@uipath/eval-tool 1.203.0-preview.203 → 1.203.0-preview.205

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,8 @@
1
1
  import {
2
- __toESM,
3
2
  __commonJS,
4
- __exportCjs,
5
- __require
6
- } from "./tool-epsr41wx.js";
3
+ __require,
4
+ __toESM
5
+ } from "./tool-1de529jm.js";
7
6
 
8
7
  // ../../node_modules/commander/lib/error.js
9
8
  var require_error = __commonJS(function(exports) {
@@ -125,7 +124,7 @@ var require_help = __commonJS(function(exports) {
125
124
  this.helpWidth = this.helpWidth ?? contextOptions.helpWidth ?? 80;
126
125
  }
127
126
  visibleCommands(cmd) {
128
- const visibleCommands = cmd.commands.filter((cmd) => !cmd._hidden);
127
+ const visibleCommands = cmd.commands.filter((cmd2) => !cmd2._hidden);
129
128
  const helpCommand = cmd._getHelpCommand();
130
129
  if (helpCommand && !helpCommand._hidden) {
131
130
  visibleCommands.push(helpCommand);
@@ -605,8 +604,8 @@ var require_option = __commonJS(function(exports) {
605
604
  }
606
605
  }
607
606
  function camelcase(str) {
608
- return str.split("-").reduce((str, word) => {
609
- return str + word[0].toUpperCase() + word.slice(1);
607
+ return str.split("-").reduce((str2, word) => {
608
+ return str2 + word[0].toUpperCase() + word.slice(1);
610
609
  });
611
610
  }
612
611
  function splitOptionFlags(flags) {
@@ -1177,44 +1176,44 @@ Expecting one of '${allowedValues.join("', '")}'`);
1177
1176
  });
1178
1177
  return source;
1179
1178
  }
1180
- _prepareUserArgs(argv2, parseOptions) {
1181
- if (argv2 !== undefined && !Array.isArray(argv2)) {
1179
+ _prepareUserArgs(argv, parseOptions) {
1180
+ if (argv !== undefined && !Array.isArray(argv)) {
1182
1181
  throw new Error("first parameter to parse must be array or undefined");
1183
1182
  }
1184
1183
  parseOptions = parseOptions || {};
1185
- if (argv2 === undefined && parseOptions.from === undefined) {
1184
+ if (argv === undefined && parseOptions.from === undefined) {
1186
1185
  if (process2.versions?.electron) {
1187
1186
  parseOptions.from = "electron";
1188
1187
  }
1189
- const execArgv2 = process2.execArgv ?? [];
1190
- if (execArgv2.includes("-e") || execArgv2.includes("--eval") || execArgv2.includes("-p") || execArgv2.includes("--print")) {
1188
+ const execArgv = process2.execArgv ?? [];
1189
+ if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) {
1191
1190
  parseOptions.from = "eval";
1192
1191
  }
1193
1192
  }
1194
- if (argv2 === undefined) {
1195
- argv2 = process2.argv;
1193
+ if (argv === undefined) {
1194
+ argv = process2.argv;
1196
1195
  }
1197
- this.rawArgs = argv2.slice();
1196
+ this.rawArgs = argv.slice();
1198
1197
  let userArgs;
1199
1198
  switch (parseOptions.from) {
1200
1199
  case undefined:
1201
1200
  case "node":
1202
- this._scriptPath = argv2[1];
1203
- userArgs = argv2.slice(2);
1201
+ this._scriptPath = argv[1];
1202
+ userArgs = argv.slice(2);
1204
1203
  break;
1205
1204
  case "electron":
1206
1205
  if (process2.defaultApp) {
1207
- this._scriptPath = argv2[1];
1208
- userArgs = argv2.slice(2);
1206
+ this._scriptPath = argv[1];
1207
+ userArgs = argv.slice(2);
1209
1208
  } else {
1210
- userArgs = argv2.slice(1);
1209
+ userArgs = argv.slice(1);
1211
1210
  }
1212
1211
  break;
1213
1212
  case "user":
1214
- userArgs = argv2.slice(0);
1213
+ userArgs = argv.slice(0);
1215
1214
  break;
1216
1215
  case "eval":
1217
- userArgs = argv2.slice(1);
1216
+ userArgs = argv.slice(1);
1218
1217
  break;
1219
1218
  default:
1220
1219
  throw new Error(`unexpected parse option { from: '${parseOptions.from}' }`);
@@ -1737,18 +1736,18 @@ Expecting one of '${allowedValues.join("', '")}'`);
1737
1736
  this.error(message, { code: "commander.missingMandatoryOptionValue" });
1738
1737
  }
1739
1738
  _conflictingOption(option, conflictingOption) {
1740
- const findBestOptionFromValue = (option) => {
1741
- const optionKey = option.attributeName();
1739
+ const findBestOptionFromValue = (option2) => {
1740
+ const optionKey = option2.attributeName();
1742
1741
  const optionValue = this.getOptionValue(optionKey);
1743
1742
  const negativeOption = this.options.find((target) => target.negate && optionKey === target.attributeName());
1744
1743
  const positiveOption = this.options.find((target) => !target.negate && optionKey === target.attributeName());
1745
1744
  if (negativeOption && (negativeOption.presetArg === undefined && optionValue === false || negativeOption.presetArg !== undefined && optionValue === negativeOption.presetArg)) {
1746
1745
  return negativeOption;
1747
1746
  }
1748
- return positiveOption || option;
1747
+ return positiveOption || option2;
1749
1748
  };
1750
- const getErrorMessage = (option) => {
1751
- const bestOption = findBestOptionFromValue(option);
1749
+ const getErrorMessage = (option2) => {
1750
+ const bestOption = findBestOptionFromValue(option2);
1752
1751
  const optionKey = bestOption.attributeName();
1753
1752
  const source = this.getOptionValueSource(optionKey);
1754
1753
  if (source === "env") {
@@ -1902,10 +1901,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
1902
1901
  this._name = path.basename(filename, path.extname(filename));
1903
1902
  return this;
1904
1903
  }
1905
- executableDir(path) {
1906
- if (path === undefined)
1904
+ executableDir(path2) {
1905
+ if (path2 === undefined)
1907
1906
  return this._executableDir;
1908
- this._executableDir = path;
1907
+ this._executableDir = path2;
1909
1908
  return this;
1910
1909
  }
1911
1910
  helpInformation(contextOptions) {
@@ -2002,11 +2001,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
2002
2001
  }
2003
2002
  help(contextOptions) {
2004
2003
  this.outputHelp(contextOptions);
2005
- let exitCode2 = Number(process2.exitCode ?? 0);
2006
- if (exitCode2 === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
2007
- exitCode2 = 1;
2004
+ let exitCode = Number(process2.exitCode ?? 0);
2005
+ if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
2006
+ exitCode = 1;
2008
2007
  }
2009
- this._exit(exitCode2, "commander.help", "(outputHelp)");
2008
+ this._exit(exitCode, "commander.help", "(outputHelp)");
2010
2009
  }
2011
2010
  addHelpText(position, text) {
2012
2011
  const allowedValues = ["beforeAll", "before", "after", "afterAll"];
@@ -2079,63 +2078,206 @@ Expecting one of '${allowedValues.join("', '")}'`);
2079
2078
  });
2080
2079
 
2081
2080
  // ../../node_modules/commander/index.js
2082
- var exports_commander = {};
2083
- __exportCjs(exports_commander, {
2084
- program: () => $program,
2085
- createCommand: () => $createCommand,
2086
- createOption: () => $createOption,
2087
- createArgument: () => $createArgument,
2088
- Command: () => $Command,
2089
- Option: () => $Option,
2090
- Argument: () => $Argument,
2091
- Help: () => $Help,
2092
- CommanderError: () => $CommanderError,
2093
- InvalidArgumentError: () => $InvalidArgumentError,
2094
- InvalidOptionArgumentError: () => $InvalidOptionArgumentError
2095
- }, {
2096
- program: (value) => $program = value,
2097
- createCommand: (value) => $createCommand = value,
2098
- createOption: (value) => $createOption = value,
2099
- createArgument: (value) => $createArgument = value,
2100
- Command: (value) => $Command = value,
2101
- Option: (value) => $Option = value,
2102
- Argument: (value) => $Argument = value,
2103
- Help: (value) => $Help = value,
2104
- CommanderError: (value) => $CommanderError = value,
2105
- InvalidArgumentError: (value) => $InvalidArgumentError = value,
2106
- InvalidOptionArgumentError: (value) => $InvalidOptionArgumentError = value
2081
+ var require_commander = __commonJS(function(exports) {
2082
+ var { Argument } = require_argument();
2083
+ var { Command } = require_command();
2084
+ var { CommanderError, InvalidArgumentError } = require_error();
2085
+ var { Help } = require_help();
2086
+ var { Option } = require_option();
2087
+ exports.program = new Command;
2088
+ exports.createCommand = (name) => new Command(name);
2089
+ exports.createOption = (flags, description) => new Option(flags, description);
2090
+ exports.createArgument = (name, description) => new Argument(name, description);
2091
+ exports.Command = Command;
2092
+ exports.Option = Option;
2093
+ exports.Argument = Argument;
2094
+ exports.Help = Help;
2095
+ exports.CommanderError = CommanderError;
2096
+ exports.InvalidArgumentError = InvalidArgumentError;
2097
+ exports.InvalidOptionArgumentError = InvalidArgumentError;
2107
2098
  });
2108
- var { Argument } = require_argument();
2109
- var { Command: Command2 } = require_command();
2110
- var { CommanderError, InvalidArgumentError } = require_error();
2111
- var { Help } = require_help();
2112
- var { Option } = require_option();
2113
- var $program = new Command2;
2114
- var $createCommand = (name) => new Command2(name);
2115
- var $createOption = (flags, description) => new Option(flags, description);
2116
- var $createArgument = (name, description) => new Argument(name, description);
2117
- var $Command = Command2;
2118
- var $Option = Option;
2119
- var $Argument = Argument;
2120
- var $Help = Help;
2121
- var $CommanderError = CommanderError;
2122
- var $InvalidArgumentError = InvalidArgumentError;
2123
- var $InvalidOptionArgumentError = InvalidArgumentError;
2124
2099
 
2125
2100
  // ../../node_modules/commander/esm.mjs
2101
+ var import__ = __toESM(require_commander(), 1);
2126
2102
  var {
2127
2103
  program,
2128
2104
  createCommand,
2129
2105
  createArgument,
2130
2106
  createOption,
2131
- CommanderError: CommanderError2,
2132
- InvalidArgumentError: InvalidArgumentError2,
2107
+ CommanderError,
2108
+ InvalidArgumentError,
2133
2109
  InvalidOptionArgumentError,
2134
2110
  Command,
2135
- Argument: Argument2,
2136
- Option: Option2,
2137
- Help: Help2
2138
- } = exports_commander;
2111
+ Argument,
2112
+ Option,
2113
+ Help
2114
+ } = import__.default;
2115
+
2116
+ // ../common/src/telemetry/pseudonymize.ts
2117
+ var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
2118
+ var PSEUDONYM_HEX_LENGTH = 32;
2119
+ var SHA256_K = new Uint32Array([
2120
+ 1116352408,
2121
+ 1899447441,
2122
+ 3049323471,
2123
+ 3921009573,
2124
+ 961987163,
2125
+ 1508970993,
2126
+ 2453635748,
2127
+ 2870763221,
2128
+ 3624381080,
2129
+ 310598401,
2130
+ 607225278,
2131
+ 1426881987,
2132
+ 1925078388,
2133
+ 2162078206,
2134
+ 2614888103,
2135
+ 3248222580,
2136
+ 3835390401,
2137
+ 4022224774,
2138
+ 264347078,
2139
+ 604807628,
2140
+ 770255983,
2141
+ 1249150122,
2142
+ 1555081692,
2143
+ 1996064986,
2144
+ 2554220882,
2145
+ 2821834349,
2146
+ 2952996808,
2147
+ 3210313671,
2148
+ 3336571891,
2149
+ 3584528711,
2150
+ 113926993,
2151
+ 338241895,
2152
+ 666307205,
2153
+ 773529912,
2154
+ 1294757372,
2155
+ 1396182291,
2156
+ 1695183700,
2157
+ 1986661051,
2158
+ 2177026350,
2159
+ 2456956037,
2160
+ 2730485921,
2161
+ 2820302411,
2162
+ 3259730800,
2163
+ 3345764771,
2164
+ 3516065817,
2165
+ 3600352804,
2166
+ 4094571909,
2167
+ 275423344,
2168
+ 430227734,
2169
+ 506948616,
2170
+ 659060556,
2171
+ 883997877,
2172
+ 958139571,
2173
+ 1322822218,
2174
+ 1537002063,
2175
+ 1747873779,
2176
+ 1955562222,
2177
+ 2024104815,
2178
+ 2227730452,
2179
+ 2361852424,
2180
+ 2428436474,
2181
+ 2756734187,
2182
+ 3204031479,
2183
+ 3329325298
2184
+ ]);
2185
+ var SHA256_INITIAL_STATE = new Uint32Array([
2186
+ 1779033703,
2187
+ 3144134277,
2188
+ 1013904242,
2189
+ 2773480762,
2190
+ 1359893119,
2191
+ 2600822924,
2192
+ 528734635,
2193
+ 1541459225
2194
+ ]);
2195
+ function rotr(value, bits) {
2196
+ return (value >>> bits | value << 32 - bits) >>> 0;
2197
+ }
2198
+ function sha256Hex(input) {
2199
+ const bytes = new TextEncoder().encode(input);
2200
+ const paddedLength = bytes.length + 9 + 63 >> 6 << 6;
2201
+ const buffer = new Uint8Array(paddedLength);
2202
+ buffer.set(bytes);
2203
+ buffer[bytes.length] = 128;
2204
+ const view = new DataView(buffer.buffer);
2205
+ const bitLength = bytes.length * 8;
2206
+ view.setUint32(paddedLength - 8, Math.floor(bitLength / 4294967296));
2207
+ view.setUint32(paddedLength - 4, bitLength >>> 0);
2208
+ const state = SHA256_INITIAL_STATE.slice();
2209
+ const schedule = new Uint32Array(64);
2210
+ for (let offset = 0;offset < paddedLength; offset += 64) {
2211
+ for (let i = 0;i < 16; i++) {
2212
+ schedule[i] = view.getUint32(offset + i * 4);
2213
+ }
2214
+ for (let i = 16;i < 64; i++) {
2215
+ const x = schedule[i - 15];
2216
+ const y = schedule[i - 2];
2217
+ const s0 = (rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3) >>> 0;
2218
+ const s1 = (rotr(y, 17) ^ rotr(y, 19) ^ y >>> 10) >>> 0;
2219
+ schedule[i] = schedule[i - 16] + s0 + schedule[i - 7] + s1 >>> 0;
2220
+ }
2221
+ let a = state[0];
2222
+ let b = state[1];
2223
+ let c = state[2];
2224
+ let d = state[3];
2225
+ let e = state[4];
2226
+ let f = state[5];
2227
+ let g = state[6];
2228
+ let h = state[7];
2229
+ for (let i = 0;i < 64; i++) {
2230
+ const s1 = (rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25)) >>> 0;
2231
+ const ch = (e & f ^ ~e & g) >>> 0;
2232
+ const temp1 = h + s1 + ch + SHA256_K[i] + schedule[i] >>> 0;
2233
+ const s0 = (rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) >>> 0;
2234
+ const maj = (a & b ^ a & c ^ b & c) >>> 0;
2235
+ const temp2 = s0 + maj >>> 0;
2236
+ h = g;
2237
+ g = f;
2238
+ f = e;
2239
+ e = d + temp1 >>> 0;
2240
+ d = c;
2241
+ c = b;
2242
+ b = a;
2243
+ a = temp1 + temp2 >>> 0;
2244
+ }
2245
+ state[0] = state[0] + a >>> 0;
2246
+ state[1] = state[1] + b >>> 0;
2247
+ state[2] = state[2] + c >>> 0;
2248
+ state[3] = state[3] + d >>> 0;
2249
+ state[4] = state[4] + e >>> 0;
2250
+ state[5] = state[5] + f >>> 0;
2251
+ state[6] = state[6] + g >>> 0;
2252
+ state[7] = state[7] + h >>> 0;
2253
+ }
2254
+ let hex = "";
2255
+ for (const word of state) {
2256
+ hex += word.toString(16).padStart(8, "0");
2257
+ }
2258
+ return hex;
2259
+ }
2260
+ function resolveSha256Hex() {
2261
+ try {
2262
+ const nodeCrypto = __require("node:crypto");
2263
+ const createHash = nodeCrypto?.createHash;
2264
+ if (typeof createHash !== "function") {
2265
+ return sha256Hex;
2266
+ }
2267
+ const native = (input) => createHash("sha256").update(input, "utf8").digest("hex");
2268
+ return native("abc") === sha256Hex("abc") ? native : sha256Hex;
2269
+ } catch {
2270
+ return sha256Hex;
2271
+ }
2272
+ }
2273
+ var cachedSha256Hex;
2274
+ function digest(input) {
2275
+ cachedSha256Hex ??= resolveSha256Hex();
2276
+ return cachedSha256Hex(input);
2277
+ }
2278
+ function pseudonymize(input) {
2279
+ return digest(`${PSEUDONYM_DOMAIN}${input}`).slice(0, PSEUDONYM_HEX_LENGTH);
2280
+ }
2139
2281
 
2140
2282
  // ../common/src/singleton.ts
2141
2283
  var PREFIX = "@uipath/common/";
@@ -2167,528 +2309,51 @@ function singleton(ctorOrName) {
2167
2309
  };
2168
2310
  }
2169
2311
 
2170
- // ../common/src/telemetry/global-telemetry-properties.ts
2171
- var telemetryPropsSlot = singleton("TelemetryDefaultProps");
2172
- function getGlobalTelemetryProperties() {
2173
- return telemetryPropsSlot.get();
2312
+ // ../common/src/telemetry/supplied-values.ts
2313
+ var suppliedValuesSlot = singleton("TelemetrySuppliedArgumentValues");
2314
+ function activeEntries() {
2315
+ const existing = suppliedValuesSlot.get();
2316
+ return Array.isArray(existing) ? existing : [];
2174
2317
  }
2175
-
2176
- // ../common/src/sdk-user-agent.ts
2177
- var USER_AGENT_HEADER = "User-Agent";
2178
- var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
2179
- function userAgentPatchKey(userAgent) {
2180
- return Symbol.for(`@uipath/common/sdk-user-agent/${userAgent}`);
2318
+ var MIN_SCRUBBABLE_LENGTH = 4;
2319
+ function recordSuppliedArgumentValues(values) {
2320
+ const flat = [];
2321
+ const push = (value) => {
2322
+ if (Array.isArray(value)) {
2323
+ for (const item of value) {
2324
+ push(item);
2325
+ }
2326
+ return;
2327
+ }
2328
+ if (typeof value === "string" && value.length >= MIN_SCRUBBABLE_LENGTH) {
2329
+ flat.push(value);
2330
+ }
2331
+ };
2332
+ push(values);
2333
+ const entry = { values: flat };
2334
+ suppliedValuesSlot.set([...activeEntries(), entry]);
2335
+ return entry;
2181
2336
  }
2182
- function splitUserAgentTokens(value) {
2183
- return value?.trim().split(/\s+/).filter(Boolean) ?? [];
2337
+ function releaseSuppliedArgumentValues(entry) {
2338
+ suppliedValuesSlot.set(activeEntries().filter((held) => held !== entry));
2184
2339
  }
2185
- function appendUserAgentToken(value, userAgent) {
2186
- const tokens = splitUserAgentTokens(value);
2187
- const seen = new Set(tokens);
2188
- for (const token of splitUserAgentTokens(userAgent)) {
2189
- if (!seen.has(token)) {
2190
- tokens.push(token);
2191
- seen.add(token);
2340
+ function getSuppliedArgumentValues() {
2341
+ const all = new Set;
2342
+ for (const entry of activeEntries()) {
2343
+ for (const value of entry.values) {
2344
+ all.add(value);
2192
2345
  }
2193
2346
  }
2194
- return tokens.join(" ");
2195
- }
2196
- function getEffectiveUserAgent(userAgent) {
2197
- return appendUserAgentToken(sdkUserAgentHostToken.get(), userAgent);
2198
- }
2199
- function getHeaderName(headers, headerName) {
2200
- return Object.keys(headers).find((key) => key.toLowerCase() === headerName.toLowerCase());
2201
- }
2202
- function getSdkUserAgentToken(pkg) {
2203
- const packageName = pkg.name.replace(/^@uipath\//, "");
2204
- return getEffectiveUserAgent(`${packageName}/${pkg.version}`);
2205
- }
2206
- function addSdkUserAgentHeader(headers, userAgent) {
2207
- const result = { ...headers ?? {} };
2208
- const headerName = getHeaderName(result, USER_AGENT_HEADER);
2209
- result[headerName ?? USER_AGENT_HEADER] = appendUserAgentToken(headerName ? result[headerName] : undefined, getEffectiveUserAgent(userAgent));
2210
- return result;
2347
+ return [...all].sort((a, b) => b.length - a.length);
2211
2348
  }
2212
- function asHeaderRecord(headers) {
2213
- return typeof headers === "object" && headers !== null ? { ...headers } : {};
2214
- }
2215
- function withForwardedHeadersInitOverride(initOverrides, forward) {
2216
- return async (requestContext) => {
2217
- const initWithHeaders = {
2218
- ...requestContext.init,
2219
- headers: forward(asHeaderRecord(requestContext.init.headers))
2220
- };
2221
- const override = typeof initOverrides === "function" ? await initOverrides({
2222
- ...requestContext,
2223
- init: initWithHeaders
2224
- }) : initOverrides;
2225
- return {
2226
- ...override ?? {},
2227
- headers: forward(asHeaderRecord(override?.headers ?? initWithHeaders.headers))
2228
- };
2229
- };
2230
- }
2231
- function installRequestHeaderForwarding(BaseApiClass, patchKey, forward) {
2232
- const prototype = BaseApiClass.prototype;
2233
- if (prototype[patchKey]) {
2234
- return;
2235
- }
2236
- if (typeof prototype.request !== "function") {
2237
- throw new Error("Generated BaseAPI request function not found.");
2238
- }
2239
- const originalRequest = prototype.request;
2240
- prototype.request = function requestWithForwardedHeaders(context, initOverrides) {
2241
- return originalRequest.call(this, context, withForwardedHeadersInitOverride(initOverrides, forward));
2242
- };
2243
- Object.defineProperty(prototype, patchKey, {
2244
- value: true
2245
- });
2246
- }
2247
- function installSdkUserAgentHeader(BaseApiClass, userAgent) {
2248
- installRequestHeaderForwarding(BaseApiClass, userAgentPatchKey(userAgent), (headers) => addSdkUserAgentHeader(headers, userAgent));
2249
- }
2250
-
2251
- // ../filesystem/src/node.ts
2252
- import { randomUUID } from "node:crypto";
2253
- import { existsSync } from "node:fs";
2254
- import * as fs from "node:fs/promises";
2255
- import * as os from "node:os";
2256
- import * as path from "node:path";
2257
- var LOCK_HEARTBEAT_MS = 5000;
2258
- var LOCK_STALE_MS = 15000;
2259
- var LOCK_MAX_WAIT_MS = 20000;
2260
- var LOCK_MAX_HOLD_MS = 60000;
2261
- var LOCK_RETRY_MIN_MS = 100;
2262
- var LOCK_RETRY_JITTER_MS = 200;
2263
-
2264
- class NodeFileSystem {
2265
- path = {
2266
- join: path.join,
2267
- resolve: path.resolve,
2268
- relative: path.relative,
2269
- dirname: path.dirname,
2270
- isAbsolute: path.isAbsolute,
2271
- basename: path.basename
2272
- };
2273
- env = {
2274
- cwd: process.cwd,
2275
- homedir: os.homedir,
2276
- tmpdir: os.tmpdir,
2277
- getenv: (key) => process.env[key]
2278
- };
2279
- utils = {
2280
- open: async (url) => {
2281
- const { default: open } = await import("./index-nzr4mx5p.js");
2282
- await open(url);
2283
- }
2284
- };
2285
- async readFile(path2, options) {
2286
- try {
2287
- if (options) {
2288
- return await fs.readFile(path2, "utf-8");
2289
- }
2290
- return await fs.readFile(path2);
2291
- } catch (error) {
2292
- if (this.isEnoent(error))
2293
- return null;
2294
- throw error;
2295
- }
2296
- }
2297
- async writeFile(filePath, data) {
2298
- const dir = path.dirname(filePath);
2299
- if (dir) {
2300
- await fs.mkdir(dir, { recursive: true });
2301
- }
2302
- await fs.writeFile(filePath, data);
2303
- }
2304
- async appendFile(filePath, data) {
2305
- const dir = path.dirname(filePath);
2306
- if (dir) {
2307
- await fs.mkdir(dir, { recursive: true });
2308
- }
2309
- await fs.appendFile(filePath, data);
2310
- }
2311
- async readdir(dirPath) {
2312
- try {
2313
- return await fs.readdir(dirPath);
2314
- } catch (error) {
2315
- if (this.isEnoent(error))
2316
- return [];
2317
- throw error;
2318
- }
2319
- }
2320
- async stat(filePath) {
2321
- try {
2322
- const stats = await fs.stat(filePath);
2323
- return {
2324
- isFile: () => stats.isFile(),
2325
- isDirectory: () => stats.isDirectory(),
2326
- size: stats.size,
2327
- mtimeMs: stats.mtimeMs
2328
- };
2329
- } catch (error) {
2330
- if (this.isEnoent(error))
2331
- return null;
2332
- throw error;
2333
- }
2334
- }
2335
- async exists(filePath) {
2336
- return existsSync(filePath);
2337
- }
2338
- async mkdir(dirPath) {
2339
- await fs.mkdir(dirPath, { recursive: true });
2340
- }
2341
- async acquireLock(lockPath) {
2342
- const canonicalPath = await this.canonicalizeLockTarget(lockPath);
2343
- const lockFile = `${canonicalPath}.lock`;
2344
- const ownerId = randomUUID();
2345
- const start = Date.now();
2346
- while (true) {
2347
- try {
2348
- await fs.writeFile(lockFile, ownerId, { flag: "wx" });
2349
- return this.createLockRelease(lockFile, ownerId);
2350
- } catch (error) {
2351
- if (!this.hasErrnoCode(error, "EEXIST")) {
2352
- throw error;
2353
- }
2354
- const stats = await fs.stat(lockFile).catch(() => null);
2355
- if (stats && Date.now() - stats.mtimeMs > LOCK_STALE_MS) {
2356
- const reclaimed = await fs.rm(lockFile, { force: true }).then(() => true).catch(() => false);
2357
- if (reclaimed)
2358
- continue;
2359
- }
2360
- if (Date.now() - start > LOCK_MAX_WAIT_MS) {
2361
- throw new Error(`ELOCKED: timed out waiting for lock on ${canonicalPath}`);
2362
- }
2363
- await new Promise((resolve2) => setTimeout(resolve2, LOCK_RETRY_MIN_MS + Math.random() * LOCK_RETRY_JITTER_MS));
2364
- }
2365
- }
2366
- }
2367
- async canonicalizeLockTarget(lockPath) {
2368
- const absolute = path.resolve(lockPath);
2369
- const fullReal = await fs.realpath(absolute).catch(() => null);
2370
- if (fullReal)
2371
- return fullReal;
2372
- const parent = path.dirname(absolute);
2373
- const base = path.basename(absolute);
2374
- const canonicalParent = await fs.realpath(parent).catch(() => parent);
2375
- return path.join(canonicalParent, base);
2376
- }
2377
- createLockRelease(lockFile, ownerId) {
2378
- const heartbeatStart = Date.now();
2379
- let heartbeatTimer;
2380
- let stopped = false;
2381
- const stopHeartbeat = () => {
2382
- stopped = true;
2383
- if (heartbeatTimer)
2384
- clearTimeout(heartbeatTimer);
2385
- };
2386
- const scheduleNextHeartbeat = () => {
2387
- if (stopped)
2388
- return;
2389
- if (Date.now() - heartbeatStart >= LOCK_MAX_HOLD_MS) {
2390
- stopped = true;
2391
- return;
2392
- }
2393
- heartbeatTimer = setTimeout(() => {
2394
- runHeartbeat();
2395
- }, LOCK_HEARTBEAT_MS);
2396
- heartbeatTimer.unref?.();
2397
- };
2398
- const runHeartbeat = async () => {
2399
- if (stopped)
2400
- return;
2401
- const current = await fs.readFile(lockFile, "utf-8").catch(() => null);
2402
- if (stopped)
2403
- return;
2404
- if (current !== ownerId) {
2405
- stopped = true;
2406
- return;
2407
- }
2408
- const now = Date.now() / 1000;
2409
- await fs.utimes(lockFile, now, now).catch(() => {});
2410
- scheduleNextHeartbeat();
2411
- };
2412
- scheduleNextHeartbeat();
2413
- let released = false;
2414
- return async () => {
2415
- if (released)
2416
- return;
2417
- released = true;
2418
- stopHeartbeat();
2419
- const current = await fs.readFile(lockFile, "utf-8").catch(() => null);
2420
- if (current === ownerId) {
2421
- await fs.rm(lockFile, { force: true });
2422
- }
2423
- };
2424
- }
2425
- async rm(filePath) {
2426
- await fs.rm(filePath, { recursive: true, force: true });
2427
- }
2428
- async rename(oldPath, newPath) {
2429
- await fs.rename(oldPath, newPath);
2430
- }
2431
- async realpath(filePath) {
2432
- try {
2433
- return await fs.realpath(filePath);
2434
- } catch (error) {
2435
- if (this.isEnoent(error))
2436
- return filePath;
2437
- throw error;
2438
- }
2439
- }
2440
- async getTempDir() {
2441
- return await fs.mkdtemp(path.join(os.tmpdir(), "uipath-fs-"));
2442
- }
2443
- async copyDirectory(sourcePath, destPath) {
2444
- const sourceStats = await this.stat(sourcePath);
2445
- if (!sourceStats) {
2446
- throw new Error(`Source directory does not exist: ${sourcePath}`);
2447
- }
2448
- if (!sourceStats.isDirectory()) {
2449
- throw new Error(`Source path is not a directory: ${sourcePath}`);
2450
- }
2451
- await this.mkdir(destPath);
2452
- const entries = await this.readdir(sourcePath);
2453
- for (const entry of entries) {
2454
- const srcEntry = path.join(sourcePath, entry);
2455
- const destEntry = path.join(destPath, entry);
2456
- const entryStats = await this.stat(srcEntry);
2457
- if (!entryStats)
2458
- continue;
2459
- if (entryStats.isDirectory()) {
2460
- await this.copyDirectory(srcEntry, destEntry);
2461
- } else if (entryStats.isFile()) {
2462
- const content = await this.readFile(srcEntry);
2463
- if (content !== null) {
2464
- await this.writeFile(destEntry, content);
2465
- }
2466
- }
2467
- }
2468
- }
2469
- isEnoent(error) {
2470
- return this.hasErrnoCode(error, "ENOENT");
2471
- }
2472
- hasErrnoCode(error, code) {
2473
- return typeof error === "object" && error !== null && "code" in error && error.code === code;
2474
- }
2475
- }
2476
-
2477
- // ../filesystem/src/index.ts
2478
- var fsInstance = new NodeFileSystem;
2479
- var getFileSystem = () => fsInstance;
2480
-
2481
- // ../common/src/telemetry/pseudonymize.ts
2482
- var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
2483
- var PSEUDONYM_HEX_LENGTH = 32;
2484
- var SHA256_K = new Uint32Array([
2485
- 1116352408,
2486
- 1899447441,
2487
- 3049323471,
2488
- 3921009573,
2489
- 961987163,
2490
- 1508970993,
2491
- 2453635748,
2492
- 2870763221,
2493
- 3624381080,
2494
- 310598401,
2495
- 607225278,
2496
- 1426881987,
2497
- 1925078388,
2498
- 2162078206,
2499
- 2614888103,
2500
- 3248222580,
2501
- 3835390401,
2502
- 4022224774,
2503
- 264347078,
2504
- 604807628,
2505
- 770255983,
2506
- 1249150122,
2507
- 1555081692,
2508
- 1996064986,
2509
- 2554220882,
2510
- 2821834349,
2511
- 2952996808,
2512
- 3210313671,
2513
- 3336571891,
2514
- 3584528711,
2515
- 113926993,
2516
- 338241895,
2517
- 666307205,
2518
- 773529912,
2519
- 1294757372,
2520
- 1396182291,
2521
- 1695183700,
2522
- 1986661051,
2523
- 2177026350,
2524
- 2456956037,
2525
- 2730485921,
2526
- 2820302411,
2527
- 3259730800,
2528
- 3345764771,
2529
- 3516065817,
2530
- 3600352804,
2531
- 4094571909,
2532
- 275423344,
2533
- 430227734,
2534
- 506948616,
2535
- 659060556,
2536
- 883997877,
2537
- 958139571,
2538
- 1322822218,
2539
- 1537002063,
2540
- 1747873779,
2541
- 1955562222,
2542
- 2024104815,
2543
- 2227730452,
2544
- 2361852424,
2545
- 2428436474,
2546
- 2756734187,
2547
- 3204031479,
2548
- 3329325298
2549
- ]);
2550
- var SHA256_INITIAL_STATE = new Uint32Array([
2551
- 1779033703,
2552
- 3144134277,
2553
- 1013904242,
2554
- 2773480762,
2555
- 1359893119,
2556
- 2600822924,
2557
- 528734635,
2558
- 1541459225
2559
- ]);
2560
- function rotr(value, bits) {
2561
- return (value >>> bits | value << 32 - bits) >>> 0;
2562
- }
2563
- function sha256Hex(input) {
2564
- const bytes = new TextEncoder().encode(input);
2565
- const paddedLength = bytes.length + 9 + 63 >> 6 << 6;
2566
- const buffer = new Uint8Array(paddedLength);
2567
- buffer.set(bytes);
2568
- buffer[bytes.length] = 128;
2569
- const view = new DataView(buffer.buffer);
2570
- const bitLength = bytes.length * 8;
2571
- view.setUint32(paddedLength - 8, Math.floor(bitLength / 4294967296));
2572
- view.setUint32(paddedLength - 4, bitLength >>> 0);
2573
- const state = SHA256_INITIAL_STATE.slice();
2574
- const schedule = new Uint32Array(64);
2575
- for (let offset = 0;offset < paddedLength; offset += 64) {
2576
- for (let i = 0;i < 16; i++) {
2577
- schedule[i] = view.getUint32(offset + i * 4);
2578
- }
2579
- for (let i = 16;i < 64; i++) {
2580
- const x = schedule[i - 15];
2581
- const y = schedule[i - 2];
2582
- const s0 = (rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3) >>> 0;
2583
- const s1 = (rotr(y, 17) ^ rotr(y, 19) ^ y >>> 10) >>> 0;
2584
- schedule[i] = schedule[i - 16] + s0 + schedule[i - 7] + s1 >>> 0;
2585
- }
2586
- let a = state[0];
2587
- let b = state[1];
2588
- let c = state[2];
2589
- let d = state[3];
2590
- let e = state[4];
2591
- let f = state[5];
2592
- let g = state[6];
2593
- let h = state[7];
2594
- for (let i = 0;i < 64; i++) {
2595
- const s1 = (rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25)) >>> 0;
2596
- const ch = (e & f ^ ~e & g) >>> 0;
2597
- const temp1 = h + s1 + ch + SHA256_K[i] + schedule[i] >>> 0;
2598
- const s0 = (rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) >>> 0;
2599
- const maj = (a & b ^ a & c ^ b & c) >>> 0;
2600
- const temp2 = s0 + maj >>> 0;
2601
- h = g;
2602
- g = f;
2603
- f = e;
2604
- e = d + temp1 >>> 0;
2605
- d = c;
2606
- c = b;
2607
- b = a;
2608
- a = temp1 + temp2 >>> 0;
2609
- }
2610
- state[0] = state[0] + a >>> 0;
2611
- state[1] = state[1] + b >>> 0;
2612
- state[2] = state[2] + c >>> 0;
2613
- state[3] = state[3] + d >>> 0;
2614
- state[4] = state[4] + e >>> 0;
2615
- state[5] = state[5] + f >>> 0;
2616
- state[6] = state[6] + g >>> 0;
2617
- state[7] = state[7] + h >>> 0;
2618
- }
2619
- let hex = "";
2620
- for (const word of state) {
2621
- hex += word.toString(16).padStart(8, "0");
2622
- }
2623
- return hex;
2624
- }
2625
- function resolveSha256Hex() {
2626
- try {
2627
- const nodeCrypto = __require("node:crypto");
2628
- const createHash = nodeCrypto?.createHash;
2629
- if (typeof createHash !== "function") {
2630
- return sha256Hex;
2631
- }
2632
- const native = (input) => createHash("sha256").update(input, "utf8").digest("hex");
2633
- return native("abc") === sha256Hex("abc") ? native : sha256Hex;
2634
- } catch {
2635
- return sha256Hex;
2636
- }
2637
- }
2638
- var cachedSha256Hex;
2639
- function digest(input) {
2640
- cachedSha256Hex ??= resolveSha256Hex();
2641
- return cachedSha256Hex(input);
2642
- }
2643
- function pseudonymize(input) {
2644
- return digest(`${PSEUDONYM_DOMAIN}${input}`).slice(0, PSEUDONYM_HEX_LENGTH);
2645
- }
2646
-
2647
- // ../common/src/telemetry/supplied-values.ts
2648
- var suppliedValuesSlot = singleton("TelemetrySuppliedArgumentValues");
2649
- function activeEntries() {
2650
- const existing = suppliedValuesSlot.get();
2651
- return Array.isArray(existing) ? existing : [];
2652
- }
2653
- var MIN_SCRUBBABLE_LENGTH = 4;
2654
- function recordSuppliedArgumentValues(values) {
2655
- const flat = [];
2656
- const push = (value) => {
2657
- if (Array.isArray(value)) {
2658
- for (const item of value) {
2659
- push(item);
2660
- }
2661
- return;
2662
- }
2663
- if (typeof value === "string" && value.length >= MIN_SCRUBBABLE_LENGTH) {
2664
- flat.push(value);
2665
- }
2666
- };
2667
- push(values);
2668
- const entry = { values: flat };
2669
- suppliedValuesSlot.set([...activeEntries(), entry]);
2670
- return entry;
2671
- }
2672
- function releaseSuppliedArgumentValues(entry) {
2673
- suppliedValuesSlot.set(activeEntries().filter((held) => held !== entry));
2674
- }
2675
- function getSuppliedArgumentValues() {
2676
- const all = new Set;
2677
- for (const entry of activeEntries()) {
2678
- for (const value of entry.values) {
2679
- all.add(value);
2680
- }
2681
- }
2682
- return [...all].sort((a, b) => b.length - a.length);
2683
- }
2684
-
2685
- // ../common/src/telemetry/pii-redactor.ts
2686
- var REDACTED = "[REDACTED]";
2687
- var MAX_VALUE_LENGTH = 280;
2688
- var MAX_STACK_LENGTH = 4096;
2689
- var MAX_SCAN_LENGTH = MAX_STACK_LENGTH;
2690
- function truncate(value, maxLength) {
2691
- return value.length > maxLength ? `${value.slice(0, maxLength)}…` : value;
2349
+
2350
+ // ../common/src/telemetry/pii-redactor.ts
2351
+ var REDACTED = "[REDACTED]";
2352
+ var MAX_VALUE_LENGTH = 280;
2353
+ var MAX_STACK_LENGTH = 4096;
2354
+ var MAX_SCAN_LENGTH = MAX_STACK_LENGTH;
2355
+ function truncate(value, maxLength) {
2356
+ return value.length > maxLength ? `${value.slice(0, maxLength)}…` : value;
2692
2357
  }
2693
2358
  var SENSITIVE_NAME_TOKENS = new Set([
2694
2359
  "token",
@@ -3263,123 +2928,434 @@ async function extractErrorDetails(error, options) {
3263
2928
  } else {
3264
2929
  message = `HTTP ${status}: ${rawMessage}`;
3265
2930
  }
3266
- } else {
3267
- message = rawMessage;
2931
+ } else {
2932
+ message = rawMessage;
2933
+ }
2934
+ if (status === undefined) {
2935
+ const connectivity = describeConnectivityError(error);
2936
+ if (connectivity && connectivity.message !== message && !message.includes(connectivity.message)) {
2937
+ message = `${message}: ${connectivity.message}`;
2938
+ }
2939
+ }
2940
+ const permission = status === undefined ? describePermissionError(error) : undefined;
2941
+ if (permission) {
2942
+ if (permission.message !== message && !message.includes(permission.message)) {
2943
+ message = `${message}: ${permission.message}`;
2944
+ }
2945
+ if (!message.includes(permission.instructions)) {
2946
+ const punctuated = message.endsWith(".") ? message : `${message}.`;
2947
+ message = `${punctuated} ${permission.instructions}`;
2948
+ }
2949
+ }
2950
+ let details = rawMessage;
2951
+ if (rawBody) {
2952
+ if (parsedBody) {
2953
+ const extra = {};
2954
+ if (parsedBody.errorCode)
2955
+ extra.errorCode = parsedBody.errorCode;
2956
+ if (parsedBody.detail)
2957
+ extra.detail = parsedBody.detail;
2958
+ if (parsedBody.details)
2959
+ extra.details = parsedBody.details;
2960
+ if (parsedBody.errors != null)
2961
+ extra.errors = parsedBody.errors;
2962
+ if (parsedBody.data && typeof parsedBody.data === "object" && Object.keys(parsedBody.data).length > 0) {
2963
+ extra.data = parsedBody.data;
2964
+ }
2965
+ details = Object.keys(extra).length > 0 ? JSON.stringify(extra) : rawBody;
2966
+ } else {
2967
+ details = rawBody;
2968
+ }
2969
+ } else if (typeof err.message === "string") {
2970
+ details = err.message;
2971
+ } else {
2972
+ details = describeThrownValue(error);
2973
+ }
2974
+ const context = {};
2975
+ if (classificationStatus) {
2976
+ context.httpStatus = classificationStatus;
2977
+ }
2978
+ if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
2979
+ context.errorCode = parsedBody.errorCode;
2980
+ } else if (parsedBody?.code && typeof parsedBody.code === "string") {
2981
+ context.errorCode = parsedBody.code;
2982
+ }
2983
+ if (parsedBody?.requestId && typeof parsedBody.requestId === "string") {
2984
+ context.requestId = parsedBody.requestId;
2985
+ }
2986
+ if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
2987
+ context.traceId = parsedBody.traceId;
2988
+ }
2989
+ if (permission?.path !== undefined) {
2990
+ context.path = permission.path;
2991
+ }
2992
+ if (status === 429) {
2993
+ const resp = response;
2994
+ const headersObj = resp?.headers;
2995
+ let retryAfterValue;
2996
+ if (headersObj && typeof headersObj === "object" && typeof headersObj.get === "function") {
2997
+ retryAfterValue = headersObj.get("retry-after") ?? undefined;
2998
+ }
2999
+ if (!retryAfterValue && headersObj && typeof headersObj === "object") {
3000
+ const headers = headersObj;
3001
+ retryAfterValue = headers["retry-after"] ?? headers["Retry-After"];
3002
+ }
3003
+ if (retryAfterValue) {
3004
+ const seconds = Number(retryAfterValue);
3005
+ if (!Number.isNaN(seconds)) {
3006
+ context.retryAfter = seconds;
3007
+ retry = retryHintForRetryAfter(seconds);
3008
+ }
3009
+ }
3010
+ }
3011
+ const hasContext = Object.keys(context).length > 0;
3012
+ let parsedErrors;
3013
+ if (parsedBody?.errors && typeof parsedBody.errors === "object") {
3014
+ const errors = {};
3015
+ for (const [field, raw] of Object.entries(parsedBody.errors)) {
3016
+ if (Array.isArray(raw)) {
3017
+ const messages = raw.map((entry) => {
3018
+ if (typeof entry === "string")
3019
+ return entry;
3020
+ if (entry && typeof entry === "object" && typeof entry.message === "string") {
3021
+ return entry.message;
3022
+ }
3023
+ return String(entry);
3024
+ }).filter(Boolean);
3025
+ if (messages.length > 0)
3026
+ errors[field] = messages;
3027
+ } else if (typeof raw === "string") {
3028
+ errors[field] = [raw];
3029
+ }
3030
+ }
3031
+ if (Object.keys(errors).length > 0)
3032
+ parsedErrors = errors;
3033
+ }
3034
+ return {
3035
+ result,
3036
+ errorCode: classification.errorCode,
3037
+ message,
3038
+ retry,
3039
+ details,
3040
+ ...hasContext ? { context } : {},
3041
+ ...parsedErrors ? { parsedErrors } : {}
3042
+ };
3043
+ }
3044
+ async function extractErrorMessage(error, options) {
3045
+ const { message } = await extractErrorDetails(error, options);
3046
+ return message;
3047
+ }
3048
+
3049
+ // ../common/src/telemetry/global-telemetry-properties.ts
3050
+ var telemetryPropsSlot = singleton("TelemetryDefaultProps");
3051
+ function getGlobalTelemetryProperties() {
3052
+ return telemetryPropsSlot.get();
3053
+ }
3054
+
3055
+ // ../common/src/sdk-user-agent.ts
3056
+ var USER_AGENT_HEADER = "User-Agent";
3057
+ var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
3058
+ function userAgentPatchKey(userAgent) {
3059
+ return Symbol.for(`@uipath/common/sdk-user-agent/${userAgent}`);
3060
+ }
3061
+ function splitUserAgentTokens(value) {
3062
+ return value?.trim().split(/\s+/).filter(Boolean) ?? [];
3063
+ }
3064
+ function appendUserAgentToken(value, userAgent) {
3065
+ const tokens = splitUserAgentTokens(value);
3066
+ const seen = new Set(tokens);
3067
+ for (const token of splitUserAgentTokens(userAgent)) {
3068
+ if (!seen.has(token)) {
3069
+ tokens.push(token);
3070
+ seen.add(token);
3071
+ }
3072
+ }
3073
+ return tokens.join(" ");
3074
+ }
3075
+ function getEffectiveUserAgent(userAgent) {
3076
+ return appendUserAgentToken(sdkUserAgentHostToken.get(), userAgent);
3077
+ }
3078
+ function getHeaderName(headers, headerName) {
3079
+ return Object.keys(headers).find((key) => key.toLowerCase() === headerName.toLowerCase());
3080
+ }
3081
+ function getSdkUserAgentToken(pkg) {
3082
+ const packageName = pkg.name.replace(/^@uipath\//, "");
3083
+ return getEffectiveUserAgent(`${packageName}/${pkg.version}`);
3084
+ }
3085
+ function addSdkUserAgentHeader(headers, userAgent) {
3086
+ const result = { ...headers ?? {} };
3087
+ const headerName = getHeaderName(result, USER_AGENT_HEADER);
3088
+ result[headerName ?? USER_AGENT_HEADER] = appendUserAgentToken(headerName ? result[headerName] : undefined, getEffectiveUserAgent(userAgent));
3089
+ return result;
3090
+ }
3091
+ function asHeaderRecord(headers) {
3092
+ return typeof headers === "object" && headers !== null ? { ...headers } : {};
3093
+ }
3094
+ function withForwardedHeadersInitOverride(initOverrides, forward) {
3095
+ return async (requestContext) => {
3096
+ const initWithHeaders = {
3097
+ ...requestContext.init,
3098
+ headers: forward(asHeaderRecord(requestContext.init.headers))
3099
+ };
3100
+ const override = typeof initOverrides === "function" ? await initOverrides({
3101
+ ...requestContext,
3102
+ init: initWithHeaders
3103
+ }) : initOverrides;
3104
+ return {
3105
+ ...override ?? {},
3106
+ headers: forward(asHeaderRecord(override?.headers ?? initWithHeaders.headers))
3107
+ };
3108
+ };
3109
+ }
3110
+ function installRequestHeaderForwarding(BaseApiClass, patchKey, forward) {
3111
+ const prototype = BaseApiClass.prototype;
3112
+ if (prototype[patchKey]) {
3113
+ return;
3114
+ }
3115
+ if (typeof prototype.request !== "function") {
3116
+ throw new Error("Generated BaseAPI request function not found.");
3117
+ }
3118
+ const originalRequest = prototype.request;
3119
+ prototype.request = function requestWithForwardedHeaders(context, initOverrides) {
3120
+ return originalRequest.call(this, context, withForwardedHeadersInitOverride(initOverrides, forward));
3121
+ };
3122
+ Object.defineProperty(prototype, patchKey, {
3123
+ value: true
3124
+ });
3125
+ }
3126
+ function installSdkUserAgentHeader(BaseApiClass, userAgent) {
3127
+ installRequestHeaderForwarding(BaseApiClass, userAgentPatchKey(userAgent), (headers) => addSdkUserAgentHeader(headers, userAgent));
3128
+ }
3129
+
3130
+ // ../filesystem/src/node.ts
3131
+ import { randomUUID } from "node:crypto";
3132
+ import { existsSync } from "node:fs";
3133
+ import * as fs from "node:fs/promises";
3134
+ import * as os from "node:os";
3135
+ import * as path from "node:path";
3136
+ var LOCK_HEARTBEAT_MS = 5000;
3137
+ var LOCK_STALE_MS = 15000;
3138
+ var LOCK_MAX_WAIT_MS = 20000;
3139
+ var LOCK_MAX_HOLD_MS = 60000;
3140
+ var LOCK_RETRY_MIN_MS = 100;
3141
+ var LOCK_RETRY_JITTER_MS = 200;
3142
+
3143
+ class NodeFileSystem {
3144
+ path = {
3145
+ join: path.join,
3146
+ resolve: path.resolve,
3147
+ relative: path.relative,
3148
+ dirname: path.dirname,
3149
+ isAbsolute: path.isAbsolute,
3150
+ basename: path.basename
3151
+ };
3152
+ env = {
3153
+ cwd: process.cwd,
3154
+ homedir: os.homedir,
3155
+ tmpdir: os.tmpdir,
3156
+ getenv: (key) => process.env[key]
3157
+ };
3158
+ utils = {
3159
+ open: async (url) => {
3160
+ const { default: open } = await import("./index-sby22td6.js");
3161
+ await open(url);
3162
+ }
3163
+ };
3164
+ async readFile(path2, options) {
3165
+ try {
3166
+ if (options) {
3167
+ return await fs.readFile(path2, "utf-8");
3168
+ }
3169
+ return await fs.readFile(path2);
3170
+ } catch (error) {
3171
+ if (this.isEnoent(error))
3172
+ return null;
3173
+ throw error;
3174
+ }
3175
+ }
3176
+ async writeFile(filePath, data) {
3177
+ const dir = path.dirname(filePath);
3178
+ if (dir) {
3179
+ await fs.mkdir(dir, { recursive: true });
3180
+ }
3181
+ await fs.writeFile(filePath, data);
3268
3182
  }
3269
- if (status === undefined) {
3270
- const connectivity = describeConnectivityError(error);
3271
- if (connectivity && connectivity.message !== message && !message.includes(connectivity.message)) {
3272
- message = `${message}: ${connectivity.message}`;
3183
+ async appendFile(filePath, data) {
3184
+ const dir = path.dirname(filePath);
3185
+ if (dir) {
3186
+ await fs.mkdir(dir, { recursive: true });
3273
3187
  }
3188
+ await fs.appendFile(filePath, data);
3274
3189
  }
3275
- const permission = status === undefined ? describePermissionError(error) : undefined;
3276
- if (permission) {
3277
- if (permission.message !== message && !message.includes(permission.message)) {
3278
- message = `${message}: ${permission.message}`;
3190
+ async readdir(dirPath) {
3191
+ try {
3192
+ return await fs.readdir(dirPath);
3193
+ } catch (error) {
3194
+ if (this.isEnoent(error))
3195
+ return [];
3196
+ throw error;
3279
3197
  }
3280
- if (!message.includes(permission.instructions)) {
3281
- const punctuated = message.endsWith(".") ? message : `${message}.`;
3282
- message = `${punctuated} ${permission.instructions}`;
3198
+ }
3199
+ async stat(filePath) {
3200
+ try {
3201
+ const stats = await fs.stat(filePath);
3202
+ return {
3203
+ isFile: () => stats.isFile(),
3204
+ isDirectory: () => stats.isDirectory(),
3205
+ size: stats.size,
3206
+ mtimeMs: stats.mtimeMs
3207
+ };
3208
+ } catch (error) {
3209
+ if (this.isEnoent(error))
3210
+ return null;
3211
+ throw error;
3283
3212
  }
3284
3213
  }
3285
- let details = rawMessage;
3286
- if (rawBody) {
3287
- if (parsedBody) {
3288
- const extra = {};
3289
- if (parsedBody.errorCode)
3290
- extra.errorCode = parsedBody.errorCode;
3291
- if (parsedBody.detail)
3292
- extra.detail = parsedBody.detail;
3293
- if (parsedBody.details)
3294
- extra.details = parsedBody.details;
3295
- if (parsedBody.errors != null)
3296
- extra.errors = parsedBody.errors;
3297
- if (parsedBody.data && typeof parsedBody.data === "object" && Object.keys(parsedBody.data).length > 0) {
3298
- extra.data = parsedBody.data;
3214
+ async exists(filePath) {
3215
+ return existsSync(filePath);
3216
+ }
3217
+ async mkdir(dirPath) {
3218
+ await fs.mkdir(dirPath, { recursive: true });
3219
+ }
3220
+ async acquireLock(lockPath) {
3221
+ const canonicalPath = await this.canonicalizeLockTarget(lockPath);
3222
+ const lockFile = `${canonicalPath}.lock`;
3223
+ const ownerId = randomUUID();
3224
+ const start = Date.now();
3225
+ while (true) {
3226
+ try {
3227
+ await fs.writeFile(lockFile, ownerId, { flag: "wx" });
3228
+ return this.createLockRelease(lockFile, ownerId);
3229
+ } catch (error) {
3230
+ if (!this.hasErrnoCode(error, "EEXIST")) {
3231
+ throw error;
3232
+ }
3233
+ const stats = await fs.stat(lockFile).catch(() => null);
3234
+ if (stats && Date.now() - stats.mtimeMs > LOCK_STALE_MS) {
3235
+ const reclaimed = await fs.rm(lockFile, { force: true }).then(() => true).catch(() => false);
3236
+ if (reclaimed)
3237
+ continue;
3238
+ }
3239
+ if (Date.now() - start > LOCK_MAX_WAIT_MS) {
3240
+ throw new Error(`ELOCKED: timed out waiting for lock on ${canonicalPath}`);
3241
+ }
3242
+ await new Promise((resolve2) => setTimeout(resolve2, LOCK_RETRY_MIN_MS + Math.random() * LOCK_RETRY_JITTER_MS));
3299
3243
  }
3300
- details = Object.keys(extra).length > 0 ? JSON.stringify(extra) : rawBody;
3301
- } else {
3302
- details = rawBody;
3303
3244
  }
3304
- } else if (typeof err.message === "string") {
3305
- details = err.message;
3306
- } else {
3307
- details = describeThrownValue(error);
3308
3245
  }
3309
- const context = {};
3310
- if (classificationStatus) {
3311
- context.httpStatus = classificationStatus;
3246
+ async canonicalizeLockTarget(lockPath) {
3247
+ const absolute = path.resolve(lockPath);
3248
+ const fullReal = await fs.realpath(absolute).catch(() => null);
3249
+ if (fullReal)
3250
+ return fullReal;
3251
+ const parent = path.dirname(absolute);
3252
+ const base = path.basename(absolute);
3253
+ const canonicalParent = await fs.realpath(parent).catch(() => parent);
3254
+ return path.join(canonicalParent, base);
3312
3255
  }
3313
- if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
3314
- context.errorCode = parsedBody.errorCode;
3315
- } else if (parsedBody?.code && typeof parsedBody.code === "string") {
3316
- context.errorCode = parsedBody.code;
3256
+ createLockRelease(lockFile, ownerId) {
3257
+ const heartbeatStart = Date.now();
3258
+ let heartbeatTimer;
3259
+ let stopped = false;
3260
+ const stopHeartbeat = () => {
3261
+ stopped = true;
3262
+ if (heartbeatTimer)
3263
+ clearTimeout(heartbeatTimer);
3264
+ };
3265
+ const scheduleNextHeartbeat = () => {
3266
+ if (stopped)
3267
+ return;
3268
+ if (Date.now() - heartbeatStart >= LOCK_MAX_HOLD_MS) {
3269
+ stopped = true;
3270
+ return;
3271
+ }
3272
+ heartbeatTimer = setTimeout(() => {
3273
+ runHeartbeat();
3274
+ }, LOCK_HEARTBEAT_MS);
3275
+ heartbeatTimer.unref?.();
3276
+ };
3277
+ const runHeartbeat = async () => {
3278
+ if (stopped)
3279
+ return;
3280
+ const current = await fs.readFile(lockFile, "utf-8").catch(() => null);
3281
+ if (stopped)
3282
+ return;
3283
+ if (current !== ownerId) {
3284
+ stopped = true;
3285
+ return;
3286
+ }
3287
+ const now = Date.now() / 1000;
3288
+ await fs.utimes(lockFile, now, now).catch(() => {});
3289
+ scheduleNextHeartbeat();
3290
+ };
3291
+ scheduleNextHeartbeat();
3292
+ let released = false;
3293
+ return async () => {
3294
+ if (released)
3295
+ return;
3296
+ released = true;
3297
+ stopHeartbeat();
3298
+ const current = await fs.readFile(lockFile, "utf-8").catch(() => null);
3299
+ if (current === ownerId) {
3300
+ await fs.rm(lockFile, { force: true });
3301
+ }
3302
+ };
3317
3303
  }
3318
- if (parsedBody?.requestId && typeof parsedBody.requestId === "string") {
3319
- context.requestId = parsedBody.requestId;
3304
+ async rm(filePath) {
3305
+ await fs.rm(filePath, { recursive: true, force: true });
3320
3306
  }
3321
- if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
3322
- context.traceId = parsedBody.traceId;
3307
+ async rename(oldPath, newPath) {
3308
+ await fs.rename(oldPath, newPath);
3323
3309
  }
3324
- if (permission?.path !== undefined) {
3325
- context.path = permission.path;
3310
+ async realpath(filePath) {
3311
+ try {
3312
+ return await fs.realpath(filePath);
3313
+ } catch (error) {
3314
+ if (this.isEnoent(error))
3315
+ return filePath;
3316
+ throw error;
3317
+ }
3326
3318
  }
3327
- if (status === 429) {
3328
- const resp = response;
3329
- const headersObj = resp?.headers;
3330
- let retryAfterValue;
3331
- if (headersObj && typeof headersObj === "object" && typeof headersObj.get === "function") {
3332
- retryAfterValue = headersObj.get("retry-after") ?? undefined;
3319
+ async getTempDir() {
3320
+ return await fs.mkdtemp(path.join(os.tmpdir(), "uipath-fs-"));
3321
+ }
3322
+ async copyDirectory(sourcePath, destPath) {
3323
+ const sourceStats = await this.stat(sourcePath);
3324
+ if (!sourceStats) {
3325
+ throw new Error(`Source directory does not exist: ${sourcePath}`);
3333
3326
  }
3334
- if (!retryAfterValue && headersObj && typeof headersObj === "object") {
3335
- const headers = headersObj;
3336
- retryAfterValue = headers["retry-after"] ?? headers["Retry-After"];
3327
+ if (!sourceStats.isDirectory()) {
3328
+ throw new Error(`Source path is not a directory: ${sourcePath}`);
3337
3329
  }
3338
- if (retryAfterValue) {
3339
- const seconds = Number(retryAfterValue);
3340
- if (!Number.isNaN(seconds)) {
3341
- context.retryAfter = seconds;
3342
- retry = retryHintForRetryAfter(seconds);
3330
+ await this.mkdir(destPath);
3331
+ const entries = await this.readdir(sourcePath);
3332
+ for (const entry of entries) {
3333
+ const srcEntry = path.join(sourcePath, entry);
3334
+ const destEntry = path.join(destPath, entry);
3335
+ const entryStats = await this.stat(srcEntry);
3336
+ if (!entryStats)
3337
+ continue;
3338
+ if (entryStats.isDirectory()) {
3339
+ await this.copyDirectory(srcEntry, destEntry);
3340
+ } else if (entryStats.isFile()) {
3341
+ const content = await this.readFile(srcEntry);
3342
+ if (content !== null) {
3343
+ await this.writeFile(destEntry, content);
3344
+ }
3343
3345
  }
3344
3346
  }
3345
3347
  }
3346
- const hasContext = Object.keys(context).length > 0;
3347
- let parsedErrors;
3348
- if (parsedBody?.errors && typeof parsedBody.errors === "object") {
3349
- const errors = {};
3350
- for (const [field, raw] of Object.entries(parsedBody.errors)) {
3351
- if (Array.isArray(raw)) {
3352
- const messages = raw.map((entry) => {
3353
- if (typeof entry === "string")
3354
- return entry;
3355
- if (entry && typeof entry === "object" && typeof entry.message === "string") {
3356
- return entry.message;
3357
- }
3358
- return String(entry);
3359
- }).filter(Boolean);
3360
- if (messages.length > 0)
3361
- errors[field] = messages;
3362
- } else if (typeof raw === "string") {
3363
- errors[field] = [raw];
3364
- }
3365
- }
3366
- if (Object.keys(errors).length > 0)
3367
- parsedErrors = errors;
3348
+ isEnoent(error) {
3349
+ return this.hasErrnoCode(error, "ENOENT");
3350
+ }
3351
+ hasErrnoCode(error, code) {
3352
+ return typeof error === "object" && error !== null && "code" in error && error.code === code;
3368
3353
  }
3369
- return {
3370
- result,
3371
- errorCode: classification.errorCode,
3372
- message,
3373
- retry,
3374
- details,
3375
- ...hasContext ? { context } : {},
3376
- ...parsedErrors ? { parsedErrors } : {}
3377
- };
3378
- }
3379
- async function extractErrorMessage(error, options) {
3380
- const { message } = await extractErrorDetails(error, options);
3381
- return message;
3382
3354
  }
3355
+
3356
+ // ../filesystem/src/index.ts
3357
+ var fsInstance = new NodeFileSystem;
3358
+ var getFileSystem = () => fsInstance;
3383
3359
  // ../common/src/exit-code.ts
3384
3360
  function setExitCode(code) {
3385
3361
  process.exitCode = code;
@@ -3418,8 +3394,8 @@ function getOutputSink() {
3418
3394
 
3419
3395
  // ../common/src/logger.ts
3420
3396
  var logFilePathSlot = singleton("logFilePath");
3421
- function setGlobalLogFilePath(path) {
3422
- logFilePathSlot.set(path);
3397
+ function setGlobalLogFilePath(path2) {
3398
+ logFilePathSlot.set(path2);
3423
3399
  }
3424
3400
  function getGlobalLogFilePath() {
3425
3401
  return logFilePathSlot.get("");
@@ -3487,14 +3463,14 @@ class SimpleLogger {
3487
3463
  return this.fileLoggingEnabled || !!getGlobalLogFilePath();
3488
3464
  }
3489
3465
  writeToFile(formatted) {
3490
- const path = this.logFilePath || getGlobalLogFilePath();
3491
- if (!path)
3466
+ const path2 = this.logFilePath || getGlobalLogFilePath();
3467
+ if (!path2)
3492
3468
  return;
3493
3469
  const timestamp = new Date().toISOString();
3494
3470
  this.pendingWrites = Promise.all([
3495
3471
  this.pendingWrites,
3496
3472
  this.pendingInit
3497
- ]).then(() => getFileSystem().appendFile(path, `${timestamp} ${formatted}`).catch(() => {}));
3473
+ ]).then(() => getFileSystem().appendFile(path2, `${timestamp} ${formatted}`).catch(() => {}));
3498
3474
  }
3499
3475
  write(formatted) {
3500
3476
  if (this.isFileLoggingActive()) {
@@ -3544,17 +3520,17 @@ class SimpleLogger {
3544
3520
  setGlobalLogFilePath("");
3545
3521
  }
3546
3522
  }
3547
- setLogFile(path) {
3548
- this.logFilePath = path;
3549
- setGlobalLogFilePath(path);
3550
- if (!path)
3523
+ setLogFile(path2) {
3524
+ this.logFilePath = path2;
3525
+ setGlobalLogFilePath(path2);
3526
+ if (!path2)
3551
3527
  return;
3552
3528
  this.fileLoggingEnabled = true;
3553
- const fs = getFileSystem();
3529
+ const fs2 = getFileSystem();
3554
3530
  this.pendingInit = (async () => {
3555
3531
  const [error] = await catchError((async () => {
3556
- await fs.mkdir(fs.path.dirname(path));
3557
- await fs.writeFile(path, "");
3532
+ await fs2.mkdir(fs2.path.dirname(path2));
3533
+ await fs2.writeFile(path2, "");
3558
3534
  })());
3559
3535
  if (error)
3560
3536
  this.fileLoggingEnabled = false;
@@ -3608,12 +3584,12 @@ var jmespathSlot = singleton("JmespathCodec");
3608
3584
  async function loadOutputCodecsAsync(needed) {
3609
3585
  const loads = [];
3610
3586
  if (needed.yaml && yamlSlot.get() === undefined) {
3611
- loads.push(import("./js-yaml-a2bk27p6.js").then((mod) => {
3587
+ loads.push(import("./js-yaml-88tdqrtd.js").then((mod) => {
3612
3588
  yamlSlot.set(mod);
3613
3589
  }));
3614
3590
  }
3615
3591
  if (needed.filter && jmespathSlot.get() === undefined) {
3616
- loads.push(import("./jmespath-ab6tdc42.js").then((m)=>__toESM(m.default,1)).then((mod) => {
3592
+ loads.push(import("./jmespath-231m3hyn.js").then((m)=>__toESM(m.default,1)).then((mod) => {
3617
3593
  jmespathSlot.set(mod);
3618
3594
  }));
3619
3595
  }
@@ -6084,9 +6060,9 @@ function getProfileStorage() {
6084
6060
  if (isAuthProfileStorage(existing)) {
6085
6061
  return existing;
6086
6062
  }
6087
- const storage = createProfileStorage();
6088
- globalSlot[AUTH_PROFILE_STORAGE_KEY] = storage;
6089
- return storage;
6063
+ const storage2 = createProfileStorage();
6064
+ globalSlot[AUTH_PROFILE_STORAGE_KEY] = storage2;
6065
+ return storage2;
6090
6066
  }
6091
6067
  var profileStorage = getProfileStorage();
6092
6068
 
@@ -6117,8 +6093,8 @@ function resolveAuthProfileFilePath(profile) {
6117
6093
  if (normalized === undefined) {
6118
6094
  throw new AuthProfileValidationError(`"${DEFAULT_AUTH_PROFILE}" is the built-in profile and does not have a profile file path.`);
6119
6095
  }
6120
- const fs = getFileSystem();
6121
- return fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR, normalized, AUTH_FILENAME);
6096
+ const fs2 = getFileSystem();
6097
+ return fs2.path.join(fs2.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR, normalized, AUTH_FILENAME);
6122
6098
  }
6123
6099
  function getActiveAuthProfileFilePath() {
6124
6100
  const profile = getActiveAuthProfile();
@@ -6410,11 +6386,11 @@ var readAuthFromEnv = () => {
6410
6386
  if (!rawUrl) {
6411
6387
  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}).`);
6412
6388
  }
6413
- const baseUrl = resolveBaseUrl(rawUrl, `Failed to validate ${OPAQUE_TOKEN_BASE_URL_VAR}`);
6389
+ const baseUrl2 = resolveBaseUrl(rawUrl, `Failed to validate ${OPAQUE_TOKEN_BASE_URL_VAR}`);
6414
6390
  return {
6415
6391
  loginStatus: "Logged in",
6416
6392
  accessToken,
6417
- baseUrl,
6393
+ baseUrl: baseUrl2,
6418
6394
  organizationName,
6419
6395
  organizationId,
6420
6396
  tenantName,
@@ -6453,8 +6429,8 @@ var SURFACE_WINDOW_MS = 60 * 60 * 1000;
6453
6429
  async function refreshTokenFingerprint(refreshToken) {
6454
6430
  const bytes = new TextEncoder().encode(refreshToken);
6455
6431
  if (globalThis.crypto?.subtle) {
6456
- const digest = await globalThis.crypto.subtle.digest("SHA-256", bytes);
6457
- return Array.from(new Uint8Array(digest), (b) => b.toString(16).padStart(2, "0")).join("").slice(0, 16);
6432
+ const digest2 = await globalThis.crypto.subtle.digest("SHA-256", bytes);
6433
+ return Array.from(new Uint8Array(digest2), (b) => b.toString(16).padStart(2, "0")).join("").slice(0, 16);
6458
6434
  }
6459
6435
  const { createHash } = await import("node:crypto");
6460
6436
  return createHash("sha256").update(refreshToken).digest("hex").slice(0, 16);
@@ -6463,9 +6439,9 @@ function breakerPathFor(authPath) {
6463
6439
  return `${authPath}${BREAKER_SUFFIX}`;
6464
6440
  }
6465
6441
  async function loadRefreshBreaker(authPath) {
6466
- const fs = getFileSystem();
6442
+ const fs2 = getFileSystem();
6467
6443
  try {
6468
- const content = await fs.readFile(breakerPathFor(authPath), "utf-8");
6444
+ const content = await fs2.readFile(breakerPathFor(authPath), "utf-8");
6469
6445
  if (!content)
6470
6446
  return {};
6471
6447
  const parsed = JSON.parse(content);
@@ -6476,20 +6452,20 @@ async function loadRefreshBreaker(authPath) {
6476
6452
  }
6477
6453
  async function saveRefreshBreaker(authPath, state) {
6478
6454
  try {
6479
- const fs = getFileSystem();
6480
- const path = breakerPathFor(authPath);
6481
- await fs.mkdir(fs.path.dirname(path));
6482
- const tempPath = `${path}.tmp`;
6483
- await fs.writeFile(tempPath, JSON.stringify(state));
6484
- await fs.rename(tempPath, path);
6455
+ const fs2 = getFileSystem();
6456
+ const path2 = breakerPathFor(authPath);
6457
+ await fs2.mkdir(fs2.path.dirname(path2));
6458
+ const tempPath = `${path2}.tmp`;
6459
+ await fs2.writeFile(tempPath, JSON.stringify(state));
6460
+ await fs2.rename(tempPath, path2);
6485
6461
  } catch {}
6486
6462
  }
6487
6463
  async function clearRefreshBreaker(authPath) {
6488
- const fs = getFileSystem();
6489
- const path = breakerPathFor(authPath);
6464
+ const fs2 = getFileSystem();
6465
+ const path2 = breakerPathFor(authPath);
6490
6466
  try {
6491
- if (await fs.exists(path)) {
6492
- await fs.rm(path);
6467
+ if (await fs2.exists(path2)) {
6468
+ await fs2.rm(path2);
6493
6469
  }
6494
6470
  } catch {}
6495
6471
  }
@@ -6510,13 +6486,13 @@ var ROBOT_USER_SERVICES_PIPE = "UiPathUserServices";
6510
6486
  var ROBOT_USER_SERVICES_ALTERNATE_PIPE = `${ROBOT_USER_SERVICES_PIPE}Alternate`;
6511
6487
  var PIPE_NAME_MAX_LENGTH = 103;
6512
6488
  var getRobotIpcPipeNames = async () => {
6513
- const fs = getFileSystem();
6514
- const username = fs.env.getenv("USER") ?? fs.env.getenv("USERNAME");
6489
+ const fs2 = getFileSystem();
6490
+ const username = fs2.env.getenv("USER") ?? fs2.env.getenv("USERNAME");
6515
6491
  if (!username) {
6516
6492
  throw new Error("Unable to determine current username");
6517
6493
  }
6518
- const tempPath = fs.env.getenv("TMPDIR") ?? "/tmp/";
6519
- return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) => fs.path.join(tempPath, `${baseName}_${username}`).substring(0, PIPE_NAME_MAX_LENGTH));
6494
+ const tempPath = fs2.env.getenv("TMPDIR") ?? "/tmp/";
6495
+ return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) => fs2.path.join(tempPath, `${baseName}_${username}`).substring(0, PIPE_NAME_MAX_LENGTH));
6520
6496
  };
6521
6497
  var defaultIsRobotIpcAvailable = async () => {
6522
6498
  if (process.platform === "win32") {
@@ -6526,20 +6502,20 @@ var defaultIsRobotIpcAvailable = async () => {
6526
6502
  if (pipeNamesError || !pipeNames) {
6527
6503
  return false;
6528
6504
  }
6529
- const fs = getFileSystem();
6505
+ const fs2 = getFileSystem();
6530
6506
  for (const pipeName of pipeNames) {
6531
- const [existsError, exists] = await catchError2(fs.exists(pipeName));
6507
+ const [existsError, exists] = await catchError2(fs2.exists(pipeName));
6532
6508
  if (!existsError && exists === true) {
6533
6509
  return true;
6534
6510
  }
6535
6511
  }
6536
6512
  return false;
6537
6513
  };
6538
- var withTimeout = (promise, timeoutMs) => new Promise((resolve, reject) => {
6514
+ var withTimeout = (promise, timeoutMs) => new Promise((resolve2, reject) => {
6539
6515
  const timer = setTimeout(() => reject(new Error(`Robot IPC call timed out after ${timeoutMs}ms`)), timeoutMs);
6540
6516
  promise.then((value) => {
6541
6517
  clearTimeout(timer);
6542
- resolve(value);
6518
+ resolve2(value);
6543
6519
  }, (error) => {
6544
6520
  clearTimeout(timer);
6545
6521
  reject(error);
@@ -6712,9 +6688,9 @@ var errorCode = (err) => {
6712
6688
  }
6713
6689
  return "EUNKNOWN";
6714
6690
  };
6715
- var probeAsync = async (fs, candidate) => {
6691
+ var probeAsync = async (fs2, candidate) => {
6716
6692
  try {
6717
- const stats = await fs.stat(candidate);
6693
+ const stats = await fs2.stat(candidate);
6718
6694
  if (stats === null) {
6719
6695
  return { exists: false };
6720
6696
  }
@@ -6741,36 +6717,36 @@ var probeAsync = async (fs, candidate) => {
6741
6717
  }
6742
6718
  };
6743
6719
  var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
6744
- const fs = getFileSystem();
6745
- if (fs.path.isAbsolute(envFilePath)) {
6746
- const probe = await probeAsync(fs, envFilePath);
6747
- return probe.exists ? { exists: true, absolutePath: envFilePath, source: "absolute" } : {
6720
+ const fs2 = getFileSystem();
6721
+ if (fs2.path.isAbsolute(envFilePath)) {
6722
+ const probe2 = await probeAsync(fs2, envFilePath);
6723
+ return probe2.exists ? { exists: true, absolutePath: envFilePath, source: "absolute" } : {
6748
6724
  exists: false,
6749
6725
  absolutePath: envFilePath,
6750
6726
  source: "absolute",
6751
- ...probe.unusable ? { unusable: probe.unusable } : {}
6727
+ ...probe2.unusable ? { unusable: probe2.unusable } : {}
6752
6728
  };
6753
6729
  }
6754
- const cwd = opts?.cwd ?? fs.env.cwd();
6730
+ const cwd = opts?.cwd ?? fs2.env.cwd();
6755
6731
  let searchDir = cwd;
6756
6732
  while (true) {
6757
- const candidate = fs.path.join(searchDir, envFilePath);
6758
- const probe = await probeAsync(fs, candidate);
6759
- if (probe.exists) {
6733
+ const candidate = fs2.path.join(searchDir, envFilePath);
6734
+ const probe2 = await probeAsync(fs2, candidate);
6735
+ if (probe2.exists) {
6760
6736
  return {
6761
6737
  exists: true,
6762
6738
  absolutePath: candidate,
6763
6739
  source: searchDir === cwd ? "cwd" : "ancestor"
6764
6740
  };
6765
6741
  }
6766
- const parentDir = fs.path.dirname(searchDir);
6742
+ const parentDir = fs2.path.dirname(searchDir);
6767
6743
  if (parentDir === searchDir) {
6768
6744
  break;
6769
6745
  }
6770
6746
  searchDir = parentDir;
6771
6747
  }
6772
- const homePath = fs.path.join(fs.env.homedir(), envFilePath);
6773
- const probe = await probeAsync(fs, homePath);
6748
+ const homePath = fs2.path.join(fs2.env.homedir(), envFilePath);
6749
+ const probe = await probeAsync(fs2, homePath);
6774
6750
  if (probe.exists) {
6775
6751
  return { exists: true, absolutePath: homePath, source: "home" };
6776
6752
  }
@@ -6813,12 +6789,12 @@ var parseEnvContent = (content) => {
6813
6789
  return env;
6814
6790
  };
6815
6791
  var loadEnvFileAsync = async ({ envPath }) => {
6816
- const fs = getFileSystem();
6817
- const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.cwd(), envPath);
6818
- if (!await fs.exists(absolutePath)) {
6792
+ const fs2 = getFileSystem();
6793
+ const absolutePath = fs2.path.isAbsolute(envPath) ? envPath : fs2.path.join(fs2.env.cwd(), envPath);
6794
+ if (!await fs2.exists(absolutePath)) {
6819
6795
  throw new Error(`Environment file not found: ${envPath}`);
6820
6796
  }
6821
- const content = await fs.readFile(absolutePath, "utf-8");
6797
+ const content = await fs2.readFile(absolutePath, "utf-8");
6822
6798
  if (content === null) {
6823
6799
  throw new Error(`Environment file not found: ${envPath}`);
6824
6800
  }
@@ -6829,10 +6805,10 @@ var saveEnvFileAsync = async ({
6829
6805
  data,
6830
6806
  merge = true
6831
6807
  }) => {
6832
- const fs = getFileSystem();
6833
- const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.homedir(), envPath);
6808
+ const fs2 = getFileSystem();
6809
+ const absolutePath = fs2.path.isAbsolute(envPath) ? envPath : fs2.path.join(fs2.env.homedir(), envPath);
6834
6810
  let existingData = {};
6835
- if (merge && await fs.exists(absolutePath)) {
6811
+ if (merge && await fs2.exists(absolutePath)) {
6836
6812
  try {
6837
6813
  existingData = await loadEnvFileAsync({ envPath: absolutePath });
6838
6814
  } catch {}
@@ -6850,11 +6826,11 @@ var saveEnvFileAsync = async ({
6850
6826
  const content = `${lines.join(`
6851
6827
  `)}
6852
6828
  `;
6853
- const dir = fs.path.dirname(absolutePath);
6854
- await fs.mkdir(dir);
6829
+ const dir = fs2.path.dirname(absolutePath);
6830
+ await fs2.mkdir(dir);
6855
6831
  const tempPath = `${absolutePath}.tmp`;
6856
- await fs.writeFile(tempPath, content);
6857
- await fs.rename(tempPath, absolutePath);
6832
+ await fs2.writeFile(tempPath, content);
6833
+ await fs2.rename(tempPath, absolutePath);
6858
6834
  };
6859
6835
 
6860
6836
  // ../auth/src/loginStatus.ts
@@ -6968,11 +6944,11 @@ async function loadFileCredentials(loadEnvFile, absolutePath) {
6968
6944
  return { credentials };
6969
6945
  }
6970
6946
  async function getGlobalCredsHint(getFs, loadEnvFile, absolutePath, envFilePath) {
6971
- const fs = getFs();
6972
- const globalPath = fs.path.join(fs.env.homedir(), envFilePath);
6947
+ const fs2 = getFs();
6948
+ const globalPath = fs2.path.join(fs2.env.homedir(), envFilePath);
6973
6949
  if (absolutePath === globalPath)
6974
6950
  return;
6975
- if (!await fs.exists(globalPath))
6951
+ if (!await fs2.exists(globalPath))
6976
6952
  return;
6977
6953
  try {
6978
6954
  const globalCreds = await loadEnvFile({ envPath: globalPath });
@@ -7376,4 +7352,4 @@ var TENANT_SELECTION_CODES = new Set([
7376
7352
  ]);
7377
7353
  export { catchError, extractErrorMessage, RESULTS, Pagination, OutputFormatter, Command, processContext, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, getAuthContext };
7378
7354
 
7379
- //# debugId=1728A2A6408C1E4964756E2164756E21
7355
+ //# debugId=35F0ED7278AEFC7264756E2164756E21