@uipath/ixp-tool 1.205.0-preview.284 → 1.206.0-preview.282
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -0
- package/dist/{index-sby22td6.js → index-nzr4mx5p.js} +2 -22
- package/dist/index.js +5 -6
- package/dist/{jmespath-231m3hyn.js → jmespath-ab6tdc42.js} +1 -1
- package/dist/{js-yaml-88tdqrtd.js → js-yaml-a2bk27p6.js} +1 -3
- package/dist/{tool-1de529jm.js → tool-epsr41wx.js} +12 -3
- package/dist/{tool-bap39xd4.js → tool-gyp276bc.js} +1267 -726
- package/dist/tool.js +6 -7
- package/package.json +2 -2
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
+
__toESM,
|
|
2
3
|
__commonJS,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "./tool-
|
|
4
|
+
__exportCjs,
|
|
5
|
+
__require
|
|
6
|
+
} from "./tool-epsr41wx.js";
|
|
6
7
|
|
|
7
8
|
// ../../node_modules/commander/lib/error.js
|
|
8
9
|
var require_error = __commonJS(function(exports) {
|
|
@@ -124,7 +125,7 @@ var require_help = __commonJS(function(exports) {
|
|
|
124
125
|
this.helpWidth = this.helpWidth ?? contextOptions.helpWidth ?? 80;
|
|
125
126
|
}
|
|
126
127
|
visibleCommands(cmd) {
|
|
127
|
-
const visibleCommands = cmd.commands.filter((
|
|
128
|
+
const visibleCommands = cmd.commands.filter((cmd) => !cmd._hidden);
|
|
128
129
|
const helpCommand = cmd._getHelpCommand();
|
|
129
130
|
if (helpCommand && !helpCommand._hidden) {
|
|
130
131
|
visibleCommands.push(helpCommand);
|
|
@@ -604,8 +605,8 @@ var require_option = __commonJS(function(exports) {
|
|
|
604
605
|
}
|
|
605
606
|
}
|
|
606
607
|
function camelcase(str) {
|
|
607
|
-
return str.split("-").reduce((
|
|
608
|
-
return
|
|
608
|
+
return str.split("-").reduce((str, word) => {
|
|
609
|
+
return str + word[0].toUpperCase() + word.slice(1);
|
|
609
610
|
});
|
|
610
611
|
}
|
|
611
612
|
function splitOptionFlags(flags) {
|
|
@@ -726,8 +727,8 @@ var require_suggestSimilar = __commonJS(function(exports) {
|
|
|
726
727
|
var require_command = __commonJS(function(exports) {
|
|
727
728
|
var EventEmitter = __require("node:events").EventEmitter;
|
|
728
729
|
var childProcess = __require("node:child_process");
|
|
729
|
-
var
|
|
730
|
-
var
|
|
730
|
+
var path = __require("node:path");
|
|
731
|
+
var fs = __require("node:fs");
|
|
731
732
|
var process2 = __require("node:process");
|
|
732
733
|
var { Argument, humanReadableArgName } = require_argument();
|
|
733
734
|
var { CommanderError } = require_error();
|
|
@@ -1176,44 +1177,44 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1176
1177
|
});
|
|
1177
1178
|
return source;
|
|
1178
1179
|
}
|
|
1179
|
-
_prepareUserArgs(
|
|
1180
|
-
if (
|
|
1180
|
+
_prepareUserArgs(argv2, parseOptions) {
|
|
1181
|
+
if (argv2 !== undefined && !Array.isArray(argv2)) {
|
|
1181
1182
|
throw new Error("first parameter to parse must be array or undefined");
|
|
1182
1183
|
}
|
|
1183
1184
|
parseOptions = parseOptions || {};
|
|
1184
|
-
if (
|
|
1185
|
+
if (argv2 === undefined && parseOptions.from === undefined) {
|
|
1185
1186
|
if (process2.versions?.electron) {
|
|
1186
1187
|
parseOptions.from = "electron";
|
|
1187
1188
|
}
|
|
1188
|
-
const
|
|
1189
|
-
if (
|
|
1189
|
+
const execArgv2 = process2.execArgv ?? [];
|
|
1190
|
+
if (execArgv2.includes("-e") || execArgv2.includes("--eval") || execArgv2.includes("-p") || execArgv2.includes("--print")) {
|
|
1190
1191
|
parseOptions.from = "eval";
|
|
1191
1192
|
}
|
|
1192
1193
|
}
|
|
1193
|
-
if (
|
|
1194
|
-
|
|
1194
|
+
if (argv2 === undefined) {
|
|
1195
|
+
argv2 = process2.argv;
|
|
1195
1196
|
}
|
|
1196
|
-
this.rawArgs =
|
|
1197
|
+
this.rawArgs = argv2.slice();
|
|
1197
1198
|
let userArgs;
|
|
1198
1199
|
switch (parseOptions.from) {
|
|
1199
1200
|
case undefined:
|
|
1200
1201
|
case "node":
|
|
1201
|
-
this._scriptPath =
|
|
1202
|
-
userArgs =
|
|
1202
|
+
this._scriptPath = argv2[1];
|
|
1203
|
+
userArgs = argv2.slice(2);
|
|
1203
1204
|
break;
|
|
1204
1205
|
case "electron":
|
|
1205
1206
|
if (process2.defaultApp) {
|
|
1206
|
-
this._scriptPath =
|
|
1207
|
-
userArgs =
|
|
1207
|
+
this._scriptPath = argv2[1];
|
|
1208
|
+
userArgs = argv2.slice(2);
|
|
1208
1209
|
} else {
|
|
1209
|
-
userArgs =
|
|
1210
|
+
userArgs = argv2.slice(1);
|
|
1210
1211
|
}
|
|
1211
1212
|
break;
|
|
1212
1213
|
case "user":
|
|
1213
|
-
userArgs =
|
|
1214
|
+
userArgs = argv2.slice(0);
|
|
1214
1215
|
break;
|
|
1215
1216
|
case "eval":
|
|
1216
|
-
userArgs =
|
|
1217
|
+
userArgs = argv2.slice(1);
|
|
1217
1218
|
break;
|
|
1218
1219
|
default:
|
|
1219
1220
|
throw new Error(`unexpected parse option { from: '${parseOptions.from}' }`);
|
|
@@ -1262,7 +1263,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1262
1263
|
this.processedArgs = [];
|
|
1263
1264
|
}
|
|
1264
1265
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
1265
|
-
if (
|
|
1266
|
+
if (fs.existsSync(executableFile))
|
|
1266
1267
|
return;
|
|
1267
1268
|
const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
|
|
1268
1269
|
const executableMissing = `'${executableFile}' does not exist
|
|
@@ -1276,12 +1277,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1276
1277
|
let launchWithNode = false;
|
|
1277
1278
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1278
1279
|
function findFile(baseDir, baseName) {
|
|
1279
|
-
const localBin =
|
|
1280
|
-
if (
|
|
1280
|
+
const localBin = path.resolve(baseDir, baseName);
|
|
1281
|
+
if (fs.existsSync(localBin))
|
|
1281
1282
|
return localBin;
|
|
1282
|
-
if (sourceExt.includes(
|
|
1283
|
+
if (sourceExt.includes(path.extname(baseName)))
|
|
1283
1284
|
return;
|
|
1284
|
-
const foundExt = sourceExt.find((ext) =>
|
|
1285
|
+
const foundExt = sourceExt.find((ext) => fs.existsSync(`${localBin}${ext}`));
|
|
1285
1286
|
if (foundExt)
|
|
1286
1287
|
return `${localBin}${foundExt}`;
|
|
1287
1288
|
return;
|
|
@@ -1293,23 +1294,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1293
1294
|
if (this._scriptPath) {
|
|
1294
1295
|
let resolvedScriptPath;
|
|
1295
1296
|
try {
|
|
1296
|
-
resolvedScriptPath =
|
|
1297
|
+
resolvedScriptPath = fs.realpathSync(this._scriptPath);
|
|
1297
1298
|
} catch {
|
|
1298
1299
|
resolvedScriptPath = this._scriptPath;
|
|
1299
1300
|
}
|
|
1300
|
-
executableDir =
|
|
1301
|
+
executableDir = path.resolve(path.dirname(resolvedScriptPath), executableDir);
|
|
1301
1302
|
}
|
|
1302
1303
|
if (executableDir) {
|
|
1303
1304
|
let localFile = findFile(executableDir, executableFile);
|
|
1304
1305
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1305
|
-
const legacyName =
|
|
1306
|
+
const legacyName = path.basename(this._scriptPath, path.extname(this._scriptPath));
|
|
1306
1307
|
if (legacyName !== this._name) {
|
|
1307
1308
|
localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
|
|
1308
1309
|
}
|
|
1309
1310
|
}
|
|
1310
1311
|
executableFile = localFile || executableFile;
|
|
1311
1312
|
}
|
|
1312
|
-
launchWithNode = sourceExt.includes(
|
|
1313
|
+
launchWithNode = sourceExt.includes(path.extname(executableFile));
|
|
1313
1314
|
let proc;
|
|
1314
1315
|
if (process2.platform !== "win32") {
|
|
1315
1316
|
if (launchWithNode) {
|
|
@@ -1736,18 +1737,18 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1736
1737
|
this.error(message, { code: "commander.missingMandatoryOptionValue" });
|
|
1737
1738
|
}
|
|
1738
1739
|
_conflictingOption(option, conflictingOption) {
|
|
1739
|
-
const findBestOptionFromValue = (
|
|
1740
|
-
const optionKey =
|
|
1740
|
+
const findBestOptionFromValue = (option) => {
|
|
1741
|
+
const optionKey = option.attributeName();
|
|
1741
1742
|
const optionValue = this.getOptionValue(optionKey);
|
|
1742
1743
|
const negativeOption = this.options.find((target) => target.negate && optionKey === target.attributeName());
|
|
1743
1744
|
const positiveOption = this.options.find((target) => !target.negate && optionKey === target.attributeName());
|
|
1744
1745
|
if (negativeOption && (negativeOption.presetArg === undefined && optionValue === false || negativeOption.presetArg !== undefined && optionValue === negativeOption.presetArg)) {
|
|
1745
1746
|
return negativeOption;
|
|
1746
1747
|
}
|
|
1747
|
-
return positiveOption ||
|
|
1748
|
+
return positiveOption || option;
|
|
1748
1749
|
};
|
|
1749
|
-
const getErrorMessage = (
|
|
1750
|
-
const bestOption = findBestOptionFromValue(
|
|
1750
|
+
const getErrorMessage = (option) => {
|
|
1751
|
+
const bestOption = findBestOptionFromValue(option);
|
|
1751
1752
|
const optionKey = bestOption.attributeName();
|
|
1752
1753
|
const source = this.getOptionValueSource(optionKey);
|
|
1753
1754
|
if (source === "env") {
|
|
@@ -1898,13 +1899,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1898
1899
|
cmd.helpGroup(this._defaultCommandGroup);
|
|
1899
1900
|
}
|
|
1900
1901
|
nameFromFilename(filename) {
|
|
1901
|
-
this._name =
|
|
1902
|
+
this._name = path.basename(filename, path.extname(filename));
|
|
1902
1903
|
return this;
|
|
1903
1904
|
}
|
|
1904
|
-
executableDir(
|
|
1905
|
-
if (
|
|
1905
|
+
executableDir(path) {
|
|
1906
|
+
if (path === undefined)
|
|
1906
1907
|
return this._executableDir;
|
|
1907
|
-
this._executableDir =
|
|
1908
|
+
this._executableDir = path;
|
|
1908
1909
|
return this;
|
|
1909
1910
|
}
|
|
1910
1911
|
helpInformation(contextOptions) {
|
|
@@ -2001,11 +2002,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2001
2002
|
}
|
|
2002
2003
|
help(contextOptions) {
|
|
2003
2004
|
this.outputHelp(contextOptions);
|
|
2004
|
-
let
|
|
2005
|
-
if (
|
|
2006
|
-
|
|
2005
|
+
let exitCode2 = Number(process2.exitCode ?? 0);
|
|
2006
|
+
if (exitCode2 === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
|
|
2007
|
+
exitCode2 = 1;
|
|
2007
2008
|
}
|
|
2008
|
-
this._exit(
|
|
2009
|
+
this._exit(exitCode2, "commander.help", "(outputHelp)");
|
|
2009
2010
|
}
|
|
2010
2011
|
addHelpText(position, text) {
|
|
2011
2012
|
const allowedValues = ["beforeAll", "before", "after", "afterAll"];
|
|
@@ -2076,32 +2077,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2076
2077
|
exports.Command = Command;
|
|
2077
2078
|
exports.useColor = useColor;
|
|
2078
2079
|
});
|
|
2079
|
-
|
|
2080
|
-
// ../../node_modules/commander/index.js
|
|
2081
|
-
var require_commander = __commonJS(function(exports) {
|
|
2082
|
-
var { Argument } = require_argument();
|
|
2083
|
-
var { Command } = require_command();
|
|
2084
|
-
var { CommanderError, InvalidArgumentError } = require_error();
|
|
2085
|
-
var { Help } = require_help();
|
|
2086
|
-
var { Option } = require_option();
|
|
2087
|
-
exports.program = new Command;
|
|
2088
|
-
exports.createCommand = (name) => new Command(name);
|
|
2089
|
-
exports.createOption = (flags, description) => new Option(flags, description);
|
|
2090
|
-
exports.createArgument = (name, description) => new Argument(name, description);
|
|
2091
|
-
exports.Command = Command;
|
|
2092
|
-
exports.Option = Option;
|
|
2093
|
-
exports.Argument = Argument;
|
|
2094
|
-
exports.Help = Help;
|
|
2095
|
-
exports.CommanderError = CommanderError;
|
|
2096
|
-
exports.InvalidArgumentError = InvalidArgumentError;
|
|
2097
|
-
exports.InvalidOptionArgumentError = InvalidArgumentError;
|
|
2098
|
-
});
|
|
2099
2080
|
// package.json
|
|
2100
2081
|
var package_default = {
|
|
2101
2082
|
name: "@uipath/ixp-tool",
|
|
2102
2083
|
author: "UiPath",
|
|
2103
2084
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
2104
|
-
version: "1.
|
|
2085
|
+
version: "1.206.0-preview.282",
|
|
2105
2086
|
description: "Manage UiPath IXP projects, prompts, predictions, and model publishing.",
|
|
2106
2087
|
private: false,
|
|
2107
2088
|
repository: {
|
|
@@ -2128,6 +2109,7 @@ var package_default = {
|
|
|
2128
2109
|
],
|
|
2129
2110
|
scripts: {
|
|
2130
2111
|
build: "bun ../../tools/build-tool.ts",
|
|
2112
|
+
typecheck: "tsc --noEmit",
|
|
2131
2113
|
package: "bun run build && bun pm pack",
|
|
2132
2114
|
test: "vitest run",
|
|
2133
2115
|
"test:coverage": "vitest run --coverage",
|
|
@@ -2145,7 +2127,7 @@ var package_default = {
|
|
|
2145
2127
|
};
|
|
2146
2128
|
|
|
2147
2129
|
// ../filesystem/src/node.ts
|
|
2148
|
-
import { randomUUID } from "node:crypto";
|
|
2130
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
2149
2131
|
import { existsSync } from "node:fs";
|
|
2150
2132
|
import * as fs from "node:fs/promises";
|
|
2151
2133
|
import * as os from "node:os";
|
|
@@ -2156,6 +2138,9 @@ var LOCK_MAX_WAIT_MS = 20000;
|
|
|
2156
2138
|
var LOCK_MAX_HOLD_MS = 60000;
|
|
2157
2139
|
var LOCK_RETRY_MIN_MS = 100;
|
|
2158
2140
|
var LOCK_RETRY_JITTER_MS = 200;
|
|
2141
|
+
var HASH_CHUNK_BYTES = 256 * 1024;
|
|
2142
|
+
var hashBuffers = [];
|
|
2143
|
+
var HASH_BUFFERS_KEPT = 64;
|
|
2159
2144
|
|
|
2160
2145
|
class NodeFileSystem {
|
|
2161
2146
|
path = {
|
|
@@ -2174,7 +2159,7 @@ class NodeFileSystem {
|
|
|
2174
2159
|
};
|
|
2175
2160
|
utils = {
|
|
2176
2161
|
open: async (url) => {
|
|
2177
|
-
const { default: open } = await import("./index-
|
|
2162
|
+
const { default: open } = await import("./index-nzr4mx5p.js");
|
|
2178
2163
|
await open(url);
|
|
2179
2164
|
}
|
|
2180
2165
|
};
|
|
@@ -2213,6 +2198,15 @@ class NodeFileSystem {
|
|
|
2213
2198
|
throw error;
|
|
2214
2199
|
}
|
|
2215
2200
|
}
|
|
2201
|
+
async readdirEntries(dirPath) {
|
|
2202
|
+
try {
|
|
2203
|
+
return await fs.readdir(dirPath, { withFileTypes: true });
|
|
2204
|
+
} catch (error) {
|
|
2205
|
+
if (this.isEnoent(error))
|
|
2206
|
+
return [];
|
|
2207
|
+
throw error;
|
|
2208
|
+
}
|
|
2209
|
+
}
|
|
2216
2210
|
async stat(filePath) {
|
|
2217
2211
|
try {
|
|
2218
2212
|
const stats = await fs.stat(filePath);
|
|
@@ -2220,7 +2214,8 @@ class NodeFileSystem {
|
|
|
2220
2214
|
isFile: () => stats.isFile(),
|
|
2221
2215
|
isDirectory: () => stats.isDirectory(),
|
|
2222
2216
|
size: stats.size,
|
|
2223
|
-
mtimeMs: stats.mtimeMs
|
|
2217
|
+
mtimeMs: stats.mtimeMs,
|
|
2218
|
+
ctimeMs: stats.ctimeMs
|
|
2224
2219
|
};
|
|
2225
2220
|
} catch (error) {
|
|
2226
2221
|
if (this.isEnoent(error))
|
|
@@ -2334,6 +2329,42 @@ class NodeFileSystem {
|
|
|
2334
2329
|
throw error;
|
|
2335
2330
|
}
|
|
2336
2331
|
}
|
|
2332
|
+
async hashFile(filePath) {
|
|
2333
|
+
let handle;
|
|
2334
|
+
try {
|
|
2335
|
+
handle = await fs.open(filePath, "r");
|
|
2336
|
+
} catch (error) {
|
|
2337
|
+
if (this.isEnoent(error))
|
|
2338
|
+
return null;
|
|
2339
|
+
throw error;
|
|
2340
|
+
}
|
|
2341
|
+
const buffer = hashBuffers.pop() ?? Buffer.allocUnsafe(HASH_CHUNK_BYTES);
|
|
2342
|
+
try {
|
|
2343
|
+
const opened = await handle.stat();
|
|
2344
|
+
const stats = {
|
|
2345
|
+
isFile: () => opened.isFile(),
|
|
2346
|
+
isDirectory: () => opened.isDirectory(),
|
|
2347
|
+
size: opened.size,
|
|
2348
|
+
mtimeMs: opened.mtimeMs,
|
|
2349
|
+
ctimeMs: opened.ctimeMs
|
|
2350
|
+
};
|
|
2351
|
+
const hash = createHash("sha256");
|
|
2352
|
+
let size = 0;
|
|
2353
|
+
for (;; ) {
|
|
2354
|
+
const { bytesRead } = await handle.read(buffer, 0, buffer.byteLength, null);
|
|
2355
|
+
if (bytesRead === 0)
|
|
2356
|
+
break;
|
|
2357
|
+
hash.update(buffer.subarray(0, bytesRead));
|
|
2358
|
+
size += bytesRead;
|
|
2359
|
+
}
|
|
2360
|
+
return { sha256: hash.digest("hex"), size, stats };
|
|
2361
|
+
} finally {
|
|
2362
|
+
if (hashBuffers.length < HASH_BUFFERS_KEPT) {
|
|
2363
|
+
hashBuffers.push(buffer);
|
|
2364
|
+
}
|
|
2365
|
+
await handle.close();
|
|
2366
|
+
}
|
|
2367
|
+
}
|
|
2337
2368
|
async realpath(filePath) {
|
|
2338
2369
|
try {
|
|
2339
2370
|
return await fs.realpath(filePath);
|
|
@@ -2384,6 +2415,208 @@ class NodeFileSystem {
|
|
|
2384
2415
|
var fsInstance = new NodeFileSystem;
|
|
2385
2416
|
var getFileSystem = () => fsInstance;
|
|
2386
2417
|
|
|
2418
|
+
// ../common/src/telemetry/telemetry-dimensions.ts
|
|
2419
|
+
var BaseDimensions = {
|
|
2420
|
+
ApplicationName: "ApplicationName",
|
|
2421
|
+
ProductVersion: "ProductVersion",
|
|
2422
|
+
InstallationId: "InstallationId",
|
|
2423
|
+
CloudUserId: "CloudUserId",
|
|
2424
|
+
CloudTenantId: "CloudTenantId",
|
|
2425
|
+
CloudOrganizationId: "CloudOrganizationId",
|
|
2426
|
+
IsInternalUser: "IsInternalUser",
|
|
2427
|
+
Environment: "Environment",
|
|
2428
|
+
BaseUrl: "BaseUrl",
|
|
2429
|
+
Region: "Region",
|
|
2430
|
+
Agent: "Agent",
|
|
2431
|
+
AgentVersion: "AgentVersion",
|
|
2432
|
+
AgentModel: "AgentModel",
|
|
2433
|
+
ToolName: "ToolName",
|
|
2434
|
+
ToolVersion: "ToolVersion",
|
|
2435
|
+
ExecutionContext: "ExecutionContext",
|
|
2436
|
+
CiProvider: "CiProvider",
|
|
2437
|
+
SessionIdSource: "SessionIdSource",
|
|
2438
|
+
SessionId: "SessionId"
|
|
2439
|
+
};
|
|
2440
|
+
var CommandDimensions = {
|
|
2441
|
+
IsCommand: "IsCommand",
|
|
2442
|
+
IsReexec: "IsReexec",
|
|
2443
|
+
CommandName: "CommandName",
|
|
2444
|
+
ExitCode: "ExitCode",
|
|
2445
|
+
TerminalOutcome: "TerminalOutcome",
|
|
2446
|
+
ErrorClass: "ErrorClass",
|
|
2447
|
+
TerminalSignal: "TerminalSignal",
|
|
2448
|
+
ErrorMessage: "ErrorMessage",
|
|
2449
|
+
SkillName: "SkillName",
|
|
2450
|
+
ProductArea: "ProductArea",
|
|
2451
|
+
Mode: "Mode"
|
|
2452
|
+
};
|
|
2453
|
+
var ProjectDimensions = {
|
|
2454
|
+
ProjectKey: "ProjectKey",
|
|
2455
|
+
ProjectType: "ProjectType",
|
|
2456
|
+
ProjectIdentityStatus: "ProjectIdentityStatus",
|
|
2457
|
+
SolutionKey: "SolutionKey",
|
|
2458
|
+
SolutionProjectKey: "SolutionProjectKey",
|
|
2459
|
+
SolutionIdentityStatus: "SolutionIdentityStatus",
|
|
2460
|
+
PreviousSolutionKey: "PreviousSolutionKey"
|
|
2461
|
+
};
|
|
2462
|
+
var GUID_KEY_DIMENSIONS = new Set([
|
|
2463
|
+
ProjectDimensions.ProjectKey,
|
|
2464
|
+
ProjectDimensions.SolutionKey,
|
|
2465
|
+
ProjectDimensions.SolutionProjectKey,
|
|
2466
|
+
ProjectDimensions.PreviousSolutionKey
|
|
2467
|
+
]);
|
|
2468
|
+
var ShipDimensions = {
|
|
2469
|
+
ShipKind: "ShipKind",
|
|
2470
|
+
Target: "Target",
|
|
2471
|
+
ProjectType: "ProjectType",
|
|
2472
|
+
ProjectTypes: "ProjectTypes",
|
|
2473
|
+
ArtifactCorrelationKey: "ArtifactCorrelationKey",
|
|
2474
|
+
PackageName: "PackageName",
|
|
2475
|
+
PackageVersion: "PackageVersion",
|
|
2476
|
+
PackageVersionKey: "PackageVersionKey",
|
|
2477
|
+
DeploymentKey: "DeploymentKey",
|
|
2478
|
+
SolutionId: "SolutionId",
|
|
2479
|
+
FolderKey: "FolderKey",
|
|
2480
|
+
FeedId: "FeedId"
|
|
2481
|
+
};
|
|
2482
|
+
var ErrorDimensions = {
|
|
2483
|
+
Result: "Result",
|
|
2484
|
+
ErrorCode: "ErrorCode",
|
|
2485
|
+
Retry: "Retry",
|
|
2486
|
+
ErrorMessage: "ErrorMessage",
|
|
2487
|
+
HttpStatus: "HttpStatus",
|
|
2488
|
+
UpstreamErrorCode: "UpstreamErrorCode"
|
|
2489
|
+
};
|
|
2490
|
+
var AuthDimensions = {
|
|
2491
|
+
AuthenticationMethod: "AuthenticationMethod",
|
|
2492
|
+
Success: "Success",
|
|
2493
|
+
Reason: "Reason"
|
|
2494
|
+
};
|
|
2495
|
+
var SkillsDimensions = {
|
|
2496
|
+
SchemaVersion: "SchemaVersion",
|
|
2497
|
+
AgentType: "AgentType",
|
|
2498
|
+
SkillsVersion: "SkillsVersion",
|
|
2499
|
+
UipSubcommand: "UipSubcommand",
|
|
2500
|
+
FileExtension: "FileExtension",
|
|
2501
|
+
SubagentModel: "SubagentModel",
|
|
2502
|
+
SubagentType: "SubagentType",
|
|
2503
|
+
PermissionMode: "PermissionMode",
|
|
2504
|
+
EffortLevel: "EffortLevel",
|
|
2505
|
+
SessionSource: "SessionSource",
|
|
2506
|
+
Outcome: "Outcome",
|
|
2507
|
+
DurationMs: "DurationMs",
|
|
2508
|
+
Source: "Source"
|
|
2509
|
+
};
|
|
2510
|
+
var PackagerDimensions = {
|
|
2511
|
+
ProjectId: "ProjectId",
|
|
2512
|
+
ProjectType: "ProjectType",
|
|
2513
|
+
SolutionId: "SolutionId"
|
|
2514
|
+
};
|
|
2515
|
+
var ScopeDimensions = {
|
|
2516
|
+
FolderId: "FolderId"
|
|
2517
|
+
};
|
|
2518
|
+
var ID_DIMENSIONS = new Set([
|
|
2519
|
+
BaseDimensions.CloudUserId,
|
|
2520
|
+
BaseDimensions.CloudTenantId,
|
|
2521
|
+
BaseDimensions.CloudOrganizationId,
|
|
2522
|
+
BaseDimensions.InstallationId,
|
|
2523
|
+
ShipDimensions.ArtifactCorrelationKey,
|
|
2524
|
+
ShipDimensions.PackageVersionKey,
|
|
2525
|
+
ShipDimensions.DeploymentKey,
|
|
2526
|
+
ShipDimensions.SolutionId,
|
|
2527
|
+
ShipDimensions.FolderKey,
|
|
2528
|
+
ShipDimensions.FeedId,
|
|
2529
|
+
PackagerDimensions.ProjectId
|
|
2530
|
+
]);
|
|
2531
|
+
var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
|
|
2532
|
+
var RESERVED_DIMENSION_NAMES = new Set([
|
|
2533
|
+
...Object.values(BaseDimensions),
|
|
2534
|
+
...Object.values(CommandDimensions),
|
|
2535
|
+
...Object.values(ShipDimensions),
|
|
2536
|
+
...Object.values(ProjectDimensions),
|
|
2537
|
+
...Object.values(ErrorDimensions),
|
|
2538
|
+
...Object.values(AuthDimensions),
|
|
2539
|
+
...Object.values(SkillsDimensions),
|
|
2540
|
+
...Object.values(PackagerDimensions),
|
|
2541
|
+
...Object.values(ScopeDimensions)
|
|
2542
|
+
]);
|
|
2543
|
+
var CURATED_DIMENSIONS = new Set([
|
|
2544
|
+
BaseDimensions.ApplicationName,
|
|
2545
|
+
BaseDimensions.ProductVersion,
|
|
2546
|
+
BaseDimensions.InstallationId,
|
|
2547
|
+
BaseDimensions.CloudUserId,
|
|
2548
|
+
BaseDimensions.CloudTenantId,
|
|
2549
|
+
BaseDimensions.CloudOrganizationId,
|
|
2550
|
+
BaseDimensions.IsInternalUser,
|
|
2551
|
+
BaseDimensions.Environment,
|
|
2552
|
+
BaseDimensions.BaseUrl,
|
|
2553
|
+
BaseDimensions.Region,
|
|
2554
|
+
BaseDimensions.Agent,
|
|
2555
|
+
BaseDimensions.AgentVersion,
|
|
2556
|
+
BaseDimensions.ToolVersion,
|
|
2557
|
+
BaseDimensions.ExecutionContext,
|
|
2558
|
+
BaseDimensions.CiProvider,
|
|
2559
|
+
BaseDimensions.SessionIdSource,
|
|
2560
|
+
BaseDimensions.SessionId,
|
|
2561
|
+
...Object.values(CommandDimensions),
|
|
2562
|
+
...Object.values(ShipDimensions),
|
|
2563
|
+
...Object.values(ProjectDimensions)
|
|
2564
|
+
]);
|
|
2565
|
+
function lowercaseIdDimensionValues(properties) {
|
|
2566
|
+
let changed = false;
|
|
2567
|
+
const result = {
|
|
2568
|
+
...properties
|
|
2569
|
+
};
|
|
2570
|
+
for (const key of Object.keys(result)) {
|
|
2571
|
+
const value = result[key];
|
|
2572
|
+
if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
|
|
2573
|
+
continue;
|
|
2574
|
+
}
|
|
2575
|
+
const lowered = value.toLowerCase();
|
|
2576
|
+
if (lowered !== value) {
|
|
2577
|
+
result[key] = lowered;
|
|
2578
|
+
changed = true;
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
return changed ? result : properties;
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2584
|
+
// ../common/src/telemetry/project-identity.ts
|
|
2585
|
+
function projectKey(id) {
|
|
2586
|
+
if (typeof id !== "string")
|
|
2587
|
+
return;
|
|
2588
|
+
const key = id.trim().toLowerCase().replaceAll("-", "");
|
|
2589
|
+
return /^[0-9a-f]{32}$/.test(key) ? key : undefined;
|
|
2590
|
+
}
|
|
2591
|
+
function projectIdentityProperties(identity) {
|
|
2592
|
+
const key = identity.id ? projectKey(identity.id) : undefined;
|
|
2593
|
+
return {
|
|
2594
|
+
[ProjectDimensions.ProjectIdentityStatus]: identity.status === "resolved" && !key ? "invalid" : identity.status,
|
|
2595
|
+
[ProjectDimensions.ProjectType]: identity.projectType,
|
|
2596
|
+
...identity.status === "resolved" && key ? {
|
|
2597
|
+
[ProjectDimensions.ProjectKey]: key
|
|
2598
|
+
} : {}
|
|
2599
|
+
};
|
|
2600
|
+
}
|
|
2601
|
+
var PROJECT_IDENTITY_LOOKUP_BUDGET_MS = 1000;
|
|
2602
|
+
async function withinProjectIdentityBudget(work, onTimeout) {
|
|
2603
|
+
work.catch(() => {
|
|
2604
|
+
return;
|
|
2605
|
+
});
|
|
2606
|
+
let timer;
|
|
2607
|
+
const expired = new Promise((resolve) => {
|
|
2608
|
+
timer = setTimeout(() => {
|
|
2609
|
+
onTimeout?.();
|
|
2610
|
+
resolve(undefined);
|
|
2611
|
+
}, PROJECT_IDENTITY_LOOKUP_BUDGET_MS);
|
|
2612
|
+
});
|
|
2613
|
+
try {
|
|
2614
|
+
return await Promise.race([work, expired]);
|
|
2615
|
+
} finally {
|
|
2616
|
+
clearTimeout(timer);
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
2619
|
+
|
|
2387
2620
|
// ../common/src/telemetry/pseudonymize.ts
|
|
2388
2621
|
var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
|
|
2389
2622
|
var PSEUDONYM_HEX_LENGTH = 32;
|
|
@@ -2752,8 +2985,8 @@ function redactValueDetectors(value, maxLength = MAX_VALUE_LENGTH) {
|
|
|
2752
2985
|
return `${redactUrl(core)}${trailing}`;
|
|
2753
2986
|
});
|
|
2754
2987
|
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
2755
|
-
out = out.replace(UNC_PATH_PATTERN, (_match, before,
|
|
2756
|
-
const [core, trailing] = peelTrailingPunctuation(
|
|
2988
|
+
out = out.replace(UNC_PATH_PATTERN, (_match, before, path) => {
|
|
2989
|
+
const [core, trailing] = peelTrailingPunctuation(path);
|
|
2757
2990
|
return `${before}unc#${pseudonymize(core)}${trailing}`;
|
|
2758
2991
|
});
|
|
2759
2992
|
out = out.replace(EMAIL_PATTERN, (match) => `email#${pseudonymize(match)}`);
|
|
@@ -2847,6 +3080,8 @@ function redactProperty(name, value) {
|
|
|
2847
3080
|
if (isSensitiveName(name)) {
|
|
2848
3081
|
return REDACTED;
|
|
2849
3082
|
}
|
|
3083
|
+
if (GUID_KEY_DIMENSIONS.has(name))
|
|
3084
|
+
return projectKey(value);
|
|
2850
3085
|
if (typeof value === "boolean" || typeof value === "number") {
|
|
2851
3086
|
return value;
|
|
2852
3087
|
}
|
|
@@ -2921,6 +3156,63 @@ function settlePromiseLike(thenable) {
|
|
|
2921
3156
|
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
|
|
2922
3157
|
}
|
|
2923
3158
|
|
|
3159
|
+
// ../common/src/error-codes.ts
|
|
3160
|
+
var CLI_ERROR_CODES = [
|
|
3161
|
+
"invalid_argument",
|
|
3162
|
+
"authentication_required",
|
|
3163
|
+
"permission_denied",
|
|
3164
|
+
"local_permission_denied",
|
|
3165
|
+
"not_found",
|
|
3166
|
+
"rate_limited",
|
|
3167
|
+
"network_error",
|
|
3168
|
+
"timeout",
|
|
3169
|
+
"server_error",
|
|
3170
|
+
"method_not_allowed",
|
|
3171
|
+
"not_supported",
|
|
3172
|
+
"configuration_error",
|
|
3173
|
+
"execution_failed",
|
|
3174
|
+
"unknown_error"
|
|
3175
|
+
];
|
|
3176
|
+
var RETRY_HINTS = [
|
|
3177
|
+
"RetryWillNotFix",
|
|
3178
|
+
"RetryLater",
|
|
3179
|
+
"RetryAfter1Second",
|
|
3180
|
+
"RetryAfter10Seconds",
|
|
3181
|
+
"RetryAfter30Seconds",
|
|
3182
|
+
"RetryAfter60Seconds"
|
|
3183
|
+
];
|
|
3184
|
+
var CLI_ERROR_CODE_VALUES = new Set(CLI_ERROR_CODES);
|
|
3185
|
+
var RETRY_HINT_VALUES = new Set(RETRY_HINTS);
|
|
3186
|
+
function isCliErrorCode(value) {
|
|
3187
|
+
return typeof value === "string" && CLI_ERROR_CODE_VALUES.has(value);
|
|
3188
|
+
}
|
|
3189
|
+
function isRetryHint(value) {
|
|
3190
|
+
return typeof value === "string" && RETRY_HINT_VALUES.has(value);
|
|
3191
|
+
}
|
|
3192
|
+
function carriedErrorCode(error) {
|
|
3193
|
+
if (!error || typeof error !== "object")
|
|
3194
|
+
return;
|
|
3195
|
+
const code = error.errorCode;
|
|
3196
|
+
return isCliErrorCode(code) ? code : undefined;
|
|
3197
|
+
}
|
|
3198
|
+
function carriedRetry(error) {
|
|
3199
|
+
if (!error || typeof error !== "object")
|
|
3200
|
+
return;
|
|
3201
|
+
const retry = error.retry;
|
|
3202
|
+
return isRetryHint(retry) ? retry : undefined;
|
|
3203
|
+
}
|
|
3204
|
+
function defaultRetryForErrorCode(errorCode) {
|
|
3205
|
+
switch (errorCode) {
|
|
3206
|
+
case "network_error":
|
|
3207
|
+
case "rate_limited":
|
|
3208
|
+
case "server_error":
|
|
3209
|
+
case "timeout":
|
|
3210
|
+
return "RetryLater";
|
|
3211
|
+
default:
|
|
3212
|
+
return "RetryWillNotFix";
|
|
3213
|
+
}
|
|
3214
|
+
}
|
|
3215
|
+
|
|
2924
3216
|
// ../common/src/error-graph.ts
|
|
2925
3217
|
function* walkErrorGraph(error) {
|
|
2926
3218
|
const queue = [error];
|
|
@@ -2965,18 +3257,54 @@ function findHttpStatusInGraph(error) {
|
|
|
2965
3257
|
return;
|
|
2966
3258
|
}
|
|
2967
3259
|
|
|
2968
|
-
// ../common/src/
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
3260
|
+
// ../common/src/http-status.ts
|
|
3261
|
+
function classifyHttpStatus(status) {
|
|
3262
|
+
if (status === undefined)
|
|
3263
|
+
return;
|
|
3264
|
+
if (status === 400 || status === 409 || status === 413 || status === 422) {
|
|
3265
|
+
return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
|
|
3266
|
+
}
|
|
3267
|
+
if (status === 401) {
|
|
3268
|
+
return {
|
|
3269
|
+
errorCode: "authentication_required",
|
|
3270
|
+
retry: "RetryWillNotFix"
|
|
3271
|
+
};
|
|
3272
|
+
}
|
|
3273
|
+
if (status === 403) {
|
|
3274
|
+
return { errorCode: "permission_denied", retry: "RetryWillNotFix" };
|
|
3275
|
+
}
|
|
3276
|
+
if (status === 404) {
|
|
3277
|
+
return { errorCode: "not_found", retry: "RetryWillNotFix" };
|
|
3278
|
+
}
|
|
3279
|
+
if (status === 405) {
|
|
3280
|
+
return { errorCode: "method_not_allowed", retry: "RetryWillNotFix" };
|
|
3281
|
+
}
|
|
3282
|
+
if (status === 408) {
|
|
3283
|
+
return { errorCode: "timeout", retry: "RetryLater" };
|
|
3284
|
+
}
|
|
3285
|
+
if (status === 429) {
|
|
3286
|
+
return { errorCode: "rate_limited", retry: "RetryLater" };
|
|
3287
|
+
}
|
|
3288
|
+
if (status >= 500 && status < 600) {
|
|
3289
|
+
return { errorCode: "server_error", retry: "RetryLater" };
|
|
3290
|
+
}
|
|
3291
|
+
return;
|
|
3292
|
+
}
|
|
3293
|
+
|
|
3294
|
+
// ../common/src/local-permission-codes.ts
|
|
3295
|
+
var LOCAL_PERMISSION_ERROR_CODES = new Set([
|
|
3296
|
+
"EACCES",
|
|
3297
|
+
"EPERM",
|
|
3298
|
+
"EROFS"
|
|
3299
|
+
]);
|
|
3300
|
+
|
|
3301
|
+
// ../common/src/error-handler.ts
|
|
3302
|
+
var DEFAULT_401 = "Unauthorized (401). The session is missing or expired, or its token carries no scope for this API. Run `uip login status --detailed` to see the session and its scopes.";
|
|
3303
|
+
var DEFAULT_403 = "Forbidden (403). The account lacks permission for this operation, or the token carries no scope for this API. Run `uip login status --detailed` to see the token's scopes.";
|
|
2978
3304
|
var DEFAULT_405 = "Method Not Allowed (405). The endpoint may not exist or the base URL may be incorrect.";
|
|
2979
3305
|
var DEFAULT_413 = "Payload too large (413). The upload exceeded the server or CDN size limit. Reduce the package size — for example, exclude unused dependencies or remove large files from the project — and try again.";
|
|
3306
|
+
var CLOUDFLARE_BLOCK_403 = "Forbidden (403) by Cloudflare, in front of the service: the answer is a Cloudflare HTML page, not the service's JSON, so the service did not see the request and did not check the account's roles or the token's scopes. Cloudflare blocks a request when its content matches a firewall rule (text that looks like SQL or script code, for example) or when it comes from a network the firewall does not allow.";
|
|
3307
|
+
var CLOUDFLARE_BLOCK_403_INSTRUCTIONS = "If the request carries text that looks like code, change that text and try again. Otherwise send the time of the request and the Cloudflare Ray ID, when the message gives one, to the owner of the service or UiPath support.";
|
|
2980
3308
|
var HTML_RESPONSE_MESSAGE = "Received HTML instead of the expected JSON response.";
|
|
2981
3309
|
var NETWORK_ERROR_CODES = new Set([
|
|
2982
3310
|
"ECONNREFUSED",
|
|
@@ -3002,8 +3330,8 @@ var TLS_ERROR_CODES = new Set([
|
|
|
3002
3330
|
var TLS_INSTRUCTIONS = "The server's TLS certificate could not be verified. Most often a " + "corporate proxy/firewall re-signs HTTPS with a root CA that Node does " + "not trust — set NODE_EXTRA_CA_CERTS to that CA's PEM file (and HTTPS_PROXY " + "if you connect through a proxy). If the certificate is instead expired or " + "its hostname does not match, fix the endpoint URL or the system clock. " + "Then retry.";
|
|
3003
3331
|
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.";
|
|
3004
3332
|
var LOCAL_PERMISSION_MESSAGE_PATTERN = new RegExp(`\\b(${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})\\b`);
|
|
3005
|
-
function localPermissionInstructions(code,
|
|
3006
|
-
const target =
|
|
3333
|
+
function localPermissionInstructions(code, path) {
|
|
3334
|
+
const target = path !== undefined ? `'${path}'` : "a local file or resource";
|
|
3007
3335
|
if (code === "EROFS") {
|
|
3008
3336
|
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.";
|
|
3009
3337
|
}
|
|
@@ -3040,12 +3368,12 @@ function describePermissionError(error) {
|
|
|
3040
3368
|
const code = matchLocalPermissionCode(cur.code, message);
|
|
3041
3369
|
if (!code)
|
|
3042
3370
|
continue;
|
|
3043
|
-
const
|
|
3371
|
+
const path = localPermissionPath(cur.path, message);
|
|
3044
3372
|
return {
|
|
3045
3373
|
code,
|
|
3046
3374
|
message: message ?? code,
|
|
3047
|
-
...
|
|
3048
|
-
instructions: localPermissionInstructions(code,
|
|
3375
|
+
...path !== undefined ? { path } : {},
|
|
3376
|
+
instructions: localPermissionInstructions(code, path)
|
|
3049
3377
|
};
|
|
3050
3378
|
}
|
|
3051
3379
|
return;
|
|
@@ -3057,11 +3385,25 @@ function matchLocalPermissionCode(code, message) {
|
|
|
3057
3385
|
const match = message ? LOCAL_PERMISSION_MESSAGE_PATTERN.exec(message) : null;
|
|
3058
3386
|
return match ? match[1] : undefined;
|
|
3059
3387
|
}
|
|
3060
|
-
function localPermissionPath(
|
|
3061
|
-
if (typeof
|
|
3062
|
-
return
|
|
3388
|
+
function localPermissionPath(path, message) {
|
|
3389
|
+
if (typeof path === "string")
|
|
3390
|
+
return path;
|
|
3063
3391
|
return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
|
|
3064
3392
|
}
|
|
3393
|
+
function readHeader(response, name) {
|
|
3394
|
+
const headers = response?.headers;
|
|
3395
|
+
if (!headers || typeof headers !== "object")
|
|
3396
|
+
return;
|
|
3397
|
+
if (typeof headers.get === "function") {
|
|
3398
|
+
const value = headers.get(name);
|
|
3399
|
+
if (value)
|
|
3400
|
+
return value;
|
|
3401
|
+
}
|
|
3402
|
+
const plain = headers;
|
|
3403
|
+
const key = Object.keys(plain).find((k) => k.toLowerCase() === name.toLowerCase());
|
|
3404
|
+
const value = key === undefined ? undefined : plain[key];
|
|
3405
|
+
return typeof value === "string" && value !== "" ? value : undefined;
|
|
3406
|
+
}
|
|
3065
3407
|
function isHtmlDocument(body) {
|
|
3066
3408
|
return /^\s*(<!doctype html|<html\b)/i.test(body);
|
|
3067
3409
|
}
|
|
@@ -3078,36 +3420,9 @@ function retryHintForRetryAfter(seconds) {
|
|
|
3078
3420
|
return "RetryAfter60Seconds";
|
|
3079
3421
|
}
|
|
3080
3422
|
function classifyError(status, error) {
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
if (status === 401) {
|
|
3085
|
-
return {
|
|
3086
|
-
errorCode: "authentication_required",
|
|
3087
|
-
retry: "RetryWillNotFix"
|
|
3088
|
-
};
|
|
3089
|
-
}
|
|
3090
|
-
if (status === 403) {
|
|
3091
|
-
return { errorCode: "permission_denied", retry: "RetryWillNotFix" };
|
|
3092
|
-
}
|
|
3093
|
-
if (status === 404) {
|
|
3094
|
-
return { errorCode: "not_found", retry: "RetryWillNotFix" };
|
|
3095
|
-
}
|
|
3096
|
-
if (status === 405) {
|
|
3097
|
-
return { errorCode: "method_not_allowed", retry: "RetryWillNotFix" };
|
|
3098
|
-
}
|
|
3099
|
-
if (status === 413) {
|
|
3100
|
-
return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
|
|
3101
|
-
}
|
|
3102
|
-
if (status === 408) {
|
|
3103
|
-
return { errorCode: "timeout", retry: "RetryLater" };
|
|
3104
|
-
}
|
|
3105
|
-
if (status === 429) {
|
|
3106
|
-
return { errorCode: "rate_limited", retry: "RetryLater" };
|
|
3107
|
-
}
|
|
3108
|
-
if (status !== undefined && status >= 500 && status < 600) {
|
|
3109
|
-
return { errorCode: "server_error", retry: "RetryLater" };
|
|
3110
|
-
}
|
|
3423
|
+
const byStatus = classifyHttpStatus(status);
|
|
3424
|
+
if (byStatus)
|
|
3425
|
+
return byStatus;
|
|
3111
3426
|
if (status === undefined && describePermissionError(error)) {
|
|
3112
3427
|
return {
|
|
3113
3428
|
errorCode: "local_permission_denied",
|
|
@@ -3123,6 +3438,17 @@ function classifyError(status, error) {
|
|
|
3123
3438
|
}
|
|
3124
3439
|
return { errorCode: "unknown_error", retry: "RetryWillNotFix" };
|
|
3125
3440
|
}
|
|
3441
|
+
function withCarriedClass(inferred, error) {
|
|
3442
|
+
const errorCode = carriedErrorCode(error);
|
|
3443
|
+
const retry = carriedRetry(error);
|
|
3444
|
+
if (errorCode === undefined || errorCode === inferred.errorCode) {
|
|
3445
|
+
return {
|
|
3446
|
+
errorCode: inferred.errorCode,
|
|
3447
|
+
retry: retry ?? inferred.retry
|
|
3448
|
+
};
|
|
3449
|
+
}
|
|
3450
|
+
return { errorCode, retry: retry ?? defaultRetryForErrorCode(errorCode) };
|
|
3451
|
+
}
|
|
3126
3452
|
function formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus) {
|
|
3127
3453
|
if (extractedMessage) {
|
|
3128
3454
|
return `HTTP ${status}: ${extractedMessage}`;
|
|
@@ -3178,9 +3504,14 @@ async function extractErrorDetails(error, options) {
|
|
|
3178
3504
|
const classificationStatus = status ?? findHttpStatusInGraph(error);
|
|
3179
3505
|
const classification = classifyError(classificationStatus, error);
|
|
3180
3506
|
let retry = classification.retry;
|
|
3507
|
+
const htmlForbidden = status === 403 && rawBody !== undefined && isHtmlDocument(rawBody);
|
|
3508
|
+
const rayId = htmlForbidden ? readHeader(response, "cf-ray") : undefined;
|
|
3509
|
+
const cloudflareBlock = htmlForbidden && (rayId !== undefined || /\bcloudflare\b/i.test(readHeader(response, "server") ?? ""));
|
|
3181
3510
|
if (status === 401) {
|
|
3182
3511
|
message = DEFAULT_401;
|
|
3183
3512
|
result = "AuthenticationError";
|
|
3513
|
+
} else if (cloudflareBlock) {
|
|
3514
|
+
message = rayId ? `${CLOUDFLARE_BLOCK_403} Cloudflare Ray ID: ${rayId}.` : CLOUDFLARE_BLOCK_403;
|
|
3184
3515
|
} else if (status === 403) {
|
|
3185
3516
|
message = options?.forbiddenMessage ?? DEFAULT_403;
|
|
3186
3517
|
result = "AuthenticationError";
|
|
@@ -3228,7 +3559,9 @@ async function extractErrorDetails(error, options) {
|
|
|
3228
3559
|
}
|
|
3229
3560
|
}
|
|
3230
3561
|
let details = rawMessage;
|
|
3231
|
-
if (
|
|
3562
|
+
if (htmlForbidden) {
|
|
3563
|
+
details = cloudflareBlock ? CLOUDFLARE_BLOCK_403_INSTRUCTIONS : HTML_RESPONSE_MESSAGE;
|
|
3564
|
+
} else if (rawBody) {
|
|
3232
3565
|
if (parsedBody) {
|
|
3233
3566
|
const extra = {};
|
|
3234
3567
|
if (parsedBody.errorCode)
|
|
@@ -3262,6 +3595,8 @@ async function extractErrorDetails(error, options) {
|
|
|
3262
3595
|
}
|
|
3263
3596
|
if (parsedBody?.requestId && typeof parsedBody.requestId === "string") {
|
|
3264
3597
|
context.requestId = parsedBody.requestId;
|
|
3598
|
+
} else if (cloudflareBlock && rayId) {
|
|
3599
|
+
context.requestId = rayId;
|
|
3265
3600
|
}
|
|
3266
3601
|
if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
|
|
3267
3602
|
context.traceId = parsedBody.traceId;
|
|
@@ -3270,16 +3605,7 @@ async function extractErrorDetails(error, options) {
|
|
|
3270
3605
|
context.path = permission.path;
|
|
3271
3606
|
}
|
|
3272
3607
|
if (status === 429) {
|
|
3273
|
-
const
|
|
3274
|
-
const headersObj = resp?.headers;
|
|
3275
|
-
let retryAfterValue;
|
|
3276
|
-
if (headersObj && typeof headersObj === "object" && typeof headersObj.get === "function") {
|
|
3277
|
-
retryAfterValue = headersObj.get("retry-after") ?? undefined;
|
|
3278
|
-
}
|
|
3279
|
-
if (!retryAfterValue && headersObj && typeof headersObj === "object") {
|
|
3280
|
-
const headers = headersObj;
|
|
3281
|
-
retryAfterValue = headers["retry-after"] ?? headers["Retry-After"];
|
|
3282
|
-
}
|
|
3608
|
+
const retryAfterValue = readHeader(response, "retry-after");
|
|
3283
3609
|
if (retryAfterValue) {
|
|
3284
3610
|
const seconds = Number(retryAfterValue);
|
|
3285
3611
|
if (!Number.isNaN(seconds)) {
|
|
@@ -3313,18 +3639,98 @@ async function extractErrorDetails(error, options) {
|
|
|
3313
3639
|
}
|
|
3314
3640
|
return {
|
|
3315
3641
|
result,
|
|
3316
|
-
errorCode: classification.errorCode,
|
|
3642
|
+
...withCarriedClass({ errorCode: classification.errorCode, retry }, error),
|
|
3317
3643
|
message,
|
|
3318
|
-
retry,
|
|
3319
3644
|
details,
|
|
3320
3645
|
...hasContext ? { context } : {},
|
|
3321
3646
|
...parsedErrors ? { parsedErrors } : {}
|
|
3322
3647
|
};
|
|
3323
3648
|
}
|
|
3324
|
-
// ../common/src/
|
|
3325
|
-
|
|
3326
|
-
|
|
3649
|
+
// ../common/src/result-types.ts
|
|
3650
|
+
var RESULTS = {
|
|
3651
|
+
Success: "Success",
|
|
3652
|
+
Failure: "Failure",
|
|
3653
|
+
ConfigError: "ConfigError",
|
|
3654
|
+
AuthenticationError: "AuthenticationError",
|
|
3655
|
+
ValidationError: "ValidationError",
|
|
3656
|
+
TimeoutError: "TimeoutError"
|
|
3657
|
+
};
|
|
3658
|
+
// ../../node_modules/commander/index.js
|
|
3659
|
+
var exports_commander = {};
|
|
3660
|
+
__exportCjs(exports_commander, {
|
|
3661
|
+
program: () => $program,
|
|
3662
|
+
createCommand: () => $createCommand,
|
|
3663
|
+
createOption: () => $createOption,
|
|
3664
|
+
createArgument: () => $createArgument,
|
|
3665
|
+
Command: () => $Command,
|
|
3666
|
+
Option: () => $Option,
|
|
3667
|
+
Argument: () => $Argument,
|
|
3668
|
+
Help: () => $Help,
|
|
3669
|
+
CommanderError: () => $CommanderError,
|
|
3670
|
+
InvalidArgumentError: () => $InvalidArgumentError,
|
|
3671
|
+
InvalidOptionArgumentError: () => $InvalidOptionArgumentError
|
|
3672
|
+
}, {
|
|
3673
|
+
program: (value) => $program = value,
|
|
3674
|
+
createCommand: (value) => $createCommand = value,
|
|
3675
|
+
createOption: (value) => $createOption = value,
|
|
3676
|
+
createArgument: (value) => $createArgument = value,
|
|
3677
|
+
Command: (value) => $Command = value,
|
|
3678
|
+
Option: (value) => $Option = value,
|
|
3679
|
+
Argument: (value) => $Argument = value,
|
|
3680
|
+
Help: (value) => $Help = value,
|
|
3681
|
+
CommanderError: (value) => $CommanderError = value,
|
|
3682
|
+
InvalidArgumentError: (value) => $InvalidArgumentError = value,
|
|
3683
|
+
InvalidOptionArgumentError: (value) => $InvalidOptionArgumentError = value
|
|
3684
|
+
});
|
|
3685
|
+
var { Argument } = require_argument();
|
|
3686
|
+
var { Command: Command2 } = require_command();
|
|
3687
|
+
var { CommanderError, InvalidArgumentError } = require_error();
|
|
3688
|
+
var { Help } = require_help();
|
|
3689
|
+
var { Option } = require_option();
|
|
3690
|
+
var $program = new Command2;
|
|
3691
|
+
var $createCommand = (name) => new Command2(name);
|
|
3692
|
+
var $createOption = (flags, description) => new Option(flags, description);
|
|
3693
|
+
var $createArgument = (name, description) => new Argument(name, description);
|
|
3694
|
+
var $Command = Command2;
|
|
3695
|
+
var $Option = Option;
|
|
3696
|
+
var $Argument = Argument;
|
|
3697
|
+
var $Help = Help;
|
|
3698
|
+
var $CommanderError = CommanderError;
|
|
3699
|
+
var $InvalidArgumentError = InvalidArgumentError;
|
|
3700
|
+
var $InvalidOptionArgumentError = InvalidArgumentError;
|
|
3701
|
+
|
|
3702
|
+
// ../../node_modules/commander/esm.mjs
|
|
3703
|
+
var {
|
|
3704
|
+
program,
|
|
3705
|
+
createCommand,
|
|
3706
|
+
createArgument,
|
|
3707
|
+
createOption,
|
|
3708
|
+
CommanderError: CommanderError2,
|
|
3709
|
+
InvalidArgumentError: InvalidArgumentError2,
|
|
3710
|
+
InvalidOptionArgumentError,
|
|
3711
|
+
Command,
|
|
3712
|
+
Argument: Argument2,
|
|
3713
|
+
Option: Option2,
|
|
3714
|
+
Help: Help2
|
|
3715
|
+
} = exports_commander;
|
|
3716
|
+
|
|
3717
|
+
// ../common/src/command-examples.ts
|
|
3718
|
+
var examplesByCommand = new WeakMap;
|
|
3719
|
+
Command.prototype.examples = function(examples) {
|
|
3720
|
+
examplesByCommand.set(this, examples);
|
|
3721
|
+
return this;
|
|
3722
|
+
};
|
|
3723
|
+
// ../common/src/preview.ts
|
|
3724
|
+
var previewSlot = singleton("PreviewBuild");
|
|
3725
|
+
function isPreviewBuild() {
|
|
3726
|
+
return previewSlot.get(false) ?? false;
|
|
3327
3727
|
}
|
|
3728
|
+
Command.prototype.previewCommand = function(nameAndArgs, opts) {
|
|
3729
|
+
if (isPreviewBuild()) {
|
|
3730
|
+
return this.command(nameAndArgs, opts);
|
|
3731
|
+
}
|
|
3732
|
+
return new Command(nameAndArgs.split(/\s+/)[0] ?? nameAndArgs);
|
|
3733
|
+
};
|
|
3328
3734
|
|
|
3329
3735
|
// ../common/src/output-context.ts
|
|
3330
3736
|
function createStorage() {
|
|
@@ -3359,8 +3765,8 @@ function getOutputSink() {
|
|
|
3359
3765
|
|
|
3360
3766
|
// ../common/src/logger.ts
|
|
3361
3767
|
var logFilePathSlot = singleton("logFilePath");
|
|
3362
|
-
function setGlobalLogFilePath(
|
|
3363
|
-
logFilePathSlot.set(
|
|
3768
|
+
function setGlobalLogFilePath(path) {
|
|
3769
|
+
logFilePathSlot.set(path);
|
|
3364
3770
|
}
|
|
3365
3771
|
function getGlobalLogFilePath() {
|
|
3366
3772
|
return logFilePathSlot.get("");
|
|
@@ -3428,14 +3834,14 @@ class SimpleLogger {
|
|
|
3428
3834
|
return this.fileLoggingEnabled || !!getGlobalLogFilePath();
|
|
3429
3835
|
}
|
|
3430
3836
|
writeToFile(formatted) {
|
|
3431
|
-
const
|
|
3432
|
-
if (!
|
|
3837
|
+
const path = this.logFilePath || getGlobalLogFilePath();
|
|
3838
|
+
if (!path)
|
|
3433
3839
|
return;
|
|
3434
3840
|
const timestamp = new Date().toISOString();
|
|
3435
3841
|
this.pendingWrites = Promise.all([
|
|
3436
3842
|
this.pendingWrites,
|
|
3437
3843
|
this.pendingInit
|
|
3438
|
-
]).then(() => getFileSystem().appendFile(
|
|
3844
|
+
]).then(() => getFileSystem().appendFile(path, `${timestamp} ${formatted}`).catch(() => {}));
|
|
3439
3845
|
}
|
|
3440
3846
|
write(formatted) {
|
|
3441
3847
|
if (this.isFileLoggingActive()) {
|
|
@@ -3485,17 +3891,17 @@ class SimpleLogger {
|
|
|
3485
3891
|
setGlobalLogFilePath("");
|
|
3486
3892
|
}
|
|
3487
3893
|
}
|
|
3488
|
-
setLogFile(
|
|
3489
|
-
this.logFilePath =
|
|
3490
|
-
setGlobalLogFilePath(
|
|
3491
|
-
if (!
|
|
3894
|
+
setLogFile(path) {
|
|
3895
|
+
this.logFilePath = path;
|
|
3896
|
+
setGlobalLogFilePath(path);
|
|
3897
|
+
if (!path)
|
|
3492
3898
|
return;
|
|
3493
3899
|
this.fileLoggingEnabled = true;
|
|
3494
|
-
const
|
|
3900
|
+
const fs = getFileSystem();
|
|
3495
3901
|
this.pendingInit = (async () => {
|
|
3496
3902
|
const [error] = await catchError((async () => {
|
|
3497
|
-
await
|
|
3498
|
-
await
|
|
3903
|
+
await fs.mkdir(fs.path.dirname(path));
|
|
3904
|
+
await fs.writeFile(path, "");
|
|
3499
3905
|
})());
|
|
3500
3906
|
if (error)
|
|
3501
3907
|
this.fileLoggingEnabled = false;
|
|
@@ -3543,18 +3949,111 @@ function getLogFilePath() {
|
|
|
3543
3949
|
return logger.getLogFilePath();
|
|
3544
3950
|
}
|
|
3545
3951
|
|
|
3952
|
+
// ../common/src/timings.ts
|
|
3953
|
+
var TIMINGS_ENV_VAR = "UIP_TIMINGS";
|
|
3954
|
+
function createStorage2() {
|
|
3955
|
+
const [error, mod] = catchError(() => __require("node:async_hooks"));
|
|
3956
|
+
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
3957
|
+
return {
|
|
3958
|
+
getStore: () => {
|
|
3959
|
+
return;
|
|
3960
|
+
},
|
|
3961
|
+
run: (_store, fn) => fn()
|
|
3962
|
+
};
|
|
3963
|
+
}
|
|
3964
|
+
return new mod.AsyncLocalStorage;
|
|
3965
|
+
}
|
|
3966
|
+
var storageSlot = singleton("TimingStorage");
|
|
3967
|
+
var stateSlot = singleton("Timings");
|
|
3968
|
+
var rootStartedSlot = singleton("TimingsRootStarted");
|
|
3969
|
+
var longLivedHostSlot = singleton("TimingsLongLivedHost");
|
|
3970
|
+
var storage = storageSlot.getOrInit(createStorage2, (value) => ("getStore" in value));
|
|
3971
|
+
function newState(baseline) {
|
|
3972
|
+
return { baseline, httpMs: 0, httpCalls: 0 };
|
|
3973
|
+
}
|
|
3974
|
+
function getState() {
|
|
3975
|
+
const scoped = storage.getStore();
|
|
3976
|
+
if (scoped) {
|
|
3977
|
+
return scoped;
|
|
3978
|
+
}
|
|
3979
|
+
const pinned = livePinnedState();
|
|
3980
|
+
if (pinned !== undefined) {
|
|
3981
|
+
return pinned;
|
|
3982
|
+
}
|
|
3983
|
+
return newState(processStartIsInvocationStart() ? 0 : performance.now());
|
|
3984
|
+
}
|
|
3985
|
+
function livePinnedState() {
|
|
3986
|
+
const pinned = stateSlot.get();
|
|
3987
|
+
return pinned !== undefined && "httpCalls" in pinned && !pinned.finished ? pinned : undefined;
|
|
3988
|
+
}
|
|
3989
|
+
function processStartIsInvocationStart() {
|
|
3990
|
+
return !rootStartedSlot.get(false) && !longLivedHostSlot.get(false);
|
|
3991
|
+
}
|
|
3992
|
+
function timingsEnabled() {
|
|
3993
|
+
if (typeof process === "undefined") {
|
|
3994
|
+
return false;
|
|
3995
|
+
}
|
|
3996
|
+
const value = process.env?.[TIMINGS_ENV_VAR];
|
|
3997
|
+
if (value === undefined) {
|
|
3998
|
+
return false;
|
|
3999
|
+
}
|
|
4000
|
+
const normalized = value.trim().toLowerCase();
|
|
4001
|
+
return normalized === "1" || normalized === "true";
|
|
4002
|
+
}
|
|
4003
|
+
function recordExitCode(exitCode) {
|
|
4004
|
+
if (!timingsEnabled()) {
|
|
4005
|
+
return;
|
|
4006
|
+
}
|
|
4007
|
+
getState().exitCode = exitCode;
|
|
4008
|
+
}
|
|
4009
|
+
function invocationStartedAt() {
|
|
4010
|
+
return new Date(performance.timeOrigin + getState().baseline);
|
|
4011
|
+
}
|
|
4012
|
+
function invocationElapsedMs() {
|
|
4013
|
+
return performance.now() - getState().baseline;
|
|
4014
|
+
}
|
|
4015
|
+
function markCommandStart() {
|
|
4016
|
+
if (!timingsEnabled()) {
|
|
4017
|
+
return;
|
|
4018
|
+
}
|
|
4019
|
+
getState().commandStart = performance.now();
|
|
4020
|
+
}
|
|
4021
|
+
function recordCommandDuration(durationMs) {
|
|
4022
|
+
if (!timingsEnabled()) {
|
|
4023
|
+
return;
|
|
4024
|
+
}
|
|
4025
|
+
getState().commandMs = durationMs;
|
|
4026
|
+
}
|
|
4027
|
+
|
|
4028
|
+
// ../common/src/exit-code.ts
|
|
4029
|
+
function setExitCode(code) {
|
|
4030
|
+
process.exitCode = code;
|
|
4031
|
+
recordExitCode(code);
|
|
4032
|
+
}
|
|
4033
|
+
var GENERIC_FAILURE_EXIT_CODE = 1;
|
|
4034
|
+
function recordCommandExit(code) {
|
|
4035
|
+
if (code === GENERIC_FAILURE_EXIT_CODE && getExitCode() !== 0) {
|
|
4036
|
+
return;
|
|
4037
|
+
}
|
|
4038
|
+
setExitCode(code);
|
|
4039
|
+
}
|
|
4040
|
+
function getExitCode() {
|
|
4041
|
+
const code = process.exitCode;
|
|
4042
|
+
return typeof code === "number" ? code : 0;
|
|
4043
|
+
}
|
|
4044
|
+
|
|
3546
4045
|
// ../common/src/output-codecs.ts
|
|
3547
4046
|
var yamlSlot = singleton("YamlCodec");
|
|
3548
4047
|
var jmespathSlot = singleton("JmespathCodec");
|
|
3549
4048
|
async function loadOutputCodecsAsync(needed) {
|
|
3550
4049
|
const loads = [];
|
|
3551
4050
|
if (needed.yaml && yamlSlot.get() === undefined) {
|
|
3552
|
-
loads.push(import("./js-yaml-
|
|
4051
|
+
loads.push(import("./js-yaml-a2bk27p6.js").then((mod) => {
|
|
3553
4052
|
yamlSlot.set(mod);
|
|
3554
4053
|
}));
|
|
3555
4054
|
}
|
|
3556
4055
|
if (needed.filter && jmespathSlot.get() === undefined) {
|
|
3557
|
-
loads.push(import("./jmespath-
|
|
4056
|
+
loads.push(import("./jmespath-ab6tdc42.js").then((m)=>__toESM(m.default,1)).then((mod) => {
|
|
3558
4057
|
jmespathSlot.set(mod);
|
|
3559
4058
|
}));
|
|
3560
4059
|
}
|
|
@@ -3579,155 +4078,6 @@ function getOutputFilter() {
|
|
|
3579
4078
|
return filterSlot.get();
|
|
3580
4079
|
}
|
|
3581
4080
|
|
|
3582
|
-
// ../common/src/telemetry/telemetry-dimensions.ts
|
|
3583
|
-
var BaseDimensions = {
|
|
3584
|
-
ApplicationName: "ApplicationName",
|
|
3585
|
-
ProductVersion: "ProductVersion",
|
|
3586
|
-
InstallationId: "InstallationId",
|
|
3587
|
-
CloudUserId: "CloudUserId",
|
|
3588
|
-
CloudTenantId: "CloudTenantId",
|
|
3589
|
-
CloudOrganizationId: "CloudOrganizationId",
|
|
3590
|
-
IsInternalUser: "IsInternalUser",
|
|
3591
|
-
Environment: "Environment",
|
|
3592
|
-
BaseUrl: "BaseUrl",
|
|
3593
|
-
Region: "Region",
|
|
3594
|
-
Agent: "Agent",
|
|
3595
|
-
AgentVersion: "AgentVersion",
|
|
3596
|
-
AgentModel: "AgentModel",
|
|
3597
|
-
ToolName: "ToolName",
|
|
3598
|
-
ToolVersion: "ToolVersion",
|
|
3599
|
-
ExecutionContext: "ExecutionContext",
|
|
3600
|
-
CiProvider: "CiProvider",
|
|
3601
|
-
SessionIdSource: "SessionIdSource",
|
|
3602
|
-
SessionId: "SessionId"
|
|
3603
|
-
};
|
|
3604
|
-
var CommandDimensions = {
|
|
3605
|
-
IsCommand: "IsCommand",
|
|
3606
|
-
IsReexec: "IsReexec",
|
|
3607
|
-
CommandName: "CommandName",
|
|
3608
|
-
ExitCode: "ExitCode",
|
|
3609
|
-
TerminalOutcome: "TerminalOutcome",
|
|
3610
|
-
ErrorClass: "ErrorClass",
|
|
3611
|
-
TerminalSignal: "TerminalSignal",
|
|
3612
|
-
ErrorMessage: "ErrorMessage",
|
|
3613
|
-
SkillName: "SkillName",
|
|
3614
|
-
ProductArea: "ProductArea",
|
|
3615
|
-
Mode: "Mode"
|
|
3616
|
-
};
|
|
3617
|
-
var ShipDimensions = {
|
|
3618
|
-
ShipKind: "ShipKind",
|
|
3619
|
-
Target: "Target",
|
|
3620
|
-
ProjectType: "ProjectType",
|
|
3621
|
-
ProjectTypes: "ProjectTypes",
|
|
3622
|
-
ArtifactCorrelationKey: "ArtifactCorrelationKey",
|
|
3623
|
-
PackageName: "PackageName",
|
|
3624
|
-
PackageVersion: "PackageVersion",
|
|
3625
|
-
PackageVersionKey: "PackageVersionKey",
|
|
3626
|
-
DeploymentKey: "DeploymentKey",
|
|
3627
|
-
SolutionId: "SolutionId",
|
|
3628
|
-
FolderKey: "FolderKey",
|
|
3629
|
-
FeedId: "FeedId"
|
|
3630
|
-
};
|
|
3631
|
-
var ErrorDimensions = {
|
|
3632
|
-
Result: "Result",
|
|
3633
|
-
ErrorCode: "ErrorCode",
|
|
3634
|
-
Retry: "Retry",
|
|
3635
|
-
ErrorMessage: "ErrorMessage",
|
|
3636
|
-
HttpStatus: "HttpStatus",
|
|
3637
|
-
UpstreamErrorCode: "UpstreamErrorCode"
|
|
3638
|
-
};
|
|
3639
|
-
var AuthDimensions = {
|
|
3640
|
-
AuthenticationMethod: "AuthenticationMethod",
|
|
3641
|
-
Success: "Success",
|
|
3642
|
-
Reason: "Reason"
|
|
3643
|
-
};
|
|
3644
|
-
var SkillsDimensions = {
|
|
3645
|
-
SchemaVersion: "SchemaVersion",
|
|
3646
|
-
AgentType: "AgentType",
|
|
3647
|
-
SkillsVersion: "SkillsVersion",
|
|
3648
|
-
UipSubcommand: "UipSubcommand",
|
|
3649
|
-
FileExtension: "FileExtension",
|
|
3650
|
-
SubagentModel: "SubagentModel",
|
|
3651
|
-
SubagentType: "SubagentType",
|
|
3652
|
-
PermissionMode: "PermissionMode",
|
|
3653
|
-
EffortLevel: "EffortLevel",
|
|
3654
|
-
SessionSource: "SessionSource",
|
|
3655
|
-
Outcome: "Outcome",
|
|
3656
|
-
DurationMs: "DurationMs",
|
|
3657
|
-
Source: "Source"
|
|
3658
|
-
};
|
|
3659
|
-
var PackagerDimensions = {
|
|
3660
|
-
ProjectId: "ProjectId",
|
|
3661
|
-
ProjectType: "ProjectType",
|
|
3662
|
-
SolutionId: "SolutionId"
|
|
3663
|
-
};
|
|
3664
|
-
var ScopeDimensions = {
|
|
3665
|
-
FolderId: "FolderId"
|
|
3666
|
-
};
|
|
3667
|
-
var ID_DIMENSIONS = new Set([
|
|
3668
|
-
BaseDimensions.CloudUserId,
|
|
3669
|
-
BaseDimensions.CloudTenantId,
|
|
3670
|
-
BaseDimensions.CloudOrganizationId,
|
|
3671
|
-
BaseDimensions.InstallationId,
|
|
3672
|
-
ShipDimensions.ArtifactCorrelationKey,
|
|
3673
|
-
ShipDimensions.PackageVersionKey,
|
|
3674
|
-
ShipDimensions.DeploymentKey,
|
|
3675
|
-
ShipDimensions.SolutionId,
|
|
3676
|
-
ShipDimensions.FolderKey,
|
|
3677
|
-
ShipDimensions.FeedId,
|
|
3678
|
-
PackagerDimensions.ProjectId
|
|
3679
|
-
]);
|
|
3680
|
-
var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
|
|
3681
|
-
var RESERVED_DIMENSION_NAMES = new Set([
|
|
3682
|
-
...Object.values(BaseDimensions),
|
|
3683
|
-
...Object.values(CommandDimensions),
|
|
3684
|
-
...Object.values(ShipDimensions),
|
|
3685
|
-
...Object.values(ErrorDimensions),
|
|
3686
|
-
...Object.values(AuthDimensions),
|
|
3687
|
-
...Object.values(SkillsDimensions),
|
|
3688
|
-
...Object.values(PackagerDimensions),
|
|
3689
|
-
...Object.values(ScopeDimensions)
|
|
3690
|
-
]);
|
|
3691
|
-
var CURATED_DIMENSIONS = new Set([
|
|
3692
|
-
BaseDimensions.ApplicationName,
|
|
3693
|
-
BaseDimensions.ProductVersion,
|
|
3694
|
-
BaseDimensions.InstallationId,
|
|
3695
|
-
BaseDimensions.CloudUserId,
|
|
3696
|
-
BaseDimensions.CloudTenantId,
|
|
3697
|
-
BaseDimensions.CloudOrganizationId,
|
|
3698
|
-
BaseDimensions.IsInternalUser,
|
|
3699
|
-
BaseDimensions.Environment,
|
|
3700
|
-
BaseDimensions.BaseUrl,
|
|
3701
|
-
BaseDimensions.Region,
|
|
3702
|
-
BaseDimensions.Agent,
|
|
3703
|
-
BaseDimensions.AgentVersion,
|
|
3704
|
-
BaseDimensions.ToolVersion,
|
|
3705
|
-
BaseDimensions.ExecutionContext,
|
|
3706
|
-
BaseDimensions.CiProvider,
|
|
3707
|
-
BaseDimensions.SessionIdSource,
|
|
3708
|
-
BaseDimensions.SessionId,
|
|
3709
|
-
...Object.values(CommandDimensions),
|
|
3710
|
-
...Object.values(ShipDimensions)
|
|
3711
|
-
]);
|
|
3712
|
-
function lowercaseIdDimensionValues(properties) {
|
|
3713
|
-
let changed = false;
|
|
3714
|
-
const result = {
|
|
3715
|
-
...properties
|
|
3716
|
-
};
|
|
3717
|
-
for (const key of Object.keys(result)) {
|
|
3718
|
-
const value = result[key];
|
|
3719
|
-
if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
|
|
3720
|
-
continue;
|
|
3721
|
-
}
|
|
3722
|
-
const lowered = value.toLowerCase();
|
|
3723
|
-
if (lowered !== value) {
|
|
3724
|
-
result[key] = lowered;
|
|
3725
|
-
changed = true;
|
|
3726
|
-
}
|
|
3727
|
-
}
|
|
3728
|
-
return changed ? result : properties;
|
|
3729
|
-
}
|
|
3730
|
-
|
|
3731
4081
|
// ../common/src/telemetry/command-terminal.ts
|
|
3732
4082
|
var recordedFailureSlot = singleton("CommandTelemetryFailure");
|
|
3733
4083
|
var AUTH_ERROR_CODES = new Set([
|
|
@@ -3846,17 +4196,8 @@ function terminalSignalFor(input, outcome) {
|
|
|
3846
4196
|
}
|
|
3847
4197
|
return outcome === "cancelled" ? "SIGINT" : undefined;
|
|
3848
4198
|
}
|
|
3849
|
-
function
|
|
3850
|
-
|
|
3851
|
-
return "auth";
|
|
3852
|
-
}
|
|
3853
|
-
if (status === 400 || status === 409 || status === 422) {
|
|
3854
|
-
return "validation";
|
|
3855
|
-
}
|
|
3856
|
-
if (status === 408) {
|
|
3857
|
-
return "timeout";
|
|
3858
|
-
}
|
|
3859
|
-
return "network_http";
|
|
4199
|
+
function classifyFailingHttpStatus(status) {
|
|
4200
|
+
return classifyFromErrorCode(classifyHttpStatus(status)?.errorCode) ?? "network_http";
|
|
3860
4201
|
}
|
|
3861
4202
|
function classifyFromResult(result) {
|
|
3862
4203
|
switch (result) {
|
|
@@ -3936,7 +4277,7 @@ function classifyError2(input) {
|
|
|
3936
4277
|
}
|
|
3937
4278
|
const status = recorded?.context?.httpStatus ?? findHttpStatusInGraph(input.error);
|
|
3938
4279
|
if (status !== undefined) {
|
|
3939
|
-
return
|
|
4280
|
+
return classifyFailingHttpStatus(status);
|
|
3940
4281
|
}
|
|
3941
4282
|
return classifyFromResult(recorded?.result) ?? classifyFromErrorCode(recorded?.errorCode) ?? classifyFromError(input.error) ?? "unknown";
|
|
3942
4283
|
}
|
|
@@ -3968,6 +4309,7 @@ function buildCommandTerminalTelemetryProperties(input) {
|
|
|
3968
4309
|
var CommonTelemetryEvents = {
|
|
3969
4310
|
Start: "Application.Start",
|
|
3970
4311
|
Error: "Application.Error",
|
|
4312
|
+
ProjectActivity: "Cli.ProjectActivity",
|
|
3971
4313
|
ShipSucceeded: "Cli.ShipSucceeded"
|
|
3972
4314
|
};
|
|
3973
4315
|
|
|
@@ -4450,115 +4792,40 @@ class TelemetryService {
|
|
|
4450
4792
|
}
|
|
4451
4793
|
spanFor(name, durationMs, success, properties, context) {
|
|
4452
4794
|
return {
|
|
4453
|
-
name: redactSpanName(name),
|
|
4454
|
-
durationMs,
|
|
4455
|
-
success,
|
|
4456
|
-
properties: this.enrichProperties(properties),
|
|
4457
|
-
operationId: context.operationId,
|
|
4458
|
-
...context.parentId !== undefined ? { parentId: context.parentId } : {},
|
|
4459
|
-
id: context.id,
|
|
4460
|
-
...context.startedAt !== undefined ? { startedAt: context.startedAt } : {}
|
|
4461
|
-
};
|
|
4462
|
-
}
|
|
4463
|
-
enrichProperties(properties) {
|
|
4464
|
-
const globalProperties = getGlobalTelemetryProperties();
|
|
4465
|
-
const enriched = {
|
|
4466
|
-
...getExecutionContextTelemetryProperties(),
|
|
4467
|
-
...globalProperties,
|
|
4468
|
-
...this.defaultProperties,
|
|
4469
|
-
...redactProperties(properties ?? {}),
|
|
4470
|
-
[TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
|
|
4471
|
-
[BaseDimensions.SessionId]: this.telemetryProvider.getSessionId?.() ?? getTelemetrySessionId()
|
|
4472
|
-
};
|
|
4473
|
-
return lowercaseIdDimensionValues(enriched);
|
|
4474
|
-
}
|
|
4475
|
-
generateId() {
|
|
4476
|
-
const bytes = new Uint8Array(8);
|
|
4477
|
-
let hex = "";
|
|
4478
|
-
do {
|
|
4479
|
-
crypto.getRandomValues(bytes);
|
|
4480
|
-
hex = "";
|
|
4481
|
-
for (const byte of bytes) {
|
|
4482
|
-
hex += byte.toString(16).padStart(2, "0");
|
|
4483
|
-
}
|
|
4484
|
-
} while (/^0+$/.test(hex));
|
|
4485
|
-
return hex;
|
|
4486
|
-
}
|
|
4487
|
-
}
|
|
4488
|
-
// ../common/src/timings.ts
|
|
4489
|
-
var TIMINGS_ENV_VAR = "UIP_TIMINGS";
|
|
4490
|
-
function createStorage2() {
|
|
4491
|
-
const [error, mod] = catchError(() => __require("node:async_hooks"));
|
|
4492
|
-
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
4493
|
-
return {
|
|
4494
|
-
getStore: () => {
|
|
4495
|
-
return;
|
|
4496
|
-
},
|
|
4497
|
-
run: (_store, fn) => fn()
|
|
4498
|
-
};
|
|
4499
|
-
}
|
|
4500
|
-
return new mod.AsyncLocalStorage;
|
|
4501
|
-
}
|
|
4502
|
-
var storageSlot = singleton("TimingStorage");
|
|
4503
|
-
var stateSlot = singleton("Timings");
|
|
4504
|
-
var rootStartedSlot = singleton("TimingsRootStarted");
|
|
4505
|
-
var longLivedHostSlot = singleton("TimingsLongLivedHost");
|
|
4506
|
-
var storage = storageSlot.getOrInit(createStorage2, (value) => ("getStore" in value));
|
|
4507
|
-
function newState(baseline) {
|
|
4508
|
-
return { baseline, httpMs: 0, httpCalls: 0 };
|
|
4509
|
-
}
|
|
4510
|
-
function getState() {
|
|
4511
|
-
const scoped = storage.getStore();
|
|
4512
|
-
if (scoped) {
|
|
4513
|
-
return scoped;
|
|
4514
|
-
}
|
|
4515
|
-
const pinned = livePinnedState();
|
|
4516
|
-
if (pinned !== undefined) {
|
|
4517
|
-
return pinned;
|
|
4518
|
-
}
|
|
4519
|
-
return newState(processStartIsInvocationStart() ? 0 : performance.now());
|
|
4520
|
-
}
|
|
4521
|
-
function livePinnedState() {
|
|
4522
|
-
const pinned = stateSlot.get();
|
|
4523
|
-
return pinned !== undefined && "httpCalls" in pinned && !pinned.finished ? pinned : undefined;
|
|
4524
|
-
}
|
|
4525
|
-
function processStartIsInvocationStart() {
|
|
4526
|
-
return !rootStartedSlot.get(false) && !longLivedHostSlot.get(false);
|
|
4527
|
-
}
|
|
4528
|
-
function timingsEnabled() {
|
|
4529
|
-
if (typeof process === "undefined") {
|
|
4530
|
-
return false;
|
|
4531
|
-
}
|
|
4532
|
-
const value = process.env?.[TIMINGS_ENV_VAR];
|
|
4533
|
-
if (value === undefined) {
|
|
4534
|
-
return false;
|
|
4535
|
-
}
|
|
4536
|
-
const normalized = value.trim().toLowerCase();
|
|
4537
|
-
return normalized === "1" || normalized === "true";
|
|
4538
|
-
}
|
|
4539
|
-
function recordExitCode(exitCode) {
|
|
4540
|
-
if (!timingsEnabled()) {
|
|
4541
|
-
return;
|
|
4542
|
-
}
|
|
4543
|
-
getState().exitCode = exitCode;
|
|
4544
|
-
}
|
|
4545
|
-
function invocationStartedAt() {
|
|
4546
|
-
return new Date(performance.timeOrigin + getState().baseline);
|
|
4547
|
-
}
|
|
4548
|
-
function invocationElapsedMs() {
|
|
4549
|
-
return performance.now() - getState().baseline;
|
|
4550
|
-
}
|
|
4551
|
-
function markCommandStart() {
|
|
4552
|
-
if (!timingsEnabled()) {
|
|
4553
|
-
return;
|
|
4795
|
+
name: redactSpanName(name),
|
|
4796
|
+
durationMs,
|
|
4797
|
+
success,
|
|
4798
|
+
properties: this.enrichProperties(properties),
|
|
4799
|
+
operationId: context.operationId,
|
|
4800
|
+
...context.parentId !== undefined ? { parentId: context.parentId } : {},
|
|
4801
|
+
id: context.id,
|
|
4802
|
+
...context.startedAt !== undefined ? { startedAt: context.startedAt } : {}
|
|
4803
|
+
};
|
|
4554
4804
|
}
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4805
|
+
enrichProperties(properties) {
|
|
4806
|
+
const globalProperties = getGlobalTelemetryProperties();
|
|
4807
|
+
const enriched = {
|
|
4808
|
+
...getExecutionContextTelemetryProperties(),
|
|
4809
|
+
...globalProperties,
|
|
4810
|
+
...this.defaultProperties,
|
|
4811
|
+
...redactProperties(properties ?? {}),
|
|
4812
|
+
[TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
|
|
4813
|
+
[BaseDimensions.SessionId]: this.telemetryProvider.getSessionId?.() ?? getTelemetrySessionId()
|
|
4814
|
+
};
|
|
4815
|
+
return lowercaseIdDimensionValues(enriched);
|
|
4816
|
+
}
|
|
4817
|
+
generateId() {
|
|
4818
|
+
const bytes = new Uint8Array(8);
|
|
4819
|
+
let hex = "";
|
|
4820
|
+
do {
|
|
4821
|
+
crypto.getRandomValues(bytes);
|
|
4822
|
+
hex = "";
|
|
4823
|
+
for (const byte of bytes) {
|
|
4824
|
+
hex += byte.toString(16).padStart(2, "0");
|
|
4825
|
+
}
|
|
4826
|
+
} while (/^0+$/.test(hex));
|
|
4827
|
+
return hex;
|
|
4560
4828
|
}
|
|
4561
|
-
getState().commandMs = durationMs;
|
|
4562
4829
|
}
|
|
4563
4830
|
// ../common/src/telemetry/proxy-http-agent.ts
|
|
4564
4831
|
var slot = singleton("ProxyAuthHttpsAgent");
|
|
@@ -4571,6 +4838,9 @@ function isTelemetryDisabled() {
|
|
|
4571
4838
|
const value = process.env.UIPATH_TELEMETRY_DISABLED;
|
|
4572
4839
|
return value === "1" || value === "true";
|
|
4573
4840
|
}
|
|
4841
|
+
function isProjectTelemetryDisabled() {
|
|
4842
|
+
return isTelemetryDisabled() || process.env.UIPATH_PROJECT_TELEMETRY_DISABLED === "1" || process.env.UIPATH_PROJECT_TELEMETRY_DISABLED === "true";
|
|
4843
|
+
}
|
|
4574
4844
|
|
|
4575
4845
|
// ../common/src/telemetry/telemetry-spool.ts
|
|
4576
4846
|
var sidecarEntrySlot = singleton("TelemetrySidecarEntry");
|
|
@@ -4607,7 +4877,6 @@ var telemetry = new Proxy({}, {
|
|
|
4607
4877
|
return typeof value === "function" ? value.bind(instance) : value;
|
|
4608
4878
|
}
|
|
4609
4879
|
});
|
|
4610
|
-
|
|
4611
4880
|
// ../common/src/formatter.ts
|
|
4612
4881
|
var ANSI_STYLES = {
|
|
4613
4882
|
red: "\x1B[31m",
|
|
@@ -4617,46 +4886,6 @@ var ANSI_RESET = "\x1B[0m";
|
|
|
4617
4886
|
function styleLine(line, style) {
|
|
4618
4887
|
return style ? `${ANSI_STYLES[style]}${line}${ANSI_RESET}` : line;
|
|
4619
4888
|
}
|
|
4620
|
-
var CLI_ERROR_CODES = [
|
|
4621
|
-
"invalid_argument",
|
|
4622
|
-
"authentication_required",
|
|
4623
|
-
"permission_denied",
|
|
4624
|
-
"local_permission_denied",
|
|
4625
|
-
"not_found",
|
|
4626
|
-
"rate_limited",
|
|
4627
|
-
"network_error",
|
|
4628
|
-
"timeout",
|
|
4629
|
-
"server_error",
|
|
4630
|
-
"method_not_allowed",
|
|
4631
|
-
"not_supported",
|
|
4632
|
-
"configuration_error",
|
|
4633
|
-
"execution_failed",
|
|
4634
|
-
"unknown_error"
|
|
4635
|
-
];
|
|
4636
|
-
var RETRY_HINTS = [
|
|
4637
|
-
"RetryWillNotFix",
|
|
4638
|
-
"RetryLater",
|
|
4639
|
-
"RetryAfter1Second",
|
|
4640
|
-
"RetryAfter10Seconds",
|
|
4641
|
-
"RetryAfter30Seconds",
|
|
4642
|
-
"RetryAfter60Seconds"
|
|
4643
|
-
];
|
|
4644
|
-
var CLI_ERROR_CODE_VALUES = new Set(CLI_ERROR_CODES);
|
|
4645
|
-
var RETRY_HINT_VALUES = new Set(RETRY_HINTS);
|
|
4646
|
-
function isCliErrorCode(value) {
|
|
4647
|
-
return typeof value === "string" && CLI_ERROR_CODE_VALUES.has(value);
|
|
4648
|
-
}
|
|
4649
|
-
function isRetryHint(value) {
|
|
4650
|
-
return typeof value === "string" && RETRY_HINT_VALUES.has(value);
|
|
4651
|
-
}
|
|
4652
|
-
var RESULTS = {
|
|
4653
|
-
Success: "Success",
|
|
4654
|
-
Failure: "Failure",
|
|
4655
|
-
ConfigError: "ConfigError",
|
|
4656
|
-
AuthenticationError: "AuthenticationError",
|
|
4657
|
-
ValidationError: "ValidationError",
|
|
4658
|
-
TimeoutError: "TimeoutError"
|
|
4659
|
-
};
|
|
4660
4889
|
var EXIT_CODES = {
|
|
4661
4890
|
Success: 0,
|
|
4662
4891
|
Failure: 1,
|
|
@@ -4665,6 +4894,9 @@ var EXIT_CODES = {
|
|
|
4665
4894
|
ValidationError: 3,
|
|
4666
4895
|
TimeoutError: 4
|
|
4667
4896
|
};
|
|
4897
|
+
function exitCodeForResult(result) {
|
|
4898
|
+
return EXIT_CODES[result] ?? EXIT_CODES.Failure;
|
|
4899
|
+
}
|
|
4668
4900
|
function escapeNonAscii(jsonText) {
|
|
4669
4901
|
return jsonText.replace(/[\u0080-\uffff]/g, (c) => {
|
|
4670
4902
|
const hex = c.charCodeAt(0).toString(16).padStart(4, "0");
|
|
@@ -5340,8 +5572,8 @@ function carriesOnlyNulls(value) {
|
|
|
5340
5572
|
}
|
|
5341
5573
|
return false;
|
|
5342
5574
|
}
|
|
5343
|
-
function nameList(names,
|
|
5344
|
-
const shown = names.slice(0,
|
|
5575
|
+
function nameList(names, cap = 12) {
|
|
5576
|
+
const shown = names.slice(0, cap).map((n) => `\`${n}\``);
|
|
5345
5577
|
const rest = names.length - shown.length;
|
|
5346
5578
|
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
5347
5579
|
}
|
|
@@ -5478,40 +5710,11 @@ function defaultErrorCodeForResult(result) {
|
|
|
5478
5710
|
return "unknown_error";
|
|
5479
5711
|
}
|
|
5480
5712
|
}
|
|
5481
|
-
function parseHttpStatusFromMessage2(message) {
|
|
5482
|
-
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
5483
|
-
if (!match)
|
|
5484
|
-
return;
|
|
5485
|
-
const status = Number(match[1]);
|
|
5486
|
-
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
5487
|
-
}
|
|
5488
|
-
function defaultErrorCodeForHttpStatus(status) {
|
|
5489
|
-
if (status === undefined)
|
|
5490
|
-
return;
|
|
5491
|
-
if (status === 400 || status === 409 || status === 422) {
|
|
5492
|
-
return "invalid_argument";
|
|
5493
|
-
}
|
|
5494
|
-
if (status === 401)
|
|
5495
|
-
return "authentication_required";
|
|
5496
|
-
if (status === 403)
|
|
5497
|
-
return "permission_denied";
|
|
5498
|
-
if (status === 404)
|
|
5499
|
-
return "not_found";
|
|
5500
|
-
if (status === 405)
|
|
5501
|
-
return "method_not_allowed";
|
|
5502
|
-
if (status === 408)
|
|
5503
|
-
return "timeout";
|
|
5504
|
-
if (status === 429)
|
|
5505
|
-
return "rate_limited";
|
|
5506
|
-
if (status >= 500 && status < 600)
|
|
5507
|
-
return "server_error";
|
|
5508
|
-
return;
|
|
5509
|
-
}
|
|
5510
5713
|
var LOCAL_PERMISSION_TEXT_PATTERN = new RegExp(`(?:\\b|\\()(?:${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})(?::\\s|\\))`);
|
|
5511
5714
|
function defaultErrorCodeForFailure(data) {
|
|
5512
5715
|
if (data.Result === RESULTS.Failure) {
|
|
5513
|
-
const status = data.Context?.httpStatus ??
|
|
5514
|
-
const errorCode =
|
|
5716
|
+
const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage(data.Message);
|
|
5717
|
+
const errorCode = classifyHttpStatus(status)?.errorCode;
|
|
5515
5718
|
if (errorCode)
|
|
5516
5719
|
return errorCode;
|
|
5517
5720
|
if (status === undefined && (LOCAL_PERMISSION_TEXT_PATTERN.test(data.Message) || LOCAL_PERMISSION_TEXT_PATTERN.test(data.Instructions))) {
|
|
@@ -5520,17 +5723,6 @@ function defaultErrorCodeForFailure(data) {
|
|
|
5520
5723
|
}
|
|
5521
5724
|
return defaultErrorCodeForResult(data.Result);
|
|
5522
5725
|
}
|
|
5523
|
-
function defaultRetryForErrorCode(errorCode) {
|
|
5524
|
-
switch (errorCode) {
|
|
5525
|
-
case "network_error":
|
|
5526
|
-
case "rate_limited":
|
|
5527
|
-
case "server_error":
|
|
5528
|
-
case "timeout":
|
|
5529
|
-
return "RetryLater";
|
|
5530
|
-
default:
|
|
5531
|
-
return "RetryWillNotFix";
|
|
5532
|
-
}
|
|
5533
|
-
}
|
|
5534
5726
|
var OutputFormatter;
|
|
5535
5727
|
((OutputFormatter) => {
|
|
5536
5728
|
function success(data, options) {
|
|
@@ -5562,7 +5754,7 @@ var OutputFormatter;
|
|
|
5562
5754
|
data.Log ??= getLogFilePath() || undefined;
|
|
5563
5755
|
data.ErrorCode ??= defaultErrorCodeForFailure(data);
|
|
5564
5756
|
data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
|
|
5565
|
-
const exitCode =
|
|
5757
|
+
const exitCode = exitCodeForResult(data.Result);
|
|
5566
5758
|
setExitCode(exitCode);
|
|
5567
5759
|
recordCommandFailureTelemetry({
|
|
5568
5760
|
result: data.Result,
|
|
@@ -5656,39 +5848,228 @@ var OutputFormatter;
|
|
|
5656
5848
|
}
|
|
5657
5849
|
OutputFormatter.formatToString = formatToString;
|
|
5658
5850
|
})(OutputFormatter ||= {});
|
|
5659
|
-
// ../../node_modules/commander/esm.mjs
|
|
5660
|
-
var import__ = __toESM(require_commander(), 1);
|
|
5661
|
-
var {
|
|
5662
|
-
program,
|
|
5663
|
-
createCommand,
|
|
5664
|
-
createArgument,
|
|
5665
|
-
createOption,
|
|
5666
|
-
CommanderError,
|
|
5667
|
-
InvalidArgumentError,
|
|
5668
|
-
InvalidOptionArgumentError,
|
|
5669
|
-
Command,
|
|
5670
|
-
Argument,
|
|
5671
|
-
Option,
|
|
5672
|
-
Help
|
|
5673
|
-
} = import__.default;
|
|
5674
5851
|
|
|
5675
|
-
// ../common/src/
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5852
|
+
// ../common/src/pass-through-tail.ts
|
|
5853
|
+
function maybeOption(arg) {
|
|
5854
|
+
return arg.length > 1 && arg[0] === "-";
|
|
5855
|
+
}
|
|
5856
|
+
function tokenizeTail(cmd, tail) {
|
|
5857
|
+
const find = (flag) => cmd.options.find((option) => option.long === flag || option.short === flag);
|
|
5858
|
+
const digitShort = cmd.options.some((option) => option.short !== undefined && /^-\d$/.test(option.short));
|
|
5859
|
+
const negativeNumber = (arg) => !digitShort && /^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg);
|
|
5860
|
+
const tokens = [];
|
|
5861
|
+
let firstUnknown = -1;
|
|
5862
|
+
let sentinel = -1;
|
|
5863
|
+
let variadic;
|
|
5864
|
+
let group;
|
|
5865
|
+
let groupIndex = 0;
|
|
5866
|
+
let i = 0;
|
|
5867
|
+
while (i < tail.length || group !== undefined) {
|
|
5868
|
+
const index = group === undefined ? i : groupIndex;
|
|
5869
|
+
const arg = group ?? tail[i++];
|
|
5870
|
+
group = undefined;
|
|
5871
|
+
if (arg === "--") {
|
|
5872
|
+
sentinel = index;
|
|
5873
|
+
tokens.push({ kind: "sentinel", index });
|
|
5874
|
+
for (let j = i;j < tail.length; j++) {
|
|
5875
|
+
tokens.push({
|
|
5876
|
+
kind: "operand",
|
|
5877
|
+
index: j,
|
|
5878
|
+
text: tail[j],
|
|
5879
|
+
literal: true
|
|
5880
|
+
});
|
|
5881
|
+
}
|
|
5882
|
+
break;
|
|
5883
|
+
}
|
|
5884
|
+
if (variadic && (!maybeOption(arg) || negativeNumber(arg))) {
|
|
5885
|
+
tokens.push({
|
|
5886
|
+
kind: "option",
|
|
5887
|
+
index,
|
|
5888
|
+
text: arg,
|
|
5889
|
+
option: variadic,
|
|
5890
|
+
value: arg
|
|
5891
|
+
});
|
|
5892
|
+
continue;
|
|
5893
|
+
}
|
|
5894
|
+
variadic = undefined;
|
|
5895
|
+
if (maybeOption(arg)) {
|
|
5896
|
+
const option = find(arg);
|
|
5897
|
+
if (option) {
|
|
5898
|
+
let value;
|
|
5899
|
+
if (option.required) {
|
|
5900
|
+
value = tail[i];
|
|
5901
|
+
if (value !== undefined)
|
|
5902
|
+
i++;
|
|
5903
|
+
} else if (option.optional) {
|
|
5904
|
+
const next = tail[i];
|
|
5905
|
+
if (next !== undefined && (!maybeOption(next) || negativeNumber(next))) {
|
|
5906
|
+
value = next;
|
|
5907
|
+
i++;
|
|
5908
|
+
}
|
|
5909
|
+
}
|
|
5910
|
+
tokens.push({
|
|
5911
|
+
kind: "option",
|
|
5912
|
+
index,
|
|
5913
|
+
text: arg,
|
|
5914
|
+
option,
|
|
5915
|
+
...value === undefined ? {} : { value }
|
|
5916
|
+
});
|
|
5917
|
+
variadic = option.variadic ? option : undefined;
|
|
5918
|
+
continue;
|
|
5919
|
+
}
|
|
5920
|
+
}
|
|
5921
|
+
if (arg.length > 2 && arg[0] === "-" && arg[1] !== "-") {
|
|
5922
|
+
const option = find(`-${arg[1]}`);
|
|
5923
|
+
if (option) {
|
|
5924
|
+
if (option.required || option.optional) {
|
|
5925
|
+
tokens.push({
|
|
5926
|
+
kind: "option",
|
|
5927
|
+
index,
|
|
5928
|
+
text: arg,
|
|
5929
|
+
option,
|
|
5930
|
+
value: arg.slice(2)
|
|
5931
|
+
});
|
|
5932
|
+
} else {
|
|
5933
|
+
tokens.push({ kind: "option", index, text: arg, option });
|
|
5934
|
+
group = `-${arg.slice(2)}`;
|
|
5935
|
+
groupIndex = index;
|
|
5936
|
+
}
|
|
5937
|
+
continue;
|
|
5938
|
+
}
|
|
5939
|
+
}
|
|
5940
|
+
if (/^--[^=]+=/.test(arg)) {
|
|
5941
|
+
const equals = arg.indexOf("=");
|
|
5942
|
+
const option = find(arg.slice(0, equals));
|
|
5943
|
+
if (option && (option.required || option.optional)) {
|
|
5944
|
+
tokens.push({
|
|
5945
|
+
kind: "option",
|
|
5946
|
+
index,
|
|
5947
|
+
text: arg,
|
|
5948
|
+
option,
|
|
5949
|
+
value: arg.slice(equals + 1)
|
|
5950
|
+
});
|
|
5951
|
+
continue;
|
|
5952
|
+
}
|
|
5953
|
+
}
|
|
5954
|
+
if (maybeOption(arg) && !negativeNumber(arg)) {
|
|
5955
|
+
const equals = arg.startsWith("--") ? arg.indexOf("=") : -1;
|
|
5956
|
+
if (firstUnknown === -1)
|
|
5957
|
+
firstUnknown = index;
|
|
5958
|
+
tokens.push({
|
|
5959
|
+
kind: "unknown",
|
|
5960
|
+
index,
|
|
5961
|
+
text: arg,
|
|
5962
|
+
flag: equals > 0 ? arg.slice(0, equals) : arg,
|
|
5963
|
+
...equals > 0 ? { inlineValue: arg.slice(equals + 1) } : {}
|
|
5964
|
+
});
|
|
5965
|
+
continue;
|
|
5966
|
+
}
|
|
5967
|
+
tokens.push({ kind: "operand", index, text: arg, literal: false });
|
|
5968
|
+
}
|
|
5969
|
+
return { tokens, firstUnknown, sentinel };
|
|
5685
5970
|
}
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5971
|
+
|
|
5972
|
+
// ../common/src/project-telemetry.ts
|
|
5973
|
+
var RESOLVER = Symbol.for("@uipath/common/projectTelemetryResolver");
|
|
5974
|
+
var CAPTURE = Symbol.for("@uipath/common/projectTelemetryCapture");
|
|
5975
|
+
var CONTEXT_RESOLVER = Symbol.for("@uipath/common/projectContextTelemetryResolver");
|
|
5976
|
+
var RULES = Symbol.for("@uipath/common/projectTargetRules");
|
|
5977
|
+
function logSkipped(what, error) {
|
|
5978
|
+
logger.debug(`[project-telemetry] ${what} skipped: ${error instanceof Error ? error.message : String(error)}`);
|
|
5979
|
+
}
|
|
5980
|
+
function bounded(work, what) {
|
|
5981
|
+
return withinProjectIdentityBudget(work, () => logSkipped(what, `no answer within ${PROJECT_IDENTITY_LOOKUP_BUDGET_MS} ms`));
|
|
5982
|
+
}
|
|
5983
|
+
async function identityWithContext(command, identity) {
|
|
5984
|
+
const props = projectIdentityProperties(identity);
|
|
5985
|
+
if (!identity.projectDirectory || isProjectTelemetryDisabled())
|
|
5986
|
+
return props;
|
|
5987
|
+
for (let node = command;node; node = node.parent ?? undefined) {
|
|
5988
|
+
const resolver = node[CONTEXT_RESOLVER];
|
|
5989
|
+
if (typeof resolver !== "function")
|
|
5990
|
+
continue;
|
|
5991
|
+
try {
|
|
5992
|
+
return {
|
|
5993
|
+
...await resolver(identity.projectDirectory),
|
|
5994
|
+
...props
|
|
5995
|
+
};
|
|
5996
|
+
} catch (error) {
|
|
5997
|
+
logSkipped("solution context lookup", error);
|
|
5998
|
+
return props;
|
|
5999
|
+
}
|
|
5689
6000
|
}
|
|
5690
|
-
return
|
|
5691
|
-
}
|
|
6001
|
+
return props;
|
|
6002
|
+
}
|
|
6003
|
+
function getProjectTelemetryResolver(command) {
|
|
6004
|
+
for (let node = command;node; node = node.parent) {
|
|
6005
|
+
const resolver = node[RESOLVER];
|
|
6006
|
+
if (typeof resolver === "function")
|
|
6007
|
+
return resolver;
|
|
6008
|
+
}
|
|
6009
|
+
return;
|
|
6010
|
+
}
|
|
6011
|
+
function attachProjectTelemetryCapture(command, capture) {
|
|
6012
|
+
command[CAPTURE] = capture;
|
|
6013
|
+
}
|
|
6014
|
+
class ProjectTelemetrySession {
|
|
6015
|
+
resolver;
|
|
6016
|
+
command;
|
|
6017
|
+
target;
|
|
6018
|
+
props = {};
|
|
6019
|
+
explicit = false;
|
|
6020
|
+
input;
|
|
6021
|
+
constructor(resolver, command) {
|
|
6022
|
+
this.resolver = resolver;
|
|
6023
|
+
this.command = command;
|
|
6024
|
+
}
|
|
6025
|
+
async setTarget(path) {
|
|
6026
|
+
this.target = path;
|
|
6027
|
+
if (this.input) {
|
|
6028
|
+
await this.resolve({
|
|
6029
|
+
...this.input,
|
|
6030
|
+
phase: "after",
|
|
6031
|
+
success: true
|
|
6032
|
+
});
|
|
6033
|
+
this.explicit = true;
|
|
6034
|
+
}
|
|
6035
|
+
}
|
|
6036
|
+
async setIdentity(identity) {
|
|
6037
|
+
try {
|
|
6038
|
+
const props = await bounded(identityWithContext(this.command, identity), "project identity capture");
|
|
6039
|
+
if (props !== undefined)
|
|
6040
|
+
this.setProperties(props);
|
|
6041
|
+
} catch (error) {
|
|
6042
|
+
logSkipped("project identity capture", error);
|
|
6043
|
+
}
|
|
6044
|
+
}
|
|
6045
|
+
setProperties(properties) {
|
|
6046
|
+
try {
|
|
6047
|
+
this.props = { ...properties };
|
|
6048
|
+
this.explicit = true;
|
|
6049
|
+
} catch (error) {
|
|
6050
|
+
logSkipped("project identity properties", error);
|
|
6051
|
+
}
|
|
6052
|
+
}
|
|
6053
|
+
properties() {
|
|
6054
|
+
return { ...this.props };
|
|
6055
|
+
}
|
|
6056
|
+
async resolve(input) {
|
|
6057
|
+
this.input = input;
|
|
6058
|
+
if (this.explicit)
|
|
6059
|
+
return;
|
|
6060
|
+
try {
|
|
6061
|
+
const props = await bounded(this.resolver({
|
|
6062
|
+
...input,
|
|
6063
|
+
target: this.target
|
|
6064
|
+
}), `project identity (${input.phase})`);
|
|
6065
|
+
if (props !== undefined) {
|
|
6066
|
+
this.props = props;
|
|
6067
|
+
}
|
|
6068
|
+
} catch (error) {
|
|
6069
|
+
logSkipped(`project identity (${input.phase})`, error);
|
|
6070
|
+
}
|
|
6071
|
+
}
|
|
6072
|
+
}
|
|
5692
6073
|
|
|
5693
6074
|
// ../common/src/telemetry/command-attribution.ts
|
|
5694
6075
|
var LEGACY_SKILL_NAMESPACE = "uipath:";
|
|
@@ -5934,8 +6315,7 @@ var pollSignalSlot = singleton("PollSignal");
|
|
|
5934
6315
|
var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
|
|
5935
6316
|
var processContext = {
|
|
5936
6317
|
exit: (code) => {
|
|
5937
|
-
|
|
5938
|
-
setExitCode(code);
|
|
6318
|
+
recordCommandExit(code);
|
|
5939
6319
|
},
|
|
5940
6320
|
get pollSignal() {
|
|
5941
6321
|
return pollSignalSlot.get();
|
|
@@ -5960,6 +6340,8 @@ function recordableArgValue(value, choices) {
|
|
|
5960
6340
|
function extractCommandParams(cmd) {
|
|
5961
6341
|
const params = {};
|
|
5962
6342
|
forEachSuppliedArgument(cmd, (name, value, choices, defaulted) => {
|
|
6343
|
+
if (name === undefined)
|
|
6344
|
+
return;
|
|
5963
6345
|
const recordable = recordableArgValue(value, choices);
|
|
5964
6346
|
params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = recordable === TELEMETRY_ARG_VALUE_WITHHELD && defaulted ? TELEMETRY_ARG_VALUE_DEFAULTED : recordable;
|
|
5965
6347
|
});
|
|
@@ -5975,7 +6357,8 @@ function isDefaultedPositional(cmd, index) {
|
|
|
5975
6357
|
function forEachSuppliedArgument(cmd, visit) {
|
|
5976
6358
|
const registered = cmd.registeredArguments ?? [];
|
|
5977
6359
|
const processed = cmd.processedArgs ?? [];
|
|
5978
|
-
|
|
6360
|
+
const bound = boundPositionalCount(cmd);
|
|
6361
|
+
for (let i = 0;i < bound; i++) {
|
|
5979
6362
|
const name = registered[i].name();
|
|
5980
6363
|
if (name && processed[i] !== undefined) {
|
|
5981
6364
|
visit(name, processed[i], registered[i].argChoices, isDefaultedPositional(cmd, i));
|
|
@@ -5990,6 +6373,71 @@ function forEachSuppliedArgument(cmd, visit) {
|
|
|
5990
6373
|
visit(key, value, choicesByAttribute.get(key), isDefaultedOption(cmd, key));
|
|
5991
6374
|
}
|
|
5992
6375
|
}
|
|
6376
|
+
forEachPassThroughToken(cmd, bound, (name, value) => {
|
|
6377
|
+
visit(name, value, name === undefined ? undefined : choicesByAttribute.get(name), false);
|
|
6378
|
+
});
|
|
6379
|
+
}
|
|
6380
|
+
function boundPositionalCount(cmd) {
|
|
6381
|
+
const registered = cmd.registeredArguments ?? [];
|
|
6382
|
+
if (registered.some((argument) => argument.variadic)) {
|
|
6383
|
+
return registered.length;
|
|
6384
|
+
}
|
|
6385
|
+
if ((cmd.args ?? []).length <= registered.length) {
|
|
6386
|
+
return registered.length;
|
|
6387
|
+
}
|
|
6388
|
+
const firstFlag = tokenizeTail(cmd, (cmd.args ?? []).slice(1)).tokens.find((token) => token.kind !== "operand")?.index ?? -1;
|
|
6389
|
+
return firstFlag === -1 ? registered.length : Math.min(registered.length, firstFlag + 1);
|
|
6390
|
+
}
|
|
6391
|
+
function forEachPassThroughToken(cmd, bound, visit) {
|
|
6392
|
+
const registered = cmd.registeredArguments ?? [];
|
|
6393
|
+
const fillsPositionals = !registered.some((argument) => argument.variadic);
|
|
6394
|
+
const { tokens, firstUnknown } = tokenizeTail(cmd, (cmd.args ?? []).slice(bound));
|
|
6395
|
+
const repeated = new Map;
|
|
6396
|
+
let nextPositional = bound;
|
|
6397
|
+
for (const token of tokens) {
|
|
6398
|
+
const pastUnknown = firstUnknown !== -1 && token.index > firstUnknown;
|
|
6399
|
+
if (token.kind === "sentinel")
|
|
6400
|
+
continue;
|
|
6401
|
+
if (token.kind === "operand") {
|
|
6402
|
+
const claimable = !pastUnknown && fillsPositionals && nextPositional < registered.length;
|
|
6403
|
+
const name = claimable ? registered[nextPositional++].name() : undefined;
|
|
6404
|
+
visit(name || undefined, token.text);
|
|
6405
|
+
continue;
|
|
6406
|
+
}
|
|
6407
|
+
if (token.kind === "unknown") {
|
|
6408
|
+
const bare = token.flag.replace(/^-+/, "");
|
|
6409
|
+
const key = bare.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
6410
|
+
const keyable = token.flag.startsWith("--") || token.flag.length === 2;
|
|
6411
|
+
if (!pastUnknown && keyable && /^[a-z][a-z0-9-]*$/i.test(bare) && key) {
|
|
6412
|
+
visit(key, token.inlineValue ?? true);
|
|
6413
|
+
} else {
|
|
6414
|
+
visit(undefined, token.text);
|
|
6415
|
+
if (token.inlineValue !== undefined) {
|
|
6416
|
+
visit(undefined, token.inlineValue);
|
|
6417
|
+
} else if (!token.flag.startsWith("--") && token.flag.length > 2) {
|
|
6418
|
+
visit(undefined, token.flag.slice(2));
|
|
6419
|
+
}
|
|
6420
|
+
}
|
|
6421
|
+
continue;
|
|
6422
|
+
}
|
|
6423
|
+
if (pastUnknown) {
|
|
6424
|
+
visit(undefined, token.text);
|
|
6425
|
+
if (token.value !== undefined)
|
|
6426
|
+
visit(undefined, token.value);
|
|
6427
|
+
continue;
|
|
6428
|
+
}
|
|
6429
|
+
const option = token.option;
|
|
6430
|
+
const name = option.attributeName();
|
|
6431
|
+
const value = option.negate ? false : option.required || option.optional ? token.value ?? true : true;
|
|
6432
|
+
const previous = repeated.get(name);
|
|
6433
|
+
if (previous) {
|
|
6434
|
+
previous.push(value);
|
|
6435
|
+
visit(name, previous);
|
|
6436
|
+
} else {
|
|
6437
|
+
repeated.set(name, [value]);
|
|
6438
|
+
visit(name, value);
|
|
6439
|
+
}
|
|
6440
|
+
}
|
|
5993
6441
|
}
|
|
5994
6442
|
function withheldArgumentValues(cmd) {
|
|
5995
6443
|
const values = [];
|
|
@@ -6051,6 +6499,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6051
6499
|
const telemetryName = commandTelemetryName(commandParts);
|
|
6052
6500
|
const commandPath = commandInvocationPath(commandParts);
|
|
6053
6501
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
6502
|
+
const projectResolver = getProjectTelemetryResolver(command);
|
|
6503
|
+
const projectSession = projectResolver && !isProjectTelemetryDisabled() ? new ProjectTelemetrySession(projectResolver, command) : undefined;
|
|
6054
6504
|
markCommandStart();
|
|
6055
6505
|
const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
|
|
6056
6506
|
try {
|
|
@@ -6063,6 +6513,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6063
6513
|
if (violation) {
|
|
6064
6514
|
return Promise.reject(violation);
|
|
6065
6515
|
}
|
|
6516
|
+
if (projectSession) {
|
|
6517
|
+
return projectSession.resolve({ command, args, phase: "before" }).then(() => {
|
|
6518
|
+
attachProjectTelemetryCapture(command, projectSession);
|
|
6519
|
+
return fn(...args);
|
|
6520
|
+
});
|
|
6521
|
+
}
|
|
6066
6522
|
return fn(...args);
|
|
6067
6523
|
}));
|
|
6068
6524
|
if (error) {
|
|
@@ -6071,22 +6527,26 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6071
6527
|
const typed = error;
|
|
6072
6528
|
const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
|
|
6073
6529
|
const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
|
|
6074
|
-
const
|
|
6530
|
+
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
6531
|
+
const classified = cancellationExitCode === undefined ? await extractErrorDetails(error) : undefined;
|
|
6532
|
+
const finalResult = customResult ?? classified?.result ?? RESULTS.Failure;
|
|
6075
6533
|
const typedErrorCode = typed.errorCode ?? typed.ErrorCode;
|
|
6076
6534
|
const customErrorCode = isCliErrorCode(typedErrorCode) ? typedErrorCode : undefined;
|
|
6077
6535
|
const typedRetry = typed.retry ?? typed.Retry;
|
|
6078
6536
|
const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
|
|
6079
6537
|
const typedContext = typed.context ?? typed.Context;
|
|
6080
6538
|
const customContext = isErrorContext(typedContext) ? typedContext : undefined;
|
|
6081
|
-
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
6082
6539
|
fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
|
|
6540
|
+
const errorCode = customErrorCode ?? classified?.errorCode;
|
|
6541
|
+
const retry = customRetry ?? classified?.retry;
|
|
6542
|
+
const errorContext = customContext ?? classified?.context;
|
|
6083
6543
|
OutputFormatter.error({
|
|
6084
6544
|
Result: finalResult,
|
|
6085
|
-
...
|
|
6545
|
+
...errorCode ? { ErrorCode: errorCode } : {},
|
|
6086
6546
|
Message: errorMessage,
|
|
6087
6547
|
Instructions: customInstructions ?? commandHelpHint(commandPath),
|
|
6088
|
-
...
|
|
6089
|
-
...
|
|
6548
|
+
...retry ? { Retry: retry } : {},
|
|
6549
|
+
...errorContext ? { Context: errorContext } : {}
|
|
6090
6550
|
});
|
|
6091
6551
|
context.exit(fallbackExitCode);
|
|
6092
6552
|
}
|
|
@@ -6095,6 +6555,14 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6095
6555
|
const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
|
|
6096
6556
|
const recordedFailure = takeRecordedCommandFailureTelemetry();
|
|
6097
6557
|
const success = !error && exitCode === 0;
|
|
6558
|
+
if (projectSession) {
|
|
6559
|
+
await projectSession.resolve({
|
|
6560
|
+
command,
|
|
6561
|
+
args,
|
|
6562
|
+
phase: "after",
|
|
6563
|
+
success
|
|
6564
|
+
});
|
|
6565
|
+
}
|
|
6098
6566
|
const terminalTelemetry = buildCommandTerminalTelemetryProperties({
|
|
6099
6567
|
error,
|
|
6100
6568
|
exitCode,
|
|
@@ -6112,6 +6580,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6112
6580
|
}
|
|
6113
6581
|
const baseProperties = redactProperties({
|
|
6114
6582
|
...commandParams,
|
|
6583
|
+
...projectSession?.properties(),
|
|
6115
6584
|
...props,
|
|
6116
6585
|
...buildCommandTelemetryAttribution(commandPath, process.env.UIPATH_SKILL),
|
|
6117
6586
|
...buildAgentSessionTelemetry(process.env),
|
|
@@ -6122,6 +6591,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6122
6591
|
});
|
|
6123
6592
|
emitInvocationRequest(telemetryName, success, baseProperties);
|
|
6124
6593
|
} finally {
|
|
6594
|
+
if (projectSession)
|
|
6595
|
+
attachProjectTelemetryCapture(command, undefined);
|
|
6125
6596
|
releaseSuppliedArgumentValues(supplied);
|
|
6126
6597
|
}
|
|
6127
6598
|
});
|
|
@@ -6374,10 +6845,10 @@ async function readJsonOption(source) {
|
|
|
6374
6845
|
async function readJsonOptionText(source) {
|
|
6375
6846
|
const { inline, file, inlineFlag, fileFlag } = source;
|
|
6376
6847
|
if (file !== undefined) {
|
|
6377
|
-
const
|
|
6378
|
-
const bytes = await
|
|
6848
|
+
const fs = getFileSystem();
|
|
6849
|
+
const bytes = await fs.readFile(file);
|
|
6379
6850
|
if (bytes === null) {
|
|
6380
|
-
throw new Error(`File not found: ${
|
|
6851
|
+
throw new Error(`File not found: ${fs.path.resolve(file)}`);
|
|
6381
6852
|
}
|
|
6382
6853
|
const text = decodeJsonFile(bytes).trim();
|
|
6383
6854
|
if (text === "") {
|
|
@@ -6453,7 +6924,7 @@ function addDeprecatedOptionAlias(command, deprecatedFlags, preferredLong) {
|
|
|
6453
6924
|
if (preferred === undefined) {
|
|
6454
6925
|
throw new Error(`${preferredLong} must be registered before its deprecated alias`);
|
|
6455
6926
|
}
|
|
6456
|
-
const deprecated = new
|
|
6927
|
+
const deprecated = new Option2(deprecatedFlags, `Deprecated alias for ${preferredLong}`).hideHelp();
|
|
6457
6928
|
const preferredKey = preferred.attributeName();
|
|
6458
6929
|
const deprecatedLabel = [deprecated.short, deprecated.long].filter((flag) => flag !== undefined).join("/");
|
|
6459
6930
|
let aliasUsed = false;
|
|
@@ -6479,7 +6950,7 @@ function addDeprecatedOptionAlias(command, deprecatedFlags, preferredLong) {
|
|
|
6479
6950
|
}
|
|
6480
6951
|
var TENANT_SWITCH_COMMAND = "uip login tenant set <tenant>";
|
|
6481
6952
|
function createHiddenDeprecatedTenantOption(flags = "-t, --tenant <tenant-name>") {
|
|
6482
|
-
return new
|
|
6953
|
+
return new Option2(flags, `Tenant name. Deprecated; use ${TENANT_SWITCH_COMMAND} to switch active tenants.`).hideHelp().argParser((tenant) => {
|
|
6483
6954
|
warnDeprecatedTenantOption(tenant);
|
|
6484
6955
|
return tenant;
|
|
6485
6956
|
});
|
|
@@ -6523,14 +6994,14 @@ function parseOffset(raw, _previous) {
|
|
|
6523
6994
|
function parseBoundedInt(raw, optionName, bounds) {
|
|
6524
6995
|
const normalized = raw.trim();
|
|
6525
6996
|
if (normalized === "") {
|
|
6526
|
-
throw new
|
|
6997
|
+
throw new InvalidArgumentError2(`${optionName} requires a value (got empty).`);
|
|
6527
6998
|
}
|
|
6528
6999
|
if (!/^-?\d+$/.test(normalized)) {
|
|
6529
|
-
throw new
|
|
7000
|
+
throw new InvalidArgumentError2(`${optionName} must be an integer, got '${normalized}'.`);
|
|
6530
7001
|
}
|
|
6531
7002
|
const n = parseInt(normalized, 10);
|
|
6532
7003
|
if (n < bounds.min || n > bounds.max) {
|
|
6533
|
-
throw new
|
|
7004
|
+
throw new InvalidArgumentError2(`${optionName} must be between ${bounds.min} and ${bounds.max}, got ${n}.`);
|
|
6534
7005
|
}
|
|
6535
7006
|
return n;
|
|
6536
7007
|
}
|
|
@@ -6655,14 +7126,39 @@ function withPseudonymizedIdentifiers(payload) {
|
|
|
6655
7126
|
}
|
|
6656
7127
|
};
|
|
6657
7128
|
}
|
|
6658
|
-
function
|
|
7129
|
+
function identityKeysOf(capture) {
|
|
7130
|
+
if (!capture) {
|
|
7131
|
+
return {};
|
|
7132
|
+
}
|
|
7133
|
+
try {
|
|
7134
|
+
const properties = capture.properties?.();
|
|
7135
|
+
if (typeof properties !== "object" || properties === null) {
|
|
7136
|
+
return {};
|
|
7137
|
+
}
|
|
7138
|
+
const keys = {};
|
|
7139
|
+
for (const key of GUID_KEY_DIMENSIONS) {
|
|
7140
|
+
const value = properties[key];
|
|
7141
|
+
if (value !== undefined) {
|
|
7142
|
+
keys[key] = value;
|
|
7143
|
+
}
|
|
7144
|
+
}
|
|
7145
|
+
return keys;
|
|
7146
|
+
} catch (error) {
|
|
7147
|
+
logSkipped("ship identity", error);
|
|
7148
|
+
return {};
|
|
7149
|
+
}
|
|
7150
|
+
}
|
|
7151
|
+
function trackShipSucceeded(payload, capture) {
|
|
6659
7152
|
const keys = getShippedKeys();
|
|
6660
7153
|
const key = dedupeKey(payload);
|
|
6661
7154
|
if (keys.has(key)) {
|
|
6662
7155
|
return false;
|
|
6663
7156
|
}
|
|
6664
7157
|
keys.add(key);
|
|
6665
|
-
telemetry.trackEvent(CommonTelemetryEvents.ShipSucceeded, redactProperties(
|
|
7158
|
+
telemetry.trackEvent(CommonTelemetryEvents.ShipSucceeded, redactProperties({
|
|
7159
|
+
...withPseudonymizedIdentifiers(payload),
|
|
7160
|
+
...identityKeysOf(capture)
|
|
7161
|
+
}));
|
|
6666
7162
|
return true;
|
|
6667
7163
|
}
|
|
6668
7164
|
// ../common/src/tool-provider.ts
|
|
@@ -6821,9 +7317,9 @@ function getProfileStorage() {
|
|
|
6821
7317
|
if (isAuthProfileStorage(existing)) {
|
|
6822
7318
|
return existing;
|
|
6823
7319
|
}
|
|
6824
|
-
const
|
|
6825
|
-
globalSlot2[AUTH_PROFILE_STORAGE_KEY] =
|
|
6826
|
-
return
|
|
7320
|
+
const storage = createProfileStorage();
|
|
7321
|
+
globalSlot2[AUTH_PROFILE_STORAGE_KEY] = storage;
|
|
7322
|
+
return storage;
|
|
6827
7323
|
}
|
|
6828
7324
|
var profileStorage = getProfileStorage();
|
|
6829
7325
|
|
|
@@ -6854,8 +7350,8 @@ function resolveAuthProfileFilePath(profile) {
|
|
|
6854
7350
|
if (normalized === undefined) {
|
|
6855
7351
|
throw new AuthProfileValidationError(`"${DEFAULT_AUTH_PROFILE}" is the built-in profile and does not have a profile file path.`);
|
|
6856
7352
|
}
|
|
6857
|
-
const
|
|
6858
|
-
return
|
|
7353
|
+
const fs = getFileSystem();
|
|
7354
|
+
return fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR, normalized, AUTH_FILENAME);
|
|
6859
7355
|
}
|
|
6860
7356
|
function getActiveAuthProfileFilePath() {
|
|
6861
7357
|
const profile = getActiveAuthProfile();
|
|
@@ -7028,6 +7524,8 @@ var ENV_AUTH_VARS = {
|
|
|
7028
7524
|
};
|
|
7029
7525
|
|
|
7030
7526
|
class EnvAuthConfigError extends Error {
|
|
7527
|
+
errorCode = "configuration_error";
|
|
7528
|
+
retry = "RetryWillNotFix";
|
|
7031
7529
|
constructor(message) {
|
|
7032
7530
|
super(message);
|
|
7033
7531
|
this.name = "EnvAuthConfigError";
|
|
@@ -7066,11 +7564,11 @@ var readAuthFromEnv = () => {
|
|
|
7066
7564
|
if (!rawUrl) {
|
|
7067
7565
|
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}).`);
|
|
7068
7566
|
}
|
|
7069
|
-
const
|
|
7567
|
+
const baseUrl = resolveBaseUrl(rawUrl, `Failed to validate ${OPAQUE_TOKEN_BASE_URL_VAR}`);
|
|
7070
7568
|
return {
|
|
7071
7569
|
loginStatus: "Logged in",
|
|
7072
7570
|
accessToken,
|
|
7073
|
-
baseUrl
|
|
7571
|
+
baseUrl,
|
|
7074
7572
|
organizationName,
|
|
7075
7573
|
organizationId,
|
|
7076
7574
|
tenantName,
|
|
@@ -7111,8 +7609,8 @@ var SURFACE_WINDOW_MS = 60 * 60 * 1000;
|
|
|
7111
7609
|
async function refreshTokenFingerprint(refreshToken) {
|
|
7112
7610
|
const bytes = new TextEncoder().encode(refreshToken);
|
|
7113
7611
|
if (globalThis.crypto?.subtle) {
|
|
7114
|
-
const
|
|
7115
|
-
return Array.from(new Uint8Array(
|
|
7612
|
+
const digest = await globalThis.crypto.subtle.digest("SHA-256", bytes);
|
|
7613
|
+
return Array.from(new Uint8Array(digest), (b) => b.toString(16).padStart(2, "0")).join("").slice(0, 16);
|
|
7116
7614
|
}
|
|
7117
7615
|
const { createHash } = await import("node:crypto");
|
|
7118
7616
|
return createHash("sha256").update(refreshToken).digest("hex").slice(0, 16);
|
|
@@ -7121,9 +7619,9 @@ function breakerPathFor(authPath) {
|
|
|
7121
7619
|
return `${authPath}${BREAKER_SUFFIX}`;
|
|
7122
7620
|
}
|
|
7123
7621
|
async function loadRefreshBreaker(authPath) {
|
|
7124
|
-
const
|
|
7622
|
+
const fs = getFileSystem();
|
|
7125
7623
|
try {
|
|
7126
|
-
const content = await
|
|
7624
|
+
const content = await fs.readFile(breakerPathFor(authPath), "utf-8");
|
|
7127
7625
|
if (!content)
|
|
7128
7626
|
return {};
|
|
7129
7627
|
const parsed = JSON.parse(content);
|
|
@@ -7134,20 +7632,20 @@ async function loadRefreshBreaker(authPath) {
|
|
|
7134
7632
|
}
|
|
7135
7633
|
async function saveRefreshBreaker(authPath, state) {
|
|
7136
7634
|
try {
|
|
7137
|
-
const
|
|
7138
|
-
const
|
|
7139
|
-
await
|
|
7140
|
-
const tempPath = `${
|
|
7141
|
-
await
|
|
7142
|
-
await
|
|
7635
|
+
const fs = getFileSystem();
|
|
7636
|
+
const path = breakerPathFor(authPath);
|
|
7637
|
+
await fs.mkdir(fs.path.dirname(path));
|
|
7638
|
+
const tempPath = `${path}.tmp`;
|
|
7639
|
+
await fs.writeFile(tempPath, JSON.stringify(state));
|
|
7640
|
+
await fs.rename(tempPath, path);
|
|
7143
7641
|
} catch {}
|
|
7144
7642
|
}
|
|
7145
7643
|
async function clearRefreshBreaker(authPath) {
|
|
7146
|
-
const
|
|
7147
|
-
const
|
|
7644
|
+
const fs = getFileSystem();
|
|
7645
|
+
const path = breakerPathFor(authPath);
|
|
7148
7646
|
try {
|
|
7149
|
-
if (await
|
|
7150
|
-
await
|
|
7647
|
+
if (await fs.exists(path)) {
|
|
7648
|
+
await fs.rm(path);
|
|
7151
7649
|
}
|
|
7152
7650
|
} catch {}
|
|
7153
7651
|
}
|
|
@@ -7168,13 +7666,13 @@ var ROBOT_USER_SERVICES_PIPE = "UiPathUserServices";
|
|
|
7168
7666
|
var ROBOT_USER_SERVICES_ALTERNATE_PIPE = `${ROBOT_USER_SERVICES_PIPE}Alternate`;
|
|
7169
7667
|
var PIPE_NAME_MAX_LENGTH = 103;
|
|
7170
7668
|
var getRobotIpcPipeNames = async () => {
|
|
7171
|
-
const
|
|
7172
|
-
const username =
|
|
7669
|
+
const fs = getFileSystem();
|
|
7670
|
+
const username = fs.env.getenv("USER") ?? fs.env.getenv("USERNAME");
|
|
7173
7671
|
if (!username) {
|
|
7174
7672
|
throw new Error("Unable to determine current username");
|
|
7175
7673
|
}
|
|
7176
|
-
const tempPath =
|
|
7177
|
-
return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) =>
|
|
7674
|
+
const tempPath = fs.env.getenv("TMPDIR") ?? "/tmp/";
|
|
7675
|
+
return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) => fs.path.join(tempPath, `${baseName}_${username}`).substring(0, PIPE_NAME_MAX_LENGTH));
|
|
7178
7676
|
};
|
|
7179
7677
|
var defaultIsRobotIpcAvailable = async () => {
|
|
7180
7678
|
if (process.platform === "win32") {
|
|
@@ -7184,20 +7682,20 @@ var defaultIsRobotIpcAvailable = async () => {
|
|
|
7184
7682
|
if (pipeNamesError || !pipeNames) {
|
|
7185
7683
|
return false;
|
|
7186
7684
|
}
|
|
7187
|
-
const
|
|
7685
|
+
const fs = getFileSystem();
|
|
7188
7686
|
for (const pipeName of pipeNames) {
|
|
7189
|
-
const [existsError, exists] = await catchError2(
|
|
7687
|
+
const [existsError, exists] = await catchError2(fs.exists(pipeName));
|
|
7190
7688
|
if (!existsError && exists === true) {
|
|
7191
7689
|
return true;
|
|
7192
7690
|
}
|
|
7193
7691
|
}
|
|
7194
7692
|
return false;
|
|
7195
7693
|
};
|
|
7196
|
-
var withTimeout = (promise, timeoutMs) => new Promise((
|
|
7694
|
+
var withTimeout = (promise, timeoutMs) => new Promise((resolve, reject) => {
|
|
7197
7695
|
const timer = setTimeout(() => reject(new Error(`Robot IPC call timed out after ${timeoutMs}ms`)), timeoutMs);
|
|
7198
7696
|
promise.then((value) => {
|
|
7199
7697
|
clearTimeout(timer);
|
|
7200
|
-
|
|
7698
|
+
resolve(value);
|
|
7201
7699
|
}, (error) => {
|
|
7202
7700
|
clearTimeout(timer);
|
|
7203
7701
|
reject(error);
|
|
@@ -7370,9 +7868,12 @@ var refreshAccessToken = async ({
|
|
|
7370
7868
|
body: tokenParams
|
|
7371
7869
|
});
|
|
7372
7870
|
const tokenData = await tokenResponse.json();
|
|
7373
|
-
if (
|
|
7871
|
+
if (tokenResponse.status === 400 || tokenResponse.status === 401) {
|
|
7374
7872
|
throw new TokenRefreshOAuthError;
|
|
7375
7873
|
}
|
|
7874
|
+
if (!tokenResponse.ok) {
|
|
7875
|
+
throw new Error(`Token refresh failed: HTTP ${tokenResponse.status}`);
|
|
7876
|
+
}
|
|
7376
7877
|
const newAccessToken = tokenData.access_token;
|
|
7377
7878
|
const newRefreshToken = tokenData.refresh_token;
|
|
7378
7879
|
if (typeof newAccessToken !== "string" || typeof newRefreshToken !== "string") {
|
|
@@ -7404,9 +7905,9 @@ var errorCode = (err) => {
|
|
|
7404
7905
|
}
|
|
7405
7906
|
return "EUNKNOWN";
|
|
7406
7907
|
};
|
|
7407
|
-
var probeAsync = async (
|
|
7908
|
+
var probeAsync = async (fs, candidate) => {
|
|
7408
7909
|
try {
|
|
7409
|
-
const stats = await
|
|
7910
|
+
const stats = await fs.stat(candidate);
|
|
7410
7911
|
if (stats === null) {
|
|
7411
7912
|
return { exists: false };
|
|
7412
7913
|
}
|
|
@@ -7433,36 +7934,36 @@ var probeAsync = async (fs2, candidate) => {
|
|
|
7433
7934
|
}
|
|
7434
7935
|
};
|
|
7435
7936
|
var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
|
|
7436
|
-
const
|
|
7437
|
-
if (
|
|
7438
|
-
const
|
|
7439
|
-
return
|
|
7937
|
+
const fs = getFileSystem();
|
|
7938
|
+
if (fs.path.isAbsolute(envFilePath)) {
|
|
7939
|
+
const probe = await probeAsync(fs, envFilePath);
|
|
7940
|
+
return probe.exists ? { exists: true, absolutePath: envFilePath, source: "absolute" } : {
|
|
7440
7941
|
exists: false,
|
|
7441
7942
|
absolutePath: envFilePath,
|
|
7442
7943
|
source: "absolute",
|
|
7443
|
-
...
|
|
7944
|
+
...probe.unusable ? { unusable: probe.unusable } : {}
|
|
7444
7945
|
};
|
|
7445
7946
|
}
|
|
7446
|
-
const cwd = opts?.cwd ??
|
|
7947
|
+
const cwd = opts?.cwd ?? fs.env.cwd();
|
|
7447
7948
|
let searchDir = cwd;
|
|
7448
7949
|
while (true) {
|
|
7449
|
-
const candidate =
|
|
7450
|
-
const
|
|
7451
|
-
if (
|
|
7950
|
+
const candidate = fs.path.join(searchDir, envFilePath);
|
|
7951
|
+
const probe = await probeAsync(fs, candidate);
|
|
7952
|
+
if (probe.exists) {
|
|
7452
7953
|
return {
|
|
7453
7954
|
exists: true,
|
|
7454
7955
|
absolutePath: candidate,
|
|
7455
7956
|
source: searchDir === cwd ? "cwd" : "ancestor"
|
|
7456
7957
|
};
|
|
7457
7958
|
}
|
|
7458
|
-
const parentDir =
|
|
7959
|
+
const parentDir = fs.path.dirname(searchDir);
|
|
7459
7960
|
if (parentDir === searchDir) {
|
|
7460
7961
|
break;
|
|
7461
7962
|
}
|
|
7462
7963
|
searchDir = parentDir;
|
|
7463
7964
|
}
|
|
7464
|
-
const homePath =
|
|
7465
|
-
const probe = await probeAsync(
|
|
7965
|
+
const homePath = fs.path.join(fs.env.homedir(), envFilePath);
|
|
7966
|
+
const probe = await probeAsync(fs, homePath);
|
|
7466
7967
|
if (probe.exists) {
|
|
7467
7968
|
return { exists: true, absolutePath: homePath, source: "home" };
|
|
7468
7969
|
}
|
|
@@ -7505,12 +8006,12 @@ var parseEnvContent = (content) => {
|
|
|
7505
8006
|
return env;
|
|
7506
8007
|
};
|
|
7507
8008
|
var loadEnvFileAsync = async ({ envPath }) => {
|
|
7508
|
-
const
|
|
7509
|
-
const absolutePath =
|
|
7510
|
-
if (!await
|
|
8009
|
+
const fs = getFileSystem();
|
|
8010
|
+
const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.cwd(), envPath);
|
|
8011
|
+
if (!await fs.exists(absolutePath)) {
|
|
7511
8012
|
throw new Error(`Environment file not found: ${envPath}`);
|
|
7512
8013
|
}
|
|
7513
|
-
const content = await
|
|
8014
|
+
const content = await fs.readFile(absolutePath, "utf-8");
|
|
7514
8015
|
if (content === null) {
|
|
7515
8016
|
throw new Error(`Environment file not found: ${envPath}`);
|
|
7516
8017
|
}
|
|
@@ -7521,10 +8022,10 @@ var saveEnvFileAsync = async ({
|
|
|
7521
8022
|
data,
|
|
7522
8023
|
merge = true
|
|
7523
8024
|
}) => {
|
|
7524
|
-
const
|
|
7525
|
-
const absolutePath =
|
|
8025
|
+
const fs = getFileSystem();
|
|
8026
|
+
const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.homedir(), envPath);
|
|
7526
8027
|
let existingData = {};
|
|
7527
|
-
if (merge && await
|
|
8028
|
+
if (merge && await fs.exists(absolutePath)) {
|
|
7528
8029
|
try {
|
|
7529
8030
|
existingData = await loadEnvFileAsync({ envPath: absolutePath });
|
|
7530
8031
|
} catch {}
|
|
@@ -7542,11 +8043,11 @@ var saveEnvFileAsync = async ({
|
|
|
7542
8043
|
const content = `${lines.join(`
|
|
7543
8044
|
`)}
|
|
7544
8045
|
`;
|
|
7545
|
-
const dir =
|
|
7546
|
-
await
|
|
8046
|
+
const dir = fs.path.dirname(absolutePath);
|
|
8047
|
+
await fs.mkdir(dir);
|
|
7547
8048
|
const tempPath = `${absolutePath}.tmp`;
|
|
7548
|
-
await
|
|
7549
|
-
await
|
|
8049
|
+
await fs.writeFile(tempPath, content);
|
|
8050
|
+
await fs.rename(tempPath, absolutePath);
|
|
7550
8051
|
};
|
|
7551
8052
|
|
|
7552
8053
|
// ../auth/src/loginStatus.ts
|
|
@@ -7670,11 +8171,11 @@ async function loadFileCredentials(loadEnvFile, absolutePath) {
|
|
|
7670
8171
|
return { credentials };
|
|
7671
8172
|
}
|
|
7672
8173
|
async function getGlobalCredsHint(getFs, loadEnvFile, absolutePath, envFilePath) {
|
|
7673
|
-
const
|
|
7674
|
-
const globalPath =
|
|
8174
|
+
const fs = getFs();
|
|
8175
|
+
const globalPath = fs.path.join(fs.env.homedir(), envFilePath);
|
|
7675
8176
|
if (absolutePath === globalPath)
|
|
7676
8177
|
return;
|
|
7677
|
-
if (!await
|
|
8178
|
+
if (!await fs.exists(globalPath))
|
|
7678
8179
|
return;
|
|
7679
8180
|
try {
|
|
7680
8181
|
const globalCreds = await loadEnvFile({ envPath: globalPath });
|
|
@@ -8089,6 +8590,51 @@ function normalizeTokenRefreshUnavailableFailure() {
|
|
|
8089
8590
|
function errorMessage(error) {
|
|
8090
8591
|
return error instanceof Error ? error.message : String(error);
|
|
8091
8592
|
}
|
|
8593
|
+
|
|
8594
|
+
// ../auth/src/authContext.ts
|
|
8595
|
+
class AuthContextUnavailableError extends Error {
|
|
8596
|
+
instructionContext;
|
|
8597
|
+
sessionHint;
|
|
8598
|
+
errorCode = "authentication_required";
|
|
8599
|
+
retry = "RetryWillNotFix";
|
|
8600
|
+
constructor(message, instructionContext = "auth", sessionHint) {
|
|
8601
|
+
super(message);
|
|
8602
|
+
this.instructionContext = instructionContext;
|
|
8603
|
+
this.sessionHint = sessionHint;
|
|
8604
|
+
this.name = "AuthContextUnavailableError";
|
|
8605
|
+
}
|
|
8606
|
+
}
|
|
8607
|
+
var getAuthContext = async (options = {}) => {
|
|
8608
|
+
const status = await getLoginStatusAsync({
|
|
8609
|
+
ensureTokenValidityMinutes: options.ensureTokenValidityMinutes,
|
|
8610
|
+
envFilePath: options.envFilePath
|
|
8611
|
+
});
|
|
8612
|
+
if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken) {
|
|
8613
|
+
throw new AuthContextUnavailableError(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.", "auth", status.hint);
|
|
8614
|
+
}
|
|
8615
|
+
const tenantName = options.tenant || status.tenantName;
|
|
8616
|
+
if (options.requireOrganizationId && !status.organizationId) {
|
|
8617
|
+
throw new AuthContextUnavailableError("Organization ID not available. Ensure you are logged in with an organization context.", "identity");
|
|
8618
|
+
}
|
|
8619
|
+
if (options.requireOrganizationName && !status.organizationName) {
|
|
8620
|
+
throw new AuthContextUnavailableError("Organization name not available. Ensure you are logged in with an organization context.", "identity");
|
|
8621
|
+
}
|
|
8622
|
+
if (options.requireTenantId && !status.tenantId) {
|
|
8623
|
+
throw new AuthContextUnavailableError(`Tenant ID not available. Ensure UIPATH_TENANT_ID is set.${status.hint ? ` ${status.hint}` : ""}`, "identity", status.hint);
|
|
8624
|
+
}
|
|
8625
|
+
if (options.requireTenantName && !tenantName) {
|
|
8626
|
+
throw new AuthContextUnavailableError("Tenant not provided and UIPATH_TENANT_NAME not set. Run 'uip login' to select a tenant, or use 'uip login tenant set <tenant>' to switch tenants.", "identity");
|
|
8627
|
+
}
|
|
8628
|
+
return {
|
|
8629
|
+
baseUrl: status.baseUrl,
|
|
8630
|
+
accessToken: status.accessToken,
|
|
8631
|
+
organizationId: status.organizationId,
|
|
8632
|
+
organizationName: status.organizationName,
|
|
8633
|
+
tenantId: status.tenantId,
|
|
8634
|
+
tenantName,
|
|
8635
|
+
identity: status.identity
|
|
8636
|
+
};
|
|
8637
|
+
};
|
|
8092
8638
|
// ../auth/src/selectTenant.ts
|
|
8093
8639
|
var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
|
|
8094
8640
|
var INVALID_TENANT_CODE = "INVALID_TENANT";
|
|
@@ -8101,7 +8647,7 @@ var package_default2 = {
|
|
|
8101
8647
|
name: "@uipath/ixp-sdk",
|
|
8102
8648
|
author: "UiPath",
|
|
8103
8649
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
8104
|
-
version: "1.
|
|
8650
|
+
version: "1.206.0-preview.282",
|
|
8105
8651
|
description: "SDK for the UiPath IXP (Intelligent eXtraction Platform) API — projects, taxonomies, prompts, predictions, and model publishing.",
|
|
8106
8652
|
repository: {
|
|
8107
8653
|
type: "git",
|
|
@@ -8159,22 +8705,17 @@ function buildIxpUserAgent() {
|
|
|
8159
8705
|
|
|
8160
8706
|
// ../ixp-sdk/src/client-factory.ts
|
|
8161
8707
|
async function createIxpConfig(options) {
|
|
8162
|
-
const
|
|
8163
|
-
|
|
8708
|
+
const auth = await getAuthContext({
|
|
8709
|
+
tenant: options?.tenant,
|
|
8710
|
+
ensureTokenValidityMinutes: options?.loginValidity,
|
|
8711
|
+
requireOrganizationId: true,
|
|
8712
|
+
requireTenantName: true
|
|
8164
8713
|
});
|
|
8165
|
-
if (status.loginStatus !== "Logged in" || !status.accessToken || !status.baseUrl || !status.organizationId) {
|
|
8166
|
-
const message = status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.";
|
|
8167
|
-
throw new Error(message);
|
|
8168
|
-
}
|
|
8169
|
-
const tenantName = options?.tenant ?? status.tenantName;
|
|
8170
|
-
if (!tenantName) {
|
|
8171
|
-
throw new Error("Tenant not provided and UIPATH_TENANT_NAME not set. Run 'uip login' to select a tenant, or use 'uip login tenant set <tenant>' to switch tenants.");
|
|
8172
|
-
}
|
|
8173
8714
|
return {
|
|
8174
|
-
baseUrl:
|
|
8175
|
-
accessToken:
|
|
8176
|
-
organizationId:
|
|
8177
|
-
tenantName,
|
|
8715
|
+
baseUrl: auth.baseUrl,
|
|
8716
|
+
accessToken: auth.accessToken,
|
|
8717
|
+
organizationId: auth.organizationId,
|
|
8718
|
+
tenantName: auth.tenantName,
|
|
8178
8719
|
userAgent: buildIxpUserAgent()
|
|
8179
8720
|
};
|
|
8180
8721
|
}
|
|
@@ -8201,8 +8742,8 @@ var JSON_CONTENT_HEADERS = {
|
|
|
8201
8742
|
class IxpHttpError extends Error {
|
|
8202
8743
|
status;
|
|
8203
8744
|
response;
|
|
8204
|
-
constructor(
|
|
8205
|
-
super(`${
|
|
8745
|
+
constructor(errorMessage, status, statusText, url, body) {
|
|
8746
|
+
super(`${errorMessage}: ${status} ${statusText} - URL: ${url} - ${body}`);
|
|
8206
8747
|
this.name = "IxpHttpError";
|
|
8207
8748
|
this.status = status;
|
|
8208
8749
|
this.response = {
|
|
@@ -8212,7 +8753,7 @@ class IxpHttpError extends Error {
|
|
|
8212
8753
|
};
|
|
8213
8754
|
}
|
|
8214
8755
|
}
|
|
8215
|
-
async function request(config, url, init,
|
|
8756
|
+
async function request(config, url, init, errorMessage) {
|
|
8216
8757
|
const response = await fetch(url, {
|
|
8217
8758
|
method: init.method,
|
|
8218
8759
|
body: init.body,
|
|
@@ -8220,7 +8761,7 @@ async function request(config, url, init, errorMessage2) {
|
|
|
8220
8761
|
});
|
|
8221
8762
|
if (!response.ok) {
|
|
8222
8763
|
const errorText = await response.text();
|
|
8223
|
-
throw new IxpHttpError(
|
|
8764
|
+
throw new IxpHttpError(errorMessage, response.status, response.statusText, url, errorText);
|
|
8224
8765
|
}
|
|
8225
8766
|
return await response.json();
|
|
8226
8767
|
}
|
|
@@ -8230,27 +8771,27 @@ var DESIGNTIME_API_VERSION = "1.0";
|
|
|
8230
8771
|
function designtimeBasePath(config) {
|
|
8231
8772
|
return platformBasePath(config, "du_/api/designtimeapi");
|
|
8232
8773
|
}
|
|
8233
|
-
function designtimeUrl(config,
|
|
8234
|
-
const separator =
|
|
8235
|
-
return `${designtimeBasePath(config)}${
|
|
8774
|
+
function designtimeUrl(config, path) {
|
|
8775
|
+
const separator = path.includes("?") ? "&" : "?";
|
|
8776
|
+
return `${designtimeBasePath(config)}${path}${separator}api-version=${DESIGNTIME_API_VERSION}`;
|
|
8236
8777
|
}
|
|
8237
|
-
async function designtimeGet(config,
|
|
8238
|
-
return request(config, designtimeUrl(config,
|
|
8778
|
+
async function designtimeGet(config, path, errorMessage) {
|
|
8779
|
+
return request(config, designtimeUrl(config, path), { method: "GET" }, errorMessage);
|
|
8239
8780
|
}
|
|
8240
|
-
async function designtimePost(config,
|
|
8241
|
-
return request(config, designtimeUrl(config,
|
|
8781
|
+
async function designtimePost(config, path, body, errorMessage) {
|
|
8782
|
+
return request(config, designtimeUrl(config, path), { method: "POST", body: JSON.stringify(body ?? {}) }, errorMessage);
|
|
8242
8783
|
}
|
|
8243
|
-
async function designtimePut(config,
|
|
8244
|
-
return request(config, designtimeUrl(config,
|
|
8784
|
+
async function designtimePut(config, path, body, errorMessage) {
|
|
8785
|
+
return request(config, designtimeUrl(config, path), { method: "PUT", body: JSON.stringify(body ?? {}) }, errorMessage);
|
|
8245
8786
|
}
|
|
8246
|
-
async function designtimePatch(config,
|
|
8247
|
-
return request(config, designtimeUrl(config,
|
|
8787
|
+
async function designtimePatch(config, path, body, errorMessage) {
|
|
8788
|
+
return request(config, designtimeUrl(config, path), { method: "PATCH", body: JSON.stringify(body ?? {}) }, errorMessage);
|
|
8248
8789
|
}
|
|
8249
|
-
async function designtimeDelete(config,
|
|
8250
|
-
return request(config, designtimeUrl(config,
|
|
8790
|
+
async function designtimeDelete(config, path, errorMessage) {
|
|
8791
|
+
return request(config, designtimeUrl(config, path), { method: "DELETE" }, errorMessage);
|
|
8251
8792
|
}
|
|
8252
|
-
async function designtimeUploadMultipart(config,
|
|
8253
|
-
const url = designtimeUrl(config,
|
|
8793
|
+
async function designtimeUploadMultipart(config, path, formData, errorMessage) {
|
|
8794
|
+
const url = designtimeUrl(config, path);
|
|
8254
8795
|
const response = await fetch(url, {
|
|
8255
8796
|
method: "POST",
|
|
8256
8797
|
headers: baseHeaders(config),
|
|
@@ -8258,19 +8799,19 @@ async function designtimeUploadMultipart(config, path2, formData, errorMessage2)
|
|
|
8258
8799
|
});
|
|
8259
8800
|
if (!response.ok) {
|
|
8260
8801
|
const errorText = await response.text();
|
|
8261
|
-
throw new IxpHttpError(
|
|
8802
|
+
throw new IxpHttpError(errorMessage, response.status, response.statusText, url, errorText);
|
|
8262
8803
|
}
|
|
8263
8804
|
return await response.json();
|
|
8264
8805
|
}
|
|
8265
|
-
async function designtimeDownloadBinary(config,
|
|
8266
|
-
const url = designtimeUrl(config,
|
|
8806
|
+
async function designtimeDownloadBinary(config, path, errorMessage) {
|
|
8807
|
+
const url = designtimeUrl(config, path);
|
|
8267
8808
|
const response = await fetch(url, {
|
|
8268
8809
|
method: "GET",
|
|
8269
8810
|
headers: baseHeaders(config)
|
|
8270
8811
|
});
|
|
8271
8812
|
if (!response.ok) {
|
|
8272
8813
|
const errorText = await response.text();
|
|
8273
|
-
throw new IxpHttpError(
|
|
8814
|
+
throw new IxpHttpError(errorMessage, response.status, response.statusText, url, errorText);
|
|
8274
8815
|
}
|
|
8275
8816
|
const contentType = response.headers.get("content-type") || "application/octet-stream";
|
|
8276
8817
|
return { buffer: await response.arrayBuffer(), contentType };
|
|
@@ -8430,14 +8971,14 @@ async function configureModel(config, projectName, options) {
|
|
|
8430
8971
|
function dataTypesPath(projectName) {
|
|
8431
8972
|
return `/api/projects/${encodeURIComponent(projectName)}/data-types`;
|
|
8432
8973
|
}
|
|
8433
|
-
async function createDataType(config, projectName,
|
|
8434
|
-
return designtimePost(config, dataTypesPath(projectName),
|
|
8974
|
+
async function createDataType(config, projectName, request) {
|
|
8975
|
+
return designtimePost(config, dataTypesPath(projectName), request, "Failed to add data type");
|
|
8435
8976
|
}
|
|
8436
|
-
async function renameDataType(config, projectName, dataTypeName,
|
|
8437
|
-
return designtimePost(config, `${dataTypesPath(projectName)}/${encodeURIComponent(dataTypeName)}/rename`,
|
|
8977
|
+
async function renameDataType(config, projectName, dataTypeName, request) {
|
|
8978
|
+
return designtimePost(config, `${dataTypesPath(projectName)}/${encodeURIComponent(dataTypeName)}/rename`, request, "Failed to rename data type");
|
|
8438
8979
|
}
|
|
8439
|
-
async function updateDataTypeInstructions(config, projectName, dataTypeName,
|
|
8440
|
-
return designtimePost(config, `${dataTypesPath(projectName)}/${encodeURIComponent(dataTypeName)}/update-instructions`,
|
|
8980
|
+
async function updateDataTypeInstructions(config, projectName, dataTypeName, request) {
|
|
8981
|
+
return designtimePost(config, `${dataTypesPath(projectName)}/${encodeURIComponent(dataTypeName)}/update-instructions`, request, "Failed to update data type instructions");
|
|
8441
8982
|
}
|
|
8442
8983
|
async function deleteDataType(config, projectName, dataTypeName) {
|
|
8443
8984
|
return designtimeDelete(config, `${dataTypesPath(projectName)}/${encodeURIComponent(dataTypeName)}`, "Failed to delete data type");
|
|
@@ -8445,17 +8986,17 @@ async function deleteDataType(config, projectName, dataTypeName) {
|
|
|
8445
8986
|
function groupsPath(projectName) {
|
|
8446
8987
|
return `/api/projects/${encodeURIComponent(projectName)}/groups`;
|
|
8447
8988
|
}
|
|
8448
|
-
async function createGroup(config, projectName,
|
|
8449
|
-
return designtimePost(config, groupsPath(projectName),
|
|
8989
|
+
async function createGroup(config, projectName, request) {
|
|
8990
|
+
return designtimePost(config, groupsPath(projectName), request, "Failed to add field group");
|
|
8450
8991
|
}
|
|
8451
8992
|
async function deleteGroup(config, projectName, groupName) {
|
|
8452
8993
|
return designtimeDelete(config, `${groupsPath(projectName)}/${encodeURIComponent(groupName)}`, "Failed to delete field group");
|
|
8453
8994
|
}
|
|
8454
|
-
async function renameGroup(config, projectName, groupName,
|
|
8455
|
-
return designtimePost(config, `${groupsPath(projectName)}/${encodeURIComponent(groupName)}/rename`,
|
|
8995
|
+
async function renameGroup(config, projectName, groupName, request) {
|
|
8996
|
+
return designtimePost(config, `${groupsPath(projectName)}/${encodeURIComponent(groupName)}/rename`, request, "Failed to rename field group");
|
|
8456
8997
|
}
|
|
8457
|
-
async function updateGroupPrompts(config, projectName,
|
|
8458
|
-
return designtimePost(config, `${groupsPath(projectName)}/update-prompts`,
|
|
8998
|
+
async function updateGroupPrompts(config, projectName, request) {
|
|
8999
|
+
return designtimePost(config, `${groupsPath(projectName)}/update-prompts`, request, "Failed to update group prompts");
|
|
8459
9000
|
}
|
|
8460
9001
|
function fieldsBasePath(projectName, groupName) {
|
|
8461
9002
|
return `/api/projects/${encodeURIComponent(projectName)}/groups/${encodeURIComponent(groupName)}/fields`;
|
|
@@ -8659,9 +9200,9 @@ var DATA_TYPES_DELETE_EXAMPLES = [
|
|
|
8659
9200
|
}
|
|
8660
9201
|
}
|
|
8661
9202
|
];
|
|
8662
|
-
var registerDataTypesCommand = (
|
|
8663
|
-
const dataTypes =
|
|
8664
|
-
dataTypes.command("add").description("Create a new data type in the project").argument("<project-name>", "Project name").requiredOption("--name <name>", `Data type name (at most ${MAX_NAME_LENGTH} characters)`).requiredOption("--kind <kind>", "Underlying data type kind: text, date, money, number, boolean, choice").requiredOption("--instructions <text>", `Instructions describing what this type represents and where its values appear (at most ${MAX_INSTRUCTIONS_LENGTH} characters)`).option("--input-value <mode>", "Whether the value appears verbatim in the document (exact-match) or is inferred/computed (inferred). Required when --kind is text or choice; forbidden for date, money, number, and boolean (those kinds don't have this property — matches the IXP UI's radio visibility).").option("--choices <json>", 'Required when --kind choice. JSON array of choices: [{"value":"<canonical>","alternates":["<alt1>","<alt2>",...]}]. `value` (required) is the canonical display name (model output). `alternates` (optional, defaults to []) are alternate spellings the model maps to `value` — omit or set to [] when the canonical value is the only matched form.').addOption(new
|
|
9203
|
+
var registerDataTypesCommand = (program) => {
|
|
9204
|
+
const dataTypes = program.command("data-types").description("Manage data types (entity_defs) — the reusable type definitions fields reference via field_type_id");
|
|
9205
|
+
dataTypes.command("add").description("Create a new data type in the project").argument("<project-name>", "Project name").requiredOption("--name <name>", `Data type name (at most ${MAX_NAME_LENGTH} characters)`).requiredOption("--kind <kind>", "Underlying data type kind: text, date, money, number, boolean, choice").requiredOption("--instructions <text>", `Instructions describing what this type represents and where its values appear (at most ${MAX_INSTRUCTIONS_LENGTH} characters)`).option("--input-value <mode>", "Whether the value appears verbatim in the document (exact-match) or is inferred/computed (inferred). Required when --kind is text or choice; forbidden for date, money, number, and boolean (those kinds don't have this property — matches the IXP UI's radio visibility).").option("--choices <json>", 'Required when --kind choice. JSON array of choices: [{"value":"<canonical>","alternates":["<alt1>","<alt2>",...]}]. `value` (required) is the canonical display name (model output). `alternates` (optional, defaults to []) are alternate spellings the model maps to `value` — omit or set to [] when the canonical value is the only matched form.').addOption(new Option2("--choices-file <path>", jsonFileOptionHelp("--choices")).conflicts("choices")).addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(DATA_TYPES_ADD_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
|
|
8665
9206
|
const [err, response] = await catchError((async () => {
|
|
8666
9207
|
const rawChoices = await readJsonOption({
|
|
8667
9208
|
inline: options.choices,
|
|
@@ -8672,7 +9213,7 @@ var registerDataTypesCommand = (program2) => {
|
|
|
8672
9213
|
const config = await createIxpConfig({
|
|
8673
9214
|
tenant: options.tenant
|
|
8674
9215
|
});
|
|
8675
|
-
const
|
|
9216
|
+
const request = {
|
|
8676
9217
|
Name: options.name,
|
|
8677
9218
|
Kind: options.kind,
|
|
8678
9219
|
Instructions: options.instructions,
|
|
@@ -8681,7 +9222,7 @@ var registerDataTypesCommand = (program2) => {
|
|
|
8681
9222
|
},
|
|
8682
9223
|
...choices && { Choices: choices }
|
|
8683
9224
|
};
|
|
8684
|
-
return await createDataType(config, projectName,
|
|
9225
|
+
return await createDataType(config, projectName, request);
|
|
8685
9226
|
})());
|
|
8686
9227
|
if (err) {
|
|
8687
9228
|
await emitError(err, "Failed to add data type");
|
|
@@ -8699,10 +9240,10 @@ var registerDataTypesCommand = (program2) => {
|
|
|
8699
9240
|
const config = await createIxpConfig({
|
|
8700
9241
|
tenant: options.tenant
|
|
8701
9242
|
});
|
|
8702
|
-
const
|
|
9243
|
+
const request = {
|
|
8703
9244
|
Instructions: options.instructions
|
|
8704
9245
|
};
|
|
8705
|
-
return await updateDataTypeInstructions(config, projectName, options.name,
|
|
9246
|
+
return await updateDataTypeInstructions(config, projectName, options.name, request);
|
|
8706
9247
|
})());
|
|
8707
9248
|
if (err) {
|
|
8708
9249
|
await emitError(err, "Failed to update data type instructions");
|
|
@@ -8720,10 +9261,10 @@ var registerDataTypesCommand = (program2) => {
|
|
|
8720
9261
|
const config = await createIxpConfig({
|
|
8721
9262
|
tenant: options.tenant
|
|
8722
9263
|
});
|
|
8723
|
-
const
|
|
9264
|
+
const request = {
|
|
8724
9265
|
NewName: options.newName
|
|
8725
9266
|
};
|
|
8726
|
-
return await renameDataType(config, projectName, options.name,
|
|
9267
|
+
return await renameDataType(config, projectName, options.name, request);
|
|
8727
9268
|
})());
|
|
8728
9269
|
if (err) {
|
|
8729
9270
|
await emitError(err, "Failed to rename data type");
|
|
@@ -8839,8 +9380,8 @@ var DEPLOYMENTS_LIST_EXAMPLES = [
|
|
|
8839
9380
|
}
|
|
8840
9381
|
}
|
|
8841
9382
|
];
|
|
8842
|
-
var registerDeploymentsCommand = (
|
|
8843
|
-
const deployments =
|
|
9383
|
+
var registerDeploymentsCommand = (program) => {
|
|
9384
|
+
const deployments = program.command("deployments").description("Manage IXP deployments — deploy trained model versions to Orchestrator folders, move a deployment to another version, and inspect the taxonomy pinned to a version");
|
|
8844
9385
|
deployments.command("create").description("Deploy a trained model version to an Orchestrator folder, making it callable at runtime by activities and Maestro Flow. Only ever adds a deployment — moving an existing one is `deployments upgrade`.").argument("<project-name>", "Project name").requiredOption("--version <number>", "Trained model version to deploy (non-negative integer). Get available versions from `uip ixp projects list-models <project-name> --output json`.", (raw) => parseBoundedInt(raw, "--version", { min: 0, max: 1e6 })).requiredOption("--folder-key <guid>", `Orchestrator folder key (GUID) to deploy into, at most ${MAX_FOLDER_KEY_LENGTH} characters. Get it from \`uip or folders list --output json\`.`).option("--title <title>", `Title to deploy under, at most ${MAX_TITLE_LENGTH} characters (defaults to the project name minus its '-ixp' suffix). Comes back verbatim as DeploymentTitle; the backend slugs and suffixes it into the name the runtime resolves, returned as DeploymentName.`).addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(DEPLOYMENTS_CREATE_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
|
|
8845
9386
|
const [err, deployment] = await catchError((async () => {
|
|
8846
9387
|
const config = await createIxpConfig({
|
|
@@ -8969,8 +9510,8 @@ function applyDetectedExtension(targetPath, detectedExt) {
|
|
|
8969
9510
|
return targetPath + detectedExt;
|
|
8970
9511
|
}
|
|
8971
9512
|
function defaultDownloadPath() {
|
|
8972
|
-
const
|
|
8973
|
-
return
|
|
9513
|
+
const fs = getFileSystem();
|
|
9514
|
+
return fs.path.join(fs.env.tmpdir(), "ixp_document");
|
|
8974
9515
|
}
|
|
8975
9516
|
var DOCUMENTS_LIST_EXAMPLES = [
|
|
8976
9517
|
{
|
|
@@ -9053,8 +9594,8 @@ var DOCUMENTS_DELETE_EXAMPLES = [
|
|
|
9053
9594
|
}
|
|
9054
9595
|
}
|
|
9055
9596
|
];
|
|
9056
|
-
var registerDocumentsCommand = (
|
|
9057
|
-
const document =
|
|
9597
|
+
var registerDocumentsCommand = (program) => {
|
|
9598
|
+
const document = program.command("documents").description("Read IXP document content");
|
|
9058
9599
|
document.command("list").description("List all documents in a project").argument("<project-name>", "Project name").option("-l, --limit <number>", "Number of items to return (1-10000)", parseLimit, DEFAULT_PAGE_SIZE).option("--offset <number>", "Number of items to skip (0-1000000)", parseOffset, 0).addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(DOCUMENTS_LIST_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
|
|
9059
9600
|
const [err, page] = await catchError((async () => {
|
|
9060
9601
|
const config = await createIxpConfig({
|
|
@@ -9084,9 +9625,9 @@ var registerDocumentsCommand = (program2) => {
|
|
|
9084
9625
|
const { buffer, contentType } = await downloadDocument(config, projectName, documentUid);
|
|
9085
9626
|
const bytes = new Uint8Array(buffer);
|
|
9086
9627
|
const detectedExt = extensionForContentType(contentType);
|
|
9087
|
-
const
|
|
9628
|
+
const fs = getFileSystem();
|
|
9088
9629
|
const finalPath = applyDetectedExtension(options.outputFile, detectedExt);
|
|
9089
|
-
await
|
|
9630
|
+
await fs.writeFile(finalPath, bytes);
|
|
9090
9631
|
return {
|
|
9091
9632
|
path: finalPath,
|
|
9092
9633
|
contentType,
|
|
@@ -9111,17 +9652,17 @@ var registerDocumentsCommand = (program2) => {
|
|
|
9111
9652
|
addDeprecatedOptionAlias(download, "--output <path>", "--output-file");
|
|
9112
9653
|
document.command("upload").description("Upload a document file to an existing project").argument("<project-name>", "Project name").argument("<file>", "Path to the document file to upload").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(DOCUMENTS_UPLOAD_EXAMPLES).trackedAction(processContext, async (projectName, file, options) => {
|
|
9113
9654
|
const [err, response] = await catchError((async () => {
|
|
9114
|
-
const
|
|
9115
|
-
const resolvedPath =
|
|
9116
|
-
const filename =
|
|
9655
|
+
const fs = getFileSystem();
|
|
9656
|
+
const resolvedPath = fs.path.resolve(file);
|
|
9657
|
+
const filename = fs.path.basename(resolvedPath);
|
|
9117
9658
|
const ext = getExtension(filename);
|
|
9118
9659
|
if (!SUPPORTED_DOCUMENT_EXTENSIONS.has(ext)) {
|
|
9119
9660
|
throw new Error(`Unsupported file type "${ext || "(none)"}". Supported: ${[...SUPPORTED_DOCUMENT_EXTENSIONS].join(", ")}`);
|
|
9120
9661
|
}
|
|
9121
|
-
if (!await
|
|
9662
|
+
if (!await fs.exists(resolvedPath)) {
|
|
9122
9663
|
throw new Error(`File not found: ${resolvedPath}`);
|
|
9123
9664
|
}
|
|
9124
|
-
const fileBuffer = await
|
|
9665
|
+
const fileBuffer = await fs.readFile(resolvedPath);
|
|
9125
9666
|
if (!fileBuffer) {
|
|
9126
9667
|
throw new Error(`Failed to read file: ${resolvedPath}`);
|
|
9127
9668
|
}
|
|
@@ -9251,8 +9792,8 @@ var FIELDS_UPDATE_PROMPTS_EXAMPLES = [
|
|
|
9251
9792
|
}
|
|
9252
9793
|
}
|
|
9253
9794
|
];
|
|
9254
|
-
var registerFieldsCommand = (
|
|
9255
|
-
const fields =
|
|
9795
|
+
var registerFieldsCommand = (program) => {
|
|
9796
|
+
const fields = program.command("fields").description("Edit fields within a project's field groups (label_defs)");
|
|
9256
9797
|
fields.command("add").description("Add a new field to a field group").argument("<project-name>", "Project name").requiredOption("--group <name>", "Field group (label_def) name").requiredOption("--field <name>", `New field name (at most ${MAX_NAME_LENGTH} characters)`).requiredOption("--type <type-name>", `Field type — name of an entity_def in the project's taxonomy (at most ${MAX_NAME_LENGTH} characters)`).requiredOption("--instructions <text>", `Instructions for the new field — describes what to extract and where to find it (at most ${MAX_INSTRUCTIONS_LENGTH} characters)`).addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(FIELDS_ADD_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
|
|
9257
9798
|
const [err, response] = await catchError((async () => {
|
|
9258
9799
|
const config = await createIxpConfig({
|
|
@@ -9333,7 +9874,7 @@ var registerFieldsCommand = (program2) => {
|
|
|
9333
9874
|
Data: response
|
|
9334
9875
|
}, { preserveDataKeys: true });
|
|
9335
9876
|
});
|
|
9336
|
-
const updatePrompts = fields.command("update-prompts").description("Bulk-update per-field extraction instructions. Match by field name within each update's field group; existing definitions preserved.").argument("<project-name>", "Project name").option("--updates <json>", `JSON array of per-field instruction updates: [{"group":"Invoice","name":"Invoice Number","instructions":"..."}]. "group" is the field group (label_def) name, "name" is the field (moon_form) name within that group. Each \`instructions\` is at most ${MAX_INSTRUCTIONS_LENGTH} characters, each \`name\` at most ${MAX_NAME_LENGTH}. Required unless --updates-file is given.`).addOption(new
|
|
9877
|
+
const updatePrompts = fields.command("update-prompts").description("Bulk-update per-field extraction instructions. Match by field name within each update's field group; existing definitions preserved.").argument("<project-name>", "Project name").option("--updates <json>", `JSON array of per-field instruction updates: [{"group":"Invoice","name":"Invoice Number","instructions":"..."}]. "group" is the field group (label_def) name, "name" is the field (moon_form) name within that group. Each \`instructions\` is at most ${MAX_INSTRUCTIONS_LENGTH} characters, each \`name\` at most ${MAX_NAME_LENGTH}. Required unless --updates-file is given.`).addOption(new Option2("--updates-file <path>", jsonFileOptionHelp("--updates")).conflicts("updates")).addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(FIELDS_UPDATE_PROMPTS_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
|
|
9337
9878
|
const [err, response] = await catchError((async () => {
|
|
9338
9879
|
const rawUpdates = await readJsonOption({
|
|
9339
9880
|
inline: options.updates,
|
|
@@ -9494,9 +10035,9 @@ var GROUPS_UPDATE_PROMPTS_EXAMPLES = [
|
|
|
9494
10035
|
}
|
|
9495
10036
|
}
|
|
9496
10037
|
];
|
|
9497
|
-
var registerGroupsCommand = (
|
|
9498
|
-
const groups =
|
|
9499
|
-
const add = groups.command("add").description("Create a new field group with instructions and at least one field").argument("<project-name>", "Project name").requiredOption("--name <name>", `New field group name (at most ${MAX_NAME_LENGTH} characters)`).requiredOption("--instructions <text>", `Instructions for the group — describes what kind of document/section it covers (at most ${MAX_INSTRUCTIONS_LENGTH} characters)`).option("--fields <json>", `JSON array of fields to create in the group (at least one): [{"name":"...","type":"<type-name>","instructions":"..."}]. \`type\` is the name of an entity_def in the project taxonomy. \`name\` and \`type\` are at most ${MAX_NAME_LENGTH} characters, \`instructions\` at most ${MAX_INSTRUCTIONS_LENGTH}. Required unless --fields-file is given.`).addOption(new
|
|
10038
|
+
var registerGroupsCommand = (program) => {
|
|
10039
|
+
const groups = program.command("groups").description("Manage field groups (label_defs) — the document type containers for fields");
|
|
10040
|
+
const add = groups.command("add").description("Create a new field group with instructions and at least one field").argument("<project-name>", "Project name").requiredOption("--name <name>", `New field group name (at most ${MAX_NAME_LENGTH} characters)`).requiredOption("--instructions <text>", `Instructions for the group — describes what kind of document/section it covers (at most ${MAX_INSTRUCTIONS_LENGTH} characters)`).option("--fields <json>", `JSON array of fields to create in the group (at least one): [{"name":"...","type":"<type-name>","instructions":"..."}]. \`type\` is the name of an entity_def in the project taxonomy. \`name\` and \`type\` are at most ${MAX_NAME_LENGTH} characters, \`instructions\` at most ${MAX_INSTRUCTIONS_LENGTH}. Required unless --fields-file is given.`).addOption(new Option2("--fields-file <path>", jsonFileOptionHelp("--fields")).conflicts("fields")).addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(GROUPS_ADD_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
|
|
9500
10041
|
const [err, response] = await catchError((async () => {
|
|
9501
10042
|
const fields = parseFieldsJson(await readJsonOption({
|
|
9502
10043
|
inline: options.fields,
|
|
@@ -9506,12 +10047,12 @@ var registerGroupsCommand = (program2) => {
|
|
|
9506
10047
|
const config = await createIxpConfig({
|
|
9507
10048
|
tenant: options.tenant
|
|
9508
10049
|
});
|
|
9509
|
-
const
|
|
10050
|
+
const request = {
|
|
9510
10051
|
Name: options.name,
|
|
9511
10052
|
Instructions: options.instructions,
|
|
9512
10053
|
Fields: fields
|
|
9513
10054
|
};
|
|
9514
|
-
return await createGroup(config, projectName,
|
|
10055
|
+
return await createGroup(config, projectName, request);
|
|
9515
10056
|
})());
|
|
9516
10057
|
if (err) {
|
|
9517
10058
|
await emitError(err, "Failed to add field group");
|
|
@@ -9565,7 +10106,7 @@ var registerGroupsCommand = (program2) => {
|
|
|
9565
10106
|
Data: response
|
|
9566
10107
|
}, { preserveDataKeys: true });
|
|
9567
10108
|
});
|
|
9568
|
-
const updatePrompts = groups.command("update-prompts").description("Bulk-update field group (label_def) extraction instructions. Match by group name; existing fields preserved.").argument("<project-name>", "Project name").option("--updates <json>", `JSON array of field group instruction updates: [{"name":"Invoice","instructions":"..."}]. Match by label_def name. Each \`instructions\` is at most ${MAX_INSTRUCTIONS_LENGTH} characters, each \`name\` at most ${MAX_NAME_LENGTH}. Required unless --updates-file is given.`).addOption(new
|
|
10109
|
+
const updatePrompts = groups.command("update-prompts").description("Bulk-update field group (label_def) extraction instructions. Match by group name; existing fields preserved.").argument("<project-name>", "Project name").option("--updates <json>", `JSON array of field group instruction updates: [{"name":"Invoice","instructions":"..."}]. Match by label_def name. Each \`instructions\` is at most ${MAX_INSTRUCTIONS_LENGTH} characters, each \`name\` at most ${MAX_NAME_LENGTH}. Required unless --updates-file is given.`).addOption(new Option2("--updates-file <path>", jsonFileOptionHelp("--updates")).conflicts("updates")).addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(GROUPS_UPDATE_PROMPTS_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
|
|
9569
10110
|
const [err, response] = await catchError((async () => {
|
|
9570
10111
|
const updates = parseUpdatesJson(await readJsonOption({
|
|
9571
10112
|
inline: options.updates,
|
|
@@ -9575,10 +10116,10 @@ var registerGroupsCommand = (program2) => {
|
|
|
9575
10116
|
const config = await createIxpConfig({
|
|
9576
10117
|
tenant: options.tenant
|
|
9577
10118
|
});
|
|
9578
|
-
const
|
|
10119
|
+
const request = {
|
|
9579
10120
|
Updates: updates
|
|
9580
10121
|
};
|
|
9581
|
-
return await updateGroupPrompts(config, projectName,
|
|
10122
|
+
return await updateGroupPrompts(config, projectName, request);
|
|
9582
10123
|
})());
|
|
9583
10124
|
if (err) {
|
|
9584
10125
|
await emitError(err, "Failed to update group prompts");
|
|
@@ -10022,9 +10563,9 @@ async function listAllDocumentIds(config, projectName) {
|
|
|
10022
10563
|
}
|
|
10023
10564
|
return ids;
|
|
10024
10565
|
}
|
|
10025
|
-
var registerLabellingsCommand = (
|
|
10026
|
-
const labelling =
|
|
10027
|
-
labelling.command("confirm").description("Confirm IXP-generated predictions as ground truth for one document. Omitting <document-id> confirms every document in the project — deprecated, and removed in the next release. For a repeatable field group, narrow with --group: alone it confirms every occurrence; add --occurrence to confirm ONE occurrence (the ergonomic single-line form); or use --updates to confirm SEVERAL occurrences in one atomic call (one request). --updates is the superset — --occurrence <N> equals --updates with a single entry — so reach for --occurrence for one line and --updates when several lines need confirming together (or with different per-line fields/corrections).").argument("<project-name>", "Project name").argument("[document-id]", "Document ID. Omitting it confirms every document in the project — deprecated, and removed in the next release.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-f, --fields <field-ids>", "Comma-separated field IDs to confirm (omit to confirm all predicted fields). Without --group, confirms each field_id across every occurrence it appears in. With --group + --occurrence, confirms only within that specific occurrence.").option("-c, --corrections <json>", 'Override predicted values while keeping references: [{"field_id":"...","value":"corrected"}]. Applies across every occurrence the field appears in (or just the targeted occurrence when --group + --occurrence are given).').option("--group <name>", 'Target field group (label_def). Must be the FULL label path exactly as shown in the "Name" field of `get-predictions` (e.g. "Invoice > Line Items"), not just the leaf name. On its own, confirms every occurrence of the group as-is. Add --occurrence to target a single occurrence, or --updates to batch specific occurrences in one call. Combine with --fields to limit to specific fields within the group.').option("--occurrence <index>", "Single-occurrence form: 0-based index of ONE occurrence within --group to confirm. Use --fields to limit to specific fields in that occurrence; omit --fields to confirm every predicted field there. Requires --group. Mutually exclusive with --updates — for several occurrences in one call, use --updates instead.").option("--updates <json>", 'Batched form: confirm SEVERAL occurrences of --group in one atomic call. JSON array of {"occurrence":<0-based-index>,"fields"?:["<field_id>",...],"corrections"?:{"<field_id>":"<value>"}}. Per entry: omit "fields" to confirm every predicted field in that occurrence (same default as --occurrence without --fields), or list specific ones. Un-selected fields in a selected occurrence carry forward their existing annotation; occurrences not listed are left as-is. Equivalent to running --occurrence once per entry, but in a single request. Mutually exclusive with --fields, --corrections, and --occurrence.').addOption(new
|
|
10566
|
+
var registerLabellingsCommand = (program) => {
|
|
10567
|
+
const labelling = program.command("labellings").description("Manage IXP labellings and predictions");
|
|
10568
|
+
labelling.command("confirm").description("Confirm IXP-generated predictions as ground truth for one document. Omitting <document-id> confirms every document in the project — deprecated, and removed in the next release. For a repeatable field group, narrow with --group: alone it confirms every occurrence; add --occurrence to confirm ONE occurrence (the ergonomic single-line form); or use --updates to confirm SEVERAL occurrences in one atomic call (one request). --updates is the superset — --occurrence <N> equals --updates with a single entry — so reach for --occurrence for one line and --updates when several lines need confirming together (or with different per-line fields/corrections).").argument("<project-name>", "Project name").argument("[document-id]", "Document ID. Omitting it confirms every document in the project — deprecated, and removed in the next release.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-f, --fields <field-ids>", "Comma-separated field IDs to confirm (omit to confirm all predicted fields). Without --group, confirms each field_id across every occurrence it appears in. With --group + --occurrence, confirms only within that specific occurrence.").option("-c, --corrections <json>", 'Override predicted values while keeping references: [{"field_id":"...","value":"corrected"}]. Applies across every occurrence the field appears in (or just the targeted occurrence when --group + --occurrence are given).').option("--group <name>", 'Target field group (label_def). Must be the FULL label path exactly as shown in the "Name" field of `get-predictions` (e.g. "Invoice > Line Items"), not just the leaf name. On its own, confirms every occurrence of the group as-is. Add --occurrence to target a single occurrence, or --updates to batch specific occurrences in one call. Combine with --fields to limit to specific fields within the group.').option("--occurrence <index>", "Single-occurrence form: 0-based index of ONE occurrence within --group to confirm. Use --fields to limit to specific fields in that occurrence; omit --fields to confirm every predicted field there. Requires --group. Mutually exclusive with --updates — for several occurrences in one call, use --updates instead.").option("--updates <json>", 'Batched form: confirm SEVERAL occurrences of --group in one atomic call. JSON array of {"occurrence":<0-based-index>,"fields"?:["<field_id>",...],"corrections"?:{"<field_id>":"<value>"}}. Per entry: omit "fields" to confirm every predicted field in that occurrence (same default as --occurrence without --fields), or list specific ones. Un-selected fields in a selected occurrence carry forward their existing annotation; occurrences not listed are left as-is. Equivalent to running --occurrence once per entry, but in a single request. Mutually exclusive with --fields, --corrections, and --occurrence.').addOption(new Option2("--updates-file <path>", jsonFileOptionHelp("--updates")).conflicts("updates")).option("-m, --model-version <version>", "Optimistic-concurrency guard: the model version (from `get-predictions`' ModelVersion) the predictions being confirmed were reviewed against. If a retrain has produced a newer version since, the confirm is rejected instead of stamping drifted values as ground truth — re-read predictions and review again. Omit to skip the check.", (raw) => parseBoundedInt(raw, "--model-version", {
|
|
10028
10569
|
min: 0,
|
|
10029
10570
|
max: Number.MAX_SAFE_INTEGER
|
|
10030
10571
|
})).examples(LABELLINGS_CONFIRM_EXAMPLES).trackedAction(processContext, async (projectName, documentUid, options) => {
|
|
@@ -10079,7 +10620,7 @@ var registerLabellingsCommand = (program2) => {
|
|
|
10079
10620
|
}
|
|
10080
10621
|
});
|
|
10081
10622
|
});
|
|
10082
|
-
labelling.command("unconfirm").description("Remove confirmations from a document — the targeted fields go back to un-annotated state. Use to roll back an earlier confirm or mark-missing when you realize it was a mistake. Every other annotation on the document is carried forward. With --fields alone, each field_id is unconfirmed across every occurrence it appears in. For a repeatable field group, narrow with --group: alone it unconfirms every occurrence; add --occurrence to roll back ONE occurrence (the ergonomic single-line form); or use --updates to roll back SEVERAL occurrences in one atomic call. Mirrors `confirm`'s targeting flags.").argument("<project-name>", "Project name").argument("<document-id>", "Document ID").option("-f, --fields <field-ids>", "Comma-separated field IDs to unconfirm. Without --group, unconfirms each field_id across every occurrence it appears in. With --group + --occurrence, limits to that specific occurrence; omit it to unconfirm every annotated field in the targeted occurrence(s).").option("--group <name>", 'Target field group (label_def). Must be the FULL label path exactly as shown in the "Name" field of `get-predictions` (e.g. "Invoice > Line Items"), not just the leaf name. On its own, unconfirms every occurrence of the group. Add --occurrence to target a single occurrence, or --updates to batch specific occurrences in one call. Combine with --fields to limit to specific fields within the group.').option("--occurrence <index>", "Single-occurrence form: 0-based index of ONE occurrence within --group to unconfirm. Use --fields to limit to specific fields in that occurrence; omit --fields to unconfirm every annotated field there. Requires --group. Mutually exclusive with --updates.").option("--updates <json>", 'Batched form: unconfirm SEVERAL occurrences of --group in one atomic call. JSON array of {"occurrence":<0-based-index>,"fields"?:["<field_id>",...]}. Per entry: omit "fields" to unconfirm every annotated field in that occurrence, or list specific ones. Occurrences not listed are left as-is. Mutually exclusive with --fields and --occurrence.').addOption(new
|
|
10623
|
+
labelling.command("unconfirm").description("Remove confirmations from a document — the targeted fields go back to un-annotated state. Use to roll back an earlier confirm or mark-missing when you realize it was a mistake. Every other annotation on the document is carried forward. With --fields alone, each field_id is unconfirmed across every occurrence it appears in. For a repeatable field group, narrow with --group: alone it unconfirms every occurrence; add --occurrence to roll back ONE occurrence (the ergonomic single-line form); or use --updates to roll back SEVERAL occurrences in one atomic call. Mirrors `confirm`'s targeting flags.").argument("<project-name>", "Project name").argument("<document-id>", "Document ID").option("-f, --fields <field-ids>", "Comma-separated field IDs to unconfirm. Without --group, unconfirms each field_id across every occurrence it appears in. With --group + --occurrence, limits to that specific occurrence; omit it to unconfirm every annotated field in the targeted occurrence(s).").option("--group <name>", 'Target field group (label_def). Must be the FULL label path exactly as shown in the "Name" field of `get-predictions` (e.g. "Invoice > Line Items"), not just the leaf name. On its own, unconfirms every occurrence of the group. Add --occurrence to target a single occurrence, or --updates to batch specific occurrences in one call. Combine with --fields to limit to specific fields within the group.').option("--occurrence <index>", "Single-occurrence form: 0-based index of ONE occurrence within --group to unconfirm. Use --fields to limit to specific fields in that occurrence; omit --fields to unconfirm every annotated field there. Requires --group. Mutually exclusive with --updates.").option("--updates <json>", 'Batched form: unconfirm SEVERAL occurrences of --group in one atomic call. JSON array of {"occurrence":<0-based-index>,"fields"?:["<field_id>",...]}. Per entry: omit "fields" to unconfirm every annotated field in that occurrence, or list specific ones. Occurrences not listed are left as-is. Mutually exclusive with --fields and --occurrence.').addOption(new Option2("--updates-file <path>", jsonFileOptionHelp("--updates")).conflicts("updates")).addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(LABELLINGS_UNCONFIRM_EXAMPLES).trackedAction(processContext, async (projectName, documentUid, options) => {
|
|
10083
10624
|
const [err, result] = await catchError((async () => {
|
|
10084
10625
|
validateUnconfirmMode({
|
|
10085
10626
|
...options,
|
|
@@ -10206,7 +10747,7 @@ function parseMetricsModelVersion(raw) {
|
|
|
10206
10747
|
return trimmed;
|
|
10207
10748
|
}
|
|
10208
10749
|
function sleep(ms) {
|
|
10209
|
-
return new Promise((
|
|
10750
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
10210
10751
|
}
|
|
10211
10752
|
function isCreatedProjectPropagationError(error) {
|
|
10212
10753
|
const message = error.message;
|
|
@@ -10575,8 +11116,8 @@ var PROJECTS_IMPORT_TAXONOMY_EXAMPLES = [
|
|
|
10575
11116
|
}
|
|
10576
11117
|
}
|
|
10577
11118
|
];
|
|
10578
|
-
var registerProjectsCommand = (
|
|
10579
|
-
const project =
|
|
11119
|
+
var registerProjectsCommand = (program) => {
|
|
11120
|
+
const project = program.command("projects").description("Manage IXP training projects");
|
|
10580
11121
|
project.command("list").description("List all IXP training projects").option("-l, --limit <number>", "Number of items to return (1-10000)", parseLimit, DEFAULT_PAGE_SIZE).option("--offset <number>", "Number of items to skip (0-1000000)", parseOffset, 0).addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(PROJECTS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
10581
11122
|
const [err, page] = await catchError((async () => {
|
|
10582
11123
|
const config = await createIxpConfig({
|
|
@@ -10828,17 +11369,17 @@ var registerProjectsCommand = (program2) => {
|
|
|
10828
11369
|
});
|
|
10829
11370
|
project.command("create").description("Create an IXP project. Given a folder of documents, uploads them and suggests a taxonomy; without a folder, creates an empty project").argument("<name>", `Project name (at most ${MAX_PROJECT_NAME_LENGTH} characters, not counting leading/trailing spaces)`).argument("[folder-path]", "Path to folder containing documents; omit to create an empty project").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-d, --description <text>", "Description of what to extract from the documents").option("--skip-taxonomy", "Create project and upload docs without suggesting a taxonomy").examples(PROJECTS_CREATE_EXAMPLES).trackedAction(processContext, async (name, folder, options) => {
|
|
10830
11371
|
const [err, result] = await catchError((async () => {
|
|
10831
|
-
const
|
|
11372
|
+
const fs = getFileSystem();
|
|
10832
11373
|
const config = await createIxpConfig({
|
|
10833
11374
|
tenant: options.tenant
|
|
10834
11375
|
});
|
|
10835
11376
|
let allFiles = [];
|
|
10836
11377
|
if (folder !== undefined) {
|
|
10837
|
-
const resolvedFolder =
|
|
10838
|
-
if (!await
|
|
11378
|
+
const resolvedFolder = fs.path.resolve(folder);
|
|
11379
|
+
if (!await fs.exists(resolvedFolder)) {
|
|
10839
11380
|
throw new Error(`Folder not found: ${resolvedFolder}`);
|
|
10840
11381
|
}
|
|
10841
|
-
allFiles = (await
|
|
11382
|
+
allFiles = (await fs.readdir(resolvedFolder)).filter((f) => SUPPORTED_DOCUMENT_EXTENSIONS.has(getExtension(f))).map((f) => fs.path.join(resolvedFolder, f));
|
|
10842
11383
|
if (allFiles.length === 0) {
|
|
10843
11384
|
throw new Error(`No supported documents found in ${resolvedFolder}. Supported: ${[...SUPPORTED_DOCUMENT_EXTENSIONS].join(", ")}`);
|
|
10844
11385
|
}
|
|
@@ -10848,8 +11389,8 @@ var registerProjectsCommand = (program2) => {
|
|
|
10848
11389
|
if (!projectName) {
|
|
10849
11390
|
throw new Error("Project was created but the server did not return its name.");
|
|
10850
11391
|
}
|
|
10851
|
-
const
|
|
10852
|
-
const projectUrl =
|
|
11392
|
+
const project = await waitForCreatedProjectReady(config, projectName, allFiles.length > 0);
|
|
11393
|
+
const projectUrl = project?.ProjectUrl ?? null;
|
|
10853
11394
|
if (allFiles.length === 0) {
|
|
10854
11395
|
return {
|
|
10855
11396
|
kind: "skipped",
|
|
@@ -10862,9 +11403,9 @@ var registerProjectsCommand = (program2) => {
|
|
|
10862
11403
|
const attachmentRefs = [];
|
|
10863
11404
|
const failedUploads = [];
|
|
10864
11405
|
for (const filePath of allFiles) {
|
|
10865
|
-
const filename =
|
|
11406
|
+
const filename = fs.path.basename(filePath);
|
|
10866
11407
|
const [uploadErr, uploadResult] = await catchError((async () => {
|
|
10867
|
-
const fileBuffer = await
|
|
11408
|
+
const fileBuffer = await fs.readFile(filePath);
|
|
10868
11409
|
if (!fileBuffer) {
|
|
10869
11410
|
throw new Error(`Failed to read file: ${filePath}`);
|
|
10870
11411
|
}
|
|
@@ -10906,18 +11447,18 @@ var registerProjectsCommand = (program2) => {
|
|
|
10906
11447
|
let taxonomy;
|
|
10907
11448
|
const lastAttemptErrors = [];
|
|
10908
11449
|
for (let attempt = 1;attempt <= 3; attempt++) {
|
|
10909
|
-
const [
|
|
11450
|
+
const [err, t] = await catchError((async () => {
|
|
10910
11451
|
const taxonomyResponse = await suggestTaxonomy(config, projectName, options.description || "", taxonomyDocs);
|
|
10911
11452
|
await importTaxonomy(config, projectName, taxonomyResponse.taxonomy);
|
|
10912
11453
|
return taxonomyResponse.taxonomy;
|
|
10913
11454
|
})());
|
|
10914
|
-
if (!
|
|
11455
|
+
if (!err) {
|
|
10915
11456
|
taxonomy = t;
|
|
10916
11457
|
taxonomyErr = undefined;
|
|
10917
11458
|
break;
|
|
10918
11459
|
}
|
|
10919
|
-
taxonomyErr =
|
|
10920
|
-
lastAttemptErrors.push(`attempt ${attempt}: ${
|
|
11460
|
+
taxonomyErr = err;
|
|
11461
|
+
lastAttemptErrors.push(`attempt ${attempt}: ${err.message}`);
|
|
10921
11462
|
if (attempt < 3) {
|
|
10922
11463
|
await new Promise((r) => setTimeout(r, 5000));
|
|
10923
11464
|
}
|
|
@@ -10980,15 +11521,15 @@ var registerProjectsCommand = (program2) => {
|
|
|
10980
11521
|
});
|
|
10981
11522
|
project.command("import-taxonomy").description("Import a taxonomy from a local JSON file into an existing project").argument("<project-name>", "Project name").argument("<file>", "Path to taxonomy JSON file").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(PROJECTS_IMPORT_TAXONOMY_EXAMPLES).trackedAction(processContext, async (projectName, file, options) => {
|
|
10982
11523
|
const [err, result] = await catchError((async () => {
|
|
10983
|
-
const
|
|
11524
|
+
const fs = getFileSystem();
|
|
10984
11525
|
const config = await createIxpConfig({
|
|
10985
11526
|
tenant: options.tenant
|
|
10986
11527
|
});
|
|
10987
|
-
const resolvedFile =
|
|
10988
|
-
if (!await
|
|
11528
|
+
const resolvedFile = fs.path.resolve(file);
|
|
11529
|
+
if (!await fs.exists(resolvedFile)) {
|
|
10989
11530
|
throw new Error(`Taxonomy file not found: ${resolvedFile}`);
|
|
10990
11531
|
}
|
|
10991
|
-
const contents = await
|
|
11532
|
+
const contents = await fs.readFile(resolvedFile, "utf-8");
|
|
10992
11533
|
if (contents === null) {
|
|
10993
11534
|
throw new Error(`Failed to read taxonomy file: ${resolvedFile}`);
|
|
10994
11535
|
}
|
|
@@ -11029,22 +11570,22 @@ var registerProjectsCommand = (program2) => {
|
|
|
11029
11570
|
};
|
|
11030
11571
|
|
|
11031
11572
|
// src/tool.ts
|
|
11032
|
-
var
|
|
11573
|
+
var metadata2 = {
|
|
11033
11574
|
name: "ixp-tool",
|
|
11034
11575
|
version: package_default.version,
|
|
11035
11576
|
description: "UiPath IXP Tool for managing projects, prompts, predictions and model publishing",
|
|
11036
11577
|
commandPrefix: "ixp"
|
|
11037
11578
|
};
|
|
11038
|
-
var
|
|
11039
|
-
registerProjectsCommand(
|
|
11040
|
-
registerDocumentsCommand(
|
|
11041
|
-
registerFieldsCommand(
|
|
11042
|
-
registerGroupsCommand(
|
|
11043
|
-
registerDataTypesCommand(
|
|
11044
|
-
registerLabellingsCommand(
|
|
11045
|
-
registerDeploymentsCommand(
|
|
11579
|
+
var registerCommands2 = async (program) => {
|
|
11580
|
+
registerProjectsCommand(program);
|
|
11581
|
+
registerDocumentsCommand(program);
|
|
11582
|
+
registerFieldsCommand(program);
|
|
11583
|
+
registerGroupsCommand(program);
|
|
11584
|
+
registerDataTypesCommand(program);
|
|
11585
|
+
registerLabellingsCommand(program);
|
|
11586
|
+
registerDeploymentsCommand(program);
|
|
11046
11587
|
};
|
|
11047
11588
|
|
|
11048
|
-
export { package_default, Command,
|
|
11589
|
+
export { package_default, Command, metadata2, registerCommands2 };
|
|
11049
11590
|
|
|
11050
|
-
//# debugId=
|
|
11591
|
+
//# debugId=58011EA299CBC32664756E2164756E21
|