@uipath/tasks-tool 1.205.0-preview.281 → 1.206.0-preview.282
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -0
- package/dist/{folder-picker-interactive-2x6yr0wh.js → folder-picker-interactive-41htawa4.js} +33 -33
- package/dist/{folder-resolver-m2j9csxn.js → folder-resolver-t2555k5b.js} +9 -10
- package/dist/{getMachineId-bsd-67w37xtj.js → getMachineId-bsd-hr7dy73y.js} +3 -3
- package/dist/{getMachineId-darwin-4g3xfpfp.js → getMachineId-darwin-k0c7ykqv.js} +3 -3
- package/dist/{getMachineId-linux-a4p6fb9w.js → getMachineId-linux-f0m4gd78.js} +2 -2
- package/dist/{getMachineId-unsupported-77w362eh.js → getMachineId-unsupported-e99prk6h.js} +2 -2
- package/dist/{getMachineId-win-9cfxg9c8.js → getMachineId-win-zqh7yjfs.js} +3 -3
- package/dist/{index-sby22td6.js → index-nzr4mx5p.js} +2 -22
- package/dist/index.js +8 -10
- package/dist/{jmespath-231m3hyn.js → jmespath-ab6tdc42.js} +1 -1
- package/dist/{js-yaml-88tdqrtd.js → js-yaml-a2bk27p6.js} +1 -3
- package/dist/{tool-bndhpxxj.js → tool-4b88bsfh.js} +30 -30
- package/dist/{tool-s6dm918n.js → tool-df3kr747.js} +1042 -549
- package/dist/{tool-1de529jm.js → tool-epsr41wx.js} +12 -3
- package/dist/{tool-2czkpqb0.js → tool-ggemp2c3.js} +1 -1
- package/dist/{tool-hqtnveag.js → tool-j4cyabhz.js} +181 -11
- package/dist/{tool-0d5gzews.js → tool-kfvhn3px.js} +1687 -1302
- package/dist/tool.js +7 -9
- 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"];
|
|
@@ -2077,25 +2078,207 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2077
2078
|
exports.useColor = useColor;
|
|
2078
2079
|
});
|
|
2079
2080
|
|
|
2080
|
-
//
|
|
2081
|
-
var
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2081
|
+
// ../common/src/telemetry/telemetry-dimensions.ts
|
|
2082
|
+
var BaseDimensions = {
|
|
2083
|
+
ApplicationName: "ApplicationName",
|
|
2084
|
+
ProductVersion: "ProductVersion",
|
|
2085
|
+
InstallationId: "InstallationId",
|
|
2086
|
+
CloudUserId: "CloudUserId",
|
|
2087
|
+
CloudTenantId: "CloudTenantId",
|
|
2088
|
+
CloudOrganizationId: "CloudOrganizationId",
|
|
2089
|
+
IsInternalUser: "IsInternalUser",
|
|
2090
|
+
Environment: "Environment",
|
|
2091
|
+
BaseUrl: "BaseUrl",
|
|
2092
|
+
Region: "Region",
|
|
2093
|
+
Agent: "Agent",
|
|
2094
|
+
AgentVersion: "AgentVersion",
|
|
2095
|
+
AgentModel: "AgentModel",
|
|
2096
|
+
ToolName: "ToolName",
|
|
2097
|
+
ToolVersion: "ToolVersion",
|
|
2098
|
+
ExecutionContext: "ExecutionContext",
|
|
2099
|
+
CiProvider: "CiProvider",
|
|
2100
|
+
SessionIdSource: "SessionIdSource",
|
|
2101
|
+
SessionId: "SessionId"
|
|
2102
|
+
};
|
|
2103
|
+
var CommandDimensions = {
|
|
2104
|
+
IsCommand: "IsCommand",
|
|
2105
|
+
IsReexec: "IsReexec",
|
|
2106
|
+
CommandName: "CommandName",
|
|
2107
|
+
ExitCode: "ExitCode",
|
|
2108
|
+
TerminalOutcome: "TerminalOutcome",
|
|
2109
|
+
ErrorClass: "ErrorClass",
|
|
2110
|
+
TerminalSignal: "TerminalSignal",
|
|
2111
|
+
ErrorMessage: "ErrorMessage",
|
|
2112
|
+
SkillName: "SkillName",
|
|
2113
|
+
ProductArea: "ProductArea",
|
|
2114
|
+
Mode: "Mode"
|
|
2115
|
+
};
|
|
2116
|
+
var ProjectDimensions = {
|
|
2117
|
+
ProjectKey: "ProjectKey",
|
|
2118
|
+
ProjectType: "ProjectType",
|
|
2119
|
+
ProjectIdentityStatus: "ProjectIdentityStatus",
|
|
2120
|
+
SolutionKey: "SolutionKey",
|
|
2121
|
+
SolutionProjectKey: "SolutionProjectKey",
|
|
2122
|
+
SolutionIdentityStatus: "SolutionIdentityStatus",
|
|
2123
|
+
PreviousSolutionKey: "PreviousSolutionKey"
|
|
2124
|
+
};
|
|
2125
|
+
var GUID_KEY_DIMENSIONS = new Set([
|
|
2126
|
+
ProjectDimensions.ProjectKey,
|
|
2127
|
+
ProjectDimensions.SolutionKey,
|
|
2128
|
+
ProjectDimensions.SolutionProjectKey,
|
|
2129
|
+
ProjectDimensions.PreviousSolutionKey
|
|
2130
|
+
]);
|
|
2131
|
+
var ShipDimensions = {
|
|
2132
|
+
ShipKind: "ShipKind",
|
|
2133
|
+
Target: "Target",
|
|
2134
|
+
ProjectType: "ProjectType",
|
|
2135
|
+
ProjectTypes: "ProjectTypes",
|
|
2136
|
+
ArtifactCorrelationKey: "ArtifactCorrelationKey",
|
|
2137
|
+
PackageName: "PackageName",
|
|
2138
|
+
PackageVersion: "PackageVersion",
|
|
2139
|
+
PackageVersionKey: "PackageVersionKey",
|
|
2140
|
+
DeploymentKey: "DeploymentKey",
|
|
2141
|
+
SolutionId: "SolutionId",
|
|
2142
|
+
FolderKey: "FolderKey",
|
|
2143
|
+
FeedId: "FeedId"
|
|
2144
|
+
};
|
|
2145
|
+
var ErrorDimensions = {
|
|
2146
|
+
Result: "Result",
|
|
2147
|
+
ErrorCode: "ErrorCode",
|
|
2148
|
+
Retry: "Retry",
|
|
2149
|
+
ErrorMessage: "ErrorMessage",
|
|
2150
|
+
HttpStatus: "HttpStatus",
|
|
2151
|
+
UpstreamErrorCode: "UpstreamErrorCode"
|
|
2152
|
+
};
|
|
2153
|
+
var AuthDimensions = {
|
|
2154
|
+
AuthenticationMethod: "AuthenticationMethod",
|
|
2155
|
+
Success: "Success",
|
|
2156
|
+
Reason: "Reason"
|
|
2157
|
+
};
|
|
2158
|
+
var SkillsDimensions = {
|
|
2159
|
+
SchemaVersion: "SchemaVersion",
|
|
2160
|
+
AgentType: "AgentType",
|
|
2161
|
+
SkillsVersion: "SkillsVersion",
|
|
2162
|
+
UipSubcommand: "UipSubcommand",
|
|
2163
|
+
FileExtension: "FileExtension",
|
|
2164
|
+
SubagentModel: "SubagentModel",
|
|
2165
|
+
SubagentType: "SubagentType",
|
|
2166
|
+
PermissionMode: "PermissionMode",
|
|
2167
|
+
EffortLevel: "EffortLevel",
|
|
2168
|
+
SessionSource: "SessionSource",
|
|
2169
|
+
Outcome: "Outcome",
|
|
2170
|
+
DurationMs: "DurationMs",
|
|
2171
|
+
Source: "Source"
|
|
2172
|
+
};
|
|
2173
|
+
var PackagerDimensions = {
|
|
2174
|
+
ProjectId: "ProjectId",
|
|
2175
|
+
ProjectType: "ProjectType",
|
|
2176
|
+
SolutionId: "SolutionId"
|
|
2177
|
+
};
|
|
2178
|
+
var ScopeDimensions = {
|
|
2179
|
+
FolderId: "FolderId"
|
|
2180
|
+
};
|
|
2181
|
+
var ID_DIMENSIONS = new Set([
|
|
2182
|
+
BaseDimensions.CloudUserId,
|
|
2183
|
+
BaseDimensions.CloudTenantId,
|
|
2184
|
+
BaseDimensions.CloudOrganizationId,
|
|
2185
|
+
BaseDimensions.InstallationId,
|
|
2186
|
+
ShipDimensions.ArtifactCorrelationKey,
|
|
2187
|
+
ShipDimensions.PackageVersionKey,
|
|
2188
|
+
ShipDimensions.DeploymentKey,
|
|
2189
|
+
ShipDimensions.SolutionId,
|
|
2190
|
+
ShipDimensions.FolderKey,
|
|
2191
|
+
ShipDimensions.FeedId,
|
|
2192
|
+
PackagerDimensions.ProjectId
|
|
2193
|
+
]);
|
|
2194
|
+
var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
|
|
2195
|
+
var RESERVED_DIMENSION_NAMES = new Set([
|
|
2196
|
+
...Object.values(BaseDimensions),
|
|
2197
|
+
...Object.values(CommandDimensions),
|
|
2198
|
+
...Object.values(ShipDimensions),
|
|
2199
|
+
...Object.values(ProjectDimensions),
|
|
2200
|
+
...Object.values(ErrorDimensions),
|
|
2201
|
+
...Object.values(AuthDimensions),
|
|
2202
|
+
...Object.values(SkillsDimensions),
|
|
2203
|
+
...Object.values(PackagerDimensions),
|
|
2204
|
+
...Object.values(ScopeDimensions)
|
|
2205
|
+
]);
|
|
2206
|
+
var CURATED_DIMENSIONS = new Set([
|
|
2207
|
+
BaseDimensions.ApplicationName,
|
|
2208
|
+
BaseDimensions.ProductVersion,
|
|
2209
|
+
BaseDimensions.InstallationId,
|
|
2210
|
+
BaseDimensions.CloudUserId,
|
|
2211
|
+
BaseDimensions.CloudTenantId,
|
|
2212
|
+
BaseDimensions.CloudOrganizationId,
|
|
2213
|
+
BaseDimensions.IsInternalUser,
|
|
2214
|
+
BaseDimensions.Environment,
|
|
2215
|
+
BaseDimensions.BaseUrl,
|
|
2216
|
+
BaseDimensions.Region,
|
|
2217
|
+
BaseDimensions.Agent,
|
|
2218
|
+
BaseDimensions.AgentVersion,
|
|
2219
|
+
BaseDimensions.ToolVersion,
|
|
2220
|
+
BaseDimensions.ExecutionContext,
|
|
2221
|
+
BaseDimensions.CiProvider,
|
|
2222
|
+
BaseDimensions.SessionIdSource,
|
|
2223
|
+
BaseDimensions.SessionId,
|
|
2224
|
+
...Object.values(CommandDimensions),
|
|
2225
|
+
...Object.values(ShipDimensions),
|
|
2226
|
+
...Object.values(ProjectDimensions)
|
|
2227
|
+
]);
|
|
2228
|
+
function lowercaseIdDimensionValues(properties) {
|
|
2229
|
+
let changed = false;
|
|
2230
|
+
const result = {
|
|
2231
|
+
...properties
|
|
2232
|
+
};
|
|
2233
|
+
for (const key of Object.keys(result)) {
|
|
2234
|
+
const value = result[key];
|
|
2235
|
+
if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
|
|
2236
|
+
continue;
|
|
2237
|
+
}
|
|
2238
|
+
const lowered = value.toLowerCase();
|
|
2239
|
+
if (lowered !== value) {
|
|
2240
|
+
result[key] = lowered;
|
|
2241
|
+
changed = true;
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
return changed ? result : properties;
|
|
2245
|
+
}
|
|
2246
|
+
|
|
2247
|
+
// ../common/src/telemetry/project-identity.ts
|
|
2248
|
+
function projectKey(id) {
|
|
2249
|
+
if (typeof id !== "string")
|
|
2250
|
+
return;
|
|
2251
|
+
const key = id.trim().toLowerCase().replaceAll("-", "");
|
|
2252
|
+
return /^[0-9a-f]{32}$/.test(key) ? key : undefined;
|
|
2253
|
+
}
|
|
2254
|
+
function projectIdentityProperties(identity) {
|
|
2255
|
+
const key = identity.id ? projectKey(identity.id) : undefined;
|
|
2256
|
+
return {
|
|
2257
|
+
[ProjectDimensions.ProjectIdentityStatus]: identity.status === "resolved" && !key ? "invalid" : identity.status,
|
|
2258
|
+
[ProjectDimensions.ProjectType]: identity.projectType,
|
|
2259
|
+
...identity.status === "resolved" && key ? {
|
|
2260
|
+
[ProjectDimensions.ProjectKey]: key
|
|
2261
|
+
} : {}
|
|
2262
|
+
};
|
|
2263
|
+
}
|
|
2264
|
+
var PROJECT_IDENTITY_LOOKUP_BUDGET_MS = 1000;
|
|
2265
|
+
async function withinProjectIdentityBudget(work, onTimeout) {
|
|
2266
|
+
work.catch(() => {
|
|
2267
|
+
return;
|
|
2268
|
+
});
|
|
2269
|
+
let timer;
|
|
2270
|
+
const expired = new Promise((resolve) => {
|
|
2271
|
+
timer = setTimeout(() => {
|
|
2272
|
+
onTimeout?.();
|
|
2273
|
+
resolve(undefined);
|
|
2274
|
+
}, PROJECT_IDENTITY_LOOKUP_BUDGET_MS);
|
|
2275
|
+
});
|
|
2276
|
+
try {
|
|
2277
|
+
return await Promise.race([work, expired]);
|
|
2278
|
+
} finally {
|
|
2279
|
+
clearTimeout(timer);
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2099
2282
|
|
|
2100
2283
|
// ../common/src/telemetry/pseudonymize.ts
|
|
2101
2284
|
var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
|
|
@@ -2560,6 +2743,8 @@ function redactProperty(name, value) {
|
|
|
2560
2743
|
if (isSensitiveName(name)) {
|
|
2561
2744
|
return REDACTED;
|
|
2562
2745
|
}
|
|
2746
|
+
if (GUID_KEY_DIMENSIONS.has(name))
|
|
2747
|
+
return projectKey(value);
|
|
2563
2748
|
if (typeof value === "boolean" || typeof value === "number") {
|
|
2564
2749
|
return value;
|
|
2565
2750
|
}
|
|
@@ -2634,6 +2819,63 @@ function settlePromiseLike(thenable) {
|
|
|
2634
2819
|
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
|
|
2635
2820
|
}
|
|
2636
2821
|
|
|
2822
|
+
// ../common/src/error-codes.ts
|
|
2823
|
+
var CLI_ERROR_CODES = [
|
|
2824
|
+
"invalid_argument",
|
|
2825
|
+
"authentication_required",
|
|
2826
|
+
"permission_denied",
|
|
2827
|
+
"local_permission_denied",
|
|
2828
|
+
"not_found",
|
|
2829
|
+
"rate_limited",
|
|
2830
|
+
"network_error",
|
|
2831
|
+
"timeout",
|
|
2832
|
+
"server_error",
|
|
2833
|
+
"method_not_allowed",
|
|
2834
|
+
"not_supported",
|
|
2835
|
+
"configuration_error",
|
|
2836
|
+
"execution_failed",
|
|
2837
|
+
"unknown_error"
|
|
2838
|
+
];
|
|
2839
|
+
var RETRY_HINTS = [
|
|
2840
|
+
"RetryWillNotFix",
|
|
2841
|
+
"RetryLater",
|
|
2842
|
+
"RetryAfter1Second",
|
|
2843
|
+
"RetryAfter10Seconds",
|
|
2844
|
+
"RetryAfter30Seconds",
|
|
2845
|
+
"RetryAfter60Seconds"
|
|
2846
|
+
];
|
|
2847
|
+
var CLI_ERROR_CODE_VALUES = new Set(CLI_ERROR_CODES);
|
|
2848
|
+
var RETRY_HINT_VALUES = new Set(RETRY_HINTS);
|
|
2849
|
+
function isCliErrorCode(value) {
|
|
2850
|
+
return typeof value === "string" && CLI_ERROR_CODE_VALUES.has(value);
|
|
2851
|
+
}
|
|
2852
|
+
function isRetryHint(value) {
|
|
2853
|
+
return typeof value === "string" && RETRY_HINT_VALUES.has(value);
|
|
2854
|
+
}
|
|
2855
|
+
function carriedErrorCode(error) {
|
|
2856
|
+
if (!error || typeof error !== "object")
|
|
2857
|
+
return;
|
|
2858
|
+
const code = error.errorCode;
|
|
2859
|
+
return isCliErrorCode(code) ? code : undefined;
|
|
2860
|
+
}
|
|
2861
|
+
function carriedRetry(error) {
|
|
2862
|
+
if (!error || typeof error !== "object")
|
|
2863
|
+
return;
|
|
2864
|
+
const retry = error.retry;
|
|
2865
|
+
return isRetryHint(retry) ? retry : undefined;
|
|
2866
|
+
}
|
|
2867
|
+
function defaultRetryForErrorCode(errorCode) {
|
|
2868
|
+
switch (errorCode) {
|
|
2869
|
+
case "network_error":
|
|
2870
|
+
case "rate_limited":
|
|
2871
|
+
case "server_error":
|
|
2872
|
+
case "timeout":
|
|
2873
|
+
return "RetryLater";
|
|
2874
|
+
default:
|
|
2875
|
+
return "RetryWillNotFix";
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
2878
|
+
|
|
2637
2879
|
// ../common/src/error-graph.ts
|
|
2638
2880
|
function* walkErrorGraph(error) {
|
|
2639
2881
|
const queue = [error];
|
|
@@ -2678,6 +2920,40 @@ function findHttpStatusInGraph(error) {
|
|
|
2678
2920
|
return;
|
|
2679
2921
|
}
|
|
2680
2922
|
|
|
2923
|
+
// ../common/src/http-status.ts
|
|
2924
|
+
function classifyHttpStatus(status) {
|
|
2925
|
+
if (status === undefined)
|
|
2926
|
+
return;
|
|
2927
|
+
if (status === 400 || status === 409 || status === 413 || status === 422) {
|
|
2928
|
+
return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
|
|
2929
|
+
}
|
|
2930
|
+
if (status === 401) {
|
|
2931
|
+
return {
|
|
2932
|
+
errorCode: "authentication_required",
|
|
2933
|
+
retry: "RetryWillNotFix"
|
|
2934
|
+
};
|
|
2935
|
+
}
|
|
2936
|
+
if (status === 403) {
|
|
2937
|
+
return { errorCode: "permission_denied", retry: "RetryWillNotFix" };
|
|
2938
|
+
}
|
|
2939
|
+
if (status === 404) {
|
|
2940
|
+
return { errorCode: "not_found", retry: "RetryWillNotFix" };
|
|
2941
|
+
}
|
|
2942
|
+
if (status === 405) {
|
|
2943
|
+
return { errorCode: "method_not_allowed", retry: "RetryWillNotFix" };
|
|
2944
|
+
}
|
|
2945
|
+
if (status === 408) {
|
|
2946
|
+
return { errorCode: "timeout", retry: "RetryLater" };
|
|
2947
|
+
}
|
|
2948
|
+
if (status === 429) {
|
|
2949
|
+
return { errorCode: "rate_limited", retry: "RetryLater" };
|
|
2950
|
+
}
|
|
2951
|
+
if (status >= 500 && status < 600) {
|
|
2952
|
+
return { errorCode: "server_error", retry: "RetryLater" };
|
|
2953
|
+
}
|
|
2954
|
+
return;
|
|
2955
|
+
}
|
|
2956
|
+
|
|
2681
2957
|
// ../common/src/local-permission-codes.ts
|
|
2682
2958
|
var LOCAL_PERMISSION_ERROR_CODES = new Set([
|
|
2683
2959
|
"EACCES",
|
|
@@ -2690,6 +2966,8 @@ var DEFAULT_401 = "Unauthorized (401). The session is missing or expired, or its
|
|
|
2690
2966
|
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.";
|
|
2691
2967
|
var DEFAULT_405 = "Method Not Allowed (405). The endpoint may not exist or the base URL may be incorrect.";
|
|
2692
2968
|
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.";
|
|
2969
|
+
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.";
|
|
2970
|
+
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.";
|
|
2693
2971
|
var HTML_RESPONSE_MESSAGE = "Received HTML instead of the expected JSON response.";
|
|
2694
2972
|
var NETWORK_ERROR_CODES = new Set([
|
|
2695
2973
|
"ECONNREFUSED",
|
|
@@ -2775,9 +3053,23 @@ function localPermissionPath(path, message) {
|
|
|
2775
3053
|
return path;
|
|
2776
3054
|
return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
|
|
2777
3055
|
}
|
|
2778
|
-
function
|
|
2779
|
-
|
|
2780
|
-
|
|
3056
|
+
function readHeader(response, name) {
|
|
3057
|
+
const headers = response?.headers;
|
|
3058
|
+
if (!headers || typeof headers !== "object")
|
|
3059
|
+
return;
|
|
3060
|
+
if (typeof headers.get === "function") {
|
|
3061
|
+
const value = headers.get(name);
|
|
3062
|
+
if (value)
|
|
3063
|
+
return value;
|
|
3064
|
+
}
|
|
3065
|
+
const plain = headers;
|
|
3066
|
+
const key = Object.keys(plain).find((k) => k.toLowerCase() === name.toLowerCase());
|
|
3067
|
+
const value = key === undefined ? undefined : plain[key];
|
|
3068
|
+
return typeof value === "string" && value !== "" ? value : undefined;
|
|
3069
|
+
}
|
|
3070
|
+
function isHtmlDocument(body) {
|
|
3071
|
+
return /^\s*(<!doctype html|<html\b)/i.test(body);
|
|
3072
|
+
}
|
|
2781
3073
|
function retryHintForRetryAfter(seconds) {
|
|
2782
3074
|
if (seconds <= 1) {
|
|
2783
3075
|
return "RetryAfter1Second";
|
|
@@ -2791,36 +3083,9 @@ function retryHintForRetryAfter(seconds) {
|
|
|
2791
3083
|
return "RetryAfter60Seconds";
|
|
2792
3084
|
}
|
|
2793
3085
|
function classifyError(status, error) {
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
if (status === 401) {
|
|
2798
|
-
return {
|
|
2799
|
-
errorCode: "authentication_required",
|
|
2800
|
-
retry: "RetryWillNotFix"
|
|
2801
|
-
};
|
|
2802
|
-
}
|
|
2803
|
-
if (status === 403) {
|
|
2804
|
-
return { errorCode: "permission_denied", retry: "RetryWillNotFix" };
|
|
2805
|
-
}
|
|
2806
|
-
if (status === 404) {
|
|
2807
|
-
return { errorCode: "not_found", retry: "RetryWillNotFix" };
|
|
2808
|
-
}
|
|
2809
|
-
if (status === 405) {
|
|
2810
|
-
return { errorCode: "method_not_allowed", retry: "RetryWillNotFix" };
|
|
2811
|
-
}
|
|
2812
|
-
if (status === 413) {
|
|
2813
|
-
return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
|
|
2814
|
-
}
|
|
2815
|
-
if (status === 408) {
|
|
2816
|
-
return { errorCode: "timeout", retry: "RetryLater" };
|
|
2817
|
-
}
|
|
2818
|
-
if (status === 429) {
|
|
2819
|
-
return { errorCode: "rate_limited", retry: "RetryLater" };
|
|
2820
|
-
}
|
|
2821
|
-
if (status !== undefined && status >= 500 && status < 600) {
|
|
2822
|
-
return { errorCode: "server_error", retry: "RetryLater" };
|
|
2823
|
-
}
|
|
3086
|
+
const byStatus = classifyHttpStatus(status);
|
|
3087
|
+
if (byStatus)
|
|
3088
|
+
return byStatus;
|
|
2824
3089
|
if (status === undefined && describePermissionError(error)) {
|
|
2825
3090
|
return {
|
|
2826
3091
|
errorCode: "local_permission_denied",
|
|
@@ -2836,6 +3101,17 @@ function classifyError(status, error) {
|
|
|
2836
3101
|
}
|
|
2837
3102
|
return { errorCode: "unknown_error", retry: "RetryWillNotFix" };
|
|
2838
3103
|
}
|
|
3104
|
+
function withCarriedClass(inferred, error) {
|
|
3105
|
+
const errorCode = carriedErrorCode(error);
|
|
3106
|
+
const retry = carriedRetry(error);
|
|
3107
|
+
if (errorCode === undefined || errorCode === inferred.errorCode) {
|
|
3108
|
+
return {
|
|
3109
|
+
errorCode: inferred.errorCode,
|
|
3110
|
+
retry: retry ?? inferred.retry
|
|
3111
|
+
};
|
|
3112
|
+
}
|
|
3113
|
+
return { errorCode, retry: retry ?? defaultRetryForErrorCode(errorCode) };
|
|
3114
|
+
}
|
|
2839
3115
|
function formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus) {
|
|
2840
3116
|
if (extractedMessage) {
|
|
2841
3117
|
return `HTTP ${status}: ${extractedMessage}`;
|
|
@@ -2891,9 +3167,14 @@ async function extractErrorDetails(error, options) {
|
|
|
2891
3167
|
const classificationStatus = status ?? findHttpStatusInGraph(error);
|
|
2892
3168
|
const classification = classifyError(classificationStatus, error);
|
|
2893
3169
|
let retry = classification.retry;
|
|
3170
|
+
const htmlForbidden = status === 403 && rawBody !== undefined && isHtmlDocument(rawBody);
|
|
3171
|
+
const rayId = htmlForbidden ? readHeader(response, "cf-ray") : undefined;
|
|
3172
|
+
const cloudflareBlock = htmlForbidden && (rayId !== undefined || /\bcloudflare\b/i.test(readHeader(response, "server") ?? ""));
|
|
2894
3173
|
if (status === 401) {
|
|
2895
3174
|
message = DEFAULT_401;
|
|
2896
3175
|
result = "AuthenticationError";
|
|
3176
|
+
} else if (cloudflareBlock) {
|
|
3177
|
+
message = rayId ? `${CLOUDFLARE_BLOCK_403} Cloudflare Ray ID: ${rayId}.` : CLOUDFLARE_BLOCK_403;
|
|
2897
3178
|
} else if (status === 403) {
|
|
2898
3179
|
message = options?.forbiddenMessage ?? DEFAULT_403;
|
|
2899
3180
|
result = "AuthenticationError";
|
|
@@ -2941,7 +3222,9 @@ async function extractErrorDetails(error, options) {
|
|
|
2941
3222
|
}
|
|
2942
3223
|
}
|
|
2943
3224
|
let details = rawMessage;
|
|
2944
|
-
if (
|
|
3225
|
+
if (htmlForbidden) {
|
|
3226
|
+
details = cloudflareBlock ? CLOUDFLARE_BLOCK_403_INSTRUCTIONS : HTML_RESPONSE_MESSAGE;
|
|
3227
|
+
} else if (rawBody) {
|
|
2945
3228
|
if (parsedBody) {
|
|
2946
3229
|
const extra = {};
|
|
2947
3230
|
if (parsedBody.errorCode)
|
|
@@ -2975,6 +3258,8 @@ async function extractErrorDetails(error, options) {
|
|
|
2975
3258
|
}
|
|
2976
3259
|
if (parsedBody?.requestId && typeof parsedBody.requestId === "string") {
|
|
2977
3260
|
context.requestId = parsedBody.requestId;
|
|
3261
|
+
} else if (cloudflareBlock && rayId) {
|
|
3262
|
+
context.requestId = rayId;
|
|
2978
3263
|
}
|
|
2979
3264
|
if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
|
|
2980
3265
|
context.traceId = parsedBody.traceId;
|
|
@@ -2983,16 +3268,7 @@ async function extractErrorDetails(error, options) {
|
|
|
2983
3268
|
context.path = permission.path;
|
|
2984
3269
|
}
|
|
2985
3270
|
if (status === 429) {
|
|
2986
|
-
const
|
|
2987
|
-
const headersObj = resp?.headers;
|
|
2988
|
-
let retryAfterValue;
|
|
2989
|
-
if (headersObj && typeof headersObj === "object" && typeof headersObj.get === "function") {
|
|
2990
|
-
retryAfterValue = headersObj.get("retry-after") ?? undefined;
|
|
2991
|
-
}
|
|
2992
|
-
if (!retryAfterValue && headersObj && typeof headersObj === "object") {
|
|
2993
|
-
const headers = headersObj;
|
|
2994
|
-
retryAfterValue = headers["retry-after"] ?? headers["Retry-After"];
|
|
2995
|
-
}
|
|
3271
|
+
const retryAfterValue = readHeader(response, "retry-after");
|
|
2996
3272
|
if (retryAfterValue) {
|
|
2997
3273
|
const seconds = Number(retryAfterValue);
|
|
2998
3274
|
if (!Number.isNaN(seconds)) {
|
|
@@ -3026,9 +3302,8 @@ async function extractErrorDetails(error, options) {
|
|
|
3026
3302
|
}
|
|
3027
3303
|
return {
|
|
3028
3304
|
result,
|
|
3029
|
-
errorCode: classification.errorCode,
|
|
3305
|
+
...withCarriedClass({ errorCode: classification.errorCode, retry }, error),
|
|
3030
3306
|
message,
|
|
3031
|
-
retry,
|
|
3032
3307
|
details,
|
|
3033
3308
|
...hasContext ? { context } : {},
|
|
3034
3309
|
...parsedErrors ? { parsedErrors } : {}
|
|
@@ -3053,13 +3328,77 @@ function extractErrorMessageSync(error) {
|
|
|
3053
3328
|
return describeThrownValue(error);
|
|
3054
3329
|
}
|
|
3055
3330
|
|
|
3056
|
-
// ../common/src/
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3331
|
+
// ../common/src/result-types.ts
|
|
3332
|
+
var RESULTS = {
|
|
3333
|
+
Success: "Success",
|
|
3334
|
+
Failure: "Failure",
|
|
3335
|
+
ConfigError: "ConfigError",
|
|
3336
|
+
AuthenticationError: "AuthenticationError",
|
|
3337
|
+
ValidationError: "ValidationError",
|
|
3338
|
+
TimeoutError: "TimeoutError"
|
|
3339
|
+
};
|
|
3340
|
+
|
|
3341
|
+
// ../../node_modules/commander/index.js
|
|
3342
|
+
var exports_commander = {};
|
|
3343
|
+
__exportCjs(exports_commander, {
|
|
3344
|
+
program: () => $program,
|
|
3345
|
+
createCommand: () => $createCommand,
|
|
3346
|
+
createOption: () => $createOption,
|
|
3347
|
+
createArgument: () => $createArgument,
|
|
3348
|
+
Command: () => $Command,
|
|
3349
|
+
Option: () => $Option,
|
|
3350
|
+
Argument: () => $Argument,
|
|
3351
|
+
Help: () => $Help,
|
|
3352
|
+
CommanderError: () => $CommanderError,
|
|
3353
|
+
InvalidArgumentError: () => $InvalidArgumentError,
|
|
3354
|
+
InvalidOptionArgumentError: () => $InvalidOptionArgumentError
|
|
3355
|
+
}, {
|
|
3356
|
+
program: (value) => $program = value,
|
|
3357
|
+
createCommand: (value) => $createCommand = value,
|
|
3358
|
+
createOption: (value) => $createOption = value,
|
|
3359
|
+
createArgument: (value) => $createArgument = value,
|
|
3360
|
+
Command: (value) => $Command = value,
|
|
3361
|
+
Option: (value) => $Option = value,
|
|
3362
|
+
Argument: (value) => $Argument = value,
|
|
3363
|
+
Help: (value) => $Help = value,
|
|
3364
|
+
CommanderError: (value) => $CommanderError = value,
|
|
3365
|
+
InvalidArgumentError: (value) => $InvalidArgumentError = value,
|
|
3366
|
+
InvalidOptionArgumentError: (value) => $InvalidOptionArgumentError = value
|
|
3367
|
+
});
|
|
3368
|
+
var { Argument } = require_argument();
|
|
3369
|
+
var { Command: Command2 } = require_command();
|
|
3370
|
+
var { CommanderError, InvalidArgumentError } = require_error();
|
|
3371
|
+
var { Help } = require_help();
|
|
3372
|
+
var { Option: Option2 } = require_option();
|
|
3373
|
+
var $program = new Command2;
|
|
3374
|
+
var $createCommand = (name) => new Command2(name);
|
|
3375
|
+
var $createOption = (flags, description) => new Option2(flags, description);
|
|
3376
|
+
var $createArgument = (name, description) => new Argument(name, description);
|
|
3377
|
+
var $Command = Command2;
|
|
3378
|
+
var $Option = Option2;
|
|
3379
|
+
var $Argument = Argument;
|
|
3380
|
+
var $Help = Help;
|
|
3381
|
+
var $CommanderError = CommanderError;
|
|
3382
|
+
var $InvalidArgumentError = InvalidArgumentError;
|
|
3383
|
+
var $InvalidOptionArgumentError = InvalidArgumentError;
|
|
3384
|
+
|
|
3385
|
+
// ../../node_modules/commander/esm.mjs
|
|
3386
|
+
var {
|
|
3387
|
+
program,
|
|
3388
|
+
createCommand,
|
|
3389
|
+
createArgument,
|
|
3390
|
+
createOption,
|
|
3391
|
+
CommanderError: CommanderError2,
|
|
3392
|
+
InvalidArgumentError: InvalidArgumentError2,
|
|
3393
|
+
InvalidOptionArgumentError,
|
|
3394
|
+
Command,
|
|
3395
|
+
Argument: Argument2,
|
|
3396
|
+
Option,
|
|
3397
|
+
Help: Help2
|
|
3398
|
+
} = exports_commander;
|
|
3060
3399
|
|
|
3061
3400
|
// ../filesystem/src/node.ts
|
|
3062
|
-
import { randomUUID } from "node:crypto";
|
|
3401
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
3063
3402
|
import { existsSync } from "node:fs";
|
|
3064
3403
|
import * as fs from "node:fs/promises";
|
|
3065
3404
|
import * as os from "node:os";
|
|
@@ -3070,6 +3409,9 @@ var LOCK_MAX_WAIT_MS = 20000;
|
|
|
3070
3409
|
var LOCK_MAX_HOLD_MS = 60000;
|
|
3071
3410
|
var LOCK_RETRY_MIN_MS = 100;
|
|
3072
3411
|
var LOCK_RETRY_JITTER_MS = 200;
|
|
3412
|
+
var HASH_CHUNK_BYTES = 256 * 1024;
|
|
3413
|
+
var hashBuffers = [];
|
|
3414
|
+
var HASH_BUFFERS_KEPT = 64;
|
|
3073
3415
|
|
|
3074
3416
|
class NodeFileSystem {
|
|
3075
3417
|
path = {
|
|
@@ -3088,7 +3430,7 @@ class NodeFileSystem {
|
|
|
3088
3430
|
};
|
|
3089
3431
|
utils = {
|
|
3090
3432
|
open: async (url) => {
|
|
3091
|
-
const { default: open } = await import("./index-
|
|
3433
|
+
const { default: open } = await import("./index-nzr4mx5p.js");
|
|
3092
3434
|
await open(url);
|
|
3093
3435
|
}
|
|
3094
3436
|
};
|
|
@@ -3127,6 +3469,15 @@ class NodeFileSystem {
|
|
|
3127
3469
|
throw error;
|
|
3128
3470
|
}
|
|
3129
3471
|
}
|
|
3472
|
+
async readdirEntries(dirPath) {
|
|
3473
|
+
try {
|
|
3474
|
+
return await fs.readdir(dirPath, { withFileTypes: true });
|
|
3475
|
+
} catch (error) {
|
|
3476
|
+
if (this.isEnoent(error))
|
|
3477
|
+
return [];
|
|
3478
|
+
throw error;
|
|
3479
|
+
}
|
|
3480
|
+
}
|
|
3130
3481
|
async stat(filePath) {
|
|
3131
3482
|
try {
|
|
3132
3483
|
const stats = await fs.stat(filePath);
|
|
@@ -3134,7 +3485,8 @@ class NodeFileSystem {
|
|
|
3134
3485
|
isFile: () => stats.isFile(),
|
|
3135
3486
|
isDirectory: () => stats.isDirectory(),
|
|
3136
3487
|
size: stats.size,
|
|
3137
|
-
mtimeMs: stats.mtimeMs
|
|
3488
|
+
mtimeMs: stats.mtimeMs,
|
|
3489
|
+
ctimeMs: stats.ctimeMs
|
|
3138
3490
|
};
|
|
3139
3491
|
} catch (error) {
|
|
3140
3492
|
if (this.isEnoent(error))
|
|
@@ -3248,6 +3600,42 @@ class NodeFileSystem {
|
|
|
3248
3600
|
throw error;
|
|
3249
3601
|
}
|
|
3250
3602
|
}
|
|
3603
|
+
async hashFile(filePath) {
|
|
3604
|
+
let handle;
|
|
3605
|
+
try {
|
|
3606
|
+
handle = await fs.open(filePath, "r");
|
|
3607
|
+
} catch (error) {
|
|
3608
|
+
if (this.isEnoent(error))
|
|
3609
|
+
return null;
|
|
3610
|
+
throw error;
|
|
3611
|
+
}
|
|
3612
|
+
const buffer = hashBuffers.pop() ?? Buffer.allocUnsafe(HASH_CHUNK_BYTES);
|
|
3613
|
+
try {
|
|
3614
|
+
const opened = await handle.stat();
|
|
3615
|
+
const stats = {
|
|
3616
|
+
isFile: () => opened.isFile(),
|
|
3617
|
+
isDirectory: () => opened.isDirectory(),
|
|
3618
|
+
size: opened.size,
|
|
3619
|
+
mtimeMs: opened.mtimeMs,
|
|
3620
|
+
ctimeMs: opened.ctimeMs
|
|
3621
|
+
};
|
|
3622
|
+
const hash = createHash("sha256");
|
|
3623
|
+
let size = 0;
|
|
3624
|
+
for (;; ) {
|
|
3625
|
+
const { bytesRead } = await handle.read(buffer, 0, buffer.byteLength, null);
|
|
3626
|
+
if (bytesRead === 0)
|
|
3627
|
+
break;
|
|
3628
|
+
hash.update(buffer.subarray(0, bytesRead));
|
|
3629
|
+
size += bytesRead;
|
|
3630
|
+
}
|
|
3631
|
+
return { sha256: hash.digest("hex"), size, stats };
|
|
3632
|
+
} finally {
|
|
3633
|
+
if (hashBuffers.length < HASH_BUFFERS_KEPT) {
|
|
3634
|
+
hashBuffers.push(buffer);
|
|
3635
|
+
}
|
|
3636
|
+
await handle.close();
|
|
3637
|
+
}
|
|
3638
|
+
}
|
|
3251
3639
|
async realpath(filePath) {
|
|
3252
3640
|
try {
|
|
3253
3641
|
return await fs.realpath(filePath);
|
|
@@ -3331,8 +3719,8 @@ function getOutputSink() {
|
|
|
3331
3719
|
|
|
3332
3720
|
// ../common/src/logger.ts
|
|
3333
3721
|
var logFilePathSlot = singleton("logFilePath");
|
|
3334
|
-
function setGlobalLogFilePath(
|
|
3335
|
-
logFilePathSlot.set(
|
|
3722
|
+
function setGlobalLogFilePath(path) {
|
|
3723
|
+
logFilePathSlot.set(path);
|
|
3336
3724
|
}
|
|
3337
3725
|
function getGlobalLogFilePath() {
|
|
3338
3726
|
return logFilePathSlot.get("");
|
|
@@ -3400,14 +3788,14 @@ class SimpleLogger {
|
|
|
3400
3788
|
return this.fileLoggingEnabled || !!getGlobalLogFilePath();
|
|
3401
3789
|
}
|
|
3402
3790
|
writeToFile(formatted) {
|
|
3403
|
-
const
|
|
3404
|
-
if (!
|
|
3791
|
+
const path = this.logFilePath || getGlobalLogFilePath();
|
|
3792
|
+
if (!path)
|
|
3405
3793
|
return;
|
|
3406
3794
|
const timestamp = new Date().toISOString();
|
|
3407
3795
|
this.pendingWrites = Promise.all([
|
|
3408
3796
|
this.pendingWrites,
|
|
3409
3797
|
this.pendingInit
|
|
3410
|
-
]).then(() => getFileSystem().appendFile(
|
|
3798
|
+
]).then(() => getFileSystem().appendFile(path, `${timestamp} ${formatted}`).catch(() => {}));
|
|
3411
3799
|
}
|
|
3412
3800
|
write(formatted) {
|
|
3413
3801
|
if (this.isFileLoggingActive()) {
|
|
@@ -3457,17 +3845,17 @@ class SimpleLogger {
|
|
|
3457
3845
|
setGlobalLogFilePath("");
|
|
3458
3846
|
}
|
|
3459
3847
|
}
|
|
3460
|
-
setLogFile(
|
|
3461
|
-
this.logFilePath =
|
|
3462
|
-
setGlobalLogFilePath(
|
|
3463
|
-
if (!
|
|
3848
|
+
setLogFile(path) {
|
|
3849
|
+
this.logFilePath = path;
|
|
3850
|
+
setGlobalLogFilePath(path);
|
|
3851
|
+
if (!path)
|
|
3464
3852
|
return;
|
|
3465
3853
|
this.fileLoggingEnabled = true;
|
|
3466
|
-
const
|
|
3854
|
+
const fs = getFileSystem();
|
|
3467
3855
|
this.pendingInit = (async () => {
|
|
3468
3856
|
const [error] = await catchError((async () => {
|
|
3469
|
-
await
|
|
3470
|
-
await
|
|
3857
|
+
await fs.mkdir(fs.path.dirname(path));
|
|
3858
|
+
await fs.writeFile(path, "");
|
|
3471
3859
|
})());
|
|
3472
3860
|
if (error)
|
|
3473
3861
|
this.fileLoggingEnabled = false;
|
|
@@ -3515,18 +3903,111 @@ function getLogFilePath() {
|
|
|
3515
3903
|
return logger.getLogFilePath();
|
|
3516
3904
|
}
|
|
3517
3905
|
|
|
3906
|
+
// ../common/src/timings.ts
|
|
3907
|
+
var TIMINGS_ENV_VAR = "UIP_TIMINGS";
|
|
3908
|
+
function createStorage2() {
|
|
3909
|
+
const [error, mod] = catchError(() => __require("node:async_hooks"));
|
|
3910
|
+
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
3911
|
+
return {
|
|
3912
|
+
getStore: () => {
|
|
3913
|
+
return;
|
|
3914
|
+
},
|
|
3915
|
+
run: (_store, fn) => fn()
|
|
3916
|
+
};
|
|
3917
|
+
}
|
|
3918
|
+
return new mod.AsyncLocalStorage;
|
|
3919
|
+
}
|
|
3920
|
+
var storageSlot = singleton("TimingStorage");
|
|
3921
|
+
var stateSlot = singleton("Timings");
|
|
3922
|
+
var rootStartedSlot = singleton("TimingsRootStarted");
|
|
3923
|
+
var longLivedHostSlot = singleton("TimingsLongLivedHost");
|
|
3924
|
+
var storage = storageSlot.getOrInit(createStorage2, (value) => ("getStore" in value));
|
|
3925
|
+
function newState(baseline) {
|
|
3926
|
+
return { baseline, httpMs: 0, httpCalls: 0 };
|
|
3927
|
+
}
|
|
3928
|
+
function getState() {
|
|
3929
|
+
const scoped = storage.getStore();
|
|
3930
|
+
if (scoped) {
|
|
3931
|
+
return scoped;
|
|
3932
|
+
}
|
|
3933
|
+
const pinned = livePinnedState();
|
|
3934
|
+
if (pinned !== undefined) {
|
|
3935
|
+
return pinned;
|
|
3936
|
+
}
|
|
3937
|
+
return newState(processStartIsInvocationStart() ? 0 : performance.now());
|
|
3938
|
+
}
|
|
3939
|
+
function livePinnedState() {
|
|
3940
|
+
const pinned = stateSlot.get();
|
|
3941
|
+
return pinned !== undefined && "httpCalls" in pinned && !pinned.finished ? pinned : undefined;
|
|
3942
|
+
}
|
|
3943
|
+
function processStartIsInvocationStart() {
|
|
3944
|
+
return !rootStartedSlot.get(false) && !longLivedHostSlot.get(false);
|
|
3945
|
+
}
|
|
3946
|
+
function timingsEnabled() {
|
|
3947
|
+
if (typeof process === "undefined") {
|
|
3948
|
+
return false;
|
|
3949
|
+
}
|
|
3950
|
+
const value = process.env?.[TIMINGS_ENV_VAR];
|
|
3951
|
+
if (value === undefined) {
|
|
3952
|
+
return false;
|
|
3953
|
+
}
|
|
3954
|
+
const normalized = value.trim().toLowerCase();
|
|
3955
|
+
return normalized === "1" || normalized === "true";
|
|
3956
|
+
}
|
|
3957
|
+
function recordExitCode(exitCode) {
|
|
3958
|
+
if (!timingsEnabled()) {
|
|
3959
|
+
return;
|
|
3960
|
+
}
|
|
3961
|
+
getState().exitCode = exitCode;
|
|
3962
|
+
}
|
|
3963
|
+
function invocationStartedAt() {
|
|
3964
|
+
return new Date(performance.timeOrigin + getState().baseline);
|
|
3965
|
+
}
|
|
3966
|
+
function invocationElapsedMs() {
|
|
3967
|
+
return performance.now() - getState().baseline;
|
|
3968
|
+
}
|
|
3969
|
+
function markCommandStart() {
|
|
3970
|
+
if (!timingsEnabled()) {
|
|
3971
|
+
return;
|
|
3972
|
+
}
|
|
3973
|
+
getState().commandStart = performance.now();
|
|
3974
|
+
}
|
|
3975
|
+
function recordCommandDuration(durationMs) {
|
|
3976
|
+
if (!timingsEnabled()) {
|
|
3977
|
+
return;
|
|
3978
|
+
}
|
|
3979
|
+
getState().commandMs = durationMs;
|
|
3980
|
+
}
|
|
3981
|
+
|
|
3982
|
+
// ../common/src/exit-code.ts
|
|
3983
|
+
function setExitCode(code) {
|
|
3984
|
+
process.exitCode = code;
|
|
3985
|
+
recordExitCode(code);
|
|
3986
|
+
}
|
|
3987
|
+
var GENERIC_FAILURE_EXIT_CODE = 1;
|
|
3988
|
+
function recordCommandExit(code) {
|
|
3989
|
+
if (code === GENERIC_FAILURE_EXIT_CODE && getExitCode() !== 0) {
|
|
3990
|
+
return;
|
|
3991
|
+
}
|
|
3992
|
+
setExitCode(code);
|
|
3993
|
+
}
|
|
3994
|
+
function getExitCode() {
|
|
3995
|
+
const code = process.exitCode;
|
|
3996
|
+
return typeof code === "number" ? code : 0;
|
|
3997
|
+
}
|
|
3998
|
+
|
|
3518
3999
|
// ../common/src/output-codecs.ts
|
|
3519
4000
|
var yamlSlot = singleton("YamlCodec");
|
|
3520
4001
|
var jmespathSlot = singleton("JmespathCodec");
|
|
3521
4002
|
async function loadOutputCodecsAsync(needed) {
|
|
3522
4003
|
const loads = [];
|
|
3523
4004
|
if (needed.yaml && yamlSlot.get() === undefined) {
|
|
3524
|
-
loads.push(import("./js-yaml-
|
|
4005
|
+
loads.push(import("./js-yaml-a2bk27p6.js").then((mod) => {
|
|
3525
4006
|
yamlSlot.set(mod);
|
|
3526
4007
|
}));
|
|
3527
4008
|
}
|
|
3528
4009
|
if (needed.filter && jmespathSlot.get() === undefined) {
|
|
3529
|
-
loads.push(import("./jmespath-
|
|
4010
|
+
loads.push(import("./jmespath-ab6tdc42.js").then((m)=>__toESM(m.default,1)).then((mod) => {
|
|
3530
4011
|
jmespathSlot.set(mod);
|
|
3531
4012
|
}));
|
|
3532
4013
|
}
|
|
@@ -3551,155 +4032,6 @@ function getOutputFilter() {
|
|
|
3551
4032
|
return filterSlot.get();
|
|
3552
4033
|
}
|
|
3553
4034
|
|
|
3554
|
-
// ../common/src/telemetry/telemetry-dimensions.ts
|
|
3555
|
-
var BaseDimensions = {
|
|
3556
|
-
ApplicationName: "ApplicationName",
|
|
3557
|
-
ProductVersion: "ProductVersion",
|
|
3558
|
-
InstallationId: "InstallationId",
|
|
3559
|
-
CloudUserId: "CloudUserId",
|
|
3560
|
-
CloudTenantId: "CloudTenantId",
|
|
3561
|
-
CloudOrganizationId: "CloudOrganizationId",
|
|
3562
|
-
IsInternalUser: "IsInternalUser",
|
|
3563
|
-
Environment: "Environment",
|
|
3564
|
-
BaseUrl: "BaseUrl",
|
|
3565
|
-
Region: "Region",
|
|
3566
|
-
Agent: "Agent",
|
|
3567
|
-
AgentVersion: "AgentVersion",
|
|
3568
|
-
AgentModel: "AgentModel",
|
|
3569
|
-
ToolName: "ToolName",
|
|
3570
|
-
ToolVersion: "ToolVersion",
|
|
3571
|
-
ExecutionContext: "ExecutionContext",
|
|
3572
|
-
CiProvider: "CiProvider",
|
|
3573
|
-
SessionIdSource: "SessionIdSource",
|
|
3574
|
-
SessionId: "SessionId"
|
|
3575
|
-
};
|
|
3576
|
-
var CommandDimensions = {
|
|
3577
|
-
IsCommand: "IsCommand",
|
|
3578
|
-
IsReexec: "IsReexec",
|
|
3579
|
-
CommandName: "CommandName",
|
|
3580
|
-
ExitCode: "ExitCode",
|
|
3581
|
-
TerminalOutcome: "TerminalOutcome",
|
|
3582
|
-
ErrorClass: "ErrorClass",
|
|
3583
|
-
TerminalSignal: "TerminalSignal",
|
|
3584
|
-
ErrorMessage: "ErrorMessage",
|
|
3585
|
-
SkillName: "SkillName",
|
|
3586
|
-
ProductArea: "ProductArea",
|
|
3587
|
-
Mode: "Mode"
|
|
3588
|
-
};
|
|
3589
|
-
var ShipDimensions = {
|
|
3590
|
-
ShipKind: "ShipKind",
|
|
3591
|
-
Target: "Target",
|
|
3592
|
-
ProjectType: "ProjectType",
|
|
3593
|
-
ProjectTypes: "ProjectTypes",
|
|
3594
|
-
ArtifactCorrelationKey: "ArtifactCorrelationKey",
|
|
3595
|
-
PackageName: "PackageName",
|
|
3596
|
-
PackageVersion: "PackageVersion",
|
|
3597
|
-
PackageVersionKey: "PackageVersionKey",
|
|
3598
|
-
DeploymentKey: "DeploymentKey",
|
|
3599
|
-
SolutionId: "SolutionId",
|
|
3600
|
-
FolderKey: "FolderKey",
|
|
3601
|
-
FeedId: "FeedId"
|
|
3602
|
-
};
|
|
3603
|
-
var ErrorDimensions = {
|
|
3604
|
-
Result: "Result",
|
|
3605
|
-
ErrorCode: "ErrorCode",
|
|
3606
|
-
Retry: "Retry",
|
|
3607
|
-
ErrorMessage: "ErrorMessage",
|
|
3608
|
-
HttpStatus: "HttpStatus",
|
|
3609
|
-
UpstreamErrorCode: "UpstreamErrorCode"
|
|
3610
|
-
};
|
|
3611
|
-
var AuthDimensions = {
|
|
3612
|
-
AuthenticationMethod: "AuthenticationMethod",
|
|
3613
|
-
Success: "Success",
|
|
3614
|
-
Reason: "Reason"
|
|
3615
|
-
};
|
|
3616
|
-
var SkillsDimensions = {
|
|
3617
|
-
SchemaVersion: "SchemaVersion",
|
|
3618
|
-
AgentType: "AgentType",
|
|
3619
|
-
SkillsVersion: "SkillsVersion",
|
|
3620
|
-
UipSubcommand: "UipSubcommand",
|
|
3621
|
-
FileExtension: "FileExtension",
|
|
3622
|
-
SubagentModel: "SubagentModel",
|
|
3623
|
-
SubagentType: "SubagentType",
|
|
3624
|
-
PermissionMode: "PermissionMode",
|
|
3625
|
-
EffortLevel: "EffortLevel",
|
|
3626
|
-
SessionSource: "SessionSource",
|
|
3627
|
-
Outcome: "Outcome",
|
|
3628
|
-
DurationMs: "DurationMs",
|
|
3629
|
-
Source: "Source"
|
|
3630
|
-
};
|
|
3631
|
-
var PackagerDimensions = {
|
|
3632
|
-
ProjectId: "ProjectId",
|
|
3633
|
-
ProjectType: "ProjectType",
|
|
3634
|
-
SolutionId: "SolutionId"
|
|
3635
|
-
};
|
|
3636
|
-
var ScopeDimensions = {
|
|
3637
|
-
FolderId: "FolderId"
|
|
3638
|
-
};
|
|
3639
|
-
var ID_DIMENSIONS = new Set([
|
|
3640
|
-
BaseDimensions.CloudUserId,
|
|
3641
|
-
BaseDimensions.CloudTenantId,
|
|
3642
|
-
BaseDimensions.CloudOrganizationId,
|
|
3643
|
-
BaseDimensions.InstallationId,
|
|
3644
|
-
ShipDimensions.ArtifactCorrelationKey,
|
|
3645
|
-
ShipDimensions.PackageVersionKey,
|
|
3646
|
-
ShipDimensions.DeploymentKey,
|
|
3647
|
-
ShipDimensions.SolutionId,
|
|
3648
|
-
ShipDimensions.FolderKey,
|
|
3649
|
-
ShipDimensions.FeedId,
|
|
3650
|
-
PackagerDimensions.ProjectId
|
|
3651
|
-
]);
|
|
3652
|
-
var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
|
|
3653
|
-
var RESERVED_DIMENSION_NAMES = new Set([
|
|
3654
|
-
...Object.values(BaseDimensions),
|
|
3655
|
-
...Object.values(CommandDimensions),
|
|
3656
|
-
...Object.values(ShipDimensions),
|
|
3657
|
-
...Object.values(ErrorDimensions),
|
|
3658
|
-
...Object.values(AuthDimensions),
|
|
3659
|
-
...Object.values(SkillsDimensions),
|
|
3660
|
-
...Object.values(PackagerDimensions),
|
|
3661
|
-
...Object.values(ScopeDimensions)
|
|
3662
|
-
]);
|
|
3663
|
-
var CURATED_DIMENSIONS = new Set([
|
|
3664
|
-
BaseDimensions.ApplicationName,
|
|
3665
|
-
BaseDimensions.ProductVersion,
|
|
3666
|
-
BaseDimensions.InstallationId,
|
|
3667
|
-
BaseDimensions.CloudUserId,
|
|
3668
|
-
BaseDimensions.CloudTenantId,
|
|
3669
|
-
BaseDimensions.CloudOrganizationId,
|
|
3670
|
-
BaseDimensions.IsInternalUser,
|
|
3671
|
-
BaseDimensions.Environment,
|
|
3672
|
-
BaseDimensions.BaseUrl,
|
|
3673
|
-
BaseDimensions.Region,
|
|
3674
|
-
BaseDimensions.Agent,
|
|
3675
|
-
BaseDimensions.AgentVersion,
|
|
3676
|
-
BaseDimensions.ToolVersion,
|
|
3677
|
-
BaseDimensions.ExecutionContext,
|
|
3678
|
-
BaseDimensions.CiProvider,
|
|
3679
|
-
BaseDimensions.SessionIdSource,
|
|
3680
|
-
BaseDimensions.SessionId,
|
|
3681
|
-
...Object.values(CommandDimensions),
|
|
3682
|
-
...Object.values(ShipDimensions)
|
|
3683
|
-
]);
|
|
3684
|
-
function lowercaseIdDimensionValues(properties) {
|
|
3685
|
-
let changed = false;
|
|
3686
|
-
const result = {
|
|
3687
|
-
...properties
|
|
3688
|
-
};
|
|
3689
|
-
for (const key of Object.keys(result)) {
|
|
3690
|
-
const value = result[key];
|
|
3691
|
-
if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
|
|
3692
|
-
continue;
|
|
3693
|
-
}
|
|
3694
|
-
const lowered = value.toLowerCase();
|
|
3695
|
-
if (lowered !== value) {
|
|
3696
|
-
result[key] = lowered;
|
|
3697
|
-
changed = true;
|
|
3698
|
-
}
|
|
3699
|
-
}
|
|
3700
|
-
return changed ? result : properties;
|
|
3701
|
-
}
|
|
3702
|
-
|
|
3703
4035
|
// ../common/src/telemetry/command-terminal.ts
|
|
3704
4036
|
var recordedFailureSlot = singleton("CommandTelemetryFailure");
|
|
3705
4037
|
var AUTH_ERROR_CODES = new Set([
|
|
@@ -3812,23 +4144,14 @@ function terminalSignalFor(input, outcome) {
|
|
|
3812
4144
|
if (input.recordedFailure?.terminalSignal) {
|
|
3813
4145
|
return input.recordedFailure.terminalSignal;
|
|
3814
4146
|
}
|
|
3815
|
-
const explicit = findStringInCauseChain(input.error, "terminalSignal") ?? findStringInCauseChain(input.error, "signal");
|
|
3816
|
-
if (explicit) {
|
|
3817
|
-
return explicit;
|
|
3818
|
-
}
|
|
3819
|
-
return outcome === "cancelled" ? "SIGINT" : undefined;
|
|
3820
|
-
}
|
|
3821
|
-
function classifyHttpStatus(status) {
|
|
3822
|
-
if (status === 401 || status === 403) {
|
|
3823
|
-
return "auth";
|
|
3824
|
-
}
|
|
3825
|
-
if (status === 400 || status === 409 || status === 422) {
|
|
3826
|
-
return "validation";
|
|
3827
|
-
}
|
|
3828
|
-
if (status === 408) {
|
|
3829
|
-
return "timeout";
|
|
4147
|
+
const explicit = findStringInCauseChain(input.error, "terminalSignal") ?? findStringInCauseChain(input.error, "signal");
|
|
4148
|
+
if (explicit) {
|
|
4149
|
+
return explicit;
|
|
3830
4150
|
}
|
|
3831
|
-
return "
|
|
4151
|
+
return outcome === "cancelled" ? "SIGINT" : undefined;
|
|
4152
|
+
}
|
|
4153
|
+
function classifyFailingHttpStatus(status) {
|
|
4154
|
+
return classifyFromErrorCode(classifyHttpStatus(status)?.errorCode) ?? "network_http";
|
|
3832
4155
|
}
|
|
3833
4156
|
function classifyFromResult(result) {
|
|
3834
4157
|
switch (result) {
|
|
@@ -3908,7 +4231,7 @@ function classifyError2(input) {
|
|
|
3908
4231
|
}
|
|
3909
4232
|
const status = recorded?.context?.httpStatus ?? findHttpStatusInGraph(input.error);
|
|
3910
4233
|
if (status !== undefined) {
|
|
3911
|
-
return
|
|
4234
|
+
return classifyFailingHttpStatus(status);
|
|
3912
4235
|
}
|
|
3913
4236
|
return classifyFromResult(recorded?.result) ?? classifyFromErrorCode(recorded?.errorCode) ?? classifyFromError(input.error) ?? "unknown";
|
|
3914
4237
|
}
|
|
@@ -3940,6 +4263,7 @@ function buildCommandTerminalTelemetryProperties(input) {
|
|
|
3940
4263
|
var CommonTelemetryEvents = {
|
|
3941
4264
|
Start: "Application.Start",
|
|
3942
4265
|
Error: "Application.Error",
|
|
4266
|
+
ProjectActivity: "Cli.ProjectActivity",
|
|
3943
4267
|
ShipSucceeded: "Cli.ShipSucceeded"
|
|
3944
4268
|
};
|
|
3945
4269
|
|
|
@@ -4457,87 +4781,21 @@ class TelemetryService {
|
|
|
4457
4781
|
return hex;
|
|
4458
4782
|
}
|
|
4459
4783
|
}
|
|
4460
|
-
// ../common/src/timings.ts
|
|
4461
|
-
var TIMINGS_ENV_VAR = "UIP_TIMINGS";
|
|
4462
|
-
function createStorage2() {
|
|
4463
|
-
const [error, mod] = catchError(() => __require("node:async_hooks"));
|
|
4464
|
-
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
4465
|
-
return {
|
|
4466
|
-
getStore: () => {
|
|
4467
|
-
return;
|
|
4468
|
-
},
|
|
4469
|
-
run: (_store, fn) => fn()
|
|
4470
|
-
};
|
|
4471
|
-
}
|
|
4472
|
-
return new mod.AsyncLocalStorage;
|
|
4473
|
-
}
|
|
4474
|
-
var storageSlot = singleton("TimingStorage");
|
|
4475
|
-
var stateSlot = singleton("Timings");
|
|
4476
|
-
var rootStartedSlot = singleton("TimingsRootStarted");
|
|
4477
|
-
var longLivedHostSlot = singleton("TimingsLongLivedHost");
|
|
4478
|
-
var storage = storageSlot.getOrInit(createStorage2, (value) => ("getStore" in value));
|
|
4479
|
-
function newState(baseline) {
|
|
4480
|
-
return { baseline, httpMs: 0, httpCalls: 0 };
|
|
4481
|
-
}
|
|
4482
|
-
function getState() {
|
|
4483
|
-
const scoped = storage.getStore();
|
|
4484
|
-
if (scoped) {
|
|
4485
|
-
return scoped;
|
|
4486
|
-
}
|
|
4487
|
-
const pinned = livePinnedState();
|
|
4488
|
-
if (pinned !== undefined) {
|
|
4489
|
-
return pinned;
|
|
4490
|
-
}
|
|
4491
|
-
return newState(processStartIsInvocationStart() ? 0 : performance.now());
|
|
4492
|
-
}
|
|
4493
|
-
function livePinnedState() {
|
|
4494
|
-
const pinned = stateSlot.get();
|
|
4495
|
-
return pinned !== undefined && "httpCalls" in pinned && !pinned.finished ? pinned : undefined;
|
|
4496
|
-
}
|
|
4497
|
-
function processStartIsInvocationStart() {
|
|
4498
|
-
return !rootStartedSlot.get(false) && !longLivedHostSlot.get(false);
|
|
4499
|
-
}
|
|
4500
|
-
function timingsEnabled() {
|
|
4501
|
-
if (typeof process === "undefined") {
|
|
4502
|
-
return false;
|
|
4503
|
-
}
|
|
4504
|
-
const value = process.env?.[TIMINGS_ENV_VAR];
|
|
4505
|
-
if (value === undefined) {
|
|
4506
|
-
return false;
|
|
4507
|
-
}
|
|
4508
|
-
const normalized = value.trim().toLowerCase();
|
|
4509
|
-
return normalized === "1" || normalized === "true";
|
|
4510
|
-
}
|
|
4511
|
-
function recordExitCode(exitCode) {
|
|
4512
|
-
if (!timingsEnabled()) {
|
|
4513
|
-
return;
|
|
4514
|
-
}
|
|
4515
|
-
getState().exitCode = exitCode;
|
|
4516
|
-
}
|
|
4517
|
-
function invocationStartedAt() {
|
|
4518
|
-
return new Date(performance.timeOrigin + getState().baseline);
|
|
4519
|
-
}
|
|
4520
|
-
function invocationElapsedMs() {
|
|
4521
|
-
return performance.now() - getState().baseline;
|
|
4522
|
-
}
|
|
4523
|
-
function markCommandStart() {
|
|
4524
|
-
if (!timingsEnabled()) {
|
|
4525
|
-
return;
|
|
4526
|
-
}
|
|
4527
|
-
getState().commandStart = performance.now();
|
|
4528
|
-
}
|
|
4529
|
-
function recordCommandDuration(durationMs) {
|
|
4530
|
-
if (!timingsEnabled()) {
|
|
4531
|
-
return;
|
|
4532
|
-
}
|
|
4533
|
-
getState().commandMs = durationMs;
|
|
4534
|
-
}
|
|
4535
4784
|
// ../common/src/telemetry/proxy-http-agent.ts
|
|
4536
4785
|
var slot = singleton("ProxyAuthHttpsAgent");
|
|
4537
4786
|
|
|
4538
4787
|
// ../common/src/telemetry/node-appinsights-telemetry-provider.ts
|
|
4539
4788
|
var providerSlot = singleton("TelemetryProvider");
|
|
4540
4789
|
|
|
4790
|
+
// ../common/src/telemetry/telemetry-config.ts
|
|
4791
|
+
function isTelemetryDisabled() {
|
|
4792
|
+
const value = process.env.UIPATH_TELEMETRY_DISABLED;
|
|
4793
|
+
return value === "1" || value === "true";
|
|
4794
|
+
}
|
|
4795
|
+
function isProjectTelemetryDisabled() {
|
|
4796
|
+
return isTelemetryDisabled() || process.env.UIPATH_PROJECT_TELEMETRY_DISABLED === "1" || process.env.UIPATH_PROJECT_TELEMETRY_DISABLED === "true";
|
|
4797
|
+
}
|
|
4798
|
+
|
|
4541
4799
|
// ../common/src/telemetry/telemetry-spool.ts
|
|
4542
4800
|
var sidecarEntrySlot = singleton("TelemetrySidecarEntry");
|
|
4543
4801
|
var MAX_SPOOL_AGE_MS = 72 * 60 * 60 * 1000;
|
|
@@ -4573,7 +4831,6 @@ var telemetry = new Proxy({}, {
|
|
|
4573
4831
|
return typeof value === "function" ? value.bind(instance) : value;
|
|
4574
4832
|
}
|
|
4575
4833
|
});
|
|
4576
|
-
|
|
4577
4834
|
// ../common/src/formatter.ts
|
|
4578
4835
|
var ANSI_STYLES = {
|
|
4579
4836
|
red: "\x1B[31m",
|
|
@@ -4583,46 +4840,6 @@ var ANSI_RESET = "\x1B[0m";
|
|
|
4583
4840
|
function styleLine(line, style) {
|
|
4584
4841
|
return style ? `${ANSI_STYLES[style]}${line}${ANSI_RESET}` : line;
|
|
4585
4842
|
}
|
|
4586
|
-
var CLI_ERROR_CODES = [
|
|
4587
|
-
"invalid_argument",
|
|
4588
|
-
"authentication_required",
|
|
4589
|
-
"permission_denied",
|
|
4590
|
-
"local_permission_denied",
|
|
4591
|
-
"not_found",
|
|
4592
|
-
"rate_limited",
|
|
4593
|
-
"network_error",
|
|
4594
|
-
"timeout",
|
|
4595
|
-
"server_error",
|
|
4596
|
-
"method_not_allowed",
|
|
4597
|
-
"not_supported",
|
|
4598
|
-
"configuration_error",
|
|
4599
|
-
"execution_failed",
|
|
4600
|
-
"unknown_error"
|
|
4601
|
-
];
|
|
4602
|
-
var RETRY_HINTS = [
|
|
4603
|
-
"RetryWillNotFix",
|
|
4604
|
-
"RetryLater",
|
|
4605
|
-
"RetryAfter1Second",
|
|
4606
|
-
"RetryAfter10Seconds",
|
|
4607
|
-
"RetryAfter30Seconds",
|
|
4608
|
-
"RetryAfter60Seconds"
|
|
4609
|
-
];
|
|
4610
|
-
var CLI_ERROR_CODE_VALUES = new Set(CLI_ERROR_CODES);
|
|
4611
|
-
var RETRY_HINT_VALUES = new Set(RETRY_HINTS);
|
|
4612
|
-
function isCliErrorCode(value) {
|
|
4613
|
-
return typeof value === "string" && CLI_ERROR_CODE_VALUES.has(value);
|
|
4614
|
-
}
|
|
4615
|
-
function isRetryHint(value) {
|
|
4616
|
-
return typeof value === "string" && RETRY_HINT_VALUES.has(value);
|
|
4617
|
-
}
|
|
4618
|
-
var RESULTS = {
|
|
4619
|
-
Success: "Success",
|
|
4620
|
-
Failure: "Failure",
|
|
4621
|
-
ConfigError: "ConfigError",
|
|
4622
|
-
AuthenticationError: "AuthenticationError",
|
|
4623
|
-
ValidationError: "ValidationError",
|
|
4624
|
-
TimeoutError: "TimeoutError"
|
|
4625
|
-
};
|
|
4626
4843
|
var EXIT_CODES = {
|
|
4627
4844
|
Success: 0,
|
|
4628
4845
|
Failure: 1,
|
|
@@ -4631,6 +4848,9 @@ var EXIT_CODES = {
|
|
|
4631
4848
|
ValidationError: 3,
|
|
4632
4849
|
TimeoutError: 4
|
|
4633
4850
|
};
|
|
4851
|
+
function exitCodeForResult(result) {
|
|
4852
|
+
return EXIT_CODES[result] ?? EXIT_CODES.Failure;
|
|
4853
|
+
}
|
|
4634
4854
|
function escapeNonAscii(jsonText) {
|
|
4635
4855
|
return jsonText.replace(/[\u0080-\uffff]/g, (c) => {
|
|
4636
4856
|
const hex = c.charCodeAt(0).toString(16).padStart(4, "0");
|
|
@@ -5306,8 +5526,8 @@ function carriesOnlyNulls(value) {
|
|
|
5306
5526
|
}
|
|
5307
5527
|
return false;
|
|
5308
5528
|
}
|
|
5309
|
-
function nameList(names,
|
|
5310
|
-
const shown = names.slice(0,
|
|
5529
|
+
function nameList(names, cap = 12) {
|
|
5530
|
+
const shown = names.slice(0, cap).map((n) => `\`${n}\``);
|
|
5311
5531
|
const rest = names.length - shown.length;
|
|
5312
5532
|
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
5313
5533
|
}
|
|
@@ -5444,40 +5664,11 @@ function defaultErrorCodeForResult(result) {
|
|
|
5444
5664
|
return "unknown_error";
|
|
5445
5665
|
}
|
|
5446
5666
|
}
|
|
5447
|
-
function parseHttpStatusFromMessage2(message) {
|
|
5448
|
-
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
5449
|
-
if (!match)
|
|
5450
|
-
return;
|
|
5451
|
-
const status = Number(match[1]);
|
|
5452
|
-
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
5453
|
-
}
|
|
5454
|
-
function defaultErrorCodeForHttpStatus(status) {
|
|
5455
|
-
if (status === undefined)
|
|
5456
|
-
return;
|
|
5457
|
-
if (status === 400 || status === 409 || status === 422) {
|
|
5458
|
-
return "invalid_argument";
|
|
5459
|
-
}
|
|
5460
|
-
if (status === 401)
|
|
5461
|
-
return "authentication_required";
|
|
5462
|
-
if (status === 403)
|
|
5463
|
-
return "permission_denied";
|
|
5464
|
-
if (status === 404)
|
|
5465
|
-
return "not_found";
|
|
5466
|
-
if (status === 405)
|
|
5467
|
-
return "method_not_allowed";
|
|
5468
|
-
if (status === 408)
|
|
5469
|
-
return "timeout";
|
|
5470
|
-
if (status === 429)
|
|
5471
|
-
return "rate_limited";
|
|
5472
|
-
if (status >= 500 && status < 600)
|
|
5473
|
-
return "server_error";
|
|
5474
|
-
return;
|
|
5475
|
-
}
|
|
5476
5667
|
var LOCAL_PERMISSION_TEXT_PATTERN = new RegExp(`(?:\\b|\\()(?:${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})(?::\\s|\\))`);
|
|
5477
5668
|
function defaultErrorCodeForFailure(data) {
|
|
5478
5669
|
if (data.Result === RESULTS.Failure) {
|
|
5479
|
-
const status = data.Context?.httpStatus ??
|
|
5480
|
-
const errorCode =
|
|
5670
|
+
const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage(data.Message);
|
|
5671
|
+
const errorCode = classifyHttpStatus(status)?.errorCode;
|
|
5481
5672
|
if (errorCode)
|
|
5482
5673
|
return errorCode;
|
|
5483
5674
|
if (status === undefined && (LOCAL_PERMISSION_TEXT_PATTERN.test(data.Message) || LOCAL_PERMISSION_TEXT_PATTERN.test(data.Instructions))) {
|
|
@@ -5486,17 +5677,6 @@ function defaultErrorCodeForFailure(data) {
|
|
|
5486
5677
|
}
|
|
5487
5678
|
return defaultErrorCodeForResult(data.Result);
|
|
5488
5679
|
}
|
|
5489
|
-
function defaultRetryForErrorCode(errorCode) {
|
|
5490
|
-
switch (errorCode) {
|
|
5491
|
-
case "network_error":
|
|
5492
|
-
case "rate_limited":
|
|
5493
|
-
case "server_error":
|
|
5494
|
-
case "timeout":
|
|
5495
|
-
return "RetryLater";
|
|
5496
|
-
default:
|
|
5497
|
-
return "RetryWillNotFix";
|
|
5498
|
-
}
|
|
5499
|
-
}
|
|
5500
5680
|
var OutputFormatter;
|
|
5501
5681
|
((OutputFormatter) => {
|
|
5502
5682
|
function success(data, options) {
|
|
@@ -5528,7 +5708,7 @@ var OutputFormatter;
|
|
|
5528
5708
|
data.Log ??= getLogFilePath() || undefined;
|
|
5529
5709
|
data.ErrorCode ??= defaultErrorCodeForFailure(data);
|
|
5530
5710
|
data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
|
|
5531
|
-
const exitCode =
|
|
5711
|
+
const exitCode = exitCodeForResult(data.Result);
|
|
5532
5712
|
setExitCode(exitCode);
|
|
5533
5713
|
recordCommandFailureTelemetry({
|
|
5534
5714
|
result: data.Result,
|
|
@@ -5623,21 +5803,227 @@ var OutputFormatter;
|
|
|
5623
5803
|
OutputFormatter.formatToString = formatToString;
|
|
5624
5804
|
})(OutputFormatter ||= {});
|
|
5625
5805
|
|
|
5626
|
-
//
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5806
|
+
// ../common/src/pass-through-tail.ts
|
|
5807
|
+
function maybeOption(arg) {
|
|
5808
|
+
return arg.length > 1 && arg[0] === "-";
|
|
5809
|
+
}
|
|
5810
|
+
function tokenizeTail(cmd, tail) {
|
|
5811
|
+
const find = (flag) => cmd.options.find((option) => option.long === flag || option.short === flag);
|
|
5812
|
+
const digitShort = cmd.options.some((option) => option.short !== undefined && /^-\d$/.test(option.short));
|
|
5813
|
+
const negativeNumber = (arg) => !digitShort && /^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg);
|
|
5814
|
+
const tokens = [];
|
|
5815
|
+
let firstUnknown = -1;
|
|
5816
|
+
let sentinel = -1;
|
|
5817
|
+
let variadic;
|
|
5818
|
+
let group;
|
|
5819
|
+
let groupIndex = 0;
|
|
5820
|
+
let i = 0;
|
|
5821
|
+
while (i < tail.length || group !== undefined) {
|
|
5822
|
+
const index = group === undefined ? i : groupIndex;
|
|
5823
|
+
const arg = group ?? tail[i++];
|
|
5824
|
+
group = undefined;
|
|
5825
|
+
if (arg === "--") {
|
|
5826
|
+
sentinel = index;
|
|
5827
|
+
tokens.push({ kind: "sentinel", index });
|
|
5828
|
+
for (let j = i;j < tail.length; j++) {
|
|
5829
|
+
tokens.push({
|
|
5830
|
+
kind: "operand",
|
|
5831
|
+
index: j,
|
|
5832
|
+
text: tail[j],
|
|
5833
|
+
literal: true
|
|
5834
|
+
});
|
|
5835
|
+
}
|
|
5836
|
+
break;
|
|
5837
|
+
}
|
|
5838
|
+
if (variadic && (!maybeOption(arg) || negativeNumber(arg))) {
|
|
5839
|
+
tokens.push({
|
|
5840
|
+
kind: "option",
|
|
5841
|
+
index,
|
|
5842
|
+
text: arg,
|
|
5843
|
+
option: variadic,
|
|
5844
|
+
value: arg
|
|
5845
|
+
});
|
|
5846
|
+
continue;
|
|
5847
|
+
}
|
|
5848
|
+
variadic = undefined;
|
|
5849
|
+
if (maybeOption(arg)) {
|
|
5850
|
+
const option = find(arg);
|
|
5851
|
+
if (option) {
|
|
5852
|
+
let value;
|
|
5853
|
+
if (option.required) {
|
|
5854
|
+
value = tail[i];
|
|
5855
|
+
if (value !== undefined)
|
|
5856
|
+
i++;
|
|
5857
|
+
} else if (option.optional) {
|
|
5858
|
+
const next = tail[i];
|
|
5859
|
+
if (next !== undefined && (!maybeOption(next) || negativeNumber(next))) {
|
|
5860
|
+
value = next;
|
|
5861
|
+
i++;
|
|
5862
|
+
}
|
|
5863
|
+
}
|
|
5864
|
+
tokens.push({
|
|
5865
|
+
kind: "option",
|
|
5866
|
+
index,
|
|
5867
|
+
text: arg,
|
|
5868
|
+
option,
|
|
5869
|
+
...value === undefined ? {} : { value }
|
|
5870
|
+
});
|
|
5871
|
+
variadic = option.variadic ? option : undefined;
|
|
5872
|
+
continue;
|
|
5873
|
+
}
|
|
5874
|
+
}
|
|
5875
|
+
if (arg.length > 2 && arg[0] === "-" && arg[1] !== "-") {
|
|
5876
|
+
const option = find(`-${arg[1]}`);
|
|
5877
|
+
if (option) {
|
|
5878
|
+
if (option.required || option.optional) {
|
|
5879
|
+
tokens.push({
|
|
5880
|
+
kind: "option",
|
|
5881
|
+
index,
|
|
5882
|
+
text: arg,
|
|
5883
|
+
option,
|
|
5884
|
+
value: arg.slice(2)
|
|
5885
|
+
});
|
|
5886
|
+
} else {
|
|
5887
|
+
tokens.push({ kind: "option", index, text: arg, option });
|
|
5888
|
+
group = `-${arg.slice(2)}`;
|
|
5889
|
+
groupIndex = index;
|
|
5890
|
+
}
|
|
5891
|
+
continue;
|
|
5892
|
+
}
|
|
5893
|
+
}
|
|
5894
|
+
if (/^--[^=]+=/.test(arg)) {
|
|
5895
|
+
const equals = arg.indexOf("=");
|
|
5896
|
+
const option = find(arg.slice(0, equals));
|
|
5897
|
+
if (option && (option.required || option.optional)) {
|
|
5898
|
+
tokens.push({
|
|
5899
|
+
kind: "option",
|
|
5900
|
+
index,
|
|
5901
|
+
text: arg,
|
|
5902
|
+
option,
|
|
5903
|
+
value: arg.slice(equals + 1)
|
|
5904
|
+
});
|
|
5905
|
+
continue;
|
|
5906
|
+
}
|
|
5907
|
+
}
|
|
5908
|
+
if (maybeOption(arg) && !negativeNumber(arg)) {
|
|
5909
|
+
const equals = arg.startsWith("--") ? arg.indexOf("=") : -1;
|
|
5910
|
+
if (firstUnknown === -1)
|
|
5911
|
+
firstUnknown = index;
|
|
5912
|
+
tokens.push({
|
|
5913
|
+
kind: "unknown",
|
|
5914
|
+
index,
|
|
5915
|
+
text: arg,
|
|
5916
|
+
flag: equals > 0 ? arg.slice(0, equals) : arg,
|
|
5917
|
+
...equals > 0 ? { inlineValue: arg.slice(equals + 1) } : {}
|
|
5918
|
+
});
|
|
5919
|
+
continue;
|
|
5920
|
+
}
|
|
5921
|
+
tokens.push({ kind: "operand", index, text: arg, literal: false });
|
|
5922
|
+
}
|
|
5923
|
+
return { tokens, firstUnknown, sentinel };
|
|
5924
|
+
}
|
|
5925
|
+
|
|
5926
|
+
// ../common/src/project-telemetry.ts
|
|
5927
|
+
var RESOLVER = Symbol.for("@uipath/common/projectTelemetryResolver");
|
|
5928
|
+
var CAPTURE = Symbol.for("@uipath/common/projectTelemetryCapture");
|
|
5929
|
+
var CONTEXT_RESOLVER = Symbol.for("@uipath/common/projectContextTelemetryResolver");
|
|
5930
|
+
var RULES = Symbol.for("@uipath/common/projectTargetRules");
|
|
5931
|
+
function logSkipped(what, error) {
|
|
5932
|
+
logger.debug(`[project-telemetry] ${what} skipped: ${error instanceof Error ? error.message : String(error)}`);
|
|
5933
|
+
}
|
|
5934
|
+
function bounded(work, what) {
|
|
5935
|
+
return withinProjectIdentityBudget(work, () => logSkipped(what, `no answer within ${PROJECT_IDENTITY_LOOKUP_BUDGET_MS} ms`));
|
|
5936
|
+
}
|
|
5937
|
+
async function identityWithContext(command, identity) {
|
|
5938
|
+
const props = projectIdentityProperties(identity);
|
|
5939
|
+
if (!identity.projectDirectory || isProjectTelemetryDisabled())
|
|
5940
|
+
return props;
|
|
5941
|
+
for (let node = command;node; node = node.parent ?? undefined) {
|
|
5942
|
+
const resolver = node[CONTEXT_RESOLVER];
|
|
5943
|
+
if (typeof resolver !== "function")
|
|
5944
|
+
continue;
|
|
5945
|
+
try {
|
|
5946
|
+
return {
|
|
5947
|
+
...await resolver(identity.projectDirectory),
|
|
5948
|
+
...props
|
|
5949
|
+
};
|
|
5950
|
+
} catch (error) {
|
|
5951
|
+
logSkipped("solution context lookup", error);
|
|
5952
|
+
return props;
|
|
5953
|
+
}
|
|
5954
|
+
}
|
|
5955
|
+
return props;
|
|
5956
|
+
}
|
|
5957
|
+
function getProjectTelemetryResolver(command) {
|
|
5958
|
+
for (let node = command;node; node = node.parent) {
|
|
5959
|
+
const resolver = node[RESOLVER];
|
|
5960
|
+
if (typeof resolver === "function")
|
|
5961
|
+
return resolver;
|
|
5962
|
+
}
|
|
5963
|
+
return;
|
|
5964
|
+
}
|
|
5965
|
+
function attachProjectTelemetryCapture(command, capture) {
|
|
5966
|
+
command[CAPTURE] = capture;
|
|
5967
|
+
}
|
|
5968
|
+
class ProjectTelemetrySession {
|
|
5969
|
+
resolver;
|
|
5970
|
+
command;
|
|
5971
|
+
target;
|
|
5972
|
+
props = {};
|
|
5973
|
+
explicit = false;
|
|
5974
|
+
input;
|
|
5975
|
+
constructor(resolver, command) {
|
|
5976
|
+
this.resolver = resolver;
|
|
5977
|
+
this.command = command;
|
|
5978
|
+
}
|
|
5979
|
+
async setTarget(path) {
|
|
5980
|
+
this.target = path;
|
|
5981
|
+
if (this.input) {
|
|
5982
|
+
await this.resolve({
|
|
5983
|
+
...this.input,
|
|
5984
|
+
phase: "after",
|
|
5985
|
+
success: true
|
|
5986
|
+
});
|
|
5987
|
+
this.explicit = true;
|
|
5988
|
+
}
|
|
5989
|
+
}
|
|
5990
|
+
async setIdentity(identity) {
|
|
5991
|
+
try {
|
|
5992
|
+
const props = await bounded(identityWithContext(this.command, identity), "project identity capture");
|
|
5993
|
+
if (props !== undefined)
|
|
5994
|
+
this.setProperties(props);
|
|
5995
|
+
} catch (error) {
|
|
5996
|
+
logSkipped("project identity capture", error);
|
|
5997
|
+
}
|
|
5998
|
+
}
|
|
5999
|
+
setProperties(properties) {
|
|
6000
|
+
try {
|
|
6001
|
+
this.props = { ...properties };
|
|
6002
|
+
this.explicit = true;
|
|
6003
|
+
} catch (error) {
|
|
6004
|
+
logSkipped("project identity properties", error);
|
|
6005
|
+
}
|
|
6006
|
+
}
|
|
6007
|
+
properties() {
|
|
6008
|
+
return { ...this.props };
|
|
6009
|
+
}
|
|
6010
|
+
async resolve(input) {
|
|
6011
|
+
this.input = input;
|
|
6012
|
+
if (this.explicit)
|
|
6013
|
+
return;
|
|
6014
|
+
try {
|
|
6015
|
+
const props = await bounded(this.resolver({
|
|
6016
|
+
...input,
|
|
6017
|
+
target: this.target
|
|
6018
|
+
}), `project identity (${input.phase})`);
|
|
6019
|
+
if (props !== undefined) {
|
|
6020
|
+
this.props = props;
|
|
6021
|
+
}
|
|
6022
|
+
} catch (error) {
|
|
6023
|
+
logSkipped(`project identity (${input.phase})`, error);
|
|
6024
|
+
}
|
|
6025
|
+
}
|
|
6026
|
+
}
|
|
5641
6027
|
|
|
5642
6028
|
// ../common/src/telemetry/command-attribution.ts
|
|
5643
6029
|
var LEGACY_SKILL_NAMESPACE = "uipath:";
|
|
@@ -5883,8 +6269,7 @@ var pollSignalSlot = singleton("PollSignal");
|
|
|
5883
6269
|
var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
|
|
5884
6270
|
var processContext = {
|
|
5885
6271
|
exit: (code) => {
|
|
5886
|
-
|
|
5887
|
-
setExitCode(code);
|
|
6272
|
+
recordCommandExit(code);
|
|
5888
6273
|
},
|
|
5889
6274
|
get pollSignal() {
|
|
5890
6275
|
return pollSignalSlot.get();
|
|
@@ -5909,6 +6294,8 @@ function recordableArgValue(value, choices) {
|
|
|
5909
6294
|
function extractCommandParams(cmd) {
|
|
5910
6295
|
const params = {};
|
|
5911
6296
|
forEachSuppliedArgument(cmd, (name, value, choices, defaulted) => {
|
|
6297
|
+
if (name === undefined)
|
|
6298
|
+
return;
|
|
5912
6299
|
const recordable = recordableArgValue(value, choices);
|
|
5913
6300
|
params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = recordable === TELEMETRY_ARG_VALUE_WITHHELD && defaulted ? TELEMETRY_ARG_VALUE_DEFAULTED : recordable;
|
|
5914
6301
|
});
|
|
@@ -5924,7 +6311,8 @@ function isDefaultedPositional(cmd, index) {
|
|
|
5924
6311
|
function forEachSuppliedArgument(cmd, visit) {
|
|
5925
6312
|
const registered = cmd.registeredArguments ?? [];
|
|
5926
6313
|
const processed = cmd.processedArgs ?? [];
|
|
5927
|
-
|
|
6314
|
+
const bound = boundPositionalCount(cmd);
|
|
6315
|
+
for (let i = 0;i < bound; i++) {
|
|
5928
6316
|
const name = registered[i].name();
|
|
5929
6317
|
if (name && processed[i] !== undefined) {
|
|
5930
6318
|
visit(name, processed[i], registered[i].argChoices, isDefaultedPositional(cmd, i));
|
|
@@ -5939,6 +6327,71 @@ function forEachSuppliedArgument(cmd, visit) {
|
|
|
5939
6327
|
visit(key, value, choicesByAttribute.get(key), isDefaultedOption(cmd, key));
|
|
5940
6328
|
}
|
|
5941
6329
|
}
|
|
6330
|
+
forEachPassThroughToken(cmd, bound, (name, value) => {
|
|
6331
|
+
visit(name, value, name === undefined ? undefined : choicesByAttribute.get(name), false);
|
|
6332
|
+
});
|
|
6333
|
+
}
|
|
6334
|
+
function boundPositionalCount(cmd) {
|
|
6335
|
+
const registered = cmd.registeredArguments ?? [];
|
|
6336
|
+
if (registered.some((argument) => argument.variadic)) {
|
|
6337
|
+
return registered.length;
|
|
6338
|
+
}
|
|
6339
|
+
if ((cmd.args ?? []).length <= registered.length) {
|
|
6340
|
+
return registered.length;
|
|
6341
|
+
}
|
|
6342
|
+
const firstFlag = tokenizeTail(cmd, (cmd.args ?? []).slice(1)).tokens.find((token) => token.kind !== "operand")?.index ?? -1;
|
|
6343
|
+
return firstFlag === -1 ? registered.length : Math.min(registered.length, firstFlag + 1);
|
|
6344
|
+
}
|
|
6345
|
+
function forEachPassThroughToken(cmd, bound, visit) {
|
|
6346
|
+
const registered = cmd.registeredArguments ?? [];
|
|
6347
|
+
const fillsPositionals = !registered.some((argument) => argument.variadic);
|
|
6348
|
+
const { tokens, firstUnknown } = tokenizeTail(cmd, (cmd.args ?? []).slice(bound));
|
|
6349
|
+
const repeated = new Map;
|
|
6350
|
+
let nextPositional = bound;
|
|
6351
|
+
for (const token of tokens) {
|
|
6352
|
+
const pastUnknown = firstUnknown !== -1 && token.index > firstUnknown;
|
|
6353
|
+
if (token.kind === "sentinel")
|
|
6354
|
+
continue;
|
|
6355
|
+
if (token.kind === "operand") {
|
|
6356
|
+
const claimable = !pastUnknown && fillsPositionals && nextPositional < registered.length;
|
|
6357
|
+
const name = claimable ? registered[nextPositional++].name() : undefined;
|
|
6358
|
+
visit(name || undefined, token.text);
|
|
6359
|
+
continue;
|
|
6360
|
+
}
|
|
6361
|
+
if (token.kind === "unknown") {
|
|
6362
|
+
const bare = token.flag.replace(/^-+/, "");
|
|
6363
|
+
const key = bare.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
6364
|
+
const keyable = token.flag.startsWith("--") || token.flag.length === 2;
|
|
6365
|
+
if (!pastUnknown && keyable && /^[a-z][a-z0-9-]*$/i.test(bare) && key) {
|
|
6366
|
+
visit(key, token.inlineValue ?? true);
|
|
6367
|
+
} else {
|
|
6368
|
+
visit(undefined, token.text);
|
|
6369
|
+
if (token.inlineValue !== undefined) {
|
|
6370
|
+
visit(undefined, token.inlineValue);
|
|
6371
|
+
} else if (!token.flag.startsWith("--") && token.flag.length > 2) {
|
|
6372
|
+
visit(undefined, token.flag.slice(2));
|
|
6373
|
+
}
|
|
6374
|
+
}
|
|
6375
|
+
continue;
|
|
6376
|
+
}
|
|
6377
|
+
if (pastUnknown) {
|
|
6378
|
+
visit(undefined, token.text);
|
|
6379
|
+
if (token.value !== undefined)
|
|
6380
|
+
visit(undefined, token.value);
|
|
6381
|
+
continue;
|
|
6382
|
+
}
|
|
6383
|
+
const option = token.option;
|
|
6384
|
+
const name = option.attributeName();
|
|
6385
|
+
const value = option.negate ? false : option.required || option.optional ? token.value ?? true : true;
|
|
6386
|
+
const previous = repeated.get(name);
|
|
6387
|
+
if (previous) {
|
|
6388
|
+
previous.push(value);
|
|
6389
|
+
visit(name, previous);
|
|
6390
|
+
} else {
|
|
6391
|
+
repeated.set(name, [value]);
|
|
6392
|
+
visit(name, value);
|
|
6393
|
+
}
|
|
6394
|
+
}
|
|
5942
6395
|
}
|
|
5943
6396
|
function withheldArgumentValues(cmd) {
|
|
5944
6397
|
const values = [];
|
|
@@ -6000,6 +6453,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6000
6453
|
const telemetryName = commandTelemetryName(commandParts);
|
|
6001
6454
|
const commandPath = commandInvocationPath(commandParts);
|
|
6002
6455
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
6456
|
+
const projectResolver = getProjectTelemetryResolver(command);
|
|
6457
|
+
const projectSession = projectResolver && !isProjectTelemetryDisabled() ? new ProjectTelemetrySession(projectResolver, command) : undefined;
|
|
6003
6458
|
markCommandStart();
|
|
6004
6459
|
const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
|
|
6005
6460
|
try {
|
|
@@ -6012,6 +6467,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6012
6467
|
if (violation) {
|
|
6013
6468
|
return Promise.reject(violation);
|
|
6014
6469
|
}
|
|
6470
|
+
if (projectSession) {
|
|
6471
|
+
return projectSession.resolve({ command, args, phase: "before" }).then(() => {
|
|
6472
|
+
attachProjectTelemetryCapture(command, projectSession);
|
|
6473
|
+
return fn(...args);
|
|
6474
|
+
});
|
|
6475
|
+
}
|
|
6015
6476
|
return fn(...args);
|
|
6016
6477
|
}));
|
|
6017
6478
|
if (error) {
|
|
@@ -6020,22 +6481,26 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6020
6481
|
const typed = error;
|
|
6021
6482
|
const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
|
|
6022
6483
|
const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
|
|
6023
|
-
const
|
|
6484
|
+
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
6485
|
+
const classified = cancellationExitCode === undefined ? await extractErrorDetails(error) : undefined;
|
|
6486
|
+
const finalResult = customResult ?? classified?.result ?? RESULTS.Failure;
|
|
6024
6487
|
const typedErrorCode = typed.errorCode ?? typed.ErrorCode;
|
|
6025
6488
|
const customErrorCode = isCliErrorCode(typedErrorCode) ? typedErrorCode : undefined;
|
|
6026
6489
|
const typedRetry = typed.retry ?? typed.Retry;
|
|
6027
6490
|
const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
|
|
6028
6491
|
const typedContext = typed.context ?? typed.Context;
|
|
6029
6492
|
const customContext = isErrorContext(typedContext) ? typedContext : undefined;
|
|
6030
|
-
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
6031
6493
|
fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
|
|
6494
|
+
const errorCode = customErrorCode ?? classified?.errorCode;
|
|
6495
|
+
const retry = customRetry ?? classified?.retry;
|
|
6496
|
+
const errorContext = customContext ?? classified?.context;
|
|
6032
6497
|
OutputFormatter.error({
|
|
6033
6498
|
Result: finalResult,
|
|
6034
|
-
...
|
|
6499
|
+
...errorCode ? { ErrorCode: errorCode } : {},
|
|
6035
6500
|
Message: errorMessage,
|
|
6036
6501
|
Instructions: customInstructions ?? commandHelpHint(commandPath),
|
|
6037
|
-
...
|
|
6038
|
-
...
|
|
6502
|
+
...retry ? { Retry: retry } : {},
|
|
6503
|
+
...errorContext ? { Context: errorContext } : {}
|
|
6039
6504
|
});
|
|
6040
6505
|
context.exit(fallbackExitCode);
|
|
6041
6506
|
}
|
|
@@ -6044,6 +6509,14 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6044
6509
|
const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
|
|
6045
6510
|
const recordedFailure = takeRecordedCommandFailureTelemetry();
|
|
6046
6511
|
const success = !error && exitCode === 0;
|
|
6512
|
+
if (projectSession) {
|
|
6513
|
+
await projectSession.resolve({
|
|
6514
|
+
command,
|
|
6515
|
+
args,
|
|
6516
|
+
phase: "after",
|
|
6517
|
+
success
|
|
6518
|
+
});
|
|
6519
|
+
}
|
|
6047
6520
|
const terminalTelemetry = buildCommandTerminalTelemetryProperties({
|
|
6048
6521
|
error,
|
|
6049
6522
|
exitCode,
|
|
@@ -6061,6 +6534,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6061
6534
|
}
|
|
6062
6535
|
const baseProperties = redactProperties({
|
|
6063
6536
|
...commandParams,
|
|
6537
|
+
...projectSession?.properties(),
|
|
6064
6538
|
...props,
|
|
6065
6539
|
...buildCommandTelemetryAttribution(commandPath, process.env.UIPATH_SKILL),
|
|
6066
6540
|
...buildAgentSessionTelemetry(process.env),
|
|
@@ -6071,6 +6545,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6071
6545
|
});
|
|
6072
6546
|
emitInvocationRequest(telemetryName, success, baseProperties);
|
|
6073
6547
|
} finally {
|
|
6548
|
+
if (projectSession)
|
|
6549
|
+
attachProjectTelemetryCapture(command, undefined);
|
|
6074
6550
|
releaseSuppliedArgumentValues(supplied);
|
|
6075
6551
|
}
|
|
6076
6552
|
});
|
|
@@ -6085,7 +6561,7 @@ function isGuid(value) {
|
|
|
6085
6561
|
async function classifiedFailure(message, error) {
|
|
6086
6562
|
const details = await extractErrorDetails(error);
|
|
6087
6563
|
return {
|
|
6088
|
-
Result:
|
|
6564
|
+
Result: details.result,
|
|
6089
6565
|
ErrorCode: details.errorCode,
|
|
6090
6566
|
Message: message,
|
|
6091
6567
|
Instructions: details.message,
|
|
@@ -6726,9 +7202,9 @@ function getProfileStorage() {
|
|
|
6726
7202
|
if (isAuthProfileStorage(existing)) {
|
|
6727
7203
|
return existing;
|
|
6728
7204
|
}
|
|
6729
|
-
const
|
|
6730
|
-
globalSlot[AUTH_PROFILE_STORAGE_KEY] =
|
|
6731
|
-
return
|
|
7205
|
+
const storage = createProfileStorage();
|
|
7206
|
+
globalSlot[AUTH_PROFILE_STORAGE_KEY] = storage;
|
|
7207
|
+
return storage;
|
|
6732
7208
|
}
|
|
6733
7209
|
var profileStorage = getProfileStorage();
|
|
6734
7210
|
|
|
@@ -6759,8 +7235,8 @@ function resolveAuthProfileFilePath(profile) {
|
|
|
6759
7235
|
if (normalized === undefined) {
|
|
6760
7236
|
throw new AuthProfileValidationError(`"${DEFAULT_AUTH_PROFILE}" is the built-in profile and does not have a profile file path.`);
|
|
6761
7237
|
}
|
|
6762
|
-
const
|
|
6763
|
-
return
|
|
7238
|
+
const fs = getFileSystem();
|
|
7239
|
+
return fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR, normalized, AUTH_FILENAME);
|
|
6764
7240
|
}
|
|
6765
7241
|
function getActiveAuthProfileFilePath() {
|
|
6766
7242
|
const profile = getActiveAuthProfile();
|
|
@@ -6867,6 +7343,8 @@ var ENV_AUTH_VARS = {
|
|
|
6867
7343
|
};
|
|
6868
7344
|
|
|
6869
7345
|
class EnvAuthConfigError extends Error {
|
|
7346
|
+
errorCode = "configuration_error";
|
|
7347
|
+
retry = "RetryWillNotFix";
|
|
6870
7348
|
constructor(message) {
|
|
6871
7349
|
super(message);
|
|
6872
7350
|
this.name = "EnvAuthConfigError";
|
|
@@ -6905,11 +7383,11 @@ var readAuthFromEnv = () => {
|
|
|
6905
7383
|
if (!rawUrl) {
|
|
6906
7384
|
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}).`);
|
|
6907
7385
|
}
|
|
6908
|
-
const
|
|
7386
|
+
const baseUrl = resolveBaseUrl(rawUrl, `Failed to validate ${OPAQUE_TOKEN_BASE_URL_VAR}`);
|
|
6909
7387
|
return {
|
|
6910
7388
|
loginStatus: "Logged in",
|
|
6911
7389
|
accessToken,
|
|
6912
|
-
baseUrl
|
|
7390
|
+
baseUrl,
|
|
6913
7391
|
organizationName,
|
|
6914
7392
|
organizationId,
|
|
6915
7393
|
tenantName,
|
|
@@ -6950,8 +7428,8 @@ var SURFACE_WINDOW_MS = 60 * 60 * 1000;
|
|
|
6950
7428
|
async function refreshTokenFingerprint(refreshToken) {
|
|
6951
7429
|
const bytes = new TextEncoder().encode(refreshToken);
|
|
6952
7430
|
if (globalThis.crypto?.subtle) {
|
|
6953
|
-
const
|
|
6954
|
-
return Array.from(new Uint8Array(
|
|
7431
|
+
const digest = await globalThis.crypto.subtle.digest("SHA-256", bytes);
|
|
7432
|
+
return Array.from(new Uint8Array(digest), (b) => b.toString(16).padStart(2, "0")).join("").slice(0, 16);
|
|
6955
7433
|
}
|
|
6956
7434
|
const { createHash } = await import("node:crypto");
|
|
6957
7435
|
return createHash("sha256").update(refreshToken).digest("hex").slice(0, 16);
|
|
@@ -6960,9 +7438,9 @@ function breakerPathFor(authPath) {
|
|
|
6960
7438
|
return `${authPath}${BREAKER_SUFFIX}`;
|
|
6961
7439
|
}
|
|
6962
7440
|
async function loadRefreshBreaker(authPath) {
|
|
6963
|
-
const
|
|
7441
|
+
const fs = getFileSystem();
|
|
6964
7442
|
try {
|
|
6965
|
-
const content = await
|
|
7443
|
+
const content = await fs.readFile(breakerPathFor(authPath), "utf-8");
|
|
6966
7444
|
if (!content)
|
|
6967
7445
|
return {};
|
|
6968
7446
|
const parsed = JSON.parse(content);
|
|
@@ -6973,20 +7451,20 @@ async function loadRefreshBreaker(authPath) {
|
|
|
6973
7451
|
}
|
|
6974
7452
|
async function saveRefreshBreaker(authPath, state) {
|
|
6975
7453
|
try {
|
|
6976
|
-
const
|
|
6977
|
-
const
|
|
6978
|
-
await
|
|
6979
|
-
const tempPath = `${
|
|
6980
|
-
await
|
|
6981
|
-
await
|
|
7454
|
+
const fs = getFileSystem();
|
|
7455
|
+
const path = breakerPathFor(authPath);
|
|
7456
|
+
await fs.mkdir(fs.path.dirname(path));
|
|
7457
|
+
const tempPath = `${path}.tmp`;
|
|
7458
|
+
await fs.writeFile(tempPath, JSON.stringify(state));
|
|
7459
|
+
await fs.rename(tempPath, path);
|
|
6982
7460
|
} catch {}
|
|
6983
7461
|
}
|
|
6984
7462
|
async function clearRefreshBreaker(authPath) {
|
|
6985
|
-
const
|
|
6986
|
-
const
|
|
7463
|
+
const fs = getFileSystem();
|
|
7464
|
+
const path = breakerPathFor(authPath);
|
|
6987
7465
|
try {
|
|
6988
|
-
if (await
|
|
6989
|
-
await
|
|
7466
|
+
if (await fs.exists(path)) {
|
|
7467
|
+
await fs.rm(path);
|
|
6990
7468
|
}
|
|
6991
7469
|
} catch {}
|
|
6992
7470
|
}
|
|
@@ -7007,13 +7485,13 @@ var ROBOT_USER_SERVICES_PIPE = "UiPathUserServices";
|
|
|
7007
7485
|
var ROBOT_USER_SERVICES_ALTERNATE_PIPE = `${ROBOT_USER_SERVICES_PIPE}Alternate`;
|
|
7008
7486
|
var PIPE_NAME_MAX_LENGTH = 103;
|
|
7009
7487
|
var getRobotIpcPipeNames = async () => {
|
|
7010
|
-
const
|
|
7011
|
-
const username =
|
|
7488
|
+
const fs = getFileSystem();
|
|
7489
|
+
const username = fs.env.getenv("USER") ?? fs.env.getenv("USERNAME");
|
|
7012
7490
|
if (!username) {
|
|
7013
7491
|
throw new Error("Unable to determine current username");
|
|
7014
7492
|
}
|
|
7015
|
-
const tempPath =
|
|
7016
|
-
return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) =>
|
|
7493
|
+
const tempPath = fs.env.getenv("TMPDIR") ?? "/tmp/";
|
|
7494
|
+
return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) => fs.path.join(tempPath, `${baseName}_${username}`).substring(0, PIPE_NAME_MAX_LENGTH));
|
|
7017
7495
|
};
|
|
7018
7496
|
var defaultIsRobotIpcAvailable = async () => {
|
|
7019
7497
|
if (process.platform === "win32") {
|
|
@@ -7023,20 +7501,20 @@ var defaultIsRobotIpcAvailable = async () => {
|
|
|
7023
7501
|
if (pipeNamesError || !pipeNames) {
|
|
7024
7502
|
return false;
|
|
7025
7503
|
}
|
|
7026
|
-
const
|
|
7504
|
+
const fs = getFileSystem();
|
|
7027
7505
|
for (const pipeName of pipeNames) {
|
|
7028
|
-
const [existsError, exists] = await catchError2(
|
|
7506
|
+
const [existsError, exists] = await catchError2(fs.exists(pipeName));
|
|
7029
7507
|
if (!existsError && exists === true) {
|
|
7030
7508
|
return true;
|
|
7031
7509
|
}
|
|
7032
7510
|
}
|
|
7033
7511
|
return false;
|
|
7034
7512
|
};
|
|
7035
|
-
var withTimeout = (promise, timeoutMs) => new Promise((
|
|
7513
|
+
var withTimeout = (promise, timeoutMs) => new Promise((resolve, reject) => {
|
|
7036
7514
|
const timer = setTimeout(() => reject(new Error(`Robot IPC call timed out after ${timeoutMs}ms`)), timeoutMs);
|
|
7037
7515
|
promise.then((value) => {
|
|
7038
7516
|
clearTimeout(timer);
|
|
7039
|
-
|
|
7517
|
+
resolve(value);
|
|
7040
7518
|
}, (error) => {
|
|
7041
7519
|
clearTimeout(timer);
|
|
7042
7520
|
reject(error);
|
|
@@ -7209,9 +7687,12 @@ var refreshAccessToken = async ({
|
|
|
7209
7687
|
body: tokenParams
|
|
7210
7688
|
});
|
|
7211
7689
|
const tokenData = await tokenResponse.json();
|
|
7212
|
-
if (
|
|
7690
|
+
if (tokenResponse.status === 400 || tokenResponse.status === 401) {
|
|
7213
7691
|
throw new TokenRefreshOAuthError;
|
|
7214
7692
|
}
|
|
7693
|
+
if (!tokenResponse.ok) {
|
|
7694
|
+
throw new Error(`Token refresh failed: HTTP ${tokenResponse.status}`);
|
|
7695
|
+
}
|
|
7215
7696
|
const newAccessToken = tokenData.access_token;
|
|
7216
7697
|
const newRefreshToken = tokenData.refresh_token;
|
|
7217
7698
|
if (typeof newAccessToken !== "string" || typeof newRefreshToken !== "string") {
|
|
@@ -7243,9 +7724,9 @@ var errorCode = (err) => {
|
|
|
7243
7724
|
}
|
|
7244
7725
|
return "EUNKNOWN";
|
|
7245
7726
|
};
|
|
7246
|
-
var probeAsync = async (
|
|
7727
|
+
var probeAsync = async (fs, candidate) => {
|
|
7247
7728
|
try {
|
|
7248
|
-
const stats = await
|
|
7729
|
+
const stats = await fs.stat(candidate);
|
|
7249
7730
|
if (stats === null) {
|
|
7250
7731
|
return { exists: false };
|
|
7251
7732
|
}
|
|
@@ -7272,36 +7753,36 @@ var probeAsync = async (fs2, candidate) => {
|
|
|
7272
7753
|
}
|
|
7273
7754
|
};
|
|
7274
7755
|
var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
|
|
7275
|
-
const
|
|
7276
|
-
if (
|
|
7277
|
-
const
|
|
7278
|
-
return
|
|
7756
|
+
const fs = getFileSystem();
|
|
7757
|
+
if (fs.path.isAbsolute(envFilePath)) {
|
|
7758
|
+
const probe = await probeAsync(fs, envFilePath);
|
|
7759
|
+
return probe.exists ? { exists: true, absolutePath: envFilePath, source: "absolute" } : {
|
|
7279
7760
|
exists: false,
|
|
7280
7761
|
absolutePath: envFilePath,
|
|
7281
7762
|
source: "absolute",
|
|
7282
|
-
...
|
|
7763
|
+
...probe.unusable ? { unusable: probe.unusable } : {}
|
|
7283
7764
|
};
|
|
7284
7765
|
}
|
|
7285
|
-
const cwd = opts?.cwd ??
|
|
7766
|
+
const cwd = opts?.cwd ?? fs.env.cwd();
|
|
7286
7767
|
let searchDir = cwd;
|
|
7287
7768
|
while (true) {
|
|
7288
|
-
const candidate =
|
|
7289
|
-
const
|
|
7290
|
-
if (
|
|
7769
|
+
const candidate = fs.path.join(searchDir, envFilePath);
|
|
7770
|
+
const probe = await probeAsync(fs, candidate);
|
|
7771
|
+
if (probe.exists) {
|
|
7291
7772
|
return {
|
|
7292
7773
|
exists: true,
|
|
7293
7774
|
absolutePath: candidate,
|
|
7294
7775
|
source: searchDir === cwd ? "cwd" : "ancestor"
|
|
7295
7776
|
};
|
|
7296
7777
|
}
|
|
7297
|
-
const parentDir =
|
|
7778
|
+
const parentDir = fs.path.dirname(searchDir);
|
|
7298
7779
|
if (parentDir === searchDir) {
|
|
7299
7780
|
break;
|
|
7300
7781
|
}
|
|
7301
7782
|
searchDir = parentDir;
|
|
7302
7783
|
}
|
|
7303
|
-
const homePath =
|
|
7304
|
-
const probe = await probeAsync(
|
|
7784
|
+
const homePath = fs.path.join(fs.env.homedir(), envFilePath);
|
|
7785
|
+
const probe = await probeAsync(fs, homePath);
|
|
7305
7786
|
if (probe.exists) {
|
|
7306
7787
|
return { exists: true, absolutePath: homePath, source: "home" };
|
|
7307
7788
|
}
|
|
@@ -7344,12 +7825,12 @@ var parseEnvContent = (content) => {
|
|
|
7344
7825
|
return env;
|
|
7345
7826
|
};
|
|
7346
7827
|
var loadEnvFileAsync = async ({ envPath }) => {
|
|
7347
|
-
const
|
|
7348
|
-
const absolutePath =
|
|
7349
|
-
if (!await
|
|
7828
|
+
const fs = getFileSystem();
|
|
7829
|
+
const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.cwd(), envPath);
|
|
7830
|
+
if (!await fs.exists(absolutePath)) {
|
|
7350
7831
|
throw new Error(`Environment file not found: ${envPath}`);
|
|
7351
7832
|
}
|
|
7352
|
-
const content = await
|
|
7833
|
+
const content = await fs.readFile(absolutePath, "utf-8");
|
|
7353
7834
|
if (content === null) {
|
|
7354
7835
|
throw new Error(`Environment file not found: ${envPath}`);
|
|
7355
7836
|
}
|
|
@@ -7360,10 +7841,10 @@ var saveEnvFileAsync = async ({
|
|
|
7360
7841
|
data,
|
|
7361
7842
|
merge = true
|
|
7362
7843
|
}) => {
|
|
7363
|
-
const
|
|
7364
|
-
const absolutePath =
|
|
7844
|
+
const fs = getFileSystem();
|
|
7845
|
+
const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.homedir(), envPath);
|
|
7365
7846
|
let existingData = {};
|
|
7366
|
-
if (merge && await
|
|
7847
|
+
if (merge && await fs.exists(absolutePath)) {
|
|
7367
7848
|
try {
|
|
7368
7849
|
existingData = await loadEnvFileAsync({ envPath: absolutePath });
|
|
7369
7850
|
} catch {}
|
|
@@ -7381,11 +7862,11 @@ var saveEnvFileAsync = async ({
|
|
|
7381
7862
|
const content = `${lines.join(`
|
|
7382
7863
|
`)}
|
|
7383
7864
|
`;
|
|
7384
|
-
const dir =
|
|
7385
|
-
await
|
|
7865
|
+
const dir = fs.path.dirname(absolutePath);
|
|
7866
|
+
await fs.mkdir(dir);
|
|
7386
7867
|
const tempPath = `${absolutePath}.tmp`;
|
|
7387
|
-
await
|
|
7388
|
-
await
|
|
7868
|
+
await fs.writeFile(tempPath, content);
|
|
7869
|
+
await fs.rename(tempPath, absolutePath);
|
|
7389
7870
|
};
|
|
7390
7871
|
|
|
7391
7872
|
// ../auth/src/loginStatus.ts
|
|
@@ -7509,11 +7990,11 @@ async function loadFileCredentials(loadEnvFile, absolutePath) {
|
|
|
7509
7990
|
return { credentials };
|
|
7510
7991
|
}
|
|
7511
7992
|
async function getGlobalCredsHint(getFs, loadEnvFile, absolutePath, envFilePath) {
|
|
7512
|
-
const
|
|
7513
|
-
const globalPath =
|
|
7993
|
+
const fs = getFs();
|
|
7994
|
+
const globalPath = fs.path.join(fs.env.homedir(), envFilePath);
|
|
7514
7995
|
if (absolutePath === globalPath)
|
|
7515
7996
|
return;
|
|
7516
|
-
if (!await
|
|
7997
|
+
if (!await fs.exists(globalPath))
|
|
7517
7998
|
return;
|
|
7518
7999
|
try {
|
|
7519
8000
|
const globalCreds = await loadEnvFile({ envPath: globalPath });
|
|
@@ -7930,26 +8411,38 @@ function errorMessage(error) {
|
|
|
7930
8411
|
}
|
|
7931
8412
|
|
|
7932
8413
|
// ../auth/src/authContext.ts
|
|
8414
|
+
class AuthContextUnavailableError extends Error {
|
|
8415
|
+
instructionContext;
|
|
8416
|
+
sessionHint;
|
|
8417
|
+
errorCode = "authentication_required";
|
|
8418
|
+
retry = "RetryWillNotFix";
|
|
8419
|
+
constructor(message, instructionContext = "auth", sessionHint) {
|
|
8420
|
+
super(message);
|
|
8421
|
+
this.instructionContext = instructionContext;
|
|
8422
|
+
this.sessionHint = sessionHint;
|
|
8423
|
+
this.name = "AuthContextUnavailableError";
|
|
8424
|
+
}
|
|
8425
|
+
}
|
|
7933
8426
|
var getAuthContext = async (options = {}) => {
|
|
7934
8427
|
const status = await getLoginStatusAsync({
|
|
7935
8428
|
ensureTokenValidityMinutes: options.ensureTokenValidityMinutes,
|
|
7936
8429
|
envFilePath: options.envFilePath
|
|
7937
8430
|
});
|
|
7938
8431
|
if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken) {
|
|
7939
|
-
throw new
|
|
8432
|
+
throw new AuthContextUnavailableError(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.", "auth", status.hint);
|
|
7940
8433
|
}
|
|
7941
|
-
const tenantName = options.tenant
|
|
8434
|
+
const tenantName = options.tenant || status.tenantName;
|
|
7942
8435
|
if (options.requireOrganizationId && !status.organizationId) {
|
|
7943
|
-
throw new
|
|
8436
|
+
throw new AuthContextUnavailableError("Organization ID not available. Ensure you are logged in with an organization context.", "identity");
|
|
7944
8437
|
}
|
|
7945
8438
|
if (options.requireOrganizationName && !status.organizationName) {
|
|
7946
|
-
throw new
|
|
8439
|
+
throw new AuthContextUnavailableError("Organization name not available. Ensure you are logged in with an organization context.", "identity");
|
|
7947
8440
|
}
|
|
7948
8441
|
if (options.requireTenantId && !status.tenantId) {
|
|
7949
|
-
throw new
|
|
8442
|
+
throw new AuthContextUnavailableError(`Tenant ID not available. Ensure UIPATH_TENANT_ID is set.${status.hint ? ` ${status.hint}` : ""}`, "identity", status.hint);
|
|
7950
8443
|
}
|
|
7951
|
-
if (options.requireTenantName && tenantName
|
|
7952
|
-
throw new
|
|
8444
|
+
if (options.requireTenantName && !tenantName) {
|
|
8445
|
+
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");
|
|
7953
8446
|
}
|
|
7954
8447
|
return {
|
|
7955
8448
|
baseUrl: status.baseUrl,
|
|
@@ -7968,6 +8461,6 @@ var TENANT_SELECTION_CODES = new Set([
|
|
|
7968
8461
|
TENANT_SELECTION_REQUIRED_CODE,
|
|
7969
8462
|
INVALID_TENANT_CODE
|
|
7970
8463
|
]);
|
|
7971
|
-
export { catchError, extractErrorMessage, extractErrorMessageSync, RESULTS,
|
|
8464
|
+
export { catchError, extractErrorMessage, extractErrorMessageSync, RESULTS, classifiedFailure, Command, Option, logger, OutputFormatter, processContext, isGuid, createHiddenDeprecatedTenantOption, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, resolveSessionIdentity, getAuthContext };
|
|
7972
8465
|
|
|
7973
|
-
//# debugId=
|
|
8466
|
+
//# debugId=DC8DA3AE9647698264756E2164756E21
|