@uipath/function-tool 1.205.0-preview.277 → 1.206.0-preview.279
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/{browser-strategy-tyy1nbjg.js → browser-strategy-bxv33ex0.js} +3 -6
- package/dist/{cliRunner-6t7v6dqr.js → cliRunner-mb829q93.js} +91 -92
- package/dist/index-6n2xsc30.js +14 -0
- package/dist/index-8h152v0c.js +10221 -0
- package/dist/{index-jhfvqtwr.js → index-dtz2wm6p.js} +247 -209
- package/dist/{index-sby22td6.js → index-nzr4mx5p.js} +2 -22
- package/dist/index-t90k2g7s.js +1130 -0
- package/dist/{jmespath-231m3hyn.js → jmespath-ab6tdc42.js} +1 -1
- package/dist/{js-yaml-88tdqrtd.js → js-yaml-a2bk27p6.js} +1 -3
- package/dist/{node-strategy-nmepnk2k.js → node-strategy-dhvvrt9n.js} +7 -12
- package/dist/{packager-tool-f7enb48c.js → packager-tool-cmtxbmhx.js} +1761 -706
- package/dist/{packager-tool-1de529jm.js → packager-tool-epsr41wx.js} +12 -3
- package/dist/{packager-tool-1shggyya.js → packager-tool-qjerhjyd.js} +78 -684
- package/dist/packager-tool.js +670 -30
- package/dist/tool.js +31 -30
- package/package.json +2 -2
- package/dist/index-27bykvvc.js +0 -6224
- package/dist/index-at7vc5xq.js +0 -157
- package/dist/index-q8r0mcyb.js +0 -10221
- package/dist/packager-tool-0gctz400.js +0 -17
- package/dist/packager-tool-b098y4a2.js +0 -646
- package/dist/packager-tool-qa9gftnj.js +0 -31
- package/dist/packager-tool-y4vgqz1w.js +0 -247
- package/dist/packager-tool-yc4kw997.js +0 -13
- /package/dist/{packager-tool-h7ke7taj.js → packager-tool-3bw869ja.js} +0 -0
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./packager-tool-y4vgqz1w.js";
|
|
4
|
-
import {
|
|
2
|
+
__toESM,
|
|
5
3
|
__commonJS,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from "./packager-tool-
|
|
4
|
+
__exportCjs,
|
|
5
|
+
__require
|
|
6
|
+
} from "./packager-tool-epsr41wx.js";
|
|
9
7
|
|
|
10
8
|
// ../../node_modules/commander/lib/error.js
|
|
11
9
|
var require_error = __commonJS(function(exports) {
|
|
@@ -127,7 +125,7 @@ var require_help = __commonJS(function(exports) {
|
|
|
127
125
|
this.helpWidth = this.helpWidth ?? contextOptions.helpWidth ?? 80;
|
|
128
126
|
}
|
|
129
127
|
visibleCommands(cmd) {
|
|
130
|
-
const visibleCommands = cmd.commands.filter((
|
|
128
|
+
const visibleCommands = cmd.commands.filter((cmd) => !cmd._hidden);
|
|
131
129
|
const helpCommand = cmd._getHelpCommand();
|
|
132
130
|
if (helpCommand && !helpCommand._hidden) {
|
|
133
131
|
visibleCommands.push(helpCommand);
|
|
@@ -607,8 +605,8 @@ var require_option = __commonJS(function(exports) {
|
|
|
607
605
|
}
|
|
608
606
|
}
|
|
609
607
|
function camelcase(str) {
|
|
610
|
-
return str.split("-").reduce((
|
|
611
|
-
return
|
|
608
|
+
return str.split("-").reduce((str, word) => {
|
|
609
|
+
return str + word[0].toUpperCase() + word.slice(1);
|
|
612
610
|
});
|
|
613
611
|
}
|
|
614
612
|
function splitOptionFlags(flags) {
|
|
@@ -1179,44 +1177,44 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1179
1177
|
});
|
|
1180
1178
|
return source;
|
|
1181
1179
|
}
|
|
1182
|
-
_prepareUserArgs(
|
|
1183
|
-
if (
|
|
1180
|
+
_prepareUserArgs(argv2, parseOptions) {
|
|
1181
|
+
if (argv2 !== undefined && !Array.isArray(argv2)) {
|
|
1184
1182
|
throw new Error("first parameter to parse must be array or undefined");
|
|
1185
1183
|
}
|
|
1186
1184
|
parseOptions = parseOptions || {};
|
|
1187
|
-
if (
|
|
1185
|
+
if (argv2 === undefined && parseOptions.from === undefined) {
|
|
1188
1186
|
if (process2.versions?.electron) {
|
|
1189
1187
|
parseOptions.from = "electron";
|
|
1190
1188
|
}
|
|
1191
|
-
const
|
|
1192
|
-
if (
|
|
1189
|
+
const execArgv2 = process2.execArgv ?? [];
|
|
1190
|
+
if (execArgv2.includes("-e") || execArgv2.includes("--eval") || execArgv2.includes("-p") || execArgv2.includes("--print")) {
|
|
1193
1191
|
parseOptions.from = "eval";
|
|
1194
1192
|
}
|
|
1195
1193
|
}
|
|
1196
|
-
if (
|
|
1197
|
-
|
|
1194
|
+
if (argv2 === undefined) {
|
|
1195
|
+
argv2 = process2.argv;
|
|
1198
1196
|
}
|
|
1199
|
-
this.rawArgs =
|
|
1197
|
+
this.rawArgs = argv2.slice();
|
|
1200
1198
|
let userArgs;
|
|
1201
1199
|
switch (parseOptions.from) {
|
|
1202
1200
|
case undefined:
|
|
1203
1201
|
case "node":
|
|
1204
|
-
this._scriptPath =
|
|
1205
|
-
userArgs =
|
|
1202
|
+
this._scriptPath = argv2[1];
|
|
1203
|
+
userArgs = argv2.slice(2);
|
|
1206
1204
|
break;
|
|
1207
1205
|
case "electron":
|
|
1208
1206
|
if (process2.defaultApp) {
|
|
1209
|
-
this._scriptPath =
|
|
1210
|
-
userArgs =
|
|
1207
|
+
this._scriptPath = argv2[1];
|
|
1208
|
+
userArgs = argv2.slice(2);
|
|
1211
1209
|
} else {
|
|
1212
|
-
userArgs =
|
|
1210
|
+
userArgs = argv2.slice(1);
|
|
1213
1211
|
}
|
|
1214
1212
|
break;
|
|
1215
1213
|
case "user":
|
|
1216
|
-
userArgs =
|
|
1214
|
+
userArgs = argv2.slice(0);
|
|
1217
1215
|
break;
|
|
1218
1216
|
case "eval":
|
|
1219
|
-
userArgs =
|
|
1217
|
+
userArgs = argv2.slice(1);
|
|
1220
1218
|
break;
|
|
1221
1219
|
default:
|
|
1222
1220
|
throw new Error(`unexpected parse option { from: '${parseOptions.from}' }`);
|
|
@@ -1739,18 +1737,18 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1739
1737
|
this.error(message, { code: "commander.missingMandatoryOptionValue" });
|
|
1740
1738
|
}
|
|
1741
1739
|
_conflictingOption(option, conflictingOption) {
|
|
1742
|
-
const findBestOptionFromValue = (
|
|
1743
|
-
const optionKey =
|
|
1740
|
+
const findBestOptionFromValue = (option) => {
|
|
1741
|
+
const optionKey = option.attributeName();
|
|
1744
1742
|
const optionValue = this.getOptionValue(optionKey);
|
|
1745
1743
|
const negativeOption = this.options.find((target) => target.negate && optionKey === target.attributeName());
|
|
1746
1744
|
const positiveOption = this.options.find((target) => !target.negate && optionKey === target.attributeName());
|
|
1747
1745
|
if (negativeOption && (negativeOption.presetArg === undefined && optionValue === false || negativeOption.presetArg !== undefined && optionValue === negativeOption.presetArg)) {
|
|
1748
1746
|
return negativeOption;
|
|
1749
1747
|
}
|
|
1750
|
-
return positiveOption ||
|
|
1748
|
+
return positiveOption || option;
|
|
1751
1749
|
};
|
|
1752
|
-
const getErrorMessage = (
|
|
1753
|
-
const bestOption = findBestOptionFromValue(
|
|
1750
|
+
const getErrorMessage = (option) => {
|
|
1751
|
+
const bestOption = findBestOptionFromValue(option);
|
|
1754
1752
|
const optionKey = bestOption.attributeName();
|
|
1755
1753
|
const source = this.getOptionValueSource(optionKey);
|
|
1756
1754
|
if (source === "env") {
|
|
@@ -1904,10 +1902,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1904
1902
|
this._name = path.basename(filename, path.extname(filename));
|
|
1905
1903
|
return this;
|
|
1906
1904
|
}
|
|
1907
|
-
executableDir(
|
|
1908
|
-
if (
|
|
1905
|
+
executableDir(path) {
|
|
1906
|
+
if (path === undefined)
|
|
1909
1907
|
return this._executableDir;
|
|
1910
|
-
this._executableDir =
|
|
1908
|
+
this._executableDir = path;
|
|
1911
1909
|
return this;
|
|
1912
1910
|
}
|
|
1913
1911
|
helpInformation(contextOptions) {
|
|
@@ -2004,11 +2002,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2004
2002
|
}
|
|
2005
2003
|
help(contextOptions) {
|
|
2006
2004
|
this.outputHelp(contextOptions);
|
|
2007
|
-
let
|
|
2008
|
-
if (
|
|
2009
|
-
|
|
2005
|
+
let exitCode2 = Number(process2.exitCode ?? 0);
|
|
2006
|
+
if (exitCode2 === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
|
|
2007
|
+
exitCode2 = 1;
|
|
2010
2008
|
}
|
|
2011
|
-
this._exit(
|
|
2009
|
+
this._exit(exitCode2, "commander.help", "(outputHelp)");
|
|
2012
2010
|
}
|
|
2013
2011
|
addHelpText(position, text) {
|
|
2014
2012
|
const allowedValues = ["beforeAll", "before", "after", "afterAll"];
|
|
@@ -2080,246 +2078,717 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2080
2078
|
exports.useColor = useColor;
|
|
2081
2079
|
});
|
|
2082
2080
|
|
|
2083
|
-
//
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
exports.CommanderError = CommanderError;
|
|
2099
|
-
exports.InvalidArgumentError = InvalidArgumentError;
|
|
2100
|
-
exports.InvalidOptionArgumentError = InvalidArgumentError;
|
|
2101
|
-
});
|
|
2081
|
+
// ../filesystem/src/node.ts
|
|
2082
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
2083
|
+
import { existsSync } from "node:fs";
|
|
2084
|
+
import * as fs from "node:fs/promises";
|
|
2085
|
+
import * as os from "node:os";
|
|
2086
|
+
import * as path from "node:path";
|
|
2087
|
+
var LOCK_HEARTBEAT_MS = 5000;
|
|
2088
|
+
var LOCK_STALE_MS = 15000;
|
|
2089
|
+
var LOCK_MAX_WAIT_MS = 20000;
|
|
2090
|
+
var LOCK_MAX_HOLD_MS = 60000;
|
|
2091
|
+
var LOCK_RETRY_MIN_MS = 100;
|
|
2092
|
+
var LOCK_RETRY_JITTER_MS = 200;
|
|
2093
|
+
var HASH_CHUNK_BYTES = 256 * 1024;
|
|
2094
|
+
var hashBuffers = [];
|
|
2095
|
+
var HASH_BUFFERS_KEPT = 64;
|
|
2102
2096
|
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
3248222580,
|
|
2123
|
-
3835390401,
|
|
2124
|
-
4022224774,
|
|
2125
|
-
264347078,
|
|
2126
|
-
604807628,
|
|
2127
|
-
770255983,
|
|
2128
|
-
1249150122,
|
|
2129
|
-
1555081692,
|
|
2130
|
-
1996064986,
|
|
2131
|
-
2554220882,
|
|
2132
|
-
2821834349,
|
|
2133
|
-
2952996808,
|
|
2134
|
-
3210313671,
|
|
2135
|
-
3336571891,
|
|
2136
|
-
3584528711,
|
|
2137
|
-
113926993,
|
|
2138
|
-
338241895,
|
|
2139
|
-
666307205,
|
|
2140
|
-
773529912,
|
|
2141
|
-
1294757372,
|
|
2142
|
-
1396182291,
|
|
2143
|
-
1695183700,
|
|
2144
|
-
1986661051,
|
|
2145
|
-
2177026350,
|
|
2146
|
-
2456956037,
|
|
2147
|
-
2730485921,
|
|
2148
|
-
2820302411,
|
|
2149
|
-
3259730800,
|
|
2150
|
-
3345764771,
|
|
2151
|
-
3516065817,
|
|
2152
|
-
3600352804,
|
|
2153
|
-
4094571909,
|
|
2154
|
-
275423344,
|
|
2155
|
-
430227734,
|
|
2156
|
-
506948616,
|
|
2157
|
-
659060556,
|
|
2158
|
-
883997877,
|
|
2159
|
-
958139571,
|
|
2160
|
-
1322822218,
|
|
2161
|
-
1537002063,
|
|
2162
|
-
1747873779,
|
|
2163
|
-
1955562222,
|
|
2164
|
-
2024104815,
|
|
2165
|
-
2227730452,
|
|
2166
|
-
2361852424,
|
|
2167
|
-
2428436474,
|
|
2168
|
-
2756734187,
|
|
2169
|
-
3204031479,
|
|
2170
|
-
3329325298
|
|
2171
|
-
]);
|
|
2172
|
-
var SHA256_INITIAL_STATE = new Uint32Array([
|
|
2173
|
-
1779033703,
|
|
2174
|
-
3144134277,
|
|
2175
|
-
1013904242,
|
|
2176
|
-
2773480762,
|
|
2177
|
-
1359893119,
|
|
2178
|
-
2600822924,
|
|
2179
|
-
528734635,
|
|
2180
|
-
1541459225
|
|
2181
|
-
]);
|
|
2182
|
-
function rotr(value, bits) {
|
|
2183
|
-
return (value >>> bits | value << 32 - bits) >>> 0;
|
|
2184
|
-
}
|
|
2185
|
-
function sha256Hex(input) {
|
|
2186
|
-
const bytes = new TextEncoder().encode(input);
|
|
2187
|
-
const paddedLength = bytes.length + 9 + 63 >> 6 << 6;
|
|
2188
|
-
const buffer = new Uint8Array(paddedLength);
|
|
2189
|
-
buffer.set(bytes);
|
|
2190
|
-
buffer[bytes.length] = 128;
|
|
2191
|
-
const view = new DataView(buffer.buffer);
|
|
2192
|
-
const bitLength = bytes.length * 8;
|
|
2193
|
-
view.setUint32(paddedLength - 8, Math.floor(bitLength / 4294967296));
|
|
2194
|
-
view.setUint32(paddedLength - 4, bitLength >>> 0);
|
|
2195
|
-
const state = SHA256_INITIAL_STATE.slice();
|
|
2196
|
-
const schedule = new Uint32Array(64);
|
|
2197
|
-
for (let offset = 0;offset < paddedLength; offset += 64) {
|
|
2198
|
-
for (let i = 0;i < 16; i++) {
|
|
2199
|
-
schedule[i] = view.getUint32(offset + i * 4);
|
|
2097
|
+
class NodeFileSystem {
|
|
2098
|
+
path = {
|
|
2099
|
+
join: path.join,
|
|
2100
|
+
resolve: path.resolve,
|
|
2101
|
+
relative: path.relative,
|
|
2102
|
+
dirname: path.dirname,
|
|
2103
|
+
isAbsolute: path.isAbsolute,
|
|
2104
|
+
basename: path.basename
|
|
2105
|
+
};
|
|
2106
|
+
env = {
|
|
2107
|
+
cwd: process.cwd,
|
|
2108
|
+
homedir: os.homedir,
|
|
2109
|
+
tmpdir: os.tmpdir,
|
|
2110
|
+
getenv: (key) => process.env[key]
|
|
2111
|
+
};
|
|
2112
|
+
utils = {
|
|
2113
|
+
open: async (url) => {
|
|
2114
|
+
const { default: open } = await import("./index-nzr4mx5p.js");
|
|
2115
|
+
await open(url);
|
|
2200
2116
|
}
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2117
|
+
};
|
|
2118
|
+
async readFile(path2, options) {
|
|
2119
|
+
try {
|
|
2120
|
+
if (options) {
|
|
2121
|
+
return await fs.readFile(path2, "utf-8");
|
|
2122
|
+
}
|
|
2123
|
+
return await fs.readFile(path2);
|
|
2124
|
+
} catch (error) {
|
|
2125
|
+
if (this.isEnoent(error))
|
|
2126
|
+
return null;
|
|
2127
|
+
throw error;
|
|
2207
2128
|
}
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
let f = state[5];
|
|
2214
|
-
let g = state[6];
|
|
2215
|
-
let h = state[7];
|
|
2216
|
-
for (let i = 0;i < 64; i++) {
|
|
2217
|
-
const s1 = (rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25)) >>> 0;
|
|
2218
|
-
const ch = (e & f ^ ~e & g) >>> 0;
|
|
2219
|
-
const temp1 = h + s1 + ch + SHA256_K[i] + schedule[i] >>> 0;
|
|
2220
|
-
const s0 = (rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) >>> 0;
|
|
2221
|
-
const maj = (a & b ^ a & c ^ b & c) >>> 0;
|
|
2222
|
-
const temp2 = s0 + maj >>> 0;
|
|
2223
|
-
h = g;
|
|
2224
|
-
g = f;
|
|
2225
|
-
f = e;
|
|
2226
|
-
e = d + temp1 >>> 0;
|
|
2227
|
-
d = c;
|
|
2228
|
-
c = b;
|
|
2229
|
-
b = a;
|
|
2230
|
-
a = temp1 + temp2 >>> 0;
|
|
2129
|
+
}
|
|
2130
|
+
async writeFile(filePath, data) {
|
|
2131
|
+
const dir = path.dirname(filePath);
|
|
2132
|
+
if (dir) {
|
|
2133
|
+
await fs.mkdir(dir, { recursive: true });
|
|
2231
2134
|
}
|
|
2232
|
-
|
|
2233
|
-
state[1] = state[1] + b >>> 0;
|
|
2234
|
-
state[2] = state[2] + c >>> 0;
|
|
2235
|
-
state[3] = state[3] + d >>> 0;
|
|
2236
|
-
state[4] = state[4] + e >>> 0;
|
|
2237
|
-
state[5] = state[5] + f >>> 0;
|
|
2238
|
-
state[6] = state[6] + g >>> 0;
|
|
2239
|
-
state[7] = state[7] + h >>> 0;
|
|
2135
|
+
await fs.writeFile(filePath, data);
|
|
2240
2136
|
}
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2137
|
+
async appendFile(filePath, data) {
|
|
2138
|
+
const dir = path.dirname(filePath);
|
|
2139
|
+
if (dir) {
|
|
2140
|
+
await fs.mkdir(dir, { recursive: true });
|
|
2141
|
+
}
|
|
2142
|
+
await fs.appendFile(filePath, data);
|
|
2244
2143
|
}
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
return sha256Hex;
|
|
2144
|
+
async readdir(dirPath) {
|
|
2145
|
+
try {
|
|
2146
|
+
return await fs.readdir(dirPath);
|
|
2147
|
+
} catch (error) {
|
|
2148
|
+
if (this.isEnoent(error))
|
|
2149
|
+
return [];
|
|
2150
|
+
throw error;
|
|
2253
2151
|
}
|
|
2254
|
-
const native = (input) => createHash("sha256").update(input, "utf8").digest("hex");
|
|
2255
|
-
return native("abc") === sha256Hex("abc") ? native : sha256Hex;
|
|
2256
|
-
} catch {
|
|
2257
|
-
return sha256Hex;
|
|
2258
2152
|
}
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
}
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
}
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2153
|
+
async readdirEntries(dirPath) {
|
|
2154
|
+
try {
|
|
2155
|
+
return await fs.readdir(dirPath, { withFileTypes: true });
|
|
2156
|
+
} catch (error) {
|
|
2157
|
+
if (this.isEnoent(error))
|
|
2158
|
+
return [];
|
|
2159
|
+
throw error;
|
|
2160
|
+
}
|
|
2161
|
+
}
|
|
2162
|
+
async stat(filePath) {
|
|
2163
|
+
try {
|
|
2164
|
+
const stats = await fs.stat(filePath);
|
|
2165
|
+
return {
|
|
2166
|
+
isFile: () => stats.isFile(),
|
|
2167
|
+
isDirectory: () => stats.isDirectory(),
|
|
2168
|
+
size: stats.size,
|
|
2169
|
+
mtimeMs: stats.mtimeMs,
|
|
2170
|
+
ctimeMs: stats.ctimeMs
|
|
2171
|
+
};
|
|
2172
|
+
} catch (error) {
|
|
2173
|
+
if (this.isEnoent(error))
|
|
2174
|
+
return null;
|
|
2175
|
+
throw error;
|
|
2176
|
+
}
|
|
2177
|
+
}
|
|
2178
|
+
async exists(filePath) {
|
|
2179
|
+
return existsSync(filePath);
|
|
2180
|
+
}
|
|
2181
|
+
async mkdir(dirPath) {
|
|
2182
|
+
await fs.mkdir(dirPath, { recursive: true });
|
|
2183
|
+
}
|
|
2184
|
+
async acquireLock(lockPath) {
|
|
2185
|
+
const canonicalPath = await this.canonicalizeLockTarget(lockPath);
|
|
2186
|
+
const lockFile = `${canonicalPath}.lock`;
|
|
2187
|
+
const ownerId = randomUUID();
|
|
2188
|
+
const start = Date.now();
|
|
2189
|
+
while (true) {
|
|
2190
|
+
try {
|
|
2191
|
+
await fs.writeFile(lockFile, ownerId, { flag: "wx" });
|
|
2192
|
+
return this.createLockRelease(lockFile, ownerId);
|
|
2193
|
+
} catch (error) {
|
|
2194
|
+
if (!this.hasErrnoCode(error, "EEXIST")) {
|
|
2195
|
+
throw error;
|
|
2290
2196
|
}
|
|
2197
|
+
const stats = await fs.stat(lockFile).catch(() => null);
|
|
2198
|
+
if (stats && Date.now() - stats.mtimeMs > LOCK_STALE_MS) {
|
|
2199
|
+
const reclaimed = await fs.rm(lockFile, { force: true }).then(() => true).catch(() => false);
|
|
2200
|
+
if (reclaimed)
|
|
2201
|
+
continue;
|
|
2202
|
+
}
|
|
2203
|
+
if (Date.now() - start > LOCK_MAX_WAIT_MS) {
|
|
2204
|
+
throw new Error(`ELOCKED: timed out waiting for lock on ${canonicalPath}`);
|
|
2205
|
+
}
|
|
2206
|
+
await new Promise((resolve2) => setTimeout(resolve2, LOCK_RETRY_MIN_MS + Math.random() * LOCK_RETRY_JITTER_MS));
|
|
2291
2207
|
}
|
|
2292
|
-
const instance = factory();
|
|
2293
|
-
_g[key] = instance;
|
|
2294
|
-
return instance;
|
|
2295
2208
|
}
|
|
2296
|
-
}
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2209
|
+
}
|
|
2210
|
+
async canonicalizeLockTarget(lockPath) {
|
|
2211
|
+
const absolute = path.resolve(lockPath);
|
|
2212
|
+
const fullReal = await fs.realpath(absolute).catch(() => null);
|
|
2213
|
+
if (fullReal)
|
|
2214
|
+
return fullReal;
|
|
2215
|
+
const parent = path.dirname(absolute);
|
|
2216
|
+
const base = path.basename(absolute);
|
|
2217
|
+
const canonicalParent = await fs.realpath(parent).catch(() => parent);
|
|
2218
|
+
return path.join(canonicalParent, base);
|
|
2219
|
+
}
|
|
2220
|
+
createLockRelease(lockFile, ownerId) {
|
|
2221
|
+
const heartbeatStart = Date.now();
|
|
2222
|
+
let heartbeatTimer;
|
|
2223
|
+
let stopped = false;
|
|
2224
|
+
const stopHeartbeat = () => {
|
|
2225
|
+
stopped = true;
|
|
2226
|
+
if (heartbeatTimer)
|
|
2227
|
+
clearTimeout(heartbeatTimer);
|
|
2228
|
+
};
|
|
2229
|
+
const scheduleNextHeartbeat = () => {
|
|
2230
|
+
if (stopped)
|
|
2231
|
+
return;
|
|
2232
|
+
if (Date.now() - heartbeatStart >= LOCK_MAX_HOLD_MS) {
|
|
2233
|
+
stopped = true;
|
|
2234
|
+
return;
|
|
2312
2235
|
}
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
}
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2236
|
+
heartbeatTimer = setTimeout(() => {
|
|
2237
|
+
runHeartbeat();
|
|
2238
|
+
}, LOCK_HEARTBEAT_MS);
|
|
2239
|
+
heartbeatTimer.unref?.();
|
|
2240
|
+
};
|
|
2241
|
+
const runHeartbeat = async () => {
|
|
2242
|
+
if (stopped)
|
|
2243
|
+
return;
|
|
2244
|
+
const current = await fs.readFile(lockFile, "utf-8").catch(() => null);
|
|
2245
|
+
if (stopped)
|
|
2246
|
+
return;
|
|
2247
|
+
if (current !== ownerId) {
|
|
2248
|
+
stopped = true;
|
|
2249
|
+
return;
|
|
2250
|
+
}
|
|
2251
|
+
const now = Date.now() / 1000;
|
|
2252
|
+
await fs.utimes(lockFile, now, now).catch(() => {});
|
|
2253
|
+
scheduleNextHeartbeat();
|
|
2254
|
+
};
|
|
2255
|
+
scheduleNextHeartbeat();
|
|
2256
|
+
let released = false;
|
|
2257
|
+
return async () => {
|
|
2258
|
+
if (released)
|
|
2259
|
+
return;
|
|
2260
|
+
released = true;
|
|
2261
|
+
stopHeartbeat();
|
|
2262
|
+
const current = await fs.readFile(lockFile, "utf-8").catch(() => null);
|
|
2263
|
+
if (current === ownerId) {
|
|
2264
|
+
await fs.rm(lockFile, { force: true });
|
|
2265
|
+
}
|
|
2266
|
+
};
|
|
2267
|
+
}
|
|
2268
|
+
async rm(filePath) {
|
|
2269
|
+
await fs.rm(filePath, { recursive: true, force: true });
|
|
2270
|
+
}
|
|
2271
|
+
async rename(oldPath, newPath) {
|
|
2272
|
+
await fs.rename(oldPath, newPath);
|
|
2273
|
+
}
|
|
2274
|
+
async isSymbolicLink(filePath) {
|
|
2275
|
+
try {
|
|
2276
|
+
return (await fs.lstat(filePath)).isSymbolicLink();
|
|
2277
|
+
} catch (error) {
|
|
2278
|
+
if (this.isEnoent(error) || this.hasErrnoCode(error, "ENOTDIR")) {
|
|
2279
|
+
return false;
|
|
2280
|
+
}
|
|
2281
|
+
throw error;
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
async hashFile(filePath) {
|
|
2285
|
+
let handle;
|
|
2286
|
+
try {
|
|
2287
|
+
handle = await fs.open(filePath, "r");
|
|
2288
|
+
} catch (error) {
|
|
2289
|
+
if (this.isEnoent(error))
|
|
2290
|
+
return null;
|
|
2291
|
+
throw error;
|
|
2292
|
+
}
|
|
2293
|
+
const buffer = hashBuffers.pop() ?? Buffer.allocUnsafe(HASH_CHUNK_BYTES);
|
|
2294
|
+
try {
|
|
2295
|
+
const opened = await handle.stat();
|
|
2296
|
+
const stats = {
|
|
2297
|
+
isFile: () => opened.isFile(),
|
|
2298
|
+
isDirectory: () => opened.isDirectory(),
|
|
2299
|
+
size: opened.size,
|
|
2300
|
+
mtimeMs: opened.mtimeMs,
|
|
2301
|
+
ctimeMs: opened.ctimeMs
|
|
2302
|
+
};
|
|
2303
|
+
const hash = createHash("sha256");
|
|
2304
|
+
let size = 0;
|
|
2305
|
+
for (;; ) {
|
|
2306
|
+
const { bytesRead } = await handle.read(buffer, 0, buffer.byteLength, null);
|
|
2307
|
+
if (bytesRead === 0)
|
|
2308
|
+
break;
|
|
2309
|
+
hash.update(buffer.subarray(0, bytesRead));
|
|
2310
|
+
size += bytesRead;
|
|
2311
|
+
}
|
|
2312
|
+
return { sha256: hash.digest("hex"), size, stats };
|
|
2313
|
+
} finally {
|
|
2314
|
+
if (hashBuffers.length < HASH_BUFFERS_KEPT) {
|
|
2315
|
+
hashBuffers.push(buffer);
|
|
2316
|
+
}
|
|
2317
|
+
await handle.close();
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
async realpath(filePath) {
|
|
2321
|
+
try {
|
|
2322
|
+
return await fs.realpath(filePath);
|
|
2323
|
+
} catch (error) {
|
|
2324
|
+
if (this.isEnoent(error))
|
|
2325
|
+
return filePath;
|
|
2326
|
+
throw error;
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
2329
|
+
async getTempDir() {
|
|
2330
|
+
return await fs.mkdtemp(path.join(os.tmpdir(), "uipath-fs-"));
|
|
2331
|
+
}
|
|
2332
|
+
async copyDirectory(sourcePath, destPath) {
|
|
2333
|
+
const sourceStats = await this.stat(sourcePath);
|
|
2334
|
+
if (!sourceStats) {
|
|
2335
|
+
throw new Error(`Source directory does not exist: ${sourcePath}`);
|
|
2336
|
+
}
|
|
2337
|
+
if (!sourceStats.isDirectory()) {
|
|
2338
|
+
throw new Error(`Source path is not a directory: ${sourcePath}`);
|
|
2339
|
+
}
|
|
2340
|
+
await this.mkdir(destPath);
|
|
2341
|
+
const entries = await this.readdir(sourcePath);
|
|
2342
|
+
for (const entry of entries) {
|
|
2343
|
+
const srcEntry = path.join(sourcePath, entry);
|
|
2344
|
+
const destEntry = path.join(destPath, entry);
|
|
2345
|
+
const entryStats = await this.stat(srcEntry);
|
|
2346
|
+
if (!entryStats)
|
|
2347
|
+
continue;
|
|
2348
|
+
if (entryStats.isDirectory()) {
|
|
2349
|
+
await this.copyDirectory(srcEntry, destEntry);
|
|
2350
|
+
} else if (entryStats.isFile()) {
|
|
2351
|
+
const content = await this.readFile(srcEntry);
|
|
2352
|
+
if (content !== null) {
|
|
2353
|
+
await this.writeFile(destEntry, content);
|
|
2354
|
+
}
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
isEnoent(error) {
|
|
2359
|
+
return this.hasErrnoCode(error, "ENOENT");
|
|
2360
|
+
}
|
|
2361
|
+
hasErrnoCode(error, code) {
|
|
2362
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === code;
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
|
|
2366
|
+
// ../filesystem/src/index.ts
|
|
2367
|
+
var fsInstance = new NodeFileSystem;
|
|
2368
|
+
var getFileSystem = () => fsInstance;
|
|
2369
|
+
|
|
2370
|
+
// ../common/src/telemetry/telemetry-dimensions.ts
|
|
2371
|
+
var BaseDimensions = {
|
|
2372
|
+
ApplicationName: "ApplicationName",
|
|
2373
|
+
ProductVersion: "ProductVersion",
|
|
2374
|
+
InstallationId: "InstallationId",
|
|
2375
|
+
CloudUserId: "CloudUserId",
|
|
2376
|
+
CloudTenantId: "CloudTenantId",
|
|
2377
|
+
CloudOrganizationId: "CloudOrganizationId",
|
|
2378
|
+
IsInternalUser: "IsInternalUser",
|
|
2379
|
+
Environment: "Environment",
|
|
2380
|
+
BaseUrl: "BaseUrl",
|
|
2381
|
+
Region: "Region",
|
|
2382
|
+
Agent: "Agent",
|
|
2383
|
+
AgentVersion: "AgentVersion",
|
|
2384
|
+
AgentModel: "AgentModel",
|
|
2385
|
+
ToolName: "ToolName",
|
|
2386
|
+
ToolVersion: "ToolVersion",
|
|
2387
|
+
ExecutionContext: "ExecutionContext",
|
|
2388
|
+
CiProvider: "CiProvider",
|
|
2389
|
+
SessionIdSource: "SessionIdSource",
|
|
2390
|
+
SessionId: "SessionId"
|
|
2391
|
+
};
|
|
2392
|
+
var CommandDimensions = {
|
|
2393
|
+
IsCommand: "IsCommand",
|
|
2394
|
+
IsReexec: "IsReexec",
|
|
2395
|
+
CommandName: "CommandName",
|
|
2396
|
+
ExitCode: "ExitCode",
|
|
2397
|
+
TerminalOutcome: "TerminalOutcome",
|
|
2398
|
+
ErrorClass: "ErrorClass",
|
|
2399
|
+
TerminalSignal: "TerminalSignal",
|
|
2400
|
+
ErrorMessage: "ErrorMessage",
|
|
2401
|
+
SkillName: "SkillName",
|
|
2402
|
+
ProductArea: "ProductArea",
|
|
2403
|
+
Mode: "Mode"
|
|
2404
|
+
};
|
|
2405
|
+
var ProjectDimensions = {
|
|
2406
|
+
ProjectKey: "ProjectKey",
|
|
2407
|
+
ProjectType: "ProjectType",
|
|
2408
|
+
ProjectIdentityStatus: "ProjectIdentityStatus",
|
|
2409
|
+
SolutionKey: "SolutionKey",
|
|
2410
|
+
SolutionProjectKey: "SolutionProjectKey",
|
|
2411
|
+
SolutionIdentityStatus: "SolutionIdentityStatus",
|
|
2412
|
+
PreviousSolutionKey: "PreviousSolutionKey"
|
|
2413
|
+
};
|
|
2414
|
+
var GUID_KEY_DIMENSIONS = new Set([
|
|
2415
|
+
ProjectDimensions.ProjectKey,
|
|
2416
|
+
ProjectDimensions.SolutionKey,
|
|
2417
|
+
ProjectDimensions.SolutionProjectKey,
|
|
2418
|
+
ProjectDimensions.PreviousSolutionKey
|
|
2419
|
+
]);
|
|
2420
|
+
var ShipDimensions = {
|
|
2421
|
+
ShipKind: "ShipKind",
|
|
2422
|
+
Target: "Target",
|
|
2423
|
+
ProjectType: "ProjectType",
|
|
2424
|
+
ProjectTypes: "ProjectTypes",
|
|
2425
|
+
ArtifactCorrelationKey: "ArtifactCorrelationKey",
|
|
2426
|
+
PackageName: "PackageName",
|
|
2427
|
+
PackageVersion: "PackageVersion",
|
|
2428
|
+
PackageVersionKey: "PackageVersionKey",
|
|
2429
|
+
DeploymentKey: "DeploymentKey",
|
|
2430
|
+
SolutionId: "SolutionId",
|
|
2431
|
+
FolderKey: "FolderKey",
|
|
2432
|
+
FeedId: "FeedId"
|
|
2433
|
+
};
|
|
2434
|
+
var ErrorDimensions = {
|
|
2435
|
+
Result: "Result",
|
|
2436
|
+
ErrorCode: "ErrorCode",
|
|
2437
|
+
Retry: "Retry",
|
|
2438
|
+
ErrorMessage: "ErrorMessage",
|
|
2439
|
+
HttpStatus: "HttpStatus",
|
|
2440
|
+
UpstreamErrorCode: "UpstreamErrorCode"
|
|
2441
|
+
};
|
|
2442
|
+
var AuthDimensions = {
|
|
2443
|
+
AuthenticationMethod: "AuthenticationMethod",
|
|
2444
|
+
Success: "Success",
|
|
2445
|
+
Reason: "Reason"
|
|
2446
|
+
};
|
|
2447
|
+
var SkillsDimensions = {
|
|
2448
|
+
SchemaVersion: "SchemaVersion",
|
|
2449
|
+
AgentType: "AgentType",
|
|
2450
|
+
SkillsVersion: "SkillsVersion",
|
|
2451
|
+
UipSubcommand: "UipSubcommand",
|
|
2452
|
+
FileExtension: "FileExtension",
|
|
2453
|
+
SubagentModel: "SubagentModel",
|
|
2454
|
+
SubagentType: "SubagentType",
|
|
2455
|
+
PermissionMode: "PermissionMode",
|
|
2456
|
+
EffortLevel: "EffortLevel",
|
|
2457
|
+
SessionSource: "SessionSource",
|
|
2458
|
+
Outcome: "Outcome",
|
|
2459
|
+
DurationMs: "DurationMs",
|
|
2460
|
+
Source: "Source"
|
|
2461
|
+
};
|
|
2462
|
+
var PackagerDimensions = {
|
|
2463
|
+
ProjectId: "ProjectId",
|
|
2464
|
+
ProjectType: "ProjectType",
|
|
2465
|
+
SolutionId: "SolutionId"
|
|
2466
|
+
};
|
|
2467
|
+
var ScopeDimensions = {
|
|
2468
|
+
FolderId: "FolderId"
|
|
2469
|
+
};
|
|
2470
|
+
var ID_DIMENSIONS = new Set([
|
|
2471
|
+
BaseDimensions.CloudUserId,
|
|
2472
|
+
BaseDimensions.CloudTenantId,
|
|
2473
|
+
BaseDimensions.CloudOrganizationId,
|
|
2474
|
+
BaseDimensions.InstallationId,
|
|
2475
|
+
ShipDimensions.ArtifactCorrelationKey,
|
|
2476
|
+
ShipDimensions.PackageVersionKey,
|
|
2477
|
+
ShipDimensions.DeploymentKey,
|
|
2478
|
+
ShipDimensions.SolutionId,
|
|
2479
|
+
ShipDimensions.FolderKey,
|
|
2480
|
+
ShipDimensions.FeedId,
|
|
2481
|
+
PackagerDimensions.ProjectId
|
|
2482
|
+
]);
|
|
2483
|
+
var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
|
|
2484
|
+
var RESERVED_DIMENSION_NAMES = new Set([
|
|
2485
|
+
...Object.values(BaseDimensions),
|
|
2486
|
+
...Object.values(CommandDimensions),
|
|
2487
|
+
...Object.values(ShipDimensions),
|
|
2488
|
+
...Object.values(ProjectDimensions),
|
|
2489
|
+
...Object.values(ErrorDimensions),
|
|
2490
|
+
...Object.values(AuthDimensions),
|
|
2491
|
+
...Object.values(SkillsDimensions),
|
|
2492
|
+
...Object.values(PackagerDimensions),
|
|
2493
|
+
...Object.values(ScopeDimensions)
|
|
2494
|
+
]);
|
|
2495
|
+
var CURATED_DIMENSIONS = new Set([
|
|
2496
|
+
BaseDimensions.ApplicationName,
|
|
2497
|
+
BaseDimensions.ProductVersion,
|
|
2498
|
+
BaseDimensions.InstallationId,
|
|
2499
|
+
BaseDimensions.CloudUserId,
|
|
2500
|
+
BaseDimensions.CloudTenantId,
|
|
2501
|
+
BaseDimensions.CloudOrganizationId,
|
|
2502
|
+
BaseDimensions.IsInternalUser,
|
|
2503
|
+
BaseDimensions.Environment,
|
|
2504
|
+
BaseDimensions.BaseUrl,
|
|
2505
|
+
BaseDimensions.Region,
|
|
2506
|
+
BaseDimensions.Agent,
|
|
2507
|
+
BaseDimensions.AgentVersion,
|
|
2508
|
+
BaseDimensions.ToolVersion,
|
|
2509
|
+
BaseDimensions.ExecutionContext,
|
|
2510
|
+
BaseDimensions.CiProvider,
|
|
2511
|
+
BaseDimensions.SessionIdSource,
|
|
2512
|
+
BaseDimensions.SessionId,
|
|
2513
|
+
...Object.values(CommandDimensions),
|
|
2514
|
+
...Object.values(ShipDimensions),
|
|
2515
|
+
...Object.values(ProjectDimensions)
|
|
2516
|
+
]);
|
|
2517
|
+
function lowercaseIdDimensionValues(properties) {
|
|
2518
|
+
let changed = false;
|
|
2519
|
+
const result = {
|
|
2520
|
+
...properties
|
|
2521
|
+
};
|
|
2522
|
+
for (const key of Object.keys(result)) {
|
|
2523
|
+
const value = result[key];
|
|
2524
|
+
if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
|
|
2525
|
+
continue;
|
|
2526
|
+
}
|
|
2527
|
+
const lowered = value.toLowerCase();
|
|
2528
|
+
if (lowered !== value) {
|
|
2529
|
+
result[key] = lowered;
|
|
2530
|
+
changed = true;
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2533
|
+
return changed ? result : properties;
|
|
2534
|
+
}
|
|
2535
|
+
|
|
2536
|
+
// ../common/src/telemetry/project-identity.ts
|
|
2537
|
+
function projectKey(id) {
|
|
2538
|
+
if (typeof id !== "string")
|
|
2539
|
+
return;
|
|
2540
|
+
const key = id.trim().toLowerCase().replaceAll("-", "");
|
|
2541
|
+
return /^[0-9a-f]{32}$/.test(key) ? key : undefined;
|
|
2542
|
+
}
|
|
2543
|
+
function projectIdentityProperties(identity) {
|
|
2544
|
+
const key = identity.id ? projectKey(identity.id) : undefined;
|
|
2545
|
+
return {
|
|
2546
|
+
[ProjectDimensions.ProjectIdentityStatus]: identity.status === "resolved" && !key ? "invalid" : identity.status,
|
|
2547
|
+
[ProjectDimensions.ProjectType]: identity.projectType,
|
|
2548
|
+
...identity.status === "resolved" && key ? {
|
|
2549
|
+
[ProjectDimensions.ProjectKey]: key
|
|
2550
|
+
} : {}
|
|
2551
|
+
};
|
|
2552
|
+
}
|
|
2553
|
+
var PROJECT_IDENTITY_LOOKUP_BUDGET_MS = 1000;
|
|
2554
|
+
async function withinProjectIdentityBudget(work, onTimeout) {
|
|
2555
|
+
work.catch(() => {
|
|
2556
|
+
return;
|
|
2557
|
+
});
|
|
2558
|
+
let timer;
|
|
2559
|
+
const expired = new Promise((resolve) => {
|
|
2560
|
+
timer = setTimeout(() => {
|
|
2561
|
+
onTimeout?.();
|
|
2562
|
+
resolve(undefined);
|
|
2563
|
+
}, PROJECT_IDENTITY_LOOKUP_BUDGET_MS);
|
|
2564
|
+
});
|
|
2565
|
+
try {
|
|
2566
|
+
return await Promise.race([work, expired]);
|
|
2567
|
+
} finally {
|
|
2568
|
+
clearTimeout(timer);
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2571
|
+
|
|
2572
|
+
// ../common/src/telemetry/pseudonymize.ts
|
|
2573
|
+
var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
|
|
2574
|
+
var PSEUDONYM_HEX_LENGTH = 32;
|
|
2575
|
+
var SHA256_K = new Uint32Array([
|
|
2576
|
+
1116352408,
|
|
2577
|
+
1899447441,
|
|
2578
|
+
3049323471,
|
|
2579
|
+
3921009573,
|
|
2580
|
+
961987163,
|
|
2581
|
+
1508970993,
|
|
2582
|
+
2453635748,
|
|
2583
|
+
2870763221,
|
|
2584
|
+
3624381080,
|
|
2585
|
+
310598401,
|
|
2586
|
+
607225278,
|
|
2587
|
+
1426881987,
|
|
2588
|
+
1925078388,
|
|
2589
|
+
2162078206,
|
|
2590
|
+
2614888103,
|
|
2591
|
+
3248222580,
|
|
2592
|
+
3835390401,
|
|
2593
|
+
4022224774,
|
|
2594
|
+
264347078,
|
|
2595
|
+
604807628,
|
|
2596
|
+
770255983,
|
|
2597
|
+
1249150122,
|
|
2598
|
+
1555081692,
|
|
2599
|
+
1996064986,
|
|
2600
|
+
2554220882,
|
|
2601
|
+
2821834349,
|
|
2602
|
+
2952996808,
|
|
2603
|
+
3210313671,
|
|
2604
|
+
3336571891,
|
|
2605
|
+
3584528711,
|
|
2606
|
+
113926993,
|
|
2607
|
+
338241895,
|
|
2608
|
+
666307205,
|
|
2609
|
+
773529912,
|
|
2610
|
+
1294757372,
|
|
2611
|
+
1396182291,
|
|
2612
|
+
1695183700,
|
|
2613
|
+
1986661051,
|
|
2614
|
+
2177026350,
|
|
2615
|
+
2456956037,
|
|
2616
|
+
2730485921,
|
|
2617
|
+
2820302411,
|
|
2618
|
+
3259730800,
|
|
2619
|
+
3345764771,
|
|
2620
|
+
3516065817,
|
|
2621
|
+
3600352804,
|
|
2622
|
+
4094571909,
|
|
2623
|
+
275423344,
|
|
2624
|
+
430227734,
|
|
2625
|
+
506948616,
|
|
2626
|
+
659060556,
|
|
2627
|
+
883997877,
|
|
2628
|
+
958139571,
|
|
2629
|
+
1322822218,
|
|
2630
|
+
1537002063,
|
|
2631
|
+
1747873779,
|
|
2632
|
+
1955562222,
|
|
2633
|
+
2024104815,
|
|
2634
|
+
2227730452,
|
|
2635
|
+
2361852424,
|
|
2636
|
+
2428436474,
|
|
2637
|
+
2756734187,
|
|
2638
|
+
3204031479,
|
|
2639
|
+
3329325298
|
|
2640
|
+
]);
|
|
2641
|
+
var SHA256_INITIAL_STATE = new Uint32Array([
|
|
2642
|
+
1779033703,
|
|
2643
|
+
3144134277,
|
|
2644
|
+
1013904242,
|
|
2645
|
+
2773480762,
|
|
2646
|
+
1359893119,
|
|
2647
|
+
2600822924,
|
|
2648
|
+
528734635,
|
|
2649
|
+
1541459225
|
|
2650
|
+
]);
|
|
2651
|
+
function rotr(value, bits) {
|
|
2652
|
+
return (value >>> bits | value << 32 - bits) >>> 0;
|
|
2653
|
+
}
|
|
2654
|
+
function sha256Hex(input) {
|
|
2655
|
+
const bytes = new TextEncoder().encode(input);
|
|
2656
|
+
const paddedLength = bytes.length + 9 + 63 >> 6 << 6;
|
|
2657
|
+
const buffer = new Uint8Array(paddedLength);
|
|
2658
|
+
buffer.set(bytes);
|
|
2659
|
+
buffer[bytes.length] = 128;
|
|
2660
|
+
const view = new DataView(buffer.buffer);
|
|
2661
|
+
const bitLength = bytes.length * 8;
|
|
2662
|
+
view.setUint32(paddedLength - 8, Math.floor(bitLength / 4294967296));
|
|
2663
|
+
view.setUint32(paddedLength - 4, bitLength >>> 0);
|
|
2664
|
+
const state = SHA256_INITIAL_STATE.slice();
|
|
2665
|
+
const schedule = new Uint32Array(64);
|
|
2666
|
+
for (let offset = 0;offset < paddedLength; offset += 64) {
|
|
2667
|
+
for (let i = 0;i < 16; i++) {
|
|
2668
|
+
schedule[i] = view.getUint32(offset + i * 4);
|
|
2669
|
+
}
|
|
2670
|
+
for (let i = 16;i < 64; i++) {
|
|
2671
|
+
const x = schedule[i - 15];
|
|
2672
|
+
const y = schedule[i - 2];
|
|
2673
|
+
const s0 = (rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3) >>> 0;
|
|
2674
|
+
const s1 = (rotr(y, 17) ^ rotr(y, 19) ^ y >>> 10) >>> 0;
|
|
2675
|
+
schedule[i] = schedule[i - 16] + s0 + schedule[i - 7] + s1 >>> 0;
|
|
2676
|
+
}
|
|
2677
|
+
let a = state[0];
|
|
2678
|
+
let b = state[1];
|
|
2679
|
+
let c = state[2];
|
|
2680
|
+
let d = state[3];
|
|
2681
|
+
let e = state[4];
|
|
2682
|
+
let f = state[5];
|
|
2683
|
+
let g = state[6];
|
|
2684
|
+
let h = state[7];
|
|
2685
|
+
for (let i = 0;i < 64; i++) {
|
|
2686
|
+
const s1 = (rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25)) >>> 0;
|
|
2687
|
+
const ch = (e & f ^ ~e & g) >>> 0;
|
|
2688
|
+
const temp1 = h + s1 + ch + SHA256_K[i] + schedule[i] >>> 0;
|
|
2689
|
+
const s0 = (rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) >>> 0;
|
|
2690
|
+
const maj = (a & b ^ a & c ^ b & c) >>> 0;
|
|
2691
|
+
const temp2 = s0 + maj >>> 0;
|
|
2692
|
+
h = g;
|
|
2693
|
+
g = f;
|
|
2694
|
+
f = e;
|
|
2695
|
+
e = d + temp1 >>> 0;
|
|
2696
|
+
d = c;
|
|
2697
|
+
c = b;
|
|
2698
|
+
b = a;
|
|
2699
|
+
a = temp1 + temp2 >>> 0;
|
|
2700
|
+
}
|
|
2701
|
+
state[0] = state[0] + a >>> 0;
|
|
2702
|
+
state[1] = state[1] + b >>> 0;
|
|
2703
|
+
state[2] = state[2] + c >>> 0;
|
|
2704
|
+
state[3] = state[3] + d >>> 0;
|
|
2705
|
+
state[4] = state[4] + e >>> 0;
|
|
2706
|
+
state[5] = state[5] + f >>> 0;
|
|
2707
|
+
state[6] = state[6] + g >>> 0;
|
|
2708
|
+
state[7] = state[7] + h >>> 0;
|
|
2709
|
+
}
|
|
2710
|
+
let hex = "";
|
|
2711
|
+
for (const word of state) {
|
|
2712
|
+
hex += word.toString(16).padStart(8, "0");
|
|
2713
|
+
}
|
|
2714
|
+
return hex;
|
|
2715
|
+
}
|
|
2716
|
+
function resolveSha256Hex() {
|
|
2717
|
+
try {
|
|
2718
|
+
const nodeCrypto = __require("node:crypto");
|
|
2719
|
+
const createHash = nodeCrypto?.createHash;
|
|
2720
|
+
if (typeof createHash !== "function") {
|
|
2721
|
+
return sha256Hex;
|
|
2722
|
+
}
|
|
2723
|
+
const native = (input) => createHash("sha256").update(input, "utf8").digest("hex");
|
|
2724
|
+
return native("abc") === sha256Hex("abc") ? native : sha256Hex;
|
|
2725
|
+
} catch {
|
|
2726
|
+
return sha256Hex;
|
|
2727
|
+
}
|
|
2728
|
+
}
|
|
2729
|
+
var cachedSha256Hex;
|
|
2730
|
+
function digest(input) {
|
|
2731
|
+
cachedSha256Hex ??= resolveSha256Hex();
|
|
2732
|
+
return cachedSha256Hex(input);
|
|
2733
|
+
}
|
|
2734
|
+
function pseudonymize(input) {
|
|
2735
|
+
return digest(`${PSEUDONYM_DOMAIN}${input}`).slice(0, PSEUDONYM_HEX_LENGTH);
|
|
2736
|
+
}
|
|
2737
|
+
|
|
2738
|
+
// ../common/src/singleton.ts
|
|
2739
|
+
var PREFIX = "@uipath/common/";
|
|
2740
|
+
var _g = globalThis;
|
|
2741
|
+
function singleton(ctorOrName) {
|
|
2742
|
+
const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
|
|
2743
|
+
const key = Symbol.for(PREFIX + name);
|
|
2744
|
+
return {
|
|
2745
|
+
get(fallback) {
|
|
2746
|
+
return _g[key] ?? fallback;
|
|
2747
|
+
},
|
|
2748
|
+
set(value) {
|
|
2749
|
+
_g[key] = value;
|
|
2750
|
+
},
|
|
2751
|
+
clear() {
|
|
2752
|
+
delete _g[key];
|
|
2753
|
+
},
|
|
2754
|
+
getOrInit(factory, guard) {
|
|
2755
|
+
const existing = _g[key];
|
|
2756
|
+
if (existing != null && typeof existing === "object") {
|
|
2757
|
+
if (!guard || guard(existing)) {
|
|
2758
|
+
return existing;
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
const instance = factory();
|
|
2762
|
+
_g[key] = instance;
|
|
2763
|
+
return instance;
|
|
2764
|
+
}
|
|
2765
|
+
};
|
|
2766
|
+
}
|
|
2767
|
+
|
|
2768
|
+
// ../common/src/telemetry/supplied-values.ts
|
|
2769
|
+
var suppliedValuesSlot = singleton("TelemetrySuppliedArgumentValues");
|
|
2770
|
+
function activeEntries() {
|
|
2771
|
+
const existing = suppliedValuesSlot.get();
|
|
2772
|
+
return Array.isArray(existing) ? existing : [];
|
|
2773
|
+
}
|
|
2774
|
+
var MIN_SCRUBBABLE_LENGTH = 4;
|
|
2775
|
+
function recordSuppliedArgumentValues(values) {
|
|
2776
|
+
const flat = [];
|
|
2777
|
+
const push = (value) => {
|
|
2778
|
+
if (Array.isArray(value)) {
|
|
2779
|
+
for (const item of value) {
|
|
2780
|
+
push(item);
|
|
2781
|
+
}
|
|
2782
|
+
return;
|
|
2783
|
+
}
|
|
2784
|
+
if (typeof value === "string" && value.length >= MIN_SCRUBBABLE_LENGTH) {
|
|
2785
|
+
flat.push(value);
|
|
2786
|
+
}
|
|
2787
|
+
};
|
|
2788
|
+
push(values);
|
|
2789
|
+
const entry = { values: flat };
|
|
2790
|
+
suppliedValuesSlot.set([...activeEntries(), entry]);
|
|
2791
|
+
return entry;
|
|
2323
2792
|
}
|
|
2324
2793
|
function releaseSuppliedArgumentValues(entry) {
|
|
2325
2794
|
suppliedValuesSlot.set(activeEntries().filter((held) => held !== entry));
|
|
@@ -2563,6 +3032,8 @@ function redactProperty(name, value) {
|
|
|
2563
3032
|
if (isSensitiveName(name)) {
|
|
2564
3033
|
return REDACTED;
|
|
2565
3034
|
}
|
|
3035
|
+
if (GUID_KEY_DIMENSIONS.has(name))
|
|
3036
|
+
return projectKey(value);
|
|
2566
3037
|
if (typeof value === "boolean" || typeof value === "number") {
|
|
2567
3038
|
return value;
|
|
2568
3039
|
}
|
|
@@ -2619,7 +3090,7 @@ function toError(error) {
|
|
|
2619
3090
|
function isPromiseLike(value) {
|
|
2620
3091
|
return value !== null && typeof value === "object" && typeof value.then === "function";
|
|
2621
3092
|
}
|
|
2622
|
-
function
|
|
3093
|
+
function catchError2(fnOrPromise) {
|
|
2623
3094
|
if (isPromiseLike(fnOrPromise)) {
|
|
2624
3095
|
return settlePromiseLike(fnOrPromise);
|
|
2625
3096
|
}
|
|
@@ -2637,9 +3108,78 @@ function settlePromiseLike(thenable) {
|
|
|
2637
3108
|
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
|
|
2638
3109
|
}
|
|
2639
3110
|
|
|
3111
|
+
// ../common/src/result-types.ts
|
|
3112
|
+
var RESULTS = {
|
|
3113
|
+
Success: "Success",
|
|
3114
|
+
Failure: "Failure",
|
|
3115
|
+
ConfigError: "ConfigError",
|
|
3116
|
+
AuthenticationError: "AuthenticationError",
|
|
3117
|
+
ValidationError: "ValidationError",
|
|
3118
|
+
TimeoutError: "TimeoutError"
|
|
3119
|
+
};
|
|
3120
|
+
|
|
3121
|
+
// ../../node_modules/commander/index.js
|
|
3122
|
+
var exports_commander = {};
|
|
3123
|
+
__exportCjs(exports_commander, {
|
|
3124
|
+
program: () => $program,
|
|
3125
|
+
createCommand: () => $createCommand,
|
|
3126
|
+
createOption: () => $createOption,
|
|
3127
|
+
createArgument: () => $createArgument,
|
|
3128
|
+
Command: () => $Command,
|
|
3129
|
+
Option: () => $Option,
|
|
3130
|
+
Argument: () => $Argument,
|
|
3131
|
+
Help: () => $Help,
|
|
3132
|
+
CommanderError: () => $CommanderError,
|
|
3133
|
+
InvalidArgumentError: () => $InvalidArgumentError,
|
|
3134
|
+
InvalidOptionArgumentError: () => $InvalidOptionArgumentError
|
|
3135
|
+
}, {
|
|
3136
|
+
program: (value) => $program = value,
|
|
3137
|
+
createCommand: (value) => $createCommand = value,
|
|
3138
|
+
createOption: (value) => $createOption = value,
|
|
3139
|
+
createArgument: (value) => $createArgument = value,
|
|
3140
|
+
Command: (value) => $Command = value,
|
|
3141
|
+
Option: (value) => $Option = value,
|
|
3142
|
+
Argument: (value) => $Argument = value,
|
|
3143
|
+
Help: (value) => $Help = value,
|
|
3144
|
+
CommanderError: (value) => $CommanderError = value,
|
|
3145
|
+
InvalidArgumentError: (value) => $InvalidArgumentError = value,
|
|
3146
|
+
InvalidOptionArgumentError: (value) => $InvalidOptionArgumentError = value
|
|
3147
|
+
});
|
|
3148
|
+
var { Argument } = require_argument();
|
|
3149
|
+
var { Command } = require_command();
|
|
3150
|
+
var { CommanderError, InvalidArgumentError } = require_error();
|
|
3151
|
+
var { Help } = require_help();
|
|
3152
|
+
var { Option: Option2 } = require_option();
|
|
3153
|
+
var $program = new Command;
|
|
3154
|
+
var $createCommand = (name) => new Command(name);
|
|
3155
|
+
var $createOption = (flags, description) => new Option2(flags, description);
|
|
3156
|
+
var $createArgument = (name, description) => new Argument(name, description);
|
|
3157
|
+
var $Command = Command;
|
|
3158
|
+
var $Option = Option2;
|
|
3159
|
+
var $Argument = Argument;
|
|
3160
|
+
var $Help = Help;
|
|
3161
|
+
var $CommanderError = CommanderError;
|
|
3162
|
+
var $InvalidArgumentError = InvalidArgumentError;
|
|
3163
|
+
var $InvalidOptionArgumentError = InvalidArgumentError;
|
|
3164
|
+
|
|
3165
|
+
// ../../node_modules/commander/esm.mjs
|
|
3166
|
+
var {
|
|
3167
|
+
program,
|
|
3168
|
+
createCommand,
|
|
3169
|
+
createArgument,
|
|
3170
|
+
createOption,
|
|
3171
|
+
CommanderError: CommanderError2,
|
|
3172
|
+
InvalidArgumentError: InvalidArgumentError2,
|
|
3173
|
+
InvalidOptionArgumentError,
|
|
3174
|
+
Command: Command2,
|
|
3175
|
+
Argument: Argument2,
|
|
3176
|
+
Option,
|
|
3177
|
+
Help: Help2
|
|
3178
|
+
} = exports_commander;
|
|
3179
|
+
|
|
2640
3180
|
// ../common/src/output-context.ts
|
|
2641
3181
|
function createStorage() {
|
|
2642
|
-
const [error, mod] =
|
|
3182
|
+
const [error, mod] = catchError2(() => __require("node:async_hooks"));
|
|
2643
3183
|
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
2644
3184
|
return {
|
|
2645
3185
|
getStore: () => {
|
|
@@ -2708,7 +3248,7 @@ class SimpleLogger {
|
|
|
2708
3248
|
}
|
|
2709
3249
|
return DEFAULT_LOG_LEVEL;
|
|
2710
3250
|
}
|
|
2711
|
-
const [localStorageError, hasDebug] =
|
|
3251
|
+
const [localStorageError, hasDebug] = catchError2(() => typeof localStorage !== "undefined" && !!localStorage.getItem("debug"));
|
|
2712
3252
|
if (!localStorageError && hasDebug) {
|
|
2713
3253
|
return 0 /* DEBUG */;
|
|
2714
3254
|
}
|
|
@@ -2804,7 +3344,7 @@ class SimpleLogger {
|
|
|
2804
3344
|
this.fileLoggingEnabled = true;
|
|
2805
3345
|
const fs = getFileSystem();
|
|
2806
3346
|
this.pendingInit = (async () => {
|
|
2807
|
-
const [error] = await
|
|
3347
|
+
const [error] = await catchError2((async () => {
|
|
2808
3348
|
await fs.mkdir(fs.path.dirname(path));
|
|
2809
3349
|
await fs.writeFile(path, "");
|
|
2810
3350
|
})());
|
|
@@ -2869,40 +3409,61 @@ function getOutputFilter() {
|
|
|
2869
3409
|
return filterSlot.get();
|
|
2870
3410
|
}
|
|
2871
3411
|
|
|
2872
|
-
// ../common/src/
|
|
2873
|
-
|
|
2874
|
-
|
|
3412
|
+
// ../common/src/error-codes.ts
|
|
3413
|
+
var CLI_ERROR_CODES = [
|
|
3414
|
+
"invalid_argument",
|
|
3415
|
+
"authentication_required",
|
|
3416
|
+
"permission_denied",
|
|
3417
|
+
"local_permission_denied",
|
|
3418
|
+
"not_found",
|
|
3419
|
+
"rate_limited",
|
|
3420
|
+
"network_error",
|
|
3421
|
+
"timeout",
|
|
3422
|
+
"server_error",
|
|
3423
|
+
"method_not_allowed",
|
|
3424
|
+
"not_supported",
|
|
3425
|
+
"configuration_error",
|
|
3426
|
+
"execution_failed",
|
|
3427
|
+
"unknown_error"
|
|
3428
|
+
];
|
|
3429
|
+
var RETRY_HINTS = [
|
|
3430
|
+
"RetryWillNotFix",
|
|
3431
|
+
"RetryLater",
|
|
3432
|
+
"RetryAfter1Second",
|
|
3433
|
+
"RetryAfter10Seconds",
|
|
3434
|
+
"RetryAfter30Seconds",
|
|
3435
|
+
"RetryAfter60Seconds"
|
|
3436
|
+
];
|
|
3437
|
+
var CLI_ERROR_CODE_VALUES = new Set(CLI_ERROR_CODES);
|
|
3438
|
+
var RETRY_HINT_VALUES = new Set(RETRY_HINTS);
|
|
3439
|
+
function isCliErrorCode(value) {
|
|
3440
|
+
return typeof value === "string" && CLI_ERROR_CODE_VALUES.has(value);
|
|
2875
3441
|
}
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
var LOCAL_PERMISSION_ERROR_CODES = new Set([
|
|
2879
|
-
"EACCES",
|
|
2880
|
-
"EPERM",
|
|
2881
|
-
"EROFS"
|
|
2882
|
-
]);
|
|
2883
|
-
|
|
2884
|
-
// ../common/src/output-codecs.ts
|
|
2885
|
-
var yamlSlot = singleton("YamlCodec");
|
|
2886
|
-
var jmespathSlot = singleton("JmespathCodec");
|
|
2887
|
-
async function loadOutputCodecsAsync(needed) {
|
|
2888
|
-
const loads = [];
|
|
2889
|
-
if (needed.yaml && yamlSlot.get() === undefined) {
|
|
2890
|
-
loads.push(import("./js-yaml-88tdqrtd.js").then((mod) => {
|
|
2891
|
-
yamlSlot.set(mod);
|
|
2892
|
-
}));
|
|
2893
|
-
}
|
|
2894
|
-
if (needed.filter && jmespathSlot.get() === undefined) {
|
|
2895
|
-
loads.push(import("./jmespath-231m3hyn.js").then((m)=>__toESM(m.default,1)).then((mod) => {
|
|
2896
|
-
jmespathSlot.set(mod);
|
|
2897
|
-
}));
|
|
2898
|
-
}
|
|
2899
|
-
await Promise.all(loads);
|
|
3442
|
+
function isRetryHint(value) {
|
|
3443
|
+
return typeof value === "string" && RETRY_HINT_VALUES.has(value);
|
|
2900
3444
|
}
|
|
2901
|
-
function
|
|
2902
|
-
|
|
3445
|
+
function carriedErrorCode(error) {
|
|
3446
|
+
if (!error || typeof error !== "object")
|
|
3447
|
+
return;
|
|
3448
|
+
const code = error.errorCode;
|
|
3449
|
+
return isCliErrorCode(code) ? code : undefined;
|
|
2903
3450
|
}
|
|
2904
|
-
function
|
|
2905
|
-
|
|
3451
|
+
function carriedRetry(error) {
|
|
3452
|
+
if (!error || typeof error !== "object")
|
|
3453
|
+
return;
|
|
3454
|
+
const retry = error.retry;
|
|
3455
|
+
return isRetryHint(retry) ? retry : undefined;
|
|
3456
|
+
}
|
|
3457
|
+
function defaultRetryForErrorCode(errorCode) {
|
|
3458
|
+
switch (errorCode) {
|
|
3459
|
+
case "network_error":
|
|
3460
|
+
case "rate_limited":
|
|
3461
|
+
case "server_error":
|
|
3462
|
+
case "timeout":
|
|
3463
|
+
return "RetryLater";
|
|
3464
|
+
default:
|
|
3465
|
+
return "RetryWillNotFix";
|
|
3466
|
+
}
|
|
2906
3467
|
}
|
|
2907
3468
|
|
|
2908
3469
|
// ../common/src/error-graph.ts
|
|
@@ -2917,185 +3478,194 @@ function* walkErrorGraph(error) {
|
|
|
2917
3478
|
continue;
|
|
2918
3479
|
seen.add(current);
|
|
2919
3480
|
const cur = current;
|
|
2920
|
-
yield cur;
|
|
2921
|
-
if (cur.cause !== undefined)
|
|
2922
|
-
queue.push(cur.cause);
|
|
2923
|
-
if (Array.isArray(cur.errors))
|
|
2924
|
-
queue.push(...cur.errors);
|
|
2925
|
-
}
|
|
2926
|
-
return;
|
|
2927
|
-
}
|
|
2928
|
-
function parseHttpStatusFromMessage(message) {
|
|
2929
|
-
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
2930
|
-
if (!match)
|
|
2931
|
-
return;
|
|
2932
|
-
const status = Number(match[1]);
|
|
2933
|
-
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
2934
|
-
}
|
|
2935
|
-
function findHttpStatusInGraph(error) {
|
|
2936
|
-
for (const node of walkErrorGraph(error)) {
|
|
2937
|
-
const response = node.response;
|
|
2938
|
-
const explicit = typeof node.status === "number" ? node.status : response?.status;
|
|
2939
|
-
if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
|
|
2940
|
-
return explicit;
|
|
2941
|
-
}
|
|
2942
|
-
if (typeof node.message === "string") {
|
|
2943
|
-
const parsed = parseHttpStatusFromMessage(node.message);
|
|
2944
|
-
if (parsed !== undefined && parsed >= 400) {
|
|
2945
|
-
return parsed;
|
|
2946
|
-
}
|
|
2947
|
-
}
|
|
2948
|
-
}
|
|
2949
|
-
return;
|
|
2950
|
-
}
|
|
2951
|
-
|
|
2952
|
-
// ../common/src/telemetry/telemetry-dimensions.ts
|
|
2953
|
-
var BaseDimensions = {
|
|
2954
|
-
ApplicationName: "ApplicationName",
|
|
2955
|
-
ProductVersion: "ProductVersion",
|
|
2956
|
-
InstallationId: "InstallationId",
|
|
2957
|
-
CloudUserId: "CloudUserId",
|
|
2958
|
-
CloudTenantId: "CloudTenantId",
|
|
2959
|
-
CloudOrganizationId: "CloudOrganizationId",
|
|
2960
|
-
IsInternalUser: "IsInternalUser",
|
|
2961
|
-
Environment: "Environment",
|
|
2962
|
-
BaseUrl: "BaseUrl",
|
|
2963
|
-
Region: "Region",
|
|
2964
|
-
Agent: "Agent",
|
|
2965
|
-
AgentVersion: "AgentVersion",
|
|
2966
|
-
AgentModel: "AgentModel",
|
|
2967
|
-
ToolName: "ToolName",
|
|
2968
|
-
ToolVersion: "ToolVersion",
|
|
2969
|
-
ExecutionContext: "ExecutionContext",
|
|
2970
|
-
CiProvider: "CiProvider",
|
|
2971
|
-
SessionIdSource: "SessionIdSource",
|
|
2972
|
-
SessionId: "SessionId"
|
|
2973
|
-
};
|
|
2974
|
-
var CommandDimensions = {
|
|
2975
|
-
IsCommand: "IsCommand",
|
|
2976
|
-
IsReexec: "IsReexec",
|
|
2977
|
-
CommandName: "CommandName",
|
|
2978
|
-
ExitCode: "ExitCode",
|
|
2979
|
-
TerminalOutcome: "TerminalOutcome",
|
|
2980
|
-
ErrorClass: "ErrorClass",
|
|
2981
|
-
TerminalSignal: "TerminalSignal",
|
|
2982
|
-
ErrorMessage: "ErrorMessage",
|
|
2983
|
-
SkillName: "SkillName",
|
|
2984
|
-
ProductArea: "ProductArea",
|
|
2985
|
-
Mode: "Mode"
|
|
2986
|
-
};
|
|
2987
|
-
var ShipDimensions = {
|
|
2988
|
-
ShipKind: "ShipKind",
|
|
2989
|
-
Target: "Target",
|
|
2990
|
-
ProjectType: "ProjectType",
|
|
2991
|
-
ProjectTypes: "ProjectTypes",
|
|
2992
|
-
ArtifactCorrelationKey: "ArtifactCorrelationKey",
|
|
2993
|
-
PackageName: "PackageName",
|
|
2994
|
-
PackageVersion: "PackageVersion",
|
|
2995
|
-
PackageVersionKey: "PackageVersionKey",
|
|
2996
|
-
DeploymentKey: "DeploymentKey",
|
|
2997
|
-
SolutionId: "SolutionId",
|
|
2998
|
-
FolderKey: "FolderKey",
|
|
2999
|
-
FeedId: "FeedId"
|
|
3000
|
-
};
|
|
3001
|
-
var ErrorDimensions = {
|
|
3002
|
-
Result: "Result",
|
|
3003
|
-
ErrorCode: "ErrorCode",
|
|
3004
|
-
Retry: "Retry",
|
|
3005
|
-
ErrorMessage: "ErrorMessage",
|
|
3006
|
-
HttpStatus: "HttpStatus",
|
|
3007
|
-
UpstreamErrorCode: "UpstreamErrorCode"
|
|
3008
|
-
};
|
|
3009
|
-
var AuthDimensions = {
|
|
3010
|
-
AuthenticationMethod: "AuthenticationMethod",
|
|
3011
|
-
Success: "Success",
|
|
3012
|
-
Reason: "Reason"
|
|
3013
|
-
};
|
|
3014
|
-
var SkillsDimensions = {
|
|
3015
|
-
SchemaVersion: "SchemaVersion",
|
|
3016
|
-
AgentType: "AgentType",
|
|
3017
|
-
SkillsVersion: "SkillsVersion",
|
|
3018
|
-
UipSubcommand: "UipSubcommand",
|
|
3019
|
-
FileExtension: "FileExtension",
|
|
3020
|
-
SubagentModel: "SubagentModel",
|
|
3021
|
-
SubagentType: "SubagentType",
|
|
3022
|
-
PermissionMode: "PermissionMode",
|
|
3023
|
-
EffortLevel: "EffortLevel",
|
|
3024
|
-
SessionSource: "SessionSource",
|
|
3025
|
-
Outcome: "Outcome",
|
|
3026
|
-
DurationMs: "DurationMs",
|
|
3027
|
-
Source: "Source"
|
|
3028
|
-
};
|
|
3029
|
-
var PackagerDimensions = {
|
|
3030
|
-
ProjectId: "ProjectId",
|
|
3031
|
-
ProjectType: "ProjectType",
|
|
3032
|
-
SolutionId: "SolutionId"
|
|
3033
|
-
};
|
|
3034
|
-
var ScopeDimensions = {
|
|
3035
|
-
FolderId: "FolderId"
|
|
3036
|
-
};
|
|
3037
|
-
var ID_DIMENSIONS = new Set([
|
|
3038
|
-
BaseDimensions.CloudUserId,
|
|
3039
|
-
BaseDimensions.CloudTenantId,
|
|
3040
|
-
BaseDimensions.CloudOrganizationId,
|
|
3041
|
-
BaseDimensions.InstallationId,
|
|
3042
|
-
ShipDimensions.ArtifactCorrelationKey,
|
|
3043
|
-
ShipDimensions.PackageVersionKey,
|
|
3044
|
-
ShipDimensions.DeploymentKey,
|
|
3045
|
-
ShipDimensions.SolutionId,
|
|
3046
|
-
ShipDimensions.FolderKey,
|
|
3047
|
-
ShipDimensions.FeedId,
|
|
3048
|
-
PackagerDimensions.ProjectId
|
|
3049
|
-
]);
|
|
3050
|
-
var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
|
|
3051
|
-
var RESERVED_DIMENSION_NAMES = new Set([
|
|
3052
|
-
...Object.values(BaseDimensions),
|
|
3053
|
-
...Object.values(CommandDimensions),
|
|
3054
|
-
...Object.values(ShipDimensions),
|
|
3055
|
-
...Object.values(ErrorDimensions),
|
|
3056
|
-
...Object.values(AuthDimensions),
|
|
3057
|
-
...Object.values(SkillsDimensions),
|
|
3058
|
-
...Object.values(PackagerDimensions),
|
|
3059
|
-
...Object.values(ScopeDimensions)
|
|
3060
|
-
]);
|
|
3061
|
-
var CURATED_DIMENSIONS = new Set([
|
|
3062
|
-
BaseDimensions.ApplicationName,
|
|
3063
|
-
BaseDimensions.ProductVersion,
|
|
3064
|
-
BaseDimensions.InstallationId,
|
|
3065
|
-
BaseDimensions.CloudUserId,
|
|
3066
|
-
BaseDimensions.CloudTenantId,
|
|
3067
|
-
BaseDimensions.CloudOrganizationId,
|
|
3068
|
-
BaseDimensions.IsInternalUser,
|
|
3069
|
-
BaseDimensions.Environment,
|
|
3070
|
-
BaseDimensions.BaseUrl,
|
|
3071
|
-
BaseDimensions.Region,
|
|
3072
|
-
BaseDimensions.Agent,
|
|
3073
|
-
BaseDimensions.AgentVersion,
|
|
3074
|
-
BaseDimensions.ToolVersion,
|
|
3075
|
-
BaseDimensions.ExecutionContext,
|
|
3076
|
-
BaseDimensions.CiProvider,
|
|
3077
|
-
BaseDimensions.SessionIdSource,
|
|
3078
|
-
BaseDimensions.SessionId,
|
|
3079
|
-
...Object.values(CommandDimensions),
|
|
3080
|
-
...Object.values(ShipDimensions)
|
|
3081
|
-
]);
|
|
3082
|
-
function lowercaseIdDimensionValues(properties) {
|
|
3083
|
-
let changed = false;
|
|
3084
|
-
const result = {
|
|
3085
|
-
...properties
|
|
3086
|
-
};
|
|
3087
|
-
for (const key of Object.keys(result)) {
|
|
3088
|
-
const value = result[key];
|
|
3089
|
-
if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
|
|
3090
|
-
continue;
|
|
3481
|
+
yield cur;
|
|
3482
|
+
if (cur.cause !== undefined)
|
|
3483
|
+
queue.push(cur.cause);
|
|
3484
|
+
if (Array.isArray(cur.errors))
|
|
3485
|
+
queue.push(...cur.errors);
|
|
3486
|
+
}
|
|
3487
|
+
return;
|
|
3488
|
+
}
|
|
3489
|
+
function parseHttpStatusFromMessage(message) {
|
|
3490
|
+
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
3491
|
+
if (!match)
|
|
3492
|
+
return;
|
|
3493
|
+
const status = Number(match[1]);
|
|
3494
|
+
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
3495
|
+
}
|
|
3496
|
+
function findHttpStatusInGraph(error) {
|
|
3497
|
+
for (const node of walkErrorGraph(error)) {
|
|
3498
|
+
const response = node.response;
|
|
3499
|
+
const explicit = typeof node.status === "number" ? node.status : response?.status;
|
|
3500
|
+
if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
|
|
3501
|
+
return explicit;
|
|
3091
3502
|
}
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3503
|
+
if (typeof node.message === "string") {
|
|
3504
|
+
const parsed = parseHttpStatusFromMessage(node.message);
|
|
3505
|
+
if (parsed !== undefined && parsed >= 400) {
|
|
3506
|
+
return parsed;
|
|
3507
|
+
}
|
|
3096
3508
|
}
|
|
3097
3509
|
}
|
|
3098
|
-
return
|
|
3510
|
+
return;
|
|
3511
|
+
}
|
|
3512
|
+
|
|
3513
|
+
// ../common/src/timings.ts
|
|
3514
|
+
var TIMINGS_ENV_VAR = "UIP_TIMINGS";
|
|
3515
|
+
function createStorage2() {
|
|
3516
|
+
const [error, mod] = catchError2(() => __require("node:async_hooks"));
|
|
3517
|
+
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
3518
|
+
return {
|
|
3519
|
+
getStore: () => {
|
|
3520
|
+
return;
|
|
3521
|
+
},
|
|
3522
|
+
run: (_store, fn) => fn()
|
|
3523
|
+
};
|
|
3524
|
+
}
|
|
3525
|
+
return new mod.AsyncLocalStorage;
|
|
3526
|
+
}
|
|
3527
|
+
var storageSlot = singleton("TimingStorage");
|
|
3528
|
+
var stateSlot = singleton("Timings");
|
|
3529
|
+
var rootStartedSlot = singleton("TimingsRootStarted");
|
|
3530
|
+
var longLivedHostSlot = singleton("TimingsLongLivedHost");
|
|
3531
|
+
var storage = storageSlot.getOrInit(createStorage2, (value) => ("getStore" in value));
|
|
3532
|
+
function newState(baseline) {
|
|
3533
|
+
return { baseline, httpMs: 0, httpCalls: 0 };
|
|
3534
|
+
}
|
|
3535
|
+
function getState() {
|
|
3536
|
+
const scoped = storage.getStore();
|
|
3537
|
+
if (scoped) {
|
|
3538
|
+
return scoped;
|
|
3539
|
+
}
|
|
3540
|
+
const pinned = livePinnedState();
|
|
3541
|
+
if (pinned !== undefined) {
|
|
3542
|
+
return pinned;
|
|
3543
|
+
}
|
|
3544
|
+
return newState(processStartIsInvocationStart() ? 0 : performance.now());
|
|
3545
|
+
}
|
|
3546
|
+
function livePinnedState() {
|
|
3547
|
+
const pinned = stateSlot.get();
|
|
3548
|
+
return pinned !== undefined && "httpCalls" in pinned && !pinned.finished ? pinned : undefined;
|
|
3549
|
+
}
|
|
3550
|
+
function processStartIsInvocationStart() {
|
|
3551
|
+
return !rootStartedSlot.get(false) && !longLivedHostSlot.get(false);
|
|
3552
|
+
}
|
|
3553
|
+
function timingsEnabled() {
|
|
3554
|
+
if (typeof process === "undefined") {
|
|
3555
|
+
return false;
|
|
3556
|
+
}
|
|
3557
|
+
const value = process.env?.[TIMINGS_ENV_VAR];
|
|
3558
|
+
if (value === undefined) {
|
|
3559
|
+
return false;
|
|
3560
|
+
}
|
|
3561
|
+
const normalized = value.trim().toLowerCase();
|
|
3562
|
+
return normalized === "1" || normalized === "true";
|
|
3563
|
+
}
|
|
3564
|
+
function recordExitCode(exitCode) {
|
|
3565
|
+
if (!timingsEnabled()) {
|
|
3566
|
+
return;
|
|
3567
|
+
}
|
|
3568
|
+
getState().exitCode = exitCode;
|
|
3569
|
+
}
|
|
3570
|
+
function invocationStartedAt() {
|
|
3571
|
+
return new Date(performance.timeOrigin + getState().baseline);
|
|
3572
|
+
}
|
|
3573
|
+
function invocationElapsedMs() {
|
|
3574
|
+
return performance.now() - getState().baseline;
|
|
3575
|
+
}
|
|
3576
|
+
function markCommandStart() {
|
|
3577
|
+
if (!timingsEnabled()) {
|
|
3578
|
+
return;
|
|
3579
|
+
}
|
|
3580
|
+
getState().commandStart = performance.now();
|
|
3581
|
+
}
|
|
3582
|
+
function recordCommandDuration(durationMs) {
|
|
3583
|
+
if (!timingsEnabled()) {
|
|
3584
|
+
return;
|
|
3585
|
+
}
|
|
3586
|
+
getState().commandMs = durationMs;
|
|
3587
|
+
}
|
|
3588
|
+
|
|
3589
|
+
// ../common/src/exit-code.ts
|
|
3590
|
+
function setExitCode(code) {
|
|
3591
|
+
process.exitCode = code;
|
|
3592
|
+
recordExitCode(code);
|
|
3593
|
+
}
|
|
3594
|
+
var GENERIC_FAILURE_EXIT_CODE = 1;
|
|
3595
|
+
function recordCommandExit(code) {
|
|
3596
|
+
if (code === GENERIC_FAILURE_EXIT_CODE && getExitCode() !== 0) {
|
|
3597
|
+
return;
|
|
3598
|
+
}
|
|
3599
|
+
setExitCode(code);
|
|
3600
|
+
}
|
|
3601
|
+
function getExitCode() {
|
|
3602
|
+
const code = process.exitCode;
|
|
3603
|
+
return typeof code === "number" ? code : 0;
|
|
3604
|
+
}
|
|
3605
|
+
|
|
3606
|
+
// ../common/src/http-status.ts
|
|
3607
|
+
function classifyHttpStatus(status) {
|
|
3608
|
+
if (status === undefined)
|
|
3609
|
+
return;
|
|
3610
|
+
if (status === 400 || status === 409 || status === 413 || status === 422) {
|
|
3611
|
+
return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
|
|
3612
|
+
}
|
|
3613
|
+
if (status === 401) {
|
|
3614
|
+
return {
|
|
3615
|
+
errorCode: "authentication_required",
|
|
3616
|
+
retry: "RetryWillNotFix"
|
|
3617
|
+
};
|
|
3618
|
+
}
|
|
3619
|
+
if (status === 403) {
|
|
3620
|
+
return { errorCode: "permission_denied", retry: "RetryWillNotFix" };
|
|
3621
|
+
}
|
|
3622
|
+
if (status === 404) {
|
|
3623
|
+
return { errorCode: "not_found", retry: "RetryWillNotFix" };
|
|
3624
|
+
}
|
|
3625
|
+
if (status === 405) {
|
|
3626
|
+
return { errorCode: "method_not_allowed", retry: "RetryWillNotFix" };
|
|
3627
|
+
}
|
|
3628
|
+
if (status === 408) {
|
|
3629
|
+
return { errorCode: "timeout", retry: "RetryLater" };
|
|
3630
|
+
}
|
|
3631
|
+
if (status === 429) {
|
|
3632
|
+
return { errorCode: "rate_limited", retry: "RetryLater" };
|
|
3633
|
+
}
|
|
3634
|
+
if (status >= 500 && status < 600) {
|
|
3635
|
+
return { errorCode: "server_error", retry: "RetryLater" };
|
|
3636
|
+
}
|
|
3637
|
+
return;
|
|
3638
|
+
}
|
|
3639
|
+
|
|
3640
|
+
// ../common/src/local-permission-codes.ts
|
|
3641
|
+
var LOCAL_PERMISSION_ERROR_CODES = new Set([
|
|
3642
|
+
"EACCES",
|
|
3643
|
+
"EPERM",
|
|
3644
|
+
"EROFS"
|
|
3645
|
+
]);
|
|
3646
|
+
|
|
3647
|
+
// ../common/src/output-codecs.ts
|
|
3648
|
+
var yamlSlot = singleton("YamlCodec");
|
|
3649
|
+
var jmespathSlot = singleton("JmespathCodec");
|
|
3650
|
+
async function loadOutputCodecsAsync(needed) {
|
|
3651
|
+
const loads = [];
|
|
3652
|
+
if (needed.yaml && yamlSlot.get() === undefined) {
|
|
3653
|
+
loads.push(import("./js-yaml-a2bk27p6.js").then((mod) => {
|
|
3654
|
+
yamlSlot.set(mod);
|
|
3655
|
+
}));
|
|
3656
|
+
}
|
|
3657
|
+
if (needed.filter && jmespathSlot.get() === undefined) {
|
|
3658
|
+
loads.push(import("./jmespath-ab6tdc42.js").then((m)=>__toESM(m.default,1)).then((mod) => {
|
|
3659
|
+
jmespathSlot.set(mod);
|
|
3660
|
+
}));
|
|
3661
|
+
}
|
|
3662
|
+
await Promise.all(loads);
|
|
3663
|
+
}
|
|
3664
|
+
function getYamlCodec() {
|
|
3665
|
+
return yamlSlot.get();
|
|
3666
|
+
}
|
|
3667
|
+
function getJmespathCodec() {
|
|
3668
|
+
return jmespathSlot.get();
|
|
3099
3669
|
}
|
|
3100
3670
|
|
|
3101
3671
|
// ../common/src/telemetry/command-terminal.ts
|
|
@@ -3216,17 +3786,8 @@ function terminalSignalFor(input, outcome) {
|
|
|
3216
3786
|
}
|
|
3217
3787
|
return outcome === "cancelled" ? "SIGINT" : undefined;
|
|
3218
3788
|
}
|
|
3219
|
-
function
|
|
3220
|
-
|
|
3221
|
-
return "auth";
|
|
3222
|
-
}
|
|
3223
|
-
if (status === 400 || status === 409 || status === 422) {
|
|
3224
|
-
return "validation";
|
|
3225
|
-
}
|
|
3226
|
-
if (status === 408) {
|
|
3227
|
-
return "timeout";
|
|
3228
|
-
}
|
|
3229
|
-
return "network_http";
|
|
3789
|
+
function classifyFailingHttpStatus(status) {
|
|
3790
|
+
return classifyFromErrorCode(classifyHttpStatus(status)?.errorCode) ?? "network_http";
|
|
3230
3791
|
}
|
|
3231
3792
|
function classifyFromResult(result) {
|
|
3232
3793
|
switch (result) {
|
|
@@ -3306,7 +3867,7 @@ function classifyError(input) {
|
|
|
3306
3867
|
}
|
|
3307
3868
|
const status = recorded?.context?.httpStatus ?? findHttpStatusInGraph(input.error);
|
|
3308
3869
|
if (status !== undefined) {
|
|
3309
|
-
return
|
|
3870
|
+
return classifyFailingHttpStatus(status);
|
|
3310
3871
|
}
|
|
3311
3872
|
return classifyFromResult(recorded?.result) ?? classifyFromErrorCode(recorded?.errorCode) ?? classifyFromError(input.error) ?? "unknown";
|
|
3312
3873
|
}
|
|
@@ -3338,6 +3899,7 @@ function buildCommandTerminalTelemetryProperties(input) {
|
|
|
3338
3899
|
var CommonTelemetryEvents = {
|
|
3339
3900
|
Start: "Application.Start",
|
|
3340
3901
|
Error: "Application.Error",
|
|
3902
|
+
ProjectActivity: "Cli.ProjectActivity",
|
|
3341
3903
|
ShipSucceeded: "Cli.ShipSucceeded"
|
|
3342
3904
|
};
|
|
3343
3905
|
|
|
@@ -3347,7 +3909,7 @@ function readRegistryValue(keyPath, valueName) {
|
|
|
3347
3909
|
if (process.platform !== "win32") {
|
|
3348
3910
|
return "";
|
|
3349
3911
|
}
|
|
3350
|
-
const [error, output] =
|
|
3912
|
+
const [error, output] = catchError2(() => execFileSync("reg", ["query", keyPath, "/v", valueName], {
|
|
3351
3913
|
encoding: "utf-8",
|
|
3352
3914
|
stdio: ["pipe", "pipe", "pipe"],
|
|
3353
3915
|
windowsHide: true
|
|
@@ -3834,101 +4396,26 @@ class TelemetryService {
|
|
|
3834
4396
|
const globalProperties = getGlobalTelemetryProperties();
|
|
3835
4397
|
const enriched = {
|
|
3836
4398
|
...getExecutionContextTelemetryProperties(),
|
|
3837
|
-
...globalProperties,
|
|
3838
|
-
...this.defaultProperties,
|
|
3839
|
-
...redactProperties(properties ?? {}),
|
|
3840
|
-
[TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
|
|
3841
|
-
[BaseDimensions.SessionId]: this.telemetryProvider.getSessionId?.() ?? getTelemetrySessionId()
|
|
3842
|
-
};
|
|
3843
|
-
return lowercaseIdDimensionValues(enriched);
|
|
3844
|
-
}
|
|
3845
|
-
generateId() {
|
|
3846
|
-
const bytes = new Uint8Array(8);
|
|
3847
|
-
let hex = "";
|
|
3848
|
-
do {
|
|
3849
|
-
crypto.getRandomValues(bytes);
|
|
3850
|
-
hex = "";
|
|
3851
|
-
for (const byte of bytes) {
|
|
3852
|
-
hex += byte.toString(16).padStart(2, "0");
|
|
3853
|
-
}
|
|
3854
|
-
} while (/^0+$/.test(hex));
|
|
3855
|
-
return hex;
|
|
3856
|
-
}
|
|
3857
|
-
}
|
|
3858
|
-
// ../common/src/timings.ts
|
|
3859
|
-
var TIMINGS_ENV_VAR = "UIP_TIMINGS";
|
|
3860
|
-
function createStorage2() {
|
|
3861
|
-
const [error, mod] = catchError(() => __require("node:async_hooks"));
|
|
3862
|
-
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
3863
|
-
return {
|
|
3864
|
-
getStore: () => {
|
|
3865
|
-
return;
|
|
3866
|
-
},
|
|
3867
|
-
run: (_store, fn) => fn()
|
|
3868
|
-
};
|
|
3869
|
-
}
|
|
3870
|
-
return new mod.AsyncLocalStorage;
|
|
3871
|
-
}
|
|
3872
|
-
var storageSlot = singleton("TimingStorage");
|
|
3873
|
-
var stateSlot = singleton("Timings");
|
|
3874
|
-
var rootStartedSlot = singleton("TimingsRootStarted");
|
|
3875
|
-
var longLivedHostSlot = singleton("TimingsLongLivedHost");
|
|
3876
|
-
var storage = storageSlot.getOrInit(createStorage2, (value) => ("getStore" in value));
|
|
3877
|
-
function newState(baseline) {
|
|
3878
|
-
return { baseline, httpMs: 0, httpCalls: 0 };
|
|
3879
|
-
}
|
|
3880
|
-
function getState() {
|
|
3881
|
-
const scoped = storage.getStore();
|
|
3882
|
-
if (scoped) {
|
|
3883
|
-
return scoped;
|
|
3884
|
-
}
|
|
3885
|
-
const pinned = livePinnedState();
|
|
3886
|
-
if (pinned !== undefined) {
|
|
3887
|
-
return pinned;
|
|
3888
|
-
}
|
|
3889
|
-
return newState(processStartIsInvocationStart() ? 0 : performance.now());
|
|
3890
|
-
}
|
|
3891
|
-
function livePinnedState() {
|
|
3892
|
-
const pinned = stateSlot.get();
|
|
3893
|
-
return pinned !== undefined && "httpCalls" in pinned && !pinned.finished ? pinned : undefined;
|
|
3894
|
-
}
|
|
3895
|
-
function processStartIsInvocationStart() {
|
|
3896
|
-
return !rootStartedSlot.get(false) && !longLivedHostSlot.get(false);
|
|
3897
|
-
}
|
|
3898
|
-
function timingsEnabled() {
|
|
3899
|
-
if (typeof process === "undefined") {
|
|
3900
|
-
return false;
|
|
3901
|
-
}
|
|
3902
|
-
const value = process.env?.[TIMINGS_ENV_VAR];
|
|
3903
|
-
if (value === undefined) {
|
|
3904
|
-
return false;
|
|
3905
|
-
}
|
|
3906
|
-
const normalized = value.trim().toLowerCase();
|
|
3907
|
-
return normalized === "1" || normalized === "true";
|
|
3908
|
-
}
|
|
3909
|
-
function recordExitCode(exitCode) {
|
|
3910
|
-
if (!timingsEnabled()) {
|
|
3911
|
-
return;
|
|
3912
|
-
}
|
|
3913
|
-
getState().exitCode = exitCode;
|
|
3914
|
-
}
|
|
3915
|
-
function invocationStartedAt() {
|
|
3916
|
-
return new Date(performance.timeOrigin + getState().baseline);
|
|
3917
|
-
}
|
|
3918
|
-
function invocationElapsedMs() {
|
|
3919
|
-
return performance.now() - getState().baseline;
|
|
3920
|
-
}
|
|
3921
|
-
function markCommandStart() {
|
|
3922
|
-
if (!timingsEnabled()) {
|
|
3923
|
-
return;
|
|
4399
|
+
...globalProperties,
|
|
4400
|
+
...this.defaultProperties,
|
|
4401
|
+
...redactProperties(properties ?? {}),
|
|
4402
|
+
[TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
|
|
4403
|
+
[BaseDimensions.SessionId]: this.telemetryProvider.getSessionId?.() ?? getTelemetrySessionId()
|
|
4404
|
+
};
|
|
4405
|
+
return lowercaseIdDimensionValues(enriched);
|
|
3924
4406
|
}
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
4407
|
+
generateId() {
|
|
4408
|
+
const bytes = new Uint8Array(8);
|
|
4409
|
+
let hex = "";
|
|
4410
|
+
do {
|
|
4411
|
+
crypto.getRandomValues(bytes);
|
|
4412
|
+
hex = "";
|
|
4413
|
+
for (const byte of bytes) {
|
|
4414
|
+
hex += byte.toString(16).padStart(2, "0");
|
|
4415
|
+
}
|
|
4416
|
+
} while (/^0+$/.test(hex));
|
|
4417
|
+
return hex;
|
|
3930
4418
|
}
|
|
3931
|
-
getState().commandMs = durationMs;
|
|
3932
4419
|
}
|
|
3933
4420
|
// ../common/src/telemetry/proxy-http-agent.ts
|
|
3934
4421
|
var slot = singleton("ProxyAuthHttpsAgent");
|
|
@@ -3936,6 +4423,15 @@ var slot = singleton("ProxyAuthHttpsAgent");
|
|
|
3936
4423
|
// ../common/src/telemetry/node-appinsights-telemetry-provider.ts
|
|
3937
4424
|
var providerSlot = singleton("TelemetryProvider");
|
|
3938
4425
|
|
|
4426
|
+
// ../common/src/telemetry/telemetry-config.ts
|
|
4427
|
+
function isTelemetryDisabled() {
|
|
4428
|
+
const value = process.env.UIPATH_TELEMETRY_DISABLED;
|
|
4429
|
+
return value === "1" || value === "true";
|
|
4430
|
+
}
|
|
4431
|
+
function isProjectTelemetryDisabled() {
|
|
4432
|
+
return isTelemetryDisabled() || process.env.UIPATH_PROJECT_TELEMETRY_DISABLED === "1" || process.env.UIPATH_PROJECT_TELEMETRY_DISABLED === "true";
|
|
4433
|
+
}
|
|
4434
|
+
|
|
3939
4435
|
// ../common/src/telemetry/telemetry-spool.ts
|
|
3940
4436
|
var sidecarEntrySlot = singleton("TelemetrySidecarEntry");
|
|
3941
4437
|
var MAX_SPOOL_AGE_MS = 72 * 60 * 60 * 1000;
|
|
@@ -3971,7 +4467,6 @@ var telemetry = new Proxy({}, {
|
|
|
3971
4467
|
return typeof value === "function" ? value.bind(instance) : value;
|
|
3972
4468
|
}
|
|
3973
4469
|
});
|
|
3974
|
-
|
|
3975
4470
|
// ../common/src/formatter.ts
|
|
3976
4471
|
var ANSI_STYLES = {
|
|
3977
4472
|
red: "\x1B[31m",
|
|
@@ -3981,46 +4476,6 @@ var ANSI_RESET = "\x1B[0m";
|
|
|
3981
4476
|
function styleLine(line, style) {
|
|
3982
4477
|
return style ? `${ANSI_STYLES[style]}${line}${ANSI_RESET}` : line;
|
|
3983
4478
|
}
|
|
3984
|
-
var CLI_ERROR_CODES = [
|
|
3985
|
-
"invalid_argument",
|
|
3986
|
-
"authentication_required",
|
|
3987
|
-
"permission_denied",
|
|
3988
|
-
"local_permission_denied",
|
|
3989
|
-
"not_found",
|
|
3990
|
-
"rate_limited",
|
|
3991
|
-
"network_error",
|
|
3992
|
-
"timeout",
|
|
3993
|
-
"server_error",
|
|
3994
|
-
"method_not_allowed",
|
|
3995
|
-
"not_supported",
|
|
3996
|
-
"configuration_error",
|
|
3997
|
-
"execution_failed",
|
|
3998
|
-
"unknown_error"
|
|
3999
|
-
];
|
|
4000
|
-
var RETRY_HINTS = [
|
|
4001
|
-
"RetryWillNotFix",
|
|
4002
|
-
"RetryLater",
|
|
4003
|
-
"RetryAfter1Second",
|
|
4004
|
-
"RetryAfter10Seconds",
|
|
4005
|
-
"RetryAfter30Seconds",
|
|
4006
|
-
"RetryAfter60Seconds"
|
|
4007
|
-
];
|
|
4008
|
-
var CLI_ERROR_CODE_VALUES = new Set(CLI_ERROR_CODES);
|
|
4009
|
-
var RETRY_HINT_VALUES = new Set(RETRY_HINTS);
|
|
4010
|
-
function isCliErrorCode(value) {
|
|
4011
|
-
return typeof value === "string" && CLI_ERROR_CODE_VALUES.has(value);
|
|
4012
|
-
}
|
|
4013
|
-
function isRetryHint(value) {
|
|
4014
|
-
return typeof value === "string" && RETRY_HINT_VALUES.has(value);
|
|
4015
|
-
}
|
|
4016
|
-
var RESULTS = {
|
|
4017
|
-
Success: "Success",
|
|
4018
|
-
Failure: "Failure",
|
|
4019
|
-
ConfigError: "ConfigError",
|
|
4020
|
-
AuthenticationError: "AuthenticationError",
|
|
4021
|
-
ValidationError: "ValidationError",
|
|
4022
|
-
TimeoutError: "TimeoutError"
|
|
4023
|
-
};
|
|
4024
4479
|
var EXIT_CODES = {
|
|
4025
4480
|
Success: 0,
|
|
4026
4481
|
Failure: 1,
|
|
@@ -4029,6 +4484,9 @@ var EXIT_CODES = {
|
|
|
4029
4484
|
ValidationError: 3,
|
|
4030
4485
|
TimeoutError: 4
|
|
4031
4486
|
};
|
|
4487
|
+
function exitCodeForResult(result) {
|
|
4488
|
+
return EXIT_CODES[result] ?? EXIT_CODES.Failure;
|
|
4489
|
+
}
|
|
4032
4490
|
function escapeNonAscii(jsonText) {
|
|
4033
4491
|
return jsonText.replace(/[\u0080-\uffff]/g, (c) => {
|
|
4034
4492
|
const hex = c.charCodeAt(0).toString(16).padStart(4, "0");
|
|
@@ -4620,7 +5078,7 @@ function availableFields(data) {
|
|
|
4620
5078
|
return [...keys];
|
|
4621
5079
|
}
|
|
4622
5080
|
function decodeQuotedIdentifier(whole, inner) {
|
|
4623
|
-
const [error, decoded] =
|
|
5081
|
+
const [error, decoded] = catchError2(() => JSON.parse(whole));
|
|
4624
5082
|
if (!error && typeof decoded === "string")
|
|
4625
5083
|
return decoded;
|
|
4626
5084
|
return inner.replace(/\\(.)/g, "$1");
|
|
@@ -4704,8 +5162,8 @@ function carriesOnlyNulls(value) {
|
|
|
4704
5162
|
}
|
|
4705
5163
|
return false;
|
|
4706
5164
|
}
|
|
4707
|
-
function nameList(names,
|
|
4708
|
-
const shown = names.slice(0,
|
|
5165
|
+
function nameList(names, cap = 12) {
|
|
5166
|
+
const shown = names.slice(0, cap).map((n) => `\`${n}\``);
|
|
4709
5167
|
const rest = names.length - shown.length;
|
|
4710
5168
|
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
4711
5169
|
}
|
|
@@ -4816,7 +5274,7 @@ function filterFailureData(envelope) {
|
|
|
4816
5274
|
if (!filter || data == null)
|
|
4817
5275
|
return;
|
|
4818
5276
|
let note;
|
|
4819
|
-
const [filterError, filtered] =
|
|
5277
|
+
const [filterError, filtered] = catchError2(() => applyFilter(data, filter, (n) => {
|
|
4820
5278
|
note = n;
|
|
4821
5279
|
}));
|
|
4822
5280
|
if (filterError) {
|
|
@@ -4842,40 +5300,11 @@ function defaultErrorCodeForResult(result) {
|
|
|
4842
5300
|
return "unknown_error";
|
|
4843
5301
|
}
|
|
4844
5302
|
}
|
|
4845
|
-
function parseHttpStatusFromMessage2(message) {
|
|
4846
|
-
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
4847
|
-
if (!match)
|
|
4848
|
-
return;
|
|
4849
|
-
const status = Number(match[1]);
|
|
4850
|
-
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
4851
|
-
}
|
|
4852
|
-
function defaultErrorCodeForHttpStatus(status) {
|
|
4853
|
-
if (status === undefined)
|
|
4854
|
-
return;
|
|
4855
|
-
if (status === 400 || status === 409 || status === 422) {
|
|
4856
|
-
return "invalid_argument";
|
|
4857
|
-
}
|
|
4858
|
-
if (status === 401)
|
|
4859
|
-
return "authentication_required";
|
|
4860
|
-
if (status === 403)
|
|
4861
|
-
return "permission_denied";
|
|
4862
|
-
if (status === 404)
|
|
4863
|
-
return "not_found";
|
|
4864
|
-
if (status === 405)
|
|
4865
|
-
return "method_not_allowed";
|
|
4866
|
-
if (status === 408)
|
|
4867
|
-
return "timeout";
|
|
4868
|
-
if (status === 429)
|
|
4869
|
-
return "rate_limited";
|
|
4870
|
-
if (status >= 500 && status < 600)
|
|
4871
|
-
return "server_error";
|
|
4872
|
-
return;
|
|
4873
|
-
}
|
|
4874
5303
|
var LOCAL_PERMISSION_TEXT_PATTERN = new RegExp(`(?:\\b|\\()(?:${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})(?::\\s|\\))`);
|
|
4875
5304
|
function defaultErrorCodeForFailure(data) {
|
|
4876
5305
|
if (data.Result === RESULTS.Failure) {
|
|
4877
|
-
const status = data.Context?.httpStatus ??
|
|
4878
|
-
const errorCode =
|
|
5306
|
+
const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage(data.Message);
|
|
5307
|
+
const errorCode = classifyHttpStatus(status)?.errorCode;
|
|
4879
5308
|
if (errorCode)
|
|
4880
5309
|
return errorCode;
|
|
4881
5310
|
if (status === undefined && (LOCAL_PERMISSION_TEXT_PATTERN.test(data.Message) || LOCAL_PERMISSION_TEXT_PATTERN.test(data.Instructions))) {
|
|
@@ -4884,17 +5313,6 @@ function defaultErrorCodeForFailure(data) {
|
|
|
4884
5313
|
}
|
|
4885
5314
|
return defaultErrorCodeForResult(data.Result);
|
|
4886
5315
|
}
|
|
4887
|
-
function defaultRetryForErrorCode(errorCode) {
|
|
4888
|
-
switch (errorCode) {
|
|
4889
|
-
case "network_error":
|
|
4890
|
-
case "rate_limited":
|
|
4891
|
-
case "server_error":
|
|
4892
|
-
case "timeout":
|
|
4893
|
-
return "RetryLater";
|
|
4894
|
-
default:
|
|
4895
|
-
return "RetryWillNotFix";
|
|
4896
|
-
}
|
|
4897
|
-
}
|
|
4898
5316
|
var OutputFormatter;
|
|
4899
5317
|
((OutputFormatter) => {
|
|
4900
5318
|
function success(data, options) {
|
|
@@ -4926,7 +5344,7 @@ var OutputFormatter;
|
|
|
4926
5344
|
data.Log ??= getLogFilePath() || undefined;
|
|
4927
5345
|
data.ErrorCode ??= defaultErrorCodeForFailure(data);
|
|
4928
5346
|
data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
|
|
4929
|
-
const exitCode =
|
|
5347
|
+
const exitCode = exitCodeForResult(data.Result);
|
|
4930
5348
|
setExitCode(exitCode);
|
|
4931
5349
|
recordCommandFailureTelemetry({
|
|
4932
5350
|
result: data.Result,
|
|
@@ -5022,6 +5440,13 @@ var OutputFormatter;
|
|
|
5022
5440
|
})(OutputFormatter ||= {});
|
|
5023
5441
|
|
|
5024
5442
|
// ../common/src/error-handler.ts
|
|
5443
|
+
var DEFAULT_401 = "Unauthorized (401). The session is missing or expired, or its token carries no scope for this API. Run `uip login status --detailed` to see the session and its scopes.";
|
|
5444
|
+
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.";
|
|
5445
|
+
var DEFAULT_405 = "Method Not Allowed (405). The endpoint may not exist or the base URL may be incorrect.";
|
|
5446
|
+
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.";
|
|
5447
|
+
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.";
|
|
5448
|
+
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.";
|
|
5449
|
+
var HTML_RESPONSE_MESSAGE = "Received HTML instead of the expected JSON response.";
|
|
5025
5450
|
var NETWORK_ERROR_CODES = new Set([
|
|
5026
5451
|
"ECONNREFUSED",
|
|
5027
5452
|
"ECONNRESET",
|
|
@@ -5046,29 +5471,544 @@ var TLS_ERROR_CODES2 = new Set([
|
|
|
5046
5471
|
var TLS_INSTRUCTIONS = "The server's TLS certificate could not be verified. Most often a " + "corporate proxy/firewall re-signs HTTPS with a root CA that Node does " + "not trust — set NODE_EXTRA_CA_CERTS to that CA's PEM file (and HTTPS_PROXY " + "if you connect through a proxy). If the certificate is instead expired or " + "its hostname does not match, fix the endpoint URL or the system clock. " + "Then retry.";
|
|
5047
5472
|
var NETWORK_INSTRUCTIONS = "Could not reach the UiPath service. Check your network connection and " + "VPN, confirm any HTTP_PROXY/HTTPS_PROXY/NO_PROXY settings are correct, " + "then retry.";
|
|
5048
5473
|
var LOCAL_PERMISSION_MESSAGE_PATTERN = new RegExp(`\\b(${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})\\b`);
|
|
5474
|
+
function localPermissionInstructions(code, path) {
|
|
5475
|
+
const target = path !== undefined ? `'${path}'` : "a local file or resource";
|
|
5476
|
+
if (code === "EROFS") {
|
|
5477
|
+
return `The filesystem containing ${target} is read-only (EROFS), so the ` + "CLI could not write to it. This is a local environment problem, " + "not a UiPath service error — retrying will not help. Use a " + "writable location, or give this environment write access to the " + "path.";
|
|
5478
|
+
}
|
|
5479
|
+
const onWindows = typeof process !== "undefined" && process.platform === "win32";
|
|
5480
|
+
const remedy = onWindows ? "Re-run from an elevated terminal, close any program holding " + "the file open, or grant your user access to the path." : "Grant this user (or the sandbox the command runs in) access " + "to the path, or run the command outside the sandbox.";
|
|
5481
|
+
return `The operating system denied access to ${target} (${code}). This is ` + "a local permission problem, not a UiPath service error — retrying " + `without a permission change will not help. ${remedy}`;
|
|
5482
|
+
}
|
|
5483
|
+
function describeConnectivityError(error) {
|
|
5484
|
+
for (const cur of walkErrorGraph(error)) {
|
|
5485
|
+
const code = typeof cur.code === "string" ? cur.code : undefined;
|
|
5486
|
+
const message = typeof cur.message === "string" ? cur.message : undefined;
|
|
5487
|
+
if (code && TLS_ERROR_CODES2.has(code)) {
|
|
5488
|
+
return {
|
|
5489
|
+
code,
|
|
5490
|
+
kind: "tls",
|
|
5491
|
+
message: message ?? code,
|
|
5492
|
+
instructions: TLS_INSTRUCTIONS
|
|
5493
|
+
};
|
|
5494
|
+
}
|
|
5495
|
+
if (code && NETWORK_ERROR_CODES.has(code)) {
|
|
5496
|
+
return {
|
|
5497
|
+
code,
|
|
5498
|
+
kind: "network",
|
|
5499
|
+
message: message ?? code,
|
|
5500
|
+
instructions: NETWORK_INSTRUCTIONS
|
|
5501
|
+
};
|
|
5502
|
+
}
|
|
5503
|
+
}
|
|
5504
|
+
return;
|
|
5505
|
+
}
|
|
5506
|
+
function describePermissionError(error) {
|
|
5507
|
+
for (const cur of walkErrorGraph(error)) {
|
|
5508
|
+
const message = typeof cur.message === "string" ? cur.message : undefined;
|
|
5509
|
+
const code = matchLocalPermissionCode(cur.code, message);
|
|
5510
|
+
if (!code)
|
|
5511
|
+
continue;
|
|
5512
|
+
const path = localPermissionPath(cur.path, message);
|
|
5513
|
+
return {
|
|
5514
|
+
code,
|
|
5515
|
+
message: message ?? code,
|
|
5516
|
+
...path !== undefined ? { path } : {},
|
|
5517
|
+
instructions: localPermissionInstructions(code, path)
|
|
5518
|
+
};
|
|
5519
|
+
}
|
|
5520
|
+
return;
|
|
5521
|
+
}
|
|
5522
|
+
function matchLocalPermissionCode(code, message) {
|
|
5523
|
+
if (typeof code === "string" && LOCAL_PERMISSION_ERROR_CODES.has(code)) {
|
|
5524
|
+
return code;
|
|
5525
|
+
}
|
|
5526
|
+
const match = message ? LOCAL_PERMISSION_MESSAGE_PATTERN.exec(message) : null;
|
|
5527
|
+
return match ? match[1] : undefined;
|
|
5528
|
+
}
|
|
5529
|
+
function localPermissionPath(path, message) {
|
|
5530
|
+
if (typeof path === "string")
|
|
5531
|
+
return path;
|
|
5532
|
+
return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
|
|
5533
|
+
}
|
|
5534
|
+
function readHeader(response, name) {
|
|
5535
|
+
const headers = response?.headers;
|
|
5536
|
+
if (!headers || typeof headers !== "object")
|
|
5537
|
+
return;
|
|
5538
|
+
if (typeof headers.get === "function") {
|
|
5539
|
+
const value = headers.get(name);
|
|
5540
|
+
if (value)
|
|
5541
|
+
return value;
|
|
5542
|
+
}
|
|
5543
|
+
const plain = headers;
|
|
5544
|
+
const key = Object.keys(plain).find((k) => k.toLowerCase() === name.toLowerCase());
|
|
5545
|
+
const value = key === undefined ? undefined : plain[key];
|
|
5546
|
+
return typeof value === "string" && value !== "" ? value : undefined;
|
|
5547
|
+
}
|
|
5548
|
+
function isHtmlDocument(body) {
|
|
5549
|
+
return /^\s*(<!doctype html|<html\b)/i.test(body);
|
|
5550
|
+
}
|
|
5551
|
+
function retryHintForRetryAfter(seconds) {
|
|
5552
|
+
if (seconds <= 1) {
|
|
5553
|
+
return "RetryAfter1Second";
|
|
5554
|
+
}
|
|
5555
|
+
if (seconds <= 10) {
|
|
5556
|
+
return "RetryAfter10Seconds";
|
|
5557
|
+
}
|
|
5558
|
+
if (seconds <= 30) {
|
|
5559
|
+
return "RetryAfter30Seconds";
|
|
5560
|
+
}
|
|
5561
|
+
return "RetryAfter60Seconds";
|
|
5562
|
+
}
|
|
5563
|
+
function classifyError2(status, error) {
|
|
5564
|
+
const byStatus = classifyHttpStatus(status);
|
|
5565
|
+
if (byStatus)
|
|
5566
|
+
return byStatus;
|
|
5567
|
+
if (status === undefined && describePermissionError(error)) {
|
|
5568
|
+
return {
|
|
5569
|
+
errorCode: "local_permission_denied",
|
|
5570
|
+
retry: "RetryWillNotFix"
|
|
5571
|
+
};
|
|
5572
|
+
}
|
|
5573
|
+
const connectivity = describeConnectivityError(error);
|
|
5574
|
+
if (connectivity) {
|
|
5575
|
+
return {
|
|
5576
|
+
errorCode: "network_error",
|
|
5577
|
+
retry: connectivity.kind === "tls" ? "RetryWillNotFix" : "RetryLater"
|
|
5578
|
+
};
|
|
5579
|
+
}
|
|
5580
|
+
return { errorCode: "unknown_error", retry: "RetryWillNotFix" };
|
|
5581
|
+
}
|
|
5582
|
+
function withCarriedClass(inferred, error) {
|
|
5583
|
+
const errorCode = carriedErrorCode(error);
|
|
5584
|
+
const retry = carriedRetry(error);
|
|
5585
|
+
if (errorCode === undefined || errorCode === inferred.errorCode) {
|
|
5586
|
+
return {
|
|
5587
|
+
errorCode: inferred.errorCode,
|
|
5588
|
+
retry: retry ?? inferred.retry
|
|
5589
|
+
};
|
|
5590
|
+
}
|
|
5591
|
+
return { errorCode, retry: retry ?? defaultRetryForErrorCode(errorCode) };
|
|
5592
|
+
}
|
|
5593
|
+
function formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus) {
|
|
5594
|
+
if (extractedMessage) {
|
|
5595
|
+
return `HTTP ${status}: ${extractedMessage}`;
|
|
5596
|
+
}
|
|
5597
|
+
return inferredStatus !== undefined ? rawMessage : `HTTP ${status}: ${rawMessage}`;
|
|
5598
|
+
}
|
|
5599
|
+
async function extractErrorDetails(error, options) {
|
|
5600
|
+
const err = error !== null && error !== undefined && typeof error === "object" ? error : {};
|
|
5601
|
+
const response = err.response;
|
|
5602
|
+
const rawMessage = typeof err.message === "string" ? err.message : "Unknown error";
|
|
5603
|
+
const explicitStatus = err.status ?? response?.status;
|
|
5604
|
+
const inferredStatus = explicitStatus === undefined ? parseHttpStatusFromMessage(rawMessage) : undefined;
|
|
5605
|
+
const status = explicitStatus ?? inferredStatus;
|
|
5606
|
+
const isSuccessfulResponse = status !== undefined && status >= 200 && status < 300;
|
|
5607
|
+
let rawBody;
|
|
5608
|
+
let extractedMessage;
|
|
5609
|
+
let parsedBody;
|
|
5610
|
+
const textFn = response?.text?.bind(response);
|
|
5611
|
+
if (textFn) {
|
|
5612
|
+
const [bodyError, body] = await catchError2((async () => textFn())());
|
|
5613
|
+
if (!bodyError && body) {
|
|
5614
|
+
rawBody = body;
|
|
5615
|
+
const [parseError, parsed] = catchError2(() => JSON.parse(body));
|
|
5616
|
+
if (!parseError && parsed && typeof parsed === "object") {
|
|
5617
|
+
parsedBody = parsed;
|
|
5618
|
+
if (parsedBody.errors && typeof parsedBody.errors === "object") {
|
|
5619
|
+
for (const field of Object.values(parsedBody.errors)) {
|
|
5620
|
+
if (Array.isArray(field) && field.length > 0) {
|
|
5621
|
+
const first = field[0];
|
|
5622
|
+
if (first && typeof first.message === "string") {
|
|
5623
|
+
extractedMessage = first.message;
|
|
5624
|
+
break;
|
|
5625
|
+
}
|
|
5626
|
+
}
|
|
5627
|
+
}
|
|
5628
|
+
}
|
|
5629
|
+
if (!extractedMessage) {
|
|
5630
|
+
extractedMessage = typeof parsedBody.message === "string" ? parsedBody.message : typeof parsedBody.errorMessage === "string" ? parsedBody.errorMessage : typeof parsedBody.title === "string" ? parsedBody.title : undefined;
|
|
5631
|
+
}
|
|
5632
|
+
if (!extractedMessage) {
|
|
5633
|
+
extractedMessage = body;
|
|
5634
|
+
}
|
|
5635
|
+
if (extractedMessage && typeof parsedBody.detail === "string" && parsedBody.detail.length > 0 && !extractedMessage.includes(parsedBody.detail)) {
|
|
5636
|
+
extractedMessage = `${extractedMessage}: ${parsedBody.detail}`;
|
|
5637
|
+
}
|
|
5638
|
+
} else {
|
|
5639
|
+
extractedMessage = isHtmlDocument(body) ? HTML_RESPONSE_MESSAGE : body;
|
|
5640
|
+
}
|
|
5641
|
+
}
|
|
5642
|
+
}
|
|
5643
|
+
let message;
|
|
5644
|
+
let result = "Failure";
|
|
5645
|
+
const classificationStatus = status ?? findHttpStatusInGraph(error);
|
|
5646
|
+
const classification = classifyError2(classificationStatus, error);
|
|
5647
|
+
let retry = classification.retry;
|
|
5648
|
+
const htmlForbidden = status === 403 && rawBody !== undefined && isHtmlDocument(rawBody);
|
|
5649
|
+
const rayId = htmlForbidden ? readHeader(response, "cf-ray") : undefined;
|
|
5650
|
+
const cloudflareBlock = htmlForbidden && (rayId !== undefined || /\bcloudflare\b/i.test(readHeader(response, "server") ?? ""));
|
|
5651
|
+
if (status === 401) {
|
|
5652
|
+
message = DEFAULT_401;
|
|
5653
|
+
result = "AuthenticationError";
|
|
5654
|
+
} else if (cloudflareBlock) {
|
|
5655
|
+
message = rayId ? `${CLOUDFLARE_BLOCK_403} Cloudflare Ray ID: ${rayId}.` : CLOUDFLARE_BLOCK_403;
|
|
5656
|
+
} else if (status === 403) {
|
|
5657
|
+
message = options?.forbiddenMessage ?? DEFAULT_403;
|
|
5658
|
+
result = "AuthenticationError";
|
|
5659
|
+
} else if (status === 405) {
|
|
5660
|
+
message = DEFAULT_405;
|
|
5661
|
+
} else if (status === 413) {
|
|
5662
|
+
message = DEFAULT_413;
|
|
5663
|
+
} else if (status === 400 || status === 422) {
|
|
5664
|
+
message = formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus);
|
|
5665
|
+
result = "ValidationError";
|
|
5666
|
+
} else if (status === 429) {
|
|
5667
|
+
message = formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus);
|
|
5668
|
+
} else if (extractedMessage) {
|
|
5669
|
+
if (isSuccessfulResponse && rawMessage !== "Unknown error") {
|
|
5670
|
+
message = rawMessage;
|
|
5671
|
+
} else {
|
|
5672
|
+
message = status ? `HTTP ${status}: ${extractedMessage}` : extractedMessage;
|
|
5673
|
+
}
|
|
5674
|
+
} else if (status) {
|
|
5675
|
+
if (inferredStatus !== undefined) {
|
|
5676
|
+
message = rawMessage;
|
|
5677
|
+
} else if (rawMessage === "Unknown error" && response) {
|
|
5678
|
+
const statusText = response.statusText;
|
|
5679
|
+
message = statusText ? `HTTP ${status} ${statusText}` : `HTTP ${status} - request failed`;
|
|
5680
|
+
} else {
|
|
5681
|
+
message = `HTTP ${status}: ${rawMessage}`;
|
|
5682
|
+
}
|
|
5683
|
+
} else {
|
|
5684
|
+
message = rawMessage;
|
|
5685
|
+
}
|
|
5686
|
+
if (status === undefined) {
|
|
5687
|
+
const connectivity = describeConnectivityError(error);
|
|
5688
|
+
if (connectivity && connectivity.message !== message && !message.includes(connectivity.message)) {
|
|
5689
|
+
message = `${message}: ${connectivity.message}`;
|
|
5690
|
+
}
|
|
5691
|
+
}
|
|
5692
|
+
const permission = status === undefined ? describePermissionError(error) : undefined;
|
|
5693
|
+
if (permission) {
|
|
5694
|
+
if (permission.message !== message && !message.includes(permission.message)) {
|
|
5695
|
+
message = `${message}: ${permission.message}`;
|
|
5696
|
+
}
|
|
5697
|
+
if (!message.includes(permission.instructions)) {
|
|
5698
|
+
const punctuated = message.endsWith(".") ? message : `${message}.`;
|
|
5699
|
+
message = `${punctuated} ${permission.instructions}`;
|
|
5700
|
+
}
|
|
5701
|
+
}
|
|
5702
|
+
let details = rawMessage;
|
|
5703
|
+
if (htmlForbidden) {
|
|
5704
|
+
details = cloudflareBlock ? CLOUDFLARE_BLOCK_403_INSTRUCTIONS : HTML_RESPONSE_MESSAGE;
|
|
5705
|
+
} else if (rawBody) {
|
|
5706
|
+
if (parsedBody) {
|
|
5707
|
+
const extra = {};
|
|
5708
|
+
if (parsedBody.errorCode)
|
|
5709
|
+
extra.errorCode = parsedBody.errorCode;
|
|
5710
|
+
if (parsedBody.detail)
|
|
5711
|
+
extra.detail = parsedBody.detail;
|
|
5712
|
+
if (parsedBody.details)
|
|
5713
|
+
extra.details = parsedBody.details;
|
|
5714
|
+
if (parsedBody.errors != null)
|
|
5715
|
+
extra.errors = parsedBody.errors;
|
|
5716
|
+
if (parsedBody.data && typeof parsedBody.data === "object" && Object.keys(parsedBody.data).length > 0) {
|
|
5717
|
+
extra.data = parsedBody.data;
|
|
5718
|
+
}
|
|
5719
|
+
details = Object.keys(extra).length > 0 ? JSON.stringify(extra) : rawBody;
|
|
5720
|
+
} else {
|
|
5721
|
+
details = rawBody;
|
|
5722
|
+
}
|
|
5723
|
+
} else if (typeof err.message === "string") {
|
|
5724
|
+
details = err.message;
|
|
5725
|
+
} else {
|
|
5726
|
+
details = describeThrownValue(error);
|
|
5727
|
+
}
|
|
5728
|
+
const context = {};
|
|
5729
|
+
if (classificationStatus) {
|
|
5730
|
+
context.httpStatus = classificationStatus;
|
|
5731
|
+
}
|
|
5732
|
+
if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
|
|
5733
|
+
context.errorCode = parsedBody.errorCode;
|
|
5734
|
+
} else if (parsedBody?.code && typeof parsedBody.code === "string") {
|
|
5735
|
+
context.errorCode = parsedBody.code;
|
|
5736
|
+
}
|
|
5737
|
+
if (parsedBody?.requestId && typeof parsedBody.requestId === "string") {
|
|
5738
|
+
context.requestId = parsedBody.requestId;
|
|
5739
|
+
} else if (cloudflareBlock && rayId) {
|
|
5740
|
+
context.requestId = rayId;
|
|
5741
|
+
}
|
|
5742
|
+
if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
|
|
5743
|
+
context.traceId = parsedBody.traceId;
|
|
5744
|
+
}
|
|
5745
|
+
if (permission?.path !== undefined) {
|
|
5746
|
+
context.path = permission.path;
|
|
5747
|
+
}
|
|
5748
|
+
if (status === 429) {
|
|
5749
|
+
const retryAfterValue = readHeader(response, "retry-after");
|
|
5750
|
+
if (retryAfterValue) {
|
|
5751
|
+
const seconds = Number(retryAfterValue);
|
|
5752
|
+
if (!Number.isNaN(seconds)) {
|
|
5753
|
+
context.retryAfter = seconds;
|
|
5754
|
+
retry = retryHintForRetryAfter(seconds);
|
|
5755
|
+
}
|
|
5756
|
+
}
|
|
5757
|
+
}
|
|
5758
|
+
const hasContext = Object.keys(context).length > 0;
|
|
5759
|
+
let parsedErrors;
|
|
5760
|
+
if (parsedBody?.errors && typeof parsedBody.errors === "object") {
|
|
5761
|
+
const errors = {};
|
|
5762
|
+
for (const [field, raw] of Object.entries(parsedBody.errors)) {
|
|
5763
|
+
if (Array.isArray(raw)) {
|
|
5764
|
+
const messages = raw.map((entry) => {
|
|
5765
|
+
if (typeof entry === "string")
|
|
5766
|
+
return entry;
|
|
5767
|
+
if (entry && typeof entry === "object" && typeof entry.message === "string") {
|
|
5768
|
+
return entry.message;
|
|
5769
|
+
}
|
|
5770
|
+
return String(entry);
|
|
5771
|
+
}).filter(Boolean);
|
|
5772
|
+
if (messages.length > 0)
|
|
5773
|
+
errors[field] = messages;
|
|
5774
|
+
} else if (typeof raw === "string") {
|
|
5775
|
+
errors[field] = [raw];
|
|
5776
|
+
}
|
|
5777
|
+
}
|
|
5778
|
+
if (Object.keys(errors).length > 0)
|
|
5779
|
+
parsedErrors = errors;
|
|
5780
|
+
}
|
|
5781
|
+
return {
|
|
5782
|
+
result,
|
|
5783
|
+
...withCarriedClass({ errorCode: classification.errorCode, retry }, error),
|
|
5784
|
+
message,
|
|
5785
|
+
details,
|
|
5786
|
+
...hasContext ? { context } : {},
|
|
5787
|
+
...parsedErrors ? { parsedErrors } : {}
|
|
5788
|
+
};
|
|
5789
|
+
}
|
|
5049
5790
|
|
|
5050
|
-
// ../common/src/
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5791
|
+
// ../common/src/pass-through-tail.ts
|
|
5792
|
+
function maybeOption(arg) {
|
|
5793
|
+
return arg.length > 1 && arg[0] === "-";
|
|
5794
|
+
}
|
|
5795
|
+
function tokenizeTail(cmd, tail) {
|
|
5796
|
+
const find = (flag) => cmd.options.find((option) => option.long === flag || option.short === flag);
|
|
5797
|
+
const digitShort = cmd.options.some((option) => option.short !== undefined && /^-\d$/.test(option.short));
|
|
5798
|
+
const negativeNumber = (arg) => !digitShort && /^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg);
|
|
5799
|
+
const tokens = [];
|
|
5800
|
+
let firstUnknown = -1;
|
|
5801
|
+
let sentinel = -1;
|
|
5802
|
+
let variadic;
|
|
5803
|
+
let group;
|
|
5804
|
+
let groupIndex = 0;
|
|
5805
|
+
let i = 0;
|
|
5806
|
+
while (i < tail.length || group !== undefined) {
|
|
5807
|
+
const index = group === undefined ? i : groupIndex;
|
|
5808
|
+
const arg = group ?? tail[i++];
|
|
5809
|
+
group = undefined;
|
|
5810
|
+
if (arg === "--") {
|
|
5811
|
+
sentinel = index;
|
|
5812
|
+
tokens.push({ kind: "sentinel", index });
|
|
5813
|
+
for (let j = i;j < tail.length; j++) {
|
|
5814
|
+
tokens.push({
|
|
5815
|
+
kind: "operand",
|
|
5816
|
+
index: j,
|
|
5817
|
+
text: tail[j],
|
|
5818
|
+
literal: true
|
|
5819
|
+
});
|
|
5820
|
+
}
|
|
5821
|
+
break;
|
|
5822
|
+
}
|
|
5823
|
+
if (variadic && (!maybeOption(arg) || negativeNumber(arg))) {
|
|
5824
|
+
tokens.push({
|
|
5825
|
+
kind: "option",
|
|
5826
|
+
index,
|
|
5827
|
+
text: arg,
|
|
5828
|
+
option: variadic,
|
|
5829
|
+
value: arg
|
|
5830
|
+
});
|
|
5831
|
+
continue;
|
|
5832
|
+
}
|
|
5833
|
+
variadic = undefined;
|
|
5834
|
+
if (maybeOption(arg)) {
|
|
5835
|
+
const option = find(arg);
|
|
5836
|
+
if (option) {
|
|
5837
|
+
let value;
|
|
5838
|
+
if (option.required) {
|
|
5839
|
+
value = tail[i];
|
|
5840
|
+
if (value !== undefined)
|
|
5841
|
+
i++;
|
|
5842
|
+
} else if (option.optional) {
|
|
5843
|
+
const next = tail[i];
|
|
5844
|
+
if (next !== undefined && (!maybeOption(next) || negativeNumber(next))) {
|
|
5845
|
+
value = next;
|
|
5846
|
+
i++;
|
|
5847
|
+
}
|
|
5848
|
+
}
|
|
5849
|
+
tokens.push({
|
|
5850
|
+
kind: "option",
|
|
5851
|
+
index,
|
|
5852
|
+
text: arg,
|
|
5853
|
+
option,
|
|
5854
|
+
...value === undefined ? {} : { value }
|
|
5855
|
+
});
|
|
5856
|
+
variadic = option.variadic ? option : undefined;
|
|
5857
|
+
continue;
|
|
5858
|
+
}
|
|
5859
|
+
}
|
|
5860
|
+
if (arg.length > 2 && arg[0] === "-" && arg[1] !== "-") {
|
|
5861
|
+
const option = find(`-${arg[1]}`);
|
|
5862
|
+
if (option) {
|
|
5863
|
+
if (option.required || option.optional) {
|
|
5864
|
+
tokens.push({
|
|
5865
|
+
kind: "option",
|
|
5866
|
+
index,
|
|
5867
|
+
text: arg,
|
|
5868
|
+
option,
|
|
5869
|
+
value: arg.slice(2)
|
|
5870
|
+
});
|
|
5871
|
+
} else {
|
|
5872
|
+
tokens.push({ kind: "option", index, text: arg, option });
|
|
5873
|
+
group = `-${arg.slice(2)}`;
|
|
5874
|
+
groupIndex = index;
|
|
5875
|
+
}
|
|
5876
|
+
continue;
|
|
5877
|
+
}
|
|
5878
|
+
}
|
|
5879
|
+
if (/^--[^=]+=/.test(arg)) {
|
|
5880
|
+
const equals = arg.indexOf("=");
|
|
5881
|
+
const option = find(arg.slice(0, equals));
|
|
5882
|
+
if (option && (option.required || option.optional)) {
|
|
5883
|
+
tokens.push({
|
|
5884
|
+
kind: "option",
|
|
5885
|
+
index,
|
|
5886
|
+
text: arg,
|
|
5887
|
+
option,
|
|
5888
|
+
value: arg.slice(equals + 1)
|
|
5889
|
+
});
|
|
5890
|
+
continue;
|
|
5891
|
+
}
|
|
5892
|
+
}
|
|
5893
|
+
if (maybeOption(arg) && !negativeNumber(arg)) {
|
|
5894
|
+
const equals = arg.startsWith("--") ? arg.indexOf("=") : -1;
|
|
5895
|
+
if (firstUnknown === -1)
|
|
5896
|
+
firstUnknown = index;
|
|
5897
|
+
tokens.push({
|
|
5898
|
+
kind: "unknown",
|
|
5899
|
+
index,
|
|
5900
|
+
text: arg,
|
|
5901
|
+
flag: equals > 0 ? arg.slice(0, equals) : arg,
|
|
5902
|
+
...equals > 0 ? { inlineValue: arg.slice(equals + 1) } : {}
|
|
5903
|
+
});
|
|
5904
|
+
continue;
|
|
5905
|
+
}
|
|
5906
|
+
tokens.push({ kind: "operand", index, text: arg, literal: false });
|
|
5907
|
+
}
|
|
5908
|
+
return { tokens, firstUnknown, sentinel };
|
|
5055
5909
|
}
|
|
5056
5910
|
|
|
5057
|
-
//
|
|
5058
|
-
var
|
|
5059
|
-
var
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5911
|
+
// ../common/src/project-telemetry.ts
|
|
5912
|
+
var RESOLVER = Symbol.for("@uipath/common/projectTelemetryResolver");
|
|
5913
|
+
var CAPTURE = Symbol.for("@uipath/common/projectTelemetryCapture");
|
|
5914
|
+
var CONTEXT_RESOLVER = Symbol.for("@uipath/common/projectContextTelemetryResolver");
|
|
5915
|
+
var RULES = Symbol.for("@uipath/common/projectTargetRules");
|
|
5916
|
+
function logSkipped(what, error) {
|
|
5917
|
+
logger.debug(`[project-telemetry] ${what} skipped: ${error instanceof Error ? error.message : String(error)}`);
|
|
5918
|
+
}
|
|
5919
|
+
function bounded(work, what) {
|
|
5920
|
+
return withinProjectIdentityBudget(work, () => logSkipped(what, `no answer within ${PROJECT_IDENTITY_LOOKUP_BUDGET_MS} ms`));
|
|
5921
|
+
}
|
|
5922
|
+
async function identityWithContext(command, identity) {
|
|
5923
|
+
const props = projectIdentityProperties(identity);
|
|
5924
|
+
if (!identity.projectDirectory || isProjectTelemetryDisabled())
|
|
5925
|
+
return props;
|
|
5926
|
+
for (let node = command;node; node = node.parent ?? undefined) {
|
|
5927
|
+
const resolver = node[CONTEXT_RESOLVER];
|
|
5928
|
+
if (typeof resolver !== "function")
|
|
5929
|
+
continue;
|
|
5930
|
+
try {
|
|
5931
|
+
return {
|
|
5932
|
+
...await resolver(identity.projectDirectory),
|
|
5933
|
+
...props
|
|
5934
|
+
};
|
|
5935
|
+
} catch (error) {
|
|
5936
|
+
logSkipped("solution context lookup", error);
|
|
5937
|
+
return props;
|
|
5938
|
+
}
|
|
5939
|
+
}
|
|
5940
|
+
return props;
|
|
5941
|
+
}
|
|
5942
|
+
function getProjectTelemetryResolver(command) {
|
|
5943
|
+
for (let node = command;node; node = node.parent) {
|
|
5944
|
+
const resolver = node[RESOLVER];
|
|
5945
|
+
if (typeof resolver === "function")
|
|
5946
|
+
return resolver;
|
|
5947
|
+
}
|
|
5948
|
+
return;
|
|
5949
|
+
}
|
|
5950
|
+
function attachProjectTelemetryCapture(command, capture) {
|
|
5951
|
+
command[CAPTURE] = capture;
|
|
5952
|
+
}
|
|
5953
|
+
class ProjectTelemetrySession {
|
|
5954
|
+
resolver;
|
|
5955
|
+
command;
|
|
5956
|
+
target;
|
|
5957
|
+
props = {};
|
|
5958
|
+
explicit = false;
|
|
5959
|
+
input;
|
|
5960
|
+
constructor(resolver, command) {
|
|
5961
|
+
this.resolver = resolver;
|
|
5962
|
+
this.command = command;
|
|
5963
|
+
}
|
|
5964
|
+
async setTarget(path) {
|
|
5965
|
+
this.target = path;
|
|
5966
|
+
if (this.input) {
|
|
5967
|
+
await this.resolve({
|
|
5968
|
+
...this.input,
|
|
5969
|
+
phase: "after",
|
|
5970
|
+
success: true
|
|
5971
|
+
});
|
|
5972
|
+
this.explicit = true;
|
|
5973
|
+
}
|
|
5974
|
+
}
|
|
5975
|
+
async setIdentity(identity) {
|
|
5976
|
+
try {
|
|
5977
|
+
const props = await bounded(identityWithContext(this.command, identity), "project identity capture");
|
|
5978
|
+
if (props !== undefined)
|
|
5979
|
+
this.setProperties(props);
|
|
5980
|
+
} catch (error) {
|
|
5981
|
+
logSkipped("project identity capture", error);
|
|
5982
|
+
}
|
|
5983
|
+
}
|
|
5984
|
+
setProperties(properties) {
|
|
5985
|
+
try {
|
|
5986
|
+
this.props = { ...properties };
|
|
5987
|
+
this.explicit = true;
|
|
5988
|
+
} catch (error) {
|
|
5989
|
+
logSkipped("project identity properties", error);
|
|
5990
|
+
}
|
|
5991
|
+
}
|
|
5992
|
+
properties() {
|
|
5993
|
+
return { ...this.props };
|
|
5994
|
+
}
|
|
5995
|
+
async resolve(input) {
|
|
5996
|
+
this.input = input;
|
|
5997
|
+
if (this.explicit)
|
|
5998
|
+
return;
|
|
5999
|
+
try {
|
|
6000
|
+
const props = await bounded(this.resolver({
|
|
6001
|
+
...input,
|
|
6002
|
+
target: this.target
|
|
6003
|
+
}), `project identity (${input.phase})`);
|
|
6004
|
+
if (props !== undefined) {
|
|
6005
|
+
this.props = props;
|
|
6006
|
+
}
|
|
6007
|
+
} catch (error) {
|
|
6008
|
+
logSkipped(`project identity (${input.phase})`, error);
|
|
6009
|
+
}
|
|
6010
|
+
}
|
|
6011
|
+
}
|
|
5072
6012
|
|
|
5073
6013
|
// ../common/src/telemetry/command-attribution.ts
|
|
5074
6014
|
var LEGACY_SKILL_NAMESPACE = "uipath:";
|
|
@@ -5314,8 +6254,7 @@ var pollSignalSlot = singleton("PollSignal");
|
|
|
5314
6254
|
var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
|
|
5315
6255
|
var processContext = {
|
|
5316
6256
|
exit: (code) => {
|
|
5317
|
-
|
|
5318
|
-
setExitCode(code);
|
|
6257
|
+
recordCommandExit(code);
|
|
5319
6258
|
},
|
|
5320
6259
|
get pollSignal() {
|
|
5321
6260
|
return pollSignalSlot.get();
|
|
@@ -5340,6 +6279,8 @@ function recordableArgValue(value, choices) {
|
|
|
5340
6279
|
function extractCommandParams(cmd) {
|
|
5341
6280
|
const params = {};
|
|
5342
6281
|
forEachSuppliedArgument(cmd, (name, value, choices, defaulted) => {
|
|
6282
|
+
if (name === undefined)
|
|
6283
|
+
return;
|
|
5343
6284
|
const recordable = recordableArgValue(value, choices);
|
|
5344
6285
|
params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = recordable === TELEMETRY_ARG_VALUE_WITHHELD && defaulted ? TELEMETRY_ARG_VALUE_DEFAULTED : recordable;
|
|
5345
6286
|
});
|
|
@@ -5355,7 +6296,8 @@ function isDefaultedPositional(cmd, index) {
|
|
|
5355
6296
|
function forEachSuppliedArgument(cmd, visit) {
|
|
5356
6297
|
const registered = cmd.registeredArguments ?? [];
|
|
5357
6298
|
const processed = cmd.processedArgs ?? [];
|
|
5358
|
-
|
|
6299
|
+
const bound = boundPositionalCount(cmd);
|
|
6300
|
+
for (let i = 0;i < bound; i++) {
|
|
5359
6301
|
const name = registered[i].name();
|
|
5360
6302
|
if (name && processed[i] !== undefined) {
|
|
5361
6303
|
visit(name, processed[i], registered[i].argChoices, isDefaultedPositional(cmd, i));
|
|
@@ -5370,6 +6312,71 @@ function forEachSuppliedArgument(cmd, visit) {
|
|
|
5370
6312
|
visit(key, value, choicesByAttribute.get(key), isDefaultedOption(cmd, key));
|
|
5371
6313
|
}
|
|
5372
6314
|
}
|
|
6315
|
+
forEachPassThroughToken(cmd, bound, (name, value) => {
|
|
6316
|
+
visit(name, value, name === undefined ? undefined : choicesByAttribute.get(name), false);
|
|
6317
|
+
});
|
|
6318
|
+
}
|
|
6319
|
+
function boundPositionalCount(cmd) {
|
|
6320
|
+
const registered = cmd.registeredArguments ?? [];
|
|
6321
|
+
if (registered.some((argument) => argument.variadic)) {
|
|
6322
|
+
return registered.length;
|
|
6323
|
+
}
|
|
6324
|
+
if ((cmd.args ?? []).length <= registered.length) {
|
|
6325
|
+
return registered.length;
|
|
6326
|
+
}
|
|
6327
|
+
const firstFlag = tokenizeTail(cmd, (cmd.args ?? []).slice(1)).tokens.find((token) => token.kind !== "operand")?.index ?? -1;
|
|
6328
|
+
return firstFlag === -1 ? registered.length : Math.min(registered.length, firstFlag + 1);
|
|
6329
|
+
}
|
|
6330
|
+
function forEachPassThroughToken(cmd, bound, visit) {
|
|
6331
|
+
const registered = cmd.registeredArguments ?? [];
|
|
6332
|
+
const fillsPositionals = !registered.some((argument) => argument.variadic);
|
|
6333
|
+
const { tokens, firstUnknown } = tokenizeTail(cmd, (cmd.args ?? []).slice(bound));
|
|
6334
|
+
const repeated = new Map;
|
|
6335
|
+
let nextPositional = bound;
|
|
6336
|
+
for (const token of tokens) {
|
|
6337
|
+
const pastUnknown = firstUnknown !== -1 && token.index > firstUnknown;
|
|
6338
|
+
if (token.kind === "sentinel")
|
|
6339
|
+
continue;
|
|
6340
|
+
if (token.kind === "operand") {
|
|
6341
|
+
const claimable = !pastUnknown && fillsPositionals && nextPositional < registered.length;
|
|
6342
|
+
const name = claimable ? registered[nextPositional++].name() : undefined;
|
|
6343
|
+
visit(name || undefined, token.text);
|
|
6344
|
+
continue;
|
|
6345
|
+
}
|
|
6346
|
+
if (token.kind === "unknown") {
|
|
6347
|
+
const bare = token.flag.replace(/^-+/, "");
|
|
6348
|
+
const key = bare.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
6349
|
+
const keyable = token.flag.startsWith("--") || token.flag.length === 2;
|
|
6350
|
+
if (!pastUnknown && keyable && /^[a-z][a-z0-9-]*$/i.test(bare) && key) {
|
|
6351
|
+
visit(key, token.inlineValue ?? true);
|
|
6352
|
+
} else {
|
|
6353
|
+
visit(undefined, token.text);
|
|
6354
|
+
if (token.inlineValue !== undefined) {
|
|
6355
|
+
visit(undefined, token.inlineValue);
|
|
6356
|
+
} else if (!token.flag.startsWith("--") && token.flag.length > 2) {
|
|
6357
|
+
visit(undefined, token.flag.slice(2));
|
|
6358
|
+
}
|
|
6359
|
+
}
|
|
6360
|
+
continue;
|
|
6361
|
+
}
|
|
6362
|
+
if (pastUnknown) {
|
|
6363
|
+
visit(undefined, token.text);
|
|
6364
|
+
if (token.value !== undefined)
|
|
6365
|
+
visit(undefined, token.value);
|
|
6366
|
+
continue;
|
|
6367
|
+
}
|
|
6368
|
+
const option = token.option;
|
|
6369
|
+
const name = option.attributeName();
|
|
6370
|
+
const value = option.negate ? false : option.required || option.optional ? token.value ?? true : true;
|
|
6371
|
+
const previous = repeated.get(name);
|
|
6372
|
+
if (previous) {
|
|
6373
|
+
previous.push(value);
|
|
6374
|
+
visit(name, previous);
|
|
6375
|
+
} else {
|
|
6376
|
+
repeated.set(name, [value]);
|
|
6377
|
+
visit(name, value);
|
|
6378
|
+
}
|
|
6379
|
+
}
|
|
5373
6380
|
}
|
|
5374
6381
|
function withheldArgumentValues(cmd) {
|
|
5375
6382
|
const values = [];
|
|
@@ -5420,7 +6427,7 @@ function implicitLimitViolation(cmd) {
|
|
|
5420
6427
|
function exitCodeFromProcess(fallback) {
|
|
5421
6428
|
return typeof process.exitCode === "number" ? process.exitCode : fallback;
|
|
5422
6429
|
}
|
|
5423
|
-
|
|
6430
|
+
Command2.prototype.trackedAction = function(context, fn, properties) {
|
|
5424
6431
|
const command = this;
|
|
5425
6432
|
return this.action(async (...args) => {
|
|
5426
6433
|
await loadOutputCodecsAsync({
|
|
@@ -5431,6 +6438,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5431
6438
|
const telemetryName = commandTelemetryName(commandParts);
|
|
5432
6439
|
const commandPath = commandInvocationPath(commandParts);
|
|
5433
6440
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
6441
|
+
const projectResolver = getProjectTelemetryResolver(command);
|
|
6442
|
+
const projectSession = projectResolver && !isProjectTelemetryDisabled() ? new ProjectTelemetrySession(projectResolver, command) : undefined;
|
|
5434
6443
|
markCommandStart();
|
|
5435
6444
|
const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
|
|
5436
6445
|
try {
|
|
@@ -5438,11 +6447,17 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5438
6447
|
let errorMessage;
|
|
5439
6448
|
let fallbackExitCode = EXIT_CODES.Success;
|
|
5440
6449
|
clearRecordedCommandFailureTelemetry();
|
|
5441
|
-
const [error] = await
|
|
6450
|
+
const [error] = await catchError2(ensureInvocationRequestScope(() => {
|
|
5442
6451
|
const violation = implicitLimitViolation(command);
|
|
5443
6452
|
if (violation) {
|
|
5444
6453
|
return Promise.reject(violation);
|
|
5445
6454
|
}
|
|
6455
|
+
if (projectSession) {
|
|
6456
|
+
return projectSession.resolve({ command, args, phase: "before" }).then(() => {
|
|
6457
|
+
attachProjectTelemetryCapture(command, projectSession);
|
|
6458
|
+
return fn(...args);
|
|
6459
|
+
});
|
|
6460
|
+
}
|
|
5446
6461
|
return fn(...args);
|
|
5447
6462
|
}));
|
|
5448
6463
|
if (error) {
|
|
@@ -5451,22 +6466,26 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5451
6466
|
const typed = error;
|
|
5452
6467
|
const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
|
|
5453
6468
|
const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
|
|
5454
|
-
const
|
|
6469
|
+
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
6470
|
+
const classified = cancellationExitCode === undefined ? await extractErrorDetails(error) : undefined;
|
|
6471
|
+
const finalResult = customResult ?? classified?.result ?? RESULTS.Failure;
|
|
5455
6472
|
const typedErrorCode = typed.errorCode ?? typed.ErrorCode;
|
|
5456
6473
|
const customErrorCode = isCliErrorCode(typedErrorCode) ? typedErrorCode : undefined;
|
|
5457
6474
|
const typedRetry = typed.retry ?? typed.Retry;
|
|
5458
6475
|
const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
|
|
5459
6476
|
const typedContext = typed.context ?? typed.Context;
|
|
5460
6477
|
const customContext = isErrorContext(typedContext) ? typedContext : undefined;
|
|
5461
|
-
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
5462
6478
|
fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
|
|
6479
|
+
const errorCode = customErrorCode ?? classified?.errorCode;
|
|
6480
|
+
const retry = customRetry ?? classified?.retry;
|
|
6481
|
+
const errorContext = customContext ?? classified?.context;
|
|
5463
6482
|
OutputFormatter.error({
|
|
5464
6483
|
Result: finalResult,
|
|
5465
|
-
...
|
|
6484
|
+
...errorCode ? { ErrorCode: errorCode } : {},
|
|
5466
6485
|
Message: errorMessage,
|
|
5467
6486
|
Instructions: customInstructions ?? commandHelpHint(commandPath),
|
|
5468
|
-
...
|
|
5469
|
-
...
|
|
6487
|
+
...retry ? { Retry: retry } : {},
|
|
6488
|
+
...errorContext ? { Context: errorContext } : {}
|
|
5470
6489
|
});
|
|
5471
6490
|
context.exit(fallbackExitCode);
|
|
5472
6491
|
}
|
|
@@ -5475,6 +6494,14 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5475
6494
|
const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
|
|
5476
6495
|
const recordedFailure = takeRecordedCommandFailureTelemetry();
|
|
5477
6496
|
const success = !error && exitCode === 0;
|
|
6497
|
+
if (projectSession) {
|
|
6498
|
+
await projectSession.resolve({
|
|
6499
|
+
command,
|
|
6500
|
+
args,
|
|
6501
|
+
phase: "after",
|
|
6502
|
+
success
|
|
6503
|
+
});
|
|
6504
|
+
}
|
|
5478
6505
|
const terminalTelemetry = buildCommandTerminalTelemetryProperties({
|
|
5479
6506
|
error,
|
|
5480
6507
|
exitCode,
|
|
@@ -5492,6 +6519,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5492
6519
|
}
|
|
5493
6520
|
const baseProperties = redactProperties({
|
|
5494
6521
|
...commandParams,
|
|
6522
|
+
...projectSession?.properties(),
|
|
5495
6523
|
...props,
|
|
5496
6524
|
...buildCommandTelemetryAttribution(commandPath, process.env.UIPATH_SKILL),
|
|
5497
6525
|
...buildAgentSessionTelemetry(process.env),
|
|
@@ -5502,6 +6530,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5502
6530
|
});
|
|
5503
6531
|
emitInvocationRequest(telemetryName, success, baseProperties);
|
|
5504
6532
|
} finally {
|
|
6533
|
+
if (projectSession)
|
|
6534
|
+
attachProjectTelemetryCapture(command, undefined);
|
|
5505
6535
|
releaseSuppliedArgumentValues(supplied);
|
|
5506
6536
|
}
|
|
5507
6537
|
});
|
|
@@ -5620,7 +6650,7 @@ function unsupportedSolutionProjectType(projectType) {
|
|
|
5620
6650
|
}
|
|
5621
6651
|
// ../common/src/command-examples.ts
|
|
5622
6652
|
var examplesByCommand = new WeakMap;
|
|
5623
|
-
|
|
6653
|
+
Command2.prototype.examples = function(examples) {
|
|
5624
6654
|
examplesByCommand.set(this, examples);
|
|
5625
6655
|
return this;
|
|
5626
6656
|
};
|
|
@@ -5629,11 +6659,11 @@ var previewSlot = singleton("PreviewBuild");
|
|
|
5629
6659
|
function isPreviewBuild() {
|
|
5630
6660
|
return previewSlot.get(false) ?? false;
|
|
5631
6661
|
}
|
|
5632
|
-
|
|
6662
|
+
Command2.prototype.previewCommand = function(nameAndArgs, opts) {
|
|
5633
6663
|
if (isPreviewBuild()) {
|
|
5634
6664
|
return this.command(nameAndArgs, opts);
|
|
5635
6665
|
}
|
|
5636
|
-
return new
|
|
6666
|
+
return new Command2(nameAndArgs.split(/\s+/)[0] ?? nameAndArgs);
|
|
5637
6667
|
};
|
|
5638
6668
|
// ../common/src/completer.ts
|
|
5639
6669
|
var COMPLETER_SYMBOL = Symbol.for("@uipath/common/completer");
|
|
@@ -5983,18 +7013,43 @@ function withPseudonymizedIdentifiers(payload) {
|
|
|
5983
7013
|
}
|
|
5984
7014
|
};
|
|
5985
7015
|
}
|
|
5986
|
-
function
|
|
7016
|
+
function identityKeysOf(capture) {
|
|
7017
|
+
if (!capture) {
|
|
7018
|
+
return {};
|
|
7019
|
+
}
|
|
7020
|
+
try {
|
|
7021
|
+
const properties = capture.properties?.();
|
|
7022
|
+
if (typeof properties !== "object" || properties === null) {
|
|
7023
|
+
return {};
|
|
7024
|
+
}
|
|
7025
|
+
const keys = {};
|
|
7026
|
+
for (const key of GUID_KEY_DIMENSIONS) {
|
|
7027
|
+
const value = properties[key];
|
|
7028
|
+
if (value !== undefined) {
|
|
7029
|
+
keys[key] = value;
|
|
7030
|
+
}
|
|
7031
|
+
}
|
|
7032
|
+
return keys;
|
|
7033
|
+
} catch (error) {
|
|
7034
|
+
logSkipped("ship identity", error);
|
|
7035
|
+
return {};
|
|
7036
|
+
}
|
|
7037
|
+
}
|
|
7038
|
+
function trackShipSucceeded(payload, capture) {
|
|
5987
7039
|
const keys = getShippedKeys();
|
|
5988
7040
|
const key = dedupeKey(payload);
|
|
5989
7041
|
if (keys.has(key)) {
|
|
5990
7042
|
return false;
|
|
5991
7043
|
}
|
|
5992
7044
|
keys.add(key);
|
|
5993
|
-
telemetry.trackEvent(CommonTelemetryEvents.ShipSucceeded, redactProperties(
|
|
7045
|
+
telemetry.trackEvent(CommonTelemetryEvents.ShipSucceeded, redactProperties({
|
|
7046
|
+
...withPseudonymizedIdentifiers(payload),
|
|
7047
|
+
...identityKeysOf(capture)
|
|
7048
|
+
}));
|
|
5994
7049
|
return true;
|
|
5995
7050
|
}
|
|
5996
7051
|
// ../common/src/tool-provider.ts
|
|
5997
7052
|
var factorySlot = singleton("PackagerFactoryProvider");
|
|
5998
|
-
export {
|
|
7053
|
+
export { getFileSystem, CommandDimensions, ShipDimensions, catchError2, RESULTS, Option, getOutputSink, logger, getOutputFormat, getOutputFormatExplicit, OutputFormatter, processContext, UIPATH_HOME_DIR, stripHostGlobalOptions, createHiddenDeprecatedTenantOption, ScreenLogger, getSdkUserAgentToken, installSdkUserAgentHeader, quoteForShell, unsupportedSolutionProjectType, trackShipSucceeded };
|
|
5999
7054
|
|
|
6000
|
-
//# debugId=
|
|
7055
|
+
//# debugId=31FB79DD99632B8864756E2164756E21
|