@uipath/maestro-builder-sdk 6.86.27 → 6.87.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.
@@ -21,9 +21,10 @@
21
21
  * resolves for a package consumer; the library default in `decompile.ts` stays
22
22
  * repo-relative for in-tree callers, mirroring the Flow and Case arms.
23
23
  *
24
- * Diagram layout is not read or emitted — the SDK emits semantic-only XML and
25
- * `uip maestro bpmn format` regenerates `bpmndi`. Run it on the recompiled artifact
26
- * when a canvas needs one.
24
+ * Diagram layout is not read or emitted — the SDK emits semantic-only XML. For a
25
+ * brownfield edit, `bpmn-merge` puts the original diagram back and draws only what the
26
+ * edit added (merge-placement.ts); `uip maestro bpmn format`, which lays the whole
27
+ * diagram out again, is for a greenfield file.
27
28
  *
28
29
  * `--style nested` lifts the regions the builder's nesting constructs lower to —
29
30
  * see `BpmnDecompileOptions.style`. It is written only after both sources have been
@@ -16,9 +16,10 @@
16
16
  *
17
17
  * What does NOT survive, and why:
18
18
  *
19
- * - **`bpmndi` diagram layout.** The SDK emits none and `uip maestro bpmn format`
20
- * regenerates it, so there is nothing to preserve. A decompiled file recompiles
21
- * to semantic-only XML; re-run `format` for a canvas.
19
+ * - **`bpmndi` diagram layout.** The SDK emits none, so there is nothing to
20
+ * preserve here. A decompiled file recompiles to semantic-only XML; `bpmn-merge`
21
+ * puts the original diagram back and draws only what the edit added
22
+ * (merge-placement.ts). `format` is for a greenfield file.
22
23
  * - **Comments, method order, and formatting.** Regenerated, not preserved.
23
24
  *
24
25
  * Everything else round-trips: events and their definitions, all four gateways,
@@ -33,11 +33,29 @@ export function run(argv) {
33
33
  });
34
34
  const out = flagValue(argv, '-o') ?? 'merged.bpmn';
35
35
  writeFileSync(out, result.xml);
36
- reportResult({ path: resolve(out), preserved: result.preserved.length, authored: result.authored.length, removed: result.removed.length });
36
+ const { layout } = result;
37
+ reportResult({
38
+ path: resolve(out),
39
+ preserved: result.preserved.length,
40
+ authored: result.authored.length,
41
+ removed: result.removed.length,
42
+ placed: layout.placed.length,
43
+ routed: layout.routed.length + layout.rerouted.length,
44
+ ...(layout.resized.length || layout.moved.length ? { resized: layout.resized, moved: layout.moved } : {}),
45
+ });
37
46
  // Say what was kept and what was rewritten: on a surgical edit the preserved count
38
47
  // should dwarf the authored one, and a reader who sees otherwise has learned something.
39
48
  console.log(`bpmn-merge: wrote ${basename(out)} (${result.preserved.length} preserved, ` +
40
49
  `${result.authored.length} authored, ${result.removed.length} removed)`);
50
+ // The diagram: what the edit added is drawn, and an existing shape moves only when a
51
+ // full lane, pool or sub-process had to grow — say so, by id, when it did.
52
+ if (layout.placed.length || layout.routed.length || layout.rerouted.length) {
53
+ console.log(`bpmn-merge: drew ${layout.placed.length} new shape(s) and ${layout.routed.length + layout.rerouted.length} edge(s); ` +
54
+ (layout.resized.length || layout.moved.length
55
+ ? `no room in its container, so grew ${layout.resized.join(', ') || 'nothing'}` +
56
+ (layout.moved.length ? ` and moved ${layout.moved.join(', ')} down by the same offset` : '')
57
+ : 'every existing shape kept its bounds'));
58
+ }
41
59
  return 0;
42
60
  }
43
61
  runWhenInvokedDirectly(import.meta.url, 'bpmn-merge', run);
@@ -0,0 +1,33 @@
1
+ /** What placement did to the diagram, by semantic element id. */
2
+ export interface BpmnPlacementReport {
3
+ /** Flow nodes the edit added that now have a shape. */
4
+ placed: string[];
5
+ /** Sequence flows the edit added that now have an edge. */
6
+ routed: string[];
7
+ /** Sequence flows kept by id but rewired, whose existing edge got a new route. */
8
+ rerouted: string[];
9
+ /** Existing containers (lane, pool, expanded sub-process) grown to fit a placed node. */
10
+ resized: string[];
11
+ /** Existing shapes shifted, with every other shape below a grown container. */
12
+ moved: string[];
13
+ }
14
+ export interface BpmnPlacementOptions {
15
+ /** True for an element id the edit added (absent from the original). Only those are drawn. */
16
+ isAdded: (id: string) => boolean;
17
+ /** Ids of existing sequence flows whose source or target the edit changed. */
18
+ rewired?: ReadonlySet<string>;
19
+ /**
20
+ * Ids of existing flow nodes the edit moved into another scope (into a sub-process it
21
+ * added, say). Their old shapes sit outside their new parent, so they are drawn again
22
+ * inside it, and their flows rerouted; they are reported as `moved`.
23
+ */
24
+ rescoped?: ReadonlySet<string>;
25
+ }
26
+ /**
27
+ * Draw the flow nodes and sequence flows the edit added, and only those, into the
28
+ * document's existing diagram. See the file header for the rules.
29
+ */
30
+ export declare function placeAddedElements(xml: string, options: BpmnPlacementOptions): {
31
+ xml: string;
32
+ report: BpmnPlacementReport;
33
+ };