@uipath/maestro-builder-sdk 6.90.1 → 6.90.2

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.
@@ -36,6 +36,8 @@ export interface LookupExhaustedFacts {
36
36
  pages: number;
37
37
  /** True when a cap, not the collection's end, stopped the scan. */
38
38
  capped: boolean;
39
+ /** True when the service reported more records (`HasMore`) but returned no `NextPageToken`. */
40
+ truncated?: boolean;
39
41
  /**
40
42
  * Every distinct value the scan saw at `by`, when the whole collection was
41
43
  * read and holds at most {@link CANDIDATE_LIMIT} records — what to pick from.
@@ -77,6 +79,7 @@ export declare class LookupExhausted extends ResolutionRefusal {
77
79
  readonly scanned: number;
78
80
  readonly pages: number;
79
81
  readonly capped: boolean;
82
+ readonly truncated: boolean;
80
83
  readonly candidates?: readonly string[];
81
84
  readonly near?: string;
82
85
  constructor(message: string, facts: LookupExhaustedFacts);
@@ -207,6 +210,8 @@ export interface ScanOutcome {
207
210
  pages: number;
208
211
  /** True when a cap, not the collection's end, stopped the scan. */
209
212
  capped: boolean;
213
+ /** True when `HasMore` was true but no `NextPageToken` came back, so the scan could not continue. */
214
+ truncated: boolean;
210
215
  }
211
216
  /**
212
217
  * Page through a collection, yielding each page's records and returning where
@@ -216,6 +221,8 @@ export interface ScanOutcome {
216
221
  * / `pageToken` / `nextPageToken` is a documented way to loop forever on page
217
222
  * one. Stops when the reply says there is no more, when it carries no token,
218
223
  * at {@link MAX_SCANNED} records, or after {@link PAGE_GUARD} transitions.
224
+ * A reply with `HasMore` true and no token is a truncated scan, not the end:
225
+ * it stops without looping and says so in {@link ScanOutcome.truncated}.
219
226
  */
220
227
  export declare function scanCollection(client: UipClient, connectorKey: string, collection: string, connectionId: string, query: string | undefined): AsyncGenerator<unknown[], ScanOutcome, void>;
221
228
  /**
@@ -84,6 +84,7 @@ export class LookupExhausted extends ResolutionRefusal {
84
84
  scanned;
85
85
  pages;
86
86
  capped;
87
+ truncated;
87
88
  candidates;
88
89
  near;
89
90
  constructor(message, facts) {
@@ -96,6 +97,7 @@ export class LookupExhausted extends ResolutionRefusal {
96
97
  this.scanned = facts.scanned;
97
98
  this.pages = facts.pages;
98
99
  this.capped = facts.capped;
100
+ this.truncated = facts.truncated === true;
99
101
  if (facts.candidates !== undefined)
100
102
  this.candidates = facts.candidates;
101
103
  if (facts.near !== undefined)
@@ -408,6 +410,10 @@ export function substitute(template, resolved) {
408
410
  export function matchRecord(record, by, value) {
409
411
  return pyStrAny(readPath(record, by)) === value;
410
412
  }
413
+ /** What a scan stopped by {@link ScanOutcome.truncated} says in place of "collection exhausted". */
414
+ function truncatedNote(collection, scanned) {
415
+ return `; TRUNCATED: the service reported more records in ${pyRepr(collection)} but returned no NextPageToken after ${scanned} record(s), so the value may be further in`;
416
+ }
411
417
  /**
412
418
  * Page through a collection, yielding each page's records and returning where
413
419
  * the scan stopped.
@@ -416,10 +422,13 @@ export function matchRecord(record, by, value) {
416
422
  * / `pageToken` / `nextPageToken` is a documented way to loop forever on page
417
423
  * one. Stops when the reply says there is no more, when it carries no token,
418
424
  * at {@link MAX_SCANNED} records, or after {@link PAGE_GUARD} transitions.
425
+ * A reply with `HasMore` true and no token is a truncated scan, not the end:
426
+ * it stops without looping and says so in {@link ScanOutcome.truncated}.
419
427
  */
420
428
  export async function* scanCollection(client, connectorKey, collection, connectionId, query) {
421
429
  let scanned = 0;
422
430
  let pages = 0;
431
+ let truncated = false;
423
432
  for (;;) {
424
433
  const payload = await listPage(client, connectorKey, collection, connectionId, query);
425
434
  const items = envelopeItems(payload);
@@ -427,7 +436,13 @@ export async function* scanCollection(client, connectorKey, collection, connecti
427
436
  yield items;
428
437
  const pagination = envelopePagination(payload);
429
438
  const token = pagination.NextPageToken;
430
- if (!truthy(pagination.HasMore) || !pyTruthy(token) || scanned >= MAX_SCANNED)
439
+ if (!truthy(pagination.HasMore))
440
+ break;
441
+ if (!pyTruthy(token)) {
442
+ truncated = scanned < MAX_SCANNED;
443
+ break;
444
+ }
445
+ if (scanned >= MAX_SCANNED)
431
446
  break;
432
447
  pages += 1;
433
448
  if (pages > PAGE_GUARD)
@@ -436,7 +451,7 @@ export async function* scanCollection(client, connectorKey, collection, connecti
436
451
  // is a documented way to loop forever on page one.
437
452
  query = query ? `${query}&nextPage=${pyStrAny(token)}` : `nextPage=${pyStrAny(token)}`;
438
453
  }
439
- return { scanned, pages, capped: scanned >= MAX_SCANNED || pages > PAGE_GUARD };
454
+ return { scanned, pages, capped: truncated || scanned >= MAX_SCANNED || pages > PAGE_GUARD, truncated };
440
455
  }
441
456
  /**
442
457
  * The connector-facing id for one lookup, or throw {@link ResolutionRefusal}.
@@ -513,7 +528,7 @@ export async function resolveOne(client, connectorKey, spec, field, by, value, c
513
528
  }
514
529
  step = await scan.next();
515
530
  }
516
- const { scanned, pages, capped } = step.value;
531
+ const { scanned, pages, capped, truncated } = step.value;
517
532
  // No exact match anywhere in the collection: try the case-only ones. Exact
518
533
  // first, because an id picked by a looser rule while the exact record sat
519
534
  // on a later page would be the wrong id. Only once the scan has read to the
@@ -562,13 +577,17 @@ export async function resolveOne(client, connectorKey, spec, field, by, value, c
562
577
  const candidates = !capped && !pyTruthy(filterPattern) && scanned <= CANDIDATE_LIMIT && held.length > 0 ? held : undefined;
563
578
  throw new LookupExhausted(`${field}: no record in ${pyRepr(collection)} has ${by}=${pyRepr(value)} ` +
564
579
  `(scanned ${scanned} record(s) across ${pages + 1} page(s)` +
565
- (capped ? `; STOPPED AT THE ${MAX_SCANNED}-record cap, so the value may be further in` : "; collection exhausted") +
580
+ (truncated
581
+ ? truncatedNote(collection, scanned)
582
+ : capped
583
+ ? `; STOPPED AT THE ${MAX_SCANNED}-record cap, so the value may be further in`
584
+ : "; collection exhausted") +
566
585
  `) on connection ${connectionId}.` +
567
586
  (near !== undefined
568
587
  ? ` 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.`
569
588
  : "") +
570
589
  (candidates !== undefined ? ` It holds: ${candidates.map(pyRepr).join(", ")}.` : ""), {
571
- field, collection, by, value, scanned, pages: pages + 1, capped,
590
+ field, collection, by, value, scanned, pages: pages + 1, capped, truncated,
572
591
  ...(candidates !== undefined ? { candidates } : {}),
573
592
  ...(near !== undefined ? { near } : {}),
574
593
  });
@@ -689,10 +708,14 @@ async function resolveInTree(client, connectorKey, spec, field, by, value, conne
689
708
  if (hit === undefined) {
690
709
  const held = level.records.map((record) => pyStrAny(readPath(record, by))).filter((text) => text !== "None");
691
710
  const shown = !level.outcome.capped && held.length > 0 && held.length <= CANDIDATE_LIMIT ? ` It holds: ${held.map(pyRepr).join(", ")}.` : "";
692
- const facts = { field, collection: where, by, value, scanned, pages, capped: level.outcome.capped };
711
+ const facts = { field, collection: where, by, value, scanned, pages, capped: level.outcome.capped, truncated: level.outcome.truncated };
693
712
  throw new LookupExhausted(`${field}: path ${pyRepr(value)} stops at segment ${i + 1}, ${pyRepr(segment)}: no record in ${pyRepr(where)} ` +
694
713
  `has ${by}=${pyRepr(segment)} (walked ${listings} listing(s), ${scanned} record(s)` +
695
- (level.outcome.capped ? `; STOPPED AT THE ${MAX_SCANNED}-record cap` : "; that listing exhausted") +
714
+ (level.outcome.truncated
715
+ ? truncatedNote(where, level.outcome.scanned)
716
+ : level.outcome.capped
717
+ ? `; STOPPED AT THE ${MAX_SCANNED}-record cap`
718
+ : "; that listing exhausted") +
696
719
  `) on connection ${connectionId}.${shown}`, facts);
697
720
  }
698
721
  if (i === segments.length - 1)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.90.1",
3
+ "version": "6.90.2",
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",
@@ -110,5 +110,5 @@
110
110
  "@types/node": "^22.7.0",
111
111
  "esbuild": "^0.28.1"
112
112
  },
113
- "gitref": "e5c5dd2ef362641d4c6540e8d01ccf347e1aa3ef"
113
+ "gitref": "fa145822a2c32fdc05f6c41bddf9d9dc4c0163db"
114
114
  }