@uipath/maestro-builder-sdk 6.86.6 → 6.86.8
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/case-expr-check.js +39 -0
- package/dist/case/decompile.d.ts +1 -0
- package/dist/case/decompile.js +62 -1
- package/dist/case/preserve.d.ts +14 -0
- package/dist/case/preserve.js +3 -0
- package/dist/case/serialize.js +26 -1
- package/package.json +2 -2
|
@@ -111,9 +111,48 @@ function checkRules(built, rules, where, roots, out) {
|
|
|
111
111
|
checkFilterExprs(built, r.connector, `${where} wait-for-connector rule`, roots, out);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* The case-schema `sanitizeVariableIdentifierIntoStringWithoutBrackets`: an
|
|
116
|
+
* identifier with a segment that is not a JS name has every character outside
|
|
117
|
+
* `[a-zA-Z0-9_]` replaced by `_` (`Stage 1` -> `Stage_1`). A segment that starts
|
|
118
|
+
* with `stage-` / `Stage_` exempts the whole identifier, as there.
|
|
119
|
+
*/
|
|
120
|
+
function platformIdentifier(identifier) {
|
|
121
|
+
const segments = identifier.split('.').filter(Boolean);
|
|
122
|
+
if (segments.some((s) => s.startsWith('stage-') || s.startsWith('Stage_')))
|
|
123
|
+
return identifier;
|
|
124
|
+
return segments.some((s) => !/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)) ? identifier.replace(/[^a-zA-Z0-9_]/g, '_') : identifier;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Variables the platform declares for every case, which a plan's gates may read
|
|
128
|
+
* though no row of the plan declares them. `uip maestro case validate` adds the
|
|
129
|
+
* same set to the variables it checks against (case-schema
|
|
130
|
+
* `validateCaseManagementVariables`), and the BPMN converter writes each one:
|
|
131
|
+
*
|
|
132
|
+
* - `stageHasRun_<stage label>` per stage (`getCaseStateVariables`), set in the
|
|
133
|
+
* initial variables setup and updated when the stage exits or completes. The
|
|
134
|
+
* platform's own V11->V12 migration writes gates on it:
|
|
135
|
+
* `=js:(vars.stageHasRun_Review != true)` for "first time this stage runs";
|
|
136
|
+
* - the hidden event-subprocess rows `tasksEventSubprocessResponse`,
|
|
137
|
+
* `mainEventSubprocessResponse`, `connectorResponse` and `eventMetadata`.
|
|
138
|
+
*
|
|
139
|
+
* Not here: the per-SLA `stageSla_<stage>_<sla id>` rows, whose ids compile
|
|
140
|
+
* mints after this check runs.
|
|
141
|
+
*/
|
|
142
|
+
function platformVariables(built) {
|
|
143
|
+
return [
|
|
144
|
+
...built.stages.map((s) => `stageHasRun_${platformIdentifier(s.label)}`),
|
|
145
|
+
'tasksEventSubprocessResponse',
|
|
146
|
+
'mainEventSubprocessResponse',
|
|
147
|
+
'connectorResponse',
|
|
148
|
+
'eventMetadata',
|
|
149
|
+
];
|
|
150
|
+
}
|
|
114
151
|
/** Every first-level expression problem in a built case, each stamped with its location. */
|
|
115
152
|
export function checkCaseExpressions(built) {
|
|
116
153
|
const roots = new Set(built.vars.map((v) => v.name));
|
|
154
|
+
for (const name of platformVariables(built))
|
|
155
|
+
roots.add(name);
|
|
117
156
|
// Task output bindings declare readable case variables too (`=vars.<var>`),
|
|
118
157
|
// via a root `inputOutputs` companion — include them so a gate that reads a
|
|
119
158
|
// task output is not flagged as an undeclared reference.
|
package/dist/case/decompile.d.ts
CHANGED
package/dist/case/decompile.js
CHANGED
|
@@ -1614,10 +1614,49 @@ function reassignedOwnNameTargets(plan) {
|
|
|
1614
1614
|
}
|
|
1615
1615
|
return targets;
|
|
1616
1616
|
}
|
|
1617
|
+
/**
|
|
1618
|
+
* The In-args in the order the source declares them: each trigger's In-args
|
|
1619
|
+
* in the order of their bridge rows on that trigger, in the slots those
|
|
1620
|
+
* In-args hold in `variables.inputs`.
|
|
1621
|
+
*
|
|
1622
|
+
* Compile writes a trigger's bridge rows (`{ source: '=vars.<slot>', var:
|
|
1623
|
+
* <companion> }`) in `.input()` order, and the preserved row order puts the
|
|
1624
|
+
* root lanes back afterwards. The Case Designer keeps the two orders apart:
|
|
1625
|
+
* an In-arg added to the trigger later can sit before older ones on the
|
|
1626
|
+
* trigger and after them in `variables.inputs`. Declaring In-args in bridge
|
|
1627
|
+
* order keeps both. A trigger with an In-arg no bridge row reads keeps the
|
|
1628
|
+
* root order.
|
|
1629
|
+
*
|
|
1630
|
+
* Example: `variables.inputs` is `[a, b, c]` and the trigger's bridge rows read
|
|
1631
|
+
* `[c, a, b]`; the source declares `.input({ c })`, `.input({ a })`, `.input({ b })`.
|
|
1632
|
+
*/
|
|
1633
|
+
function inArgsInBridgeOrder(plan) {
|
|
1634
|
+
const inputs = [...(plan.variables?.inputs ?? [])];
|
|
1635
|
+
for (const node of (plan.nodes ?? []).filter(isTrigger)) {
|
|
1636
|
+
const slots = inputs.flatMap((input, index) => (input.elementId === node.id ? [index] : []));
|
|
1637
|
+
if (slots.length < 2)
|
|
1638
|
+
continue;
|
|
1639
|
+
const position = new Map();
|
|
1640
|
+
// A V30 trigger can also hold bridge rows in a stray `data.uipath` bag; the
|
|
1641
|
+
// platform's migration reads them after the `data.inputs` rows.
|
|
1642
|
+
const stray = node.type === 'uipath.case.trigger' ? (node.data?.uipath?.outputs ?? []) : [];
|
|
1643
|
+
[...(triggerData(node).bag?.outputs ?? []), ...stray].forEach((row, index) => {
|
|
1644
|
+
const slot = typeof row?.source === 'string' ? /^=vars\.(.+)$/.exec(row.source)?.[1] : undefined;
|
|
1645
|
+
if (slot !== undefined && !position.has(slot))
|
|
1646
|
+
position.set(slot, index);
|
|
1647
|
+
});
|
|
1648
|
+
const own = slots.map((index) => inputs[index]);
|
|
1649
|
+
if (own.some((input) => typeof input.id !== 'string' || !position.has(input.id)))
|
|
1650
|
+
continue;
|
|
1651
|
+
const ordered = [...own].sort((a, b) => position.get(a.id) - position.get(b.id));
|
|
1652
|
+
slots.forEach((slot, index) => { inputs[slot] = ordered[index]; });
|
|
1653
|
+
}
|
|
1654
|
+
return inputs;
|
|
1655
|
+
}
|
|
1617
1656
|
function emitVariables(out, depth, plan, triggerNameById, triggerIsTimer) {
|
|
1618
1657
|
const variables = plan.variables ?? {};
|
|
1619
1658
|
const produced = producedVariableNames(plan);
|
|
1620
|
-
for (const input of
|
|
1659
|
+
for (const input of inArgsInBridgeOrder(plan)) {
|
|
1621
1660
|
let from = input.elementId && triggerNameById.get(input.elementId);
|
|
1622
1661
|
// An In-arg with no trigger is a shape only older SDKs wrote (builder-sdk
|
|
1623
1662
|
// #1368): no companion, so nothing binds it. A bare `.input()` now binds to
|
|
@@ -2068,6 +2107,20 @@ function emptyLists(owner, fields) {
|
|
|
2068
2107
|
function variableShape(row) {
|
|
2069
2108
|
return row.type === 'jsonSchema' && row.body !== undefined && row._jsonSchema === undefined ? { omit: ['_jsonSchema'] } : {};
|
|
2070
2109
|
}
|
|
2110
|
+
/**
|
|
2111
|
+
* A custom (`{ assign }`) output row's label, when it is not the name of the
|
|
2112
|
+
* variable it assigns. Compile labels the row with the variable
|
|
2113
|
+
* (`name: 'caseOutcome'`), as the Designer does by default; a Designer row can
|
|
2114
|
+
* carry another label (`{ name: 'caseOutcomeDenied', var: 'caseOutcome' }`).
|
|
2115
|
+
* The label is display only: the row writes `var`. Recorded as `{ name:
|
|
2116
|
+
* 'caseOutcomeDenied', var: 'caseOutcome', custom: true }`.
|
|
2117
|
+
*/
|
|
2118
|
+
function customRowLabel(row, plan) {
|
|
2119
|
+
if (row.custom !== true || typeof row.var !== 'string' || typeof row.name !== 'string')
|
|
2120
|
+
return {};
|
|
2121
|
+
const variable = (plan.variables?.inputOutputs ?? []).find((entry) => entry.id === row.var);
|
|
2122
|
+
return row.name === (variable?.name ?? row.var) ? {} : { var: row.var, custom: true };
|
|
2123
|
+
}
|
|
2071
2124
|
function identityPreservation(plan) {
|
|
2072
2125
|
return {
|
|
2073
2126
|
...(plan.id ? { id: plan.id } : {}),
|
|
@@ -2087,6 +2140,7 @@ function identityPreservation(plan) {
|
|
|
2087
2140
|
outputs: (task.data?.outputs ?? []).map((row) => ({
|
|
2088
2141
|
name: row.name ?? '',
|
|
2089
2142
|
...(row.id ? { id: row.id } : {}),
|
|
2143
|
+
...customRowLabel(row, plan),
|
|
2090
2144
|
// A form output's `originalVar` when the Designer spelled it as the variable, not the slot id.
|
|
2091
2145
|
...(task.type === 'action' && typeof row.originalVar === 'string' && row.originalVar !== row.id
|
|
2092
2146
|
? { originalVar: row.originalVar } : {}),
|
|
@@ -2386,6 +2440,7 @@ export function collectPreservation(plan) {
|
|
|
2386
2440
|
const connectorConfigurations = [];
|
|
2387
2441
|
const httpRequestMetadata = [];
|
|
2388
2442
|
const omitTaskElementIds = [];
|
|
2443
|
+
const omitTaskDisplayNames = [];
|
|
2389
2444
|
const actionDataFields = [];
|
|
2390
2445
|
const documentExtractionData = [];
|
|
2391
2446
|
const omitStagePositions = [];
|
|
@@ -2410,6 +2465,10 @@ export function collectPreservation(plan) {
|
|
|
2410
2465
|
// `omitTaskElementIds` in preserve.ts.
|
|
2411
2466
|
if (!Object.prototype.hasOwnProperty.call(task, 'elementId'))
|
|
2412
2467
|
omitTaskElementIds.push({ stage: label, lane: laneIndex, task: task.displayName ?? '' });
|
|
2468
|
+
// A task saved with no name must not gain `displayName: ""`: see
|
|
2469
|
+
// `omitTaskDisplayNames` in preserve.ts.
|
|
2470
|
+
if (task.displayName === undefined && typeof task.id === 'string' && task.id !== '')
|
|
2471
|
+
omitTaskDisplayNames.push(task.id);
|
|
2413
2472
|
const fields = Object.fromEntries(Object.entries(task).filter(([name]) => !taskKnown.has(name) && name !== 'elementId'));
|
|
2414
2473
|
for (const field of Object.keys(fields))
|
|
2415
2474
|
throw new Error(`task "${task.displayName ?? task.id ?? '?'}" has unsupported field "${field}", which is not allowed in the collision-refusing preservation channel.`);
|
|
@@ -2465,6 +2524,8 @@ export function collectPreservation(plan) {
|
|
|
2465
2524
|
preservation.subscriptionFilters = subscriptionFilterEntries;
|
|
2466
2525
|
if (omitTaskElementIds.length)
|
|
2467
2526
|
preservation.omitTaskElementIds = omitTaskElementIds;
|
|
2527
|
+
if (omitTaskDisplayNames.length)
|
|
2528
|
+
preservation.omitTaskDisplayNames = omitTaskDisplayNames;
|
|
2468
2529
|
if (actionDataFields.length)
|
|
2469
2530
|
preservation.actionDataFields = actionDataFields;
|
|
2470
2531
|
if (documentExtractionData.length)
|
package/dist/case/preserve.d.ts
CHANGED
|
@@ -189,6 +189,7 @@ interface StageIdentity {
|
|
|
189
189
|
fields?: Record<string, unknown>;
|
|
190
190
|
}>;
|
|
191
191
|
/** `originalVar` only when it is not the row's `id` (the serializer's own spelling). `elementId` when an action form output names another element than its task. `fields` as on an input. `omit`: the fields an action form output (`target`, `_jsonSchema`, `elementId`) or a resource extract (`target`) was saved without that compile writes. */
|
|
192
|
+
/** `var` and `custom: true`: a custom row whose label (`name`) is not the name of the variable it assigns. */
|
|
192
193
|
outputs?: Array<{
|
|
193
194
|
name: string;
|
|
194
195
|
id?: string;
|
|
@@ -196,6 +197,8 @@ interface StageIdentity {
|
|
|
196
197
|
elementId?: string;
|
|
197
198
|
fields?: Record<string, unknown>;
|
|
198
199
|
omit?: string[];
|
|
200
|
+
var?: string;
|
|
201
|
+
custom?: true;
|
|
199
202
|
}>;
|
|
200
203
|
/** The io lists a resource task saved empty (`inputs: []`), which compile writes only when it binds a row. */
|
|
201
204
|
emptyIo?: Array<'inputs' | 'outputs'>;
|
|
@@ -410,6 +413,17 @@ export interface CaseJsonPreservation {
|
|
|
410
413
|
* contract; greenfield authoring still always gets one.
|
|
411
414
|
*/
|
|
412
415
|
omitTaskElementIds?: PreservedTaskRef[];
|
|
416
|
+
/**
|
|
417
|
+
* Ids of the tasks the source saved with no `displayName`. The builder names
|
|
418
|
+
* every task (`.task("", ...)` for such a task), and the serializer writes
|
|
419
|
+
* `displayName: ""`. The two are not the same to the platform: the converter
|
|
420
|
+
* embeds each task's JSON verbatim in the BPMN it writes
|
|
421
|
+
* (`serializeTaskForCaseManagement` in `@uipath/case-schema`), and its
|
|
422
|
+
* validation names a task `displayName ?? data.name ?? id`, so `""` would
|
|
423
|
+
* replace the fallback. Compile removes the field from a listed task while
|
|
424
|
+
* its name is still `""`; a task the author named keeps its name.
|
|
425
|
+
*/
|
|
426
|
+
omitTaskDisplayNames?: string[];
|
|
413
427
|
/** Opaque wire identities aligned to typed constructs by name and position. */
|
|
414
428
|
identities?: CaseIdentityPreservation;
|
|
415
429
|
/**
|
package/dist/case/preserve.js
CHANGED
|
@@ -315,6 +315,9 @@ export function caseJsonPreservationErrors(payload) {
|
|
|
315
315
|
errors.push(`task "${task.name}" ${side} "${row.name}" omits "${String(field)}", which is not an omittable field`);
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
|
+
for (const id of payload.omitTaskDisplayNames ?? [])
|
|
319
|
+
if (typeof id !== 'string' || id === '')
|
|
320
|
+
errors.push('omitted task displayName ids must be non-empty strings');
|
|
318
321
|
for (const entry of payload.omitTaskElementIds ?? [])
|
|
319
322
|
if (!Number.isInteger(entry.lane) || entry.lane < 0)
|
|
320
323
|
errors.push(`omitted-elementId task lane "${entry.lane}" is not a non-negative integer`);
|
package/dist/case/serialize.js
CHANGED
|
@@ -855,6 +855,16 @@ export function applyPreservation(result, preservation, options = {}) {
|
|
|
855
855
|
else if (preservation.omitLayout)
|
|
856
856
|
delete result.layout;
|
|
857
857
|
applyResourceWires(result, preservation.resourceWires);
|
|
858
|
+
// Last, after every lookup of a task by its name: a task the source saved
|
|
859
|
+
// with no name gets none back while it is still unnamed (preserve.ts).
|
|
860
|
+
if (preservation.omitTaskDisplayNames?.length) {
|
|
861
|
+
const unnamed = new Set(preservation.omitTaskDisplayNames);
|
|
862
|
+
for (const stage of stageNodes)
|
|
863
|
+
for (const lane of stage.data?.tasks ?? [])
|
|
864
|
+
for (const task of lane)
|
|
865
|
+
if (unnamed.has(task?.id) && task.displayName === '')
|
|
866
|
+
delete task.displayName;
|
|
867
|
+
}
|
|
858
868
|
// Root rows of the original that compile does not write itself
|
|
859
869
|
// (preserve.ts `unreadBindings` / `readBindings` / `bindings`): a row the
|
|
860
870
|
// original read nowhere stays, as Studio Web keeps it; any other stays while
|
|
@@ -1288,6 +1298,18 @@ function applyPreservedIdentities(result, preservation) {
|
|
|
1288
1298
|
// field compile writes: a resource extract without its task's `elementId`
|
|
1289
1299
|
// is one the converter never reads (#1419).
|
|
1290
1300
|
const takeOutputRows = (outputRows, wantedRows, actionRows = false) => {
|
|
1301
|
+
// A custom row's own label goes back on the one custom row that still
|
|
1302
|
+
// assigns its variable (matched once every id is final).
|
|
1303
|
+
for (const row of wantedRows)
|
|
1304
|
+
if (row.custom === true && typeof row.var === 'string') {
|
|
1305
|
+
const label = row.name;
|
|
1306
|
+
const variable = row.var;
|
|
1307
|
+
rowRenames.push(() => {
|
|
1308
|
+
const holders = outputRows.filter((candidate) => candidate?.custom === true && candidate.var === variable);
|
|
1309
|
+
if (holders.length === 1 && wantedRows.filter((other) => other.custom === true && other.var === variable).length === 1)
|
|
1310
|
+
holders[0].name = label;
|
|
1311
|
+
});
|
|
1312
|
+
}
|
|
1291
1313
|
// Match by name when unique on both sides, else by position.
|
|
1292
1314
|
const unique = (names, name) => names.filter((n) => n === name).length === 1;
|
|
1293
1315
|
const currentNames = outputRows.map((r) => r?.name);
|
|
@@ -3341,7 +3363,10 @@ function emitRule(r, seed, ownerId, ids, resolver, site) {
|
|
|
3341
3363
|
throw new CompileRefusal('UNKNOWN_BUSINESS_EVENT', `rule "api-event" in ${site} listens for business event "${r.businessEvent}", which the case does not declare — add .businessEvent(${JSON.stringify(r.businessEvent)}).`);
|
|
3342
3364
|
out.businessEventType = r.businessEvent;
|
|
3343
3365
|
}
|
|
3344
|
-
|
|
3366
|
+
// An empty gate is written as given: Studio Web saves `conditionExpression: ""`
|
|
3367
|
+
// on rules it never gated, and the platform reads it as no gate (every
|
|
3368
|
+
// reader tests `conditionExpression?.length`), so it round-trips as it is.
|
|
3369
|
+
if (r.expression !== undefined)
|
|
3345
3370
|
out.conditionExpression = r.expression;
|
|
3346
3371
|
return out;
|
|
3347
3372
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.86.
|
|
3
|
+
"version": "6.86.8",
|
|
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",
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"@types/node": "^22.7.0",
|
|
104
104
|
"esbuild": "^0.28.1"
|
|
105
105
|
},
|
|
106
|
-
"gitref": "
|
|
106
|
+
"gitref": "a0113ad6c8144e78d2bb8b9b33cb3c0e814fc51b"
|
|
107
107
|
}
|