From 60ca796243af06f7485ebfa0336f95b063de1a01 Mon Sep 17 00:00:00 2001 From: Maciej Barelkowski Date: Thu, 1 Dec 2022 14:37:05 +0100 Subject: [PATCH] feat: support `zeebe:script` Related to https://github.com/camunda/camunda-modeler/issues/3321 --- CHANGELOG.md | 4 +++ resources/zeebe.json | 23 +++++++++++++ .../xml/scriptTask-zeebe-script.part.bpmn | 9 ++++++ test/spec/xml/read.js | 32 +++++++++++++++++++ test/spec/xml/write.js | 20 ++++++++++++ 5 files changed, 88 insertions(+) create mode 100644 test/fixtures/xml/scriptTask-zeebe-script.part.bpmn diff --git a/CHANGELOG.md b/CHANGELOG.md index f8bbdd6..fd5561d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ All notable changes to [zeebe-bpmn-moddle](https://github.com/camunda/zeebe-bpmn ___Note:__ Yet to be released changes appear here._ +## 0.17.0 + +`FEAT`: support `zeebe:script` ([#39](https://github.com/camunda/zeebe-bpmn-moddle/pull/39)) + ## 0.16.0 `FEAT`: support `zeebe:candidateUsers` ([#38](https://github.com/camunda/zeebe-bpmn-moddle/pull/38)) diff --git a/resources/zeebe.json b/resources/zeebe.json index 5cd049f..8b3538e 100644 --- a/resources/zeebe.json +++ b/resources/zeebe.json @@ -405,6 +405,29 @@ "type": "String" } ] + }, + { + "name": "Script", + "superClass": [ + "Element" + ], + "meta": { + "allowedIn": [ + "bpmn:ScriptTask" + ] + }, + "properties": [ + { + "name": "expression", + "type": "String", + "isAttr": true + }, + { + "name": "resultVariable", + "type": "String", + "isAttr": true + } + ] } ] } diff --git a/test/fixtures/xml/scriptTask-zeebe-script.part.bpmn b/test/fixtures/xml/scriptTask-zeebe-script.part.bpmn new file mode 100644 index 0000000..f882033 --- /dev/null +++ b/test/fixtures/xml/scriptTask-zeebe-script.part.bpmn @@ -0,0 +1,9 @@ + + + + + diff --git a/test/spec/xml/read.js b/test/spec/xml/read.js index 50ec875..0189d3e 100644 --- a/test/spec/xml/read.js +++ b/test/spec/xml/read.js @@ -632,6 +632,38 @@ describe('read', function() { }); + + describe('zeebe:script', function() { + + it('on ScriptTask', async function() { + + // given + var xml = readFile('test/fixtures/xml/scriptTask-zeebe-script.part.bpmn'); + + // when + const { + rootElement: task + } = await moddle.fromXML(xml, 'bpmn:ScriptTask'); + + // then + expect(task).to.jsonEqual({ + $type: 'bpmn:ScriptTask', + id: 'script-task-1', + extensionElements: { + $type: 'bpmn:ExtensionElements', + values: [ + { + $type: 'zeebe:Script', + expression: '=today()', + resultVariable: 'result' + } + ] + } + }); + }); + + }); + }); }); diff --git a/test/spec/xml/write.js b/test/spec/xml/write.js index 0258f24..e1aefbe 100644 --- a/test/spec/xml/write.js +++ b/test/spec/xml/write.js @@ -285,6 +285,26 @@ describe('write', function() { expect(xml).to.eql(expectedXML); }); + + it('zeebe:script', async function() { + + // given + const moddleElement = moddle.create('zeebe:Script', { + expression: '=today()', + resultVariable: 'result' + }); + + const expectedXML = ''; + + // when + const xml = await write(moddleElement); + + // then + expect(xml).to.eql(expectedXML); + }); + }); });