@uipath/ixp-tool 1.206.0-preview.303 → 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
  package_default,
4
4
  Command,
5
5
  registerCommands2
6
- } from "./tool-d3dh8cy6.js";
6
+ } from "./tool-adhh4raq.js";
7
7
 
8
8
  // src/index.ts
9
9
  var program = new Command;
@@ -2082,7 +2082,7 @@ var package_default = {
2082
2082
  name: "@uipath/ixp-tool",
2083
2083
  author: "UiPath",
2084
2084
  license: "SEE LICENSE IN LICENSE.txt",
2085
- version: "1.206.0-preview.303",
2085
+ version: "1.207.0-preview.305",
2086
2086
  description: "Manage UiPath IXP projects, prompts, predictions, and model publishing.",
2087
2087
  private: false,
2088
2088
  repository: {
@@ -2175,12 +2175,26 @@ class NodeFileSystem {
2175
2175
  throw error;
2176
2176
  }
2177
2177
  }
2178
- async writeFile(filePath, data) {
2178
+ async writeFile(filePath, data, options) {
2179
2179
  const dir = path.dirname(filePath);
2180
2180
  if (dir) {
2181
2181
  await fs.mkdir(dir, { recursive: true });
2182
2182
  }
2183
- await fs.writeFile(filePath, data);
2183
+ if (options?.mode === undefined || process.platform === "win32") {
2184
+ if (options?.exclusive) {
2185
+ await fs.writeFile(filePath, data, { flag: "wx" });
2186
+ } else {
2187
+ await fs.writeFile(filePath, data);
2188
+ }
2189
+ return;
2190
+ }
2191
+ const handle = await fs.open(filePath, options.exclusive ? "wx" : "w", options.mode);
2192
+ try {
2193
+ await handle.chmod(options.mode);
2194
+ await handle.writeFile(data);
2195
+ } finally {
2196
+ await handle.close();
2197
+ }
2184
2198
  }
2185
2199
  async appendFile(filePath, data) {
2186
2200
  const dir = path.dirname(filePath);
@@ -2215,7 +2229,8 @@ class NodeFileSystem {
2215
2229
  isDirectory: () => stats.isDirectory(),
2216
2230
  size: stats.size,
2217
2231
  mtimeMs: stats.mtimeMs,
2218
- ctimeMs: stats.ctimeMs
2232
+ ctimeMs: stats.ctimeMs,
2233
+ mode: stats.mode
2219
2234
  };
2220
2235
  } catch (error) {
2221
2236
  if (this.isEnoent(error))
@@ -2226,8 +2241,13 @@ class NodeFileSystem {
2226
2241
  async exists(filePath) {
2227
2242
  return existsSync(filePath);
2228
2243
  }
2229
- async mkdir(dirPath) {
2230
- await fs.mkdir(dirPath, { recursive: true });
2244
+ async mkdir(dirPath, options) {
2245
+ await fs.mkdir(dirPath, { recursive: true, mode: options?.mode });
2246
+ }
2247
+ async chmod(targetPath, mode) {
2248
+ if (process.platform === "win32")
2249
+ return;
2250
+ await fs.chmod(targetPath, mode);
2231
2251
  }
2232
2252
  async acquireLock(lockPath) {
2233
2253
  const canonicalPath = await this.canonicalizeLockTarget(lockPath);
@@ -2377,7 +2397,7 @@ class NodeFileSystem {
2377
2397
  async getTempDir() {
2378
2398
  return await fs.mkdtemp(path.join(os.tmpdir(), "uipath-fs-"));
2379
2399
  }
2380
- async copyDirectory(sourcePath, destPath) {
2400
+ async copyDirectory(sourcePath, destPath, options) {
2381
2401
  const sourceStats = await this.stat(sourcePath);
2382
2402
  if (!sourceStats) {
2383
2403
  throw new Error(`Source directory does not exist: ${sourcePath}`);
@@ -2394,7 +2414,9 @@ class NodeFileSystem {
2394
2414
  if (!entryStats)
2395
2415
  continue;
2396
2416
  if (entryStats.isDirectory()) {
2397
- await this.copyDirectory(srcEntry, destEntry);
2417
+ if (options?.skipDirectoryNames?.includes(entry))
2418
+ continue;
2419
+ await this.copyDirectory(srcEntry, destEntry, options);
2398
2420
  } else if (entryStats.isFile()) {
2399
2421
  const content = await this.readFile(srcEntry);
2400
2422
  if (content !== null) {
@@ -2457,13 +2479,15 @@ var ProjectDimensions = {
2457
2479
  SolutionKey: "SolutionKey",
2458
2480
  SolutionProjectKey: "SolutionProjectKey",
2459
2481
  SolutionIdentityStatus: "SolutionIdentityStatus",
2460
- PreviousSolutionKey: "PreviousSolutionKey"
2482
+ PreviousSolutionKey: "PreviousSolutionKey",
2483
+ PreviousProjectKey: "PreviousProjectKey"
2461
2484
  };
2462
2485
  var GUID_KEY_DIMENSIONS = new Set([
2463
2486
  ProjectDimensions.ProjectKey,
2464
2487
  ProjectDimensions.SolutionKey,
2465
2488
  ProjectDimensions.SolutionProjectKey,
2466
- ProjectDimensions.PreviousSolutionKey
2489
+ ProjectDimensions.PreviousSolutionKey,
2490
+ ProjectDimensions.PreviousProjectKey
2467
2491
  ]);
2468
2492
  var ShipDimensions = {
2469
2493
  ShipKind: "ShipKind",
@@ -2617,9 +2641,7 @@ async function withinProjectIdentityBudget(work, onTimeout) {
2617
2641
  }
2618
2642
  }
2619
2643
 
2620
- // ../common/src/telemetry/pseudonymize.ts
2621
- var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
2622
- var PSEUDONYM_HEX_LENGTH = 32;
2644
+ // ../common/src/sha256.ts
2623
2645
  var SHA256_K = new Uint32Array([
2624
2646
  1116352408,
2625
2647
  1899447441,
@@ -2699,7 +2721,7 @@ var SHA256_INITIAL_STATE = new Uint32Array([
2699
2721
  function rotr(value, bits) {
2700
2722
  return (value >>> bits | value << 32 - bits) >>> 0;
2701
2723
  }
2702
- function sha256Hex(input) {
2724
+ function sha256Words(input) {
2703
2725
  const bytes = new TextEncoder().encode(input);
2704
2726
  const paddedLength = bytes.length + 9 + 63 >> 6 << 6;
2705
2727
  const buffer = new Uint8Array(paddedLength);
@@ -2755,12 +2777,19 @@ function sha256Hex(input) {
2755
2777
  state[6] = state[6] + g >>> 0;
2756
2778
  state[7] = state[7] + h >>> 0;
2757
2779
  }
2780
+ return state;
2781
+ }
2782
+ function sha256Hex(input) {
2758
2783
  let hex = "";
2759
- for (const word of state) {
2784
+ for (const word of sha256Words(input)) {
2760
2785
  hex += word.toString(16).padStart(8, "0");
2761
2786
  }
2762
2787
  return hex;
2763
2788
  }
2789
+
2790
+ // ../common/src/telemetry/pseudonymize.ts
2791
+ var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
2792
+ var PSEUDONYM_HEX_LENGTH = 32;
2764
2793
  function resolveSha256Hex() {
2765
2794
  try {
2766
2795
  const nodeCrypto = __require("node:crypto");
@@ -3156,13 +3185,25 @@ function settlePromiseLike(thenable) {
3156
3185
  return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
3157
3186
  }
3158
3187
 
3188
+ // ../common/src/result-types.ts
3189
+ var RESULTS = {
3190
+ Success: "Success",
3191
+ Failure: "Failure",
3192
+ ConfigError: "ConfigError",
3193
+ AuthenticationError: "AuthenticationError",
3194
+ ValidationError: "ValidationError",
3195
+ TimeoutError: "TimeoutError"
3196
+ };
3197
+
3159
3198
  // ../common/src/error-codes.ts
3160
3199
  var CLI_ERROR_CODES = [
3161
3200
  "invalid_argument",
3201
+ "confirmation_required",
3162
3202
  "authentication_required",
3163
3203
  "permission_denied",
3164
3204
  "local_permission_denied",
3165
3205
  "not_found",
3206
+ "not_enabled",
3166
3207
  "rate_limited",
3167
3208
  "network_error",
3168
3209
  "timeout",
@@ -3201,6 +3242,12 @@ function carriedRetry(error) {
3201
3242
  const retry = error.retry;
3202
3243
  return isRetryHint(retry) ? retry : undefined;
3203
3244
  }
3245
+ function carriedResult(error) {
3246
+ if (!error || typeof error !== "object")
3247
+ return;
3248
+ const result = error.result;
3249
+ return typeof result === "string" && result !== RESULTS.Success && Object.values(RESULTS).includes(result) ? result : undefined;
3250
+ }
3204
3251
  function defaultRetryForErrorCode(errorCode) {
3205
3252
  switch (errorCode) {
3206
3253
  case "network_error":
@@ -3590,6 +3637,8 @@ async function extractErrorDetails(error, options) {
3590
3637
  }
3591
3638
  if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
3592
3639
  context.errorCode = parsedBody.errorCode;
3640
+ } else if (typeof parsedBody?.errorCode === "number") {
3641
+ context.errorCode = String(parsedBody.errorCode);
3593
3642
  } else if (parsedBody?.code && typeof parsedBody.code === "string") {
3594
3643
  context.errorCode = parsedBody.code;
3595
3644
  }
@@ -3646,15 +3695,6 @@ async function extractErrorDetails(error, options) {
3646
3695
  ...parsedErrors ? { parsedErrors } : {}
3647
3696
  };
3648
3697
  }
3649
- // ../common/src/result-types.ts
3650
- var RESULTS = {
3651
- Success: "Success",
3652
- Failure: "Failure",
3653
- ConfigError: "ConfigError",
3654
- AuthenticationError: "AuthenticationError",
3655
- ValidationError: "ValidationError",
3656
- TimeoutError: "TimeoutError"
3657
- };
3658
3698
  // ../../node_modules/commander/index.js
3659
3699
  var exports_commander = {};
3660
3700
  __exportCjs(exports_commander, {
@@ -4087,7 +4127,10 @@ var AUTH_ERROR_CODES = new Set([
4087
4127
  var LOCAL_PERMISSION_CLI_ERROR_CODES = new Set([
4088
4128
  "local_permission_denied"
4089
4129
  ]);
4090
- var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
4130
+ var VALIDATION_ERROR_CODES = new Set([
4131
+ "invalid_argument",
4132
+ "confirmation_required"
4133
+ ]);
4091
4134
  var NETWORK_HTTP_ERROR_CODES = new Set([
4092
4135
  "network_error",
4093
4136
  "rate_limited",
@@ -4313,6 +4356,109 @@ var CommonTelemetryEvents = {
4313
4356
  ShipSucceeded: "Cli.ShipSucceeded"
4314
4357
  };
4315
4358
 
4359
+ // ../common/src/telemetry/global-telemetry-properties.ts
4360
+ var telemetryPropsSlot = singleton("TelemetryDefaultProps");
4361
+ function getGlobalTelemetryProperties() {
4362
+ return telemetryPropsSlot.get();
4363
+ }
4364
+
4365
+ // ../common/src/telemetry/trace-context.ts
4366
+ var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
4367
+ var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
4368
+ function getProcessEnv() {
4369
+ return globalThis.process?.env;
4370
+ }
4371
+ function parseInboundTraceparent(value) {
4372
+ if (!value) {
4373
+ return;
4374
+ }
4375
+ const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
4376
+ if (!match) {
4377
+ return;
4378
+ }
4379
+ const [, traceId, parentSpanId] = match;
4380
+ if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
4381
+ return;
4382
+ }
4383
+ return { traceId, parentSpanId };
4384
+ }
4385
+ function getInboundTraceContext() {
4386
+ return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
4387
+ }
4388
+
4389
+ // ../common/src/telemetry/session-id.ts
4390
+ var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
4391
+ var SESSION_ID_MAX_LENGTH = 64;
4392
+ var RANDOM_SESSION_ID_LENGTH = 32;
4393
+ var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
4394
+ var CONTROL_CHARACTERS = /\p{Cc}/gu;
4395
+ var INHERITED_SESSION_SOURCES = [
4396
+ { envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
4397
+ { envVar: "CODEX_THREAD_ID", source: "codex" },
4398
+ { envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
4399
+ { envVar: "TERM_SESSION_ID", source: "terminal" },
4400
+ { envVar: "WT_SESSION", source: "terminal" }
4401
+ ];
4402
+ var telemetrySessionSlot = singleton("TelemetrySession");
4403
+ var telemetryOperationIdSlot = singleton("TelemetryOperationId");
4404
+ function getProcessEnv2() {
4405
+ return globalThis.process?.env;
4406
+ }
4407
+ function normalizeSessionId(value) {
4408
+ if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
4409
+ return;
4410
+ }
4411
+ const cleaned = String(value).replace(CONTROL_CHARACTERS, "").trim().slice(0, SESSION_ID_MAX_LENGTH);
4412
+ return cleaned || undefined;
4413
+ }
4414
+ function getConfiguredTelemetrySessionId() {
4415
+ return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
4416
+ }
4417
+ function getInheritedSession(env) {
4418
+ for (const candidate of INHERITED_SESSION_SOURCES) {
4419
+ const handle = normalizeSessionId(env[candidate.envVar]);
4420
+ if (handle) {
4421
+ return { id: handle, source: candidate.source };
4422
+ }
4423
+ }
4424
+ return;
4425
+ }
4426
+ function generateRandomSession() {
4427
+ const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
4428
+ crypto.getRandomValues(bytes);
4429
+ let hex = "";
4430
+ for (const byte of bytes) {
4431
+ hex += byte.toString(16).padStart(2, "0");
4432
+ }
4433
+ return { id: hex, source: "random" };
4434
+ }
4435
+ function resolveTelemetrySession() {
4436
+ const existing = telemetrySessionSlot.get();
4437
+ if (existing) {
4438
+ return existing;
4439
+ }
4440
+ const declaredHandle = getConfiguredTelemetrySessionId();
4441
+ const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
4442
+ telemetrySessionSlot.set(resolved);
4443
+ return resolved;
4444
+ }
4445
+ function getTelemetrySessionId() {
4446
+ return resolveTelemetrySession().id;
4447
+ }
4448
+ function getTelemetrySessionSource() {
4449
+ return resolveTelemetrySession().source;
4450
+ }
4451
+ function getTelemetryOperationId() {
4452
+ const existing = telemetryOperationIdSlot.get();
4453
+ if (existing) {
4454
+ return existing;
4455
+ }
4456
+ const inboundTraceId = getInboundTraceContext()?.traceId;
4457
+ const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
4458
+ telemetryOperationIdSlot.set(generated);
4459
+ return generated;
4460
+ }
4461
+
4316
4462
  // ../common/src/registry.ts
4317
4463
  import { execFileSync } from "node:child_process";
4318
4464
  function readRegistryValue(keyPath, valueName) {
@@ -4534,108 +4680,6 @@ class NodeContextStorage {
4534
4680
  return this.storage.getStore();
4535
4681
  }
4536
4682
  }
4537
- // ../common/src/telemetry/trace-context.ts
4538
- var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
4539
- var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
4540
- function getProcessEnv() {
4541
- return globalThis.process?.env;
4542
- }
4543
- function parseInboundTraceparent(value) {
4544
- if (!value) {
4545
- return;
4546
- }
4547
- const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
4548
- if (!match) {
4549
- return;
4550
- }
4551
- const [, traceId, parentSpanId] = match;
4552
- if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
4553
- return;
4554
- }
4555
- return { traceId, parentSpanId };
4556
- }
4557
- function getInboundTraceContext() {
4558
- return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
4559
- }
4560
-
4561
- // ../common/src/telemetry/session-id.ts
4562
- var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
4563
- var SESSION_ID_MAX_LENGTH = 64;
4564
- var RANDOM_SESSION_ID_LENGTH = 32;
4565
- var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
4566
- var CONTROL_CHARACTERS = /\p{Cc}/gu;
4567
- var INHERITED_SESSION_SOURCES = [
4568
- { envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
4569
- { envVar: "CODEX_THREAD_ID", source: "codex" },
4570
- { envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
4571
- { envVar: "TERM_SESSION_ID", source: "terminal" },
4572
- { envVar: "WT_SESSION", source: "terminal" }
4573
- ];
4574
- var telemetrySessionSlot = singleton("TelemetrySession");
4575
- var telemetryOperationIdSlot = singleton("TelemetryOperationId");
4576
- function getProcessEnv2() {
4577
- return globalThis.process?.env;
4578
- }
4579
- function normalizeSessionId(value) {
4580
- if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
4581
- return;
4582
- }
4583
- const cleaned = String(value).replace(CONTROL_CHARACTERS, "").trim().slice(0, SESSION_ID_MAX_LENGTH);
4584
- return cleaned || undefined;
4585
- }
4586
- function getConfiguredTelemetrySessionId() {
4587
- return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
4588
- }
4589
- function getInheritedSession(env) {
4590
- for (const candidate of INHERITED_SESSION_SOURCES) {
4591
- const handle = normalizeSessionId(env[candidate.envVar]);
4592
- if (handle) {
4593
- return { id: handle, source: candidate.source };
4594
- }
4595
- }
4596
- return;
4597
- }
4598
- function generateRandomSession() {
4599
- const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
4600
- crypto.getRandomValues(bytes);
4601
- let hex = "";
4602
- for (const byte of bytes) {
4603
- hex += byte.toString(16).padStart(2, "0");
4604
- }
4605
- return { id: hex, source: "random" };
4606
- }
4607
- function resolveTelemetrySession() {
4608
- const existing = telemetrySessionSlot.get();
4609
- if (existing) {
4610
- return existing;
4611
- }
4612
- const declaredHandle = getConfiguredTelemetrySessionId();
4613
- const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
4614
- telemetrySessionSlot.set(resolved);
4615
- return resolved;
4616
- }
4617
- function getTelemetrySessionId() {
4618
- return resolveTelemetrySession().id;
4619
- }
4620
- function getTelemetrySessionSource() {
4621
- return resolveTelemetrySession().source;
4622
- }
4623
- function getTelemetryOperationId() {
4624
- const existing = telemetryOperationIdSlot.get();
4625
- if (existing) {
4626
- return existing;
4627
- }
4628
- const inboundTraceId = getInboundTraceContext()?.traceId;
4629
- const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
4630
- telemetryOperationIdSlot.set(generated);
4631
- return generated;
4632
- }
4633
- // ../common/src/telemetry/global-telemetry-properties.ts
4634
- var telemetryPropsSlot = singleton("TelemetryDefaultProps");
4635
- function getGlobalTelemetryProperties() {
4636
- return telemetryPropsSlot.get();
4637
- }
4638
-
4639
4683
  // ../common/src/telemetry/span-clock.ts
4640
4684
  function startSpanClock() {
4641
4685
  const started = performance.now();
@@ -4849,6 +4893,7 @@ var MAX_SPOOL_AGE_MS = 72 * 60 * 60 * 1000;
4849
4893
  // ../common/src/telemetry/telemetry-init.ts
4850
4894
  var telemetryInstanceSlot = singleton("TelemetryService");
4851
4895
  var DEFAULT_AI_CONNECTION_STRING = atob("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj");
4896
+ var browserProviderSlot = singleton("BrowserAppInsightsTelemetryProvider");
4852
4897
  function getGlobalTelemetryInstance() {
4853
4898
  const existing = telemetryInstanceSlot.get();
4854
4899
  if (existing && typeof existing === "object" && "trackEvent" in existing && typeof existing.trackEvent === "function") {
@@ -5032,7 +5077,7 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
5032
5077
  const pagedRows = extractPagedRows(data.Data);
5033
5078
  const items = pagedRows ?? (Array.isArray(data.Data) ? data.Data : [data.Data]);
5034
5079
  items.forEach((item) => {
5035
- const values = Object.values(item).map((v) => v ?? "").join("\t");
5080
+ const values = item === null || typeof item !== "object" ? String(item ?? "") : Object.values(item).map((v) => v ?? "").join("\t");
5036
5081
  logFn(values);
5037
5082
  });
5038
5083
  } else {
@@ -5047,7 +5092,8 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
5047
5092
  default: {
5048
5093
  const hasData = "Data" in data && data.Data != null;
5049
5094
  const pagedRows = hasData ? extractPagedRows(data.Data) : null;
5050
- const rows = pagedRows ? pagedRows : Array.isArray(data.Data) ? data.Data : null;
5095
+ const resolvedRows = pagedRows ? pagedRows : Array.isArray(data.Data) ? data.Data : null;
5096
+ const rows = resolvedRows && isPrimitiveArray(resolvedRows) ? resolvedRows.map((entry) => ({ Value: entry })) : resolvedRows;
5051
5097
  if (hasData && !(rows !== null && rows.length === 0)) {
5052
5098
  const logValue = data.Log;
5053
5099
  if (rows !== null) {
@@ -5104,6 +5150,9 @@ function printTable(data, logFn, externalLogValue, tableRowStyle) {
5104
5150
  function isPlainObjectArray(value) {
5105
5151
  return Array.isArray(value) && value.length > 0 && value.every(isPlainRecord);
5106
5152
  }
5153
+ function isPrimitiveArray(value) {
5154
+ return Array.isArray(value) && value.length > 0 && value.every((entry) => entry === null || typeof entry !== "object");
5155
+ }
5107
5156
  function isNonEmptyPlainObject(value) {
5108
5157
  return isPlainRecord(value) && Object.keys(value).length > 0;
5109
5158
  }
@@ -5450,12 +5499,12 @@ class FilterEvaluationError extends Error {
5450
5499
  instructions;
5451
5500
  retry = "RetryWillNotFix";
5452
5501
  result = RESULTS.ValidationError;
5453
- constructor(filter, cause) {
5502
+ constructor(filter, cause, hint) {
5454
5503
  const underlying = cause instanceof Error ? cause.message : String(cause);
5455
- super(`Filter '${filter}' failed to evaluate: ${underlying}`);
5504
+ super(`Filter '${filter}' failed to evaluate: ${underlying}` + (hint ? ` ${hint.detail}` : ""));
5456
5505
  this.name = "FilterEvaluationError";
5457
5506
  this.filter = filter;
5458
- 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(@)'.";
5507
+ 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(@)'.";
5459
5508
  }
5460
5509
  }
5461
5510
 
@@ -5577,6 +5626,93 @@ function nameList(names, cap = 12) {
5577
5626
  const rest = names.length - shown.length;
5578
5627
  return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
5579
5628
  }
5629
+ function notFieldsOn(names, scope) {
5630
+ return `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
5631
+ }
5632
+ function failingFieldRead(ast, isList, fn, argIndex) {
5633
+ const [left, right, condition] = ast.children ?? [];
5634
+ let scopes = [];
5635
+ if (!isList) {
5636
+ scopes = [ast];
5637
+ } else if (ast.type === "FilterProjection" && left?.type === "Identity") {
5638
+ scopes = [condition, right];
5639
+ } else if (ast.type === "Projection" && (left?.type === "Identity" || left?.type === "Flatten" && left.children?.[0]?.type === "Identity")) {
5640
+ scopes = [right];
5641
+ }
5642
+ const reads = new Set;
5643
+ let tracked = 0;
5644
+ const visit = (node) => {
5645
+ if (!node)
5646
+ return;
5647
+ switch (node.type) {
5648
+ case "Function": {
5649
+ const arg = node.children?.[argIndex - 1];
5650
+ if (node.name === fn && arg?.type === "Field" && arg.name) {
5651
+ reads.add(arg.name);
5652
+ tracked++;
5653
+ }
5654
+ node.children?.forEach(visit);
5655
+ return;
5656
+ }
5657
+ case "AndExpression":
5658
+ case "OrExpression":
5659
+ case "NotExpression":
5660
+ case "Comparator":
5661
+ case "MultiSelectList":
5662
+ case "MultiSelectHash":
5663
+ node.children?.forEach(visit);
5664
+ return;
5665
+ case "KeyValuePair":
5666
+ visit(node.value);
5667
+ return;
5668
+ }
5669
+ };
5670
+ scopes.forEach(visit);
5671
+ const calls = (node) => {
5672
+ if (node === null || typeof node !== "object")
5673
+ return 0;
5674
+ const own = node.type === "Function" && node.name === fn ? 1 : 0;
5675
+ const next = node.type === "KeyValuePair" ? [node.value] : node.children ?? [];
5676
+ return own + next.reduce((sum, child) => sum + calls(child), 0);
5677
+ };
5678
+ return reads.size === 1 && tracked === calls(ast) ? [...reads][0] : undefined;
5679
+ }
5680
+ function fieldExpression(name) {
5681
+ return /^[A-Za-z_]\w*$/.test(name) ? name : JSON.stringify(name);
5682
+ }
5683
+ function evaluationHint(codec, filter, data, cause) {
5684
+ const underlying = cause instanceof Error ? cause.message : String(cause);
5685
+ const failure = /\b(\w+)\(\) expected argument (\d+) to be type (\S+) but received type null\b/.exec(underlying);
5686
+ if (!failure)
5687
+ return;
5688
+ const [, fn, position, expected] = failure;
5689
+ const name = failingFieldRead(codec.compile(filter), Array.isArray(data), fn, Number(position));
5690
+ if (name === undefined)
5691
+ return;
5692
+ const present = availableFields(data);
5693
+ if (present.length === 0)
5694
+ return;
5695
+ const scope = `${countRecords(data)} record(s)`;
5696
+ if (!present.includes(name)) {
5697
+ return {
5698
+ detail: `${notFieldsOn([name], scope)}. Available fields: ${nameList(present)}.`,
5699
+ instructions: "Use a field the records have; names are case-sensitive."
5700
+ };
5701
+ }
5702
+ const records = Array.isArray(data) ? data : [data];
5703
+ const unset = records.filter((r) => r?.[name] == null).length;
5704
+ const field = fieldExpression(name);
5705
+ let fallback;
5706
+ if (expected.split(",").includes("string")) {
5707
+ fallback = "''";
5708
+ } else if (expected.split(",").includes("array")) {
5709
+ fallback = "`[]`";
5710
+ }
5711
+ return {
5712
+ detail: `\`${name}\` is null or missing on ${unset} of the ${scope} it read.`,
5713
+ 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.`
5714
+ };
5715
+ }
5580
5716
  function buildFilterWarning(filter, data, outcome) {
5581
5717
  const present = availableFields(data);
5582
5718
  const refs = referencedFields(filter);
@@ -5584,7 +5720,7 @@ function buildFilterWarning(filter, data, outcome) {
5584
5720
  const unchecked = refs.nested.filter((name) => !present.includes(name));
5585
5721
  const count = countRecords(data);
5586
5722
  const scope = `${count} record(s)`;
5587
- const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
5723
+ const isNotAField = (names) => notFieldsOn(names, scope);
5588
5724
  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" : "";
5589
5725
  const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
5590
5726
  let detail;
@@ -5635,7 +5771,8 @@ function applyFilter(data, filter, onWarning) {
5635
5771
  try {
5636
5772
  result = codec.search(data, filter);
5637
5773
  } catch (err) {
5638
- throw new FilterEvaluationError(filter, err);
5774
+ const [, hint] = catchError(() => evaluationHint(codec, filter, data, err));
5775
+ throw new FilterEvaluationError(filter, err, hint);
5639
5776
  }
5640
5777
  const inputCount = countRecords(data);
5641
5778
  const warn = (outcome) => {
@@ -6526,7 +6663,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
6526
6663
  logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
6527
6664
  const typed = error;
6528
6665
  const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
6529
- const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
6666
+ const customResult = carriedResult(error);
6530
6667
  const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
6531
6668
  const classified = cancellationExitCode === undefined ? await extractErrorDetails(error) : undefined;
6532
6669
  const finalResult = customResult ?? classified?.result ?? RESULTS.Failure;
@@ -6600,14 +6737,17 @@ Command.prototype.trackedAction = function(context, fn, properties) {
6600
6737
  // ../common/src/completer.ts
6601
6738
  var COMPLETER_SYMBOL = Symbol.for("@uipath/common/completer");
6602
6739
  // ../common/src/confirmation.ts
6603
- function requireConfirmation(flags, operation) {
6740
+ function requireConfirmation(flags, operation, options) {
6604
6741
  if (flags.yes === true || flags.force === true) {
6605
6742
  return true;
6606
6743
  }
6744
+ const message = options?.reversible ? `Confirmation required: this will ${operation}.` : `Confirmation required: this will ${operation} and cannot be undone.`;
6607
6745
  OutputFormatter.error({
6608
6746
  Result: RESULTS.Failure,
6609
- Message: `Confirmation required: this will ${operation} and cannot be undone.`,
6610
- Instructions: "Re-run with --yes to confirm."
6747
+ Message: message,
6748
+ Instructions: options?.instructions ?? "Re-run with --yes to confirm.",
6749
+ ErrorCode: "confirmation_required",
6750
+ Retry: "RetryWillNotFix"
6611
6751
  });
6612
6752
  processContext.exit(1);
6613
6753
  return false;
@@ -7039,6 +7179,8 @@ var FAILURE_STATUSES = new Set([
7039
7179
  "canceled",
7040
7180
  "stopped"
7041
7181
  ]);
7182
+ // ../common/src/relayed-output.ts
7183
+ var RELAYED_OUTPUT_SYMBOL = Symbol.for("@uipath/common/relayed-output");
7042
7184
  // ../common/src/screen-logger.ts
7043
7185
  var ScreenLogger;
7044
7186
  ((ScreenLogger) => {
@@ -7194,6 +7336,8 @@ function settlePromiseLike2(thenable) {
7194
7336
  // ../auth/src/constants.ts
7195
7337
  var UIPATH_HOME_DIR = ".uipath";
7196
7338
  var AUTH_FILENAME = ".auth";
7339
+ var AUTH_FILE_MODE = 384;
7340
+ var AUTH_DIR_MODE = 448;
7197
7341
  var DEFAULT_BASE_URL = "https://cloud.uipath.com";
7198
7342
  var DEFAULT_AUTH_TIMEOUT_MS2 = 5 * 60 * 1000;
7199
7343
 
@@ -8017,6 +8161,38 @@ var loadEnvFileAsync = async ({ envPath }) => {
8017
8161
  }
8018
8162
  return parseEnvContent(content);
8019
8163
  };
8164
+ var findAuthHomeDir = (fs, dir) => {
8165
+ let current = dir;
8166
+ for (;; ) {
8167
+ if (fs.path.basename(current) === UIPATH_HOME_DIR)
8168
+ return current;
8169
+ const parent = fs.path.dirname(current);
8170
+ if (parent === current)
8171
+ return;
8172
+ current = parent;
8173
+ }
8174
+ };
8175
+ var TEMP_FILE_ATTEMPTS = 5;
8176
+ var isFileExists = (error) => error instanceof Error && error.code === "EEXIST";
8177
+ var writeTempFile = async (fs, targetPath, content) => {
8178
+ for (let attempt = 1;; attempt++) {
8179
+ const tempPath = `${targetPath}.${crypto.randomUUID()}.tmp`;
8180
+ try {
8181
+ await fs.writeFile(tempPath, content, {
8182
+ mode: AUTH_FILE_MODE,
8183
+ exclusive: true
8184
+ });
8185
+ return tempPath;
8186
+ } catch (error) {
8187
+ if (!isFileExists(error)) {
8188
+ await fs.rm(tempPath).catch(() => {});
8189
+ throw error;
8190
+ }
8191
+ if (attempt === TEMP_FILE_ATTEMPTS)
8192
+ throw error;
8193
+ }
8194
+ }
8195
+ };
8020
8196
  var saveEnvFileAsync = async ({
8021
8197
  envPath,
8022
8198
  data,
@@ -8044,10 +8220,18 @@ var saveEnvFileAsync = async ({
8044
8220
  `)}
8045
8221
  `;
8046
8222
  const dir = fs.path.dirname(absolutePath);
8047
- await fs.mkdir(dir);
8048
- const tempPath = `${absolutePath}.tmp`;
8049
- await fs.writeFile(tempPath, content);
8050
- await fs.rename(tempPath, absolutePath);
8223
+ await fs.mkdir(dir, { mode: AUTH_DIR_MODE });
8224
+ const authHomeDir = findAuthHomeDir(fs, dir);
8225
+ if (authHomeDir !== undefined) {
8226
+ await fs.chmod?.(authHomeDir, AUTH_DIR_MODE);
8227
+ }
8228
+ const tempPath = await writeTempFile(fs, absolutePath, content);
8229
+ try {
8230
+ await fs.rename(tempPath, absolutePath);
8231
+ } catch (error) {
8232
+ await fs.rm(tempPath).catch(() => {});
8233
+ throw error;
8234
+ }
8051
8235
  };
8052
8236
 
8053
8237
  // ../auth/src/loginStatus.ts
@@ -8647,7 +8831,7 @@ var package_default2 = {
8647
8831
  name: "@uipath/ixp-sdk",
8648
8832
  author: "UiPath",
8649
8833
  license: "SEE LICENSE IN LICENSE.txt",
8650
- version: "1.206.0-preview.303",
8834
+ version: "1.207.0-preview.305",
8651
8835
  description: "SDK for the UiPath IXP (Intelligent eXtraction Platform) API — projects, taxonomies, prompts, predictions, and model publishing.",
8652
8836
  repository: {
8653
8837
  type: "git",
@@ -8753,12 +8937,49 @@ class IxpHttpError extends Error {
8753
8937
  };
8754
8938
  }
8755
8939
  }
8940
+
8941
+ class IxpServiceNotEnabledError extends Error {
8942
+ status;
8943
+ constructor(status, url) {
8944
+ super(`IXP service is not enabled: ${status} response - URL: ${url}`);
8945
+ this.name = "IxpServiceNotEnabledError";
8946
+ this.status = status;
8947
+ }
8948
+ }
8949
+ var GATEWAY_SERVICE_NOT_FOUND = /^Service: \S+ not found in Organization: /;
8950
+ var SERVICE_NOT_INSTALLED_CODE = "[ServiceNotInstalledError]";
8951
+ function hasServiceNotInstalledCode(body) {
8952
+ try {
8953
+ const parsed = JSON.parse(body);
8954
+ if (parsed === null || typeof parsed !== "object")
8955
+ return false;
8956
+ const { Code, code } = parsed;
8957
+ return (Code ?? code) === SERVICE_NOT_INSTALLED_CODE;
8958
+ } catch {
8959
+ return false;
8960
+ }
8961
+ }
8962
+ async function assertServiceEnabled(response, url) {
8963
+ const contentType = response.headers.get("content-type") ?? "";
8964
+ const isHtml = contentType.toLowerCase().startsWith("text/html");
8965
+ if (isHtml && (response.ok || response.status === 404)) {
8966
+ throw new IxpServiceNotEnabledError(response.status, url);
8967
+ }
8968
+ if (response.status !== 404)
8969
+ return;
8970
+ const body = (await response.clone().text()).trim();
8971
+ const notEnabled = contentType.includes("json") ? hasServiceNotInstalledCode(body) : GATEWAY_SERVICE_NOT_FOUND.test(body);
8972
+ if (notEnabled) {
8973
+ throw new IxpServiceNotEnabledError(response.status, url);
8974
+ }
8975
+ }
8756
8976
  async function request(config, url, init, errorMessage) {
8757
8977
  const response = await fetch(url, {
8758
8978
  method: init.method,
8759
8979
  body: init.body,
8760
8980
  headers: { ...baseHeaders(config), ...JSON_CONTENT_HEADERS }
8761
8981
  });
8982
+ await assertServiceEnabled(response, url);
8762
8983
  if (!response.ok) {
8763
8984
  const errorText = await response.text();
8764
8985
  throw new IxpHttpError(errorMessage, response.status, response.statusText, url, errorText);
@@ -8797,6 +9018,7 @@ async function designtimeUploadMultipart(config, path, formData, errorMessage) {
8797
9018
  headers: baseHeaders(config),
8798
9019
  body: formData
8799
9020
  });
9021
+ await assertServiceEnabled(response, url);
8800
9022
  if (!response.ok) {
8801
9023
  const errorText = await response.text();
8802
9024
  throw new IxpHttpError(errorMessage, response.status, response.statusText, url, errorText);
@@ -8809,6 +9031,7 @@ async function designtimeDownloadBinary(config, path, errorMessage) {
8809
9031
  method: "GET",
8810
9032
  headers: baseHeaders(config)
8811
9033
  });
9034
+ await assertServiceEnabled(response, url);
8812
9035
  if (!response.ok) {
8813
9036
  const errorText = await response.text();
8814
9037
  throw new IxpHttpError(errorMessage, response.status, response.statusText, url, errorText);
@@ -9027,6 +9250,10 @@ async function updateFieldPrompts(config, projectName, updates) {
9027
9250
  }, "Failed to update field prompts");
9028
9251
  }
9029
9252
  // src/utils/emit-error.ts
9253
+ var SERVICE_NOT_ENABLED_INSTRUCTIONS = "The IXP service is not enabled in your environment.";
9254
+ function isServiceNotEnabled(error) {
9255
+ return error instanceof Error && error.name === "IxpServiceNotEnabledError";
9256
+ }
9030
9257
  function pickString(...values) {
9031
9258
  return values.find((v) => typeof v === "string" && v.length > 0);
9032
9259
  }
@@ -9051,6 +9278,18 @@ function httpStatusOf(error) {
9051
9278
  return typeof status === "number" ? status : undefined;
9052
9279
  }
9053
9280
  async function emitError(error, message, hint) {
9281
+ if (isServiceNotEnabled(error)) {
9282
+ const status = httpStatusOf(error);
9283
+ OutputFormatter.error({
9284
+ Result: RESULTS.Failure,
9285
+ ErrorCode: "not_supported",
9286
+ Message: message,
9287
+ Instructions: SERVICE_NOT_ENABLED_INSTRUCTIONS,
9288
+ Retry: "RetryWillNotFix",
9289
+ ...status !== undefined ? { Context: { httpStatus: status } } : {}
9290
+ });
9291
+ return;
9292
+ }
9054
9293
  const details = await extractErrorDetails(error);
9055
9294
  const body = await parseResponseBody(error);
9056
9295
  let instructions = details.message;
@@ -11588,4 +11827,4 @@ var registerCommands2 = async (program) => {
11588
11827
 
11589
11828
  export { package_default, Command, metadata2, registerCommands2 };
11590
11829
 
11591
- //# debugId=4F43A6F86EA99AA764756E2164756E21
11830
+ //# debugId=66CAF77939811CB464756E2164756E21
package/dist/tool.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  metadata2,
3
3
  registerCommands2
4
- } from "./tool-d3dh8cy6.js";
4
+ } from "./tool-adhh4raq.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/ixp-tool",
3
3
  "author": "UiPath",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
- "version": "1.206.0-preview.303",
5
+ "version": "1.207.0-preview.305",
6
6
  "description": "Manage UiPath IXP projects, prompts, predictions, and model publishing.",
7
7
  "private": false,
8
8
  "repository": {
@@ -27,5 +27,5 @@
27
27
  "files": [
28
28
  "dist"
29
29
  ],
30
- "gitHead": "7d17b8a3c1a50892d42c9302087abc8307b04409"
30
+ "gitHead": "1600aa89255c37c1b8bc68d9882c3395c1d5bff4"
31
31
  }