@emaarco/bpmn-js-data-simulation 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +59 -64
  2. package/dist/assets/bpmn-js-data-simulation.css +26 -1
  3. package/dist/domain/PathResolver.d.ts +9 -0
  4. package/dist/domain/PathResolver.d.ts.map +1 -0
  5. package/dist/domain/model.d.ts +20 -0
  6. package/dist/domain/model.d.ts.map +1 -1
  7. package/dist/engines/camunda7/Camunda7Engine.d.ts +4 -2
  8. package/dist/engines/camunda7/Camunda7Engine.d.ts.map +1 -1
  9. package/dist/engines/types.d.ts +4 -2
  10. package/dist/engines/types.d.ts.map +1 -1
  11. package/dist/engines/zeebe/ZeebeEngine.d.ts +4 -2
  12. package/dist/engines/zeebe/ZeebeEngine.d.ts.map +1 -1
  13. package/dist/index.cjs +181 -33
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.ts +3 -2
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +180 -34
  18. package/dist/index.js.map +1 -1
  19. package/dist/integration/DataGateways.d.ts +0 -1
  20. package/dist/integration/DataGateways.d.ts.map +1 -1
  21. package/dist/integration/DataSimulation.d.ts +2 -2
  22. package/dist/integration/DataSimulation.d.ts.map +1 -1
  23. package/dist/integration/IoMappings.d.ts.map +1 -1
  24. package/dist/integration/PathGraphReader.d.ts +13 -0
  25. package/dist/integration/PathGraphReader.d.ts.map +1 -0
  26. package/dist/integration/PathMarkers.d.ts +12 -0
  27. package/dist/integration/PathMarkers.d.ts.map +1 -0
  28. package/dist/integration/PathSimulation.d.ts +20 -0
  29. package/dist/integration/PathSimulation.d.ts.map +1 -0
  30. package/dist/integration/VariableUsageCollector.d.ts.map +1 -1
  31. package/dist/integration/index.d.ts +2 -2
  32. package/dist/integration/index.d.ts.map +1 -1
  33. package/dist/integration/tokenSimulation.d.ts +6 -0
  34. package/dist/integration/tokenSimulation.d.ts.map +1 -1
  35. package/dist/utils/diagramElements.d.ts +4 -0
  36. package/dist/utils/diagramElements.d.ts.map +1 -1
  37. package/package.json +13 -10
package/README.md CHANGED
@@ -1,98 +1,93 @@
1
1
  # @emaarco/bpmn-js-data-simulation
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/@emaarco/bpmn-js-data-simulation.svg)](https://www.npmjs.com/package/@emaarco/bpmn-js-data-simulation)
3
+ [![npm](https://img.shields.io/npm/v/@emaarco/bpmn-js-data-simulation)](https://www.npmjs.com/package/@emaarco/bpmn-js-data-simulation)
4
4
  [![CI](https://github.com/emaarco/bpmn-js-data-simulation/actions/workflows/ci.yml/badge.svg)](https://github.com/emaarco/bpmn-js-data-simulation/actions/workflows/ci.yml)
5
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/emaarco/bpmn-js-data-simulation/blob/main/LICENSE)
5
+ [![License: MIT](https://img.shields.io/github/license/emaarco/bpmn-js-data-simulation)](https://github.com/emaarco/bpmn-js-data-simulation/blob/main/LICENSE)
6
6
 
7
- An add-on for [bpmn-js-token-simulation](https://github.com/bpmn-io/bpmn-js-token-simulation) that runs BPMN
8
- processes **with data**: start variables, io mappings and gateway conditions, evaluated the way the
9
- engine would. No running engine, no clicking the path by hand.
7
+ [![A Bike Order process starts from a scenario, its gateways decide by the data and a card shows why "Credit OK?" took "yes"; then, in the demo's what-if panel, dragging the order total above 5,000 sends the path through the manual review](https://github.com/emaarco/bpmn-js-data-simulation/blob/main/docs/screenshots/simulation.gif)](https://emaarco.github.io/bpmn-js-data-simulation/)
10
8
 
11
- ![Starting a Zeebe process with a scenario, hovering gateways to see why they took their flow, and fixing a missing variable to continue a stuck token](https://raw.githubusercontent.com/emaarco/bpmn-js-data-simulation/main/docs/screenshots/simulation.gif)
9
+ **Show which path a process takes for real data, right in bpmn-js.**
10
+
11
+ An add-on for the bpmn-js token simulation whose gateways decide by their conditions, the way Zeebe or Camunda 7 would. Pre-1.0: a minor release may still change the API.
12
12
 
13
13
  ## Why
14
14
 
15
- The token simulation shows which paths a process _can_ take. Gateways pick their flow by click, and
16
- conditions, default flows and io mappings are ignored. That explains BPMN, but not _why_ a process
17
- takes a path, and checking a condition still needs a deployed process and a running engine.
15
+ Seeing the path a process takes for given data usually means deploying it. The token simulation needs no engine, but you click every gateway and it ignores conditions and mappings. This add-on evaluates them in the modeler, viewer or slide your readers see, within [known limits](https://github.com/emaarco/bpmn-js-data-simulation/blob/main/docs/how-it-works.md#limits).
18
16
 
19
- bpmn-js-data-simulation evaluates what the process is modeled with:
17
+ ## What you get
20
18
 
21
- - **Shows why a path is taken.** Gateways that decided turn green; hover one and a card lists its
22
- conditions, their results and the values they read. Click the gateway to keep the card open.
23
- - **What-if on the spot.** Start an instance from a scenario, change any value in the start dialog,
24
- or edit the variables of a running instance.
25
- - **Behaves like the engine.** Zeebe conditions and mappings are FEEL, Camunda 7 ones JUEL, with
26
- each engine's rules for task results and variables.
27
- - **Fails visibly.** When no flow matches or a condition fails, the token stops at the gateway and
28
- it turns red, as an incident would; its card tells why. Fix the data and continue.
29
- - **Drop-in.** One more module next to the token simulation, in any bpmn-js modeler or viewer. A
30
- **Data Simulation** switch next to the token simulation's own turns it off for the plain click-through.
19
+ - **See why a path is taken:** gateways that decided turn green, and a card lists each condition, its result and the values it read.
20
+ - **Show the path without running it:** `pathSimulation.simulate(variables)` marks the path the exclusive and inclusive gateways take, for example behind a slider, even in a plain viewer without the token simulation ([path simulation](https://github.com/emaarco/bpmn-js-data-simulation/blob/main/docs/usage.md#path-simulation-what-if)).
21
+ - **Start from a scenario:** the token simulation's ▶ opens a dialog prefilled from a [scenario file](https://github.com/emaarco/bpmn-js-data-simulation/blob/main/docs/scenarios.md) that also mocks task results.
22
+ - **Fail visibly:** if no flow matches or a condition fails, the token stops at a red gateway, like an incident.
23
+ - **Works in modelers and viewers:** one more module next to the token simulation.
31
24
 
32
- ## Install
25
+ ## Supported engines
33
26
 
34
- ```
35
- npm install @emaarco/bpmn-js-data-simulation
36
- ```
27
+ The `engine` option, `'zeebe'` by default, picks how conditions and mappings are read:
37
28
 
38
- `bpmn-js` (>= 18) and `bpmn-js-token-simulation` (`1.0.0`, pinned) are peer dependencies.
29
+ | Engine | `engine` | Conditions | Mappings |
30
+ | ------------------------------ | ------------ | ------------------------------------------------------------------------------------------------------- | --------------------- |
31
+ | Zeebe (Camunda 8) | `'zeebe'` | FEEL | `zeebe:ioMapping` |
32
+ | Camunda 7, Operaton, CIB seven | `'camunda7'` | [JUEL subset](https://github.com/emaarco/bpmn-js-data-simulation/blob/main/docs/engines.md#juel-subset) | `camunda:inputOutput` |
39
33
 
40
- ## Quick start
34
+ Conditions it cannot evaluate, such as JUEL method calls or scripts, fall back to a click and end the what-if path ([Engines](https://github.com/emaarco/bpmn-js-data-simulation/blob/main/docs/engines.md)).
41
35
 
42
- ```ts
43
- import BpmnModeler from 'bpmn-js/lib/Modeler'
44
- import TokenSimulationModule from 'bpmn-js-token-simulation'
45
- import DataSimulationModule from '@emaarco/bpmn-js-data-simulation'
46
- import zeebeModdle from 'zeebe-bpmn-moddle/resources/zeebe.json'
47
- import 'bpmn-js-token-simulation/assets/css/bpmn-js-token-simulation.css'
48
- import '@emaarco/bpmn-js-data-simulation/assets/bpmn-js-data-simulation.css'
36
+ ## Install
49
37
 
50
- const modeler = new BpmnModeler({
51
- container: '#canvas',
52
- additionalModules: [TokenSimulationModule, DataSimulationModule],
53
- moddleExtensions: { zeebe: zeebeModdle },
54
- dataSimulation: { engine: 'zeebe', scenarios },
55
- })
38
+ ```bash
39
+ npm install @emaarco/bpmn-js-data-simulation bpmn-js-token-simulation zeebe-bpmn-moddle
56
40
  ```
57
41
 
58
- Switch on the token simulation and press ▶ on a start event: a dialog asks for the start variables
59
- the process reads, prefilled from a scenario. The [demo](https://emaarco.github.io/bpmn-js-data-simulation/)
60
- runs Zeebe and Camunda 7 examples. Details: [usage](https://github.com/emaarco/bpmn-js-data-simulation/blob/main/docs/usage.md).
42
+ It needs `bpmn-js` 18 or newer; for Camunda 7, install `camunda-bpmn-moddle` instead of `zeebe-bpmn-moddle`. The full simulation needs `bpmn-js-token-simulation` in your own dependencies, as above; it is an optional peer, so npm does not add it for you.
61
43
 
62
- ## What it covers
44
+ For the path alone (`PathSimulationModule`), leave the token simulation out:
63
45
 
64
- | Step | What happens |
65
- | ---------------------------- | -------------------------------------------------------------------------------------- |
66
- | Start | ▶ opens a form with the variables the process reads; a scenario prefills it |
67
- | Tasks | Input and output mappings write process variables; task results come from the scenario |
68
- | Gateways | Exclusive and inclusive gateways evaluate their conditions, including the default flow |
69
- | No match or failed condition | The token waits at the gateway, marked red, until you fix the data |
70
- | Unsupported condition | The gateway keeps the token simulation's click |
71
- | Inspect | Gateway cards explain each decision; Process Data in the palette shows the variables |
46
+ ```bash
47
+ npm install @emaarco/bpmn-js-data-simulation zeebe-bpmn-moddle
48
+ ```
49
+
50
+ ## Get started
72
51
 
73
- ## Scenarios
52
+ 1. Register the module next to the token simulation:
74
53
 
75
- Named sets of start variables and mocked task results, in a JSON file next to the diagram.
54
+ ```ts
55
+ import BpmnModeler from 'bpmn-js/lib/Modeler'
56
+ import TokenSimulationModule from 'bpmn-js-token-simulation'
57
+ import DataSimulationModule from '@emaarco/bpmn-js-data-simulation'
58
+ import zeebeModdle from 'zeebe-bpmn-moddle/resources/zeebe.json'
59
+ import 'bpmn-js-token-simulation/assets/css/bpmn-js-token-simulation.css'
60
+ import '@emaarco/bpmn-js-data-simulation/assets/bpmn-js-data-simulation.css'
76
61
 
77
- Details: [scenarios](https://github.com/emaarco/bpmn-js-data-simulation/blob/main/docs/scenarios.md).
62
+ const modeler = new BpmnModeler({
63
+ container: '#canvas',
64
+ additionalModules: [TokenSimulationModule, DataSimulationModule],
65
+ moddleExtensions: { zeebe: zeebeModdle },
66
+ dataSimulation: { engine: 'zeebe' },
67
+ })
68
+ ```
78
69
 
79
- ## Zeebe and Camunda 7
70
+ For a viewer or Camunda 7, swap the imports as in [Usage](https://github.com/emaarco/bpmn-js-data-simulation/blob/main/docs/usage.md#set-up-the-modeler).
80
71
 
81
- `engine: 'zeebe'` reads `zeebe:ioMapping` and evaluates FEEL; `engine: 'camunda7'` reads
82
- `camunda:inputOutput` and evaluates a subset of JUEL (also for Operaton and CIB seven).
72
+ 2. Turn on the **Token Simulation** switch at the top left and press ▶ on a start event.
73
+ 3. Fill in the variables, start, and hover a gateway to see why it decided.
83
74
 
84
- Details: [engines](https://github.com/emaarco/bpmn-js-data-simulation/blob/main/docs/engines.md).
75
+ From code, `modeler.get('pathSimulation').simulate({ orderTotal: 6800 })` marks the path instead; a viewer with only `PathSimulationModule` does the same without the token simulation. Full walk-through: [Usage](https://github.com/emaarco/bpmn-js-data-simulation/blob/main/docs/usage.md).
85
76
 
86
- ## Documentation
77
+ ## Help and feedback
87
78
 
88
- - [Usage](https://github.com/emaarco/bpmn-js-data-simulation/blob/main/docs/usage.md): setup, start dialog, decision cards, Process Data and API
89
- - [Scenarios](https://github.com/emaarco/bpmn-js-data-simulation/blob/main/docs/scenarios.md): the scenario file and task results
90
- - [Engines](https://github.com/emaarco/bpmn-js-data-simulation/blob/main/docs/engines.md): Zeebe and Camunda 7 semantics, gateways, the JUEL subset
91
- - [How it works](https://github.com/emaarco/bpmn-js-data-simulation/blob/main/docs/how-it-works.md): how it plugs into the token simulation, decisions and limits
79
+ - **Documentation:** [Usage](https://github.com/emaarco/bpmn-js-data-simulation/blob/main/docs/usage.md), [Scenarios](https://github.com/emaarco/bpmn-js-data-simulation/blob/main/docs/scenarios.md), [Engines](https://github.com/emaarco/bpmn-js-data-simulation/blob/main/docs/engines.md) and [How it works](https://github.com/emaarco/bpmn-js-data-simulation/blob/main/docs/how-it-works.md).
80
+ - **Demo:** [emaarco.github.io/bpmn-js-data-simulation](https://emaarco.github.io/bpmn-js-data-simulation/).
81
+ - **Bugs and ideas:** [open an issue](https://github.com/emaarco/bpmn-js-data-simulation/issues).
92
82
 
93
83
  ## Contributing
94
84
 
95
- See [CONTRIBUTING.md](https://github.com/emaarco/bpmn-js-data-simulation/blob/main/CONTRIBUTING.md).
85
+ Contributions are welcome; see [CONTRIBUTING.md](https://github.com/emaarco/bpmn-js-data-simulation/blob/main/CONTRIBUTING.md).
86
+
87
+ ## Credits
88
+
89
+ - [bpmn-js-token-simulation](https://github.com/bpmn-io/bpmn-js-token-simulation) by bpmn.io moves the tokens.
90
+ - [feelin](https://github.com/nikku/feelin) evaluates FEEL.
96
91
 
97
92
  ## License
98
93
 
@@ -21,6 +21,8 @@
21
21
  --bds-danger-soft: rgba(201, 42, 42, 0.12);
22
22
  --bds-gateway-decided-fill: #e7f3ee;
23
23
  --bds-gateway-stuck-fill: #fbe9e9;
24
+ --bds-path-taken: var(--bds-accent);
25
+ --bds-path-skipped-opacity: 0.25;
24
26
 
25
27
  --bds-space-1: 4px;
26
28
  --bds-space-2: 8px;
@@ -67,6 +69,29 @@
67
69
  stroke-width: 3px !important;
68
70
  }
69
71
 
72
+ .djs-element.bds-path--taken,
73
+ .djs-element.bds-path--skipped {
74
+ transition: opacity var(--bds-motion-fast) var(--bds-ease);
75
+ }
76
+
77
+ .djs-element.bds-path--skipped {
78
+ opacity: var(--bds-path-skipped-opacity);
79
+ }
80
+
81
+ .djs-shape.bds-path--taken .djs-visual > :is(rect, circle, polygon) {
82
+ stroke: var(--bds-path-taken) !important;
83
+ }
84
+
85
+ .djs-connection.bds-path--taken .djs-visual > path {
86
+ stroke: var(--bds-path-taken) !important;
87
+ stroke-width: 2px !important;
88
+ }
89
+
90
+ .djs-element.bds-path--stuck .djs-visual > polygon {
91
+ fill: var(--bds-gateway-stuck-fill) !important;
92
+ stroke: var(--bds-danger) !important;
93
+ }
94
+
70
95
  .bds-palette-entry svg {
71
96
  width: 1em;
72
97
  height: 1em;
@@ -77,7 +102,7 @@
77
102
  stroke-linejoin: round;
78
103
  }
79
104
 
80
- .bds-palette-entry[hidden] {
105
+ .bts-palette .bds-palette-entry[hidden] {
81
106
  display: none;
82
107
  }
83
108
 
@@ -0,0 +1,9 @@
1
+ import { type EvaluateCondition } from './GatewayRouter.js';
2
+ import type { PathGraph, SimulatedPath } from './model.js';
3
+ export declare class PathResolver {
4
+ private readonly router;
5
+ resolve(graph: PathGraph, evaluateCondition: EvaluateCondition): SimulatedPath;
6
+ private leave;
7
+ private sumMeasures;
8
+ }
9
+ //# sourceMappingURL=PathResolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PathResolver.d.ts","sourceRoot":"","sources":["../../src/domain/PathResolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAiB,MAAM,oBAAoB,CAAA;AAC1E,OAAO,KAAK,EAAY,SAAS,EAA6B,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/F,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;IAE7C,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,iBAAiB,GAAG,aAAa;IA0B9E,OAAO,CAAC,KAAK;IAWb,OAAO,CAAC,WAAW;CAOpB"}
@@ -61,4 +61,24 @@ export interface StartFieldHints {
61
61
  examples?: Variables[];
62
62
  taskResultNames?: string[];
63
63
  }
64
+ export interface PathFlow extends OutgoingFlow {
65
+ targetId: string;
66
+ }
67
+ export interface PathNode {
68
+ id: string;
69
+ gatewayKind?: GatewayKind;
70
+ outgoing: PathFlow[];
71
+ nestedStartIds: string[];
72
+ measures: Record<string, number>;
73
+ }
74
+ export interface PathGraph {
75
+ startIds: string[];
76
+ nodes: PathNode[];
77
+ }
78
+ export interface SimulatedPath {
79
+ taken: string[];
80
+ skipped: string[];
81
+ decisions: Record<string, RoutingDecision>;
82
+ measures: Record<string, number>;
83
+ }
64
84
  //# sourceMappingURL=model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/domain/model.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAA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F,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAA;IACtB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;CAC3B;AAED,MAAM,WAAW,QAAS,SAAQ,YAAY;IAC5C,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,QAAQ,EAAE,QAAQ,EAAE,CAAA;IACpB,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjC;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,KAAK,EAAE,QAAQ,EAAE,CAAA;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAC1C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjC"}
@@ -6,8 +6,10 @@ export declare class Camunda7Engine implements EngineAdapter {
6
6
  readonly expressionLanguage = "JUEL";
7
7
  readonly taskResultPropagation: TaskResultPropagation;
8
8
  writeVariable(variables: Variables, target: string, value: unknown): Variables;
9
- readInputMappings(element: ModdleElement): Mapping[];
10
- readOutputMappings(element: ModdleElement): Mapping[];
9
+ readIoMappings(element: ModdleElement): {
10
+ inputs: Mapping[];
11
+ outputs: Mapping[];
12
+ };
11
13
  readCondition(sequenceFlow: ModdleElement): string | undefined;
12
14
  canEvaluate(expression: string): boolean;
13
15
  evaluate(expression: string, variables: Variables): Evaluation;
@@ -1 +1 @@
1
- {"version":3,"file":"Camunda7Engine.d.ts","sourceRoot":"","sources":["../../../src/engines/camunda7/Camunda7Engine.ts"],"names":[],"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Q,CAAC,qBAAqB,EAAE,qBAAqB,CAAW;IAEhE,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,SAAS;IAI9E,cAAc,CAAC,OAAO,EAAE,aAAa,GAAG;QAAE,MAAM,EAAE,OAAO,EAAE,CAAC;QAAC,OAAO,EAAE,OAAO,EAAE,CAAA;KAAE;IAOjF,aAAa,CAAC,YAAY,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS;IAM9D,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IASxC,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,UAAU;IAW9D,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE;IAQ/C,OAAO,CAAC,YAAY;CASrB"}
@@ -11,8 +11,10 @@ export interface EngineAdapter {
11
11
  expressionLanguage: string;
12
12
  taskResultPropagation: TaskResultPropagation;
13
13
  writeVariable(variables: Variables, target: string, value: unknown): Variables;
14
- readInputMappings(element: ModdleElement): Mapping[];
15
- readOutputMappings(element: ModdleElement): Mapping[];
14
+ readIoMappings(element: ModdleElement): {
15
+ inputs: Mapping[];
16
+ outputs: Mapping[];
17
+ };
16
18
  readCondition(sequenceFlow: ModdleElement): string | undefined;
17
19
  canEvaluate(expression: string): boolean;
18
20
  evaluate(expression: string, variables: Variables): Evaluation;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/engines/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAExE,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAA;AAE3C,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAA;CAC5B;AAED,MAAM,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AA;IAC5C,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,SAAS,CAAA;IAC9E,cAAc,CAAC,OAAO,EAAE,aAAa,GAAG;QAAE,MAAM,EAAE,OAAO,EAAE,CAAC;QAAC,OAAO,EAAE,OAAO,EAAE,CAAA;KAAE,CAAA;IACjF,aAAa,CAAC,YAAY,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS,CAAA;IAC9D,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAA;IACxC,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,UAAU,CAAA;IAC9D,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAChD"}
@@ -6,8 +6,10 @@ export declare class ZeebeEngine implements EngineAdapter {
6
6
  readonly expressionLanguage = "FEEL";
7
7
  readonly taskResultPropagation: TaskResultPropagation;
8
8
  writeVariable(variables: Variables, target: string, value: unknown): Variables;
9
- readInputMappings(element: ModdleElement): Mapping[];
10
- readOutputMappings(element: ModdleElement): Mapping[];
9
+ readIoMappings(element: ModdleElement): {
10
+ inputs: Mapping[];
11
+ outputs: Mapping[];
12
+ };
11
13
  readCondition(sequenceFlow: ModdleElement): string | undefined;
12
14
  canEvaluate(expression: string): boolean;
13
15
  evaluate(expression: string, variables: Variables): Evaluation;
@@ -1 +1 @@
1
- {"version":3,"file":"ZeebeEngine.d.ts","sourceRoot":"","sources":["../../../src/engines/zeebe/ZeebeEngine.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAG3E,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAItF,qBAAa,WAAY,YAAW,aAAa;IAC/C,QAAQ,CAAC,EAAE,WAAU;IACrB,QAAQ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,cAAc,CAAC,OAAO,EAAE,aAAa,GAAG;QAAE,MAAM,EAAE,OAAO,EAAE,CAAC;QAAC,OAAO,EAAE,OAAO,EAAE,CAAA;KAAE;IAOjF,aAAa,CAAC,YAAY,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS;IAI9D,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAIxC,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,UAAU;IAgB9D,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE;IAiB/C,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,QAAQ;CAGjB"}
package/dist/index.cjs CHANGED
@@ -605,11 +605,11 @@ class Camunda7Engine {
605
605
  writeVariable(variables, target, value) {
606
606
  return { ...variables, [target]: value };
607
607
  }
608
- readInputMappings(element) {
609
- return this.readMappings(element, "inputParameters");
610
- }
611
- readOutputMappings(element) {
612
- return this.readMappings(element, "outputParameters");
608
+ readIoMappings(element) {
609
+ return {
610
+ inputs: this.readMappings(element, "inputParameters"),
611
+ outputs: this.readMappings(element, "outputParameters")
612
+ };
613
613
  }
614
614
  readCondition(sequenceFlow) {
615
615
  const condition = readConditionExpression(sequenceFlow);
@@ -661,11 +661,11 @@ class ZeebeEngine {
661
661
  writeVariable(variables, target, value) {
662
662
  return setVariable(variables, target, value);
663
663
  }
664
- readInputMappings(element) {
665
- return this.readMappings(element, "inputParameters");
666
- }
667
- readOutputMappings(element) {
668
- return this.readMappings(element, "outputParameters");
664
+ readIoMappings(element) {
665
+ return {
666
+ inputs: this.readMappings(element, "inputParameters"),
667
+ outputs: this.readMappings(element, "outputParameters")
668
+ };
669
669
  }
670
670
  readCondition(sequenceFlow) {
671
671
  return readConditionExpression(sequenceFlow)?.body?.trim() || void 0;
@@ -1049,6 +1049,18 @@ function gatewayOf(element) {
1049
1049
  if (element.type === "bpmn:SequenceFlow" && element.source && isGateway(element.source)) return element.source.id;
1050
1050
  return void 0;
1051
1051
  }
1052
+ function outgoingSequenceFlows(element) {
1053
+ return (element.outgoing ?? []).filter((flow) => is(flow, "bpmn:SequenceFlow"));
1054
+ }
1055
+ function readOutgoingFlow(sequenceFlow, engine) {
1056
+ const name = sequenceFlow.businessObject.name;
1057
+ return {
1058
+ id: sequenceFlow.id,
1059
+ ...typeof name === "string" && name ? { name } : {},
1060
+ expression: engine.readCondition(sequenceFlow.businessObject),
1061
+ isDefault: sequenceFlow.source?.businessObject.default === sequenceFlow.businessObject
1062
+ };
1063
+ }
1052
1064
 
1053
1065
  class DataGateways {
1054
1066
  constructor(dataSimulation, store, simulator) {
@@ -1070,7 +1082,7 @@ class DataGateways {
1070
1082
  return;
1071
1083
  }
1072
1084
  for (const flowId of decision.takenFlowIds) {
1073
- const flow = this.sequenceFlows(gateway).find((candidate) => candidate.id === flowId);
1085
+ const flow = outgoingSequenceFlows(gateway).find((candidate) => candidate.id === flowId);
1074
1086
  this.simulator.enter({ element: flow, scope: scope.parent });
1075
1087
  }
1076
1088
  }
@@ -1128,19 +1140,7 @@ class DataGateways {
1128
1140
  }
1129
1141
  outgoingFlows(gateway) {
1130
1142
  const engine = this.dataSimulation.getEngine();
1131
- const defaultFlow = gateway.businessObject.default;
1132
- return this.sequenceFlows(gateway).map((flow) => {
1133
- const name = flow.businessObject.name;
1134
- return {
1135
- id: flow.id,
1136
- ...typeof name === "string" && name ? { name } : {},
1137
- expression: engine.readCondition(flow.businessObject),
1138
- isDefault: flow.businessObject === defaultFlow
1139
- };
1140
- });
1141
- }
1142
- sequenceFlows(gateway) {
1143
- return (gateway.outgoing ?? []).filter((flow) => is(flow, "bpmn:SequenceFlow"));
1143
+ return outgoingSequenceFlows(gateway).map((flow) => readOutgoingFlow(flow, engine));
1144
1144
  }
1145
1145
  }
1146
1146
  DataGateways.$inject = ["dataSimulation", "dataSimulationStore", "simulator"];
@@ -1151,8 +1151,7 @@ class IoMappings {
1151
1151
  this.store = store;
1152
1152
  }
1153
1153
  apply(element, instanceId) {
1154
- const inputs = this.engine.readInputMappings(element.businessObject);
1155
- const outputs = this.engine.readOutputMappings(element.businessObject);
1154
+ const { inputs, outputs } = this.engine.readIoMappings(element.businessObject);
1156
1155
  const taskResult = this.store.getTaskResult(instanceId, element.id);
1157
1156
  if (!inputs.length && !outputs.length && !taskResult) return;
1158
1157
  const processVariables = this.store.getVariables(instanceId);
@@ -1197,10 +1196,15 @@ const TRACE_EVENT = "tokenSimulation.simulator.trace";
1197
1196
  const DATA_TOGGLE_EVENT = "dataSimulation.toggle";
1198
1197
 
1199
1198
  class DataSimulation {
1200
- constructor(config, eventBus, store) {
1199
+ constructor(config, eventBus, store, injector) {
1201
1200
  this.eventBus = eventBus;
1202
1201
  this.store = store;
1203
1202
  this.scenarioParser = new ScenarioParser();
1203
+ if (!injector.get("simulator", false)) {
1204
+ throw new Error(
1205
+ "DataSimulationModule needs bpmn-js-token-simulation; for the path alone use PathSimulationModule"
1206
+ );
1207
+ }
1204
1208
  this.engine = new EngineRegistry().resolve(config?.engine ?? "zeebe");
1205
1209
  this.ioMappings = new IoMappings(this.engine, store);
1206
1210
  this.enabled = config?.enabled ?? true;
@@ -1263,7 +1267,7 @@ class DataSimulation {
1263
1267
  if (this.store.hasInstance(instanceId)) this.ioMappings.apply(element, instanceId);
1264
1268
  }
1265
1269
  }
1266
- DataSimulation.$inject = ["config.dataSimulation", "eventBus", "dataSimulationStore"];
1270
+ DataSimulation.$inject = ["config.dataSimulation", "eventBus", "dataSimulationStore", "injector"];
1267
1271
 
1268
1272
  class GatewayDecisionView {
1269
1273
  constructor(snapshot) {
@@ -1433,7 +1437,7 @@ function createSheet() {
1433
1437
 
1434
1438
  const OUTCOME_OVERLAY = "bds-flow-outcome";
1435
1439
  const DECIDED_MARKER = "bds-gateway--decided";
1436
- const STUCK_MARKER = "bds-gateway--stuck";
1440
+ const STUCK_MARKER$1 = "bds-gateway--stuck";
1437
1441
  const BADGE_DISTANCE = 38;
1438
1442
  const BADGE_MIN_SCALE = 1;
1439
1443
  class DataSimulationOverlays {
@@ -1488,13 +1492,13 @@ class DataSimulationOverlays {
1488
1492
  markGateway({ elementId, decision }) {
1489
1493
  const gateway = this.elementRegistry.get(elementId);
1490
1494
  if (!gateway) return;
1491
- this.canvas.addMarker(gateway, decision.stuckReason ? STUCK_MARKER : DECIDED_MARKER);
1495
+ this.canvas.addMarker(gateway, decision.stuckReason ? STUCK_MARKER$1 : DECIDED_MARKER);
1492
1496
  this.markedGateways.push(gateway);
1493
1497
  }
1494
1498
  unmarkGateways() {
1495
1499
  for (const gateway of this.markedGateways) {
1496
1500
  this.canvas.removeMarker(gateway, DECIDED_MARKER);
1497
- this.canvas.removeMarker(gateway, STUCK_MARKER);
1501
+ this.canvas.removeMarker(gateway, STUCK_MARKER$1);
1498
1502
  }
1499
1503
  this.markedGateways = [];
1500
1504
  }
@@ -1990,8 +1994,7 @@ class VariableUsageCollector {
1990
1994
  return this.usage(element.source ?? element, { conditionReads: this.engine.readVariableNames(condition) });
1991
1995
  }
1992
1996
  if (!is(element, "bpmn:FlowNode")) return void 0;
1993
- const inputs = this.engine.readInputMappings(businessObject);
1994
- const outputs = this.engine.readOutputMappings(businessObject);
1997
+ const { inputs, outputs } = this.engine.readIoMappings(businessObject);
1995
1998
  return this.usage(element, {
1996
1999
  inputReads: inputs.flatMap((mapping) => this.engine.readVariableNames(mapping.source)),
1997
2000
  inputTargets: inputs.map((mapping) => mapping.target),
@@ -2062,7 +2065,150 @@ class DataStartForm {
2062
2065
  }
2063
2066
  DataStartForm.$inject = ["config.dataSimulation", "eventBus", "dataSimulation", "dataSimulationStore"];
2064
2067
 
2068
+ class PathResolver {
2069
+ constructor() {
2070
+ this.router = new GatewayRouter();
2071
+ }
2072
+ resolve(graph, evaluateCondition) {
2073
+ const nodes = new Map(graph.nodes.map((node) => [node.id, node]));
2074
+ const takenIds = /* @__PURE__ */ new Set();
2075
+ const decisions = {};
2076
+ const pendingIds = [...graph.startIds];
2077
+ while (pendingIds.length) {
2078
+ const node = nodes.get(pendingIds.shift());
2079
+ if (!node || takenIds.has(node.id)) continue;
2080
+ takenIds.add(node.id);
2081
+ pendingIds.push(...node.nestedStartIds);
2082
+ for (const flow of this.leave(node, evaluateCondition, decisions)) {
2083
+ takenIds.add(flow.id);
2084
+ pendingIds.push(flow.targetId);
2085
+ }
2086
+ }
2087
+ const elementIds = graph.nodes.flatMap((node) => [node.id, ...node.outgoing.map((flow) => flow.id)]);
2088
+ return {
2089
+ taken: elementIds.filter((id) => takenIds.has(id)),
2090
+ skipped: elementIds.filter((id) => !takenIds.has(id)),
2091
+ decisions,
2092
+ measures: this.sumMeasures(graph.nodes.filter((node) => takenIds.has(node.id)))
2093
+ };
2094
+ }
2095
+ leave(node, evaluateCondition, decisions) {
2096
+ if (!node.gatewayKind || node.outgoing.length < 2) return node.outgoing;
2097
+ const decision = this.router.route(node.gatewayKind, node.outgoing, evaluateCondition);
2098
+ decisions[node.id] = decision;
2099
+ return node.outgoing.filter((flow) => decision.takenFlowIds.includes(flow.id));
2100
+ }
2101
+ sumMeasures(nodes) {
2102
+ const totals = {};
2103
+ for (const node of nodes) {
2104
+ for (const [name, value] of Object.entries(node.measures)) totals[name] = (totals[name] ?? 0) + value;
2105
+ }
2106
+ return totals;
2107
+ }
2108
+ }
2109
+
2110
+ const GATEWAY_KINDS = {
2111
+ "bpmn:ExclusiveGateway": "exclusive",
2112
+ "bpmn:InclusiveGateway": "inclusive"
2113
+ };
2114
+ class PathGraphReader {
2115
+ constructor(elementRegistry, engine) {
2116
+ this.elementRegistry = elementRegistry;
2117
+ this.engine = engine;
2118
+ }
2119
+ read(measureNames) {
2120
+ const flowNodes = this.elementRegistry.filter(
2121
+ (element) => element.id === element.businessObject.id && is(element, "bpmn:FlowNode")
2122
+ );
2123
+ const startEventsIn = (container) => flowNodes.filter((node) => is(node, "bpmn:StartEvent") && node.businessObject.$parent === container);
2124
+ const processStartIds = flowNodes.filter((node) => is(node, "bpmn:StartEvent") && this.isProcess(node.businessObject.$parent)).map((node) => node.id);
2125
+ return {
2126
+ startIds: processStartIds,
2127
+ nodes: flowNodes.map((node) => this.toPathNode(node, startEventsIn, measureNames))
2128
+ };
2129
+ }
2130
+ toPathNode(node, startEventsIn, measureNames) {
2131
+ const entersSubProcess = is(node, "bpmn:SubProcess") && !node.businessObject.triggeredByEvent;
2132
+ return {
2133
+ id: node.id,
2134
+ ...GATEWAY_KINDS[node.type] ? { gatewayKind: GATEWAY_KINDS[node.type] } : {},
2135
+ outgoing: outgoingSequenceFlows(node).map((flow) => ({
2136
+ ...readOutgoingFlow(flow, this.engine),
2137
+ targetId: flow.target.id
2138
+ })),
2139
+ nestedStartIds: entersSubProcess ? startEventsIn(node.businessObject).map((start) => start.id) : [],
2140
+ measures: Object.fromEntries(measureNames.map((name) => [name, this.readMeasure(node.businessObject, name)]))
2141
+ };
2142
+ }
2143
+ isProcess(element) {
2144
+ return element?.$type === "bpmn:Process";
2145
+ }
2146
+ readMeasure(businessObject, name) {
2147
+ const attribute = businessObject.$attrs?.[name];
2148
+ const value = typeof attribute === "string" && attribute.trim() ? Number(attribute) : Number.NaN;
2149
+ return Number.isFinite(value) ? value : 0;
2150
+ }
2151
+ }
2152
+
2153
+ const TAKEN_MARKER = "bds-path--taken";
2154
+ const SKIPPED_MARKER = "bds-path--skipped";
2155
+ const STUCK_MARKER = "bds-path--stuck";
2156
+ class PathMarkers {
2157
+ constructor(canvas, elementRegistry) {
2158
+ this.canvas = canvas;
2159
+ this.elementRegistry = elementRegistry;
2160
+ this.marked = [];
2161
+ }
2162
+ show(path) {
2163
+ this.clear();
2164
+ for (const id of path.taken) this.mark(id, TAKEN_MARKER);
2165
+ for (const id of path.skipped) this.mark(id, SKIPPED_MARKER);
2166
+ for (const [gatewayId, decision] of Object.entries(path.decisions)) {
2167
+ if (decision.stuckReason) this.mark(gatewayId, STUCK_MARKER);
2168
+ }
2169
+ }
2170
+ clear() {
2171
+ for (const { element, marker } of this.marked) this.canvas.removeMarker(element, marker);
2172
+ this.marked = [];
2173
+ }
2174
+ mark(id, marker) {
2175
+ const element = this.elementRegistry.get(id);
2176
+ if (!element) return;
2177
+ for (const markedElement of [element, ...element.labels ?? []]) {
2178
+ this.canvas.addMarker(markedElement, marker);
2179
+ this.marked.push({ element: markedElement, marker });
2180
+ }
2181
+ }
2182
+ }
2183
+
2184
+ class PathSimulation {
2185
+ constructor(config, elementRegistry, canvas) {
2186
+ this.pathResolver = new PathResolver();
2187
+ this.engine = new EngineRegistry().resolve(config?.engine ?? "zeebe");
2188
+ this.pathGraphReader = new PathGraphReader(elementRegistry, this.engine);
2189
+ this.pathMarkers = new PathMarkers(canvas, elementRegistry);
2190
+ }
2191
+ getEngine() {
2192
+ return this.engine;
2193
+ }
2194
+ simulate(variables, options = {}) {
2195
+ const graph = this.pathGraphReader.read(options.measures ?? []);
2196
+ const path = this.pathResolver.resolve(graph, (expression) => this.engine.evaluate(expression, variables));
2197
+ this.pathMarkers.show(path);
2198
+ return path;
2199
+ }
2200
+ clear() {
2201
+ this.pathMarkers.clear();
2202
+ }
2203
+ }
2204
+ PathSimulation.$inject = ["config.dataSimulation", "elementRegistry", "canvas"];
2205
+
2206
+ const PathSimulationModule = {
2207
+ __init__: [],
2208
+ pathSimulation: ["type", PathSimulation]
2209
+ };
2065
2210
  const DataSimulationModule = {
2211
+ __depends__: [PathSimulationModule],
2066
2212
  __init__: [
2067
2213
  "dataSimulation",
2068
2214
  "dataSimulationOverlays",
@@ -2085,9 +2231,11 @@ const DataSimulationModule = {
2085
2231
  };
2086
2232
 
2087
2233
  exports.Camunda7Engine = Camunda7Engine;
2234
+ exports.DataSimulationModule = DataSimulationModule;
2088
2235
  exports.DataSimulationStore = DataSimulationStore;
2089
2236
  exports.EngineRegistry = EngineRegistry;
2090
2237
  exports.GatewayRouter = GatewayRouter;
2238
+ exports.PathSimulationModule = PathSimulationModule;
2091
2239
  exports.ScenarioError = ScenarioError;
2092
2240
  exports.ScenarioParser = ScenarioParser;
2093
2241
  exports.SimpleStartFormRenderer = SimpleStartFormRenderer;