@uipath/maestro-builder-sdk 6.120.13 → 6.120.15
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/case/decompile.d.ts +12 -0
- package/dist/case/decompile.js +70 -0
- package/dist/case/preserve.d.ts +27 -0
- package/dist/case/preserve.js +13 -0
- package/dist/case/serialize.js +37 -0
- package/package.json +2 -2
package/dist/case/decompile.d.ts
CHANGED
|
@@ -260,6 +260,18 @@ type Preservation = {
|
|
|
260
260
|
trigger: string;
|
|
261
261
|
companion?: string;
|
|
262
262
|
}>;
|
|
263
|
+
bridgeFields?: Array<{
|
|
264
|
+
slot: string;
|
|
265
|
+
trigger: string;
|
|
266
|
+
fields: Record<string, unknown>;
|
|
267
|
+
keys: string[];
|
|
268
|
+
}>;
|
|
269
|
+
strayTriggerRows?: Array<{
|
|
270
|
+
trigger: string;
|
|
271
|
+
index: number;
|
|
272
|
+
row: Record<string, unknown>;
|
|
273
|
+
dangling?: true;
|
|
274
|
+
}>;
|
|
263
275
|
omitMetadata?: Array<'caseAppEnabled' | 'caseIdentifierType' | 'publishVersion' | 'intsvcActivityConfig'>;
|
|
264
276
|
publishVersion?: number;
|
|
265
277
|
nodeFields?: Record<string, Record<string, unknown>>;
|
package/dist/case/decompile.js
CHANGED
|
@@ -2036,6 +2036,70 @@ function triggerlessInArgs(plan) {
|
|
|
2036
2036
|
return [{ name: input.name, elementId: input.elementId, trigger, ...(companion !== undefined ? { companion } : {}) }];
|
|
2037
2037
|
});
|
|
2038
2038
|
}
|
|
2039
|
+
/** The fields compile writes on a bridge row (`appendTriggerBridge` in serialize.ts). */
|
|
2040
|
+
const BRIDGE_ROW_FIELDS = new Set(['name', 'type', 'source', 'var']);
|
|
2041
|
+
/**
|
|
2042
|
+
* Each In-arg bridge row that carries a field compile does not write (Studio
|
|
2043
|
+
* Web saves an array In-arg's bridge with the In-arg's `subType`), keyed by the
|
|
2044
|
+
* In-arg's slot id and its trigger, with the row's key order.
|
|
2045
|
+
*
|
|
2046
|
+
* Example: `{ name: "Items", type: "array", subType: "string", source: "=vars.vX", var: "items" }`
|
|
2047
|
+
* records `{ slot: "vX", trigger: "trigger_1", fields: { subType: "string" }, keys: [...] }`.
|
|
2048
|
+
*/
|
|
2049
|
+
function bridgeFields(plan) {
|
|
2050
|
+
const triggers = new Map((plan.nodes ?? []).filter(isTrigger).map((node) => [node.id, node]));
|
|
2051
|
+
return (plan.variables?.inputs ?? []).flatMap((input) => {
|
|
2052
|
+
const node = typeof input.elementId === 'string' ? triggers.get(input.elementId) : undefined;
|
|
2053
|
+
if (!node || typeof node.id !== 'string' || typeof input.id !== 'string')
|
|
2054
|
+
return [];
|
|
2055
|
+
const row = (triggerData(node).bag?.outputs ?? []).find((candidate) => candidate?.source === `=vars.${input.id}`);
|
|
2056
|
+
if (!row)
|
|
2057
|
+
return [];
|
|
2058
|
+
const fields = Object.fromEntries(Object.entries(row).filter(([key]) => !BRIDGE_ROW_FIELDS.has(key)));
|
|
2059
|
+
if (!Object.keys(fields).length)
|
|
2060
|
+
return [];
|
|
2061
|
+
return [{ slot: input.id, trigger: node.id, fields, keys: Object.keys(row) }];
|
|
2062
|
+
});
|
|
2063
|
+
}
|
|
2064
|
+
/**
|
|
2065
|
+
* The rows of a manual or timer trigger's `outputs` that are not an In-arg
|
|
2066
|
+
* bridge compile writes, each with the trigger's id and its index there.
|
|
2067
|
+
* Compile writes such a trigger's outputs as exactly one bridge row per In-arg
|
|
2068
|
+
* bound to it (`{ source: "=vars.<slot>" }`), and its source (`manualTrigger()`,
|
|
2069
|
+
* `timerTrigger()`) has no outputs to declare. A Studio Web plan can hold
|
|
2070
|
+
* others: a stale bridge whose slot the In-arg no longer has, or a second row
|
|
2071
|
+
* reading the same slot. Without this they were dropped on the round trip.
|
|
2072
|
+
* An event trigger's other rows are its declared `outputs` instead.
|
|
2073
|
+
*
|
|
2074
|
+
* A row whose source is not the slot of one of the trigger's In-args (or has no
|
|
2075
|
+
* source) is recorded `dangling: true`: compile restores it as is. A row that
|
|
2076
|
+
* reads a live In-arg slot is restored only while that slot is still an In-arg
|
|
2077
|
+
* of the trigger, so an edit that deletes or renames the In-arg drops it.
|
|
2078
|
+
*
|
|
2079
|
+
* Example: In-arg `PRODUCER` on slot `vNew` and the trigger row `{ name:
|
|
2080
|
+
* "PRODUCER", source: "=vars.vOld", var: "producer" }` records `{ trigger,
|
|
2081
|
+
* index: 1, row, dangling: true }` (and `PRODUCER` is also an unbridged In-arg).
|
|
2082
|
+
*/
|
|
2083
|
+
function strayTriggerRows(plan) {
|
|
2084
|
+
return (plan.nodes ?? []).filter(isTrigger).flatMap((node) => {
|
|
2085
|
+
const bag = triggerData(node).bag;
|
|
2086
|
+
if (typeof node.id !== 'string' || !Array.isArray(bag?.outputs) || bag.serviceType === 'Intsvc.EventTrigger')
|
|
2087
|
+
return [];
|
|
2088
|
+
const slots = new Set((plan.variables?.inputs ?? [])
|
|
2089
|
+
.filter((input) => input.elementId === node.id && typeof input.id === 'string')
|
|
2090
|
+
.map((input) => `=vars.${input.id}`));
|
|
2091
|
+
const bridged = new Set();
|
|
2092
|
+
return bag.outputs.flatMap((row, index) => {
|
|
2093
|
+
const source = typeof row?.source === 'string' ? row.source : undefined;
|
|
2094
|
+
if (source !== undefined && slots.has(source) && !bridged.has(source)) {
|
|
2095
|
+
bridged.add(source);
|
|
2096
|
+
return [];
|
|
2097
|
+
}
|
|
2098
|
+
const dangling = source === undefined || !slots.has(source);
|
|
2099
|
+
return [{ trigger: node.id, index, row: row, ...(dangling ? { dangling: true } : {}) }];
|
|
2100
|
+
});
|
|
2101
|
+
});
|
|
2102
|
+
}
|
|
2039
2103
|
function emitVariables(out, depth, plan, triggerNameById, triggerIsTimer) {
|
|
2040
2104
|
const variables = plan.variables ?? {};
|
|
2041
2105
|
const produced = producedVariableNames(plan);
|
|
@@ -3293,6 +3357,12 @@ export function collectPreservation(plan) {
|
|
|
3293
3357
|
const triggerless = triggerlessInArgs(plan);
|
|
3294
3358
|
if (triggerless.length)
|
|
3295
3359
|
preservation.triggerlessInArgs = triggerless;
|
|
3360
|
+
const bridged = bridgeFields(plan);
|
|
3361
|
+
if (bridged.length)
|
|
3362
|
+
preservation.bridgeFields = bridged;
|
|
3363
|
+
const stray = strayTriggerRows(plan);
|
|
3364
|
+
if (stray.length)
|
|
3365
|
+
preservation.strayTriggerRows = stray;
|
|
3296
3366
|
if (Object.keys(variableFields).length)
|
|
3297
3367
|
preservation.variableFields = variableFields;
|
|
3298
3368
|
if (Object.keys(legacyVariableDefaults).length)
|
package/dist/case/preserve.d.ts
CHANGED
|
@@ -432,6 +432,33 @@ export interface CaseJsonPreservation {
|
|
|
432
432
|
trigger: string;
|
|
433
433
|
companion?: string;
|
|
434
434
|
}>;
|
|
435
|
+
/**
|
|
436
|
+
* In-arg bridge rows that carried fields compile does not write (an array
|
|
437
|
+
* In-arg's `subType`), keyed by the In-arg's slot id and trigger, with the
|
|
438
|
+
* row's key order. Compile puts the fields back on that In-arg's bridge row
|
|
439
|
+
* only while the In-arg is still bound to that trigger.
|
|
440
|
+
*/
|
|
441
|
+
bridgeFields?: Array<{
|
|
442
|
+
slot: string;
|
|
443
|
+
trigger: string;
|
|
444
|
+
fields: Record<string, unknown>;
|
|
445
|
+
keys: string[];
|
|
446
|
+
}>;
|
|
447
|
+
/**
|
|
448
|
+
* Rows of a manual or timer trigger's `outputs` that are not a bridge row
|
|
449
|
+
* compile writes (a stale bridge whose slot is gone, a second row reading a
|
|
450
|
+
* slot), verbatim, with the trigger's id and the row's index. `dangling`
|
|
451
|
+
* marks a row whose source named no In-arg slot of the trigger at decompile.
|
|
452
|
+
* Compile puts each back at its index while the trigger is still in the
|
|
453
|
+
* plan, and a row that is not `dangling` only while its source slot is still
|
|
454
|
+
* an In-arg of that trigger (an edit that deletes or renames it drops the row).
|
|
455
|
+
*/
|
|
456
|
+
strayTriggerRows?: Array<{
|
|
457
|
+
trigger: string;
|
|
458
|
+
index: number;
|
|
459
|
+
row: Record<string, unknown>;
|
|
460
|
+
dangling?: true;
|
|
461
|
+
}>;
|
|
435
462
|
/**
|
|
436
463
|
* Opaque V30 layout side-car. Decompile folds a node's inline
|
|
437
464
|
* {@link CASE_NODE_LAYOUT_FIELDS} into it, the platform's disk form.
|
package/dist/case/preserve.js
CHANGED
|
@@ -362,6 +362,19 @@ export function caseJsonPreservationErrors(payload) {
|
|
|
362
362
|
&& (entry.companion === undefined || (typeof entry.companion === 'string' && entry.companion !== ''))
|
|
363
363
|
&& Object.keys(entry).every((key) => ['name', 'elementId', 'trigger', 'companion'].includes(key)))))
|
|
364
364
|
errors.push('preserved "triggerlessInArgs" must be an array of { name, elementId, trigger, companion? } with non-empty strings, elementId not the trigger');
|
|
365
|
+
if (payload.bridgeFields !== undefined
|
|
366
|
+
&& (!Array.isArray(payload.bridgeFields) || !payload.bridgeFields.every((entry) => entry !== null && typeof entry === 'object'
|
|
367
|
+
&& typeof entry.slot === 'string' && entry.slot !== '' && typeof entry.trigger === 'string' && entry.trigger !== ''
|
|
368
|
+
&& entry.fields !== null && typeof entry.fields === 'object' && !Array.isArray(entry.fields)
|
|
369
|
+
&& !['name', 'type', 'source', 'var'].some((key) => Object.prototype.hasOwnProperty.call(entry.fields, key))
|
|
370
|
+
&& Array.isArray(entry.keys) && entry.keys.every((key) => typeof key === 'string'))))
|
|
371
|
+
errors.push('preserved "bridgeFields" must be an array of { slot, trigger, fields, keys } carrying no compiled bridge field');
|
|
372
|
+
if (payload.strayTriggerRows !== undefined
|
|
373
|
+
&& (!Array.isArray(payload.strayTriggerRows) || !payload.strayTriggerRows.every((entry) => entry !== null && typeof entry === 'object'
|
|
374
|
+
&& typeof entry.trigger === 'string' && entry.trigger !== '' && Number.isInteger(entry.index) && entry.index >= 0
|
|
375
|
+
&& entry.row !== null && typeof entry.row === 'object' && !Array.isArray(entry.row)
|
|
376
|
+
&& (entry.dangling === undefined || entry.dangling === true))))
|
|
377
|
+
errors.push('preserved "strayTriggerRows" must be an array of { trigger, index, row, dangling? } with a non-empty trigger id, an index >= 0, an object row and dangling absent or true');
|
|
365
378
|
if (payload.legacyTriggerIds !== undefined
|
|
366
379
|
&& (!Array.isArray(payload.legacyTriggerIds) || !payload.legacyTriggerIds.every((id) => typeof id === 'string')))
|
|
367
380
|
errors.push('preserved "legacyTriggerIds" must be an array of trigger id strings');
|
package/dist/case/serialize.js
CHANGED
|
@@ -704,6 +704,43 @@ export function applyPreservation(result, preservation, options = {}) {
|
|
|
704
704
|
delete node.data[CASE_FORMAT_PROFILE.triggerBagField];
|
|
705
705
|
}
|
|
706
706
|
restoreTriggerlessInArgs(result, preservation.triggerlessInArgs);
|
|
707
|
+
// A bridge row's Designer-saved fields (an array In-arg's `subType`), in the
|
|
708
|
+
// row's saved key order, while the In-arg is still bound to that trigger.
|
|
709
|
+
for (const { slot, trigger, fields, keys } of preservation.bridgeFields ?? []) {
|
|
710
|
+
const input = (variables.inputs ?? []).find((candidate) => candidate.id === slot);
|
|
711
|
+
if (!input || input.elementId !== trigger)
|
|
712
|
+
continue;
|
|
713
|
+
const node = result.nodes.find((candidate) => candidate.id === trigger);
|
|
714
|
+
const rows = node?.data?.[CASE_FORMAT_PROFILE.triggerBagField]?.outputs;
|
|
715
|
+
const at = Array.isArray(rows) ? rows.findIndex((row) => row?.source === `=vars.${slot}`) : -1;
|
|
716
|
+
if (at < 0)
|
|
717
|
+
continue;
|
|
718
|
+
const merged = { ...rows[at], ...fields };
|
|
719
|
+
const ordered = {};
|
|
720
|
+
for (const key of [...keys, ...Object.keys(merged)])
|
|
721
|
+
if (key in merged && !(key in ordered))
|
|
722
|
+
ordered[key] = merged[key];
|
|
723
|
+
rows[at] = ordered;
|
|
724
|
+
}
|
|
725
|
+
// A manual or timer trigger's rows that are not a bridge compile writes, back
|
|
726
|
+
// at their saved index, while the trigger is still in the plan. A row that
|
|
727
|
+
// read a live In-arg slot comes back only while that slot is still an In-arg
|
|
728
|
+
// of the trigger: an edit that deletes or renames the In-arg drops it instead
|
|
729
|
+
// of leaving a dangling bridge. One already dangling at decompile comes back.
|
|
730
|
+
for (const { trigger, index, row, dangling } of [...(preservation.strayTriggerRows ?? [])].sort((a, b) => a.index - b.index)) {
|
|
731
|
+
const node = result.nodes.find((candidate) => candidate.id === trigger);
|
|
732
|
+
if (!node)
|
|
733
|
+
continue;
|
|
734
|
+
if (dangling !== true && !(variables.inputs ?? []).some((input) => input.elementId === trigger
|
|
735
|
+
&& typeof input.id === 'string' && row.source === `=vars.${input.id}`))
|
|
736
|
+
continue;
|
|
737
|
+
const data = (node.data ??= {});
|
|
738
|
+
const bag = (data[CASE_FORMAT_PROFILE.triggerBagField] ??= {});
|
|
739
|
+
if (bag.serviceType === 'Intsvc.EventTrigger')
|
|
740
|
+
continue;
|
|
741
|
+
const outputs = Array.isArray(bag.outputs) ? bag.outputs : (bag.outputs = []);
|
|
742
|
+
outputs.splice(Math.min(index, outputs.length), 0, structuredClone(row));
|
|
743
|
+
}
|
|
707
744
|
for (const name of preservation.omitInputDefaults ?? []) {
|
|
708
745
|
const row = (variables.inputs ?? []).find((candidate) => candidate.name === name);
|
|
709
746
|
if (row?.default === '')
|
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.15",
|
|
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": "d8e9380893de16cc624003c948360cd9f3f82c3a"
|
|
128
128
|
}
|