@bpmnkit/core 1.15.0 → 1.16.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.
- package/builder-reference.md +2 -1
- package/dist/bpmn/auto-layout.js +174 -40
- package/dist/bpmn/bpmn-builder.d.ts +120 -14
- package/dist/bpmn/bpmn-builder.js +411 -152
- package/dist/bpmn/bpmn-model.d.ts +15 -0
- package/dist/bpmn/bpmn-parser.js +32 -6
- package/dist/bpmn/bpmn-serializer.js +9 -2
- package/dist/bpmn/compact-stream.d.ts +7 -0
- package/dist/bpmn/compact-stream.js +7 -0
- package/dist/bpmn/compact.d.ts +124 -9
- package/dist/bpmn/compact.js +295 -27
- package/dist/bpmn/full-operations.d.ts +19 -0
- package/dist/bpmn/full-operations.js +191 -7
- package/dist/bpmn/preserving-writer.d.ts +1 -1
- package/dist/bpmn/preserving-writer.js +1 -1
- package/dist/bpmn/process-delta.d.ts +32 -1
- package/dist/bpmn/process-delta.js +62 -1
- package/dist/bpmn/process-text-writer.d.ts +18 -7
- package/dist/bpmn/process-text-writer.js +105 -22
- package/dist/bpmn/process-text.d.ts +27 -1
- package/dist/bpmn/process-text.js +350 -2
- package/dist/bpmn/swimlanes.d.ts +178 -0
- package/dist/bpmn/swimlanes.js +774 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.js +3 -2
- package/dist/layout/semantic/place.d.ts +2 -0
- package/dist/layout/semantic/place.js +28 -9
- package/dist/xml/xml-patch.d.ts +1 -1
- package/package.json +2 -2
package/dist/bpmn/compact.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { packAnnotations } from "../layout/annotations.js";
|
|
2
2
|
import { layoutProcess } from "../layout/index.js";
|
|
3
3
|
import { assertBpmnDefinitions, assertCompactDiagram } from "./argument-guards.js";
|
|
4
|
-
import { addAnnotationShapes } from "./auto-layout.js";
|
|
4
|
+
import { addAnnotationShapes, applyAutoLayout } from "./auto-layout.js";
|
|
5
5
|
import { normalizeCamundaVersion } from "./camunda-compat.js";
|
|
6
6
|
import { toFeelCondition } from "./feel-condition.js";
|
|
7
7
|
import { restConnectorTaskType } from "./rest-connector.js";
|
|
8
8
|
import { assignEventDefinitionIds, rootDefinitionId } from "./stable-ids.js";
|
|
9
|
+
import { assignLane, buildLaneSet, collaborationProblems, laneForNewNode, laneOf, poolLanedProcesses, primaryProcess, revisitMessage, } from "./swimlanes.js";
|
|
9
10
|
import { makeConditionalDefinition, zeebeExtensionsToXmlElements } from "./zeebe-extensions.js";
|
|
10
11
|
import { assertDeployable } from "./zeebe-validate/gate.js";
|
|
11
12
|
// ── Default flows ────────────────────────────────────────────────────────────
|
|
@@ -302,16 +303,82 @@ function compactifyFlows(elements, sequenceFlows) {
|
|
|
302
303
|
*/
|
|
303
304
|
export function compactify(defs) {
|
|
304
305
|
assertBpmnDefinitions(defs, "compactify");
|
|
306
|
+
const pooled = defs.collaborations.length > 0 || defs.processes.some((p) => p.laneSet);
|
|
307
|
+
const primary = primaryProcess(defs);
|
|
308
|
+
const collaboration = defs.collaborations[0];
|
|
309
|
+
const participants = (collaboration?.participants ?? []).map(compactifyParticipant);
|
|
310
|
+
const messageFlows = (collaboration?.messageFlows ?? []).map(compactifyMessageFlow);
|
|
305
311
|
return {
|
|
306
312
|
id: defs.id,
|
|
307
|
-
processes: defs.processes.map((process) =>
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
313
|
+
processes: defs.processes.map((process) => {
|
|
314
|
+
const lanes = compactifyLanes(process);
|
|
315
|
+
// Flowable reads an absent isExecutable as true. Every non-primary pool says
|
|
316
|
+
// what it is, because expand gives only the first keyless pool the default.
|
|
317
|
+
const executable = process.isExecutable !== false;
|
|
318
|
+
const written = !executable || (pooled && process !== primary);
|
|
319
|
+
return {
|
|
320
|
+
id: process.id,
|
|
321
|
+
name: process.name,
|
|
322
|
+
documentation: process.documentation,
|
|
323
|
+
...(written ? { executable } : {}),
|
|
324
|
+
...(lanes.length > 0 ? { lanes } : {}),
|
|
325
|
+
elements: process.flowElements.map((el) => compactifyElement(el, defs)),
|
|
326
|
+
flows: compactifyFlows(process.flowElements, process.sequenceFlows),
|
|
327
|
+
};
|
|
328
|
+
}),
|
|
329
|
+
...(participants.length > 0 ? { participants } : {}),
|
|
330
|
+
...(messageFlows.length > 0 ? { messageFlows } : {}),
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
/** Element types that are not flow nodes: they sit in no lane. */
|
|
334
|
+
export const DATA_ELEMENT_TYPES = new Set([
|
|
335
|
+
"dataObject",
|
|
336
|
+
"dataObjectReference",
|
|
337
|
+
"dataStoreReference",
|
|
338
|
+
]);
|
|
339
|
+
/**
|
|
340
|
+
* The lane tree of `process`, members on leaves only. A member is kept only
|
|
341
|
+
* when it is a top-level flow node, so what `expand` would refuse (a dangling
|
|
342
|
+
* ref, a data reference, a sub-process child) is not passed on; a parent's own
|
|
343
|
+
* refs, which repeat its children's under the union convention, are dropped.
|
|
344
|
+
*/
|
|
345
|
+
export function compactifyLanes(process) {
|
|
346
|
+
const nodeIds = new Set(process.flowElements.filter((e) => !DATA_ELEMENT_TYPES.has(e.type)).map((e) => e.id));
|
|
347
|
+
const seen = new Set();
|
|
348
|
+
const toCompact = (lane) => {
|
|
349
|
+
if (seen.has(lane))
|
|
350
|
+
throw new Error(`Lane "${lane.id}" appears twice in one lane tree`);
|
|
351
|
+
seen.add(lane);
|
|
352
|
+
const result = { id: lane.id };
|
|
353
|
+
if (lane.name)
|
|
354
|
+
result.name = lane.name;
|
|
355
|
+
const children = lane.childLaneSet?.lanes ?? [];
|
|
356
|
+
if (children.length > 0) {
|
|
357
|
+
result.lanes = children.map(toCompact);
|
|
358
|
+
return result;
|
|
359
|
+
}
|
|
360
|
+
const members = [...new Set(lane.flowNodeRefs)].filter((ref) => nodeIds.has(ref));
|
|
361
|
+
if (members.length > 0)
|
|
362
|
+
result.members = members;
|
|
363
|
+
return result;
|
|
314
364
|
};
|
|
365
|
+
return (process.laneSet?.lanes ?? []).map(toCompact);
|
|
366
|
+
}
|
|
367
|
+
/** A pool as compact writes it; a black box has no `processId`. */
|
|
368
|
+
export function compactifyParticipant(participant) {
|
|
369
|
+
const result = { id: participant.id };
|
|
370
|
+
if (participant.name)
|
|
371
|
+
result.name = participant.name;
|
|
372
|
+
if (participant.processRef !== undefined)
|
|
373
|
+
result.processId = participant.processRef;
|
|
374
|
+
return result;
|
|
375
|
+
}
|
|
376
|
+
/** A message flow as compact writes it, with `source`/`target` so streams never read it as a sequence flow. */
|
|
377
|
+
export function compactifyMessageFlow(flow) {
|
|
378
|
+
const result = { id: flow.id, source: flow.sourceRef, target: flow.targetRef };
|
|
379
|
+
if (flow.name)
|
|
380
|
+
result.name = flow.name;
|
|
381
|
+
return result;
|
|
315
382
|
}
|
|
316
383
|
// ── Expand ───────────────────────────────────────────────────────────────────
|
|
317
384
|
const EVENT_TYPES = new Set([
|
|
@@ -391,9 +458,63 @@ function compactProblems(compact) {
|
|
|
391
458
|
problems.push(`a note is on "${note.elementId}", which is not an element in the diagram`);
|
|
392
459
|
}
|
|
393
460
|
}
|
|
461
|
+
problems.push(...compactLaneProblems(process, claim));
|
|
394
462
|
}
|
|
463
|
+
for (const participant of compact.participants ?? [])
|
|
464
|
+
claim(participant.id, "participant");
|
|
465
|
+
for (const flow of compact.messageFlows ?? [])
|
|
466
|
+
claim(flow.id, "message flow");
|
|
467
|
+
return { problems, ids: seen };
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* What is wrong with the lanes of `process`: a lane tree that loops, members on
|
|
471
|
+
* a lane with child lanes, a member that is not a top-level flow node of this
|
|
472
|
+
* process, and a node listed in two lanes. Lane ids are claimed through `claim`.
|
|
473
|
+
* A node in no lane is not a problem; `expand` places it.
|
|
474
|
+
*/
|
|
475
|
+
function compactLaneProblems(process, claim) {
|
|
476
|
+
const problems = [];
|
|
477
|
+
const nodes = new Map(process.elements.map((element) => [element.id, element]));
|
|
478
|
+
const laneOfMember = new Map();
|
|
479
|
+
const seen = new Set();
|
|
480
|
+
const visit = (lanes) => {
|
|
481
|
+
for (const lane of lanes) {
|
|
482
|
+
if (seen.has(lane)) {
|
|
483
|
+
problems.push(`lane "${lane.id}" appears twice in the lane tree of "${process.id}"`);
|
|
484
|
+
continue;
|
|
485
|
+
}
|
|
486
|
+
seen.add(lane);
|
|
487
|
+
claim(lane.id, "lane");
|
|
488
|
+
const children = lane.lanes ?? [];
|
|
489
|
+
if (children.length > 0 && (lane.members?.length ?? 0) > 0) {
|
|
490
|
+
problems.push(`lane "${lane.id}" has child lanes and members; members go on its leaf lanes`);
|
|
491
|
+
}
|
|
492
|
+
for (const member of lane.members ?? []) {
|
|
493
|
+
const problem = memberProblem(process, lane.id, member, nodes.get(member), laneOfMember);
|
|
494
|
+
if (problem !== undefined)
|
|
495
|
+
problems.push(problem);
|
|
496
|
+
}
|
|
497
|
+
visit(children);
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
visit(process.lanes ?? []);
|
|
395
501
|
return problems;
|
|
396
502
|
}
|
|
503
|
+
/** Why `member` cannot sit in lane `laneId`, or `undefined`; records the lane of a valid member. */
|
|
504
|
+
function memberProblem(process, laneId, member, element, laneOfMember) {
|
|
505
|
+
if (element === undefined) {
|
|
506
|
+
return `lane "${laneId}" lists "${member}", which is not a top-level flow node of process "${process.id}"`;
|
|
507
|
+
}
|
|
508
|
+
if (DATA_ELEMENT_TYPES.has(element.type)) {
|
|
509
|
+
return `lane "${laneId}" lists "${member}", a ${element.type}; lanes hold flow nodes only`;
|
|
510
|
+
}
|
|
511
|
+
const other = laneOfMember.get(member);
|
|
512
|
+
if (other !== undefined && other !== laneId) {
|
|
513
|
+
return `"${member}" is in lanes "${other}" and "${laneId}"; a node belongs to one lane`;
|
|
514
|
+
}
|
|
515
|
+
laneOfMember.set(member, laneId);
|
|
516
|
+
return undefined;
|
|
517
|
+
}
|
|
397
518
|
export function makeEventDef(eventType) {
|
|
398
519
|
switch (eventType) {
|
|
399
520
|
case "timer":
|
|
@@ -908,7 +1029,7 @@ function buildDiagram(processId, process) {
|
|
|
908
1029
|
},
|
|
909
1030
|
};
|
|
910
1031
|
}
|
|
911
|
-
function expandProcess(compact, roots) {
|
|
1032
|
+
function expandProcess(compact, isExecutable, roots) {
|
|
912
1033
|
const incoming = new Map();
|
|
913
1034
|
const outgoing = new Map();
|
|
914
1035
|
for (const f of compact.flows) {
|
|
@@ -953,7 +1074,7 @@ function expandProcess(compact, roots) {
|
|
|
953
1074
|
id: compact.id,
|
|
954
1075
|
name: compact.name,
|
|
955
1076
|
documentation: compact.documentation,
|
|
956
|
-
isExecutable
|
|
1077
|
+
isExecutable,
|
|
957
1078
|
extensionElements: [],
|
|
958
1079
|
flowElements,
|
|
959
1080
|
sequenceFlows,
|
|
@@ -962,7 +1083,125 @@ function expandProcess(compact, roots) {
|
|
|
962
1083
|
groups: [],
|
|
963
1084
|
unknownAttributes: {},
|
|
964
1085
|
};
|
|
965
|
-
return
|
|
1086
|
+
return process;
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* True when the compact describes pools or lanes, which switches `expand` to
|
|
1090
|
+
* the collaboration path: pools, lanes, and a layout of the whole diagram.
|
|
1091
|
+
*/
|
|
1092
|
+
export function isPooled(compact) {
|
|
1093
|
+
return ((compact.participants?.length ?? 0) > 0 ||
|
|
1094
|
+
(compact.messageFlows?.length ?? 0) > 0 ||
|
|
1095
|
+
compact.processes.some((process) => (process.lanes?.length ?? 0) > 0));
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* `isExecutable` per process of `compact`, in order, by the rule documented on
|
|
1099
|
+
* {@link CompactProcess.executable}. `pooled` is {@link isPooled} of `compact`.
|
|
1100
|
+
*/
|
|
1101
|
+
export function executability(compact, pooled) {
|
|
1102
|
+
let defaultTaken = false;
|
|
1103
|
+
return compact.processes.map((process) => {
|
|
1104
|
+
if (process.executable !== undefined)
|
|
1105
|
+
return process.executable;
|
|
1106
|
+
if (!pooled)
|
|
1107
|
+
return true;
|
|
1108
|
+
const executable = !defaultTaken;
|
|
1109
|
+
defaultTaken = true;
|
|
1110
|
+
return executable;
|
|
1111
|
+
});
|
|
1112
|
+
}
|
|
1113
|
+
/**
|
|
1114
|
+
* `process` with the lane set `lanes` describes, replacing any it had. Members
|
|
1115
|
+
* are taken from leaf lanes only and written verbatim; a node no lane lists goes
|
|
1116
|
+
* in the lane {@link laneForNewNode} picks for it. `lanes` must not loop back
|
|
1117
|
+
* on itself. Returns `process` unchanged when `lanes` is absent or empty.
|
|
1118
|
+
*
|
|
1119
|
+
* @throws Error when `lanes` loops back on itself, or as {@link buildLaneSet} does.
|
|
1120
|
+
*/
|
|
1121
|
+
export function withLanes(process, lanes) {
|
|
1122
|
+
if (lanes === undefined || lanes.length === 0)
|
|
1123
|
+
return process;
|
|
1124
|
+
const leafOf = new Map();
|
|
1125
|
+
// Callers validate first, but this one is exported: a looping tree must fail
|
|
1126
|
+
// as one rather than overflow the stack.
|
|
1127
|
+
const seen = new Set();
|
|
1128
|
+
const collect = (children) => {
|
|
1129
|
+
for (const lane of children) {
|
|
1130
|
+
if (seen.has(lane))
|
|
1131
|
+
throw new Error(revisitMessage(lane.id));
|
|
1132
|
+
seen.add(lane);
|
|
1133
|
+
if ((lane.lanes?.length ?? 0) > 0)
|
|
1134
|
+
collect(lane.lanes ?? []);
|
|
1135
|
+
else
|
|
1136
|
+
for (const member of lane.members ?? [])
|
|
1137
|
+
leafOf.set(member, lane.id);
|
|
1138
|
+
}
|
|
1139
|
+
};
|
|
1140
|
+
collect(lanes);
|
|
1141
|
+
const laned = { ...process, laneSet: buildLaneSet(process, lanes, leafOf) };
|
|
1142
|
+
return fillLanes(laned, process.flowElements.map((element) => element.id));
|
|
1143
|
+
}
|
|
1144
|
+
/**
|
|
1145
|
+
* Puts each of `nodeIds` that is a top-level flow node of laned `process` and in
|
|
1146
|
+
* no lane yet into the lane {@link laneForNewNode} picks, in the order given.
|
|
1147
|
+
* Other ids are skipped. Returns `process` itself when it has no lanes.
|
|
1148
|
+
*/
|
|
1149
|
+
export function fillLanes(process, nodeIds) {
|
|
1150
|
+
if (process.laneSet === undefined)
|
|
1151
|
+
return process;
|
|
1152
|
+
const types = new Map(process.flowElements.map((element) => [element.id, element.type]));
|
|
1153
|
+
let laned = process;
|
|
1154
|
+
// One pass in the order given: an unlisted node whose only neighbours are
|
|
1155
|
+
// later unlisted nodes lands in the first leaf. Models leave single nodes
|
|
1156
|
+
// unlisted, not whole chains; a chain would need passes until nothing moves.
|
|
1157
|
+
for (const id of nodeIds) {
|
|
1158
|
+
const type = types.get(id);
|
|
1159
|
+
if (type === undefined || DATA_ELEMENT_TYPES.has(type) || laneOf(laned, id) !== undefined) {
|
|
1160
|
+
continue;
|
|
1161
|
+
}
|
|
1162
|
+
const lane = laneForNewNode(laned, id);
|
|
1163
|
+
if (lane !== undefined)
|
|
1164
|
+
laned = assignLane(laned, id, lane.id);
|
|
1165
|
+
}
|
|
1166
|
+
return laned;
|
|
1167
|
+
}
|
|
1168
|
+
/**
|
|
1169
|
+
* The first collaboration `compact` describes, under the first free
|
|
1170
|
+
* `Collaboration_<n>` id given the ids already taken. Empty without
|
|
1171
|
+
* participants or message flows.
|
|
1172
|
+
*/
|
|
1173
|
+
export function expandCollaborations(compact, ids) {
|
|
1174
|
+
const participants = compact.participants ?? [];
|
|
1175
|
+
const messageFlows = compact.messageFlows ?? [];
|
|
1176
|
+
if (participants.length === 0 && messageFlows.length === 0)
|
|
1177
|
+
return [];
|
|
1178
|
+
// Bounded: at most ids.size candidates can be taken.
|
|
1179
|
+
let n = 1;
|
|
1180
|
+
while (ids.has(`Collaboration_${n}`) && n <= ids.size)
|
|
1181
|
+
n++;
|
|
1182
|
+
return [
|
|
1183
|
+
{
|
|
1184
|
+
id: `Collaboration_${n}`,
|
|
1185
|
+
participants: participants.map((participant) => ({
|
|
1186
|
+
id: participant.id,
|
|
1187
|
+
name: participant.name,
|
|
1188
|
+
processRef: participant.processId,
|
|
1189
|
+
unknownAttributes: {},
|
|
1190
|
+
})),
|
|
1191
|
+
messageFlows: messageFlows.map((flow) => ({
|
|
1192
|
+
id: flow.id,
|
|
1193
|
+
name: flow.name,
|
|
1194
|
+
sourceRef: flow.source,
|
|
1195
|
+
targetRef: flow.target,
|
|
1196
|
+
unknownAttributes: {},
|
|
1197
|
+
})),
|
|
1198
|
+
textAnnotations: [],
|
|
1199
|
+
associations: [],
|
|
1200
|
+
groups: [],
|
|
1201
|
+
extensionElements: [],
|
|
1202
|
+
unknownAttributes: {},
|
|
1203
|
+
},
|
|
1204
|
+
];
|
|
966
1205
|
}
|
|
967
1206
|
/**
|
|
968
1207
|
* Restores a {@link CompactDiagram} (produced by {@link compactify} or an AI
|
|
@@ -974,9 +1213,19 @@ function expandProcess(compact, roots) {
|
|
|
974
1213
|
* Then `assertDeployable` refuses what Zeebe would reject, unless
|
|
975
1214
|
* `options.validate` is `false`.
|
|
976
1215
|
*
|
|
1216
|
+
* A diagram with lanes, participants or message flows becomes one collaboration:
|
|
1217
|
+
* every process with content gets a pool (a synthesized `Participant_<processId>`
|
|
1218
|
+
* when none names it), and the whole diagram is laid out on one plane bound to
|
|
1219
|
+
* the collaboration. Without them, each process is laid out on its own plane,
|
|
1220
|
+
* exactly as before lanes existed.
|
|
1221
|
+
*
|
|
977
1222
|
* @throws {Error} When the diagram cannot be valid BPMN — a flow or boundary
|
|
978
1223
|
* event naming an element that is not in its scope, a duplicate or missing id,
|
|
979
|
-
*
|
|
1224
|
+
* an unknown `eventType`, or a lane member that is not a top-level flow node of
|
|
1225
|
+
* its process, sits in two lanes or sits on a lane with child lanes. The message
|
|
1226
|
+
* lists every such problem at once. Pool problems (a participant naming a
|
|
1227
|
+
* missing process, a message-flow end in no pool, a message flow inside one
|
|
1228
|
+
* pool) are reported by a second check once those pass.
|
|
980
1229
|
* @throws {DeployabilityError} When the gate runs and Zeebe would reject the model.
|
|
981
1230
|
*
|
|
982
1231
|
* @example
|
|
@@ -989,19 +1238,43 @@ function expandProcess(compact, roots) {
|
|
|
989
1238
|
*/
|
|
990
1239
|
export function expand(compact, options = {}) {
|
|
991
1240
|
assertCompactDiagram(compact, "expand");
|
|
992
|
-
const problems = compactProblems(compact);
|
|
1241
|
+
const { problems, ids } = compactProblems(compact);
|
|
993
1242
|
if (problems.length > 0) {
|
|
994
1243
|
throw new Error(`expand: invalid CompactDiagram — ${problems.join("; ")}`);
|
|
995
1244
|
}
|
|
996
1245
|
const roots = new CompactRoots();
|
|
997
|
-
const
|
|
998
|
-
const
|
|
999
|
-
|
|
1000
|
-
const { process, diagram } = expandProcess(cp, roots);
|
|
1001
|
-
processes.push(process);
|
|
1002
|
-
diagrams.push(diagram);
|
|
1003
|
-
}
|
|
1246
|
+
const pooled = isPooled(compact);
|
|
1247
|
+
const executable = executability(compact, pooled);
|
|
1248
|
+
const processes = compact.processes.map((cp, index) => expandProcess(cp, executable[index] ?? true, roots));
|
|
1004
1249
|
const gate = options.validate !== false;
|
|
1250
|
+
const defs = expandDefinitions(compact, processes, roots, gate);
|
|
1251
|
+
const definitions = pooled
|
|
1252
|
+
? expandPools(compact, defs, ids)
|
|
1253
|
+
: { ...defs, diagrams: processes.map((process) => buildDiagram(process.id, process)) };
|
|
1254
|
+
if (!gate)
|
|
1255
|
+
return definitions;
|
|
1256
|
+
return assertDeployable(definitions, {
|
|
1257
|
+
camundaVersion: normalizeCamundaVersion(options.camundaVersion ?? compact.executionPlatformVersion),
|
|
1258
|
+
placeholders: options.placeholders ?? false,
|
|
1259
|
+
}).definitions;
|
|
1260
|
+
}
|
|
1261
|
+
/** `defs` with the pools and lanes `compact` describes, laid out on one collaboration plane. */
|
|
1262
|
+
function expandPools(compact, defs, ids) {
|
|
1263
|
+
const withPools = poolLanedProcesses({
|
|
1264
|
+
...defs,
|
|
1265
|
+
collaborations: expandCollaborations(compact, ids),
|
|
1266
|
+
processes: defs.processes.map((process, index) => withLanes(process, compact.processes[index]?.lanes)),
|
|
1267
|
+
});
|
|
1268
|
+
// Checked on the built model: a message flow's ends and a pool's process
|
|
1269
|
+
// can only be judged once every pool, synthesized ones included, exists.
|
|
1270
|
+
const poolProblems = collaborationProblems(withPools);
|
|
1271
|
+
if (poolProblems.length > 0) {
|
|
1272
|
+
throw new Error(`expand: invalid CompactDiagram — ${poolProblems.join("; ")}`);
|
|
1273
|
+
}
|
|
1274
|
+
return applyAutoLayout(withPools);
|
|
1275
|
+
}
|
|
1276
|
+
/** The definitions around `processes`, with no collaborations and no diagram. */
|
|
1277
|
+
function expandDefinitions(compact, processes, roots, gate) {
|
|
1005
1278
|
const platform = compact.executionPlatformVersion;
|
|
1006
1279
|
// Gated output is Camunda 8 output: marking it so makes `Bpmn.export`'s "auto" check agree.
|
|
1007
1280
|
const camunda8 = gate || platform !== undefined;
|
|
@@ -1026,13 +1299,8 @@ export function expand(compact, options = {}) {
|
|
|
1026
1299
|
signals: roots.signals,
|
|
1027
1300
|
collaborations: [],
|
|
1028
1301
|
processes,
|
|
1029
|
-
diagrams,
|
|
1302
|
+
diagrams: [],
|
|
1030
1303
|
};
|
|
1031
|
-
|
|
1032
|
-
return definitions;
|
|
1033
|
-
return assertDeployable(definitions, {
|
|
1034
|
-
camundaVersion: normalizeCamundaVersion(options.camundaVersion ?? platform),
|
|
1035
|
-
placeholders: options.placeholders ?? false,
|
|
1036
|
-
}).definitions;
|
|
1304
|
+
return definitions;
|
|
1037
1305
|
}
|
|
1038
1306
|
//# sourceMappingURL=compact.js.map
|
|
@@ -80,10 +80,29 @@ export declare function applyBpmnOperations(definitions: BpmnDefinitions, operat
|
|
|
80
80
|
* a multi-process document means "this is how that process should look", not
|
|
81
81
|
* "delete the others".
|
|
82
82
|
*
|
|
83
|
+
* Lanes, pools and executability follow the same rule: a key the compact leaves
|
|
84
|
+
* out leaves that part of the model alone. A process's `lanes` rebuilds its
|
|
85
|
+
* membership (an empty list removes the lane set), keeping the attributes and
|
|
86
|
+
* extensions of every lane whose id survives; members that are not top-level
|
|
87
|
+
* flow nodes are dropped and unlisted nodes are placed as {@link expand} places
|
|
88
|
+
* them. `participants` and `messageFlows` replace those of the first
|
|
89
|
+
* collaboration, keeping what the compact form does not carry (`messageRef`,
|
|
90
|
+
* extensions, foreign attributes) on every id that survives. A lane, pool or
|
|
91
|
+
* message flow listed without a `name` has none, as {@link compactify} writes
|
|
92
|
+
* it, so a compact edit can remove a name. A laned process
|
|
93
|
+
* without a pool then gets one. A process the compact adds gets the
|
|
94
|
+
* `isExecutable` {@link expand} would give it, so a keyless partner pool is
|
|
95
|
+
* not executable. Without the keys, a deleted node still leaves
|
|
96
|
+
* its lanes and message flows, and an inserted one joins its predecessor's lane.
|
|
97
|
+
*
|
|
83
98
|
* @param definitions - The model to update. Never mutated.
|
|
84
99
|
* @param compact - The intended topology.
|
|
85
100
|
* @param options - `strict` (default `true`) throws instead of returning problems.
|
|
86
101
|
* @returns The updated model, plus what applied and what did not.
|
|
102
|
+
* @throws Error, in either mode, when the result would carry an id used twice
|
|
103
|
+
* or a collaboration problem (a dangling message end or process reference, a
|
|
104
|
+
* message inside one pool) that `definitions` did not already have: the
|
|
105
|
+
* input is invalid, as {@link expand} would find it.
|
|
87
106
|
*/
|
|
88
107
|
export declare function reconcileCompact(definitions: BpmnDefinitions, compact: CompactDiagram, options?: ApplyBpmnOperationsOptions): ApplyBpmnOperationsResult;
|
|
89
108
|
//# sourceMappingURL=full-operations.d.ts.map
|