@uipath/common 0.9.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/command-help.d.ts +2 -22
- package/dist/constants.d.ts +0 -2
- package/dist/error-handler.d.ts +1 -0
- package/dist/formatter.d.ts +26 -0
- package/dist/guid.d.ts +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1131 -1000
- package/dist/option-validators.d.ts +2 -0
- package/dist/orchestrator-urls.d.ts +65 -0
- package/dist/output-format-context.d.ts +11 -0
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -2177,6 +2177,129 @@ Command.prototype.examples = function(examples) {
|
|
|
2177
2177
|
examplesByCommand.set(this, examples);
|
|
2178
2178
|
return this;
|
|
2179
2179
|
};
|
|
2180
|
+
// src/singleton.ts
|
|
2181
|
+
var PREFIX = "@uipath/common/";
|
|
2182
|
+
var _g = globalThis;
|
|
2183
|
+
function singleton(ctorOrName) {
|
|
2184
|
+
const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
|
|
2185
|
+
const key = Symbol.for(PREFIX + name);
|
|
2186
|
+
return {
|
|
2187
|
+
get(fallback) {
|
|
2188
|
+
return _g[key] ?? fallback;
|
|
2189
|
+
},
|
|
2190
|
+
set(value) {
|
|
2191
|
+
_g[key] = value;
|
|
2192
|
+
},
|
|
2193
|
+
clear() {
|
|
2194
|
+
delete _g[key];
|
|
2195
|
+
},
|
|
2196
|
+
getOrInit(factory, guard) {
|
|
2197
|
+
const existing = _g[key];
|
|
2198
|
+
if (existing != null && typeof existing === "object") {
|
|
2199
|
+
if (!guard || guard(existing)) {
|
|
2200
|
+
return existing;
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
const instance = factory();
|
|
2204
|
+
_g[key] = instance;
|
|
2205
|
+
return instance;
|
|
2206
|
+
}
|
|
2207
|
+
};
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2210
|
+
// src/output-context.ts
|
|
2211
|
+
function createStorage() {
|
|
2212
|
+
const [error, mod] = catchError(() => __require("node:async_hooks"));
|
|
2213
|
+
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
2214
|
+
return {
|
|
2215
|
+
getStore: () => {
|
|
2216
|
+
return;
|
|
2217
|
+
},
|
|
2218
|
+
run: (_store, fn) => fn()
|
|
2219
|
+
};
|
|
2220
|
+
}
|
|
2221
|
+
return new mod.AsyncLocalStorage;
|
|
2222
|
+
}
|
|
2223
|
+
var storageSingleton = singleton("OutputStorage");
|
|
2224
|
+
var sinkSlot = singleton("OutputSink");
|
|
2225
|
+
var outputStorage = storageSingleton.getOrInit(createStorage, (v) => ("getStore" in v));
|
|
2226
|
+
var CONSOLE_FALLBACK = {
|
|
2227
|
+
writeOut: (str) => process.stdout.write(str),
|
|
2228
|
+
writeErr: (str) => process.stderr.write(str),
|
|
2229
|
+
writeLog: (str) => process.stdout.write(str),
|
|
2230
|
+
capabilities: {
|
|
2231
|
+
isInteractive: false,
|
|
2232
|
+
supportsColor: false,
|
|
2233
|
+
outputWidth: 80
|
|
2234
|
+
}
|
|
2235
|
+
};
|
|
2236
|
+
function runWithSink(sink, fn) {
|
|
2237
|
+
return outputStorage.run(sink, fn);
|
|
2238
|
+
}
|
|
2239
|
+
function getOutputSink() {
|
|
2240
|
+
return outputStorage.getStore() ?? sinkSlot.get() ?? CONSOLE_FALLBACK;
|
|
2241
|
+
}
|
|
2242
|
+
function setGlobalSink(sink) {
|
|
2243
|
+
sinkSlot.set(sink);
|
|
2244
|
+
}
|
|
2245
|
+
|
|
2246
|
+
// src/command-help.ts
|
|
2247
|
+
function extractCommandHelp(cmd, helper) {
|
|
2248
|
+
const usage = helper.commandUsage(cmd);
|
|
2249
|
+
const description = helper.commandDescription(cmd);
|
|
2250
|
+
const args = helper.visibleArguments(cmd).map((arg) => {
|
|
2251
|
+
const result2 = {
|
|
2252
|
+
Name: arg.name(),
|
|
2253
|
+
Description: arg.description || "",
|
|
2254
|
+
Required: arg.required
|
|
2255
|
+
};
|
|
2256
|
+
if (arg.defaultValue !== undefined) {
|
|
2257
|
+
result2.Default = String(arg.defaultValue);
|
|
2258
|
+
}
|
|
2259
|
+
return result2;
|
|
2260
|
+
});
|
|
2261
|
+
const options = helper.visibleOptions(cmd).map((opt) => {
|
|
2262
|
+
const result2 = {
|
|
2263
|
+
Flags: opt.flags,
|
|
2264
|
+
Description: opt.description || ""
|
|
2265
|
+
};
|
|
2266
|
+
const defaultDesc = opt.defaultValueDescription ?? (opt.defaultValue !== undefined ? String(opt.defaultValue) : undefined);
|
|
2267
|
+
if (defaultDesc !== undefined) {
|
|
2268
|
+
result2.Default = defaultDesc;
|
|
2269
|
+
}
|
|
2270
|
+
return result2;
|
|
2271
|
+
});
|
|
2272
|
+
const examples = getCommandExamples(cmd);
|
|
2273
|
+
const result = {
|
|
2274
|
+
Command: cmd.name(),
|
|
2275
|
+
Description: description,
|
|
2276
|
+
Usage: usage,
|
|
2277
|
+
Arguments: args,
|
|
2278
|
+
Options: options
|
|
2279
|
+
};
|
|
2280
|
+
if (examples.length > 0) {
|
|
2281
|
+
result.Examples = examples;
|
|
2282
|
+
}
|
|
2283
|
+
return result;
|
|
2284
|
+
}
|
|
2285
|
+
var VALID_FORMATS = ["table", "json", "yaml", "plain"];
|
|
2286
|
+
function extractFormatFromArgs(args) {
|
|
2287
|
+
for (let i = 0;i < args.length; i++) {
|
|
2288
|
+
if (args[i] === "--output" && i + 1 < args.length) {
|
|
2289
|
+
const value = args[i + 1];
|
|
2290
|
+
if (VALID_FORMATS.includes(value)) {
|
|
2291
|
+
return value;
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
2294
|
+
if (args[i]?.startsWith("--output=")) {
|
|
2295
|
+
const value = args[i].substring("--output=".length);
|
|
2296
|
+
if (VALID_FORMATS.includes(value)) {
|
|
2297
|
+
return value;
|
|
2298
|
+
}
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2301
|
+
return getOutputSink().capabilities.isInteractive ? "table" : "json";
|
|
2302
|
+
}
|
|
2180
2303
|
// src/command-walker.ts
|
|
2181
2304
|
function collectCommands(command, parentName, result) {
|
|
2182
2305
|
const subcommands = command.commands;
|
|
@@ -2192,79 +2315,398 @@ function collectCommands(command, parentName, result) {
|
|
|
2192
2315
|
collectCommands(sub, name, result);
|
|
2193
2316
|
}
|
|
2194
2317
|
}
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2318
|
+
// src/completer.ts
|
|
2319
|
+
var COMPLETER_SYMBOL = Symbol.for("@uipath/common/completer");
|
|
2320
|
+
function withCompleter(target, spec) {
|
|
2321
|
+
target[COMPLETER_SYMBOL] = spec;
|
|
2322
|
+
return target;
|
|
2323
|
+
}
|
|
2324
|
+
function getCompleter(target) {
|
|
2325
|
+
if (!target)
|
|
2326
|
+
return;
|
|
2327
|
+
const raw = target[COMPLETER_SYMBOL];
|
|
2328
|
+
if (raw && typeof raw === "object" && "command" in raw && "valueSelector" in raw) {
|
|
2329
|
+
return raw;
|
|
2203
2330
|
}
|
|
2204
|
-
|
|
2205
|
-
|
|
2331
|
+
return;
|
|
2332
|
+
}
|
|
2333
|
+
// src/console-guard.ts
|
|
2334
|
+
function format(first, ...rest) {
|
|
2335
|
+
if (typeof first !== "string") {
|
|
2336
|
+
if (first === undefined && rest.length === 0)
|
|
2337
|
+
return "";
|
|
2338
|
+
return [first, ...rest].map(String).join(" ");
|
|
2206
2339
|
}
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2340
|
+
let i = 0;
|
|
2341
|
+
const result = first.replace(/%[sdifjoO%]/g, (spec) => {
|
|
2342
|
+
if (spec === "%%")
|
|
2343
|
+
return "%";
|
|
2344
|
+
if (i >= rest.length)
|
|
2345
|
+
return spec;
|
|
2346
|
+
const arg = rest[i++];
|
|
2347
|
+
switch (spec) {
|
|
2348
|
+
case "%s":
|
|
2349
|
+
return String(arg);
|
|
2350
|
+
case "%d":
|
|
2351
|
+
case "%i":
|
|
2352
|
+
return String(parseInt(String(arg), 10));
|
|
2353
|
+
case "%f":
|
|
2354
|
+
return String(parseFloat(String(arg)));
|
|
2355
|
+
case "%j":
|
|
2356
|
+
case "%o":
|
|
2357
|
+
case "%O":
|
|
2358
|
+
try {
|
|
2359
|
+
return JSON.stringify(arg);
|
|
2360
|
+
} catch {
|
|
2361
|
+
return String(arg);
|
|
2362
|
+
}
|
|
2363
|
+
default:
|
|
2364
|
+
return spec;
|
|
2215
2365
|
}
|
|
2216
|
-
|
|
2366
|
+
});
|
|
2367
|
+
const extra = rest.slice(i);
|
|
2368
|
+
if (extra.length > 0) {
|
|
2369
|
+
return result + " " + extra.map(String).join(" ");
|
|
2217
2370
|
}
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2371
|
+
return result;
|
|
2372
|
+
}
|
|
2373
|
+
function formatArgs(args) {
|
|
2374
|
+
return `${format(args[0], ...args.slice(1))}
|
|
2375
|
+
`;
|
|
2376
|
+
}
|
|
2377
|
+
var guardInstalledSlot = singleton("ConsoleGuardInstalled");
|
|
2378
|
+
var savedOriginalsSlot = singleton("ConsoleGuardOriginals");
|
|
2379
|
+
function installConsoleGuard() {
|
|
2380
|
+
if (guardInstalledSlot.get(false))
|
|
2381
|
+
return;
|
|
2382
|
+
const originals = {
|
|
2383
|
+
log: console.log,
|
|
2384
|
+
info: console.info,
|
|
2385
|
+
warn: console.warn,
|
|
2386
|
+
error: console.error,
|
|
2387
|
+
debug: console.debug
|
|
2388
|
+
};
|
|
2389
|
+
savedOriginalsSlot.set(originals);
|
|
2390
|
+
let reentrant = false;
|
|
2391
|
+
function guardedWriter(original) {
|
|
2392
|
+
return (...args) => {
|
|
2393
|
+
if (reentrant) {
|
|
2394
|
+
original.apply(console, args);
|
|
2395
|
+
return;
|
|
2227
2396
|
}
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
}
|
|
2234
|
-
|
|
2235
|
-
if (obj === null || obj === undefined || obj === false) {
|
|
2236
|
-
return true;
|
|
2237
|
-
}
|
|
2238
|
-
if (typeof obj === "string") {
|
|
2239
|
-
return obj === "";
|
|
2240
|
-
}
|
|
2241
|
-
if (typeof obj === "object") {
|
|
2242
|
-
if (Array.isArray(obj)) {
|
|
2243
|
-
return obj.length === 0;
|
|
2244
|
-
}
|
|
2245
|
-
if (obj === null) {
|
|
2246
|
-
return true;
|
|
2247
|
-
}
|
|
2248
|
-
return Object.keys(obj).length === 0;
|
|
2249
|
-
}
|
|
2250
|
-
return false;
|
|
2251
|
-
};
|
|
2252
|
-
var isAlpha = (ch) => {
|
|
2253
|
-
return ch >= "a" && ch <= "z" || ch >= "A" && ch <= "Z" || ch === "_";
|
|
2254
|
-
};
|
|
2255
|
-
var isNum = (ch) => {
|
|
2256
|
-
return ch >= "0" && ch <= "9" || ch === "-";
|
|
2257
|
-
};
|
|
2258
|
-
var isAlphaNum = (ch) => {
|
|
2259
|
-
return ch >= "a" && ch <= "z" || ch >= "A" && ch <= "Z" || ch >= "0" && ch <= "9" || ch === "_";
|
|
2260
|
-
};
|
|
2261
|
-
var ensureInteger = (value) => {
|
|
2262
|
-
if (!(typeof value === "number") || Math.floor(value) !== value) {
|
|
2263
|
-
throw new Error("invalid-value: expecting an integer.");
|
|
2397
|
+
reentrant = true;
|
|
2398
|
+
try {
|
|
2399
|
+
getOutputSink().writeErr(formatArgs(args));
|
|
2400
|
+
} finally {
|
|
2401
|
+
reentrant = false;
|
|
2402
|
+
}
|
|
2403
|
+
};
|
|
2264
2404
|
}
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2405
|
+
console.log = guardedWriter(originals.log);
|
|
2406
|
+
console.info = guardedWriter(originals.info);
|
|
2407
|
+
console.warn = guardedWriter(originals.warn);
|
|
2408
|
+
console.error = guardedWriter(originals.error);
|
|
2409
|
+
console.debug = guardedWriter(originals.debug);
|
|
2410
|
+
guardInstalledSlot.set(true);
|
|
2411
|
+
}
|
|
2412
|
+
function restoreConsole() {
|
|
2413
|
+
const originals = savedOriginalsSlot.get();
|
|
2414
|
+
if (!originals)
|
|
2415
|
+
return;
|
|
2416
|
+
console.log = originals.log;
|
|
2417
|
+
console.info = originals.info;
|
|
2418
|
+
console.warn = originals.warn;
|
|
2419
|
+
console.error = originals.error;
|
|
2420
|
+
console.debug = originals.debug;
|
|
2421
|
+
guardInstalledSlot.clear();
|
|
2422
|
+
}
|
|
2423
|
+
// src/constants.ts
|
|
2424
|
+
var UIPATH_HOME_DIR = ".uipath";
|
|
2425
|
+
var AUTH_FILENAME = ".auth";
|
|
2426
|
+
var CONFIG_FILENAME = "config.json";
|
|
2427
|
+
var DEFAULT_BASE_URL = "https://cloud.uipath.com";
|
|
2428
|
+
var DEFAULT_PAGE_SIZE = 50;
|
|
2429
|
+
var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
|
|
2430
|
+
var DEFAULT_FETCH_TIMEOUT_MS = 30000;
|
|
2431
|
+
var DEFAULT_REDIRECT_URI = "http://localhost:8104/oidc/login";
|
|
2432
|
+
// src/env-reference.ts
|
|
2433
|
+
function resolveEnvReference(value) {
|
|
2434
|
+
if (value == null)
|
|
2435
|
+
return value;
|
|
2436
|
+
if (value.startsWith("env.")) {
|
|
2437
|
+
const name = value.slice(4);
|
|
2438
|
+
const resolved = process.env[name];
|
|
2439
|
+
if (!resolved) {
|
|
2440
|
+
throw new Error(`Environment variable "${name}" is not set`);
|
|
2441
|
+
}
|
|
2442
|
+
return resolved;
|
|
2443
|
+
}
|
|
2444
|
+
return value;
|
|
2445
|
+
}
|
|
2446
|
+
// src/error-handler.ts
|
|
2447
|
+
var DEFAULT_401 = "Unauthorized (401). Run `uip login` to authenticate.";
|
|
2448
|
+
var DEFAULT_403 = "Forbidden (403). Ensure the account has the required permissions.";
|
|
2449
|
+
var DEFAULT_405 = "Method Not Allowed (405). The endpoint may not exist or the base URL may be incorrect.";
|
|
2450
|
+
var HTML_RESPONSE_MESSAGE = "Received HTML instead of the expected JSON response.";
|
|
2451
|
+
function isHtmlDocument(body) {
|
|
2452
|
+
return /^\s*(<!doctype html|<html\b)/i.test(body);
|
|
2453
|
+
}
|
|
2454
|
+
async function extractErrorDetails(error, options) {
|
|
2455
|
+
const err = error !== null && error !== undefined && typeof error === "object" ? error : {};
|
|
2456
|
+
const response = err.response;
|
|
2457
|
+
const status = err.status ?? response?.status;
|
|
2458
|
+
const isSuccessfulResponse = status !== undefined && status >= 200 && status < 300;
|
|
2459
|
+
let rawBody;
|
|
2460
|
+
let extractedMessage;
|
|
2461
|
+
let parsedBody;
|
|
2462
|
+
const textFn = response?.text?.bind(response);
|
|
2463
|
+
if (textFn) {
|
|
2464
|
+
const [bodyError, body] = await catchError((async () => textFn())());
|
|
2465
|
+
if (!bodyError && body) {
|
|
2466
|
+
rawBody = body;
|
|
2467
|
+
const [parseError, parsed] = catchError(() => JSON.parse(body));
|
|
2468
|
+
if (!parseError && parsed && typeof parsed === "object") {
|
|
2469
|
+
parsedBody = parsed;
|
|
2470
|
+
if (parsedBody.errors && typeof parsedBody.errors === "object") {
|
|
2471
|
+
for (const field of Object.values(parsedBody.errors)) {
|
|
2472
|
+
if (Array.isArray(field) && field.length > 0) {
|
|
2473
|
+
const first = field[0];
|
|
2474
|
+
if (first && typeof first.message === "string") {
|
|
2475
|
+
extractedMessage = first.message;
|
|
2476
|
+
break;
|
|
2477
|
+
}
|
|
2478
|
+
}
|
|
2479
|
+
}
|
|
2480
|
+
}
|
|
2481
|
+
if (!extractedMessage) {
|
|
2482
|
+
extractedMessage = typeof parsedBody.message === "string" ? parsedBody.message : typeof parsedBody.errorMessage === "string" ? parsedBody.errorMessage : typeof parsedBody.title === "string" ? parsedBody.title : undefined;
|
|
2483
|
+
}
|
|
2484
|
+
if (!extractedMessage) {
|
|
2485
|
+
extractedMessage = body;
|
|
2486
|
+
}
|
|
2487
|
+
} else {
|
|
2488
|
+
extractedMessage = isHtmlDocument(body) ? HTML_RESPONSE_MESSAGE : body;
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
const rawMessage = typeof err.message === "string" ? err.message : "Unknown error";
|
|
2493
|
+
let message;
|
|
2494
|
+
let result = "Failure";
|
|
2495
|
+
if (status === 401) {
|
|
2496
|
+
message = DEFAULT_401;
|
|
2497
|
+
result = "AuthenticationError";
|
|
2498
|
+
} else if (status === 403) {
|
|
2499
|
+
message = options?.forbiddenMessage ?? DEFAULT_403;
|
|
2500
|
+
result = "AuthenticationError";
|
|
2501
|
+
} else if (status === 405) {
|
|
2502
|
+
message = DEFAULT_405;
|
|
2503
|
+
} else if (status === 400 || status === 422) {
|
|
2504
|
+
message = extractedMessage ? `HTTP ${status}: ${extractedMessage}` : `HTTP ${status}: ${rawMessage}`;
|
|
2505
|
+
result = "ValidationError";
|
|
2506
|
+
} else if (status === 429) {
|
|
2507
|
+
message = extractedMessage ? `HTTP ${status}: ${extractedMessage}` : `HTTP ${status}: ${rawMessage}`;
|
|
2508
|
+
} else if (extractedMessage) {
|
|
2509
|
+
if (isSuccessfulResponse && rawMessage !== "Unknown error") {
|
|
2510
|
+
message = rawMessage;
|
|
2511
|
+
} else {
|
|
2512
|
+
message = status ? `HTTP ${status}: ${extractedMessage}` : extractedMessage;
|
|
2513
|
+
}
|
|
2514
|
+
} else if (status) {
|
|
2515
|
+
if (rawMessage === "Unknown error" && response) {
|
|
2516
|
+
const statusText = response.statusText;
|
|
2517
|
+
message = statusText ? `HTTP ${status} ${statusText}` : `HTTP ${status} - request failed`;
|
|
2518
|
+
} else {
|
|
2519
|
+
message = `HTTP ${status}: ${rawMessage}`;
|
|
2520
|
+
}
|
|
2521
|
+
} else {
|
|
2522
|
+
message = rawMessage;
|
|
2523
|
+
}
|
|
2524
|
+
let details = rawMessage;
|
|
2525
|
+
if (rawBody) {
|
|
2526
|
+
if (parsedBody) {
|
|
2527
|
+
const extra = {};
|
|
2528
|
+
if (parsedBody.errorCode)
|
|
2529
|
+
extra.errorCode = parsedBody.errorCode;
|
|
2530
|
+
if (parsedBody.details)
|
|
2531
|
+
extra.details = parsedBody.details;
|
|
2532
|
+
if (parsedBody.errors != null)
|
|
2533
|
+
extra.errors = parsedBody.errors;
|
|
2534
|
+
if (parsedBody.data && typeof parsedBody.data === "object" && Object.keys(parsedBody.data).length > 0) {
|
|
2535
|
+
extra.data = parsedBody.data;
|
|
2536
|
+
}
|
|
2537
|
+
details = Object.keys(extra).length > 0 ? JSON.stringify(extra) : rawBody;
|
|
2538
|
+
} else {
|
|
2539
|
+
details = rawBody;
|
|
2540
|
+
}
|
|
2541
|
+
} else if (typeof err.message === "string") {
|
|
2542
|
+
details = err.message;
|
|
2543
|
+
} else {
|
|
2544
|
+
details = String(error);
|
|
2545
|
+
}
|
|
2546
|
+
const context = {};
|
|
2547
|
+
if (status) {
|
|
2548
|
+
context.httpStatus = status;
|
|
2549
|
+
}
|
|
2550
|
+
if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
|
|
2551
|
+
context.errorCode = parsedBody.errorCode;
|
|
2552
|
+
}
|
|
2553
|
+
if (parsedBody?.requestId && typeof parsedBody.requestId === "string") {
|
|
2554
|
+
context.requestId = parsedBody.requestId;
|
|
2555
|
+
}
|
|
2556
|
+
if (status === 429) {
|
|
2557
|
+
const resp = response;
|
|
2558
|
+
const headersObj = resp?.headers;
|
|
2559
|
+
let retryAfterValue;
|
|
2560
|
+
if (headersObj && typeof headersObj === "object" && typeof headersObj.get === "function") {
|
|
2561
|
+
retryAfterValue = headersObj.get("retry-after") ?? undefined;
|
|
2562
|
+
}
|
|
2563
|
+
if (!retryAfterValue && headersObj && typeof headersObj === "object") {
|
|
2564
|
+
const headers = headersObj;
|
|
2565
|
+
retryAfterValue = headers["retry-after"] ?? headers["Retry-After"];
|
|
2566
|
+
}
|
|
2567
|
+
if (retryAfterValue) {
|
|
2568
|
+
const seconds = Number(retryAfterValue);
|
|
2569
|
+
if (!Number.isNaN(seconds)) {
|
|
2570
|
+
context.retryAfter = seconds;
|
|
2571
|
+
}
|
|
2572
|
+
}
|
|
2573
|
+
}
|
|
2574
|
+
const hasContext = Object.keys(context).length > 0;
|
|
2575
|
+
return { result, message, details, ...hasContext ? { context } : {} };
|
|
2576
|
+
}
|
|
2577
|
+
async function extractErrorMessage(error, options) {
|
|
2578
|
+
const { message } = await extractErrorDetails(error, options);
|
|
2579
|
+
return message;
|
|
2580
|
+
}
|
|
2581
|
+
function extractErrorMessageSync(error) {
|
|
2582
|
+
if (error instanceof Error) {
|
|
2583
|
+
return error.message;
|
|
2584
|
+
}
|
|
2585
|
+
if (typeof error === "object" && error !== null) {
|
|
2586
|
+
if ("status" in error && error.status === 401) {
|
|
2587
|
+
return DEFAULT_401;
|
|
2588
|
+
}
|
|
2589
|
+
if ("message" in error && typeof error.message === "string") {
|
|
2590
|
+
return error.message;
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2593
|
+
return String(error);
|
|
2594
|
+
}
|
|
2595
|
+
// src/error-instructions.ts
|
|
2596
|
+
function extractHttpStatus(err) {
|
|
2597
|
+
if (!err || typeof err !== "object")
|
|
2598
|
+
return;
|
|
2599
|
+
const e = err;
|
|
2600
|
+
return e.response?.status ?? e.status ?? e.statusCode;
|
|
2601
|
+
}
|
|
2602
|
+
var GENERIC = "Check authentication and parameters";
|
|
2603
|
+
function instructionsFor(ctx, err) {
|
|
2604
|
+
switch (ctx) {
|
|
2605
|
+
case "auth":
|
|
2606
|
+
return "Re-authenticate with 'uip login' or verify your session hasn't expired";
|
|
2607
|
+
case "identity":
|
|
2608
|
+
return "Pass --tenant (and ensure your login includes an organization) or re-authenticate";
|
|
2609
|
+
case "input-parse":
|
|
2610
|
+
return "Ensure --inputs is valid JSON or pipe JSON via stdin";
|
|
2611
|
+
case "input-validate":
|
|
2612
|
+
return "Fix the flagged input fields to match the process's input schema";
|
|
2613
|
+
case "flag-format":
|
|
2614
|
+
return "Check the flag value format — see --help for the expected shape";
|
|
2615
|
+
case "permissions":
|
|
2616
|
+
return "Confirm your user has the required permissions in this folder/tenant, or re-authenticate with 'uip login' if your session has lapsed";
|
|
2617
|
+
case "backend": {
|
|
2618
|
+
const status = extractHttpStatus(err);
|
|
2619
|
+
if (status === 401) {
|
|
2620
|
+
return "Re-authenticate with 'uip login' — your session is invalid or expired";
|
|
2621
|
+
}
|
|
2622
|
+
if (status === 403) {
|
|
2623
|
+
return "Confirm your user has access to the folder and the required permissions";
|
|
2624
|
+
}
|
|
2625
|
+
if (status === 404) {
|
|
2626
|
+
return "Verify the resource exists in the current folder/tenant";
|
|
2627
|
+
}
|
|
2628
|
+
if (status === 400) {
|
|
2629
|
+
return "Request was rejected — check flag values and inputs";
|
|
2630
|
+
}
|
|
2631
|
+
if (status !== undefined && status >= 500 && status < 600) {
|
|
2632
|
+
return "Orchestrator returned a server error — retry; if it persists, check service status";
|
|
2633
|
+
}
|
|
2634
|
+
return GENERIC;
|
|
2635
|
+
}
|
|
2636
|
+
}
|
|
2637
|
+
}
|
|
2638
|
+
// ../../node_modules/@jmespath-community/jmespath/dist/index.mjs
|
|
2639
|
+
var isObject = (obj) => {
|
|
2640
|
+
return obj !== null && Object.prototype.toString.call(obj) === "[object Object]";
|
|
2641
|
+
};
|
|
2642
|
+
var strictDeepEqual = (first, second) => {
|
|
2643
|
+
if (first === second) {
|
|
2644
|
+
return true;
|
|
2645
|
+
}
|
|
2646
|
+
if (typeof first !== typeof second) {
|
|
2647
|
+
return false;
|
|
2648
|
+
}
|
|
2649
|
+
if (Array.isArray(first) && Array.isArray(second)) {
|
|
2650
|
+
if (first.length !== second.length) {
|
|
2651
|
+
return false;
|
|
2652
|
+
}
|
|
2653
|
+
for (let i = 0;i < first.length; i += 1) {
|
|
2654
|
+
if (!strictDeepEqual(first[i], second[i])) {
|
|
2655
|
+
return false;
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
return true;
|
|
2659
|
+
}
|
|
2660
|
+
if (isObject(first) && isObject(second)) {
|
|
2661
|
+
const firstEntries = Object.entries(first);
|
|
2662
|
+
const secondKeys = new Set(Object.keys(second));
|
|
2663
|
+
if (firstEntries.length !== secondKeys.size) {
|
|
2664
|
+
return false;
|
|
2665
|
+
}
|
|
2666
|
+
for (const [key, value] of firstEntries) {
|
|
2667
|
+
if (!strictDeepEqual(value, second[key])) {
|
|
2668
|
+
return false;
|
|
2669
|
+
}
|
|
2670
|
+
secondKeys.delete(key);
|
|
2671
|
+
}
|
|
2672
|
+
return secondKeys.size === 0;
|
|
2673
|
+
}
|
|
2674
|
+
return false;
|
|
2675
|
+
};
|
|
2676
|
+
var isFalse = (obj) => {
|
|
2677
|
+
if (obj === null || obj === undefined || obj === false) {
|
|
2678
|
+
return true;
|
|
2679
|
+
}
|
|
2680
|
+
if (typeof obj === "string") {
|
|
2681
|
+
return obj === "";
|
|
2682
|
+
}
|
|
2683
|
+
if (typeof obj === "object") {
|
|
2684
|
+
if (Array.isArray(obj)) {
|
|
2685
|
+
return obj.length === 0;
|
|
2686
|
+
}
|
|
2687
|
+
if (obj === null) {
|
|
2688
|
+
return true;
|
|
2689
|
+
}
|
|
2690
|
+
return Object.keys(obj).length === 0;
|
|
2691
|
+
}
|
|
2692
|
+
return false;
|
|
2693
|
+
};
|
|
2694
|
+
var isAlpha = (ch) => {
|
|
2695
|
+
return ch >= "a" && ch <= "z" || ch >= "A" && ch <= "Z" || ch === "_";
|
|
2696
|
+
};
|
|
2697
|
+
var isNum = (ch) => {
|
|
2698
|
+
return ch >= "0" && ch <= "9" || ch === "-";
|
|
2699
|
+
};
|
|
2700
|
+
var isAlphaNum = (ch) => {
|
|
2701
|
+
return ch >= "a" && ch <= "z" || ch >= "A" && ch <= "Z" || ch >= "0" && ch <= "9" || ch === "_";
|
|
2702
|
+
};
|
|
2703
|
+
var ensureInteger = (value) => {
|
|
2704
|
+
if (!(typeof value === "number") || Math.floor(value) !== value) {
|
|
2705
|
+
throw new Error("invalid-value: expecting an integer.");
|
|
2706
|
+
}
|
|
2707
|
+
return value;
|
|
2708
|
+
};
|
|
2709
|
+
var ensurePositiveInteger = (value) => {
|
|
2268
2710
|
if (!(typeof value === "number") || value < 0 || Math.floor(value) !== value) {
|
|
2269
2711
|
throw new Error("invalid-value: expecting a non-negative integer.");
|
|
2270
2712
|
}
|
|
@@ -7005,7 +7447,7 @@ var convertWslPathToWindows = async (path) => {
|
|
|
7005
7447
|
}
|
|
7006
7448
|
};
|
|
7007
7449
|
|
|
7008
|
-
// ../../node_modules/define-lazy-prop/index.js
|
|
7450
|
+
// ../../node_modules/open/node_modules/define-lazy-prop/index.js
|
|
7009
7451
|
function defineLazyProperty(object, propertyName, valueGetter) {
|
|
7010
7452
|
const define = (value) => Object.defineProperty(object, propertyName, { value, enumerable: true, writable: true });
|
|
7011
7453
|
Object.defineProperty(object, propertyName, {
|
|
@@ -7503,6 +7945,15 @@ class NodeFileSystem {
|
|
|
7503
7945
|
async rename(oldPath, newPath) {
|
|
7504
7946
|
await fs6.rename(oldPath, newPath);
|
|
7505
7947
|
}
|
|
7948
|
+
async realpath(filePath) {
|
|
7949
|
+
try {
|
|
7950
|
+
return await fs6.realpath(filePath);
|
|
7951
|
+
} catch (error) {
|
|
7952
|
+
if (this.isEnoent(error))
|
|
7953
|
+
return filePath;
|
|
7954
|
+
throw error;
|
|
7955
|
+
}
|
|
7956
|
+
}
|
|
7506
7957
|
async getTempDir() {
|
|
7507
7958
|
return await fs6.mkdtemp(path2.join(os2.tmpdir(), "uipath-fs-"));
|
|
7508
7959
|
}
|
|
@@ -7543,72 +7994,6 @@ var getFileSystem = () => {
|
|
|
7543
7994
|
return fsInstance;
|
|
7544
7995
|
};
|
|
7545
7996
|
|
|
7546
|
-
// src/singleton.ts
|
|
7547
|
-
var PREFIX = "@uipath/common/";
|
|
7548
|
-
var _g = globalThis;
|
|
7549
|
-
function singleton(ctorOrName) {
|
|
7550
|
-
const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
|
|
7551
|
-
const key = Symbol.for(PREFIX + name);
|
|
7552
|
-
return {
|
|
7553
|
-
get(fallback) {
|
|
7554
|
-
return _g[key] ?? fallback;
|
|
7555
|
-
},
|
|
7556
|
-
set(value) {
|
|
7557
|
-
_g[key] = value;
|
|
7558
|
-
},
|
|
7559
|
-
clear() {
|
|
7560
|
-
delete _g[key];
|
|
7561
|
-
},
|
|
7562
|
-
getOrInit(factory, guard) {
|
|
7563
|
-
const existing = _g[key];
|
|
7564
|
-
if (existing != null && typeof existing === "object") {
|
|
7565
|
-
if (!guard || guard(existing)) {
|
|
7566
|
-
return existing;
|
|
7567
|
-
}
|
|
7568
|
-
}
|
|
7569
|
-
const instance = factory();
|
|
7570
|
-
_g[key] = instance;
|
|
7571
|
-
return instance;
|
|
7572
|
-
}
|
|
7573
|
-
};
|
|
7574
|
-
}
|
|
7575
|
-
|
|
7576
|
-
// src/output-context.ts
|
|
7577
|
-
function createStorage() {
|
|
7578
|
-
const [error, mod2] = catchError(() => __require("node:async_hooks"));
|
|
7579
|
-
if (error || typeof mod2?.AsyncLocalStorage !== "function") {
|
|
7580
|
-
return {
|
|
7581
|
-
getStore: () => {
|
|
7582
|
-
return;
|
|
7583
|
-
},
|
|
7584
|
-
run: (_store, fn) => fn()
|
|
7585
|
-
};
|
|
7586
|
-
}
|
|
7587
|
-
return new mod2.AsyncLocalStorage;
|
|
7588
|
-
}
|
|
7589
|
-
var storageSingleton = singleton("OutputStorage");
|
|
7590
|
-
var sinkSlot = singleton("OutputSink");
|
|
7591
|
-
var outputStorage = storageSingleton.getOrInit(createStorage, (v) => ("getStore" in v));
|
|
7592
|
-
var CONSOLE_FALLBACK = {
|
|
7593
|
-
writeOut: (str2) => process.stdout.write(str2),
|
|
7594
|
-
writeErr: (str2) => process.stderr.write(str2),
|
|
7595
|
-
writeLog: (str2) => process.stdout.write(str2),
|
|
7596
|
-
capabilities: {
|
|
7597
|
-
isInteractive: false,
|
|
7598
|
-
supportsColor: false,
|
|
7599
|
-
outputWidth: 80
|
|
7600
|
-
}
|
|
7601
|
-
};
|
|
7602
|
-
function runWithSink(sink, fn) {
|
|
7603
|
-
return outputStorage.run(sink, fn);
|
|
7604
|
-
}
|
|
7605
|
-
function getOutputSink() {
|
|
7606
|
-
return outputStorage.getStore() ?? sinkSlot.get() ?? CONSOLE_FALLBACK;
|
|
7607
|
-
}
|
|
7608
|
-
function setGlobalSink(sink) {
|
|
7609
|
-
sinkSlot.set(sink);
|
|
7610
|
-
}
|
|
7611
|
-
|
|
7612
7997
|
// src/logger.ts
|
|
7613
7998
|
var logFilePathSlot = singleton("logFilePath");
|
|
7614
7999
|
function setGlobalLogFilePath(path3) {
|
|
@@ -7786,6 +8171,9 @@ class SimpleLogger {
|
|
|
7786
8171
|
case "Debug":
|
|
7787
8172
|
this.debug(msg);
|
|
7788
8173
|
break;
|
|
8174
|
+
case "Information":
|
|
8175
|
+
this.info(msg);
|
|
8176
|
+
break;
|
|
7789
8177
|
case "Warning":
|
|
7790
8178
|
this.warn(msg);
|
|
7791
8179
|
break;
|
|
@@ -7823,13 +8211,20 @@ function configureLogger(config) {
|
|
|
7823
8211
|
|
|
7824
8212
|
// src/output-format-context.ts
|
|
7825
8213
|
var formatSlot = singleton("OutputFormat");
|
|
8214
|
+
var formatExplicitSlot = singleton("OutputFormatExplicit");
|
|
7826
8215
|
var filterSlot = singleton("OutputFilter");
|
|
7827
|
-
function setOutputFormat(
|
|
7828
|
-
formatSlot.set(
|
|
8216
|
+
function setOutputFormat(format2) {
|
|
8217
|
+
formatSlot.set(format2);
|
|
7829
8218
|
}
|
|
7830
8219
|
function getOutputFormat() {
|
|
7831
8220
|
return formatSlot.get("json");
|
|
7832
8221
|
}
|
|
8222
|
+
function setOutputFormatExplicit(explicit) {
|
|
8223
|
+
formatExplicitSlot.set(explicit);
|
|
8224
|
+
}
|
|
8225
|
+
function getOutputFormatExplicit() {
|
|
8226
|
+
return formatExplicitSlot.get(false) ?? false;
|
|
8227
|
+
}
|
|
7833
8228
|
function setOutputFilter(filter) {
|
|
7834
8229
|
filterSlot.set(filter);
|
|
7835
8230
|
}
|
|
@@ -8061,11 +8456,69 @@ function setGlobalTelemetryProperties(properties) {
|
|
|
8061
8456
|
function getGlobalTelemetryProperties() {
|
|
8062
8457
|
return telemetryPropsSlot.get();
|
|
8063
8458
|
}
|
|
8064
|
-
function toOperationUrn(name) {
|
|
8065
|
-
if (URL.canParse(name))
|
|
8066
|
-
return name;
|
|
8067
|
-
const sanitized = encodeURIComponent(name).replace(/%2F/g, "/");
|
|
8068
|
-
return `urn:uip:${sanitized}`;
|
|
8459
|
+
function toOperationUrn(name) {
|
|
8460
|
+
if (URL.canParse(name))
|
|
8461
|
+
return name;
|
|
8462
|
+
const sanitized = encodeURIComponent(name).replace(/%2F/g, "/");
|
|
8463
|
+
return `urn:uip:${sanitized}`;
|
|
8464
|
+
}
|
|
8465
|
+
function isRecord(value) {
|
|
8466
|
+
return value !== null && typeof value === "object";
|
|
8467
|
+
}
|
|
8468
|
+
function formatFlushJsonError(error) {
|
|
8469
|
+
if (error instanceof Error)
|
|
8470
|
+
return error.message;
|
|
8471
|
+
if (typeof error === "string")
|
|
8472
|
+
return error;
|
|
8473
|
+
if (!isRecord(error))
|
|
8474
|
+
return String(error);
|
|
8475
|
+
const parts = [];
|
|
8476
|
+
if (error.index !== undefined) {
|
|
8477
|
+
parts.push(`index ${String(error.index)}`);
|
|
8478
|
+
}
|
|
8479
|
+
if (error.statusCode !== undefined) {
|
|
8480
|
+
parts.push(`status ${String(error.statusCode)}`);
|
|
8481
|
+
}
|
|
8482
|
+
if (error.message !== undefined) {
|
|
8483
|
+
parts.push(String(error.message));
|
|
8484
|
+
}
|
|
8485
|
+
return parts.length > 0 ? parts.join(": ") : JSON.stringify(error);
|
|
8486
|
+
}
|
|
8487
|
+
function stripAppInsightsDumpStack(response) {
|
|
8488
|
+
return response.replace(/stack:\s*(['"`])[\s\S]*?\1\s*,?\s*/g, "").replace(/^\[object Error\]\s*/, "").trim();
|
|
8489
|
+
}
|
|
8490
|
+
function extractAppInsightsDumpMessage(response) {
|
|
8491
|
+
if (!response.startsWith("[object Error]"))
|
|
8492
|
+
return;
|
|
8493
|
+
const messageMatch = response.match(/\bmessage:\s*(['"`])([\s\S]*?)\1/);
|
|
8494
|
+
if (messageMatch?.[2])
|
|
8495
|
+
return messageMatch[2];
|
|
8496
|
+
const normalizedDiagnostic = stripAppInsightsDumpStack(response);
|
|
8497
|
+
if (normalizedDiagnostic && normalizedDiagnostic !== "{}") {
|
|
8498
|
+
return normalizedDiagnostic;
|
|
8499
|
+
}
|
|
8500
|
+
const stackLineMatch = response.match(/Error:\s*[^\\\n\r']+/);
|
|
8501
|
+
return stackLineMatch?.[0] ?? response;
|
|
8502
|
+
}
|
|
8503
|
+
function normalizeFlushCallbackError(response) {
|
|
8504
|
+
if (response === undefined || response === null)
|
|
8505
|
+
return;
|
|
8506
|
+
if (response instanceof Error)
|
|
8507
|
+
return response.message;
|
|
8508
|
+
const text = String(response).trim();
|
|
8509
|
+
if (!text)
|
|
8510
|
+
return;
|
|
8511
|
+
if (text.toLowerCase().includes("no data to send"))
|
|
8512
|
+
return;
|
|
8513
|
+
const [parseError, parsed] = catchError(() => JSON.parse(text));
|
|
8514
|
+
if (!parseError) {
|
|
8515
|
+
const errors = isRecord(parsed) ? parsed.errors : undefined;
|
|
8516
|
+
if (Array.isArray(errors) && errors.length > 0) {
|
|
8517
|
+
return errors.map(formatFlushJsonError).join("; ");
|
|
8518
|
+
}
|
|
8519
|
+
return;
|
|
8520
|
+
}
|
|
8521
|
+
return extractAppInsightsDumpMessage(text) ?? text;
|
|
8069
8522
|
}
|
|
8070
8523
|
async function loadApplicationInsights() {
|
|
8071
8524
|
const savedDebug = process.env.DEBUG;
|
|
@@ -8124,929 +8577,552 @@ class NodeAppInsightsTelemetryProvider {
|
|
|
8124
8577
|
...globalProps,
|
|
8125
8578
|
...properties
|
|
8126
8579
|
};
|
|
8127
|
-
}
|
|
8128
|
-
async trackEvent(eventName, properties) {
|
|
8129
|
-
const client = this.client;
|
|
8130
|
-
if (!client)
|
|
8131
|
-
return;
|
|
8132
|
-
const merged = this.mergeProperties(properties);
|
|
8133
|
-
const [error] = catchError(() => client.trackEvent({
|
|
8134
|
-
name: eventName,
|
|
8135
|
-
properties: merged
|
|
8136
|
-
}));
|
|
8137
|
-
if (error) {
|
|
8138
|
-
logger.debug(`[AppInsights] trackEvent failed for: ${eventName}`);
|
|
8139
|
-
}
|
|
8140
|
-
}
|
|
8141
|
-
async trackException(error, properties) {
|
|
8142
|
-
const client = this.client;
|
|
8143
|
-
if (!client)
|
|
8144
|
-
return;
|
|
8145
|
-
const merged = this.mergeProperties(properties);
|
|
8146
|
-
const [trackError] = catchError(() => client.trackException({
|
|
8147
|
-
exception: error,
|
|
8148
|
-
properties: merged
|
|
8149
|
-
}));
|
|
8150
|
-
if (trackError) {
|
|
8151
|
-
logger.debug(`[AppInsights] trackException failed for: ${error.message}`);
|
|
8152
|
-
}
|
|
8153
|
-
}
|
|
8154
|
-
async trackRequest(name, duration, success, properties) {
|
|
8155
|
-
const client = this.client;
|
|
8156
|
-
if (!client)
|
|
8157
|
-
return;
|
|
8158
|
-
const merged = this.mergeProperties(properties);
|
|
8159
|
-
const [trackError] = catchError(() => client.trackRequest({
|
|
8160
|
-
name,
|
|
8161
|
-
url: toOperationUrn(name),
|
|
8162
|
-
duration,
|
|
8163
|
-
resultCode: success ? "200" : "500",
|
|
8164
|
-
success,
|
|
8165
|
-
properties: merged
|
|
8166
|
-
}));
|
|
8167
|
-
if (trackError) {
|
|
8168
|
-
logger.debug(`[AppInsights] trackRequest failed for: ${name}`);
|
|
8169
|
-
}
|
|
8170
|
-
}
|
|
8171
|
-
async trackDependency(name, type2, duration, success, properties) {
|
|
8172
|
-
const client = this.client;
|
|
8173
|
-
if (!client)
|
|
8174
|
-
return;
|
|
8175
|
-
const merged = this.mergeProperties(properties);
|
|
8176
|
-
client.trackDependency({
|
|
8177
|
-
name,
|
|
8178
|
-
dependencyTypeName: type2,
|
|
8179
|
-
duration,
|
|
8180
|
-
resultCode: success ? "200" : "500",
|
|
8181
|
-
success,
|
|
8182
|
-
properties: merged
|
|
8183
|
-
});
|
|
8184
|
-
}
|
|
8185
|
-
async flush() {
|
|
8186
|
-
const client = this.client;
|
|
8187
|
-
if (!client) {
|
|
8188
|
-
logger.warn(`[AppInsights] flush error (non-fatal): nil client`);
|
|
8189
|
-
return;
|
|
8190
|
-
}
|
|
8191
|
-
const [error] = await catchError(new Promise((resolve2, reject) => {
|
|
8192
|
-
client.flush({
|
|
8193
|
-
callback: (response) => {
|
|
8194
|
-
if (!response) {
|
|
8195
|
-
resolve2();
|
|
8196
|
-
return;
|
|
8197
|
-
}
|
|
8198
|
-
const [parseError, parsed] = catchError(() => JSON.parse(response));
|
|
8199
|
-
if (parseError || parsed?.errors && parsed.errors.length > 0) {
|
|
8200
|
-
reject(new Error(response));
|
|
8201
|
-
} else {
|
|
8202
|
-
resolve2();
|
|
8203
|
-
}
|
|
8204
|
-
}
|
|
8205
|
-
});
|
|
8206
|
-
}));
|
|
8207
|
-
if (error) {
|
|
8208
|
-
logger.warn(`[AppInsights] flush error (non-fatal): ${error.message}`);
|
|
8209
|
-
}
|
|
8210
|
-
}
|
|
8211
|
-
async shutdown() {
|
|
8212
|
-
if (!this.appInsightsModule) {
|
|
8213
|
-
logger.warn(`[AppInsights] shutdown error (non-fatal): nil appInsightsModule`);
|
|
8214
|
-
return;
|
|
8215
|
-
}
|
|
8216
|
-
const appInsights = this.appInsightsModule;
|
|
8217
|
-
const [err] = catchError(() => appInsights.dispose());
|
|
8218
|
-
if (err) {
|
|
8219
|
-
logger.warn(`[AppInsights] shutdown error (non-fatal): ${err.message}`);
|
|
8220
|
-
}
|
|
8221
|
-
this.client = undefined;
|
|
8222
|
-
this.appInsightsModule = undefined;
|
|
8223
|
-
this.initialized = false;
|
|
8224
|
-
}
|
|
8225
|
-
}
|
|
8226
|
-
async function getOrCreateProvider(connectionString) {
|
|
8227
|
-
const existing = providerSlot.get();
|
|
8228
|
-
if (existing && typeof existing === "object" && "flush" in existing && typeof existing.flush === "function") {
|
|
8229
|
-
return existing;
|
|
8230
|
-
}
|
|
8231
|
-
if (existing instanceof Promise) {
|
|
8232
|
-
return existing;
|
|
8233
|
-
}
|
|
8234
|
-
const initPromise = (async () => {
|
|
8235
|
-
const provider = new NodeAppInsightsTelemetryProvider(connectionString);
|
|
8236
|
-
const ok = await provider.initialize();
|
|
8237
|
-
if (!ok) {
|
|
8238
|
-
providerSlot.clear();
|
|
8239
|
-
return;
|
|
8240
|
-
}
|
|
8241
|
-
providerSlot.set(provider);
|
|
8242
|
-
return provider;
|
|
8243
|
-
})();
|
|
8244
|
-
providerSlot.set(initPromise);
|
|
8245
|
-
return initPromise;
|
|
8246
|
-
}
|
|
8247
|
-
|
|
8248
|
-
// src/telemetry/telemetry-init.ts
|
|
8249
|
-
var telemetryInstanceSlot = singleton("TelemetryService");
|
|
8250
|
-
var DEFAULT_AI_CONNECTION_STRING = atob("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj");
|
|
8251
|
-
function getConnectionString() {
|
|
8252
|
-
return process.env.UIPATH_AI_CONNECTION_STRING || DEFAULT_AI_CONNECTION_STRING;
|
|
8253
|
-
}
|
|
8254
|
-
async function createAppInsightsProvider() {
|
|
8255
|
-
return getOrCreateProvider(getConnectionString());
|
|
8256
|
-
}
|
|
8257
|
-
function isTelemetryDisabled() {
|
|
8258
|
-
const value = process.env.UIPATH_TELEMETRY_DISABLED;
|
|
8259
|
-
return value === "1" || value === "true";
|
|
8260
|
-
}
|
|
8261
|
-
var telemetryProviderInstance;
|
|
8262
|
-
async function createTelemetryProvider() {
|
|
8263
|
-
if (isTelemetryDisabled()) {
|
|
8264
|
-
const fallback = new LoggerTelemetryProvider;
|
|
8265
|
-
telemetryProviderInstance = fallback;
|
|
8266
|
-
return { provider: fallback, name: "Disabled" };
|
|
8267
|
-
}
|
|
8268
|
-
const [error, provider] = await catchError(createAppInsightsProvider());
|
|
8269
|
-
if (error) {
|
|
8270
|
-
logger.warn(`[Telemetry] AppInsights provider failed: ${error.message}. Falling back to logger.`);
|
|
8271
|
-
}
|
|
8272
|
-
if (error || !provider) {
|
|
8273
|
-
const fallback = new LoggerTelemetryProvider;
|
|
8274
|
-
telemetryProviderInstance = fallback;
|
|
8275
|
-
return { provider: fallback, name: "LoggerTelemetryProvider" };
|
|
8276
|
-
}
|
|
8277
|
-
telemetryProviderInstance = provider;
|
|
8278
|
-
return { provider, name: "NodeAppInsightsTelemetryProvider" };
|
|
8279
|
-
}
|
|
8280
|
-
function getGlobalTelemetryInstance() {
|
|
8281
|
-
const existing = telemetryInstanceSlot.get();
|
|
8282
|
-
if (existing && typeof existing === "object" && "trackEvent" in existing && typeof existing.trackEvent === "function") {
|
|
8283
|
-
return existing;
|
|
8284
|
-
}
|
|
8285
|
-
return;
|
|
8286
|
-
}
|
|
8287
|
-
function setGlobalTelemetryInstance(instance) {
|
|
8288
|
-
telemetryInstanceSlot.set(instance);
|
|
8289
|
-
}
|
|
8290
|
-
var _localTelemetryInstance;
|
|
8291
|
-
function getTelemetryInstance() {
|
|
8292
|
-
const global = getGlobalTelemetryInstance();
|
|
8293
|
-
if (global)
|
|
8294
|
-
return global;
|
|
8295
|
-
if (!_localTelemetryInstance) {
|
|
8296
|
-
_localTelemetryInstance = new TelemetryService(new LoggerTelemetryProvider, new NodeContextStorage);
|
|
8297
|
-
}
|
|
8298
|
-
return _localTelemetryInstance;
|
|
8299
|
-
}
|
|
8300
|
-
var telemetry = new Proxy({}, {
|
|
8301
|
-
get(_, prop) {
|
|
8302
|
-
const instance = getTelemetryInstance();
|
|
8303
|
-
const value = instance[prop];
|
|
8304
|
-
return typeof value === "function" ? value.bind(instance) : value;
|
|
8305
|
-
}
|
|
8306
|
-
});
|
|
8307
|
-
async function telemetryInit(options) {
|
|
8308
|
-
const { provider, name: providerName } = await createTelemetryProvider();
|
|
8309
|
-
const instance = new TelemetryService(provider, new NodeContextStorage);
|
|
8310
|
-
setGlobalTelemetryInstance(instance);
|
|
8311
|
-
_localTelemetryInstance = instance;
|
|
8312
|
-
const isAppInsights = providerName === "NodeAppInsightsTelemetryProvider";
|
|
8313
|
-
if (options?.version && isAppInsights) {
|
|
8314
|
-
provider.setApplicationVersion(options.version);
|
|
8315
|
-
}
|
|
8316
|
-
if (options?.defaultProperties) {
|
|
8317
|
-
setGlobalTelemetryProperties(options.defaultProperties);
|
|
8318
|
-
telemetry.setDefaultProperties(options.defaultProperties);
|
|
8319
|
-
}
|
|
8320
|
-
if (!isAppInsights) {
|
|
8321
|
-
logger.debug(`[Telemetry] initialized with fallback provider (${providerName}). applicationinsights package not available.`);
|
|
8322
|
-
}
|
|
8323
|
-
}
|
|
8324
|
-
var FLUSH_SHUTDOWN_TIMEOUT_MS = 5000;
|
|
8325
|
-
async function telemetryFlushAndShutdown() {
|
|
8326
|
-
if (telemetryProviderInstance && "shutdown" in telemetryProviderInstance) {
|
|
8327
|
-
const provider = telemetryProviderInstance;
|
|
8328
|
-
let timer;
|
|
8329
|
-
const timeout = new Promise((resolve2) => {
|
|
8330
|
-
timer = setTimeout(() => resolve2("timeout"), FLUSH_SHUTDOWN_TIMEOUT_MS);
|
|
8331
|
-
});
|
|
8332
|
-
const result = await Promise.race([
|
|
8333
|
-
provider.flush().then(() => provider.shutdown()).then(() => "done"),
|
|
8334
|
-
timeout
|
|
8335
|
-
]);
|
|
8336
|
-
if (timer)
|
|
8337
|
-
clearTimeout(timer);
|
|
8338
|
-
if (result === "timeout") {
|
|
8339
|
-
logger.warn(`[Telemetry] flush/shutdown timed out after ${FLUSH_SHUTDOWN_TIMEOUT_MS}ms`);
|
|
8340
|
-
}
|
|
8341
|
-
}
|
|
8342
|
-
}
|
|
8343
|
-
|
|
8344
|
-
// src/formatter.ts
|
|
8345
|
-
var RESULTS = {
|
|
8346
|
-
Success: "Success",
|
|
8347
|
-
Failure: "Failure",
|
|
8348
|
-
ConfigError: "ConfigError",
|
|
8349
|
-
AuthenticationError: "AuthenticationError",
|
|
8350
|
-
ValidationError: "ValidationError",
|
|
8351
|
-
TimeoutError: "TimeoutError"
|
|
8352
|
-
};
|
|
8353
|
-
var EXIT_CODES = {
|
|
8354
|
-
Success: 0,
|
|
8355
|
-
Failure: 1,
|
|
8356
|
-
ConfigError: 1,
|
|
8357
|
-
AuthenticationError: 2,
|
|
8358
|
-
ValidationError: 3,
|
|
8359
|
-
TimeoutError: 4
|
|
8360
|
-
};
|
|
8361
|
-
|
|
8362
|
-
class SuccessOutput {
|
|
8363
|
-
Result = RESULTS.Success;
|
|
8364
|
-
Code;
|
|
8365
|
-
Data;
|
|
8366
|
-
Instructions;
|
|
8367
|
-
Log;
|
|
8368
|
-
constructor(code, data) {
|
|
8369
|
-
this.Code = code;
|
|
8370
|
-
this.Data = data;
|
|
8371
|
-
const logPath = getLogFilePath();
|
|
8372
|
-
if (logPath) {
|
|
8373
|
-
this.Log = logPath;
|
|
8580
|
+
}
|
|
8581
|
+
async trackEvent(eventName, properties) {
|
|
8582
|
+
const client = this.client;
|
|
8583
|
+
if (!client)
|
|
8584
|
+
return;
|
|
8585
|
+
const merged = this.mergeProperties(properties);
|
|
8586
|
+
const [error] = catchError(() => client.trackEvent({
|
|
8587
|
+
name: eventName,
|
|
8588
|
+
properties: merged
|
|
8589
|
+
}));
|
|
8590
|
+
if (error) {
|
|
8591
|
+
logger.debug(`[AppInsights] trackEvent failed for: ${eventName}`);
|
|
8374
8592
|
}
|
|
8375
8593
|
}
|
|
8376
|
-
|
|
8377
|
-
|
|
8378
|
-
|
|
8379
|
-
|
|
8380
|
-
|
|
8381
|
-
|
|
8382
|
-
|
|
8383
|
-
|
|
8384
|
-
|
|
8385
|
-
|
|
8386
|
-
|
|
8387
|
-
this.Instructions = instructions;
|
|
8388
|
-
if (context) {
|
|
8389
|
-
this.Context = context;
|
|
8594
|
+
async trackException(error, properties) {
|
|
8595
|
+
const client = this.client;
|
|
8596
|
+
if (!client)
|
|
8597
|
+
return;
|
|
8598
|
+
const merged = this.mergeProperties(properties);
|
|
8599
|
+
const [trackError] = catchError(() => client.trackException({
|
|
8600
|
+
exception: error,
|
|
8601
|
+
properties: merged
|
|
8602
|
+
}));
|
|
8603
|
+
if (trackError) {
|
|
8604
|
+
logger.debug(`[AppInsights] trackException failed for: ${error.message}`);
|
|
8390
8605
|
}
|
|
8391
|
-
|
|
8392
|
-
|
|
8393
|
-
|
|
8606
|
+
}
|
|
8607
|
+
async trackRequest(name, duration, success, properties) {
|
|
8608
|
+
const client = this.client;
|
|
8609
|
+
if (!client)
|
|
8610
|
+
return;
|
|
8611
|
+
const merged = this.mergeProperties(properties);
|
|
8612
|
+
const [trackError] = catchError(() => client.trackRequest({
|
|
8613
|
+
name,
|
|
8614
|
+
url: toOperationUrn(name),
|
|
8615
|
+
duration,
|
|
8616
|
+
resultCode: success ? "200" : "500",
|
|
8617
|
+
success,
|
|
8618
|
+
properties: merged
|
|
8619
|
+
}));
|
|
8620
|
+
if (trackError) {
|
|
8621
|
+
logger.debug(`[AppInsights] trackRequest failed for: ${name}`);
|
|
8394
8622
|
}
|
|
8395
8623
|
}
|
|
8396
|
-
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
|
|
8400
|
-
|
|
8624
|
+
async trackDependency(name, type2, duration, success, properties) {
|
|
8625
|
+
const client = this.client;
|
|
8626
|
+
if (!client)
|
|
8627
|
+
return;
|
|
8628
|
+
const merged = this.mergeProperties(properties);
|
|
8629
|
+
client.trackDependency({
|
|
8630
|
+
name,
|
|
8631
|
+
dependencyTypeName: type2,
|
|
8632
|
+
duration,
|
|
8633
|
+
resultCode: success ? "200" : "500",
|
|
8634
|
+
success,
|
|
8635
|
+
properties: merged
|
|
8636
|
+
});
|
|
8401
8637
|
}
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
logFn(toYaml(data));
|
|
8408
|
-
break;
|
|
8409
|
-
case "plain": {
|
|
8410
|
-
if ("Data" in data && data.Data != null) {
|
|
8411
|
-
const items = Array.isArray(data.Data) ? data.Data : [data.Data];
|
|
8412
|
-
items.forEach((item) => {
|
|
8413
|
-
const values = Object.values(item).map((v) => v ?? "").join("\t");
|
|
8414
|
-
logFn(values);
|
|
8415
|
-
});
|
|
8416
|
-
} else {
|
|
8417
|
-
const values = Object.values(data).map((v) => v ?? "").join("\t");
|
|
8418
|
-
logFn(values);
|
|
8419
|
-
}
|
|
8420
|
-
break;
|
|
8638
|
+
async flush() {
|
|
8639
|
+
const client = this.client;
|
|
8640
|
+
if (!client) {
|
|
8641
|
+
logger.warn(`[AppInsights] flush error (non-fatal): nil client`);
|
|
8642
|
+
return;
|
|
8421
8643
|
}
|
|
8422
|
-
|
|
8423
|
-
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
|
|
8427
|
-
|
|
8428
|
-
|
|
8644
|
+
const [error] = await catchError(new Promise((resolve2, reject) => {
|
|
8645
|
+
client.flush({
|
|
8646
|
+
callback: (response) => {
|
|
8647
|
+
const errorMessage = normalizeFlushCallbackError(response);
|
|
8648
|
+
if (errorMessage === undefined) {
|
|
8649
|
+
resolve2();
|
|
8650
|
+
return;
|
|
8651
|
+
}
|
|
8652
|
+
reject(new Error(errorMessage));
|
|
8429
8653
|
}
|
|
8430
|
-
}
|
|
8431
|
-
|
|
8432
|
-
|
|
8433
|
-
|
|
8654
|
+
});
|
|
8655
|
+
}));
|
|
8656
|
+
if (error) {
|
|
8657
|
+
logger.warn(`[AppInsights] flush error (non-fatal): ${error.message}`);
|
|
8434
8658
|
}
|
|
8435
8659
|
}
|
|
8436
|
-
|
|
8437
|
-
|
|
8438
|
-
|
|
8439
|
-
|
|
8440
|
-
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
}
|
|
8445
|
-
|
|
8446
|
-
|
|
8447
|
-
|
|
8448
|
-
|
|
8449
|
-
for (let pos = 0;pos < text.length; pos += width) {
|
|
8450
|
-
lines.push(text.substring(pos, pos + width));
|
|
8451
|
-
}
|
|
8452
|
-
return lines;
|
|
8453
|
-
}
|
|
8454
|
-
function printTable(data, logFn, externalLogValue) {
|
|
8455
|
-
if (data.length === 0)
|
|
8456
|
-
return;
|
|
8457
|
-
const keys = Object.keys(data[0]).filter((key) => key !== "Code" && key !== "Log");
|
|
8458
|
-
const maxWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
|
|
8459
|
-
const header = keys.map((key, i2) => key.padEnd(maxWidths[i2])).join(" | ");
|
|
8460
|
-
logFn(header);
|
|
8461
|
-
logFn(keys.map((_, i2) => "-".repeat(maxWidths[i2])).join("-|-"));
|
|
8462
|
-
data.forEach((item) => {
|
|
8463
|
-
const row = keys.map((key, i2) => cellToString(item[key]).padEnd(maxWidths[i2])).join(" | ");
|
|
8464
|
-
logFn(row);
|
|
8465
|
-
});
|
|
8466
|
-
if (externalLogValue) {
|
|
8467
|
-
logFn("");
|
|
8468
|
-
logFn(`Log: ${externalLogValue}`);
|
|
8469
|
-
}
|
|
8470
|
-
}
|
|
8471
|
-
function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
8472
|
-
const keys = Object.keys(data).filter((key) => key !== "Code" && key !== "Log");
|
|
8473
|
-
if (keys.length === 0)
|
|
8474
|
-
return;
|
|
8475
|
-
const maxKeyWidth = Math.max(...keys.map((key) => key.length));
|
|
8476
|
-
keys.forEach((key) => {
|
|
8477
|
-
const keyCol = key.padEnd(maxKeyWidth);
|
|
8478
|
-
logFn(`${keyCol} | ${cellToString(data[key])}`);
|
|
8479
|
-
});
|
|
8480
|
-
if (externalLogValue) {
|
|
8481
|
-
logFn("");
|
|
8482
|
-
logFn(`Log: ${externalLogValue}`);
|
|
8660
|
+
async shutdown() {
|
|
8661
|
+
if (!this.appInsightsModule) {
|
|
8662
|
+
logger.warn(`[AppInsights] shutdown error (non-fatal): nil appInsightsModule`);
|
|
8663
|
+
return;
|
|
8664
|
+
}
|
|
8665
|
+
const appInsights = this.appInsightsModule;
|
|
8666
|
+
const [err] = catchError(() => appInsights.dispose());
|
|
8667
|
+
if (err) {
|
|
8668
|
+
logger.warn(`[AppInsights] shutdown error (non-fatal): ${err.message}`);
|
|
8669
|
+
}
|
|
8670
|
+
this.client = undefined;
|
|
8671
|
+
this.appInsightsModule = undefined;
|
|
8672
|
+
this.initialized = false;
|
|
8483
8673
|
}
|
|
8484
8674
|
}
|
|
8485
|
-
function
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
if (keys.length === 0)
|
|
8490
|
-
return;
|
|
8491
|
-
if (!process.stdout.isTTY) {
|
|
8492
|
-
printTable(data, logFn, externalLogValue);
|
|
8493
|
-
return;
|
|
8494
|
-
}
|
|
8495
|
-
const naturalWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
|
|
8496
|
-
const separatorTotal = (keys.length - 1) * 3;
|
|
8497
|
-
const totalWidth = naturalWidths.reduce((a, b) => a + b, 0) + separatorTotal;
|
|
8498
|
-
const termWidth = process.stdout.columns || 120;
|
|
8499
|
-
if (totalWidth <= termWidth) {
|
|
8500
|
-
printTable(data, logFn, externalLogValue);
|
|
8501
|
-
return;
|
|
8675
|
+
async function getOrCreateProvider(connectionString) {
|
|
8676
|
+
const existing = providerSlot.get();
|
|
8677
|
+
if (existing && typeof existing === "object" && "flush" in existing && typeof existing.flush === "function") {
|
|
8678
|
+
return existing;
|
|
8502
8679
|
}
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
const minWidths = keys.map((key) => Math.max(key.length, MIN_COL_WIDTH));
|
|
8506
|
-
let bestCol = -1;
|
|
8507
|
-
let bestCost = Infinity;
|
|
8508
|
-
for (let i2 = 0;i2 < keys.length; i2++) {
|
|
8509
|
-
const maxShrink = naturalWidths[i2] - minWidths[i2];
|
|
8510
|
-
if (maxShrink < overflow)
|
|
8511
|
-
continue;
|
|
8512
|
-
const newWidth = naturalWidths[i2] - overflow;
|
|
8513
|
-
let extraRows = 0;
|
|
8514
|
-
for (const item of data) {
|
|
8515
|
-
const cellLen = cellToString(item[keys[i2]]).length;
|
|
8516
|
-
if (cellLen > newWidth) {
|
|
8517
|
-
extraRows += Math.ceil(cellLen / newWidth) - 1;
|
|
8518
|
-
}
|
|
8519
|
-
}
|
|
8520
|
-
if (extraRows < bestCost) {
|
|
8521
|
-
bestCost = extraRows;
|
|
8522
|
-
bestCol = i2;
|
|
8523
|
-
}
|
|
8680
|
+
if (existing instanceof Promise) {
|
|
8681
|
+
return existing;
|
|
8524
8682
|
}
|
|
8525
|
-
const
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
|
|
8529
|
-
|
|
8530
|
-
|
|
8531
|
-
index: i2,
|
|
8532
|
-
potential: naturalWidths[i2] - minWidths[i2]
|
|
8533
|
-
})).filter((c) => c.potential > 0).sort((a, b) => b.potential - a.potential);
|
|
8534
|
-
for (const col of colsByShrinkPotential) {
|
|
8535
|
-
if (remaining <= 0)
|
|
8536
|
-
break;
|
|
8537
|
-
const shrink = Math.min(remaining, col.potential);
|
|
8538
|
-
finalWidths[col.index] -= shrink;
|
|
8539
|
-
remaining -= shrink;
|
|
8683
|
+
const initPromise = (async () => {
|
|
8684
|
+
const provider = new NodeAppInsightsTelemetryProvider(connectionString);
|
|
8685
|
+
const ok = await provider.initialize();
|
|
8686
|
+
if (!ok) {
|
|
8687
|
+
providerSlot.clear();
|
|
8688
|
+
return;
|
|
8540
8689
|
}
|
|
8690
|
+
providerSlot.set(provider);
|
|
8691
|
+
return provider;
|
|
8692
|
+
})();
|
|
8693
|
+
providerSlot.set(initPromise);
|
|
8694
|
+
return initPromise;
|
|
8695
|
+
}
|
|
8696
|
+
|
|
8697
|
+
// src/telemetry/telemetry-init.ts
|
|
8698
|
+
var telemetryInstanceSlot = singleton("TelemetryService");
|
|
8699
|
+
var DEFAULT_AI_CONNECTION_STRING = atob("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj");
|
|
8700
|
+
function getConnectionString() {
|
|
8701
|
+
return process.env.UIPATH_AI_CONNECTION_STRING || DEFAULT_AI_CONNECTION_STRING;
|
|
8702
|
+
}
|
|
8703
|
+
async function createAppInsightsProvider() {
|
|
8704
|
+
return getOrCreateProvider(getConnectionString());
|
|
8705
|
+
}
|
|
8706
|
+
function isTelemetryDisabled() {
|
|
8707
|
+
const value = process.env.UIPATH_TELEMETRY_DISABLED;
|
|
8708
|
+
return value === "1" || value === "true";
|
|
8709
|
+
}
|
|
8710
|
+
var telemetryProviderInstance;
|
|
8711
|
+
async function createTelemetryProvider() {
|
|
8712
|
+
if (isTelemetryDisabled()) {
|
|
8713
|
+
const fallback = new LoggerTelemetryProvider;
|
|
8714
|
+
telemetryProviderInstance = fallback;
|
|
8715
|
+
return { provider: fallback, name: "Disabled" };
|
|
8541
8716
|
}
|
|
8542
|
-
const
|
|
8543
|
-
|
|
8544
|
-
|
|
8545
|
-
data.forEach((item) => {
|
|
8546
|
-
const cellLines = keys.map((key, i2) => wrapText(cellToString(item[key]), finalWidths[i2]));
|
|
8547
|
-
const lineCount = Math.max(...cellLines.map((l) => l.length));
|
|
8548
|
-
for (let line = 0;line < lineCount; line++) {
|
|
8549
|
-
const row = keys.map((_, i2) => {
|
|
8550
|
-
const val = line < cellLines[i2].length ? cellLines[i2][line] : "";
|
|
8551
|
-
return val.padEnd(finalWidths[i2]);
|
|
8552
|
-
}).join(" | ");
|
|
8553
|
-
logFn(row);
|
|
8554
|
-
}
|
|
8555
|
-
});
|
|
8556
|
-
if (externalLogValue) {
|
|
8557
|
-
logFn("");
|
|
8558
|
-
logFn(`Log: ${externalLogValue}`);
|
|
8717
|
+
const [error, provider] = await catchError(createAppInsightsProvider());
|
|
8718
|
+
if (error) {
|
|
8719
|
+
logger.warn(`[Telemetry] AppInsights provider failed: ${error.message}. Falling back to logger.`);
|
|
8559
8720
|
}
|
|
8721
|
+
if (error || !provider) {
|
|
8722
|
+
const fallback = new LoggerTelemetryProvider;
|
|
8723
|
+
telemetryProviderInstance = fallback;
|
|
8724
|
+
return { provider: fallback, name: "LoggerTelemetryProvider" };
|
|
8725
|
+
}
|
|
8726
|
+
telemetryProviderInstance = provider;
|
|
8727
|
+
return { provider, name: "NodeAppInsightsTelemetryProvider" };
|
|
8560
8728
|
}
|
|
8561
|
-
function
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
try {
|
|
8566
|
-
compile(filter);
|
|
8567
|
-
return null;
|
|
8568
|
-
} catch (err) {
|
|
8569
|
-
return err instanceof Error ? err : new Error(String(err));
|
|
8729
|
+
function getGlobalTelemetryInstance() {
|
|
8730
|
+
const existing = telemetryInstanceSlot.get();
|
|
8731
|
+
if (existing && typeof existing === "object" && "trackEvent" in existing && typeof existing.trackEvent === "function") {
|
|
8732
|
+
return existing;
|
|
8570
8733
|
}
|
|
8734
|
+
return;
|
|
8571
8735
|
}
|
|
8572
|
-
function
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
return result;
|
|
8736
|
+
function setGlobalTelemetryInstance(instance) {
|
|
8737
|
+
telemetryInstanceSlot.set(instance);
|
|
8738
|
+
}
|
|
8739
|
+
var _localTelemetryInstance;
|
|
8740
|
+
function getTelemetryInstance() {
|
|
8741
|
+
const global = getGlobalTelemetryInstance();
|
|
8742
|
+
if (global)
|
|
8743
|
+
return global;
|
|
8744
|
+
if (!_localTelemetryInstance) {
|
|
8745
|
+
_localTelemetryInstance = new TelemetryService(new LoggerTelemetryProvider, new NodeContextStorage);
|
|
8583
8746
|
}
|
|
8584
|
-
|
|
8585
|
-
return result;
|
|
8586
|
-
return { Value: result };
|
|
8747
|
+
return _localTelemetryInstance;
|
|
8587
8748
|
}
|
|
8588
|
-
var
|
|
8589
|
-
(
|
|
8590
|
-
|
|
8591
|
-
|
|
8592
|
-
|
|
8593
|
-
if (filter) {
|
|
8594
|
-
data.Data = applyFilter(data.Data, filter);
|
|
8595
|
-
}
|
|
8596
|
-
logOutput(data, getOutputFormat());
|
|
8749
|
+
var telemetry = new Proxy({}, {
|
|
8750
|
+
get(_, prop) {
|
|
8751
|
+
const instance = getTelemetryInstance();
|
|
8752
|
+
const value = instance[prop];
|
|
8753
|
+
return typeof value === "function" ? value.bind(instance) : value;
|
|
8597
8754
|
}
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8755
|
+
});
|
|
8756
|
+
async function telemetryInit(options) {
|
|
8757
|
+
const { provider, name: providerName } = await createTelemetryProvider();
|
|
8758
|
+
const instance = new TelemetryService(provider, new NodeContextStorage);
|
|
8759
|
+
setGlobalTelemetryInstance(instance);
|
|
8760
|
+
_localTelemetryInstance = instance;
|
|
8761
|
+
const isAppInsights = providerName === "NodeAppInsightsTelemetryProvider";
|
|
8762
|
+
if (options?.version && isAppInsights) {
|
|
8763
|
+
provider.setApplicationVersion(options.version);
|
|
8607
8764
|
}
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
Result: RESULTS.Success,
|
|
8612
|
-
Code: code,
|
|
8613
|
-
Data: items
|
|
8614
|
-
};
|
|
8615
|
-
if (items.length === 0 && opts?.emptyInstructions) {
|
|
8616
|
-
data.Instructions = opts.emptyInstructions;
|
|
8617
|
-
}
|
|
8618
|
-
if (opts?.warning) {
|
|
8619
|
-
data.Warning = opts.warning;
|
|
8620
|
-
}
|
|
8621
|
-
success(data);
|
|
8765
|
+
if (options?.defaultProperties) {
|
|
8766
|
+
setGlobalTelemetryProperties(options.defaultProperties);
|
|
8767
|
+
telemetry.setDefaultProperties(options.defaultProperties);
|
|
8622
8768
|
}
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
const format = getOutputFormat();
|
|
8626
|
-
const sink = getOutputSink();
|
|
8627
|
-
if (format === "json") {
|
|
8628
|
-
sink.writeErr(`${JSON.stringify(data)}
|
|
8629
|
-
`);
|
|
8630
|
-
} else {
|
|
8631
|
-
for (const [key, value] of Object.entries(data)) {
|
|
8632
|
-
sink.writeErr(`${key}: ${value}
|
|
8633
|
-
`);
|
|
8634
|
-
}
|
|
8635
|
-
}
|
|
8769
|
+
if (!isAppInsights) {
|
|
8770
|
+
logger.debug(`[Telemetry] initialized with fallback provider (${providerName}). applicationinsights package not available.`);
|
|
8636
8771
|
}
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
const
|
|
8644
|
-
|
|
8645
|
-
lines.push(msg);
|
|
8772
|
+
}
|
|
8773
|
+
var FLUSH_SHUTDOWN_TIMEOUT_MS = 5000;
|
|
8774
|
+
async function telemetryFlushAndShutdown() {
|
|
8775
|
+
if (telemetryProviderInstance && "shutdown" in telemetryProviderInstance) {
|
|
8776
|
+
const provider = telemetryProviderInstance;
|
|
8777
|
+
let timer;
|
|
8778
|
+
const timeout = new Promise((resolve2) => {
|
|
8779
|
+
timer = setTimeout(() => resolve2("timeout"), FLUSH_SHUTDOWN_TIMEOUT_MS);
|
|
8646
8780
|
});
|
|
8647
|
-
|
|
8648
|
-
|
|
8781
|
+
const result = await Promise.race([
|
|
8782
|
+
provider.flush().then(() => provider.shutdown()).then(() => "done"),
|
|
8783
|
+
timeout
|
|
8784
|
+
]);
|
|
8785
|
+
if (timer)
|
|
8786
|
+
clearTimeout(timer);
|
|
8787
|
+
if (result === "timeout") {
|
|
8788
|
+
logger.warn(`[Telemetry] flush/shutdown timed out after ${FLUSH_SHUTDOWN_TIMEOUT_MS}ms`);
|
|
8789
|
+
}
|
|
8649
8790
|
}
|
|
8650
|
-
|
|
8651
|
-
})(OutputFormatter ||= {});
|
|
8791
|
+
}
|
|
8652
8792
|
|
|
8653
|
-
// src/
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
|
|
8660
|
-
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
|
|
8665
|
-
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8793
|
+
// src/formatter.ts
|
|
8794
|
+
var RESULTS = {
|
|
8795
|
+
Success: "Success",
|
|
8796
|
+
Failure: "Failure",
|
|
8797
|
+
ConfigError: "ConfigError",
|
|
8798
|
+
AuthenticationError: "AuthenticationError",
|
|
8799
|
+
ValidationError: "ValidationError",
|
|
8800
|
+
TimeoutError: "TimeoutError"
|
|
8801
|
+
};
|
|
8802
|
+
var EXIT_CODES = {
|
|
8803
|
+
Success: 0,
|
|
8804
|
+
Failure: 1,
|
|
8805
|
+
ConfigError: 1,
|
|
8806
|
+
AuthenticationError: 2,
|
|
8807
|
+
ValidationError: 3,
|
|
8808
|
+
TimeoutError: 4
|
|
8809
|
+
};
|
|
8810
|
+
|
|
8811
|
+
class Pagination {
|
|
8812
|
+
Returned;
|
|
8813
|
+
Limit;
|
|
8814
|
+
Offset;
|
|
8815
|
+
Total;
|
|
8816
|
+
HasMore;
|
|
8817
|
+
constructor({
|
|
8818
|
+
returned,
|
|
8819
|
+
limit,
|
|
8820
|
+
offset,
|
|
8821
|
+
total
|
|
8822
|
+
}) {
|
|
8823
|
+
this.Returned = returned;
|
|
8824
|
+
this.Limit = limit;
|
|
8825
|
+
this.Offset = offset;
|
|
8826
|
+
this.Total = total;
|
|
8827
|
+
this.HasMore = total === undefined ? returned === limit : offset + returned < total;
|
|
8828
|
+
}
|
|
8829
|
+
}
|
|
8830
|
+
|
|
8831
|
+
class SuccessOutput {
|
|
8832
|
+
Result = RESULTS.Success;
|
|
8833
|
+
Code;
|
|
8834
|
+
Data;
|
|
8835
|
+
Pagination;
|
|
8836
|
+
Instructions;
|
|
8837
|
+
Log;
|
|
8838
|
+
constructor(code, data) {
|
|
8839
|
+
this.Code = code;
|
|
8840
|
+
this.Data = data;
|
|
8841
|
+
const logPath = getLogFilePath();
|
|
8842
|
+
if (logPath) {
|
|
8843
|
+
this.Log = logPath;
|
|
8676
8844
|
}
|
|
8677
|
-
return result2;
|
|
8678
|
-
});
|
|
8679
|
-
const examples = getCommandExamples(cmd);
|
|
8680
|
-
const result = {
|
|
8681
|
-
Command: cmd.name(),
|
|
8682
|
-
Description: description,
|
|
8683
|
-
Usage: usage,
|
|
8684
|
-
Arguments: args,
|
|
8685
|
-
Options: options
|
|
8686
|
-
};
|
|
8687
|
-
if (examples.length > 0) {
|
|
8688
|
-
result.Examples = examples;
|
|
8689
8845
|
}
|
|
8690
|
-
return result;
|
|
8691
8846
|
}
|
|
8692
|
-
function formatHelpAll(command, baseName = "") {
|
|
8693
|
-
const entries = [];
|
|
8694
|
-
collectCommands(command, baseName, entries);
|
|
8695
|
-
const helper = command.createHelp();
|
|
8696
|
-
const format = getOutputFormat();
|
|
8697
|
-
if (format === "table" || format === "plain") {
|
|
8698
|
-
return entries.map((e) => Help.prototype.formatHelp.call(helper, e.command, helper)).join(`
|
|
8699
8847
|
|
|
8700
|
-
|
|
8848
|
+
class FailureOutput {
|
|
8849
|
+
Result;
|
|
8850
|
+
Message;
|
|
8851
|
+
Instructions;
|
|
8852
|
+
Context;
|
|
8853
|
+
Log;
|
|
8854
|
+
constructor(result, message, instructions, context) {
|
|
8855
|
+
this.Result = result;
|
|
8856
|
+
this.Message = message;
|
|
8857
|
+
this.Instructions = instructions;
|
|
8858
|
+
if (context) {
|
|
8859
|
+
this.Context = context;
|
|
8860
|
+
}
|
|
8861
|
+
const logPath = getLogFilePath();
|
|
8862
|
+
if (logPath) {
|
|
8863
|
+
this.Log = logPath;
|
|
8864
|
+
}
|
|
8701
8865
|
}
|
|
8702
|
-
const data = entries.map((e) => {
|
|
8703
|
-
const help = extractCommandHelp(e.command, helper);
|
|
8704
|
-
return { ...help, Command: e.fullName };
|
|
8705
|
-
});
|
|
8706
|
-
const output = {
|
|
8707
|
-
Result: RESULTS.Success,
|
|
8708
|
-
Code: "HelpAll",
|
|
8709
|
-
Data: data
|
|
8710
|
-
};
|
|
8711
|
-
return OutputFormatter.formatToString(output);
|
|
8712
8866
|
}
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
|
|
8717
|
-
|
|
8718
|
-
|
|
8719
|
-
|
|
8867
|
+
function printOutput(data, format2 = "json", logFn) {
|
|
8868
|
+
if (!data) {
|
|
8869
|
+
logFn("Empty response object. No data to display.");
|
|
8870
|
+
return;
|
|
8871
|
+
}
|
|
8872
|
+
switch (format2) {
|
|
8873
|
+
case "json":
|
|
8874
|
+
logFn(JSON.stringify(data, null, 2));
|
|
8875
|
+
break;
|
|
8876
|
+
case "yaml":
|
|
8877
|
+
logFn(toYaml(data));
|
|
8878
|
+
break;
|
|
8879
|
+
case "plain": {
|
|
8880
|
+
if ("Data" in data && data.Data != null) {
|
|
8881
|
+
const items = Array.isArray(data.Data) ? data.Data : [data.Data];
|
|
8882
|
+
items.forEach((item) => {
|
|
8883
|
+
const values = Object.values(item).map((v) => v ?? "").join("\t");
|
|
8884
|
+
logFn(values);
|
|
8885
|
+
});
|
|
8886
|
+
} else {
|
|
8887
|
+
const values = Object.values(data).map((v) => v ?? "").join("\t");
|
|
8888
|
+
logFn(values);
|
|
8720
8889
|
}
|
|
8890
|
+
break;
|
|
8721
8891
|
}
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
|
|
8892
|
+
default: {
|
|
8893
|
+
if ("Data" in data && data.Data != null && !(Array.isArray(data.Data) && data.Data.length === 0)) {
|
|
8894
|
+
const logValue = data.Log;
|
|
8895
|
+
if (Array.isArray(data.Data)) {
|
|
8896
|
+
printResizableTable(data.Data, logFn, logValue);
|
|
8897
|
+
} else {
|
|
8898
|
+
printVerticalTable(data.Data, logFn, logValue);
|
|
8899
|
+
}
|
|
8900
|
+
} else {
|
|
8901
|
+
printTable([{ ...data }], logFn);
|
|
8726
8902
|
}
|
|
8903
|
+
break;
|
|
8727
8904
|
}
|
|
8728
8905
|
}
|
|
8729
|
-
return getOutputSink().capabilities.isInteractive ? "table" : "json";
|
|
8730
8906
|
}
|
|
8731
|
-
function
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
command.configureOutput().writeOut?.(formatHelpAll(command, baseName));
|
|
8736
|
-
throw new CommanderError(0, "commander.helpDisplayed", "(outputHelp)");
|
|
8737
|
-
});
|
|
8907
|
+
function logOutput(data, format2 = "json") {
|
|
8908
|
+
const sink = getOutputSink();
|
|
8909
|
+
printOutput(data, format2, (msg) => sink.writeOut(`${msg}
|
|
8910
|
+
`));
|
|
8738
8911
|
}
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
function withCompleter(target, spec) {
|
|
8742
|
-
target[COMPLETER_SYMBOL] = spec;
|
|
8743
|
-
return target;
|
|
8912
|
+
function cellToString(val) {
|
|
8913
|
+
return val != null && typeof val === "object" ? JSON.stringify(val) : String(val ?? "");
|
|
8744
8914
|
}
|
|
8745
|
-
function
|
|
8746
|
-
if (
|
|
8747
|
-
return;
|
|
8748
|
-
const
|
|
8749
|
-
|
|
8750
|
-
|
|
8915
|
+
function wrapText(text, width) {
|
|
8916
|
+
if (text.length <= width)
|
|
8917
|
+
return [text];
|
|
8918
|
+
const lines = [];
|
|
8919
|
+
for (let pos = 0;pos < text.length; pos += width) {
|
|
8920
|
+
lines.push(text.substring(pos, pos + width));
|
|
8751
8921
|
}
|
|
8752
|
-
return;
|
|
8922
|
+
return lines;
|
|
8753
8923
|
}
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
|
|
8763
|
-
|
|
8764
|
-
|
|
8765
|
-
if (i2 >= rest.length)
|
|
8766
|
-
return spec;
|
|
8767
|
-
const arg = rest[i2++];
|
|
8768
|
-
switch (spec) {
|
|
8769
|
-
case "%s":
|
|
8770
|
-
return String(arg);
|
|
8771
|
-
case "%d":
|
|
8772
|
-
case "%i":
|
|
8773
|
-
return String(parseInt(String(arg), 10));
|
|
8774
|
-
case "%f":
|
|
8775
|
-
return String(parseFloat(String(arg)));
|
|
8776
|
-
case "%j":
|
|
8777
|
-
case "%o":
|
|
8778
|
-
case "%O":
|
|
8779
|
-
try {
|
|
8780
|
-
return JSON.stringify(arg);
|
|
8781
|
-
} catch {
|
|
8782
|
-
return String(arg);
|
|
8783
|
-
}
|
|
8784
|
-
default:
|
|
8785
|
-
return spec;
|
|
8786
|
-
}
|
|
8924
|
+
function printTable(data, logFn, externalLogValue) {
|
|
8925
|
+
if (data.length === 0)
|
|
8926
|
+
return;
|
|
8927
|
+
const keys = Object.keys(data[0]).filter((key) => key !== "Code" && key !== "Log");
|
|
8928
|
+
const maxWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
|
|
8929
|
+
const header = keys.map((key, i2) => key.padEnd(maxWidths[i2])).join(" | ");
|
|
8930
|
+
logFn(header);
|
|
8931
|
+
logFn(keys.map((_, i2) => "-".repeat(maxWidths[i2])).join("-|-"));
|
|
8932
|
+
data.forEach((item) => {
|
|
8933
|
+
const row = keys.map((key, i2) => cellToString(item[key]).padEnd(maxWidths[i2])).join(" | ");
|
|
8934
|
+
logFn(row);
|
|
8787
8935
|
});
|
|
8788
|
-
|
|
8789
|
-
|
|
8790
|
-
|
|
8936
|
+
if (externalLogValue) {
|
|
8937
|
+
logFn("");
|
|
8938
|
+
logFn(`Log: ${externalLogValue}`);
|
|
8791
8939
|
}
|
|
8792
|
-
return result;
|
|
8793
8940
|
}
|
|
8794
|
-
function
|
|
8795
|
-
|
|
8796
|
-
|
|
8797
|
-
}
|
|
8798
|
-
var guardInstalledSlot = singleton("ConsoleGuardInstalled");
|
|
8799
|
-
var savedOriginalsSlot = singleton("ConsoleGuardOriginals");
|
|
8800
|
-
function installConsoleGuard() {
|
|
8801
|
-
if (guardInstalledSlot.get(false))
|
|
8941
|
+
function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
8942
|
+
const keys = Object.keys(data).filter((key) => key !== "Code" && key !== "Log");
|
|
8943
|
+
if (keys.length === 0)
|
|
8802
8944
|
return;
|
|
8803
|
-
const
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
let reentrant = false;
|
|
8812
|
-
function guardedWriter(original) {
|
|
8813
|
-
return (...args) => {
|
|
8814
|
-
if (reentrant) {
|
|
8815
|
-
original.apply(console, args);
|
|
8816
|
-
return;
|
|
8817
|
-
}
|
|
8818
|
-
reentrant = true;
|
|
8819
|
-
try {
|
|
8820
|
-
getOutputSink().writeErr(formatArgs(args));
|
|
8821
|
-
} finally {
|
|
8822
|
-
reentrant = false;
|
|
8823
|
-
}
|
|
8824
|
-
};
|
|
8945
|
+
const maxKeyWidth = Math.max(...keys.map((key) => key.length));
|
|
8946
|
+
keys.forEach((key) => {
|
|
8947
|
+
const keyCol = key.padEnd(maxKeyWidth);
|
|
8948
|
+
logFn(`${keyCol} | ${cellToString(data[key])}`);
|
|
8949
|
+
});
|
|
8950
|
+
if (externalLogValue) {
|
|
8951
|
+
logFn("");
|
|
8952
|
+
logFn(`Log: ${externalLogValue}`);
|
|
8825
8953
|
}
|
|
8826
|
-
console.log = guardedWriter(originals.log);
|
|
8827
|
-
console.info = guardedWriter(originals.info);
|
|
8828
|
-
console.warn = guardedWriter(originals.warn);
|
|
8829
|
-
console.error = guardedWriter(originals.error);
|
|
8830
|
-
console.debug = guardedWriter(originals.debug);
|
|
8831
|
-
guardInstalledSlot.set(true);
|
|
8832
8954
|
}
|
|
8833
|
-
function
|
|
8834
|
-
|
|
8835
|
-
|
|
8955
|
+
function printResizableTable(data, logFn = console.log, externalLogValue) {
|
|
8956
|
+
if (data.length === 0)
|
|
8957
|
+
return;
|
|
8958
|
+
const keys = Object.keys(data[0]).filter((key) => key !== "Code" && key !== "Log");
|
|
8959
|
+
if (keys.length === 0)
|
|
8960
|
+
return;
|
|
8961
|
+
if (!process.stdout.isTTY) {
|
|
8962
|
+
printTable(data, logFn, externalLogValue);
|
|
8836
8963
|
return;
|
|
8837
|
-
console.log = originals.log;
|
|
8838
|
-
console.info = originals.info;
|
|
8839
|
-
console.warn = originals.warn;
|
|
8840
|
-
console.error = originals.error;
|
|
8841
|
-
console.debug = originals.debug;
|
|
8842
|
-
guardInstalledSlot.clear();
|
|
8843
|
-
}
|
|
8844
|
-
// src/constants.ts
|
|
8845
|
-
var UIPATH_HOME_DIR = ".uipath";
|
|
8846
|
-
var AUTH_FILENAME = ".auth";
|
|
8847
|
-
var CONFIG_FILENAME = "config.json";
|
|
8848
|
-
var LOCAL_CONFIG_FILENAME = "uipath.config.json";
|
|
8849
|
-
var DEFAULT_BASE_URL = "https://cloud.uipath.com";
|
|
8850
|
-
var DEFAULT_PAGE_SIZE = 50;
|
|
8851
|
-
var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
|
|
8852
|
-
var DEFAULT_FETCH_TIMEOUT_MS = 30000;
|
|
8853
|
-
var DEFAULT_REDIRECT_URI = "http://localhost:8104/oidc/login";
|
|
8854
|
-
// src/env-reference.ts
|
|
8855
|
-
function resolveEnvReference(value) {
|
|
8856
|
-
if (value == null)
|
|
8857
|
-
return value;
|
|
8858
|
-
if (value.startsWith("env.")) {
|
|
8859
|
-
const name = value.slice(4);
|
|
8860
|
-
const resolved = process.env[name];
|
|
8861
|
-
if (!resolved) {
|
|
8862
|
-
throw new Error(`Environment variable "${name}" is not set`);
|
|
8863
|
-
}
|
|
8864
|
-
return resolved;
|
|
8865
8964
|
}
|
|
8866
|
-
|
|
8867
|
-
|
|
8868
|
-
|
|
8869
|
-
|
|
8870
|
-
|
|
8871
|
-
|
|
8872
|
-
|
|
8873
|
-
|
|
8874
|
-
const
|
|
8875
|
-
const
|
|
8876
|
-
|
|
8877
|
-
let
|
|
8878
|
-
let
|
|
8879
|
-
|
|
8880
|
-
|
|
8881
|
-
|
|
8882
|
-
|
|
8883
|
-
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
|
|
8888
|
-
|
|
8889
|
-
if (Array.isArray(field) && field.length > 0) {
|
|
8890
|
-
const first = field[0];
|
|
8891
|
-
if (first && typeof first.message === "string") {
|
|
8892
|
-
extractedMessage = first.message;
|
|
8893
|
-
break;
|
|
8894
|
-
}
|
|
8895
|
-
}
|
|
8896
|
-
}
|
|
8897
|
-
}
|
|
8898
|
-
if (!extractedMessage) {
|
|
8899
|
-
extractedMessage = typeof parsedBody.message === "string" ? parsedBody.message : typeof parsedBody.errorMessage === "string" ? parsedBody.errorMessage : typeof parsedBody.title === "string" ? parsedBody.title : undefined;
|
|
8900
|
-
}
|
|
8901
|
-
if (!extractedMessage) {
|
|
8902
|
-
extractedMessage = body;
|
|
8903
|
-
}
|
|
8904
|
-
} else {
|
|
8905
|
-
extractedMessage = body;
|
|
8965
|
+
const naturalWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
|
|
8966
|
+
const separatorTotal = (keys.length - 1) * 3;
|
|
8967
|
+
const totalWidth = naturalWidths.reduce((a, b) => a + b, 0) + separatorTotal;
|
|
8968
|
+
const termWidth = process.stdout.columns || 120;
|
|
8969
|
+
if (totalWidth <= termWidth) {
|
|
8970
|
+
printTable(data, logFn, externalLogValue);
|
|
8971
|
+
return;
|
|
8972
|
+
}
|
|
8973
|
+
const overflow = totalWidth - termWidth;
|
|
8974
|
+
const MIN_COL_WIDTH = 10;
|
|
8975
|
+
const minWidths = keys.map((key) => Math.max(key.length, MIN_COL_WIDTH));
|
|
8976
|
+
let bestCol = -1;
|
|
8977
|
+
let bestCost = Infinity;
|
|
8978
|
+
for (let i2 = 0;i2 < keys.length; i2++) {
|
|
8979
|
+
const maxShrink = naturalWidths[i2] - minWidths[i2];
|
|
8980
|
+
if (maxShrink < overflow)
|
|
8981
|
+
continue;
|
|
8982
|
+
const newWidth = naturalWidths[i2] - overflow;
|
|
8983
|
+
let extraRows = 0;
|
|
8984
|
+
for (const item of data) {
|
|
8985
|
+
const cellLen = cellToString(item[keys[i2]]).length;
|
|
8986
|
+
if (cellLen > newWidth) {
|
|
8987
|
+
extraRows += Math.ceil(cellLen / newWidth) - 1;
|
|
8906
8988
|
}
|
|
8907
8989
|
}
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
|
|
8911
|
-
let result = "Failure";
|
|
8912
|
-
if (status === 401) {
|
|
8913
|
-
message = DEFAULT_401;
|
|
8914
|
-
result = "AuthenticationError";
|
|
8915
|
-
} else if (status === 403) {
|
|
8916
|
-
message = options?.forbiddenMessage ?? DEFAULT_403;
|
|
8917
|
-
result = "AuthenticationError";
|
|
8918
|
-
} else if (status === 405) {
|
|
8919
|
-
message = DEFAULT_405;
|
|
8920
|
-
} else if (status === 400 || status === 422) {
|
|
8921
|
-
message = extractedMessage ? `HTTP ${status}: ${extractedMessage}` : `HTTP ${status}: ${rawMessage}`;
|
|
8922
|
-
result = "ValidationError";
|
|
8923
|
-
} else if (status === 429) {
|
|
8924
|
-
message = extractedMessage ? `HTTP ${status}: ${extractedMessage}` : `HTTP ${status}: ${rawMessage}`;
|
|
8925
|
-
} else if (extractedMessage) {
|
|
8926
|
-
message = status ? `HTTP ${status}: ${extractedMessage}` : extractedMessage;
|
|
8927
|
-
} else if (status) {
|
|
8928
|
-
if (rawMessage === "Unknown error" && response) {
|
|
8929
|
-
const statusText = response.statusText;
|
|
8930
|
-
message = statusText ? `HTTP ${status} ${statusText}` : `HTTP ${status} - request failed`;
|
|
8931
|
-
} else {
|
|
8932
|
-
message = `HTTP ${status}: ${rawMessage}`;
|
|
8990
|
+
if (extraRows < bestCost) {
|
|
8991
|
+
bestCost = extraRows;
|
|
8992
|
+
bestCol = i2;
|
|
8933
8993
|
}
|
|
8934
|
-
} else {
|
|
8935
|
-
message = rawMessage;
|
|
8936
8994
|
}
|
|
8937
|
-
|
|
8938
|
-
if (
|
|
8939
|
-
|
|
8940
|
-
const extra = {};
|
|
8941
|
-
if (parsedBody.errorCode)
|
|
8942
|
-
extra.errorCode = parsedBody.errorCode;
|
|
8943
|
-
if (parsedBody.details)
|
|
8944
|
-
extra.details = parsedBody.details;
|
|
8945
|
-
if (parsedBody.errors != null)
|
|
8946
|
-
extra.errors = parsedBody.errors;
|
|
8947
|
-
if (parsedBody.data && typeof parsedBody.data === "object" && Object.keys(parsedBody.data).length > 0) {
|
|
8948
|
-
extra.data = parsedBody.data;
|
|
8949
|
-
}
|
|
8950
|
-
details = Object.keys(extra).length > 0 ? JSON.stringify(extra) : rawBody;
|
|
8951
|
-
} else {
|
|
8952
|
-
details = rawBody;
|
|
8953
|
-
}
|
|
8954
|
-
} else if (typeof err.message === "string") {
|
|
8955
|
-
details = err.message;
|
|
8995
|
+
const finalWidths = [...naturalWidths];
|
|
8996
|
+
if (bestCol !== -1) {
|
|
8997
|
+
finalWidths[bestCol] = naturalWidths[bestCol] - overflow;
|
|
8956
8998
|
} else {
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
|
|
8960
|
-
|
|
8961
|
-
|
|
8999
|
+
let remaining = overflow;
|
|
9000
|
+
const colsByShrinkPotential = keys.map((_, i2) => ({
|
|
9001
|
+
index: i2,
|
|
9002
|
+
potential: naturalWidths[i2] - minWidths[i2]
|
|
9003
|
+
})).filter((c) => c.potential > 0).sort((a, b) => b.potential - a.potential);
|
|
9004
|
+
for (const col of colsByShrinkPotential) {
|
|
9005
|
+
if (remaining <= 0)
|
|
9006
|
+
break;
|
|
9007
|
+
const shrink = Math.min(remaining, col.potential);
|
|
9008
|
+
finalWidths[col.index] -= shrink;
|
|
9009
|
+
remaining -= shrink;
|
|
9010
|
+
}
|
|
8962
9011
|
}
|
|
8963
|
-
|
|
8964
|
-
|
|
9012
|
+
const header = keys.map((key, i2) => key.padEnd(finalWidths[i2])).join(" | ");
|
|
9013
|
+
logFn(header);
|
|
9014
|
+
logFn(keys.map((_, i2) => "-".repeat(finalWidths[i2])).join("-|-"));
|
|
9015
|
+
data.forEach((item) => {
|
|
9016
|
+
const cellLines = keys.map((key, i2) => wrapText(cellToString(item[key]), finalWidths[i2]));
|
|
9017
|
+
const lineCount = Math.max(...cellLines.map((l) => l.length));
|
|
9018
|
+
for (let line = 0;line < lineCount; line++) {
|
|
9019
|
+
const row = keys.map((_, i2) => {
|
|
9020
|
+
const val = line < cellLines[i2].length ? cellLines[i2][line] : "";
|
|
9021
|
+
return val.padEnd(finalWidths[i2]);
|
|
9022
|
+
}).join(" | ");
|
|
9023
|
+
logFn(row);
|
|
9024
|
+
}
|
|
9025
|
+
});
|
|
9026
|
+
if (externalLogValue) {
|
|
9027
|
+
logFn("");
|
|
9028
|
+
logFn(`Log: ${externalLogValue}`);
|
|
8965
9029
|
}
|
|
8966
|
-
|
|
8967
|
-
|
|
9030
|
+
}
|
|
9031
|
+
function toYaml(data) {
|
|
9032
|
+
return dump(data);
|
|
9033
|
+
}
|
|
9034
|
+
function validateOutputFilter(filter) {
|
|
9035
|
+
try {
|
|
9036
|
+
compile(filter);
|
|
9037
|
+
return null;
|
|
9038
|
+
} catch (err) {
|
|
9039
|
+
return err instanceof Error ? err : new Error(String(err));
|
|
8968
9040
|
}
|
|
8969
|
-
|
|
8970
|
-
|
|
8971
|
-
|
|
8972
|
-
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
const
|
|
8978
|
-
|
|
8979
|
-
}
|
|
8980
|
-
if (retryAfterValue) {
|
|
8981
|
-
const seconds = Number(retryAfterValue);
|
|
8982
|
-
if (!Number.isNaN(seconds)) {
|
|
8983
|
-
context.retryAfter = seconds;
|
|
8984
|
-
}
|
|
9041
|
+
}
|
|
9042
|
+
function applyFilter(data, filter) {
|
|
9043
|
+
const result = search(data, filter);
|
|
9044
|
+
if (result == null)
|
|
9045
|
+
return [];
|
|
9046
|
+
if (Array.isArray(result)) {
|
|
9047
|
+
if (result.length > 0 && typeof result[0] !== "object") {
|
|
9048
|
+
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
9049
|
+
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
9050
|
+
return result.map((v) => ({ [key]: v }));
|
|
8985
9051
|
}
|
|
9052
|
+
return result;
|
|
8986
9053
|
}
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
}
|
|
8990
|
-
async function extractErrorMessage(error, options) {
|
|
8991
|
-
const { message } = await extractErrorDetails(error, options);
|
|
8992
|
-
return message;
|
|
9054
|
+
if (typeof result === "object")
|
|
9055
|
+
return result;
|
|
9056
|
+
return { Value: result };
|
|
8993
9057
|
}
|
|
8994
|
-
|
|
8995
|
-
|
|
8996
|
-
|
|
9058
|
+
var OutputFormatter;
|
|
9059
|
+
((OutputFormatter) => {
|
|
9060
|
+
function success(data) {
|
|
9061
|
+
data.Log ??= getLogFilePath() || undefined;
|
|
9062
|
+
const filter = getOutputFilter();
|
|
9063
|
+
if (filter) {
|
|
9064
|
+
data.Data = applyFilter(data.Data, filter);
|
|
9065
|
+
}
|
|
9066
|
+
logOutput(data, getOutputFormat());
|
|
8997
9067
|
}
|
|
8998
|
-
|
|
8999
|
-
|
|
9000
|
-
|
|
9068
|
+
OutputFormatter.success = success;
|
|
9069
|
+
function error(data) {
|
|
9070
|
+
data.Log ??= getLogFilePath() || undefined;
|
|
9071
|
+
process.exitCode = EXIT_CODES[data.Result] ?? 1;
|
|
9072
|
+
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
9073
|
+
result: data.Result,
|
|
9074
|
+
message: data.Message
|
|
9075
|
+
});
|
|
9076
|
+
logOutput(data, getOutputFormat());
|
|
9077
|
+
}
|
|
9078
|
+
OutputFormatter.error = error;
|
|
9079
|
+
function emitList(code, items, opts) {
|
|
9080
|
+
const data = {
|
|
9081
|
+
Result: RESULTS.Success,
|
|
9082
|
+
Code: code,
|
|
9083
|
+
Data: items
|
|
9084
|
+
};
|
|
9085
|
+
if (items.length === 0 && opts?.emptyInstructions) {
|
|
9086
|
+
data.Instructions = opts.emptyInstructions;
|
|
9001
9087
|
}
|
|
9002
|
-
if (
|
|
9003
|
-
|
|
9088
|
+
if (opts?.warning) {
|
|
9089
|
+
data.Warning = opts.warning;
|
|
9004
9090
|
}
|
|
9091
|
+
success(data);
|
|
9005
9092
|
}
|
|
9006
|
-
|
|
9007
|
-
|
|
9008
|
-
|
|
9009
|
-
|
|
9010
|
-
|
|
9011
|
-
|
|
9012
|
-
|
|
9013
|
-
|
|
9014
|
-
|
|
9015
|
-
|
|
9016
|
-
|
|
9017
|
-
switch (ctx) {
|
|
9018
|
-
case "auth":
|
|
9019
|
-
return "Re-authenticate with 'uip login' or verify your session hasn't expired";
|
|
9020
|
-
case "identity":
|
|
9021
|
-
return "Pass --tenant (and ensure your login includes an organization) or re-authenticate";
|
|
9022
|
-
case "input-parse":
|
|
9023
|
-
return "Ensure --inputs is valid JSON or pipe JSON via stdin";
|
|
9024
|
-
case "input-validate":
|
|
9025
|
-
return "Fix the flagged input fields to match the process's input schema";
|
|
9026
|
-
case "flag-format":
|
|
9027
|
-
return "Check the flag value format — see --help for the expected shape";
|
|
9028
|
-
case "permissions":
|
|
9029
|
-
return "Confirm your user has the required permissions in this folder/tenant, or re-authenticate with 'uip login' if your session has lapsed";
|
|
9030
|
-
case "backend": {
|
|
9031
|
-
const status = extractHttpStatus(err);
|
|
9032
|
-
if (status === 401) {
|
|
9033
|
-
return "Re-authenticate with 'uip login' — your session is invalid or expired";
|
|
9034
|
-
}
|
|
9035
|
-
if (status === 403) {
|
|
9036
|
-
return "Confirm your user has access to the folder and the required permissions";
|
|
9037
|
-
}
|
|
9038
|
-
if (status === 404) {
|
|
9039
|
-
return "Verify the resource exists in the current folder/tenant";
|
|
9040
|
-
}
|
|
9041
|
-
if (status === 400) {
|
|
9042
|
-
return "Request was rejected — check flag values and inputs";
|
|
9043
|
-
}
|
|
9044
|
-
if (status !== undefined && status >= 500 && status < 600) {
|
|
9045
|
-
return "Orchestrator returned a server error — retry; if it persists, check service status";
|
|
9093
|
+
OutputFormatter.emitList = emitList;
|
|
9094
|
+
function log(data) {
|
|
9095
|
+
const format2 = getOutputFormat();
|
|
9096
|
+
const sink = getOutputSink();
|
|
9097
|
+
if (format2 === "json") {
|
|
9098
|
+
sink.writeErr(`${JSON.stringify(data)}
|
|
9099
|
+
`);
|
|
9100
|
+
} else {
|
|
9101
|
+
for (const [key, value] of Object.entries(data)) {
|
|
9102
|
+
sink.writeErr(`${key}: ${value}
|
|
9103
|
+
`);
|
|
9046
9104
|
}
|
|
9047
|
-
return GENERIC;
|
|
9048
9105
|
}
|
|
9049
9106
|
}
|
|
9107
|
+
OutputFormatter.log = log;
|
|
9108
|
+
function formatToString(data) {
|
|
9109
|
+
const filter = getOutputFilter();
|
|
9110
|
+
if (filter && "Data" in data && data.Data != null) {
|
|
9111
|
+
data.Data = applyFilter(data.Data, filter);
|
|
9112
|
+
}
|
|
9113
|
+
const lines = [];
|
|
9114
|
+
printOutput(data, getOutputFormat(), (msg) => {
|
|
9115
|
+
lines.push(msg);
|
|
9116
|
+
});
|
|
9117
|
+
return lines.join(`
|
|
9118
|
+
`);
|
|
9119
|
+
}
|
|
9120
|
+
OutputFormatter.formatToString = formatToString;
|
|
9121
|
+
})(OutputFormatter ||= {});
|
|
9122
|
+
// src/guid.ts
|
|
9123
|
+
var GUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
9124
|
+
function isGuid(value) {
|
|
9125
|
+
return GUID_REGEX.test(value);
|
|
9050
9126
|
}
|
|
9051
9127
|
// ../../node_modules/jsonpath-plus/dist/index-node-esm.js
|
|
9052
9128
|
import vm from "vm";
|
|
@@ -10479,18 +10555,65 @@ function parseOffset(raw, _previous) {
|
|
|
10479
10555
|
return parseBoundedInt(raw, "--offset", { min: 0, max: 1e6 });
|
|
10480
10556
|
}
|
|
10481
10557
|
function parseBoundedInt(raw, optionName, bounds) {
|
|
10482
|
-
|
|
10558
|
+
const normalized = raw.trim();
|
|
10559
|
+
if (normalized === "") {
|
|
10483
10560
|
throw new InvalidArgumentError(`${optionName} requires a value (got empty).`);
|
|
10484
10561
|
}
|
|
10485
|
-
if (!/^-?\d+$/.test(
|
|
10486
|
-
throw new InvalidArgumentError(`${optionName} must be an integer, got '${
|
|
10562
|
+
if (!/^-?\d+$/.test(normalized)) {
|
|
10563
|
+
throw new InvalidArgumentError(`${optionName} must be an integer, got '${normalized}'.`);
|
|
10487
10564
|
}
|
|
10488
|
-
const n = parseInt(
|
|
10565
|
+
const n = parseInt(normalized, 10);
|
|
10489
10566
|
if (n < bounds.min || n > bounds.max) {
|
|
10490
10567
|
throw new InvalidArgumentError(`${optionName} must be between ${bounds.min} and ${bounds.max}, got ${n}.`);
|
|
10491
10568
|
}
|
|
10492
10569
|
return n;
|
|
10493
10570
|
}
|
|
10571
|
+
function parsePositiveInteger(raw) {
|
|
10572
|
+
return parseSafeInteger(raw, 1);
|
|
10573
|
+
}
|
|
10574
|
+
function parseNonNegativeInteger(raw) {
|
|
10575
|
+
return parseSafeInteger(raw, 0);
|
|
10576
|
+
}
|
|
10577
|
+
function parseSafeInteger(raw, min) {
|
|
10578
|
+
const normalized = raw.trim();
|
|
10579
|
+
if (!/^\d+$/.test(normalized)) {
|
|
10580
|
+
return;
|
|
10581
|
+
}
|
|
10582
|
+
const parsed = Number(normalized);
|
|
10583
|
+
if (!Number.isSafeInteger(parsed) || parsed < min) {
|
|
10584
|
+
return;
|
|
10585
|
+
}
|
|
10586
|
+
return parsed;
|
|
10587
|
+
}
|
|
10588
|
+
// src/orchestrator-urls.ts
|
|
10589
|
+
function requireNonEmpty(label, value) {
|
|
10590
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
10591
|
+
throw new Error(`${label} is required and must be a non-empty string (got ${JSON.stringify(value)})`);
|
|
10592
|
+
}
|
|
10593
|
+
}
|
|
10594
|
+
function trimTrailingSlash(s) {
|
|
10595
|
+
return s.endsWith("/") ? s.slice(0, -1) : s;
|
|
10596
|
+
}
|
|
10597
|
+
function buildOrchestratorUrl(baseUrl, org, tenant, path3) {
|
|
10598
|
+
requireNonEmpty("baseUrl", baseUrl);
|
|
10599
|
+
requireNonEmpty("org", org);
|
|
10600
|
+
requireNonEmpty("tenant", tenant);
|
|
10601
|
+
return `${trimTrailingSlash(baseUrl)}/${encodeURIComponent(org)}/${encodeURIComponent(tenant)}/orchestrator_${path3}`;
|
|
10602
|
+
}
|
|
10603
|
+
function buildActionCenterInboxUrl(baseUrl, org, tenant, taskKey) {
|
|
10604
|
+
requireNonEmpty("taskKey", taskKey);
|
|
10605
|
+
return buildOrchestratorUrl(baseUrl, org, tenant, `/actions/inbox/${encodeURIComponent(taskKey)}`);
|
|
10606
|
+
}
|
|
10607
|
+
function buildActionCenterTaskUrl(baseUrl, org, tenant, taskId) {
|
|
10608
|
+
const idStr = String(taskId);
|
|
10609
|
+
if (idStr.trim().length === 0 || idStr === "0") {
|
|
10610
|
+
throw new Error(`taskId is required and must be a non-zero, non-empty value (got ${JSON.stringify(taskId)})`);
|
|
10611
|
+
}
|
|
10612
|
+
requireNonEmpty("baseUrl", baseUrl);
|
|
10613
|
+
requireNonEmpty("org", org);
|
|
10614
|
+
requireNonEmpty("tenant", tenant);
|
|
10615
|
+
return `${trimTrailingSlash(baseUrl)}/${encodeURIComponent(org)}/${encodeURIComponent(tenant)}/actions_/current-task/tasks/${encodeURIComponent(idStr)}`;
|
|
10616
|
+
}
|
|
10494
10617
|
// src/polling/abort-controller.ts
|
|
10495
10618
|
var created = false;
|
|
10496
10619
|
function createPollAbortController() {
|
|
@@ -11192,8 +11315,10 @@ export {
|
|
|
11192
11315
|
telemetryInit,
|
|
11193
11316
|
telemetryFlushAndShutdown,
|
|
11194
11317
|
telemetry,
|
|
11318
|
+
singleton,
|
|
11195
11319
|
setProcessContextPollSignal,
|
|
11196
11320
|
setPackagerFactoryProvider,
|
|
11321
|
+
setOutputFormatExplicit,
|
|
11197
11322
|
setOutputFormat,
|
|
11198
11323
|
setOutputFilter,
|
|
11199
11324
|
setGlobalTelemetryProperties,
|
|
@@ -11203,11 +11328,12 @@ export {
|
|
|
11203
11328
|
restoreConsole,
|
|
11204
11329
|
resolveEnvReference,
|
|
11205
11330
|
resetLoggerInstance,
|
|
11206
|
-
registerHelpAll,
|
|
11207
11331
|
readRegistryValue,
|
|
11208
11332
|
processContext,
|
|
11209
11333
|
pollUntil,
|
|
11334
|
+
parsePositiveInteger,
|
|
11210
11335
|
parseOffset,
|
|
11336
|
+
parseNonNegativeInteger,
|
|
11211
11337
|
parseLimit,
|
|
11212
11338
|
parseBoundedInt,
|
|
11213
11339
|
msToDuration,
|
|
@@ -11215,17 +11341,19 @@ export {
|
|
|
11215
11341
|
isTerminalStatus,
|
|
11216
11342
|
isTelemetryDisabled,
|
|
11217
11343
|
isSuccessStatus,
|
|
11344
|
+
isHtmlDocument,
|
|
11345
|
+
isGuid,
|
|
11218
11346
|
isFailureStatus,
|
|
11219
11347
|
instructionsFor,
|
|
11220
11348
|
installConsoleGuard,
|
|
11221
11349
|
getOutputSink,
|
|
11350
|
+
getOutputFormatExplicit,
|
|
11222
11351
|
getOutputFormat,
|
|
11223
11352
|
getOutputFilter,
|
|
11224
11353
|
getLogFilePath,
|
|
11225
11354
|
getGlobalLogFilePath,
|
|
11226
11355
|
getCompleter,
|
|
11227
11356
|
getCommandExamples,
|
|
11228
|
-
formatHelpAll,
|
|
11229
11357
|
extractFormatFromArgs,
|
|
11230
11358
|
extractErrorMessageSync,
|
|
11231
11359
|
extractErrorMessage,
|
|
@@ -11241,18 +11369,21 @@ export {
|
|
|
11241
11369
|
configureLogger,
|
|
11242
11370
|
collectCommands,
|
|
11243
11371
|
catchError,
|
|
11372
|
+
buildOrchestratorUrl,
|
|
11373
|
+
buildActionCenterTaskUrl,
|
|
11374
|
+
buildActionCenterInboxUrl,
|
|
11244
11375
|
UIPATH_HOME_DIR,
|
|
11245
11376
|
TelemetryService,
|
|
11246
11377
|
SuccessOutput,
|
|
11247
11378
|
ScreenLogger,
|
|
11248
11379
|
RESULTS,
|
|
11249
11380
|
PollOutcome,
|
|
11381
|
+
Pagination,
|
|
11250
11382
|
POLL_DEFAULTS,
|
|
11251
11383
|
OutputFormatter,
|
|
11252
11384
|
NodeContextStorage,
|
|
11253
11385
|
MIN_INTERVAL_MS,
|
|
11254
11386
|
LogLevel,
|
|
11255
|
-
LOCAL_CONFIG_FILENAME,
|
|
11256
11387
|
JsonPathError,
|
|
11257
11388
|
FailureOutput,
|
|
11258
11389
|
ErrorDecision,
|