@uipath/maestro-builder-sdk 6.103.0 → 6.104.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
@@ -41,7 +41,7 @@ could hand you spans for a version you do not have.
41
41
 
42
42
  ## `@uipath/maestro-builder-sdk`
43
43
 
44
- 263 symbol(s). Import from `@uipath/maestro-builder-sdk`.
44
+ 265 symbol(s). Import from `@uipath/maestro-builder-sdk`.
45
45
 
46
46
  | Symbol | Kind | Declaration | Area | Summary |
47
47
  | --- | --- | --- | --- | --- |
@@ -207,10 +207,10 @@ could hand you spans for a version you do not have.
207
207
  | `lookup` | function | `dist/core/lookups.d.ts:143-164` | Generated descriptors | Begin resolving a `where` parameter on a connector-EVENT descriptor. |
208
208
  | `LookupBuilder` | type | `dist/core/lookups.d.ts:64-71` | Generated descriptors | What `lookup(...)` returns: the generic form plus any generated aliases. |
209
209
  | `lookupKey` | function | `dist/core/lookups.d.ts:55-63` | Generated descriptors | The identity of one resolution, as `prepare` records it and `compile` reads it. |
210
- | `LookupResolution` | interface | `dist/core/lookups.d.ts:165-174` | Generated descriptors | One recorded resolution, as `connectors-local/resolutions.json` stores it. |
211
- | `LookupResolutions` | type | `dist/core/lookups.d.ts:175-176` | Generated descriptors | Every recorded resolution, keyed by lookupKey. |
210
+ | `LookupResolution` | interface | `dist/core/lookups.d.ts:165-182` | Generated descriptors | One recorded resolution, as `connectors-local/resolutions.json` stores it. |
211
+ | `LookupResolutions` | type | `dist/core/lookups.d.ts:183-184` | Generated descriptors | Every recorded resolution, keyed by lookupKey. |
212
212
  | `LookupSpec` | interface | `dist/core/lookups.d.ts:11-36` | Generated descriptors | One lookup field's retrieval contract, generated from `reference`. |
213
- | `lookupSpecOf` | function | `dist/core/lookups.d.ts:234-241` | Generated descriptors | The LookupSpec for one field, or `undefined` when it earns no helper. |
213
+ | `lookupSpecOf` | function | `dist/core/lookups.d.ts:260-267` | Generated descriptors | The LookupSpec for one field, or `undefined` when it earns no helper. |
214
214
  | `LookupStrategy` | type | `dist/core/lookups.d.ts:1-10` | Generated descriptors | How `prepare` should retrieve the collection, chosen from the metadata. |
215
215
  | `LookupToken` | interface | `dist/core/lookups.d.ts:37-52` | Generated descriptors | An unresolved lookup: what `.byEmail(…)` returns. |
216
216
  | `LoopOptions` | interface | `dist/flow-sdk.d.ts:411-435` | Option shapes | Loop-specific options. |
@@ -240,11 +240,13 @@ could hand you spans for a version you do not have.
240
240
  | `QueuePriority` | type | `dist/nodes/queue/flow/spec.d.ts:9-10` | Supporting types | The three priorities an Orchestrator queue item can carry. |
241
241
  | `ran` | function | `dist/core/expr.d.ts:95-141` | Expressions and types | Did this step run? |
242
242
  | `rawNode` | function | `dist/raw-node.d.ts:9-89` | Supporting types | Place a node this SDK has no factory for, carrying its definition verbatim (`uipath.exotic.thing@2.1` and the manifest… |
243
- | `RawReference` | type | `dist/core/lookups.d.ts:225-233` | Supporting types | |
243
+ | `RawReference` | type | `dist/core/lookups.d.ts:251-259` | Supporting types | |
244
+ | `recordedEventResolution` | function | `dist/core/lookups.d.ts:219-227` | Generated descriptors | The recorded row for a token on an event's `where`, under either key resolvedEventValue tries, or `undefined`. |
245
+ | `recordedResolution` | function | `dist/core/lookups.d.ts:193-201` | Generated descriptors | The recorded row for a token, or `undefined` — resolvedValue with the rest of the row (the connection it was resolved… |
244
246
  | `RemoteA2aToolRef` | interface | `dist/core/actions.d.ts:488-508` | Supporting types | A remote A2A (agent-to-agent) endpoint the agent may delegate to. |
245
- | `resolvedEventValue` | function | `dist/core/lookups.d.ts:185-201` | Generated descriptors | resolvedValue for a token on an event's `where`. |
246
- | `resolvedValue` | function | `dist/core/lookups.d.ts:177-184` | Generated descriptors | The recorded id for a token, or `undefined`. |
247
- | `resolveEventWhere` | function | `dist/core/lookups.d.ts:242-259` | Generated descriptors | An event subscription's `where` with every lookup token swapped for the id `registry prepare --resolve` recorded, or a… |
247
+ | `resolvedEventValue` | function | `dist/core/lookups.d.ts:202-218` | Generated descriptors | resolvedValue for a token on an event's `where`. |
248
+ | `resolvedValue` | function | `dist/core/lookups.d.ts:185-192` | Generated descriptors | The recorded id for a token, or `undefined`. |
249
+ | `resolveEventWhere` | function | `dist/core/lookups.d.ts:268-285` | Generated descriptors | An event subscription's `where` with every lookup token swapped for the id `registry prepare --resolve` recorded, or a… |
248
250
  | `ResourceRef` | interface | `dist/core/resource-resolution.d.ts:4-18` | Supporting types | A solution resource by kind and name, and — for one in an Orchestrator folder — that folder's PATH (`Shared`,… |
249
251
  | `ResourceToken` | interface | `dist/core/resource-resolution.d.ts:166-176` | Supporting types | A solution resource as a connector input: what `resource()` and `entity()` return. |
250
252
  | `ReturnFieldType` | type | `dist/core/actions.d.ts:285-302` | Supporting types | A JSON-schema-ish type for one field of a step's declared `returns`. |
@@ -295,8 +297,8 @@ could hand you spans for a version you do not have.
295
297
  | `TriggerSpec` | type | `dist/nodes/trigger/flow/spec.d.ts:81-100` | Supporting types | What starts the flow. |
296
298
  | `TypeDesc` | type | `dist/core/expr.d.ts:404` | Supporting types | |
297
299
  | `types` | const | `dist/core/expr.d.ts:388-403` | Expressions and types | Variable type descriptors (map to Flow variable `type` values). |
298
- | `unresolvedLookupMessage` | function | `dist/core/lookups.d.ts:202-211` | Generated descriptors | The message for a lookup nothing has resolved — the command that fixes it. |
299
- | `unresolvedLookupsMessage` | function | `dist/core/lookups.d.ts:212-224` | Generated descriptors | The message for every lookup one node still owes, with the ONE `prepare` that records them all (it takes every… |
300
+ | `unresolvedLookupMessage` | function | `dist/core/lookups.d.ts:228-237` | Generated descriptors | The message for a lookup nothing has resolved — the command that fixes it. |
301
+ | `unresolvedLookupsMessage` | function | `dist/core/lookups.d.ts:238-250` | Generated descriptors | The message for every lookup one node still owes, with the ONE `prepare` that records them all (it takes every… |
300
302
  | `v` | function | `dist/core/expr.d.ts:29-41` | Expressions and types | Reference a flow variable or output by name → `$vars.<name>`. |
301
303
  | `VarDecl` | interface | `dist/flow-sdk.d.ts:67-79` | Supporting types | 7 field(s) |
302
304
  | `VarSpec` | interface | `dist/flow-sdk.d.ts:80-135` | Supporting types | The rich spelling of a variable declaration: pass it instead of a bare `types.*` descriptor wherever `.input()` /… |
@@ -5,12 +5,12 @@
5
5
 
6
6
  # Maestro Builder SDK — member index
7
7
 
8
- **A lookup table of 1343 rows — match one name in it, do not read it.**
8
+ **A lookup table of 1344 rows — match one name in it, do not read it.**
9
9
  Grep or search for the member you have; the row it lands on is the whole
10
10
  answer. Reading top to bottom costs ~20x what the one row does and tells you
11
11
  nothing you asked for.
12
12
 
13
- Every field and method of every exported shape — 1343 across
13
+ Every field and method of every exported shape — 1344 across
14
14
  249 interfaces and classes — keyed by the MEMBER's own name.
15
15
 
16
16
  **Use this when the name you have is a field or a method**, which is usually
@@ -32,7 +32,7 @@ truncated summary would, for less. Read the span.
32
32
  Member names repeat across shapes (`name` is declared on 69 of them), so the
33
33
  `Declared on` column is what makes a match actionable. For the whole shape
34
34
  rather than the one field, look that name up in [`api-index.md`](api-index.md) —
35
- which is why its span is not repeated on all 1343 rows here.
35
+ which is why its span is not repeated on all 1344 rows here.
36
36
 
37
37
  **A name that misses both indexes is probably not part of the API.** The one
38
38
  that comes up is a RUNTIME output key — a human task's `Action`, a step's
@@ -178,6 +178,7 @@ not find it either.
178
178
  | `connection` | property | `HttpOpts` | `dist/bpmn/bpmn-sdk.d.ts:1332-1360` |
179
179
  | `connection` | property | `HttpRequestConnector` | `dist/case/case-sdk.d.ts:615-616` |
180
180
  | `connection` | property | `TriggerOptions` | `dist/core/actions.d.ts:1151-1155` |
181
+ | `connectionId` | property | `LookupResolution` | `dist/core/lookups.d.ts:174-181` |
181
182
  | `connections` | property | `HitlRecipient` | `dist/nodes/hitl/flow/spec.d.ts:70-74` |
182
183
  | `connector` | property | `BuiltTask` | `dist/case/case-sdk.d.ts:1001` |
183
184
  | `connector` | property | `CaseHttpRequestSpec` | `dist/case/case-sdk.d.ts:605-609` |
@@ -26,6 +26,7 @@ import { bindingRequiredFields, CASE_RUNTIME_INTERNAL_TYPES, CONNECTOR_ACTIVITY_
26
26
  import { ownEntry } from '../core/own-entry.js';
27
27
  import { MANAGED_HTTP_TYPE, isManagedHttpV2, managedHttpAbsoluteUrl, managedHttpMissing } from './managed-http.js';
28
28
  import { connectorV2Missing, isConnectorV2 } from './connector.js';
29
+ import { lookupConnectionIndex } from '../core/lookup-connection.js';
29
30
  /**
30
31
  * The node row a diagnostic is about, where two rules can report one row: the
31
32
  * authored-task rules (`checkIntsvcActivities`, EMPTY_REQUIRED_FIELD) and the
@@ -120,6 +121,9 @@ export function check(built, opts = {}) {
120
121
  }
121
122
  /** {@link check}, saying whether the serializer pass stopped early, for `check --baseline` (check-baseline.ts). */
122
123
  export function checkModel(built, opts = {}) {
124
+ // Which steps share a recorded lookup row across connections (LOOKUP_CONNECTION_MISMATCH), file-wide.
125
+ if (opts.resolutions && !opts.lookupConnections)
126
+ opts = { ...opts, lookupConnections: lookupConnectionIndex(built, opts.resolutions, opts.bindings) };
123
127
  const diags = [];
124
128
  // Duplicate and missing ids (`documentIdProblems`) are the serializer's.
125
129
  checkScope(built.nodes, built.flows, 'process', diags, true);
@@ -40,7 +40,7 @@ export interface Diagnostic {
40
40
  * Every hook fails open: without a library, `check` judges a connector task up
41
41
  * to the library, as `compile` would.
42
42
  */
43
- export type CaseCheckOpts = Pick<ConnectorCheckOpts, 'lookups' | 'resolutions' | 'resources' | 'schemaReadiness' | 'bindings'> & {
43
+ export type CaseCheckOpts = Pick<ConnectorCheckOpts, 'lookups' | 'resolutions' | 'resources' | 'schemaReadiness' | 'bindings' | 'lookupConnections'> & {
44
44
  /** The library `compile` serializes against, for the serializer `check` runs. */
45
45
  library?: Library;
46
46
  };
@@ -13,6 +13,7 @@ import { checkRuleSemantics } from './check-rule-semantics.js';
13
13
  import { serialize } from './serialize.js';
14
14
  import { lintPlanFindings, planReport } from './plan-check/index.js';
15
15
  import { caseExprLints } from './case-expr-check.js';
16
+ import { lookupConnectionIndex } from '../core/lookup-connection.js';
16
17
  const TYPE_NAMES = new Set(Object.values(types));
17
18
  // audit-case-coverage: rule-slot table start
18
19
  // This runtime table must equal the committed matrix's rejected cells. The audit
@@ -27,6 +28,9 @@ const ILLEGAL = [];
27
28
  * @returns Every diagnostic found. An `error` fails `check`; only a `lowering` error stops `compile`.
28
29
  */
29
30
  export function check(built, opts = {}) {
31
+ // Which steps share a recorded lookup row across connections (LOOKUP_CONNECTION_MISMATCH), file-wide.
32
+ if (opts.resolutions && !opts.lookupConnections)
33
+ opts = { ...opts, lookupConnections: lookupConnectionIndex(built, opts.resolutions, opts.bindings) };
30
34
  const diags = [];
31
35
  if (!built.id)
32
36
  diags.push({ level: 'error', code: 'NO_ID', message: 'casePlan() requires an id.' });
package/dist/check.js CHANGED
@@ -26,6 +26,7 @@ import { loopParallelWarning, resolveLoopDefinition, loopVersion } from './loop-
26
26
  import { refusalClass } from './core/refusals.js';
27
27
  import { classifyDrafts, placeDiagnostics } from './edit-scope.js';
28
28
  import { preExistingFindings, scopeFindings } from './core/baseline-scope.js';
29
+ import { lookupConnectionIndex } from './core/lookup-connection.js';
29
30
  export function check(built, opts = {}) {
30
31
  return checkCompiled(built, opts).diagnostics;
31
32
  }
@@ -36,6 +37,9 @@ export function check(built, opts = {}) {
36
37
  * code's `class`.
37
38
  */
38
39
  export function checkCompiled(built, opts = {}) {
40
+ // Which steps share a recorded lookup row across connections (LOOKUP_CONNECTION_MISMATCH), file-wide.
41
+ if (opts.resolutions && !opts.lookupConnections)
42
+ opts = { ...opts, lookupConnections: lookupConnectionIndex(built, opts.resolutions, opts.bindings) };
39
43
  // A connection two connectors use, and an agent resource's `nodeId` another
40
44
  // node of the file has, are the serializer's CONNECTION_CONNECTOR_CONFLICT /
41
45
  // FLOW_AGENT_RESOURCE_NODE_ID: it claims ids and resolves connections file-wide.
@@ -25,6 +25,7 @@
25
25
  import { type LookupResolutions, type LookupSpec } from './lookups.js';
26
26
  import type { SchemaReadiness } from './library.js';
27
27
  import { CompileRefusal } from './compile-refusal.js';
28
+ import { type LookupConnectionIndex } from './lookup-connection.js';
28
29
  import { type ResourceResolutions } from './resource-resolution.js';
29
30
  import { type BindingsView, type PrepareTarget } from './binding-messages.js';
30
31
  /** One connector activity, as every family already models it. */
@@ -152,6 +153,12 @@ export interface ConnectorCheckOpts {
152
153
  }, inputs: Record<string, unknown>) => string | undefined;
153
154
  /** The project's `bindings.json`, for the label rules. */
154
155
  bindings?: BindingsView;
156
+ /**
157
+ * Which bound connections use each recorded lookup row, file-wide
158
+ * (`lookupConnectionIndex`), so LOOKUP_CONNECTION_MISMATCH can tell a row two
159
+ * steps share across connections from one `prepare` can fix.
160
+ */
161
+ lookupConnections?: LookupConnectionIndex;
155
162
  }
156
163
  /**
157
164
  * The `resource()` / `entity()` inputs.
@@ -22,12 +22,13 @@
22
22
  * over `vars`. Without this a BPMN `'=vars.channelId'` would read as a pasted
23
23
  * literal id and warn about itself.
24
24
  */
25
- import { isLookupToken, resolvedValue, } from './lookups.js';
25
+ import { isLookupToken, recordedResolution, } from './lookups.js';
26
26
  import { Expr } from './expr.js';
27
27
  import { isRecord } from './node-envelope.js';
28
28
  import { extractRefs } from './expr-check.js';
29
29
  import { prepareCommand, resolveFlagArg } from './cli-spelling.js';
30
30
  import { CompileRefusal } from './compile-refusal.js';
31
+ import { LOOKUP_CONNECTION_MISMATCH, lookupConnectionMismatch } from './lookup-connection.js';
31
32
  import { isResourceToken, resolveRecordedResource } from './resource-resolution.js';
32
33
  import { bindingLabelRefusal, bindingMissingMessage, missingBindingLabels, } from './binding-messages.js';
33
34
  /**
@@ -187,6 +188,9 @@ unresolvedWarning = true) {
187
188
  // `integration_service_boundary` eval card went from 70 turns to 86 and from
188
189
  // 0/3 to 3/3 `max_turns_exhausted` when BPMN started reporting them at all.
189
190
  const unresolved = [];
191
+ // Recorded lookups, for LOOKUP_CONNECTION_MISMATCH: each row names the
192
+ // connection it was resolved on, and the step names the one it runs on.
193
+ const resolved = [];
190
194
  const literals = [];
191
195
  const visit = (value, path) => {
192
196
  if (isLookupToken(value)) {
@@ -213,8 +217,11 @@ unresolvedWarning = true) {
213
217
  });
214
218
  return;
215
219
  }
216
- if (resolvedValue(value, resolutions) === undefined)
220
+ const row = recordedResolution(value, resolutions);
221
+ if (row?.value === undefined)
217
222
  unresolved.push(value);
223
+ else
224
+ resolved.push({ token: value, row, name: named });
218
225
  return;
219
226
  }
220
227
  const reading = dialect.classify(value);
@@ -263,6 +270,9 @@ unresolvedWarning = true) {
263
270
  visit(value, [name]);
264
271
  if (unresolved.length && unresolvedWarning)
265
272
  report(unresolvedDiagnostic(where, spec, unresolved));
273
+ const mismatch = lookupConnectionMismatch(where, resolved, spec.connection, opts.bindings, { key: spec.key, action: spec.action }, opts.lookupConnections);
274
+ if (mismatch)
275
+ report({ level: 'error', code: LOOKUP_CONNECTION_MISMATCH, message: mismatch });
266
276
  if (literals.length)
267
277
  report(literalIdDiagnostic(where, spec, literals, dialect.descriptors));
268
278
  }
@@ -19,6 +19,7 @@
19
19
  * question, and in run 12 on having nowhere to put a payload condition.
20
20
  */
21
21
  import { type LookupResolutions } from './lookups.js';
22
+ import { type LookupConnectionIndex } from './lookup-connection.js';
22
23
  import { type ByoaEventFacts, type ByoaLedger } from './byoa.js';
23
24
  import type { BindingsView } from './binding-messages.js';
24
25
  /** A code/message sink, as each family's check supplies one. */
@@ -95,6 +96,8 @@ export interface EventCheckOpts {
95
96
  resolutions?: LookupResolutions;
96
97
  /** The project's `bindings.json`, for the BYOA connection check. */
97
98
  bindings?: BindingsView;
99
+ /** Which bound connections use each recorded lookup row, file-wide (`lookupConnectionIndex`). */
100
+ lookupConnections?: LookupConnectionIndex;
98
101
  }
99
102
  /**
100
103
  * Ask the library what event parameters a subscription's operation declares.
@@ -18,7 +18,8 @@
18
18
  * `skill-bpmn-outlook-waitfor-email` in `flow-v2-run-8` failed on exactly that last
19
19
  * question, and in run 12 on having nowhere to put a payload condition.
20
20
  */
21
- import { isLookupToken, resolvedEventValue, unresolvedLookupMessage, } from './lookups.js';
21
+ import { isLookupToken, recordedEventResolution, unresolvedLookupMessage, } from './lookups.js';
22
+ import { LOOKUP_CONNECTION_MISMATCH, lookupConnectionMismatch } from './lookup-connection.js';
22
23
  import { prepareCommand } from './cli-spelling.js';
23
24
  import { EVENT_FILTER_OPERATORS, eventFiltersNotArray, readEventFilter, eventFilterExpressionRefusal, eventFilterProblem, jmesStringProblem } from './event-filters.js';
24
25
  import { EVENT_BYOA_UNVERIFIED, byoaUnverified } from './byoa.js';
@@ -134,14 +135,27 @@ compileRefusals = true) {
134
135
  const resolutions = opts.resolutions ?? {};
135
136
  const scope = sub.where && typeof sub.where === 'object'
136
137
  ? Object.entries(sub.where) : [];
137
- for (const [key, value] of compileRefusals ? scope : []) {
138
+ // Recorded `where` lookups, for LOOKUP_CONNECTION_MISMATCH. Reported whatever
139
+ // `compileRefusals` says: compile writes a mismatched id without a word.
140
+ const recorded = [];
141
+ for (const [key, value] of scope) {
138
142
  if (!isLookupToken(value))
139
143
  continue;
140
- if (resolvedEventValue(value, resolutions) !== undefined)
144
+ const row = recordedEventResolution(value, resolutions);
145
+ if (row?.value !== undefined) {
146
+ recorded.push({ token: value, row, name: `where.${key}` });
147
+ continue;
148
+ }
149
+ if (!compileRefusals)
141
150
  continue;
142
151
  warn('LOOKUP_UNRESOLVED', `${where}: \`where.${key}\` ` + unresolvedLookupMessage(value)
143
152
  + `\nCompile will fail until this is recorded.`);
144
153
  }
154
+ const mismatch = lookupConnectionMismatch(where, recorded, sub.connection, opts.bindings, {
155
+ key: connectorKey, action: eventName, ...(object ? { extra: ['--object', object] } : {}),
156
+ }, opts.lookupConnections);
157
+ if (mismatch)
158
+ error(LOOKUP_CONNECTION_MISMATCH, mismatch);
145
159
  const names = opts.eventFilterFields?.(sub.connector, sub.event, object);
146
160
  if (names && names.length > 0 && Array.isArray(sub.filters)) {
147
161
  const known = new Set(names);
@@ -0,0 +1,90 @@
1
+ /**
2
+ * core/lookup-connection — a recorded lookup id used on a different connection
3
+ * than the one it was resolved on (#1982).
4
+ *
5
+ * A lookup id belongs to one connection. Slack user `U123` exists on the
6
+ * workspace it was looked up in and nowhere else; a Jira issue-type id is valid
7
+ * in one site. `prepare --resolve` records the connection each id came from
8
+ * (`connectionId` on the row in `connectors-local/resolutions.json`), and this
9
+ * module compares it with the connection the step is bound to. Before the
10
+ * field existed, an id resolved on connection A and bound to connection B
11
+ * compiled cleanly and failed at run time, and the skill told the agent to
12
+ * compare the two by hand.
13
+ *
14
+ * `lint`, not `lowering`: the serializer writes exactly the id that was
15
+ * recorded, and some lookups are the same on every connection (Slack's
16
+ * `send_as` sends the word `bot`), so the id is probably wrong, not certainly.
17
+ * The remedy is cheap either way: resolve again on the bound connection.
18
+ *
19
+ * One row cannot serve two connections yet (#2042): rows are keyed
20
+ * `[nodeType, field, by, value]`, not by connection. When two steps use the
21
+ * same row on two different bound connections, re-running `prepare` on one
22
+ * only moves the error to the other, so the message says so and prints no
23
+ * command ({@link lookupConnectionIndex}).
24
+ *
25
+ * Silent when there is nothing to compare: a row without `connectionId` (an
26
+ * older ledger), or a step whose connection does not resolve to a real id (no
27
+ * bindings.json, an undeclared label, a placeholder GUID). The binding rules
28
+ * already report the last two.
29
+ *
30
+ * No `node:` imports: `check` imports this module (FB015).
31
+ */
32
+ import { type BindingsView } from './binding-messages.js';
33
+ import { type LookupResolution, type LookupResolutions, type LookupToken } from './lookups.js';
34
+ /** The diagnostic code. */
35
+ export declare const LOOKUP_CONNECTION_MISMATCH = "LOOKUP_CONNECTION_MISMATCH";
36
+ /** One resolved lookup on a step: the token, the row it resolved to, and how the message names the field. */
37
+ export interface ResolvedLookupUse {
38
+ token: LookupToken;
39
+ row: LookupResolution;
40
+ /** The field as the author wrote it, e.g. `channel` or `where.parentFolderId`. */
41
+ name: string;
42
+ }
43
+ /**
44
+ * The connection id a step is bound to, or `undefined` when it does not
45
+ * resolve to a real one. Same reading as `byoaUnverified`: the label through
46
+ * bindings.json, else the label itself when it is already an id.
47
+ */
48
+ export declare function boundConnectionId(connection: unknown, bindings: Pick<BindingsView, 'resolve'> | undefined): string | undefined;
49
+ /**
50
+ * Which bound connections use each recorded row, across a whole built flow,
51
+ * case or process. Keyed by the row object itself (the ledger's own entry), so
52
+ * an event token found under the event-form key and an activity token under
53
+ * its own key land on the same row when they share one.
54
+ */
55
+ export type LookupConnectionIndex = ReadonlyMap<LookupResolution, ReadonlySet<string>>;
56
+ /**
57
+ * Build the {@link LookupConnectionIndex} for one built artifact.
58
+ *
59
+ * Family-agnostic, like the rules it feeds: it walks the built object and
60
+ * reads every object that carries a string `connection` beside `inputs` (a
61
+ * connector activity) or `where` (an event subscription) — the same
62
+ * `{ inputs, connection }` and `{ where, connection }` shapes
63
+ * `checkConnectorLookups` and `checkEventResolution` read. Connections are
64
+ * read through bindings.json as {@link boundConnectionId} reads them, and
65
+ * stored lower-cased.
66
+ *
67
+ * @param root - The built flow, case or process.
68
+ * @param resolutions - Everything `prepare --resolve` has recorded.
69
+ * @param bindings - Resolves a `connection:` label to an id.
70
+ */
71
+ export declare function lookupConnectionIndex(root: unknown, resolutions: LookupResolutions | undefined, bindings: Pick<BindingsView, 'resolve'> | undefined): LookupConnectionIndex;
72
+ /**
73
+ * The LOOKUP_CONNECTION_MISMATCH message for one step, or `undefined` when no
74
+ * recorded lookup on it came from another connection. One message per step,
75
+ * like LOOKUP_UNRESOLVED: the remedy is one `prepare` with every `--resolve`.
76
+ * A row another step uses on a different connection gets no command (see the
77
+ * module header): one row cannot serve two connections yet.
78
+ *
79
+ * @param where - How the message opens (`Connector step "post"`, `trigger`).
80
+ * @param uses - Every resolved lookup on the step.
81
+ * @param connection - The step's `connection:` as authored.
82
+ * @param bindings - Resolves the label to an id.
83
+ * @param command - The `<key> <action-or-event>` the prepare command takes, plus any extra flags (`--object x`).
84
+ * @param index - Which bound connections use each row, file-wide; without it every row reads as used by this step alone.
85
+ */
86
+ export declare function lookupConnectionMismatch(where: string, uses: readonly ResolvedLookupUse[], connection: unknown, bindings: Pick<BindingsView, 'resolve'> | undefined, command: {
87
+ key: string;
88
+ action: string;
89
+ extra?: readonly string[];
90
+ }, index?: LookupConnectionIndex): string | undefined;
@@ -0,0 +1,165 @@
1
+ /**
2
+ * core/lookup-connection — a recorded lookup id used on a different connection
3
+ * than the one it was resolved on (#1982).
4
+ *
5
+ * A lookup id belongs to one connection. Slack user `U123` exists on the
6
+ * workspace it was looked up in and nowhere else; a Jira issue-type id is valid
7
+ * in one site. `prepare --resolve` records the connection each id came from
8
+ * (`connectionId` on the row in `connectors-local/resolutions.json`), and this
9
+ * module compares it with the connection the step is bound to. Before the
10
+ * field existed, an id resolved on connection A and bound to connection B
11
+ * compiled cleanly and failed at run time, and the skill told the agent to
12
+ * compare the two by hand.
13
+ *
14
+ * `lint`, not `lowering`: the serializer writes exactly the id that was
15
+ * recorded, and some lookups are the same on every connection (Slack's
16
+ * `send_as` sends the word `bot`), so the id is probably wrong, not certainly.
17
+ * The remedy is cheap either way: resolve again on the bound connection.
18
+ *
19
+ * One row cannot serve two connections yet (#2042): rows are keyed
20
+ * `[nodeType, field, by, value]`, not by connection. When two steps use the
21
+ * same row on two different bound connections, re-running `prepare` on one
22
+ * only moves the error to the other, so the message says so and prints no
23
+ * command ({@link lookupConnectionIndex}).
24
+ *
25
+ * Silent when there is nothing to compare: a row without `connectionId` (an
26
+ * older ledger), or a step whose connection does not resolve to a real id (no
27
+ * bindings.json, an undeclared label, a placeholder GUID). The binding rules
28
+ * already report the last two.
29
+ *
30
+ * No `node:` imports: `check` imports this module (FB015).
31
+ */
32
+ import { GUID_RE, STUB_GUID_RE } from './binding-messages.js';
33
+ import { prepareCommand, resolveFlagArg } from './cli-spelling.js';
34
+ import { isLookupToken, recordedEventResolution, recordedResolution, } from './lookups.js';
35
+ /** The diagnostic code. */
36
+ export const LOOKUP_CONNECTION_MISMATCH = 'LOOKUP_CONNECTION_MISMATCH';
37
+ /**
38
+ * The connection id a step is bound to, or `undefined` when it does not
39
+ * resolve to a real one. Same reading as `byoaUnverified`: the label through
40
+ * bindings.json, else the label itself when it is already an id.
41
+ */
42
+ export function boundConnectionId(connection, bindings) {
43
+ if (typeof connection !== 'string' || connection === '')
44
+ return undefined;
45
+ const id = bindings?.resolve(connection) ?? connection;
46
+ return GUID_RE.test(id) && !STUB_GUID_RE.test(id) ? id : undefined;
47
+ }
48
+ /**
49
+ * Build the {@link LookupConnectionIndex} for one built artifact.
50
+ *
51
+ * Family-agnostic, like the rules it feeds: it walks the built object and
52
+ * reads every object that carries a string `connection` beside `inputs` (a
53
+ * connector activity) or `where` (an event subscription) — the same
54
+ * `{ inputs, connection }` and `{ where, connection }` shapes
55
+ * `checkConnectorLookups` and `checkEventResolution` read. Connections are
56
+ * read through bindings.json as {@link boundConnectionId} reads them, and
57
+ * stored lower-cased.
58
+ *
59
+ * @param root - The built flow, case or process.
60
+ * @param resolutions - Everything `prepare --resolve` has recorded.
61
+ * @param bindings - Resolves a `connection:` label to an id.
62
+ */
63
+ export function lookupConnectionIndex(root, resolutions, bindings) {
64
+ const index = new Map();
65
+ if (!resolutions || Object.keys(resolutions).length === 0)
66
+ return index;
67
+ const seen = new WeakSet();
68
+ const add = (row, bound) => {
69
+ if (row?.value === undefined)
70
+ return;
71
+ let ids = index.get(row);
72
+ if (!ids)
73
+ index.set(row, (ids = new Set()));
74
+ ids.add(bound.toLowerCase());
75
+ };
76
+ const tokensIn = (value, found, depth = 0) => {
77
+ if (depth > 16 || value === null || typeof value !== 'object')
78
+ return;
79
+ if (isLookupToken(value)) {
80
+ found.push(value);
81
+ return;
82
+ }
83
+ for (const v of Array.isArray(value) ? value : Object.values(value))
84
+ tokensIn(v, found, depth + 1);
85
+ };
86
+ const visit = (value) => {
87
+ if (value === null || typeof value !== 'object' || seen.has(value))
88
+ return;
89
+ seen.add(value);
90
+ if (isLookupToken(value))
91
+ return;
92
+ const o = value;
93
+ const bound = typeof o.connection === 'string' ? boundConnectionId(o.connection, bindings) : undefined;
94
+ if (bound !== undefined) {
95
+ if (o.inputs && typeof o.inputs === 'object') {
96
+ const found = [];
97
+ tokensIn(o.inputs, found);
98
+ for (const token of found)
99
+ add(recordedResolution(token, resolutions), bound);
100
+ }
101
+ if (o.where && typeof o.where === 'object' && !Array.isArray(o.where)) {
102
+ for (const v of Object.values(o.where)) {
103
+ if (isLookupToken(v))
104
+ add(recordedEventResolution(v, resolutions), bound);
105
+ }
106
+ }
107
+ }
108
+ for (const v of Array.isArray(value) ? value : Object.values(o))
109
+ visit(v);
110
+ };
111
+ visit(root);
112
+ return index;
113
+ }
114
+ /**
115
+ * The LOOKUP_CONNECTION_MISMATCH message for one step, or `undefined` when no
116
+ * recorded lookup on it came from another connection. One message per step,
117
+ * like LOOKUP_UNRESOLVED: the remedy is one `prepare` with every `--resolve`.
118
+ * A row another step uses on a different connection gets no command (see the
119
+ * module header): one row cannot serve two connections yet.
120
+ *
121
+ * @param where - How the message opens (`Connector step "post"`, `trigger`).
122
+ * @param uses - Every resolved lookup on the step.
123
+ * @param connection - The step's `connection:` as authored.
124
+ * @param bindings - Resolves the label to an id.
125
+ * @param command - The `<key> <action-or-event>` the prepare command takes, plus any extra flags (`--object x`).
126
+ * @param index - Which bound connections use each row, file-wide; without it every row reads as used by this step alone.
127
+ */
128
+ export function lookupConnectionMismatch(where, uses, connection, bindings, command, index) {
129
+ const bound = boundConnectionId(connection, bindings);
130
+ if (bound === undefined)
131
+ return undefined;
132
+ const wrong = uses.filter(({ row }) => typeof row.connectionId === 'string' && row.connectionId !== ''
133
+ && row.connectionId.toLowerCase() !== bound.toLowerCase());
134
+ if (wrong.length === 0)
135
+ return undefined;
136
+ const label = connection;
137
+ const named = label.toLowerCase() === bound.toLowerCase() ? `connection ${bound}` : `connection \`${label}\` (${bound})`;
138
+ const sharedBy = (row) => {
139
+ const ids = index?.get(row);
140
+ return ids && ids.size > 1 ? ids : undefined;
141
+ };
142
+ const shared = wrong.filter(({ row }) => sharedBy(row) !== undefined);
143
+ const fixable = wrong.filter(({ row }) => sharedBy(row) === undefined);
144
+ const describe = ({ token, row, name }) => `\`${name}\` (${token.__lookup.by}=${JSON.stringify(token.__lookup.value)}) was resolved on connection ${row.connectionId}`;
145
+ const parts = [];
146
+ if (fixable.length > 0) {
147
+ const args = fixable.map(({ token }) => resolveFlagArg(token.__lookup.field, token.__lookup.by, String(token.__lookup.value)));
148
+ const head = ` ${prepareCommand(command.key, command.action, ...(command.extra ?? []), '--connection-id', bound)}`;
149
+ const block = [head + ' \\', ...args.map((a, i) => ` --resolve ${a}${i < args.length - 1 ? ' \\' : ''}`)].join('\n');
150
+ parts.push(`${where}: lookup ${fixable.map(describe).join('; ')}, but this step uses ${named}. `
151
+ + `A lookup id belongs to the connection it was found on, so the recorded `
152
+ + `${fixable.length === 1 ? 'id' : 'ids'} will likely fail at run time. Resolve again on the bound connection:\n`
153
+ + block);
154
+ }
155
+ if (shared.length > 0) {
156
+ const all = [...new Set(shared.flatMap(({ row }) => [...sharedBy(row)]))].sort();
157
+ parts.push(`${where}: lookup ${shared.map(describe).join('; ')}, but this step uses ${named}, `
158
+ + `and steps in this file use the same recorded ${shared.length === 1 ? 'lookup' : 'lookups'} on `
159
+ + `${all.length} connections (${all.join(', ')}). `
160
+ + `One resolutions.json row cannot serve two connections yet (#2042), so re-running \`prepare\` on one `
161
+ + `connection only moves this error to the other step. Bind these steps to one connection, or write `
162
+ + `the id for one of them by hand.`);
163
+ }
164
+ return parts.join('\n');
165
+ }
@@ -171,6 +171,14 @@ export interface LookupResolution {
171
171
  match: string;
172
172
  /** The opaque id the connector wants. */
173
173
  value: string;
174
+ /**
175
+ * The Integration Service connection id the lookup was resolved on. A lookup
176
+ * id belongs to one connection: Slack user `U123` on one workspace is nobody
177
+ * on another. `check` compares it with the connection the step is bound to
178
+ * (LOOKUP_CONNECTION_MISMATCH). Absent on a row written before `prepare`
179
+ * recorded it; such a row is not compared.
180
+ */
181
+ connectionId?: string;
174
182
  }
175
183
  /** Every recorded resolution, keyed by {@link lookupKey}. */
176
184
  export type LookupResolutions = Readonly<Record<string, LookupResolution>>;
@@ -182,6 +190,15 @@ export type LookupResolutions = Readonly<Record<string, LookupResolution>>;
182
190
  * @returns The connector-facing id, when this exact `(nodeType, field, by, value)` was resolved.
183
191
  */
184
192
  export declare function resolvedValue(token: LookupToken, resolutions: LookupResolutions): string | undefined;
193
+ /**
194
+ * The recorded row for a token, or `undefined` — {@link resolvedValue} with the
195
+ * rest of the row (the connection it was resolved on).
196
+ *
197
+ * @param token - The lookup.
198
+ * @param resolutions - Everything `prepare --resolve` has recorded.
199
+ * @returns The row for this exact `(nodeType, field, by, value)`.
200
+ */
201
+ export declare function recordedResolution(token: LookupToken, resolutions: LookupResolutions): LookupResolution | undefined;
185
202
  /**
186
203
  * {@link resolvedValue} for a token on an event's `where`.
187
204
  *
@@ -199,6 +216,15 @@ export declare function resolvedValue(token: LookupToken, resolutions: LookupRes
199
216
  * @returns The connector-facing id, when either key was resolved.
200
217
  */
201
218
  export declare function resolvedEventValue(token: LookupToken, resolutions: LookupResolutions): string | undefined;
219
+ /**
220
+ * The recorded row for a token on an event's `where`, under either key
221
+ * {@link resolvedEventValue} tries, or `undefined`.
222
+ *
223
+ * @param token - The lookup, from either `lookup()` form.
224
+ * @param resolutions - Everything `prepare --resolve` has recorded.
225
+ * @returns The row, own key first, then the event form.
226
+ */
227
+ export declare function recordedEventResolution(token: LookupToken, resolutions: LookupResolutions): LookupResolution | undefined;
202
228
  /**
203
229
  * The message for a lookup nothing has resolved — the command that fixes it.
204
230
  *
@@ -164,8 +164,20 @@ export function lookup(a, b, c) {
164
164
  * @returns The connector-facing id, when this exact `(nodeType, field, by, value)` was resolved.
165
165
  */
166
166
  export function resolvedValue(token, resolutions) {
167
+ return recordedResolution(token, resolutions)?.value;
168
+ }
169
+ /**
170
+ * The recorded row for a token, or `undefined` — {@link resolvedValue} with the
171
+ * rest of the row (the connection it was resolved on).
172
+ *
173
+ * @param token - The lookup.
174
+ * @param resolutions - Everything `prepare --resolve` has recorded.
175
+ * @returns The row for this exact `(nodeType, field, by, value)`.
176
+ */
177
+ export function recordedResolution(token, resolutions) {
167
178
  const { nodeType, field, by, value } = token.__lookup;
168
- return resolutions[lookupKey(nodeType, field, by, value)]?.value;
179
+ const key = lookupKey(nodeType, field, by, value);
180
+ return Object.prototype.hasOwnProperty.call(resolutions, key) ? resolutions[key] : undefined;
169
181
  }
170
182
  /**
171
183
  * The event form of a node type — `uipath.connector.event.<key>.<op>` — for one
@@ -193,12 +205,26 @@ function eventFormOf(nodeType) {
193
205
  * @returns The connector-facing id, when either key was resolved.
194
206
  */
195
207
  export function resolvedEventValue(token, resolutions) {
196
- const own = resolvedValue(token, resolutions);
197
- if (own !== undefined)
208
+ return recordedEventResolution(token, resolutions)?.value;
209
+ }
210
+ /**
211
+ * The recorded row for a token on an event's `where`, under either key
212
+ * {@link resolvedEventValue} tries, or `undefined`.
213
+ *
214
+ * @param token - The lookup, from either `lookup()` form.
215
+ * @param resolutions - Everything `prepare --resolve` has recorded.
216
+ * @returns The row, own key first, then the event form.
217
+ */
218
+ export function recordedEventResolution(token, resolutions) {
219
+ const own = recordedResolution(token, resolutions);
220
+ if (own?.value !== undefined)
198
221
  return own;
199
222
  const { nodeType, field, by, value } = token.__lookup;
200
223
  const eventForm = eventFormOf(nodeType);
201
- return eventForm === undefined ? undefined : resolutions[lookupKey(eventForm, field, by, value)]?.value;
224
+ if (eventForm === undefined)
225
+ return undefined;
226
+ const key = lookupKey(eventForm, field, by, value);
227
+ return Object.prototype.hasOwnProperty.call(resolutions, key) ? resolutions[key] : undefined;
202
228
  }
203
229
  /**
204
230
  * The message for a lookup nothing has resolved — the command that fixes it.
@@ -564,6 +564,7 @@ export declare const REFUSALS: {
564
564
  readonly LIBRARY_REQUIRED: "lowering";
565
565
  readonly LIST_OUTPUT_WRAPPER: "lint";
566
566
  readonly LOOKUP_ARGS: "lowering";
567
+ readonly LOOKUP_CONNECTION_MISMATCH: "lint";
567
568
  readonly LOOKUP_LITERAL_ID: "lint";
568
569
  readonly LOOKUP_MISPLACED: "lowering";
569
570
  readonly LOOKUP_RUNTIME_VALUE: "lint";
@@ -640,6 +640,7 @@ export const REFUSALS = {
640
640
  LIBRARY_REQUIRED: 'lowering',
641
641
  LIST_OUTPUT_WRAPPER: 'lint',
642
642
  LOOKUP_ARGS: 'lowering',
643
+ LOOKUP_CONNECTION_MISMATCH: 'lint',
643
644
  LOOKUP_LITERAL_ID: 'lint',
644
645
  LOOKUP_MISPLACED: 'lowering',
645
646
  LOOKUP_RUNTIME_VALUE: 'lint',
@@ -8,7 +8,9 @@
8
8
  * entries STAND rather than being re-resolved: a resolved id is a snapshot
9
9
  * either way, and re-resolving on every call would make an unrelated `prepare`
10
10
  * silently change an artifact. Re-resolving is `--refresh-lookups`, a
11
- * deliberate act with a visible diff.
11
+ * deliberate act with a visible diff. The one exception is a row recorded on
12
+ * another connection (`connectionId`, #1982): its id belongs to that
13
+ * connection, so it is resolved again.
12
14
  *
13
15
  * The object half of the ledger (`objects[nodeType][requested]`) lives in
14
16
  * `objects.ts`; this module reads and rewrites the WHOLE file so neither
@@ -137,7 +139,15 @@ export async function writeResolutions(run, specs) {
137
139
  }
138
140
  const key = resolutionKey(run.nodeType, field, by, value);
139
141
  const found = findResolution(existing, run.nodeType, field, by, value);
140
- if (found && !run.refreshLookups) {
142
+ // A row resolved on ANOTHER connection does not stand: its id belongs to
143
+ // that connection (#1982). This is the re-run `check`'s
144
+ // LOOKUP_CONNECTION_MISMATCH names, so it must replace the row without
145
+ // `--refresh-lookups`. A row with no `connectionId` predates the field and
146
+ // stands as before: nothing says where it came from.
147
+ const recordedOn = found ? pyGet(found.row, "connectionId", null) : null;
148
+ const otherConnection = typeof recordedOn === "string" && recordedOn !== ""
149
+ && recordedOn.toLowerCase() !== run.connectionId.toLowerCase();
150
+ if (found && !run.refreshLookups && !otherConnection) {
141
151
  const kept = pyStrAny(pyGet(found.row, "value", null));
142
152
  resolved.set(field, kept);
143
153
  run.reporter.info(resolutionLine(field, by, value, kept, true));
@@ -199,18 +209,18 @@ export async function writeResolutions(run, specs) {
199
209
  // it under the raw one, so the tuple does not end up recorded twice.
200
210
  if (found && found.key !== key)
201
211
  delete existing[found.key];
202
- existing[key] = { nodeType: run.nodeType, field, by, match: value, value: got };
212
+ existing[key] = { nodeType: run.nodeType, field, by, match: value, value: got, connectionId: run.connectionId };
203
213
  run.reporter.info(resolutionLine(field, by, value, got));
204
214
  answered.push(resolutionLine(field, by, value, got));
205
215
  }
206
216
  // ALL-OR-NOTHING, deliberately, even though the rows that DID resolve are
207
- // correct for this connection. A ledger row carries no connection: it is
208
- // keyed `[nodeType, field, by, value]`, and a later run REUSES a recorded row
209
- // without asking again unless `--refresh-lookups` is passed (above). So a
210
- // partial write from connection A would hand A's workspace ids to the next
211
- // run bound to connection B — the 2026-09-23 run resolved one recipient on
212
- // one Slack workspace and then re-pinned to another. Until rows are keyed by
213
- // connection, a run that misses records nothing and says what it found.
217
+ // correct for this connection. A ledger row is keyed `[nodeType, field, by,
218
+ // value]`, not by connection, so a partial write from connection A would
219
+ // leave A's workspace ids in the one slot the next run bound to connection B
220
+ // reads — the 2026-09-23 run resolved one recipient on one Slack workspace
221
+ // and then re-pinned to another. A row now records its `connectionId`, so
222
+ // that run re-resolves it and `check` reports it (LOOKUP_CONNECTION_MISMATCH),
223
+ // but a run that misses still records nothing and says what it found.
214
224
  if (misses.length > 0) {
215
225
  const message = misses.length === 1 && notTried.length === 0 && answered.length === 0
216
226
  ? misses[0].message
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.103.0",
3
+ "version": "6.104.0",
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",
@@ -121,5 +121,5 @@
121
121
  "@types/node": "^22.7.0",
122
122
  "esbuild": "^0.28.1"
123
123
  },
124
- "gitref": "a2b0c3e4c8d5532116ba89a1761d07300bd4c4bd"
124
+ "gitref": "c14960c0ecf77fc1f041006b84a3d96c887163e3"
125
125
  }