@uipath/rpa-legacy-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 +558 -206
- package/package.json +31 -40
package/dist/tool.js
CHANGED
|
@@ -680,6 +680,7 @@ var init_open = __esm(() => {
|
|
|
680
680
|
});
|
|
681
681
|
|
|
682
682
|
// ../filesystem/src/node.ts
|
|
683
|
+
import { randomUUID } from "node:crypto";
|
|
683
684
|
import { existsSync } from "node:fs";
|
|
684
685
|
import * as fs6 from "node:fs/promises";
|
|
685
686
|
import * as os2 from "node:os";
|
|
@@ -761,6 +762,90 @@ class NodeFileSystem {
|
|
|
761
762
|
async mkdir(dirPath) {
|
|
762
763
|
await fs6.mkdir(dirPath, { recursive: true });
|
|
763
764
|
}
|
|
765
|
+
async acquireLock(lockPath) {
|
|
766
|
+
const canonicalPath = await this.canonicalizeLockTarget(lockPath);
|
|
767
|
+
const lockFile = `${canonicalPath}.lock`;
|
|
768
|
+
const ownerId = randomUUID();
|
|
769
|
+
const start = Date.now();
|
|
770
|
+
while (true) {
|
|
771
|
+
try {
|
|
772
|
+
await fs6.writeFile(lockFile, ownerId, { flag: "wx" });
|
|
773
|
+
return this.createLockRelease(lockFile, ownerId);
|
|
774
|
+
} catch (error) {
|
|
775
|
+
if (!this.hasErrnoCode(error, "EEXIST")) {
|
|
776
|
+
throw error;
|
|
777
|
+
}
|
|
778
|
+
const stats = await fs6.stat(lockFile).catch(() => null);
|
|
779
|
+
if (stats && Date.now() - stats.mtimeMs > LOCK_STALE_MS) {
|
|
780
|
+
const reclaimed = await fs6.rm(lockFile, { force: true }).then(() => true).catch(() => false);
|
|
781
|
+
if (reclaimed)
|
|
782
|
+
continue;
|
|
783
|
+
}
|
|
784
|
+
if (Date.now() - start > LOCK_MAX_WAIT_MS) {
|
|
785
|
+
throw new Error(`ELOCKED: timed out waiting for lock on ${canonicalPath}`);
|
|
786
|
+
}
|
|
787
|
+
await new Promise((resolve2) => setTimeout(resolve2, LOCK_RETRY_MIN_MS + Math.random() * LOCK_RETRY_JITTER_MS));
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
async canonicalizeLockTarget(lockPath) {
|
|
792
|
+
const absolute = path2.resolve(lockPath);
|
|
793
|
+
const fullReal = await fs6.realpath(absolute).catch(() => null);
|
|
794
|
+
if (fullReal)
|
|
795
|
+
return fullReal;
|
|
796
|
+
const parent = path2.dirname(absolute);
|
|
797
|
+
const base = path2.basename(absolute);
|
|
798
|
+
const canonicalParent = await fs6.realpath(parent).catch(() => parent);
|
|
799
|
+
return path2.join(canonicalParent, base);
|
|
800
|
+
}
|
|
801
|
+
createLockRelease(lockFile, ownerId) {
|
|
802
|
+
const heartbeatStart = Date.now();
|
|
803
|
+
let heartbeatTimer;
|
|
804
|
+
let stopped = false;
|
|
805
|
+
const stopHeartbeat = () => {
|
|
806
|
+
stopped = true;
|
|
807
|
+
if (heartbeatTimer)
|
|
808
|
+
clearTimeout(heartbeatTimer);
|
|
809
|
+
};
|
|
810
|
+
const scheduleNextHeartbeat = () => {
|
|
811
|
+
if (stopped)
|
|
812
|
+
return;
|
|
813
|
+
if (Date.now() - heartbeatStart >= LOCK_MAX_HOLD_MS) {
|
|
814
|
+
stopped = true;
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
heartbeatTimer = setTimeout(() => {
|
|
818
|
+
runHeartbeat();
|
|
819
|
+
}, LOCK_HEARTBEAT_MS);
|
|
820
|
+
heartbeatTimer.unref?.();
|
|
821
|
+
};
|
|
822
|
+
const runHeartbeat = async () => {
|
|
823
|
+
if (stopped)
|
|
824
|
+
return;
|
|
825
|
+
const current = await fs6.readFile(lockFile, "utf-8").catch(() => null);
|
|
826
|
+
if (stopped)
|
|
827
|
+
return;
|
|
828
|
+
if (current !== ownerId) {
|
|
829
|
+
stopped = true;
|
|
830
|
+
return;
|
|
831
|
+
}
|
|
832
|
+
const now = Date.now() / 1000;
|
|
833
|
+
await fs6.utimes(lockFile, now, now).catch(() => {});
|
|
834
|
+
scheduleNextHeartbeat();
|
|
835
|
+
};
|
|
836
|
+
scheduleNextHeartbeat();
|
|
837
|
+
let released = false;
|
|
838
|
+
return async () => {
|
|
839
|
+
if (released)
|
|
840
|
+
return;
|
|
841
|
+
released = true;
|
|
842
|
+
stopHeartbeat();
|
|
843
|
+
const current = await fs6.readFile(lockFile, "utf-8").catch(() => null);
|
|
844
|
+
if (current === ownerId) {
|
|
845
|
+
await fs6.rm(lockFile, { force: true });
|
|
846
|
+
}
|
|
847
|
+
};
|
|
848
|
+
}
|
|
764
849
|
async rm(filePath) {
|
|
765
850
|
await fs6.rm(filePath, { recursive: true, force: true });
|
|
766
851
|
}
|
|
@@ -806,9 +891,13 @@ class NodeFileSystem {
|
|
|
806
891
|
}
|
|
807
892
|
}
|
|
808
893
|
isEnoent(error) {
|
|
809
|
-
return
|
|
894
|
+
return this.hasErrnoCode(error, "ENOENT");
|
|
895
|
+
}
|
|
896
|
+
hasErrnoCode(error, code) {
|
|
897
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === code;
|
|
810
898
|
}
|
|
811
899
|
}
|
|
900
|
+
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;
|
|
812
901
|
var init_node = __esm(() => {
|
|
813
902
|
init_open();
|
|
814
903
|
});
|
|
@@ -5296,7 +5385,8 @@ var DEFAULT_CLIENT_ID = "36dea5b8-e8bb-423d-8e7b-c808df8f1c00", AUTH_FILE_CONFIG
|
|
|
5296
5385
|
if (!clientSecret && fileAuth.clientSecret) {
|
|
5297
5386
|
clientSecret = fileAuth.clientSecret;
|
|
5298
5387
|
}
|
|
5299
|
-
const
|
|
5388
|
+
const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && Boolean(clientSecret);
|
|
5389
|
+
const scopes = customScopes && customScopes.length > 0 ? customScopes : fileAuth.scopes && fileAuth.scopes.length > 0 ? fileAuth.scopes : isExternalAppAuth ? [] : DEFAULT_SCOPES;
|
|
5300
5390
|
return {
|
|
5301
5391
|
clientId,
|
|
5302
5392
|
clientSecret,
|
|
@@ -5327,32 +5417,7 @@ var init_config = __esm(() => {
|
|
|
5327
5417
|
this.name = "InvalidBaseUrlError";
|
|
5328
5418
|
}
|
|
5329
5419
|
};
|
|
5330
|
-
DEFAULT_SCOPES = [
|
|
5331
|
-
"offline_access",
|
|
5332
|
-
"ProcessMining",
|
|
5333
|
-
"OrchestratorApiUserAccess",
|
|
5334
|
-
"StudioWebBackend",
|
|
5335
|
-
"IdentityServerApi",
|
|
5336
|
-
"ConnectionService",
|
|
5337
|
-
"DataService",
|
|
5338
|
-
"DataServiceApiUserAccess",
|
|
5339
|
-
"DocumentUnderstanding",
|
|
5340
|
-
"EnterpriseContextService",
|
|
5341
|
-
"Directory",
|
|
5342
|
-
"JamJamApi",
|
|
5343
|
-
"LLMGateway",
|
|
5344
|
-
"LLMOps",
|
|
5345
|
-
"OMS",
|
|
5346
|
-
"RCS.FolderAuthorization",
|
|
5347
|
-
"RCS.TagsManagement",
|
|
5348
|
-
"TestmanagerApiUserAccess",
|
|
5349
|
-
"AutomationSolutions",
|
|
5350
|
-
"StudioWebTypeCacheService",
|
|
5351
|
-
"Docs.GPT.Search",
|
|
5352
|
-
"Insights",
|
|
5353
|
-
"ReferenceToken",
|
|
5354
|
-
"Audit.Read"
|
|
5355
|
-
];
|
|
5420
|
+
DEFAULT_SCOPES = ["openid", "profile", "offline_access"];
|
|
5356
5421
|
});
|
|
5357
5422
|
|
|
5358
5423
|
// ../../node_modules/oauth4webapi/build/index.js
|
|
@@ -6124,7 +6189,7 @@ var init_envAuth = __esm(() => {
|
|
|
6124
6189
|
|
|
6125
6190
|
// ../../node_modules/@uipath/coreipc/index.js
|
|
6126
6191
|
var require_coreipc = __commonJS((exports, module) => {
|
|
6127
|
-
var __dirname = "/
|
|
6192
|
+
var __dirname = "/home/runner/work/cli/cli/node_modules/@uipath/coreipc";
|
|
6128
6193
|
/*! For license information please see index.js.LICENSE.txt */
|
|
6129
6194
|
(function(e, t) {
|
|
6130
6195
|
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();
|
|
@@ -24662,6 +24727,129 @@ function normalizeTokenRefreshFailure() {
|
|
|
24662
24727
|
function normalizeTokenRefreshUnavailableFailure() {
|
|
24663
24728
|
return "token refresh failed before authentication completed";
|
|
24664
24729
|
}
|
|
24730
|
+
function errorMessage(error) {
|
|
24731
|
+
return error instanceof Error ? error.message : String(error);
|
|
24732
|
+
}
|
|
24733
|
+
function computeExpirationThreshold(ensureTokenValidityMinutes) {
|
|
24734
|
+
return new Date(Date.now() + (ensureTokenValidityMinutes ?? 0) * 60 * 1000);
|
|
24735
|
+
}
|
|
24736
|
+
async function runRefreshLocked(inputs) {
|
|
24737
|
+
const {
|
|
24738
|
+
absolutePath,
|
|
24739
|
+
refreshToken: callerRefreshToken,
|
|
24740
|
+
customAuthority,
|
|
24741
|
+
ensureTokenValidityMinutes,
|
|
24742
|
+
loadEnvFile,
|
|
24743
|
+
saveEnvFile,
|
|
24744
|
+
refreshFn,
|
|
24745
|
+
resolveConfig
|
|
24746
|
+
} = inputs;
|
|
24747
|
+
const expirationThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
|
|
24748
|
+
let fresh;
|
|
24749
|
+
try {
|
|
24750
|
+
fresh = await loadEnvFile({ envPath: absolutePath });
|
|
24751
|
+
} catch (error) {
|
|
24752
|
+
return {
|
|
24753
|
+
kind: "fail",
|
|
24754
|
+
status: {
|
|
24755
|
+
loginStatus: "Refresh Failed",
|
|
24756
|
+
hint: "Could not read the auth file while refreshing. Retry, or run 'uip login' to re-authenticate.",
|
|
24757
|
+
tokenRefresh: {
|
|
24758
|
+
attempted: false,
|
|
24759
|
+
success: false,
|
|
24760
|
+
errorMessage: `auth file read failed: ${errorMessage(error)}`
|
|
24761
|
+
}
|
|
24762
|
+
}
|
|
24763
|
+
};
|
|
24764
|
+
}
|
|
24765
|
+
const freshAccess = fresh.UIPATH_ACCESS_TOKEN;
|
|
24766
|
+
const freshExp = freshAccess ? getTokenExpiration(freshAccess) : undefined;
|
|
24767
|
+
if (freshAccess && freshExp && freshExp > expirationThreshold) {
|
|
24768
|
+
return {
|
|
24769
|
+
kind: "ok",
|
|
24770
|
+
accessToken: freshAccess,
|
|
24771
|
+
refreshToken: fresh.UIPATH_REFRESH_TOKEN ?? callerRefreshToken,
|
|
24772
|
+
expiration: freshExp,
|
|
24773
|
+
tokenRefresh: { attempted: false, success: true }
|
|
24774
|
+
};
|
|
24775
|
+
}
|
|
24776
|
+
const tokenForIdP = fresh.UIPATH_REFRESH_TOKEN ?? callerRefreshToken;
|
|
24777
|
+
let refreshedAccess;
|
|
24778
|
+
let refreshedRefresh;
|
|
24779
|
+
try {
|
|
24780
|
+
const config = await resolveConfig({ customAuthority });
|
|
24781
|
+
const refreshed = await refreshFn({
|
|
24782
|
+
refreshToken: tokenForIdP,
|
|
24783
|
+
tokenEndpoint: config.tokenEndpoint,
|
|
24784
|
+
clientId: config.clientId,
|
|
24785
|
+
expectedAuthority: customAuthority
|
|
24786
|
+
});
|
|
24787
|
+
refreshedAccess = refreshed.accessToken;
|
|
24788
|
+
refreshedRefresh = refreshed.refreshToken;
|
|
24789
|
+
} catch (error) {
|
|
24790
|
+
const isOAuthFailure = isTokenRefreshOAuthFailure(error);
|
|
24791
|
+
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.";
|
|
24792
|
+
const message = isOAuthFailure ? normalizeTokenRefreshFailure() : normalizeTokenRefreshUnavailableFailure();
|
|
24793
|
+
return {
|
|
24794
|
+
kind: "fail",
|
|
24795
|
+
status: {
|
|
24796
|
+
loginStatus: "Refresh Failed",
|
|
24797
|
+
hint,
|
|
24798
|
+
tokenRefresh: {
|
|
24799
|
+
attempted: true,
|
|
24800
|
+
success: false,
|
|
24801
|
+
errorMessage: message
|
|
24802
|
+
}
|
|
24803
|
+
}
|
|
24804
|
+
};
|
|
24805
|
+
}
|
|
24806
|
+
const refreshedExp = getTokenExpiration(refreshedAccess);
|
|
24807
|
+
if (!refreshedExp || refreshedExp <= new Date) {
|
|
24808
|
+
return {
|
|
24809
|
+
kind: "fail",
|
|
24810
|
+
status: {
|
|
24811
|
+
loginStatus: "Refresh Failed",
|
|
24812
|
+
hint: "The identity server returned an unusable token. Run 'uip login' to re-authenticate.",
|
|
24813
|
+
tokenRefresh: {
|
|
24814
|
+
attempted: true,
|
|
24815
|
+
success: false,
|
|
24816
|
+
errorMessage: "refreshed token has no valid expiration claim"
|
|
24817
|
+
}
|
|
24818
|
+
}
|
|
24819
|
+
};
|
|
24820
|
+
}
|
|
24821
|
+
try {
|
|
24822
|
+
await saveEnvFile({
|
|
24823
|
+
envPath: absolutePath,
|
|
24824
|
+
data: {
|
|
24825
|
+
UIPATH_ACCESS_TOKEN: refreshedAccess,
|
|
24826
|
+
UIPATH_REFRESH_TOKEN: refreshedRefresh
|
|
24827
|
+
},
|
|
24828
|
+
merge: true
|
|
24829
|
+
});
|
|
24830
|
+
return {
|
|
24831
|
+
kind: "ok",
|
|
24832
|
+
accessToken: refreshedAccess,
|
|
24833
|
+
refreshToken: refreshedRefresh,
|
|
24834
|
+
expiration: refreshedExp,
|
|
24835
|
+
tokenRefresh: { attempted: true, success: true }
|
|
24836
|
+
};
|
|
24837
|
+
} catch (error) {
|
|
24838
|
+
const msg = errorMessage(error);
|
|
24839
|
+
return {
|
|
24840
|
+
kind: "ok",
|
|
24841
|
+
accessToken: refreshedAccess,
|
|
24842
|
+
refreshToken: refreshedRefresh,
|
|
24843
|
+
expiration: refreshedExp,
|
|
24844
|
+
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.`,
|
|
24845
|
+
tokenRefresh: {
|
|
24846
|
+
attempted: true,
|
|
24847
|
+
success: true,
|
|
24848
|
+
errorMessage: `persistence failed: ${msg}`
|
|
24849
|
+
}
|
|
24850
|
+
};
|
|
24851
|
+
}
|
|
24852
|
+
}
|
|
24665
24853
|
var LoginStatusSource, getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
24666
24854
|
const {
|
|
24667
24855
|
resolveEnvFilePath = resolveEnvFilePathAsync,
|
|
@@ -24736,73 +24924,103 @@ var LoginStatusSource, getLoginStatusWithDeps = async (options = {}, deps = {})
|
|
|
24736
24924
|
let refreshToken = credentials.UIPATH_REFRESH_TOKEN;
|
|
24737
24925
|
let expiration = getTokenExpiration(accessToken);
|
|
24738
24926
|
let persistenceWarning;
|
|
24927
|
+
let lockReleaseFailed = false;
|
|
24739
24928
|
let tokenRefresh;
|
|
24740
|
-
const
|
|
24741
|
-
|
|
24742
|
-
|
|
24743
|
-
|
|
24929
|
+
const outerThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
|
|
24930
|
+
const tryGlobalCredsHint = async () => {
|
|
24931
|
+
const fs7 = getFs();
|
|
24932
|
+
const globalPath = fs7.path.join(fs7.env.homedir(), envFilePath);
|
|
24933
|
+
if (absolutePath === globalPath)
|
|
24934
|
+
return;
|
|
24935
|
+
if (!await fs7.exists(globalPath))
|
|
24936
|
+
return;
|
|
24744
24937
|
try {
|
|
24745
|
-
const
|
|
24746
|
-
|
|
24747
|
-
|
|
24748
|
-
const
|
|
24749
|
-
|
|
24750
|
-
|
|
24751
|
-
|
|
24752
|
-
|
|
24753
|
-
|
|
24754
|
-
refreshedAccess = refreshed.accessToken;
|
|
24755
|
-
refreshedRefresh = refreshed.refreshToken;
|
|
24756
|
-
} catch (error) {
|
|
24757
|
-
const isOAuthFailure = isTokenRefreshOAuthFailure(error);
|
|
24758
|
-
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.";
|
|
24759
|
-
const errorMessage = isOAuthFailure ? normalizeTokenRefreshFailure() : normalizeTokenRefreshUnavailableFailure();
|
|
24760
|
-
return {
|
|
24761
|
-
loginStatus: "Refresh Failed",
|
|
24762
|
-
hint,
|
|
24763
|
-
tokenRefresh: {
|
|
24764
|
-
attempted: true,
|
|
24765
|
-
success: false,
|
|
24766
|
-
errorMessage
|
|
24767
|
-
}
|
|
24768
|
-
};
|
|
24938
|
+
const globalCreds = await loadEnvFile({ envPath: globalPath });
|
|
24939
|
+
if (!globalCreds.UIPATH_ACCESS_TOKEN)
|
|
24940
|
+
return;
|
|
24941
|
+
const globalExp = getTokenExpiration(globalCreds.UIPATH_ACCESS_TOKEN);
|
|
24942
|
+
if (globalExp && globalExp <= new Date)
|
|
24943
|
+
return;
|
|
24944
|
+
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.`;
|
|
24945
|
+
} catch {
|
|
24946
|
+
return;
|
|
24769
24947
|
}
|
|
24770
|
-
|
|
24771
|
-
|
|
24948
|
+
};
|
|
24949
|
+
if (expiration && expiration <= outerThreshold && refreshToken) {
|
|
24950
|
+
let release;
|
|
24951
|
+
try {
|
|
24952
|
+
release = await getFs().acquireLock(absolutePath);
|
|
24953
|
+
} catch (error) {
|
|
24954
|
+
const msg = errorMessage(error);
|
|
24955
|
+
const globalHint = await tryGlobalCredsHint();
|
|
24956
|
+
if (globalHint) {
|
|
24957
|
+
return {
|
|
24958
|
+
loginStatus: "Expired",
|
|
24959
|
+
accessToken,
|
|
24960
|
+
refreshToken,
|
|
24961
|
+
baseUrl: credentials.UIPATH_URL,
|
|
24962
|
+
organizationName: credentials.UIPATH_ORGANIZATION_NAME,
|
|
24963
|
+
organizationId: credentials.UIPATH_ORGANIZATION_ID,
|
|
24964
|
+
tenantName: credentials.UIPATH_TENANT_NAME,
|
|
24965
|
+
tenantId: credentials.UIPATH_TENANT_ID,
|
|
24966
|
+
expiration,
|
|
24967
|
+
source: "file" /* File */,
|
|
24968
|
+
hint: globalHint,
|
|
24969
|
+
tokenRefresh: {
|
|
24970
|
+
attempted: false,
|
|
24971
|
+
success: false,
|
|
24972
|
+
errorMessage: `lock acquisition failed: ${msg}`
|
|
24973
|
+
}
|
|
24974
|
+
};
|
|
24975
|
+
}
|
|
24772
24976
|
return {
|
|
24773
24977
|
loginStatus: "Refresh Failed",
|
|
24774
|
-
hint: "
|
|
24978
|
+
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.",
|
|
24775
24979
|
tokenRefresh: {
|
|
24776
|
-
attempted:
|
|
24980
|
+
attempted: false,
|
|
24777
24981
|
success: false,
|
|
24778
|
-
errorMessage:
|
|
24982
|
+
errorMessage: `lock acquisition failed: ${msg}`
|
|
24779
24983
|
}
|
|
24780
24984
|
};
|
|
24781
24985
|
}
|
|
24782
|
-
|
|
24783
|
-
refreshToken = refreshedRefresh;
|
|
24784
|
-
expiration = refreshedExp;
|
|
24986
|
+
let lockedFailure;
|
|
24785
24987
|
try {
|
|
24786
|
-
await
|
|
24787
|
-
|
|
24788
|
-
|
|
24789
|
-
|
|
24790
|
-
|
|
24791
|
-
|
|
24792
|
-
|
|
24988
|
+
const outcome = await runRefreshLocked({
|
|
24989
|
+
absolutePath,
|
|
24990
|
+
refreshToken,
|
|
24991
|
+
customAuthority: credentials.UIPATH_URL,
|
|
24992
|
+
ensureTokenValidityMinutes,
|
|
24993
|
+
loadEnvFile,
|
|
24994
|
+
saveEnvFile,
|
|
24995
|
+
refreshFn: refreshTokenFn,
|
|
24996
|
+
resolveConfig
|
|
24793
24997
|
});
|
|
24794
|
-
|
|
24795
|
-
|
|
24796
|
-
|
|
24797
|
-
|
|
24798
|
-
|
|
24799
|
-
|
|
24800
|
-
|
|
24801
|
-
|
|
24802
|
-
|
|
24803
|
-
|
|
24804
|
-
|
|
24805
|
-
|
|
24998
|
+
if (outcome.kind === "fail") {
|
|
24999
|
+
lockedFailure = outcome.status;
|
|
25000
|
+
} else {
|
|
25001
|
+
accessToken = outcome.accessToken;
|
|
25002
|
+
refreshToken = outcome.refreshToken;
|
|
25003
|
+
expiration = outcome.expiration;
|
|
25004
|
+
tokenRefresh = outcome.tokenRefresh;
|
|
25005
|
+
if (outcome.persistenceWarning) {
|
|
25006
|
+
persistenceWarning = outcome.persistenceWarning;
|
|
25007
|
+
}
|
|
25008
|
+
}
|
|
25009
|
+
} finally {
|
|
25010
|
+
try {
|
|
25011
|
+
await release();
|
|
25012
|
+
} catch {
|
|
25013
|
+
lockReleaseFailed = true;
|
|
25014
|
+
}
|
|
25015
|
+
}
|
|
25016
|
+
if (lockedFailure) {
|
|
25017
|
+
const globalHint = await tryGlobalCredsHint();
|
|
25018
|
+
const base = globalHint ? {
|
|
25019
|
+
...lockedFailure,
|
|
25020
|
+
loginStatus: "Expired",
|
|
25021
|
+
hint: globalHint
|
|
25022
|
+
} : lockedFailure;
|
|
25023
|
+
return lockReleaseFailed ? { ...base, lockReleaseFailed: true } : base;
|
|
24806
25024
|
}
|
|
24807
25025
|
}
|
|
24808
25026
|
const result = {
|
|
@@ -24817,23 +25035,13 @@ var LoginStatusSource, getLoginStatusWithDeps = async (options = {}, deps = {})
|
|
|
24817
25035
|
expiration,
|
|
24818
25036
|
source: "file" /* File */,
|
|
24819
25037
|
...persistenceWarning ? { hint: persistenceWarning, persistenceFailed: true } : {},
|
|
25038
|
+
...lockReleaseFailed ? { lockReleaseFailed: true } : {},
|
|
24820
25039
|
...tokenRefresh ? { tokenRefresh } : {}
|
|
24821
25040
|
};
|
|
24822
25041
|
if (result.loginStatus === "Expired") {
|
|
24823
|
-
const
|
|
24824
|
-
|
|
24825
|
-
|
|
24826
|
-
try {
|
|
24827
|
-
const globalCreds = await loadEnvFile({
|
|
24828
|
-
envPath: globalPath
|
|
24829
|
-
});
|
|
24830
|
-
if (globalCreds.UIPATH_ACCESS_TOKEN) {
|
|
24831
|
-
const globalExp = getTokenExpiration(globalCreds.UIPATH_ACCESS_TOKEN);
|
|
24832
|
-
if (!globalExp || globalExp > new Date) {
|
|
24833
|
-
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.`;
|
|
24834
|
-
}
|
|
24835
|
-
}
|
|
24836
|
-
} catch {}
|
|
25042
|
+
const globalHint = await tryGlobalCredsHint();
|
|
25043
|
+
if (globalHint) {
|
|
25044
|
+
result.hint = globalHint;
|
|
24837
25045
|
}
|
|
24838
25046
|
}
|
|
24839
25047
|
return result;
|
|
@@ -24908,9 +25116,11 @@ var clientCredentialsLogin = async ({
|
|
|
24908
25116
|
const params = {
|
|
24909
25117
|
grant_type: "client_credentials",
|
|
24910
25118
|
client_id: config.clientId,
|
|
24911
|
-
client_secret: config.clientSecret ?? ""
|
|
24912
|
-
scope: config.scopes.join(" ")
|
|
25119
|
+
client_secret: config.clientSecret ?? ""
|
|
24913
25120
|
};
|
|
25121
|
+
if (config.scopes.length > 0) {
|
|
25122
|
+
params.scope = config.scopes.join(" ");
|
|
25123
|
+
}
|
|
24914
25124
|
const tokenResponse = await fetch(config.tokenEndpoint, {
|
|
24915
25125
|
method: "POST",
|
|
24916
25126
|
headers: {
|
|
@@ -25120,11 +25330,25 @@ var interactiveLoginWithDeps = async (options, deps) => {
|
|
|
25120
25330
|
searchDir = parentDir;
|
|
25121
25331
|
}
|
|
25122
25332
|
}
|
|
25123
|
-
|
|
25124
|
-
|
|
25125
|
-
|
|
25126
|
-
|
|
25127
|
-
|
|
25333
|
+
let saveRelease;
|
|
25334
|
+
try {
|
|
25335
|
+
if (typeof fs7.acquireLock === "function") {
|
|
25336
|
+
saveRelease = await fs7.acquireLock(savePath);
|
|
25337
|
+
}
|
|
25338
|
+
} catch {
|
|
25339
|
+
saveRelease = undefined;
|
|
25340
|
+
}
|
|
25341
|
+
try {
|
|
25342
|
+
await saveEnvFile({
|
|
25343
|
+
envPath: savePath,
|
|
25344
|
+
data: credentials,
|
|
25345
|
+
merge: true
|
|
25346
|
+
});
|
|
25347
|
+
} finally {
|
|
25348
|
+
if (saveRelease) {
|
|
25349
|
+
await saveRelease().catch(() => {});
|
|
25350
|
+
}
|
|
25351
|
+
}
|
|
25128
25352
|
const reportedPath = fs7.path.isAbsolute(savePath) ? savePath : fs7.path.join(fs7.env.homedir(), savePath);
|
|
25129
25353
|
emit({
|
|
25130
25354
|
type: "saved",
|
|
@@ -25154,7 +25378,21 @@ async function logoutWithDeps(options, deps = {}) {
|
|
|
25154
25378
|
const fs7 = getFs();
|
|
25155
25379
|
const { absolutePath } = await resolveEnvFilePath(options.file);
|
|
25156
25380
|
if (absolutePath && await fs7.exists(absolutePath)) {
|
|
25157
|
-
|
|
25381
|
+
let release;
|
|
25382
|
+
try {
|
|
25383
|
+
if (typeof fs7.acquireLock === "function") {
|
|
25384
|
+
release = await fs7.acquireLock(absolutePath);
|
|
25385
|
+
}
|
|
25386
|
+
} catch {
|
|
25387
|
+
release = undefined;
|
|
25388
|
+
}
|
|
25389
|
+
try {
|
|
25390
|
+
await fs7.rm(absolutePath);
|
|
25391
|
+
} finally {
|
|
25392
|
+
if (release) {
|
|
25393
|
+
await release().catch(() => {});
|
|
25394
|
+
}
|
|
25395
|
+
}
|
|
25158
25396
|
return {
|
|
25159
25397
|
success: true,
|
|
25160
25398
|
message: `Logged out successfully. Removed ${absolutePath}`,
|
|
@@ -25175,81 +25413,6 @@ var init_logout = __esm(() => {
|
|
|
25175
25413
|
init_envFile();
|
|
25176
25414
|
});
|
|
25177
25415
|
|
|
25178
|
-
// ../auth/src/strategies/browser-strategy.ts
|
|
25179
|
-
var exports_browser_strategy = {};
|
|
25180
|
-
__export(exports_browser_strategy, {
|
|
25181
|
-
BrowserAuthStrategy: () => BrowserAuthStrategy
|
|
25182
|
-
});
|
|
25183
|
-
|
|
25184
|
-
class BrowserAuthStrategy {
|
|
25185
|
-
async execute(url, _redirectUri, expectedState) {
|
|
25186
|
-
const global2 = getGlobalThis();
|
|
25187
|
-
if (!global2?.window) {
|
|
25188
|
-
throw new Error("Browser environment required for authentication");
|
|
25189
|
-
}
|
|
25190
|
-
const screenWidth = global2.window.screen?.width ?? 1024;
|
|
25191
|
-
const screenHeight = global2.window.screen?.height ?? 768;
|
|
25192
|
-
const width = 600;
|
|
25193
|
-
const height = 700;
|
|
25194
|
-
const left = screenWidth / 2 - width / 2;
|
|
25195
|
-
const top = screenHeight / 2 - height / 2;
|
|
25196
|
-
if (!global2.window.open) {
|
|
25197
|
-
throw new Error("window.open is not available");
|
|
25198
|
-
}
|
|
25199
|
-
const popupResult = global2.window.open(url, "uip_auth", `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes,status=yes`);
|
|
25200
|
-
const popup = popupResult;
|
|
25201
|
-
if (!popup) {
|
|
25202
|
-
throw new Error(`Authentication popup was blocked by your browser.
|
|
25203
|
-
|
|
25204
|
-
` + `To continue:
|
|
25205
|
-
` + `1. Look for a popup blocker icon in your address bar
|
|
25206
|
-
` + `2. Allow popups for this site
|
|
25207
|
-
` + `3. Try logging in again
|
|
25208
|
-
|
|
25209
|
-
` + "If using an ad blocker, you may need to temporarily disable it.");
|
|
25210
|
-
}
|
|
25211
|
-
return new Promise((resolve2, reject) => {
|
|
25212
|
-
const messageHandler = (event) => {
|
|
25213
|
-
if (event.data?.type === "UIP_AUTH_CODE" && event.data.code) {
|
|
25214
|
-
if (event.data.state !== expectedState) {
|
|
25215
|
-
cleanup();
|
|
25216
|
-
reject(new Error("OAuth state mismatch — the callback state does not match the expected value. " + "This may indicate a CSRF attack. Please try signing in again."));
|
|
25217
|
-
popup.close();
|
|
25218
|
-
return;
|
|
25219
|
-
}
|
|
25220
|
-
cleanup();
|
|
25221
|
-
resolve2(event.data.code);
|
|
25222
|
-
popup.close();
|
|
25223
|
-
} else if (event.data?.type === "UIP_AUTH_ERROR") {
|
|
25224
|
-
cleanup();
|
|
25225
|
-
const errorMsg = event.data.error || "Authentication failed";
|
|
25226
|
-
reject(new Error(`Authentication failed: ${errorMsg}
|
|
25227
|
-
|
|
25228
|
-
` + "Please check your credentials and try again. " + "If the problem persists, verify your UiPath account is active."));
|
|
25229
|
-
popup.close();
|
|
25230
|
-
}
|
|
25231
|
-
};
|
|
25232
|
-
const cleanup = () => {
|
|
25233
|
-
global2.window?.removeEventListener?.("message", messageHandler);
|
|
25234
|
-
if (timer)
|
|
25235
|
-
clearInterval(timer);
|
|
25236
|
-
};
|
|
25237
|
-
if (global2.window?.addEventListener) {
|
|
25238
|
-
global2.window.addEventListener("message", messageHandler);
|
|
25239
|
-
}
|
|
25240
|
-
const timer = setInterval(() => {
|
|
25241
|
-
if (popup.closed) {
|
|
25242
|
-
cleanup();
|
|
25243
|
-
reject(new Error(`Authentication was cancelled.
|
|
25244
|
-
|
|
25245
|
-
` + "The authentication popup was closed before completing the login process. " + "Please try again and complete the authentication flow."));
|
|
25246
|
-
}
|
|
25247
|
-
}, 1000);
|
|
25248
|
-
});
|
|
25249
|
-
}
|
|
25250
|
-
}
|
|
25251
|
-
var init_browser_strategy = () => {};
|
|
25252
|
-
|
|
25253
25416
|
// ../auth/src/getBaseHtml.ts
|
|
25254
25417
|
var getBaseHtml = ({ title, message, type: type2 }) => {
|
|
25255
25418
|
const icon = type2 === "success" ? "✓" : "✕";
|
|
@@ -25396,7 +25559,7 @@ var getBaseHtml = ({ title, message, type: type2 }) => {
|
|
|
25396
25559
|
};
|
|
25397
25560
|
|
|
25398
25561
|
// ../auth/src/server.ts
|
|
25399
|
-
var startServer = async ({
|
|
25562
|
+
var AUTH_TIMEOUT_ERROR_CODE = "EAUTHTIMEOUT", startServer = async ({
|
|
25400
25563
|
redirectUri,
|
|
25401
25564
|
timeoutMs = DEFAULT_AUTH_TIMEOUT_MS2,
|
|
25402
25565
|
onListening
|
|
@@ -25467,7 +25630,18 @@ var startServer = async ({
|
|
|
25467
25630
|
reject(new Error("No authorization code received"));
|
|
25468
25631
|
return;
|
|
25469
25632
|
});
|
|
25470
|
-
|
|
25633
|
+
const timeoutHandle = setTimeout(() => {
|
|
25634
|
+
server.close();
|
|
25635
|
+
const err = new Error("Authentication timeout");
|
|
25636
|
+
err.code = AUTH_TIMEOUT_ERROR_CODE;
|
|
25637
|
+
reject(err);
|
|
25638
|
+
}, timeoutMs);
|
|
25639
|
+
const bindHost = redirectUri.hostname === "localhost" ? "127.0.0.1" : redirectUri.hostname;
|
|
25640
|
+
server.on("error", (err) => {
|
|
25641
|
+
clearTimeout(timeoutHandle);
|
|
25642
|
+
reject(err);
|
|
25643
|
+
});
|
|
25644
|
+
server.listen(Number(redirectUri.port), bindHost, () => {
|
|
25471
25645
|
if (onListening) {
|
|
25472
25646
|
Promise.resolve(onListening()).catch((err) => {
|
|
25473
25647
|
server.close();
|
|
@@ -25476,10 +25650,6 @@ var startServer = async ({
|
|
|
25476
25650
|
});
|
|
25477
25651
|
}
|
|
25478
25652
|
});
|
|
25479
|
-
const timeoutHandle = setTimeout(() => {
|
|
25480
|
-
server.close();
|
|
25481
|
-
reject(new Error("Authentication timeout"));
|
|
25482
|
-
}, timeoutMs);
|
|
25483
25653
|
server.on("close", () => {
|
|
25484
25654
|
clearTimeout(timeoutHandle);
|
|
25485
25655
|
});
|
|
@@ -25489,6 +25659,81 @@ var init_server = __esm(() => {
|
|
|
25489
25659
|
init_constants();
|
|
25490
25660
|
});
|
|
25491
25661
|
|
|
25662
|
+
// ../auth/src/strategies/browser-strategy.ts
|
|
25663
|
+
var exports_browser_strategy = {};
|
|
25664
|
+
__export(exports_browser_strategy, {
|
|
25665
|
+
BrowserAuthStrategy: () => BrowserAuthStrategy
|
|
25666
|
+
});
|
|
25667
|
+
|
|
25668
|
+
class BrowserAuthStrategy {
|
|
25669
|
+
async execute(url, _redirectUri, expectedState) {
|
|
25670
|
+
const global2 = getGlobalThis();
|
|
25671
|
+
if (!global2?.window) {
|
|
25672
|
+
throw new Error("Browser environment required for authentication");
|
|
25673
|
+
}
|
|
25674
|
+
const screenWidth = global2.window.screen?.width ?? 1024;
|
|
25675
|
+
const screenHeight = global2.window.screen?.height ?? 768;
|
|
25676
|
+
const width = 600;
|
|
25677
|
+
const height = 700;
|
|
25678
|
+
const left = screenWidth / 2 - width / 2;
|
|
25679
|
+
const top = screenHeight / 2 - height / 2;
|
|
25680
|
+
if (!global2.window.open) {
|
|
25681
|
+
throw new Error("window.open is not available");
|
|
25682
|
+
}
|
|
25683
|
+
const popupResult = global2.window.open(url, "uip_auth", `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes,status=yes`);
|
|
25684
|
+
const popup = popupResult;
|
|
25685
|
+
if (!popup) {
|
|
25686
|
+
throw new Error(`Authentication popup was blocked by your browser.
|
|
25687
|
+
|
|
25688
|
+
` + `To continue:
|
|
25689
|
+
` + `1. Look for a popup blocker icon in your address bar
|
|
25690
|
+
` + `2. Allow popups for this site
|
|
25691
|
+
` + `3. Try logging in again
|
|
25692
|
+
|
|
25693
|
+
` + "If using an ad blocker, you may need to temporarily disable it.");
|
|
25694
|
+
}
|
|
25695
|
+
return new Promise((resolve2, reject) => {
|
|
25696
|
+
const messageHandler = (event) => {
|
|
25697
|
+
if (event.data?.type === "UIP_AUTH_CODE" && event.data.code) {
|
|
25698
|
+
if (event.data.state !== expectedState) {
|
|
25699
|
+
cleanup();
|
|
25700
|
+
reject(new Error("OAuth state mismatch — the callback state does not match the expected value. " + "This may indicate a CSRF attack. Please try signing in again."));
|
|
25701
|
+
popup.close();
|
|
25702
|
+
return;
|
|
25703
|
+
}
|
|
25704
|
+
cleanup();
|
|
25705
|
+
resolve2(event.data.code);
|
|
25706
|
+
popup.close();
|
|
25707
|
+
} else if (event.data?.type === "UIP_AUTH_ERROR") {
|
|
25708
|
+
cleanup();
|
|
25709
|
+
const errorMsg = event.data.error || "Authentication failed";
|
|
25710
|
+
reject(new Error(`Authentication failed: ${errorMsg}
|
|
25711
|
+
|
|
25712
|
+
` + "Please check your credentials and try again. " + "If the problem persists, verify your UiPath account is active."));
|
|
25713
|
+
popup.close();
|
|
25714
|
+
}
|
|
25715
|
+
};
|
|
25716
|
+
const cleanup = () => {
|
|
25717
|
+
global2.window?.removeEventListener?.("message", messageHandler);
|
|
25718
|
+
if (timer)
|
|
25719
|
+
clearInterval(timer);
|
|
25720
|
+
};
|
|
25721
|
+
if (global2.window?.addEventListener) {
|
|
25722
|
+
global2.window.addEventListener("message", messageHandler);
|
|
25723
|
+
}
|
|
25724
|
+
const timer = setInterval(() => {
|
|
25725
|
+
if (popup.closed) {
|
|
25726
|
+
cleanup();
|
|
25727
|
+
reject(new Error(`Authentication was cancelled.
|
|
25728
|
+
|
|
25729
|
+
` + "The authentication popup was closed before completing the login process. " + "Please try again and complete the authentication flow."));
|
|
25730
|
+
}
|
|
25731
|
+
}, 1000);
|
|
25732
|
+
});
|
|
25733
|
+
}
|
|
25734
|
+
}
|
|
25735
|
+
var init_browser_strategy = () => {};
|
|
25736
|
+
|
|
25492
25737
|
// ../auth/src/strategies/node-strategy.ts
|
|
25493
25738
|
var exports_node_strategy = {};
|
|
25494
25739
|
__export(exports_node_strategy, {
|
|
@@ -25575,7 +25820,8 @@ __export(exports_src, {
|
|
|
25575
25820
|
ENV_AUTH_ENABLE_VAR: () => ENV_AUTH_ENABLE_VAR,
|
|
25576
25821
|
ENFORCE_ROBOT_AUTH_VAR: () => ENFORCE_ROBOT_AUTH_VAR,
|
|
25577
25822
|
DEFAULT_ENV_FILENAME: () => DEFAULT_ENV_FILENAME,
|
|
25578
|
-
DEFAULT_AUTH_FILENAME: () => DEFAULT_AUTH_FILENAME
|
|
25823
|
+
DEFAULT_AUTH_FILENAME: () => DEFAULT_AUTH_FILENAME,
|
|
25824
|
+
AUTH_TIMEOUT_ERROR_CODE: () => AUTH_TIMEOUT_ERROR_CODE
|
|
25579
25825
|
});
|
|
25580
25826
|
var authenticate = async ({
|
|
25581
25827
|
baseUrl,
|
|
@@ -25650,6 +25896,7 @@ var init_src2 = __esm(() => {
|
|
|
25650
25896
|
init_config();
|
|
25651
25897
|
init_envAuth();
|
|
25652
25898
|
init_selectTenant();
|
|
25899
|
+
init_server();
|
|
25653
25900
|
init_envFile();
|
|
25654
25901
|
init_jwt();
|
|
25655
25902
|
init_authContext();
|
|
@@ -25662,7 +25909,8 @@ var init_src2 = __esm(() => {
|
|
|
25662
25909
|
// package.json
|
|
25663
25910
|
var package_default = {
|
|
25664
25911
|
name: "@uipath/rpa-legacy-tool",
|
|
25665
|
-
|
|
25912
|
+
license: "MIT",
|
|
25913
|
+
version: "1.195.0",
|
|
25666
25914
|
description: "uipcli plugin for validating, analyzing and building RPA projects using the legacy UiPath CLI",
|
|
25667
25915
|
private: false,
|
|
25668
25916
|
maintainers: [
|
|
@@ -30881,6 +31129,60 @@ function escapeNonAscii(jsonText) {
|
|
|
30881
31129
|
function needsAsciiSafeJson(sink) {
|
|
30882
31130
|
return process.platform === "win32" && !sink.capabilities.isInteractive;
|
|
30883
31131
|
}
|
|
31132
|
+
function isPlainRecord(value) {
|
|
31133
|
+
if (value === null || typeof value !== "object")
|
|
31134
|
+
return false;
|
|
31135
|
+
const prototype = Object.getPrototypeOf(value);
|
|
31136
|
+
return prototype === Object.prototype || prototype === null;
|
|
31137
|
+
}
|
|
31138
|
+
function toLowerCamelCaseKey(key) {
|
|
31139
|
+
if (!key)
|
|
31140
|
+
return key;
|
|
31141
|
+
if (/[_\-\s]/.test(key)) {
|
|
31142
|
+
const [firstPart, ...restParts] = key.split(/[_\-\s]+/).filter(Boolean);
|
|
31143
|
+
if (!firstPart)
|
|
31144
|
+
return key;
|
|
31145
|
+
return [
|
|
31146
|
+
toLowerCamelCaseSimpleKey(firstPart),
|
|
31147
|
+
...restParts.map((part) => {
|
|
31148
|
+
const normalized = toLowerCamelCaseSimpleKey(part);
|
|
31149
|
+
return normalized.charAt(0).toUpperCase() + normalized.slice(1);
|
|
31150
|
+
})
|
|
31151
|
+
].join("");
|
|
31152
|
+
}
|
|
31153
|
+
return toLowerCamelCaseSimpleKey(key);
|
|
31154
|
+
}
|
|
31155
|
+
function toLowerCamelCaseSimpleKey(key) {
|
|
31156
|
+
if (/^[A-Z0-9]+$/.test(key))
|
|
31157
|
+
return key.toLowerCase();
|
|
31158
|
+
return key.replace(/^[A-Z]+(?=[A-Z][a-z]|\d|$)|^[A-Z]/, (match) => match.toLowerCase());
|
|
31159
|
+
}
|
|
31160
|
+
function toPascalCaseKey(key) {
|
|
31161
|
+
const lowerCamelKey = toLowerCamelCaseKey(key);
|
|
31162
|
+
return lowerCamelKey ? lowerCamelKey.charAt(0).toUpperCase() + lowerCamelKey.slice(1) : lowerCamelKey;
|
|
31163
|
+
}
|
|
31164
|
+
function toPascalCaseData(value) {
|
|
31165
|
+
if (Array.isArray(value))
|
|
31166
|
+
return value.map(toPascalCaseData);
|
|
31167
|
+
if (!isPlainRecord(value))
|
|
31168
|
+
return value;
|
|
31169
|
+
const result = {};
|
|
31170
|
+
for (const [key, nestedValue] of Object.entries(value)) {
|
|
31171
|
+
result[toPascalCaseKey(key)] = toPascalCaseData(nestedValue);
|
|
31172
|
+
}
|
|
31173
|
+
return result;
|
|
31174
|
+
}
|
|
31175
|
+
function normalizeDataKeys(data) {
|
|
31176
|
+
return toPascalCaseData(data);
|
|
31177
|
+
}
|
|
31178
|
+
function normalizeOutputKeys(data) {
|
|
31179
|
+
const result = {};
|
|
31180
|
+
for (const [key, value] of Object.entries(data)) {
|
|
31181
|
+
const pascalKey = toPascalCaseKey(key);
|
|
31182
|
+
result[pascalKey] = pascalKey === "Data" ? value : toPascalCaseData(value);
|
|
31183
|
+
}
|
|
31184
|
+
return result;
|
|
31185
|
+
}
|
|
30884
31186
|
function printOutput(data, format = "json", logFn, asciiSafe = false) {
|
|
30885
31187
|
if (!data) {
|
|
30886
31188
|
logFn("Empty response object. No data to display.");
|
|
@@ -30943,7 +31245,7 @@ function wrapText(text, width) {
|
|
|
30943
31245
|
function printTable(data, logFn, externalLogValue) {
|
|
30944
31246
|
if (data.length === 0)
|
|
30945
31247
|
return;
|
|
30946
|
-
const keys = Object.keys(data[0]).filter((key) =>
|
|
31248
|
+
const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
|
|
30947
31249
|
const maxWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
|
|
30948
31250
|
const header = keys.map((key, i2) => key.padEnd(maxWidths[i2])).join(" | ");
|
|
30949
31251
|
logFn(header);
|
|
@@ -30958,7 +31260,7 @@ function printTable(data, logFn, externalLogValue) {
|
|
|
30958
31260
|
}
|
|
30959
31261
|
}
|
|
30960
31262
|
function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
30961
|
-
const keys = Object.keys(data).filter((key) =>
|
|
31263
|
+
const keys = Object.keys(data).filter((key) => !["code", "log"].includes(key.toLowerCase()));
|
|
30962
31264
|
if (keys.length === 0)
|
|
30963
31265
|
return;
|
|
30964
31266
|
const maxKeyWidth = Math.max(...keys.map((key) => key.length));
|
|
@@ -30974,7 +31276,7 @@ function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
|
30974
31276
|
function printResizableTable(data, logFn = console.log, externalLogValue) {
|
|
30975
31277
|
if (data.length === 0)
|
|
30976
31278
|
return;
|
|
30977
|
-
const keys = Object.keys(data[0]).filter((key) =>
|
|
31279
|
+
const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
|
|
30978
31280
|
if (keys.length === 0)
|
|
30979
31281
|
return;
|
|
30980
31282
|
if (!process.stdout.isTTY) {
|
|
@@ -31050,8 +31352,26 @@ function printResizableTable(data, logFn = console.log, externalLogValue) {
|
|
|
31050
31352
|
function toYaml(data) {
|
|
31051
31353
|
return dump(data);
|
|
31052
31354
|
}
|
|
31355
|
+
class FilterEvaluationError extends Error {
|
|
31356
|
+
__brand = "FilterEvaluationError";
|
|
31357
|
+
filter;
|
|
31358
|
+
instructions;
|
|
31359
|
+
result = RESULTS.ValidationError;
|
|
31360
|
+
constructor(filter, cause) {
|
|
31361
|
+
const underlying = cause instanceof Error ? cause.message : String(cause);
|
|
31362
|
+
super(`Filter '${filter}' failed to evaluate: ${underlying}`);
|
|
31363
|
+
this.name = "FilterEvaluationError";
|
|
31364
|
+
this.filter = filter;
|
|
31365
|
+
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(@)'.";
|
|
31366
|
+
}
|
|
31367
|
+
}
|
|
31053
31368
|
function applyFilter(data, filter) {
|
|
31054
|
-
|
|
31369
|
+
let result;
|
|
31370
|
+
try {
|
|
31371
|
+
result = search(data, filter);
|
|
31372
|
+
} catch (err) {
|
|
31373
|
+
throw new FilterEvaluationError(filter, err);
|
|
31374
|
+
}
|
|
31055
31375
|
if (result == null)
|
|
31056
31376
|
return [];
|
|
31057
31377
|
if (Array.isArray(result)) {
|
|
@@ -31068,13 +31388,18 @@ function applyFilter(data, filter) {
|
|
|
31068
31388
|
}
|
|
31069
31389
|
var OutputFormatter;
|
|
31070
31390
|
((OutputFormatter) => {
|
|
31071
|
-
function success(data) {
|
|
31391
|
+
function success(data, options) {
|
|
31072
31392
|
data.Log ??= getLogFilePath() || undefined;
|
|
31393
|
+
const normalize = !options?.preserveDataKeys;
|
|
31394
|
+
if (normalize) {
|
|
31395
|
+
data.Data = normalizeDataKeys(data.Data);
|
|
31396
|
+
}
|
|
31073
31397
|
const filter = getOutputFilter();
|
|
31074
31398
|
if (filter) {
|
|
31075
|
-
|
|
31399
|
+
const filtered = applyFilter(data.Data, filter);
|
|
31400
|
+
data.Data = normalize ? normalizeDataKeys(filtered) : filtered;
|
|
31076
31401
|
}
|
|
31077
|
-
logOutput(data, getOutputFormat());
|
|
31402
|
+
logOutput(normalizeOutputKeys(data), getOutputFormat());
|
|
31078
31403
|
}
|
|
31079
31404
|
OutputFormatter.success = success;
|
|
31080
31405
|
function error(data) {
|
|
@@ -31084,7 +31409,7 @@ var OutputFormatter;
|
|
|
31084
31409
|
result: data.Result,
|
|
31085
31410
|
message: data.Message
|
|
31086
31411
|
});
|
|
31087
|
-
logOutput(data, getOutputFormat());
|
|
31412
|
+
logOutput(normalizeOutputKeys(data), getOutputFormat());
|
|
31088
31413
|
}
|
|
31089
31414
|
OutputFormatter.error = error;
|
|
31090
31415
|
function emitList(code, items, opts) {
|
|
@@ -31105,13 +31430,14 @@ var OutputFormatter;
|
|
|
31105
31430
|
function log(data) {
|
|
31106
31431
|
const format = getOutputFormat();
|
|
31107
31432
|
const sink = getOutputSink();
|
|
31433
|
+
const normalized = toPascalCaseData(data);
|
|
31108
31434
|
if (format === "json") {
|
|
31109
|
-
const json2 = JSON.stringify(
|
|
31435
|
+
const json2 = JSON.stringify(normalized);
|
|
31110
31436
|
const safe = needsAsciiSafeJson(sink) ? escapeNonAscii(json2) : json2;
|
|
31111
31437
|
sink.writeErr(`${safe}
|
|
31112
31438
|
`);
|
|
31113
31439
|
} else {
|
|
31114
|
-
for (const [key, value] of Object.entries(
|
|
31440
|
+
for (const [key, value] of Object.entries(normalized)) {
|
|
31115
31441
|
sink.writeErr(`${key}: ${value}
|
|
31116
31442
|
`);
|
|
31117
31443
|
}
|
|
@@ -31120,12 +31446,16 @@ var OutputFormatter;
|
|
|
31120
31446
|
OutputFormatter.log = log;
|
|
31121
31447
|
function formatToString(data) {
|
|
31122
31448
|
const filter = getOutputFilter();
|
|
31123
|
-
if (
|
|
31124
|
-
data.Data =
|
|
31449
|
+
if ("Data" in data && data.Data != null) {
|
|
31450
|
+
data.Data = normalizeDataKeys(data.Data);
|
|
31451
|
+
if (filter) {
|
|
31452
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter));
|
|
31453
|
+
}
|
|
31125
31454
|
}
|
|
31455
|
+
const output = normalizeOutputKeys(data);
|
|
31126
31456
|
const lines = [];
|
|
31127
31457
|
const sink = getOutputSink();
|
|
31128
|
-
printOutput(
|
|
31458
|
+
printOutput(output, getOutputFormat(), (msg) => {
|
|
31129
31459
|
lines.push(msg);
|
|
31130
31460
|
}, needsAsciiSafeJson(sink));
|
|
31131
31461
|
return lines.join(`
|
|
@@ -32536,6 +32866,22 @@ JSONPath.prototype.safeVm = {
|
|
|
32536
32866
|
Script: SafeScript
|
|
32537
32867
|
};
|
|
32538
32868
|
JSONPath.prototype.vm = vm;
|
|
32869
|
+
// ../common/src/polling/types.ts
|
|
32870
|
+
var PollOutcome = {
|
|
32871
|
+
Completed: "completed",
|
|
32872
|
+
Timeout: "timeout",
|
|
32873
|
+
Interrupted: "interrupted",
|
|
32874
|
+
Aborted: "aborted",
|
|
32875
|
+
Failed: "failed"
|
|
32876
|
+
};
|
|
32877
|
+
|
|
32878
|
+
// ../common/src/polling/poll-failure-mapping.ts
|
|
32879
|
+
var REASON_BY_OUTCOME = {
|
|
32880
|
+
[PollOutcome.Timeout]: "poll_timeout",
|
|
32881
|
+
[PollOutcome.Failed]: "poll_failed",
|
|
32882
|
+
[PollOutcome.Interrupted]: "poll_failed",
|
|
32883
|
+
[PollOutcome.Aborted]: "poll_aborted"
|
|
32884
|
+
};
|
|
32539
32885
|
// ../common/src/polling/terminal-statuses.ts
|
|
32540
32886
|
var TERMINAL_STATUSES = new Set([
|
|
32541
32887
|
"completed",
|
|
@@ -32563,6 +32909,8 @@ var ScreenLogger;
|
|
|
32563
32909
|
}
|
|
32564
32910
|
ScreenLogger.progress = progress;
|
|
32565
32911
|
})(ScreenLogger ||= {});
|
|
32912
|
+
// ../common/src/sdk-user-agent.ts
|
|
32913
|
+
var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
|
|
32566
32914
|
// ../common/src/tool-provider.ts
|
|
32567
32915
|
var factorySlot = singleton("PackagerFactoryProvider");
|
|
32568
32916
|
// ../common/src/telemetry/pii-redactor.ts
|
|
@@ -32745,13 +33093,17 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
32745
33093
|
const [error] = await catchError(fn(...args));
|
|
32746
33094
|
if (error) {
|
|
32747
33095
|
errorMessage = error instanceof Error ? error.message : String(error);
|
|
32748
|
-
logger.
|
|
33096
|
+
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
33097
|
+
const typed = error;
|
|
33098
|
+
const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
|
|
33099
|
+
const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
|
|
33100
|
+
const finalResult = customResult ?? RESULTS.Failure;
|
|
32749
33101
|
OutputFormatter.error({
|
|
32750
|
-
Result:
|
|
33102
|
+
Result: finalResult,
|
|
32751
33103
|
Message: errorMessage,
|
|
32752
|
-
Instructions: "An unexpected error occurred. Run with --log-level debug for details."
|
|
33104
|
+
Instructions: customInstructions ?? "An unexpected error occurred. Run with --log-level debug for details."
|
|
32753
33105
|
});
|
|
32754
|
-
context.exit(
|
|
33106
|
+
context.exit(EXIT_CODES[finalResult]);
|
|
32755
33107
|
}
|
|
32756
33108
|
const durationMs = performance.now() - startTime;
|
|
32757
33109
|
const success = !error && (process.exitCode === undefined || process.exitCode === 0);
|
package/package.json
CHANGED
|
@@ -1,42 +1,33 @@
|
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"@uipath/auth": "1.1.0",
|
|
34
|
-
"@uipath/common": "1.1.0",
|
|
35
|
-
"@uipath/filesystem": "1.1.0",
|
|
36
|
-
"adm-zip": "^0.5.16",
|
|
37
|
-
"@types/adm-zip": "^0.5.7",
|
|
38
|
-
"@types/bun": "^1.3.11",
|
|
39
|
-
"typescript": "^6.0.2"
|
|
40
|
-
},
|
|
41
|
-
"gitHead": "06e8c8f566df4b87da4a008635483c62f64f33f0"
|
|
2
|
+
"name": "@uipath/rpa-legacy-tool",
|
|
3
|
+
"license": "MIT",
|
|
4
|
+
"version": "1.195.0",
|
|
5
|
+
"description": "uipcli plugin for validating, analyzing and building RPA projects using the legacy UiPath CLI",
|
|
6
|
+
"private": false,
|
|
7
|
+
"maintainers": [
|
|
8
|
+
"alexandru.roman"
|
|
9
|
+
],
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/UiPath/cli.git",
|
|
13
|
+
"directory": "packages/rpa-legacy-tool"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"registry": "https://registry.npmjs.org/"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"uipcli-tool"
|
|
20
|
+
],
|
|
21
|
+
"type": "module",
|
|
22
|
+
"main": "./dist/tool.js",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": "./dist/tool.js"
|
|
25
|
+
},
|
|
26
|
+
"bin": {
|
|
27
|
+
"rpa-legacy-tool": "./dist/index.js"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
32
|
+
"gitHead": "65fabb84552758b2710d8ca68470e70a9b1d19bc"
|
|
42
33
|
}
|