Skip to content

Commit

Permalink
patch smqp
Browse files Browse the repository at this point in the history
  • Loading branch information
paed01 committed Apr 19, 2024
1 parent 3f3ee4c commit 32de2bd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

# 20.0.2

- patch away package prettier from smqp

# 20.0.1

- hoist current definition environment output to engine environment output if run fails
Expand Down
36 changes: 20 additions & 16 deletions lib/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -613,30 +613,19 @@ Execution.prototype._onChildMessage = function onChildMessage(routingKey, messag

newState = 'idle';
break;
case 'definition.error':
case 'definition.error': {
this._saveOutput(owner.environment.output);
this._teardownDefinition(owner);
newState = 'error';
break;
}
case 'activity.wait': {
if (listener) listener.emit('wait', owner.getApi(message), this);
break;
}
case 'process.end': {
if (!message.content.output) break;
const environment = this.environment;

for (const key in message.content.output) {
switch (key) {
case 'data': {
environment.output.data = environment.output.data || {};
environment.output.data = { ...environment.output.data, ...message.content.output.data };
break;
}
default: {
environment.output[key] = message.content.output[key];
}
}
}
if (message.content.inbound) break;
this._saveOutput(message.content.output);
break;
}
}
Expand Down Expand Up @@ -678,6 +667,21 @@ Execution.prototype._teardownDefinition = function teardownDefinition(definition
definition.broker.cancel('_engine_definition');
};

Execution.prototype._saveOutput = function saveOutput(output) {
if (!output || typeof output !== 'object') return;

const environmentOutput = this.environment.output;

for (const key in output) {
if (key === 'data') {
const data = (environmentOutput.data = environmentOutput.data || {});
environmentOutput.data = { ...data, ...output.data };
} else {
environmentOutput[key] = output[key];
}
}
};

Execution.prototype.getState = function getState() {
const definitions = [];
for (const definition of this.definitions) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bpmn-engine",
"description": "BPMN 2.0 execution engine. Open source javascript workflow engine.",
"version": "20.0.1",
"version": "20.0.2",
"type": "module",
"module": "./src/index.js",
"main": "./lib/index.cjs",
Expand Down Expand Up @@ -73,6 +73,6 @@
"bpmn-moddle": "^9.0.1",
"debug": "^4.3.4",
"moddle-context-serializer": "^4.2.0",
"smqp": "^8.2.3"
"smqp": "^8.2.4"
}
}

0 comments on commit 32de2bd

Please sign in to comment.