@uipath/admin-tool 1.205.0-preview.281 → 1.206.0-preview.282
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.
- package/dist/{index-37jrt4wz.js → index-0tbanmrb.js} +79 -85
- package/dist/{index-3mgpezgw.js → index-h9t95d1v.js} +58 -64
- package/dist/{index-3v0kv44y.js → index-jd9v7pra.js} +207 -2986
- package/dist/{index-00ks13f2.js → index-s679w9k7.js} +2100 -40
- package/dist/{index-esy280as.js → index-x4997kvr.js} +2 -22
- package/dist/{index-6s9xyeev.js → index-x8zxgeh4.js} +22 -28
- package/dist/{jmespath-v0jttxep.js → jmespath-z30y456m.js} +1 -1
- package/dist/{js-yaml-qv0npwpc.js → js-yaml-cr6n3g9w.js} +1 -3
- package/dist/{tool-nwbftwhg.js → tool-1nnqcf86.js} +36 -21
- package/dist/{tool-x2rahref.js → tool-639e3mrh.js} +36 -41
- package/dist/{tool-vwvd47vw.js → tool-geyxa9fk.js} +25 -33
- package/dist/tool-vp6z9an2.js +867 -0
- package/dist/{tool-2wtwtawb.js → tool-zg1at4tw.js} +1131 -594
- package/dist/tool.js +11 -13
- package/package.json +2 -2
- package/dist/tool-1yh8g550.js +0 -52
- package/dist/tool-hsqb6sve.js +0 -2859
|
@@ -1,8 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
function __accessProp(key) {
|
|
8
|
+
return this[key];
|
|
9
|
+
}
|
|
10
|
+
var __toESMCache_node;
|
|
11
|
+
var __toESMCache_esm;
|
|
12
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
13
|
+
var canCache = mod != null && typeof mod === "object";
|
|
14
|
+
if (canCache) {
|
|
15
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
16
|
+
var cached = cache.get(mod);
|
|
17
|
+
if (cached)
|
|
18
|
+
return cached;
|
|
19
|
+
}
|
|
20
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
21
|
+
const to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
22
|
+
if (mod && typeof mod === "object" || typeof mod === "function") {
|
|
23
|
+
for (let key of __getOwnPropNames(mod))
|
|
24
|
+
if (!__hasOwnProp.call(to, key))
|
|
25
|
+
__defProp(to, key, {
|
|
26
|
+
get: __accessProp.bind(mod, key),
|
|
27
|
+
enumerable: true
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
if (canCache)
|
|
31
|
+
cache.set(mod, to);
|
|
32
|
+
return to;
|
|
33
|
+
};
|
|
34
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
35
|
+
var __exportCjs = (target, getters, setters) => {
|
|
36
|
+
for (var name in getters)
|
|
37
|
+
__defProp(target, name, {
|
|
38
|
+
get: getters[name],
|
|
39
|
+
set: setters[name],
|
|
40
|
+
enumerable: true,
|
|
41
|
+
configurable: true
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
6
45
|
|
|
7
46
|
// ../../../node_modules/commander/lib/error.js
|
|
8
47
|
var require_error = __commonJS(function(exports) {
|
|
@@ -124,7 +163,7 @@ var require_help = __commonJS(function(exports) {
|
|
|
124
163
|
this.helpWidth = this.helpWidth ?? contextOptions.helpWidth ?? 80;
|
|
125
164
|
}
|
|
126
165
|
visibleCommands(cmd) {
|
|
127
|
-
const visibleCommands = cmd.commands.filter((
|
|
166
|
+
const visibleCommands = cmd.commands.filter((cmd) => !cmd._hidden);
|
|
128
167
|
const helpCommand = cmd._getHelpCommand();
|
|
129
168
|
if (helpCommand && !helpCommand._hidden) {
|
|
130
169
|
visibleCommands.push(helpCommand);
|
|
@@ -604,8 +643,8 @@ var require_option = __commonJS(function(exports) {
|
|
|
604
643
|
}
|
|
605
644
|
}
|
|
606
645
|
function camelcase(str) {
|
|
607
|
-
return str.split("-").reduce((
|
|
608
|
-
return
|
|
646
|
+
return str.split("-").reduce((str, word) => {
|
|
647
|
+
return str + word[0].toUpperCase() + word.slice(1);
|
|
609
648
|
});
|
|
610
649
|
}
|
|
611
650
|
function splitOptionFlags(flags) {
|
|
@@ -726,8 +765,8 @@ var require_suggestSimilar = __commonJS(function(exports) {
|
|
|
726
765
|
var require_command = __commonJS(function(exports) {
|
|
727
766
|
var EventEmitter = __require("node:events").EventEmitter;
|
|
728
767
|
var childProcess = __require("node:child_process");
|
|
729
|
-
var
|
|
730
|
-
var
|
|
768
|
+
var path = __require("node:path");
|
|
769
|
+
var fs = __require("node:fs");
|
|
731
770
|
var process2 = __require("node:process");
|
|
732
771
|
var { Argument, humanReadableArgName } = require_argument();
|
|
733
772
|
var { CommanderError } = require_error();
|
|
@@ -1176,44 +1215,44 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1176
1215
|
});
|
|
1177
1216
|
return source;
|
|
1178
1217
|
}
|
|
1179
|
-
_prepareUserArgs(
|
|
1180
|
-
if (
|
|
1218
|
+
_prepareUserArgs(argv2, parseOptions) {
|
|
1219
|
+
if (argv2 !== undefined && !Array.isArray(argv2)) {
|
|
1181
1220
|
throw new Error("first parameter to parse must be array or undefined");
|
|
1182
1221
|
}
|
|
1183
1222
|
parseOptions = parseOptions || {};
|
|
1184
|
-
if (
|
|
1223
|
+
if (argv2 === undefined && parseOptions.from === undefined) {
|
|
1185
1224
|
if (process2.versions?.electron) {
|
|
1186
1225
|
parseOptions.from = "electron";
|
|
1187
1226
|
}
|
|
1188
|
-
const
|
|
1189
|
-
if (
|
|
1227
|
+
const execArgv2 = process2.execArgv ?? [];
|
|
1228
|
+
if (execArgv2.includes("-e") || execArgv2.includes("--eval") || execArgv2.includes("-p") || execArgv2.includes("--print")) {
|
|
1190
1229
|
parseOptions.from = "eval";
|
|
1191
1230
|
}
|
|
1192
1231
|
}
|
|
1193
|
-
if (
|
|
1194
|
-
|
|
1232
|
+
if (argv2 === undefined) {
|
|
1233
|
+
argv2 = process2.argv;
|
|
1195
1234
|
}
|
|
1196
|
-
this.rawArgs =
|
|
1235
|
+
this.rawArgs = argv2.slice();
|
|
1197
1236
|
let userArgs;
|
|
1198
1237
|
switch (parseOptions.from) {
|
|
1199
1238
|
case undefined:
|
|
1200
1239
|
case "node":
|
|
1201
|
-
this._scriptPath =
|
|
1202
|
-
userArgs =
|
|
1240
|
+
this._scriptPath = argv2[1];
|
|
1241
|
+
userArgs = argv2.slice(2);
|
|
1203
1242
|
break;
|
|
1204
1243
|
case "electron":
|
|
1205
1244
|
if (process2.defaultApp) {
|
|
1206
|
-
this._scriptPath =
|
|
1207
|
-
userArgs =
|
|
1245
|
+
this._scriptPath = argv2[1];
|
|
1246
|
+
userArgs = argv2.slice(2);
|
|
1208
1247
|
} else {
|
|
1209
|
-
userArgs =
|
|
1248
|
+
userArgs = argv2.slice(1);
|
|
1210
1249
|
}
|
|
1211
1250
|
break;
|
|
1212
1251
|
case "user":
|
|
1213
|
-
userArgs =
|
|
1252
|
+
userArgs = argv2.slice(0);
|
|
1214
1253
|
break;
|
|
1215
1254
|
case "eval":
|
|
1216
|
-
userArgs =
|
|
1255
|
+
userArgs = argv2.slice(1);
|
|
1217
1256
|
break;
|
|
1218
1257
|
default:
|
|
1219
1258
|
throw new Error(`unexpected parse option { from: '${parseOptions.from}' }`);
|
|
@@ -1262,7 +1301,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1262
1301
|
this.processedArgs = [];
|
|
1263
1302
|
}
|
|
1264
1303
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
1265
|
-
if (
|
|
1304
|
+
if (fs.existsSync(executableFile))
|
|
1266
1305
|
return;
|
|
1267
1306
|
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";
|
|
1268
1307
|
const executableMissing = `'${executableFile}' does not exist
|
|
@@ -1276,12 +1315,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1276
1315
|
let launchWithNode = false;
|
|
1277
1316
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1278
1317
|
function findFile(baseDir, baseName) {
|
|
1279
|
-
const localBin =
|
|
1280
|
-
if (
|
|
1318
|
+
const localBin = path.resolve(baseDir, baseName);
|
|
1319
|
+
if (fs.existsSync(localBin))
|
|
1281
1320
|
return localBin;
|
|
1282
|
-
if (sourceExt.includes(
|
|
1321
|
+
if (sourceExt.includes(path.extname(baseName)))
|
|
1283
1322
|
return;
|
|
1284
|
-
const foundExt = sourceExt.find((ext) =>
|
|
1323
|
+
const foundExt = sourceExt.find((ext) => fs.existsSync(`${localBin}${ext}`));
|
|
1285
1324
|
if (foundExt)
|
|
1286
1325
|
return `${localBin}${foundExt}`;
|
|
1287
1326
|
return;
|
|
@@ -1293,23 +1332,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1293
1332
|
if (this._scriptPath) {
|
|
1294
1333
|
let resolvedScriptPath;
|
|
1295
1334
|
try {
|
|
1296
|
-
resolvedScriptPath =
|
|
1335
|
+
resolvedScriptPath = fs.realpathSync(this._scriptPath);
|
|
1297
1336
|
} catch {
|
|
1298
1337
|
resolvedScriptPath = this._scriptPath;
|
|
1299
1338
|
}
|
|
1300
|
-
executableDir =
|
|
1339
|
+
executableDir = path.resolve(path.dirname(resolvedScriptPath), executableDir);
|
|
1301
1340
|
}
|
|
1302
1341
|
if (executableDir) {
|
|
1303
1342
|
let localFile = findFile(executableDir, executableFile);
|
|
1304
1343
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1305
|
-
const legacyName =
|
|
1344
|
+
const legacyName = path.basename(this._scriptPath, path.extname(this._scriptPath));
|
|
1306
1345
|
if (legacyName !== this._name) {
|
|
1307
1346
|
localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
|
|
1308
1347
|
}
|
|
1309
1348
|
}
|
|
1310
1349
|
executableFile = localFile || executableFile;
|
|
1311
1350
|
}
|
|
1312
|
-
launchWithNode = sourceExt.includes(
|
|
1351
|
+
launchWithNode = sourceExt.includes(path.extname(executableFile));
|
|
1313
1352
|
let proc;
|
|
1314
1353
|
if (process2.platform !== "win32") {
|
|
1315
1354
|
if (launchWithNode) {
|
|
@@ -1736,18 +1775,18 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1736
1775
|
this.error(message, { code: "commander.missingMandatoryOptionValue" });
|
|
1737
1776
|
}
|
|
1738
1777
|
_conflictingOption(option, conflictingOption) {
|
|
1739
|
-
const findBestOptionFromValue = (
|
|
1740
|
-
const optionKey =
|
|
1778
|
+
const findBestOptionFromValue = (option) => {
|
|
1779
|
+
const optionKey = option.attributeName();
|
|
1741
1780
|
const optionValue = this.getOptionValue(optionKey);
|
|
1742
1781
|
const negativeOption = this.options.find((target) => target.negate && optionKey === target.attributeName());
|
|
1743
1782
|
const positiveOption = this.options.find((target) => !target.negate && optionKey === target.attributeName());
|
|
1744
1783
|
if (negativeOption && (negativeOption.presetArg === undefined && optionValue === false || negativeOption.presetArg !== undefined && optionValue === negativeOption.presetArg)) {
|
|
1745
1784
|
return negativeOption;
|
|
1746
1785
|
}
|
|
1747
|
-
return positiveOption ||
|
|
1786
|
+
return positiveOption || option;
|
|
1748
1787
|
};
|
|
1749
|
-
const getErrorMessage = (
|
|
1750
|
-
const bestOption = findBestOptionFromValue(
|
|
1788
|
+
const getErrorMessage = (option) => {
|
|
1789
|
+
const bestOption = findBestOptionFromValue(option);
|
|
1751
1790
|
const optionKey = bestOption.attributeName();
|
|
1752
1791
|
const source = this.getOptionValueSource(optionKey);
|
|
1753
1792
|
if (source === "env") {
|
|
@@ -1898,13 +1937,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1898
1937
|
cmd.helpGroup(this._defaultCommandGroup);
|
|
1899
1938
|
}
|
|
1900
1939
|
nameFromFilename(filename) {
|
|
1901
|
-
this._name =
|
|
1940
|
+
this._name = path.basename(filename, path.extname(filename));
|
|
1902
1941
|
return this;
|
|
1903
1942
|
}
|
|
1904
|
-
executableDir(
|
|
1905
|
-
if (
|
|
1943
|
+
executableDir(path) {
|
|
1944
|
+
if (path === undefined)
|
|
1906
1945
|
return this._executableDir;
|
|
1907
|
-
this._executableDir =
|
|
1946
|
+
this._executableDir = path;
|
|
1908
1947
|
return this;
|
|
1909
1948
|
}
|
|
1910
1949
|
helpInformation(contextOptions) {
|
|
@@ -2001,11 +2040,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2001
2040
|
}
|
|
2002
2041
|
help(contextOptions) {
|
|
2003
2042
|
this.outputHelp(contextOptions);
|
|
2004
|
-
let
|
|
2005
|
-
if (
|
|
2006
|
-
|
|
2043
|
+
let exitCode2 = Number(process2.exitCode ?? 0);
|
|
2044
|
+
if (exitCode2 === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
|
|
2045
|
+
exitCode2 = 1;
|
|
2007
2046
|
}
|
|
2008
|
-
this._exit(
|
|
2047
|
+
this._exit(exitCode2, "commander.help", "(outputHelp)");
|
|
2009
2048
|
}
|
|
2010
2049
|
addHelpText(position, text) {
|
|
2011
2050
|
const allowedValues = ["beforeAll", "before", "after", "afterAll"];
|
|
@@ -2077,26 +2116,6 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2077
2116
|
exports.useColor = useColor;
|
|
2078
2117
|
});
|
|
2079
2118
|
|
|
2080
|
-
// ../../../node_modules/commander/index.js
|
|
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;
|
|
2098
|
-
});
|
|
2099
|
-
|
|
2100
2119
|
// ../../common/src/host-global-options.ts
|
|
2101
2120
|
var HOST_GLOBAL_OPTIONS_WITH_VALUE = [
|
|
2102
2121
|
"--output",
|
|
@@ -2133,7 +2152,7 @@ function stripHostGlobalOptions(args) {
|
|
|
2133
2152
|
}
|
|
2134
2153
|
|
|
2135
2154
|
// ../../filesystem/src/node.ts
|
|
2136
|
-
import { randomUUID } from "node:crypto";
|
|
2155
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
2137
2156
|
import { existsSync } from "node:fs";
|
|
2138
2157
|
import * as fs from "node:fs/promises";
|
|
2139
2158
|
import * as os from "node:os";
|
|
@@ -2144,6 +2163,9 @@ var LOCK_MAX_WAIT_MS = 20000;
|
|
|
2144
2163
|
var LOCK_MAX_HOLD_MS = 60000;
|
|
2145
2164
|
var LOCK_RETRY_MIN_MS = 100;
|
|
2146
2165
|
var LOCK_RETRY_JITTER_MS = 200;
|
|
2166
|
+
var HASH_CHUNK_BYTES = 256 * 1024;
|
|
2167
|
+
var hashBuffers = [];
|
|
2168
|
+
var HASH_BUFFERS_KEPT = 64;
|
|
2147
2169
|
|
|
2148
2170
|
class NodeFileSystem {
|
|
2149
2171
|
path = {
|
|
@@ -2162,7 +2184,7 @@ class NodeFileSystem {
|
|
|
2162
2184
|
};
|
|
2163
2185
|
utils = {
|
|
2164
2186
|
open: async (url) => {
|
|
2165
|
-
const { default: open } = await import("./index-
|
|
2187
|
+
const { default: open } = await import("./index-x4997kvr.js");
|
|
2166
2188
|
await open(url);
|
|
2167
2189
|
}
|
|
2168
2190
|
};
|
|
@@ -2201,6 +2223,15 @@ class NodeFileSystem {
|
|
|
2201
2223
|
throw error;
|
|
2202
2224
|
}
|
|
2203
2225
|
}
|
|
2226
|
+
async readdirEntries(dirPath) {
|
|
2227
|
+
try {
|
|
2228
|
+
return await fs.readdir(dirPath, { withFileTypes: true });
|
|
2229
|
+
} catch (error) {
|
|
2230
|
+
if (this.isEnoent(error))
|
|
2231
|
+
return [];
|
|
2232
|
+
throw error;
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2204
2235
|
async stat(filePath) {
|
|
2205
2236
|
try {
|
|
2206
2237
|
const stats = await fs.stat(filePath);
|
|
@@ -2208,7 +2239,8 @@ class NodeFileSystem {
|
|
|
2208
2239
|
isFile: () => stats.isFile(),
|
|
2209
2240
|
isDirectory: () => stats.isDirectory(),
|
|
2210
2241
|
size: stats.size,
|
|
2211
|
-
mtimeMs: stats.mtimeMs
|
|
2242
|
+
mtimeMs: stats.mtimeMs,
|
|
2243
|
+
ctimeMs: stats.ctimeMs
|
|
2212
2244
|
};
|
|
2213
2245
|
} catch (error) {
|
|
2214
2246
|
if (this.isEnoent(error))
|
|
@@ -2322,6 +2354,42 @@ class NodeFileSystem {
|
|
|
2322
2354
|
throw error;
|
|
2323
2355
|
}
|
|
2324
2356
|
}
|
|
2357
|
+
async hashFile(filePath) {
|
|
2358
|
+
let handle;
|
|
2359
|
+
try {
|
|
2360
|
+
handle = await fs.open(filePath, "r");
|
|
2361
|
+
} catch (error) {
|
|
2362
|
+
if (this.isEnoent(error))
|
|
2363
|
+
return null;
|
|
2364
|
+
throw error;
|
|
2365
|
+
}
|
|
2366
|
+
const buffer = hashBuffers.pop() ?? Buffer.allocUnsafe(HASH_CHUNK_BYTES);
|
|
2367
|
+
try {
|
|
2368
|
+
const opened = await handle.stat();
|
|
2369
|
+
const stats = {
|
|
2370
|
+
isFile: () => opened.isFile(),
|
|
2371
|
+
isDirectory: () => opened.isDirectory(),
|
|
2372
|
+
size: opened.size,
|
|
2373
|
+
mtimeMs: opened.mtimeMs,
|
|
2374
|
+
ctimeMs: opened.ctimeMs
|
|
2375
|
+
};
|
|
2376
|
+
const hash = createHash("sha256");
|
|
2377
|
+
let size = 0;
|
|
2378
|
+
for (;; ) {
|
|
2379
|
+
const { bytesRead } = await handle.read(buffer, 0, buffer.byteLength, null);
|
|
2380
|
+
if (bytesRead === 0)
|
|
2381
|
+
break;
|
|
2382
|
+
hash.update(buffer.subarray(0, bytesRead));
|
|
2383
|
+
size += bytesRead;
|
|
2384
|
+
}
|
|
2385
|
+
return { sha256: hash.digest("hex"), size, stats };
|
|
2386
|
+
} finally {
|
|
2387
|
+
if (hashBuffers.length < HASH_BUFFERS_KEPT) {
|
|
2388
|
+
hashBuffers.push(buffer);
|
|
2389
|
+
}
|
|
2390
|
+
await handle.close();
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2325
2393
|
async realpath(filePath) {
|
|
2326
2394
|
try {
|
|
2327
2395
|
return await fs.realpath(filePath);
|
|
@@ -2372,6 +2440,208 @@ class NodeFileSystem {
|
|
|
2372
2440
|
var fsInstance = new NodeFileSystem;
|
|
2373
2441
|
var getFileSystem = () => fsInstance;
|
|
2374
2442
|
|
|
2443
|
+
// ../../common/src/telemetry/telemetry-dimensions.ts
|
|
2444
|
+
var BaseDimensions = {
|
|
2445
|
+
ApplicationName: "ApplicationName",
|
|
2446
|
+
ProductVersion: "ProductVersion",
|
|
2447
|
+
InstallationId: "InstallationId",
|
|
2448
|
+
CloudUserId: "CloudUserId",
|
|
2449
|
+
CloudTenantId: "CloudTenantId",
|
|
2450
|
+
CloudOrganizationId: "CloudOrganizationId",
|
|
2451
|
+
IsInternalUser: "IsInternalUser",
|
|
2452
|
+
Environment: "Environment",
|
|
2453
|
+
BaseUrl: "BaseUrl",
|
|
2454
|
+
Region: "Region",
|
|
2455
|
+
Agent: "Agent",
|
|
2456
|
+
AgentVersion: "AgentVersion",
|
|
2457
|
+
AgentModel: "AgentModel",
|
|
2458
|
+
ToolName: "ToolName",
|
|
2459
|
+
ToolVersion: "ToolVersion",
|
|
2460
|
+
ExecutionContext: "ExecutionContext",
|
|
2461
|
+
CiProvider: "CiProvider",
|
|
2462
|
+
SessionIdSource: "SessionIdSource",
|
|
2463
|
+
SessionId: "SessionId"
|
|
2464
|
+
};
|
|
2465
|
+
var CommandDimensions = {
|
|
2466
|
+
IsCommand: "IsCommand",
|
|
2467
|
+
IsReexec: "IsReexec",
|
|
2468
|
+
CommandName: "CommandName",
|
|
2469
|
+
ExitCode: "ExitCode",
|
|
2470
|
+
TerminalOutcome: "TerminalOutcome",
|
|
2471
|
+
ErrorClass: "ErrorClass",
|
|
2472
|
+
TerminalSignal: "TerminalSignal",
|
|
2473
|
+
ErrorMessage: "ErrorMessage",
|
|
2474
|
+
SkillName: "SkillName",
|
|
2475
|
+
ProductArea: "ProductArea",
|
|
2476
|
+
Mode: "Mode"
|
|
2477
|
+
};
|
|
2478
|
+
var ProjectDimensions = {
|
|
2479
|
+
ProjectKey: "ProjectKey",
|
|
2480
|
+
ProjectType: "ProjectType",
|
|
2481
|
+
ProjectIdentityStatus: "ProjectIdentityStatus",
|
|
2482
|
+
SolutionKey: "SolutionKey",
|
|
2483
|
+
SolutionProjectKey: "SolutionProjectKey",
|
|
2484
|
+
SolutionIdentityStatus: "SolutionIdentityStatus",
|
|
2485
|
+
PreviousSolutionKey: "PreviousSolutionKey"
|
|
2486
|
+
};
|
|
2487
|
+
var GUID_KEY_DIMENSIONS = new Set([
|
|
2488
|
+
ProjectDimensions.ProjectKey,
|
|
2489
|
+
ProjectDimensions.SolutionKey,
|
|
2490
|
+
ProjectDimensions.SolutionProjectKey,
|
|
2491
|
+
ProjectDimensions.PreviousSolutionKey
|
|
2492
|
+
]);
|
|
2493
|
+
var ShipDimensions = {
|
|
2494
|
+
ShipKind: "ShipKind",
|
|
2495
|
+
Target: "Target",
|
|
2496
|
+
ProjectType: "ProjectType",
|
|
2497
|
+
ProjectTypes: "ProjectTypes",
|
|
2498
|
+
ArtifactCorrelationKey: "ArtifactCorrelationKey",
|
|
2499
|
+
PackageName: "PackageName",
|
|
2500
|
+
PackageVersion: "PackageVersion",
|
|
2501
|
+
PackageVersionKey: "PackageVersionKey",
|
|
2502
|
+
DeploymentKey: "DeploymentKey",
|
|
2503
|
+
SolutionId: "SolutionId",
|
|
2504
|
+
FolderKey: "FolderKey",
|
|
2505
|
+
FeedId: "FeedId"
|
|
2506
|
+
};
|
|
2507
|
+
var ErrorDimensions = {
|
|
2508
|
+
Result: "Result",
|
|
2509
|
+
ErrorCode: "ErrorCode",
|
|
2510
|
+
Retry: "Retry",
|
|
2511
|
+
ErrorMessage: "ErrorMessage",
|
|
2512
|
+
HttpStatus: "HttpStatus",
|
|
2513
|
+
UpstreamErrorCode: "UpstreamErrorCode"
|
|
2514
|
+
};
|
|
2515
|
+
var AuthDimensions = {
|
|
2516
|
+
AuthenticationMethod: "AuthenticationMethod",
|
|
2517
|
+
Success: "Success",
|
|
2518
|
+
Reason: "Reason"
|
|
2519
|
+
};
|
|
2520
|
+
var SkillsDimensions = {
|
|
2521
|
+
SchemaVersion: "SchemaVersion",
|
|
2522
|
+
AgentType: "AgentType",
|
|
2523
|
+
SkillsVersion: "SkillsVersion",
|
|
2524
|
+
UipSubcommand: "UipSubcommand",
|
|
2525
|
+
FileExtension: "FileExtension",
|
|
2526
|
+
SubagentModel: "SubagentModel",
|
|
2527
|
+
SubagentType: "SubagentType",
|
|
2528
|
+
PermissionMode: "PermissionMode",
|
|
2529
|
+
EffortLevel: "EffortLevel",
|
|
2530
|
+
SessionSource: "SessionSource",
|
|
2531
|
+
Outcome: "Outcome",
|
|
2532
|
+
DurationMs: "DurationMs",
|
|
2533
|
+
Source: "Source"
|
|
2534
|
+
};
|
|
2535
|
+
var PackagerDimensions = {
|
|
2536
|
+
ProjectId: "ProjectId",
|
|
2537
|
+
ProjectType: "ProjectType",
|
|
2538
|
+
SolutionId: "SolutionId"
|
|
2539
|
+
};
|
|
2540
|
+
var ScopeDimensions = {
|
|
2541
|
+
FolderId: "FolderId"
|
|
2542
|
+
};
|
|
2543
|
+
var ID_DIMENSIONS = new Set([
|
|
2544
|
+
BaseDimensions.CloudUserId,
|
|
2545
|
+
BaseDimensions.CloudTenantId,
|
|
2546
|
+
BaseDimensions.CloudOrganizationId,
|
|
2547
|
+
BaseDimensions.InstallationId,
|
|
2548
|
+
ShipDimensions.ArtifactCorrelationKey,
|
|
2549
|
+
ShipDimensions.PackageVersionKey,
|
|
2550
|
+
ShipDimensions.DeploymentKey,
|
|
2551
|
+
ShipDimensions.SolutionId,
|
|
2552
|
+
ShipDimensions.FolderKey,
|
|
2553
|
+
ShipDimensions.FeedId,
|
|
2554
|
+
PackagerDimensions.ProjectId
|
|
2555
|
+
]);
|
|
2556
|
+
var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
|
|
2557
|
+
var RESERVED_DIMENSION_NAMES = new Set([
|
|
2558
|
+
...Object.values(BaseDimensions),
|
|
2559
|
+
...Object.values(CommandDimensions),
|
|
2560
|
+
...Object.values(ShipDimensions),
|
|
2561
|
+
...Object.values(ProjectDimensions),
|
|
2562
|
+
...Object.values(ErrorDimensions),
|
|
2563
|
+
...Object.values(AuthDimensions),
|
|
2564
|
+
...Object.values(SkillsDimensions),
|
|
2565
|
+
...Object.values(PackagerDimensions),
|
|
2566
|
+
...Object.values(ScopeDimensions)
|
|
2567
|
+
]);
|
|
2568
|
+
var CURATED_DIMENSIONS = new Set([
|
|
2569
|
+
BaseDimensions.ApplicationName,
|
|
2570
|
+
BaseDimensions.ProductVersion,
|
|
2571
|
+
BaseDimensions.InstallationId,
|
|
2572
|
+
BaseDimensions.CloudUserId,
|
|
2573
|
+
BaseDimensions.CloudTenantId,
|
|
2574
|
+
BaseDimensions.CloudOrganizationId,
|
|
2575
|
+
BaseDimensions.IsInternalUser,
|
|
2576
|
+
BaseDimensions.Environment,
|
|
2577
|
+
BaseDimensions.BaseUrl,
|
|
2578
|
+
BaseDimensions.Region,
|
|
2579
|
+
BaseDimensions.Agent,
|
|
2580
|
+
BaseDimensions.AgentVersion,
|
|
2581
|
+
BaseDimensions.ToolVersion,
|
|
2582
|
+
BaseDimensions.ExecutionContext,
|
|
2583
|
+
BaseDimensions.CiProvider,
|
|
2584
|
+
BaseDimensions.SessionIdSource,
|
|
2585
|
+
BaseDimensions.SessionId,
|
|
2586
|
+
...Object.values(CommandDimensions),
|
|
2587
|
+
...Object.values(ShipDimensions),
|
|
2588
|
+
...Object.values(ProjectDimensions)
|
|
2589
|
+
]);
|
|
2590
|
+
function lowercaseIdDimensionValues(properties) {
|
|
2591
|
+
let changed = false;
|
|
2592
|
+
const result = {
|
|
2593
|
+
...properties
|
|
2594
|
+
};
|
|
2595
|
+
for (const key of Object.keys(result)) {
|
|
2596
|
+
const value = result[key];
|
|
2597
|
+
if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
|
|
2598
|
+
continue;
|
|
2599
|
+
}
|
|
2600
|
+
const lowered = value.toLowerCase();
|
|
2601
|
+
if (lowered !== value) {
|
|
2602
|
+
result[key] = lowered;
|
|
2603
|
+
changed = true;
|
|
2604
|
+
}
|
|
2605
|
+
}
|
|
2606
|
+
return changed ? result : properties;
|
|
2607
|
+
}
|
|
2608
|
+
|
|
2609
|
+
// ../../common/src/telemetry/project-identity.ts
|
|
2610
|
+
function projectKey(id) {
|
|
2611
|
+
if (typeof id !== "string")
|
|
2612
|
+
return;
|
|
2613
|
+
const key = id.trim().toLowerCase().replaceAll("-", "");
|
|
2614
|
+
return /^[0-9a-f]{32}$/.test(key) ? key : undefined;
|
|
2615
|
+
}
|
|
2616
|
+
function projectIdentityProperties(identity) {
|
|
2617
|
+
const key = identity.id ? projectKey(identity.id) : undefined;
|
|
2618
|
+
return {
|
|
2619
|
+
[ProjectDimensions.ProjectIdentityStatus]: identity.status === "resolved" && !key ? "invalid" : identity.status,
|
|
2620
|
+
[ProjectDimensions.ProjectType]: identity.projectType,
|
|
2621
|
+
...identity.status === "resolved" && key ? {
|
|
2622
|
+
[ProjectDimensions.ProjectKey]: key
|
|
2623
|
+
} : {}
|
|
2624
|
+
};
|
|
2625
|
+
}
|
|
2626
|
+
var PROJECT_IDENTITY_LOOKUP_BUDGET_MS = 1000;
|
|
2627
|
+
async function withinProjectIdentityBudget(work, onTimeout) {
|
|
2628
|
+
work.catch(() => {
|
|
2629
|
+
return;
|
|
2630
|
+
});
|
|
2631
|
+
let timer;
|
|
2632
|
+
const expired = new Promise((resolve) => {
|
|
2633
|
+
timer = setTimeout(() => {
|
|
2634
|
+
onTimeout?.();
|
|
2635
|
+
resolve(undefined);
|
|
2636
|
+
}, PROJECT_IDENTITY_LOOKUP_BUDGET_MS);
|
|
2637
|
+
});
|
|
2638
|
+
try {
|
|
2639
|
+
return await Promise.race([work, expired]);
|
|
2640
|
+
} finally {
|
|
2641
|
+
clearTimeout(timer);
|
|
2642
|
+
}
|
|
2643
|
+
}
|
|
2644
|
+
|
|
2375
2645
|
// ../../common/src/telemetry/pseudonymize.ts
|
|
2376
2646
|
var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
|
|
2377
2647
|
var PSEUDONYM_HEX_LENGTH = 32;
|
|
@@ -2740,8 +3010,8 @@ function redactValueDetectors(value, maxLength = MAX_VALUE_LENGTH) {
|
|
|
2740
3010
|
return `${redactUrl(core)}${trailing}`;
|
|
2741
3011
|
});
|
|
2742
3012
|
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
2743
|
-
out = out.replace(UNC_PATH_PATTERN, (_match, before,
|
|
2744
|
-
const [core, trailing] = peelTrailingPunctuation(
|
|
3013
|
+
out = out.replace(UNC_PATH_PATTERN, (_match, before, path) => {
|
|
3014
|
+
const [core, trailing] = peelTrailingPunctuation(path);
|
|
2745
3015
|
return `${before}unc#${pseudonymize(core)}${trailing}`;
|
|
2746
3016
|
});
|
|
2747
3017
|
out = out.replace(EMAIL_PATTERN, (match) => `email#${pseudonymize(match)}`);
|
|
@@ -2835,6 +3105,8 @@ function redactProperty(name, value) {
|
|
|
2835
3105
|
if (isSensitiveName(name)) {
|
|
2836
3106
|
return REDACTED;
|
|
2837
3107
|
}
|
|
3108
|
+
if (GUID_KEY_DIMENSIONS.has(name))
|
|
3109
|
+
return projectKey(value);
|
|
2838
3110
|
if (typeof value === "boolean" || typeof value === "number") {
|
|
2839
3111
|
return value;
|
|
2840
3112
|
}
|
|
@@ -2909,6 +3181,63 @@ function settlePromiseLike(thenable) {
|
|
|
2909
3181
|
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
|
|
2910
3182
|
}
|
|
2911
3183
|
|
|
3184
|
+
// ../../common/src/error-codes.ts
|
|
3185
|
+
var CLI_ERROR_CODES = [
|
|
3186
|
+
"invalid_argument",
|
|
3187
|
+
"authentication_required",
|
|
3188
|
+
"permission_denied",
|
|
3189
|
+
"local_permission_denied",
|
|
3190
|
+
"not_found",
|
|
3191
|
+
"rate_limited",
|
|
3192
|
+
"network_error",
|
|
3193
|
+
"timeout",
|
|
3194
|
+
"server_error",
|
|
3195
|
+
"method_not_allowed",
|
|
3196
|
+
"not_supported",
|
|
3197
|
+
"configuration_error",
|
|
3198
|
+
"execution_failed",
|
|
3199
|
+
"unknown_error"
|
|
3200
|
+
];
|
|
3201
|
+
var RETRY_HINTS = [
|
|
3202
|
+
"RetryWillNotFix",
|
|
3203
|
+
"RetryLater",
|
|
3204
|
+
"RetryAfter1Second",
|
|
3205
|
+
"RetryAfter10Seconds",
|
|
3206
|
+
"RetryAfter30Seconds",
|
|
3207
|
+
"RetryAfter60Seconds"
|
|
3208
|
+
];
|
|
3209
|
+
var CLI_ERROR_CODE_VALUES = new Set(CLI_ERROR_CODES);
|
|
3210
|
+
var RETRY_HINT_VALUES = new Set(RETRY_HINTS);
|
|
3211
|
+
function isCliErrorCode(value) {
|
|
3212
|
+
return typeof value === "string" && CLI_ERROR_CODE_VALUES.has(value);
|
|
3213
|
+
}
|
|
3214
|
+
function isRetryHint(value) {
|
|
3215
|
+
return typeof value === "string" && RETRY_HINT_VALUES.has(value);
|
|
3216
|
+
}
|
|
3217
|
+
function carriedErrorCode(error) {
|
|
3218
|
+
if (!error || typeof error !== "object")
|
|
3219
|
+
return;
|
|
3220
|
+
const code = error.errorCode;
|
|
3221
|
+
return isCliErrorCode(code) ? code : undefined;
|
|
3222
|
+
}
|
|
3223
|
+
function carriedRetry(error) {
|
|
3224
|
+
if (!error || typeof error !== "object")
|
|
3225
|
+
return;
|
|
3226
|
+
const retry = error.retry;
|
|
3227
|
+
return isRetryHint(retry) ? retry : undefined;
|
|
3228
|
+
}
|
|
3229
|
+
function defaultRetryForErrorCode(errorCode) {
|
|
3230
|
+
switch (errorCode) {
|
|
3231
|
+
case "network_error":
|
|
3232
|
+
case "rate_limited":
|
|
3233
|
+
case "server_error":
|
|
3234
|
+
case "timeout":
|
|
3235
|
+
return "RetryLater";
|
|
3236
|
+
default:
|
|
3237
|
+
return "RetryWillNotFix";
|
|
3238
|
+
}
|
|
3239
|
+
}
|
|
3240
|
+
|
|
2912
3241
|
// ../../common/src/error-graph.ts
|
|
2913
3242
|
function* walkErrorGraph(error) {
|
|
2914
3243
|
const queue = [error];
|
|
@@ -2953,18 +3282,54 @@ function findHttpStatusInGraph(error) {
|
|
|
2953
3282
|
return;
|
|
2954
3283
|
}
|
|
2955
3284
|
|
|
2956
|
-
// ../../common/src/
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
3285
|
+
// ../../common/src/http-status.ts
|
|
3286
|
+
function classifyHttpStatus(status) {
|
|
3287
|
+
if (status === undefined)
|
|
3288
|
+
return;
|
|
3289
|
+
if (status === 400 || status === 409 || status === 413 || status === 422) {
|
|
3290
|
+
return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
|
|
3291
|
+
}
|
|
3292
|
+
if (status === 401) {
|
|
3293
|
+
return {
|
|
3294
|
+
errorCode: "authentication_required",
|
|
3295
|
+
retry: "RetryWillNotFix"
|
|
3296
|
+
};
|
|
3297
|
+
}
|
|
3298
|
+
if (status === 403) {
|
|
3299
|
+
return { errorCode: "permission_denied", retry: "RetryWillNotFix" };
|
|
3300
|
+
}
|
|
3301
|
+
if (status === 404) {
|
|
3302
|
+
return { errorCode: "not_found", retry: "RetryWillNotFix" };
|
|
3303
|
+
}
|
|
3304
|
+
if (status === 405) {
|
|
3305
|
+
return { errorCode: "method_not_allowed", retry: "RetryWillNotFix" };
|
|
3306
|
+
}
|
|
3307
|
+
if (status === 408) {
|
|
3308
|
+
return { errorCode: "timeout", retry: "RetryLater" };
|
|
3309
|
+
}
|
|
3310
|
+
if (status === 429) {
|
|
3311
|
+
return { errorCode: "rate_limited", retry: "RetryLater" };
|
|
3312
|
+
}
|
|
3313
|
+
if (status >= 500 && status < 600) {
|
|
3314
|
+
return { errorCode: "server_error", retry: "RetryLater" };
|
|
3315
|
+
}
|
|
3316
|
+
return;
|
|
3317
|
+
}
|
|
3318
|
+
|
|
3319
|
+
// ../../common/src/local-permission-codes.ts
|
|
3320
|
+
var LOCAL_PERMISSION_ERROR_CODES = new Set([
|
|
3321
|
+
"EACCES",
|
|
3322
|
+
"EPERM",
|
|
3323
|
+
"EROFS"
|
|
3324
|
+
]);
|
|
3325
|
+
|
|
3326
|
+
// ../../common/src/error-handler.ts
|
|
2964
3327
|
var DEFAULT_401 = "Unauthorized (401). The session is missing or expired, or its token carries no scope for this API. Run `uip login status --detailed` to see the session and its scopes.";
|
|
2965
3328
|
var DEFAULT_403 = "Forbidden (403). The account lacks permission for this operation, or the token carries no scope for this API. Run `uip login status --detailed` to see the token's scopes.";
|
|
2966
3329
|
var DEFAULT_405 = "Method Not Allowed (405). The endpoint may not exist or the base URL may be incorrect.";
|
|
2967
3330
|
var DEFAULT_413 = "Payload too large (413). The upload exceeded the server or CDN size limit. Reduce the package size — for example, exclude unused dependencies or remove large files from the project — and try again.";
|
|
3331
|
+
var CLOUDFLARE_BLOCK_403 = "Forbidden (403) by Cloudflare, in front of the service: the answer is a Cloudflare HTML page, not the service's JSON, so the service did not see the request and did not check the account's roles or the token's scopes. Cloudflare blocks a request when its content matches a firewall rule (text that looks like SQL or script code, for example) or when it comes from a network the firewall does not allow.";
|
|
3332
|
+
var CLOUDFLARE_BLOCK_403_INSTRUCTIONS = "If the request carries text that looks like code, change that text and try again. Otherwise send the time of the request and the Cloudflare Ray ID, when the message gives one, to the owner of the service or UiPath support.";
|
|
2968
3333
|
var HTML_RESPONSE_MESSAGE = "Received HTML instead of the expected JSON response.";
|
|
2969
3334
|
var NETWORK_ERROR_CODES = new Set([
|
|
2970
3335
|
"ECONNREFUSED",
|
|
@@ -2990,8 +3355,8 @@ var TLS_ERROR_CODES = new Set([
|
|
|
2990
3355
|
var TLS_INSTRUCTIONS = "The server's TLS certificate could not be verified. Most often a " + "corporate proxy/firewall re-signs HTTPS with a root CA that Node does " + "not trust — set NODE_EXTRA_CA_CERTS to that CA's PEM file (and HTTPS_PROXY " + "if you connect through a proxy). If the certificate is instead expired or " + "its hostname does not match, fix the endpoint URL or the system clock. " + "Then retry.";
|
|
2991
3356
|
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.";
|
|
2992
3357
|
var LOCAL_PERMISSION_MESSAGE_PATTERN = new RegExp(`\\b(${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})\\b`);
|
|
2993
|
-
function localPermissionInstructions(code,
|
|
2994
|
-
const target =
|
|
3358
|
+
function localPermissionInstructions(code, path) {
|
|
3359
|
+
const target = path !== undefined ? `'${path}'` : "a local file or resource";
|
|
2995
3360
|
if (code === "EROFS") {
|
|
2996
3361
|
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.";
|
|
2997
3362
|
}
|
|
@@ -3028,12 +3393,12 @@ function describePermissionError(error) {
|
|
|
3028
3393
|
const code = matchLocalPermissionCode(cur.code, message);
|
|
3029
3394
|
if (!code)
|
|
3030
3395
|
continue;
|
|
3031
|
-
const
|
|
3396
|
+
const path = localPermissionPath(cur.path, message);
|
|
3032
3397
|
return {
|
|
3033
3398
|
code,
|
|
3034
3399
|
message: message ?? code,
|
|
3035
|
-
...
|
|
3036
|
-
instructions: localPermissionInstructions(code,
|
|
3400
|
+
...path !== undefined ? { path } : {},
|
|
3401
|
+
instructions: localPermissionInstructions(code, path)
|
|
3037
3402
|
};
|
|
3038
3403
|
}
|
|
3039
3404
|
return;
|
|
@@ -3045,11 +3410,25 @@ function matchLocalPermissionCode(code, message) {
|
|
|
3045
3410
|
const match = message ? LOCAL_PERMISSION_MESSAGE_PATTERN.exec(message) : null;
|
|
3046
3411
|
return match ? match[1] : undefined;
|
|
3047
3412
|
}
|
|
3048
|
-
function localPermissionPath(
|
|
3049
|
-
if (typeof
|
|
3050
|
-
return
|
|
3413
|
+
function localPermissionPath(path, message) {
|
|
3414
|
+
if (typeof path === "string")
|
|
3415
|
+
return path;
|
|
3051
3416
|
return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
|
|
3052
3417
|
}
|
|
3418
|
+
function readHeader(response, name) {
|
|
3419
|
+
const headers = response?.headers;
|
|
3420
|
+
if (!headers || typeof headers !== "object")
|
|
3421
|
+
return;
|
|
3422
|
+
if (typeof headers.get === "function") {
|
|
3423
|
+
const value = headers.get(name);
|
|
3424
|
+
if (value)
|
|
3425
|
+
return value;
|
|
3426
|
+
}
|
|
3427
|
+
const plain = headers;
|
|
3428
|
+
const key = Object.keys(plain).find((k) => k.toLowerCase() === name.toLowerCase());
|
|
3429
|
+
const value = key === undefined ? undefined : plain[key];
|
|
3430
|
+
return typeof value === "string" && value !== "" ? value : undefined;
|
|
3431
|
+
}
|
|
3053
3432
|
function isHtmlDocument(body) {
|
|
3054
3433
|
return /^\s*(<!doctype html|<html\b)/i.test(body);
|
|
3055
3434
|
}
|
|
@@ -3066,36 +3445,9 @@ function retryHintForRetryAfter(seconds) {
|
|
|
3066
3445
|
return "RetryAfter60Seconds";
|
|
3067
3446
|
}
|
|
3068
3447
|
function classifyError(status, error) {
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
if (status === 401) {
|
|
3073
|
-
return {
|
|
3074
|
-
errorCode: "authentication_required",
|
|
3075
|
-
retry: "RetryWillNotFix"
|
|
3076
|
-
};
|
|
3077
|
-
}
|
|
3078
|
-
if (status === 403) {
|
|
3079
|
-
return { errorCode: "permission_denied", retry: "RetryWillNotFix" };
|
|
3080
|
-
}
|
|
3081
|
-
if (status === 404) {
|
|
3082
|
-
return { errorCode: "not_found", retry: "RetryWillNotFix" };
|
|
3083
|
-
}
|
|
3084
|
-
if (status === 405) {
|
|
3085
|
-
return { errorCode: "method_not_allowed", retry: "RetryWillNotFix" };
|
|
3086
|
-
}
|
|
3087
|
-
if (status === 413) {
|
|
3088
|
-
return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
|
|
3089
|
-
}
|
|
3090
|
-
if (status === 408) {
|
|
3091
|
-
return { errorCode: "timeout", retry: "RetryLater" };
|
|
3092
|
-
}
|
|
3093
|
-
if (status === 429) {
|
|
3094
|
-
return { errorCode: "rate_limited", retry: "RetryLater" };
|
|
3095
|
-
}
|
|
3096
|
-
if (status !== undefined && status >= 500 && status < 600) {
|
|
3097
|
-
return { errorCode: "server_error", retry: "RetryLater" };
|
|
3098
|
-
}
|
|
3448
|
+
const byStatus = classifyHttpStatus(status);
|
|
3449
|
+
if (byStatus)
|
|
3450
|
+
return byStatus;
|
|
3099
3451
|
if (status === undefined && describePermissionError(error)) {
|
|
3100
3452
|
return {
|
|
3101
3453
|
errorCode: "local_permission_denied",
|
|
@@ -3111,6 +3463,17 @@ function classifyError(status, error) {
|
|
|
3111
3463
|
}
|
|
3112
3464
|
return { errorCode: "unknown_error", retry: "RetryWillNotFix" };
|
|
3113
3465
|
}
|
|
3466
|
+
function withCarriedClass(inferred, error) {
|
|
3467
|
+
const errorCode = carriedErrorCode(error);
|
|
3468
|
+
const retry = carriedRetry(error);
|
|
3469
|
+
if (errorCode === undefined || errorCode === inferred.errorCode) {
|
|
3470
|
+
return {
|
|
3471
|
+
errorCode: inferred.errorCode,
|
|
3472
|
+
retry: retry ?? inferred.retry
|
|
3473
|
+
};
|
|
3474
|
+
}
|
|
3475
|
+
return { errorCode, retry: retry ?? defaultRetryForErrorCode(errorCode) };
|
|
3476
|
+
}
|
|
3114
3477
|
function formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus) {
|
|
3115
3478
|
if (extractedMessage) {
|
|
3116
3479
|
return `HTTP ${status}: ${extractedMessage}`;
|
|
@@ -3166,9 +3529,14 @@ async function extractErrorDetails(error, options) {
|
|
|
3166
3529
|
const classificationStatus = status ?? findHttpStatusInGraph(error);
|
|
3167
3530
|
const classification = classifyError(classificationStatus, error);
|
|
3168
3531
|
let retry = classification.retry;
|
|
3532
|
+
const htmlForbidden = status === 403 && rawBody !== undefined && isHtmlDocument(rawBody);
|
|
3533
|
+
const rayId = htmlForbidden ? readHeader(response, "cf-ray") : undefined;
|
|
3534
|
+
const cloudflareBlock = htmlForbidden && (rayId !== undefined || /\bcloudflare\b/i.test(readHeader(response, "server") ?? ""));
|
|
3169
3535
|
if (status === 401) {
|
|
3170
3536
|
message = DEFAULT_401;
|
|
3171
3537
|
result = "AuthenticationError";
|
|
3538
|
+
} else if (cloudflareBlock) {
|
|
3539
|
+
message = rayId ? `${CLOUDFLARE_BLOCK_403} Cloudflare Ray ID: ${rayId}.` : CLOUDFLARE_BLOCK_403;
|
|
3172
3540
|
} else if (status === 403) {
|
|
3173
3541
|
message = options?.forbiddenMessage ?? DEFAULT_403;
|
|
3174
3542
|
result = "AuthenticationError";
|
|
@@ -3216,7 +3584,9 @@ async function extractErrorDetails(error, options) {
|
|
|
3216
3584
|
}
|
|
3217
3585
|
}
|
|
3218
3586
|
let details = rawMessage;
|
|
3219
|
-
if (
|
|
3587
|
+
if (htmlForbidden) {
|
|
3588
|
+
details = cloudflareBlock ? CLOUDFLARE_BLOCK_403_INSTRUCTIONS : HTML_RESPONSE_MESSAGE;
|
|
3589
|
+
} else if (rawBody) {
|
|
3220
3590
|
if (parsedBody) {
|
|
3221
3591
|
const extra = {};
|
|
3222
3592
|
if (parsedBody.errorCode)
|
|
@@ -3250,6 +3620,8 @@ async function extractErrorDetails(error, options) {
|
|
|
3250
3620
|
}
|
|
3251
3621
|
if (parsedBody?.requestId && typeof parsedBody.requestId === "string") {
|
|
3252
3622
|
context.requestId = parsedBody.requestId;
|
|
3623
|
+
} else if (cloudflareBlock && rayId) {
|
|
3624
|
+
context.requestId = rayId;
|
|
3253
3625
|
}
|
|
3254
3626
|
if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
|
|
3255
3627
|
context.traceId = parsedBody.traceId;
|
|
@@ -3258,16 +3630,7 @@ async function extractErrorDetails(error, options) {
|
|
|
3258
3630
|
context.path = permission.path;
|
|
3259
3631
|
}
|
|
3260
3632
|
if (status === 429) {
|
|
3261
|
-
const
|
|
3262
|
-
const headersObj = resp?.headers;
|
|
3263
|
-
let retryAfterValue;
|
|
3264
|
-
if (headersObj && typeof headersObj === "object" && typeof headersObj.get === "function") {
|
|
3265
|
-
retryAfterValue = headersObj.get("retry-after") ?? undefined;
|
|
3266
|
-
}
|
|
3267
|
-
if (!retryAfterValue && headersObj && typeof headersObj === "object") {
|
|
3268
|
-
const headers = headersObj;
|
|
3269
|
-
retryAfterValue = headers["retry-after"] ?? headers["Retry-After"];
|
|
3270
|
-
}
|
|
3633
|
+
const retryAfterValue = readHeader(response, "retry-after");
|
|
3271
3634
|
if (retryAfterValue) {
|
|
3272
3635
|
const seconds = Number(retryAfterValue);
|
|
3273
3636
|
if (!Number.isNaN(seconds)) {
|
|
@@ -3301,9 +3664,8 @@ async function extractErrorDetails(error, options) {
|
|
|
3301
3664
|
}
|
|
3302
3665
|
return {
|
|
3303
3666
|
result,
|
|
3304
|
-
errorCode: classification.errorCode,
|
|
3667
|
+
...withCarriedClass({ errorCode: classification.errorCode, retry }, error),
|
|
3305
3668
|
message,
|
|
3306
|
-
retry,
|
|
3307
3669
|
details,
|
|
3308
3670
|
...hasContext ? { context } : {},
|
|
3309
3671
|
...parsedErrors ? { parsedErrors } : {}
|
|
@@ -3313,10 +3675,183 @@ async function extractErrorMessage(error, options) {
|
|
|
3313
3675
|
const { message } = await extractErrorDetails(error, options);
|
|
3314
3676
|
return message;
|
|
3315
3677
|
}
|
|
3316
|
-
// ../../common/src/
|
|
3317
|
-
function
|
|
3318
|
-
|
|
3678
|
+
// ../../common/src/error-instructions.ts
|
|
3679
|
+
function extractHttpStatus(err) {
|
|
3680
|
+
if (!err || typeof err !== "object")
|
|
3681
|
+
return;
|
|
3682
|
+
const e = err;
|
|
3683
|
+
const structured = e.response?.status ?? e.status ?? e.statusCode;
|
|
3684
|
+
if (structured !== undefined)
|
|
3685
|
+
return structured;
|
|
3686
|
+
return typeof e.message === "string" ? parseHttpStatusFromMessage(e.message) : undefined;
|
|
3687
|
+
}
|
|
3688
|
+
var GENERIC = "Check authentication and parameters";
|
|
3689
|
+
function hasIdentityInstructionContext(err) {
|
|
3690
|
+
return err !== null && typeof err === "object" && "instructionContext" in err && err.instructionContext === "identity";
|
|
3691
|
+
}
|
|
3692
|
+
function instructionsFor(ctx, err) {
|
|
3693
|
+
if (ctx === "auth" && hasIdentityInstructionContext(err)) {
|
|
3694
|
+
return instructionsFor("identity");
|
|
3695
|
+
}
|
|
3696
|
+
switch (ctx) {
|
|
3697
|
+
case "auth":
|
|
3698
|
+
return "Run 'uip login' to authenticate. To inspect the current session, run 'uip whoami'.";
|
|
3699
|
+
case "auth-configuration":
|
|
3700
|
+
return "Fix the authentication settings named in Message, then retry.";
|
|
3701
|
+
case "identity":
|
|
3702
|
+
return "Select an active tenant with 'uip login tenant set <tenant>' and ensure your login includes an organization";
|
|
3703
|
+
case "input-parse":
|
|
3704
|
+
return "Ensure --inputs is valid JSON or pipe JSON via stdin";
|
|
3705
|
+
case "input-validate":
|
|
3706
|
+
return "Fix the flagged input fields to match the process's input schema";
|
|
3707
|
+
case "flag-format":
|
|
3708
|
+
return "Check the flag value format — see --help for the expected shape";
|
|
3709
|
+
case "permissions":
|
|
3710
|
+
return "Confirm your user has the required permissions in this folder/tenant, or re-authenticate with 'uip login' if your session has lapsed";
|
|
3711
|
+
case "backend": {
|
|
3712
|
+
const status = extractHttpStatus(err);
|
|
3713
|
+
if (status === 401) {
|
|
3714
|
+
return "Re-authenticate with 'uip login' — your session is invalid or expired";
|
|
3715
|
+
}
|
|
3716
|
+
if (status === 403) {
|
|
3717
|
+
return "Confirm your user has access to the resource, and the required permissions in this folder or tenant";
|
|
3718
|
+
}
|
|
3719
|
+
if (status === 404) {
|
|
3720
|
+
return "Verify the resource exists in the current folder/tenant";
|
|
3721
|
+
}
|
|
3722
|
+
if (status === 400 || status === 422) {
|
|
3723
|
+
return "Request was rejected — check flag values and inputs";
|
|
3724
|
+
}
|
|
3725
|
+
if (status === 405) {
|
|
3726
|
+
return "Check the command name and the base URL in use — the endpoint may not exist";
|
|
3727
|
+
}
|
|
3728
|
+
if (status === 408) {
|
|
3729
|
+
return "The request timed out — retry; if it persists, narrow the request (e.g. --limit on list commands)";
|
|
3730
|
+
}
|
|
3731
|
+
if (status === 409) {
|
|
3732
|
+
return "The resource already exists, or changed since it was read — list it to see the current state";
|
|
3733
|
+
}
|
|
3734
|
+
if (status === 413) {
|
|
3735
|
+
return "The upload is over the size limit — exclude unused dependencies or drop large files, then retry";
|
|
3736
|
+
}
|
|
3737
|
+
if (status === 429) {
|
|
3738
|
+
return "Rate limit reached — wait and retry; when the service suggests a delay, Retry and Context.retryAfter carry it";
|
|
3739
|
+
}
|
|
3740
|
+
if (status !== undefined && status >= 500 && status < 600) {
|
|
3741
|
+
return "The service returned a server error — retry; if it persists, check service status";
|
|
3742
|
+
}
|
|
3743
|
+
const permission = describePermissionError(err);
|
|
3744
|
+
if (permission) {
|
|
3745
|
+
return permission.instructions;
|
|
3746
|
+
}
|
|
3747
|
+
const connectivity = describeConnectivityError(err);
|
|
3748
|
+
if (connectivity) {
|
|
3749
|
+
return connectivity.instructions;
|
|
3750
|
+
}
|
|
3751
|
+
return GENERIC;
|
|
3752
|
+
}
|
|
3753
|
+
}
|
|
3754
|
+
}
|
|
3755
|
+
|
|
3756
|
+
// ../../common/src/result-types.ts
|
|
3757
|
+
var RESULTS = {
|
|
3758
|
+
Success: "Success",
|
|
3759
|
+
Failure: "Failure",
|
|
3760
|
+
ConfigError: "ConfigError",
|
|
3761
|
+
AuthenticationError: "AuthenticationError",
|
|
3762
|
+
ValidationError: "ValidationError",
|
|
3763
|
+
TimeoutError: "TimeoutError"
|
|
3764
|
+
};
|
|
3765
|
+
|
|
3766
|
+
// ../../common/src/classified-failure.ts
|
|
3767
|
+
async function authContextFailure(error, sessionInstructions) {
|
|
3768
|
+
const details = await extractErrorDetails(error);
|
|
3769
|
+
const missingIdentity = hasIdentityInstructionContext(error);
|
|
3770
|
+
return {
|
|
3771
|
+
Result: details.errorCode === "configuration_error" ? RESULTS.ConfigError : details.errorCode === "authentication_required" ? RESULTS.AuthenticationError : details.result,
|
|
3772
|
+
ErrorCode: details.errorCode,
|
|
3773
|
+
Message: details.message,
|
|
3774
|
+
Instructions: details.errorCode === "configuration_error" ? instructionsFor("auth-configuration") : details.errorCode === "authentication_required" && !missingIdentity && sessionInstructions !== undefined ? sessionInstructions : instructionsFor(details.errorCode === "authentication_required" ? "auth" : "backend", error),
|
|
3775
|
+
Retry: details.retry,
|
|
3776
|
+
...details.context ? { Context: details.context } : {}
|
|
3777
|
+
};
|
|
3319
3778
|
}
|
|
3779
|
+
// ../../../node_modules/commander/index.js
|
|
3780
|
+
var exports_commander = {};
|
|
3781
|
+
__exportCjs(exports_commander, {
|
|
3782
|
+
program: () => $program,
|
|
3783
|
+
createCommand: () => $createCommand,
|
|
3784
|
+
createOption: () => $createOption,
|
|
3785
|
+
createArgument: () => $createArgument,
|
|
3786
|
+
Command: () => $Command,
|
|
3787
|
+
Option: () => $Option,
|
|
3788
|
+
Argument: () => $Argument,
|
|
3789
|
+
Help: () => $Help,
|
|
3790
|
+
CommanderError: () => $CommanderError,
|
|
3791
|
+
InvalidArgumentError: () => $InvalidArgumentError,
|
|
3792
|
+
InvalidOptionArgumentError: () => $InvalidOptionArgumentError
|
|
3793
|
+
}, {
|
|
3794
|
+
program: (value) => $program = value,
|
|
3795
|
+
createCommand: (value) => $createCommand = value,
|
|
3796
|
+
createOption: (value) => $createOption = value,
|
|
3797
|
+
createArgument: (value) => $createArgument = value,
|
|
3798
|
+
Command: (value) => $Command = value,
|
|
3799
|
+
Option: (value) => $Option = value,
|
|
3800
|
+
Argument: (value) => $Argument = value,
|
|
3801
|
+
Help: (value) => $Help = value,
|
|
3802
|
+
CommanderError: (value) => $CommanderError = value,
|
|
3803
|
+
InvalidArgumentError: (value) => $InvalidArgumentError = value,
|
|
3804
|
+
InvalidOptionArgumentError: (value) => $InvalidOptionArgumentError = value
|
|
3805
|
+
});
|
|
3806
|
+
var { Argument } = require_argument();
|
|
3807
|
+
var { Command } = require_command();
|
|
3808
|
+
var { CommanderError, InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
3809
|
+
var { Help } = require_help();
|
|
3810
|
+
var { Option: Option2 } = require_option();
|
|
3811
|
+
var $program = new Command;
|
|
3812
|
+
var $createCommand = (name) => new Command(name);
|
|
3813
|
+
var $createOption = (flags, description) => new Option2(flags, description);
|
|
3814
|
+
var $createArgument = (name, description) => new Argument(name, description);
|
|
3815
|
+
var $Command = Command;
|
|
3816
|
+
var $Option = Option2;
|
|
3817
|
+
var $Argument = Argument;
|
|
3818
|
+
var $Help = Help;
|
|
3819
|
+
var $CommanderError = CommanderError;
|
|
3820
|
+
var $InvalidArgumentError = InvalidArgumentError2;
|
|
3821
|
+
var $InvalidOptionArgumentError = InvalidArgumentError2;
|
|
3822
|
+
|
|
3823
|
+
// ../../../node_modules/commander/esm.mjs
|
|
3824
|
+
var {
|
|
3825
|
+
program,
|
|
3826
|
+
createCommand,
|
|
3827
|
+
createArgument,
|
|
3828
|
+
createOption,
|
|
3829
|
+
CommanderError: CommanderError2,
|
|
3830
|
+
InvalidArgumentError,
|
|
3831
|
+
InvalidOptionArgumentError,
|
|
3832
|
+
Command: Command2,
|
|
3833
|
+
Argument: Argument2,
|
|
3834
|
+
Option,
|
|
3835
|
+
Help: Help2
|
|
3836
|
+
} = exports_commander;
|
|
3837
|
+
|
|
3838
|
+
// ../../common/src/command-examples.ts
|
|
3839
|
+
var examplesByCommand = new WeakMap;
|
|
3840
|
+
Command2.prototype.examples = function(examples) {
|
|
3841
|
+
examplesByCommand.set(this, examples);
|
|
3842
|
+
return this;
|
|
3843
|
+
};
|
|
3844
|
+
// ../../common/src/preview.ts
|
|
3845
|
+
var previewSlot = singleton("PreviewBuild");
|
|
3846
|
+
function isPreviewBuild() {
|
|
3847
|
+
return previewSlot.get(false) ?? false;
|
|
3848
|
+
}
|
|
3849
|
+
Command2.prototype.previewCommand = function(nameAndArgs, opts) {
|
|
3850
|
+
if (isPreviewBuild()) {
|
|
3851
|
+
return this.command(nameAndArgs, opts);
|
|
3852
|
+
}
|
|
3853
|
+
return new Command2(nameAndArgs.split(/\s+/)[0] ?? nameAndArgs);
|
|
3854
|
+
};
|
|
3320
3855
|
|
|
3321
3856
|
// ../../common/src/output-context.ts
|
|
3322
3857
|
function createStorage() {
|
|
@@ -3351,8 +3886,8 @@ function getOutputSink() {
|
|
|
3351
3886
|
|
|
3352
3887
|
// ../../common/src/logger.ts
|
|
3353
3888
|
var logFilePathSlot = singleton("logFilePath");
|
|
3354
|
-
function setGlobalLogFilePath(
|
|
3355
|
-
logFilePathSlot.set(
|
|
3889
|
+
function setGlobalLogFilePath(path) {
|
|
3890
|
+
logFilePathSlot.set(path);
|
|
3356
3891
|
}
|
|
3357
3892
|
function getGlobalLogFilePath() {
|
|
3358
3893
|
return logFilePathSlot.get("");
|
|
@@ -3420,14 +3955,14 @@ class SimpleLogger {
|
|
|
3420
3955
|
return this.fileLoggingEnabled || !!getGlobalLogFilePath();
|
|
3421
3956
|
}
|
|
3422
3957
|
writeToFile(formatted) {
|
|
3423
|
-
const
|
|
3424
|
-
if (!
|
|
3958
|
+
const path = this.logFilePath || getGlobalLogFilePath();
|
|
3959
|
+
if (!path)
|
|
3425
3960
|
return;
|
|
3426
3961
|
const timestamp = new Date().toISOString();
|
|
3427
3962
|
this.pendingWrites = Promise.all([
|
|
3428
3963
|
this.pendingWrites,
|
|
3429
3964
|
this.pendingInit
|
|
3430
|
-
]).then(() => getFileSystem().appendFile(
|
|
3965
|
+
]).then(() => getFileSystem().appendFile(path, `${timestamp} ${formatted}`).catch(() => {}));
|
|
3431
3966
|
}
|
|
3432
3967
|
write(formatted) {
|
|
3433
3968
|
if (this.isFileLoggingActive()) {
|
|
@@ -3477,17 +4012,17 @@ class SimpleLogger {
|
|
|
3477
4012
|
setGlobalLogFilePath("");
|
|
3478
4013
|
}
|
|
3479
4014
|
}
|
|
3480
|
-
setLogFile(
|
|
3481
|
-
this.logFilePath =
|
|
3482
|
-
setGlobalLogFilePath(
|
|
3483
|
-
if (!
|
|
4015
|
+
setLogFile(path) {
|
|
4016
|
+
this.logFilePath = path;
|
|
4017
|
+
setGlobalLogFilePath(path);
|
|
4018
|
+
if (!path)
|
|
3484
4019
|
return;
|
|
3485
4020
|
this.fileLoggingEnabled = true;
|
|
3486
|
-
const
|
|
4021
|
+
const fs = getFileSystem();
|
|
3487
4022
|
this.pendingInit = (async () => {
|
|
3488
4023
|
const [error] = await catchError((async () => {
|
|
3489
|
-
await
|
|
3490
|
-
await
|
|
4024
|
+
await fs.mkdir(fs.path.dirname(path));
|
|
4025
|
+
await fs.writeFile(path, "");
|
|
3491
4026
|
})());
|
|
3492
4027
|
if (error)
|
|
3493
4028
|
this.fileLoggingEnabled = false;
|
|
@@ -3529,10 +4064,103 @@ class SimpleLogger {
|
|
|
3529
4064
|
}
|
|
3530
4065
|
};
|
|
3531
4066
|
}
|
|
3532
|
-
var loggerSingleton = singleton(SimpleLogger);
|
|
3533
|
-
var logger = SimpleLogger.getInstance();
|
|
3534
|
-
function getLogFilePath() {
|
|
3535
|
-
return logger.getLogFilePath();
|
|
4067
|
+
var loggerSingleton = singleton(SimpleLogger);
|
|
4068
|
+
var logger = SimpleLogger.getInstance();
|
|
4069
|
+
function getLogFilePath() {
|
|
4070
|
+
return logger.getLogFilePath();
|
|
4071
|
+
}
|
|
4072
|
+
|
|
4073
|
+
// ../../common/src/timings.ts
|
|
4074
|
+
var TIMINGS_ENV_VAR = "UIP_TIMINGS";
|
|
4075
|
+
function createStorage2() {
|
|
4076
|
+
const [error, mod] = catchError(() => __require("node:async_hooks"));
|
|
4077
|
+
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
4078
|
+
return {
|
|
4079
|
+
getStore: () => {
|
|
4080
|
+
return;
|
|
4081
|
+
},
|
|
4082
|
+
run: (_store, fn) => fn()
|
|
4083
|
+
};
|
|
4084
|
+
}
|
|
4085
|
+
return new mod.AsyncLocalStorage;
|
|
4086
|
+
}
|
|
4087
|
+
var storageSlot = singleton("TimingStorage");
|
|
4088
|
+
var stateSlot = singleton("Timings");
|
|
4089
|
+
var rootStartedSlot = singleton("TimingsRootStarted");
|
|
4090
|
+
var longLivedHostSlot = singleton("TimingsLongLivedHost");
|
|
4091
|
+
var storage = storageSlot.getOrInit(createStorage2, (value) => ("getStore" in value));
|
|
4092
|
+
function newState(baseline) {
|
|
4093
|
+
return { baseline, httpMs: 0, httpCalls: 0 };
|
|
4094
|
+
}
|
|
4095
|
+
function getState() {
|
|
4096
|
+
const scoped = storage.getStore();
|
|
4097
|
+
if (scoped) {
|
|
4098
|
+
return scoped;
|
|
4099
|
+
}
|
|
4100
|
+
const pinned = livePinnedState();
|
|
4101
|
+
if (pinned !== undefined) {
|
|
4102
|
+
return pinned;
|
|
4103
|
+
}
|
|
4104
|
+
return newState(processStartIsInvocationStart() ? 0 : performance.now());
|
|
4105
|
+
}
|
|
4106
|
+
function livePinnedState() {
|
|
4107
|
+
const pinned = stateSlot.get();
|
|
4108
|
+
return pinned !== undefined && "httpCalls" in pinned && !pinned.finished ? pinned : undefined;
|
|
4109
|
+
}
|
|
4110
|
+
function processStartIsInvocationStart() {
|
|
4111
|
+
return !rootStartedSlot.get(false) && !longLivedHostSlot.get(false);
|
|
4112
|
+
}
|
|
4113
|
+
function timingsEnabled() {
|
|
4114
|
+
if (typeof process === "undefined") {
|
|
4115
|
+
return false;
|
|
4116
|
+
}
|
|
4117
|
+
const value = process.env?.[TIMINGS_ENV_VAR];
|
|
4118
|
+
if (value === undefined) {
|
|
4119
|
+
return false;
|
|
4120
|
+
}
|
|
4121
|
+
const normalized = value.trim().toLowerCase();
|
|
4122
|
+
return normalized === "1" || normalized === "true";
|
|
4123
|
+
}
|
|
4124
|
+
function recordExitCode(exitCode) {
|
|
4125
|
+
if (!timingsEnabled()) {
|
|
4126
|
+
return;
|
|
4127
|
+
}
|
|
4128
|
+
getState().exitCode = exitCode;
|
|
4129
|
+
}
|
|
4130
|
+
function invocationStartedAt() {
|
|
4131
|
+
return new Date(performance.timeOrigin + getState().baseline);
|
|
4132
|
+
}
|
|
4133
|
+
function invocationElapsedMs() {
|
|
4134
|
+
return performance.now() - getState().baseline;
|
|
4135
|
+
}
|
|
4136
|
+
function markCommandStart() {
|
|
4137
|
+
if (!timingsEnabled()) {
|
|
4138
|
+
return;
|
|
4139
|
+
}
|
|
4140
|
+
getState().commandStart = performance.now();
|
|
4141
|
+
}
|
|
4142
|
+
function recordCommandDuration(durationMs) {
|
|
4143
|
+
if (!timingsEnabled()) {
|
|
4144
|
+
return;
|
|
4145
|
+
}
|
|
4146
|
+
getState().commandMs = durationMs;
|
|
4147
|
+
}
|
|
4148
|
+
|
|
4149
|
+
// ../../common/src/exit-code.ts
|
|
4150
|
+
function setExitCode(code) {
|
|
4151
|
+
process.exitCode = code;
|
|
4152
|
+
recordExitCode(code);
|
|
4153
|
+
}
|
|
4154
|
+
var GENERIC_FAILURE_EXIT_CODE = 1;
|
|
4155
|
+
function recordCommandExit(code) {
|
|
4156
|
+
if (code === GENERIC_FAILURE_EXIT_CODE && getExitCode() !== 0) {
|
|
4157
|
+
return;
|
|
4158
|
+
}
|
|
4159
|
+
setExitCode(code);
|
|
4160
|
+
}
|
|
4161
|
+
function getExitCode() {
|
|
4162
|
+
const code = process.exitCode;
|
|
4163
|
+
return typeof code === "number" ? code : 0;
|
|
3536
4164
|
}
|
|
3537
4165
|
|
|
3538
4166
|
// ../../common/src/output-codecs.ts
|
|
@@ -3541,12 +4169,12 @@ var jmespathSlot = singleton("JmespathCodec");
|
|
|
3541
4169
|
async function loadOutputCodecsAsync(needed) {
|
|
3542
4170
|
const loads = [];
|
|
3543
4171
|
if (needed.yaml && yamlSlot.get() === undefined) {
|
|
3544
|
-
loads.push(import("./js-yaml-
|
|
4172
|
+
loads.push(import("./js-yaml-cr6n3g9w.js").then((mod) => {
|
|
3545
4173
|
yamlSlot.set(mod);
|
|
3546
4174
|
}));
|
|
3547
4175
|
}
|
|
3548
4176
|
if (needed.filter && jmespathSlot.get() === undefined) {
|
|
3549
|
-
loads.push(import("./jmespath-
|
|
4177
|
+
loads.push(import("./jmespath-z30y456m.js").then((m)=>__toESM(m.default,1)).then((mod) => {
|
|
3550
4178
|
jmespathSlot.set(mod);
|
|
3551
4179
|
}));
|
|
3552
4180
|
}
|
|
@@ -3571,155 +4199,6 @@ function getOutputFilter() {
|
|
|
3571
4199
|
return filterSlot.get();
|
|
3572
4200
|
}
|
|
3573
4201
|
|
|
3574
|
-
// ../../common/src/telemetry/telemetry-dimensions.ts
|
|
3575
|
-
var BaseDimensions = {
|
|
3576
|
-
ApplicationName: "ApplicationName",
|
|
3577
|
-
ProductVersion: "ProductVersion",
|
|
3578
|
-
InstallationId: "InstallationId",
|
|
3579
|
-
CloudUserId: "CloudUserId",
|
|
3580
|
-
CloudTenantId: "CloudTenantId",
|
|
3581
|
-
CloudOrganizationId: "CloudOrganizationId",
|
|
3582
|
-
IsInternalUser: "IsInternalUser",
|
|
3583
|
-
Environment: "Environment",
|
|
3584
|
-
BaseUrl: "BaseUrl",
|
|
3585
|
-
Region: "Region",
|
|
3586
|
-
Agent: "Agent",
|
|
3587
|
-
AgentVersion: "AgentVersion",
|
|
3588
|
-
AgentModel: "AgentModel",
|
|
3589
|
-
ToolName: "ToolName",
|
|
3590
|
-
ToolVersion: "ToolVersion",
|
|
3591
|
-
ExecutionContext: "ExecutionContext",
|
|
3592
|
-
CiProvider: "CiProvider",
|
|
3593
|
-
SessionIdSource: "SessionIdSource",
|
|
3594
|
-
SessionId: "SessionId"
|
|
3595
|
-
};
|
|
3596
|
-
var CommandDimensions = {
|
|
3597
|
-
IsCommand: "IsCommand",
|
|
3598
|
-
IsReexec: "IsReexec",
|
|
3599
|
-
CommandName: "CommandName",
|
|
3600
|
-
ExitCode: "ExitCode",
|
|
3601
|
-
TerminalOutcome: "TerminalOutcome",
|
|
3602
|
-
ErrorClass: "ErrorClass",
|
|
3603
|
-
TerminalSignal: "TerminalSignal",
|
|
3604
|
-
ErrorMessage: "ErrorMessage",
|
|
3605
|
-
SkillName: "SkillName",
|
|
3606
|
-
ProductArea: "ProductArea",
|
|
3607
|
-
Mode: "Mode"
|
|
3608
|
-
};
|
|
3609
|
-
var ShipDimensions = {
|
|
3610
|
-
ShipKind: "ShipKind",
|
|
3611
|
-
Target: "Target",
|
|
3612
|
-
ProjectType: "ProjectType",
|
|
3613
|
-
ProjectTypes: "ProjectTypes",
|
|
3614
|
-
ArtifactCorrelationKey: "ArtifactCorrelationKey",
|
|
3615
|
-
PackageName: "PackageName",
|
|
3616
|
-
PackageVersion: "PackageVersion",
|
|
3617
|
-
PackageVersionKey: "PackageVersionKey",
|
|
3618
|
-
DeploymentKey: "DeploymentKey",
|
|
3619
|
-
SolutionId: "SolutionId",
|
|
3620
|
-
FolderKey: "FolderKey",
|
|
3621
|
-
FeedId: "FeedId"
|
|
3622
|
-
};
|
|
3623
|
-
var ErrorDimensions = {
|
|
3624
|
-
Result: "Result",
|
|
3625
|
-
ErrorCode: "ErrorCode",
|
|
3626
|
-
Retry: "Retry",
|
|
3627
|
-
ErrorMessage: "ErrorMessage",
|
|
3628
|
-
HttpStatus: "HttpStatus",
|
|
3629
|
-
UpstreamErrorCode: "UpstreamErrorCode"
|
|
3630
|
-
};
|
|
3631
|
-
var AuthDimensions = {
|
|
3632
|
-
AuthenticationMethod: "AuthenticationMethod",
|
|
3633
|
-
Success: "Success",
|
|
3634
|
-
Reason: "Reason"
|
|
3635
|
-
};
|
|
3636
|
-
var SkillsDimensions = {
|
|
3637
|
-
SchemaVersion: "SchemaVersion",
|
|
3638
|
-
AgentType: "AgentType",
|
|
3639
|
-
SkillsVersion: "SkillsVersion",
|
|
3640
|
-
UipSubcommand: "UipSubcommand",
|
|
3641
|
-
FileExtension: "FileExtension",
|
|
3642
|
-
SubagentModel: "SubagentModel",
|
|
3643
|
-
SubagentType: "SubagentType",
|
|
3644
|
-
PermissionMode: "PermissionMode",
|
|
3645
|
-
EffortLevel: "EffortLevel",
|
|
3646
|
-
SessionSource: "SessionSource",
|
|
3647
|
-
Outcome: "Outcome",
|
|
3648
|
-
DurationMs: "DurationMs",
|
|
3649
|
-
Source: "Source"
|
|
3650
|
-
};
|
|
3651
|
-
var PackagerDimensions = {
|
|
3652
|
-
ProjectId: "ProjectId",
|
|
3653
|
-
ProjectType: "ProjectType",
|
|
3654
|
-
SolutionId: "SolutionId"
|
|
3655
|
-
};
|
|
3656
|
-
var ScopeDimensions = {
|
|
3657
|
-
FolderId: "FolderId"
|
|
3658
|
-
};
|
|
3659
|
-
var ID_DIMENSIONS = new Set([
|
|
3660
|
-
BaseDimensions.CloudUserId,
|
|
3661
|
-
BaseDimensions.CloudTenantId,
|
|
3662
|
-
BaseDimensions.CloudOrganizationId,
|
|
3663
|
-
BaseDimensions.InstallationId,
|
|
3664
|
-
ShipDimensions.ArtifactCorrelationKey,
|
|
3665
|
-
ShipDimensions.PackageVersionKey,
|
|
3666
|
-
ShipDimensions.DeploymentKey,
|
|
3667
|
-
ShipDimensions.SolutionId,
|
|
3668
|
-
ShipDimensions.FolderKey,
|
|
3669
|
-
ShipDimensions.FeedId,
|
|
3670
|
-
PackagerDimensions.ProjectId
|
|
3671
|
-
]);
|
|
3672
|
-
var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
|
|
3673
|
-
var RESERVED_DIMENSION_NAMES = new Set([
|
|
3674
|
-
...Object.values(BaseDimensions),
|
|
3675
|
-
...Object.values(CommandDimensions),
|
|
3676
|
-
...Object.values(ShipDimensions),
|
|
3677
|
-
...Object.values(ErrorDimensions),
|
|
3678
|
-
...Object.values(AuthDimensions),
|
|
3679
|
-
...Object.values(SkillsDimensions),
|
|
3680
|
-
...Object.values(PackagerDimensions),
|
|
3681
|
-
...Object.values(ScopeDimensions)
|
|
3682
|
-
]);
|
|
3683
|
-
var CURATED_DIMENSIONS = new Set([
|
|
3684
|
-
BaseDimensions.ApplicationName,
|
|
3685
|
-
BaseDimensions.ProductVersion,
|
|
3686
|
-
BaseDimensions.InstallationId,
|
|
3687
|
-
BaseDimensions.CloudUserId,
|
|
3688
|
-
BaseDimensions.CloudTenantId,
|
|
3689
|
-
BaseDimensions.CloudOrganizationId,
|
|
3690
|
-
BaseDimensions.IsInternalUser,
|
|
3691
|
-
BaseDimensions.Environment,
|
|
3692
|
-
BaseDimensions.BaseUrl,
|
|
3693
|
-
BaseDimensions.Region,
|
|
3694
|
-
BaseDimensions.Agent,
|
|
3695
|
-
BaseDimensions.AgentVersion,
|
|
3696
|
-
BaseDimensions.ToolVersion,
|
|
3697
|
-
BaseDimensions.ExecutionContext,
|
|
3698
|
-
BaseDimensions.CiProvider,
|
|
3699
|
-
BaseDimensions.SessionIdSource,
|
|
3700
|
-
BaseDimensions.SessionId,
|
|
3701
|
-
...Object.values(CommandDimensions),
|
|
3702
|
-
...Object.values(ShipDimensions)
|
|
3703
|
-
]);
|
|
3704
|
-
function lowercaseIdDimensionValues(properties) {
|
|
3705
|
-
let changed = false;
|
|
3706
|
-
const result = {
|
|
3707
|
-
...properties
|
|
3708
|
-
};
|
|
3709
|
-
for (const key of Object.keys(result)) {
|
|
3710
|
-
const value = result[key];
|
|
3711
|
-
if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
|
|
3712
|
-
continue;
|
|
3713
|
-
}
|
|
3714
|
-
const lowered = value.toLowerCase();
|
|
3715
|
-
if (lowered !== value) {
|
|
3716
|
-
result[key] = lowered;
|
|
3717
|
-
changed = true;
|
|
3718
|
-
}
|
|
3719
|
-
}
|
|
3720
|
-
return changed ? result : properties;
|
|
3721
|
-
}
|
|
3722
|
-
|
|
3723
4202
|
// ../../common/src/telemetry/command-terminal.ts
|
|
3724
4203
|
var recordedFailureSlot = singleton("CommandTelemetryFailure");
|
|
3725
4204
|
var AUTH_ERROR_CODES = new Set([
|
|
@@ -3838,17 +4317,8 @@ function terminalSignalFor(input, outcome) {
|
|
|
3838
4317
|
}
|
|
3839
4318
|
return outcome === "cancelled" ? "SIGINT" : undefined;
|
|
3840
4319
|
}
|
|
3841
|
-
function
|
|
3842
|
-
|
|
3843
|
-
return "auth";
|
|
3844
|
-
}
|
|
3845
|
-
if (status === 400 || status === 409 || status === 422) {
|
|
3846
|
-
return "validation";
|
|
3847
|
-
}
|
|
3848
|
-
if (status === 408) {
|
|
3849
|
-
return "timeout";
|
|
3850
|
-
}
|
|
3851
|
-
return "network_http";
|
|
4320
|
+
function classifyFailingHttpStatus(status) {
|
|
4321
|
+
return classifyFromErrorCode(classifyHttpStatus(status)?.errorCode) ?? "network_http";
|
|
3852
4322
|
}
|
|
3853
4323
|
function classifyFromResult(result) {
|
|
3854
4324
|
switch (result) {
|
|
@@ -3928,7 +4398,7 @@ function classifyError2(input) {
|
|
|
3928
4398
|
}
|
|
3929
4399
|
const status = recorded?.context?.httpStatus ?? findHttpStatusInGraph(input.error);
|
|
3930
4400
|
if (status !== undefined) {
|
|
3931
|
-
return
|
|
4401
|
+
return classifyFailingHttpStatus(status);
|
|
3932
4402
|
}
|
|
3933
4403
|
return classifyFromResult(recorded?.result) ?? classifyFromErrorCode(recorded?.errorCode) ?? classifyFromError(input.error) ?? "unknown";
|
|
3934
4404
|
}
|
|
@@ -3960,6 +4430,7 @@ function buildCommandTerminalTelemetryProperties(input) {
|
|
|
3960
4430
|
var CommonTelemetryEvents = {
|
|
3961
4431
|
Start: "Application.Start",
|
|
3962
4432
|
Error: "Application.Error",
|
|
4433
|
+
ProjectActivity: "Cli.ProjectActivity",
|
|
3963
4434
|
ShipSucceeded: "Cli.ShipSucceeded"
|
|
3964
4435
|
};
|
|
3965
4436
|
|
|
@@ -4465,92 +4936,17 @@ class TelemetryService {
|
|
|
4465
4936
|
return lowercaseIdDimensionValues(enriched);
|
|
4466
4937
|
}
|
|
4467
4938
|
generateId() {
|
|
4468
|
-
const bytes = new Uint8Array(8);
|
|
4469
|
-
let hex = "";
|
|
4470
|
-
do {
|
|
4471
|
-
crypto.getRandomValues(bytes);
|
|
4472
|
-
hex = "";
|
|
4473
|
-
for (const byte of bytes) {
|
|
4474
|
-
hex += byte.toString(16).padStart(2, "0");
|
|
4475
|
-
}
|
|
4476
|
-
} while (/^0+$/.test(hex));
|
|
4477
|
-
return hex;
|
|
4478
|
-
}
|
|
4479
|
-
}
|
|
4480
|
-
// ../../common/src/timings.ts
|
|
4481
|
-
var TIMINGS_ENV_VAR = "UIP_TIMINGS";
|
|
4482
|
-
function createStorage2() {
|
|
4483
|
-
const [error, mod] = catchError(() => __require("node:async_hooks"));
|
|
4484
|
-
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
4485
|
-
return {
|
|
4486
|
-
getStore: () => {
|
|
4487
|
-
return;
|
|
4488
|
-
},
|
|
4489
|
-
run: (_store, fn) => fn()
|
|
4490
|
-
};
|
|
4491
|
-
}
|
|
4492
|
-
return new mod.AsyncLocalStorage;
|
|
4493
|
-
}
|
|
4494
|
-
var storageSlot = singleton("TimingStorage");
|
|
4495
|
-
var stateSlot = singleton("Timings");
|
|
4496
|
-
var rootStartedSlot = singleton("TimingsRootStarted");
|
|
4497
|
-
var longLivedHostSlot = singleton("TimingsLongLivedHost");
|
|
4498
|
-
var storage = storageSlot.getOrInit(createStorage2, (value) => ("getStore" in value));
|
|
4499
|
-
function newState(baseline) {
|
|
4500
|
-
return { baseline, httpMs: 0, httpCalls: 0 };
|
|
4501
|
-
}
|
|
4502
|
-
function getState() {
|
|
4503
|
-
const scoped = storage.getStore();
|
|
4504
|
-
if (scoped) {
|
|
4505
|
-
return scoped;
|
|
4506
|
-
}
|
|
4507
|
-
const pinned = livePinnedState();
|
|
4508
|
-
if (pinned !== undefined) {
|
|
4509
|
-
return pinned;
|
|
4510
|
-
}
|
|
4511
|
-
return newState(processStartIsInvocationStart() ? 0 : performance.now());
|
|
4512
|
-
}
|
|
4513
|
-
function livePinnedState() {
|
|
4514
|
-
const pinned = stateSlot.get();
|
|
4515
|
-
return pinned !== undefined && "httpCalls" in pinned && !pinned.finished ? pinned : undefined;
|
|
4516
|
-
}
|
|
4517
|
-
function processStartIsInvocationStart() {
|
|
4518
|
-
return !rootStartedSlot.get(false) && !longLivedHostSlot.get(false);
|
|
4519
|
-
}
|
|
4520
|
-
function timingsEnabled() {
|
|
4521
|
-
if (typeof process === "undefined") {
|
|
4522
|
-
return false;
|
|
4523
|
-
}
|
|
4524
|
-
const value = process.env?.[TIMINGS_ENV_VAR];
|
|
4525
|
-
if (value === undefined) {
|
|
4526
|
-
return false;
|
|
4527
|
-
}
|
|
4528
|
-
const normalized = value.trim().toLowerCase();
|
|
4529
|
-
return normalized === "1" || normalized === "true";
|
|
4530
|
-
}
|
|
4531
|
-
function recordExitCode(exitCode) {
|
|
4532
|
-
if (!timingsEnabled()) {
|
|
4533
|
-
return;
|
|
4534
|
-
}
|
|
4535
|
-
getState().exitCode = exitCode;
|
|
4536
|
-
}
|
|
4537
|
-
function invocationStartedAt() {
|
|
4538
|
-
return new Date(performance.timeOrigin + getState().baseline);
|
|
4539
|
-
}
|
|
4540
|
-
function invocationElapsedMs() {
|
|
4541
|
-
return performance.now() - getState().baseline;
|
|
4542
|
-
}
|
|
4543
|
-
function markCommandStart() {
|
|
4544
|
-
if (!timingsEnabled()) {
|
|
4545
|
-
return;
|
|
4546
|
-
}
|
|
4547
|
-
getState().commandStart = performance.now();
|
|
4548
|
-
}
|
|
4549
|
-
function recordCommandDuration(durationMs) {
|
|
4550
|
-
if (!timingsEnabled()) {
|
|
4551
|
-
return;
|
|
4939
|
+
const bytes = new Uint8Array(8);
|
|
4940
|
+
let hex = "";
|
|
4941
|
+
do {
|
|
4942
|
+
crypto.getRandomValues(bytes);
|
|
4943
|
+
hex = "";
|
|
4944
|
+
for (const byte of bytes) {
|
|
4945
|
+
hex += byte.toString(16).padStart(2, "0");
|
|
4946
|
+
}
|
|
4947
|
+
} while (/^0+$/.test(hex));
|
|
4948
|
+
return hex;
|
|
4552
4949
|
}
|
|
4553
|
-
getState().commandMs = durationMs;
|
|
4554
4950
|
}
|
|
4555
4951
|
// ../../common/src/telemetry/proxy-http-agent.ts
|
|
4556
4952
|
var slot = singleton("ProxyAuthHttpsAgent");
|
|
@@ -4558,6 +4954,15 @@ var slot = singleton("ProxyAuthHttpsAgent");
|
|
|
4558
4954
|
// ../../common/src/telemetry/node-appinsights-telemetry-provider.ts
|
|
4559
4955
|
var providerSlot = singleton("TelemetryProvider");
|
|
4560
4956
|
|
|
4957
|
+
// ../../common/src/telemetry/telemetry-config.ts
|
|
4958
|
+
function isTelemetryDisabled() {
|
|
4959
|
+
const value = process.env.UIPATH_TELEMETRY_DISABLED;
|
|
4960
|
+
return value === "1" || value === "true";
|
|
4961
|
+
}
|
|
4962
|
+
function isProjectTelemetryDisabled() {
|
|
4963
|
+
return isTelemetryDisabled() || process.env.UIPATH_PROJECT_TELEMETRY_DISABLED === "1" || process.env.UIPATH_PROJECT_TELEMETRY_DISABLED === "true";
|
|
4964
|
+
}
|
|
4965
|
+
|
|
4561
4966
|
// ../../common/src/telemetry/telemetry-spool.ts
|
|
4562
4967
|
var sidecarEntrySlot = singleton("TelemetrySidecarEntry");
|
|
4563
4968
|
var MAX_SPOOL_AGE_MS = 72 * 60 * 60 * 1000;
|
|
@@ -4593,7 +4998,6 @@ var telemetry = new Proxy({}, {
|
|
|
4593
4998
|
return typeof value === "function" ? value.bind(instance) : value;
|
|
4594
4999
|
}
|
|
4595
5000
|
});
|
|
4596
|
-
|
|
4597
5001
|
// ../../common/src/formatter.ts
|
|
4598
5002
|
var ANSI_STYLES = {
|
|
4599
5003
|
red: "\x1B[31m",
|
|
@@ -4603,46 +5007,6 @@ var ANSI_RESET = "\x1B[0m";
|
|
|
4603
5007
|
function styleLine(line, style) {
|
|
4604
5008
|
return style ? `${ANSI_STYLES[style]}${line}${ANSI_RESET}` : line;
|
|
4605
5009
|
}
|
|
4606
|
-
var CLI_ERROR_CODES = [
|
|
4607
|
-
"invalid_argument",
|
|
4608
|
-
"authentication_required",
|
|
4609
|
-
"permission_denied",
|
|
4610
|
-
"local_permission_denied",
|
|
4611
|
-
"not_found",
|
|
4612
|
-
"rate_limited",
|
|
4613
|
-
"network_error",
|
|
4614
|
-
"timeout",
|
|
4615
|
-
"server_error",
|
|
4616
|
-
"method_not_allowed",
|
|
4617
|
-
"not_supported",
|
|
4618
|
-
"configuration_error",
|
|
4619
|
-
"execution_failed",
|
|
4620
|
-
"unknown_error"
|
|
4621
|
-
];
|
|
4622
|
-
var RETRY_HINTS = [
|
|
4623
|
-
"RetryWillNotFix",
|
|
4624
|
-
"RetryLater",
|
|
4625
|
-
"RetryAfter1Second",
|
|
4626
|
-
"RetryAfter10Seconds",
|
|
4627
|
-
"RetryAfter30Seconds",
|
|
4628
|
-
"RetryAfter60Seconds"
|
|
4629
|
-
];
|
|
4630
|
-
var CLI_ERROR_CODE_VALUES = new Set(CLI_ERROR_CODES);
|
|
4631
|
-
var RETRY_HINT_VALUES = new Set(RETRY_HINTS);
|
|
4632
|
-
function isCliErrorCode(value) {
|
|
4633
|
-
return typeof value === "string" && CLI_ERROR_CODE_VALUES.has(value);
|
|
4634
|
-
}
|
|
4635
|
-
function isRetryHint(value) {
|
|
4636
|
-
return typeof value === "string" && RETRY_HINT_VALUES.has(value);
|
|
4637
|
-
}
|
|
4638
|
-
var RESULTS = {
|
|
4639
|
-
Success: "Success",
|
|
4640
|
-
Failure: "Failure",
|
|
4641
|
-
ConfigError: "ConfigError",
|
|
4642
|
-
AuthenticationError: "AuthenticationError",
|
|
4643
|
-
ValidationError: "ValidationError",
|
|
4644
|
-
TimeoutError: "TimeoutError"
|
|
4645
|
-
};
|
|
4646
5010
|
var EXIT_CODES = {
|
|
4647
5011
|
Success: 0,
|
|
4648
5012
|
Failure: 1,
|
|
@@ -4651,6 +5015,9 @@ var EXIT_CODES = {
|
|
|
4651
5015
|
ValidationError: 3,
|
|
4652
5016
|
TimeoutError: 4
|
|
4653
5017
|
};
|
|
5018
|
+
function exitCodeForResult(result) {
|
|
5019
|
+
return EXIT_CODES[result] ?? EXIT_CODES.Failure;
|
|
5020
|
+
}
|
|
4654
5021
|
function escapeNonAscii(jsonText) {
|
|
4655
5022
|
return jsonText.replace(/[\u0080-\uffff]/g, (c) => {
|
|
4656
5023
|
const hex = c.charCodeAt(0).toString(16).padStart(4, "0");
|
|
@@ -5326,8 +5693,8 @@ function carriesOnlyNulls(value) {
|
|
|
5326
5693
|
}
|
|
5327
5694
|
return false;
|
|
5328
5695
|
}
|
|
5329
|
-
function nameList(names,
|
|
5330
|
-
const shown = names.slice(0,
|
|
5696
|
+
function nameList(names, cap = 12) {
|
|
5697
|
+
const shown = names.slice(0, cap).map((n) => `\`${n}\``);
|
|
5331
5698
|
const rest = names.length - shown.length;
|
|
5332
5699
|
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
5333
5700
|
}
|
|
@@ -5464,40 +5831,11 @@ function defaultErrorCodeForResult(result) {
|
|
|
5464
5831
|
return "unknown_error";
|
|
5465
5832
|
}
|
|
5466
5833
|
}
|
|
5467
|
-
function parseHttpStatusFromMessage2(message) {
|
|
5468
|
-
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
5469
|
-
if (!match)
|
|
5470
|
-
return;
|
|
5471
|
-
const status = Number(match[1]);
|
|
5472
|
-
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
5473
|
-
}
|
|
5474
|
-
function defaultErrorCodeForHttpStatus(status) {
|
|
5475
|
-
if (status === undefined)
|
|
5476
|
-
return;
|
|
5477
|
-
if (status === 400 || status === 409 || status === 422) {
|
|
5478
|
-
return "invalid_argument";
|
|
5479
|
-
}
|
|
5480
|
-
if (status === 401)
|
|
5481
|
-
return "authentication_required";
|
|
5482
|
-
if (status === 403)
|
|
5483
|
-
return "permission_denied";
|
|
5484
|
-
if (status === 404)
|
|
5485
|
-
return "not_found";
|
|
5486
|
-
if (status === 405)
|
|
5487
|
-
return "method_not_allowed";
|
|
5488
|
-
if (status === 408)
|
|
5489
|
-
return "timeout";
|
|
5490
|
-
if (status === 429)
|
|
5491
|
-
return "rate_limited";
|
|
5492
|
-
if (status >= 500 && status < 600)
|
|
5493
|
-
return "server_error";
|
|
5494
|
-
return;
|
|
5495
|
-
}
|
|
5496
5834
|
var LOCAL_PERMISSION_TEXT_PATTERN = new RegExp(`(?:\\b|\\()(?:${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})(?::\\s|\\))`);
|
|
5497
5835
|
function defaultErrorCodeForFailure(data) {
|
|
5498
5836
|
if (data.Result === RESULTS.Failure) {
|
|
5499
|
-
const status = data.Context?.httpStatus ??
|
|
5500
|
-
const errorCode =
|
|
5837
|
+
const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage(data.Message);
|
|
5838
|
+
const errorCode = classifyHttpStatus(status)?.errorCode;
|
|
5501
5839
|
if (errorCode)
|
|
5502
5840
|
return errorCode;
|
|
5503
5841
|
if (status === undefined && (LOCAL_PERMISSION_TEXT_PATTERN.test(data.Message) || LOCAL_PERMISSION_TEXT_PATTERN.test(data.Instructions))) {
|
|
@@ -5506,17 +5844,6 @@ function defaultErrorCodeForFailure(data) {
|
|
|
5506
5844
|
}
|
|
5507
5845
|
return defaultErrorCodeForResult(data.Result);
|
|
5508
5846
|
}
|
|
5509
|
-
function defaultRetryForErrorCode(errorCode) {
|
|
5510
|
-
switch (errorCode) {
|
|
5511
|
-
case "network_error":
|
|
5512
|
-
case "rate_limited":
|
|
5513
|
-
case "server_error":
|
|
5514
|
-
case "timeout":
|
|
5515
|
-
return "RetryLater";
|
|
5516
|
-
default:
|
|
5517
|
-
return "RetryWillNotFix";
|
|
5518
|
-
}
|
|
5519
|
-
}
|
|
5520
5847
|
var OutputFormatter;
|
|
5521
5848
|
((OutputFormatter) => {
|
|
5522
5849
|
function success(data, options) {
|
|
@@ -5548,7 +5875,7 @@ var OutputFormatter;
|
|
|
5548
5875
|
data.Log ??= getLogFilePath() || undefined;
|
|
5549
5876
|
data.ErrorCode ??= defaultErrorCodeForFailure(data);
|
|
5550
5877
|
data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
|
|
5551
|
-
const exitCode =
|
|
5878
|
+
const exitCode = exitCodeForResult(data.Result);
|
|
5552
5879
|
setExitCode(exitCode);
|
|
5553
5880
|
recordCommandFailureTelemetry({
|
|
5554
5881
|
result: data.Result,
|
|
@@ -5642,39 +5969,228 @@ var OutputFormatter;
|
|
|
5642
5969
|
}
|
|
5643
5970
|
OutputFormatter.formatToString = formatToString;
|
|
5644
5971
|
})(OutputFormatter ||= {});
|
|
5645
|
-
// ../../../node_modules/commander/esm.mjs
|
|
5646
|
-
var import__ = __toESM(require_commander(), 1);
|
|
5647
|
-
var {
|
|
5648
|
-
program,
|
|
5649
|
-
createCommand,
|
|
5650
|
-
createArgument,
|
|
5651
|
-
createOption,
|
|
5652
|
-
CommanderError,
|
|
5653
|
-
InvalidArgumentError,
|
|
5654
|
-
InvalidOptionArgumentError,
|
|
5655
|
-
Command,
|
|
5656
|
-
Argument,
|
|
5657
|
-
Option,
|
|
5658
|
-
Help
|
|
5659
|
-
} = import__.default;
|
|
5660
5972
|
|
|
5661
|
-
// ../../common/src/
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5973
|
+
// ../../common/src/pass-through-tail.ts
|
|
5974
|
+
function maybeOption(arg) {
|
|
5975
|
+
return arg.length > 1 && arg[0] === "-";
|
|
5976
|
+
}
|
|
5977
|
+
function tokenizeTail(cmd, tail) {
|
|
5978
|
+
const find = (flag) => cmd.options.find((option) => option.long === flag || option.short === flag);
|
|
5979
|
+
const digitShort = cmd.options.some((option) => option.short !== undefined && /^-\d$/.test(option.short));
|
|
5980
|
+
const negativeNumber = (arg) => !digitShort && /^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg);
|
|
5981
|
+
const tokens = [];
|
|
5982
|
+
let firstUnknown = -1;
|
|
5983
|
+
let sentinel = -1;
|
|
5984
|
+
let variadic;
|
|
5985
|
+
let group;
|
|
5986
|
+
let groupIndex = 0;
|
|
5987
|
+
let i = 0;
|
|
5988
|
+
while (i < tail.length || group !== undefined) {
|
|
5989
|
+
const index = group === undefined ? i : groupIndex;
|
|
5990
|
+
const arg = group ?? tail[i++];
|
|
5991
|
+
group = undefined;
|
|
5992
|
+
if (arg === "--") {
|
|
5993
|
+
sentinel = index;
|
|
5994
|
+
tokens.push({ kind: "sentinel", index });
|
|
5995
|
+
for (let j = i;j < tail.length; j++) {
|
|
5996
|
+
tokens.push({
|
|
5997
|
+
kind: "operand",
|
|
5998
|
+
index: j,
|
|
5999
|
+
text: tail[j],
|
|
6000
|
+
literal: true
|
|
6001
|
+
});
|
|
6002
|
+
}
|
|
6003
|
+
break;
|
|
6004
|
+
}
|
|
6005
|
+
if (variadic && (!maybeOption(arg) || negativeNumber(arg))) {
|
|
6006
|
+
tokens.push({
|
|
6007
|
+
kind: "option",
|
|
6008
|
+
index,
|
|
6009
|
+
text: arg,
|
|
6010
|
+
option: variadic,
|
|
6011
|
+
value: arg
|
|
6012
|
+
});
|
|
6013
|
+
continue;
|
|
6014
|
+
}
|
|
6015
|
+
variadic = undefined;
|
|
6016
|
+
if (maybeOption(arg)) {
|
|
6017
|
+
const option = find(arg);
|
|
6018
|
+
if (option) {
|
|
6019
|
+
let value;
|
|
6020
|
+
if (option.required) {
|
|
6021
|
+
value = tail[i];
|
|
6022
|
+
if (value !== undefined)
|
|
6023
|
+
i++;
|
|
6024
|
+
} else if (option.optional) {
|
|
6025
|
+
const next = tail[i];
|
|
6026
|
+
if (next !== undefined && (!maybeOption(next) || negativeNumber(next))) {
|
|
6027
|
+
value = next;
|
|
6028
|
+
i++;
|
|
6029
|
+
}
|
|
6030
|
+
}
|
|
6031
|
+
tokens.push({
|
|
6032
|
+
kind: "option",
|
|
6033
|
+
index,
|
|
6034
|
+
text: arg,
|
|
6035
|
+
option,
|
|
6036
|
+
...value === undefined ? {} : { value }
|
|
6037
|
+
});
|
|
6038
|
+
variadic = option.variadic ? option : undefined;
|
|
6039
|
+
continue;
|
|
6040
|
+
}
|
|
6041
|
+
}
|
|
6042
|
+
if (arg.length > 2 && arg[0] === "-" && arg[1] !== "-") {
|
|
6043
|
+
const option = find(`-${arg[1]}`);
|
|
6044
|
+
if (option) {
|
|
6045
|
+
if (option.required || option.optional) {
|
|
6046
|
+
tokens.push({
|
|
6047
|
+
kind: "option",
|
|
6048
|
+
index,
|
|
6049
|
+
text: arg,
|
|
6050
|
+
option,
|
|
6051
|
+
value: arg.slice(2)
|
|
6052
|
+
});
|
|
6053
|
+
} else {
|
|
6054
|
+
tokens.push({ kind: "option", index, text: arg, option });
|
|
6055
|
+
group = `-${arg.slice(2)}`;
|
|
6056
|
+
groupIndex = index;
|
|
6057
|
+
}
|
|
6058
|
+
continue;
|
|
6059
|
+
}
|
|
6060
|
+
}
|
|
6061
|
+
if (/^--[^=]+=/.test(arg)) {
|
|
6062
|
+
const equals = arg.indexOf("=");
|
|
6063
|
+
const option = find(arg.slice(0, equals));
|
|
6064
|
+
if (option && (option.required || option.optional)) {
|
|
6065
|
+
tokens.push({
|
|
6066
|
+
kind: "option",
|
|
6067
|
+
index,
|
|
6068
|
+
text: arg,
|
|
6069
|
+
option,
|
|
6070
|
+
value: arg.slice(equals + 1)
|
|
6071
|
+
});
|
|
6072
|
+
continue;
|
|
6073
|
+
}
|
|
6074
|
+
}
|
|
6075
|
+
if (maybeOption(arg) && !negativeNumber(arg)) {
|
|
6076
|
+
const equals = arg.startsWith("--") ? arg.indexOf("=") : -1;
|
|
6077
|
+
if (firstUnknown === -1)
|
|
6078
|
+
firstUnknown = index;
|
|
6079
|
+
tokens.push({
|
|
6080
|
+
kind: "unknown",
|
|
6081
|
+
index,
|
|
6082
|
+
text: arg,
|
|
6083
|
+
flag: equals > 0 ? arg.slice(0, equals) : arg,
|
|
6084
|
+
...equals > 0 ? { inlineValue: arg.slice(equals + 1) } : {}
|
|
6085
|
+
});
|
|
6086
|
+
continue;
|
|
6087
|
+
}
|
|
6088
|
+
tokens.push({ kind: "operand", index, text: arg, literal: false });
|
|
6089
|
+
}
|
|
6090
|
+
return { tokens, firstUnknown, sentinel };
|
|
5671
6091
|
}
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
6092
|
+
|
|
6093
|
+
// ../../common/src/project-telemetry.ts
|
|
6094
|
+
var RESOLVER = Symbol.for("@uipath/common/projectTelemetryResolver");
|
|
6095
|
+
var CAPTURE = Symbol.for("@uipath/common/projectTelemetryCapture");
|
|
6096
|
+
var CONTEXT_RESOLVER = Symbol.for("@uipath/common/projectContextTelemetryResolver");
|
|
6097
|
+
var RULES = Symbol.for("@uipath/common/projectTargetRules");
|
|
6098
|
+
function logSkipped(what, error) {
|
|
6099
|
+
logger.debug(`[project-telemetry] ${what} skipped: ${error instanceof Error ? error.message : String(error)}`);
|
|
6100
|
+
}
|
|
6101
|
+
function bounded(work, what) {
|
|
6102
|
+
return withinProjectIdentityBudget(work, () => logSkipped(what, `no answer within ${PROJECT_IDENTITY_LOOKUP_BUDGET_MS} ms`));
|
|
6103
|
+
}
|
|
6104
|
+
async function identityWithContext(command, identity) {
|
|
6105
|
+
const props = projectIdentityProperties(identity);
|
|
6106
|
+
if (!identity.projectDirectory || isProjectTelemetryDisabled())
|
|
6107
|
+
return props;
|
|
6108
|
+
for (let node = command;node; node = node.parent ?? undefined) {
|
|
6109
|
+
const resolver = node[CONTEXT_RESOLVER];
|
|
6110
|
+
if (typeof resolver !== "function")
|
|
6111
|
+
continue;
|
|
6112
|
+
try {
|
|
6113
|
+
return {
|
|
6114
|
+
...await resolver(identity.projectDirectory),
|
|
6115
|
+
...props
|
|
6116
|
+
};
|
|
6117
|
+
} catch (error) {
|
|
6118
|
+
logSkipped("solution context lookup", error);
|
|
6119
|
+
return props;
|
|
6120
|
+
}
|
|
5675
6121
|
}
|
|
5676
|
-
return
|
|
5677
|
-
}
|
|
6122
|
+
return props;
|
|
6123
|
+
}
|
|
6124
|
+
function getProjectTelemetryResolver(command) {
|
|
6125
|
+
for (let node = command;node; node = node.parent) {
|
|
6126
|
+
const resolver = node[RESOLVER];
|
|
6127
|
+
if (typeof resolver === "function")
|
|
6128
|
+
return resolver;
|
|
6129
|
+
}
|
|
6130
|
+
return;
|
|
6131
|
+
}
|
|
6132
|
+
function attachProjectTelemetryCapture(command, capture) {
|
|
6133
|
+
command[CAPTURE] = capture;
|
|
6134
|
+
}
|
|
6135
|
+
class ProjectTelemetrySession {
|
|
6136
|
+
resolver;
|
|
6137
|
+
command;
|
|
6138
|
+
target;
|
|
6139
|
+
props = {};
|
|
6140
|
+
explicit = false;
|
|
6141
|
+
input;
|
|
6142
|
+
constructor(resolver, command) {
|
|
6143
|
+
this.resolver = resolver;
|
|
6144
|
+
this.command = command;
|
|
6145
|
+
}
|
|
6146
|
+
async setTarget(path) {
|
|
6147
|
+
this.target = path;
|
|
6148
|
+
if (this.input) {
|
|
6149
|
+
await this.resolve({
|
|
6150
|
+
...this.input,
|
|
6151
|
+
phase: "after",
|
|
6152
|
+
success: true
|
|
6153
|
+
});
|
|
6154
|
+
this.explicit = true;
|
|
6155
|
+
}
|
|
6156
|
+
}
|
|
6157
|
+
async setIdentity(identity) {
|
|
6158
|
+
try {
|
|
6159
|
+
const props = await bounded(identityWithContext(this.command, identity), "project identity capture");
|
|
6160
|
+
if (props !== undefined)
|
|
6161
|
+
this.setProperties(props);
|
|
6162
|
+
} catch (error) {
|
|
6163
|
+
logSkipped("project identity capture", error);
|
|
6164
|
+
}
|
|
6165
|
+
}
|
|
6166
|
+
setProperties(properties) {
|
|
6167
|
+
try {
|
|
6168
|
+
this.props = { ...properties };
|
|
6169
|
+
this.explicit = true;
|
|
6170
|
+
} catch (error) {
|
|
6171
|
+
logSkipped("project identity properties", error);
|
|
6172
|
+
}
|
|
6173
|
+
}
|
|
6174
|
+
properties() {
|
|
6175
|
+
return { ...this.props };
|
|
6176
|
+
}
|
|
6177
|
+
async resolve(input) {
|
|
6178
|
+
this.input = input;
|
|
6179
|
+
if (this.explicit)
|
|
6180
|
+
return;
|
|
6181
|
+
try {
|
|
6182
|
+
const props = await bounded(this.resolver({
|
|
6183
|
+
...input,
|
|
6184
|
+
target: this.target
|
|
6185
|
+
}), `project identity (${input.phase})`);
|
|
6186
|
+
if (props !== undefined) {
|
|
6187
|
+
this.props = props;
|
|
6188
|
+
}
|
|
6189
|
+
} catch (error) {
|
|
6190
|
+
logSkipped(`project identity (${input.phase})`, error);
|
|
6191
|
+
}
|
|
6192
|
+
}
|
|
6193
|
+
}
|
|
5678
6194
|
|
|
5679
6195
|
// ../../common/src/telemetry/command-attribution.ts
|
|
5680
6196
|
var LEGACY_SKILL_NAMESPACE = "uipath:";
|
|
@@ -5920,8 +6436,7 @@ var pollSignalSlot = singleton("PollSignal");
|
|
|
5920
6436
|
var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
|
|
5921
6437
|
var processContext = {
|
|
5922
6438
|
exit: (code) => {
|
|
5923
|
-
|
|
5924
|
-
setExitCode(code);
|
|
6439
|
+
recordCommandExit(code);
|
|
5925
6440
|
},
|
|
5926
6441
|
get pollSignal() {
|
|
5927
6442
|
return pollSignalSlot.get();
|
|
@@ -5946,6 +6461,8 @@ function recordableArgValue(value, choices) {
|
|
|
5946
6461
|
function extractCommandParams(cmd) {
|
|
5947
6462
|
const params = {};
|
|
5948
6463
|
forEachSuppliedArgument(cmd, (name, value, choices, defaulted) => {
|
|
6464
|
+
if (name === undefined)
|
|
6465
|
+
return;
|
|
5949
6466
|
const recordable = recordableArgValue(value, choices);
|
|
5950
6467
|
params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = recordable === TELEMETRY_ARG_VALUE_WITHHELD && defaulted ? TELEMETRY_ARG_VALUE_DEFAULTED : recordable;
|
|
5951
6468
|
});
|
|
@@ -5961,7 +6478,8 @@ function isDefaultedPositional(cmd, index) {
|
|
|
5961
6478
|
function forEachSuppliedArgument(cmd, visit) {
|
|
5962
6479
|
const registered = cmd.registeredArguments ?? [];
|
|
5963
6480
|
const processed = cmd.processedArgs ?? [];
|
|
5964
|
-
|
|
6481
|
+
const bound = boundPositionalCount(cmd);
|
|
6482
|
+
for (let i = 0;i < bound; i++) {
|
|
5965
6483
|
const name = registered[i].name();
|
|
5966
6484
|
if (name && processed[i] !== undefined) {
|
|
5967
6485
|
visit(name, processed[i], registered[i].argChoices, isDefaultedPositional(cmd, i));
|
|
@@ -5976,6 +6494,71 @@ function forEachSuppliedArgument(cmd, visit) {
|
|
|
5976
6494
|
visit(key, value, choicesByAttribute.get(key), isDefaultedOption(cmd, key));
|
|
5977
6495
|
}
|
|
5978
6496
|
}
|
|
6497
|
+
forEachPassThroughToken(cmd, bound, (name, value) => {
|
|
6498
|
+
visit(name, value, name === undefined ? undefined : choicesByAttribute.get(name), false);
|
|
6499
|
+
});
|
|
6500
|
+
}
|
|
6501
|
+
function boundPositionalCount(cmd) {
|
|
6502
|
+
const registered = cmd.registeredArguments ?? [];
|
|
6503
|
+
if (registered.some((argument) => argument.variadic)) {
|
|
6504
|
+
return registered.length;
|
|
6505
|
+
}
|
|
6506
|
+
if ((cmd.args ?? []).length <= registered.length) {
|
|
6507
|
+
return registered.length;
|
|
6508
|
+
}
|
|
6509
|
+
const firstFlag = tokenizeTail(cmd, (cmd.args ?? []).slice(1)).tokens.find((token) => token.kind !== "operand")?.index ?? -1;
|
|
6510
|
+
return firstFlag === -1 ? registered.length : Math.min(registered.length, firstFlag + 1);
|
|
6511
|
+
}
|
|
6512
|
+
function forEachPassThroughToken(cmd, bound, visit) {
|
|
6513
|
+
const registered = cmd.registeredArguments ?? [];
|
|
6514
|
+
const fillsPositionals = !registered.some((argument) => argument.variadic);
|
|
6515
|
+
const { tokens, firstUnknown } = tokenizeTail(cmd, (cmd.args ?? []).slice(bound));
|
|
6516
|
+
const repeated = new Map;
|
|
6517
|
+
let nextPositional = bound;
|
|
6518
|
+
for (const token of tokens) {
|
|
6519
|
+
const pastUnknown = firstUnknown !== -1 && token.index > firstUnknown;
|
|
6520
|
+
if (token.kind === "sentinel")
|
|
6521
|
+
continue;
|
|
6522
|
+
if (token.kind === "operand") {
|
|
6523
|
+
const claimable = !pastUnknown && fillsPositionals && nextPositional < registered.length;
|
|
6524
|
+
const name = claimable ? registered[nextPositional++].name() : undefined;
|
|
6525
|
+
visit(name || undefined, token.text);
|
|
6526
|
+
continue;
|
|
6527
|
+
}
|
|
6528
|
+
if (token.kind === "unknown") {
|
|
6529
|
+
const bare = token.flag.replace(/^-+/, "");
|
|
6530
|
+
const key = bare.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
6531
|
+
const keyable = token.flag.startsWith("--") || token.flag.length === 2;
|
|
6532
|
+
if (!pastUnknown && keyable && /^[a-z][a-z0-9-]*$/i.test(bare) && key) {
|
|
6533
|
+
visit(key, token.inlineValue ?? true);
|
|
6534
|
+
} else {
|
|
6535
|
+
visit(undefined, token.text);
|
|
6536
|
+
if (token.inlineValue !== undefined) {
|
|
6537
|
+
visit(undefined, token.inlineValue);
|
|
6538
|
+
} else if (!token.flag.startsWith("--") && token.flag.length > 2) {
|
|
6539
|
+
visit(undefined, token.flag.slice(2));
|
|
6540
|
+
}
|
|
6541
|
+
}
|
|
6542
|
+
continue;
|
|
6543
|
+
}
|
|
6544
|
+
if (pastUnknown) {
|
|
6545
|
+
visit(undefined, token.text);
|
|
6546
|
+
if (token.value !== undefined)
|
|
6547
|
+
visit(undefined, token.value);
|
|
6548
|
+
continue;
|
|
6549
|
+
}
|
|
6550
|
+
const option = token.option;
|
|
6551
|
+
const name = option.attributeName();
|
|
6552
|
+
const value = option.negate ? false : option.required || option.optional ? token.value ?? true : true;
|
|
6553
|
+
const previous = repeated.get(name);
|
|
6554
|
+
if (previous) {
|
|
6555
|
+
previous.push(value);
|
|
6556
|
+
visit(name, previous);
|
|
6557
|
+
} else {
|
|
6558
|
+
repeated.set(name, [value]);
|
|
6559
|
+
visit(name, value);
|
|
6560
|
+
}
|
|
6561
|
+
}
|
|
5979
6562
|
}
|
|
5980
6563
|
function withheldArgumentValues(cmd) {
|
|
5981
6564
|
const values = [];
|
|
@@ -6026,7 +6609,7 @@ function implicitLimitViolation(cmd) {
|
|
|
6026
6609
|
function exitCodeFromProcess(fallback) {
|
|
6027
6610
|
return typeof process.exitCode === "number" ? process.exitCode : fallback;
|
|
6028
6611
|
}
|
|
6029
|
-
|
|
6612
|
+
Command2.prototype.trackedAction = function(context, fn, properties) {
|
|
6030
6613
|
const command = this;
|
|
6031
6614
|
return this.action(async (...args) => {
|
|
6032
6615
|
await loadOutputCodecsAsync({
|
|
@@ -6037,6 +6620,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6037
6620
|
const telemetryName = commandTelemetryName(commandParts);
|
|
6038
6621
|
const commandPath = commandInvocationPath(commandParts);
|
|
6039
6622
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
6623
|
+
const projectResolver = getProjectTelemetryResolver(command);
|
|
6624
|
+
const projectSession = projectResolver && !isProjectTelemetryDisabled() ? new ProjectTelemetrySession(projectResolver, command) : undefined;
|
|
6040
6625
|
markCommandStart();
|
|
6041
6626
|
const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
|
|
6042
6627
|
try {
|
|
@@ -6049,6 +6634,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6049
6634
|
if (violation) {
|
|
6050
6635
|
return Promise.reject(violation);
|
|
6051
6636
|
}
|
|
6637
|
+
if (projectSession) {
|
|
6638
|
+
return projectSession.resolve({ command, args, phase: "before" }).then(() => {
|
|
6639
|
+
attachProjectTelemetryCapture(command, projectSession);
|
|
6640
|
+
return fn(...args);
|
|
6641
|
+
});
|
|
6642
|
+
}
|
|
6052
6643
|
return fn(...args);
|
|
6053
6644
|
}));
|
|
6054
6645
|
if (error) {
|
|
@@ -6057,22 +6648,26 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6057
6648
|
const typed = error;
|
|
6058
6649
|
const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
|
|
6059
6650
|
const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
|
|
6060
|
-
const
|
|
6651
|
+
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
6652
|
+
const classified = cancellationExitCode === undefined ? await extractErrorDetails(error) : undefined;
|
|
6653
|
+
const finalResult = customResult ?? classified?.result ?? RESULTS.Failure;
|
|
6061
6654
|
const typedErrorCode = typed.errorCode ?? typed.ErrorCode;
|
|
6062
6655
|
const customErrorCode = isCliErrorCode(typedErrorCode) ? typedErrorCode : undefined;
|
|
6063
6656
|
const typedRetry = typed.retry ?? typed.Retry;
|
|
6064
6657
|
const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
|
|
6065
6658
|
const typedContext = typed.context ?? typed.Context;
|
|
6066
6659
|
const customContext = isErrorContext(typedContext) ? typedContext : undefined;
|
|
6067
|
-
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
6068
6660
|
fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
|
|
6661
|
+
const errorCode = customErrorCode ?? classified?.errorCode;
|
|
6662
|
+
const retry = customRetry ?? classified?.retry;
|
|
6663
|
+
const errorContext = customContext ?? classified?.context;
|
|
6069
6664
|
OutputFormatter.error({
|
|
6070
6665
|
Result: finalResult,
|
|
6071
|
-
...
|
|
6666
|
+
...errorCode ? { ErrorCode: errorCode } : {},
|
|
6072
6667
|
Message: errorMessage,
|
|
6073
6668
|
Instructions: customInstructions ?? commandHelpHint(commandPath),
|
|
6074
|
-
...
|
|
6075
|
-
...
|
|
6669
|
+
...retry ? { Retry: retry } : {},
|
|
6670
|
+
...errorContext ? { Context: errorContext } : {}
|
|
6076
6671
|
});
|
|
6077
6672
|
context.exit(fallbackExitCode);
|
|
6078
6673
|
}
|
|
@@ -6081,6 +6676,14 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6081
6676
|
const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
|
|
6082
6677
|
const recordedFailure = takeRecordedCommandFailureTelemetry();
|
|
6083
6678
|
const success = !error && exitCode === 0;
|
|
6679
|
+
if (projectSession) {
|
|
6680
|
+
await projectSession.resolve({
|
|
6681
|
+
command,
|
|
6682
|
+
args,
|
|
6683
|
+
phase: "after",
|
|
6684
|
+
success
|
|
6685
|
+
});
|
|
6686
|
+
}
|
|
6084
6687
|
const terminalTelemetry = buildCommandTerminalTelemetryProperties({
|
|
6085
6688
|
error,
|
|
6086
6689
|
exitCode,
|
|
@@ -6098,6 +6701,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6098
6701
|
}
|
|
6099
6702
|
const baseProperties = redactProperties({
|
|
6100
6703
|
...commandParams,
|
|
6704
|
+
...projectSession?.properties(),
|
|
6101
6705
|
...props,
|
|
6102
6706
|
...buildCommandTelemetryAttribution(commandPath, process.env.UIPATH_SKILL),
|
|
6103
6707
|
...buildAgentSessionTelemetry(process.env),
|
|
@@ -6108,6 +6712,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6108
6712
|
});
|
|
6109
6713
|
emitInvocationRequest(telemetryName, success, baseProperties);
|
|
6110
6714
|
} finally {
|
|
6715
|
+
if (projectSession)
|
|
6716
|
+
attachProjectTelemetryCapture(command, undefined);
|
|
6111
6717
|
releaseSuppliedArgumentValues(supplied);
|
|
6112
6718
|
}
|
|
6113
6719
|
});
|
|
@@ -6318,75 +6924,6 @@ var RESERVED_KEYWORDS_LOWER = new Set([
|
|
|
6318
6924
|
"writeonly",
|
|
6319
6925
|
"xor"
|
|
6320
6926
|
]);
|
|
6321
|
-
// ../../common/src/error-instructions.ts
|
|
6322
|
-
function extractHttpStatus(err) {
|
|
6323
|
-
if (!err || typeof err !== "object")
|
|
6324
|
-
return;
|
|
6325
|
-
const e = err;
|
|
6326
|
-
const structured = e.response?.status ?? e.status ?? e.statusCode;
|
|
6327
|
-
if (structured !== undefined)
|
|
6328
|
-
return structured;
|
|
6329
|
-
return typeof e.message === "string" ? parseHttpStatusFromMessage(e.message) : undefined;
|
|
6330
|
-
}
|
|
6331
|
-
var GENERIC = "Check authentication and parameters";
|
|
6332
|
-
function instructionsFor(ctx, err) {
|
|
6333
|
-
switch (ctx) {
|
|
6334
|
-
case "auth":
|
|
6335
|
-
return "Run 'uip login' to authenticate. To inspect the current session, run 'uip whoami'.";
|
|
6336
|
-
case "identity":
|
|
6337
|
-
return "Select an active tenant with 'uip login tenant set <tenant>' and ensure your login includes an organization";
|
|
6338
|
-
case "input-parse":
|
|
6339
|
-
return "Ensure --inputs is valid JSON or pipe JSON via stdin";
|
|
6340
|
-
case "input-validate":
|
|
6341
|
-
return "Fix the flagged input fields to match the process's input schema";
|
|
6342
|
-
case "flag-format":
|
|
6343
|
-
return "Check the flag value format — see --help for the expected shape";
|
|
6344
|
-
case "permissions":
|
|
6345
|
-
return "Confirm your user has the required permissions in this folder/tenant, or re-authenticate with 'uip login' if your session has lapsed";
|
|
6346
|
-
case "backend": {
|
|
6347
|
-
const status = extractHttpStatus(err);
|
|
6348
|
-
if (status === 401) {
|
|
6349
|
-
return "Re-authenticate with 'uip login' — your session is invalid or expired";
|
|
6350
|
-
}
|
|
6351
|
-
if (status === 403) {
|
|
6352
|
-
return "Confirm your user has access to the resource, and the required permissions in this folder or tenant";
|
|
6353
|
-
}
|
|
6354
|
-
if (status === 404) {
|
|
6355
|
-
return "Verify the resource exists in the current folder/tenant";
|
|
6356
|
-
}
|
|
6357
|
-
if (status === 400 || status === 422) {
|
|
6358
|
-
return "Request was rejected — check flag values and inputs";
|
|
6359
|
-
}
|
|
6360
|
-
if (status === 405) {
|
|
6361
|
-
return "Check the command name and the base URL in use — the endpoint may not exist";
|
|
6362
|
-
}
|
|
6363
|
-
if (status === 408) {
|
|
6364
|
-
return "The request timed out — retry; if it persists, narrow the request (e.g. --limit on list commands)";
|
|
6365
|
-
}
|
|
6366
|
-
if (status === 409) {
|
|
6367
|
-
return "The resource already exists, or changed since it was read — list it to see the current state";
|
|
6368
|
-
}
|
|
6369
|
-
if (status === 413) {
|
|
6370
|
-
return "The upload is over the size limit — exclude unused dependencies or drop large files, then retry";
|
|
6371
|
-
}
|
|
6372
|
-
if (status === 429) {
|
|
6373
|
-
return "Rate limit reached — wait and retry; when the service suggests a delay, Retry and Context.retryAfter carry it";
|
|
6374
|
-
}
|
|
6375
|
-
if (status !== undefined && status >= 500 && status < 600) {
|
|
6376
|
-
return "The service returned a server error — retry; if it persists, check service status";
|
|
6377
|
-
}
|
|
6378
|
-
const permission = describePermissionError(err);
|
|
6379
|
-
if (permission) {
|
|
6380
|
-
return permission.instructions;
|
|
6381
|
-
}
|
|
6382
|
-
const connectivity = describeConnectivityError(err);
|
|
6383
|
-
if (connectivity) {
|
|
6384
|
-
return connectivity.instructions;
|
|
6385
|
-
}
|
|
6386
|
-
return GENERIC;
|
|
6387
|
-
}
|
|
6388
|
-
}
|
|
6389
|
-
}
|
|
6390
6927
|
// ../../common/src/guid.ts
|
|
6391
6928
|
var GUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
6392
6929
|
function isGuid(value) {
|
|
@@ -6614,6 +7151,6 @@ function installSdkUserAgentHeader(BaseApiClass, userAgent) {
|
|
|
6614
7151
|
var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
|
|
6615
7152
|
// ../../common/src/tool-provider.ts
|
|
6616
7153
|
var factorySlot = singleton("PackagerFactoryProvider");
|
|
6617
|
-
export { getFileSystem, catchError, extractErrorDetails, extractErrorMessage,
|
|
7154
|
+
export { __commonJS, __require, getFileSystem, catchError, extractErrorDetails, extractErrorMessage, hasIdentityInstructionContext, instructionsFor, RESULTS, authContextFailure, InvalidArgumentError, Option, logger, EXIT_CODES, OutputFormatter, processContext, DEFAULT_PAGE_SIZE, isGuid, stripHostGlobalOptions, resolveDeprecatedOptionAlias, warnDeprecatedOptionAlias, createHiddenDeprecatedTenantOption, parseLimit, splitScopeList, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader };
|
|
6618
7155
|
|
|
6619
|
-
//# debugId=
|
|
7156
|
+
//# debugId=3580666AE31B33D264756E2164756E21
|