@uipath/maestro-builder-sdk 6.120.0 → 6.120.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/bpmn/merge-placement.d.ts +11 -0
- package/dist/bpmn/merge-placement.js +15 -0
- package/dist/bpmn/merge.js +205 -15
- package/dist/case/decompile.js +16 -0
- package/dist/case/preserve.d.ts +4 -0
- package/dist/case/serialize.js +11 -0
- package/package.json +2 -2
|
@@ -23,6 +23,17 @@ export interface BpmnPlacementOptions {
|
|
|
23
23
|
*/
|
|
24
24
|
rescoped?: ReadonlySet<string>;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* The size a node's shape takes when the edit changed its type, or undefined when it keeps
|
|
28
|
+
* its own: a change of kind (activity, event, gateway) draws the new kind at its default
|
|
29
|
+
* size, and so does an expanded sub-process made into another activity, which has nothing
|
|
30
|
+
* left to show inside. Within a kind the shape keeps its bounds, where Studio Web's
|
|
31
|
+
* change-element resets every retyped node to its default size.
|
|
32
|
+
*/
|
|
33
|
+
export declare function retypedShapeSize(from: string, to: string): {
|
|
34
|
+
w: number;
|
|
35
|
+
h: number;
|
|
36
|
+
} | undefined;
|
|
26
37
|
/**
|
|
27
38
|
* Draw the flow nodes and sequence flows the edit added, and only those, into the
|
|
28
39
|
* document's existing diagram. See the file header for the rules.
|
|
@@ -101,6 +101,21 @@ function sizeOf(local, rendering) {
|
|
|
101
101
|
return { w: 350, h: 200 };
|
|
102
102
|
return { w: 100, h: 80 };
|
|
103
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* The size a node's shape takes when the edit changed its type, or undefined when it keeps
|
|
106
|
+
* its own: a change of kind (activity, event, gateway) draws the new kind at its default
|
|
107
|
+
* size, and so does an expanded sub-process made into another activity, which has nothing
|
|
108
|
+
* left to show inside. Within a kind the shape keeps its bounds, where Studio Web's
|
|
109
|
+
* change-element resets every retyped node to its default size.
|
|
110
|
+
*/
|
|
111
|
+
export function retypedShapeSize(from, to) {
|
|
112
|
+
if (!isFlowNode(from) || !isFlowNode(to))
|
|
113
|
+
return undefined;
|
|
114
|
+
const kind = (local) => (EVENTS.has(local) ? 'event' : GATEWAYS.has(local) ? 'gateway' : 'activity');
|
|
115
|
+
if (kind(from) === kind(to) && !(SUB_PROCESSES.has(from) && !SUB_PROCESSES.has(to)))
|
|
116
|
+
return undefined;
|
|
117
|
+
return sizeOf(to, 'collapsed');
|
|
118
|
+
}
|
|
104
119
|
const num = (value) => Number(value ?? 0);
|
|
105
120
|
function boxOf(range) {
|
|
106
121
|
const a = range.attributes;
|
package/dist/bpmn/merge.js
CHANGED
|
@@ -61,14 +61,32 @@
|
|
|
61
61
|
* removed it and it stays. Nothing in this file needs to know what those payloads
|
|
62
62
|
* mean.
|
|
63
63
|
*
|
|
64
|
+
* ## A changed element type
|
|
65
|
+
*
|
|
66
|
+
* An edit that turns a `bpmn:task` into a `bpmn:scriptTask` keeps its id, so the element
|
|
67
|
+
* pairs with the original's and merges three ways like any other, under the edited tag
|
|
68
|
+
* (with the original's prefix). Whether the type changed is read from the baseline and
|
|
69
|
+
* the edit, not the original, so a type the round trip does not reproduce is left alone.
|
|
70
|
+
* Keeping the original's tag wrote a `bpmn:task` with a `bpmn:script`, which Studio Web's
|
|
71
|
+
* parser drops on load. What the old type defines and the new one does not goes, per
|
|
72
|
+
* bpmn-moddle's schema (`retypeDropped`): `scriptFormat`, `implementation`, `rendering`, a
|
|
73
|
+
* gateway's `default`, and a sub-process's flow elements and artifacts. Everything else the
|
|
74
|
+
* original holds and the round trip does not carry stays, as does its wiring. Its shape
|
|
75
|
+
* keeps its bounds unless the node changed kind (activity, event, gateway) or stopped being
|
|
76
|
+
* a sub-process: then it is redrawn at the new kind's default size around its old centre,
|
|
77
|
+
* without its label, and its flows are routed again; a sub-process's own diagram goes with
|
|
78
|
+
* it (`withRetypedShapes`). Studio Web's change-element resets the size on every retype and
|
|
79
|
+
* keeps the top-left corner; the merge moves as little of the diagram as a valid one needs.
|
|
80
|
+
*
|
|
64
81
|
* ## What it does not repair
|
|
65
82
|
*
|
|
66
83
|
* A bare `<uipath:input name="args">`, which `uip maestro bpmn validate` rejects (the row
|
|
67
84
|
* must declare `type="json"` and target `"bodyField"`), stays bare unless the author
|
|
68
85
|
* edits that row: the merge changes what the edit changed and nothing else.
|
|
69
86
|
*/
|
|
87
|
+
import BpmnModdle from 'bpmn-moddle';
|
|
70
88
|
import { ownEntry } from '../core/own-entry.js';
|
|
71
|
-
import { placeAddedElements } from './merge-placement.js';
|
|
89
|
+
import { placeAddedElements, retypedShapeSize } from './merge-placement.js';
|
|
72
90
|
import { findByLocal, parseXmlRanges } from './xml-ranges.js';
|
|
73
91
|
const WIRING = new Set(['incoming', 'outgoing']);
|
|
74
92
|
const isWiring = (range) => WIRING.has(range.local);
|
|
@@ -269,10 +287,14 @@ function mergeAttributes(original, baseline, edited) {
|
|
|
269
287
|
merged.set(name, edited[name]);
|
|
270
288
|
return merged;
|
|
271
289
|
}
|
|
272
|
-
/**
|
|
273
|
-
|
|
290
|
+
/**
|
|
291
|
+
* The original open tag, patched to carry `attributes`, and named `name` when the edit
|
|
292
|
+
* changed the element's type: same spelling for every attribute it keeps.
|
|
293
|
+
*/
|
|
294
|
+
function openTag(original, attributes, selfClosing, name) {
|
|
274
295
|
const { xml, range } = original;
|
|
275
|
-
const
|
|
296
|
+
const written = xml.slice(range.start, range.innerStart);
|
|
297
|
+
const tag = name === range.name ? written : `<${name}${written.slice(1 + range.name.length)}`;
|
|
276
298
|
const wasSelfClosing = range.innerStart === range.end;
|
|
277
299
|
const own = Object.entries(range.attributes);
|
|
278
300
|
if (selfClosing === wasSelfClosing && own.length === attributes.size && own.every(([k, v]) => attributes.get(k) === v))
|
|
@@ -367,6 +389,68 @@ function changedPart(baseline, edited) {
|
|
|
367
389
|
}
|
|
368
390
|
return spliceChildren(edited, edits);
|
|
369
391
|
}
|
|
392
|
+
let schema;
|
|
393
|
+
const featureCache = new Map();
|
|
394
|
+
const lowerFirst = (name) => `${name.charAt(0).toLowerCase()}${name.slice(1)}`;
|
|
395
|
+
/**
|
|
396
|
+
* The names an element of BPMN type `local` (`scriptTask`) may carry: its attributes, and
|
|
397
|
+
* its child elements, by property name and by the tag of every type a contained child can
|
|
398
|
+
* have (`renderings` is written `bpmn:rendering`; a sub-process's `flowElements` are
|
|
399
|
+
* `bpmn:task`, `bpmn:sequenceFlow`, …). References (`incoming`) name no contained type.
|
|
400
|
+
* Read from bpmn-moddle, the model Studio Web parses with; undefined for a name that is
|
|
401
|
+
* no BPMN type.
|
|
402
|
+
*/
|
|
403
|
+
function bpmnFeatures(local) {
|
|
404
|
+
if (featureCache.has(local))
|
|
405
|
+
return featureCache.get(local);
|
|
406
|
+
schema ??= new BpmnModdle();
|
|
407
|
+
const model = schema;
|
|
408
|
+
const bpmnType = (name) => `bpmn:${name.charAt(0).toUpperCase()}${name.slice(1)}`;
|
|
409
|
+
const type = bpmnType(local);
|
|
410
|
+
let names;
|
|
411
|
+
if (model.getTypeDescriptor(type)) {
|
|
412
|
+
names = new Set();
|
|
413
|
+
const types = model.getPackage('bpmn').types.map((t) => t.name);
|
|
414
|
+
for (const property of model.getElementDescriptor(model.getType(type)).properties) {
|
|
415
|
+
names.add(property.name);
|
|
416
|
+
if (property.isAttr || property.isReference || !property.type.startsWith('bpmn:'))
|
|
417
|
+
continue;
|
|
418
|
+
for (const name of types)
|
|
419
|
+
if (Object.hasOwn(model.getElementDescriptor(model.getType(`bpmn:${name}`)).allTypesByName, property.type))
|
|
420
|
+
names.add(lowerFirst(name));
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
featureCache.set(local, names);
|
|
424
|
+
return names;
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* When the edit changed an element's type (a `bpmn:task` made a `bpmn:scriptTask`), what
|
|
428
|
+
* the original's element holds that its old type defines and the new one does not: a
|
|
429
|
+
* ScriptTask's `scriptFormat` and `script` on the way back to a Task, a UserTask's
|
|
430
|
+
* `implementation` and `rendering` on the way to a ScriptTask. Studio Web's change-element
|
|
431
|
+
* keeps the node and swaps its type; a parser of the new type has no place for these, so
|
|
432
|
+
* they go even when the round trip does not carry them. Empty without a type change, or
|
|
433
|
+
* when either side is no BPMN type.
|
|
434
|
+
*/
|
|
435
|
+
function retypeDropped(baseline, edited) {
|
|
436
|
+
if (baseline.range.local === edited.range.local)
|
|
437
|
+
return new Set();
|
|
438
|
+
const before = bpmnFeatures(baseline.range.local);
|
|
439
|
+
const after = bpmnFeatures(edited.range.local);
|
|
440
|
+
if (!before || !after)
|
|
441
|
+
return new Set();
|
|
442
|
+
return new Set([...before].filter((name) => !after.has(name)));
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* The merged element's tag: the original's, unless the edit changed the type (the edited
|
|
446
|
+
* element's differs from the baseline's), then the edited type under the original's prefix.
|
|
447
|
+
* Decided against the baseline, not the original, so an element the round trip writes as
|
|
448
|
+
* another type keeps its own tag through an edit that leaves the type alone.
|
|
449
|
+
*/
|
|
450
|
+
function retypedName(original, baseline, edited) {
|
|
451
|
+
const { name, local } = original.range;
|
|
452
|
+
return baseline.range.local === edited.range.local ? name : `${name.slice(0, name.length - local.length)}${edited.range.local}`;
|
|
453
|
+
}
|
|
370
454
|
/**
|
|
371
455
|
* One element, three ways. Untouched (the edit equals the baseline, wiring aside) with
|
|
372
456
|
* its wiring unchanged, it is the original's text. Otherwise it is rebuilt from the
|
|
@@ -386,17 +470,24 @@ function mergeNode(original, baseline, edited, ctx) {
|
|
|
386
470
|
ctx.preserved.push(child.id);
|
|
387
471
|
return textOf(original.xml, original.range);
|
|
388
472
|
}
|
|
473
|
+
const dropped = retypeDropped(baseline, edited);
|
|
389
474
|
const attributes = mergeAttributes(original.range.attributes, baseline.range.attributes, edited.range.attributes);
|
|
475
|
+
for (const name of attributes.keys())
|
|
476
|
+
if (dropped.has(name) && !Object.hasOwn(edited.range.attributes, name))
|
|
477
|
+
attributes.delete(name);
|
|
390
478
|
const leaf = (element) => element.range.children.length === 0;
|
|
391
479
|
const inner = (element) => element.xml.slice(element.range.innerStart, element.range.innerEnd);
|
|
392
|
-
const
|
|
480
|
+
const isLeaf = leaf(original) && leaf(baseline) && leaf(edited);
|
|
481
|
+
const body = isLeaf
|
|
393
482
|
? (inner(edited) === inner(baseline) ? inner(original) : asWritten(inner(original), inner(edited)))
|
|
394
|
-
: mergeChildren(original, baseline, edited, wiring, ctx);
|
|
395
|
-
|
|
396
|
-
|
|
483
|
+
: mergeChildren(original, baseline, edited, wiring, dropped, ctx);
|
|
484
|
+
const name = retypedName(original, baseline, edited);
|
|
485
|
+
// Merged children that all went leave only the whitespace that sat between them.
|
|
486
|
+
if (body === '' || (!isLeaf && body.trim() === ''))
|
|
487
|
+
return openTag(original, attributes, true, name);
|
|
397
488
|
const { range } = original;
|
|
398
|
-
const close = range.innerStart === range.end ? `</${
|
|
399
|
-
return `${openTag(original, attributes, false)}${body}${close}`;
|
|
489
|
+
const close = range.innerStart === range.end || name !== range.name ? `</${name}>` : original.xml.slice(range.innerEnd, range.end);
|
|
490
|
+
return `${openTag(original, attributes, false, name)}${body}${close}`;
|
|
400
491
|
}
|
|
401
492
|
/**
|
|
402
493
|
* The children of an element the merge rebuilds, from the original's: in the original's
|
|
@@ -404,7 +495,7 @@ function mergeNode(original, baseline, edited, ctx) {
|
|
|
404
495
|
* original's wiring sat, and what the edit added placed among its neighbours the way the
|
|
405
496
|
* edited document orders them.
|
|
406
497
|
*/
|
|
407
|
-
function mergeChildren(original, baseline, edited, wiring, ctx) {
|
|
498
|
+
function mergeChildren(original, baseline, edited, wiring, dropped, ctx) {
|
|
408
499
|
const originalChildren = original.range.children;
|
|
409
500
|
const editedChildren = edited.range.children;
|
|
410
501
|
const originalPayload = originalChildren.filter((child) => !isWiring(child));
|
|
@@ -435,8 +526,12 @@ function mergeChildren(original, baseline, edited, wiring, ctx) {
|
|
|
435
526
|
const lead = original.xml.slice(at, child.start);
|
|
436
527
|
at = child.end;
|
|
437
528
|
if (isWiring(child)) {
|
|
438
|
-
if (!wiring)
|
|
439
|
-
|
|
529
|
+
if (!wiring) {
|
|
530
|
+
// Unchanged wiring still anchors what the edit adds: an added `extensionElements` goes before it.
|
|
531
|
+
const flow = original.xml.slice(child.innerStart, child.innerEnd).trim();
|
|
532
|
+
const editedAt = editedChildren.findIndex((e) => e.local === child.local && edited.xml.slice(e.innerStart, e.innerEnd).trim() === flow);
|
|
533
|
+
pieces.push({ lead, text: textOf(original.xml, child), editedAt: editedAt < 0 ? undefined : editedAt });
|
|
534
|
+
}
|
|
440
535
|
else if (!wiringPlaced) {
|
|
441
536
|
// The merged wiring replaces all of the original's, written where its first entry sat.
|
|
442
537
|
wiringPlaced = true;
|
|
@@ -455,6 +550,9 @@ function mergeChildren(original, baseline, edited, wiring, ctx) {
|
|
|
455
550
|
const text = mergeNode(locate(original, child), base && locate(baseline, base), locate(edited, counterpart), ctx);
|
|
456
551
|
pieces.push({ lead, text, editedAt: editedIndex.get(counterpart) });
|
|
457
552
|
}
|
|
553
|
+
else if (dropped.has(child.local)) {
|
|
554
|
+
// The edit changed the element's type, and the new one has no place for this child.
|
|
555
|
+
}
|
|
458
556
|
else if (!originalToBaseline.has(child)) {
|
|
459
557
|
// The round trip does not carry it, so the edit could not have removed it. Except a
|
|
460
558
|
// binding row: decompile drops one nothing reads, and a bindings block the edit
|
|
@@ -667,15 +765,107 @@ function scopes(xml) {
|
|
|
667
765
|
root.children.filter((c) => c.local === 'process').forEach(visit);
|
|
668
766
|
return parents;
|
|
669
767
|
}
|
|
768
|
+
/** Each element's local name, by id, for every element under the document's processes. */
|
|
769
|
+
function localsById(xml) {
|
|
770
|
+
const locals = new Map();
|
|
771
|
+
const visit = (range) => {
|
|
772
|
+
if (range.id !== undefined)
|
|
773
|
+
locals.set(range.id, range.local);
|
|
774
|
+
range.children.forEach(visit);
|
|
775
|
+
};
|
|
776
|
+
for (const root of parseXmlRanges(xml))
|
|
777
|
+
root.children.filter((c) => c.local === 'process').forEach((p) => p.children.forEach(visit));
|
|
778
|
+
return locals;
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* Drop every diagram whose plane draws an element the merge removed: the diagram a
|
|
782
|
+
* collapsed sub-process draws its contents in, when the sub-process was deleted, retyped,
|
|
783
|
+
* or went with a sub-process it sat in. A plane that already pointed nowhere in the
|
|
784
|
+
* original is left as it was.
|
|
785
|
+
*/
|
|
786
|
+
function withoutOrphanDiagrams(originalIds, merged) {
|
|
787
|
+
const kept = modelIds(merged);
|
|
788
|
+
const orphans = parseXmlRanges(merged).flatMap((root) => root.children.filter((diagram) => {
|
|
789
|
+
if (diagram.local !== 'BPMNDiagram')
|
|
790
|
+
return false;
|
|
791
|
+
const element = diagram.children.find((c) => c.local === 'BPMNPlane')?.attributes.bpmnElement;
|
|
792
|
+
return element !== undefined && originalIds.has(element) && !kept.has(element);
|
|
793
|
+
}));
|
|
794
|
+
return orphans.length ? replaceRanges(merged, orphans.map((range) => ({ range, text: '' }))) : merged;
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Redraw, at the new kind's default size around the same centre and without its label, the
|
|
798
|
+
* shape of a node the edit changed into another kind (a task into an event, an expanded
|
|
799
|
+
* sub-process into a task: `retypedShapeSize`). A node that is no longer a sub-process
|
|
800
|
+
* loses `isExpanded` and the diagram a collapsed one draws its contents in. Returns the
|
|
801
|
+
* ids it resized, whose flows are then routed again.
|
|
802
|
+
*/
|
|
803
|
+
function withRetypedShapes(originalXml, merged) {
|
|
804
|
+
const before = localsById(originalXml);
|
|
805
|
+
const sizes = new Map();
|
|
806
|
+
const after = localsById(merged);
|
|
807
|
+
for (const [id, local] of after) {
|
|
808
|
+
const was = before.get(id);
|
|
809
|
+
const size = was === undefined || was === local ? undefined : retypedShapeSize(was, local);
|
|
810
|
+
if (size)
|
|
811
|
+
sizes.set(id, size);
|
|
812
|
+
}
|
|
813
|
+
const SUB = /^(subProcess|adHocSubProcess|transaction)$/;
|
|
814
|
+
const unnested = new Set([...after].filter(([id, local]) => !SUB.test(local) && SUB.test(before.get(id) ?? '')).map(([id]) => id));
|
|
815
|
+
if (!sizes.size && !unnested.size)
|
|
816
|
+
return { xml: merged, resized: new Set() };
|
|
817
|
+
const edits = [];
|
|
818
|
+
const quoted = (n) => `"${Math.round(n * 100) / 100}"`;
|
|
819
|
+
for (const shape of allByLocal(parseXmlRanges(merged), 'BPMNShape')) {
|
|
820
|
+
const id = shape.attributes.bpmnElement;
|
|
821
|
+
const size = id === undefined ? undefined : sizes.get(id);
|
|
822
|
+
if (!size)
|
|
823
|
+
continue;
|
|
824
|
+
const bounds = shape.children.find((c) => c.local === 'Bounds');
|
|
825
|
+
if (!bounds)
|
|
826
|
+
continue;
|
|
827
|
+
const box = ['x', 'y', 'width', 'height'].map((k) => Number(bounds.attributes[k] ?? 0));
|
|
828
|
+
const values = {
|
|
829
|
+
x: box[0] + (box[2] - size.w) / 2, y: box[1] + (box[3] - size.h) / 2, width: size.w, height: size.h,
|
|
830
|
+
};
|
|
831
|
+
const set = (tag, name, value) => tag.replace(new RegExp(`(\\s${name}\\s*=\\s*)("[^"]*"|'[^']*')`), (_all, lead) => `${lead}${value}`);
|
|
832
|
+
let open = merged.slice(shape.start, bounds.start);
|
|
833
|
+
if (!SUB.test(after.get(id)))
|
|
834
|
+
open = open.replace(/\s+isExpanded\s*=\s*("[^"]*"|'[^']*')/, '');
|
|
835
|
+
let tag = merged.slice(bounds.start, bounds.end);
|
|
836
|
+
for (const [name, value] of Object.entries(values))
|
|
837
|
+
tag = set(tag, name, quoted(value));
|
|
838
|
+
// The label was placed for the old kind's shape; the designer places one anew without it.
|
|
839
|
+
const label = shape.children.find((c) => c.local === 'BPMNLabel');
|
|
840
|
+
const rest = label && label.start >= bounds.end
|
|
841
|
+
? merged.slice(bounds.end, whitespaceStart(merged, label.start)) + merged.slice(label.end, shape.end)
|
|
842
|
+
: merged.slice(bounds.end, shape.end);
|
|
843
|
+
edits.push({ range: shape, text: open + tag + rest });
|
|
844
|
+
}
|
|
845
|
+
// A collapsed sub-process draws its contents in a diagram of its own, which a node that
|
|
846
|
+
// is no longer a sub-process has no use for.
|
|
847
|
+
for (const diagram of parseXmlRanges(merged).flatMap((root) => root.children.filter((c) => c.local === 'BPMNDiagram'))) {
|
|
848
|
+
const plane = diagram.children.find((c) => c.local === 'BPMNPlane');
|
|
849
|
+
if (plane?.attributes.bpmnElement !== undefined && unnested.has(plane.attributes.bpmnElement))
|
|
850
|
+
edits.push({ range: diagram, text: '' });
|
|
851
|
+
}
|
|
852
|
+
return { xml: replaceRanges(merged, edits), resized: new Set(sizes.keys()) };
|
|
853
|
+
}
|
|
670
854
|
/**
|
|
671
855
|
* Draw what the edit added into the original's diagram (merge-placement.ts): a shape for
|
|
672
856
|
* each new flow node, an edge for each new sequence flow, and a new route for a kept flow
|
|
673
857
|
* whose ends the edit moved.
|
|
674
858
|
*/
|
|
675
|
-
function withPlacement(originalXml,
|
|
859
|
+
function withPlacement(originalXml, mergedXml) {
|
|
676
860
|
const originalIds = modelIds(originalXml);
|
|
677
861
|
const before = flowEnds(originalXml);
|
|
678
|
-
const
|
|
862
|
+
const { xml: merged, resized } = withRetypedShapes(originalXml, withoutOrphanDiagrams(originalIds, mergedXml));
|
|
863
|
+
const rewired = new Set([...flowEnds(merged)].filter(([id, ends]) => {
|
|
864
|
+
if (!before.has(id))
|
|
865
|
+
return false;
|
|
866
|
+
const [source, target] = ends.split('->');
|
|
867
|
+
return before.get(id) !== ends || resized.has(source) || resized.has(target);
|
|
868
|
+
}).map(([id]) => id));
|
|
679
869
|
const scopeBefore = scopes(originalXml);
|
|
680
870
|
const rescoped = new Set([...scopes(merged)].filter(([id, scope]) => scopeBefore.has(id) && scopeBefore.get(id) !== scope).map(([id]) => id));
|
|
681
871
|
const { xml, report } = placeAddedElements(merged, { isAdded: (id) => !originalIds.has(id), rewired, rescoped });
|
package/dist/case/decompile.js
CHANGED
|
@@ -2296,9 +2296,25 @@ function conditionIdentityOf(condition, ambiguousSlas = new Map(), siblings = [c
|
|
|
2296
2296
|
...(rule.uipath?.outputs?.length
|
|
2297
2297
|
? { outputs: rule.uipath.outputs.map((row) => ({ name: row.name ?? '', ...(row.id ? { id: row.id } : {}) })) }
|
|
2298
2298
|
: {}),
|
|
2299
|
+
// Its input rows (the event `body` subscription) carry ids too, which
|
|
2300
|
+
// compile mints as `v<name>`; a Designer row's own id comes back.
|
|
2301
|
+
...(ruleInputIdentity(rule.uipath?.inputs)),
|
|
2299
2302
|
}))),
|
|
2300
2303
|
};
|
|
2301
2304
|
}
|
|
2305
|
+
/**
|
|
2306
|
+
* A wait-for-connector rule's input rows by name and id (`conditionIdentityOf`),
|
|
2307
|
+
* when one has an id compile would not mint: compile writes `v<name>`
|
|
2308
|
+
* (`vbody`), so an SDK-written rule records nothing.
|
|
2309
|
+
*/
|
|
2310
|
+
function ruleInputIdentity(inputs) {
|
|
2311
|
+
if (!Array.isArray(inputs))
|
|
2312
|
+
return {};
|
|
2313
|
+
const rows = inputs;
|
|
2314
|
+
if (!rows.some((row) => typeof row?.id === 'string' && row.id !== `v${String(row?.name ?? '')}`))
|
|
2315
|
+
return {};
|
|
2316
|
+
return { inputs: rows.map((row) => ({ name: typeof row?.name === 'string' ? row.name : '', ...(typeof row?.id === 'string' ? { id: row.id } : {}) })) };
|
|
2317
|
+
}
|
|
2302
2318
|
function slaIdentity(sla) {
|
|
2303
2319
|
return {
|
|
2304
2320
|
...(sla.id ? { id: sla.id } : {}),
|
package/dist/case/preserve.d.ts
CHANGED
package/dist/case/serialize.js
CHANGED
|
@@ -1537,6 +1537,17 @@ function applyPreservedIdentities(result, preservation, warn) {
|
|
|
1537
1537
|
pins.push({ index, rule });
|
|
1538
1538
|
if (rule.outputs)
|
|
1539
1539
|
takeOutputRows(ruleTarget?.[bagField]?.outputs ?? [], rule.outputs);
|
|
1540
|
+
if (rule.inputs) {
|
|
1541
|
+
// By name when the name is unique on both sides, else by position, as a task's inputs.
|
|
1542
|
+
const rows = ruleTarget?.[bagField]?.inputs ?? [];
|
|
1543
|
+
const once = (names, name) => names.filter((n) => n === name).length === 1;
|
|
1544
|
+
rule.inputs.forEach((row, index) => {
|
|
1545
|
+
const byName = once(rule.inputs.map((r) => r.name), row.name) && once(rows.map((r) => r?.name), row.name);
|
|
1546
|
+
const input = byName ? rows.find((r) => r?.name === row.name) : rows[index];
|
|
1547
|
+
if (input && input.name === row.name)
|
|
1548
|
+
takeRow(input, row.id, false);
|
|
1549
|
+
});
|
|
1550
|
+
}
|
|
1540
1551
|
}));
|
|
1541
1552
|
});
|
|
1542
1553
|
// Each pin goes to the condition it was saved on. Ids pair up by position,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.120.
|
|
3
|
+
"version": "6.120.2",
|
|
4
4
|
"description": "Build UiPath Flow, Case, and BPMN artifacts by writing TypeScript.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://docs.uipath.com/maestro",
|
|
@@ -124,5 +124,5 @@
|
|
|
124
124
|
"@types/node": "^22.7.0",
|
|
125
125
|
"esbuild": "^0.28.1"
|
|
126
126
|
},
|
|
127
|
-
"gitref": "
|
|
127
|
+
"gitref": "53cda99a37bbc03af9ea7b89bc2a0c60d231ac28"
|
|
128
128
|
}
|