@uipath/maestro-builder-sdk 6.118.1 → 6.119.1

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.
@@ -597,8 +597,17 @@ export function candidateResolvesAllLine(label, lookups) {
597
597
  return ` ${label} resolves all ${lookups} lookup(s)`;
598
598
  }
599
599
  /** The terminal report's line for a candidate whose collection was read to the end. */
600
- export function candidateExhaustedLine(label, field, scanned) {
601
- return ` ${label} ${field}: ${scanned} record(s) scanned, no match`;
600
+ export function candidateExhaustedLine(label, field, scanned, absentBy) {
601
+ return absentBy !== undefined
602
+ ? ` ${label} ${field}: ${scanned} record(s) scanned, none carries ${pyRepr(absentBy)}`
603
+ : ` ${label} ${field}: ${scanned} record(s) scanned, no match`;
604
+ }
605
+ /** What to do when no record on any candidate carried the field searched by. */
606
+ function byAbsentRemedy(by, otherBys) {
607
+ return (`No record carries ${pyRepr(by)} on any connection tried, so the value is not what to check: ` +
608
+ (otherBys !== undefined && otherBys.length > 0
609
+ ? `search by ${otherBys.map(pyRepr).join(" or ")} instead. `
610
+ : "no other field of this lookup is searchable, so list what the collection holds to choose a record. "));
602
611
  }
603
612
  /** The terminal report's line for a candidate whose lookup failed for another reason: the error, verbatim. */
604
613
  export function candidateErrorLine(label, error) {
@@ -638,9 +647,12 @@ export function pinnedConnectionExhaustedMessage(first, connectorKey, othersCoun
638
647
  export function candidateListingFailedMessage(first, error) {
639
648
  return `${PREFIX}${first}\n(could not list other connections: ${messageOf(error)})`;
640
649
  }
641
- export function onlyConnectionMessage(first, connectorKey, hint) {
650
+ export function onlyConnectionMessage(first, connectorKey, hint, byAbsent = false) {
642
651
  return (`${PREFIX}${first}\n` +
643
- `This is the only enabled ${connectorKey} connection on the tenant, so the value is what to check.\n` +
652
+ // A `byAbsent` miss already says what to search by instead (`byAbsentNote`).
653
+ (byAbsent
654
+ ? `This is the only enabled ${connectorKey} connection on the tenant.\n`
655
+ : `This is the only enabled ${connectorKey} connection on the tenant, so the value is what to check.\n`) +
644
656
  hint);
645
657
  }
646
658
  /** Two or more candidates resolve everything: reported, never chosen between. */
@@ -656,11 +668,13 @@ export function severalConnectionsResolveMessage(count, connectorKey, listing) {
656
668
  * been tried, so seeing what the collection actually holds is the next step
657
669
  * rather than the detour it is while a retry is still available.
658
670
  */
659
- export function noConnectionResolvesMessage(connectorKey, first, lines, connectionId) {
671
+ export function noConnectionResolvesMessage(connectorKey, first, lines, connectionId, absent) {
660
672
  return (`${PREFIX}no ${connectorKey} connection could resolve ` +
661
673
  `${first.field}: ${first.by}=${pyRepr(first.value)}\n` +
662
674
  `${lines.join("\n")}\n` +
663
- "Every candidate was read to the end, so the value is what to check now. " +
675
+ (absent !== undefined
676
+ ? `Every candidate was read to the end. ${byAbsentRemedy(first.by, absent.otherBys)}`
677
+ : "Every candidate was read to the end, so the value is what to check now. ") +
664
678
  collectionListingHint(connectorKey, first.collection, connectionId));
665
679
  }
666
680
  // ---------------------------------------------------------------------------
@@ -45,6 +45,13 @@ export interface LookupExhaustedFacts {
45
45
  candidates?: readonly string[];
46
46
  /** A value the scan saw that equals the wanted one ignoring case; the match itself is exact. */
47
47
  near?: string;
48
+ /**
49
+ * True when a scan read to the end but NONE of the records carried a value
50
+ * at `by`: no value can match on that field on this connection.
51
+ */
52
+ byAbsent?: boolean;
53
+ /** The other fields this lookup is searchable by, for a `byAbsent` miss. */
54
+ otherBys?: readonly string[];
48
55
  }
49
56
  /**
50
57
  * A collection this small is listed in full when a value is not in it. The
@@ -82,8 +89,12 @@ export declare class LookupExhausted extends ResolutionRefusal {
82
89
  readonly truncated: boolean;
83
90
  readonly candidates?: readonly string[];
84
91
  readonly near?: string;
92
+ readonly byAbsent: boolean;
93
+ readonly otherBys?: readonly string[];
85
94
  constructor(message: string, facts: LookupExhaustedFacts);
86
95
  }
96
+ /** The sentence a `byAbsent` miss adds, with what to search by instead. */
97
+ export declare function byAbsentNote(scanned: number, by: string, otherBys: readonly string[] | undefined): string;
87
98
  /** One `--resolve <field>:<by>=<value>`, parsed. */
88
99
  export type ResolveRequest = readonly [field: string, by: string, value: string];
89
100
  /**
@@ -87,6 +87,8 @@ export class LookupExhausted extends ResolutionRefusal {
87
87
  truncated;
88
88
  candidates;
89
89
  near;
90
+ byAbsent;
91
+ otherBys;
90
92
  constructor(message, facts) {
91
93
  super(message, "RESOLVE_NO_MATCH");
92
94
  this.name = "LookupExhausted";
@@ -102,8 +104,19 @@ export class LookupExhausted extends ResolutionRefusal {
102
104
  this.candidates = facts.candidates;
103
105
  if (facts.near !== undefined)
104
106
  this.near = facts.near;
107
+ this.byAbsent = facts.byAbsent === true;
108
+ if (facts.otherBys !== undefined)
109
+ this.otherBys = facts.otherBys;
105
110
  }
106
111
  }
112
+ /** The sentence a `byAbsent` miss adds, with what to search by instead. */
113
+ export function byAbsentNote(scanned, by, otherBys) {
114
+ return (` None of the ${scanned} record(s) carries a ${pyRepr(by)} value on this connection, so no ${pyRepr(by)} can match here: ` +
115
+ "the connection hides or does not expose that field." +
116
+ (otherBys !== undefined && otherBys.length > 0
117
+ ? ` Search by ${otherBys.map(pyRepr).join(" or ")} instead.`
118
+ : " No other field of this lookup is searchable; list what the collection holds to choose a record."));
119
+ }
107
120
  /**
108
121
  * A tree walk lists one child collection per parent it opens. Google Drive's
109
122
  * picker root holds three records (`My Drive`, `Shared with me`, `Shared
@@ -506,10 +519,15 @@ export async function resolveOne(client, connectorKey, spec, field, by, value, c
506
519
  // Records whose `by` equals the value ignoring case only, first per distinct
507
520
  // spelling: the fallback when no record matches exactly.
508
521
  const caseOnly = new Map();
522
+ // Records with any value at `by`: zero across a non-empty scan means the
523
+ // connection hides the field, not that the value is wrong.
524
+ let carrying = 0;
509
525
  let step = await scan.next();
510
526
  while (!step.done) {
511
527
  for (const record of step.value) {
512
528
  const at = readPath(record, by);
529
+ if (at !== null && at !== undefined && at !== "")
530
+ carrying += 1;
513
531
  if (at !== null && at !== undefined) {
514
532
  const text = pyStrAny(at);
515
533
  if (held.length <= CANDIDATE_LIMIT && !held.includes(text))
@@ -575,6 +593,10 @@ export async function resolveOne(client, connectorKey, spec, field, by, value, c
575
593
  // Eval Test'), and listing that subset as what the collection "holds" would
576
594
  // be false. 693 library operations declare a `filterPattern`.
577
595
  const candidates = !capped && !pyTruthy(filterPattern) && scanned <= CANDIDATE_LIMIT && held.length > 0 ? held : undefined;
596
+ // A filtered or capped scan did not read every record, so an empty `by`
597
+ // among the records it read says nothing about the field.
598
+ const byAbsent = scanned > 0 && carrying === 0 && !capped && !truncated && !pyTruthy(filterPattern);
599
+ const otherBys = byAbsent ? searchableBy.filter((other) => other !== by) : undefined;
578
600
  throw new LookupExhausted(`${field}: no record in ${pyRepr(collection)} has ${by}=${pyRepr(value)} ` +
579
601
  `(scanned ${scanned} record(s) across ${pages + 1} page(s)` +
580
602
  (truncated
@@ -586,10 +608,12 @@ export async function resolveOne(client, connectorKey, spec, field, by, value, c
586
608
  (near !== undefined
587
609
  ? ` Did you mean ${pyRepr(near)}? It differs only in case and was not taken: the scan stopped before the end, where an exact match may still be.`
588
610
  : "") +
589
- (candidates !== undefined ? ` It holds: ${candidates.map(pyRepr).join(", ")}.` : ""), {
611
+ (candidates !== undefined ? ` It holds: ${candidates.map(pyRepr).join(", ")}.` : "") +
612
+ (byAbsent ? byAbsentNote(scanned, by, otherBys) : ""), {
590
613
  field, collection, by, value, scanned, pages: pages + 1, capped, truncated,
591
614
  ...(candidates !== undefined ? { candidates } : {}),
592
615
  ...(near !== undefined ? { near } : {}),
616
+ ...(byAbsent ? { byAbsent, otherBys } : {}),
593
617
  });
594
618
  }
595
619
  /**
@@ -76,11 +76,14 @@ export async function retryOtherConnections(ctx, plan, first) {
76
76
  }
77
77
  const others = candidates.filter((row) => !sameId(row));
78
78
  if (others.length === 0) {
79
- throw new PrepareRefusal(onlyConnectionMessage(first.message, ctx.connectorKey, collectionListingHint(ctx.connectorKey, first.collection, ctx.connectionId)), "LOOKUP_EXHAUSTED_ONLY_CONNECTION");
79
+ throw new PrepareRefusal(onlyConnectionMessage(first.message, ctx.connectorKey, collectionListingHint(ctx.connectorKey, first.collection, ctx.connectionId), first.byAbsent), "LOOKUP_EXHAUSTED_ONLY_CONNECTION");
80
80
  }
81
81
  ctx.reporter.info(tryingOtherConnectionsLine(first.field, others.length, ctx.connectorKey));
82
82
  const winners = [];
83
83
  const report = [];
84
+ // Whether every candidate hid the field `first` searched by: then the value
85
+ // is not what to check, the `by` is.
86
+ let everyAbsent = first.byAbsent;
84
87
  for (const row of others) {
85
88
  const outcome = await probeCandidate(ctx.client, ctx.connectorKey, plan, pyStrAny(pyGet(row, "Id", null)));
86
89
  const label = candidateLabel(row);
@@ -89,9 +92,13 @@ export async function retryOtherConnections(ctx, plan, first) {
89
92
  report.push(candidateResolvesAllLine(label, plan.ordered.length));
90
93
  }
91
94
  else if (outcome.kind === "exhausted") {
92
- report.push(candidateExhaustedLine(label, outcome.error.field, outcome.error.scanned));
95
+ const miss = outcome.error;
96
+ if (!(miss.byAbsent && miss.field === first.field))
97
+ everyAbsent = false;
98
+ report.push(candidateExhaustedLine(label, miss.field, miss.scanned, miss.byAbsent ? miss.by : undefined));
93
99
  }
94
100
  else {
101
+ everyAbsent = false;
95
102
  report.push(candidateErrorLine(label, outcome.error));
96
103
  }
97
104
  }
@@ -104,6 +111,9 @@ export async function retryOtherConnections(ctx, plan, first) {
104
111
  // one connection first, so the reader can see the value really is absent
105
112
  // rather than guess which connection was asked.
106
113
  const original = candidates.find(sameId) ?? { Name: ctx.connectionId, Folder: "?" };
107
- const lines = [candidateExhaustedLine(candidateLabel(original), first.field, first.scanned), ...report];
108
- throw new PrepareRefusal(noConnectionResolvesMessage(ctx.connectorKey, first, lines, ctx.connectionId), "LOOKUP_EXHAUSTED_EVERYWHERE");
114
+ const lines = [
115
+ candidateExhaustedLine(candidateLabel(original), first.field, first.scanned, first.byAbsent ? first.by : undefined),
116
+ ...report,
117
+ ];
118
+ throw new PrepareRefusal(noConnectionResolvesMessage(ctx.connectorKey, first, lines, ctx.connectionId, everyAbsent ? (first.otherBys !== undefined ? { otherBys: first.otherBys } : {}) : undefined), "LOOKUP_EXHAUSTED_EVERYWHERE");
109
119
  }
@@ -63,6 +63,23 @@ export interface CollectedRefusal {
63
63
  }
64
64
  export interface SerializeOpts {
65
65
  library?: Library;
66
+ /**
67
+ * The `.flow` this compile overwrites, parsed (`compile-cli` reads the output
68
+ * file before writing it). A type can read the node it had there through
69
+ * {@link FlowSerializeContext.overwrittenNode}: Extract document keeps the
70
+ * taxonomy ids that file has for entries the source names none for (#1985).
71
+ */
72
+ overwrites?: unknown;
73
+ /**
74
+ * Informational lines a type reports about what it wrote (`compile: <message>`),
75
+ * with the data behind them for `--json`. For instance Extract document's
76
+ * kept-vs-minted taxonomy id counts.
77
+ */
78
+ note?: (note: {
79
+ step: string;
80
+ message: string;
81
+ data?: unknown;
82
+ }) => void;
66
83
  /** The project's bindings.json (`Bindings`), or any view that answers the label rules. */
67
84
  bindings?: BindingsView;
68
85
  /**
package/dist/serialize.js CHANGED
@@ -196,6 +196,21 @@ export { CONNECTOR_INPUT_MISSING } from './core/connector-inputs.js';
196
196
  */
197
197
  const DRAFT_CODES_AGREE = true;
198
198
  void DRAFT_CODES_AGREE;
199
+ /** The node of `flow` emitted under `id`, when it is of type `typeName` (top level or a subflow). */
200
+ function overwrittenNodeOf(flow, id, typeName) {
201
+ if (flow === null || typeof flow !== 'object')
202
+ return undefined;
203
+ const f = flow;
204
+ const lists = [f.nodes, ...(f.subflows !== null && typeof f.subflows === 'object' ? Object.values(f.subflows).map((s) => s?.nodes) : [])];
205
+ for (const list of lists) {
206
+ if (!Array.isArray(list))
207
+ continue;
208
+ const node = list.find((n) => n !== null && typeof n === 'object' && n.id === id);
209
+ if (node !== undefined)
210
+ return node.type === typeName ? node : undefined;
211
+ }
212
+ return undefined;
213
+ }
199
214
  /**
200
215
  * `serialize`, plus the extra files the flow needs on disk beside it.
201
216
  *
@@ -2351,6 +2366,8 @@ function serializeFlow(built, opts) {
2351
2366
  ? resolved.carried
2352
2367
  : bundledDefinition(typeName, v) ?? carriedFor(typeName, v)),
2353
2368
  bindings: resourceBindings,
2369
+ overwrittenNode: () => overwrittenNodeOf(opts.overwrites, id, impl.typeName),
2370
+ note: (message, data) => opts.note?.({ step: step.name, message, ...(data !== undefined ? { data } : {}) }),
2354
2371
  resolveBinding: ((name, attribute, at, target) => resolveBinding(bindingOpts, name, attribute, at, target)),
2355
2372
  resolveBindingPair: (labels, at, target) => resolveBindingPair(bindingOpts, labels, at, target),
2356
2373
  bindConnection: (c) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.118.1",
3
+ "version": "6.119.1",
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",
@@ -124,5 +124,5 @@
124
124
  "@types/node": "^22.7.0",
125
125
  "esbuild": "^0.28.1"
126
126
  },
127
- "gitref": "0c0b4c5db91985dd7604ca295f9b32825d7a28bd"
127
+ "gitref": "8f3e2c3b9e24fc452b419bc3493a24444544dfb5"
128
128
  }