bpmn-engine 24.0.0 → 25.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/lib/index.cjs +12 -1
- package/package.json +3 -3
- package/src/index.js +12 -1
package/lib/index.cjs
CHANGED
|
@@ -280,6 +280,10 @@ Engine.prototype.stop = function stop() {
|
|
|
280
280
|
};
|
|
281
281
|
|
|
282
282
|
Engine.prototype.recover = function recover(savedState, recoverOptions) {
|
|
283
|
+
if (this[kExecution]?.isRunning) {
|
|
284
|
+
throw new Error('cannot recover a running engine');
|
|
285
|
+
}
|
|
286
|
+
|
|
283
287
|
if (!savedState) return this;
|
|
284
288
|
|
|
285
289
|
let name = this.name;
|
|
@@ -287,7 +291,10 @@ Engine.prototype.recover = function recover(savedState, recoverOptions) {
|
|
|
287
291
|
|
|
288
292
|
this.logger.debug(`<${name}> recover`);
|
|
289
293
|
|
|
290
|
-
if (recoverOptions)
|
|
294
|
+
if (recoverOptions) {
|
|
295
|
+
this[kEnvironment] = this[kEnvironment].clone(recoverOptions);
|
|
296
|
+
}
|
|
297
|
+
|
|
291
298
|
if (savedState.environment) this[kEnvironment] = this[kEnvironment].recover(savedState.environment);
|
|
292
299
|
|
|
293
300
|
if (!savedState.definitions) return this;
|
|
@@ -329,6 +336,10 @@ Engine.prototype.resume = async function resume(...args) {
|
|
|
329
336
|
throw err;
|
|
330
337
|
}
|
|
331
338
|
execution = this[kExecution] = new Execution(this, definitions, this.options);
|
|
339
|
+
} else if (execution.isRunning) {
|
|
340
|
+
const err = new Error('cannot resume a running engine');
|
|
341
|
+
if (callback) return callback(err);
|
|
342
|
+
throw err;
|
|
332
343
|
}
|
|
333
344
|
|
|
334
345
|
return execution._resume(resumeOptions, callback);
|
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": "
|
|
4
|
+
"version": "25.0.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./src/index.js",
|
|
7
7
|
"main": "./lib/index.cjs",
|
|
@@ -66,13 +66,13 @@
|
|
|
66
66
|
"mocha-cakes-2": "^3.3.0",
|
|
67
67
|
"prettier": "^3.2.5",
|
|
68
68
|
"rollup": "^4.10.0",
|
|
69
|
-
"texample": "^0.0.
|
|
69
|
+
"texample": "^0.0.7"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"bpmn-elements": "^17.0.0",
|
|
73
73
|
"bpmn-moddle": "^9.0.1",
|
|
74
74
|
"debug": "^4.3.7",
|
|
75
|
-
"moddle-context-serializer": "^4.
|
|
75
|
+
"moddle-context-serializer": "^4.3.0"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"smqp": ">=9"
|
package/src/index.js
CHANGED
|
@@ -134,6 +134,10 @@ Engine.prototype.stop = function stop() {
|
|
|
134
134
|
};
|
|
135
135
|
|
|
136
136
|
Engine.prototype.recover = function recover(savedState, recoverOptions) {
|
|
137
|
+
if (this[kExecution]?.isRunning) {
|
|
138
|
+
throw new Error('cannot recover a running engine');
|
|
139
|
+
}
|
|
140
|
+
|
|
137
141
|
if (!savedState) return this;
|
|
138
142
|
|
|
139
143
|
let name = this.name;
|
|
@@ -141,7 +145,10 @@ Engine.prototype.recover = function recover(savedState, recoverOptions) {
|
|
|
141
145
|
|
|
142
146
|
this.logger.debug(`<${name}> recover`);
|
|
143
147
|
|
|
144
|
-
if (recoverOptions)
|
|
148
|
+
if (recoverOptions) {
|
|
149
|
+
this[kEnvironment] = this[kEnvironment].clone(recoverOptions);
|
|
150
|
+
}
|
|
151
|
+
|
|
145
152
|
if (savedState.environment) this[kEnvironment] = this[kEnvironment].recover(savedState.environment);
|
|
146
153
|
|
|
147
154
|
if (!savedState.definitions) return this;
|
|
@@ -183,6 +190,10 @@ Engine.prototype.resume = async function resume(...args) {
|
|
|
183
190
|
throw err;
|
|
184
191
|
}
|
|
185
192
|
execution = this[kExecution] = new Execution(this, definitions, this.options);
|
|
193
|
+
} else if (execution.isRunning) {
|
|
194
|
+
const err = new Error('cannot resume a running engine');
|
|
195
|
+
if (callback) return callback(err);
|
|
196
|
+
throw err;
|
|
186
197
|
}
|
|
187
198
|
|
|
188
199
|
return execution._resume(resumeOptions, callback);
|