@uipath/maestro-builder-sdk 6.96.7 → 6.97.1

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 (55) hide show
  1. package/README.md +2 -1
  2. package/dist/api-index.md +62 -62
  3. package/dist/api-members.md +292 -289
  4. package/dist/bpmn/bpmn-sdk.d.ts +36 -0
  5. package/dist/bpmn/check-cli.js +8 -4
  6. package/dist/bpmn/compile-cli.js +4 -3
  7. package/dist/bpmn/decompile-cli.js +15 -1
  8. package/dist/bpmn/decompile-pipeline.d.ts +5 -0
  9. package/dist/bpmn/decompile-pipeline.js +3 -3
  10. package/dist/bpmn/decompile-stamp.d.ts +13 -0
  11. package/dist/bpmn/decompile-stamp.js +8 -0
  12. package/dist/bpmn/decompile.d.ts +17 -4
  13. package/dist/bpmn/decompile.js +19 -10
  14. package/dist/bpmn/merge-cli.js +32 -4
  15. package/dist/bpmn/merge-source.d.ts +2 -0
  16. package/dist/bpmn/merge-source.js +1 -0
  17. package/dist/bpmn/serialize.js +7 -1
  18. package/dist/bpmn/typed-node.d.ts +7 -0
  19. package/dist/bpmn/typed-node.js +50 -26
  20. package/dist/bpmn-api.md +3 -0
  21. package/dist/case/check-cli.js +4 -2
  22. package/dist/case/compile-cli.js +14 -9
  23. package/dist/case/decompile-cli.d.ts +1 -1
  24. package/dist/case/decompile-cli.js +12 -2
  25. package/dist/check-cli.js +12 -6
  26. package/dist/cli/commands/registry.js +2 -0
  27. package/dist/compile-cli.js +16 -10
  28. package/dist/core/cli-library.d.ts +18 -2
  29. package/dist/core/cli-library.js +25 -5
  30. package/dist/core/library.d.ts +74 -2
  31. package/dist/core/library.js +88 -11
  32. package/dist/decompile-cli.js +17 -2
  33. package/dist/decompile-stamp.d.ts +13 -0
  34. package/dist/decompile-stamp.js +7 -1
  35. package/dist/emit.js +5 -8
  36. package/dist/merge-cli.js +51 -1
  37. package/dist/registry/curated-overlay.d.ts +11 -0
  38. package/dist/registry/curated-overlay.js +27 -0
  39. package/dist/registry/describe-cli.d.ts +3 -0
  40. package/dist/registry/describe-cli.js +38 -6
  41. package/dist/registry/fetch/fetch-connectors.d.ts +21 -0
  42. package/dist/registry/fetch/fetch-connectors.js +84 -0
  43. package/dist/registry/fetch/fetch-definitions.d.ts +61 -0
  44. package/dist/registry/fetch/fetch-definitions.js +447 -0
  45. package/dist/registry/fetch/flow-requests.d.ts +14 -0
  46. package/dist/registry/fetch/flow-requests.js +81 -0
  47. package/dist/registry/fetch/with-fetched-definitions.d.ts +46 -0
  48. package/dist/registry/fetch/with-fetched-definitions.js +211 -0
  49. package/dist/registry/library-build/events.d.ts +9 -2
  50. package/dist/registry/library-build/events.js +4 -10
  51. package/dist/registry/pull-cli.d.ts +9 -0
  52. package/dist/registry/pull-cli.js +150 -10
  53. package/dist/registry/search-cli.d.ts +25 -0
  54. package/dist/registry/search-cli.js +94 -10
  55. package/package.json +4 -3
@@ -4,6 +4,11 @@ import { PULL_COMMAND } from "../core/cli-spelling.js";
4
4
  import { resolveLibraryDir } from "../core/library-cache.js";
5
5
  import { defaultReadText } from "../core/read-text.js";
6
6
  import { dirname, join } from "node:path";
7
+ import { catalogConnectorKey } from "./library-build/canonical.js";
8
+ import { fetchDefinitionsEnabled, uipUnavailableReason } from "./fetch/fetch-definitions.js";
9
+ import { defaultUipClient } from "./uip/client.js";
10
+ import { registrySearchConnectors } from "./uip/commands.js";
11
+ import { failureReason, getCI, isSuccess, parseEnvelope, tail } from "./uip/envelope.js";
7
12
  export const DEFAULT_SEARCH_LIMIT = 20;
8
13
  const USAGE = "Usage: flow-sdk registry search [query] [--library <dir>] [--library-md <dir>] [--connector <key>] [--limit <n>]";
9
14
  function text(value) {
@@ -115,6 +120,70 @@ export async function searchRegistryOperations(options) {
115
120
  });
116
121
  return { total: matches.length, operations };
117
122
  }
123
+ /**
124
+ * The search over the tenant's live catalog, for when no library was pulled
125
+ * (docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md §3.5): every connector node type
126
+ * `uip maestro flow registry search` lists, matched with the same tokens and
127
+ * `--connector` rule as the library search. On Automation Suite this is the
128
+ * curated catalog, which no published library describes.
129
+ */
130
+ /** No library, and uip cannot be asked: a blocked mode (exit 2), as "no library cached" is with fetching off. */
131
+ export class TenantSearchBlocked extends Error {
132
+ name = "TenantSearchBlocked";
133
+ }
134
+ export async function searchTenantOperations(options, client = defaultUipClient()) {
135
+ const unavailable = await uipUnavailableReason(client);
136
+ if (unavailable !== undefined) {
137
+ throw new TenantSearchBlocked(`No connector library is cached, and the tenant's catalog could not be searched through uip instead: ${unavailable}.`);
138
+ }
139
+ const result = await client.run(registrySearchConnectors());
140
+ if (result.code !== 0)
141
+ throw new Error(`The tenant's catalog could not be searched: ${failureReason(result)}`);
142
+ // Read as every other registry reply is: in any key case, and a reply that is
143
+ // not a successful envelope with a list is a failed search, never "no match".
144
+ const envelope = parseEnvelope(result.stdout);
145
+ const data = getCI(envelope, "Data");
146
+ if (!isSuccess(envelope) || !Array.isArray(data)) {
147
+ throw new Error(`The tenant's catalog could not be searched: uip answered ${tail(result.stdout.trim()) || "nothing"}`);
148
+ }
149
+ const rows = data;
150
+ const tokens = queryTokens(options.query);
151
+ const connector = options.connector?.trim().toLowerCase();
152
+ const matches = [];
153
+ for (const row of rows) {
154
+ const nodeType = text(getCI(row, "NodeType"));
155
+ // Every form, start triggers included: a trigger-only operation is still found.
156
+ const key = catalogConnectorKey(nodeType);
157
+ if (key === null)
158
+ continue;
159
+ if (connector && key.toLowerCase() !== connector)
160
+ continue;
161
+ const label = text(getCI(row, "DisplayName"));
162
+ // The library search also matches the operation name run together
163
+ // (`getwidget`) and the description; the catalog row carries both.
164
+ const operation = nodeType.slice(nodeType.lastIndexOf(".") + 1);
165
+ const haystack = [label, nodeType, key, operation.replace(/-/g, ""), text(getCI(row, "Description"))].join(" ").toLowerCase();
166
+ if (!tokens.every((token) => haystack.includes(token)))
167
+ continue;
168
+ matches.push({
169
+ nodeType,
170
+ version: text(getCI(row, "Version")),
171
+ connectorKey: key,
172
+ label,
173
+ activityType: "",
174
+ objectName: "",
175
+ operationName: "",
176
+ definitionPath: "",
177
+ });
178
+ }
179
+ const warning = getCI(envelope, "Warning");
180
+ return {
181
+ total: matches.length,
182
+ operations: matches.slice(0, options.limit ?? DEFAULT_SEARCH_LIMIT),
183
+ source: "tenant",
184
+ ...(typeof warning === "string" && warning.trim() !== "" ? { warning: warning.trim() } : {}),
185
+ };
186
+ }
118
187
  function value(args, name) {
119
188
  const index = args.indexOf(name);
120
189
  return index >= 0 ? args[index + 1] : undefined;
@@ -123,8 +192,16 @@ export async function run(argv) {
123
192
  // Same resolution as compile and check: named, else the environment, else the
124
193
  // shared cache `registry pull` filled. Requiring the flag here while the other
125
194
  // verbs defaulted it was the inconsistency an author hit first.
126
- const libraryPath = resolveLibraryDir(value(argv, "--library"));
127
- if (!libraryPath) {
195
+ const explicit = value(argv, "--library");
196
+ const resolved = resolveLibraryDir(explicit);
197
+ // No library pulled, and none named: the tenant's live catalog through uip.
198
+ // A named library, by `--library` or FLOW_SDK_LIBRARY_JSON, is searched (or
199
+ // refused) as it always was.
200
+ const named = explicit ?? (process.env.FLOW_SDK_LIBRARY_JSON || undefined);
201
+ const tenant = named === undefined && fetchDefinitionsEnabled()
202
+ && (resolved === undefined || defaultReadText()(join(resolved, "index.json")) === undefined);
203
+ const libraryPath = tenant ? undefined : resolved;
204
+ if (!libraryPath && !tenant) {
128
205
  // Say why. A bare usage line here read as "no match" to an agent deciding
129
206
  // between a connector and http(): it took the failed search for a miss.
130
207
  console.error(`No connector library is cached. Run \`${PULL_COMMAND}\`, or pass` +
@@ -152,19 +229,26 @@ export async function run(argv) {
152
229
  .join(" ")
153
230
  .trim();
154
231
  try {
155
- const result = await searchRegistryOperations({
156
- libraryPath,
157
- markdownPath: value(argv, "--library-md"),
158
- query: query || undefined,
159
- connector: value(argv, "--connector"),
160
- limit,
161
- });
232
+ // No library pulled: the tenant's live catalog instead, through uip.
233
+ const result = libraryPath === undefined
234
+ ? await searchTenantOperations({ query: query || undefined, connector: value(argv, "--connector"), limit })
235
+ : await searchRegistryOperations({
236
+ libraryPath,
237
+ markdownPath: value(argv, "--library-md"),
238
+ query: query || undefined,
239
+ connector: value(argv, "--connector"),
240
+ limit,
241
+ });
242
+ // Said where a person reads it, not only in the JSON: an incomplete catalog
243
+ // answering "no match" would read as the connector not existing.
244
+ if (result.warning !== undefined)
245
+ console.error(`registry search: ${result.warning}`);
162
246
  reportResult(result);
163
247
  printResult(JSON.stringify(result, null, 2));
164
248
  return 0;
165
249
  }
166
250
  catch (error) {
167
251
  console.error(error instanceof Error ? error.message : String(error));
168
- return 1;
252
+ return error instanceof TenantSearchBlocked ? 2 : 1;
169
253
  }
170
254
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.96.7",
3
+ "version": "6.97.1",
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",
@@ -76,7 +76,8 @@
76
76
  "json-result",
77
77
  "prepare-resource",
78
78
  "bpmn-merge-source",
79
- "flow-merge-source"
79
+ "flow-merge-source",
80
+ "fetch-definitions"
80
81
  ],
81
82
  "files": [
82
83
  "dist",
@@ -113,5 +114,5 @@
113
114
  "@types/node": "^22.7.0",
114
115
  "esbuild": "^0.28.1"
115
116
  },
116
- "gitref": "0f0cc58b2213886cb7060dda81ed3193235c9d10"
117
+ "gitref": "9ed95e4a157d2c2e05ceb0b3e0634c6d61e6d21e"
117
118
  }