How to use @opuscapita/fsm-workflow-core - 10 common examples

To help you get started, we’ve selected a few @opuscapita/fsm-workflow-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OpusCapita / fsm-workflow / packages / examples / invoice-console / index.js View on Github external
let fs = require("fs");

let { startForm, eventForm, restartForm } = require("./forms").default;

let {MachineDefinition, Machine} = require("@opuscapita/fsm-workflow-core");

let machineSchemaAsText = fs.readFileSync("./machine-schema.json", "utf8");

let machineDefinition = new MachineDefinition({
  schema: JSON.parse(machineSchemaAsText),
  objectConfiguration: {
    stateFieldName: "status"
  },
});

let invoiceMachine = new Machine({
  machineDefinition,
  convertObjectToReference: (o) => {
    return {
      //...we don't need it here
    }
  }
});

let invoice = {
  status: "none"
};

let blessed = require("blessed");
let program = blessed.program();

// Create a screen object.
github OpusCapita / fsm-workflow / crud-editor / src / components / WorkflowEditor / WorkflowEditor.react.js View on Github external
constructor(props) {
    super(props);

    this.state = {
      machine: new MachineDefinition(props.workflow),
      selectedStates: [],
      selectedTransitions: [],
      activeTabKey: 0
    };
  }
github OpusCapita / fsm-workflow / packages / task-manager / src / specs / TaskManager.eventSending.spec.js View on Github external
describe('Task manager:event sending', function() {
  const machine = new Machine({
    machineDefinition: new MachineDefinition({
      objectConfiguration: {
        "stateFieldName": "status"
      },
      schema: {
        "name": "test",
        "initialState": "init",
        "finalStates": [
          "finished"
        ],
        "transitions": [
          {
            "from": "init",
            "event": "finish",
            "to": "finished",
          }
        ]
github OpusCapita / fsm-workflow / packages / examples / process-task-manager-ui / src / client / components / Container.react.js View on Github external
constructor(props) {
    super(props);

    this.processMachine = new Machine({
      machineDefinition: new MachineDefinition({
        schema: require('../workflow/process-schema.json'),
        objectConfiguration: require('../workflow/objectConfiguration.json'),
        actions: require('../workflow/actions').default,
        conditions: require('../workflow/conditions').default
      }),
      context: {
        sendNotification: ({ notification }) => {
          this._notificationSystem.addNotification(notification);
        }
      },
      convertObjectToReference: (o) => {
        return {
          //...we don't need it here
        }
      }
    });
github OpusCapita / fsm-workflow / packages / examples / complete-demo / src / server / fsm / fsm.js View on Github external
get machine() {
    return new Machine({
      machineDefinition: new MachineDefinition({
        schema: schema.getSchema(),
        actions,
        conditions,
        objectConfiguration: objectConfig.getConfig()
      }),
      convertObjectToReference: object => ({
        businessObjType: 'invoice',
        businessObjId: object[objectIdProp]
      }),
      history: this.history
    })
  }
}
github OpusCapita / fsm-workflow / crud-editor / src / components / WorkflowEditor / WorkflowEditor.react.js View on Github external
componentWillReceiveProps(nextProps) {
    if (!isEqual(nextProps.workflow, this.props.workflow)) {
      this.setState({
        machine: new MachineDefinition(nextProps.workflow)
      });
    }
  }
github OpusCapita / fsm-workflow / packages / examples / invoice-console / index.js View on Github external
let fs = require("fs");

let { startForm, eventForm, restartForm } = require("./forms").default;

let {MachineDefinition, Machine} = require("@opuscapita/fsm-workflow-core");

let machineSchemaAsText = fs.readFileSync("./machine-schema.json", "utf8");

let machineDefinition = new MachineDefinition({
  schema: JSON.parse(machineSchemaAsText),
  objectConfiguration: {
    stateFieldName: "status"
  },
});

let invoiceMachine = new Machine({
  machineDefinition,
  convertObjectToReference: (o) => {
    return {
      //...we don't need it here
    }
  }
});

let invoice = {
github OpusCapita / fsm-workflow / task-manager / src / specs / TaskManager.eventSending.spec.js View on Github external
describe('Task manager:event sending', function() {
  const machine = new Machine({
    machineDefinition: new MachineDefinition({
      schema: {
        "name": "test",
        "initialState": "init",
        "finalStates": [
          "finished"
        ],
        "objectStateFieldName": "status",
        "transitions": [
          {
            "from": "init",
            "event": "finish",
            "to": "finished",
          }
        ]
      }
    })
github OpusCapita / fsm-workflow / packages / task-manager / src / specs / TaskManager.monitoring.spec.js View on Github external
describe('Task manager:monitoring', function() {
  const machine = new Machine({
    machineDefinition: new MachineDefinition({
      objectConfiguration: {
        "stateFieldName": "status"
      },
      schema: {
        "name": "test",
        "initialState": "init",
        "finalStates": [
          "finished"
        ],
        "transitions": [
          {
            "from": "init",
            "event": "autoFinish",
            "to": "finished",
            "automatic": true
          }
github OpusCapita / fsm-workflow / packages / task-manager / src / specs / TaskManager.eventSending.spec.js View on Github external
describe('Task manager:event sending', function() {
  const machine = new Machine({
    machineDefinition: new MachineDefinition({
      objectConfiguration: {
        "stateFieldName": "status"
      },
      schema: {
        "name": "test",
        "initialState": "init",
        "finalStates": [
          "finished"
        ],
        "transitions": [
          {
            "from": "init",
            "event": "finish",
            "to": "finished",
          }

@opuscapita/fsm-workflow-core

FSM workflow (for Node.js)

Apache-2.0
Latest version published 3 years ago

Package Health Score

49 / 100
Full package analysis