@uipath/maestro-builder-sdk 6.105.0 → 6.106.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.
@@ -1,9 +1,10 @@
1
1
  import { reportResult } from '../cli-result.js';
2
2
  import { createHash } from "node:crypto";
3
3
  import { mkdir, readFile, realpath, rename, rm, stat, symlink, unlink, writeFile, } from "node:fs/promises";
4
+ import { existsSync } from "node:fs";
4
5
  import { join, resolve } from "node:path";
5
6
  import { writeJsonFile } from "../core/json-file.js";
6
- import { CURRENT_LINK, LIBRARY_JSON_DIR, LIBRARY_MARKDOWN_DIR, cacheEntry, libraryCacheRoot, referencedConnectorKeys, } from "../core/library-cache.js";
7
+ import { CURRENT_LINK, LIBRARY_JSON_DIR, LIBRARY_MARKDOWN_DIR, cacheEntry, libraryCacheRoot, referencedConnectorKeys, resolveCachedLibrary, } from "../core/library-cache.js";
7
8
  import { extractLibrary } from "./extractor.js";
8
9
  import { materializeRegistry } from "./materializer.js";
9
10
  import { curatedOverlayIdentity } from "./curated-overlay.js";
@@ -136,8 +137,14 @@ async function isFileAsync(path) {
136
137
  * of these: bytes that do not match their sidecar are refused, not routed around.
137
138
  */
138
139
  export class ArchiveUnavailableError extends Error {
139
- constructor(message) {
140
+ status;
141
+ /**
142
+ * @param status The HTTP status when the server answered one: a 404 says no
143
+ * library is published there, anything else may pass.
144
+ */
145
+ constructor(message, status) {
140
146
  super(message);
147
+ this.status = status;
141
148
  this.name = "ArchiveUnavailableError";
142
149
  }
143
150
  }
@@ -153,7 +160,7 @@ async function reach(url) {
153
160
  throw new ArchiveUnavailableError(`Could not download ${url}: ${detail}`);
154
161
  }
155
162
  if (!response.ok) {
156
- throw new ArchiveUnavailableError(`Could not download ${url}: HTTP ${response.status} ${response.statusText}`);
163
+ throw new ArchiveUnavailableError(`Could not download ${url}: HTTP ${response.status} ${response.statusText}`, response.status);
157
164
  }
158
165
  return response;
159
166
  }
@@ -376,7 +383,17 @@ export async function run(argv) {
376
383
  catch (error) {
377
384
  if (!(error instanceof ArchiveUnavailableError))
378
385
  throw error;
379
- return await pullWithoutArchive(argv, error.message);
386
+ // A library pulled earlier is still the library: compile keeps using
387
+ // it, so fetching beside it would mix the two. Say the download failed.
388
+ // The pulled cache, or a library FLOW_SDK_LIBRARY_JSON names: either is
389
+ // what compile reads, and a fetch beside it would bypass it.
390
+ const cached = resolveCachedLibrary(cacheDir) ?? configuredLibrary();
391
+ if (cached !== undefined && explicitLibraryRequest(argv) === undefined) {
392
+ console.error(`registry pull: ${error.message}. The library pulled earlier is kept (${cached}); ` +
393
+ "run the pull again once the download can be reached.");
394
+ return 1;
395
+ }
396
+ return await pullWithoutArchive(argv, error);
380
397
  }
381
398
  const archiveSha256 = await archiveIdentity(archive);
382
399
  const overlaySha256 = await curatedOverlayIdentity();
@@ -473,7 +490,8 @@ export async function run(argv) {
473
490
  * author's next `check` names it, and on Automation Suite it may simply not be
474
491
  * approved.
475
492
  */
476
- async function pullWithoutArchive(argv, why) {
493
+ async function pullWithoutArchive(argv, unavailable) {
494
+ const why = unavailable.message;
477
495
  const overlayDir = value(argv, "--connectors-local") ?? workPath("connectors-local");
478
496
  const named = repeated(argv, "--connector");
479
497
  const keys = named.length > 0
@@ -496,7 +514,11 @@ async function pullWithoutArchive(argv, why) {
496
514
  console.error("registry pull: the connector library is unavailable and no connector is referenced by this project yet. " +
497
515
  "Name one with `--connector <key>` to fetch it through uip.");
498
516
  reportResult({ library: null, overlay: resolve(overlayDir), fetched: [] });
499
- return 0;
517
+ // Nothing published there (a 404), or no route to it at all, as on an
518
+ // air-gapped Automation Suite: no library is to be had, and nothing is
519
+ // referenced yet, so there is nothing to fail. A server error may pass,
520
+ // and a CI step must not read it as success.
521
+ return unavailable.status === undefined || unavailable.status === 404 ? 0 : 1;
500
522
  }
501
523
  console.error(`registry pull: fetching ${keys.join(", ")} through uip into ${overlayDir} instead.`);
502
524
  const result = await fetchConnectors(keys, {
@@ -532,6 +554,11 @@ async function pullWithoutArchive(argv, why) {
532
554
  (result.modules.length > 0 ? `, with ${result.modules.join(", ")}` : "") + ".");
533
555
  return result.failed.length > 0 || namedUnlisted.length > 0 ? 1 : 0;
534
556
  }
557
+ /** The library FLOW_SDK_LIBRARY_JSON names, when it holds an index. */
558
+ function configuredLibrary() {
559
+ const dir = process.env.FLOW_SDK_LIBRARY_JSON || undefined;
560
+ return dir !== undefined && existsSync(join(dir, "index.json")) ? dir : undefined;
561
+ }
535
562
  /**
536
563
  * The flag (with its value) that asked for a specific library, or `undefined`
537
564
  * for the default request the uip fallback may answer.
@@ -156,6 +156,10 @@ export async function searchTenantOperations(options, client = defaultUipClient(
156
156
  const key = catalogConnectorKey(nodeType);
157
157
  if (key === null)
158
158
  continue;
159
+ // A node the tenant lists but has gated off (a feature flag): describe and
160
+ // check could not fetch it, so it is not offered.
161
+ if (getCI(row, "AvailableOnTenant") === false)
162
+ continue;
159
163
  if (connector && key.toLowerCase() !== connector)
160
164
  continue;
161
165
  const label = text(getCI(row, "DisplayName"));
@@ -176,14 +180,36 @@ export async function searchTenantOperations(options, client = defaultUipClient(
176
180
  definitionPath: "",
177
181
  });
178
182
  }
179
- const warning = getCI(envelope, "Warning");
183
+ const warnings = [getCI(envelope, "Warning")].filter((w) => typeof w === "string" && w.trim() !== "").map((w) => w.trim());
184
+ // The catalog lists operations, not the objects a generic operation takes, so
185
+ // a query naming an object can miss here where the library would hit.
186
+ if (matches.length === 0 && tokens.length > 0) {
187
+ warnings.push("The tenant's catalog names operations, not the objects a generic operation works on, " +
188
+ "so a query naming an object (\"salesforce contact\") can find nothing here. " +
189
+ "Search by the connector and operation (\"salesforce create record\") before treating this as a miss.");
190
+ }
180
191
  return {
181
192
  total: matches.length,
182
193
  operations: matches.slice(0, options.limit ?? DEFAULT_SEARCH_LIMIT),
183
194
  source: "tenant",
184
- ...(typeof warning === "string" && warning.trim() !== "" ? { warning: warning.trim() } : {}),
195
+ ...(warnings.length > 0 ? { warning: warnings.join(" ") } : {}),
185
196
  };
186
197
  }
198
+ /**
199
+ * Whether `dir` holds a library index. A reader that throws (outside Node with
200
+ * no host reader: READ_TEXT_UNAVAILABLE) reads as none, so the search answers
201
+ * from the tenant or says why, rather than rejecting.
202
+ */
203
+ function hasIndex(dir) {
204
+ if (dir === undefined)
205
+ return false;
206
+ try {
207
+ return defaultReadText()(join(dir, "index.json")) !== undefined;
208
+ }
209
+ catch {
210
+ return false;
211
+ }
212
+ }
187
213
  function value(args, name) {
188
214
  const index = args.indexOf(name);
189
215
  return index >= 0 ? args[index + 1] : undefined;
@@ -198,8 +224,7 @@ export async function run(argv) {
198
224
  // A named library, by `--library` or FLOW_SDK_LIBRARY_JSON, is searched (or
199
225
  // refused) as it always was.
200
226
  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);
227
+ const tenant = named === undefined && fetchDefinitionsEnabled() && !hasIndex(resolved);
203
228
  const libraryPath = tenant ? undefined : resolved;
204
229
  if (!libraryPath && !tenant) {
205
230
  // Say why. A bare usage line here read as "no match" to an agent deciding
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.105.0",
3
+ "version": "6.106.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",
@@ -60,6 +60,7 @@
60
60
  "flow-decompile": "./dist/decompile-cli.js",
61
61
  "flow-merge": "./dist/merge-cli.js",
62
62
  "flow-check": "./dist/check-cli.js",
63
+ "flow-build": "./dist/build-cli.js",
63
64
  "case-compile": "./dist/case/compile-cli.js",
64
65
  "case-check": "./dist/case/check-cli.js",
65
66
  "case-decompile": "./dist/case/decompile-cli.js",
@@ -84,7 +85,8 @@
84
85
  "flow-check-baseline",
85
86
  "flow-decompile-scripts",
86
87
  "flow-script-metadata",
87
- "flow-pipeline-strict"
88
+ "flow-pipeline-strict",
89
+ "flow-build"
88
90
  ],
89
91
  "files": [
90
92
  "dist",
@@ -121,5 +123,5 @@
121
123
  "@types/node": "^22.7.0",
122
124
  "esbuild": "^0.28.1"
123
125
  },
124
- "gitref": "73e97cc8d46b9b8679fb8f70f7a38262590f51e0"
126
+ "gitref": "b84c2c90fcc6512f55ef828fb753ba84a698af3d"
125
127
  }