@uipath/maestro-builder-sdk 6.118.0 → 6.119.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/api-index.md CHANGED
@@ -135,7 +135,7 @@ could hand you spans for a version you do not have.
135
135
  | `DocumentClassifyInputs` | interface | `dist/nodes/document/flow/spec.d.ts:10-39` | Option shapes | What `documentClassify()` takes: the document, and how to split and classify it. |
136
136
  | `DocValidationInputs` | interface | `dist/nodes/hitl/flow/spec.d.ts:76-99` | Option shapes | The Document Validation task's subject — `variant: 'document-validation'` only. |
137
137
  | `DoWhileOptions` | interface | `dist/flow-sdk.d.ts:451-460` | Option shapes | Do-while options. |
138
- | `dynamicExtract` | function | `dist/nodes/document/flow/factories.d.ts:20-30` | Actions | Extract fields from a document with an INLINE schema — Dynamic Extract (`uipath.ixp.extract-document-builder`), the… |
138
+ | `dynamicExtract` | function | `dist/nodes/document/flow/factories.d.ts:20-89` | Actions | Extract fields from a document with an INLINE schema — Dynamic Extract (`uipath.ixp.extract-document-builder`), the… |
139
139
  | `DynamicExtractInputs` | interface | `dist/nodes/document/flow/spec.d.ts:56-131` | Option shapes | What `dynamicExtract()` takes: the document and the fields to extract from it. |
140
140
  | `EdgeRoute` | interface | `dist/flow-sdk.d.ts:651-665` | Supporting types | One edge's route: user-dragged bends and/or the auto-router's waypoints. |
141
141
  | `endCall` | function | `dist/nodes/agent/flow/factories.d.ts:32-39` | Actions | Hang up (`uipath.conversational.voice.end-call`). |
@@ -197,7 +197,7 @@ could hand you spans for a version you do not have.
197
197
  | `InOutField` | interface | `dist/core/actions.d.ts:278-295` | Supporting types | A value the reviewer READS **and can correct**: pre-filled from the flow, editable on the form, and the (possibly… |
198
198
  | `input` | function | `dist/core/expr.d.ts:44-61` | Expressions and types | Reference a flow input by name → `$vars.<triggerId>.output.<name>`. |
199
199
  | `isLookupToken` | function | `dist/core/lookups.d.ts:53-54` | Generated descriptors | True when `v` is an unresolved LookupToken. |
200
- | `ixpExtract` | function | `dist/nodes/document/flow/factories.d.ts:31-85` | Actions | Extract fields from a document with a published IxP project — the platform's **Extract** node (`uipath.ixp.*`, service… |
200
+ | `ixpExtract` | function | `dist/nodes/document/flow/factories.d.ts:90-144` | Actions | Extract fields from a document with a published IxP project — the platform's **Extract** node (`uipath.ixp.*`, service… |
201
201
  | `IxpExtractInputs` | interface | `dist/nodes/document/flow/spec.d.ts:149-224` | Option shapes | What `ixpExtract()` takes: the IxP project's extractor, its identity on the tenant, and the document. |
202
202
  | `IxpToolRef` | interface | `dist/core/actions.d.ts:789-827` | Supporting types | A published IxP (Intelligent eXtraction Platform) project as a tool — the agent decides when to extract a document and… |
203
203
  | `js` | function | `dist/core/expr.d.ts:247-282` | Expressions and types | Build a raw JS *expression* (a condition or computation). |
package/dist/check.d.ts CHANGED
@@ -1,13 +1,3 @@
1
- /**
2
- * check — static validation of a BuiltFlow before serialization.
3
- *
4
- * Produces structured, actionable diagnostics (the kind an agent can act on):
5
- * references to undeclared variables/steps, empty branch arms, missing
6
- * terminals, and every refusal `compile` would raise (duplicate step names, an
7
- * input a connector does not declare, …), which it gets by running the
8
- * serializer in collect mode (`serializerRefusals`), so each of those rules
9
- * lives in the serializer alone.
10
- */
11
1
  import type { SolutionProjects } from './core/solution-projects.js';
12
2
  import { type ResourceResolutions } from './core/resource-resolution.js';
13
3
  import type { NodeCatalog } from './core/node-catalog.js';
package/dist/check.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { typescript } from './core/typescript-module.js';
1
2
  import { isResourceToken } from './core/resource-resolution.js';
2
3
  import { isLookupToken } from './core/lookups.js';
3
4
  import { prepareCommand } from './core/cli-spelling.js';
@@ -1140,7 +1141,12 @@ function checkFlow(built, ancestors, opts = {}) {
1140
1141
  }
1141
1142
  // A registered node type declares what its output is; `none` reports here,
1142
1143
  // at the same point as the per-family no-output rules below.
1143
- const placed = checkedSteps.get(name);
1144
+ //
1145
+ // Only a READ reaches a node type's output contract: the same text in a
1146
+ // string literal or a comment (`'see $vars.extract.output.ExtractionResult'`)
1147
+ // is a mention, which the contracts' rules must not judge.
1148
+ const isRead = code.startsWith('$vars', m.index ?? 0);
1149
+ const placed = isRead ? checkedSteps.get(name) : undefined;
1144
1150
  if (placed) {
1145
1151
  const contract = placed.impl.checkOutput?.(placed.spec, opts)
1146
1152
  ?? placed.impl.output(placed.spec, { resources: opts.resources });
@@ -1217,7 +1223,7 @@ function checkFlow(built, ancestors, opts = {}) {
1217
1223
  }
1218
1224
  // A registered node type that states its output's fields: the same read
1219
1225
  // rule, worded by its contract and reported through its family's catalog.
1220
- const fieldsPlaced = checkedSteps.get(name);
1226
+ const fieldsPlaced = isRead ? checkedSteps.get(name) : undefined;
1221
1227
  const fieldsContract = fieldsPlaced
1222
1228
  && (fieldsPlaced.impl.checkOutput?.(fieldsPlaced.spec, opts)
1223
1229
  ?? fieldsPlaced.impl.output(fieldsPlaced.spec, { resources: opts.resources }));
@@ -2019,17 +2025,73 @@ function declaredRefName(js, triggerId) {
2019
2025
  return viaTrigger?.[1];
2020
2026
  }
2021
2027
  /**
2022
- * The JavaScript text with `//` and `/* *\/` comments and the text of string and
2023
- * template literals replaced by spaces — same length, so a match offset in the
2024
- * original indexes the same character here. A template's `${…}` bodies are code
2025
- * and are kept (nested templates and strings inside them are blanked in turn).
2028
+ * The JavaScript text with `//` and `/* *\/` comments and the text of string,
2029
+ * template and regular-expression literals replaced by spaces — same length, so
2030
+ * a match offset in the original indexes the same character here. A template's
2031
+ * `${…}` bodies are code and are kept (nested templates and strings inside them
2032
+ * are blanked in turn).
2026
2033
  *
2027
2034
  * This is the read-versus-mention line `uip maestro flow validate` draws in its
2028
2035
  * `$vars` extraction (`collectVarsRefs`, `inProse`): a rule that fires on a VALID
2029
- * name must not fire on `"pass $vars.x here"` or a commented-out line. Regex
2030
- * literals are not recognised; a `$vars` reference inside one is vanishingly rare.
2036
+ * name must not fire on `"pass $vars.x here"` or a commented-out line.
2037
+ *
2038
+ * The literals come from the TypeScript parser, because only a parser tells a
2039
+ * regular expression from a division: in `const q = /['"]/; return $vars.a.output;`
2040
+ * the quote inside the regexp opens no string, so the read after it stays code.
2041
+ * Comments are then found by {@link maskComments} on the text with the literals
2042
+ * already blank, where a `//` or `/*` can only be a comment. Text that parses
2043
+ * neither as an expression nor as a script body falls back to that scanner alone.
2031
2044
  */
2032
2045
  function codeOnly(src) {
2046
+ // Only the offsets of `$vars` matches are consulted, so text without one needs no parse.
2047
+ if (!src.includes('$vars'))
2048
+ return src;
2049
+ return maskComments(maskLiterals(src) ?? src);
2050
+ }
2051
+ /** `src` with every string, template-text and regexp literal's contents blanked, from a parse; undefined when it does not parse. */
2052
+ function maskLiterals(src) {
2053
+ const ts = typescript();
2054
+ const attempts = [['(', '\n)'], ['function __body() {\n', '\n}']];
2055
+ for (const [prefix, suffix] of attempts) {
2056
+ const sf = ts.createSourceFile('code-only.js', `${prefix}${src}${suffix}`, ts.ScriptTarget.Latest, true, ts.ScriptKind.JS);
2057
+ if ((sf.parseDiagnostics ?? []).length > 0)
2058
+ continue;
2059
+ const out = src.split('');
2060
+ const blank = (from, to) => {
2061
+ for (let k = Math.max(from, 0); k < to && k < out.length; k++)
2062
+ if (out[k] !== '\n')
2063
+ out[k] = ' ';
2064
+ };
2065
+ const visit = (node) => {
2066
+ const start = node.getStart(sf) - prefix.length;
2067
+ const end = node.end - prefix.length;
2068
+ switch (node.kind) {
2069
+ case ts.SyntaxKind.StringLiteral:
2070
+ case ts.SyntaxKind.NoSubstitutionTemplateLiteral:
2071
+ case ts.SyntaxKind.RegularExpressionLiteral:
2072
+ case ts.SyntaxKind.TemplateTail:
2073
+ blank(start + 1, end - 1);
2074
+ break;
2075
+ case ts.SyntaxKind.TemplateHead:
2076
+ case ts.SyntaxKind.TemplateMiddle:
2077
+ blank(start + 1, end - 2);
2078
+ break;
2079
+ default: break;
2080
+ }
2081
+ ts.forEachChild(node, visit);
2082
+ };
2083
+ visit(sf);
2084
+ return out.join('');
2085
+ }
2086
+ return undefined;
2087
+ }
2088
+ /**
2089
+ * The hand scanner: blanks `//` and `/* *\/` comments and the text of string
2090
+ * and template literals. On text whose literals {@link maskLiterals} already
2091
+ * blanked it finds only comments; on its own (text that does not parse) it does
2092
+ * not know regular expressions, so a quote inside one opens a string.
2093
+ */
2094
+ function maskComments(src) {
2033
2095
  const out = src.split('');
2034
2096
  const n = src.length;
2035
2097
  let i = 0;
@@ -168,14 +168,20 @@ export async function run(argv) {
168
168
  // The node registry cache `uip maestro flow registry pull` writes: a `rawNode`
169
169
  // without `manifest` resolves its definition there (#1981). Read on first use.
170
170
  const nodeCatalog = readNodeCatalog();
171
+ // The `.flow` this compile overwrites: a step reads the node it had there
172
+ // (Extract document keeps its taxonomy ids, #1985).
173
+ const overwrites = readJsonOrUndefined(resolve(out));
174
+ const notes = [];
171
175
  const warnings = [];
172
176
  let emitted;
173
177
  try {
174
178
  emitted = await withFetchedDefinitions(argv, (library) => {
175
179
  // One pass's warnings: a pass that missed a definition runs again.
176
180
  warnings.length = 0;
181
+ notes.length = 0;
177
182
  return serializeWithSidecars(built, {
178
183
  library, bindings, warn: (w) => warnings.push(w), resources, agentSource, nodeCatalog,
184
+ overwrites, note: (n) => notes.push(n),
179
185
  ...(solution !== undefined ? { solution } : {}),
180
186
  carriedDrafts: (d) => warnings.push(draftWarning(d)),
181
187
  });
@@ -247,6 +253,8 @@ export async function run(argv) {
247
253
  console.log(`compile: wrote ${sidecar.path}`);
248
254
  written.push(target);
249
255
  }
256
+ for (const n of notes)
257
+ console.log(`compile: ${JSON.stringify(n.step)} ${n.message}`);
250
258
  for (const path of processors?.written ?? [])
251
259
  console.log(`compile: wrote ${path} (IDP processor)`);
252
260
  for (const why of processors?.skipped ?? [])
@@ -267,7 +275,10 @@ export async function run(argv) {
267
275
  + `. To make this explicit, set source: "${to}" on "${step}" in the .flow.ts.`);
268
276
  }
269
277
  }
270
- reportResult({ path: resolve(out), nodes: flowJson.nodes.length, edges: flowJson.edges.length, sidecars: written });
278
+ reportResult({
279
+ path: resolve(out), nodes: flowJson.nodes.length, edges: flowJson.edges.length, sidecars: written,
280
+ ...(notes.length > 0 ? { notes } : {}),
281
+ });
271
282
  // PRUNE the agent resources this compile owns but did not write this time.
272
283
  // Compile otherwise only ever ADDS files, and an agent resource is keyed by a
273
284
  // uuid derived from the step name and the resource's identity — so dropping a
@@ -364,7 +364,17 @@ export declare const REFUSALS: {
364
364
  readonly EXTERNAL_TASK_FOLDER: "lowering";
365
365
  readonly EXTERNAL_TASK_MODE: "lowering";
366
366
  readonly EXTERNAL_TASK_MODE_MISMATCH: "lowering";
367
+ readonly EXTRACT_READ_NOT_OUTPUT: "lint";
368
+ readonly EXTRACT_READ_UNKNOWN_FIELD: "lint";
367
369
  readonly EXTRACT_SCHEMA_SHAPE: "lint";
370
+ readonly EXTRACT_TAXONOMY_BARE: "lint";
371
+ readonly EXTRACT_TAXONOMY_DUPLICATE_ID: "lint";
372
+ readonly EXTRACT_TAXONOMY_FIELD_TYPE: "lint";
373
+ readonly EXTRACT_TAXONOMY_LEGACY: "lint";
374
+ readonly EXTRACT_TAXONOMY_LIMIT: "lint";
375
+ readonly EXTRACT_TAXONOMY_NESTING: "lint";
376
+ readonly EXTRACT_TAXONOMY_REF: "lint";
377
+ readonly EXTRACT_TAXONOMY_STRUCTURE: "lint";
368
378
  readonly FAKE_JOIN: "lint";
369
379
  readonly FILE_NOT_FOUND: "lowering";
370
380
  readonly FIRE_AND_FORGET_READ: "lint";
@@ -438,7 +438,17 @@ export const REFUSALS = {
438
438
  EXTERNAL_TASK_FOLDER: 'lowering',
439
439
  EXTERNAL_TASK_MODE: 'lowering',
440
440
  EXTERNAL_TASK_MODE_MISMATCH: 'lowering',
441
+ EXTRACT_READ_NOT_OUTPUT: 'lint',
442
+ EXTRACT_READ_UNKNOWN_FIELD: 'lint',
441
443
  EXTRACT_SCHEMA_SHAPE: 'lint',
444
+ EXTRACT_TAXONOMY_BARE: 'lint',
445
+ EXTRACT_TAXONOMY_DUPLICATE_ID: 'lint',
446
+ EXTRACT_TAXONOMY_FIELD_TYPE: 'lint',
447
+ EXTRACT_TAXONOMY_LEGACY: 'lint',
448
+ EXTRACT_TAXONOMY_LIMIT: 'lint',
449
+ EXTRACT_TAXONOMY_NESTING: 'lint',
450
+ EXTRACT_TAXONOMY_REF: 'lint',
451
+ EXTRACT_TAXONOMY_STRUCTURE: 'lint',
442
452
  FAKE_JOIN: 'lint',
443
453
  FILE_NOT_FOUND: 'lowering',
444
454
  FIRE_AND_FORGET_READ: 'lint',