bpmn-engine 23.0.1 → 23.0.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/lib/index.cjs +18 -20
- package/package.json +7 -5
- package/src/extensions/ProcessOutputDataObject.js +5 -5
- package/src/index.js +12 -14
package/lib/index.cjs
CHANGED
|
@@ -145,7 +145,7 @@ Object.defineProperties(ProcessOutputDataObject.prototype, {
|
|
|
145
145
|
ProcessOutputDataObject.prototype.read = function readDataObject(broker, exchange, routingKeyPrefix, messageProperties) {
|
|
146
146
|
const environment = this.environment;
|
|
147
147
|
const { id, name, type } = this;
|
|
148
|
-
const value = environment.variables.data
|
|
148
|
+
const value = environment.variables.data?.[this.id];
|
|
149
149
|
return broker.publish(exchange, `${routingKeyPrefix}response`, { id, name, type, value }, messageProperties);
|
|
150
150
|
};
|
|
151
151
|
|
|
@@ -153,15 +153,15 @@ ProcessOutputDataObject.prototype.write = function writeDataObject(broker, excha
|
|
|
153
153
|
const environment = this.environment;
|
|
154
154
|
const { id, name, type } = this;
|
|
155
155
|
|
|
156
|
-
environment.variables.data = environment.variables.data || {};
|
|
157
|
-
|
|
156
|
+
const data = (environment.variables.data = environment.variables.data || {});
|
|
157
|
+
data[id] = value;
|
|
158
158
|
|
|
159
|
-
environment.output.data = environment.output.data || {};
|
|
160
|
-
|
|
159
|
+
const outputData = (environment.output.data = environment.output.data || {});
|
|
160
|
+
outputData[id] = value;
|
|
161
161
|
return broker.publish(exchange, `${routingKeyPrefix}response`, { id, name, type, value }, messageProperties);
|
|
162
162
|
};
|
|
163
163
|
|
|
164
|
-
const nodeRequire = node_module.createRequire(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
|
|
164
|
+
const nodeRequire = node_module.createRequire(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
|
|
165
165
|
const { version: engineVersion } = nodeRequire('../package.json');
|
|
166
166
|
|
|
167
167
|
const kEngine = Symbol.for('engine');
|
|
@@ -175,14 +175,14 @@ const kState = Symbol.for('state');
|
|
|
175
175
|
const kStopped = Symbol.for('stopped');
|
|
176
176
|
const kTypeResolver = Symbol.for('type resolver');
|
|
177
177
|
|
|
178
|
-
function Engine(options
|
|
178
|
+
function Engine(options) {
|
|
179
179
|
if (!(this instanceof Engine)) return new Engine(options);
|
|
180
180
|
|
|
181
181
|
node_events.EventEmitter.call(this);
|
|
182
182
|
|
|
183
183
|
const opts = (this.options = {
|
|
184
184
|
Logger: Logger,
|
|
185
|
-
scripts: new Scripts(options
|
|
185
|
+
scripts: new Scripts(options?.disableDummyScript),
|
|
186
186
|
...options,
|
|
187
187
|
});
|
|
188
188
|
|
|
@@ -334,11 +334,11 @@ Engine.prototype.resume = async function resume(...args) {
|
|
|
334
334
|
return execution._resume(resumeOptions, callback);
|
|
335
335
|
};
|
|
336
336
|
|
|
337
|
-
Engine.prototype.addSource = function addSource(
|
|
338
|
-
if (!
|
|
337
|
+
Engine.prototype.addSource = function addSource(options) {
|
|
338
|
+
if (!options?.sourceContext) return;
|
|
339
339
|
const loadedDefinitions = this[kLoadedDefinitions];
|
|
340
340
|
if (loadedDefinitions) loadedDefinitions.splice(0);
|
|
341
|
-
this[kPendingSources].add(
|
|
341
|
+
this[kPendingSources].add(options.sourceContext);
|
|
342
342
|
};
|
|
343
343
|
|
|
344
344
|
Engine.prototype.getDefinitions = function getDefinitions(executeOptions) {
|
|
@@ -382,9 +382,7 @@ Engine.prototype._loadDefinitions = async function loadDefinitions(executeOption
|
|
|
382
382
|
return loadedDefinitions;
|
|
383
383
|
};
|
|
384
384
|
|
|
385
|
-
Engine.prototype._loadDefinition = function loadDefinition(serializedContext, executeOptions
|
|
386
|
-
const { settings, variables } = executeOptions;
|
|
387
|
-
|
|
385
|
+
Engine.prototype._loadDefinition = function loadDefinition(serializedContext, executeOptions) {
|
|
388
386
|
const environment = this.environment;
|
|
389
387
|
const context = new Elements__namespace.Context(
|
|
390
388
|
serializedContext,
|
|
@@ -393,11 +391,11 @@ Engine.prototype._loadDefinition = function loadDefinition(serializedContext, ex
|
|
|
393
391
|
...executeOptions,
|
|
394
392
|
settings: {
|
|
395
393
|
...environment.settings,
|
|
396
|
-
...settings,
|
|
394
|
+
...executeOptions?.settings,
|
|
397
395
|
},
|
|
398
396
|
variables: {
|
|
399
397
|
...environment.variables,
|
|
400
|
-
...variables,
|
|
398
|
+
...executeOptions?.variables,
|
|
401
399
|
},
|
|
402
400
|
source: serializedContext,
|
|
403
401
|
})
|
|
@@ -570,8 +568,8 @@ Execution.prototype.stop = async function stop() {
|
|
|
570
568
|
return result;
|
|
571
569
|
};
|
|
572
570
|
|
|
573
|
-
Execution.prototype._setup = function setup(setupOptions
|
|
574
|
-
const listener = setupOptions
|
|
571
|
+
Execution.prototype._setup = function setup(setupOptions) {
|
|
572
|
+
const listener = setupOptions?.listener || this.options.listener;
|
|
575
573
|
if (listener && typeof listener.emit !== 'function') throw new Error('listener.emit is not a function');
|
|
576
574
|
|
|
577
575
|
const onChildMessage = this._onChildMessage.bind(this);
|
|
@@ -717,9 +715,9 @@ Execution.prototype.getPostponed = function getPostponed() {
|
|
|
717
715
|
return result;
|
|
718
716
|
};
|
|
719
717
|
|
|
720
|
-
Execution.prototype.signal = function signal(payload,
|
|
718
|
+
Execution.prototype.signal = function signal(payload, signalOptions) {
|
|
721
719
|
for (const definition of this[kExecuting]) {
|
|
722
|
-
if (ignoreSameDefinition && payload?.parent?.id === definition.id) continue;
|
|
720
|
+
if (signalOptions?.ignoreSameDefinition && payload?.parent?.id === definition.id) continue;
|
|
723
721
|
definition.signal(payload);
|
|
724
722
|
}
|
|
725
723
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpmn-engine",
|
|
3
3
|
"description": "BPMN 2.0 execution engine. Open source javascript workflow engine.",
|
|
4
|
-
"version": "23.0.
|
|
4
|
+
"version": "23.0.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./src/index.js",
|
|
7
7
|
"main": "./lib/index.cjs",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
],
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@bonniernews/hot-bev": "^0.4.0",
|
|
55
|
-
"@rollup/plugin-commonjs": "^
|
|
55
|
+
"@rollup/plugin-commonjs": "^28.0.0",
|
|
56
56
|
"@types/bpmn-moddle": "^5.1.6",
|
|
57
57
|
"@types/node": "^18.19.31",
|
|
58
58
|
"bent": "^7.3.12",
|
|
@@ -69,10 +69,12 @@
|
|
|
69
69
|
"texample": "^0.0.6"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"bpmn-elements": "^16.1
|
|
72
|
+
"bpmn-elements": "^16.2.1",
|
|
73
73
|
"bpmn-moddle": "^9.0.1",
|
|
74
74
|
"debug": "^4.3.7",
|
|
75
|
-
"moddle-context-serializer": "^4.2.1"
|
|
76
|
-
|
|
75
|
+
"moddle-context-serializer": "^4.2.1"
|
|
76
|
+
},
|
|
77
|
+
"peerDependencies": {
|
|
78
|
+
"smqp": ">=9"
|
|
77
79
|
}
|
|
78
80
|
}
|
|
@@ -24,7 +24,7 @@ Object.defineProperties(ProcessOutputDataObject.prototype, {
|
|
|
24
24
|
ProcessOutputDataObject.prototype.read = function readDataObject(broker, exchange, routingKeyPrefix, messageProperties) {
|
|
25
25
|
const environment = this.environment;
|
|
26
26
|
const { id, name, type } = this;
|
|
27
|
-
const value = environment.variables.data
|
|
27
|
+
const value = environment.variables.data?.[this.id];
|
|
28
28
|
return broker.publish(exchange, `${routingKeyPrefix}response`, { id, name, type, value }, messageProperties);
|
|
29
29
|
};
|
|
30
30
|
|
|
@@ -32,10 +32,10 @@ ProcessOutputDataObject.prototype.write = function writeDataObject(broker, excha
|
|
|
32
32
|
const environment = this.environment;
|
|
33
33
|
const { id, name, type } = this;
|
|
34
34
|
|
|
35
|
-
environment.variables.data = environment.variables.data || {};
|
|
36
|
-
|
|
35
|
+
const data = (environment.variables.data = environment.variables.data || {});
|
|
36
|
+
data[id] = value;
|
|
37
37
|
|
|
38
|
-
environment.output.data = environment.output.data || {};
|
|
39
|
-
|
|
38
|
+
const outputData = (environment.output.data = environment.output.data || {});
|
|
39
|
+
outputData[id] = value;
|
|
40
40
|
return broker.publish(exchange, `${routingKeyPrefix}response`, { id, name, type, value }, messageProperties);
|
|
41
41
|
};
|
package/src/index.js
CHANGED
|
@@ -29,14 +29,14 @@ const kTypeResolver = Symbol.for('type resolver');
|
|
|
29
29
|
export default Engine;
|
|
30
30
|
export { JavaScripts };
|
|
31
31
|
|
|
32
|
-
export function Engine(options
|
|
32
|
+
export function Engine(options) {
|
|
33
33
|
if (!(this instanceof Engine)) return new Engine(options);
|
|
34
34
|
|
|
35
35
|
EventEmitter.call(this);
|
|
36
36
|
|
|
37
37
|
const opts = (this.options = {
|
|
38
38
|
Logger: DebugLogger,
|
|
39
|
-
scripts: new JavaScripts(options
|
|
39
|
+
scripts: new JavaScripts(options?.disableDummyScript),
|
|
40
40
|
...options,
|
|
41
41
|
});
|
|
42
42
|
|
|
@@ -188,11 +188,11 @@ Engine.prototype.resume = async function resume(...args) {
|
|
|
188
188
|
return execution._resume(resumeOptions, callback);
|
|
189
189
|
};
|
|
190
190
|
|
|
191
|
-
Engine.prototype.addSource = function addSource(
|
|
192
|
-
if (!
|
|
191
|
+
Engine.prototype.addSource = function addSource(options) {
|
|
192
|
+
if (!options?.sourceContext) return;
|
|
193
193
|
const loadedDefinitions = this[kLoadedDefinitions];
|
|
194
194
|
if (loadedDefinitions) loadedDefinitions.splice(0);
|
|
195
|
-
this[kPendingSources].add(
|
|
195
|
+
this[kPendingSources].add(options.sourceContext);
|
|
196
196
|
};
|
|
197
197
|
|
|
198
198
|
Engine.prototype.getDefinitions = function getDefinitions(executeOptions) {
|
|
@@ -236,9 +236,7 @@ Engine.prototype._loadDefinitions = async function loadDefinitions(executeOption
|
|
|
236
236
|
return loadedDefinitions;
|
|
237
237
|
};
|
|
238
238
|
|
|
239
|
-
Engine.prototype._loadDefinition = function loadDefinition(serializedContext, executeOptions
|
|
240
|
-
const { settings, variables } = executeOptions;
|
|
241
|
-
|
|
239
|
+
Engine.prototype._loadDefinition = function loadDefinition(serializedContext, executeOptions) {
|
|
242
240
|
const environment = this.environment;
|
|
243
241
|
const context = new Elements.Context(
|
|
244
242
|
serializedContext,
|
|
@@ -247,11 +245,11 @@ Engine.prototype._loadDefinition = function loadDefinition(serializedContext, ex
|
|
|
247
245
|
...executeOptions,
|
|
248
246
|
settings: {
|
|
249
247
|
...environment.settings,
|
|
250
|
-
...settings,
|
|
248
|
+
...executeOptions?.settings,
|
|
251
249
|
},
|
|
252
250
|
variables: {
|
|
253
251
|
...environment.variables,
|
|
254
|
-
...variables,
|
|
252
|
+
...executeOptions?.variables,
|
|
255
253
|
},
|
|
256
254
|
source: serializedContext,
|
|
257
255
|
})
|
|
@@ -424,8 +422,8 @@ Execution.prototype.stop = async function stop() {
|
|
|
424
422
|
return result;
|
|
425
423
|
};
|
|
426
424
|
|
|
427
|
-
Execution.prototype._setup = function setup(setupOptions
|
|
428
|
-
const listener = setupOptions
|
|
425
|
+
Execution.prototype._setup = function setup(setupOptions) {
|
|
426
|
+
const listener = setupOptions?.listener || this.options.listener;
|
|
429
427
|
if (listener && typeof listener.emit !== 'function') throw new Error('listener.emit is not a function');
|
|
430
428
|
|
|
431
429
|
const onChildMessage = this._onChildMessage.bind(this);
|
|
@@ -571,9 +569,9 @@ Execution.prototype.getPostponed = function getPostponed() {
|
|
|
571
569
|
return result;
|
|
572
570
|
};
|
|
573
571
|
|
|
574
|
-
Execution.prototype.signal = function signal(payload,
|
|
572
|
+
Execution.prototype.signal = function signal(payload, signalOptions) {
|
|
575
573
|
for (const definition of this[kExecuting]) {
|
|
576
|
-
if (ignoreSameDefinition && payload?.parent?.id === definition.id) continue;
|
|
574
|
+
if (signalOptions?.ignoreSameDefinition && payload?.parent?.id === definition.id) continue;
|
|
577
575
|
definition.signal(payload);
|
|
578
576
|
}
|
|
579
577
|
};
|