@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
@@ -56,6 +56,21 @@ export interface RegistryCatalog {
56
56
  */
57
57
  failure?: string;
58
58
  }
59
+ /** Whether `registry pull --force` refreshed the local catalog copy, or why not. */
60
+ export type RegistryRefresh = {
61
+ ok: true;
62
+ } | {
63
+ ok: false;
64
+ reason: string;
65
+ };
66
+ /**
67
+ * `uip maestro flow registry pull --force`: refresh the local catalog copy the
68
+ * probes and the search answer from. It never refreshes itself, so before
69
+ * `prepare` concludes that the catalog serves nothing for a connector it pulls
70
+ * once and looks again; a stale copy would otherwise send a connector the
71
+ * catalog does serve down the BPMN-only path, and state it as fact.
72
+ */
73
+ export declare function refreshRegistryCatalog(client: UipClient, timeoutMs?: number): Promise<RegistryRefresh>;
59
74
  /**
60
75
  * `registry search <key>`, read for both catalogs. This runs only on the
61
76
  * failure path, to tell the author what the catalog does serve.
@@ -18,7 +18,7 @@
18
18
  */
19
19
  import { compareCodePoints, sortedStrings } from "../compat/compare.js";
20
20
  import { editDistance } from "../../core/edit-distance.js";
21
- import { registrySearch } from "../uip/commands.js";
21
+ import { registryPull, registrySearch } from "../uip/commands.js";
22
22
  import { failureReason, findJsonDocument, tail } from "../uip/envelope.js";
23
23
  import { isPlainObject, pyOr } from "./support.js";
24
24
  /**
@@ -141,6 +141,17 @@ export function registryEventIds(payload, connectorKey) {
141
141
  forms: ["trigger", "event"].filter((form) => forms.get(id).has(form)),
142
142
  }));
143
143
  }
144
+ /**
145
+ * `uip maestro flow registry pull --force`: refresh the local catalog copy the
146
+ * probes and the search answer from. It never refreshes itself, so before
147
+ * `prepare` concludes that the catalog serves nothing for a connector it pulls
148
+ * once and looks again; a stale copy would otherwise send a connector the
149
+ * catalog does serve down the BPMN-only path, and state it as fact.
150
+ */
151
+ export async function refreshRegistryCatalog(client, timeoutMs) {
152
+ const result = await client.run(registryPull(), timeoutMs === undefined ? undefined : { timeoutMs });
153
+ return result.code === 0 ? { ok: true } : { ok: false, reason: failureReason(result) };
154
+ }
144
155
  /**
145
156
  * `registry search <key>`, read for both catalogs. This runs only on the
146
157
  * failure path, to tell the author what the catalog does serve.
@@ -0,0 +1,105 @@
1
+ import { SYNTHESIZED_FROM_INTEGRATION_SERVICE } from "../../core/synthesized-definition.js";
2
+ import { type BuildContext } from "../library-build/context.js";
3
+ import type { LibraryEntry } from "../model/library.js";
4
+ /** The marker a synthesized sidecar carries; Flow refuses a definition that has it. One owner, `core/`, so the writer and the refuser cannot drift. */
5
+ export { SYNTHESIZED_FROM_INTEGRATION_SERVICE };
6
+ /** One row of `uip is activities list`, the fields this module reads. */
7
+ export interface IsActivity {
8
+ /** The activity's own name, PascalCase: `CreateTestSet`. */
9
+ name: string;
10
+ displayName: string;
11
+ description: string;
12
+ /** The IS object the activity addresses: `TestSet`. */
13
+ objectName: string;
14
+ /** The HTTP verb as the catalog spells it: `POST`, `GETBYID`, `PATCH`, … */
15
+ method: string;
16
+ }
17
+ /** Why the Integration Service path could not prepare the action. */
18
+ export type IntegrationServiceMiss =
19
+ /** The catalog could not be listed (`reason`: the CLI's own words), or lists no curated activity (no `reason`). */
20
+ {
21
+ kind: "no-catalog";
22
+ reason?: string;
23
+ }
24
+ /** The catalog lists curated activities, none of which is the action; their ids, for the refusal. */
25
+ | {
26
+ kind: "no-such-activity";
27
+ activities: string[];
28
+ }
29
+ /** The activity's HTTP method maps to no `is resources` verb, so there is no describe to read. */
30
+ | {
31
+ kind: "no-operation";
32
+ activity: IsActivity;
33
+ }
34
+ /** The activity exists but `is resources describe` returned no schema for it. */
35
+ | {
36
+ kind: "no-schema";
37
+ activity: IsActivity;
38
+ operation: string;
39
+ };
40
+ export interface IntegrationServicePrepared {
41
+ entry: LibraryEntry;
42
+ /**
43
+ * The action id the entry goes by: the activity's own name in kebab case,
44
+ * whatever spelling the author gave (`--action "Create Test Set"` prepares
45
+ * `create-test-set`). The overlay path and the handoff use it.
46
+ */
47
+ action: string;
48
+ /** The registry-shaped node `planLibrary` builds the sidecar from. */
49
+ node: Record<string, unknown>;
50
+ activity: IsActivity;
51
+ /** The `is resources` verb the describe was read under (`Create`, `Retrieve`, …). */
52
+ operation: string;
53
+ }
54
+ /**
55
+ * The action id an activity goes by: its PascalCase name in kebab case —
56
+ * `CreateTestSet` → `create-test-set`, `AssignTestCasesToReq` →
57
+ * `assign-test-cases-to-req`, `CreateV2Attachment` → `create-v2-attachment`.
58
+ * A run of capitals stays one word (`GetPDFReport` → `get-pdf-report`).
59
+ */
60
+ export declare function activityActionId(name: string): string;
61
+ /** The curated rows of an activities listing, in the catalog's order. */
62
+ export declare function curatedActivities(rows: readonly unknown[]): IsActivity[];
63
+ /**
64
+ * The curated activity an author's action names: by action id first
65
+ * (`create-test-set`), then by the activity's own name or display name,
66
+ * case-insensitively — `CreateTestSet`, `"Create Test Set"` and `create test set`
67
+ * all reach it. The spellings are compared both as given and in kebab case, so a
68
+ * display name with spaces matches whether or not the author kebab-cased it.
69
+ */
70
+ export declare function matchActivity(activities: readonly IsActivity[], action: string): IsActivity | undefined;
71
+ /** The `is resources` verb an activity's HTTP method reads under; `undefined` for a verb the catalog has no describe for. */
72
+ export declare function describeOperationFor(method: string): string | undefined;
73
+ /**
74
+ * Prepare one action from Integration Service: the entry and the node the
75
+ * sidecar is built from, or why not.
76
+ */
77
+ export declare function integrationServiceEntry(ctx: BuildContext, input: {
78
+ connectorKey: string;
79
+ action: string;
80
+ }): Promise<IntegrationServicePrepared | {
81
+ miss: IntegrationServiceMiss;
82
+ }>;
83
+ /**
84
+ * The library entry for one described activity — the shape `extractCanonical`
85
+ * writes from a registry node, filled from the describe instead: the IS
86
+ * object and verb, the path and its parameters, the request fields as the
87
+ * input schema. `httpMethod` keeps the catalog's spelling (`GETBYID` for a
88
+ * get-by-id, as registry entries do); the wire maps it. The entry goes by the
89
+ * activity's own action id, never the author's spelling: a display name would
90
+ * put spaces (or a `/`) in the overlay path and a second entry next to the id.
91
+ */
92
+ export declare function synthesizeEntry(input: {
93
+ connectorKey: string;
94
+ activity: IsActivity;
95
+ operation: string;
96
+ described: Record<string, unknown>;
97
+ connector: unknown;
98
+ }): LibraryEntry;
99
+ /**
100
+ * The node `planLibrary` turns into the `.v1def.json` sidecar — the little a
101
+ * BPMN compile reads of one (`inputDefinition.fields` for the body, the model's
102
+ * type and service type) and the marker Flow refuses on. `buildV1Definition`
103
+ * keeps every key here.
104
+ */
105
+ export declare function synthesizeNode(entry: LibraryEntry, described: Record<string, unknown>): Record<string, unknown>;
@@ -0,0 +1,218 @@
1
+ /**
2
+ * Prepare a connector operation the Flow node catalog does not serve, from
3
+ * Integration Service itself.
4
+ *
5
+ * `prepare` names an operation through `uip maestro flow registry get
6
+ * uipath.connector.<key>.<action>`: the registry node is the library entry's
7
+ * source and its `.v1def.json` sidecar. Some connectors have no node there at
8
+ * all, yet Integration Service serves them in full: `uip is activities list
9
+ * <key>` lists the curated activities with their object and HTTP method, and
10
+ * `uip is resources describe <key> <object> --operation <verb>` returns the
11
+ * path, the path/query parameters and the request and response fields. Told
12
+ * "op not in library", an author hand-fills `.activity('Intsvc.ActivityExecution')`
13
+ * tasks and gets the identity rows wrong.
14
+ *
15
+ * A BPMN connector task needs no registry node: the `sendTask` carries its own
16
+ * identity (`objectName`, `method`, `path`, `connectorKey`) and rows, which is
17
+ * exactly what the describe returns. So when the catalog serves NOTHING for the
18
+ * connector — not a misspelt action on a connector it does serve — this builds
19
+ * the library entry and a sidecar from the activity catalog and the describe,
20
+ * and the ordinary overlay write, descriptor regeneration and handoff follow.
21
+ * The sidecar is marked `synthesizedFrom: "integration-service"`: a Flow node
22
+ * embeds the registry's whole definition (form, handles, model), which no
23
+ * describe can supply, so Flow's compile and check refuse the entry with
24
+ * CONNECTOR_NO_FLOW_DEFINITION rather than emit a node the designer cannot open.
25
+ *
26
+ * Every `uip` call goes through the {@link BuildContext}; everything else is
27
+ * pure over the parsed replies.
28
+ */
29
+ import { SCHEMA_VERSION, normalizeFieldKeys, pick } from "../library-build/canonical.js";
30
+ import { SYNTHESIZED_FROM_INTEGRATION_SERVICE } from "../../core/synthesized-definition.js";
31
+ import { isActivitiesCatalog, isConnectorGet, isDescribeOperation } from "../library-build/context.js";
32
+ import { HTTP_METHOD_TO_OPERATION } from "../library-build/enrich.js";
33
+ import { get, pyOr } from "../library-build/py.js";
34
+ import { isPlainObject } from "./support.js";
35
+ /** The marker a synthesized sidecar carries; Flow refuses a definition that has it. One owner, `core/`, so the writer and the refuser cannot drift. */
36
+ export { SYNTHESIZED_FROM_INTEGRATION_SERVICE };
37
+ /**
38
+ * The action id an activity goes by: its PascalCase name in kebab case —
39
+ * `CreateTestSet` → `create-test-set`, `AssignTestCasesToReq` →
40
+ * `assign-test-cases-to-req`, `CreateV2Attachment` → `create-v2-attachment`.
41
+ * A run of capitals stays one word (`GetPDFReport` → `get-pdf-report`).
42
+ */
43
+ export function activityActionId(name) {
44
+ return name
45
+ .replace(/([a-z0-9])([A-Z])/g, "$1-$2")
46
+ .replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2")
47
+ .replace(/[\s_]+/g, "-")
48
+ .toLowerCase();
49
+ }
50
+ /** The curated rows of an activities listing, in the catalog's order. */
51
+ export function curatedActivities(rows) {
52
+ const out = [];
53
+ for (const row of rows) {
54
+ if (!isPlainObject(row))
55
+ continue;
56
+ if (String(pyOr(get(row, "IsCurated"), "")).toLowerCase() !== "yes")
57
+ continue;
58
+ const name = String(pyOr(get(row, "Name"), "")).trim();
59
+ const objectName = String(pyOr(get(row, "ObjectName"), "")).trim();
60
+ const method = String(pyOr(get(row, "MethodName"), "")).trim().toUpperCase();
61
+ if (!name || !objectName || objectName === "N/A" || !method || method === "N/A")
62
+ continue;
63
+ out.push({
64
+ name,
65
+ displayName: String(pyOr(get(row, "DisplayName"), name)),
66
+ description: String(pyOr(get(row, "Description"), "")),
67
+ objectName,
68
+ method,
69
+ });
70
+ }
71
+ return out;
72
+ }
73
+ /**
74
+ * The curated activity an author's action names: by action id first
75
+ * (`create-test-set`), then by the activity's own name or display name,
76
+ * case-insensitively — `CreateTestSet`, `"Create Test Set"` and `create test set`
77
+ * all reach it. The spellings are compared both as given and in kebab case, so a
78
+ * display name with spaces matches whether or not the author kebab-cased it.
79
+ */
80
+ export function matchActivity(activities, action) {
81
+ const wanted = action.trim().toLowerCase();
82
+ const wantedId = activityActionId(action.trim());
83
+ return (activities.find((a) => activityActionId(a.name) === wanted)
84
+ ?? activities.find((a) => a.name.toLowerCase() === wanted)
85
+ ?? activities.find((a) => a.displayName.trim().toLowerCase() === wanted)
86
+ ?? activities.find((a) => activityActionId(a.displayName) === wantedId));
87
+ }
88
+ /** The `is resources` verb an activity's HTTP method reads under; `undefined` for a verb the catalog has no describe for. */
89
+ export function describeOperationFor(method) {
90
+ return HTTP_METHOD_TO_OPERATION.get(method.toUpperCase());
91
+ }
92
+ /**
93
+ * Prepare one action from Integration Service: the entry and the node the
94
+ * sidecar is built from, or why not.
95
+ */
96
+ export async function integrationServiceEntry(ctx, input) {
97
+ const { connectorKey, action } = input;
98
+ const catalog = await isActivitiesCatalog(ctx, connectorKey);
99
+ if ("failure" in catalog)
100
+ return { miss: { kind: "no-catalog", reason: catalog.failure } };
101
+ const activities = curatedActivities(catalog.rows);
102
+ if (activities.length === 0)
103
+ return { miss: { kind: "no-catalog" } };
104
+ const activity = matchActivity(activities, action);
105
+ if (!activity)
106
+ return { miss: { kind: "no-such-activity", activities: activities.map((a) => activityActionId(a.name)) } };
107
+ // No guess for a method the table does not list: a describe read under the
108
+ // wrong verb returns another operation's path, and the entry would target it.
109
+ const operation = describeOperationFor(activity.method);
110
+ if (operation === undefined)
111
+ return { miss: { kind: "no-operation", activity } };
112
+ const described = await isDescribeOperation(ctx, connectorKey, activity.objectName, operation);
113
+ if (!isPlainObject(described))
114
+ return { miss: { kind: "no-schema", activity, operation } };
115
+ const connector = await isConnectorGet(ctx, connectorKey);
116
+ const entry = synthesizeEntry({ connectorKey, activity, operation, described, connector });
117
+ return { entry, action: activityActionId(activity.name), node: synthesizeNode(entry, described), activity, operation };
118
+ }
119
+ /**
120
+ * The library entry for one described activity — the shape `extractCanonical`
121
+ * writes from a registry node, filled from the describe instead: the IS
122
+ * object and verb, the path and its parameters, the request fields as the
123
+ * input schema. `httpMethod` keeps the catalog's spelling (`GETBYID` for a
124
+ * get-by-id, as registry entries do); the wire maps it. The entry goes by the
125
+ * activity's own action id, never the author's spelling: a display name would
126
+ * put spaces (or a `/`) in the overlay path and a second entry next to the id.
127
+ */
128
+ export function synthesizeEntry(input) {
129
+ const { connectorKey, activity, operation, described, connector } = input;
130
+ const op = pyOr(pick(described, "Operation", "operation"), {});
131
+ const path = String(pyOr(pick(op, "Path", "path"), ""));
132
+ const method = String(pyOr(pick(op, "Method", "method"), activity.method)).toUpperCase();
133
+ const label = String(pyOr(pick(op, "Curated", "curated"), activity.displayName));
134
+ const parameters = normalizeFieldKeys(pyOr(pick(described, "Parameters", "parameters"), []));
135
+ const requestFields = normalizeFieldKeys(pyOr(pick(described, "RequestFields", "requestFields"), []));
136
+ const responseFields = normalizeFieldKeys(pyOr(pick(described, "ResponseFields", "responseFields"), []));
137
+ const connectorName = String(pyOr(get(connector, "Name"), connectorKey));
138
+ const icon = String(pyOr(get(connector, "Image"), ""));
139
+ const entry = {
140
+ schemaVersion: SCHEMA_VERSION,
141
+ nodeType: `uipath.connector.${connectorKey}.${activityActionId(activity.name)}`,
142
+ version: "1.0.0",
143
+ category: "connector",
144
+ tags: ["connector", "activity"],
145
+ connector: { key: connectorKey, name: connectorName },
146
+ operation: {
147
+ name: operation,
148
+ objectName: activity.objectName,
149
+ objectDisplayName: String(pyOr(pick(described, "DisplayName", "displayName"), activity.objectName)),
150
+ httpMethod: method,
151
+ path,
152
+ pathTemplate: path,
153
+ subType: "standard",
154
+ supportsStreaming: false,
155
+ activityType: "Curated",
156
+ parameters,
157
+ },
158
+ display: {
159
+ label,
160
+ description: activity.description || `(${connectorName}) ${label}`,
161
+ icon,
162
+ iconBackground: "",
163
+ iconBackgroundDark: "",
164
+ operationLabel: label,
165
+ },
166
+ runtime: {
167
+ bpmnType: "bpmn:SendTask",
168
+ serviceType: "Intsvc.ActivityExecution",
169
+ activityConfigurationVersion: "v1",
170
+ requiresConnection: true,
171
+ requiresFolderKey: true,
172
+ requiresConnectionForSchema: true,
173
+ },
174
+ inputSchema: { fields: requestFields },
175
+ outputSchema: { fields: responseFields },
176
+ provenance: {
177
+ source: SYNTHESIZED_FROM_INTEGRATION_SERVICE,
178
+ activity: activity.name,
179
+ method: activity.method,
180
+ },
181
+ };
182
+ return entry;
183
+ }
184
+ /**
185
+ * The node `planLibrary` turns into the `.v1def.json` sidecar — the little a
186
+ * BPMN compile reads of one (`inputDefinition.fields` for the body, the model's
187
+ * type and service type) and the marker Flow refuses on. `buildV1Definition`
188
+ * keeps every key here.
189
+ */
190
+ export function synthesizeNode(entry, described) {
191
+ const e = entry;
192
+ const outputFields = normalizeFieldKeys(pyOr(pick(described, "ResponseFields", "responseFields"), []));
193
+ return {
194
+ nodeType: e.nodeType,
195
+ version: e.version,
196
+ category: e.category,
197
+ tags: e.tags,
198
+ display: { label: e.display.label, description: e.display.description, icon: e.display.icon },
199
+ model: {
200
+ type: "bpmn:SendTask",
201
+ serviceType: "Intsvc.ActivityExecution",
202
+ bindings: { resource: "connection", propertyAttribute: "ConnectionId" },
203
+ context: [
204
+ { name: "connectorKey", value: e.connector.key },
205
+ { name: "objectName", value: e.operation.objectName },
206
+ { name: "operation", value: e.operation.name },
207
+ { name: "method", value: e.operation.httpMethod },
208
+ { name: "path", value: e.operation.path },
209
+ { name: "connection", value: "" },
210
+ { name: "folderKey", value: "" },
211
+ { name: "activityConfigurationVersion", value: "v1" },
212
+ ],
213
+ },
214
+ inputDefinition: { fields: e.inputSchema.fields },
215
+ outputDefinition: { output: { fields: outputFields }, error: {} },
216
+ synthesizedFrom: SYNTHESIZED_FROM_INTEGRATION_SERVICE,
217
+ };
218
+ }
@@ -21,7 +21,8 @@
21
21
  * `core/cli-spelling.ts`) without this module reading the environment.
22
22
  */
23
23
  import { Refusal } from "../errors.js";
24
- import { type RegistryCatalog } from "./actions.js";
24
+ import { type RegistryCatalog, type RegistryRefresh } from "./actions.js";
25
+ import type { IntegrationServiceMiss } from "./integration-service.js";
25
26
  export declare const PREFIX = "prepare-connector: ";
26
27
  /** The spelling the Python hard-coded into every pasteable re-run. */
27
28
  export declare const PREPARE_COMMAND = "npx flow-sdk registry prepare";
@@ -101,6 +102,10 @@ export declare function unresolvedOperationMessage(input: {
101
102
  name: string;
102
103
  probes: readonly ProbeMiss[];
103
104
  catalog: RegistryCatalog;
105
+ /** What Integration Service said, when the catalog served nothing for the connector and IS was asked instead. */
106
+ integrationService?: IntegrationServiceMiss;
107
+ /** Whether the catalog was refreshed before that conclusion. */
108
+ registryRefresh?: RegistryRefresh;
104
109
  }): string;
105
110
  /**
106
111
  * A `registry get` probe failed for a reason other than "Node not found" — an
@@ -133,6 +138,41 @@ export declare function inputFieldNote(count: number | undefined | null): string
133
138
  export declare function tsNote(jsonOnly: boolean, connectorKey: string): string;
134
139
  /** The action path's success line. */
135
140
  export declare function preparedSummaryLine(nodeType: string, out: string, ts: string, variants: number, fieldNote: string): string;
141
+ /**
142
+ * "The catalog serves no node for <key>", worded by what was measured: a fact
143
+ * after a forced pull, the local copy's answer when the pull failed or did not
144
+ * run (`registry get` and `registry search` answer from a copy that never
145
+ * refreshes itself).
146
+ */
147
+ export declare function catalogServesNothingPhrase(key: string, refresh: RegistryRefresh | undefined): string;
148
+ /** The progress line before the one `registry pull --force` the fallback runs. */
149
+ export declare function refreshingCatalogLine(key: string): string;
150
+ /** The warning when that pull failed; the fallback continues against the local copy. */
151
+ export declare function catalogRefreshFailedLine(reason: string): string;
152
+ /** The note when the author's `--action` spelling was not the entry's id. */
153
+ export declare function actionCanonicalizedLine(given: string, actionId: string): string;
154
+ /**
155
+ * What Integration Service serves when the Flow catalog serves nothing for a
156
+ * connector: the curated activities' action ids, so the author re-runs with
157
+ * one of them, or why the one they named could not be read.
158
+ */
159
+ export declare function integrationServiceLines(key: string, name: string, miss: IntegrationServiceMiss, refresh?: RegistryRefresh): string[];
160
+ /** The action path's source line when Integration Service supplied the entry. */
161
+ export declare function preparedFromIntegrationServiceLine(key: string, activity: {
162
+ name: string;
163
+ objectName: string;
164
+ method: string;
165
+ }, refresh?: RegistryRefresh): string;
166
+ /**
167
+ * The pasteable BPMN call for an operation prepared from Integration Service —
168
+ * the only family that compiles it, so the Flow import handoff is not printed
169
+ * for it. Required inputs are named with their type; the rest are left to the
170
+ * descriptor the overlay carries.
171
+ */
172
+ export declare function bpmnConnectorUsageLines(connectorKey: string, action: string, required: ReadonlyArray<{
173
+ name: string;
174
+ type: string;
175
+ }>, boundConnection?: string, boundFolder?: string): string[];
136
176
  /** Why this run did not overwrite the overlay (`_keep_prepared_schema`). */
137
177
  export declare function keptSchemaMessage(action: string, kept: number, discarded: number): string;
138
178
  /** The set was SHAPED right but resolved to nothing new: a VALUE is wrong for this connection. */
@@ -23,6 +23,7 @@
23
23
  import { Refusal, messageOf } from "../errors.js";
24
24
  import { commentText } from "../../core/comment-text.js";
25
25
  import { plausibleMatches } from "./actions.js";
26
+ import { HTTP_METHOD_TO_OPERATION } from "../library-build/enrich.js";
26
27
  import { pyGet, pyOr, pyRepr, pyStrAny, pyTruthy } from "./support.js";
27
28
  export const PREFIX = "prepare-connector: ";
28
29
  /** The spelling the Python hard-coded into every pasteable re-run. */
@@ -178,7 +179,7 @@ function sharedTokens(wanted, candidate) {
178
179
  * offline validators accept and the runtime dispatches to the wrong operation.
179
180
  */
180
181
  export function unresolvedOperationMessage(input) {
181
- const { connectorKey: key, name, probes, catalog } = input;
182
+ const { connectorKey: key, name, probes, catalog, integrationService, registryRefresh } = input;
182
183
  const lines = [
183
184
  `${PREFIX}\`${key} ${name}\` is neither an action nor an event the registry serves:`,
184
185
  ...probeLines(probes),
@@ -221,6 +222,8 @@ export function unresolvedOperationMessage(input) {
221
222
  else {
222
223
  lines.push("", `\`registry search ${key}\` lists no action for ${key} either.`);
223
224
  }
225
+ if (integrationService !== undefined)
226
+ lines.push("", ...integrationServiceLines(key, name, integrationService, registryRefresh));
224
227
  lines.push("", "`registry get` and `registry search` answer from the CLI's local copy of the catalog.", "If it looks stale, refresh it first: `uip maestro flow registry pull --force`.",
225
228
  // Named `flow` on purpose, whatever family you are authoring: this is the
226
229
  // catalog `prepare` itself reads, and `uip maestro bpmn registry pull` fills
@@ -311,6 +314,84 @@ export function tsNote(jsonOnly, connectorKey) {
311
314
  export function preparedSummaryLine(nodeType, out, ts, variants, fieldNote) {
312
315
  return `${PREFIX}${nodeType} → ${out}/ (${ts}, ${variants} variant(s), ${fieldNote})`;
313
316
  }
317
+ /**
318
+ * "The catalog serves no node for <key>", worded by what was measured: a fact
319
+ * after a forced pull, the local copy's answer when the pull failed or did not
320
+ * run (`registry get` and `registry search` answer from a copy that never
321
+ * refreshes itself).
322
+ */
323
+ export function catalogServesNothingPhrase(key, refresh) {
324
+ if (refresh?.ok === true)
325
+ return `the Flow node catalog, refreshed with \`uip maestro flow registry pull --force\`, serves no node for ${key}`;
326
+ const why = refresh === undefined ? "it was not refreshed" : `refreshing it failed: ${refresh.reason}`;
327
+ return `the CLI's local copy of the Flow node catalog serves no node for ${key} (${why})`;
328
+ }
329
+ /** The progress line before the one `registry pull --force` the fallback runs. */
330
+ export function refreshingCatalogLine(key) {
331
+ return ` the local catalog copy serves no node for ${key}; refreshing it (uip maestro flow registry pull --force) and looking again.`;
332
+ }
333
+ /** The warning when that pull failed; the fallback continues against the local copy. */
334
+ export function catalogRefreshFailedLine(reason) {
335
+ return `${PREFIX}registry pull --force failed (${reason}); continuing with the local catalog copy, which may be stale.`;
336
+ }
337
+ /** The note when the author's `--action` spelling was not the entry's id. */
338
+ export function actionCanonicalizedLine(given, actionId) {
339
+ return ` action: "${given}" is Integration Service activity ${actionId}; the entry is written under that id.`;
340
+ }
341
+ /**
342
+ * What Integration Service serves when the Flow catalog serves nothing for a
343
+ * connector: the curated activities' action ids, so the author re-runs with
344
+ * one of them, or why the one they named could not be read.
345
+ */
346
+ export function integrationServiceLines(key, name, miss, refresh) {
347
+ const phrase = catalogServesNothingPhrase(key, refresh);
348
+ const head = `${phrase[0].toUpperCase()}${phrase.slice(1)}, so Integration Service was asked instead (\`uip is activities list ${key}\`).`;
349
+ if (miss.kind === "no-catalog") {
350
+ return miss.reason === undefined
351
+ ? [head, `It lists no curated activity for ${key} either — the connector may need enabling on this tenant, or the key may be misspelt.`]
352
+ : [head, `That call failed: ${miss.reason}`, "Fix that (the connection, the login, the connector's enablement on this tenant), then re-run."];
353
+ }
354
+ if (miss.kind === "no-operation") {
355
+ return [
356
+ head,
357
+ `It lists \`${name}\` (${miss.activity.name}: ${miss.activity.objectName} ${miss.activity.method}), but ${miss.activity.method} maps to no`,
358
+ `\`is resources\` operation (${[...HTTP_METHOD_TO_OPERATION.keys()].join(", ")} do), so there is no describe to prepare it from.`,
359
+ "Author it as an `.activity('Intsvc.ActivityExecution')` task from `uip is activities list` and `uip is resources describe` by hand.",
360
+ ];
361
+ }
362
+ if (miss.kind === "no-schema") {
363
+ return [
364
+ head,
365
+ `It lists \`${name}\` (${miss.activity.name}: ${miss.activity.objectName} ${miss.activity.method}), but`,
366
+ `\`uip is resources describe ${key} ${miss.activity.objectName} --operation ${miss.operation} --connection-id <id>\` returned no schema for it,`,
367
+ "so there is nothing to prepare from. Check the connection, then re-run.",
368
+ ];
369
+ }
370
+ const close = plausibleMatches(name, miss.activities);
371
+ const lines = [head];
372
+ if (close.length > 0)
373
+ lines.push(`Closest activity to "${name}": ${close.slice(0, 3).join(", ")}`);
374
+ lines.push(`Activities Integration Service serves for ${key} (re-run with one as --action):`, ...miss.activities.map((a) => ` ${a}`));
375
+ return lines;
376
+ }
377
+ /** The action path's source line when Integration Service supplied the entry. */
378
+ export function preparedFromIntegrationServiceLine(key, activity, refresh) {
379
+ return (` source: Integration Service activity ${activity.name} (${activity.objectName} ${activity.method}) — ${catalogServesNothingPhrase(key, refresh)}, `
380
+ + "so this operation compiles in BPMN only (a Flow step or agent tool needs the registry's node definition).");
381
+ }
382
+ /**
383
+ * The pasteable BPMN call for an operation prepared from Integration Service —
384
+ * the only family that compiles it, so the Flow import handoff is not printed
385
+ * for it. Required inputs are named with their type; the rest are left to the
386
+ * descriptor the overlay carries.
387
+ */
388
+ export function bpmnConnectorUsageLines(connectorKey, action, required, boundConnection = "<binding-name>", boundFolder = "<folder-binding-name>") {
389
+ const inputs = required.map((f) => `${/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(f.name) ? f.name : JSON.stringify(f.name)}: /* ${commentText(f.type)}, required */`).join(", ");
390
+ return [
391
+ `.connector("<id>", "${connectorKey}", "${action}", { ${inputs} }, { connection: "${boundConnection}", folder: "${boundFolder}" })`,
392
+ "this operation was prepared from Integration Service, so it compiles in BPMN only; `bpmn check` and `bpmn compile` read the overlay from ./connectors-local (or --connectors-local <dir>).",
393
+ ];
394
+ }
314
395
  /** Why this run did not overwrite the overlay (`_keep_prepared_schema`). */
315
396
  export function keptSchemaMessage(action, kept, discarded) {
316
397
  return (`${PREFIX}kept the prepared schema for ${action} ` +