@uipath/maestro-builder-sdk 6.18.2 → 6.18.4

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
@@ -204,9 +204,9 @@ could hand you spans for a version you do not have.
204
204
  | `ran` | function | `dist/core/expr.d.ts:95-141` | Expressions and types | Did this step run? |
205
205
  | `rawNode` | function | `dist/core/node-classes.d.ts:180-242` | Supporting types | Place a node this SDK has no factory for, carrying its definition verbatim (`uipath.exotic.thing@2.1` and the manifest… |
206
206
  | `RawReference` | type | `dist/core/lookups.d.ts:190-198` | Supporting types | |
207
- | `refuseLookupToken` | function | `dist/core/lookups.d.ts:207-226` | Generated descriptors | Refuse a lookup token where the family cannot resolve one. |
208
207
  | `RemoteA2aToolRef` | interface | `dist/core/actions.d.ts:1745-1765` | Supporting types | A remote A2A (agent-to-agent) endpoint the agent may delegate to. |
209
208
  | `resolvedValue` | function | `dist/core/lookups.d.ts:172-179` | Generated descriptors | The recorded id for a token, or `undefined`. |
209
+ | `resolveEventWhere` | function | `dist/core/lookups.d.ts:207-224` | Generated descriptors | An event subscription's `where` with every lookup token swapped for the id `registry prepare --resolve` recorded, or a… |
210
210
  | `ReturnFieldType` | type | `dist/core/actions.d.ts:1317-1334` | Supporting types | A JSON-schema-ish type for one field of a step's declared `returns`. |
211
211
  | `ReturnOptions` | interface | `dist/flow-sdk.d.ts:397-428` | Option shapes | `.return(...)`-specific options. |
212
212
  | `rpaWorkflow` | function | `dist/core/actions.d.ts:2841-2885` | Actions | Invoke a deployed RPA (robotic process automation) workflow — a classic UI-automation process, published to… |
@@ -21,17 +21,17 @@ export interface Diagnostic {
21
21
  * The connector-library facts Case `check` reads, from the same `Library`
22
22
  * instance `compile` serializes against (`caseCheckOpts` in `./cli-library.ts`).
23
23
  *
24
- * Deliberately NARROWER than Flow's and BPMN's bag. An error here must be a
25
- * refusal Case `compile` actually makes, and Case `serialize` resolves the
26
- * connector operation and the event (`library.resolve` / `resolveEvent`) but does
27
- * not validate connector inputs, binding labels or BYOA. Those rules stay off
28
- * until Case compile enforces them; passing them here would refuse sources that
29
- * compile accepts.
24
+ * Deliberately NARROWER than Flow's bag. An error here must be a refusal Case
25
+ * `compile` actually makes. Case `serialize` resolves the connector operation and
26
+ * the event, and validates a connector task's inputs and resolves its lookups
27
+ * through the shared `buildConnectorInputs` (`connectorInputs`, `lookups`,
28
+ * `resolutions`). It does not check binding labels or BYOA, so those hooks stay
29
+ * off until Case compile enforces them.
30
30
  *
31
31
  * Every hook fails open: without a library, `check` stays a pure function of the
32
32
  * built model.
33
33
  */
34
- export type CaseCheckOpts = Pick<ConnectorCheckOpts, 'connectorResolveError' | 'schemaReadiness'> & {
34
+ export type CaseCheckOpts = Pick<ConnectorCheckOpts, 'connectorResolveError' | 'connectorInputs' | 'lookups' | 'resolutions' | 'schemaReadiness'> & {
35
35
  /**
36
36
  * What Case `compile` would refuse an event subscription with, or `undefined`
37
37
  * when it resolves: `EVENT_UNKNOWN` (the event is not in the library, or
@@ -2,7 +2,8 @@ import { types } from '../core/expr.js';
2
2
  import { authoredCaseVersion, CASE_FORMAT_PROFILE, CASE_SCHEMA_VERSIONS } from './format-profile.js';
3
3
  import { schemaVersionRefusal } from '../schema-version.js';
4
4
  import { caseJsonPreservation, caseJsonPreservationErrors } from './preserve.js';
5
- import { EQUALS_EXPR_DIALECT, checkConnectorContract, checkConnectorSchema, } from '../core/connector-checks.js';
5
+ import { EQUALS_EXPR_DIALECT, checkConnectorContract, checkConnectorLookups, checkConnectorSchema, } from '../core/connector-checks.js';
6
+ import { checkEventResolution } from '../core/event-checks.js';
6
7
  const TYPE_NAMES = new Set(Object.values(types));
7
8
  // audit-case-coverage: rule-slot table start
8
9
  // This runtime table must equal the committed matrix's rejected cells. The audit
@@ -288,6 +289,9 @@ function checkLibraryConnectors(built, opts, diags) {
288
289
  const refused = opts.subscriptionError?.(kind, sub);
289
290
  if (refused !== undefined)
290
291
  diags.push({ level: 'error', code: refused.code, message: `${where}: ${refused.message}`, where: at });
292
+ // A `where` lookup nobody recorded: Flow's LOOKUP_UNRESOLVED warning, from the
293
+ // shared event rules. Only `resolutions` is passed, so nothing else in them fires.
294
+ checkEventResolution(sub, where, kind, { resolutions: opts.resolutions ?? {} }, (code, message) => diags.push({ level: 'error', code, message, where: at }), (code, message) => diags.push({ level: 'warning', code, message, where: at }));
291
295
  };
292
296
  const rules = (conditions, where) => {
293
297
  for (const c of conditions)
@@ -310,6 +314,7 @@ function checkLibraryConnectors(built, opts, diags) {
310
314
  if (t.kind === 'connector' && t.connector) {
311
315
  const where = `Connector task "${t.name}"`;
312
316
  const spec = t.connector;
317
+ checkConnectorLookups(where, spec, opts, EQUALS_EXPR_DIALECT, reporter(where, t.name));
313
318
  checkConnectorSchema(where, spec, opts, EQUALS_EXPR_DIALECT, reporter(where, t.name));
314
319
  checkConnectorContract(where, spec, opts, reporter(where, t.name));
315
320
  }
@@ -5,9 +5,10 @@ import type { CaseCheckOpts } from './check.js';
5
5
  *
6
6
  * Only the hooks for refusals Case `compile` makes (see {@link CaseCheckOpts}):
7
7
  * the operation and event resolution (the event through `resolveCaseSubscription`,
8
- * compile's own call), and the schema-readiness warnings. The
9
- * field-contract, binding-label and BYOA hooks of the shared bag are left out,
10
- * because Case `serialize` does not enforce them.
8
+ * compile's own call), a connector task's field contract and lookups (the
9
+ * `=`-expression validator Case compile runs), and the schema-readiness warnings.
10
+ * The binding-label and BYOA hooks of the shared bag are left out, because Case
11
+ * `serialize` does not enforce them.
11
12
  *
12
13
  * @param library - The library `openCliLibrary` returned, or `undefined`.
13
14
  * @returns The options for Case `check`.
@@ -14,9 +14,10 @@ import { EVENT_GENERIC_NO_OBJECT, GenericEventNoObjectError, resolveCaseSubscrip
14
14
  *
15
15
  * Only the hooks for refusals Case `compile` makes (see {@link CaseCheckOpts}):
16
16
  * the operation and event resolution (the event through `resolveCaseSubscription`,
17
- * compile's own call), and the schema-readiness warnings. The
18
- * field-contract, binding-label and BYOA hooks of the shared bag are left out,
19
- * because Case `serialize` does not enforce them.
17
+ * compile's own call), a connector task's field contract and lookups (the
18
+ * `=`-expression validator Case compile runs), and the schema-readiness warnings.
19
+ * The binding-label and BYOA hooks of the shared bag are left out, because Case
20
+ * `serialize` does not enforce them.
20
21
  *
21
22
  * @param library - The library `openCliLibrary` returned, or `undefined`.
22
23
  * @returns The options for Case `check`.
@@ -27,6 +28,9 @@ export function caseCheckOpts(library) {
27
28
  const shared = connectorCheckOpts(library);
28
29
  return {
29
30
  connectorResolveError: shared.connectorResolveError,
31
+ connectorInputs: shared.connectorInputs,
32
+ lookups: shared.lookups,
33
+ resolutions: shared.resolutions,
30
34
  schemaReadiness: shared.schemaReadiness,
31
35
  subscriptionError: (kind, sub) => {
32
36
  try {
@@ -9,8 +9,9 @@
9
9
  * name) are resolved here to the generated ids.
10
10
  */
11
11
  import { IdGen } from './ids.js';
12
- import { transportHttpMethod } from '../core/connector-inputs.js';
13
- import { refuseLookupToken } from '../core/lookups.js';
12
+ import { buildConnectorInputs, nestConnectorBody, transportHttpMethod } from '../core/connector-inputs.js';
13
+ import { EQUALS_EXPR_DIALECT } from '../core/connector-checks.js';
14
+ import { resolveEventWhere } from '../core/lookups.js';
14
15
  import { resolveCaseSubscription } from './subscription.js';
15
16
  import { CASE_FORMAT_PROFILE, CASE_SCHEMA_VERSIONS } from './format-profile.js';
16
17
  import { resolveSchemaVersion } from '../schema-version.js';
@@ -901,16 +902,13 @@ function resolvedSubscriptionBag(kind, spec, resolver, elementId) {
901
902
  return {
902
903
  serviceType: kind === 'trigger' ? CASE_FORMAT_PROFILE.eventServiceType : CASE_FORMAT_PROFILE.waitConnectorServiceType,
903
904
  context,
904
- inputs: [eventInput(spec.where ?? {}, elementId)],
905
+ inputs: [eventInput(resolveEventWhere(spec.where, resolver.library.lookupResolutions, `${kind === 'trigger' ? 'event trigger' : 'wait-for-connector'} "${elementId}"`), elementId)],
905
906
  outputs: connectorOutputs(rc, elementId, resolver),
906
907
  bindings: [],
907
908
  };
908
909
  }
910
+ /** The subscription's `body` input; `where` has its lookups already resolved (`resolveEventWhere`). */
909
911
  function eventInput(where, elementId) {
910
- // Case compile does not read resolutions.json (Flow does); a token here
911
- // would be emitted raw where the connector expects an id.
912
- for (const [field, value] of Object.entries(where))
913
- refuseLookupToken(value, 'case', field);
914
912
  return Object.keys(where).length
915
913
  ? { name: 'body', type: 'json', target: 'body', body: { queryParams: where }, var: 'vbody', id: 'vbody', elementId }
916
914
  : { name: 'body', type: 'json', target: 'body', value: '', var: 'vbody', id: 'vbody', elementId };
@@ -1083,7 +1081,6 @@ function connectorTaskData(spec, resolver, elementId) {
1083
1081
  throw new Error(`connector task needs the connector library — pass { library } to serialize or use uip maestro case compile --library.`);
1084
1082
  const rc = resolver.library.resolve(spec.key, spec.action, spec.version, spec.object);
1085
1083
  const op = rc.entry.operation ?? {};
1086
- const params = Array.isArray(op.parameters) ? op.parameters : [];
1087
1084
  const context = [
1088
1085
  io('connectorKey', 'string', { value: rc.connectorKey }),
1089
1086
  ];
@@ -1097,31 +1094,31 @@ function connectorTaskData(spec, resolver, elementId) {
1097
1094
  if (folderRef)
1098
1095
  context.push(io('folderKey', 'string', { value: `=bindings.${folderRef.id}` }));
1099
1096
  context.push(io('objectName', 'string', { value: op.objectName ?? spec.action }), io('method', 'string', { value: transportHttpMethod(rc.httpMethod) }), io('path', 'string', { value: rc.endpoint }), io('metadata', 'json', { body: connectorMetadata(rc, op) }));
1100
- // inputs: split declared parameters into path/query slots; the rest is the body.
1097
+ // inputs: the shared validator (`core/connector-inputs.ts`), the one Flow's and
1098
+ // BPMN's serializers and every family's `check` run. It refuses a missing
1099
+ // required field, an unknown or mistyped input, and swaps a `lookup()` token for
1100
+ // the id `registry prepare --resolve` recorded (refusing one nobody recorded).
1101
+ // Case used to split the inputs itself: an unknown name went to the body
1102
+ // unchecked, and every token was refused, because nothing here read
1103
+ // `resolutions.json` (#1034, #1036).
1101
1104
  //
1102
- // Guard BEFORE the split. These values are emitted verbatim, so an unresolved
1103
- // lookup ships as `{"__lookup": …}` where the connector wants an id — verified
1104
- // by probe before this existed. Only Flow reads resolutions.json.
1105
- for (const [name, value] of Object.entries(spec.inputs ?? {})) {
1106
- refuseLookupToken(value, 'case', name);
1107
- }
1108
- const pathParameters = {};
1109
- const queryParameters = {};
1110
- const body = { ...spec.inputs };
1111
- for (const p of params) {
1112
- const name = String(p.name ?? '');
1113
- if (!(name in body))
1114
- continue;
1115
- const camel = toCamel(name);
1116
- if (p.type === 'path') {
1117
- pathParameters[camel] = body[name];
1118
- delete body[name];
1119
- }
1120
- else if (p.type === 'query') {
1121
- queryParameters[camel] = body[name];
1122
- delete body[name];
1123
- }
1124
- }
1105
+ // The ROUTING is the library's (a field's location is a property of the
1106
+ // operation); the SPELLING of the path/query keys is Case's own: the Case
1107
+ // designer camelCases them (`send_as` → `sendAs`, see
1108
+ // `fixtures/execute-connector-activity.sample.json`), and the body is nested.
1109
+ const slots = buildConnectorInputs(rc, spec.inputs ?? {}, {
1110
+ dialect: EQUALS_EXPR_DIALECT,
1111
+ resolutions: resolver.library.lookupResolutions,
1112
+ lookups: resolver.library.lookupSpecs(spec.key, spec.action, spec.version, spec.object),
1113
+ });
1114
+ const camelKeys = (slot) => Object.fromEntries(Object.entries(slot ?? {}).map(([name, value]) => [toCamel(name), value]));
1115
+ const pathParameters = camelKeys(slots.pathParameters);
1116
+ const queryParameters = camelKeys(slots.queryParameters);
1117
+ // Case has no multipart wire: a filled file part stays in the body, where it
1118
+ // has always gone.
1119
+ const parts = Object.fromEntries((slots.multipartParameters ?? [])
1120
+ .filter((part) => part.value !== undefined).map((part) => [part.name, part.value]));
1121
+ const body = nestConnectorBody({ ...(slots.bodyParameters ?? {}), ...parts });
1125
1122
  const inputs = [
1126
1123
  ioSlot('pathParameters', pathParameters, `${elementId}`),
1127
1124
  ioSlot('queryParameters', queryParameters, `${elementId}`),
@@ -205,23 +205,21 @@ type RawReference = {
205
205
  */
206
206
  export declare function lookupSpecOf(reference: RawReference, invariant?: ReadonlySet<string>): LookupSpec | undefined;
207
207
  /**
208
- * Refuse a lookup token where the family cannot resolve one.
209
- *
210
- * `lookup()` is a FLOW surface today: only `serialize.ts` substitutes a
211
- * recorded resolution, and only `check.ts` reports an unresolved one. Case and
212
- * BPMN pass connector input values straight into their emitted payload, so a
213
- * token reaching either one is embedded verbatim — a `.case` carrying
214
- * `{"__lookup": {…}}` where the connector expects an id.
215
- *
216
- * That is silent wrongness, which is the failure this whole surface exists to
217
- * remove; emitting it from the tool that removes it would be the worst possible
218
- * outcome. Until Case and BPMN read `resolutions.json` too, they refuse the
219
- * token and say so.
220
- *
221
- * @param value - A connector input value.
222
- * @param family - The authoring family, for the message.
223
- * @param field - The input name, for the message.
224
- * @throws If `value` is an unresolved {@link LookupToken}.
208
+ * An event subscription's `where` with every lookup token swapped for the id
209
+ * `registry prepare --resolve` recorded, or a throw naming the first one nobody
210
+ * recorded.
211
+ *
212
+ * The id is looked up under the token's own node type, which for an event
213
+ * lookup is the EVENT form `prepare` stores it under. Emitting a placeholder for
214
+ * a value nobody resolved would subscribe the trigger to the wrong folder,
215
+ * channel or queue, so an unrecorded token is refused, never passed through.
216
+ * Shared by Flow's and Case's serializers, so both resolve and refuse alike.
217
+ *
218
+ * @param where - The authored `where`.
219
+ * @param resolutions - The library's recorded resolutions (`library.lookupResolutions`).
220
+ * @param site - How the caller names the subscription, prefixed to the refusal.
221
+ * @returns The `where` with ids in place of tokens.
222
+ * @throws If a token has no recorded resolution.
225
223
  */
226
- export declare function refuseLookupToken(value: unknown, family: string, field: string): void;
224
+ export declare function resolveEventWhere(where: Record<string, unknown> | undefined, resolutions: LookupResolutions, site: string): Record<string, unknown>;
227
225
  export {};
@@ -259,33 +259,33 @@ function byAlias(lookupName) {
259
259
  return 'by' + words.map((w) => w[0].toUpperCase() + w.slice(1)).join('');
260
260
  }
261
261
  /**
262
- * Refuse a lookup token where the family cannot resolve one.
262
+ * An event subscription's `where` with every lookup token swapped for the id
263
+ * `registry prepare --resolve` recorded, or a throw naming the first one nobody
264
+ * recorded.
263
265
  *
264
- * `lookup()` is a FLOW surface today: only `serialize.ts` substitutes a
265
- * recorded resolution, and only `check.ts` reports an unresolved one. Case and
266
- * BPMN pass connector input values straight into their emitted payload, so a
267
- * token reaching either one is embedded verbatim — a `.case` carrying
268
- * `{"__lookup": {…}}` where the connector expects an id.
266
+ * The id is looked up under the token's own node type, which for an event
267
+ * lookup is the EVENT form `prepare` stores it under. Emitting a placeholder for
268
+ * a value nobody resolved would subscribe the trigger to the wrong folder,
269
+ * channel or queue, so an unrecorded token is refused, never passed through.
270
+ * Shared by Flow's and Case's serializers, so both resolve and refuse alike.
269
271
  *
270
- * That is silent wrongness, which is the failure this whole surface exists to
271
- * remove; emitting it from the tool that removes it would be the worst possible
272
- * outcome. Until Case and BPMN read `resolutions.json` too, they refuse the
273
- * token and say so.
274
- *
275
- * @param value - A connector input value.
276
- * @param family - The authoring family, for the message.
277
- * @param field - The input name, for the message.
278
- * @throws If `value` is an unresolved {@link LookupToken}.
272
+ * @param where - The authored `where`.
273
+ * @param resolutions - The library's recorded resolutions (`library.lookupResolutions`).
274
+ * @param site - How the caller names the subscription, prefixed to the refusal.
275
+ * @returns The `where` with ids in place of tokens.
276
+ * @throws If a token has no recorded resolution.
279
277
  */
280
- export function refuseLookupToken(value, family, field) {
281
- if (!isLookupToken(value))
282
- return;
283
- const { nodeType, by, value: wanted } = value.__lookup;
284
- throw new Error(`${family}: input "${field}" is a lookup(), which ${family} cannot resolve — ` +
285
- `only Flow reads connectors-local/resolutions.json today, so this would be ` +
286
- `emitted as a raw token where the connector expects an id.\n` +
287
- `Resolve it first and pass the value:\n` +
288
- ` ${prepareCommand()} ${nodeType.replace(/^uipath\.connector\.(?:trigger\.|event\.)?/, '').replace(/\.([^.]+)$/, ' --action $1')} \\\n` +
289
- ` --resolve ${field}:${by}=${String(wanted)}\n` +
290
- `then read the id out of connectors-local/resolutions.json.`);
278
+ export function resolveEventWhere(where, resolutions, site) {
279
+ const out = {};
280
+ for (const [key, value] of Object.entries(where ?? {})) {
281
+ if (!isLookupToken(value)) {
282
+ out[key] = value;
283
+ continue;
284
+ }
285
+ const resolved = resolvedValue(value, resolutions);
286
+ if (resolved === undefined)
287
+ throw new Error(`${site}: \`where.${key}\` ` + unresolvedLookupMessage(value));
288
+ out[key] = resolved;
289
+ }
290
+ return out;
291
291
  }
package/dist/serialize.js CHANGED
@@ -44,7 +44,7 @@ export function connectorInputErrors(rc, inputs, resolutions = {}, lookups = {})
44
44
  render: (value) => renderDeep(value, NO_RENAME),
45
45
  });
46
46
  }
47
- import { isLookupToken, resolvedValue, unresolvedLookupMessage, } from './core/lookups.js';
47
+ import { isLookupToken, resolveEventWhere, } from './core/lookups.js';
48
48
  import { declaredScriptShape, inferScriptShape } from './core/script-return.js';
49
49
  import { migrateToSchemaVersion } from './migrate.js';
50
50
  import { FLOW_SCHEMA_VERSIONS } from './format-profile.js';
@@ -4127,19 +4127,7 @@ function eventDetail(rc, sub, nodeId, opts, site) {
4127
4127
  // `prepare --resolve` stored under the EVENT-form node type — or refused.
4128
4128
  // Same rule as connector inputs: emitting a placeholder for a value nobody
4129
4129
  // resolved would subscribe the trigger to the wrong folder/channel/queue.
4130
- const eventResolutions = opts.library?.lookupResolutions ?? {};
4131
- const where = {};
4132
- for (const [k, v] of Object.entries(sub.where ?? {})) {
4133
- if (!isLookupToken(v)) {
4134
- where[k] = v;
4135
- continue;
4136
- }
4137
- const resolved = resolvedValue(v, eventResolutions);
4138
- if (resolved === undefined) {
4139
- throw new Error(`event node "${nodeId}": \`where.${k}\` ` + unresolvedLookupMessage(v));
4140
- }
4141
- where[k] = resolved;
4142
- }
4130
+ const where = resolveEventWhere(sub.where, opts.library?.lookupResolutions ?? {}, `event node "${nodeId}"`);
4143
4131
  // A subscription's parameters do not all travel in the same slot. The
4144
4132
  // connector declares which, and the library bakes it per field as `bucket`:
4145
4133
  // measured against designer-authored triggers, Jira's `project`/`issuetype`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.18.2",
3
+ "version": "6.18.4",
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",
@@ -92,5 +92,5 @@
92
92
  "@types/node": "^22.7.0",
93
93
  "esbuild": "^0.28.1"
94
94
  },
95
- "gitref": "a1a9df938c60a4e31cc9025ec9664d34f41aa799"
95
+ "gitref": "35ff6e86b7aecb0b5c76663b6650a0924a8b7f6e"
96
96
  }