@uipath/pm-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-bgzvqa5f.js";
6
+ } from "./tool-f3hgzc0f.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/pm-tool",
2083
2083
  author: "UiPath",
2084
2084
  license: "SEE LICENSE IN LICENSE.txt",
2085
- version: "1.206.0-preview.301",
2085
+ version: "1.207.0-preview.305",
2086
2086
  description: "Process Mining — process apps, transformations, and data ingestion.",
2087
2087
  private: false,
2088
2088
  repository: {
@@ -2174,12 +2174,26 @@ class NodeFileSystem {
2174
2174
  throw error;
2175
2175
  }
2176
2176
  }
2177
- async writeFile(filePath, data) {
2177
+ async writeFile(filePath, data, options) {
2178
2178
  const dir = path.dirname(filePath);
2179
2179
  if (dir) {
2180
2180
  await fs.mkdir(dir, { recursive: true });
2181
2181
  }
2182
- await fs.writeFile(filePath, data);
2182
+ if (options?.mode === undefined || process.platform === "win32") {
2183
+ if (options?.exclusive) {
2184
+ await fs.writeFile(filePath, data, { flag: "wx" });
2185
+ } else {
2186
+ await fs.writeFile(filePath, data);
2187
+ }
2188
+ return;
2189
+ }
2190
+ const handle = await fs.open(filePath, options.exclusive ? "wx" : "w", options.mode);
2191
+ try {
2192
+ await handle.chmod(options.mode);
2193
+ await handle.writeFile(data);
2194
+ } finally {
2195
+ await handle.close();
2196
+ }
2183
2197
  }
2184
2198
  async appendFile(filePath, data) {
2185
2199
  const dir = path.dirname(filePath);
@@ -2214,7 +2228,8 @@ class NodeFileSystem {
2214
2228
  isDirectory: () => stats.isDirectory(),
2215
2229
  size: stats.size,
2216
2230
  mtimeMs: stats.mtimeMs,
2217
- ctimeMs: stats.ctimeMs
2231
+ ctimeMs: stats.ctimeMs,
2232
+ mode: stats.mode
2218
2233
  };
2219
2234
  } catch (error) {
2220
2235
  if (this.isEnoent(error))
@@ -2225,8 +2240,13 @@ class NodeFileSystem {
2225
2240
  async exists(filePath) {
2226
2241
  return existsSync(filePath);
2227
2242
  }
2228
- async mkdir(dirPath) {
2229
- await fs.mkdir(dirPath, { recursive: true });
2243
+ async mkdir(dirPath, options) {
2244
+ await fs.mkdir(dirPath, { recursive: true, mode: options?.mode });
2245
+ }
2246
+ async chmod(targetPath, mode) {
2247
+ if (process.platform === "win32")
2248
+ return;
2249
+ await fs.chmod(targetPath, mode);
2230
2250
  }
2231
2251
  async acquireLock(lockPath) {
2232
2252
  const canonicalPath = await this.canonicalizeLockTarget(lockPath);
@@ -2376,7 +2396,7 @@ class NodeFileSystem {
2376
2396
  async getTempDir() {
2377
2397
  return await fs.mkdtemp(path.join(os.tmpdir(), "uipath-fs-"));
2378
2398
  }
2379
- async copyDirectory(sourcePath, destPath) {
2399
+ async copyDirectory(sourcePath, destPath, options) {
2380
2400
  const sourceStats = await this.stat(sourcePath);
2381
2401
  if (!sourceStats) {
2382
2402
  throw new Error(`Source directory does not exist: ${sourcePath}`);
@@ -2393,7 +2413,9 @@ class NodeFileSystem {
2393
2413
  if (!entryStats)
2394
2414
  continue;
2395
2415
  if (entryStats.isDirectory()) {
2396
- await this.copyDirectory(srcEntry, destEntry);
2416
+ if (options?.skipDirectoryNames?.includes(entry))
2417
+ continue;
2418
+ await this.copyDirectory(srcEntry, destEntry, options);
2397
2419
  } else if (entryStats.isFile()) {
2398
2420
  const content = await this.readFile(srcEntry);
2399
2421
  if (content !== null) {
@@ -2456,13 +2478,15 @@ var ProjectDimensions = {
2456
2478
  SolutionKey: "SolutionKey",
2457
2479
  SolutionProjectKey: "SolutionProjectKey",
2458
2480
  SolutionIdentityStatus: "SolutionIdentityStatus",
2459
- PreviousSolutionKey: "PreviousSolutionKey"
2481
+ PreviousSolutionKey: "PreviousSolutionKey",
2482
+ PreviousProjectKey: "PreviousProjectKey"
2460
2483
  };
2461
2484
  var GUID_KEY_DIMENSIONS = new Set([
2462
2485
  ProjectDimensions.ProjectKey,
2463
2486
  ProjectDimensions.SolutionKey,
2464
2487
  ProjectDimensions.SolutionProjectKey,
2465
- ProjectDimensions.PreviousSolutionKey
2488
+ ProjectDimensions.PreviousSolutionKey,
2489
+ ProjectDimensions.PreviousProjectKey
2466
2490
  ]);
2467
2491
  var ShipDimensions = {
2468
2492
  ShipKind: "ShipKind",
@@ -2616,9 +2640,7 @@ async function withinProjectIdentityBudget(work, onTimeout) {
2616
2640
  }
2617
2641
  }
2618
2642
 
2619
- // ../common/src/telemetry/pseudonymize.ts
2620
- var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
2621
- var PSEUDONYM_HEX_LENGTH = 32;
2643
+ // ../common/src/sha256.ts
2622
2644
  var SHA256_K = new Uint32Array([
2623
2645
  1116352408,
2624
2646
  1899447441,
@@ -2698,7 +2720,7 @@ var SHA256_INITIAL_STATE = new Uint32Array([
2698
2720
  function rotr(value, bits) {
2699
2721
  return (value >>> bits | value << 32 - bits) >>> 0;
2700
2722
  }
2701
- function sha256Hex(input) {
2723
+ function sha256Words(input) {
2702
2724
  const bytes = new TextEncoder().encode(input);
2703
2725
  const paddedLength = bytes.length + 9 + 63 >> 6 << 6;
2704
2726
  const buffer = new Uint8Array(paddedLength);
@@ -2754,12 +2776,19 @@ function sha256Hex(input) {
2754
2776
  state[6] = state[6] + g >>> 0;
2755
2777
  state[7] = state[7] + h >>> 0;
2756
2778
  }
2779
+ return state;
2780
+ }
2781
+ function sha256Hex(input) {
2757
2782
  let hex = "";
2758
- for (const word of state) {
2783
+ for (const word of sha256Words(input)) {
2759
2784
  hex += word.toString(16).padStart(8, "0");
2760
2785
  }
2761
2786
  return hex;
2762
2787
  }
2788
+
2789
+ // ../common/src/telemetry/pseudonymize.ts
2790
+ var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
2791
+ var PSEUDONYM_HEX_LENGTH = 32;
2763
2792
  function resolveSha256Hex() {
2764
2793
  try {
2765
2794
  const nodeCrypto = __require("node:crypto");
@@ -3155,13 +3184,25 @@ function settlePromiseLike(thenable) {
3155
3184
  return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
3156
3185
  }
3157
3186
 
3187
+ // ../common/src/result-types.ts
3188
+ var RESULTS = {
3189
+ Success: "Success",
3190
+ Failure: "Failure",
3191
+ ConfigError: "ConfigError",
3192
+ AuthenticationError: "AuthenticationError",
3193
+ ValidationError: "ValidationError",
3194
+ TimeoutError: "TimeoutError"
3195
+ };
3196
+
3158
3197
  // ../common/src/error-codes.ts
3159
3198
  var CLI_ERROR_CODES = [
3160
3199
  "invalid_argument",
3200
+ "confirmation_required",
3161
3201
  "authentication_required",
3162
3202
  "permission_denied",
3163
3203
  "local_permission_denied",
3164
3204
  "not_found",
3205
+ "not_enabled",
3165
3206
  "rate_limited",
3166
3207
  "network_error",
3167
3208
  "timeout",
@@ -3200,6 +3241,12 @@ function carriedRetry(error) {
3200
3241
  const retry = error.retry;
3201
3242
  return isRetryHint(retry) ? retry : undefined;
3202
3243
  }
3244
+ function carriedResult(error) {
3245
+ if (!error || typeof error !== "object")
3246
+ return;
3247
+ const result = error.result;
3248
+ return typeof result === "string" && result !== RESULTS.Success && Object.values(RESULTS).includes(result) ? result : undefined;
3249
+ }
3203
3250
  function defaultRetryForErrorCode(errorCode) {
3204
3251
  switch (errorCode) {
3205
3252
  case "network_error":
@@ -3589,6 +3636,8 @@ async function extractErrorDetails(error, options) {
3589
3636
  }
3590
3637
  if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
3591
3638
  context.errorCode = parsedBody.errorCode;
3639
+ } else if (typeof parsedBody?.errorCode === "number") {
3640
+ context.errorCode = String(parsedBody.errorCode);
3592
3641
  } else if (parsedBody?.code && typeof parsedBody.code === "string") {
3593
3642
  context.errorCode = parsedBody.code;
3594
3643
  }
@@ -3645,15 +3694,6 @@ async function extractErrorDetails(error, options) {
3645
3694
  ...parsedErrors ? { parsedErrors } : {}
3646
3695
  };
3647
3696
  }
3648
- // ../common/src/result-types.ts
3649
- var RESULTS = {
3650
- Success: "Success",
3651
- Failure: "Failure",
3652
- ConfigError: "ConfigError",
3653
- AuthenticationError: "AuthenticationError",
3654
- ValidationError: "ValidationError",
3655
- TimeoutError: "TimeoutError"
3656
- };
3657
3697
  // ../../node_modules/commander/index.js
3658
3698
  var exports_commander = {};
3659
3699
  __exportCjs(exports_commander, {
@@ -4086,7 +4126,10 @@ var AUTH_ERROR_CODES = new Set([
4086
4126
  var LOCAL_PERMISSION_CLI_ERROR_CODES = new Set([
4087
4127
  "local_permission_denied"
4088
4128
  ]);
4089
- var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
4129
+ var VALIDATION_ERROR_CODES = new Set([
4130
+ "invalid_argument",
4131
+ "confirmation_required"
4132
+ ]);
4090
4133
  var NETWORK_HTTP_ERROR_CODES = new Set([
4091
4134
  "network_error",
4092
4135
  "rate_limited",
@@ -4312,6 +4355,109 @@ var CommonTelemetryEvents = {
4312
4355
  ShipSucceeded: "Cli.ShipSucceeded"
4313
4356
  };
4314
4357
 
4358
+ // ../common/src/telemetry/global-telemetry-properties.ts
4359
+ var telemetryPropsSlot = singleton("TelemetryDefaultProps");
4360
+ function getGlobalTelemetryProperties() {
4361
+ return telemetryPropsSlot.get();
4362
+ }
4363
+
4364
+ // ../common/src/telemetry/trace-context.ts
4365
+ var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
4366
+ var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
4367
+ function getProcessEnv() {
4368
+ return globalThis.process?.env;
4369
+ }
4370
+ function parseInboundTraceparent(value) {
4371
+ if (!value) {
4372
+ return;
4373
+ }
4374
+ const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
4375
+ if (!match) {
4376
+ return;
4377
+ }
4378
+ const [, traceId, parentSpanId] = match;
4379
+ if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
4380
+ return;
4381
+ }
4382
+ return { traceId, parentSpanId };
4383
+ }
4384
+ function getInboundTraceContext() {
4385
+ return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
4386
+ }
4387
+
4388
+ // ../common/src/telemetry/session-id.ts
4389
+ var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
4390
+ var SESSION_ID_MAX_LENGTH = 64;
4391
+ var RANDOM_SESSION_ID_LENGTH = 32;
4392
+ var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
4393
+ var CONTROL_CHARACTERS = /\p{Cc}/gu;
4394
+ var INHERITED_SESSION_SOURCES = [
4395
+ { envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
4396
+ { envVar: "CODEX_THREAD_ID", source: "codex" },
4397
+ { envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
4398
+ { envVar: "TERM_SESSION_ID", source: "terminal" },
4399
+ { envVar: "WT_SESSION", source: "terminal" }
4400
+ ];
4401
+ var telemetrySessionSlot = singleton("TelemetrySession");
4402
+ var telemetryOperationIdSlot = singleton("TelemetryOperationId");
4403
+ function getProcessEnv2() {
4404
+ return globalThis.process?.env;
4405
+ }
4406
+ function normalizeSessionId(value) {
4407
+ if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
4408
+ return;
4409
+ }
4410
+ const cleaned = String(value).replace(CONTROL_CHARACTERS, "").trim().slice(0, SESSION_ID_MAX_LENGTH);
4411
+ return cleaned || undefined;
4412
+ }
4413
+ function getConfiguredTelemetrySessionId() {
4414
+ return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
4415
+ }
4416
+ function getInheritedSession(env) {
4417
+ for (const candidate of INHERITED_SESSION_SOURCES) {
4418
+ const handle = normalizeSessionId(env[candidate.envVar]);
4419
+ if (handle) {
4420
+ return { id: handle, source: candidate.source };
4421
+ }
4422
+ }
4423
+ return;
4424
+ }
4425
+ function generateRandomSession() {
4426
+ const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
4427
+ crypto.getRandomValues(bytes);
4428
+ let hex = "";
4429
+ for (const byte of bytes) {
4430
+ hex += byte.toString(16).padStart(2, "0");
4431
+ }
4432
+ return { id: hex, source: "random" };
4433
+ }
4434
+ function resolveTelemetrySession() {
4435
+ const existing = telemetrySessionSlot.get();
4436
+ if (existing) {
4437
+ return existing;
4438
+ }
4439
+ const declaredHandle = getConfiguredTelemetrySessionId();
4440
+ const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
4441
+ telemetrySessionSlot.set(resolved);
4442
+ return resolved;
4443
+ }
4444
+ function getTelemetrySessionId() {
4445
+ return resolveTelemetrySession().id;
4446
+ }
4447
+ function getTelemetrySessionSource() {
4448
+ return resolveTelemetrySession().source;
4449
+ }
4450
+ function getTelemetryOperationId() {
4451
+ const existing = telemetryOperationIdSlot.get();
4452
+ if (existing) {
4453
+ return existing;
4454
+ }
4455
+ const inboundTraceId = getInboundTraceContext()?.traceId;
4456
+ const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
4457
+ telemetryOperationIdSlot.set(generated);
4458
+ return generated;
4459
+ }
4460
+
4315
4461
  // ../common/src/registry.ts
4316
4462
  import { execFileSync } from "node:child_process";
4317
4463
  function readRegistryValue(keyPath, valueName) {
@@ -4533,108 +4679,6 @@ class NodeContextStorage {
4533
4679
  return this.storage.getStore();
4534
4680
  }
4535
4681
  }
4536
- // ../common/src/telemetry/trace-context.ts
4537
- var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
4538
- var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
4539
- function getProcessEnv() {
4540
- return globalThis.process?.env;
4541
- }
4542
- function parseInboundTraceparent(value) {
4543
- if (!value) {
4544
- return;
4545
- }
4546
- const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
4547
- if (!match) {
4548
- return;
4549
- }
4550
- const [, traceId, parentSpanId] = match;
4551
- if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
4552
- return;
4553
- }
4554
- return { traceId, parentSpanId };
4555
- }
4556
- function getInboundTraceContext() {
4557
- return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
4558
- }
4559
-
4560
- // ../common/src/telemetry/session-id.ts
4561
- var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
4562
- var SESSION_ID_MAX_LENGTH = 64;
4563
- var RANDOM_SESSION_ID_LENGTH = 32;
4564
- var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
4565
- var CONTROL_CHARACTERS = /\p{Cc}/gu;
4566
- var INHERITED_SESSION_SOURCES = [
4567
- { envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
4568
- { envVar: "CODEX_THREAD_ID", source: "codex" },
4569
- { envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
4570
- { envVar: "TERM_SESSION_ID", source: "terminal" },
4571
- { envVar: "WT_SESSION", source: "terminal" }
4572
- ];
4573
- var telemetrySessionSlot = singleton("TelemetrySession");
4574
- var telemetryOperationIdSlot = singleton("TelemetryOperationId");
4575
- function getProcessEnv2() {
4576
- return globalThis.process?.env;
4577
- }
4578
- function normalizeSessionId(value) {
4579
- if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
4580
- return;
4581
- }
4582
- const cleaned = String(value).replace(CONTROL_CHARACTERS, "").trim().slice(0, SESSION_ID_MAX_LENGTH);
4583
- return cleaned || undefined;
4584
- }
4585
- function getConfiguredTelemetrySessionId() {
4586
- return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
4587
- }
4588
- function getInheritedSession(env) {
4589
- for (const candidate of INHERITED_SESSION_SOURCES) {
4590
- const handle = normalizeSessionId(env[candidate.envVar]);
4591
- if (handle) {
4592
- return { id: handle, source: candidate.source };
4593
- }
4594
- }
4595
- return;
4596
- }
4597
- function generateRandomSession() {
4598
- const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
4599
- crypto.getRandomValues(bytes);
4600
- let hex = "";
4601
- for (const byte of bytes) {
4602
- hex += byte.toString(16).padStart(2, "0");
4603
- }
4604
- return { id: hex, source: "random" };
4605
- }
4606
- function resolveTelemetrySession() {
4607
- const existing = telemetrySessionSlot.get();
4608
- if (existing) {
4609
- return existing;
4610
- }
4611
- const declaredHandle = getConfiguredTelemetrySessionId();
4612
- const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
4613
- telemetrySessionSlot.set(resolved);
4614
- return resolved;
4615
- }
4616
- function getTelemetrySessionId() {
4617
- return resolveTelemetrySession().id;
4618
- }
4619
- function getTelemetrySessionSource() {
4620
- return resolveTelemetrySession().source;
4621
- }
4622
- function getTelemetryOperationId() {
4623
- const existing = telemetryOperationIdSlot.get();
4624
- if (existing) {
4625
- return existing;
4626
- }
4627
- const inboundTraceId = getInboundTraceContext()?.traceId;
4628
- const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
4629
- telemetryOperationIdSlot.set(generated);
4630
- return generated;
4631
- }
4632
- // ../common/src/telemetry/global-telemetry-properties.ts
4633
- var telemetryPropsSlot = singleton("TelemetryDefaultProps");
4634
- function getGlobalTelemetryProperties() {
4635
- return telemetryPropsSlot.get();
4636
- }
4637
-
4638
4682
  // ../common/src/telemetry/span-clock.ts
4639
4683
  function startSpanClock() {
4640
4684
  const started = performance.now();
@@ -4848,6 +4892,7 @@ var MAX_SPOOL_AGE_MS = 72 * 60 * 60 * 1000;
4848
4892
  // ../common/src/telemetry/telemetry-init.ts
4849
4893
  var telemetryInstanceSlot = singleton("TelemetryService");
4850
4894
  var DEFAULT_AI_CONNECTION_STRING = atob("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj");
4895
+ var browserProviderSlot = singleton("BrowserAppInsightsTelemetryProvider");
4851
4896
  function getGlobalTelemetryInstance() {
4852
4897
  const existing = telemetryInstanceSlot.get();
4853
4898
  if (existing && typeof existing === "object" && "trackEvent" in existing && typeof existing.trackEvent === "function") {
@@ -5031,7 +5076,7 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
5031
5076
  const pagedRows = extractPagedRows(data.Data);
5032
5077
  const items = pagedRows ?? (Array.isArray(data.Data) ? data.Data : [data.Data]);
5033
5078
  items.forEach((item) => {
5034
- const values = Object.values(item).map((v) => v ?? "").join("\t");
5079
+ const values = item === null || typeof item !== "object" ? String(item ?? "") : Object.values(item).map((v) => v ?? "").join("\t");
5035
5080
  logFn(values);
5036
5081
  });
5037
5082
  } else {
@@ -5046,7 +5091,8 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
5046
5091
  default: {
5047
5092
  const hasData = "Data" in data && data.Data != null;
5048
5093
  const pagedRows = hasData ? extractPagedRows(data.Data) : null;
5049
- const rows = pagedRows ? pagedRows : Array.isArray(data.Data) ? data.Data : null;
5094
+ const resolvedRows = pagedRows ? pagedRows : Array.isArray(data.Data) ? data.Data : null;
5095
+ const rows = resolvedRows && isPrimitiveArray(resolvedRows) ? resolvedRows.map((entry) => ({ Value: entry })) : resolvedRows;
5050
5096
  if (hasData && !(rows !== null && rows.length === 0)) {
5051
5097
  const logValue = data.Log;
5052
5098
  if (rows !== null) {
@@ -5103,6 +5149,9 @@ function printTable(data, logFn, externalLogValue, tableRowStyle) {
5103
5149
  function isPlainObjectArray(value) {
5104
5150
  return Array.isArray(value) && value.length > 0 && value.every(isPlainRecord);
5105
5151
  }
5152
+ function isPrimitiveArray(value) {
5153
+ return Array.isArray(value) && value.length > 0 && value.every((entry) => entry === null || typeof entry !== "object");
5154
+ }
5106
5155
  function isNonEmptyPlainObject(value) {
5107
5156
  return isPlainRecord(value) && Object.keys(value).length > 0;
5108
5157
  }
@@ -5449,12 +5498,12 @@ class FilterEvaluationError extends Error {
5449
5498
  instructions;
5450
5499
  retry = "RetryWillNotFix";
5451
5500
  result = RESULTS.ValidationError;
5452
- constructor(filter, cause) {
5501
+ constructor(filter, cause, hint) {
5453
5502
  const underlying = cause instanceof Error ? cause.message : String(cause);
5454
- super(`Filter '${filter}' failed to evaluate: ${underlying}`);
5503
+ super(`Filter '${filter}' failed to evaluate: ${underlying}` + (hint ? ` ${hint.detail}` : ""));
5455
5504
  this.name = "FilterEvaluationError";
5456
5505
  this.filter = filter;
5457
- 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(@)'.";
5506
+ 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(@)'.";
5458
5507
  }
5459
5508
  }
5460
5509
 
@@ -5576,6 +5625,93 @@ function nameList(names, cap = 12) {
5576
5625
  const rest = names.length - shown.length;
5577
5626
  return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
5578
5627
  }
5628
+ function notFieldsOn(names, scope) {
5629
+ return `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
5630
+ }
5631
+ function failingFieldRead(ast, isList, fn, argIndex) {
5632
+ const [left, right, condition] = ast.children ?? [];
5633
+ let scopes = [];
5634
+ if (!isList) {
5635
+ scopes = [ast];
5636
+ } else if (ast.type === "FilterProjection" && left?.type === "Identity") {
5637
+ scopes = [condition, right];
5638
+ } else if (ast.type === "Projection" && (left?.type === "Identity" || left?.type === "Flatten" && left.children?.[0]?.type === "Identity")) {
5639
+ scopes = [right];
5640
+ }
5641
+ const reads = new Set;
5642
+ let tracked = 0;
5643
+ const visit = (node) => {
5644
+ if (!node)
5645
+ return;
5646
+ switch (node.type) {
5647
+ case "Function": {
5648
+ const arg = node.children?.[argIndex - 1];
5649
+ if (node.name === fn && arg?.type === "Field" && arg.name) {
5650
+ reads.add(arg.name);
5651
+ tracked++;
5652
+ }
5653
+ node.children?.forEach(visit);
5654
+ return;
5655
+ }
5656
+ case "AndExpression":
5657
+ case "OrExpression":
5658
+ case "NotExpression":
5659
+ case "Comparator":
5660
+ case "MultiSelectList":
5661
+ case "MultiSelectHash":
5662
+ node.children?.forEach(visit);
5663
+ return;
5664
+ case "KeyValuePair":
5665
+ visit(node.value);
5666
+ return;
5667
+ }
5668
+ };
5669
+ scopes.forEach(visit);
5670
+ const calls = (node) => {
5671
+ if (node === null || typeof node !== "object")
5672
+ return 0;
5673
+ const own = node.type === "Function" && node.name === fn ? 1 : 0;
5674
+ const next = node.type === "KeyValuePair" ? [node.value] : node.children ?? [];
5675
+ return own + next.reduce((sum, child) => sum + calls(child), 0);
5676
+ };
5677
+ return reads.size === 1 && tracked === calls(ast) ? [...reads][0] : undefined;
5678
+ }
5679
+ function fieldExpression(name) {
5680
+ return /^[A-Za-z_]\w*$/.test(name) ? name : JSON.stringify(name);
5681
+ }
5682
+ function evaluationHint(codec, filter, data, cause) {
5683
+ const underlying = cause instanceof Error ? cause.message : String(cause);
5684
+ const failure = /\b(\w+)\(\) expected argument (\d+) to be type (\S+) but received type null\b/.exec(underlying);
5685
+ if (!failure)
5686
+ return;
5687
+ const [, fn, position, expected] = failure;
5688
+ const name = failingFieldRead(codec.compile(filter), Array.isArray(data), fn, Number(position));
5689
+ if (name === undefined)
5690
+ return;
5691
+ const present = availableFields(data);
5692
+ if (present.length === 0)
5693
+ return;
5694
+ const scope = `${countRecords(data)} record(s)`;
5695
+ if (!present.includes(name)) {
5696
+ return {
5697
+ detail: `${notFieldsOn([name], scope)}. Available fields: ${nameList(present)}.`,
5698
+ instructions: "Use a field the records have; names are case-sensitive."
5699
+ };
5700
+ }
5701
+ const records = Array.isArray(data) ? data : [data];
5702
+ const unset = records.filter((r) => r?.[name] == null).length;
5703
+ const field = fieldExpression(name);
5704
+ let fallback;
5705
+ if (expected.split(",").includes("string")) {
5706
+ fallback = "''";
5707
+ } else if (expected.split(",").includes("array")) {
5708
+ fallback = "`[]`";
5709
+ }
5710
+ return {
5711
+ detail: `\`${name}\` is null or missing on ${unset} of the ${scope} it read.`,
5712
+ 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.`
5713
+ };
5714
+ }
5579
5715
  function buildFilterWarning(filter, data, outcome) {
5580
5716
  const present = availableFields(data);
5581
5717
  const refs = referencedFields(filter);
@@ -5583,7 +5719,7 @@ function buildFilterWarning(filter, data, outcome) {
5583
5719
  const unchecked = refs.nested.filter((name) => !present.includes(name));
5584
5720
  const count = countRecords(data);
5585
5721
  const scope = `${count} record(s)`;
5586
- const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
5722
+ const isNotAField = (names) => notFieldsOn(names, scope);
5587
5723
  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" : "";
5588
5724
  const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
5589
5725
  let detail;
@@ -5634,7 +5770,8 @@ function applyFilter(data, filter, onWarning) {
5634
5770
  try {
5635
5771
  result = codec.search(data, filter);
5636
5772
  } catch (err) {
5637
- throw new FilterEvaluationError(filter, err);
5773
+ const [, hint] = catchError(() => evaluationHint(codec, filter, data, err));
5774
+ throw new FilterEvaluationError(filter, err, hint);
5638
5775
  }
5639
5776
  const inputCount = countRecords(data);
5640
5777
  const warn = (outcome) => {
@@ -6525,7 +6662,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
6525
6662
  logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
6526
6663
  const typed = error;
6527
6664
  const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
6528
- const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
6665
+ const customResult = carriedResult(error);
6529
6666
  const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
6530
6667
  const classified = cancellationExitCode === undefined ? await extractErrorDetails(error) : undefined;
6531
6668
  const finalResult = customResult ?? classified?.result ?? RESULTS.Failure;
@@ -6599,14 +6736,17 @@ Command.prototype.trackedAction = function(context, fn, properties) {
6599
6736
  // ../common/src/completer.ts
6600
6737
  var COMPLETER_SYMBOL = Symbol.for("@uipath/common/completer");
6601
6738
  // ../common/src/confirmation.ts
6602
- function requireConfirmation(flags, operation) {
6739
+ function requireConfirmation(flags, operation, options) {
6603
6740
  if (flags.yes === true || flags.force === true) {
6604
6741
  return true;
6605
6742
  }
6743
+ const message = options?.reversible ? `Confirmation required: this will ${operation}.` : `Confirmation required: this will ${operation} and cannot be undone.`;
6606
6744
  OutputFormatter.error({
6607
6745
  Result: RESULTS.Failure,
6608
- Message: `Confirmation required: this will ${operation} and cannot be undone.`,
6609
- Instructions: "Re-run with --yes to confirm."
6746
+ Message: message,
6747
+ Instructions: options?.instructions ?? "Re-run with --yes to confirm.",
6748
+ ErrorCode: "confirmation_required",
6749
+ Retry: "RetryWillNotFix"
6610
6750
  });
6611
6751
  processContext.exit(1);
6612
6752
  return false;
@@ -6900,6 +7040,8 @@ var FAILURE_STATUSES = new Set([
6900
7040
  "canceled",
6901
7041
  "stopped"
6902
7042
  ]);
7043
+ // ../common/src/relayed-output.ts
7044
+ var RELAYED_OUTPUT_SYMBOL = Symbol.for("@uipath/common/relayed-output");
6903
7045
  // ../common/src/screen-logger.ts
6904
7046
  var ScreenLogger;
6905
7047
  ((ScreenLogger) => {
@@ -6947,6 +7089,8 @@ function settlePromiseLike2(thenable) {
6947
7089
  // ../auth/src/constants.ts
6948
7090
  var UIPATH_HOME_DIR = ".uipath";
6949
7091
  var AUTH_FILENAME = ".auth";
7092
+ var AUTH_FILE_MODE = 384;
7093
+ var AUTH_DIR_MODE = 448;
6950
7094
  var DEFAULT_BASE_URL = "https://cloud.uipath.com";
6951
7095
  var DEFAULT_AUTH_TIMEOUT_MS2 = 5 * 60 * 1000;
6952
7096
 
@@ -7770,6 +7914,38 @@ var loadEnvFileAsync = async ({ envPath }) => {
7770
7914
  }
7771
7915
  return parseEnvContent(content);
7772
7916
  };
7917
+ var findAuthHomeDir = (fs, dir) => {
7918
+ let current = dir;
7919
+ for (;; ) {
7920
+ if (fs.path.basename(current) === UIPATH_HOME_DIR)
7921
+ return current;
7922
+ const parent = fs.path.dirname(current);
7923
+ if (parent === current)
7924
+ return;
7925
+ current = parent;
7926
+ }
7927
+ };
7928
+ var TEMP_FILE_ATTEMPTS = 5;
7929
+ var isFileExists = (error) => error instanceof Error && error.code === "EEXIST";
7930
+ var writeTempFile = async (fs, targetPath, content) => {
7931
+ for (let attempt = 1;; attempt++) {
7932
+ const tempPath = `${targetPath}.${crypto.randomUUID()}.tmp`;
7933
+ try {
7934
+ await fs.writeFile(tempPath, content, {
7935
+ mode: AUTH_FILE_MODE,
7936
+ exclusive: true
7937
+ });
7938
+ return tempPath;
7939
+ } catch (error) {
7940
+ if (!isFileExists(error)) {
7941
+ await fs.rm(tempPath).catch(() => {});
7942
+ throw error;
7943
+ }
7944
+ if (attempt === TEMP_FILE_ATTEMPTS)
7945
+ throw error;
7946
+ }
7947
+ }
7948
+ };
7773
7949
  var saveEnvFileAsync = async ({
7774
7950
  envPath,
7775
7951
  data,
@@ -7797,10 +7973,18 @@ var saveEnvFileAsync = async ({
7797
7973
  `)}
7798
7974
  `;
7799
7975
  const dir = fs.path.dirname(absolutePath);
7800
- await fs.mkdir(dir);
7801
- const tempPath = `${absolutePath}.tmp`;
7802
- await fs.writeFile(tempPath, content);
7803
- await fs.rename(tempPath, absolutePath);
7976
+ await fs.mkdir(dir, { mode: AUTH_DIR_MODE });
7977
+ const authHomeDir = findAuthHomeDir(fs, dir);
7978
+ if (authHomeDir !== undefined) {
7979
+ await fs.chmod?.(authHomeDir, AUTH_DIR_MODE);
7980
+ }
7981
+ const tempPath = await writeTempFile(fs, absolutePath, content);
7982
+ try {
7983
+ await fs.rename(tempPath, absolutePath);
7984
+ } catch (error) {
7985
+ await fs.rm(tempPath).catch(() => {});
7986
+ throw error;
7987
+ }
7804
7988
  };
7805
7989
 
7806
7990
  // ../auth/src/loginStatus.ts
@@ -10459,9 +10643,20 @@ async function uploadParts(config, bytes, parts) {
10459
10643
  await Promise.all(Array.from({ length: Math.min(MAX_CONCURRENT_UPLOADS, parts.length) }, () => worker()));
10460
10644
  return completed;
10461
10645
  }
10646
+ function isPmServiceUri(config, uri) {
10647
+ let target;
10648
+ let service;
10649
+ try {
10650
+ target = new URL(uri);
10651
+ service = new URL(`${config.baseUrl.replace(/\/+$/, "")}/${encodeURIComponent(config.organizationName)}/${encodeURIComponent(config.tenantName)}/processmining_/`);
10652
+ } catch {
10653
+ return false;
10654
+ }
10655
+ return target.origin === service.origin && target.username === "" && target.password === "" && target.pathname.startsWith(service.pathname);
10656
+ }
10462
10657
  async function uploadPart(config, part, content) {
10463
10658
  const headers = { "Content-Type": "text/csv" };
10464
- if (part.uri.startsWith(config.baseUrl)) {
10659
+ if (isPmServiceUri(config, part.uri)) {
10465
10660
  headers.Authorization = `Bearer ${config.authToken}`;
10466
10661
  }
10467
10662
  const response = await fetch(part.uri, {
@@ -10686,6 +10881,28 @@ var QUERY_INFO_EXAMPLES = [
10686
10881
  }
10687
10882
  }
10688
10883
  ];
10884
+ var QUERY_LAYOUT_EXAMPLES = [
10885
+ {
10886
+ Description: "Read the process graph layout; the route (app-wide on a pre-multi-process app, per process on a multi-process one) is picked from 'query info'",
10887
+ Command: "uip pm query layout 9c46289e",
10888
+ Output: {
10889
+ Code: "PmQueryLayout",
10890
+ Data: {
10891
+ Ranking: [{ NodeId: 0, Rank: 6, SequenceId: 0, GraphId: 0 }]
10892
+ }
10893
+ }
10894
+ },
10895
+ {
10896
+ Description: "Read one process's layout on a multi-process app (process ids come from 'query info')",
10897
+ Command: "uip pm query layout 9c46289e --process-id Process",
10898
+ Output: {
10899
+ Code: "PmQueryLayout",
10900
+ Data: {
10901
+ Ranking: [{ NodeId: 0, Rank: 6, SequenceId: 0, GraphId: 0 }]
10902
+ }
10903
+ }
10904
+ }
10905
+ ];
10689
10906
  var QUERY_PERCENTILE_EXAMPLES = [
10690
10907
  {
10691
10908
  Description: "Compute the 50th/90th/95th percentiles of case throughput time",
@@ -10757,14 +10974,18 @@ function registerQueryCommand(program) {
10757
10974
  Data: result
10758
10975
  });
10759
10976
  });
10760
- queryCmd.command("layout <app-id>").description("Get the persisted global graph layout of a process app").addOption(new Option2("--type <type>", "Layout to read: the process 'graph' or the 'process-model'").choices(LAYOUT_TYPES).default("graph")).addOption(new Option2("--stage <stage>", "App stage").choices(STAGES7).default("dev")).trackedAction(processContext, async (appId, options) => {
10977
+ queryCmd.command("layout <app-id>").description("Get the persisted global graph layout of a process app").addOption(new Option2("--type <type>", "Layout to read: the process 'graph' or the 'process-model'").choices(LAYOUT_TYPES).default("graph")).addOption(new Option2("--stage <stage>", "App stage").choices(STAGES7).default("dev")).option("--process-id <id>", "Process to read the layout of, on a multi-process app (process ids come from 'query info'). Without it, a multi-process app reads its only process; a pre-multi-process app always reads its app-wide layout").examples(QUERY_LAYOUT_EXAMPLES).trackedAction(processContext, async (appId, options) => {
10761
10978
  const config = await loadConfigOrExit();
10762
10979
  if (!config)
10763
10980
  return;
10764
- const endpoint = options.type === "process-model" ? "processModelGlobalLayout" : "graphLayout";
10765
- const [err, result] = await catchError(pmGet(config, `/query/${appId}/${options.stage}/${endpoint}`));
10981
+ const [routeErr, processId] = await catchError(resolveLayoutProcess(config, appId, options));
10982
+ if (routeErr) {
10983
+ fail(routeErr.message, "Check the app id (uip pm apps list); 'uip pm query info' lists its processes.");
10984
+ return;
10985
+ }
10986
+ const [err, result] = await catchError(processId !== null ? readProcessLayout(config, appId, processId, options) : pmGet(config, `/query/${encodeURIComponent(appId)}/${options.stage}/${options.type === "process-model" ? "processModelGlobalLayout" : "processGraphGlobalLayout"}`));
10766
10987
  if (err) {
10767
- fail(err.message, "Check the app id (uip pm apps list) and that the stage has a completed ingestion.");
10988
+ fail(err.message, processId !== null ? "Check the app id (uip pm apps list) and the process id (uip pm query info)." : "Check the app id (uip pm apps list) and that the stage has a completed ingestion.");
10768
10989
  return;
10769
10990
  }
10770
10991
  OutputFormatter.success({
@@ -10828,6 +11049,67 @@ function registerBodyQuery(queryCmd, spec) {
10828
11049
  });
10829
11050
  });
10830
11051
  }
11052
+ var MODEL_LESS_MINER = "directly-follows";
11053
+ async function resolveLayoutProcess(config, appId, options) {
11054
+ if (options.processId === "") {
11055
+ throw new Error("--process-id cannot be empty.");
11056
+ }
11057
+ const info = await pmGet(config, `/query/${encodeURIComponent(appId)}/${options.stage}/info`);
11058
+ const features = field(info, "features");
11059
+ const preMultiProcess = (features ? field(features, "withoutProcessId") : undefined) ?? true;
11060
+ const processes = readLayoutProcesses(info);
11061
+ if (preMultiProcess) {
11062
+ if (options.processId !== undefined) {
11063
+ throw new Error(`App '${appId}' is a pre-multi-process app: its layout is app-wide, so --process-id does not apply. Run it without --process-id.`);
11064
+ }
11065
+ rejectModelLessProcessModel(options, processes[0]);
11066
+ return null;
11067
+ }
11068
+ const process2 = pickLayoutProcess(appId, processes, options.processId);
11069
+ rejectModelLessProcessModel(options, process2);
11070
+ return process2.id;
11071
+ }
11072
+ function readLayoutProcesses(info) {
11073
+ const internal = field(info, "internalFields");
11074
+ const processes = (internal ? field(internal, "processes") : undefined) ?? [];
11075
+ return processes.flatMap((p) => {
11076
+ const id = field(p, "processId");
11077
+ const miner = field(p, "miner");
11078
+ return typeof id === "string" && id !== "" ? [{ id, miner: typeof miner === "string" ? miner : undefined }] : [];
11079
+ });
11080
+ }
11081
+ function pickLayoutProcess(appId, processes, wanted) {
11082
+ const available = processes.map((p) => p.id).join(", ");
11083
+ if (wanted !== undefined) {
11084
+ const match = processes.find((p) => p.id === wanted);
11085
+ if (!match) {
11086
+ throw new Error(`Process '${wanted}' not found on app '${appId}'. Available: ${available}.`);
11087
+ }
11088
+ return match;
11089
+ }
11090
+ if (processes.length === 1)
11091
+ return processes[0];
11092
+ if (processes.length === 0) {
11093
+ throw new Error(`App '${appId}' exposes no processes to read a layout of.`);
11094
+ }
11095
+ throw new Error(`App '${appId}' has ${processes.length} processes; pick one with --process-id. Available: ${available}.`);
11096
+ }
11097
+ function rejectModelLessProcessModel(options, process2) {
11098
+ if (options.type !== "process-model" || process2?.miner !== MODEL_LESS_MINER)
11099
+ return;
11100
+ throw new Error(`Process '${process2.id}' uses the ${MODEL_LESS_MINER} miner and has no process model, so it has no process-model layout. Use --type graph.`);
11101
+ }
11102
+ async function readProcessLayout(config, appId, processId, options) {
11103
+ const app = await pmGet(config, `/apps/${encodeURIComponent(appId)}/${options.stage}`);
11104
+ const successful = field(app, "successfulIngestion");
11105
+ const ingestionId = successful ? field(successful, "id") : undefined;
11106
+ if (!ingestionId) {
11107
+ throw new Error(`The ${options.stage} stage has no successful ingestion to read the process layout of.`);
11108
+ }
11109
+ const endpoint = options.type === "process-model" ? "processModelGlobalLayout" : "minedProcessGlobalLayout";
11110
+ const query = new URLSearchParams({ processId });
11111
+ return pmtGet(config, appId, `/apps/${encodeURIComponent(appId)}/${options.stage}/ingestions/${encodeURIComponent(ingestionId)}/processMetadata/${endpoint}?${query}`);
11112
+ }
10831
11113
  async function resolveRunBody(config, appId, spec, options) {
10832
11114
  const usingSugar = spec.withSugar === true && (options.groupBy !== undefined || (options.metric?.length ?? 0) > 0);
10833
11115
  if (!usingSugar) {
@@ -11284,4 +11566,4 @@ var registerCommands2 = async (program) => {
11284
11566
 
11285
11567
  export { Command, metadata2, registerCommands2 };
11286
11568
 
11287
- //# debugId=283631DD24622BE264756E2164756E21
11569
+ //# debugId=79C1FDDABB52DA1C64756E2164756E21
package/dist/tool.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  metadata2,
3
3
  registerCommands2
4
- } from "./tool-bgzvqa5f.js";
4
+ } from "./tool-f3hgzc0f.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/pm-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": "Process Mining — process apps, transformations, and data ingestion.",
7
7
  "private": false,
8
8
  "repository": {
@@ -27,5 +27,5 @@
27
27
  "files": [
28
28
  "dist"
29
29
  ],
30
- "gitHead": "078afc3ef7ebf4c38353ee0059e321acf16a350d"
30
+ "gitHead": "1600aa89255c37c1b8bc68d9882c3395c1d5bff4"
31
31
  }