bpmn-elements 7.0.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/src/Context.js +50 -40
  3. package/dist/src/Environment.js +39 -19
  4. package/dist/src/MessageFormatter.js +11 -11
  5. package/dist/src/activity/Activity.js +91 -91
  6. package/dist/src/activity/ActivityExecution.js +35 -35
  7. package/dist/src/definition/Definition.js +50 -50
  8. package/dist/src/definition/DefinitionExecution.js +114 -125
  9. package/dist/src/eventDefinitions/CancelEventDefinition.js +16 -16
  10. package/dist/src/eventDefinitions/CompensateEventDefinition.js +24 -24
  11. package/dist/src/eventDefinitions/ConditionalEventDefinition.js +8 -8
  12. package/dist/src/eventDefinitions/ErrorEventDefinition.js +26 -26
  13. package/dist/src/eventDefinitions/EscalationEventDefinition.js +20 -20
  14. package/dist/src/eventDefinitions/EventDefinitionExecution.js +14 -14
  15. package/dist/src/eventDefinitions/LinkEventDefinition.js +15 -15
  16. package/dist/src/eventDefinitions/MessageEventDefinition.js +23 -23
  17. package/dist/src/eventDefinitions/SignalEventDefinition.js +24 -24
  18. package/dist/src/eventDefinitions/TimerEventDefinition.js +21 -21
  19. package/dist/src/events/BoundaryEvent.js +20 -20
  20. package/dist/src/events/EndEvent.js +3 -3
  21. package/dist/src/events/IntermediateCatchEvent.js +3 -3
  22. package/dist/src/events/IntermediateThrowEvent.js +3 -3
  23. package/dist/src/events/StartEvent.js +9 -9
  24. package/dist/src/flows/Association.js +7 -7
  25. package/dist/src/flows/MessageFlow.js +9 -9
  26. package/dist/src/flows/SequenceFlow.js +7 -7
  27. package/dist/src/gateways/EventBasedGateway.js +11 -11
  28. package/dist/src/io/InputOutputSpecification.js +4 -4
  29. package/dist/src/io/Properties.js +9 -9
  30. package/dist/src/process/Process.js +64 -61
  31. package/dist/src/process/ProcessExecution.js +93 -90
  32. package/dist/src/tasks/ReceiveTask.js +16 -16
  33. package/dist/src/tasks/SubProcess.js +16 -18
  34. package/package.json +9 -9
  35. package/src/Context.js +48 -40
  36. package/src/Environment.js +48 -20
  37. package/src/EventBroker.js +1 -1
  38. package/src/MessageFormatter.js +11 -11
  39. package/src/activity/Activity.js +91 -91
  40. package/src/activity/ActivityExecution.js +34 -34
  41. package/src/definition/Definition.js +51 -50
  42. package/src/definition/DefinitionExecution.js +111 -113
  43. package/src/eventDefinitions/CancelEventDefinition.js +16 -16
  44. package/src/eventDefinitions/CompensateEventDefinition.js +25 -24
  45. package/src/eventDefinitions/ConditionalEventDefinition.js +8 -8
  46. package/src/eventDefinitions/ErrorEventDefinition.js +26 -26
  47. package/src/eventDefinitions/EscalationEventDefinition.js +20 -20
  48. package/src/eventDefinitions/EventDefinitionExecution.js +14 -14
  49. package/src/eventDefinitions/LinkEventDefinition.js +15 -15
  50. package/src/eventDefinitions/MessageEventDefinition.js +23 -23
  51. package/src/eventDefinitions/SignalEventDefinition.js +24 -24
  52. package/src/eventDefinitions/TimerEventDefinition.js +21 -21
  53. package/src/events/BoundaryEvent.js +20 -20
  54. package/src/events/EndEvent.js +3 -3
  55. package/src/events/IntermediateCatchEvent.js +3 -3
  56. package/src/events/IntermediateThrowEvent.js +3 -3
  57. package/src/events/StartEvent.js +9 -9
  58. package/src/flows/Association.js +7 -7
  59. package/src/flows/MessageFlow.js +9 -9
  60. package/src/flows/SequenceFlow.js +7 -7
  61. package/src/gateways/EventBasedGateway.js +11 -11
  62. package/src/io/BpmnIO.js +5 -1
  63. package/src/io/InputOutputSpecification.js +4 -4
  64. package/src/io/Properties.js +9 -9
  65. package/src/process/Process.js +62 -58
  66. package/src/process/ProcessExecution.js +86 -88
  67. package/src/tasks/ReceiveTask.js +16 -16
  68. package/src/tasks/SubProcess.js +16 -16
@@ -13,7 +13,7 @@ var _Api = require("../Api");
13
13
 
14
14
  var _shared = require("../shared");
15
15
 
16
- const countersSymbol = Symbol.for('counters');
16
+ const kCounters = Symbol.for('counters');
17
17
 
18
18
  function Association(associationDef, {
19
19
  environment
@@ -37,7 +37,7 @@ function Association(associationDef, {
37
37
  this.isAssociation = true;
38
38
  this.environment = environment;
39
39
  const logger = this.logger = environment.Logger(type.toLowerCase());
40
- this[countersSymbol] = {
40
+ this[kCounters] = {
41
41
  complete: 0,
42
42
  take: 0,
43
43
  discard: 0
@@ -64,7 +64,7 @@ Object.defineProperty(proto, 'counters', {
64
64
  enumerable: true,
65
65
 
66
66
  get() {
67
- return { ...this[countersSymbol]
67
+ return { ...this[kCounters]
68
68
  };
69
69
  }
70
70
 
@@ -72,7 +72,7 @@ Object.defineProperty(proto, 'counters', {
72
72
 
73
73
  proto.take = function take(content = {}) {
74
74
  this.logger.debug(`<${this.id}> take target <${this.targetId}>`);
75
- ++this[countersSymbol].take;
75
+ ++this[kCounters].take;
76
76
 
77
77
  this._publishEvent('take', content);
78
78
 
@@ -81,7 +81,7 @@ proto.take = function take(content = {}) {
81
81
 
82
82
  proto.discard = function discard(content = {}) {
83
83
  this.logger.debug(`<${this.id}> discard target <${this.targetId}>`);
84
- ++this[countersSymbol].discard;
84
+ ++this[kCounters].discard;
85
85
 
86
86
  this._publishEvent('discard', content);
87
87
 
@@ -90,7 +90,7 @@ proto.discard = function discard(content = {}) {
90
90
 
91
91
  proto.complete = function complete(content = {}) {
92
92
  this.logger.debug(`<${this.id}> completed target <${this.targetId}>`);
93
- ++this[countersSymbol].complete;
93
+ ++this[kCounters].complete;
94
94
 
95
95
  this._publishEvent('complete', content);
96
96
 
@@ -105,7 +105,7 @@ proto.getState = function getState() {
105
105
  };
106
106
 
107
107
  proto.recover = function recover(state) {
108
- Object.assign(this[countersSymbol], state.counters);
108
+ Object.assign(this[kCounters], state.counters);
109
109
  this.broker.recover(state.broker);
110
110
  };
111
111
 
@@ -11,8 +11,8 @@ var _messageHelper = require("../messageHelper");
11
11
 
12
12
  var _EventBroker = require("../EventBroker");
13
13
 
14
- const countersSymbol = Symbol.for('counters');
15
- const sourceElementSymbol = Symbol.for('sourceElement');
14
+ const kCounters = Symbol.for('counters');
15
+ const kSourceElement = Symbol.for('sourceElement');
16
16
 
17
17
  function MessageFlow(flowDef, context) {
18
18
  const {
@@ -33,7 +33,7 @@ function MessageFlow(flowDef, context) {
33
33
  this.behaviour = behaviour;
34
34
  this.environment = context.environment;
35
35
  this.context = context;
36
- this[countersSymbol] = {
36
+ this[kCounters] = {
37
37
  messages: 0
38
38
  };
39
39
  const {
@@ -48,7 +48,7 @@ function MessageFlow(flowDef, context) {
48
48
  this.once = once;
49
49
  this.emit = emit;
50
50
  this.waitFor = waitFor;
51
- this[sourceElementSymbol] = context.getActivityById(source.id) || context.getProcessById(source.processId);
51
+ this[kSourceElement] = context.getActivityById(source.id) || context.getProcessById(source.processId);
52
52
  this.logger = context.environment.Logger(type.toLowerCase());
53
53
  }
54
54
 
@@ -57,7 +57,7 @@ Object.defineProperty(proto, 'counters', {
57
57
  enumerable: true,
58
58
 
59
59
  get() {
60
- return { ...this[countersSymbol]
60
+ return { ...this[kCounters]
61
61
  };
62
62
  }
63
63
 
@@ -72,7 +72,7 @@ proto.getState = function getState() {
72
72
  };
73
73
 
74
74
  proto.recover = function recover(state) {
75
- Object.assign(this[countersSymbol], state.counters);
75
+ Object.assign(this[kCounters], state.counters);
76
76
  };
77
77
 
78
78
  proto.getApi = function getApi() {
@@ -80,7 +80,7 @@ proto.getApi = function getApi() {
80
80
  };
81
81
 
82
82
  proto.activate = function activate() {
83
- const sourceElement = this[sourceElementSymbol];
83
+ const sourceElement = this[kSourceElement];
84
84
  const safeId = (0, _shared.brokerSafeId)(this.id);
85
85
  sourceElement.on('message', this.deactivate.bind(this), {
86
86
  consumerTag: `_message-on-message-${safeId}`
@@ -91,7 +91,7 @@ proto.activate = function activate() {
91
91
  };
92
92
 
93
93
  proto.deactivate = function deactivate() {
94
- const sourceElement = this[sourceElementSymbol];
94
+ const sourceElement = this[kSourceElement];
95
95
  const safeId = (0, _shared.brokerSafeId)(this.id);
96
96
  sourceElement.broker.cancel(`_message-on-end-${safeId}`);
97
97
  sourceElement.broker.cancel(`_message-on-message-${safeId}`);
@@ -100,7 +100,7 @@ proto.deactivate = function deactivate() {
100
100
  proto._onSourceEnd = function onSourceEnd({
101
101
  content
102
102
  }) {
103
- ++this[countersSymbol].messages;
103
+ ++this[kCounters].messages;
104
104
  const source = this.source;
105
105
  const target = this.target;
106
106
  this.logger.debug(`<${this.id}> sending message from <${source.processId}.${source.id}> to <${target.id ? `${target.processId}.${target.id}` : target.processId}>`);
@@ -17,7 +17,7 @@ var _Api = require("../Api");
17
17
 
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
19
 
20
- const countersSymbol = Symbol.for('counters');
20
+ const kCounters = Symbol.for('counters');
21
21
  var _default = SequenceFlow;
22
22
  exports.default = _default;
23
23
 
@@ -45,7 +45,7 @@ function SequenceFlow(flowDef, {
45
45
  this.isSequenceFlow = true;
46
46
  this.environment = environment;
47
47
  const logger = this.logger = environment.Logger(type.toLowerCase());
48
- this[countersSymbol] = {
48
+ this[kCounters] = {
49
49
  looped: 0,
50
50
  take: 0,
51
51
  discard: 0
@@ -75,7 +75,7 @@ Object.defineProperty(proto, 'counters', {
75
75
  enumerable: true,
76
76
 
77
77
  get() {
78
- return { ...this[countersSymbol]
78
+ return { ...this[kCounters]
79
79
  };
80
80
  }
81
81
 
@@ -87,7 +87,7 @@ proto.take = function take(content = {}) {
87
87
  sequenceId
88
88
  } = content;
89
89
  this.logger.debug(`<${sequenceId} (${this.id})> take, target <${this.targetId}>`);
90
- ++this[countersSymbol].take;
90
+ ++this[kCounters].take;
91
91
 
92
92
  this._publishEvent('take', content);
93
93
 
@@ -101,14 +101,14 @@ proto.discard = function discard(content = {}) {
101
101
  const discardSequence = content.discardSequence = (content.discardSequence || []).slice();
102
102
 
103
103
  if (discardSequence.indexOf(this.targetId) > -1) {
104
- ++this[countersSymbol].looped;
104
+ ++this[kCounters].looped;
105
105
  this.logger.debug(`<${this.id}> discard loop detected <${this.sourceId}> -> <${this.targetId}>. Stop.`);
106
106
  return this._publishEvent('looped', content);
107
107
  }
108
108
 
109
109
  discardSequence.push(this.sourceId);
110
110
  this.logger.debug(`<${sequenceId} (${this.id})> discard, target <${this.targetId}>`);
111
- ++this[countersSymbol].discard;
111
+ ++this[kCounters].discard;
112
112
 
113
113
  this._publishEvent('discard', content);
114
114
  };
@@ -121,7 +121,7 @@ proto.getState = function getState() {
121
121
  };
122
122
 
123
123
  proto.recover = function recover(state) {
124
- Object.assign(this[countersSymbol], state.counters);
124
+ Object.assign(this[kCounters], state.counters);
125
125
  this.broker.recover(state.broker);
126
126
  };
127
127
 
@@ -12,8 +12,8 @@ var _messageHelper = require("../messageHelper");
12
12
 
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
14
 
15
- const completedSymbol = Symbol.for('completed');
16
- const targetsSymbol = Symbol.for('targets');
15
+ const kCompleted = Symbol.for('completed');
16
+ const kTargets = Symbol.for('targets');
17
17
 
18
18
  function EventBasedGateway(activityDef, context) {
19
19
  return new _Activity.default(EventBasedGatewayBehaviour, activityDef, context);
@@ -25,7 +25,7 @@ function EventBasedGatewayBehaviour(activity, context) {
25
25
  this.activity = activity;
26
26
  this.broker = activity.broker;
27
27
  this.context = context;
28
- this[targetsSymbol] = activity.outbound.map(flow => context.getActivityById(flow.targetId));
28
+ this[kTargets] = activity.outbound.map(flow => context.getActivityById(flow.targetId));
29
29
  }
30
30
 
31
31
  EventBasedGatewayBehaviour.prototype.execute = function execute(executeMessage) {
@@ -35,8 +35,8 @@ EventBasedGatewayBehaviour.prototype.execute = function execute(executeMessage)
35
35
  outbound = [],
36
36
  outboundTaken
37
37
  } = executeContent;
38
- const targets = this[targetsSymbol];
39
- this[completedSymbol] = false;
38
+ const targets = this[kTargets];
39
+ this[kCompleted] = false;
40
40
  if (!targets.length) return this._complete(executeContent);
41
41
 
42
42
  for (const flow of this.activity.outbound) {
@@ -46,12 +46,12 @@ EventBasedGatewayBehaviour.prototype.execute = function execute(executeMessage)
46
46
  });
47
47
  }
48
48
 
49
- if (!this[completedSymbol] && outboundTaken) return;
49
+ if (!this[kCompleted] && outboundTaken) return;
50
50
  const targetConsumerTag = `_gateway-listener-${this.id}`;
51
51
 
52
52
  const onTargetCompleted = this._onTargetCompleted.bind(this, executeMessage);
53
53
 
54
- for (const target of this[targetsSymbol]) {
54
+ for (const target of this[kTargets]) {
55
55
  target.broker.subscribeOnce('event', 'activity.end', onTargetCompleted, {
56
56
  consumerTag: targetConsumerTag
57
57
  });
@@ -62,7 +62,7 @@ EventBasedGatewayBehaviour.prototype.execute = function execute(executeMessage)
62
62
  noAck: true,
63
63
  consumerTag: '_api-stop-execution'
64
64
  });
65
- this[completedSymbol] = false;
65
+ this[kCompleted] = false;
66
66
  if (!executeMessage.fields.redelivered) return broker.publish('execution', 'execute.outbound.take', (0, _messageHelper.cloneContent)(executeContent, {
67
67
  outboundTaken: true
68
68
  }));
@@ -79,7 +79,7 @@ EventBasedGatewayBehaviour.prototype._onTargetCompleted = function onTargetCompl
79
79
 
80
80
  this._stop();
81
81
 
82
- for (const target of this[targetsSymbol]) {
82
+ for (const target of this[kTargets]) {
83
83
  if (target === owner) continue;
84
84
  target.discard();
85
85
  }
@@ -96,14 +96,14 @@ EventBasedGatewayBehaviour.prototype._onTargetCompleted = function onTargetCompl
96
96
  };
97
97
 
98
98
  EventBasedGatewayBehaviour.prototype._complete = function complete(completedContent) {
99
- this[completedSymbol] = true;
99
+ this[kCompleted] = true;
100
100
  this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(completedContent));
101
101
  };
102
102
 
103
103
  EventBasedGatewayBehaviour.prototype._stop = function stop() {
104
104
  const targetConsumerTag = `_gateway-listener-${this.id}`;
105
105
 
106
- for (const target of this[targetsSymbol]) target.broker.cancel(targetConsumerTag);
106
+ for (const target of this[kTargets]) target.broker.cancel(targetConsumerTag);
107
107
 
108
108
  this.broker.cancel('_api-stop-execution');
109
109
  };
@@ -11,7 +11,7 @@ var _shared = require("../shared");
11
11
 
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
 
14
- const consumingSymbol = Symbol.for('consuming');
14
+ const kConsuming = Symbol.for('consuming');
15
15
 
16
16
  function IoSpecification(activity, ioSpecificationDef, context) {
17
17
  const {
@@ -30,14 +30,14 @@ function IoSpecification(activity, ioSpecificationDef, context) {
30
30
  const proto = IoSpecification.prototype;
31
31
 
32
32
  proto.activate = function activate() {
33
- if (this[consumingSymbol]) return;
34
- this[consumingSymbol] = this.broker.subscribeTmp('event', 'activity.#', this._onActivityEvent.bind(this), {
33
+ if (this[kConsuming]) return;
34
+ this[kConsuming] = this.broker.subscribeTmp('event', 'activity.#', this._onActivityEvent.bind(this), {
35
35
  noAck: true
36
36
  });
37
37
  };
38
38
 
39
39
  proto.deactivate = function deactivate() {
40
- if (this[consumingSymbol]) this[consumingSymbol] = this[consumingSymbol].cancel();
40
+ if (this[kConsuming]) this[kConsuming] = this[kConsuming].cancel();
41
41
  };
42
42
 
43
43
  proto._onActivityEvent = function onActivityEvent(routingKey, message) {
@@ -9,13 +9,13 @@ var _getPropertyValue = _interopRequireDefault(require("../getPropertyValue"));
9
9
 
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
 
12
- const propertiesSymbol = Symbol.for('properties');
13
- const consumingSymbol = Symbol.for('consuming');
12
+ const kProperties = Symbol.for('properties');
13
+ const kConsuming = Symbol.for('consuming');
14
14
 
15
15
  function Properties(activity, propertiesDef, context) {
16
16
  this.activity = activity;
17
17
  this.broker = activity.broker;
18
- const props = this[propertiesSymbol] = {
18
+ const props = this[kProperties] = {
19
19
  properties: [],
20
20
  dataInputObjects: [],
21
21
  dataOutputObjects: []
@@ -85,19 +85,19 @@ function Properties(activity, propertiesDef, context) {
85
85
  const proto = Properties.prototype;
86
86
 
87
87
  proto.activate = function activate(message) {
88
- if (this[consumingSymbol]) return;
88
+ if (this[kConsuming]) return;
89
89
 
90
90
  if (message.fields.redelivered && message.content.properties) {
91
91
  this._onActivityEvent('activity.extension.resume', message);
92
92
  }
93
93
 
94
- this[consumingSymbol] = this.broker.subscribeTmp('event', 'activity.#', this._onActivityEvent.bind(this), {
94
+ this[kConsuming] = this.broker.subscribeTmp('event', 'activity.#', this._onActivityEvent.bind(this), {
95
95
  noAck: true
96
96
  });
97
97
  };
98
98
 
99
99
  proto.deactivate = function deactivate() {
100
- if (this[consumingSymbol]) this[consumingSymbol] = this[consumingSymbol].cancel();
100
+ if (this[kConsuming]) this[kConsuming] = this[kConsuming].cancel();
101
101
  };
102
102
 
103
103
  proto._onActivityEvent = function onActivityEvent(routingKey, message) {
@@ -116,7 +116,7 @@ proto._onActivityEvent = function onActivityEvent(routingKey, message) {
116
116
 
117
117
  proto._formatOnEnter = function formatOnEnter(message) {
118
118
  const startRoutingKey = 'run.enter.bpmn-properties';
119
- const dataInputObjects = this[propertiesSymbol].dataInputObjects;
119
+ const dataInputObjects = this[kProperties].dataInputObjects;
120
120
  const broker = this.broker;
121
121
 
122
122
  if (!dataInputObjects.length) {
@@ -147,7 +147,7 @@ proto._formatOnComplete = function formatOnComplete(message) {
147
147
 
148
148
  const outputProperties = this._getProperties(message, messageOutput);
149
149
 
150
- const dataOutputObjects = this[propertiesSymbol].dataOutputObjects;
150
+ const dataOutputObjects = this[kProperties].dataOutputObjects;
151
151
  const broker = this.broker;
152
152
 
153
153
  if (!dataOutputObjects.length) {
@@ -184,7 +184,7 @@ proto._getProperties = function getProperties(message, values) {
184
184
  id,
185
185
  type,
186
186
  name
187
- } of this[propertiesSymbol].properties) {
187
+ } of this[kProperties].properties) {
188
188
  if (!(id in response)) {
189
189
  response[id] = {
190
190
  id,