@uipath/maestro-builder-sdk 6.98.0 → 6.100.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/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';
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';
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
- const compileOpts = { library, bindings };
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
+ }
@@ -30,10 +30,24 @@ import { FlowAction } from './core/node-classes.js';
30
30
  * }))
31
31
  * ```
32
32
  *
33
- * `manifest` must be a real definition — an exact copy of what the registry or
34
- * Workbench serves for that `nodeType@version`. It is not permission to invent
35
- * one: the platform resolves the node against its own catalog at run time, so a
36
- * hand-written manifest validates locally and fails on the tenant.
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
- /** The complete node manifest, exactly as the platform serves it. */
66
- manifest: unknown;
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` must be a real definition — an exact copy of what the registry or
39
- * Workbench serves for that `nodeType@version`. It is not permission to invent
40
- * one: the platform resolves the node against its own catalog at run time, so a
41
- * hand-written manifest validates locally and fails on the tenant.
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
- /** Its exits, for `.stepSwitch` (core/raw-node-exits.ts). */
95
- [RAW_NODE_EXITS]() {
96
- const manifest = this.spec.manifest;
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: this.spec.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 } : {}),
@@ -7,6 +7,7 @@
7
7
  * the platform emits, so the result passes `uip maestro flow validate`.
8
8
  */
9
9
  import { type ResourceResolutions } from './core/resource-resolution.js';
10
+ import type { NodeCatalog } from './core/node-catalog.js';
10
11
  import type { DefinitionReference } from './core/node-classes.js';
11
12
  import type { BuiltFlow } from './flow-sdk.js';
12
13
  import type { Library } from './library.js';
@@ -70,6 +71,14 @@ export interface SerializeOpts {
70
71
  * and are refused with the `prepare` command when it has none.
71
72
  */
72
73
  resources?: ResourceResolutions;
74
+ /**
75
+ * The node definitions `uip maestro flow registry pull` cached on this
76
+ * machine. A `rawNode` that omits `manifest` resolves its definition here by
77
+ * `nodeType` + `version`, and is refused (`RAW_NODE_MANIFEST_NOT_CACHED`)
78
+ * when the catalog has none. `uip maestro flow compile` and `check` pass the
79
+ * cache at `~/.uipath/nodes/index.json`; a programmatic caller passes its own.
80
+ */
81
+ nodeCatalog?: NodeCatalog;
73
82
  /**
74
83
  * Receives each {@link SerializeWarning}. `compile-cli` prints them as
75
84
  * `⚠ [CODE] …` after `check()`'s diagnostics; a caller that passes nothing
package/dist/serialize.js CHANGED
@@ -572,9 +572,12 @@ function refuseUnknownTrigger(spec, call) {
572
572
  * CONTRIBUTION_INVALID, so `check` reports it on the node and `compile` names
573
573
  * the code. An `internal SDK error:` is passed on as it is.
574
574
  */
575
- function contributionOf(node, requestedVersion, where) {
575
+ function contributionOf(node, requestedVersion, where, nodeCatalog) {
576
576
  try {
577
- return node.contribute(requestedVersion !== undefined ? { requestedVersion } : {});
577
+ return node.contribute({
578
+ ...(requestedVersion !== undefined ? { requestedVersion } : {}),
579
+ ...(nodeCatalog !== undefined ? { nodeCatalog } : {}),
580
+ });
578
581
  }
579
582
  catch (error) {
580
583
  if (error instanceof CompileRefusal || (error instanceof Error && error.message.startsWith('internal SDK error:')))
@@ -2013,7 +2016,7 @@ function serializeFlow(built, opts) {
2013
2016
  if (built.trigger !== undefined && !customTrigger)
2014
2017
  refuseUnknownTrigger(built.trigger, '.trigger()');
2015
2018
  if (customTrigger) {
2016
- const contribution = contributionOf(customTrigger, built.triggerOptions?.version, 'trigger');
2019
+ const contribution = contributionOf(customTrigger, built.triggerOptions?.version, 'trigger', opts.nodeCatalog);
2017
2020
  const def = resolveContributionDefinition(contribution.definition, built.triggerOptions?.version, 'trigger');
2018
2021
  const node = makeNode(def.nodeType, triggerId, built.triggerOptions?.label ?? def.display?.label ?? 'Start', { def, requestedVersion: built.triggerOptions?.version });
2019
2022
  const inputs = renderDeep(contribution.inputs ?? {}, NO_RENAME);
@@ -2058,7 +2061,7 @@ function serializeFlow(built, opts) {
2058
2061
  */
2059
2062
  function emitContribution(spec, stepName, requestedVersion, tails, scope, parentId) {
2060
2063
  const where = `step "${stepName}"`;
2061
- const contribution = contributionOf(spec, requestedVersion, where);
2064
+ const contribution = contributionOf(spec, requestedVersion, where, opts.nodeCatalog);
2062
2065
  const def = resolveContributionDefinition(contribution.definition, requestedVersion, where);
2063
2066
  // A connector definition reached this path only through a raw or hand-written
2064
2067
  // contribution — `connector()` never does — and would be emitted without
@@ -2970,7 +2973,7 @@ function serializeFlow(built, opts) {
2970
2973
  // no routable fan-out (a human task pinned to 1.0, a variant, an http
2971
2974
  // with no branches) must refuse rather than emit a node and then
2972
2975
  // discover it has one port. `stepExits` carries the reason.
2973
- const declaredExits = stepExits(step.spec, step.options?.version);
2976
+ const declaredExits = stepExits(step.spec, step.options?.version, opts.nodeCatalog);
2974
2977
  if (!hasExits(declaredExits)) {
2975
2978
  refuseOn(scope, step.name, new CompileRefusal('STEP_SWITCH_NO_EXITS', `.stepSwitch("${step.name}"): ${declaredExits.reason}, so there are no exits to route.`, declaredExits.suggestion));
2976
2979
  }
@@ -3500,7 +3503,7 @@ function serializeFlow(built, opts) {
3500
3503
  const epSpec = spec;
3501
3504
  let node;
3502
3505
  if (customEp) {
3503
- const contribution = contributionOf(customEp, requestedVersion, `entryPoint "${ep.id}"`);
3506
+ const contribution = contributionOf(customEp, requestedVersion, `entryPoint "${ep.id}"`, opts.nodeCatalog);
3504
3507
  const def = resolveContributionDefinition(contribution.definition, requestedVersion, `entryPoint "${ep.id}"`);
3505
3508
  node = makeNode(def.nodeType, ep.id, ep.options?.label ?? def.display?.label ?? ep.id, { def, requestedVersion });
3506
3509
  node.inputs = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.98.0",
3
+ "version": "6.100.0",
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",
@@ -115,5 +115,5 @@
115
115
  "@types/node": "^22.7.0",
116
116
  "esbuild": "^0.28.1"
117
117
  },
118
- "gitref": "c34b7ab7eafff32159cf7ae8d651cbf7aa65465c"
118
+ "gitref": "a44ecccdf05df7a87b2c9814a41abfeaf81d5f34"
119
119
  }