@uipath/resourcecatalog-tool 1.201.0 → 1.202.0-preview.136
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-xaqpc626.js → index-q6vc5bja.js} +27 -27
- package/dist/{index-91ejywfm.js → index-xnzgkhtg.js} +4 -4
- package/dist/index.js +3 -6
- package/dist/{js-yaml-eydtmn4r.js → js-yaml-71wj4em9.js} +27 -19
- package/dist/{tool-0v6na3yp.js → tool-1de529jm.js} +9 -7
- package/dist/{tool-jcjrwxd6.js → tool-y0mf21nm.js} +1637 -554
- package/dist/tool.js +5 -8
- package/package.json +2 -2
- package/dist/browser-strategy-qmh7k5c8.js +0 -99
- package/dist/node-strategy-37a5fbf7.js +0 -348
- package/dist/tool-31j9b09f.js +0 -265
- package/dist/tool-eb3gcj08.js +0 -14
- package/dist/tool-yy8n2117.js +0 -11
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isBrowser
|
|
3
|
-
} from "./tool-eb3gcj08.js";
|
|
4
|
-
import {
|
|
5
|
-
catchError,
|
|
6
|
-
getFileSystem
|
|
7
|
-
} from "./tool-31j9b09f.js";
|
|
8
|
-
import {
|
|
9
|
-
AUTH_FILENAME,
|
|
10
|
-
DEFAULT_BASE_URL,
|
|
11
|
-
UIPATH_HOME_DIR
|
|
12
|
-
} from "./tool-yy8n2117.js";
|
|
13
1
|
import {
|
|
14
2
|
__commonJS,
|
|
15
3
|
__require,
|
|
16
4
|
__toESM
|
|
17
|
-
} from "./tool-
|
|
5
|
+
} from "./tool-1de529jm.js";
|
|
18
6
|
|
|
19
7
|
// ../../../node_modules/commander/lib/error.js
|
|
20
|
-
var require_error = __commonJS((exports)
|
|
8
|
+
var require_error = __commonJS(function(exports) {
|
|
21
9
|
class CommanderError extends Error {
|
|
22
10
|
constructor(exitCode, code, message) {
|
|
23
11
|
super(message);
|
|
@@ -41,7 +29,7 @@ var require_error = __commonJS((exports) => {
|
|
|
41
29
|
});
|
|
42
30
|
|
|
43
31
|
// ../../../node_modules/commander/lib/argument.js
|
|
44
|
-
var require_argument = __commonJS((exports)
|
|
32
|
+
var require_argument = __commonJS(function(exports) {
|
|
45
33
|
var { InvalidArgumentError } = require_error();
|
|
46
34
|
|
|
47
35
|
class Argument {
|
|
@@ -121,7 +109,7 @@ var require_argument = __commonJS((exports) => {
|
|
|
121
109
|
});
|
|
122
110
|
|
|
123
111
|
// ../../../node_modules/commander/lib/help.js
|
|
124
|
-
var require_help = __commonJS((exports)
|
|
112
|
+
var require_help = __commonJS(function(exports) {
|
|
125
113
|
var { humanReadableArgName } = require_argument();
|
|
126
114
|
|
|
127
115
|
class Help {
|
|
@@ -478,7 +466,7 @@ ${itemIndentStr}`);
|
|
|
478
466
|
});
|
|
479
467
|
|
|
480
468
|
// ../../../node_modules/commander/lib/option.js
|
|
481
|
-
var require_option = __commonJS((exports)
|
|
469
|
+
var require_option = __commonJS(function(exports) {
|
|
482
470
|
var { InvalidArgumentError } = require_error();
|
|
483
471
|
|
|
484
472
|
class Option {
|
|
@@ -662,7 +650,7 @@ var require_option = __commonJS((exports) => {
|
|
|
662
650
|
});
|
|
663
651
|
|
|
664
652
|
// ../../../node_modules/commander/lib/suggestSimilar.js
|
|
665
|
-
var require_suggestSimilar = __commonJS((exports)
|
|
653
|
+
var require_suggestSimilar = __commonJS(function(exports) {
|
|
666
654
|
var maxDistance = 3;
|
|
667
655
|
function editDistance(a, b) {
|
|
668
656
|
if (Math.abs(a.length - b.length) > maxDistance)
|
|
@@ -735,11 +723,11 @@ var require_suggestSimilar = __commonJS((exports) => {
|
|
|
735
723
|
});
|
|
736
724
|
|
|
737
725
|
// ../../../node_modules/commander/lib/command.js
|
|
738
|
-
var require_command = __commonJS((exports)
|
|
726
|
+
var require_command = __commonJS(function(exports) {
|
|
739
727
|
var EventEmitter = __require("node:events").EventEmitter;
|
|
740
728
|
var childProcess = __require("node:child_process");
|
|
741
|
-
var
|
|
742
|
-
var
|
|
729
|
+
var path2 = __require("node:path");
|
|
730
|
+
var fs2 = __require("node:fs");
|
|
743
731
|
var process2 = __require("node:process");
|
|
744
732
|
var { Argument, humanReadableArgName } = require_argument();
|
|
745
733
|
var { CommanderError } = require_error();
|
|
@@ -1274,7 +1262,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1274
1262
|
this.processedArgs = [];
|
|
1275
1263
|
}
|
|
1276
1264
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
1277
|
-
if (
|
|
1265
|
+
if (fs2.existsSync(executableFile))
|
|
1278
1266
|
return;
|
|
1279
1267
|
const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
|
|
1280
1268
|
const executableMissing = `'${executableFile}' does not exist
|
|
@@ -1288,12 +1276,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1288
1276
|
let launchWithNode = false;
|
|
1289
1277
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1290
1278
|
function findFile(baseDir, baseName) {
|
|
1291
|
-
const localBin =
|
|
1292
|
-
if (
|
|
1279
|
+
const localBin = path2.resolve(baseDir, baseName);
|
|
1280
|
+
if (fs2.existsSync(localBin))
|
|
1293
1281
|
return localBin;
|
|
1294
|
-
if (sourceExt.includes(
|
|
1282
|
+
if (sourceExt.includes(path2.extname(baseName)))
|
|
1295
1283
|
return;
|
|
1296
|
-
const foundExt = sourceExt.find((ext) =>
|
|
1284
|
+
const foundExt = sourceExt.find((ext) => fs2.existsSync(`${localBin}${ext}`));
|
|
1297
1285
|
if (foundExt)
|
|
1298
1286
|
return `${localBin}${foundExt}`;
|
|
1299
1287
|
return;
|
|
@@ -1305,23 +1293,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1305
1293
|
if (this._scriptPath) {
|
|
1306
1294
|
let resolvedScriptPath;
|
|
1307
1295
|
try {
|
|
1308
|
-
resolvedScriptPath =
|
|
1296
|
+
resolvedScriptPath = fs2.realpathSync(this._scriptPath);
|
|
1309
1297
|
} catch {
|
|
1310
1298
|
resolvedScriptPath = this._scriptPath;
|
|
1311
1299
|
}
|
|
1312
|
-
executableDir =
|
|
1300
|
+
executableDir = path2.resolve(path2.dirname(resolvedScriptPath), executableDir);
|
|
1313
1301
|
}
|
|
1314
1302
|
if (executableDir) {
|
|
1315
1303
|
let localFile = findFile(executableDir, executableFile);
|
|
1316
1304
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1317
|
-
const legacyName =
|
|
1305
|
+
const legacyName = path2.basename(this._scriptPath, path2.extname(this._scriptPath));
|
|
1318
1306
|
if (legacyName !== this._name) {
|
|
1319
1307
|
localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
|
|
1320
1308
|
}
|
|
1321
1309
|
}
|
|
1322
1310
|
executableFile = localFile || executableFile;
|
|
1323
1311
|
}
|
|
1324
|
-
launchWithNode = sourceExt.includes(
|
|
1312
|
+
launchWithNode = sourceExt.includes(path2.extname(executableFile));
|
|
1325
1313
|
let proc;
|
|
1326
1314
|
if (process2.platform !== "win32") {
|
|
1327
1315
|
if (launchWithNode) {
|
|
@@ -1910,13 +1898,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1910
1898
|
cmd.helpGroup(this._defaultCommandGroup);
|
|
1911
1899
|
}
|
|
1912
1900
|
nameFromFilename(filename) {
|
|
1913
|
-
this._name =
|
|
1901
|
+
this._name = path2.basename(filename, path2.extname(filename));
|
|
1914
1902
|
return this;
|
|
1915
1903
|
}
|
|
1916
|
-
executableDir(
|
|
1917
|
-
if (
|
|
1904
|
+
executableDir(path3) {
|
|
1905
|
+
if (path3 === undefined)
|
|
1918
1906
|
return this._executableDir;
|
|
1919
|
-
this._executableDir =
|
|
1907
|
+
this._executableDir = path3;
|
|
1920
1908
|
return this;
|
|
1921
1909
|
}
|
|
1922
1910
|
helpInformation(contextOptions) {
|
|
@@ -2090,7 +2078,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2090
2078
|
});
|
|
2091
2079
|
|
|
2092
2080
|
// ../../../node_modules/commander/index.js
|
|
2093
|
-
var require_commander = __commonJS((exports)
|
|
2081
|
+
var require_commander = __commonJS(function(exports) {
|
|
2094
2082
|
var { Argument } = require_argument();
|
|
2095
2083
|
var { Command } = require_command();
|
|
2096
2084
|
var { CommanderError, InvalidArgumentError } = require_error();
|
|
@@ -2112,7 +2100,7 @@ var require_commander = __commonJS((exports) => {
|
|
|
2112
2100
|
var package_default = {
|
|
2113
2101
|
name: "@uipath/resourcecatalog-tool",
|
|
2114
2102
|
license: "MIT",
|
|
2115
|
-
version: "1.
|
|
2103
|
+
version: "1.202.0-preview.136",
|
|
2116
2104
|
description: "CLI plugin for the UiPath Resource Catalog Service.",
|
|
2117
2105
|
private: false,
|
|
2118
2106
|
repository: {
|
|
@@ -2154,11 +2142,753 @@ var package_default = {
|
|
|
2154
2142
|
}
|
|
2155
2143
|
};
|
|
2156
2144
|
|
|
2145
|
+
// ../../filesystem/src/node.ts
|
|
2146
|
+
import { randomUUID } from "node:crypto";
|
|
2147
|
+
import { existsSync } from "node:fs";
|
|
2148
|
+
import * as fs from "node:fs/promises";
|
|
2149
|
+
import * as os from "node:os";
|
|
2150
|
+
import * as path from "node:path";
|
|
2151
|
+
var LOCK_HEARTBEAT_MS = 5000;
|
|
2152
|
+
var LOCK_STALE_MS = 15000;
|
|
2153
|
+
var LOCK_MAX_WAIT_MS = 20000;
|
|
2154
|
+
var LOCK_MAX_HOLD_MS = 60000;
|
|
2155
|
+
var LOCK_RETRY_MIN_MS = 100;
|
|
2156
|
+
var LOCK_RETRY_JITTER_MS = 200;
|
|
2157
|
+
|
|
2158
|
+
class NodeFileSystem {
|
|
2159
|
+
path = {
|
|
2160
|
+
join: path.join,
|
|
2161
|
+
resolve: path.resolve,
|
|
2162
|
+
relative: path.relative,
|
|
2163
|
+
dirname: path.dirname,
|
|
2164
|
+
isAbsolute: path.isAbsolute,
|
|
2165
|
+
basename: path.basename
|
|
2166
|
+
};
|
|
2167
|
+
env = {
|
|
2168
|
+
cwd: process.cwd,
|
|
2169
|
+
homedir: os.homedir,
|
|
2170
|
+
tmpdir: os.tmpdir,
|
|
2171
|
+
getenv: (key) => process.env[key]
|
|
2172
|
+
};
|
|
2173
|
+
utils = {
|
|
2174
|
+
open: async (url) => {
|
|
2175
|
+
const { default: open } = await import("./index-xnzgkhtg.js");
|
|
2176
|
+
await open(url);
|
|
2177
|
+
}
|
|
2178
|
+
};
|
|
2179
|
+
async readFile(path2, options) {
|
|
2180
|
+
try {
|
|
2181
|
+
if (options) {
|
|
2182
|
+
return await fs.readFile(path2, "utf-8");
|
|
2183
|
+
}
|
|
2184
|
+
return await fs.readFile(path2);
|
|
2185
|
+
} catch (error) {
|
|
2186
|
+
if (this.isEnoent(error))
|
|
2187
|
+
return null;
|
|
2188
|
+
throw error;
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
async writeFile(filePath, data) {
|
|
2192
|
+
const dir = path.dirname(filePath);
|
|
2193
|
+
if (dir) {
|
|
2194
|
+
await fs.mkdir(dir, { recursive: true });
|
|
2195
|
+
}
|
|
2196
|
+
await fs.writeFile(filePath, data);
|
|
2197
|
+
}
|
|
2198
|
+
async appendFile(filePath, data) {
|
|
2199
|
+
const dir = path.dirname(filePath);
|
|
2200
|
+
if (dir) {
|
|
2201
|
+
await fs.mkdir(dir, { recursive: true });
|
|
2202
|
+
}
|
|
2203
|
+
await fs.appendFile(filePath, data);
|
|
2204
|
+
}
|
|
2205
|
+
async readdir(dirPath) {
|
|
2206
|
+
try {
|
|
2207
|
+
return await fs.readdir(dirPath);
|
|
2208
|
+
} catch (error) {
|
|
2209
|
+
if (this.isEnoent(error))
|
|
2210
|
+
return [];
|
|
2211
|
+
throw error;
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
async stat(filePath) {
|
|
2215
|
+
try {
|
|
2216
|
+
const stats = await fs.stat(filePath);
|
|
2217
|
+
return {
|
|
2218
|
+
isFile: () => stats.isFile(),
|
|
2219
|
+
isDirectory: () => stats.isDirectory(),
|
|
2220
|
+
size: stats.size,
|
|
2221
|
+
mtimeMs: stats.mtimeMs
|
|
2222
|
+
};
|
|
2223
|
+
} catch (error) {
|
|
2224
|
+
if (this.isEnoent(error))
|
|
2225
|
+
return null;
|
|
2226
|
+
throw error;
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
async exists(filePath) {
|
|
2230
|
+
return existsSync(filePath);
|
|
2231
|
+
}
|
|
2232
|
+
async mkdir(dirPath) {
|
|
2233
|
+
await fs.mkdir(dirPath, { recursive: true });
|
|
2234
|
+
}
|
|
2235
|
+
async acquireLock(lockPath) {
|
|
2236
|
+
const canonicalPath = await this.canonicalizeLockTarget(lockPath);
|
|
2237
|
+
const lockFile = `${canonicalPath}.lock`;
|
|
2238
|
+
const ownerId = randomUUID();
|
|
2239
|
+
const start = Date.now();
|
|
2240
|
+
while (true) {
|
|
2241
|
+
try {
|
|
2242
|
+
await fs.writeFile(lockFile, ownerId, { flag: "wx" });
|
|
2243
|
+
return this.createLockRelease(lockFile, ownerId);
|
|
2244
|
+
} catch (error) {
|
|
2245
|
+
if (!this.hasErrnoCode(error, "EEXIST")) {
|
|
2246
|
+
throw error;
|
|
2247
|
+
}
|
|
2248
|
+
const stats = await fs.stat(lockFile).catch(() => null);
|
|
2249
|
+
if (stats && Date.now() - stats.mtimeMs > LOCK_STALE_MS) {
|
|
2250
|
+
const reclaimed = await fs.rm(lockFile, { force: true }).then(() => true).catch(() => false);
|
|
2251
|
+
if (reclaimed)
|
|
2252
|
+
continue;
|
|
2253
|
+
}
|
|
2254
|
+
if (Date.now() - start > LOCK_MAX_WAIT_MS) {
|
|
2255
|
+
throw new Error(`ELOCKED: timed out waiting for lock on ${canonicalPath}`);
|
|
2256
|
+
}
|
|
2257
|
+
await new Promise((resolve2) => setTimeout(resolve2, LOCK_RETRY_MIN_MS + Math.random() * LOCK_RETRY_JITTER_MS));
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2260
|
+
}
|
|
2261
|
+
async canonicalizeLockTarget(lockPath) {
|
|
2262
|
+
const absolute = path.resolve(lockPath);
|
|
2263
|
+
const fullReal = await fs.realpath(absolute).catch(() => null);
|
|
2264
|
+
if (fullReal)
|
|
2265
|
+
return fullReal;
|
|
2266
|
+
const parent = path.dirname(absolute);
|
|
2267
|
+
const base = path.basename(absolute);
|
|
2268
|
+
const canonicalParent = await fs.realpath(parent).catch(() => parent);
|
|
2269
|
+
return path.join(canonicalParent, base);
|
|
2270
|
+
}
|
|
2271
|
+
createLockRelease(lockFile, ownerId) {
|
|
2272
|
+
const heartbeatStart = Date.now();
|
|
2273
|
+
let heartbeatTimer;
|
|
2274
|
+
let stopped = false;
|
|
2275
|
+
const stopHeartbeat = () => {
|
|
2276
|
+
stopped = true;
|
|
2277
|
+
if (heartbeatTimer)
|
|
2278
|
+
clearTimeout(heartbeatTimer);
|
|
2279
|
+
};
|
|
2280
|
+
const scheduleNextHeartbeat = () => {
|
|
2281
|
+
if (stopped)
|
|
2282
|
+
return;
|
|
2283
|
+
if (Date.now() - heartbeatStart >= LOCK_MAX_HOLD_MS) {
|
|
2284
|
+
stopped = true;
|
|
2285
|
+
return;
|
|
2286
|
+
}
|
|
2287
|
+
heartbeatTimer = setTimeout(() => {
|
|
2288
|
+
runHeartbeat();
|
|
2289
|
+
}, LOCK_HEARTBEAT_MS);
|
|
2290
|
+
heartbeatTimer.unref?.();
|
|
2291
|
+
};
|
|
2292
|
+
const runHeartbeat = async () => {
|
|
2293
|
+
if (stopped)
|
|
2294
|
+
return;
|
|
2295
|
+
const current = await fs.readFile(lockFile, "utf-8").catch(() => null);
|
|
2296
|
+
if (stopped)
|
|
2297
|
+
return;
|
|
2298
|
+
if (current !== ownerId) {
|
|
2299
|
+
stopped = true;
|
|
2300
|
+
return;
|
|
2301
|
+
}
|
|
2302
|
+
const now = Date.now() / 1000;
|
|
2303
|
+
await fs.utimes(lockFile, now, now).catch(() => {});
|
|
2304
|
+
scheduleNextHeartbeat();
|
|
2305
|
+
};
|
|
2306
|
+
scheduleNextHeartbeat();
|
|
2307
|
+
let released = false;
|
|
2308
|
+
return async () => {
|
|
2309
|
+
if (released)
|
|
2310
|
+
return;
|
|
2311
|
+
released = true;
|
|
2312
|
+
stopHeartbeat();
|
|
2313
|
+
const current = await fs.readFile(lockFile, "utf-8").catch(() => null);
|
|
2314
|
+
if (current === ownerId) {
|
|
2315
|
+
await fs.rm(lockFile, { force: true });
|
|
2316
|
+
}
|
|
2317
|
+
};
|
|
2318
|
+
}
|
|
2319
|
+
async rm(filePath) {
|
|
2320
|
+
await fs.rm(filePath, { recursive: true, force: true });
|
|
2321
|
+
}
|
|
2322
|
+
async rename(oldPath, newPath) {
|
|
2323
|
+
await fs.rename(oldPath, newPath);
|
|
2324
|
+
}
|
|
2325
|
+
async realpath(filePath) {
|
|
2326
|
+
try {
|
|
2327
|
+
return await fs.realpath(filePath);
|
|
2328
|
+
} catch (error) {
|
|
2329
|
+
if (this.isEnoent(error))
|
|
2330
|
+
return filePath;
|
|
2331
|
+
throw error;
|
|
2332
|
+
}
|
|
2333
|
+
}
|
|
2334
|
+
async getTempDir() {
|
|
2335
|
+
return await fs.mkdtemp(path.join(os.tmpdir(), "uipath-fs-"));
|
|
2336
|
+
}
|
|
2337
|
+
async copyDirectory(sourcePath, destPath) {
|
|
2338
|
+
const sourceStats = await this.stat(sourcePath);
|
|
2339
|
+
if (!sourceStats) {
|
|
2340
|
+
throw new Error(`Source directory does not exist: ${sourcePath}`);
|
|
2341
|
+
}
|
|
2342
|
+
if (!sourceStats.isDirectory()) {
|
|
2343
|
+
throw new Error(`Source path is not a directory: ${sourcePath}`);
|
|
2344
|
+
}
|
|
2345
|
+
await this.mkdir(destPath);
|
|
2346
|
+
const entries = await this.readdir(sourcePath);
|
|
2347
|
+
for (const entry of entries) {
|
|
2348
|
+
const srcEntry = path.join(sourcePath, entry);
|
|
2349
|
+
const destEntry = path.join(destPath, entry);
|
|
2350
|
+
const entryStats = await this.stat(srcEntry);
|
|
2351
|
+
if (!entryStats)
|
|
2352
|
+
continue;
|
|
2353
|
+
if (entryStats.isDirectory()) {
|
|
2354
|
+
await this.copyDirectory(srcEntry, destEntry);
|
|
2355
|
+
} else if (entryStats.isFile()) {
|
|
2356
|
+
const content = await this.readFile(srcEntry);
|
|
2357
|
+
if (content !== null) {
|
|
2358
|
+
await this.writeFile(destEntry, content);
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
isEnoent(error) {
|
|
2364
|
+
return this.hasErrnoCode(error, "ENOENT");
|
|
2365
|
+
}
|
|
2366
|
+
hasErrnoCode(error, code) {
|
|
2367
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === code;
|
|
2368
|
+
}
|
|
2369
|
+
}
|
|
2370
|
+
|
|
2371
|
+
// ../../filesystem/src/index.ts
|
|
2372
|
+
var fsInstance = new NodeFileSystem;
|
|
2373
|
+
var getFileSystem = () => fsInstance;
|
|
2374
|
+
|
|
2375
|
+
// ../../common/src/telemetry/pseudonymize.ts
|
|
2376
|
+
var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
|
|
2377
|
+
var PSEUDONYM_HEX_LENGTH = 32;
|
|
2378
|
+
var SHA256_K = new Uint32Array([
|
|
2379
|
+
1116352408,
|
|
2380
|
+
1899447441,
|
|
2381
|
+
3049323471,
|
|
2382
|
+
3921009573,
|
|
2383
|
+
961987163,
|
|
2384
|
+
1508970993,
|
|
2385
|
+
2453635748,
|
|
2386
|
+
2870763221,
|
|
2387
|
+
3624381080,
|
|
2388
|
+
310598401,
|
|
2389
|
+
607225278,
|
|
2390
|
+
1426881987,
|
|
2391
|
+
1925078388,
|
|
2392
|
+
2162078206,
|
|
2393
|
+
2614888103,
|
|
2394
|
+
3248222580,
|
|
2395
|
+
3835390401,
|
|
2396
|
+
4022224774,
|
|
2397
|
+
264347078,
|
|
2398
|
+
604807628,
|
|
2399
|
+
770255983,
|
|
2400
|
+
1249150122,
|
|
2401
|
+
1555081692,
|
|
2402
|
+
1996064986,
|
|
2403
|
+
2554220882,
|
|
2404
|
+
2821834349,
|
|
2405
|
+
2952996808,
|
|
2406
|
+
3210313671,
|
|
2407
|
+
3336571891,
|
|
2408
|
+
3584528711,
|
|
2409
|
+
113926993,
|
|
2410
|
+
338241895,
|
|
2411
|
+
666307205,
|
|
2412
|
+
773529912,
|
|
2413
|
+
1294757372,
|
|
2414
|
+
1396182291,
|
|
2415
|
+
1695183700,
|
|
2416
|
+
1986661051,
|
|
2417
|
+
2177026350,
|
|
2418
|
+
2456956037,
|
|
2419
|
+
2730485921,
|
|
2420
|
+
2820302411,
|
|
2421
|
+
3259730800,
|
|
2422
|
+
3345764771,
|
|
2423
|
+
3516065817,
|
|
2424
|
+
3600352804,
|
|
2425
|
+
4094571909,
|
|
2426
|
+
275423344,
|
|
2427
|
+
430227734,
|
|
2428
|
+
506948616,
|
|
2429
|
+
659060556,
|
|
2430
|
+
883997877,
|
|
2431
|
+
958139571,
|
|
2432
|
+
1322822218,
|
|
2433
|
+
1537002063,
|
|
2434
|
+
1747873779,
|
|
2435
|
+
1955562222,
|
|
2436
|
+
2024104815,
|
|
2437
|
+
2227730452,
|
|
2438
|
+
2361852424,
|
|
2439
|
+
2428436474,
|
|
2440
|
+
2756734187,
|
|
2441
|
+
3204031479,
|
|
2442
|
+
3329325298
|
|
2443
|
+
]);
|
|
2444
|
+
var SHA256_INITIAL_STATE = new Uint32Array([
|
|
2445
|
+
1779033703,
|
|
2446
|
+
3144134277,
|
|
2447
|
+
1013904242,
|
|
2448
|
+
2773480762,
|
|
2449
|
+
1359893119,
|
|
2450
|
+
2600822924,
|
|
2451
|
+
528734635,
|
|
2452
|
+
1541459225
|
|
2453
|
+
]);
|
|
2454
|
+
function rotr(value, bits) {
|
|
2455
|
+
return (value >>> bits | value << 32 - bits) >>> 0;
|
|
2456
|
+
}
|
|
2457
|
+
function sha256Hex(input) {
|
|
2458
|
+
const bytes = new TextEncoder().encode(input);
|
|
2459
|
+
const paddedLength = bytes.length + 9 + 63 >> 6 << 6;
|
|
2460
|
+
const buffer = new Uint8Array(paddedLength);
|
|
2461
|
+
buffer.set(bytes);
|
|
2462
|
+
buffer[bytes.length] = 128;
|
|
2463
|
+
const view = new DataView(buffer.buffer);
|
|
2464
|
+
const bitLength = bytes.length * 8;
|
|
2465
|
+
view.setUint32(paddedLength - 8, Math.floor(bitLength / 4294967296));
|
|
2466
|
+
view.setUint32(paddedLength - 4, bitLength >>> 0);
|
|
2467
|
+
const state = SHA256_INITIAL_STATE.slice();
|
|
2468
|
+
const schedule = new Uint32Array(64);
|
|
2469
|
+
for (let offset = 0;offset < paddedLength; offset += 64) {
|
|
2470
|
+
for (let i = 0;i < 16; i++) {
|
|
2471
|
+
schedule[i] = view.getUint32(offset + i * 4);
|
|
2472
|
+
}
|
|
2473
|
+
for (let i = 16;i < 64; i++) {
|
|
2474
|
+
const x = schedule[i - 15];
|
|
2475
|
+
const y = schedule[i - 2];
|
|
2476
|
+
const s0 = (rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3) >>> 0;
|
|
2477
|
+
const s1 = (rotr(y, 17) ^ rotr(y, 19) ^ y >>> 10) >>> 0;
|
|
2478
|
+
schedule[i] = schedule[i - 16] + s0 + schedule[i - 7] + s1 >>> 0;
|
|
2479
|
+
}
|
|
2480
|
+
let a = state[0];
|
|
2481
|
+
let b = state[1];
|
|
2482
|
+
let c = state[2];
|
|
2483
|
+
let d = state[3];
|
|
2484
|
+
let e = state[4];
|
|
2485
|
+
let f = state[5];
|
|
2486
|
+
let g = state[6];
|
|
2487
|
+
let h = state[7];
|
|
2488
|
+
for (let i = 0;i < 64; i++) {
|
|
2489
|
+
const s1 = (rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25)) >>> 0;
|
|
2490
|
+
const ch = (e & f ^ ~e & g) >>> 0;
|
|
2491
|
+
const temp1 = h + s1 + ch + SHA256_K[i] + schedule[i] >>> 0;
|
|
2492
|
+
const s0 = (rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) >>> 0;
|
|
2493
|
+
const maj = (a & b ^ a & c ^ b & c) >>> 0;
|
|
2494
|
+
const temp2 = s0 + maj >>> 0;
|
|
2495
|
+
h = g;
|
|
2496
|
+
g = f;
|
|
2497
|
+
f = e;
|
|
2498
|
+
e = d + temp1 >>> 0;
|
|
2499
|
+
d = c;
|
|
2500
|
+
c = b;
|
|
2501
|
+
b = a;
|
|
2502
|
+
a = temp1 + temp2 >>> 0;
|
|
2503
|
+
}
|
|
2504
|
+
state[0] = state[0] + a >>> 0;
|
|
2505
|
+
state[1] = state[1] + b >>> 0;
|
|
2506
|
+
state[2] = state[2] + c >>> 0;
|
|
2507
|
+
state[3] = state[3] + d >>> 0;
|
|
2508
|
+
state[4] = state[4] + e >>> 0;
|
|
2509
|
+
state[5] = state[5] + f >>> 0;
|
|
2510
|
+
state[6] = state[6] + g >>> 0;
|
|
2511
|
+
state[7] = state[7] + h >>> 0;
|
|
2512
|
+
}
|
|
2513
|
+
let hex = "";
|
|
2514
|
+
for (const word of state) {
|
|
2515
|
+
hex += word.toString(16).padStart(8, "0");
|
|
2516
|
+
}
|
|
2517
|
+
return hex;
|
|
2518
|
+
}
|
|
2519
|
+
function resolveSha256Hex() {
|
|
2520
|
+
try {
|
|
2521
|
+
const nodeCrypto = __require("node:crypto");
|
|
2522
|
+
const createHash = nodeCrypto?.createHash;
|
|
2523
|
+
if (typeof createHash !== "function") {
|
|
2524
|
+
return sha256Hex;
|
|
2525
|
+
}
|
|
2526
|
+
const native = (input) => createHash("sha256").update(input, "utf8").digest("hex");
|
|
2527
|
+
return native("abc") === sha256Hex("abc") ? native : sha256Hex;
|
|
2528
|
+
} catch {
|
|
2529
|
+
return sha256Hex;
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
var cachedSha256Hex;
|
|
2533
|
+
function digest(input) {
|
|
2534
|
+
cachedSha256Hex ??= resolveSha256Hex();
|
|
2535
|
+
return cachedSha256Hex(input);
|
|
2536
|
+
}
|
|
2537
|
+
function pseudonymize(input) {
|
|
2538
|
+
return digest(`${PSEUDONYM_DOMAIN}${input}`).slice(0, PSEUDONYM_HEX_LENGTH);
|
|
2539
|
+
}
|
|
2540
|
+
|
|
2541
|
+
// ../../common/src/singleton.ts
|
|
2542
|
+
var PREFIX = "@uipath/common/";
|
|
2543
|
+
var _g = globalThis;
|
|
2544
|
+
function singleton(ctorOrName) {
|
|
2545
|
+
const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
|
|
2546
|
+
const key = Symbol.for(PREFIX + name);
|
|
2547
|
+
return {
|
|
2548
|
+
get(fallback) {
|
|
2549
|
+
return _g[key] ?? fallback;
|
|
2550
|
+
},
|
|
2551
|
+
set(value) {
|
|
2552
|
+
_g[key] = value;
|
|
2553
|
+
},
|
|
2554
|
+
clear() {
|
|
2555
|
+
delete _g[key];
|
|
2556
|
+
},
|
|
2557
|
+
getOrInit(factory, guard) {
|
|
2558
|
+
const existing = _g[key];
|
|
2559
|
+
if (existing != null && typeof existing === "object") {
|
|
2560
|
+
if (!guard || guard(existing)) {
|
|
2561
|
+
return existing;
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
const instance = factory();
|
|
2565
|
+
_g[key] = instance;
|
|
2566
|
+
return instance;
|
|
2567
|
+
}
|
|
2568
|
+
};
|
|
2569
|
+
}
|
|
2570
|
+
|
|
2571
|
+
// ../../common/src/telemetry/supplied-values.ts
|
|
2572
|
+
var suppliedValuesSlot = singleton("TelemetrySuppliedArgumentValues");
|
|
2573
|
+
function activeEntries() {
|
|
2574
|
+
const existing = suppliedValuesSlot.get();
|
|
2575
|
+
return Array.isArray(existing) ? existing : [];
|
|
2576
|
+
}
|
|
2577
|
+
var MIN_SCRUBBABLE_LENGTH = 4;
|
|
2578
|
+
function recordSuppliedArgumentValues(values) {
|
|
2579
|
+
const flat = [];
|
|
2580
|
+
const push = (value) => {
|
|
2581
|
+
if (Array.isArray(value)) {
|
|
2582
|
+
for (const item of value) {
|
|
2583
|
+
push(item);
|
|
2584
|
+
}
|
|
2585
|
+
return;
|
|
2586
|
+
}
|
|
2587
|
+
if (typeof value === "string" && value.length >= MIN_SCRUBBABLE_LENGTH) {
|
|
2588
|
+
flat.push(value);
|
|
2589
|
+
}
|
|
2590
|
+
};
|
|
2591
|
+
push(values);
|
|
2592
|
+
const entry = { values: flat };
|
|
2593
|
+
suppliedValuesSlot.set([...activeEntries(), entry]);
|
|
2594
|
+
return entry;
|
|
2595
|
+
}
|
|
2596
|
+
function releaseSuppliedArgumentValues(entry) {
|
|
2597
|
+
suppliedValuesSlot.set(activeEntries().filter((held) => held !== entry));
|
|
2598
|
+
}
|
|
2599
|
+
function getSuppliedArgumentValues() {
|
|
2600
|
+
const all = new Set;
|
|
2601
|
+
for (const entry of activeEntries()) {
|
|
2602
|
+
for (const value of entry.values) {
|
|
2603
|
+
all.add(value);
|
|
2604
|
+
}
|
|
2605
|
+
}
|
|
2606
|
+
return [...all].sort((a, b) => b.length - a.length);
|
|
2607
|
+
}
|
|
2608
|
+
|
|
2609
|
+
// ../../common/src/telemetry/pii-redactor.ts
|
|
2610
|
+
var REDACTED = "[REDACTED]";
|
|
2611
|
+
var MAX_VALUE_LENGTH = 280;
|
|
2612
|
+
var MAX_STACK_LENGTH = 4096;
|
|
2613
|
+
var MAX_SCAN_LENGTH = MAX_STACK_LENGTH;
|
|
2614
|
+
function truncate(value, maxLength) {
|
|
2615
|
+
return value.length > maxLength ? `${value.slice(0, maxLength)}…` : value;
|
|
2616
|
+
}
|
|
2617
|
+
var SENSITIVE_NAME_TOKENS = new Set([
|
|
2618
|
+
"token",
|
|
2619
|
+
"tokens",
|
|
2620
|
+
"secret",
|
|
2621
|
+
"secrets",
|
|
2622
|
+
"password",
|
|
2623
|
+
"passwords",
|
|
2624
|
+
"pwd",
|
|
2625
|
+
"credential",
|
|
2626
|
+
"credentials",
|
|
2627
|
+
"auth",
|
|
2628
|
+
"authentication",
|
|
2629
|
+
"authorization",
|
|
2630
|
+
"authority",
|
|
2631
|
+
"cert",
|
|
2632
|
+
"certificate",
|
|
2633
|
+
"certificates"
|
|
2634
|
+
]);
|
|
2635
|
+
var SENSITIVE_KEY_PREFIXES = new Set([
|
|
2636
|
+
"api",
|
|
2637
|
+
"access",
|
|
2638
|
+
"client",
|
|
2639
|
+
"private",
|
|
2640
|
+
"public",
|
|
2641
|
+
"signing",
|
|
2642
|
+
"encryption",
|
|
2643
|
+
"session",
|
|
2644
|
+
"master",
|
|
2645
|
+
"shared",
|
|
2646
|
+
"root",
|
|
2647
|
+
"ssh",
|
|
2648
|
+
"rsa",
|
|
2649
|
+
"aes",
|
|
2650
|
+
"hmac",
|
|
2651
|
+
"oauth"
|
|
2652
|
+
]);
|
|
2653
|
+
var UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
|
|
2654
|
+
var EMAIL_PATTERN = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
2655
|
+
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
2656
|
+
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
2657
|
+
var PADDED_BASE64_PATTERN = /[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
|
|
2658
|
+
var BASE64_WITH_PLUS_PATTERN = /[A-Za-z0-9+/]{40,}/g;
|
|
2659
|
+
var USER_HOME_PATTERN = /(?<![A-Za-z0-9._-])([/\\])(Users|home|Profiles)([/\\])([^/\\]+)/gi;
|
|
2660
|
+
var UNC_PATH_PATTERN = /(^|[\s"'<>|=,;([{])(\\\\[^\s"'<>|]+)/g;
|
|
2661
|
+
var HOST_PORT_PATTERN = /(?<![/@.\w-])(?!\d+\.\d+\.\d+\.\d+:)[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?(?:\.[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?)+:\d{1,5}\b/g;
|
|
2662
|
+
var SOURCE_FILE_EXTENSIONS = new Set([
|
|
2663
|
+
"ts",
|
|
2664
|
+
"tsx",
|
|
2665
|
+
"js",
|
|
2666
|
+
"jsx",
|
|
2667
|
+
"mjs",
|
|
2668
|
+
"cjs",
|
|
2669
|
+
"cts",
|
|
2670
|
+
"mts",
|
|
2671
|
+
"py",
|
|
2672
|
+
"cs",
|
|
2673
|
+
"java",
|
|
2674
|
+
"go",
|
|
2675
|
+
"rs",
|
|
2676
|
+
"rb",
|
|
2677
|
+
"php",
|
|
2678
|
+
"sh",
|
|
2679
|
+
"ps1",
|
|
2680
|
+
"json",
|
|
2681
|
+
"jsonc",
|
|
2682
|
+
"yaml",
|
|
2683
|
+
"yml",
|
|
2684
|
+
"xml",
|
|
2685
|
+
"xaml",
|
|
2686
|
+
"md",
|
|
2687
|
+
"txt",
|
|
2688
|
+
"log",
|
|
2689
|
+
"css",
|
|
2690
|
+
"html",
|
|
2691
|
+
"htm",
|
|
2692
|
+
"csproj",
|
|
2693
|
+
"nuspec",
|
|
2694
|
+
"sql"
|
|
2695
|
+
]);
|
|
2696
|
+
var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
|
|
2697
|
+
var QUOTED_LITERAL_MAX_SPAN = 200;
|
|
2698
|
+
var QUOTED_LITERAL_PATTERN = new RegExp([
|
|
2699
|
+
`(?<![A-Za-z0-9])'(?:[^\\
|
|
2700
|
+
]|\\.){2,${QUOTED_LITERAL_MAX_SPAN}}?'(?![A-Za-z0-9])`,
|
|
2701
|
+
`(?<![A-Za-z0-9])"(?:[^\\
|
|
2702
|
+
]|\\.){2,${QUOTED_LITERAL_MAX_SPAN}}?"(?![A-Za-z0-9])`
|
|
2703
|
+
].join("|"), "g");
|
|
2704
|
+
var JSON_BODY_PATTERN = /[{[][^{}[\]]*[:,][^{}[\]]*[\]}]/g;
|
|
2705
|
+
var COLLAPSED_BODY = "{…}";
|
|
2706
|
+
var COLLAPSED_BODY_MARKER = "\x01body\x01";
|
|
2707
|
+
var MAX_BODY_NESTING = 8;
|
|
2708
|
+
function collapseJsonBodies(text) {
|
|
2709
|
+
let out = text;
|
|
2710
|
+
for (let pass = 0;pass < MAX_BODY_NESTING; pass++) {
|
|
2711
|
+
const next = out.replace(JSON_BODY_PATTERN, COLLAPSED_BODY_MARKER);
|
|
2712
|
+
if (next === out) {
|
|
2713
|
+
break;
|
|
2714
|
+
}
|
|
2715
|
+
out = next;
|
|
2716
|
+
}
|
|
2717
|
+
return out.split(COLLAPSED_BODY_MARKER).join(COLLAPSED_BODY);
|
|
2718
|
+
}
|
|
2719
|
+
var TRAILING_PROSE_PUNCT = /[.,;:!?)\]}>'"]+$/;
|
|
2720
|
+
function peelTrailingPunctuation(match) {
|
|
2721
|
+
const trailing = match.match(TRAILING_PROSE_PUNCT)?.[0] ?? "";
|
|
2722
|
+
return trailing ? [match.slice(0, -trailing.length), trailing] : [match, ""];
|
|
2723
|
+
}
|
|
2724
|
+
function redactUrl(raw) {
|
|
2725
|
+
try {
|
|
2726
|
+
const url = new URL(raw);
|
|
2727
|
+
return `${url.protocol}//${url.host}`;
|
|
2728
|
+
} catch {
|
|
2729
|
+
return `url#${pseudonymize(raw)}`;
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2732
|
+
function redactValueDetectors(value, maxLength = MAX_VALUE_LENGTH) {
|
|
2733
|
+
let out = truncate(value, MAX_SCAN_LENGTH);
|
|
2734
|
+
out = out.replace(JWT_PATTERN, () => REDACTED);
|
|
2735
|
+
out = out.replace(URL_PATTERN, (match) => {
|
|
2736
|
+
const [core, trailing] = peelTrailingPunctuation(match);
|
|
2737
|
+
return `${redactUrl(core)}${trailing}`;
|
|
2738
|
+
});
|
|
2739
|
+
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
2740
|
+
out = out.replace(UNC_PATH_PATTERN, (_match, before, path2) => {
|
|
2741
|
+
const [core, trailing] = peelTrailingPunctuation(path2);
|
|
2742
|
+
return `${before}unc#${pseudonymize(core)}${trailing}`;
|
|
2743
|
+
});
|
|
2744
|
+
out = out.replace(EMAIL_PATTERN, (match) => `email#${pseudonymize(match)}`);
|
|
2745
|
+
out = out.replace(UUID_PATTERN, (match) => `uuid#${pseudonymize(match)}`);
|
|
2746
|
+
out = out.replace(HOST_PORT_PATTERN, (match) => {
|
|
2747
|
+
const split = match.lastIndexOf(":");
|
|
2748
|
+
const host = match.slice(0, split);
|
|
2749
|
+
const extension = host.slice(host.lastIndexOf(".") + 1).toLowerCase();
|
|
2750
|
+
if (SOURCE_FILE_EXTENSIONS.has(extension)) {
|
|
2751
|
+
return match;
|
|
2752
|
+
}
|
|
2753
|
+
return `host#${pseudonymize(host)}:${match.slice(split + 1)}`;
|
|
2754
|
+
});
|
|
2755
|
+
out = out.replace(PADDED_BASE64_PATTERN, () => REDACTED);
|
|
2756
|
+
out = out.replace(BASE64_WITH_PLUS_PATTERN, (match) => match.includes("+") ? REDACTED : match);
|
|
2757
|
+
out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
|
|
2758
|
+
return truncate(out, maxLength);
|
|
2759
|
+
}
|
|
2760
|
+
function redactSpanName(name) {
|
|
2761
|
+
return redactValueDetectors(truncate(name, MAX_SCAN_LENGTH).replace(QUOTED_LITERAL_PATTERN, (match) => `${match[0]}<redacted>${match[0]}`));
|
|
2762
|
+
}
|
|
2763
|
+
var HTTP_DEPENDENCY_NAME = /^([A-Z]+) (\/.*)$/s;
|
|
2764
|
+
function redactHttpDependencyName(name) {
|
|
2765
|
+
const parts = HTTP_DEPENDENCY_NAME.exec(name);
|
|
2766
|
+
if (!parts) {
|
|
2767
|
+
return redactMessage(name);
|
|
2768
|
+
}
|
|
2769
|
+
return `${parts[1]} ${redactMessage(parts[2])}`;
|
|
2770
|
+
}
|
|
2771
|
+
function redactMessage(value) {
|
|
2772
|
+
let out = collapseJsonBodies(truncate(value, MAX_SCAN_LENGTH)).replace(QUOTED_LITERAL_PATTERN, (match) => `${match[0]}<redacted>${match[0]}`);
|
|
2773
|
+
for (const supplied of getSuppliedArgumentValues()) {
|
|
2774
|
+
out = out.split(supplied).join(REDACTED);
|
|
2775
|
+
}
|
|
2776
|
+
return redactValueDetectors(out);
|
|
2777
|
+
}
|
|
2778
|
+
var MESSAGE_NAMES = new Set([
|
|
2779
|
+
"message",
|
|
2780
|
+
"errormessage",
|
|
2781
|
+
"errmessage",
|
|
2782
|
+
"error_message",
|
|
2783
|
+
"msg",
|
|
2784
|
+
"detail",
|
|
2785
|
+
"details",
|
|
2786
|
+
"reason",
|
|
2787
|
+
"instructions",
|
|
2788
|
+
"warning"
|
|
2789
|
+
]);
|
|
2790
|
+
function isFreeFormValue(name, value) {
|
|
2791
|
+
return MESSAGE_NAMES.has(name.toLowerCase()) || /['"{[]/.test(value);
|
|
2792
|
+
}
|
|
2793
|
+
function redactError(error) {
|
|
2794
|
+
const safe = new Error(redactMessage(error.message ?? ""));
|
|
2795
|
+
safe.name = error.name;
|
|
2796
|
+
safe.stack = typeof error.stack === "string" ? redactStack(error.stack) : undefined;
|
|
2797
|
+
return safe;
|
|
2798
|
+
}
|
|
2799
|
+
function redactStack(stack) {
|
|
2800
|
+
const bounded = truncate(stack, MAX_STACK_LENGTH);
|
|
2801
|
+
const firstBreak = bounded.indexOf(`
|
|
2802
|
+
`);
|
|
2803
|
+
if (firstBreak === -1) {
|
|
2804
|
+
return redactMessage(bounded);
|
|
2805
|
+
}
|
|
2806
|
+
return `${redactMessage(bounded.slice(0, firstBreak))}
|
|
2807
|
+
${redactValueDetectors(bounded.slice(firstBreak + 1), MAX_STACK_LENGTH)}`;
|
|
2808
|
+
}
|
|
2809
|
+
function nameTokens(name) {
|
|
2810
|
+
return name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[\s._-]+/).map((t) => t.toLowerCase()).filter(Boolean);
|
|
2811
|
+
}
|
|
2812
|
+
function isSensitiveName(name) {
|
|
2813
|
+
const tokens = nameTokens(name);
|
|
2814
|
+
for (let i = 0;i < tokens.length; i++) {
|
|
2815
|
+
const token = tokens[i];
|
|
2816
|
+
if (SENSITIVE_NAME_TOKENS.has(token)) {
|
|
2817
|
+
return true;
|
|
2818
|
+
}
|
|
2819
|
+
if (token === "key" || token === "keys") {
|
|
2820
|
+
const prev = tokens[i - 1];
|
|
2821
|
+
if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
|
|
2822
|
+
return true;
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
}
|
|
2826
|
+
return false;
|
|
2827
|
+
}
|
|
2828
|
+
function redactProperty(name, value) {
|
|
2829
|
+
if (value === undefined || value === null) {
|
|
2830
|
+
return;
|
|
2831
|
+
}
|
|
2832
|
+
if (isSensitiveName(name)) {
|
|
2833
|
+
return REDACTED;
|
|
2834
|
+
}
|
|
2835
|
+
if (typeof value === "boolean" || typeof value === "number") {
|
|
2836
|
+
return value;
|
|
2837
|
+
}
|
|
2838
|
+
if (typeof value !== "string") {
|
|
2839
|
+
return "[OBJECT]";
|
|
2840
|
+
}
|
|
2841
|
+
return isFreeFormValue(name, value) ? redactMessage(value) : redactValueDetectors(value);
|
|
2842
|
+
}
|
|
2843
|
+
function redactProperties(properties) {
|
|
2844
|
+
const out = {};
|
|
2845
|
+
for (const [name, value] of Object.entries(properties)) {
|
|
2846
|
+
const redacted = redactProperty(name, value);
|
|
2847
|
+
if (redacted !== undefined) {
|
|
2848
|
+
out[name] = redacted;
|
|
2849
|
+
}
|
|
2850
|
+
}
|
|
2851
|
+
return out;
|
|
2852
|
+
}
|
|
2853
|
+
|
|
2157
2854
|
// ../../common/src/catch-error.ts
|
|
2855
|
+
var MAX_SERIALIZED_LENGTH = 500;
|
|
2856
|
+
var TRUNCATION_SUFFIX = "…(truncated)";
|
|
2857
|
+
var REDACTED2 = "[REDACTED]";
|
|
2858
|
+
function cap(text) {
|
|
2859
|
+
return text.length > MAX_SERIALIZED_LENGTH ? `${text.slice(0, MAX_SERIALIZED_LENGTH)}${TRUNCATION_SUFFIX}` : text;
|
|
2860
|
+
}
|
|
2861
|
+
function omitSensitive(key, value) {
|
|
2862
|
+
return key.length > 0 && isSensitiveName(key) ? REDACTED2 : value;
|
|
2863
|
+
}
|
|
2864
|
+
function describeThrownValue(value) {
|
|
2865
|
+
if (typeof value !== "object" || value === null) {
|
|
2866
|
+
return String(value);
|
|
2867
|
+
}
|
|
2868
|
+
let message;
|
|
2869
|
+
try {
|
|
2870
|
+
message = value.message;
|
|
2871
|
+
} catch {
|
|
2872
|
+
message = undefined;
|
|
2873
|
+
}
|
|
2874
|
+
if (typeof message === "string" && message.length > 0) {
|
|
2875
|
+
return cap(message);
|
|
2876
|
+
}
|
|
2877
|
+
try {
|
|
2878
|
+
const json = JSON.stringify(value, omitSensitive);
|
|
2879
|
+
if (json !== undefined) {
|
|
2880
|
+
return cap(json);
|
|
2881
|
+
}
|
|
2882
|
+
} catch {}
|
|
2883
|
+
return String(value);
|
|
2884
|
+
}
|
|
2885
|
+
function toError(error) {
|
|
2886
|
+
return error instanceof Error ? error : new Error(describeThrownValue(error), { cause: error });
|
|
2887
|
+
}
|
|
2158
2888
|
function isPromiseLike(value) {
|
|
2159
2889
|
return value !== null && typeof value === "object" && typeof value.then === "function";
|
|
2160
2890
|
}
|
|
2161
|
-
function
|
|
2891
|
+
function catchError(fnOrPromise) {
|
|
2162
2892
|
if (isPromiseLike(fnOrPromise)) {
|
|
2163
2893
|
return settlePromiseLike(fnOrPromise);
|
|
2164
2894
|
}
|
|
@@ -2169,17 +2899,11 @@ function catchError2(fnOrPromise) {
|
|
|
2169
2899
|
}
|
|
2170
2900
|
return [undefined, result];
|
|
2171
2901
|
} catch (error) {
|
|
2172
|
-
return [
|
|
2173
|
-
error instanceof Error ? error : new Error(String(error)),
|
|
2174
|
-
undefined
|
|
2175
|
-
];
|
|
2902
|
+
return [toError(error), undefined];
|
|
2176
2903
|
}
|
|
2177
2904
|
}
|
|
2178
2905
|
function settlePromiseLike(thenable) {
|
|
2179
|
-
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [
|
|
2180
|
-
error instanceof Error ? error : new Error(String(error)),
|
|
2181
|
-
undefined
|
|
2182
|
-
]);
|
|
2906
|
+
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
|
|
2183
2907
|
}
|
|
2184
2908
|
|
|
2185
2909
|
// ../../common/src/error-handler.ts
|
|
@@ -2213,8 +2937,8 @@ var TLS_INSTRUCTIONS = "The server's TLS certificate could not be verified. Most
|
|
|
2213
2937
|
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.";
|
|
2214
2938
|
var LOCAL_PERMISSION_ERROR_CODES = new Set(["EACCES", "EPERM", "EROFS"]);
|
|
2215
2939
|
var LOCAL_PERMISSION_MESSAGE_PATTERN = /\b(EACCES|EPERM|EROFS)\b/;
|
|
2216
|
-
function localPermissionInstructions(code,
|
|
2217
|
-
const target =
|
|
2940
|
+
function localPermissionInstructions(code, path2) {
|
|
2941
|
+
const target = path2 !== undefined ? `'${path2}'` : "a local file or resource";
|
|
2218
2942
|
if (code === "EROFS") {
|
|
2219
2943
|
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.";
|
|
2220
2944
|
}
|
|
@@ -2250,12 +2974,12 @@ function describePermissionError(error) {
|
|
|
2250
2974
|
const code = matchLocalPermissionCode(cur.code, message);
|
|
2251
2975
|
if (!code)
|
|
2252
2976
|
continue;
|
|
2253
|
-
const
|
|
2977
|
+
const path2 = localPermissionPath(cur.path, message);
|
|
2254
2978
|
return {
|
|
2255
2979
|
code,
|
|
2256
2980
|
message: message ?? code,
|
|
2257
|
-
...
|
|
2258
|
-
instructions: localPermissionInstructions(code,
|
|
2981
|
+
...path2 !== undefined ? { path: path2 } : {},
|
|
2982
|
+
instructions: localPermissionInstructions(code, path2)
|
|
2259
2983
|
};
|
|
2260
2984
|
}
|
|
2261
2985
|
return;
|
|
@@ -2267,9 +2991,9 @@ function matchLocalPermissionCode(code, message) {
|
|
|
2267
2991
|
const match = message ? LOCAL_PERMISSION_MESSAGE_PATTERN.exec(message) : null;
|
|
2268
2992
|
return match ? match[1] : undefined;
|
|
2269
2993
|
}
|
|
2270
|
-
function localPermissionPath(
|
|
2271
|
-
if (typeof
|
|
2272
|
-
return
|
|
2994
|
+
function localPermissionPath(path2, message) {
|
|
2995
|
+
if (typeof path2 === "string")
|
|
2996
|
+
return path2;
|
|
2273
2997
|
return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
|
|
2274
2998
|
}
|
|
2275
2999
|
function* walkErrorGraph(error) {
|
|
@@ -2378,10 +3102,10 @@ async function extractErrorDetails(error, options) {
|
|
|
2378
3102
|
let parsedBody;
|
|
2379
3103
|
const textFn = response?.text?.bind(response);
|
|
2380
3104
|
if (textFn) {
|
|
2381
|
-
const [bodyError, body] = await
|
|
3105
|
+
const [bodyError, body] = await catchError((async () => textFn())());
|
|
2382
3106
|
if (!bodyError && body) {
|
|
2383
3107
|
rawBody = body;
|
|
2384
|
-
const [parseError, parsed] =
|
|
3108
|
+
const [parseError, parsed] = catchError(() => JSON.parse(body));
|
|
2385
3109
|
if (!parseError && parsed && typeof parsed === "object") {
|
|
2386
3110
|
parsedBody = parsed;
|
|
2387
3111
|
if (parsedBody.errors && typeof parsedBody.errors === "object") {
|
|
@@ -2484,7 +3208,7 @@ async function extractErrorDetails(error, options) {
|
|
|
2484
3208
|
} else if (typeof err.message === "string") {
|
|
2485
3209
|
details = err.message;
|
|
2486
3210
|
} else {
|
|
2487
|
-
details =
|
|
3211
|
+
details = describeThrownValue(error);
|
|
2488
3212
|
}
|
|
2489
3213
|
const context = {};
|
|
2490
3214
|
if (status) {
|
|
@@ -2560,73 +3284,14 @@ async function extractErrorMessage(error, options) {
|
|
|
2560
3284
|
const { message } = await extractErrorDetails(error, options);
|
|
2561
3285
|
return message;
|
|
2562
3286
|
}
|
|
2563
|
-
//
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
program,
|
|
2567
|
-
createCommand,
|
|
2568
|
-
createArgument,
|
|
2569
|
-
createOption,
|
|
2570
|
-
CommanderError,
|
|
2571
|
-
InvalidArgumentError,
|
|
2572
|
-
InvalidOptionArgumentError,
|
|
2573
|
-
Command,
|
|
2574
|
-
Argument,
|
|
2575
|
-
Option,
|
|
2576
|
-
Help
|
|
2577
|
-
} = import__.default;
|
|
2578
|
-
|
|
2579
|
-
// ../../common/src/command-examples.ts
|
|
2580
|
-
var examplesByCommand = new WeakMap;
|
|
2581
|
-
Command.prototype.examples = function(examples) {
|
|
2582
|
-
examplesByCommand.set(this, examples);
|
|
2583
|
-
return this;
|
|
2584
|
-
};
|
|
2585
|
-
// ../../common/src/singleton.ts
|
|
2586
|
-
var PREFIX = "@uipath/common/";
|
|
2587
|
-
var _g = globalThis;
|
|
2588
|
-
function singleton(ctorOrName) {
|
|
2589
|
-
const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
|
|
2590
|
-
const key = Symbol.for(PREFIX + name);
|
|
2591
|
-
return {
|
|
2592
|
-
get(fallback) {
|
|
2593
|
-
return _g[key] ?? fallback;
|
|
2594
|
-
},
|
|
2595
|
-
set(value) {
|
|
2596
|
-
_g[key] = value;
|
|
2597
|
-
},
|
|
2598
|
-
clear() {
|
|
2599
|
-
delete _g[key];
|
|
2600
|
-
},
|
|
2601
|
-
getOrInit(factory, guard) {
|
|
2602
|
-
const existing = _g[key];
|
|
2603
|
-
if (existing != null && typeof existing === "object") {
|
|
2604
|
-
if (!guard || guard(existing)) {
|
|
2605
|
-
return existing;
|
|
2606
|
-
}
|
|
2607
|
-
}
|
|
2608
|
-
const instance = factory();
|
|
2609
|
-
_g[key] = instance;
|
|
2610
|
-
return instance;
|
|
2611
|
-
}
|
|
2612
|
-
};
|
|
2613
|
-
}
|
|
2614
|
-
|
|
2615
|
-
// ../../common/src/preview.ts
|
|
2616
|
-
var previewSlot = singleton("PreviewBuild");
|
|
2617
|
-
function isPreviewBuild() {
|
|
2618
|
-
return previewSlot.get(false) ?? false;
|
|
3287
|
+
// ../../common/src/exit-code.ts
|
|
3288
|
+
function setExitCode(code) {
|
|
3289
|
+
process.exitCode = code;
|
|
2619
3290
|
}
|
|
2620
|
-
Command.prototype.previewCommand = function(nameAndArgs, opts) {
|
|
2621
|
-
if (isPreviewBuild()) {
|
|
2622
|
-
return this.command(nameAndArgs, opts);
|
|
2623
|
-
}
|
|
2624
|
-
return new Command(nameAndArgs.split(/\s+/)[0] ?? nameAndArgs);
|
|
2625
|
-
};
|
|
2626
3291
|
|
|
2627
3292
|
// ../../common/src/output-context.ts
|
|
2628
3293
|
function createStorage() {
|
|
2629
|
-
const [error, mod] =
|
|
3294
|
+
const [error, mod] = catchError(() => __require("node:async_hooks"));
|
|
2630
3295
|
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
2631
3296
|
return {
|
|
2632
3297
|
getStore: () => {
|
|
@@ -2657,8 +3322,8 @@ function getOutputSink() {
|
|
|
2657
3322
|
|
|
2658
3323
|
// ../../common/src/logger.ts
|
|
2659
3324
|
var logFilePathSlot = singleton("logFilePath");
|
|
2660
|
-
function setGlobalLogFilePath(
|
|
2661
|
-
logFilePathSlot.set(
|
|
3325
|
+
function setGlobalLogFilePath(path2) {
|
|
3326
|
+
logFilePathSlot.set(path2);
|
|
2662
3327
|
}
|
|
2663
3328
|
function getGlobalLogFilePath() {
|
|
2664
3329
|
return logFilePathSlot.get("");
|
|
@@ -2695,7 +3360,7 @@ class SimpleLogger {
|
|
|
2695
3360
|
}
|
|
2696
3361
|
return DEFAULT_LOG_LEVEL;
|
|
2697
3362
|
}
|
|
2698
|
-
const [localStorageError, hasDebug] =
|
|
3363
|
+
const [localStorageError, hasDebug] = catchError(() => typeof localStorage !== "undefined" && !!localStorage.getItem("debug"));
|
|
2699
3364
|
if (!localStorageError && hasDebug) {
|
|
2700
3365
|
return 0 /* DEBUG */;
|
|
2701
3366
|
}
|
|
@@ -2726,54 +3391,49 @@ class SimpleLogger {
|
|
|
2726
3391
|
return this.fileLoggingEnabled || !!getGlobalLogFilePath();
|
|
2727
3392
|
}
|
|
2728
3393
|
writeToFile(formatted) {
|
|
2729
|
-
const
|
|
2730
|
-
if (!
|
|
3394
|
+
const path2 = this.logFilePath || getGlobalLogFilePath();
|
|
3395
|
+
if (!path2)
|
|
2731
3396
|
return;
|
|
2732
3397
|
const timestamp = new Date().toISOString();
|
|
2733
3398
|
this.pendingWrites = Promise.all([
|
|
2734
3399
|
this.pendingWrites,
|
|
2735
3400
|
this.pendingInit
|
|
2736
|
-
]).then(() => getFileSystem().appendFile(
|
|
3401
|
+
]).then(() => getFileSystem().appendFile(path2, `${timestamp} ${formatted}`).catch(() => {}));
|
|
2737
3402
|
}
|
|
2738
|
-
|
|
2739
|
-
if (this.level > 0 /* DEBUG */)
|
|
2740
|
-
return;
|
|
2741
|
-
const formatted = this.format(`[DEBUG] ${message}`, args);
|
|
3403
|
+
write(formatted) {
|
|
2742
3404
|
if (this.isFileLoggingActive()) {
|
|
2743
3405
|
this.writeToFile(formatted);
|
|
2744
3406
|
} else {
|
|
2745
3407
|
getOutputSink().writeErr(formatted);
|
|
2746
3408
|
}
|
|
2747
3409
|
}
|
|
3410
|
+
debug(message, ...args) {
|
|
3411
|
+
if (this.level > 0 /* DEBUG */)
|
|
3412
|
+
return;
|
|
3413
|
+
const formatted = this.format(`[DEBUG] ${message}`, args);
|
|
3414
|
+
this.write(formatted);
|
|
3415
|
+
}
|
|
2748
3416
|
info(message, ...args) {
|
|
2749
3417
|
if (this.level > 1 /* INFO */)
|
|
2750
3418
|
return;
|
|
2751
3419
|
const formatted = this.format(message, args);
|
|
2752
|
-
|
|
2753
|
-
this.writeToFile(formatted);
|
|
2754
|
-
} else {
|
|
2755
|
-
getOutputSink().writeErr(formatted);
|
|
2756
|
-
}
|
|
3420
|
+
this.write(formatted);
|
|
2757
3421
|
}
|
|
2758
3422
|
warn(message, ...args) {
|
|
2759
3423
|
if (this.level > 2 /* WARN */)
|
|
2760
3424
|
return;
|
|
2761
3425
|
const formatted = this.format(`[WARN] ${message}`, args);
|
|
2762
|
-
|
|
2763
|
-
this.writeToFile(formatted);
|
|
2764
|
-
} else {
|
|
2765
|
-
getOutputSink().writeErr(formatted);
|
|
2766
|
-
}
|
|
3426
|
+
this.write(formatted);
|
|
2767
3427
|
}
|
|
2768
3428
|
error(message, ...args) {
|
|
2769
3429
|
if (this.level > 3 /* ERROR */)
|
|
2770
3430
|
return;
|
|
2771
3431
|
const formatted = this.format(`[ERROR] ${message}`, args);
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
3432
|
+
this.write(formatted);
|
|
3433
|
+
}
|
|
3434
|
+
report(message) {
|
|
3435
|
+
const formatted = this.format(message, []);
|
|
3436
|
+
this.write(formatted);
|
|
2777
3437
|
}
|
|
2778
3438
|
getLevel() {
|
|
2779
3439
|
return this.level;
|
|
@@ -2788,17 +3448,17 @@ class SimpleLogger {
|
|
|
2788
3448
|
setGlobalLogFilePath("");
|
|
2789
3449
|
}
|
|
2790
3450
|
}
|
|
2791
|
-
setLogFile(
|
|
2792
|
-
this.logFilePath =
|
|
2793
|
-
setGlobalLogFilePath(
|
|
2794
|
-
if (!
|
|
3451
|
+
setLogFile(path2) {
|
|
3452
|
+
this.logFilePath = path2;
|
|
3453
|
+
setGlobalLogFilePath(path2);
|
|
3454
|
+
if (!path2)
|
|
2795
3455
|
return;
|
|
2796
3456
|
this.fileLoggingEnabled = true;
|
|
2797
|
-
const
|
|
3457
|
+
const fs2 = getFileSystem();
|
|
2798
3458
|
this.pendingInit = (async () => {
|
|
2799
|
-
const [error] = await
|
|
2800
|
-
await
|
|
2801
|
-
await
|
|
3459
|
+
const [error] = await catchError((async () => {
|
|
3460
|
+
await fs2.mkdir(fs2.path.dirname(path2));
|
|
3461
|
+
await fs2.writeFile(path2, "");
|
|
2802
3462
|
})());
|
|
2803
3463
|
if (error)
|
|
2804
3464
|
this.fileLoggingEnabled = false;
|
|
@@ -2852,12 +3512,12 @@ var jmespathSlot = singleton("JmespathCodec");
|
|
|
2852
3512
|
async function loadOutputCodecsAsync(needed) {
|
|
2853
3513
|
const loads = [];
|
|
2854
3514
|
if (needed.yaml && yamlSlot.get() === undefined) {
|
|
2855
|
-
loads.push(import("./js-yaml-
|
|
3515
|
+
loads.push(import("./js-yaml-71wj4em9.js").then((mod) => {
|
|
2856
3516
|
yamlSlot.set(mod);
|
|
2857
3517
|
}));
|
|
2858
3518
|
}
|
|
2859
3519
|
if (needed.filter && jmespathSlot.get() === undefined) {
|
|
2860
|
-
loads.push(import("./index-
|
|
3520
|
+
loads.push(import("./index-q6vc5bja.js").then((mod) => {
|
|
2861
3521
|
jmespathSlot.set(mod);
|
|
2862
3522
|
}));
|
|
2863
3523
|
}
|
|
@@ -3112,7 +3772,7 @@ function readRegistryValue(keyPath, valueName) {
|
|
|
3112
3772
|
if (process.platform !== "win32") {
|
|
3113
3773
|
return "";
|
|
3114
3774
|
}
|
|
3115
|
-
const [error, output] =
|
|
3775
|
+
const [error, output] = catchError(() => execFileSync("reg", ["query", keyPath, "/v", valueName], {
|
|
3116
3776
|
encoding: "utf-8",
|
|
3117
3777
|
stdio: ["pipe", "pipe", "pipe"]
|
|
3118
3778
|
}));
|
|
@@ -3135,27 +3795,41 @@ class LoggerTelemetryProvider {
|
|
|
3135
3795
|
...this.analyticsUniqueId ? { analyticsUniqueId: this.analyticsUniqueId } : {}
|
|
3136
3796
|
};
|
|
3137
3797
|
}
|
|
3138
|
-
async trackEvent(
|
|
3139
|
-
logger.debug(formatMessage("Event",
|
|
3798
|
+
async trackEvent({ name, properties }) {
|
|
3799
|
+
logger.debug(formatMessage("Event", name, this.enrich(properties)));
|
|
3140
3800
|
}
|
|
3141
|
-
async trackException(
|
|
3801
|
+
async trackException({
|
|
3802
|
+
error,
|
|
3803
|
+
properties
|
|
3804
|
+
}) {
|
|
3142
3805
|
logger.error(formatMessage("Exception", error.message, this.enrich({
|
|
3143
3806
|
...properties,
|
|
3144
3807
|
stack: error.stack
|
|
3145
3808
|
})));
|
|
3146
3809
|
}
|
|
3147
|
-
async trackRequest(
|
|
3810
|
+
async trackRequest({
|
|
3811
|
+
name,
|
|
3812
|
+
durationMs,
|
|
3813
|
+
success,
|
|
3814
|
+
properties
|
|
3815
|
+
}) {
|
|
3148
3816
|
logger.debug(formatMessage("Request", name, this.enrich({
|
|
3149
3817
|
...properties,
|
|
3150
|
-
duration: `${
|
|
3818
|
+
duration: `${durationMs}ms`,
|
|
3151
3819
|
success
|
|
3152
3820
|
})));
|
|
3153
3821
|
}
|
|
3154
|
-
async trackDependency(
|
|
3822
|
+
async trackDependency({
|
|
3823
|
+
name,
|
|
3824
|
+
type,
|
|
3825
|
+
durationMs,
|
|
3826
|
+
success,
|
|
3827
|
+
properties
|
|
3828
|
+
}) {
|
|
3155
3829
|
logger.debug(formatMessage("Dependency", name, this.enrich({
|
|
3156
3830
|
...properties,
|
|
3157
3831
|
type,
|
|
3158
|
-
duration: `${
|
|
3832
|
+
duration: `${durationMs}ms`,
|
|
3159
3833
|
success
|
|
3160
3834
|
})));
|
|
3161
3835
|
}
|
|
@@ -3375,180 +4049,52 @@ function getInheritedSession(env) {
|
|
|
3375
4049
|
}
|
|
3376
4050
|
function generateRandomSession() {
|
|
3377
4051
|
const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
|
|
3378
|
-
crypto.getRandomValues(bytes);
|
|
3379
|
-
let hex = "";
|
|
3380
|
-
for (const byte of bytes) {
|
|
3381
|
-
hex += byte.toString(16).padStart(2, "0");
|
|
3382
|
-
}
|
|
3383
|
-
return { id: hex, source: "random" };
|
|
3384
|
-
}
|
|
3385
|
-
function resolveTelemetrySession() {
|
|
3386
|
-
const existing = telemetrySessionSlot.get();
|
|
3387
|
-
if (existing) {
|
|
3388
|
-
return existing;
|
|
3389
|
-
}
|
|
3390
|
-
const declaredHandle = getConfiguredTelemetrySessionId();
|
|
3391
|
-
const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
|
|
3392
|
-
telemetrySessionSlot.set(resolved);
|
|
3393
|
-
return resolved;
|
|
3394
|
-
}
|
|
3395
|
-
function getTelemetrySessionSource() {
|
|
3396
|
-
return resolveTelemetrySession().source;
|
|
3397
|
-
}
|
|
3398
|
-
function getTelemetryOperationId() {
|
|
3399
|
-
const existing = telemetryOperationIdSlot.get();
|
|
3400
|
-
if (existing) {
|
|
3401
|
-
return existing;
|
|
3402
|
-
}
|
|
3403
|
-
const inboundTraceId = getInboundTraceContext()?.traceId;
|
|
3404
|
-
const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
|
|
3405
|
-
telemetryOperationIdSlot.set(generated);
|
|
3406
|
-
return generated;
|
|
3407
|
-
}
|
|
3408
|
-
// ../../common/src/telemetry/global-telemetry-properties.ts
|
|
3409
|
-
var telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
3410
|
-
function getGlobalTelemetryProperties() {
|
|
3411
|
-
return telemetryPropsSlot.get();
|
|
3412
|
-
}
|
|
3413
|
-
|
|
3414
|
-
// ../../common/src/telemetry/pii-redactor.ts
|
|
3415
|
-
var REDACTED = "[REDACTED]";
|
|
3416
|
-
var MAX_VALUE_LENGTH = 200;
|
|
3417
|
-
var SENSITIVE_NAME_TOKENS = new Set([
|
|
3418
|
-
"token",
|
|
3419
|
-
"tokens",
|
|
3420
|
-
"secret",
|
|
3421
|
-
"secrets",
|
|
3422
|
-
"password",
|
|
3423
|
-
"passwords",
|
|
3424
|
-
"pwd",
|
|
3425
|
-
"credential",
|
|
3426
|
-
"credentials",
|
|
3427
|
-
"auth",
|
|
3428
|
-
"authentication",
|
|
3429
|
-
"authorization",
|
|
3430
|
-
"authority",
|
|
3431
|
-
"cert",
|
|
3432
|
-
"certificate",
|
|
3433
|
-
"certificates"
|
|
3434
|
-
]);
|
|
3435
|
-
var SENSITIVE_KEY_PREFIXES = new Set([
|
|
3436
|
-
"api",
|
|
3437
|
-
"access",
|
|
3438
|
-
"client",
|
|
3439
|
-
"private",
|
|
3440
|
-
"public",
|
|
3441
|
-
"signing",
|
|
3442
|
-
"encryption",
|
|
3443
|
-
"session",
|
|
3444
|
-
"master",
|
|
3445
|
-
"shared",
|
|
3446
|
-
"root",
|
|
3447
|
-
"ssh",
|
|
3448
|
-
"rsa",
|
|
3449
|
-
"aes",
|
|
3450
|
-
"hmac",
|
|
3451
|
-
"oauth"
|
|
3452
|
-
]);
|
|
3453
|
-
var UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
|
|
3454
|
-
var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
3455
|
-
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
3456
|
-
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
3457
|
-
var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
|
|
3458
|
-
var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
|
|
3459
|
-
var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
|
|
3460
|
-
function shortHash(input) {
|
|
3461
|
-
let hash = 2166136261;
|
|
3462
|
-
for (let i = 0;i < input.length; i++) {
|
|
3463
|
-
hash ^= input.charCodeAt(i);
|
|
3464
|
-
hash = Math.imul(hash, 16777619);
|
|
3465
|
-
}
|
|
3466
|
-
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
3467
|
-
}
|
|
3468
|
-
function redactUrl(raw) {
|
|
3469
|
-
try {
|
|
3470
|
-
const url = new URL(raw);
|
|
3471
|
-
return `${url.protocol}//${url.host}`;
|
|
3472
|
-
} catch {
|
|
3473
|
-
return `url#${shortHash(raw)}`;
|
|
3474
|
-
}
|
|
3475
|
-
}
|
|
3476
|
-
function redactValueDetectors(value) {
|
|
3477
|
-
let out = value;
|
|
3478
|
-
out = out.replace(JWT_PATTERN, () => REDACTED);
|
|
3479
|
-
out = out.replace(URL_PATTERN, (match) => {
|
|
3480
|
-
const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
|
|
3481
|
-
const core = trailing ? match.slice(0, -trailing.length) : match;
|
|
3482
|
-
return `${redactUrl(core)}${trailing}`;
|
|
3483
|
-
});
|
|
3484
|
-
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
3485
|
-
out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
|
|
3486
|
-
out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
|
|
3487
|
-
out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
|
|
3488
|
-
if (out.length > MAX_VALUE_LENGTH) {
|
|
3489
|
-
out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
|
|
3490
|
-
}
|
|
3491
|
-
return out;
|
|
3492
|
-
}
|
|
3493
|
-
function redactValue(value) {
|
|
3494
|
-
return redactValueDetectors(value);
|
|
3495
|
-
}
|
|
3496
|
-
function redactError(error) {
|
|
3497
|
-
const safe = new Error(redactValueDetectors(error.message ?? ""));
|
|
3498
|
-
safe.name = error.name;
|
|
3499
|
-
safe.stack = typeof error.stack === "string" ? redactValueDetectors(error.stack) : undefined;
|
|
3500
|
-
return safe;
|
|
3501
|
-
}
|
|
3502
|
-
function nameTokens(name) {
|
|
3503
|
-
return name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[\s._-]+/).map((t) => t.toLowerCase()).filter(Boolean);
|
|
3504
|
-
}
|
|
3505
|
-
function isSensitiveName(name) {
|
|
3506
|
-
const tokens = nameTokens(name);
|
|
3507
|
-
for (let i = 0;i < tokens.length; i++) {
|
|
3508
|
-
const token = tokens[i];
|
|
3509
|
-
if (SENSITIVE_NAME_TOKENS.has(token)) {
|
|
3510
|
-
return true;
|
|
3511
|
-
}
|
|
3512
|
-
if (token === "key" || token === "keys") {
|
|
3513
|
-
const prev = tokens[i - 1];
|
|
3514
|
-
if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
|
|
3515
|
-
return true;
|
|
3516
|
-
}
|
|
3517
|
-
}
|
|
3518
|
-
}
|
|
3519
|
-
return false;
|
|
3520
|
-
}
|
|
3521
|
-
function redactProperty(name, value) {
|
|
3522
|
-
if (value === undefined || value === null) {
|
|
3523
|
-
return;
|
|
3524
|
-
}
|
|
3525
|
-
if (isSensitiveName(name)) {
|
|
3526
|
-
return REDACTED;
|
|
3527
|
-
}
|
|
3528
|
-
if (typeof value === "boolean" || typeof value === "number") {
|
|
3529
|
-
return value;
|
|
4052
|
+
crypto.getRandomValues(bytes);
|
|
4053
|
+
let hex = "";
|
|
4054
|
+
for (const byte of bytes) {
|
|
4055
|
+
hex += byte.toString(16).padStart(2, "0");
|
|
3530
4056
|
}
|
|
3531
|
-
|
|
3532
|
-
|
|
4057
|
+
return { id: hex, source: "random" };
|
|
4058
|
+
}
|
|
4059
|
+
function resolveTelemetrySession() {
|
|
4060
|
+
const existing = telemetrySessionSlot.get();
|
|
4061
|
+
if (existing) {
|
|
4062
|
+
return existing;
|
|
3533
4063
|
}
|
|
3534
|
-
|
|
4064
|
+
const declaredHandle = getConfiguredTelemetrySessionId();
|
|
4065
|
+
const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
|
|
4066
|
+
telemetrySessionSlot.set(resolved);
|
|
4067
|
+
return resolved;
|
|
3535
4068
|
}
|
|
3536
|
-
function
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
4069
|
+
function getTelemetrySessionSource() {
|
|
4070
|
+
return resolveTelemetrySession().source;
|
|
4071
|
+
}
|
|
4072
|
+
function getTelemetryOperationId() {
|
|
4073
|
+
const existing = telemetryOperationIdSlot.get();
|
|
4074
|
+
if (existing) {
|
|
4075
|
+
return existing;
|
|
3543
4076
|
}
|
|
3544
|
-
|
|
4077
|
+
const inboundTraceId = getInboundTraceContext()?.traceId;
|
|
4078
|
+
const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
|
|
4079
|
+
telemetryOperationIdSlot.set(generated);
|
|
4080
|
+
return generated;
|
|
4081
|
+
}
|
|
4082
|
+
// ../../common/src/telemetry/global-telemetry-properties.ts
|
|
4083
|
+
var telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
4084
|
+
function getGlobalTelemetryProperties() {
|
|
4085
|
+
return telemetryPropsSlot.get();
|
|
3545
4086
|
}
|
|
3546
4087
|
|
|
3547
|
-
// ../../common/src/telemetry/
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
4088
|
+
// ../../common/src/telemetry/span-clock.ts
|
|
4089
|
+
function startSpanClock() {
|
|
4090
|
+
const started = performance.now();
|
|
4091
|
+
return {
|
|
4092
|
+
startedAt: new Date(performance.timeOrigin + started),
|
|
4093
|
+
elapsedMs: () => performance.now() - started
|
|
4094
|
+
};
|
|
4095
|
+
}
|
|
3551
4096
|
|
|
4097
|
+
// ../../common/src/telemetry/telemetry-service.ts
|
|
3552
4098
|
class TelemetryService {
|
|
3553
4099
|
telemetryProvider;
|
|
3554
4100
|
contextStorage;
|
|
@@ -3568,36 +4114,39 @@ class TelemetryService {
|
|
|
3568
4114
|
this.defaultProperties = properties === undefined ? undefined : { ...this.defaultProperties, ...properties };
|
|
3569
4115
|
}
|
|
3570
4116
|
trackEvent(name, properties) {
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
4117
|
+
this.telemetryProvider.trackEvent({
|
|
4118
|
+
name: redactSpanName(name),
|
|
4119
|
+
properties: this.enrichProperties(properties),
|
|
4120
|
+
...this.leafCorrelation()
|
|
4121
|
+
});
|
|
3574
4122
|
}
|
|
3575
|
-
trackException(error, properties) {
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
4123
|
+
trackException(error, properties, context) {
|
|
4124
|
+
this.telemetryProvider.trackException({
|
|
4125
|
+
error: redactError(error),
|
|
4126
|
+
properties: this.enrichProperties(properties),
|
|
4127
|
+
...this.leafCorrelation(context)
|
|
4128
|
+
});
|
|
3579
4129
|
}
|
|
3580
4130
|
async trackRequest(name, fn, properties) {
|
|
3581
|
-
const parentContext = this.
|
|
4131
|
+
const parentContext = this.getActiveContext();
|
|
3582
4132
|
const operationId = parentContext?.operationId ?? this.operationId ?? getTelemetryOperationId();
|
|
3583
4133
|
const parentId = parentContext ? parentContext.id : this.inboundParentIdFor(operationId);
|
|
4134
|
+
const clock = startSpanClock();
|
|
3584
4135
|
const context = {
|
|
3585
4136
|
operationId,
|
|
3586
4137
|
...parentId !== undefined ? { parentId } : {},
|
|
3587
|
-
id: this.generateId()
|
|
4138
|
+
id: this.generateId(),
|
|
4139
|
+
startedAt: clock.startedAt
|
|
3588
4140
|
};
|
|
3589
|
-
const startTime = performance.now();
|
|
3590
4141
|
try {
|
|
3591
4142
|
const result = await this.contextStorage.run(context, fn);
|
|
3592
|
-
const durationMs =
|
|
3593
|
-
|
|
3594
|
-
await this.telemetryProvider.trackRequest(name, durationMs, true, enrichedProperties);
|
|
4143
|
+
const durationMs = clock.elapsedMs();
|
|
4144
|
+
await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, true, properties, context));
|
|
3595
4145
|
return result;
|
|
3596
4146
|
} catch (error) {
|
|
3597
|
-
const durationMs =
|
|
4147
|
+
const durationMs = clock.elapsedMs();
|
|
3598
4148
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
3599
|
-
|
|
3600
|
-
await this.telemetryProvider.trackRequest(name, durationMs, false, enrichedProperties);
|
|
4149
|
+
await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, { ...properties, errorMessage: err.message }, context));
|
|
3601
4150
|
throw error;
|
|
3602
4151
|
}
|
|
3603
4152
|
}
|
|
@@ -3606,8 +4155,7 @@ class TelemetryService {
|
|
|
3606
4155
|
operationId: this.operationId ?? getTelemetryOperationId(),
|
|
3607
4156
|
id: this.generateId()
|
|
3608
4157
|
};
|
|
3609
|
-
|
|
3610
|
-
this.telemetryProvider.trackRequest(name, durationMs, success, enrichedProperties);
|
|
4158
|
+
this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, success, properties, requestContext));
|
|
3611
4159
|
}
|
|
3612
4160
|
createRequestContext() {
|
|
3613
4161
|
const operationId = this.operationId ?? getTelemetryOperationId();
|
|
@@ -3615,7 +4163,8 @@ class TelemetryService {
|
|
|
3615
4163
|
return {
|
|
3616
4164
|
operationId,
|
|
3617
4165
|
...parentId !== undefined ? { parentId } : {},
|
|
3618
|
-
id: this.generateId()
|
|
4166
|
+
id: this.generateId(),
|
|
4167
|
+
startedAt: startSpanClock().startedAt
|
|
3619
4168
|
};
|
|
3620
4169
|
}
|
|
3621
4170
|
inboundParentIdFor(operationId) {
|
|
@@ -3626,58 +4175,84 @@ class TelemetryService {
|
|
|
3626
4175
|
return this.contextStorage.run(context, fn);
|
|
3627
4176
|
}
|
|
3628
4177
|
createDependencyContext() {
|
|
3629
|
-
const parentContext = this.
|
|
4178
|
+
const parentContext = this.getActiveContext();
|
|
3630
4179
|
if (!parentContext) {
|
|
3631
4180
|
return;
|
|
3632
4181
|
}
|
|
3633
4182
|
return {
|
|
3634
4183
|
operationId: parentContext.operationId,
|
|
3635
4184
|
parentId: parentContext.id,
|
|
3636
|
-
id: this.generateId()
|
|
4185
|
+
id: this.generateId(),
|
|
4186
|
+
startedAt: startSpanClock().startedAt
|
|
3637
4187
|
};
|
|
3638
4188
|
}
|
|
3639
4189
|
trackDependencyResult(name, type, durationMs, success, properties, context, resultCode) {
|
|
3640
|
-
|
|
3641
|
-
|
|
4190
|
+
this.telemetryProvider.trackDependency({
|
|
4191
|
+
...this.spanFor(redactHttpDependencyName(name), durationMs, success, properties, context),
|
|
4192
|
+
type,
|
|
4193
|
+
...resultCode !== undefined ? { resultCode } : {}
|
|
4194
|
+
});
|
|
3642
4195
|
}
|
|
3643
4196
|
async trackDependencyOperation(name, type, fn, properties) {
|
|
3644
|
-
const
|
|
4197
|
+
const clock = startSpanClock();
|
|
4198
|
+
const parentContext = this.getActiveContext();
|
|
3645
4199
|
const childContext = parentContext !== undefined ? {
|
|
3646
4200
|
operationId: parentContext.operationId,
|
|
3647
4201
|
parentId: parentContext.id,
|
|
3648
|
-
id: this.generateId()
|
|
3649
|
-
|
|
3650
|
-
|
|
4202
|
+
id: this.generateId(),
|
|
4203
|
+
startedAt: clock.startedAt
|
|
4204
|
+
} : {
|
|
4205
|
+
...this.createRequestContext(),
|
|
4206
|
+
startedAt: clock.startedAt
|
|
4207
|
+
};
|
|
3651
4208
|
try {
|
|
3652
4209
|
const result = await this.contextStorage.run(childContext, fn);
|
|
3653
|
-
const durationMs =
|
|
3654
|
-
|
|
3655
|
-
|
|
4210
|
+
const durationMs = clock.elapsedMs();
|
|
4211
|
+
await this.telemetryProvider.trackDependency({
|
|
4212
|
+
...this.spanFor(name, durationMs, true, properties, childContext),
|
|
4213
|
+
type
|
|
4214
|
+
});
|
|
3656
4215
|
return result;
|
|
3657
4216
|
} catch (error) {
|
|
3658
|
-
const durationMs =
|
|
4217
|
+
const durationMs = clock.elapsedMs();
|
|
3659
4218
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
3660
|
-
|
|
3661
|
-
|
|
4219
|
+
await this.telemetryProvider.trackDependency({
|
|
4220
|
+
...this.spanFor(name, durationMs, false, { ...properties, errorMessage: err.message }, childContext),
|
|
4221
|
+
type
|
|
4222
|
+
});
|
|
3662
4223
|
throw error;
|
|
3663
4224
|
}
|
|
3664
4225
|
}
|
|
3665
|
-
|
|
4226
|
+
getActiveContext() {
|
|
3666
4227
|
return this.contextStorage.getContext();
|
|
3667
4228
|
}
|
|
3668
|
-
|
|
4229
|
+
leafCorrelation(explicit) {
|
|
4230
|
+
const context = explicit ?? this.getActiveContext();
|
|
4231
|
+
return {
|
|
4232
|
+
operationId: context?.operationId ?? this.operationId ?? getTelemetryOperationId(),
|
|
4233
|
+
...context !== undefined ? { parentId: context.id } : {}
|
|
4234
|
+
};
|
|
4235
|
+
}
|
|
4236
|
+
spanFor(name, durationMs, success, properties, context) {
|
|
4237
|
+
return {
|
|
4238
|
+
name: redactSpanName(name),
|
|
4239
|
+
durationMs,
|
|
4240
|
+
success,
|
|
4241
|
+
properties: this.enrichProperties(properties),
|
|
4242
|
+
operationId: context.operationId,
|
|
4243
|
+
...context.parentId !== undefined ? { parentId: context.parentId } : {},
|
|
4244
|
+
id: context.id,
|
|
4245
|
+
...context.startedAt !== undefined ? { startedAt: context.startedAt } : {}
|
|
4246
|
+
};
|
|
4247
|
+
}
|
|
4248
|
+
enrichProperties(properties) {
|
|
3669
4249
|
const globalProperties = getGlobalTelemetryProperties();
|
|
3670
4250
|
const enriched = {
|
|
3671
4251
|
...getExecutionContextTelemetryProperties(),
|
|
3672
4252
|
...globalProperties,
|
|
3673
4253
|
...this.defaultProperties,
|
|
3674
4254
|
...redactProperties(properties ?? {}),
|
|
3675
|
-
[TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource()
|
|
3676
|
-
...context ? {
|
|
3677
|
-
[TELEMETRY_OPERATION_ID_PROPERTY]: context.operationId,
|
|
3678
|
-
...context.parentId !== undefined ? { [TELEMETRY_PARENT_ID_PROPERTY]: context.parentId } : {},
|
|
3679
|
-
[TELEMETRY_SPAN_ID_PROPERTY]: context.id
|
|
3680
|
-
} : {}
|
|
4255
|
+
[TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource()
|
|
3681
4256
|
};
|
|
3682
4257
|
return enriched;
|
|
3683
4258
|
}
|
|
@@ -3694,6 +4269,81 @@ class TelemetryService {
|
|
|
3694
4269
|
return hex;
|
|
3695
4270
|
}
|
|
3696
4271
|
}
|
|
4272
|
+
// ../../common/src/timings.ts
|
|
4273
|
+
var TIMINGS_ENV_VAR = "UIP_TIMINGS";
|
|
4274
|
+
function createStorage2() {
|
|
4275
|
+
const [error, mod] = catchError(() => __require("node:async_hooks"));
|
|
4276
|
+
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
4277
|
+
return {
|
|
4278
|
+
getStore: () => {
|
|
4279
|
+
return;
|
|
4280
|
+
},
|
|
4281
|
+
run: (_store, fn) => fn()
|
|
4282
|
+
};
|
|
4283
|
+
}
|
|
4284
|
+
return new mod.AsyncLocalStorage;
|
|
4285
|
+
}
|
|
4286
|
+
var storageSlot = singleton("TimingStorage");
|
|
4287
|
+
var stateSlot = singleton("Timings");
|
|
4288
|
+
var rootStartedSlot = singleton("TimingsRootStarted");
|
|
4289
|
+
var longLivedHostSlot = singleton("TimingsLongLivedHost");
|
|
4290
|
+
var storage = storageSlot.getOrInit(createStorage2, (value) => ("getStore" in value));
|
|
4291
|
+
function newState(baseline) {
|
|
4292
|
+
return { baseline, httpMs: 0, httpCalls: 0 };
|
|
4293
|
+
}
|
|
4294
|
+
function getState() {
|
|
4295
|
+
const scoped = storage.getStore();
|
|
4296
|
+
if (scoped) {
|
|
4297
|
+
return scoped;
|
|
4298
|
+
}
|
|
4299
|
+
const pinned = livePinnedState();
|
|
4300
|
+
if (pinned !== undefined) {
|
|
4301
|
+
return pinned;
|
|
4302
|
+
}
|
|
4303
|
+
return newState(processStartIsInvocationStart() ? 0 : performance.now());
|
|
4304
|
+
}
|
|
4305
|
+
function livePinnedState() {
|
|
4306
|
+
const pinned = stateSlot.get();
|
|
4307
|
+
return pinned !== undefined && "httpCalls" in pinned && !pinned.finished ? pinned : undefined;
|
|
4308
|
+
}
|
|
4309
|
+
function processStartIsInvocationStart() {
|
|
4310
|
+
return !rootStartedSlot.get(false) && !longLivedHostSlot.get(false);
|
|
4311
|
+
}
|
|
4312
|
+
function timingsEnabled() {
|
|
4313
|
+
if (typeof process === "undefined") {
|
|
4314
|
+
return false;
|
|
4315
|
+
}
|
|
4316
|
+
const value = process.env?.[TIMINGS_ENV_VAR];
|
|
4317
|
+
if (value === undefined) {
|
|
4318
|
+
return false;
|
|
4319
|
+
}
|
|
4320
|
+
const normalized = value.trim().toLowerCase();
|
|
4321
|
+
return normalized === "1" || normalized === "true";
|
|
4322
|
+
}
|
|
4323
|
+
function recordExitCode(exitCode) {
|
|
4324
|
+
if (!timingsEnabled()) {
|
|
4325
|
+
return;
|
|
4326
|
+
}
|
|
4327
|
+
getState().exitCode = exitCode;
|
|
4328
|
+
}
|
|
4329
|
+
function invocationStartedAt() {
|
|
4330
|
+
return new Date(performance.timeOrigin + getState().baseline);
|
|
4331
|
+
}
|
|
4332
|
+
function invocationElapsedMs() {
|
|
4333
|
+
return performance.now() - getState().baseline;
|
|
4334
|
+
}
|
|
4335
|
+
function markCommandStart() {
|
|
4336
|
+
if (!timingsEnabled()) {
|
|
4337
|
+
return;
|
|
4338
|
+
}
|
|
4339
|
+
getState().commandStart = performance.now();
|
|
4340
|
+
}
|
|
4341
|
+
function recordCommandDuration(durationMs) {
|
|
4342
|
+
if (!timingsEnabled()) {
|
|
4343
|
+
return;
|
|
4344
|
+
}
|
|
4345
|
+
getState().commandMs = durationMs;
|
|
4346
|
+
}
|
|
3697
4347
|
// ../../common/src/telemetry/proxy-http-agent.ts
|
|
3698
4348
|
var slot = singleton("ProxyAuthHttpsAgent");
|
|
3699
4349
|
|
|
@@ -3714,6 +4364,9 @@ function getGlobalTelemetryInstance() {
|
|
|
3714
4364
|
}
|
|
3715
4365
|
return;
|
|
3716
4366
|
}
|
|
4367
|
+
function setGlobalTelemetryInstance(instance) {
|
|
4368
|
+
telemetryInstanceSlot.set(instance);
|
|
4369
|
+
}
|
|
3717
4370
|
var _localTelemetryInstance;
|
|
3718
4371
|
function getTelemetryInstance() {
|
|
3719
4372
|
const global = getGlobalTelemetryInstance();
|
|
@@ -3721,6 +4374,7 @@ function getTelemetryInstance() {
|
|
|
3721
4374
|
return global;
|
|
3722
4375
|
if (!_localTelemetryInstance) {
|
|
3723
4376
|
_localTelemetryInstance = new TelemetryService(new LoggerTelemetryProvider, new NodeContextStorage);
|
|
4377
|
+
setGlobalTelemetryInstance(_localTelemetryInstance);
|
|
3724
4378
|
}
|
|
3725
4379
|
return _localTelemetryInstance;
|
|
3726
4380
|
}
|
|
@@ -3733,6 +4387,14 @@ var telemetry = new Proxy({}, {
|
|
|
3733
4387
|
});
|
|
3734
4388
|
|
|
3735
4389
|
// ../../common/src/formatter.ts
|
|
4390
|
+
var ANSI_STYLES = {
|
|
4391
|
+
red: "\x1B[31m",
|
|
4392
|
+
dim: "\x1B[2m"
|
|
4393
|
+
};
|
|
4394
|
+
var ANSI_RESET = "\x1B[0m";
|
|
4395
|
+
function styleLine(line, style) {
|
|
4396
|
+
return style ? `${ANSI_STYLES[style]}${line}${ANSI_RESET}` : line;
|
|
4397
|
+
}
|
|
3736
4398
|
var CLI_ERROR_CODES = [
|
|
3737
4399
|
"invalid_argument",
|
|
3738
4400
|
"authentication_required",
|
|
@@ -3771,22 +4433,6 @@ var EXIT_CODES = {
|
|
|
3771
4433
|
ValidationError: 3,
|
|
3772
4434
|
TimeoutError: 4
|
|
3773
4435
|
};
|
|
3774
|
-
class SuccessOutput {
|
|
3775
|
-
Result = RESULTS.Success;
|
|
3776
|
-
Code;
|
|
3777
|
-
Data;
|
|
3778
|
-
Pagination;
|
|
3779
|
-
Instructions;
|
|
3780
|
-
Log;
|
|
3781
|
-
constructor(code, data) {
|
|
3782
|
-
this.Code = code;
|
|
3783
|
-
this.Data = data;
|
|
3784
|
-
const logPath = getLogFilePath();
|
|
3785
|
-
if (logPath) {
|
|
3786
|
-
this.Log = logPath;
|
|
3787
|
-
}
|
|
3788
|
-
}
|
|
3789
|
-
}
|
|
3790
4436
|
function escapeNonAscii(jsonText) {
|
|
3791
4437
|
return jsonText.replace(/[\u0080-\uffff]/g, (c) => {
|
|
3792
4438
|
const hex = c.charCodeAt(0).toString(16).padStart(4, "0");
|
|
@@ -3851,19 +4497,45 @@ function toPascalCaseKey(key) {
|
|
|
3851
4497
|
const lowerCamelKey = toLowerCamelCaseKey(key);
|
|
3852
4498
|
return lowerCamelKey ? lowerCamelKey.charAt(0).toUpperCase() + lowerCamelKey.slice(1) : lowerCamelKey;
|
|
3853
4499
|
}
|
|
3854
|
-
function
|
|
4500
|
+
function collectVerbatimRefs(value, into) {
|
|
4501
|
+
if (typeof value !== "object" || value === null)
|
|
4502
|
+
return;
|
|
4503
|
+
if (into.has(value))
|
|
4504
|
+
return;
|
|
4505
|
+
into.add(value);
|
|
4506
|
+
for (const nested of Array.isArray(value) ? value : Object.values(value)) {
|
|
4507
|
+
collectVerbatimRefs(nested, into);
|
|
4508
|
+
}
|
|
4509
|
+
}
|
|
4510
|
+
function toPascalCaseData(value, verbatimKeys, subtrees) {
|
|
4511
|
+
if (subtrees?.mode === "skip" && typeof value === "object" && value !== null && subtrees.refs.has(value)) {
|
|
4512
|
+
return value;
|
|
4513
|
+
}
|
|
3855
4514
|
if (Array.isArray(value))
|
|
3856
|
-
return value.map(toPascalCaseData);
|
|
4515
|
+
return value.map((entry) => toPascalCaseData(entry, verbatimKeys, subtrees));
|
|
3857
4516
|
if (!isPlainRecord(value))
|
|
3858
4517
|
return value;
|
|
3859
4518
|
const result = {};
|
|
3860
4519
|
for (const [key, nestedValue] of Object.entries(value)) {
|
|
3861
|
-
|
|
4520
|
+
const pascalKey = toPascalCaseKey(key);
|
|
4521
|
+
if (verbatimKeys?.has(pascalKey)) {
|
|
4522
|
+
result[pascalKey] = nestedValue;
|
|
4523
|
+
if (subtrees?.mode === "collect") {
|
|
4524
|
+
collectVerbatimRefs(nestedValue, subtrees.refs);
|
|
4525
|
+
}
|
|
4526
|
+
continue;
|
|
4527
|
+
}
|
|
4528
|
+
result[pascalKey] = toPascalCaseData(nestedValue, verbatimKeys, subtrees);
|
|
3862
4529
|
}
|
|
3863
4530
|
return result;
|
|
3864
4531
|
}
|
|
3865
|
-
function normalizeDataKeys(data) {
|
|
3866
|
-
return toPascalCaseData(data);
|
|
4532
|
+
function normalizeDataKeys(data, verbatimKeys, subtrees) {
|
|
4533
|
+
return toPascalCaseData(data, verbatimKeys, subtrees);
|
|
4534
|
+
}
|
|
4535
|
+
function toVerbatimKeySet(preserve) {
|
|
4536
|
+
if (!Array.isArray(preserve))
|
|
4537
|
+
return;
|
|
4538
|
+
return new Set(preserve.map(toPascalCaseKey));
|
|
3867
4539
|
}
|
|
3868
4540
|
function normalizeOutputKeys(data) {
|
|
3869
4541
|
const result = {};
|
|
@@ -3873,7 +4545,7 @@ function normalizeOutputKeys(data) {
|
|
|
3873
4545
|
}
|
|
3874
4546
|
return result;
|
|
3875
4547
|
}
|
|
3876
|
-
function printOutput(data, format = "json", logFn, asciiSafe = false) {
|
|
4548
|
+
function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowStyle) {
|
|
3877
4549
|
if (!data) {
|
|
3878
4550
|
logFn("Empty response object. No data to display.");
|
|
3879
4551
|
return;
|
|
@@ -3908,7 +4580,7 @@ function printOutput(data, format = "json", logFn, asciiSafe = false) {
|
|
|
3908
4580
|
if (hasData && !(rows !== null && rows.length === 0)) {
|
|
3909
4581
|
const logValue = data.Log;
|
|
3910
4582
|
if (rows !== null) {
|
|
3911
|
-
printResizableTable(rows, logFn, logValue);
|
|
4583
|
+
printResizableTable(rows, logFn, logValue, undefined, tableRowStyle);
|
|
3912
4584
|
} else {
|
|
3913
4585
|
printVerticalTable(data.Data, logFn, logValue);
|
|
3914
4586
|
}
|
|
@@ -3919,10 +4591,11 @@ function printOutput(data, format = "json", logFn, asciiSafe = false) {
|
|
|
3919
4591
|
}
|
|
3920
4592
|
}
|
|
3921
4593
|
}
|
|
3922
|
-
function logOutput(data, format = "json") {
|
|
4594
|
+
function logOutput(data, format = "json", tableRowStyle) {
|
|
3923
4595
|
const sink = getOutputSink();
|
|
4596
|
+
const styleFn = sink.capabilities.isInteractive && sink.capabilities.supportsColor ? tableRowStyle : undefined;
|
|
3924
4597
|
printOutput(data, format, (msg) => sink.writeOut(`${msg}
|
|
3925
|
-
`), needsAsciiSafeJson(sink));
|
|
4598
|
+
`), needsAsciiSafeJson(sink), styleFn);
|
|
3926
4599
|
}
|
|
3927
4600
|
function cellToString(val) {
|
|
3928
4601
|
return val != null && typeof val === "object" ? JSON.stringify(val) : String(val ?? "");
|
|
@@ -3936,7 +4609,7 @@ function wrapText(text, width) {
|
|
|
3936
4609
|
}
|
|
3937
4610
|
return lines;
|
|
3938
4611
|
}
|
|
3939
|
-
function printTable(data, logFn, externalLogValue) {
|
|
4612
|
+
function printTable(data, logFn, externalLogValue, tableRowStyle) {
|
|
3940
4613
|
if (data.length === 0)
|
|
3941
4614
|
return;
|
|
3942
4615
|
const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
|
|
@@ -3946,7 +4619,7 @@ function printTable(data, logFn, externalLogValue) {
|
|
|
3946
4619
|
logFn(keys.map((_, i) => "-".repeat(maxWidths[i])).join("-|-"));
|
|
3947
4620
|
data.forEach((item) => {
|
|
3948
4621
|
const row = keys.map((key, i) => cellToString(item[key]).padEnd(maxWidths[i])).join(" | ");
|
|
3949
|
-
logFn(row);
|
|
4622
|
+
logFn(styleLine(row, tableRowStyle?.(item)));
|
|
3950
4623
|
});
|
|
3951
4624
|
if (externalLogValue) {
|
|
3952
4625
|
logFn("");
|
|
@@ -3989,14 +4662,14 @@ function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
|
3989
4662
|
logFn(`Log: ${externalLogValue}`);
|
|
3990
4663
|
}
|
|
3991
4664
|
}
|
|
3992
|
-
function printResizableTable(data, logFn = console.log, externalLogValue, availableWidth) {
|
|
4665
|
+
function printResizableTable(data, logFn = console.log, externalLogValue, availableWidth, tableRowStyle) {
|
|
3993
4666
|
if (data.length === 0)
|
|
3994
4667
|
return;
|
|
3995
4668
|
const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
|
|
3996
4669
|
if (keys.length === 0)
|
|
3997
4670
|
return;
|
|
3998
4671
|
if (!process.stdout.isTTY) {
|
|
3999
|
-
printTable(data, logFn, externalLogValue);
|
|
4672
|
+
printTable(data, logFn, externalLogValue, tableRowStyle);
|
|
4000
4673
|
return;
|
|
4001
4674
|
}
|
|
4002
4675
|
const naturalWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
|
|
@@ -4004,7 +4677,7 @@ function printResizableTable(data, logFn = console.log, externalLogValue, availa
|
|
|
4004
4677
|
const totalWidth = naturalWidths.reduce((a, b) => a + b, 0) + separatorTotal;
|
|
4005
4678
|
const termWidth = availableWidth ?? (process.stdout.columns || 120);
|
|
4006
4679
|
if (totalWidth <= termWidth) {
|
|
4007
|
-
printTable(data, logFn, externalLogValue);
|
|
4680
|
+
printTable(data, logFn, externalLogValue, tableRowStyle);
|
|
4008
4681
|
return;
|
|
4009
4682
|
}
|
|
4010
4683
|
const overflow = totalWidth - termWidth;
|
|
@@ -4050,6 +4723,7 @@ function printResizableTable(data, logFn = console.log, externalLogValue, availa
|
|
|
4050
4723
|
logFn(header);
|
|
4051
4724
|
logFn(keys.map((_, i) => "-".repeat(finalWidths[i])).join("-|-"));
|
|
4052
4725
|
data.forEach((item) => {
|
|
4726
|
+
const style = tableRowStyle?.(item);
|
|
4053
4727
|
const cellLines = keys.map((key, i) => wrapText(cellToString(item[key]), finalWidths[i]));
|
|
4054
4728
|
const lineCount = Math.max(...cellLines.map((l) => l.length));
|
|
4055
4729
|
for (let line = 0;line < lineCount; line++) {
|
|
@@ -4057,7 +4731,7 @@ function printResizableTable(data, logFn = console.log, externalLogValue, availa
|
|
|
4057
4731
|
const val = line < cellLines[i].length ? cellLines[i][line] : "";
|
|
4058
4732
|
return val.padEnd(finalWidths[i]);
|
|
4059
4733
|
}).join(" | ");
|
|
4060
|
-
logFn(row);
|
|
4734
|
+
logFn(styleLine(row, style));
|
|
4061
4735
|
}
|
|
4062
4736
|
});
|
|
4063
4737
|
if (externalLogValue) {
|
|
@@ -4201,30 +4875,36 @@ var OutputFormatter;
|
|
|
4201
4875
|
((OutputFormatter) => {
|
|
4202
4876
|
function success(data, options) {
|
|
4203
4877
|
data.Log ??= getLogFilePath() || undefined;
|
|
4204
|
-
const normalize =
|
|
4878
|
+
const normalize = options?.preserveDataKeys !== true;
|
|
4879
|
+
const verbatim = toVerbatimKeySet(options?.preserveDataKeys);
|
|
4880
|
+
const subtrees = verbatim && {
|
|
4881
|
+
refs: new Set,
|
|
4882
|
+
mode: "collect"
|
|
4883
|
+
};
|
|
4205
4884
|
if (normalize) {
|
|
4206
|
-
data.Data = normalizeDataKeys(data.Data);
|
|
4885
|
+
data.Data = normalizeDataKeys(data.Data, verbatim, subtrees);
|
|
4207
4886
|
}
|
|
4208
4887
|
const filter = getOutputFilter();
|
|
4209
4888
|
if (filter) {
|
|
4210
4889
|
const filtered = applyFilter(data.Data, filter);
|
|
4211
|
-
data.Data = normalize ? normalizeDataKeys(filtered) : filtered;
|
|
4890
|
+
data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
4212
4891
|
}
|
|
4213
|
-
logOutput(normalizeOutputKeys(data), getOutputFormat());
|
|
4892
|
+
logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
|
|
4214
4893
|
}
|
|
4215
4894
|
OutputFormatter.success = success;
|
|
4216
4895
|
function error(data) {
|
|
4217
4896
|
data.Log ??= getLogFilePath() || undefined;
|
|
4218
4897
|
data.ErrorCode ??= defaultErrorCodeForFailure(data);
|
|
4219
4898
|
data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
|
|
4220
|
-
|
|
4899
|
+
const exitCode = EXIT_CODES[data.Result] ?? 1;
|
|
4900
|
+
setExitCode(exitCode);
|
|
4221
4901
|
recordCommandFailureTelemetry({
|
|
4222
4902
|
result: data.Result,
|
|
4223
4903
|
errorCode: data.ErrorCode,
|
|
4224
4904
|
retry: data.Retry,
|
|
4225
4905
|
message: data.Message,
|
|
4226
4906
|
context: data.Context,
|
|
4227
|
-
exitCode
|
|
4907
|
+
exitCode,
|
|
4228
4908
|
errorClass: data.TelemetryErrorClass,
|
|
4229
4909
|
terminalOutcome: data.TelemetryTerminalOutcome,
|
|
4230
4910
|
terminalSignal: data.TelemetryTerminalSignal
|
|
@@ -4300,6 +4980,39 @@ var OutputFormatter;
|
|
|
4300
4980
|
}
|
|
4301
4981
|
OutputFormatter.formatToString = formatToString;
|
|
4302
4982
|
})(OutputFormatter ||= {});
|
|
4983
|
+
// ../../../node_modules/commander/esm.mjs
|
|
4984
|
+
var import__ = __toESM(require_commander(), 1);
|
|
4985
|
+
var {
|
|
4986
|
+
program,
|
|
4987
|
+
createCommand,
|
|
4988
|
+
createArgument,
|
|
4989
|
+
createOption,
|
|
4990
|
+
CommanderError,
|
|
4991
|
+
InvalidArgumentError,
|
|
4992
|
+
InvalidOptionArgumentError,
|
|
4993
|
+
Command,
|
|
4994
|
+
Argument,
|
|
4995
|
+
Option,
|
|
4996
|
+
Help
|
|
4997
|
+
} = import__.default;
|
|
4998
|
+
|
|
4999
|
+
// ../../common/src/command-examples.ts
|
|
5000
|
+
var examplesByCommand = new WeakMap;
|
|
5001
|
+
Command.prototype.examples = function(examples) {
|
|
5002
|
+
examplesByCommand.set(this, examples);
|
|
5003
|
+
return this;
|
|
5004
|
+
};
|
|
5005
|
+
// ../../common/src/preview.ts
|
|
5006
|
+
var previewSlot = singleton("PreviewBuild");
|
|
5007
|
+
function isPreviewBuild() {
|
|
5008
|
+
return previewSlot.get(false) ?? false;
|
|
5009
|
+
}
|
|
5010
|
+
Command.prototype.previewCommand = function(nameAndArgs, opts) {
|
|
5011
|
+
if (isPreviewBuild()) {
|
|
5012
|
+
return this.command(nameAndArgs, opts);
|
|
5013
|
+
}
|
|
5014
|
+
return new Command(nameAndArgs.split(/\s+/)[0] ?? nameAndArgs);
|
|
5015
|
+
};
|
|
4303
5016
|
|
|
4304
5017
|
// ../../common/src/telemetry/command-attribution.ts
|
|
4305
5018
|
var LEGACY_SKILL_NAMESPACE = "uipath:";
|
|
@@ -4454,6 +5167,57 @@ function buildCommandTelemetryAttribution(commandPath, skillSource) {
|
|
|
4454
5167
|
};
|
|
4455
5168
|
}
|
|
4456
5169
|
|
|
5170
|
+
// ../../common/src/telemetry/command-name.ts
|
|
5171
|
+
var TELEMETRY_COMMAND_ROOT = "uip";
|
|
5172
|
+
function commandTelemetryName(parts) {
|
|
5173
|
+
const tokens = [];
|
|
5174
|
+
for (const part of parts) {
|
|
5175
|
+
const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !== TELEMETRY_COMMAND_ROOT);
|
|
5176
|
+
if (pieces.every(isCommandToken)) {
|
|
5177
|
+
tokens.push(...pieces);
|
|
5178
|
+
continue;
|
|
5179
|
+
}
|
|
5180
|
+
tokens.push(UNKNOWN_TOKEN);
|
|
5181
|
+
}
|
|
5182
|
+
return [TELEMETRY_COMMAND_ROOT, ...tokens].join(".");
|
|
5183
|
+
}
|
|
5184
|
+
var COMMAND_TOKEN_PATTERN = /^[a-z0-9][a-z0-9-]*$/;
|
|
5185
|
+
var MAX_COMMAND_TOKEN_LENGTH = 32;
|
|
5186
|
+
var GUID_TOKEN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
5187
|
+
function isCommandToken(token) {
|
|
5188
|
+
return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token) && !/^\d+$/.test(token);
|
|
5189
|
+
}
|
|
5190
|
+
var UNKNOWN_TOKEN = "<unknown>";
|
|
5191
|
+
|
|
5192
|
+
// ../../common/src/telemetry/invocation-request.ts
|
|
5193
|
+
var requestContextSlot = singleton("TelemetryInvocationRequestContext");
|
|
5194
|
+
function activeContext() {
|
|
5195
|
+
return telemetry.getActiveContext?.();
|
|
5196
|
+
}
|
|
5197
|
+
function runWithInvocationRequest(fn) {
|
|
5198
|
+
const context = telemetry.createRequestContext();
|
|
5199
|
+
context.startedAt = invocationStartedAt();
|
|
5200
|
+
requestContextSlot.set(context);
|
|
5201
|
+
return telemetry.runWithContext(context, fn);
|
|
5202
|
+
}
|
|
5203
|
+
function ensureInvocationRequestScope(fn) {
|
|
5204
|
+
if (activeContext() !== undefined) {
|
|
5205
|
+
return fn();
|
|
5206
|
+
}
|
|
5207
|
+
const kept = requestContextSlot.get();
|
|
5208
|
+
return kept === undefined ? runWithInvocationRequest(fn) : telemetry.runWithContext(kept, fn);
|
|
5209
|
+
}
|
|
5210
|
+
function getInvocationRequestContext() {
|
|
5211
|
+
return activeContext() ?? requestContextSlot.get();
|
|
5212
|
+
}
|
|
5213
|
+
function emitInvocationRequest(name, success, properties) {
|
|
5214
|
+
const context = getInvocationRequestContext();
|
|
5215
|
+
telemetry.trackRequestResult(name, invocationElapsedMs(), success, properties, context);
|
|
5216
|
+
if (context !== undefined && requestContextSlot.get() === context) {
|
|
5217
|
+
requestContextSlot.clear();
|
|
5218
|
+
}
|
|
5219
|
+
}
|
|
5220
|
+
|
|
4457
5221
|
// ../../common/src/trackedAction.ts
|
|
4458
5222
|
var pollSignalSlot = singleton("PollSignal");
|
|
4459
5223
|
var cliErrorCodeValues = new Set(CLI_ERROR_CODES);
|
|
@@ -4461,28 +5225,74 @@ var retryHintValues = new Set(RETRY_HINTS);
|
|
|
4461
5225
|
var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
|
|
4462
5226
|
var processContext = {
|
|
4463
5227
|
exit: (code) => {
|
|
4464
|
-
|
|
5228
|
+
recordExitCode(code);
|
|
5229
|
+
setExitCode(code);
|
|
4465
5230
|
},
|
|
4466
5231
|
get pollSignal() {
|
|
4467
5232
|
return pollSignalSlot.get();
|
|
4468
5233
|
}
|
|
4469
5234
|
};
|
|
5235
|
+
var TELEMETRY_ARG_VALUE_WITHHELD = "<provided>";
|
|
5236
|
+
var TELEMETRY_ARG_VALUE_DEFAULTED = "<default>";
|
|
5237
|
+
function recordableArgValue(value, choices) {
|
|
5238
|
+
if (typeof value === "boolean" || typeof value === "number") {
|
|
5239
|
+
return value;
|
|
5240
|
+
}
|
|
5241
|
+
if (choices && choices.length > 0) {
|
|
5242
|
+
if (typeof value === "string" && choices.includes(value)) {
|
|
5243
|
+
return value;
|
|
5244
|
+
}
|
|
5245
|
+
if (Array.isArray(value) && value.length > 0 && value.every((entry) => typeof entry === "string" && choices.includes(entry))) {
|
|
5246
|
+
return value.join(",");
|
|
5247
|
+
}
|
|
5248
|
+
}
|
|
5249
|
+
return TELEMETRY_ARG_VALUE_WITHHELD;
|
|
5250
|
+
}
|
|
4470
5251
|
function extractCommandParams(cmd) {
|
|
4471
5252
|
const params = {};
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
5253
|
+
forEachSuppliedArgument(cmd, (name, value, choices, defaulted) => {
|
|
5254
|
+
const recordable = recordableArgValue(value, choices);
|
|
5255
|
+
params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = recordable === TELEMETRY_ARG_VALUE_WITHHELD && defaulted ? TELEMETRY_ARG_VALUE_DEFAULTED : recordable;
|
|
5256
|
+
});
|
|
5257
|
+
return params;
|
|
5258
|
+
}
|
|
5259
|
+
function isDefaultedOption(cmd, name) {
|
|
5260
|
+
const source = cmd.getOptionValueSource?.(name);
|
|
5261
|
+
return source === "default" || source === "implied";
|
|
5262
|
+
}
|
|
5263
|
+
function isDefaultedPositional(cmd, index) {
|
|
5264
|
+
return index >= (cmd.args?.length ?? 0);
|
|
5265
|
+
}
|
|
5266
|
+
function forEachSuppliedArgument(cmd, visit) {
|
|
4477
5267
|
const registered = cmd.registeredArguments ?? [];
|
|
4478
5268
|
const processed = cmd.processedArgs ?? [];
|
|
4479
5269
|
for (let i = 0;i < registered.length; i++) {
|
|
4480
|
-
|
|
5270
|
+
const name = registered[i].name();
|
|
5271
|
+
if (name && processed[i] !== undefined) {
|
|
5272
|
+
visit(name, processed[i], registered[i].argChoices, isDefaultedPositional(cmd, i));
|
|
5273
|
+
}
|
|
5274
|
+
}
|
|
5275
|
+
const choicesByAttribute = new Map;
|
|
5276
|
+
for (const option of cmd.options) {
|
|
5277
|
+
choicesByAttribute.set(option.attributeName(), option.argChoices);
|
|
4481
5278
|
}
|
|
4482
5279
|
for (const [key, value] of Object.entries(cmd.opts())) {
|
|
4483
|
-
|
|
5280
|
+
if (key && value !== undefined) {
|
|
5281
|
+
visit(key, value, choicesByAttribute.get(key), isDefaultedOption(cmd, key));
|
|
5282
|
+
}
|
|
4484
5283
|
}
|
|
4485
|
-
|
|
5284
|
+
}
|
|
5285
|
+
function withheldArgumentValues(cmd) {
|
|
5286
|
+
const values = [];
|
|
5287
|
+
forEachSuppliedArgument(cmd, (_name, value, choices, defaulted) => {
|
|
5288
|
+
if (defaulted) {
|
|
5289
|
+
return;
|
|
5290
|
+
}
|
|
5291
|
+
if (recordableArgValue(value, choices) === TELEMETRY_ARG_VALUE_WITHHELD) {
|
|
5292
|
+
values.push(value);
|
|
5293
|
+
}
|
|
5294
|
+
});
|
|
5295
|
+
return values;
|
|
4486
5296
|
}
|
|
4487
5297
|
function deriveCommandPath(cmd) {
|
|
4488
5298
|
const parts = [];
|
|
@@ -4497,7 +5307,7 @@ function deriveCommandPath(cmd) {
|
|
|
4497
5307
|
if (parts.length > 1) {
|
|
4498
5308
|
parts.shift();
|
|
4499
5309
|
}
|
|
4500
|
-
return
|
|
5310
|
+
return commandTelemetryName(parts);
|
|
4501
5311
|
}
|
|
4502
5312
|
function isCliErrorCode(value) {
|
|
4503
5313
|
return typeof value === "string" && cliErrorCodeValues.has(value);
|
|
@@ -4537,68 +5347,77 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
4537
5347
|
});
|
|
4538
5348
|
const telemetryName = deriveCommandPath(command);
|
|
4539
5349
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
4540
|
-
|
|
4541
|
-
const
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
5350
|
+
markCommandStart();
|
|
5351
|
+
const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
|
|
5352
|
+
try {
|
|
5353
|
+
const startTime = performance.now();
|
|
5354
|
+
let errorMessage;
|
|
5355
|
+
let fallbackExitCode = EXIT_CODES.Success;
|
|
5356
|
+
clearRecordedCommandFailureTelemetry();
|
|
5357
|
+
const [error] = await catchError(ensureInvocationRequestScope(() => {
|
|
5358
|
+
const violation = implicitLimitViolation(command);
|
|
5359
|
+
if (violation) {
|
|
5360
|
+
return Promise.reject(violation);
|
|
5361
|
+
}
|
|
5362
|
+
return fn(...args);
|
|
5363
|
+
}));
|
|
5364
|
+
if (error) {
|
|
5365
|
+
errorMessage = error instanceof Error ? error.message : String(error);
|
|
5366
|
+
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
5367
|
+
const typed = error;
|
|
5368
|
+
const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
|
|
5369
|
+
const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
|
|
5370
|
+
const finalResult = customResult ?? RESULTS.Failure;
|
|
5371
|
+
const typedErrorCode = typed.errorCode ?? typed.ErrorCode;
|
|
5372
|
+
const customErrorCode = isCliErrorCode(typedErrorCode) ? typedErrorCode : undefined;
|
|
5373
|
+
const typedRetry = typed.retry ?? typed.Retry;
|
|
5374
|
+
const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
|
|
5375
|
+
const typedContext = typed.context ?? typed.Context;
|
|
5376
|
+
const customContext = isErrorContext(typedContext) ? typedContext : undefined;
|
|
5377
|
+
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
5378
|
+
fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
|
|
5379
|
+
OutputFormatter.error({
|
|
5380
|
+
Result: finalResult,
|
|
5381
|
+
...customErrorCode ? { ErrorCode: customErrorCode } : {},
|
|
5382
|
+
Message: errorMessage,
|
|
5383
|
+
Instructions: customInstructions ?? commandHelpHint(telemetryName),
|
|
5384
|
+
...customRetry ? { Retry: customRetry } : {},
|
|
5385
|
+
...customContext ? { Context: customContext } : {}
|
|
5386
|
+
});
|
|
5387
|
+
context.exit(fallbackExitCode);
|
|
5388
|
+
}
|
|
5389
|
+
const durationMs = performance.now() - startTime;
|
|
5390
|
+
recordCommandDuration(durationMs);
|
|
5391
|
+
const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
|
|
5392
|
+
const recordedFailure = takeRecordedCommandFailureTelemetry();
|
|
5393
|
+
const success = !error && exitCode === 0;
|
|
5394
|
+
const terminalTelemetry = buildCommandTerminalTelemetryProperties({
|
|
5395
|
+
error,
|
|
5396
|
+
exitCode,
|
|
5397
|
+
recordedFailure,
|
|
5398
|
+
pollSignal: context.pollSignal
|
|
4574
5399
|
});
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
}
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
|
|
4597
|
-
command: "true",
|
|
4598
|
-
...terminalTelemetry,
|
|
4599
|
-
...errorMessage ? { errorMessage } : {}
|
|
4600
|
-
});
|
|
4601
|
-
telemetry.trackRequestResult(telemetryName, durationMs, success, baseProperties, requestContext);
|
|
5400
|
+
if (terminalTelemetry.error_class === "internal" && error) {
|
|
5401
|
+
telemetry.trackException(error instanceof Error ? error : new Error(String(error)), { command_name: telemetryName }, getInvocationRequestContext());
|
|
5402
|
+
}
|
|
5403
|
+
const commandParams = extractCommandParams(command);
|
|
5404
|
+
if (props) {
|
|
5405
|
+
for (const key of Object.keys(props)) {
|
|
5406
|
+
delete commandParams[`${TELEMETRY_COMMAND_ARG_PREFIX}${key}`];
|
|
5407
|
+
}
|
|
5408
|
+
}
|
|
5409
|
+
const baseProperties = redactProperties({
|
|
5410
|
+
...commandParams,
|
|
5411
|
+
...props,
|
|
5412
|
+
...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
|
|
5413
|
+
command: "true",
|
|
5414
|
+
...terminalTelemetry,
|
|
5415
|
+
...errorMessage ? { errorMessage } : {}
|
|
5416
|
+
});
|
|
5417
|
+
emitInvocationRequest(telemetryName, success, baseProperties);
|
|
5418
|
+
} finally {
|
|
5419
|
+
releaseSuppliedArgumentValues(supplied);
|
|
5420
|
+
}
|
|
4602
5421
|
});
|
|
4603
5422
|
};
|
|
4604
5423
|
// ../../common/src/completer.ts
|
|
@@ -4609,6 +5428,204 @@ var savedOriginalsSlot = singleton("ConsoleGuardOriginals");
|
|
|
4609
5428
|
// ../../common/src/constants.ts
|
|
4610
5429
|
var DEFAULT_PAGE_SIZE = 50;
|
|
4611
5430
|
var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
|
|
5431
|
+
// ../../common/src/entity-name-rules.ts
|
|
5432
|
+
var RESERVED_SQL_KEYWORDS_LOWER = new Set(["group", "order"]);
|
|
5433
|
+
var RESERVED_FIELD_NAMES_LOWER = new Set([
|
|
5434
|
+
"id",
|
|
5435
|
+
"createdby",
|
|
5436
|
+
"createtime",
|
|
5437
|
+
"updatedby",
|
|
5438
|
+
"updatetime",
|
|
5439
|
+
"recordowner",
|
|
5440
|
+
"version"
|
|
5441
|
+
]);
|
|
5442
|
+
var RESERVED_KEYWORDS_LOWER = new Set([
|
|
5443
|
+
"abstract",
|
|
5444
|
+
"as",
|
|
5445
|
+
"base",
|
|
5446
|
+
"bool",
|
|
5447
|
+
"break",
|
|
5448
|
+
"byte",
|
|
5449
|
+
"case",
|
|
5450
|
+
"catch",
|
|
5451
|
+
"char",
|
|
5452
|
+
"checked",
|
|
5453
|
+
"class",
|
|
5454
|
+
"const",
|
|
5455
|
+
"continue",
|
|
5456
|
+
"decimal",
|
|
5457
|
+
"default",
|
|
5458
|
+
"delegate",
|
|
5459
|
+
"do",
|
|
5460
|
+
"double",
|
|
5461
|
+
"else",
|
|
5462
|
+
"enum",
|
|
5463
|
+
"event",
|
|
5464
|
+
"explicit",
|
|
5465
|
+
"extern",
|
|
5466
|
+
"false",
|
|
5467
|
+
"finally",
|
|
5468
|
+
"fixed",
|
|
5469
|
+
"float",
|
|
5470
|
+
"for",
|
|
5471
|
+
"foreach",
|
|
5472
|
+
"goto",
|
|
5473
|
+
"if",
|
|
5474
|
+
"implicit",
|
|
5475
|
+
"in",
|
|
5476
|
+
"int",
|
|
5477
|
+
"interface",
|
|
5478
|
+
"internal",
|
|
5479
|
+
"is",
|
|
5480
|
+
"lock",
|
|
5481
|
+
"long",
|
|
5482
|
+
"namespace",
|
|
5483
|
+
"new",
|
|
5484
|
+
"null",
|
|
5485
|
+
"object",
|
|
5486
|
+
"operator",
|
|
5487
|
+
"out",
|
|
5488
|
+
"override",
|
|
5489
|
+
"params",
|
|
5490
|
+
"private",
|
|
5491
|
+
"protected",
|
|
5492
|
+
"public",
|
|
5493
|
+
"readonly",
|
|
5494
|
+
"ref",
|
|
5495
|
+
"return",
|
|
5496
|
+
"sbyte",
|
|
5497
|
+
"sealed",
|
|
5498
|
+
"short",
|
|
5499
|
+
"sizeof",
|
|
5500
|
+
"stackalloc",
|
|
5501
|
+
"static",
|
|
5502
|
+
"string",
|
|
5503
|
+
"struct",
|
|
5504
|
+
"switch",
|
|
5505
|
+
"this",
|
|
5506
|
+
"throw",
|
|
5507
|
+
"true",
|
|
5508
|
+
"try",
|
|
5509
|
+
"typeof",
|
|
5510
|
+
"uint",
|
|
5511
|
+
"ulong",
|
|
5512
|
+
"unchecked",
|
|
5513
|
+
"unsafe",
|
|
5514
|
+
"ushort",
|
|
5515
|
+
"using",
|
|
5516
|
+
"virtual",
|
|
5517
|
+
"void",
|
|
5518
|
+
"volatile",
|
|
5519
|
+
"while",
|
|
5520
|
+
"addhandler",
|
|
5521
|
+
"addressof",
|
|
5522
|
+
"alias",
|
|
5523
|
+
"and",
|
|
5524
|
+
"andalso",
|
|
5525
|
+
"boolean",
|
|
5526
|
+
"byref",
|
|
5527
|
+
"byval",
|
|
5528
|
+
"call",
|
|
5529
|
+
"cbool",
|
|
5530
|
+
"cbyte",
|
|
5531
|
+
"cchar",
|
|
5532
|
+
"cdate",
|
|
5533
|
+
"cdbl",
|
|
5534
|
+
"cdec",
|
|
5535
|
+
"cint",
|
|
5536
|
+
"clng",
|
|
5537
|
+
"cobj",
|
|
5538
|
+
"csbyte",
|
|
5539
|
+
"cshort",
|
|
5540
|
+
"csng",
|
|
5541
|
+
"cstr",
|
|
5542
|
+
"ctype",
|
|
5543
|
+
"cuint",
|
|
5544
|
+
"culng",
|
|
5545
|
+
"cushort",
|
|
5546
|
+
"date",
|
|
5547
|
+
"declare",
|
|
5548
|
+
"dim",
|
|
5549
|
+
"directcast",
|
|
5550
|
+
"each",
|
|
5551
|
+
"elseif",
|
|
5552
|
+
"end",
|
|
5553
|
+
"endif",
|
|
5554
|
+
"erase",
|
|
5555
|
+
"error",
|
|
5556
|
+
"exit",
|
|
5557
|
+
"friend",
|
|
5558
|
+
"function",
|
|
5559
|
+
"get",
|
|
5560
|
+
"gettype",
|
|
5561
|
+
"getxmlnamespace",
|
|
5562
|
+
"global",
|
|
5563
|
+
"gosub",
|
|
5564
|
+
"goto",
|
|
5565
|
+
"handles",
|
|
5566
|
+
"implements",
|
|
5567
|
+
"imports",
|
|
5568
|
+
"inherits",
|
|
5569
|
+
"integer",
|
|
5570
|
+
"isnot",
|
|
5571
|
+
"let",
|
|
5572
|
+
"lib",
|
|
5573
|
+
"like",
|
|
5574
|
+
"loop",
|
|
5575
|
+
"me",
|
|
5576
|
+
"mod",
|
|
5577
|
+
"module",
|
|
5578
|
+
"mustinherit",
|
|
5579
|
+
"mustoverride",
|
|
5580
|
+
"mybase",
|
|
5581
|
+
"myclass",
|
|
5582
|
+
"narrowing",
|
|
5583
|
+
"next",
|
|
5584
|
+
"not",
|
|
5585
|
+
"nothing",
|
|
5586
|
+
"notinheritable",
|
|
5587
|
+
"notoverridable",
|
|
5588
|
+
"of",
|
|
5589
|
+
"on",
|
|
5590
|
+
"option",
|
|
5591
|
+
"optional",
|
|
5592
|
+
"or",
|
|
5593
|
+
"orelse",
|
|
5594
|
+
"overloads",
|
|
5595
|
+
"overridable",
|
|
5596
|
+
"overrides",
|
|
5597
|
+
"paramarray",
|
|
5598
|
+
"partial",
|
|
5599
|
+
"property",
|
|
5600
|
+
"raiseevent",
|
|
5601
|
+
"redim",
|
|
5602
|
+
"rem",
|
|
5603
|
+
"removehandler",
|
|
5604
|
+
"resume",
|
|
5605
|
+
"select",
|
|
5606
|
+
"set",
|
|
5607
|
+
"shadows",
|
|
5608
|
+
"shared",
|
|
5609
|
+
"single",
|
|
5610
|
+
"step",
|
|
5611
|
+
"stop",
|
|
5612
|
+
"structure",
|
|
5613
|
+
"sub",
|
|
5614
|
+
"synclock",
|
|
5615
|
+
"then",
|
|
5616
|
+
"to",
|
|
5617
|
+
"trycast",
|
|
5618
|
+
"uinteger",
|
|
5619
|
+
"ushort",
|
|
5620
|
+
"variant",
|
|
5621
|
+
"wend",
|
|
5622
|
+
"when",
|
|
5623
|
+
"widening",
|
|
5624
|
+
"with",
|
|
5625
|
+
"withevents",
|
|
5626
|
+
"writeonly",
|
|
5627
|
+
"xor"
|
|
5628
|
+
]);
|
|
4612
5629
|
// ../../common/src/host-global-options.ts
|
|
4613
5630
|
var HOST_GLOBAL_OPTIONS_WITH_VALUE = [
|
|
4614
5631
|
"--output",
|
|
@@ -5041,7 +6058,7 @@ class VoidApiResponse {
|
|
|
5041
6058
|
var package_default2 = {
|
|
5042
6059
|
name: "@uipath/resourcecatalog-sdk",
|
|
5043
6060
|
license: "MIT",
|
|
5044
|
-
version: "1.
|
|
6061
|
+
version: "1.202.0",
|
|
5045
6062
|
description: "SDK for the UiPath Resource Catalog Service API.",
|
|
5046
6063
|
repository: {
|
|
5047
6064
|
type: "git",
|
|
@@ -6428,6 +7445,40 @@ class TagsApi extends BaseAPI {
|
|
|
6428
7445
|
await this.tagsPutRaw(requestParameters, initOverrides);
|
|
6429
7446
|
}
|
|
6430
7447
|
}
|
|
7448
|
+
// ../../auth/src/catch-error.ts
|
|
7449
|
+
function isPromiseLike2(value) {
|
|
7450
|
+
return value !== null && typeof value === "object" && typeof value.then === "function";
|
|
7451
|
+
}
|
|
7452
|
+
function catchError2(fnOrPromise) {
|
|
7453
|
+
if (isPromiseLike2(fnOrPromise)) {
|
|
7454
|
+
return settlePromiseLike2(fnOrPromise);
|
|
7455
|
+
}
|
|
7456
|
+
try {
|
|
7457
|
+
const result = fnOrPromise();
|
|
7458
|
+
if (isPromiseLike2(result)) {
|
|
7459
|
+
return settlePromiseLike2(result);
|
|
7460
|
+
}
|
|
7461
|
+
return [undefined, result];
|
|
7462
|
+
} catch (error) {
|
|
7463
|
+
return [
|
|
7464
|
+
error instanceof Error ? error : new Error(String(error)),
|
|
7465
|
+
undefined
|
|
7466
|
+
];
|
|
7467
|
+
}
|
|
7468
|
+
}
|
|
7469
|
+
function settlePromiseLike2(thenable) {
|
|
7470
|
+
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [
|
|
7471
|
+
error instanceof Error ? error : new Error(String(error)),
|
|
7472
|
+
undefined
|
|
7473
|
+
]);
|
|
7474
|
+
}
|
|
7475
|
+
|
|
7476
|
+
// ../../auth/src/constants.ts
|
|
7477
|
+
var UIPATH_HOME_DIR = ".uipath";
|
|
7478
|
+
var AUTH_FILENAME = ".auth";
|
|
7479
|
+
var DEFAULT_BASE_URL = "https://cloud.uipath.com";
|
|
7480
|
+
var DEFAULT_AUTH_TIMEOUT_MS2 = 5 * 60 * 1000;
|
|
7481
|
+
|
|
6431
7482
|
// ../../auth/src/config.ts
|
|
6432
7483
|
var DEFAULT_CLIENT_ID = "36dea5b8-e8bb-423d-8e7b-c808df8f1c00";
|
|
6433
7484
|
var AUTH_FILE_CONFIG_KEY = Symbol.for("@uipath/auth/AuthFileConfig");
|
|
@@ -6441,7 +7492,7 @@ class InvalidBaseUrlError extends Error {
|
|
|
6441
7492
|
super(`Invalid base URL: "${url}"
|
|
6442
7493
|
` + `Reason: ${reason}
|
|
6443
7494
|
|
|
6444
|
-
` + `Expected format: an https:// URL, e.g. https://cloud.uipath.com (commercial), https://govcloud.uipath.us (Public Sector), or your Automation Suite host (https://<your-host>).
|
|
7495
|
+
` + `Expected format: an https:// URL (or bare host — https:// is assumed), e.g. https://cloud.uipath.com (commercial), https://govcloud.uipath.us (Public Sector), or your Automation Suite host (https://<your-host>).
|
|
6445
7496
|
` + `You can specify the URL via:
|
|
6446
7497
|
` + ` • --authority flag
|
|
6447
7498
|
` + ` • UIPATH_URL environment variable
|
|
@@ -6462,10 +7513,16 @@ var normalizeAndValidateBaseUrl = (rawUrl) => {
|
|
|
6462
7513
|
while (baseUrl.endsWith("/")) {
|
|
6463
7514
|
baseUrl = baseUrl.slice(0, -1);
|
|
6464
7515
|
}
|
|
7516
|
+
const hasScheme = /^[a-z][a-z0-9+.-]*:\/\//i.test(baseUrl);
|
|
7517
|
+
const [hostCandidate] = baseUrl.split(/[/?#]/, 1);
|
|
7518
|
+
if (!hasScheme && hostCandidate.includes(".")) {
|
|
7519
|
+
baseUrl = `https://${baseUrl}`;
|
|
7520
|
+
}
|
|
6465
7521
|
const resolvedBaseUrl = baseUrl;
|
|
6466
|
-
const [urlError, url] =
|
|
7522
|
+
const [urlError, url] = catchError2(() => new URL(resolvedBaseUrl));
|
|
6467
7523
|
if (urlError) {
|
|
6468
|
-
|
|
7524
|
+
const shapeHint = !hasScheme && !hostCandidate.includes(".") ? ` "${rawUrl.trim()}" is not a URL or a host name. Pass the full authority URL — https://<host>, or just <host> (https:// is assumed).` : ` ${urlError instanceof Error ? urlError.message : "Unknown error"}`;
|
|
7525
|
+
throw new InvalidBaseUrlError(baseUrl, `Malformed URL.${shapeHint}`);
|
|
6469
7526
|
}
|
|
6470
7527
|
if (url.protocol !== "https:") {
|
|
6471
7528
|
throw new InvalidBaseUrlError(baseUrl, `Authority must use https:// scheme, got ${url.protocol}//. OIDC token exchange requires TLS end-to-end.`);
|
|
@@ -6520,6 +7577,11 @@ var resolveConfigAsync = async ({
|
|
|
6520
7577
|
};
|
|
6521
7578
|
};
|
|
6522
7579
|
|
|
7580
|
+
// ../../auth/src/utils/platform.ts
|
|
7581
|
+
function isBrowser() {
|
|
7582
|
+
return typeof globalThis !== "undefined" && "window" in globalThis && "document" in globalThis;
|
|
7583
|
+
}
|
|
7584
|
+
|
|
6523
7585
|
// ../../auth/src/authProfile.ts
|
|
6524
7586
|
var DEFAULT_AUTH_PROFILE = "default";
|
|
6525
7587
|
var PROFILE_DIR = "profiles";
|
|
@@ -6531,7 +7593,7 @@ function isAuthProfileStorage(value) {
|
|
|
6531
7593
|
return value !== null && typeof value === "object" && "getStore" in value && "run" in value;
|
|
6532
7594
|
}
|
|
6533
7595
|
function createProfileStorage() {
|
|
6534
|
-
const [error, mod] =
|
|
7596
|
+
const [error, mod] = catchError2(() => __require("node:async_hooks"));
|
|
6535
7597
|
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
6536
7598
|
return {
|
|
6537
7599
|
getStore: () => {
|
|
@@ -6547,9 +7609,9 @@ function getProfileStorage() {
|
|
|
6547
7609
|
if (isAuthProfileStorage(existing)) {
|
|
6548
7610
|
return existing;
|
|
6549
7611
|
}
|
|
6550
|
-
const
|
|
6551
|
-
globalSlot2[AUTH_PROFILE_STORAGE_KEY] =
|
|
6552
|
-
return
|
|
7612
|
+
const storage2 = createProfileStorage();
|
|
7613
|
+
globalSlot2[AUTH_PROFILE_STORAGE_KEY] = storage2;
|
|
7614
|
+
return storage2;
|
|
6553
7615
|
}
|
|
6554
7616
|
var profileStorage = getProfileStorage();
|
|
6555
7617
|
|
|
@@ -6580,8 +7642,8 @@ function resolveAuthProfileFilePath(profile) {
|
|
|
6580
7642
|
if (normalized === undefined) {
|
|
6581
7643
|
throw new AuthProfileValidationError(`"${DEFAULT_AUTH_PROFILE}" is the built-in profile and does not have a profile file path.`);
|
|
6582
7644
|
}
|
|
6583
|
-
const
|
|
6584
|
-
return
|
|
7645
|
+
const fs2 = getFileSystem();
|
|
7646
|
+
return fs2.path.join(fs2.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR, normalized, AUTH_FILENAME);
|
|
6585
7647
|
}
|
|
6586
7648
|
function getActiveAuthProfileFilePath() {
|
|
6587
7649
|
const profile = getActiveAuthProfile();
|
|
@@ -6662,7 +7724,7 @@ var getTokenExpiration = (accessToken) => {
|
|
|
6662
7724
|
// ../../auth/src/sessionIdentity.ts
|
|
6663
7725
|
var parseAuthFlow = (value) => value === "authorization_code" || value === "client_credentials" || value === "federated_credentials" ? value : undefined;
|
|
6664
7726
|
var decodeClaims = (accessToken) => {
|
|
6665
|
-
const [error, claims] =
|
|
7727
|
+
const [error, claims] = catchError2(() => parseJWT(accessToken));
|
|
6666
7728
|
return error ? undefined : claims;
|
|
6667
7729
|
};
|
|
6668
7730
|
var asString = (value) => typeof value === "string" && value.length > 0 ? value : undefined;
|
|
@@ -6746,27 +7808,48 @@ var requireEnv = (name) => {
|
|
|
6746
7808
|
}
|
|
6747
7809
|
return value;
|
|
6748
7810
|
};
|
|
7811
|
+
var OPAQUE_TOKEN_BASE_URL_VAR = "UIPATH_URL";
|
|
7812
|
+
var resolveBaseUrl = (rawUrl, failureContext) => {
|
|
7813
|
+
const [baseUrlError, baseUrl] = catchError2(() => normalizeAndValidateBaseUrl(rawUrl));
|
|
7814
|
+
if (baseUrlError) {
|
|
7815
|
+
if (baseUrlError instanceof InvalidBaseUrlError) {
|
|
7816
|
+
throw baseUrlError;
|
|
7817
|
+
}
|
|
7818
|
+
throw new EnvAuthConfigError(`${failureContext}: ` + `${baseUrlError instanceof Error ? baseUrlError.message : String(baseUrlError)}`);
|
|
7819
|
+
}
|
|
7820
|
+
return baseUrl;
|
|
7821
|
+
};
|
|
6749
7822
|
var readAuthFromEnv = () => {
|
|
6750
7823
|
const accessToken = requireEnv(ENV_AUTH_VARS.token);
|
|
6751
7824
|
const organizationName = requireEnv(ENV_AUTH_VARS.organizationName);
|
|
6752
7825
|
const organizationId = requireEnv(ENV_AUTH_VARS.organizationId);
|
|
6753
7826
|
const tenantName = requireEnv(ENV_AUTH_VARS.tenantName);
|
|
6754
7827
|
const tenantId = requireEnv(ENV_AUTH_VARS.tenantId);
|
|
6755
|
-
const [parseError, payload] =
|
|
7828
|
+
const [parseError, payload] = catchError2(() => parseJWT(accessToken));
|
|
6756
7829
|
if (parseError) {
|
|
6757
|
-
|
|
7830
|
+
const parseErrorMessage = parseError instanceof Error ? parseError.message : String(parseError);
|
|
7831
|
+
const rawUrl = process.env[OPAQUE_TOKEN_BASE_URL_VAR];
|
|
7832
|
+
if (!rawUrl) {
|
|
7833
|
+
throw new EnvAuthConfigError(`${ENV_AUTH_VARS.token} is not a JWT (treating it as an opaque token, ` + `e.g. a Personal Access Token). Set ${OPAQUE_TOKEN_BASE_URL_VAR} to the ` + `UiPath base URL if this is a PAT, or fix the token if it was meant to ` + `be a JWT (parse error: ${parseErrorMessage}).`);
|
|
7834
|
+
}
|
|
7835
|
+
const baseUrl2 = resolveBaseUrl(rawUrl, `Failed to validate ${OPAQUE_TOKEN_BASE_URL_VAR}`);
|
|
7836
|
+
return {
|
|
7837
|
+
loginStatus: "Logged in",
|
|
7838
|
+
accessToken,
|
|
7839
|
+
baseUrl: baseUrl2,
|
|
7840
|
+
organizationName,
|
|
7841
|
+
organizationId,
|
|
7842
|
+
tenantName,
|
|
7843
|
+
tenantId,
|
|
7844
|
+
source: "env-vars" /* EnvironmentVariables */,
|
|
7845
|
+
hint: "Token is opaque (not a JWT) - expiration and identity cannot be " + "determined locally. Commands will fail with 401 once it is revoked or " + `expired. If this was meant to be a JWT instead of a PAT, note: ${parseErrorMessage}`
|
|
7846
|
+
};
|
|
6758
7847
|
}
|
|
6759
7848
|
const iss = payload.iss;
|
|
6760
7849
|
if (typeof iss !== "string" || iss.length === 0) {
|
|
6761
7850
|
throw new EnvAuthConfigError(`${ENV_AUTH_VARS.token} has no 'iss' claim; cannot determine ` + `the UiPath server. Ensure the token was issued by a UiPath identity server.`);
|
|
6762
7851
|
}
|
|
6763
|
-
const
|
|
6764
|
-
if (baseUrlError) {
|
|
6765
|
-
if (baseUrlError instanceof InvalidBaseUrlError) {
|
|
6766
|
-
throw baseUrlError;
|
|
6767
|
-
}
|
|
6768
|
-
throw new EnvAuthConfigError(`Failed to derive server URL from token 'iss' claim: ` + `${baseUrlError instanceof Error ? baseUrlError.message : String(baseUrlError)}`);
|
|
6769
|
-
}
|
|
7852
|
+
const baseUrl = resolveBaseUrl(iss, "Failed to derive server URL from token 'iss' claim");
|
|
6770
7853
|
const expiration = getTokenExpiration(accessToken);
|
|
6771
7854
|
const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
|
|
6772
7855
|
const identity = resolveSessionIdentity(accessToken);
|
|
@@ -6792,8 +7875,8 @@ var SURFACE_WINDOW_MS = 60 * 60 * 1000;
|
|
|
6792
7875
|
async function refreshTokenFingerprint(refreshToken) {
|
|
6793
7876
|
const bytes = new TextEncoder().encode(refreshToken);
|
|
6794
7877
|
if (globalThis.crypto?.subtle) {
|
|
6795
|
-
const
|
|
6796
|
-
return Array.from(new Uint8Array(
|
|
7878
|
+
const digest2 = await globalThis.crypto.subtle.digest("SHA-256", bytes);
|
|
7879
|
+
return Array.from(new Uint8Array(digest2), (b) => b.toString(16).padStart(2, "0")).join("").slice(0, 16);
|
|
6797
7880
|
}
|
|
6798
7881
|
const { createHash } = await import("node:crypto");
|
|
6799
7882
|
return createHash("sha256").update(refreshToken).digest("hex").slice(0, 16);
|
|
@@ -6802,9 +7885,9 @@ function breakerPathFor(authPath) {
|
|
|
6802
7885
|
return `${authPath}${BREAKER_SUFFIX}`;
|
|
6803
7886
|
}
|
|
6804
7887
|
async function loadRefreshBreaker(authPath) {
|
|
6805
|
-
const
|
|
7888
|
+
const fs2 = getFileSystem();
|
|
6806
7889
|
try {
|
|
6807
|
-
const content = await
|
|
7890
|
+
const content = await fs2.readFile(breakerPathFor(authPath), "utf-8");
|
|
6808
7891
|
if (!content)
|
|
6809
7892
|
return {};
|
|
6810
7893
|
const parsed = JSON.parse(content);
|
|
@@ -6815,20 +7898,20 @@ async function loadRefreshBreaker(authPath) {
|
|
|
6815
7898
|
}
|
|
6816
7899
|
async function saveRefreshBreaker(authPath, state) {
|
|
6817
7900
|
try {
|
|
6818
|
-
const
|
|
6819
|
-
const
|
|
6820
|
-
await
|
|
6821
|
-
const tempPath = `${
|
|
6822
|
-
await
|
|
6823
|
-
await
|
|
7901
|
+
const fs2 = getFileSystem();
|
|
7902
|
+
const path2 = breakerPathFor(authPath);
|
|
7903
|
+
await fs2.mkdir(fs2.path.dirname(path2));
|
|
7904
|
+
const tempPath = `${path2}.tmp`;
|
|
7905
|
+
await fs2.writeFile(tempPath, JSON.stringify(state));
|
|
7906
|
+
await fs2.rename(tempPath, path2);
|
|
6824
7907
|
} catch {}
|
|
6825
7908
|
}
|
|
6826
7909
|
async function clearRefreshBreaker(authPath) {
|
|
6827
|
-
const
|
|
6828
|
-
const
|
|
7910
|
+
const fs2 = getFileSystem();
|
|
7911
|
+
const path2 = breakerPathFor(authPath);
|
|
6829
7912
|
try {
|
|
6830
|
-
if (await
|
|
6831
|
-
await
|
|
7913
|
+
if (await fs2.exists(path2)) {
|
|
7914
|
+
await fs2.rm(path2);
|
|
6832
7915
|
}
|
|
6833
7916
|
} catch {}
|
|
6834
7917
|
}
|
|
@@ -6849,43 +7932,43 @@ var ROBOT_USER_SERVICES_PIPE = "UiPathUserServices";
|
|
|
6849
7932
|
var ROBOT_USER_SERVICES_ALTERNATE_PIPE = `${ROBOT_USER_SERVICES_PIPE}Alternate`;
|
|
6850
7933
|
var PIPE_NAME_MAX_LENGTH = 103;
|
|
6851
7934
|
var getRobotIpcPipeNames = async () => {
|
|
6852
|
-
const
|
|
6853
|
-
const username =
|
|
7935
|
+
const fs2 = getFileSystem();
|
|
7936
|
+
const username = fs2.env.getenv("USER") ?? fs2.env.getenv("USERNAME");
|
|
6854
7937
|
if (!username) {
|
|
6855
7938
|
throw new Error("Unable to determine current username");
|
|
6856
7939
|
}
|
|
6857
|
-
const tempPath =
|
|
6858
|
-
return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) =>
|
|
7940
|
+
const tempPath = fs2.env.getenv("TMPDIR") ?? "/tmp/";
|
|
7941
|
+
return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) => fs2.path.join(tempPath, `${baseName}_${username}`).substring(0, PIPE_NAME_MAX_LENGTH));
|
|
6859
7942
|
};
|
|
6860
7943
|
var defaultIsRobotIpcAvailable = async () => {
|
|
6861
7944
|
if (process.platform === "win32") {
|
|
6862
7945
|
return true;
|
|
6863
7946
|
}
|
|
6864
|
-
const [pipeNamesError, pipeNames] = await
|
|
7947
|
+
const [pipeNamesError, pipeNames] = await catchError2(getRobotIpcPipeNames());
|
|
6865
7948
|
if (pipeNamesError || !pipeNames) {
|
|
6866
7949
|
return false;
|
|
6867
7950
|
}
|
|
6868
|
-
const
|
|
7951
|
+
const fs2 = getFileSystem();
|
|
6869
7952
|
for (const pipeName of pipeNames) {
|
|
6870
|
-
const [existsError, exists] = await
|
|
7953
|
+
const [existsError, exists] = await catchError2(fs2.exists(pipeName));
|
|
6871
7954
|
if (!existsError && exists === true) {
|
|
6872
7955
|
return true;
|
|
6873
7956
|
}
|
|
6874
7957
|
}
|
|
6875
7958
|
return false;
|
|
6876
7959
|
};
|
|
6877
|
-
var withTimeout = (promise, timeoutMs) => new Promise((
|
|
7960
|
+
var withTimeout = (promise, timeoutMs) => new Promise((resolve2, reject) => {
|
|
6878
7961
|
const timer = setTimeout(() => reject(new Error(`Robot IPC call timed out after ${timeoutMs}ms`)), timeoutMs);
|
|
6879
7962
|
promise.then((value) => {
|
|
6880
7963
|
clearTimeout(timer);
|
|
6881
|
-
|
|
7964
|
+
resolve2(value);
|
|
6882
7965
|
}, (error) => {
|
|
6883
7966
|
clearTimeout(timer);
|
|
6884
7967
|
reject(error);
|
|
6885
7968
|
});
|
|
6886
7969
|
});
|
|
6887
7970
|
var parseResourceUrl = (url) => {
|
|
6888
|
-
const [error, parsed] =
|
|
7971
|
+
const [error, parsed] = catchError2(() => new URL(url));
|
|
6889
7972
|
if (error || !parsed)
|
|
6890
7973
|
return;
|
|
6891
7974
|
const segments = parsed.pathname.split("/").filter(Boolean);
|
|
@@ -6905,7 +7988,7 @@ var defaultLoadModule = async () => {
|
|
|
6905
7988
|
if (!hostLoader) {
|
|
6906
7989
|
return;
|
|
6907
7990
|
}
|
|
6908
|
-
const [error, mod] = await
|
|
7991
|
+
const [error, mod] = await catchError2(() => hostLoader());
|
|
6909
7992
|
if (error || !mod) {
|
|
6910
7993
|
return;
|
|
6911
7994
|
}
|
|
@@ -6931,7 +8014,7 @@ var tryRobotClientFallback = async (options = {}) => {
|
|
|
6931
8014
|
const mod = await loadModule();
|
|
6932
8015
|
if (!mod)
|
|
6933
8016
|
return;
|
|
6934
|
-
const [ctorError, proxy] =
|
|
8017
|
+
const [ctorError, proxy] = catchError2(() => new mod.RobotProxyConstructor);
|
|
6935
8018
|
if (ctorError || !proxy) {
|
|
6936
8019
|
return;
|
|
6937
8020
|
}
|
|
@@ -6954,7 +8037,7 @@ var tryRobotClientFallback = async (options = {}) => {
|
|
|
6954
8037
|
let organizationIdFromToken;
|
|
6955
8038
|
let tenantIdFromToken;
|
|
6956
8039
|
let issuerFromToken;
|
|
6957
|
-
const [jwtError, claims] =
|
|
8040
|
+
const [jwtError, claims] = catchError2(() => parseJWT(accessToken));
|
|
6958
8041
|
if (!jwtError && claims) {
|
|
6959
8042
|
const rawOrgId = claims.prtId ?? claims.organizationId ?? claims.prt_id;
|
|
6960
8043
|
if (typeof rawOrgId === "string" && rawOrgId.length > 0) {
|
|
@@ -6981,7 +8064,7 @@ var tryRobotClientFallback = async (options = {}) => {
|
|
|
6981
8064
|
} catch {
|
|
6982
8065
|
return;
|
|
6983
8066
|
} finally {
|
|
6984
|
-
await
|
|
8067
|
+
await catchError2(() => withTimeout(proxy.CloseAsync(), CLOSE_TIMEOUT_MS));
|
|
6985
8068
|
}
|
|
6986
8069
|
};
|
|
6987
8070
|
|
|
@@ -7051,9 +8134,9 @@ var errorCode = (err) => {
|
|
|
7051
8134
|
}
|
|
7052
8135
|
return "EUNKNOWN";
|
|
7053
8136
|
};
|
|
7054
|
-
var probeAsync = async (
|
|
8137
|
+
var probeAsync = async (fs2, candidate) => {
|
|
7055
8138
|
try {
|
|
7056
|
-
const stats = await
|
|
8139
|
+
const stats = await fs2.stat(candidate);
|
|
7057
8140
|
if (stats === null) {
|
|
7058
8141
|
return { exists: false };
|
|
7059
8142
|
}
|
|
@@ -7080,9 +8163,9 @@ var probeAsync = async (fs, candidate) => {
|
|
|
7080
8163
|
}
|
|
7081
8164
|
};
|
|
7082
8165
|
var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
|
|
7083
|
-
const
|
|
7084
|
-
if (
|
|
7085
|
-
const probe2 = await probeAsync(
|
|
8166
|
+
const fs2 = getFileSystem();
|
|
8167
|
+
if (fs2.path.isAbsolute(envFilePath)) {
|
|
8168
|
+
const probe2 = await probeAsync(fs2, envFilePath);
|
|
7086
8169
|
return probe2.exists ? { exists: true, absolutePath: envFilePath, source: "absolute" } : {
|
|
7087
8170
|
exists: false,
|
|
7088
8171
|
absolutePath: envFilePath,
|
|
@@ -7090,11 +8173,11 @@ var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opt
|
|
|
7090
8173
|
...probe2.unusable ? { unusable: probe2.unusable } : {}
|
|
7091
8174
|
};
|
|
7092
8175
|
}
|
|
7093
|
-
const cwd = opts?.cwd ??
|
|
8176
|
+
const cwd = opts?.cwd ?? fs2.env.cwd();
|
|
7094
8177
|
let searchDir = cwd;
|
|
7095
8178
|
while (true) {
|
|
7096
|
-
const candidate =
|
|
7097
|
-
const probe2 = await probeAsync(
|
|
8179
|
+
const candidate = fs2.path.join(searchDir, envFilePath);
|
|
8180
|
+
const probe2 = await probeAsync(fs2, candidate);
|
|
7098
8181
|
if (probe2.exists) {
|
|
7099
8182
|
return {
|
|
7100
8183
|
exists: true,
|
|
@@ -7102,14 +8185,14 @@ var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opt
|
|
|
7102
8185
|
source: searchDir === cwd ? "cwd" : "ancestor"
|
|
7103
8186
|
};
|
|
7104
8187
|
}
|
|
7105
|
-
const parentDir =
|
|
8188
|
+
const parentDir = fs2.path.dirname(searchDir);
|
|
7106
8189
|
if (parentDir === searchDir) {
|
|
7107
8190
|
break;
|
|
7108
8191
|
}
|
|
7109
8192
|
searchDir = parentDir;
|
|
7110
8193
|
}
|
|
7111
|
-
const homePath =
|
|
7112
|
-
const probe = await probeAsync(
|
|
8194
|
+
const homePath = fs2.path.join(fs2.env.homedir(), envFilePath);
|
|
8195
|
+
const probe = await probeAsync(fs2, homePath);
|
|
7113
8196
|
if (probe.exists) {
|
|
7114
8197
|
return { exists: true, absolutePath: homePath, source: "home" };
|
|
7115
8198
|
}
|
|
@@ -7131,12 +8214,12 @@ var resolveEnvFilePathAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) =
|
|
|
7131
8214
|
};
|
|
7132
8215
|
};
|
|
7133
8216
|
var loadEnvFileAsync = async ({ envPath }) => {
|
|
7134
|
-
const
|
|
7135
|
-
const absolutePath =
|
|
7136
|
-
if (!await
|
|
8217
|
+
const fs2 = getFileSystem();
|
|
8218
|
+
const absolutePath = fs2.path.isAbsolute(envPath) ? envPath : fs2.path.join(fs2.env.cwd(), envPath);
|
|
8219
|
+
if (!await fs2.exists(absolutePath)) {
|
|
7137
8220
|
throw new Error(`Environment file not found: ${envPath}`);
|
|
7138
8221
|
}
|
|
7139
|
-
const content = await
|
|
8222
|
+
const content = await fs2.readFile(absolutePath, "utf-8");
|
|
7140
8223
|
if (content === null) {
|
|
7141
8224
|
throw new Error(`Environment file not found: ${envPath}`);
|
|
7142
8225
|
}
|
|
@@ -7165,10 +8248,10 @@ var saveEnvFileAsync = async ({
|
|
|
7165
8248
|
data,
|
|
7166
8249
|
merge = true
|
|
7167
8250
|
}) => {
|
|
7168
|
-
const
|
|
7169
|
-
const absolutePath =
|
|
8251
|
+
const fs2 = getFileSystem();
|
|
8252
|
+
const absolutePath = fs2.path.isAbsolute(envPath) ? envPath : fs2.path.join(fs2.env.homedir(), envPath);
|
|
7170
8253
|
let existingData = {};
|
|
7171
|
-
if (merge && await
|
|
8254
|
+
if (merge && await fs2.exists(absolutePath)) {
|
|
7172
8255
|
try {
|
|
7173
8256
|
existingData = await loadEnvFileAsync({ envPath: absolutePath });
|
|
7174
8257
|
} catch {}
|
|
@@ -7186,11 +8269,11 @@ var saveEnvFileAsync = async ({
|
|
|
7186
8269
|
const content = `${lines.join(`
|
|
7187
8270
|
`)}
|
|
7188
8271
|
`;
|
|
7189
|
-
const dir =
|
|
7190
|
-
await
|
|
8272
|
+
const dir = fs2.path.dirname(absolutePath);
|
|
8273
|
+
await fs2.mkdir(dir);
|
|
7191
8274
|
const tempPath = `${absolutePath}.tmp`;
|
|
7192
|
-
await
|
|
7193
|
-
await
|
|
8275
|
+
await fs2.writeFile(tempPath, content);
|
|
8276
|
+
await fs2.rename(tempPath, absolutePath);
|
|
7194
8277
|
};
|
|
7195
8278
|
|
|
7196
8279
|
// ../../auth/src/loginStatus.ts
|
|
@@ -7304,11 +8387,11 @@ async function loadFileCredentials(loadEnvFile, absolutePath) {
|
|
|
7304
8387
|
return { credentials };
|
|
7305
8388
|
}
|
|
7306
8389
|
async function getGlobalCredsHint(getFs, loadEnvFile, absolutePath, envFilePath) {
|
|
7307
|
-
const
|
|
7308
|
-
const globalPath =
|
|
8390
|
+
const fs2 = getFs();
|
|
8391
|
+
const globalPath = fs2.path.join(fs2.env.homedir(), envFilePath);
|
|
7309
8392
|
if (absolutePath === globalPath)
|
|
7310
8393
|
return;
|
|
7311
|
-
if (!await
|
|
8394
|
+
if (!await fs2.exists(globalPath))
|
|
7312
8395
|
return;
|
|
7313
8396
|
try {
|
|
7314
8397
|
const globalCreds = await loadEnvFile({ envPath: globalPath });
|
|
@@ -7774,7 +8857,7 @@ var registerSearchCommands = (rcs) => {
|
|
|
7774
8857
|
}
|
|
7775
8858
|
const resolvedOffset = offset.value ?? 0;
|
|
7776
8859
|
const resolvedLimit = options.limit ?? DEFAULT_PAGE_SIZE;
|
|
7777
|
-
const [error, result] = await
|
|
8860
|
+
const [error, result] = await catchError((async () => {
|
|
7778
8861
|
const { api, organizationId } = await createApiClient(EntitiesApi, {
|
|
7779
8862
|
loginValidity: options.loginValidity,
|
|
7780
8863
|
tenantName: options.tenant
|
|
@@ -7883,7 +8966,7 @@ var registerTagCommands = (rcs) => {
|
|
|
7883
8966
|
if (offset.usedDeprecated) {
|
|
7884
8967
|
warnDeprecatedOptionAlias("--skip", "--offset");
|
|
7885
8968
|
}
|
|
7886
|
-
const [error, result] = await
|
|
8969
|
+
const [error, result] = await catchError((async () => {
|
|
7887
8970
|
if (options.type !== TagType.Label && options.type !== TagType.KeyValue) {
|
|
7888
8971
|
throw new Error(`Invalid --type '${options.type}'. Use 'Label' or 'KeyValue'.`);
|
|
7889
8972
|
}
|
|
@@ -7943,4 +9026,4 @@ var registerCommands = async (program2) => {
|
|
|
7943
9026
|
|
|
7944
9027
|
export { Command, metadata, registerCommands };
|
|
7945
9028
|
|
|
7946
|
-
//# debugId=
|
|
9029
|
+
//# debugId=58C4C4DC3E674C4264756E2164756E21
|