bpmn-elements 8.1.0 → 8.2.1
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.
- package/CHANGELOG.md +10 -0
- package/dist/index.js +0 -49
- package/dist/src/Api.js +4 -19
- package/dist/src/Context.js +7 -36
- package/dist/src/Environment.js +18 -44
- package/dist/src/EventBroker.js +8 -27
- package/dist/src/Expressions.js +0 -13
- package/dist/src/ExtensionsMapper.js +32 -44
- package/dist/src/MessageFormatter.js +0 -33
- package/dist/src/Scripts.js +2 -9
- package/dist/src/Timers.js +0 -9
- package/dist/src/activity/Activity.js +62 -294
- package/dist/src/activity/ActivityExecution.js +8 -76
- package/dist/src/activity/Dummy.js +2 -3
- package/dist/src/activity/Escalation.js +4 -4
- package/dist/src/activity/ExecutionScope.js +0 -4
- package/dist/src/activity/Message.js +4 -4
- package/dist/src/activity/Signal.js +4 -4
- package/dist/src/definition/Definition.js +12 -133
- package/dist/src/definition/DefinitionExecution.js +10 -160
- package/dist/src/error/BpmnError.js +2 -3
- package/dist/src/error/Errors.js +0 -16
- package/dist/src/eventDefinitions/CancelEventDefinition.js +2 -35
- package/dist/src/eventDefinitions/CompensateEventDefinition.js +3 -34
- package/dist/src/eventDefinitions/ConditionalEventDefinition.js +3 -42
- package/dist/src/eventDefinitions/ErrorEventDefinition.js +11 -41
- package/dist/src/eventDefinitions/EscalationEventDefinition.js +7 -37
- package/dist/src/eventDefinitions/EventDefinitionExecution.js +0 -30
- package/dist/src/eventDefinitions/LinkEventDefinition.js +11 -37
- package/dist/src/eventDefinitions/MessageEventDefinition.js +11 -44
- package/dist/src/eventDefinitions/SignalEventDefinition.js +9 -46
- package/dist/src/eventDefinitions/TerminateEventDefinition.js +0 -3
- package/dist/src/eventDefinitions/TimerEventDefinition.js +8 -52
- package/dist/src/events/BoundaryEvent.js +4 -44
- package/dist/src/events/EndEvent.js +2 -11
- package/dist/src/events/IntermediateCatchEvent.js +0 -13
- package/dist/src/events/IntermediateThrowEvent.js +2 -11
- package/dist/src/events/StartEvent.js +5 -25
- package/dist/src/flows/Association.js +4 -27
- package/dist/src/flows/MessageFlow.js +6 -18
- package/dist/src/flows/SequenceFlow.js +4 -39
- package/dist/src/gateways/EventBasedGateway.js +0 -21
- package/dist/src/gateways/ExclusiveGateway.js +0 -6
- package/dist/src/gateways/InclusiveGateway.js +0 -6
- package/dist/src/gateways/ParallelGateway.js +2 -7
- package/dist/src/getPropertyValue.js +0 -30
- package/dist/src/io/BpmnIO.js +8 -5
- package/dist/src/io/EnvironmentDataObject.js +0 -8
- package/dist/src/io/EnvironmentDataStore.js +0 -8
- package/dist/src/io/EnvironmentDataStoreReference.js +0 -8
- package/dist/src/io/InputOutputSpecification.js +25 -36
- package/dist/src/io/Properties.js +15 -47
- package/dist/src/messageHelper.js +10 -23
- package/dist/src/process/Process.js +10 -112
- package/dist/src/process/ProcessExecution.js +14 -170
- package/dist/src/shared.js +0 -7
- package/dist/src/tasks/CallActivity.js +2 -23
- package/dist/src/tasks/LoopCharacteristics.js +16 -67
- package/dist/src/tasks/ReceiveTask.js +8 -48
- package/dist/src/tasks/ScriptTask.js +1 -15
- package/dist/src/tasks/ServiceImplementation.js +0 -4
- package/dist/src/tasks/ServiceTask.js +1 -25
- package/dist/src/tasks/SignalTask.js +2 -21
- package/dist/src/tasks/StandardLoopCharacteristics.js +4 -5
- package/dist/src/tasks/SubProcess.js +4 -52
- package/dist/src/tasks/Task.js +0 -8
- package/dist/src/tasks/Transaction.js +0 -3
- package/package.json +8 -8
- package/src/Context.js +7 -3
- package/src/ExtensionsMapper.js +35 -35
- package/src/activity/Activity.js +22 -51
- package/src/gateways/EventBasedGateway.js +0 -1
- package/src/io/BpmnIO.js +7 -0
- package/src/io/EnvironmentDataObject.js +1 -0
- package/src/io/InputOutputSpecification.js +17 -6
- package/src/io/Properties.js +9 -11
- package/src/process/ProcessExecution.js +2 -1
- package/src/tasks/ServiceTask.js +1 -3
- package/src/tasks/StandardLoopCharacteristics.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
+
# 8.2.1
|
|
5
|
+
|
|
6
|
+
- fix resume on caught activity error throws #31
|
|
7
|
+
|
|
8
|
+
# 8.2.0
|
|
9
|
+
|
|
10
|
+
- fix resume when activity has formatting status, extensions were not re-activated
|
|
11
|
+
- fix InputOutputSpecification output now passed as dataOutput instead of dataInput, as it should
|
|
12
|
+
- refactor Extensions loading, bpmn io is now pushed to the end of the extensions list
|
|
13
|
+
|
|
4
14
|
# 8.1.0
|
|
5
15
|
|
|
6
16
|
- support non-interrupting BoundaryEvent with ISO8601 repeating interval timeCycle
|
package/dist/index.js
CHANGED
|
@@ -333,101 +333,52 @@ Object.defineProperty(exports, "UserTask", {
|
|
|
333
333
|
return _SignalTask.default;
|
|
334
334
|
}
|
|
335
335
|
});
|
|
336
|
-
|
|
337
336
|
var _Activity = _interopRequireDefault(require("./src/activity/Activity"));
|
|
338
|
-
|
|
339
337
|
var _Association = _interopRequireDefault(require("./src/flows/Association"));
|
|
340
|
-
|
|
341
338
|
var _BoundaryEvent = _interopRequireDefault(require("./src/events/BoundaryEvent"));
|
|
342
|
-
|
|
343
339
|
var _BpmnError = _interopRequireDefault(require("./src/error/BpmnError"));
|
|
344
|
-
|
|
345
340
|
var _CallActivity = _interopRequireDefault(require("./src/tasks/CallActivity"));
|
|
346
|
-
|
|
347
341
|
var _CancelEventDefinition = _interopRequireDefault(require("./src/eventDefinitions/CancelEventDefinition"));
|
|
348
|
-
|
|
349
342
|
var _CompensateEventDefinition = _interopRequireDefault(require("./src/eventDefinitions/CompensateEventDefinition"));
|
|
350
|
-
|
|
351
343
|
var _ConditionalEventDefinition = _interopRequireDefault(require("./src/eventDefinitions/ConditionalEventDefinition"));
|
|
352
|
-
|
|
353
344
|
var _Context = _interopRequireDefault(require("./src/Context"));
|
|
354
|
-
|
|
355
345
|
var _EnvironmentDataObject = _interopRequireDefault(require("./src/io/EnvironmentDataObject"));
|
|
356
|
-
|
|
357
346
|
var _EnvironmentDataStore = _interopRequireDefault(require("./src/io/EnvironmentDataStore"));
|
|
358
|
-
|
|
359
347
|
var _EnvironmentDataStoreReference = _interopRequireDefault(require("./src/io/EnvironmentDataStoreReference"));
|
|
360
|
-
|
|
361
348
|
var _Definition = _interopRequireDefault(require("./src/definition/Definition"));
|
|
362
|
-
|
|
363
349
|
var _Dummy = _interopRequireDefault(require("./src/activity/Dummy"));
|
|
364
|
-
|
|
365
350
|
var _EndEvent = _interopRequireDefault(require("./src/events/EndEvent"));
|
|
366
|
-
|
|
367
351
|
var _Environment = _interopRequireDefault(require("./src/Environment"));
|
|
368
|
-
|
|
369
352
|
var _ErrorEventDefinition = _interopRequireDefault(require("./src/eventDefinitions/ErrorEventDefinition"));
|
|
370
|
-
|
|
371
353
|
var _Escalation = _interopRequireDefault(require("./src/activity/Escalation"));
|
|
372
|
-
|
|
373
354
|
var _EscalationEventDefinition = _interopRequireDefault(require("./src/eventDefinitions/EscalationEventDefinition"));
|
|
374
|
-
|
|
375
355
|
var _EventBasedGateway = _interopRequireDefault(require("./src/gateways/EventBasedGateway"));
|
|
376
|
-
|
|
377
356
|
var _ExclusiveGateway = _interopRequireDefault(require("./src/gateways/ExclusiveGateway"));
|
|
378
|
-
|
|
379
357
|
var _InclusiveGateway = _interopRequireDefault(require("./src/gateways/InclusiveGateway"));
|
|
380
|
-
|
|
381
358
|
var _InputOutputSpecification = _interopRequireDefault(require("./src/io/InputOutputSpecification"));
|
|
382
|
-
|
|
383
359
|
var _IntermediateCatchEvent = _interopRequireDefault(require("./src/events/IntermediateCatchEvent"));
|
|
384
|
-
|
|
385
360
|
var _IntermediateThrowEvent = _interopRequireDefault(require("./src/events/IntermediateThrowEvent"));
|
|
386
|
-
|
|
387
361
|
var _LinkEventDefinition = _interopRequireDefault(require("./src/eventDefinitions/LinkEventDefinition"));
|
|
388
|
-
|
|
389
362
|
var _LoopCharacteristics = _interopRequireDefault(require("./src/tasks/LoopCharacteristics"));
|
|
390
|
-
|
|
391
363
|
var _Message = _interopRequireDefault(require("./src/activity/Message"));
|
|
392
|
-
|
|
393
364
|
var _MessageEventDefinition = _interopRequireDefault(require("./src/eventDefinitions/MessageEventDefinition"));
|
|
394
|
-
|
|
395
365
|
var _MessageFlow = _interopRequireDefault(require("./src/flows/MessageFlow"));
|
|
396
|
-
|
|
397
366
|
var _ParallelGateway = _interopRequireDefault(require("./src/gateways/ParallelGateway"));
|
|
398
|
-
|
|
399
367
|
var _Process = _interopRequireDefault(require("./src/process/Process"));
|
|
400
|
-
|
|
401
368
|
var _Properties = _interopRequireDefault(require("./src/io/Properties"));
|
|
402
|
-
|
|
403
369
|
var _ReceiveTask = _interopRequireDefault(require("./src/tasks/ReceiveTask"));
|
|
404
|
-
|
|
405
370
|
var _ScriptTask = _interopRequireDefault(require("./src/tasks/ScriptTask"));
|
|
406
|
-
|
|
407
371
|
var _SequenceFlow = _interopRequireDefault(require("./src/flows/SequenceFlow"));
|
|
408
|
-
|
|
409
372
|
var _ServiceImplementation = _interopRequireDefault(require("./src/tasks/ServiceImplementation"));
|
|
410
|
-
|
|
411
373
|
var _ServiceTask = _interopRequireDefault(require("./src/tasks/ServiceTask"));
|
|
412
|
-
|
|
413
374
|
var _Signal = _interopRequireDefault(require("./src/activity/Signal"));
|
|
414
|
-
|
|
415
375
|
var _SignalEventDefinition = _interopRequireDefault(require("./src/eventDefinitions/SignalEventDefinition"));
|
|
416
|
-
|
|
417
376
|
var _SignalTask = _interopRequireDefault(require("./src/tasks/SignalTask"));
|
|
418
|
-
|
|
419
377
|
var _StandardLoopCharacteristics = _interopRequireDefault(require("./src/tasks/StandardLoopCharacteristics"));
|
|
420
|
-
|
|
421
378
|
var _StartEvent = _interopRequireDefault(require("./src/events/StartEvent"));
|
|
422
|
-
|
|
423
379
|
var _SubProcess = _interopRequireDefault(require("./src/tasks/SubProcess"));
|
|
424
|
-
|
|
425
380
|
var _Task = _interopRequireDefault(require("./src/tasks/Task"));
|
|
426
|
-
|
|
427
381
|
var _TerminateEventDefinition = _interopRequireDefault(require("./src/eventDefinitions/TerminateEventDefinition"));
|
|
428
|
-
|
|
429
382
|
var _TimerEventDefinition = _interopRequireDefault(require("./src/eventDefinitions/TimerEventDefinition"));
|
|
430
|
-
|
|
431
383
|
var _Transaction = _interopRequireDefault(require("./src/tasks/Transaction"));
|
|
432
|
-
|
|
433
384
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/dist/src/Api.js
CHANGED
|
@@ -8,27 +8,20 @@ exports.Api = Api;
|
|
|
8
8
|
exports.DefinitionApi = DefinitionApi;
|
|
9
9
|
exports.FlowApi = FlowApi;
|
|
10
10
|
exports.ProcessApi = ProcessApi;
|
|
11
|
-
|
|
12
11
|
var _messageHelper = require("./messageHelper");
|
|
13
|
-
|
|
14
12
|
var _shared = require("./shared");
|
|
15
|
-
|
|
16
13
|
function ActivityApi(broker, apiMessage, environment) {
|
|
17
14
|
return new Api('activity', broker, apiMessage, environment);
|
|
18
15
|
}
|
|
19
|
-
|
|
20
16
|
function DefinitionApi(broker, apiMessage, environment) {
|
|
21
17
|
return new Api('definition', broker, apiMessage, environment);
|
|
22
18
|
}
|
|
23
|
-
|
|
24
19
|
function ProcessApi(broker, apiMessage, environment) {
|
|
25
20
|
return new Api('process', broker, apiMessage, environment);
|
|
26
21
|
}
|
|
27
|
-
|
|
28
22
|
function FlowApi(broker, apiMessage, environment) {
|
|
29
23
|
return new Api('flow', broker, apiMessage, environment);
|
|
30
24
|
}
|
|
31
|
-
|
|
32
25
|
function Api(pfx, broker, sourceMessage, environment) {
|
|
33
26
|
if (!sourceMessage) throw new Error('Api requires message');
|
|
34
27
|
const apiMessage = (0, _messageHelper.cloneMessage)(sourceMessage);
|
|
@@ -50,35 +43,28 @@ function Api(pfx, broker, sourceMessage, environment) {
|
|
|
50
43
|
this.owner = broker.owner;
|
|
51
44
|
this.messagePrefix = pfx;
|
|
52
45
|
}
|
|
53
|
-
|
|
54
46
|
const proto = Api.prototype;
|
|
55
|
-
|
|
56
47
|
proto.cancel = function cancel(message, options) {
|
|
57
48
|
this.sendApiMessage('cancel', {
|
|
58
49
|
message
|
|
59
50
|
}, options);
|
|
60
51
|
};
|
|
61
|
-
|
|
62
52
|
proto.discard = function discard() {
|
|
63
53
|
this.sendApiMessage('discard');
|
|
64
54
|
};
|
|
65
|
-
|
|
66
55
|
proto.fail = function fail(error) {
|
|
67
56
|
this.sendApiMessage('error', {
|
|
68
57
|
error
|
|
69
58
|
});
|
|
70
59
|
};
|
|
71
|
-
|
|
72
60
|
proto.signal = function signal(message, options) {
|
|
73
61
|
this.sendApiMessage('signal', {
|
|
74
62
|
message
|
|
75
63
|
}, options);
|
|
76
64
|
};
|
|
77
|
-
|
|
78
65
|
proto.stop = function stop() {
|
|
79
66
|
this.sendApiMessage('stop');
|
|
80
67
|
};
|
|
81
|
-
|
|
82
68
|
proto.resolveExpression = function resolveExpression(expression) {
|
|
83
69
|
return this.environment.resolveExpression(expression, {
|
|
84
70
|
fields: this.fields,
|
|
@@ -86,25 +72,24 @@ proto.resolveExpression = function resolveExpression(expression) {
|
|
|
86
72
|
properties: this.messageProperties
|
|
87
73
|
}, this.owner);
|
|
88
74
|
};
|
|
89
|
-
|
|
90
75
|
proto.sendApiMessage = function sendApiMessage(action, content, options) {
|
|
91
76
|
const correlationId = options && options.correlationId || (0, _shared.getUniqueId)(`${this.id || this.messagePrefix}_signal`);
|
|
92
77
|
let key = `${this.messagePrefix}.${action}`;
|
|
93
78
|
if (this.executionId) key += `.${this.executionId}`;
|
|
94
|
-
this.broker.publish('api', key, this.createMessage(content), {
|
|
79
|
+
this.broker.publish('api', key, this.createMessage(content), {
|
|
80
|
+
...options,
|
|
95
81
|
correlationId,
|
|
96
82
|
type: action
|
|
97
83
|
});
|
|
98
84
|
};
|
|
99
|
-
|
|
100
85
|
proto.getPostponed = function getPostponed(...args) {
|
|
101
86
|
if (this.owner.getPostponed) return this.owner.getPostponed(...args);
|
|
102
87
|
if (this.owner.isSubProcess && this.owner.execution) return this.owner.execution.getPostponed(...args);
|
|
103
88
|
return [];
|
|
104
89
|
};
|
|
105
|
-
|
|
106
90
|
proto.createMessage = function createMessage(content) {
|
|
107
|
-
return {
|
|
91
|
+
return {
|
|
92
|
+
...this.content,
|
|
108
93
|
...content
|
|
109
94
|
};
|
|
110
95
|
};
|
package/dist/src/Context.js
CHANGED
|
@@ -4,20 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = Context;
|
|
7
|
-
|
|
7
|
+
var _BpmnIO = _interopRequireDefault(require("./io/BpmnIO"));
|
|
8
8
|
var _Environment = _interopRequireDefault(require("./Environment"));
|
|
9
|
-
|
|
10
9
|
var _ExtensionsMapper = _interopRequireDefault(require("./ExtensionsMapper"));
|
|
11
|
-
|
|
12
10
|
var _shared = require("./shared");
|
|
13
|
-
|
|
14
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
12
|
function Context(definitionContext, environment) {
|
|
17
13
|
environment = environment ? environment.clone() : new _Environment.default();
|
|
18
14
|
return new ContextInstance(definitionContext, environment);
|
|
19
15
|
}
|
|
20
|
-
|
|
21
16
|
function ContextInstance(definitionContext, environment) {
|
|
22
17
|
const {
|
|
23
18
|
id = 'Def',
|
|
@@ -31,7 +26,7 @@ function ContextInstance(definitionContext, environment) {
|
|
|
31
26
|
this.sid = sid;
|
|
32
27
|
this.definitionContext = definitionContext;
|
|
33
28
|
this.environment = environment;
|
|
34
|
-
this.extensionsMapper =
|
|
29
|
+
this.extensionsMapper = new _ExtensionsMapper.default(this);
|
|
35
30
|
this.refs = {
|
|
36
31
|
activityRefs: {},
|
|
37
32
|
associationRefs: [],
|
|
@@ -44,9 +39,7 @@ function ContextInstance(definitionContext, environment) {
|
|
|
44
39
|
sequenceFlows: []
|
|
45
40
|
};
|
|
46
41
|
}
|
|
47
|
-
|
|
48
42
|
const proto = ContextInstance.prototype;
|
|
49
|
-
|
|
50
43
|
proto.getActivityById = function getActivityById(activityId) {
|
|
51
44
|
const activityInstance = this.refs.activityRefs[activityId];
|
|
52
45
|
if (activityInstance) return activityInstance;
|
|
@@ -54,14 +47,12 @@ proto.getActivityById = function getActivityById(activityId) {
|
|
|
54
47
|
if (!activity) return null;
|
|
55
48
|
return this.upsertActivity(activity);
|
|
56
49
|
};
|
|
57
|
-
|
|
58
50
|
proto.upsertActivity = function upsertActivity(activityDef) {
|
|
59
51
|
let activityInstance = this.refs.activityRefs[activityDef.id];
|
|
60
52
|
if (activityInstance) return activityInstance;
|
|
61
53
|
activityInstance = this.refs.activityRefs[activityDef.id] = new activityDef.Behaviour(activityDef, this);
|
|
62
54
|
return activityInstance;
|
|
63
55
|
};
|
|
64
|
-
|
|
65
56
|
proto.getSequenceFlowById = function getSequenceFlowById(sequenceFlowId) {
|
|
66
57
|
const flowInstance = this.refs.sequenceFlowRefs[sequenceFlowId];
|
|
67
58
|
if (flowInstance) return flowInstance;
|
|
@@ -69,31 +60,24 @@ proto.getSequenceFlowById = function getSequenceFlowById(sequenceFlowId) {
|
|
|
69
60
|
if (!flowDef) return null;
|
|
70
61
|
return this.upsertSequenceFlow(flowDef);
|
|
71
62
|
};
|
|
72
|
-
|
|
73
63
|
proto.getInboundSequenceFlows = function getInboundSequenceFlows(activityId) {
|
|
74
64
|
return (this.definitionContext.getInboundSequenceFlows(activityId) || []).map(flow => this.upsertSequenceFlow(flow));
|
|
75
65
|
};
|
|
76
|
-
|
|
77
66
|
proto.getOutboundSequenceFlows = function getOutboundSequenceFlows(activityId) {
|
|
78
67
|
return (this.definitionContext.getOutboundSequenceFlows(activityId) || []).map(flow => this.upsertSequenceFlow(flow));
|
|
79
68
|
};
|
|
80
|
-
|
|
81
69
|
proto.getInboundAssociations = function getInboundAssociations(activityId) {
|
|
82
70
|
return (this.definitionContext.getInboundAssociations(activityId) || []).map(association => this.upsertAssociation(association));
|
|
83
71
|
};
|
|
84
|
-
|
|
85
72
|
proto.getOutboundAssociations = function getOutboundAssociations(activityId) {
|
|
86
73
|
return (this.definitionContext.getOutboundAssociations(activityId) || []).map(association => this.upsertAssociation(association));
|
|
87
74
|
};
|
|
88
|
-
|
|
89
75
|
proto.getActivities = function getActivities(scopeId) {
|
|
90
76
|
return (this.definitionContext.getActivities(scopeId) || []).map(activityDef => this.upsertActivity(activityDef));
|
|
91
77
|
};
|
|
92
|
-
|
|
93
78
|
proto.getSequenceFlows = function getSequenceFlows(scopeId) {
|
|
94
79
|
return (this.definitionContext.getSequenceFlows(scopeId) || []).map(flow => this.upsertSequenceFlow(flow));
|
|
95
80
|
};
|
|
96
|
-
|
|
97
81
|
proto.upsertSequenceFlow = function upsertSequenceFlow(flowDefinition) {
|
|
98
82
|
const refs = this.refs.sequenceFlowRefs;
|
|
99
83
|
let flowInstance = refs[flowDefinition.id];
|
|
@@ -102,11 +86,9 @@ proto.upsertSequenceFlow = function upsertSequenceFlow(flowDefinition) {
|
|
|
102
86
|
this.refs.sequenceFlows.push(flowInstance);
|
|
103
87
|
return flowInstance;
|
|
104
88
|
};
|
|
105
|
-
|
|
106
89
|
proto.getAssociations = function getAssociations(scopeId) {
|
|
107
90
|
return (this.definitionContext.getAssociations(scopeId) || []).map(association => this.upsertAssociation(association));
|
|
108
91
|
};
|
|
109
|
-
|
|
110
92
|
proto.upsertAssociation = function upsertAssociation(associationDefinition) {
|
|
111
93
|
const refs = this.refs.associationRefs;
|
|
112
94
|
let instance = refs[associationDefinition.id];
|
|
@@ -114,11 +96,9 @@ proto.upsertAssociation = function upsertAssociation(associationDefinition) {
|
|
|
114
96
|
instance = refs[associationDefinition.id] = new associationDefinition.Behaviour(associationDefinition, this);
|
|
115
97
|
return instance;
|
|
116
98
|
};
|
|
117
|
-
|
|
118
99
|
proto.clone = function clone(newEnvironment) {
|
|
119
100
|
return new ContextInstance(this.definitionContext, newEnvironment || this.environment);
|
|
120
101
|
};
|
|
121
|
-
|
|
122
102
|
proto.getProcessById = function getProcessById(processId) {
|
|
123
103
|
const refs = this.refs.processRefs;
|
|
124
104
|
let bp = this.refs.processRefs[processId];
|
|
@@ -130,35 +110,29 @@ proto.getProcessById = function getProcessById(processId) {
|
|
|
130
110
|
this.refs.processes.push(bp);
|
|
131
111
|
return bp;
|
|
132
112
|
};
|
|
133
|
-
|
|
134
113
|
proto.getNewProcessById = function getNewProcessById(processId) {
|
|
135
114
|
if (!this.getProcessById(processId)) return null;
|
|
136
115
|
const bpDef = this.definitionContext.getProcessById(processId);
|
|
137
116
|
const bp = new bpDef.Behaviour(bpDef, this.clone(this.environment.clone()));
|
|
138
117
|
return bp;
|
|
139
118
|
};
|
|
140
|
-
|
|
141
119
|
proto.getProcesses = function getProcesses() {
|
|
142
120
|
return this.definitionContext.getProcesses().map(({
|
|
143
121
|
id: processId
|
|
144
122
|
}) => this.getProcessById(processId));
|
|
145
123
|
};
|
|
146
|
-
|
|
147
124
|
proto.getExecutableProcesses = function getExecutableProcesses() {
|
|
148
125
|
return this.definitionContext.getExecutableProcesses().map(({
|
|
149
126
|
id: processId
|
|
150
127
|
}) => this.getProcessById(processId));
|
|
151
128
|
};
|
|
152
|
-
|
|
153
129
|
proto.getMessageFlows = function getMessageFlows(sourceId) {
|
|
154
130
|
if (!this.refs.messageFlows.length) {
|
|
155
131
|
const flows = this.definitionContext.getMessageFlows() || [];
|
|
156
132
|
this.refs.messageFlows.push(...flows.map(flow => new flow.Behaviour(flow, this)));
|
|
157
133
|
}
|
|
158
|
-
|
|
159
134
|
return this.refs.messageFlows.filter(flow => flow.source.processId === sourceId);
|
|
160
135
|
};
|
|
161
|
-
|
|
162
136
|
proto.getDataObjectById = function getDataObjectById(referenceId) {
|
|
163
137
|
let dataObject;
|
|
164
138
|
if (dataObject = this.refs.dataObjectRefs[referenceId]) return dataObject;
|
|
@@ -167,7 +141,6 @@ proto.getDataObjectById = function getDataObjectById(referenceId) {
|
|
|
167
141
|
dataObject = this.refs.dataObjectRefs[dataObjectDef.id] = new dataObjectDef.Behaviour(dataObjectDef, this);
|
|
168
142
|
return dataObject;
|
|
169
143
|
};
|
|
170
|
-
|
|
171
144
|
proto.getDataStoreById = function getDataStoreById(referenceId) {
|
|
172
145
|
let dataStore;
|
|
173
146
|
if (dataStore = this.refs.dataStoreRefs[referenceId]) return dataStore;
|
|
@@ -176,33 +149,31 @@ proto.getDataStoreById = function getDataStoreById(referenceId) {
|
|
|
176
149
|
dataStore = this.refs.dataStoreRefs[dataStoreDef.id] = new dataStoreDef.Behaviour(dataStoreDef, this);
|
|
177
150
|
return dataStore;
|
|
178
151
|
};
|
|
179
|
-
|
|
180
152
|
proto.getStartActivities = function getStartActivities(filterOptions, scopeId) {
|
|
181
153
|
const {
|
|
182
154
|
referenceId,
|
|
183
155
|
referenceType = 'unknown'
|
|
184
156
|
} = filterOptions || {};
|
|
185
157
|
const result = [];
|
|
186
|
-
|
|
187
158
|
for (const activity of this.getActivities()) {
|
|
188
159
|
if (!activity.isStart) continue;
|
|
189
160
|
if (scopeId && activity.parent.id !== scopeId) continue;
|
|
190
|
-
|
|
191
161
|
if (!filterOptions) {
|
|
192
162
|
result.push(activity);
|
|
193
163
|
continue;
|
|
194
164
|
}
|
|
195
|
-
|
|
196
165
|
if (!activity.behaviour.eventDefinitions && !activity.behaviour.eventDefinitions) continue;
|
|
197
166
|
const ref = activity.eventDefinitions.some(ed => {
|
|
198
167
|
return ed.reference && ed.reference.id === referenceId && ed.reference.referenceType === referenceType;
|
|
199
168
|
});
|
|
200
169
|
if (ref) result.push(activity);
|
|
201
170
|
}
|
|
202
|
-
|
|
203
171
|
return result;
|
|
204
172
|
};
|
|
205
|
-
|
|
206
173
|
proto.loadExtensions = function loadExtensions(activity) {
|
|
207
|
-
|
|
174
|
+
const io = new _BpmnIO.default(activity, this);
|
|
175
|
+
const extensions = this.extensionsMapper.get(activity);
|
|
176
|
+
if (io.hasIo) extensions.extensions.push(io);
|
|
177
|
+
if (!extensions.extensions.length) return;
|
|
178
|
+
return extensions;
|
|
208
179
|
};
|
package/dist/src/Environment.js
CHANGED
|
@@ -4,19 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = Environment;
|
|
7
|
-
|
|
8
7
|
var _Expressions = _interopRequireDefault(require("./Expressions"));
|
|
9
|
-
|
|
10
8
|
var _Scripts = require("./Scripts");
|
|
11
|
-
|
|
12
9
|
var _Timers = require("./Timers");
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
const kServices = Symbol.for('services');
|
|
17
12
|
const kVariables = Symbol.for('variables');
|
|
18
13
|
const defaultOptions = ['expressions', 'extensions', 'Logger', 'output', 'scripts', 'services', 'settings', 'timers', 'variables'];
|
|
19
|
-
|
|
20
14
|
function Environment(options = {}) {
|
|
21
15
|
this.options = validateOptions(options);
|
|
22
16
|
this.expressions = options.expressions || (0, _Expressions.default)();
|
|
@@ -24,52 +18,46 @@ function Environment(options = {}) {
|
|
|
24
18
|
this.output = options.output || {};
|
|
25
19
|
this.scripts = options.scripts || (0, _Scripts.Scripts)();
|
|
26
20
|
this.timers = options.timers || (0, _Timers.Timers)();
|
|
27
|
-
this.settings = {
|
|
21
|
+
this.settings = {
|
|
22
|
+
...options.settings
|
|
28
23
|
};
|
|
29
24
|
this.Logger = options.Logger || DummyLogger;
|
|
30
25
|
this[kServices] = options.services || {};
|
|
31
26
|
this[kVariables] = options.variables || {};
|
|
32
27
|
}
|
|
33
|
-
|
|
34
28
|
const proto = Environment.prototype;
|
|
35
29
|
Object.defineProperty(proto, 'variables', {
|
|
36
30
|
enumerable: true,
|
|
37
|
-
|
|
38
31
|
get() {
|
|
39
32
|
return this[kVariables];
|
|
40
33
|
}
|
|
41
|
-
|
|
42
34
|
});
|
|
43
35
|
Object.defineProperty(proto, 'services', {
|
|
44
36
|
enumerable: true,
|
|
45
|
-
|
|
46
37
|
get() {
|
|
47
38
|
return this[kServices];
|
|
48
39
|
},
|
|
49
|
-
|
|
50
40
|
set(value) {
|
|
51
41
|
const services = this[kServices];
|
|
52
|
-
|
|
53
42
|
for (const name in services) {
|
|
54
43
|
if (!(name in value)) delete services[name];
|
|
55
44
|
}
|
|
56
|
-
|
|
57
45
|
Object.assign(services, value);
|
|
58
46
|
}
|
|
59
|
-
|
|
60
47
|
});
|
|
61
|
-
|
|
62
48
|
proto.getState = function getState() {
|
|
63
49
|
return {
|
|
64
|
-
settings: {
|
|
50
|
+
settings: {
|
|
51
|
+
...this.settings
|
|
65
52
|
},
|
|
66
|
-
variables: {
|
|
53
|
+
variables: {
|
|
54
|
+
...this[kVariables]
|
|
67
55
|
},
|
|
68
|
-
output: {
|
|
56
|
+
output: {
|
|
57
|
+
...this.output
|
|
69
58
|
}
|
|
70
59
|
};
|
|
71
60
|
};
|
|
72
|
-
|
|
73
61
|
proto.recover = function recover(state) {
|
|
74
62
|
if (!state) return this;
|
|
75
63
|
if (state.settings) Object.assign(this.settings, state.settings);
|
|
@@ -77,13 +65,14 @@ proto.recover = function recover(state) {
|
|
|
77
65
|
if (state.output) Object.assign(this.output, state.output);
|
|
78
66
|
return this;
|
|
79
67
|
};
|
|
80
|
-
|
|
81
68
|
proto.clone = function clone(overrideOptions = {}) {
|
|
82
69
|
const services = this[kServices];
|
|
83
70
|
const newOptions = {
|
|
84
|
-
settings: {
|
|
71
|
+
settings: {
|
|
72
|
+
...this.settings
|
|
85
73
|
},
|
|
86
|
-
variables: {
|
|
74
|
+
variables: {
|
|
75
|
+
...this[kVariables]
|
|
87
76
|
},
|
|
88
77
|
Logger: this.Logger,
|
|
89
78
|
extensions: this.extensions,
|
|
@@ -94,38 +83,35 @@ proto.clone = function clone(overrideOptions = {}) {
|
|
|
94
83
|
...overrideOptions,
|
|
95
84
|
services
|
|
96
85
|
};
|
|
97
|
-
if (overrideOptions.services) newOptions.services = {
|
|
86
|
+
if (overrideOptions.services) newOptions.services = {
|
|
87
|
+
...services,
|
|
98
88
|
...overrideOptions.services
|
|
99
89
|
};
|
|
100
90
|
return new this.constructor(newOptions);
|
|
101
91
|
};
|
|
102
|
-
|
|
103
92
|
proto.assignVariables = function assignVariables(newVars) {
|
|
104
93
|
if (!newVars || typeof newVars !== 'object') return;
|
|
105
|
-
this[kVariables] = {
|
|
94
|
+
this[kVariables] = {
|
|
95
|
+
...this.variables,
|
|
106
96
|
...newVars
|
|
107
97
|
};
|
|
108
98
|
};
|
|
109
|
-
|
|
110
99
|
proto.assignSettings = function assignVariables(newSettings) {
|
|
111
100
|
if (!newSettings || typeof newSettings !== 'object') return;
|
|
112
|
-
this.settings = {
|
|
101
|
+
this.settings = {
|
|
102
|
+
...this.settings,
|
|
113
103
|
...newSettings
|
|
114
104
|
};
|
|
115
105
|
};
|
|
116
|
-
|
|
117
106
|
proto.getScript = function getScript(...args) {
|
|
118
107
|
return this.scripts.getScript(...args);
|
|
119
108
|
};
|
|
120
|
-
|
|
121
109
|
proto.registerScript = function registerScript(...args) {
|
|
122
110
|
return this.scripts.register(...args);
|
|
123
111
|
};
|
|
124
|
-
|
|
125
112
|
proto.getServiceByName = function getServiceByName(serviceName) {
|
|
126
113
|
return this[kServices][serviceName];
|
|
127
114
|
};
|
|
128
|
-
|
|
129
115
|
proto.resolveExpression = function resolveExpression(expression, message = {}, expressionFnContext) {
|
|
130
116
|
const from = {
|
|
131
117
|
environment: this,
|
|
@@ -133,52 +119,40 @@ proto.resolveExpression = function resolveExpression(expression, message = {}, e
|
|
|
133
119
|
};
|
|
134
120
|
return this.expressions.resolveExpression(expression, from, expressionFnContext);
|
|
135
121
|
};
|
|
136
|
-
|
|
137
122
|
proto.addService = function addService(name, fn) {
|
|
138
123
|
this[kServices][name] = fn;
|
|
139
124
|
};
|
|
140
|
-
|
|
141
125
|
function validateOptions(input) {
|
|
142
126
|
const options = {};
|
|
143
|
-
|
|
144
127
|
for (const key in input) {
|
|
145
128
|
if (defaultOptions.indexOf(key) === -1) {
|
|
146
129
|
options[key] = input[key];
|
|
147
130
|
}
|
|
148
131
|
}
|
|
149
|
-
|
|
150
132
|
if (input.timers) {
|
|
151
133
|
if (typeof input.timers.register !== 'function') throw new Error('timers.register is not a function');
|
|
152
134
|
if (typeof input.timers.setTimeout !== 'function') throw new Error('timers.setTimeout is not a function');
|
|
153
135
|
if (typeof input.timers.clearTimeout !== 'function') throw new Error('timers.clearTimeout is not a function');
|
|
154
136
|
}
|
|
155
|
-
|
|
156
137
|
if (input.scripts) {
|
|
157
138
|
if (typeof input.scripts.register !== 'function') throw new Error('scripts.register is not a function');
|
|
158
139
|
if (typeof input.scripts.getScript !== 'function') throw new Error('scripts.getScript is not a function');
|
|
159
140
|
}
|
|
160
|
-
|
|
161
141
|
if (input.extensions) {
|
|
162
142
|
if (typeof input.extensions !== 'object') throw new Error('extensions is not an object');
|
|
163
|
-
|
|
164
143
|
for (const key in input.extensions) {
|
|
165
144
|
if (typeof input.extensions[key] !== 'function') throw new Error(`extensions[${key}] is not a function`);
|
|
166
145
|
}
|
|
167
146
|
}
|
|
168
|
-
|
|
169
147
|
return options;
|
|
170
148
|
}
|
|
171
|
-
|
|
172
149
|
function DummyLogger() {
|
|
173
150
|
return {
|
|
174
151
|
debug,
|
|
175
152
|
error,
|
|
176
153
|
warn
|
|
177
154
|
};
|
|
178
|
-
|
|
179
155
|
function debug() {}
|
|
180
|
-
|
|
181
156
|
function error() {}
|
|
182
|
-
|
|
183
157
|
function warn() {}
|
|
184
158
|
}
|