@aranzatech/diagrams-bpmn 0.3.0 → 0.3.2
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-DAGDhO-D.d.cts → catalog-DG-sz0VM.d.cts} +1 -1
- package/dist/{catalog-Q1QmKLDD.d.ts → catalog-DNIyjHbl.d.ts} +1 -1
- package/dist/{chunk-334WN4JZ.js → chunk-NYIYQUGX.js} +104 -23
- package/dist/chunk-NYIYQUGX.js.map +1 -0
- package/dist/elements/index.d.cts +3 -3
- package/dist/elements/index.d.ts +3 -3
- package/dist/extensions/index.d.cts +2 -2
- package/dist/extensions/index.d.ts +2 -2
- package/dist/index.cjs +102 -21
- 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 +1 -1
- package/dist/layout/index.cjs +392 -95
- package/dist/layout/index.cjs.map +1 -1
- package/dist/layout/index.d.cts +4 -4
- package/dist/layout/index.d.ts +4 -4
- package/dist/layout/index.js +392 -95
- package/dist/layout/index.js.map +1 -1
- package/dist/modeling/index.d.cts +4 -4
- package/dist/modeling/index.d.ts +4 -4
- package/dist/{types-CggktCqr.d.cts → types-CDp9kWQ4.d.cts} +2 -2
- package/dist/{types-DmDODKlh.d.ts → types-CuDL2YGL.d.ts} +2 -2
- package/dist/{types-D7zel9dq.d.ts → types-X5FyP8oS.d.ts} +1 -1
- package/dist/{types-BX_o95GC.d.cts → types-dQUuSnV5.d.cts} +1 -1
- package/dist/{types-BYN4Zuee.d.cts → types-nvF59RGF.d.cts} +12 -0
- package/dist/{types-BYN4Zuee.d.ts → types-nvF59RGF.d.ts} +12 -0
- package/dist/validation/index.d.cts +3 -3
- package/dist/validation/index.d.ts +3 -3
- package/dist/xml/index.cjs +102 -21
- package/dist/xml/index.cjs.map +1 -1
- package/dist/xml/index.d.cts +4 -4
- package/dist/xml/index.d.ts +4 -4
- package/dist/xml/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-334WN4JZ.js.map +0 -1
package/dist/xml/index.cjs
CHANGED
|
@@ -779,6 +779,9 @@ var TRIGGER_TO_EVENT_DEF = {
|
|
|
779
779
|
function asElements(v) {
|
|
780
780
|
return Array.isArray(v) ? v : [];
|
|
781
781
|
}
|
|
782
|
+
function asLaneSets(value) {
|
|
783
|
+
return asElements(value);
|
|
784
|
+
}
|
|
782
785
|
function asString(v) {
|
|
783
786
|
return typeof v === "string" && v.trim() ? v.trim() : void 0;
|
|
784
787
|
}
|
|
@@ -833,6 +836,11 @@ function extractLaneMembership(process) {
|
|
|
833
836
|
if (child) walkLaneSet(child);
|
|
834
837
|
}
|
|
835
838
|
}
|
|
839
|
+
const laneSets = asLaneSets(process.laneSets);
|
|
840
|
+
if (laneSets.length > 0) {
|
|
841
|
+
for (const laneSet2 of laneSets) walkLaneSet(laneSet2);
|
|
842
|
+
return map;
|
|
843
|
+
}
|
|
836
844
|
const laneSet = process.laneSet;
|
|
837
845
|
if (laneSet) walkLaneSet(laneSet);
|
|
838
846
|
return map;
|
|
@@ -933,15 +941,39 @@ function extractAranzaExtensions(el) {
|
|
|
933
941
|
if (ft) result.flowableType = ft;
|
|
934
942
|
const fde = asString(elAttrs["flowable:delegateExpression"]);
|
|
935
943
|
if (fde) result.flowableDelegateExpression = fde;
|
|
944
|
+
const fc = asString(elAttrs["flowable:class"]);
|
|
945
|
+
if (fc) result.flowableClass = fc;
|
|
946
|
+
const fe = asString(elAttrs["flowable:expression"]);
|
|
947
|
+
if (fe) result.flowableExpression = fe;
|
|
936
948
|
const fk = asString(elAttrs["flowable:formKey"]);
|
|
937
949
|
if (fk) result.formKey = fk;
|
|
938
950
|
const cu = asString(elAttrs["flowable:candidateUsers"]);
|
|
939
951
|
if (cu) result.candidateUsers = cu;
|
|
940
952
|
const cg = asString(elAttrs["flowable:candidateGroups"]);
|
|
941
953
|
if (cg) result.candidateGroups = cg;
|
|
954
|
+
const dueDate2 = asString(elAttrs["flowable:dueDate"]);
|
|
955
|
+
if (dueDate2) result.dueDate = dueDate2;
|
|
956
|
+
const skipExpression2 = asString(elAttrs["flowable:skipExpression"]);
|
|
957
|
+
if (skipExpression2) result.skipExpression = skipExpression2;
|
|
958
|
+
const businessCalendarName2 = asString(elAttrs["flowable:businessCalendarName"]);
|
|
959
|
+
if (businessCalendarName2) result.businessCalendarName = businessCalendarName2;
|
|
960
|
+
const resultVariable = asString(elAttrs["flowable:resultVariable"]);
|
|
961
|
+
if (resultVariable) result.resultVariable = resultVariable;
|
|
962
|
+
const ruleVariablesInput = asString(elAttrs["flowable:ruleVariablesInput"]);
|
|
963
|
+
if (ruleVariablesInput) result.ruleVariablesInput = ruleVariablesInput;
|
|
964
|
+
const ruleNames = asString(elAttrs["flowable:rules"]);
|
|
965
|
+
if (ruleNames) result.ruleNames = ruleNames;
|
|
966
|
+
const exclude = asString(elAttrs["flowable:exclude"]);
|
|
967
|
+
if (exclude === "true") result.excludeRules = true;
|
|
968
|
+
else if (exclude === "false") result.excludeRules = false;
|
|
942
969
|
}
|
|
943
970
|
const ext = el.extensionElements;
|
|
944
|
-
if (!ext)
|
|
971
|
+
if (!ext) {
|
|
972
|
+
if (result.flowableType === "http" && !result.serviceConfig) {
|
|
973
|
+
result.serviceConfig = { implementation: "http" };
|
|
974
|
+
}
|
|
975
|
+
return result;
|
|
976
|
+
}
|
|
945
977
|
const extValues = asElements(ext.values);
|
|
946
978
|
const inlineDecision = extValues.find((v) => v.$type === "aranza:InlineDecision");
|
|
947
979
|
if (inlineDecision) {
|
|
@@ -956,7 +988,12 @@ function extractAranzaExtensions(el) {
|
|
|
956
988
|
}
|
|
957
989
|
}
|
|
958
990
|
const taskConfig = extValues.find((v) => v.$type === "aranza:TaskConfig");
|
|
959
|
-
if (!taskConfig)
|
|
991
|
+
if (!taskConfig) {
|
|
992
|
+
if (result.flowableType === "http" && !result.serviceConfig) {
|
|
993
|
+
result.serviceConfig = { implementation: "http" };
|
|
994
|
+
}
|
|
995
|
+
return result;
|
|
996
|
+
}
|
|
960
997
|
const priority = asString(taskConfig.priority);
|
|
961
998
|
if (priority === "critical" || priority === "high" || priority === "medium" || priority === "low") {
|
|
962
999
|
result.priority = priority;
|
|
@@ -1016,6 +1053,9 @@ function extractAranzaExtensions(el) {
|
|
|
1016
1053
|
if (skipExpression) result.skipExpression = skipExpression;
|
|
1017
1054
|
const businessCalendarName = asString(taskConfig.businessCalendarName);
|
|
1018
1055
|
if (businessCalendarName) result.businessCalendarName = businessCalendarName;
|
|
1056
|
+
if (!result.serviceConfig && result.flowableType === "http") {
|
|
1057
|
+
result.serviceConfig = { implementation: "http" };
|
|
1058
|
+
}
|
|
1019
1059
|
return result;
|
|
1020
1060
|
}
|
|
1021
1061
|
function extractCompletionCondition(el) {
|
|
@@ -1133,8 +1173,8 @@ function buildNode(el, elementType, parentId, ctx, nodes) {
|
|
|
1133
1173
|
}
|
|
1134
1174
|
function buildEdge(el, edgeType, ctx, edges) {
|
|
1135
1175
|
const id = el.id;
|
|
1136
|
-
const source = el.sourceRef
|
|
1137
|
-
const target = el.targetRef
|
|
1176
|
+
const source = extractReferenceId(el.sourceRef);
|
|
1177
|
+
const target = extractReferenceId(el.targetRef);
|
|
1138
1178
|
if (!source || !target) {
|
|
1139
1179
|
ctx.warnings.push(`Edge "${id}" missing source or target \u2014 skipped.`);
|
|
1140
1180
|
return;
|
|
@@ -1169,6 +1209,21 @@ function buildEdge(el, edgeType, ctx, edges) {
|
|
|
1169
1209
|
if (waypoints?.length) data.routingPoints = waypoints;
|
|
1170
1210
|
edges.push({ id, type: edgeType, source, target, data });
|
|
1171
1211
|
}
|
|
1212
|
+
function extractReferenceId(value) {
|
|
1213
|
+
if (Array.isArray(value)) {
|
|
1214
|
+
for (const entry of value) {
|
|
1215
|
+
const id = extractReferenceId(entry);
|
|
1216
|
+
if (id) return id;
|
|
1217
|
+
}
|
|
1218
|
+
return void 0;
|
|
1219
|
+
}
|
|
1220
|
+
if (typeof value === "string") return value;
|
|
1221
|
+
if (value && typeof value === "object") {
|
|
1222
|
+
const id = value.id;
|
|
1223
|
+
return typeof id === "string" ? id : void 0;
|
|
1224
|
+
}
|
|
1225
|
+
return void 0;
|
|
1226
|
+
}
|
|
1172
1227
|
function handleCollaboration(collaboration, ctx, nodes, edges) {
|
|
1173
1228
|
for (const participant of asElements(collaboration.participants)) {
|
|
1174
1229
|
const id = participant.id;
|
|
@@ -1194,9 +1249,12 @@ function handleCollaboration(collaboration, ctx, nodes, edges) {
|
|
|
1194
1249
|
nodes,
|
|
1195
1250
|
edges
|
|
1196
1251
|
);
|
|
1197
|
-
const
|
|
1198
|
-
if (
|
|
1199
|
-
addLaneNodes(laneSet, id, ctx, nodes);
|
|
1252
|
+
const laneSets = asLaneSets(processRef.laneSets);
|
|
1253
|
+
if (laneSets.length > 0) {
|
|
1254
|
+
for (const laneSet of laneSets) addLaneNodes(laneSet, id, ctx, nodes);
|
|
1255
|
+
} else {
|
|
1256
|
+
const laneSet = processRef.laneSet;
|
|
1257
|
+
if (laneSet) addLaneNodes(laneSet, id, ctx, nodes);
|
|
1200
1258
|
}
|
|
1201
1259
|
}
|
|
1202
1260
|
}
|
|
@@ -1253,8 +1311,13 @@ async function parseBpmnXml(xml) {
|
|
|
1253
1311
|
handleCollaboration(rootEl, ctx, nodes, edges);
|
|
1254
1312
|
} else if (rootEl.$type === "bpmn:Process") {
|
|
1255
1313
|
const laneMembership = extractLaneMembership(rootEl);
|
|
1256
|
-
const
|
|
1257
|
-
if (
|
|
1314
|
+
const laneSets = asLaneSets(rootEl.laneSets);
|
|
1315
|
+
if (laneSets.length > 0) {
|
|
1316
|
+
for (const laneSet of laneSets) addLaneNodes(laneSet, void 0, ctx, nodes);
|
|
1317
|
+
} else {
|
|
1318
|
+
const laneSet = rootEl.laneSet;
|
|
1319
|
+
if (laneSet) addLaneNodes(laneSet, void 0, ctx, nodes);
|
|
1320
|
+
}
|
|
1258
1321
|
walkFlowElements(
|
|
1259
1322
|
[...asElements(rootEl.flowElements), ...asElements(rootEl.artifacts)],
|
|
1260
1323
|
void 0,
|
|
@@ -1557,6 +1620,13 @@ function buildAranzaExtensionElements(moddle, node) {
|
|
|
1557
1620
|
return moddle.create("bpmn:ExtensionElements", { values });
|
|
1558
1621
|
}
|
|
1559
1622
|
var ARTIFACT_ELEMENT_TYPES = /* @__PURE__ */ new Set(["Annotation", "Group"]);
|
|
1623
|
+
var DATA_ASSOCIATION_SOURCE_TYPES = /* @__PURE__ */ new Set([
|
|
1624
|
+
"DataObject",
|
|
1625
|
+
"DataObjectReference",
|
|
1626
|
+
"DataStore",
|
|
1627
|
+
"DataStoreReference",
|
|
1628
|
+
"DataInput"
|
|
1629
|
+
]);
|
|
1560
1630
|
function buildSemanticModel(moddle, nodes, edges, opts) {
|
|
1561
1631
|
const defId = opts.id ?? "Definitions_1";
|
|
1562
1632
|
const defName = opts.name;
|
|
@@ -1664,6 +1734,7 @@ function buildProcess(moddle, allNodes, allEdges, poolId, laneNodes, processId,
|
|
|
1664
1734
|
};
|
|
1665
1735
|
const myNodes = (poolId ? allNodes.filter((n) => belongsToPool(n)) : allNodes.filter((n) => n.data.elementType !== "Pool" && n.data.elementType !== "Lane")).filter((n) => !isInsideSubProcess(n)).filter((n) => !(n.data.elementType === "DataStore" && referencedDataStoreIds.has(n.id)));
|
|
1666
1736
|
const myLanes = laneNodes.filter((l) => poolId ? l.parentId === poolId : true);
|
|
1737
|
+
const nodeById = new Map(myNodes.map((node) => [node.id, node]));
|
|
1667
1738
|
const presentDataObjectIds = new Set(
|
|
1668
1739
|
myNodes.filter((n) => n.data.elementType === "DataObject").map((n) => n.id)
|
|
1669
1740
|
);
|
|
@@ -1695,7 +1766,7 @@ function buildProcess(moddle, allNodes, allEdges, poolId, laneNodes, processId,
|
|
|
1695
1766
|
(e) => (e.data?.edgeType === "sequenceFlow" || e.data?.edgeType === "association" || e.data?.edgeType === "dataAssociation") && myNodeIds.has(e.source) && myNodeIds.has(e.target)
|
|
1696
1767
|
);
|
|
1697
1768
|
for (const edge of myEdges) {
|
|
1698
|
-
const edgeMeta = buildEdgeElement(moddle, edge);
|
|
1769
|
+
const edgeMeta = buildEdgeElement(moddle, edge, nodeById);
|
|
1699
1770
|
if (!edgeMeta) continue;
|
|
1700
1771
|
if (edge.data?.edgeType === "association") {
|
|
1701
1772
|
artifacts.push(edgeMeta);
|
|
@@ -1741,10 +1812,12 @@ function buildProcess(moddle, allNodes, allEdges, poolId, laneNodes, processId,
|
|
|
1741
1812
|
flowNodeRef: myNodes.filter((n) => n.parentId === l.id).map((n) => ({ id: n.id }))
|
|
1742
1813
|
})
|
|
1743
1814
|
);
|
|
1744
|
-
process.
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1815
|
+
process.laneSets = [
|
|
1816
|
+
moddle.create("bpmn:LaneSet", {
|
|
1817
|
+
id: `LaneSet_${processId}`,
|
|
1818
|
+
lanes: laneElements
|
|
1819
|
+
})
|
|
1820
|
+
];
|
|
1748
1821
|
}
|
|
1749
1822
|
return process;
|
|
1750
1823
|
}
|
|
@@ -1852,6 +1925,7 @@ function buildNestedFlowElements(moddle, parent, allNodes, allEdges) {
|
|
|
1852
1925
|
const referencedDataStoreIds = collectReferencedDataStoreIds(allNodes);
|
|
1853
1926
|
const childNodes = allNodes.filter((node) => node.parentId === parent.id).filter((node) => !(node.data.elementType === "DataStore" && referencedDataStoreIds.has(node.id)));
|
|
1854
1927
|
const childNodeIds = new Set(childNodes.map((node) => node.id));
|
|
1928
|
+
const childNodeById = new Map(childNodes.map((node) => [node.id, node]));
|
|
1855
1929
|
const flowElements = [];
|
|
1856
1930
|
const artifacts = [];
|
|
1857
1931
|
const presentDataObjectIds = new Set(
|
|
@@ -1880,7 +1954,7 @@ function buildNestedFlowElements(moddle, parent, allNodes, allEdges) {
|
|
|
1880
1954
|
}
|
|
1881
1955
|
for (const edge of allEdges) {
|
|
1882
1956
|
if (!childNodeIds.has(edge.source) || !childNodeIds.has(edge.target)) continue;
|
|
1883
|
-
const element = buildEdgeElement(moddle, edge);
|
|
1957
|
+
const element = buildEdgeElement(moddle, edge, childNodeById);
|
|
1884
1958
|
if (!element) continue;
|
|
1885
1959
|
if (edge.data?.edgeType === "association") {
|
|
1886
1960
|
artifacts.push(element);
|
|
@@ -1890,16 +1964,23 @@ function buildNestedFlowElements(moddle, parent, allNodes, allEdges) {
|
|
|
1890
1964
|
}
|
|
1891
1965
|
return { flowElements, artifacts };
|
|
1892
1966
|
}
|
|
1893
|
-
function buildEdgeElement(moddle, edge) {
|
|
1967
|
+
function buildEdgeElement(moddle, edge, nodeById) {
|
|
1894
1968
|
if (!edge.data) return null;
|
|
1895
|
-
const
|
|
1969
|
+
const sourceNode = nodeById.get(edge.source);
|
|
1970
|
+
const dataAssociationIsInput = edge.data.edgeType === "dataAssociation" && DATA_ASSOCIATION_SOURCE_TYPES.has(sourceNode?.data.elementType ?? "");
|
|
1971
|
+
const moddleType = edge.data.edgeType === "dataAssociation" ? dataAssociationIsInput ? "bpmn:DataInputAssociation" : "bpmn:DataOutputAssociation" : EDGE_TYPE_TO_MODDLE[edge.data.edgeType];
|
|
1896
1972
|
if (!moddleType) return null;
|
|
1897
1973
|
const attrs = {
|
|
1898
1974
|
id: edge.id,
|
|
1899
|
-
name: edge.data.label ?? ""
|
|
1900
|
-
sourceRef: { id: edge.source },
|
|
1901
|
-
targetRef: { id: edge.target }
|
|
1975
|
+
name: edge.data.label ?? ""
|
|
1902
1976
|
};
|
|
1977
|
+
if (edge.data.edgeType === "dataAssociation") {
|
|
1978
|
+
attrs.sourceRef = [{ id: edge.source }];
|
|
1979
|
+
attrs.targetRef = { id: edge.target };
|
|
1980
|
+
} else {
|
|
1981
|
+
attrs.sourceRef = { id: edge.source };
|
|
1982
|
+
attrs.targetRef = { id: edge.target };
|
|
1983
|
+
}
|
|
1903
1984
|
if (edge.data.documentation) {
|
|
1904
1985
|
attrs.documentation = [
|
|
1905
1986
|
moddle.create("bpmn:Documentation", { text: edge.data.documentation })
|
|
@@ -1952,7 +2033,7 @@ function buildBpmnDI(moddle, definitions, nodes, edges) {
|
|
|
1952
2033
|
);
|
|
1953
2034
|
}
|
|
1954
2035
|
const rootEls = definitions.rootElements;
|
|
1955
|
-
const planeElement = rootEls?.[0];
|
|
2036
|
+
const planeElement = rootEls?.find((element) => element.$type === "bpmn:Collaboration") ?? rootEls?.find((element) => element.$type === "bpmn:Process") ?? rootEls?.[0];
|
|
1956
2037
|
const plane = moddle.create("bpmndi:BPMNPlane", {
|
|
1957
2038
|
id: "BPMNPlane_1",
|
|
1958
2039
|
bpmnElement: planeElement ?? { id: "unknown" },
|