@uipath/admin-vpngateway-tool 1.1.0 → 1.195.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/index.js +780 -152
- package/dist/tool.js +780 -152
- package/package.json +28 -34
package/dist/index.js
CHANGED
|
@@ -2144,7 +2144,8 @@ var {
|
|
|
2144
2144
|
// package.json
|
|
2145
2145
|
var package_default = {
|
|
2146
2146
|
name: "@uipath/admin-vpngateway-tool",
|
|
2147
|
-
|
|
2147
|
+
license: "MIT",
|
|
2148
|
+
version: "1.195.0",
|
|
2148
2149
|
description: "CLI plugin for UiPath VPN Gateway management (Hypervisor service).",
|
|
2149
2150
|
private: false,
|
|
2150
2151
|
repository: {
|
|
@@ -2155,7 +2156,9 @@ var package_default = {
|
|
|
2155
2156
|
publishConfig: {
|
|
2156
2157
|
registry: "https://npm.pkg.github.com/@uipath"
|
|
2157
2158
|
},
|
|
2158
|
-
keywords: [
|
|
2159
|
+
keywords: [
|
|
2160
|
+
"cli-tool"
|
|
2161
|
+
],
|
|
2159
2162
|
type: "module",
|
|
2160
2163
|
main: "./dist/tool.js",
|
|
2161
2164
|
exports: {
|
|
@@ -2164,7 +2167,9 @@ var package_default = {
|
|
|
2164
2167
|
bin: {
|
|
2165
2168
|
"admin-vpngateway-tool": "./dist/index.js"
|
|
2166
2169
|
},
|
|
2167
|
-
files: [
|
|
2170
|
+
files: [
|
|
2171
|
+
"dist"
|
|
2172
|
+
],
|
|
2168
2173
|
scripts: {
|
|
2169
2174
|
build: "bun build ./src/tool.ts --outdir dist --format esm --target node --external commander && bun build ./src/index.ts --outdir dist --format esm --target node",
|
|
2170
2175
|
package: "bun run build && bun pm pack",
|
|
@@ -2213,6 +2218,7 @@ import path from "node:path";
|
|
|
2213
2218
|
import { fileURLToPath } from "node:url";
|
|
2214
2219
|
import childProcess3 from "node:child_process";
|
|
2215
2220
|
import fs5, { constants as fsConstants2 } from "node:fs/promises";
|
|
2221
|
+
import { randomUUID } from "node:crypto";
|
|
2216
2222
|
import { existsSync } from "node:fs";
|
|
2217
2223
|
import * as fs6 from "node:fs/promises";
|
|
2218
2224
|
import * as os2 from "node:os";
|
|
@@ -2964,6 +2970,90 @@ class NodeFileSystem {
|
|
|
2964
2970
|
async mkdir(dirPath) {
|
|
2965
2971
|
await fs6.mkdir(dirPath, { recursive: true });
|
|
2966
2972
|
}
|
|
2973
|
+
async acquireLock(lockPath) {
|
|
2974
|
+
const canonicalPath = await this.canonicalizeLockTarget(lockPath);
|
|
2975
|
+
const lockFile = `${canonicalPath}.lock`;
|
|
2976
|
+
const ownerId = randomUUID();
|
|
2977
|
+
const start = Date.now();
|
|
2978
|
+
while (true) {
|
|
2979
|
+
try {
|
|
2980
|
+
await fs6.writeFile(lockFile, ownerId, { flag: "wx" });
|
|
2981
|
+
return this.createLockRelease(lockFile, ownerId);
|
|
2982
|
+
} catch (error) {
|
|
2983
|
+
if (!this.hasErrnoCode(error, "EEXIST")) {
|
|
2984
|
+
throw error;
|
|
2985
|
+
}
|
|
2986
|
+
const stats = await fs6.stat(lockFile).catch(() => null);
|
|
2987
|
+
if (stats && Date.now() - stats.mtimeMs > LOCK_STALE_MS) {
|
|
2988
|
+
const reclaimed = await fs6.rm(lockFile, { force: true }).then(() => true).catch(() => false);
|
|
2989
|
+
if (reclaimed)
|
|
2990
|
+
continue;
|
|
2991
|
+
}
|
|
2992
|
+
if (Date.now() - start > LOCK_MAX_WAIT_MS) {
|
|
2993
|
+
throw new Error(`ELOCKED: timed out waiting for lock on ${canonicalPath}`);
|
|
2994
|
+
}
|
|
2995
|
+
await new Promise((resolve2) => setTimeout(resolve2, LOCK_RETRY_MIN_MS + Math.random() * LOCK_RETRY_JITTER_MS));
|
|
2996
|
+
}
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
async canonicalizeLockTarget(lockPath) {
|
|
3000
|
+
const absolute = path2.resolve(lockPath);
|
|
3001
|
+
const fullReal = await fs6.realpath(absolute).catch(() => null);
|
|
3002
|
+
if (fullReal)
|
|
3003
|
+
return fullReal;
|
|
3004
|
+
const parent = path2.dirname(absolute);
|
|
3005
|
+
const base = path2.basename(absolute);
|
|
3006
|
+
const canonicalParent = await fs6.realpath(parent).catch(() => parent);
|
|
3007
|
+
return path2.join(canonicalParent, base);
|
|
3008
|
+
}
|
|
3009
|
+
createLockRelease(lockFile, ownerId) {
|
|
3010
|
+
const heartbeatStart = Date.now();
|
|
3011
|
+
let heartbeatTimer;
|
|
3012
|
+
let stopped = false;
|
|
3013
|
+
const stopHeartbeat = () => {
|
|
3014
|
+
stopped = true;
|
|
3015
|
+
if (heartbeatTimer)
|
|
3016
|
+
clearTimeout(heartbeatTimer);
|
|
3017
|
+
};
|
|
3018
|
+
const scheduleNextHeartbeat = () => {
|
|
3019
|
+
if (stopped)
|
|
3020
|
+
return;
|
|
3021
|
+
if (Date.now() - heartbeatStart >= LOCK_MAX_HOLD_MS) {
|
|
3022
|
+
stopped = true;
|
|
3023
|
+
return;
|
|
3024
|
+
}
|
|
3025
|
+
heartbeatTimer = setTimeout(() => {
|
|
3026
|
+
runHeartbeat();
|
|
3027
|
+
}, LOCK_HEARTBEAT_MS);
|
|
3028
|
+
heartbeatTimer.unref?.();
|
|
3029
|
+
};
|
|
3030
|
+
const runHeartbeat = async () => {
|
|
3031
|
+
if (stopped)
|
|
3032
|
+
return;
|
|
3033
|
+
const current = await fs6.readFile(lockFile, "utf-8").catch(() => null);
|
|
3034
|
+
if (stopped)
|
|
3035
|
+
return;
|
|
3036
|
+
if (current !== ownerId) {
|
|
3037
|
+
stopped = true;
|
|
3038
|
+
return;
|
|
3039
|
+
}
|
|
3040
|
+
const now = Date.now() / 1000;
|
|
3041
|
+
await fs6.utimes(lockFile, now, now).catch(() => {});
|
|
3042
|
+
scheduleNextHeartbeat();
|
|
3043
|
+
};
|
|
3044
|
+
scheduleNextHeartbeat();
|
|
3045
|
+
let released = false;
|
|
3046
|
+
return async () => {
|
|
3047
|
+
if (released)
|
|
3048
|
+
return;
|
|
3049
|
+
released = true;
|
|
3050
|
+
stopHeartbeat();
|
|
3051
|
+
const current = await fs6.readFile(lockFile, "utf-8").catch(() => null);
|
|
3052
|
+
if (current === ownerId) {
|
|
3053
|
+
await fs6.rm(lockFile, { force: true });
|
|
3054
|
+
}
|
|
3055
|
+
};
|
|
3056
|
+
}
|
|
2967
3057
|
async rm(filePath) {
|
|
2968
3058
|
await fs6.rm(filePath, { recursive: true, force: true });
|
|
2969
3059
|
}
|
|
@@ -3009,9 +3099,18 @@ class NodeFileSystem {
|
|
|
3009
3099
|
}
|
|
3010
3100
|
}
|
|
3011
3101
|
isEnoent(error) {
|
|
3012
|
-
return
|
|
3102
|
+
return this.hasErrnoCode(error, "ENOENT");
|
|
3103
|
+
}
|
|
3104
|
+
hasErrnoCode(error, code) {
|
|
3105
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === code;
|
|
3013
3106
|
}
|
|
3014
3107
|
}
|
|
3108
|
+
var LOCK_HEARTBEAT_MS = 5000;
|
|
3109
|
+
var LOCK_STALE_MS = 15000;
|
|
3110
|
+
var LOCK_MAX_WAIT_MS = 20000;
|
|
3111
|
+
var LOCK_MAX_HOLD_MS = 60000;
|
|
3112
|
+
var LOCK_RETRY_MIN_MS = 100;
|
|
3113
|
+
var LOCK_RETRY_JITTER_MS = 200;
|
|
3015
3114
|
var init_node = __esm(() => {
|
|
3016
3115
|
init_open();
|
|
3017
3116
|
});
|
|
@@ -3023,7 +3122,7 @@ var init_src = __esm(() => {
|
|
|
3023
3122
|
fsInstance = new NodeFileSystem;
|
|
3024
3123
|
});
|
|
3025
3124
|
var require_coreipc = __commonJS2((exports, module) => {
|
|
3026
|
-
var __dirname3 = "/
|
|
3125
|
+
var __dirname3 = "/home/runner/work/cli/cli/node_modules/@uipath/coreipc";
|
|
3027
3126
|
/*! For license information please see index.js.LICENSE.txt */
|
|
3028
3127
|
(function(e, t) {
|
|
3029
3128
|
typeof exports == "object" && typeof module == "object" ? module.exports = t() : typeof define == "function" && define.amd ? define([], t) : typeof exports == "object" ? exports.ipc = t() : e.ipc = t();
|
|
@@ -20823,6 +20922,135 @@ var require_dist = __commonJS2((exports) => {
|
|
|
20823
20922
|
exports.RobotProxyConstructor = RobotProxyConstructor;
|
|
20824
20923
|
__exportStar(require_agent(), exports);
|
|
20825
20924
|
});
|
|
20925
|
+
var init_server = __esm(() => {
|
|
20926
|
+
init_constants();
|
|
20927
|
+
});
|
|
20928
|
+
var PREFIX = "@uipath/common/";
|
|
20929
|
+
var _g = globalThis;
|
|
20930
|
+
function singleton(ctorOrName) {
|
|
20931
|
+
const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
|
|
20932
|
+
const key = Symbol.for(PREFIX + name);
|
|
20933
|
+
return {
|
|
20934
|
+
get(fallback) {
|
|
20935
|
+
return _g[key] ?? fallback;
|
|
20936
|
+
},
|
|
20937
|
+
set(value) {
|
|
20938
|
+
_g[key] = value;
|
|
20939
|
+
},
|
|
20940
|
+
clear() {
|
|
20941
|
+
delete _g[key];
|
|
20942
|
+
},
|
|
20943
|
+
getOrInit(factory, guard) {
|
|
20944
|
+
const existing = _g[key];
|
|
20945
|
+
if (existing != null && typeof existing === "object") {
|
|
20946
|
+
if (!guard || guard(existing)) {
|
|
20947
|
+
return existing;
|
|
20948
|
+
}
|
|
20949
|
+
}
|
|
20950
|
+
const instance = factory();
|
|
20951
|
+
_g[key] = instance;
|
|
20952
|
+
return instance;
|
|
20953
|
+
}
|
|
20954
|
+
};
|
|
20955
|
+
}
|
|
20956
|
+
var USER_AGENT_HEADER = "User-Agent";
|
|
20957
|
+
var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
|
|
20958
|
+
function userAgentPatchKey(userAgent) {
|
|
20959
|
+
return Symbol.for(`@uipath/common/sdk-user-agent/${userAgent}`);
|
|
20960
|
+
}
|
|
20961
|
+
function splitUserAgentTokens(value) {
|
|
20962
|
+
return value?.trim().split(/\s+/).filter(Boolean) ?? [];
|
|
20963
|
+
}
|
|
20964
|
+
function appendUserAgentToken(value, userAgent) {
|
|
20965
|
+
const tokens = splitUserAgentTokens(value);
|
|
20966
|
+
const seen = new Set(tokens);
|
|
20967
|
+
for (const token of splitUserAgentTokens(userAgent)) {
|
|
20968
|
+
if (!seen.has(token)) {
|
|
20969
|
+
tokens.push(token);
|
|
20970
|
+
seen.add(token);
|
|
20971
|
+
}
|
|
20972
|
+
}
|
|
20973
|
+
return tokens.join(" ");
|
|
20974
|
+
}
|
|
20975
|
+
function getEffectiveUserAgent(userAgent) {
|
|
20976
|
+
return appendUserAgentToken(sdkUserAgentHostToken.get(), userAgent);
|
|
20977
|
+
}
|
|
20978
|
+
function isHeadersLike(headers) {
|
|
20979
|
+
return typeof headers === "object" && headers !== null && "get" in headers && typeof headers.get === "function" && "set" in headers && typeof headers.set === "function";
|
|
20980
|
+
}
|
|
20981
|
+
function getSdkUserAgentToken(pkg) {
|
|
20982
|
+
const packageName = pkg.name.replace(/^@uipath\//, "");
|
|
20983
|
+
return getEffectiveUserAgent(`${packageName}/${pkg.version}`);
|
|
20984
|
+
}
|
|
20985
|
+
function addSdkUserAgentHeader(headers, userAgent) {
|
|
20986
|
+
const result = { ...headers ?? {} };
|
|
20987
|
+
const effectiveUserAgent = getEffectiveUserAgent(userAgent);
|
|
20988
|
+
const headerName = Object.keys(result).find((key) => key.toLowerCase() === USER_AGENT_HEADER.toLowerCase());
|
|
20989
|
+
if (headerName) {
|
|
20990
|
+
result[headerName] = appendUserAgentToken(result[headerName], effectiveUserAgent);
|
|
20991
|
+
} else {
|
|
20992
|
+
result[USER_AGENT_HEADER] = effectiveUserAgent;
|
|
20993
|
+
}
|
|
20994
|
+
return result;
|
|
20995
|
+
}
|
|
20996
|
+
function withSdkUserAgentHeader(headers, userAgent) {
|
|
20997
|
+
const effectiveUserAgent = getEffectiveUserAgent(userAgent);
|
|
20998
|
+
if (isHeadersLike(headers)) {
|
|
20999
|
+
headers.set(USER_AGENT_HEADER, appendUserAgentToken(headers.get(USER_AGENT_HEADER), effectiveUserAgent));
|
|
21000
|
+
return headers;
|
|
21001
|
+
}
|
|
21002
|
+
if (Array.isArray(headers)) {
|
|
21003
|
+
const result = headers.map((entry) => {
|
|
21004
|
+
const [key, value] = entry;
|
|
21005
|
+
return [key, value];
|
|
21006
|
+
});
|
|
21007
|
+
const headerIndex = result.findIndex(([key]) => key.toLowerCase() === USER_AGENT_HEADER.toLowerCase());
|
|
21008
|
+
if (headerIndex >= 0) {
|
|
21009
|
+
const [key, value] = result[headerIndex];
|
|
21010
|
+
result[headerIndex] = [
|
|
21011
|
+
key,
|
|
21012
|
+
appendUserAgentToken(value, effectiveUserAgent)
|
|
21013
|
+
];
|
|
21014
|
+
} else {
|
|
21015
|
+
result.push([USER_AGENT_HEADER, effectiveUserAgent]);
|
|
21016
|
+
}
|
|
21017
|
+
return result;
|
|
21018
|
+
}
|
|
21019
|
+
return addSdkUserAgentHeader(typeof headers === "object" && headers !== null ? { ...headers } : {}, effectiveUserAgent);
|
|
21020
|
+
}
|
|
21021
|
+
function withUserAgentInitOverride(initOverrides, userAgent) {
|
|
21022
|
+
return async (requestContext) => {
|
|
21023
|
+
const initWithUserAgent = {
|
|
21024
|
+
...requestContext.init,
|
|
21025
|
+
headers: withSdkUserAgentHeader(requestContext.init.headers, userAgent)
|
|
21026
|
+
};
|
|
21027
|
+
const override = typeof initOverrides === "function" ? await initOverrides({
|
|
21028
|
+
...requestContext,
|
|
21029
|
+
init: initWithUserAgent
|
|
21030
|
+
}) : initOverrides;
|
|
21031
|
+
return {
|
|
21032
|
+
...override ?? {},
|
|
21033
|
+
headers: withSdkUserAgentHeader(override?.headers ?? initWithUserAgent.headers, userAgent)
|
|
21034
|
+
};
|
|
21035
|
+
};
|
|
21036
|
+
}
|
|
21037
|
+
function installSdkUserAgentHeader(BaseApiClass, userAgent) {
|
|
21038
|
+
const prototype = BaseApiClass.prototype;
|
|
21039
|
+
const patchKey = userAgentPatchKey(userAgent);
|
|
21040
|
+
if (prototype[patchKey]) {
|
|
21041
|
+
return;
|
|
21042
|
+
}
|
|
21043
|
+
if (typeof prototype.request !== "function") {
|
|
21044
|
+
throw new Error("Generated BaseAPI request function not found.");
|
|
21045
|
+
}
|
|
21046
|
+
const originalRequest = prototype.request;
|
|
21047
|
+
prototype.request = function requestWithUserAgent(context, initOverrides) {
|
|
21048
|
+
return originalRequest.call(this, context, withUserAgentInitOverride(initOverrides, userAgent));
|
|
21049
|
+
};
|
|
21050
|
+
Object.defineProperty(prototype, patchKey, {
|
|
21051
|
+
value: true
|
|
21052
|
+
});
|
|
21053
|
+
}
|
|
20826
21054
|
var BASE_PATH = "http://localhost".replace(/\/+$/, "");
|
|
20827
21055
|
|
|
20828
21056
|
class Configuration {
|
|
@@ -21071,6 +21299,54 @@ class VoidApiResponse {
|
|
|
21071
21299
|
return;
|
|
21072
21300
|
}
|
|
21073
21301
|
}
|
|
21302
|
+
var package_default2 = {
|
|
21303
|
+
name: "@uipath/admin-vpngateway-sdk",
|
|
21304
|
+
license: "MIT",
|
|
21305
|
+
version: "1.195.0",
|
|
21306
|
+
description: "SDK for the UiPath Hypervisor VPN Gateway management APIs.",
|
|
21307
|
+
repository: {
|
|
21308
|
+
type: "git",
|
|
21309
|
+
url: "https://github.com/UiPath/cli.git",
|
|
21310
|
+
directory: "packages/admin/vpngateway-sdk"
|
|
21311
|
+
},
|
|
21312
|
+
publishConfig: {
|
|
21313
|
+
registry: "https://npm.pkg.github.com/@uipath"
|
|
21314
|
+
},
|
|
21315
|
+
keywords: [
|
|
21316
|
+
"uipath",
|
|
21317
|
+
"vpn-gateway",
|
|
21318
|
+
"hypervisor",
|
|
21319
|
+
"sdk"
|
|
21320
|
+
],
|
|
21321
|
+
type: "module",
|
|
21322
|
+
main: "./dist/index.js",
|
|
21323
|
+
types: "./dist/src/index.d.ts",
|
|
21324
|
+
exports: {
|
|
21325
|
+
".": {
|
|
21326
|
+
types: "./dist/src/index.d.ts",
|
|
21327
|
+
default: "./dist/index.js"
|
|
21328
|
+
}
|
|
21329
|
+
},
|
|
21330
|
+
files: [
|
|
21331
|
+
"dist"
|
|
21332
|
+
],
|
|
21333
|
+
private: true,
|
|
21334
|
+
scripts: {
|
|
21335
|
+
build: "bun build ./src/index.ts --outdir dist --format esm --target node && tsc -p tsconfig.build.json --noCheck",
|
|
21336
|
+
generate: "bun run src/scripts/generate-sdk.ts",
|
|
21337
|
+
lint: "biome check ."
|
|
21338
|
+
},
|
|
21339
|
+
devDependencies: {
|
|
21340
|
+
"@openapitools/openapi-generator-cli": "^2.31.1",
|
|
21341
|
+
"@types/node": "^25.5.0",
|
|
21342
|
+
"@uipath/auth": "workspace:*",
|
|
21343
|
+
"@uipath/common": "workspace:*",
|
|
21344
|
+
"@uipath/filesystem": "workspace:*",
|
|
21345
|
+
typescript: "^6.0.2"
|
|
21346
|
+
}
|
|
21347
|
+
};
|
|
21348
|
+
var SDK_USER_AGENT = getSdkUserAgentToken(package_default2);
|
|
21349
|
+
installSdkUserAgentHeader(BaseAPI, SDK_USER_AGENT);
|
|
21074
21350
|
function FreezingMetadataFromJSON(json) {
|
|
21075
21351
|
return FreezingMetadataFromJSONTyped(json, false);
|
|
21076
21352
|
}
|
|
@@ -21764,32 +22040,7 @@ class InvalidBaseUrlError extends Error {
|
|
|
21764
22040
|
this.name = "InvalidBaseUrlError";
|
|
21765
22041
|
}
|
|
21766
22042
|
}
|
|
21767
|
-
var DEFAULT_SCOPES = [
|
|
21768
|
-
"offline_access",
|
|
21769
|
-
"ProcessMining",
|
|
21770
|
-
"OrchestratorApiUserAccess",
|
|
21771
|
-
"StudioWebBackend",
|
|
21772
|
-
"IdentityServerApi",
|
|
21773
|
-
"ConnectionService",
|
|
21774
|
-
"DataService",
|
|
21775
|
-
"DataServiceApiUserAccess",
|
|
21776
|
-
"DocumentUnderstanding",
|
|
21777
|
-
"EnterpriseContextService",
|
|
21778
|
-
"Directory",
|
|
21779
|
-
"JamJamApi",
|
|
21780
|
-
"LLMGateway",
|
|
21781
|
-
"LLMOps",
|
|
21782
|
-
"OMS",
|
|
21783
|
-
"RCS.FolderAuthorization",
|
|
21784
|
-
"RCS.TagsManagement",
|
|
21785
|
-
"TestmanagerApiUserAccess",
|
|
21786
|
-
"AutomationSolutions",
|
|
21787
|
-
"StudioWebTypeCacheService",
|
|
21788
|
-
"Docs.GPT.Search",
|
|
21789
|
-
"Insights",
|
|
21790
|
-
"ReferenceToken",
|
|
21791
|
-
"Audit.Read"
|
|
21792
|
-
];
|
|
22043
|
+
var DEFAULT_SCOPES = ["openid", "profile", "offline_access"];
|
|
21793
22044
|
var normalizeAndValidateBaseUrl = (rawUrl) => {
|
|
21794
22045
|
let baseUrl = rawUrl;
|
|
21795
22046
|
if (baseUrl.endsWith("/identity_/")) {
|
|
@@ -21839,7 +22090,8 @@ var resolveConfigAsync = async ({
|
|
|
21839
22090
|
if (!clientSecret && fileAuth.clientSecret) {
|
|
21840
22091
|
clientSecret = fileAuth.clientSecret;
|
|
21841
22092
|
}
|
|
21842
|
-
const
|
|
22093
|
+
const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && Boolean(clientSecret);
|
|
22094
|
+
const scopes = customScopes && customScopes.length > 0 ? customScopes : fileAuth.scopes && fileAuth.scopes.length > 0 ? fileAuth.scopes : isExternalAppAuth ? [] : DEFAULT_SCOPES;
|
|
21843
22095
|
return {
|
|
21844
22096
|
clientId,
|
|
21845
22097
|
clientSecret,
|
|
@@ -22326,6 +22578,129 @@ function normalizeTokenRefreshFailure() {
|
|
|
22326
22578
|
function normalizeTokenRefreshUnavailableFailure() {
|
|
22327
22579
|
return "token refresh failed before authentication completed";
|
|
22328
22580
|
}
|
|
22581
|
+
function errorMessage(error) {
|
|
22582
|
+
return error instanceof Error ? error.message : String(error);
|
|
22583
|
+
}
|
|
22584
|
+
function computeExpirationThreshold(ensureTokenValidityMinutes) {
|
|
22585
|
+
return new Date(Date.now() + (ensureTokenValidityMinutes ?? 0) * 60 * 1000);
|
|
22586
|
+
}
|
|
22587
|
+
async function runRefreshLocked(inputs) {
|
|
22588
|
+
const {
|
|
22589
|
+
absolutePath,
|
|
22590
|
+
refreshToken: callerRefreshToken,
|
|
22591
|
+
customAuthority,
|
|
22592
|
+
ensureTokenValidityMinutes,
|
|
22593
|
+
loadEnvFile,
|
|
22594
|
+
saveEnvFile,
|
|
22595
|
+
refreshFn,
|
|
22596
|
+
resolveConfig
|
|
22597
|
+
} = inputs;
|
|
22598
|
+
const expirationThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
|
|
22599
|
+
let fresh;
|
|
22600
|
+
try {
|
|
22601
|
+
fresh = await loadEnvFile({ envPath: absolutePath });
|
|
22602
|
+
} catch (error) {
|
|
22603
|
+
return {
|
|
22604
|
+
kind: "fail",
|
|
22605
|
+
status: {
|
|
22606
|
+
loginStatus: "Refresh Failed",
|
|
22607
|
+
hint: "Could not read the auth file while refreshing. Retry, or run 'uip login' to re-authenticate.",
|
|
22608
|
+
tokenRefresh: {
|
|
22609
|
+
attempted: false,
|
|
22610
|
+
success: false,
|
|
22611
|
+
errorMessage: `auth file read failed: ${errorMessage(error)}`
|
|
22612
|
+
}
|
|
22613
|
+
}
|
|
22614
|
+
};
|
|
22615
|
+
}
|
|
22616
|
+
const freshAccess = fresh.UIPATH_ACCESS_TOKEN;
|
|
22617
|
+
const freshExp = freshAccess ? getTokenExpiration(freshAccess) : undefined;
|
|
22618
|
+
if (freshAccess && freshExp && freshExp > expirationThreshold) {
|
|
22619
|
+
return {
|
|
22620
|
+
kind: "ok",
|
|
22621
|
+
accessToken: freshAccess,
|
|
22622
|
+
refreshToken: fresh.UIPATH_REFRESH_TOKEN ?? callerRefreshToken,
|
|
22623
|
+
expiration: freshExp,
|
|
22624
|
+
tokenRefresh: { attempted: false, success: true }
|
|
22625
|
+
};
|
|
22626
|
+
}
|
|
22627
|
+
const tokenForIdP = fresh.UIPATH_REFRESH_TOKEN ?? callerRefreshToken;
|
|
22628
|
+
let refreshedAccess;
|
|
22629
|
+
let refreshedRefresh;
|
|
22630
|
+
try {
|
|
22631
|
+
const config = await resolveConfig({ customAuthority });
|
|
22632
|
+
const refreshed = await refreshFn({
|
|
22633
|
+
refreshToken: tokenForIdP,
|
|
22634
|
+
tokenEndpoint: config.tokenEndpoint,
|
|
22635
|
+
clientId: config.clientId,
|
|
22636
|
+
expectedAuthority: customAuthority
|
|
22637
|
+
});
|
|
22638
|
+
refreshedAccess = refreshed.accessToken;
|
|
22639
|
+
refreshedRefresh = refreshed.refreshToken;
|
|
22640
|
+
} catch (error) {
|
|
22641
|
+
const isOAuthFailure = isTokenRefreshOAuthFailure(error);
|
|
22642
|
+
const hint = isOAuthFailure ? "Run 'uip login' to re-authenticate — the stored refresh token is invalid or expired." : "Token refresh failed. Check your network connection, then retry or run 'uip login' to re-authenticate.";
|
|
22643
|
+
const message = isOAuthFailure ? normalizeTokenRefreshFailure() : normalizeTokenRefreshUnavailableFailure();
|
|
22644
|
+
return {
|
|
22645
|
+
kind: "fail",
|
|
22646
|
+
status: {
|
|
22647
|
+
loginStatus: "Refresh Failed",
|
|
22648
|
+
hint,
|
|
22649
|
+
tokenRefresh: {
|
|
22650
|
+
attempted: true,
|
|
22651
|
+
success: false,
|
|
22652
|
+
errorMessage: message
|
|
22653
|
+
}
|
|
22654
|
+
}
|
|
22655
|
+
};
|
|
22656
|
+
}
|
|
22657
|
+
const refreshedExp = getTokenExpiration(refreshedAccess);
|
|
22658
|
+
if (!refreshedExp || refreshedExp <= new Date) {
|
|
22659
|
+
return {
|
|
22660
|
+
kind: "fail",
|
|
22661
|
+
status: {
|
|
22662
|
+
loginStatus: "Refresh Failed",
|
|
22663
|
+
hint: "The identity server returned an unusable token. Run 'uip login' to re-authenticate.",
|
|
22664
|
+
tokenRefresh: {
|
|
22665
|
+
attempted: true,
|
|
22666
|
+
success: false,
|
|
22667
|
+
errorMessage: "refreshed token has no valid expiration claim"
|
|
22668
|
+
}
|
|
22669
|
+
}
|
|
22670
|
+
};
|
|
22671
|
+
}
|
|
22672
|
+
try {
|
|
22673
|
+
await saveEnvFile({
|
|
22674
|
+
envPath: absolutePath,
|
|
22675
|
+
data: {
|
|
22676
|
+
UIPATH_ACCESS_TOKEN: refreshedAccess,
|
|
22677
|
+
UIPATH_REFRESH_TOKEN: refreshedRefresh
|
|
22678
|
+
},
|
|
22679
|
+
merge: true
|
|
22680
|
+
});
|
|
22681
|
+
return {
|
|
22682
|
+
kind: "ok",
|
|
22683
|
+
accessToken: refreshedAccess,
|
|
22684
|
+
refreshToken: refreshedRefresh,
|
|
22685
|
+
expiration: refreshedExp,
|
|
22686
|
+
tokenRefresh: { attempted: true, success: true }
|
|
22687
|
+
};
|
|
22688
|
+
} catch (error) {
|
|
22689
|
+
const msg = errorMessage(error);
|
|
22690
|
+
return {
|
|
22691
|
+
kind: "ok",
|
|
22692
|
+
accessToken: refreshedAccess,
|
|
22693
|
+
refreshToken: refreshedRefresh,
|
|
22694
|
+
expiration: refreshedExp,
|
|
22695
|
+
persistenceWarning: `Access token refreshed in memory but could not be written to ${absolutePath}: ${msg}. The next CLI invocation will fail until the file can be updated — run 'uip login' to re-authenticate.`,
|
|
22696
|
+
tokenRefresh: {
|
|
22697
|
+
attempted: true,
|
|
22698
|
+
success: true,
|
|
22699
|
+
errorMessage: `persistence failed: ${msg}`
|
|
22700
|
+
}
|
|
22701
|
+
};
|
|
22702
|
+
}
|
|
22703
|
+
}
|
|
22329
22704
|
var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
22330
22705
|
const {
|
|
22331
22706
|
resolveEnvFilePath = resolveEnvFilePathAsync,
|
|
@@ -22400,73 +22775,103 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
22400
22775
|
let refreshToken = credentials.UIPATH_REFRESH_TOKEN;
|
|
22401
22776
|
let expiration = getTokenExpiration(accessToken);
|
|
22402
22777
|
let persistenceWarning;
|
|
22778
|
+
let lockReleaseFailed = false;
|
|
22403
22779
|
let tokenRefresh;
|
|
22404
|
-
const
|
|
22405
|
-
|
|
22406
|
-
|
|
22407
|
-
|
|
22780
|
+
const outerThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
|
|
22781
|
+
const tryGlobalCredsHint = async () => {
|
|
22782
|
+
const fs7 = getFs();
|
|
22783
|
+
const globalPath = fs7.path.join(fs7.env.homedir(), envFilePath);
|
|
22784
|
+
if (absolutePath === globalPath)
|
|
22785
|
+
return;
|
|
22786
|
+
if (!await fs7.exists(globalPath))
|
|
22787
|
+
return;
|
|
22408
22788
|
try {
|
|
22409
|
-
const
|
|
22410
|
-
|
|
22411
|
-
|
|
22412
|
-
const
|
|
22413
|
-
|
|
22414
|
-
|
|
22415
|
-
|
|
22416
|
-
|
|
22417
|
-
|
|
22418
|
-
refreshedAccess = refreshed.accessToken;
|
|
22419
|
-
refreshedRefresh = refreshed.refreshToken;
|
|
22420
|
-
} catch (error) {
|
|
22421
|
-
const isOAuthFailure = isTokenRefreshOAuthFailure(error);
|
|
22422
|
-
const hint = isOAuthFailure ? "Run 'uip login' to re-authenticate — the stored refresh token is invalid or expired." : "Token refresh failed. Check your network connection, then retry or run 'uip login' to re-authenticate.";
|
|
22423
|
-
const errorMessage = isOAuthFailure ? normalizeTokenRefreshFailure() : normalizeTokenRefreshUnavailableFailure();
|
|
22424
|
-
return {
|
|
22425
|
-
loginStatus: "Refresh Failed",
|
|
22426
|
-
hint,
|
|
22427
|
-
tokenRefresh: {
|
|
22428
|
-
attempted: true,
|
|
22429
|
-
success: false,
|
|
22430
|
-
errorMessage
|
|
22431
|
-
}
|
|
22432
|
-
};
|
|
22789
|
+
const globalCreds = await loadEnvFile({ envPath: globalPath });
|
|
22790
|
+
if (!globalCreds.UIPATH_ACCESS_TOKEN)
|
|
22791
|
+
return;
|
|
22792
|
+
const globalExp = getTokenExpiration(globalCreds.UIPATH_ACCESS_TOKEN);
|
|
22793
|
+
if (globalExp && globalExp <= new Date)
|
|
22794
|
+
return;
|
|
22795
|
+
return `Local credentials file at ${absolutePath} has expired credentials. Valid credentials exist in ${globalPath}. Remove the local file or run 'uip login' to re-authenticate.`;
|
|
22796
|
+
} catch {
|
|
22797
|
+
return;
|
|
22433
22798
|
}
|
|
22434
|
-
|
|
22435
|
-
|
|
22799
|
+
};
|
|
22800
|
+
if (expiration && expiration <= outerThreshold && refreshToken) {
|
|
22801
|
+
let release;
|
|
22802
|
+
try {
|
|
22803
|
+
release = await getFs().acquireLock(absolutePath);
|
|
22804
|
+
} catch (error) {
|
|
22805
|
+
const msg = errorMessage(error);
|
|
22806
|
+
const globalHint = await tryGlobalCredsHint();
|
|
22807
|
+
if (globalHint) {
|
|
22808
|
+
return {
|
|
22809
|
+
loginStatus: "Expired",
|
|
22810
|
+
accessToken,
|
|
22811
|
+
refreshToken,
|
|
22812
|
+
baseUrl: credentials.UIPATH_URL,
|
|
22813
|
+
organizationName: credentials.UIPATH_ORGANIZATION_NAME,
|
|
22814
|
+
organizationId: credentials.UIPATH_ORGANIZATION_ID,
|
|
22815
|
+
tenantName: credentials.UIPATH_TENANT_NAME,
|
|
22816
|
+
tenantId: credentials.UIPATH_TENANT_ID,
|
|
22817
|
+
expiration,
|
|
22818
|
+
source: "file",
|
|
22819
|
+
hint: globalHint,
|
|
22820
|
+
tokenRefresh: {
|
|
22821
|
+
attempted: false,
|
|
22822
|
+
success: false,
|
|
22823
|
+
errorMessage: `lock acquisition failed: ${msg}`
|
|
22824
|
+
}
|
|
22825
|
+
};
|
|
22826
|
+
}
|
|
22436
22827
|
return {
|
|
22437
22828
|
loginStatus: "Refresh Failed",
|
|
22438
|
-
hint: "
|
|
22829
|
+
hint: "Could not acquire the auth-file lock — too many concurrent `uip` processes, or a permission issue on the auth directory. Retry, or run 'uip login' to re-authenticate.",
|
|
22439
22830
|
tokenRefresh: {
|
|
22440
|
-
attempted:
|
|
22831
|
+
attempted: false,
|
|
22441
22832
|
success: false,
|
|
22442
|
-
errorMessage:
|
|
22833
|
+
errorMessage: `lock acquisition failed: ${msg}`
|
|
22443
22834
|
}
|
|
22444
22835
|
};
|
|
22445
22836
|
}
|
|
22446
|
-
|
|
22447
|
-
refreshToken = refreshedRefresh;
|
|
22448
|
-
expiration = refreshedExp;
|
|
22837
|
+
let lockedFailure;
|
|
22449
22838
|
try {
|
|
22450
|
-
await
|
|
22451
|
-
|
|
22452
|
-
|
|
22453
|
-
|
|
22454
|
-
|
|
22455
|
-
|
|
22456
|
-
|
|
22839
|
+
const outcome = await runRefreshLocked({
|
|
22840
|
+
absolutePath,
|
|
22841
|
+
refreshToken,
|
|
22842
|
+
customAuthority: credentials.UIPATH_URL,
|
|
22843
|
+
ensureTokenValidityMinutes,
|
|
22844
|
+
loadEnvFile,
|
|
22845
|
+
saveEnvFile,
|
|
22846
|
+
refreshFn: refreshTokenFn,
|
|
22847
|
+
resolveConfig
|
|
22457
22848
|
});
|
|
22458
|
-
|
|
22459
|
-
|
|
22460
|
-
|
|
22461
|
-
|
|
22462
|
-
|
|
22463
|
-
|
|
22464
|
-
|
|
22465
|
-
|
|
22466
|
-
|
|
22467
|
-
|
|
22468
|
-
|
|
22469
|
-
|
|
22849
|
+
if (outcome.kind === "fail") {
|
|
22850
|
+
lockedFailure = outcome.status;
|
|
22851
|
+
} else {
|
|
22852
|
+
accessToken = outcome.accessToken;
|
|
22853
|
+
refreshToken = outcome.refreshToken;
|
|
22854
|
+
expiration = outcome.expiration;
|
|
22855
|
+
tokenRefresh = outcome.tokenRefresh;
|
|
22856
|
+
if (outcome.persistenceWarning) {
|
|
22857
|
+
persistenceWarning = outcome.persistenceWarning;
|
|
22858
|
+
}
|
|
22859
|
+
}
|
|
22860
|
+
} finally {
|
|
22861
|
+
try {
|
|
22862
|
+
await release();
|
|
22863
|
+
} catch {
|
|
22864
|
+
lockReleaseFailed = true;
|
|
22865
|
+
}
|
|
22866
|
+
}
|
|
22867
|
+
if (lockedFailure) {
|
|
22868
|
+
const globalHint = await tryGlobalCredsHint();
|
|
22869
|
+
const base = globalHint ? {
|
|
22870
|
+
...lockedFailure,
|
|
22871
|
+
loginStatus: "Expired",
|
|
22872
|
+
hint: globalHint
|
|
22873
|
+
} : lockedFailure;
|
|
22874
|
+
return lockReleaseFailed ? { ...base, lockReleaseFailed: true } : base;
|
|
22470
22875
|
}
|
|
22471
22876
|
}
|
|
22472
22877
|
const result = {
|
|
@@ -22481,23 +22886,13 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
22481
22886
|
expiration,
|
|
22482
22887
|
source: "file",
|
|
22483
22888
|
...persistenceWarning ? { hint: persistenceWarning, persistenceFailed: true } : {},
|
|
22889
|
+
...lockReleaseFailed ? { lockReleaseFailed: true } : {},
|
|
22484
22890
|
...tokenRefresh ? { tokenRefresh } : {}
|
|
22485
22891
|
};
|
|
22486
22892
|
if (result.loginStatus === "Expired") {
|
|
22487
|
-
const
|
|
22488
|
-
|
|
22489
|
-
|
|
22490
|
-
try {
|
|
22491
|
-
const globalCreds = await loadEnvFile({
|
|
22492
|
-
envPath: globalPath
|
|
22493
|
-
});
|
|
22494
|
-
if (globalCreds.UIPATH_ACCESS_TOKEN) {
|
|
22495
|
-
const globalExp = getTokenExpiration(globalCreds.UIPATH_ACCESS_TOKEN);
|
|
22496
|
-
if (!globalExp || globalExp > new Date) {
|
|
22497
|
-
result.hint = `Local credentials file at ${absolutePath} has expired credentials. Valid credentials exist in ${globalPath}. Remove the local file or run 'uip login' to re-authenticate.`;
|
|
22498
|
-
}
|
|
22499
|
-
}
|
|
22500
|
-
} catch {}
|
|
22893
|
+
const globalHint = await tryGlobalCredsHint();
|
|
22894
|
+
if (globalHint) {
|
|
22895
|
+
result.hint = globalHint;
|
|
22501
22896
|
}
|
|
22502
22897
|
}
|
|
22503
22898
|
return result;
|
|
@@ -22512,6 +22907,7 @@ var getLoginStatusAsync = async (options = {}) => {
|
|
|
22512
22907
|
};
|
|
22513
22908
|
init_src();
|
|
22514
22909
|
init_src();
|
|
22910
|
+
init_server();
|
|
22515
22911
|
async function resolveConfig(options) {
|
|
22516
22912
|
const status = await getLoginStatusAsync();
|
|
22517
22913
|
if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken) {
|
|
@@ -22529,10 +22925,10 @@ async function resolveConfig(options) {
|
|
|
22529
22925
|
return {
|
|
22530
22926
|
config: new Configuration({
|
|
22531
22927
|
basePath,
|
|
22532
|
-
headers: {
|
|
22928
|
+
headers: addSdkUserAgentHeader({
|
|
22533
22929
|
Authorization: `Bearer ${bearerToken}`,
|
|
22534
22930
|
"x-uipath-source": "UiPath.CLI"
|
|
22535
|
-
}
|
|
22931
|
+
}, SDK_USER_AGENT)
|
|
22536
22932
|
}),
|
|
22537
22933
|
organizationId: status.organizationId,
|
|
22538
22934
|
tenantName: tenant
|
|
@@ -22548,6 +22944,7 @@ async function createApiClient(ApiClass, options) {
|
|
|
22548
22944
|
}
|
|
22549
22945
|
|
|
22550
22946
|
// ../../filesystem/src/node.ts
|
|
22947
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
22551
22948
|
import { existsSync as existsSync2 } from "node:fs";
|
|
22552
22949
|
import * as fs13 from "node:fs/promises";
|
|
22553
22950
|
import * as os5 from "node:os";
|
|
@@ -23164,6 +23561,13 @@ defineLazyProperty2(apps2, "safari", () => detectPlatformBinary2({
|
|
|
23164
23561
|
var open_default2 = open2;
|
|
23165
23562
|
|
|
23166
23563
|
// ../../filesystem/src/node.ts
|
|
23564
|
+
var LOCK_HEARTBEAT_MS2 = 5000;
|
|
23565
|
+
var LOCK_STALE_MS2 = 15000;
|
|
23566
|
+
var LOCK_MAX_WAIT_MS2 = 20000;
|
|
23567
|
+
var LOCK_MAX_HOLD_MS2 = 60000;
|
|
23568
|
+
var LOCK_RETRY_MIN_MS2 = 100;
|
|
23569
|
+
var LOCK_RETRY_JITTER_MS2 = 200;
|
|
23570
|
+
|
|
23167
23571
|
class NodeFileSystem2 {
|
|
23168
23572
|
path = {
|
|
23169
23573
|
join: path5.join,
|
|
@@ -23240,6 +23644,90 @@ class NodeFileSystem2 {
|
|
|
23240
23644
|
async mkdir(dirPath) {
|
|
23241
23645
|
await fs13.mkdir(dirPath, { recursive: true });
|
|
23242
23646
|
}
|
|
23647
|
+
async acquireLock(lockPath) {
|
|
23648
|
+
const canonicalPath = await this.canonicalizeLockTarget(lockPath);
|
|
23649
|
+
const lockFile = `${canonicalPath}.lock`;
|
|
23650
|
+
const ownerId = randomUUID2();
|
|
23651
|
+
const start = Date.now();
|
|
23652
|
+
while (true) {
|
|
23653
|
+
try {
|
|
23654
|
+
await fs13.writeFile(lockFile, ownerId, { flag: "wx" });
|
|
23655
|
+
return this.createLockRelease(lockFile, ownerId);
|
|
23656
|
+
} catch (error) {
|
|
23657
|
+
if (!this.hasErrnoCode(error, "EEXIST")) {
|
|
23658
|
+
throw error;
|
|
23659
|
+
}
|
|
23660
|
+
const stats = await fs13.stat(lockFile).catch(() => null);
|
|
23661
|
+
if (stats && Date.now() - stats.mtimeMs > LOCK_STALE_MS2) {
|
|
23662
|
+
const reclaimed = await fs13.rm(lockFile, { force: true }).then(() => true).catch(() => false);
|
|
23663
|
+
if (reclaimed)
|
|
23664
|
+
continue;
|
|
23665
|
+
}
|
|
23666
|
+
if (Date.now() - start > LOCK_MAX_WAIT_MS2) {
|
|
23667
|
+
throw new Error(`ELOCKED: timed out waiting for lock on ${canonicalPath}`);
|
|
23668
|
+
}
|
|
23669
|
+
await new Promise((resolve3) => setTimeout(resolve3, LOCK_RETRY_MIN_MS2 + Math.random() * LOCK_RETRY_JITTER_MS2));
|
|
23670
|
+
}
|
|
23671
|
+
}
|
|
23672
|
+
}
|
|
23673
|
+
async canonicalizeLockTarget(lockPath) {
|
|
23674
|
+
const absolute = path5.resolve(lockPath);
|
|
23675
|
+
const fullReal = await fs13.realpath(absolute).catch(() => null);
|
|
23676
|
+
if (fullReal)
|
|
23677
|
+
return fullReal;
|
|
23678
|
+
const parent = path5.dirname(absolute);
|
|
23679
|
+
const base = path5.basename(absolute);
|
|
23680
|
+
const canonicalParent = await fs13.realpath(parent).catch(() => parent);
|
|
23681
|
+
return path5.join(canonicalParent, base);
|
|
23682
|
+
}
|
|
23683
|
+
createLockRelease(lockFile, ownerId) {
|
|
23684
|
+
const heartbeatStart = Date.now();
|
|
23685
|
+
let heartbeatTimer;
|
|
23686
|
+
let stopped = false;
|
|
23687
|
+
const stopHeartbeat = () => {
|
|
23688
|
+
stopped = true;
|
|
23689
|
+
if (heartbeatTimer)
|
|
23690
|
+
clearTimeout(heartbeatTimer);
|
|
23691
|
+
};
|
|
23692
|
+
const scheduleNextHeartbeat = () => {
|
|
23693
|
+
if (stopped)
|
|
23694
|
+
return;
|
|
23695
|
+
if (Date.now() - heartbeatStart >= LOCK_MAX_HOLD_MS2) {
|
|
23696
|
+
stopped = true;
|
|
23697
|
+
return;
|
|
23698
|
+
}
|
|
23699
|
+
heartbeatTimer = setTimeout(() => {
|
|
23700
|
+
runHeartbeat();
|
|
23701
|
+
}, LOCK_HEARTBEAT_MS2);
|
|
23702
|
+
heartbeatTimer.unref?.();
|
|
23703
|
+
};
|
|
23704
|
+
const runHeartbeat = async () => {
|
|
23705
|
+
if (stopped)
|
|
23706
|
+
return;
|
|
23707
|
+
const current = await fs13.readFile(lockFile, "utf-8").catch(() => null);
|
|
23708
|
+
if (stopped)
|
|
23709
|
+
return;
|
|
23710
|
+
if (current !== ownerId) {
|
|
23711
|
+
stopped = true;
|
|
23712
|
+
return;
|
|
23713
|
+
}
|
|
23714
|
+
const now = Date.now() / 1000;
|
|
23715
|
+
await fs13.utimes(lockFile, now, now).catch(() => {});
|
|
23716
|
+
scheduleNextHeartbeat();
|
|
23717
|
+
};
|
|
23718
|
+
scheduleNextHeartbeat();
|
|
23719
|
+
let released = false;
|
|
23720
|
+
return async () => {
|
|
23721
|
+
if (released)
|
|
23722
|
+
return;
|
|
23723
|
+
released = true;
|
|
23724
|
+
stopHeartbeat();
|
|
23725
|
+
const current = await fs13.readFile(lockFile, "utf-8").catch(() => null);
|
|
23726
|
+
if (current === ownerId) {
|
|
23727
|
+
await fs13.rm(lockFile, { force: true });
|
|
23728
|
+
}
|
|
23729
|
+
};
|
|
23730
|
+
}
|
|
23243
23731
|
async rm(filePath) {
|
|
23244
23732
|
await fs13.rm(filePath, { recursive: true, force: true });
|
|
23245
23733
|
}
|
|
@@ -23285,7 +23773,10 @@ class NodeFileSystem2 {
|
|
|
23285
23773
|
}
|
|
23286
23774
|
}
|
|
23287
23775
|
isEnoent(error) {
|
|
23288
|
-
return
|
|
23776
|
+
return this.hasErrnoCode(error, "ENOENT");
|
|
23777
|
+
}
|
|
23778
|
+
hasErrnoCode(error, code) {
|
|
23779
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === code;
|
|
23289
23780
|
}
|
|
23290
23781
|
}
|
|
23291
23782
|
|
|
@@ -23427,10 +23918,15 @@ async function extractErrorDetails(error, options) {
|
|
|
23427
23918
|
}
|
|
23428
23919
|
if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
|
|
23429
23920
|
context.errorCode = parsedBody.errorCode;
|
|
23921
|
+
} else if (parsedBody?.code && typeof parsedBody.code === "string") {
|
|
23922
|
+
context.errorCode = parsedBody.code;
|
|
23430
23923
|
}
|
|
23431
23924
|
if (parsedBody?.requestId && typeof parsedBody.requestId === "string") {
|
|
23432
23925
|
context.requestId = parsedBody.requestId;
|
|
23433
23926
|
}
|
|
23927
|
+
if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
|
|
23928
|
+
context.traceId = parsedBody.traceId;
|
|
23929
|
+
}
|
|
23434
23930
|
if (status === 429) {
|
|
23435
23931
|
const resp = response;
|
|
23436
23932
|
const headersObj = resp?.headers;
|
|
@@ -23450,7 +23946,35 @@ async function extractErrorDetails(error, options) {
|
|
|
23450
23946
|
}
|
|
23451
23947
|
}
|
|
23452
23948
|
const hasContext = Object.keys(context).length > 0;
|
|
23453
|
-
|
|
23949
|
+
let parsedErrors;
|
|
23950
|
+
if (parsedBody?.errors && typeof parsedBody.errors === "object") {
|
|
23951
|
+
const errors = {};
|
|
23952
|
+
for (const [field, raw] of Object.entries(parsedBody.errors)) {
|
|
23953
|
+
if (Array.isArray(raw)) {
|
|
23954
|
+
const messages = raw.map((entry) => {
|
|
23955
|
+
if (typeof entry === "string")
|
|
23956
|
+
return entry;
|
|
23957
|
+
if (entry && typeof entry === "object" && typeof entry.message === "string") {
|
|
23958
|
+
return entry.message;
|
|
23959
|
+
}
|
|
23960
|
+
return String(entry);
|
|
23961
|
+
}).filter(Boolean);
|
|
23962
|
+
if (messages.length > 0)
|
|
23963
|
+
errors[field] = messages;
|
|
23964
|
+
} else if (typeof raw === "string") {
|
|
23965
|
+
errors[field] = [raw];
|
|
23966
|
+
}
|
|
23967
|
+
}
|
|
23968
|
+
if (Object.keys(errors).length > 0)
|
|
23969
|
+
parsedErrors = errors;
|
|
23970
|
+
}
|
|
23971
|
+
return {
|
|
23972
|
+
result,
|
|
23973
|
+
message,
|
|
23974
|
+
details,
|
|
23975
|
+
...hasContext ? { context } : {},
|
|
23976
|
+
...parsedErrors ? { parsedErrors } : {}
|
|
23977
|
+
};
|
|
23454
23978
|
}
|
|
23455
23979
|
// ../../common/src/command-examples.ts
|
|
23456
23980
|
var examplesByCommand = new WeakMap;
|
|
@@ -23459,30 +23983,30 @@ Command.prototype.examples = function(examples) {
|
|
|
23459
23983
|
return this;
|
|
23460
23984
|
};
|
|
23461
23985
|
// ../../common/src/singleton.ts
|
|
23462
|
-
var
|
|
23463
|
-
var
|
|
23464
|
-
function
|
|
23986
|
+
var PREFIX2 = "@uipath/common/";
|
|
23987
|
+
var _g2 = globalThis;
|
|
23988
|
+
function singleton2(ctorOrName) {
|
|
23465
23989
|
const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
|
|
23466
|
-
const key = Symbol.for(
|
|
23990
|
+
const key = Symbol.for(PREFIX2 + name);
|
|
23467
23991
|
return {
|
|
23468
23992
|
get(fallback) {
|
|
23469
|
-
return
|
|
23993
|
+
return _g2[key] ?? fallback;
|
|
23470
23994
|
},
|
|
23471
23995
|
set(value) {
|
|
23472
|
-
|
|
23996
|
+
_g2[key] = value;
|
|
23473
23997
|
},
|
|
23474
23998
|
clear() {
|
|
23475
|
-
delete
|
|
23999
|
+
delete _g2[key];
|
|
23476
24000
|
},
|
|
23477
24001
|
getOrInit(factory, guard) {
|
|
23478
|
-
const existing =
|
|
24002
|
+
const existing = _g2[key];
|
|
23479
24003
|
if (existing != null && typeof existing === "object") {
|
|
23480
24004
|
if (!guard || guard(existing)) {
|
|
23481
24005
|
return existing;
|
|
23482
24006
|
}
|
|
23483
24007
|
}
|
|
23484
24008
|
const instance = factory();
|
|
23485
|
-
|
|
24009
|
+
_g2[key] = instance;
|
|
23486
24010
|
return instance;
|
|
23487
24011
|
}
|
|
23488
24012
|
};
|
|
@@ -23501,8 +24025,8 @@ function createStorage() {
|
|
|
23501
24025
|
}
|
|
23502
24026
|
return new mod.AsyncLocalStorage;
|
|
23503
24027
|
}
|
|
23504
|
-
var storageSingleton =
|
|
23505
|
-
var sinkSlot =
|
|
24028
|
+
var storageSingleton = singleton2("OutputStorage");
|
|
24029
|
+
var sinkSlot = singleton2("OutputSink");
|
|
23506
24030
|
var outputStorage = storageSingleton.getOrInit(createStorage, (v) => ("getStore" in v));
|
|
23507
24031
|
var CONSOLE_FALLBACK = {
|
|
23508
24032
|
writeOut: (str) => process.stdout.write(str),
|
|
@@ -23520,8 +24044,8 @@ function getOutputSink() {
|
|
|
23520
24044
|
// ../../common/src/completer.ts
|
|
23521
24045
|
var COMPLETER_SYMBOL = Symbol.for("@uipath/common/completer");
|
|
23522
24046
|
// ../../common/src/console-guard.ts
|
|
23523
|
-
var guardInstalledSlot =
|
|
23524
|
-
var savedOriginalsSlot =
|
|
24047
|
+
var guardInstalledSlot = singleton2("ConsoleGuardInstalled");
|
|
24048
|
+
var savedOriginalsSlot = singleton2("ConsoleGuardOriginals");
|
|
23525
24049
|
// ../../common/src/constants.ts
|
|
23526
24050
|
var DEFAULT_AUTH_TIMEOUT_MS2 = 5 * 60 * 1000;
|
|
23527
24051
|
// ../../common/src/error-instructions.ts
|
|
@@ -28175,7 +28699,7 @@ var safeLoadAll = renamed("safeLoadAll", "loadAll");
|
|
|
28175
28699
|
var safeDump = renamed("safeDump", "dump");
|
|
28176
28700
|
|
|
28177
28701
|
// ../../common/src/logger.ts
|
|
28178
|
-
var logFilePathSlot =
|
|
28702
|
+
var logFilePathSlot = singleton2("logFilePath");
|
|
28179
28703
|
function setGlobalLogFilePath(path4) {
|
|
28180
28704
|
logFilePathSlot.set(path4);
|
|
28181
28705
|
}
|
|
@@ -28359,16 +28883,16 @@ class SimpleLogger {
|
|
|
28359
28883
|
}
|
|
28360
28884
|
};
|
|
28361
28885
|
}
|
|
28362
|
-
var loggerSingleton =
|
|
28886
|
+
var loggerSingleton = singleton2(SimpleLogger);
|
|
28363
28887
|
var logger = SimpleLogger.getInstance();
|
|
28364
28888
|
function getLogFilePath() {
|
|
28365
28889
|
return logger.getLogFilePath();
|
|
28366
28890
|
}
|
|
28367
28891
|
|
|
28368
28892
|
// ../../common/src/output-format-context.ts
|
|
28369
|
-
var formatSlot =
|
|
28370
|
-
var formatExplicitSlot =
|
|
28371
|
-
var filterSlot =
|
|
28893
|
+
var formatSlot = singleton2("OutputFormat");
|
|
28894
|
+
var formatExplicitSlot = singleton2("OutputFormatExplicit");
|
|
28895
|
+
var filterSlot = singleton2("OutputFilter");
|
|
28372
28896
|
function getOutputFormat() {
|
|
28373
28897
|
return formatSlot.get("json");
|
|
28374
28898
|
}
|
|
@@ -28546,11 +29070,11 @@ class TelemetryService {
|
|
|
28546
29070
|
}
|
|
28547
29071
|
}
|
|
28548
29072
|
// ../../common/src/telemetry/node-appinsights-telemetry-provider.ts
|
|
28549
|
-
var telemetryPropsSlot =
|
|
28550
|
-
var providerSlot =
|
|
29073
|
+
var telemetryPropsSlot = singleton2("TelemetryDefaultProps");
|
|
29074
|
+
var providerSlot = singleton2("TelemetryProvider");
|
|
28551
29075
|
|
|
28552
29076
|
// ../../common/src/telemetry/telemetry-init.ts
|
|
28553
|
-
var telemetryInstanceSlot =
|
|
29077
|
+
var telemetryInstanceSlot = singleton2("TelemetryService");
|
|
28554
29078
|
var DEFAULT_AI_CONNECTION_STRING = atob("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj");
|
|
28555
29079
|
function getGlobalTelemetryInstance() {
|
|
28556
29080
|
const existing = telemetryInstanceSlot.get();
|
|
@@ -28619,6 +29143,60 @@ function escapeNonAscii(jsonText) {
|
|
|
28619
29143
|
function needsAsciiSafeJson(sink) {
|
|
28620
29144
|
return process.platform === "win32" && !sink.capabilities.isInteractive;
|
|
28621
29145
|
}
|
|
29146
|
+
function isPlainRecord(value) {
|
|
29147
|
+
if (value === null || typeof value !== "object")
|
|
29148
|
+
return false;
|
|
29149
|
+
const prototype = Object.getPrototypeOf(value);
|
|
29150
|
+
return prototype === Object.prototype || prototype === null;
|
|
29151
|
+
}
|
|
29152
|
+
function toLowerCamelCaseKey(key) {
|
|
29153
|
+
if (!key)
|
|
29154
|
+
return key;
|
|
29155
|
+
if (/[_\-\s]/.test(key)) {
|
|
29156
|
+
const [firstPart, ...restParts] = key.split(/[_\-\s]+/).filter(Boolean);
|
|
29157
|
+
if (!firstPart)
|
|
29158
|
+
return key;
|
|
29159
|
+
return [
|
|
29160
|
+
toLowerCamelCaseSimpleKey(firstPart),
|
|
29161
|
+
...restParts.map((part) => {
|
|
29162
|
+
const normalized = toLowerCamelCaseSimpleKey(part);
|
|
29163
|
+
return normalized.charAt(0).toUpperCase() + normalized.slice(1);
|
|
29164
|
+
})
|
|
29165
|
+
].join("");
|
|
29166
|
+
}
|
|
29167
|
+
return toLowerCamelCaseSimpleKey(key);
|
|
29168
|
+
}
|
|
29169
|
+
function toLowerCamelCaseSimpleKey(key) {
|
|
29170
|
+
if (/^[A-Z0-9]+$/.test(key))
|
|
29171
|
+
return key.toLowerCase();
|
|
29172
|
+
return key.replace(/^[A-Z]+(?=[A-Z][a-z]|\d|$)|^[A-Z]/, (match) => match.toLowerCase());
|
|
29173
|
+
}
|
|
29174
|
+
function toPascalCaseKey(key) {
|
|
29175
|
+
const lowerCamelKey = toLowerCamelCaseKey(key);
|
|
29176
|
+
return lowerCamelKey ? lowerCamelKey.charAt(0).toUpperCase() + lowerCamelKey.slice(1) : lowerCamelKey;
|
|
29177
|
+
}
|
|
29178
|
+
function toPascalCaseData(value) {
|
|
29179
|
+
if (Array.isArray(value))
|
|
29180
|
+
return value.map(toPascalCaseData);
|
|
29181
|
+
if (!isPlainRecord(value))
|
|
29182
|
+
return value;
|
|
29183
|
+
const result = {};
|
|
29184
|
+
for (const [key, nestedValue] of Object.entries(value)) {
|
|
29185
|
+
result[toPascalCaseKey(key)] = toPascalCaseData(nestedValue);
|
|
29186
|
+
}
|
|
29187
|
+
return result;
|
|
29188
|
+
}
|
|
29189
|
+
function normalizeDataKeys(data) {
|
|
29190
|
+
return toPascalCaseData(data);
|
|
29191
|
+
}
|
|
29192
|
+
function normalizeOutputKeys(data) {
|
|
29193
|
+
const result = {};
|
|
29194
|
+
for (const [key, value] of Object.entries(data)) {
|
|
29195
|
+
const pascalKey = toPascalCaseKey(key);
|
|
29196
|
+
result[pascalKey] = pascalKey === "Data" ? value : toPascalCaseData(value);
|
|
29197
|
+
}
|
|
29198
|
+
return result;
|
|
29199
|
+
}
|
|
28622
29200
|
function printOutput(data, format = "json", logFn, asciiSafe = false) {
|
|
28623
29201
|
if (!data) {
|
|
28624
29202
|
logFn("Empty response object. No data to display.");
|
|
@@ -28681,7 +29259,7 @@ function wrapText(text, width) {
|
|
|
28681
29259
|
function printTable(data, logFn, externalLogValue) {
|
|
28682
29260
|
if (data.length === 0)
|
|
28683
29261
|
return;
|
|
28684
|
-
const keys = Object.keys(data[0]).filter((key) =>
|
|
29262
|
+
const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
|
|
28685
29263
|
const maxWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
|
|
28686
29264
|
const header = keys.map((key, i2) => key.padEnd(maxWidths[i2])).join(" | ");
|
|
28687
29265
|
logFn(header);
|
|
@@ -28696,7 +29274,7 @@ function printTable(data, logFn, externalLogValue) {
|
|
|
28696
29274
|
}
|
|
28697
29275
|
}
|
|
28698
29276
|
function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
28699
|
-
const keys = Object.keys(data).filter((key) =>
|
|
29277
|
+
const keys = Object.keys(data).filter((key) => !["code", "log"].includes(key.toLowerCase()));
|
|
28700
29278
|
if (keys.length === 0)
|
|
28701
29279
|
return;
|
|
28702
29280
|
const maxKeyWidth = Math.max(...keys.map((key) => key.length));
|
|
@@ -28712,7 +29290,7 @@ function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
|
28712
29290
|
function printResizableTable(data, logFn = console.log, externalLogValue) {
|
|
28713
29291
|
if (data.length === 0)
|
|
28714
29292
|
return;
|
|
28715
|
-
const keys = Object.keys(data[0]).filter((key) =>
|
|
29293
|
+
const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
|
|
28716
29294
|
if (keys.length === 0)
|
|
28717
29295
|
return;
|
|
28718
29296
|
if (!process.stdout.isTTY) {
|
|
@@ -28788,8 +29366,26 @@ function printResizableTable(data, logFn = console.log, externalLogValue) {
|
|
|
28788
29366
|
function toYaml(data) {
|
|
28789
29367
|
return dump(data);
|
|
28790
29368
|
}
|
|
29369
|
+
class FilterEvaluationError extends Error {
|
|
29370
|
+
__brand = "FilterEvaluationError";
|
|
29371
|
+
filter;
|
|
29372
|
+
instructions;
|
|
29373
|
+
result = RESULTS.ValidationError;
|
|
29374
|
+
constructor(filter, cause) {
|
|
29375
|
+
const underlying = cause instanceof Error ? cause.message : String(cause);
|
|
29376
|
+
super(`Filter '${filter}' failed to evaluate: ${underlying}`);
|
|
29377
|
+
this.name = "FilterEvaluationError";
|
|
29378
|
+
this.filter = filter;
|
|
29379
|
+
this.instructions = `The --output-filter expression '${filter}' failed at evaluation time. ` + "Note that --output-filter operates on the 'Data' field of the envelope, not the full object. " + "For example, on a list result use 'length(@)' instead of 'Data | length(@)'.";
|
|
29380
|
+
}
|
|
29381
|
+
}
|
|
28791
29382
|
function applyFilter(data, filter) {
|
|
28792
|
-
|
|
29383
|
+
let result;
|
|
29384
|
+
try {
|
|
29385
|
+
result = search(data, filter);
|
|
29386
|
+
} catch (err) {
|
|
29387
|
+
throw new FilterEvaluationError(filter, err);
|
|
29388
|
+
}
|
|
28793
29389
|
if (result == null)
|
|
28794
29390
|
return [];
|
|
28795
29391
|
if (Array.isArray(result)) {
|
|
@@ -28806,13 +29402,18 @@ function applyFilter(data, filter) {
|
|
|
28806
29402
|
}
|
|
28807
29403
|
var OutputFormatter;
|
|
28808
29404
|
((OutputFormatter) => {
|
|
28809
|
-
function success(data) {
|
|
29405
|
+
function success(data, options) {
|
|
28810
29406
|
data.Log ??= getLogFilePath() || undefined;
|
|
29407
|
+
const normalize = !options?.preserveDataKeys;
|
|
29408
|
+
if (normalize) {
|
|
29409
|
+
data.Data = normalizeDataKeys(data.Data);
|
|
29410
|
+
}
|
|
28811
29411
|
const filter = getOutputFilter();
|
|
28812
29412
|
if (filter) {
|
|
28813
|
-
|
|
29413
|
+
const filtered = applyFilter(data.Data, filter);
|
|
29414
|
+
data.Data = normalize ? normalizeDataKeys(filtered) : filtered;
|
|
28814
29415
|
}
|
|
28815
|
-
logOutput(data, getOutputFormat());
|
|
29416
|
+
logOutput(normalizeOutputKeys(data), getOutputFormat());
|
|
28816
29417
|
}
|
|
28817
29418
|
OutputFormatter.success = success;
|
|
28818
29419
|
function error(data) {
|
|
@@ -28822,7 +29423,7 @@ var OutputFormatter;
|
|
|
28822
29423
|
result: data.Result,
|
|
28823
29424
|
message: data.Message
|
|
28824
29425
|
});
|
|
28825
|
-
logOutput(data, getOutputFormat());
|
|
29426
|
+
logOutput(normalizeOutputKeys(data), getOutputFormat());
|
|
28826
29427
|
}
|
|
28827
29428
|
OutputFormatter.error = error;
|
|
28828
29429
|
function emitList(code, items, opts) {
|
|
@@ -28843,13 +29444,14 @@ var OutputFormatter;
|
|
|
28843
29444
|
function log(data) {
|
|
28844
29445
|
const format = getOutputFormat();
|
|
28845
29446
|
const sink = getOutputSink();
|
|
29447
|
+
const normalized = toPascalCaseData(data);
|
|
28846
29448
|
if (format === "json") {
|
|
28847
|
-
const json2 = JSON.stringify(
|
|
29449
|
+
const json2 = JSON.stringify(normalized);
|
|
28848
29450
|
const safe = needsAsciiSafeJson(sink) ? escapeNonAscii(json2) : json2;
|
|
28849
29451
|
sink.writeErr(`${safe}
|
|
28850
29452
|
`);
|
|
28851
29453
|
} else {
|
|
28852
|
-
for (const [key, value] of Object.entries(
|
|
29454
|
+
for (const [key, value] of Object.entries(normalized)) {
|
|
28853
29455
|
sink.writeErr(`${key}: ${value}
|
|
28854
29456
|
`);
|
|
28855
29457
|
}
|
|
@@ -28858,12 +29460,16 @@ var OutputFormatter;
|
|
|
28858
29460
|
OutputFormatter.log = log;
|
|
28859
29461
|
function formatToString(data) {
|
|
28860
29462
|
const filter = getOutputFilter();
|
|
28861
|
-
if (
|
|
28862
|
-
data.Data =
|
|
29463
|
+
if ("Data" in data && data.Data != null) {
|
|
29464
|
+
data.Data = normalizeDataKeys(data.Data);
|
|
29465
|
+
if (filter) {
|
|
29466
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter));
|
|
29467
|
+
}
|
|
28863
29468
|
}
|
|
29469
|
+
const output = normalizeOutputKeys(data);
|
|
28864
29470
|
const lines = [];
|
|
28865
29471
|
const sink = getOutputSink();
|
|
28866
|
-
printOutput(
|
|
29472
|
+
printOutput(output, getOutputFormat(), (msg) => {
|
|
28867
29473
|
lines.push(msg);
|
|
28868
29474
|
}, needsAsciiSafeJson(sink));
|
|
28869
29475
|
return lines.join(`
|
|
@@ -30274,6 +30880,22 @@ JSONPath.prototype.safeVm = {
|
|
|
30274
30880
|
Script: SafeScript
|
|
30275
30881
|
};
|
|
30276
30882
|
JSONPath.prototype.vm = vm;
|
|
30883
|
+
// ../../common/src/polling/types.ts
|
|
30884
|
+
var PollOutcome = {
|
|
30885
|
+
Completed: "completed",
|
|
30886
|
+
Timeout: "timeout",
|
|
30887
|
+
Interrupted: "interrupted",
|
|
30888
|
+
Aborted: "aborted",
|
|
30889
|
+
Failed: "failed"
|
|
30890
|
+
};
|
|
30891
|
+
|
|
30892
|
+
// ../../common/src/polling/poll-failure-mapping.ts
|
|
30893
|
+
var REASON_BY_OUTCOME = {
|
|
30894
|
+
[PollOutcome.Timeout]: "poll_timeout",
|
|
30895
|
+
[PollOutcome.Failed]: "poll_failed",
|
|
30896
|
+
[PollOutcome.Interrupted]: "poll_failed",
|
|
30897
|
+
[PollOutcome.Aborted]: "poll_aborted"
|
|
30898
|
+
};
|
|
30277
30899
|
// ../../common/src/polling/terminal-statuses.ts
|
|
30278
30900
|
var TERMINAL_STATUSES = new Set([
|
|
30279
30901
|
"completed",
|
|
@@ -30301,8 +30923,10 @@ var ScreenLogger;
|
|
|
30301
30923
|
}
|
|
30302
30924
|
ScreenLogger.progress = progress;
|
|
30303
30925
|
})(ScreenLogger ||= {});
|
|
30926
|
+
// ../../common/src/sdk-user-agent.ts
|
|
30927
|
+
var sdkUserAgentHostToken2 = singleton2("SdkUserAgentHostToken");
|
|
30304
30928
|
// ../../common/src/tool-provider.ts
|
|
30305
|
-
var factorySlot =
|
|
30929
|
+
var factorySlot = singleton2("PackagerFactoryProvider");
|
|
30306
30930
|
// ../../common/src/telemetry/pii-redactor.ts
|
|
30307
30931
|
var REDACTED = "[REDACTED]";
|
|
30308
30932
|
var MAX_VALUE_LENGTH = 200;
|
|
@@ -30428,7 +31052,7 @@ function redactProperties(properties) {
|
|
|
30428
31052
|
}
|
|
30429
31053
|
|
|
30430
31054
|
// ../../common/src/trackedAction.ts
|
|
30431
|
-
var pollSignalSlot =
|
|
31055
|
+
var pollSignalSlot = singleton2("PollSignal");
|
|
30432
31056
|
var processContext = {
|
|
30433
31057
|
exit: (code) => {
|
|
30434
31058
|
process.exitCode = code;
|
|
@@ -30479,17 +31103,21 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
30479
31103
|
const telemetryName = deriveCommandPath(command);
|
|
30480
31104
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
30481
31105
|
const startTime = performance.now();
|
|
30482
|
-
let
|
|
31106
|
+
let errorMessage2;
|
|
30483
31107
|
const [error] = await catchError2(fn(...args));
|
|
30484
31108
|
if (error) {
|
|
30485
|
-
|
|
30486
|
-
logger.
|
|
31109
|
+
errorMessage2 = error instanceof Error ? error.message : String(error);
|
|
31110
|
+
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage2}`);
|
|
31111
|
+
const typed = error;
|
|
31112
|
+
const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
|
|
31113
|
+
const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
|
|
31114
|
+
const finalResult = customResult ?? RESULTS.Failure;
|
|
30487
31115
|
OutputFormatter.error({
|
|
30488
|
-
Result:
|
|
30489
|
-
Message:
|
|
30490
|
-
Instructions: "An unexpected error occurred. Run with --log-level debug for details."
|
|
31116
|
+
Result: finalResult,
|
|
31117
|
+
Message: errorMessage2,
|
|
31118
|
+
Instructions: customInstructions ?? "An unexpected error occurred. Run with --log-level debug for details."
|
|
30491
31119
|
});
|
|
30492
|
-
context.exit(
|
|
31120
|
+
context.exit(EXIT_CODES[finalResult]);
|
|
30493
31121
|
}
|
|
30494
31122
|
const durationMs = performance.now() - startTime;
|
|
30495
31123
|
const success = !error && (process.exitCode === undefined || process.exitCode === 0);
|
|
@@ -30498,7 +31126,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
30498
31126
|
...props,
|
|
30499
31127
|
duration: String(durationMs),
|
|
30500
31128
|
success: String(success),
|
|
30501
|
-
...
|
|
31129
|
+
...errorMessage2 ? { errorMessage: errorMessage2 } : {}
|
|
30502
31130
|
}));
|
|
30503
31131
|
});
|
|
30504
31132
|
};
|
|
@@ -30519,14 +31147,14 @@ async function reportError(error, loginInstructions) {
|
|
|
30519
31147
|
|
|
30520
31148
|
// src/helpers/validators.ts
|
|
30521
31149
|
var IPV4_OCTET = /^(25[0-5]|2[0-4]\d|[01]?\d?\d)$/;
|
|
30522
|
-
function
|
|
31150
|
+
function errorMessage2(err) {
|
|
30523
31151
|
return err instanceof Error ? err.message : String(err);
|
|
30524
31152
|
}
|
|
30525
31153
|
function asInvalidArgument(fn) {
|
|
30526
31154
|
try {
|
|
30527
31155
|
return fn();
|
|
30528
31156
|
} catch (err) {
|
|
30529
|
-
throw new InvalidArgumentError(
|
|
31157
|
+
throw new InvalidArgumentError(errorMessage2(err));
|
|
30530
31158
|
}
|
|
30531
31159
|
}
|
|
30532
31160
|
function assertIpv4(value, label) {
|
|
@@ -31200,7 +31828,7 @@ function appendTrustedCert(value, previous) {
|
|
|
31200
31828
|
try {
|
|
31201
31829
|
return [...previous, assertTrustedCertSpec(value)];
|
|
31202
31830
|
} catch (err) {
|
|
31203
|
-
throw new InvalidArgumentError(
|
|
31831
|
+
throw new InvalidArgumentError(errorMessage2(err));
|
|
31204
31832
|
}
|
|
31205
31833
|
}
|
|
31206
31834
|
var LOGIN_INSTRUCTIONS2 = "Ensure you are logged in with 'uip login' and that your account has org-admin access to the Hypervisor service. Pass --tenant <name> to target a tenant other than your login context.";
|