@uipath/maestro-builder-sdk 6.99.0 → 6.101.0
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/README.md +3 -0
- package/dist/api-index.md +46 -45
- package/dist/api-members.md +136 -132
- package/dist/check-cli.js +3 -1
- package/dist/check.d.ts +7 -0
- package/dist/check.js +85 -4
- package/dist/cli/commands/capabilities.d.ts +10 -0
- package/dist/cli/commands/capabilities.js +24 -0
- package/dist/cli/common.d.ts +17 -17
- package/dist/cli/common.js +114 -20
- package/dist/cli/index.js +2 -0
- package/dist/compile-cli.js +5 -1
- package/dist/core/node-catalog.d.ts +39 -0
- package/dist/core/node-catalog.js +45 -0
- package/dist/core/node-classes.d.ts +9 -0
- package/dist/core/node-classes.js +0 -21
- package/dist/core/raw-node-exits.d.ts +6 -3
- package/dist/core/raw-node-exits.js +5 -3
- package/dist/core/refusals.d.ts +2 -0
- package/dist/core/refusals.js +2 -0
- package/dist/decompile.js +13 -7
- package/dist/emit.js +3 -0
- package/dist/flow-output-backing.d.ts +11 -0
- package/dist/flow-output-backing.js +23 -2
- package/dist/flow-sdk.d.ts +1 -0
- package/dist/flow-step-exits.d.ts +4 -1
- package/dist/flow-step-exits.js +6 -3
- package/dist/index.d.ts +3 -0
- package/dist/index.js +5 -0
- package/dist/merge-cli.js +7 -4
- package/dist/node-catalog-files.d.ts +9 -0
- package/dist/node-catalog-files.js +63 -0
- package/dist/raw-node.d.ts +24 -6
- package/dist/raw-node.js +41 -8
- package/dist/sdk-capabilities.d.ts +57 -0
- package/dist/sdk-capabilities.js +76 -0
- package/dist/serialize.d.ts +9 -0
- package/dist/serialize.js +9 -6
- package/package.json +9 -3
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
export const RAW_NODE_EXITS = Symbol('rawNodeExits');
|
|
3
3
|
/**
|
|
4
4
|
* `action`'s exits when it is a raw node whose manifest declares more than one
|
|
5
|
-
* forward exit; `undefined` otherwise (then it has nothing to route).
|
|
5
|
+
* forward exit; `undefined` otherwise (then it has nothing to route). A raw node
|
|
6
|
+
* with no manifest reads it from `catalog` (#1981), and answers {@link NoExits}
|
|
7
|
+
* when the catalog has none, so `.stepSwitch` names the command that fills it.
|
|
6
8
|
*/
|
|
7
|
-
export function rawNodeExits(action) {
|
|
9
|
+
export function rawNodeExits(action, catalog) {
|
|
8
10
|
const own = action?.[RAW_NODE_EXITS];
|
|
9
|
-
return typeof own === 'function' ? own.call(action) : undefined;
|
|
11
|
+
return typeof own === 'function' ? own.call(action, catalog) : undefined;
|
|
10
12
|
}
|
package/dist/core/refusals.d.ts
CHANGED
|
@@ -626,6 +626,7 @@ export declare const REFUSALS: {
|
|
|
626
626
|
readonly QUEUE_READ_WITHOUT_RETURNS: "lint";
|
|
627
627
|
readonly QUEUE_RETURNS_WITHOUT_WAIT: "lowering";
|
|
628
628
|
readonly RAW_NODE_CONNECTOR: "lowering";
|
|
629
|
+
readonly RAW_NODE_MANIFEST_NOT_CACHED: "lowering";
|
|
629
630
|
readonly RAW_NODE_TYPED_FAMILY: "lint";
|
|
630
631
|
readonly RAW_NODE_UNKNOWN_INPUT: "lowering";
|
|
631
632
|
readonly RAW_NODE_VERSION_MISMATCH: "lowering";
|
|
@@ -650,6 +651,7 @@ export declare const REFUSALS: {
|
|
|
650
651
|
readonly RETRY_BASE_WITHOUT_EXPONENTIAL: "lint";
|
|
651
652
|
readonly RETRY_INVALID_COUNT: "lint";
|
|
652
653
|
readonly RETRY_INVALID_DURATION: "lint";
|
|
654
|
+
readonly RETURN_OUTPUT_MISSING: "lint";
|
|
653
655
|
readonly RETURN_UPDATES_SAME_VAR: "lowering";
|
|
654
656
|
readonly RPA_KEY_NOT_KEY: "lint";
|
|
655
657
|
readonly RPA_LOCAL_HAS_FOLDER: "lowering";
|
package/dist/core/refusals.js
CHANGED
|
@@ -700,6 +700,7 @@ export const REFUSALS = {
|
|
|
700
700
|
QUEUE_READ_WITHOUT_RETURNS: 'lint',
|
|
701
701
|
QUEUE_RETURNS_WITHOUT_WAIT: 'lowering',
|
|
702
702
|
RAW_NODE_CONNECTOR: 'lowering',
|
|
703
|
+
RAW_NODE_MANIFEST_NOT_CACHED: 'lowering',
|
|
703
704
|
RAW_NODE_TYPED_FAMILY: 'lint',
|
|
704
705
|
RAW_NODE_UNKNOWN_INPUT: 'lowering',
|
|
705
706
|
RAW_NODE_VERSION_MISMATCH: 'lowering',
|
|
@@ -724,6 +725,7 @@ export const REFUSALS = {
|
|
|
724
725
|
RETRY_BASE_WITHOUT_EXPONENTIAL: 'lint',
|
|
725
726
|
RETRY_INVALID_COUNT: 'lint',
|
|
726
727
|
RETRY_INVALID_DURATION: 'lint',
|
|
728
|
+
RETURN_OUTPUT_MISSING: 'lint',
|
|
727
729
|
RETURN_UPDATES_SAME_VAR: 'lowering',
|
|
728
730
|
RPA_KEY_NOT_KEY: 'lint',
|
|
729
731
|
RPA_LOCAL_HAS_FOLDER: 'lowering',
|
package/dist/decompile.js
CHANGED
|
@@ -1985,7 +1985,6 @@ function armCb(param, segs) {
|
|
|
1985
1985
|
*/
|
|
1986
1986
|
function returnSeg(node, ctx) {
|
|
1987
1987
|
const updates = ctx.flow.variables?.variableUpdates?.[node.id] ?? [];
|
|
1988
|
-
const outputIds = new Set(readFlowGlobals(ctx.flow.variables).filter((g) => g.direction === 'out').map((g) => g.id));
|
|
1989
1988
|
const opts = returnOptsArg(node, ctx.refTargets?.has(node.id) ?? false);
|
|
1990
1989
|
const entries = updates.map((u) => `${key(u.variableId)}: ${emitVal(u.expression, ctx.imp, ctx.inputNames)}`);
|
|
1991
1990
|
const written = new Set(updates.map((u) => u.variableId));
|
|
@@ -1994,7 +1993,7 @@ function returnSeg(node, ctx) {
|
|
|
1994
1993
|
continue;
|
|
1995
1994
|
const source = out?.source;
|
|
1996
1995
|
const raw = unwrapSource(source);
|
|
1997
|
-
if (raw === undefined || isIdentityEndSource(raw, name
|
|
1996
|
+
if (raw === undefined || isIdentityEndSource(raw, name))
|
|
1998
1997
|
continue;
|
|
1999
1998
|
entries.push(`${key(name)}: ${emitVal(source, ctx.imp, ctx.inputNames)}`);
|
|
2000
1999
|
}
|
|
@@ -2005,12 +2004,19 @@ function returnSeg(node, ctx) {
|
|
|
2005
2004
|
/**
|
|
2006
2005
|
* The fill-in mapping `endOutputs` writes for a variable no `.return` named:
|
|
2007
2006
|
* `=js:$vars.<name>`, read through the backing Variable `foldOutputBacking`
|
|
2008
|
-
* has already folded back.
|
|
2009
|
-
*
|
|
2010
|
-
|
|
2011
|
-
|
|
2007
|
+
* has already folded back.
|
|
2008
|
+
*
|
|
2009
|
+
* An output mapped to `null` is NOT folded, though compile writes that for an
|
|
2010
|
+
* unbacked output a `.return()` leaves out (#1092). A designer End that says
|
|
2011
|
+
* `report_location <- null` returns null on purpose, and source that drops it
|
|
2012
|
+
* reads as a `.return()` that forgot the output, which `check` refuses
|
|
2013
|
+
* (RETURN_OUTPUT_MISSING, #1966). So decompile spells it: ``report_location:
|
|
2014
|
+
* js`null` ``. That compiles to the same `=js:null` mapping, so the round trip is
|
|
2015
|
+
* unchanged.
|
|
2016
|
+
*/
|
|
2017
|
+
function isIdentityEndSource(raw, name) {
|
|
2012
2018
|
const body = (raw.startsWith('=js:') ? raw.slice(4) : raw).trim();
|
|
2013
|
-
return body === `$vars.${name}
|
|
2019
|
+
return body === `$vars.${name}`;
|
|
2014
2020
|
}
|
|
2015
2021
|
/**
|
|
2016
2022
|
* The options argument for a `.return(...)` — `version`, plus the End's `name`
|
package/dist/emit.js
CHANGED
|
@@ -33,6 +33,7 @@ import { openCliLibrary } from './core/cli-library.js';
|
|
|
33
33
|
import { defaultBindingsFile, defaultResourcesFile } from './workdir.js';
|
|
34
34
|
import { readCliResources } from './registry/prepare/resources.js';
|
|
35
35
|
import { writeJsonFile } from './core/json-file.js';
|
|
36
|
+
import { readNodeCatalog } from './node-catalog-files.js';
|
|
36
37
|
/**
|
|
37
38
|
* Resolve the connector library the way `compile-cli` does (`openCliLibrary`),
|
|
38
39
|
* with the `connectors-local` overlay `registry prepare` writes: only load it
|
|
@@ -54,6 +55,8 @@ export function emitFlow(built, path, opts = {}) {
|
|
|
54
55
|
library: opts.library ?? defaultLibrary(opts.libraryDir),
|
|
55
56
|
bindings: opts.bindings ?? new Bindings(bindFile),
|
|
56
57
|
resources: opts.resources ?? defaultResources(),
|
|
58
|
+
// Where a `rawNode` without `manifest` finds its definition, as in `compile`.
|
|
59
|
+
nodeCatalog: opts.nodeCatalog ?? readNodeCatalog(),
|
|
57
60
|
// Same channel `compile` uses; a host that wants them elsewhere passes `warn`.
|
|
58
61
|
warn: opts.warn ?? ((w) => process.stderr.write(` ⚠ [${w.code}] ${w.message}\n`)),
|
|
59
62
|
});
|
|
@@ -40,6 +40,17 @@ export declare function scopeVariableUse(steps: readonly Step[]): {
|
|
|
40
40
|
read: Set<string>;
|
|
41
41
|
stepNames: Set<string>;
|
|
42
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* The outputs of one scope that get a backing Variable, without the collision
|
|
45
|
+
* plan: the names `planOutputBacking` backs whenever it has no problem to
|
|
46
|
+
* report. An output NOT in this set is set only by a `.return()` that names
|
|
47
|
+
* it, and every other End maps it to `null` (`check`'s RETURN_OUTPUT_MISSING).
|
|
48
|
+
*
|
|
49
|
+
* @param built - The scope's flow.
|
|
50
|
+
* @param outputs - Its outputs after the `.output()` + `.var()` merge (`planFlowGlobals`).
|
|
51
|
+
* @param sharedOutputs - The outputs a `{ shared }` input feeds.
|
|
52
|
+
*/
|
|
53
|
+
export declare function backedOutputs(built: Pick<BuiltFlow, 'steps' | 'entryPoints'>, outputs: readonly Pick<VarDecl, 'name' | 'default'>[], sharedOutputs?: ReadonlySet<string>): Set<string>;
|
|
43
54
|
/**
|
|
44
55
|
* Plan the backing Variables for one scope (the flow, or one subflow body).
|
|
45
56
|
*
|
|
@@ -136,6 +136,28 @@ export function scopeVariableUse(steps) {
|
|
|
136
136
|
visit(s);
|
|
137
137
|
return { written, read, stepNames };
|
|
138
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Whether output `o` gets a backing Variable: the scope sets or reads it
|
|
141
|
+
* outside a `.return()` value (the list in this file's header).
|
|
142
|
+
*/
|
|
143
|
+
function needsBacking(o, use, sharedOutputs) {
|
|
144
|
+
const readsIt = use.read.has(o.name) && !use.stepNames.has(o.name);
|
|
145
|
+
return use.written.has(o.name) || readsIt || sharedOutputs.has(o.name) || o.default !== undefined;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The outputs of one scope that get a backing Variable, without the collision
|
|
149
|
+
* plan: the names `planOutputBacking` backs whenever it has no problem to
|
|
150
|
+
* report. An output NOT in this set is set only by a `.return()` that names
|
|
151
|
+
* it, and every other End maps it to `null` (`check`'s RETURN_OUTPUT_MISSING).
|
|
152
|
+
*
|
|
153
|
+
* @param built - The scope's flow.
|
|
154
|
+
* @param outputs - Its outputs after the `.output()` + `.var()` merge (`planFlowGlobals`).
|
|
155
|
+
* @param sharedOutputs - The outputs a `{ shared }` input feeds.
|
|
156
|
+
*/
|
|
157
|
+
export function backedOutputs(built, outputs, sharedOutputs = new Set()) {
|
|
158
|
+
const use = scopeVariableUse([...built.steps, ...(built.entryPoints ?? []).flatMap((ep) => ep.steps)]);
|
|
159
|
+
return new Set(outputs.filter((o) => needsBacking(o, use, sharedOutputs)).map((o) => o.name));
|
|
160
|
+
}
|
|
139
161
|
/**
|
|
140
162
|
* Plan the backing Variables for one scope (the flow, or one subflow body).
|
|
141
163
|
*
|
|
@@ -169,8 +191,7 @@ export function planOutputBacking(built, outputs, vars, sharedOutputs = new Set(
|
|
|
169
191
|
const problems = [];
|
|
170
192
|
for (const o of outputs) {
|
|
171
193
|
const readsIt = use.read.has(o.name) && !use.stepNames.has(o.name);
|
|
172
|
-
|
|
173
|
-
if (!needs)
|
|
194
|
+
if (!needsBacking(o, use, sharedOutputs))
|
|
174
195
|
continue;
|
|
175
196
|
const id = outputBackingName(o.name);
|
|
176
197
|
const holder = taken.get(id);
|
package/dist/flow-sdk.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export * from './core/connectors.js';
|
|
|
38
38
|
export * from './core/lookups.js';
|
|
39
39
|
export { resource, entity, type ResourceToken, type ResourceRef } from './core/resource-resolution.js';
|
|
40
40
|
export * from './core/node-classes.js';
|
|
41
|
+
export type { NodeCatalog } from './core/node-catalog.js';
|
|
41
42
|
export * from './raw-node.js';
|
|
42
43
|
import { Expr } from './core/expr.js';
|
|
43
44
|
import type { ErrorEnvelopeField } from './core/expr.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type DeclaredExit, type ExitRouting, type NoExits } from './core/step-ports.js';
|
|
2
|
+
import type { NodeCatalog } from './core/node-catalog.js';
|
|
2
3
|
/**
|
|
3
4
|
* The author-declared exits of a step's spec: a registered type's own `exits`,
|
|
4
5
|
* at the version the step resolves to (its pin, else the type's choice; an
|
|
@@ -9,7 +10,9 @@ import { type DeclaredExit, type ExitRouting, type NoExits } from './core/step-p
|
|
|
9
10
|
export declare function stepExits(spec: {
|
|
10
11
|
kind?: unknown;
|
|
11
12
|
inputs?: unknown;
|
|
12
|
-
} | undefined, pinnedVersion?: string
|
|
13
|
+
} | undefined, pinnedVersion?: string,
|
|
14
|
+
/** The node registry cache a manifest-less `rawNode` reads its exits from (#1981). */
|
|
15
|
+
nodeCatalog?: NodeCatalog): DeclaredExit[] | NoExits;
|
|
13
16
|
/**
|
|
14
17
|
* How a step's author-named exits leave it (`FlowNodeType.routing`), at the
|
|
15
18
|
* version the step resolves to, as for `stepExits`: what check's flow-level
|
package/dist/flow-step-exits.js
CHANGED
|
@@ -16,9 +16,12 @@ import { rawNodeExits } from './core/raw-node-exits.js';
|
|
|
16
16
|
* `declaredExits` for a kind not yet registered. `serialize` and `check` ask
|
|
17
17
|
* here, so they agree on what a port means.
|
|
18
18
|
*/
|
|
19
|
-
export function stepExits(spec, pinnedVersion
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
export function stepExits(spec, pinnedVersion,
|
|
20
|
+
/** The node registry cache a manifest-less `rawNode` reads its exits from (#1981). */
|
|
21
|
+
nodeCatalog) {
|
|
22
|
+
// A `rawNode` declares its exits through the manifest it carries (#1141), or
|
|
23
|
+
// the one the node registry cache holds for it.
|
|
24
|
+
const raw = rawNodeExits(spec, nodeCatalog);
|
|
22
25
|
if (raw !== undefined)
|
|
23
26
|
return raw;
|
|
24
27
|
const impl = resolvedImpl(spec, pinnedVersion, 'exits');
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
export * from './flow-sdk.js';
|
|
10
10
|
export { serialize } from './serialize.js';
|
|
11
11
|
export type { SerializeOpts } from './serialize.js';
|
|
12
|
+
export { readNodeCatalog } from './node-catalog-files.js';
|
|
12
13
|
export { emitFlow } from './emit.js';
|
|
13
14
|
export type { EmitFlowOpts } from './emit.js';
|
|
14
15
|
export { decompile as decompileFlow } from './decompile.js';
|
|
@@ -20,6 +21,8 @@ export { Library } from './library.js';
|
|
|
20
21
|
export { Bindings } from './bindings.js';
|
|
21
22
|
export { check } from './check.js';
|
|
22
23
|
export type { Diagnostic } from './check.js';
|
|
24
|
+
export { sdkCapabilities, sdkVersionSatisfies, isSdkVersionFloor } from './sdk-capabilities.js';
|
|
25
|
+
export type { SdkCapabilities } from './sdk-capabilities.js';
|
|
23
26
|
export { casePlan, preserveCaseJson, rule, when } from './case/case-sdk.js';
|
|
24
27
|
export type { CaseRule, CaseRuleInput, CaseRuleGrid, WhenExpression, CaseJsonPreservation, CaseLayout, CaseNodeLayout, PreservedCaseNode, PreservedTaskFields, PreservedVariableLane, CaseRuleType, RuleOpts, BuiltCase, BuiltStage, BuiltTask, TaskKind, UnresolvedReferenceTaskKind, ExternalEventPair, ExternalExecutionMode, ExternalTaskOptions, } from './case/case-sdk.js';
|
|
25
28
|
export { serialize as serializeCase } from './case/serialize.js';
|
package/dist/index.js
CHANGED
|
@@ -15,6 +15,8 @@ export * from './flow-sdk.js';
|
|
|
15
15
|
// (`serializeCase` / `serializeBpmn`), so this was an inconsistency, not a
|
|
16
16
|
// deliberate restriction.
|
|
17
17
|
export { serialize } from './serialize.js';
|
|
18
|
+
// The node registry cache a `rawNode` without `manifest` resolves from (#1981).
|
|
19
|
+
export { readNodeCatalog } from './node-catalog-files.js';
|
|
18
20
|
export { emitFlow } from './emit.js';
|
|
19
21
|
export { decompile as decompileFlow } from './decompile.js';
|
|
20
22
|
export { mergeFlow } from './merge.js';
|
|
@@ -22,6 +24,9 @@ export { MergeRefusedError as FlowMergeRefusedError } from './merge.js';
|
|
|
22
24
|
export { Library } from './library.js';
|
|
23
25
|
export { Bindings } from './bindings.js';
|
|
24
26
|
export { check } from './check.js';
|
|
27
|
+
// What this installed copy supports, and the version test behind the project
|
|
28
|
+
// floor (`flowSdk.minVersion`) that `flow-sdk` enforces (#1991).
|
|
29
|
+
export { sdkCapabilities, sdkVersionSatisfies, isSdkVersionFloor } from './sdk-capabilities.js';
|
|
25
30
|
// Case authoring API (reference-mode). `casePlan()` exposes only case methods.
|
|
26
31
|
export { casePlan, preserveCaseJson, rule, when } from './case/case-sdk.js';
|
|
27
32
|
export { serialize as serializeCase } from './case/serialize.js';
|
package/dist/merge-cli.js
CHANGED
|
@@ -88,6 +88,7 @@ import { readFlowStamp, restampFlowSource, sourceDigest, STAMP_MARKER } from './
|
|
|
88
88
|
import { ensureTypeScriptRuntime } from './node-runtime.js';
|
|
89
89
|
import { flowCheckOpts, openCliLibrary } from './cli-library.js';
|
|
90
90
|
import { FETCHED_PROVENANCE } from './core/library.js';
|
|
91
|
+
import { readNodeCatalog } from './node-catalog-files.js';
|
|
91
92
|
import { flowConnectorRequests, hidesLacked } from './registry/fetch/flow-requests.js';
|
|
92
93
|
import { fetchDefinitionsEnabled } from './registry/fetch/fetch-definitions.js';
|
|
93
94
|
import { openWithFetchedDefinitions, withFetchedDefinitions } from './registry/fetch/with-fetched-definitions.js';
|
|
@@ -304,7 +305,9 @@ export async function run(argv) {
|
|
|
304
305
|
})
|
|
305
306
|
: fetchedLibrary;
|
|
306
307
|
const bindings = derivedFrom || editedIsSource ? new Bindings(flagValue(argv, '--bindings') ?? defaultBindingsFile()) : undefined;
|
|
307
|
-
|
|
308
|
+
// The node registry cache a manifest-less `rawNode` resolves from (#1981), read on first use.
|
|
309
|
+
const nodeCatalog = readNodeCatalog();
|
|
310
|
+
const compileOpts = { library, bindings, nodeCatalog };
|
|
308
311
|
// Resolved as decompile resolves it, so a split `.flow` merges as the document the
|
|
309
312
|
// source was decompiled from.
|
|
310
313
|
const originalParts = [];
|
|
@@ -325,7 +328,7 @@ export async function run(argv) {
|
|
|
325
328
|
editedSidecars = compiled.sidecars;
|
|
326
329
|
drafts = compiled.drafts;
|
|
327
330
|
lowering = compiled.lowering.map(onNode);
|
|
328
|
-
diagnostics = checkEdited(compiled.built, edited, flowCheckOpts(library, bindings));
|
|
331
|
+
diagnostics = checkEdited(compiled.built, edited, { ...flowCheckOpts(library, bindings), nodeCatalog });
|
|
329
332
|
}
|
|
330
333
|
else {
|
|
331
334
|
edited = JSON.parse(readFileSync(editedPath, 'utf8'));
|
|
@@ -414,7 +417,7 @@ export async function run(argv) {
|
|
|
414
417
|
const baselineFindings = baselineCompile === undefined ? undefined : findingCounts([
|
|
415
418
|
...baselineCompile.drafts,
|
|
416
419
|
...baselineCompile.lowering,
|
|
417
|
-
...checkEdited(baselineCompile.built, baselineCompile.flow, flowCheckOpts(library, bindings)).filter((d) => d.level === 'error'),
|
|
420
|
+
...checkEdited(baselineCompile.built, baselineCompile.flow, { ...flowCheckOpts(library, bindings), nodeCatalog }).filter((d) => d.level === 'error'),
|
|
418
421
|
]);
|
|
419
422
|
const unplacedDrafts = splitUnplaced(unplaced, baselineFindings);
|
|
420
423
|
const unplacedChecks = splitUnplaced(checked.unplaced, baselineFindings);
|
|
@@ -610,6 +613,6 @@ async function mergeLibrary(argv, originalPath, editedSource) {
|
|
|
610
613
|
return library;
|
|
611
614
|
// A recording pass only, its result discarded: the merge compiles with the
|
|
612
615
|
// library opened after it, which reads whatever it fetched.
|
|
613
|
-
await withFetchedDefinitions(argv, (pass) => compileSourceDraftTolerant(editedSource, { library: pass }), { who: 'flow-merge', notes });
|
|
616
|
+
await withFetchedDefinitions(argv, (pass) => compileSourceDraftTolerant(editedSource, { library: pass, nodeCatalog: readNodeCatalog() }), { who: 'flow-merge', notes });
|
|
614
617
|
return openWithFetchedDefinitions(argv, flowConnectorRequests(original), { who: 'flow-merge', notes });
|
|
615
618
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NodeCatalog } from './core/node-catalog.js';
|
|
2
|
+
/** The cache `uip maestro flow registry pull` writes. */
|
|
3
|
+
export declare function defaultNodeCatalogFile(): string;
|
|
4
|
+
/**
|
|
5
|
+
* The node catalog in `file` (default {@link defaultNodeCatalogFile}). A
|
|
6
|
+
* missing or unreadable file is an empty catalog: the lookup that needed it
|
|
7
|
+
* reports the miss and names `registry pull`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function readNodeCatalog(file?: string): NodeCatalog;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading the node registry cache from disk, for the CLIs (#1981). Apart from
|
|
3
|
+
* `core/node-catalog.ts`, the port `serialize` reads, so serializing a flow
|
|
4
|
+
* loads no `node:fs` (FB015).
|
|
5
|
+
*
|
|
6
|
+
* `uip maestro flow registry pull` writes the cache to
|
|
7
|
+
* `~/.uipath/nodes/index.json`: one array of node manifests, each exactly what
|
|
8
|
+
* `uip maestro flow registry get <nodeType>` prints as `Data.Node` (measured
|
|
9
|
+
* 2026-11-13 on `core.logic.mock@1.0`, an RPA process node and
|
|
10
|
+
* `uipath.agent.autonomous`: byte-equal). The file is about 20 MB, so it is
|
|
11
|
+
* read on the first lookup, not when the catalog is opened: a flow with no
|
|
12
|
+
* manifest-less `rawNode` never reads it.
|
|
13
|
+
*/
|
|
14
|
+
import { readFileSync } from 'node:fs';
|
|
15
|
+
import { homedir } from 'node:os';
|
|
16
|
+
import { join } from 'node:path';
|
|
17
|
+
import { isRecord } from './core/node-envelope.js';
|
|
18
|
+
/** The cache `uip maestro flow registry pull` writes. */
|
|
19
|
+
export function defaultNodeCatalogFile() {
|
|
20
|
+
return join(homedir(), '.uipath', 'nodes', 'index.json');
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The node catalog in `file` (default {@link defaultNodeCatalogFile}). A
|
|
24
|
+
* missing or unreadable file is an empty catalog: the lookup that needed it
|
|
25
|
+
* reports the miss and names `registry pull`.
|
|
26
|
+
*/
|
|
27
|
+
export function readNodeCatalog(file = defaultNodeCatalogFile()) {
|
|
28
|
+
let byType;
|
|
29
|
+
const index = () => {
|
|
30
|
+
if (byType !== undefined)
|
|
31
|
+
return byType;
|
|
32
|
+
byType = new Map();
|
|
33
|
+
for (const node of cachedNodes(file)) {
|
|
34
|
+
if (!isRecord(node) || typeof node.nodeType !== 'string' || typeof node.version !== 'string')
|
|
35
|
+
continue;
|
|
36
|
+
let versions = byType.get(node.nodeType);
|
|
37
|
+
if (versions === undefined)
|
|
38
|
+
byType.set(node.nodeType, versions = new Map());
|
|
39
|
+
// A few connector types are listed twice at one version (a rawNode refuses those anyway); keep the first.
|
|
40
|
+
if (!versions.has(node.version))
|
|
41
|
+
versions.set(node.version, node);
|
|
42
|
+
}
|
|
43
|
+
return byType;
|
|
44
|
+
};
|
|
45
|
+
return {
|
|
46
|
+
source: file.startsWith(homedir()) ? `~${file.slice(homedir().length)}` : file,
|
|
47
|
+
definition: (nodeType, version) => index().get(nodeType)?.get(version),
|
|
48
|
+
versions: (nodeType) => [...(index().get(nodeType)?.keys() ?? [])],
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** The manifests in the cache file: an array, or `{ nodes: [...] }`; nothing when absent or unparseable. */
|
|
52
|
+
function cachedNodes(file) {
|
|
53
|
+
let parsed;
|
|
54
|
+
try {
|
|
55
|
+
parsed = JSON.parse(readFileSync(file, 'utf8'));
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
60
|
+
if (Array.isArray(parsed))
|
|
61
|
+
return parsed;
|
|
62
|
+
return isRecord(parsed) && Array.isArray(parsed.nodes) ? parsed.nodes : [];
|
|
63
|
+
}
|
package/dist/raw-node.d.ts
CHANGED
|
@@ -30,10 +30,24 @@ import { FlowAction } from './core/node-classes.js';
|
|
|
30
30
|
* }))
|
|
31
31
|
* ```
|
|
32
32
|
*
|
|
33
|
-
* `manifest
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
33
|
+
* **Omit `manifest`** to have `compile` and `check` read it from the node
|
|
34
|
+
* registry cache `uip maestro flow registry pull` writes on this machine
|
|
35
|
+
* (`~/.uipath/nodes/index.json`), by `nodeType` + `version`, exactly as
|
|
36
|
+
* `uip maestro flow registry get <nodeType>` would print it:
|
|
37
|
+
*
|
|
38
|
+
* ```ts
|
|
39
|
+
* .step('exotic', rawNode({ nodeType: 'uipath.exotic.thing', version: '2.1', inputs: { … } }))
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* When the cache has no `nodeType@version`, the step is refused
|
|
43
|
+
* (`RAW_NODE_MANIFEST_NOT_CACHED`), naming `registry pull` and `registry get`.
|
|
44
|
+
* A programmatic `serialize()` resolves it only from the
|
|
45
|
+
* `SerializeOpts.nodeCatalog` its caller passes.
|
|
46
|
+
*
|
|
47
|
+
* A `manifest` you do pass must be a real definition — an exact copy of what the
|
|
48
|
+
* registry or Workbench serves for that `nodeType@version`. It is not permission
|
|
49
|
+
* to invent one: the platform resolves the node against its own catalog at run
|
|
50
|
+
* time, so a hand-written manifest validates locally and fails on the tenant.
|
|
37
51
|
*
|
|
38
52
|
* Prefer a typed factory when one exists — it carries the family's checks, its
|
|
39
53
|
* defaults, and its output contract, none of which a raw node can know.
|
|
@@ -62,8 +76,12 @@ export declare function rawNode(spec: {
|
|
|
62
76
|
nodeType: string;
|
|
63
77
|
/** The exact definition version; also becomes the node's `typeVersion`. */
|
|
64
78
|
version: string;
|
|
65
|
-
/**
|
|
66
|
-
|
|
79
|
+
/**
|
|
80
|
+
* The complete node manifest, exactly as the platform serves it. Omit it to
|
|
81
|
+
* resolve the manifest from the local node registry cache by `nodeType` +
|
|
82
|
+
* `version` (`uip maestro flow registry pull` fills it).
|
|
83
|
+
*/
|
|
84
|
+
manifest?: unknown;
|
|
67
85
|
/** The node's `inputs`. `Expr` values render through the usual pipeline. */
|
|
68
86
|
inputs?: Record<string, unknown>;
|
|
69
87
|
/** Overrides for the node's `outputs`; rarely needed. */
|
package/dist/raw-node.js
CHANGED
|
@@ -11,6 +11,7 @@ import { rawNodeInputProblem, rawNodeTypedFamilyWarning } from './raw-node-advic
|
|
|
11
11
|
import { forwardFanOut } from './core/definition-handles.js';
|
|
12
12
|
import { RAW_NODE_EXITS } from './core/raw-node-exits.js';
|
|
13
13
|
import { CompileRefusal } from './core/compile-refusal.js';
|
|
14
|
+
import { catalogDefinition } from './core/node-catalog.js';
|
|
14
15
|
/**
|
|
15
16
|
* Place a node this SDK has no factory for, carrying its definition verbatim
|
|
16
17
|
* (`uipath.exotic.thing@2.1` and the manifest the platform served for it).
|
|
@@ -35,10 +36,24 @@ import { CompileRefusal } from './core/compile-refusal.js';
|
|
|
35
36
|
* }))
|
|
36
37
|
* ```
|
|
37
38
|
*
|
|
38
|
-
* `manifest
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
39
|
+
* **Omit `manifest`** to have `compile` and `check` read it from the node
|
|
40
|
+
* registry cache `uip maestro flow registry pull` writes on this machine
|
|
41
|
+
* (`~/.uipath/nodes/index.json`), by `nodeType` + `version`, exactly as
|
|
42
|
+
* `uip maestro flow registry get <nodeType>` would print it:
|
|
43
|
+
*
|
|
44
|
+
* ```ts
|
|
45
|
+
* .step('exotic', rawNode({ nodeType: 'uipath.exotic.thing', version: '2.1', inputs: { … } }))
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* When the cache has no `nodeType@version`, the step is refused
|
|
49
|
+
* (`RAW_NODE_MANIFEST_NOT_CACHED`), naming `registry pull` and `registry get`.
|
|
50
|
+
* A programmatic `serialize()` resolves it only from the
|
|
51
|
+
* `SerializeOpts.nodeCatalog` its caller passes.
|
|
52
|
+
*
|
|
53
|
+
* A `manifest` you do pass must be a real definition — an exact copy of what the
|
|
54
|
+
* registry or Workbench serves for that `nodeType@version`. It is not permission
|
|
55
|
+
* to invent one: the platform resolves the node against its own catalog at run
|
|
56
|
+
* time, so a hand-written manifest validates locally and fails on the tenant.
|
|
42
57
|
*
|
|
43
58
|
* Prefer a typed factory when one exists — it carries the family's checks, its
|
|
44
59
|
* defaults, and its output contract, none of which a raw node can know.
|
|
@@ -72,6 +87,12 @@ class RawNode extends FlowAction {
|
|
|
72
87
|
super();
|
|
73
88
|
this.spec = spec;
|
|
74
89
|
}
|
|
90
|
+
/** The manifest the author passed, else the catalog's for `nodeType@version`. */
|
|
91
|
+
manifestFrom(catalog) {
|
|
92
|
+
if (this.spec.manifest !== undefined)
|
|
93
|
+
return { manifest: this.spec.manifest };
|
|
94
|
+
return catalogDefinition(catalog, this.spec.nodeType, this.spec.version);
|
|
95
|
+
}
|
|
75
96
|
/**
|
|
76
97
|
* `check` surfaces a typed family as a warning, and an input a registered node
|
|
77
98
|
* type never reads as a warning at a version the SDK does not bundle. The
|
|
@@ -91,9 +112,16 @@ class RawNode extends FlowAction {
|
|
|
91
112
|
out.push({ code: 'RAW_NODE_TYPED_FAMILY', severity: 'warning', message: typed });
|
|
92
113
|
return out;
|
|
93
114
|
}
|
|
94
|
-
/**
|
|
95
|
-
|
|
96
|
-
|
|
115
|
+
/**
|
|
116
|
+
* Its exits, for `.stepSwitch` (core/raw-node-exits.ts), read off the manifest
|
|
117
|
+
* it carries or the one `catalog` holds. With neither, the exits are unknown,
|
|
118
|
+
* and the reason says which command fills the cache.
|
|
119
|
+
*/
|
|
120
|
+
[RAW_NODE_EXITS](catalog) {
|
|
121
|
+
const found = this.manifestFrom(catalog);
|
|
122
|
+
if ('missing' in found)
|
|
123
|
+
return { reason: found.missing.message, suggestion: found.missing.suggestion };
|
|
124
|
+
const manifest = found.manifest;
|
|
97
125
|
return forwardFanOut(manifest, this.spec.inputs ?? {})?.map((port) => ({ value: port, port }));
|
|
98
126
|
}
|
|
99
127
|
contribute(context) {
|
|
@@ -110,12 +138,17 @@ class RawNode extends FlowAction {
|
|
|
110
138
|
throw new CompileRefusal('RAW_NODE_VERSION_MISMATCH', `rawNode("${this.spec.nodeType}") carries version ${this.spec.version}, but the step requests `
|
|
111
139
|
+ `${context.requestedVersion}. Pass the manifest for the requested version, or drop { version }.`);
|
|
112
140
|
}
|
|
141
|
+
// No manifest of its own: the cache `registry pull` wrote, which the CLI
|
|
142
|
+
// passes in (the serializer reaches no file system, FB015).
|
|
143
|
+
const found = this.manifestFrom(context.nodeCatalog);
|
|
144
|
+
if ('missing' in found)
|
|
145
|
+
throw new CompileRefusal('RAW_NODE_MANIFEST_NOT_CACHED', found.missing.message, found.missing.suggestion);
|
|
113
146
|
return {
|
|
114
147
|
definition: {
|
|
115
148
|
source: 'snapshot',
|
|
116
149
|
nodeType: this.spec.nodeType,
|
|
117
150
|
version,
|
|
118
|
-
manifest:
|
|
151
|
+
manifest: found.manifest,
|
|
119
152
|
},
|
|
120
153
|
...(this.spec.inputs !== undefined ? { inputs: this.spec.inputs } : {}),
|
|
121
154
|
...(this.spec.outputs !== undefined ? { outputs: this.spec.outputs } : {}),
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an installed copy of this SDK says about itself, and the project floor.
|
|
3
|
+
*
|
|
4
|
+
* A caller that needs a feature asks the copy in use instead of guessing its
|
|
5
|
+
* release from what it ships (a symbol in `dist/api-index.md`, a word in a
|
|
6
|
+
* generated pipeline). `flow-sdk capabilities` prints the same answer.
|
|
7
|
+
*
|
|
8
|
+
* The capability list is the `cliCapabilities` array of this package's own
|
|
9
|
+
* `package.json`, the list `uip` already reads before it forwards an option.
|
|
10
|
+
* A name, once listed, is never renamed or dropped.
|
|
11
|
+
*
|
|
12
|
+
* The version is the one the release stamps into `package.json`. The source
|
|
13
|
+
* tree keeps it at `0.0.0-local` (docs/RELEASE.md) and the eval image stamps
|
|
14
|
+
* `9999.0.0-local`: a version ending in `-local` is a build of a checkout, and
|
|
15
|
+
* {@link sdkVersionSatisfies} lets it meet any floor.
|
|
16
|
+
*/
|
|
17
|
+
/** The answer of {@link sdkCapabilities}. */
|
|
18
|
+
export interface SdkCapabilities {
|
|
19
|
+
/** The package name, `@uipath/maestro-builder-sdk`. */
|
|
20
|
+
name: string;
|
|
21
|
+
/** The installed version, for instance `6.97.0`; `0.0.0-local` in a checkout. */
|
|
22
|
+
version: string;
|
|
23
|
+
/** The commit the release was built from, or `null` when none was stamped. */
|
|
24
|
+
gitref: string | null;
|
|
25
|
+
/** The stable feature names this copy supports, for instance `flow-check-baseline`. */
|
|
26
|
+
capabilities: string[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Read the name, version, gitref and capability list of this installed copy
|
|
30
|
+
* from its `package.json`. Needs Node: it reads the file through
|
|
31
|
+
* `node:module`'s `createRequire`, loaded on call.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* import { sdkCapabilities } from '@uipath/maestro-builder-sdk';
|
|
36
|
+
* if (!sdkCapabilities().capabilities.includes('flow-check-baseline')) {
|
|
37
|
+
* throw new Error('upgrade @uipath/maestro-builder-sdk');
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function sdkCapabilities(): SdkCapabilities;
|
|
42
|
+
/** Whether `floor` is a plain release version (`6.97.0`), the only form `flowSdk.minVersion` takes. */
|
|
43
|
+
export declare function isSdkVersionFloor(floor: string): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Whether an installed SDK `version` meets `floor`, a release version such as
|
|
46
|
+
* `6.97.0`. A version ending in `-local` (a build of a checkout) meets every
|
|
47
|
+
* floor. Another prerelease (`6.97.0-beta.1`) sits below its release, as in
|
|
48
|
+
* semver. A `version` or `floor` that is not a version meets nothing.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* sdkVersionSatisfies('6.97.1', '6.97.0'); // true
|
|
53
|
+
* sdkVersionSatisfies('6.90.0', '6.97.0'); // false
|
|
54
|
+
* sdkVersionSatisfies('0.0.0-local', '6.97.0'); // true
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function sdkVersionSatisfies(version: string, floor: string): boolean;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an installed copy of this SDK says about itself, and the project floor.
|
|
3
|
+
*
|
|
4
|
+
* A caller that needs a feature asks the copy in use instead of guessing its
|
|
5
|
+
* release from what it ships (a symbol in `dist/api-index.md`, a word in a
|
|
6
|
+
* generated pipeline). `flow-sdk capabilities` prints the same answer.
|
|
7
|
+
*
|
|
8
|
+
* The capability list is the `cliCapabilities` array of this package's own
|
|
9
|
+
* `package.json`, the list `uip` already reads before it forwards an option.
|
|
10
|
+
* A name, once listed, is never renamed or dropped.
|
|
11
|
+
*
|
|
12
|
+
* The version is the one the release stamps into `package.json`. The source
|
|
13
|
+
* tree keeps it at `0.0.0-local` (docs/RELEASE.md) and the eval image stamps
|
|
14
|
+
* `9999.0.0-local`: a version ending in `-local` is a build of a checkout, and
|
|
15
|
+
* {@link sdkVersionSatisfies} lets it meet any floor.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Read the name, version, gitref and capability list of this installed copy
|
|
19
|
+
* from its `package.json`. Needs Node: it reads the file through
|
|
20
|
+
* `node:module`'s `createRequire`, loaded on call.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* import { sdkCapabilities } from '@uipath/maestro-builder-sdk';
|
|
25
|
+
* if (!sdkCapabilities().capabilities.includes('flow-check-baseline')) {
|
|
26
|
+
* throw new Error('upgrade @uipath/maestro-builder-sdk');
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export function sdkCapabilities() {
|
|
31
|
+
const load = globalThis.process?.getBuiltinModule;
|
|
32
|
+
const mod = load?.('node:module');
|
|
33
|
+
if (!mod?.createRequire)
|
|
34
|
+
throw new Error('sdkCapabilities() needs Node 22.3 or later (process.getBuiltinModule)');
|
|
35
|
+
const pkg = mod.createRequire(import.meta.url)('../package.json');
|
|
36
|
+
return {
|
|
37
|
+
name: typeof pkg.name === 'string' ? pkg.name : '',
|
|
38
|
+
version: typeof pkg.version === 'string' ? pkg.version : '',
|
|
39
|
+
gitref: typeof pkg.gitref === 'string' && pkg.gitref !== '' ? pkg.gitref : null,
|
|
40
|
+
capabilities: Array.isArray(pkg.cliCapabilities) ? pkg.cliCapabilities.filter((c) => typeof c === 'string') : [],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const RELEASE = /^(\d+)\.(\d+)\.(\d+)$/;
|
|
44
|
+
const INSTALLED = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/;
|
|
45
|
+
/** Whether `floor` is a plain release version (`6.97.0`), the only form `flowSdk.minVersion` takes. */
|
|
46
|
+
export function isSdkVersionFloor(floor) {
|
|
47
|
+
return RELEASE.test(floor);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Whether an installed SDK `version` meets `floor`, a release version such as
|
|
51
|
+
* `6.97.0`. A version ending in `-local` (a build of a checkout) meets every
|
|
52
|
+
* floor. Another prerelease (`6.97.0-beta.1`) sits below its release, as in
|
|
53
|
+
* semver. A `version` or `floor` that is not a version meets nothing.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* sdkVersionSatisfies('6.97.1', '6.97.0'); // true
|
|
58
|
+
* sdkVersionSatisfies('6.90.0', '6.97.0'); // false
|
|
59
|
+
* sdkVersionSatisfies('0.0.0-local', '6.97.0'); // true
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export function sdkVersionSatisfies(version, floor) {
|
|
63
|
+
const want = RELEASE.exec(floor);
|
|
64
|
+
const have = INSTALLED.exec(version);
|
|
65
|
+
if (!want || !have)
|
|
66
|
+
return false;
|
|
67
|
+
const prerelease = have[4];
|
|
68
|
+
if (version.endsWith('-local'))
|
|
69
|
+
return true;
|
|
70
|
+
for (let i = 1; i <= 3; i++) {
|
|
71
|
+
const delta = Number(have[i]) - Number(want[i]);
|
|
72
|
+
if (delta !== 0)
|
|
73
|
+
return delta > 0;
|
|
74
|
+
}
|
|
75
|
+
return prerelease === undefined;
|
|
76
|
+
}
|