bpmn-elements 8.2.4 → 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} +1 -1
  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 +42 -43
  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 +30 -30
  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 +1 -1
  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 +42 -44
  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
package/src/Context.js CHANGED
@@ -1,7 +1,7 @@
1
- import BpmnIO from './io/BpmnIO';
2
- import Environment from './Environment';
3
- import ExtensionsMapper from './ExtensionsMapper';
4
- import {getUniqueId} from './shared';
1
+ import BpmnIO from './io/BpmnIO.js';
2
+ import Environment from './Environment.js';
3
+ import ExtensionsMapper from './ExtensionsMapper.js';
4
+ import {getUniqueId} from './shared.js';
5
5
 
6
6
  export default function Context(definitionContext, environment) {
7
7
  environment = environment ? environment.clone() : new Environment();
@@ -31,9 +31,7 @@ function ContextInstance(definitionContext, environment) {
31
31
  };
32
32
  }
33
33
 
34
- const proto = ContextInstance.prototype;
35
-
36
- proto.getActivityById = function getActivityById(activityId) {
34
+ ContextInstance.prototype.getActivityById = function getActivityById(activityId) {
37
35
  const activityInstance = this.refs.activityRefs[activityId];
38
36
  if (activityInstance) return activityInstance;
39
37
  const activity = this.definitionContext.getActivityById(activityId);
@@ -41,7 +39,7 @@ proto.getActivityById = function getActivityById(activityId) {
41
39
  return this.upsertActivity(activity);
42
40
  };
43
41
 
44
- proto.upsertActivity = function upsertActivity(activityDef) {
42
+ ContextInstance.prototype.upsertActivity = function upsertActivity(activityDef) {
45
43
  let activityInstance = this.refs.activityRefs[activityDef.id];
46
44
  if (activityInstance) return activityInstance;
47
45
 
@@ -50,7 +48,7 @@ proto.upsertActivity = function upsertActivity(activityDef) {
50
48
  return activityInstance;
51
49
  };
52
50
 
53
- proto.getSequenceFlowById = function getSequenceFlowById(sequenceFlowId) {
51
+ ContextInstance.prototype.getSequenceFlowById = function getSequenceFlowById(sequenceFlowId) {
54
52
  const flowInstance = this.refs.sequenceFlowRefs[sequenceFlowId];
55
53
  if (flowInstance) return flowInstance;
56
54
 
@@ -59,31 +57,31 @@ proto.getSequenceFlowById = function getSequenceFlowById(sequenceFlowId) {
59
57
  return this.upsertSequenceFlow(flowDef);
60
58
  };
61
59
 
62
- proto.getInboundSequenceFlows = function getInboundSequenceFlows(activityId) {
60
+ ContextInstance.prototype.getInboundSequenceFlows = function getInboundSequenceFlows(activityId) {
63
61
  return (this.definitionContext.getInboundSequenceFlows(activityId) || []).map((flow) => this.upsertSequenceFlow(flow));
64
62
  };
65
63
 
66
- proto.getOutboundSequenceFlows = function getOutboundSequenceFlows(activityId) {
64
+ ContextInstance.prototype.getOutboundSequenceFlows = function getOutboundSequenceFlows(activityId) {
67
65
  return (this.definitionContext.getOutboundSequenceFlows(activityId) || []).map((flow) => this.upsertSequenceFlow(flow));
68
66
  };
69
67
 
70
- proto.getInboundAssociations = function getInboundAssociations(activityId) {
68
+ ContextInstance.prototype.getInboundAssociations = function getInboundAssociations(activityId) {
71
69
  return (this.definitionContext.getInboundAssociations(activityId) || []).map((association) => this.upsertAssociation(association));
72
70
  };
73
71
 
74
- proto.getOutboundAssociations = function getOutboundAssociations(activityId) {
72
+ ContextInstance.prototype.getOutboundAssociations = function getOutboundAssociations(activityId) {
75
73
  return (this.definitionContext.getOutboundAssociations(activityId) || []).map((association) => this.upsertAssociation(association));
76
74
  };
77
75
 
78
- proto.getActivities = function getActivities(scopeId) {
76
+ ContextInstance.prototype.getActivities = function getActivities(scopeId) {
79
77
  return (this.definitionContext.getActivities(scopeId) || []).map((activityDef) => this.upsertActivity(activityDef));
80
78
  };
81
79
 
82
- proto.getSequenceFlows = function getSequenceFlows(scopeId) {
80
+ ContextInstance.prototype.getSequenceFlows = function getSequenceFlows(scopeId) {
83
81
  return (this.definitionContext.getSequenceFlows(scopeId) || []).map((flow) => this.upsertSequenceFlow(flow));
84
82
  };
85
83
 
86
- proto.upsertSequenceFlow = function upsertSequenceFlow(flowDefinition) {
84
+ ContextInstance.prototype.upsertSequenceFlow = function upsertSequenceFlow(flowDefinition) {
87
85
  const refs = this.refs.sequenceFlowRefs;
88
86
  let flowInstance = refs[flowDefinition.id];
89
87
  if (flowInstance) return flowInstance;
@@ -94,11 +92,11 @@ proto.upsertSequenceFlow = function upsertSequenceFlow(flowDefinition) {
94
92
  return flowInstance;
95
93
  };
96
94
 
97
- proto.getAssociations = function getAssociations(scopeId) {
95
+ ContextInstance.prototype.getAssociations = function getAssociations(scopeId) {
98
96
  return (this.definitionContext.getAssociations(scopeId) || []).map((association) => this.upsertAssociation(association));
99
97
  };
100
98
 
101
- proto.upsertAssociation = function upsertAssociation(associationDefinition) {
99
+ ContextInstance.prototype.upsertAssociation = function upsertAssociation(associationDefinition) {
102
100
  const refs = this.refs.associationRefs;
103
101
  let instance = refs[associationDefinition.id];
104
102
  if (instance) return instance;
@@ -108,11 +106,11 @@ proto.upsertAssociation = function upsertAssociation(associationDefinition) {
108
106
  return instance;
109
107
  };
110
108
 
111
- proto.clone = function clone(newEnvironment) {
109
+ ContextInstance.prototype.clone = function clone(newEnvironment) {
112
110
  return new ContextInstance(this.definitionContext, newEnvironment || this.environment);
113
111
  };
114
112
 
115
- proto.getProcessById = function getProcessById(processId) {
113
+ ContextInstance.prototype.getProcessById = function getProcessById(processId) {
116
114
  const refs = this.refs.processRefs;
117
115
  let bp = this.refs.processRefs[processId];
118
116
  if (bp) return bp;
@@ -127,22 +125,22 @@ proto.getProcessById = function getProcessById(processId) {
127
125
  return bp;
128
126
  };
129
127
 
130
- proto.getNewProcessById = function getNewProcessById(processId) {
128
+ ContextInstance.prototype.getNewProcessById = function getNewProcessById(processId) {
131
129
  if (!this.getProcessById(processId)) return null;
132
130
  const bpDef = this.definitionContext.getProcessById(processId);
133
131
  const bp = new bpDef.Behaviour(bpDef, this.clone(this.environment.clone()));
134
132
  return bp;
135
133
  };
136
134
 
137
- proto.getProcesses = function getProcesses() {
135
+ ContextInstance.prototype.getProcesses = function getProcesses() {
138
136
  return this.definitionContext.getProcesses().map(({id: processId}) => this.getProcessById(processId));
139
137
  };
140
138
 
141
- proto.getExecutableProcesses = function getExecutableProcesses() {
139
+ ContextInstance.prototype.getExecutableProcesses = function getExecutableProcesses() {
142
140
  return this.definitionContext.getExecutableProcesses().map(({id: processId}) => this.getProcessById(processId));
143
141
  };
144
142
 
145
- proto.getMessageFlows = function getMessageFlows(sourceId) {
143
+ ContextInstance.prototype.getMessageFlows = function getMessageFlows(sourceId) {
146
144
  if (!this.refs.messageFlows.length) {
147
145
  const flows = this.definitionContext.getMessageFlows() || [];
148
146
  this.refs.messageFlows.push(...flows.map((flow) => new flow.Behaviour(flow, this)));
@@ -151,7 +149,7 @@ proto.getMessageFlows = function getMessageFlows(sourceId) {
151
149
  return this.refs.messageFlows.filter((flow) => flow.source.processId === sourceId);
152
150
  };
153
151
 
154
- proto.getDataObjectById = function getDataObjectById(referenceId) {
152
+ ContextInstance.prototype.getDataObjectById = function getDataObjectById(referenceId) {
155
153
  let dataObject;
156
154
  if ((dataObject = this.refs.dataObjectRefs[referenceId])) return dataObject;
157
155
 
@@ -163,7 +161,7 @@ proto.getDataObjectById = function getDataObjectById(referenceId) {
163
161
  return dataObject;
164
162
  };
165
163
 
166
- proto.getDataStoreById = function getDataStoreById(referenceId) {
164
+ ContextInstance.prototype.getDataStoreById = function getDataStoreById(referenceId) {
167
165
  let dataStore;
168
166
  if ((dataStore = this.refs.dataStoreRefs[referenceId])) return dataStore;
169
167
 
@@ -175,7 +173,7 @@ proto.getDataStoreById = function getDataStoreById(referenceId) {
175
173
  return dataStore;
176
174
  };
177
175
 
178
- proto.getStartActivities = function getStartActivities(filterOptions, scopeId) {
176
+ ContextInstance.prototype.getStartActivities = function getStartActivities(filterOptions, scopeId) {
179
177
  const {referenceId, referenceType = 'unknown'} = filterOptions || {};
180
178
  const result = [];
181
179
  for (const activity of this.getActivities()) {
@@ -196,7 +194,7 @@ proto.getStartActivities = function getStartActivities(filterOptions, scopeId) {
196
194
  return result;
197
195
  };
198
196
 
199
- proto.loadExtensions = function loadExtensions(activity) {
197
+ ContextInstance.prototype.loadExtensions = function loadExtensions(activity) {
200
198
  const io = new BpmnIO(activity, this);
201
199
  const extensions = this.extensionsMapper.get(activity);
202
200
  if (io.hasIo) extensions.extensions.push(io);
@@ -1,6 +1,6 @@
1
- import Expressions from './Expressions';
2
- import {Scripts as IScripts} from './Scripts';
3
- import {Timers} from './Timers';
1
+ import Expressions from './Expressions.js';
2
+ import {Scripts as IScripts} from './Scripts.js';
3
+ import {Timers} from './Timers.js';
4
4
 
5
5
  const kServices = Symbol.for('services');
6
6
  const kVariables = Symbol.for('variables');
@@ -31,16 +31,14 @@ export default function Environment(options = {}) {
31
31
  this[kVariables] = options.variables || {};
32
32
  }
33
33
 
34
- const proto = Environment.prototype;
35
-
36
- Object.defineProperty(proto, 'variables', {
34
+ Object.defineProperty(Environment.prototype, 'variables', {
37
35
  enumerable: true,
38
36
  get() {
39
37
  return this[kVariables];
40
38
  },
41
39
  });
42
40
 
43
- Object.defineProperty(proto, 'services', {
41
+ Object.defineProperty(Environment.prototype, 'services', {
44
42
  enumerable: true,
45
43
  get() {
46
44
  return this[kServices];
@@ -54,7 +52,7 @@ Object.defineProperty(proto, 'services', {
54
52
  },
55
53
  });
56
54
 
57
- proto.getState = function getState() {
55
+ Environment.prototype.getState = function getState() {
58
56
  return {
59
57
  settings: {...this.settings},
60
58
  variables: {...this[kVariables]},
@@ -62,7 +60,7 @@ proto.getState = function getState() {
62
60
  };
63
61
  };
64
62
 
65
- proto.recover = function recover(state) {
63
+ Environment.prototype.recover = function recover(state) {
66
64
  if (!state) return this;
67
65
 
68
66
  if (state.settings) Object.assign(this.settings, state.settings);
@@ -72,7 +70,7 @@ proto.recover = function recover(state) {
72
70
  return this;
73
71
  };
74
72
 
75
- proto.clone = function clone(overrideOptions = {}) {
73
+ Environment.prototype.clone = function clone(overrideOptions = {}) {
76
74
  const services = this[kServices];
77
75
  const newOptions = {
78
76
  settings: {...this.settings},
@@ -92,7 +90,7 @@ proto.clone = function clone(overrideOptions = {}) {
92
90
  return new this.constructor(newOptions);
93
91
  };
94
92
 
95
- proto.assignVariables = function assignVariables(newVars) {
93
+ Environment.prototype.assignVariables = function assignVariables(newVars) {
96
94
  if (!newVars || typeof newVars !== 'object') return;
97
95
 
98
96
  this[kVariables] = {
@@ -101,7 +99,7 @@ proto.assignVariables = function assignVariables(newVars) {
101
99
  };
102
100
  };
103
101
 
104
- proto.assignSettings = function assignVariables(newSettings) {
102
+ Environment.prototype.assignSettings = function assignVariables(newSettings) {
105
103
  if (!newSettings || typeof newSettings !== 'object') return;
106
104
 
107
105
  this.settings = {
@@ -110,19 +108,19 @@ proto.assignSettings = function assignVariables(newSettings) {
110
108
  };
111
109
  };
112
110
 
113
- proto.getScript = function getScript(...args) {
111
+ Environment.prototype.getScript = function getScript(...args) {
114
112
  return this.scripts.getScript(...args);
115
113
  };
116
114
 
117
- proto.registerScript = function registerScript(...args) {
115
+ Environment.prototype.registerScript = function registerScript(...args) {
118
116
  return this.scripts.register(...args);
119
117
  };
120
118
 
121
- proto.getServiceByName = function getServiceByName(serviceName) {
119
+ Environment.prototype.getServiceByName = function getServiceByName(serviceName) {
122
120
  return this[kServices][serviceName];
123
121
  };
124
122
 
125
- proto.resolveExpression = function resolveExpression(expression, message = {}, expressionFnContext) {
123
+ Environment.prototype.resolveExpression = function resolveExpression(expression, message = {}, expressionFnContext) {
126
124
  const from = {
127
125
  environment: this,
128
126
  ...message,
@@ -131,7 +129,7 @@ proto.resolveExpression = function resolveExpression(expression, message = {}, e
131
129
  return this.expressions.resolveExpression(expression, from, expressionFnContext);
132
130
  };
133
131
 
134
- proto.addService = function addService(name, fn) {
132
+ Environment.prototype.addService = function addService(name, fn) {
135
133
  this[kServices][name] = fn;
136
134
  };
137
135
 
@@ -1,5 +1,5 @@
1
1
  import { Broker } from 'smqp';
2
- import { makeErrorFromMessage } from './error/Errors';
2
+ import { makeErrorFromMessage } from './error/Errors.js';
3
3
 
4
4
  export {
5
5
  ActivityBroker,
@@ -1,4 +1,4 @@
1
- import getPropertyValue from './getPropertyValue';
1
+ import getPropertyValue from './getPropertyValue.js';
2
2
 
3
3
  const isExpressionPattern = /^\${(.+?)}$/;
4
4
  const expressionPattern = /\${(.+?)}/;
@@ -1,6 +1,6 @@
1
- import {cloneMessage} from './messageHelper';
2
- import {getUniqueId} from './shared';
3
- import {ActivityError} from './error/Errors';
1
+ import {cloneMessage} from './messageHelper.js';
2
+ import {getUniqueId} from './shared.js';
3
+ import {ActivityError} from './error/Errors.js';
4
4
  import {getRoutingKeyPattern} from 'smqp';
5
5
 
6
6
  const kOnMessage = Symbol.for('onMessage');