@uipath/resourcecatalog-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-xnzgkhtg.js → index-x4997kvr.js} +2 -22
- package/dist/index.js +6 -7
- package/dist/{jmespath-drx4ffp3.js → jmespath-09m00b2f.js} +1 -1
- package/dist/{js-yaml-71wj4em9.js → js-yaml-cr6n3g9w.js} +1 -3
- package/dist/{tool-1de529jm.js → tool-epsr41wx.js} +12 -3
- package/dist/{tool-vkw2stpg.js → tool-wz0aqz49.js} +1147 -627
- package/dist/tool.js +6 -7
- package/package.json +2 -2
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
+
__toESM,
|
|
2
3
|
__commonJS,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "./tool-
|
|
4
|
+
__exportCjs,
|
|
5
|
+
__require
|
|
6
|
+
} from "./tool-epsr41wx.js";
|
|
6
7
|
|
|
7
8
|
// ../../../node_modules/commander/lib/error.js
|
|
8
9
|
var require_error = __commonJS(function(exports) {
|
|
@@ -124,7 +125,7 @@ var require_help = __commonJS(function(exports) {
|
|
|
124
125
|
this.helpWidth = this.helpWidth ?? contextOptions.helpWidth ?? 80;
|
|
125
126
|
}
|
|
126
127
|
visibleCommands(cmd) {
|
|
127
|
-
const visibleCommands = cmd.commands.filter((
|
|
128
|
+
const visibleCommands = cmd.commands.filter((cmd) => !cmd._hidden);
|
|
128
129
|
const helpCommand = cmd._getHelpCommand();
|
|
129
130
|
if (helpCommand && !helpCommand._hidden) {
|
|
130
131
|
visibleCommands.push(helpCommand);
|
|
@@ -604,8 +605,8 @@ var require_option = __commonJS(function(exports) {
|
|
|
604
605
|
}
|
|
605
606
|
}
|
|
606
607
|
function camelcase(str) {
|
|
607
|
-
return str.split("-").reduce((
|
|
608
|
-
return
|
|
608
|
+
return str.split("-").reduce((str, word) => {
|
|
609
|
+
return str + word[0].toUpperCase() + word.slice(1);
|
|
609
610
|
});
|
|
610
611
|
}
|
|
611
612
|
function splitOptionFlags(flags) {
|
|
@@ -726,8 +727,8 @@ var require_suggestSimilar = __commonJS(function(exports) {
|
|
|
726
727
|
var require_command = __commonJS(function(exports) {
|
|
727
728
|
var EventEmitter = __require("node:events").EventEmitter;
|
|
728
729
|
var childProcess = __require("node:child_process");
|
|
729
|
-
var
|
|
730
|
-
var
|
|
730
|
+
var path = __require("node:path");
|
|
731
|
+
var fs = __require("node:fs");
|
|
731
732
|
var process2 = __require("node:process");
|
|
732
733
|
var { Argument, humanReadableArgName } = require_argument();
|
|
733
734
|
var { CommanderError } = require_error();
|
|
@@ -1176,44 +1177,44 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1176
1177
|
});
|
|
1177
1178
|
return source;
|
|
1178
1179
|
}
|
|
1179
|
-
_prepareUserArgs(
|
|
1180
|
-
if (
|
|
1180
|
+
_prepareUserArgs(argv2, parseOptions) {
|
|
1181
|
+
if (argv2 !== undefined && !Array.isArray(argv2)) {
|
|
1181
1182
|
throw new Error("first parameter to parse must be array or undefined");
|
|
1182
1183
|
}
|
|
1183
1184
|
parseOptions = parseOptions || {};
|
|
1184
|
-
if (
|
|
1185
|
+
if (argv2 === undefined && parseOptions.from === undefined) {
|
|
1185
1186
|
if (process2.versions?.electron) {
|
|
1186
1187
|
parseOptions.from = "electron";
|
|
1187
1188
|
}
|
|
1188
|
-
const
|
|
1189
|
-
if (
|
|
1189
|
+
const execArgv2 = process2.execArgv ?? [];
|
|
1190
|
+
if (execArgv2.includes("-e") || execArgv2.includes("--eval") || execArgv2.includes("-p") || execArgv2.includes("--print")) {
|
|
1190
1191
|
parseOptions.from = "eval";
|
|
1191
1192
|
}
|
|
1192
1193
|
}
|
|
1193
|
-
if (
|
|
1194
|
-
|
|
1194
|
+
if (argv2 === undefined) {
|
|
1195
|
+
argv2 = process2.argv;
|
|
1195
1196
|
}
|
|
1196
|
-
this.rawArgs =
|
|
1197
|
+
this.rawArgs = argv2.slice();
|
|
1197
1198
|
let userArgs;
|
|
1198
1199
|
switch (parseOptions.from) {
|
|
1199
1200
|
case undefined:
|
|
1200
1201
|
case "node":
|
|
1201
|
-
this._scriptPath =
|
|
1202
|
-
userArgs =
|
|
1202
|
+
this._scriptPath = argv2[1];
|
|
1203
|
+
userArgs = argv2.slice(2);
|
|
1203
1204
|
break;
|
|
1204
1205
|
case "electron":
|
|
1205
1206
|
if (process2.defaultApp) {
|
|
1206
|
-
this._scriptPath =
|
|
1207
|
-
userArgs =
|
|
1207
|
+
this._scriptPath = argv2[1];
|
|
1208
|
+
userArgs = argv2.slice(2);
|
|
1208
1209
|
} else {
|
|
1209
|
-
userArgs =
|
|
1210
|
+
userArgs = argv2.slice(1);
|
|
1210
1211
|
}
|
|
1211
1212
|
break;
|
|
1212
1213
|
case "user":
|
|
1213
|
-
userArgs =
|
|
1214
|
+
userArgs = argv2.slice(0);
|
|
1214
1215
|
break;
|
|
1215
1216
|
case "eval":
|
|
1216
|
-
userArgs =
|
|
1217
|
+
userArgs = argv2.slice(1);
|
|
1217
1218
|
break;
|
|
1218
1219
|
default:
|
|
1219
1220
|
throw new Error(`unexpected parse option { from: '${parseOptions.from}' }`);
|
|
@@ -1262,7 +1263,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1262
1263
|
this.processedArgs = [];
|
|
1263
1264
|
}
|
|
1264
1265
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
1265
|
-
if (
|
|
1266
|
+
if (fs.existsSync(executableFile))
|
|
1266
1267
|
return;
|
|
1267
1268
|
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
1269
|
const executableMissing = `'${executableFile}' does not exist
|
|
@@ -1276,12 +1277,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1276
1277
|
let launchWithNode = false;
|
|
1277
1278
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1278
1279
|
function findFile(baseDir, baseName) {
|
|
1279
|
-
const localBin =
|
|
1280
|
-
if (
|
|
1280
|
+
const localBin = path.resolve(baseDir, baseName);
|
|
1281
|
+
if (fs.existsSync(localBin))
|
|
1281
1282
|
return localBin;
|
|
1282
|
-
if (sourceExt.includes(
|
|
1283
|
+
if (sourceExt.includes(path.extname(baseName)))
|
|
1283
1284
|
return;
|
|
1284
|
-
const foundExt = sourceExt.find((ext) =>
|
|
1285
|
+
const foundExt = sourceExt.find((ext) => fs.existsSync(`${localBin}${ext}`));
|
|
1285
1286
|
if (foundExt)
|
|
1286
1287
|
return `${localBin}${foundExt}`;
|
|
1287
1288
|
return;
|
|
@@ -1293,23 +1294,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1293
1294
|
if (this._scriptPath) {
|
|
1294
1295
|
let resolvedScriptPath;
|
|
1295
1296
|
try {
|
|
1296
|
-
resolvedScriptPath =
|
|
1297
|
+
resolvedScriptPath = fs.realpathSync(this._scriptPath);
|
|
1297
1298
|
} catch {
|
|
1298
1299
|
resolvedScriptPath = this._scriptPath;
|
|
1299
1300
|
}
|
|
1300
|
-
executableDir =
|
|
1301
|
+
executableDir = path.resolve(path.dirname(resolvedScriptPath), executableDir);
|
|
1301
1302
|
}
|
|
1302
1303
|
if (executableDir) {
|
|
1303
1304
|
let localFile = findFile(executableDir, executableFile);
|
|
1304
1305
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1305
|
-
const legacyName =
|
|
1306
|
+
const legacyName = path.basename(this._scriptPath, path.extname(this._scriptPath));
|
|
1306
1307
|
if (legacyName !== this._name) {
|
|
1307
1308
|
localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
|
|
1308
1309
|
}
|
|
1309
1310
|
}
|
|
1310
1311
|
executableFile = localFile || executableFile;
|
|
1311
1312
|
}
|
|
1312
|
-
launchWithNode = sourceExt.includes(
|
|
1313
|
+
launchWithNode = sourceExt.includes(path.extname(executableFile));
|
|
1313
1314
|
let proc;
|
|
1314
1315
|
if (process2.platform !== "win32") {
|
|
1315
1316
|
if (launchWithNode) {
|
|
@@ -1736,18 +1737,18 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1736
1737
|
this.error(message, { code: "commander.missingMandatoryOptionValue" });
|
|
1737
1738
|
}
|
|
1738
1739
|
_conflictingOption(option, conflictingOption) {
|
|
1739
|
-
const findBestOptionFromValue = (
|
|
1740
|
-
const optionKey =
|
|
1740
|
+
const findBestOptionFromValue = (option) => {
|
|
1741
|
+
const optionKey = option.attributeName();
|
|
1741
1742
|
const optionValue = this.getOptionValue(optionKey);
|
|
1742
1743
|
const negativeOption = this.options.find((target) => target.negate && optionKey === target.attributeName());
|
|
1743
1744
|
const positiveOption = this.options.find((target) => !target.negate && optionKey === target.attributeName());
|
|
1744
1745
|
if (negativeOption && (negativeOption.presetArg === undefined && optionValue === false || negativeOption.presetArg !== undefined && optionValue === negativeOption.presetArg)) {
|
|
1745
1746
|
return negativeOption;
|
|
1746
1747
|
}
|
|
1747
|
-
return positiveOption ||
|
|
1748
|
+
return positiveOption || option;
|
|
1748
1749
|
};
|
|
1749
|
-
const getErrorMessage = (
|
|
1750
|
-
const bestOption = findBestOptionFromValue(
|
|
1750
|
+
const getErrorMessage = (option) => {
|
|
1751
|
+
const bestOption = findBestOptionFromValue(option);
|
|
1751
1752
|
const optionKey = bestOption.attributeName();
|
|
1752
1753
|
const source = this.getOptionValueSource(optionKey);
|
|
1753
1754
|
if (source === "env") {
|
|
@@ -1898,13 +1899,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1898
1899
|
cmd.helpGroup(this._defaultCommandGroup);
|
|
1899
1900
|
}
|
|
1900
1901
|
nameFromFilename(filename) {
|
|
1901
|
-
this._name =
|
|
1902
|
+
this._name = path.basename(filename, path.extname(filename));
|
|
1902
1903
|
return this;
|
|
1903
1904
|
}
|
|
1904
|
-
executableDir(
|
|
1905
|
-
if (
|
|
1905
|
+
executableDir(path) {
|
|
1906
|
+
if (path === undefined)
|
|
1906
1907
|
return this._executableDir;
|
|
1907
|
-
this._executableDir =
|
|
1908
|
+
this._executableDir = path;
|
|
1908
1909
|
return this;
|
|
1909
1910
|
}
|
|
1910
1911
|
helpInformation(contextOptions) {
|
|
@@ -2001,11 +2002,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2001
2002
|
}
|
|
2002
2003
|
help(contextOptions) {
|
|
2003
2004
|
this.outputHelp(contextOptions);
|
|
2004
|
-
let
|
|
2005
|
-
if (
|
|
2006
|
-
|
|
2005
|
+
let exitCode2 = Number(process2.exitCode ?? 0);
|
|
2006
|
+
if (exitCode2 === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
|
|
2007
|
+
exitCode2 = 1;
|
|
2007
2008
|
}
|
|
2008
|
-
this._exit(
|
|
2009
|
+
this._exit(exitCode2, "commander.help", "(outputHelp)");
|
|
2009
2010
|
}
|
|
2010
2011
|
addHelpText(position, text) {
|
|
2011
2012
|
const allowedValues = ["beforeAll", "before", "after", "afterAll"];
|
|
@@ -2076,32 +2077,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2076
2077
|
exports.Command = Command;
|
|
2077
2078
|
exports.useColor = useColor;
|
|
2078
2079
|
});
|
|
2079
|
-
|
|
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
2080
|
// package.json
|
|
2100
2081
|
var package_default = {
|
|
2101
2082
|
name: "@uipath/resourcecatalog-tool",
|
|
2102
2083
|
author: "UiPath",
|
|
2103
2084
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
2104
|
-
version: "1.
|
|
2085
|
+
version: "1.206.0-preview.282",
|
|
2105
2086
|
description: "CLI plugin for the UiPath Resource Catalog Service.",
|
|
2106
2087
|
private: false,
|
|
2107
2088
|
repository: {
|
|
@@ -2145,7 +2126,7 @@ var package_default = {
|
|
|
2145
2126
|
};
|
|
2146
2127
|
|
|
2147
2128
|
// ../../filesystem/src/node.ts
|
|
2148
|
-
import { randomUUID } from "node:crypto";
|
|
2129
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
2149
2130
|
import { existsSync } from "node:fs";
|
|
2150
2131
|
import * as fs from "node:fs/promises";
|
|
2151
2132
|
import * as os from "node:os";
|
|
@@ -2156,6 +2137,9 @@ var LOCK_MAX_WAIT_MS = 20000;
|
|
|
2156
2137
|
var LOCK_MAX_HOLD_MS = 60000;
|
|
2157
2138
|
var LOCK_RETRY_MIN_MS = 100;
|
|
2158
2139
|
var LOCK_RETRY_JITTER_MS = 200;
|
|
2140
|
+
var HASH_CHUNK_BYTES = 256 * 1024;
|
|
2141
|
+
var hashBuffers = [];
|
|
2142
|
+
var HASH_BUFFERS_KEPT = 64;
|
|
2159
2143
|
|
|
2160
2144
|
class NodeFileSystem {
|
|
2161
2145
|
path = {
|
|
@@ -2174,7 +2158,7 @@ class NodeFileSystem {
|
|
|
2174
2158
|
};
|
|
2175
2159
|
utils = {
|
|
2176
2160
|
open: async (url) => {
|
|
2177
|
-
const { default: open } = await import("./index-
|
|
2161
|
+
const { default: open } = await import("./index-x4997kvr.js");
|
|
2178
2162
|
await open(url);
|
|
2179
2163
|
}
|
|
2180
2164
|
};
|
|
@@ -2213,6 +2197,15 @@ class NodeFileSystem {
|
|
|
2213
2197
|
throw error;
|
|
2214
2198
|
}
|
|
2215
2199
|
}
|
|
2200
|
+
async readdirEntries(dirPath) {
|
|
2201
|
+
try {
|
|
2202
|
+
return await fs.readdir(dirPath, { withFileTypes: true });
|
|
2203
|
+
} catch (error) {
|
|
2204
|
+
if (this.isEnoent(error))
|
|
2205
|
+
return [];
|
|
2206
|
+
throw error;
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2216
2209
|
async stat(filePath) {
|
|
2217
2210
|
try {
|
|
2218
2211
|
const stats = await fs.stat(filePath);
|
|
@@ -2220,7 +2213,8 @@ class NodeFileSystem {
|
|
|
2220
2213
|
isFile: () => stats.isFile(),
|
|
2221
2214
|
isDirectory: () => stats.isDirectory(),
|
|
2222
2215
|
size: stats.size,
|
|
2223
|
-
mtimeMs: stats.mtimeMs
|
|
2216
|
+
mtimeMs: stats.mtimeMs,
|
|
2217
|
+
ctimeMs: stats.ctimeMs
|
|
2224
2218
|
};
|
|
2225
2219
|
} catch (error) {
|
|
2226
2220
|
if (this.isEnoent(error))
|
|
@@ -2334,6 +2328,42 @@ class NodeFileSystem {
|
|
|
2334
2328
|
throw error;
|
|
2335
2329
|
}
|
|
2336
2330
|
}
|
|
2331
|
+
async hashFile(filePath) {
|
|
2332
|
+
let handle;
|
|
2333
|
+
try {
|
|
2334
|
+
handle = await fs.open(filePath, "r");
|
|
2335
|
+
} catch (error) {
|
|
2336
|
+
if (this.isEnoent(error))
|
|
2337
|
+
return null;
|
|
2338
|
+
throw error;
|
|
2339
|
+
}
|
|
2340
|
+
const buffer = hashBuffers.pop() ?? Buffer.allocUnsafe(HASH_CHUNK_BYTES);
|
|
2341
|
+
try {
|
|
2342
|
+
const opened = await handle.stat();
|
|
2343
|
+
const stats = {
|
|
2344
|
+
isFile: () => opened.isFile(),
|
|
2345
|
+
isDirectory: () => opened.isDirectory(),
|
|
2346
|
+
size: opened.size,
|
|
2347
|
+
mtimeMs: opened.mtimeMs,
|
|
2348
|
+
ctimeMs: opened.ctimeMs
|
|
2349
|
+
};
|
|
2350
|
+
const hash = createHash("sha256");
|
|
2351
|
+
let size = 0;
|
|
2352
|
+
for (;; ) {
|
|
2353
|
+
const { bytesRead } = await handle.read(buffer, 0, buffer.byteLength, null);
|
|
2354
|
+
if (bytesRead === 0)
|
|
2355
|
+
break;
|
|
2356
|
+
hash.update(buffer.subarray(0, bytesRead));
|
|
2357
|
+
size += bytesRead;
|
|
2358
|
+
}
|
|
2359
|
+
return { sha256: hash.digest("hex"), size, stats };
|
|
2360
|
+
} finally {
|
|
2361
|
+
if (hashBuffers.length < HASH_BUFFERS_KEPT) {
|
|
2362
|
+
hashBuffers.push(buffer);
|
|
2363
|
+
}
|
|
2364
|
+
await handle.close();
|
|
2365
|
+
}
|
|
2366
|
+
}
|
|
2337
2367
|
async realpath(filePath) {
|
|
2338
2368
|
try {
|
|
2339
2369
|
return await fs.realpath(filePath);
|
|
@@ -2384,6 +2414,208 @@ class NodeFileSystem {
|
|
|
2384
2414
|
var fsInstance = new NodeFileSystem;
|
|
2385
2415
|
var getFileSystem = () => fsInstance;
|
|
2386
2416
|
|
|
2417
|
+
// ../../common/src/telemetry/telemetry-dimensions.ts
|
|
2418
|
+
var BaseDimensions = {
|
|
2419
|
+
ApplicationName: "ApplicationName",
|
|
2420
|
+
ProductVersion: "ProductVersion",
|
|
2421
|
+
InstallationId: "InstallationId",
|
|
2422
|
+
CloudUserId: "CloudUserId",
|
|
2423
|
+
CloudTenantId: "CloudTenantId",
|
|
2424
|
+
CloudOrganizationId: "CloudOrganizationId",
|
|
2425
|
+
IsInternalUser: "IsInternalUser",
|
|
2426
|
+
Environment: "Environment",
|
|
2427
|
+
BaseUrl: "BaseUrl",
|
|
2428
|
+
Region: "Region",
|
|
2429
|
+
Agent: "Agent",
|
|
2430
|
+
AgentVersion: "AgentVersion",
|
|
2431
|
+
AgentModel: "AgentModel",
|
|
2432
|
+
ToolName: "ToolName",
|
|
2433
|
+
ToolVersion: "ToolVersion",
|
|
2434
|
+
ExecutionContext: "ExecutionContext",
|
|
2435
|
+
CiProvider: "CiProvider",
|
|
2436
|
+
SessionIdSource: "SessionIdSource",
|
|
2437
|
+
SessionId: "SessionId"
|
|
2438
|
+
};
|
|
2439
|
+
var CommandDimensions = {
|
|
2440
|
+
IsCommand: "IsCommand",
|
|
2441
|
+
IsReexec: "IsReexec",
|
|
2442
|
+
CommandName: "CommandName",
|
|
2443
|
+
ExitCode: "ExitCode",
|
|
2444
|
+
TerminalOutcome: "TerminalOutcome",
|
|
2445
|
+
ErrorClass: "ErrorClass",
|
|
2446
|
+
TerminalSignal: "TerminalSignal",
|
|
2447
|
+
ErrorMessage: "ErrorMessage",
|
|
2448
|
+
SkillName: "SkillName",
|
|
2449
|
+
ProductArea: "ProductArea",
|
|
2450
|
+
Mode: "Mode"
|
|
2451
|
+
};
|
|
2452
|
+
var ProjectDimensions = {
|
|
2453
|
+
ProjectKey: "ProjectKey",
|
|
2454
|
+
ProjectType: "ProjectType",
|
|
2455
|
+
ProjectIdentityStatus: "ProjectIdentityStatus",
|
|
2456
|
+
SolutionKey: "SolutionKey",
|
|
2457
|
+
SolutionProjectKey: "SolutionProjectKey",
|
|
2458
|
+
SolutionIdentityStatus: "SolutionIdentityStatus",
|
|
2459
|
+
PreviousSolutionKey: "PreviousSolutionKey"
|
|
2460
|
+
};
|
|
2461
|
+
var GUID_KEY_DIMENSIONS = new Set([
|
|
2462
|
+
ProjectDimensions.ProjectKey,
|
|
2463
|
+
ProjectDimensions.SolutionKey,
|
|
2464
|
+
ProjectDimensions.SolutionProjectKey,
|
|
2465
|
+
ProjectDimensions.PreviousSolutionKey
|
|
2466
|
+
]);
|
|
2467
|
+
var ShipDimensions = {
|
|
2468
|
+
ShipKind: "ShipKind",
|
|
2469
|
+
Target: "Target",
|
|
2470
|
+
ProjectType: "ProjectType",
|
|
2471
|
+
ProjectTypes: "ProjectTypes",
|
|
2472
|
+
ArtifactCorrelationKey: "ArtifactCorrelationKey",
|
|
2473
|
+
PackageName: "PackageName",
|
|
2474
|
+
PackageVersion: "PackageVersion",
|
|
2475
|
+
PackageVersionKey: "PackageVersionKey",
|
|
2476
|
+
DeploymentKey: "DeploymentKey",
|
|
2477
|
+
SolutionId: "SolutionId",
|
|
2478
|
+
FolderKey: "FolderKey",
|
|
2479
|
+
FeedId: "FeedId"
|
|
2480
|
+
};
|
|
2481
|
+
var ErrorDimensions = {
|
|
2482
|
+
Result: "Result",
|
|
2483
|
+
ErrorCode: "ErrorCode",
|
|
2484
|
+
Retry: "Retry",
|
|
2485
|
+
ErrorMessage: "ErrorMessage",
|
|
2486
|
+
HttpStatus: "HttpStatus",
|
|
2487
|
+
UpstreamErrorCode: "UpstreamErrorCode"
|
|
2488
|
+
};
|
|
2489
|
+
var AuthDimensions = {
|
|
2490
|
+
AuthenticationMethod: "AuthenticationMethod",
|
|
2491
|
+
Success: "Success",
|
|
2492
|
+
Reason: "Reason"
|
|
2493
|
+
};
|
|
2494
|
+
var SkillsDimensions = {
|
|
2495
|
+
SchemaVersion: "SchemaVersion",
|
|
2496
|
+
AgentType: "AgentType",
|
|
2497
|
+
SkillsVersion: "SkillsVersion",
|
|
2498
|
+
UipSubcommand: "UipSubcommand",
|
|
2499
|
+
FileExtension: "FileExtension",
|
|
2500
|
+
SubagentModel: "SubagentModel",
|
|
2501
|
+
SubagentType: "SubagentType",
|
|
2502
|
+
PermissionMode: "PermissionMode",
|
|
2503
|
+
EffortLevel: "EffortLevel",
|
|
2504
|
+
SessionSource: "SessionSource",
|
|
2505
|
+
Outcome: "Outcome",
|
|
2506
|
+
DurationMs: "DurationMs",
|
|
2507
|
+
Source: "Source"
|
|
2508
|
+
};
|
|
2509
|
+
var PackagerDimensions = {
|
|
2510
|
+
ProjectId: "ProjectId",
|
|
2511
|
+
ProjectType: "ProjectType",
|
|
2512
|
+
SolutionId: "SolutionId"
|
|
2513
|
+
};
|
|
2514
|
+
var ScopeDimensions = {
|
|
2515
|
+
FolderId: "FolderId"
|
|
2516
|
+
};
|
|
2517
|
+
var ID_DIMENSIONS = new Set([
|
|
2518
|
+
BaseDimensions.CloudUserId,
|
|
2519
|
+
BaseDimensions.CloudTenantId,
|
|
2520
|
+
BaseDimensions.CloudOrganizationId,
|
|
2521
|
+
BaseDimensions.InstallationId,
|
|
2522
|
+
ShipDimensions.ArtifactCorrelationKey,
|
|
2523
|
+
ShipDimensions.PackageVersionKey,
|
|
2524
|
+
ShipDimensions.DeploymentKey,
|
|
2525
|
+
ShipDimensions.SolutionId,
|
|
2526
|
+
ShipDimensions.FolderKey,
|
|
2527
|
+
ShipDimensions.FeedId,
|
|
2528
|
+
PackagerDimensions.ProjectId
|
|
2529
|
+
]);
|
|
2530
|
+
var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
|
|
2531
|
+
var RESERVED_DIMENSION_NAMES = new Set([
|
|
2532
|
+
...Object.values(BaseDimensions),
|
|
2533
|
+
...Object.values(CommandDimensions),
|
|
2534
|
+
...Object.values(ShipDimensions),
|
|
2535
|
+
...Object.values(ProjectDimensions),
|
|
2536
|
+
...Object.values(ErrorDimensions),
|
|
2537
|
+
...Object.values(AuthDimensions),
|
|
2538
|
+
...Object.values(SkillsDimensions),
|
|
2539
|
+
...Object.values(PackagerDimensions),
|
|
2540
|
+
...Object.values(ScopeDimensions)
|
|
2541
|
+
]);
|
|
2542
|
+
var CURATED_DIMENSIONS = new Set([
|
|
2543
|
+
BaseDimensions.ApplicationName,
|
|
2544
|
+
BaseDimensions.ProductVersion,
|
|
2545
|
+
BaseDimensions.InstallationId,
|
|
2546
|
+
BaseDimensions.CloudUserId,
|
|
2547
|
+
BaseDimensions.CloudTenantId,
|
|
2548
|
+
BaseDimensions.CloudOrganizationId,
|
|
2549
|
+
BaseDimensions.IsInternalUser,
|
|
2550
|
+
BaseDimensions.Environment,
|
|
2551
|
+
BaseDimensions.BaseUrl,
|
|
2552
|
+
BaseDimensions.Region,
|
|
2553
|
+
BaseDimensions.Agent,
|
|
2554
|
+
BaseDimensions.AgentVersion,
|
|
2555
|
+
BaseDimensions.ToolVersion,
|
|
2556
|
+
BaseDimensions.ExecutionContext,
|
|
2557
|
+
BaseDimensions.CiProvider,
|
|
2558
|
+
BaseDimensions.SessionIdSource,
|
|
2559
|
+
BaseDimensions.SessionId,
|
|
2560
|
+
...Object.values(CommandDimensions),
|
|
2561
|
+
...Object.values(ShipDimensions),
|
|
2562
|
+
...Object.values(ProjectDimensions)
|
|
2563
|
+
]);
|
|
2564
|
+
function lowercaseIdDimensionValues(properties) {
|
|
2565
|
+
let changed = false;
|
|
2566
|
+
const result = {
|
|
2567
|
+
...properties
|
|
2568
|
+
};
|
|
2569
|
+
for (const key of Object.keys(result)) {
|
|
2570
|
+
const value = result[key];
|
|
2571
|
+
if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
|
|
2572
|
+
continue;
|
|
2573
|
+
}
|
|
2574
|
+
const lowered = value.toLowerCase();
|
|
2575
|
+
if (lowered !== value) {
|
|
2576
|
+
result[key] = lowered;
|
|
2577
|
+
changed = true;
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2580
|
+
return changed ? result : properties;
|
|
2581
|
+
}
|
|
2582
|
+
|
|
2583
|
+
// ../../common/src/telemetry/project-identity.ts
|
|
2584
|
+
function projectKey(id) {
|
|
2585
|
+
if (typeof id !== "string")
|
|
2586
|
+
return;
|
|
2587
|
+
const key = id.trim().toLowerCase().replaceAll("-", "");
|
|
2588
|
+
return /^[0-9a-f]{32}$/.test(key) ? key : undefined;
|
|
2589
|
+
}
|
|
2590
|
+
function projectIdentityProperties(identity) {
|
|
2591
|
+
const key = identity.id ? projectKey(identity.id) : undefined;
|
|
2592
|
+
return {
|
|
2593
|
+
[ProjectDimensions.ProjectIdentityStatus]: identity.status === "resolved" && !key ? "invalid" : identity.status,
|
|
2594
|
+
[ProjectDimensions.ProjectType]: identity.projectType,
|
|
2595
|
+
...identity.status === "resolved" && key ? {
|
|
2596
|
+
[ProjectDimensions.ProjectKey]: key
|
|
2597
|
+
} : {}
|
|
2598
|
+
};
|
|
2599
|
+
}
|
|
2600
|
+
var PROJECT_IDENTITY_LOOKUP_BUDGET_MS = 1000;
|
|
2601
|
+
async function withinProjectIdentityBudget(work, onTimeout) {
|
|
2602
|
+
work.catch(() => {
|
|
2603
|
+
return;
|
|
2604
|
+
});
|
|
2605
|
+
let timer;
|
|
2606
|
+
const expired = new Promise((resolve) => {
|
|
2607
|
+
timer = setTimeout(() => {
|
|
2608
|
+
onTimeout?.();
|
|
2609
|
+
resolve(undefined);
|
|
2610
|
+
}, PROJECT_IDENTITY_LOOKUP_BUDGET_MS);
|
|
2611
|
+
});
|
|
2612
|
+
try {
|
|
2613
|
+
return await Promise.race([work, expired]);
|
|
2614
|
+
} finally {
|
|
2615
|
+
clearTimeout(timer);
|
|
2616
|
+
}
|
|
2617
|
+
}
|
|
2618
|
+
|
|
2387
2619
|
// ../../common/src/telemetry/pseudonymize.ts
|
|
2388
2620
|
var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
|
|
2389
2621
|
var PSEUDONYM_HEX_LENGTH = 32;
|
|
@@ -2752,8 +2984,8 @@ function redactValueDetectors(value, maxLength = MAX_VALUE_LENGTH) {
|
|
|
2752
2984
|
return `${redactUrl(core)}${trailing}`;
|
|
2753
2985
|
});
|
|
2754
2986
|
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
2755
|
-
out = out.replace(UNC_PATH_PATTERN, (_match, before,
|
|
2756
|
-
const [core, trailing] = peelTrailingPunctuation(
|
|
2987
|
+
out = out.replace(UNC_PATH_PATTERN, (_match, before, path) => {
|
|
2988
|
+
const [core, trailing] = peelTrailingPunctuation(path);
|
|
2757
2989
|
return `${before}unc#${pseudonymize(core)}${trailing}`;
|
|
2758
2990
|
});
|
|
2759
2991
|
out = out.replace(EMAIL_PATTERN, (match) => `email#${pseudonymize(match)}`);
|
|
@@ -2847,6 +3079,8 @@ function redactProperty(name, value) {
|
|
|
2847
3079
|
if (isSensitiveName(name)) {
|
|
2848
3080
|
return REDACTED;
|
|
2849
3081
|
}
|
|
3082
|
+
if (GUID_KEY_DIMENSIONS.has(name))
|
|
3083
|
+
return projectKey(value);
|
|
2850
3084
|
if (typeof value === "boolean" || typeof value === "number") {
|
|
2851
3085
|
return value;
|
|
2852
3086
|
}
|
|
@@ -2921,6 +3155,63 @@ function settlePromiseLike(thenable) {
|
|
|
2921
3155
|
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
|
|
2922
3156
|
}
|
|
2923
3157
|
|
|
3158
|
+
// ../../common/src/error-codes.ts
|
|
3159
|
+
var CLI_ERROR_CODES = [
|
|
3160
|
+
"invalid_argument",
|
|
3161
|
+
"authentication_required",
|
|
3162
|
+
"permission_denied",
|
|
3163
|
+
"local_permission_denied",
|
|
3164
|
+
"not_found",
|
|
3165
|
+
"rate_limited",
|
|
3166
|
+
"network_error",
|
|
3167
|
+
"timeout",
|
|
3168
|
+
"server_error",
|
|
3169
|
+
"method_not_allowed",
|
|
3170
|
+
"not_supported",
|
|
3171
|
+
"configuration_error",
|
|
3172
|
+
"execution_failed",
|
|
3173
|
+
"unknown_error"
|
|
3174
|
+
];
|
|
3175
|
+
var RETRY_HINTS = [
|
|
3176
|
+
"RetryWillNotFix",
|
|
3177
|
+
"RetryLater",
|
|
3178
|
+
"RetryAfter1Second",
|
|
3179
|
+
"RetryAfter10Seconds",
|
|
3180
|
+
"RetryAfter30Seconds",
|
|
3181
|
+
"RetryAfter60Seconds"
|
|
3182
|
+
];
|
|
3183
|
+
var CLI_ERROR_CODE_VALUES = new Set(CLI_ERROR_CODES);
|
|
3184
|
+
var RETRY_HINT_VALUES = new Set(RETRY_HINTS);
|
|
3185
|
+
function isCliErrorCode(value) {
|
|
3186
|
+
return typeof value === "string" && CLI_ERROR_CODE_VALUES.has(value);
|
|
3187
|
+
}
|
|
3188
|
+
function isRetryHint(value) {
|
|
3189
|
+
return typeof value === "string" && RETRY_HINT_VALUES.has(value);
|
|
3190
|
+
}
|
|
3191
|
+
function carriedErrorCode(error) {
|
|
3192
|
+
if (!error || typeof error !== "object")
|
|
3193
|
+
return;
|
|
3194
|
+
const code = error.errorCode;
|
|
3195
|
+
return isCliErrorCode(code) ? code : undefined;
|
|
3196
|
+
}
|
|
3197
|
+
function carriedRetry(error) {
|
|
3198
|
+
if (!error || typeof error !== "object")
|
|
3199
|
+
return;
|
|
3200
|
+
const retry = error.retry;
|
|
3201
|
+
return isRetryHint(retry) ? retry : undefined;
|
|
3202
|
+
}
|
|
3203
|
+
function defaultRetryForErrorCode(errorCode) {
|
|
3204
|
+
switch (errorCode) {
|
|
3205
|
+
case "network_error":
|
|
3206
|
+
case "rate_limited":
|
|
3207
|
+
case "server_error":
|
|
3208
|
+
case "timeout":
|
|
3209
|
+
return "RetryLater";
|
|
3210
|
+
default:
|
|
3211
|
+
return "RetryWillNotFix";
|
|
3212
|
+
}
|
|
3213
|
+
}
|
|
3214
|
+
|
|
2924
3215
|
// ../../common/src/error-graph.ts
|
|
2925
3216
|
function* walkErrorGraph(error) {
|
|
2926
3217
|
const queue = [error];
|
|
@@ -2965,18 +3256,54 @@ function findHttpStatusInGraph(error) {
|
|
|
2965
3256
|
return;
|
|
2966
3257
|
}
|
|
2967
3258
|
|
|
2968
|
-
// ../../common/src/
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
3259
|
+
// ../../common/src/http-status.ts
|
|
3260
|
+
function classifyHttpStatus(status) {
|
|
3261
|
+
if (status === undefined)
|
|
3262
|
+
return;
|
|
3263
|
+
if (status === 400 || status === 409 || status === 413 || status === 422) {
|
|
3264
|
+
return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
|
|
3265
|
+
}
|
|
3266
|
+
if (status === 401) {
|
|
3267
|
+
return {
|
|
3268
|
+
errorCode: "authentication_required",
|
|
3269
|
+
retry: "RetryWillNotFix"
|
|
3270
|
+
};
|
|
3271
|
+
}
|
|
3272
|
+
if (status === 403) {
|
|
3273
|
+
return { errorCode: "permission_denied", retry: "RetryWillNotFix" };
|
|
3274
|
+
}
|
|
3275
|
+
if (status === 404) {
|
|
3276
|
+
return { errorCode: "not_found", retry: "RetryWillNotFix" };
|
|
3277
|
+
}
|
|
3278
|
+
if (status === 405) {
|
|
3279
|
+
return { errorCode: "method_not_allowed", retry: "RetryWillNotFix" };
|
|
3280
|
+
}
|
|
3281
|
+
if (status === 408) {
|
|
3282
|
+
return { errorCode: "timeout", retry: "RetryLater" };
|
|
3283
|
+
}
|
|
3284
|
+
if (status === 429) {
|
|
3285
|
+
return { errorCode: "rate_limited", retry: "RetryLater" };
|
|
3286
|
+
}
|
|
3287
|
+
if (status >= 500 && status < 600) {
|
|
3288
|
+
return { errorCode: "server_error", retry: "RetryLater" };
|
|
3289
|
+
}
|
|
3290
|
+
return;
|
|
3291
|
+
}
|
|
3292
|
+
|
|
3293
|
+
// ../../common/src/local-permission-codes.ts
|
|
3294
|
+
var LOCAL_PERMISSION_ERROR_CODES = new Set([
|
|
3295
|
+
"EACCES",
|
|
3296
|
+
"EPERM",
|
|
3297
|
+
"EROFS"
|
|
3298
|
+
]);
|
|
3299
|
+
|
|
3300
|
+
// ../../common/src/error-handler.ts
|
|
3301
|
+
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.";
|
|
3302
|
+
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.";
|
|
3303
|
+
var DEFAULT_405 = "Method Not Allowed (405). The endpoint may not exist or the base URL may be incorrect.";
|
|
2979
3304
|
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.";
|
|
3305
|
+
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.";
|
|
3306
|
+
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.";
|
|
2980
3307
|
var HTML_RESPONSE_MESSAGE = "Received HTML instead of the expected JSON response.";
|
|
2981
3308
|
var NETWORK_ERROR_CODES = new Set([
|
|
2982
3309
|
"ECONNREFUSED",
|
|
@@ -3002,8 +3329,8 @@ var TLS_ERROR_CODES = new Set([
|
|
|
3002
3329
|
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.";
|
|
3003
3330
|
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.";
|
|
3004
3331
|
var LOCAL_PERMISSION_MESSAGE_PATTERN = new RegExp(`\\b(${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})\\b`);
|
|
3005
|
-
function localPermissionInstructions(code,
|
|
3006
|
-
const target =
|
|
3332
|
+
function localPermissionInstructions(code, path) {
|
|
3333
|
+
const target = path !== undefined ? `'${path}'` : "a local file or resource";
|
|
3007
3334
|
if (code === "EROFS") {
|
|
3008
3335
|
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.";
|
|
3009
3336
|
}
|
|
@@ -3040,12 +3367,12 @@ function describePermissionError(error) {
|
|
|
3040
3367
|
const code = matchLocalPermissionCode(cur.code, message);
|
|
3041
3368
|
if (!code)
|
|
3042
3369
|
continue;
|
|
3043
|
-
const
|
|
3370
|
+
const path = localPermissionPath(cur.path, message);
|
|
3044
3371
|
return {
|
|
3045
3372
|
code,
|
|
3046
3373
|
message: message ?? code,
|
|
3047
|
-
...
|
|
3048
|
-
instructions: localPermissionInstructions(code,
|
|
3374
|
+
...path !== undefined ? { path } : {},
|
|
3375
|
+
instructions: localPermissionInstructions(code, path)
|
|
3049
3376
|
};
|
|
3050
3377
|
}
|
|
3051
3378
|
return;
|
|
@@ -3057,11 +3384,25 @@ function matchLocalPermissionCode(code, message) {
|
|
|
3057
3384
|
const match = message ? LOCAL_PERMISSION_MESSAGE_PATTERN.exec(message) : null;
|
|
3058
3385
|
return match ? match[1] : undefined;
|
|
3059
3386
|
}
|
|
3060
|
-
function localPermissionPath(
|
|
3061
|
-
if (typeof
|
|
3062
|
-
return
|
|
3387
|
+
function localPermissionPath(path, message) {
|
|
3388
|
+
if (typeof path === "string")
|
|
3389
|
+
return path;
|
|
3063
3390
|
return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
|
|
3064
3391
|
}
|
|
3392
|
+
function readHeader(response, name) {
|
|
3393
|
+
const headers = response?.headers;
|
|
3394
|
+
if (!headers || typeof headers !== "object")
|
|
3395
|
+
return;
|
|
3396
|
+
if (typeof headers.get === "function") {
|
|
3397
|
+
const value = headers.get(name);
|
|
3398
|
+
if (value)
|
|
3399
|
+
return value;
|
|
3400
|
+
}
|
|
3401
|
+
const plain = headers;
|
|
3402
|
+
const key = Object.keys(plain).find((k) => k.toLowerCase() === name.toLowerCase());
|
|
3403
|
+
const value = key === undefined ? undefined : plain[key];
|
|
3404
|
+
return typeof value === "string" && value !== "" ? value : undefined;
|
|
3405
|
+
}
|
|
3065
3406
|
function isHtmlDocument(body) {
|
|
3066
3407
|
return /^\s*(<!doctype html|<html\b)/i.test(body);
|
|
3067
3408
|
}
|
|
@@ -3078,36 +3419,9 @@ function retryHintForRetryAfter(seconds) {
|
|
|
3078
3419
|
return "RetryAfter60Seconds";
|
|
3079
3420
|
}
|
|
3080
3421
|
function classifyError(status, error) {
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
if (status === 401) {
|
|
3085
|
-
return {
|
|
3086
|
-
errorCode: "authentication_required",
|
|
3087
|
-
retry: "RetryWillNotFix"
|
|
3088
|
-
};
|
|
3089
|
-
}
|
|
3090
|
-
if (status === 403) {
|
|
3091
|
-
return { errorCode: "permission_denied", retry: "RetryWillNotFix" };
|
|
3092
|
-
}
|
|
3093
|
-
if (status === 404) {
|
|
3094
|
-
return { errorCode: "not_found", retry: "RetryWillNotFix" };
|
|
3095
|
-
}
|
|
3096
|
-
if (status === 405) {
|
|
3097
|
-
return { errorCode: "method_not_allowed", retry: "RetryWillNotFix" };
|
|
3098
|
-
}
|
|
3099
|
-
if (status === 413) {
|
|
3100
|
-
return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
|
|
3101
|
-
}
|
|
3102
|
-
if (status === 408) {
|
|
3103
|
-
return { errorCode: "timeout", retry: "RetryLater" };
|
|
3104
|
-
}
|
|
3105
|
-
if (status === 429) {
|
|
3106
|
-
return { errorCode: "rate_limited", retry: "RetryLater" };
|
|
3107
|
-
}
|
|
3108
|
-
if (status !== undefined && status >= 500 && status < 600) {
|
|
3109
|
-
return { errorCode: "server_error", retry: "RetryLater" };
|
|
3110
|
-
}
|
|
3422
|
+
const byStatus = classifyHttpStatus(status);
|
|
3423
|
+
if (byStatus)
|
|
3424
|
+
return byStatus;
|
|
3111
3425
|
if (status === undefined && describePermissionError(error)) {
|
|
3112
3426
|
return {
|
|
3113
3427
|
errorCode: "local_permission_denied",
|
|
@@ -3123,6 +3437,17 @@ function classifyError(status, error) {
|
|
|
3123
3437
|
}
|
|
3124
3438
|
return { errorCode: "unknown_error", retry: "RetryWillNotFix" };
|
|
3125
3439
|
}
|
|
3440
|
+
function withCarriedClass(inferred, error) {
|
|
3441
|
+
const errorCode = carriedErrorCode(error);
|
|
3442
|
+
const retry = carriedRetry(error);
|
|
3443
|
+
if (errorCode === undefined || errorCode === inferred.errorCode) {
|
|
3444
|
+
return {
|
|
3445
|
+
errorCode: inferred.errorCode,
|
|
3446
|
+
retry: retry ?? inferred.retry
|
|
3447
|
+
};
|
|
3448
|
+
}
|
|
3449
|
+
return { errorCode, retry: retry ?? defaultRetryForErrorCode(errorCode) };
|
|
3450
|
+
}
|
|
3126
3451
|
function formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus) {
|
|
3127
3452
|
if (extractedMessage) {
|
|
3128
3453
|
return `HTTP ${status}: ${extractedMessage}`;
|
|
@@ -3178,9 +3503,14 @@ async function extractErrorDetails(error, options) {
|
|
|
3178
3503
|
const classificationStatus = status ?? findHttpStatusInGraph(error);
|
|
3179
3504
|
const classification = classifyError(classificationStatus, error);
|
|
3180
3505
|
let retry = classification.retry;
|
|
3506
|
+
const htmlForbidden = status === 403 && rawBody !== undefined && isHtmlDocument(rawBody);
|
|
3507
|
+
const rayId = htmlForbidden ? readHeader(response, "cf-ray") : undefined;
|
|
3508
|
+
const cloudflareBlock = htmlForbidden && (rayId !== undefined || /\bcloudflare\b/i.test(readHeader(response, "server") ?? ""));
|
|
3181
3509
|
if (status === 401) {
|
|
3182
3510
|
message = DEFAULT_401;
|
|
3183
3511
|
result = "AuthenticationError";
|
|
3512
|
+
} else if (cloudflareBlock) {
|
|
3513
|
+
message = rayId ? `${CLOUDFLARE_BLOCK_403} Cloudflare Ray ID: ${rayId}.` : CLOUDFLARE_BLOCK_403;
|
|
3184
3514
|
} else if (status === 403) {
|
|
3185
3515
|
message = options?.forbiddenMessage ?? DEFAULT_403;
|
|
3186
3516
|
result = "AuthenticationError";
|
|
@@ -3228,7 +3558,9 @@ async function extractErrorDetails(error, options) {
|
|
|
3228
3558
|
}
|
|
3229
3559
|
}
|
|
3230
3560
|
let details = rawMessage;
|
|
3231
|
-
if (
|
|
3561
|
+
if (htmlForbidden) {
|
|
3562
|
+
details = cloudflareBlock ? CLOUDFLARE_BLOCK_403_INSTRUCTIONS : HTML_RESPONSE_MESSAGE;
|
|
3563
|
+
} else if (rawBody) {
|
|
3232
3564
|
if (parsedBody) {
|
|
3233
3565
|
const extra = {};
|
|
3234
3566
|
if (parsedBody.errorCode)
|
|
@@ -3262,6 +3594,8 @@ async function extractErrorDetails(error, options) {
|
|
|
3262
3594
|
}
|
|
3263
3595
|
if (parsedBody?.requestId && typeof parsedBody.requestId === "string") {
|
|
3264
3596
|
context.requestId = parsedBody.requestId;
|
|
3597
|
+
} else if (cloudflareBlock && rayId) {
|
|
3598
|
+
context.requestId = rayId;
|
|
3265
3599
|
}
|
|
3266
3600
|
if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
|
|
3267
3601
|
context.traceId = parsedBody.traceId;
|
|
@@ -3270,16 +3604,7 @@ async function extractErrorDetails(error, options) {
|
|
|
3270
3604
|
context.path = permission.path;
|
|
3271
3605
|
}
|
|
3272
3606
|
if (status === 429) {
|
|
3273
|
-
const
|
|
3274
|
-
const headersObj = resp?.headers;
|
|
3275
|
-
let retryAfterValue;
|
|
3276
|
-
if (headersObj && typeof headersObj === "object" && typeof headersObj.get === "function") {
|
|
3277
|
-
retryAfterValue = headersObj.get("retry-after") ?? undefined;
|
|
3278
|
-
}
|
|
3279
|
-
if (!retryAfterValue && headersObj && typeof headersObj === "object") {
|
|
3280
|
-
const headers = headersObj;
|
|
3281
|
-
retryAfterValue = headers["retry-after"] ?? headers["Retry-After"];
|
|
3282
|
-
}
|
|
3607
|
+
const retryAfterValue = readHeader(response, "retry-after");
|
|
3283
3608
|
if (retryAfterValue) {
|
|
3284
3609
|
const seconds = Number(retryAfterValue);
|
|
3285
3610
|
if (!Number.isNaN(seconds)) {
|
|
@@ -3313,9 +3638,8 @@ async function extractErrorDetails(error, options) {
|
|
|
3313
3638
|
}
|
|
3314
3639
|
return {
|
|
3315
3640
|
result,
|
|
3316
|
-
errorCode: classification.errorCode,
|
|
3641
|
+
...withCarriedClass({ errorCode: classification.errorCode, retry }, error),
|
|
3317
3642
|
message,
|
|
3318
|
-
retry,
|
|
3319
3643
|
details,
|
|
3320
3644
|
...hasContext ? { context } : {},
|
|
3321
3645
|
...parsedErrors ? { parsedErrors } : {}
|
|
@@ -3325,10 +3649,91 @@ async function extractErrorMessage(error, options) {
|
|
|
3325
3649
|
const { message } = await extractErrorDetails(error, options);
|
|
3326
3650
|
return message;
|
|
3327
3651
|
}
|
|
3328
|
-
// ../../common/src/
|
|
3329
|
-
|
|
3330
|
-
|
|
3652
|
+
// ../../common/src/result-types.ts
|
|
3653
|
+
var RESULTS = {
|
|
3654
|
+
Success: "Success",
|
|
3655
|
+
Failure: "Failure",
|
|
3656
|
+
ConfigError: "ConfigError",
|
|
3657
|
+
AuthenticationError: "AuthenticationError",
|
|
3658
|
+
ValidationError: "ValidationError",
|
|
3659
|
+
TimeoutError: "TimeoutError"
|
|
3660
|
+
};
|
|
3661
|
+
// ../../../node_modules/commander/index.js
|
|
3662
|
+
var exports_commander = {};
|
|
3663
|
+
__exportCjs(exports_commander, {
|
|
3664
|
+
program: () => $program,
|
|
3665
|
+
createCommand: () => $createCommand,
|
|
3666
|
+
createOption: () => $createOption,
|
|
3667
|
+
createArgument: () => $createArgument,
|
|
3668
|
+
Command: () => $Command,
|
|
3669
|
+
Option: () => $Option,
|
|
3670
|
+
Argument: () => $Argument,
|
|
3671
|
+
Help: () => $Help,
|
|
3672
|
+
CommanderError: () => $CommanderError,
|
|
3673
|
+
InvalidArgumentError: () => $InvalidArgumentError,
|
|
3674
|
+
InvalidOptionArgumentError: () => $InvalidOptionArgumentError
|
|
3675
|
+
}, {
|
|
3676
|
+
program: (value) => $program = value,
|
|
3677
|
+
createCommand: (value) => $createCommand = value,
|
|
3678
|
+
createOption: (value) => $createOption = value,
|
|
3679
|
+
createArgument: (value) => $createArgument = value,
|
|
3680
|
+
Command: (value) => $Command = value,
|
|
3681
|
+
Option: (value) => $Option = value,
|
|
3682
|
+
Argument: (value) => $Argument = value,
|
|
3683
|
+
Help: (value) => $Help = value,
|
|
3684
|
+
CommanderError: (value) => $CommanderError = value,
|
|
3685
|
+
InvalidArgumentError: (value) => $InvalidArgumentError = value,
|
|
3686
|
+
InvalidOptionArgumentError: (value) => $InvalidOptionArgumentError = value
|
|
3687
|
+
});
|
|
3688
|
+
var { Argument } = require_argument();
|
|
3689
|
+
var { Command: Command2 } = require_command();
|
|
3690
|
+
var { CommanderError, InvalidArgumentError } = require_error();
|
|
3691
|
+
var { Help } = require_help();
|
|
3692
|
+
var { Option } = require_option();
|
|
3693
|
+
var $program = new Command2;
|
|
3694
|
+
var $createCommand = (name) => new Command2(name);
|
|
3695
|
+
var $createOption = (flags, description) => new Option(flags, description);
|
|
3696
|
+
var $createArgument = (name, description) => new Argument(name, description);
|
|
3697
|
+
var $Command = Command2;
|
|
3698
|
+
var $Option = Option;
|
|
3699
|
+
var $Argument = Argument;
|
|
3700
|
+
var $Help = Help;
|
|
3701
|
+
var $CommanderError = CommanderError;
|
|
3702
|
+
var $InvalidArgumentError = InvalidArgumentError;
|
|
3703
|
+
var $InvalidOptionArgumentError = InvalidArgumentError;
|
|
3704
|
+
|
|
3705
|
+
// ../../../node_modules/commander/esm.mjs
|
|
3706
|
+
var {
|
|
3707
|
+
program,
|
|
3708
|
+
createCommand,
|
|
3709
|
+
createArgument,
|
|
3710
|
+
createOption,
|
|
3711
|
+
CommanderError: CommanderError2,
|
|
3712
|
+
InvalidArgumentError: InvalidArgumentError2,
|
|
3713
|
+
InvalidOptionArgumentError,
|
|
3714
|
+
Command,
|
|
3715
|
+
Argument: Argument2,
|
|
3716
|
+
Option: Option2,
|
|
3717
|
+
Help: Help2
|
|
3718
|
+
} = exports_commander;
|
|
3719
|
+
|
|
3720
|
+
// ../../common/src/command-examples.ts
|
|
3721
|
+
var examplesByCommand = new WeakMap;
|
|
3722
|
+
Command.prototype.examples = function(examples) {
|
|
3723
|
+
examplesByCommand.set(this, examples);
|
|
3724
|
+
return this;
|
|
3725
|
+
};
|
|
3726
|
+
// ../../common/src/preview.ts
|
|
3727
|
+
var previewSlot = singleton("PreviewBuild");
|
|
3728
|
+
function isPreviewBuild() {
|
|
3729
|
+
return previewSlot.get(false) ?? false;
|
|
3331
3730
|
}
|
|
3731
|
+
Command.prototype.previewCommand = function(nameAndArgs, opts) {
|
|
3732
|
+
if (isPreviewBuild()) {
|
|
3733
|
+
return this.command(nameAndArgs, opts);
|
|
3734
|
+
}
|
|
3735
|
+
return new Command(nameAndArgs.split(/\s+/)[0] ?? nameAndArgs);
|
|
3736
|
+
};
|
|
3332
3737
|
|
|
3333
3738
|
// ../../common/src/output-context.ts
|
|
3334
3739
|
function createStorage() {
|
|
@@ -3363,8 +3768,8 @@ function getOutputSink() {
|
|
|
3363
3768
|
|
|
3364
3769
|
// ../../common/src/logger.ts
|
|
3365
3770
|
var logFilePathSlot = singleton("logFilePath");
|
|
3366
|
-
function setGlobalLogFilePath(
|
|
3367
|
-
logFilePathSlot.set(
|
|
3771
|
+
function setGlobalLogFilePath(path) {
|
|
3772
|
+
logFilePathSlot.set(path);
|
|
3368
3773
|
}
|
|
3369
3774
|
function getGlobalLogFilePath() {
|
|
3370
3775
|
return logFilePathSlot.get("");
|
|
@@ -3432,14 +3837,14 @@ class SimpleLogger {
|
|
|
3432
3837
|
return this.fileLoggingEnabled || !!getGlobalLogFilePath();
|
|
3433
3838
|
}
|
|
3434
3839
|
writeToFile(formatted) {
|
|
3435
|
-
const
|
|
3436
|
-
if (!
|
|
3840
|
+
const path = this.logFilePath || getGlobalLogFilePath();
|
|
3841
|
+
if (!path)
|
|
3437
3842
|
return;
|
|
3438
3843
|
const timestamp = new Date().toISOString();
|
|
3439
3844
|
this.pendingWrites = Promise.all([
|
|
3440
3845
|
this.pendingWrites,
|
|
3441
3846
|
this.pendingInit
|
|
3442
|
-
]).then(() => getFileSystem().appendFile(
|
|
3847
|
+
]).then(() => getFileSystem().appendFile(path, `${timestamp} ${formatted}`).catch(() => {}));
|
|
3443
3848
|
}
|
|
3444
3849
|
write(formatted) {
|
|
3445
3850
|
if (this.isFileLoggingActive()) {
|
|
@@ -3489,17 +3894,17 @@ class SimpleLogger {
|
|
|
3489
3894
|
setGlobalLogFilePath("");
|
|
3490
3895
|
}
|
|
3491
3896
|
}
|
|
3492
|
-
setLogFile(
|
|
3493
|
-
this.logFilePath =
|
|
3494
|
-
setGlobalLogFilePath(
|
|
3495
|
-
if (!
|
|
3897
|
+
setLogFile(path) {
|
|
3898
|
+
this.logFilePath = path;
|
|
3899
|
+
setGlobalLogFilePath(path);
|
|
3900
|
+
if (!path)
|
|
3496
3901
|
return;
|
|
3497
3902
|
this.fileLoggingEnabled = true;
|
|
3498
|
-
const
|
|
3903
|
+
const fs = getFileSystem();
|
|
3499
3904
|
this.pendingInit = (async () => {
|
|
3500
3905
|
const [error] = await catchError((async () => {
|
|
3501
|
-
await
|
|
3502
|
-
await
|
|
3906
|
+
await fs.mkdir(fs.path.dirname(path));
|
|
3907
|
+
await fs.writeFile(path, "");
|
|
3503
3908
|
})());
|
|
3504
3909
|
if (error)
|
|
3505
3910
|
this.fileLoggingEnabled = false;
|
|
@@ -3547,18 +3952,111 @@ function getLogFilePath() {
|
|
|
3547
3952
|
return logger.getLogFilePath();
|
|
3548
3953
|
}
|
|
3549
3954
|
|
|
3955
|
+
// ../../common/src/timings.ts
|
|
3956
|
+
var TIMINGS_ENV_VAR = "UIP_TIMINGS";
|
|
3957
|
+
function createStorage2() {
|
|
3958
|
+
const [error, mod] = catchError(() => __require("node:async_hooks"));
|
|
3959
|
+
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
3960
|
+
return {
|
|
3961
|
+
getStore: () => {
|
|
3962
|
+
return;
|
|
3963
|
+
},
|
|
3964
|
+
run: (_store, fn) => fn()
|
|
3965
|
+
};
|
|
3966
|
+
}
|
|
3967
|
+
return new mod.AsyncLocalStorage;
|
|
3968
|
+
}
|
|
3969
|
+
var storageSlot = singleton("TimingStorage");
|
|
3970
|
+
var stateSlot = singleton("Timings");
|
|
3971
|
+
var rootStartedSlot = singleton("TimingsRootStarted");
|
|
3972
|
+
var longLivedHostSlot = singleton("TimingsLongLivedHost");
|
|
3973
|
+
var storage = storageSlot.getOrInit(createStorage2, (value) => ("getStore" in value));
|
|
3974
|
+
function newState(baseline) {
|
|
3975
|
+
return { baseline, httpMs: 0, httpCalls: 0 };
|
|
3976
|
+
}
|
|
3977
|
+
function getState() {
|
|
3978
|
+
const scoped = storage.getStore();
|
|
3979
|
+
if (scoped) {
|
|
3980
|
+
return scoped;
|
|
3981
|
+
}
|
|
3982
|
+
const pinned = livePinnedState();
|
|
3983
|
+
if (pinned !== undefined) {
|
|
3984
|
+
return pinned;
|
|
3985
|
+
}
|
|
3986
|
+
return newState(processStartIsInvocationStart() ? 0 : performance.now());
|
|
3987
|
+
}
|
|
3988
|
+
function livePinnedState() {
|
|
3989
|
+
const pinned = stateSlot.get();
|
|
3990
|
+
return pinned !== undefined && "httpCalls" in pinned && !pinned.finished ? pinned : undefined;
|
|
3991
|
+
}
|
|
3992
|
+
function processStartIsInvocationStart() {
|
|
3993
|
+
return !rootStartedSlot.get(false) && !longLivedHostSlot.get(false);
|
|
3994
|
+
}
|
|
3995
|
+
function timingsEnabled() {
|
|
3996
|
+
if (typeof process === "undefined") {
|
|
3997
|
+
return false;
|
|
3998
|
+
}
|
|
3999
|
+
const value = process.env?.[TIMINGS_ENV_VAR];
|
|
4000
|
+
if (value === undefined) {
|
|
4001
|
+
return false;
|
|
4002
|
+
}
|
|
4003
|
+
const normalized = value.trim().toLowerCase();
|
|
4004
|
+
return normalized === "1" || normalized === "true";
|
|
4005
|
+
}
|
|
4006
|
+
function recordExitCode(exitCode) {
|
|
4007
|
+
if (!timingsEnabled()) {
|
|
4008
|
+
return;
|
|
4009
|
+
}
|
|
4010
|
+
getState().exitCode = exitCode;
|
|
4011
|
+
}
|
|
4012
|
+
function invocationStartedAt() {
|
|
4013
|
+
return new Date(performance.timeOrigin + getState().baseline);
|
|
4014
|
+
}
|
|
4015
|
+
function invocationElapsedMs() {
|
|
4016
|
+
return performance.now() - getState().baseline;
|
|
4017
|
+
}
|
|
4018
|
+
function markCommandStart() {
|
|
4019
|
+
if (!timingsEnabled()) {
|
|
4020
|
+
return;
|
|
4021
|
+
}
|
|
4022
|
+
getState().commandStart = performance.now();
|
|
4023
|
+
}
|
|
4024
|
+
function recordCommandDuration(durationMs) {
|
|
4025
|
+
if (!timingsEnabled()) {
|
|
4026
|
+
return;
|
|
4027
|
+
}
|
|
4028
|
+
getState().commandMs = durationMs;
|
|
4029
|
+
}
|
|
4030
|
+
|
|
4031
|
+
// ../../common/src/exit-code.ts
|
|
4032
|
+
function setExitCode(code) {
|
|
4033
|
+
process.exitCode = code;
|
|
4034
|
+
recordExitCode(code);
|
|
4035
|
+
}
|
|
4036
|
+
var GENERIC_FAILURE_EXIT_CODE = 1;
|
|
4037
|
+
function recordCommandExit(code) {
|
|
4038
|
+
if (code === GENERIC_FAILURE_EXIT_CODE && getExitCode() !== 0) {
|
|
4039
|
+
return;
|
|
4040
|
+
}
|
|
4041
|
+
setExitCode(code);
|
|
4042
|
+
}
|
|
4043
|
+
function getExitCode() {
|
|
4044
|
+
const code = process.exitCode;
|
|
4045
|
+
return typeof code === "number" ? code : 0;
|
|
4046
|
+
}
|
|
4047
|
+
|
|
3550
4048
|
// ../../common/src/output-codecs.ts
|
|
3551
4049
|
var yamlSlot = singleton("YamlCodec");
|
|
3552
4050
|
var jmespathSlot = singleton("JmespathCodec");
|
|
3553
4051
|
async function loadOutputCodecsAsync(needed) {
|
|
3554
4052
|
const loads = [];
|
|
3555
4053
|
if (needed.yaml && yamlSlot.get() === undefined) {
|
|
3556
|
-
loads.push(import("./js-yaml-
|
|
4054
|
+
loads.push(import("./js-yaml-cr6n3g9w.js").then((mod) => {
|
|
3557
4055
|
yamlSlot.set(mod);
|
|
3558
4056
|
}));
|
|
3559
4057
|
}
|
|
3560
4058
|
if (needed.filter && jmespathSlot.get() === undefined) {
|
|
3561
|
-
loads.push(import("./jmespath-
|
|
4059
|
+
loads.push(import("./jmespath-09m00b2f.js").then((m)=>__toESM(m.default,1)).then((mod) => {
|
|
3562
4060
|
jmespathSlot.set(mod);
|
|
3563
4061
|
}));
|
|
3564
4062
|
}
|
|
@@ -3583,155 +4081,6 @@ function getOutputFilter() {
|
|
|
3583
4081
|
return filterSlot.get();
|
|
3584
4082
|
}
|
|
3585
4083
|
|
|
3586
|
-
// ../../common/src/telemetry/telemetry-dimensions.ts
|
|
3587
|
-
var BaseDimensions = {
|
|
3588
|
-
ApplicationName: "ApplicationName",
|
|
3589
|
-
ProductVersion: "ProductVersion",
|
|
3590
|
-
InstallationId: "InstallationId",
|
|
3591
|
-
CloudUserId: "CloudUserId",
|
|
3592
|
-
CloudTenantId: "CloudTenantId",
|
|
3593
|
-
CloudOrganizationId: "CloudOrganizationId",
|
|
3594
|
-
IsInternalUser: "IsInternalUser",
|
|
3595
|
-
Environment: "Environment",
|
|
3596
|
-
BaseUrl: "BaseUrl",
|
|
3597
|
-
Region: "Region",
|
|
3598
|
-
Agent: "Agent",
|
|
3599
|
-
AgentVersion: "AgentVersion",
|
|
3600
|
-
AgentModel: "AgentModel",
|
|
3601
|
-
ToolName: "ToolName",
|
|
3602
|
-
ToolVersion: "ToolVersion",
|
|
3603
|
-
ExecutionContext: "ExecutionContext",
|
|
3604
|
-
CiProvider: "CiProvider",
|
|
3605
|
-
SessionIdSource: "SessionIdSource",
|
|
3606
|
-
SessionId: "SessionId"
|
|
3607
|
-
};
|
|
3608
|
-
var CommandDimensions = {
|
|
3609
|
-
IsCommand: "IsCommand",
|
|
3610
|
-
IsReexec: "IsReexec",
|
|
3611
|
-
CommandName: "CommandName",
|
|
3612
|
-
ExitCode: "ExitCode",
|
|
3613
|
-
TerminalOutcome: "TerminalOutcome",
|
|
3614
|
-
ErrorClass: "ErrorClass",
|
|
3615
|
-
TerminalSignal: "TerminalSignal",
|
|
3616
|
-
ErrorMessage: "ErrorMessage",
|
|
3617
|
-
SkillName: "SkillName",
|
|
3618
|
-
ProductArea: "ProductArea",
|
|
3619
|
-
Mode: "Mode"
|
|
3620
|
-
};
|
|
3621
|
-
var ShipDimensions = {
|
|
3622
|
-
ShipKind: "ShipKind",
|
|
3623
|
-
Target: "Target",
|
|
3624
|
-
ProjectType: "ProjectType",
|
|
3625
|
-
ProjectTypes: "ProjectTypes",
|
|
3626
|
-
ArtifactCorrelationKey: "ArtifactCorrelationKey",
|
|
3627
|
-
PackageName: "PackageName",
|
|
3628
|
-
PackageVersion: "PackageVersion",
|
|
3629
|
-
PackageVersionKey: "PackageVersionKey",
|
|
3630
|
-
DeploymentKey: "DeploymentKey",
|
|
3631
|
-
SolutionId: "SolutionId",
|
|
3632
|
-
FolderKey: "FolderKey",
|
|
3633
|
-
FeedId: "FeedId"
|
|
3634
|
-
};
|
|
3635
|
-
var ErrorDimensions = {
|
|
3636
|
-
Result: "Result",
|
|
3637
|
-
ErrorCode: "ErrorCode",
|
|
3638
|
-
Retry: "Retry",
|
|
3639
|
-
ErrorMessage: "ErrorMessage",
|
|
3640
|
-
HttpStatus: "HttpStatus",
|
|
3641
|
-
UpstreamErrorCode: "UpstreamErrorCode"
|
|
3642
|
-
};
|
|
3643
|
-
var AuthDimensions = {
|
|
3644
|
-
AuthenticationMethod: "AuthenticationMethod",
|
|
3645
|
-
Success: "Success",
|
|
3646
|
-
Reason: "Reason"
|
|
3647
|
-
};
|
|
3648
|
-
var SkillsDimensions = {
|
|
3649
|
-
SchemaVersion: "SchemaVersion",
|
|
3650
|
-
AgentType: "AgentType",
|
|
3651
|
-
SkillsVersion: "SkillsVersion",
|
|
3652
|
-
UipSubcommand: "UipSubcommand",
|
|
3653
|
-
FileExtension: "FileExtension",
|
|
3654
|
-
SubagentModel: "SubagentModel",
|
|
3655
|
-
SubagentType: "SubagentType",
|
|
3656
|
-
PermissionMode: "PermissionMode",
|
|
3657
|
-
EffortLevel: "EffortLevel",
|
|
3658
|
-
SessionSource: "SessionSource",
|
|
3659
|
-
Outcome: "Outcome",
|
|
3660
|
-
DurationMs: "DurationMs",
|
|
3661
|
-
Source: "Source"
|
|
3662
|
-
};
|
|
3663
|
-
var PackagerDimensions = {
|
|
3664
|
-
ProjectId: "ProjectId",
|
|
3665
|
-
ProjectType: "ProjectType",
|
|
3666
|
-
SolutionId: "SolutionId"
|
|
3667
|
-
};
|
|
3668
|
-
var ScopeDimensions = {
|
|
3669
|
-
FolderId: "FolderId"
|
|
3670
|
-
};
|
|
3671
|
-
var ID_DIMENSIONS = new Set([
|
|
3672
|
-
BaseDimensions.CloudUserId,
|
|
3673
|
-
BaseDimensions.CloudTenantId,
|
|
3674
|
-
BaseDimensions.CloudOrganizationId,
|
|
3675
|
-
BaseDimensions.InstallationId,
|
|
3676
|
-
ShipDimensions.ArtifactCorrelationKey,
|
|
3677
|
-
ShipDimensions.PackageVersionKey,
|
|
3678
|
-
ShipDimensions.DeploymentKey,
|
|
3679
|
-
ShipDimensions.SolutionId,
|
|
3680
|
-
ShipDimensions.FolderKey,
|
|
3681
|
-
ShipDimensions.FeedId,
|
|
3682
|
-
PackagerDimensions.ProjectId
|
|
3683
|
-
]);
|
|
3684
|
-
var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
|
|
3685
|
-
var RESERVED_DIMENSION_NAMES = new Set([
|
|
3686
|
-
...Object.values(BaseDimensions),
|
|
3687
|
-
...Object.values(CommandDimensions),
|
|
3688
|
-
...Object.values(ShipDimensions),
|
|
3689
|
-
...Object.values(ErrorDimensions),
|
|
3690
|
-
...Object.values(AuthDimensions),
|
|
3691
|
-
...Object.values(SkillsDimensions),
|
|
3692
|
-
...Object.values(PackagerDimensions),
|
|
3693
|
-
...Object.values(ScopeDimensions)
|
|
3694
|
-
]);
|
|
3695
|
-
var CURATED_DIMENSIONS = new Set([
|
|
3696
|
-
BaseDimensions.ApplicationName,
|
|
3697
|
-
BaseDimensions.ProductVersion,
|
|
3698
|
-
BaseDimensions.InstallationId,
|
|
3699
|
-
BaseDimensions.CloudUserId,
|
|
3700
|
-
BaseDimensions.CloudTenantId,
|
|
3701
|
-
BaseDimensions.CloudOrganizationId,
|
|
3702
|
-
BaseDimensions.IsInternalUser,
|
|
3703
|
-
BaseDimensions.Environment,
|
|
3704
|
-
BaseDimensions.BaseUrl,
|
|
3705
|
-
BaseDimensions.Region,
|
|
3706
|
-
BaseDimensions.Agent,
|
|
3707
|
-
BaseDimensions.AgentVersion,
|
|
3708
|
-
BaseDimensions.ToolVersion,
|
|
3709
|
-
BaseDimensions.ExecutionContext,
|
|
3710
|
-
BaseDimensions.CiProvider,
|
|
3711
|
-
BaseDimensions.SessionIdSource,
|
|
3712
|
-
BaseDimensions.SessionId,
|
|
3713
|
-
...Object.values(CommandDimensions),
|
|
3714
|
-
...Object.values(ShipDimensions)
|
|
3715
|
-
]);
|
|
3716
|
-
function lowercaseIdDimensionValues(properties) {
|
|
3717
|
-
let changed = false;
|
|
3718
|
-
const result = {
|
|
3719
|
-
...properties
|
|
3720
|
-
};
|
|
3721
|
-
for (const key of Object.keys(result)) {
|
|
3722
|
-
const value = result[key];
|
|
3723
|
-
if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
|
|
3724
|
-
continue;
|
|
3725
|
-
}
|
|
3726
|
-
const lowered = value.toLowerCase();
|
|
3727
|
-
if (lowered !== value) {
|
|
3728
|
-
result[key] = lowered;
|
|
3729
|
-
changed = true;
|
|
3730
|
-
}
|
|
3731
|
-
}
|
|
3732
|
-
return changed ? result : properties;
|
|
3733
|
-
}
|
|
3734
|
-
|
|
3735
4084
|
// ../../common/src/telemetry/command-terminal.ts
|
|
3736
4085
|
var recordedFailureSlot = singleton("CommandTelemetryFailure");
|
|
3737
4086
|
var AUTH_ERROR_CODES = new Set([
|
|
@@ -3850,17 +4199,8 @@ function terminalSignalFor(input, outcome) {
|
|
|
3850
4199
|
}
|
|
3851
4200
|
return outcome === "cancelled" ? "SIGINT" : undefined;
|
|
3852
4201
|
}
|
|
3853
|
-
function
|
|
3854
|
-
|
|
3855
|
-
return "auth";
|
|
3856
|
-
}
|
|
3857
|
-
if (status === 400 || status === 409 || status === 422) {
|
|
3858
|
-
return "validation";
|
|
3859
|
-
}
|
|
3860
|
-
if (status === 408) {
|
|
3861
|
-
return "timeout";
|
|
3862
|
-
}
|
|
3863
|
-
return "network_http";
|
|
4202
|
+
function classifyFailingHttpStatus(status) {
|
|
4203
|
+
return classifyFromErrorCode(classifyHttpStatus(status)?.errorCode) ?? "network_http";
|
|
3864
4204
|
}
|
|
3865
4205
|
function classifyFromResult(result) {
|
|
3866
4206
|
switch (result) {
|
|
@@ -3940,7 +4280,7 @@ function classifyError2(input) {
|
|
|
3940
4280
|
}
|
|
3941
4281
|
const status = recorded?.context?.httpStatus ?? findHttpStatusInGraph(input.error);
|
|
3942
4282
|
if (status !== undefined) {
|
|
3943
|
-
return
|
|
4283
|
+
return classifyFailingHttpStatus(status);
|
|
3944
4284
|
}
|
|
3945
4285
|
return classifyFromResult(recorded?.result) ?? classifyFromErrorCode(recorded?.errorCode) ?? classifyFromError(input.error) ?? "unknown";
|
|
3946
4286
|
}
|
|
@@ -3972,6 +4312,7 @@ function buildCommandTerminalTelemetryProperties(input) {
|
|
|
3972
4312
|
var CommonTelemetryEvents = {
|
|
3973
4313
|
Start: "Application.Start",
|
|
3974
4314
|
Error: "Application.Error",
|
|
4315
|
+
ProjectActivity: "Cli.ProjectActivity",
|
|
3975
4316
|
ShipSucceeded: "Cli.ShipSucceeded"
|
|
3976
4317
|
};
|
|
3977
4318
|
|
|
@@ -4452,117 +4793,42 @@ class TelemetryService {
|
|
|
4452
4793
|
...context !== undefined ? { parentId: context.id } : {}
|
|
4453
4794
|
};
|
|
4454
4795
|
}
|
|
4455
|
-
spanFor(name, durationMs, success, properties, context) {
|
|
4456
|
-
return {
|
|
4457
|
-
name: redactSpanName(name),
|
|
4458
|
-
durationMs,
|
|
4459
|
-
success,
|
|
4460
|
-
properties: this.enrichProperties(properties),
|
|
4461
|
-
operationId: context.operationId,
|
|
4462
|
-
...context.parentId !== undefined ? { parentId: context.parentId } : {},
|
|
4463
|
-
id: context.id,
|
|
4464
|
-
...context.startedAt !== undefined ? { startedAt: context.startedAt } : {}
|
|
4465
|
-
};
|
|
4466
|
-
}
|
|
4467
|
-
enrichProperties(properties) {
|
|
4468
|
-
const globalProperties = getGlobalTelemetryProperties();
|
|
4469
|
-
const enriched = {
|
|
4470
|
-
...getExecutionContextTelemetryProperties(),
|
|
4471
|
-
...globalProperties,
|
|
4472
|
-
...this.defaultProperties,
|
|
4473
|
-
...redactProperties(properties ?? {}),
|
|
4474
|
-
[TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
|
|
4475
|
-
[BaseDimensions.SessionId]: this.telemetryProvider.getSessionId?.() ?? getTelemetrySessionId()
|
|
4476
|
-
};
|
|
4477
|
-
return lowercaseIdDimensionValues(enriched);
|
|
4478
|
-
}
|
|
4479
|
-
generateId() {
|
|
4480
|
-
const bytes = new Uint8Array(8);
|
|
4481
|
-
let hex = "";
|
|
4482
|
-
do {
|
|
4483
|
-
crypto.getRandomValues(bytes);
|
|
4484
|
-
hex = "";
|
|
4485
|
-
for (const byte of bytes) {
|
|
4486
|
-
hex += byte.toString(16).padStart(2, "0");
|
|
4487
|
-
}
|
|
4488
|
-
} while (/^0+$/.test(hex));
|
|
4489
|
-
return hex;
|
|
4490
|
-
}
|
|
4491
|
-
}
|
|
4492
|
-
// ../../common/src/timings.ts
|
|
4493
|
-
var TIMINGS_ENV_VAR = "UIP_TIMINGS";
|
|
4494
|
-
function createStorage2() {
|
|
4495
|
-
const [error, mod] = catchError(() => __require("node:async_hooks"));
|
|
4496
|
-
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
4497
|
-
return {
|
|
4498
|
-
getStore: () => {
|
|
4499
|
-
return;
|
|
4500
|
-
},
|
|
4501
|
-
run: (_store, fn) => fn()
|
|
4502
|
-
};
|
|
4503
|
-
}
|
|
4504
|
-
return new mod.AsyncLocalStorage;
|
|
4505
|
-
}
|
|
4506
|
-
var storageSlot = singleton("TimingStorage");
|
|
4507
|
-
var stateSlot = singleton("Timings");
|
|
4508
|
-
var rootStartedSlot = singleton("TimingsRootStarted");
|
|
4509
|
-
var longLivedHostSlot = singleton("TimingsLongLivedHost");
|
|
4510
|
-
var storage = storageSlot.getOrInit(createStorage2, (value) => ("getStore" in value));
|
|
4511
|
-
function newState(baseline) {
|
|
4512
|
-
return { baseline, httpMs: 0, httpCalls: 0 };
|
|
4513
|
-
}
|
|
4514
|
-
function getState() {
|
|
4515
|
-
const scoped = storage.getStore();
|
|
4516
|
-
if (scoped) {
|
|
4517
|
-
return scoped;
|
|
4518
|
-
}
|
|
4519
|
-
const pinned = livePinnedState();
|
|
4520
|
-
if (pinned !== undefined) {
|
|
4521
|
-
return pinned;
|
|
4522
|
-
}
|
|
4523
|
-
return newState(processStartIsInvocationStart() ? 0 : performance.now());
|
|
4524
|
-
}
|
|
4525
|
-
function livePinnedState() {
|
|
4526
|
-
const pinned = stateSlot.get();
|
|
4527
|
-
return pinned !== undefined && "httpCalls" in pinned && !pinned.finished ? pinned : undefined;
|
|
4528
|
-
}
|
|
4529
|
-
function processStartIsInvocationStart() {
|
|
4530
|
-
return !rootStartedSlot.get(false) && !longLivedHostSlot.get(false);
|
|
4531
|
-
}
|
|
4532
|
-
function timingsEnabled() {
|
|
4533
|
-
if (typeof process === "undefined") {
|
|
4534
|
-
return false;
|
|
4535
|
-
}
|
|
4536
|
-
const value = process.env?.[TIMINGS_ENV_VAR];
|
|
4537
|
-
if (value === undefined) {
|
|
4538
|
-
return false;
|
|
4539
|
-
}
|
|
4540
|
-
const normalized = value.trim().toLowerCase();
|
|
4541
|
-
return normalized === "1" || normalized === "true";
|
|
4542
|
-
}
|
|
4543
|
-
function recordExitCode(exitCode) {
|
|
4544
|
-
if (!timingsEnabled()) {
|
|
4545
|
-
return;
|
|
4796
|
+
spanFor(name, durationMs, success, properties, context) {
|
|
4797
|
+
return {
|
|
4798
|
+
name: redactSpanName(name),
|
|
4799
|
+
durationMs,
|
|
4800
|
+
success,
|
|
4801
|
+
properties: this.enrichProperties(properties),
|
|
4802
|
+
operationId: context.operationId,
|
|
4803
|
+
...context.parentId !== undefined ? { parentId: context.parentId } : {},
|
|
4804
|
+
id: context.id,
|
|
4805
|
+
...context.startedAt !== undefined ? { startedAt: context.startedAt } : {}
|
|
4806
|
+
};
|
|
4546
4807
|
}
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
return;
|
|
4808
|
+
enrichProperties(properties) {
|
|
4809
|
+
const globalProperties = getGlobalTelemetryProperties();
|
|
4810
|
+
const enriched = {
|
|
4811
|
+
...getExecutionContextTelemetryProperties(),
|
|
4812
|
+
...globalProperties,
|
|
4813
|
+
...this.defaultProperties,
|
|
4814
|
+
...redactProperties(properties ?? {}),
|
|
4815
|
+
[TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
|
|
4816
|
+
[BaseDimensions.SessionId]: this.telemetryProvider.getSessionId?.() ?? getTelemetrySessionId()
|
|
4817
|
+
};
|
|
4818
|
+
return lowercaseIdDimensionValues(enriched);
|
|
4558
4819
|
}
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4820
|
+
generateId() {
|
|
4821
|
+
const bytes = new Uint8Array(8);
|
|
4822
|
+
let hex = "";
|
|
4823
|
+
do {
|
|
4824
|
+
crypto.getRandomValues(bytes);
|
|
4825
|
+
hex = "";
|
|
4826
|
+
for (const byte of bytes) {
|
|
4827
|
+
hex += byte.toString(16).padStart(2, "0");
|
|
4828
|
+
}
|
|
4829
|
+
} while (/^0+$/.test(hex));
|
|
4830
|
+
return hex;
|
|
4564
4831
|
}
|
|
4565
|
-
getState().commandMs = durationMs;
|
|
4566
4832
|
}
|
|
4567
4833
|
// ../../common/src/telemetry/proxy-http-agent.ts
|
|
4568
4834
|
var slot = singleton("ProxyAuthHttpsAgent");
|
|
@@ -4570,6 +4836,15 @@ var slot = singleton("ProxyAuthHttpsAgent");
|
|
|
4570
4836
|
// ../../common/src/telemetry/node-appinsights-telemetry-provider.ts
|
|
4571
4837
|
var providerSlot = singleton("TelemetryProvider");
|
|
4572
4838
|
|
|
4839
|
+
// ../../common/src/telemetry/telemetry-config.ts
|
|
4840
|
+
function isTelemetryDisabled() {
|
|
4841
|
+
const value = process.env.UIPATH_TELEMETRY_DISABLED;
|
|
4842
|
+
return value === "1" || value === "true";
|
|
4843
|
+
}
|
|
4844
|
+
function isProjectTelemetryDisabled() {
|
|
4845
|
+
return isTelemetryDisabled() || process.env.UIPATH_PROJECT_TELEMETRY_DISABLED === "1" || process.env.UIPATH_PROJECT_TELEMETRY_DISABLED === "true";
|
|
4846
|
+
}
|
|
4847
|
+
|
|
4573
4848
|
// ../../common/src/telemetry/telemetry-spool.ts
|
|
4574
4849
|
var sidecarEntrySlot = singleton("TelemetrySidecarEntry");
|
|
4575
4850
|
var MAX_SPOOL_AGE_MS = 72 * 60 * 60 * 1000;
|
|
@@ -4605,7 +4880,6 @@ var telemetry = new Proxy({}, {
|
|
|
4605
4880
|
return typeof value === "function" ? value.bind(instance) : value;
|
|
4606
4881
|
}
|
|
4607
4882
|
});
|
|
4608
|
-
|
|
4609
4883
|
// ../../common/src/formatter.ts
|
|
4610
4884
|
var ANSI_STYLES = {
|
|
4611
4885
|
red: "\x1B[31m",
|
|
@@ -4615,46 +4889,6 @@ var ANSI_RESET = "\x1B[0m";
|
|
|
4615
4889
|
function styleLine(line, style) {
|
|
4616
4890
|
return style ? `${ANSI_STYLES[style]}${line}${ANSI_RESET}` : line;
|
|
4617
4891
|
}
|
|
4618
|
-
var CLI_ERROR_CODES = [
|
|
4619
|
-
"invalid_argument",
|
|
4620
|
-
"authentication_required",
|
|
4621
|
-
"permission_denied",
|
|
4622
|
-
"local_permission_denied",
|
|
4623
|
-
"not_found",
|
|
4624
|
-
"rate_limited",
|
|
4625
|
-
"network_error",
|
|
4626
|
-
"timeout",
|
|
4627
|
-
"server_error",
|
|
4628
|
-
"method_not_allowed",
|
|
4629
|
-
"not_supported",
|
|
4630
|
-
"configuration_error",
|
|
4631
|
-
"execution_failed",
|
|
4632
|
-
"unknown_error"
|
|
4633
|
-
];
|
|
4634
|
-
var RETRY_HINTS = [
|
|
4635
|
-
"RetryWillNotFix",
|
|
4636
|
-
"RetryLater",
|
|
4637
|
-
"RetryAfter1Second",
|
|
4638
|
-
"RetryAfter10Seconds",
|
|
4639
|
-
"RetryAfter30Seconds",
|
|
4640
|
-
"RetryAfter60Seconds"
|
|
4641
|
-
];
|
|
4642
|
-
var CLI_ERROR_CODE_VALUES = new Set(CLI_ERROR_CODES);
|
|
4643
|
-
var RETRY_HINT_VALUES = new Set(RETRY_HINTS);
|
|
4644
|
-
function isCliErrorCode(value) {
|
|
4645
|
-
return typeof value === "string" && CLI_ERROR_CODE_VALUES.has(value);
|
|
4646
|
-
}
|
|
4647
|
-
function isRetryHint(value) {
|
|
4648
|
-
return typeof value === "string" && RETRY_HINT_VALUES.has(value);
|
|
4649
|
-
}
|
|
4650
|
-
var RESULTS = {
|
|
4651
|
-
Success: "Success",
|
|
4652
|
-
Failure: "Failure",
|
|
4653
|
-
ConfigError: "ConfigError",
|
|
4654
|
-
AuthenticationError: "AuthenticationError",
|
|
4655
|
-
ValidationError: "ValidationError",
|
|
4656
|
-
TimeoutError: "TimeoutError"
|
|
4657
|
-
};
|
|
4658
4892
|
var EXIT_CODES = {
|
|
4659
4893
|
Success: 0,
|
|
4660
4894
|
Failure: 1,
|
|
@@ -4663,6 +4897,9 @@ var EXIT_CODES = {
|
|
|
4663
4897
|
ValidationError: 3,
|
|
4664
4898
|
TimeoutError: 4
|
|
4665
4899
|
};
|
|
4900
|
+
function exitCodeForResult(result) {
|
|
4901
|
+
return EXIT_CODES[result] ?? EXIT_CODES.Failure;
|
|
4902
|
+
}
|
|
4666
4903
|
function escapeNonAscii(jsonText) {
|
|
4667
4904
|
return jsonText.replace(/[\u0080-\uffff]/g, (c) => {
|
|
4668
4905
|
const hex = c.charCodeAt(0).toString(16).padStart(4, "0");
|
|
@@ -5338,8 +5575,8 @@ function carriesOnlyNulls(value) {
|
|
|
5338
5575
|
}
|
|
5339
5576
|
return false;
|
|
5340
5577
|
}
|
|
5341
|
-
function nameList(names,
|
|
5342
|
-
const shown = names.slice(0,
|
|
5578
|
+
function nameList(names, cap = 12) {
|
|
5579
|
+
const shown = names.slice(0, cap).map((n) => `\`${n}\``);
|
|
5343
5580
|
const rest = names.length - shown.length;
|
|
5344
5581
|
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
5345
5582
|
}
|
|
@@ -5476,40 +5713,11 @@ function defaultErrorCodeForResult(result) {
|
|
|
5476
5713
|
return "unknown_error";
|
|
5477
5714
|
}
|
|
5478
5715
|
}
|
|
5479
|
-
function parseHttpStatusFromMessage2(message) {
|
|
5480
|
-
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
5481
|
-
if (!match)
|
|
5482
|
-
return;
|
|
5483
|
-
const status = Number(match[1]);
|
|
5484
|
-
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
5485
|
-
}
|
|
5486
|
-
function defaultErrorCodeForHttpStatus(status) {
|
|
5487
|
-
if (status === undefined)
|
|
5488
|
-
return;
|
|
5489
|
-
if (status === 400 || status === 409 || status === 422) {
|
|
5490
|
-
return "invalid_argument";
|
|
5491
|
-
}
|
|
5492
|
-
if (status === 401)
|
|
5493
|
-
return "authentication_required";
|
|
5494
|
-
if (status === 403)
|
|
5495
|
-
return "permission_denied";
|
|
5496
|
-
if (status === 404)
|
|
5497
|
-
return "not_found";
|
|
5498
|
-
if (status === 405)
|
|
5499
|
-
return "method_not_allowed";
|
|
5500
|
-
if (status === 408)
|
|
5501
|
-
return "timeout";
|
|
5502
|
-
if (status === 429)
|
|
5503
|
-
return "rate_limited";
|
|
5504
|
-
if (status >= 500 && status < 600)
|
|
5505
|
-
return "server_error";
|
|
5506
|
-
return;
|
|
5507
|
-
}
|
|
5508
5716
|
var LOCAL_PERMISSION_TEXT_PATTERN = new RegExp(`(?:\\b|\\()(?:${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})(?::\\s|\\))`);
|
|
5509
5717
|
function defaultErrorCodeForFailure(data) {
|
|
5510
5718
|
if (data.Result === RESULTS.Failure) {
|
|
5511
|
-
const status = data.Context?.httpStatus ??
|
|
5512
|
-
const errorCode =
|
|
5719
|
+
const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage(data.Message);
|
|
5720
|
+
const errorCode = classifyHttpStatus(status)?.errorCode;
|
|
5513
5721
|
if (errorCode)
|
|
5514
5722
|
return errorCode;
|
|
5515
5723
|
if (status === undefined && (LOCAL_PERMISSION_TEXT_PATTERN.test(data.Message) || LOCAL_PERMISSION_TEXT_PATTERN.test(data.Instructions))) {
|
|
@@ -5518,17 +5726,6 @@ function defaultErrorCodeForFailure(data) {
|
|
|
5518
5726
|
}
|
|
5519
5727
|
return defaultErrorCodeForResult(data.Result);
|
|
5520
5728
|
}
|
|
5521
|
-
function defaultRetryForErrorCode(errorCode) {
|
|
5522
|
-
switch (errorCode) {
|
|
5523
|
-
case "network_error":
|
|
5524
|
-
case "rate_limited":
|
|
5525
|
-
case "server_error":
|
|
5526
|
-
case "timeout":
|
|
5527
|
-
return "RetryLater";
|
|
5528
|
-
default:
|
|
5529
|
-
return "RetryWillNotFix";
|
|
5530
|
-
}
|
|
5531
|
-
}
|
|
5532
5729
|
var OutputFormatter;
|
|
5533
5730
|
((OutputFormatter) => {
|
|
5534
5731
|
function success(data, options) {
|
|
@@ -5560,7 +5757,7 @@ var OutputFormatter;
|
|
|
5560
5757
|
data.Log ??= getLogFilePath() || undefined;
|
|
5561
5758
|
data.ErrorCode ??= defaultErrorCodeForFailure(data);
|
|
5562
5759
|
data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
|
|
5563
|
-
const exitCode =
|
|
5760
|
+
const exitCode = exitCodeForResult(data.Result);
|
|
5564
5761
|
setExitCode(exitCode);
|
|
5565
5762
|
recordCommandFailureTelemetry({
|
|
5566
5763
|
result: data.Result,
|
|
@@ -5654,39 +5851,228 @@ var OutputFormatter;
|
|
|
5654
5851
|
}
|
|
5655
5852
|
OutputFormatter.formatToString = formatToString;
|
|
5656
5853
|
})(OutputFormatter ||= {});
|
|
5657
|
-
// ../../../node_modules/commander/esm.mjs
|
|
5658
|
-
var import__ = __toESM(require_commander(), 1);
|
|
5659
|
-
var {
|
|
5660
|
-
program,
|
|
5661
|
-
createCommand,
|
|
5662
|
-
createArgument,
|
|
5663
|
-
createOption,
|
|
5664
|
-
CommanderError,
|
|
5665
|
-
InvalidArgumentError,
|
|
5666
|
-
InvalidOptionArgumentError,
|
|
5667
|
-
Command,
|
|
5668
|
-
Argument,
|
|
5669
|
-
Option,
|
|
5670
|
-
Help
|
|
5671
|
-
} = import__.default;
|
|
5672
5854
|
|
|
5673
|
-
// ../../common/src/
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5855
|
+
// ../../common/src/pass-through-tail.ts
|
|
5856
|
+
function maybeOption(arg) {
|
|
5857
|
+
return arg.length > 1 && arg[0] === "-";
|
|
5858
|
+
}
|
|
5859
|
+
function tokenizeTail(cmd, tail) {
|
|
5860
|
+
const find = (flag) => cmd.options.find((option) => option.long === flag || option.short === flag);
|
|
5861
|
+
const digitShort = cmd.options.some((option) => option.short !== undefined && /^-\d$/.test(option.short));
|
|
5862
|
+
const negativeNumber = (arg) => !digitShort && /^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg);
|
|
5863
|
+
const tokens = [];
|
|
5864
|
+
let firstUnknown = -1;
|
|
5865
|
+
let sentinel = -1;
|
|
5866
|
+
let variadic;
|
|
5867
|
+
let group;
|
|
5868
|
+
let groupIndex = 0;
|
|
5869
|
+
let i = 0;
|
|
5870
|
+
while (i < tail.length || group !== undefined) {
|
|
5871
|
+
const index = group === undefined ? i : groupIndex;
|
|
5872
|
+
const arg = group ?? tail[i++];
|
|
5873
|
+
group = undefined;
|
|
5874
|
+
if (arg === "--") {
|
|
5875
|
+
sentinel = index;
|
|
5876
|
+
tokens.push({ kind: "sentinel", index });
|
|
5877
|
+
for (let j = i;j < tail.length; j++) {
|
|
5878
|
+
tokens.push({
|
|
5879
|
+
kind: "operand",
|
|
5880
|
+
index: j,
|
|
5881
|
+
text: tail[j],
|
|
5882
|
+
literal: true
|
|
5883
|
+
});
|
|
5884
|
+
}
|
|
5885
|
+
break;
|
|
5886
|
+
}
|
|
5887
|
+
if (variadic && (!maybeOption(arg) || negativeNumber(arg))) {
|
|
5888
|
+
tokens.push({
|
|
5889
|
+
kind: "option",
|
|
5890
|
+
index,
|
|
5891
|
+
text: arg,
|
|
5892
|
+
option: variadic,
|
|
5893
|
+
value: arg
|
|
5894
|
+
});
|
|
5895
|
+
continue;
|
|
5896
|
+
}
|
|
5897
|
+
variadic = undefined;
|
|
5898
|
+
if (maybeOption(arg)) {
|
|
5899
|
+
const option = find(arg);
|
|
5900
|
+
if (option) {
|
|
5901
|
+
let value;
|
|
5902
|
+
if (option.required) {
|
|
5903
|
+
value = tail[i];
|
|
5904
|
+
if (value !== undefined)
|
|
5905
|
+
i++;
|
|
5906
|
+
} else if (option.optional) {
|
|
5907
|
+
const next = tail[i];
|
|
5908
|
+
if (next !== undefined && (!maybeOption(next) || negativeNumber(next))) {
|
|
5909
|
+
value = next;
|
|
5910
|
+
i++;
|
|
5911
|
+
}
|
|
5912
|
+
}
|
|
5913
|
+
tokens.push({
|
|
5914
|
+
kind: "option",
|
|
5915
|
+
index,
|
|
5916
|
+
text: arg,
|
|
5917
|
+
option,
|
|
5918
|
+
...value === undefined ? {} : { value }
|
|
5919
|
+
});
|
|
5920
|
+
variadic = option.variadic ? option : undefined;
|
|
5921
|
+
continue;
|
|
5922
|
+
}
|
|
5923
|
+
}
|
|
5924
|
+
if (arg.length > 2 && arg[0] === "-" && arg[1] !== "-") {
|
|
5925
|
+
const option = find(`-${arg[1]}`);
|
|
5926
|
+
if (option) {
|
|
5927
|
+
if (option.required || option.optional) {
|
|
5928
|
+
tokens.push({
|
|
5929
|
+
kind: "option",
|
|
5930
|
+
index,
|
|
5931
|
+
text: arg,
|
|
5932
|
+
option,
|
|
5933
|
+
value: arg.slice(2)
|
|
5934
|
+
});
|
|
5935
|
+
} else {
|
|
5936
|
+
tokens.push({ kind: "option", index, text: arg, option });
|
|
5937
|
+
group = `-${arg.slice(2)}`;
|
|
5938
|
+
groupIndex = index;
|
|
5939
|
+
}
|
|
5940
|
+
continue;
|
|
5941
|
+
}
|
|
5942
|
+
}
|
|
5943
|
+
if (/^--[^=]+=/.test(arg)) {
|
|
5944
|
+
const equals = arg.indexOf("=");
|
|
5945
|
+
const option = find(arg.slice(0, equals));
|
|
5946
|
+
if (option && (option.required || option.optional)) {
|
|
5947
|
+
tokens.push({
|
|
5948
|
+
kind: "option",
|
|
5949
|
+
index,
|
|
5950
|
+
text: arg,
|
|
5951
|
+
option,
|
|
5952
|
+
value: arg.slice(equals + 1)
|
|
5953
|
+
});
|
|
5954
|
+
continue;
|
|
5955
|
+
}
|
|
5956
|
+
}
|
|
5957
|
+
if (maybeOption(arg) && !negativeNumber(arg)) {
|
|
5958
|
+
const equals = arg.startsWith("--") ? arg.indexOf("=") : -1;
|
|
5959
|
+
if (firstUnknown === -1)
|
|
5960
|
+
firstUnknown = index;
|
|
5961
|
+
tokens.push({
|
|
5962
|
+
kind: "unknown",
|
|
5963
|
+
index,
|
|
5964
|
+
text: arg,
|
|
5965
|
+
flag: equals > 0 ? arg.slice(0, equals) : arg,
|
|
5966
|
+
...equals > 0 ? { inlineValue: arg.slice(equals + 1) } : {}
|
|
5967
|
+
});
|
|
5968
|
+
continue;
|
|
5969
|
+
}
|
|
5970
|
+
tokens.push({ kind: "operand", index, text: arg, literal: false });
|
|
5971
|
+
}
|
|
5972
|
+
return { tokens, firstUnknown, sentinel };
|
|
5683
5973
|
}
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5974
|
+
|
|
5975
|
+
// ../../common/src/project-telemetry.ts
|
|
5976
|
+
var RESOLVER = Symbol.for("@uipath/common/projectTelemetryResolver");
|
|
5977
|
+
var CAPTURE = Symbol.for("@uipath/common/projectTelemetryCapture");
|
|
5978
|
+
var CONTEXT_RESOLVER = Symbol.for("@uipath/common/projectContextTelemetryResolver");
|
|
5979
|
+
var RULES = Symbol.for("@uipath/common/projectTargetRules");
|
|
5980
|
+
function logSkipped(what, error) {
|
|
5981
|
+
logger.debug(`[project-telemetry] ${what} skipped: ${error instanceof Error ? error.message : String(error)}`);
|
|
5982
|
+
}
|
|
5983
|
+
function bounded(work, what) {
|
|
5984
|
+
return withinProjectIdentityBudget(work, () => logSkipped(what, `no answer within ${PROJECT_IDENTITY_LOOKUP_BUDGET_MS} ms`));
|
|
5985
|
+
}
|
|
5986
|
+
async function identityWithContext(command, identity) {
|
|
5987
|
+
const props = projectIdentityProperties(identity);
|
|
5988
|
+
if (!identity.projectDirectory || isProjectTelemetryDisabled())
|
|
5989
|
+
return props;
|
|
5990
|
+
for (let node = command;node; node = node.parent ?? undefined) {
|
|
5991
|
+
const resolver = node[CONTEXT_RESOLVER];
|
|
5992
|
+
if (typeof resolver !== "function")
|
|
5993
|
+
continue;
|
|
5994
|
+
try {
|
|
5995
|
+
return {
|
|
5996
|
+
...await resolver(identity.projectDirectory),
|
|
5997
|
+
...props
|
|
5998
|
+
};
|
|
5999
|
+
} catch (error) {
|
|
6000
|
+
logSkipped("solution context lookup", error);
|
|
6001
|
+
return props;
|
|
6002
|
+
}
|
|
5687
6003
|
}
|
|
5688
|
-
return
|
|
5689
|
-
}
|
|
6004
|
+
return props;
|
|
6005
|
+
}
|
|
6006
|
+
function getProjectTelemetryResolver(command) {
|
|
6007
|
+
for (let node = command;node; node = node.parent) {
|
|
6008
|
+
const resolver = node[RESOLVER];
|
|
6009
|
+
if (typeof resolver === "function")
|
|
6010
|
+
return resolver;
|
|
6011
|
+
}
|
|
6012
|
+
return;
|
|
6013
|
+
}
|
|
6014
|
+
function attachProjectTelemetryCapture(command, capture) {
|
|
6015
|
+
command[CAPTURE] = capture;
|
|
6016
|
+
}
|
|
6017
|
+
class ProjectTelemetrySession {
|
|
6018
|
+
resolver;
|
|
6019
|
+
command;
|
|
6020
|
+
target;
|
|
6021
|
+
props = {};
|
|
6022
|
+
explicit = false;
|
|
6023
|
+
input;
|
|
6024
|
+
constructor(resolver, command) {
|
|
6025
|
+
this.resolver = resolver;
|
|
6026
|
+
this.command = command;
|
|
6027
|
+
}
|
|
6028
|
+
async setTarget(path) {
|
|
6029
|
+
this.target = path;
|
|
6030
|
+
if (this.input) {
|
|
6031
|
+
await this.resolve({
|
|
6032
|
+
...this.input,
|
|
6033
|
+
phase: "after",
|
|
6034
|
+
success: true
|
|
6035
|
+
});
|
|
6036
|
+
this.explicit = true;
|
|
6037
|
+
}
|
|
6038
|
+
}
|
|
6039
|
+
async setIdentity(identity) {
|
|
6040
|
+
try {
|
|
6041
|
+
const props = await bounded(identityWithContext(this.command, identity), "project identity capture");
|
|
6042
|
+
if (props !== undefined)
|
|
6043
|
+
this.setProperties(props);
|
|
6044
|
+
} catch (error) {
|
|
6045
|
+
logSkipped("project identity capture", error);
|
|
6046
|
+
}
|
|
6047
|
+
}
|
|
6048
|
+
setProperties(properties) {
|
|
6049
|
+
try {
|
|
6050
|
+
this.props = { ...properties };
|
|
6051
|
+
this.explicit = true;
|
|
6052
|
+
} catch (error) {
|
|
6053
|
+
logSkipped("project identity properties", error);
|
|
6054
|
+
}
|
|
6055
|
+
}
|
|
6056
|
+
properties() {
|
|
6057
|
+
return { ...this.props };
|
|
6058
|
+
}
|
|
6059
|
+
async resolve(input) {
|
|
6060
|
+
this.input = input;
|
|
6061
|
+
if (this.explicit)
|
|
6062
|
+
return;
|
|
6063
|
+
try {
|
|
6064
|
+
const props = await bounded(this.resolver({
|
|
6065
|
+
...input,
|
|
6066
|
+
target: this.target
|
|
6067
|
+
}), `project identity (${input.phase})`);
|
|
6068
|
+
if (props !== undefined) {
|
|
6069
|
+
this.props = props;
|
|
6070
|
+
}
|
|
6071
|
+
} catch (error) {
|
|
6072
|
+
logSkipped(`project identity (${input.phase})`, error);
|
|
6073
|
+
}
|
|
6074
|
+
}
|
|
6075
|
+
}
|
|
5690
6076
|
|
|
5691
6077
|
// ../../common/src/telemetry/command-attribution.ts
|
|
5692
6078
|
var LEGACY_SKILL_NAMESPACE = "uipath:";
|
|
@@ -5932,8 +6318,7 @@ var pollSignalSlot = singleton("PollSignal");
|
|
|
5932
6318
|
var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
|
|
5933
6319
|
var processContext = {
|
|
5934
6320
|
exit: (code) => {
|
|
5935
|
-
|
|
5936
|
-
setExitCode(code);
|
|
6321
|
+
recordCommandExit(code);
|
|
5937
6322
|
},
|
|
5938
6323
|
get pollSignal() {
|
|
5939
6324
|
return pollSignalSlot.get();
|
|
@@ -5958,6 +6343,8 @@ function recordableArgValue(value, choices) {
|
|
|
5958
6343
|
function extractCommandParams(cmd) {
|
|
5959
6344
|
const params = {};
|
|
5960
6345
|
forEachSuppliedArgument(cmd, (name, value, choices, defaulted) => {
|
|
6346
|
+
if (name === undefined)
|
|
6347
|
+
return;
|
|
5961
6348
|
const recordable = recordableArgValue(value, choices);
|
|
5962
6349
|
params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = recordable === TELEMETRY_ARG_VALUE_WITHHELD && defaulted ? TELEMETRY_ARG_VALUE_DEFAULTED : recordable;
|
|
5963
6350
|
});
|
|
@@ -5973,7 +6360,8 @@ function isDefaultedPositional(cmd, index) {
|
|
|
5973
6360
|
function forEachSuppliedArgument(cmd, visit) {
|
|
5974
6361
|
const registered = cmd.registeredArguments ?? [];
|
|
5975
6362
|
const processed = cmd.processedArgs ?? [];
|
|
5976
|
-
|
|
6363
|
+
const bound = boundPositionalCount(cmd);
|
|
6364
|
+
for (let i = 0;i < bound; i++) {
|
|
5977
6365
|
const name = registered[i].name();
|
|
5978
6366
|
if (name && processed[i] !== undefined) {
|
|
5979
6367
|
visit(name, processed[i], registered[i].argChoices, isDefaultedPositional(cmd, i));
|
|
@@ -5988,6 +6376,71 @@ function forEachSuppliedArgument(cmd, visit) {
|
|
|
5988
6376
|
visit(key, value, choicesByAttribute.get(key), isDefaultedOption(cmd, key));
|
|
5989
6377
|
}
|
|
5990
6378
|
}
|
|
6379
|
+
forEachPassThroughToken(cmd, bound, (name, value) => {
|
|
6380
|
+
visit(name, value, name === undefined ? undefined : choicesByAttribute.get(name), false);
|
|
6381
|
+
});
|
|
6382
|
+
}
|
|
6383
|
+
function boundPositionalCount(cmd) {
|
|
6384
|
+
const registered = cmd.registeredArguments ?? [];
|
|
6385
|
+
if (registered.some((argument) => argument.variadic)) {
|
|
6386
|
+
return registered.length;
|
|
6387
|
+
}
|
|
6388
|
+
if ((cmd.args ?? []).length <= registered.length) {
|
|
6389
|
+
return registered.length;
|
|
6390
|
+
}
|
|
6391
|
+
const firstFlag = tokenizeTail(cmd, (cmd.args ?? []).slice(1)).tokens.find((token) => token.kind !== "operand")?.index ?? -1;
|
|
6392
|
+
return firstFlag === -1 ? registered.length : Math.min(registered.length, firstFlag + 1);
|
|
6393
|
+
}
|
|
6394
|
+
function forEachPassThroughToken(cmd, bound, visit) {
|
|
6395
|
+
const registered = cmd.registeredArguments ?? [];
|
|
6396
|
+
const fillsPositionals = !registered.some((argument) => argument.variadic);
|
|
6397
|
+
const { tokens, firstUnknown } = tokenizeTail(cmd, (cmd.args ?? []).slice(bound));
|
|
6398
|
+
const repeated = new Map;
|
|
6399
|
+
let nextPositional = bound;
|
|
6400
|
+
for (const token of tokens) {
|
|
6401
|
+
const pastUnknown = firstUnknown !== -1 && token.index > firstUnknown;
|
|
6402
|
+
if (token.kind === "sentinel")
|
|
6403
|
+
continue;
|
|
6404
|
+
if (token.kind === "operand") {
|
|
6405
|
+
const claimable = !pastUnknown && fillsPositionals && nextPositional < registered.length;
|
|
6406
|
+
const name = claimable ? registered[nextPositional++].name() : undefined;
|
|
6407
|
+
visit(name || undefined, token.text);
|
|
6408
|
+
continue;
|
|
6409
|
+
}
|
|
6410
|
+
if (token.kind === "unknown") {
|
|
6411
|
+
const bare = token.flag.replace(/^-+/, "");
|
|
6412
|
+
const key = bare.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
6413
|
+
const keyable = token.flag.startsWith("--") || token.flag.length === 2;
|
|
6414
|
+
if (!pastUnknown && keyable && /^[a-z][a-z0-9-]*$/i.test(bare) && key) {
|
|
6415
|
+
visit(key, token.inlineValue ?? true);
|
|
6416
|
+
} else {
|
|
6417
|
+
visit(undefined, token.text);
|
|
6418
|
+
if (token.inlineValue !== undefined) {
|
|
6419
|
+
visit(undefined, token.inlineValue);
|
|
6420
|
+
} else if (!token.flag.startsWith("--") && token.flag.length > 2) {
|
|
6421
|
+
visit(undefined, token.flag.slice(2));
|
|
6422
|
+
}
|
|
6423
|
+
}
|
|
6424
|
+
continue;
|
|
6425
|
+
}
|
|
6426
|
+
if (pastUnknown) {
|
|
6427
|
+
visit(undefined, token.text);
|
|
6428
|
+
if (token.value !== undefined)
|
|
6429
|
+
visit(undefined, token.value);
|
|
6430
|
+
continue;
|
|
6431
|
+
}
|
|
6432
|
+
const option = token.option;
|
|
6433
|
+
const name = option.attributeName();
|
|
6434
|
+
const value = option.negate ? false : option.required || option.optional ? token.value ?? true : true;
|
|
6435
|
+
const previous = repeated.get(name);
|
|
6436
|
+
if (previous) {
|
|
6437
|
+
previous.push(value);
|
|
6438
|
+
visit(name, previous);
|
|
6439
|
+
} else {
|
|
6440
|
+
repeated.set(name, [value]);
|
|
6441
|
+
visit(name, value);
|
|
6442
|
+
}
|
|
6443
|
+
}
|
|
5991
6444
|
}
|
|
5992
6445
|
function withheldArgumentValues(cmd) {
|
|
5993
6446
|
const values = [];
|
|
@@ -6049,6 +6502,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6049
6502
|
const telemetryName = commandTelemetryName(commandParts);
|
|
6050
6503
|
const commandPath = commandInvocationPath(commandParts);
|
|
6051
6504
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
6505
|
+
const projectResolver = getProjectTelemetryResolver(command);
|
|
6506
|
+
const projectSession = projectResolver && !isProjectTelemetryDisabled() ? new ProjectTelemetrySession(projectResolver, command) : undefined;
|
|
6052
6507
|
markCommandStart();
|
|
6053
6508
|
const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
|
|
6054
6509
|
try {
|
|
@@ -6061,6 +6516,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6061
6516
|
if (violation) {
|
|
6062
6517
|
return Promise.reject(violation);
|
|
6063
6518
|
}
|
|
6519
|
+
if (projectSession) {
|
|
6520
|
+
return projectSession.resolve({ command, args, phase: "before" }).then(() => {
|
|
6521
|
+
attachProjectTelemetryCapture(command, projectSession);
|
|
6522
|
+
return fn(...args);
|
|
6523
|
+
});
|
|
6524
|
+
}
|
|
6064
6525
|
return fn(...args);
|
|
6065
6526
|
}));
|
|
6066
6527
|
if (error) {
|
|
@@ -6069,22 +6530,26 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6069
6530
|
const typed = error;
|
|
6070
6531
|
const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
|
|
6071
6532
|
const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
|
|
6072
|
-
const
|
|
6533
|
+
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
6534
|
+
const classified = cancellationExitCode === undefined ? await extractErrorDetails(error) : undefined;
|
|
6535
|
+
const finalResult = customResult ?? classified?.result ?? RESULTS.Failure;
|
|
6073
6536
|
const typedErrorCode = typed.errorCode ?? typed.ErrorCode;
|
|
6074
6537
|
const customErrorCode = isCliErrorCode(typedErrorCode) ? typedErrorCode : undefined;
|
|
6075
6538
|
const typedRetry = typed.retry ?? typed.Retry;
|
|
6076
6539
|
const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
|
|
6077
6540
|
const typedContext = typed.context ?? typed.Context;
|
|
6078
6541
|
const customContext = isErrorContext(typedContext) ? typedContext : undefined;
|
|
6079
|
-
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
6080
6542
|
fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
|
|
6543
|
+
const errorCode = customErrorCode ?? classified?.errorCode;
|
|
6544
|
+
const retry = customRetry ?? classified?.retry;
|
|
6545
|
+
const errorContext = customContext ?? classified?.context;
|
|
6081
6546
|
OutputFormatter.error({
|
|
6082
6547
|
Result: finalResult,
|
|
6083
|
-
...
|
|
6548
|
+
...errorCode ? { ErrorCode: errorCode } : {},
|
|
6084
6549
|
Message: errorMessage,
|
|
6085
6550
|
Instructions: customInstructions ?? commandHelpHint(commandPath),
|
|
6086
|
-
...
|
|
6087
|
-
...
|
|
6551
|
+
...retry ? { Retry: retry } : {},
|
|
6552
|
+
...errorContext ? { Context: errorContext } : {}
|
|
6088
6553
|
});
|
|
6089
6554
|
context.exit(fallbackExitCode);
|
|
6090
6555
|
}
|
|
@@ -6093,6 +6558,14 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6093
6558
|
const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
|
|
6094
6559
|
const recordedFailure = takeRecordedCommandFailureTelemetry();
|
|
6095
6560
|
const success = !error && exitCode === 0;
|
|
6561
|
+
if (projectSession) {
|
|
6562
|
+
await projectSession.resolve({
|
|
6563
|
+
command,
|
|
6564
|
+
args,
|
|
6565
|
+
phase: "after",
|
|
6566
|
+
success
|
|
6567
|
+
});
|
|
6568
|
+
}
|
|
6096
6569
|
const terminalTelemetry = buildCommandTerminalTelemetryProperties({
|
|
6097
6570
|
error,
|
|
6098
6571
|
exitCode,
|
|
@@ -6110,6 +6583,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6110
6583
|
}
|
|
6111
6584
|
const baseProperties = redactProperties({
|
|
6112
6585
|
...commandParams,
|
|
6586
|
+
...projectSession?.properties(),
|
|
6113
6587
|
...props,
|
|
6114
6588
|
...buildCommandTelemetryAttribution(commandPath, process.env.UIPATH_SKILL),
|
|
6115
6589
|
...buildAgentSessionTelemetry(process.env),
|
|
@@ -6120,6 +6594,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6120
6594
|
});
|
|
6121
6595
|
emitInvocationRequest(telemetryName, success, baseProperties);
|
|
6122
6596
|
} finally {
|
|
6597
|
+
if (projectSession)
|
|
6598
|
+
attachProjectTelemetryCapture(command, undefined);
|
|
6123
6599
|
releaseSuppliedArgumentValues(supplied);
|
|
6124
6600
|
}
|
|
6125
6601
|
});
|
|
@@ -6412,7 +6888,7 @@ function warnDeprecatedOptionAlias(deprecatedFlag, preferredFlag) {
|
|
|
6412
6888
|
}
|
|
6413
6889
|
var TENANT_SWITCH_COMMAND = "uip login tenant set <tenant>";
|
|
6414
6890
|
function createHiddenDeprecatedTenantOption(flags = "-t, --tenant <tenant-name>") {
|
|
6415
|
-
return new
|
|
6891
|
+
return new Option2(flags, `Tenant name. Deprecated; use ${TENANT_SWITCH_COMMAND} to switch active tenants.`).hideHelp().argParser((tenant) => {
|
|
6416
6892
|
warnDeprecatedTenantOption(tenant);
|
|
6417
6893
|
return tenant;
|
|
6418
6894
|
});
|
|
@@ -6798,7 +7274,7 @@ var package_default2 = {
|
|
|
6798
7274
|
name: "@uipath/resourcecatalog-sdk",
|
|
6799
7275
|
author: "UiPath",
|
|
6800
7276
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
6801
|
-
version: "1.
|
|
7277
|
+
version: "1.206.0",
|
|
6802
7278
|
description: "SDK for the UiPath Resource Catalog Service API.",
|
|
6803
7279
|
repository: {
|
|
6804
7280
|
type: "git",
|
|
@@ -8340,9 +8816,9 @@ function getProfileStorage() {
|
|
|
8340
8816
|
if (isAuthProfileStorage(existing)) {
|
|
8341
8817
|
return existing;
|
|
8342
8818
|
}
|
|
8343
|
-
const
|
|
8344
|
-
globalSlot2[AUTH_PROFILE_STORAGE_KEY] =
|
|
8345
|
-
return
|
|
8819
|
+
const storage = createProfileStorage();
|
|
8820
|
+
globalSlot2[AUTH_PROFILE_STORAGE_KEY] = storage;
|
|
8821
|
+
return storage;
|
|
8346
8822
|
}
|
|
8347
8823
|
var profileStorage = getProfileStorage();
|
|
8348
8824
|
|
|
@@ -8373,8 +8849,8 @@ function resolveAuthProfileFilePath(profile) {
|
|
|
8373
8849
|
if (normalized === undefined) {
|
|
8374
8850
|
throw new AuthProfileValidationError(`"${DEFAULT_AUTH_PROFILE}" is the built-in profile and does not have a profile file path.`);
|
|
8375
8851
|
}
|
|
8376
|
-
const
|
|
8377
|
-
return
|
|
8852
|
+
const fs = getFileSystem();
|
|
8853
|
+
return fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR, normalized, AUTH_FILENAME);
|
|
8378
8854
|
}
|
|
8379
8855
|
function getActiveAuthProfileFilePath() {
|
|
8380
8856
|
const profile = getActiveAuthProfile();
|
|
@@ -8547,6 +9023,8 @@ var ENV_AUTH_VARS = {
|
|
|
8547
9023
|
};
|
|
8548
9024
|
|
|
8549
9025
|
class EnvAuthConfigError extends Error {
|
|
9026
|
+
errorCode = "configuration_error";
|
|
9027
|
+
retry = "RetryWillNotFix";
|
|
8550
9028
|
constructor(message) {
|
|
8551
9029
|
super(message);
|
|
8552
9030
|
this.name = "EnvAuthConfigError";
|
|
@@ -8585,11 +9063,11 @@ var readAuthFromEnv = () => {
|
|
|
8585
9063
|
if (!rawUrl) {
|
|
8586
9064
|
throw new EnvAuthConfigError(`${ENV_AUTH_VARS.token} is not a JWT (treating it as an opaque token, ` + `e.g. a Personal Access Token). Set ${OPAQUE_TOKEN_BASE_URL_VAR} to the ` + `UiPath base URL if this is a PAT, or fix the token if it was meant to ` + `be a JWT (parse error: ${parseErrorMessage}).`);
|
|
8587
9065
|
}
|
|
8588
|
-
const
|
|
9066
|
+
const baseUrl = resolveBaseUrl(rawUrl, `Failed to validate ${OPAQUE_TOKEN_BASE_URL_VAR}`);
|
|
8589
9067
|
return {
|
|
8590
9068
|
loginStatus: "Logged in",
|
|
8591
9069
|
accessToken,
|
|
8592
|
-
baseUrl
|
|
9070
|
+
baseUrl,
|
|
8593
9071
|
organizationName,
|
|
8594
9072
|
organizationId,
|
|
8595
9073
|
tenantName,
|
|
@@ -8630,8 +9108,8 @@ var SURFACE_WINDOW_MS = 60 * 60 * 1000;
|
|
|
8630
9108
|
async function refreshTokenFingerprint(refreshToken) {
|
|
8631
9109
|
const bytes = new TextEncoder().encode(refreshToken);
|
|
8632
9110
|
if (globalThis.crypto?.subtle) {
|
|
8633
|
-
const
|
|
8634
|
-
return Array.from(new Uint8Array(
|
|
9111
|
+
const digest = await globalThis.crypto.subtle.digest("SHA-256", bytes);
|
|
9112
|
+
return Array.from(new Uint8Array(digest), (b) => b.toString(16).padStart(2, "0")).join("").slice(0, 16);
|
|
8635
9113
|
}
|
|
8636
9114
|
const { createHash } = await import("node:crypto");
|
|
8637
9115
|
return createHash("sha256").update(refreshToken).digest("hex").slice(0, 16);
|
|
@@ -8640,9 +9118,9 @@ function breakerPathFor(authPath) {
|
|
|
8640
9118
|
return `${authPath}${BREAKER_SUFFIX}`;
|
|
8641
9119
|
}
|
|
8642
9120
|
async function loadRefreshBreaker(authPath) {
|
|
8643
|
-
const
|
|
9121
|
+
const fs = getFileSystem();
|
|
8644
9122
|
try {
|
|
8645
|
-
const content = await
|
|
9123
|
+
const content = await fs.readFile(breakerPathFor(authPath), "utf-8");
|
|
8646
9124
|
if (!content)
|
|
8647
9125
|
return {};
|
|
8648
9126
|
const parsed = JSON.parse(content);
|
|
@@ -8653,20 +9131,20 @@ async function loadRefreshBreaker(authPath) {
|
|
|
8653
9131
|
}
|
|
8654
9132
|
async function saveRefreshBreaker(authPath, state) {
|
|
8655
9133
|
try {
|
|
8656
|
-
const
|
|
8657
|
-
const
|
|
8658
|
-
await
|
|
8659
|
-
const tempPath = `${
|
|
8660
|
-
await
|
|
8661
|
-
await
|
|
9134
|
+
const fs = getFileSystem();
|
|
9135
|
+
const path = breakerPathFor(authPath);
|
|
9136
|
+
await fs.mkdir(fs.path.dirname(path));
|
|
9137
|
+
const tempPath = `${path}.tmp`;
|
|
9138
|
+
await fs.writeFile(tempPath, JSON.stringify(state));
|
|
9139
|
+
await fs.rename(tempPath, path);
|
|
8662
9140
|
} catch {}
|
|
8663
9141
|
}
|
|
8664
9142
|
async function clearRefreshBreaker(authPath) {
|
|
8665
|
-
const
|
|
8666
|
-
const
|
|
9143
|
+
const fs = getFileSystem();
|
|
9144
|
+
const path = breakerPathFor(authPath);
|
|
8667
9145
|
try {
|
|
8668
|
-
if (await
|
|
8669
|
-
await
|
|
9146
|
+
if (await fs.exists(path)) {
|
|
9147
|
+
await fs.rm(path);
|
|
8670
9148
|
}
|
|
8671
9149
|
} catch {}
|
|
8672
9150
|
}
|
|
@@ -8687,13 +9165,13 @@ var ROBOT_USER_SERVICES_PIPE = "UiPathUserServices";
|
|
|
8687
9165
|
var ROBOT_USER_SERVICES_ALTERNATE_PIPE = `${ROBOT_USER_SERVICES_PIPE}Alternate`;
|
|
8688
9166
|
var PIPE_NAME_MAX_LENGTH = 103;
|
|
8689
9167
|
var getRobotIpcPipeNames = async () => {
|
|
8690
|
-
const
|
|
8691
|
-
const username =
|
|
9168
|
+
const fs = getFileSystem();
|
|
9169
|
+
const username = fs.env.getenv("USER") ?? fs.env.getenv("USERNAME");
|
|
8692
9170
|
if (!username) {
|
|
8693
9171
|
throw new Error("Unable to determine current username");
|
|
8694
9172
|
}
|
|
8695
|
-
const tempPath =
|
|
8696
|
-
return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) =>
|
|
9173
|
+
const tempPath = fs.env.getenv("TMPDIR") ?? "/tmp/";
|
|
9174
|
+
return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) => fs.path.join(tempPath, `${baseName}_${username}`).substring(0, PIPE_NAME_MAX_LENGTH));
|
|
8697
9175
|
};
|
|
8698
9176
|
var defaultIsRobotIpcAvailable = async () => {
|
|
8699
9177
|
if (process.platform === "win32") {
|
|
@@ -8703,20 +9181,20 @@ var defaultIsRobotIpcAvailable = async () => {
|
|
|
8703
9181
|
if (pipeNamesError || !pipeNames) {
|
|
8704
9182
|
return false;
|
|
8705
9183
|
}
|
|
8706
|
-
const
|
|
9184
|
+
const fs = getFileSystem();
|
|
8707
9185
|
for (const pipeName of pipeNames) {
|
|
8708
|
-
const [existsError, exists] = await catchError2(
|
|
9186
|
+
const [existsError, exists] = await catchError2(fs.exists(pipeName));
|
|
8709
9187
|
if (!existsError && exists === true) {
|
|
8710
9188
|
return true;
|
|
8711
9189
|
}
|
|
8712
9190
|
}
|
|
8713
9191
|
return false;
|
|
8714
9192
|
};
|
|
8715
|
-
var withTimeout = (promise, timeoutMs) => new Promise((
|
|
9193
|
+
var withTimeout = (promise, timeoutMs) => new Promise((resolve, reject) => {
|
|
8716
9194
|
const timer = setTimeout(() => reject(new Error(`Robot IPC call timed out after ${timeoutMs}ms`)), timeoutMs);
|
|
8717
9195
|
promise.then((value) => {
|
|
8718
9196
|
clearTimeout(timer);
|
|
8719
|
-
|
|
9197
|
+
resolve(value);
|
|
8720
9198
|
}, (error) => {
|
|
8721
9199
|
clearTimeout(timer);
|
|
8722
9200
|
reject(error);
|
|
@@ -8889,9 +9367,12 @@ var refreshAccessToken = async ({
|
|
|
8889
9367
|
body: tokenParams
|
|
8890
9368
|
});
|
|
8891
9369
|
const tokenData = await tokenResponse.json();
|
|
8892
|
-
if (
|
|
9370
|
+
if (tokenResponse.status === 400 || tokenResponse.status === 401) {
|
|
8893
9371
|
throw new TokenRefreshOAuthError;
|
|
8894
9372
|
}
|
|
9373
|
+
if (!tokenResponse.ok) {
|
|
9374
|
+
throw new Error(`Token refresh failed: HTTP ${tokenResponse.status}`);
|
|
9375
|
+
}
|
|
8895
9376
|
const newAccessToken = tokenData.access_token;
|
|
8896
9377
|
const newRefreshToken = tokenData.refresh_token;
|
|
8897
9378
|
if (typeof newAccessToken !== "string" || typeof newRefreshToken !== "string") {
|
|
@@ -8923,9 +9404,9 @@ var errorCode = (err) => {
|
|
|
8923
9404
|
}
|
|
8924
9405
|
return "EUNKNOWN";
|
|
8925
9406
|
};
|
|
8926
|
-
var probeAsync = async (
|
|
9407
|
+
var probeAsync = async (fs, candidate) => {
|
|
8927
9408
|
try {
|
|
8928
|
-
const stats = await
|
|
9409
|
+
const stats = await fs.stat(candidate);
|
|
8929
9410
|
if (stats === null) {
|
|
8930
9411
|
return { exists: false };
|
|
8931
9412
|
}
|
|
@@ -8952,36 +9433,36 @@ var probeAsync = async (fs2, candidate) => {
|
|
|
8952
9433
|
}
|
|
8953
9434
|
};
|
|
8954
9435
|
var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
|
|
8955
|
-
const
|
|
8956
|
-
if (
|
|
8957
|
-
const
|
|
8958
|
-
return
|
|
9436
|
+
const fs = getFileSystem();
|
|
9437
|
+
if (fs.path.isAbsolute(envFilePath)) {
|
|
9438
|
+
const probe = await probeAsync(fs, envFilePath);
|
|
9439
|
+
return probe.exists ? { exists: true, absolutePath: envFilePath, source: "absolute" } : {
|
|
8959
9440
|
exists: false,
|
|
8960
9441
|
absolutePath: envFilePath,
|
|
8961
9442
|
source: "absolute",
|
|
8962
|
-
...
|
|
9443
|
+
...probe.unusable ? { unusable: probe.unusable } : {}
|
|
8963
9444
|
};
|
|
8964
9445
|
}
|
|
8965
|
-
const cwd = opts?.cwd ??
|
|
9446
|
+
const cwd = opts?.cwd ?? fs.env.cwd();
|
|
8966
9447
|
let searchDir = cwd;
|
|
8967
9448
|
while (true) {
|
|
8968
|
-
const candidate =
|
|
8969
|
-
const
|
|
8970
|
-
if (
|
|
9449
|
+
const candidate = fs.path.join(searchDir, envFilePath);
|
|
9450
|
+
const probe = await probeAsync(fs, candidate);
|
|
9451
|
+
if (probe.exists) {
|
|
8971
9452
|
return {
|
|
8972
9453
|
exists: true,
|
|
8973
9454
|
absolutePath: candidate,
|
|
8974
9455
|
source: searchDir === cwd ? "cwd" : "ancestor"
|
|
8975
9456
|
};
|
|
8976
9457
|
}
|
|
8977
|
-
const parentDir =
|
|
9458
|
+
const parentDir = fs.path.dirname(searchDir);
|
|
8978
9459
|
if (parentDir === searchDir) {
|
|
8979
9460
|
break;
|
|
8980
9461
|
}
|
|
8981
9462
|
searchDir = parentDir;
|
|
8982
9463
|
}
|
|
8983
|
-
const homePath =
|
|
8984
|
-
const probe = await probeAsync(
|
|
9464
|
+
const homePath = fs.path.join(fs.env.homedir(), envFilePath);
|
|
9465
|
+
const probe = await probeAsync(fs, homePath);
|
|
8985
9466
|
if (probe.exists) {
|
|
8986
9467
|
return { exists: true, absolutePath: homePath, source: "home" };
|
|
8987
9468
|
}
|
|
@@ -9024,12 +9505,12 @@ var parseEnvContent = (content) => {
|
|
|
9024
9505
|
return env;
|
|
9025
9506
|
};
|
|
9026
9507
|
var loadEnvFileAsync = async ({ envPath }) => {
|
|
9027
|
-
const
|
|
9028
|
-
const absolutePath =
|
|
9029
|
-
if (!await
|
|
9508
|
+
const fs = getFileSystem();
|
|
9509
|
+
const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.cwd(), envPath);
|
|
9510
|
+
if (!await fs.exists(absolutePath)) {
|
|
9030
9511
|
throw new Error(`Environment file not found: ${envPath}`);
|
|
9031
9512
|
}
|
|
9032
|
-
const content = await
|
|
9513
|
+
const content = await fs.readFile(absolutePath, "utf-8");
|
|
9033
9514
|
if (content === null) {
|
|
9034
9515
|
throw new Error(`Environment file not found: ${envPath}`);
|
|
9035
9516
|
}
|
|
@@ -9040,10 +9521,10 @@ var saveEnvFileAsync = async ({
|
|
|
9040
9521
|
data,
|
|
9041
9522
|
merge = true
|
|
9042
9523
|
}) => {
|
|
9043
|
-
const
|
|
9044
|
-
const absolutePath =
|
|
9524
|
+
const fs = getFileSystem();
|
|
9525
|
+
const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.homedir(), envPath);
|
|
9045
9526
|
let existingData = {};
|
|
9046
|
-
if (merge && await
|
|
9527
|
+
if (merge && await fs.exists(absolutePath)) {
|
|
9047
9528
|
try {
|
|
9048
9529
|
existingData = await loadEnvFileAsync({ envPath: absolutePath });
|
|
9049
9530
|
} catch {}
|
|
@@ -9061,11 +9542,11 @@ var saveEnvFileAsync = async ({
|
|
|
9061
9542
|
const content = `${lines.join(`
|
|
9062
9543
|
`)}
|
|
9063
9544
|
`;
|
|
9064
|
-
const dir =
|
|
9065
|
-
await
|
|
9545
|
+
const dir = fs.path.dirname(absolutePath);
|
|
9546
|
+
await fs.mkdir(dir);
|
|
9066
9547
|
const tempPath = `${absolutePath}.tmp`;
|
|
9067
|
-
await
|
|
9068
|
-
await
|
|
9548
|
+
await fs.writeFile(tempPath, content);
|
|
9549
|
+
await fs.rename(tempPath, absolutePath);
|
|
9069
9550
|
};
|
|
9070
9551
|
|
|
9071
9552
|
// ../../auth/src/loginStatus.ts
|
|
@@ -9189,11 +9670,11 @@ async function loadFileCredentials(loadEnvFile, absolutePath) {
|
|
|
9189
9670
|
return { credentials };
|
|
9190
9671
|
}
|
|
9191
9672
|
async function getGlobalCredsHint(getFs, loadEnvFile, absolutePath, envFilePath) {
|
|
9192
|
-
const
|
|
9193
|
-
const globalPath =
|
|
9673
|
+
const fs = getFs();
|
|
9674
|
+
const globalPath = fs.path.join(fs.env.homedir(), envFilePath);
|
|
9194
9675
|
if (absolutePath === globalPath)
|
|
9195
9676
|
return;
|
|
9196
|
-
if (!await
|
|
9677
|
+
if (!await fs.exists(globalPath))
|
|
9197
9678
|
return;
|
|
9198
9679
|
try {
|
|
9199
9680
|
const globalCreds = await loadEnvFile({ envPath: globalPath });
|
|
@@ -9608,6 +10089,51 @@ function normalizeTokenRefreshUnavailableFailure() {
|
|
|
9608
10089
|
function errorMessage(error) {
|
|
9609
10090
|
return error instanceof Error ? error.message : String(error);
|
|
9610
10091
|
}
|
|
10092
|
+
|
|
10093
|
+
// ../../auth/src/authContext.ts
|
|
10094
|
+
class AuthContextUnavailableError extends Error {
|
|
10095
|
+
instructionContext;
|
|
10096
|
+
sessionHint;
|
|
10097
|
+
errorCode = "authentication_required";
|
|
10098
|
+
retry = "RetryWillNotFix";
|
|
10099
|
+
constructor(message, instructionContext = "auth", sessionHint) {
|
|
10100
|
+
super(message);
|
|
10101
|
+
this.instructionContext = instructionContext;
|
|
10102
|
+
this.sessionHint = sessionHint;
|
|
10103
|
+
this.name = "AuthContextUnavailableError";
|
|
10104
|
+
}
|
|
10105
|
+
}
|
|
10106
|
+
var getAuthContext = async (options = {}) => {
|
|
10107
|
+
const status = await getLoginStatusAsync({
|
|
10108
|
+
ensureTokenValidityMinutes: options.ensureTokenValidityMinutes,
|
|
10109
|
+
envFilePath: options.envFilePath
|
|
10110
|
+
});
|
|
10111
|
+
if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken) {
|
|
10112
|
+
throw new AuthContextUnavailableError(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.", "auth", status.hint);
|
|
10113
|
+
}
|
|
10114
|
+
const tenantName = options.tenant || status.tenantName;
|
|
10115
|
+
if (options.requireOrganizationId && !status.organizationId) {
|
|
10116
|
+
throw new AuthContextUnavailableError("Organization ID not available. Ensure you are logged in with an organization context.", "identity");
|
|
10117
|
+
}
|
|
10118
|
+
if (options.requireOrganizationName && !status.organizationName) {
|
|
10119
|
+
throw new AuthContextUnavailableError("Organization name not available. Ensure you are logged in with an organization context.", "identity");
|
|
10120
|
+
}
|
|
10121
|
+
if (options.requireTenantId && !status.tenantId) {
|
|
10122
|
+
throw new AuthContextUnavailableError(`Tenant ID not available. Ensure UIPATH_TENANT_ID is set.${status.hint ? ` ${status.hint}` : ""}`, "identity", status.hint);
|
|
10123
|
+
}
|
|
10124
|
+
if (options.requireTenantName && !tenantName) {
|
|
10125
|
+
throw new AuthContextUnavailableError("Tenant not provided and UIPATH_TENANT_NAME not set. Run 'uip login' to select a tenant, or use 'uip login tenant set <tenant>' to switch tenants.", "identity");
|
|
10126
|
+
}
|
|
10127
|
+
return {
|
|
10128
|
+
baseUrl: status.baseUrl,
|
|
10129
|
+
accessToken: status.accessToken,
|
|
10130
|
+
organizationId: status.organizationId,
|
|
10131
|
+
organizationName: status.organizationName,
|
|
10132
|
+
tenantId: status.tenantId,
|
|
10133
|
+
tenantName,
|
|
10134
|
+
identity: status.identity
|
|
10135
|
+
};
|
|
10136
|
+
};
|
|
9611
10137
|
// ../../auth/src/selectTenant.ts
|
|
9612
10138
|
var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
|
|
9613
10139
|
var INVALID_TENANT_CODE = "INVALID_TENANT";
|
|
@@ -9617,28 +10143,22 @@ var TENANT_SELECTION_CODES = new Set([
|
|
|
9617
10143
|
]);
|
|
9618
10144
|
// ../resourcecatalog-sdk/src/client-factory.ts
|
|
9619
10145
|
async function resolveConfig(options) {
|
|
9620
|
-
const
|
|
9621
|
-
ensureTokenValidityMinutes: options?.loginValidity
|
|
10146
|
+
const auth = await getAuthContext({
|
|
10147
|
+
ensureTokenValidityMinutes: options?.loginValidity,
|
|
10148
|
+
tenant: options?.tenantName,
|
|
10149
|
+
requireOrganizationId: true,
|
|
10150
|
+
requireTenantName: true
|
|
9622
10151
|
});
|
|
9623
|
-
|
|
9624
|
-
|
|
9625
|
-
|
|
9626
|
-
if (!status.organizationId) {
|
|
9627
|
-
throw new Error("Organization ID not available. Ensure you are logged in with an organization context.");
|
|
9628
|
-
}
|
|
9629
|
-
const tenant = options?.tenantName ?? status.tenantName;
|
|
9630
|
-
if (!tenant) {
|
|
9631
|
-
throw new Error("Tenant not available. Run 'uip login' to select a tenant, or use 'uip login tenant set <tenant>' to switch tenants.");
|
|
9632
|
-
}
|
|
9633
|
-
const basePath = `${status.baseUrl}/${status.organizationId}/${tenant}/resourcecatalog_`;
|
|
9634
|
-
const bearerToken = options?.s2sToken ?? status.accessToken;
|
|
10152
|
+
const tenant = auth.tenantName;
|
|
10153
|
+
const basePath = `${auth.baseUrl}/${encodeURIComponent(auth.organizationId)}/${encodeURIComponent(tenant)}/resourcecatalog_`;
|
|
10154
|
+
const bearerToken = options?.s2sToken ?? auth.accessToken;
|
|
9635
10155
|
return {
|
|
9636
10156
|
config: new Configuration({
|
|
9637
10157
|
basePath,
|
|
9638
10158
|
accessToken: async () => bearerToken,
|
|
9639
10159
|
headers: addSdkUserAgentHeader(undefined, SDK_USER_AGENT)
|
|
9640
10160
|
}),
|
|
9641
|
-
organizationId:
|
|
10161
|
+
organizationId: auth.organizationId,
|
|
9642
10162
|
tenantName: tenant
|
|
9643
10163
|
};
|
|
9644
10164
|
}
|
|
@@ -9690,7 +10210,7 @@ var registerSearchCommands = (rcs) => {
|
|
|
9690
10210
|
"",
|
|
9691
10211
|
"Returns the standard paging envelope {items, total, count, next}."
|
|
9692
10212
|
].join(`
|
|
9693
|
-
`)).addOption(createHiddenDeprecatedTenantOption("--tenant <name>")).option("--entity-type <value>", "RCS entityTypes filter entry. Repeat to pass multiple values (e.g. --entity-type Process).", (value, previous = []) => [...previous, value]).option("--entity-sub-type <value>", "RCS entitySubType filter entry. Repeat to pass multiple values (e.g. --entity-sub-type ProcessOrchestration).", (value, previous = []) => [...previous, value]).option("--name <text>", "Substring filter on entity name (RCS `name` query param).").option("--folder-key <guid>", "Folder GUID to scope the call (sets X-UIPATH-FolderKey).").option("--folder-path <path>", "Folder path to scope the call (sets X-UIPATH-FolderPath).").option("--limit <n>", `Page size. Maps to RCS take. Defaults to ${DEFAULT_PAGE_SIZE}.`, (v) => Number.parseInt(v, 10)).option("--offset <n>", "Row offset. Maps to RCS skip. Defaults to 0.", (v) => Number.parseInt(v, 10)).addOption(new
|
|
10213
|
+
`)).addOption(createHiddenDeprecatedTenantOption("--tenant <name>")).option("--entity-type <value>", "RCS entityTypes filter entry. Repeat to pass multiple values (e.g. --entity-type Process).", (value, previous = []) => [...previous, value]).option("--entity-sub-type <value>", "RCS entitySubType filter entry. Repeat to pass multiple values (e.g. --entity-sub-type ProcessOrchestration).", (value, previous = []) => [...previous, value]).option("--name <text>", "Substring filter on entity name (RCS `name` query param).").option("--folder-key <guid>", "Folder GUID to scope the call (sets X-UIPATH-FolderKey).").option("--folder-path <path>", "Folder path to scope the call (sets X-UIPATH-FolderPath).").option("--limit <n>", `Page size. Maps to RCS take. Defaults to ${DEFAULT_PAGE_SIZE}.`, (v) => Number.parseInt(v, 10)).option("--offset <n>", "Row offset. Maps to RCS skip. Defaults to 0.", (v) => Number.parseInt(v, 10)).addOption(new Option2("--skip <n>").hideHelp().argParser((v) => Number.parseInt(v, 10))).option("--login-validity <minutes>", "Override the interactive-login token lifetime for this call. Rarely needed.", (v) => Number.parseInt(v, 10)).examples(SEARCH_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
9694
10214
|
const offset = resolveDeprecatedOptionAlias({
|
|
9695
10215
|
preferredValue: options.offset,
|
|
9696
10216
|
deprecatedValue: options.skip,
|
|
@@ -9801,7 +10321,7 @@ var registerTagCommands = (rcs) => {
|
|
|
9801
10321
|
"(your account must have RCS access to that tenant). Use --type KeyValue",
|
|
9802
10322
|
"for key/value tags, or --starts-with to filter by name prefix."
|
|
9803
10323
|
].join(`
|
|
9804
|
-
`)).addOption(createHiddenDeprecatedTenantOption("--tenant <name>")).option("--type <type>", "Tag type to list: 'Label' (default) or 'KeyValue'. Case-sensitive.", "Label").option("--starts-with <prefix>", "Return only tags whose normalized name starts with this prefix (case-insensitive).").option("--limit <n>", "Page size — how many tags to return in one call. Defaults to 100.", (v) => Number.parseInt(v, 10), 100).option("--offset <n>", "Row offset into the result set. Defaults to 0.", (v) => Number.parseInt(v, 10)).addOption(new
|
|
10324
|
+
`)).addOption(createHiddenDeprecatedTenantOption("--tenant <name>")).option("--type <type>", "Tag type to list: 'Label' (default) or 'KeyValue'. Case-sensitive.", "Label").option("--starts-with <prefix>", "Return only tags whose normalized name starts with this prefix (case-insensitive).").option("--limit <n>", "Page size — how many tags to return in one call. Defaults to 100.", (v) => Number.parseInt(v, 10), 100).option("--offset <n>", "Row offset into the result set. Defaults to 0.", (v) => Number.parseInt(v, 10)).addOption(new Option2("--skip <n>").hideHelp().argParser((v) => Number.parseInt(v, 10))).option("--login-validity <minutes>", "Override the interactive-login token lifetime for this call. Rarely needed.", (v) => Number.parseInt(v, 10)).examples(LIST_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
9805
10325
|
const offset = resolveDeprecatedOptionAlias({
|
|
9806
10326
|
preferredValue: options.offset,
|
|
9807
10327
|
deprecatedValue: options.skip,
|
|
@@ -9854,8 +10374,8 @@ var registerTagCommands = (rcs) => {
|
|
|
9854
10374
|
};
|
|
9855
10375
|
|
|
9856
10376
|
// src/commands/rcs.ts
|
|
9857
|
-
var registerRcsCommand = (
|
|
9858
|
-
const rcs =
|
|
10377
|
+
var registerRcsCommand = (program) => {
|
|
10378
|
+
const rcs = program.command("rcs").description([
|
|
9859
10379
|
"Manage UiPath Resource Catalog Service resources.",
|
|
9860
10380
|
"",
|
|
9861
10381
|
"Subcommand groups:",
|
|
@@ -9868,16 +10388,16 @@ var registerRcsCommand = (program2) => {
|
|
|
9868
10388
|
};
|
|
9869
10389
|
|
|
9870
10390
|
// src/tool.ts
|
|
9871
|
-
var
|
|
10391
|
+
var metadata2 = {
|
|
9872
10392
|
name: "resourcecatalog-tool",
|
|
9873
10393
|
version: package_default.version,
|
|
9874
10394
|
description: "Manage UiPath Resource Catalog Service resources.",
|
|
9875
10395
|
commandPrefix: "admin"
|
|
9876
10396
|
};
|
|
9877
|
-
var
|
|
9878
|
-
registerRcsCommand(
|
|
10397
|
+
var registerCommands2 = async (program) => {
|
|
10398
|
+
registerRcsCommand(program);
|
|
9879
10399
|
};
|
|
9880
10400
|
|
|
9881
|
-
export { Command,
|
|
10401
|
+
export { Command, metadata2, registerCommands2 };
|
|
9882
10402
|
|
|
9883
|
-
//# debugId=
|
|
10403
|
+
//# debugId=CEA9DF4ADB5A551464756E2164756E21
|