@uipath/maestro-builder-sdk 6.93.3 → 6.93.5
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/api-index.md +25 -23
- package/dist/api-members.md +147 -147
- package/dist/case/case-sdk.d.ts +19 -4
- package/dist/case/case-sdk.js +1 -1
- package/dist/case/decompile.d.ts +4 -0
- package/dist/case/decompile.js +75 -2
- package/dist/case/preserve.d.ts +30 -1
- package/dist/case/preserve.js +30 -2
- package/dist/case/serialize.js +32 -3
- package/dist/core/ts-literal.js +28 -1
- package/package.json +2 -2
package/dist/case/case-sdk.d.ts
CHANGED
|
@@ -944,12 +944,27 @@ export interface TaskRetryPolicy {
|
|
|
944
944
|
/** The growth factor of an `Exponential` backoff. */
|
|
945
945
|
exponentialBase?: number;
|
|
946
946
|
}
|
|
947
|
+
/** A JSON value a task input can hold besides a string (`TaskInputBinding.value`). */
|
|
948
|
+
type TaskInputJson = number | boolean | null | TaskInputJson[] | {
|
|
949
|
+
[key: string]: TaskInputJson;
|
|
950
|
+
};
|
|
951
|
+
/**
|
|
952
|
+
* A task input's value: a string (a literal or an expression), or a JSON value
|
|
953
|
+
* for a non-string input, saved as is. For example `'=vars.amount'`, or `{}`
|
|
954
|
+
* on an object input.
|
|
955
|
+
*/
|
|
956
|
+
export type TaskInputValue = string | TaskInputJson;
|
|
947
957
|
/** A task input binding: a resource input parameter set to a literal or a `=`-expression. */
|
|
948
958
|
export interface TaskInputBinding {
|
|
949
959
|
/** The resource's input parameter name. */
|
|
950
960
|
name: string;
|
|
951
|
-
/**
|
|
952
|
-
|
|
961
|
+
/**
|
|
962
|
+
* The bound value — a literal, `=vars.<name>`, or a `=js:` expression; or,
|
|
963
|
+
* for a non-string input, a JSON value saved as is (`{}` on an object
|
|
964
|
+
* input, `true` on a boolean one), the way Studio Web saves a value typed
|
|
965
|
+
* into such an input.
|
|
966
|
+
*/
|
|
967
|
+
value: TaskInputValue;
|
|
953
968
|
type: TypeDesc;
|
|
954
969
|
/** Whether the resource requires this parameter (`data.inputs[].required`); written only when set. */
|
|
955
970
|
required?: boolean;
|
|
@@ -1667,11 +1682,11 @@ declare class TaskBuilder {
|
|
|
1667
1682
|
* })))
|
|
1668
1683
|
* ```
|
|
1669
1684
|
*
|
|
1670
|
-
* @param shape - Input parameter names to literals, case-variable references, or `{ value, type, required, default }`.
|
|
1685
|
+
* @param shape - Input parameter names to literals, case-variable references, or `{ value, type, required, default }`. A non-string input may take a JSON `value` (`{ value: {}, type: 'object' }`, `{ value: true, type: 'boolean' }`), which is written as is.
|
|
1671
1686
|
* @returns This builder, so calls chain.
|
|
1672
1687
|
*/
|
|
1673
1688
|
inputs(shape: Record<string, string | {
|
|
1674
|
-
value:
|
|
1689
|
+
value: TaskInputValue;
|
|
1675
1690
|
type?: TypeDesc;
|
|
1676
1691
|
required?: boolean;
|
|
1677
1692
|
default?: string | number | boolean | null;
|
package/dist/case/case-sdk.js
CHANGED
|
@@ -735,7 +735,7 @@ class TaskBuilder {
|
|
|
735
735
|
* })))
|
|
736
736
|
* ```
|
|
737
737
|
*
|
|
738
|
-
* @param shape - Input parameter names to literals, case-variable references, or `{ value, type, required, default }`.
|
|
738
|
+
* @param shape - Input parameter names to literals, case-variable references, or `{ value, type, required, default }`. A non-string input may take a JSON `value` (`{ value: {}, type: 'object' }`, `{ value: true, type: 'boolean' }`), which is written as is.
|
|
739
739
|
* @returns This builder, so calls chain.
|
|
740
740
|
*/
|
|
741
741
|
inputs(shape) {
|
package/dist/case/decompile.d.ts
CHANGED
|
@@ -249,6 +249,10 @@ type Preservation = {
|
|
|
249
249
|
omitLayout?: boolean;
|
|
250
250
|
variableLanes?: Array<'inputs' | 'outputs' | 'inputOutputs'>;
|
|
251
251
|
omitInputDefaults?: string[];
|
|
252
|
+
unbridgedInArgs?: Array<{
|
|
253
|
+
name: string;
|
|
254
|
+
trigger: string;
|
|
255
|
+
}>;
|
|
252
256
|
omitMetadata?: Array<'caseAppEnabled' | 'caseIdentifierType' | 'publishVersion'>;
|
|
253
257
|
publishVersion?: number;
|
|
254
258
|
nodeFields?: Record<string, Record<string, unknown>>;
|
package/dist/case/decompile.js
CHANGED
|
@@ -18,7 +18,7 @@ import { preserveSchemaVersion } from '../schema-version.js';
|
|
|
18
18
|
import { ownEntry } from '../core/own-entry.js';
|
|
19
19
|
import { EVENT_FILTER_OPERATORS, eventFilterExpressionOf, eventFilterFromTreeLeaf, eventFilterProblem, EXPRESSION_FILTER_OPERATORS, filterExprFromLeaf } from '../core/event-filters.js';
|
|
20
20
|
import { CASE_FILTER_SPELLING, caseSubscriptionBody, caseSubscriptionOwners } from './subscription.js';
|
|
21
|
-
import { CASE_NODE_CANVAS_FIELDS, CASE_NODE_LAYOUT_FIELDS, isTypedInputField, isUnrestorableSlotId, PRESERVED_STAGE_DATA_KEYS, PRESERVED_TRIGGER_DATA_KEYS, RESOURCE_INPUT_WRITTEN, RESOURCE_OUTPUT_WRITTEN, CASE_EMPTY_LISTS, STAGE_EMPTY_LISTS, TASK_EMPTY_LISTS, taskFingerprint, PRESERVED_ACTION_DATA_KEYS, TYPED_TRIGGER_DISPLAY_KEYS, } from './preserve.js';
|
|
21
|
+
import { CASE_NODE_CANVAS_FIELDS, CASE_NODE_LAYOUT_FIELDS, isTypedInputField, isUnrestorableSlotId, planElementIds, PRESERVED_STAGE_DATA_KEYS, PRESERVED_TRIGGER_DATA_KEYS, RESOURCE_INPUT_WRITTEN, RESOURCE_OUTPUT_WRITTEN, CASE_EMPTY_LISTS, STAGE_EMPTY_LISTS, TASK_EMPTY_LISTS, taskFingerprint, PRESERVED_ACTION_DATA_KEYS, TYPED_TRIGGER_DISPLAY_KEYS, } from './preserve.js';
|
|
22
22
|
import { stableId } from '../core/stable-id.js';
|
|
23
23
|
import { ACTION_CONTEXT_COPIES, ACTION_PASSTHROUGH_SETTINGS } from './action-settings.js';
|
|
24
24
|
import { resourceIdentity, SOLUTION_FOLDER } from './resource-identity.js';
|
|
@@ -1490,7 +1490,19 @@ function ioArg(rows, kind, task, varKeyById) {
|
|
|
1490
1490
|
// A stored literal that itself looks quoted is written in one more pair, so
|
|
1491
1491
|
// `.inputs()` / `{ assign }` (which strip one pair, as `sdd convert` does)
|
|
1492
1492
|
// compile it back to the same text.
|
|
1493
|
-
|
|
1493
|
+
// Only an absent input value reads as `''`: a saved `null` is a JSON value
|
|
1494
|
+
// like `{}`, and `?? ''` turned it into the empty string.
|
|
1495
|
+
const stored = kind === 'inputs' ? (row[valueField] === undefined ? '' : row[valueField]) : (row[valueField] ?? '');
|
|
1496
|
+
// An input saved with a JSON value (an object-typed input's `{}`, a
|
|
1497
|
+
// boolean input's `true`) is written as that value: `.inputs()` passes a
|
|
1498
|
+
// non-string value through as is. `String()` would turn it into
|
|
1499
|
+
// `"[object Object]"` / `"true"`.
|
|
1500
|
+
if (kind === 'inputs' && typeof stored !== 'string') {
|
|
1501
|
+
const typedJson = (row.type && row.type !== 'string' ? `, type: ${tsLiteral(row.type)}` : '')
|
|
1502
|
+
+ (typeof row.required === 'boolean' ? `, required: ${boolLit(row.required)}` : '')
|
|
1503
|
+
+ (isTypedInputDefault(row.default) ? `, default: ${tsLiteral(row.default)}` : '');
|
|
1504
|
+
return `${key(String(row.name ?? ''))}: { value: ${tsLiteral(stored)}${typedJson} }`;
|
|
1505
|
+
}
|
|
1494
1506
|
const unquotes = kind === 'inputs' || row.custom === true;
|
|
1495
1507
|
const spelled = unquotes ? literalSource(String(stored)) : stored;
|
|
1496
1508
|
if (spelled === undefined) {
|
|
@@ -1749,6 +1761,28 @@ function variableDescription(entry) {
|
|
|
1749
1761
|
throw new Error(`variable "${entry.name}" has a non-string "description", which is not authorable.`);
|
|
1750
1762
|
return description;
|
|
1751
1763
|
}
|
|
1764
|
+
/**
|
|
1765
|
+
* The `elementId` compile writes on each root `inputOutputs` row, by name: an
|
|
1766
|
+
* In-arg's companion takes the trigger the In-arg is bound to, every other row
|
|
1767
|
+
* `root`. An In-arg whose saved trigger is not a trigger node of the plan is
|
|
1768
|
+
* left out: compile binds it to the primary trigger, which this does not track.
|
|
1769
|
+
*/
|
|
1770
|
+
function companionElementIds(plan) {
|
|
1771
|
+
const triggers = new Set((plan.nodes ?? []).filter(isTrigger).map((node) => node.id));
|
|
1772
|
+
const out = new Map();
|
|
1773
|
+
for (const row of plan.variables?.inputOutputs ?? [])
|
|
1774
|
+
if (row?.name)
|
|
1775
|
+
out.set(row.name, 'root');
|
|
1776
|
+
for (const input of plan.variables?.inputs ?? []) {
|
|
1777
|
+
if (!input?.name)
|
|
1778
|
+
continue;
|
|
1779
|
+
if (typeof input.elementId === 'string' && triggers.has(input.elementId))
|
|
1780
|
+
out.set(input.name, input.elementId);
|
|
1781
|
+
else
|
|
1782
|
+
out.delete(input.name);
|
|
1783
|
+
}
|
|
1784
|
+
return out;
|
|
1785
|
+
}
|
|
1752
1786
|
/**
|
|
1753
1787
|
* The root `inputOutputs` rows decompile turns into a `.var()`: not an In- or
|
|
1754
1788
|
* Out-arg's companion, nor a custom row a task output writes. These are the
|
|
@@ -1867,6 +1901,23 @@ function inArgsInBridgeOrder(plan) {
|
|
|
1867
1901
|
}
|
|
1868
1902
|
return inputs;
|
|
1869
1903
|
}
|
|
1904
|
+
/**
|
|
1905
|
+
* In-args bound to a trigger of the plan that no row of that trigger reads
|
|
1906
|
+
* (`{ source: "=vars.<slot>" }`, in `data.inputs.outputs` or a V30 trigger's
|
|
1907
|
+
* stray `data.uipath.outputs`), each with that trigger's id. Compile writes
|
|
1908
|
+
* that bridge row for every In-arg.
|
|
1909
|
+
*/
|
|
1910
|
+
function unbridgedInArgs(plan) {
|
|
1911
|
+
const triggers = new Map((plan.nodes ?? []).filter(isTrigger).map((node) => [node.id, node]));
|
|
1912
|
+
return (plan.variables?.inputs ?? []).flatMap((input) => {
|
|
1913
|
+
const node = typeof input.elementId === 'string' ? triggers.get(input.elementId) : undefined;
|
|
1914
|
+
if (!node || typeof node.id !== 'string' || typeof input.id !== 'string' || !input.name)
|
|
1915
|
+
return [];
|
|
1916
|
+
const stray = node.type === 'uipath.case.trigger' ? (node.data?.uipath?.outputs ?? []) : [];
|
|
1917
|
+
const rows = [...(triggerData(node).bag?.outputs ?? []), ...stray];
|
|
1918
|
+
return rows.some((row) => row?.source === `=vars.${input.id}`) ? [] : [{ name: input.name, trigger: node.id }];
|
|
1919
|
+
});
|
|
1920
|
+
}
|
|
1870
1921
|
function emitVariables(out, depth, plan, triggerNameById, triggerIsTimer) {
|
|
1871
1922
|
const variables = plan.variables ?? {};
|
|
1872
1923
|
const produced = producedVariableNames(plan);
|
|
@@ -2831,6 +2882,8 @@ export function collectPreservation(plan) {
|
|
|
2831
2882
|
const legacyVariableDefaults = {};
|
|
2832
2883
|
const variableOrder = {};
|
|
2833
2884
|
const declaredInOut = declaredInOutNames(plan);
|
|
2885
|
+
const writtenElementId = companionElementIds(plan);
|
|
2886
|
+
let elementIds;
|
|
2834
2887
|
for (const lane of ['inputs', 'outputs', 'inputOutputs']) {
|
|
2835
2888
|
const rows = plan.variables?.[lane] ?? [];
|
|
2836
2889
|
if (rows.length)
|
|
@@ -2853,6 +2906,23 @@ export function collectPreservation(plan) {
|
|
|
2853
2906
|
const formalOutput = (plan.variables?.outputs ?? []).find((candidate) => candidate.name === row.name);
|
|
2854
2907
|
if (lane === 'inputOutputs' && formalOutput && row.default !== undefined && formalOutput.default !== row.default)
|
|
2855
2908
|
fields.default = row.default;
|
|
2909
|
+
// The element a root row belongs to. Compile writes the In-arg's trigger on
|
|
2910
|
+
// its companion and `root` on every other row; Studio Web can save another
|
|
2911
|
+
// (a `.var()` row it keeps under `trigger_1` after the In-arg that put it
|
|
2912
|
+
// there went). The converter copies it into the BPMN variables, so it is
|
|
2913
|
+
// carried with the value compile writes, and applied only while compile
|
|
2914
|
+
// still writes that value.
|
|
2915
|
+
if (lane === 'inputOutputs' && typeof row.elementId === 'string') {
|
|
2916
|
+
const written = writtenElementId.get(row.name);
|
|
2917
|
+
if (written !== undefined && written !== row.elementId)
|
|
2918
|
+
Object.assign(fields, {
|
|
2919
|
+
elementId: row.elementId,
|
|
2920
|
+
...(written === 'root' ? {} : { writtenElementId: written }),
|
|
2921
|
+
// One that named no element when saved stays as saved; compile cannot
|
|
2922
|
+
// tell an element an edit deleted from one that was never there.
|
|
2923
|
+
...(row.elementId === 'root' || (elementIds ??= planElementIds(plan)).has(row.elementId) ? {} : { elementIdUnresolved: true }),
|
|
2924
|
+
});
|
|
2925
|
+
}
|
|
2856
2926
|
if (lane === 'outputs' && row.var !== undefined)
|
|
2857
2927
|
fields.var = row.var;
|
|
2858
2928
|
// `body` is typed only on a structured (`jsonSchema`) variable. On any
|
|
@@ -2885,6 +2955,9 @@ export function collectPreservation(plan) {
|
|
|
2885
2955
|
.map((row) => row.name);
|
|
2886
2956
|
if (omitInputDefaults.length)
|
|
2887
2957
|
preservation.omitInputDefaults = omitInputDefaults;
|
|
2958
|
+
const unbridged = unbridgedInArgs(plan);
|
|
2959
|
+
if (unbridged.length)
|
|
2960
|
+
preservation.unbridgedInArgs = unbridged;
|
|
2888
2961
|
if (Object.keys(variableFields).length)
|
|
2889
2962
|
preservation.variableFields = variableFields;
|
|
2890
2963
|
if (Object.keys(legacyVariableDefaults).length)
|
package/dist/case/preserve.d.ts
CHANGED
|
@@ -6,6 +6,14 @@ import type { BindingsView } from '../core/binding-messages.js';
|
|
|
6
6
|
import { type PreservedResourceWire } from './resource-wire.js';
|
|
7
7
|
import { type PreservedDocumentExtractionData } from './document-extraction-saved.js';
|
|
8
8
|
export type PreservedVariableLane = 'inputs' | 'outputs' | 'inputOutputs';
|
|
9
|
+
/**
|
|
10
|
+
* The ids a variable row's `elementId` can name in `plan`: every node (stages,
|
|
11
|
+
* triggers), and every task, by its own id and by the `<stageId>-<taskId>`
|
|
12
|
+
* form Studio Web writes on task io rows.
|
|
13
|
+
*/
|
|
14
|
+
export declare function planElementIds(plan: {
|
|
15
|
+
nodes?: unknown;
|
|
16
|
+
}): Set<string>;
|
|
9
17
|
/**
|
|
10
18
|
* A preserved `inputs[]` / `outputs[]` slot id copied verbatim from its name is
|
|
11
19
|
* the STRICT_FORMAL_ARG_ID defect, not an identity to keep; the minted id stands.
|
|
@@ -302,6 +310,18 @@ export interface CaseJsonPreservation {
|
|
|
302
310
|
* platform's V23 -> V24 migration does when it makes the same change.
|
|
303
311
|
*/
|
|
304
312
|
legacyTriggerIds?: string[];
|
|
313
|
+
/**
|
|
314
|
+
* In-args whose trigger has no bridge row reading them (no `{ source:
|
|
315
|
+
* "=vars.<slot>" }` in its `outputs`). Compile writes that row for every
|
|
316
|
+
* In-arg; a Studio Web plan can lack it, and then the companion is never set
|
|
317
|
+
* when the case starts. Compile leaves the row out again for each In-arg
|
|
318
|
+
* only while it is still bound to the trigger that lacked the row: an edit
|
|
319
|
+
* that binds it to another trigger gets that trigger's bridge.
|
|
320
|
+
*/
|
|
321
|
+
unbridgedInArgs?: Array<{
|
|
322
|
+
name: string;
|
|
323
|
+
trigger: string;
|
|
324
|
+
}>;
|
|
305
325
|
/**
|
|
306
326
|
* Opaque V30 layout side-car. Decompile folds a node's inline
|
|
307
327
|
* {@link CASE_NODE_LAYOUT_FIELDS} into it, the platform's disk form.
|
|
@@ -345,7 +365,16 @@ export interface CaseJsonPreservation {
|
|
|
345
365
|
* being silently rewritten.
|
|
346
366
|
*/
|
|
347
367
|
publishVersion?: number;
|
|
348
|
-
/**
|
|
368
|
+
/**
|
|
369
|
+
* Designer-internal variable fields keyed by lane and variable name. On an
|
|
370
|
+
* `inputOutputs` row, `elementId` is the element Studio Web saved the row
|
|
371
|
+
* under when compile writes another (`writtenElementId`, absent for `root`);
|
|
372
|
+
* compile puts it back only while it still writes that value, so a source
|
|
373
|
+
* edit that moves the row (a `.var()` made an In-arg) keeps compile's. It is
|
|
374
|
+
* also put back only while it is `root` or names an element of the plan
|
|
375
|
+
* (`planElementIds`), unless it named none when saved
|
|
376
|
+
* (`elementIdUnresolved`): an edit that deletes that element gets `root`.
|
|
377
|
+
*/
|
|
349
378
|
variableFields?: Partial<Record<PreservedVariableLane, Record<string, Record<string, unknown>>>>;
|
|
350
379
|
/**
|
|
351
380
|
* Legacy non-string defaults retained by decompile/recompile. Each value must
|
package/dist/case/preserve.js
CHANGED
|
@@ -4,6 +4,23 @@ import { Bindings } from '../core/bindings.js';
|
|
|
4
4
|
import { bindingIdCandidates, offlineBindingLabel } from './ids.js';
|
|
5
5
|
import { resourceBindingSeed, resourceWireError } from './resource-wire.js';
|
|
6
6
|
import { preservedDocumentExtractionDataError } from './document-extraction-saved.js';
|
|
7
|
+
/**
|
|
8
|
+
* The ids a variable row's `elementId` can name in `plan`: every node (stages,
|
|
9
|
+
* triggers), and every task, by its own id and by the `<stageId>-<taskId>`
|
|
10
|
+
* form Studio Web writes on task io rows.
|
|
11
|
+
*/
|
|
12
|
+
export function planElementIds(plan) {
|
|
13
|
+
const ids = new Set();
|
|
14
|
+
for (const node of (Array.isArray(plan.nodes) ? plan.nodes : [])) {
|
|
15
|
+
if (typeof node?.id !== 'string')
|
|
16
|
+
continue;
|
|
17
|
+
ids.add(node.id);
|
|
18
|
+
for (const task of (node.data?.tasks ?? []).flat())
|
|
19
|
+
if (typeof task?.id === 'string')
|
|
20
|
+
ids.add(task.id).add(`${node.id}-${task.id}`);
|
|
21
|
+
}
|
|
22
|
+
return ids;
|
|
23
|
+
}
|
|
7
24
|
/**
|
|
8
25
|
* A preserved `inputs[]` / `outputs[]` slot id copied verbatim from its name is
|
|
9
26
|
* the STRICT_FORMAL_ARG_ID defect, not an identity to keep; the minted id stands.
|
|
@@ -280,6 +297,13 @@ export function caseJsonPreservationErrors(payload) {
|
|
|
280
297
|
continue;
|
|
281
298
|
}
|
|
282
299
|
// A carried `body` names the non-structured type it was saved for.
|
|
300
|
+
for (const [name, fields] of Object.entries(rows ?? {}))
|
|
301
|
+
for (const field of ['elementId', 'writtenElementId'])
|
|
302
|
+
if (fields[field] !== undefined && (typeof fields[field] !== 'string' || fields[field] === ''))
|
|
303
|
+
errors.push(`variable "${name}" carried ${field} must be a non-empty string`);
|
|
304
|
+
for (const [name, fields] of Object.entries(rows ?? {}))
|
|
305
|
+
if (fields.elementIdUnresolved !== undefined && fields.elementIdUnresolved !== true)
|
|
306
|
+
errors.push(`variable "${name}" carried elementIdUnresolved must be true when present`);
|
|
283
307
|
for (const [name, fields] of Object.entries(rows ?? {}))
|
|
284
308
|
if (fields.body !== undefined && (typeof fields.bodyType !== 'string' || fields.bodyType === 'jsonSchema'))
|
|
285
309
|
errors.push(`variable "${name}" carried body needs the non-jsonSchema type it was saved for (bodyType)`);
|
|
@@ -288,12 +312,12 @@ export function caseJsonPreservationErrors(payload) {
|
|
|
288
312
|
if (lane === 'inputOutputs' && field === 'value')
|
|
289
313
|
errors.push(`variable "${name}" field "value" on inputOutputs is behavior (a process mapping's var) and cannot be preserved`);
|
|
290
314
|
else if (!PRESERVED_VARIABLE_KEYS.has(field)
|
|
291
|
-
&& !(lane === 'inputOutputs' && (field === 'default' || field === 'custom'))
|
|
315
|
+
&& !(lane === 'inputOutputs' && (field === 'default' || field === 'custom' || field === 'elementId' || field === 'writtenElementId' || field === 'elementIdUnresolved'))
|
|
292
316
|
&& !(lane === 'outputs' && field === 'var')
|
|
293
317
|
&& field !== 'body' && field !== 'bodyType')
|
|
294
318
|
errors.push(`variable "${name}" field "${field}" is not an allowed preserved designer field`);
|
|
295
319
|
else if (VARIABLE_KEYS.has(field)
|
|
296
|
-
&& !(lane === 'inputOutputs' && field === 'default')
|
|
320
|
+
&& !(lane === 'inputOutputs' && (field === 'default' || field === 'elementId'))
|
|
297
321
|
&& !(lane === 'outputs' && field === 'var')
|
|
298
322
|
&& field !== 'body')
|
|
299
323
|
errors.push(`variable "${name}" field "${field}" is owned by the typed Case serializer`);
|
|
@@ -314,6 +338,10 @@ export function caseJsonPreservationErrors(payload) {
|
|
|
314
338
|
errors.push(`legacy variable default "${name}" must be a JSON-encodable non-string value`);
|
|
315
339
|
}
|
|
316
340
|
}
|
|
341
|
+
if (payload.unbridgedInArgs !== undefined
|
|
342
|
+
&& (!Array.isArray(payload.unbridgedInArgs) || !payload.unbridgedInArgs.every((entry) => entry !== null && typeof entry === 'object'
|
|
343
|
+
&& typeof entry.name === 'string' && entry.name !== '' && typeof entry.trigger === 'string' && entry.trigger !== '')))
|
|
344
|
+
errors.push('preserved "unbridgedInArgs" must be an array of { name, trigger } with non-empty strings');
|
|
317
345
|
if (payload.legacyTriggerIds !== undefined
|
|
318
346
|
&& (!Array.isArray(payload.legacyTriggerIds) || !payload.legacyTriggerIds.every((id) => typeof id === 'string')))
|
|
319
347
|
errors.push('preserved "legacyTriggerIds" must be an array of trigger id strings');
|
package/dist/case/serialize.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* name) are resolved here to the generated ids.
|
|
10
10
|
*/
|
|
11
11
|
import { IdGen, offlineBindingSeed } from './ids.js';
|
|
12
|
-
import { CASE_EMPTY_LISTS, isUnrestorableSlotId, METADATA_ABSENT_READING, STAGE_EMPTY_LISTS, TASK_EMPTY_LISTS, taskFingerprint } from './preserve.js';
|
|
12
|
+
import { CASE_EMPTY_LISTS, isUnrestorableSlotId, METADATA_ABSENT_READING, planElementIds, STAGE_EMPTY_LISTS, TASK_EMPTY_LISTS, taskFingerprint } from './preserve.js';
|
|
13
13
|
import { v31TaskSets } from './task-sets.js';
|
|
14
14
|
import { camelizeName, defaultActionOutputVar } from './action-output-var.js';
|
|
15
15
|
import { ACTION_CONTEXT_COPIES, ACTION_FORM_KIND_CONTEXT, ACTION_PASSTHROUGH_SETTINGS } from './action-settings.js';
|
|
@@ -624,6 +624,7 @@ export function applyPreservation(result, preservation, options = {}) {
|
|
|
624
624
|
const named = new Set(order ?? []);
|
|
625
625
|
variables[lane] = [...ordered, ...rows.filter((row) => !named.has(String(row.name ?? '')))];
|
|
626
626
|
}
|
|
627
|
+
let elementIds;
|
|
627
628
|
for (const [lane, byName] of Object.entries(preservation.variableFields ?? {})) {
|
|
628
629
|
const rows = variables[lane] ?? [];
|
|
629
630
|
for (const [name, fields] of Object.entries(byName ?? {})) {
|
|
@@ -632,16 +633,27 @@ export function applyPreservation(result, preservation, options = {}) {
|
|
|
632
633
|
continue;
|
|
633
634
|
// `custom` alone has nothing to mark when no row is written: an older SDK's
|
|
634
635
|
// companion for a variable an output writes, which this one migrates away.
|
|
635
|
-
|
|
636
|
+
// A carried `elementId` likewise has no row to re-point.
|
|
637
|
+
if (!row && Object.keys(fields).every((field) => field === 'custom' || (lane === 'inputOutputs' && (field === 'elementId' || field === 'writtenElementId' || field === 'elementIdUnresolved'))))
|
|
636
638
|
continue;
|
|
637
639
|
if (!row)
|
|
638
640
|
throw new CompileRefusal('PRESERVATION_TARGET_MISSING', `preserved variable "${name}" was not regenerated in variables.${lane}.`);
|
|
639
641
|
for (const [field, value] of Object.entries(fields)) {
|
|
640
642
|
// `bodyType` is the type a carried `body` was saved for, not a field.
|
|
641
|
-
if (field === 'bodyType')
|
|
643
|
+
if (field === 'bodyType' || field === 'writtenElementId' || field === 'elementIdUnresolved')
|
|
642
644
|
continue;
|
|
643
645
|
if (row[field] === value)
|
|
644
646
|
continue;
|
|
647
|
+
// A saved `elementId` replaces the one compile writes only while compile
|
|
648
|
+
// writes the value it wrote at decompile; an edit that moved the row wins.
|
|
649
|
+
// It must also still name an element of the plan (or have named none when
|
|
650
|
+
// saved): an edit that deleted the trigger it names gets compile's `root`.
|
|
651
|
+
if (lane === 'inputOutputs' && field === 'elementId') {
|
|
652
|
+
const stillThere = value === 'root' || fields.elementIdUnresolved === true || (elementIds ??= planElementIds(result)).has(String(value));
|
|
653
|
+
if (stillThere && row.elementId === (fields.writtenElementId ?? 'root'))
|
|
654
|
+
row.elementId = value;
|
|
655
|
+
continue;
|
|
656
|
+
}
|
|
645
657
|
// A carried `body` describes the type it was saved with. A variable the
|
|
646
658
|
// edit gave another type (a `string`, or a `jsonSchema` with the schema
|
|
647
659
|
// the author typed) does not get it.
|
|
@@ -676,6 +688,23 @@ export function applyPreservation(result, preservation, options = {}) {
|
|
|
676
688
|
row.default = value;
|
|
677
689
|
}
|
|
678
690
|
}
|
|
691
|
+
// An In-arg its trigger had no bridge row for: drop the row compile wrote,
|
|
692
|
+
// and the `outputs` list when that row was its only entry. Only while the
|
|
693
|
+
// In-arg is still bound to that trigger: one an edit rebinds keeps its bridge.
|
|
694
|
+
for (const { name, trigger } of preservation.unbridgedInArgs ?? []) {
|
|
695
|
+
const input = (variables.inputs ?? []).find((candidate) => candidate.name === name);
|
|
696
|
+
if (!input || typeof input.id !== 'string' || input.elementId !== trigger)
|
|
697
|
+
continue;
|
|
698
|
+
const node = result.nodes.find((candidate) => candidate.id === input.elementId);
|
|
699
|
+
const bag = node?.data?.[CASE_FORMAT_PROFILE.triggerBagField];
|
|
700
|
+
if (!Array.isArray(bag?.outputs))
|
|
701
|
+
continue;
|
|
702
|
+
bag.outputs = bag.outputs.filter((row) => row?.source !== `=vars.${input.id}`);
|
|
703
|
+
if (!bag.outputs.length)
|
|
704
|
+
delete bag.outputs;
|
|
705
|
+
if (!Object.keys(bag).length)
|
|
706
|
+
delete node.data[CASE_FORMAT_PROFILE.triggerBagField];
|
|
707
|
+
}
|
|
679
708
|
for (const name of preservation.omitInputDefaults ?? []) {
|
|
680
709
|
const row = (variables.inputs ?? []).find((candidate) => candidate.name === name);
|
|
681
710
|
if (row?.default === '')
|
package/dist/core/ts-literal.js
CHANGED
|
@@ -19,11 +19,38 @@ const LINE_SEPARATORS = /[\u2028\u2029]/g;
|
|
|
19
19
|
export function tsLiteral(value) {
|
|
20
20
|
if (value === undefined)
|
|
21
21
|
throw new Error('cannot write undefined as a TypeScript literal.');
|
|
22
|
-
const json = JSON.stringify(value);
|
|
22
|
+
const json = hasProtoKey(value) ? protoSafe(value) : JSON.stringify(value);
|
|
23
23
|
if (json === undefined)
|
|
24
24
|
throw new Error(`cannot write a ${typeof value} as a TypeScript literal.`);
|
|
25
25
|
return json.replace(LINE_SEPARATORS, (c) => `\\u${c.charCodeAt(0).toString(16)}`);
|
|
26
26
|
}
|
|
27
|
+
/** Whether `value` holds an object with an own `__proto__` key, at any depth. */
|
|
28
|
+
function hasProtoKey(value) {
|
|
29
|
+
if (Array.isArray(value))
|
|
30
|
+
return value.some(hasProtoKey);
|
|
31
|
+
if (value === null || typeof value !== 'object')
|
|
32
|
+
return false;
|
|
33
|
+
return Object.hasOwn(value, '__proto__') || Object.values(value).some(hasProtoKey);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* `value`'s JSON, with each own `__proto__` key written as the computed key
|
|
37
|
+
* `["__proto__"]`. In an object literal a plain `"__proto__": x` sets the
|
|
38
|
+
* prototype instead of making a key, so the key was lost on compile; a
|
|
39
|
+
* computed key makes an own property, as `JSON.parse` does.
|
|
40
|
+
*/
|
|
41
|
+
function protoSafe(value) {
|
|
42
|
+
if (Array.isArray(value))
|
|
43
|
+
return `[${value.map((v) => protoSafe(v) ?? 'null').join(',')}]`;
|
|
44
|
+
if (value === null || typeof value !== 'object' || typeof value.toJSON === 'function')
|
|
45
|
+
return JSON.stringify(value);
|
|
46
|
+
const parts = [];
|
|
47
|
+
for (const [k, v] of Object.entries(value)) {
|
|
48
|
+
const item = protoSafe(v);
|
|
49
|
+
if (item !== undefined)
|
|
50
|
+
parts.push(`${k === '__proto__' ? '["__proto__"]' : JSON.stringify(k)}:${item}`);
|
|
51
|
+
}
|
|
52
|
+
return `{${parts.join(',')}}`;
|
|
53
|
+
}
|
|
27
54
|
/** `value` as a TS string literal, null and undefined as `""` (the BPMN decompiler's text fields). */
|
|
28
55
|
export function tsText(value) {
|
|
29
56
|
return tsLiteral(String(value ?? ''));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.93.
|
|
3
|
+
"version": "6.93.5",
|
|
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",
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
"@types/node": "^22.7.0",
|
|
112
112
|
"esbuild": "^0.28.1"
|
|
113
113
|
},
|
|
114
|
-
"gitref": "
|
|
114
|
+
"gitref": "6a68485f8a16c79eafdc26f4ef14b6d90324bef3"
|
|
115
115
|
}
|