Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/zeebe/util/feelUtility.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,9 @@ function getInfo(variable) {
}

if (!isNil(variable.atomicValue)) {
if (typeof variable.atomicValue === 'string') {
return JSON.stringify(variable.atomicValue);
}
return '' + variable.atomicValue;
}

Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
19 changes: 19 additions & 0 deletions test/fixtures/zeebe/ioMappings.context.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_18uyvm0" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.45.0-dev" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.8.0">
<bpmn:process id="Process_1" isExecutable="true">
<bpmn:serviceTask id="ServiceTask_1" name="ServiceTask_1">
<bpmn:extensionElements>
<zeebe:ioMapping>
<zeebe:input source="={ &#34;plain&#34;: &#34;hello&#34;, &#34;withNewlines&#34;: &#34;&#10;hello&#10;&#34;, &#34;withQuotes&#34;: &#34;\&#34;YES\&#34;\&#34;\&#34;&#34; }" target="contextWithStrings" />
</zeebe:ioMapping>
</bpmn:extensionElements>
</bpmn:serviceTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
<bpmndi:BPMNShape id="Activity_0scc5am_di" bpmnElement="ServiceTask_1">
<dc:Bounds x="160" y="120" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
16 changes: 8 additions & 8 deletions test/spec/zeebe/Mappings.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [] },
Expand All @@ -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: [] },
Expand Down Expand Up @@ -529,7 +529,7 @@ describe('ZeebeVariableResolver - Variable Mappings', function() {
{
name: 'resultVariable',
type: 'String',
info: '1'
info: '"1"'
}
]);
}));
Expand All @@ -548,7 +548,7 @@ describe('ZeebeVariableResolver - Variable Mappings', function() {
{
name: 'output',
type: 'String',
info: '2'
info: '"2"'
}
]);
}));
Expand All @@ -569,7 +569,7 @@ describe('ZeebeVariableResolver - Variable Mappings', function() {
{
name: 'foo',
type: 'String',
info: '1'
info: '"1"'
}
]);
}));
Expand All @@ -590,7 +590,7 @@ describe('ZeebeVariableResolver - Variable Mappings', function() {
{
name: 'foo',
type: 'String',
info: '2'
info: '"2"'
}
]);
}));
Expand All @@ -611,7 +611,7 @@ describe('ZeebeVariableResolver - Variable Mappings', function() {
{
name: 'foo',
type: 'String',
info: '2'
info: '"2"'
}
]);
}));
Expand All @@ -630,7 +630,7 @@ describe('ZeebeVariableResolver - Variable Mappings', function() {
{
name: 'foo',
type: 'String',
info: '2'
info: '"2"'
}
]);
}));
Expand Down
70 changes: 65 additions & 5 deletions test/spec/zeebe/ZeebeVariableResolver.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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\\"\\"\\""' }
]);

}));
Expand Down Expand Up @@ -2291,6 +2349,7 @@ describe('ZeebeVariableResolver', function() {
expect(variables).to.variableInclude({
name: 'outString',
type: 'String',
info: '"hello"',
scope: 'Process_varResolution'
});
}));
Expand All @@ -2308,6 +2367,7 @@ describe('ZeebeVariableResolver', function() {
expect(variables).to.variableInclude({
name: 'outCamundaString',
type: 'String',
info: '"\\nhello\\n"',
scope: 'Process_varResolution'
});
}));
Expand Down Expand Up @@ -2480,7 +2540,7 @@ describe('ZeebeVariableResolver', function() {
expect(variables).to.variableInclude({
name: 'pathDeepString',
type: 'String',
info: 'YES',
info: '"YES"',
scope: 'pathConsumerTask'
});
}));
Expand All @@ -2506,7 +2566,7 @@ describe('ZeebeVariableResolver', function() {
{
name: 'property',
type: 'String',
info: '10'
info: '"10"'
}
]
},
Expand Down Expand Up @@ -2628,4 +2688,4 @@ const createProvider = function({ variables, variableResolver, origin, delay = 0
return variables;
}
}(variableResolver);
};
};
Loading