diff --git a/lib/compiled-config.js b/lib/compiled-config.js index 83d209a..ce15eb1 100644 --- a/lib/compiled-config.js +++ b/lib/compiled-config.js @@ -54,12 +54,14 @@ const rules = { "camunda-compat/no-expression": "error", "camunda-compat/no-loop": "error", "camunda-compat/no-multiple-none-start-events": "error", + "camunda-compat/no-priority-definition": "error", "camunda-compat/no-propagate-all-parent-variables": "error", "camunda-compat/no-signal-event-sub-process": "error", "camunda-compat/no-task-schedule": "error", "camunda-compat/no-template": "error", "camunda-compat/no-zeebe-properties": "error", "camunda-compat/no-zeebe-user-task": "error", + "camunda-compat/priority-definition": "error", "camunda-compat/secrets": "warn", "camunda-compat/sequence-flow-condition": "error", "camunda-compat/signal-reference": "error", @@ -185,66 +187,74 @@ import rule_24 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-multi cache['bpmnlint-plugin-camunda-compat/no-multiple-none-start-events'] = rule_24; -import rule_25 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-propagate-all-parent-variables'; +import rule_25 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-priority-definition'; -cache['bpmnlint-plugin-camunda-compat/no-propagate-all-parent-variables'] = rule_25; +cache['bpmnlint-plugin-camunda-compat/no-priority-definition'] = rule_25; -import rule_26 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-signal-event-sub-process'; +import rule_26 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-propagate-all-parent-variables'; -cache['bpmnlint-plugin-camunda-compat/no-signal-event-sub-process'] = rule_26; +cache['bpmnlint-plugin-camunda-compat/no-propagate-all-parent-variables'] = rule_26; -import rule_27 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-task-schedule'; +import rule_27 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-signal-event-sub-process'; -cache['bpmnlint-plugin-camunda-compat/no-task-schedule'] = rule_27; +cache['bpmnlint-plugin-camunda-compat/no-signal-event-sub-process'] = rule_27; -import rule_28 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-template'; +import rule_28 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-task-schedule'; -cache['bpmnlint-plugin-camunda-compat/no-template'] = rule_28; +cache['bpmnlint-plugin-camunda-compat/no-task-schedule'] = rule_28; -import rule_29 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-zeebe-properties'; +import rule_29 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-template'; -cache['bpmnlint-plugin-camunda-compat/no-zeebe-properties'] = rule_29; +cache['bpmnlint-plugin-camunda-compat/no-template'] = rule_29; -import rule_30 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-zeebe-user-task'; +import rule_30 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-zeebe-properties'; -cache['bpmnlint-plugin-camunda-compat/no-zeebe-user-task'] = rule_30; +cache['bpmnlint-plugin-camunda-compat/no-zeebe-properties'] = rule_30; -import rule_31 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/secrets'; +import rule_31 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-zeebe-user-task'; -cache['bpmnlint-plugin-camunda-compat/secrets'] = rule_31; +cache['bpmnlint-plugin-camunda-compat/no-zeebe-user-task'] = rule_31; -import rule_32 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/sequence-flow-condition'; +import rule_32 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/priority-definition'; -cache['bpmnlint-plugin-camunda-compat/sequence-flow-condition'] = rule_32; +cache['bpmnlint-plugin-camunda-compat/priority-definition'] = rule_32; -import rule_33 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/signal-reference'; +import rule_33 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/secrets'; -cache['bpmnlint-plugin-camunda-compat/signal-reference'] = rule_33; +cache['bpmnlint-plugin-camunda-compat/secrets'] = rule_33; -import rule_34 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/start-event-form'; +import rule_34 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/sequence-flow-condition'; -cache['bpmnlint-plugin-camunda-compat/start-event-form'] = rule_34; +cache['bpmnlint-plugin-camunda-compat/sequence-flow-condition'] = rule_34; -import rule_35 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/subscription'; +import rule_35 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/signal-reference'; -cache['bpmnlint-plugin-camunda-compat/subscription'] = rule_35; +cache['bpmnlint-plugin-camunda-compat/signal-reference'] = rule_35; -import rule_36 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/task-schedule'; +import rule_36 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/start-event-form'; -cache['bpmnlint-plugin-camunda-compat/task-schedule'] = rule_36; +cache['bpmnlint-plugin-camunda-compat/start-event-form'] = rule_36; -import rule_37 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/timer'; +import rule_37 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/subscription'; -cache['bpmnlint-plugin-camunda-compat/timer'] = rule_37; +cache['bpmnlint-plugin-camunda-compat/subscription'] = rule_37; -import rule_38 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/user-task-definition'; +import rule_38 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/task-schedule'; -cache['bpmnlint-plugin-camunda-compat/user-task-definition'] = rule_38; +cache['bpmnlint-plugin-camunda-compat/task-schedule'] = rule_38; -import rule_39 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/user-task-form'; +import rule_39 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/timer'; -cache['bpmnlint-plugin-camunda-compat/user-task-form'] = rule_39; +cache['bpmnlint-plugin-camunda-compat/timer'] = rule_39; -import rule_40 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/wait-for-completion'; +import rule_40 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/user-task-definition'; -cache['bpmnlint-plugin-camunda-compat/wait-for-completion'] = rule_40; \ No newline at end of file +cache['bpmnlint-plugin-camunda-compat/user-task-definition'] = rule_40; + +import rule_41 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/user-task-form'; + +cache['bpmnlint-plugin-camunda-compat/user-task-form'] = rule_41; + +import rule_42 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/wait-for-completion'; + +cache['bpmnlint-plugin-camunda-compat/wait-for-completion'] = rule_42; \ No newline at end of file diff --git a/lib/utils/error-messages.js b/lib/utils/error-messages.js index bfd6bf3..6693247 100644 --- a/lib/utils/error-messages.js +++ b/lib/utils/error-messages.js @@ -324,6 +324,10 @@ function getExtensionElementNotAllowedErrorMessage(report, executionPlatform, ex return getSupportedMessage('A with or ', executionPlatform, executionPlatformVersion, allowedVersion); } + if (is(node, 'bpmn:UserTask') && is(extensionElement, 'zeebe:PriorityDefinition')) { + return getSupportedMessage('A with ', executionPlatform, executionPlatformVersion, allowedVersion); + } + if (is(node, 'bpmn:StartEvent') && is(extensionElement, 'zeebe:FormDefinition')) { return getSupportedMessage('A with ', executionPlatform, executionPlatformVersion, allowedVersion); } @@ -648,6 +652,10 @@ function getExpressionValueNotAllowedErrorMessage(report, executionPlatform, exe return `${ getIndefiniteArticle(typeString) } <${ typeString }> must be an ISO 8601 date`; } + if (is(node, 'zeebe:PriorityDefinition') && property === 'priority') { + return `${ getIndefiniteArticle(typeString) } <${ typeString }> must be an expression, or an integer between 0 and 100`; + } + return message; } diff --git a/lib/utils/properties-panel.js b/lib/utils/properties-panel.js index 1b16712..e0605ca 100644 --- a/lib/utils/properties-panel.js +++ b/lib/utils/properties-panel.js @@ -303,6 +303,14 @@ export function getEntryIds(report) { return ids; } + if (isExpressionValueNotAllowedError(data, 'priority', 'zeebe:PriorityDefinition')) { + return [ 'priorityDefinitionPriority' ]; + } + + if (isExtensionElementNotAllowedError(data, 'zeebe:PriorityDefinition', 'bpmn:UserTask')) { + return [ 'priorityDefinition' ]; + } + if (isPropertyError(data, 'propagateAllParentVariables', 'zeebe:CalledElement')) { return [ 'propagateAllParentVariables' ]; } @@ -533,6 +541,14 @@ export function getErrorMessage(id, report) { } } + if (id === 'priorityDefinitionPriority') { + if (type === ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED) { + return getNotSupportedMessage('', allowedVersion); + } else { + return 'Must be an expression, or an integer between 0 and 100.'; + } + } + if (id === 'propagateAllParentVariables') { return getNotSupportedMessage('', allowedVersion); } diff --git a/package-lock.json b/package-lock.json index c86869f..39275eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@bpmn-io/diagram-js-ui": "^0.2.3", "bpmn-moddle": "^9.0.1", "bpmnlint": "^10.3.0", - "bpmnlint-plugin-camunda-compat": "^2.23.0", + "bpmnlint-plugin-camunda-compat": "^2.24.0", "bpmnlint-utils": "^1.0.2", "camunda-bpmn-moddle": "^7.0.1", "clsx": "^2.0.0", @@ -20,12 +20,12 @@ "min-dom": "^5.1.1", "modeler-moddle": "^0.2.0", "semver-compare": "^1.0.0", - "zeebe-bpmn-moddle": "^1.4.0" + "zeebe-bpmn-moddle": "^1.5.1" }, "devDependencies": { "bpmn-js": "^17.9.0", "bpmn-js-element-templates": "^1.16.0", - "bpmn-js-properties-panel": "^5.21.0", + "bpmn-js-properties-panel": "^5.22.0", "camunda-bpmn-js-behaviors": "^1.5.0", "chai": "^4.4.1", "cross-env": "^7.0.3", @@ -1482,9 +1482,9 @@ } }, "node_modules/bpmn-js-properties-panel": { - "version": "5.21.0", - "resolved": "https://registry.npmjs.org/bpmn-js-properties-panel/-/bpmn-js-properties-panel-5.21.0.tgz", - "integrity": "sha512-W9mm0EftiRJqara+nDO7q5IhI7syXWmhmbyYv/fR8o9+KqOZJuj7zwg+WKxbZVCgCLRcyVgM96zEF10dTZO5Ug==", + "version": "5.22.0", + "resolved": "https://registry.npmjs.org/bpmn-js-properties-panel/-/bpmn-js-properties-panel-5.22.0.tgz", + "integrity": "sha512-U8fI4nYrFFWKjwD4sDh5VOc8pM5YCYYnWYjJabCPTZOPa8rBTrgKUjIK9boINc350TRTRrOm+0x175bQHPu0OQ==", "dev": true, "dependencies": { "@bpmn-io/extract-process-variables": "^0.8.0", @@ -1626,9 +1626,9 @@ } }, "node_modules/bpmnlint-plugin-camunda-compat": { - "version": "2.23.0", - "resolved": "https://registry.npmjs.org/bpmnlint-plugin-camunda-compat/-/bpmnlint-plugin-camunda-compat-2.23.0.tgz", - "integrity": "sha512-iTnwwMpNaY97gn3XPf0XaQeTS2phoRLZGk3ri7Pv9YEVkt4wvBkFgA5T1TYfsZcrm/3FHRGDAwS1T0pAtLH9fQ==", + "version": "2.24.0", + "resolved": "https://registry.npmjs.org/bpmnlint-plugin-camunda-compat/-/bpmnlint-plugin-camunda-compat-2.24.0.tgz", + "integrity": "sha512-2ehX5zv8Kj8GKwO7Bu+F8TciltFoLnKCtW1W0427TPj1EVJW5oilUDCP9DKQHQLM0Qa+y50LmlKI/mNE0DOKHw==", "dependencies": { "@bpmn-io/feel-lint": "^1.2.0", "@bpmn-io/moddle-utils": "^0.2.1", @@ -6620,9 +6620,9 @@ } }, "node_modules/zeebe-bpmn-moddle": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/zeebe-bpmn-moddle/-/zeebe-bpmn-moddle-1.4.0.tgz", - "integrity": "sha512-XSm0fMHPjQ5cmEGxga02du9arxb5NKH5ve7VQ0LFSes4wGcrZ/oJjaR3NlBqH6xTTD3g+Mcbh45+yesydPUQPg==" + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/zeebe-bpmn-moddle/-/zeebe-bpmn-moddle-1.5.1.tgz", + "integrity": "sha512-20dqDop32YdjqyVLZB3Vhh8oq+VKVcmOPNGRUkW6m1kJOtkR/abZSPdqiMtjY310tkagMS56ocZB2yW8itMOHQ==" }, "node_modules/zod": { "version": "3.23.8", @@ -7888,9 +7888,9 @@ } }, "bpmn-js-properties-panel": { - "version": "5.21.0", - "resolved": "https://registry.npmjs.org/bpmn-js-properties-panel/-/bpmn-js-properties-panel-5.21.0.tgz", - "integrity": "sha512-W9mm0EftiRJqara+nDO7q5IhI7syXWmhmbyYv/fR8o9+KqOZJuj7zwg+WKxbZVCgCLRcyVgM96zEF10dTZO5Ug==", + "version": "5.22.0", + "resolved": "https://registry.npmjs.org/bpmn-js-properties-panel/-/bpmn-js-properties-panel-5.22.0.tgz", + "integrity": "sha512-U8fI4nYrFFWKjwD4sDh5VOc8pM5YCYYnWYjJabCPTZOPa8rBTrgKUjIK9boINc350TRTRrOm+0x175bQHPu0OQ==", "dev": true, "requires": { "@bpmn-io/extract-process-variables": "^0.8.0", @@ -7982,9 +7982,9 @@ } }, "bpmnlint-plugin-camunda-compat": { - "version": "2.23.0", - "resolved": "https://registry.npmjs.org/bpmnlint-plugin-camunda-compat/-/bpmnlint-plugin-camunda-compat-2.23.0.tgz", - "integrity": "sha512-iTnwwMpNaY97gn3XPf0XaQeTS2phoRLZGk3ri7Pv9YEVkt4wvBkFgA5T1TYfsZcrm/3FHRGDAwS1T0pAtLH9fQ==", + "version": "2.24.0", + "resolved": "https://registry.npmjs.org/bpmnlint-plugin-camunda-compat/-/bpmnlint-plugin-camunda-compat-2.24.0.tgz", + "integrity": "sha512-2ehX5zv8Kj8GKwO7Bu+F8TciltFoLnKCtW1W0427TPj1EVJW5oilUDCP9DKQHQLM0Qa+y50LmlKI/mNE0DOKHw==", "requires": { "@bpmn-io/feel-lint": "^1.2.0", "@bpmn-io/moddle-utils": "^0.2.1", @@ -11630,9 +11630,9 @@ "dev": true }, "zeebe-bpmn-moddle": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/zeebe-bpmn-moddle/-/zeebe-bpmn-moddle-1.4.0.tgz", - "integrity": "sha512-XSm0fMHPjQ5cmEGxga02du9arxb5NKH5ve7VQ0LFSes4wGcrZ/oJjaR3NlBqH6xTTD3g+Mcbh45+yesydPUQPg==" + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/zeebe-bpmn-moddle/-/zeebe-bpmn-moddle-1.5.1.tgz", + "integrity": "sha512-20dqDop32YdjqyVLZB3Vhh8oq+VKVcmOPNGRUkW6m1kJOtkR/abZSPdqiMtjY310tkagMS56ocZB2yW8itMOHQ==" }, "zod": { "version": "3.23.8", diff --git a/package.json b/package.json index a6dc4de..fec1f0e 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@bpmn-io/diagram-js-ui": "^0.2.3", "bpmn-moddle": "^9.0.1", "bpmnlint": "^10.3.0", - "bpmnlint-plugin-camunda-compat": "^2.23.0", + "bpmnlint-plugin-camunda-compat": "^2.24.0", "bpmnlint-utils": "^1.0.2", "camunda-bpmn-moddle": "^7.0.1", "clsx": "^2.0.0", @@ -40,12 +40,12 @@ "min-dom": "^5.1.1", "modeler-moddle": "^0.2.0", "semver-compare": "^1.0.0", - "zeebe-bpmn-moddle": "^1.4.0" + "zeebe-bpmn-moddle": "^1.5.1" }, "devDependencies": { "bpmn-js": "^17.9.0", "bpmn-js-element-templates": "^1.16.0", - "bpmn-js-properties-panel": "^5.21.0", + "bpmn-js-properties-panel": "^5.22.0", "camunda-bpmn-js-behaviors": "^1.5.0", "chai": "^4.4.1", "cross-env": "^7.0.3", diff --git a/test/spec/utils/error-messages.spec.js b/test/spec/utils/error-messages.spec.js index 8f46924..71ae4d6 100644 --- a/test/spec/utils/error-messages.spec.js +++ b/test/spec/utils/error-messages.spec.js @@ -249,7 +249,6 @@ describe('utils/error-messages', function() { const errorMessage = getErrorMessage(report, 'Camunda Cloud', '8.3'); // then - console.log(errorMessage); expect(errorMessage).to.equal('A collapsed is only supported by Camunda 8.4 or newer'); }); @@ -426,6 +425,33 @@ describe('utils/error-messages', function() { }); + it('should adjust (user task with zeebe:PriorityDefinition)', async function() { + + // given + const executionPlatformVersion = '8.5'; + + const node = createElement('bpmn:UserTask', { + extensionElements: createElement('bpmn:ExtensionElements', { + values: [ + createElement('zeebe:PriorityDefinition', { + priority: '40' + }) + ] + }) + }); + + const { default: rule } = await import('bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-priority-definition'); + + const report = await getLintError(node, rule, { version: executionPlatformVersion }); + + // when + const errorMessage = getErrorMessage(report, 'Camunda Cloud', executionPlatformVersion); + + // then + expect(errorMessage).to.equal('A with is only supported by Camunda 8.6 or newer'); + }); + + it('should adjust (start event with zeebe:FormDefinition)', async function() { // given @@ -1751,6 +1777,33 @@ describe('utils/error-messages', function() { expect(errorMessage).to.equal('A must be an ISO 8601 date'); }); + + it('should adjust (priority)', async function() { + + // given + const executionPlatformVersion = '8.6'; + + const node = createElement('bpmn:UserTask', { + extensionElements: createElement('bpmn:ExtensionElements', { + values: [ + createElement('zeebe:PriorityDefinition', { + priority: 'foo' + }) + ] + }) + }); + + const { default: rule } = await import('bpmnlint-plugin-camunda-compat/rules/camunda-cloud/priority-definition'); + + const report = await getLintError(node, rule, { version: executionPlatformVersion }); + + // when + const errorMessage = getErrorMessage(report, 'Camunda Cloud', executionPlatformVersion); + + // then + expect(errorMessage).to.equal('A must be an expression, or an integer between 0 and 100'); + }); + }); diff --git a/test/spec/utils/properties-panel.spec.js b/test/spec/utils/properties-panel.spec.js index f674f9a..8a93f78 100644 --- a/test/spec/utils/properties-panel.spec.js +++ b/test/spec/utils/properties-panel.spec.js @@ -1722,6 +1722,33 @@ describe('utils/properties-panel', function() { }); + it('user task - Priority', async function() { + + // given + const node = createElement('bpmn:UserTask', { + extensionElements: createElement('bpmn:ExtensionElements', { + values: [ + createElement('zeebe:PriorityDefinition', { + priority: 'foo' + }) + ] + }) + }); + + const { default: rule } = await import('bpmnlint-plugin-camunda-compat/rules/camunda-cloud/priority-definition'); + + const report = await getLintError(node, rule); + + // when + const entryIds = getEntryIds(report); + + // then + expect(entryIds).to.eql([ 'priorityDefinitionPriority' ]); + + expectErrorMessage(entryIds[ 0 ], 'Must be an expression, or an integer between 0 and 100.', report); + }); + + it('call activity - Propagate all variables', async function() { // given