@uipath/maestro-builder-sdk 6.18.4 → 6.18.5

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.
@@ -38,6 +38,18 @@ export type CaseCheckOpts = Pick<ConnectorCheckOpts, 'connectorResolveError' | '
38
38
  * refuses the `object`) or `EVENT_GENERIC_NO_OBJECT` (a GENERIC event with no
39
39
  * `object`). Built on `resolveCaseSubscription`, the call compile makes.
40
40
  */
41
+ /**
42
+ * What Case `compile` would refuse an External Agent / External Workflow
43
+ * task's resolved descriptor with (`externalDescriptorRefusal`), or
44
+ * `undefined`: also `undefined` when the descriptor does not resolve, which
45
+ * `connectorResolveError` reports.
46
+ */
47
+ externalDescriptorError?: (kind: 'external-agent' | 'external-workflow', descriptor: {
48
+ key: string;
49
+ action: string;
50
+ version?: string;
51
+ object?: string;
52
+ }) => string | undefined;
41
53
  subscriptionError?: (kind: 'trigger' | 'event', subscription: EventSubscription) => {
42
54
  code: string;
43
55
  message: string;
@@ -4,6 +4,7 @@ import { schemaVersionRefusal } from '../schema-version.js';
4
4
  import { caseJsonPreservation, caseJsonPreservationErrors } from './preserve.js';
5
5
  import { EQUALS_EXPR_DIALECT, checkConnectorContract, checkConnectorLookups, checkConnectorSchema, } from '../core/connector-checks.js';
6
6
  import { checkEventResolution } from '../core/event-checks.js';
7
+ import { EXTERNAL_TASK_DESCRIPTOR_CONTRACT } from './external.js';
7
8
  const TYPE_NAMES = new Set(Object.values(types));
8
9
  // audit-case-coverage: rule-slot table start
9
10
  // This runtime table must equal the committed matrix's rejected cells. The audit
@@ -270,7 +271,10 @@ export function check(built, opts = {}) {
270
271
  *
271
272
  * - a connector task and an External Agent / External Workflow task resolve
272
273
  * their operation (`library.resolve`): CONNECTOR_NOT_IN_LIBRARY,
273
- * CONNECTOR_OBJECT_REQUIRED, CONNECTOR_OBJECT_NOT_GENERIC;
274
+ * CONNECTOR_OBJECT_REQUIRED, CONNECTOR_OBJECT_NOT_GENERIC; then their inputs
275
+ * (`buildConnectorInputs`): CONNECTOR_INPUT, LOOKUP_UNRESOLVED;
276
+ * - an external task's resolved descriptor (`externalDescriptorRefusal`):
277
+ * EXTERNAL_TASK_DESCRIPTOR_CONTRACT;
274
278
  * - an event trigger, a wait-for-connector task and a wait-for-connector rule
275
279
  * resolve their subscription (`resolveCaseSubscription`): EVENT_UNKNOWN,
276
280
  * EVENT_GENERIC_NO_OBJECT.
@@ -321,7 +325,12 @@ function checkLibraryConnectors(built, opts, diags) {
321
325
  if ((t.kind === 'external-agent' || t.kind === 'external-workflow')
322
326
  && t.external?.connector?.key?.trim() && t.external.connector.action?.trim()) {
323
327
  const where = `${t.kind === 'external-agent' ? 'External Agent' : 'External Workflow'} task "${t.name}"`;
324
- checkConnectorContract(where, t.external.connector, opts, reporter(where, t.name));
328
+ const spec = t.external.connector;
329
+ checkConnectorLookups(where, spec, opts, EQUALS_EXPR_DIALECT, reporter(where, t.name));
330
+ checkConnectorContract(where, spec, opts, reporter(where, t.name));
331
+ const refused = opts.externalDescriptorError?.(t.kind, spec);
332
+ if (refused !== undefined)
333
+ diags.push({ level: 'error', code: EXTERNAL_TASK_DESCRIPTOR_CONTRACT, message: `${where}: ${refused}`, where: t.name });
325
334
  }
326
335
  if (t.kind === 'wait-for-connector' && isSubscription(t.waitConnector))
327
336
  subscription('event', t.waitConnector, `Wait-for-connector task "${t.name}"`, t.name);
@@ -8,6 +8,7 @@
8
8
  * both `case check` and `case compile`'s check pass call.
9
9
  */
10
10
  import { connectorCheckOpts } from '../core/cli-library.js';
11
+ import { externalDescriptorRefusal } from './external.js';
11
12
  import { EVENT_GENERIC_NO_OBJECT, GenericEventNoObjectError, resolveCaseSubscription } from './subscription.js';
12
13
  /**
13
14
  * Case's check options from a library the CLI already opened, or `{}` without one.
@@ -32,6 +33,16 @@ export function caseCheckOpts(library) {
32
33
  lookups: shared.lookups,
33
34
  resolutions: shared.resolutions,
34
35
  schemaReadiness: shared.schemaReadiness,
36
+ externalDescriptorError: (kind, d) => {
37
+ let rc;
38
+ try {
39
+ rc = library.resolve(d.key, d.action, d.version, d.object);
40
+ }
41
+ catch {
42
+ return undefined; // connectorResolveError's to report
43
+ }
44
+ return externalDescriptorRefusal(kind, rc);
45
+ },
35
46
  subscriptionError: (kind, sub) => {
36
47
  try {
37
48
  resolveCaseSubscription(library, kind, sub);
@@ -0,0 +1,27 @@
1
+ /**
2
+ * case/external — the descriptor contract of an External Agent / External
3
+ * Workflow task, shared by Case `serialize` (which throws it) and Case `check`
4
+ * (which reports it as EXTERNAL_TASK_DESCRIPTOR_CONTRACT), so the two refuse the
5
+ * same descriptors with the same text (#1035).
6
+ *
7
+ * The task's inputs are not here: they go through the shared
8
+ * `buildConnectorInputs`, which `check` already runs as `connectorInputs`.
9
+ */
10
+ import type { ResolvedConnector } from '../core/library.js';
11
+ /** Check's code for {@link externalDescriptorRefusal}. */
12
+ export declare const EXTERNAL_TASK_DESCRIPTOR_CONTRACT = "EXTERNAL_TASK_DESCRIPTOR_CONTRACT";
13
+ /**
14
+ * Why a resolved descriptor cannot back this external task, or `undefined`.
15
+ *
16
+ * An External Agent task needs an `AgentExecution` operation and an External
17
+ * Workflow task a `ProcessExecution` one: the service type the task emits
18
+ * (`Intsvc.SyncAgentExecution`, …) is chosen by the family, and a descriptor of
19
+ * the other kind (or a plain connector action) would run the wrong contract.
20
+ * Both need the operation's `uiPathActivityTypeId`, which the task emits as its
21
+ * `activity` context.
22
+ *
23
+ * @param kind - The task kind.
24
+ * @param rc - What `library.resolve` returned for the task's descriptor.
25
+ * @returns The refusal, or `undefined`.
26
+ */
27
+ export declare function externalDescriptorRefusal(kind: 'external-agent' | 'external-workflow', rc: Pick<ResolvedConnector, 'nodeType' | 'version' | 'activityTypeId' | 'entry'>): string | undefined;
@@ -0,0 +1,25 @@
1
+ /** Check's code for {@link externalDescriptorRefusal}. */
2
+ export const EXTERNAL_TASK_DESCRIPTOR_CONTRACT = 'EXTERNAL_TASK_DESCRIPTOR_CONTRACT';
3
+ /**
4
+ * Why a resolved descriptor cannot back this external task, or `undefined`.
5
+ *
6
+ * An External Agent task needs an `AgentExecution` operation and an External
7
+ * Workflow task a `ProcessExecution` one: the service type the task emits
8
+ * (`Intsvc.SyncAgentExecution`, …) is chosen by the family, and a descriptor of
9
+ * the other kind (or a plain connector action) would run the wrong contract.
10
+ * Both need the operation's `uiPathActivityTypeId`, which the task emits as its
11
+ * `activity` context.
12
+ *
13
+ * @param kind - The task kind.
14
+ * @param rc - What `library.resolve` returned for the task's descriptor.
15
+ * @returns The refusal, or `undefined`.
16
+ */
17
+ export function externalDescriptorRefusal(kind, rc) {
18
+ const op = rc.entry?.operation ?? {};
19
+ const expectedSubType = kind === 'external-agent' ? 'AgentExecution' : 'ProcessExecution';
20
+ if (op.subType !== expectedSubType)
21
+ return `${kind} task requires a ${expectedSubType} descriptor; resolved ${String(op.subType ?? 'no subtype')}.`;
22
+ if (!rc.activityTypeId)
23
+ return `${kind} task descriptor ${rc.nodeType}@${rc.version} has no uiPathActivityTypeId.`;
24
+ return undefined;
25
+ }
@@ -13,6 +13,7 @@ import { buildConnectorInputs, nestConnectorBody, transportHttpMethod } from '..
13
13
  import { EQUALS_EXPR_DIALECT } from '../core/connector-checks.js';
14
14
  import { resolveEventWhere } from '../core/lookups.js';
15
15
  import { resolveCaseSubscription } from './subscription.js';
16
+ import { externalDescriptorRefusal } from './external.js';
16
17
  import { CASE_FORMAT_PROFILE, CASE_SCHEMA_VERSIONS } from './format-profile.js';
17
18
  import { resolveSchemaVersion } from '../schema-version.js';
18
19
  import { caseJsonPreservation, caseJsonPreservationErrors, } from './preserve.js';
@@ -1131,12 +1132,9 @@ function externalTaskData(kind, spec, resolver) {
1131
1132
  if (!resolver.library)
1132
1133
  throw new Error(`${kind} task needs the connector library — pass { library } to serialize or use uip maestro case compile --library.`);
1133
1134
  const rc = resolver.library.resolve(spec.connector.key, spec.connector.action, spec.connector.version, spec.connector.object);
1134
- const op = rc.entry.operation ?? {};
1135
- const expectedSubType = kind === 'external-agent' ? 'AgentExecution' : 'ProcessExecution';
1136
- if (op.subType !== expectedSubType)
1137
- throw new Error(`${kind} task requires a ${expectedSubType} descriptor; resolved ${String(op.subType ?? 'no subtype')}.`);
1138
- if (!rc.activityTypeId)
1139
- throw new Error(`${kind} task descriptor ${rc.nodeType}@${rc.version} has no uiPathActivityTypeId.`);
1135
+ const refused = externalDescriptorRefusal(kind, rc);
1136
+ if (refused)
1137
+ throw new Error(refused);
1140
1138
  if (spec.mode !== 'sync' && spec.mode !== 'async')
1141
1139
  throw new Error(`${kind} task mode must be "sync" or "async".`);
1142
1140
  const connection = bindingRef(resolver, spec.connector.connection, 'Connection', 'ConnectionId', `${rc.connectorKey} connection`);
@@ -1150,13 +1148,18 @@ function externalTaskData(kind, spec, resolver) {
1150
1148
  : (spec.mode === 'sync'
1151
1149
  ? CASE_FORMAT_PROFILE.externalWorkflowSyncServiceType
1152
1150
  : CASE_FORMAT_PROFILE.externalWorkflowAsyncServiceType);
1151
+ // The inputs: the shared validator every connector activity runs (unknown,
1152
+ // missing required or mistyped input; a `lookup()` swapped for its recorded id,
1153
+ // or refused). Case `check` reports the same through `connectorInputs`.
1153
1154
  const fields = new Map(rc.fields.map((field) => [field.name, field]));
1154
- const unknown = Object.keys(spec.connector.inputs).find((name) => !fields.has(name));
1155
- if (unknown)
1156
- throw new Error(`${kind} task has unknown input "${unknown}" for ${rc.nodeType}@${rc.version}.`);
1157
- const missing = rc.fields.find((field) => field.required && !(field.name in spec.connector.inputs));
1158
- if (missing)
1159
- throw new Error(`${kind} task is missing required input "${missing.name}".`);
1155
+ const slots = buildConnectorInputs(rc, spec.connector.inputs, {
1156
+ dialect: EQUALS_EXPR_DIALECT,
1157
+ resolutions: resolver.library.lookupResolutions,
1158
+ lookups: resolver.library.lookupSpecs(spec.connector.key, spec.connector.action, spec.connector.version, spec.connector.object),
1159
+ });
1160
+ const resolved = {
1161
+ ...slots.bodyParameters, ...slots.pathParameters, ...slots.queryParameters,
1162
+ };
1160
1163
  const responseVar = connectorOutputVar(resolver, 'response');
1161
1164
  return {
1162
1165
  serviceType,
@@ -1172,7 +1175,7 @@ function externalTaskData(kind, spec, resolver) {
1172
1175
  id: name,
1173
1176
  name,
1174
1177
  type: jsonType(fields.get(name)?.type),
1175
- value,
1178
+ value: name in resolved ? resolved[name] : value,
1176
1179
  target: name,
1177
1180
  })),
1178
1181
  outputs: [{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.18.4",
3
+ "version": "6.18.5",
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": "35ff6e86b7aecb0b5c76663b6650a0924a8b7f6e"
95
+ "gitref": "714298df601bba1d5d278525ba354d670cec21aa"
96
96
  }