From b5cc6c5845e54ba7bd64c4de4b867a6686960b7c Mon Sep 17 00:00:00 2001 From: Ali Barin Date: Tue, 10 Mar 2026 16:40:50 +0100 Subject: [PATCH 1/3] test: assert JSON serialization for string variables --- test/fixtures/zeebe/ioMappings.context.bpmn | 19 +++++ test/spec/zeebe/Mappings.spec.js | 16 ++--- test/spec/zeebe/ZeebeVariableResolver.spec.js | 70 +++++++++++++++++-- 3 files changed, 92 insertions(+), 13 deletions(-) create mode 100644 test/fixtures/zeebe/ioMappings.context.bpmn diff --git a/test/fixtures/zeebe/ioMappings.context.bpmn b/test/fixtures/zeebe/ioMappings.context.bpmn new file mode 100644 index 0000000..ebb476b --- /dev/null +++ b/test/fixtures/zeebe/ioMappings.context.bpmn @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/test/spec/zeebe/Mappings.spec.js b/test/spec/zeebe/Mappings.spec.js index 1c4a6e8..2ece628 100644 --- a/test/spec/zeebe/Mappings.spec.js +++ b/test/spec/zeebe/Mappings.spec.js @@ -160,7 +160,7 @@ describe('ZeebeVariableResolver - Variable Mappings', function() { type: 'Context', info: '', entries: [ - { name: 'string', type: 'String', info: 'foo', entries: [] }, + { name: 'string', type: 'String', info: '"foo"', entries: [] }, { name: 'number', type: 'Number', info: '1', entries: [] }, { name: 'booleanTrue', type: 'Boolean', info: 'true', entries: [] }, { name: 'booleanFalse', type: 'Boolean', info: 'false', entries: [] }, @@ -186,7 +186,7 @@ describe('ZeebeVariableResolver - Variable Mappings', function() { detail: 'Context', info: '', entries: [ - { name: 'string', detail: 'String', info: 'foo', entries: [] }, + { name: 'string', detail: 'String', info: '"foo"', entries: [] }, { name: 'number', detail: 'Number', info: '1', entries: [] }, { name: 'booleanTrue', detail: 'Boolean', info: 'true', entries: [] }, { name: 'booleanFalse', detail: 'Boolean', info: 'false', entries: [] }, @@ -529,7 +529,7 @@ describe('ZeebeVariableResolver - Variable Mappings', function() { { name: 'resultVariable', type: 'String', - info: '1' + info: '"1"' } ]); })); @@ -548,7 +548,7 @@ describe('ZeebeVariableResolver - Variable Mappings', function() { { name: 'output', type: 'String', - info: '2' + info: '"2"' } ]); })); @@ -569,7 +569,7 @@ describe('ZeebeVariableResolver - Variable Mappings', function() { { name: 'foo', type: 'String', - info: '1' + info: '"1"' } ]); })); @@ -590,7 +590,7 @@ describe('ZeebeVariableResolver - Variable Mappings', function() { { name: 'foo', type: 'String', - info: '2' + info: '"2"' } ]); })); @@ -611,7 +611,7 @@ describe('ZeebeVariableResolver - Variable Mappings', function() { { name: 'foo', type: 'String', - info: '2' + info: '"2"' } ]); })); @@ -630,7 +630,7 @@ describe('ZeebeVariableResolver - Variable Mappings', function() { { name: 'foo', type: 'String', - info: '2' + info: '"2"' } ]); })); diff --git a/test/spec/zeebe/ZeebeVariableResolver.spec.js b/test/spec/zeebe/ZeebeVariableResolver.spec.js index f6e3536..3b86624 100644 --- a/test/spec/zeebe/ZeebeVariableResolver.spec.js +++ b/test/spec/zeebe/ZeebeVariableResolver.spec.js @@ -24,6 +24,7 @@ import connectorsSubProcessXML from 'test/fixtures/zeebe/connectors.sub-process. import connectorsOutputMappingXML from 'test/fixtures/zeebe/connectors.output-mapping.bpmn'; import ioMappingsXML from 'test/fixtures/zeebe/ioMappings.bpmn'; import ioMappingsStaticXML from 'test/fixtures/zeebe/ioMappings.static.bpmn'; +import ioMappingsContextXML from 'test/fixtures/zeebe/ioMappings.context.bpmn'; import ioMappingsEmptyXML from 'test/fixtures/zeebe/ioMappings.empty.bpmn'; import ioMappingsNullXML from 'test/fixtures/zeebe/ioMappings.null.bpmn'; import ioMappingsHierarchicalNamesXML from 'test/fixtures/zeebe/ioMappings.hierarchical-names.bpmn'; @@ -1941,6 +1942,63 @@ describe('ZeebeVariableResolver', function() { }); + describe('io mappings - context', function() { + + beforeEach( + bootstrapModeler(ioMappingsContextXML, { + additionalModules: [ + ZeebeVariableResolverModule + ], + moddleExtensions: { + zeebe: ZeebeModdle + } + }) + ); + + + it('should declare context with string entries', inject(async function(variableResolver, elementRegistry) { + + // given + const task = elementRegistry.get('ServiceTask_1'); + + // when + const variables = await variableResolver.getVariablesForElement(task); + + // then + expect(variables).to.variableEqual([ + { + name: 'contextWithStrings', + type: 'Context', + info: '', + scope: 'ServiceTask_1', + entries: [ + { + name: 'plain', + type: 'String', + entries: [], + info: '"hello"' + }, + { + name: 'withNewlines', + type: 'String', + entries: [], + info: '"\\nhello\\n"' + }, + { + name: 'withQuotes', + type: 'String', + entries: [], + info: '"\\"YES\\"\\"\\""' + } + ] + }, + ]); + + })); + + }); + + describe('io mappings - empty', function() { beforeEach( @@ -2037,8 +2095,8 @@ describe('ZeebeVariableResolver', function() { // then // filter own name, later input mappings + all output mappings expect(variables).to.variableEqual([ - { name: 'staticInput', type: 'String', scope: 'ServiceTask_1', info: 'YES' }, - { name: 'otherStaticInput', type: 'String', scope: 'ServiceTask_1', info: '"YES"""' } + { name: 'staticInput', type: 'String', scope: 'ServiceTask_1', info: '"YES"' }, + { name: 'otherStaticInput', type: 'String', scope: 'ServiceTask_1', info: '"\\"YES\\"\\"\\""' } ]); })); @@ -2291,6 +2349,7 @@ describe('ZeebeVariableResolver', function() { expect(variables).to.variableInclude({ name: 'outString', type: 'String', + info: '"hello"', scope: 'Process_varResolution' }); })); @@ -2308,6 +2367,7 @@ describe('ZeebeVariableResolver', function() { expect(variables).to.variableInclude({ name: 'outCamundaString', type: 'String', + info: '"\\nhello\\n"', scope: 'Process_varResolution' }); })); @@ -2480,7 +2540,7 @@ describe('ZeebeVariableResolver', function() { expect(variables).to.variableInclude({ name: 'pathDeepString', type: 'String', - info: 'YES', + info: '"YES"', scope: 'pathConsumerTask' }); })); @@ -2506,7 +2566,7 @@ describe('ZeebeVariableResolver', function() { { name: 'property', type: 'String', - info: '10' + info: '"10"' } ] }, @@ -2628,4 +2688,4 @@ const createProvider = function({ variables, variableResolver, origin, delay = 0 return variables; } }(variableResolver); -}; \ No newline at end of file +}; From 6cec14dbd665ea4cf81328393183d6d779b66f8f Mon Sep 17 00:00:00 2001 From: Ali Barin Date: Wed, 11 Mar 2026 23:00:43 +0100 Subject: [PATCH 2/3] fix: serialize string info values as JSON Related to #88 --- lib/zeebe/util/feelUtility.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/zeebe/util/feelUtility.js b/lib/zeebe/util/feelUtility.js index 3a4392f..7e55e4f 100644 --- a/lib/zeebe/util/feelUtility.js +++ b/lib/zeebe/util/feelUtility.js @@ -421,6 +421,9 @@ function getInfo(variable) { } if (!isNil(variable.atomicValue)) { + if (typeof variable.atomicValue === 'string') { + return JSON.stringify(variable.atomicValue); + } return '' + variable.atomicValue; } From d5f76c03979afcdfcd5813b585b16c4b098e11d3 Mon Sep 17 00:00:00 2001 From: Ali Barin Date: Mon, 16 Mar 2026 17:42:37 +0100 Subject: [PATCH 3/3] deps: update @bpmn-io/lezer-feel to 2.3.1 --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8ac35e0..5ac7d4d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "MIT", "dependencies": { "@bpmn-io/extract-process-variables": "^2.2.1", - "@bpmn-io/lezer-feel": "^2.3.0", + "@bpmn-io/lezer-feel": "^2.3.1", "@lezer/common": "^1.5.1", "min-dash": "^5.0.0" }, @@ -492,9 +492,9 @@ } }, "node_modules/@bpmn-io/lezer-feel": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@bpmn-io/lezer-feel/-/lezer-feel-2.3.0.tgz", - "integrity": "sha512-GU6UwiBZP2imXkDOXhNWdlBWCjZjDj0QcR+zEWRDK5jDHDFdN1wUZjOvYpZIKFpNJd3JRHY6uz3Ynqu/THn3gA==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@bpmn-io/lezer-feel/-/lezer-feel-2.3.1.tgz", + "integrity": "sha512-MNe3M7XUuUk0OvrIIXM0m7M2hNLouxPqJyqd6+XCDMy9dsan0zLA0vl7Cu8ypCbsAlViIGIvYdkjzZNiXd3gng==", "license": "MIT", "dependencies": { "@lezer/highlight": "^1.2.3", @@ -8999,9 +8999,9 @@ } }, "@bpmn-io/lezer-feel": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@bpmn-io/lezer-feel/-/lezer-feel-2.3.0.tgz", - "integrity": "sha512-GU6UwiBZP2imXkDOXhNWdlBWCjZjDj0QcR+zEWRDK5jDHDFdN1wUZjOvYpZIKFpNJd3JRHY6uz3Ynqu/THn3gA==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@bpmn-io/lezer-feel/-/lezer-feel-2.3.1.tgz", + "integrity": "sha512-MNe3M7XUuUk0OvrIIXM0m7M2hNLouxPqJyqd6+XCDMy9dsan0zLA0vl7Cu8ypCbsAlViIGIvYdkjzZNiXd3gng==", "requires": { "@lezer/highlight": "^1.2.3", "@lezer/lr": "^1.4.8", diff --git a/package.json b/package.json index fc20347..9395124 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "license": "MIT", "dependencies": { "@bpmn-io/extract-process-variables": "^2.2.1", - "@bpmn-io/lezer-feel": "^2.3.0", + "@bpmn-io/lezer-feel": "^2.3.1", "@lezer/common": "^1.5.1", "min-dash": "^5.0.0" },