@uipath/aops-tool 1.201.0 → 1.202.0-preview.136

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,23 +1,11 @@
1
- import {
2
- isBrowser
3
- } from "./tool-9qecd4wb.js";
4
- import {
5
- catchError,
6
- getFileSystem
7
- } from "./tool-7eva0peq.js";
8
- import {
9
- AUTH_FILENAME,
10
- DEFAULT_BASE_URL,
11
- UIPATH_HOME_DIR
12
- } from "./tool-5arsyj36.js";
13
1
  import {
14
2
  __commonJS,
15
3
  __require,
16
4
  __toESM
17
- } from "./tool-0v6na3yp.js";
5
+ } from "./tool-1de529jm.js";
18
6
 
19
7
  // ../../node_modules/commander/lib/error.js
20
- var require_error = __commonJS((exports) => {
8
+ var require_error = __commonJS(function(exports) {
21
9
  class CommanderError extends Error {
22
10
  constructor(exitCode, code, message) {
23
11
  super(message);
@@ -41,7 +29,7 @@ var require_error = __commonJS((exports) => {
41
29
  });
42
30
 
43
31
  // ../../node_modules/commander/lib/argument.js
44
- var require_argument = __commonJS((exports) => {
32
+ var require_argument = __commonJS(function(exports) {
45
33
  var { InvalidArgumentError } = require_error();
46
34
 
47
35
  class Argument {
@@ -121,7 +109,7 @@ var require_argument = __commonJS((exports) => {
121
109
  });
122
110
 
123
111
  // ../../node_modules/commander/lib/help.js
124
- var require_help = __commonJS((exports) => {
112
+ var require_help = __commonJS(function(exports) {
125
113
  var { humanReadableArgName } = require_argument();
126
114
 
127
115
  class Help {
@@ -478,7 +466,7 @@ ${itemIndentStr}`);
478
466
  });
479
467
 
480
468
  // ../../node_modules/commander/lib/option.js
481
- var require_option = __commonJS((exports) => {
469
+ var require_option = __commonJS(function(exports) {
482
470
  var { InvalidArgumentError } = require_error();
483
471
 
484
472
  class Option {
@@ -662,7 +650,7 @@ var require_option = __commonJS((exports) => {
662
650
  });
663
651
 
664
652
  // ../../node_modules/commander/lib/suggestSimilar.js
665
- var require_suggestSimilar = __commonJS((exports) => {
653
+ var require_suggestSimilar = __commonJS(function(exports) {
666
654
  var maxDistance = 3;
667
655
  function editDistance(a, b) {
668
656
  if (Math.abs(a.length - b.length) > maxDistance)
@@ -735,11 +723,11 @@ var require_suggestSimilar = __commonJS((exports) => {
735
723
  });
736
724
 
737
725
  // ../../node_modules/commander/lib/command.js
738
- var require_command = __commonJS((exports) => {
726
+ var require_command = __commonJS(function(exports) {
739
727
  var EventEmitter = __require("node:events").EventEmitter;
740
728
  var childProcess = __require("node:child_process");
741
- var path = __require("node:path");
742
- var fs = __require("node:fs");
729
+ var path2 = __require("node:path");
730
+ var fs2 = __require("node:fs");
743
731
  var process2 = __require("node:process");
744
732
  var { Argument, humanReadableArgName } = require_argument();
745
733
  var { CommanderError } = require_error();
@@ -1274,7 +1262,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1274
1262
  this.processedArgs = [];
1275
1263
  }
1276
1264
  _checkForMissingExecutable(executableFile, executableDir, subcommandName) {
1277
- if (fs.existsSync(executableFile))
1265
+ if (fs2.existsSync(executableFile))
1278
1266
  return;
1279
1267
  const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
1280
1268
  const executableMissing = `'${executableFile}' does not exist
@@ -1288,12 +1276,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
1288
1276
  let launchWithNode = false;
1289
1277
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
1290
1278
  function findFile(baseDir, baseName) {
1291
- const localBin = path.resolve(baseDir, baseName);
1292
- if (fs.existsSync(localBin))
1279
+ const localBin = path2.resolve(baseDir, baseName);
1280
+ if (fs2.existsSync(localBin))
1293
1281
  return localBin;
1294
- if (sourceExt.includes(path.extname(baseName)))
1282
+ if (sourceExt.includes(path2.extname(baseName)))
1295
1283
  return;
1296
- const foundExt = sourceExt.find((ext) => fs.existsSync(`${localBin}${ext}`));
1284
+ const foundExt = sourceExt.find((ext) => fs2.existsSync(`${localBin}${ext}`));
1297
1285
  if (foundExt)
1298
1286
  return `${localBin}${foundExt}`;
1299
1287
  return;
@@ -1305,23 +1293,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
1305
1293
  if (this._scriptPath) {
1306
1294
  let resolvedScriptPath;
1307
1295
  try {
1308
- resolvedScriptPath = fs.realpathSync(this._scriptPath);
1296
+ resolvedScriptPath = fs2.realpathSync(this._scriptPath);
1309
1297
  } catch {
1310
1298
  resolvedScriptPath = this._scriptPath;
1311
1299
  }
1312
- executableDir = path.resolve(path.dirname(resolvedScriptPath), executableDir);
1300
+ executableDir = path2.resolve(path2.dirname(resolvedScriptPath), executableDir);
1313
1301
  }
1314
1302
  if (executableDir) {
1315
1303
  let localFile = findFile(executableDir, executableFile);
1316
1304
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
1317
- const legacyName = path.basename(this._scriptPath, path.extname(this._scriptPath));
1305
+ const legacyName = path2.basename(this._scriptPath, path2.extname(this._scriptPath));
1318
1306
  if (legacyName !== this._name) {
1319
1307
  localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
1320
1308
  }
1321
1309
  }
1322
1310
  executableFile = localFile || executableFile;
1323
1311
  }
1324
- launchWithNode = sourceExt.includes(path.extname(executableFile));
1312
+ launchWithNode = sourceExt.includes(path2.extname(executableFile));
1325
1313
  let proc;
1326
1314
  if (process2.platform !== "win32") {
1327
1315
  if (launchWithNode) {
@@ -1910,13 +1898,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
1910
1898
  cmd.helpGroup(this._defaultCommandGroup);
1911
1899
  }
1912
1900
  nameFromFilename(filename) {
1913
- this._name = path.basename(filename, path.extname(filename));
1901
+ this._name = path2.basename(filename, path2.extname(filename));
1914
1902
  return this;
1915
1903
  }
1916
- executableDir(path2) {
1917
- if (path2 === undefined)
1904
+ executableDir(path3) {
1905
+ if (path3 === undefined)
1918
1906
  return this._executableDir;
1919
- this._executableDir = path2;
1907
+ this._executableDir = path3;
1920
1908
  return this;
1921
1909
  }
1922
1910
  helpInformation(contextOptions) {
@@ -2090,7 +2078,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2090
2078
  });
2091
2079
 
2092
2080
  // ../../node_modules/commander/index.js
2093
- var require_commander = __commonJS((exports) => {
2081
+ var require_commander = __commonJS(function(exports) {
2094
2082
  var { Argument } = require_argument();
2095
2083
  var { Command } = require_command();
2096
2084
  var { CommanderError, InvalidArgumentError } = require_error();
@@ -2112,7 +2100,7 @@ var require_commander = __commonJS((exports) => {
2112
2100
  var package_default = {
2113
2101
  name: "@uipath/aops-tool",
2114
2102
  license: "MIT",
2115
- version: "1.201.0",
2103
+ version: "1.202.0-preview.136",
2116
2104
  description: "Manage UiPath StudioAdmin AOps — connections, repos, projects, solutions, pipelines, executions.",
2117
2105
  private: false,
2118
2106
  repository: {
@@ -2156,11 +2144,753 @@ var package_default = {
2156
2144
  }
2157
2145
  };
2158
2146
 
2147
+ // ../filesystem/src/node.ts
2148
+ import { randomUUID } from "node:crypto";
2149
+ import { existsSync } from "node:fs";
2150
+ import * as fs from "node:fs/promises";
2151
+ import * as os from "node:os";
2152
+ import * as path from "node:path";
2153
+ var LOCK_HEARTBEAT_MS = 5000;
2154
+ var LOCK_STALE_MS = 15000;
2155
+ var LOCK_MAX_WAIT_MS = 20000;
2156
+ var LOCK_MAX_HOLD_MS = 60000;
2157
+ var LOCK_RETRY_MIN_MS = 100;
2158
+ var LOCK_RETRY_JITTER_MS = 200;
2159
+
2160
+ class NodeFileSystem {
2161
+ path = {
2162
+ join: path.join,
2163
+ resolve: path.resolve,
2164
+ relative: path.relative,
2165
+ dirname: path.dirname,
2166
+ isAbsolute: path.isAbsolute,
2167
+ basename: path.basename
2168
+ };
2169
+ env = {
2170
+ cwd: process.cwd,
2171
+ homedir: os.homedir,
2172
+ tmpdir: os.tmpdir,
2173
+ getenv: (key) => process.env[key]
2174
+ };
2175
+ utils = {
2176
+ open: async (url) => {
2177
+ const { default: open } = await import("./index-sby22td6.js");
2178
+ await open(url);
2179
+ }
2180
+ };
2181
+ async readFile(path2, options) {
2182
+ try {
2183
+ if (options) {
2184
+ return await fs.readFile(path2, "utf-8");
2185
+ }
2186
+ return await fs.readFile(path2);
2187
+ } catch (error) {
2188
+ if (this.isEnoent(error))
2189
+ return null;
2190
+ throw error;
2191
+ }
2192
+ }
2193
+ async writeFile(filePath, data) {
2194
+ const dir = path.dirname(filePath);
2195
+ if (dir) {
2196
+ await fs.mkdir(dir, { recursive: true });
2197
+ }
2198
+ await fs.writeFile(filePath, data);
2199
+ }
2200
+ async appendFile(filePath, data) {
2201
+ const dir = path.dirname(filePath);
2202
+ if (dir) {
2203
+ await fs.mkdir(dir, { recursive: true });
2204
+ }
2205
+ await fs.appendFile(filePath, data);
2206
+ }
2207
+ async readdir(dirPath) {
2208
+ try {
2209
+ return await fs.readdir(dirPath);
2210
+ } catch (error) {
2211
+ if (this.isEnoent(error))
2212
+ return [];
2213
+ throw error;
2214
+ }
2215
+ }
2216
+ async stat(filePath) {
2217
+ try {
2218
+ const stats = await fs.stat(filePath);
2219
+ return {
2220
+ isFile: () => stats.isFile(),
2221
+ isDirectory: () => stats.isDirectory(),
2222
+ size: stats.size,
2223
+ mtimeMs: stats.mtimeMs
2224
+ };
2225
+ } catch (error) {
2226
+ if (this.isEnoent(error))
2227
+ return null;
2228
+ throw error;
2229
+ }
2230
+ }
2231
+ async exists(filePath) {
2232
+ return existsSync(filePath);
2233
+ }
2234
+ async mkdir(dirPath) {
2235
+ await fs.mkdir(dirPath, { recursive: true });
2236
+ }
2237
+ async acquireLock(lockPath) {
2238
+ const canonicalPath = await this.canonicalizeLockTarget(lockPath);
2239
+ const lockFile = `${canonicalPath}.lock`;
2240
+ const ownerId = randomUUID();
2241
+ const start = Date.now();
2242
+ while (true) {
2243
+ try {
2244
+ await fs.writeFile(lockFile, ownerId, { flag: "wx" });
2245
+ return this.createLockRelease(lockFile, ownerId);
2246
+ } catch (error) {
2247
+ if (!this.hasErrnoCode(error, "EEXIST")) {
2248
+ throw error;
2249
+ }
2250
+ const stats = await fs.stat(lockFile).catch(() => null);
2251
+ if (stats && Date.now() - stats.mtimeMs > LOCK_STALE_MS) {
2252
+ const reclaimed = await fs.rm(lockFile, { force: true }).then(() => true).catch(() => false);
2253
+ if (reclaimed)
2254
+ continue;
2255
+ }
2256
+ if (Date.now() - start > LOCK_MAX_WAIT_MS) {
2257
+ throw new Error(`ELOCKED: timed out waiting for lock on ${canonicalPath}`);
2258
+ }
2259
+ await new Promise((resolve2) => setTimeout(resolve2, LOCK_RETRY_MIN_MS + Math.random() * LOCK_RETRY_JITTER_MS));
2260
+ }
2261
+ }
2262
+ }
2263
+ async canonicalizeLockTarget(lockPath) {
2264
+ const absolute = path.resolve(lockPath);
2265
+ const fullReal = await fs.realpath(absolute).catch(() => null);
2266
+ if (fullReal)
2267
+ return fullReal;
2268
+ const parent = path.dirname(absolute);
2269
+ const base = path.basename(absolute);
2270
+ const canonicalParent = await fs.realpath(parent).catch(() => parent);
2271
+ return path.join(canonicalParent, base);
2272
+ }
2273
+ createLockRelease(lockFile, ownerId) {
2274
+ const heartbeatStart = Date.now();
2275
+ let heartbeatTimer;
2276
+ let stopped = false;
2277
+ const stopHeartbeat = () => {
2278
+ stopped = true;
2279
+ if (heartbeatTimer)
2280
+ clearTimeout(heartbeatTimer);
2281
+ };
2282
+ const scheduleNextHeartbeat = () => {
2283
+ if (stopped)
2284
+ return;
2285
+ if (Date.now() - heartbeatStart >= LOCK_MAX_HOLD_MS) {
2286
+ stopped = true;
2287
+ return;
2288
+ }
2289
+ heartbeatTimer = setTimeout(() => {
2290
+ runHeartbeat();
2291
+ }, LOCK_HEARTBEAT_MS);
2292
+ heartbeatTimer.unref?.();
2293
+ };
2294
+ const runHeartbeat = async () => {
2295
+ if (stopped)
2296
+ return;
2297
+ const current = await fs.readFile(lockFile, "utf-8").catch(() => null);
2298
+ if (stopped)
2299
+ return;
2300
+ if (current !== ownerId) {
2301
+ stopped = true;
2302
+ return;
2303
+ }
2304
+ const now = Date.now() / 1000;
2305
+ await fs.utimes(lockFile, now, now).catch(() => {});
2306
+ scheduleNextHeartbeat();
2307
+ };
2308
+ scheduleNextHeartbeat();
2309
+ let released = false;
2310
+ return async () => {
2311
+ if (released)
2312
+ return;
2313
+ released = true;
2314
+ stopHeartbeat();
2315
+ const current = await fs.readFile(lockFile, "utf-8").catch(() => null);
2316
+ if (current === ownerId) {
2317
+ await fs.rm(lockFile, { force: true });
2318
+ }
2319
+ };
2320
+ }
2321
+ async rm(filePath) {
2322
+ await fs.rm(filePath, { recursive: true, force: true });
2323
+ }
2324
+ async rename(oldPath, newPath) {
2325
+ await fs.rename(oldPath, newPath);
2326
+ }
2327
+ async realpath(filePath) {
2328
+ try {
2329
+ return await fs.realpath(filePath);
2330
+ } catch (error) {
2331
+ if (this.isEnoent(error))
2332
+ return filePath;
2333
+ throw error;
2334
+ }
2335
+ }
2336
+ async getTempDir() {
2337
+ return await fs.mkdtemp(path.join(os.tmpdir(), "uipath-fs-"));
2338
+ }
2339
+ async copyDirectory(sourcePath, destPath) {
2340
+ const sourceStats = await this.stat(sourcePath);
2341
+ if (!sourceStats) {
2342
+ throw new Error(`Source directory does not exist: ${sourcePath}`);
2343
+ }
2344
+ if (!sourceStats.isDirectory()) {
2345
+ throw new Error(`Source path is not a directory: ${sourcePath}`);
2346
+ }
2347
+ await this.mkdir(destPath);
2348
+ const entries = await this.readdir(sourcePath);
2349
+ for (const entry of entries) {
2350
+ const srcEntry = path.join(sourcePath, entry);
2351
+ const destEntry = path.join(destPath, entry);
2352
+ const entryStats = await this.stat(srcEntry);
2353
+ if (!entryStats)
2354
+ continue;
2355
+ if (entryStats.isDirectory()) {
2356
+ await this.copyDirectory(srcEntry, destEntry);
2357
+ } else if (entryStats.isFile()) {
2358
+ const content = await this.readFile(srcEntry);
2359
+ if (content !== null) {
2360
+ await this.writeFile(destEntry, content);
2361
+ }
2362
+ }
2363
+ }
2364
+ }
2365
+ isEnoent(error) {
2366
+ return this.hasErrnoCode(error, "ENOENT");
2367
+ }
2368
+ hasErrnoCode(error, code) {
2369
+ return typeof error === "object" && error !== null && "code" in error && error.code === code;
2370
+ }
2371
+ }
2372
+
2373
+ // ../filesystem/src/index.ts
2374
+ var fsInstance = new NodeFileSystem;
2375
+ var getFileSystem = () => fsInstance;
2376
+
2377
+ // ../common/src/telemetry/pseudonymize.ts
2378
+ var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
2379
+ var PSEUDONYM_HEX_LENGTH = 32;
2380
+ var SHA256_K = new Uint32Array([
2381
+ 1116352408,
2382
+ 1899447441,
2383
+ 3049323471,
2384
+ 3921009573,
2385
+ 961987163,
2386
+ 1508970993,
2387
+ 2453635748,
2388
+ 2870763221,
2389
+ 3624381080,
2390
+ 310598401,
2391
+ 607225278,
2392
+ 1426881987,
2393
+ 1925078388,
2394
+ 2162078206,
2395
+ 2614888103,
2396
+ 3248222580,
2397
+ 3835390401,
2398
+ 4022224774,
2399
+ 264347078,
2400
+ 604807628,
2401
+ 770255983,
2402
+ 1249150122,
2403
+ 1555081692,
2404
+ 1996064986,
2405
+ 2554220882,
2406
+ 2821834349,
2407
+ 2952996808,
2408
+ 3210313671,
2409
+ 3336571891,
2410
+ 3584528711,
2411
+ 113926993,
2412
+ 338241895,
2413
+ 666307205,
2414
+ 773529912,
2415
+ 1294757372,
2416
+ 1396182291,
2417
+ 1695183700,
2418
+ 1986661051,
2419
+ 2177026350,
2420
+ 2456956037,
2421
+ 2730485921,
2422
+ 2820302411,
2423
+ 3259730800,
2424
+ 3345764771,
2425
+ 3516065817,
2426
+ 3600352804,
2427
+ 4094571909,
2428
+ 275423344,
2429
+ 430227734,
2430
+ 506948616,
2431
+ 659060556,
2432
+ 883997877,
2433
+ 958139571,
2434
+ 1322822218,
2435
+ 1537002063,
2436
+ 1747873779,
2437
+ 1955562222,
2438
+ 2024104815,
2439
+ 2227730452,
2440
+ 2361852424,
2441
+ 2428436474,
2442
+ 2756734187,
2443
+ 3204031479,
2444
+ 3329325298
2445
+ ]);
2446
+ var SHA256_INITIAL_STATE = new Uint32Array([
2447
+ 1779033703,
2448
+ 3144134277,
2449
+ 1013904242,
2450
+ 2773480762,
2451
+ 1359893119,
2452
+ 2600822924,
2453
+ 528734635,
2454
+ 1541459225
2455
+ ]);
2456
+ function rotr(value, bits) {
2457
+ return (value >>> bits | value << 32 - bits) >>> 0;
2458
+ }
2459
+ function sha256Hex(input) {
2460
+ const bytes = new TextEncoder().encode(input);
2461
+ const paddedLength = bytes.length + 9 + 63 >> 6 << 6;
2462
+ const buffer = new Uint8Array(paddedLength);
2463
+ buffer.set(bytes);
2464
+ buffer[bytes.length] = 128;
2465
+ const view = new DataView(buffer.buffer);
2466
+ const bitLength = bytes.length * 8;
2467
+ view.setUint32(paddedLength - 8, Math.floor(bitLength / 4294967296));
2468
+ view.setUint32(paddedLength - 4, bitLength >>> 0);
2469
+ const state = SHA256_INITIAL_STATE.slice();
2470
+ const schedule = new Uint32Array(64);
2471
+ for (let offset = 0;offset < paddedLength; offset += 64) {
2472
+ for (let i = 0;i < 16; i++) {
2473
+ schedule[i] = view.getUint32(offset + i * 4);
2474
+ }
2475
+ for (let i = 16;i < 64; i++) {
2476
+ const x = schedule[i - 15];
2477
+ const y = schedule[i - 2];
2478
+ const s0 = (rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3) >>> 0;
2479
+ const s1 = (rotr(y, 17) ^ rotr(y, 19) ^ y >>> 10) >>> 0;
2480
+ schedule[i] = schedule[i - 16] + s0 + schedule[i - 7] + s1 >>> 0;
2481
+ }
2482
+ let a = state[0];
2483
+ let b = state[1];
2484
+ let c = state[2];
2485
+ let d = state[3];
2486
+ let e = state[4];
2487
+ let f = state[5];
2488
+ let g = state[6];
2489
+ let h = state[7];
2490
+ for (let i = 0;i < 64; i++) {
2491
+ const s1 = (rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25)) >>> 0;
2492
+ const ch = (e & f ^ ~e & g) >>> 0;
2493
+ const temp1 = h + s1 + ch + SHA256_K[i] + schedule[i] >>> 0;
2494
+ const s0 = (rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) >>> 0;
2495
+ const maj = (a & b ^ a & c ^ b & c) >>> 0;
2496
+ const temp2 = s0 + maj >>> 0;
2497
+ h = g;
2498
+ g = f;
2499
+ f = e;
2500
+ e = d + temp1 >>> 0;
2501
+ d = c;
2502
+ c = b;
2503
+ b = a;
2504
+ a = temp1 + temp2 >>> 0;
2505
+ }
2506
+ state[0] = state[0] + a >>> 0;
2507
+ state[1] = state[1] + b >>> 0;
2508
+ state[2] = state[2] + c >>> 0;
2509
+ state[3] = state[3] + d >>> 0;
2510
+ state[4] = state[4] + e >>> 0;
2511
+ state[5] = state[5] + f >>> 0;
2512
+ state[6] = state[6] + g >>> 0;
2513
+ state[7] = state[7] + h >>> 0;
2514
+ }
2515
+ let hex = "";
2516
+ for (const word of state) {
2517
+ hex += word.toString(16).padStart(8, "0");
2518
+ }
2519
+ return hex;
2520
+ }
2521
+ function resolveSha256Hex() {
2522
+ try {
2523
+ const nodeCrypto = __require("node:crypto");
2524
+ const createHash = nodeCrypto?.createHash;
2525
+ if (typeof createHash !== "function") {
2526
+ return sha256Hex;
2527
+ }
2528
+ const native = (input) => createHash("sha256").update(input, "utf8").digest("hex");
2529
+ return native("abc") === sha256Hex("abc") ? native : sha256Hex;
2530
+ } catch {
2531
+ return sha256Hex;
2532
+ }
2533
+ }
2534
+ var cachedSha256Hex;
2535
+ function digest(input) {
2536
+ cachedSha256Hex ??= resolveSha256Hex();
2537
+ return cachedSha256Hex(input);
2538
+ }
2539
+ function pseudonymize(input) {
2540
+ return digest(`${PSEUDONYM_DOMAIN}${input}`).slice(0, PSEUDONYM_HEX_LENGTH);
2541
+ }
2542
+
2543
+ // ../common/src/singleton.ts
2544
+ var PREFIX = "@uipath/common/";
2545
+ var _g = globalThis;
2546
+ function singleton(ctorOrName) {
2547
+ const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
2548
+ const key = Symbol.for(PREFIX + name);
2549
+ return {
2550
+ get(fallback) {
2551
+ return _g[key] ?? fallback;
2552
+ },
2553
+ set(value) {
2554
+ _g[key] = value;
2555
+ },
2556
+ clear() {
2557
+ delete _g[key];
2558
+ },
2559
+ getOrInit(factory, guard) {
2560
+ const existing = _g[key];
2561
+ if (existing != null && typeof existing === "object") {
2562
+ if (!guard || guard(existing)) {
2563
+ return existing;
2564
+ }
2565
+ }
2566
+ const instance = factory();
2567
+ _g[key] = instance;
2568
+ return instance;
2569
+ }
2570
+ };
2571
+ }
2572
+
2573
+ // ../common/src/telemetry/supplied-values.ts
2574
+ var suppliedValuesSlot = singleton("TelemetrySuppliedArgumentValues");
2575
+ function activeEntries() {
2576
+ const existing = suppliedValuesSlot.get();
2577
+ return Array.isArray(existing) ? existing : [];
2578
+ }
2579
+ var MIN_SCRUBBABLE_LENGTH = 4;
2580
+ function recordSuppliedArgumentValues(values) {
2581
+ const flat = [];
2582
+ const push = (value) => {
2583
+ if (Array.isArray(value)) {
2584
+ for (const item of value) {
2585
+ push(item);
2586
+ }
2587
+ return;
2588
+ }
2589
+ if (typeof value === "string" && value.length >= MIN_SCRUBBABLE_LENGTH) {
2590
+ flat.push(value);
2591
+ }
2592
+ };
2593
+ push(values);
2594
+ const entry = { values: flat };
2595
+ suppliedValuesSlot.set([...activeEntries(), entry]);
2596
+ return entry;
2597
+ }
2598
+ function releaseSuppliedArgumentValues(entry) {
2599
+ suppliedValuesSlot.set(activeEntries().filter((held) => held !== entry));
2600
+ }
2601
+ function getSuppliedArgumentValues() {
2602
+ const all = new Set;
2603
+ for (const entry of activeEntries()) {
2604
+ for (const value of entry.values) {
2605
+ all.add(value);
2606
+ }
2607
+ }
2608
+ return [...all].sort((a, b) => b.length - a.length);
2609
+ }
2610
+
2611
+ // ../common/src/telemetry/pii-redactor.ts
2612
+ var REDACTED = "[REDACTED]";
2613
+ var MAX_VALUE_LENGTH = 280;
2614
+ var MAX_STACK_LENGTH = 4096;
2615
+ var MAX_SCAN_LENGTH = MAX_STACK_LENGTH;
2616
+ function truncate(value, maxLength) {
2617
+ return value.length > maxLength ? `${value.slice(0, maxLength)}…` : value;
2618
+ }
2619
+ var SENSITIVE_NAME_TOKENS = new Set([
2620
+ "token",
2621
+ "tokens",
2622
+ "secret",
2623
+ "secrets",
2624
+ "password",
2625
+ "passwords",
2626
+ "pwd",
2627
+ "credential",
2628
+ "credentials",
2629
+ "auth",
2630
+ "authentication",
2631
+ "authorization",
2632
+ "authority",
2633
+ "cert",
2634
+ "certificate",
2635
+ "certificates"
2636
+ ]);
2637
+ var SENSITIVE_KEY_PREFIXES = new Set([
2638
+ "api",
2639
+ "access",
2640
+ "client",
2641
+ "private",
2642
+ "public",
2643
+ "signing",
2644
+ "encryption",
2645
+ "session",
2646
+ "master",
2647
+ "shared",
2648
+ "root",
2649
+ "ssh",
2650
+ "rsa",
2651
+ "aes",
2652
+ "hmac",
2653
+ "oauth"
2654
+ ]);
2655
+ var UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
2656
+ var EMAIL_PATTERN = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
2657
+ var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
2658
+ var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
2659
+ var PADDED_BASE64_PATTERN = /[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
2660
+ var BASE64_WITH_PLUS_PATTERN = /[A-Za-z0-9+/]{40,}/g;
2661
+ var USER_HOME_PATTERN = /(?<![A-Za-z0-9._-])([/\\])(Users|home|Profiles)([/\\])([^/\\]+)/gi;
2662
+ var UNC_PATH_PATTERN = /(^|[\s"'<>|=,;([{])(\\\\[^\s"'<>|]+)/g;
2663
+ var HOST_PORT_PATTERN = /(?<![/@.\w-])(?!\d+\.\d+\.\d+\.\d+:)[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?(?:\.[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?)+:\d{1,5}\b/g;
2664
+ var SOURCE_FILE_EXTENSIONS = new Set([
2665
+ "ts",
2666
+ "tsx",
2667
+ "js",
2668
+ "jsx",
2669
+ "mjs",
2670
+ "cjs",
2671
+ "cts",
2672
+ "mts",
2673
+ "py",
2674
+ "cs",
2675
+ "java",
2676
+ "go",
2677
+ "rs",
2678
+ "rb",
2679
+ "php",
2680
+ "sh",
2681
+ "ps1",
2682
+ "json",
2683
+ "jsonc",
2684
+ "yaml",
2685
+ "yml",
2686
+ "xml",
2687
+ "xaml",
2688
+ "md",
2689
+ "txt",
2690
+ "log",
2691
+ "css",
2692
+ "html",
2693
+ "htm",
2694
+ "csproj",
2695
+ "nuspec",
2696
+ "sql"
2697
+ ]);
2698
+ var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
2699
+ var QUOTED_LITERAL_MAX_SPAN = 200;
2700
+ var QUOTED_LITERAL_PATTERN = new RegExp([
2701
+ `(?<![A-Za-z0-9])'(?:[^\\
2702
+ ]|\\.){2,${QUOTED_LITERAL_MAX_SPAN}}?'(?![A-Za-z0-9])`,
2703
+ `(?<![A-Za-z0-9])"(?:[^\\
2704
+ ]|\\.){2,${QUOTED_LITERAL_MAX_SPAN}}?"(?![A-Za-z0-9])`
2705
+ ].join("|"), "g");
2706
+ var JSON_BODY_PATTERN = /[{[][^{}[\]]*[:,][^{}[\]]*[\]}]/g;
2707
+ var COLLAPSED_BODY = "{…}";
2708
+ var COLLAPSED_BODY_MARKER = "\x01body\x01";
2709
+ var MAX_BODY_NESTING = 8;
2710
+ function collapseJsonBodies(text) {
2711
+ let out = text;
2712
+ for (let pass = 0;pass < MAX_BODY_NESTING; pass++) {
2713
+ const next = out.replace(JSON_BODY_PATTERN, COLLAPSED_BODY_MARKER);
2714
+ if (next === out) {
2715
+ break;
2716
+ }
2717
+ out = next;
2718
+ }
2719
+ return out.split(COLLAPSED_BODY_MARKER).join(COLLAPSED_BODY);
2720
+ }
2721
+ var TRAILING_PROSE_PUNCT = /[.,;:!?)\]}>'"]+$/;
2722
+ function peelTrailingPunctuation(match) {
2723
+ const trailing = match.match(TRAILING_PROSE_PUNCT)?.[0] ?? "";
2724
+ return trailing ? [match.slice(0, -trailing.length), trailing] : [match, ""];
2725
+ }
2726
+ function redactUrl(raw) {
2727
+ try {
2728
+ const url = new URL(raw);
2729
+ return `${url.protocol}//${url.host}`;
2730
+ } catch {
2731
+ return `url#${pseudonymize(raw)}`;
2732
+ }
2733
+ }
2734
+ function redactValueDetectors(value, maxLength = MAX_VALUE_LENGTH) {
2735
+ let out = truncate(value, MAX_SCAN_LENGTH);
2736
+ out = out.replace(JWT_PATTERN, () => REDACTED);
2737
+ out = out.replace(URL_PATTERN, (match) => {
2738
+ const [core, trailing] = peelTrailingPunctuation(match);
2739
+ return `${redactUrl(core)}${trailing}`;
2740
+ });
2741
+ out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
2742
+ out = out.replace(UNC_PATH_PATTERN, (_match, before, path2) => {
2743
+ const [core, trailing] = peelTrailingPunctuation(path2);
2744
+ return `${before}unc#${pseudonymize(core)}${trailing}`;
2745
+ });
2746
+ out = out.replace(EMAIL_PATTERN, (match) => `email#${pseudonymize(match)}`);
2747
+ out = out.replace(UUID_PATTERN, (match) => `uuid#${pseudonymize(match)}`);
2748
+ out = out.replace(HOST_PORT_PATTERN, (match) => {
2749
+ const split = match.lastIndexOf(":");
2750
+ const host = match.slice(0, split);
2751
+ const extension = host.slice(host.lastIndexOf(".") + 1).toLowerCase();
2752
+ if (SOURCE_FILE_EXTENSIONS.has(extension)) {
2753
+ return match;
2754
+ }
2755
+ return `host#${pseudonymize(host)}:${match.slice(split + 1)}`;
2756
+ });
2757
+ out = out.replace(PADDED_BASE64_PATTERN, () => REDACTED);
2758
+ out = out.replace(BASE64_WITH_PLUS_PATTERN, (match) => match.includes("+") ? REDACTED : match);
2759
+ out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
2760
+ return truncate(out, maxLength);
2761
+ }
2762
+ function redactSpanName(name) {
2763
+ return redactValueDetectors(truncate(name, MAX_SCAN_LENGTH).replace(QUOTED_LITERAL_PATTERN, (match) => `${match[0]}<redacted>${match[0]}`));
2764
+ }
2765
+ var HTTP_DEPENDENCY_NAME = /^([A-Z]+) (\/.*)$/s;
2766
+ function redactHttpDependencyName(name) {
2767
+ const parts = HTTP_DEPENDENCY_NAME.exec(name);
2768
+ if (!parts) {
2769
+ return redactMessage(name);
2770
+ }
2771
+ return `${parts[1]} ${redactMessage(parts[2])}`;
2772
+ }
2773
+ function redactMessage(value) {
2774
+ let out = collapseJsonBodies(truncate(value, MAX_SCAN_LENGTH)).replace(QUOTED_LITERAL_PATTERN, (match) => `${match[0]}<redacted>${match[0]}`);
2775
+ for (const supplied of getSuppliedArgumentValues()) {
2776
+ out = out.split(supplied).join(REDACTED);
2777
+ }
2778
+ return redactValueDetectors(out);
2779
+ }
2780
+ var MESSAGE_NAMES = new Set([
2781
+ "message",
2782
+ "errormessage",
2783
+ "errmessage",
2784
+ "error_message",
2785
+ "msg",
2786
+ "detail",
2787
+ "details",
2788
+ "reason",
2789
+ "instructions",
2790
+ "warning"
2791
+ ]);
2792
+ function isFreeFormValue(name, value) {
2793
+ return MESSAGE_NAMES.has(name.toLowerCase()) || /['"{[]/.test(value);
2794
+ }
2795
+ function redactError(error) {
2796
+ const safe = new Error(redactMessage(error.message ?? ""));
2797
+ safe.name = error.name;
2798
+ safe.stack = typeof error.stack === "string" ? redactStack(error.stack) : undefined;
2799
+ return safe;
2800
+ }
2801
+ function redactStack(stack) {
2802
+ const bounded = truncate(stack, MAX_STACK_LENGTH);
2803
+ const firstBreak = bounded.indexOf(`
2804
+ `);
2805
+ if (firstBreak === -1) {
2806
+ return redactMessage(bounded);
2807
+ }
2808
+ return `${redactMessage(bounded.slice(0, firstBreak))}
2809
+ ${redactValueDetectors(bounded.slice(firstBreak + 1), MAX_STACK_LENGTH)}`;
2810
+ }
2811
+ function nameTokens(name) {
2812
+ return name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[\s._-]+/).map((t) => t.toLowerCase()).filter(Boolean);
2813
+ }
2814
+ function isSensitiveName(name) {
2815
+ const tokens = nameTokens(name);
2816
+ for (let i = 0;i < tokens.length; i++) {
2817
+ const token = tokens[i];
2818
+ if (SENSITIVE_NAME_TOKENS.has(token)) {
2819
+ return true;
2820
+ }
2821
+ if (token === "key" || token === "keys") {
2822
+ const prev = tokens[i - 1];
2823
+ if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
2824
+ return true;
2825
+ }
2826
+ }
2827
+ }
2828
+ return false;
2829
+ }
2830
+ function redactProperty(name, value) {
2831
+ if (value === undefined || value === null) {
2832
+ return;
2833
+ }
2834
+ if (isSensitiveName(name)) {
2835
+ return REDACTED;
2836
+ }
2837
+ if (typeof value === "boolean" || typeof value === "number") {
2838
+ return value;
2839
+ }
2840
+ if (typeof value !== "string") {
2841
+ return "[OBJECT]";
2842
+ }
2843
+ return isFreeFormValue(name, value) ? redactMessage(value) : redactValueDetectors(value);
2844
+ }
2845
+ function redactProperties(properties) {
2846
+ const out = {};
2847
+ for (const [name, value] of Object.entries(properties)) {
2848
+ const redacted = redactProperty(name, value);
2849
+ if (redacted !== undefined) {
2850
+ out[name] = redacted;
2851
+ }
2852
+ }
2853
+ return out;
2854
+ }
2855
+
2159
2856
  // ../common/src/catch-error.ts
2857
+ var MAX_SERIALIZED_LENGTH = 500;
2858
+ var TRUNCATION_SUFFIX = "…(truncated)";
2859
+ var REDACTED2 = "[REDACTED]";
2860
+ function cap(text) {
2861
+ return text.length > MAX_SERIALIZED_LENGTH ? `${text.slice(0, MAX_SERIALIZED_LENGTH)}${TRUNCATION_SUFFIX}` : text;
2862
+ }
2863
+ function omitSensitive(key, value) {
2864
+ return key.length > 0 && isSensitiveName(key) ? REDACTED2 : value;
2865
+ }
2866
+ function describeThrownValue(value) {
2867
+ if (typeof value !== "object" || value === null) {
2868
+ return String(value);
2869
+ }
2870
+ let message;
2871
+ try {
2872
+ message = value.message;
2873
+ } catch {
2874
+ message = undefined;
2875
+ }
2876
+ if (typeof message === "string" && message.length > 0) {
2877
+ return cap(message);
2878
+ }
2879
+ try {
2880
+ const json = JSON.stringify(value, omitSensitive);
2881
+ if (json !== undefined) {
2882
+ return cap(json);
2883
+ }
2884
+ } catch {}
2885
+ return String(value);
2886
+ }
2887
+ function toError(error) {
2888
+ return error instanceof Error ? error : new Error(describeThrownValue(error), { cause: error });
2889
+ }
2160
2890
  function isPromiseLike(value) {
2161
2891
  return value !== null && typeof value === "object" && typeof value.then === "function";
2162
2892
  }
2163
- function catchError2(fnOrPromise) {
2893
+ function catchError(fnOrPromise) {
2164
2894
  if (isPromiseLike(fnOrPromise)) {
2165
2895
  return settlePromiseLike(fnOrPromise);
2166
2896
  }
@@ -2171,17 +2901,11 @@ function catchError2(fnOrPromise) {
2171
2901
  }
2172
2902
  return [undefined, result];
2173
2903
  } catch (error) {
2174
- return [
2175
- error instanceof Error ? error : new Error(String(error)),
2176
- undefined
2177
- ];
2904
+ return [toError(error), undefined];
2178
2905
  }
2179
2906
  }
2180
2907
  function settlePromiseLike(thenable) {
2181
- return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [
2182
- error instanceof Error ? error : new Error(String(error)),
2183
- undefined
2184
- ]);
2908
+ return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
2185
2909
  }
2186
2910
 
2187
2911
  // ../common/src/error-handler.ts
@@ -2215,8 +2939,8 @@ var TLS_INSTRUCTIONS = "The server's TLS certificate could not be verified. Most
2215
2939
  var NETWORK_INSTRUCTIONS = "Could not reach the UiPath service. Check your network connection and " + "VPN, confirm any HTTP_PROXY/HTTPS_PROXY/NO_PROXY settings are correct, " + "then retry.";
2216
2940
  var LOCAL_PERMISSION_ERROR_CODES = new Set(["EACCES", "EPERM", "EROFS"]);
2217
2941
  var LOCAL_PERMISSION_MESSAGE_PATTERN = /\b(EACCES|EPERM|EROFS)\b/;
2218
- function localPermissionInstructions(code, path) {
2219
- const target = path !== undefined ? `'${path}'` : "a local file or resource";
2942
+ function localPermissionInstructions(code, path2) {
2943
+ const target = path2 !== undefined ? `'${path2}'` : "a local file or resource";
2220
2944
  if (code === "EROFS") {
2221
2945
  return `The filesystem containing ${target} is read-only (EROFS), so the ` + "CLI could not write to it. This is a local environment problem, " + "not a UiPath service error — retrying will not help. Use a " + "writable location, or give this environment write access to the " + "path.";
2222
2946
  }
@@ -2252,12 +2976,12 @@ function describePermissionError(error) {
2252
2976
  const code = matchLocalPermissionCode(cur.code, message);
2253
2977
  if (!code)
2254
2978
  continue;
2255
- const path = localPermissionPath(cur.path, message);
2979
+ const path2 = localPermissionPath(cur.path, message);
2256
2980
  return {
2257
2981
  code,
2258
2982
  message: message ?? code,
2259
- ...path !== undefined ? { path } : {},
2260
- instructions: localPermissionInstructions(code, path)
2983
+ ...path2 !== undefined ? { path: path2 } : {},
2984
+ instructions: localPermissionInstructions(code, path2)
2261
2985
  };
2262
2986
  }
2263
2987
  return;
@@ -2269,9 +2993,9 @@ function matchLocalPermissionCode(code, message) {
2269
2993
  const match = message ? LOCAL_PERMISSION_MESSAGE_PATTERN.exec(message) : null;
2270
2994
  return match ? match[1] : undefined;
2271
2995
  }
2272
- function localPermissionPath(path, message) {
2273
- if (typeof path === "string")
2274
- return path;
2996
+ function localPermissionPath(path2, message) {
2997
+ if (typeof path2 === "string")
2998
+ return path2;
2275
2999
  return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
2276
3000
  }
2277
3001
  function* walkErrorGraph(error) {
@@ -2380,10 +3104,10 @@ async function extractErrorDetails(error, options) {
2380
3104
  let parsedBody;
2381
3105
  const textFn = response?.text?.bind(response);
2382
3106
  if (textFn) {
2383
- const [bodyError, body] = await catchError2((async () => textFn())());
3107
+ const [bodyError, body] = await catchError((async () => textFn())());
2384
3108
  if (!bodyError && body) {
2385
3109
  rawBody = body;
2386
- const [parseError, parsed] = catchError2(() => JSON.parse(body));
3110
+ const [parseError, parsed] = catchError(() => JSON.parse(body));
2387
3111
  if (!parseError && parsed && typeof parsed === "object") {
2388
3112
  parsedBody = parsed;
2389
3113
  if (parsedBody.errors && typeof parsedBody.errors === "object") {
@@ -2486,7 +3210,7 @@ async function extractErrorDetails(error, options) {
2486
3210
  } else if (typeof err.message === "string") {
2487
3211
  details = err.message;
2488
3212
  } else {
2489
- details = String(error);
3213
+ details = describeThrownValue(error);
2490
3214
  }
2491
3215
  const context = {};
2492
3216
  if (status) {
@@ -2562,73 +3286,14 @@ async function extractErrorMessage(error, options) {
2562
3286
  const { message } = await extractErrorDetails(error, options);
2563
3287
  return message;
2564
3288
  }
2565
- // ../../node_modules/commander/esm.mjs
2566
- var import__ = __toESM(require_commander(), 1);
2567
- var {
2568
- program,
2569
- createCommand,
2570
- createArgument,
2571
- createOption,
2572
- CommanderError,
2573
- InvalidArgumentError,
2574
- InvalidOptionArgumentError,
2575
- Command,
2576
- Argument,
2577
- Option,
2578
- Help
2579
- } = import__.default;
2580
-
2581
- // ../common/src/command-examples.ts
2582
- var examplesByCommand = new WeakMap;
2583
- Command.prototype.examples = function(examples) {
2584
- examplesByCommand.set(this, examples);
2585
- return this;
2586
- };
2587
- // ../common/src/singleton.ts
2588
- var PREFIX = "@uipath/common/";
2589
- var _g = globalThis;
2590
- function singleton(ctorOrName) {
2591
- const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
2592
- const key = Symbol.for(PREFIX + name);
2593
- return {
2594
- get(fallback) {
2595
- return _g[key] ?? fallback;
2596
- },
2597
- set(value) {
2598
- _g[key] = value;
2599
- },
2600
- clear() {
2601
- delete _g[key];
2602
- },
2603
- getOrInit(factory, guard) {
2604
- const existing = _g[key];
2605
- if (existing != null && typeof existing === "object") {
2606
- if (!guard || guard(existing)) {
2607
- return existing;
2608
- }
2609
- }
2610
- const instance = factory();
2611
- _g[key] = instance;
2612
- return instance;
2613
- }
2614
- };
3289
+ // ../common/src/exit-code.ts
3290
+ function setExitCode(code) {
3291
+ process.exitCode = code;
2615
3292
  }
2616
3293
 
2617
- // ../common/src/preview.ts
2618
- var previewSlot = singleton("PreviewBuild");
2619
- function isPreviewBuild() {
2620
- return previewSlot.get(false) ?? false;
2621
- }
2622
- Command.prototype.previewCommand = function(nameAndArgs, opts) {
2623
- if (isPreviewBuild()) {
2624
- return this.command(nameAndArgs, opts);
2625
- }
2626
- return new Command(nameAndArgs.split(/\s+/)[0] ?? nameAndArgs);
2627
- };
2628
-
2629
3294
  // ../common/src/output-context.ts
2630
3295
  function createStorage() {
2631
- const [error, mod] = catchError2(() => __require("node:async_hooks"));
3296
+ const [error, mod] = catchError(() => __require("node:async_hooks"));
2632
3297
  if (error || typeof mod?.AsyncLocalStorage !== "function") {
2633
3298
  return {
2634
3299
  getStore: () => {
@@ -2659,8 +3324,8 @@ function getOutputSink() {
2659
3324
 
2660
3325
  // ../common/src/logger.ts
2661
3326
  var logFilePathSlot = singleton("logFilePath");
2662
- function setGlobalLogFilePath(path) {
2663
- logFilePathSlot.set(path);
3327
+ function setGlobalLogFilePath(path2) {
3328
+ logFilePathSlot.set(path2);
2664
3329
  }
2665
3330
  function getGlobalLogFilePath() {
2666
3331
  return logFilePathSlot.get("");
@@ -2697,7 +3362,7 @@ class SimpleLogger {
2697
3362
  }
2698
3363
  return DEFAULT_LOG_LEVEL;
2699
3364
  }
2700
- const [localStorageError, hasDebug] = catchError2(() => typeof localStorage !== "undefined" && !!localStorage.getItem("debug"));
3365
+ const [localStorageError, hasDebug] = catchError(() => typeof localStorage !== "undefined" && !!localStorage.getItem("debug"));
2701
3366
  if (!localStorageError && hasDebug) {
2702
3367
  return 0 /* DEBUG */;
2703
3368
  }
@@ -2728,54 +3393,49 @@ class SimpleLogger {
2728
3393
  return this.fileLoggingEnabled || !!getGlobalLogFilePath();
2729
3394
  }
2730
3395
  writeToFile(formatted) {
2731
- const path = this.logFilePath || getGlobalLogFilePath();
2732
- if (!path)
3396
+ const path2 = this.logFilePath || getGlobalLogFilePath();
3397
+ if (!path2)
2733
3398
  return;
2734
3399
  const timestamp = new Date().toISOString();
2735
3400
  this.pendingWrites = Promise.all([
2736
3401
  this.pendingWrites,
2737
3402
  this.pendingInit
2738
- ]).then(() => getFileSystem().appendFile(path, `${timestamp} ${formatted}`).catch(() => {}));
3403
+ ]).then(() => getFileSystem().appendFile(path2, `${timestamp} ${formatted}`).catch(() => {}));
2739
3404
  }
2740
- debug(message, ...args) {
2741
- if (this.level > 0 /* DEBUG */)
2742
- return;
2743
- const formatted = this.format(`[DEBUG] ${message}`, args);
3405
+ write(formatted) {
2744
3406
  if (this.isFileLoggingActive()) {
2745
3407
  this.writeToFile(formatted);
2746
3408
  } else {
2747
3409
  getOutputSink().writeErr(formatted);
2748
3410
  }
2749
3411
  }
3412
+ debug(message, ...args) {
3413
+ if (this.level > 0 /* DEBUG */)
3414
+ return;
3415
+ const formatted = this.format(`[DEBUG] ${message}`, args);
3416
+ this.write(formatted);
3417
+ }
2750
3418
  info(message, ...args) {
2751
3419
  if (this.level > 1 /* INFO */)
2752
3420
  return;
2753
3421
  const formatted = this.format(message, args);
2754
- if (this.isFileLoggingActive()) {
2755
- this.writeToFile(formatted);
2756
- } else {
2757
- getOutputSink().writeErr(formatted);
2758
- }
3422
+ this.write(formatted);
2759
3423
  }
2760
3424
  warn(message, ...args) {
2761
3425
  if (this.level > 2 /* WARN */)
2762
3426
  return;
2763
3427
  const formatted = this.format(`[WARN] ${message}`, args);
2764
- if (this.isFileLoggingActive()) {
2765
- this.writeToFile(formatted);
2766
- } else {
2767
- getOutputSink().writeErr(formatted);
2768
- }
3428
+ this.write(formatted);
2769
3429
  }
2770
3430
  error(message, ...args) {
2771
3431
  if (this.level > 3 /* ERROR */)
2772
3432
  return;
2773
3433
  const formatted = this.format(`[ERROR] ${message}`, args);
2774
- if (this.isFileLoggingActive()) {
2775
- this.writeToFile(formatted);
2776
- } else {
2777
- getOutputSink().writeErr(formatted);
2778
- }
3434
+ this.write(formatted);
3435
+ }
3436
+ report(message) {
3437
+ const formatted = this.format(message, []);
3438
+ this.write(formatted);
2779
3439
  }
2780
3440
  getLevel() {
2781
3441
  return this.level;
@@ -2790,17 +3450,17 @@ class SimpleLogger {
2790
3450
  setGlobalLogFilePath("");
2791
3451
  }
2792
3452
  }
2793
- setLogFile(path) {
2794
- this.logFilePath = path;
2795
- setGlobalLogFilePath(path);
2796
- if (!path)
3453
+ setLogFile(path2) {
3454
+ this.logFilePath = path2;
3455
+ setGlobalLogFilePath(path2);
3456
+ if (!path2)
2797
3457
  return;
2798
3458
  this.fileLoggingEnabled = true;
2799
- const fs = getFileSystem();
3459
+ const fs2 = getFileSystem();
2800
3460
  this.pendingInit = (async () => {
2801
- const [error] = await catchError2((async () => {
2802
- await fs.mkdir(fs.path.dirname(path));
2803
- await fs.writeFile(path, "");
3461
+ const [error] = await catchError((async () => {
3462
+ await fs2.mkdir(fs2.path.dirname(path2));
3463
+ await fs2.writeFile(path2, "");
2804
3464
  })());
2805
3465
  if (error)
2806
3466
  this.fileLoggingEnabled = false;
@@ -2854,12 +3514,12 @@ var jmespathSlot = singleton("JmespathCodec");
2854
3514
  async function loadOutputCodecsAsync(needed) {
2855
3515
  const loads = [];
2856
3516
  if (needed.yaml && yamlSlot.get() === undefined) {
2857
- loads.push(import("./js-yaml-4ypbq2tt.js").then((mod) => {
3517
+ loads.push(import("./js-yaml-88tdqrtd.js").then((mod) => {
2858
3518
  yamlSlot.set(mod);
2859
3519
  }));
2860
3520
  }
2861
3521
  if (needed.filter && jmespathSlot.get() === undefined) {
2862
- loads.push(import("./index-2fj08e7n.js").then((mod) => {
3522
+ loads.push(import("./index-gpd94m28.js").then((mod) => {
2863
3523
  jmespathSlot.set(mod);
2864
3524
  }));
2865
3525
  }
@@ -3114,7 +3774,7 @@ function readRegistryValue(keyPath, valueName) {
3114
3774
  if (process.platform !== "win32") {
3115
3775
  return "";
3116
3776
  }
3117
- const [error, output] = catchError2(() => execFileSync("reg", ["query", keyPath, "/v", valueName], {
3777
+ const [error, output] = catchError(() => execFileSync("reg", ["query", keyPath, "/v", valueName], {
3118
3778
  encoding: "utf-8",
3119
3779
  stdio: ["pipe", "pipe", "pipe"]
3120
3780
  }));
@@ -3137,27 +3797,41 @@ class LoggerTelemetryProvider {
3137
3797
  ...this.analyticsUniqueId ? { analyticsUniqueId: this.analyticsUniqueId } : {}
3138
3798
  };
3139
3799
  }
3140
- async trackEvent(eventName, properties) {
3141
- logger.debug(formatMessage("Event", eventName, this.enrich(properties)));
3800
+ async trackEvent({ name, properties }) {
3801
+ logger.debug(formatMessage("Event", name, this.enrich(properties)));
3142
3802
  }
3143
- async trackException(error, properties) {
3803
+ async trackException({
3804
+ error,
3805
+ properties
3806
+ }) {
3144
3807
  logger.error(formatMessage("Exception", error.message, this.enrich({
3145
3808
  ...properties,
3146
3809
  stack: error.stack
3147
3810
  })));
3148
3811
  }
3149
- async trackRequest(name, duration, success, properties) {
3812
+ async trackRequest({
3813
+ name,
3814
+ durationMs,
3815
+ success,
3816
+ properties
3817
+ }) {
3150
3818
  logger.debug(formatMessage("Request", name, this.enrich({
3151
3819
  ...properties,
3152
- duration: `${duration}ms`,
3820
+ duration: `${durationMs}ms`,
3153
3821
  success
3154
3822
  })));
3155
3823
  }
3156
- async trackDependency(name, type, duration, success, properties) {
3824
+ async trackDependency({
3825
+ name,
3826
+ type,
3827
+ durationMs,
3828
+ success,
3829
+ properties
3830
+ }) {
3157
3831
  logger.debug(formatMessage("Dependency", name, this.enrich({
3158
3832
  ...properties,
3159
3833
  type,
3160
- duration: `${duration}ms`,
3834
+ duration: `${durationMs}ms`,
3161
3835
  success
3162
3836
  })));
3163
3837
  }
@@ -3395,162 +4069,34 @@ function resolveTelemetrySession() {
3395
4069
  return resolved;
3396
4070
  }
3397
4071
  function getTelemetrySessionSource() {
3398
- return resolveTelemetrySession().source;
3399
- }
3400
- function getTelemetryOperationId() {
3401
- const existing = telemetryOperationIdSlot.get();
3402
- if (existing) {
3403
- return existing;
3404
- }
3405
- const inboundTraceId = getInboundTraceContext()?.traceId;
3406
- const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
3407
- telemetryOperationIdSlot.set(generated);
3408
- return generated;
3409
- }
3410
- // ../common/src/telemetry/global-telemetry-properties.ts
3411
- var telemetryPropsSlot = singleton("TelemetryDefaultProps");
3412
- function getGlobalTelemetryProperties() {
3413
- return telemetryPropsSlot.get();
3414
- }
3415
-
3416
- // ../common/src/telemetry/pii-redactor.ts
3417
- var REDACTED = "[REDACTED]";
3418
- var MAX_VALUE_LENGTH = 200;
3419
- var SENSITIVE_NAME_TOKENS = new Set([
3420
- "token",
3421
- "tokens",
3422
- "secret",
3423
- "secrets",
3424
- "password",
3425
- "passwords",
3426
- "pwd",
3427
- "credential",
3428
- "credentials",
3429
- "auth",
3430
- "authentication",
3431
- "authorization",
3432
- "authority",
3433
- "cert",
3434
- "certificate",
3435
- "certificates"
3436
- ]);
3437
- var SENSITIVE_KEY_PREFIXES = new Set([
3438
- "api",
3439
- "access",
3440
- "client",
3441
- "private",
3442
- "public",
3443
- "signing",
3444
- "encryption",
3445
- "session",
3446
- "master",
3447
- "shared",
3448
- "root",
3449
- "ssh",
3450
- "rsa",
3451
- "aes",
3452
- "hmac",
3453
- "oauth"
3454
- ]);
3455
- var UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
3456
- var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
3457
- var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
3458
- var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
3459
- var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
3460
- var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
3461
- var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
3462
- function shortHash(input) {
3463
- let hash = 2166136261;
3464
- for (let i = 0;i < input.length; i++) {
3465
- hash ^= input.charCodeAt(i);
3466
- hash = Math.imul(hash, 16777619);
3467
- }
3468
- return (hash >>> 0).toString(16).padStart(8, "0");
3469
- }
3470
- function redactUrl(raw) {
3471
- try {
3472
- const url = new URL(raw);
3473
- return `${url.protocol}//${url.host}`;
3474
- } catch {
3475
- return `url#${shortHash(raw)}`;
3476
- }
3477
- }
3478
- function redactValueDetectors(value) {
3479
- let out = value;
3480
- out = out.replace(JWT_PATTERN, () => REDACTED);
3481
- out = out.replace(URL_PATTERN, (match) => {
3482
- const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
3483
- const core = trailing ? match.slice(0, -trailing.length) : match;
3484
- return `${redactUrl(core)}${trailing}`;
3485
- });
3486
- out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
3487
- out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
3488
- out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
3489
- out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
3490
- if (out.length > MAX_VALUE_LENGTH) {
3491
- out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
3492
- }
3493
- return out;
3494
- }
3495
- function redactValue(value) {
3496
- return redactValueDetectors(value);
3497
- }
3498
- function redactError(error) {
3499
- const safe = new Error(redactValueDetectors(error.message ?? ""));
3500
- safe.name = error.name;
3501
- safe.stack = typeof error.stack === "string" ? redactValueDetectors(error.stack) : undefined;
3502
- return safe;
3503
- }
3504
- function nameTokens(name) {
3505
- return name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[\s._-]+/).map((t) => t.toLowerCase()).filter(Boolean);
3506
- }
3507
- function isSensitiveName(name) {
3508
- const tokens = nameTokens(name);
3509
- for (let i = 0;i < tokens.length; i++) {
3510
- const token = tokens[i];
3511
- if (SENSITIVE_NAME_TOKENS.has(token)) {
3512
- return true;
3513
- }
3514
- if (token === "key" || token === "keys") {
3515
- const prev = tokens[i - 1];
3516
- if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
3517
- return true;
3518
- }
3519
- }
3520
- }
3521
- return false;
3522
- }
3523
- function redactProperty(name, value) {
3524
- if (value === undefined || value === null) {
3525
- return;
3526
- }
3527
- if (isSensitiveName(name)) {
3528
- return REDACTED;
3529
- }
3530
- if (typeof value === "boolean" || typeof value === "number") {
3531
- return value;
3532
- }
3533
- if (typeof value !== "string") {
3534
- return "[OBJECT]";
3535
- }
3536
- return redactValueDetectors(value);
3537
- }
3538
- function redactProperties(properties) {
3539
- const out = {};
3540
- for (const [name, value] of Object.entries(properties)) {
3541
- const redacted = redactProperty(name, value);
3542
- if (redacted !== undefined) {
3543
- out[name] = redacted;
3544
- }
4072
+ return resolveTelemetrySession().source;
4073
+ }
4074
+ function getTelemetryOperationId() {
4075
+ const existing = telemetryOperationIdSlot.get();
4076
+ if (existing) {
4077
+ return existing;
3545
4078
  }
3546
- return out;
4079
+ const inboundTraceId = getInboundTraceContext()?.traceId;
4080
+ const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
4081
+ telemetryOperationIdSlot.set(generated);
4082
+ return generated;
4083
+ }
4084
+ // ../common/src/telemetry/global-telemetry-properties.ts
4085
+ var telemetryPropsSlot = singleton("TelemetryDefaultProps");
4086
+ function getGlobalTelemetryProperties() {
4087
+ return telemetryPropsSlot.get();
3547
4088
  }
3548
4089
 
3549
- // ../common/src/telemetry/telemetry-service.ts
3550
- var TELEMETRY_OPERATION_ID_PROPERTY = "uip.trace.operation_id";
3551
- var TELEMETRY_PARENT_ID_PROPERTY = "uip.trace.parent_id";
3552
- var TELEMETRY_SPAN_ID_PROPERTY = "uip.trace.span_id";
4090
+ // ../common/src/telemetry/span-clock.ts
4091
+ function startSpanClock() {
4092
+ const started = performance.now();
4093
+ return {
4094
+ startedAt: new Date(performance.timeOrigin + started),
4095
+ elapsedMs: () => performance.now() - started
4096
+ };
4097
+ }
3553
4098
 
4099
+ // ../common/src/telemetry/telemetry-service.ts
3554
4100
  class TelemetryService {
3555
4101
  telemetryProvider;
3556
4102
  contextStorage;
@@ -3570,36 +4116,39 @@ class TelemetryService {
3570
4116
  this.defaultProperties = properties === undefined ? undefined : { ...this.defaultProperties, ...properties };
3571
4117
  }
3572
4118
  trackEvent(name, properties) {
3573
- const context = this.getCurrentContext();
3574
- const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
3575
- this.telemetryProvider.trackEvent(name, enrichedProperties);
4119
+ this.telemetryProvider.trackEvent({
4120
+ name: redactSpanName(name),
4121
+ properties: this.enrichProperties(properties),
4122
+ ...this.leafCorrelation()
4123
+ });
3576
4124
  }
3577
- trackException(error, properties) {
3578
- const context = this.getCurrentContext();
3579
- const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
3580
- this.telemetryProvider.trackException(redactError(error), enrichedProperties);
4125
+ trackException(error, properties, context) {
4126
+ this.telemetryProvider.trackException({
4127
+ error: redactError(error),
4128
+ properties: this.enrichProperties(properties),
4129
+ ...this.leafCorrelation(context)
4130
+ });
3581
4131
  }
3582
4132
  async trackRequest(name, fn, properties) {
3583
- const parentContext = this.getCurrentContext();
4133
+ const parentContext = this.getActiveContext();
3584
4134
  const operationId = parentContext?.operationId ?? this.operationId ?? getTelemetryOperationId();
3585
4135
  const parentId = parentContext ? parentContext.id : this.inboundParentIdFor(operationId);
4136
+ const clock = startSpanClock();
3586
4137
  const context = {
3587
4138
  operationId,
3588
4139
  ...parentId !== undefined ? { parentId } : {},
3589
- id: this.generateId()
4140
+ id: this.generateId(),
4141
+ startedAt: clock.startedAt
3590
4142
  };
3591
- const startTime = performance.now();
3592
4143
  try {
3593
4144
  const result = await this.contextStorage.run(context, fn);
3594
- const durationMs = performance.now() - startTime;
3595
- const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
3596
- await this.telemetryProvider.trackRequest(name, durationMs, true, enrichedProperties);
4145
+ const durationMs = clock.elapsedMs();
4146
+ await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, true, properties, context));
3597
4147
  return result;
3598
4148
  } catch (error) {
3599
- const durationMs = performance.now() - startTime;
4149
+ const durationMs = clock.elapsedMs();
3600
4150
  const err = error instanceof Error ? error : new Error(String(error));
3601
- const enrichedProperties = this.enrichPropertiesWithContext({ ...properties, errorMessage: err.message }, context);
3602
- await this.telemetryProvider.trackRequest(name, durationMs, false, enrichedProperties);
4151
+ await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, { ...properties, errorMessage: err.message }, context));
3603
4152
  throw error;
3604
4153
  }
3605
4154
  }
@@ -3608,8 +4157,7 @@ class TelemetryService {
3608
4157
  operationId: this.operationId ?? getTelemetryOperationId(),
3609
4158
  id: this.generateId()
3610
4159
  };
3611
- const enrichedProperties = this.enrichPropertiesWithContext(properties, requestContext);
3612
- this.telemetryProvider.trackRequest(name, durationMs, success, enrichedProperties);
4160
+ this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, success, properties, requestContext));
3613
4161
  }
3614
4162
  createRequestContext() {
3615
4163
  const operationId = this.operationId ?? getTelemetryOperationId();
@@ -3617,7 +4165,8 @@ class TelemetryService {
3617
4165
  return {
3618
4166
  operationId,
3619
4167
  ...parentId !== undefined ? { parentId } : {},
3620
- id: this.generateId()
4168
+ id: this.generateId(),
4169
+ startedAt: startSpanClock().startedAt
3621
4170
  };
3622
4171
  }
3623
4172
  inboundParentIdFor(operationId) {
@@ -3628,58 +4177,84 @@ class TelemetryService {
3628
4177
  return this.contextStorage.run(context, fn);
3629
4178
  }
3630
4179
  createDependencyContext() {
3631
- const parentContext = this.getCurrentContext();
4180
+ const parentContext = this.getActiveContext();
3632
4181
  if (!parentContext) {
3633
4182
  return;
3634
4183
  }
3635
4184
  return {
3636
4185
  operationId: parentContext.operationId,
3637
4186
  parentId: parentContext.id,
3638
- id: this.generateId()
4187
+ id: this.generateId(),
4188
+ startedAt: startSpanClock().startedAt
3639
4189
  };
3640
4190
  }
3641
4191
  trackDependencyResult(name, type, durationMs, success, properties, context, resultCode) {
3642
- const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
3643
- this.telemetryProvider.trackDependency(redactValue(name), type, durationMs, success, enrichedProperties, resultCode);
4192
+ this.telemetryProvider.trackDependency({
4193
+ ...this.spanFor(redactHttpDependencyName(name), durationMs, success, properties, context),
4194
+ type,
4195
+ ...resultCode !== undefined ? { resultCode } : {}
4196
+ });
3644
4197
  }
3645
4198
  async trackDependencyOperation(name, type, fn, properties) {
3646
- const parentContext = this.getCurrentContext();
4199
+ const clock = startSpanClock();
4200
+ const parentContext = this.getActiveContext();
3647
4201
  const childContext = parentContext !== undefined ? {
3648
4202
  operationId: parentContext.operationId,
3649
4203
  parentId: parentContext.id,
3650
- id: this.generateId()
3651
- } : this.createRequestContext();
3652
- const startTime = performance.now();
4204
+ id: this.generateId(),
4205
+ startedAt: clock.startedAt
4206
+ } : {
4207
+ ...this.createRequestContext(),
4208
+ startedAt: clock.startedAt
4209
+ };
3653
4210
  try {
3654
4211
  const result = await this.contextStorage.run(childContext, fn);
3655
- const durationMs = performance.now() - startTime;
3656
- const enrichedProperties = this.enrichPropertiesWithContext(properties, childContext);
3657
- await this.telemetryProvider.trackDependency(name, type, durationMs, true, enrichedProperties);
4212
+ const durationMs = clock.elapsedMs();
4213
+ await this.telemetryProvider.trackDependency({
4214
+ ...this.spanFor(name, durationMs, true, properties, childContext),
4215
+ type
4216
+ });
3658
4217
  return result;
3659
4218
  } catch (error) {
3660
- const durationMs = performance.now() - startTime;
4219
+ const durationMs = clock.elapsedMs();
3661
4220
  const err = error instanceof Error ? error : new Error(String(error));
3662
- const enrichedProperties = this.enrichPropertiesWithContext({ ...properties, errorMessage: err.message }, childContext);
3663
- await this.telemetryProvider.trackDependency(name, type, durationMs, false, enrichedProperties);
4221
+ await this.telemetryProvider.trackDependency({
4222
+ ...this.spanFor(name, durationMs, false, { ...properties, errorMessage: err.message }, childContext),
4223
+ type
4224
+ });
3664
4225
  throw error;
3665
4226
  }
3666
4227
  }
3667
- getCurrentContext() {
4228
+ getActiveContext() {
3668
4229
  return this.contextStorage.getContext();
3669
4230
  }
3670
- enrichPropertiesWithContext(properties, context) {
4231
+ leafCorrelation(explicit) {
4232
+ const context = explicit ?? this.getActiveContext();
4233
+ return {
4234
+ operationId: context?.operationId ?? this.operationId ?? getTelemetryOperationId(),
4235
+ ...context !== undefined ? { parentId: context.id } : {}
4236
+ };
4237
+ }
4238
+ spanFor(name, durationMs, success, properties, context) {
4239
+ return {
4240
+ name: redactSpanName(name),
4241
+ durationMs,
4242
+ success,
4243
+ properties: this.enrichProperties(properties),
4244
+ operationId: context.operationId,
4245
+ ...context.parentId !== undefined ? { parentId: context.parentId } : {},
4246
+ id: context.id,
4247
+ ...context.startedAt !== undefined ? { startedAt: context.startedAt } : {}
4248
+ };
4249
+ }
4250
+ enrichProperties(properties) {
3671
4251
  const globalProperties = getGlobalTelemetryProperties();
3672
4252
  const enriched = {
3673
4253
  ...getExecutionContextTelemetryProperties(),
3674
4254
  ...globalProperties,
3675
4255
  ...this.defaultProperties,
3676
4256
  ...redactProperties(properties ?? {}),
3677
- [TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
3678
- ...context ? {
3679
- [TELEMETRY_OPERATION_ID_PROPERTY]: context.operationId,
3680
- ...context.parentId !== undefined ? { [TELEMETRY_PARENT_ID_PROPERTY]: context.parentId } : {},
3681
- [TELEMETRY_SPAN_ID_PROPERTY]: context.id
3682
- } : {}
4257
+ [TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource()
3683
4258
  };
3684
4259
  return enriched;
3685
4260
  }
@@ -3696,6 +4271,81 @@ class TelemetryService {
3696
4271
  return hex;
3697
4272
  }
3698
4273
  }
4274
+ // ../common/src/timings.ts
4275
+ var TIMINGS_ENV_VAR = "UIP_TIMINGS";
4276
+ function createStorage2() {
4277
+ const [error, mod] = catchError(() => __require("node:async_hooks"));
4278
+ if (error || typeof mod?.AsyncLocalStorage !== "function") {
4279
+ return {
4280
+ getStore: () => {
4281
+ return;
4282
+ },
4283
+ run: (_store, fn) => fn()
4284
+ };
4285
+ }
4286
+ return new mod.AsyncLocalStorage;
4287
+ }
4288
+ var storageSlot = singleton("TimingStorage");
4289
+ var stateSlot = singleton("Timings");
4290
+ var rootStartedSlot = singleton("TimingsRootStarted");
4291
+ var longLivedHostSlot = singleton("TimingsLongLivedHost");
4292
+ var storage = storageSlot.getOrInit(createStorage2, (value) => ("getStore" in value));
4293
+ function newState(baseline) {
4294
+ return { baseline, httpMs: 0, httpCalls: 0 };
4295
+ }
4296
+ function getState() {
4297
+ const scoped = storage.getStore();
4298
+ if (scoped) {
4299
+ return scoped;
4300
+ }
4301
+ const pinned = livePinnedState();
4302
+ if (pinned !== undefined) {
4303
+ return pinned;
4304
+ }
4305
+ return newState(processStartIsInvocationStart() ? 0 : performance.now());
4306
+ }
4307
+ function livePinnedState() {
4308
+ const pinned = stateSlot.get();
4309
+ return pinned !== undefined && "httpCalls" in pinned && !pinned.finished ? pinned : undefined;
4310
+ }
4311
+ function processStartIsInvocationStart() {
4312
+ return !rootStartedSlot.get(false) && !longLivedHostSlot.get(false);
4313
+ }
4314
+ function timingsEnabled() {
4315
+ if (typeof process === "undefined") {
4316
+ return false;
4317
+ }
4318
+ const value = process.env?.[TIMINGS_ENV_VAR];
4319
+ if (value === undefined) {
4320
+ return false;
4321
+ }
4322
+ const normalized = value.trim().toLowerCase();
4323
+ return normalized === "1" || normalized === "true";
4324
+ }
4325
+ function recordExitCode(exitCode) {
4326
+ if (!timingsEnabled()) {
4327
+ return;
4328
+ }
4329
+ getState().exitCode = exitCode;
4330
+ }
4331
+ function invocationStartedAt() {
4332
+ return new Date(performance.timeOrigin + getState().baseline);
4333
+ }
4334
+ function invocationElapsedMs() {
4335
+ return performance.now() - getState().baseline;
4336
+ }
4337
+ function markCommandStart() {
4338
+ if (!timingsEnabled()) {
4339
+ return;
4340
+ }
4341
+ getState().commandStart = performance.now();
4342
+ }
4343
+ function recordCommandDuration(durationMs) {
4344
+ if (!timingsEnabled()) {
4345
+ return;
4346
+ }
4347
+ getState().commandMs = durationMs;
4348
+ }
3699
4349
  // ../common/src/telemetry/proxy-http-agent.ts
3700
4350
  var slot = singleton("ProxyAuthHttpsAgent");
3701
4351
 
@@ -3716,6 +4366,9 @@ function getGlobalTelemetryInstance() {
3716
4366
  }
3717
4367
  return;
3718
4368
  }
4369
+ function setGlobalTelemetryInstance(instance) {
4370
+ telemetryInstanceSlot.set(instance);
4371
+ }
3719
4372
  var _localTelemetryInstance;
3720
4373
  function getTelemetryInstance() {
3721
4374
  const global = getGlobalTelemetryInstance();
@@ -3723,6 +4376,7 @@ function getTelemetryInstance() {
3723
4376
  return global;
3724
4377
  if (!_localTelemetryInstance) {
3725
4378
  _localTelemetryInstance = new TelemetryService(new LoggerTelemetryProvider, new NodeContextStorage);
4379
+ setGlobalTelemetryInstance(_localTelemetryInstance);
3726
4380
  }
3727
4381
  return _localTelemetryInstance;
3728
4382
  }
@@ -3735,6 +4389,14 @@ var telemetry = new Proxy({}, {
3735
4389
  });
3736
4390
 
3737
4391
  // ../common/src/formatter.ts
4392
+ var ANSI_STYLES = {
4393
+ red: "\x1B[31m",
4394
+ dim: "\x1B[2m"
4395
+ };
4396
+ var ANSI_RESET = "\x1B[0m";
4397
+ function styleLine(line, style) {
4398
+ return style ? `${ANSI_STYLES[style]}${line}${ANSI_RESET}` : line;
4399
+ }
3738
4400
  var CLI_ERROR_CODES = [
3739
4401
  "invalid_argument",
3740
4402
  "authentication_required",
@@ -3773,22 +4435,6 @@ var EXIT_CODES = {
3773
4435
  ValidationError: 3,
3774
4436
  TimeoutError: 4
3775
4437
  };
3776
- class SuccessOutput {
3777
- Result = RESULTS.Success;
3778
- Code;
3779
- Data;
3780
- Pagination;
3781
- Instructions;
3782
- Log;
3783
- constructor(code, data) {
3784
- this.Code = code;
3785
- this.Data = data;
3786
- const logPath = getLogFilePath();
3787
- if (logPath) {
3788
- this.Log = logPath;
3789
- }
3790
- }
3791
- }
3792
4438
  function escapeNonAscii(jsonText) {
3793
4439
  return jsonText.replace(/[\u0080-\uffff]/g, (c) => {
3794
4440
  const hex = c.charCodeAt(0).toString(16).padStart(4, "0");
@@ -3853,19 +4499,45 @@ function toPascalCaseKey(key) {
3853
4499
  const lowerCamelKey = toLowerCamelCaseKey(key);
3854
4500
  return lowerCamelKey ? lowerCamelKey.charAt(0).toUpperCase() + lowerCamelKey.slice(1) : lowerCamelKey;
3855
4501
  }
3856
- function toPascalCaseData(value) {
4502
+ function collectVerbatimRefs(value, into) {
4503
+ if (typeof value !== "object" || value === null)
4504
+ return;
4505
+ if (into.has(value))
4506
+ return;
4507
+ into.add(value);
4508
+ for (const nested of Array.isArray(value) ? value : Object.values(value)) {
4509
+ collectVerbatimRefs(nested, into);
4510
+ }
4511
+ }
4512
+ function toPascalCaseData(value, verbatimKeys, subtrees) {
4513
+ if (subtrees?.mode === "skip" && typeof value === "object" && value !== null && subtrees.refs.has(value)) {
4514
+ return value;
4515
+ }
3857
4516
  if (Array.isArray(value))
3858
- return value.map(toPascalCaseData);
4517
+ return value.map((entry) => toPascalCaseData(entry, verbatimKeys, subtrees));
3859
4518
  if (!isPlainRecord(value))
3860
4519
  return value;
3861
4520
  const result = {};
3862
4521
  for (const [key, nestedValue] of Object.entries(value)) {
3863
- result[toPascalCaseKey(key)] = toPascalCaseData(nestedValue);
4522
+ const pascalKey = toPascalCaseKey(key);
4523
+ if (verbatimKeys?.has(pascalKey)) {
4524
+ result[pascalKey] = nestedValue;
4525
+ if (subtrees?.mode === "collect") {
4526
+ collectVerbatimRefs(nestedValue, subtrees.refs);
4527
+ }
4528
+ continue;
4529
+ }
4530
+ result[pascalKey] = toPascalCaseData(nestedValue, verbatimKeys, subtrees);
3864
4531
  }
3865
4532
  return result;
3866
4533
  }
3867
- function normalizeDataKeys(data) {
3868
- return toPascalCaseData(data);
4534
+ function normalizeDataKeys(data, verbatimKeys, subtrees) {
4535
+ return toPascalCaseData(data, verbatimKeys, subtrees);
4536
+ }
4537
+ function toVerbatimKeySet(preserve) {
4538
+ if (!Array.isArray(preserve))
4539
+ return;
4540
+ return new Set(preserve.map(toPascalCaseKey));
3869
4541
  }
3870
4542
  function normalizeOutputKeys(data) {
3871
4543
  const result = {};
@@ -3875,7 +4547,7 @@ function normalizeOutputKeys(data) {
3875
4547
  }
3876
4548
  return result;
3877
4549
  }
3878
- function printOutput(data, format = "json", logFn, asciiSafe = false) {
4550
+ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowStyle) {
3879
4551
  if (!data) {
3880
4552
  logFn("Empty response object. No data to display.");
3881
4553
  return;
@@ -3910,7 +4582,7 @@ function printOutput(data, format = "json", logFn, asciiSafe = false) {
3910
4582
  if (hasData && !(rows !== null && rows.length === 0)) {
3911
4583
  const logValue = data.Log;
3912
4584
  if (rows !== null) {
3913
- printResizableTable(rows, logFn, logValue);
4585
+ printResizableTable(rows, logFn, logValue, undefined, tableRowStyle);
3914
4586
  } else {
3915
4587
  printVerticalTable(data.Data, logFn, logValue);
3916
4588
  }
@@ -3921,10 +4593,11 @@ function printOutput(data, format = "json", logFn, asciiSafe = false) {
3921
4593
  }
3922
4594
  }
3923
4595
  }
3924
- function logOutput(data, format = "json") {
4596
+ function logOutput(data, format = "json", tableRowStyle) {
3925
4597
  const sink = getOutputSink();
4598
+ const styleFn = sink.capabilities.isInteractive && sink.capabilities.supportsColor ? tableRowStyle : undefined;
3926
4599
  printOutput(data, format, (msg) => sink.writeOut(`${msg}
3927
- `), needsAsciiSafeJson(sink));
4600
+ `), needsAsciiSafeJson(sink), styleFn);
3928
4601
  }
3929
4602
  function cellToString(val) {
3930
4603
  return val != null && typeof val === "object" ? JSON.stringify(val) : String(val ?? "");
@@ -3938,7 +4611,7 @@ function wrapText(text, width) {
3938
4611
  }
3939
4612
  return lines;
3940
4613
  }
3941
- function printTable(data, logFn, externalLogValue) {
4614
+ function printTable(data, logFn, externalLogValue, tableRowStyle) {
3942
4615
  if (data.length === 0)
3943
4616
  return;
3944
4617
  const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
@@ -3948,7 +4621,7 @@ function printTable(data, logFn, externalLogValue) {
3948
4621
  logFn(keys.map((_, i) => "-".repeat(maxWidths[i])).join("-|-"));
3949
4622
  data.forEach((item) => {
3950
4623
  const row = keys.map((key, i) => cellToString(item[key]).padEnd(maxWidths[i])).join(" | ");
3951
- logFn(row);
4624
+ logFn(styleLine(row, tableRowStyle?.(item)));
3952
4625
  });
3953
4626
  if (externalLogValue) {
3954
4627
  logFn("");
@@ -3991,14 +4664,14 @@ function printVerticalTable(data, logFn = console.log, externalLogValue) {
3991
4664
  logFn(`Log: ${externalLogValue}`);
3992
4665
  }
3993
4666
  }
3994
- function printResizableTable(data, logFn = console.log, externalLogValue, availableWidth) {
4667
+ function printResizableTable(data, logFn = console.log, externalLogValue, availableWidth, tableRowStyle) {
3995
4668
  if (data.length === 0)
3996
4669
  return;
3997
4670
  const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
3998
4671
  if (keys.length === 0)
3999
4672
  return;
4000
4673
  if (!process.stdout.isTTY) {
4001
- printTable(data, logFn, externalLogValue);
4674
+ printTable(data, logFn, externalLogValue, tableRowStyle);
4002
4675
  return;
4003
4676
  }
4004
4677
  const naturalWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
@@ -4006,7 +4679,7 @@ function printResizableTable(data, logFn = console.log, externalLogValue, availa
4006
4679
  const totalWidth = naturalWidths.reduce((a, b) => a + b, 0) + separatorTotal;
4007
4680
  const termWidth = availableWidth ?? (process.stdout.columns || 120);
4008
4681
  if (totalWidth <= termWidth) {
4009
- printTable(data, logFn, externalLogValue);
4682
+ printTable(data, logFn, externalLogValue, tableRowStyle);
4010
4683
  return;
4011
4684
  }
4012
4685
  const overflow = totalWidth - termWidth;
@@ -4052,6 +4725,7 @@ function printResizableTable(data, logFn = console.log, externalLogValue, availa
4052
4725
  logFn(header);
4053
4726
  logFn(keys.map((_, i) => "-".repeat(finalWidths[i])).join("-|-"));
4054
4727
  data.forEach((item) => {
4728
+ const style = tableRowStyle?.(item);
4055
4729
  const cellLines = keys.map((key, i) => wrapText(cellToString(item[key]), finalWidths[i]));
4056
4730
  const lineCount = Math.max(...cellLines.map((l) => l.length));
4057
4731
  for (let line = 0;line < lineCount; line++) {
@@ -4059,7 +4733,7 @@ function printResizableTable(data, logFn = console.log, externalLogValue, availa
4059
4733
  const val = line < cellLines[i].length ? cellLines[i][line] : "";
4060
4734
  return val.padEnd(finalWidths[i]);
4061
4735
  }).join(" | ");
4062
- logFn(row);
4736
+ logFn(styleLine(row, style));
4063
4737
  }
4064
4738
  });
4065
4739
  if (externalLogValue) {
@@ -4203,30 +4877,36 @@ var OutputFormatter;
4203
4877
  ((OutputFormatter) => {
4204
4878
  function success(data, options) {
4205
4879
  data.Log ??= getLogFilePath() || undefined;
4206
- const normalize = !options?.preserveDataKeys;
4880
+ const normalize = options?.preserveDataKeys !== true;
4881
+ const verbatim = toVerbatimKeySet(options?.preserveDataKeys);
4882
+ const subtrees = verbatim && {
4883
+ refs: new Set,
4884
+ mode: "collect"
4885
+ };
4207
4886
  if (normalize) {
4208
- data.Data = normalizeDataKeys(data.Data);
4887
+ data.Data = normalizeDataKeys(data.Data, verbatim, subtrees);
4209
4888
  }
4210
4889
  const filter = getOutputFilter();
4211
4890
  if (filter) {
4212
4891
  const filtered = applyFilter(data.Data, filter);
4213
- data.Data = normalize ? normalizeDataKeys(filtered) : filtered;
4892
+ data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
4214
4893
  }
4215
- logOutput(normalizeOutputKeys(data), getOutputFormat());
4894
+ logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
4216
4895
  }
4217
4896
  OutputFormatter.success = success;
4218
4897
  function error(data) {
4219
4898
  data.Log ??= getLogFilePath() || undefined;
4220
4899
  data.ErrorCode ??= defaultErrorCodeForFailure(data);
4221
4900
  data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
4222
- process.exitCode = EXIT_CODES[data.Result] ?? 1;
4901
+ const exitCode = EXIT_CODES[data.Result] ?? 1;
4902
+ setExitCode(exitCode);
4223
4903
  recordCommandFailureTelemetry({
4224
4904
  result: data.Result,
4225
4905
  errorCode: data.ErrorCode,
4226
4906
  retry: data.Retry,
4227
4907
  message: data.Message,
4228
4908
  context: data.Context,
4229
- exitCode: process.exitCode,
4909
+ exitCode,
4230
4910
  errorClass: data.TelemetryErrorClass,
4231
4911
  terminalOutcome: data.TelemetryTerminalOutcome,
4232
4912
  terminalSignal: data.TelemetryTerminalSignal
@@ -4302,6 +4982,39 @@ var OutputFormatter;
4302
4982
  }
4303
4983
  OutputFormatter.formatToString = formatToString;
4304
4984
  })(OutputFormatter ||= {});
4985
+ // ../../node_modules/commander/esm.mjs
4986
+ var import__ = __toESM(require_commander(), 1);
4987
+ var {
4988
+ program,
4989
+ createCommand,
4990
+ createArgument,
4991
+ createOption,
4992
+ CommanderError,
4993
+ InvalidArgumentError,
4994
+ InvalidOptionArgumentError,
4995
+ Command,
4996
+ Argument,
4997
+ Option,
4998
+ Help
4999
+ } = import__.default;
5000
+
5001
+ // ../common/src/command-examples.ts
5002
+ var examplesByCommand = new WeakMap;
5003
+ Command.prototype.examples = function(examples) {
5004
+ examplesByCommand.set(this, examples);
5005
+ return this;
5006
+ };
5007
+ // ../common/src/preview.ts
5008
+ var previewSlot = singleton("PreviewBuild");
5009
+ function isPreviewBuild() {
5010
+ return previewSlot.get(false) ?? false;
5011
+ }
5012
+ Command.prototype.previewCommand = function(nameAndArgs, opts) {
5013
+ if (isPreviewBuild()) {
5014
+ return this.command(nameAndArgs, opts);
5015
+ }
5016
+ return new Command(nameAndArgs.split(/\s+/)[0] ?? nameAndArgs);
5017
+ };
4305
5018
 
4306
5019
  // ../common/src/telemetry/command-attribution.ts
4307
5020
  var LEGACY_SKILL_NAMESPACE = "uipath:";
@@ -4456,6 +5169,57 @@ function buildCommandTelemetryAttribution(commandPath, skillSource) {
4456
5169
  };
4457
5170
  }
4458
5171
 
5172
+ // ../common/src/telemetry/command-name.ts
5173
+ var TELEMETRY_COMMAND_ROOT = "uip";
5174
+ function commandTelemetryName(parts) {
5175
+ const tokens = [];
5176
+ for (const part of parts) {
5177
+ const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !== TELEMETRY_COMMAND_ROOT);
5178
+ if (pieces.every(isCommandToken)) {
5179
+ tokens.push(...pieces);
5180
+ continue;
5181
+ }
5182
+ tokens.push(UNKNOWN_TOKEN);
5183
+ }
5184
+ return [TELEMETRY_COMMAND_ROOT, ...tokens].join(".");
5185
+ }
5186
+ var COMMAND_TOKEN_PATTERN = /^[a-z0-9][a-z0-9-]*$/;
5187
+ var MAX_COMMAND_TOKEN_LENGTH = 32;
5188
+ var GUID_TOKEN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
5189
+ function isCommandToken(token) {
5190
+ return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token) && !/^\d+$/.test(token);
5191
+ }
5192
+ var UNKNOWN_TOKEN = "<unknown>";
5193
+
5194
+ // ../common/src/telemetry/invocation-request.ts
5195
+ var requestContextSlot = singleton("TelemetryInvocationRequestContext");
5196
+ function activeContext() {
5197
+ return telemetry.getActiveContext?.();
5198
+ }
5199
+ function runWithInvocationRequest(fn) {
5200
+ const context = telemetry.createRequestContext();
5201
+ context.startedAt = invocationStartedAt();
5202
+ requestContextSlot.set(context);
5203
+ return telemetry.runWithContext(context, fn);
5204
+ }
5205
+ function ensureInvocationRequestScope(fn) {
5206
+ if (activeContext() !== undefined) {
5207
+ return fn();
5208
+ }
5209
+ const kept = requestContextSlot.get();
5210
+ return kept === undefined ? runWithInvocationRequest(fn) : telemetry.runWithContext(kept, fn);
5211
+ }
5212
+ function getInvocationRequestContext() {
5213
+ return activeContext() ?? requestContextSlot.get();
5214
+ }
5215
+ function emitInvocationRequest(name, success, properties) {
5216
+ const context = getInvocationRequestContext();
5217
+ telemetry.trackRequestResult(name, invocationElapsedMs(), success, properties, context);
5218
+ if (context !== undefined && requestContextSlot.get() === context) {
5219
+ requestContextSlot.clear();
5220
+ }
5221
+ }
5222
+
4459
5223
  // ../common/src/trackedAction.ts
4460
5224
  var pollSignalSlot = singleton("PollSignal");
4461
5225
  var cliErrorCodeValues = new Set(CLI_ERROR_CODES);
@@ -4463,28 +5227,74 @@ var retryHintValues = new Set(RETRY_HINTS);
4463
5227
  var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
4464
5228
  var processContext = {
4465
5229
  exit: (code) => {
4466
- process.exitCode = code;
5230
+ recordExitCode(code);
5231
+ setExitCode(code);
4467
5232
  },
4468
5233
  get pollSignal() {
4469
5234
  return pollSignalSlot.get();
4470
5235
  }
4471
5236
  };
5237
+ var TELEMETRY_ARG_VALUE_WITHHELD = "<provided>";
5238
+ var TELEMETRY_ARG_VALUE_DEFAULTED = "<default>";
5239
+ function recordableArgValue(value, choices) {
5240
+ if (typeof value === "boolean" || typeof value === "number") {
5241
+ return value;
5242
+ }
5243
+ if (choices && choices.length > 0) {
5244
+ if (typeof value === "string" && choices.includes(value)) {
5245
+ return value;
5246
+ }
5247
+ if (Array.isArray(value) && value.length > 0 && value.every((entry) => typeof entry === "string" && choices.includes(entry))) {
5248
+ return value.join(",");
5249
+ }
5250
+ }
5251
+ return TELEMETRY_ARG_VALUE_WITHHELD;
5252
+ }
4472
5253
  function extractCommandParams(cmd) {
4473
5254
  const params = {};
4474
- const add = (name, value) => {
4475
- if (name && value !== undefined) {
4476
- params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = value;
4477
- }
4478
- };
5255
+ forEachSuppliedArgument(cmd, (name, value, choices, defaulted) => {
5256
+ const recordable = recordableArgValue(value, choices);
5257
+ params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = recordable === TELEMETRY_ARG_VALUE_WITHHELD && defaulted ? TELEMETRY_ARG_VALUE_DEFAULTED : recordable;
5258
+ });
5259
+ return params;
5260
+ }
5261
+ function isDefaultedOption(cmd, name) {
5262
+ const source = cmd.getOptionValueSource?.(name);
5263
+ return source === "default" || source === "implied";
5264
+ }
5265
+ function isDefaultedPositional(cmd, index) {
5266
+ return index >= (cmd.args?.length ?? 0);
5267
+ }
5268
+ function forEachSuppliedArgument(cmd, visit) {
4479
5269
  const registered = cmd.registeredArguments ?? [];
4480
5270
  const processed = cmd.processedArgs ?? [];
4481
5271
  for (let i = 0;i < registered.length; i++) {
4482
- add(registered[i].name(), processed[i]);
5272
+ const name = registered[i].name();
5273
+ if (name && processed[i] !== undefined) {
5274
+ visit(name, processed[i], registered[i].argChoices, isDefaultedPositional(cmd, i));
5275
+ }
5276
+ }
5277
+ const choicesByAttribute = new Map;
5278
+ for (const option of cmd.options) {
5279
+ choicesByAttribute.set(option.attributeName(), option.argChoices);
4483
5280
  }
4484
5281
  for (const [key, value] of Object.entries(cmd.opts())) {
4485
- add(key, value);
5282
+ if (key && value !== undefined) {
5283
+ visit(key, value, choicesByAttribute.get(key), isDefaultedOption(cmd, key));
5284
+ }
4486
5285
  }
4487
- return params;
5286
+ }
5287
+ function withheldArgumentValues(cmd) {
5288
+ const values = [];
5289
+ forEachSuppliedArgument(cmd, (_name, value, choices, defaulted) => {
5290
+ if (defaulted) {
5291
+ return;
5292
+ }
5293
+ if (recordableArgValue(value, choices) === TELEMETRY_ARG_VALUE_WITHHELD) {
5294
+ values.push(value);
5295
+ }
5296
+ });
5297
+ return values;
4488
5298
  }
4489
5299
  function deriveCommandPath(cmd) {
4490
5300
  const parts = [];
@@ -4499,7 +5309,7 @@ function deriveCommandPath(cmd) {
4499
5309
  if (parts.length > 1) {
4500
5310
  parts.shift();
4501
5311
  }
4502
- return ["uip", ...parts.filter((p) => p !== "uip")].join(".");
5312
+ return commandTelemetryName(parts);
4503
5313
  }
4504
5314
  function isCliErrorCode(value) {
4505
5315
  return typeof value === "string" && cliErrorCodeValues.has(value);
@@ -4539,68 +5349,77 @@ Command.prototype.trackedAction = function(context, fn, properties) {
4539
5349
  });
4540
5350
  const telemetryName = deriveCommandPath(command);
4541
5351
  const props = typeof properties === "function" ? properties(...args) : properties;
4542
- const requestContext = telemetry.createRequestContext();
4543
- const startTime = performance.now();
4544
- let errorMessage;
4545
- let fallbackExitCode = EXIT_CODES.Success;
4546
- clearRecordedCommandFailureTelemetry();
4547
- const [error] = await catchError2(telemetry.runWithContext(requestContext, () => {
4548
- const violation = implicitLimitViolation(command);
4549
- if (violation) {
4550
- return Promise.reject(violation);
4551
- }
4552
- return fn(...args);
4553
- }));
4554
- if (error) {
4555
- errorMessage = error instanceof Error ? error.message : String(error);
4556
- logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
4557
- const typed = error;
4558
- const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
4559
- const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
4560
- const finalResult = customResult ?? RESULTS.Failure;
4561
- const typedErrorCode = typed.errorCode ?? typed.ErrorCode;
4562
- const customErrorCode = isCliErrorCode(typedErrorCode) ? typedErrorCode : undefined;
4563
- const typedRetry = typed.retry ?? typed.Retry;
4564
- const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
4565
- const typedContext = typed.context ?? typed.Context;
4566
- const customContext = isErrorContext(typedContext) ? typedContext : undefined;
4567
- const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
4568
- fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
4569
- OutputFormatter.error({
4570
- Result: finalResult,
4571
- ...customErrorCode ? { ErrorCode: customErrorCode } : {},
4572
- Message: errorMessage,
4573
- Instructions: customInstructions ?? commandHelpHint(telemetryName),
4574
- ...customRetry ? { Retry: customRetry } : {},
4575
- ...customContext ? { Context: customContext } : {}
5352
+ markCommandStart();
5353
+ const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
5354
+ try {
5355
+ const startTime = performance.now();
5356
+ let errorMessage;
5357
+ let fallbackExitCode = EXIT_CODES.Success;
5358
+ clearRecordedCommandFailureTelemetry();
5359
+ const [error] = await catchError(ensureInvocationRequestScope(() => {
5360
+ const violation = implicitLimitViolation(command);
5361
+ if (violation) {
5362
+ return Promise.reject(violation);
5363
+ }
5364
+ return fn(...args);
5365
+ }));
5366
+ if (error) {
5367
+ errorMessage = error instanceof Error ? error.message : String(error);
5368
+ logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
5369
+ const typed = error;
5370
+ const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
5371
+ const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
5372
+ const finalResult = customResult ?? RESULTS.Failure;
5373
+ const typedErrorCode = typed.errorCode ?? typed.ErrorCode;
5374
+ const customErrorCode = isCliErrorCode(typedErrorCode) ? typedErrorCode : undefined;
5375
+ const typedRetry = typed.retry ?? typed.Retry;
5376
+ const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
5377
+ const typedContext = typed.context ?? typed.Context;
5378
+ const customContext = isErrorContext(typedContext) ? typedContext : undefined;
5379
+ const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
5380
+ fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
5381
+ OutputFormatter.error({
5382
+ Result: finalResult,
5383
+ ...customErrorCode ? { ErrorCode: customErrorCode } : {},
5384
+ Message: errorMessage,
5385
+ Instructions: customInstructions ?? commandHelpHint(telemetryName),
5386
+ ...customRetry ? { Retry: customRetry } : {},
5387
+ ...customContext ? { Context: customContext } : {}
5388
+ });
5389
+ context.exit(fallbackExitCode);
5390
+ }
5391
+ const durationMs = performance.now() - startTime;
5392
+ recordCommandDuration(durationMs);
5393
+ const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
5394
+ const recordedFailure = takeRecordedCommandFailureTelemetry();
5395
+ const success = !error && exitCode === 0;
5396
+ const terminalTelemetry = buildCommandTerminalTelemetryProperties({
5397
+ error,
5398
+ exitCode,
5399
+ recordedFailure,
5400
+ pollSignal: context.pollSignal
4576
5401
  });
4577
- context.exit(fallbackExitCode);
4578
- }
4579
- const durationMs = performance.now() - startTime;
4580
- const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
4581
- const recordedFailure = takeRecordedCommandFailureTelemetry();
4582
- const success = !error && exitCode === 0;
4583
- const terminalTelemetry = buildCommandTerminalTelemetryProperties({
4584
- error,
4585
- exitCode,
4586
- recordedFailure,
4587
- pollSignal: context.pollSignal
4588
- });
4589
- const commandParams = extractCommandParams(command);
4590
- if (props) {
4591
- for (const key of Object.keys(props)) {
4592
- delete commandParams[`${TELEMETRY_COMMAND_ARG_PREFIX}${key}`];
4593
- }
4594
- }
4595
- const baseProperties = redactProperties({
4596
- ...commandParams,
4597
- ...props,
4598
- ...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
4599
- command: "true",
4600
- ...terminalTelemetry,
4601
- ...errorMessage ? { errorMessage } : {}
4602
- });
4603
- telemetry.trackRequestResult(telemetryName, durationMs, success, baseProperties, requestContext);
5402
+ if (terminalTelemetry.error_class === "internal" && error) {
5403
+ telemetry.trackException(error instanceof Error ? error : new Error(String(error)), { command_name: telemetryName }, getInvocationRequestContext());
5404
+ }
5405
+ const commandParams = extractCommandParams(command);
5406
+ if (props) {
5407
+ for (const key of Object.keys(props)) {
5408
+ delete commandParams[`${TELEMETRY_COMMAND_ARG_PREFIX}${key}`];
5409
+ }
5410
+ }
5411
+ const baseProperties = redactProperties({
5412
+ ...commandParams,
5413
+ ...props,
5414
+ ...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
5415
+ command: "true",
5416
+ ...terminalTelemetry,
5417
+ ...errorMessage ? { errorMessage } : {}
5418
+ });
5419
+ emitInvocationRequest(telemetryName, success, baseProperties);
5420
+ } finally {
5421
+ releaseSuppliedArgumentValues(supplied);
5422
+ }
4604
5423
  });
4605
5424
  };
4606
5425
  // ../common/src/completer.ts
@@ -4623,6 +5442,204 @@ var guardInstalledSlot = singleton("ConsoleGuardInstalled");
4623
5442
  var savedOriginalsSlot = singleton("ConsoleGuardOriginals");
4624
5443
  // ../common/src/constants.ts
4625
5444
  var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
5445
+ // ../common/src/entity-name-rules.ts
5446
+ var RESERVED_SQL_KEYWORDS_LOWER = new Set(["group", "order"]);
5447
+ var RESERVED_FIELD_NAMES_LOWER = new Set([
5448
+ "id",
5449
+ "createdby",
5450
+ "createtime",
5451
+ "updatedby",
5452
+ "updatetime",
5453
+ "recordowner",
5454
+ "version"
5455
+ ]);
5456
+ var RESERVED_KEYWORDS_LOWER = new Set([
5457
+ "abstract",
5458
+ "as",
5459
+ "base",
5460
+ "bool",
5461
+ "break",
5462
+ "byte",
5463
+ "case",
5464
+ "catch",
5465
+ "char",
5466
+ "checked",
5467
+ "class",
5468
+ "const",
5469
+ "continue",
5470
+ "decimal",
5471
+ "default",
5472
+ "delegate",
5473
+ "do",
5474
+ "double",
5475
+ "else",
5476
+ "enum",
5477
+ "event",
5478
+ "explicit",
5479
+ "extern",
5480
+ "false",
5481
+ "finally",
5482
+ "fixed",
5483
+ "float",
5484
+ "for",
5485
+ "foreach",
5486
+ "goto",
5487
+ "if",
5488
+ "implicit",
5489
+ "in",
5490
+ "int",
5491
+ "interface",
5492
+ "internal",
5493
+ "is",
5494
+ "lock",
5495
+ "long",
5496
+ "namespace",
5497
+ "new",
5498
+ "null",
5499
+ "object",
5500
+ "operator",
5501
+ "out",
5502
+ "override",
5503
+ "params",
5504
+ "private",
5505
+ "protected",
5506
+ "public",
5507
+ "readonly",
5508
+ "ref",
5509
+ "return",
5510
+ "sbyte",
5511
+ "sealed",
5512
+ "short",
5513
+ "sizeof",
5514
+ "stackalloc",
5515
+ "static",
5516
+ "string",
5517
+ "struct",
5518
+ "switch",
5519
+ "this",
5520
+ "throw",
5521
+ "true",
5522
+ "try",
5523
+ "typeof",
5524
+ "uint",
5525
+ "ulong",
5526
+ "unchecked",
5527
+ "unsafe",
5528
+ "ushort",
5529
+ "using",
5530
+ "virtual",
5531
+ "void",
5532
+ "volatile",
5533
+ "while",
5534
+ "addhandler",
5535
+ "addressof",
5536
+ "alias",
5537
+ "and",
5538
+ "andalso",
5539
+ "boolean",
5540
+ "byref",
5541
+ "byval",
5542
+ "call",
5543
+ "cbool",
5544
+ "cbyte",
5545
+ "cchar",
5546
+ "cdate",
5547
+ "cdbl",
5548
+ "cdec",
5549
+ "cint",
5550
+ "clng",
5551
+ "cobj",
5552
+ "csbyte",
5553
+ "cshort",
5554
+ "csng",
5555
+ "cstr",
5556
+ "ctype",
5557
+ "cuint",
5558
+ "culng",
5559
+ "cushort",
5560
+ "date",
5561
+ "declare",
5562
+ "dim",
5563
+ "directcast",
5564
+ "each",
5565
+ "elseif",
5566
+ "end",
5567
+ "endif",
5568
+ "erase",
5569
+ "error",
5570
+ "exit",
5571
+ "friend",
5572
+ "function",
5573
+ "get",
5574
+ "gettype",
5575
+ "getxmlnamespace",
5576
+ "global",
5577
+ "gosub",
5578
+ "goto",
5579
+ "handles",
5580
+ "implements",
5581
+ "imports",
5582
+ "inherits",
5583
+ "integer",
5584
+ "isnot",
5585
+ "let",
5586
+ "lib",
5587
+ "like",
5588
+ "loop",
5589
+ "me",
5590
+ "mod",
5591
+ "module",
5592
+ "mustinherit",
5593
+ "mustoverride",
5594
+ "mybase",
5595
+ "myclass",
5596
+ "narrowing",
5597
+ "next",
5598
+ "not",
5599
+ "nothing",
5600
+ "notinheritable",
5601
+ "notoverridable",
5602
+ "of",
5603
+ "on",
5604
+ "option",
5605
+ "optional",
5606
+ "or",
5607
+ "orelse",
5608
+ "overloads",
5609
+ "overridable",
5610
+ "overrides",
5611
+ "paramarray",
5612
+ "partial",
5613
+ "property",
5614
+ "raiseevent",
5615
+ "redim",
5616
+ "rem",
5617
+ "removehandler",
5618
+ "resume",
5619
+ "select",
5620
+ "set",
5621
+ "shadows",
5622
+ "shared",
5623
+ "single",
5624
+ "step",
5625
+ "stop",
5626
+ "structure",
5627
+ "sub",
5628
+ "synclock",
5629
+ "then",
5630
+ "to",
5631
+ "trycast",
5632
+ "uinteger",
5633
+ "ushort",
5634
+ "variant",
5635
+ "wend",
5636
+ "when",
5637
+ "widening",
5638
+ "with",
5639
+ "withevents",
5640
+ "writeonly",
5641
+ "xor"
5642
+ ]);
4626
5643
  // ../common/src/host-global-options.ts
4627
5644
  var HOST_GLOBAL_OPTIONS_WITH_VALUE = [
4628
5645
  "--output",
@@ -4781,7 +5798,7 @@ function abortError(signal) {
4781
5798
  return err;
4782
5799
  }
4783
5800
  function interruptibleSleep(ms, signal) {
4784
- return new Promise((resolve, reject) => {
5801
+ return new Promise((resolve2, reject) => {
4785
5802
  if (signal?.aborted) {
4786
5803
  reject(abortError(signal));
4787
5804
  return;
@@ -4794,7 +5811,7 @@ function interruptibleSleep(ms, signal) {
4794
5811
  };
4795
5812
  const timer = setTimeout(() => {
4796
5813
  cleanup();
4797
- resolve();
5814
+ resolve2();
4798
5815
  }, ms);
4799
5816
  if (signal) {
4800
5817
  onAbort = () => {
@@ -4860,7 +5877,7 @@ async function handlePollError(error, errorSource, cfg, state) {
4860
5877
  state.consecutiveErrors++;
4861
5878
  const onError = cfg.onError;
4862
5879
  if (onError) {
4863
- const [callbackErr, decision] = await catchError2(Promise.resolve().then(() => onError(error, state.consecutiveErrors)));
5880
+ const [callbackErr, decision] = await catchError(Promise.resolve().then(() => onError(error, state.consecutiveErrors)));
4864
5881
  if (callbackErr) {
4865
5882
  if (cfg.label) {
4866
5883
  logger.warn(`[${cfg.logPrefix}] ${cfg.label} — onError callback threw: ${callbackErr.message}`);
@@ -4897,7 +5914,7 @@ function computeErrorSleepMs(cfg, state, ctx) {
4897
5914
  }
4898
5915
  async function doSleep(ms, cfg) {
4899
5916
  if (ms > 0) {
4900
- const [err] = await catchError2(interruptibleSleep(ms, cfg.signal));
5917
+ const [err] = await catchError(interruptibleSleep(ms, cfg.signal));
4901
5918
  if (err) {
4902
5919
  if (isAbortError(err))
4903
5920
  return;
@@ -4911,7 +5928,7 @@ function isAbortError(err) {
4911
5928
  return err.name === "AbortError";
4912
5929
  }
4913
5930
  async function safeCallback(label, name, fn, prefix) {
4914
- const [err] = await catchError2(Promise.resolve().then(() => fn()));
5931
+ const [err] = await catchError(Promise.resolve().then(() => fn()));
4915
5932
  if (err && label) {
4916
5933
  logger.warn(`[${prefix}] ${label} — ${name} callback threw: ${err.message}`);
4917
5934
  }
@@ -4923,7 +5940,7 @@ async function processSuccessfulPoll(result, cfg, state) {
4923
5940
  }
4924
5941
  if (cfg.getStatus) {
4925
5942
  const getStatus = cfg.getStatus;
4926
- const [statusErr, newStatus] = catchError2(() => getStatus(result));
5943
+ const [statusErr, newStatus] = catchError(() => getStatus(result));
4927
5944
  if (statusErr) {
4928
5945
  if (cfg.label) {
4929
5946
  logger.warn(`[${cfg.logPrefix}] ${cfg.label} — getStatus threw: ${statusErr.message}`);
@@ -4962,7 +5979,7 @@ async function handleCompleted(result, cfg) {
4962
5979
  let statusStr = "";
4963
5980
  if (cfg.getStatus) {
4964
5981
  const getStatus = cfg.getStatus;
4965
- const [, status] = catchError2(() => getStatus(result));
5982
+ const [, status] = catchError(() => getStatus(result));
4966
5983
  if (status != null)
4967
5984
  statusStr = ` ${status}`;
4968
5985
  }
@@ -5025,7 +6042,7 @@ function logStart(options, cfg) {
5025
6042
  if (typeof options.intervalMs === "function") {
5026
6043
  intervalDesc = "dynamic";
5027
6044
  } else {
5028
- const [intervalErr, intervalVal] = catchError2(() => cfg.getInterval({ pollCount: 0, elapsedMs: 0 }));
6045
+ const [intervalErr, intervalVal] = catchError(() => cfg.getInterval({ pollCount: 0, elapsedMs: 0 }));
5029
6046
  intervalDesc = intervalErr ? "dynamic" : `${intervalVal}ms`;
5030
6047
  }
5031
6048
  const backoffDesc = options.backoff ? ", error backoff enabled" : "";
@@ -5063,7 +6080,7 @@ async function runPollLoop(cfg, state) {
5063
6080
  }
5064
6081
  const ctx = buildContext(cfg, state);
5065
6082
  if (cfg.beforePoll) {
5066
- const [beforePollErr] = await catchError2(Promise.resolve().then(() => cfg.beforePoll?.(ctx)));
6083
+ const [beforePollErr] = await catchError(Promise.resolve().then(() => cfg.beforePoll?.(ctx)));
5067
6084
  if (beforePollErr) {
5068
6085
  const outcome = await handleErrorAndSleep(beforePollErr, "beforePoll", cfg, state, ctx);
5069
6086
  if (outcome)
@@ -5071,7 +6088,7 @@ async function runPollLoop(cfg, state) {
5071
6088
  continue;
5072
6089
  }
5073
6090
  }
5074
- const [pollErr, result] = await catchError2(cfg.fn());
6091
+ const [pollErr, result] = await catchError(cfg.fn());
5075
6092
  if (pollErr) {
5076
6093
  const outcome = await handleErrorAndSleep(pollErr, "poll", cfg, state, ctx);
5077
6094
  if (outcome)
@@ -5079,7 +6096,7 @@ async function runPollLoop(cfg, state) {
5079
6096
  continue;
5080
6097
  }
5081
6098
  await processSuccessfulPoll(result, cfg, state);
5082
- const [untilErr, isTerminal] = catchError2(() => cfg.until(result));
6099
+ const [untilErr, isTerminal] = catchError(() => cfg.until(result));
5083
6100
  if (untilErr) {
5084
6101
  const outcome = await handleErrorAndSleep(untilErr, "until", cfg, state, ctx);
5085
6102
  if (outcome)
@@ -5478,7 +6495,7 @@ class VoidApiResponse {
5478
6495
  var package_default2 = {
5479
6496
  name: "@uipath/sc-sdk",
5480
6497
  license: "MIT",
5481
- version: "1.201.0",
6498
+ version: "1.202.0",
5482
6499
  description: "SDK for the UiPath SourceControl API — connections, repositories, automation projects, solutions.",
5483
6500
  repository: {
5484
6501
  type: "git",
@@ -6663,6 +7680,40 @@ class SolutionsApi extends BaseAPI {
6663
7680
  return await response.value();
6664
7681
  }
6665
7682
  }
7683
+ // ../auth/src/catch-error.ts
7684
+ function isPromiseLike2(value) {
7685
+ return value !== null && typeof value === "object" && typeof value.then === "function";
7686
+ }
7687
+ function catchError2(fnOrPromise) {
7688
+ if (isPromiseLike2(fnOrPromise)) {
7689
+ return settlePromiseLike2(fnOrPromise);
7690
+ }
7691
+ try {
7692
+ const result = fnOrPromise();
7693
+ if (isPromiseLike2(result)) {
7694
+ return settlePromiseLike2(result);
7695
+ }
7696
+ return [undefined, result];
7697
+ } catch (error) {
7698
+ return [
7699
+ error instanceof Error ? error : new Error(String(error)),
7700
+ undefined
7701
+ ];
7702
+ }
7703
+ }
7704
+ function settlePromiseLike2(thenable) {
7705
+ return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [
7706
+ error instanceof Error ? error : new Error(String(error)),
7707
+ undefined
7708
+ ]);
7709
+ }
7710
+
7711
+ // ../auth/src/constants.ts
7712
+ var UIPATH_HOME_DIR = ".uipath";
7713
+ var AUTH_FILENAME = ".auth";
7714
+ var DEFAULT_BASE_URL = "https://cloud.uipath.com";
7715
+ var DEFAULT_AUTH_TIMEOUT_MS2 = 5 * 60 * 1000;
7716
+
6666
7717
  // ../auth/src/config.ts
6667
7718
  var DEFAULT_CLIENT_ID = "36dea5b8-e8bb-423d-8e7b-c808df8f1c00";
6668
7719
  var AUTH_FILE_CONFIG_KEY = Symbol.for("@uipath/auth/AuthFileConfig");
@@ -6676,7 +7727,7 @@ class InvalidBaseUrlError extends Error {
6676
7727
  super(`Invalid base URL: "${url}"
6677
7728
  ` + `Reason: ${reason}
6678
7729
 
6679
- ` + `Expected format: an https:// URL, e.g. https://cloud.uipath.com (commercial), https://govcloud.uipath.us (Public Sector), or your Automation Suite host (https://<your-host>).
7730
+ ` + `Expected format: an https:// URL (or bare host — https:// is assumed), e.g. https://cloud.uipath.com (commercial), https://govcloud.uipath.us (Public Sector), or your Automation Suite host (https://<your-host>).
6680
7731
  ` + `You can specify the URL via:
6681
7732
  ` + ` • --authority flag
6682
7733
  ` + ` • UIPATH_URL environment variable
@@ -6697,10 +7748,16 @@ var normalizeAndValidateBaseUrl = (rawUrl) => {
6697
7748
  while (baseUrl.endsWith("/")) {
6698
7749
  baseUrl = baseUrl.slice(0, -1);
6699
7750
  }
7751
+ const hasScheme = /^[a-z][a-z0-9+.-]*:\/\//i.test(baseUrl);
7752
+ const [hostCandidate] = baseUrl.split(/[/?#]/, 1);
7753
+ if (!hasScheme && hostCandidate.includes(".")) {
7754
+ baseUrl = `https://${baseUrl}`;
7755
+ }
6700
7756
  const resolvedBaseUrl = baseUrl;
6701
- const [urlError, url] = catchError(() => new URL(resolvedBaseUrl));
7757
+ const [urlError, url] = catchError2(() => new URL(resolvedBaseUrl));
6702
7758
  if (urlError) {
6703
- throw new InvalidBaseUrlError(baseUrl, `Malformed URL. ${urlError instanceof Error ? urlError.message : "Unknown error"}`);
7759
+ const shapeHint = !hasScheme && !hostCandidate.includes(".") ? ` "${rawUrl.trim()}" is not a URL or a host name. Pass the full authority URL — https://<host>, or just <host> (https:// is assumed).` : ` ${urlError instanceof Error ? urlError.message : "Unknown error"}`;
7760
+ throw new InvalidBaseUrlError(baseUrl, `Malformed URL.${shapeHint}`);
6704
7761
  }
6705
7762
  if (url.protocol !== "https:") {
6706
7763
  throw new InvalidBaseUrlError(baseUrl, `Authority must use https:// scheme, got ${url.protocol}//. OIDC token exchange requires TLS end-to-end.`);
@@ -6755,6 +7812,11 @@ var resolveConfigAsync = async ({
6755
7812
  };
6756
7813
  };
6757
7814
 
7815
+ // ../auth/src/utils/platform.ts
7816
+ function isBrowser() {
7817
+ return typeof globalThis !== "undefined" && "window" in globalThis && "document" in globalThis;
7818
+ }
7819
+
6758
7820
  // ../auth/src/authProfile.ts
6759
7821
  var DEFAULT_AUTH_PROFILE = "default";
6760
7822
  var PROFILE_DIR = "profiles";
@@ -6766,7 +7828,7 @@ function isAuthProfileStorage(value) {
6766
7828
  return value !== null && typeof value === "object" && "getStore" in value && "run" in value;
6767
7829
  }
6768
7830
  function createProfileStorage() {
6769
- const [error, mod] = catchError(() => __require("node:async_hooks"));
7831
+ const [error, mod] = catchError2(() => __require("node:async_hooks"));
6770
7832
  if (error || typeof mod?.AsyncLocalStorage !== "function") {
6771
7833
  return {
6772
7834
  getStore: () => {
@@ -6782,9 +7844,9 @@ function getProfileStorage() {
6782
7844
  if (isAuthProfileStorage(existing)) {
6783
7845
  return existing;
6784
7846
  }
6785
- const storage = createProfileStorage();
6786
- globalSlot2[AUTH_PROFILE_STORAGE_KEY] = storage;
6787
- return storage;
7847
+ const storage2 = createProfileStorage();
7848
+ globalSlot2[AUTH_PROFILE_STORAGE_KEY] = storage2;
7849
+ return storage2;
6788
7850
  }
6789
7851
  var profileStorage = getProfileStorage();
6790
7852
 
@@ -6815,8 +7877,8 @@ function resolveAuthProfileFilePath(profile) {
6815
7877
  if (normalized === undefined) {
6816
7878
  throw new AuthProfileValidationError(`"${DEFAULT_AUTH_PROFILE}" is the built-in profile and does not have a profile file path.`);
6817
7879
  }
6818
- const fs = getFileSystem();
6819
- return fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR, normalized, AUTH_FILENAME);
7880
+ const fs2 = getFileSystem();
7881
+ return fs2.path.join(fs2.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR, normalized, AUTH_FILENAME);
6820
7882
  }
6821
7883
  function getActiveAuthProfileFilePath() {
6822
7884
  const profile = getActiveAuthProfile();
@@ -6897,7 +7959,7 @@ var getTokenExpiration = (accessToken) => {
6897
7959
  // ../auth/src/sessionIdentity.ts
6898
7960
  var parseAuthFlow = (value) => value === "authorization_code" || value === "client_credentials" || value === "federated_credentials" ? value : undefined;
6899
7961
  var decodeClaims = (accessToken) => {
6900
- const [error, claims] = catchError(() => parseJWT(accessToken));
7962
+ const [error, claims] = catchError2(() => parseJWT(accessToken));
6901
7963
  return error ? undefined : claims;
6902
7964
  };
6903
7965
  var asString = (value) => typeof value === "string" && value.length > 0 ? value : undefined;
@@ -6981,27 +8043,48 @@ var requireEnv = (name) => {
6981
8043
  }
6982
8044
  return value;
6983
8045
  };
8046
+ var OPAQUE_TOKEN_BASE_URL_VAR = "UIPATH_URL";
8047
+ var resolveBaseUrl = (rawUrl, failureContext) => {
8048
+ const [baseUrlError, baseUrl] = catchError2(() => normalizeAndValidateBaseUrl(rawUrl));
8049
+ if (baseUrlError) {
8050
+ if (baseUrlError instanceof InvalidBaseUrlError) {
8051
+ throw baseUrlError;
8052
+ }
8053
+ throw new EnvAuthConfigError(`${failureContext}: ` + `${baseUrlError instanceof Error ? baseUrlError.message : String(baseUrlError)}`);
8054
+ }
8055
+ return baseUrl;
8056
+ };
6984
8057
  var readAuthFromEnv = () => {
6985
8058
  const accessToken = requireEnv(ENV_AUTH_VARS.token);
6986
8059
  const organizationName = requireEnv(ENV_AUTH_VARS.organizationName);
6987
8060
  const organizationId = requireEnv(ENV_AUTH_VARS.organizationId);
6988
8061
  const tenantName = requireEnv(ENV_AUTH_VARS.tenantName);
6989
8062
  const tenantId = requireEnv(ENV_AUTH_VARS.tenantId);
6990
- const [parseError, payload] = catchError(() => parseJWT(accessToken));
8063
+ const [parseError, payload] = catchError2(() => parseJWT(accessToken));
6991
8064
  if (parseError) {
6992
- throw new EnvAuthConfigError(`${ENV_AUTH_VARS.token} is not a valid JWT: ` + `${parseError instanceof Error ? parseError.message : String(parseError)}`);
8065
+ const parseErrorMessage = parseError instanceof Error ? parseError.message : String(parseError);
8066
+ const rawUrl = process.env[OPAQUE_TOKEN_BASE_URL_VAR];
8067
+ if (!rawUrl) {
8068
+ throw new EnvAuthConfigError(`${ENV_AUTH_VARS.token} is not a JWT (treating it as an opaque token, ` + `e.g. a Personal Access Token). Set ${OPAQUE_TOKEN_BASE_URL_VAR} to the ` + `UiPath base URL if this is a PAT, or fix the token if it was meant to ` + `be a JWT (parse error: ${parseErrorMessage}).`);
8069
+ }
8070
+ const baseUrl2 = resolveBaseUrl(rawUrl, `Failed to validate ${OPAQUE_TOKEN_BASE_URL_VAR}`);
8071
+ return {
8072
+ loginStatus: "Logged in",
8073
+ accessToken,
8074
+ baseUrl: baseUrl2,
8075
+ organizationName,
8076
+ organizationId,
8077
+ tenantName,
8078
+ tenantId,
8079
+ source: "env-vars" /* EnvironmentVariables */,
8080
+ hint: "Token is opaque (not a JWT) - expiration and identity cannot be " + "determined locally. Commands will fail with 401 once it is revoked or " + `expired. If this was meant to be a JWT instead of a PAT, note: ${parseErrorMessage}`
8081
+ };
6993
8082
  }
6994
8083
  const iss = payload.iss;
6995
8084
  if (typeof iss !== "string" || iss.length === 0) {
6996
8085
  throw new EnvAuthConfigError(`${ENV_AUTH_VARS.token} has no 'iss' claim; cannot determine ` + `the UiPath server. Ensure the token was issued by a UiPath identity server.`);
6997
8086
  }
6998
- const [baseUrlError, baseUrl] = catchError(() => normalizeAndValidateBaseUrl(iss));
6999
- if (baseUrlError) {
7000
- if (baseUrlError instanceof InvalidBaseUrlError) {
7001
- throw baseUrlError;
7002
- }
7003
- throw new EnvAuthConfigError(`Failed to derive server URL from token 'iss' claim: ` + `${baseUrlError instanceof Error ? baseUrlError.message : String(baseUrlError)}`);
7004
- }
8087
+ const baseUrl = resolveBaseUrl(iss, "Failed to derive server URL from token 'iss' claim");
7005
8088
  const expiration = getTokenExpiration(accessToken);
7006
8089
  const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
7007
8090
  const identity = resolveSessionIdentity(accessToken);
@@ -7027,8 +8110,8 @@ var SURFACE_WINDOW_MS = 60 * 60 * 1000;
7027
8110
  async function refreshTokenFingerprint(refreshToken) {
7028
8111
  const bytes = new TextEncoder().encode(refreshToken);
7029
8112
  if (globalThis.crypto?.subtle) {
7030
- const digest = await globalThis.crypto.subtle.digest("SHA-256", bytes);
7031
- return Array.from(new Uint8Array(digest), (b) => b.toString(16).padStart(2, "0")).join("").slice(0, 16);
8113
+ const digest2 = await globalThis.crypto.subtle.digest("SHA-256", bytes);
8114
+ return Array.from(new Uint8Array(digest2), (b) => b.toString(16).padStart(2, "0")).join("").slice(0, 16);
7032
8115
  }
7033
8116
  const { createHash } = await import("node:crypto");
7034
8117
  return createHash("sha256").update(refreshToken).digest("hex").slice(0, 16);
@@ -7037,9 +8120,9 @@ function breakerPathFor(authPath) {
7037
8120
  return `${authPath}${BREAKER_SUFFIX}`;
7038
8121
  }
7039
8122
  async function loadRefreshBreaker(authPath) {
7040
- const fs = getFileSystem();
8123
+ const fs2 = getFileSystem();
7041
8124
  try {
7042
- const content = await fs.readFile(breakerPathFor(authPath), "utf-8");
8125
+ const content = await fs2.readFile(breakerPathFor(authPath), "utf-8");
7043
8126
  if (!content)
7044
8127
  return {};
7045
8128
  const parsed = JSON.parse(content);
@@ -7050,20 +8133,20 @@ async function loadRefreshBreaker(authPath) {
7050
8133
  }
7051
8134
  async function saveRefreshBreaker(authPath, state) {
7052
8135
  try {
7053
- const fs = getFileSystem();
7054
- const path = breakerPathFor(authPath);
7055
- await fs.mkdir(fs.path.dirname(path));
7056
- const tempPath = `${path}.tmp`;
7057
- await fs.writeFile(tempPath, JSON.stringify(state));
7058
- await fs.rename(tempPath, path);
8136
+ const fs2 = getFileSystem();
8137
+ const path2 = breakerPathFor(authPath);
8138
+ await fs2.mkdir(fs2.path.dirname(path2));
8139
+ const tempPath = `${path2}.tmp`;
8140
+ await fs2.writeFile(tempPath, JSON.stringify(state));
8141
+ await fs2.rename(tempPath, path2);
7059
8142
  } catch {}
7060
8143
  }
7061
8144
  async function clearRefreshBreaker(authPath) {
7062
- const fs = getFileSystem();
7063
- const path = breakerPathFor(authPath);
8145
+ const fs2 = getFileSystem();
8146
+ const path2 = breakerPathFor(authPath);
7064
8147
  try {
7065
- if (await fs.exists(path)) {
7066
- await fs.rm(path);
8148
+ if (await fs2.exists(path2)) {
8149
+ await fs2.rm(path2);
7067
8150
  }
7068
8151
  } catch {}
7069
8152
  }
@@ -7084,43 +8167,43 @@ var ROBOT_USER_SERVICES_PIPE = "UiPathUserServices";
7084
8167
  var ROBOT_USER_SERVICES_ALTERNATE_PIPE = `${ROBOT_USER_SERVICES_PIPE}Alternate`;
7085
8168
  var PIPE_NAME_MAX_LENGTH = 103;
7086
8169
  var getRobotIpcPipeNames = async () => {
7087
- const fs = getFileSystem();
7088
- const username = fs.env.getenv("USER") ?? fs.env.getenv("USERNAME");
8170
+ const fs2 = getFileSystem();
8171
+ const username = fs2.env.getenv("USER") ?? fs2.env.getenv("USERNAME");
7089
8172
  if (!username) {
7090
8173
  throw new Error("Unable to determine current username");
7091
8174
  }
7092
- const tempPath = fs.env.getenv("TMPDIR") ?? "/tmp/";
7093
- return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) => fs.path.join(tempPath, `${baseName}_${username}`).substring(0, PIPE_NAME_MAX_LENGTH));
8175
+ const tempPath = fs2.env.getenv("TMPDIR") ?? "/tmp/";
8176
+ return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) => fs2.path.join(tempPath, `${baseName}_${username}`).substring(0, PIPE_NAME_MAX_LENGTH));
7094
8177
  };
7095
8178
  var defaultIsRobotIpcAvailable = async () => {
7096
8179
  if (process.platform === "win32") {
7097
8180
  return true;
7098
8181
  }
7099
- const [pipeNamesError, pipeNames] = await catchError(getRobotIpcPipeNames());
8182
+ const [pipeNamesError, pipeNames] = await catchError2(getRobotIpcPipeNames());
7100
8183
  if (pipeNamesError || !pipeNames) {
7101
8184
  return false;
7102
8185
  }
7103
- const fs = getFileSystem();
8186
+ const fs2 = getFileSystem();
7104
8187
  for (const pipeName of pipeNames) {
7105
- const [existsError, exists] = await catchError(fs.exists(pipeName));
8188
+ const [existsError, exists] = await catchError2(fs2.exists(pipeName));
7106
8189
  if (!existsError && exists === true) {
7107
8190
  return true;
7108
8191
  }
7109
8192
  }
7110
8193
  return false;
7111
8194
  };
7112
- var withTimeout = (promise, timeoutMs) => new Promise((resolve, reject) => {
8195
+ var withTimeout = (promise, timeoutMs) => new Promise((resolve2, reject) => {
7113
8196
  const timer = setTimeout(() => reject(new Error(`Robot IPC call timed out after ${timeoutMs}ms`)), timeoutMs);
7114
8197
  promise.then((value) => {
7115
8198
  clearTimeout(timer);
7116
- resolve(value);
8199
+ resolve2(value);
7117
8200
  }, (error) => {
7118
8201
  clearTimeout(timer);
7119
8202
  reject(error);
7120
8203
  });
7121
8204
  });
7122
8205
  var parseResourceUrl = (url) => {
7123
- const [error, parsed] = catchError(() => new URL(url));
8206
+ const [error, parsed] = catchError2(() => new URL(url));
7124
8207
  if (error || !parsed)
7125
8208
  return;
7126
8209
  const segments = parsed.pathname.split("/").filter(Boolean);
@@ -7140,7 +8223,7 @@ var defaultLoadModule = async () => {
7140
8223
  if (!hostLoader) {
7141
8224
  return;
7142
8225
  }
7143
- const [error, mod] = await catchError(() => hostLoader());
8226
+ const [error, mod] = await catchError2(() => hostLoader());
7144
8227
  if (error || !mod) {
7145
8228
  return;
7146
8229
  }
@@ -7166,7 +8249,7 @@ var tryRobotClientFallback = async (options = {}) => {
7166
8249
  const mod = await loadModule();
7167
8250
  if (!mod)
7168
8251
  return;
7169
- const [ctorError, proxy] = catchError(() => new mod.RobotProxyConstructor);
8252
+ const [ctorError, proxy] = catchError2(() => new mod.RobotProxyConstructor);
7170
8253
  if (ctorError || !proxy) {
7171
8254
  return;
7172
8255
  }
@@ -7189,7 +8272,7 @@ var tryRobotClientFallback = async (options = {}) => {
7189
8272
  let organizationIdFromToken;
7190
8273
  let tenantIdFromToken;
7191
8274
  let issuerFromToken;
7192
- const [jwtError, claims] = catchError(() => parseJWT(accessToken));
8275
+ const [jwtError, claims] = catchError2(() => parseJWT(accessToken));
7193
8276
  if (!jwtError && claims) {
7194
8277
  const rawOrgId = claims.prtId ?? claims.organizationId ?? claims.prt_id;
7195
8278
  if (typeof rawOrgId === "string" && rawOrgId.length > 0) {
@@ -7216,7 +8299,7 @@ var tryRobotClientFallback = async (options = {}) => {
7216
8299
  } catch {
7217
8300
  return;
7218
8301
  } finally {
7219
- await catchError(() => withTimeout(proxy.CloseAsync(), CLOSE_TIMEOUT_MS));
8302
+ await catchError2(() => withTimeout(proxy.CloseAsync(), CLOSE_TIMEOUT_MS));
7220
8303
  }
7221
8304
  };
7222
8305
 
@@ -7286,9 +8369,9 @@ var errorCode = (err) => {
7286
8369
  }
7287
8370
  return "EUNKNOWN";
7288
8371
  };
7289
- var probeAsync = async (fs, candidate) => {
8372
+ var probeAsync = async (fs2, candidate) => {
7290
8373
  try {
7291
- const stats = await fs.stat(candidate);
8374
+ const stats = await fs2.stat(candidate);
7292
8375
  if (stats === null) {
7293
8376
  return { exists: false };
7294
8377
  }
@@ -7315,9 +8398,9 @@ var probeAsync = async (fs, candidate) => {
7315
8398
  }
7316
8399
  };
7317
8400
  var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
7318
- const fs = getFileSystem();
7319
- if (fs.path.isAbsolute(envFilePath)) {
7320
- const probe2 = await probeAsync(fs, envFilePath);
8401
+ const fs2 = getFileSystem();
8402
+ if (fs2.path.isAbsolute(envFilePath)) {
8403
+ const probe2 = await probeAsync(fs2, envFilePath);
7321
8404
  return probe2.exists ? { exists: true, absolutePath: envFilePath, source: "absolute" } : {
7322
8405
  exists: false,
7323
8406
  absolutePath: envFilePath,
@@ -7325,11 +8408,11 @@ var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opt
7325
8408
  ...probe2.unusable ? { unusable: probe2.unusable } : {}
7326
8409
  };
7327
8410
  }
7328
- const cwd = opts?.cwd ?? fs.env.cwd();
8411
+ const cwd = opts?.cwd ?? fs2.env.cwd();
7329
8412
  let searchDir = cwd;
7330
8413
  while (true) {
7331
- const candidate = fs.path.join(searchDir, envFilePath);
7332
- const probe2 = await probeAsync(fs, candidate);
8414
+ const candidate = fs2.path.join(searchDir, envFilePath);
8415
+ const probe2 = await probeAsync(fs2, candidate);
7333
8416
  if (probe2.exists) {
7334
8417
  return {
7335
8418
  exists: true,
@@ -7337,14 +8420,14 @@ var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opt
7337
8420
  source: searchDir === cwd ? "cwd" : "ancestor"
7338
8421
  };
7339
8422
  }
7340
- const parentDir = fs.path.dirname(searchDir);
8423
+ const parentDir = fs2.path.dirname(searchDir);
7341
8424
  if (parentDir === searchDir) {
7342
8425
  break;
7343
8426
  }
7344
8427
  searchDir = parentDir;
7345
8428
  }
7346
- const homePath = fs.path.join(fs.env.homedir(), envFilePath);
7347
- const probe = await probeAsync(fs, homePath);
8429
+ const homePath = fs2.path.join(fs2.env.homedir(), envFilePath);
8430
+ const probe = await probeAsync(fs2, homePath);
7348
8431
  if (probe.exists) {
7349
8432
  return { exists: true, absolutePath: homePath, source: "home" };
7350
8433
  }
@@ -7366,12 +8449,12 @@ var resolveEnvFilePathAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) =
7366
8449
  };
7367
8450
  };
7368
8451
  var loadEnvFileAsync = async ({ envPath }) => {
7369
- const fs = getFileSystem();
7370
- const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.cwd(), envPath);
7371
- if (!await fs.exists(absolutePath)) {
8452
+ const fs2 = getFileSystem();
8453
+ const absolutePath = fs2.path.isAbsolute(envPath) ? envPath : fs2.path.join(fs2.env.cwd(), envPath);
8454
+ if (!await fs2.exists(absolutePath)) {
7372
8455
  throw new Error(`Environment file not found: ${envPath}`);
7373
8456
  }
7374
- const content = await fs.readFile(absolutePath, "utf-8");
8457
+ const content = await fs2.readFile(absolutePath, "utf-8");
7375
8458
  if (content === null) {
7376
8459
  throw new Error(`Environment file not found: ${envPath}`);
7377
8460
  }
@@ -7400,10 +8483,10 @@ var saveEnvFileAsync = async ({
7400
8483
  data,
7401
8484
  merge = true
7402
8485
  }) => {
7403
- const fs = getFileSystem();
7404
- const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.homedir(), envPath);
8486
+ const fs2 = getFileSystem();
8487
+ const absolutePath = fs2.path.isAbsolute(envPath) ? envPath : fs2.path.join(fs2.env.homedir(), envPath);
7405
8488
  let existingData = {};
7406
- if (merge && await fs.exists(absolutePath)) {
8489
+ if (merge && await fs2.exists(absolutePath)) {
7407
8490
  try {
7408
8491
  existingData = await loadEnvFileAsync({ envPath: absolutePath });
7409
8492
  } catch {}
@@ -7421,11 +8504,11 @@ var saveEnvFileAsync = async ({
7421
8504
  const content = `${lines.join(`
7422
8505
  `)}
7423
8506
  `;
7424
- const dir = fs.path.dirname(absolutePath);
7425
- await fs.mkdir(dir);
8507
+ const dir = fs2.path.dirname(absolutePath);
8508
+ await fs2.mkdir(dir);
7426
8509
  const tempPath = `${absolutePath}.tmp`;
7427
- await fs.writeFile(tempPath, content);
7428
- await fs.rename(tempPath, absolutePath);
8510
+ await fs2.writeFile(tempPath, content);
8511
+ await fs2.rename(tempPath, absolutePath);
7429
8512
  };
7430
8513
 
7431
8514
  // ../auth/src/loginStatus.ts
@@ -7539,11 +8622,11 @@ async function loadFileCredentials(loadEnvFile, absolutePath) {
7539
8622
  return { credentials };
7540
8623
  }
7541
8624
  async function getGlobalCredsHint(getFs, loadEnvFile, absolutePath, envFilePath) {
7542
- const fs = getFs();
7543
- const globalPath = fs.path.join(fs.env.homedir(), envFilePath);
8625
+ const fs2 = getFs();
8626
+ const globalPath = fs2.path.join(fs2.env.homedir(), envFilePath);
7544
8627
  if (absolutePath === globalPath)
7545
8628
  return;
7546
- if (!await fs.exists(globalPath))
8629
+ if (!await fs2.exists(globalPath))
7547
8630
  return;
7548
8631
  try {
7549
8632
  const globalCreds = await loadEnvFile({ envPath: globalPath });
@@ -8229,7 +9312,7 @@ class VoidApiResponse2 {
8229
9312
  var package_default3 = {
8230
9313
  name: "@uipath/cicd-sdk",
8231
9314
  license: "MIT",
8232
- version: "1.201.0",
9315
+ version: "1.202.0",
8233
9316
  description: "SDK for the UiPath StudioAdmin CICD API — pipelines, pipeline executions, partition configuration.",
8234
9317
  repository: {
8235
9318
  type: "git",
@@ -9371,7 +10454,7 @@ var withLoginValidity = (cmd) => {
9371
10454
  return cmd;
9372
10455
  };
9373
10456
  async function getScApi(ApiClass, options) {
9374
- const [err, api] = await catchError2(createApiClient(ApiClass, { loginValidity: options.loginValidity }));
10457
+ const [err, api] = await catchError(createApiClient(ApiClass, { loginValidity: options.loginValidity }));
9375
10458
  if (err) {
9376
10459
  OutputFormatter.error({
9377
10460
  Result: RESULTS.Failure,
@@ -9384,7 +10467,7 @@ async function getScApi(ApiClass, options) {
9384
10467
  return api;
9385
10468
  }
9386
10469
  async function getCicdApi(ApiClass, options) {
9387
- const [err, api] = await catchError2(createApiClient2(ApiClass, { loginValidity: options.loginValidity }));
10470
+ const [err, api] = await catchError(createApiClient2(ApiClass, { loginValidity: options.loginValidity }));
9388
10471
  if (err) {
9389
10472
  OutputFormatter.error({
9390
10473
  Result: RESULTS.Failure,
@@ -9604,11 +10687,14 @@ var REPOS_BULK_EXAMPLES = [
9604
10687
  Command: "uip aops connection repos-bulk --ids f1e2d3c4-0000-0000-0000-000000000001,f1e2d3c4-0000-0000-0000-000000000002",
9605
10688
  Output: {
9606
10689
  Code: "ConnectionReposBulk",
9607
- Data: {
9608
- [SAMPLE_CONNECTION_ID]: [
9609
- { identifier: SAMPLE_REPO_ID, name: "automation-hub" }
9610
- ]
9611
- }
10690
+ Data: [
10691
+ {
10692
+ ConnectionId: SAMPLE_CONNECTION_ID,
10693
+ Repositories: [
10694
+ { identifier: SAMPLE_REPO_ID, name: "automation-hub" }
10695
+ ]
10696
+ }
10697
+ ]
9612
10698
  }
9613
10699
  }
9614
10700
  ];
@@ -9676,7 +10762,7 @@ var registerConnectionCommand = (program2) => {
9676
10762
  const api = await getScApi(ConnectionsApi, options);
9677
10763
  if (!api)
9678
10764
  return;
9679
- const [error, result] = await catchError2(api.connectionsGetConnections());
10765
+ const [error, result] = await catchError(api.connectionsGetConnections());
9680
10766
  if (error) {
9681
10767
  OutputFormatter.error({
9682
10768
  Result: RESULTS.Failure,
@@ -9703,7 +10789,7 @@ var registerConnectionCommand = (program2) => {
9703
10789
  const api = await getScApi(ConnectionsApi, options);
9704
10790
  if (!api)
9705
10791
  return;
9706
- const [error, result] = await catchError2(api.connectionsGetConnectionsStates());
10792
+ const [error, result] = await catchError(api.connectionsGetConnectionsStates());
9707
10793
  if (error) {
9708
10794
  OutputFormatter.error({
9709
10795
  Result: RESULTS.Failure,
@@ -9736,7 +10822,7 @@ var registerConnectionCommand = (program2) => {
9736
10822
  const triggerCall = connectionId ? api.connectionsSyncConnection({
9737
10823
  connectionIdentifier: connectionId
9738
10824
  }) : api.connectionsSyncConnections();
9739
- const [error] = await catchError2(triggerCall);
10825
+ const [error] = await catchError(triggerCall);
9740
10826
  if (error) {
9741
10827
  OutputFormatter.error({
9742
10828
  Result: RESULTS.Failure,
@@ -9811,7 +10897,7 @@ var registerConnectionCommand = (program2) => {
9811
10897
  const api = await getScApi(ConnectionsApi, options);
9812
10898
  if (!api)
9813
10899
  return;
9814
- const [error] = await catchError2(api.connectionsDeleteConnection({
10900
+ const [error] = await catchError(api.connectionsDeleteConnection({
9815
10901
  connectionIdentifier: connectionId
9816
10902
  }));
9817
10903
  if (error) {
@@ -9840,7 +10926,7 @@ var registerConnectionCommand = (program2) => {
9840
10926
  const api = await getScApi(ConnectionsApi, options);
9841
10927
  if (!api)
9842
10928
  return;
9843
- const [error, result] = await catchError2(api.connectionsGetRepositories({
10929
+ const [error, result] = await catchError(api.connectionsGetRepositories({
9844
10930
  connectionIdentifier: connectionId,
9845
10931
  azureProjectsIds: options.azureProjectsIds,
9846
10932
  organizationIdentifier: options.organizationIdentifier
@@ -9863,15 +10949,16 @@ var registerConnectionCommand = (program2) => {
9863
10949
  withLoginValidity(connection.command("repos-bulk").description([
9864
10950
  "Fetch repositories for multiple connections in a single round-trip.",
9865
10951
  "",
9866
- "Returns a map keyed by connection identifier — handy when you need a quick",
9867
- "cross-connection inventory without N round-trips. Pass connection ids as a",
9868
- "comma-separated list via `--ids`."
10952
+ "Returns one row per connection — `ConnectionId` plus its `Repositories`,",
10953
+ "so the id feeds back into `connection repos <id>` — handy when you need a",
10954
+ "quick cross-connection inventory without N round-trips. Pass connection ids",
10955
+ "as a comma-separated list via `--ids`."
9869
10956
  ].join(`
9870
10957
  `)).requiredOption("--ids <csv>", "Comma-separated connection identifiers from `connection list`.").examples(REPOS_BULK_EXAMPLES)).trackedAction(processContext, async (options) => {
9871
10958
  const api = await getScApi(ConnectionsApi, options);
9872
10959
  if (!api)
9873
10960
  return;
9874
- const [error, result] = await catchError2(api.connectionsGetRepositoriesPerConnections({
10961
+ const [error, result] = await catchError(api.connectionsGetRepositoriesPerConnections({
9875
10962
  connectionsIdentifiers: csvToArray(options.ids)
9876
10963
  }));
9877
10964
  if (error) {
@@ -9886,7 +10973,10 @@ var registerConnectionCommand = (program2) => {
9886
10973
  OutputFormatter.success({
9887
10974
  Result: RESULTS.Success,
9888
10975
  Code: "ConnectionReposBulk",
9889
- Data: result
10976
+ Data: Object.entries(result ?? {}).map(([connectionId, repositories]) => ({
10977
+ ConnectionId: connectionId,
10978
+ Repositories: repositories ?? []
10979
+ }))
9890
10980
  });
9891
10981
  });
9892
10982
  withLoginValidity(connection.command("projects").description([
@@ -9927,7 +11017,7 @@ var registerConnectionCommand = (program2) => {
9927
11017
  processContext.exit(1);
9928
11018
  return;
9929
11019
  }
9930
- const [error, result] = await catchError2(api.connectionsGetProjects({
11020
+ const [error, result] = await catchError(api.connectionsGetProjects({
9931
11021
  connectionIdentifier: connectionId,
9932
11022
  repositoryIds: options.repositoryIds,
9933
11023
  targetFramework: options.targetFramework,
@@ -9989,7 +11079,7 @@ var registerConnectionCommand = (program2) => {
9989
11079
  processContext.exit(1);
9990
11080
  return;
9991
11081
  }
9992
- const [error, result] = await catchError2(api.connectionsGetSolutions({
11082
+ const [error, result] = await catchError(api.connectionsGetSolutions({
9993
11083
  connectionIdentifier: connectionId,
9994
11084
  pageIndex: skip / take,
9995
11085
  pageSize: take,
@@ -10021,7 +11111,7 @@ var registerConnectionCommand = (program2) => {
10021
11111
  const api = await getScApi(ConnectionsApi, options);
10022
11112
  if (!api)
10023
11113
  return;
10024
- const [error, result] = await catchError2(api.connectionsGetAzureProjects({
11114
+ const [error, result] = await catchError(api.connectionsGetAzureProjects({
10025
11115
  connectionIdentifier: connectionId,
10026
11116
  organizationIdentifier: options.organizationIdentifier
10027
11117
  }));
@@ -10042,6 +11132,9 @@ var registerConnectionCommand = (program2) => {
10042
11132
  });
10043
11133
  };
10044
11134
 
11135
+ // src/commands/_shared/verbatim-fields.ts
11136
+ var ARGUMENT_FIELDS = ["arguments", "inputArguments"];
11137
+
10045
11138
  // src/commands/execution.ts
10046
11139
  var SAMPLE_EXECUTION_ID = "22222222-3333-4444-5555-666666666666";
10047
11140
  var TERMINAL_STATES = new Set([
@@ -10133,7 +11226,7 @@ async function resolveJobKey(api, executionId, override) {
10133
11226
  processContext.exit(1);
10134
11227
  return null;
10135
11228
  }
10136
- const [error, exec] = await catchError2(api.pipelineExecutionsGetPipelineExecution({
11229
+ const [error, exec] = await catchError(api.pipelineExecutionsGetPipelineExecution({
10137
11230
  pipelineExecutionIdentifier: executionId
10138
11231
  }));
10139
11232
  if (error) {
@@ -10190,7 +11283,7 @@ var registerExecutionCommand = (program2) => {
10190
11283
  const api = await getCicdApi(PipelineExecutionsApi, options);
10191
11284
  if (!api)
10192
11285
  return;
10193
- const [error, result] = await catchError2(api.pipelineExecutionsGetPipelineExecution({
11286
+ const [error, result] = await catchError(api.pipelineExecutionsGetPipelineExecution({
10194
11287
  pipelineExecutionIdentifier: executionId
10195
11288
  }));
10196
11289
  if (error) {
@@ -10217,7 +11310,7 @@ var registerExecutionCommand = (program2) => {
10217
11310
  logger.warn("--with-arguments: execution has no jobExecutionIdentifier yet (runner not picked up); inputArguments will be null.");
10218
11311
  data = { ...data, inputArguments: null };
10219
11312
  } else {
10220
- const [detailsErr, details] = await catchError2(api.pipelineExecutionsGetPipelineJobDetails({
11313
+ const [detailsErr, details] = await catchError(api.pipelineExecutionsGetPipelineJobDetails({
10221
11314
  jobKey: result.jobExecutionIdentifier
10222
11315
  }));
10223
11316
  if (detailsErr) {
@@ -10231,11 +11324,7 @@ var registerExecutionCommand = (program2) => {
10231
11324
  }
10232
11325
  }
10233
11326
  }
10234
- OutputFormatter.success({
10235
- Result: RESULTS.Success,
10236
- Code: "ExecutionGet",
10237
- Data: data
10238
- });
11327
+ OutputFormatter.success({ Result: RESULTS.Success, Code: "ExecutionGet", Data: data }, { preserveDataKeys: ARGUMENT_FIELDS });
10239
11328
  });
10240
11329
  withLoginValidity(execution.command("logs").description([
10241
11330
  "Fetch logs for an execution. With `--follow`, polls until the execution",
@@ -10270,7 +11359,7 @@ var registerExecutionCommand = (program2) => {
10270
11359
  return;
10271
11360
  const limit = options.limit ?? 200;
10272
11361
  if (!options.follow) {
10273
- const [error, result] = await catchError2(api.pipelineExecutionsGetPipelineExecutionLogs({
11362
+ const [error, result] = await catchError(api.pipelineExecutionsGetPipelineExecutionLogs({
10274
11363
  jobKey: resolved.jobKey,
10275
11364
  skip: 0,
10276
11365
  take: limit
@@ -10355,7 +11444,7 @@ var registerExecutionCommand = (program2) => {
10355
11444
  const resolved = await resolveJobKey(api, executionId, options.jobKey);
10356
11445
  if (!resolved)
10357
11446
  return;
10358
- const [error, result] = await catchError2(api.pipelineExecutionsGetPipelineJobDetails({
11447
+ const [error, result] = await catchError(api.pipelineExecutionsGetPipelineJobDetails({
10359
11448
  jobKey: resolved.jobKey
10360
11449
  }));
10361
11450
  if (error || !result?.key) {
@@ -10400,7 +11489,7 @@ var registerExecutionCommand = (program2) => {
10400
11489
  return;
10401
11490
  let currentState = resolved.state;
10402
11491
  if (currentState === undefined && executionId) {
10403
- const [, exec] = await catchError2(api.pipelineExecutionsGetPipelineExecution({
11492
+ const [, exec] = await catchError(api.pipelineExecutionsGetPipelineExecution({
10404
11493
  pipelineExecutionIdentifier: executionId
10405
11494
  }));
10406
11495
  currentState = exec?.state;
@@ -10417,7 +11506,7 @@ var registerExecutionCommand = (program2) => {
10417
11506
  });
10418
11507
  return;
10419
11508
  }
10420
- const [stopErr] = await catchError2(api.pipelineExecutionsStopPipelineJobExecution({
11509
+ const [stopErr] = await catchError(api.pipelineExecutionsStopPipelineJobExecution({
10421
11510
  jobKey: resolved.jobKey
10422
11511
  }));
10423
11512
  if (stopErr) {
@@ -10493,15 +11582,15 @@ var mapExecutionRow = (e) => ({
10493
11582
 
10494
11583
  // src/commands/_shared/load-json.ts
10495
11584
  var loadJsonFile = async (file, contractName) => {
10496
- const fs = getFileSystem();
10497
- const [readErr, content] = await catchError2(fs.readFile(file, "utf-8"));
11585
+ const fs2 = getFileSystem();
11586
+ const [readErr, content] = await catchError(fs2.readFile(file, "utf-8"));
10498
11587
  if (readErr || content === null) {
10499
11588
  return emit({
10500
11589
  message: readErr?.message ?? `File not found: ${file}`,
10501
11590
  instructions: `Verify the file exists at '${file}' and is readable.`
10502
11591
  });
10503
11592
  }
10504
- const [parseErr, parsed] = catchError2(() => JSON.parse(content));
11593
+ const [parseErr, parsed] = catchError(() => JSON.parse(content));
10505
11594
  if (parseErr) {
10506
11595
  return emit({
10507
11596
  message: parseErr.message,
@@ -10592,16 +11681,16 @@ var partitionEditPipelineKeys = (parsed) => {
10592
11681
  var sentEditPipelineFields = (dto) => Object.fromEntries(Object.entries(EditPipelineDtoToJSON(dto)).filter(([, value]) => value !== undefined));
10593
11682
 
10594
11683
  // src/commands/_shared/write-json-file.ts
10595
- var writeJsonFile = async (path, data) => {
10596
- const fs = getFileSystem();
10597
- const absolutePath = fs.path.resolve(path);
11684
+ var writeJsonFile = async (path2, data) => {
11685
+ const fs2 = getFileSystem();
11686
+ const absolutePath = fs2.path.resolve(path2);
10598
11687
  const json = `${JSON.stringify(data, null, 2)}
10599
11688
  `;
10600
- const [err] = await catchError2(fs.writeFile(absolutePath, json));
11689
+ const [err] = await catchError(fs2.writeFile(absolutePath, json));
10601
11690
  if (err) {
10602
11691
  OutputFormatter.error({
10603
11692
  Result: RESULTS.Failure,
10604
- Message: `Failed to write '${path}': ${err.message}`,
11693
+ Message: `Failed to write '${path2}': ${err.message}`,
10605
11694
  Instructions: "Verify the parent directory exists, is writable, and that the path is not a directory or a read-only file."
10606
11695
  });
10607
11696
  processContext.exit(1);
@@ -10611,7 +11700,7 @@ var writeJsonFile = async (path, data) => {
10611
11700
  };
10612
11701
 
10613
11702
  // src/commands/pipeline.ts
10614
- var UPDATE_FILE_INSTRUCTIONS = `update is a full-replace PUT, so any field it does not send is cleared. Use EditPipelineDto's own field names — ${EDITABLE_PIPELINE_FIELDS.join(", ")} — and regenerate the file with 'uip aops pipeline get <pipeline-id> --for-update --output-file <path>'. Only --output-file writes the raw DTO; the stdout envelope is PascalCased and is not a valid input file.`;
11703
+ var UPDATE_FILE_INSTRUCTIONS = `update is a full-replace PUT, so any field it does not send is cleared. Use EditPipelineDto's own field names — ${EDITABLE_PIPELINE_FIELDS.join(", ")} — and regenerate the file with 'uip aops pipeline get <pipeline-id> --for-update --output-file <path>', which writes the DTO on its own. Redirecting stdout instead writes the whole envelope, so --file would see Result/Code/Data rather than the DTO.`;
10615
11704
  var SAMPLE_PIPELINE_ID = "11111111-2222-3333-4444-555555555555";
10616
11705
  var SAMPLE_EXECUTION_ID2 = "22222222-3333-4444-5555-666666666666";
10617
11706
  var csvToArray2 = (raw) => raw.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
@@ -10844,7 +11933,7 @@ var registerPipelineCommand = (program2) => {
10844
11933
  processContext.exit(1);
10845
11934
  return;
10846
11935
  }
10847
- const [error, result] = await catchError2(api.pipelineGetPipelines({
11936
+ const [error, result] = await catchError(api.pipelineGetPipelines({
10848
11937
  repositoryIds: options.repositoryIds,
10849
11938
  pageIndex: offset / limit,
10850
11939
  pageSize: limit,
@@ -10875,7 +11964,7 @@ var registerPipelineCommand = (program2) => {
10875
11964
  const api = await getCicdApi(PipelineApi, options);
10876
11965
  if (!api)
10877
11966
  return;
10878
- const [error, result] = await catchError2(api.pipelineGetPipelinesState());
11967
+ const [error, result] = await catchError(api.pipelineGetPipelinesState());
10879
11968
  if (error) {
10880
11969
  OutputFormatter.error({
10881
11970
  Result: RESULTS.Failure,
@@ -10907,7 +11996,7 @@ var registerPipelineCommand = (program2) => {
10907
11996
  const api = await getCicdApi(PipelineApi, options);
10908
11997
  if (!api)
10909
11998
  return;
10910
- const [error, result] = await catchError2(api.pipelineGetPipelineProcesses());
11999
+ const [error, result] = await catchError(api.pipelineGetPipelineProcesses());
10911
12000
  if (error) {
10912
12001
  OutputFormatter.error({
10913
12002
  Result: RESULTS.Failure,
@@ -10927,7 +12016,7 @@ var registerPipelineCommand = (program2) => {
10927
12016
  const api = await getCicdApi(PipelineApi, options);
10928
12017
  if (!api)
10929
12018
  return;
10930
- const [error, result] = await catchError2(api.pipelineGetPipelineProcess({ identifier: processId }));
12019
+ const [error, result] = await catchError(api.pipelineGetPipelineProcess({ identifier: processId }));
10931
12020
  if (error) {
10932
12021
  const message = error instanceof SyntaxError || /unexpected end of json/i.test(error.message ?? "") ? `Process ${processId} not found.` : await extractErrorMessage(error);
10933
12022
  OutputFormatter.error({
@@ -10951,13 +12040,13 @@ var registerPipelineCommand = (program2) => {
10951
12040
  Result: RESULTS.Success,
10952
12041
  Code: "PipelineProcess",
10953
12042
  Data: result
10954
- });
12043
+ }, { preserveDataKeys: ARGUMENT_FIELDS });
10955
12044
  });
10956
12045
  withLoginValidity(pipeline.command("repos").description("List SourceControl repositories that have at least one pipeline.").examples(REPOS_EXAMPLES2)).trackedAction(processContext, async (options) => {
10957
12046
  const api = await getCicdApi(PipelineApi, options);
10958
12047
  if (!api)
10959
12048
  return;
10960
- const [error, result] = await catchError2(api.pipelineGetPipelinesRepositories());
12049
+ const [error, result] = await catchError(api.pipelineGetPipelinesRepositories());
10961
12050
  if (error) {
10962
12051
  OutputFormatter.error({
10963
12052
  Result: RESULTS.Failure,
@@ -10982,16 +12071,22 @@ var registerPipelineCommand = (program2) => {
10982
12071
  "Pass `--output-file <path>` to persist the payload to a JSON file in",
10983
12072
  "addition to the structured stdout envelope.",
10984
12073
  "",
10985
- "Combine `--for-update` with `--output-file`: that file holds the raw DTO and",
10986
- "is what `update --file` accepts. The stdout envelope is PascalCased like",
10987
- "every other command's, so capturing it instead produces a file `update`",
10988
- "rejects."
12074
+ "`--for-update` keeps the DTO's own key casing in `Data` on both routes.",
12075
+ "`--output-file` writes that payload alone, so it is what `update --file`",
12076
+ "reads; capturing stdout captures the whole envelope, whose `Data` has to be",
12077
+ "extracted first. Without the flag, `Data` is PascalCased like every other",
12078
+ "command's — except the `Arguments` map, whose keys are the names you chose",
12079
+ "and are never rewritten.",
12080
+ "",
12081
+ "`--output-filter` runs against `Data` as printed, and JMESPath is",
12082
+ "case-sensitive: with `--for-update` match the DTO's own names (`name`), and",
12083
+ "inside `Arguments` match your own argument names."
10989
12084
  ].join(`
10990
- `)).argument("<pipeline-id>", "Pipeline identifier from `pipeline list`.").option("--for-update", "Return the EditPipelineDto shape instead of the full PipelineDto. Written to --output-file it is round-trip-ready for `pipeline update --file`; the stdout envelope is PascalCased and is not.").option("--output-file <path>", "Write the success Data payload to this file as JSON (UTF-8, 2-space indent). Stdout still emits the structured envelope.").examples(GET_EXAMPLES2)).trackedAction(processContext, async (pipelineId, options) => {
12085
+ `)).argument("<pipeline-id>", "Pipeline identifier from `pipeline list`.").option("--for-update", "Return the EditPipelineDto shape instead of the full PipelineDto. Combine with --output-file to write a file `pipeline update --file` accepts as-is; from stdout, extract `Data` first.").option("--output-file <path>", "Write the success Data payload to this file as JSON (UTF-8, 2-space indent). Stdout still emits the structured envelope.").examples(GET_EXAMPLES2)).trackedAction(processContext, async (pipelineId, options) => {
10991
12086
  const api = await getCicdApi(PipelineApi, options);
10992
12087
  if (!api)
10993
12088
  return;
10994
- const [error, result] = await catchError2(api.pipelineGetPipelineByIdentifier({ value: pipelineId }));
12089
+ const [error, result] = await catchError(api.pipelineGetPipelineByIdentifier({ value: pipelineId }));
10995
12090
  if (error) {
10996
12091
  OutputFormatter.error({
10997
12092
  Result: RESULTS.Failure,
@@ -11007,10 +12102,8 @@ var registerPipelineCommand = (program2) => {
11007
12102
  if (!written)
11008
12103
  return;
11009
12104
  }
11010
- OutputFormatter.success({
11011
- Result: RESULTS.Success,
11012
- Code: "PipelineGet",
11013
- Data: data
12105
+ OutputFormatter.success({ Result: RESULTS.Success, Code: "PipelineGet", Data: data }, {
12106
+ preserveDataKeys: options.forUpdate ? true : ARGUMENT_FIELDS
11014
12107
  });
11015
12108
  });
11016
12109
  withLoginValidity(pipeline.command("search").description([
@@ -11035,7 +12128,7 @@ var registerPipelineCommand = (program2) => {
11035
12128
  return;
11036
12129
  }
11037
12130
  const call = hasName ? api.pipelineGetPipelineByName({ value: options.name }) : api.pipelineGetPipelinesByPrefix({ value: options.prefix });
11038
- const [error, result] = await catchError2(call);
12131
+ const [error, result] = await catchError(call);
11039
12132
  if (error) {
11040
12133
  const message = error.message ?? "";
11041
12134
  const looksLikeNoMatch = error instanceof SyntaxError || /unexpected end of json/i.test(message) || /\.map is not a function/i.test(message) || /cannot read prop.*['"]map['"]/i.test(message);
@@ -11069,7 +12162,7 @@ var registerPipelineCommand = (program2) => {
11069
12162
  Result: RESULTS.Success,
11070
12163
  Code: "PipelineSearch",
11071
12164
  Data: result
11072
- });
12165
+ }, { preserveDataKeys: ARGUMENT_FIELDS });
11073
12166
  });
11074
12167
  withLoginValidity(pipeline.command("create").description([
11075
12168
  "Create a new pipeline from a JSON file conforming to PipelineDto.",
@@ -11085,7 +12178,7 @@ var registerPipelineCommand = (program2) => {
11085
12178
  const api = await getCicdApi(PipelineApi, options);
11086
12179
  if (!api)
11087
12180
  return;
11088
- const [error, result] = await catchError2(api.pipelineSavePipeline({
12181
+ const [error, result] = await catchError(api.pipelineSavePipeline({
11089
12182
  pipelineDto: dto,
11090
12183
  telemetryFlowId: options.telemetryFlowId
11091
12184
  }));
@@ -11102,7 +12195,7 @@ var registerPipelineCommand = (program2) => {
11102
12195
  Result: RESULTS.Success,
11103
12196
  Code: "PipelineCreated",
11104
12197
  Data: result
11105
- });
12198
+ }, { preserveDataKeys: ARGUMENT_FIELDS });
11106
12199
  });
11107
12200
  withLoginValidity(pipeline.command("update").description([
11108
12201
  "Update an existing pipeline with a JSON file conforming to **EditPipelineDto**",
@@ -11157,7 +12250,7 @@ var registerPipelineCommand = (program2) => {
11157
12250
  const api = await getCicdApi(PipelineApi, options);
11158
12251
  if (!api)
11159
12252
  return;
11160
- const [error] = await catchError2(api.pipelineUpdatePipeline({ editPipelineDto: dto }));
12253
+ const [error] = await catchError(api.pipelineUpdatePipeline({ editPipelineDto: dto }));
11161
12254
  if (error) {
11162
12255
  OutputFormatter.error({
11163
12256
  Result: RESULTS.Failure,
@@ -11171,7 +12264,7 @@ var registerPipelineCommand = (program2) => {
11171
12264
  Result: RESULTS.Success,
11172
12265
  Code: "PipelineUpdated",
11173
12266
  Data: { Pipeline: sentEditPipelineFields(dto) }
11174
- });
12267
+ }, { preserveDataKeys: ARGUMENT_FIELDS });
11175
12268
  });
11176
12269
  withLoginValidity(pipeline.command("delete").description([
11177
12270
  "Delete a pipeline by identifier.",
@@ -11185,7 +12278,7 @@ var registerPipelineCommand = (program2) => {
11185
12278
  const api = await getCicdApi(PipelineApi, options);
11186
12279
  if (!api)
11187
12280
  return;
11188
- const [error] = await catchError2(api.pipelineDeletePipeline({ pipelineIdentifier: pipelineId }));
12281
+ const [error] = await catchError(api.pipelineDeletePipeline({ pipelineIdentifier: pipelineId }));
11189
12282
  if (error) {
11190
12283
  OutputFormatter.error({
11191
12284
  Result: RESULTS.Failure,
@@ -11212,7 +12305,7 @@ var registerPipelineCommand = (program2) => {
11212
12305
  const api = await getCicdApi(PipelineApi, options);
11213
12306
  if (!api)
11214
12307
  return;
11215
- const [error] = await catchError2(api.pipelineRunPipeline({ pipelineIdentifier: pipelineId }));
12308
+ const [error] = await catchError(api.pipelineRunPipeline({ pipelineIdentifier: pipelineId }));
11216
12309
  if (error) {
11217
12310
  OutputFormatter.error({
11218
12311
  Result: RESULTS.Failure,
@@ -11243,7 +12336,7 @@ var registerPipelineCommand = (program2) => {
11243
12336
  const api = await getCicdApi(PipelineApi, options);
11244
12337
  if (!api)
11245
12338
  return;
11246
- const [error, result] = await catchError2(api.pipelineSaveAndRunPipeline({
12339
+ const [error, result] = await catchError(api.pipelineSaveAndRunPipeline({
11247
12340
  pipelineDto: dto,
11248
12341
  telemetryFlowId: options.telemetryFlowId
11249
12342
  }));
@@ -11261,7 +12354,7 @@ var registerPipelineCommand = (program2) => {
11261
12354
  Result: RESULTS.Success,
11262
12355
  Code: "PipelineSavedAndRunStarted",
11263
12356
  Data: { pipeline: result, executionId }
11264
- });
12357
+ }, { preserveDataKeys: ARGUMENT_FIELDS });
11265
12358
  });
11266
12359
  withLoginValidity(pipeline.command("executions").description([
11267
12360
  "List executions for a pipeline.",
@@ -11287,7 +12380,7 @@ var registerPipelineCommand = (program2) => {
11287
12380
  processContext.exit(1);
11288
12381
  return;
11289
12382
  }
11290
- const [error, result] = await catchError2(api.pipelineGetPipelineExecutions({
12383
+ const [error, result] = await catchError(api.pipelineGetPipelineExecutions({
11291
12384
  pipelineIdentifier: pipelineId,
11292
12385
  pageIndex: offset / limit,
11293
12386
  pageSize: limit
@@ -11319,7 +12412,7 @@ var registerPipelineCommand = (program2) => {
11319
12412
  const api = await getCicdApi(PipelineApi, options);
11320
12413
  if (!api)
11321
12414
  return;
11322
- const [error, result] = await catchError2(api.pipelineGetPipelinesExecutions({
12415
+ const [error, result] = await catchError(api.pipelineGetPipelinesExecutions({
11323
12416
  pipelineExecutionsIdentifiers: csvToArray2(options.ids)
11324
12417
  }));
11325
12418
  if (error) {
@@ -11498,7 +12591,7 @@ var registerProjectCommand = (program2) => {
11498
12591
  if (options.connections) {
11499
12592
  connectionIds = options.connections.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
11500
12593
  } else {
11501
- const [discoverErr, discovered] = await catchError2(connectionsApi.connectionsGetConnections());
12594
+ const [discoverErr, discovered] = await catchError(connectionsApi.connectionsGetConnections());
11502
12595
  if (discoverErr) {
11503
12596
  OutputFormatter.error({
11504
12597
  Result: RESULTS.Failure,
@@ -11519,7 +12612,7 @@ var registerProjectCommand = (program2) => {
11519
12612
  return;
11520
12613
  }
11521
12614
  const fanout = await Promise.all(connectionIds.map(async (connectionIdentifier) => {
11522
- const [err, page] = await catchError2(connectionsApi.connectionsGetProjects({
12615
+ const [err, page] = await catchError(connectionsApi.connectionsGetProjects({
11523
12616
  connectionIdentifier,
11524
12617
  targetFramework: options.targetFramework,
11525
12618
  projectType: options.projectType,
@@ -11570,7 +12663,7 @@ var registerProjectCommand = (program2) => {
11570
12663
  const api = await getScApi(ProjectsApi, options);
11571
12664
  if (!api)
11572
12665
  return;
11573
- const [error, result] = await catchError2(api.projectsGetProject({
12666
+ const [error, result] = await catchError(api.projectsGetProject({
11574
12667
  projectIdentifier: options.projectId,
11575
12668
  reference: options.reference
11576
12669
  }));
@@ -11605,7 +12698,7 @@ var registerProjectCommand = (program2) => {
11605
12698
  const connectionsApi = await getScApi(ConnectionsApi, options);
11606
12699
  if (!connectionsApi)
11607
12700
  return;
11608
- const [reposErr, repos] = await catchError2(connectionsApi.connectionsGetRepositories({
12701
+ const [reposErr, repos] = await catchError(connectionsApi.connectionsGetRepositories({
11609
12702
  connectionIdentifier: connectionId
11610
12703
  }));
11611
12704
  if (reposErr) {
@@ -11626,7 +12719,7 @@ var registerProjectCommand = (program2) => {
11626
12719
  const branchesApi = await getScApi(RepositoriesApi, options);
11627
12720
  if (!branchesApi)
11628
12721
  return;
11629
- const [bErr, branches] = await catchError2(branchesApi.repositoriesGetRepositoryBranches({
12722
+ const [bErr, branches] = await catchError(branchesApi.repositoriesGetRepositoryBranches({
11630
12723
  repositoryIdentifier
11631
12724
  }));
11632
12725
  if (bErr) {
@@ -11659,7 +12752,7 @@ var registerProjectCommand = (program2) => {
11659
12752
  const api = await getScApi(ProjectsApi, options);
11660
12753
  if (!api)
11661
12754
  return;
11662
- const [error, result] = await catchError2(api.projectsGetAutomationProjectFiles({
12755
+ const [error, result] = await catchError(api.projectsGetAutomationProjectFiles({
11663
12756
  projectIdentifier: options.projectId,
11664
12757
  path: options.path,
11665
12758
  reference: options.reference
@@ -11689,7 +12782,7 @@ var registerProjectCommand = (program2) => {
11689
12782
  const api = await getScApi(ProjectsApi, options);
11690
12783
  if (!api)
11691
12784
  return;
11692
- const [error, result] = await catchError2(api.projectsGetAutomationProjectFileContent({
12785
+ const [error, result] = await catchError(api.projectsGetAutomationProjectFileContent({
11693
12786
  projectIdentifier: options.projectId,
11694
12787
  path: options.path,
11695
12788
  reference: options.reference
@@ -11754,7 +12847,7 @@ var registerProjectCommand = (program2) => {
11754
12847
  processContext.exit(1);
11755
12848
  return;
11756
12849
  }
11757
- const [error, result] = await catchError2(api.projectsGetAutomationProjectCommits({
12850
+ const [error, result] = await catchError(api.projectsGetAutomationProjectCommits({
11758
12851
  projectIdentifier: options.projectId,
11759
12852
  path: options.path,
11760
12853
  branch: options.branch,
@@ -11787,7 +12880,7 @@ var registerProjectCommand = (program2) => {
11787
12880
  const api = await getScApi(ProjectsApi, options);
11788
12881
  if (!api)
11789
12882
  return;
11790
- const [error, result] = await catchError2(api.projectsGetAutomationProjectCommit({
12883
+ const [error, result] = await catchError(api.projectsGetAutomationProjectCommit({
11791
12884
  projectIdentifier: options.projectId,
11792
12885
  reference: options.reference
11793
12886
  }));
@@ -11870,7 +12963,7 @@ var registerRepoCommand = (program2) => {
11870
12963
  const api = await getScApi(RepositoriesApi, options);
11871
12964
  if (!api)
11872
12965
  return;
11873
- const [error, result] = await catchError2(api.repositoriesGetRepositoryBranches({
12966
+ const [error, result] = await catchError(api.repositoriesGetRepositoryBranches({
11874
12967
  repositoryIdentifier: repoId
11875
12968
  }));
11876
12969
  if (error) {
@@ -11899,7 +12992,7 @@ var registerRepoCommand = (program2) => {
11899
12992
  const api = await getScApi(RepositoriesApi, options);
11900
12993
  if (!api)
11901
12994
  return;
11902
- const [error, result] = await catchError2(api.repositoriesGetRepositoryProjectFiles({
12995
+ const [error, result] = await catchError(api.repositoriesGetRepositoryProjectFiles({
11903
12996
  repositoryIdentifier: repoId,
11904
12997
  reference: options.reference
11905
12998
  }));
@@ -11963,7 +13056,7 @@ var registerSolutionCommand = (program2) => {
11963
13056
  const api = await getScApi(SolutionsApi, options);
11964
13057
  if (!api)
11965
13058
  return;
11966
- const [error, result] = await catchError2(api.solutionsGetSolution({
13059
+ const [error, result] = await catchError(api.solutionsGetSolution({
11967
13060
  solutionIdentifier: solutionId
11968
13061
  }));
11969
13062
  if (error) {
@@ -12026,7 +13119,7 @@ var registerSolutionCommand = (program2) => {
12026
13119
  processContext.exit(1);
12027
13120
  return;
12028
13121
  }
12029
- const [error, result] = await catchError2(api.solutionsGetSolutionCommits({
13122
+ const [error, result] = await catchError(api.solutionsGetSolutionCommits({
12030
13123
  solutionIdentifier: solutionId,
12031
13124
  path: options.path,
12032
13125
  branch: options.branch,
@@ -12069,4 +13162,4 @@ var registerCommands = async (program2) => {
12069
13162
 
12070
13163
  export { Command, metadata, registerCommands };
12071
13164
 
12072
- //# debugId=846B4DA6D613F2CD64756E2164756E21
13165
+ //# debugId=0FDD209FA0002E9664756E2164756E21