wolkenkit
Documentation
News
DocumentationGetting startedUpdating wolkenkitUpdating an application

Updating an application

To update an application to the current version of wolkenkit follow the steps given below.

package.json

Previous version (1.2.0)

"wolkenkit": {
  "application": "your-app",
  "runtime": {
    "version": "1.2.0"
  },
  "...": "..."
}

Current version (latest)

"wolkenkit": {
  "application": "your-app",
  "runtime": {
    "version": "latest"
  },
  "...": "..."
}

Write model, defining commands

Previous version (1.2.0)

const commands = {
  send (message, command, mark) {
    if (...) {
      return mark.asRejected('Failed to send message.');
    }

    // ...

    mark.asDone();
  }
};

Current version (latest)

const commands = {
  async send (message, command) {
    if (...) {
      return command.reject('Failed to send message.');
    }

    // ...
  }
};

Please note that you can omit the async keyword if you don't use asynchronous code in your command. For details see defining commands.

Write model, using command middleware

Previous version (1.2.0)

const commands = {
  send: [
    (message, command, mark) => {
      if (...) {
        return mark.asRejected('Failed to validate message.');
      }

      // ...

      mark.asReadyForNext();
    },

    (message, command, mark) => {
     if (...) {
       return mark.asRejected('Failed to send message.');
     }

     // ...

     mark.asDone();
   }
  ]
};

Current version (latest)

const commands = {
  send: [
    async (message, command) => {
      if (...) {
        return command.reject('Failed to validate message.');
      }

      // ...
    },

    async (message, command) => {
     if (...) {
       return command.reject('Failed to send message.');
     }

     // ...
   }
  ]
};

Please note that you can omit the async keyword if you don't use asynchronous code in your middleware. For details see using command middleware.

Write model, using services

Previous version (1.2.0)

const commands = {
  send (message, command, services, mark) {
    const app = services.get('app');

    // ...

    mark.asDone();
  }
};

Current version (latest)

const commands = {
  async send (message, command, { app }) {
    // ...
  }
};

For details see using command services.

Read model, defining projections

Previous version (1.2.0)

const when = {
  'communication.message.sent' (messages, event, mark) {
    // ...

    mark.asDone();
  }
};

Current version (latest)

const projections = {
  async 'communication.message.sent' (messages, event) {
    // ...
  }
};

Please note that you can omit the async keyword if you don't use asynchronous code in your projections. For details see defining projections.

Read model, using services

Previous version (1.2.0)

const when = {
  'communication.message.sent' (messages, event, services, mark) {
    const app = services.get('app');

    // ...

    mark.asDone();
  }
};

Current version (latest)

const projections = {
  'communication.message.sent' (messages, event, { app }) {
    // ...
  }
};

For details see using services.

Stateless flows, reacting to events

Previous version (1.2.0)

const when = {
  'communication.message.sent' (event, mark) {
    // ...

    mark.asDone();
  }
};

Current version (latest)

const reactions = {
  async 'communication.message.sent' (event) {
    // ...
  }
};

Please note that you can omit the async keyword if you don't use asynchronous code in your reaction. For details see reacting to events.

Stateless flows, using services

Previous version (1.2.0)

const when = {
  'communication.message.sent' (event, services, mark) {
    const app = services.get('app');

    // ...

    mark.asDone();
  }
};

Current version (latest)

const reactions = {
  'communication.message.sent' (event, { app }) {
    // ...
  }
};

For details see using services.

Stateful flows, reacting to state transitions

Previous version (1.2.0)

const when = {
  pristine: {
    'awaiting-payment' (flow, event, mark) {
      // ...

      mark.asDone();
    }    
  }
};

Current version (latest)

const reactions = {
  pristine: {
    async 'awaiting-payment' (flow, event) {
      // ...
    }    
  }
};

Please note that you can omit the async keyword if you don't use asynchronous code in your reaction. For details see reacting to state transitions.

Stateful flows, using services

Previous version (1.2.0)

const when = {
  pristine: {
    'communication.message.sent' (flow, event, services, mark) {
      const app = services.get('app');

      // ...

      mark.asDone();
    }    
  }
};

Current version (latest)

const reactions = {
  pristine: {
    'communication.message.sent' (flow, event, { app }) {
      // ...
    }    
  }
};

For details see using services.