@uipath/maestro-builder-sdk 6.56.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 (75) hide show
  1. package/dist/api-index.md +6 -2
  2. package/dist/api-members.md +1 -1
  3. package/dist/case/subscription.d.ts +4 -2
  4. package/dist/case/subscription.js +5 -2
  5. package/dist/cli/commands/flow.js +2 -0
  6. package/dist/core/actions.js +2 -2
  7. package/dist/core/binding-messages.d.ts +2 -1
  8. package/dist/core/binding-messages.js +3 -4
  9. package/dist/core/byoa.d.ts +3 -2
  10. package/dist/core/byoa.js +3 -3
  11. package/dist/core/carried-definitions.d.ts +0 -18
  12. package/dist/core/carried-definitions.js +3 -2
  13. package/dist/core/ceql.d.ts +2 -1
  14. package/dist/core/ceql.js +3 -2
  15. package/dist/core/compile-refusal.d.ts +21 -0
  16. package/dist/core/compile-refusal.js +26 -0
  17. package/dist/core/connector-inputs.js +2 -1
  18. package/dist/core/connector-resolve-error.d.ts +2 -1
  19. package/dist/core/connector-resolve-error.js +3 -4
  20. package/dist/core/connectors.js +2 -1
  21. package/dist/core/event-filters.js +2 -1
  22. package/dist/core/hitl-routing.d.ts +7 -82
  23. package/dist/core/hitl-routing.js +95 -6
  24. package/dist/core/library.js +4 -3
  25. package/dist/core/lookups.js +6 -5
  26. package/dist/core/nodes/registry.js +3 -2
  27. package/dist/core/nodes/versioned.js +3 -2
  28. package/dist/core/process-resource-sort-order.js +1 -1
  29. package/dist/core/read-text.d.ts +0 -28
  30. package/dist/core/read-text.js +3 -2
  31. package/dist/core/refusals.d.ts +465 -0
  32. package/dist/core/refusals.js +504 -0
  33. package/dist/core/script-function.d.ts +126 -0
  34. package/dist/core/script-function.js +511 -0
  35. package/dist/core/typescript-module.js +2 -1
  36. package/dist/decompile-cli.js +11 -3
  37. package/dist/decompile.d.ts +9 -0
  38. package/dist/decompile.js +76 -3
  39. package/dist/flow-expr-check.d.ts +2 -1
  40. package/dist/flow-expr-check.js +4 -2
  41. package/dist/flow-node-type.d.ts +21 -0
  42. package/dist/flow-sdk.js +17 -16
  43. package/dist/flow-step-tree.js +1 -1
  44. package/dist/flow-variables.js +3 -2
  45. package/dist/load.js +19 -5
  46. package/dist/nodes/agent/flow/inline-agent.js +7 -6
  47. package/dist/nodes/connector/flow/node-type.js +2 -1
  48. package/dist/nodes/data-fabric/flow/factories.js +2 -1
  49. package/dist/nodes/data-fabric/flow/verbs.js +2 -1
  50. package/dist/nodes/delay/flow/factories.js +2 -1
  51. package/dist/nodes/document/flow/ixp.js +5 -1
  52. package/dist/nodes/hitl/flow/check.js +4 -2
  53. package/dist/nodes/hitl/flow/node-type.js +6 -5
  54. package/dist/nodes/http/flow/factories.js +2 -1
  55. package/dist/nodes/http/flow/node-type.js +6 -5
  56. package/dist/nodes/process/flow/factories.js +2 -1
  57. package/dist/nodes/queue/flow/node-type.js +3 -2
  58. package/dist/nodes/script/flow/factories.d.ts +42 -1
  59. package/dist/nodes/script/flow/factories.js +8 -9
  60. package/dist/nodes/script/flow/node-type.js +71 -0
  61. package/dist/nodes/script/flow/runtime.d.ts +20 -0
  62. package/dist/nodes/script/flow/runtime.js +29 -0
  63. package/dist/nodes/script/flow/spec.d.ts +32 -1
  64. package/dist/nodes/transform/flow/node-type.js +2 -1
  65. package/dist/raw-node.js +3 -2
  66. package/dist/ref-resolve.d.ts +0 -36
  67. package/dist/ref-resolve.js +9 -8
  68. package/dist/schema-version.d.ts +0 -38
  69. package/dist/schema-version.js +3 -2
  70. package/dist/script-function-scope.d.ts +57 -0
  71. package/dist/script-function-scope.js +203 -0
  72. package/dist/sdk-resolve.js +2 -1
  73. package/dist/serialize.d.ts +5 -2
  74. package/dist/serialize.js +115 -83
  75. package/package.json +2 -2
@@ -14,6 +14,7 @@ import { lookupSpecOf } from './lookups.js';
14
14
  import { loadByoaLedger, loadInvariantCollections, loadLookupResolutions } from './lookup-store.js';
15
15
  import { ownEntry } from './own-entry.js';
16
16
  import { ConnectorResolveError } from './connector-resolve-error.js';
17
+ import { CompileRefusal } from './compile-refusal.js';
17
18
  export { ConnectorResolveError } from './connector-resolve-error.js';
18
19
  export class Library {
19
20
  layers = [];
@@ -59,7 +60,7 @@ export class Library {
59
60
  const idx = libraryPath(dir, 'index.json');
60
61
  const entries = libraryEntries(read, idx);
61
62
  if (entries === undefined)
62
- throw new Error(`connector library not found at ${idx}. `
63
+ throw new CompileRefusal('LIBRARY_NOT_FOUND', `connector library not found at ${idx}. `
63
64
  + (read === readTextFromDisk
64
65
  ? `Run \`${PULL_COMMAND}\`, or point --library / $FLOW_SDK_LIBRARY_JSON at a library-json dir.`
65
66
  : 'The reader passed to Library has no such file.'));
@@ -292,7 +293,7 @@ export class Library {
292
293
  };
293
294
  }
294
295
  }
295
- throw new Error(`connector activity not found in library: ${wire.connectorKey} ${wire.httpMethod ?? '?'} ${wire.endpoint ?? '?'}`);
296
+ throw new CompileRefusal('CONNECTOR_NOT_IN_LIBRARY', `connector activity not found in library: ${wire.connectorKey} ${wire.httpMethod ?? '?'} ${wire.endpoint ?? '?'}`);
296
297
  }
297
298
  /**
298
299
  * Resolve a connector EVENT: the START trigger
@@ -393,7 +394,7 @@ export class Library {
393
394
  };
394
395
  }
395
396
  }
396
- throw new Error(`connector ${kind} event not found in library: ${wire.connectorKey} `
397
+ throw new CompileRefusal('EVENT_UNKNOWN', `connector ${kind} event not found in library: ${wire.connectorKey} `
397
398
  + `${wire.eventOperation ?? '?'} ${wire.objectName ?? '?'}`);
398
399
  }
399
400
  /**
@@ -28,6 +28,7 @@
28
28
  * make the surface worse rather than more complete.
29
29
  */
30
30
  import { prepareCommand, resolveFlagArg } from './cli-spelling.js';
31
+ import { CompileRefusal } from './compile-refusal.js';
31
32
  /** True when `v` is an unresolved {@link LookupToken}. */
32
33
  export function isLookupToken(v) {
33
34
  return (typeof v === 'object' && v !== null &&
@@ -100,7 +101,7 @@ function makeBuilder(nodeType, field, spec, generic) {
100
101
  // at `prepare` time. The alternative is spending the network call to be
101
102
  // told the field does not exist, which is the expensive way to learn it.
102
103
  if (spec && !spec.by.includes(name)) {
103
- throw new Error(`lookup(${nodeType}, '${field}'): cannot search by "${name}". ` +
104
+ throw new CompileRefusal('LOOKUP_UNKNOWN_MATCH_KEY', `lookup(${nodeType}, '${field}'): cannot search by "${name}". ` +
104
105
  `This collection is searchable by ${spec.by.map((b) => `"${b}"`).join(', ')}.`);
105
106
  }
106
107
  return token(name, value);
@@ -116,7 +117,7 @@ function makeBuilder(nodeType, field, spec, generic) {
116
117
  get(target, prop, receiver) {
117
118
  if (typeof prop === 'string' && !(prop in target) && ALIAS_SHAPE.test(prop)) {
118
119
  return () => {
119
- throw new Error(missingAliasMessage(nodeType, field, prop, spec, generic));
120
+ throw new CompileRefusal('LOOKUP_UNKNOWN_ALIAS', missingAliasMessage(nodeType, field, prop, spec, generic));
120
121
  };
121
122
  }
122
123
  return Reflect.get(target, prop, receiver);
@@ -126,7 +127,7 @@ function makeBuilder(nodeType, field, spec, generic) {
126
127
  export function lookup(a, b, c) {
127
128
  if (typeof a === 'string') {
128
129
  if (typeof c !== 'string') {
129
- throw new Error("lookup(key, action, field) needs all three arguments; " +
130
+ throw new CompileRefusal('LOOKUP_ARGS', "lookup(key, action, field) needs all three arguments; " +
130
131
  "did you mean lookup(descriptor, field)?");
131
132
  }
132
133
  return makeBuilder(`uipath.connector.${a}.${b}`, c, undefined, { key: a, action: b });
@@ -148,7 +149,7 @@ export function lookup(a, b, c) {
148
149
  // Naming the fields that DO have one matters: the commonest cause of this
149
150
  // is a field whose `reference` is degenerate, where the right answer is a
150
151
  // plain string and not a different helper call.
151
- throw new Error(`lookup(${bearing.nodeType}, '${b}'): no lookup is generated for that field. ` +
152
+ throw new CompileRefusal('LOOKUP_UNKNOWN_FIELD', `lookup(${bearing.nodeType}, '${b}'): no lookup is generated for that field. ` +
152
153
  (known.length
153
154
  ? `Fields with a lookup: ${known.map((k) => `"${k}"`).join(', ')}.`
154
155
  : 'This operation has no lookup fields — author the value as a plain string.'));
@@ -317,7 +318,7 @@ export function resolveEventWhere(where, resolutions, site) {
317
318
  }
318
319
  const resolved = resolvedEventValue(value, resolutions);
319
320
  if (resolved === undefined)
320
- throw new Error(`${site}: \`where.${key}\` ` + unresolvedLookupMessage(value));
321
+ throw new CompileRefusal('LOOKUP_UNRESOLVED', `${site}: \`where.${key}\` ` + unresolvedLookupMessage(value));
321
322
  out[key] = resolved;
322
323
  }
323
324
  return out;
@@ -1,5 +1,6 @@
1
1
  import { asVersioned } from './versioned.js';
2
2
  import { ownEntry } from '../own-entry.js';
3
+ import { CompileRefusal } from '../compile-refusal.js';
3
4
  /** Whether a prefix entry owns `typeName`: under its prefix, and accepted by its narrowing, if it has one. */
4
5
  function owns(p, typeName) {
5
6
  return typeName.startsWith(p.prefix) && (p.matches?.(typeName) ?? true);
@@ -44,11 +45,11 @@ export class NodeTypeRegistry {
44
45
  if (this.#extensions.includes(family))
45
46
  return;
46
47
  if (family.package === undefined) {
47
- throw new Error(`cannot register node family "${family.id}": a family registered at run time must name its package (NodeFamily.package).`);
48
+ throw new CompileRefusal('NODE_FAMILY_REGISTRATION', `cannot register node family "${family.id}": a family registered at run time must name its package (NodeFamily.package).`);
48
49
  }
49
50
  const { index, problems } = this.#build([...this.#builtIn, ...this.#extensions, family]);
50
51
  if (problems.length > 0) {
51
- throw new Error(`cannot register node family "${family.id}" from ${family.package.name}:\n`
52
+ throw new CompileRefusal('NODE_FAMILY_REGISTRATION', `cannot register node family "${family.id}" from ${family.package.name}:\n`
52
53
  + problems.map((p) => ` - ${p}`).join('\n'));
53
54
  }
54
55
  this.#extensions = [...this.#extensions, family];
@@ -1,4 +1,5 @@
1
1
  import { ownEntry } from '../own-entry.js';
2
+ import { CompileRefusal } from '../compile-refusal.js';
2
3
  /** True for a {@link VersionedNodeType}; a plain {@link NodeType} carries `version` instead. */
3
4
  export function isVersioned(t) {
4
5
  return 'versions' in t;
@@ -44,7 +45,7 @@ export function resolveVersion(t, spec, requested, where) {
44
45
  throw new Error(`internal SDK error: ${t.typeName}'s select() chose ${version} for ${where}, but the type registers only `
45
46
  + `${known}. This is a bug in the node type, not in the flow; please report it.`);
46
47
  }
47
- throw new Error(`${where} requests ${t.typeName}@${version}, but this SDK registers only ${known}. `
48
+ throw new CompileRefusal('NODE_VERSION_UNREGISTERED', `${where} requests ${t.typeName}@${version}, but this SDK registers only ${known}. `
48
49
  + 'Versions are exact — omit { version } to use the default, or request one listed here.');
49
50
  }
50
51
  return impl;
@@ -88,7 +89,7 @@ export function resolveVersionCarried(t, spec, requested, where, carried) {
88
89
  ? '. Versions are exact — omit { version } to use the default, or request one listed here.'
89
90
  : '. Versions are exact — omit { version } to use the default, request one listed here, or carry '
90
91
  + "that version's definition (the .flow file's definitions[] entry) with .definitions([...]).";
91
- throw new Error(`${where} requests ${t.typeName}@${requested}, but this SDK registers only ${registered}`
92
+ throw new CompileRefusal('NODE_VERSION_UNREGISTERED', `${where} requests ${t.typeName}@${requested}, but this SDK registers only ${registered}`
92
93
  + (carriedVersions.length > 0 ? ` and the flow carries only ${carriedVersions.join(', ')}` : '')
93
94
  + remedy);
94
95
  }
@@ -39,6 +39,6 @@ export const DYNAMIC_NODE_SORT_OFFSET = 500;
39
39
  export function resourceNodeSortOrder(category) {
40
40
  const base = ownEntry(PROCESS_RESOURCE_CATEGORY_SORT_ORDERS, category);
41
41
  if (base === undefined)
42
- throw new Error(`no sortOrder for process-resource category '${category}'`);
42
+ throw new Error(`internal SDK error: no sortOrder for process-resource category '${category}'`);
43
43
  return base + DYNAMIC_NODE_SORT_OFFSET;
44
44
  }
@@ -1,31 +1,3 @@
1
- /**
2
- * core/read-text — how the connector library reads its files.
3
- *
4
- * `Library` and `loadLibrary` read every library and overlay file through a
5
- * `ReadText`, so a host without a disk can serve them: Studio Web keeps the library
6
- * zip in memory and answers each read from it. A read is synchronous because QuickJS
7
- * cannot wait on one while it compiles.
8
- *
9
- * `Library` keeps what a host reader returns for library files (the index and the
10
- * ledgers) for as long as the reader lives, because a library build does not change:
11
- * pass a new reader for a new build. Overlay files are read afresh each time, because
12
- * `prepare` rewrites them.
13
- *
14
- * The default reads the disk. A host without one, which runs the SDK's CLI and so
15
- * cannot pass a reader in, hands one over before the run:
16
- * `globalThis[Symbol.for('uipath.maestro-builder-sdk.readText')] = read`, with
17
- * `$FLOW_SDK_LIBRARY_JSON` naming the folder it serves. That reader then answers every
18
- * default read, library and overlay alike, and its index is kept like any host reader's.
19
- * The default overlay folder is still looked up on the host's `fs`; pass
20
- * `--connectors-local` for an overlay only the reader serves. `node:fs` comes from
21
- * `process.getBuiltinModule`, not an `import`, so the library loads no `node:` builtin
22
- * (FB015 exempts this fallback), and `process` is read through `globalThis`, as in
23
- * `core/typescript-module.ts`.
24
- *
25
- * The tenant calls (`registry prepare`'s `uip` runs) have a sibling slot,
26
- * `globalThis[Symbol.for('uipath.maestro-builder-sdk.uip')]`, documented on
27
- * `defaultUipClient` in `registry/uip/client.ts`.
28
- */
29
1
  /** The file's text, or `undefined` when there is none. */
30
2
  export type ReadText = (path: string) => string | undefined;
31
3
  /** The reader a default read uses: the host's, when one is in the slot, else the disk. */
@@ -26,6 +26,7 @@
26
26
  * `globalThis[Symbol.for('uipath.maestro-builder-sdk.uip')]`, documented on
27
27
  * `defaultUipClient` in `registry/uip/client.ts`.
28
28
  */
29
+ import { CompileRefusal } from './compile-refusal.js';
29
30
  const HOST_READ_TEXT = Symbol.for('uipath.maestro-builder-sdk.readText');
30
31
  /** The reader a default read uses: the host's, when one is in the slot, else the disk. */
31
32
  export function defaultReadText() {
@@ -34,7 +35,7 @@ export function defaultReadText() {
34
35
  export function readTextFromDisk(path) {
35
36
  const getBuiltinModule = globalThis.process?.getBuiltinModule;
36
37
  if (getBuiltinModule === undefined) {
37
- throw new Error(`cannot read ${path}: outside Node, pass a readText function to the connector library`
38
+ throw new CompileRefusal('READ_TEXT_UNAVAILABLE', `cannot read ${path}: outside Node, pass a readText function to the connector library`
38
39
  + ` or set globalThis[Symbol.for('uipath.maestro-builder-sdk.readText')]`);
39
40
  }
40
41
  const fs = getBuiltinModule('node:fs');
@@ -48,7 +49,7 @@ export function libraryPath(dir, rel) {
48
49
  export function readJson(read, path) {
49
50
  const text = read(path);
50
51
  if (text === undefined)
51
- throw new Error(`no such file: ${path}`);
52
+ throw new CompileRefusal('FILE_NOT_FOUND', `no such file: ${path}`);
52
53
  return JSON.parse(text);
53
54
  }
54
55
  /** One reader's cache. Two readers can serve different files at the same path. */