From 0151d472e59554f6b180bf2a74e6ceec238a9ab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A5l=20Edman?= Date: Sat, 4 May 2024 10:34:42 +0200 Subject: [PATCH] ship with bpmn-elements@14 --- CHANGELOG.md | 8 ++++ docs/API.md | 2 +- package.json | 8 ++-- test/feature/timers-feature.js | 73 +++++++++++++++++++++++++++++++++- 4 files changed, 84 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a28dfb8..492789c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/docs/API.md b/docs/API.md index b1ffc5f..bc63f6d 100644 --- a/docs/API.md +++ b/docs/API.md @@ -1,6 +1,6 @@ -# 20.0.1 API Reference +# 21.0.0 API Reference diff --git a/package.json b/package.json index e25d0ce..02ae051 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", @@ -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" } } diff --git a/test/feature/timers-feature.js b/test/feature/timers-feature.js index 232afd5..20c7654 100644 --- a/test/feature/timers-feature.js +++ b/test/feature/timers-feature.js @@ -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'); }); @@ -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'); }); }); @@ -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 = ` + + + + + + 2023-01-32 + + + + + `; + + 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 }); + expect(err).to.match(/Invalid ISO 8601 date/i); + }); + + Given('a source with a start event timer with invalid cycle', () => { + source = ` + + + + + R-3/2023-01-32 + + + + + `; + + 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 }); + expect(err).to.match(/Unexpected/i); + }); + }); });