@aranzatech/diagrams-bpmn 0.2.3 → 0.2.5
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-DIBySQqA.d.ts → catalog-CQtKEV7q.d.ts} +1 -1
- package/dist/{catalog-m8fHIiKH.d.cts → catalog-D2AcvrDO.d.cts} +1 -1
- package/dist/{chunk-33AR3PXF.js → chunk-ASZ3TFNQ.js} +228 -17
- package/dist/chunk-ASZ3TFNQ.js.map +1 -0
- package/dist/{chunk-H3YMTGFG.js → chunk-IMW6RG6F.js} +3 -3
- package/dist/{chunk-H3YMTGFG.js.map → chunk-IMW6RG6F.js.map} +1 -1
- package/dist/{chunk-ECTJRD7Z.js → chunk-O3NWJ5H7.js} +9 -18
- package/dist/chunk-O3NWJ5H7.js.map +1 -0
- package/dist/{chunk-KALSGH4D.js → chunk-PDTXM32P.js} +6 -6
- package/dist/chunk-PDTXM32P.js.map +1 -0
- package/dist/edges/index.cjs +6 -15
- package/dist/edges/index.cjs.map +1 -1
- package/dist/edges/index.js +2 -2
- package/dist/elements/index.d.cts +3 -3
- package/dist/elements/index.d.ts +3 -3
- package/dist/index.cjs +248 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -4
- package/dist/modeling/index.d.cts +3 -3
- package/dist/modeling/index.d.ts +3 -3
- package/dist/nodes/index.cjs +16 -16
- package/dist/nodes/index.cjs.map +1 -1
- package/dist/nodes/index.js +2 -2
- package/dist/{types-vVi5T7qj.d.cts → types-CIBColRi.d.ts} +11 -2
- package/dist/{types-BxjCV2oX.d.ts → types-fDlPLIHd.d.cts} +11 -2
- package/dist/{types-DznxZxpV.d.cts → types-rWbKYrHH.d.cts} +61 -1
- package/dist/{types-DznxZxpV.d.ts → types-rWbKYrHH.d.ts} +61 -1
- package/dist/validation/index.d.cts +2 -2
- package/dist/validation/index.d.ts +2 -2
- package/dist/xml/index.cjs +226 -15
- package/dist/xml/index.cjs.map +1 -1
- package/dist/xml/index.d.cts +3 -2
- package/dist/xml/index.d.ts +3 -2
- package/dist/xml/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-33AR3PXF.js.map +0 -1
- package/dist/chunk-ECTJRD7Z.js.map +0 -1
- package/dist/chunk-KALSGH4D.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -768,8 +768,8 @@ var BPMN_THEME = {
|
|
|
768
768
|
fontFamily: "Inter, system-ui, sans-serif",
|
|
769
769
|
fontSize: 11,
|
|
770
770
|
labelColor: "#0f172a",
|
|
771
|
-
shadow: "
|
|
772
|
-
shadowSelected: "
|
|
771
|
+
shadow: "none",
|
|
772
|
+
shadowSelected: "none",
|
|
773
773
|
transition: "box-shadow 140ms ease, filter 140ms ease, transform 140ms ease"
|
|
774
774
|
};
|
|
775
775
|
function resolveStroke(selected, override) {
|
|
@@ -779,8 +779,8 @@ function resolveStroke(selected, override) {
|
|
|
779
779
|
function resolveStrokeWidth(selected) {
|
|
780
780
|
return selected ? BPMN_THEME.strokeWidthSelected : BPMN_THEME.strokeWidth;
|
|
781
781
|
}
|
|
782
|
-
function resolveShapeFilter(
|
|
783
|
-
return
|
|
782
|
+
function resolveShapeFilter(_selected) {
|
|
783
|
+
return void 0;
|
|
784
784
|
}
|
|
785
785
|
function resolveNodeShadow(selected) {
|
|
786
786
|
return selected ? BPMN_THEME.shadowSelected : BPMN_THEME.shadow;
|
|
@@ -937,7 +937,7 @@ function StartEventNode({ data, selected }) {
|
|
|
937
937
|
const trigger = d.trigger ?? "none";
|
|
938
938
|
const dashArray = d.isNonInterrupting ? "4 2" : void 0;
|
|
939
939
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: SIZE, height: SIZE, position: "relative" }, children: [
|
|
940
|
-
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: SIZE, height: SIZE, style: { overflow: "visible", display: "block", filter: resolveShapeFilter(
|
|
940
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: SIZE, height: SIZE, style: { overflow: "visible", display: "block", filter: resolveShapeFilter() }, children: [
|
|
941
941
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
942
942
|
"circle",
|
|
943
943
|
{
|
|
@@ -966,7 +966,7 @@ function EndEventNode({ data, selected }) {
|
|
|
966
966
|
const fill = d.color?.fill ?? BPMN_THEME.fill;
|
|
967
967
|
const trigger = d.trigger ?? "none";
|
|
968
968
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: SIZE2, height: SIZE2, position: "relative" }, children: [
|
|
969
|
-
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: SIZE2, height: SIZE2, style: { overflow: "visible", display: "block", filter: resolveShapeFilter(
|
|
969
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: SIZE2, height: SIZE2, style: { overflow: "visible", display: "block", filter: resolveShapeFilter() }, children: [
|
|
970
970
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
971
971
|
"circle",
|
|
972
972
|
{
|
|
@@ -996,7 +996,7 @@ function IntermediateCatchEventNode({ data, selected }) {
|
|
|
996
996
|
const fill = d.color?.fill ?? BPMN_THEME.fill;
|
|
997
997
|
const trigger = d.trigger && d.trigger !== "none" ? d.trigger : "timer";
|
|
998
998
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: SIZE3, height: SIZE3, position: "relative" }, children: [
|
|
999
|
-
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: SIZE3, height: SIZE3, style: { overflow: "visible", display: "block", filter: resolveShapeFilter(
|
|
999
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: SIZE3, height: SIZE3, style: { overflow: "visible", display: "block", filter: resolveShapeFilter() }, children: [
|
|
1000
1000
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: CX3, cy: CX3, r: R_OUTER, fill, stroke, strokeWidth: sw }),
|
|
1001
1001
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: CX3, cy: CX3, r: R_INNER, fill: "none", stroke, strokeWidth: sw }),
|
|
1002
1002
|
/* @__PURE__ */ jsxRuntime.jsx(EventMarker, { cx: CX3, cy: CX3, trigger, filled: false, stroke, bg: fill, r: ICON_R })
|
|
@@ -1012,7 +1012,7 @@ function IntermediateThrowEventNode({ data, selected }) {
|
|
|
1012
1012
|
const fill = d.color?.fill ?? BPMN_THEME.fill;
|
|
1013
1013
|
const trigger = d.trigger && d.trigger !== "none" ? d.trigger : "message";
|
|
1014
1014
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: SIZE3, height: SIZE3, position: "relative" }, children: [
|
|
1015
|
-
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: SIZE3, height: SIZE3, style: { overflow: "visible", display: "block", filter: resolveShapeFilter(
|
|
1015
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: SIZE3, height: SIZE3, style: { overflow: "visible", display: "block", filter: resolveShapeFilter() }, children: [
|
|
1016
1016
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: CX3, cy: CX3, r: R_OUTER, fill, stroke, strokeWidth: sw }),
|
|
1017
1017
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: CX3, cy: CX3, r: R_INNER, fill: stroke, stroke, strokeWidth: sw }),
|
|
1018
1018
|
/* @__PURE__ */ jsxRuntime.jsx(EventMarker, { cx: CX3, cy: CX3, trigger, filled: true, stroke: fill, bg: stroke, r: ICON_R })
|
|
@@ -1029,7 +1029,7 @@ function BoundaryEventNode({ data, selected }) {
|
|
|
1029
1029
|
const trigger = d.trigger && d.trigger !== "none" ? d.trigger : "timer";
|
|
1030
1030
|
const dashArray = d.isNonInterrupting ? "4 2" : void 0;
|
|
1031
1031
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: SIZE3, height: SIZE3, position: "relative" }, children: [
|
|
1032
|
-
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: SIZE3, height: SIZE3, style: { overflow: "visible", display: "block", filter: resolveShapeFilter(
|
|
1032
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: SIZE3, height: SIZE3, style: { overflow: "visible", display: "block", filter: resolveShapeFilter() }, children: [
|
|
1033
1033
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1034
1034
|
"circle",
|
|
1035
1035
|
{
|
|
@@ -1304,7 +1304,7 @@ function GatewayNode({ data, selected }) {
|
|
|
1304
1304
|
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
1305
1305
|
const sw = resolveStrokeWidth(selected);
|
|
1306
1306
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: SIZE4, height: SIZE4, position: "relative" }, children: [
|
|
1307
|
-
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: SIZE4, height: SIZE4, style: { overflow: "visible", display: "block", filter: resolveShapeFilter(
|
|
1307
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: SIZE4, height: SIZE4, style: { overflow: "visible", display: "block", filter: resolveShapeFilter() }, children: [
|
|
1308
1308
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1309
1309
|
"polygon",
|
|
1310
1310
|
{
|
|
@@ -1740,7 +1740,7 @@ function DataObjectNode({ data, selected }) {
|
|
|
1740
1740
|
`L ${W} ${FOLD}`
|
|
1741
1741
|
].join(" ");
|
|
1742
1742
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: W, height: H2, position: "relative" }, children: [
|
|
1743
|
-
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: W, height: H2, style: { overflow: "visible", display: "block", filter: resolveShapeFilter(
|
|
1743
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: W, height: H2, style: { overflow: "visible", display: "block", filter: resolveShapeFilter() }, children: [
|
|
1744
1744
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: path, fill, stroke, strokeWidth: sw }),
|
|
1745
1745
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: foldPath2, fill: "none", stroke, strokeWidth: sw })
|
|
1746
1746
|
] }),
|
|
@@ -1758,7 +1758,7 @@ function DataStoreNode({ data, selected }) {
|
|
|
1758
1758
|
const sw = resolveStrokeWidth(selected);
|
|
1759
1759
|
const fill = d.color?.fill ?? BPMN_THEME.fill;
|
|
1760
1760
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: DS_W, height: DS_H, position: "relative" }, children: [
|
|
1761
|
-
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: DS_W, height: DS_H, style: { overflow: "visible", display: "block", filter: resolveShapeFilter(
|
|
1761
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: DS_W, height: DS_H, style: { overflow: "visible", display: "block", filter: resolveShapeFilter() }, children: [
|
|
1762
1762
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1763
1763
|
"path",
|
|
1764
1764
|
{
|
|
@@ -1804,7 +1804,7 @@ function DataObjectReferenceNode({ data, selected }) {
|
|
|
1804
1804
|
const sw = resolveStrokeWidth(selected);
|
|
1805
1805
|
const fill = d.color?.fill ?? BPMN_THEME.fill;
|
|
1806
1806
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: W2, height: H3, position: "relative" }, children: [
|
|
1807
|
-
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: W2, height: H3, style: { overflow: "visible", display: "block", filter: resolveShapeFilter(
|
|
1807
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: W2, height: H3, style: { overflow: "visible", display: "block", filter: resolveShapeFilter() }, children: [
|
|
1808
1808
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: documentPath(), fill, stroke, strokeWidth: sw }),
|
|
1809
1809
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: foldPath(), fill: "none", stroke, strokeWidth: sw }),
|
|
1810
1810
|
d.isCollection && collectionLines(stroke, sw)
|
|
@@ -1819,7 +1819,7 @@ function DataInputNode({ data, selected }) {
|
|
|
1819
1819
|
const sw = resolveStrokeWidth(selected);
|
|
1820
1820
|
const fill = d.color?.fill ?? BPMN_THEME.fill;
|
|
1821
1821
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: W2, height: H3, position: "relative" }, children: [
|
|
1822
|
-
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: W2, height: H3, style: { overflow: "visible", display: "block", filter: resolveShapeFilter(
|
|
1822
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: W2, height: H3, style: { overflow: "visible", display: "block", filter: resolveShapeFilter() }, children: [
|
|
1823
1823
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: documentPath(), fill, stroke, strokeWidth: sw }),
|
|
1824
1824
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: foldPath(), fill: "none", stroke, strokeWidth: sw }),
|
|
1825
1825
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1843,7 +1843,7 @@ function DataOutputNode({ data, selected }) {
|
|
|
1843
1843
|
const sw = resolveStrokeWidth(selected);
|
|
1844
1844
|
const fill = d.color?.fill ?? BPMN_THEME.fill;
|
|
1845
1845
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: W2, height: H3, position: "relative" }, children: [
|
|
1846
|
-
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: W2, height: H3, style: { overflow: "visible", display: "block", filter: resolveShapeFilter(
|
|
1846
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: W2, height: H3, style: { overflow: "visible", display: "block", filter: resolveShapeFilter() }, children: [
|
|
1847
1847
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: documentPath(), fill, stroke, strokeWidth: sw }),
|
|
1848
1848
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: foldPath(), fill: "none", stroke, strokeWidth: sw }),
|
|
1849
1849
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1871,7 +1871,7 @@ function DataStoreReferenceNode({ data, selected }) {
|
|
|
1871
1871
|
const sw = resolveStrokeWidth(selected);
|
|
1872
1872
|
const fill = d.color?.fill ?? BPMN_THEME.fill;
|
|
1873
1873
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: DS_W2, height: DS_H2, position: "relative" }, children: [
|
|
1874
|
-
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: DS_W2, height: DS_H2, style: { overflow: "visible", display: "block", filter: resolveShapeFilter(
|
|
1874
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: DS_W2, height: DS_H2, style: { overflow: "visible", display: "block", filter: resolveShapeFilter() }, children: [
|
|
1875
1875
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1876
1876
|
"path",
|
|
1877
1877
|
{
|
|
@@ -2225,15 +2225,6 @@ var BPMN_NODE_TYPES = {
|
|
|
2225
2225
|
};
|
|
2226
2226
|
|
|
2227
2227
|
// src/edges/path.ts
|
|
2228
|
-
function getEdgePoints(sourceX, sourceY, targetX, targetY, routingPoints) {
|
|
2229
|
-
if (routingPoints && routingPoints.length >= 2) {
|
|
2230
|
-
return routingPoints;
|
|
2231
|
-
}
|
|
2232
|
-
return [
|
|
2233
|
-
{ x: sourceX, y: sourceY },
|
|
2234
|
-
{ x: targetX, y: targetY }
|
|
2235
|
-
];
|
|
2236
|
-
}
|
|
2237
2228
|
function getPolylineMidpoint(points) {
|
|
2238
2229
|
if (points.length === 0) return { x: 0, y: 0 };
|
|
2239
2230
|
if (points.length === 1) return points[0];
|
|
@@ -2297,8 +2288,8 @@ function SequenceFlowEdge({
|
|
|
2297
2288
|
}) {
|
|
2298
2289
|
const d = data;
|
|
2299
2290
|
const points = d?.routingPoints;
|
|
2300
|
-
const polyline =
|
|
2301
|
-
const path = points && points.length >= 2 ? routing.pointsToSvgPath(points) : routing.getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);
|
|
2291
|
+
const polyline = points && points.length >= 2 ? [{ x: sourceX, y: sourceY }, ...points.slice(1, -1), { x: targetX, y: targetY }] : [{ x: sourceX, y: sourceY }, { x: targetX, y: targetY }];
|
|
2292
|
+
const path = points && points.length >= 2 ? routing.pointsToSvgPath([{ x: sourceX, y: sourceY }, ...points.slice(1, -1), { x: targetX, y: targetY }]) : routing.getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);
|
|
2302
2293
|
const midpoint = getPolylineMidpoint(polyline);
|
|
2303
2294
|
const defaultMarkerPath = d?.isDefault ? getDefaultFlowMarkerPath(polyline) : null;
|
|
2304
2295
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -2362,8 +2353,8 @@ function MessageFlowEdge({
|
|
|
2362
2353
|
}) {
|
|
2363
2354
|
const d = data;
|
|
2364
2355
|
const points = d?.routingPoints;
|
|
2365
|
-
const polyline =
|
|
2366
|
-
const path = points && points.length >= 2 ? routing.pointsToSvgPath(points) : routing.getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);
|
|
2356
|
+
const polyline = points && points.length >= 2 ? [{ x: sourceX, y: sourceY }, ...points.slice(1, -1), { x: targetX, y: targetY }] : [{ x: sourceX, y: sourceY }, { x: targetX, y: targetY }];
|
|
2357
|
+
const path = points && points.length >= 2 ? routing.pointsToSvgPath([{ x: sourceX, y: sourceY }, ...points.slice(1, -1), { x: targetX, y: targetY }]) : routing.getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);
|
|
2367
2358
|
const midpoint = getPolylineMidpoint(polyline);
|
|
2368
2359
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2369
2360
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2415,7 +2406,7 @@ function AssociationEdge({
|
|
|
2415
2406
|
const d = data;
|
|
2416
2407
|
const points = d?.routingPoints;
|
|
2417
2408
|
const direction = d?.associationDirection ?? "none";
|
|
2418
|
-
const path = points && points.length >= 2 ? routing.pointsToSvgPath(points) : routing.getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);
|
|
2409
|
+
const path = points && points.length >= 2 ? routing.pointsToSvgPath([{ x: sourceX, y: sourceY }, ...points.slice(1, -1), { x: targetX, y: targetY }]) : routing.getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);
|
|
2419
2410
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2420
2411
|
react.BaseEdge,
|
|
2421
2412
|
{
|
|
@@ -2446,7 +2437,7 @@ function DataAssociationEdge({
|
|
|
2446
2437
|
}) {
|
|
2447
2438
|
const d = data;
|
|
2448
2439
|
const points = d?.routingPoints;
|
|
2449
|
-
const path = points && points.length >= 2 ? routing.pointsToSvgPath(points) : routing.getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);
|
|
2440
|
+
const path = points && points.length >= 2 ? routing.pointsToSvgPath([{ x: sourceX, y: sourceY }, ...points.slice(1, -1), { x: targetX, y: targetY }]) : routing.getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);
|
|
2450
2441
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2451
2442
|
react.BaseEdge,
|
|
2452
2443
|
{
|
|
@@ -2683,9 +2674,84 @@ function extractLaneMembership(process) {
|
|
|
2683
2674
|
function extractTrigger(el) {
|
|
2684
2675
|
const defs = asElements(el.eventDefinitions);
|
|
2685
2676
|
if (defs.length === 0) return void 0;
|
|
2686
|
-
if (defs.length > 1)
|
|
2677
|
+
if (defs.length > 1) {
|
|
2678
|
+
return defs.some((def) => def.$type === "bpmn:ParallelMultipleEventDefinition") ? "parallelMultiple" : "multiple";
|
|
2679
|
+
}
|
|
2687
2680
|
return EVENT_DEF_TO_TRIGGER[defs[0].$type];
|
|
2688
2681
|
}
|
|
2682
|
+
function parseVariableType(value) {
|
|
2683
|
+
const text = asString(value) ?? "";
|
|
2684
|
+
if (text.includes("int")) return "integer";
|
|
2685
|
+
if (text.includes("boolean")) return "boolean";
|
|
2686
|
+
if (text.includes("date")) return "date";
|
|
2687
|
+
if (text.includes("array")) return "array";
|
|
2688
|
+
if (text.includes("anyType")) return "object";
|
|
2689
|
+
return "string";
|
|
2690
|
+
}
|
|
2691
|
+
function extractEventDefinition(el) {
|
|
2692
|
+
const defs = asElements(el.eventDefinitions);
|
|
2693
|
+
if (defs.length === 0) return void 0;
|
|
2694
|
+
if (defs.length > 1) {
|
|
2695
|
+
return {
|
|
2696
|
+
type: defs.some((def2) => def2.$type === "bpmn:ParallelMultipleEventDefinition") ? "parallelMultiple" : "multiple"
|
|
2697
|
+
};
|
|
2698
|
+
}
|
|
2699
|
+
const [def] = defs;
|
|
2700
|
+
const type = EVENT_DEF_TO_TRIGGER[def.$type];
|
|
2701
|
+
if (!type) return void 0;
|
|
2702
|
+
const eventDefinition = {
|
|
2703
|
+
type,
|
|
2704
|
+
...asString(def.messageRef?.id) ? { messageRef: def.messageRef.id } : {},
|
|
2705
|
+
...asString(def.signalRef?.id) ? { signalRef: def.signalRef.id } : {},
|
|
2706
|
+
...asString(def.errorRef?.id) ? { errorRef: def.errorRef.id } : {},
|
|
2707
|
+
...asString(def.escalationRef?.id) ? { escalationRef: def.escalationRef.id } : {},
|
|
2708
|
+
...asString(def.condition?.body) ? { conditionExpression: def.condition.body } : {}
|
|
2709
|
+
};
|
|
2710
|
+
const timeDate = asString(def.timeDate?.body);
|
|
2711
|
+
const timeDuration = asString(def.timeDuration?.body);
|
|
2712
|
+
const timeCycle = asString(def.timeCycle?.body);
|
|
2713
|
+
if (timeDate) eventDefinition.timer = { kind: "date", value: timeDate };
|
|
2714
|
+
else if (timeCycle) eventDefinition.timer = { kind: "cycle", value: timeCycle };
|
|
2715
|
+
else if (timeDuration) eventDefinition.timer = { kind: "duration", value: timeDuration };
|
|
2716
|
+
if (type === "link") {
|
|
2717
|
+
const linkName = asString(el.name) ?? asString(def.name);
|
|
2718
|
+
if (linkName) eventDefinition.linkName = linkName;
|
|
2719
|
+
}
|
|
2720
|
+
return eventDefinition;
|
|
2721
|
+
}
|
|
2722
|
+
function extractDefinitions(rootElement) {
|
|
2723
|
+
const definitions = {};
|
|
2724
|
+
const rootElements = asElements(rootElement.rootElements);
|
|
2725
|
+
const messages = rootElements.filter((element) => element.$type === "bpmn:Message" && asString(element.id)).map((message) => ({
|
|
2726
|
+
id: message.id,
|
|
2727
|
+
name: asString(message.name) ?? message.id
|
|
2728
|
+
}));
|
|
2729
|
+
if (messages.length > 0) definitions.messages = messages;
|
|
2730
|
+
const signals = rootElements.filter((element) => element.$type === "bpmn:Signal" && asString(element.id)).map((signal) => ({
|
|
2731
|
+
id: signal.id,
|
|
2732
|
+
name: asString(signal.name) ?? signal.id
|
|
2733
|
+
}));
|
|
2734
|
+
if (signals.length > 0) definitions.signals = signals;
|
|
2735
|
+
const errors = rootElements.filter((element) => element.$type === "bpmn:Error" && asString(element.id)).map((error) => ({
|
|
2736
|
+
id: error.id,
|
|
2737
|
+
name: asString(error.name) ?? error.id,
|
|
2738
|
+
...asString(error.errorCode) ? { errorCode: error.errorCode } : {}
|
|
2739
|
+
}));
|
|
2740
|
+
if (errors.length > 0) definitions.errors = errors;
|
|
2741
|
+
const escalations = rootElements.filter((element) => element.$type === "bpmn:Escalation" && asString(element.id)).map((escalation) => ({
|
|
2742
|
+
id: escalation.id,
|
|
2743
|
+
name: asString(escalation.name) ?? escalation.id,
|
|
2744
|
+
...asString(escalation.escalationCode) ? { escalationCode: escalation.escalationCode } : {}
|
|
2745
|
+
}));
|
|
2746
|
+
if (escalations.length > 0) definitions.escalations = escalations;
|
|
2747
|
+
const itemDefinitions = asElements(rootElement.itemDefinitions).filter((item) => asString(item.id)).map((item) => ({
|
|
2748
|
+
id: String(item.id).replace(/_item$/, ""),
|
|
2749
|
+
name: String(item.id).replace(/_item$/, ""),
|
|
2750
|
+
type: parseVariableType(item.structureRef)
|
|
2751
|
+
}));
|
|
2752
|
+
if (itemDefinitions.length > 0) definitions.variables = itemDefinitions;
|
|
2753
|
+
return Object.keys(definitions).length > 0 ? definitions : void 0;
|
|
2754
|
+
}
|
|
2689
2755
|
function extractSubProcessVariant(el) {
|
|
2690
2756
|
if (el.$type === "bpmn:Transaction") return "transaction";
|
|
2691
2757
|
if (el.$type === "bpmn:AdHocSubProcess") return "adhoc";
|
|
@@ -2726,6 +2792,7 @@ function buildNode(el, elementType, parentId, ctx, nodes) {
|
|
|
2726
2792
|
const label = asString(el.name);
|
|
2727
2793
|
const documentation = extractDocumentation(el);
|
|
2728
2794
|
const trigger = extractTrigger(el);
|
|
2795
|
+
const eventDefinition = extractEventDefinition(el);
|
|
2729
2796
|
const isNonInterrupting = el.cancelActivity === false;
|
|
2730
2797
|
const attachedToRef = el.attachedToRef?.id;
|
|
2731
2798
|
const data = {
|
|
@@ -2733,8 +2800,17 @@ function buildNode(el, elementType, parentId, ctx, nodes) {
|
|
|
2733
2800
|
...label ? { label } : {},
|
|
2734
2801
|
...documentation ? { documentation } : {},
|
|
2735
2802
|
...trigger ? { trigger } : {},
|
|
2803
|
+
...eventDefinition ? { eventDefinition } : {},
|
|
2736
2804
|
...isNonInterrupting ? { isNonInterrupting: true } : {},
|
|
2737
|
-
...
|
|
2805
|
+
...elementType === "BoundaryEvent" ? { cancelActivity: el.cancelActivity !== false } : {},
|
|
2806
|
+
...attachedToRef ? { attachedToRef } : {},
|
|
2807
|
+
...eventDefinition?.timer ? { timer: eventDefinition.timer, timerExpression: eventDefinition.timer } : {},
|
|
2808
|
+
...eventDefinition?.messageRef ? { messageRef: eventDefinition.messageRef } : {},
|
|
2809
|
+
...eventDefinition?.signalRef ? { signalRef: eventDefinition.signalRef } : {},
|
|
2810
|
+
...eventDefinition?.errorRef ? { errorRef: eventDefinition.errorRef } : {},
|
|
2811
|
+
...eventDefinition?.escalationRef ? { escalationRef: eventDefinition.escalationRef } : {},
|
|
2812
|
+
...eventDefinition?.conditionExpression ? { conditionExpression: eventDefinition.conditionExpression } : {},
|
|
2813
|
+
...eventDefinition?.linkName ? { linkName: eventDefinition.linkName } : {}
|
|
2738
2814
|
};
|
|
2739
2815
|
if (elementType === "SubProcess" || elementType === "Transaction" || elementType === "EventSubProcess" || elementType === "AdHocSubProcess") {
|
|
2740
2816
|
const variant = extractSubProcessVariant(el);
|
|
@@ -2884,10 +2960,23 @@ async function parseBpmnXml(xml) {
|
|
|
2884
2960
|
};
|
|
2885
2961
|
return { ...edge, data };
|
|
2886
2962
|
});
|
|
2963
|
+
const firstProcess = asElements(rootElement.rootElements).find((rootEl) => rootEl.$type === "bpmn:Process");
|
|
2964
|
+
const importedDefinitions = extractDefinitions(rootElement);
|
|
2965
|
+
const process = firstProcess ? (() => {
|
|
2966
|
+
const importedProcess = {};
|
|
2967
|
+
const processId = asString(firstProcess.id);
|
|
2968
|
+
const documentation = extractDocumentation(firstProcess);
|
|
2969
|
+
if (processId) importedProcess.processId = processId;
|
|
2970
|
+
if (typeof firstProcess.isExecutable === "boolean") importedProcess.executable = firstProcess.isExecutable;
|
|
2971
|
+
if (documentation) importedProcess.documentation = documentation;
|
|
2972
|
+
if (importedDefinitions) importedProcess.definitions = importedDefinitions;
|
|
2973
|
+
return importedProcess;
|
|
2974
|
+
})() : importedDefinitions ? { definitions: importedDefinitions } : void 0;
|
|
2887
2975
|
return {
|
|
2888
2976
|
nodes: normalizeChildPositions(nodes, nodeIds),
|
|
2889
2977
|
edges: normalizedEdges,
|
|
2890
|
-
warnings
|
|
2978
|
+
warnings,
|
|
2979
|
+
...process ? { process } : {}
|
|
2891
2980
|
};
|
|
2892
2981
|
}
|
|
2893
2982
|
function collectDefaultFlows(el, defaultFlowById) {
|
|
@@ -2917,6 +3006,99 @@ function uid(prefix, id) {
|
|
|
2917
3006
|
function asNodes(nodes, types) {
|
|
2918
3007
|
return nodes.filter((n) => types.includes(n.data.elementType));
|
|
2919
3008
|
}
|
|
3009
|
+
function normalizeEventDefinition(data) {
|
|
3010
|
+
const trigger = data.eventDefinition?.type ?? data.trigger;
|
|
3011
|
+
if (!trigger || trigger === "none") return void 0;
|
|
3012
|
+
const normalized = { type: trigger };
|
|
3013
|
+
const timer = data.eventDefinition?.timer ?? data.timer ?? data.timerExpression;
|
|
3014
|
+
const messageRef = data.eventDefinition?.messageRef ?? (typeof data.messageRef === "string" ? data.messageRef : void 0);
|
|
3015
|
+
const signalRef = data.eventDefinition?.signalRef ?? (typeof data.signalRef === "string" ? data.signalRef : void 0);
|
|
3016
|
+
const errorRef = data.eventDefinition?.errorRef ?? (typeof data.errorRef === "string" ? data.errorRef : void 0);
|
|
3017
|
+
const escalationRef = data.eventDefinition?.escalationRef ?? (typeof data.escalationRef === "string" ? data.escalationRef : void 0);
|
|
3018
|
+
const conditionExpression = data.eventDefinition?.conditionExpression ?? (typeof data.conditionExpression === "string" ? data.conditionExpression : void 0);
|
|
3019
|
+
const linkName = data.eventDefinition?.linkName ?? (typeof data.linkName === "string" ? data.linkName : void 0);
|
|
3020
|
+
if (timer) normalized.timer = timer;
|
|
3021
|
+
if (messageRef) normalized.messageRef = messageRef;
|
|
3022
|
+
if (signalRef) normalized.signalRef = signalRef;
|
|
3023
|
+
if (errorRef) normalized.errorRef = errorRef;
|
|
3024
|
+
if (escalationRef) normalized.escalationRef = escalationRef;
|
|
3025
|
+
if (conditionExpression) normalized.conditionExpression = conditionExpression;
|
|
3026
|
+
if (linkName) normalized.linkName = linkName;
|
|
3027
|
+
return normalized;
|
|
3028
|
+
}
|
|
3029
|
+
function parseVariableType2(type) {
|
|
3030
|
+
switch (type) {
|
|
3031
|
+
case "integer":
|
|
3032
|
+
return "xsd:int";
|
|
3033
|
+
case "boolean":
|
|
3034
|
+
return "xsd:boolean";
|
|
3035
|
+
case "date":
|
|
3036
|
+
return "xsd:dateTime";
|
|
3037
|
+
case "object":
|
|
3038
|
+
return "xsd:anyType";
|
|
3039
|
+
case "array":
|
|
3040
|
+
return "xsd:anyType";
|
|
3041
|
+
default:
|
|
3042
|
+
return "xsd:string";
|
|
3043
|
+
}
|
|
3044
|
+
}
|
|
3045
|
+
function buildGlobalDefinitions(moddle, definitionsSet) {
|
|
3046
|
+
if (!definitionsSet) return [];
|
|
3047
|
+
const rootElements = [];
|
|
3048
|
+
for (const message of definitionsSet.messages ?? []) {
|
|
3049
|
+
rootElements.push(moddle.create("bpmn:Message", { id: message.id, name: message.name }));
|
|
3050
|
+
}
|
|
3051
|
+
for (const signal of definitionsSet.signals ?? []) {
|
|
3052
|
+
rootElements.push(moddle.create("bpmn:Signal", { id: signal.id, name: signal.name }));
|
|
3053
|
+
}
|
|
3054
|
+
for (const error of definitionsSet.errors ?? []) {
|
|
3055
|
+
rootElements.push(moddle.create("bpmn:Error", {
|
|
3056
|
+
id: error.id,
|
|
3057
|
+
name: error.name,
|
|
3058
|
+
...error.errorCode ? { errorCode: error.errorCode } : {}
|
|
3059
|
+
}));
|
|
3060
|
+
}
|
|
3061
|
+
for (const escalation of definitionsSet.escalations ?? []) {
|
|
3062
|
+
rootElements.push(moddle.create("bpmn:Escalation", {
|
|
3063
|
+
id: escalation.id,
|
|
3064
|
+
name: escalation.name,
|
|
3065
|
+
...escalation.escalationCode ? { escalationCode: escalation.escalationCode } : {}
|
|
3066
|
+
}));
|
|
3067
|
+
}
|
|
3068
|
+
return rootElements;
|
|
3069
|
+
}
|
|
3070
|
+
function buildItemDefinitions(moddle, variables) {
|
|
3071
|
+
return (variables ?? []).map(
|
|
3072
|
+
(variable) => moddle.create("bpmn:ItemDefinition", {
|
|
3073
|
+
id: `${variable.id}_item`,
|
|
3074
|
+
itemKind: "Information",
|
|
3075
|
+
structureRef: parseVariableType2(variable.type)
|
|
3076
|
+
})
|
|
3077
|
+
);
|
|
3078
|
+
}
|
|
3079
|
+
function buildEventDefinitions(moddle, node, eventDefinition) {
|
|
3080
|
+
if (eventDefinition.type === "multiple" || eventDefinition.type === "parallelMultiple") {
|
|
3081
|
+
return [];
|
|
3082
|
+
}
|
|
3083
|
+
const defType = TRIGGER_TO_EVENT_DEF[eventDefinition.type];
|
|
3084
|
+
if (!defType) return [];
|
|
3085
|
+
const attrs = { id: uid("EventDef", node.id) };
|
|
3086
|
+
if (eventDefinition.messageRef) attrs.messageRef = { id: eventDefinition.messageRef };
|
|
3087
|
+
if (eventDefinition.signalRef) attrs.signalRef = { id: eventDefinition.signalRef };
|
|
3088
|
+
if (eventDefinition.errorRef) attrs.errorRef = { id: eventDefinition.errorRef };
|
|
3089
|
+
if (eventDefinition.escalationRef) attrs.escalationRef = { id: eventDefinition.escalationRef };
|
|
3090
|
+
if (eventDefinition.conditionExpression) {
|
|
3091
|
+
attrs.condition = moddle.create("bpmn:FormalExpression", {
|
|
3092
|
+
body: eventDefinition.conditionExpression
|
|
3093
|
+
});
|
|
3094
|
+
}
|
|
3095
|
+
if (eventDefinition.timer?.value) {
|
|
3096
|
+
attrs[eventDefinition.timer.kind === "date" ? "timeDate" : eventDefinition.timer.kind === "cycle" ? "timeCycle" : "timeDuration"] = moddle.create("bpmn:FormalExpression", {
|
|
3097
|
+
body: eventDefinition.timer.value
|
|
3098
|
+
});
|
|
3099
|
+
}
|
|
3100
|
+
return [moddle.create(defType, attrs)];
|
|
3101
|
+
}
|
|
2920
3102
|
function buildSemanticModel(moddle, nodes, edges, opts) {
|
|
2921
3103
|
const defId = opts.id ?? "Definitions_1";
|
|
2922
3104
|
const defName = opts.name;
|
|
@@ -2928,13 +3110,19 @@ function buildSemanticModel(moddle, nodes, edges, opts) {
|
|
|
2928
3110
|
targetNamespace: "http://bpmn.io/schema/bpmn",
|
|
2929
3111
|
...defName ? { name: defName } : {}
|
|
2930
3112
|
});
|
|
2931
|
-
const rootElements = [
|
|
3113
|
+
const rootElements = [
|
|
3114
|
+
...buildGlobalDefinitions(moddle, opts.process?.definitions)
|
|
3115
|
+
];
|
|
3116
|
+
const itemDefinitions = buildItemDefinitions(moddle, opts.process?.definitions?.variables);
|
|
3117
|
+
if (itemDefinitions.length > 0) {
|
|
3118
|
+
definitions.itemDefinitions = itemDefinitions;
|
|
3119
|
+
}
|
|
2932
3120
|
if (isCollaboration) {
|
|
2933
3121
|
const participants = [];
|
|
2934
3122
|
const processes = [];
|
|
2935
3123
|
for (const pool of poolNodes) {
|
|
2936
3124
|
const processId = `Process_${pool.id}`;
|
|
2937
|
-
const process = buildProcess(moddle, nodes, edges, pool.id, laneNodes, processId);
|
|
3125
|
+
const process = buildProcess(moddle, nodes, edges, pool.id, laneNodes, processId, opts);
|
|
2938
3126
|
processes.push(process);
|
|
2939
3127
|
const participant = moddle.create("bpmn:Participant", {
|
|
2940
3128
|
id: pool.id,
|
|
@@ -2968,13 +3156,21 @@ function buildSemanticModel(moddle, nodes, edges, opts) {
|
|
|
2968
3156
|
});
|
|
2969
3157
|
rootElements.push(collaboration, ...processes);
|
|
2970
3158
|
} else {
|
|
2971
|
-
const process = buildProcess(
|
|
3159
|
+
const process = buildProcess(
|
|
3160
|
+
moddle,
|
|
3161
|
+
nodes,
|
|
3162
|
+
edges,
|
|
3163
|
+
void 0,
|
|
3164
|
+
laneNodes,
|
|
3165
|
+
opts.process?.processId ?? "Process_1",
|
|
3166
|
+
opts
|
|
3167
|
+
);
|
|
2972
3168
|
rootElements.push(process);
|
|
2973
3169
|
}
|
|
2974
3170
|
definitions.rootElements = rootElements;
|
|
2975
3171
|
return definitions;
|
|
2976
3172
|
}
|
|
2977
|
-
function buildProcess(moddle, allNodes, allEdges, poolId, laneNodes, processId) {
|
|
3173
|
+
function buildProcess(moddle, allNodes, allEdges, poolId, laneNodes, processId, opts) {
|
|
2978
3174
|
const subProcessIds = new Set(
|
|
2979
3175
|
allNodes.filter(
|
|
2980
3176
|
(n) => n.data.elementType === "SubProcess" || n.data.elementType === "Transaction" || n.data.elementType === "EventSubProcess" || n.data.elementType === "AdHocSubProcess"
|
|
@@ -3024,9 +3220,14 @@ function buildProcess(moddle, allNodes, allEdges, poolId, laneNodes, processId)
|
|
|
3024
3220
|
}
|
|
3025
3221
|
const process = moddle.create("bpmn:Process", {
|
|
3026
3222
|
id: processId,
|
|
3027
|
-
isExecutable: true,
|
|
3223
|
+
isExecutable: opts.process?.executable ?? true,
|
|
3028
3224
|
flowElements
|
|
3029
3225
|
});
|
|
3226
|
+
if (opts.process?.documentation) {
|
|
3227
|
+
process.documentation = [
|
|
3228
|
+
moddle.create("bpmn:Documentation", { text: opts.process.documentation })
|
|
3229
|
+
];
|
|
3230
|
+
}
|
|
3030
3231
|
if (myLanes.length > 0) {
|
|
3031
3232
|
const laneElements = myLanes.map(
|
|
3032
3233
|
(l) => moddle.create("bpmn:Lane", {
|
|
@@ -3043,7 +3244,8 @@ function buildProcess(moddle, allNodes, allEdges, poolId, laneNodes, processId)
|
|
|
3043
3244
|
return process;
|
|
3044
3245
|
}
|
|
3045
3246
|
function buildFlowElement(moddle, node, allNodes, allEdges) {
|
|
3046
|
-
const { elementType, label
|
|
3247
|
+
const { elementType, label } = node.data;
|
|
3248
|
+
const eventDefinition = normalizeEventDefinition(node.data);
|
|
3047
3249
|
if (elementType === "Pool" || elementType === "Lane") return null;
|
|
3048
3250
|
const moddleType = ELEMENT_TYPE_TO_MODDLE[elementType];
|
|
3049
3251
|
if (!moddleType) return null;
|
|
@@ -3056,15 +3258,15 @@ function buildFlowElement(moddle, node, allNodes, allEdges) {
|
|
|
3056
3258
|
moddle.create("bpmn:Documentation", { text: node.data.documentation })
|
|
3057
3259
|
];
|
|
3058
3260
|
}
|
|
3059
|
-
if (
|
|
3060
|
-
const
|
|
3061
|
-
if (
|
|
3062
|
-
|
|
3063
|
-
}
|
|
3261
|
+
if (eventDefinition) {
|
|
3262
|
+
const eventDefinitions = buildEventDefinitions(moddle, node, eventDefinition);
|
|
3263
|
+
if (eventDefinitions.length > 0) attrs.eventDefinitions = eventDefinitions;
|
|
3264
|
+
if (eventDefinition.linkName) attrs.name = eventDefinition.linkName;
|
|
3064
3265
|
}
|
|
3065
3266
|
if (elementType === "BoundaryEvent") {
|
|
3066
3267
|
attrs.attachedToRef = { id: node.data.attachedToRef ?? node.parentId };
|
|
3067
|
-
|
|
3268
|
+
const interrupting = node.data.cancelActivity ?? !node.data.isNonInterrupting;
|
|
3269
|
+
attrs.cancelActivity = interrupting;
|
|
3068
3270
|
}
|
|
3069
3271
|
const isSubProcess3 = elementType === "SubProcess" || elementType === "Transaction" || elementType === "EventSubProcess" || elementType === "AdHocSubProcess";
|
|
3070
3272
|
if (isSubProcess3) {
|