@uipath/apms-tool 1.205.0-preview.277 → 1.206.0-preview.279
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-yj3y4fqs.js → tool-sawvjv5n.js} +1103 -489
- 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/apms-tool",
|
|
2102
2083
|
author: "UiPath",
|
|
2103
2084
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
2104
|
-
version: "1.
|
|
2085
|
+
version: "1.206.0-preview.279",
|
|
2105
2086
|
description: "CLI plugin for the UiPath Access Policy Management Service.",
|
|
2106
2087
|
private: false,
|
|
2107
2088
|
repository: {
|
|
@@ -2128,6 +2109,7 @@ var package_default = {
|
|
|
2128
2109
|
],
|
|
2129
2110
|
scripts: {
|
|
2130
2111
|
build: "bun ../../../tools/build-tool.ts",
|
|
2112
|
+
typecheck: "tsc --noEmit",
|
|
2131
2113
|
package: "bun run build && bun pm pack",
|
|
2132
2114
|
lint: "biome check .",
|
|
2133
2115
|
"lint:fix": "biome check --write .",
|
|
@@ -2181,6 +2163,15 @@ function getGlobalTelemetryProperties() {
|
|
|
2181
2163
|
return telemetryPropsSlot.get();
|
|
2182
2164
|
}
|
|
2183
2165
|
|
|
2166
|
+
// ../../common/src/telemetry/telemetry-config.ts
|
|
2167
|
+
function isTelemetryDisabled() {
|
|
2168
|
+
const value = process.env.UIPATH_TELEMETRY_DISABLED;
|
|
2169
|
+
return value === "1" || value === "true";
|
|
2170
|
+
}
|
|
2171
|
+
function isProjectTelemetryDisabled() {
|
|
2172
|
+
return isTelemetryDisabled() || process.env.UIPATH_PROJECT_TELEMETRY_DISABLED === "1" || process.env.UIPATH_PROJECT_TELEMETRY_DISABLED === "true";
|
|
2173
|
+
}
|
|
2174
|
+
|
|
2184
2175
|
// ../../common/src/telemetry/telemetry-dimensions.ts
|
|
2185
2176
|
var BaseDimensions = {
|
|
2186
2177
|
ApplicationName: "ApplicationName",
|
|
@@ -2216,6 +2207,21 @@ var CommandDimensions = {
|
|
|
2216
2207
|
ProductArea: "ProductArea",
|
|
2217
2208
|
Mode: "Mode"
|
|
2218
2209
|
};
|
|
2210
|
+
var ProjectDimensions = {
|
|
2211
|
+
ProjectKey: "ProjectKey",
|
|
2212
|
+
ProjectType: "ProjectType",
|
|
2213
|
+
ProjectIdentityStatus: "ProjectIdentityStatus",
|
|
2214
|
+
SolutionKey: "SolutionKey",
|
|
2215
|
+
SolutionProjectKey: "SolutionProjectKey",
|
|
2216
|
+
SolutionIdentityStatus: "SolutionIdentityStatus",
|
|
2217
|
+
PreviousSolutionKey: "PreviousSolutionKey"
|
|
2218
|
+
};
|
|
2219
|
+
var GUID_KEY_DIMENSIONS = new Set([
|
|
2220
|
+
ProjectDimensions.ProjectKey,
|
|
2221
|
+
ProjectDimensions.SolutionKey,
|
|
2222
|
+
ProjectDimensions.SolutionProjectKey,
|
|
2223
|
+
ProjectDimensions.PreviousSolutionKey
|
|
2224
|
+
]);
|
|
2219
2225
|
var ShipDimensions = {
|
|
2220
2226
|
ShipKind: "ShipKind",
|
|
2221
2227
|
Target: "Target",
|
|
@@ -2284,6 +2290,7 @@ var RESERVED_DIMENSION_NAMES = new Set([
|
|
|
2284
2290
|
...Object.values(BaseDimensions),
|
|
2285
2291
|
...Object.values(CommandDimensions),
|
|
2286
2292
|
...Object.values(ShipDimensions),
|
|
2293
|
+
...Object.values(ProjectDimensions),
|
|
2287
2294
|
...Object.values(ErrorDimensions),
|
|
2288
2295
|
...Object.values(AuthDimensions),
|
|
2289
2296
|
...Object.values(SkillsDimensions),
|
|
@@ -2309,7 +2316,8 @@ var CURATED_DIMENSIONS = new Set([
|
|
|
2309
2316
|
BaseDimensions.SessionIdSource,
|
|
2310
2317
|
BaseDimensions.SessionId,
|
|
2311
2318
|
...Object.values(CommandDimensions),
|
|
2312
|
-
...Object.values(ShipDimensions)
|
|
2319
|
+
...Object.values(ShipDimensions),
|
|
2320
|
+
...Object.values(ProjectDimensions)
|
|
2313
2321
|
]);
|
|
2314
2322
|
function lowercaseIdDimensionValues(properties) {
|
|
2315
2323
|
let changed = false;
|
|
@@ -2660,7 +2668,7 @@ var package_default2 = {
|
|
|
2660
2668
|
name: "@uipath/apms-sdk",
|
|
2661
2669
|
author: "UiPath",
|
|
2662
2670
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
2663
|
-
version: "1.
|
|
2671
|
+
version: "1.206.0",
|
|
2664
2672
|
description: "SDK for the UiPath Access Policy Management Service API.",
|
|
2665
2673
|
repository: {
|
|
2666
2674
|
type: "git",
|
|
@@ -2691,8 +2699,10 @@ var package_default2 = {
|
|
|
2691
2699
|
private: true,
|
|
2692
2700
|
scripts: {
|
|
2693
2701
|
build: "bun build ./src/index.ts --outdir dist --format esm --target node --sourcemap=linked && tsc -p tsconfig.build.json --noCheck",
|
|
2702
|
+
typecheck: "tsc --noEmit",
|
|
2694
2703
|
generate: "bun run src/scripts/generate-sdk.ts",
|
|
2695
|
-
lint: "biome check ."
|
|
2704
|
+
lint: "biome check .",
|
|
2705
|
+
test: "vitest run"
|
|
2696
2706
|
},
|
|
2697
2707
|
devDependencies: {
|
|
2698
2708
|
"@openapitools/openapi-generator-cli": "^2.31.1",
|
|
@@ -2708,11 +2718,6 @@ var package_default2 = {
|
|
|
2708
2718
|
var SDK_USER_AGENT = getSdkUserAgentToken(package_default2);
|
|
2709
2719
|
installSdkUserAgentHeader(BaseAPI, SDK_USER_AGENT);
|
|
2710
2720
|
|
|
2711
|
-
// ../apms-sdk/generated/src/models/UiPathPlatformServiceAccessPolicyManagementDomainDataStatus.ts
|
|
2712
|
-
function UiPathPlatformServiceAccessPolicyManagementDomainDataStatusToJSON(value) {
|
|
2713
|
-
return value;
|
|
2714
|
-
}
|
|
2715
|
-
|
|
2716
2721
|
// ../apms-sdk/generated/src/models/UiPathPlatformServiceAccessPolicyManagementDomainDataType.ts
|
|
2717
2722
|
function UiPathPlatformServiceAccessPolicyManagementDomainDataTypeFromJSON(json) {
|
|
2718
2723
|
return UiPathPlatformServiceAccessPolicyManagementDomainDataTypeFromJSONTyped(json, false);
|
|
@@ -2751,7 +2756,7 @@ function UiPathPlatformServiceAccessPolicyManagementDomainRequestsAddIpConfigura
|
|
|
2751
2756
|
return value;
|
|
2752
2757
|
}
|
|
2753
2758
|
return {
|
|
2754
|
-
status:
|
|
2759
|
+
status: value["status"]
|
|
2755
2760
|
};
|
|
2756
2761
|
}
|
|
2757
2762
|
|
|
@@ -2813,7 +2818,7 @@ function UiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateIpConfig
|
|
|
2813
2818
|
return value;
|
|
2814
2819
|
}
|
|
2815
2820
|
return {
|
|
2816
|
-
status:
|
|
2821
|
+
status: value["status"],
|
|
2817
2822
|
updatedOn: value["updatedOn"] == null ? value["updatedOn"] : value["updatedOn"].toISOString()
|
|
2818
2823
|
};
|
|
2819
2824
|
}
|
|
@@ -3814,7 +3819,7 @@ function isBrowser() {
|
|
|
3814
3819
|
}
|
|
3815
3820
|
|
|
3816
3821
|
// ../../filesystem/src/node.ts
|
|
3817
|
-
import { randomUUID } from "node:crypto";
|
|
3822
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
3818
3823
|
import { existsSync } from "node:fs";
|
|
3819
3824
|
import * as fs from "node:fs/promises";
|
|
3820
3825
|
import * as os from "node:os";
|
|
@@ -3825,6 +3830,9 @@ var LOCK_MAX_WAIT_MS = 20000;
|
|
|
3825
3830
|
var LOCK_MAX_HOLD_MS = 60000;
|
|
3826
3831
|
var LOCK_RETRY_MIN_MS = 100;
|
|
3827
3832
|
var LOCK_RETRY_JITTER_MS = 200;
|
|
3833
|
+
var HASH_CHUNK_BYTES = 256 * 1024;
|
|
3834
|
+
var hashBuffers = [];
|
|
3835
|
+
var HASH_BUFFERS_KEPT = 64;
|
|
3828
3836
|
|
|
3829
3837
|
class NodeFileSystem {
|
|
3830
3838
|
path = {
|
|
@@ -3843,7 +3851,7 @@ class NodeFileSystem {
|
|
|
3843
3851
|
};
|
|
3844
3852
|
utils = {
|
|
3845
3853
|
open: async (url) => {
|
|
3846
|
-
const { default: open } = await import("./index-
|
|
3854
|
+
const { default: open } = await import("./index-x4997kvr.js");
|
|
3847
3855
|
await open(url);
|
|
3848
3856
|
}
|
|
3849
3857
|
};
|
|
@@ -3882,6 +3890,15 @@ class NodeFileSystem {
|
|
|
3882
3890
|
throw error;
|
|
3883
3891
|
}
|
|
3884
3892
|
}
|
|
3893
|
+
async readdirEntries(dirPath) {
|
|
3894
|
+
try {
|
|
3895
|
+
return await fs.readdir(dirPath, { withFileTypes: true });
|
|
3896
|
+
} catch (error) {
|
|
3897
|
+
if (this.isEnoent(error))
|
|
3898
|
+
return [];
|
|
3899
|
+
throw error;
|
|
3900
|
+
}
|
|
3901
|
+
}
|
|
3885
3902
|
async stat(filePath) {
|
|
3886
3903
|
try {
|
|
3887
3904
|
const stats = await fs.stat(filePath);
|
|
@@ -3889,7 +3906,8 @@ class NodeFileSystem {
|
|
|
3889
3906
|
isFile: () => stats.isFile(),
|
|
3890
3907
|
isDirectory: () => stats.isDirectory(),
|
|
3891
3908
|
size: stats.size,
|
|
3892
|
-
mtimeMs: stats.mtimeMs
|
|
3909
|
+
mtimeMs: stats.mtimeMs,
|
|
3910
|
+
ctimeMs: stats.ctimeMs
|
|
3893
3911
|
};
|
|
3894
3912
|
} catch (error) {
|
|
3895
3913
|
if (this.isEnoent(error))
|
|
@@ -4003,6 +4021,42 @@ class NodeFileSystem {
|
|
|
4003
4021
|
throw error;
|
|
4004
4022
|
}
|
|
4005
4023
|
}
|
|
4024
|
+
async hashFile(filePath) {
|
|
4025
|
+
let handle;
|
|
4026
|
+
try {
|
|
4027
|
+
handle = await fs.open(filePath, "r");
|
|
4028
|
+
} catch (error) {
|
|
4029
|
+
if (this.isEnoent(error))
|
|
4030
|
+
return null;
|
|
4031
|
+
throw error;
|
|
4032
|
+
}
|
|
4033
|
+
const buffer = hashBuffers.pop() ?? Buffer.allocUnsafe(HASH_CHUNK_BYTES);
|
|
4034
|
+
try {
|
|
4035
|
+
const opened = await handle.stat();
|
|
4036
|
+
const stats = {
|
|
4037
|
+
isFile: () => opened.isFile(),
|
|
4038
|
+
isDirectory: () => opened.isDirectory(),
|
|
4039
|
+
size: opened.size,
|
|
4040
|
+
mtimeMs: opened.mtimeMs,
|
|
4041
|
+
ctimeMs: opened.ctimeMs
|
|
4042
|
+
};
|
|
4043
|
+
const hash = createHash("sha256");
|
|
4044
|
+
let size = 0;
|
|
4045
|
+
for (;; ) {
|
|
4046
|
+
const { bytesRead } = await handle.read(buffer, 0, buffer.byteLength, null);
|
|
4047
|
+
if (bytesRead === 0)
|
|
4048
|
+
break;
|
|
4049
|
+
hash.update(buffer.subarray(0, bytesRead));
|
|
4050
|
+
size += bytesRead;
|
|
4051
|
+
}
|
|
4052
|
+
return { sha256: hash.digest("hex"), size, stats };
|
|
4053
|
+
} finally {
|
|
4054
|
+
if (hashBuffers.length < HASH_BUFFERS_KEPT) {
|
|
4055
|
+
hashBuffers.push(buffer);
|
|
4056
|
+
}
|
|
4057
|
+
await handle.close();
|
|
4058
|
+
}
|
|
4059
|
+
}
|
|
4006
4060
|
async realpath(filePath) {
|
|
4007
4061
|
try {
|
|
4008
4062
|
return await fs.realpath(filePath);
|
|
@@ -4113,8 +4167,8 @@ function resolveAuthProfileFilePath(profile) {
|
|
|
4113
4167
|
if (normalized === undefined) {
|
|
4114
4168
|
throw new AuthProfileValidationError(`"${DEFAULT_AUTH_PROFILE}" is the built-in profile and does not have a profile file path.`);
|
|
4115
4169
|
}
|
|
4116
|
-
const
|
|
4117
|
-
return
|
|
4170
|
+
const fs = getFileSystem();
|
|
4171
|
+
return fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR, normalized, AUTH_FILENAME);
|
|
4118
4172
|
}
|
|
4119
4173
|
function getActiveAuthProfileFilePath() {
|
|
4120
4174
|
const profile = getActiveAuthProfile();
|
|
@@ -4287,6 +4341,8 @@ var ENV_AUTH_VARS = {
|
|
|
4287
4341
|
};
|
|
4288
4342
|
|
|
4289
4343
|
class EnvAuthConfigError extends Error {
|
|
4344
|
+
errorCode = "configuration_error";
|
|
4345
|
+
retry = "RetryWillNotFix";
|
|
4290
4346
|
constructor(message) {
|
|
4291
4347
|
super(message);
|
|
4292
4348
|
this.name = "EnvAuthConfigError";
|
|
@@ -4325,11 +4381,11 @@ var readAuthFromEnv = () => {
|
|
|
4325
4381
|
if (!rawUrl) {
|
|
4326
4382
|
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}).`);
|
|
4327
4383
|
}
|
|
4328
|
-
const
|
|
4384
|
+
const baseUrl = resolveBaseUrl(rawUrl, `Failed to validate ${OPAQUE_TOKEN_BASE_URL_VAR}`);
|
|
4329
4385
|
return {
|
|
4330
4386
|
loginStatus: "Logged in",
|
|
4331
4387
|
accessToken,
|
|
4332
|
-
baseUrl
|
|
4388
|
+
baseUrl,
|
|
4333
4389
|
organizationName,
|
|
4334
4390
|
organizationId,
|
|
4335
4391
|
tenantName,
|
|
@@ -4380,9 +4436,9 @@ function breakerPathFor(authPath) {
|
|
|
4380
4436
|
return `${authPath}${BREAKER_SUFFIX}`;
|
|
4381
4437
|
}
|
|
4382
4438
|
async function loadRefreshBreaker(authPath) {
|
|
4383
|
-
const
|
|
4439
|
+
const fs = getFileSystem();
|
|
4384
4440
|
try {
|
|
4385
|
-
const content = await
|
|
4441
|
+
const content = await fs.readFile(breakerPathFor(authPath), "utf-8");
|
|
4386
4442
|
if (!content)
|
|
4387
4443
|
return {};
|
|
4388
4444
|
const parsed = JSON.parse(content);
|
|
@@ -4393,20 +4449,20 @@ async function loadRefreshBreaker(authPath) {
|
|
|
4393
4449
|
}
|
|
4394
4450
|
async function saveRefreshBreaker(authPath, state) {
|
|
4395
4451
|
try {
|
|
4396
|
-
const
|
|
4397
|
-
const
|
|
4398
|
-
await
|
|
4399
|
-
const tempPath = `${
|
|
4400
|
-
await
|
|
4401
|
-
await
|
|
4452
|
+
const fs = getFileSystem();
|
|
4453
|
+
const path = breakerPathFor(authPath);
|
|
4454
|
+
await fs.mkdir(fs.path.dirname(path));
|
|
4455
|
+
const tempPath = `${path}.tmp`;
|
|
4456
|
+
await fs.writeFile(tempPath, JSON.stringify(state));
|
|
4457
|
+
await fs.rename(tempPath, path);
|
|
4402
4458
|
} catch {}
|
|
4403
4459
|
}
|
|
4404
4460
|
async function clearRefreshBreaker(authPath) {
|
|
4405
|
-
const
|
|
4406
|
-
const
|
|
4461
|
+
const fs = getFileSystem();
|
|
4462
|
+
const path = breakerPathFor(authPath);
|
|
4407
4463
|
try {
|
|
4408
|
-
if (await
|
|
4409
|
-
await
|
|
4464
|
+
if (await fs.exists(path)) {
|
|
4465
|
+
await fs.rm(path);
|
|
4410
4466
|
}
|
|
4411
4467
|
} catch {}
|
|
4412
4468
|
}
|
|
@@ -4427,13 +4483,13 @@ var ROBOT_USER_SERVICES_PIPE = "UiPathUserServices";
|
|
|
4427
4483
|
var ROBOT_USER_SERVICES_ALTERNATE_PIPE = `${ROBOT_USER_SERVICES_PIPE}Alternate`;
|
|
4428
4484
|
var PIPE_NAME_MAX_LENGTH = 103;
|
|
4429
4485
|
var getRobotIpcPipeNames = async () => {
|
|
4430
|
-
const
|
|
4431
|
-
const username =
|
|
4486
|
+
const fs = getFileSystem();
|
|
4487
|
+
const username = fs.env.getenv("USER") ?? fs.env.getenv("USERNAME");
|
|
4432
4488
|
if (!username) {
|
|
4433
4489
|
throw new Error("Unable to determine current username");
|
|
4434
4490
|
}
|
|
4435
|
-
const tempPath =
|
|
4436
|
-
return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) =>
|
|
4491
|
+
const tempPath = fs.env.getenv("TMPDIR") ?? "/tmp/";
|
|
4492
|
+
return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) => fs.path.join(tempPath, `${baseName}_${username}`).substring(0, PIPE_NAME_MAX_LENGTH));
|
|
4437
4493
|
};
|
|
4438
4494
|
var defaultIsRobotIpcAvailable = async () => {
|
|
4439
4495
|
if (process.platform === "win32") {
|
|
@@ -4443,20 +4499,20 @@ var defaultIsRobotIpcAvailable = async () => {
|
|
|
4443
4499
|
if (pipeNamesError || !pipeNames) {
|
|
4444
4500
|
return false;
|
|
4445
4501
|
}
|
|
4446
|
-
const
|
|
4502
|
+
const fs = getFileSystem();
|
|
4447
4503
|
for (const pipeName of pipeNames) {
|
|
4448
|
-
const [existsError, exists] = await catchError(
|
|
4504
|
+
const [existsError, exists] = await catchError(fs.exists(pipeName));
|
|
4449
4505
|
if (!existsError && exists === true) {
|
|
4450
4506
|
return true;
|
|
4451
4507
|
}
|
|
4452
4508
|
}
|
|
4453
4509
|
return false;
|
|
4454
4510
|
};
|
|
4455
|
-
var withTimeout = (promise, timeoutMs) => new Promise((
|
|
4511
|
+
var withTimeout = (promise, timeoutMs) => new Promise((resolve, reject) => {
|
|
4456
4512
|
const timer = setTimeout(() => reject(new Error(`Robot IPC call timed out after ${timeoutMs}ms`)), timeoutMs);
|
|
4457
4513
|
promise.then((value) => {
|
|
4458
4514
|
clearTimeout(timer);
|
|
4459
|
-
|
|
4515
|
+
resolve(value);
|
|
4460
4516
|
}, (error) => {
|
|
4461
4517
|
clearTimeout(timer);
|
|
4462
4518
|
reject(error);
|
|
@@ -4629,9 +4685,12 @@ var refreshAccessToken = async ({
|
|
|
4629
4685
|
body: tokenParams
|
|
4630
4686
|
});
|
|
4631
4687
|
const tokenData = await tokenResponse.json();
|
|
4632
|
-
if (
|
|
4688
|
+
if (tokenResponse.status === 400 || tokenResponse.status === 401) {
|
|
4633
4689
|
throw new TokenRefreshOAuthError;
|
|
4634
4690
|
}
|
|
4691
|
+
if (!tokenResponse.ok) {
|
|
4692
|
+
throw new Error(`Token refresh failed: HTTP ${tokenResponse.status}`);
|
|
4693
|
+
}
|
|
4635
4694
|
const newAccessToken = tokenData.access_token;
|
|
4636
4695
|
const newRefreshToken = tokenData.refresh_token;
|
|
4637
4696
|
if (typeof newAccessToken !== "string" || typeof newRefreshToken !== "string") {
|
|
@@ -4663,9 +4722,9 @@ var errorCode = (err) => {
|
|
|
4663
4722
|
}
|
|
4664
4723
|
return "EUNKNOWN";
|
|
4665
4724
|
};
|
|
4666
|
-
var probeAsync = async (
|
|
4725
|
+
var probeAsync = async (fs, candidate) => {
|
|
4667
4726
|
try {
|
|
4668
|
-
const stats = await
|
|
4727
|
+
const stats = await fs.stat(candidate);
|
|
4669
4728
|
if (stats === null) {
|
|
4670
4729
|
return { exists: false };
|
|
4671
4730
|
}
|
|
@@ -4692,36 +4751,36 @@ var probeAsync = async (fs2, candidate) => {
|
|
|
4692
4751
|
}
|
|
4693
4752
|
};
|
|
4694
4753
|
var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
|
|
4695
|
-
const
|
|
4696
|
-
if (
|
|
4697
|
-
const
|
|
4698
|
-
return
|
|
4754
|
+
const fs = getFileSystem();
|
|
4755
|
+
if (fs.path.isAbsolute(envFilePath)) {
|
|
4756
|
+
const probe = await probeAsync(fs, envFilePath);
|
|
4757
|
+
return probe.exists ? { exists: true, absolutePath: envFilePath, source: "absolute" } : {
|
|
4699
4758
|
exists: false,
|
|
4700
4759
|
absolutePath: envFilePath,
|
|
4701
4760
|
source: "absolute",
|
|
4702
|
-
...
|
|
4761
|
+
...probe.unusable ? { unusable: probe.unusable } : {}
|
|
4703
4762
|
};
|
|
4704
4763
|
}
|
|
4705
|
-
const cwd = opts?.cwd ??
|
|
4764
|
+
const cwd = opts?.cwd ?? fs.env.cwd();
|
|
4706
4765
|
let searchDir = cwd;
|
|
4707
4766
|
while (true) {
|
|
4708
|
-
const candidate =
|
|
4709
|
-
const
|
|
4710
|
-
if (
|
|
4767
|
+
const candidate = fs.path.join(searchDir, envFilePath);
|
|
4768
|
+
const probe = await probeAsync(fs, candidate);
|
|
4769
|
+
if (probe.exists) {
|
|
4711
4770
|
return {
|
|
4712
4771
|
exists: true,
|
|
4713
4772
|
absolutePath: candidate,
|
|
4714
4773
|
source: searchDir === cwd ? "cwd" : "ancestor"
|
|
4715
4774
|
};
|
|
4716
4775
|
}
|
|
4717
|
-
const parentDir =
|
|
4776
|
+
const parentDir = fs.path.dirname(searchDir);
|
|
4718
4777
|
if (parentDir === searchDir) {
|
|
4719
4778
|
break;
|
|
4720
4779
|
}
|
|
4721
4780
|
searchDir = parentDir;
|
|
4722
4781
|
}
|
|
4723
|
-
const homePath =
|
|
4724
|
-
const probe = await probeAsync(
|
|
4782
|
+
const homePath = fs.path.join(fs.env.homedir(), envFilePath);
|
|
4783
|
+
const probe = await probeAsync(fs, homePath);
|
|
4725
4784
|
if (probe.exists) {
|
|
4726
4785
|
return { exists: true, absolutePath: homePath, source: "home" };
|
|
4727
4786
|
}
|
|
@@ -4764,12 +4823,12 @@ var parseEnvContent = (content) => {
|
|
|
4764
4823
|
return env;
|
|
4765
4824
|
};
|
|
4766
4825
|
var loadEnvFileAsync = async ({ envPath }) => {
|
|
4767
|
-
const
|
|
4768
|
-
const absolutePath =
|
|
4769
|
-
if (!await
|
|
4826
|
+
const fs = getFileSystem();
|
|
4827
|
+
const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.cwd(), envPath);
|
|
4828
|
+
if (!await fs.exists(absolutePath)) {
|
|
4770
4829
|
throw new Error(`Environment file not found: ${envPath}`);
|
|
4771
4830
|
}
|
|
4772
|
-
const content = await
|
|
4831
|
+
const content = await fs.readFile(absolutePath, "utf-8");
|
|
4773
4832
|
if (content === null) {
|
|
4774
4833
|
throw new Error(`Environment file not found: ${envPath}`);
|
|
4775
4834
|
}
|
|
@@ -4780,10 +4839,10 @@ var saveEnvFileAsync = async ({
|
|
|
4780
4839
|
data,
|
|
4781
4840
|
merge = true
|
|
4782
4841
|
}) => {
|
|
4783
|
-
const
|
|
4784
|
-
const absolutePath =
|
|
4842
|
+
const fs = getFileSystem();
|
|
4843
|
+
const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.homedir(), envPath);
|
|
4785
4844
|
let existingData = {};
|
|
4786
|
-
if (merge && await
|
|
4845
|
+
if (merge && await fs.exists(absolutePath)) {
|
|
4787
4846
|
try {
|
|
4788
4847
|
existingData = await loadEnvFileAsync({ envPath: absolutePath });
|
|
4789
4848
|
} catch {}
|
|
@@ -4801,11 +4860,11 @@ var saveEnvFileAsync = async ({
|
|
|
4801
4860
|
const content = `${lines.join(`
|
|
4802
4861
|
`)}
|
|
4803
4862
|
`;
|
|
4804
|
-
const dir =
|
|
4805
|
-
await
|
|
4863
|
+
const dir = fs.path.dirname(absolutePath);
|
|
4864
|
+
await fs.mkdir(dir);
|
|
4806
4865
|
const tempPath = `${absolutePath}.tmp`;
|
|
4807
|
-
await
|
|
4808
|
-
await
|
|
4866
|
+
await fs.writeFile(tempPath, content);
|
|
4867
|
+
await fs.rename(tempPath, absolutePath);
|
|
4809
4868
|
};
|
|
4810
4869
|
|
|
4811
4870
|
// ../../auth/src/loginStatus.ts
|
|
@@ -4929,11 +4988,11 @@ async function loadFileCredentials(loadEnvFile, absolutePath) {
|
|
|
4929
4988
|
return { credentials };
|
|
4930
4989
|
}
|
|
4931
4990
|
async function getGlobalCredsHint(getFs, loadEnvFile, absolutePath, envFilePath) {
|
|
4932
|
-
const
|
|
4933
|
-
const globalPath =
|
|
4991
|
+
const fs = getFs();
|
|
4992
|
+
const globalPath = fs.path.join(fs.env.homedir(), envFilePath);
|
|
4934
4993
|
if (absolutePath === globalPath)
|
|
4935
4994
|
return;
|
|
4936
|
-
if (!await
|
|
4995
|
+
if (!await fs.exists(globalPath))
|
|
4937
4996
|
return;
|
|
4938
4997
|
try {
|
|
4939
4998
|
const globalCreds = await loadEnvFile({ envPath: globalPath });
|
|
@@ -5348,6 +5407,51 @@ function normalizeTokenRefreshUnavailableFailure() {
|
|
|
5348
5407
|
function errorMessage(error) {
|
|
5349
5408
|
return error instanceof Error ? error.message : String(error);
|
|
5350
5409
|
}
|
|
5410
|
+
|
|
5411
|
+
// ../../auth/src/authContext.ts
|
|
5412
|
+
class AuthContextUnavailableError extends Error {
|
|
5413
|
+
instructionContext;
|
|
5414
|
+
sessionHint;
|
|
5415
|
+
errorCode = "authentication_required";
|
|
5416
|
+
retry = "RetryWillNotFix";
|
|
5417
|
+
constructor(message, instructionContext = "auth", sessionHint) {
|
|
5418
|
+
super(message);
|
|
5419
|
+
this.instructionContext = instructionContext;
|
|
5420
|
+
this.sessionHint = sessionHint;
|
|
5421
|
+
this.name = "AuthContextUnavailableError";
|
|
5422
|
+
}
|
|
5423
|
+
}
|
|
5424
|
+
var getAuthContext = async (options = {}) => {
|
|
5425
|
+
const status = await getLoginStatusAsync({
|
|
5426
|
+
ensureTokenValidityMinutes: options.ensureTokenValidityMinutes,
|
|
5427
|
+
envFilePath: options.envFilePath
|
|
5428
|
+
});
|
|
5429
|
+
if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken) {
|
|
5430
|
+
throw new AuthContextUnavailableError(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.", "auth", status.hint);
|
|
5431
|
+
}
|
|
5432
|
+
const tenantName = options.tenant || status.tenantName;
|
|
5433
|
+
if (options.requireOrganizationId && !status.organizationId) {
|
|
5434
|
+
throw new AuthContextUnavailableError("Organization ID not available. Ensure you are logged in with an organization context.", "identity");
|
|
5435
|
+
}
|
|
5436
|
+
if (options.requireOrganizationName && !status.organizationName) {
|
|
5437
|
+
throw new AuthContextUnavailableError("Organization name not available. Ensure you are logged in with an organization context.", "identity");
|
|
5438
|
+
}
|
|
5439
|
+
if (options.requireTenantId && !status.tenantId) {
|
|
5440
|
+
throw new AuthContextUnavailableError(`Tenant ID not available. Ensure UIPATH_TENANT_ID is set.${status.hint ? ` ${status.hint}` : ""}`, "identity", status.hint);
|
|
5441
|
+
}
|
|
5442
|
+
if (options.requireTenantName && !tenantName) {
|
|
5443
|
+
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");
|
|
5444
|
+
}
|
|
5445
|
+
return {
|
|
5446
|
+
baseUrl: status.baseUrl,
|
|
5447
|
+
accessToken: status.accessToken,
|
|
5448
|
+
organizationId: status.organizationId,
|
|
5449
|
+
organizationName: status.organizationName,
|
|
5450
|
+
tenantId: status.tenantId,
|
|
5451
|
+
tenantName,
|
|
5452
|
+
identity: status.identity
|
|
5453
|
+
};
|
|
5454
|
+
};
|
|
5351
5455
|
// ../../auth/src/selectTenant.ts
|
|
5352
5456
|
var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
|
|
5353
5457
|
var INVALID_TENANT_CODE = "INVALID_TENANT";
|
|
@@ -5361,17 +5465,12 @@ function rewriteApmsUrl(url) {
|
|
|
5361
5465
|
return url.replace(STRIP_PREFIX_RE, "/accesspolicy_");
|
|
5362
5466
|
}
|
|
5363
5467
|
async function resolveConfig(options) {
|
|
5364
|
-
const
|
|
5365
|
-
ensureTokenValidityMinutes: options?.loginValidity
|
|
5468
|
+
const auth = await getAuthContext({
|
|
5469
|
+
ensureTokenValidityMinutes: options?.loginValidity,
|
|
5470
|
+
requireOrganizationId: true
|
|
5366
5471
|
});
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
}
|
|
5370
|
-
if (!status.organizationId) {
|
|
5371
|
-
throw new Error("Organization ID not available. Ensure you are logged in with an organization context.");
|
|
5372
|
-
}
|
|
5373
|
-
const basePath = `${status.baseUrl}/${status.organizationId}/accesspolicy_`;
|
|
5374
|
-
const bearerToken = options?.s2sToken ?? status.accessToken;
|
|
5472
|
+
const basePath = `${auth.baseUrl}/${encodeURIComponent(auth.organizationId)}/accesspolicy_`;
|
|
5473
|
+
const bearerToken = options?.s2sToken ?? auth.accessToken;
|
|
5375
5474
|
const fetchApi = (input, init) => {
|
|
5376
5475
|
if (typeof input === "string") {
|
|
5377
5476
|
return fetch(rewriteApmsUrl(input), init);
|
|
@@ -5388,7 +5487,7 @@ async function resolveConfig(options) {
|
|
|
5388
5487
|
headers: addSdkUserAgentHeader(undefined, SDK_USER_AGENT),
|
|
5389
5488
|
fetchApi
|
|
5390
5489
|
}),
|
|
5391
|
-
organizationId:
|
|
5490
|
+
organizationId: auth.organizationId
|
|
5392
5491
|
};
|
|
5393
5492
|
}
|
|
5394
5493
|
async function createApiClient(ApiClass, options) {
|
|
@@ -5398,6 +5497,42 @@ async function createApiClient(ApiClass, options) {
|
|
|
5398
5497
|
organizationId
|
|
5399
5498
|
};
|
|
5400
5499
|
}
|
|
5500
|
+
// ../../common/src/telemetry/project-identity.ts
|
|
5501
|
+
function projectKey(id) {
|
|
5502
|
+
if (typeof id !== "string")
|
|
5503
|
+
return;
|
|
5504
|
+
const key = id.trim().toLowerCase().replaceAll("-", "");
|
|
5505
|
+
return /^[0-9a-f]{32}$/.test(key) ? key : undefined;
|
|
5506
|
+
}
|
|
5507
|
+
function projectIdentityProperties(identity) {
|
|
5508
|
+
const key = identity.id ? projectKey(identity.id) : undefined;
|
|
5509
|
+
return {
|
|
5510
|
+
[ProjectDimensions.ProjectIdentityStatus]: identity.status === "resolved" && !key ? "invalid" : identity.status,
|
|
5511
|
+
[ProjectDimensions.ProjectType]: identity.projectType,
|
|
5512
|
+
...identity.status === "resolved" && key ? {
|
|
5513
|
+
[ProjectDimensions.ProjectKey]: key
|
|
5514
|
+
} : {}
|
|
5515
|
+
};
|
|
5516
|
+
}
|
|
5517
|
+
var PROJECT_IDENTITY_LOOKUP_BUDGET_MS = 1000;
|
|
5518
|
+
async function withinProjectIdentityBudget(work, onTimeout) {
|
|
5519
|
+
work.catch(() => {
|
|
5520
|
+
return;
|
|
5521
|
+
});
|
|
5522
|
+
let timer;
|
|
5523
|
+
const expired = new Promise((resolve) => {
|
|
5524
|
+
timer = setTimeout(() => {
|
|
5525
|
+
onTimeout?.();
|
|
5526
|
+
resolve(undefined);
|
|
5527
|
+
}, PROJECT_IDENTITY_LOOKUP_BUDGET_MS);
|
|
5528
|
+
});
|
|
5529
|
+
try {
|
|
5530
|
+
return await Promise.race([work, expired]);
|
|
5531
|
+
} finally {
|
|
5532
|
+
clearTimeout(timer);
|
|
5533
|
+
}
|
|
5534
|
+
}
|
|
5535
|
+
|
|
5401
5536
|
// ../../common/src/telemetry/pseudonymize.ts
|
|
5402
5537
|
var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
|
|
5403
5538
|
var PSEUDONYM_HEX_LENGTH = 32;
|
|
@@ -5736,8 +5871,8 @@ function redactValueDetectors(value, maxLength = MAX_VALUE_LENGTH) {
|
|
|
5736
5871
|
return `${redactUrl(core)}${trailing}`;
|
|
5737
5872
|
});
|
|
5738
5873
|
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
5739
|
-
out = out.replace(UNC_PATH_PATTERN, (_match, before,
|
|
5740
|
-
const [core, trailing] = peelTrailingPunctuation(
|
|
5874
|
+
out = out.replace(UNC_PATH_PATTERN, (_match, before, path) => {
|
|
5875
|
+
const [core, trailing] = peelTrailingPunctuation(path);
|
|
5741
5876
|
return `${before}unc#${pseudonymize(core)}${trailing}`;
|
|
5742
5877
|
});
|
|
5743
5878
|
out = out.replace(EMAIL_PATTERN, (match) => `email#${pseudonymize(match)}`);
|
|
@@ -5831,6 +5966,8 @@ function redactProperty(name, value) {
|
|
|
5831
5966
|
if (isSensitiveName(name)) {
|
|
5832
5967
|
return REDACTED;
|
|
5833
5968
|
}
|
|
5969
|
+
if (GUID_KEY_DIMENSIONS.has(name))
|
|
5970
|
+
return projectKey(value);
|
|
5834
5971
|
if (typeof value === "boolean" || typeof value === "number") {
|
|
5835
5972
|
return value;
|
|
5836
5973
|
}
|
|
@@ -5905,6 +6042,63 @@ function settlePromiseLike2(thenable) {
|
|
|
5905
6042
|
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
|
|
5906
6043
|
}
|
|
5907
6044
|
|
|
6045
|
+
// ../../common/src/error-codes.ts
|
|
6046
|
+
var CLI_ERROR_CODES = [
|
|
6047
|
+
"invalid_argument",
|
|
6048
|
+
"authentication_required",
|
|
6049
|
+
"permission_denied",
|
|
6050
|
+
"local_permission_denied",
|
|
6051
|
+
"not_found",
|
|
6052
|
+
"rate_limited",
|
|
6053
|
+
"network_error",
|
|
6054
|
+
"timeout",
|
|
6055
|
+
"server_error",
|
|
6056
|
+
"method_not_allowed",
|
|
6057
|
+
"not_supported",
|
|
6058
|
+
"configuration_error",
|
|
6059
|
+
"execution_failed",
|
|
6060
|
+
"unknown_error"
|
|
6061
|
+
];
|
|
6062
|
+
var RETRY_HINTS = [
|
|
6063
|
+
"RetryWillNotFix",
|
|
6064
|
+
"RetryLater",
|
|
6065
|
+
"RetryAfter1Second",
|
|
6066
|
+
"RetryAfter10Seconds",
|
|
6067
|
+
"RetryAfter30Seconds",
|
|
6068
|
+
"RetryAfter60Seconds"
|
|
6069
|
+
];
|
|
6070
|
+
var CLI_ERROR_CODE_VALUES = new Set(CLI_ERROR_CODES);
|
|
6071
|
+
var RETRY_HINT_VALUES = new Set(RETRY_HINTS);
|
|
6072
|
+
function isCliErrorCode(value) {
|
|
6073
|
+
return typeof value === "string" && CLI_ERROR_CODE_VALUES.has(value);
|
|
6074
|
+
}
|
|
6075
|
+
function isRetryHint(value) {
|
|
6076
|
+
return typeof value === "string" && RETRY_HINT_VALUES.has(value);
|
|
6077
|
+
}
|
|
6078
|
+
function carriedErrorCode(error) {
|
|
6079
|
+
if (!error || typeof error !== "object")
|
|
6080
|
+
return;
|
|
6081
|
+
const code = error.errorCode;
|
|
6082
|
+
return isCliErrorCode(code) ? code : undefined;
|
|
6083
|
+
}
|
|
6084
|
+
function carriedRetry(error) {
|
|
6085
|
+
if (!error || typeof error !== "object")
|
|
6086
|
+
return;
|
|
6087
|
+
const retry = error.retry;
|
|
6088
|
+
return isRetryHint(retry) ? retry : undefined;
|
|
6089
|
+
}
|
|
6090
|
+
function defaultRetryForErrorCode(errorCode) {
|
|
6091
|
+
switch (errorCode) {
|
|
6092
|
+
case "network_error":
|
|
6093
|
+
case "rate_limited":
|
|
6094
|
+
case "server_error":
|
|
6095
|
+
case "timeout":
|
|
6096
|
+
return "RetryLater";
|
|
6097
|
+
default:
|
|
6098
|
+
return "RetryWillNotFix";
|
|
6099
|
+
}
|
|
6100
|
+
}
|
|
6101
|
+
|
|
5908
6102
|
// ../../common/src/error-graph.ts
|
|
5909
6103
|
function* walkErrorGraph(error) {
|
|
5910
6104
|
const queue = [error];
|
|
@@ -5949,6 +6143,40 @@ function findHttpStatusInGraph(error) {
|
|
|
5949
6143
|
return;
|
|
5950
6144
|
}
|
|
5951
6145
|
|
|
6146
|
+
// ../../common/src/http-status.ts
|
|
6147
|
+
function classifyHttpStatus(status) {
|
|
6148
|
+
if (status === undefined)
|
|
6149
|
+
return;
|
|
6150
|
+
if (status === 400 || status === 409 || status === 413 || status === 422) {
|
|
6151
|
+
return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
|
|
6152
|
+
}
|
|
6153
|
+
if (status === 401) {
|
|
6154
|
+
return {
|
|
6155
|
+
errorCode: "authentication_required",
|
|
6156
|
+
retry: "RetryWillNotFix"
|
|
6157
|
+
};
|
|
6158
|
+
}
|
|
6159
|
+
if (status === 403) {
|
|
6160
|
+
return { errorCode: "permission_denied", retry: "RetryWillNotFix" };
|
|
6161
|
+
}
|
|
6162
|
+
if (status === 404) {
|
|
6163
|
+
return { errorCode: "not_found", retry: "RetryWillNotFix" };
|
|
6164
|
+
}
|
|
6165
|
+
if (status === 405) {
|
|
6166
|
+
return { errorCode: "method_not_allowed", retry: "RetryWillNotFix" };
|
|
6167
|
+
}
|
|
6168
|
+
if (status === 408) {
|
|
6169
|
+
return { errorCode: "timeout", retry: "RetryLater" };
|
|
6170
|
+
}
|
|
6171
|
+
if (status === 429) {
|
|
6172
|
+
return { errorCode: "rate_limited", retry: "RetryLater" };
|
|
6173
|
+
}
|
|
6174
|
+
if (status >= 500 && status < 600) {
|
|
6175
|
+
return { errorCode: "server_error", retry: "RetryLater" };
|
|
6176
|
+
}
|
|
6177
|
+
return;
|
|
6178
|
+
}
|
|
6179
|
+
|
|
5952
6180
|
// ../../common/src/local-permission-codes.ts
|
|
5953
6181
|
var LOCAL_PERMISSION_ERROR_CODES = new Set([
|
|
5954
6182
|
"EACCES",
|
|
@@ -5961,6 +6189,8 @@ var DEFAULT_401 = "Unauthorized (401). The session is missing or expired, or its
|
|
|
5961
6189
|
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.";
|
|
5962
6190
|
var DEFAULT_405 = "Method Not Allowed (405). The endpoint may not exist or the base URL may be incorrect.";
|
|
5963
6191
|
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.";
|
|
6192
|
+
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.";
|
|
6193
|
+
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.";
|
|
5964
6194
|
var HTML_RESPONSE_MESSAGE = "Received HTML instead of the expected JSON response.";
|
|
5965
6195
|
var NETWORK_ERROR_CODES = new Set([
|
|
5966
6196
|
"ECONNREFUSED",
|
|
@@ -5986,8 +6216,8 @@ var TLS_ERROR_CODES = new Set([
|
|
|
5986
6216
|
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.";
|
|
5987
6217
|
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.";
|
|
5988
6218
|
var LOCAL_PERMISSION_MESSAGE_PATTERN = new RegExp(`\\b(${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})\\b`);
|
|
5989
|
-
function localPermissionInstructions(code,
|
|
5990
|
-
const target =
|
|
6219
|
+
function localPermissionInstructions(code, path) {
|
|
6220
|
+
const target = path !== undefined ? `'${path}'` : "a local file or resource";
|
|
5991
6221
|
if (code === "EROFS") {
|
|
5992
6222
|
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.";
|
|
5993
6223
|
}
|
|
@@ -6024,12 +6254,12 @@ function describePermissionError(error) {
|
|
|
6024
6254
|
const code = matchLocalPermissionCode(cur.code, message);
|
|
6025
6255
|
if (!code)
|
|
6026
6256
|
continue;
|
|
6027
|
-
const
|
|
6257
|
+
const path = localPermissionPath(cur.path, message);
|
|
6028
6258
|
return {
|
|
6029
6259
|
code,
|
|
6030
6260
|
message: message ?? code,
|
|
6031
|
-
...
|
|
6032
|
-
instructions: localPermissionInstructions(code,
|
|
6261
|
+
...path !== undefined ? { path } : {},
|
|
6262
|
+
instructions: localPermissionInstructions(code, path)
|
|
6033
6263
|
};
|
|
6034
6264
|
}
|
|
6035
6265
|
return;
|
|
@@ -6041,11 +6271,25 @@ function matchLocalPermissionCode(code, message) {
|
|
|
6041
6271
|
const match = message ? LOCAL_PERMISSION_MESSAGE_PATTERN.exec(message) : null;
|
|
6042
6272
|
return match ? match[1] : undefined;
|
|
6043
6273
|
}
|
|
6044
|
-
function localPermissionPath(
|
|
6045
|
-
if (typeof
|
|
6046
|
-
return
|
|
6274
|
+
function localPermissionPath(path, message) {
|
|
6275
|
+
if (typeof path === "string")
|
|
6276
|
+
return path;
|
|
6047
6277
|
return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
|
|
6048
6278
|
}
|
|
6279
|
+
function readHeader(response, name) {
|
|
6280
|
+
const headers = response?.headers;
|
|
6281
|
+
if (!headers || typeof headers !== "object")
|
|
6282
|
+
return;
|
|
6283
|
+
if (typeof headers.get === "function") {
|
|
6284
|
+
const value = headers.get(name);
|
|
6285
|
+
if (value)
|
|
6286
|
+
return value;
|
|
6287
|
+
}
|
|
6288
|
+
const plain = headers;
|
|
6289
|
+
const key = Object.keys(plain).find((k) => k.toLowerCase() === name.toLowerCase());
|
|
6290
|
+
const value = key === undefined ? undefined : plain[key];
|
|
6291
|
+
return typeof value === "string" && value !== "" ? value : undefined;
|
|
6292
|
+
}
|
|
6049
6293
|
function isHtmlDocument(body) {
|
|
6050
6294
|
return /^\s*(<!doctype html|<html\b)/i.test(body);
|
|
6051
6295
|
}
|
|
@@ -6062,36 +6306,9 @@ function retryHintForRetryAfter(seconds) {
|
|
|
6062
6306
|
return "RetryAfter60Seconds";
|
|
6063
6307
|
}
|
|
6064
6308
|
function classifyError(status, error) {
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
if (status === 401) {
|
|
6069
|
-
return {
|
|
6070
|
-
errorCode: "authentication_required",
|
|
6071
|
-
retry: "RetryWillNotFix"
|
|
6072
|
-
};
|
|
6073
|
-
}
|
|
6074
|
-
if (status === 403) {
|
|
6075
|
-
return { errorCode: "permission_denied", retry: "RetryWillNotFix" };
|
|
6076
|
-
}
|
|
6077
|
-
if (status === 404) {
|
|
6078
|
-
return { errorCode: "not_found", retry: "RetryWillNotFix" };
|
|
6079
|
-
}
|
|
6080
|
-
if (status === 405) {
|
|
6081
|
-
return { errorCode: "method_not_allowed", retry: "RetryWillNotFix" };
|
|
6082
|
-
}
|
|
6083
|
-
if (status === 413) {
|
|
6084
|
-
return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
|
|
6085
|
-
}
|
|
6086
|
-
if (status === 408) {
|
|
6087
|
-
return { errorCode: "timeout", retry: "RetryLater" };
|
|
6088
|
-
}
|
|
6089
|
-
if (status === 429) {
|
|
6090
|
-
return { errorCode: "rate_limited", retry: "RetryLater" };
|
|
6091
|
-
}
|
|
6092
|
-
if (status !== undefined && status >= 500 && status < 600) {
|
|
6093
|
-
return { errorCode: "server_error", retry: "RetryLater" };
|
|
6094
|
-
}
|
|
6309
|
+
const byStatus = classifyHttpStatus(status);
|
|
6310
|
+
if (byStatus)
|
|
6311
|
+
return byStatus;
|
|
6095
6312
|
if (status === undefined && describePermissionError(error)) {
|
|
6096
6313
|
return {
|
|
6097
6314
|
errorCode: "local_permission_denied",
|
|
@@ -6107,6 +6324,17 @@ function classifyError(status, error) {
|
|
|
6107
6324
|
}
|
|
6108
6325
|
return { errorCode: "unknown_error", retry: "RetryWillNotFix" };
|
|
6109
6326
|
}
|
|
6327
|
+
function withCarriedClass(inferred, error) {
|
|
6328
|
+
const errorCode = carriedErrorCode(error);
|
|
6329
|
+
const retry = carriedRetry(error);
|
|
6330
|
+
if (errorCode === undefined || errorCode === inferred.errorCode) {
|
|
6331
|
+
return {
|
|
6332
|
+
errorCode: inferred.errorCode,
|
|
6333
|
+
retry: retry ?? inferred.retry
|
|
6334
|
+
};
|
|
6335
|
+
}
|
|
6336
|
+
return { errorCode, retry: retry ?? defaultRetryForErrorCode(errorCode) };
|
|
6337
|
+
}
|
|
6110
6338
|
function formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus) {
|
|
6111
6339
|
if (extractedMessage) {
|
|
6112
6340
|
return `HTTP ${status}: ${extractedMessage}`;
|
|
@@ -6162,9 +6390,14 @@ async function extractErrorDetails(error, options) {
|
|
|
6162
6390
|
const classificationStatus = status ?? findHttpStatusInGraph(error);
|
|
6163
6391
|
const classification = classifyError(classificationStatus, error);
|
|
6164
6392
|
let retry = classification.retry;
|
|
6393
|
+
const htmlForbidden = status === 403 && rawBody !== undefined && isHtmlDocument(rawBody);
|
|
6394
|
+
const rayId = htmlForbidden ? readHeader(response, "cf-ray") : undefined;
|
|
6395
|
+
const cloudflareBlock = htmlForbidden && (rayId !== undefined || /\bcloudflare\b/i.test(readHeader(response, "server") ?? ""));
|
|
6165
6396
|
if (status === 401) {
|
|
6166
6397
|
message = DEFAULT_401;
|
|
6167
6398
|
result = "AuthenticationError";
|
|
6399
|
+
} else if (cloudflareBlock) {
|
|
6400
|
+
message = rayId ? `${CLOUDFLARE_BLOCK_403} Cloudflare Ray ID: ${rayId}.` : CLOUDFLARE_BLOCK_403;
|
|
6168
6401
|
} else if (status === 403) {
|
|
6169
6402
|
message = options?.forbiddenMessage ?? DEFAULT_403;
|
|
6170
6403
|
result = "AuthenticationError";
|
|
@@ -6212,7 +6445,9 @@ async function extractErrorDetails(error, options) {
|
|
|
6212
6445
|
}
|
|
6213
6446
|
}
|
|
6214
6447
|
let details = rawMessage;
|
|
6215
|
-
if (
|
|
6448
|
+
if (htmlForbidden) {
|
|
6449
|
+
details = cloudflareBlock ? CLOUDFLARE_BLOCK_403_INSTRUCTIONS : HTML_RESPONSE_MESSAGE;
|
|
6450
|
+
} else if (rawBody) {
|
|
6216
6451
|
if (parsedBody) {
|
|
6217
6452
|
const extra = {};
|
|
6218
6453
|
if (parsedBody.errorCode)
|
|
@@ -6246,6 +6481,8 @@ async function extractErrorDetails(error, options) {
|
|
|
6246
6481
|
}
|
|
6247
6482
|
if (parsedBody?.requestId && typeof parsedBody.requestId === "string") {
|
|
6248
6483
|
context.requestId = parsedBody.requestId;
|
|
6484
|
+
} else if (cloudflareBlock && rayId) {
|
|
6485
|
+
context.requestId = rayId;
|
|
6249
6486
|
}
|
|
6250
6487
|
if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
|
|
6251
6488
|
context.traceId = parsedBody.traceId;
|
|
@@ -6254,16 +6491,7 @@ async function extractErrorDetails(error, options) {
|
|
|
6254
6491
|
context.path = permission.path;
|
|
6255
6492
|
}
|
|
6256
6493
|
if (status === 429) {
|
|
6257
|
-
const
|
|
6258
|
-
const headersObj = resp?.headers;
|
|
6259
|
-
let retryAfterValue;
|
|
6260
|
-
if (headersObj && typeof headersObj === "object" && typeof headersObj.get === "function") {
|
|
6261
|
-
retryAfterValue = headersObj.get("retry-after") ?? undefined;
|
|
6262
|
-
}
|
|
6263
|
-
if (!retryAfterValue && headersObj && typeof headersObj === "object") {
|
|
6264
|
-
const headers = headersObj;
|
|
6265
|
-
retryAfterValue = headers["retry-after"] ?? headers["Retry-After"];
|
|
6266
|
-
}
|
|
6494
|
+
const retryAfterValue = readHeader(response, "retry-after");
|
|
6267
6495
|
if (retryAfterValue) {
|
|
6268
6496
|
const seconds = Number(retryAfterValue);
|
|
6269
6497
|
if (!Number.isNaN(seconds)) {
|
|
@@ -6297,9 +6525,8 @@ async function extractErrorDetails(error, options) {
|
|
|
6297
6525
|
}
|
|
6298
6526
|
return {
|
|
6299
6527
|
result,
|
|
6300
|
-
errorCode: classification.errorCode,
|
|
6528
|
+
...withCarriedClass({ errorCode: classification.errorCode, retry }, error),
|
|
6301
6529
|
message,
|
|
6302
|
-
retry,
|
|
6303
6530
|
details,
|
|
6304
6531
|
...hasContext ? { context } : {},
|
|
6305
6532
|
...parsedErrors ? { parsedErrors } : {}
|
|
@@ -6309,51 +6536,224 @@ async function extractErrorMessage(error, options) {
|
|
|
6309
6536
|
const { message } = await extractErrorDetails(error, options);
|
|
6310
6537
|
return message;
|
|
6311
6538
|
}
|
|
6312
|
-
// ../../common/src/
|
|
6313
|
-
function
|
|
6314
|
-
|
|
6539
|
+
// ../../common/src/error-instructions.ts
|
|
6540
|
+
function extractHttpStatus(err) {
|
|
6541
|
+
if (!err || typeof err !== "object")
|
|
6542
|
+
return;
|
|
6543
|
+
const e = err;
|
|
6544
|
+
const structured = e.response?.status ?? e.status ?? e.statusCode;
|
|
6545
|
+
if (structured !== undefined)
|
|
6546
|
+
return structured;
|
|
6547
|
+
return typeof e.message === "string" ? parseHttpStatusFromMessage(e.message) : undefined;
|
|
6315
6548
|
}
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
const [error, mod] = catchError2(() => __require("node:async_hooks"));
|
|
6320
|
-
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
6321
|
-
return {
|
|
6322
|
-
getStore: () => {
|
|
6323
|
-
return;
|
|
6324
|
-
},
|
|
6325
|
-
run: (_store, fn) => fn()
|
|
6326
|
-
};
|
|
6327
|
-
}
|
|
6328
|
-
return new mod.AsyncLocalStorage;
|
|
6549
|
+
var GENERIC = "Check authentication and parameters";
|
|
6550
|
+
function hasIdentityInstructionContext(err) {
|
|
6551
|
+
return err !== null && typeof err === "object" && "instructionContext" in err && err.instructionContext === "identity";
|
|
6329
6552
|
}
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6553
|
+
function instructionsFor(ctx, err) {
|
|
6554
|
+
if (ctx === "auth" && hasIdentityInstructionContext(err)) {
|
|
6555
|
+
return instructionsFor("identity");
|
|
6556
|
+
}
|
|
6557
|
+
switch (ctx) {
|
|
6558
|
+
case "auth":
|
|
6559
|
+
return "Run 'uip login' to authenticate. To inspect the current session, run 'uip whoami'.";
|
|
6560
|
+
case "auth-configuration":
|
|
6561
|
+
return "Fix the authentication settings named in Message, then retry.";
|
|
6562
|
+
case "identity":
|
|
6563
|
+
return "Select an active tenant with 'uip login tenant set <tenant>' and ensure your login includes an organization";
|
|
6564
|
+
case "input-parse":
|
|
6565
|
+
return "Ensure --inputs is valid JSON or pipe JSON via stdin";
|
|
6566
|
+
case "input-validate":
|
|
6567
|
+
return "Fix the flagged input fields to match the process's input schema";
|
|
6568
|
+
case "flag-format":
|
|
6569
|
+
return "Check the flag value format — see --help for the expected shape";
|
|
6570
|
+
case "permissions":
|
|
6571
|
+
return "Confirm your user has the required permissions in this folder/tenant, or re-authenticate with 'uip login' if your session has lapsed";
|
|
6572
|
+
case "backend": {
|
|
6573
|
+
const status = extractHttpStatus(err);
|
|
6574
|
+
if (status === 401) {
|
|
6575
|
+
return "Re-authenticate with 'uip login' — your session is invalid or expired";
|
|
6576
|
+
}
|
|
6577
|
+
if (status === 403) {
|
|
6578
|
+
return "Confirm your user has access to the resource, and the required permissions in this folder or tenant";
|
|
6579
|
+
}
|
|
6580
|
+
if (status === 404) {
|
|
6581
|
+
return "Verify the resource exists in the current folder/tenant";
|
|
6582
|
+
}
|
|
6583
|
+
if (status === 400 || status === 422) {
|
|
6584
|
+
return "Request was rejected — check flag values and inputs";
|
|
6585
|
+
}
|
|
6586
|
+
if (status === 405) {
|
|
6587
|
+
return "Check the command name and the base URL in use — the endpoint may not exist";
|
|
6588
|
+
}
|
|
6589
|
+
if (status === 408) {
|
|
6590
|
+
return "The request timed out — retry; if it persists, narrow the request (e.g. --limit on list commands)";
|
|
6591
|
+
}
|
|
6592
|
+
if (status === 409) {
|
|
6593
|
+
return "The resource already exists, or changed since it was read — list it to see the current state";
|
|
6594
|
+
}
|
|
6595
|
+
if (status === 413) {
|
|
6596
|
+
return "The upload is over the size limit — exclude unused dependencies or drop large files, then retry";
|
|
6597
|
+
}
|
|
6598
|
+
if (status === 429) {
|
|
6599
|
+
return "Rate limit reached — wait and retry; when the service suggests a delay, Retry and Context.retryAfter carry it";
|
|
6600
|
+
}
|
|
6601
|
+
if (status !== undefined && status >= 500 && status < 600) {
|
|
6602
|
+
return "The service returned a server error — retry; if it persists, check service status";
|
|
6603
|
+
}
|
|
6604
|
+
const permission = describePermissionError(err);
|
|
6605
|
+
if (permission) {
|
|
6606
|
+
return permission.instructions;
|
|
6607
|
+
}
|
|
6608
|
+
const connectivity = describeConnectivityError(err);
|
|
6609
|
+
if (connectivity) {
|
|
6610
|
+
return connectivity.instructions;
|
|
6611
|
+
}
|
|
6612
|
+
return GENERIC;
|
|
6613
|
+
}
|
|
6342
6614
|
}
|
|
6343
|
-
};
|
|
6344
|
-
function getOutputSink() {
|
|
6345
|
-
return outputStorage.getStore() ?? sinkSlot.get() ?? CONSOLE_FALLBACK;
|
|
6346
6615
|
}
|
|
6347
6616
|
|
|
6348
|
-
// ../../common/src/
|
|
6349
|
-
var
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6617
|
+
// ../../common/src/result-types.ts
|
|
6618
|
+
var RESULTS = {
|
|
6619
|
+
Success: "Success",
|
|
6620
|
+
Failure: "Failure",
|
|
6621
|
+
ConfigError: "ConfigError",
|
|
6622
|
+
AuthenticationError: "AuthenticationError",
|
|
6623
|
+
ValidationError: "ValidationError",
|
|
6624
|
+
TimeoutError: "TimeoutError"
|
|
6625
|
+
};
|
|
6626
|
+
|
|
6627
|
+
// ../../common/src/classified-failure.ts
|
|
6628
|
+
async function authContextFailure(error, sessionInstructions) {
|
|
6629
|
+
const details = await extractErrorDetails(error);
|
|
6630
|
+
const missingIdentity = hasIdentityInstructionContext(error);
|
|
6631
|
+
return {
|
|
6632
|
+
Result: details.errorCode === "configuration_error" ? RESULTS.ConfigError : details.errorCode === "authentication_required" ? RESULTS.AuthenticationError : details.result,
|
|
6633
|
+
ErrorCode: details.errorCode,
|
|
6634
|
+
Message: details.message,
|
|
6635
|
+
Instructions: details.errorCode === "configuration_error" ? instructionsFor("auth-configuration") : details.errorCode === "authentication_required" && !missingIdentity && sessionInstructions !== undefined ? sessionInstructions : instructionsFor(details.errorCode === "authentication_required" ? "auth" : "backend", error),
|
|
6636
|
+
Retry: details.retry,
|
|
6637
|
+
...details.context ? { Context: details.context } : {}
|
|
6638
|
+
};
|
|
6639
|
+
}
|
|
6640
|
+
// ../../../node_modules/commander/index.js
|
|
6641
|
+
var exports_commander = {};
|
|
6642
|
+
__exportCjs(exports_commander, {
|
|
6643
|
+
program: () => $program,
|
|
6644
|
+
createCommand: () => $createCommand,
|
|
6645
|
+
createOption: () => $createOption,
|
|
6646
|
+
createArgument: () => $createArgument,
|
|
6647
|
+
Command: () => $Command,
|
|
6648
|
+
Option: () => $Option,
|
|
6649
|
+
Argument: () => $Argument,
|
|
6650
|
+
Help: () => $Help,
|
|
6651
|
+
CommanderError: () => $CommanderError,
|
|
6652
|
+
InvalidArgumentError: () => $InvalidArgumentError,
|
|
6653
|
+
InvalidOptionArgumentError: () => $InvalidOptionArgumentError
|
|
6654
|
+
}, {
|
|
6655
|
+
program: (value) => $program = value,
|
|
6656
|
+
createCommand: (value) => $createCommand = value,
|
|
6657
|
+
createOption: (value) => $createOption = value,
|
|
6658
|
+
createArgument: (value) => $createArgument = value,
|
|
6659
|
+
Command: (value) => $Command = value,
|
|
6660
|
+
Option: (value) => $Option = value,
|
|
6661
|
+
Argument: (value) => $Argument = value,
|
|
6662
|
+
Help: (value) => $Help = value,
|
|
6663
|
+
CommanderError: (value) => $CommanderError = value,
|
|
6664
|
+
InvalidArgumentError: (value) => $InvalidArgumentError = value,
|
|
6665
|
+
InvalidOptionArgumentError: (value) => $InvalidOptionArgumentError = value
|
|
6666
|
+
});
|
|
6667
|
+
var { Argument } = require_argument();
|
|
6668
|
+
var { Command: Command2 } = require_command();
|
|
6669
|
+
var { CommanderError, InvalidArgumentError } = require_error();
|
|
6670
|
+
var { Help } = require_help();
|
|
6671
|
+
var { Option } = require_option();
|
|
6672
|
+
var $program = new Command2;
|
|
6673
|
+
var $createCommand = (name) => new Command2(name);
|
|
6674
|
+
var $createOption = (flags, description) => new Option(flags, description);
|
|
6675
|
+
var $createArgument = (name, description) => new Argument(name, description);
|
|
6676
|
+
var $Command = Command2;
|
|
6677
|
+
var $Option = Option;
|
|
6678
|
+
var $Argument = Argument;
|
|
6679
|
+
var $Help = Help;
|
|
6680
|
+
var $CommanderError = CommanderError;
|
|
6681
|
+
var $InvalidArgumentError = InvalidArgumentError;
|
|
6682
|
+
var $InvalidOptionArgumentError = InvalidArgumentError;
|
|
6683
|
+
|
|
6684
|
+
// ../../../node_modules/commander/esm.mjs
|
|
6685
|
+
var {
|
|
6686
|
+
program,
|
|
6687
|
+
createCommand,
|
|
6688
|
+
createArgument,
|
|
6689
|
+
createOption,
|
|
6690
|
+
CommanderError: CommanderError2,
|
|
6691
|
+
InvalidArgumentError: InvalidArgumentError2,
|
|
6692
|
+
InvalidOptionArgumentError,
|
|
6693
|
+
Command,
|
|
6694
|
+
Argument: Argument2,
|
|
6695
|
+
Option: Option2,
|
|
6696
|
+
Help: Help2
|
|
6697
|
+
} = exports_commander;
|
|
6698
|
+
|
|
6699
|
+
// ../../common/src/command-examples.ts
|
|
6700
|
+
var examplesByCommand = new WeakMap;
|
|
6701
|
+
Command.prototype.examples = function(examples) {
|
|
6702
|
+
examplesByCommand.set(this, examples);
|
|
6703
|
+
return this;
|
|
6704
|
+
};
|
|
6705
|
+
// ../../common/src/preview.ts
|
|
6706
|
+
var previewSlot = singleton("PreviewBuild");
|
|
6707
|
+
function isPreviewBuild() {
|
|
6708
|
+
return previewSlot.get(false) ?? false;
|
|
6709
|
+
}
|
|
6710
|
+
Command.prototype.previewCommand = function(nameAndArgs, opts) {
|
|
6711
|
+
if (isPreviewBuild()) {
|
|
6712
|
+
return this.command(nameAndArgs, opts);
|
|
6713
|
+
}
|
|
6714
|
+
return new Command(nameAndArgs.split(/\s+/)[0] ?? nameAndArgs);
|
|
6715
|
+
};
|
|
6716
|
+
|
|
6717
|
+
// ../../common/src/output-context.ts
|
|
6718
|
+
function createStorage() {
|
|
6719
|
+
const [error, mod] = catchError2(() => __require("node:async_hooks"));
|
|
6720
|
+
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
6721
|
+
return {
|
|
6722
|
+
getStore: () => {
|
|
6723
|
+
return;
|
|
6724
|
+
},
|
|
6725
|
+
run: (_store, fn) => fn()
|
|
6726
|
+
};
|
|
6727
|
+
}
|
|
6728
|
+
return new mod.AsyncLocalStorage;
|
|
6729
|
+
}
|
|
6730
|
+
var storageSingleton = singleton("OutputStorage");
|
|
6731
|
+
var sinkSlot = singleton("OutputSink");
|
|
6732
|
+
var outputStorage = storageSingleton.getOrInit(createStorage, (v) => ("getStore" in v));
|
|
6733
|
+
var CONSOLE_FALLBACK = {
|
|
6734
|
+
writeOut: (str) => process.stdout.write(str),
|
|
6735
|
+
writeErr: (str) => process.stderr.write(str),
|
|
6736
|
+
writeLog: (str) => process.stdout.write(str),
|
|
6737
|
+
capabilities: {
|
|
6738
|
+
isInteractive: false,
|
|
6739
|
+
canReadInput: false,
|
|
6740
|
+
supportsColor: false,
|
|
6741
|
+
outputWidth: 80
|
|
6742
|
+
}
|
|
6743
|
+
};
|
|
6744
|
+
function getOutputSink() {
|
|
6745
|
+
return outputStorage.getStore() ?? sinkSlot.get() ?? CONSOLE_FALLBACK;
|
|
6746
|
+
}
|
|
6747
|
+
|
|
6748
|
+
// ../../common/src/logger.ts
|
|
6749
|
+
var logFilePathSlot = singleton("logFilePath");
|
|
6750
|
+
function setGlobalLogFilePath(path) {
|
|
6751
|
+
logFilePathSlot.set(path);
|
|
6752
|
+
}
|
|
6753
|
+
function getGlobalLogFilePath() {
|
|
6754
|
+
return logFilePathSlot.get("");
|
|
6755
|
+
}
|
|
6756
|
+
var DEFAULT_LOG_LEVEL = 2 /* WARN */;
|
|
6357
6757
|
|
|
6358
6758
|
class SimpleLogger {
|
|
6359
6759
|
__brand = "SimpleLogger";
|
|
@@ -6416,14 +6816,14 @@ class SimpleLogger {
|
|
|
6416
6816
|
return this.fileLoggingEnabled || !!getGlobalLogFilePath();
|
|
6417
6817
|
}
|
|
6418
6818
|
writeToFile(formatted) {
|
|
6419
|
-
const
|
|
6420
|
-
if (!
|
|
6819
|
+
const path = this.logFilePath || getGlobalLogFilePath();
|
|
6820
|
+
if (!path)
|
|
6421
6821
|
return;
|
|
6422
6822
|
const timestamp = new Date().toISOString();
|
|
6423
6823
|
this.pendingWrites = Promise.all([
|
|
6424
6824
|
this.pendingWrites,
|
|
6425
6825
|
this.pendingInit
|
|
6426
|
-
]).then(() => getFileSystem().appendFile(
|
|
6826
|
+
]).then(() => getFileSystem().appendFile(path, `${timestamp} ${formatted}`).catch(() => {}));
|
|
6427
6827
|
}
|
|
6428
6828
|
write(formatted) {
|
|
6429
6829
|
if (this.isFileLoggingActive()) {
|
|
@@ -6473,17 +6873,17 @@ class SimpleLogger {
|
|
|
6473
6873
|
setGlobalLogFilePath("");
|
|
6474
6874
|
}
|
|
6475
6875
|
}
|
|
6476
|
-
setLogFile(
|
|
6477
|
-
this.logFilePath =
|
|
6478
|
-
setGlobalLogFilePath(
|
|
6479
|
-
if (!
|
|
6876
|
+
setLogFile(path) {
|
|
6877
|
+
this.logFilePath = path;
|
|
6878
|
+
setGlobalLogFilePath(path);
|
|
6879
|
+
if (!path)
|
|
6480
6880
|
return;
|
|
6481
6881
|
this.fileLoggingEnabled = true;
|
|
6482
|
-
const
|
|
6882
|
+
const fs = getFileSystem();
|
|
6483
6883
|
this.pendingInit = (async () => {
|
|
6484
6884
|
const [error] = await catchError2((async () => {
|
|
6485
|
-
await
|
|
6486
|
-
await
|
|
6885
|
+
await fs.mkdir(fs.path.dirname(path));
|
|
6886
|
+
await fs.writeFile(path, "");
|
|
6487
6887
|
})());
|
|
6488
6888
|
if (error)
|
|
6489
6889
|
this.fileLoggingEnabled = false;
|
|
@@ -6531,18 +6931,111 @@ function getLogFilePath() {
|
|
|
6531
6931
|
return logger.getLogFilePath();
|
|
6532
6932
|
}
|
|
6533
6933
|
|
|
6934
|
+
// ../../common/src/timings.ts
|
|
6935
|
+
var TIMINGS_ENV_VAR = "UIP_TIMINGS";
|
|
6936
|
+
function createStorage2() {
|
|
6937
|
+
const [error, mod] = catchError2(() => __require("node:async_hooks"));
|
|
6938
|
+
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
6939
|
+
return {
|
|
6940
|
+
getStore: () => {
|
|
6941
|
+
return;
|
|
6942
|
+
},
|
|
6943
|
+
run: (_store, fn) => fn()
|
|
6944
|
+
};
|
|
6945
|
+
}
|
|
6946
|
+
return new mod.AsyncLocalStorage;
|
|
6947
|
+
}
|
|
6948
|
+
var storageSlot = singleton("TimingStorage");
|
|
6949
|
+
var stateSlot = singleton("Timings");
|
|
6950
|
+
var rootStartedSlot = singleton("TimingsRootStarted");
|
|
6951
|
+
var longLivedHostSlot = singleton("TimingsLongLivedHost");
|
|
6952
|
+
var storage = storageSlot.getOrInit(createStorage2, (value) => ("getStore" in value));
|
|
6953
|
+
function newState(baseline) {
|
|
6954
|
+
return { baseline, httpMs: 0, httpCalls: 0 };
|
|
6955
|
+
}
|
|
6956
|
+
function getState() {
|
|
6957
|
+
const scoped = storage.getStore();
|
|
6958
|
+
if (scoped) {
|
|
6959
|
+
return scoped;
|
|
6960
|
+
}
|
|
6961
|
+
const pinned = livePinnedState();
|
|
6962
|
+
if (pinned !== undefined) {
|
|
6963
|
+
return pinned;
|
|
6964
|
+
}
|
|
6965
|
+
return newState(processStartIsInvocationStart() ? 0 : performance.now());
|
|
6966
|
+
}
|
|
6967
|
+
function livePinnedState() {
|
|
6968
|
+
const pinned = stateSlot.get();
|
|
6969
|
+
return pinned !== undefined && "httpCalls" in pinned && !pinned.finished ? pinned : undefined;
|
|
6970
|
+
}
|
|
6971
|
+
function processStartIsInvocationStart() {
|
|
6972
|
+
return !rootStartedSlot.get(false) && !longLivedHostSlot.get(false);
|
|
6973
|
+
}
|
|
6974
|
+
function timingsEnabled() {
|
|
6975
|
+
if (typeof process === "undefined") {
|
|
6976
|
+
return false;
|
|
6977
|
+
}
|
|
6978
|
+
const value = process.env?.[TIMINGS_ENV_VAR];
|
|
6979
|
+
if (value === undefined) {
|
|
6980
|
+
return false;
|
|
6981
|
+
}
|
|
6982
|
+
const normalized = value.trim().toLowerCase();
|
|
6983
|
+
return normalized === "1" || normalized === "true";
|
|
6984
|
+
}
|
|
6985
|
+
function recordExitCode(exitCode) {
|
|
6986
|
+
if (!timingsEnabled()) {
|
|
6987
|
+
return;
|
|
6988
|
+
}
|
|
6989
|
+
getState().exitCode = exitCode;
|
|
6990
|
+
}
|
|
6991
|
+
function invocationStartedAt() {
|
|
6992
|
+
return new Date(performance.timeOrigin + getState().baseline);
|
|
6993
|
+
}
|
|
6994
|
+
function invocationElapsedMs() {
|
|
6995
|
+
return performance.now() - getState().baseline;
|
|
6996
|
+
}
|
|
6997
|
+
function markCommandStart() {
|
|
6998
|
+
if (!timingsEnabled()) {
|
|
6999
|
+
return;
|
|
7000
|
+
}
|
|
7001
|
+
getState().commandStart = performance.now();
|
|
7002
|
+
}
|
|
7003
|
+
function recordCommandDuration(durationMs) {
|
|
7004
|
+
if (!timingsEnabled()) {
|
|
7005
|
+
return;
|
|
7006
|
+
}
|
|
7007
|
+
getState().commandMs = durationMs;
|
|
7008
|
+
}
|
|
7009
|
+
|
|
7010
|
+
// ../../common/src/exit-code.ts
|
|
7011
|
+
function setExitCode(code) {
|
|
7012
|
+
process.exitCode = code;
|
|
7013
|
+
recordExitCode(code);
|
|
7014
|
+
}
|
|
7015
|
+
var GENERIC_FAILURE_EXIT_CODE = 1;
|
|
7016
|
+
function recordCommandExit(code) {
|
|
7017
|
+
if (code === GENERIC_FAILURE_EXIT_CODE && getExitCode() !== 0) {
|
|
7018
|
+
return;
|
|
7019
|
+
}
|
|
7020
|
+
setExitCode(code);
|
|
7021
|
+
}
|
|
7022
|
+
function getExitCode() {
|
|
7023
|
+
const code = process.exitCode;
|
|
7024
|
+
return typeof code === "number" ? code : 0;
|
|
7025
|
+
}
|
|
7026
|
+
|
|
6534
7027
|
// ../../common/src/output-codecs.ts
|
|
6535
7028
|
var yamlSlot = singleton("YamlCodec");
|
|
6536
7029
|
var jmespathSlot = singleton("JmespathCodec");
|
|
6537
7030
|
async function loadOutputCodecsAsync(needed) {
|
|
6538
7031
|
const loads = [];
|
|
6539
7032
|
if (needed.yaml && yamlSlot.get() === undefined) {
|
|
6540
|
-
loads.push(import("./js-yaml-
|
|
7033
|
+
loads.push(import("./js-yaml-cr6n3g9w.js").then((mod) => {
|
|
6541
7034
|
yamlSlot.set(mod);
|
|
6542
7035
|
}));
|
|
6543
7036
|
}
|
|
6544
7037
|
if (needed.filter && jmespathSlot.get() === undefined) {
|
|
6545
|
-
loads.push(import("./jmespath-
|
|
7038
|
+
loads.push(import("./jmespath-09m00b2f.js").then((m)=>__toESM(m.default,1)).then((mod) => {
|
|
6546
7039
|
jmespathSlot.set(mod);
|
|
6547
7040
|
}));
|
|
6548
7041
|
}
|
|
@@ -6685,17 +7178,8 @@ function terminalSignalFor(input, outcome) {
|
|
|
6685
7178
|
}
|
|
6686
7179
|
return outcome === "cancelled" ? "SIGINT" : undefined;
|
|
6687
7180
|
}
|
|
6688
|
-
function
|
|
6689
|
-
|
|
6690
|
-
return "auth";
|
|
6691
|
-
}
|
|
6692
|
-
if (status === 400 || status === 409 || status === 422) {
|
|
6693
|
-
return "validation";
|
|
6694
|
-
}
|
|
6695
|
-
if (status === 408) {
|
|
6696
|
-
return "timeout";
|
|
6697
|
-
}
|
|
6698
|
-
return "network_http";
|
|
7181
|
+
function classifyFailingHttpStatus(status) {
|
|
7182
|
+
return classifyFromErrorCode(classifyHttpStatus(status)?.errorCode) ?? "network_http";
|
|
6699
7183
|
}
|
|
6700
7184
|
function classifyFromResult(result) {
|
|
6701
7185
|
switch (result) {
|
|
@@ -6709,23 +7193,23 @@ function classifyFromResult(result) {
|
|
|
6709
7193
|
return;
|
|
6710
7194
|
}
|
|
6711
7195
|
}
|
|
6712
|
-
function classifyFromErrorCode(
|
|
6713
|
-
if (!
|
|
7196
|
+
function classifyFromErrorCode(errorCode) {
|
|
7197
|
+
if (!errorCode) {
|
|
6714
7198
|
return;
|
|
6715
7199
|
}
|
|
6716
|
-
if (AUTH_ERROR_CODES.has(
|
|
7200
|
+
if (AUTH_ERROR_CODES.has(errorCode)) {
|
|
6717
7201
|
return "auth";
|
|
6718
7202
|
}
|
|
6719
|
-
if (LOCAL_PERMISSION_CLI_ERROR_CODES.has(
|
|
7203
|
+
if (LOCAL_PERMISSION_CLI_ERROR_CODES.has(errorCode)) {
|
|
6720
7204
|
return "local_permission";
|
|
6721
7205
|
}
|
|
6722
|
-
if (VALIDATION_ERROR_CODES.has(
|
|
7206
|
+
if (VALIDATION_ERROR_CODES.has(errorCode)) {
|
|
6723
7207
|
return "validation";
|
|
6724
7208
|
}
|
|
6725
|
-
if (TIMEOUT_ERROR_CODES.has(
|
|
7209
|
+
if (TIMEOUT_ERROR_CODES.has(errorCode)) {
|
|
6726
7210
|
return "timeout";
|
|
6727
7211
|
}
|
|
6728
|
-
if (NETWORK_HTTP_ERROR_CODES.has(
|
|
7212
|
+
if (NETWORK_HTTP_ERROR_CODES.has(errorCode)) {
|
|
6729
7213
|
return "network_http";
|
|
6730
7214
|
}
|
|
6731
7215
|
return;
|
|
@@ -6775,7 +7259,7 @@ function classifyError2(input) {
|
|
|
6775
7259
|
}
|
|
6776
7260
|
const status = recorded?.context?.httpStatus ?? findHttpStatusInGraph(input.error);
|
|
6777
7261
|
if (status !== undefined) {
|
|
6778
|
-
return
|
|
7262
|
+
return classifyFailingHttpStatus(status);
|
|
6779
7263
|
}
|
|
6780
7264
|
return classifyFromResult(recorded?.result) ?? classifyFromErrorCode(recorded?.errorCode) ?? classifyFromError(input.error) ?? "unknown";
|
|
6781
7265
|
}
|
|
@@ -6807,6 +7291,7 @@ function buildCommandTerminalTelemetryProperties(input) {
|
|
|
6807
7291
|
var CommonTelemetryEvents = {
|
|
6808
7292
|
Start: "Application.Start",
|
|
6809
7293
|
Error: "Application.Error",
|
|
7294
|
+
ProjectActivity: "Cli.ProjectActivity",
|
|
6810
7295
|
ShipSucceeded: "Cli.ShipSucceeded"
|
|
6811
7296
|
};
|
|
6812
7297
|
|
|
@@ -7318,81 +7803,6 @@ class TelemetryService {
|
|
|
7318
7803
|
return hex;
|
|
7319
7804
|
}
|
|
7320
7805
|
}
|
|
7321
|
-
// ../../common/src/timings.ts
|
|
7322
|
-
var TIMINGS_ENV_VAR = "UIP_TIMINGS";
|
|
7323
|
-
function createStorage2() {
|
|
7324
|
-
const [error, mod] = catchError2(() => __require("node:async_hooks"));
|
|
7325
|
-
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
7326
|
-
return {
|
|
7327
|
-
getStore: () => {
|
|
7328
|
-
return;
|
|
7329
|
-
},
|
|
7330
|
-
run: (_store, fn) => fn()
|
|
7331
|
-
};
|
|
7332
|
-
}
|
|
7333
|
-
return new mod.AsyncLocalStorage;
|
|
7334
|
-
}
|
|
7335
|
-
var storageSlot = singleton("TimingStorage");
|
|
7336
|
-
var stateSlot = singleton("Timings");
|
|
7337
|
-
var rootStartedSlot = singleton("TimingsRootStarted");
|
|
7338
|
-
var longLivedHostSlot = singleton("TimingsLongLivedHost");
|
|
7339
|
-
var storage = storageSlot.getOrInit(createStorage2, (value) => ("getStore" in value));
|
|
7340
|
-
function newState(baseline) {
|
|
7341
|
-
return { baseline, httpMs: 0, httpCalls: 0 };
|
|
7342
|
-
}
|
|
7343
|
-
function getState() {
|
|
7344
|
-
const scoped = storage.getStore();
|
|
7345
|
-
if (scoped) {
|
|
7346
|
-
return scoped;
|
|
7347
|
-
}
|
|
7348
|
-
const pinned = livePinnedState();
|
|
7349
|
-
if (pinned !== undefined) {
|
|
7350
|
-
return pinned;
|
|
7351
|
-
}
|
|
7352
|
-
return newState(processStartIsInvocationStart() ? 0 : performance.now());
|
|
7353
|
-
}
|
|
7354
|
-
function livePinnedState() {
|
|
7355
|
-
const pinned = stateSlot.get();
|
|
7356
|
-
return pinned !== undefined && "httpCalls" in pinned && !pinned.finished ? pinned : undefined;
|
|
7357
|
-
}
|
|
7358
|
-
function processStartIsInvocationStart() {
|
|
7359
|
-
return !rootStartedSlot.get(false) && !longLivedHostSlot.get(false);
|
|
7360
|
-
}
|
|
7361
|
-
function timingsEnabled() {
|
|
7362
|
-
if (typeof process === "undefined") {
|
|
7363
|
-
return false;
|
|
7364
|
-
}
|
|
7365
|
-
const value = process.env?.[TIMINGS_ENV_VAR];
|
|
7366
|
-
if (value === undefined) {
|
|
7367
|
-
return false;
|
|
7368
|
-
}
|
|
7369
|
-
const normalized = value.trim().toLowerCase();
|
|
7370
|
-
return normalized === "1" || normalized === "true";
|
|
7371
|
-
}
|
|
7372
|
-
function recordExitCode(exitCode) {
|
|
7373
|
-
if (!timingsEnabled()) {
|
|
7374
|
-
return;
|
|
7375
|
-
}
|
|
7376
|
-
getState().exitCode = exitCode;
|
|
7377
|
-
}
|
|
7378
|
-
function invocationStartedAt() {
|
|
7379
|
-
return new Date(performance.timeOrigin + getState().baseline);
|
|
7380
|
-
}
|
|
7381
|
-
function invocationElapsedMs() {
|
|
7382
|
-
return performance.now() - getState().baseline;
|
|
7383
|
-
}
|
|
7384
|
-
function markCommandStart() {
|
|
7385
|
-
if (!timingsEnabled()) {
|
|
7386
|
-
return;
|
|
7387
|
-
}
|
|
7388
|
-
getState().commandStart = performance.now();
|
|
7389
|
-
}
|
|
7390
|
-
function recordCommandDuration(durationMs) {
|
|
7391
|
-
if (!timingsEnabled()) {
|
|
7392
|
-
return;
|
|
7393
|
-
}
|
|
7394
|
-
getState().commandMs = durationMs;
|
|
7395
|
-
}
|
|
7396
7806
|
// ../../common/src/telemetry/proxy-http-agent.ts
|
|
7397
7807
|
var slot = singleton("ProxyAuthHttpsAgent");
|
|
7398
7808
|
|
|
@@ -7434,7 +7844,6 @@ var telemetry = new Proxy({}, {
|
|
|
7434
7844
|
return typeof value === "function" ? value.bind(instance) : value;
|
|
7435
7845
|
}
|
|
7436
7846
|
});
|
|
7437
|
-
|
|
7438
7847
|
// ../../common/src/formatter.ts
|
|
7439
7848
|
var ANSI_STYLES = {
|
|
7440
7849
|
red: "\x1B[31m",
|
|
@@ -7444,46 +7853,6 @@ var ANSI_RESET = "\x1B[0m";
|
|
|
7444
7853
|
function styleLine(line, style) {
|
|
7445
7854
|
return style ? `${ANSI_STYLES[style]}${line}${ANSI_RESET}` : line;
|
|
7446
7855
|
}
|
|
7447
|
-
var CLI_ERROR_CODES = [
|
|
7448
|
-
"invalid_argument",
|
|
7449
|
-
"authentication_required",
|
|
7450
|
-
"permission_denied",
|
|
7451
|
-
"local_permission_denied",
|
|
7452
|
-
"not_found",
|
|
7453
|
-
"rate_limited",
|
|
7454
|
-
"network_error",
|
|
7455
|
-
"timeout",
|
|
7456
|
-
"server_error",
|
|
7457
|
-
"method_not_allowed",
|
|
7458
|
-
"not_supported",
|
|
7459
|
-
"configuration_error",
|
|
7460
|
-
"execution_failed",
|
|
7461
|
-
"unknown_error"
|
|
7462
|
-
];
|
|
7463
|
-
var RETRY_HINTS = [
|
|
7464
|
-
"RetryWillNotFix",
|
|
7465
|
-
"RetryLater",
|
|
7466
|
-
"RetryAfter1Second",
|
|
7467
|
-
"RetryAfter10Seconds",
|
|
7468
|
-
"RetryAfter30Seconds",
|
|
7469
|
-
"RetryAfter60Seconds"
|
|
7470
|
-
];
|
|
7471
|
-
var CLI_ERROR_CODE_VALUES = new Set(CLI_ERROR_CODES);
|
|
7472
|
-
var RETRY_HINT_VALUES = new Set(RETRY_HINTS);
|
|
7473
|
-
function isCliErrorCode(value) {
|
|
7474
|
-
return typeof value === "string" && CLI_ERROR_CODE_VALUES.has(value);
|
|
7475
|
-
}
|
|
7476
|
-
function isRetryHint(value) {
|
|
7477
|
-
return typeof value === "string" && RETRY_HINT_VALUES.has(value);
|
|
7478
|
-
}
|
|
7479
|
-
var RESULTS = {
|
|
7480
|
-
Success: "Success",
|
|
7481
|
-
Failure: "Failure",
|
|
7482
|
-
ConfigError: "ConfigError",
|
|
7483
|
-
AuthenticationError: "AuthenticationError",
|
|
7484
|
-
ValidationError: "ValidationError",
|
|
7485
|
-
TimeoutError: "TimeoutError"
|
|
7486
|
-
};
|
|
7487
7856
|
var EXIT_CODES = {
|
|
7488
7857
|
Success: 0,
|
|
7489
7858
|
Failure: 1,
|
|
@@ -7492,6 +7861,9 @@ var EXIT_CODES = {
|
|
|
7492
7861
|
ValidationError: 3,
|
|
7493
7862
|
TimeoutError: 4
|
|
7494
7863
|
};
|
|
7864
|
+
function exitCodeForResult(result) {
|
|
7865
|
+
return EXIT_CODES[result] ?? EXIT_CODES.Failure;
|
|
7866
|
+
}
|
|
7495
7867
|
function escapeNonAscii(jsonText) {
|
|
7496
7868
|
return jsonText.replace(/[\u0080-\uffff]/g, (c) => {
|
|
7497
7869
|
const hex = c.charCodeAt(0).toString(16).padStart(4, "0");
|
|
@@ -8167,8 +8539,8 @@ function carriesOnlyNulls(value) {
|
|
|
8167
8539
|
}
|
|
8168
8540
|
return false;
|
|
8169
8541
|
}
|
|
8170
|
-
function nameList(names,
|
|
8171
|
-
const shown = names.slice(0,
|
|
8542
|
+
function nameList(names, cap = 12) {
|
|
8543
|
+
const shown = names.slice(0, cap).map((n) => `\`${n}\``);
|
|
8172
8544
|
const rest = names.length - shown.length;
|
|
8173
8545
|
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
8174
8546
|
}
|
|
@@ -8305,59 +8677,19 @@ function defaultErrorCodeForResult(result) {
|
|
|
8305
8677
|
return "unknown_error";
|
|
8306
8678
|
}
|
|
8307
8679
|
}
|
|
8308
|
-
function parseHttpStatusFromMessage2(message) {
|
|
8309
|
-
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
8310
|
-
if (!match)
|
|
8311
|
-
return;
|
|
8312
|
-
const status = Number(match[1]);
|
|
8313
|
-
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
8314
|
-
}
|
|
8315
|
-
function defaultErrorCodeForHttpStatus(status) {
|
|
8316
|
-
if (status === undefined)
|
|
8317
|
-
return;
|
|
8318
|
-
if (status === 400 || status === 409 || status === 422) {
|
|
8319
|
-
return "invalid_argument";
|
|
8320
|
-
}
|
|
8321
|
-
if (status === 401)
|
|
8322
|
-
return "authentication_required";
|
|
8323
|
-
if (status === 403)
|
|
8324
|
-
return "permission_denied";
|
|
8325
|
-
if (status === 404)
|
|
8326
|
-
return "not_found";
|
|
8327
|
-
if (status === 405)
|
|
8328
|
-
return "method_not_allowed";
|
|
8329
|
-
if (status === 408)
|
|
8330
|
-
return "timeout";
|
|
8331
|
-
if (status === 429)
|
|
8332
|
-
return "rate_limited";
|
|
8333
|
-
if (status >= 500 && status < 600)
|
|
8334
|
-
return "server_error";
|
|
8335
|
-
return;
|
|
8336
|
-
}
|
|
8337
8680
|
var LOCAL_PERMISSION_TEXT_PATTERN = new RegExp(`(?:\\b|\\()(?:${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})(?::\\s|\\))`);
|
|
8338
8681
|
function defaultErrorCodeForFailure(data) {
|
|
8339
8682
|
if (data.Result === RESULTS.Failure) {
|
|
8340
|
-
const status = data.Context?.httpStatus ??
|
|
8341
|
-
const
|
|
8342
|
-
if (
|
|
8343
|
-
return
|
|
8683
|
+
const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage(data.Message);
|
|
8684
|
+
const errorCode = classifyHttpStatus(status)?.errorCode;
|
|
8685
|
+
if (errorCode)
|
|
8686
|
+
return errorCode;
|
|
8344
8687
|
if (status === undefined && (LOCAL_PERMISSION_TEXT_PATTERN.test(data.Message) || LOCAL_PERMISSION_TEXT_PATTERN.test(data.Instructions))) {
|
|
8345
8688
|
return "local_permission_denied";
|
|
8346
8689
|
}
|
|
8347
8690
|
}
|
|
8348
8691
|
return defaultErrorCodeForResult(data.Result);
|
|
8349
8692
|
}
|
|
8350
|
-
function defaultRetryForErrorCode(errorCode2) {
|
|
8351
|
-
switch (errorCode2) {
|
|
8352
|
-
case "network_error":
|
|
8353
|
-
case "rate_limited":
|
|
8354
|
-
case "server_error":
|
|
8355
|
-
case "timeout":
|
|
8356
|
-
return "RetryLater";
|
|
8357
|
-
default:
|
|
8358
|
-
return "RetryWillNotFix";
|
|
8359
|
-
}
|
|
8360
|
-
}
|
|
8361
8693
|
var OutputFormatter;
|
|
8362
8694
|
((OutputFormatter) => {
|
|
8363
8695
|
function success(data, options) {
|
|
@@ -8389,7 +8721,7 @@ var OutputFormatter;
|
|
|
8389
8721
|
data.Log ??= getLogFilePath() || undefined;
|
|
8390
8722
|
data.ErrorCode ??= defaultErrorCodeForFailure(data);
|
|
8391
8723
|
data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
|
|
8392
|
-
const exitCode =
|
|
8724
|
+
const exitCode = exitCodeForResult(data.Result);
|
|
8393
8725
|
setExitCode(exitCode);
|
|
8394
8726
|
recordCommandFailureTelemetry({
|
|
8395
8727
|
result: data.Result,
|
|
@@ -8483,39 +8815,228 @@ var OutputFormatter;
|
|
|
8483
8815
|
}
|
|
8484
8816
|
OutputFormatter.formatToString = formatToString;
|
|
8485
8817
|
})(OutputFormatter ||= {});
|
|
8486
|
-
// ../../../node_modules/commander/esm.mjs
|
|
8487
|
-
var import__2 = __toESM(require_commander(), 1);
|
|
8488
|
-
var {
|
|
8489
|
-
program,
|
|
8490
|
-
createCommand,
|
|
8491
|
-
createArgument,
|
|
8492
|
-
createOption,
|
|
8493
|
-
CommanderError,
|
|
8494
|
-
InvalidArgumentError,
|
|
8495
|
-
InvalidOptionArgumentError,
|
|
8496
|
-
Command,
|
|
8497
|
-
Argument,
|
|
8498
|
-
Option,
|
|
8499
|
-
Help
|
|
8500
|
-
} = import__2.default;
|
|
8501
8818
|
|
|
8502
|
-
// ../../common/src/
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
|
|
8506
|
-
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8819
|
+
// ../../common/src/pass-through-tail.ts
|
|
8820
|
+
function maybeOption(arg) {
|
|
8821
|
+
return arg.length > 1 && arg[0] === "-";
|
|
8822
|
+
}
|
|
8823
|
+
function tokenizeTail(cmd, tail) {
|
|
8824
|
+
const find = (flag) => cmd.options.find((option) => option.long === flag || option.short === flag);
|
|
8825
|
+
const digitShort = cmd.options.some((option) => option.short !== undefined && /^-\d$/.test(option.short));
|
|
8826
|
+
const negativeNumber = (arg) => !digitShort && /^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg);
|
|
8827
|
+
const tokens = [];
|
|
8828
|
+
let firstUnknown = -1;
|
|
8829
|
+
let sentinel = -1;
|
|
8830
|
+
let variadic;
|
|
8831
|
+
let group;
|
|
8832
|
+
let groupIndex = 0;
|
|
8833
|
+
let i = 0;
|
|
8834
|
+
while (i < tail.length || group !== undefined) {
|
|
8835
|
+
const index = group === undefined ? i : groupIndex;
|
|
8836
|
+
const arg = group ?? tail[i++];
|
|
8837
|
+
group = undefined;
|
|
8838
|
+
if (arg === "--") {
|
|
8839
|
+
sentinel = index;
|
|
8840
|
+
tokens.push({ kind: "sentinel", index });
|
|
8841
|
+
for (let j = i;j < tail.length; j++) {
|
|
8842
|
+
tokens.push({
|
|
8843
|
+
kind: "operand",
|
|
8844
|
+
index: j,
|
|
8845
|
+
text: tail[j],
|
|
8846
|
+
literal: true
|
|
8847
|
+
});
|
|
8848
|
+
}
|
|
8849
|
+
break;
|
|
8850
|
+
}
|
|
8851
|
+
if (variadic && (!maybeOption(arg) || negativeNumber(arg))) {
|
|
8852
|
+
tokens.push({
|
|
8853
|
+
kind: "option",
|
|
8854
|
+
index,
|
|
8855
|
+
text: arg,
|
|
8856
|
+
option: variadic,
|
|
8857
|
+
value: arg
|
|
8858
|
+
});
|
|
8859
|
+
continue;
|
|
8860
|
+
}
|
|
8861
|
+
variadic = undefined;
|
|
8862
|
+
if (maybeOption(arg)) {
|
|
8863
|
+
const option = find(arg);
|
|
8864
|
+
if (option) {
|
|
8865
|
+
let value;
|
|
8866
|
+
if (option.required) {
|
|
8867
|
+
value = tail[i];
|
|
8868
|
+
if (value !== undefined)
|
|
8869
|
+
i++;
|
|
8870
|
+
} else if (option.optional) {
|
|
8871
|
+
const next = tail[i];
|
|
8872
|
+
if (next !== undefined && (!maybeOption(next) || negativeNumber(next))) {
|
|
8873
|
+
value = next;
|
|
8874
|
+
i++;
|
|
8875
|
+
}
|
|
8876
|
+
}
|
|
8877
|
+
tokens.push({
|
|
8878
|
+
kind: "option",
|
|
8879
|
+
index,
|
|
8880
|
+
text: arg,
|
|
8881
|
+
option,
|
|
8882
|
+
...value === undefined ? {} : { value }
|
|
8883
|
+
});
|
|
8884
|
+
variadic = option.variadic ? option : undefined;
|
|
8885
|
+
continue;
|
|
8886
|
+
}
|
|
8887
|
+
}
|
|
8888
|
+
if (arg.length > 2 && arg[0] === "-" && arg[1] !== "-") {
|
|
8889
|
+
const option = find(`-${arg[1]}`);
|
|
8890
|
+
if (option) {
|
|
8891
|
+
if (option.required || option.optional) {
|
|
8892
|
+
tokens.push({
|
|
8893
|
+
kind: "option",
|
|
8894
|
+
index,
|
|
8895
|
+
text: arg,
|
|
8896
|
+
option,
|
|
8897
|
+
value: arg.slice(2)
|
|
8898
|
+
});
|
|
8899
|
+
} else {
|
|
8900
|
+
tokens.push({ kind: "option", index, text: arg, option });
|
|
8901
|
+
group = `-${arg.slice(2)}`;
|
|
8902
|
+
groupIndex = index;
|
|
8903
|
+
}
|
|
8904
|
+
continue;
|
|
8905
|
+
}
|
|
8906
|
+
}
|
|
8907
|
+
if (/^--[^=]+=/.test(arg)) {
|
|
8908
|
+
const equals = arg.indexOf("=");
|
|
8909
|
+
const option = find(arg.slice(0, equals));
|
|
8910
|
+
if (option && (option.required || option.optional)) {
|
|
8911
|
+
tokens.push({
|
|
8912
|
+
kind: "option",
|
|
8913
|
+
index,
|
|
8914
|
+
text: arg,
|
|
8915
|
+
option,
|
|
8916
|
+
value: arg.slice(equals + 1)
|
|
8917
|
+
});
|
|
8918
|
+
continue;
|
|
8919
|
+
}
|
|
8920
|
+
}
|
|
8921
|
+
if (maybeOption(arg) && !negativeNumber(arg)) {
|
|
8922
|
+
const equals = arg.startsWith("--") ? arg.indexOf("=") : -1;
|
|
8923
|
+
if (firstUnknown === -1)
|
|
8924
|
+
firstUnknown = index;
|
|
8925
|
+
tokens.push({
|
|
8926
|
+
kind: "unknown",
|
|
8927
|
+
index,
|
|
8928
|
+
text: arg,
|
|
8929
|
+
flag: equals > 0 ? arg.slice(0, equals) : arg,
|
|
8930
|
+
...equals > 0 ? { inlineValue: arg.slice(equals + 1) } : {}
|
|
8931
|
+
});
|
|
8932
|
+
continue;
|
|
8933
|
+
}
|
|
8934
|
+
tokens.push({ kind: "operand", index, text: arg, literal: false });
|
|
8935
|
+
}
|
|
8936
|
+
return { tokens, firstUnknown, sentinel };
|
|
8512
8937
|
}
|
|
8513
|
-
|
|
8514
|
-
|
|
8515
|
-
|
|
8938
|
+
|
|
8939
|
+
// ../../common/src/project-telemetry.ts
|
|
8940
|
+
var RESOLVER = Symbol.for("@uipath/common/projectTelemetryResolver");
|
|
8941
|
+
var CAPTURE = Symbol.for("@uipath/common/projectTelemetryCapture");
|
|
8942
|
+
var CONTEXT_RESOLVER = Symbol.for("@uipath/common/projectContextTelemetryResolver");
|
|
8943
|
+
var RULES = Symbol.for("@uipath/common/projectTargetRules");
|
|
8944
|
+
function logSkipped(what, error) {
|
|
8945
|
+
logger.debug(`[project-telemetry] ${what} skipped: ${error instanceof Error ? error.message : String(error)}`);
|
|
8946
|
+
}
|
|
8947
|
+
function bounded(work, what) {
|
|
8948
|
+
return withinProjectIdentityBudget(work, () => logSkipped(what, `no answer within ${PROJECT_IDENTITY_LOOKUP_BUDGET_MS} ms`));
|
|
8949
|
+
}
|
|
8950
|
+
async function identityWithContext(command, identity) {
|
|
8951
|
+
const props = projectIdentityProperties(identity);
|
|
8952
|
+
if (!identity.projectDirectory || isProjectTelemetryDisabled())
|
|
8953
|
+
return props;
|
|
8954
|
+
for (let node = command;node; node = node.parent ?? undefined) {
|
|
8955
|
+
const resolver = node[CONTEXT_RESOLVER];
|
|
8956
|
+
if (typeof resolver !== "function")
|
|
8957
|
+
continue;
|
|
8958
|
+
try {
|
|
8959
|
+
return {
|
|
8960
|
+
...await resolver(identity.projectDirectory),
|
|
8961
|
+
...props
|
|
8962
|
+
};
|
|
8963
|
+
} catch (error) {
|
|
8964
|
+
logSkipped("solution context lookup", error);
|
|
8965
|
+
return props;
|
|
8966
|
+
}
|
|
8516
8967
|
}
|
|
8517
|
-
return
|
|
8518
|
-
}
|
|
8968
|
+
return props;
|
|
8969
|
+
}
|
|
8970
|
+
function getProjectTelemetryResolver(command) {
|
|
8971
|
+
for (let node = command;node; node = node.parent) {
|
|
8972
|
+
const resolver = node[RESOLVER];
|
|
8973
|
+
if (typeof resolver === "function")
|
|
8974
|
+
return resolver;
|
|
8975
|
+
}
|
|
8976
|
+
return;
|
|
8977
|
+
}
|
|
8978
|
+
function attachProjectTelemetryCapture(command, capture) {
|
|
8979
|
+
command[CAPTURE] = capture;
|
|
8980
|
+
}
|
|
8981
|
+
class ProjectTelemetrySession {
|
|
8982
|
+
resolver;
|
|
8983
|
+
command;
|
|
8984
|
+
target;
|
|
8985
|
+
props = {};
|
|
8986
|
+
explicit = false;
|
|
8987
|
+
input;
|
|
8988
|
+
constructor(resolver, command) {
|
|
8989
|
+
this.resolver = resolver;
|
|
8990
|
+
this.command = command;
|
|
8991
|
+
}
|
|
8992
|
+
async setTarget(path) {
|
|
8993
|
+
this.target = path;
|
|
8994
|
+
if (this.input) {
|
|
8995
|
+
await this.resolve({
|
|
8996
|
+
...this.input,
|
|
8997
|
+
phase: "after",
|
|
8998
|
+
success: true
|
|
8999
|
+
});
|
|
9000
|
+
this.explicit = true;
|
|
9001
|
+
}
|
|
9002
|
+
}
|
|
9003
|
+
async setIdentity(identity) {
|
|
9004
|
+
try {
|
|
9005
|
+
const props = await bounded(identityWithContext(this.command, identity), "project identity capture");
|
|
9006
|
+
if (props !== undefined)
|
|
9007
|
+
this.setProperties(props);
|
|
9008
|
+
} catch (error) {
|
|
9009
|
+
logSkipped("project identity capture", error);
|
|
9010
|
+
}
|
|
9011
|
+
}
|
|
9012
|
+
setProperties(properties) {
|
|
9013
|
+
try {
|
|
9014
|
+
this.props = { ...properties };
|
|
9015
|
+
this.explicit = true;
|
|
9016
|
+
} catch (error) {
|
|
9017
|
+
logSkipped("project identity properties", error);
|
|
9018
|
+
}
|
|
9019
|
+
}
|
|
9020
|
+
properties() {
|
|
9021
|
+
return { ...this.props };
|
|
9022
|
+
}
|
|
9023
|
+
async resolve(input) {
|
|
9024
|
+
this.input = input;
|
|
9025
|
+
if (this.explicit)
|
|
9026
|
+
return;
|
|
9027
|
+
try {
|
|
9028
|
+
const props = await bounded(this.resolver({
|
|
9029
|
+
...input,
|
|
9030
|
+
target: this.target
|
|
9031
|
+
}), `project identity (${input.phase})`);
|
|
9032
|
+
if (props !== undefined) {
|
|
9033
|
+
this.props = props;
|
|
9034
|
+
}
|
|
9035
|
+
} catch (error) {
|
|
9036
|
+
logSkipped(`project identity (${input.phase})`, error);
|
|
9037
|
+
}
|
|
9038
|
+
}
|
|
9039
|
+
}
|
|
8519
9040
|
|
|
8520
9041
|
// ../../common/src/telemetry/command-attribution.ts
|
|
8521
9042
|
var LEGACY_SKILL_NAMESPACE = "uipath:";
|
|
@@ -8761,8 +9282,7 @@ var pollSignalSlot = singleton("PollSignal");
|
|
|
8761
9282
|
var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
|
|
8762
9283
|
var processContext = {
|
|
8763
9284
|
exit: (code) => {
|
|
8764
|
-
|
|
8765
|
-
setExitCode(code);
|
|
9285
|
+
recordCommandExit(code);
|
|
8766
9286
|
},
|
|
8767
9287
|
get pollSignal() {
|
|
8768
9288
|
return pollSignalSlot.get();
|
|
@@ -8787,6 +9307,8 @@ function recordableArgValue(value, choices) {
|
|
|
8787
9307
|
function extractCommandParams(cmd) {
|
|
8788
9308
|
const params = {};
|
|
8789
9309
|
forEachSuppliedArgument(cmd, (name, value, choices, defaulted) => {
|
|
9310
|
+
if (name === undefined)
|
|
9311
|
+
return;
|
|
8790
9312
|
const recordable = recordableArgValue(value, choices);
|
|
8791
9313
|
params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = recordable === TELEMETRY_ARG_VALUE_WITHHELD && defaulted ? TELEMETRY_ARG_VALUE_DEFAULTED : recordable;
|
|
8792
9314
|
});
|
|
@@ -8802,7 +9324,8 @@ function isDefaultedPositional(cmd, index) {
|
|
|
8802
9324
|
function forEachSuppliedArgument(cmd, visit) {
|
|
8803
9325
|
const registered = cmd.registeredArguments ?? [];
|
|
8804
9326
|
const processed = cmd.processedArgs ?? [];
|
|
8805
|
-
|
|
9327
|
+
const bound = boundPositionalCount(cmd);
|
|
9328
|
+
for (let i = 0;i < bound; i++) {
|
|
8806
9329
|
const name = registered[i].name();
|
|
8807
9330
|
if (name && processed[i] !== undefined) {
|
|
8808
9331
|
visit(name, processed[i], registered[i].argChoices, isDefaultedPositional(cmd, i));
|
|
@@ -8817,6 +9340,71 @@ function forEachSuppliedArgument(cmd, visit) {
|
|
|
8817
9340
|
visit(key, value, choicesByAttribute.get(key), isDefaultedOption(cmd, key));
|
|
8818
9341
|
}
|
|
8819
9342
|
}
|
|
9343
|
+
forEachPassThroughToken(cmd, bound, (name, value) => {
|
|
9344
|
+
visit(name, value, name === undefined ? undefined : choicesByAttribute.get(name), false);
|
|
9345
|
+
});
|
|
9346
|
+
}
|
|
9347
|
+
function boundPositionalCount(cmd) {
|
|
9348
|
+
const registered = cmd.registeredArguments ?? [];
|
|
9349
|
+
if (registered.some((argument) => argument.variadic)) {
|
|
9350
|
+
return registered.length;
|
|
9351
|
+
}
|
|
9352
|
+
if ((cmd.args ?? []).length <= registered.length) {
|
|
9353
|
+
return registered.length;
|
|
9354
|
+
}
|
|
9355
|
+
const firstFlag = tokenizeTail(cmd, (cmd.args ?? []).slice(1)).tokens.find((token) => token.kind !== "operand")?.index ?? -1;
|
|
9356
|
+
return firstFlag === -1 ? registered.length : Math.min(registered.length, firstFlag + 1);
|
|
9357
|
+
}
|
|
9358
|
+
function forEachPassThroughToken(cmd, bound, visit) {
|
|
9359
|
+
const registered = cmd.registeredArguments ?? [];
|
|
9360
|
+
const fillsPositionals = !registered.some((argument) => argument.variadic);
|
|
9361
|
+
const { tokens, firstUnknown } = tokenizeTail(cmd, (cmd.args ?? []).slice(bound));
|
|
9362
|
+
const repeated = new Map;
|
|
9363
|
+
let nextPositional = bound;
|
|
9364
|
+
for (const token of tokens) {
|
|
9365
|
+
const pastUnknown = firstUnknown !== -1 && token.index > firstUnknown;
|
|
9366
|
+
if (token.kind === "sentinel")
|
|
9367
|
+
continue;
|
|
9368
|
+
if (token.kind === "operand") {
|
|
9369
|
+
const claimable = !pastUnknown && fillsPositionals && nextPositional < registered.length;
|
|
9370
|
+
const name = claimable ? registered[nextPositional++].name() : undefined;
|
|
9371
|
+
visit(name || undefined, token.text);
|
|
9372
|
+
continue;
|
|
9373
|
+
}
|
|
9374
|
+
if (token.kind === "unknown") {
|
|
9375
|
+
const bare = token.flag.replace(/^-+/, "");
|
|
9376
|
+
const key = bare.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
9377
|
+
const keyable = token.flag.startsWith("--") || token.flag.length === 2;
|
|
9378
|
+
if (!pastUnknown && keyable && /^[a-z][a-z0-9-]*$/i.test(bare) && key) {
|
|
9379
|
+
visit(key, token.inlineValue ?? true);
|
|
9380
|
+
} else {
|
|
9381
|
+
visit(undefined, token.text);
|
|
9382
|
+
if (token.inlineValue !== undefined) {
|
|
9383
|
+
visit(undefined, token.inlineValue);
|
|
9384
|
+
} else if (!token.flag.startsWith("--") && token.flag.length > 2) {
|
|
9385
|
+
visit(undefined, token.flag.slice(2));
|
|
9386
|
+
}
|
|
9387
|
+
}
|
|
9388
|
+
continue;
|
|
9389
|
+
}
|
|
9390
|
+
if (pastUnknown) {
|
|
9391
|
+
visit(undefined, token.text);
|
|
9392
|
+
if (token.value !== undefined)
|
|
9393
|
+
visit(undefined, token.value);
|
|
9394
|
+
continue;
|
|
9395
|
+
}
|
|
9396
|
+
const option = token.option;
|
|
9397
|
+
const name = option.attributeName();
|
|
9398
|
+
const value = option.negate ? false : option.required || option.optional ? token.value ?? true : true;
|
|
9399
|
+
const previous = repeated.get(name);
|
|
9400
|
+
if (previous) {
|
|
9401
|
+
previous.push(value);
|
|
9402
|
+
visit(name, previous);
|
|
9403
|
+
} else {
|
|
9404
|
+
repeated.set(name, [value]);
|
|
9405
|
+
visit(name, value);
|
|
9406
|
+
}
|
|
9407
|
+
}
|
|
8820
9408
|
}
|
|
8821
9409
|
function withheldArgumentValues(cmd) {
|
|
8822
9410
|
const values = [];
|
|
@@ -8878,11 +9466,13 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
8878
9466
|
const telemetryName = commandTelemetryName(commandParts);
|
|
8879
9467
|
const commandPath = commandInvocationPath(commandParts);
|
|
8880
9468
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
9469
|
+
const projectResolver = getProjectTelemetryResolver(command);
|
|
9470
|
+
const projectSession = projectResolver && !isProjectTelemetryDisabled() ? new ProjectTelemetrySession(projectResolver, command) : undefined;
|
|
8881
9471
|
markCommandStart();
|
|
8882
9472
|
const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
|
|
8883
9473
|
try {
|
|
8884
9474
|
const startTime = performance.now();
|
|
8885
|
-
let
|
|
9475
|
+
let errorMessage;
|
|
8886
9476
|
let fallbackExitCode = EXIT_CODES.Success;
|
|
8887
9477
|
clearRecordedCommandFailureTelemetry();
|
|
8888
9478
|
const [error] = await catchError2(ensureInvocationRequestScope(() => {
|
|
@@ -8890,30 +9480,40 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
8890
9480
|
if (violation) {
|
|
8891
9481
|
return Promise.reject(violation);
|
|
8892
9482
|
}
|
|
9483
|
+
if (projectSession) {
|
|
9484
|
+
return projectSession.resolve({ command, args, phase: "before" }).then(() => {
|
|
9485
|
+
attachProjectTelemetryCapture(command, projectSession);
|
|
9486
|
+
return fn(...args);
|
|
9487
|
+
});
|
|
9488
|
+
}
|
|
8893
9489
|
return fn(...args);
|
|
8894
9490
|
}));
|
|
8895
9491
|
if (error) {
|
|
8896
|
-
|
|
8897
|
-
logger.debug(`[trackedAction] ${telemetryName} failed: ${
|
|
9492
|
+
errorMessage = error instanceof Error ? error.message : String(error);
|
|
9493
|
+
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
8898
9494
|
const typed = error;
|
|
8899
9495
|
const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
|
|
8900
9496
|
const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
|
|
8901
|
-
const
|
|
9497
|
+
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
9498
|
+
const classified = cancellationExitCode === undefined ? await extractErrorDetails(error) : undefined;
|
|
9499
|
+
const finalResult = customResult ?? classified?.result ?? RESULTS.Failure;
|
|
8902
9500
|
const typedErrorCode = typed.errorCode ?? typed.ErrorCode;
|
|
8903
9501
|
const customErrorCode = isCliErrorCode(typedErrorCode) ? typedErrorCode : undefined;
|
|
8904
9502
|
const typedRetry = typed.retry ?? typed.Retry;
|
|
8905
9503
|
const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
|
|
8906
9504
|
const typedContext = typed.context ?? typed.Context;
|
|
8907
9505
|
const customContext = isErrorContext(typedContext) ? typedContext : undefined;
|
|
8908
|
-
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
8909
9506
|
fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
|
|
9507
|
+
const errorCode = customErrorCode ?? classified?.errorCode;
|
|
9508
|
+
const retry = customRetry ?? classified?.retry;
|
|
9509
|
+
const errorContext = customContext ?? classified?.context;
|
|
8910
9510
|
OutputFormatter.error({
|
|
8911
9511
|
Result: finalResult,
|
|
8912
|
-
...
|
|
8913
|
-
Message:
|
|
9512
|
+
...errorCode ? { ErrorCode: errorCode } : {},
|
|
9513
|
+
Message: errorMessage,
|
|
8914
9514
|
Instructions: customInstructions ?? commandHelpHint(commandPath),
|
|
8915
|
-
...
|
|
8916
|
-
...
|
|
9515
|
+
...retry ? { Retry: retry } : {},
|
|
9516
|
+
...errorContext ? { Context: errorContext } : {}
|
|
8917
9517
|
});
|
|
8918
9518
|
context.exit(fallbackExitCode);
|
|
8919
9519
|
}
|
|
@@ -8922,6 +9522,14 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
8922
9522
|
const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
|
|
8923
9523
|
const recordedFailure = takeRecordedCommandFailureTelemetry();
|
|
8924
9524
|
const success = !error && exitCode === 0;
|
|
9525
|
+
if (projectSession) {
|
|
9526
|
+
await projectSession.resolve({
|
|
9527
|
+
command,
|
|
9528
|
+
args,
|
|
9529
|
+
phase: "after",
|
|
9530
|
+
success
|
|
9531
|
+
});
|
|
9532
|
+
}
|
|
8925
9533
|
const terminalTelemetry = buildCommandTerminalTelemetryProperties({
|
|
8926
9534
|
error,
|
|
8927
9535
|
exitCode,
|
|
@@ -8939,16 +9547,19 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
8939
9547
|
}
|
|
8940
9548
|
const baseProperties = redactProperties({
|
|
8941
9549
|
...commandParams,
|
|
9550
|
+
...projectSession?.properties(),
|
|
8942
9551
|
...props,
|
|
8943
9552
|
...buildCommandTelemetryAttribution(commandPath, process.env.UIPATH_SKILL),
|
|
8944
9553
|
...buildAgentSessionTelemetry(process.env),
|
|
8945
9554
|
[CommandDimensions.CommandName]: commandPath,
|
|
8946
9555
|
[CommandDimensions.IsCommand]: "true",
|
|
8947
9556
|
...terminalTelemetry,
|
|
8948
|
-
...
|
|
9557
|
+
...errorMessage ? { [CommandDimensions.ErrorMessage]: errorMessage } : {}
|
|
8949
9558
|
});
|
|
8950
9559
|
emitInvocationRequest(telemetryName, success, baseProperties);
|
|
8951
9560
|
} finally {
|
|
9561
|
+
if (projectSession)
|
|
9562
|
+
attachProjectTelemetryCapture(command, undefined);
|
|
8952
9563
|
releaseSuppliedArgumentValues(supplied);
|
|
8953
9564
|
}
|
|
8954
9565
|
});
|
|
@@ -9276,8 +9887,8 @@ var withLoginValidity = (cmd) => {
|
|
|
9276
9887
|
return cmd;
|
|
9277
9888
|
};
|
|
9278
9889
|
async function loadJsonFile(file, typeLabel) {
|
|
9279
|
-
const
|
|
9280
|
-
const [readErr, content] = await catchError2(
|
|
9890
|
+
const fs = getFileSystem();
|
|
9891
|
+
const [readErr, content] = await catchError2(fs.readFile(file, "utf-8"));
|
|
9281
9892
|
if (readErr || content === null) {
|
|
9282
9893
|
return [
|
|
9283
9894
|
{
|
|
@@ -9308,6 +9919,11 @@ var emitLoadError = (err) => {
|
|
|
9308
9919
|
processContext.exit(1);
|
|
9309
9920
|
};
|
|
9310
9921
|
var emitFailure = async (error, instructions) => {
|
|
9922
|
+
if (error instanceof Error && (error.name === "AuthContextUnavailableError" || error.name === "EnvAuthConfigError")) {
|
|
9923
|
+
OutputFormatter.error(await authContextFailure(error, instructions));
|
|
9924
|
+
processContext.exit(1);
|
|
9925
|
+
return;
|
|
9926
|
+
}
|
|
9311
9927
|
OutputFormatter.error({
|
|
9312
9928
|
Result: RESULTS.Failure,
|
|
9313
9929
|
Message: await extractErrorMessage(error),
|
|
@@ -9330,16 +9946,14 @@ async function extractResponseData(response) {
|
|
|
9330
9946
|
return;
|
|
9331
9947
|
}
|
|
9332
9948
|
async function fetchCurrentIp(loginValidity) {
|
|
9333
|
-
const
|
|
9334
|
-
ensureTokenValidityMinutes: loginValidity
|
|
9949
|
+
const auth = await getAuthContext({
|
|
9950
|
+
ensureTokenValidityMinutes: loginValidity,
|
|
9951
|
+
requireOrganizationId: true
|
|
9335
9952
|
});
|
|
9336
|
-
|
|
9337
|
-
throw new Error(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.");
|
|
9338
|
-
}
|
|
9339
|
-
const url = `${status.baseUrl}/${status.organizationId}/portal_/api/accesspolicy/ip`;
|
|
9953
|
+
const url = `${auth.baseUrl}/${encodeURIComponent(auth.organizationId)}/portal_/api/accesspolicy/ip`;
|
|
9340
9954
|
const res = await fetch(url, {
|
|
9341
9955
|
method: "GET",
|
|
9342
|
-
headers: { Authorization: `Bearer ${
|
|
9956
|
+
headers: { Authorization: `Bearer ${auth.accessToken}` }
|
|
9343
9957
|
});
|
|
9344
9958
|
const text = (await res.text()).trim();
|
|
9345
9959
|
if (!res.ok) {
|
|
@@ -10368,8 +10982,8 @@ var registerMyIpCommand = (apms) => {
|
|
|
10368
10982
|
};
|
|
10369
10983
|
|
|
10370
10984
|
// src/commands/apms.ts
|
|
10371
|
-
var registerIpRestrictionCommand = (
|
|
10372
|
-
const ipRestriction =
|
|
10985
|
+
var registerIpRestrictionCommand = (program) => {
|
|
10986
|
+
const ipRestriction = program.command("ip-restriction").description([
|
|
10373
10987
|
"Manage UiPath IP-restriction policies (Access Policy Management Service).",
|
|
10374
10988
|
"",
|
|
10375
10989
|
"Subcommand groups:",
|
|
@@ -10386,16 +11000,16 @@ var registerIpRestrictionCommand = (program2) => {
|
|
|
10386
11000
|
};
|
|
10387
11001
|
|
|
10388
11002
|
// src/tool.ts
|
|
10389
|
-
var
|
|
11003
|
+
var metadata2 = {
|
|
10390
11004
|
name: "apms-tool",
|
|
10391
11005
|
version: package_default.version,
|
|
10392
11006
|
description: "Manage UiPath IP-restriction policies (Access Policy Management Service).",
|
|
10393
11007
|
commandPrefix: "admin"
|
|
10394
11008
|
};
|
|
10395
|
-
var
|
|
10396
|
-
registerIpRestrictionCommand(
|
|
11009
|
+
var registerCommands2 = async (program) => {
|
|
11010
|
+
registerIpRestrictionCommand(program);
|
|
10397
11011
|
};
|
|
10398
11012
|
|
|
10399
|
-
export { Command,
|
|
11013
|
+
export { Command, metadata2, registerCommands2 };
|
|
10400
11014
|
|
|
10401
|
-
//# debugId=
|
|
11015
|
+
//# debugId=014A8E0385B00A7264756E2164756E21
|