bpmn-elements 8.2.3 → 9.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 (123) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/{src/Api.js → Api.js} +11 -12
  3. package/dist/{src/Context.js → Context.js} +26 -27
  4. package/dist/{src/Environment.js → Environment.js} +15 -16
  5. package/dist/{src/EventBroker.js → EventBroker.js} +8 -2
  6. package/dist/{src/Expressions.js → Expressions.js} +1 -1
  7. package/dist/{src/MessageFormatter.js → MessageFormatter.js} +3 -3
  8. package/dist/{src/activity → activity}/Activity.js +62 -63
  9. package/dist/{src/activity → activity}/ActivityExecution.js +23 -24
  10. package/dist/{src/activity → activity}/Dummy.js +1 -1
  11. package/dist/{src/activity → activity}/ExecutionScope.js +2 -2
  12. package/dist/{src/definition → definition}/Definition.js +41 -42
  13. package/dist/{src/definition → definition}/DefinitionExecution.js +45 -46
  14. package/dist/{src/error → error}/Errors.js +1 -1
  15. package/dist/{src/eventDefinitions → eventDefinitions}/CancelEventDefinition.js +12 -13
  16. package/dist/{src/eventDefinitions → eventDefinitions}/CompensateEventDefinition.js +12 -13
  17. package/dist/{src/eventDefinitions → eventDefinitions}/ConditionalEventDefinition.js +13 -14
  18. package/dist/{src/eventDefinitions → eventDefinitions}/ErrorEventDefinition.js +13 -14
  19. package/dist/{src/eventDefinitions → eventDefinitions}/EscalationEventDefinition.js +12 -13
  20. package/dist/{src/eventDefinitions → eventDefinitions}/EventDefinitionExecution.js +10 -11
  21. package/dist/{src/eventDefinitions → eventDefinitions}/LinkEventDefinition.js +14 -15
  22. package/dist/{src/eventDefinitions → eventDefinitions}/MessageEventDefinition.js +13 -14
  23. package/dist/{src/eventDefinitions → eventDefinitions}/SignalEventDefinition.js +13 -14
  24. package/dist/{src/eventDefinitions → eventDefinitions}/TerminateEventDefinition.js +1 -1
  25. package/dist/{src/eventDefinitions → eventDefinitions}/TimerEventDefinition.js +15 -16
  26. package/dist/{src/events → events}/BoundaryEvent.js +15 -16
  27. package/dist/{src/events → events}/EndEvent.js +3 -3
  28. package/dist/{src/events → events}/IntermediateCatchEvent.js +3 -3
  29. package/dist/{src/events → events}/IntermediateThrowEvent.js +3 -3
  30. package/dist/{src/events → events}/StartEvent.js +8 -9
  31. package/dist/{src/flows → flows}/Association.js +15 -16
  32. package/dist/{src/flows → flows}/MessageFlow.js +16 -14
  33. package/dist/{src/flows → flows}/SequenceFlow.js +16 -18
  34. package/dist/{src/gateways → gateways}/EventBasedGateway.js +2 -2
  35. package/dist/{src/gateways → gateways}/ExclusiveGateway.js +2 -2
  36. package/dist/{src/gateways → gateways}/InclusiveGateway.js +2 -2
  37. package/dist/{src/gateways → gateways}/ParallelGateway.js +2 -2
  38. package/dist/index.js +48 -48
  39. package/dist/{src/io → io}/InputOutputSpecification.js +8 -9
  40. package/dist/{src/io → io}/Properties.js +7 -8
  41. package/dist/package.json +3 -0
  42. package/dist/{src/process → process}/Process.js +39 -40
  43. package/dist/{src/process → process}/ProcessExecution.js +55 -48
  44. package/dist/{src/tasks → tasks}/CallActivity.js +7 -8
  45. package/dist/{src/tasks → tasks}/LoopCharacteristics.js +2 -2
  46. package/dist/{src/tasks → tasks}/ReceiveTask.js +14 -15
  47. package/dist/{src/tasks → tasks}/ScriptTask.js +4 -4
  48. package/dist/{src/tasks → tasks}/ServiceImplementation.js +1 -1
  49. package/dist/{src/tasks → tasks}/ServiceTask.js +6 -7
  50. package/dist/{src/tasks → tasks}/SignalTask.js +7 -8
  51. package/dist/{src/tasks → tasks}/StandardLoopCharacteristics.js +1 -1
  52. package/dist/{src/tasks → tasks}/SubProcess.js +17 -18
  53. package/dist/{src/tasks → tasks}/Task.js +2 -2
  54. package/dist/{src/tasks → tasks}/Transaction.js +1 -1
  55. package/package.json +31 -31
  56. package/src/Api.js +11 -13
  57. package/src/Context.js +26 -28
  58. package/src/Environment.js +15 -17
  59. package/src/EventBroker.js +5 -2
  60. package/src/Expressions.js +1 -1
  61. package/src/MessageFormatter.js +3 -3
  62. package/src/activity/Activity.js +62 -64
  63. package/src/activity/ActivityExecution.js +23 -25
  64. package/src/activity/Dummy.js +1 -1
  65. package/src/activity/ExecutionScope.js +2 -2
  66. package/src/definition/Definition.js +41 -43
  67. package/src/definition/DefinitionExecution.js +45 -47
  68. package/src/error/Errors.js +1 -1
  69. package/src/eventDefinitions/CancelEventDefinition.js +12 -14
  70. package/src/eventDefinitions/CompensateEventDefinition.js +12 -14
  71. package/src/eventDefinitions/ConditionalEventDefinition.js +13 -15
  72. package/src/eventDefinitions/ErrorEventDefinition.js +13 -15
  73. package/src/eventDefinitions/EscalationEventDefinition.js +12 -14
  74. package/src/eventDefinitions/EventDefinitionExecution.js +10 -12
  75. package/src/eventDefinitions/LinkEventDefinition.js +14 -16
  76. package/src/eventDefinitions/MessageEventDefinition.js +13 -15
  77. package/src/eventDefinitions/SignalEventDefinition.js +13 -15
  78. package/src/eventDefinitions/TerminateEventDefinition.js +1 -1
  79. package/src/eventDefinitions/TimerEventDefinition.js +15 -17
  80. package/src/events/BoundaryEvent.js +15 -17
  81. package/src/events/EndEvent.js +3 -3
  82. package/src/events/IntermediateCatchEvent.js +3 -3
  83. package/src/events/IntermediateThrowEvent.js +3 -3
  84. package/src/events/StartEvent.js +8 -10
  85. package/src/flows/Association.js +15 -17
  86. package/src/flows/MessageFlow.js +14 -15
  87. package/src/flows/SequenceFlow.js +16 -20
  88. package/src/gateways/EventBasedGateway.js +2 -2
  89. package/src/gateways/ExclusiveGateway.js +2 -2
  90. package/src/gateways/InclusiveGateway.js +2 -2
  91. package/src/gateways/ParallelGateway.js +2 -2
  92. package/src/index.js +106 -0
  93. package/src/io/InputOutputSpecification.js +8 -10
  94. package/src/io/Properties.js +7 -9
  95. package/src/process/Process.js +39 -41
  96. package/src/process/ProcessExecution.js +55 -49
  97. package/src/tasks/CallActivity.js +7 -9
  98. package/src/tasks/LoopCharacteristics.js +2 -2
  99. package/src/tasks/ReceiveTask.js +215 -217
  100. package/src/tasks/ScriptTask.js +4 -4
  101. package/src/tasks/ServiceImplementation.js +1 -1
  102. package/src/tasks/ServiceTask.js +6 -8
  103. package/src/tasks/SignalTask.js +7 -9
  104. package/src/tasks/StandardLoopCharacteristics.js +1 -1
  105. package/src/tasks/SubProcess.js +17 -19
  106. package/src/tasks/Task.js +2 -2
  107. package/src/tasks/Transaction.js +1 -1
  108. package/types/index.d.ts +491 -0
  109. package/index.js +0 -106
  110. /package/dist/{src/ExtensionsMapper.js → ExtensionsMapper.js} +0 -0
  111. /package/dist/{src/Scripts.js → Scripts.js} +0 -0
  112. /package/dist/{src/Timers.js → Timers.js} +0 -0
  113. /package/dist/{src/activity → activity}/Escalation.js +0 -0
  114. /package/dist/{src/activity → activity}/Message.js +0 -0
  115. /package/dist/{src/activity → activity}/Signal.js +0 -0
  116. /package/dist/{src/error → error}/BpmnError.js +0 -0
  117. /package/dist/{src/getPropertyValue.js → getPropertyValue.js} +0 -0
  118. /package/dist/{src/io → io}/BpmnIO.js +0 -0
  119. /package/dist/{src/io → io}/EnvironmentDataObject.js +0 -0
  120. /package/dist/{src/io → io}/EnvironmentDataStore.js +0 -0
  121. /package/dist/{src/io → io}/EnvironmentDataStoreReference.js +0 -0
  122. /package/dist/{src/messageHelper.js → messageHelper.js} +0 -0
  123. /package/dist/{src/shared.js → shared.js} +0 -0
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = CancelEventDefinition;
7
- var _shared = require("../shared");
8
- var _messageHelper = require("../messageHelper");
7
+ var _shared = require("../shared.js");
8
+ var _messageHelper = require("../messageHelper.js");
9
9
  const kMessageQ = Symbol.for('cancelQ');
10
10
  const kCompleted = Symbol.for('completed');
11
11
  const kExecuteMessage = Symbol.for('executeMessage');
@@ -40,17 +40,16 @@ function CancelEventDefinition(activity, eventDefinition) {
40
40
  });
41
41
  }
42
42
  }
43
- const proto = CancelEventDefinition.prototype;
44
- Object.defineProperty(proto, 'executionId', {
43
+ Object.defineProperty(CancelEventDefinition.prototype, 'executionId', {
45
44
  get() {
46
45
  const message = this[kExecuteMessage];
47
46
  return message && message.content.executionId;
48
47
  }
49
48
  });
50
- proto.execute = function execute(executeMessage) {
49
+ CancelEventDefinition.prototype.execute = function execute(executeMessage) {
51
50
  return this.isThrowing ? this.executeThrow(executeMessage) : this.executeCatch(executeMessage);
52
51
  };
53
- proto.executeCatch = function executeCatch(executeMessage) {
52
+ CancelEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
54
53
  this[kExecuteMessage] = executeMessage;
55
54
  this[kCompleted] = false;
56
55
  const executeContent = executeMessage.content;
@@ -86,7 +85,7 @@ proto.executeCatch = function executeCatch(executeMessage) {
86
85
  exchangeKey
87
86
  }));
88
87
  };
89
- proto.executeThrow = function executeThrow(executeMessage) {
88
+ CancelEventDefinition.prototype.executeThrow = function executeThrow(executeMessage) {
90
89
  const {
91
90
  isTransaction
92
91
  } = this.environment.variables.content || {};
@@ -109,12 +108,12 @@ proto.executeThrow = function executeThrow(executeMessage) {
109
108
  });
110
109
  return broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(executeContent));
111
110
  };
112
- proto._onCatchMessage = function onCatchMessage(_, message) {
111
+ CancelEventDefinition.prototype._onCatchMessage = function onCatchMessage(_, message) {
113
112
  if (message.content && message.content.isTransaction) return this._onCancelTransaction(_, message);
114
113
  this._debug(`cancel caught from <${message.content.id}>`);
115
114
  return this._complete(message.content.message);
116
115
  };
117
- proto._onCancelTransaction = function onCancelTransaction(_, message) {
116
+ CancelEventDefinition.prototype._onCancelTransaction = function onCancelTransaction(_, message) {
118
117
  const broker = this.broker,
119
118
  executionId = this.executionId;
120
119
  const executeContent = this[kExecuteMessage].content;
@@ -143,7 +142,7 @@ proto._onCancelTransaction = function onCancelTransaction(_, message) {
143
142
  consumerTag: `_oncancelend-${executionId}`
144
143
  });
145
144
  };
146
- proto._complete = function complete(output) {
145
+ CancelEventDefinition.prototype._complete = function complete(output) {
147
146
  this[kCompleted] = true;
148
147
  this._stop();
149
148
  this._debug('completed');
@@ -153,7 +152,7 @@ proto._complete = function complete(output) {
153
152
  });
154
153
  return this.broker.publish('execution', 'execute.completed', content);
155
154
  };
156
- proto._onApiMessage = function onApiMessage(routingKey, message) {
155
+ CancelEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey, message) {
157
156
  switch (message.properties.type) {
158
157
  case 'discard':
159
158
  {
@@ -169,7 +168,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
169
168
  }
170
169
  }
171
170
  };
172
- proto._stop = function stop() {
171
+ CancelEventDefinition.prototype._stop = function stop() {
173
172
  const broker = this.broker,
174
173
  executionId = this.executionId;
175
174
  broker.cancel(`_api-parent-${executionId}`);
@@ -179,6 +178,6 @@ proto._stop = function stop() {
179
178
  broker.cancel(`_onattached-cancel-${executionId}`);
180
179
  this[kMessageQ].purge();
181
180
  };
182
- proto._debug = function debug(msg) {
181
+ CancelEventDefinition.prototype._debug = function debug(msg) {
183
182
  this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
184
183
  };
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = CompensateEventDefinition;
7
- var _shared = require("../shared");
8
- var _messageHelper = require("../messageHelper");
7
+ var _shared = require("../shared.js");
8
+ var _messageHelper = require("../messageHelper.js");
9
9
  const kCompleted = Symbol.for('completed');
10
10
  const kExecuteMessage = Symbol.for('executeMessage');
11
11
  const kMessageQ = Symbol.for('messageQ');
@@ -41,17 +41,16 @@ function CompensateEventDefinition(activity, eventDefinition, context) {
41
41
  });
42
42
  }
43
43
  }
44
- const proto = CompensateEventDefinition.prototype;
45
- Object.defineProperty(proto, 'executionId', {
44
+ Object.defineProperty(CompensateEventDefinition.prototype, 'executionId', {
46
45
  get() {
47
46
  const message = this[kExecuteMessage];
48
47
  return message && message.content.executionId;
49
48
  }
50
49
  });
51
- proto.execute = function execute(executeMessage) {
50
+ CompensateEventDefinition.prototype.execute = function execute(executeMessage) {
52
51
  return this.isThrowing ? this.executeThrow(executeMessage) : this.executeCatch(executeMessage);
53
52
  };
54
- proto.executeCatch = function executeCatch(executeMessage) {
53
+ CompensateEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
55
54
  this[kExecuteMessage] = executeMessage;
56
55
  this[kCompleted] = false;
57
56
  const executeContent = executeMessage.content;
@@ -91,7 +90,7 @@ proto.executeCatch = function executeCatch(executeMessage) {
91
90
  detachContent.parent = (0, _messageHelper.shiftParent)(parent);
92
91
  broker.publish('event', 'activity.detach', detachContent);
93
92
  };
94
- proto.executeThrow = function executeThrow(executeMessage) {
93
+ CompensateEventDefinition.prototype.executeThrow = function executeThrow(executeMessage) {
95
94
  const executeContent = executeMessage.content;
96
95
  const {
97
96
  executionId,
@@ -111,7 +110,7 @@ proto.executeThrow = function executeThrow(executeMessage) {
111
110
  });
112
111
  return broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(executeContent));
113
112
  };
114
- proto._onCollect = function onCollect(routingKey, message) {
113
+ CompensateEventDefinition.prototype._onCollect = function onCollect(routingKey, message) {
115
114
  switch (routingKey) {
116
115
  case 'execute.error':
117
116
  case 'execute.completed':
@@ -120,7 +119,7 @@ proto._onCollect = function onCollect(routingKey, message) {
120
119
  }
121
120
  }
122
121
  };
123
- proto._onCompensateApiMessage = function onCompensateApiMessage(routingKey, message) {
122
+ CompensateEventDefinition.prototype._onCompensateApiMessage = function onCompensateApiMessage(routingKey, message) {
124
123
  const output = message.content.message;
125
124
  this[kCompleted] = true;
126
125
  this._stop();
@@ -152,10 +151,10 @@ proto._onCompensateApiMessage = function onCompensateApiMessage(routingKey, mess
152
151
  }));
153
152
  }
154
153
  };
155
- proto._onCollected = function onCollected(routingKey, message) {
154
+ CompensateEventDefinition.prototype._onCollected = function onCollected(routingKey, message) {
156
155
  for (const association of this[kAssociations]) association.take((0, _messageHelper.cloneMessage)(message));
157
156
  };
158
- proto._onApiMessage = function onApiMessage(routingKey, message) {
157
+ CompensateEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey, message) {
159
158
  const messageType = message.properties.type;
160
159
  switch (messageType) {
161
160
  case 'compensate':
@@ -176,7 +175,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
176
175
  }
177
176
  }
178
177
  };
179
- proto._stop = function stop() {
178
+ CompensateEventDefinition.prototype._stop = function stop() {
180
179
  const broker = this.broker,
181
180
  executionId = this.executionId;
182
181
  broker.cancel(`_api-${executionId}`);
@@ -185,6 +184,6 @@ proto._stop = function stop() {
185
184
  broker.cancel('_convey-messages');
186
185
  this[kMessageQ].purge();
187
186
  };
188
- proto._debug = function debug(msg) {
187
+ CompensateEventDefinition.prototype._debug = function debug(msg) {
189
188
  this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
190
189
  };
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = ConditionalEventDefinition;
7
- var _messageHelper = require("../messageHelper");
8
- var _Errors = require("../error/Errors");
7
+ var _messageHelper = require("../messageHelper.js");
8
+ var _Errors = require("../error/Errors.js");
9
9
  const kExecuteMessage = Symbol.for('executeMessage');
10
10
  function ConditionalEventDefinition(activity, eventDefinition) {
11
11
  const {
@@ -27,18 +27,17 @@ function ConditionalEventDefinition(activity, eventDefinition) {
27
27
  this.broker = broker;
28
28
  this.logger = environment.Logger(type.toLowerCase());
29
29
  }
30
- const proto = ConditionalEventDefinition.prototype;
31
- Object.defineProperty(proto, 'executionId', {
30
+ Object.defineProperty(ConditionalEventDefinition.prototype, 'executionId', {
32
31
  get() {
33
32
  const message = this[kExecuteMessage];
34
33
  return message && message.content.executionId;
35
34
  }
36
35
  });
37
- proto.execute = function execute(executeMessage) {
36
+ ConditionalEventDefinition.prototype.execute = function execute(executeMessage) {
38
37
  this[kExecuteMessage] = executeMessage;
39
38
  return this.isWaiting ? this.executeWait(executeMessage) : this.executeCatch(executeMessage);
40
39
  };
41
- proto.executeWait = function executeWait(executeMessage) {
40
+ ConditionalEventDefinition.prototype.executeWait = function executeWait(executeMessage) {
42
41
  const executeContent = executeMessage.content;
43
42
  const {
44
43
  executionId,
@@ -63,7 +62,7 @@ proto.executeWait = function executeWait(executeMessage) {
63
62
  waitContent.parent = (0, _messageHelper.shiftParent)(parent);
64
63
  broker.publish('event', 'activity.wait', waitContent);
65
64
  };
66
- proto.executeCatch = function executeCatch(executeMessage) {
65
+ ConditionalEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
67
66
  const executeContent = executeMessage.content;
68
67
  const {
69
68
  executionId,
@@ -83,7 +82,7 @@ proto.executeCatch = function executeCatch(executeMessage) {
83
82
  consumerTag: `_onend-${executionId}_${index}`
84
83
  });
85
84
  };
86
- proto._onWaitApiMessage = function onWaitApiMessage(routingKey, message) {
85
+ ConditionalEventDefinition.prototype._onWaitApiMessage = function onWaitApiMessage(routingKey, message) {
87
86
  const messageType = message.properties.type;
88
87
  switch (messageType) {
89
88
  case 'signal':
@@ -103,7 +102,7 @@ proto._onWaitApiMessage = function onWaitApiMessage(routingKey, message) {
103
102
  }
104
103
  }
105
104
  };
106
- proto._evaluateWait = function evaluate(message) {
105
+ ConditionalEventDefinition.prototype._evaluateWait = function evaluate(message) {
107
106
  const executeMessage = this[kExecuteMessage];
108
107
  const broker = this.broker,
109
108
  executeContent = executeMessage.content;
@@ -126,13 +125,13 @@ proto._evaluateWait = function evaluate(message) {
126
125
  output
127
126
  }));
128
127
  };
129
- proto._stopWait = function stopWait() {
128
+ ConditionalEventDefinition.prototype._stopWait = function stopWait() {
130
129
  const broker = this.broker,
131
130
  executionId = this.executionId;
132
131
  broker.cancel(`_api-${executionId}`);
133
132
  broker.cancel(`_parent-signal-${executionId}`);
134
133
  };
135
- proto._onAttachedCompleted = function onAttachedCompleted(routingKey, message) {
134
+ ConditionalEventDefinition.prototype._onAttachedCompleted = function onAttachedCompleted(routingKey, message) {
136
135
  this._stopCatch();
137
136
  const executeMessage = this[kExecuteMessage];
138
137
  const broker = this.broker,
@@ -156,7 +155,7 @@ proto._onAttachedCompleted = function onAttachedCompleted(routingKey, message) {
156
155
  }));
157
156
  }
158
157
  };
159
- proto._onCatchApiMessage = function onCatchApiMessage(routingKey, message) {
158
+ ConditionalEventDefinition.prototype._onCatchApiMessage = function onCatchApiMessage(routingKey, message) {
160
159
  const messageType = message.properties.type;
161
160
  switch (messageType) {
162
161
  case 'discard':
@@ -174,7 +173,7 @@ proto._onCatchApiMessage = function onCatchApiMessage(routingKey, message) {
174
173
  }
175
174
  }
176
175
  };
177
- proto._stopCatch = function stopCatch() {
176
+ ConditionalEventDefinition.prototype._stopCatch = function stopCatch() {
178
177
  const {
179
178
  executionId,
180
179
  index
@@ -182,6 +181,6 @@ proto._stopCatch = function stopCatch() {
182
181
  this.activity.attachedTo.broker.cancel(`_onend-${executionId}_${index}`);
183
182
  this.broker.cancel(`_api-${executionId}_${index}`);
184
183
  };
185
- proto._debug = function debug(msg) {
184
+ ConditionalEventDefinition.prototype._debug = function debug(msg) {
186
185
  this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
187
186
  };
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = ErrorEventDefinition;
7
- var _shared = require("../shared");
8
- var _messageHelper = require("../messageHelper");
7
+ var _shared = require("../shared.js");
8
+ var _messageHelper = require("../messageHelper.js");
9
9
  const kCompleted = Symbol.for('completed');
10
10
  const kMessageQ = Symbol.for('messageQ');
11
11
  const kExecuteMessage = Symbol.for('executeMessage');
@@ -49,17 +49,16 @@ function ErrorEventDefinition(activity, eventDefinition) {
49
49
  });
50
50
  }
51
51
  }
52
- const proto = ErrorEventDefinition.prototype;
53
- Object.defineProperty(proto, 'executionId', {
52
+ Object.defineProperty(ErrorEventDefinition.prototype, 'executionId', {
54
53
  get() {
55
54
  const message = this[kExecuteMessage];
56
55
  return message && message.content.executionId;
57
56
  }
58
57
  });
59
- proto.execute = function execute(executeMessage) {
58
+ ErrorEventDefinition.prototype.execute = function execute(executeMessage) {
60
59
  return this.isThrowing ? this.executeThrow(executeMessage) : this.executeCatch(executeMessage);
61
60
  };
62
- proto.executeCatch = function executeCatch(executeMessage) {
61
+ ErrorEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
63
62
  this[kExecuteMessage] = executeMessage;
64
63
  this[kCompleted] = false;
65
64
  const executeContent = executeMessage.content;
@@ -103,7 +102,7 @@ proto.executeCatch = function executeCatch(executeMessage) {
103
102
  waitContent.parent = (0, _messageHelper.shiftParent)(parent);
104
103
  broker.publish('event', 'activity.wait', waitContent);
105
104
  };
106
- proto.executeThrow = function executeThrow(executeMessage) {
105
+ ErrorEventDefinition.prototype.executeThrow = function executeThrow(executeMessage) {
107
106
  const executeContent = executeMessage.content;
108
107
  const {
109
108
  executionId,
@@ -130,7 +129,7 @@ proto.executeThrow = function executeThrow(executeMessage) {
130
129
  }
131
130
  }));
132
131
  };
133
- proto._onErrorMessage = function onErrorMessage(routingKey, message) {
132
+ ErrorEventDefinition.prototype._onErrorMessage = function onErrorMessage(routingKey, message) {
134
133
  const error = message.content.error;
135
134
  if (!this[kReferenceElement]) return this._catchError(routingKey, message, error);
136
135
  if (!error) return;
@@ -138,14 +137,14 @@ proto._onErrorMessage = function onErrorMessage(routingKey, message) {
138
137
  if ('' + error.code !== '' + info.message.code) return;
139
138
  return this._catchError(routingKey, message, error);
140
139
  };
141
- proto._onThrowApiMessage = function onThrowApiMessage(routingKey, message) {
140
+ ErrorEventDefinition.prototype._onThrowApiMessage = function onThrowApiMessage(routingKey, message) {
142
141
  const error = message.content.message;
143
142
  if (!this[kReferenceElement]) return this._catchError(routingKey, message, error);
144
143
  const info = this[kReferenceInfo];
145
144
  if (info.message.id !== (error && error.id)) return;
146
145
  return this._catchError(routingKey, message, error);
147
146
  };
148
- proto._catchError = function catchError(routingKey, message, error) {
147
+ ErrorEventDefinition.prototype._catchError = function catchError(routingKey, message, error) {
149
148
  this[kCompleted] = true;
150
149
  this._stop();
151
150
  this._debug(`caught ${this[kReferenceInfo].description}`);
@@ -171,7 +170,7 @@ proto._catchError = function catchError(routingKey, message, error) {
171
170
  state: 'catch'
172
171
  }));
173
172
  };
174
- proto._onApiMessage = function onApiMessage(routingKey, message) {
173
+ ErrorEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey, message) {
175
174
  const messageType = message.properties.type;
176
175
  switch (messageType) {
177
176
  case 'discard':
@@ -187,7 +186,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
187
186
  }
188
187
  }
189
188
  };
190
- proto._stop = function stop() {
189
+ ErrorEventDefinition.prototype._stop = function stop() {
191
190
  const broker = this.broker,
192
191
  executionId = this.executionId;
193
192
  broker.cancel(`_onthrow-${executionId}`);
@@ -195,7 +194,7 @@ proto._stop = function stop() {
195
194
  broker.cancel(`_api-${executionId}`);
196
195
  this[kMessageQ].purge();
197
196
  };
198
- proto._getReferenceInfo = function getReferenceInfo(message) {
197
+ ErrorEventDefinition.prototype._getReferenceInfo = function getReferenceInfo(message) {
199
198
  const referenceElement = this[kReferenceElement];
200
199
  if (!referenceElement) {
201
200
  return {
@@ -212,6 +211,6 @@ proto._getReferenceInfo = function getReferenceInfo(message) {
212
211
  if (result.message.code) result.description += ` code ${result.message.code}`;
213
212
  return result;
214
213
  };
215
- proto._debug = function debug(msg) {
214
+ ErrorEventDefinition.prototype._debug = function debug(msg) {
216
215
  this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
217
216
  };
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = EscalationEventDefinition;
7
- var _getPropertyValue = _interopRequireDefault(require("../getPropertyValue"));
8
- var _shared = require("../shared");
9
- var _messageHelper = require("../messageHelper");
7
+ var _getPropertyValue = _interopRequireDefault(require("../getPropertyValue.js"));
8
+ var _shared = require("../shared.js");
9
+ var _messageHelper = require("../messageHelper.js");
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
  const kCompleted = Symbol.for('completed');
12
12
  const kMessageQ = Symbol.for('messageQ');
@@ -50,17 +50,16 @@ function EscalationEventDefinition(activity, eventDefinition) {
50
50
  });
51
51
  }
52
52
  }
53
- const proto = EscalationEventDefinition.prototype;
54
- Object.defineProperty(proto, 'executionId', {
53
+ Object.defineProperty(EscalationEventDefinition.prototype, 'executionId', {
55
54
  get() {
56
55
  const message = this[kExecuteMessage];
57
56
  return message && message.content.executionId;
58
57
  }
59
58
  });
60
- proto.execute = function execute(executeMessage) {
59
+ EscalationEventDefinition.prototype.execute = function execute(executeMessage) {
61
60
  return this.isThrowing ? this.executeThrow(executeMessage) : this.executeCatch(executeMessage);
62
61
  };
63
- proto.executeCatch = function executeCatch(executeMessage) {
62
+ EscalationEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
64
63
  this[kExecuteMessage] = executeMessage;
65
64
  this[kCompleted] = false;
66
65
  const executeContent = executeMessage.content;
@@ -90,7 +89,7 @@ proto.executeCatch = function executeCatch(executeMessage) {
90
89
  waitContent.parent = (0, _messageHelper.shiftParent)(parent);
91
90
  broker.publish('event', 'activity.wait', waitContent);
92
91
  };
93
- proto.executeThrow = function executeThrow(executeMessage) {
92
+ EscalationEventDefinition.prototype.executeThrow = function executeThrow(executeMessage) {
94
93
  const executeContent = executeMessage.content;
95
94
  const {
96
95
  executionId,
@@ -111,7 +110,7 @@ proto.executeThrow = function executeThrow(executeMessage) {
111
110
  });
112
111
  return broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(executeContent));
113
112
  };
114
- proto._onCatchMessage = function onCatchMessage(routingKey, message) {
113
+ EscalationEventDefinition.prototype._onCatchMessage = function onCatchMessage(routingKey, message) {
115
114
  const info = this[kReference];
116
115
  if ((0, _getPropertyValue.default)(message, 'content.message.id') !== info.message.id) return;
117
116
  const output = message.content.message;
@@ -139,7 +138,7 @@ proto._onCatchMessage = function onCatchMessage(routingKey, message) {
139
138
  state: 'catch'
140
139
  }));
141
140
  };
142
- proto._onApiMessage = function onApiMessage(routingKey, message) {
141
+ EscalationEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey, message) {
143
142
  switch (message.properties.type) {
144
143
  case 'escalate':
145
144
  {
@@ -158,13 +157,13 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
158
157
  }
159
158
  }
160
159
  };
161
- proto._stop = function stop() {
160
+ EscalationEventDefinition.prototype._stop = function stop() {
162
161
  const broker = this.broker,
163
162
  executionId = this.executionId;
164
163
  broker.cancel(`_api-${executionId}`);
165
164
  broker.cancel(`_onescalate-${executionId}`);
166
165
  };
167
- proto._getReferenceInfo = function getReferenceInfo(message) {
166
+ EscalationEventDefinition.prototype._getReferenceInfo = function getReferenceInfo(message) {
168
167
  const referenceElement = this[kReferenceElement];
169
168
  if (!referenceElement) {
170
169
  return {
@@ -180,6 +179,6 @@ proto._getReferenceInfo = function getReferenceInfo(message) {
180
179
  result.description = `${result.message.name} <${result.message.id}>`;
181
180
  return result;
182
181
  };
183
- proto._debug = function debug(msg) {
182
+ EscalationEventDefinition.prototype._debug = function debug(msg) {
184
183
  this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
185
184
  };
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = EventDefinitionExecution;
7
- var _messageHelper = require("../messageHelper");
7
+ var _messageHelper = require("../messageHelper.js");
8
8
  const kCompleted = Symbol.for('completed');
9
9
  const kExecuteMessage = Symbol.for('executeMessage');
10
10
  const kStopped = Symbol.for('stopped');
@@ -18,20 +18,19 @@ function EventDefinitionExecution(activity, eventDefinitions, completedRoutingKe
18
18
  this[kStopped] = false;
19
19
  this[kExecuteMessage] = null;
20
20
  }
21
- const proto = EventDefinitionExecution.prototype;
22
- Object.defineProperty(proto, 'completed', {
21
+ Object.defineProperty(EventDefinitionExecution.prototype, 'completed', {
23
22
  enumerable: true,
24
23
  get() {
25
24
  return this[kCompleted];
26
25
  }
27
26
  });
28
- Object.defineProperty(proto, 'stopped', {
27
+ Object.defineProperty(EventDefinitionExecution.prototype, 'stopped', {
29
28
  enumerable: true,
30
29
  get() {
31
30
  return this[kStopped];
32
31
  }
33
32
  });
34
- proto.execute = function execute(executeMessage) {
33
+ EventDefinitionExecution.prototype.execute = function execute(executeMessage) {
35
34
  const content = executeMessage.content;
36
35
  if (content.isDefinitionScope) return this._executeDefinition(executeMessage);
37
36
  if (!content.isRootScope) return;
@@ -71,7 +70,7 @@ proto.execute = function execute(executeMessage) {
71
70
  broker.publish('execution', 'execute.start', edContent);
72
71
  }
73
72
  };
74
- proto._onApiMessage = function onApiMessage(_, message) {
73
+ EventDefinitionExecution.prototype._onApiMessage = function onApiMessage(_, message) {
75
74
  const messageType = message.properties.type;
76
75
  switch (messageType) {
77
76
  case 'stop':
@@ -79,7 +78,7 @@ proto._onApiMessage = function onApiMessage(_, message) {
79
78
  return this._stop();
80
79
  }
81
80
  };
82
- proto._onExecuteMessage = function onExecuteMessage(routingKey, message) {
81
+ EventDefinitionExecution.prototype._onExecuteMessage = function onExecuteMessage(routingKey, message) {
83
82
  switch (routingKey) {
84
83
  case 'execute.completed':
85
84
  {
@@ -103,7 +102,7 @@ proto._onExecuteMessage = function onExecuteMessage(routingKey, message) {
103
102
  }
104
103
  }
105
104
  };
106
- proto._complete = function complete(message) {
105
+ EventDefinitionExecution.prototype._complete = function complete(message) {
107
106
  const {
108
107
  executionId,
109
108
  type,
@@ -122,7 +121,7 @@ proto._complete = function complete(message) {
122
121
  correlationId: message.properties.correlationId
123
122
  });
124
123
  };
125
- proto._executeDefinition = function executeDefinition(message) {
124
+ EventDefinitionExecution.prototype._executeDefinition = function executeDefinition(message) {
126
125
  const {
127
126
  executionId,
128
127
  index
@@ -132,11 +131,11 @@ proto._executeDefinition = function executeDefinition(message) {
132
131
  this._debug(executionId, `execute event definition ${ed.type}, index ${index}`);
133
132
  ed.execute(message);
134
133
  };
135
- proto._stop = function stop() {
134
+ EventDefinitionExecution.prototype._stop = function stop() {
136
135
  this[kStopped] = true;
137
136
  this.broker.cancel('_eventdefinition-execution-execute-tag');
138
137
  this.broker.cancel('_eventdefinition-execution-api-tag');
139
138
  };
140
- proto._debug = function debug(executionId, msg) {
139
+ EventDefinitionExecution.prototype._debug = function debug(executionId, msg) {
141
140
  this.activity.logger.debug(`<${executionId} (${this.id})> ${msg}`);
142
141
  };
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = LinkEventDefinition;
7
- var _getPropertyValue = _interopRequireDefault(require("../getPropertyValue"));
8
- var _shared = require("../shared");
9
- var _messageHelper = require("../messageHelper");
7
+ var _getPropertyValue = _interopRequireDefault(require("../getPropertyValue.js"));
8
+ var _shared = require("../shared.js");
9
+ var _messageHelper = require("../messageHelper.js");
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
  const kCompleted = Symbol.for('completed');
12
12
  const kMessageQ = Symbol.for('messageQ');
@@ -49,17 +49,16 @@ function LinkEventDefinition(activity, eventDefinition) {
49
49
  });
50
50
  }
51
51
  }
52
- const proto = LinkEventDefinition.prototype;
53
- Object.defineProperty(proto, 'executionId', {
52
+ Object.defineProperty(LinkEventDefinition.prototype, 'executionId', {
54
53
  get() {
55
54
  const message = this[kExecuteMessage];
56
55
  return message && message.content.executionId;
57
56
  }
58
57
  });
59
- proto.execute = function execute(executeMessage) {
58
+ LinkEventDefinition.prototype.execute = function execute(executeMessage) {
60
59
  return this.isThrowing ? this.executeThrow(executeMessage) : this.executeCatch(executeMessage);
61
60
  };
62
- proto.executeCatch = function executeCatch(executeMessage) {
61
+ LinkEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
63
62
  this[kExecuteMessage] = executeMessage;
64
63
  this[kCompleted] = false;
65
64
  const executeContent = executeMessage.content;
@@ -93,7 +92,7 @@ proto.executeCatch = function executeCatch(executeMessage) {
93
92
  waitContent.parent = (0, _messageHelper.shiftParent)(parent);
94
93
  broker.publish('event', 'activity.wait', waitContent);
95
94
  };
96
- proto.executeThrow = function executeThrow(executeMessage) {
95
+ LinkEventDefinition.prototype.executeThrow = function executeThrow(executeMessage) {
97
96
  const executeContent = executeMessage.content;
98
97
  const {
99
98
  executionId,
@@ -116,12 +115,12 @@ proto.executeThrow = function executeThrow(executeMessage) {
116
115
  });
117
116
  return broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(executeContent));
118
117
  };
119
- proto._onCatchLink = function onCatchLink(routingKey, message) {
118
+ LinkEventDefinition.prototype._onCatchLink = function onCatchLink(routingKey, message) {
120
119
  if ((0, _getPropertyValue.default)(message, 'content.message.linkName') !== this.reference.linkName) return;
121
120
  if (message.content.state === 'discard') return this._discard();
122
121
  return this._complete('caught', message.content.message);
123
122
  };
124
- proto._onApiMessage = function onApiMessage(routingKey, message) {
123
+ LinkEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey, message) {
125
124
  const messageType = message.properties.type;
126
125
  switch (messageType) {
127
126
  case 'discard':
@@ -135,7 +134,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
135
134
  }
136
135
  }
137
136
  };
138
- proto._complete = function complete(verb, output) {
137
+ LinkEventDefinition.prototype._complete = function complete(verb, output) {
139
138
  this[kCompleted] = true;
140
139
  this._stop();
141
140
  this._debug(`${verb} link ${this.reference.linkName}`);
@@ -160,12 +159,12 @@ proto._complete = function complete(verb, output) {
160
159
  state: 'catch'
161
160
  }));
162
161
  };
163
- proto._discard = function discard() {
162
+ LinkEventDefinition.prototype._discard = function discard() {
164
163
  this[kCompleted] = true;
165
164
  this._stop();
166
165
  return this.broker.publish('execution', 'execute.discard', (0, _messageHelper.cloneContent)(this[kExecuteMessage].content));
167
166
  };
168
- proto._stop = function stop() {
167
+ LinkEventDefinition.prototype._stop = function stop() {
169
168
  const broker = this.broker,
170
169
  executionId = this.executionId;
171
170
  broker.cancel(`_api-link-${executionId}`);
@@ -173,7 +172,7 @@ proto._stop = function stop() {
173
172
  broker.cancel(`_api-${executionId}`);
174
173
  this[kMessageQ].purge();
175
174
  };
176
- proto._onDiscard = function onDiscard(_, message) {
175
+ LinkEventDefinition.prototype._onDiscard = function onDiscard(_, message) {
177
176
  this.broker.publish('event', 'activity.link.discard', (0, _messageHelper.cloneContent)(message.content, {
178
177
  message: {
179
178
  ...this.reference
@@ -184,6 +183,6 @@ proto._onDiscard = function onDiscard(_, message) {
184
183
  delegate: true
185
184
  });
186
185
  };
187
- proto._debug = function debug(msg) {
186
+ LinkEventDefinition.prototype._debug = function debug(msg) {
188
187
  this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
189
188
  };