├── .eslintrc ├── .github ├── merge-me.yml └── workflows │ └── CI.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── package-lock.json ├── package.json ├── resources └── zeebe.json └── test ├── .eslintrc ├── expect.js ├── fixtures └── xml │ ├── adhoc-sub-process-zeebe-adHoc.bpmn │ ├── businessRuleTask-zeebe-calledDecision.part.bpmn │ ├── call-activity-zeebe-calledElement-propagateAllChildVariables.part.bpmn │ ├── call-activity-zeebe-calledElement-propagateAllParentVariables.part.bpmn │ ├── call-activity-zeebe-calledElement.part.bpmn │ ├── calledDecision-bindingType.part.bpmn │ ├── calledDecision-versionTag.part.bpmn │ ├── calledElement-bindingType.part.bpmn │ ├── calledElement-versionTag.part.bpmn │ ├── event-zeebe-executionListener.part.bpmn │ ├── formDefinition-bindingType.part.bpmn │ ├── formDefinition-versionTag.part.bpmn │ ├── gateway-zeebe-executionListener.part.bpmn │ ├── message-zeebe-subscription.part.bpmn │ ├── process-zeebe-userTaskForm.part.bpmn │ ├── rootElement.bpmn │ ├── scriptTask-zeebe-script.part.bpmn │ ├── simple.bpmn │ ├── startEvent-zeebe-properties.part.bpmn │ ├── task-modelerTemplate.part.bpmn │ ├── task-modelerTemplateIcon.part.bpmn │ ├── task-modelerTemplateVersion.part.bpmn │ ├── task-zeebe-executionListener.part.bpmn │ ├── userTask-zeebe-assignmentDefinition.part.bpmn │ ├── userTask-zeebe-formDefinition-externalReference.part.bpmn │ ├── userTask-zeebe-formDefinition-formId.part.bpmn │ ├── userTask-zeebe-formDefinition-formKey.part.bpmn │ ├── userTask-zeebe-formDefinition.bpmn │ ├── userTask-zeebe-priority.part.bpmn │ ├── userTask-zeebe-taskListener.part.bpmn │ ├── userTask-zeebe-taskSchedule.part.bpmn │ ├── userTask-zeebe-userTask.part.bpmn │ ├── zeebe-adHoc.bpmn │ ├── zeebe-bindingType.bpmn │ ├── zeebe-execution-listeners.bpmn │ ├── zeebe-linkedResources.bpmn │ ├── zeebe-properties.bpmn │ ├── zeebe-service-task │ ├── businessRuleTask-zeebe-extensions.part.bpmn │ ├── businessRuleTask-zeebe-ioMapping.part.bpmn │ ├── businessRuleTask-zeebe-loopCharacteristics.part.bpmn │ ├── businessRuleTask-zeebe-retryCounter.part.bpmn │ ├── scriptTask-zeebe-extensions.part.bpmn │ ├── scriptTask-zeebe-ioMapping.part.bpmn │ ├── scriptTask-zeebe-loopCharacteristics.part.bpmn │ ├── scriptTask-zeebe-retryCounter.part.bpmn │ ├── sendTask-zeebe-extensions.part.bpmn │ ├── sendTask-zeebe-ioMapping.part.bpmn │ ├── sendTask-zeebe-loopCharacteristics.part.bpmn │ ├── sendTask-zeebe-retryCounter.part.bpmn │ ├── serviceTask-zeebe-extensions.part.bpmn │ ├── serviceTask-zeebe-ioMapping.part.bpmn │ ├── serviceTask-zeebe-linkedResource.part.bpmn │ ├── serviceTask-zeebe-loopCharacteristics.part.bpmn │ └── serviceTask-zeebe-retryCounter.part.bpmn │ ├── zeebe-taskListeners.bpmn │ ├── zeebe-versionTag.bpmn │ └── zeebe-versionTag.part.bpmn ├── helper.js ├── matchers.js └── spec ├── descriptor.js ├── integration.js └── xml ├── read.js ├── roundtrip.js └── write.js /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "plugin:bpmn-io/es6" 3 | } -------------------------------------------------------------------------------- /.github/merge-me.yml: -------------------------------------------------------------------------------- 1 | reviewTeams: 2 | - modeling-dev 3 | - modeling-design 4 | -------------------------------------------------------------------------------- /.github/workflows/CI.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: [ push, pull_request ] 3 | jobs: 4 | build: 5 | 6 | strategy: 7 | matrix: 8 | os: [ ubuntu-latest ] 9 | node-version: [ 20 ] 10 | 11 | runs-on: ${{ matrix.os }} 12 | 13 | steps: 14 | - name: Checkout 15 | uses: actions/checkout@v4 16 | - name: Use Node.js 17 | uses: actions/setup-node@v4 18 | with: 19 | node-version: ${{ matrix.node-version }} 20 | cache: 'npm' 21 | - name: Install dependencies 22 | run: npm ci 23 | - name: Build 24 | run: npm run all -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to [zeebe-bpmn-moddle](https://github.com/camunda/zeebe-bpmn-moddle) are documented here. We use [semantic versioning](http://semver.org/) for releases. 4 | 5 | ## Unreleased 6 | 7 | ___Note:__ Yet to be released changes appear here._ 8 | 9 | ## 1.9.0 10 | 11 | * `FEAT`: support `zeebe:AdHoc` for `bpmn:AdHocSubprocess` ([#69](https://github.com/camunda/zeebe-bpmn-moddle/pull/69)) 12 | 13 | ## 1.8.0 14 | 15 | * `FEAT`: support `zeebe:LinkedResource` for `bpmn:ServiceTask` 16 | 17 | ## 1.7.0 18 | 19 | * `FEAT`: support `zeebe:TaskListener` for `bpmn:UserTask` ([#67](https://github.com/camunda/zeebe-bpmn-moddle/pull/67)) 20 | 21 | ## 1.6.1 22 | 23 | * `FIX`: fix `allowedIn` for zeebe:LoopCharacteristics ([#66](https://github.com/camunda/zeebe-bpmn-moddle/pull/66)) 24 | 25 | ## 1.6.0 26 | 27 | * `FEAT`: support `zeebe:versionTag` for `zeebe:CalledDecision`, `zeebe:CalledElement` and `zeebe:FormDefinition` ([#65](https://github.com/camunda/zeebe-bpmn-moddle/pull/65)) 28 | 29 | ## 1.5.1 30 | 31 | * `FIX`: rename `zeebe:priority` to `zeebe:priorityDefinition` ([#62](https://github.com/camunda/zeebe-bpmn-moddle/issues/62)) 32 | 33 | ## 1.5.0 34 | 35 | * `FEAT`: support `zeebe:priority` ([#62](https://github.com/camunda/zeebe-bpmn-moddle/issues/62)) 36 | 37 | ## 1.4.0 38 | 39 | * `FEAT`: support `zeebe:bindingType` for `zeebe:CalledDecision`, `zeebe:CalledElement` and `zeebe:FormDefinition` ([#61](https://github.com/camunda/zeebe-bpmn-moddle/pull/61)) 40 | 41 | ## 1.3.0 42 | 43 | * `FEAT`: support `zeebe:VersionTag` ([#60](https://github.com/camunda/zeebe-bpmn-moddle/pull/60)) 44 | 45 | ## 1.2.0 46 | 47 | * `FEAT`: support: `zeebe:ExecutionListener` ([#57](https://github.com/camunda/zeebe-bpmn-moddle/pull/57)) 48 | 49 | ## 1.1.0 50 | 51 | * `FEAT`: support `zeebe:UserTask` ([#54](https://github.com/camunda/zeebe-bpmn-moddle/pull/56)) 52 | 53 | ## 1.0.0 54 | 55 | * `FEAT`: support `CalledElement#propagateAllParentVariables` ([#51](https://github.com/camunda/zeebe-bpmn-moddle/pull/51), [#52](https://github.com/camunda/zeebe-bpmn-moddle/pull/52)) 56 | * `FEAT`: support `FormDefinition#formId` ([#49](https://github.com/camunda/zeebe-bpmn-moddle/pull/49)) 57 | 58 | ## 0.19.0 59 | 60 | * `FEAT`: add `zeebe:modelerTemplate` for root elements 61 | 62 | ## 0.18.0 63 | 64 | * `FEAT`: add `zeebe:TaskSchedule` extension element ([#45](https://github.com/camunda/zeebe-bpmn-moddle/pull/45)) 65 | * `CHORE`: remove `zeebe:PropertiesHolder` type ([#44](https://github.com/camunda/zeebe-bpmn-moddle/pull/44)) 66 | 67 | ### Breaking Changes 68 | 69 | * `zeebe:PropertiesHolder` type removed without replacement as `zeebe:Properties` extension elements are generally allowed 70 | 71 | ## 0.17.0 72 | 73 | * `FEAT`: support `zeebe:script` ([#39](https://github.com/camunda/zeebe-bpmn-moddle/pull/39)) 74 | 75 | ## 0.16.0 76 | 77 | * `FEAT`: support `zeebe:candidateUsers` ([#38](https://github.com/camunda/zeebe-bpmn-moddle/pull/38)) 78 | 79 | ## 0.15.0 80 | 81 | * `CHORE`: remove behaviors ([#33](https://github.com/camunda/zeebe-bpmn-moddle/pull/33)) 82 | 83 | ### Breaking Changes 84 | 85 | * Behaviors moved to [`camunda-bpmn-js-behaviors`](https://github.com/camunda/camunda-bpmn-js-behaviors) 86 | 87 | ## 0.14.0 88 | 89 | _Unintentional re-publish of `v0.13.0`._ 90 | 91 | ## 0.13.0 92 | 93 | * `FEAT`: support `zeebe:properties` ([#30](https://github.com/camunda/zeebe-bpmn-moddle/issues/30)) 94 | 95 | ## 0.12.2 96 | 97 | * `FIX`: allow copy extensions to user task ([#28](https://github.com/camunda/zeebe-bpmn-moddle/pull/28)) 98 | 99 | ## 0.12.1 100 | 101 | * `FIX`: serialize `zeebe:modelerTemplateIcon` as property ([#25](https://github.com/camunda/zeebe-bpmn-moddle/pull/25)) 102 | 103 | ## 0.12.0 104 | 105 | * `FEAT`: support `zeebe:modelerTemplateIcon` ([#23](https://github.com/camunda/zeebe-bpmn-moddle/pull/23)) 106 | 107 | ## 0.11.0 108 | 109 | * `FEAT`: support `zeebe:modelerTemplate` and `zeebe:modelerTemplateVersion` ([#20](https://github.com/camunda/zeebe-bpmn-moddle/pull/20)) 110 | 111 | ## 0.10.0 112 | 113 | * `FEAT`: support `zeebe:assignmentDefinition` for `bpmn:UserTask` ([b5f368](https://github.com/camunda/zeebe-bpmn-moddle/commit/b5f368ce8daae65f8266b430df3cbd1bedd9232c)) 114 | 115 | ## 0.9.0 116 | 117 | * `FEAT`: support `zeebe:calledDecision` for `bpmn:BusinessRuleTask` ([ee9b59a](https://github.com/camunda/zeebe-bpmn-moddle/commit/ee9b59a00145542a4de9c3193f5e5c13d42a2cfc)) 118 | 119 | ## 0.8.0 120 | 121 | * `FEAT`: make Message Intermediate Throw Event and Message End Event Zeebe Service Tasks to support Zeebe 1.2 ([#15](https://github.com/camunda/zeebe-bpmn-moddle/pull/15)) 122 | * `FIX`: restrict `taskDefinition` property for Zeebe Service Tasks only ([#14](https://github.com/camunda/zeebe-bpmn-moddle/pull/14)) 123 | 124 | ## 0.7.1 125 | 126 | * `FIX`: correctly encode HTML entities in extension properties ([#12](https://github.com/camunda/zeebe-bpmn-moddle/pull/12)) 127 | 128 | ## 0.7.0 129 | 130 | * `FEAT`: extend ZeebeServiceTask type to support Zeebe 1.1 ([#9](https://github.com/camunda/zeebe-bpmn-moddle/pull/9)) 131 | 132 | ## 0.6.0 133 | 134 | * `FEAT`: allow `zeebe:TaskHeaders` only in `bpmn:ServiceTask` ([#7](https://github.com/camunda/zeebe-bpmn-moddle/issues/7)) 135 | 136 | ## 0.5.0 137 | 138 | * `FEAT`: add support for zeebe:UserTaskForm and zeebe:FormDefinition ([#6](https://github.com/camunda/zeebe-bpmn-moddle/pull/6)) 139 | 140 | ## 0.4.0 141 | 142 | * `FIX`: add allowedIn for zeebe:IoMapping ([#5](https://github.com/camunda/zeebe-bpmn-moddle/pull/5)) 143 | 144 | ## 0.3.0 145 | 146 | * `FEAT`: implement zeebe moddle extension and add canCopyProperty for initial set of elements ([#3](https://github.com/camunda/zeebe-bpmn-moddle/pull/3)) 147 | 148 | ## 0.2.0 149 | 150 | * `FEAT`: allow `propagateAllChildVariables` attribute for `zeebe:CalledElement` ([#2](https://github.com/camunda/zeebe-bpmn-moddle/pull/2)) 151 | 152 | ## 0.1.0 153 | 154 | * `CHORE`: first release :tada: 155 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2020-present Camunda Services GmbH 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # zeebe-bpmn-moddle 2 | 3 | [![CI](https://github.com/camunda/zeebe-bpmn-moddle/workflows/CI/badge.svg)](https://github.com/camunda/zeebe-bpmn-moddle/actions?query=workflow%3ACI) 4 | 5 | This project defines the [Zeebe](https://zeebe.io) namespace extensions for BPMN 2.0 as a [moddle](https://github.com/bpmn-io/moddle) descriptor. 6 | 7 | ## Usage 8 | 9 | Use it together with [bpmn-moddle](https://github.com/bpmn-io/bpmn-moddle) to validate Zeebe BPMN 2.0 extensions. 10 | 11 | ```javascript 12 | const BpmnModdle = require('bpmn-moddle'); 13 | 14 | const zeebeModdle = require('zeebe-bpmn-moddle/resources/zeebe.json'); 15 | 16 | const moddle = new BpmnModdle({ zeebe: zeebeModdle }); 17 | 18 | const taskDefinition = moddle.create('zeebe:TaskDefinition', { 19 | type: 'payment-service', 20 | retries: '5' 21 | }); 22 | 23 | const serviceTask = moddle.create('bpmn:ServiceTask', { 24 | extensionElements: [ taskDefinition ] 25 | }); 26 | ``` 27 | 28 | ## Building the Project 29 | 30 | Execute the test via 31 | 32 | ```sh 33 | npm test 34 | ``` 35 | 36 | Perform a complete build of the application via 37 | 38 | ```sh 39 | npm run all 40 | ``` 41 | 42 | # Behaviors 43 | 44 | Inside a [bpmn-js editor](https://github.com/bpmn-io/bpmn-js) pair this extension with [camunda-bpmn-js-behaviors](https://github.com/camunda/camunda-bpmn-js-behaviors#camunda-platform-8) to ensure Camunda properties are created, updated and deleted as expected. 45 | 46 | ## License 47 | 48 | Use under the terms of the [MIT license](http://opensource.org/licenses/MIT). 49 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "zeebe-bpmn-moddle", 3 | "version": "1.9.0", 4 | "description": "Zeebe moddle extensions for BPMN 2.0", 5 | "scripts": { 6 | "all": "run-s lint test", 7 | "lint": "eslint .", 8 | "dev": "npm test -- --watch", 9 | "test": "mocha -r ./test/expect --reporter=spec --recursive test" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/camunda/zeebe-bpmn-moddle" 14 | }, 15 | "keywords": [ 16 | "bpmn", 17 | "moddle", 18 | "bpmn20", 19 | "zeebe", 20 | "meta-model" 21 | ], 22 | "author": { 23 | "name": "Maciej Barelkowski", 24 | "url": "https://github.com/barmac" 25 | }, 26 | "contributors": [ 27 | { 28 | "name": "bpmn.io contributors", 29 | "url": "https://github.com/bpmn-io" 30 | } 31 | ], 32 | "license": "MIT", 33 | "devDependencies": { 34 | "async": "^2.6.0", 35 | "bpmn-moddle": "^7.1.2", 36 | "chai": "^4.3.4", 37 | "eslint": "^8.23.0", 38 | "eslint-plugin-bpmn-io": "^0.14.1", 39 | "glob": "^7.1.6", 40 | "jsondiffpatch": "^0.2.5", 41 | "min-dash": "^3.5.2", 42 | "mocha": "^11.1.0", 43 | "npm-run-all": "^4.1.2", 44 | "xsd-schema-validator": "^0.7.0" 45 | }, 46 | "files": [ 47 | "resources" 48 | ] 49 | } 50 | -------------------------------------------------------------------------------- /resources/zeebe.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "zeebe", 3 | "prefix": "zeebe", 4 | "uri": "http://camunda.org/schema/zeebe/1.0", 5 | "xml": { 6 | "tagAlias": "lowerCase" 7 | }, 8 | "associations": [], 9 | "types": [ 10 | { 11 | "name": "ZeebeServiceTask", 12 | "extends": [ 13 | "bpmn:ServiceTask", 14 | "bpmn:BusinessRuleTask", 15 | "bpmn:ScriptTask", 16 | "bpmn:SendTask", 17 | "bpmn:EndEvent", 18 | "bpmn:IntermediateThrowEvent" 19 | ], 20 | "properties": [ 21 | { 22 | "name": "retryCounter", 23 | "type": "String", 24 | "isAttr": true 25 | } 26 | ] 27 | }, 28 | { 29 | "name": "IoMapping", 30 | "superClass": [ 31 | "Element" 32 | ], 33 | "properties": [ 34 | { 35 | "name": "ioMapping", 36 | "type": "IoMapping" 37 | }, 38 | { 39 | "name": "inputParameters", 40 | "isMany": true, 41 | "type": "Input" 42 | }, 43 | { 44 | "name": "outputParameters", 45 | "isMany": true, 46 | "type": "Output" 47 | } 48 | ], 49 | "meta": { 50 | "allowedIn": [ 51 | "bpmn:CallActivity", 52 | "bpmn:Event", 53 | "bpmn:ReceiveTask", 54 | "zeebe:ZeebeServiceTask", 55 | "bpmn:SubProcess", 56 | "bpmn:UserTask" 57 | ] 58 | } 59 | }, 60 | { 61 | "name": "InputOutputParameter", 62 | "properties": [ 63 | { 64 | "name": "source", 65 | "isAttr": true, 66 | "type": "String" 67 | }, 68 | { 69 | "name": "target", 70 | "isAttr": true, 71 | "type": "String" 72 | } 73 | ] 74 | }, 75 | { 76 | "name": "Subscription", 77 | "superClass": [ 78 | "Element" 79 | ], 80 | "properties": [ 81 | { 82 | "name": "correlationKey", 83 | "isAttr": true, 84 | "type": "String" 85 | } 86 | ] 87 | }, 88 | { 89 | "name": "Input", 90 | "superClass": [ 91 | "InputOutputParameter" 92 | ], 93 | "meta": { 94 | "allowedIn": [ 95 | "bpmn:CallActivity", 96 | "zeebe:ZeebeServiceTask", 97 | "bpmn:SubProcess", 98 | "bpmn:UserTask" 99 | ] 100 | } 101 | }, 102 | { 103 | "name": "Output", 104 | "superClass": [ 105 | "InputOutputParameter" 106 | ], 107 | "meta": { 108 | "allowedIn": [ 109 | "bpmn:CallActivity", 110 | "bpmn:Event", 111 | "bpmn:ReceiveTask", 112 | "zeebe:ZeebeServiceTask", 113 | "bpmn:SubProcess", 114 | "bpmn:UserTask" 115 | ] 116 | } 117 | }, 118 | { 119 | "name": "TaskHeaders", 120 | "superClass": [ 121 | "Element" 122 | ], 123 | "meta": { 124 | "allowedIn": [ 125 | "zeebe:ZeebeServiceTask", 126 | "bpmn:UserTask" 127 | ] 128 | }, 129 | "properties": [ 130 | { 131 | "name": "values", 132 | "type": "Header", 133 | "isMany": true 134 | } 135 | ] 136 | }, 137 | { 138 | "name": "Header", 139 | "superClass": [ 140 | "Element" 141 | ], 142 | "properties": [ 143 | { 144 | "name": "id", 145 | "type": "String", 146 | "isAttr": true 147 | }, 148 | { 149 | "name": "key", 150 | "type": "String", 151 | "isAttr": true 152 | }, 153 | { 154 | "name": "value", 155 | "type": "String", 156 | "isAttr": true 157 | } 158 | ] 159 | }, 160 | { 161 | "name": "TaskDefinition", 162 | "superClass": [ 163 | "Element" 164 | ], 165 | "meta": { 166 | "allowedIn": [ 167 | "zeebe:ZeebeServiceTask" 168 | ] 169 | }, 170 | "properties": [ 171 | { 172 | "name": "type", 173 | "type": "String", 174 | "isAttr": true 175 | }, 176 | { 177 | "name": "retries", 178 | "type": "String", 179 | "isAttr": true 180 | } 181 | ] 182 | }, 183 | { 184 | "name": "LoopCharacteristics", 185 | "superClass": [ 186 | "Element" 187 | ], 188 | "meta": { 189 | "allowedIn": [ 190 | "bpmn:MultiInstanceLoopCharacteristics" 191 | ] 192 | }, 193 | "properties": [ 194 | { 195 | "name": "inputCollection", 196 | "type": "String", 197 | "isAttr": true 198 | }, 199 | { 200 | "name": "inputElement", 201 | "type": "String", 202 | "isAttr": true 203 | }, 204 | { 205 | "name": "outputCollection", 206 | "type": "String", 207 | "isAttr": true 208 | }, 209 | { 210 | "name": "outputElement", 211 | "type": "String", 212 | "isAttr": true 213 | } 214 | ] 215 | }, 216 | { 217 | "name": "CalledElement", 218 | "superClass": [ 219 | "Element" 220 | ], 221 | "meta": { 222 | "allowedIn": [ 223 | "bpmn:CallActivity" 224 | ] 225 | }, 226 | "properties": [ 227 | { 228 | "name": "processId", 229 | "type": "String", 230 | "isAttr": true 231 | }, 232 | { 233 | "name": "processIdExpression", 234 | "type": "String", 235 | "isAttr": true 236 | }, 237 | { 238 | "name": "propagateAllChildVariables", 239 | "isAttr": true, 240 | "type": "Boolean" 241 | }, 242 | { 243 | "name": "propagateAllParentVariables", 244 | "isAttr": true, 245 | "type": "Boolean", 246 | "default": true 247 | } 248 | ] 249 | }, 250 | { 251 | "name": "UserTaskForm", 252 | "superClass": [ 253 | "Element" 254 | ], 255 | "meta": { 256 | "allowedIn": [ 257 | "bpmn:Process" 258 | ] 259 | }, 260 | "properties": [ 261 | { 262 | "name": "id", 263 | "type": "String", 264 | "isAttr": true 265 | }, 266 | { 267 | "name": "body", 268 | "type": "String", 269 | "isBody": true 270 | } 271 | ] 272 | }, 273 | { 274 | "name": "FormDefinition", 275 | "superClass": [ 276 | "Element" 277 | ], 278 | "meta": { 279 | "allowedIn": [ 280 | "bpmn:UserTask" 281 | ] 282 | }, 283 | "properties": [ 284 | { 285 | "name": "formKey", 286 | "type": "String", 287 | "isAttr": true 288 | }, 289 | { 290 | "name": "formId", 291 | "type": "String", 292 | "isAttr": true 293 | }, 294 | { 295 | "name": "externalReference", 296 | "type": "String", 297 | "isAttr": true 298 | } 299 | ] 300 | }, 301 | { 302 | "name": "LinkedResource", 303 | "superClass": [ 304 | "Element" 305 | ], 306 | "meta": { 307 | "allowedIn": [ 308 | "bpmn:ServiceTask" 309 | ] 310 | }, 311 | "properties": [ 312 | { 313 | "name": "resourceId", 314 | "type": "String", 315 | "isAttr": true 316 | }, 317 | { 318 | "name": "resourceType", 319 | "type": "String", 320 | "isAttr": true 321 | }, 322 | { 323 | "name": "linkName", 324 | "type": "String", 325 | "isAttr": true 326 | } 327 | ] 328 | }, 329 | { 330 | "name": "LinkedResources", 331 | "superClass": [ 332 | "Element" 333 | ], 334 | "meta": { 335 | "allowedIn": [ 336 | "bpmn:ServiceTask" 337 | ] 338 | }, 339 | "properties": [ 340 | { 341 | "name": "values", 342 | "type": "LinkedResource", 343 | "isMany": true 344 | } 345 | ] 346 | }, 347 | { 348 | "name": "UserTask", 349 | "superClass": [ 350 | "Element" 351 | ], 352 | "meta": { 353 | "allowedIn": [ 354 | "bpmn:UserTask" 355 | ] 356 | }, 357 | "properties": [] 358 | }, 359 | { 360 | "name": "CalledDecision", 361 | "superClass": [ 362 | "Element" 363 | ], 364 | "meta": { 365 | "allowedIn": [ 366 | "bpmn:BusinessRuleTask" 367 | ] 368 | }, 369 | "properties": [ 370 | { 371 | "name": "decisionId", 372 | "type": "String", 373 | "isAttr": true 374 | }, 375 | { 376 | "name": "resultVariable", 377 | "type": "String", 378 | "isAttr": true 379 | } 380 | ] 381 | }, 382 | { 383 | "name": "AssignmentDefinition", 384 | "superClass": [ 385 | "Element" 386 | ], 387 | "meta": { 388 | "allowedIn": [ 389 | "bpmn:UserTask" 390 | ] 391 | }, 392 | "properties": [ 393 | { 394 | "name": "assignee", 395 | "type": "String", 396 | "isAttr": true 397 | }, 398 | { 399 | "name": "candidateGroups", 400 | "type": "String", 401 | "isAttr": true 402 | }, 403 | { 404 | "name": "candidateUsers", 405 | "type": "String", 406 | "isAttr": true 407 | } 408 | ] 409 | }, 410 | { 411 | "name": "PriorityDefinition", 412 | "superClass": [ 413 | "Element" 414 | ], 415 | "meta": { 416 | "allowedIn": [ 417 | "bpmn:UserTask" 418 | ] 419 | }, 420 | "properties": [ 421 | { 422 | "name": "priority", 423 | "type": "String", 424 | "isAttr": true 425 | } 426 | ] 427 | }, 428 | { 429 | "name": "TaskSchedule", 430 | "superClass": [ 431 | "Element" 432 | ], 433 | "meta": { 434 | "allowedIn": [ 435 | "bpmn:UserTask" 436 | ] 437 | }, 438 | "properties": [ 439 | { 440 | "name": "dueDate", 441 | "type": "String", 442 | "isAttr": true 443 | }, 444 | { 445 | "name": "followUpDate", 446 | "type": "String", 447 | "isAttr": true 448 | } 449 | ] 450 | }, 451 | { 452 | "name": "Properties", 453 | "superClass": [ 454 | "Element" 455 | ], 456 | "properties": [ 457 | { 458 | "name": "properties", 459 | "type": "Property", 460 | "isMany": true 461 | } 462 | ] 463 | }, 464 | { 465 | "name": "Property", 466 | "properties": [ 467 | { 468 | "name": "name", 469 | "type": "String", 470 | "isAttr": true 471 | }, 472 | { 473 | "name": "value", 474 | "type": "String", 475 | "isAttr": true 476 | } 477 | ] 478 | }, 479 | { 480 | "name": "TemplateSupported", 481 | "isAbstract": true, 482 | "extends": [ 483 | "bpmn:Collaboration", 484 | "bpmn:Process", 485 | "bpmn:FlowElement" 486 | ], 487 | "properties": [ 488 | { 489 | "name": "modelerTemplate", 490 | "isAttr": true, 491 | "type": "String" 492 | }, 493 | { 494 | "name": "modelerTemplateVersion", 495 | "isAttr": true, 496 | "type": "Integer" 497 | }, 498 | { 499 | "name": "modelerTemplateIcon", 500 | "isAttr": true, 501 | "type": "String" 502 | } 503 | ] 504 | }, 505 | { 506 | "name": "TemplatedRootElement", 507 | "isAbstract": true, 508 | "extends": [ 509 | "bpmn:Error", 510 | "bpmn:Escalation", 511 | "bpmn:Message", 512 | "bpmn:Signal" 513 | ], 514 | "properties": [ 515 | { 516 | "name": "modelerTemplate", 517 | "isAttr": true, 518 | "type": "String" 519 | } 520 | ] 521 | }, 522 | { 523 | "name": "Script", 524 | "superClass": [ 525 | "Element" 526 | ], 527 | "meta": { 528 | "allowedIn": [ 529 | "bpmn:ScriptTask" 530 | ] 531 | }, 532 | "properties": [ 533 | { 534 | "name": "expression", 535 | "type": "String", 536 | "isAttr": true 537 | }, 538 | { 539 | "name": "resultVariable", 540 | "type": "String", 541 | "isAttr": true 542 | } 543 | ] 544 | }, 545 | { 546 | "name": "ExecutionListeners", 547 | "superClass": [ 548 | "Element" 549 | ], 550 | "meta": { 551 | "allowedIn": [ 552 | "bpmn:Event", 553 | "bpmn:Activity", 554 | "bpmn:Process", 555 | "bpmn:ExclusiveGateway", 556 | "bpmn:InclusiveGateway", 557 | "bpmn:ParallelGateway", 558 | "bpmn:EventBasedGateway" 559 | ] 560 | }, 561 | "properties": [ 562 | { 563 | "name": "listeners", 564 | "type": "ExecutionListener", 565 | "isMany": true 566 | } 567 | ] 568 | }, 569 | { 570 | "name": "ExecutionListener", 571 | "superClass": [ 572 | "Element" 573 | ], 574 | "meta": { 575 | "allowedIn": [ 576 | "zeebe:ExecutionListeners" 577 | ] 578 | }, 579 | "properties": [ 580 | { 581 | "name": "eventType", 582 | "type": "String", 583 | "isAttr": true 584 | }, 585 | { 586 | "name": "retries", 587 | "type": "String", 588 | "isAttr": true 589 | }, 590 | { 591 | "name": "type", 592 | "type": "String", 593 | "isAttr": true 594 | } 595 | ] 596 | }, 597 | { 598 | "name": "TaskListeners", 599 | "superClass": [ 600 | "Element" 601 | ], 602 | "meta": { 603 | "allowedIn": [ 604 | "bpmn:UserTask" 605 | ] 606 | }, 607 | "properties": [ 608 | { 609 | "name": "listeners", 610 | "type": "TaskListener", 611 | "isMany": true 612 | } 613 | ] 614 | }, 615 | { 616 | "name": "TaskListener", 617 | "superClass": [ 618 | "Element" 619 | ], 620 | "meta": { 621 | "allowedIn": [ 622 | "zeebe:TaskListeners" 623 | ] 624 | }, 625 | "properties": [ 626 | { 627 | "name": "eventType", 628 | "type": "String", 629 | "isAttr": true 630 | }, 631 | { 632 | "name": "retries", 633 | "type": "String", 634 | "isAttr": true 635 | }, 636 | { 637 | "name": "type", 638 | "type": "String", 639 | "isAttr": true 640 | } 641 | ] 642 | }, 643 | { 644 | "name": "VersionTag", 645 | "superClass": [ 646 | "Element" 647 | ], 648 | "meta": { 649 | "allowedIn": [ 650 | "bpmn:Process" 651 | ] 652 | }, 653 | "properties": [ 654 | { 655 | "name": "value", 656 | "type": "String", 657 | "isAttr": true 658 | } 659 | ] 660 | }, 661 | { 662 | "name": "BindingTypeSupported", 663 | "isAbstract": true, 664 | "extends": [ 665 | "zeebe:CalledDecision", 666 | "zeebe:CalledElement", 667 | "zeebe:FormDefinition", 668 | "zeebe:LinkedResource" 669 | ], 670 | "properties": [ 671 | { 672 | "name": "bindingType", 673 | "isAttr": true, 674 | "type": "String", 675 | "default": "latest" 676 | }, 677 | { 678 | "name": "versionTag", 679 | "isAttr": true, 680 | "type": "String" 681 | } 682 | ] 683 | }, 684 | { 685 | "name": "AdHoc", 686 | "superClass": [ 687 | "Element" 688 | ], 689 | "meta": { 690 | "allowedIn": [ 691 | "bpmn:AdHocSubProcess" 692 | ] 693 | }, 694 | "properties": [ 695 | { 696 | "name": "activeElementsCollection", 697 | "isAttr": true, 698 | "type": "String" 699 | } 700 | ] 701 | } 702 | ] 703 | } 704 | -------------------------------------------------------------------------------- /test/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "plugin:bpmn-io/mocha" 3 | } -------------------------------------------------------------------------------- /test/expect.js: -------------------------------------------------------------------------------- 1 | var chai = require('chai'); 2 | 3 | // add matchers 4 | chai.use(require('./matchers')); 5 | 6 | // expose expect as global 7 | global.expect = chai.expect; -------------------------------------------------------------------------------- /test/fixtures/xml/adhoc-sub-process-zeebe-adHoc.bpmn: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/fixtures/xml/businessRuleTask-zeebe-calledDecision.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/fixtures/xml/call-activity-zeebe-calledElement-propagateAllChildVariables.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/fixtures/xml/call-activity-zeebe-calledElement-propagateAllParentVariables.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/fixtures/xml/call-activity-zeebe-calledElement.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/fixtures/xml/calledDecision-bindingType.part.bpmn: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/fixtures/xml/calledDecision-versionTag.part.bpmn: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/fixtures/xml/calledElement-bindingType.part.bpmn: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/fixtures/xml/calledElement-versionTag.part.bpmn: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/fixtures/xml/event-zeebe-executionListener.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/fixtures/xml/formDefinition-bindingType.part.bpmn: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/fixtures/xml/formDefinition-versionTag.part.bpmn: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/fixtures/xml/gateway-zeebe-executionListener.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/fixtures/xml/message-zeebe-subscription.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/fixtures/xml/process-zeebe-userTaskForm.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | { components: [ { label: "field", key: "field" } ] } 8 | { components: [ { label: "<field>", key: "field" } ] } 9 | 10 | -------------------------------------------------------------------------------- /test/fixtures/xml/rootElement.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/fixtures/xml/scriptTask-zeebe-script.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/fixtures/xml/simple.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Flow_0kq4fdb 16 | Flow_0mnzrj4 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Flow_0kq4fdb 25 | 26 | 27 | 28 | Flow_0mnzrj4 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /test/fixtures/xml/startEvent-zeebe-properties.part.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/fixtures/xml/task-modelerTemplate.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/task-modelerTemplateIcon.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /test/fixtures/xml/task-modelerTemplateVersion.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/task-zeebe-executionListener.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/fixtures/xml/userTask-zeebe-assignmentDefinition.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/fixtures/xml/userTask-zeebe-formDefinition-externalReference.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/fixtures/xml/userTask-zeebe-formDefinition-formId.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/fixtures/xml/userTask-zeebe-formDefinition-formKey.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/fixtures/xml/userTask-zeebe-formDefinition.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /test/fixtures/xml/userTask-zeebe-priority.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/fixtures/xml/userTask-zeebe-taskListener.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/fixtures/xml/userTask-zeebe-taskSchedule.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/fixtures/xml/userTask-zeebe-userTask.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-adHoc.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-bindingType.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-execution-listeners.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-linkedResources.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | 17 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-properties.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Flow_1ghqtxk 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | Flow_1ghqtxk 21 | Flow_0829k0f 22 | Flow_1yxvdzm 23 | 24 | 25 | 26 | 27 | Flow_1mj7vtb 28 | Flow_1e9zid1 29 | Flow_0zeynk4 30 | 31 | 32 | 33 | Flow_0zeynk4 34 | 35 | 36 | 37 | = day of week(today()) = "Tuesday" 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | Flow_0829k0f 49 | Flow_1mj7vtb 50 | 51 | 52 | Flow_1yxvdzm 53 | Flow_1e9zid1 54 | 55 | PT15S 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-service-task/businessRuleTask-zeebe-extensions.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-service-task/businessRuleTask-zeebe-ioMapping.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-service-task/businessRuleTask-zeebe-loopCharacteristics.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-service-task/businessRuleTask-zeebe-retryCounter.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-service-task/scriptTask-zeebe-extensions.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-service-task/scriptTask-zeebe-ioMapping.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-service-task/scriptTask-zeebe-loopCharacteristics.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-service-task/scriptTask-zeebe-retryCounter.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-service-task/sendTask-zeebe-extensions.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-service-task/sendTask-zeebe-ioMapping.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-service-task/sendTask-zeebe-loopCharacteristics.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-service-task/sendTask-zeebe-retryCounter.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-service-task/serviceTask-zeebe-extensions.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-service-task/serviceTask-zeebe-ioMapping.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-service-task/serviceTask-zeebe-linkedResource.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 13 | 19 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-service-task/serviceTask-zeebe-loopCharacteristics.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-service-task/serviceTask-zeebe-retryCounter.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-taskListeners.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-versionTag.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Flow_1 9 | 10 | 11 | Flow_1 12 | Flow_2 13 | 14 | 15 | 16 | Flow_2 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /test/fixtures/xml/zeebe-versionTag.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/helper.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var fs = require('fs'); 4 | 5 | 6 | function readFile(filename) { 7 | return fs.readFileSync(filename, { encoding: 'UTF-8' }); 8 | } 9 | 10 | module.exports.readFile = readFile; 11 | 12 | 13 | var BpmnModdle = require('bpmn-moddle'); 14 | 15 | var zeebeDescriptor = require('../resources/zeebe'); 16 | 17 | function createModdle() { 18 | return new BpmnModdle({ 19 | zeebe: zeebeDescriptor 20 | }); 21 | } 22 | 23 | module.exports.createModdle = createModdle; -------------------------------------------------------------------------------- /test/matchers.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function(chai, utils) { 4 | 5 | utils.addMethod(chai.Assertion.prototype, 'jsonEqual', function(comparison) { 6 | 7 | var actual = JSON.stringify(this._obj); 8 | var expected = JSON.stringify(comparison); 9 | 10 | this.assert( 11 | actual == expected, 12 | 'expected #{this} to deep equal #{act}', 13 | 'expected #{this} not to deep equal #{act}', 14 | comparison, // expected 15 | this._obj, // actual 16 | true // show diff 17 | ); 18 | }); 19 | }; -------------------------------------------------------------------------------- /test/spec/descriptor.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | 4 | describe('descriptor', function() { 5 | 6 | var zeebeDescriptor = require('../../resources/zeebe'); 7 | 8 | 9 | it('should provide model', function() { 10 | 11 | // then 12 | expect(zeebeDescriptor).to.exist; 13 | 14 | expect(zeebeDescriptor.uri).to.eql('http://camunda.org/schema/zeebe/1.0'); 15 | expect(zeebeDescriptor.prefix).to.eql('zeebe'); 16 | }); 17 | 18 | }); -------------------------------------------------------------------------------- /test/spec/integration.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var BpmnModdle = require('bpmn-moddle'); 4 | 5 | var zeebeDescriptor = require('../../resources/zeebe'); 6 | 7 | 8 | describe('exports', function() { 9 | 10 | it('should extend bpmn-moddle', function() { 11 | 12 | // given 13 | var moddle = new BpmnModdle({ 14 | zeebe: zeebeDescriptor 15 | }); 16 | 17 | // when 18 | var serviceTask = moddle.create('bpmn:ServiceTask'); 19 | 20 | // then 21 | expect(serviceTask.$instanceOf('zeebe:ZeebeServiceTask')).to.be.true; 22 | }); 23 | 24 | }); -------------------------------------------------------------------------------- /test/spec/xml/read.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | 4 | var readFile = require('../../helper').readFile, 5 | createModdle = require('../../helper').createModdle; 6 | 7 | 8 | describe('read', function() { 9 | 10 | describe('should read extensions', function() { 11 | 12 | var moddle; 13 | 14 | beforeEach(function() { 15 | moddle = createModdle(); 16 | }); 17 | 18 | 19 | describe('zeebe:TaskDefinition / zeebe:TaskHeaders / zeebe:Header', function() { 20 | 21 | it('on ServiceTask', async function() { 22 | 23 | // given 24 | var xml = readFile('test/fixtures/xml/zeebe-service-task/serviceTask-zeebe-extensions.part.bpmn'); 25 | 26 | // when 27 | const { 28 | rootElement: proc 29 | } = await moddle.fromXML(xml, 'bpmn:ServiceTask'); 30 | 31 | // then 32 | expect(proc).to.jsonEqual({ 33 | $type: 'bpmn:ServiceTask', 34 | id: 'collect-money', 35 | name: 'Collect Money', 36 | extensionElements: { 37 | $type: 'bpmn:ExtensionElements', 38 | values: [ 39 | { 40 | $type: 'zeebe:TaskDefinition', 41 | type: 'payment-service', 42 | retries: '5' 43 | }, 44 | { 45 | $type: 'zeebe:TaskHeaders', 46 | values: [ 47 | { 48 | $type: 'zeebe:Header', 49 | key: 'method', 50 | value: 'VISA' 51 | } 52 | ] 53 | } 54 | ] 55 | } 56 | }); 57 | }); 58 | 59 | }); 60 | 61 | 62 | describe('zeebe:retryCounter', function() { 63 | 64 | it('on ServiceTask', async function() { 65 | 66 | // given 67 | var xml = readFile('test/fixtures/xml/zeebe-service-task/serviceTask-zeebe-retryCounter.part.bpmn'); 68 | 69 | // when 70 | const { 71 | rootElement: proc 72 | } = await moddle.fromXML(xml, 'bpmn:ServiceTask'); 73 | 74 | // then 75 | expect(proc).to.jsonEqual({ 76 | $type: 'bpmn:ServiceTask', 77 | retryCounter: 'text' 78 | }); 79 | }); 80 | 81 | }); 82 | 83 | 84 | describe('zeebe:Properties', function() { 85 | 86 | it('on StartEvent', async function() { 87 | 88 | // given 89 | var xml = readFile('test/fixtures/xml/startEvent-zeebe-properties.part.bpmn'); 90 | 91 | // when 92 | const { 93 | rootElement: event 94 | } = await moddle.fromXML(xml, 'bpmn:StartEvent'); 95 | 96 | // then 97 | expect(event).to.jsonEqual({ 98 | $type: 'bpmn:StartEvent', 99 | id: 'start', 100 | extensionElements: { 101 | $type: 'bpmn:ExtensionElements', 102 | values: [ 103 | { 104 | $type: 'zeebe:Properties', 105 | properties: [ 106 | { 107 | $type: 'zeebe:Property', 108 | name: 'id', 109 | value: 'start' 110 | }, 111 | { 112 | $type: 'zeebe:Property', 113 | name: 'type', 114 | value: 'event' 115 | } 116 | ] 117 | } 118 | ] 119 | } 120 | }); 121 | }); 122 | 123 | }); 124 | 125 | 126 | describe('zeebe:Subscription', function() { 127 | 128 | it('on Message', async function() { 129 | 130 | // given 131 | var xml = readFile('test/fixtures/xml/message-zeebe-subscription.part.bpmn'); 132 | 133 | // when 134 | const { 135 | rootElement: proc 136 | } = await moddle.fromXML(xml, 'bpmn:Message'); 137 | 138 | // then 139 | expect(proc).to.jsonEqual({ 140 | $type: 'bpmn:Message', 141 | id: 'Message', 142 | name: 'Money collected', 143 | extensionElements: { 144 | $type: 'bpmn:ExtensionElements', 145 | values: [ 146 | { 147 | $type: 'zeebe:Subscription', 148 | correlationKey: 'orderId' 149 | } 150 | ] 151 | } 152 | }); 153 | }); 154 | 155 | }); 156 | 157 | 158 | describe('zeebe:calledElement', function() { 159 | 160 | it('on CallActivity', async function() { 161 | 162 | // given 163 | var xml = readFile('test/fixtures/xml/call-activity-zeebe-calledElement.part.bpmn'); 164 | 165 | // when 166 | const { 167 | rootElement: proc 168 | } = await moddle.fromXML(xml, 'bpmn:CallActivity'); 169 | 170 | // then 171 | expect(proc).to.jsonEqual({ 172 | $type: 'bpmn:CallActivity', 173 | id: 'task-A', 174 | name: 'A', 175 | extensionElements: { 176 | $type: 'bpmn:ExtensionElements', 177 | values: [ 178 | { 179 | $type: 'zeebe:CalledElement', 180 | processId: 'child-process-id' 181 | } 182 | ] 183 | } 184 | }); 185 | 186 | }); 187 | 188 | 189 | it('on CallActivity with propagateAllChildVariables', async function() { 190 | 191 | // given 192 | var xml = readFile('test/fixtures/xml/call-activity-zeebe-calledElement-propagateAllChildVariables.part.bpmn'); 193 | 194 | // when 195 | const { 196 | rootElement: proc 197 | } = await moddle.fromXML(xml, 'bpmn:CallActivity'); 198 | 199 | // then 200 | expect(proc).to.jsonEqual({ 201 | $type: 'bpmn:CallActivity', 202 | id: 'task-A', 203 | name: 'A', 204 | extensionElements: { 205 | $type: 'bpmn:ExtensionElements', 206 | values: [ 207 | { 208 | $type: 'zeebe:CalledElement', 209 | processId: 'child-process-id', 210 | propagateAllChildVariables: true 211 | } 212 | ] 213 | } 214 | }); 215 | }); 216 | 217 | describe('with propagateAllParentVariables', function() { 218 | 219 | it('default value', function() { 220 | 221 | // when 222 | var bo = moddle.create('zeebe:CalledElement'); 223 | 224 | // then 225 | expect(bo.get('zeebe:propagateAllParentVariables')).to.be.true; 226 | }); 227 | 228 | 229 | it('default value read from BPMN', async function() { 230 | 231 | // given 232 | var xml = readFile('test/fixtures/xml/call-activity-zeebe-calledElement.part.bpmn'); 233 | 234 | // when 235 | const { 236 | rootElement: proc 237 | } = await moddle.fromXML(xml, 'bpmn:CallActivity'); 238 | 239 | const extensionElements = proc.get('extensionElements'); 240 | const values = extensionElements.get('values'); 241 | const calledElement = values[0]; 242 | 243 | // then 244 | expect(calledElement.get('zeebe:propagateAllParentVariables')).to.be.true; 245 | }); 246 | 247 | 248 | it('disabled in BPMN', async function() { 249 | 250 | // given 251 | var xml = readFile('test/fixtures/xml/call-activity-zeebe-calledElement-propagateAllParentVariables.part.bpmn'); 252 | 253 | // when 254 | const { 255 | rootElement: proc 256 | } = await moddle.fromXML(xml, 'bpmn:CallActivity'); 257 | 258 | // then 259 | expect(proc).to.jsonEqual({ 260 | $type: 'bpmn:CallActivity', 261 | id: 'task-A', 262 | name: 'A', 263 | extensionElements: { 264 | $type: 'bpmn:ExtensionElements', 265 | values: [ 266 | { 267 | $type: 'zeebe:CalledElement', 268 | processId: 'child-process-id', 269 | propagateAllParentVariables: false 270 | } 271 | ] 272 | } 273 | }); 274 | 275 | }); 276 | }); 277 | 278 | }); 279 | 280 | 281 | describe('zeebe:loopCharacteristics', function() { 282 | 283 | it('on CallActivity', async function() { 284 | 285 | // given 286 | var xml = readFile('test/fixtures/xml/zeebe-service-task/serviceTask-zeebe-loopCharacteristics.part.bpmn'); 287 | 288 | // when 289 | const { 290 | rootElement: proc 291 | } = await moddle.fromXML(xml, 'bpmn:ServiceTask'); 292 | 293 | // then 294 | expect(proc).to.jsonEqual({ 295 | $type: 'bpmn:ServiceTask', 296 | id: 'task-A', 297 | name: 'A', 298 | loopCharacteristics: { 299 | $type: 'bpmn:MultiInstanceLoopCharacteristics', 300 | isSequential: true, 301 | extensionElements: { 302 | $type: 'bpmn:ExtensionElements', 303 | values: [ 304 | { 305 | $type: 'zeebe:LoopCharacteristics', 306 | inputCollection: '= items', 307 | inputElement: 'item', 308 | outputCollection: 'results', 309 | outputElement: '= result' 310 | } 311 | ] 312 | } 313 | } 314 | }); 315 | }); 316 | 317 | }); 318 | 319 | 320 | describe('zeebe:linkedResource', function() { 321 | 322 | it('on ServiceTask', async function() { 323 | 324 | // given 325 | var xml = readFile('test/fixtures/xml/zeebe-service-task/serviceTask-zeebe-linkedResource.part.bpmn'); 326 | 327 | // when 328 | const { 329 | rootElement: proc 330 | } = await moddle.fromXML(xml, 'bpmn:ServiceTask'); 331 | 332 | // then 333 | expect(proc).to.jsonEqual({ 334 | $type: 'bpmn:ServiceTask', 335 | id: 'collect-money', 336 | name: 'Collect Money', 337 | extensionElements: { 338 | $type: 'bpmn:ExtensionElements', 339 | values: [ 340 | { 341 | $type: 'zeebe:LinkedResources', 342 | values: [ 343 | { 344 | $type: 'zeebe:LinkedResource', 345 | resourceId:'=myScript', 346 | resourceType:'RPA', 347 | bindingType:'latest' 348 | }, 349 | { 350 | $type: 'zeebe:LinkedResource', 351 | resourceId: '=myScript', 352 | resourceType: 'RPA', 353 | bindingType: 'versionTag', 354 | versionTag: 'v1' 355 | }, 356 | { 357 | $type: 'zeebe:LinkedResource', 358 | resourceId: '=myScript', 359 | resourceType: 'RPA', 360 | bindingType: 'deployment', 361 | linkName: 'myScript' 362 | } 363 | ] 364 | } 365 | ] 366 | } 367 | }); 368 | 369 | }); 370 | 371 | }); 372 | 373 | describe('zeebe:ioMapping / zeebe:Input / zeebe:Output', function() { 374 | 375 | it('on ServiceTask', async function() { 376 | 377 | // given 378 | var xml = readFile('test/fixtures/xml/zeebe-service-task/serviceTask-zeebe-ioMapping.part.bpmn'); 379 | 380 | // when 381 | const { 382 | rootElement: proc 383 | } = await moddle.fromXML(xml, 'bpmn:ServiceTask'); 384 | 385 | // then 386 | expect(proc).to.jsonEqual({ 387 | $type: 'bpmn:ServiceTask', 388 | id: 'collect-money', 389 | name: 'Collect Money', 390 | extensionElements: { 391 | $type: 'bpmn:ExtensionElements', 392 | values: [ 393 | { 394 | $type: 'zeebe:IoMapping', 395 | inputParameters: [ 396 | { 397 | $type: 'zeebe:Input', 398 | source: 'sourceValue', 399 | target: 'targetValue' 400 | } 401 | ], 402 | outputParameters: [ 403 | { 404 | $type: 'zeebe:Output', 405 | source: 'sourceValue', 406 | target: 'targetValue' 407 | } 408 | ] 409 | } 410 | ] 411 | } 412 | }); 413 | 414 | }); 415 | 416 | 417 | it('on SendTask', async function() { 418 | 419 | // given 420 | var xml = readFile('test/fixtures/xml/zeebe-service-task/sendTask-zeebe-ioMapping.part.bpmn'); 421 | 422 | // when 423 | const { 424 | rootElement: proc 425 | } = await moddle.fromXML(xml, 'bpmn:SendTask'); 426 | 427 | // then 428 | expect(proc).to.jsonEqual({ 429 | $type: 'bpmn:SendTask', 430 | id: 'collect-money', 431 | name: 'Collect Money', 432 | extensionElements: { 433 | $type: 'bpmn:ExtensionElements', 434 | values: [ 435 | { 436 | $type: 'zeebe:IoMapping', 437 | inputParameters: [ 438 | { 439 | $type: 'zeebe:Input', 440 | source: 'sourceValue', 441 | target: 'targetValue' 442 | } 443 | ], 444 | outputParameters: [ 445 | { 446 | $type: 'zeebe:Output', 447 | source: 'sourceValue', 448 | target: 'targetValue' 449 | } 450 | ] 451 | } 452 | ] 453 | } 454 | }); 455 | 456 | }); 457 | 458 | 459 | it('on ScriptTask', async function() { 460 | 461 | // given 462 | var xml = readFile('test/fixtures/xml/zeebe-service-task/scriptTask-zeebe-ioMapping.part.bpmn'); 463 | 464 | // when 465 | const { 466 | rootElement: proc 467 | } = await moddle.fromXML(xml, 'bpmn:ScriptTask'); 468 | 469 | // then 470 | expect(proc).to.jsonEqual({ 471 | $type: 'bpmn:ScriptTask', 472 | id: 'collect-money', 473 | name: 'Collect Money', 474 | extensionElements: { 475 | $type: 'bpmn:ExtensionElements', 476 | values: [ 477 | { 478 | $type: 'zeebe:IoMapping', 479 | inputParameters: [ 480 | { 481 | $type: 'zeebe:Input', 482 | source: 'sourceValue', 483 | target: 'targetValue' 484 | } 485 | ], 486 | outputParameters: [ 487 | { 488 | $type: 'zeebe:Output', 489 | source: 'sourceValue', 490 | target: 'targetValue' 491 | } 492 | ] 493 | } 494 | ] 495 | } 496 | }); 497 | 498 | }); 499 | 500 | 501 | it('on BusinessRuleTask', async function() { 502 | 503 | // given 504 | var xml = readFile('test/fixtures/xml/zeebe-service-task/businessRuleTask-zeebe-ioMapping.part.bpmn'); 505 | 506 | // when 507 | const { 508 | rootElement: proc 509 | } = await moddle.fromXML(xml, 'bpmn:BusinessRuleTask'); 510 | 511 | // then 512 | expect(proc).to.jsonEqual({ 513 | $type: 'bpmn:BusinessRuleTask', 514 | id: 'collect-money', 515 | name: 'Collect Money', 516 | extensionElements: { 517 | $type: 'bpmn:ExtensionElements', 518 | values: [ 519 | { 520 | $type: 'zeebe:IoMapping', 521 | inputParameters: [ 522 | { 523 | $type: 'zeebe:Input', 524 | source: 'sourceValue', 525 | target: 'targetValue' 526 | } 527 | ], 528 | outputParameters: [ 529 | { 530 | $type: 'zeebe:Output', 531 | source: 'sourceValue', 532 | target: 'targetValue' 533 | } 534 | ] 535 | } 536 | ] 537 | } 538 | }); 539 | }); 540 | 541 | }); 542 | 543 | 544 | describe('zeebe:userTaskForm', function() { 545 | 546 | it('on Process', async function() { 547 | 548 | // given 549 | var xml = readFile('test/fixtures/xml/process-zeebe-userTaskForm.part.bpmn'); 550 | 551 | // when 552 | const { 553 | rootElement: proc 554 | } = await moddle.fromXML(xml, 'bpmn:Process'); 555 | 556 | // then 557 | expect(proc).to.jsonEqual({ 558 | $type: 'bpmn:Process', 559 | id: 'process-1', 560 | extensionElements: { 561 | $type: 'bpmn:ExtensionElements', 562 | values: [ 563 | { 564 | $type: 'zeebe:UserTaskForm', 565 | id: 'userTaskForm-1', 566 | body: '{ components: [ { label: "field", key: "field" } ] }' 567 | }, 568 | { 569 | $type: 'zeebe:UserTaskForm', 570 | id: 'userTaskForm-2', 571 | body: '{ components: [ { label: "", key: "field" } ] }' 572 | } 573 | ] 574 | } 575 | }); 576 | }); 577 | 578 | }); 579 | 580 | 581 | describe('zeebe:formDefinition', function() { 582 | 583 | describe('on UserTask', function() { 584 | 585 | it('zeebe:formKey', async function() { 586 | 587 | // given 588 | var xml = readFile('test/fixtures/xml/userTask-zeebe-formDefinition-formKey.part.bpmn'); 589 | 590 | // when 591 | const { 592 | rootElement: proc 593 | } = await moddle.fromXML(xml, 'bpmn:UserTask'); 594 | 595 | // then 596 | expect(proc).to.jsonEqual({ 597 | $type: 'bpmn:UserTask', 598 | id: 'user-task-1', 599 | extensionElements: { 600 | $type: 'bpmn:ExtensionElements', 601 | values: [ 602 | { 603 | $type: 'zeebe:FormDefinition', 604 | formKey: 'form-1' 605 | } 606 | ] 607 | } 608 | }); 609 | }); 610 | 611 | 612 | it('zeebe:formId', async function() { 613 | 614 | // given 615 | var xml = readFile('test/fixtures/xml/userTask-zeebe-formDefinition-formId.part.bpmn'); 616 | 617 | // when 618 | const { 619 | rootElement: proc 620 | } = await moddle.fromXML(xml, 'bpmn:UserTask'); 621 | 622 | // then 623 | expect(proc).to.jsonEqual({ 624 | $type: 'bpmn:UserTask', 625 | id: 'user-task-1', 626 | extensionElements: { 627 | $type: 'bpmn:ExtensionElements', 628 | values: [ 629 | { 630 | $type: 'zeebe:FormDefinition', 631 | formId: 'form-1' 632 | } 633 | ] 634 | } 635 | }); 636 | }); 637 | 638 | 639 | it('zeebe:externalReference', async function() { 640 | 641 | // given 642 | var xml = readFile('test/fixtures/xml/userTask-zeebe-formDefinition-externalReference.part.bpmn'); 643 | 644 | // when 645 | const { 646 | rootElement: proc 647 | } = await moddle.fromXML(xml, 'bpmn:UserTask'); 648 | 649 | // then 650 | expect(proc).to.jsonEqual({ 651 | $type: 'bpmn:UserTask', 652 | id: 'user-task-1', 653 | extensionElements: { 654 | $type: 'bpmn:ExtensionElements', 655 | values: [ 656 | { 657 | $type: 'zeebe:FormDefinition', 658 | externalReference: 'form-1' 659 | } 660 | ] 661 | } 662 | }); 663 | }); 664 | }); 665 | 666 | }); 667 | 668 | 669 | describe('zeebe:userTask', function() { 670 | 671 | it('should read', async function() { 672 | 673 | // given 674 | var xml = readFile('test/fixtures/xml/userTask-zeebe-userTask.part.bpmn'); 675 | 676 | // when 677 | const { 678 | rootElement: proc 679 | } = await moddle.fromXML(xml, 'bpmn:UserTask'); 680 | 681 | // then 682 | expect(proc).to.jsonEqual({ 683 | $type: 'bpmn:UserTask', 684 | id: 'user-task-1', 685 | extensionElements: { 686 | $type: 'bpmn:ExtensionElements', 687 | values: [ 688 | { 689 | $type: 'zeebe:UserTask' 690 | } 691 | ] 692 | } 693 | }); 694 | }); 695 | }); 696 | 697 | 698 | describe('zeebe:calledDecision', function() { 699 | 700 | it('on BusinessRuleTask', async function() { 701 | 702 | // given 703 | var xml = readFile('test/fixtures/xml/businessRuleTask-zeebe-calledDecision.part.bpmn'); 704 | 705 | // when 706 | const { 707 | rootElement: task 708 | } = await moddle.fromXML(xml, 'bpmn:BusinessRuleTask'); 709 | 710 | // then 711 | expect(task).to.jsonEqual({ 712 | $type: 'bpmn:BusinessRuleTask', 713 | id: 'business-rule-task-1', 714 | extensionElements: { 715 | $type: 'bpmn:ExtensionElements', 716 | values: [ 717 | { 718 | $type: 'zeebe:CalledDecision', 719 | decisionId: 'dishId', 720 | resultVariable: 'dishVariable' 721 | } 722 | ] 723 | } 724 | }); 725 | }); 726 | 727 | }); 728 | 729 | 730 | describe('zeebe:AssignmentDefinition', function() { 731 | 732 | it('on UserTask', async function() { 733 | 734 | // given 735 | var xml = readFile('test/fixtures/xml/userTask-zeebe-assignmentDefinition.part.bpmn'); 736 | 737 | // when 738 | const { 739 | rootElement: task 740 | } = await moddle.fromXML(xml, 'bpmn:UserTask'); 741 | 742 | // then 743 | expect(task).to.jsonEqual({ 744 | $type: 'bpmn:UserTask', 745 | id: 'user-task-1', 746 | extensionElements: { 747 | $type: 'bpmn:ExtensionElements', 748 | values: [ 749 | { 750 | $type: 'zeebe:AssignmentDefinition', 751 | assignee: '= ring.bearer', 752 | candidateGroups: 'elves, men, dwarfs, hobbits', 753 | candidateUsers: 'saruman, gandalf' 754 | } 755 | ] 756 | } 757 | }); 758 | }); 759 | 760 | }); 761 | 762 | 763 | describe('zeebe:PriorityDefinition', function() { 764 | 765 | it('on UserTask', async function() { 766 | 767 | // given 768 | var xml = readFile('test/fixtures/xml/userTask-zeebe-priority.part.bpmn'); 769 | 770 | // when 771 | const { 772 | rootElement: task 773 | } = await moddle.fromXML(xml, 'bpmn:UserTask'); 774 | 775 | // then 776 | expect(task).to.jsonEqual({ 777 | $type: 'bpmn:UserTask', 778 | id: 'user-task-1', 779 | extensionElements: { 780 | $type: 'bpmn:ExtensionElements', 781 | values: [ 782 | { 783 | $type: 'zeebe:PriorityDefinition', 784 | priority: '75' 785 | } 786 | ] 787 | } 788 | }); 789 | }); 790 | 791 | }); 792 | 793 | 794 | describe('zeebe:TaskSchedule', function() { 795 | 796 | it('on UserTask', async function() { 797 | 798 | // given 799 | var xml = readFile('test/fixtures/xml/userTask-zeebe-taskSchedule.part.bpmn'); 800 | 801 | // when 802 | const { 803 | rootElement: task 804 | } = await moddle.fromXML(xml, 'bpmn:UserTask'); 805 | 806 | // then 807 | expect(task).to.jsonEqual({ 808 | $type: 'bpmn:UserTask', 809 | id: 'user-task-1', 810 | extensionElements: { 811 | $type: 'bpmn:ExtensionElements', 812 | values: [ 813 | { 814 | $type: 'zeebe:TaskSchedule', 815 | dueDate: '2023-04-20T04:20:00Z', 816 | followUpDate: '=followUpDate' 817 | } 818 | ] 819 | } 820 | }); 821 | }); 822 | 823 | }); 824 | 825 | 826 | describe('zeebe:TemplateSupported', function() { 827 | 828 | describe('zeebe:modelerTemplate', function() { 829 | 830 | it('on Task', async function() { 831 | 832 | // given 833 | var xml = readFile('test/fixtures/xml/task-modelerTemplate.part.bpmn'); 834 | 835 | // when 836 | const { 837 | rootElement: task 838 | } = await moddle.fromXML(xml, 'bpmn:Task'); 839 | 840 | // then 841 | expect(task).to.jsonEqual({ 842 | $type: 'bpmn:Task', 843 | modelerTemplate: 'foo' 844 | }); 845 | }); 846 | 847 | }); 848 | 849 | 850 | describe('zeebe:modelerTemplateVersion', function() { 851 | 852 | it('on Task', async function() { 853 | 854 | // given 855 | var xml = readFile('test/fixtures/xml/task-modelerTemplateVersion.part.bpmn'); 856 | 857 | // when 858 | const { 859 | rootElement: task 860 | } = await moddle.fromXML(xml, 'bpmn:Task'); 861 | 862 | // then 863 | expect(task).to.jsonEqual({ 864 | $type: 'bpmn:Task', 865 | modelerTemplate: 'foo', 866 | modelerTemplateVersion: 1 867 | }); 868 | }); 869 | 870 | }); 871 | 872 | 873 | describe('zeebe:modelerTemplateIcon', function() { 874 | 875 | it('on Task', async function() { 876 | 877 | // given 878 | const xml = readFile('test/fixtures/xml/task-modelerTemplateIcon.part.bpmn'); 879 | 880 | // when 881 | const { 882 | rootElement: task 883 | } = await moddle.fromXML(xml, 'bpmn:Task'); 884 | 885 | // then 886 | expect(task).to.jsonEqual({ 887 | $type: 'bpmn:Task', 888 | modelerTemplate: 'foo', 889 | modelerTemplateVersion: 1, 890 | modelerTemplateIcon: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3C/svg%3E" 891 | }); 892 | }); 893 | 894 | }); 895 | 896 | }); 897 | 898 | 899 | describe('zeebe:TemplatedRootElement', function() { 900 | 901 | describe('zeebe:modelerTemplate', function() { 902 | 903 | it('on root elements', async function() { 904 | 905 | // given 906 | var xml = readFile('test/fixtures/xml/rootElement.bpmn'); 907 | 908 | // when 909 | const { 910 | rootElement: definitions 911 | } = await moddle.fromXML(xml, 'bpmn:Definitions'); 912 | 913 | // then 914 | expect(definitions).to.jsonEqual({ 915 | $type: 'bpmn:Definitions', 916 | targetNamespace: 'http://bpmn.io/schema/bpmn', 917 | rootElements: [ 918 | { 919 | $type: 'bpmn:Message', 920 | modelerTemplate: 'templateId' 921 | }, 922 | { 923 | $type: 'bpmn:Error', 924 | modelerTemplate: 'templateId' 925 | }, 926 | { 927 | $type: 'bpmn:Signal', 928 | modelerTemplate: 'templateId' 929 | }, 930 | { 931 | $type: 'bpmn:Escalation', 932 | modelerTemplate: 'templateId' 933 | } 934 | ] 935 | }); 936 | }); 937 | 938 | }); 939 | }); 940 | 941 | 942 | describe('zeebe:script', function() { 943 | 944 | it('on ScriptTask', async function() { 945 | 946 | // given 947 | var xml = readFile('test/fixtures/xml/scriptTask-zeebe-script.part.bpmn'); 948 | 949 | // when 950 | const { 951 | rootElement: task 952 | } = await moddle.fromXML(xml, 'bpmn:ScriptTask'); 953 | 954 | // then 955 | expect(task).to.jsonEqual({ 956 | $type: 'bpmn:ScriptTask', 957 | id: 'script-task-1', 958 | extensionElements: { 959 | $type: 'bpmn:ExtensionElements', 960 | values: [ 961 | { 962 | $type: 'zeebe:Script', 963 | expression: '=today()', 964 | resultVariable: 'result' 965 | } 966 | ] 967 | } 968 | }); 969 | }); 970 | 971 | }); 972 | 973 | 974 | describe('zeebe:ExecutionListener', function() { 975 | 976 | it('on Task', async function() { 977 | 978 | // given 979 | var xml = readFile('test/fixtures/xml/task-zeebe-executionListener.part.bpmn'); 980 | 981 | // when 982 | const { 983 | rootElement: task 984 | } = await moddle.fromXML(xml, 'bpmn:Task'); 985 | 986 | // then 987 | expect(task).to.jsonEqual({ 988 | $type: 'bpmn:Task', 989 | id: 'task-1', 990 | extensionElements: { 991 | $type: 'bpmn:ExtensionElements', 992 | values: [ 993 | { 994 | $type: 'zeebe:ExecutionListeners', 995 | listeners: [ 996 | { 997 | $type: 'zeebe:ExecutionListener', 998 | eventType: 'start', 999 | retries: '3', 1000 | type: 'sysout' 1001 | } 1002 | ] 1003 | } 1004 | ] 1005 | } 1006 | }); 1007 | }); 1008 | 1009 | 1010 | it('on Event', async function() { 1011 | 1012 | // given 1013 | var xml = readFile('test/fixtures/xml/event-zeebe-executionListener.part.bpmn'); 1014 | 1015 | // when 1016 | const { 1017 | rootElement: event 1018 | } = await moddle.fromXML(xml, 'bpmn:EndEvent'); 1019 | 1020 | // then 1021 | expect(event).to.jsonEqual({ 1022 | $type: 'bpmn:EndEvent', 1023 | id: 'endEvent-1', 1024 | extensionElements: { 1025 | $type: 'bpmn:ExtensionElements', 1026 | values: [ 1027 | { 1028 | $type: 'zeebe:ExecutionListeners', 1029 | listeners: [ 1030 | { 1031 | $type: 'zeebe:ExecutionListener', 1032 | eventType: 'start', 1033 | retries: '3', 1034 | type: 'sysout' 1035 | } 1036 | ] 1037 | } 1038 | ] 1039 | } 1040 | }); 1041 | }); 1042 | 1043 | 1044 | it('on Gateway', async function() { 1045 | 1046 | // given 1047 | var xml = readFile('test/fixtures/xml/gateway-zeebe-executionListener.part.bpmn'); 1048 | 1049 | // when 1050 | const { 1051 | rootElement: gateway 1052 | } = await moddle.fromXML(xml, 'bpmn:ExclusiveGateway'); 1053 | 1054 | // then 1055 | expect(gateway).to.jsonEqual({ 1056 | $type: 'bpmn:ExclusiveGateway', 1057 | id: 'exclusiveGateway-1', 1058 | extensionElements: { 1059 | $type: 'bpmn:ExtensionElements', 1060 | values: [ 1061 | { 1062 | $type: 'zeebe:ExecutionListeners', 1063 | listeners: [ 1064 | { 1065 | $type: 'zeebe:ExecutionListener', 1066 | eventType: 'start', 1067 | retries: '3', 1068 | type: 'sysout' 1069 | } 1070 | ] 1071 | } 1072 | ] 1073 | } 1074 | }); 1075 | }); 1076 | 1077 | }); 1078 | 1079 | 1080 | describe('zeebe:VersionTag', function() { 1081 | 1082 | it('on Process', async function() { 1083 | 1084 | // given 1085 | var xml = readFile('test/fixtures/xml/zeebe-versionTag.part.bpmn'); 1086 | 1087 | // when 1088 | const { 1089 | rootElement: task 1090 | } = await moddle.fromXML(xml, 'bpmn:Process'); 1091 | 1092 | // then 1093 | expect(task).to.jsonEqual({ 1094 | $type: 'bpmn:Process', 1095 | id: 'process-1', 1096 | extensionElements: { 1097 | $type: 'bpmn:ExtensionElements', 1098 | values: [ 1099 | { 1100 | $type: 'zeebe:VersionTag', 1101 | value: 'v1.0.0' 1102 | } 1103 | ] 1104 | } 1105 | }); 1106 | }); 1107 | 1108 | }); 1109 | 1110 | 1111 | describe('zeebe:BindingTypeSupported', function() { 1112 | 1113 | describe('zeebe:bindingType', function() { 1114 | 1115 | it('on zeebe:CalledDecision', async function() { 1116 | 1117 | // given 1118 | var xml = readFile('test/fixtures/xml/calledDecision-bindingType.part.bpmn'); 1119 | 1120 | // when 1121 | const { 1122 | rootElement: businessRuleTask 1123 | } = await moddle.fromXML(xml, 'bpmn:BusinessRuleTask'); 1124 | 1125 | // then 1126 | expect(businessRuleTask).to.jsonEqual({ 1127 | $type: 'bpmn:BusinessRuleTask', 1128 | id: 'BusinessRuleTask_1', 1129 | extensionElements: { 1130 | $type: 'bpmn:ExtensionElements', 1131 | values: [ 1132 | { 1133 | $type: 'zeebe:CalledDecision', 1134 | bindingType: 'deployment' 1135 | } 1136 | ] 1137 | } 1138 | }); 1139 | }); 1140 | 1141 | 1142 | it('on zeebe:CalledElement', async function() { 1143 | 1144 | // given 1145 | var xml = readFile('test/fixtures/xml/calledElement-bindingType.part.bpmn'); 1146 | 1147 | // when 1148 | const { 1149 | rootElement: callActivity 1150 | } = await moddle.fromXML(xml, 'bpmn:CallActivity'); 1151 | 1152 | // then 1153 | expect(callActivity).to.jsonEqual({ 1154 | $type: 'bpmn:CallActivity', 1155 | id: 'CallActivity_1', 1156 | extensionElements: { 1157 | $type: 'bpmn:ExtensionElements', 1158 | values: [ 1159 | { 1160 | $type: 'zeebe:CalledElement', 1161 | bindingType: 'deployment' 1162 | } 1163 | ] 1164 | } 1165 | }); 1166 | }); 1167 | 1168 | 1169 | it('on zeebe:FormDefinition', async function() { 1170 | 1171 | // given 1172 | var xml = readFile('test/fixtures/xml/formDefinition-bindingType.part.bpmn'); 1173 | 1174 | // when 1175 | const { 1176 | rootElement: userTask 1177 | } = await moddle.fromXML(xml, 'bpmn:UserTask'); 1178 | 1179 | // then 1180 | expect(userTask).to.jsonEqual({ 1181 | $type: 'bpmn:UserTask', 1182 | id: 'UserTask_1', 1183 | extensionElements: { 1184 | $type: 'bpmn:ExtensionElements', 1185 | values: [ 1186 | { 1187 | $type: 'zeebe:FormDefinition', 1188 | bindingType: 'deployment' 1189 | } 1190 | ] 1191 | } 1192 | }); 1193 | }); 1194 | 1195 | }); 1196 | 1197 | 1198 | describe('zeebe:versionTag', function() { 1199 | 1200 | it('on zeebe:CalledDecision', async function() { 1201 | 1202 | // given 1203 | var xml = readFile('test/fixtures/xml/calledDecision-versionTag.part.bpmn'); 1204 | 1205 | // when 1206 | const { 1207 | rootElement: businessRuleTask 1208 | } = await moddle.fromXML(xml, 'bpmn:BusinessRuleTask'); 1209 | 1210 | // then 1211 | expect(businessRuleTask).to.jsonEqual({ 1212 | $type: 'bpmn:BusinessRuleTask', 1213 | id: 'BusinessRuleTask_1', 1214 | extensionElements: { 1215 | $type: 'bpmn:ExtensionElements', 1216 | values: [ 1217 | { 1218 | $type: 'zeebe:CalledDecision', 1219 | bindingType: 'versionTag', 1220 | versionTag: 'v1.0.0' 1221 | } 1222 | ] 1223 | } 1224 | }); 1225 | }); 1226 | 1227 | 1228 | it('on zeebe:CalledElement', async function() { 1229 | 1230 | // given 1231 | var xml = readFile('test/fixtures/xml/calledElement-versionTag.part.bpmn'); 1232 | 1233 | // when 1234 | const { 1235 | rootElement: callActivity 1236 | } = await moddle.fromXML(xml, 'bpmn:CallActivity'); 1237 | 1238 | // then 1239 | expect(callActivity).to.jsonEqual({ 1240 | $type: 'bpmn:CallActivity', 1241 | id: 'CallActivity_1', 1242 | extensionElements: { 1243 | $type: 'bpmn:ExtensionElements', 1244 | values: [ 1245 | { 1246 | $type: 'zeebe:CalledElement', 1247 | bindingType: 'versionTag', 1248 | versionTag: 'v1.0.0' 1249 | } 1250 | ] 1251 | } 1252 | }); 1253 | }); 1254 | 1255 | 1256 | it('on zeebe:FormDefinition', async function() { 1257 | 1258 | // given 1259 | var xml = readFile('test/fixtures/xml/formDefinition-versionTag.part.bpmn'); 1260 | 1261 | // when 1262 | const { 1263 | rootElement: userTask 1264 | } = await moddle.fromXML(xml, 'bpmn:UserTask'); 1265 | 1266 | // then 1267 | expect(userTask).to.jsonEqual({ 1268 | $type: 'bpmn:UserTask', 1269 | id: 'UserTask_1', 1270 | extensionElements: { 1271 | $type: 'bpmn:ExtensionElements', 1272 | values: [ 1273 | { 1274 | $type: 'zeebe:FormDefinition', 1275 | bindingType: 'versionTag', 1276 | versionTag: 'v1.0.0' 1277 | } 1278 | ] 1279 | } 1280 | }); 1281 | }); 1282 | 1283 | }); 1284 | 1285 | }); 1286 | 1287 | 1288 | describe('zeebe:TaskListener', function() { 1289 | 1290 | it('on UserTask', async function() { 1291 | 1292 | // given 1293 | var xml = readFile('test/fixtures/xml/userTask-zeebe-taskListener.part.bpmn'); 1294 | 1295 | // when 1296 | const { 1297 | rootElement: task 1298 | } = await moddle.fromXML(xml, 'bpmn:UserTask'); 1299 | 1300 | // then 1301 | expect(task).to.jsonEqual({ 1302 | $type: 'bpmn:UserTask', 1303 | id: 'UserTask', 1304 | extensionElements: { 1305 | $type: 'bpmn:ExtensionElements', 1306 | values: [ 1307 | { 1308 | $type: 'zeebe:TaskListeners', 1309 | listeners: [ 1310 | { 1311 | $type: 'zeebe:TaskListener', 1312 | eventType: 'complete', 1313 | retries: '3', 1314 | type: 'complete_listener' 1315 | } 1316 | ] 1317 | } 1318 | ] 1319 | } 1320 | }); 1321 | }); 1322 | 1323 | }); 1324 | 1325 | 1326 | describe('zeebe:AdHoc', function() { 1327 | 1328 | it('on AdHocSubProcess', async function() { 1329 | 1330 | // given 1331 | var xml = readFile('test/fixtures/xml/adhoc-sub-process-zeebe-adHoc.bpmn'); 1332 | 1333 | // when 1334 | const { 1335 | rootElement: subprocess 1336 | } = await moddle.fromXML(xml, 'bpmn:AdHocSubProcess'); 1337 | 1338 | // then 1339 | expect(subprocess).to.jsonEqual({ 1340 | $type: 'bpmn:AdHocSubProcess', 1341 | id: 'AdHocSubProcess_1', 1342 | extensionElements: { 1343 | $type: 'bpmn:ExtensionElements', 1344 | values: [ 1345 | { 1346 | $type: 'zeebe:AdHoc', 1347 | activeElementsCollection: '=activeElements' 1348 | } 1349 | ] 1350 | } 1351 | }); 1352 | }); 1353 | 1354 | }); 1355 | 1356 | }); 1357 | 1358 | }); 1359 | -------------------------------------------------------------------------------- /test/spec/xml/roundtrip.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var readFile = require('../../helper').readFile, 4 | createModdle = require('../../helper').createModdle; 5 | 6 | 7 | describe('import -> export roundtrip', function() { 8 | 9 | function stripSpaces(xml) { 10 | return xml.replace(/\n|\r/g, '') 11 | .replace(/\s{2,}/g, ' ') 12 | .replace(/\s\/>/g, '/>') 13 | .replace(/>\s+<'); 14 | } 15 | 16 | function validateExport(file) { 17 | 18 | return async function() { 19 | 20 | // given 21 | var xml = readFile(file); 22 | 23 | var moddle = createModdle(); 24 | 25 | // when 26 | const { 27 | rootElement: definitions, 28 | warnings 29 | } = await moddle.fromXML(xml, 'bpmn:Definitions'); 30 | 31 | // then 32 | expect(warnings).to.be.empty; 33 | 34 | // but when 35 | const { 36 | xml: savedXML 37 | } = await moddle.toXML(definitions); 38 | 39 | // then 40 | expect(stripSpaces(savedXML)).to.eql(stripSpaces(xml)); 41 | }; 42 | } 43 | 44 | 45 | describe('Zeebe properties', function() { 46 | 47 | it('should keep Zeebe properties', validateExport('test/fixtures/xml/simple.bpmn')); 48 | 49 | }); 50 | 51 | 52 | it('should keep zeebe:properties', validateExport('test/fixtures/xml/zeebe-properties.bpmn')); 53 | 54 | 55 | it('should keep zeebe:modelerTemplate', validateExport('test/fixtures/xml/rootElement.bpmn')); 56 | 57 | 58 | describe('zeebe:UserTask', function() { 59 | 60 | it('should keep zeebe:formDefinition properties', validateExport('test/fixtures/xml/userTask-zeebe-formDefinition.bpmn')); 61 | 62 | }); 63 | 64 | 65 | describe('zeebe:ExecutionListeners', function() { 66 | 67 | it('should keep zeebe:executionListeners', validateExport('test/fixtures/xml/zeebe-execution-listeners.bpmn')); 68 | 69 | }); 70 | 71 | 72 | describe('zeebe:VersionTag', function() { 73 | 74 | it('should keep zeebe:versionTag', validateExport('test/fixtures/xml/zeebe-versionTag.bpmn')); 75 | 76 | }); 77 | 78 | 79 | describe('zeebe:BindingTypeSupported', function() { 80 | 81 | it('should keep zeebe:bindingType', validateExport('test/fixtures/xml/zeebe-bindingType.bpmn')); 82 | 83 | }); 84 | 85 | 86 | describe('zeebe:TaskListeners', function() { 87 | 88 | it('should keep zeebe:taskListeners', validateExport('test/fixtures/xml/zeebe-taskListeners.bpmn')); 89 | 90 | }); 91 | 92 | 93 | describe('zeebe:LinkedResource', function() { 94 | 95 | it('should keep zeebe:linkedResource', validateExport('test/fixtures/xml/zeebe-linkedResources.bpmn')); 96 | 97 | }); 98 | 99 | 100 | describe('zeebe:AdHoc', function() { 101 | 102 | it('should keep zeebe:adHoc', validateExport('test/fixtures/xml/zeebe-adHoc.bpmn')); 103 | 104 | }); 105 | 106 | }); 107 | -------------------------------------------------------------------------------- /test/spec/xml/write.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var assign = require('min-dash').assign, 4 | isFunction = require('min-dash').isFunction; 5 | 6 | var Helper = require('../../helper'); 7 | 8 | 9 | describe('write', function() { 10 | 11 | var moddle = Helper.createModdle(); 12 | 13 | 14 | async function write(element, options, callback) { 15 | if (isFunction(options)) { 16 | callback = options; 17 | options = {}; 18 | } 19 | 20 | // skip preamble for tests 21 | options = assign({ preamble: false }, options); 22 | 23 | const { xml } = await moddle.toXML(element, options); 24 | 25 | return xml; 26 | } 27 | 28 | 29 | describe('should export properties', function() { 30 | 31 | it('ServiceTask#retryCounter', async function() { 32 | 33 | // given 34 | var fieldElem = moddle.create('bpmn:ServiceTask', { 35 | retryCounter: 'text' 36 | }); 37 | 38 | var expectedXML = ''; 42 | 43 | // when 44 | const xml = await write(fieldElem); 45 | 46 | // then 47 | expect(xml).to.eql(expectedXML); 48 | }); 49 | 50 | 51 | it('SendTask#retryCounter', async function() { 52 | 53 | // given 54 | var fieldElem = moddle.create('bpmn:SendTask', { 55 | retryCounter: 'text' 56 | }); 57 | 58 | var expectedXML = ''; 62 | 63 | // when 64 | const xml = await write(fieldElem); 65 | 66 | // then 67 | expect(xml).to.eql(expectedXML); 68 | }); 69 | 70 | 71 | it('BusinessRuleTask#retryCounter', async function() { 72 | 73 | // given 74 | var fieldElem = moddle.create('bpmn:BusinessRuleTask', { 75 | retryCounter: 'text' 76 | }); 77 | 78 | var expectedXML = ''; 82 | 83 | // when 84 | const xml = await write(fieldElem); 85 | 86 | // then 87 | expect(xml).to.eql(expectedXML); 88 | }); 89 | 90 | 91 | it('ScriptTask#retryCounter', async function() { 92 | 93 | // given 94 | var fieldElem = moddle.create('bpmn:ScriptTask', { 95 | retryCounter: 'text' 96 | }); 97 | 98 | var expectedXML = ''; 102 | 103 | // when 104 | const xml = await write(fieldElem); 105 | 106 | // then 107 | expect(xml).to.eql(expectedXML); 108 | }); 109 | 110 | 111 | it('CalledElement#propagateAllChildVariables - true', async function() { 112 | 113 | // given 114 | var fieldElem = moddle.create('zeebe:CalledElement', { 115 | propagateAllChildVariables: true 116 | }); 117 | 118 | var expectedXML = ''; 121 | 122 | // when 123 | const xml = await write(fieldElem); 124 | 125 | // then 126 | expect(xml).to.eql(expectedXML); 127 | }); 128 | 129 | 130 | it('CalledElement#propagateAllChildVariables - false', async function() { 131 | 132 | // given 133 | var fieldElem = moddle.create('zeebe:CalledElement', { 134 | propagateAllChildVariables: false 135 | }); 136 | 137 | var expectedXML = ''; 140 | 141 | // when 142 | const xml = await write(fieldElem); 143 | 144 | // then 145 | expect(xml).to.eql(expectedXML); 146 | }); 147 | 148 | 149 | it('CalledElement#propagateAllParentVariables - true', async function() { 150 | 151 | // given 152 | var fieldElem = moddle.create('zeebe:CalledElement', { 153 | propagateAllParentVariables: true 154 | }); 155 | 156 | var expectedXML = ''; 158 | 159 | // when 160 | const xml = await write(fieldElem); 161 | 162 | // then 163 | expect(xml).to.eql(expectedXML); 164 | }); 165 | 166 | 167 | it('CalledElement#propagateAllParentVariables - false', async function() { 168 | 169 | // given 170 | var fieldElem = moddle.create('zeebe:CalledElement', { 171 | propagateAllParentVariables: false 172 | }); 173 | 174 | var expectedXML = ''; 177 | 178 | // when 179 | const xml = await write(fieldElem); 180 | 181 | // then 182 | expect(xml).to.eql(expectedXML); 183 | }); 184 | 185 | 186 | it('zeebe:userTaskForm', async function() { 187 | 188 | // given 189 | var proc = moddle.create('bpmn:Process', { 190 | extensionElements: moddle.create('bpmn:ExtensionElements', { 191 | values: [ 192 | moddle.create('zeebe:UserTaskForm', { 193 | id: 'userTaskForm-1', 194 | body: '{ components: [ { label: "field", key: "field" } ] }' 195 | }), 196 | moddle.create('zeebe:UserTaskForm', { 197 | id: 'userTaskForm-2', 198 | body: '{ components: [ { label: "", key: "field" } ] }' 199 | }) 200 | ] 201 | }) 202 | }); 203 | 204 | var expectedXML = 205 | '' + 207 | '' + 208 | '' + 209 | '{ components: [ { label: "field", key: "field" } ] }' + 210 | '' + 211 | '' + 212 | '{ components: [ { label: "<field>", key: "field" } ] }' + 213 | '' + 214 | '' + 215 | ''; 216 | 217 | // when 218 | const xml = await write(proc); 219 | 220 | // then 221 | expect(xml).to.eql(expectedXML); 222 | }); 223 | 224 | 225 | describe('zeebe:formDefinition', function() { 226 | 227 | it('zeebe:formKey', async function() { 228 | 229 | // given 230 | var proc = moddle.create('bpmn:UserTask', { 231 | extensionElements: moddle.create('bpmn:ExtensionElements', { 232 | values: [ 233 | moddle.create('zeebe:FormDefinition', { 234 | formKey: 'form-1' 235 | }) 236 | ] 237 | }) 238 | }); 239 | 240 | var expectedXML = 241 | '' + 243 | '' + 244 | '' + 245 | '' + 246 | ''; 247 | 248 | // when 249 | const xml = await write(proc); 250 | 251 | // then 252 | expect(xml).to.eql(expectedXML); 253 | }); 254 | 255 | 256 | it('zeebe:formId', async function() { 257 | 258 | // given 259 | var proc = moddle.create('bpmn:UserTask', { 260 | extensionElements: moddle.create('bpmn:ExtensionElements', { 261 | values: [ 262 | moddle.create('zeebe:FormDefinition', { 263 | formId: 'form-1' 264 | }) 265 | ] 266 | }) 267 | }); 268 | 269 | var expectedXML = 270 | '' + 272 | '' + 273 | '' + 274 | '' + 275 | ''; 276 | 277 | // when 278 | const xml = await write(proc); 279 | 280 | // then 281 | expect(xml).to.eql(expectedXML); 282 | }); 283 | 284 | 285 | it('zeebe:externalReference', async function() { 286 | 287 | // given 288 | var proc = moddle.create('bpmn:UserTask', { 289 | extensionElements: moddle.create('bpmn:ExtensionElements', { 290 | values: [ 291 | moddle.create('zeebe:FormDefinition', { 292 | externalReference: 'form-1' 293 | }) 294 | ] 295 | }) 296 | }); 297 | 298 | var expectedXML = 299 | '' + 301 | '' + 302 | '' + 303 | '' + 304 | ''; 305 | 306 | // when 307 | const xml = await write(proc); 308 | 309 | // then 310 | expect(xml).to.eql(expectedXML); 311 | }); 312 | }); 313 | 314 | 315 | it('zeebe:userTask', async function() { 316 | 317 | // given 318 | var userTask = moddle.create('zeebe:UserTask', {}); 319 | 320 | var expectedXML = ''; 322 | 323 | // when 324 | const xml = await write(userTask); 325 | 326 | // then 327 | expect(xml).to.eql(expectedXML); 328 | }); 329 | 330 | 331 | it('zeebe:calledDecision', async function() { 332 | 333 | // given 334 | var calledDecision = moddle.create('zeebe:CalledDecision', { 335 | decisionId: 'dishDecision', 336 | resultVariable: 'dishVariable' 337 | }); 338 | 339 | var expectedXML = ''; 343 | 344 | // when 345 | const xml = await write(calledDecision); 346 | 347 | // then 348 | expect(xml).to.eql(expectedXML); 349 | }); 350 | 351 | 352 | it('zeebe:AssignmentDefinition', async function() { 353 | 354 | // given 355 | var assignmentDefinition = moddle.create('zeebe:AssignmentDefinition', { 356 | assignee: 'myAssignee', 357 | candidateGroups: 'myCandidateGroup', 358 | candidateUsers: 'myCandidateUser' 359 | }); 360 | 361 | var expectedXML = ''; 366 | 367 | // when 368 | const xml = await write(assignmentDefinition); 369 | 370 | // then 371 | expect(xml).to.eql(expectedXML); 372 | }); 373 | 374 | 375 | it('zeebe:PriorityDefinition', async function() { 376 | 377 | // given 378 | var priority = moddle.create('zeebe:PriorityDefinition', { 379 | priority: '100' 380 | }); 381 | 382 | var expectedXML = ''; 385 | 386 | // when 387 | const xml = await write(priority); 388 | 389 | // then 390 | expect(xml).to.eql(expectedXML); 391 | 392 | }); 393 | 394 | 395 | it('zeebe:TaskSchedule', async function() { 396 | 397 | // given 398 | var taskSchedule = moddle.create('zeebe:TaskSchedule', { 399 | dueDate: '2023-04-20T04:20:00Z', 400 | followUpDate: '=followUpDate' 401 | }); 402 | 403 | var expectedXML = ''; 407 | 408 | // when 409 | const xml = await write(taskSchedule); 410 | 411 | // then 412 | expect(xml).to.eql(expectedXML); 413 | }); 414 | 415 | 416 | it('zeebe:modelerTemplate', async function() { 417 | 418 | // given 419 | const moddleElement = moddle.create('zeebe:ZeebeServiceTask', { 420 | modelerTemplate: 'foo' 421 | }); 422 | 423 | const expectedXML = ''; 426 | 427 | // when 428 | const xml = await write(moddleElement); 429 | 430 | // then 431 | expect(xml).to.eql(expectedXML); 432 | }); 433 | 434 | 435 | it('zeebe:modelerTemplate on root element', async function() { 436 | 437 | // given 438 | const moddleElement = moddle.create('bpmn:Message', { 439 | modelerTemplate: 'foo' 440 | }); 441 | 442 | const expectedXML = ''; 446 | 447 | // when 448 | const xml = await write(moddleElement); 449 | 450 | // then 451 | expect(xml).to.eql(expectedXML); 452 | }); 453 | 454 | 455 | it('zeebe:modelerTemplateVersion', async function() { 456 | 457 | // given 458 | const moddleElement = moddle.create('zeebe:ZeebeServiceTask', { 459 | modelerTemplateVersion: '12' 460 | }); 461 | 462 | const expectedXML = ''; 465 | 466 | // when 467 | const xml = await write(moddleElement); 468 | 469 | // then 470 | expect(xml).to.eql(expectedXML); 471 | }); 472 | 473 | 474 | it('zeebe:modelerTemplateIcon', async function() { 475 | 476 | // given 477 | const moddleElement = moddle.create('zeebe:ZeebeServiceTask', { 478 | modelerTemplateIcon: "data:image/svg+xml,%3Csvg xmlns=\"http://www.w3.org/2000/svg\" width='16' height='16'%3E%3C/svg%3E", 479 | }); 480 | 481 | const expectedXML = ''; 484 | 485 | // when 486 | const xml = await write(moddleElement); 487 | 488 | // then 489 | expect(xml).to.eql(expectedXML); 490 | }); 491 | 492 | 493 | it('zeebe:script', async function() { 494 | 495 | // given 496 | const moddleElement = moddle.create('zeebe:Script', { 497 | expression: '=today()', 498 | resultVariable: 'result' 499 | }); 500 | 501 | const expectedXML = ''; 504 | 505 | // when 506 | const xml = await write(moddleElement); 507 | 508 | // then 509 | expect(xml).to.eql(expectedXML); 510 | }); 511 | 512 | 513 | it('zeebe:ExecutionListeners', async function() { 514 | 515 | // given 516 | const moddleElement = moddle.create('zeebe:ExecutionListeners', { 517 | listeners: [ 518 | moddle.create('zeebe:ExecutionListener', { 519 | eventType: 'start', 520 | retries: '3', 521 | type: 'sysout' 522 | }) 523 | ] 524 | }); 525 | 526 | const expectedXML = '' + 528 | '' + 529 | ''; 530 | 531 | // when 532 | const xml = await write(moddleElement); 533 | 534 | // then 535 | expect(xml).to.eql(expectedXML); 536 | }); 537 | 538 | 539 | it('zeebe:VersionTag', async function() { 540 | 541 | // given 542 | const moddleElement = moddle.create('zeebe:VersionTag', { 543 | value: 'v1.0.0' 544 | }); 545 | 546 | const expectedXML = ''; 549 | 550 | // when 551 | const xml = await write(moddleElement); 552 | 553 | // then 554 | expect(xml).to.eql(expectedXML); 555 | }); 556 | 557 | 558 | describe('zeebe:BindingTypeSupported', function() { 559 | 560 | describe('zeebe:bindingType', function() { 561 | 562 | it('on zeebe:CalledDecision', async function() { 563 | 564 | // given 565 | const moddleElement = moddle.create('zeebe:CalledDecision', { 566 | bindingType: 'deployment' 567 | }); 568 | 569 | const expectedXML = ''; 572 | 573 | // when 574 | const xml = await write(moddleElement); 575 | 576 | // then 577 | expect(xml).to.eql(expectedXML); 578 | }); 579 | 580 | 581 | it('on zeebe:CalledElement', async function() { 582 | 583 | // given 584 | const moddleElement = moddle.create('zeebe:CalledElement', { 585 | bindingType: 'deployment' 586 | }); 587 | 588 | const expectedXML = ''; 591 | 592 | // when 593 | const xml = await write(moddleElement); 594 | 595 | // then 596 | expect(xml).to.eql(expectedXML); 597 | }); 598 | 599 | 600 | it('on zeebe:FormDefinition', async function() { 601 | 602 | // given 603 | const moddleElement = moddle.create('zeebe:FormDefinition', { 604 | bindingType: 'deployment' 605 | }); 606 | 607 | const expectedXML = ''; 610 | 611 | // when 612 | const xml = await write(moddleElement); 613 | 614 | // then 615 | expect(xml).to.eql(expectedXML); 616 | }); 617 | 618 | }); 619 | 620 | 621 | describe('zeebe:versionTag', function() { 622 | 623 | it('on zeebe:CalledDecision', async function() { 624 | 625 | // given 626 | const moddleElement = moddle.create('zeebe:CalledDecision', { 627 | bindingType: 'versionTag', 628 | versionTag: 'v1.0.0' 629 | }); 630 | 631 | const expectedXML = ''; 635 | 636 | // when 637 | const xml = await write(moddleElement); 638 | 639 | // then 640 | expect(xml).to.eql(expectedXML); 641 | }); 642 | 643 | 644 | it('on zeebe:CalledElement', async function() { 645 | 646 | // given 647 | const moddleElement = moddle.create('zeebe:CalledElement', { 648 | bindingType: 'versionTag', 649 | versionTag: 'v1.0.0' 650 | }); 651 | 652 | const expectedXML = ''; 656 | 657 | // when 658 | const xml = await write(moddleElement); 659 | 660 | // then 661 | expect(xml).to.eql(expectedXML); 662 | }); 663 | 664 | 665 | it('on zeebe:FormDefinition', async function() { 666 | 667 | // given 668 | const moddleElement = moddle.create('zeebe:FormDefinition', { 669 | bindingType: 'versionTag', 670 | versionTag: 'v1.0.0' 671 | }); 672 | 673 | const expectedXML = ''; 677 | 678 | // when 679 | const xml = await write(moddleElement); 680 | 681 | // then 682 | expect(xml).to.eql(expectedXML); 683 | }); 684 | 685 | 686 | it('on zeebe:LinkedResource', async function() { 687 | 688 | // given 689 | const moddleElement = moddle.create('zeebe:LinkedResource', { 690 | bindingType: 'versionTag', 691 | versionTag: 'v1.0.0' 692 | }); 693 | 694 | const expectedXML = ''; 698 | 699 | // when 700 | const xml = await write(moddleElement); 701 | 702 | // then 703 | expect(xml).to.eql(expectedXML); 704 | }); 705 | 706 | }); 707 | 708 | }); 709 | 710 | 711 | it('zeebe:TaskListeners', async function() { 712 | 713 | // given 714 | const moddleElement = moddle.create('zeebe:TaskListeners', { 715 | listeners: [ 716 | moddle.create('zeebe:TaskListener', { 717 | eventType: 'complete', 718 | retries: '1', 719 | type: 'complete_listener' 720 | }) 721 | ] 722 | }); 723 | 724 | const expectedXML = '' + 726 | '' + 727 | ''; 728 | 729 | // when 730 | const xml = await write(moddleElement); 731 | 732 | // then 733 | expect(xml).to.eql(expectedXML); 734 | }); 735 | 736 | 737 | it('zeebe:LinkedResource', async function() { 738 | 739 | // given 740 | const moddleElement = moddle.create('zeebe:LinkedResource', { 741 | resourceId:'=myScript', 742 | resourceType:'RPA', 743 | linkName:'myScript' }); 744 | 745 | const expectedXML = ''; 750 | 751 | // when 752 | const xml = await write(moddleElement); 753 | 754 | // then 755 | expect(xml).to.eql(expectedXML); 756 | }); 757 | 758 | 759 | it('zeebe:LinkedResources', async function() { 760 | 761 | // given 762 | const moddleElement = moddle.create('zeebe:LinkedResources'); 763 | 764 | const expectedXML = ''; 765 | 766 | // when 767 | const xml = await write(moddleElement); 768 | 769 | // then 770 | expect(xml).to.eql(expectedXML); 771 | }); 772 | 773 | it('zeebe:AdHoc', async function() { 774 | 775 | // given 776 | const moddleElement = moddle.create('zeebe:AdHoc', { activeElementsCollection: '= some collection' }); 777 | 778 | const expectedXML = ''; 779 | 780 | // when 781 | const xml = await write(moddleElement); 782 | 783 | // then 784 | expect(xml).to.eql(expectedXML); 785 | }); 786 | 787 | }); 788 | 789 | }); 790 | --------------------------------------------------------------------------------