bpmn-elements 8.2.0 → 8.2.2
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 +8 -0
- package/dist/index.js +0 -49
- package/dist/src/Api.js +4 -19
- package/dist/src/Context.js +0 -35
- 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 +0 -12
- 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 +39 -243
- 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 +2 -7
- 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 +12 -37
- package/dist/src/io/Properties.js +6 -39
- package/dist/src/messageHelper.js +10 -23
- package/dist/src/process/Process.js +10 -112
- package/dist/src/process/ProcessExecution.js +24 -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 +0 -20
- 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 +7 -7
- package/src/Context.js +0 -1
- package/src/activity/Activity.js +1 -1
- package/src/gateways/EventBasedGateway.js +0 -1
- package/src/io/InputOutputSpecification.js +0 -1
- package/src/process/ProcessExecution.js +8 -1
- package/src/tasks/StandardLoopCharacteristics.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
+
# 8.2.2
|
|
5
|
+
|
|
6
|
+
- mitigate possible stack overflow error by not acking message before publishing a new one. Fix after fix #31
|
|
7
|
+
|
|
8
|
+
# 8.2.1
|
|
9
|
+
|
|
10
|
+
- fix resume on caught activity error throws #31
|
|
11
|
+
|
|
4
12
|
# 8.2.0
|
|
5
13
|
|
|
6
14
|
- fix resume when activity has formatting status, extensions were not re-activated
|
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,22 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = Context;
|
|
7
|
-
|
|
8
7
|
var _BpmnIO = _interopRequireDefault(require("./io/BpmnIO"));
|
|
9
|
-
|
|
10
8
|
var _Environment = _interopRequireDefault(require("./Environment"));
|
|
11
|
-
|
|
12
9
|
var _ExtensionsMapper = _interopRequireDefault(require("./ExtensionsMapper"));
|
|
13
|
-
|
|
14
10
|
var _shared = require("./shared");
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
12
|
function Context(definitionContext, environment) {
|
|
19
13
|
environment = environment ? environment.clone() : new _Environment.default();
|
|
20
14
|
return new ContextInstance(definitionContext, environment);
|
|
21
15
|
}
|
|
22
|
-
|
|
23
16
|
function ContextInstance(definitionContext, environment) {
|
|
24
17
|
const {
|
|
25
18
|
id = 'Def',
|
|
@@ -46,9 +39,7 @@ function ContextInstance(definitionContext, environment) {
|
|
|
46
39
|
sequenceFlows: []
|
|
47
40
|
};
|
|
48
41
|
}
|
|
49
|
-
|
|
50
42
|
const proto = ContextInstance.prototype;
|
|
51
|
-
|
|
52
43
|
proto.getActivityById = function getActivityById(activityId) {
|
|
53
44
|
const activityInstance = this.refs.activityRefs[activityId];
|
|
54
45
|
if (activityInstance) return activityInstance;
|
|
@@ -56,14 +47,12 @@ proto.getActivityById = function getActivityById(activityId) {
|
|
|
56
47
|
if (!activity) return null;
|
|
57
48
|
return this.upsertActivity(activity);
|
|
58
49
|
};
|
|
59
|
-
|
|
60
50
|
proto.upsertActivity = function upsertActivity(activityDef) {
|
|
61
51
|
let activityInstance = this.refs.activityRefs[activityDef.id];
|
|
62
52
|
if (activityInstance) return activityInstance;
|
|
63
53
|
activityInstance = this.refs.activityRefs[activityDef.id] = new activityDef.Behaviour(activityDef, this);
|
|
64
54
|
return activityInstance;
|
|
65
55
|
};
|
|
66
|
-
|
|
67
56
|
proto.getSequenceFlowById = function getSequenceFlowById(sequenceFlowId) {
|
|
68
57
|
const flowInstance = this.refs.sequenceFlowRefs[sequenceFlowId];
|
|
69
58
|
if (flowInstance) return flowInstance;
|
|
@@ -71,31 +60,24 @@ proto.getSequenceFlowById = function getSequenceFlowById(sequenceFlowId) {
|
|
|
71
60
|
if (!flowDef) return null;
|
|
72
61
|
return this.upsertSequenceFlow(flowDef);
|
|
73
62
|
};
|
|
74
|
-
|
|
75
63
|
proto.getInboundSequenceFlows = function getInboundSequenceFlows(activityId) {
|
|
76
64
|
return (this.definitionContext.getInboundSequenceFlows(activityId) || []).map(flow => this.upsertSequenceFlow(flow));
|
|
77
65
|
};
|
|
78
|
-
|
|
79
66
|
proto.getOutboundSequenceFlows = function getOutboundSequenceFlows(activityId) {
|
|
80
67
|
return (this.definitionContext.getOutboundSequenceFlows(activityId) || []).map(flow => this.upsertSequenceFlow(flow));
|
|
81
68
|
};
|
|
82
|
-
|
|
83
69
|
proto.getInboundAssociations = function getInboundAssociations(activityId) {
|
|
84
70
|
return (this.definitionContext.getInboundAssociations(activityId) || []).map(association => this.upsertAssociation(association));
|
|
85
71
|
};
|
|
86
|
-
|
|
87
72
|
proto.getOutboundAssociations = function getOutboundAssociations(activityId) {
|
|
88
73
|
return (this.definitionContext.getOutboundAssociations(activityId) || []).map(association => this.upsertAssociation(association));
|
|
89
74
|
};
|
|
90
|
-
|
|
91
75
|
proto.getActivities = function getActivities(scopeId) {
|
|
92
76
|
return (this.definitionContext.getActivities(scopeId) || []).map(activityDef => this.upsertActivity(activityDef));
|
|
93
77
|
};
|
|
94
|
-
|
|
95
78
|
proto.getSequenceFlows = function getSequenceFlows(scopeId) {
|
|
96
79
|
return (this.definitionContext.getSequenceFlows(scopeId) || []).map(flow => this.upsertSequenceFlow(flow));
|
|
97
80
|
};
|
|
98
|
-
|
|
99
81
|
proto.upsertSequenceFlow = function upsertSequenceFlow(flowDefinition) {
|
|
100
82
|
const refs = this.refs.sequenceFlowRefs;
|
|
101
83
|
let flowInstance = refs[flowDefinition.id];
|
|
@@ -104,11 +86,9 @@ proto.upsertSequenceFlow = function upsertSequenceFlow(flowDefinition) {
|
|
|
104
86
|
this.refs.sequenceFlows.push(flowInstance);
|
|
105
87
|
return flowInstance;
|
|
106
88
|
};
|
|
107
|
-
|
|
108
89
|
proto.getAssociations = function getAssociations(scopeId) {
|
|
109
90
|
return (this.definitionContext.getAssociations(scopeId) || []).map(association => this.upsertAssociation(association));
|
|
110
91
|
};
|
|
111
|
-
|
|
112
92
|
proto.upsertAssociation = function upsertAssociation(associationDefinition) {
|
|
113
93
|
const refs = this.refs.associationRefs;
|
|
114
94
|
let instance = refs[associationDefinition.id];
|
|
@@ -116,11 +96,9 @@ proto.upsertAssociation = function upsertAssociation(associationDefinition) {
|
|
|
116
96
|
instance = refs[associationDefinition.id] = new associationDefinition.Behaviour(associationDefinition, this);
|
|
117
97
|
return instance;
|
|
118
98
|
};
|
|
119
|
-
|
|
120
99
|
proto.clone = function clone(newEnvironment) {
|
|
121
100
|
return new ContextInstance(this.definitionContext, newEnvironment || this.environment);
|
|
122
101
|
};
|
|
123
|
-
|
|
124
102
|
proto.getProcessById = function getProcessById(processId) {
|
|
125
103
|
const refs = this.refs.processRefs;
|
|
126
104
|
let bp = this.refs.processRefs[processId];
|
|
@@ -132,35 +110,29 @@ proto.getProcessById = function getProcessById(processId) {
|
|
|
132
110
|
this.refs.processes.push(bp);
|
|
133
111
|
return bp;
|
|
134
112
|
};
|
|
135
|
-
|
|
136
113
|
proto.getNewProcessById = function getNewProcessById(processId) {
|
|
137
114
|
if (!this.getProcessById(processId)) return null;
|
|
138
115
|
const bpDef = this.definitionContext.getProcessById(processId);
|
|
139
116
|
const bp = new bpDef.Behaviour(bpDef, this.clone(this.environment.clone()));
|
|
140
117
|
return bp;
|
|
141
118
|
};
|
|
142
|
-
|
|
143
119
|
proto.getProcesses = function getProcesses() {
|
|
144
120
|
return this.definitionContext.getProcesses().map(({
|
|
145
121
|
id: processId
|
|
146
122
|
}) => this.getProcessById(processId));
|
|
147
123
|
};
|
|
148
|
-
|
|
149
124
|
proto.getExecutableProcesses = function getExecutableProcesses() {
|
|
150
125
|
return this.definitionContext.getExecutableProcesses().map(({
|
|
151
126
|
id: processId
|
|
152
127
|
}) => this.getProcessById(processId));
|
|
153
128
|
};
|
|
154
|
-
|
|
155
129
|
proto.getMessageFlows = function getMessageFlows(sourceId) {
|
|
156
130
|
if (!this.refs.messageFlows.length) {
|
|
157
131
|
const flows = this.definitionContext.getMessageFlows() || [];
|
|
158
132
|
this.refs.messageFlows.push(...flows.map(flow => new flow.Behaviour(flow, this)));
|
|
159
133
|
}
|
|
160
|
-
|
|
161
134
|
return this.refs.messageFlows.filter(flow => flow.source.processId === sourceId);
|
|
162
135
|
};
|
|
163
|
-
|
|
164
136
|
proto.getDataObjectById = function getDataObjectById(referenceId) {
|
|
165
137
|
let dataObject;
|
|
166
138
|
if (dataObject = this.refs.dataObjectRefs[referenceId]) return dataObject;
|
|
@@ -169,7 +141,6 @@ proto.getDataObjectById = function getDataObjectById(referenceId) {
|
|
|
169
141
|
dataObject = this.refs.dataObjectRefs[dataObjectDef.id] = new dataObjectDef.Behaviour(dataObjectDef, this);
|
|
170
142
|
return dataObject;
|
|
171
143
|
};
|
|
172
|
-
|
|
173
144
|
proto.getDataStoreById = function getDataStoreById(referenceId) {
|
|
174
145
|
let dataStore;
|
|
175
146
|
if (dataStore = this.refs.dataStoreRefs[referenceId]) return dataStore;
|
|
@@ -178,33 +149,27 @@ proto.getDataStoreById = function getDataStoreById(referenceId) {
|
|
|
178
149
|
dataStore = this.refs.dataStoreRefs[dataStoreDef.id] = new dataStoreDef.Behaviour(dataStoreDef, this);
|
|
179
150
|
return dataStore;
|
|
180
151
|
};
|
|
181
|
-
|
|
182
152
|
proto.getStartActivities = function getStartActivities(filterOptions, scopeId) {
|
|
183
153
|
const {
|
|
184
154
|
referenceId,
|
|
185
155
|
referenceType = 'unknown'
|
|
186
156
|
} = filterOptions || {};
|
|
187
157
|
const result = [];
|
|
188
|
-
|
|
189
158
|
for (const activity of this.getActivities()) {
|
|
190
159
|
if (!activity.isStart) continue;
|
|
191
160
|
if (scopeId && activity.parent.id !== scopeId) continue;
|
|
192
|
-
|
|
193
161
|
if (!filterOptions) {
|
|
194
162
|
result.push(activity);
|
|
195
163
|
continue;
|
|
196
164
|
}
|
|
197
|
-
|
|
198
165
|
if (!activity.behaviour.eventDefinitions && !activity.behaviour.eventDefinitions) continue;
|
|
199
166
|
const ref = activity.eventDefinitions.some(ed => {
|
|
200
167
|
return ed.reference && ed.reference.id === referenceId && ed.reference.referenceType === referenceType;
|
|
201
168
|
});
|
|
202
169
|
if (ref) result.push(activity);
|
|
203
170
|
}
|
|
204
|
-
|
|
205
171
|
return result;
|
|
206
172
|
};
|
|
207
|
-
|
|
208
173
|
proto.loadExtensions = function loadExtensions(activity) {
|
|
209
174
|
const io = new _BpmnIO.default(activity, this);
|
|
210
175
|
const extensions = this.extensionsMapper.get(activity);
|
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
|
}
|