@uipath/maestro-builder-sdk 6.57.0 → 6.58.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.
Files changed (59) hide show
  1. package/dist/case/subscription.d.ts +4 -2
  2. package/dist/case/subscription.js +5 -2
  3. package/dist/core/actions.js +2 -2
  4. package/dist/core/binding-messages.d.ts +2 -1
  5. package/dist/core/binding-messages.js +3 -4
  6. package/dist/core/byoa.d.ts +3 -2
  7. package/dist/core/byoa.js +3 -3
  8. package/dist/core/carried-definitions.d.ts +0 -18
  9. package/dist/core/carried-definitions.js +3 -2
  10. package/dist/core/ceql.d.ts +2 -1
  11. package/dist/core/ceql.js +3 -2
  12. package/dist/core/compile-refusal.d.ts +21 -0
  13. package/dist/core/compile-refusal.js +26 -0
  14. package/dist/core/connector-inputs.js +2 -1
  15. package/dist/core/connector-resolve-error.d.ts +2 -1
  16. package/dist/core/connector-resolve-error.js +3 -4
  17. package/dist/core/connectors.js +2 -1
  18. package/dist/core/event-filters.js +2 -1
  19. package/dist/core/hitl-routing.d.ts +7 -82
  20. package/dist/core/hitl-routing.js +95 -6
  21. package/dist/core/library.js +4 -3
  22. package/dist/core/lookups.js +6 -5
  23. package/dist/core/nodes/registry.js +3 -2
  24. package/dist/core/nodes/versioned.js +3 -2
  25. package/dist/core/process-resource-sort-order.js +1 -1
  26. package/dist/core/read-text.d.ts +0 -28
  27. package/dist/core/read-text.js +3 -2
  28. package/dist/core/refusals.d.ts +465 -0
  29. package/dist/core/refusals.js +504 -0
  30. package/dist/core/script-function.js +2 -1
  31. package/dist/core/typescript-module.js +2 -1
  32. package/dist/flow-expr-check.d.ts +2 -1
  33. package/dist/flow-expr-check.js +4 -2
  34. package/dist/flow-sdk.js +17 -16
  35. package/dist/flow-step-tree.js +1 -1
  36. package/dist/flow-variables.js +3 -2
  37. package/dist/load.js +7 -6
  38. package/dist/nodes/agent/flow/inline-agent.js +7 -6
  39. package/dist/nodes/connector/flow/node-type.js +2 -1
  40. package/dist/nodes/data-fabric/flow/factories.js +2 -1
  41. package/dist/nodes/data-fabric/flow/verbs.js +2 -1
  42. package/dist/nodes/delay/flow/factories.js +2 -1
  43. package/dist/nodes/document/flow/ixp.js +5 -1
  44. package/dist/nodes/hitl/flow/check.js +4 -2
  45. package/dist/nodes/hitl/flow/node-type.js +6 -5
  46. package/dist/nodes/http/flow/factories.js +2 -1
  47. package/dist/nodes/http/flow/node-type.js +6 -5
  48. package/dist/nodes/process/flow/factories.js +2 -1
  49. package/dist/nodes/queue/flow/node-type.js +3 -2
  50. package/dist/nodes/transform/flow/node-type.js +2 -1
  51. package/dist/raw-node.js +3 -2
  52. package/dist/ref-resolve.d.ts +0 -36
  53. package/dist/ref-resolve.js +9 -8
  54. package/dist/schema-version.d.ts +0 -38
  55. package/dist/schema-version.js +3 -2
  56. package/dist/sdk-resolve.js +2 -1
  57. package/dist/serialize.d.ts +5 -2
  58. package/dist/serialize.js +115 -83
  59. package/package.json +2 -2
@@ -1,39 +1,3 @@
1
- /**
2
- * `$ref` resolution for SPLIT `.flow` files (design §5, Phase 5E).
3
- *
4
- * The format lets a `.flow` be split across sibling files with JSON Reference
5
- * (`{ "$ref": "./layout.json" }`) — used to sideline layout or definitions, or
6
- * to extract a subflow out of an oversized file
7
- * (`flow-schema/REF_RESOLUTION.md`, MST-8579). Decompile has to READ those, so
8
- * this resolves them into ONE object model before anything else looks at the
9
- * document.
10
- *
11
- * Compile keeps writing a single file, deliberately: nothing in the designer or
12
- * the skills splits files today, so write-through splitting would be a merge
13
- * concern with no producer to round-trip against.
14
- *
15
- * The semantics below are the platform resolver's, mirrored rather than
16
- * reinvented (`flow-schema/src/ref-resolver/`), because a file the platform
17
- * reads one way and the SDK another is worse than no support at all:
18
- *
19
- * - **`$ref` replaces the whole object.** JSON Reference, not JSON Schema —
20
- * sibling properties beside a `$ref` are dropped, not merged.
21
- * - **Same-document fragments (`#/…`) are left ALONE.** They are legitimate
22
- * internal pointers — a connector tool's `outputSchema` carries them — and
23
- * they are not file references. Resolving them as filenames is the exact
24
- * regression the platform's own guard exists to prevent.
25
- * - **Relative paths only.** Absolute paths, Windows drive letters, protocol
26
- * URIs and traversal above the referencing file's root are REFUSED, because
27
- * a `.flow` is untrusted input and the alternative is a file-exfiltration
28
- * primitive (`$ref: '/etc/passwd'`, `$ref: 'https://…'`).
29
- * - **Any depth**, and resolved content is walked again for its own refs.
30
- *
31
- * Where this deliberately differs: an unresolvable ref is an ERROR here, not a
32
- * warning. The platform's resolver collects non-fatal errors because a canvas
33
- * can render a partial document and let a person fix it; decompile turns the
34
- * document into SOURCE, and a silently-missing subtree becomes source that
35
- * compiles to a different flow. Failing names the file that is missing.
36
- */
37
1
  /** How this module reads a sibling file. Injected so it is testable and so the
38
2
  * SDK core stays free of `node:fs`. */
39
3
  export type RefReader = (resolvedPath: string) => string;
@@ -34,6 +34,7 @@
34
34
  * document into SOURCE, and a silently-missing subtree becomes source that
35
35
  * compiles to a different flow. Failing names the file that is missing.
36
36
  */
37
+ import { CompileRefusal } from './core/compile-refusal.js';
37
38
  /**
38
39
  * Collapse `.` and `..` segments, preserving a leading `/` for POSIX absolute
39
40
  * paths — the platform's `normalizePath`, same behavior.
@@ -60,13 +61,13 @@ function normalizePath(path) {
60
61
  */
61
62
  export function resolveRefPath(baseUri, refPath) {
62
63
  if (refPath.startsWith('#')) {
63
- throw new Error(`$ref "${refPath}" is a same-document fragment, not a file — it must not be resolved as a path.`);
64
+ throw new CompileRefusal('JSON_REF_PATH_INVALID', `$ref "${refPath}" is a same-document fragment, not a file — it must not be resolved as a path.`);
64
65
  }
65
66
  if (refPath.startsWith('/') || /^[a-zA-Z]:/.test(refPath)) {
66
- throw new Error(`$ref "${refPath}" is an absolute path; only relative paths are allowed.`);
67
+ throw new CompileRefusal('JSON_REF_PATH_INVALID', `$ref "${refPath}" is an absolute path; only relative paths are allowed.`);
67
68
  }
68
69
  if (refPath.includes('://')) {
69
- throw new Error(`$ref "${refPath}" is a protocol URI; only relative file paths are allowed.`);
70
+ throw new CompileRefusal('JSON_REF_PATH_INVALID', `$ref "${refPath}" is a protocol URI; only relative file paths are allowed.`);
70
71
  }
71
72
  const normalizedBase = baseUri.replace(/\\/g, '/');
72
73
  const lastSlash = normalizedBase.lastIndexOf('/');
@@ -74,7 +75,7 @@ export function resolveRefPath(baseUri, refPath) {
74
75
  const resolved = normalizePath(`${baseDir}${refPath}`);
75
76
  const isAbsoluteBase = normalizedBase.startsWith('/') || /^[a-zA-Z]:\//.test(normalizedBase);
76
77
  if (!isAbsoluteBase && resolved.startsWith('..')) {
77
- throw new Error(`$ref "${refPath}" escapes the project root.`);
78
+ throw new CompileRefusal('JSON_REF_PATH_INVALID', `$ref "${refPath}" escapes the project root.`);
78
79
  }
79
80
  return resolved;
80
81
  }
@@ -115,11 +116,11 @@ export function resolveFlowRefs(doc, options) {
115
116
  if (node.$ref.startsWith('#'))
116
117
  return node;
117
118
  if (depth >= maxDepth) {
118
- throw new Error(`$ref resolution exceeded ${maxDepth} levels at ${where} ("${node.$ref}").`);
119
+ throw new CompileRefusal('JSON_REF_TOO_DEEP', `$ref resolution exceeded ${maxDepth} levels at ${where} ("${node.$ref}").`);
119
120
  }
120
121
  const path = resolveRefPath(baseUri, node.$ref);
121
122
  if (visiting.has(path)) {
122
- throw new Error(`Circular $ref at ${where}: "${node.$ref}" is already being resolved.`);
123
+ throw new CompileRefusal('JSON_REF_CIRCULAR', `Circular $ref at ${where}: "${node.$ref}" is already being resolved.`);
123
124
  }
124
125
  let text;
125
126
  try {
@@ -127,7 +128,7 @@ export function resolveFlowRefs(doc, options) {
127
128
  }
128
129
  catch (err) {
129
130
  const why = err instanceof Error ? err.message : String(err);
130
- throw new Error(`$ref at ${where} points at "${node.$ref}", which could not be read (${why}).`);
131
+ throw new CompileRefusal('JSON_REF_UNREADABLE', `$ref at ${where} points at "${node.$ref}", which could not be read (${why}).`);
131
132
  }
132
133
  let parsed;
133
134
  try {
@@ -135,7 +136,7 @@ export function resolveFlowRefs(doc, options) {
135
136
  }
136
137
  catch (err) {
137
138
  const why = err instanceof Error ? err.message : String(err);
138
- throw new Error(`$ref at ${where} points at "${node.$ref}", which is not valid JSON (${why}).`);
139
+ throw new CompileRefusal('JSON_REF_NOT_JSON', `$ref at ${where} points at "${node.$ref}", which is not valid JSON (${why}).`);
139
140
  }
140
141
  visiting.add(path);
141
142
  try {
@@ -1,41 +1,3 @@
1
- /**
2
- * schema-version — the artifact's FILE-FORMAT version, as something an author
3
- * can declare and a decompile can PRESERVE.
4
- *
5
- * Every artifact family this SDK writes carries a version that describes the
6
- * DOCUMENT's grammar rather than the author's release: Flow's top-level
7
- * `version`, Case's top-level `version`, BPMN's `uipath:migrationVersion`. Until
8
- * now each family pinned exactly one value in its serializer's format profile
9
- * and overwrote whatever the input said, which is right for greenfield
10
- * authoring and wrong for the brownfield loop:
11
- *
12
- * decompile(a 1.10 flow) -> compile -> a 1.9 flow, with nothing said.
13
- *
14
- * That silent rewrite is the hole this module closes. `.schemaVersion(v)` on
15
- * each builder declares the version the emitted document targets, decompile
16
- * emits the call so a round-trip re-declares what it read, and the serializer
17
- * writes what was declared instead of the pin.
18
- *
19
- * ## A declared version is a CLAIM, not a switch
20
- *
21
- * The rule that shapes this whole module is the one CASE_PARITY §3.8 states for
22
- * `.version()`: a document's version asserts that the whole document matches
23
- * that schema. An author writing `.version('30.0.0')` against the old
24
- * V20-emitting serializer produced an INVALID document, because the claim was
25
- * false. So `.schemaVersion()` accepts only versions this SDK can actually
26
- * write — {@link SchemaVersionPolicy.writable}, each row carrying the evidence
27
- * that says so — and refuses anything else rather than stamping a claim it
28
- * cannot back. Moving a document BETWEEN versions stays the product's job
29
- * (`uip maestro flow migrate`), because a hop can carry data repairs this SDK
30
- * has no way to reproduce.
31
- *
32
- * ## Comparing versions
33
- *
34
- * `'1.10' < '1.9'` as strings, which is exactly the wrong answer, and the same
35
- * trap sits in Case's `'30.0.0'` vs `'9.0.0'`. Nothing here compares version
36
- * strings with `<`; {@link compareSchemaVersions} splits on `.` and compares
37
- * segments numerically, and every gate goes through it.
38
- */
39
1
  /** The artifact families that carry a schema version. */
40
2
  export type ArtifactFamily = 'flow' | 'case' | 'bpmn';
41
3
  /** A version this SDK build can WRITE, with the evidence that says it can. */
@@ -36,6 +36,7 @@
36
36
  * strings with `<`; {@link compareSchemaVersions} splits on `.` and compares
37
37
  * segments numerically, and every gate goes through it.
38
38
  */
39
+ import { CompileRefusal } from './core/compile-refusal.js';
39
40
  /** A version string the schema families use: dotted, numeric, e.g. `1.9`, `1.10`, `30.0.0`. */
40
41
  const SYNTAX = /^\d+(\.\d+)*$/;
41
42
  /** True when `value` is shaped like a schema version at all. */
@@ -52,7 +53,7 @@ export function isSchemaVersionSyntax(value) {
52
53
  */
53
54
  export function compareSchemaVersions(a, b) {
54
55
  if (!isSchemaVersionSyntax(a) || !isSchemaVersionSyntax(b)) {
55
- throw new Error(`compareSchemaVersions: "${a}" / "${b}" is not a dotted-numeric schema version.`);
56
+ throw new Error(`internal SDK error: compareSchemaVersions: "${a}" / "${b}" is not a dotted-numeric schema version.`);
56
57
  }
57
58
  const left = a.split('.').map(Number);
58
59
  const right = b.split('.').map(Number);
@@ -134,7 +135,7 @@ export function resolveSchemaVersion(policy, requested) {
134
135
  return policy.default;
135
136
  const refusal = schemaVersionRefusal(policy, requested);
136
137
  if (refusal)
137
- throw new Error(refusal);
138
+ throw new CompileRefusal('SCHEMA_VERSION_UNSUPPORTED', refusal);
138
139
  return requested;
139
140
  }
140
141
  export function preserveSchemaVersion(policy, declared) {
@@ -3,6 +3,7 @@ import { existsSync } from 'node:fs';
3
3
  import { register } from 'node:module';
4
4
  import { fileURLToPath } from 'node:url';
5
5
  import { PACKAGE_NAME } from './package-name.js';
6
+ import { CompileRefusal } from './core/compile-refusal.js';
6
7
  let registered = false;
7
8
  /**
8
9
  * Make `import … from '@uipath/maestro-builder-sdk'` in authored source resolve
@@ -25,7 +26,7 @@ export function useThisSdkForAuthoredSource() {
25
26
  registered = true;
26
27
  return;
27
28
  }
28
- throw new Error(`cannot point authored source at this copy of ${PACKAGE_NAME}: ${fileURLToPath(hook)} is missing, as in a bundle, `
29
+ throw new CompileRefusal('SDK_RESOLVE_HOOK_MISSING', `cannot point authored source at this copy of ${PACKAGE_NAME}: ${fileURLToPath(hook)} is missing, as in a bundle, `
29
30
  + 'so its imports would load a second copy and serialize wrong. Run the installed package, or load authored source yourself.');
30
31
  }
31
32
  register(hook);
@@ -188,9 +188,12 @@ export declare function assertFileWideIdsUnique(flow: any): void;
188
188
  * It holds for real definitions: of the 5,102 in the local registry index
189
189
  * (2026-09-30), 4,999 reference a `<bindings.…>` name and every one of them
190
190
  * declares that name in `model.bindings.values`, which is what the emitters
191
- * close. Agent resource definitions are the one exemption (see below).
191
+ * close. Agent resource definitions are one exemption (see below); `unbound`,
192
+ * the nodes a draft compile reported as `BINDING_MISSING`, is the other: such a
193
+ * node names no connection, so it writes no binding rows, and the draft finding
194
+ * already says so.
192
195
  *
193
196
  * @throws BindingRefusal `BINDING_PLACEHOLDER_UNRESOLVED`, naming each dangling
194
197
  * placeholder and the step that carries it.
195
198
  */
196
- export declare function assertBindingPlaceholdersResolve(flow: any): void;
199
+ export declare function assertBindingPlaceholdersResolve(flow: any, unbound?: ReadonlySet<string>): void;