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.
- package/CHANGELOG.md +10 -0
- package/dist/{src/Api.js → Api.js} +11 -12
- package/dist/{src/Context.js → Context.js} +26 -27
- package/dist/{src/Environment.js → Environment.js} +15 -16
- package/dist/{src/EventBroker.js → EventBroker.js} +1 -1
- package/dist/{src/Expressions.js → Expressions.js} +1 -1
- package/dist/{src/MessageFormatter.js → MessageFormatter.js} +3 -3
- package/dist/{src/activity → activity}/Activity.js +62 -63
- package/dist/{src/activity → activity}/ActivityExecution.js +23 -24
- package/dist/{src/activity → activity}/Dummy.js +1 -1
- package/dist/{src/activity → activity}/ExecutionScope.js +2 -2
- package/dist/{src/definition → definition}/Definition.js +41 -42
- package/dist/{src/definition → definition}/DefinitionExecution.js +45 -46
- package/dist/{src/error → error}/Errors.js +1 -1
- package/dist/{src/eventDefinitions → eventDefinitions}/CancelEventDefinition.js +12 -13
- package/dist/{src/eventDefinitions → eventDefinitions}/CompensateEventDefinition.js +12 -13
- package/dist/{src/eventDefinitions → eventDefinitions}/ConditionalEventDefinition.js +13 -14
- package/dist/{src/eventDefinitions → eventDefinitions}/ErrorEventDefinition.js +13 -14
- package/dist/{src/eventDefinitions → eventDefinitions}/EscalationEventDefinition.js +12 -13
- package/dist/{src/eventDefinitions → eventDefinitions}/EventDefinitionExecution.js +10 -11
- package/dist/{src/eventDefinitions → eventDefinitions}/LinkEventDefinition.js +14 -15
- package/dist/{src/eventDefinitions → eventDefinitions}/MessageEventDefinition.js +13 -14
- package/dist/{src/eventDefinitions → eventDefinitions}/SignalEventDefinition.js +13 -14
- package/dist/{src/eventDefinitions → eventDefinitions}/TerminateEventDefinition.js +1 -1
- package/dist/{src/eventDefinitions → eventDefinitions}/TimerEventDefinition.js +15 -16
- package/dist/{src/events → events}/BoundaryEvent.js +15 -16
- package/dist/{src/events → events}/EndEvent.js +3 -3
- package/dist/{src/events → events}/IntermediateCatchEvent.js +3 -3
- package/dist/{src/events → events}/IntermediateThrowEvent.js +3 -3
- package/dist/{src/events → events}/StartEvent.js +8 -9
- package/dist/{src/flows → flows}/Association.js +15 -16
- package/dist/{src/flows → flows}/MessageFlow.js +16 -14
- package/dist/{src/flows → flows}/SequenceFlow.js +16 -18
- package/dist/{src/gateways → gateways}/EventBasedGateway.js +2 -2
- package/dist/{src/gateways → gateways}/ExclusiveGateway.js +2 -2
- package/dist/{src/gateways → gateways}/InclusiveGateway.js +2 -2
- package/dist/{src/gateways → gateways}/ParallelGateway.js +2 -2
- package/dist/index.js +48 -48
- package/dist/{src/io → io}/InputOutputSpecification.js +8 -9
- package/dist/{src/io → io}/Properties.js +7 -8
- package/dist/package.json +3 -0
- package/dist/{src/process → process}/Process.js +39 -40
- package/dist/{src/process → process}/ProcessExecution.js +42 -43
- package/dist/{src/tasks → tasks}/CallActivity.js +7 -8
- package/dist/{src/tasks → tasks}/LoopCharacteristics.js +2 -2
- package/dist/{src/tasks → tasks}/ReceiveTask.js +14 -15
- package/dist/{src/tasks → tasks}/ScriptTask.js +4 -4
- package/dist/{src/tasks → tasks}/ServiceImplementation.js +1 -1
- package/dist/{src/tasks → tasks}/ServiceTask.js +6 -7
- package/dist/{src/tasks → tasks}/SignalTask.js +7 -8
- package/dist/{src/tasks → tasks}/StandardLoopCharacteristics.js +1 -1
- package/dist/{src/tasks → tasks}/SubProcess.js +17 -18
- package/dist/{src/tasks → tasks}/Task.js +2 -2
- package/dist/{src/tasks → tasks}/Transaction.js +1 -1
- package/package.json +30 -30
- package/src/Api.js +11 -13
- package/src/Context.js +26 -28
- package/src/Environment.js +15 -17
- package/src/EventBroker.js +1 -1
- package/src/Expressions.js +1 -1
- package/src/MessageFormatter.js +3 -3
- package/src/activity/Activity.js +62 -64
- package/src/activity/ActivityExecution.js +23 -25
- package/src/activity/Dummy.js +1 -1
- package/src/activity/ExecutionScope.js +2 -2
- package/src/definition/Definition.js +41 -43
- package/src/definition/DefinitionExecution.js +45 -47
- package/src/error/Errors.js +1 -1
- package/src/eventDefinitions/CancelEventDefinition.js +12 -14
- package/src/eventDefinitions/CompensateEventDefinition.js +12 -14
- package/src/eventDefinitions/ConditionalEventDefinition.js +13 -15
- package/src/eventDefinitions/ErrorEventDefinition.js +13 -15
- package/src/eventDefinitions/EscalationEventDefinition.js +12 -14
- package/src/eventDefinitions/EventDefinitionExecution.js +10 -12
- package/src/eventDefinitions/LinkEventDefinition.js +14 -16
- package/src/eventDefinitions/MessageEventDefinition.js +13 -15
- package/src/eventDefinitions/SignalEventDefinition.js +13 -15
- package/src/eventDefinitions/TerminateEventDefinition.js +1 -1
- package/src/eventDefinitions/TimerEventDefinition.js +15 -17
- package/src/events/BoundaryEvent.js +15 -17
- package/src/events/EndEvent.js +3 -3
- package/src/events/IntermediateCatchEvent.js +3 -3
- package/src/events/IntermediateThrowEvent.js +3 -3
- package/src/events/StartEvent.js +8 -10
- package/src/flows/Association.js +15 -17
- package/src/flows/MessageFlow.js +14 -15
- package/src/flows/SequenceFlow.js +16 -20
- package/src/gateways/EventBasedGateway.js +2 -2
- package/src/gateways/ExclusiveGateway.js +2 -2
- package/src/gateways/InclusiveGateway.js +2 -2
- package/src/gateways/ParallelGateway.js +2 -2
- package/src/index.js +106 -0
- package/src/io/InputOutputSpecification.js +8 -10
- package/src/io/Properties.js +7 -9
- package/src/process/Process.js +39 -41
- package/src/process/ProcessExecution.js +42 -44
- package/src/tasks/CallActivity.js +7 -9
- package/src/tasks/LoopCharacteristics.js +2 -2
- package/src/tasks/ReceiveTask.js +215 -217
- package/src/tasks/ScriptTask.js +4 -4
- package/src/tasks/ServiceImplementation.js +1 -1
- package/src/tasks/ServiceTask.js +6 -8
- package/src/tasks/SignalTask.js +7 -9
- package/src/tasks/StandardLoopCharacteristics.js +1 -1
- package/src/tasks/SubProcess.js +17 -19
- package/src/tasks/Task.js +2 -2
- package/src/tasks/Transaction.js +1 -1
- package/types/index.d.ts +491 -0
- package/index.js +0 -106
- /package/dist/{src/ExtensionsMapper.js → ExtensionsMapper.js} +0 -0
- /package/dist/{src/Scripts.js → Scripts.js} +0 -0
- /package/dist/{src/Timers.js → Timers.js} +0 -0
- /package/dist/{src/activity → activity}/Escalation.js +0 -0
- /package/dist/{src/activity → activity}/Message.js +0 -0
- /package/dist/{src/activity → activity}/Signal.js +0 -0
- /package/dist/{src/error → error}/BpmnError.js +0 -0
- /package/dist/{src/getPropertyValue.js → getPropertyValue.js} +0 -0
- /package/dist/{src/io → io}/BpmnIO.js +0 -0
- /package/dist/{src/io → io}/EnvironmentDataObject.js +0 -0
- /package/dist/{src/io → io}/EnvironmentDataStore.js +0 -0
- /package/dist/{src/io → io}/EnvironmentDataStoreReference.js +0 -0
- /package/dist/{src/messageHelper.js → messageHelper.js} +0 -0
- /package/dist/{src/shared.js → shared.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
+
# 9.0.0
|
|
5
|
+
|
|
6
|
+
- Turn into module with exports for node
|
|
7
|
+
- Add basic type declaration, still learning
|
|
8
|
+
- return Api instance for Message- and Association flows, as stated by type declaration
|
|
9
|
+
|
|
10
|
+
# 8.2.4
|
|
11
|
+
|
|
12
|
+
- allow process to start before receiving api messages, should fix issue #32
|
|
13
|
+
|
|
4
14
|
# 8.2.3
|
|
5
15
|
|
|
6
16
|
- fix resumed boundary event initialized twice even if it's completed
|
|
@@ -8,8 +8,8 @@ exports.Api = Api;
|
|
|
8
8
|
exports.DefinitionApi = DefinitionApi;
|
|
9
9
|
exports.FlowApi = FlowApi;
|
|
10
10
|
exports.ProcessApi = ProcessApi;
|
|
11
|
-
var _messageHelper = require("./messageHelper");
|
|
12
|
-
var _shared = require("./shared");
|
|
11
|
+
var _messageHelper = require("./messageHelper.js");
|
|
12
|
+
var _shared = require("./shared.js");
|
|
13
13
|
function ActivityApi(broker, apiMessage, environment) {
|
|
14
14
|
return new Api('activity', broker, apiMessage, environment);
|
|
15
15
|
}
|
|
@@ -43,36 +43,35 @@ function Api(pfx, broker, sourceMessage, environment) {
|
|
|
43
43
|
this.owner = broker.owner;
|
|
44
44
|
this.messagePrefix = pfx;
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
proto.cancel = function cancel(message, options) {
|
|
46
|
+
Api.prototype.cancel = function cancel(message, options) {
|
|
48
47
|
this.sendApiMessage('cancel', {
|
|
49
48
|
message
|
|
50
49
|
}, options);
|
|
51
50
|
};
|
|
52
|
-
|
|
51
|
+
Api.prototype.discard = function discard() {
|
|
53
52
|
this.sendApiMessage('discard');
|
|
54
53
|
};
|
|
55
|
-
|
|
54
|
+
Api.prototype.fail = function fail(error) {
|
|
56
55
|
this.sendApiMessage('error', {
|
|
57
56
|
error
|
|
58
57
|
});
|
|
59
58
|
};
|
|
60
|
-
|
|
59
|
+
Api.prototype.signal = function signal(message, options) {
|
|
61
60
|
this.sendApiMessage('signal', {
|
|
62
61
|
message
|
|
63
62
|
}, options);
|
|
64
63
|
};
|
|
65
|
-
|
|
64
|
+
Api.prototype.stop = function stop() {
|
|
66
65
|
this.sendApiMessage('stop');
|
|
67
66
|
};
|
|
68
|
-
|
|
67
|
+
Api.prototype.resolveExpression = function resolveExpression(expression) {
|
|
69
68
|
return this.environment.resolveExpression(expression, {
|
|
70
69
|
fields: this.fields,
|
|
71
70
|
content: this.content,
|
|
72
71
|
properties: this.messageProperties
|
|
73
72
|
}, this.owner);
|
|
74
73
|
};
|
|
75
|
-
|
|
74
|
+
Api.prototype.sendApiMessage = function sendApiMessage(action, content, options) {
|
|
76
75
|
const correlationId = options && options.correlationId || (0, _shared.getUniqueId)(`${this.id || this.messagePrefix}_signal`);
|
|
77
76
|
let key = `${this.messagePrefix}.${action}`;
|
|
78
77
|
if (this.executionId) key += `.${this.executionId}`;
|
|
@@ -82,12 +81,12 @@ proto.sendApiMessage = function sendApiMessage(action, content, options) {
|
|
|
82
81
|
type: action
|
|
83
82
|
});
|
|
84
83
|
};
|
|
85
|
-
|
|
84
|
+
Api.prototype.getPostponed = function getPostponed(...args) {
|
|
86
85
|
if (this.owner.getPostponed) return this.owner.getPostponed(...args);
|
|
87
86
|
if (this.owner.isSubProcess && this.owner.execution) return this.owner.execution.getPostponed(...args);
|
|
88
87
|
return [];
|
|
89
88
|
};
|
|
90
|
-
|
|
89
|
+
Api.prototype.createMessage = function createMessage(content) {
|
|
91
90
|
return {
|
|
92
91
|
...this.content,
|
|
93
92
|
...content
|
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = Context;
|
|
7
|
-
var _BpmnIO = _interopRequireDefault(require("./io/BpmnIO"));
|
|
8
|
-
var _Environment = _interopRequireDefault(require("./Environment"));
|
|
9
|
-
var _ExtensionsMapper = _interopRequireDefault(require("./ExtensionsMapper"));
|
|
10
|
-
var _shared = require("./shared");
|
|
7
|
+
var _BpmnIO = _interopRequireDefault(require("./io/BpmnIO.js"));
|
|
8
|
+
var _Environment = _interopRequireDefault(require("./Environment.js"));
|
|
9
|
+
var _ExtensionsMapper = _interopRequireDefault(require("./ExtensionsMapper.js"));
|
|
10
|
+
var _shared = require("./shared.js");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
function Context(definitionContext, environment) {
|
|
13
13
|
environment = environment ? environment.clone() : new _Environment.default();
|
|
@@ -39,46 +39,45 @@ function ContextInstance(definitionContext, environment) {
|
|
|
39
39
|
sequenceFlows: []
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
proto.getActivityById = function getActivityById(activityId) {
|
|
42
|
+
ContextInstance.prototype.getActivityById = function getActivityById(activityId) {
|
|
44
43
|
const activityInstance = this.refs.activityRefs[activityId];
|
|
45
44
|
if (activityInstance) return activityInstance;
|
|
46
45
|
const activity = this.definitionContext.getActivityById(activityId);
|
|
47
46
|
if (!activity) return null;
|
|
48
47
|
return this.upsertActivity(activity);
|
|
49
48
|
};
|
|
50
|
-
|
|
49
|
+
ContextInstance.prototype.upsertActivity = function upsertActivity(activityDef) {
|
|
51
50
|
let activityInstance = this.refs.activityRefs[activityDef.id];
|
|
52
51
|
if (activityInstance) return activityInstance;
|
|
53
52
|
activityInstance = this.refs.activityRefs[activityDef.id] = new activityDef.Behaviour(activityDef, this);
|
|
54
53
|
return activityInstance;
|
|
55
54
|
};
|
|
56
|
-
|
|
55
|
+
ContextInstance.prototype.getSequenceFlowById = function getSequenceFlowById(sequenceFlowId) {
|
|
57
56
|
const flowInstance = this.refs.sequenceFlowRefs[sequenceFlowId];
|
|
58
57
|
if (flowInstance) return flowInstance;
|
|
59
58
|
const flowDef = this.definitionContext.getSequenceFlowById(sequenceFlowId);
|
|
60
59
|
if (!flowDef) return null;
|
|
61
60
|
return this.upsertSequenceFlow(flowDef);
|
|
62
61
|
};
|
|
63
|
-
|
|
62
|
+
ContextInstance.prototype.getInboundSequenceFlows = function getInboundSequenceFlows(activityId) {
|
|
64
63
|
return (this.definitionContext.getInboundSequenceFlows(activityId) || []).map(flow => this.upsertSequenceFlow(flow));
|
|
65
64
|
};
|
|
66
|
-
|
|
65
|
+
ContextInstance.prototype.getOutboundSequenceFlows = function getOutboundSequenceFlows(activityId) {
|
|
67
66
|
return (this.definitionContext.getOutboundSequenceFlows(activityId) || []).map(flow => this.upsertSequenceFlow(flow));
|
|
68
67
|
};
|
|
69
|
-
|
|
68
|
+
ContextInstance.prototype.getInboundAssociations = function getInboundAssociations(activityId) {
|
|
70
69
|
return (this.definitionContext.getInboundAssociations(activityId) || []).map(association => this.upsertAssociation(association));
|
|
71
70
|
};
|
|
72
|
-
|
|
71
|
+
ContextInstance.prototype.getOutboundAssociations = function getOutboundAssociations(activityId) {
|
|
73
72
|
return (this.definitionContext.getOutboundAssociations(activityId) || []).map(association => this.upsertAssociation(association));
|
|
74
73
|
};
|
|
75
|
-
|
|
74
|
+
ContextInstance.prototype.getActivities = function getActivities(scopeId) {
|
|
76
75
|
return (this.definitionContext.getActivities(scopeId) || []).map(activityDef => this.upsertActivity(activityDef));
|
|
77
76
|
};
|
|
78
|
-
|
|
77
|
+
ContextInstance.prototype.getSequenceFlows = function getSequenceFlows(scopeId) {
|
|
79
78
|
return (this.definitionContext.getSequenceFlows(scopeId) || []).map(flow => this.upsertSequenceFlow(flow));
|
|
80
79
|
};
|
|
81
|
-
|
|
80
|
+
ContextInstance.prototype.upsertSequenceFlow = function upsertSequenceFlow(flowDefinition) {
|
|
82
81
|
const refs = this.refs.sequenceFlowRefs;
|
|
83
82
|
let flowInstance = refs[flowDefinition.id];
|
|
84
83
|
if (flowInstance) return flowInstance;
|
|
@@ -86,20 +85,20 @@ proto.upsertSequenceFlow = function upsertSequenceFlow(flowDefinition) {
|
|
|
86
85
|
this.refs.sequenceFlows.push(flowInstance);
|
|
87
86
|
return flowInstance;
|
|
88
87
|
};
|
|
89
|
-
|
|
88
|
+
ContextInstance.prototype.getAssociations = function getAssociations(scopeId) {
|
|
90
89
|
return (this.definitionContext.getAssociations(scopeId) || []).map(association => this.upsertAssociation(association));
|
|
91
90
|
};
|
|
92
|
-
|
|
91
|
+
ContextInstance.prototype.upsertAssociation = function upsertAssociation(associationDefinition) {
|
|
93
92
|
const refs = this.refs.associationRefs;
|
|
94
93
|
let instance = refs[associationDefinition.id];
|
|
95
94
|
if (instance) return instance;
|
|
96
95
|
instance = refs[associationDefinition.id] = new associationDefinition.Behaviour(associationDefinition, this);
|
|
97
96
|
return instance;
|
|
98
97
|
};
|
|
99
|
-
|
|
98
|
+
ContextInstance.prototype.clone = function clone(newEnvironment) {
|
|
100
99
|
return new ContextInstance(this.definitionContext, newEnvironment || this.environment);
|
|
101
100
|
};
|
|
102
|
-
|
|
101
|
+
ContextInstance.prototype.getProcessById = function getProcessById(processId) {
|
|
103
102
|
const refs = this.refs.processRefs;
|
|
104
103
|
let bp = this.refs.processRefs[processId];
|
|
105
104
|
if (bp) return bp;
|
|
@@ -110,30 +109,30 @@ proto.getProcessById = function getProcessById(processId) {
|
|
|
110
109
|
this.refs.processes.push(bp);
|
|
111
110
|
return bp;
|
|
112
111
|
};
|
|
113
|
-
|
|
112
|
+
ContextInstance.prototype.getNewProcessById = function getNewProcessById(processId) {
|
|
114
113
|
if (!this.getProcessById(processId)) return null;
|
|
115
114
|
const bpDef = this.definitionContext.getProcessById(processId);
|
|
116
115
|
const bp = new bpDef.Behaviour(bpDef, this.clone(this.environment.clone()));
|
|
117
116
|
return bp;
|
|
118
117
|
};
|
|
119
|
-
|
|
118
|
+
ContextInstance.prototype.getProcesses = function getProcesses() {
|
|
120
119
|
return this.definitionContext.getProcesses().map(({
|
|
121
120
|
id: processId
|
|
122
121
|
}) => this.getProcessById(processId));
|
|
123
122
|
};
|
|
124
|
-
|
|
123
|
+
ContextInstance.prototype.getExecutableProcesses = function getExecutableProcesses() {
|
|
125
124
|
return this.definitionContext.getExecutableProcesses().map(({
|
|
126
125
|
id: processId
|
|
127
126
|
}) => this.getProcessById(processId));
|
|
128
127
|
};
|
|
129
|
-
|
|
128
|
+
ContextInstance.prototype.getMessageFlows = function getMessageFlows(sourceId) {
|
|
130
129
|
if (!this.refs.messageFlows.length) {
|
|
131
130
|
const flows = this.definitionContext.getMessageFlows() || [];
|
|
132
131
|
this.refs.messageFlows.push(...flows.map(flow => new flow.Behaviour(flow, this)));
|
|
133
132
|
}
|
|
134
133
|
return this.refs.messageFlows.filter(flow => flow.source.processId === sourceId);
|
|
135
134
|
};
|
|
136
|
-
|
|
135
|
+
ContextInstance.prototype.getDataObjectById = function getDataObjectById(referenceId) {
|
|
137
136
|
let dataObject;
|
|
138
137
|
if (dataObject = this.refs.dataObjectRefs[referenceId]) return dataObject;
|
|
139
138
|
const dataObjectDef = this.definitionContext.getDataObjectById(referenceId);
|
|
@@ -141,7 +140,7 @@ proto.getDataObjectById = function getDataObjectById(referenceId) {
|
|
|
141
140
|
dataObject = this.refs.dataObjectRefs[dataObjectDef.id] = new dataObjectDef.Behaviour(dataObjectDef, this);
|
|
142
141
|
return dataObject;
|
|
143
142
|
};
|
|
144
|
-
|
|
143
|
+
ContextInstance.prototype.getDataStoreById = function getDataStoreById(referenceId) {
|
|
145
144
|
let dataStore;
|
|
146
145
|
if (dataStore = this.refs.dataStoreRefs[referenceId]) return dataStore;
|
|
147
146
|
const dataStoreDef = this.definitionContext.getDataStoreById(referenceId) || this.definitionContext.getDataStoreReferenceById(referenceId);
|
|
@@ -149,7 +148,7 @@ proto.getDataStoreById = function getDataStoreById(referenceId) {
|
|
|
149
148
|
dataStore = this.refs.dataStoreRefs[dataStoreDef.id] = new dataStoreDef.Behaviour(dataStoreDef, this);
|
|
150
149
|
return dataStore;
|
|
151
150
|
};
|
|
152
|
-
|
|
151
|
+
ContextInstance.prototype.getStartActivities = function getStartActivities(filterOptions, scopeId) {
|
|
153
152
|
const {
|
|
154
153
|
referenceId,
|
|
155
154
|
referenceType = 'unknown'
|
|
@@ -170,7 +169,7 @@ proto.getStartActivities = function getStartActivities(filterOptions, scopeId) {
|
|
|
170
169
|
}
|
|
171
170
|
return result;
|
|
172
171
|
};
|
|
173
|
-
|
|
172
|
+
ContextInstance.prototype.loadExtensions = function loadExtensions(activity) {
|
|
174
173
|
const io = new _BpmnIO.default(activity, this);
|
|
175
174
|
const extensions = this.extensionsMapper.get(activity);
|
|
176
175
|
if (io.hasIo) extensions.extensions.push(io);
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = Environment;
|
|
7
|
-
var _Expressions = _interopRequireDefault(require("./Expressions"));
|
|
8
|
-
var _Scripts = require("./Scripts");
|
|
9
|
-
var _Timers = require("./Timers");
|
|
7
|
+
var _Expressions = _interopRequireDefault(require("./Expressions.js"));
|
|
8
|
+
var _Scripts = require("./Scripts.js");
|
|
9
|
+
var _Timers = require("./Timers.js");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
const kServices = Symbol.for('services');
|
|
12
12
|
const kVariables = Symbol.for('variables');
|
|
@@ -25,14 +25,13 @@ function Environment(options = {}) {
|
|
|
25
25
|
this[kServices] = options.services || {};
|
|
26
26
|
this[kVariables] = options.variables || {};
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
Object.defineProperty(proto, 'variables', {
|
|
28
|
+
Object.defineProperty(Environment.prototype, 'variables', {
|
|
30
29
|
enumerable: true,
|
|
31
30
|
get() {
|
|
32
31
|
return this[kVariables];
|
|
33
32
|
}
|
|
34
33
|
});
|
|
35
|
-
Object.defineProperty(
|
|
34
|
+
Object.defineProperty(Environment.prototype, 'services', {
|
|
36
35
|
enumerable: true,
|
|
37
36
|
get() {
|
|
38
37
|
return this[kServices];
|
|
@@ -45,7 +44,7 @@ Object.defineProperty(proto, 'services', {
|
|
|
45
44
|
Object.assign(services, value);
|
|
46
45
|
}
|
|
47
46
|
});
|
|
48
|
-
|
|
47
|
+
Environment.prototype.getState = function getState() {
|
|
49
48
|
return {
|
|
50
49
|
settings: {
|
|
51
50
|
...this.settings
|
|
@@ -58,14 +57,14 @@ proto.getState = function getState() {
|
|
|
58
57
|
}
|
|
59
58
|
};
|
|
60
59
|
};
|
|
61
|
-
|
|
60
|
+
Environment.prototype.recover = function recover(state) {
|
|
62
61
|
if (!state) return this;
|
|
63
62
|
if (state.settings) Object.assign(this.settings, state.settings);
|
|
64
63
|
if (state.variables) Object.assign(this[kVariables], state.variables);
|
|
65
64
|
if (state.output) Object.assign(this.output, state.output);
|
|
66
65
|
return this;
|
|
67
66
|
};
|
|
68
|
-
|
|
67
|
+
Environment.prototype.clone = function clone(overrideOptions = {}) {
|
|
69
68
|
const services = this[kServices];
|
|
70
69
|
const newOptions = {
|
|
71
70
|
settings: {
|
|
@@ -89,37 +88,37 @@ proto.clone = function clone(overrideOptions = {}) {
|
|
|
89
88
|
};
|
|
90
89
|
return new this.constructor(newOptions);
|
|
91
90
|
};
|
|
92
|
-
|
|
91
|
+
Environment.prototype.assignVariables = function assignVariables(newVars) {
|
|
93
92
|
if (!newVars || typeof newVars !== 'object') return;
|
|
94
93
|
this[kVariables] = {
|
|
95
94
|
...this.variables,
|
|
96
95
|
...newVars
|
|
97
96
|
};
|
|
98
97
|
};
|
|
99
|
-
|
|
98
|
+
Environment.prototype.assignSettings = function assignVariables(newSettings) {
|
|
100
99
|
if (!newSettings || typeof newSettings !== 'object') return;
|
|
101
100
|
this.settings = {
|
|
102
101
|
...this.settings,
|
|
103
102
|
...newSettings
|
|
104
103
|
};
|
|
105
104
|
};
|
|
106
|
-
|
|
105
|
+
Environment.prototype.getScript = function getScript(...args) {
|
|
107
106
|
return this.scripts.getScript(...args);
|
|
108
107
|
};
|
|
109
|
-
|
|
108
|
+
Environment.prototype.registerScript = function registerScript(...args) {
|
|
110
109
|
return this.scripts.register(...args);
|
|
111
110
|
};
|
|
112
|
-
|
|
111
|
+
Environment.prototype.getServiceByName = function getServiceByName(serviceName) {
|
|
113
112
|
return this[kServices][serviceName];
|
|
114
113
|
};
|
|
115
|
-
|
|
114
|
+
Environment.prototype.resolveExpression = function resolveExpression(expression, message = {}, expressionFnContext) {
|
|
116
115
|
const from = {
|
|
117
116
|
environment: this,
|
|
118
117
|
...message
|
|
119
118
|
};
|
|
120
119
|
return this.expressions.resolveExpression(expression, from, expressionFnContext);
|
|
121
120
|
};
|
|
122
|
-
|
|
121
|
+
Environment.prototype.addService = function addService(name, fn) {
|
|
123
122
|
this[kServices][name] = fn;
|
|
124
123
|
};
|
|
125
124
|
function validateOptions(input) {
|
|
@@ -9,7 +9,7 @@ exports.EventBroker = EventBroker;
|
|
|
9
9
|
exports.MessageFlowBroker = MessageFlowBroker;
|
|
10
10
|
exports.ProcessBroker = ProcessBroker;
|
|
11
11
|
var _smqp = require("smqp");
|
|
12
|
-
var _Errors = require("./error/Errors");
|
|
12
|
+
var _Errors = require("./error/Errors.js");
|
|
13
13
|
function ActivityBroker(activity) {
|
|
14
14
|
const executionBroker = ExecutionBroker(activity, 'activity');
|
|
15
15
|
return executionBroker;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = Expressions;
|
|
7
|
-
var _getPropertyValue = _interopRequireDefault(require("./getPropertyValue"));
|
|
7
|
+
var _getPropertyValue = _interopRequireDefault(require("./getPropertyValue.js"));
|
|
8
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
9
|
const isExpressionPattern = /^\${(.+?)}$/;
|
|
10
10
|
const expressionPattern = /\${(.+?)}/;
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Formatter = Formatter;
|
|
7
|
-
var _messageHelper = require("./messageHelper");
|
|
8
|
-
var _shared = require("./shared");
|
|
9
|
-
var _Errors = require("./error/Errors");
|
|
7
|
+
var _messageHelper = require("./messageHelper.js");
|
|
8
|
+
var _shared = require("./shared.js");
|
|
9
|
+
var _Errors = require("./error/Errors.js");
|
|
10
10
|
var _smqp = require("smqp");
|
|
11
11
|
const kOnMessage = Symbol.for('onMessage');
|
|
12
12
|
const kExecution = Symbol.for('execution');
|