@uipath/gov-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.
Files changed (2) hide show
  1. package/dist/tool.js +1301 -305
  2. package/package.json +25 -31
package/dist/tool.js CHANGED
@@ -2156,6 +2156,7 @@ import path from "node:path";
2156
2156
  import { fileURLToPath } from "node:url";
2157
2157
  import childProcess3 from "node:child_process";
2158
2158
  import fs5, { constants as fsConstants2 } from "node:fs/promises";
2159
+ import { randomUUID } from "node:crypto";
2159
2160
  import { existsSync } from "node:fs";
2160
2161
  import * as fs6 from "node:fs/promises";
2161
2162
  import * as os2 from "node:os";
@@ -2928,6 +2929,90 @@ class NodeFileSystem {
2928
2929
  async mkdir(dirPath) {
2929
2930
  await fs6.mkdir(dirPath, { recursive: true });
2930
2931
  }
2932
+ async acquireLock(lockPath) {
2933
+ const canonicalPath = await this.canonicalizeLockTarget(lockPath);
2934
+ const lockFile = `${canonicalPath}.lock`;
2935
+ const ownerId = randomUUID();
2936
+ const start = Date.now();
2937
+ while (true) {
2938
+ try {
2939
+ await fs6.writeFile(lockFile, ownerId, { flag: "wx" });
2940
+ return this.createLockRelease(lockFile, ownerId);
2941
+ } catch (error) {
2942
+ if (!this.hasErrnoCode(error, "EEXIST")) {
2943
+ throw error;
2944
+ }
2945
+ const stats = await fs6.stat(lockFile).catch(() => null);
2946
+ if (stats && Date.now() - stats.mtimeMs > LOCK_STALE_MS) {
2947
+ const reclaimed = await fs6.rm(lockFile, { force: true }).then(() => true).catch(() => false);
2948
+ if (reclaimed)
2949
+ continue;
2950
+ }
2951
+ if (Date.now() - start > LOCK_MAX_WAIT_MS) {
2952
+ throw new Error(`ELOCKED: timed out waiting for lock on ${canonicalPath}`);
2953
+ }
2954
+ await new Promise((resolve2) => setTimeout(resolve2, LOCK_RETRY_MIN_MS + Math.random() * LOCK_RETRY_JITTER_MS));
2955
+ }
2956
+ }
2957
+ }
2958
+ async canonicalizeLockTarget(lockPath) {
2959
+ const absolute = path2.resolve(lockPath);
2960
+ const fullReal = await fs6.realpath(absolute).catch(() => null);
2961
+ if (fullReal)
2962
+ return fullReal;
2963
+ const parent = path2.dirname(absolute);
2964
+ const base = path2.basename(absolute);
2965
+ const canonicalParent = await fs6.realpath(parent).catch(() => parent);
2966
+ return path2.join(canonicalParent, base);
2967
+ }
2968
+ createLockRelease(lockFile, ownerId) {
2969
+ const heartbeatStart = Date.now();
2970
+ let heartbeatTimer;
2971
+ let stopped = false;
2972
+ const stopHeartbeat = () => {
2973
+ stopped = true;
2974
+ if (heartbeatTimer)
2975
+ clearTimeout(heartbeatTimer);
2976
+ };
2977
+ const scheduleNextHeartbeat = () => {
2978
+ if (stopped)
2979
+ return;
2980
+ if (Date.now() - heartbeatStart >= LOCK_MAX_HOLD_MS) {
2981
+ stopped = true;
2982
+ return;
2983
+ }
2984
+ heartbeatTimer = setTimeout(() => {
2985
+ runHeartbeat();
2986
+ }, LOCK_HEARTBEAT_MS);
2987
+ heartbeatTimer.unref?.();
2988
+ };
2989
+ const runHeartbeat = async () => {
2990
+ if (stopped)
2991
+ return;
2992
+ const current = await fs6.readFile(lockFile, "utf-8").catch(() => null);
2993
+ if (stopped)
2994
+ return;
2995
+ if (current !== ownerId) {
2996
+ stopped = true;
2997
+ return;
2998
+ }
2999
+ const now = Date.now() / 1000;
3000
+ await fs6.utimes(lockFile, now, now).catch(() => {});
3001
+ scheduleNextHeartbeat();
3002
+ };
3003
+ scheduleNextHeartbeat();
3004
+ let released = false;
3005
+ return async () => {
3006
+ if (released)
3007
+ return;
3008
+ released = true;
3009
+ stopHeartbeat();
3010
+ const current = await fs6.readFile(lockFile, "utf-8").catch(() => null);
3011
+ if (current === ownerId) {
3012
+ await fs6.rm(lockFile, { force: true });
3013
+ }
3014
+ };
3015
+ }
2931
3016
  async rm(filePath) {
2932
3017
  await fs6.rm(filePath, { recursive: true, force: true });
2933
3018
  }
@@ -2973,9 +3058,18 @@ class NodeFileSystem {
2973
3058
  }
2974
3059
  }
2975
3060
  isEnoent(error) {
2976
- return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
3061
+ return this.hasErrnoCode(error, "ENOENT");
3062
+ }
3063
+ hasErrnoCode(error, code) {
3064
+ return typeof error === "object" && error !== null && "code" in error && error.code === code;
2977
3065
  }
2978
3066
  }
3067
+ var LOCK_HEARTBEAT_MS = 5000;
3068
+ var LOCK_STALE_MS = 15000;
3069
+ var LOCK_MAX_WAIT_MS = 20000;
3070
+ var LOCK_MAX_HOLD_MS = 60000;
3071
+ var LOCK_RETRY_MIN_MS = 100;
3072
+ var LOCK_RETRY_JITTER_MS = 200;
2979
3073
  var init_node = __esm(() => {
2980
3074
  init_open();
2981
3075
  });
@@ -2987,7 +3081,7 @@ var init_src = __esm(() => {
2987
3081
  fsInstance = new NodeFileSystem;
2988
3082
  });
2989
3083
  var require_coreipc = __commonJS2((exports, module) => {
2990
- var __dirname3 = "/Users/alexandru.oltean/github/cli/node_modules/@uipath/coreipc";
3084
+ var __dirname3 = "/home/runner/work/cli/cli/node_modules/@uipath/coreipc";
2991
3085
  /*! For license information please see index.js.LICENSE.txt */
2992
3086
  (function(e, t) {
2993
3087
  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();
@@ -20787,9 +20881,13 @@ var require_dist = __commonJS2((exports) => {
20787
20881
  exports.RobotProxyConstructor = RobotProxyConstructor;
20788
20882
  __exportStar(require_agent(), exports);
20789
20883
  });
20884
+ var init_server = __esm(() => {
20885
+ init_constants();
20886
+ });
20790
20887
  var package_default = {
20791
20888
  name: "@uipath/access-policy-tool",
20792
- version: "1.1.0",
20889
+ license: "MIT",
20890
+ version: "1.195.0",
20793
20891
  description: "Manage UiPath Access Policies, rules, and compliance evaluations.",
20794
20892
  private: false,
20795
20893
  repository: {
@@ -20831,6 +20929,132 @@ var package_default = {
20831
20929
  typescript: "^6.0.2"
20832
20930
  }
20833
20931
  };
20932
+ var PREFIX = "@uipath/common/";
20933
+ var _g = globalThis;
20934
+ function singleton(ctorOrName) {
20935
+ const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
20936
+ const key = Symbol.for(PREFIX + name);
20937
+ return {
20938
+ get(fallback) {
20939
+ return _g[key] ?? fallback;
20940
+ },
20941
+ set(value) {
20942
+ _g[key] = value;
20943
+ },
20944
+ clear() {
20945
+ delete _g[key];
20946
+ },
20947
+ getOrInit(factory, guard) {
20948
+ const existing = _g[key];
20949
+ if (existing != null && typeof existing === "object") {
20950
+ if (!guard || guard(existing)) {
20951
+ return existing;
20952
+ }
20953
+ }
20954
+ const instance = factory();
20955
+ _g[key] = instance;
20956
+ return instance;
20957
+ }
20958
+ };
20959
+ }
20960
+ var USER_AGENT_HEADER = "User-Agent";
20961
+ var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
20962
+ function userAgentPatchKey(userAgent) {
20963
+ return Symbol.for(`@uipath/common/sdk-user-agent/${userAgent}`);
20964
+ }
20965
+ function splitUserAgentTokens(value) {
20966
+ return value?.trim().split(/\s+/).filter(Boolean) ?? [];
20967
+ }
20968
+ function appendUserAgentToken(value, userAgent) {
20969
+ const tokens = splitUserAgentTokens(value);
20970
+ const seen = new Set(tokens);
20971
+ for (const token of splitUserAgentTokens(userAgent)) {
20972
+ if (!seen.has(token)) {
20973
+ tokens.push(token);
20974
+ seen.add(token);
20975
+ }
20976
+ }
20977
+ return tokens.join(" ");
20978
+ }
20979
+ function getEffectiveUserAgent(userAgent) {
20980
+ return appendUserAgentToken(sdkUserAgentHostToken.get(), userAgent);
20981
+ }
20982
+ function isHeadersLike(headers) {
20983
+ return typeof headers === "object" && headers !== null && "get" in headers && typeof headers.get === "function" && "set" in headers && typeof headers.set === "function";
20984
+ }
20985
+ function getSdkUserAgentToken(pkg) {
20986
+ const packageName = pkg.name.replace(/^@uipath\//, "");
20987
+ return getEffectiveUserAgent(`${packageName}/${pkg.version}`);
20988
+ }
20989
+ function addSdkUserAgentHeader(headers, userAgent) {
20990
+ const result = { ...headers ?? {} };
20991
+ const effectiveUserAgent = getEffectiveUserAgent(userAgent);
20992
+ const headerName = Object.keys(result).find((key) => key.toLowerCase() === USER_AGENT_HEADER.toLowerCase());
20993
+ if (headerName) {
20994
+ result[headerName] = appendUserAgentToken(result[headerName], effectiveUserAgent);
20995
+ } else {
20996
+ result[USER_AGENT_HEADER] = effectiveUserAgent;
20997
+ }
20998
+ return result;
20999
+ }
21000
+ function withSdkUserAgentHeader(headers, userAgent) {
21001
+ const effectiveUserAgent = getEffectiveUserAgent(userAgent);
21002
+ if (isHeadersLike(headers)) {
21003
+ headers.set(USER_AGENT_HEADER, appendUserAgentToken(headers.get(USER_AGENT_HEADER), effectiveUserAgent));
21004
+ return headers;
21005
+ }
21006
+ if (Array.isArray(headers)) {
21007
+ const result = headers.map((entry) => {
21008
+ const [key, value] = entry;
21009
+ return [key, value];
21010
+ });
21011
+ const headerIndex = result.findIndex(([key]) => key.toLowerCase() === USER_AGENT_HEADER.toLowerCase());
21012
+ if (headerIndex >= 0) {
21013
+ const [key, value] = result[headerIndex];
21014
+ result[headerIndex] = [
21015
+ key,
21016
+ appendUserAgentToken(value, effectiveUserAgent)
21017
+ ];
21018
+ } else {
21019
+ result.push([USER_AGENT_HEADER, effectiveUserAgent]);
21020
+ }
21021
+ return result;
21022
+ }
21023
+ return addSdkUserAgentHeader(typeof headers === "object" && headers !== null ? { ...headers } : {}, effectiveUserAgent);
21024
+ }
21025
+ function withUserAgentInitOverride(initOverrides, userAgent) {
21026
+ return async (requestContext) => {
21027
+ const initWithUserAgent = {
21028
+ ...requestContext.init,
21029
+ headers: withSdkUserAgentHeader(requestContext.init.headers, userAgent)
21030
+ };
21031
+ const override = typeof initOverrides === "function" ? await initOverrides({
21032
+ ...requestContext,
21033
+ init: initWithUserAgent
21034
+ }) : initOverrides;
21035
+ return {
21036
+ ...override ?? {},
21037
+ headers: withSdkUserAgentHeader(override?.headers ?? initWithUserAgent.headers, userAgent)
21038
+ };
21039
+ };
21040
+ }
21041
+ function installSdkUserAgentHeader(BaseApiClass, userAgent) {
21042
+ const prototype = BaseApiClass.prototype;
21043
+ const patchKey = userAgentPatchKey(userAgent);
21044
+ if (prototype[patchKey]) {
21045
+ return;
21046
+ }
21047
+ if (typeof prototype.request !== "function") {
21048
+ throw new Error("Generated BaseAPI request function not found.");
21049
+ }
21050
+ const originalRequest = prototype.request;
21051
+ prototype.request = function requestWithUserAgent(context, initOverrides) {
21052
+ return originalRequest.call(this, context, withUserAgentInitOverride(initOverrides, userAgent));
21053
+ };
21054
+ Object.defineProperty(prototype, patchKey, {
21055
+ value: true
21056
+ });
21057
+ }
20834
21058
  var BASE_PATH = "http://localhost".replace(/\/+$/, "");
20835
21059
 
20836
21060
  class Configuration {
@@ -21080,6 +21304,54 @@ class VoidApiResponse {
21080
21304
  return;
21081
21305
  }
21082
21306
  }
21307
+ var package_default2 = {
21308
+ name: "@uipath/authz-sdk",
21309
+ license: "MIT",
21310
+ version: "1.195.0",
21311
+ description: "SDK for the UiPath Authorization Service API.",
21312
+ repository: {
21313
+ type: "git",
21314
+ url: "https://github.com/UiPath/cli.git",
21315
+ directory: "packages/admin/authz-sdk"
21316
+ },
21317
+ publishConfig: {
21318
+ registry: "https://npm.pkg.github.com/@uipath"
21319
+ },
21320
+ keywords: [
21321
+ "uipath",
21322
+ "authorization",
21323
+ "authz",
21324
+ "sdk"
21325
+ ],
21326
+ type: "module",
21327
+ main: "./dist/index.js",
21328
+ types: "./dist/src/index.d.ts",
21329
+ exports: {
21330
+ ".": {
21331
+ types: "./dist/src/index.d.ts",
21332
+ default: "./dist/index.js"
21333
+ }
21334
+ },
21335
+ files: [
21336
+ "dist"
21337
+ ],
21338
+ private: true,
21339
+ scripts: {
21340
+ build: "bun build ./src/index.ts --outdir dist --format esm --target node && tsc -p tsconfig.build.json --noCheck",
21341
+ generate: "bun run src/scripts/generate-sdk.ts",
21342
+ lint: "biome check ."
21343
+ },
21344
+ devDependencies: {
21345
+ "@openapitools/openapi-generator-cli": "^2.31.1",
21346
+ "@types/node": "^25.5.2",
21347
+ "@uipath/auth": "workspace:*",
21348
+ "@uipath/common": "workspace:*",
21349
+ "@uipath/filesystem": "workspace:*",
21350
+ typescript: "^6.0.2"
21351
+ }
21352
+ };
21353
+ var SDK_USER_AGENT = getSdkUserAgentToken(package_default2);
21354
+ installSdkUserAgentHeader(BaseAPI, SDK_USER_AGENT);
21083
21355
  function PolicyOperatorFromJSON(json) {
21084
21356
  return PolicyOperatorFromJSONTyped(json, false);
21085
21357
  }
@@ -21650,32 +21922,7 @@ class InvalidBaseUrlError extends Error {
21650
21922
  this.name = "InvalidBaseUrlError";
21651
21923
  }
21652
21924
  }
21653
- var DEFAULT_SCOPES = [
21654
- "offline_access",
21655
- "ProcessMining",
21656
- "OrchestratorApiUserAccess",
21657
- "StudioWebBackend",
21658
- "IdentityServerApi",
21659
- "ConnectionService",
21660
- "DataService",
21661
- "DataServiceApiUserAccess",
21662
- "DocumentUnderstanding",
21663
- "EnterpriseContextService",
21664
- "Directory",
21665
- "JamJamApi",
21666
- "LLMGateway",
21667
- "LLMOps",
21668
- "OMS",
21669
- "RCS.FolderAuthorization",
21670
- "RCS.TagsManagement",
21671
- "TestmanagerApiUserAccess",
21672
- "AutomationSolutions",
21673
- "StudioWebTypeCacheService",
21674
- "Docs.GPT.Search",
21675
- "Insights",
21676
- "ReferenceToken",
21677
- "Audit.Read"
21678
- ];
21925
+ var DEFAULT_SCOPES = ["openid", "profile", "offline_access"];
21679
21926
  var normalizeAndValidateBaseUrl = (rawUrl) => {
21680
21927
  let baseUrl = rawUrl;
21681
21928
  if (baseUrl.endsWith("/identity_/")) {
@@ -21725,7 +21972,8 @@ var resolveConfigAsync = async ({
21725
21972
  if (!clientSecret && fileAuth.clientSecret) {
21726
21973
  clientSecret = fileAuth.clientSecret;
21727
21974
  }
21728
- const scopes = customScopes && customScopes.length > 0 ? customScopes : fileAuth.scopes && fileAuth.scopes.length > 0 ? fileAuth.scopes : DEFAULT_SCOPES;
21975
+ const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && Boolean(clientSecret);
21976
+ const scopes = customScopes && customScopes.length > 0 ? customScopes : fileAuth.scopes && fileAuth.scopes.length > 0 ? fileAuth.scopes : isExternalAppAuth ? [] : DEFAULT_SCOPES;
21729
21977
  return {
21730
21978
  clientId,
21731
21979
  clientSecret,
@@ -22212,6 +22460,129 @@ function normalizeTokenRefreshFailure() {
22212
22460
  function normalizeTokenRefreshUnavailableFailure() {
22213
22461
  return "token refresh failed before authentication completed";
22214
22462
  }
22463
+ function errorMessage(error) {
22464
+ return error instanceof Error ? error.message : String(error);
22465
+ }
22466
+ function computeExpirationThreshold(ensureTokenValidityMinutes) {
22467
+ return new Date(Date.now() + (ensureTokenValidityMinutes ?? 0) * 60 * 1000);
22468
+ }
22469
+ async function runRefreshLocked(inputs) {
22470
+ const {
22471
+ absolutePath,
22472
+ refreshToken: callerRefreshToken,
22473
+ customAuthority,
22474
+ ensureTokenValidityMinutes,
22475
+ loadEnvFile,
22476
+ saveEnvFile,
22477
+ refreshFn,
22478
+ resolveConfig
22479
+ } = inputs;
22480
+ const expirationThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
22481
+ let fresh;
22482
+ try {
22483
+ fresh = await loadEnvFile({ envPath: absolutePath });
22484
+ } catch (error) {
22485
+ return {
22486
+ kind: "fail",
22487
+ status: {
22488
+ loginStatus: "Refresh Failed",
22489
+ hint: "Could not read the auth file while refreshing. Retry, or run 'uip login' to re-authenticate.",
22490
+ tokenRefresh: {
22491
+ attempted: false,
22492
+ success: false,
22493
+ errorMessage: `auth file read failed: ${errorMessage(error)}`
22494
+ }
22495
+ }
22496
+ };
22497
+ }
22498
+ const freshAccess = fresh.UIPATH_ACCESS_TOKEN;
22499
+ const freshExp = freshAccess ? getTokenExpiration(freshAccess) : undefined;
22500
+ if (freshAccess && freshExp && freshExp > expirationThreshold) {
22501
+ return {
22502
+ kind: "ok",
22503
+ accessToken: freshAccess,
22504
+ refreshToken: fresh.UIPATH_REFRESH_TOKEN ?? callerRefreshToken,
22505
+ expiration: freshExp,
22506
+ tokenRefresh: { attempted: false, success: true }
22507
+ };
22508
+ }
22509
+ const tokenForIdP = fresh.UIPATH_REFRESH_TOKEN ?? callerRefreshToken;
22510
+ let refreshedAccess;
22511
+ let refreshedRefresh;
22512
+ try {
22513
+ const config = await resolveConfig({ customAuthority });
22514
+ const refreshed = await refreshFn({
22515
+ refreshToken: tokenForIdP,
22516
+ tokenEndpoint: config.tokenEndpoint,
22517
+ clientId: config.clientId,
22518
+ expectedAuthority: customAuthority
22519
+ });
22520
+ refreshedAccess = refreshed.accessToken;
22521
+ refreshedRefresh = refreshed.refreshToken;
22522
+ } catch (error) {
22523
+ const isOAuthFailure = isTokenRefreshOAuthFailure(error);
22524
+ 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.";
22525
+ const message = isOAuthFailure ? normalizeTokenRefreshFailure() : normalizeTokenRefreshUnavailableFailure();
22526
+ return {
22527
+ kind: "fail",
22528
+ status: {
22529
+ loginStatus: "Refresh Failed",
22530
+ hint,
22531
+ tokenRefresh: {
22532
+ attempted: true,
22533
+ success: false,
22534
+ errorMessage: message
22535
+ }
22536
+ }
22537
+ };
22538
+ }
22539
+ const refreshedExp = getTokenExpiration(refreshedAccess);
22540
+ if (!refreshedExp || refreshedExp <= new Date) {
22541
+ return {
22542
+ kind: "fail",
22543
+ status: {
22544
+ loginStatus: "Refresh Failed",
22545
+ hint: "The identity server returned an unusable token. Run 'uip login' to re-authenticate.",
22546
+ tokenRefresh: {
22547
+ attempted: true,
22548
+ success: false,
22549
+ errorMessage: "refreshed token has no valid expiration claim"
22550
+ }
22551
+ }
22552
+ };
22553
+ }
22554
+ try {
22555
+ await saveEnvFile({
22556
+ envPath: absolutePath,
22557
+ data: {
22558
+ UIPATH_ACCESS_TOKEN: refreshedAccess,
22559
+ UIPATH_REFRESH_TOKEN: refreshedRefresh
22560
+ },
22561
+ merge: true
22562
+ });
22563
+ return {
22564
+ kind: "ok",
22565
+ accessToken: refreshedAccess,
22566
+ refreshToken: refreshedRefresh,
22567
+ expiration: refreshedExp,
22568
+ tokenRefresh: { attempted: true, success: true }
22569
+ };
22570
+ } catch (error) {
22571
+ const msg = errorMessage(error);
22572
+ return {
22573
+ kind: "ok",
22574
+ accessToken: refreshedAccess,
22575
+ refreshToken: refreshedRefresh,
22576
+ expiration: refreshedExp,
22577
+ 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.`,
22578
+ tokenRefresh: {
22579
+ attempted: true,
22580
+ success: true,
22581
+ errorMessage: `persistence failed: ${msg}`
22582
+ }
22583
+ };
22584
+ }
22585
+ }
22215
22586
  var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
22216
22587
  const {
22217
22588
  resolveEnvFilePath = resolveEnvFilePathAsync,
@@ -22286,73 +22657,103 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
22286
22657
  let refreshToken = credentials.UIPATH_REFRESH_TOKEN;
22287
22658
  let expiration = getTokenExpiration(accessToken);
22288
22659
  let persistenceWarning;
22660
+ let lockReleaseFailed = false;
22289
22661
  let tokenRefresh;
22290
- const expirationThreshold = new Date(Date.now() + (ensureTokenValidityMinutes ?? 0) * 60 * 1000);
22291
- if (expiration && expiration <= expirationThreshold && refreshToken) {
22292
- let refreshedAccess;
22293
- let refreshedRefresh;
22662
+ const outerThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
22663
+ const tryGlobalCredsHint = async () => {
22664
+ const fs7 = getFs();
22665
+ const globalPath = fs7.path.join(fs7.env.homedir(), envFilePath);
22666
+ if (absolutePath === globalPath)
22667
+ return;
22668
+ if (!await fs7.exists(globalPath))
22669
+ return;
22294
22670
  try {
22295
- const config = await resolveConfig({
22296
- customAuthority: credentials.UIPATH_URL
22297
- });
22298
- const refreshed = await refreshTokenFn({
22299
- refreshToken,
22300
- tokenEndpoint: config.tokenEndpoint,
22301
- clientId: config.clientId,
22302
- expectedAuthority: credentials.UIPATH_URL
22303
- });
22304
- refreshedAccess = refreshed.accessToken;
22305
- refreshedRefresh = refreshed.refreshToken;
22671
+ const globalCreds = await loadEnvFile({ envPath: globalPath });
22672
+ if (!globalCreds.UIPATH_ACCESS_TOKEN)
22673
+ return;
22674
+ const globalExp = getTokenExpiration(globalCreds.UIPATH_ACCESS_TOKEN);
22675
+ if (globalExp && globalExp <= new Date)
22676
+ return;
22677
+ 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.`;
22678
+ } catch {
22679
+ return;
22680
+ }
22681
+ };
22682
+ if (expiration && expiration <= outerThreshold && refreshToken) {
22683
+ let release;
22684
+ try {
22685
+ release = await getFs().acquireLock(absolutePath);
22306
22686
  } catch (error) {
22307
- const isOAuthFailure = isTokenRefreshOAuthFailure(error);
22308
- 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.";
22309
- const errorMessage = isOAuthFailure ? normalizeTokenRefreshFailure() : normalizeTokenRefreshUnavailableFailure();
22687
+ const msg = errorMessage(error);
22688
+ const globalHint = await tryGlobalCredsHint();
22689
+ if (globalHint) {
22690
+ return {
22691
+ loginStatus: "Expired",
22692
+ accessToken,
22693
+ refreshToken,
22694
+ baseUrl: credentials.UIPATH_URL,
22695
+ organizationName: credentials.UIPATH_ORGANIZATION_NAME,
22696
+ organizationId: credentials.UIPATH_ORGANIZATION_ID,
22697
+ tenantName: credentials.UIPATH_TENANT_NAME,
22698
+ tenantId: credentials.UIPATH_TENANT_ID,
22699
+ expiration,
22700
+ source: "file",
22701
+ hint: globalHint,
22702
+ tokenRefresh: {
22703
+ attempted: false,
22704
+ success: false,
22705
+ errorMessage: `lock acquisition failed: ${msg}`
22706
+ }
22707
+ };
22708
+ }
22310
22709
  return {
22311
22710
  loginStatus: "Refresh Failed",
22312
- hint,
22711
+ 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.",
22313
22712
  tokenRefresh: {
22314
- attempted: true,
22713
+ attempted: false,
22315
22714
  success: false,
22316
- errorMessage
22715
+ errorMessage: `lock acquisition failed: ${msg}`
22317
22716
  }
22318
22717
  };
22319
22718
  }
22320
- const refreshedExp = getTokenExpiration(refreshedAccess);
22321
- if (!refreshedExp || refreshedExp <= new Date) {
22322
- return {
22323
- loginStatus: "Refresh Failed",
22324
- hint: "The identity server returned an unusable token. Run 'uip login' to re-authenticate.",
22325
- tokenRefresh: {
22326
- attempted: true,
22327
- success: false,
22328
- errorMessage: "refreshed token has no valid expiration claim"
22719
+ let lockedFailure;
22720
+ try {
22721
+ const outcome = await runRefreshLocked({
22722
+ absolutePath,
22723
+ refreshToken,
22724
+ customAuthority: credentials.UIPATH_URL,
22725
+ ensureTokenValidityMinutes,
22726
+ loadEnvFile,
22727
+ saveEnvFile,
22728
+ refreshFn: refreshTokenFn,
22729
+ resolveConfig
22730
+ });
22731
+ if (outcome.kind === "fail") {
22732
+ lockedFailure = outcome.status;
22733
+ } else {
22734
+ accessToken = outcome.accessToken;
22735
+ refreshToken = outcome.refreshToken;
22736
+ expiration = outcome.expiration;
22737
+ tokenRefresh = outcome.tokenRefresh;
22738
+ if (outcome.persistenceWarning) {
22739
+ persistenceWarning = outcome.persistenceWarning;
22329
22740
  }
22330
- };
22741
+ }
22742
+ } finally {
22743
+ try {
22744
+ await release();
22745
+ } catch {
22746
+ lockReleaseFailed = true;
22747
+ }
22331
22748
  }
22332
- accessToken = refreshedAccess;
22333
- refreshToken = refreshedRefresh;
22334
- expiration = refreshedExp;
22335
- try {
22336
- await saveEnvFile({
22337
- envPath: absolutePath,
22338
- data: {
22339
- UIPATH_ACCESS_TOKEN: accessToken,
22340
- UIPATH_REFRESH_TOKEN: refreshToken
22341
- },
22342
- merge: true
22343
- });
22344
- tokenRefresh = {
22345
- attempted: true,
22346
- success: true
22347
- };
22348
- } catch (error) {
22349
- const msg = error instanceof Error ? error.message : String(error);
22350
- 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.`;
22351
- tokenRefresh = {
22352
- attempted: true,
22353
- success: true,
22354
- errorMessage: `persistence failed: ${msg}`
22355
- };
22749
+ if (lockedFailure) {
22750
+ const globalHint = await tryGlobalCredsHint();
22751
+ const base = globalHint ? {
22752
+ ...lockedFailure,
22753
+ loginStatus: "Expired",
22754
+ hint: globalHint
22755
+ } : lockedFailure;
22756
+ return lockReleaseFailed ? { ...base, lockReleaseFailed: true } : base;
22356
22757
  }
22357
22758
  }
22358
22759
  const result = {
@@ -22367,23 +22768,13 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
22367
22768
  expiration,
22368
22769
  source: "file",
22369
22770
  ...persistenceWarning ? { hint: persistenceWarning, persistenceFailed: true } : {},
22771
+ ...lockReleaseFailed ? { lockReleaseFailed: true } : {},
22370
22772
  ...tokenRefresh ? { tokenRefresh } : {}
22371
22773
  };
22372
22774
  if (result.loginStatus === "Expired") {
22373
- const fs7 = getFs();
22374
- const globalPath = fs7.path.join(fs7.env.homedir(), envFilePath);
22375
- if (absolutePath !== globalPath && await fs7.exists(globalPath)) {
22376
- try {
22377
- const globalCreds = await loadEnvFile({
22378
- envPath: globalPath
22379
- });
22380
- if (globalCreds.UIPATH_ACCESS_TOKEN) {
22381
- const globalExp = getTokenExpiration(globalCreds.UIPATH_ACCESS_TOKEN);
22382
- if (!globalExp || globalExp > new Date) {
22383
- 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.`;
22384
- }
22385
- }
22386
- } catch {}
22775
+ const globalHint = await tryGlobalCredsHint();
22776
+ if (globalHint) {
22777
+ result.hint = globalHint;
22387
22778
  }
22388
22779
  }
22389
22780
  return result;
@@ -22398,6 +22789,7 @@ var getLoginStatusAsync = async (options = {}) => {
22398
22789
  };
22399
22790
  init_src();
22400
22791
  init_src();
22792
+ init_server();
22401
22793
  async function resolveConfig(plane, options) {
22402
22794
  const status = await getLoginStatusAsync({
22403
22795
  ensureTokenValidityMinutes: options?.loginValidity
@@ -22413,7 +22805,8 @@ async function resolveConfig(plane, options) {
22413
22805
  return {
22414
22806
  config: new Configuration({
22415
22807
  basePath,
22416
- accessToken: async () => bearerToken
22808
+ accessToken: async () => bearerToken,
22809
+ headers: addSdkUserAgentHeader(undefined, SDK_USER_AGENT)
22417
22810
  }),
22418
22811
  organizationId: status.organizationId,
22419
22812
  tenantId: status.tenantId,
@@ -22567,10 +22960,15 @@ async function extractErrorDetails(error, options) {
22567
22960
  }
22568
22961
  if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
22569
22962
  context.errorCode = parsedBody.errorCode;
22963
+ } else if (parsedBody?.code && typeof parsedBody.code === "string") {
22964
+ context.errorCode = parsedBody.code;
22570
22965
  }
22571
22966
  if (parsedBody?.requestId && typeof parsedBody.requestId === "string") {
22572
22967
  context.requestId = parsedBody.requestId;
22573
22968
  }
22969
+ if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
22970
+ context.traceId = parsedBody.traceId;
22971
+ }
22574
22972
  if (status === 429) {
22575
22973
  const resp = response;
22576
22974
  const headersObj = resp?.headers;
@@ -22590,7 +22988,35 @@ async function extractErrorDetails(error, options) {
22590
22988
  }
22591
22989
  }
22592
22990
  const hasContext = Object.keys(context).length > 0;
22593
- return { result, message, details, ...hasContext ? { context } : {} };
22991
+ let parsedErrors;
22992
+ if (parsedBody?.errors && typeof parsedBody.errors === "object") {
22993
+ const errors = {};
22994
+ for (const [field, raw] of Object.entries(parsedBody.errors)) {
22995
+ if (Array.isArray(raw)) {
22996
+ const messages = raw.map((entry) => {
22997
+ if (typeof entry === "string")
22998
+ return entry;
22999
+ if (entry && typeof entry === "object" && typeof entry.message === "string") {
23000
+ return entry.message;
23001
+ }
23002
+ return String(entry);
23003
+ }).filter(Boolean);
23004
+ if (messages.length > 0)
23005
+ errors[field] = messages;
23006
+ } else if (typeof raw === "string") {
23007
+ errors[field] = [raw];
23008
+ }
23009
+ }
23010
+ if (Object.keys(errors).length > 0)
23011
+ parsedErrors = errors;
23012
+ }
23013
+ return {
23014
+ result,
23015
+ message,
23016
+ details,
23017
+ ...hasContext ? { context } : {},
23018
+ ...parsedErrors ? { parsedErrors } : {}
23019
+ };
22594
23020
  }
22595
23021
  async function extractErrorMessage(error, options) {
22596
23022
  const { message } = await extractErrorDetails(error, options);
@@ -22601,34 +23027,6 @@ Command.prototype.examples = function(examples) {
22601
23027
  examplesByCommand.set(this, examples);
22602
23028
  return this;
22603
23029
  };
22604
- var PREFIX = "@uipath/common/";
22605
- var _g = globalThis;
22606
- function singleton(ctorOrName) {
22607
- const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
22608
- const key = Symbol.for(PREFIX + name);
22609
- return {
22610
- get(fallback) {
22611
- return _g[key] ?? fallback;
22612
- },
22613
- set(value) {
22614
- _g[key] = value;
22615
- },
22616
- clear() {
22617
- delete _g[key];
22618
- },
22619
- getOrInit(factory, guard) {
22620
- const existing = _g[key];
22621
- if (existing != null && typeof existing === "object") {
22622
- if (!guard || guard(existing)) {
22623
- return existing;
22624
- }
22625
- }
22626
- const instance = factory();
22627
- _g[key] = instance;
22628
- return instance;
22629
- }
22630
- };
22631
- }
22632
23030
  function createStorage() {
22633
23031
  const [error, mod] = catchError2(() => __require2("node:async_hooks"));
22634
23032
  if (error || typeof mod?.AsyncLocalStorage !== "function") {
@@ -27695,6 +28093,60 @@ function escapeNonAscii(jsonText) {
27695
28093
  function needsAsciiSafeJson(sink) {
27696
28094
  return process.platform === "win32" && !sink.capabilities.isInteractive;
27697
28095
  }
28096
+ function isPlainRecord(value) {
28097
+ if (value === null || typeof value !== "object")
28098
+ return false;
28099
+ const prototype = Object.getPrototypeOf(value);
28100
+ return prototype === Object.prototype || prototype === null;
28101
+ }
28102
+ function toLowerCamelCaseKey(key) {
28103
+ if (!key)
28104
+ return key;
28105
+ if (/[_\-\s]/.test(key)) {
28106
+ const [firstPart, ...restParts] = key.split(/[_\-\s]+/).filter(Boolean);
28107
+ if (!firstPart)
28108
+ return key;
28109
+ return [
28110
+ toLowerCamelCaseSimpleKey(firstPart),
28111
+ ...restParts.map((part) => {
28112
+ const normalized = toLowerCamelCaseSimpleKey(part);
28113
+ return normalized.charAt(0).toUpperCase() + normalized.slice(1);
28114
+ })
28115
+ ].join("");
28116
+ }
28117
+ return toLowerCamelCaseSimpleKey(key);
28118
+ }
28119
+ function toLowerCamelCaseSimpleKey(key) {
28120
+ if (/^[A-Z0-9]+$/.test(key))
28121
+ return key.toLowerCase();
28122
+ return key.replace(/^[A-Z]+(?=[A-Z][a-z]|\d|$)|^[A-Z]/, (match) => match.toLowerCase());
28123
+ }
28124
+ function toPascalCaseKey(key) {
28125
+ const lowerCamelKey = toLowerCamelCaseKey(key);
28126
+ return lowerCamelKey ? lowerCamelKey.charAt(0).toUpperCase() + lowerCamelKey.slice(1) : lowerCamelKey;
28127
+ }
28128
+ function toPascalCaseData(value) {
28129
+ if (Array.isArray(value))
28130
+ return value.map(toPascalCaseData);
28131
+ if (!isPlainRecord(value))
28132
+ return value;
28133
+ const result = {};
28134
+ for (const [key, nestedValue] of Object.entries(value)) {
28135
+ result[toPascalCaseKey(key)] = toPascalCaseData(nestedValue);
28136
+ }
28137
+ return result;
28138
+ }
28139
+ function normalizeDataKeys(data) {
28140
+ return toPascalCaseData(data);
28141
+ }
28142
+ function normalizeOutputKeys(data) {
28143
+ const result = {};
28144
+ for (const [key, value] of Object.entries(data)) {
28145
+ const pascalKey = toPascalCaseKey(key);
28146
+ result[pascalKey] = pascalKey === "Data" ? value : toPascalCaseData(value);
28147
+ }
28148
+ return result;
28149
+ }
27698
28150
  function printOutput(data, format = "json", logFn, asciiSafe = false) {
27699
28151
  if (!data) {
27700
28152
  logFn("Empty response object. No data to display.");
@@ -27757,7 +28209,7 @@ function wrapText(text, width) {
27757
28209
  function printTable(data, logFn, externalLogValue) {
27758
28210
  if (data.length === 0)
27759
28211
  return;
27760
- const keys = Object.keys(data[0]).filter((key) => key !== "Code" && key !== "Log");
28212
+ const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
27761
28213
  const maxWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
27762
28214
  const header = keys.map((key, i2) => key.padEnd(maxWidths[i2])).join(" | ");
27763
28215
  logFn(header);
@@ -27772,7 +28224,7 @@ function printTable(data, logFn, externalLogValue) {
27772
28224
  }
27773
28225
  }
27774
28226
  function printVerticalTable(data, logFn = console.log, externalLogValue) {
27775
- const keys = Object.keys(data).filter((key) => key !== "Code" && key !== "Log");
28227
+ const keys = Object.keys(data).filter((key) => !["code", "log"].includes(key.toLowerCase()));
27776
28228
  if (keys.length === 0)
27777
28229
  return;
27778
28230
  const maxKeyWidth = Math.max(...keys.map((key) => key.length));
@@ -27788,7 +28240,7 @@ function printVerticalTable(data, logFn = console.log, externalLogValue) {
27788
28240
  function printResizableTable(data, logFn = console.log, externalLogValue) {
27789
28241
  if (data.length === 0)
27790
28242
  return;
27791
- const keys = Object.keys(data[0]).filter((key) => key !== "Code" && key !== "Log");
28243
+ const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
27792
28244
  if (keys.length === 0)
27793
28245
  return;
27794
28246
  if (!process.stdout.isTTY) {
@@ -27864,8 +28316,27 @@ function printResizableTable(data, logFn = console.log, externalLogValue) {
27864
28316
  function toYaml(data) {
27865
28317
  return dump(data);
27866
28318
  }
28319
+
28320
+ class FilterEvaluationError extends Error {
28321
+ __brand = "FilterEvaluationError";
28322
+ filter;
28323
+ instructions;
28324
+ result = RESULTS.ValidationError;
28325
+ constructor(filter, cause) {
28326
+ const underlying = cause instanceof Error ? cause.message : String(cause);
28327
+ super(`Filter '${filter}' failed to evaluate: ${underlying}`);
28328
+ this.name = "FilterEvaluationError";
28329
+ this.filter = filter;
28330
+ 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(@)'.";
28331
+ }
28332
+ }
27867
28333
  function applyFilter(data, filter) {
27868
- const result = search(data, filter);
28334
+ let result;
28335
+ try {
28336
+ result = search(data, filter);
28337
+ } catch (err) {
28338
+ throw new FilterEvaluationError(filter, err);
28339
+ }
27869
28340
  if (result == null)
27870
28341
  return [];
27871
28342
  if (Array.isArray(result)) {
@@ -27882,13 +28353,18 @@ function applyFilter(data, filter) {
27882
28353
  }
27883
28354
  var OutputFormatter;
27884
28355
  ((OutputFormatter2) => {
27885
- function success(data) {
28356
+ function success(data, options) {
27886
28357
  data.Log ??= getLogFilePath() || undefined;
28358
+ const normalize = !options?.preserveDataKeys;
28359
+ if (normalize) {
28360
+ data.Data = normalizeDataKeys(data.Data);
28361
+ }
27887
28362
  const filter = getOutputFilter();
27888
28363
  if (filter) {
27889
- data.Data = applyFilter(data.Data, filter);
28364
+ const filtered = applyFilter(data.Data, filter);
28365
+ data.Data = normalize ? normalizeDataKeys(filtered) : filtered;
27890
28366
  }
27891
- logOutput(data, getOutputFormat());
28367
+ logOutput(normalizeOutputKeys(data), getOutputFormat());
27892
28368
  }
27893
28369
  OutputFormatter2.success = success;
27894
28370
  function error(data) {
@@ -27898,7 +28374,7 @@ var OutputFormatter;
27898
28374
  result: data.Result,
27899
28375
  message: data.Message
27900
28376
  });
27901
- logOutput(data, getOutputFormat());
28377
+ logOutput(normalizeOutputKeys(data), getOutputFormat());
27902
28378
  }
27903
28379
  OutputFormatter2.error = error;
27904
28380
  function emitList(code, items, opts) {
@@ -27919,13 +28395,14 @@ var OutputFormatter;
27919
28395
  function log(data) {
27920
28396
  const format = getOutputFormat();
27921
28397
  const sink = getOutputSink();
28398
+ const normalized = toPascalCaseData(data);
27922
28399
  if (format === "json") {
27923
- const json2 = JSON.stringify(data);
28400
+ const json2 = JSON.stringify(normalized);
27924
28401
  const safe = needsAsciiSafeJson(sink) ? escapeNonAscii(json2) : json2;
27925
28402
  sink.writeErr(`${safe}
27926
28403
  `);
27927
28404
  } else {
27928
- for (const [key, value] of Object.entries(data)) {
28405
+ for (const [key, value] of Object.entries(normalized)) {
27929
28406
  sink.writeErr(`${key}: ${value}
27930
28407
  `);
27931
28408
  }
@@ -27934,12 +28411,16 @@ var OutputFormatter;
27934
28411
  OutputFormatter2.log = log;
27935
28412
  function formatToString(data) {
27936
28413
  const filter = getOutputFilter();
27937
- if (filter && "Data" in data && data.Data != null) {
27938
- data.Data = applyFilter(data.Data, filter);
28414
+ if ("Data" in data && data.Data != null) {
28415
+ data.Data = normalizeDataKeys(data.Data);
28416
+ if (filter) {
28417
+ data.Data = normalizeDataKeys(applyFilter(data.Data, filter));
28418
+ }
27939
28419
  }
28420
+ const output = normalizeOutputKeys(data);
27940
28421
  const lines = [];
27941
28422
  const sink = getOutputSink();
27942
- printOutput(data, getOutputFormat(), (msg) => {
28423
+ printOutput(output, getOutputFormat(), (msg) => {
27943
28424
  lines.push(msg);
27944
28425
  }, needsAsciiSafeJson(sink));
27945
28426
  return lines.join(`
@@ -29362,6 +29843,19 @@ function parseSafeInteger(raw, min) {
29362
29843
  }
29363
29844
  return parsed;
29364
29845
  }
29846
+ var PollOutcome = {
29847
+ Completed: "completed",
29848
+ Timeout: "timeout",
29849
+ Interrupted: "interrupted",
29850
+ Aborted: "aborted",
29851
+ Failed: "failed"
29852
+ };
29853
+ var REASON_BY_OUTCOME = {
29854
+ [PollOutcome.Timeout]: "poll_timeout",
29855
+ [PollOutcome.Failed]: "poll_failed",
29856
+ [PollOutcome.Interrupted]: "poll_failed",
29857
+ [PollOutcome.Aborted]: "poll_aborted"
29858
+ };
29365
29859
  var TERMINAL_STATUSES = new Set([
29366
29860
  "completed",
29367
29861
  "successful",
@@ -29561,17 +30055,21 @@ Command.prototype.trackedAction = function(context, fn, properties) {
29561
30055
  const telemetryName = deriveCommandPath(command);
29562
30056
  const props = typeof properties === "function" ? properties(...args) : properties;
29563
30057
  const startTime = performance.now();
29564
- let errorMessage;
30058
+ let errorMessage2;
29565
30059
  const [error] = await catchError2(fn(...args));
29566
30060
  if (error) {
29567
- errorMessage = error instanceof Error ? error.message : String(error);
29568
- logger.error(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
30061
+ errorMessage2 = error instanceof Error ? error.message : String(error);
30062
+ logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage2}`);
30063
+ const typed = error;
30064
+ const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
30065
+ const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
30066
+ const finalResult = customResult ?? RESULTS.Failure;
29569
30067
  OutputFormatter.error({
29570
- Result: RESULTS.Failure,
29571
- Message: errorMessage,
29572
- Instructions: "An unexpected error occurred. Run with --log-level debug for details."
30068
+ Result: finalResult,
30069
+ Message: errorMessage2,
30070
+ Instructions: customInstructions ?? "An unexpected error occurred. Run with --log-level debug for details."
29573
30071
  });
29574
- context.exit(1);
30072
+ context.exit(EXIT_CODES[finalResult]);
29575
30073
  }
29576
30074
  const durationMs = performance.now() - startTime;
29577
30075
  const success = !error && (process.exitCode === undefined || process.exitCode === 0);
@@ -29580,7 +30078,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
29580
30078
  ...props,
29581
30079
  duration: String(durationMs),
29582
30080
  success: String(success),
29583
- ...errorMessage ? { errorMessage } : {}
30081
+ ...errorMessage2 ? { errorMessage: errorMessage2 } : {}
29584
30082
  }));
29585
30083
  });
29586
30084
  };
@@ -30019,6 +30517,7 @@ import path3 from "node:path";
30019
30517
  import { fileURLToPath as fileURLToPath2 } from "node:url";
30020
30518
  import childProcess32 from "node:child_process";
30021
30519
  import fs52, { constants as fsConstants22 } from "node:fs/promises";
30520
+ import { randomUUID as randomUUID2 } from "node:crypto";
30022
30521
  import { existsSync as existsSync2 } from "node:fs";
30023
30522
  import * as fs62 from "node:fs/promises";
30024
30523
  import * as os22 from "node:os";
@@ -30773,6 +31272,90 @@ class NodeFileSystem2 {
30773
31272
  async mkdir(dirPath) {
30774
31273
  await fs62.mkdir(dirPath, { recursive: true });
30775
31274
  }
31275
+ async acquireLock(lockPath) {
31276
+ const canonicalPath = await this.canonicalizeLockTarget(lockPath);
31277
+ const lockFile = `${canonicalPath}.lock`;
31278
+ const ownerId = randomUUID2();
31279
+ const start = Date.now();
31280
+ while (true) {
31281
+ try {
31282
+ await fs62.writeFile(lockFile, ownerId, { flag: "wx" });
31283
+ return this.createLockRelease(lockFile, ownerId);
31284
+ } catch (error) {
31285
+ if (!this.hasErrnoCode(error, "EEXIST")) {
31286
+ throw error;
31287
+ }
31288
+ const stats = await fs62.stat(lockFile).catch(() => null);
31289
+ if (stats && Date.now() - stats.mtimeMs > LOCK_STALE_MS2) {
31290
+ const reclaimed = await fs62.rm(lockFile, { force: true }).then(() => true).catch(() => false);
31291
+ if (reclaimed)
31292
+ continue;
31293
+ }
31294
+ if (Date.now() - start > LOCK_MAX_WAIT_MS2) {
31295
+ throw new Error(`ELOCKED: timed out waiting for lock on ${canonicalPath}`);
31296
+ }
31297
+ await new Promise((resolve22) => setTimeout(resolve22, LOCK_RETRY_MIN_MS2 + Math.random() * LOCK_RETRY_JITTER_MS2));
31298
+ }
31299
+ }
31300
+ }
31301
+ async canonicalizeLockTarget(lockPath) {
31302
+ const absolute = path22.resolve(lockPath);
31303
+ const fullReal = await fs62.realpath(absolute).catch(() => null);
31304
+ if (fullReal)
31305
+ return fullReal;
31306
+ const parent = path22.dirname(absolute);
31307
+ const base = path22.basename(absolute);
31308
+ const canonicalParent = await fs62.realpath(parent).catch(() => parent);
31309
+ return path22.join(canonicalParent, base);
31310
+ }
31311
+ createLockRelease(lockFile, ownerId) {
31312
+ const heartbeatStart = Date.now();
31313
+ let heartbeatTimer;
31314
+ let stopped = false;
31315
+ const stopHeartbeat = () => {
31316
+ stopped = true;
31317
+ if (heartbeatTimer)
31318
+ clearTimeout(heartbeatTimer);
31319
+ };
31320
+ const scheduleNextHeartbeat = () => {
31321
+ if (stopped)
31322
+ return;
31323
+ if (Date.now() - heartbeatStart >= LOCK_MAX_HOLD_MS2) {
31324
+ stopped = true;
31325
+ return;
31326
+ }
31327
+ heartbeatTimer = setTimeout(() => {
31328
+ runHeartbeat();
31329
+ }, LOCK_HEARTBEAT_MS2);
31330
+ heartbeatTimer.unref?.();
31331
+ };
31332
+ const runHeartbeat = async () => {
31333
+ if (stopped)
31334
+ return;
31335
+ const current = await fs62.readFile(lockFile, "utf-8").catch(() => null);
31336
+ if (stopped)
31337
+ return;
31338
+ if (current !== ownerId) {
31339
+ stopped = true;
31340
+ return;
31341
+ }
31342
+ const now = Date.now() / 1000;
31343
+ await fs62.utimes(lockFile, now, now).catch(() => {});
31344
+ scheduleNextHeartbeat();
31345
+ };
31346
+ scheduleNextHeartbeat();
31347
+ let released = false;
31348
+ return async () => {
31349
+ if (released)
31350
+ return;
31351
+ released = true;
31352
+ stopHeartbeat();
31353
+ const current = await fs62.readFile(lockFile, "utf-8").catch(() => null);
31354
+ if (current === ownerId) {
31355
+ await fs62.rm(lockFile, { force: true });
31356
+ }
31357
+ };
31358
+ }
30776
31359
  async rm(filePath) {
30777
31360
  await fs62.rm(filePath, { recursive: true, force: true });
30778
31361
  }
@@ -30818,9 +31401,18 @@ class NodeFileSystem2 {
30818
31401
  }
30819
31402
  }
30820
31403
  isEnoent(error) {
30821
- return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
31404
+ return this.hasErrnoCode(error, "ENOENT");
31405
+ }
31406
+ hasErrnoCode(error, code) {
31407
+ return typeof error === "object" && error !== null && "code" in error && error.code === code;
30822
31408
  }
30823
31409
  }
31410
+ var LOCK_HEARTBEAT_MS2 = 5000;
31411
+ var LOCK_STALE_MS2 = 15000;
31412
+ var LOCK_MAX_WAIT_MS2 = 20000;
31413
+ var LOCK_MAX_HOLD_MS2 = 60000;
31414
+ var LOCK_RETRY_MIN_MS2 = 100;
31415
+ var LOCK_RETRY_JITTER_MS2 = 200;
30824
31416
  var init_node2 = __esm2(() => {
30825
31417
  init_open2();
30826
31418
  });
@@ -30832,7 +31424,7 @@ var init_src2 = __esm2(() => {
30832
31424
  fsInstance2 = new NodeFileSystem2;
30833
31425
  });
30834
31426
  var require_coreipc2 = __commonJS3((exports, module) => {
30835
- var __dirname3 = "/Users/alexandru.oltean/github/cli/node_modules/@uipath/coreipc";
31427
+ var __dirname3 = "/home/runner/work/cli/cli/node_modules/@uipath/coreipc";
30836
31428
  /*! For license information please see index.js.LICENSE.txt */
30837
31429
  (function(e, t) {
30838
31430
  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();
@@ -48632,9 +49224,13 @@ var require_dist2 = __commonJS3((exports) => {
48632
49224
  exports.RobotProxyConstructor = RobotProxyConstructor;
48633
49225
  __exportStar(require_agent2(), exports);
48634
49226
  });
48635
- var package_default2 = {
49227
+ var init_server2 = __esm2(() => {
49228
+ init_constants2();
49229
+ });
49230
+ var package_default3 = {
48636
49231
  name: "@uipath/aops-policy-tool",
48637
- version: "1.1.0",
49232
+ license: "MIT",
49233
+ version: "1.195.0",
48638
49234
  description: "CLI plugin for managing UiPath AOps governance policies.",
48639
49235
  private: false,
48640
49236
  repository: {
@@ -48676,6 +49272,132 @@ var package_default2 = {
48676
49272
  typescript: "^6.0.2"
48677
49273
  }
48678
49274
  };
49275
+ var PREFIX2 = "@uipath/common/";
49276
+ var _g2 = globalThis;
49277
+ function singleton2(ctorOrName) {
49278
+ const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
49279
+ const key = Symbol.for(PREFIX2 + name);
49280
+ return {
49281
+ get(fallback) {
49282
+ return _g2[key] ?? fallback;
49283
+ },
49284
+ set(value) {
49285
+ _g2[key] = value;
49286
+ },
49287
+ clear() {
49288
+ delete _g2[key];
49289
+ },
49290
+ getOrInit(factory, guard) {
49291
+ const existing = _g2[key];
49292
+ if (existing != null && typeof existing === "object") {
49293
+ if (!guard || guard(existing)) {
49294
+ return existing;
49295
+ }
49296
+ }
49297
+ const instance = factory();
49298
+ _g2[key] = instance;
49299
+ return instance;
49300
+ }
49301
+ };
49302
+ }
49303
+ var USER_AGENT_HEADER2 = "User-Agent";
49304
+ var sdkUserAgentHostToken2 = singleton2("SdkUserAgentHostToken");
49305
+ function userAgentPatchKey2(userAgent) {
49306
+ return Symbol.for(`@uipath/common/sdk-user-agent/${userAgent}`);
49307
+ }
49308
+ function splitUserAgentTokens2(value) {
49309
+ return value?.trim().split(/\s+/).filter(Boolean) ?? [];
49310
+ }
49311
+ function appendUserAgentToken2(value, userAgent) {
49312
+ const tokens = splitUserAgentTokens2(value);
49313
+ const seen = new Set(tokens);
49314
+ for (const token of splitUserAgentTokens2(userAgent)) {
49315
+ if (!seen.has(token)) {
49316
+ tokens.push(token);
49317
+ seen.add(token);
49318
+ }
49319
+ }
49320
+ return tokens.join(" ");
49321
+ }
49322
+ function getEffectiveUserAgent2(userAgent) {
49323
+ return appendUserAgentToken2(sdkUserAgentHostToken2.get(), userAgent);
49324
+ }
49325
+ function isHeadersLike2(headers) {
49326
+ return typeof headers === "object" && headers !== null && "get" in headers && typeof headers.get === "function" && "set" in headers && typeof headers.set === "function";
49327
+ }
49328
+ function getSdkUserAgentToken2(pkg) {
49329
+ const packageName = pkg.name.replace(/^@uipath\//, "");
49330
+ return getEffectiveUserAgent2(`${packageName}/${pkg.version}`);
49331
+ }
49332
+ function addSdkUserAgentHeader2(headers, userAgent) {
49333
+ const result = { ...headers ?? {} };
49334
+ const effectiveUserAgent = getEffectiveUserAgent2(userAgent);
49335
+ const headerName = Object.keys(result).find((key) => key.toLowerCase() === USER_AGENT_HEADER2.toLowerCase());
49336
+ if (headerName) {
49337
+ result[headerName] = appendUserAgentToken2(result[headerName], effectiveUserAgent);
49338
+ } else {
49339
+ result[USER_AGENT_HEADER2] = effectiveUserAgent;
49340
+ }
49341
+ return result;
49342
+ }
49343
+ function withSdkUserAgentHeader2(headers, userAgent) {
49344
+ const effectiveUserAgent = getEffectiveUserAgent2(userAgent);
49345
+ if (isHeadersLike2(headers)) {
49346
+ headers.set(USER_AGENT_HEADER2, appendUserAgentToken2(headers.get(USER_AGENT_HEADER2), effectiveUserAgent));
49347
+ return headers;
49348
+ }
49349
+ if (Array.isArray(headers)) {
49350
+ const result = headers.map((entry) => {
49351
+ const [key, value] = entry;
49352
+ return [key, value];
49353
+ });
49354
+ const headerIndex = result.findIndex(([key]) => key.toLowerCase() === USER_AGENT_HEADER2.toLowerCase());
49355
+ if (headerIndex >= 0) {
49356
+ const [key, value] = result[headerIndex];
49357
+ result[headerIndex] = [
49358
+ key,
49359
+ appendUserAgentToken2(value, effectiveUserAgent)
49360
+ ];
49361
+ } else {
49362
+ result.push([USER_AGENT_HEADER2, effectiveUserAgent]);
49363
+ }
49364
+ return result;
49365
+ }
49366
+ return addSdkUserAgentHeader2(typeof headers === "object" && headers !== null ? { ...headers } : {}, effectiveUserAgent);
49367
+ }
49368
+ function withUserAgentInitOverride2(initOverrides, userAgent) {
49369
+ return async (requestContext) => {
49370
+ const initWithUserAgent = {
49371
+ ...requestContext.init,
49372
+ headers: withSdkUserAgentHeader2(requestContext.init.headers, userAgent)
49373
+ };
49374
+ const override = typeof initOverrides === "function" ? await initOverrides({
49375
+ ...requestContext,
49376
+ init: initWithUserAgent
49377
+ }) : initOverrides;
49378
+ return {
49379
+ ...override ?? {},
49380
+ headers: withSdkUserAgentHeader2(override?.headers ?? initWithUserAgent.headers, userAgent)
49381
+ };
49382
+ };
49383
+ }
49384
+ function installSdkUserAgentHeader2(BaseApiClass, userAgent) {
49385
+ const prototype = BaseApiClass.prototype;
49386
+ const patchKey = userAgentPatchKey2(userAgent);
49387
+ if (prototype[patchKey]) {
49388
+ return;
49389
+ }
49390
+ if (typeof prototype.request !== "function") {
49391
+ throw new Error("Generated BaseAPI request function not found.");
49392
+ }
49393
+ const originalRequest = prototype.request;
49394
+ prototype.request = function requestWithUserAgent(context, initOverrides) {
49395
+ return originalRequest.call(this, context, withUserAgentInitOverride2(initOverrides, userAgent));
49396
+ };
49397
+ Object.defineProperty(prototype, patchKey, {
49398
+ value: true
49399
+ });
49400
+ }
48679
49401
  var BASE_PATH2 = "http://localhost".replace(/\/+$/, "");
48680
49402
 
48681
49403
  class Configuration2 {
@@ -48943,6 +49665,53 @@ class TextApiResponse {
48943
49665
  return await this.raw.text();
48944
49666
  }
48945
49667
  }
49668
+ var package_default22 = {
49669
+ name: "@uipath/aops-policy-sdk",
49670
+ license: "MIT",
49671
+ version: "1.195.0",
49672
+ description: "SDK for the UiPath AOps Governance API — policy management and deployment.",
49673
+ repository: {
49674
+ type: "git",
49675
+ url: "https://github.com/UiPath/cli.git",
49676
+ directory: "packages/gov/aops-policy-sdk"
49677
+ },
49678
+ publishConfig: {
49679
+ registry: "https://npm.pkg.github.com/@uipath"
49680
+ },
49681
+ keywords: [
49682
+ "uipath",
49683
+ "governance",
49684
+ "policy",
49685
+ "sdk"
49686
+ ],
49687
+ type: "module",
49688
+ main: "./dist/index.js",
49689
+ types: "./dist/src/index.d.ts",
49690
+ exports: {
49691
+ ".": {
49692
+ types: "./dist/src/index.d.ts",
49693
+ default: "./dist/index.js"
49694
+ }
49695
+ },
49696
+ files: [
49697
+ "dist"
49698
+ ],
49699
+ private: true,
49700
+ scripts: {
49701
+ build: "bun build ./src/index.ts --outdir dist --format esm --target node && tsc -p tsconfig.build.json --noCheck",
49702
+ generate: "bun run src/scripts/generate-sdk.ts",
49703
+ lint: "biome check ."
49704
+ },
49705
+ devDependencies: {
49706
+ "@openapitools/openapi-generator-cli": "^2.31.1",
49707
+ "@types/node": "^25.5.2",
49708
+ "@uipath/auth": "workspace:*",
49709
+ "@uipath/common": "workspace:*",
49710
+ typescript: "^6.0.2"
49711
+ }
49712
+ };
49713
+ var SDK_USER_AGENT2 = getSdkUserAgentToken2(package_default22);
49714
+ installSdkUserAgentHeader2(BaseAPI2, SDK_USER_AGENT2);
48946
49715
  function AddLicenseTypeRequestToJSON(json2) {
48947
49716
  return AddLicenseTypeRequestToJSONTyped(json2, false);
48948
49717
  }
@@ -51599,32 +52368,7 @@ class InvalidBaseUrlError2 extends Error {
51599
52368
  this.name = "InvalidBaseUrlError";
51600
52369
  }
51601
52370
  }
51602
- var DEFAULT_SCOPES2 = [
51603
- "offline_access",
51604
- "ProcessMining",
51605
- "OrchestratorApiUserAccess",
51606
- "StudioWebBackend",
51607
- "IdentityServerApi",
51608
- "ConnectionService",
51609
- "DataService",
51610
- "DataServiceApiUserAccess",
51611
- "DocumentUnderstanding",
51612
- "EnterpriseContextService",
51613
- "Directory",
51614
- "JamJamApi",
51615
- "LLMGateway",
51616
- "LLMOps",
51617
- "OMS",
51618
- "RCS.FolderAuthorization",
51619
- "RCS.TagsManagement",
51620
- "TestmanagerApiUserAccess",
51621
- "AutomationSolutions",
51622
- "StudioWebTypeCacheService",
51623
- "Docs.GPT.Search",
51624
- "Insights",
51625
- "ReferenceToken",
51626
- "Audit.Read"
51627
- ];
52371
+ var DEFAULT_SCOPES2 = ["openid", "profile", "offline_access"];
51628
52372
  var normalizeAndValidateBaseUrl2 = (rawUrl) => {
51629
52373
  let baseUrl = rawUrl;
51630
52374
  if (baseUrl.endsWith("/identity_/")) {
@@ -51674,7 +52418,8 @@ var resolveConfigAsync2 = async ({
51674
52418
  if (!clientSecret && fileAuth.clientSecret) {
51675
52419
  clientSecret = fileAuth.clientSecret;
51676
52420
  }
51677
- const scopes = customScopes && customScopes.length > 0 ? customScopes : fileAuth.scopes && fileAuth.scopes.length > 0 ? fileAuth.scopes : DEFAULT_SCOPES2;
52421
+ const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID2 && Boolean(clientSecret);
52422
+ const scopes = customScopes && customScopes.length > 0 ? customScopes : fileAuth.scopes && fileAuth.scopes.length > 0 ? fileAuth.scopes : isExternalAppAuth ? [] : DEFAULT_SCOPES2;
51678
52423
  return {
51679
52424
  clientId,
51680
52425
  clientSecret,
@@ -52161,6 +52906,129 @@ function normalizeTokenRefreshFailure2() {
52161
52906
  function normalizeTokenRefreshUnavailableFailure2() {
52162
52907
  return "token refresh failed before authentication completed";
52163
52908
  }
52909
+ function errorMessage2(error) {
52910
+ return error instanceof Error ? error.message : String(error);
52911
+ }
52912
+ function computeExpirationThreshold2(ensureTokenValidityMinutes) {
52913
+ return new Date(Date.now() + (ensureTokenValidityMinutes ?? 0) * 60 * 1000);
52914
+ }
52915
+ async function runRefreshLocked2(inputs) {
52916
+ const {
52917
+ absolutePath,
52918
+ refreshToken: callerRefreshToken,
52919
+ customAuthority,
52920
+ ensureTokenValidityMinutes,
52921
+ loadEnvFile,
52922
+ saveEnvFile,
52923
+ refreshFn,
52924
+ resolveConfig: resolveConfig2
52925
+ } = inputs;
52926
+ const expirationThreshold = computeExpirationThreshold2(ensureTokenValidityMinutes);
52927
+ let fresh;
52928
+ try {
52929
+ fresh = await loadEnvFile({ envPath: absolutePath });
52930
+ } catch (error) {
52931
+ return {
52932
+ kind: "fail",
52933
+ status: {
52934
+ loginStatus: "Refresh Failed",
52935
+ hint: "Could not read the auth file while refreshing. Retry, or run 'uip login' to re-authenticate.",
52936
+ tokenRefresh: {
52937
+ attempted: false,
52938
+ success: false,
52939
+ errorMessage: `auth file read failed: ${errorMessage2(error)}`
52940
+ }
52941
+ }
52942
+ };
52943
+ }
52944
+ const freshAccess = fresh.UIPATH_ACCESS_TOKEN;
52945
+ const freshExp = freshAccess ? getTokenExpiration2(freshAccess) : undefined;
52946
+ if (freshAccess && freshExp && freshExp > expirationThreshold) {
52947
+ return {
52948
+ kind: "ok",
52949
+ accessToken: freshAccess,
52950
+ refreshToken: fresh.UIPATH_REFRESH_TOKEN ?? callerRefreshToken,
52951
+ expiration: freshExp,
52952
+ tokenRefresh: { attempted: false, success: true }
52953
+ };
52954
+ }
52955
+ const tokenForIdP = fresh.UIPATH_REFRESH_TOKEN ?? callerRefreshToken;
52956
+ let refreshedAccess;
52957
+ let refreshedRefresh;
52958
+ try {
52959
+ const config = await resolveConfig2({ customAuthority });
52960
+ const refreshed = await refreshFn({
52961
+ refreshToken: tokenForIdP,
52962
+ tokenEndpoint: config.tokenEndpoint,
52963
+ clientId: config.clientId,
52964
+ expectedAuthority: customAuthority
52965
+ });
52966
+ refreshedAccess = refreshed.accessToken;
52967
+ refreshedRefresh = refreshed.refreshToken;
52968
+ } catch (error) {
52969
+ const isOAuthFailure = isTokenRefreshOAuthFailure2(error);
52970
+ 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.";
52971
+ const message = isOAuthFailure ? normalizeTokenRefreshFailure2() : normalizeTokenRefreshUnavailableFailure2();
52972
+ return {
52973
+ kind: "fail",
52974
+ status: {
52975
+ loginStatus: "Refresh Failed",
52976
+ hint,
52977
+ tokenRefresh: {
52978
+ attempted: true,
52979
+ success: false,
52980
+ errorMessage: message
52981
+ }
52982
+ }
52983
+ };
52984
+ }
52985
+ const refreshedExp = getTokenExpiration2(refreshedAccess);
52986
+ if (!refreshedExp || refreshedExp <= new Date) {
52987
+ return {
52988
+ kind: "fail",
52989
+ status: {
52990
+ loginStatus: "Refresh Failed",
52991
+ hint: "The identity server returned an unusable token. Run 'uip login' to re-authenticate.",
52992
+ tokenRefresh: {
52993
+ attempted: true,
52994
+ success: false,
52995
+ errorMessage: "refreshed token has no valid expiration claim"
52996
+ }
52997
+ }
52998
+ };
52999
+ }
53000
+ try {
53001
+ await saveEnvFile({
53002
+ envPath: absolutePath,
53003
+ data: {
53004
+ UIPATH_ACCESS_TOKEN: refreshedAccess,
53005
+ UIPATH_REFRESH_TOKEN: refreshedRefresh
53006
+ },
53007
+ merge: true
53008
+ });
53009
+ return {
53010
+ kind: "ok",
53011
+ accessToken: refreshedAccess,
53012
+ refreshToken: refreshedRefresh,
53013
+ expiration: refreshedExp,
53014
+ tokenRefresh: { attempted: true, success: true }
53015
+ };
53016
+ } catch (error) {
53017
+ const msg = errorMessage2(error);
53018
+ return {
53019
+ kind: "ok",
53020
+ accessToken: refreshedAccess,
53021
+ refreshToken: refreshedRefresh,
53022
+ expiration: refreshedExp,
53023
+ 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.`,
53024
+ tokenRefresh: {
53025
+ attempted: true,
53026
+ success: true,
53027
+ errorMessage: `persistence failed: ${msg}`
53028
+ }
53029
+ };
53030
+ }
53031
+ }
52164
53032
  var getLoginStatusWithDeps2 = async (options = {}, deps = {}) => {
52165
53033
  const {
52166
53034
  resolveEnvFilePath = resolveEnvFilePathAsync2,
@@ -52235,73 +53103,103 @@ var getLoginStatusWithDeps2 = async (options = {}, deps = {}) => {
52235
53103
  let refreshToken = credentials.UIPATH_REFRESH_TOKEN;
52236
53104
  let expiration = getTokenExpiration2(accessToken);
52237
53105
  let persistenceWarning;
53106
+ let lockReleaseFailed = false;
52238
53107
  let tokenRefresh;
52239
- const expirationThreshold = new Date(Date.now() + (ensureTokenValidityMinutes ?? 0) * 60 * 1000);
52240
- if (expiration && expiration <= expirationThreshold && refreshToken) {
52241
- let refreshedAccess;
52242
- let refreshedRefresh;
53108
+ const outerThreshold = computeExpirationThreshold2(ensureTokenValidityMinutes);
53109
+ const tryGlobalCredsHint = async () => {
53110
+ const fs72 = getFs();
53111
+ const globalPath = fs72.path.join(fs72.env.homedir(), envFilePath);
53112
+ if (absolutePath === globalPath)
53113
+ return;
53114
+ if (!await fs72.exists(globalPath))
53115
+ return;
52243
53116
  try {
52244
- const config = await resolveConfig2({
52245
- customAuthority: credentials.UIPATH_URL
52246
- });
52247
- const refreshed = await refreshTokenFn({
52248
- refreshToken,
52249
- tokenEndpoint: config.tokenEndpoint,
52250
- clientId: config.clientId,
52251
- expectedAuthority: credentials.UIPATH_URL
52252
- });
52253
- refreshedAccess = refreshed.accessToken;
52254
- refreshedRefresh = refreshed.refreshToken;
53117
+ const globalCreds = await loadEnvFile({ envPath: globalPath });
53118
+ if (!globalCreds.UIPATH_ACCESS_TOKEN)
53119
+ return;
53120
+ const globalExp = getTokenExpiration2(globalCreds.UIPATH_ACCESS_TOKEN);
53121
+ if (globalExp && globalExp <= new Date)
53122
+ return;
53123
+ 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.`;
53124
+ } catch {
53125
+ return;
53126
+ }
53127
+ };
53128
+ if (expiration && expiration <= outerThreshold && refreshToken) {
53129
+ let release;
53130
+ try {
53131
+ release = await getFs().acquireLock(absolutePath);
52255
53132
  } catch (error) {
52256
- const isOAuthFailure = isTokenRefreshOAuthFailure2(error);
52257
- 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.";
52258
- const errorMessage = isOAuthFailure ? normalizeTokenRefreshFailure2() : normalizeTokenRefreshUnavailableFailure2();
53133
+ const msg = errorMessage2(error);
53134
+ const globalHint = await tryGlobalCredsHint();
53135
+ if (globalHint) {
53136
+ return {
53137
+ loginStatus: "Expired",
53138
+ accessToken,
53139
+ refreshToken,
53140
+ baseUrl: credentials.UIPATH_URL,
53141
+ organizationName: credentials.UIPATH_ORGANIZATION_NAME,
53142
+ organizationId: credentials.UIPATH_ORGANIZATION_ID,
53143
+ tenantName: credentials.UIPATH_TENANT_NAME,
53144
+ tenantId: credentials.UIPATH_TENANT_ID,
53145
+ expiration,
53146
+ source: "file",
53147
+ hint: globalHint,
53148
+ tokenRefresh: {
53149
+ attempted: false,
53150
+ success: false,
53151
+ errorMessage: `lock acquisition failed: ${msg}`
53152
+ }
53153
+ };
53154
+ }
52259
53155
  return {
52260
53156
  loginStatus: "Refresh Failed",
52261
- hint,
53157
+ 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.",
52262
53158
  tokenRefresh: {
52263
- attempted: true,
53159
+ attempted: false,
52264
53160
  success: false,
52265
- errorMessage
53161
+ errorMessage: `lock acquisition failed: ${msg}`
52266
53162
  }
52267
53163
  };
52268
53164
  }
52269
- const refreshedExp = getTokenExpiration2(refreshedAccess);
52270
- if (!refreshedExp || refreshedExp <= new Date) {
52271
- return {
52272
- loginStatus: "Refresh Failed",
52273
- hint: "The identity server returned an unusable token. Run 'uip login' to re-authenticate.",
52274
- tokenRefresh: {
52275
- attempted: true,
52276
- success: false,
52277
- errorMessage: "refreshed token has no valid expiration claim"
53165
+ let lockedFailure;
53166
+ try {
53167
+ const outcome = await runRefreshLocked2({
53168
+ absolutePath,
53169
+ refreshToken,
53170
+ customAuthority: credentials.UIPATH_URL,
53171
+ ensureTokenValidityMinutes,
53172
+ loadEnvFile,
53173
+ saveEnvFile,
53174
+ refreshFn: refreshTokenFn,
53175
+ resolveConfig: resolveConfig2
53176
+ });
53177
+ if (outcome.kind === "fail") {
53178
+ lockedFailure = outcome.status;
53179
+ } else {
53180
+ accessToken = outcome.accessToken;
53181
+ refreshToken = outcome.refreshToken;
53182
+ expiration = outcome.expiration;
53183
+ tokenRefresh = outcome.tokenRefresh;
53184
+ if (outcome.persistenceWarning) {
53185
+ persistenceWarning = outcome.persistenceWarning;
52278
53186
  }
52279
- };
53187
+ }
53188
+ } finally {
53189
+ try {
53190
+ await release();
53191
+ } catch {
53192
+ lockReleaseFailed = true;
53193
+ }
52280
53194
  }
52281
- accessToken = refreshedAccess;
52282
- refreshToken = refreshedRefresh;
52283
- expiration = refreshedExp;
52284
- try {
52285
- await saveEnvFile({
52286
- envPath: absolutePath,
52287
- data: {
52288
- UIPATH_ACCESS_TOKEN: accessToken,
52289
- UIPATH_REFRESH_TOKEN: refreshToken
52290
- },
52291
- merge: true
52292
- });
52293
- tokenRefresh = {
52294
- attempted: true,
52295
- success: true
52296
- };
52297
- } catch (error) {
52298
- const msg = error instanceof Error ? error.message : String(error);
52299
- 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.`;
52300
- tokenRefresh = {
52301
- attempted: true,
52302
- success: true,
52303
- errorMessage: `persistence failed: ${msg}`
52304
- };
53195
+ if (lockedFailure) {
53196
+ const globalHint = await tryGlobalCredsHint();
53197
+ const base = globalHint ? {
53198
+ ...lockedFailure,
53199
+ loginStatus: "Expired",
53200
+ hint: globalHint
53201
+ } : lockedFailure;
53202
+ return lockReleaseFailed ? { ...base, lockReleaseFailed: true } : base;
52305
53203
  }
52306
53204
  }
52307
53205
  const result = {
@@ -52316,23 +53214,13 @@ var getLoginStatusWithDeps2 = async (options = {}, deps = {}) => {
52316
53214
  expiration,
52317
53215
  source: "file",
52318
53216
  ...persistenceWarning ? { hint: persistenceWarning, persistenceFailed: true } : {},
53217
+ ...lockReleaseFailed ? { lockReleaseFailed: true } : {},
52319
53218
  ...tokenRefresh ? { tokenRefresh } : {}
52320
53219
  };
52321
53220
  if (result.loginStatus === "Expired") {
52322
- const fs72 = getFs();
52323
- const globalPath = fs72.path.join(fs72.env.homedir(), envFilePath);
52324
- if (absolutePath !== globalPath && await fs72.exists(globalPath)) {
52325
- try {
52326
- const globalCreds = await loadEnvFile({
52327
- envPath: globalPath
52328
- });
52329
- if (globalCreds.UIPATH_ACCESS_TOKEN) {
52330
- const globalExp = getTokenExpiration2(globalCreds.UIPATH_ACCESS_TOKEN);
52331
- if (!globalExp || globalExp > new Date) {
52332
- 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.`;
52333
- }
52334
- }
52335
- } catch {}
53221
+ const globalHint = await tryGlobalCredsHint();
53222
+ if (globalHint) {
53223
+ result.hint = globalHint;
52336
53224
  }
52337
53225
  }
52338
53226
  return result;
@@ -52347,6 +53235,7 @@ var getLoginStatusAsync2 = async (options = {}) => {
52347
53235
  };
52348
53236
  init_src2();
52349
53237
  init_src2();
53238
+ init_server2();
52350
53239
  async function createGovernanceConfig(options) {
52351
53240
  const status = await getLoginStatusAsync2({
52352
53241
  ensureTokenValidityMinutes: options?.loginValidity
@@ -52362,7 +53251,8 @@ async function createGovernanceConfig(options) {
52362
53251
  const bearerToken = options?.s2sToken ?? status.accessToken;
52363
53252
  return new Configuration2({
52364
53253
  basePath,
52365
- apiKey: () => `Bearer ${bearerToken}`
53254
+ apiKey: () => `Bearer ${bearerToken}`,
53255
+ headers: addSdkUserAgentHeader2(undefined, SDK_USER_AGENT2)
52366
53256
  });
52367
53257
  }
52368
53258
  async function createApiClient2(ApiClass, options) {
@@ -52501,10 +53391,15 @@ async function extractErrorDetails2(error, options) {
52501
53391
  }
52502
53392
  if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
52503
53393
  context.errorCode = parsedBody.errorCode;
53394
+ } else if (parsedBody?.code && typeof parsedBody.code === "string") {
53395
+ context.errorCode = parsedBody.code;
52504
53396
  }
52505
53397
  if (parsedBody?.requestId && typeof parsedBody.requestId === "string") {
52506
53398
  context.requestId = parsedBody.requestId;
52507
53399
  }
53400
+ if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
53401
+ context.traceId = parsedBody.traceId;
53402
+ }
52508
53403
  if (status === 429) {
52509
53404
  const resp = response;
52510
53405
  const headersObj = resp?.headers;
@@ -52524,7 +53419,35 @@ async function extractErrorDetails2(error, options) {
52524
53419
  }
52525
53420
  }
52526
53421
  const hasContext = Object.keys(context).length > 0;
52527
- return { result, message, details, ...hasContext ? { context } : {} };
53422
+ let parsedErrors;
53423
+ if (parsedBody?.errors && typeof parsedBody.errors === "object") {
53424
+ const errors = {};
53425
+ for (const [field, raw] of Object.entries(parsedBody.errors)) {
53426
+ if (Array.isArray(raw)) {
53427
+ const messages = raw.map((entry) => {
53428
+ if (typeof entry === "string")
53429
+ return entry;
53430
+ if (entry && typeof entry === "object" && typeof entry.message === "string") {
53431
+ return entry.message;
53432
+ }
53433
+ return String(entry);
53434
+ }).filter(Boolean);
53435
+ if (messages.length > 0)
53436
+ errors[field] = messages;
53437
+ } else if (typeof raw === "string") {
53438
+ errors[field] = [raw];
53439
+ }
53440
+ }
53441
+ if (Object.keys(errors).length > 0)
53442
+ parsedErrors = errors;
53443
+ }
53444
+ return {
53445
+ result,
53446
+ message,
53447
+ details,
53448
+ ...hasContext ? { context } : {},
53449
+ ...parsedErrors ? { parsedErrors } : {}
53450
+ };
52528
53451
  }
52529
53452
  async function extractErrorMessage2(error, options) {
52530
53453
  const { message } = await extractErrorDetails2(error, options);
@@ -52535,34 +53458,6 @@ Command.prototype.examples = function(examples) {
52535
53458
  examplesByCommand2.set(this, examples);
52536
53459
  return this;
52537
53460
  };
52538
- var PREFIX2 = "@uipath/common/";
52539
- var _g2 = globalThis;
52540
- function singleton2(ctorOrName) {
52541
- const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
52542
- const key = Symbol.for(PREFIX2 + name);
52543
- return {
52544
- get(fallback) {
52545
- return _g2[key] ?? fallback;
52546
- },
52547
- set(value) {
52548
- _g2[key] = value;
52549
- },
52550
- clear() {
52551
- delete _g2[key];
52552
- },
52553
- getOrInit(factory, guard) {
52554
- const existing = _g2[key];
52555
- if (existing != null && typeof existing === "object") {
52556
- if (!guard || guard(existing)) {
52557
- return existing;
52558
- }
52559
- }
52560
- const instance = factory();
52561
- _g2[key] = instance;
52562
- return instance;
52563
- }
52564
- };
52565
- }
52566
53461
  function createStorage2() {
52567
53462
  const [error, mod2] = catchError22(() => __require3("node:async_hooks"));
52568
53463
  if (error || typeof mod2?.AsyncLocalStorage !== "function") {
@@ -57629,6 +58524,60 @@ function escapeNonAscii2(jsonText) {
57629
58524
  function needsAsciiSafeJson2(sink) {
57630
58525
  return process.platform === "win32" && !sink.capabilities.isInteractive;
57631
58526
  }
58527
+ function isPlainRecord2(value) {
58528
+ if (value === null || typeof value !== "object")
58529
+ return false;
58530
+ const prototype = Object.getPrototypeOf(value);
58531
+ return prototype === Object.prototype || prototype === null;
58532
+ }
58533
+ function toLowerCamelCaseKey2(key) {
58534
+ if (!key)
58535
+ return key;
58536
+ if (/[_\-\s]/.test(key)) {
58537
+ const [firstPart, ...restParts] = key.split(/[_\-\s]+/).filter(Boolean);
58538
+ if (!firstPart)
58539
+ return key;
58540
+ return [
58541
+ toLowerCamelCaseSimpleKey2(firstPart),
58542
+ ...restParts.map((part) => {
58543
+ const normalized = toLowerCamelCaseSimpleKey2(part);
58544
+ return normalized.charAt(0).toUpperCase() + normalized.slice(1);
58545
+ })
58546
+ ].join("");
58547
+ }
58548
+ return toLowerCamelCaseSimpleKey2(key);
58549
+ }
58550
+ function toLowerCamelCaseSimpleKey2(key) {
58551
+ if (/^[A-Z0-9]+$/.test(key))
58552
+ return key.toLowerCase();
58553
+ return key.replace(/^[A-Z]+(?=[A-Z][a-z]|\d|$)|^[A-Z]/, (match) => match.toLowerCase());
58554
+ }
58555
+ function toPascalCaseKey2(key) {
58556
+ const lowerCamelKey = toLowerCamelCaseKey2(key);
58557
+ return lowerCamelKey ? lowerCamelKey.charAt(0).toUpperCase() + lowerCamelKey.slice(1) : lowerCamelKey;
58558
+ }
58559
+ function toPascalCaseData2(value) {
58560
+ if (Array.isArray(value))
58561
+ return value.map(toPascalCaseData2);
58562
+ if (!isPlainRecord2(value))
58563
+ return value;
58564
+ const result = {};
58565
+ for (const [key, nestedValue] of Object.entries(value)) {
58566
+ result[toPascalCaseKey2(key)] = toPascalCaseData2(nestedValue);
58567
+ }
58568
+ return result;
58569
+ }
58570
+ function normalizeDataKeys2(data) {
58571
+ return toPascalCaseData2(data);
58572
+ }
58573
+ function normalizeOutputKeys2(data) {
58574
+ const result = {};
58575
+ for (const [key, value] of Object.entries(data)) {
58576
+ const pascalKey = toPascalCaseKey2(key);
58577
+ result[pascalKey] = pascalKey === "Data" ? value : toPascalCaseData2(value);
58578
+ }
58579
+ return result;
58580
+ }
57632
58581
  function printOutput2(data, format = "json", logFn, asciiSafe = false) {
57633
58582
  if (!data) {
57634
58583
  logFn("Empty response object. No data to display.");
@@ -57691,7 +58640,7 @@ function wrapText2(text, width) {
57691
58640
  function printTable2(data, logFn, externalLogValue) {
57692
58641
  if (data.length === 0)
57693
58642
  return;
57694
- const keys = Object.keys(data[0]).filter((key) => key !== "Code" && key !== "Log");
58643
+ const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
57695
58644
  const maxWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString2(item[key]).length)));
57696
58645
  const header = keys.map((key, i22) => key.padEnd(maxWidths[i22])).join(" | ");
57697
58646
  logFn(header);
@@ -57706,7 +58655,7 @@ function printTable2(data, logFn, externalLogValue) {
57706
58655
  }
57707
58656
  }
57708
58657
  function printVerticalTable2(data, logFn = console.log, externalLogValue) {
57709
- const keys = Object.keys(data).filter((key) => key !== "Code" && key !== "Log");
58658
+ const keys = Object.keys(data).filter((key) => !["code", "log"].includes(key.toLowerCase()));
57710
58659
  if (keys.length === 0)
57711
58660
  return;
57712
58661
  const maxKeyWidth = Math.max(...keys.map((key) => key.length));
@@ -57722,7 +58671,7 @@ function printVerticalTable2(data, logFn = console.log, externalLogValue) {
57722
58671
  function printResizableTable2(data, logFn = console.log, externalLogValue) {
57723
58672
  if (data.length === 0)
57724
58673
  return;
57725
- const keys = Object.keys(data[0]).filter((key) => key !== "Code" && key !== "Log");
58674
+ const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
57726
58675
  if (keys.length === 0)
57727
58676
  return;
57728
58677
  if (!process.stdout.isTTY) {
@@ -57798,8 +58747,27 @@ function printResizableTable2(data, logFn = console.log, externalLogValue) {
57798
58747
  function toYaml2(data) {
57799
58748
  return dump2(data);
57800
58749
  }
58750
+
58751
+ class FilterEvaluationError2 extends Error {
58752
+ __brand = "FilterEvaluationError";
58753
+ filter;
58754
+ instructions;
58755
+ result = RESULTS2.ValidationError;
58756
+ constructor(filter, cause) {
58757
+ const underlying = cause instanceof Error ? cause.message : String(cause);
58758
+ super(`Filter '${filter}' failed to evaluate: ${underlying}`);
58759
+ this.name = "FilterEvaluationError";
58760
+ this.filter = filter;
58761
+ 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(@)'.";
58762
+ }
58763
+ }
57801
58764
  function applyFilter2(data, filter) {
57802
- const result = search2(data, filter);
58765
+ let result;
58766
+ try {
58767
+ result = search2(data, filter);
58768
+ } catch (err) {
58769
+ throw new FilterEvaluationError2(filter, err);
58770
+ }
57803
58771
  if (result == null)
57804
58772
  return [];
57805
58773
  if (Array.isArray(result)) {
@@ -57816,13 +58784,18 @@ function applyFilter2(data, filter) {
57816
58784
  }
57817
58785
  var OutputFormatter2;
57818
58786
  ((OutputFormatter3) => {
57819
- function success(data) {
58787
+ function success(data, options) {
57820
58788
  data.Log ??= getLogFilePath2() || undefined;
58789
+ const normalize = !options?.preserveDataKeys;
58790
+ if (normalize) {
58791
+ data.Data = normalizeDataKeys2(data.Data);
58792
+ }
57821
58793
  const filter = getOutputFilter2();
57822
58794
  if (filter) {
57823
- data.Data = applyFilter2(data.Data, filter);
58795
+ const filtered = applyFilter2(data.Data, filter);
58796
+ data.Data = normalize ? normalizeDataKeys2(filtered) : filtered;
57824
58797
  }
57825
- logOutput2(data, getOutputFormat2());
58798
+ logOutput2(normalizeOutputKeys2(data), getOutputFormat2());
57826
58799
  }
57827
58800
  OutputFormatter3.success = success;
57828
58801
  function error(data) {
@@ -57832,7 +58805,7 @@ var OutputFormatter2;
57832
58805
  result: data.Result,
57833
58806
  message: data.Message
57834
58807
  });
57835
- logOutput2(data, getOutputFormat2());
58808
+ logOutput2(normalizeOutputKeys2(data), getOutputFormat2());
57836
58809
  }
57837
58810
  OutputFormatter3.error = error;
57838
58811
  function emitList(code, items, opts) {
@@ -57853,13 +58826,14 @@ var OutputFormatter2;
57853
58826
  function log(data) {
57854
58827
  const format = getOutputFormat2();
57855
58828
  const sink = getOutputSink2();
58829
+ const normalized = toPascalCaseData2(data);
57856
58830
  if (format === "json") {
57857
- const json22 = JSON.stringify(data);
58831
+ const json22 = JSON.stringify(normalized);
57858
58832
  const safe = needsAsciiSafeJson2(sink) ? escapeNonAscii2(json22) : json22;
57859
58833
  sink.writeErr(`${safe}
57860
58834
  `);
57861
58835
  } else {
57862
- for (const [key, value] of Object.entries(data)) {
58836
+ for (const [key, value] of Object.entries(normalized)) {
57863
58837
  sink.writeErr(`${key}: ${value}
57864
58838
  `);
57865
58839
  }
@@ -57868,12 +58842,16 @@ var OutputFormatter2;
57868
58842
  OutputFormatter3.log = log;
57869
58843
  function formatToString(data) {
57870
58844
  const filter = getOutputFilter2();
57871
- if (filter && "Data" in data && data.Data != null) {
57872
- data.Data = applyFilter2(data.Data, filter);
58845
+ if ("Data" in data && data.Data != null) {
58846
+ data.Data = normalizeDataKeys2(data.Data);
58847
+ if (filter) {
58848
+ data.Data = normalizeDataKeys2(applyFilter2(data.Data, filter));
58849
+ }
57873
58850
  }
58851
+ const output = normalizeOutputKeys2(data);
57874
58852
  const lines = [];
57875
58853
  const sink = getOutputSink2();
57876
- printOutput2(data, getOutputFormat2(), (msg) => {
58854
+ printOutput2(output, getOutputFormat2(), (msg) => {
57877
58855
  lines.push(msg);
57878
58856
  }, needsAsciiSafeJson2(sink));
57879
58857
  return lines.join(`
@@ -59282,6 +60260,19 @@ JSONPath2.prototype.safeVm = {
59282
60260
  Script: SafeScript2
59283
60261
  };
59284
60262
  JSONPath2.prototype.vm = vm2;
60263
+ var PollOutcome2 = {
60264
+ Completed: "completed",
60265
+ Timeout: "timeout",
60266
+ Interrupted: "interrupted",
60267
+ Aborted: "aborted",
60268
+ Failed: "failed"
60269
+ };
60270
+ var REASON_BY_OUTCOME2 = {
60271
+ [PollOutcome2.Timeout]: "poll_timeout",
60272
+ [PollOutcome2.Failed]: "poll_failed",
60273
+ [PollOutcome2.Interrupted]: "poll_failed",
60274
+ [PollOutcome2.Aborted]: "poll_aborted"
60275
+ };
59285
60276
  var TERMINAL_STATUSES2 = new Set([
59286
60277
  "completed",
59287
60278
  "successful",
@@ -59481,17 +60472,21 @@ Command.prototype.trackedAction = function(context, fn, properties) {
59481
60472
  const telemetryName = deriveCommandPath2(command);
59482
60473
  const props = typeof properties === "function" ? properties(...args) : properties;
59483
60474
  const startTime = performance.now();
59484
- let errorMessage;
60475
+ let errorMessage22;
59485
60476
  const [error] = await catchError22(fn(...args));
59486
60477
  if (error) {
59487
- errorMessage = error instanceof Error ? error.message : String(error);
59488
- logger2.error(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
60478
+ errorMessage22 = error instanceof Error ? error.message : String(error);
60479
+ logger2.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage22}`);
60480
+ const typed = error;
60481
+ const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
60482
+ const customResult = typeof typed.result === "string" && typed.result !== RESULTS2.Success && Object.values(RESULTS2).includes(typed.result) ? typed.result : undefined;
60483
+ const finalResult = customResult ?? RESULTS2.Failure;
59489
60484
  OutputFormatter2.error({
59490
- Result: RESULTS2.Failure,
59491
- Message: errorMessage,
59492
- Instructions: "An unexpected error occurred. Run with --log-level debug for details."
60485
+ Result: finalResult,
60486
+ Message: errorMessage22,
60487
+ Instructions: customInstructions ?? "An unexpected error occurred. Run with --log-level debug for details."
59493
60488
  });
59494
- context.exit(1);
60489
+ context.exit(EXIT_CODES2[finalResult]);
59495
60490
  }
59496
60491
  const durationMs = performance.now() - startTime;
59497
60492
  const success = !error && (process.exitCode === undefined || process.exitCode === 0);
@@ -59500,7 +60495,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
59500
60495
  ...props,
59501
60496
  duration: String(durationMs),
59502
60497
  success: String(success),
59503
- ...errorMessage ? { errorMessage } : {}
60498
+ ...errorMessage22 ? { errorMessage: errorMessage22 } : {}
59504
60499
  }));
59505
60500
  });
59506
60501
  };
@@ -63372,7 +64367,7 @@ var registerAopsPolicyCommand = (program2) => {
63372
64367
  };
63373
64368
  var metadata2 = {
63374
64369
  name: "aops-policy-tool",
63375
- version: package_default2.version,
64370
+ version: package_default3.version,
63376
64371
  description: "Manage UiPath AOps governance policies.",
63377
64372
  commandPrefix: "gov"
63378
64373
  };
@@ -63380,9 +64375,10 @@ var registerCommands2 = async (program2) => {
63380
64375
  registerAopsPolicyCommand(program2);
63381
64376
  };
63382
64377
  // package.json
63383
- var package_default3 = {
64378
+ var package_default5 = {
63384
64379
  name: "@uipath/gov-tool",
63385
- version: "1.1.0",
64380
+ license: "MIT",
64381
+ version: "1.195.0",
63386
64382
  description: "Manage UiPath governance (AOps and Access policies) end-to-end.",
63387
64383
  private: false,
63388
64384
  repository: {
@@ -63424,7 +64420,7 @@ var package_default3 = {
63424
64420
  // src/tool.ts
63425
64421
  var metadata3 = {
63426
64422
  name: "gov-tool",
63427
- version: package_default3.version,
64423
+ version: package_default5.version,
63428
64424
  description: "Manage UiPath governance — AOps policies and Access policies.",
63429
64425
  commandPrefix: "gov"
63430
64426
  };