@uipath/platform-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/tool.js +632 -126
- package/package.json +22 -32
package/dist/tool.js
CHANGED
|
@@ -706,6 +706,7 @@ var init_open = __esm(() => {
|
|
|
706
706
|
});
|
|
707
707
|
|
|
708
708
|
// ../filesystem/src/node.ts
|
|
709
|
+
import { randomUUID } from "node:crypto";
|
|
709
710
|
import { existsSync } from "node:fs";
|
|
710
711
|
import * as fs6 from "node:fs/promises";
|
|
711
712
|
import * as os2 from "node:os";
|
|
@@ -787,6 +788,90 @@ class NodeFileSystem {
|
|
|
787
788
|
async mkdir(dirPath) {
|
|
788
789
|
await fs6.mkdir(dirPath, { recursive: true });
|
|
789
790
|
}
|
|
791
|
+
async acquireLock(lockPath) {
|
|
792
|
+
const canonicalPath = await this.canonicalizeLockTarget(lockPath);
|
|
793
|
+
const lockFile = `${canonicalPath}.lock`;
|
|
794
|
+
const ownerId = randomUUID();
|
|
795
|
+
const start = Date.now();
|
|
796
|
+
while (true) {
|
|
797
|
+
try {
|
|
798
|
+
await fs6.writeFile(lockFile, ownerId, { flag: "wx" });
|
|
799
|
+
return this.createLockRelease(lockFile, ownerId);
|
|
800
|
+
} catch (error) {
|
|
801
|
+
if (!this.hasErrnoCode(error, "EEXIST")) {
|
|
802
|
+
throw error;
|
|
803
|
+
}
|
|
804
|
+
const stats = await fs6.stat(lockFile).catch(() => null);
|
|
805
|
+
if (stats && Date.now() - stats.mtimeMs > LOCK_STALE_MS) {
|
|
806
|
+
const reclaimed = await fs6.rm(lockFile, { force: true }).then(() => true).catch(() => false);
|
|
807
|
+
if (reclaimed)
|
|
808
|
+
continue;
|
|
809
|
+
}
|
|
810
|
+
if (Date.now() - start > LOCK_MAX_WAIT_MS) {
|
|
811
|
+
throw new Error(`ELOCKED: timed out waiting for lock on ${canonicalPath}`);
|
|
812
|
+
}
|
|
813
|
+
await new Promise((resolve2) => setTimeout(resolve2, LOCK_RETRY_MIN_MS + Math.random() * LOCK_RETRY_JITTER_MS));
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
async canonicalizeLockTarget(lockPath) {
|
|
818
|
+
const absolute = path2.resolve(lockPath);
|
|
819
|
+
const fullReal = await fs6.realpath(absolute).catch(() => null);
|
|
820
|
+
if (fullReal)
|
|
821
|
+
return fullReal;
|
|
822
|
+
const parent = path2.dirname(absolute);
|
|
823
|
+
const base = path2.basename(absolute);
|
|
824
|
+
const canonicalParent = await fs6.realpath(parent).catch(() => parent);
|
|
825
|
+
return path2.join(canonicalParent, base);
|
|
826
|
+
}
|
|
827
|
+
createLockRelease(lockFile, ownerId) {
|
|
828
|
+
const heartbeatStart = Date.now();
|
|
829
|
+
let heartbeatTimer;
|
|
830
|
+
let stopped = false;
|
|
831
|
+
const stopHeartbeat = () => {
|
|
832
|
+
stopped = true;
|
|
833
|
+
if (heartbeatTimer)
|
|
834
|
+
clearTimeout(heartbeatTimer);
|
|
835
|
+
};
|
|
836
|
+
const scheduleNextHeartbeat = () => {
|
|
837
|
+
if (stopped)
|
|
838
|
+
return;
|
|
839
|
+
if (Date.now() - heartbeatStart >= LOCK_MAX_HOLD_MS) {
|
|
840
|
+
stopped = true;
|
|
841
|
+
return;
|
|
842
|
+
}
|
|
843
|
+
heartbeatTimer = setTimeout(() => {
|
|
844
|
+
runHeartbeat();
|
|
845
|
+
}, LOCK_HEARTBEAT_MS);
|
|
846
|
+
heartbeatTimer.unref?.();
|
|
847
|
+
};
|
|
848
|
+
const runHeartbeat = async () => {
|
|
849
|
+
if (stopped)
|
|
850
|
+
return;
|
|
851
|
+
const current = await fs6.readFile(lockFile, "utf-8").catch(() => null);
|
|
852
|
+
if (stopped)
|
|
853
|
+
return;
|
|
854
|
+
if (current !== ownerId) {
|
|
855
|
+
stopped = true;
|
|
856
|
+
return;
|
|
857
|
+
}
|
|
858
|
+
const now = Date.now() / 1000;
|
|
859
|
+
await fs6.utimes(lockFile, now, now).catch(() => {});
|
|
860
|
+
scheduleNextHeartbeat();
|
|
861
|
+
};
|
|
862
|
+
scheduleNextHeartbeat();
|
|
863
|
+
let released = false;
|
|
864
|
+
return async () => {
|
|
865
|
+
if (released)
|
|
866
|
+
return;
|
|
867
|
+
released = true;
|
|
868
|
+
stopHeartbeat();
|
|
869
|
+
const current = await fs6.readFile(lockFile, "utf-8").catch(() => null);
|
|
870
|
+
if (current === ownerId) {
|
|
871
|
+
await fs6.rm(lockFile, { force: true });
|
|
872
|
+
}
|
|
873
|
+
};
|
|
874
|
+
}
|
|
790
875
|
async rm(filePath) {
|
|
791
876
|
await fs6.rm(filePath, { recursive: true, force: true });
|
|
792
877
|
}
|
|
@@ -832,9 +917,13 @@ class NodeFileSystem {
|
|
|
832
917
|
}
|
|
833
918
|
}
|
|
834
919
|
isEnoent(error) {
|
|
835
|
-
return
|
|
920
|
+
return this.hasErrnoCode(error, "ENOENT");
|
|
921
|
+
}
|
|
922
|
+
hasErrnoCode(error, code) {
|
|
923
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === code;
|
|
836
924
|
}
|
|
837
925
|
}
|
|
926
|
+
var LOCK_HEARTBEAT_MS = 5000, LOCK_STALE_MS = 15000, LOCK_MAX_WAIT_MS = 20000, LOCK_MAX_HOLD_MS = 60000, LOCK_RETRY_MIN_MS = 100, LOCK_RETRY_JITTER_MS = 200;
|
|
838
927
|
var init_node = __esm(() => {
|
|
839
928
|
init_open();
|
|
840
929
|
});
|
|
@@ -848,7 +937,7 @@ var init_src = __esm(() => {
|
|
|
848
937
|
|
|
849
938
|
// ../../node_modules/@uipath/coreipc/index.js
|
|
850
939
|
var require_coreipc = __commonJS((exports, module) => {
|
|
851
|
-
var __dirname = "/
|
|
940
|
+
var __dirname = "/home/runner/work/cli/cli/node_modules/@uipath/coreipc";
|
|
852
941
|
/*! For license information please see index.js.LICENSE.txt */
|
|
853
942
|
(function(e, t) {
|
|
854
943
|
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();
|
|
@@ -19040,6 +19129,10 @@ var require_dist = __commonJS((exports) => {
|
|
|
19040
19129
|
exports.RobotProxyConstructor = RobotProxyConstructor;
|
|
19041
19130
|
__exportStar(require_agent(), exports);
|
|
19042
19131
|
});
|
|
19132
|
+
// ../auth/src/server.ts
|
|
19133
|
+
var init_server = __esm(() => {
|
|
19134
|
+
init_constants();
|
|
19135
|
+
});
|
|
19043
19136
|
|
|
19044
19137
|
// ../../node_modules/commander/lib/error.js
|
|
19045
19138
|
var require_error = __commonJS((exports) => {
|
|
@@ -44630,7 +44723,8 @@ var require_dist3 = __commonJS((exports) => {
|
|
|
44630
44723
|
// package.json
|
|
44631
44724
|
var package_default = {
|
|
44632
44725
|
name: "@uipath/platform-tool",
|
|
44633
|
-
|
|
44726
|
+
license: "MIT",
|
|
44727
|
+
version: "1.195.0",
|
|
44634
44728
|
description: "Manage UiPath platform-level resources such as tenant licensing.",
|
|
44635
44729
|
type: "module",
|
|
44636
44730
|
main: "./dist/tool.js",
|
|
@@ -44691,32 +44785,7 @@ class InvalidBaseUrlError extends Error {
|
|
|
44691
44785
|
this.name = "InvalidBaseUrlError";
|
|
44692
44786
|
}
|
|
44693
44787
|
}
|
|
44694
|
-
var DEFAULT_SCOPES = [
|
|
44695
|
-
"offline_access",
|
|
44696
|
-
"ProcessMining",
|
|
44697
|
-
"OrchestratorApiUserAccess",
|
|
44698
|
-
"StudioWebBackend",
|
|
44699
|
-
"IdentityServerApi",
|
|
44700
|
-
"ConnectionService",
|
|
44701
|
-
"DataService",
|
|
44702
|
-
"DataServiceApiUserAccess",
|
|
44703
|
-
"DocumentUnderstanding",
|
|
44704
|
-
"EnterpriseContextService",
|
|
44705
|
-
"Directory",
|
|
44706
|
-
"JamJamApi",
|
|
44707
|
-
"LLMGateway",
|
|
44708
|
-
"LLMOps",
|
|
44709
|
-
"OMS",
|
|
44710
|
-
"RCS.FolderAuthorization",
|
|
44711
|
-
"RCS.TagsManagement",
|
|
44712
|
-
"TestmanagerApiUserAccess",
|
|
44713
|
-
"AutomationSolutions",
|
|
44714
|
-
"StudioWebTypeCacheService",
|
|
44715
|
-
"Docs.GPT.Search",
|
|
44716
|
-
"Insights",
|
|
44717
|
-
"ReferenceToken",
|
|
44718
|
-
"Audit.Read"
|
|
44719
|
-
];
|
|
44788
|
+
var DEFAULT_SCOPES = ["openid", "profile", "offline_access"];
|
|
44720
44789
|
var normalizeAndValidateBaseUrl = (rawUrl) => {
|
|
44721
44790
|
let baseUrl = rawUrl;
|
|
44722
44791
|
if (baseUrl.endsWith("/identity_/")) {
|
|
@@ -44766,7 +44835,8 @@ var resolveConfigAsync = async ({
|
|
|
44766
44835
|
if (!clientSecret && fileAuth.clientSecret) {
|
|
44767
44836
|
clientSecret = fileAuth.clientSecret;
|
|
44768
44837
|
}
|
|
44769
|
-
const
|
|
44838
|
+
const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && Boolean(clientSecret);
|
|
44839
|
+
const scopes = customScopes && customScopes.length > 0 ? customScopes : fileAuth.scopes && fileAuth.scopes.length > 0 ? fileAuth.scopes : isExternalAppAuth ? [] : DEFAULT_SCOPES;
|
|
44770
44840
|
return {
|
|
44771
44841
|
clientId,
|
|
44772
44842
|
clientSecret,
|
|
@@ -45266,6 +45336,129 @@ function normalizeTokenRefreshFailure() {
|
|
|
45266
45336
|
function normalizeTokenRefreshUnavailableFailure() {
|
|
45267
45337
|
return "token refresh failed before authentication completed";
|
|
45268
45338
|
}
|
|
45339
|
+
function errorMessage(error) {
|
|
45340
|
+
return error instanceof Error ? error.message : String(error);
|
|
45341
|
+
}
|
|
45342
|
+
function computeExpirationThreshold(ensureTokenValidityMinutes) {
|
|
45343
|
+
return new Date(Date.now() + (ensureTokenValidityMinutes ?? 0) * 60 * 1000);
|
|
45344
|
+
}
|
|
45345
|
+
async function runRefreshLocked(inputs) {
|
|
45346
|
+
const {
|
|
45347
|
+
absolutePath,
|
|
45348
|
+
refreshToken: callerRefreshToken,
|
|
45349
|
+
customAuthority,
|
|
45350
|
+
ensureTokenValidityMinutes,
|
|
45351
|
+
loadEnvFile,
|
|
45352
|
+
saveEnvFile,
|
|
45353
|
+
refreshFn,
|
|
45354
|
+
resolveConfig
|
|
45355
|
+
} = inputs;
|
|
45356
|
+
const expirationThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
|
|
45357
|
+
let fresh;
|
|
45358
|
+
try {
|
|
45359
|
+
fresh = await loadEnvFile({ envPath: absolutePath });
|
|
45360
|
+
} catch (error) {
|
|
45361
|
+
return {
|
|
45362
|
+
kind: "fail",
|
|
45363
|
+
status: {
|
|
45364
|
+
loginStatus: "Refresh Failed",
|
|
45365
|
+
hint: "Could not read the auth file while refreshing. Retry, or run 'uip login' to re-authenticate.",
|
|
45366
|
+
tokenRefresh: {
|
|
45367
|
+
attempted: false,
|
|
45368
|
+
success: false,
|
|
45369
|
+
errorMessage: `auth file read failed: ${errorMessage(error)}`
|
|
45370
|
+
}
|
|
45371
|
+
}
|
|
45372
|
+
};
|
|
45373
|
+
}
|
|
45374
|
+
const freshAccess = fresh.UIPATH_ACCESS_TOKEN;
|
|
45375
|
+
const freshExp = freshAccess ? getTokenExpiration(freshAccess) : undefined;
|
|
45376
|
+
if (freshAccess && freshExp && freshExp > expirationThreshold) {
|
|
45377
|
+
return {
|
|
45378
|
+
kind: "ok",
|
|
45379
|
+
accessToken: freshAccess,
|
|
45380
|
+
refreshToken: fresh.UIPATH_REFRESH_TOKEN ?? callerRefreshToken,
|
|
45381
|
+
expiration: freshExp,
|
|
45382
|
+
tokenRefresh: { attempted: false, success: true }
|
|
45383
|
+
};
|
|
45384
|
+
}
|
|
45385
|
+
const tokenForIdP = fresh.UIPATH_REFRESH_TOKEN ?? callerRefreshToken;
|
|
45386
|
+
let refreshedAccess;
|
|
45387
|
+
let refreshedRefresh;
|
|
45388
|
+
try {
|
|
45389
|
+
const config = await resolveConfig({ customAuthority });
|
|
45390
|
+
const refreshed = await refreshFn({
|
|
45391
|
+
refreshToken: tokenForIdP,
|
|
45392
|
+
tokenEndpoint: config.tokenEndpoint,
|
|
45393
|
+
clientId: config.clientId,
|
|
45394
|
+
expectedAuthority: customAuthority
|
|
45395
|
+
});
|
|
45396
|
+
refreshedAccess = refreshed.accessToken;
|
|
45397
|
+
refreshedRefresh = refreshed.refreshToken;
|
|
45398
|
+
} catch (error) {
|
|
45399
|
+
const isOAuthFailure = isTokenRefreshOAuthFailure(error);
|
|
45400
|
+
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.";
|
|
45401
|
+
const message = isOAuthFailure ? normalizeTokenRefreshFailure() : normalizeTokenRefreshUnavailableFailure();
|
|
45402
|
+
return {
|
|
45403
|
+
kind: "fail",
|
|
45404
|
+
status: {
|
|
45405
|
+
loginStatus: "Refresh Failed",
|
|
45406
|
+
hint,
|
|
45407
|
+
tokenRefresh: {
|
|
45408
|
+
attempted: true,
|
|
45409
|
+
success: false,
|
|
45410
|
+
errorMessage: message
|
|
45411
|
+
}
|
|
45412
|
+
}
|
|
45413
|
+
};
|
|
45414
|
+
}
|
|
45415
|
+
const refreshedExp = getTokenExpiration(refreshedAccess);
|
|
45416
|
+
if (!refreshedExp || refreshedExp <= new Date) {
|
|
45417
|
+
return {
|
|
45418
|
+
kind: "fail",
|
|
45419
|
+
status: {
|
|
45420
|
+
loginStatus: "Refresh Failed",
|
|
45421
|
+
hint: "The identity server returned an unusable token. Run 'uip login' to re-authenticate.",
|
|
45422
|
+
tokenRefresh: {
|
|
45423
|
+
attempted: true,
|
|
45424
|
+
success: false,
|
|
45425
|
+
errorMessage: "refreshed token has no valid expiration claim"
|
|
45426
|
+
}
|
|
45427
|
+
}
|
|
45428
|
+
};
|
|
45429
|
+
}
|
|
45430
|
+
try {
|
|
45431
|
+
await saveEnvFile({
|
|
45432
|
+
envPath: absolutePath,
|
|
45433
|
+
data: {
|
|
45434
|
+
UIPATH_ACCESS_TOKEN: refreshedAccess,
|
|
45435
|
+
UIPATH_REFRESH_TOKEN: refreshedRefresh
|
|
45436
|
+
},
|
|
45437
|
+
merge: true
|
|
45438
|
+
});
|
|
45439
|
+
return {
|
|
45440
|
+
kind: "ok",
|
|
45441
|
+
accessToken: refreshedAccess,
|
|
45442
|
+
refreshToken: refreshedRefresh,
|
|
45443
|
+
expiration: refreshedExp,
|
|
45444
|
+
tokenRefresh: { attempted: true, success: true }
|
|
45445
|
+
};
|
|
45446
|
+
} catch (error) {
|
|
45447
|
+
const msg = errorMessage(error);
|
|
45448
|
+
return {
|
|
45449
|
+
kind: "ok",
|
|
45450
|
+
accessToken: refreshedAccess,
|
|
45451
|
+
refreshToken: refreshedRefresh,
|
|
45452
|
+
expiration: refreshedExp,
|
|
45453
|
+
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.`,
|
|
45454
|
+
tokenRefresh: {
|
|
45455
|
+
attempted: true,
|
|
45456
|
+
success: true,
|
|
45457
|
+
errorMessage: `persistence failed: ${msg}`
|
|
45458
|
+
}
|
|
45459
|
+
};
|
|
45460
|
+
}
|
|
45461
|
+
}
|
|
45269
45462
|
var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
45270
45463
|
const {
|
|
45271
45464
|
resolveEnvFilePath = resolveEnvFilePathAsync,
|
|
@@ -45340,73 +45533,103 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
45340
45533
|
let refreshToken = credentials.UIPATH_REFRESH_TOKEN;
|
|
45341
45534
|
let expiration = getTokenExpiration(accessToken);
|
|
45342
45535
|
let persistenceWarning;
|
|
45536
|
+
let lockReleaseFailed = false;
|
|
45343
45537
|
let tokenRefresh;
|
|
45344
|
-
const
|
|
45345
|
-
|
|
45346
|
-
|
|
45347
|
-
|
|
45538
|
+
const outerThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
|
|
45539
|
+
const tryGlobalCredsHint = async () => {
|
|
45540
|
+
const fs7 = getFs();
|
|
45541
|
+
const globalPath = fs7.path.join(fs7.env.homedir(), envFilePath);
|
|
45542
|
+
if (absolutePath === globalPath)
|
|
45543
|
+
return;
|
|
45544
|
+
if (!await fs7.exists(globalPath))
|
|
45545
|
+
return;
|
|
45348
45546
|
try {
|
|
45349
|
-
const
|
|
45350
|
-
|
|
45351
|
-
|
|
45352
|
-
const
|
|
45353
|
-
|
|
45354
|
-
|
|
45355
|
-
|
|
45356
|
-
|
|
45357
|
-
|
|
45358
|
-
|
|
45359
|
-
|
|
45547
|
+
const globalCreds = await loadEnvFile({ envPath: globalPath });
|
|
45548
|
+
if (!globalCreds.UIPATH_ACCESS_TOKEN)
|
|
45549
|
+
return;
|
|
45550
|
+
const globalExp = getTokenExpiration(globalCreds.UIPATH_ACCESS_TOKEN);
|
|
45551
|
+
if (globalExp && globalExp <= new Date)
|
|
45552
|
+
return;
|
|
45553
|
+
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.`;
|
|
45554
|
+
} catch {
|
|
45555
|
+
return;
|
|
45556
|
+
}
|
|
45557
|
+
};
|
|
45558
|
+
if (expiration && expiration <= outerThreshold && refreshToken) {
|
|
45559
|
+
let release;
|
|
45560
|
+
try {
|
|
45561
|
+
release = await getFs().acquireLock(absolutePath);
|
|
45360
45562
|
} catch (error) {
|
|
45361
|
-
const
|
|
45362
|
-
const
|
|
45363
|
-
|
|
45563
|
+
const msg = errorMessage(error);
|
|
45564
|
+
const globalHint = await tryGlobalCredsHint();
|
|
45565
|
+
if (globalHint) {
|
|
45566
|
+
return {
|
|
45567
|
+
loginStatus: "Expired",
|
|
45568
|
+
accessToken,
|
|
45569
|
+
refreshToken,
|
|
45570
|
+
baseUrl: credentials.UIPATH_URL,
|
|
45571
|
+
organizationName: credentials.UIPATH_ORGANIZATION_NAME,
|
|
45572
|
+
organizationId: credentials.UIPATH_ORGANIZATION_ID,
|
|
45573
|
+
tenantName: credentials.UIPATH_TENANT_NAME,
|
|
45574
|
+
tenantId: credentials.UIPATH_TENANT_ID,
|
|
45575
|
+
expiration,
|
|
45576
|
+
source: "file" /* File */,
|
|
45577
|
+
hint: globalHint,
|
|
45578
|
+
tokenRefresh: {
|
|
45579
|
+
attempted: false,
|
|
45580
|
+
success: false,
|
|
45581
|
+
errorMessage: `lock acquisition failed: ${msg}`
|
|
45582
|
+
}
|
|
45583
|
+
};
|
|
45584
|
+
}
|
|
45364
45585
|
return {
|
|
45365
45586
|
loginStatus: "Refresh Failed",
|
|
45366
|
-
hint,
|
|
45587
|
+
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.",
|
|
45367
45588
|
tokenRefresh: {
|
|
45368
|
-
attempted:
|
|
45589
|
+
attempted: false,
|
|
45369
45590
|
success: false,
|
|
45370
|
-
errorMessage
|
|
45591
|
+
errorMessage: `lock acquisition failed: ${msg}`
|
|
45371
45592
|
}
|
|
45372
45593
|
};
|
|
45373
45594
|
}
|
|
45374
|
-
|
|
45375
|
-
|
|
45376
|
-
|
|
45377
|
-
|
|
45378
|
-
|
|
45379
|
-
|
|
45380
|
-
|
|
45381
|
-
|
|
45382
|
-
|
|
45595
|
+
let lockedFailure;
|
|
45596
|
+
try {
|
|
45597
|
+
const outcome = await runRefreshLocked({
|
|
45598
|
+
absolutePath,
|
|
45599
|
+
refreshToken,
|
|
45600
|
+
customAuthority: credentials.UIPATH_URL,
|
|
45601
|
+
ensureTokenValidityMinutes,
|
|
45602
|
+
loadEnvFile,
|
|
45603
|
+
saveEnvFile,
|
|
45604
|
+
refreshFn: refreshTokenFn,
|
|
45605
|
+
resolveConfig
|
|
45606
|
+
});
|
|
45607
|
+
if (outcome.kind === "fail") {
|
|
45608
|
+
lockedFailure = outcome.status;
|
|
45609
|
+
} else {
|
|
45610
|
+
accessToken = outcome.accessToken;
|
|
45611
|
+
refreshToken = outcome.refreshToken;
|
|
45612
|
+
expiration = outcome.expiration;
|
|
45613
|
+
tokenRefresh = outcome.tokenRefresh;
|
|
45614
|
+
if (outcome.persistenceWarning) {
|
|
45615
|
+
persistenceWarning = outcome.persistenceWarning;
|
|
45383
45616
|
}
|
|
45384
|
-
}
|
|
45617
|
+
}
|
|
45618
|
+
} finally {
|
|
45619
|
+
try {
|
|
45620
|
+
await release();
|
|
45621
|
+
} catch {
|
|
45622
|
+
lockReleaseFailed = true;
|
|
45623
|
+
}
|
|
45385
45624
|
}
|
|
45386
|
-
|
|
45387
|
-
|
|
45388
|
-
|
|
45389
|
-
|
|
45390
|
-
|
|
45391
|
-
|
|
45392
|
-
|
|
45393
|
-
|
|
45394
|
-
UIPATH_REFRESH_TOKEN: refreshToken
|
|
45395
|
-
},
|
|
45396
|
-
merge: true
|
|
45397
|
-
});
|
|
45398
|
-
tokenRefresh = {
|
|
45399
|
-
attempted: true,
|
|
45400
|
-
success: true
|
|
45401
|
-
};
|
|
45402
|
-
} catch (error) {
|
|
45403
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
45404
|
-
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.`;
|
|
45405
|
-
tokenRefresh = {
|
|
45406
|
-
attempted: true,
|
|
45407
|
-
success: true,
|
|
45408
|
-
errorMessage: `persistence failed: ${msg}`
|
|
45409
|
-
};
|
|
45625
|
+
if (lockedFailure) {
|
|
45626
|
+
const globalHint = await tryGlobalCredsHint();
|
|
45627
|
+
const base = globalHint ? {
|
|
45628
|
+
...lockedFailure,
|
|
45629
|
+
loginStatus: "Expired",
|
|
45630
|
+
hint: globalHint
|
|
45631
|
+
} : lockedFailure;
|
|
45632
|
+
return lockReleaseFailed ? { ...base, lockReleaseFailed: true } : base;
|
|
45410
45633
|
}
|
|
45411
45634
|
}
|
|
45412
45635
|
const result = {
|
|
@@ -45421,23 +45644,13 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
45421
45644
|
expiration,
|
|
45422
45645
|
source: "file" /* File */,
|
|
45423
45646
|
...persistenceWarning ? { hint: persistenceWarning, persistenceFailed: true } : {},
|
|
45647
|
+
...lockReleaseFailed ? { lockReleaseFailed: true } : {},
|
|
45424
45648
|
...tokenRefresh ? { tokenRefresh } : {}
|
|
45425
45649
|
};
|
|
45426
45650
|
if (result.loginStatus === "Expired") {
|
|
45427
|
-
const
|
|
45428
|
-
|
|
45429
|
-
|
|
45430
|
-
try {
|
|
45431
|
-
const globalCreds = await loadEnvFile({
|
|
45432
|
-
envPath: globalPath
|
|
45433
|
-
});
|
|
45434
|
-
if (globalCreds.UIPATH_ACCESS_TOKEN) {
|
|
45435
|
-
const globalExp = getTokenExpiration(globalCreds.UIPATH_ACCESS_TOKEN);
|
|
45436
|
-
if (!globalExp || globalExp > new Date) {
|
|
45437
|
-
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.`;
|
|
45438
|
-
}
|
|
45439
|
-
}
|
|
45440
|
-
} catch {}
|
|
45651
|
+
const globalHint = await tryGlobalCredsHint();
|
|
45652
|
+
if (globalHint) {
|
|
45653
|
+
result.hint = globalHint;
|
|
45441
45654
|
}
|
|
45442
45655
|
}
|
|
45443
45656
|
return result;
|
|
@@ -45504,6 +45717,10 @@ var fetchTenantsAndOrganizations = async (baseUrl, accessToken, organizationId)
|
|
|
45504
45717
|
};
|
|
45505
45718
|
// ../auth/src/logout.ts
|
|
45506
45719
|
init_src();
|
|
45720
|
+
|
|
45721
|
+
// ../auth/src/index.ts
|
|
45722
|
+
init_server();
|
|
45723
|
+
|
|
45507
45724
|
// ../common/src/attachment-binding.ts
|
|
45508
45725
|
init_src();
|
|
45509
45726
|
|
|
@@ -45641,10 +45858,15 @@ async function extractErrorDetails(error, options) {
|
|
|
45641
45858
|
}
|
|
45642
45859
|
if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
|
|
45643
45860
|
context.errorCode = parsedBody.errorCode;
|
|
45861
|
+
} else if (parsedBody?.code && typeof parsedBody.code === "string") {
|
|
45862
|
+
context.errorCode = parsedBody.code;
|
|
45644
45863
|
}
|
|
45645
45864
|
if (parsedBody?.requestId && typeof parsedBody.requestId === "string") {
|
|
45646
45865
|
context.requestId = parsedBody.requestId;
|
|
45647
45866
|
}
|
|
45867
|
+
if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
|
|
45868
|
+
context.traceId = parsedBody.traceId;
|
|
45869
|
+
}
|
|
45648
45870
|
if (status === 429) {
|
|
45649
45871
|
const resp = response;
|
|
45650
45872
|
const headersObj = resp?.headers;
|
|
@@ -45664,7 +45886,35 @@ async function extractErrorDetails(error, options) {
|
|
|
45664
45886
|
}
|
|
45665
45887
|
}
|
|
45666
45888
|
const hasContext = Object.keys(context).length > 0;
|
|
45667
|
-
|
|
45889
|
+
let parsedErrors;
|
|
45890
|
+
if (parsedBody?.errors && typeof parsedBody.errors === "object") {
|
|
45891
|
+
const errors = {};
|
|
45892
|
+
for (const [field, raw] of Object.entries(parsedBody.errors)) {
|
|
45893
|
+
if (Array.isArray(raw)) {
|
|
45894
|
+
const messages = raw.map((entry) => {
|
|
45895
|
+
if (typeof entry === "string")
|
|
45896
|
+
return entry;
|
|
45897
|
+
if (entry && typeof entry === "object" && typeof entry.message === "string") {
|
|
45898
|
+
return entry.message;
|
|
45899
|
+
}
|
|
45900
|
+
return String(entry);
|
|
45901
|
+
}).filter(Boolean);
|
|
45902
|
+
if (messages.length > 0)
|
|
45903
|
+
errors[field] = messages;
|
|
45904
|
+
} else if (typeof raw === "string") {
|
|
45905
|
+
errors[field] = [raw];
|
|
45906
|
+
}
|
|
45907
|
+
}
|
|
45908
|
+
if (Object.keys(errors).length > 0)
|
|
45909
|
+
parsedErrors = errors;
|
|
45910
|
+
}
|
|
45911
|
+
return {
|
|
45912
|
+
result,
|
|
45913
|
+
message,
|
|
45914
|
+
details,
|
|
45915
|
+
...hasContext ? { context } : {},
|
|
45916
|
+
...parsedErrors ? { parsedErrors } : {}
|
|
45917
|
+
};
|
|
45668
45918
|
}
|
|
45669
45919
|
async function extractErrorMessage(error, options) {
|
|
45670
45920
|
const { message } = await extractErrorDetails(error, options);
|
|
@@ -50832,6 +51082,60 @@ function escapeNonAscii(jsonText) {
|
|
|
50832
51082
|
function needsAsciiSafeJson(sink) {
|
|
50833
51083
|
return process.platform === "win32" && !sink.capabilities.isInteractive;
|
|
50834
51084
|
}
|
|
51085
|
+
function isPlainRecord(value) {
|
|
51086
|
+
if (value === null || typeof value !== "object")
|
|
51087
|
+
return false;
|
|
51088
|
+
const prototype = Object.getPrototypeOf(value);
|
|
51089
|
+
return prototype === Object.prototype || prototype === null;
|
|
51090
|
+
}
|
|
51091
|
+
function toLowerCamelCaseKey(key) {
|
|
51092
|
+
if (!key)
|
|
51093
|
+
return key;
|
|
51094
|
+
if (/[_\-\s]/.test(key)) {
|
|
51095
|
+
const [firstPart, ...restParts] = key.split(/[_\-\s]+/).filter(Boolean);
|
|
51096
|
+
if (!firstPart)
|
|
51097
|
+
return key;
|
|
51098
|
+
return [
|
|
51099
|
+
toLowerCamelCaseSimpleKey(firstPart),
|
|
51100
|
+
...restParts.map((part) => {
|
|
51101
|
+
const normalized = toLowerCamelCaseSimpleKey(part);
|
|
51102
|
+
return normalized.charAt(0).toUpperCase() + normalized.slice(1);
|
|
51103
|
+
})
|
|
51104
|
+
].join("");
|
|
51105
|
+
}
|
|
51106
|
+
return toLowerCamelCaseSimpleKey(key);
|
|
51107
|
+
}
|
|
51108
|
+
function toLowerCamelCaseSimpleKey(key) {
|
|
51109
|
+
if (/^[A-Z0-9]+$/.test(key))
|
|
51110
|
+
return key.toLowerCase();
|
|
51111
|
+
return key.replace(/^[A-Z]+(?=[A-Z][a-z]|\d|$)|^[A-Z]/, (match) => match.toLowerCase());
|
|
51112
|
+
}
|
|
51113
|
+
function toPascalCaseKey(key) {
|
|
51114
|
+
const lowerCamelKey = toLowerCamelCaseKey(key);
|
|
51115
|
+
return lowerCamelKey ? lowerCamelKey.charAt(0).toUpperCase() + lowerCamelKey.slice(1) : lowerCamelKey;
|
|
51116
|
+
}
|
|
51117
|
+
function toPascalCaseData(value) {
|
|
51118
|
+
if (Array.isArray(value))
|
|
51119
|
+
return value.map(toPascalCaseData);
|
|
51120
|
+
if (!isPlainRecord(value))
|
|
51121
|
+
return value;
|
|
51122
|
+
const result = {};
|
|
51123
|
+
for (const [key, nestedValue] of Object.entries(value)) {
|
|
51124
|
+
result[toPascalCaseKey(key)] = toPascalCaseData(nestedValue);
|
|
51125
|
+
}
|
|
51126
|
+
return result;
|
|
51127
|
+
}
|
|
51128
|
+
function normalizeDataKeys(data) {
|
|
51129
|
+
return toPascalCaseData(data);
|
|
51130
|
+
}
|
|
51131
|
+
function normalizeOutputKeys(data) {
|
|
51132
|
+
const result = {};
|
|
51133
|
+
for (const [key, value] of Object.entries(data)) {
|
|
51134
|
+
const pascalKey = toPascalCaseKey(key);
|
|
51135
|
+
result[pascalKey] = pascalKey === "Data" ? value : toPascalCaseData(value);
|
|
51136
|
+
}
|
|
51137
|
+
return result;
|
|
51138
|
+
}
|
|
50835
51139
|
function printOutput(data, format = "json", logFn, asciiSafe = false) {
|
|
50836
51140
|
if (!data) {
|
|
50837
51141
|
logFn("Empty response object. No data to display.");
|
|
@@ -50894,7 +51198,7 @@ function wrapText(text, width) {
|
|
|
50894
51198
|
function printTable(data, logFn, externalLogValue) {
|
|
50895
51199
|
if (data.length === 0)
|
|
50896
51200
|
return;
|
|
50897
|
-
const keys = Object.keys(data[0]).filter((key) =>
|
|
51201
|
+
const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
|
|
50898
51202
|
const maxWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
|
|
50899
51203
|
const header = keys.map((key, i2) => key.padEnd(maxWidths[i2])).join(" | ");
|
|
50900
51204
|
logFn(header);
|
|
@@ -50909,7 +51213,7 @@ function printTable(data, logFn, externalLogValue) {
|
|
|
50909
51213
|
}
|
|
50910
51214
|
}
|
|
50911
51215
|
function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
50912
|
-
const keys = Object.keys(data).filter((key) =>
|
|
51216
|
+
const keys = Object.keys(data).filter((key) => !["code", "log"].includes(key.toLowerCase()));
|
|
50913
51217
|
if (keys.length === 0)
|
|
50914
51218
|
return;
|
|
50915
51219
|
const maxKeyWidth = Math.max(...keys.map((key) => key.length));
|
|
@@ -50925,7 +51229,7 @@ function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
|
50925
51229
|
function printResizableTable(data, logFn = console.log, externalLogValue) {
|
|
50926
51230
|
if (data.length === 0)
|
|
50927
51231
|
return;
|
|
50928
|
-
const keys = Object.keys(data[0]).filter((key) =>
|
|
51232
|
+
const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
|
|
50929
51233
|
if (keys.length === 0)
|
|
50930
51234
|
return;
|
|
50931
51235
|
if (!process.stdout.isTTY) {
|
|
@@ -51001,8 +51305,26 @@ function printResizableTable(data, logFn = console.log, externalLogValue) {
|
|
|
51001
51305
|
function toYaml(data) {
|
|
51002
51306
|
return dump(data);
|
|
51003
51307
|
}
|
|
51308
|
+
class FilterEvaluationError extends Error {
|
|
51309
|
+
__brand = "FilterEvaluationError";
|
|
51310
|
+
filter;
|
|
51311
|
+
instructions;
|
|
51312
|
+
result = RESULTS.ValidationError;
|
|
51313
|
+
constructor(filter, cause) {
|
|
51314
|
+
const underlying = cause instanceof Error ? cause.message : String(cause);
|
|
51315
|
+
super(`Filter '${filter}' failed to evaluate: ${underlying}`);
|
|
51316
|
+
this.name = "FilterEvaluationError";
|
|
51317
|
+
this.filter = filter;
|
|
51318
|
+
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(@)'.";
|
|
51319
|
+
}
|
|
51320
|
+
}
|
|
51004
51321
|
function applyFilter(data, filter) {
|
|
51005
|
-
|
|
51322
|
+
let result;
|
|
51323
|
+
try {
|
|
51324
|
+
result = search(data, filter);
|
|
51325
|
+
} catch (err) {
|
|
51326
|
+
throw new FilterEvaluationError(filter, err);
|
|
51327
|
+
}
|
|
51006
51328
|
if (result == null)
|
|
51007
51329
|
return [];
|
|
51008
51330
|
if (Array.isArray(result)) {
|
|
@@ -51019,13 +51341,18 @@ function applyFilter(data, filter) {
|
|
|
51019
51341
|
}
|
|
51020
51342
|
var OutputFormatter;
|
|
51021
51343
|
((OutputFormatter) => {
|
|
51022
|
-
function success(data) {
|
|
51344
|
+
function success(data, options) {
|
|
51023
51345
|
data.Log ??= getLogFilePath() || undefined;
|
|
51346
|
+
const normalize = !options?.preserveDataKeys;
|
|
51347
|
+
if (normalize) {
|
|
51348
|
+
data.Data = normalizeDataKeys(data.Data);
|
|
51349
|
+
}
|
|
51024
51350
|
const filter = getOutputFilter();
|
|
51025
51351
|
if (filter) {
|
|
51026
|
-
|
|
51352
|
+
const filtered = applyFilter(data.Data, filter);
|
|
51353
|
+
data.Data = normalize ? normalizeDataKeys(filtered) : filtered;
|
|
51027
51354
|
}
|
|
51028
|
-
logOutput(data, getOutputFormat());
|
|
51355
|
+
logOutput(normalizeOutputKeys(data), getOutputFormat());
|
|
51029
51356
|
}
|
|
51030
51357
|
OutputFormatter.success = success;
|
|
51031
51358
|
function error(data) {
|
|
@@ -51035,7 +51362,7 @@ var OutputFormatter;
|
|
|
51035
51362
|
result: data.Result,
|
|
51036
51363
|
message: data.Message
|
|
51037
51364
|
});
|
|
51038
|
-
logOutput(data, getOutputFormat());
|
|
51365
|
+
logOutput(normalizeOutputKeys(data), getOutputFormat());
|
|
51039
51366
|
}
|
|
51040
51367
|
OutputFormatter.error = error;
|
|
51041
51368
|
function emitList(code, items, opts) {
|
|
@@ -51056,13 +51383,14 @@ var OutputFormatter;
|
|
|
51056
51383
|
function log(data) {
|
|
51057
51384
|
const format = getOutputFormat();
|
|
51058
51385
|
const sink = getOutputSink();
|
|
51386
|
+
const normalized = toPascalCaseData(data);
|
|
51059
51387
|
if (format === "json") {
|
|
51060
|
-
const json2 = JSON.stringify(
|
|
51388
|
+
const json2 = JSON.stringify(normalized);
|
|
51061
51389
|
const safe = needsAsciiSafeJson(sink) ? escapeNonAscii(json2) : json2;
|
|
51062
51390
|
sink.writeErr(`${safe}
|
|
51063
51391
|
`);
|
|
51064
51392
|
} else {
|
|
51065
|
-
for (const [key, value] of Object.entries(
|
|
51393
|
+
for (const [key, value] of Object.entries(normalized)) {
|
|
51066
51394
|
sink.writeErr(`${key}: ${value}
|
|
51067
51395
|
`);
|
|
51068
51396
|
}
|
|
@@ -51071,12 +51399,16 @@ var OutputFormatter;
|
|
|
51071
51399
|
OutputFormatter.log = log;
|
|
51072
51400
|
function formatToString(data) {
|
|
51073
51401
|
const filter = getOutputFilter();
|
|
51074
|
-
if (
|
|
51075
|
-
data.Data =
|
|
51402
|
+
if ("Data" in data && data.Data != null) {
|
|
51403
|
+
data.Data = normalizeDataKeys(data.Data);
|
|
51404
|
+
if (filter) {
|
|
51405
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter));
|
|
51406
|
+
}
|
|
51076
51407
|
}
|
|
51408
|
+
const output = normalizeOutputKeys(data);
|
|
51077
51409
|
const lines = [];
|
|
51078
51410
|
const sink = getOutputSink();
|
|
51079
|
-
printOutput(
|
|
51411
|
+
printOutput(output, getOutputFormat(), (msg) => {
|
|
51080
51412
|
lines.push(msg);
|
|
51081
51413
|
}, needsAsciiSafeJson(sink));
|
|
51082
51414
|
return lines.join(`
|
|
@@ -52487,6 +52819,22 @@ JSONPath.prototype.safeVm = {
|
|
|
52487
52819
|
Script: SafeScript
|
|
52488
52820
|
};
|
|
52489
52821
|
JSONPath.prototype.vm = vm;
|
|
52822
|
+
// ../common/src/polling/types.ts
|
|
52823
|
+
var PollOutcome = {
|
|
52824
|
+
Completed: "completed",
|
|
52825
|
+
Timeout: "timeout",
|
|
52826
|
+
Interrupted: "interrupted",
|
|
52827
|
+
Aborted: "aborted",
|
|
52828
|
+
Failed: "failed"
|
|
52829
|
+
};
|
|
52830
|
+
|
|
52831
|
+
// ../common/src/polling/poll-failure-mapping.ts
|
|
52832
|
+
var REASON_BY_OUTCOME = {
|
|
52833
|
+
[PollOutcome.Timeout]: "poll_timeout",
|
|
52834
|
+
[PollOutcome.Failed]: "poll_failed",
|
|
52835
|
+
[PollOutcome.Interrupted]: "poll_failed",
|
|
52836
|
+
[PollOutcome.Aborted]: "poll_aborted"
|
|
52837
|
+
};
|
|
52490
52838
|
// ../common/src/polling/terminal-statuses.ts
|
|
52491
52839
|
var TERMINAL_STATUSES = new Set([
|
|
52492
52840
|
"completed",
|
|
@@ -52514,6 +52862,105 @@ var ScreenLogger;
|
|
|
52514
52862
|
}
|
|
52515
52863
|
ScreenLogger.progress = progress;
|
|
52516
52864
|
})(ScreenLogger ||= {});
|
|
52865
|
+
// ../common/src/sdk-user-agent.ts
|
|
52866
|
+
var USER_AGENT_HEADER = "User-Agent";
|
|
52867
|
+
var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
|
|
52868
|
+
function userAgentPatchKey(userAgent) {
|
|
52869
|
+
return Symbol.for(`@uipath/common/sdk-user-agent/${userAgent}`);
|
|
52870
|
+
}
|
|
52871
|
+
function splitUserAgentTokens(value) {
|
|
52872
|
+
return value?.trim().split(/\s+/).filter(Boolean) ?? [];
|
|
52873
|
+
}
|
|
52874
|
+
function appendUserAgentToken(value, userAgent) {
|
|
52875
|
+
const tokens = splitUserAgentTokens(value);
|
|
52876
|
+
const seen = new Set(tokens);
|
|
52877
|
+
for (const token of splitUserAgentTokens(userAgent)) {
|
|
52878
|
+
if (!seen.has(token)) {
|
|
52879
|
+
tokens.push(token);
|
|
52880
|
+
seen.add(token);
|
|
52881
|
+
}
|
|
52882
|
+
}
|
|
52883
|
+
return tokens.join(" ");
|
|
52884
|
+
}
|
|
52885
|
+
function getEffectiveUserAgent(userAgent) {
|
|
52886
|
+
return appendUserAgentToken(sdkUserAgentHostToken.get(), userAgent);
|
|
52887
|
+
}
|
|
52888
|
+
function isHeadersLike(headers) {
|
|
52889
|
+
return typeof headers === "object" && headers !== null && "get" in headers && typeof headers.get === "function" && "set" in headers && typeof headers.set === "function";
|
|
52890
|
+
}
|
|
52891
|
+
function getSdkUserAgentToken(pkg) {
|
|
52892
|
+
const packageName = pkg.name.replace(/^@uipath\//, "");
|
|
52893
|
+
return getEffectiveUserAgent(`${packageName}/${pkg.version}`);
|
|
52894
|
+
}
|
|
52895
|
+
function addSdkUserAgentHeader(headers, userAgent) {
|
|
52896
|
+
const result = { ...headers ?? {} };
|
|
52897
|
+
const effectiveUserAgent = getEffectiveUserAgent(userAgent);
|
|
52898
|
+
const headerName = Object.keys(result).find((key) => key.toLowerCase() === USER_AGENT_HEADER.toLowerCase());
|
|
52899
|
+
if (headerName) {
|
|
52900
|
+
result[headerName] = appendUserAgentToken(result[headerName], effectiveUserAgent);
|
|
52901
|
+
} else {
|
|
52902
|
+
result[USER_AGENT_HEADER] = effectiveUserAgent;
|
|
52903
|
+
}
|
|
52904
|
+
return result;
|
|
52905
|
+
}
|
|
52906
|
+
function withSdkUserAgentHeader(headers, userAgent) {
|
|
52907
|
+
const effectiveUserAgent = getEffectiveUserAgent(userAgent);
|
|
52908
|
+
if (isHeadersLike(headers)) {
|
|
52909
|
+
headers.set(USER_AGENT_HEADER, appendUserAgentToken(headers.get(USER_AGENT_HEADER), effectiveUserAgent));
|
|
52910
|
+
return headers;
|
|
52911
|
+
}
|
|
52912
|
+
if (Array.isArray(headers)) {
|
|
52913
|
+
const result = headers.map((entry) => {
|
|
52914
|
+
const [key, value] = entry;
|
|
52915
|
+
return [key, value];
|
|
52916
|
+
});
|
|
52917
|
+
const headerIndex = result.findIndex(([key]) => key.toLowerCase() === USER_AGENT_HEADER.toLowerCase());
|
|
52918
|
+
if (headerIndex >= 0) {
|
|
52919
|
+
const [key, value] = result[headerIndex];
|
|
52920
|
+
result[headerIndex] = [
|
|
52921
|
+
key,
|
|
52922
|
+
appendUserAgentToken(value, effectiveUserAgent)
|
|
52923
|
+
];
|
|
52924
|
+
} else {
|
|
52925
|
+
result.push([USER_AGENT_HEADER, effectiveUserAgent]);
|
|
52926
|
+
}
|
|
52927
|
+
return result;
|
|
52928
|
+
}
|
|
52929
|
+
return addSdkUserAgentHeader(typeof headers === "object" && headers !== null ? { ...headers } : {}, effectiveUserAgent);
|
|
52930
|
+
}
|
|
52931
|
+
function withUserAgentInitOverride(initOverrides, userAgent) {
|
|
52932
|
+
return async (requestContext) => {
|
|
52933
|
+
const initWithUserAgent = {
|
|
52934
|
+
...requestContext.init,
|
|
52935
|
+
headers: withSdkUserAgentHeader(requestContext.init.headers, userAgent)
|
|
52936
|
+
};
|
|
52937
|
+
const override = typeof initOverrides === "function" ? await initOverrides({
|
|
52938
|
+
...requestContext,
|
|
52939
|
+
init: initWithUserAgent
|
|
52940
|
+
}) : initOverrides;
|
|
52941
|
+
return {
|
|
52942
|
+
...override ?? {},
|
|
52943
|
+
headers: withSdkUserAgentHeader(override?.headers ?? initWithUserAgent.headers, userAgent)
|
|
52944
|
+
};
|
|
52945
|
+
};
|
|
52946
|
+
}
|
|
52947
|
+
function installSdkUserAgentHeader(BaseApiClass, userAgent) {
|
|
52948
|
+
const prototype = BaseApiClass.prototype;
|
|
52949
|
+
const patchKey = userAgentPatchKey(userAgent);
|
|
52950
|
+
if (prototype[patchKey]) {
|
|
52951
|
+
return;
|
|
52952
|
+
}
|
|
52953
|
+
if (typeof prototype.request !== "function") {
|
|
52954
|
+
throw new Error("Generated BaseAPI request function not found.");
|
|
52955
|
+
}
|
|
52956
|
+
const originalRequest = prototype.request;
|
|
52957
|
+
prototype.request = function requestWithUserAgent(context, initOverrides) {
|
|
52958
|
+
return originalRequest.call(this, context, withUserAgentInitOverride(initOverrides, userAgent));
|
|
52959
|
+
};
|
|
52960
|
+
Object.defineProperty(prototype, patchKey, {
|
|
52961
|
+
value: true
|
|
52962
|
+
});
|
|
52963
|
+
}
|
|
52517
52964
|
// ../common/src/tool-provider.ts
|
|
52518
52965
|
var factorySlot = singleton("PackagerFactoryProvider");
|
|
52519
52966
|
// ../common/src/telemetry/pii-redactor.ts
|
|
@@ -52692,17 +53139,21 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
52692
53139
|
const telemetryName = deriveCommandPath(command);
|
|
52693
53140
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
52694
53141
|
const startTime = performance.now();
|
|
52695
|
-
let
|
|
53142
|
+
let errorMessage2;
|
|
52696
53143
|
const [error] = await catchError2(fn(...args));
|
|
52697
53144
|
if (error) {
|
|
52698
|
-
|
|
52699
|
-
logger.
|
|
53145
|
+
errorMessage2 = error instanceof Error ? error.message : String(error);
|
|
53146
|
+
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage2}`);
|
|
53147
|
+
const typed = error;
|
|
53148
|
+
const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
|
|
53149
|
+
const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
|
|
53150
|
+
const finalResult = customResult ?? RESULTS.Failure;
|
|
52700
53151
|
OutputFormatter.error({
|
|
52701
|
-
Result:
|
|
52702
|
-
Message:
|
|
52703
|
-
Instructions: "An unexpected error occurred. Run with --log-level debug for details."
|
|
53152
|
+
Result: finalResult,
|
|
53153
|
+
Message: errorMessage2,
|
|
53154
|
+
Instructions: customInstructions ?? "An unexpected error occurred. Run with --log-level debug for details."
|
|
52704
53155
|
});
|
|
52705
|
-
context.exit(
|
|
53156
|
+
context.exit(EXIT_CODES[finalResult]);
|
|
52706
53157
|
}
|
|
52707
53158
|
const durationMs = performance.now() - startTime;
|
|
52708
53159
|
const success = !error && (process.exitCode === undefined || process.exitCode === 0);
|
|
@@ -52711,7 +53162,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
52711
53162
|
...props,
|
|
52712
53163
|
duration: String(durationMs),
|
|
52713
53164
|
success: String(success),
|
|
52714
|
-
...
|
|
53165
|
+
...errorMessage2 ? { errorMessage: errorMessage2 } : {}
|
|
52715
53166
|
}));
|
|
52716
53167
|
});
|
|
52717
53168
|
};
|
|
@@ -53605,6 +54056,57 @@ class JSONApiResponse {
|
|
|
53605
54056
|
return this.transformer(await this.raw.json());
|
|
53606
54057
|
}
|
|
53607
54058
|
}
|
|
54059
|
+
// ../admin/identity-sdk/package.json
|
|
54060
|
+
var package_default2 = {
|
|
54061
|
+
name: "@uipath/identity-sdk",
|
|
54062
|
+
license: "MIT",
|
|
54063
|
+
version: "1.2.0",
|
|
54064
|
+
repository: {
|
|
54065
|
+
type: "git",
|
|
54066
|
+
url: "https://github.com/UiPath/cli.git",
|
|
54067
|
+
directory: "packages/admin/identity-sdk"
|
|
54068
|
+
},
|
|
54069
|
+
publishConfig: {
|
|
54070
|
+
registry: "https://npm.pkg.github.com/@uipath"
|
|
54071
|
+
},
|
|
54072
|
+
keywords: [
|
|
54073
|
+
"uipath",
|
|
54074
|
+
"identity",
|
|
54075
|
+
"sdk"
|
|
54076
|
+
],
|
|
54077
|
+
type: "module",
|
|
54078
|
+
main: "./dist/index.js",
|
|
54079
|
+
types: "./dist/src/index.d.ts",
|
|
54080
|
+
exports: {
|
|
54081
|
+
".": {
|
|
54082
|
+
types: "./dist/src/index.d.ts",
|
|
54083
|
+
default: "./dist/index.js"
|
|
54084
|
+
}
|
|
54085
|
+
},
|
|
54086
|
+
files: [
|
|
54087
|
+
"dist"
|
|
54088
|
+
],
|
|
54089
|
+
private: true,
|
|
54090
|
+
scripts: {
|
|
54091
|
+
build: "bun build ./src/index.ts --outdir dist --format esm --target node && tsc -p tsconfig.build.json --noCheck",
|
|
54092
|
+
generate: "bun run src/scripts/generate-sdk.ts",
|
|
54093
|
+
lint: "biome check .",
|
|
54094
|
+
test: "vitest run",
|
|
54095
|
+
"test:coverage": "vitest run --coverage"
|
|
54096
|
+
},
|
|
54097
|
+
devDependencies: {
|
|
54098
|
+
"@uipath/auth": "workspace:*",
|
|
54099
|
+
"@uipath/common": "workspace:*",
|
|
54100
|
+
"@uipath/filesystem": "workspace:*",
|
|
54101
|
+
"@openapitools/openapi-generator-cli": "^2.31.1",
|
|
54102
|
+
"@types/node": "^25.5.2",
|
|
54103
|
+
typescript: "^6.0.2"
|
|
54104
|
+
}
|
|
54105
|
+
};
|
|
54106
|
+
|
|
54107
|
+
// ../admin/identity-sdk/src/user-agent.ts
|
|
54108
|
+
var SDK_USER_AGENT = getSdkUserAgentToken(package_default2);
|
|
54109
|
+
installSdkUserAgentHeader(BaseAPI, SDK_USER_AGENT);
|
|
53608
54110
|
|
|
53609
54111
|
// ../admin/identity-sdk/generated/src/models/DirectoryEntityType.ts
|
|
53610
54112
|
function DirectoryEntityTypeFromJSON(json2) {
|
|
@@ -54185,19 +54687,23 @@ class DirectoryApi extends BaseAPI {
|
|
|
54185
54687
|
async function createIdentityConfig(options) {
|
|
54186
54688
|
const ctx = await getAuthContext({
|
|
54187
54689
|
ensureTokenValidityMinutes: options?.loginValidity,
|
|
54188
|
-
requireOrganizationId:
|
|
54690
|
+
requireOrganizationId: options?.organization === undefined,
|
|
54189
54691
|
requireTenantName: true
|
|
54190
54692
|
});
|
|
54191
|
-
const
|
|
54192
|
-
|
|
54693
|
+
const organizationId = options?.organization ?? ctx.organizationId;
|
|
54694
|
+
if (organizationId === undefined || organizationId.length === 0) {
|
|
54695
|
+
throw new Error("Organization ID not available. Provide --organization or log in with an organization context.");
|
|
54696
|
+
}
|
|
54697
|
+
const identityBasePath = `${ctx.baseUrl}/${organizationId}/identity_`;
|
|
54698
|
+
const headers = addSdkUserAgentHeader({
|
|
54193
54699
|
Authorization: `Bearer ${ctx.accessToken}`
|
|
54194
|
-
};
|
|
54700
|
+
}, SDK_USER_AGENT);
|
|
54195
54701
|
return {
|
|
54196
54702
|
config: new Configuration2({
|
|
54197
54703
|
basePath: identityBasePath,
|
|
54198
54704
|
headers
|
|
54199
54705
|
}),
|
|
54200
|
-
organizationId
|
|
54706
|
+
organizationId
|
|
54201
54707
|
};
|
|
54202
54708
|
}
|
|
54203
54709
|
async function createApiClient(ApiClass, options) {
|
package/package.json
CHANGED
|
@@ -1,34 +1,24 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"@types/node": "^25.5.2",
|
|
25
|
-
"typescript": "^6.0.2"
|
|
26
|
-
},
|
|
27
|
-
"keywords": [
|
|
28
|
-
"cli-tool"
|
|
29
|
-
],
|
|
30
|
-
"publishConfig": {
|
|
31
|
-
"registry": "https://registry.npmjs.org/"
|
|
32
|
-
},
|
|
33
|
-
"gitHead": "06e8c8f566df4b87da4a008635483c62f64f33f0"
|
|
2
|
+
"name": "@uipath/platform-tool",
|
|
3
|
+
"license": "MIT",
|
|
4
|
+
"version": "1.195.0",
|
|
5
|
+
"description": "Manage UiPath platform-level resources such as tenant licensing.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/tool.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./dist/tool.js"
|
|
10
|
+
},
|
|
11
|
+
"bin": {
|
|
12
|
+
"platform-tool": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"keywords": [
|
|
18
|
+
"cli-tool"
|
|
19
|
+
],
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"registry": "https://registry.npmjs.org/"
|
|
22
|
+
},
|
|
23
|
+
"gitHead": "65fabb84552758b2710d8ca68470e70a9b1d19bc"
|
|
34
24
|
}
|