@uipath/api-workflow-tool 1.205.0-preview.276 → 1.206.0-preview.279
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -0
- package/dist/THIRD-PARTY-NOTICES.md +64 -3
- package/dist/applicationinsights-web-8m26566f.js +17209 -0
- package/dist/executor-tool.js +7 -9
- package/dist/index-1wp4j95a.js +10 -0
- package/dist/index-3d09whjq.js +11 -0
- package/dist/{index-waq4trz1.js → index-njewr1c3.js} +5040 -2961
- package/dist/{index-h8cph72k.js → index-nzr4mx5p.js} +2 -22
- package/dist/index.js +14 -15
- package/dist/index.umd.min-ttg1qc0x.js +7814 -0
- package/dist/{jmespath-e4a59c8w.js → jmespath-wwym30dp.js} +1 -1
- package/dist/js-yaml-0c4svjwq.js +36 -0
- package/dist/{node-65zj1szm.js → node-zecqtv6e.js} +13 -90
- package/dist/{packager-tool-bgy9gdsp.js → packager-tool-2ckhrf4j.js} +128 -15
- package/dist/{packager-tool-kh3aq9n7.js → packager-tool-2wwd7kp4.js} +920 -903
- package/dist/{packager-tool-xak3m9vd.js → packager-tool-3hcrfsc1.js} +762 -384
- package/dist/{packager-tool-0aacqssr.js → packager-tool-5b6vjjp3.js} +371 -371
- package/dist/{packager-tool-d3w0wn6k.js → packager-tool-5gce5wfd.js} +16 -16
- package/dist/{packager-tool-f7zta1kg.js → packager-tool-61bdk9sn.js} +203 -156
- package/dist/{packager-tool-1yh8g550.js → packager-tool-6an893wm.js} +12 -3
- package/dist/{packager-tool-1x9mzgbf.js → packager-tool-km68yge6.js} +62 -586
- package/dist/{packager-tool-evd1kzq2.js → packager-tool-qhv22qaj.js} +809 -380
- package/dist/packager-tool-rqprykf5.js +15 -0
- package/dist/{packager-tool-xc4ng9g5.js → packager-tool-w1asrkzg.js} +361 -205
- package/dist/packager-tool.js +6 -6
- package/dist/tool.js +13 -14
- package/package.json +2 -2
- package/dist/index-ptb713hx.js +0 -72
- package/dist/index.umd.min-fqefd9kn.js +0 -7814
- package/dist/js-yaml-69tsdrrf.js +0 -37
|
@@ -1,23 +1,34 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CommandDimensions,
|
|
3
3
|
ErrorDimensions,
|
|
4
|
+
projectIdentityProperties,
|
|
5
|
+
PROJECT_IDENTITY_LOOKUP_BUDGET_MS,
|
|
6
|
+
withinProjectIdentityBudget,
|
|
7
|
+
singleton,
|
|
8
|
+
recordSuppliedArgumentValues,
|
|
9
|
+
releaseSuppliedArgumentValues,
|
|
10
|
+
redactProperties,
|
|
11
|
+
catchError,
|
|
12
|
+
isCliErrorCode,
|
|
13
|
+
isRetryHint,
|
|
14
|
+
defaultRetryForErrorCode,
|
|
15
|
+
walkErrorGraph,
|
|
16
|
+
parseHttpStatusFromMessage,
|
|
17
|
+
findHttpStatusInGraph,
|
|
18
|
+
classifyHttpStatus,
|
|
4
19
|
LOCAL_PERMISSION_ERROR_CODES,
|
|
20
|
+
extractErrorDetails,
|
|
5
21
|
TelemetryService,
|
|
6
|
-
|
|
22
|
+
isProjectTelemetryDisabled,
|
|
7
23
|
buildCommandTelemetryAttribution,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
recordSuppliedArgumentValues,
|
|
11
|
-
redactProperties,
|
|
12
|
-
releaseSuppliedArgumentValues,
|
|
13
|
-
singleton,
|
|
14
|
-
walkErrorGraph
|
|
15
|
-
} from "./packager-tool-evd1kzq2.js";
|
|
24
|
+
buildAgentSessionTelemetry
|
|
25
|
+
} from "./packager-tool-qhv22qaj.js";
|
|
16
26
|
import {
|
|
27
|
+
__toESM,
|
|
17
28
|
__commonJS,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} from "./packager-tool-
|
|
29
|
+
__exportCjs,
|
|
30
|
+
__require
|
|
31
|
+
} from "./packager-tool-6an893wm.js";
|
|
21
32
|
|
|
22
33
|
// ../../node_modules/commander/lib/error.js
|
|
23
34
|
var require_error = __commonJS(function(exports) {
|
|
@@ -139,7 +150,7 @@ var require_help = __commonJS(function(exports) {
|
|
|
139
150
|
this.helpWidth = this.helpWidth ?? contextOptions.helpWidth ?? 80;
|
|
140
151
|
}
|
|
141
152
|
visibleCommands(cmd) {
|
|
142
|
-
const visibleCommands = cmd.commands.filter((
|
|
153
|
+
const visibleCommands = cmd.commands.filter((cmd) => !cmd._hidden);
|
|
143
154
|
const helpCommand = cmd._getHelpCommand();
|
|
144
155
|
if (helpCommand && !helpCommand._hidden) {
|
|
145
156
|
visibleCommands.push(helpCommand);
|
|
@@ -619,8 +630,8 @@ var require_option = __commonJS(function(exports) {
|
|
|
619
630
|
}
|
|
620
631
|
}
|
|
621
632
|
function camelcase(str) {
|
|
622
|
-
return str.split("-").reduce((
|
|
623
|
-
return
|
|
633
|
+
return str.split("-").reduce((str, word) => {
|
|
634
|
+
return str + word[0].toUpperCase() + word.slice(1);
|
|
624
635
|
});
|
|
625
636
|
}
|
|
626
637
|
function splitOptionFlags(flags) {
|
|
@@ -741,8 +752,8 @@ var require_suggestSimilar = __commonJS(function(exports) {
|
|
|
741
752
|
var require_command = __commonJS(function(exports) {
|
|
742
753
|
var EventEmitter = __require("node:events").EventEmitter;
|
|
743
754
|
var childProcess = __require("node:child_process");
|
|
744
|
-
var
|
|
745
|
-
var
|
|
755
|
+
var path = __require("node:path");
|
|
756
|
+
var fs = __require("node:fs");
|
|
746
757
|
var process2 = __require("node:process");
|
|
747
758
|
var { Argument, humanReadableArgName } = require_argument();
|
|
748
759
|
var { CommanderError } = require_error();
|
|
@@ -1191,44 +1202,44 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1191
1202
|
});
|
|
1192
1203
|
return source;
|
|
1193
1204
|
}
|
|
1194
|
-
_prepareUserArgs(
|
|
1195
|
-
if (
|
|
1205
|
+
_prepareUserArgs(argv2, parseOptions) {
|
|
1206
|
+
if (argv2 !== undefined && !Array.isArray(argv2)) {
|
|
1196
1207
|
throw new Error("first parameter to parse must be array or undefined");
|
|
1197
1208
|
}
|
|
1198
1209
|
parseOptions = parseOptions || {};
|
|
1199
|
-
if (
|
|
1210
|
+
if (argv2 === undefined && parseOptions.from === undefined) {
|
|
1200
1211
|
if (process2.versions?.electron) {
|
|
1201
1212
|
parseOptions.from = "electron";
|
|
1202
1213
|
}
|
|
1203
|
-
const
|
|
1204
|
-
if (
|
|
1214
|
+
const execArgv2 = process2.execArgv ?? [];
|
|
1215
|
+
if (execArgv2.includes("-e") || execArgv2.includes("--eval") || execArgv2.includes("-p") || execArgv2.includes("--print")) {
|
|
1205
1216
|
parseOptions.from = "eval";
|
|
1206
1217
|
}
|
|
1207
1218
|
}
|
|
1208
|
-
if (
|
|
1209
|
-
|
|
1219
|
+
if (argv2 === undefined) {
|
|
1220
|
+
argv2 = process2.argv;
|
|
1210
1221
|
}
|
|
1211
|
-
this.rawArgs =
|
|
1222
|
+
this.rawArgs = argv2.slice();
|
|
1212
1223
|
let userArgs;
|
|
1213
1224
|
switch (parseOptions.from) {
|
|
1214
1225
|
case undefined:
|
|
1215
1226
|
case "node":
|
|
1216
|
-
this._scriptPath =
|
|
1217
|
-
userArgs =
|
|
1227
|
+
this._scriptPath = argv2[1];
|
|
1228
|
+
userArgs = argv2.slice(2);
|
|
1218
1229
|
break;
|
|
1219
1230
|
case "electron":
|
|
1220
1231
|
if (process2.defaultApp) {
|
|
1221
|
-
this._scriptPath =
|
|
1222
|
-
userArgs =
|
|
1232
|
+
this._scriptPath = argv2[1];
|
|
1233
|
+
userArgs = argv2.slice(2);
|
|
1223
1234
|
} else {
|
|
1224
|
-
userArgs =
|
|
1235
|
+
userArgs = argv2.slice(1);
|
|
1225
1236
|
}
|
|
1226
1237
|
break;
|
|
1227
1238
|
case "user":
|
|
1228
|
-
userArgs =
|
|
1239
|
+
userArgs = argv2.slice(0);
|
|
1229
1240
|
break;
|
|
1230
1241
|
case "eval":
|
|
1231
|
-
userArgs =
|
|
1242
|
+
userArgs = argv2.slice(1);
|
|
1232
1243
|
break;
|
|
1233
1244
|
default:
|
|
1234
1245
|
throw new Error(`unexpected parse option { from: '${parseOptions.from}' }`);
|
|
@@ -1277,7 +1288,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1277
1288
|
this.processedArgs = [];
|
|
1278
1289
|
}
|
|
1279
1290
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
1280
|
-
if (
|
|
1291
|
+
if (fs.existsSync(executableFile))
|
|
1281
1292
|
return;
|
|
1282
1293
|
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";
|
|
1283
1294
|
const executableMissing = `'${executableFile}' does not exist
|
|
@@ -1291,12 +1302,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1291
1302
|
let launchWithNode = false;
|
|
1292
1303
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1293
1304
|
function findFile(baseDir, baseName) {
|
|
1294
|
-
const localBin =
|
|
1295
|
-
if (
|
|
1305
|
+
const localBin = path.resolve(baseDir, baseName);
|
|
1306
|
+
if (fs.existsSync(localBin))
|
|
1296
1307
|
return localBin;
|
|
1297
|
-
if (sourceExt.includes(
|
|
1308
|
+
if (sourceExt.includes(path.extname(baseName)))
|
|
1298
1309
|
return;
|
|
1299
|
-
const foundExt = sourceExt.find((ext) =>
|
|
1310
|
+
const foundExt = sourceExt.find((ext) => fs.existsSync(`${localBin}${ext}`));
|
|
1300
1311
|
if (foundExt)
|
|
1301
1312
|
return `${localBin}${foundExt}`;
|
|
1302
1313
|
return;
|
|
@@ -1308,23 +1319,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1308
1319
|
if (this._scriptPath) {
|
|
1309
1320
|
let resolvedScriptPath;
|
|
1310
1321
|
try {
|
|
1311
|
-
resolvedScriptPath =
|
|
1322
|
+
resolvedScriptPath = fs.realpathSync(this._scriptPath);
|
|
1312
1323
|
} catch {
|
|
1313
1324
|
resolvedScriptPath = this._scriptPath;
|
|
1314
1325
|
}
|
|
1315
|
-
executableDir =
|
|
1326
|
+
executableDir = path.resolve(path.dirname(resolvedScriptPath), executableDir);
|
|
1316
1327
|
}
|
|
1317
1328
|
if (executableDir) {
|
|
1318
1329
|
let localFile = findFile(executableDir, executableFile);
|
|
1319
1330
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1320
|
-
const legacyName =
|
|
1331
|
+
const legacyName = path.basename(this._scriptPath, path.extname(this._scriptPath));
|
|
1321
1332
|
if (legacyName !== this._name) {
|
|
1322
1333
|
localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
|
|
1323
1334
|
}
|
|
1324
1335
|
}
|
|
1325
1336
|
executableFile = localFile || executableFile;
|
|
1326
1337
|
}
|
|
1327
|
-
launchWithNode = sourceExt.includes(
|
|
1338
|
+
launchWithNode = sourceExt.includes(path.extname(executableFile));
|
|
1328
1339
|
let proc;
|
|
1329
1340
|
if (process2.platform !== "win32") {
|
|
1330
1341
|
if (launchWithNode) {
|
|
@@ -1751,18 +1762,18 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1751
1762
|
this.error(message, { code: "commander.missingMandatoryOptionValue" });
|
|
1752
1763
|
}
|
|
1753
1764
|
_conflictingOption(option, conflictingOption) {
|
|
1754
|
-
const findBestOptionFromValue = (
|
|
1755
|
-
const optionKey =
|
|
1765
|
+
const findBestOptionFromValue = (option) => {
|
|
1766
|
+
const optionKey = option.attributeName();
|
|
1756
1767
|
const optionValue = this.getOptionValue(optionKey);
|
|
1757
1768
|
const negativeOption = this.options.find((target) => target.negate && optionKey === target.attributeName());
|
|
1758
1769
|
const positiveOption = this.options.find((target) => !target.negate && optionKey === target.attributeName());
|
|
1759
1770
|
if (negativeOption && (negativeOption.presetArg === undefined && optionValue === false || negativeOption.presetArg !== undefined && optionValue === negativeOption.presetArg)) {
|
|
1760
1771
|
return negativeOption;
|
|
1761
1772
|
}
|
|
1762
|
-
return positiveOption ||
|
|
1773
|
+
return positiveOption || option;
|
|
1763
1774
|
};
|
|
1764
|
-
const getErrorMessage = (
|
|
1765
|
-
const bestOption = findBestOptionFromValue(
|
|
1775
|
+
const getErrorMessage = (option) => {
|
|
1776
|
+
const bestOption = findBestOptionFromValue(option);
|
|
1766
1777
|
const optionKey = bestOption.attributeName();
|
|
1767
1778
|
const source = this.getOptionValueSource(optionKey);
|
|
1768
1779
|
if (source === "env") {
|
|
@@ -1913,13 +1924,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1913
1924
|
cmd.helpGroup(this._defaultCommandGroup);
|
|
1914
1925
|
}
|
|
1915
1926
|
nameFromFilename(filename) {
|
|
1916
|
-
this._name =
|
|
1927
|
+
this._name = path.basename(filename, path.extname(filename));
|
|
1917
1928
|
return this;
|
|
1918
1929
|
}
|
|
1919
|
-
executableDir(
|
|
1920
|
-
if (
|
|
1930
|
+
executableDir(path) {
|
|
1931
|
+
if (path === undefined)
|
|
1921
1932
|
return this._executableDir;
|
|
1922
|
-
this._executableDir =
|
|
1933
|
+
this._executableDir = path;
|
|
1923
1934
|
return this;
|
|
1924
1935
|
}
|
|
1925
1936
|
helpInformation(contextOptions) {
|
|
@@ -2016,11 +2027,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2016
2027
|
}
|
|
2017
2028
|
help(contextOptions) {
|
|
2018
2029
|
this.outputHelp(contextOptions);
|
|
2019
|
-
let
|
|
2020
|
-
if (
|
|
2021
|
-
|
|
2030
|
+
let exitCode2 = Number(process2.exitCode ?? 0);
|
|
2031
|
+
if (exitCode2 === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
|
|
2032
|
+
exitCode2 = 1;
|
|
2022
2033
|
}
|
|
2023
|
-
this._exit(
|
|
2034
|
+
this._exit(exitCode2, "commander.help", "(outputHelp)");
|
|
2024
2035
|
}
|
|
2025
2036
|
addHelpText(position, text) {
|
|
2026
2037
|
const allowedValues = ["beforeAll", "before", "after", "afterAll"];
|
|
@@ -2093,27 +2104,66 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2093
2104
|
});
|
|
2094
2105
|
|
|
2095
2106
|
// ../../node_modules/commander/index.js
|
|
2096
|
-
var
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2107
|
+
var exports_commander = {};
|
|
2108
|
+
__exportCjs(exports_commander, {
|
|
2109
|
+
program: () => $program,
|
|
2110
|
+
createCommand: () => $createCommand,
|
|
2111
|
+
createOption: () => $createOption,
|
|
2112
|
+
createArgument: () => $createArgument,
|
|
2113
|
+
Command: () => $Command,
|
|
2114
|
+
Option: () => $Option,
|
|
2115
|
+
Argument: () => $Argument,
|
|
2116
|
+
Help: () => $Help,
|
|
2117
|
+
CommanderError: () => $CommanderError,
|
|
2118
|
+
InvalidArgumentError: () => $InvalidArgumentError,
|
|
2119
|
+
InvalidOptionArgumentError: () => $InvalidOptionArgumentError
|
|
2120
|
+
}, {
|
|
2121
|
+
program: (value) => $program = value,
|
|
2122
|
+
createCommand: (value) => $createCommand = value,
|
|
2123
|
+
createOption: (value) => $createOption = value,
|
|
2124
|
+
createArgument: (value) => $createArgument = value,
|
|
2125
|
+
Command: (value) => $Command = value,
|
|
2126
|
+
Option: (value) => $Option = value,
|
|
2127
|
+
Argument: (value) => $Argument = value,
|
|
2128
|
+
Help: (value) => $Help = value,
|
|
2129
|
+
CommanderError: (value) => $CommanderError = value,
|
|
2130
|
+
InvalidArgumentError: (value) => $InvalidArgumentError = value,
|
|
2131
|
+
InvalidOptionArgumentError: (value) => $InvalidOptionArgumentError = value
|
|
2113
2132
|
});
|
|
2133
|
+
var { Argument } = require_argument();
|
|
2134
|
+
var { Command: Command2 } = require_command();
|
|
2135
|
+
var { CommanderError, InvalidArgumentError } = require_error();
|
|
2136
|
+
var { Help } = require_help();
|
|
2137
|
+
var { Option: Option2 } = require_option();
|
|
2138
|
+
var $program = new Command2;
|
|
2139
|
+
var $createCommand = (name) => new Command2(name);
|
|
2140
|
+
var $createOption = (flags, description) => new Option2(flags, description);
|
|
2141
|
+
var $createArgument = (name, description) => new Argument(name, description);
|
|
2142
|
+
var $Command = Command2;
|
|
2143
|
+
var $Option = Option2;
|
|
2144
|
+
var $Argument = Argument;
|
|
2145
|
+
var $Help = Help;
|
|
2146
|
+
var $CommanderError = CommanderError;
|
|
2147
|
+
var $InvalidArgumentError = InvalidArgumentError;
|
|
2148
|
+
var $InvalidOptionArgumentError = InvalidArgumentError;
|
|
2149
|
+
|
|
2150
|
+
// ../../node_modules/commander/esm.mjs
|
|
2151
|
+
var {
|
|
2152
|
+
program,
|
|
2153
|
+
createCommand,
|
|
2154
|
+
createArgument,
|
|
2155
|
+
createOption,
|
|
2156
|
+
CommanderError: CommanderError2,
|
|
2157
|
+
InvalidArgumentError: InvalidArgumentError2,
|
|
2158
|
+
InvalidOptionArgumentError,
|
|
2159
|
+
Command,
|
|
2160
|
+
Argument: Argument2,
|
|
2161
|
+
Option,
|
|
2162
|
+
Help: Help2
|
|
2163
|
+
} = exports_commander;
|
|
2114
2164
|
|
|
2115
2165
|
// ../filesystem/src/node.ts
|
|
2116
|
-
import { randomUUID } from "node:crypto";
|
|
2166
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
2117
2167
|
import { existsSync } from "node:fs";
|
|
2118
2168
|
import * as fs from "node:fs/promises";
|
|
2119
2169
|
import * as os from "node:os";
|
|
@@ -2124,6 +2174,9 @@ var LOCK_MAX_WAIT_MS = 20000;
|
|
|
2124
2174
|
var LOCK_MAX_HOLD_MS = 60000;
|
|
2125
2175
|
var LOCK_RETRY_MIN_MS = 100;
|
|
2126
2176
|
var LOCK_RETRY_JITTER_MS = 200;
|
|
2177
|
+
var HASH_CHUNK_BYTES = 256 * 1024;
|
|
2178
|
+
var hashBuffers = [];
|
|
2179
|
+
var HASH_BUFFERS_KEPT = 64;
|
|
2127
2180
|
|
|
2128
2181
|
class NodeFileSystem {
|
|
2129
2182
|
path = {
|
|
@@ -2142,7 +2195,7 @@ class NodeFileSystem {
|
|
|
2142
2195
|
};
|
|
2143
2196
|
utils = {
|
|
2144
2197
|
open: async (url) => {
|
|
2145
|
-
const { default: open } = await import("./index-
|
|
2198
|
+
const { default: open } = await import("./index-nzr4mx5p.js");
|
|
2146
2199
|
await open(url);
|
|
2147
2200
|
}
|
|
2148
2201
|
};
|
|
@@ -2181,6 +2234,15 @@ class NodeFileSystem {
|
|
|
2181
2234
|
throw error;
|
|
2182
2235
|
}
|
|
2183
2236
|
}
|
|
2237
|
+
async readdirEntries(dirPath) {
|
|
2238
|
+
try {
|
|
2239
|
+
return await fs.readdir(dirPath, { withFileTypes: true });
|
|
2240
|
+
} catch (error) {
|
|
2241
|
+
if (this.isEnoent(error))
|
|
2242
|
+
return [];
|
|
2243
|
+
throw error;
|
|
2244
|
+
}
|
|
2245
|
+
}
|
|
2184
2246
|
async stat(filePath) {
|
|
2185
2247
|
try {
|
|
2186
2248
|
const stats = await fs.stat(filePath);
|
|
@@ -2188,7 +2250,8 @@ class NodeFileSystem {
|
|
|
2188
2250
|
isFile: () => stats.isFile(),
|
|
2189
2251
|
isDirectory: () => stats.isDirectory(),
|
|
2190
2252
|
size: stats.size,
|
|
2191
|
-
mtimeMs: stats.mtimeMs
|
|
2253
|
+
mtimeMs: stats.mtimeMs,
|
|
2254
|
+
ctimeMs: stats.ctimeMs
|
|
2192
2255
|
};
|
|
2193
2256
|
} catch (error) {
|
|
2194
2257
|
if (this.isEnoent(error))
|
|
@@ -2302,6 +2365,42 @@ class NodeFileSystem {
|
|
|
2302
2365
|
throw error;
|
|
2303
2366
|
}
|
|
2304
2367
|
}
|
|
2368
|
+
async hashFile(filePath) {
|
|
2369
|
+
let handle;
|
|
2370
|
+
try {
|
|
2371
|
+
handle = await fs.open(filePath, "r");
|
|
2372
|
+
} catch (error) {
|
|
2373
|
+
if (this.isEnoent(error))
|
|
2374
|
+
return null;
|
|
2375
|
+
throw error;
|
|
2376
|
+
}
|
|
2377
|
+
const buffer = hashBuffers.pop() ?? Buffer.allocUnsafe(HASH_CHUNK_BYTES);
|
|
2378
|
+
try {
|
|
2379
|
+
const opened = await handle.stat();
|
|
2380
|
+
const stats = {
|
|
2381
|
+
isFile: () => opened.isFile(),
|
|
2382
|
+
isDirectory: () => opened.isDirectory(),
|
|
2383
|
+
size: opened.size,
|
|
2384
|
+
mtimeMs: opened.mtimeMs,
|
|
2385
|
+
ctimeMs: opened.ctimeMs
|
|
2386
|
+
};
|
|
2387
|
+
const hash = createHash("sha256");
|
|
2388
|
+
let size = 0;
|
|
2389
|
+
for (;; ) {
|
|
2390
|
+
const { bytesRead } = await handle.read(buffer, 0, buffer.byteLength, null);
|
|
2391
|
+
if (bytesRead === 0)
|
|
2392
|
+
break;
|
|
2393
|
+
hash.update(buffer.subarray(0, bytesRead));
|
|
2394
|
+
size += bytesRead;
|
|
2395
|
+
}
|
|
2396
|
+
return { sha256: hash.digest("hex"), size, stats };
|
|
2397
|
+
} finally {
|
|
2398
|
+
if (hashBuffers.length < HASH_BUFFERS_KEPT) {
|
|
2399
|
+
hashBuffers.push(buffer);
|
|
2400
|
+
}
|
|
2401
|
+
await handle.close();
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2305
2404
|
async realpath(filePath) {
|
|
2306
2405
|
try {
|
|
2307
2406
|
return await fs.realpath(filePath);
|
|
@@ -2351,6 +2450,32 @@ class NodeFileSystem {
|
|
|
2351
2450
|
// ../filesystem/src/index.ts
|
|
2352
2451
|
var fsInstance = new NodeFileSystem;
|
|
2353
2452
|
var getFileSystem = () => fsInstance;
|
|
2453
|
+
// ../common/src/result-types.ts
|
|
2454
|
+
var RESULTS = {
|
|
2455
|
+
Success: "Success",
|
|
2456
|
+
Failure: "Failure",
|
|
2457
|
+
ConfigError: "ConfigError",
|
|
2458
|
+
AuthenticationError: "AuthenticationError",
|
|
2459
|
+
ValidationError: "ValidationError",
|
|
2460
|
+
TimeoutError: "TimeoutError"
|
|
2461
|
+
};
|
|
2462
|
+
// ../common/src/command-examples.ts
|
|
2463
|
+
var examplesByCommand = new WeakMap;
|
|
2464
|
+
Command.prototype.examples = function(examples) {
|
|
2465
|
+
examplesByCommand.set(this, examples);
|
|
2466
|
+
return this;
|
|
2467
|
+
};
|
|
2468
|
+
// ../common/src/preview.ts
|
|
2469
|
+
var previewSlot = singleton("PreviewBuild");
|
|
2470
|
+
function isPreviewBuild() {
|
|
2471
|
+
return previewSlot.get(false) ?? false;
|
|
2472
|
+
}
|
|
2473
|
+
Command.prototype.previewCommand = function(nameAndArgs, opts) {
|
|
2474
|
+
if (isPreviewBuild()) {
|
|
2475
|
+
return this.command(nameAndArgs, opts);
|
|
2476
|
+
}
|
|
2477
|
+
return new Command(nameAndArgs.split(/\s+/)[0] ?? nameAndArgs);
|
|
2478
|
+
};
|
|
2354
2479
|
|
|
2355
2480
|
// ../common/src/output-context.ts
|
|
2356
2481
|
function createStorage() {
|
|
@@ -2385,8 +2510,8 @@ function getOutputSink() {
|
|
|
2385
2510
|
|
|
2386
2511
|
// ../common/src/logger.ts
|
|
2387
2512
|
var logFilePathSlot = singleton("logFilePath");
|
|
2388
|
-
function setGlobalLogFilePath(
|
|
2389
|
-
logFilePathSlot.set(
|
|
2513
|
+
function setGlobalLogFilePath(path) {
|
|
2514
|
+
logFilePathSlot.set(path);
|
|
2390
2515
|
}
|
|
2391
2516
|
function getGlobalLogFilePath() {
|
|
2392
2517
|
return logFilePathSlot.get("");
|
|
@@ -2454,14 +2579,14 @@ class SimpleLogger {
|
|
|
2454
2579
|
return this.fileLoggingEnabled || !!getGlobalLogFilePath();
|
|
2455
2580
|
}
|
|
2456
2581
|
writeToFile(formatted) {
|
|
2457
|
-
const
|
|
2458
|
-
if (!
|
|
2582
|
+
const path = this.logFilePath || getGlobalLogFilePath();
|
|
2583
|
+
if (!path)
|
|
2459
2584
|
return;
|
|
2460
2585
|
const timestamp = new Date().toISOString();
|
|
2461
2586
|
this.pendingWrites = Promise.all([
|
|
2462
2587
|
this.pendingWrites,
|
|
2463
2588
|
this.pendingInit
|
|
2464
|
-
]).then(() => getFileSystem().appendFile(
|
|
2589
|
+
]).then(() => getFileSystem().appendFile(path, `${timestamp} ${formatted}`).catch(() => {}));
|
|
2465
2590
|
}
|
|
2466
2591
|
write(formatted) {
|
|
2467
2592
|
if (this.isFileLoggingActive()) {
|
|
@@ -2511,17 +2636,17 @@ class SimpleLogger {
|
|
|
2511
2636
|
setGlobalLogFilePath("");
|
|
2512
2637
|
}
|
|
2513
2638
|
}
|
|
2514
|
-
setLogFile(
|
|
2515
|
-
this.logFilePath =
|
|
2516
|
-
setGlobalLogFilePath(
|
|
2517
|
-
if (!
|
|
2639
|
+
setLogFile(path) {
|
|
2640
|
+
this.logFilePath = path;
|
|
2641
|
+
setGlobalLogFilePath(path);
|
|
2642
|
+
if (!path)
|
|
2518
2643
|
return;
|
|
2519
2644
|
this.fileLoggingEnabled = true;
|
|
2520
|
-
const
|
|
2645
|
+
const fs = getFileSystem();
|
|
2521
2646
|
this.pendingInit = (async () => {
|
|
2522
2647
|
const [error] = await catchError((async () => {
|
|
2523
|
-
await
|
|
2524
|
-
await
|
|
2648
|
+
await fs.mkdir(fs.path.dirname(path));
|
|
2649
|
+
await fs.writeFile(path, "");
|
|
2525
2650
|
})());
|
|
2526
2651
|
if (error)
|
|
2527
2652
|
this.fileLoggingEnabled = false;
|
|
@@ -2569,43 +2694,6 @@ function getLogFilePath() {
|
|
|
2569
2694
|
return logger.getLogFilePath();
|
|
2570
2695
|
}
|
|
2571
2696
|
|
|
2572
|
-
// ../common/src/telemetry/debug-telemetry-provider.ts
|
|
2573
|
-
class DebugTelemetryProvider {
|
|
2574
|
-
async trackEvent({ name }) {
|
|
2575
|
-
logger.debug(`[Telemetry] Event: ${name}`);
|
|
2576
|
-
}
|
|
2577
|
-
async trackException({ error }) {
|
|
2578
|
-
logger.error(`[Telemetry] Exception: ${error.message}`);
|
|
2579
|
-
}
|
|
2580
|
-
async trackRequest({
|
|
2581
|
-
name,
|
|
2582
|
-
durationMs,
|
|
2583
|
-
success
|
|
2584
|
-
}) {
|
|
2585
|
-
logger.debug(`[Telemetry] Request: ${name} (${durationMs}ms, ${success ? "ok" : "fail"})`);
|
|
2586
|
-
}
|
|
2587
|
-
async trackDependency({
|
|
2588
|
-
name,
|
|
2589
|
-
type,
|
|
2590
|
-
durationMs,
|
|
2591
|
-
success
|
|
2592
|
-
}) {
|
|
2593
|
-
logger.debug(`[Telemetry] Dependency: ${name} [${type}] (${durationMs}ms, ${success ? "ok" : "fail"})`);
|
|
2594
|
-
}
|
|
2595
|
-
}
|
|
2596
|
-
|
|
2597
|
-
// ../common/src/telemetry/node-context-storage.ts
|
|
2598
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2599
|
-
|
|
2600
|
-
class NodeContextStorage {
|
|
2601
|
-
storage = new AsyncLocalStorage;
|
|
2602
|
-
run(context, fn) {
|
|
2603
|
-
return this.storage.run(context, fn);
|
|
2604
|
-
}
|
|
2605
|
-
getContext() {
|
|
2606
|
-
return this.storage.getStore();
|
|
2607
|
-
}
|
|
2608
|
-
}
|
|
2609
2697
|
// ../common/src/timings.ts
|
|
2610
2698
|
var TIMINGS_ENV_VAR = "UIP_TIMINGS";
|
|
2611
2699
|
function createStorage2() {
|
|
@@ -2682,145 +2770,21 @@ function recordCommandDuration(durationMs) {
|
|
|
2682
2770
|
getState().commandMs = durationMs;
|
|
2683
2771
|
}
|
|
2684
2772
|
|
|
2685
|
-
// ../common/src/registry.ts
|
|
2686
|
-
import { execFileSync } from "node:child_process";
|
|
2687
|
-
function readRegistryValue(keyPath, valueName) {
|
|
2688
|
-
if (process.platform !== "win32") {
|
|
2689
|
-
return "";
|
|
2690
|
-
}
|
|
2691
|
-
const [error, output] = catchError(() => execFileSync("reg", ["query", keyPath, "/v", valueName], {
|
|
2692
|
-
encoding: "utf-8",
|
|
2693
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
2694
|
-
windowsHide: true
|
|
2695
|
-
}));
|
|
2696
|
-
if (error) {
|
|
2697
|
-
return "";
|
|
2698
|
-
}
|
|
2699
|
-
const match = output.match(new RegExp(`${valueName}\\s+REG_SZ\\s+(.+)`));
|
|
2700
|
-
return match?.[1]?.trim() ?? "";
|
|
2701
|
-
}
|
|
2702
|
-
|
|
2703
|
-
// ../common/src/telemetry/logger-telemetry-provider.ts
|
|
2704
|
-
class LoggerTelemetryProvider {
|
|
2705
|
-
analyticsUniqueId;
|
|
2706
|
-
constructor() {
|
|
2707
|
-
this.analyticsUniqueId = readRegistryValue("HKCU\\Software\\UiPath", "AnalyticsUniqueId");
|
|
2708
|
-
}
|
|
2709
|
-
enrich(properties) {
|
|
2710
|
-
return {
|
|
2711
|
-
...properties,
|
|
2712
|
-
...this.analyticsUniqueId ? { analyticsUniqueId: this.analyticsUniqueId } : {}
|
|
2713
|
-
};
|
|
2714
|
-
}
|
|
2715
|
-
async trackEvent({ name, properties }) {
|
|
2716
|
-
logger.debug(formatMessage("Event", name, this.enrich(properties)));
|
|
2717
|
-
}
|
|
2718
|
-
async trackException({
|
|
2719
|
-
error,
|
|
2720
|
-
properties
|
|
2721
|
-
}) {
|
|
2722
|
-
logger.error(formatMessage("Exception", error.message, this.enrich({
|
|
2723
|
-
...properties,
|
|
2724
|
-
stack: error.stack
|
|
2725
|
-
})));
|
|
2726
|
-
}
|
|
2727
|
-
async trackRequest({
|
|
2728
|
-
name,
|
|
2729
|
-
durationMs,
|
|
2730
|
-
success,
|
|
2731
|
-
properties
|
|
2732
|
-
}) {
|
|
2733
|
-
logger.debug(formatMessage("Request", name, this.enrich({
|
|
2734
|
-
...properties,
|
|
2735
|
-
duration: `${durationMs}ms`,
|
|
2736
|
-
success
|
|
2737
|
-
})));
|
|
2738
|
-
}
|
|
2739
|
-
async trackDependency({
|
|
2740
|
-
name,
|
|
2741
|
-
type,
|
|
2742
|
-
durationMs,
|
|
2743
|
-
success,
|
|
2744
|
-
properties
|
|
2745
|
-
}) {
|
|
2746
|
-
logger.debug(formatMessage("Dependency", name, this.enrich({
|
|
2747
|
-
...properties,
|
|
2748
|
-
type,
|
|
2749
|
-
duration: `${durationMs}ms`,
|
|
2750
|
-
success
|
|
2751
|
-
})));
|
|
2752
|
-
}
|
|
2753
|
-
}
|
|
2754
|
-
function formatMessage(category, name, properties) {
|
|
2755
|
-
let message = `[Telemetry] [${category}] ${name}`;
|
|
2756
|
-
if (properties && Object.keys(properties).length > 0) {
|
|
2757
|
-
const propsStr = Object.entries(properties).filter(([_, value]) => value !== undefined).map(([key, value]) => `${key}=${value}`).join(", ");
|
|
2758
|
-
if (propsStr) {
|
|
2759
|
-
message += ` | ${propsStr}`;
|
|
2760
|
-
}
|
|
2761
|
-
}
|
|
2762
|
-
return message;
|
|
2763
|
-
}
|
|
2764
|
-
|
|
2765
|
-
// ../common/src/telemetry/proxy-http-agent.ts
|
|
2766
|
-
var slot = singleton("ProxyAuthHttpsAgent");
|
|
2767
|
-
|
|
2768
|
-
// ../common/src/telemetry/node-appinsights-telemetry-provider.ts
|
|
2769
|
-
var providerSlot = singleton("TelemetryProvider");
|
|
2770
|
-
|
|
2771
|
-
// ../common/src/telemetry/telemetry-spool.ts
|
|
2772
|
-
var sidecarEntrySlot = singleton("TelemetrySidecarEntry");
|
|
2773
|
-
var MAX_SPOOL_AGE_MS = 72 * 60 * 60 * 1000;
|
|
2774
|
-
|
|
2775
|
-
// ../common/src/telemetry/telemetry-init.ts
|
|
2776
|
-
var telemetryInstanceSlot = singleton("TelemetryService");
|
|
2777
|
-
var DEFAULT_AI_CONNECTION_STRING = atob("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj");
|
|
2778
|
-
function getGlobalTelemetryInstance() {
|
|
2779
|
-
const existing = telemetryInstanceSlot.get();
|
|
2780
|
-
if (existing && typeof existing === "object" && "trackEvent" in existing && typeof existing.trackEvent === "function") {
|
|
2781
|
-
return existing;
|
|
2782
|
-
}
|
|
2783
|
-
return;
|
|
2784
|
-
}
|
|
2785
|
-
function setGlobalTelemetryInstance(instance) {
|
|
2786
|
-
telemetryInstanceSlot.set(instance);
|
|
2787
|
-
}
|
|
2788
|
-
var _localTelemetryInstance;
|
|
2789
|
-
function getTelemetryInstance() {
|
|
2790
|
-
const global = getGlobalTelemetryInstance();
|
|
2791
|
-
if (global)
|
|
2792
|
-
return global;
|
|
2793
|
-
if (!_localTelemetryInstance) {
|
|
2794
|
-
_localTelemetryInstance = new TelemetryService(new LoggerTelemetryProvider, new NodeContextStorage);
|
|
2795
|
-
setGlobalTelemetryInstance(_localTelemetryInstance);
|
|
2796
|
-
}
|
|
2797
|
-
return _localTelemetryInstance;
|
|
2798
|
-
}
|
|
2799
|
-
var telemetry = new Proxy({}, {
|
|
2800
|
-
get(_, prop) {
|
|
2801
|
-
const instance = getTelemetryInstance();
|
|
2802
|
-
const value = instance[prop];
|
|
2803
|
-
return typeof value === "function" ? value.bind(instance) : value;
|
|
2804
|
-
}
|
|
2805
|
-
});
|
|
2806
|
-
// ../../node_modules/commander/esm.mjs
|
|
2807
|
-
var import__ = __toESM(require_commander(), 1);
|
|
2808
|
-
var {
|
|
2809
|
-
program,
|
|
2810
|
-
createCommand,
|
|
2811
|
-
createArgument,
|
|
2812
|
-
createOption,
|
|
2813
|
-
CommanderError,
|
|
2814
|
-
InvalidArgumentError,
|
|
2815
|
-
InvalidOptionArgumentError,
|
|
2816
|
-
Command,
|
|
2817
|
-
Argument,
|
|
2818
|
-
Option,
|
|
2819
|
-
Help
|
|
2820
|
-
} = import__.default;
|
|
2821
2773
|
// ../common/src/exit-code.ts
|
|
2822
2774
|
function setExitCode(code) {
|
|
2823
2775
|
process.exitCode = code;
|
|
2776
|
+
recordExitCode(code);
|
|
2777
|
+
}
|
|
2778
|
+
var GENERIC_FAILURE_EXIT_CODE = 1;
|
|
2779
|
+
function recordCommandExit(code) {
|
|
2780
|
+
if (code === GENERIC_FAILURE_EXIT_CODE && getExitCode() !== 0) {
|
|
2781
|
+
return;
|
|
2782
|
+
}
|
|
2783
|
+
setExitCode(code);
|
|
2784
|
+
}
|
|
2785
|
+
function getExitCode() {
|
|
2786
|
+
const code = process.exitCode;
|
|
2787
|
+
return typeof code === "number" ? code : 0;
|
|
2824
2788
|
}
|
|
2825
2789
|
|
|
2826
2790
|
// ../common/src/output-codecs.ts
|
|
@@ -2829,12 +2793,12 @@ var jmespathSlot = singleton("JmespathCodec");
|
|
|
2829
2793
|
async function loadOutputCodecsAsync(needed) {
|
|
2830
2794
|
const loads = [];
|
|
2831
2795
|
if (needed.yaml && yamlSlot.get() === undefined) {
|
|
2832
|
-
loads.push(import("./js-yaml-
|
|
2796
|
+
loads.push(import("./js-yaml-0c4svjwq.js").then((mod) => {
|
|
2833
2797
|
yamlSlot.set(mod);
|
|
2834
2798
|
}));
|
|
2835
2799
|
}
|
|
2836
2800
|
if (needed.filter && jmespathSlot.get() === undefined) {
|
|
2837
|
-
loads.push(import("./jmespath-
|
|
2801
|
+
loads.push(import("./jmespath-wwym30dp.js").then((m)=>__toESM(m.default,1)).then((mod) => {
|
|
2838
2802
|
jmespathSlot.set(mod);
|
|
2839
2803
|
}));
|
|
2840
2804
|
}
|
|
@@ -2977,17 +2941,8 @@ function terminalSignalFor(input, outcome) {
|
|
|
2977
2941
|
}
|
|
2978
2942
|
return outcome === "cancelled" ? "SIGINT" : undefined;
|
|
2979
2943
|
}
|
|
2980
|
-
function
|
|
2981
|
-
|
|
2982
|
-
return "auth";
|
|
2983
|
-
}
|
|
2984
|
-
if (status === 400 || status === 409 || status === 422) {
|
|
2985
|
-
return "validation";
|
|
2986
|
-
}
|
|
2987
|
-
if (status === 408) {
|
|
2988
|
-
return "timeout";
|
|
2989
|
-
}
|
|
2990
|
-
return "network_http";
|
|
2944
|
+
function classifyFailingHttpStatus(status) {
|
|
2945
|
+
return classifyFromErrorCode(classifyHttpStatus(status)?.errorCode) ?? "network_http";
|
|
2991
2946
|
}
|
|
2992
2947
|
function classifyFromResult(result) {
|
|
2993
2948
|
switch (result) {
|
|
@@ -3067,7 +3022,7 @@ function classifyError(input) {
|
|
|
3067
3022
|
}
|
|
3068
3023
|
const status = recorded?.context?.httpStatus ?? findHttpStatusInGraph(input.error);
|
|
3069
3024
|
if (status !== undefined) {
|
|
3070
|
-
return
|
|
3025
|
+
return classifyFailingHttpStatus(status);
|
|
3071
3026
|
}
|
|
3072
3027
|
return classifyFromResult(recorded?.result) ?? classifyFromErrorCode(recorded?.errorCode) ?? classifyFromError(input.error) ?? "unknown";
|
|
3073
3028
|
}
|
|
@@ -3099,58 +3054,176 @@ function buildCommandTerminalTelemetryProperties(input) {
|
|
|
3099
3054
|
var CommonTelemetryEvents = {
|
|
3100
3055
|
Start: "Application.Start",
|
|
3101
3056
|
Error: "Application.Error",
|
|
3057
|
+
ProjectActivity: "Cli.ProjectActivity",
|
|
3102
3058
|
ShipSucceeded: "Cli.ShipSucceeded"
|
|
3103
3059
|
};
|
|
3104
3060
|
|
|
3105
|
-
// ../common/src/
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3061
|
+
// ../common/src/registry.ts
|
|
3062
|
+
import { execFileSync } from "node:child_process";
|
|
3063
|
+
function readRegistryValue(keyPath, valueName) {
|
|
3064
|
+
if (process.platform !== "win32") {
|
|
3065
|
+
return "";
|
|
3066
|
+
}
|
|
3067
|
+
const [error, output] = catchError(() => execFileSync("reg", ["query", keyPath, "/v", valueName], {
|
|
3068
|
+
encoding: "utf-8",
|
|
3069
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
3070
|
+
windowsHide: true
|
|
3071
|
+
}));
|
|
3072
|
+
if (error) {
|
|
3073
|
+
return "";
|
|
3074
|
+
}
|
|
3075
|
+
const match = output.match(new RegExp(`${valueName}\\s+REG_SZ\\s+(.+)`));
|
|
3076
|
+
return match?.[1]?.trim() ?? "";
|
|
3077
|
+
}
|
|
3078
|
+
|
|
3079
|
+
// ../common/src/telemetry/logger-telemetry-provider.ts
|
|
3080
|
+
class LoggerTelemetryProvider {
|
|
3081
|
+
analyticsUniqueId;
|
|
3082
|
+
constructor() {
|
|
3083
|
+
this.analyticsUniqueId = readRegistryValue("HKCU\\Software\\UiPath", "AnalyticsUniqueId");
|
|
3084
|
+
}
|
|
3085
|
+
enrich(properties) {
|
|
3086
|
+
return {
|
|
3087
|
+
...properties,
|
|
3088
|
+
...this.analyticsUniqueId ? { analyticsUniqueId: this.analyticsUniqueId } : {}
|
|
3089
|
+
};
|
|
3090
|
+
}
|
|
3091
|
+
async trackEvent({ name, properties }) {
|
|
3092
|
+
logger.debug(formatMessage("Event", name, this.enrich(properties)));
|
|
3093
|
+
}
|
|
3094
|
+
async trackException({
|
|
3095
|
+
error,
|
|
3096
|
+
properties
|
|
3097
|
+
}) {
|
|
3098
|
+
logger.error(formatMessage("Exception", error.message, this.enrich({
|
|
3099
|
+
...properties,
|
|
3100
|
+
stack: error.stack
|
|
3101
|
+
})));
|
|
3102
|
+
}
|
|
3103
|
+
async trackRequest({
|
|
3104
|
+
name,
|
|
3105
|
+
durationMs,
|
|
3106
|
+
success,
|
|
3107
|
+
properties
|
|
3108
|
+
}) {
|
|
3109
|
+
logger.debug(formatMessage("Request", name, this.enrich({
|
|
3110
|
+
...properties,
|
|
3111
|
+
duration: `${durationMs}ms`,
|
|
3112
|
+
success
|
|
3113
|
+
})));
|
|
3114
|
+
}
|
|
3115
|
+
async trackDependency({
|
|
3116
|
+
name,
|
|
3117
|
+
type,
|
|
3118
|
+
durationMs,
|
|
3119
|
+
success,
|
|
3120
|
+
properties
|
|
3121
|
+
}) {
|
|
3122
|
+
logger.debug(formatMessage("Dependency", name, this.enrich({
|
|
3123
|
+
...properties,
|
|
3124
|
+
type,
|
|
3125
|
+
duration: `${durationMs}ms`,
|
|
3126
|
+
success
|
|
3127
|
+
})));
|
|
3128
|
+
}
|
|
3129
|
+
}
|
|
3130
|
+
function formatMessage(category, name, properties) {
|
|
3131
|
+
let message = `[Telemetry] [${category}] ${name}`;
|
|
3132
|
+
if (properties && Object.keys(properties).length > 0) {
|
|
3133
|
+
const propsStr = Object.entries(properties).filter(([_, value]) => value !== undefined).map(([key, value]) => `${key}=${value}`).join(", ");
|
|
3134
|
+
if (propsStr) {
|
|
3135
|
+
message += ` | ${propsStr}`;
|
|
3136
|
+
}
|
|
3137
|
+
}
|
|
3138
|
+
return message;
|
|
3139
|
+
}
|
|
3140
|
+
|
|
3141
|
+
// ../common/src/telemetry/debug-telemetry-provider.ts
|
|
3142
|
+
class DebugTelemetryProvider {
|
|
3143
|
+
async trackEvent({ name }) {
|
|
3144
|
+
logger.debug(`[Telemetry] Event: ${name}`);
|
|
3145
|
+
}
|
|
3146
|
+
async trackException({ error }) {
|
|
3147
|
+
logger.error(`[Telemetry] Exception: ${error.message}`);
|
|
3148
|
+
}
|
|
3149
|
+
async trackRequest({
|
|
3150
|
+
name,
|
|
3151
|
+
durationMs,
|
|
3152
|
+
success
|
|
3153
|
+
}) {
|
|
3154
|
+
logger.debug(`[Telemetry] Request: ${name} (${durationMs}ms, ${success ? "ok" : "fail"})`);
|
|
3155
|
+
}
|
|
3156
|
+
async trackDependency({
|
|
3157
|
+
name,
|
|
3158
|
+
type,
|
|
3159
|
+
durationMs,
|
|
3160
|
+
success
|
|
3161
|
+
}) {
|
|
3162
|
+
logger.debug(`[Telemetry] Dependency: ${name} [${type}] (${durationMs}ms, ${success ? "ok" : "fail"})`);
|
|
3163
|
+
}
|
|
3164
|
+
}
|
|
3165
|
+
// ../common/src/telemetry/node-context-storage.ts
|
|
3166
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3167
|
+
|
|
3168
|
+
class NodeContextStorage {
|
|
3169
|
+
storage = new AsyncLocalStorage;
|
|
3170
|
+
run(context, fn) {
|
|
3171
|
+
return this.storage.run(context, fn);
|
|
3172
|
+
}
|
|
3173
|
+
getContext() {
|
|
3174
|
+
return this.storage.getStore();
|
|
3175
|
+
}
|
|
3176
|
+
}
|
|
3177
|
+
// ../common/src/telemetry/proxy-http-agent.ts
|
|
3178
|
+
var slot = singleton("ProxyAuthHttpsAgent");
|
|
3179
|
+
|
|
3180
|
+
// ../common/src/telemetry/node-appinsights-telemetry-provider.ts
|
|
3181
|
+
var providerSlot = singleton("TelemetryProvider");
|
|
3182
|
+
|
|
3183
|
+
// ../common/src/telemetry/telemetry-spool.ts
|
|
3184
|
+
var sidecarEntrySlot = singleton("TelemetrySidecarEntry");
|
|
3185
|
+
var MAX_SPOOL_AGE_MS = 72 * 60 * 60 * 1000;
|
|
3186
|
+
|
|
3187
|
+
// ../common/src/telemetry/telemetry-init.ts
|
|
3188
|
+
var telemetryInstanceSlot = singleton("TelemetryService");
|
|
3189
|
+
var DEFAULT_AI_CONNECTION_STRING = atob("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj");
|
|
3190
|
+
function getGlobalTelemetryInstance() {
|
|
3191
|
+
const existing = telemetryInstanceSlot.get();
|
|
3192
|
+
if (existing && typeof existing === "object" && "trackEvent" in existing && typeof existing.trackEvent === "function") {
|
|
3193
|
+
return existing;
|
|
3194
|
+
}
|
|
3195
|
+
return;
|
|
3196
|
+
}
|
|
3197
|
+
function setGlobalTelemetryInstance(instance) {
|
|
3198
|
+
telemetryInstanceSlot.set(instance);
|
|
3199
|
+
}
|
|
3200
|
+
var _localTelemetryInstance;
|
|
3201
|
+
function getTelemetryInstance() {
|
|
3202
|
+
const global = getGlobalTelemetryInstance();
|
|
3203
|
+
if (global)
|
|
3204
|
+
return global;
|
|
3205
|
+
if (!_localTelemetryInstance) {
|
|
3206
|
+
_localTelemetryInstance = new TelemetryService(new LoggerTelemetryProvider, new NodeContextStorage);
|
|
3207
|
+
setGlobalTelemetryInstance(_localTelemetryInstance);
|
|
3208
|
+
}
|
|
3209
|
+
return _localTelemetryInstance;
|
|
3210
|
+
}
|
|
3211
|
+
var telemetry = new Proxy({}, {
|
|
3212
|
+
get(_, prop) {
|
|
3213
|
+
const instance = getTelemetryInstance();
|
|
3214
|
+
const value = instance[prop];
|
|
3215
|
+
return typeof value === "function" ? value.bind(instance) : value;
|
|
3216
|
+
}
|
|
3217
|
+
});
|
|
3218
|
+
// ../common/src/formatter.ts
|
|
3219
|
+
var ANSI_STYLES = {
|
|
3220
|
+
red: "\x1B[31m",
|
|
3221
|
+
dim: "\x1B[2m"
|
|
3109
3222
|
};
|
|
3110
3223
|
var ANSI_RESET = "\x1B[0m";
|
|
3111
3224
|
function styleLine(line, style) {
|
|
3112
3225
|
return style ? `${ANSI_STYLES[style]}${line}${ANSI_RESET}` : line;
|
|
3113
3226
|
}
|
|
3114
|
-
var CLI_ERROR_CODES = [
|
|
3115
|
-
"invalid_argument",
|
|
3116
|
-
"authentication_required",
|
|
3117
|
-
"permission_denied",
|
|
3118
|
-
"local_permission_denied",
|
|
3119
|
-
"not_found",
|
|
3120
|
-
"rate_limited",
|
|
3121
|
-
"network_error",
|
|
3122
|
-
"timeout",
|
|
3123
|
-
"server_error",
|
|
3124
|
-
"method_not_allowed",
|
|
3125
|
-
"not_supported",
|
|
3126
|
-
"configuration_error",
|
|
3127
|
-
"execution_failed",
|
|
3128
|
-
"unknown_error"
|
|
3129
|
-
];
|
|
3130
|
-
var RETRY_HINTS = [
|
|
3131
|
-
"RetryWillNotFix",
|
|
3132
|
-
"RetryLater",
|
|
3133
|
-
"RetryAfter1Second",
|
|
3134
|
-
"RetryAfter10Seconds",
|
|
3135
|
-
"RetryAfter30Seconds",
|
|
3136
|
-
"RetryAfter60Seconds"
|
|
3137
|
-
];
|
|
3138
|
-
var CLI_ERROR_CODE_VALUES = new Set(CLI_ERROR_CODES);
|
|
3139
|
-
var RETRY_HINT_VALUES = new Set(RETRY_HINTS);
|
|
3140
|
-
function isCliErrorCode(value) {
|
|
3141
|
-
return typeof value === "string" && CLI_ERROR_CODE_VALUES.has(value);
|
|
3142
|
-
}
|
|
3143
|
-
function isRetryHint(value) {
|
|
3144
|
-
return typeof value === "string" && RETRY_HINT_VALUES.has(value);
|
|
3145
|
-
}
|
|
3146
|
-
var RESULTS = {
|
|
3147
|
-
Success: "Success",
|
|
3148
|
-
Failure: "Failure",
|
|
3149
|
-
ConfigError: "ConfigError",
|
|
3150
|
-
AuthenticationError: "AuthenticationError",
|
|
3151
|
-
ValidationError: "ValidationError",
|
|
3152
|
-
TimeoutError: "TimeoutError"
|
|
3153
|
-
};
|
|
3154
3227
|
var EXIT_CODES = {
|
|
3155
3228
|
Success: 0,
|
|
3156
3229
|
Failure: 1,
|
|
@@ -3159,6 +3232,9 @@ var EXIT_CODES = {
|
|
|
3159
3232
|
ValidationError: 3,
|
|
3160
3233
|
TimeoutError: 4
|
|
3161
3234
|
};
|
|
3235
|
+
function exitCodeForResult(result) {
|
|
3236
|
+
return EXIT_CODES[result] ?? EXIT_CODES.Failure;
|
|
3237
|
+
}
|
|
3162
3238
|
class SuccessOutput {
|
|
3163
3239
|
Result = RESULTS.Success;
|
|
3164
3240
|
Code;
|
|
@@ -4023,40 +4099,11 @@ function defaultErrorCodeForResult(result) {
|
|
|
4023
4099
|
return "unknown_error";
|
|
4024
4100
|
}
|
|
4025
4101
|
}
|
|
4026
|
-
function parseHttpStatusFromMessage(message) {
|
|
4027
|
-
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
4028
|
-
if (!match)
|
|
4029
|
-
return;
|
|
4030
|
-
const status = Number(match[1]);
|
|
4031
|
-
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
4032
|
-
}
|
|
4033
|
-
function defaultErrorCodeForHttpStatus(status) {
|
|
4034
|
-
if (status === undefined)
|
|
4035
|
-
return;
|
|
4036
|
-
if (status === 400 || status === 409 || status === 422) {
|
|
4037
|
-
return "invalid_argument";
|
|
4038
|
-
}
|
|
4039
|
-
if (status === 401)
|
|
4040
|
-
return "authentication_required";
|
|
4041
|
-
if (status === 403)
|
|
4042
|
-
return "permission_denied";
|
|
4043
|
-
if (status === 404)
|
|
4044
|
-
return "not_found";
|
|
4045
|
-
if (status === 405)
|
|
4046
|
-
return "method_not_allowed";
|
|
4047
|
-
if (status === 408)
|
|
4048
|
-
return "timeout";
|
|
4049
|
-
if (status === 429)
|
|
4050
|
-
return "rate_limited";
|
|
4051
|
-
if (status >= 500 && status < 600)
|
|
4052
|
-
return "server_error";
|
|
4053
|
-
return;
|
|
4054
|
-
}
|
|
4055
4102
|
var LOCAL_PERMISSION_TEXT_PATTERN = new RegExp(`(?:\\b|\\()(?:${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})(?::\\s|\\))`);
|
|
4056
4103
|
function defaultErrorCodeForFailure(data) {
|
|
4057
4104
|
if (data.Result === RESULTS.Failure) {
|
|
4058
4105
|
const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage(data.Message);
|
|
4059
|
-
const errorCode =
|
|
4106
|
+
const errorCode = classifyHttpStatus(status)?.errorCode;
|
|
4060
4107
|
if (errorCode)
|
|
4061
4108
|
return errorCode;
|
|
4062
4109
|
if (status === undefined && (LOCAL_PERMISSION_TEXT_PATTERN.test(data.Message) || LOCAL_PERMISSION_TEXT_PATTERN.test(data.Instructions))) {
|
|
@@ -4065,17 +4112,6 @@ function defaultErrorCodeForFailure(data) {
|
|
|
4065
4112
|
}
|
|
4066
4113
|
return defaultErrorCodeForResult(data.Result);
|
|
4067
4114
|
}
|
|
4068
|
-
function defaultRetryForErrorCode(errorCode) {
|
|
4069
|
-
switch (errorCode) {
|
|
4070
|
-
case "network_error":
|
|
4071
|
-
case "rate_limited":
|
|
4072
|
-
case "server_error":
|
|
4073
|
-
case "timeout":
|
|
4074
|
-
return "RetryLater";
|
|
4075
|
-
default:
|
|
4076
|
-
return "RetryWillNotFix";
|
|
4077
|
-
}
|
|
4078
|
-
}
|
|
4079
4115
|
var OutputFormatter;
|
|
4080
4116
|
((OutputFormatter) => {
|
|
4081
4117
|
function success(data, options) {
|
|
@@ -4107,7 +4143,7 @@ var OutputFormatter;
|
|
|
4107
4143
|
data.Log ??= getLogFilePath() || undefined;
|
|
4108
4144
|
data.ErrorCode ??= defaultErrorCodeForFailure(data);
|
|
4109
4145
|
data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
|
|
4110
|
-
const exitCode =
|
|
4146
|
+
const exitCode = exitCodeForResult(data.Result);
|
|
4111
4147
|
setExitCode(exitCode);
|
|
4112
4148
|
recordCommandFailureTelemetry({
|
|
4113
4149
|
result: data.Result,
|
|
@@ -4201,23 +4237,275 @@ var OutputFormatter;
|
|
|
4201
4237
|
}
|
|
4202
4238
|
OutputFormatter.formatToString = formatToString;
|
|
4203
4239
|
})(OutputFormatter ||= {});
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4240
|
+
|
|
4241
|
+
// ../common/src/pass-through-tail.ts
|
|
4242
|
+
function maybeOption(arg) {
|
|
4243
|
+
return arg.length > 1 && arg[0] === "-";
|
|
4244
|
+
}
|
|
4245
|
+
function tokenizeTail(cmd, tail) {
|
|
4246
|
+
const find = (flag) => cmd.options.find((option) => option.long === flag || option.short === flag);
|
|
4247
|
+
const digitShort = cmd.options.some((option) => option.short !== undefined && /^-\d$/.test(option.short));
|
|
4248
|
+
const negativeNumber = (arg) => !digitShort && /^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg);
|
|
4249
|
+
const tokens = [];
|
|
4250
|
+
let firstUnknown = -1;
|
|
4251
|
+
let sentinel = -1;
|
|
4252
|
+
let variadic;
|
|
4253
|
+
let group;
|
|
4254
|
+
let groupIndex = 0;
|
|
4255
|
+
let i = 0;
|
|
4256
|
+
while (i < tail.length || group !== undefined) {
|
|
4257
|
+
const index = group === undefined ? i : groupIndex;
|
|
4258
|
+
const arg = group ?? tail[i++];
|
|
4259
|
+
group = undefined;
|
|
4260
|
+
if (arg === "--") {
|
|
4261
|
+
sentinel = index;
|
|
4262
|
+
tokens.push({ kind: "sentinel", index });
|
|
4263
|
+
for (let j = i;j < tail.length; j++) {
|
|
4264
|
+
tokens.push({
|
|
4265
|
+
kind: "operand",
|
|
4266
|
+
index: j,
|
|
4267
|
+
text: tail[j],
|
|
4268
|
+
literal: true
|
|
4269
|
+
});
|
|
4270
|
+
}
|
|
4271
|
+
break;
|
|
4272
|
+
}
|
|
4273
|
+
if (variadic && (!maybeOption(arg) || negativeNumber(arg))) {
|
|
4274
|
+
tokens.push({
|
|
4275
|
+
kind: "option",
|
|
4276
|
+
index,
|
|
4277
|
+
text: arg,
|
|
4278
|
+
option: variadic,
|
|
4279
|
+
value: arg
|
|
4280
|
+
});
|
|
4281
|
+
continue;
|
|
4282
|
+
}
|
|
4283
|
+
variadic = undefined;
|
|
4284
|
+
if (maybeOption(arg)) {
|
|
4285
|
+
const option = find(arg);
|
|
4286
|
+
if (option) {
|
|
4287
|
+
let value;
|
|
4288
|
+
if (option.required) {
|
|
4289
|
+
value = tail[i];
|
|
4290
|
+
if (value !== undefined)
|
|
4291
|
+
i++;
|
|
4292
|
+
} else if (option.optional) {
|
|
4293
|
+
const next = tail[i];
|
|
4294
|
+
if (next !== undefined && (!maybeOption(next) || negativeNumber(next))) {
|
|
4295
|
+
value = next;
|
|
4296
|
+
i++;
|
|
4297
|
+
}
|
|
4298
|
+
}
|
|
4299
|
+
tokens.push({
|
|
4300
|
+
kind: "option",
|
|
4301
|
+
index,
|
|
4302
|
+
text: arg,
|
|
4303
|
+
option,
|
|
4304
|
+
...value === undefined ? {} : { value }
|
|
4305
|
+
});
|
|
4306
|
+
variadic = option.variadic ? option : undefined;
|
|
4307
|
+
continue;
|
|
4308
|
+
}
|
|
4309
|
+
}
|
|
4310
|
+
if (arg.length > 2 && arg[0] === "-" && arg[1] !== "-") {
|
|
4311
|
+
const option = find(`-${arg[1]}`);
|
|
4312
|
+
if (option) {
|
|
4313
|
+
if (option.required || option.optional) {
|
|
4314
|
+
tokens.push({
|
|
4315
|
+
kind: "option",
|
|
4316
|
+
index,
|
|
4317
|
+
text: arg,
|
|
4318
|
+
option,
|
|
4319
|
+
value: arg.slice(2)
|
|
4320
|
+
});
|
|
4321
|
+
} else {
|
|
4322
|
+
tokens.push({ kind: "option", index, text: arg, option });
|
|
4323
|
+
group = `-${arg.slice(2)}`;
|
|
4324
|
+
groupIndex = index;
|
|
4325
|
+
}
|
|
4326
|
+
continue;
|
|
4327
|
+
}
|
|
4328
|
+
}
|
|
4329
|
+
if (/^--[^=]+=/.test(arg)) {
|
|
4330
|
+
const equals = arg.indexOf("=");
|
|
4331
|
+
const option = find(arg.slice(0, equals));
|
|
4332
|
+
if (option && (option.required || option.optional)) {
|
|
4333
|
+
tokens.push({
|
|
4334
|
+
kind: "option",
|
|
4335
|
+
index,
|
|
4336
|
+
text: arg,
|
|
4337
|
+
option,
|
|
4338
|
+
value: arg.slice(equals + 1)
|
|
4339
|
+
});
|
|
4340
|
+
continue;
|
|
4341
|
+
}
|
|
4342
|
+
}
|
|
4343
|
+
if (maybeOption(arg) && !negativeNumber(arg)) {
|
|
4344
|
+
const equals = arg.startsWith("--") ? arg.indexOf("=") : -1;
|
|
4345
|
+
if (firstUnknown === -1)
|
|
4346
|
+
firstUnknown = index;
|
|
4347
|
+
tokens.push({
|
|
4348
|
+
kind: "unknown",
|
|
4349
|
+
index,
|
|
4350
|
+
text: arg,
|
|
4351
|
+
flag: equals > 0 ? arg.slice(0, equals) : arg,
|
|
4352
|
+
...equals > 0 ? { inlineValue: arg.slice(equals + 1) } : {}
|
|
4353
|
+
});
|
|
4354
|
+
continue;
|
|
4355
|
+
}
|
|
4356
|
+
tokens.push({ kind: "operand", index, text: arg, literal: false });
|
|
4357
|
+
}
|
|
4358
|
+
return { tokens, firstUnknown, sentinel };
|
|
4214
4359
|
}
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4360
|
+
|
|
4361
|
+
// ../common/src/project-telemetry.ts
|
|
4362
|
+
var RESOLVER = Symbol.for("@uipath/common/projectTelemetryResolver");
|
|
4363
|
+
var CAPTURE = Symbol.for("@uipath/common/projectTelemetryCapture");
|
|
4364
|
+
var CONTEXT_RESOLVER = Symbol.for("@uipath/common/projectContextTelemetryResolver");
|
|
4365
|
+
var RULES = Symbol.for("@uipath/common/projectTargetRules");
|
|
4366
|
+
function logSkipped(what, error) {
|
|
4367
|
+
logger.debug(`[project-telemetry] ${what} skipped: ${error instanceof Error ? error.message : String(error)}`);
|
|
4368
|
+
}
|
|
4369
|
+
function bounded(work, what) {
|
|
4370
|
+
return withinProjectIdentityBudget(work, () => logSkipped(what, `no answer within ${PROJECT_IDENTITY_LOOKUP_BUDGET_MS} ms`));
|
|
4371
|
+
}
|
|
4372
|
+
async function identityWithContext(command, identity) {
|
|
4373
|
+
const props = projectIdentityProperties(identity);
|
|
4374
|
+
if (!identity.projectDirectory || isProjectTelemetryDisabled())
|
|
4375
|
+
return props;
|
|
4376
|
+
for (let node = command;node; node = node.parent ?? undefined) {
|
|
4377
|
+
const resolver = node[CONTEXT_RESOLVER];
|
|
4378
|
+
if (typeof resolver !== "function")
|
|
4379
|
+
continue;
|
|
4380
|
+
try {
|
|
4381
|
+
return {
|
|
4382
|
+
...await resolver(identity.projectDirectory),
|
|
4383
|
+
...props
|
|
4384
|
+
};
|
|
4385
|
+
} catch (error) {
|
|
4386
|
+
logSkipped("solution context lookup", error);
|
|
4387
|
+
return props;
|
|
4388
|
+
}
|
|
4218
4389
|
}
|
|
4219
|
-
return
|
|
4220
|
-
}
|
|
4390
|
+
return props;
|
|
4391
|
+
}
|
|
4392
|
+
function configureProjectTelemetry(command, resolver) {
|
|
4393
|
+
command[RESOLVER] = resolver;
|
|
4394
|
+
}
|
|
4395
|
+
function getProjectTelemetryResolver(command) {
|
|
4396
|
+
for (let node = command;node; node = node.parent) {
|
|
4397
|
+
const resolver = node[RESOLVER];
|
|
4398
|
+
if (typeof resolver === "function")
|
|
4399
|
+
return resolver;
|
|
4400
|
+
}
|
|
4401
|
+
return;
|
|
4402
|
+
}
|
|
4403
|
+
function getProjectTelemetryCapture(command) {
|
|
4404
|
+
const capture = command?.[CAPTURE];
|
|
4405
|
+
return capture !== null && typeof capture === "object" ? capture : undefined;
|
|
4406
|
+
}
|
|
4407
|
+
function attachProjectTelemetryCapture(command, capture) {
|
|
4408
|
+
command[CAPTURE] = capture;
|
|
4409
|
+
}
|
|
4410
|
+
function createProjectCommandResolver(root, rules, read) {
|
|
4411
|
+
return createIdentityCommandResolver(root, rules, async (target, command) => identityWithContext(command, await read(target)));
|
|
4412
|
+
}
|
|
4413
|
+
function createIdentityCommandResolver(root, rules, read) {
|
|
4414
|
+
const record = root;
|
|
4415
|
+
record[RULES] = [...ruleSets(root), rules];
|
|
4416
|
+
return async ({ command, args, phase, target, success }) => {
|
|
4417
|
+
const parts = [];
|
|
4418
|
+
for (let node = command;node && node !== root; node = node.parent) {
|
|
4419
|
+
parts.unshift(node.name());
|
|
4420
|
+
}
|
|
4421
|
+
const rule = rules[parts.join(" ")] ?? rules[parts[0]];
|
|
4422
|
+
if (!rule || rule.create && phase === "before")
|
|
4423
|
+
return;
|
|
4424
|
+
if (rule.create && !success)
|
|
4425
|
+
return;
|
|
4426
|
+
if (phase === "after" && !rule.create && target === undefined)
|
|
4427
|
+
return;
|
|
4428
|
+
const opts = command.opts();
|
|
4429
|
+
let selected = target;
|
|
4430
|
+
for (const name of rule.options ?? []) {
|
|
4431
|
+
if (selected === undefined && typeof opts[name] === "string")
|
|
4432
|
+
selected = opts[name];
|
|
4433
|
+
}
|
|
4434
|
+
for (const name of rule.arguments ?? []) {
|
|
4435
|
+
const index = command.registeredArguments.findIndex((arg) => arg.name() === name);
|
|
4436
|
+
if (selected === undefined && index >= 0 && typeof args[index] === "string")
|
|
4437
|
+
selected = args[index];
|
|
4438
|
+
}
|
|
4439
|
+
selected ??= rule.defaultTarget;
|
|
4440
|
+
if (selected === undefined)
|
|
4441
|
+
return;
|
|
4442
|
+
return read(selected, command);
|
|
4443
|
+
};
|
|
4444
|
+
}
|
|
4445
|
+
|
|
4446
|
+
class ProjectTelemetrySession {
|
|
4447
|
+
resolver;
|
|
4448
|
+
command;
|
|
4449
|
+
target;
|
|
4450
|
+
props = {};
|
|
4451
|
+
explicit = false;
|
|
4452
|
+
input;
|
|
4453
|
+
constructor(resolver, command) {
|
|
4454
|
+
this.resolver = resolver;
|
|
4455
|
+
this.command = command;
|
|
4456
|
+
}
|
|
4457
|
+
async setTarget(path) {
|
|
4458
|
+
this.target = path;
|
|
4459
|
+
if (this.input) {
|
|
4460
|
+
await this.resolve({
|
|
4461
|
+
...this.input,
|
|
4462
|
+
phase: "after",
|
|
4463
|
+
success: true
|
|
4464
|
+
});
|
|
4465
|
+
this.explicit = true;
|
|
4466
|
+
}
|
|
4467
|
+
}
|
|
4468
|
+
async setIdentity(identity) {
|
|
4469
|
+
try {
|
|
4470
|
+
const props = await bounded(identityWithContext(this.command, identity), "project identity capture");
|
|
4471
|
+
if (props !== undefined)
|
|
4472
|
+
this.setProperties(props);
|
|
4473
|
+
} catch (error) {
|
|
4474
|
+
logSkipped("project identity capture", error);
|
|
4475
|
+
}
|
|
4476
|
+
}
|
|
4477
|
+
setProperties(properties) {
|
|
4478
|
+
try {
|
|
4479
|
+
this.props = { ...properties };
|
|
4480
|
+
this.explicit = true;
|
|
4481
|
+
} catch (error) {
|
|
4482
|
+
logSkipped("project identity properties", error);
|
|
4483
|
+
}
|
|
4484
|
+
}
|
|
4485
|
+
properties() {
|
|
4486
|
+
return { ...this.props };
|
|
4487
|
+
}
|
|
4488
|
+
async resolve(input) {
|
|
4489
|
+
this.input = input;
|
|
4490
|
+
if (this.explicit)
|
|
4491
|
+
return;
|
|
4492
|
+
try {
|
|
4493
|
+
const props = await bounded(this.resolver({
|
|
4494
|
+
...input,
|
|
4495
|
+
target: this.target
|
|
4496
|
+
}), `project identity (${input.phase})`);
|
|
4497
|
+
if (props !== undefined) {
|
|
4498
|
+
this.props = props;
|
|
4499
|
+
}
|
|
4500
|
+
} catch (error) {
|
|
4501
|
+
logSkipped(`project identity (${input.phase})`, error);
|
|
4502
|
+
}
|
|
4503
|
+
}
|
|
4504
|
+
}
|
|
4505
|
+
function ruleSets(root) {
|
|
4506
|
+
const sets = root[RULES];
|
|
4507
|
+
return Array.isArray(sets) ? sets : [];
|
|
4508
|
+
}
|
|
4221
4509
|
|
|
4222
4510
|
// ../common/src/telemetry/command-name.ts
|
|
4223
4511
|
var TELEMETRY_NAME_ROOT = "Cli";
|
|
@@ -4287,8 +4575,7 @@ var pollSignalSlot = singleton("PollSignal");
|
|
|
4287
4575
|
var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
|
|
4288
4576
|
var processContext = {
|
|
4289
4577
|
exit: (code) => {
|
|
4290
|
-
|
|
4291
|
-
setExitCode(code);
|
|
4578
|
+
recordCommandExit(code);
|
|
4292
4579
|
},
|
|
4293
4580
|
get pollSignal() {
|
|
4294
4581
|
return pollSignalSlot.get();
|
|
@@ -4313,6 +4600,8 @@ function recordableArgValue(value, choices) {
|
|
|
4313
4600
|
function extractCommandParams(cmd) {
|
|
4314
4601
|
const params = {};
|
|
4315
4602
|
forEachSuppliedArgument(cmd, (name, value, choices, defaulted) => {
|
|
4603
|
+
if (name === undefined)
|
|
4604
|
+
return;
|
|
4316
4605
|
const recordable = recordableArgValue(value, choices);
|
|
4317
4606
|
params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = recordable === TELEMETRY_ARG_VALUE_WITHHELD && defaulted ? TELEMETRY_ARG_VALUE_DEFAULTED : recordable;
|
|
4318
4607
|
});
|
|
@@ -4328,7 +4617,8 @@ function isDefaultedPositional(cmd, index) {
|
|
|
4328
4617
|
function forEachSuppliedArgument(cmd, visit) {
|
|
4329
4618
|
const registered = cmd.registeredArguments ?? [];
|
|
4330
4619
|
const processed = cmd.processedArgs ?? [];
|
|
4331
|
-
|
|
4620
|
+
const bound = boundPositionalCount(cmd);
|
|
4621
|
+
for (let i = 0;i < bound; i++) {
|
|
4332
4622
|
const name = registered[i].name();
|
|
4333
4623
|
if (name && processed[i] !== undefined) {
|
|
4334
4624
|
visit(name, processed[i], registered[i].argChoices, isDefaultedPositional(cmd, i));
|
|
@@ -4343,6 +4633,71 @@ function forEachSuppliedArgument(cmd, visit) {
|
|
|
4343
4633
|
visit(key, value, choicesByAttribute.get(key), isDefaultedOption(cmd, key));
|
|
4344
4634
|
}
|
|
4345
4635
|
}
|
|
4636
|
+
forEachPassThroughToken(cmd, bound, (name, value) => {
|
|
4637
|
+
visit(name, value, name === undefined ? undefined : choicesByAttribute.get(name), false);
|
|
4638
|
+
});
|
|
4639
|
+
}
|
|
4640
|
+
function boundPositionalCount(cmd) {
|
|
4641
|
+
const registered = cmd.registeredArguments ?? [];
|
|
4642
|
+
if (registered.some((argument) => argument.variadic)) {
|
|
4643
|
+
return registered.length;
|
|
4644
|
+
}
|
|
4645
|
+
if ((cmd.args ?? []).length <= registered.length) {
|
|
4646
|
+
return registered.length;
|
|
4647
|
+
}
|
|
4648
|
+
const firstFlag = tokenizeTail(cmd, (cmd.args ?? []).slice(1)).tokens.find((token) => token.kind !== "operand")?.index ?? -1;
|
|
4649
|
+
return firstFlag === -1 ? registered.length : Math.min(registered.length, firstFlag + 1);
|
|
4650
|
+
}
|
|
4651
|
+
function forEachPassThroughToken(cmd, bound, visit) {
|
|
4652
|
+
const registered = cmd.registeredArguments ?? [];
|
|
4653
|
+
const fillsPositionals = !registered.some((argument) => argument.variadic);
|
|
4654
|
+
const { tokens, firstUnknown } = tokenizeTail(cmd, (cmd.args ?? []).slice(bound));
|
|
4655
|
+
const repeated = new Map;
|
|
4656
|
+
let nextPositional = bound;
|
|
4657
|
+
for (const token of tokens) {
|
|
4658
|
+
const pastUnknown = firstUnknown !== -1 && token.index > firstUnknown;
|
|
4659
|
+
if (token.kind === "sentinel")
|
|
4660
|
+
continue;
|
|
4661
|
+
if (token.kind === "operand") {
|
|
4662
|
+
const claimable = !pastUnknown && fillsPositionals && nextPositional < registered.length;
|
|
4663
|
+
const name = claimable ? registered[nextPositional++].name() : undefined;
|
|
4664
|
+
visit(name || undefined, token.text);
|
|
4665
|
+
continue;
|
|
4666
|
+
}
|
|
4667
|
+
if (token.kind === "unknown") {
|
|
4668
|
+
const bare = token.flag.replace(/^-+/, "");
|
|
4669
|
+
const key = bare.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
4670
|
+
const keyable = token.flag.startsWith("--") || token.flag.length === 2;
|
|
4671
|
+
if (!pastUnknown && keyable && /^[a-z][a-z0-9-]*$/i.test(bare) && key) {
|
|
4672
|
+
visit(key, token.inlineValue ?? true);
|
|
4673
|
+
} else {
|
|
4674
|
+
visit(undefined, token.text);
|
|
4675
|
+
if (token.inlineValue !== undefined) {
|
|
4676
|
+
visit(undefined, token.inlineValue);
|
|
4677
|
+
} else if (!token.flag.startsWith("--") && token.flag.length > 2) {
|
|
4678
|
+
visit(undefined, token.flag.slice(2));
|
|
4679
|
+
}
|
|
4680
|
+
}
|
|
4681
|
+
continue;
|
|
4682
|
+
}
|
|
4683
|
+
if (pastUnknown) {
|
|
4684
|
+
visit(undefined, token.text);
|
|
4685
|
+
if (token.value !== undefined)
|
|
4686
|
+
visit(undefined, token.value);
|
|
4687
|
+
continue;
|
|
4688
|
+
}
|
|
4689
|
+
const option = token.option;
|
|
4690
|
+
const name = option.attributeName();
|
|
4691
|
+
const value = option.negate ? false : option.required || option.optional ? token.value ?? true : true;
|
|
4692
|
+
const previous = repeated.get(name);
|
|
4693
|
+
if (previous) {
|
|
4694
|
+
previous.push(value);
|
|
4695
|
+
visit(name, previous);
|
|
4696
|
+
} else {
|
|
4697
|
+
repeated.set(name, [value]);
|
|
4698
|
+
visit(name, value);
|
|
4699
|
+
}
|
|
4700
|
+
}
|
|
4346
4701
|
}
|
|
4347
4702
|
function withheldArgumentValues(cmd) {
|
|
4348
4703
|
const values = [];
|
|
@@ -4404,6 +4759,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
4404
4759
|
const telemetryName = commandTelemetryName(commandParts);
|
|
4405
4760
|
const commandPath = commandInvocationPath(commandParts);
|
|
4406
4761
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
4762
|
+
const projectResolver = getProjectTelemetryResolver(command);
|
|
4763
|
+
const projectSession = projectResolver && !isProjectTelemetryDisabled() ? new ProjectTelemetrySession(projectResolver, command) : undefined;
|
|
4407
4764
|
markCommandStart();
|
|
4408
4765
|
const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
|
|
4409
4766
|
try {
|
|
@@ -4416,6 +4773,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
4416
4773
|
if (violation) {
|
|
4417
4774
|
return Promise.reject(violation);
|
|
4418
4775
|
}
|
|
4776
|
+
if (projectSession) {
|
|
4777
|
+
return projectSession.resolve({ command, args, phase: "before" }).then(() => {
|
|
4778
|
+
attachProjectTelemetryCapture(command, projectSession);
|
|
4779
|
+
return fn(...args);
|
|
4780
|
+
});
|
|
4781
|
+
}
|
|
4419
4782
|
return fn(...args);
|
|
4420
4783
|
}));
|
|
4421
4784
|
if (error) {
|
|
@@ -4424,22 +4787,26 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
4424
4787
|
const typed = error;
|
|
4425
4788
|
const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
|
|
4426
4789
|
const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
|
|
4427
|
-
const
|
|
4790
|
+
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
4791
|
+
const classified = cancellationExitCode === undefined ? await extractErrorDetails(error) : undefined;
|
|
4792
|
+
const finalResult = customResult ?? classified?.result ?? RESULTS.Failure;
|
|
4428
4793
|
const typedErrorCode = typed.errorCode ?? typed.ErrorCode;
|
|
4429
4794
|
const customErrorCode = isCliErrorCode(typedErrorCode) ? typedErrorCode : undefined;
|
|
4430
4795
|
const typedRetry = typed.retry ?? typed.Retry;
|
|
4431
4796
|
const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
|
|
4432
4797
|
const typedContext = typed.context ?? typed.Context;
|
|
4433
4798
|
const customContext = isErrorContext(typedContext) ? typedContext : undefined;
|
|
4434
|
-
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
4435
4799
|
fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
|
|
4800
|
+
const errorCode = customErrorCode ?? classified?.errorCode;
|
|
4801
|
+
const retry = customRetry ?? classified?.retry;
|
|
4802
|
+
const errorContext = customContext ?? classified?.context;
|
|
4436
4803
|
OutputFormatter.error({
|
|
4437
4804
|
Result: finalResult,
|
|
4438
|
-
...
|
|
4805
|
+
...errorCode ? { ErrorCode: errorCode } : {},
|
|
4439
4806
|
Message: errorMessage,
|
|
4440
4807
|
Instructions: customInstructions ?? commandHelpHint(commandPath),
|
|
4441
|
-
...
|
|
4442
|
-
...
|
|
4808
|
+
...retry ? { Retry: retry } : {},
|
|
4809
|
+
...errorContext ? { Context: errorContext } : {}
|
|
4443
4810
|
});
|
|
4444
4811
|
context.exit(fallbackExitCode);
|
|
4445
4812
|
}
|
|
@@ -4448,6 +4815,14 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
4448
4815
|
const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
|
|
4449
4816
|
const recordedFailure = takeRecordedCommandFailureTelemetry();
|
|
4450
4817
|
const success = !error && exitCode === 0;
|
|
4818
|
+
if (projectSession) {
|
|
4819
|
+
await projectSession.resolve({
|
|
4820
|
+
command,
|
|
4821
|
+
args,
|
|
4822
|
+
phase: "after",
|
|
4823
|
+
success
|
|
4824
|
+
});
|
|
4825
|
+
}
|
|
4451
4826
|
const terminalTelemetry = buildCommandTerminalTelemetryProperties({
|
|
4452
4827
|
error,
|
|
4453
4828
|
exitCode,
|
|
@@ -4465,6 +4840,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
4465
4840
|
}
|
|
4466
4841
|
const baseProperties = redactProperties({
|
|
4467
4842
|
...commandParams,
|
|
4843
|
+
...projectSession?.properties(),
|
|
4468
4844
|
...props,
|
|
4469
4845
|
...buildCommandTelemetryAttribution(commandPath, process.env.UIPATH_SKILL),
|
|
4470
4846
|
...buildAgentSessionTelemetry(process.env),
|
|
@@ -4475,6 +4851,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
4475
4851
|
});
|
|
4476
4852
|
emitInvocationRequest(telemetryName, success, baseProperties);
|
|
4477
4853
|
} finally {
|
|
4854
|
+
if (projectSession)
|
|
4855
|
+
attachProjectTelemetryCapture(command, undefined);
|
|
4478
4856
|
releaseSuppliedArgumentValues(supplied);
|
|
4479
4857
|
}
|
|
4480
4858
|
});
|
|
@@ -4822,6 +5200,6 @@ function unsupportedSolutionProjectType(projectType) {
|
|
|
4822
5200
|
var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
|
|
4823
5201
|
// ../common/src/tool-provider.ts
|
|
4824
5202
|
var factorySlot = singleton("PackagerFactoryProvider");
|
|
4825
|
-
export { NodeFileSystem, getFileSystem, logger, DebugTelemetryProvider, NodeContextStorage,
|
|
5203
|
+
export { NodeFileSystem, getFileSystem, RESULTS, Command, Option, logger, DebugTelemetryProvider, NodeContextStorage, SuccessOutput, FailureOutput, OutputFormatter, configureProjectTelemetry, getProjectTelemetryCapture, createProjectCommandResolver, processContext, registerPackageMetadataOptions, mapPackageMetadataOptions, quoteForShell, unsupportedSolutionProjectType };
|
|
4826
5204
|
|
|
4827
|
-
//# debugId=
|
|
5205
|
+
//# debugId=ED0DD26D03E18E1164756E2164756E21
|