Skip to content

Commit

Permalink
ship with bpmn-elements@14
Browse files Browse the repository at this point in the history
  • Loading branch information
paed01 committed May 4, 2024
1 parent 7304469 commit 0151d47
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

# 21.0.0

Stop execution if invalid time duration, cycle, or date is encountered.

## Breaking

- invalid `TimerEventDefinition` timer type value stops execution according to [`bpmn-elements@14`](https://github.com/paed01/bpmn-elements/blob/master/CHANGELOG.md). Old behaviour can be achieved by using bpmn-elements@13

# 20.0.2

- patch away package prettier from smqp
Expand Down
2 changes: 1 addition & 1 deletion docs/API.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- version -->

# 20.0.1 API Reference
# 21.0.0 API Reference

<!-- versionstop -->

Expand Down
8 changes: 4 additions & 4 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.2",
"version": "21.0.0",
"type": "module",
"module": "./src/index.js",
"main": "./lib/index.cjs",
Expand Down Expand Up @@ -60,7 +60,7 @@
"camunda-bpmn-moddle": "^7.0.1",
"chai": "^5.1.0",
"chronokinesis": "^6.0.0",
"eslint": "^9.0.0",
"eslint": "^9.2.0",
"markdown-toc": "^1.2.0",
"mocha": "^10.2.0",
"mocha-cakes-2": "^3.3.0",
Expand All @@ -69,10 +69,10 @@
"rollup": "^4.10.0"
},
"dependencies": {
"bpmn-elements": "^13.2.0",
"bpmn-elements": "^14.0.1",
"bpmn-moddle": "^9.0.1",
"debug": "^4.3.4",
"moddle-context-serializer": "^4.2.0",
"smqp": "^8.2.4"
"smqp": "^8.2.3"
}
}
73 changes: 71 additions & 2 deletions test/feature/timers-feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ Feature('Timers', () => {

And('time date is executing', () => {
const [timer] = activity.getExecuting();
expect(timer.content).to.have.property('expireAt').to.deep.equal(new Date('1993-06-26'));
expect(timer.content)
.to.have.property('expireAt')
.to.deep.equal(new Date(1993, 5, 26));
expect(timer.content).to.have.property('timeDate').to.equal('1993-06-26');
});

Expand Down Expand Up @@ -234,7 +236,9 @@ Feature('Timers', () => {
});

Then('throw time date has timed out', () => {
expect(timeoutMessage.content).to.have.property('expireAt').to.deep.equal(new Date('1993-06-26'));
expect(timeoutMessage.content)
.to.have.property('expireAt')
.to.deep.equal(new Date(1993, 5, 26));
expect(timeoutMessage.content).to.have.property('timeDate').to.equal('1993-06-26');
});
});
Expand Down Expand Up @@ -351,4 +355,69 @@ Feature('Timers', () => {
expect(engine.environment.timers.executing).to.have.length(0);
});
});

Scenario('engine with invalid timers', () => {
let engine, source;
Given('a source with user task and a bound timer event with invalid date', () => {
source = `<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<process id="bp2" isExecutable="true">
<userTask id="task" />
<boundaryEvent id="bound-timer-2" attachedToRef="task">
<timerEventDefinition>
<timeDate xsi:type="tFormalExpression">2023-01-32</timeDate>
</timerEventDefinition>
</boundaryEvent>
</process>
</definitions>
`;

engine = Engine({
name: 'invalid-timers',
source,
});
});

let fail;
When('source is executed', async () => {
fail = engine.waitFor('error');
await engine.execute();
});

Then('run fails', async () => {
const err = await fail;
console.log({ err });

Check warning on line 389 in test/feature/timers-feature.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected console statement

Check warning on line 389 in test/feature/timers-feature.js

View workflow job for this annotation

GitHub Actions / build (20)

Unexpected console statement

Check warning on line 389 in test/feature/timers-feature.js

View workflow job for this annotation

GitHub Actions / build (latest)

Unexpected console statement
expect(err).to.match(/Invalid ISO 8601 date/i);
});

Given('a source with a start event timer with invalid cycle', () => {
source = `<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<process id="bp2" isExecutable="true">
<startEvent id="bound-timer-2" attachedToRef="task">
<timerEventDefinition>
<timeCycle xsi:type="tFormalExpression">R-3/2023-01-32</timeCycle>
</timerEventDefinition>
</startEvent>
</process>
</definitions>
`;

engine = Engine({
name: 'invalid-timers',
source,
});
});

When('source is executed', async () => {
fail = engine.waitFor('error');
await engine.execute();
});

Then('run fails', async () => {
const err = await fail;
console.log({ err });

Check warning on line 419 in test/feature/timers-feature.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected console statement

Check warning on line 419 in test/feature/timers-feature.js

View workflow job for this annotation

GitHub Actions / build (20)

Unexpected console statement

Check warning on line 419 in test/feature/timers-feature.js

View workflow job for this annotation

GitHub Actions / build (latest)

Unexpected console statement
expect(err).to.match(/Unexpected/i);
});
});
});

0 comments on commit 0151d47

Please sign in to comment.