@uipath/maestro-builder-sdk 6.36.0 → 6.37.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.
Files changed (38) hide show
  1. package/dist/api-index.md +28 -27
  2. package/dist/api-members.md +94 -93
  3. package/dist/bpmn/bpmn-sdk.d.ts +38 -9
  4. package/dist/bpmn/bpmn-sdk.js +104 -28
  5. package/dist/bpmn/check.js +64 -0
  6. package/dist/bpmn/connector.js +3 -0
  7. package/dist/bpmn/declared-vars.js +10 -3
  8. package/dist/bpmn/decompile.js +38 -10
  9. package/dist/bpmn/intsvc.d.ts +9 -10
  10. package/dist/bpmn/intsvc.js +31 -18
  11. package/dist/bpmn/registry-types.json +30 -24
  12. package/dist/bpmn/resource-key-pattern.d.ts +38 -0
  13. package/dist/bpmn/resource-key-pattern.js +47 -0
  14. package/dist/bpmn/serialize.js +22 -24
  15. package/dist/bpmn/typed-node.d.ts +17 -0
  16. package/dist/bpmn/typed-node.js +19 -0
  17. package/dist/cli-library.js +3 -1
  18. package/dist/core/cli-library.d.ts +8 -2
  19. package/dist/core/cli-library.js +6 -4
  20. package/dist/core/connector-resolve-error.d.ts +7 -1
  21. package/dist/core/event-checks.js +2 -2
  22. package/dist/core/lookups.d.ts +22 -0
  23. package/dist/core/lookups.js +34 -1
  24. package/dist/core/synthesized-definition.d.ts +15 -0
  25. package/dist/core/synthesized-definition.js +22 -0
  26. package/dist/registry/library-build/context.d.ts +16 -0
  27. package/dist/registry/library-build/context.js +32 -5
  28. package/dist/registry/prepare/actions.d.ts +15 -0
  29. package/dist/registry/prepare/actions.js +12 -1
  30. package/dist/registry/prepare/integration-service.d.ts +105 -0
  31. package/dist/registry/prepare/integration-service.js +218 -0
  32. package/dist/registry/prepare/messages.d.ts +41 -1
  33. package/dist/registry/prepare/messages.js +82 -1
  34. package/dist/registry/prepare/pipeline.js +73 -15
  35. package/dist/registry/uip/commands.d.ts +8 -0
  36. package/dist/registry/uip/commands.js +12 -0
  37. package/dist/serialize.js +11 -0
  38. package/package.json +2 -2
@@ -35,12 +35,13 @@ import { enrichEntry } from "../library-build/enrich.js";
35
35
  import { expandGenericForConnector, genericTemplatesByOp } from "../library-build/generic-expand.js";
36
36
  import { planLibrary } from "../library-build/plan.js";
37
37
  import { MemoryResponseCache } from "../uip/response-cache.js";
38
- import { registryCatalog } from "./actions.js";
38
+ import { refreshRegistryCatalog, registryCatalog } from "./actions.js";
39
39
  import { chooseConnection, listConnections, lookupConnection, mergeBindings, restoreBindings, snapshotBindings, solutionConnectionIds, } from "./connections.js";
40
40
  import { prepareEvent } from "./event.js";
41
+ import { integrationServiceEntry } from "./integration-service.js";
41
42
  import { descriptorUsage } from "./handoff.js";
42
43
  import { ResolutionsExhausted, allParentsResolved, resolvedParentValues, writeResolutions } from "./ledger.js";
43
- import { PREPARE_COMMAND, PrepareRefusal, ambiguousLabelsMessage, connectionChoiceLine, bindingsLine, candidateLabel, connectionLine, generatedModulesLine, genericActionNeedsObjectMessage, inputFieldNote, flagDiffersFromSourceLine, keptSchemaMessage, labelTakenMessage, lookupVocabularyLines, missingGenericSchemaMessage, missingParentsNote, nextLine, noCanonicalEntryMessage, objectFlagsOnlyForGenericMessage, objectNoteLine, objectRecordedLine, parentFieldNamesMismatchMessage, parentOnlyMessage, prefixed, preparedSummaryLine, rejectedParentFieldsMessage, rerunAgainstLine, resolvedParentsNote, registryGetFailedMessage, sharedLabelMessage, sourceLabelSuffix, tsNote, partlyUnreadableLabelLine, unreadableLabelLine, unresolvedOperationMessage, } from "./messages.js";
44
+ import { PREPARE_COMMAND, PrepareRefusal, ambiguousLabelsMessage, connectionChoiceLine, bindingsLine, bpmnConnectorUsageLines, candidateLabel, connectionLine, generatedModulesLine, genericActionNeedsObjectMessage, inputFieldNote, flagDiffersFromSourceLine, keptSchemaMessage, labelTakenMessage, lookupVocabularyLines, missingGenericSchemaMessage, missingParentsNote, nextLine, noCanonicalEntryMessage, objectFlagsOnlyForGenericMessage, objectNoteLine, objectRecordedLine, parentFieldNamesMismatchMessage, parentOnlyMessage, prefixed, preparedFromIntegrationServiceLine, actionCanonicalizedLine, catalogRefreshFailedLine, refreshingCatalogLine, preparedSummaryLine, rejectedParentFieldsMessage, rerunAgainstLine, resolvedParentsNote, registryGetFailedMessage, sharedLabelMessage, sourceLabelSuffix, tsNote, partlyUnreadableLabelLine, unreadableLabelLine, unresolvedOperationMessage, } from "./messages.js";
44
45
  import { ObjectMatchRefusal, RESOLUTIONS_FILENAME, matchObject, recordObjectResolution } from "./objects.js";
45
46
  import { countInputFields, keepPreparedSchema, lookupSpecsFromOverlay, mergeFilesInto, parentFields as overlayParentFields, schemaActionParents, } from "./overlay.js";
46
47
  import { declaredParents, objectActionRequest, objectActionSpecs, parseFields } from "./parents.js";
@@ -326,13 +327,21 @@ export async function prepareConnector(options, ports) {
326
327
  return prepareConnector({ ...options, ...labels, connectionId: chosenId, refreshLookups: true }, ports);
327
328
  }
328
329
  }
329
- /** Everything after stage 0, against one settled connection. */
330
- async function prepareOnConnection(options, ports, connected) {
330
+ /**
331
+ * Everything after stage 0, against one settled connection. `registryRefresh`
332
+ * is set on the one re-entry after `registry pull --force` (below), so the
333
+ * pull runs at most once per command.
334
+ */
335
+ async function prepareOnConnection(options, ports, connected, registryRefresh) {
331
336
  const cwd = ports.cwd ?? process.cwd();
332
337
  const info = (line) => ports.reporter.info(line);
333
338
  const warn = (line) => ports.reporter.warn(line);
334
339
  const command = ports.prepareCommand ?? PREPARE_COMMAND;
335
- const { connectorKey, action } = options;
340
+ const { connectorKey } = options;
341
+ // Rebound to the activity's own action id when Integration Service supplies
342
+ // the entry, so the overlay path, the summary and the handoff all spell the
343
+ // id the entry goes by rather than the author's `--action`.
344
+ let action = options.action;
336
345
  const fieldPairs = options.fields ?? [];
337
346
  const parentFields = parseFields(fieldPairs);
338
347
  const outShown = options.out ?? defaultOverlayOut(cwd);
@@ -341,7 +350,8 @@ async function prepareOnConnection(options, ports, connected) {
341
350
  const jsonOnly = options.jsonOnly ?? false;
342
351
  const { connectionId, bound, rollback } = connected;
343
352
  const ctx = createBuildContext({ client: ports.client, caches: ports.caches ?? memoryCaches(), reporter: ports.reporter, concurrency: 1, timeoutMs: ports.timeoutMs }, { connectionId, parentFields });
344
- const nodeType = `uipath.connector.${connectorKey}.${action}`;
353
+ let nodeType = `uipath.connector.${connectorKey}.${action}`;
354
+ let fromIntegrationService;
345
355
  const actionProbe = await registryProbe(ctx, nodeType);
346
356
  if ("miss" in actionProbe) {
347
357
  // Not an activity. Connector EVENTS live one namespace over, and their
@@ -375,20 +385,52 @@ async function prepareOnConnection(options, ports, connected) {
375
385
  throw new PrepareRefusal(registryGetFailedMessage(connectorKey, action, probes), "REGISTRY_GET_FAILED");
376
386
  }
377
387
  const catalog = await registryCatalog(ports.client, connectorKey, ports.timeoutMs);
378
- throw new PrepareRefusal(unresolvedOperationMessage({ connectorKey, name: action, probes, catalog }), "OPERATION_UNKNOWN");
388
+ // A catalog that serves NOTHING for the connector — no action, no event, and
389
+ // the search itself answered — is a connector the Flow registry does not
390
+ // carry, not a misspelt action on one it does. Integration Service still
391
+ // serves it, and a BPMN connector task needs nothing more.
392
+ if (catalog.failure === undefined && catalog.actions.length === 0 && catalog.events.length === 0) {
393
+ // The probes and the search answer from the CLI's local catalog copy,
394
+ // which never refreshes itself. Pull once and look again before
395
+ // concluding anything: a stale copy would send a connector the catalog
396
+ // does serve down the BPMN-only path, and the summary would state it.
397
+ if (registryRefresh === undefined) {
398
+ info(refreshingCatalogLine(connectorKey));
399
+ const refreshed = await refreshRegistryCatalog(ports.client, ports.timeoutMs);
400
+ if (!refreshed.ok)
401
+ warn(catalogRefreshFailedLine(refreshed.reason));
402
+ return prepareOnConnection(options, ports, connected, refreshed);
403
+ }
404
+ const prepared = await integrationServiceEntry(ctx, { connectorKey, action });
405
+ if ("miss" in prepared) {
406
+ throw new PrepareRefusal(unresolvedOperationMessage({ connectorKey, name: action, probes, catalog, integrationService: prepared.miss, registryRefresh }), "OPERATION_UNKNOWN");
407
+ }
408
+ info(preparedFromIntegrationServiceLine(connectorKey, prepared.activity, registryRefresh));
409
+ if (prepared.action !== action)
410
+ info(actionCanonicalizedLine(action, prepared.action));
411
+ action = prepared.action;
412
+ nodeType = prepared.entry.nodeType;
413
+ fromIntegrationService = prepared;
414
+ }
415
+ else {
416
+ throw new PrepareRefusal(unresolvedOperationMessage({ connectorKey, name: action, probes, catalog }), "OPERATION_UNKNOWN");
417
+ }
379
418
  }
380
- const payload = ctx.caches.registry.read(actionProbe.name);
419
+ // The registry reply this entry came from, or none when Integration Service
420
+ // supplied it — then there is no node to read parents from and the sidecar
421
+ // is built from the synthesized node instead.
422
+ const payload = fromIntegrationService === undefined && "name" in actionProbe ? ctx.caches.registry.read(actionProbe.name) : undefined;
381
423
  // The registry's own declaration of parent inputs, read from the same reply.
382
- const declared = declaredParents(payload);
383
- let entry = extractCanonical(nodeOf(payload));
424
+ const declared = payload === undefined ? [] : declaredParents(payload);
425
+ let entry = fromIntegrationService?.entry ?? extractCanonical(nodeOf(payload));
384
426
  if (entry === undefined)
385
427
  throw new PrepareRefusal(noCanonicalEntryMessage(nodeType), "NO_CANONICAL_ENTRY");
386
428
  if (options.version)
387
429
  entry.version = options.version;
388
430
  if (parentFields.size > 0) {
389
- const request = objectActionRequest(payload, parentFields);
431
+ const request = payload === undefined ? undefined : objectActionRequest(payload, parentFields);
390
432
  if (request === undefined) {
391
- throw new PrepareRefusal(parentFieldNamesMismatchMessage([...parentFields.keys()], objectActionSpecs(payload)), "PARENT_FIELDS_MISMATCH");
433
+ throw new PrepareRefusal(parentFieldNamesMismatchMessage([...parentFields.keys()], payload === undefined ? [] : objectActionSpecs(payload)), "PARENT_FIELDS_MISMATCH");
392
434
  }
393
435
  entry.operation.customFieldsRequestDetails = request;
394
436
  }
@@ -422,11 +464,14 @@ async function prepareOnConnection(options, ports, connected) {
422
464
  else {
423
465
  if (objectName || options.allObjects)
424
466
  throw new PrepareRefusal(objectFlagsOnlyForGenericMessage(), "OBJECT_NOT_GENERIC");
425
- entry = await enrichEntry(ctx, entry); // full schema via --connection-id
467
+ // An Integration Service entry IS the describe; there is nothing to enrich it with.
468
+ if (fromIntegrationService === undefined)
469
+ entry = await enrichEntry(ctx, entry); // full schema via --connection-id
426
470
  preparedEntries = [entry];
427
471
  }
428
472
  const entryNodeType = entry.nodeType;
429
- const plan = planLibrary(preparedEntries, (requestedNodeType) => (requestedNodeType === entryNodeType ? nodeOf(payload) : undefined));
473
+ const sidecarNode = fromIntegrationService?.node ?? nodeOf(payload);
474
+ const plan = planLibrary(preparedEntries, (requestedNodeType) => (requestedNodeType === entryNodeType ? sidecarNode : undefined));
430
475
  for (const line of plan.warnings)
431
476
  warn(line);
432
477
  const kept = keepPreparedSchema(out, entryNodeType, plan.files, parentFields, objectName);
@@ -501,7 +546,20 @@ async function prepareOnConnection(options, ports, connected) {
501
546
  warn(missingParentsNote(connectorKey, action, actionParents, missing, parentFields, command));
502
547
  }
503
548
  }
504
- if (!jsonOnly) {
549
+ if (fromIntegrationService !== undefined) {
550
+ // BPMN is the family that compiles this entry, so the handoff is its call,
551
+ // whether or not a module was generated; the Flow import is never repointed.
552
+ const required = fromIntegrationService.entry.inputSchema?.fields ?? [];
553
+ const params = fromIntegrationService.entry.operation.parameters ?? [];
554
+ const fields = [
555
+ ...params.filter((f) => f.required === true).map((f) => ({ name: String(f.name), type: String(f.dataType ?? "string") })),
556
+ ...required.filter((f) => f.required === true).map((f) => ({ name: String(f.name), type: String(f.type ?? f.dataType ?? "string") })),
557
+ ];
558
+ for (const line of bpmnConnectorUsageLines(connectorKey, action, fields, pyOr(bound?.connection, "<binding-name>"), pyOr(bound?.folder, "<folder-binding-name>"))) {
559
+ info(nextLine(line));
560
+ }
561
+ }
562
+ else if (!jsonOnly) {
505
563
  // Print what was bound, so the last line of output is a call the reader
506
564
  // can paste rather than `<binding-name>` placeholders. `or`, not `??`: an
507
565
  // empty symbolic name is a placeholder in Python's eyes too.
@@ -17,7 +17,15 @@ export declare function connectionArgs(connectionId?: string): string[];
17
17
  export declare function fieldArgs(parentFields: ReadonlyMap<string, string> | Readonly<Record<string, string>> | undefined): string[];
18
18
  export declare function registrySearchConnectors(): string[];
19
19
  export declare function registrySearch(query: string): string[];
20
+ /**
21
+ * `uip maestro flow registry pull --force`: refresh the CLI's local copy of the
22
+ * Flow node catalog, which `registry get` and `registry search` answer from and
23
+ * which never refreshes itself.
24
+ */
25
+ export declare function registryPull(): string[];
20
26
  export declare function registryGet(nodeType: string, connectionId?: string): string[];
27
+ /** `uip is activities list <key> --output json`: the connector's activity catalog — curated activities with their object and HTTP method, and the generic record verbs. No connection needed. */
28
+ export declare function isActivitiesList(connectorKey: string): string[];
21
29
  export declare function isConnectorsMetadata(connectorKey: string): string[];
22
30
  export declare function isResourcesDescribeOperation(connectorKey: string, objectName: string, operation: string, connectionId?: string, parentFields?: ReadonlyMap<string, string> | Readonly<Record<string, string>>): string[];
23
31
  export declare function isResourcesDescribeObject(connectorKey: string, objectName: string, connectionId?: string): string[];
@@ -28,9 +28,21 @@ export function registrySearchConnectors() {
28
28
  export function registrySearch(query) {
29
29
  return [UIP, "maestro", "flow", "registry", "search", query, "--output", "json"];
30
30
  }
31
+ /**
32
+ * `uip maestro flow registry pull --force`: refresh the CLI's local copy of the
33
+ * Flow node catalog, which `registry get` and `registry search` answer from and
34
+ * which never refreshes itself.
35
+ */
36
+ export function registryPull() {
37
+ return [UIP, "maestro", "flow", "registry", "pull", "--force"];
38
+ }
31
39
  export function registryGet(nodeType, connectionId) {
32
40
  return [UIP, "maestro", "flow", "registry", "get", nodeType, "--output", "json", ...connectionArgs(connectionId)];
33
41
  }
42
+ /** `uip is activities list <key> --output json`: the connector's activity catalog — curated activities with their object and HTTP method, and the generic record verbs. No connection needed. */
43
+ export function isActivitiesList(connectorKey) {
44
+ return [UIP, "is", "activities", "list", connectorKey, "--output", "json"];
45
+ }
34
46
  export function isConnectorsMetadata(connectorKey) {
35
47
  return [UIP, "is", "connectors", "metadata", connectorKey, "--output", "json"];
36
48
  }
package/dist/serialize.js CHANGED
@@ -22,6 +22,7 @@ import { resolveVersionCarried } from './core/nodes/versioned.js';
22
22
  import { indexCarriedDefinitions } from './core/carried-definitions.js';
23
23
  import { formFieldJsonSchema, formFieldSettingsWire, wireFormFieldType } from './core/form-field-type.js';
24
24
  import { ConnectorResolveError } from './core/connector-resolve-error.js';
25
+ import { synthesizedDefinitionRefusal } from './core/synthesized-definition.js';
25
26
  import { connectionConnectors } from './bindings-v2.js';
26
27
  import { BindingRefusal, GUID_RE, bindingLabelRefusal, bindingMissingMessage, missingBindingLabels } from './core/binding-messages.js';
27
28
  import { ByoaRefusal, byoaUnverified } from './core/byoa.js';
@@ -5225,6 +5226,10 @@ export function serialize(built, opts = {}) {
5225
5226
  addEdge(scope, t, id);
5226
5227
  return [{ node: id, port: successPort(type) }];
5227
5228
  }
5229
+ // An entry `prepare` synthesized from Integration Service compiles in BPMN only.
5230
+ const noDefinition = synthesizedDefinitionRefusal(rc);
5231
+ if (noDefinition)
5232
+ throw noDefinition;
5228
5233
  const id = stepUid(scope, step.name);
5229
5234
  const node = makeNode(rc.nodeType, id, step.name, { parentId, requestedVersion: step.options?.version, def: rc.v1def });
5230
5235
  declareListOutputType(node, rc);
@@ -5594,6 +5599,12 @@ export function serialize(built, opts = {}) {
5594
5599
  if (!opts.library)
5595
5600
  throw new Error(`inline agent "${step.name}"'s connector tool needs a library (pass --library / set $FLOW_SDK_LIBRARY_JSON).`);
5596
5601
  const rc = opts.library.resolve(tr.connector, tr.operation, tr.version, tr.object);
5602
+ // An entry `prepare` synthesized from Integration Service compiles in
5603
+ // BPMN only — for a tool as for a step: `connectorToolDef` reads the
5604
+ // same definition, and a synthesized one has no form or handles.
5605
+ const noDefinition = synthesizedDefinitionRefusal(rc);
5606
+ if (noDefinition)
5607
+ throw noDefinition;
5597
5608
  tdef = connectorToolDef(rc);
5598
5609
  label = tr.name ?? rc.v1def?.display?.label ?? tr.operation;
5599
5610
  // The connection rides the same three places it does for a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.36.0",
3
+ "version": "6.37.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",
@@ -93,5 +93,5 @@
93
93
  "@types/node": "^22.7.0",
94
94
  "esbuild": "^0.28.1"
95
95
  },
96
- "gitref": "6eb5a3b4536c8fe021771e7dd0ad44c76dd30cfe"
96
+ "gitref": "e7e986c269c7f0f0b561327523501319eb350cdd"
97
97
  }