@uipath/resourcecatalog-tool 0.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.js +1591 -236
  2. package/dist/tool.js +1594 -236
  3. package/package.json +28 -42
package/dist/index.js CHANGED
@@ -1006,7 +1006,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1006
1006
  this._exitCallback = (err) => {
1007
1007
  if (err.code !== "commander.executeSubCommandAsync") {
1008
1008
  throw err;
1009
- } else {}
1009
+ }
1010
1010
  };
1011
1011
  }
1012
1012
  return this;
@@ -2477,11 +2477,11 @@ import path from "node:path";
2477
2477
  import { fileURLToPath } from "node:url";
2478
2478
  import childProcess3 from "node:child_process";
2479
2479
  import fs5, { constants as fsConstants2 } from "node:fs/promises";
2480
- function detectArchBinary(binary2) {
2481
- if (typeof binary2 === "string" || Array.isArray(binary2)) {
2482
- return binary2;
2480
+ function detectArchBinary(binary) {
2481
+ if (typeof binary === "string" || Array.isArray(binary)) {
2482
+ return binary;
2483
2483
  }
2484
- const { [arch]: archBinary } = binary2;
2484
+ const { [arch]: archBinary } = binary;
2485
2485
  if (!archBinary) {
2486
2486
  throw new Error(`${arch} is not supported`);
2487
2487
  }
@@ -2761,6 +2761,7 @@ var init_open = __esm(() => {
2761
2761
  });
2762
2762
 
2763
2763
  // ../../filesystem/src/node.ts
2764
+ import { randomUUID } from "node:crypto";
2764
2765
  import { existsSync } from "node:fs";
2765
2766
  import * as fs6 from "node:fs/promises";
2766
2767
  import * as os2 from "node:os";
@@ -2842,6 +2843,90 @@ class NodeFileSystem {
2842
2843
  async mkdir(dirPath) {
2843
2844
  await fs6.mkdir(dirPath, { recursive: true });
2844
2845
  }
2846
+ async acquireLock(lockPath) {
2847
+ const canonicalPath = await this.canonicalizeLockTarget(lockPath);
2848
+ const lockFile = `${canonicalPath}.lock`;
2849
+ const ownerId = randomUUID();
2850
+ const start = Date.now();
2851
+ while (true) {
2852
+ try {
2853
+ await fs6.writeFile(lockFile, ownerId, { flag: "wx" });
2854
+ return this.createLockRelease(lockFile, ownerId);
2855
+ } catch (error) {
2856
+ if (!this.hasErrnoCode(error, "EEXIST")) {
2857
+ throw error;
2858
+ }
2859
+ const stats = await fs6.stat(lockFile).catch(() => null);
2860
+ if (stats && Date.now() - stats.mtimeMs > LOCK_STALE_MS) {
2861
+ const reclaimed = await fs6.rm(lockFile, { force: true }).then(() => true).catch(() => false);
2862
+ if (reclaimed)
2863
+ continue;
2864
+ }
2865
+ if (Date.now() - start > LOCK_MAX_WAIT_MS) {
2866
+ throw new Error(`ELOCKED: timed out waiting for lock on ${canonicalPath}`);
2867
+ }
2868
+ await new Promise((resolve2) => setTimeout(resolve2, LOCK_RETRY_MIN_MS + Math.random() * LOCK_RETRY_JITTER_MS));
2869
+ }
2870
+ }
2871
+ }
2872
+ async canonicalizeLockTarget(lockPath) {
2873
+ const absolute = path2.resolve(lockPath);
2874
+ const fullReal = await fs6.realpath(absolute).catch(() => null);
2875
+ if (fullReal)
2876
+ return fullReal;
2877
+ const parent = path2.dirname(absolute);
2878
+ const base = path2.basename(absolute);
2879
+ const canonicalParent = await fs6.realpath(parent).catch(() => parent);
2880
+ return path2.join(canonicalParent, base);
2881
+ }
2882
+ createLockRelease(lockFile, ownerId) {
2883
+ const heartbeatStart = Date.now();
2884
+ let heartbeatTimer;
2885
+ let stopped = false;
2886
+ const stopHeartbeat = () => {
2887
+ stopped = true;
2888
+ if (heartbeatTimer)
2889
+ clearTimeout(heartbeatTimer);
2890
+ };
2891
+ const scheduleNextHeartbeat = () => {
2892
+ if (stopped)
2893
+ return;
2894
+ if (Date.now() - heartbeatStart >= LOCK_MAX_HOLD_MS) {
2895
+ stopped = true;
2896
+ return;
2897
+ }
2898
+ heartbeatTimer = setTimeout(() => {
2899
+ runHeartbeat();
2900
+ }, LOCK_HEARTBEAT_MS);
2901
+ heartbeatTimer.unref?.();
2902
+ };
2903
+ const runHeartbeat = async () => {
2904
+ if (stopped)
2905
+ return;
2906
+ const current = await fs6.readFile(lockFile, "utf-8").catch(() => null);
2907
+ if (stopped)
2908
+ return;
2909
+ if (current !== ownerId) {
2910
+ stopped = true;
2911
+ return;
2912
+ }
2913
+ const now = Date.now() / 1000;
2914
+ await fs6.utimes(lockFile, now, now).catch(() => {});
2915
+ scheduleNextHeartbeat();
2916
+ };
2917
+ scheduleNextHeartbeat();
2918
+ let released = false;
2919
+ return async () => {
2920
+ if (released)
2921
+ return;
2922
+ released = true;
2923
+ stopHeartbeat();
2924
+ const current = await fs6.readFile(lockFile, "utf-8").catch(() => null);
2925
+ if (current === ownerId) {
2926
+ await fs6.rm(lockFile, { force: true });
2927
+ }
2928
+ };
2929
+ }
2845
2930
  async rm(filePath) {
2846
2931
  await fs6.rm(filePath, { recursive: true, force: true });
2847
2932
  }
@@ -2887,16 +2972,18 @@ class NodeFileSystem {
2887
2972
  }
2888
2973
  }
2889
2974
  isEnoent(error) {
2890
- return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
2975
+ return this.hasErrnoCode(error, "ENOENT");
2976
+ }
2977
+ hasErrnoCode(error, code) {
2978
+ return typeof error === "object" && error !== null && "code" in error && error.code === code;
2891
2979
  }
2892
2980
  }
2981
+ var LOCK_HEARTBEAT_MS = 5000, LOCK_STALE_MS = 15000, LOCK_MAX_WAIT_MS = 20000, LOCK_MAX_HOLD_MS = 60000, LOCK_RETRY_MIN_MS = 100, LOCK_RETRY_JITTER_MS = 200;
2893
2982
  var init_node = __esm(() => {
2894
2983
  init_open();
2895
2984
  });
2896
2985
  // ../../filesystem/src/index.ts
2897
- var fsInstance, getFileSystem = () => {
2898
- return fsInstance;
2899
- };
2986
+ var fsInstance, getFileSystem = () => fsInstance;
2900
2987
  var init_src = __esm(() => {
2901
2988
  init_node();
2902
2989
  init_node();
@@ -21136,6 +21223,10 @@ var require_dist = __commonJS((exports) => {
21136
21223
  exports.RobotProxyConstructor = RobotProxyConstructor;
21137
21224
  __exportStar(require_agent(), exports);
21138
21225
  });
21226
+ // ../../auth/src/server.ts
21227
+ var init_server = __esm(() => {
21228
+ init_constants();
21229
+ });
21139
21230
 
21140
21231
  // ../../../node_modules/commander/esm.mjs
21141
21232
  var import__ = __toESM(require_commander(), 1);
@@ -21155,7 +21246,8 @@ var {
21155
21246
  // package.json
21156
21247
  var package_default = {
21157
21248
  name: "@uipath/resourcecatalog-tool",
21158
- version: "0.1.0",
21249
+ license: "MIT",
21250
+ version: "1.2.0",
21159
21251
  description: "CLI plugin for the UiPath Resource Catalog Service.",
21160
21252
  private: false,
21161
21253
  repository: {
@@ -21197,6 +21289,9 @@ var package_default = {
21197
21289
  }
21198
21290
  };
21199
21291
 
21292
+ // ../../common/src/attachment-binding.ts
21293
+ init_src();
21294
+
21200
21295
  // ../../common/src/catch-error.ts
21201
21296
  function isPromiseLike(value) {
21202
21297
  return value !== null && typeof value === "object" && typeof value.then === "function";
@@ -21224,78 +21319,7 @@ function settlePromiseLike(thenable) {
21224
21319
  undefined
21225
21320
  ]);
21226
21321
  }
21227
- // ../../common/src/command-examples.ts
21228
- var examplesByCommand = new WeakMap;
21229
- Command.prototype.examples = function(examples) {
21230
- examplesByCommand.set(this, examples);
21231
- return this;
21232
- };
21233
- // ../../common/src/singleton.ts
21234
- var PREFIX = "@uipath/common/";
21235
- var _g = globalThis;
21236
- function singleton(ctorOrName) {
21237
- const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
21238
- const key = Symbol.for(PREFIX + name);
21239
- return {
21240
- get(fallback) {
21241
- return _g[key] ?? fallback;
21242
- },
21243
- set(value) {
21244
- _g[key] = value;
21245
- },
21246
- clear() {
21247
- delete _g[key];
21248
- },
21249
- getOrInit(factory, guard) {
21250
- const existing = _g[key];
21251
- if (existing != null && typeof existing === "object") {
21252
- if (!guard || guard(existing)) {
21253
- return existing;
21254
- }
21255
- }
21256
- const instance = factory();
21257
- _g[key] = instance;
21258
- return instance;
21259
- }
21260
- };
21261
- }
21262
21322
 
21263
- // ../../common/src/output-context.ts
21264
- function createStorage() {
21265
- const [error, mod] = catchError(() => __require("node:async_hooks"));
21266
- if (error || typeof mod?.AsyncLocalStorage !== "function") {
21267
- return {
21268
- getStore: () => {
21269
- return;
21270
- },
21271
- run: (_store, fn) => fn()
21272
- };
21273
- }
21274
- return new mod.AsyncLocalStorage;
21275
- }
21276
- var storageSingleton = singleton("OutputStorage");
21277
- var sinkSlot = singleton("OutputSink");
21278
- var outputStorage = storageSingleton.getOrInit(createStorage, (v) => ("getStore" in v));
21279
- var CONSOLE_FALLBACK = {
21280
- writeOut: (str) => process.stdout.write(str),
21281
- writeErr: (str) => process.stderr.write(str),
21282
- writeLog: (str) => process.stdout.write(str),
21283
- capabilities: {
21284
- isInteractive: false,
21285
- supportsColor: false,
21286
- outputWidth: 80
21287
- }
21288
- };
21289
- function getOutputSink() {
21290
- return outputStorage.getStore() ?? sinkSlot.get() ?? CONSOLE_FALLBACK;
21291
- }
21292
- // ../../common/src/completer.ts
21293
- var COMPLETER_SYMBOL = Symbol.for("@uipath/common/completer");
21294
- // ../../common/src/console-guard.ts
21295
- var guardInstalledSlot = singleton("ConsoleGuardInstalled");
21296
- var savedOriginalsSlot = singleton("ConsoleGuardOriginals");
21297
- // ../../common/src/constants.ts
21298
- var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
21299
21323
  // ../../common/src/error-handler.ts
21300
21324
  var DEFAULT_401 = "Unauthorized (401). Run `uip login` to authenticate.";
21301
21325
  var DEFAULT_403 = "Forbidden (403). Ensure the account has the required permissions.";
@@ -21402,10 +21426,15 @@ async function extractErrorDetails(error, options) {
21402
21426
  }
21403
21427
  if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
21404
21428
  context.errorCode = parsedBody.errorCode;
21429
+ } else if (parsedBody?.code && typeof parsedBody.code === "string") {
21430
+ context.errorCode = parsedBody.code;
21405
21431
  }
21406
21432
  if (parsedBody?.requestId && typeof parsedBody.requestId === "string") {
21407
21433
  context.requestId = parsedBody.requestId;
21408
21434
  }
21435
+ if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
21436
+ context.traceId = parsedBody.traceId;
21437
+ }
21409
21438
  if (status === 429) {
21410
21439
  const resp = response;
21411
21440
  const headersObj = resp?.headers;
@@ -21425,12 +21454,113 @@ async function extractErrorDetails(error, options) {
21425
21454
  }
21426
21455
  }
21427
21456
  const hasContext = Object.keys(context).length > 0;
21428
- return { result, message, details, ...hasContext ? { context } : {} };
21457
+ let parsedErrors;
21458
+ if (parsedBody?.errors && typeof parsedBody.errors === "object") {
21459
+ const errors = {};
21460
+ for (const [field, raw] of Object.entries(parsedBody.errors)) {
21461
+ if (Array.isArray(raw)) {
21462
+ const messages = raw.map((entry) => {
21463
+ if (typeof entry === "string")
21464
+ return entry;
21465
+ if (entry && typeof entry === "object" && typeof entry.message === "string") {
21466
+ return entry.message;
21467
+ }
21468
+ return String(entry);
21469
+ }).filter(Boolean);
21470
+ if (messages.length > 0)
21471
+ errors[field] = messages;
21472
+ } else if (typeof raw === "string") {
21473
+ errors[field] = [raw];
21474
+ }
21475
+ }
21476
+ if (Object.keys(errors).length > 0)
21477
+ parsedErrors = errors;
21478
+ }
21479
+ return {
21480
+ result,
21481
+ message,
21482
+ details,
21483
+ ...hasContext ? { context } : {},
21484
+ ...parsedErrors ? { parsedErrors } : {}
21485
+ };
21429
21486
  }
21430
21487
  async function extractErrorMessage(error, options) {
21431
21488
  const { message } = await extractErrorDetails(error, options);
21432
21489
  return message;
21433
21490
  }
21491
+ // ../../common/src/command-examples.ts
21492
+ var examplesByCommand = new WeakMap;
21493
+ Command.prototype.examples = function(examples) {
21494
+ examplesByCommand.set(this, examples);
21495
+ return this;
21496
+ };
21497
+ // ../../common/src/singleton.ts
21498
+ var PREFIX = "@uipath/common/";
21499
+ var _g = globalThis;
21500
+ function singleton(ctorOrName) {
21501
+ const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
21502
+ const key = Symbol.for(PREFIX + name);
21503
+ return {
21504
+ get(fallback) {
21505
+ return _g[key] ?? fallback;
21506
+ },
21507
+ set(value) {
21508
+ _g[key] = value;
21509
+ },
21510
+ clear() {
21511
+ delete _g[key];
21512
+ },
21513
+ getOrInit(factory, guard) {
21514
+ const existing = _g[key];
21515
+ if (existing != null && typeof existing === "object") {
21516
+ if (!guard || guard(existing)) {
21517
+ return existing;
21518
+ }
21519
+ }
21520
+ const instance = factory();
21521
+ _g[key] = instance;
21522
+ return instance;
21523
+ }
21524
+ };
21525
+ }
21526
+
21527
+ // ../../common/src/output-context.ts
21528
+ function createStorage() {
21529
+ const [error, mod] = catchError(() => __require("node:async_hooks"));
21530
+ if (error || typeof mod?.AsyncLocalStorage !== "function") {
21531
+ return {
21532
+ getStore: () => {
21533
+ return;
21534
+ },
21535
+ run: (_store, fn) => fn()
21536
+ };
21537
+ }
21538
+ return new mod.AsyncLocalStorage;
21539
+ }
21540
+ var storageSingleton = singleton("OutputStorage");
21541
+ var sinkSlot = singleton("OutputSink");
21542
+ var outputStorage = storageSingleton.getOrInit(createStorage, (v) => ("getStore" in v));
21543
+ var CONSOLE_FALLBACK = {
21544
+ writeOut: (str) => process.stdout.write(str),
21545
+ writeErr: (str) => process.stderr.write(str),
21546
+ writeLog: (str) => process.stdout.write(str),
21547
+ capabilities: {
21548
+ isInteractive: false,
21549
+ supportsColor: false,
21550
+ outputWidth: 80
21551
+ }
21552
+ };
21553
+ function getOutputSink() {
21554
+ return outputStorage.getStore() ?? sinkSlot.get() ?? CONSOLE_FALLBACK;
21555
+ }
21556
+ // ../../common/src/completer.ts
21557
+ var COMPLETER_SYMBOL = Symbol.for("@uipath/common/completer");
21558
+ // ../../common/src/console-guard.ts
21559
+ var guardInstalledSlot = singleton("ConsoleGuardInstalled");
21560
+ var savedOriginalsSlot = singleton("ConsoleGuardOriginals");
21561
+ // ../../common/src/constants.ts
21562
+ var DEFAULT_PAGE_SIZE = 50;
21563
+ var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
21434
21564
  // ../../../node_modules/@jmespath-community/jmespath/dist/index.mjs
21435
21565
  var isObject = (obj) => {
21436
21566
  return obj !== null && Object.prototype.toString.call(obj) === "[object Object]";
@@ -26475,15 +26605,80 @@ class SuccessOutput {
26475
26605
  }
26476
26606
  }
26477
26607
  }
26478
- function printOutput(data, format = "json", logFn) {
26608
+ function escapeNonAscii(jsonText) {
26609
+ return jsonText.replace(/[\u0080-\uffff]/g, (c) => {
26610
+ const hex = c.charCodeAt(0).toString(16).padStart(4, "0");
26611
+ return `\\u${hex}`;
26612
+ });
26613
+ }
26614
+ function needsAsciiSafeJson(sink) {
26615
+ return process.platform === "win32" && !sink.capabilities.isInteractive;
26616
+ }
26617
+ function isPlainRecord(value) {
26618
+ if (value === null || typeof value !== "object")
26619
+ return false;
26620
+ const prototype = Object.getPrototypeOf(value);
26621
+ return prototype === Object.prototype || prototype === null;
26622
+ }
26623
+ function toLowerCamelCaseKey(key) {
26624
+ if (!key)
26625
+ return key;
26626
+ if (/[_\-\s]/.test(key)) {
26627
+ const [firstPart, ...restParts] = key.split(/[_\-\s]+/).filter(Boolean);
26628
+ if (!firstPart)
26629
+ return key;
26630
+ return [
26631
+ toLowerCamelCaseSimpleKey(firstPart),
26632
+ ...restParts.map((part) => {
26633
+ const normalized = toLowerCamelCaseSimpleKey(part);
26634
+ return normalized.charAt(0).toUpperCase() + normalized.slice(1);
26635
+ })
26636
+ ].join("");
26637
+ }
26638
+ return toLowerCamelCaseSimpleKey(key);
26639
+ }
26640
+ function toLowerCamelCaseSimpleKey(key) {
26641
+ if (/^[A-Z0-9]+$/.test(key))
26642
+ return key.toLowerCase();
26643
+ return key.replace(/^[A-Z]+(?=[A-Z][a-z]|\d|$)|^[A-Z]/, (match) => match.toLowerCase());
26644
+ }
26645
+ function toPascalCaseKey(key) {
26646
+ const lowerCamelKey = toLowerCamelCaseKey(key);
26647
+ return lowerCamelKey ? lowerCamelKey.charAt(0).toUpperCase() + lowerCamelKey.slice(1) : lowerCamelKey;
26648
+ }
26649
+ function toPascalCaseData(value) {
26650
+ if (Array.isArray(value))
26651
+ return value.map(toPascalCaseData);
26652
+ if (!isPlainRecord(value))
26653
+ return value;
26654
+ const result = {};
26655
+ for (const [key, nestedValue] of Object.entries(value)) {
26656
+ result[toPascalCaseKey(key)] = toPascalCaseData(nestedValue);
26657
+ }
26658
+ return result;
26659
+ }
26660
+ function normalizeDataKeys(data) {
26661
+ return toPascalCaseData(data);
26662
+ }
26663
+ function normalizeOutputKeys(data) {
26664
+ const result = {};
26665
+ for (const [key, value] of Object.entries(data)) {
26666
+ const pascalKey = toPascalCaseKey(key);
26667
+ result[pascalKey] = pascalKey === "Data" ? value : toPascalCaseData(value);
26668
+ }
26669
+ return result;
26670
+ }
26671
+ function printOutput(data, format = "json", logFn, asciiSafe = false) {
26479
26672
  if (!data) {
26480
26673
  logFn("Empty response object. No data to display.");
26481
26674
  return;
26482
26675
  }
26483
26676
  switch (format) {
26484
- case "json":
26485
- logFn(JSON.stringify(data, null, 2));
26677
+ case "json": {
26678
+ const json2 = JSON.stringify(data, null, 2);
26679
+ logFn(asciiSafe ? escapeNonAscii(json2) : json2);
26486
26680
  break;
26681
+ }
26487
26682
  case "yaml":
26488
26683
  logFn(toYaml(data));
26489
26684
  break;
@@ -26518,7 +26713,7 @@ function printOutput(data, format = "json", logFn) {
26518
26713
  function logOutput(data, format = "json") {
26519
26714
  const sink = getOutputSink();
26520
26715
  printOutput(data, format, (msg) => sink.writeOut(`${msg}
26521
- `));
26716
+ `), needsAsciiSafeJson(sink));
26522
26717
  }
26523
26718
  function cellToString(val) {
26524
26719
  return val != null && typeof val === "object" ? JSON.stringify(val) : String(val ?? "");
@@ -26535,7 +26730,7 @@ function wrapText(text, width) {
26535
26730
  function printTable(data, logFn, externalLogValue) {
26536
26731
  if (data.length === 0)
26537
26732
  return;
26538
- const keys = Object.keys(data[0]).filter((key) => key !== "Code" && key !== "Log");
26733
+ const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
26539
26734
  const maxWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
26540
26735
  const header = keys.map((key, i2) => key.padEnd(maxWidths[i2])).join(" | ");
26541
26736
  logFn(header);
@@ -26550,7 +26745,7 @@ function printTable(data, logFn, externalLogValue) {
26550
26745
  }
26551
26746
  }
26552
26747
  function printVerticalTable(data, logFn = console.log, externalLogValue) {
26553
- const keys = Object.keys(data).filter((key) => key !== "Code" && key !== "Log");
26748
+ const keys = Object.keys(data).filter((key) => !["code", "log"].includes(key.toLowerCase()));
26554
26749
  if (keys.length === 0)
26555
26750
  return;
26556
26751
  const maxKeyWidth = Math.max(...keys.map((key) => key.length));
@@ -26566,7 +26761,7 @@ function printVerticalTable(data, logFn = console.log, externalLogValue) {
26566
26761
  function printResizableTable(data, logFn = console.log, externalLogValue) {
26567
26762
  if (data.length === 0)
26568
26763
  return;
26569
- const keys = Object.keys(data[0]).filter((key) => key !== "Code" && key !== "Log");
26764
+ const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
26570
26765
  if (keys.length === 0)
26571
26766
  return;
26572
26767
  if (!process.stdout.isTTY) {
@@ -26642,8 +26837,26 @@ function printResizableTable(data, logFn = console.log, externalLogValue) {
26642
26837
  function toYaml(data) {
26643
26838
  return dump(data);
26644
26839
  }
26840
+ class FilterEvaluationError extends Error {
26841
+ __brand = "FilterEvaluationError";
26842
+ filter;
26843
+ instructions;
26844
+ result = RESULTS.ValidationError;
26845
+ constructor(filter, cause) {
26846
+ const underlying = cause instanceof Error ? cause.message : String(cause);
26847
+ super(`Filter '${filter}' failed to evaluate: ${underlying}`);
26848
+ this.name = "FilterEvaluationError";
26849
+ this.filter = filter;
26850
+ 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(@)'.";
26851
+ }
26852
+ }
26645
26853
  function applyFilter(data, filter) {
26646
- const result = search(data, filter);
26854
+ let result;
26855
+ try {
26856
+ result = search(data, filter);
26857
+ } catch (err) {
26858
+ throw new FilterEvaluationError(filter, err);
26859
+ }
26647
26860
  if (result == null)
26648
26861
  return [];
26649
26862
  if (Array.isArray(result)) {
@@ -26660,13 +26873,18 @@ function applyFilter(data, filter) {
26660
26873
  }
26661
26874
  var OutputFormatter;
26662
26875
  ((OutputFormatter) => {
26663
- function success(data) {
26876
+ function success(data, options) {
26664
26877
  data.Log ??= getLogFilePath() || undefined;
26878
+ const normalize = !options?.preserveDataKeys;
26879
+ if (normalize) {
26880
+ data.Data = normalizeDataKeys(data.Data);
26881
+ }
26665
26882
  const filter = getOutputFilter();
26666
26883
  if (filter) {
26667
- data.Data = applyFilter(data.Data, filter);
26884
+ const filtered = applyFilter(data.Data, filter);
26885
+ data.Data = normalize ? normalizeDataKeys(filtered) : filtered;
26668
26886
  }
26669
- logOutput(data, getOutputFormat());
26887
+ logOutput(normalizeOutputKeys(data), getOutputFormat());
26670
26888
  }
26671
26889
  OutputFormatter.success = success;
26672
26890
  function error(data) {
@@ -26676,7 +26894,7 @@ var OutputFormatter;
26676
26894
  result: data.Result,
26677
26895
  message: data.Message
26678
26896
  });
26679
- logOutput(data, getOutputFormat());
26897
+ logOutput(normalizeOutputKeys(data), getOutputFormat());
26680
26898
  }
26681
26899
  OutputFormatter.error = error;
26682
26900
  function emitList(code, items, opts) {
@@ -26697,11 +26915,14 @@ var OutputFormatter;
26697
26915
  function log(data) {
26698
26916
  const format = getOutputFormat();
26699
26917
  const sink = getOutputSink();
26918
+ const normalized = toPascalCaseData(data);
26700
26919
  if (format === "json") {
26701
- sink.writeErr(`${JSON.stringify(data)}
26920
+ const json2 = JSON.stringify(normalized);
26921
+ const safe = needsAsciiSafeJson(sink) ? escapeNonAscii(json2) : json2;
26922
+ sink.writeErr(`${safe}
26702
26923
  `);
26703
26924
  } else {
26704
- for (const [key, value] of Object.entries(data)) {
26925
+ for (const [key, value] of Object.entries(normalized)) {
26705
26926
  sink.writeErr(`${key}: ${value}
26706
26927
  `);
26707
26928
  }
@@ -26710,13 +26931,18 @@ var OutputFormatter;
26710
26931
  OutputFormatter.log = log;
26711
26932
  function formatToString(data) {
26712
26933
  const filter = getOutputFilter();
26713
- if (filter && "Data" in data && data.Data != null) {
26714
- data.Data = applyFilter(data.Data, filter);
26934
+ if ("Data" in data && data.Data != null) {
26935
+ data.Data = normalizeDataKeys(data.Data);
26936
+ if (filter) {
26937
+ data.Data = normalizeDataKeys(applyFilter(data.Data, filter));
26938
+ }
26715
26939
  }
26940
+ const output = normalizeOutputKeys(data);
26716
26941
  const lines = [];
26717
- printOutput(data, getOutputFormat(), (msg) => {
26942
+ const sink = getOutputSink();
26943
+ printOutput(output, getOutputFormat(), (msg) => {
26718
26944
  lines.push(msg);
26719
- });
26945
+ }, needsAsciiSafeJson(sink));
26720
26946
  return lines.join(`
26721
26947
  `);
26722
26948
  }
@@ -28125,6 +28351,62 @@ JSONPath.prototype.safeVm = {
28125
28351
  Script: SafeScript
28126
28352
  };
28127
28353
  JSONPath.prototype.vm = vm;
28354
+ // ../../common/src/option-aliases.ts
28355
+ function resolveDeprecatedOptionAlias({
28356
+ preferredValue,
28357
+ deprecatedValue,
28358
+ preferredFlag,
28359
+ deprecatedFlag
28360
+ }) {
28361
+ const hasPreferred = preferredValue !== undefined;
28362
+ const hasDeprecated = deprecatedValue !== undefined;
28363
+ if (hasPreferred && hasDeprecated) {
28364
+ return {
28365
+ value: undefined,
28366
+ usedDeprecated: true,
28367
+ error: {
28368
+ message: `${deprecatedFlag} and ${preferredFlag} are aliases. Use only ${preferredFlag}.`,
28369
+ instructions: `Replace ${deprecatedFlag} with ${preferredFlag}.`
28370
+ }
28371
+ };
28372
+ }
28373
+ return {
28374
+ value: hasPreferred ? preferredValue : deprecatedValue,
28375
+ usedDeprecated: hasDeprecated
28376
+ };
28377
+ }
28378
+ function warnDeprecatedOptionAlias(deprecatedFlag, preferredFlag) {
28379
+ getOutputSink().writeErr(`[WARN] ${deprecatedFlag} is deprecated. Use ${preferredFlag} instead.
28380
+ `);
28381
+ }
28382
+ var TENANT_SWITCH_COMMAND = "uip login tenant set <tenant>";
28383
+ function createHiddenDeprecatedTenantOption(flags = "-t, --tenant <tenant-name>") {
28384
+ return new Option(flags, `Tenant name. Deprecated; use ${TENANT_SWITCH_COMMAND} to switch active tenants.`).hideHelp().argParser((tenant) => {
28385
+ warnDeprecatedTenantOption(tenant);
28386
+ return tenant;
28387
+ });
28388
+ }
28389
+ function warnDeprecatedTenantOption(tenant) {
28390
+ if (tenant === undefined)
28391
+ return;
28392
+ warnDeprecatedOptionAlias("--tenant", TENANT_SWITCH_COMMAND);
28393
+ }
28394
+ // ../../common/src/polling/types.ts
28395
+ var PollOutcome = {
28396
+ Completed: "completed",
28397
+ Timeout: "timeout",
28398
+ Interrupted: "interrupted",
28399
+ Aborted: "aborted",
28400
+ Failed: "failed"
28401
+ };
28402
+
28403
+ // ../../common/src/polling/poll-failure-mapping.ts
28404
+ var REASON_BY_OUTCOME = {
28405
+ [PollOutcome.Timeout]: "poll_timeout",
28406
+ [PollOutcome.Failed]: "poll_failed",
28407
+ [PollOutcome.Interrupted]: "poll_failed",
28408
+ [PollOutcome.Aborted]: "poll_aborted"
28409
+ };
28128
28410
  // ../../common/src/polling/terminal-statuses.ts
28129
28411
  var TERMINAL_STATUSES = new Set([
28130
28412
  "completed",
@@ -28152,6 +28434,105 @@ var ScreenLogger;
28152
28434
  }
28153
28435
  ScreenLogger.progress = progress;
28154
28436
  })(ScreenLogger ||= {});
28437
+ // ../../common/src/sdk-user-agent.ts
28438
+ var USER_AGENT_HEADER = "User-Agent";
28439
+ var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
28440
+ function userAgentPatchKey(userAgent) {
28441
+ return Symbol.for(`@uipath/common/sdk-user-agent/${userAgent}`);
28442
+ }
28443
+ function splitUserAgentTokens(value) {
28444
+ return value?.trim().split(/\s+/).filter(Boolean) ?? [];
28445
+ }
28446
+ function appendUserAgentToken(value, userAgent) {
28447
+ const tokens = splitUserAgentTokens(value);
28448
+ const seen = new Set(tokens);
28449
+ for (const token of splitUserAgentTokens(userAgent)) {
28450
+ if (!seen.has(token)) {
28451
+ tokens.push(token);
28452
+ seen.add(token);
28453
+ }
28454
+ }
28455
+ return tokens.join(" ");
28456
+ }
28457
+ function getEffectiveUserAgent(userAgent) {
28458
+ return appendUserAgentToken(sdkUserAgentHostToken.get(), userAgent);
28459
+ }
28460
+ function isHeadersLike(headers) {
28461
+ return typeof headers === "object" && headers !== null && "get" in headers && typeof headers.get === "function" && "set" in headers && typeof headers.set === "function";
28462
+ }
28463
+ function getSdkUserAgentToken(pkg) {
28464
+ const packageName = pkg.name.replace(/^@uipath\//, "");
28465
+ return getEffectiveUserAgent(`${packageName}/${pkg.version}`);
28466
+ }
28467
+ function addSdkUserAgentHeader(headers, userAgent) {
28468
+ const result = { ...headers ?? {} };
28469
+ const effectiveUserAgent = getEffectiveUserAgent(userAgent);
28470
+ const headerName = Object.keys(result).find((key) => key.toLowerCase() === USER_AGENT_HEADER.toLowerCase());
28471
+ if (headerName) {
28472
+ result[headerName] = appendUserAgentToken(result[headerName], effectiveUserAgent);
28473
+ } else {
28474
+ result[USER_AGENT_HEADER] = effectiveUserAgent;
28475
+ }
28476
+ return result;
28477
+ }
28478
+ function withSdkUserAgentHeader(headers, userAgent) {
28479
+ const effectiveUserAgent = getEffectiveUserAgent(userAgent);
28480
+ if (isHeadersLike(headers)) {
28481
+ headers.set(USER_AGENT_HEADER, appendUserAgentToken(headers.get(USER_AGENT_HEADER), effectiveUserAgent));
28482
+ return headers;
28483
+ }
28484
+ if (Array.isArray(headers)) {
28485
+ const result = headers.map((entry) => {
28486
+ const [key, value] = entry;
28487
+ return [key, value];
28488
+ });
28489
+ const headerIndex = result.findIndex(([key]) => key.toLowerCase() === USER_AGENT_HEADER.toLowerCase());
28490
+ if (headerIndex >= 0) {
28491
+ const [key, value] = result[headerIndex];
28492
+ result[headerIndex] = [
28493
+ key,
28494
+ appendUserAgentToken(value, effectiveUserAgent)
28495
+ ];
28496
+ } else {
28497
+ result.push([USER_AGENT_HEADER, effectiveUserAgent]);
28498
+ }
28499
+ return result;
28500
+ }
28501
+ return addSdkUserAgentHeader(typeof headers === "object" && headers !== null ? { ...headers } : {}, effectiveUserAgent);
28502
+ }
28503
+ function withUserAgentInitOverride(initOverrides, userAgent) {
28504
+ return async (requestContext) => {
28505
+ const initWithUserAgent = {
28506
+ ...requestContext.init,
28507
+ headers: withSdkUserAgentHeader(requestContext.init.headers, userAgent)
28508
+ };
28509
+ const override = typeof initOverrides === "function" ? await initOverrides({
28510
+ ...requestContext,
28511
+ init: initWithUserAgent
28512
+ }) : initOverrides;
28513
+ return {
28514
+ ...override ?? {},
28515
+ headers: withSdkUserAgentHeader(override?.headers ?? initWithUserAgent.headers, userAgent)
28516
+ };
28517
+ };
28518
+ }
28519
+ function installSdkUserAgentHeader(BaseApiClass, userAgent) {
28520
+ const prototype = BaseApiClass.prototype;
28521
+ const patchKey = userAgentPatchKey(userAgent);
28522
+ if (prototype[patchKey]) {
28523
+ return;
28524
+ }
28525
+ if (typeof prototype.request !== "function") {
28526
+ throw new Error("Generated BaseAPI request function not found.");
28527
+ }
28528
+ const originalRequest = prototype.request;
28529
+ prototype.request = function requestWithUserAgent(context, initOverrides) {
28530
+ return originalRequest.call(this, context, withUserAgentInitOverride(initOverrides, userAgent));
28531
+ };
28532
+ Object.defineProperty(prototype, patchKey, {
28533
+ value: true
28534
+ });
28535
+ }
28155
28536
  // ../../common/src/tool-provider.ts
28156
28537
  var factorySlot = singleton("PackagerFactoryProvider");
28157
28538
  // ../../common/src/telemetry/pii-redactor.ts
@@ -28334,13 +28715,17 @@ Command.prototype.trackedAction = function(context, fn, properties) {
28334
28715
  const [error] = await catchError(fn(...args));
28335
28716
  if (error) {
28336
28717
  errorMessage = error instanceof Error ? error.message : String(error);
28337
- logger.error(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
28718
+ logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
28719
+ const typed = error;
28720
+ const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
28721
+ const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
28722
+ const finalResult = customResult ?? RESULTS.Failure;
28338
28723
  OutputFormatter.error({
28339
- Result: RESULTS.Failure,
28724
+ Result: finalResult,
28340
28725
  Message: errorMessage,
28341
- Instructions: "An unexpected error occurred. Run with --log-level debug for details."
28726
+ Instructions: customInstructions ?? "An unexpected error occurred. Run with --log-level debug for details."
28342
28727
  });
28343
- context.exit(1);
28728
+ context.exit(EXIT_CODES[finalResult]);
28344
28729
  }
28345
28730
  const durationMs = performance.now() - startTime;
28346
28731
  const success = !error && (process.exitCode === undefined || process.exitCode === 0);
@@ -28602,8 +28987,66 @@ class VoidApiResponse {
28602
28987
  return;
28603
28988
  }
28604
28989
  }
28605
-
28606
- // ../resourcecatalog-sdk/generated/src/models/TagType.ts
28990
+ // ../resourcecatalog-sdk/package.json
28991
+ var package_default2 = {
28992
+ name: "@uipath/resourcecatalog-sdk",
28993
+ license: "MIT",
28994
+ version: "1.2.0",
28995
+ description: "SDK for the UiPath Resource Catalog Service API.",
28996
+ repository: {
28997
+ type: "git",
28998
+ url: "https://github.com/UiPath/cli.git",
28999
+ directory: "packages/admin/resourcecatalog-sdk"
29000
+ },
29001
+ publishConfig: {
29002
+ registry: "https://npm.pkg.github.com/@uipath"
29003
+ },
29004
+ keywords: [
29005
+ "uipath",
29006
+ "resource-catalog",
29007
+ "sdk"
29008
+ ],
29009
+ type: "module",
29010
+ main: "./dist/index.js",
29011
+ types: "./dist/src/index.d.ts",
29012
+ exports: {
29013
+ ".": {
29014
+ types: "./dist/src/index.d.ts",
29015
+ default: "./dist/index.js"
29016
+ }
29017
+ },
29018
+ files: [
29019
+ "dist"
29020
+ ],
29021
+ private: true,
29022
+ scripts: {
29023
+ build: "bun build ./src/index.ts --outdir dist --format esm --target node && tsc -p tsconfig.build.json --noCheck",
29024
+ generate: "bun run src/scripts/generate-sdk.ts",
29025
+ lint: "biome check ."
29026
+ },
29027
+ devDependencies: {
29028
+ "@openapitools/openapi-generator-cli": "^2.31.1",
29029
+ "@types/node": "^25.5.2",
29030
+ "@uipath/auth": "workspace:*",
29031
+ "@uipath/common": "workspace:*",
29032
+ "@uipath/filesystem": "workspace:*",
29033
+ typescript: "^6.0.2"
29034
+ }
29035
+ };
29036
+
29037
+ // ../resourcecatalog-sdk/src/user-agent.ts
29038
+ var SDK_USER_AGENT = getSdkUserAgentToken(package_default2);
29039
+ installSdkUserAgentHeader(BaseAPI, SDK_USER_AGENT);
29040
+
29041
+ // ../resourcecatalog-sdk/generated/src/models/EntitySearchState.ts
29042
+ function EntitySearchStateFromJSON(json2) {
29043
+ return EntitySearchStateFromJSONTyped(json2, false);
29044
+ }
29045
+ function EntitySearchStateFromJSONTyped(json2, ignoreDiscriminator) {
29046
+ return json2;
29047
+ }
29048
+
29049
+ // ../resourcecatalog-sdk/generated/src/models/TagType.ts
28607
29050
  var TagType = {
28608
29051
  Label: "Label",
28609
29052
  KeyValue: "KeyValue"
@@ -28618,6 +29061,168 @@ function TagTypeToJSON(value) {
28618
29061
  return value;
28619
29062
  }
28620
29063
 
29064
+ // ../resourcecatalog-sdk/generated/src/models/TagModel.ts
29065
+ function TagModelFromJSON(json2) {
29066
+ return TagModelFromJSONTyped(json2, false);
29067
+ }
29068
+ function TagModelFromJSONTyped(json2, ignoreDiscriminator) {
29069
+ if (json2 == null) {
29070
+ return json2;
29071
+ }
29072
+ return {
29073
+ key: json2["key"] == null ? undefined : json2["key"],
29074
+ displayName: json2["displayName"] == null ? undefined : json2["displayName"],
29075
+ name: json2["name"] == null ? undefined : json2["name"],
29076
+ displayValue: json2["displayValue"] == null ? undefined : json2["displayValue"],
29077
+ value: json2["value"] == null ? undefined : json2["value"],
29078
+ type: json2["type"] == null ? undefined : TagTypeFromJSON(json2["type"]),
29079
+ accountKey: json2["accountKey"] == null ? undefined : json2["accountKey"],
29080
+ tenantKey: json2["tenantKey"] == null ? undefined : json2["tenantKey"],
29081
+ userKey: json2["userKey"] == null ? undefined : json2["userKey"]
29082
+ };
29083
+ }
29084
+
29085
+ // ../resourcecatalog-sdk/generated/src/models/EntityScope.ts
29086
+ function EntityScopeFromJSON(json2) {
29087
+ return EntityScopeFromJSONTyped(json2, false);
29088
+ }
29089
+ function EntityScopeFromJSONTyped(json2, ignoreDiscriminator) {
29090
+ return json2;
29091
+ }
29092
+
29093
+ // ../resourcecatalog-sdk/generated/src/models/FolderType.ts
29094
+ function FolderTypeFromJSON(json2) {
29095
+ return FolderTypeFromJSONTyped(json2, false);
29096
+ }
29097
+ function FolderTypeFromJSONTyped(json2, ignoreDiscriminator) {
29098
+ return json2;
29099
+ }
29100
+
29101
+ // ../resourcecatalog-sdk/generated/src/models/FolderModel.ts
29102
+ function FolderModelFromJSON(json2) {
29103
+ return FolderModelFromJSONTyped(json2, false);
29104
+ }
29105
+ function FolderModelFromJSONTyped(json2, ignoreDiscriminator) {
29106
+ if (json2 == null) {
29107
+ return json2;
29108
+ }
29109
+ return {
29110
+ id: json2["id"] == null ? undefined : json2["id"],
29111
+ key: json2["key"] == null ? undefined : json2["key"],
29112
+ displayName: json2["displayName"] == null ? undefined : json2["displayName"],
29113
+ code: json2["code"] == null ? undefined : json2["code"],
29114
+ fullyQualifiedName: json2["fullyQualifiedName"] == null ? undefined : json2["fullyQualifiedName"],
29115
+ timestamp: json2["timestamp"] == null ? undefined : new Date(json2["timestamp"]),
29116
+ tenantKey: json2["tenantKey"] == null ? undefined : json2["tenantKey"],
29117
+ accountKey: json2["accountKey"] == null ? undefined : json2["accountKey"],
29118
+ userKey: json2["userKey"] == null ? undefined : json2["userKey"],
29119
+ type: json2["type"] == null ? undefined : FolderTypeFromJSON(json2["type"]),
29120
+ path: json2["path"] == null ? undefined : json2["path"],
29121
+ permissions: json2["permissions"] == null ? undefined : json2["permissions"]
29122
+ };
29123
+ }
29124
+
29125
+ // ../resourcecatalog-sdk/generated/src/models/EntityModel.ts
29126
+ function EntityModelFromJSON(json2) {
29127
+ return EntityModelFromJSONTyped(json2, false);
29128
+ }
29129
+ function EntityModelFromJSONTyped(json2, ignoreDiscriminator) {
29130
+ if (json2 == null) {
29131
+ return json2;
29132
+ }
29133
+ return {
29134
+ entityKey: json2["entityKey"] == null ? undefined : json2["entityKey"],
29135
+ name: json2["name"] == null ? undefined : json2["name"],
29136
+ description: json2["description"] == null ? undefined : json2["description"],
29137
+ entityType: json2["entityType"] == null ? undefined : json2["entityType"],
29138
+ tags: json2["tags"] == null ? undefined : json2["tags"].map(TagModelFromJSON),
29139
+ folders: json2["folders"] == null ? undefined : json2["folders"].map(FolderModelFromJSON),
29140
+ linkedFoldersCount: json2["linkedFoldersCount"] == null ? undefined : json2["linkedFoldersCount"],
29141
+ source: json2["source"] == null ? undefined : json2["source"],
29142
+ scope: json2["scope"] == null ? undefined : EntityScopeFromJSON(json2["scope"]),
29143
+ searchState: json2["searchState"] == null ? undefined : EntitySearchStateFromJSON(json2["searchState"]),
29144
+ timestamp: json2["timestamp"] == null ? undefined : new Date(json2["timestamp"]),
29145
+ folderKey: json2["folderKey"] == null ? undefined : json2["folderKey"],
29146
+ folderKeys: json2["folderKeys"] == null ? undefined : json2["folderKeys"],
29147
+ tenantKey: json2["tenantKey"] == null ? undefined : json2["tenantKey"],
29148
+ accountKey: json2["accountKey"] == null ? undefined : json2["accountKey"],
29149
+ userKey: json2["userKey"] == null ? undefined : json2["userKey"],
29150
+ dependencies: json2["dependencies"] == null ? undefined : json2["dependencies"],
29151
+ customData: json2["customData"] == null ? undefined : json2["customData"],
29152
+ entitySubType: json2["entitySubType"] == null ? undefined : json2["entitySubType"]
29153
+ };
29154
+ }
29155
+
29156
+ // ../resourcecatalog-sdk/generated/src/models/EntityModelPaginationResult.ts
29157
+ function EntityModelPaginationResultFromJSON(json2) {
29158
+ return EntityModelPaginationResultFromJSONTyped(json2, false);
29159
+ }
29160
+ function EntityModelPaginationResultFromJSONTyped(json2, ignoreDiscriminator) {
29161
+ if (json2 == null) {
29162
+ return json2;
29163
+ }
29164
+ return {
29165
+ count: json2["count"] == null ? undefined : json2["count"],
29166
+ value: json2["value"] == null ? undefined : json2["value"].map(EntityModelFromJSON)
29167
+ };
29168
+ }
29169
+
29170
+ // ../resourcecatalog-sdk/generated/src/models/FolderDto.ts
29171
+ function FolderDtoFromJSON(json2) {
29172
+ return FolderDtoFromJSONTyped(json2, false);
29173
+ }
29174
+ function FolderDtoFromJSONTyped(json2, ignoreDiscriminator) {
29175
+ if (json2 == null) {
29176
+ return json2;
29177
+ }
29178
+ return {
29179
+ key: json2["key"] == null ? undefined : json2["key"],
29180
+ fullyQualifiedName: json2["fullyQualifiedName"] == null ? undefined : json2["fullyQualifiedName"],
29181
+ isPersonal: json2["isPersonal"] == null ? undefined : json2["isPersonal"],
29182
+ folderType: json2["folderType"] == null ? undefined : FolderTypeFromJSON(json2["folderType"])
29183
+ };
29184
+ }
29185
+
29186
+ // ../resourcecatalog-sdk/generated/src/models/FolderEntityModel.ts
29187
+ function FolderEntityModelFromJSON(json2) {
29188
+ return FolderEntityModelFromJSONTyped(json2, false);
29189
+ }
29190
+ function FolderEntityModelFromJSONTyped(json2, ignoreDiscriminator) {
29191
+ if (json2 == null) {
29192
+ return json2;
29193
+ }
29194
+ return {
29195
+ folderKey: json2["folderKey"] == null ? undefined : json2["folderKey"],
29196
+ folderName: json2["folderName"] == null ? undefined : json2["folderName"],
29197
+ folderCode: json2["folderCode"] == null ? undefined : json2["folderCode"],
29198
+ fullyQualifiedName: json2["fullyQualifiedName"] == null ? undefined : json2["fullyQualifiedName"],
29199
+ folderType: json2["folderType"] == null ? undefined : FolderTypeFromJSON(json2["folderType"]),
29200
+ folderPath: json2["folderPath"] == null ? undefined : json2["folderPath"],
29201
+ entityKey: json2["entityKey"] == null ? undefined : json2["entityKey"],
29202
+ entityName: json2["entityName"] == null ? undefined : json2["entityName"],
29203
+ entityDescription: json2["entityDescription"] == null ? undefined : json2["entityDescription"],
29204
+ entityType: json2["entityType"] == null ? undefined : json2["entityType"],
29205
+ entitySubType: json2["entitySubType"] == null ? undefined : json2["entitySubType"],
29206
+ entitySource: json2["entitySource"] == null ? undefined : json2["entitySource"]
29207
+ };
29208
+ }
29209
+
29210
+ // ../resourcecatalog-sdk/generated/src/models/FolderEntityModelCursorPaginationResult.ts
29211
+ function FolderEntityModelCursorPaginationResultFromJSON(json2) {
29212
+ return FolderEntityModelCursorPaginationResultFromJSONTyped(json2, false);
29213
+ }
29214
+ function FolderEntityModelCursorPaginationResultFromJSONTyped(json2, ignoreDiscriminator) {
29215
+ if (json2 == null) {
29216
+ return json2;
29217
+ }
29218
+ return {
29219
+ items: json2["items"] == null ? undefined : json2["items"].map(FolderEntityModelFromJSON),
29220
+ totalCount: json2["totalCount"] == null ? undefined : json2["totalCount"],
29221
+ nextPage: json2["nextPage"] == null ? undefined : json2["nextPage"],
29222
+ previousPage: json2["previousPage"] == null ? undefined : json2["previousPage"]
29223
+ };
29224
+ }
29225
+
28621
29226
  // ../resourcecatalog-sdk/generated/src/models/TagReferencesModel.ts
28622
29227
  function TagReferencesModelFromJSON(json2) {
28623
29228
  return TagReferencesModelFromJSONTyped(json2, false);
@@ -28739,27 +29344,464 @@ function TagValueModelPaginationResultFromJSONTyped(json2, ignoreDiscriminator)
28739
29344
  if (json2 == null) {
28740
29345
  return json2;
28741
29346
  }
28742
- return {
28743
- count: json2["count"] == null ? undefined : json2["count"],
28744
- value: json2["value"] == null ? undefined : json2["value"].map(TagValueModelFromJSON)
28745
- };
28746
- }
28747
-
28748
- // ../resourcecatalog-sdk/generated/src/models/ValueModel.ts
28749
- function ValueModelToJSON(json2) {
28750
- return ValueModelToJSONTyped(json2, false);
28751
- }
28752
- function ValueModelToJSONTyped(value, ignoreDiscriminator = false) {
28753
- if (value == null) {
28754
- return value;
29347
+ return {
29348
+ count: json2["count"] == null ? undefined : json2["count"],
29349
+ value: json2["value"] == null ? undefined : json2["value"].map(TagValueModelFromJSON)
29350
+ };
29351
+ }
29352
+
29353
+ // ../resourcecatalog-sdk/generated/src/models/ValueModel.ts
29354
+ function ValueModelToJSON(json2) {
29355
+ return ValueModelToJSONTyped(json2, false);
29356
+ }
29357
+ function ValueModelToJSONTyped(value, ignoreDiscriminator = false) {
29358
+ if (value == null) {
29359
+ return value;
29360
+ }
29361
+ return {
29362
+ labelKey: value["labelKey"],
29363
+ values: value["values"],
29364
+ accountKey: value["accountKey"],
29365
+ tenantKey: value["tenantKey"],
29366
+ userKey: value["userKey"]
29367
+ };
29368
+ }
29369
+
29370
+ // ../resourcecatalog-sdk/generated/src/apis/EntitiesApi.ts
29371
+ class EntitiesApi extends BaseAPI {
29372
+ async entitiesGetRaw(requestParameters, initOverrides) {
29373
+ if (requestParameters["xUiPathInternalAccountId"] == null) {
29374
+ throw new RequiredError("xUiPathInternalAccountId", 'Required parameter "xUiPathInternalAccountId" was null or undefined when calling entitiesGet().');
29375
+ }
29376
+ const queryParameters = {};
29377
+ if (requestParameters["skip"] != null) {
29378
+ queryParameters["skip"] = requestParameters["skip"];
29379
+ }
29380
+ if (requestParameters["take"] != null) {
29381
+ queryParameters["take"] = requestParameters["take"];
29382
+ }
29383
+ if (requestParameters["entityTypes"] != null) {
29384
+ queryParameters["entityTypes"] = requestParameters["entityTypes"];
29385
+ }
29386
+ if (requestParameters["entitySubType"] != null) {
29387
+ queryParameters["entitySubType"] = requestParameters["entitySubType"];
29388
+ }
29389
+ if (requestParameters["apiVersion"] != null) {
29390
+ queryParameters["api-version"] = requestParameters["apiVersion"];
29391
+ }
29392
+ const headerParameters = {};
29393
+ if (requestParameters["xVersion"] != null) {
29394
+ headerParameters["X-Version"] = String(requestParameters["xVersion"]);
29395
+ }
29396
+ if (requestParameters["xUiPathInternalAccountId"] != null) {
29397
+ headerParameters["X-UiPath-Internal-AccountId"] = String(requestParameters["xUiPathInternalAccountId"]);
29398
+ }
29399
+ if (requestParameters["xUiPathInternalTenantId"] != null) {
29400
+ headerParameters["X-UiPath-Internal-TenantId"] = String(requestParameters["xUiPathInternalTenantId"]);
29401
+ }
29402
+ if (requestParameters["xUIPATHOrganizationUnitId"] != null) {
29403
+ headerParameters["X-UIPATH-OrganizationUnitId"] = String(requestParameters["xUIPATHOrganizationUnitId"]);
29404
+ }
29405
+ if (requestParameters["xUIPATHFolderPath"] != null) {
29406
+ headerParameters["X-UIPATH-FolderPath"] = String(requestParameters["xUIPATHFolderPath"]);
29407
+ }
29408
+ if (requestParameters["xUIPATHFolderPathEncoded"] != null) {
29409
+ headerParameters["X-UIPATH-FolderPath-Encoded"] = String(requestParameters["xUIPATHFolderPathEncoded"]);
29410
+ }
29411
+ if (requestParameters["xUIPATHFolderKey"] != null) {
29412
+ headerParameters["X-UIPATH-FolderKey"] = String(requestParameters["xUIPATHFolderKey"]);
29413
+ }
29414
+ if (this.configuration && this.configuration.accessToken) {
29415
+ const token = this.configuration.accessToken;
29416
+ const tokenString = await token("Bearer", []);
29417
+ if (tokenString) {
29418
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
29419
+ }
29420
+ }
29421
+ let urlPath = `/Entities`;
29422
+ const response = await this.request({
29423
+ path: urlPath,
29424
+ method: "GET",
29425
+ headers: headerParameters,
29426
+ query: queryParameters
29427
+ }, initOverrides);
29428
+ return new JSONApiResponse(response, (jsonValue) => EntityModelPaginationResultFromJSON(jsonValue));
29429
+ }
29430
+ async entitiesGet(requestParameters, initOverrides) {
29431
+ const response = await this.entitiesGetRaw(requestParameters, initOverrides);
29432
+ return await response.value();
29433
+ }
29434
+ async entitiesGetByEntityTypeRaw(requestParameters, initOverrides) {
29435
+ if (requestParameters["entityType"] == null) {
29436
+ throw new RequiredError("entityType", 'Required parameter "entityType" was null or undefined when calling entitiesGetByEntityType().');
29437
+ }
29438
+ if (requestParameters["xUiPathInternalAccountId"] == null) {
29439
+ throw new RequiredError("xUiPathInternalAccountId", 'Required parameter "xUiPathInternalAccountId" was null or undefined when calling entitiesGetByEntityType().');
29440
+ }
29441
+ const queryParameters = {};
29442
+ if (requestParameters["name"] != null) {
29443
+ queryParameters["name"] = requestParameters["name"];
29444
+ }
29445
+ if (requestParameters["skip"] != null) {
29446
+ queryParameters["skip"] = requestParameters["skip"];
29447
+ }
29448
+ if (requestParameters["take"] != null) {
29449
+ queryParameters["take"] = requestParameters["take"];
29450
+ }
29451
+ if (requestParameters["entitySubType"] != null) {
29452
+ queryParameters["entitySubType"] = requestParameters["entitySubType"];
29453
+ }
29454
+ if (requestParameters["apiVersion"] != null) {
29455
+ queryParameters["api-version"] = requestParameters["apiVersion"];
29456
+ }
29457
+ const headerParameters = {};
29458
+ if (requestParameters["xVersion"] != null) {
29459
+ headerParameters["X-Version"] = String(requestParameters["xVersion"]);
29460
+ }
29461
+ if (requestParameters["xUiPathInternalAccountId"] != null) {
29462
+ headerParameters["X-UiPath-Internal-AccountId"] = String(requestParameters["xUiPathInternalAccountId"]);
29463
+ }
29464
+ if (requestParameters["xUiPathInternalTenantId"] != null) {
29465
+ headerParameters["X-UiPath-Internal-TenantId"] = String(requestParameters["xUiPathInternalTenantId"]);
29466
+ }
29467
+ if (requestParameters["xUIPATHOrganizationUnitId"] != null) {
29468
+ headerParameters["X-UIPATH-OrganizationUnitId"] = String(requestParameters["xUIPATHOrganizationUnitId"]);
29469
+ }
29470
+ if (requestParameters["xUIPATHFolderPath"] != null) {
29471
+ headerParameters["X-UIPATH-FolderPath"] = String(requestParameters["xUIPATHFolderPath"]);
29472
+ }
29473
+ if (requestParameters["xUIPATHFolderPathEncoded"] != null) {
29474
+ headerParameters["X-UIPATH-FolderPath-Encoded"] = String(requestParameters["xUIPATHFolderPathEncoded"]);
29475
+ }
29476
+ if (requestParameters["xUIPATHFolderKey"] != null) {
29477
+ headerParameters["X-UIPATH-FolderKey"] = String(requestParameters["xUIPATHFolderKey"]);
29478
+ }
29479
+ if (this.configuration && this.configuration.accessToken) {
29480
+ const token = this.configuration.accessToken;
29481
+ const tokenString = await token("Bearer", []);
29482
+ if (tokenString) {
29483
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
29484
+ }
29485
+ }
29486
+ let urlPath = `/Entities/{entityType}`;
29487
+ urlPath = urlPath.replace(`{${"entityType"}}`, encodeURIComponent(String(requestParameters["entityType"])));
29488
+ const response = await this.request({
29489
+ path: urlPath,
29490
+ method: "GET",
29491
+ headers: headerParameters,
29492
+ query: queryParameters
29493
+ }, initOverrides);
29494
+ return new JSONApiResponse(response, (jsonValue) => EntityModelPaginationResultFromJSON(jsonValue));
29495
+ }
29496
+ async entitiesGetByEntityType(requestParameters, initOverrides) {
29497
+ const response = await this.entitiesGetByEntityTypeRaw(requestParameters, initOverrides);
29498
+ return await response.value();
29499
+ }
29500
+ async entitiesGetDependenciesRaw(requestParameters, initOverrides) {
29501
+ if (requestParameters["entityKey"] == null) {
29502
+ throw new RequiredError("entityKey", 'Required parameter "entityKey" was null or undefined when calling entitiesGetDependencies().');
29503
+ }
29504
+ if (requestParameters["xUiPathInternalAccountId"] == null) {
29505
+ throw new RequiredError("xUiPathInternalAccountId", 'Required parameter "xUiPathInternalAccountId" was null or undefined when calling entitiesGetDependencies().');
29506
+ }
29507
+ const queryParameters = {};
29508
+ if (requestParameters["apiVersion"] != null) {
29509
+ queryParameters["api-version"] = requestParameters["apiVersion"];
29510
+ }
29511
+ const headerParameters = {};
29512
+ if (requestParameters["xVersion"] != null) {
29513
+ headerParameters["X-Version"] = String(requestParameters["xVersion"]);
29514
+ }
29515
+ if (requestParameters["xUiPathInternalAccountId"] != null) {
29516
+ headerParameters["X-UiPath-Internal-AccountId"] = String(requestParameters["xUiPathInternalAccountId"]);
29517
+ }
29518
+ if (requestParameters["xUiPathInternalTenantId"] != null) {
29519
+ headerParameters["X-UiPath-Internal-TenantId"] = String(requestParameters["xUiPathInternalTenantId"]);
29520
+ }
29521
+ if (this.configuration && this.configuration.accessToken) {
29522
+ const token = this.configuration.accessToken;
29523
+ const tokenString = await token("Bearer", []);
29524
+ if (tokenString) {
29525
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
29526
+ }
29527
+ }
29528
+ let urlPath = `/Entities/{entityKey}/Dependencies`;
29529
+ urlPath = urlPath.replace(`{${"entityKey"}}`, encodeURIComponent(String(requestParameters["entityKey"])));
29530
+ const response = await this.request({
29531
+ path: urlPath,
29532
+ method: "GET",
29533
+ headers: headerParameters,
29534
+ query: queryParameters
29535
+ }, initOverrides);
29536
+ return new JSONApiResponse(response, (jsonValue) => jsonValue.map(EntityModelFromJSON));
29537
+ }
29538
+ async entitiesGetDependencies(requestParameters, initOverrides) {
29539
+ const response = await this.entitiesGetDependenciesRaw(requestParameters, initOverrides);
29540
+ return await response.value();
29541
+ }
29542
+ async entitiesGetEntitiesByKeysRaw(requestParameters, initOverrides) {
29543
+ if (requestParameters["xUiPathInternalAccountId"] == null) {
29544
+ throw new RequiredError("xUiPathInternalAccountId", 'Required parameter "xUiPathInternalAccountId" was null or undefined when calling entitiesGetEntitiesByKeys().');
29545
+ }
29546
+ const queryParameters = {};
29547
+ if (requestParameters["apiVersion"] != null) {
29548
+ queryParameters["api-version"] = requestParameters["apiVersion"];
29549
+ }
29550
+ const headerParameters = {};
29551
+ headerParameters["Content-Type"] = "application/json";
29552
+ if (requestParameters["xVersion"] != null) {
29553
+ headerParameters["X-Version"] = String(requestParameters["xVersion"]);
29554
+ }
29555
+ if (requestParameters["xUiPathInternalAccountId"] != null) {
29556
+ headerParameters["X-UiPath-Internal-AccountId"] = String(requestParameters["xUiPathInternalAccountId"]);
29557
+ }
29558
+ if (requestParameters["xUiPathInternalTenantId"] != null) {
29559
+ headerParameters["X-UiPath-Internal-TenantId"] = String(requestParameters["xUiPathInternalTenantId"]);
29560
+ }
29561
+ if (this.configuration && this.configuration.accessToken) {
29562
+ const token = this.configuration.accessToken;
29563
+ const tokenString = await token("Bearer", []);
29564
+ if (tokenString) {
29565
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
29566
+ }
29567
+ }
29568
+ let urlPath = `/Entities/GetEntitiesByKeys`;
29569
+ const response = await this.request({
29570
+ path: urlPath,
29571
+ method: "POST",
29572
+ headers: headerParameters,
29573
+ query: queryParameters,
29574
+ body: requestParameters["requestBody"]
29575
+ }, initOverrides);
29576
+ return new JSONApiResponse(response, (jsonValue) => jsonValue.map(EntityModelFromJSON));
29577
+ }
29578
+ async entitiesGetEntitiesByKeys(requestParameters, initOverrides) {
29579
+ const response = await this.entitiesGetEntitiesByKeysRaw(requestParameters, initOverrides);
29580
+ return await response.value();
29581
+ }
29582
+ async entitiesGetFoldersRaw(requestParameters, initOverrides) {
29583
+ if (requestParameters["entityType"] == null) {
29584
+ throw new RequiredError("entityType", 'Required parameter "entityType" was null or undefined when calling entitiesGetFolders().');
29585
+ }
29586
+ if (requestParameters["xUiPathInternalAccountId"] == null) {
29587
+ throw new RequiredError("xUiPathInternalAccountId", 'Required parameter "xUiPathInternalAccountId" was null or undefined when calling entitiesGetFolders().');
29588
+ }
29589
+ const queryParameters = {};
29590
+ if (requestParameters["permissions"] != null) {
29591
+ queryParameters["permissions"] = requestParameters["permissions"];
29592
+ }
29593
+ if (requestParameters["folderTypes"] != null) {
29594
+ queryParameters["folderTypes"] = requestParameters["folderTypes"];
29595
+ }
29596
+ if (requestParameters["apiVersion"] != null) {
29597
+ queryParameters["api-version"] = requestParameters["apiVersion"];
29598
+ }
29599
+ const headerParameters = {};
29600
+ if (requestParameters["xVersion"] != null) {
29601
+ headerParameters["X-Version"] = String(requestParameters["xVersion"]);
29602
+ }
29603
+ if (requestParameters["xUiPathInternalAccountId"] != null) {
29604
+ headerParameters["X-UiPath-Internal-AccountId"] = String(requestParameters["xUiPathInternalAccountId"]);
29605
+ }
29606
+ if (requestParameters["xUiPathInternalTenantId"] != null) {
29607
+ headerParameters["X-UiPath-Internal-TenantId"] = String(requestParameters["xUiPathInternalTenantId"]);
29608
+ }
29609
+ if (this.configuration && this.configuration.accessToken) {
29610
+ const token = this.configuration.accessToken;
29611
+ const tokenString = await token("Bearer", []);
29612
+ if (tokenString) {
29613
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
29614
+ }
29615
+ }
29616
+ let urlPath = `/Entities/{entityType}/Folders`;
29617
+ urlPath = urlPath.replace(`{${"entityType"}}`, encodeURIComponent(String(requestParameters["entityType"])));
29618
+ const response = await this.request({
29619
+ path: urlPath,
29620
+ method: "GET",
29621
+ headers: headerParameters,
29622
+ query: queryParameters
29623
+ }, initOverrides);
29624
+ return new JSONApiResponse(response, (jsonValue) => jsonValue.map(FolderDtoFromJSON));
29625
+ }
29626
+ async entitiesGetFolders(requestParameters, initOverrides) {
29627
+ const response = await this.entitiesGetFoldersRaw(requestParameters, initOverrides);
29628
+ return await response.value();
29629
+ }
29630
+ async entitiesGetPermissionsRaw(requestParameters, initOverrides) {
29631
+ if (requestParameters["entityType"] == null) {
29632
+ throw new RequiredError("entityType", 'Required parameter "entityType" was null or undefined when calling entitiesGetPermissions().');
29633
+ }
29634
+ if (requestParameters["xUiPathInternalAccountId"] == null) {
29635
+ throw new RequiredError("xUiPathInternalAccountId", 'Required parameter "xUiPathInternalAccountId" was null or undefined when calling entitiesGetPermissions().');
29636
+ }
29637
+ const queryParameters = {};
29638
+ if (requestParameters["apiVersion"] != null) {
29639
+ queryParameters["api-version"] = requestParameters["apiVersion"];
29640
+ }
29641
+ const headerParameters = {};
29642
+ if (requestParameters["xVersion"] != null) {
29643
+ headerParameters["X-Version"] = String(requestParameters["xVersion"]);
29644
+ }
29645
+ if (requestParameters["xUiPathInternalAccountId"] != null) {
29646
+ headerParameters["X-UiPath-Internal-AccountId"] = String(requestParameters["xUiPathInternalAccountId"]);
29647
+ }
29648
+ if (requestParameters["xUiPathInternalTenantId"] != null) {
29649
+ headerParameters["X-UiPath-Internal-TenantId"] = String(requestParameters["xUiPathInternalTenantId"]);
29650
+ }
29651
+ if (requestParameters["xUIPATHOrganizationUnitId"] != null) {
29652
+ headerParameters["X-UIPATH-OrganizationUnitId"] = String(requestParameters["xUIPATHOrganizationUnitId"]);
29653
+ }
29654
+ if (requestParameters["xUIPATHFolderPath"] != null) {
29655
+ headerParameters["X-UIPATH-FolderPath"] = String(requestParameters["xUIPATHFolderPath"]);
29656
+ }
29657
+ if (requestParameters["xUIPATHFolderPathEncoded"] != null) {
29658
+ headerParameters["X-UIPATH-FolderPath-Encoded"] = String(requestParameters["xUIPATHFolderPathEncoded"]);
29659
+ }
29660
+ if (requestParameters["xUIPATHFolderKey"] != null) {
29661
+ headerParameters["X-UIPATH-FolderKey"] = String(requestParameters["xUIPATHFolderKey"]);
29662
+ }
29663
+ if (this.configuration && this.configuration.accessToken) {
29664
+ const token = this.configuration.accessToken;
29665
+ const tokenString = await token("Bearer", []);
29666
+ if (tokenString) {
29667
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
29668
+ }
29669
+ }
29670
+ let urlPath = `/Entities/{entityType}/Permissions`;
29671
+ urlPath = urlPath.replace(`{${"entityType"}}`, encodeURIComponent(String(requestParameters["entityType"])));
29672
+ const response = await this.request({
29673
+ path: urlPath,
29674
+ method: "GET",
29675
+ headers: headerParameters,
29676
+ query: queryParameters
29677
+ }, initOverrides);
29678
+ return new JSONApiResponse(response);
29679
+ }
29680
+ async entitiesGetPermissions(requestParameters, initOverrides) {
29681
+ const response = await this.entitiesGetPermissionsRaw(requestParameters, initOverrides);
29682
+ return await response.value();
29683
+ }
29684
+ async entitiesSearchRaw(requestParameters, initOverrides) {
29685
+ if (requestParameters["xUiPathInternalAccountId"] == null) {
29686
+ throw new RequiredError("xUiPathInternalAccountId", 'Required parameter "xUiPathInternalAccountId" was null or undefined when calling entitiesSearch().');
29687
+ }
29688
+ const queryParameters = {};
29689
+ if (requestParameters["name"] != null) {
29690
+ queryParameters["name"] = requestParameters["name"];
29691
+ }
29692
+ if (requestParameters["skip"] != null) {
29693
+ queryParameters["skip"] = requestParameters["skip"];
29694
+ }
29695
+ if (requestParameters["take"] != null) {
29696
+ queryParameters["take"] = requestParameters["take"];
29697
+ }
29698
+ if (requestParameters["entityTypes"] != null) {
29699
+ queryParameters["entityTypes"] = requestParameters["entityTypes"];
29700
+ }
29701
+ if (requestParameters["entitySubType"] != null) {
29702
+ queryParameters["entitySubType"] = requestParameters["entitySubType"];
29703
+ }
29704
+ if (requestParameters["apiVersion"] != null) {
29705
+ queryParameters["api-version"] = requestParameters["apiVersion"];
29706
+ }
29707
+ const headerParameters = {};
29708
+ if (requestParameters["xVersion"] != null) {
29709
+ headerParameters["X-Version"] = String(requestParameters["xVersion"]);
29710
+ }
29711
+ if (requestParameters["xUiPathInternalAccountId"] != null) {
29712
+ headerParameters["X-UiPath-Internal-AccountId"] = String(requestParameters["xUiPathInternalAccountId"]);
29713
+ }
29714
+ if (requestParameters["xUiPathInternalTenantId"] != null) {
29715
+ headerParameters["X-UiPath-Internal-TenantId"] = String(requestParameters["xUiPathInternalTenantId"]);
29716
+ }
29717
+ if (requestParameters["xUIPATHOrganizationUnitId"] != null) {
29718
+ headerParameters["X-UIPATH-OrganizationUnitId"] = String(requestParameters["xUIPATHOrganizationUnitId"]);
29719
+ }
29720
+ if (requestParameters["xUIPATHFolderPath"] != null) {
29721
+ headerParameters["X-UIPATH-FolderPath"] = String(requestParameters["xUIPATHFolderPath"]);
29722
+ }
29723
+ if (requestParameters["xUIPATHFolderPathEncoded"] != null) {
29724
+ headerParameters["X-UIPATH-FolderPath-Encoded"] = String(requestParameters["xUIPATHFolderPathEncoded"]);
29725
+ }
29726
+ if (requestParameters["xUIPATHFolderKey"] != null) {
29727
+ headerParameters["X-UIPATH-FolderKey"] = String(requestParameters["xUIPATHFolderKey"]);
29728
+ }
29729
+ if (this.configuration && this.configuration.accessToken) {
29730
+ const token = this.configuration.accessToken;
29731
+ const tokenString = await token("Bearer", []);
29732
+ if (tokenString) {
29733
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
29734
+ }
29735
+ }
29736
+ let urlPath = `/Entities/Search`;
29737
+ const response = await this.request({
29738
+ path: urlPath,
29739
+ method: "GET",
29740
+ headers: headerParameters,
29741
+ query: queryParameters
29742
+ }, initOverrides);
29743
+ return new JSONApiResponse(response, (jsonValue) => EntityModelPaginationResultFromJSON(jsonValue));
29744
+ }
29745
+ async entitiesSearch(requestParameters, initOverrides) {
29746
+ const response = await this.entitiesSearchRaw(requestParameters, initOverrides);
29747
+ return await response.value();
29748
+ }
29749
+ async entitiesSearchFolderEntitiesRaw(requestParameters, initOverrides) {
29750
+ if (requestParameters["xUiPathInternalAccountId"] == null) {
29751
+ throw new RequiredError("xUiPathInternalAccountId", 'Required parameter "xUiPathInternalAccountId" was null or undefined when calling entitiesSearchFolderEntities().');
29752
+ }
29753
+ const queryParameters = {};
29754
+ if (requestParameters["name"] != null) {
29755
+ queryParameters["name"] = requestParameters["name"];
29756
+ }
29757
+ if (requestParameters["pageCursor"] != null) {
29758
+ queryParameters["pageCursor"] = requestParameters["pageCursor"];
29759
+ }
29760
+ if (requestParameters["pageSize"] != null) {
29761
+ queryParameters["pageSize"] = requestParameters["pageSize"];
29762
+ }
29763
+ if (requestParameters["entityTypes"] != null) {
29764
+ queryParameters["entityTypes"] = requestParameters["entityTypes"];
29765
+ }
29766
+ if (requestParameters["entitySubTypes"] != null) {
29767
+ queryParameters["entitySubTypes"] = requestParameters["entitySubTypes"];
29768
+ }
29769
+ if (requestParameters["folderTypes"] != null) {
29770
+ queryParameters["folderTypes"] = requestParameters["folderTypes"];
29771
+ }
29772
+ if (requestParameters["apiVersion"] != null) {
29773
+ queryParameters["api-version"] = requestParameters["apiVersion"];
29774
+ }
29775
+ const headerParameters = {};
29776
+ if (requestParameters["xVersion"] != null) {
29777
+ headerParameters["X-Version"] = String(requestParameters["xVersion"]);
29778
+ }
29779
+ if (requestParameters["xUiPathInternalAccountId"] != null) {
29780
+ headerParameters["X-UiPath-Internal-AccountId"] = String(requestParameters["xUiPathInternalAccountId"]);
29781
+ }
29782
+ if (requestParameters["xUiPathInternalTenantId"] != null) {
29783
+ headerParameters["X-UiPath-Internal-TenantId"] = String(requestParameters["xUiPathInternalTenantId"]);
29784
+ }
29785
+ if (this.configuration && this.configuration.accessToken) {
29786
+ const token = this.configuration.accessToken;
29787
+ const tokenString = await token("Bearer", []);
29788
+ if (tokenString) {
29789
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
29790
+ }
29791
+ }
29792
+ let urlPath = `/Entities/SearchFolderEntities`;
29793
+ const response = await this.request({
29794
+ path: urlPath,
29795
+ method: "GET",
29796
+ headers: headerParameters,
29797
+ query: queryParameters
29798
+ }, initOverrides);
29799
+ return new JSONApiResponse(response, (jsonValue) => FolderEntityModelCursorPaginationResultFromJSON(jsonValue));
29800
+ }
29801
+ async entitiesSearchFolderEntities(requestParameters, initOverrides) {
29802
+ const response = await this.entitiesSearchFolderEntitiesRaw(requestParameters, initOverrides);
29803
+ return await response.value();
28755
29804
  }
28756
- return {
28757
- labelKey: value["labelKey"],
28758
- values: value["values"],
28759
- accountKey: value["accountKey"],
28760
- tenantKey: value["tenantKey"],
28761
- userKey: value["userKey"]
28762
- };
28763
29805
  }
28764
29806
 
28765
29807
  // ../resourcecatalog-sdk/generated/src/apis/TagsApi.ts
@@ -29360,30 +30402,7 @@ class InvalidBaseUrlError extends Error {
29360
30402
  this.name = "InvalidBaseUrlError";
29361
30403
  }
29362
30404
  }
29363
- var DEFAULT_SCOPES = [
29364
- "offline_access",
29365
- "ProcessMining",
29366
- "OrchestratorApiUserAccess",
29367
- "StudioWebBackend",
29368
- "IdentityServerApi",
29369
- "ConnectionService",
29370
- "DataService",
29371
- "DataServiceApiUserAccess",
29372
- "DocumentUnderstanding",
29373
- "EnterpriseContextService",
29374
- "Directory",
29375
- "JamJamApi",
29376
- "LLMGateway",
29377
- "LLMOps",
29378
- "OMS",
29379
- "RCS.FolderAuthorization",
29380
- "RCS.TagsManagement",
29381
- "TestmanagerApiUserAccess",
29382
- "AutomationSolutions",
29383
- "StudioWebTypeCacheService",
29384
- "Docs.GPT.Search",
29385
- "Insights"
29386
- ];
30405
+ var DEFAULT_SCOPES = ["openid", "profile", "offline_access"];
29387
30406
  var normalizeAndValidateBaseUrl = (rawUrl) => {
29388
30407
  let baseUrl = rawUrl;
29389
30408
  if (baseUrl.endsWith("/identity_/")) {
@@ -29433,7 +30452,8 @@ var resolveConfigAsync = async ({
29433
30452
  if (!clientSecret && fileAuth.clientSecret) {
29434
30453
  clientSecret = fileAuth.clientSecret;
29435
30454
  }
29436
- const scopes = customScopes && customScopes.length > 0 ? customScopes : fileAuth.scopes && fileAuth.scopes.length > 0 ? fileAuth.scopes : DEFAULT_SCOPES;
30455
+ const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && Boolean(clientSecret);
30456
+ const scopes = customScopes && customScopes.length > 0 ? customScopes : fileAuth.scopes && fileAuth.scopes.length > 0 ? fileAuth.scopes : isExternalAppAuth ? [] : DEFAULT_SCOPES;
29437
30457
  return {
29438
30458
  clientId,
29439
30459
  clientSecret,
@@ -29521,6 +30541,7 @@ var getTokenExpiration = (accessToken) => {
29521
30541
 
29522
30542
  // ../../auth/src/envAuth.ts
29523
30543
  var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
30544
+ var ENFORCE_ROBOT_AUTH_VAR = "UIPATH_CLI_ENFORCE_ROBOT_AUTH";
29524
30545
  var ENV_AUTH_VARS = {
29525
30546
  token: "UIPATH_CLI_AUTH_TOKEN",
29526
30547
  organizationName: "UIPATH_CLI_ORGANIZATION_NAME",
@@ -29536,6 +30557,7 @@ class EnvAuthConfigError extends Error {
29536
30557
  }
29537
30558
  }
29538
30559
  var isEnvAuthEnabled = () => process.env[ENV_AUTH_ENABLE_VAR] === "true";
30560
+ var isRobotAuthEnforced = () => process.env[ENFORCE_ROBOT_AUTH_VAR] === "true";
29539
30561
  var requireEnv = (name) => {
29540
30562
  const value = process.env[name];
29541
30563
  if (!value) {
@@ -29577,7 +30599,9 @@ var readAuthFromEnv = () => {
29577
30599
  expiration
29578
30600
  };
29579
30601
  };
30602
+
29580
30603
  // ../../auth/src/robotClientFallback.ts
30604
+ init_src();
29581
30605
  var DEFAULT_TIMEOUT_MS = 1000;
29582
30606
  var CLOSE_TIMEOUT_MS = 500;
29583
30607
  var NOTICE_SENTINEL = Symbol.for("@uipath/auth/robotFallbackNoticePrinted");
@@ -29589,6 +30613,35 @@ var printNoticeOnce = () => {
29589
30613
  catchError2(() => process.stderr.write(`Using UiPath Robot credentials. Run 'uip login' for a dedicated session.
29590
30614
  `));
29591
30615
  };
30616
+ var ROBOT_USER_SERVICES_PIPE = "UiPathUserServices";
30617
+ var ROBOT_USER_SERVICES_ALTERNATE_PIPE = `${ROBOT_USER_SERVICES_PIPE}Alternate`;
30618
+ var PIPE_NAME_MAX_LENGTH = 103;
30619
+ var getRobotIpcPipeNames = async () => {
30620
+ const fs7 = getFileSystem();
30621
+ const username = fs7.env.getenv("USER") ?? fs7.env.getenv("USERNAME");
30622
+ if (!username) {
30623
+ throw new Error("Unable to determine current username");
30624
+ }
30625
+ const tempPath = fs7.env.getenv("TMPDIR") ?? "/tmp/";
30626
+ return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) => fs7.path.join(tempPath, `${baseName}_${username}`).substring(0, PIPE_NAME_MAX_LENGTH));
30627
+ };
30628
+ var defaultIsRobotIpcAvailable = async () => {
30629
+ if (process.platform === "win32") {
30630
+ return true;
30631
+ }
30632
+ const [pipeNamesError, pipeNames] = await catchError2(getRobotIpcPipeNames());
30633
+ if (pipeNamesError || !pipeNames) {
30634
+ return false;
30635
+ }
30636
+ const fs7 = getFileSystem();
30637
+ for (const pipeName of pipeNames) {
30638
+ const [existsError, exists] = await catchError2(fs7.exists(pipeName));
30639
+ if (!existsError && exists === true) {
30640
+ return true;
30641
+ }
30642
+ }
30643
+ return false;
30644
+ };
29592
30645
  var withTimeout = (promise, timeoutMs) => new Promise((resolve2, reject) => {
29593
30646
  const timer = setTimeout(() => reject(new Error(`Robot IPC call timed out after ${timeoutMs}ms`)), timeoutMs);
29594
30647
  promise.then((value) => {
@@ -29620,14 +30673,20 @@ var defaultLoadModule = async () => {
29620
30673
  var tryRobotClientFallback = async (options = {}) => {
29621
30674
  if (isBrowser())
29622
30675
  return;
29623
- if (process.env.CI || process.env.GITHUB_ACTIONS) {
29624
- return;
29625
- }
29626
- if (process.env.UIPATH_URL) {
29627
- return;
30676
+ if (!options.force) {
30677
+ if (process.env.CI || process.env.GITHUB_ACTIONS) {
30678
+ return;
30679
+ }
30680
+ if (process.env.UIPATH_URL) {
30681
+ return;
30682
+ }
29628
30683
  }
29629
30684
  const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
30685
+ const isRobotIpcAvailable = options.isRobotIpcAvailable ?? defaultIsRobotIpcAvailable;
29630
30686
  const loadModule = options.loadModule ?? defaultLoadModule;
30687
+ if (!await isRobotIpcAvailable()) {
30688
+ return;
30689
+ }
29631
30690
  const mod2 = await loadModule();
29632
30691
  if (!mod2)
29633
30692
  return;
@@ -29894,11 +30953,130 @@ function normalizeTokenRefreshFailure() {
29894
30953
  function normalizeTokenRefreshUnavailableFailure() {
29895
30954
  return "token refresh failed before authentication completed";
29896
30955
  }
29897
- var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
29898
- if (isEnvAuthEnabled()) {
29899
- return readAuthFromEnv();
30956
+ function errorMessage(error) {
30957
+ return error instanceof Error ? error.message : String(error);
30958
+ }
30959
+ function computeExpirationThreshold(ensureTokenValidityMinutes) {
30960
+ return new Date(Date.now() + (ensureTokenValidityMinutes ?? 0) * 60 * 1000);
30961
+ }
30962
+ async function runRefreshLocked(inputs) {
30963
+ const {
30964
+ absolutePath,
30965
+ refreshToken: callerRefreshToken,
30966
+ customAuthority,
30967
+ ensureTokenValidityMinutes,
30968
+ loadEnvFile,
30969
+ saveEnvFile,
30970
+ refreshFn,
30971
+ resolveConfig
30972
+ } = inputs;
30973
+ const expirationThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
30974
+ let fresh;
30975
+ try {
30976
+ fresh = await loadEnvFile({ envPath: absolutePath });
30977
+ } catch (error) {
30978
+ return {
30979
+ kind: "fail",
30980
+ status: {
30981
+ loginStatus: "Refresh Failed",
30982
+ hint: "Could not read the auth file while refreshing. Retry, or run 'uip login' to re-authenticate.",
30983
+ tokenRefresh: {
30984
+ attempted: false,
30985
+ success: false,
30986
+ errorMessage: `auth file read failed: ${errorMessage(error)}`
30987
+ }
30988
+ }
30989
+ };
29900
30990
  }
29901
- const { envFilePath = DEFAULT_ENV_FILENAME, ensureTokenValidityMinutes } = options;
30991
+ const freshAccess = fresh.UIPATH_ACCESS_TOKEN;
30992
+ const freshExp = freshAccess ? getTokenExpiration(freshAccess) : undefined;
30993
+ if (freshAccess && freshExp && freshExp > expirationThreshold) {
30994
+ return {
30995
+ kind: "ok",
30996
+ accessToken: freshAccess,
30997
+ refreshToken: fresh.UIPATH_REFRESH_TOKEN ?? callerRefreshToken,
30998
+ expiration: freshExp,
30999
+ tokenRefresh: { attempted: false, success: true }
31000
+ };
31001
+ }
31002
+ const tokenForIdP = fresh.UIPATH_REFRESH_TOKEN ?? callerRefreshToken;
31003
+ let refreshedAccess;
31004
+ let refreshedRefresh;
31005
+ try {
31006
+ const config = await resolveConfig({ customAuthority });
31007
+ const refreshed = await refreshFn({
31008
+ refreshToken: tokenForIdP,
31009
+ tokenEndpoint: config.tokenEndpoint,
31010
+ clientId: config.clientId,
31011
+ expectedAuthority: customAuthority
31012
+ });
31013
+ refreshedAccess = refreshed.accessToken;
31014
+ refreshedRefresh = refreshed.refreshToken;
31015
+ } catch (error) {
31016
+ const isOAuthFailure = isTokenRefreshOAuthFailure(error);
31017
+ const hint = isOAuthFailure ? "Run 'uip login' to re-authenticate — the stored refresh token is invalid or expired." : "Token refresh failed. Check your network connection, then retry or run 'uip login' to re-authenticate.";
31018
+ const message = isOAuthFailure ? normalizeTokenRefreshFailure() : normalizeTokenRefreshUnavailableFailure();
31019
+ return {
31020
+ kind: "fail",
31021
+ status: {
31022
+ loginStatus: "Refresh Failed",
31023
+ hint,
31024
+ tokenRefresh: {
31025
+ attempted: true,
31026
+ success: false,
31027
+ errorMessage: message
31028
+ }
31029
+ }
31030
+ };
31031
+ }
31032
+ const refreshedExp = getTokenExpiration(refreshedAccess);
31033
+ if (!refreshedExp || refreshedExp <= new Date) {
31034
+ return {
31035
+ kind: "fail",
31036
+ status: {
31037
+ loginStatus: "Refresh Failed",
31038
+ hint: "The identity server returned an unusable token. Run 'uip login' to re-authenticate.",
31039
+ tokenRefresh: {
31040
+ attempted: true,
31041
+ success: false,
31042
+ errorMessage: "refreshed token has no valid expiration claim"
31043
+ }
31044
+ }
31045
+ };
31046
+ }
31047
+ try {
31048
+ await saveEnvFile({
31049
+ envPath: absolutePath,
31050
+ data: {
31051
+ UIPATH_ACCESS_TOKEN: refreshedAccess,
31052
+ UIPATH_REFRESH_TOKEN: refreshedRefresh
31053
+ },
31054
+ merge: true
31055
+ });
31056
+ return {
31057
+ kind: "ok",
31058
+ accessToken: refreshedAccess,
31059
+ refreshToken: refreshedRefresh,
31060
+ expiration: refreshedExp,
31061
+ tokenRefresh: { attempted: true, success: true }
31062
+ };
31063
+ } catch (error) {
31064
+ const msg = errorMessage(error);
31065
+ return {
31066
+ kind: "ok",
31067
+ accessToken: refreshedAccess,
31068
+ refreshToken: refreshedRefresh,
31069
+ expiration: refreshedExp,
31070
+ persistenceWarning: `Access token refreshed in memory but could not be written to ${absolutePath}: ${msg}. The next CLI invocation will fail until the file can be updated — run 'uip login' to re-authenticate.`,
31071
+ tokenRefresh: {
31072
+ attempted: true,
31073
+ success: true,
31074
+ errorMessage: `persistence failed: ${msg}`
31075
+ }
31076
+ };
31077
+ }
31078
+ }
31079
+ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
29902
31080
  const {
29903
31081
  resolveEnvFilePath = resolveEnvFilePathAsync,
29904
31082
  loadEnvFile = loadEnvFileAsync,
@@ -29908,6 +31086,34 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
29908
31086
  resolveConfig = resolveConfigAsync,
29909
31087
  robotFallback = tryRobotClientFallback
29910
31088
  } = deps;
31089
+ if (isRobotAuthEnforced()) {
31090
+ if (isEnvAuthEnabled()) {
31091
+ throw new EnvAuthConfigError(`${ENV_AUTH_ENABLE_VAR}=true and ${ENFORCE_ROBOT_AUTH_VAR}=true ` + `are mutually exclusive. Unset one of them and re-run.`);
31092
+ }
31093
+ const robotCreds = await robotFallback({ force: true });
31094
+ if (!robotCreds) {
31095
+ return {
31096
+ loginStatus: "Not logged in",
31097
+ hint: `${ENFORCE_ROBOT_AUTH_VAR}=true but the UiPath Robot ` + `session is unavailable. Start and sign in to the Assistant, ` + `or unset ${ENFORCE_ROBOT_AUTH_VAR} to fall back to file or ` + `env-var authentication.`
31098
+ };
31099
+ }
31100
+ const expiration2 = getTokenExpiration(robotCreds.accessToken);
31101
+ return {
31102
+ loginStatus: "Logged in",
31103
+ accessToken: robotCreds.accessToken,
31104
+ baseUrl: robotCreds.baseUrl,
31105
+ organizationName: robotCreds.organizationName,
31106
+ organizationId: robotCreds.organizationId,
31107
+ tenantName: robotCreds.tenantName,
31108
+ tenantId: robotCreds.tenantId,
31109
+ expiration: expiration2,
31110
+ source: "robot" /* Robot */
31111
+ };
31112
+ }
31113
+ if (isEnvAuthEnabled()) {
31114
+ return readAuthFromEnv();
31115
+ }
31116
+ const { envFilePath = DEFAULT_ENV_FILENAME, ensureTokenValidityMinutes } = options;
29911
31117
  const { absolutePath } = await resolveEnvFilePath(envFilePath);
29912
31118
  if (absolutePath === undefined) {
29913
31119
  const robotCreds = await robotFallback();
@@ -29944,73 +31150,103 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
29944
31150
  let refreshToken = credentials.UIPATH_REFRESH_TOKEN;
29945
31151
  let expiration = getTokenExpiration(accessToken);
29946
31152
  let persistenceWarning;
31153
+ let lockReleaseFailed = false;
29947
31154
  let tokenRefresh;
29948
- const expirationThreshold = new Date(Date.now() + (ensureTokenValidityMinutes ?? 0) * 60 * 1000);
29949
- if (expiration && expiration <= expirationThreshold && refreshToken) {
29950
- let refreshedAccess;
29951
- let refreshedRefresh;
31155
+ const outerThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
31156
+ const tryGlobalCredsHint = async () => {
31157
+ const fs7 = getFs();
31158
+ const globalPath = fs7.path.join(fs7.env.homedir(), envFilePath);
31159
+ if (absolutePath === globalPath)
31160
+ return;
31161
+ if (!await fs7.exists(globalPath))
31162
+ return;
29952
31163
  try {
29953
- const config = await resolveConfig({
29954
- customAuthority: credentials.UIPATH_URL
29955
- });
29956
- const refreshed = await refreshTokenFn({
29957
- refreshToken,
29958
- tokenEndpoint: config.tokenEndpoint,
29959
- clientId: config.clientId,
29960
- expectedAuthority: credentials.UIPATH_URL
29961
- });
29962
- refreshedAccess = refreshed.accessToken;
29963
- refreshedRefresh = refreshed.refreshToken;
29964
- } catch (error) {
29965
- const isOAuthFailure = isTokenRefreshOAuthFailure(error);
29966
- const hint = isOAuthFailure ? "Run 'uip login' to re-authenticate — the stored refresh token is invalid or expired." : "Token refresh failed. Check your network connection, then retry or run 'uip login' to re-authenticate.";
29967
- const errorMessage = isOAuthFailure ? normalizeTokenRefreshFailure() : normalizeTokenRefreshUnavailableFailure();
29968
- return {
29969
- loginStatus: "Refresh Failed",
29970
- hint,
29971
- tokenRefresh: {
29972
- attempted: true,
29973
- success: false,
29974
- errorMessage
29975
- }
29976
- };
31164
+ const globalCreds = await loadEnvFile({ envPath: globalPath });
31165
+ if (!globalCreds.UIPATH_ACCESS_TOKEN)
31166
+ return;
31167
+ const globalExp = getTokenExpiration(globalCreds.UIPATH_ACCESS_TOKEN);
31168
+ if (globalExp && globalExp <= new Date)
31169
+ return;
31170
+ return `Local credentials file at ${absolutePath} has expired credentials. Valid credentials exist in ${globalPath}. Remove the local file or run 'uip login' to re-authenticate.`;
31171
+ } catch {
31172
+ return;
29977
31173
  }
29978
- const refreshedExp = getTokenExpiration(refreshedAccess);
29979
- if (!refreshedExp || refreshedExp <= new Date) {
31174
+ };
31175
+ if (expiration && expiration <= outerThreshold && refreshToken) {
31176
+ let release;
31177
+ try {
31178
+ release = await getFs().acquireLock(absolutePath);
31179
+ } catch (error) {
31180
+ const msg = errorMessage(error);
31181
+ const globalHint = await tryGlobalCredsHint();
31182
+ if (globalHint) {
31183
+ return {
31184
+ loginStatus: "Expired",
31185
+ accessToken,
31186
+ refreshToken,
31187
+ baseUrl: credentials.UIPATH_URL,
31188
+ organizationName: credentials.UIPATH_ORGANIZATION_NAME,
31189
+ organizationId: credentials.UIPATH_ORGANIZATION_ID,
31190
+ tenantName: credentials.UIPATH_TENANT_NAME,
31191
+ tenantId: credentials.UIPATH_TENANT_ID,
31192
+ expiration,
31193
+ source: "file" /* File */,
31194
+ hint: globalHint,
31195
+ tokenRefresh: {
31196
+ attempted: false,
31197
+ success: false,
31198
+ errorMessage: `lock acquisition failed: ${msg}`
31199
+ }
31200
+ };
31201
+ }
29980
31202
  return {
29981
31203
  loginStatus: "Refresh Failed",
29982
- hint: "The identity server returned an unusable token. Run 'uip login' to re-authenticate.",
31204
+ hint: "Could not acquire the auth-file lock — too many concurrent `uip` processes, or a permission issue on the auth directory. Retry, or run 'uip login' to re-authenticate.",
29983
31205
  tokenRefresh: {
29984
- attempted: true,
31206
+ attempted: false,
29985
31207
  success: false,
29986
- errorMessage: "refreshed token has no valid expiration claim"
31208
+ errorMessage: `lock acquisition failed: ${msg}`
29987
31209
  }
29988
31210
  };
29989
31211
  }
29990
- accessToken = refreshedAccess;
29991
- refreshToken = refreshedRefresh;
29992
- expiration = refreshedExp;
31212
+ let lockedFailure;
29993
31213
  try {
29994
- await saveEnvFile({
29995
- envPath: absolutePath,
29996
- data: {
29997
- UIPATH_ACCESS_TOKEN: accessToken,
29998
- UIPATH_REFRESH_TOKEN: refreshToken
29999
- },
30000
- merge: true
31214
+ const outcome = await runRefreshLocked({
31215
+ absolutePath,
31216
+ refreshToken,
31217
+ customAuthority: credentials.UIPATH_URL,
31218
+ ensureTokenValidityMinutes,
31219
+ loadEnvFile,
31220
+ saveEnvFile,
31221
+ refreshFn: refreshTokenFn,
31222
+ resolveConfig
30001
31223
  });
30002
- tokenRefresh = {
30003
- attempted: true,
30004
- success: true
30005
- };
30006
- } catch (error) {
30007
- const msg = error instanceof Error ? error.message : String(error);
30008
- persistenceWarning = `Access token refreshed in memory but could not be written to ${absolutePath}: ${msg}. The next CLI invocation will fail until the file can be updated — run 'uip login' to re-authenticate.`;
30009
- tokenRefresh = {
30010
- attempted: true,
30011
- success: true,
30012
- errorMessage: `persistence failed: ${msg}`
30013
- };
31224
+ if (outcome.kind === "fail") {
31225
+ lockedFailure = outcome.status;
31226
+ } else {
31227
+ accessToken = outcome.accessToken;
31228
+ refreshToken = outcome.refreshToken;
31229
+ expiration = outcome.expiration;
31230
+ tokenRefresh = outcome.tokenRefresh;
31231
+ if (outcome.persistenceWarning) {
31232
+ persistenceWarning = outcome.persistenceWarning;
31233
+ }
31234
+ }
31235
+ } finally {
31236
+ try {
31237
+ await release();
31238
+ } catch {
31239
+ lockReleaseFailed = true;
31240
+ }
31241
+ }
31242
+ if (lockedFailure) {
31243
+ const globalHint = await tryGlobalCredsHint();
31244
+ const base = globalHint ? {
31245
+ ...lockedFailure,
31246
+ loginStatus: "Expired",
31247
+ hint: globalHint
31248
+ } : lockedFailure;
31249
+ return lockReleaseFailed ? { ...base, lockReleaseFailed: true } : base;
30014
31250
  }
30015
31251
  }
30016
31252
  const result = {
@@ -30025,23 +31261,13 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
30025
31261
  expiration,
30026
31262
  source: "file" /* File */,
30027
31263
  ...persistenceWarning ? { hint: persistenceWarning, persistenceFailed: true } : {},
31264
+ ...lockReleaseFailed ? { lockReleaseFailed: true } : {},
30028
31265
  ...tokenRefresh ? { tokenRefresh } : {}
30029
31266
  };
30030
31267
  if (result.loginStatus === "Expired") {
30031
- const fs7 = getFs();
30032
- const globalPath = fs7.path.join(fs7.env.homedir(), envFilePath);
30033
- if (absolutePath !== globalPath && await fs7.exists(globalPath)) {
30034
- try {
30035
- const globalCreds = await loadEnvFile({
30036
- envPath: globalPath
30037
- });
30038
- if (globalCreds.UIPATH_ACCESS_TOKEN) {
30039
- const globalExp = getTokenExpiration(globalCreds.UIPATH_ACCESS_TOKEN);
30040
- if (!globalExp || globalExp > new Date) {
30041
- result.hint = `Local credentials file at ${absolutePath} has expired credentials. Valid credentials exist in ${globalPath}. Remove the local file or run 'uip login' to re-authenticate.`;
30042
- }
30043
- }
30044
- } catch {}
31268
+ const globalHint = await tryGlobalCredsHint();
31269
+ if (globalHint) {
31270
+ result.hint = globalHint;
30045
31271
  }
30046
31272
  }
30047
31273
  return result;
@@ -30058,6 +31284,10 @@ var getLoginStatusAsync = async (options = {}) => {
30058
31284
  init_src();
30059
31285
  // ../../auth/src/logout.ts
30060
31286
  init_src();
31287
+
31288
+ // ../../auth/src/index.ts
31289
+ init_server();
31290
+
30061
31291
  // ../resourcecatalog-sdk/src/client-factory.ts
30062
31292
  async function resolveConfig(options) {
30063
31293
  const status = await getLoginStatusAsync({
@@ -30071,14 +31301,15 @@ async function resolveConfig(options) {
30071
31301
  }
30072
31302
  const tenant = options?.tenantName ?? status.tenantName;
30073
31303
  if (!tenant) {
30074
- throw new Error("Tenant not available. Pass --tenant <name> or log in with a tenant context.");
31304
+ throw new Error("Tenant not available. Run 'uip login' to select a tenant, or use 'uip login tenant set <tenant>' to switch tenants.");
30075
31305
  }
30076
31306
  const basePath = `${status.baseUrl}/${status.organizationId}/${tenant}/resourcecatalog_`;
30077
31307
  const bearerToken = options?.s2sToken ?? status.accessToken;
30078
31308
  return {
30079
31309
  config: new Configuration({
30080
31310
  basePath,
30081
- accessToken: async () => bearerToken
31311
+ accessToken: async () => bearerToken,
31312
+ headers: addSdkUserAgentHeader(undefined, SDK_USER_AGENT)
30082
31313
  }),
30083
31314
  organizationId: status.organizationId,
30084
31315
  tenantName: tenant
@@ -30092,8 +31323,112 @@ async function createApiClient(ApiClass, options) {
30092
31323
  tenantName
30093
31324
  };
30094
31325
  }
31326
+ // src/commands/search.ts
31327
+ var LOGIN_INSTRUCTIONS = "Ensure you are logged in with 'uip login' and have access to the Resource Catalog service.";
31328
+ var SEARCH_EXAMPLES = [
31329
+ {
31330
+ Description: "Search RCS Process entities by entitySubType (matches the Orchestrator UI Add-Tool picker)",
31331
+ Command: "uip admin rcs search --entity-type Process --entity-sub-type ProcessOrchestration --limit 8",
31332
+ Output: {
31333
+ Code: "RcsSearch",
31334
+ Data: {
31335
+ items: [
31336
+ {
31337
+ entityKey: "entity-guid",
31338
+ name: "Sample Orchestrator",
31339
+ entityType: "Process",
31340
+ entitySubType: "ProcessOrchestration"
31341
+ }
31342
+ ],
31343
+ count: 1
31344
+ }
31345
+ }
31346
+ },
31347
+ {
31348
+ Description: "Search across one folder by key",
31349
+ Command: "uip admin rcs search --entity-type Process --folder-key 11111111-1111-1111-1111-111111111111",
31350
+ Output: {
31351
+ Code: "RcsSearch",
31352
+ Data: { items: [], count: 0 }
31353
+ }
31354
+ }
31355
+ ];
31356
+ var registerSearchCommands = (rcs) => {
31357
+ rcs.command("search").description([
31358
+ "Search Resource Catalog entities (RCS GET /Entities/Search).",
31359
+ "",
31360
+ "Filters: --entity-type, --entity-sub-type (each repeatable),",
31361
+ "--name (substring on entity name), --folder-key/--folder-path",
31362
+ "(sent as X-UIPATH-FolderKey/X-UIPATH-FolderPath headers).",
31363
+ "",
31364
+ "Returns the standard paging envelope {items, total, count, next}."
31365
+ ].join(`
31366
+ `)).addOption(createHiddenDeprecatedTenantOption("--tenant <name>")).option("--entity-type <value>", "RCS entityTypes filter entry. Repeat to pass multiple values (e.g. --entity-type Process).", (value, previous = []) => [...previous, value]).option("--entity-sub-type <value>", "RCS entitySubType filter entry. Repeat to pass multiple values (e.g. --entity-sub-type ProcessOrchestration).", (value, previous = []) => [...previous, value]).option("--name <text>", "Substring filter on entity name (RCS `name` query param).").option("--folder-key <guid>", "Folder GUID to scope the call (sets X-UIPATH-FolderKey).").option("--folder-path <path>", "Folder path to scope the call (sets X-UIPATH-FolderPath).").option("--limit <n>", `Page size. Maps to RCS take. Defaults to ${DEFAULT_PAGE_SIZE}.`, (v) => Number.parseInt(v, 10)).option("--offset <n>", "Row offset. Maps to RCS skip. Defaults to 0.", (v) => Number.parseInt(v, 10)).addOption(new Option("--skip <n>").hideHelp().argParser((v) => Number.parseInt(v, 10))).option("--login-validity <minutes>", "Override the interactive-login token lifetime for this call. Rarely needed.", (v) => Number.parseInt(v, 10)).examples(SEARCH_EXAMPLES).trackedAction(processContext, async (options) => {
31367
+ const offset = resolveDeprecatedOptionAlias({
31368
+ preferredValue: options.offset,
31369
+ deprecatedValue: options.skip,
31370
+ preferredFlag: "--offset",
31371
+ deprecatedFlag: "--skip"
31372
+ });
31373
+ if (offset.error) {
31374
+ OutputFormatter.error({
31375
+ Result: RESULTS.Failure,
31376
+ Message: offset.error.message,
31377
+ Instructions: offset.error.instructions
31378
+ });
31379
+ processContext.exit(1);
31380
+ return;
31381
+ }
31382
+ if (offset.usedDeprecated) {
31383
+ warnDeprecatedOptionAlias("--skip", "--offset");
31384
+ }
31385
+ const resolvedOffset = offset.value ?? 0;
31386
+ const resolvedLimit = options.limit ?? DEFAULT_PAGE_SIZE;
31387
+ const [error, result] = await catchError((async () => {
31388
+ const { api, organizationId } = await createApiClient(EntitiesApi, {
31389
+ loginValidity: options.loginValidity,
31390
+ tenantName: options.tenant
31391
+ });
31392
+ return await api.entitiesSearch({
31393
+ xUiPathInternalAccountId: organizationId,
31394
+ name: options.name,
31395
+ skip: resolvedOffset,
31396
+ take: resolvedLimit,
31397
+ entityTypes: options.entityType,
31398
+ entitySubType: options.entitySubType,
31399
+ xUIPATHFolderKey: options.folderKey,
31400
+ xUIPATHFolderPath: options.folderPath
31401
+ });
31402
+ })());
31403
+ if (error) {
31404
+ OutputFormatter.error({
31405
+ Result: RESULTS.Failure,
31406
+ Message: await extractErrorMessage(error),
31407
+ Instructions: LOGIN_INSTRUCTIONS
31408
+ });
31409
+ processContext.exit(1);
31410
+ return;
31411
+ }
31412
+ const items = result?.value ?? [];
31413
+ const total = result?.count;
31414
+ const count = items.length;
31415
+ const nextSkip = resolvedOffset + count;
31416
+ const next = typeof total === "number" && nextSkip < total ? { skip: nextSkip, take: resolvedLimit } : undefined;
31417
+ OutputFormatter.success({
31418
+ Result: RESULTS.Success,
31419
+ Code: "RcsSearch",
31420
+ Data: {
31421
+ items,
31422
+ total,
31423
+ count,
31424
+ ...next ? { next } : {}
31425
+ }
31426
+ });
31427
+ });
31428
+ };
31429
+
30095
31430
  // src/commands/tag.ts
30096
- var LOGIN_INSTRUCTIONS = "Ensure you are logged in with 'uip login' and have access to the Resource Catalog service. If you see 'Invalid scope(s)', re-run 'uip login' to pick up the RCS.Tags scope.";
31431
+ var LOGIN_INSTRUCTIONS2 = "Ensure you are logged in with 'uip login' and have access to the Resource Catalog service. If you see 'Invalid scope(s)', re-run 'uip login' to pick up the RCS.Tags scope.";
30097
31432
  var LIST_EXAMPLES = [
30098
31433
  {
30099
31434
  Description: "List all Label tags for the current tenant",
@@ -30135,11 +31470,29 @@ var registerTagCommands = (rcs) => {
30135
31470
  "List tags for a tenant in the current organization.",
30136
31471
  "",
30137
31472
  "By default returns TagType.Label tags for the tenant in your login context.",
30138
- "Pass --tenant <name> to target a different tenant in the same organization",
31473
+ "Use 'uip login tenant set <tenant>' to target a different tenant in the same organization",
30139
31474
  "(your account must have RCS access to that tenant). Use --type KeyValue",
30140
31475
  "for key/value tags, or --starts-with to filter by name prefix."
30141
31476
  ].join(`
30142
- `)).option("--tenant <name>", "Target tenant name. Defaults to the tenant in your login context.").option("--type <type>", "Tag type to list: 'Label' (default) or 'KeyValue'. Case-sensitive.", "Label").option("--starts-with <prefix>", "Return only tags whose normalized name starts with this prefix (case-insensitive).").option("--limit <n>", "Page size — how many tags to return in one call. Defaults to 100.", (v) => Number.parseInt(v, 10), 100).option("--skip <n>", "Row offset into the result set. Defaults to 0.", (v) => Number.parseInt(v, 10), 0).option("--login-validity <minutes>", "Override the interactive-login token lifetime for this call. Rarely needed.", (v) => Number.parseInt(v, 10)).examples(LIST_EXAMPLES).trackedAction(processContext, async (options) => {
31477
+ `)).addOption(createHiddenDeprecatedTenantOption("--tenant <name>")).option("--type <type>", "Tag type to list: 'Label' (default) or 'KeyValue'. Case-sensitive.", "Label").option("--starts-with <prefix>", "Return only tags whose normalized name starts with this prefix (case-insensitive).").option("--limit <n>", "Page size — how many tags to return in one call. Defaults to 100.", (v) => Number.parseInt(v, 10), 100).option("--offset <n>", "Row offset into the result set. Defaults to 0.", (v) => Number.parseInt(v, 10)).addOption(new Option("--skip <n>").hideHelp().argParser((v) => Number.parseInt(v, 10))).option("--login-validity <minutes>", "Override the interactive-login token lifetime for this call. Rarely needed.", (v) => Number.parseInt(v, 10)).examples(LIST_EXAMPLES).trackedAction(processContext, async (options) => {
31478
+ const offset = resolveDeprecatedOptionAlias({
31479
+ preferredValue: options.offset,
31480
+ deprecatedValue: options.skip,
31481
+ preferredFlag: "--offset",
31482
+ deprecatedFlag: "--skip"
31483
+ });
31484
+ if (offset.error) {
31485
+ OutputFormatter.error({
31486
+ Result: RESULTS.Failure,
31487
+ Message: offset.error.message,
31488
+ Instructions: offset.error.instructions
31489
+ });
31490
+ processContext.exit(1);
31491
+ return;
31492
+ }
31493
+ if (offset.usedDeprecated) {
31494
+ warnDeprecatedOptionAlias("--skip", "--offset");
31495
+ }
30143
31496
  const [error, result] = await catchError((async () => {
30144
31497
  if (options.type !== TagType.Label && options.type !== TagType.KeyValue) {
30145
31498
  throw new Error(`Invalid --type '${options.type}'. Use 'Label' or 'KeyValue'.`);
@@ -30153,14 +31506,14 @@ var registerTagCommands = (rcs) => {
30153
31506
  type: options.type,
30154
31507
  startsWith: options.startsWith,
30155
31508
  take: options.limit,
30156
- skip: options.skip
31509
+ skip: offset.value ?? 0
30157
31510
  });
30158
31511
  })());
30159
31512
  if (error) {
30160
31513
  OutputFormatter.error({
30161
31514
  Result: RESULTS.Failure,
30162
31515
  Message: await extractErrorMessage(error),
30163
- Instructions: LOGIN_INSTRUCTIONS
31516
+ Instructions: LOGIN_INSTRUCTIONS2
30164
31517
  });
30165
31518
  processContext.exit(1);
30166
31519
  return;
@@ -30179,9 +31532,11 @@ var registerRcsCommand = (program2) => {
30179
31532
  "Manage UiPath Resource Catalog Service resources.",
30180
31533
  "",
30181
31534
  "Subcommand groups:",
31535
+ " search — search tenant- or folder-scoped RCS entities.",
30182
31536
  " tag — list tenant-scoped tags."
30183
31537
  ].join(`
30184
31538
  `));
31539
+ registerSearchCommands(rcs);
30185
31540
  registerTagCommands(rcs);
30186
31541
  };
30187
31542