@uipath/maestro-builder-sdk 6.47.0 → 6.47.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.
@@ -16,7 +16,7 @@ import { EQUALS_EXPR_DIALECT } from '../core/connector-checks.js';
16
16
  import { bindingLabelRefusal } from '../core/binding-messages.js';
17
17
  import { resolveEventWhere } from '../core/lookups.js';
18
18
  import { resolveCaseSubscription } from './subscription.js';
19
- import { externalDescriptorRefusal } from './external.js';
19
+ import { externalDescriptorRefusal, externalHybridRefusal, externalServiceType, isExternalExecutionMode } from './external.js';
20
20
  import { CASE_FORMAT_PROFILE, CASE_SCHEMA_VERSIONS } from './format-profile.js';
21
21
  import { isResourceLabelRefusal, resolveResourceRef, resourceIdentity } from './resource-identity.js';
22
22
  import { ownEntry } from '../core/own-entry.js';
@@ -914,7 +914,8 @@ function taskData(task, resolver, taskId, stageId, ids) {
914
914
  // into the child (`data.inputs[]`) and reading results back (`data.outputs[]`)
915
915
  // uses the identical io-binding wire as the other reference tasks (Gap F).
916
916
  case 'case-management':
917
- case 'flow-process': {
917
+ case 'flow-process':
918
+ case 'function': {
918
919
  // Reference-mode task, plus optional io-binding: input params and output
919
920
  // extractions (`data.inputs[]` / `data.outputs[]`). Each row's `elementId`
920
921
  // is "<stageId>-<taskId>"; an output also registers a root `inputOutputs`
@@ -970,7 +971,7 @@ function taskData(task, resolver, taskId, stageId, ids) {
970
971
  return connectorTaskData(task.connector, resolver, taskId, `Connector task "${task.name}"`);
971
972
  case 'external-agent':
972
973
  case 'external-workflow':
973
- return externalTaskData(task.kind, task.external, resolver, `${task.kind === 'external-agent' ? 'External Agent' : 'External Workflow'} task "${task.name}"`);
974
+ return externalTaskData(task.kind, task.external, resolver, taskId, `${task.kind === 'external-agent' ? 'External Agent' : 'External Workflow'} task "${task.name}"`);
974
975
  case 'wait-for-timer': {
975
976
  if (task.timer?.duration)
976
977
  return { timerType: 'timeDuration', timeDuration: task.timer.duration };
@@ -1258,6 +1259,7 @@ const REFERENCE_BINDING = {
1258
1259
  'api-workflow': { resource: 'process', subType: 'Api' },
1259
1260
  'case-management': { resource: 'process', subType: 'CaseManagement' },
1260
1261
  'flow-process': { resource: 'process' },
1262
+ function: { resource: 'process', subType: 'Function' },
1261
1263
  };
1262
1264
  /**
1263
1265
  * Mint (once per resource + resourceKey + attribute) one root binding row of a
@@ -1358,7 +1360,7 @@ function businessRuleTaskData(task, resolver, elementId, ids) {
1358
1360
  * the op's output schema. Connection/folder resolve through `bindings` and are
1359
1361
  * referenced as `=bindings.<id>`, with the binding entry collected at case root.
1360
1362
  */
1361
- function connectorTaskData(spec, resolver, elementId, where) {
1363
+ function connectorTaskData(spec, resolver, elementId, where, executionType) {
1362
1364
  if (!resolver.library)
1363
1365
  throw new Error(`connector task needs the connector library — pass { library } to serialize or use uip maestro case compile --library.`);
1364
1366
  const rc = resolver.library.resolve(spec.key, spec.action, spec.version, spec.object);
@@ -1376,7 +1378,7 @@ function connectorTaskData(spec, resolver, elementId, where) {
1376
1378
  const folderRef = folderBindingRef(resolver, spec.folder, connRef, { attribute: 'folder', where, target });
1377
1379
  if (folderRef)
1378
1380
  context.push(io('folderKey', 'string', { value: `=bindings.${folderRef.id}` }));
1379
- 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) }));
1381
+ 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, executionType) }));
1380
1382
  // inputs: the shared validator (`core/connector-inputs.ts`), the one Flow's and
1381
1383
  // BPMN's serializers and every family's `check` run. It refuses a missing
1382
1384
  // required field, an unknown or mistyped input, and swaps a `lookup()` token for
@@ -1410,66 +1412,35 @@ function connectorTaskData(spec, resolver, elementId, where) {
1410
1412
  const outputs = connectorOutputs(rc, elementId, resolver);
1411
1413
  return { serviceType: CASE_FORMAT_PROFILE.connectorActivityServiceType, context, inputs, outputs, bindings: [] };
1412
1414
  }
1413
- function externalTaskData(kind, spec, resolver, where) {
1415
+ /**
1416
+ * An External Agent / External Workflow task, in the shape the Case Designer
1417
+ * saves one (`uip`'s `tests/fixtures/external-tasks/designer-saved.json`, alpha
1418
+ * 2026-10-16): a connector activity's `data` — `connectorKey`, `connection`,
1419
+ * `resourceKey`, `folderKey`, `objectName`, `method`, `path`, `metadata`
1420
+ * context; `pathParameters` / `queryParameters` / `body` input containers;
1421
+ * `response` + `Error` outputs — plus the object's `executionType` (in the
1422
+ * context and in the metadata's configuration), `activityConfigurationVersion:
1423
+ * "v2"`, and the sync or async service type that execution type gives.
1424
+ */
1425
+ function externalTaskData(kind, spec, resolver, elementId, where) {
1414
1426
  if (!resolver.library)
1415
1427
  throw new Error(`${kind} task needs the connector library — pass { library } to serialize or use uip maestro case compile --library.`);
1416
1428
  const rc = resolver.library.resolve(spec.connector.key, spec.connector.action, spec.connector.version, spec.connector.object);
1417
1429
  const refused = externalDescriptorRefusal(kind, rc);
1418
1430
  if (refused)
1419
1431
  throw new Error(refused);
1420
- if (spec.mode !== 'sync' && spec.mode !== 'async')
1421
- throw new Error(`${kind} task mode must be "sync" or "async".`);
1422
- const target = { key: spec.connector.key, action: spec.connector.action };
1423
- const connection = bindingRef(resolver, spec.connector.connection, 'Connection', 'ConnectionId', `${rc.connectorKey} connection`, { attribute: 'connection', where, target });
1424
- const folder = folderBindingRef(resolver, spec.connector.folder, connection, { attribute: 'folder', where, target });
1425
- if (!connection || !folder)
1432
+ if (!isExternalExecutionMode(spec.mode))
1433
+ throw new Error(`${kind} task mode must be the connector object's executionType: "sync", "async" or "hybrid".`);
1434
+ if (spec.mode === 'hybrid')
1435
+ throw new Error(externalHybridRefusal(where));
1436
+ if (!spec.connector.connection || !spec.connector.folder)
1426
1437
  throw new Error(`${kind} task requires non-empty connection and folder binding names.`);
1427
- const serviceType = kind === 'external-agent'
1428
- ? (spec.mode === 'sync'
1429
- ? CASE_FORMAT_PROFILE.externalAgentSyncServiceType
1430
- : CASE_FORMAT_PROFILE.externalAgentAsyncServiceType)
1431
- : (spec.mode === 'sync'
1432
- ? CASE_FORMAT_PROFILE.externalWorkflowSyncServiceType
1433
- : CASE_FORMAT_PROFILE.externalWorkflowAsyncServiceType);
1434
- // The inputs: the shared validator every connector activity runs (unknown,
1435
- // missing required or mistyped input; a `lookup()` swapped for its recorded id,
1436
- // or refused). Case `check` reports the same through `connectorInputs`.
1437
- const fields = new Map(rc.fields.map((field) => [field.name, field]));
1438
- const slots = buildConnectorInputs(rc, spec.connector.inputs, {
1439
- dialect: EQUALS_EXPR_DIALECT,
1440
- resolutions: resolver.library.lookupResolutions,
1441
- lookups: resolver.library.lookupSpecs(spec.connector.key, spec.connector.action, spec.connector.version, spec.connector.object),
1442
- });
1443
- const resolved = {
1444
- ...slots.bodyParameters, ...slots.pathParameters, ...slots.queryParameters,
1445
- };
1446
- const responseVar = connectorOutputVar(resolver, 'response');
1447
- return {
1448
- serviceType,
1449
- context: [
1450
- io('activity', 'string', { value: rc.activityTypeId }),
1451
- io('connectorKey', 'string', { value: rc.connectorKey }),
1452
- io('connection', 'string', { value: `=bindings.${connection.id}` }),
1453
- io('folderKey', 'string', { value: `=bindings.${folder.id}` }),
1454
- io('method', 'string', { value: transportHttpMethod(rc.httpMethod) }),
1455
- io('path', 'string', { value: rc.endpoint }),
1456
- ],
1457
- inputs: Object.entries(spec.connector.inputs).map(([name, value]) => ({
1458
- id: name,
1459
- name,
1460
- type: jsonType(fields.get(name)?.type),
1461
- value: name in resolved ? resolved[name] : value,
1462
- target: name,
1463
- })),
1464
- outputs: [{
1465
- id: responseVar,
1466
- name: 'response',
1467
- type: 'json',
1468
- source: '.',
1469
- var: responseVar,
1470
- }],
1471
- bindings: [],
1472
- };
1438
+ const data = connectorTaskData(spec.connector, resolver, elementId, where, spec.mode);
1439
+ const context = data.context;
1440
+ const metadataAt = context.findIndex((row) => row.name === 'metadata');
1441
+ context.splice(metadataAt, 0, io('executionType', 'string', { value: spec.mode }));
1442
+ context.push(io('activityConfigurationVersion', 'string', { value: 'v2' }));
1443
+ return { ...data, serviceType: externalServiceType(kind, spec.mode) };
1473
1444
  }
1474
1445
  /** A context/output name/value entry (the caseplan `InputOutput` shape). */
1475
1446
  function io(name, type, extra) {
@@ -1577,7 +1548,7 @@ function folderBindingRef(resolver, name, connection, site) {
1577
1548
  /** The connector `metadata` json blob: the FUNCTIONAL essentialConfiguration +
1578
1549
  * activityTypeId. Designer cosmetics (packageId/activityColor/…) are omitted —
1579
1550
  * the caseplan schema-validates without them (see design §C). */
1580
- function connectorMetadata(rc, op) {
1551
+ function connectorMetadata(rc, op, executionType) {
1581
1552
  const instanceParameters = {
1582
1553
  connectorKey: rc.connectorKey,
1583
1554
  objectName: op.objectName ?? rc.nodeType.split('.').pop(),
@@ -1594,6 +1565,9 @@ function connectorMetadata(rc, op) {
1594
1565
  httpMethod: transportHttpMethod(rc.httpMethod),
1595
1566
  path: rc.endpoint,
1596
1567
  packageVersion: rc.version,
1568
+ // An external task's object states how it runs; the Designer saves it here
1569
+ // and beside the configuration. A plain connector activity has none.
1570
+ ...(executionType ? { executionType } : {}),
1597
1571
  },
1598
1572
  };
1599
1573
  return {
@@ -1601,6 +1575,7 @@ function connectorMetadata(rc, op) {
1601
1575
  configuration: `=jsonString:${JSON.stringify(configuration)}`,
1602
1576
  uiPathActivityTypeId: rc.activityTypeId ?? '',
1603
1577
  errorState: { issues: [] },
1578
+ ...(executionType ? { executionType } : {}),
1604
1579
  },
1605
1580
  activityMetadata: {
1606
1581
  activity: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.47.0",
3
+ "version": "6.47.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",
@@ -93,5 +93,5 @@
93
93
  "@types/node": "^22.7.0",
94
94
  "esbuild": "^0.28.1"
95
95
  },
96
- "gitref": "e0223e1b46cdf1eb1f4ab072c970824f52b87eeb"
96
+ "gitref": "16b96902c3da22af8e0fc3cfc8a53edcc832f04c"
97
97
  }