@aranzatech/diagrams-bpmn 0.2.11 → 0.2.13
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.
- package/dist/{catalog-Ch3YT0-0.d.cts → catalog-BiLXVn-2.d.cts} +1 -1
- package/dist/{catalog-BOwJOaXV.d.ts → catalog-Di2nzGs9.d.ts} +1 -1
- package/dist/chunk-FBTGIYZS.js +218 -0
- package/dist/chunk-FBTGIYZS.js.map +1 -0
- package/dist/{chunk-HLCUGTEK.js → chunk-YUE5EM3W.js} +223 -35
- package/dist/chunk-YUE5EM3W.js.map +1 -0
- package/dist/elements/index.cjs +217 -0
- package/dist/elements/index.cjs.map +1 -1
- package/dist/elements/index.d.cts +15 -16
- package/dist/elements/index.d.ts +15 -16
- package/dist/elements/index.js +1 -1
- package/dist/guards-DPHXfpY8.d.cts +16 -0
- package/dist/guards-qgSeZEU4.d.ts +16 -0
- package/dist/index.cjs +221 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/layout/index.cjs +87 -0
- package/dist/layout/index.cjs.map +1 -1
- package/dist/layout/index.d.cts +22 -4
- package/dist/layout/index.d.ts +22 -4
- package/dist/layout/index.js +90 -2
- package/dist/layout/index.js.map +1 -1
- package/dist/modeling/index.d.cts +3 -3
- package/dist/modeling/index.d.ts +3 -3
- package/dist/{types-BTuiBv7p.d.cts → types-Dfrt0wVs.d.cts} +45 -1
- package/dist/{types-BTuiBv7p.d.ts → types-Dfrt0wVs.d.ts} +45 -1
- package/dist/{types-DSDMCAre.d.ts → types-rEfHsPr5.d.ts} +1 -1
- package/dist/{types-C7tONwP5.d.cts → types-s2_VvPGf.d.cts} +1 -1
- package/dist/validation/index.d.cts +2 -2
- package/dist/validation/index.d.ts +2 -2
- package/dist/xml/index.cjs +221 -33
- package/dist/xml/index.cjs.map +1 -1
- package/dist/xml/index.d.cts +3 -3
- package/dist/xml/index.d.ts +3 -3
- package/dist/xml/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-HLCUGTEK.js.map +0 -1
- package/dist/chunk-OZKTOILD.js +0 -3
- package/dist/chunk-OZKTOILD.js.map +0 -1
package/dist/layout/index.js
CHANGED
|
@@ -1,9 +1,97 @@
|
|
|
1
1
|
import { getBpmnNodeSize } from '../chunk-UAWLUDKC.js';
|
|
2
2
|
import '../chunk-RLAJNRF2.js';
|
|
3
3
|
import '../chunk-L5Z22RLX.js';
|
|
4
|
-
import { dagreLayout, applyLayoutResultToDiagram } from '@aranzatech/diagrams-core/layout';
|
|
4
|
+
import { elkLayout, dagreLayout, applyLayoutResultToDiagram } from '@aranzatech/diagrams-core/layout';
|
|
5
5
|
export { applyLayoutResultToDiagram } from '@aranzatech/diagrams-core/layout';
|
|
6
6
|
|
|
7
|
+
var BPMN_CONTAINER_TYPES = /* @__PURE__ */ new Set([
|
|
8
|
+
"Pool",
|
|
9
|
+
"Lane",
|
|
10
|
+
"SubProcess",
|
|
11
|
+
"Transaction",
|
|
12
|
+
"EventSubProcess",
|
|
13
|
+
"AdHocSubProcess"
|
|
14
|
+
]);
|
|
15
|
+
var CONTAINER_MIN_SIZE = {
|
|
16
|
+
Pool: { w: 560, h: 160 },
|
|
17
|
+
Lane: { w: 480, h: 100 },
|
|
18
|
+
SubProcess: { w: 200, h: 120 },
|
|
19
|
+
Transaction: { w: 200, h: 120 },
|
|
20
|
+
EventSubProcess: { w: 200, h: 120 },
|
|
21
|
+
AdHocSubProcess: { w: 200, h: 120 }
|
|
22
|
+
};
|
|
23
|
+
var CONTAINER_PADDING = {
|
|
24
|
+
Pool: "[top=30,left=55,bottom=30,right=40]",
|
|
25
|
+
Lane: "[top=25,left=60,bottom=25,right=40]",
|
|
26
|
+
SubProcess: "[top=25,left=35,bottom=25,right=35]",
|
|
27
|
+
Transaction: "[top=25,left=35,bottom=25,right=35]",
|
|
28
|
+
EventSubProcess: "[top=25,left=35,bottom=25,right=35]",
|
|
29
|
+
AdHocSubProcess: "[top=25,left=35,bottom=25,right=35]"
|
|
30
|
+
};
|
|
31
|
+
async function bpmnElkLayout(nodes, edges) {
|
|
32
|
+
const poolsWithLanes = /* @__PURE__ */ new Set();
|
|
33
|
+
for (const node of nodes) {
|
|
34
|
+
if (node.data.elementType === "Lane" && node.parentId) {
|
|
35
|
+
poolsWithLanes.add(node.parentId);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const result = await elkLayout(
|
|
39
|
+
nodes,
|
|
40
|
+
edges,
|
|
41
|
+
{
|
|
42
|
+
direction: "LR",
|
|
43
|
+
getNodeSize: (node) => {
|
|
44
|
+
const bNode = node;
|
|
45
|
+
if (BPMN_CONTAINER_TYPES.has(bNode.data.elementType)) return void 0;
|
|
46
|
+
return getBpmnNodeSize(bNode);
|
|
47
|
+
},
|
|
48
|
+
isContainerNode: (node) => BPMN_CONTAINER_TYPES.has(node.data.elementType),
|
|
49
|
+
getNodeLayoutOptions: (node) => {
|
|
50
|
+
const type = node.data.elementType;
|
|
51
|
+
if (!BPMN_CONTAINER_TYPES.has(type)) return void 0;
|
|
52
|
+
const min = CONTAINER_MIN_SIZE[type];
|
|
53
|
+
const dir = type === "Pool" && poolsWithLanes.has(node.id) ? "DOWN" : "RIGHT";
|
|
54
|
+
return {
|
|
55
|
+
"elk.direction": dir,
|
|
56
|
+
"elk.nodeSize.constraints": "MINIMUM_SIZE",
|
|
57
|
+
...min ? { "elk.nodeSize.minimum": `[w=${min.w},h=${min.h}]` } : {},
|
|
58
|
+
...CONTAINER_PADDING[type] ? { "elk.padding": CONTAINER_PADDING[type] } : {}
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
elk: {
|
|
62
|
+
"elk.algorithm": "layered",
|
|
63
|
+
"elk.direction": "RIGHT",
|
|
64
|
+
"elk.hierarchyHandling": "INCLUDE_CHILDREN",
|
|
65
|
+
"elk.edgeRouting": "ORTHOGONAL",
|
|
66
|
+
"elk.layered.spacing.nodeNodeBetweenLayers": "100",
|
|
67
|
+
"elk.layered.spacing.edgeNodeBetweenLayers": "40",
|
|
68
|
+
"elk.spacing.nodeNode": "60",
|
|
69
|
+
"elk.spacing.componentComponent": "80"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
const nodeMap = new Map(result.nodes.map((n) => [n.id, n]));
|
|
74
|
+
const edgeMap = new Map(result.edges.map((e) => [e.id, e]));
|
|
75
|
+
const updatedNodes = nodes.map((node) => {
|
|
76
|
+
const laid = nodeMap.get(node.id);
|
|
77
|
+
if (!laid) return node;
|
|
78
|
+
return { ...node, position: laid.position, width: laid.width, height: laid.height };
|
|
79
|
+
});
|
|
80
|
+
const updatedEdges = edges.map((edge) => {
|
|
81
|
+
const laid = edgeMap.get(edge.id);
|
|
82
|
+
if (!laid) return edge;
|
|
83
|
+
const nextData = { ...edge.data };
|
|
84
|
+
if (laid.points && laid.points.length > 0) {
|
|
85
|
+
nextData.routingPoints = laid.points;
|
|
86
|
+
} else {
|
|
87
|
+
delete nextData.routingPoints;
|
|
88
|
+
}
|
|
89
|
+
return { ...edge, data: nextData };
|
|
90
|
+
});
|
|
91
|
+
return { nodes: updatedNodes, edges: updatedEdges };
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// src/layout/index.ts
|
|
7
95
|
async function bpmnDagreLayout(nodes, edges, options = {}) {
|
|
8
96
|
return dagreLayout(nodes, edges, {
|
|
9
97
|
...options,
|
|
@@ -14,6 +102,6 @@ function applyBpmnLayoutResult(state, result) {
|
|
|
14
102
|
return applyLayoutResultToDiagram(state, result);
|
|
15
103
|
}
|
|
16
104
|
|
|
17
|
-
export { applyBpmnLayoutResult, bpmnDagreLayout };
|
|
105
|
+
export { applyBpmnLayoutResult, bpmnDagreLayout, bpmnElkLayout };
|
|
18
106
|
//# sourceMappingURL=index.js.map
|
|
19
107
|
//# sourceMappingURL=index.js.map
|
package/dist/layout/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/layout/index.ts"],"names":[],"mappings":";;;;;;AAcA,eAAsB,eAAA,CACpB,KAAA,EACA,KAAA,EACA,OAAA,GAAyB,EAAC,EACH;AACvB,EAAA,OAAO,WAAA,CAAY,OAAwB,KAAA,EAAwB;AAAA,IACjE,GAAG,OAAA;AAAA,IACH,WAAA,EAAa,CAAC,IAAA,KAAS,eAAA,CAAgB,IAAkB;AAAA,GAC1D,CAAA;AACH;AAMO,SAAS,qBAAA,CACd,OACA,MAAA,EACkB;AAClB,EAAA,OAAO,0BAAA,CAA2B,OAAO,MAAM,CAAA;AACjD","file":"index.js","sourcesContent":["import type { DiagramEdge, LayoutOptions, LayoutResult } from \"@aranzatech/diagrams-core/types\";\nimport { dagreLayout, applyLayoutResultToDiagram } from \"@aranzatech/diagrams-core/layout\";\nimport type { DiagramNode } from \"@aranzatech/diagrams-core/types\";\nimport type { BpmnRFNode, BpmnRFEdge } from \"../xml/types\";\nimport { getBpmnNodeSize } from \"../modeling\";\nimport type { BpmnDiagramState } from \"../modeling\";\n\nexport { applyLayoutResultToDiagram };\n\n/**\n * Dagre layout pre-configured for BPMN diagrams.\n * Uses BPMN-specific node sizes (events 52×52, gateways 64×64, tasks 192×64, etc.)\n * instead of the generic fallback, which prevents overlaps and poor spacing.\n */\nexport async function bpmnDagreLayout(\n nodes: BpmnRFNode[],\n edges: BpmnRFEdge[],\n options: LayoutOptions = {},\n): Promise<LayoutResult> {\n return dagreLayout(nodes as DiagramNode[], edges as DiagramEdge[], {\n ...options,\n getNodeSize: (node) => getBpmnNodeSize(node as BpmnRFNode),\n });\n}\n\n/**\n * Applies a bpmn dagre layout result back to the diagram state.\n * Convenience wrapper so callers only need one import.\n */\nexport function applyBpmnLayoutResult(\n state: BpmnDiagramState,\n result: LayoutResult,\n): BpmnDiagramState {\n return applyLayoutResultToDiagram(state, result) as BpmnDiagramState;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/layout/elk.ts","../../src/layout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O;AACL,MAAA,OAAO,QAAA,CAAS,aAAA;AAAA,IAClB;AACA,IAAA,OAAO,EAAE,GAAG,IAAA,EAAM,IAAA,EAAM,QAAA,EAAS;AAAA,EACnC,CAAC,CAAA;AAED,EAAA,OAAO,EAAE,KAAA,EAAO,YAAA,EAAc,KAAA,EAAO,YAAA,EAA6B;AACpE;;;AC3GA,eAAsB,eAAA,CACpB,KAAA,EACA,KAAA,EACA,OAAA,GAAyB,EAAC,EACH;AACvB,EAAA,OAAO,WAAA,CAAY,OAAwB,KAAA,EAAwB;AAAA,IACjE,GAAG,OAAA;AAAA,IACH,WAAA,EAAa,CAAC,IAAA,KAAS,eAAA,CAAgB,IAAkB;AAAA,GAC1D,CAAA;AACH;AAMO,SAAS,qBAAA,CACd,OACA,MAAA,EACkB;AAClB,EAAA,OAAO,0BAAA,CAA2B,OAAO,MAAM,CAAA;AACjD","file":"index.js","sourcesContent":["import { elkLayout } from \"@aranzatech/diagrams-core/layout\";\nimport type { DiagramNode, DiagramEdge } from \"@aranzatech/diagrams-core/types\";\nimport type { BpmnRFNode, BpmnRFEdge } from \"../xml/types\";\nimport type { BpmnElementType } from \"../elements/types\";\nimport { getBpmnNodeSize } from \"../modeling\";\n\n// Container types that ELK auto-sizes based on their children.\nconst BPMN_CONTAINER_TYPES = new Set<BpmnElementType>([\n \"Pool\",\n \"Lane\",\n \"SubProcess\",\n \"Transaction\",\n \"EventSubProcess\",\n \"AdHocSubProcess\",\n]);\n\nconst CONTAINER_MIN_SIZE: Partial<Record<BpmnElementType, { w: number; h: number }>> = {\n Pool: { w: 560, h: 160 },\n Lane: { w: 480, h: 100 },\n SubProcess: { w: 200, h: 120 },\n Transaction: { w: 200, h: 120 },\n EventSubProcess: { w: 200, h: 120 },\n AdHocSubProcess: { w: 200, h: 120 },\n};\n\n// Left padding: label strip (≈30 px) + breathing room before first node.\nconst CONTAINER_PADDING: Partial<Record<BpmnElementType, string>> = {\n Pool: \"[top=30,left=55,bottom=30,right=40]\",\n Lane: \"[top=25,left=60,bottom=25,right=40]\",\n SubProcess: \"[top=25,left=35,bottom=25,right=35]\",\n Transaction: \"[top=25,left=35,bottom=25,right=35]\",\n EventSubProcess: \"[top=25,left=35,bottom=25,right=35]\",\n AdHocSubProcess: \"[top=25,left=35,bottom=25,right=35]\",\n};\n\n/**\n * ELK-based auto-layout for BPMN diagrams.\n *\n * Direction policy — always LEFT-TO-RIGHT to match screen anatomy:\n * - Root: RIGHT — free nodes and pools flow LR on the canvas.\n * - Pool that contains Lanes: DOWN internally so lanes stack top-to-bottom\n * (standard horizontal-pool anatomy); the pool itself is still placed LR.\n * - Pool without lanes, Lane, SubProcess, Transaction, AdHoc: RIGHT — content\n * flows left-to-right inside the container.\n * - All edges get ORTHOGONAL routing in a single INCLUDE_CHILDREN pass so\n * cross-pool and cross-lane edges are routed correctly.\n * - Containers auto-resize to fit their children.\n */\nexport async function bpmnElkLayout(\n nodes: BpmnRFNode[],\n edges: BpmnRFEdge[],\n): Promise<{ nodes: BpmnRFNode[]; edges: BpmnRFEdge[] }> {\n // Pools that contain at least one Lane child need DOWN internal direction so\n // the lanes stack vertically (standard horizontal BPMN pool).\n const poolsWithLanes = new Set<string>();\n for (const node of nodes) {\n if (node.data.elementType === \"Lane\" && node.parentId) {\n poolsWithLanes.add(node.parentId);\n }\n }\n\n const result = await elkLayout(\n nodes as unknown as DiagramNode[],\n edges as unknown as DiagramEdge[],\n {\n direction: \"LR\",\n getNodeSize: (node) => {\n const bNode = node as unknown as BpmnRFNode;\n if (BPMN_CONTAINER_TYPES.has(bNode.data.elementType)) return undefined;\n return getBpmnNodeSize(bNode);\n },\n isContainerNode: (node) =>\n BPMN_CONTAINER_TYPES.has((node as unknown as BpmnRFNode).data.elementType),\n getNodeLayoutOptions: (node) => {\n const type = (node as unknown as BpmnRFNode).data.elementType;\n if (!BPMN_CONTAINER_TYPES.has(type)) return undefined;\n const min = CONTAINER_MIN_SIZE[type];\n // Pool with Lanes: DOWN so lanes stack top-to-bottom inside the pool.\n // Everything else (Lane content, SubProcess, free tasks): RIGHT (LR).\n const dir = type === \"Pool\" && poolsWithLanes.has(node.id) ? \"DOWN\" : \"RIGHT\";\n return {\n \"elk.direction\": dir,\n \"elk.nodeSize.constraints\": \"MINIMUM_SIZE\",\n ...(min ? { \"elk.nodeSize.minimum\": `[w=${min.w},h=${min.h}]` } : {}),\n ...(CONTAINER_PADDING[type] ? { \"elk.padding\": CONTAINER_PADDING[type] } : {}),\n };\n },\n elk: {\n \"elk.algorithm\": \"layered\",\n \"elk.direction\": \"RIGHT\",\n \"elk.hierarchyHandling\": \"INCLUDE_CHILDREN\",\n \"elk.edgeRouting\": \"ORTHOGONAL\",\n \"elk.layered.spacing.nodeNodeBetweenLayers\": \"100\",\n \"elk.layered.spacing.edgeNodeBetweenLayers\": \"40\",\n \"elk.spacing.nodeNode\": \"60\",\n \"elk.spacing.componentComponent\": \"80\",\n },\n },\n );\n\n const nodeMap = new Map(result.nodes.map((n) => [n.id, n]));\n const edgeMap = new Map(result.edges.map((e) => [e.id, e]));\n\n const updatedNodes = nodes.map((node) => {\n const laid = nodeMap.get(node.id);\n if (!laid) return node;\n return { ...node, position: laid.position, width: laid.width, height: laid.height };\n });\n\n const updatedEdges = edges.map((edge) => {\n const laid = edgeMap.get(edge.id);\n if (!laid) return edge;\n const nextData = { ...edge.data };\n if (laid.points && laid.points.length > 0) {\n nextData.routingPoints = laid.points;\n } else {\n delete nextData.routingPoints;\n }\n return { ...edge, data: nextData };\n });\n\n return { nodes: updatedNodes, edges: updatedEdges as BpmnRFEdge[] };\n}\n","import type { DiagramEdge, LayoutOptions, LayoutResult } from \"@aranzatech/diagrams-core/types\";\nimport { dagreLayout, applyLayoutResultToDiagram } from \"@aranzatech/diagrams-core/layout\";\nimport type { DiagramNode } from \"@aranzatech/diagrams-core/types\";\nimport type { BpmnRFNode, BpmnRFEdge } from \"../xml/types\";\nimport { getBpmnNodeSize } from \"../modeling\";\nimport type { BpmnDiagramState } from \"../modeling\";\n\nexport { applyLayoutResultToDiagram };\nexport { bpmnElkLayout } from \"./elk\";\n\n/**\n * Dagre layout pre-configured for BPMN diagrams.\n * Uses BPMN-specific node sizes (events 52×52, gateways 64×64, tasks 192×64, etc.)\n * instead of the generic fallback, which prevents overlaps and poor spacing.\n */\nexport async function bpmnDagreLayout(\n nodes: BpmnRFNode[],\n edges: BpmnRFEdge[],\n options: LayoutOptions = {},\n): Promise<LayoutResult> {\n return dagreLayout(nodes as DiagramNode[], edges as DiagramEdge[], {\n ...options,\n getNodeSize: (node) => getBpmnNodeSize(node as BpmnRFNode),\n });\n}\n\n/**\n * Applies a bpmn dagre layout result back to the diagram state.\n * Convenience wrapper so callers only need one import.\n */\nexport function applyBpmnLayoutResult(\n state: BpmnDiagramState,\n result: LayoutResult,\n): BpmnDiagramState {\n return applyLayoutResultToDiagram(state, result) as BpmnDiagramState;\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ModelingRules, ClipboardState, DiagramSnapshot, DiagramState, DiagramEventBus, ResizeHandlePosition, DiagramCommand, ConnectionValidator, SmartGuideResult, SelectionState, LayoutCacheOptions, LayoutCache, EdgeLabelOffsetOptions, EdgeLabelLayout, CommandStackState, Viewport, LayoutFn } from '@aranzatech/diagrams-core';
|
|
2
2
|
import { DiagramDocument, CreateDiagramDocumentOptions } from '@aranzatech/diagrams-core/serialization';
|
|
3
|
-
import { c as BpmnEdgeType, b as BpmnEdgeData, f as BpmnElementType, m as BpmnNodeData } from '../types-
|
|
4
|
-
import { d as BpmnRFNode, c as BpmnRFEdge } from '../types-
|
|
5
|
-
export { g as getBpmnElementSize, i as isBpmnElementResizable } from '../catalog-
|
|
3
|
+
import { c as BpmnEdgeType, b as BpmnEdgeData, f as BpmnElementType, m as BpmnNodeData } from '../types-Dfrt0wVs.cjs';
|
|
4
|
+
import { d as BpmnRFNode, c as BpmnRFEdge } from '../types-s2_VvPGf.cjs';
|
|
5
|
+
export { g as getBpmnElementSize, i as isBpmnElementResizable } from '../catalog-BiLXVn-2.cjs';
|
|
6
6
|
import '@xyflow/react';
|
|
7
7
|
|
|
8
8
|
type BpmnDiagramState = DiagramState<BpmnRFNode, BpmnRFEdge>;
|
package/dist/modeling/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ModelingRules, ClipboardState, DiagramSnapshot, DiagramState, DiagramEventBus, ResizeHandlePosition, DiagramCommand, ConnectionValidator, SmartGuideResult, SelectionState, LayoutCacheOptions, LayoutCache, EdgeLabelOffsetOptions, EdgeLabelLayout, CommandStackState, Viewport, LayoutFn } from '@aranzatech/diagrams-core';
|
|
2
2
|
import { DiagramDocument, CreateDiagramDocumentOptions } from '@aranzatech/diagrams-core/serialization';
|
|
3
|
-
import { c as BpmnEdgeType, b as BpmnEdgeData, f as BpmnElementType, m as BpmnNodeData } from '../types-
|
|
4
|
-
import { d as BpmnRFNode, c as BpmnRFEdge } from '../types-
|
|
5
|
-
export { g as getBpmnElementSize, i as isBpmnElementResizable } from '../catalog-
|
|
3
|
+
import { c as BpmnEdgeType, b as BpmnEdgeData, f as BpmnElementType, m as BpmnNodeData } from '../types-Dfrt0wVs.js';
|
|
4
|
+
import { d as BpmnRFNode, c as BpmnRFEdge } from '../types-rEfHsPr5.js';
|
|
5
|
+
export { g as getBpmnElementSize, i as isBpmnElementResizable } from '../catalog-Di2nzGs9.js';
|
|
6
6
|
import '@xyflow/react';
|
|
7
7
|
|
|
8
8
|
type BpmnDiagramState = DiagramState<BpmnRFNode, BpmnRFEdge>;
|
|
@@ -166,14 +166,54 @@ interface BpmnNodeData extends Record<string, unknown> {
|
|
|
166
166
|
script?: string;
|
|
167
167
|
/** BusinessRuleTask: id of the referenced DMN decision table. */
|
|
168
168
|
decisionRef?: string;
|
|
169
|
+
/** BusinessRuleTask: simplified inline decision table (alternative to external decisionRef). */
|
|
170
|
+
inlineDecisionTable?: InlineDecisionTable;
|
|
169
171
|
/** UserTask: form key resolved to a FormDefinition by name at runtime. */
|
|
170
172
|
formKey?: string;
|
|
171
173
|
/** UserTask: comma-separated Flowable user ids that can claim this task. */
|
|
172
174
|
candidateUsers?: string;
|
|
173
175
|
/** UserTask: comma-separated Flowable group ids that can claim this task. */
|
|
174
176
|
candidateGroups?: string;
|
|
177
|
+
/** UserTask: ISO-8601 due date or FEEL expression evaluated at task creation. */
|
|
178
|
+
dueDate?: string;
|
|
179
|
+
/** UserTask: FEEL expression; when truthy the task is skipped. */
|
|
180
|
+
skipExpression?: string;
|
|
181
|
+
/** UserTask: name of the business calendar used to compute the due date. */
|
|
182
|
+
businessCalendarName?: string;
|
|
183
|
+
/** DataObjectReference: id of the backing bpmn:DataObject element. */
|
|
184
|
+
dataObjectRef?: string;
|
|
175
185
|
/** AdHocSubProcess: FEEL expression that determines when the sub-process completes. */
|
|
176
186
|
completionCondition?: string;
|
|
187
|
+
/** Loop / multi-instance type: none | loop | sequentialMultiple | parallelMultiple. */
|
|
188
|
+
loopType?: string;
|
|
189
|
+
/** StandardLoopCharacteristics: FEEL condition evaluated before each iteration. */
|
|
190
|
+
loopCondition?: string;
|
|
191
|
+
/** MultiInstanceLoopCharacteristics: number of instances as a FEEL expression. */
|
|
192
|
+
loopCardinality?: string;
|
|
193
|
+
/** MultiInstanceLoopCharacteristics: FEEL condition to stop before all instances finish. */
|
|
194
|
+
loopCompletionCondition?: string;
|
|
195
|
+
}
|
|
196
|
+
interface InlineDecisionInput {
|
|
197
|
+
id: string;
|
|
198
|
+
expression: string;
|
|
199
|
+
label: string;
|
|
200
|
+
}
|
|
201
|
+
interface InlineDecisionOutput {
|
|
202
|
+
id: string;
|
|
203
|
+
name: string;
|
|
204
|
+
label: string;
|
|
205
|
+
}
|
|
206
|
+
interface InlineDecisionRule {
|
|
207
|
+
id: string;
|
|
208
|
+
inputs: Record<string, string>;
|
|
209
|
+
outputs: Record<string, string>;
|
|
210
|
+
annotation?: string;
|
|
211
|
+
}
|
|
212
|
+
interface InlineDecisionTable {
|
|
213
|
+
hitPolicy: "FIRST" | "UNIQUE" | "COLLECT";
|
|
214
|
+
inputs: InlineDecisionInput[];
|
|
215
|
+
outputs: InlineDecisionOutput[];
|
|
216
|
+
rules: InlineDecisionRule[];
|
|
177
217
|
}
|
|
178
218
|
interface BpmnEdgeData extends Record<string, unknown> {
|
|
179
219
|
label?: string;
|
|
@@ -190,6 +230,10 @@ interface BpmnEdgeData extends Record<string, unknown> {
|
|
|
190
230
|
x: number;
|
|
191
231
|
y: number;
|
|
192
232
|
}>;
|
|
233
|
+
/** MessageFlow: free-text description or JSON schema of the message payload. */
|
|
234
|
+
payloadSchema?: string;
|
|
235
|
+
/** MessageFlow: FEEL/JSONPath correlation key expression, e.g. $.orderId. */
|
|
236
|
+
correlationKey?: string;
|
|
193
237
|
}
|
|
194
238
|
|
|
195
|
-
export type { BpmnCategory as B, EventTrigger as E, SubProcessVariant as S, TaskMarker as T, BpmnDefinitionsSet as a, BpmnEdgeData as b, BpmnEdgeType as c, BpmnElementMeta as d, BpmnElementSize as e, BpmnElementType as f, BpmnErrorDefinition as g, BpmnEscalationDefinition as h, BpmnEventDefinition as i, BpmnEventSemantics as j, BpmnHandlePolicy as k, BpmnMessageDefinition as l, BpmnNodeData as m, BpmnOrientation as n, BpmnProcessVariable as o, BpmnSignalDefinition as p, BpmnTimerDefinition as q, BpmnTimerKind as r };
|
|
239
|
+
export type { BpmnCategory as B, EventTrigger as E, InlineDecisionInput as I, SubProcessVariant as S, TaskMarker as T, BpmnDefinitionsSet as a, BpmnEdgeData as b, BpmnEdgeType as c, BpmnElementMeta as d, BpmnElementSize as e, BpmnElementType as f, BpmnErrorDefinition as g, BpmnEscalationDefinition as h, BpmnEventDefinition as i, BpmnEventSemantics as j, BpmnHandlePolicy as k, BpmnMessageDefinition as l, BpmnNodeData as m, BpmnOrientation as n, BpmnProcessVariable as o, BpmnSignalDefinition as p, BpmnTimerDefinition as q, BpmnTimerKind as r, InlineDecisionOutput as s, InlineDecisionRule as t, InlineDecisionTable as u };
|
|
@@ -166,14 +166,54 @@ interface BpmnNodeData extends Record<string, unknown> {
|
|
|
166
166
|
script?: string;
|
|
167
167
|
/** BusinessRuleTask: id of the referenced DMN decision table. */
|
|
168
168
|
decisionRef?: string;
|
|
169
|
+
/** BusinessRuleTask: simplified inline decision table (alternative to external decisionRef). */
|
|
170
|
+
inlineDecisionTable?: InlineDecisionTable;
|
|
169
171
|
/** UserTask: form key resolved to a FormDefinition by name at runtime. */
|
|
170
172
|
formKey?: string;
|
|
171
173
|
/** UserTask: comma-separated Flowable user ids that can claim this task. */
|
|
172
174
|
candidateUsers?: string;
|
|
173
175
|
/** UserTask: comma-separated Flowable group ids that can claim this task. */
|
|
174
176
|
candidateGroups?: string;
|
|
177
|
+
/** UserTask: ISO-8601 due date or FEEL expression evaluated at task creation. */
|
|
178
|
+
dueDate?: string;
|
|
179
|
+
/** UserTask: FEEL expression; when truthy the task is skipped. */
|
|
180
|
+
skipExpression?: string;
|
|
181
|
+
/** UserTask: name of the business calendar used to compute the due date. */
|
|
182
|
+
businessCalendarName?: string;
|
|
183
|
+
/** DataObjectReference: id of the backing bpmn:DataObject element. */
|
|
184
|
+
dataObjectRef?: string;
|
|
175
185
|
/** AdHocSubProcess: FEEL expression that determines when the sub-process completes. */
|
|
176
186
|
completionCondition?: string;
|
|
187
|
+
/** Loop / multi-instance type: none | loop | sequentialMultiple | parallelMultiple. */
|
|
188
|
+
loopType?: string;
|
|
189
|
+
/** StandardLoopCharacteristics: FEEL condition evaluated before each iteration. */
|
|
190
|
+
loopCondition?: string;
|
|
191
|
+
/** MultiInstanceLoopCharacteristics: number of instances as a FEEL expression. */
|
|
192
|
+
loopCardinality?: string;
|
|
193
|
+
/** MultiInstanceLoopCharacteristics: FEEL condition to stop before all instances finish. */
|
|
194
|
+
loopCompletionCondition?: string;
|
|
195
|
+
}
|
|
196
|
+
interface InlineDecisionInput {
|
|
197
|
+
id: string;
|
|
198
|
+
expression: string;
|
|
199
|
+
label: string;
|
|
200
|
+
}
|
|
201
|
+
interface InlineDecisionOutput {
|
|
202
|
+
id: string;
|
|
203
|
+
name: string;
|
|
204
|
+
label: string;
|
|
205
|
+
}
|
|
206
|
+
interface InlineDecisionRule {
|
|
207
|
+
id: string;
|
|
208
|
+
inputs: Record<string, string>;
|
|
209
|
+
outputs: Record<string, string>;
|
|
210
|
+
annotation?: string;
|
|
211
|
+
}
|
|
212
|
+
interface InlineDecisionTable {
|
|
213
|
+
hitPolicy: "FIRST" | "UNIQUE" | "COLLECT";
|
|
214
|
+
inputs: InlineDecisionInput[];
|
|
215
|
+
outputs: InlineDecisionOutput[];
|
|
216
|
+
rules: InlineDecisionRule[];
|
|
177
217
|
}
|
|
178
218
|
interface BpmnEdgeData extends Record<string, unknown> {
|
|
179
219
|
label?: string;
|
|
@@ -190,6 +230,10 @@ interface BpmnEdgeData extends Record<string, unknown> {
|
|
|
190
230
|
x: number;
|
|
191
231
|
y: number;
|
|
192
232
|
}>;
|
|
233
|
+
/** MessageFlow: free-text description or JSON schema of the message payload. */
|
|
234
|
+
payloadSchema?: string;
|
|
235
|
+
/** MessageFlow: FEEL/JSONPath correlation key expression, e.g. $.orderId. */
|
|
236
|
+
correlationKey?: string;
|
|
193
237
|
}
|
|
194
238
|
|
|
195
|
-
export type { BpmnCategory as B, EventTrigger as E, SubProcessVariant as S, TaskMarker as T, BpmnDefinitionsSet as a, BpmnEdgeData as b, BpmnEdgeType as c, BpmnElementMeta as d, BpmnElementSize as e, BpmnElementType as f, BpmnErrorDefinition as g, BpmnEscalationDefinition as h, BpmnEventDefinition as i, BpmnEventSemantics as j, BpmnHandlePolicy as k, BpmnMessageDefinition as l, BpmnNodeData as m, BpmnOrientation as n, BpmnProcessVariable as o, BpmnSignalDefinition as p, BpmnTimerDefinition as q, BpmnTimerKind as r };
|
|
239
|
+
export type { BpmnCategory as B, EventTrigger as E, InlineDecisionInput as I, SubProcessVariant as S, TaskMarker as T, BpmnDefinitionsSet as a, BpmnEdgeData as b, BpmnEdgeType as c, BpmnElementMeta as d, BpmnElementSize as e, BpmnElementType as f, BpmnErrorDefinition as g, BpmnEscalationDefinition as h, BpmnEventDefinition as i, BpmnEventSemantics as j, BpmnHandlePolicy as k, BpmnMessageDefinition as l, BpmnNodeData as m, BpmnOrientation as n, BpmnProcessVariable as o, BpmnSignalDefinition as p, BpmnTimerDefinition as q, BpmnTimerKind as r, InlineDecisionOutput as s, InlineDecisionRule as t, InlineDecisionTable as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Node, Edge } from '@xyflow/react';
|
|
2
|
-
import { m as BpmnNodeData, b as BpmnEdgeData, a as BpmnDefinitionsSet } from './types-
|
|
2
|
+
import { m as BpmnNodeData, b as BpmnEdgeData, a as BpmnDefinitionsSet } from './types-Dfrt0wVs.js';
|
|
3
3
|
|
|
4
4
|
type BpmnRFNode = Node<BpmnNodeData>;
|
|
5
5
|
type BpmnRFEdge = Edge<BpmnEdgeData>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Node, Edge } from '@xyflow/react';
|
|
2
|
-
import { m as BpmnNodeData, b as BpmnEdgeData, a as BpmnDefinitionsSet } from './types-
|
|
2
|
+
import { m as BpmnNodeData, b as BpmnEdgeData, a as BpmnDefinitionsSet } from './types-Dfrt0wVs.cjs';
|
|
3
3
|
|
|
4
4
|
type BpmnRFNode = Node<BpmnNodeData>;
|
|
5
5
|
type BpmnRFEdge = Edge<BpmnEdgeData>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as BpmnRFNode, c as BpmnRFEdge } from '../types-
|
|
1
|
+
import { d as BpmnRFNode, c as BpmnRFEdge } from '../types-s2_VvPGf.cjs';
|
|
2
2
|
import '@xyflow/react';
|
|
3
|
-
import '../types-
|
|
3
|
+
import '../types-Dfrt0wVs.cjs';
|
|
4
4
|
|
|
5
5
|
type BpmnValidationSeverity = "error" | "warning" | "info";
|
|
6
6
|
interface BpmnValidationIssue {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as BpmnRFNode, c as BpmnRFEdge } from '../types-
|
|
1
|
+
import { d as BpmnRFNode, c as BpmnRFEdge } from '../types-rEfHsPr5.js';
|
|
2
2
|
import '@xyflow/react';
|
|
3
|
-
import '../types-
|
|
3
|
+
import '../types-Dfrt0wVs.js';
|
|
4
4
|
|
|
5
5
|
type BpmnValidationSeverity = "error" | "warning" | "info";
|
|
6
6
|
interface BpmnValidationIssue {
|