@uipath/maestro-builder-sdk 6.124.4 → 6.124.6
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/decompile.js +65 -0
- package/dist/merge-variables.d.ts +35 -0
- package/dist/merge-variables.js +74 -0
- package/dist/merge.js +2 -2
- package/dist/migrate.d.ts +36 -0
- package/dist/migrate.js +1 -1
- package/dist/registry/library-build/context.d.ts +7 -6
- package/dist/registry/library-build/context.js +15 -11
- package/dist/registry/library-build/enrich.js +2 -0
- package/dist/registry/prepare/failed-describe.d.ts +3 -0
- package/dist/registry/prepare/failed-describe.js +26 -0
- package/dist/registry/prepare/messages.d.ts +11 -0
- package/dist/registry/prepare/messages.js +29 -0
- package/dist/registry/prepare/pipeline.js +3 -0
- package/package.json +2 -2
package/dist/decompile.js
CHANGED
|
@@ -2486,6 +2486,14 @@ function region(cursor, stop, scope, ipdom, ctx, refInto) {
|
|
|
2486
2486
|
flagDropped(node, ctx, segs);
|
|
2487
2487
|
return segs;
|
|
2488
2488
|
}
|
|
2489
|
+
// Arms that never meet, not every one of them ending: side lists off the one port.
|
|
2490
|
+
const sides = stopBehind === undefined ? sideListFanOut(node, stop, scope, ctx, ipdom, refInto) : undefined;
|
|
2491
|
+
if (sides) {
|
|
2492
|
+
segs.push(...sides.segs);
|
|
2493
|
+
cursor = sides.cursor;
|
|
2494
|
+
flagDropped(node, ctx, segs);
|
|
2495
|
+
continue;
|
|
2496
|
+
}
|
|
2489
2497
|
// Unstructured fan-out we can't fold — best-effort marker.
|
|
2490
2498
|
// No successor is walked: leave the edges unaccounted so `flagDropped` names each.
|
|
2491
2499
|
const why = stopBehind !== undefined ? terminateBehindStepWhy(stopBehind) : '';
|
|
@@ -2497,6 +2505,63 @@ function region(cursor, stop, scope, ipdom, ctx, refInto) {
|
|
|
2497
2505
|
}
|
|
2498
2506
|
return segs;
|
|
2499
2507
|
}
|
|
2508
|
+
/**
|
|
2509
|
+
* A fan-out whose arms never meet and do not all end, spelled as side lists off
|
|
2510
|
+
* the one port: every arm but the last is `.stepToList(<port>, …)`, and the walk
|
|
2511
|
+
* goes on down the last arm. For instance `prep@success -> a -> End` beside
|
|
2512
|
+
* `prep@success -> b` (b's path left open, which the canvas and the classic CLI
|
|
2513
|
+
* both write) is
|
|
2514
|
+
*
|
|
2515
|
+
* ```ts
|
|
2516
|
+
* .step('prep', …)
|
|
2517
|
+
* .stepToList('success', (p) => p.step('a', …).return({}))
|
|
2518
|
+
* .step('b', …)
|
|
2519
|
+
* ```
|
|
2520
|
+
*
|
|
2521
|
+
* which serialize writes back as the same two edges out of `prep@success`: a
|
|
2522
|
+
* side list leaves from the port the main path also continues from, and under
|
|
2523
|
+
* `.openTails()` (which decompile always emits) neither path gains an End.
|
|
2524
|
+
* There is no join to lose: the file has none, and `.parallel(...)` would add
|
|
2525
|
+
* one (a Merge waits for every arm, which this flow never did). An arm that
|
|
2526
|
+
* does reach a step of the last arm's path ends in `.stepToRef(...)`, the edge
|
|
2527
|
+
* the file has.
|
|
2528
|
+
*
|
|
2529
|
+
* `undefined`, so the caller keeps its marker, when the port has more than two
|
|
2530
|
+
* edges (a port takes one side list), when the edges leave more than one port, from a human task (whose ports a side list may not rewire), when
|
|
2531
|
+
* an arm goes straight into the enclosing loop's handle, or when an arm would
|
|
2532
|
+
* walk past the region's `stop` the last arm does not reach (the enclosing
|
|
2533
|
+
* construct emits that node).
|
|
2534
|
+
*/
|
|
2535
|
+
function sideListFanOut(node, stop, scope, ctx, ipdom, refInto) {
|
|
2536
|
+
const edges = scopeSuccEdges(ctx.graph, node.id, scope);
|
|
2537
|
+
// Exactly two: a port takes one side list (PORT_ALREADY_ROUTED), so a third arm
|
|
2538
|
+
// has nowhere to go and the fan-out keeps the marker.
|
|
2539
|
+
if (edges.length !== 2)
|
|
2540
|
+
return undefined;
|
|
2541
|
+
const port = edges[0].sourcePort;
|
|
2542
|
+
if (edges.some((e) => e.sourcePort !== port) || ctx.graph.primaryOutcomePort(node.id) !== undefined)
|
|
2543
|
+
return undefined;
|
|
2544
|
+
const main = edges[edges.length - 1];
|
|
2545
|
+
const mainReach = forwardReach([main.targetNodeId], scope, ctx.graph);
|
|
2546
|
+
for (const e of edges.slice(0, -1)) {
|
|
2547
|
+
// An arm straight into the enclosing container's handle is no side list.
|
|
2548
|
+
if (e.targetNodeId === ctx.breakInto)
|
|
2549
|
+
return undefined;
|
|
2550
|
+
const reach = forwardReach([e.targetNodeId], scope, ctx.graph);
|
|
2551
|
+
if (stop !== EXIT && reach.has(stop) && !mainReach.has(stop))
|
|
2552
|
+
return undefined;
|
|
2553
|
+
}
|
|
2554
|
+
// A side path may also hand control back to what the enclosing side path rejoins.
|
|
2555
|
+
const into = new Set([...mainReach, ...(refInto ?? [])]);
|
|
2556
|
+
const segs = [];
|
|
2557
|
+
for (const e of edges.slice(0, -1)) {
|
|
2558
|
+
const body = edgeRegion(e, EXIT, scope, ipdom, ctx, into);
|
|
2559
|
+
if (body.length === 0)
|
|
2560
|
+
return undefined;
|
|
2561
|
+
segs.push(`.stepToList(${tsLiteral(port)}, ${armCb('p', body)})`);
|
|
2562
|
+
}
|
|
2563
|
+
return { segs, cursor: follow(ctx.graph, node.id, main.targetNodeId) };
|
|
2564
|
+
}
|
|
2500
2565
|
/** A branch/switch node's arm labels (the designer edge text), when non-default. */
|
|
2501
2566
|
function armLabels(node) {
|
|
2502
2567
|
const i = node.inputs ?? {};
|
|
@@ -23,4 +23,39 @@ export declare function mergeVariables(original: Json, edited: Json, baseline: {
|
|
|
23
23
|
* author changed. Built from entries, so an own `__proto__` key stays a key.
|
|
24
24
|
*/
|
|
25
25
|
export declare function mergeObject(o: Obj, b: Obj, e: Obj, inner: (o: Json, b: Json, e: Json) => Json): Obj;
|
|
26
|
+
/** The fields of a node {@link withoutReturnRespellings} reads. */
|
|
27
|
+
interface EndLike {
|
|
28
|
+
id: string;
|
|
29
|
+
type: string;
|
|
30
|
+
outputs?: unknown;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The merged `variables` without the update rows that only re-spell what an
|
|
34
|
+
* End returns, where the original End returned it without one.
|
|
35
|
+
*
|
|
36
|
+
* Studio Web returns a Variable (an `inout` global) from an End through the
|
|
37
|
+
* End's output mapping alone, `outputs.<id>.source`, with no variable update.
|
|
38
|
+
* Compile writes a `.return({ items: … })` of a Variable as that mapping AND an
|
|
39
|
+
* update row with the same expression, and decompile reads either spelling as
|
|
40
|
+
* the same `.return`. So when the author edits what an End returns, the row is
|
|
41
|
+
* compile's spelling of the edit, not a second edit, and a file whose End had
|
|
42
|
+
* none keeps none.
|
|
43
|
+
*
|
|
44
|
+
* Example, the author changes what End `end` returns for Variable `items`:
|
|
45
|
+
*
|
|
46
|
+
* original end.outputs.items.source = $vars.items no rows
|
|
47
|
+
* edited end.outputs.items.source = ($vars.items) ?? null end: [items = ($vars.items) ?? null]
|
|
48
|
+
* merged end.outputs.items.source = ($vars.items) ?? null no rows
|
|
49
|
+
*
|
|
50
|
+
* A row is dropped only when all hold: the node is an End (or Terminate: a node
|
|
51
|
+
* whose `outputs.<id>.source` is its return mapping, `isOutputMappingNode`) the original has;
|
|
52
|
+
* the variable is a Variable; the row's expression is the End's mapping for it;
|
|
53
|
+
* and the original End wrote no row for it. A row for an Output, for a name
|
|
54
|
+
* that is no global, or with another expression is the author's (or the
|
|
55
|
+
* original's) and stays.
|
|
56
|
+
*/
|
|
57
|
+
export declare function withoutReturnRespellings(variables: Json, nodes: readonly EndLike[], original: {
|
|
58
|
+
nodes?: readonly EndLike[];
|
|
59
|
+
variables?: Json;
|
|
60
|
+
}): Json;
|
|
26
61
|
export {};
|
package/dist/merge-variables.js
CHANGED
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
*/
|
|
43
43
|
import { jsonClone } from './core/json-clone.js';
|
|
44
44
|
import { CONTAINER_KEYS } from './flow-variables.js';
|
|
45
|
+
import { isOutputMappingNode } from './migrate.js';
|
|
45
46
|
/** `jsonClone`, which also passes `undefined` (an absent section or key) through. */
|
|
46
47
|
const copy = (v) => (v === undefined ? v : jsonClone(v));
|
|
47
48
|
const isObj = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
@@ -368,3 +369,76 @@ function boundToGoneNode(entry, goneNodeIds) {
|
|
|
368
369
|
const nodeId = isObj(entry.binding) ? entry.binding.nodeId : undefined;
|
|
369
370
|
return typeof nodeId === 'string' && goneNodeIds.has(nodeId);
|
|
370
371
|
}
|
|
372
|
+
/** An expression's text in either End spelling, `"=js: x"` or `{ type: 'jsExpression', expression: 'x' }`. */
|
|
373
|
+
function jsBody(v) {
|
|
374
|
+
if (typeof v === 'string')
|
|
375
|
+
return v.startsWith('=js:') ? v.slice(4).trim() : undefined;
|
|
376
|
+
return isObj(v) && v.type === 'jsExpression' && typeof v.expression === 'string' ? v.expression.trim() : undefined;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* The merged `variables` without the update rows that only re-spell what an
|
|
380
|
+
* End returns, where the original End returned it without one.
|
|
381
|
+
*
|
|
382
|
+
* Studio Web returns a Variable (an `inout` global) from an End through the
|
|
383
|
+
* End's output mapping alone, `outputs.<id>.source`, with no variable update.
|
|
384
|
+
* Compile writes a `.return({ items: … })` of a Variable as that mapping AND an
|
|
385
|
+
* update row with the same expression, and decompile reads either spelling as
|
|
386
|
+
* the same `.return`. So when the author edits what an End returns, the row is
|
|
387
|
+
* compile's spelling of the edit, not a second edit, and a file whose End had
|
|
388
|
+
* none keeps none.
|
|
389
|
+
*
|
|
390
|
+
* Example, the author changes what End `end` returns for Variable `items`:
|
|
391
|
+
*
|
|
392
|
+
* original end.outputs.items.source = $vars.items no rows
|
|
393
|
+
* edited end.outputs.items.source = ($vars.items) ?? null end: [items = ($vars.items) ?? null]
|
|
394
|
+
* merged end.outputs.items.source = ($vars.items) ?? null no rows
|
|
395
|
+
*
|
|
396
|
+
* A row is dropped only when all hold: the node is an End (or Terminate: a node
|
|
397
|
+
* whose `outputs.<id>.source` is its return mapping, `isOutputMappingNode`) the original has;
|
|
398
|
+
* the variable is a Variable; the row's expression is the End's mapping for it;
|
|
399
|
+
* and the original End wrote no row for it. A row for an Output, for a name
|
|
400
|
+
* that is no global, or with another expression is the author's (or the
|
|
401
|
+
* original's) and stays.
|
|
402
|
+
*/
|
|
403
|
+
export function withoutReturnRespellings(variables, nodes, original) {
|
|
404
|
+
if (!isObj(variables) || !isObj(variables.variableUpdates))
|
|
405
|
+
return variables;
|
|
406
|
+
const updates = variables.variableUpdates;
|
|
407
|
+
const globals = Array.isArray(variables.globals) ? variables.globals : [];
|
|
408
|
+
const isVariable = (id) => globals.some((g) => isObj(g) && g.id === id && g.direction === 'inout');
|
|
409
|
+
const origEnds = new Set((original.nodes ?? []).filter((n) => isOutputMappingNode(n.type)).map((n) => n.id));
|
|
410
|
+
const origUpdates = isObj(original.variables) && isObj(original.variables.variableUpdates) ? original.variables.variableUpdates : {};
|
|
411
|
+
// Collected as entries and built with Object.fromEntries: a node id such as
|
|
412
|
+
// `__proto__` assigned onto a plain object would hit the prototype setter
|
|
413
|
+
// and vanish from the result.
|
|
414
|
+
const out = [];
|
|
415
|
+
let changed = false;
|
|
416
|
+
for (const [nodeId, rows] of Object.entries(updates)) {
|
|
417
|
+
const end = nodes.find((n) => n.id === nodeId && isOutputMappingNode(n.type));
|
|
418
|
+
if (!end || !origEnds.has(nodeId) || !Array.isArray(rows)) {
|
|
419
|
+
out.push([nodeId, rows]);
|
|
420
|
+
continue;
|
|
421
|
+
}
|
|
422
|
+
const origRows = has(origUpdates, nodeId) && Array.isArray(origUpdates[nodeId]) ? origUpdates[nodeId] : [];
|
|
423
|
+
const kept = rows.filter((r) => {
|
|
424
|
+
if (!isObj(r) || typeof r.variableId !== 'string')
|
|
425
|
+
return true;
|
|
426
|
+
const id = r.variableId;
|
|
427
|
+
if (!isVariable(id) || origRows.some((x) => isObj(x) && x.variableId === id))
|
|
428
|
+
return true;
|
|
429
|
+
const body = jsBody(r.expression);
|
|
430
|
+
const mapping = isObj(end.outputs) && isObj(end.outputs[id]) ? end.outputs[id].source : undefined;
|
|
431
|
+
return body === undefined || body !== jsBody(mapping);
|
|
432
|
+
});
|
|
433
|
+
if (kept.length !== rows.length)
|
|
434
|
+
changed = true;
|
|
435
|
+
if (kept.length)
|
|
436
|
+
out.push([nodeId, kept]);
|
|
437
|
+
}
|
|
438
|
+
if (!changed)
|
|
439
|
+
return variables;
|
|
440
|
+
// An original with no `variableUpdates` key keeps none when nothing is left.
|
|
441
|
+
if (out.length || (isObj(original.variables) && has(original.variables, 'variableUpdates')))
|
|
442
|
+
return { ...variables, variableUpdates: Object.fromEntries(out) };
|
|
443
|
+
return Object.fromEntries(Object.entries(variables).filter(([k]) => k !== 'variableUpdates'));
|
|
444
|
+
}
|
package/dist/merge.js
CHANGED
|
@@ -104,7 +104,7 @@ import { MergeRefusedError, mergedFileFindings, roundTripFindings } from './merg
|
|
|
104
104
|
import { placeAddedNodes, stripPlaceholderFlag, unplacedRule } from './node-placement.js';
|
|
105
105
|
import { mergeAgentSidecars } from './merge-sidecars.js';
|
|
106
106
|
import { embeddedAgentFindings, isEmbeddedAgent, mergeEmbeddedAgentNode } from './merge-embedded-agent.js';
|
|
107
|
-
import { mergeObject, mergeVariables, stableJson } from './merge-variables.js';
|
|
107
|
+
import { mergeObject, mergeVariables, stableJson, withoutReturnRespellings } from './merge-variables.js';
|
|
108
108
|
import { keepProcessInputReads } from './merge-process-inputs.js';
|
|
109
109
|
import { replaceSupersededOutputs } from './merge-superseded-outputs.js';
|
|
110
110
|
import { restoredConnectionMessage, withOriginalConnectionLabels } from './merge-baseline-connections.js';
|
|
@@ -585,7 +585,7 @@ function mergeFlowFindings(original, edited, options) {
|
|
|
585
585
|
if (layoutNodes)
|
|
586
586
|
for (const id of goneNodeIds)
|
|
587
587
|
delete layoutNodes[id];
|
|
588
|
-
const variables = mergeVariables(original.variables, edited.variables, options.baseline, goneNodeIds);
|
|
588
|
+
const variables = withoutReturnRespellings(mergeVariables(original.variables, edited.variables, options.baseline, goneNodeIds), finalNodes, original);
|
|
589
589
|
if (variables === undefined)
|
|
590
590
|
delete result.variables;
|
|
591
591
|
else
|
package/dist/migrate.d.ts
CHANGED
|
@@ -13,3 +13,39 @@ export declare function migrateToSchemaVersion(flow: any, target?: string): void
|
|
|
13
13
|
* now — the rename is the point, and callers that pass no target are unchanged.
|
|
14
14
|
*/
|
|
15
15
|
export declare function migrateTo16(flow: any): void;
|
|
16
|
+
/**
|
|
17
|
+
* Whether `type` is a node whose `outputs.<varId>.source` is an output MAPPING the
|
|
18
|
+
* author edits: the value assigned to a flow output variable when the run
|
|
19
|
+
* ends there. Only these keep the envelope on their output sources.
|
|
20
|
+
*
|
|
21
|
+
* **Why every other node's output `source` stays a plain string (MST-17759).**
|
|
22
|
+
* On a non-End node, `outputs.<k>.source` is the node type's own projection of
|
|
23
|
+
* its runtime result (`"=result.response"`, `"=Error"`), copied from the
|
|
24
|
+
* manifest's `outputDefinition`. The designer writes it as that plain string
|
|
25
|
+
* and never edits it: the manifest mappers spell it so
|
|
26
|
+
* (flow-workbench `packages/flow-core/src/manifest/mappers/connector.ts:317`,
|
|
27
|
+
* `data/queue-factory.ts:250`), and a designer-saved 1.9 file carries strings
|
|
28
|
+
* on every such node. The VS Code Maestro editor reads it as a string —
|
|
29
|
+
* `cleanSourceExpression(source)` calls `source.startsWith('=')`
|
|
30
|
+
* (`packages/canvas/src/utils/execution-data-transformer.ts:149`) — so the
|
|
31
|
+
* envelope this module used to write there crashed debug with
|
|
32
|
+
* `e.startsWith is not a function`.
|
|
33
|
+
*
|
|
34
|
+
* The envelope came from copying the OUTPUT of the platform's 1.2→1.3 file
|
|
35
|
+
* migration (`packages/migrations/src/migrations/v1.2-to-v1.3.ts`). Its doc
|
|
36
|
+
* comment scopes output wrapping to "End-node output mappings", but its loop
|
|
37
|
+
* wraps every node, so a migrated file is not the shape the designer writes.
|
|
38
|
+
*
|
|
39
|
+
* **Why End-type mappings keep the envelope.** The designer's End-node editor
|
|
40
|
+
* writes one. Each mapping row is bound to `outputs.<varId>.source`
|
|
41
|
+
* (`packages/canvas/src/components/properties-panel/contributors/end-node.ts:24`)
|
|
42
|
+
* and rendered by the expression `CodeEditorField`, whose default
|
|
43
|
+
* `valueFormat: 'expressionValue'` emits `{ type, expression, fieldType }` on
|
|
44
|
+
* every edit (`CodeEditorField.tsx:318-321`, `:786`); the End contributor sets
|
|
45
|
+
* no other `valueFormat`. Convert-to-subflow writes the same shape into the
|
|
46
|
+
* subflow's End nodes (`packages/canvas/src/utils/subflows/convert-to-subflow.ts:649-654`).
|
|
47
|
+
* flow-schema's `isEndNodeType` also counts `core.control.response`
|
|
48
|
+
* (`packages/flow-schema/src/validation/rules/helpers.ts:99`); the SDK does
|
|
49
|
+
* not emit that node, so it is not listed here.
|
|
50
|
+
*/
|
|
51
|
+
export declare function isOutputMappingNode(type: unknown): boolean;
|
package/dist/migrate.js
CHANGED
|
@@ -213,7 +213,7 @@ export function migrateTo16(flow) {
|
|
|
213
213
|
* (`packages/flow-schema/src/validation/rules/helpers.ts:99`); the SDK does
|
|
214
214
|
* not emit that node, so it is not listed here.
|
|
215
215
|
*/
|
|
216
|
-
function isOutputMappingNode(type) {
|
|
216
|
+
export function isOutputMappingNode(type) {
|
|
217
217
|
return type === 'core.control.end' || type === 'core.logic.terminate';
|
|
218
218
|
}
|
|
219
219
|
function wrapDynamicValues(flow) {
|
|
@@ -18,7 +18,7 @@ export interface BuildPorts {
|
|
|
18
18
|
/** Kill a `uip` call after this long. Unset means no limit, as the Python had none. */
|
|
19
19
|
timeoutMs?: number;
|
|
20
20
|
}
|
|
21
|
-
/** One describe that failed
|
|
21
|
+
/** One describe that failed: `(connector, object, operation, message)`. */
|
|
22
22
|
export type FailedFieldDescribe = readonly [
|
|
23
23
|
connectorKey: string,
|
|
24
24
|
objectName: string,
|
|
@@ -32,13 +32,15 @@ export type FailedFieldDescribe = readonly [
|
|
|
32
32
|
* `--connection-id`; `parentFields` are forwarded as `-f name=value` on
|
|
33
33
|
* describes and discriminate their cache key; `failedFieldDescribes` collects
|
|
34
34
|
* the CLI's own rejection message for each describe that failed under `-f`,
|
|
35
|
-
* because the pipeline otherwise swallows it (see `isDescribeOperation`)
|
|
35
|
+
* because the pipeline otherwise swallows it (see `isDescribeOperation`);
|
|
36
|
+
* `failedDescribes` collects every failed describe, with or without parent fields.
|
|
36
37
|
*/
|
|
37
38
|
export interface BuildContext extends BuildPorts {
|
|
38
39
|
connectionId?: string;
|
|
39
40
|
/** Insertion order is the `-f` order on the command line. */
|
|
40
41
|
parentFields: Map<string, string>;
|
|
41
42
|
failedFieldDescribes: FailedFieldDescribe[];
|
|
43
|
+
failedDescribes: FailedFieldDescribe[];
|
|
42
44
|
}
|
|
43
45
|
export interface BuildScope {
|
|
44
46
|
connectionId?: string;
|
|
@@ -100,10 +102,9 @@ export declare function registryGet(ctx: BuildContext, nodeType: string, quiet?:
|
|
|
100
102
|
* <object> --operation <op>` (plus `--connection-id` and `-f` when set).
|
|
101
103
|
*
|
|
102
104
|
* Returns the payload's `Data` on success, or `undefined` on any failure. A
|
|
103
|
-
* failure is cached too, with a sentinel that keeps the CLI's `Message
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
* set — from a fresh call and from a cached failure alike.
|
|
105
|
+
* failure is cached too, with a sentinel that keeps the CLI's `Message`, and
|
|
106
|
+
* recorded on the context from a fresh call and a cached failure alike; a call
|
|
107
|
+
* with no parseable answer is recorded in `failedDescribes` only, and not cached.
|
|
107
108
|
*/
|
|
108
109
|
export declare function isDescribeOperation(ctx: BuildContext, connectorKey: string, objectName: string, operation: string): Promise<unknown>;
|
|
109
110
|
/**
|
|
@@ -29,6 +29,7 @@ export function createBuildContext(ports, scope = {}) {
|
|
|
29
29
|
...(scope.connectionId ? { connectionId: scope.connectionId } : {}),
|
|
30
30
|
parentFields,
|
|
31
31
|
failedFieldDescribes: [],
|
|
32
|
+
failedDescribes: [],
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
35
|
/** `_schema_cache_scope()`: static and per-connection responses never share a cache. */
|
|
@@ -149,20 +150,23 @@ export async function registryGet(ctx, nodeType, quiet = false) {
|
|
|
149
150
|
ctx.reporter.warn(` WARN: registry get failed for ${nodeType}: ${probe.miss.reason}`);
|
|
150
151
|
return undefined;
|
|
151
152
|
}
|
|
153
|
+
function describeFailure(connectorKey, objectName, operation, message) {
|
|
154
|
+
return [connectorKey, objectName, operation, typeof message === "string" && message ? message : ""];
|
|
155
|
+
}
|
|
152
156
|
function noteFailedFieldDescribe(ctx, connectorKey, objectName, operation, message) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
157
|
+
const failure = describeFailure(connectorKey, objectName, operation, message);
|
|
158
|
+
ctx.failedDescribes.push(failure);
|
|
159
|
+
if (ctx.parentFields.size > 0)
|
|
160
|
+
ctx.failedFieldDescribes.push(failure);
|
|
156
161
|
}
|
|
157
162
|
/**
|
|
158
163
|
* `is_describe_operation`: cached `uip is resources describe <connector>
|
|
159
164
|
* <object> --operation <op>` (plus `--connection-id` and `-f` when set).
|
|
160
165
|
*
|
|
161
166
|
* Returns the payload's `Data` on success, or `undefined` on any failure. A
|
|
162
|
-
* failure is cached too, with a sentinel that keeps the CLI's `Message
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
* set — from a fresh call and from a cached failure alike.
|
|
167
|
+
* failure is cached too, with a sentinel that keeps the CLI's `Message`, and
|
|
168
|
+
* recorded on the context from a fresh call and a cached failure alike; a call
|
|
169
|
+
* with no parseable answer is recorded in `failedDescribes` only, and not cached.
|
|
166
170
|
*/
|
|
167
171
|
export async function isDescribeOperation(ctx, connectorKey, objectName, operation) {
|
|
168
172
|
const parts = [schemaCacheScope(ctx), connectorKey, objectName, operation];
|
|
@@ -177,11 +181,11 @@ export async function isDescribeOperation(ctx, connectorKey, objectName, operati
|
|
|
177
181
|
return isPyDict(cached) && cached.Data !== undefined ? cached.Data : undefined;
|
|
178
182
|
}
|
|
179
183
|
const result = await runUip(ctx, isResourcesDescribeOperation(connectorKey, objectName, operation, ctx.connectionId, ctx.parentFields));
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (parsed === undefined)
|
|
184
|
+
const parsed = refused(result) ? undefined : parseStdout(result.stdout);
|
|
185
|
+
if (parsed === undefined) {
|
|
186
|
+
ctx.failedDescribes.push(describeFailure(connectorKey, objectName, operation, failureReason(result)));
|
|
184
187
|
return undefined;
|
|
188
|
+
}
|
|
185
189
|
const payload = envelope(parsed);
|
|
186
190
|
if (get(payload, "Result") !== "Success") {
|
|
187
191
|
noteFailedFieldDescribe(ctx, connectorKey, objectName, operation, get(payload, "Message"));
|
|
@@ -161,6 +161,7 @@ export async function enrichEntry(ctx, entry) {
|
|
|
161
161
|
if (!pyTruthy(opName))
|
|
162
162
|
return entry; // nothing to do
|
|
163
163
|
const failuresBefore = ctx.failedFieldDescribes.length;
|
|
164
|
+
const describeFailuresBefore = ctx.failedDescribes.length;
|
|
164
165
|
let data = await isDescribeOperation(ctx, connectorKey, objectName, opName);
|
|
165
166
|
if (!pyTruthy(data)) {
|
|
166
167
|
const alt = await discoverOperationName(ctx, entry);
|
|
@@ -175,6 +176,7 @@ export async function enrichEntry(ctx, entry) {
|
|
|
175
176
|
// query-entity-records and get-entity-record-by-id). Only the describe
|
|
176
177
|
// whose answer is used may speak for the parent set.
|
|
177
178
|
ctx.failedFieldDescribes.length = failuresBefore;
|
|
179
|
+
ctx.failedDescribes.length = describeFailuresBefore;
|
|
178
180
|
data = await isDescribeOperation(ctx, connectorKey, objectName, alt);
|
|
179
181
|
}
|
|
180
182
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type BuildContext, type FailedFieldDescribe } from "../library-build/context.js";
|
|
2
|
+
import type { LibraryEntry } from "../model/library.js";
|
|
3
|
+
export declare function recoverFailedDescribe(ctx: BuildContext, entry: LibraryEntry, failures: readonly FailedFieldDescribe[], warn: (line: string) => void): Promise<LibraryEntry>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { inputSchemaFromConnection } from "../../core/library.js";
|
|
2
|
+
import { enrichEntry } from "../library-build/enrich.js";
|
|
3
|
+
import { DescribeFallback, PrepareRefusal, describeFailedLine, describeFailedMessage } from "./messages.js";
|
|
4
|
+
const DESCRIBE_FAILED = "DESCRIBE_FAILED";
|
|
5
|
+
export async function recoverFailedDescribe(ctx, entry, failures, warn) {
|
|
6
|
+
const failure = failures.at(-1);
|
|
7
|
+
if (failure === undefined)
|
|
8
|
+
return entry;
|
|
9
|
+
if (ctx.parentFields.size > 0)
|
|
10
|
+
return entry;
|
|
11
|
+
if (inputSchemaFromConnection(entry)) {
|
|
12
|
+
warn(describeFailedLine(failure, DescribeFallback.RegistryEntry));
|
|
13
|
+
return entry;
|
|
14
|
+
}
|
|
15
|
+
// Shares `caches`; the describe without a connection caches under its own scope.
|
|
16
|
+
const withoutConnection = { ...ctx, connectionId: undefined, failedFieldDescribes: [], failedDescribes: [] };
|
|
17
|
+
const filled = await enrichEntry(withoutConnection, entry);
|
|
18
|
+
if (withoutConnection.failedDescribes.length === 0) {
|
|
19
|
+
warn(describeFailedLine(failure, DescribeFallback.WithoutConnection));
|
|
20
|
+
return filled;
|
|
21
|
+
}
|
|
22
|
+
if (entry.inputSchema.fields.length === 0)
|
|
23
|
+
throw new PrepareRefusal(describeFailedMessage(failure), DESCRIBE_FAILED);
|
|
24
|
+
warn(describeFailedLine(failure, DescribeFallback.RegistryEntry));
|
|
25
|
+
return entry;
|
|
26
|
+
}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* `core/cli-spelling.ts`) without this module reading the environment.
|
|
22
22
|
*/
|
|
23
23
|
import { Refusal } from "../errors.js";
|
|
24
|
+
import type { FailedFieldDescribe } from "../library-build/context.js";
|
|
24
25
|
import { type RegistryCatalog, type RegistryRefresh } from "./actions.js";
|
|
25
26
|
import type { IntegrationServiceMiss } from "./integration-service.js";
|
|
26
27
|
export declare const PREFIX = "prepare-connector: ";
|
|
@@ -139,6 +140,16 @@ export declare function fieldFlagMessage(pair: string): string;
|
|
|
139
140
|
* non-empty message is the one quoted.
|
|
140
141
|
*/
|
|
141
142
|
export declare function rejectedParentFieldsMessage(pairs: readonly string[], failures?: ReadonlyArray<readonly unknown[]>): string;
|
|
143
|
+
/** What `prepare` did about a failed connection-scoped describe. */
|
|
144
|
+
export declare enum DescribeFallback {
|
|
145
|
+
/** The registry's entry was kept as it is. */
|
|
146
|
+
RegistryEntry = 0,
|
|
147
|
+
/** The input schema was read from the describe without the connection. */
|
|
148
|
+
WithoutConnection = 1
|
|
149
|
+
}
|
|
150
|
+
/** The warning when `is resources describe --connection-id` failed for the action. */
|
|
151
|
+
export declare function describeFailedLine(failure: FailedFieldDescribe, fallback: DescribeFallback): string;
|
|
152
|
+
export declare function describeFailedMessage(failure: FailedFieldDescribe): string;
|
|
142
153
|
/** ` object: <note>` — the ladder's normalization sentence. */
|
|
143
154
|
export declare function objectNoteLine(note: string): string;
|
|
144
155
|
/** ` object: <requested> -> <matched> recorded in <ledger>`. */
|
|
@@ -313,6 +313,35 @@ export function rejectedParentFieldsMessage(pairs, failures = []) {
|
|
|
313
313
|
"only inside its project), so they cannot be copied from another " +
|
|
314
314
|
"project, connection, or task.");
|
|
315
315
|
}
|
|
316
|
+
/** What `prepare` did about a failed connection-scoped describe. */
|
|
317
|
+
export var DescribeFallback;
|
|
318
|
+
(function (DescribeFallback) {
|
|
319
|
+
/** The registry's entry was kept as it is. */
|
|
320
|
+
DescribeFallback[DescribeFallback["RegistryEntry"] = 0] = "RegistryEntry";
|
|
321
|
+
/** The input schema was read from the describe without the connection. */
|
|
322
|
+
DescribeFallback[DescribeFallback["WithoutConnection"] = 1] = "WithoutConnection";
|
|
323
|
+
})(DescribeFallback || (DescribeFallback = {}));
|
|
324
|
+
function describeSubject(connectorKey, objectName, operation) {
|
|
325
|
+
return `${connectorKey} ${objectName} ${operation}`;
|
|
326
|
+
}
|
|
327
|
+
function serviceSaid(message) {
|
|
328
|
+
return (message || "no message").replace(/\.$/, "");
|
|
329
|
+
}
|
|
330
|
+
/** The warning when `is resources describe --connection-id` failed for the action. */
|
|
331
|
+
export function describeFailedLine(failure, fallback) {
|
|
332
|
+
const [connectorKey, objectName, operation, message] = failure;
|
|
333
|
+
const outcome = fallback === DescribeFallback.WithoutConnection
|
|
334
|
+
? "The input schema was read from the describe without the connection instead, so fields only this connection adds are missing."
|
|
335
|
+
: "The registry's entry was used as it is, so fields it does not list are missing.";
|
|
336
|
+
return (`${PREFIX}WARN: Integration Service could not describe ${describeSubject(connectorKey, objectName, operation)} ` +
|
|
337
|
+
`with this connection: ${serviceSaid(message)}. ${outcome}`);
|
|
338
|
+
}
|
|
339
|
+
export function describeFailedMessage(failure) {
|
|
340
|
+
const [connectorKey, objectName, operation, message] = failure;
|
|
341
|
+
return (`${PREFIX}Integration Service failed to describe ${describeSubject(connectorKey, objectName, operation)} ` +
|
|
342
|
+
`with this connection and without it, so no input field is known for it. Integration Service said: ${serviceSaid(message)}. ` +
|
|
343
|
+
"Editing the flow cannot fix this. Check the connection works and retry; if it still fails, report it with this output.");
|
|
344
|
+
}
|
|
316
345
|
// ---------------------------------------------------------------------------
|
|
317
346
|
// The object decision
|
|
318
347
|
/** ` object: <note>` — the ladder's normalization sentence. */
|
|
@@ -38,6 +38,7 @@ import { planLibrary } from "../library-build/plan.js";
|
|
|
38
38
|
import { MemoryResponseCache } from "../uip/response-cache.js";
|
|
39
39
|
import { catalogServesNothing, refreshRegistryCatalog, registryCatalog } from "./actions.js";
|
|
40
40
|
import { loginScope } from "./catalog-absence.js";
|
|
41
|
+
import { recoverFailedDescribe } from "./failed-describe.js";
|
|
41
42
|
import { loginStatusData } from "../uip/login-status.js";
|
|
42
43
|
import { chooseConnection, listConnections, lookupConnection, mergeBindings, restoreBindings, snapshotBindings, solutionConnectionIds, } from "./connections.js";
|
|
43
44
|
import { prepareEvent } from "./event.js";
|
|
@@ -536,7 +537,9 @@ async function prepareOnConnection(options, ports, connected, registryRefresh) {
|
|
|
536
537
|
throw new PrepareRefusal(objectFlagsOnlyForGenericMessage(), "OBJECT_NOT_GENERIC");
|
|
537
538
|
// An Integration Service entry IS the describe; there is nothing to enrich it with.
|
|
538
539
|
if (fromIntegrationService === undefined) {
|
|
540
|
+
const failuresBefore = ctx.failedDescribes.length;
|
|
539
541
|
entry = await enrichEntry(ctx, entry); // full schema via --connection-id
|
|
542
|
+
entry = await recoverFailedDescribe(ctx, entry, ctx.failedDescribes.slice(failuresBefore), warn);
|
|
540
543
|
if (isExternalOperation(entry.operation)) {
|
|
541
544
|
const { mode, event } = libraryExecution(entry.operation);
|
|
542
545
|
if (mode === undefined)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.124.
|
|
3
|
+
"version": "6.124.6",
|
|
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",
|
|
@@ -127,5 +127,5 @@
|
|
|
127
127
|
"@types/node": "^22.7.0",
|
|
128
128
|
"esbuild": "^0.28.1"
|
|
129
129
|
},
|
|
130
|
-
"gitref": "
|
|
130
|
+
"gitref": "beb2ac8e1725ce8e73b2391c96fda0c99d2d9bc4"
|
|
131
131
|
}
|