@uipath/platform-tool 1.206.0-preview.301 → 1.207.0-preview.305

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Command,
4
4
  metadata2,
5
5
  registerCommands2
6
- } from "./tool-skzf0jvf.js";
6
+ } from "./tool-2dkjswkn.js";
7
7
 
8
8
  // src/index.ts
9
9
  var program = new Command;
@@ -28120,7 +28120,7 @@ var package_default = {
28120
28120
  name: "@uipath/platform-tool",
28121
28121
  author: "UiPath",
28122
28122
  license: "SEE LICENSE IN LICENSE.txt",
28123
- version: "1.206.0-preview.301",
28123
+ version: "1.207.0-preview.305",
28124
28124
  description: "Manage UiPath platform-level resources such as tenant licensing.",
28125
28125
  publishConfig: {
28126
28126
  registry: "https://npm.pkg.github.com/"
@@ -28192,6 +28192,8 @@ function settlePromiseLike(thenable) {
28192
28192
  // ../auth/src/constants.ts
28193
28193
  var UIPATH_HOME_DIR = ".uipath";
28194
28194
  var AUTH_FILENAME = ".auth";
28195
+ var AUTH_FILE_MODE = 384;
28196
+ var AUTH_DIR_MODE = 448;
28195
28197
  var DEFAULT_BASE_URL = "https://cloud.uipath.com";
28196
28198
  var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
28197
28199
 
@@ -28337,12 +28339,26 @@ class NodeFileSystem {
28337
28339
  throw error;
28338
28340
  }
28339
28341
  }
28340
- async writeFile(filePath, data) {
28342
+ async writeFile(filePath, data, options) {
28341
28343
  const dir = path.dirname(filePath);
28342
28344
  if (dir) {
28343
28345
  await fs.mkdir(dir, { recursive: true });
28344
28346
  }
28345
- await fs.writeFile(filePath, data);
28347
+ if (options?.mode === undefined || process.platform === "win32") {
28348
+ if (options?.exclusive) {
28349
+ await fs.writeFile(filePath, data, { flag: "wx" });
28350
+ } else {
28351
+ await fs.writeFile(filePath, data);
28352
+ }
28353
+ return;
28354
+ }
28355
+ const handle = await fs.open(filePath, options.exclusive ? "wx" : "w", options.mode);
28356
+ try {
28357
+ await handle.chmod(options.mode);
28358
+ await handle.writeFile(data);
28359
+ } finally {
28360
+ await handle.close();
28361
+ }
28346
28362
  }
28347
28363
  async appendFile(filePath, data) {
28348
28364
  const dir = path.dirname(filePath);
@@ -28377,7 +28393,8 @@ class NodeFileSystem {
28377
28393
  isDirectory: () => stats.isDirectory(),
28378
28394
  size: stats.size,
28379
28395
  mtimeMs: stats.mtimeMs,
28380
- ctimeMs: stats.ctimeMs
28396
+ ctimeMs: stats.ctimeMs,
28397
+ mode: stats.mode
28381
28398
  };
28382
28399
  } catch (error) {
28383
28400
  if (this.isEnoent(error))
@@ -28388,8 +28405,13 @@ class NodeFileSystem {
28388
28405
  async exists(filePath) {
28389
28406
  return existsSync(filePath);
28390
28407
  }
28391
- async mkdir(dirPath) {
28392
- await fs.mkdir(dirPath, { recursive: true });
28408
+ async mkdir(dirPath, options) {
28409
+ await fs.mkdir(dirPath, { recursive: true, mode: options?.mode });
28410
+ }
28411
+ async chmod(targetPath, mode) {
28412
+ if (process.platform === "win32")
28413
+ return;
28414
+ await fs.chmod(targetPath, mode);
28393
28415
  }
28394
28416
  async acquireLock(lockPath) {
28395
28417
  const canonicalPath = await this.canonicalizeLockTarget(lockPath);
@@ -28539,7 +28561,7 @@ class NodeFileSystem {
28539
28561
  async getTempDir() {
28540
28562
  return await fs.mkdtemp(path.join(os.tmpdir(), "uipath-fs-"));
28541
28563
  }
28542
- async copyDirectory(sourcePath, destPath) {
28564
+ async copyDirectory(sourcePath, destPath, options) {
28543
28565
  const sourceStats = await this.stat(sourcePath);
28544
28566
  if (!sourceStats) {
28545
28567
  throw new Error(`Source directory does not exist: ${sourcePath}`);
@@ -28556,7 +28578,9 @@ class NodeFileSystem {
28556
28578
  if (!entryStats)
28557
28579
  continue;
28558
28580
  if (entryStats.isDirectory()) {
28559
- await this.copyDirectory(srcEntry, destEntry);
28581
+ if (options?.skipDirectoryNames?.includes(entry))
28582
+ continue;
28583
+ await this.copyDirectory(srcEntry, destEntry, options);
28560
28584
  } else if (entryStats.isFile()) {
28561
28585
  const content = await this.readFile(srcEntry);
28562
28586
  if (content !== null) {
@@ -29304,6 +29328,38 @@ var loadEnvFileAsync = async ({ envPath }) => {
29304
29328
  }
29305
29329
  return parseEnvContent(content);
29306
29330
  };
29331
+ var findAuthHomeDir = (fs, dir) => {
29332
+ let current = dir;
29333
+ for (;; ) {
29334
+ if (fs.path.basename(current) === UIPATH_HOME_DIR)
29335
+ return current;
29336
+ const parent = fs.path.dirname(current);
29337
+ if (parent === current)
29338
+ return;
29339
+ current = parent;
29340
+ }
29341
+ };
29342
+ var TEMP_FILE_ATTEMPTS = 5;
29343
+ var isFileExists = (error) => error instanceof Error && error.code === "EEXIST";
29344
+ var writeTempFile = async (fs, targetPath, content) => {
29345
+ for (let attempt = 1;; attempt++) {
29346
+ const tempPath = `${targetPath}.${crypto.randomUUID()}.tmp`;
29347
+ try {
29348
+ await fs.writeFile(tempPath, content, {
29349
+ mode: AUTH_FILE_MODE,
29350
+ exclusive: true
29351
+ });
29352
+ return tempPath;
29353
+ } catch (error) {
29354
+ if (!isFileExists(error)) {
29355
+ await fs.rm(tempPath).catch(() => {});
29356
+ throw error;
29357
+ }
29358
+ if (attempt === TEMP_FILE_ATTEMPTS)
29359
+ throw error;
29360
+ }
29361
+ }
29362
+ };
29307
29363
  var saveEnvFileAsync = async ({
29308
29364
  envPath,
29309
29365
  data,
@@ -29331,10 +29387,18 @@ var saveEnvFileAsync = async ({
29331
29387
  `)}
29332
29388
  `;
29333
29389
  const dir = fs.path.dirname(absolutePath);
29334
- await fs.mkdir(dir);
29335
- const tempPath = `${absolutePath}.tmp`;
29336
- await fs.writeFile(tempPath, content);
29337
- await fs.rename(tempPath, absolutePath);
29390
+ await fs.mkdir(dir, { mode: AUTH_DIR_MODE });
29391
+ const authHomeDir = findAuthHomeDir(fs, dir);
29392
+ if (authHomeDir !== undefined) {
29393
+ await fs.chmod?.(authHomeDir, AUTH_DIR_MODE);
29394
+ }
29395
+ const tempPath = await writeTempFile(fs, absolutePath, content);
29396
+ try {
29397
+ await fs.rename(tempPath, absolutePath);
29398
+ } catch (error) {
29399
+ await fs.rm(tempPath).catch(() => {});
29400
+ throw error;
29401
+ }
29338
29402
  };
29339
29403
 
29340
29404
  // ../auth/src/loginStatus.ts
@@ -29971,13 +30035,15 @@ var ProjectDimensions = {
29971
30035
  SolutionKey: "SolutionKey",
29972
30036
  SolutionProjectKey: "SolutionProjectKey",
29973
30037
  SolutionIdentityStatus: "SolutionIdentityStatus",
29974
- PreviousSolutionKey: "PreviousSolutionKey"
30038
+ PreviousSolutionKey: "PreviousSolutionKey",
30039
+ PreviousProjectKey: "PreviousProjectKey"
29975
30040
  };
29976
30041
  var GUID_KEY_DIMENSIONS = new Set([
29977
30042
  ProjectDimensions.ProjectKey,
29978
30043
  ProjectDimensions.SolutionKey,
29979
30044
  ProjectDimensions.SolutionProjectKey,
29980
- ProjectDimensions.PreviousSolutionKey
30045
+ ProjectDimensions.PreviousSolutionKey,
30046
+ ProjectDimensions.PreviousProjectKey
29981
30047
  ]);
29982
30048
  var ShipDimensions = {
29983
30049
  ShipKind: "ShipKind",
@@ -30131,9 +30197,7 @@ async function withinProjectIdentityBudget(work, onTimeout) {
30131
30197
  }
30132
30198
  }
30133
30199
 
30134
- // ../common/src/telemetry/pseudonymize.ts
30135
- var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
30136
- var PSEUDONYM_HEX_LENGTH = 32;
30200
+ // ../common/src/sha256.ts
30137
30201
  var SHA256_K = new Uint32Array([
30138
30202
  1116352408,
30139
30203
  1899447441,
@@ -30213,7 +30277,7 @@ var SHA256_INITIAL_STATE = new Uint32Array([
30213
30277
  function rotr(value, bits) {
30214
30278
  return (value >>> bits | value << 32 - bits) >>> 0;
30215
30279
  }
30216
- function sha256Hex(input) {
30280
+ function sha256Words(input) {
30217
30281
  const bytes = new TextEncoder().encode(input);
30218
30282
  const paddedLength = bytes.length + 9 + 63 >> 6 << 6;
30219
30283
  const buffer = new Uint8Array(paddedLength);
@@ -30269,12 +30333,19 @@ function sha256Hex(input) {
30269
30333
  state[6] = state[6] + g >>> 0;
30270
30334
  state[7] = state[7] + h >>> 0;
30271
30335
  }
30336
+ return state;
30337
+ }
30338
+ function sha256Hex(input) {
30272
30339
  let hex = "";
30273
- for (const word of state) {
30340
+ for (const word of sha256Words(input)) {
30274
30341
  hex += word.toString(16).padStart(8, "0");
30275
30342
  }
30276
30343
  return hex;
30277
30344
  }
30345
+
30346
+ // ../common/src/telemetry/pseudonymize.ts
30347
+ var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
30348
+ var PSEUDONYM_HEX_LENGTH = 32;
30278
30349
  function resolveSha256Hex() {
30279
30350
  try {
30280
30351
  const nodeCrypto = __require("node:crypto");
@@ -30670,13 +30741,25 @@ function settlePromiseLike2(thenable) {
30670
30741
  return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
30671
30742
  }
30672
30743
 
30744
+ // ../common/src/result-types.ts
30745
+ var RESULTS = {
30746
+ Success: "Success",
30747
+ Failure: "Failure",
30748
+ ConfigError: "ConfigError",
30749
+ AuthenticationError: "AuthenticationError",
30750
+ ValidationError: "ValidationError",
30751
+ TimeoutError: "TimeoutError"
30752
+ };
30753
+
30673
30754
  // ../common/src/error-codes.ts
30674
30755
  var CLI_ERROR_CODES = [
30675
30756
  "invalid_argument",
30757
+ "confirmation_required",
30676
30758
  "authentication_required",
30677
30759
  "permission_denied",
30678
30760
  "local_permission_denied",
30679
30761
  "not_found",
30762
+ "not_enabled",
30680
30763
  "rate_limited",
30681
30764
  "network_error",
30682
30765
  "timeout",
@@ -30715,6 +30798,12 @@ function carriedRetry(error) {
30715
30798
  const retry = error.retry;
30716
30799
  return isRetryHint(retry) ? retry : undefined;
30717
30800
  }
30801
+ function carriedResult(error) {
30802
+ if (!error || typeof error !== "object")
30803
+ return;
30804
+ const result = error.result;
30805
+ return typeof result === "string" && result !== RESULTS.Success && Object.values(RESULTS).includes(result) ? result : undefined;
30806
+ }
30718
30807
  function defaultRetryForErrorCode(errorCode) {
30719
30808
  switch (errorCode) {
30720
30809
  case "network_error":
@@ -31104,6 +31193,8 @@ async function extractErrorDetails(error, options) {
31104
31193
  }
31105
31194
  if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
31106
31195
  context.errorCode = parsedBody.errorCode;
31196
+ } else if (typeof parsedBody?.errorCode === "number") {
31197
+ context.errorCode = String(parsedBody.errorCode);
31107
31198
  } else if (parsedBody?.code && typeof parsedBody.code === "string") {
31108
31199
  context.errorCode = parsedBody.code;
31109
31200
  }
@@ -31242,16 +31333,6 @@ function instructionsFor(ctx, err) {
31242
31333
  }
31243
31334
  }
31244
31335
 
31245
- // ../common/src/result-types.ts
31246
- var RESULTS = {
31247
- Success: "Success",
31248
- Failure: "Failure",
31249
- ConfigError: "ConfigError",
31250
- AuthenticationError: "AuthenticationError",
31251
- ValidationError: "ValidationError",
31252
- TimeoutError: "TimeoutError"
31253
- };
31254
-
31255
31336
  // ../common/src/classified-failure.ts
31256
31337
  async function authContextFailure(error, sessionInstructions) {
31257
31338
  const details = await extractErrorDetails(error);
@@ -31697,7 +31778,10 @@ var AUTH_ERROR_CODES = new Set([
31697
31778
  var LOCAL_PERMISSION_CLI_ERROR_CODES = new Set([
31698
31779
  "local_permission_denied"
31699
31780
  ]);
31700
- var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
31781
+ var VALIDATION_ERROR_CODES = new Set([
31782
+ "invalid_argument",
31783
+ "confirmation_required"
31784
+ ]);
31701
31785
  var NETWORK_HTTP_ERROR_CODES = new Set([
31702
31786
  "network_error",
31703
31787
  "rate_limited",
@@ -31923,6 +32007,109 @@ var CommonTelemetryEvents = {
31923
32007
  ShipSucceeded: "Cli.ShipSucceeded"
31924
32008
  };
31925
32009
 
32010
+ // ../common/src/telemetry/global-telemetry-properties.ts
32011
+ var telemetryPropsSlot = singleton("TelemetryDefaultProps");
32012
+ function getGlobalTelemetryProperties() {
32013
+ return telemetryPropsSlot.get();
32014
+ }
32015
+
32016
+ // ../common/src/telemetry/trace-context.ts
32017
+ var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
32018
+ var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
32019
+ function getProcessEnv() {
32020
+ return globalThis.process?.env;
32021
+ }
32022
+ function parseInboundTraceparent(value) {
32023
+ if (!value) {
32024
+ return;
32025
+ }
32026
+ const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
32027
+ if (!match) {
32028
+ return;
32029
+ }
32030
+ const [, traceId, parentSpanId] = match;
32031
+ if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
32032
+ return;
32033
+ }
32034
+ return { traceId, parentSpanId };
32035
+ }
32036
+ function getInboundTraceContext() {
32037
+ return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
32038
+ }
32039
+
32040
+ // ../common/src/telemetry/session-id.ts
32041
+ var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
32042
+ var SESSION_ID_MAX_LENGTH = 64;
32043
+ var RANDOM_SESSION_ID_LENGTH = 32;
32044
+ var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
32045
+ var CONTROL_CHARACTERS = /\p{Cc}/gu;
32046
+ var INHERITED_SESSION_SOURCES = [
32047
+ { envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
32048
+ { envVar: "CODEX_THREAD_ID", source: "codex" },
32049
+ { envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
32050
+ { envVar: "TERM_SESSION_ID", source: "terminal" },
32051
+ { envVar: "WT_SESSION", source: "terminal" }
32052
+ ];
32053
+ var telemetrySessionSlot = singleton("TelemetrySession");
32054
+ var telemetryOperationIdSlot = singleton("TelemetryOperationId");
32055
+ function getProcessEnv2() {
32056
+ return globalThis.process?.env;
32057
+ }
32058
+ function normalizeSessionId(value) {
32059
+ if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
32060
+ return;
32061
+ }
32062
+ const cleaned = String(value).replace(CONTROL_CHARACTERS, "").trim().slice(0, SESSION_ID_MAX_LENGTH);
32063
+ return cleaned || undefined;
32064
+ }
32065
+ function getConfiguredTelemetrySessionId() {
32066
+ return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
32067
+ }
32068
+ function getInheritedSession(env) {
32069
+ for (const candidate of INHERITED_SESSION_SOURCES) {
32070
+ const handle = normalizeSessionId(env[candidate.envVar]);
32071
+ if (handle) {
32072
+ return { id: handle, source: candidate.source };
32073
+ }
32074
+ }
32075
+ return;
32076
+ }
32077
+ function generateRandomSession() {
32078
+ const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
32079
+ crypto.getRandomValues(bytes);
32080
+ let hex = "";
32081
+ for (const byte of bytes) {
32082
+ hex += byte.toString(16).padStart(2, "0");
32083
+ }
32084
+ return { id: hex, source: "random" };
32085
+ }
32086
+ function resolveTelemetrySession() {
32087
+ const existing = telemetrySessionSlot.get();
32088
+ if (existing) {
32089
+ return existing;
32090
+ }
32091
+ const declaredHandle = getConfiguredTelemetrySessionId();
32092
+ const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
32093
+ telemetrySessionSlot.set(resolved);
32094
+ return resolved;
32095
+ }
32096
+ function getTelemetrySessionId() {
32097
+ return resolveTelemetrySession().id;
32098
+ }
32099
+ function getTelemetrySessionSource() {
32100
+ return resolveTelemetrySession().source;
32101
+ }
32102
+ function getTelemetryOperationId() {
32103
+ const existing = telemetryOperationIdSlot.get();
32104
+ if (existing) {
32105
+ return existing;
32106
+ }
32107
+ const inboundTraceId = getInboundTraceContext()?.traceId;
32108
+ const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
32109
+ telemetryOperationIdSlot.set(generated);
32110
+ return generated;
32111
+ }
32112
+
31926
32113
  // ../common/src/registry.ts
31927
32114
  import { execFileSync } from "node:child_process";
31928
32115
  function readRegistryValue(keyPath, valueName) {
@@ -32144,108 +32331,6 @@ class NodeContextStorage {
32144
32331
  return this.storage.getStore();
32145
32332
  }
32146
32333
  }
32147
- // ../common/src/telemetry/trace-context.ts
32148
- var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
32149
- var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
32150
- function getProcessEnv() {
32151
- return globalThis.process?.env;
32152
- }
32153
- function parseInboundTraceparent(value) {
32154
- if (!value) {
32155
- return;
32156
- }
32157
- const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
32158
- if (!match) {
32159
- return;
32160
- }
32161
- const [, traceId, parentSpanId] = match;
32162
- if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
32163
- return;
32164
- }
32165
- return { traceId, parentSpanId };
32166
- }
32167
- function getInboundTraceContext() {
32168
- return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
32169
- }
32170
-
32171
- // ../common/src/telemetry/session-id.ts
32172
- var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
32173
- var SESSION_ID_MAX_LENGTH = 64;
32174
- var RANDOM_SESSION_ID_LENGTH = 32;
32175
- var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
32176
- var CONTROL_CHARACTERS = /\p{Cc}/gu;
32177
- var INHERITED_SESSION_SOURCES = [
32178
- { envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
32179
- { envVar: "CODEX_THREAD_ID", source: "codex" },
32180
- { envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
32181
- { envVar: "TERM_SESSION_ID", source: "terminal" },
32182
- { envVar: "WT_SESSION", source: "terminal" }
32183
- ];
32184
- var telemetrySessionSlot = singleton("TelemetrySession");
32185
- var telemetryOperationIdSlot = singleton("TelemetryOperationId");
32186
- function getProcessEnv2() {
32187
- return globalThis.process?.env;
32188
- }
32189
- function normalizeSessionId(value) {
32190
- if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
32191
- return;
32192
- }
32193
- const cleaned = String(value).replace(CONTROL_CHARACTERS, "").trim().slice(0, SESSION_ID_MAX_LENGTH);
32194
- return cleaned || undefined;
32195
- }
32196
- function getConfiguredTelemetrySessionId() {
32197
- return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
32198
- }
32199
- function getInheritedSession(env) {
32200
- for (const candidate of INHERITED_SESSION_SOURCES) {
32201
- const handle = normalizeSessionId(env[candidate.envVar]);
32202
- if (handle) {
32203
- return { id: handle, source: candidate.source };
32204
- }
32205
- }
32206
- return;
32207
- }
32208
- function generateRandomSession() {
32209
- const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
32210
- crypto.getRandomValues(bytes);
32211
- let hex = "";
32212
- for (const byte of bytes) {
32213
- hex += byte.toString(16).padStart(2, "0");
32214
- }
32215
- return { id: hex, source: "random" };
32216
- }
32217
- function resolveTelemetrySession() {
32218
- const existing = telemetrySessionSlot.get();
32219
- if (existing) {
32220
- return existing;
32221
- }
32222
- const declaredHandle = getConfiguredTelemetrySessionId();
32223
- const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
32224
- telemetrySessionSlot.set(resolved);
32225
- return resolved;
32226
- }
32227
- function getTelemetrySessionId() {
32228
- return resolveTelemetrySession().id;
32229
- }
32230
- function getTelemetrySessionSource() {
32231
- return resolveTelemetrySession().source;
32232
- }
32233
- function getTelemetryOperationId() {
32234
- const existing = telemetryOperationIdSlot.get();
32235
- if (existing) {
32236
- return existing;
32237
- }
32238
- const inboundTraceId = getInboundTraceContext()?.traceId;
32239
- const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
32240
- telemetryOperationIdSlot.set(generated);
32241
- return generated;
32242
- }
32243
- // ../common/src/telemetry/global-telemetry-properties.ts
32244
- var telemetryPropsSlot = singleton("TelemetryDefaultProps");
32245
- function getGlobalTelemetryProperties() {
32246
- return telemetryPropsSlot.get();
32247
- }
32248
-
32249
32334
  // ../common/src/telemetry/span-clock.ts
32250
32335
  function startSpanClock() {
32251
32336
  const started = performance.now();
@@ -32459,6 +32544,7 @@ var MAX_SPOOL_AGE_MS = 72 * 60 * 60 * 1000;
32459
32544
  // ../common/src/telemetry/telemetry-init.ts
32460
32545
  var telemetryInstanceSlot = singleton("TelemetryService");
32461
32546
  var DEFAULT_AI_CONNECTION_STRING = atob("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj");
32547
+ var browserProviderSlot = singleton("BrowserAppInsightsTelemetryProvider");
32462
32548
  function getGlobalTelemetryInstance() {
32463
32549
  const existing = telemetryInstanceSlot.get();
32464
32550
  if (existing && typeof existing === "object" && "trackEvent" in existing && typeof existing.trackEvent === "function") {
@@ -32675,7 +32761,7 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
32675
32761
  const pagedRows = extractPagedRows(data.Data);
32676
32762
  const items = pagedRows ?? (Array.isArray(data.Data) ? data.Data : [data.Data]);
32677
32763
  items.forEach((item) => {
32678
- const values = Object.values(item).map((v) => v ?? "").join("\t");
32764
+ const values = item === null || typeof item !== "object" ? String(item ?? "") : Object.values(item).map((v) => v ?? "").join("\t");
32679
32765
  logFn(values);
32680
32766
  });
32681
32767
  } else {
@@ -32690,7 +32776,8 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
32690
32776
  default: {
32691
32777
  const hasData = "Data" in data && data.Data != null;
32692
32778
  const pagedRows = hasData ? extractPagedRows(data.Data) : null;
32693
- const rows = pagedRows ? pagedRows : Array.isArray(data.Data) ? data.Data : null;
32779
+ const resolvedRows = pagedRows ? pagedRows : Array.isArray(data.Data) ? data.Data : null;
32780
+ const rows = resolvedRows && isPrimitiveArray(resolvedRows) ? resolvedRows.map((entry) => ({ Value: entry })) : resolvedRows;
32694
32781
  if (hasData && !(rows !== null && rows.length === 0)) {
32695
32782
  const logValue = data.Log;
32696
32783
  if (rows !== null) {
@@ -32747,6 +32834,9 @@ function printTable(data, logFn, externalLogValue, tableRowStyle) {
32747
32834
  function isPlainObjectArray(value) {
32748
32835
  return Array.isArray(value) && value.length > 0 && value.every(isPlainRecord);
32749
32836
  }
32837
+ function isPrimitiveArray(value) {
32838
+ return Array.isArray(value) && value.length > 0 && value.every((entry) => entry === null || typeof entry !== "object");
32839
+ }
32750
32840
  function isNonEmptyPlainObject(value) {
32751
32841
  return isPlainRecord(value) && Object.keys(value).length > 0;
32752
32842
  }
@@ -33093,12 +33183,12 @@ class FilterEvaluationError extends Error {
33093
33183
  instructions;
33094
33184
  retry = "RetryWillNotFix";
33095
33185
  result = RESULTS.ValidationError;
33096
- constructor(filter, cause) {
33186
+ constructor(filter, cause, hint) {
33097
33187
  const underlying = cause instanceof Error ? cause.message : String(cause);
33098
- super(`Filter '${filter}' failed to evaluate: ${underlying}`);
33188
+ super(`Filter '${filter}' failed to evaluate: ${underlying}` + (hint ? ` ${hint.detail}` : ""));
33099
33189
  this.name = "FilterEvaluationError";
33100
33190
  this.filter = filter;
33101
- 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(@)'.";
33191
+ this.instructions = (hint ? `${hint.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(@)'.";
33102
33192
  }
33103
33193
  }
33104
33194
 
@@ -33220,6 +33310,93 @@ function nameList(names, cap = 12) {
33220
33310
  const rest = names.length - shown.length;
33221
33311
  return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
33222
33312
  }
33313
+ function notFieldsOn(names, scope) {
33314
+ return `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
33315
+ }
33316
+ function failingFieldRead(ast, isList, fn, argIndex) {
33317
+ const [left, right, condition] = ast.children ?? [];
33318
+ let scopes = [];
33319
+ if (!isList) {
33320
+ scopes = [ast];
33321
+ } else if (ast.type === "FilterProjection" && left?.type === "Identity") {
33322
+ scopes = [condition, right];
33323
+ } else if (ast.type === "Projection" && (left?.type === "Identity" || left?.type === "Flatten" && left.children?.[0]?.type === "Identity")) {
33324
+ scopes = [right];
33325
+ }
33326
+ const reads = new Set;
33327
+ let tracked = 0;
33328
+ const visit = (node) => {
33329
+ if (!node)
33330
+ return;
33331
+ switch (node.type) {
33332
+ case "Function": {
33333
+ const arg = node.children?.[argIndex - 1];
33334
+ if (node.name === fn && arg?.type === "Field" && arg.name) {
33335
+ reads.add(arg.name);
33336
+ tracked++;
33337
+ }
33338
+ node.children?.forEach(visit);
33339
+ return;
33340
+ }
33341
+ case "AndExpression":
33342
+ case "OrExpression":
33343
+ case "NotExpression":
33344
+ case "Comparator":
33345
+ case "MultiSelectList":
33346
+ case "MultiSelectHash":
33347
+ node.children?.forEach(visit);
33348
+ return;
33349
+ case "KeyValuePair":
33350
+ visit(node.value);
33351
+ return;
33352
+ }
33353
+ };
33354
+ scopes.forEach(visit);
33355
+ const calls = (node) => {
33356
+ if (node === null || typeof node !== "object")
33357
+ return 0;
33358
+ const own = node.type === "Function" && node.name === fn ? 1 : 0;
33359
+ const next = node.type === "KeyValuePair" ? [node.value] : node.children ?? [];
33360
+ return own + next.reduce((sum, child) => sum + calls(child), 0);
33361
+ };
33362
+ return reads.size === 1 && tracked === calls(ast) ? [...reads][0] : undefined;
33363
+ }
33364
+ function fieldExpression(name) {
33365
+ return /^[A-Za-z_]\w*$/.test(name) ? name : JSON.stringify(name);
33366
+ }
33367
+ function evaluationHint(codec, filter, data, cause) {
33368
+ const underlying = cause instanceof Error ? cause.message : String(cause);
33369
+ const failure = /\b(\w+)\(\) expected argument (\d+) to be type (\S+) but received type null\b/.exec(underlying);
33370
+ if (!failure)
33371
+ return;
33372
+ const [, fn, position, expected] = failure;
33373
+ const name = failingFieldRead(codec.compile(filter), Array.isArray(data), fn, Number(position));
33374
+ if (name === undefined)
33375
+ return;
33376
+ const present = availableFields(data);
33377
+ if (present.length === 0)
33378
+ return;
33379
+ const scope = `${countRecords(data)} record(s)`;
33380
+ if (!present.includes(name)) {
33381
+ return {
33382
+ detail: `${notFieldsOn([name], scope)}. Available fields: ${nameList(present)}.`,
33383
+ instructions: "Use a field the records have; names are case-sensitive."
33384
+ };
33385
+ }
33386
+ const records = Array.isArray(data) ? data : [data];
33387
+ const unset = records.filter((r) => r?.[name] == null).length;
33388
+ const field = fieldExpression(name);
33389
+ let fallback;
33390
+ if (expected.split(",").includes("string")) {
33391
+ fallback = "''";
33392
+ } else if (expected.split(",").includes("array")) {
33393
+ fallback = "`[]`";
33394
+ }
33395
+ return {
33396
+ detail: `\`${name}\` is null or missing on ${unset} of the ${scope} it read.`,
33397
+ instructions: fallback ? `Give it a default where ${fn}() reads it, e.g. \`${field} || ${fallback}\`.` : `Filter out the records where \`${name}\` is null before ${fn}() reads it.`
33398
+ };
33399
+ }
33223
33400
  function buildFilterWarning(filter, data, outcome) {
33224
33401
  const present = availableFields(data);
33225
33402
  const refs = referencedFields(filter);
@@ -33227,7 +33404,7 @@ function buildFilterWarning(filter, data, outcome) {
33227
33404
  const unchecked = refs.nested.filter((name) => !present.includes(name));
33228
33405
  const count = countRecords(data);
33229
33406
  const scope = `${count} record(s)`;
33230
- const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
33407
+ const isNotAField = (names) => notFieldsOn(names, scope);
33231
33408
  const soundness = unchecked.length > 0 ? `${nameList(unchecked)} ${unchecked.length === 1 ? "reads" : "read"} below the top level, so ${unchecked.length === 1 ? "it was" : "they were"} not checked against the record keys` : refs.top.length > 0 ? "every field it names exists" : "";
33232
33409
  const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
33233
33410
  let detail;
@@ -33278,7 +33455,8 @@ function applyFilter(data, filter, onWarning) {
33278
33455
  try {
33279
33456
  result = codec.search(data, filter);
33280
33457
  } catch (err) {
33281
- throw new FilterEvaluationError(filter, err);
33458
+ const [, hint] = catchError2(() => evaluationHint(codec, filter, data, err));
33459
+ throw new FilterEvaluationError(filter, err, hint);
33282
33460
  }
33283
33461
  const inputCount = countRecords(data);
33284
33462
  const warn = (outcome) => {
@@ -34169,7 +34347,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
34169
34347
  logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
34170
34348
  const typed = error;
34171
34349
  const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
34172
- const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
34350
+ const customResult = carriedResult(error);
34173
34351
  const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
34174
34352
  const classified = cancellationExitCode === undefined ? await extractErrorDetails(error) : undefined;
34175
34353
  const finalResult = customResult ?? classified?.result ?? RESULTS.Failure;
@@ -34981,6 +35159,8 @@ var FAILURE_STATUSES = new Set([
34981
35159
  "canceled",
34982
35160
  "stopped"
34983
35161
  ]);
35162
+ // ../common/src/relayed-output.ts
35163
+ var RELAYED_OUTPUT_SYMBOL = Symbol.for("@uipath/common/relayed-output");
34984
35164
  // ../common/src/screen-logger.ts
34985
35165
  var ScreenLogger;
34986
35166
  ((ScreenLogger) => {
@@ -35127,6 +35307,22 @@ var formatResponseError = async (err) => {
35127
35307
  }
35128
35308
  return extractErrorMessage(err);
35129
35309
  };
35310
+ var responseOf = (err) => {
35311
+ const response = err?.response;
35312
+ if (!response || typeof response !== "object") {
35313
+ return;
35314
+ }
35315
+ const candidate = response;
35316
+ return typeof candidate.status === "number" && typeof candidate.clone === "function" ? candidate : undefined;
35317
+ };
35318
+ var readJsonErrorBody = async (err, status) => {
35319
+ const response = responseOf(err);
35320
+ if (response?.status !== status) {
35321
+ return;
35322
+ }
35323
+ const [, body] = await catchError2(response.clone().json());
35324
+ return body && typeof body === "object" && !Array.isArray(body) ? body : undefined;
35325
+ };
35130
35326
 
35131
35327
  // src/utils/sdk-client.ts
35132
35328
  var import_license_accountant_typescript2 = __toESM(require_dist(), 1);
@@ -35256,8 +35452,8 @@ var CONSUMABLES_GET_EXAMPLES = [
35256
35452
  }
35257
35453
  },
35258
35454
  {
35259
- Description: "Use a custom date range for consumption (overrides each consumable's bundle window). Both --start-date and --end-date must be provided together. Dates are interpreted as ISO 8601.",
35260
- Command: "uip platform licenses consumables get --start-date 2025-01-01 --end-date 2025-01-31",
35455
+ Description: "Use a custom date range for consumption (overrides each consumable's bundle window). Both --start-date and --end-date must be provided together. Dates are interpreted as ISO 8601 in UTC. The end date is exclusive: the window stops at 00:00 UTC on --end-date, so this example covers all of January (1 to 31 January).",
35456
+ Command: "uip platform licenses consumables get --start-date 2025-01-01 --end-date 2025-02-01",
35261
35457
  Output: {
35262
35458
  Code: "LicensesConsumablesSummary",
35263
35459
  Data: [
@@ -35268,7 +35464,7 @@ var CONSUMABLES_GET_EXAMPLES = [
35268
35464
  allocated: 1200,
35269
35465
  consumedFromOrgWithoutTenant: 5,
35270
35466
  startDate: "2025-01-01T00:00:00.000Z",
35271
- endDate: "2025-01-31T00:00:00.000Z",
35467
+ endDate: "2025-02-01T00:00:00.000Z",
35272
35468
  tenantId: "296b7134-6691-43db-b48a-2d95ed3ab031",
35273
35469
  tenantName: "default",
35274
35470
  consumedFromTenantPool: 120,
@@ -35301,7 +35497,25 @@ var CONSUMABLES_GET_EXAMPLES = [
35301
35497
  },
35302
35498
  {
35303
35499
  Description: "Daily breakdown by service for a single tenant × consumable unit over an ISO date range. Requires --tenant, --unit, --start-date and --end-date. One row per (date, service).",
35304
- Command: "uip platform licenses consumables get --mode daily --tenant default --unit AIU --start-date 2025-01-01 --end-date 2025-01-31",
35500
+ Command: "uip platform licenses consumables get --mode daily --tenant default --unit AIU --start-date 2025-01-01 --end-date 2025-02-01",
35501
+ Output: {
35502
+ Code: "LicensesConsumablesDaily",
35503
+ Data: [
35504
+ {
35505
+ code: "AIU",
35506
+ name: "AI Units",
35507
+ tenantId: "296b7134-6691-43db-b48a-2d95ed3ab031",
35508
+ tenantName: "default",
35509
+ date: "2025-01-15",
35510
+ service: "orchestrator",
35511
+ consumedAmount: 24
35512
+ }
35513
+ ]
35514
+ }
35515
+ },
35516
+ {
35517
+ Description: "Report a single day. The end date is exclusive, so pass the next day as --end-date. The same date for both flags is rejected.",
35518
+ Command: "uip platform licenses consumables get --mode daily --tenant default --unit AIU --start-date 2025-01-15 --end-date 2025-01-16",
35305
35519
  Output: {
35306
35520
  Code: "LicensesConsumablesDaily",
35307
35521
  Data: [
@@ -35319,7 +35533,7 @@ var CONSUMABLES_GET_EXAMPLES = [
35319
35533
  },
35320
35534
  {
35321
35535
  Description: "Folder breakdown for a single tenant × consumable unit over an ISO date range. Requires --tenant, --unit, --start-date and --end-date. One row per folder with that folder's own (non-inherited) consumption and process count.",
35322
- Command: "uip platform licenses consumables get --mode folders --tenant default --unit AIU --start-date 2025-01-01 --end-date 2025-01-31",
35536
+ Command: "uip platform licenses consumables get --mode folders --tenant default --unit AIU --start-date 2025-01-01 --end-date 2025-02-01",
35323
35537
  Output: {
35324
35538
  Code: "LicensesConsumablesFolders",
35325
35539
  Data: [
@@ -35398,7 +35612,7 @@ async function validateConsumablesOptions(options) {
35398
35612
  OutputFormatter.error({
35399
35613
  Result: RESULTS.Failure,
35400
35614
  Message: "--start-date must be strictly before --end-date.",
35401
- Instructions: "Provide a non-empty date range, e.g. --start-date 2025-01-01 --end-date 2025-01-31."
35615
+ Instructions: "The end date is exclusive: the window stops at 00:00 UTC on --end-date, so it must be after the start date. For a single day pass the next day as the end, e.g. --start-date 2025-01-15 --end-date 2025-01-16."
35402
35616
  });
35403
35617
  processContext.exit(1);
35404
35618
  return null;
@@ -35706,7 +35920,7 @@ async function handleConsumablesGet(options) {
35706
35920
  var registerConsumablesCommand = (program) => {
35707
35921
  const licenses = program.commands.find((c) => c.name() === "licenses") ?? program.command("licenses").description("View and manage organization-level license resources.");
35708
35922
  const consumables = licenses.commands.find((c) => c.name() === "consumables") ?? licenses.command("consumables").description("View consumable license usage across the organization and its tenants.");
35709
- consumables.command("get").description("Get a consumables report. Default --mode summary returns per-consumable allocation + per-tenant pool consumption. --mode daily returns the daily breakdown by service, and --mode folders returns the breakdown by folder, both scoped to a single tenant × consumable unit.").option("--mode <summary|daily|folders>", "Report shape. 'summary' (default) returns per-consumable allocation + per-tenant consumption. 'daily' returns one row per (date, service). 'folders' returns one row per folder. 'daily' and 'folders' both require --tenant, --unit, --start-date and --end-date.", "summary").option("--tenant <tenant-name>", "Scope the report to a single tenant (matched by name from the current organization's tenant list). Required when --mode daily.").option("--unit <code>", "Filter to a single consumable unit by product code (e.g. AIU, AGU, RU, PLTU). Case-insensitive. Required when --mode daily.").option("--start-date <iso-date>", "Start of the consumption window as an ISO 8601 date. Must be used together with --end-date. Overrides each consumable's bundle start. Required when --mode daily.").option("--end-date <iso-date>", "End of the consumption window as an ISO 8601 date. Must be used together with --start-date. Overrides each consumable's bundle end. Required when --mode daily.").examples(CONSUMABLES_GET_EXAMPLES).trackedAction(processContext, (options) => handleConsumablesGet(options));
35923
+ consumables.command("get").description("Get a consumables report. Default --mode summary returns per-consumable allocation + per-tenant pool consumption. --mode daily returns the daily breakdown by service, and --mode folders returns the breakdown by folder, both scoped to a single tenant × consumable unit.").option("--mode <summary|daily|folders>", "Report shape. 'summary' (default) returns per-consumable allocation + per-tenant consumption. 'daily' returns one row per (date, service). 'folders' returns one row per folder. 'daily' and 'folders' both require --tenant, --unit, --start-date and --end-date.", "summary").option("--tenant <tenant-name>", "Scope the report to a single tenant (matched by name from the current organization's tenant list). Required when --mode daily.").option("--unit <code>", "Filter to a single consumable unit by product code (e.g. AIU, AGU, RU, PLTU). Case-insensitive. Required when --mode daily.").option("--start-date <iso-date>", "Start of the consumption window as an ISO 8601 date. Must be used together with --end-date. Overrides each consumable's bundle start. Required when --mode daily.").option("--end-date <iso-date>", "End of the consumption window as an ISO 8601 date. Exclusive: the window stops at this moment, and a date without a time means 00:00 UTC, so that day itself is not included. Must be after --start-date, so one day needs the next day as the end (--start-date 2025-01-15 --end-date 2025-01-16). Must be used together with --start-date. Overrides each consumable's bundle end. Required when --mode daily.").examples(CONSUMABLES_GET_EXAMPLES).trackedAction(processContext, (options) => handleConsumablesGet(options));
35710
35924
  };
35711
35925
 
35712
35926
  // ../admin/identity-sdk/generated/src/runtime.ts
@@ -35960,7 +36174,7 @@ var package_default2 = {
35960
36174
  name: "@uipath/identity-sdk",
35961
36175
  author: "UiPath",
35962
36176
  license: "SEE LICENSE IN LICENSE.txt",
35963
- version: "1.206.0",
36177
+ version: "1.207.0",
35964
36178
  repository: {
35965
36179
  type: "git",
35966
36180
  url: "https://github.com/UiPath/cli.git",
@@ -37871,19 +38085,43 @@ var TOP_UPS_GET_EXAMPLES = [
37871
38085
  ];
37872
38086
  var TOP_UPS_REQUEST_EXAMPLES = [
37873
38087
  {
37874
- Description: "Request a top-up for yourself (the logged-in user). This notifies your organization's admins; it does not grant anything directly.",
38088
+ Description: "Request a top-up for yourself (the logged-in user). Without an auto-grant policy this notifies your organization's admins; it does not grant anything directly.",
37875
38089
  Command: "uip platform users top-ups request",
37876
38090
  Output: {
37877
38091
  Code: "TopUpRequested",
37878
38092
  Data: {
37879
38093
  userId: "11111111-1111-1111-1111-111111111111",
37880
38094
  outcome: "NotificationSent",
37881
- message: "Your administrators have been notified."
38095
+ message: "Your top-up request has been sent to your administrators."
38096
+ }
38097
+ }
38098
+ },
38099
+ {
38100
+ Description: "When the organization's governance policy auto-grants top-ups, the request is granted on the spot and returns the grant job to poll with 'top-ups get'.",
38101
+ Command: "uip platform users top-ups request",
38102
+ Output: {
38103
+ Code: "TopUpAutoGranted",
38104
+ Data: {
38105
+ userId: "11111111-1111-1111-1111-111111111111",
38106
+ outcome: "AutoGranted",
38107
+ message: "Your top-up request was auto-granted (10).",
38108
+ jobId: "b3f1c2d4-0000-0000-0000-000000000009"
37882
38109
  }
37883
38110
  }
37884
38111
  }
37885
38112
  ];
37886
- var REQUEST_SENT_OUTCOME = "NotificationSent";
38113
+ var REQUEST_AUTO_GRANTED_OUTCOME = "AutoGranted";
38114
+ var REQUEST_REFUSED_STATUS = 422;
38115
+ var readRequestRefusal = async (err) => {
38116
+ const body = await readJsonErrorBody(err, REQUEST_REFUSED_STATUS);
38117
+ if (typeof body?.outcome !== "string") {
38118
+ return;
38119
+ }
38120
+ return {
38121
+ outcome: body.outcome,
38122
+ message: typeof body.message === "string" && body.message.length > 0 ? body.message : null
38123
+ };
38124
+ };
37887
38125
  async function resolveSourcePool(organizationOverride) {
37888
38126
  const [clientErr, client] = await catchError2(createFrontEndLicenseApi(organizationOverride));
37889
38127
  if (clientErr) {
@@ -38084,32 +38322,46 @@ async function handleTopUpRequest(options) {
38084
38322
  userId: resolved.userId
38085
38323
  }));
38086
38324
  if (reqErr) {
38325
+ const refusal = await readRequestRefusal(reqErr);
38326
+ if (!refusal) {
38327
+ OutputFormatter.error({
38328
+ Result: RESULTS.Failure,
38329
+ Message: "Error requesting a top-up.",
38330
+ Instructions: await formatResponseError(reqErr)
38331
+ });
38332
+ processContext.exit(1);
38333
+ return;
38334
+ }
38087
38335
  OutputFormatter.error({
38088
38336
  Result: RESULTS.Failure,
38089
- Message: "Error requesting a top-up.",
38090
- Instructions: await formatResponseError(reqErr)
38337
+ ErrorCode: "invalid_argument",
38338
+ Message: `Top-up request was not sent (${refusal.outcome}).`,
38339
+ Instructions: refusal.message ?? "The License Resource Manager gave no reason. Check your usage with 'uip platform users usage get' or ask an administrator for a top-up.",
38340
+ Retry: "RetryWillNotFix",
38341
+ Context: {
38342
+ httpStatus: REQUEST_REFUSED_STATUS,
38343
+ errorCode: refusal.outcome
38344
+ }
38091
38345
  });
38092
38346
  processContext.exit(1);
38093
38347
  return;
38094
38348
  }
38095
38349
  const outcome = result?.outcome ?? null;
38096
- if (outcome !== REQUEST_SENT_OUTCOME) {
38097
- OutputFormatter.error({
38098
- Result: RESULTS.Failure,
38099
- Message: `Top-up request was not sent (${outcome ?? "unknown"}).`,
38100
- Instructions: result?.message ?? "The user is not eligible for a top-up, or the organization has no active distribution."
38350
+ const message = result?.message ?? null;
38351
+ if (outcome === REQUEST_AUTO_GRANTED_OUTCOME) {
38352
+ const jobId = result?.jobId ?? null;
38353
+ OutputFormatter.success({
38354
+ Result: RESULTS.Success,
38355
+ Code: "TopUpAutoGranted",
38356
+ Data: { userId: resolved.userId, outcome, message, jobId },
38357
+ Instructions: jobId ? `Top-up granted by policy. Check progress with 'uip platform users top-ups get ${jobId}'.` : undefined
38101
38358
  });
38102
- processContext.exit(1);
38103
38359
  return;
38104
38360
  }
38105
38361
  OutputFormatter.success({
38106
38362
  Result: RESULTS.Success,
38107
38363
  Code: "TopUpRequested",
38108
- Data: {
38109
- userId: resolved.userId,
38110
- outcome,
38111
- message: result?.message ?? null
38112
- }
38364
+ Data: { userId: resolved.userId, outcome, message }
38113
38365
  });
38114
38366
  }
38115
38367
  var registerTopUpsCommand = (program) => {
@@ -38120,7 +38372,7 @@ var registerTopUpsCommand = (program) => {
38120
38372
  max: MAX_COUNT
38121
38373
  }), 1).option("--organization <account-id>", "Organization account GUID (defaults to the org from the current login).").examples(TOP_UPS_CREATE_EXAMPLES).trackedAction(processContext, (userInput, options) => handleTopUpCreate(userInput, options));
38122
38374
  topUps.command("get").description("Check the status of a top-up grant job. Use the job id returned by 'top-ups create'.").argument("<job-id>", "Top-up job id returned by 'top-ups create'.").option("--organization <account-id>", "Organization account GUID (defaults to the org from the current login).").examples(TOP_UPS_GET_EXAMPLES).trackedAction(processContext, (jobId, options) => handleTopUpGet(jobId, options));
38123
- topUps.command("request").description("Request a top-up for yourself (the logged-in user), which notifies the organization's admins. " + "It does not grant anything directly.").option("--organization <account-id>", "Organization account GUID (defaults to the org from the current login).").examples(TOP_UPS_REQUEST_EXAMPLES).trackedAction(processContext, (options) => handleTopUpRequest(options));
38375
+ topUps.command("request").description("Request a top-up for yourself (the logged-in user). The organization's admins are notified, " + "or, when a governance policy auto-grants top-ups, the top-up is granted right away and the grant job's id is returned.").option("--organization <account-id>", "Organization account GUID (defaults to the org from the current login).").examples(TOP_UPS_REQUEST_EXAMPLES).trackedAction(processContext, (options) => handleTopUpRequest(options));
38124
38376
  };
38125
38377
 
38126
38378
  // src/commands/users.ts
@@ -38640,4 +38892,4 @@ var registerCommands2 = async (program) => {
38640
38892
 
38641
38893
  export { Command, metadata2, registerCommands2 };
38642
38894
 
38643
- //# debugId=99D4324AEF436CE164756E2164756E21
38895
+ //# debugId=3A020ADAE39BE5BF64756E2164756E21
package/dist/tool.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  metadata2,
3
3
  registerCommands2
4
- } from "./tool-skzf0jvf.js";
4
+ } from "./tool-2dkjswkn.js";
5
5
  export {
6
6
  metadata2 as metadata,
7
7
  registerCommands2 as registerCommands
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@uipath/platform-tool",
3
3
  "author": "UiPath",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
- "version": "1.206.0-preview.301",
5
+ "version": "1.207.0-preview.305",
6
6
  "description": "Manage UiPath platform-level resources such as tenant licensing.",
7
7
  "publishConfig": {
8
8
  "registry": "https://registry.npmjs.org/"
@@ -21,5 +21,5 @@
21
21
  "keywords": [
22
22
  "cli-tool"
23
23
  ],
24
- "gitHead": "078afc3ef7ebf4c38353ee0059e321acf16a350d"
24
+ "gitHead": "1600aa89255c37c1b8bc68d9882c3395c1d5bff4"
25
25
  }