@uipath/integrationservice-sdk 0.1.5 → 0.1.7

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/README.md +233 -233
  2. package/dist/index.js +530 -889
  3. package/package.json +36 -43
package/dist/index.js CHANGED
@@ -4,25 +4,43 @@ var __getProtoOf = Object.getPrototypeOf;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
7
12
  var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
8
20
  target = mod != null ? __create(__getProtoOf(mod)) : {};
9
21
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
22
  for (let key of __getOwnPropNames(mod))
11
23
  if (!__hasOwnProp.call(to, key))
12
24
  __defProp(to, key, {
13
- get: () => mod[key],
25
+ get: __accessProp.bind(mod, key),
14
26
  enumerable: true
15
27
  });
28
+ if (canCache)
29
+ cache.set(mod, to);
16
30
  return to;
17
31
  };
18
32
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
33
+ var __returnValue = (v) => v;
34
+ function __exportSetter(name, newValue) {
35
+ this[name] = __returnValue.bind(null, newValue);
36
+ }
19
37
  var __export = (target, all) => {
20
38
  for (var name in all)
21
39
  __defProp(target, name, {
22
40
  get: all[name],
23
41
  enumerable: true,
24
42
  configurable: true,
25
- set: (newValue) => all[name] = () => newValue
43
+ set: __exportSetter.bind(all, name)
26
44
  });
27
45
  };
28
46
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
@@ -38,6 +56,12 @@ function catchError(fnOrPromise) {
38
56
  }
39
57
  try {
40
58
  const result = fnOrPromise();
59
+ if (result instanceof Promise) {
60
+ return result.then((data) => [undefined, data]).catch((error) => [
61
+ error instanceof Error ? error : new Error(String(error)),
62
+ undefined
63
+ ]);
64
+ }
41
65
  return [undefined, result];
42
66
  } catch (error) {
43
67
  return [
@@ -6692,33 +6716,60 @@ var init_js_yaml = __esm(() => {
6692
6716
  safeDump = renamed("safeDump", "dump");
6693
6717
  });
6694
6718
 
6695
- // ../common/src/output-context.ts
6696
- function getSharedStorage() {
6697
- const g = globalThis;
6698
- if (!g[STORAGE_KEY]) {
6699
- try {
6700
- const { AsyncLocalStorage } = __require("node:async_hooks");
6701
- g[STORAGE_KEY] = new AsyncLocalStorage;
6702
- } catch {
6703
- g[STORAGE_KEY] = {
6704
- getStore: () => {
6705
- return;
6706
- },
6707
- run: (_store, fn) => fn()
6708
- };
6719
+ // ../common/src/singleton.ts
6720
+ function singleton(ctorOrName) {
6721
+ const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
6722
+ const key = Symbol.for(PREFIX + name);
6723
+ return {
6724
+ get(fallback) {
6725
+ return _g[key] ?? fallback;
6726
+ },
6727
+ set(value) {
6728
+ _g[key] = value;
6729
+ },
6730
+ clear() {
6731
+ delete _g[key];
6732
+ },
6733
+ getOrInit(factory, guard) {
6734
+ const existing = _g[key];
6735
+ if (existing != null && typeof existing === "object") {
6736
+ if (!guard || guard(existing)) {
6737
+ return existing;
6738
+ }
6739
+ }
6740
+ const instance = factory();
6741
+ _g[key] = instance;
6742
+ return instance;
6709
6743
  }
6744
+ };
6745
+ }
6746
+ var PREFIX = "@uipath/common/", _g;
6747
+ var init_singleton = __esm(() => {
6748
+ _g = globalThis;
6749
+ });
6750
+
6751
+ // ../common/src/output-context.ts
6752
+ function createStorage() {
6753
+ const [error, mod2] = catchError(() => __require("node:async_hooks"));
6754
+ if (error) {
6755
+ return {
6756
+ getStore: () => {
6757
+ return;
6758
+ },
6759
+ run: (_store, fn) => fn()
6760
+ };
6710
6761
  }
6711
- return g[STORAGE_KEY];
6762
+ return new mod2.AsyncLocalStorage;
6712
6763
  }
6713
6764
  function getOutputSink() {
6714
- const g = globalThis;
6715
- return outputStorage.getStore() ?? g[GLOBAL_SINK_KEY] ?? CONSOLE_FALLBACK;
6765
+ return outputStorage.getStore() ?? sinkSlot.get() ?? CONSOLE_FALLBACK;
6716
6766
  }
6717
- var STORAGE_KEY, GLOBAL_SINK_KEY, outputStorage, CONSOLE_FALLBACK;
6767
+ var storageSingleton, sinkSlot, outputStorage, CONSOLE_FALLBACK;
6718
6768
  var init_output_context = __esm(() => {
6719
- STORAGE_KEY = Symbol.for("@uipath/common/output-storage");
6720
- GLOBAL_SINK_KEY = Symbol.for("@uipath/common/global-sink");
6721
- outputStorage = getSharedStorage();
6769
+ init_singleton();
6770
+ storageSingleton = singleton("OutputStorage");
6771
+ sinkSlot = singleton("OutputSink");
6772
+ outputStorage = storageSingleton.getOrInit(createStorage, (v) => ("getStore" in v));
6722
6773
  CONSOLE_FALLBACK = {
6723
6774
  writeOut: (str2) => process.stdout.write(str2),
6724
6775
  writeErr: (str2) => process.stderr.write(str2),
@@ -6735,237 +6786,218 @@ var init_output_context = __esm(() => {
6735
6786
  import { appendFileSync, mkdirSync, writeFileSync } from "node:fs";
6736
6787
  import { dirname } from "node:path";
6737
6788
  function setGlobalLogFilePath(path) {
6738
- globalThis[GLOBAL_KEY] = path;
6789
+ logFilePathSlot.set(path);
6739
6790
  }
6740
6791
  function getGlobalLogFilePath() {
6741
- return globalThis[GLOBAL_KEY] ?? "";
6792
+ return logFilePathSlot.get("");
6742
6793
  }
6743
-
6744
- class SimpleLogger {
6745
- static instance;
6746
- level;
6747
- logFilePath;
6748
- fileLoggingEnabled;
6749
- constructor() {
6750
- this.level = SimpleLogger.resolveLevel();
6751
- this.logFilePath = "";
6752
- this.fileLoggingEnabled = false;
6753
- }
6754
- static getInstance() {
6755
- if (!SimpleLogger.instance) {
6756
- SimpleLogger.instance = new SimpleLogger;
6794
+ function getLogFilePath() {
6795
+ return logger.getLogFilePath();
6796
+ }
6797
+ var logFilePathSlot, DEFAULT_LOG_LEVEL = 3 /* ERROR */, SimpleLogger, loggerSingleton, logger;
6798
+ var init_logger = __esm(() => {
6799
+ init_output_context();
6800
+ init_singleton();
6801
+ logFilePathSlot = singleton("logFilePath");
6802
+ SimpleLogger = class SimpleLogger {
6803
+ __brand = "SimpleLogger";
6804
+ level;
6805
+ logFilePath;
6806
+ fileLoggingEnabled;
6807
+ constructor() {
6808
+ this.level = SimpleLogger.resolveLevel();
6809
+ this.logFilePath = "";
6810
+ this.fileLoggingEnabled = false;
6757
6811
  }
6758
- return SimpleLogger.instance;
6759
- }
6760
- static resetInstance() {
6761
- SimpleLogger.instance = undefined;
6762
- }
6763
- static resolveLevel() {
6764
- if (typeof process !== "undefined" && process.env?.UIPCLI_LOG_LEVEL) {
6765
- const parsed = SimpleLogger.parseLevel(process.env.UIPCLI_LOG_LEVEL);
6766
- if (parsed !== undefined)
6767
- return parsed;
6812
+ static getInstance() {
6813
+ return loggerSingleton.getOrInit(() => new SimpleLogger, (v) => ("__brand" in v) && v.__brand === "SimpleLogger");
6768
6814
  }
6769
- if (typeof process !== "undefined" && process.env?.DEBUG) {
6770
- return 0 /* DEBUG */;
6815
+ static resetInstance() {
6816
+ loggerSingleton.clear();
6771
6817
  }
6772
- try {
6773
- if (typeof localStorage !== "undefined" && localStorage.getItem("debug")) {
6774
- return 0 /* DEBUG */;
6818
+ static isNode = typeof process !== "undefined" && !!process.versions?.node;
6819
+ static resolveLevel() {
6820
+ if (SimpleLogger.isNode) {
6821
+ const explicitLevel = SimpleLogger.parseLevel(process.env?.UIPCLI_LOG_LEVEL ?? "");
6822
+ if (explicitLevel !== undefined)
6823
+ return explicitLevel;
6824
+ const debugVal = process.env?.DEBUG;
6825
+ if (debugVal === "true" || debugVal === "1") {
6826
+ return 0 /* DEBUG */;
6827
+ }
6828
+ return DEFAULT_LOG_LEVEL;
6775
6829
  }
6776
- } catch {}
6777
- return 3 /* ERROR */;
6778
- }
6779
- static parseLevel(value) {
6780
- switch (value.toLowerCase()) {
6781
- case "debug":
6830
+ const [localStorageError, hasDebug] = catchError(() => typeof localStorage !== "undefined" && !!localStorage.getItem("debug"));
6831
+ if (!localStorageError && hasDebug) {
6782
6832
  return 0 /* DEBUG */;
6783
- case "info":
6784
- return 1 /* INFO */;
6785
- case "warn":
6786
- return 2 /* WARN */;
6787
- case "error":
6788
- return 3 /* ERROR */;
6789
- default:
6790
- return;
6833
+ }
6834
+ return DEFAULT_LOG_LEVEL;
6835
+ }
6836
+ static parseLevel(value) {
6837
+ switch (value.toLowerCase()) {
6838
+ case "debug":
6839
+ return 0 /* DEBUG */;
6840
+ case "info":
6841
+ return 1 /* INFO */;
6842
+ case "warn":
6843
+ return 2 /* WARN */;
6844
+ case "error":
6845
+ return 3 /* ERROR */;
6846
+ default:
6847
+ return;
6848
+ }
6791
6849
  }
6792
- }
6793
- format(message, args) {
6794
- if (args.length === 0)
6795
- return `${message}
6850
+ format(message, args) {
6851
+ if (args.length === 0)
6852
+ return `${message}
6796
6853
  `;
6797
- return `${message} ${args.map(String).join(" ")}
6854
+ return `${message} ${args.map(String).join(" ")}
6798
6855
  `;
6799
- }
6800
- isFileLoggingActive() {
6801
- return this.fileLoggingEnabled || !!getGlobalLogFilePath();
6802
- }
6803
- writeToFile(formatted) {
6804
- const path = this.logFilePath || getGlobalLogFilePath();
6805
- if (!path)
6806
- return;
6807
- try {
6856
+ }
6857
+ isFileLoggingActive() {
6858
+ return this.fileLoggingEnabled || !!getGlobalLogFilePath();
6859
+ }
6860
+ writeToFile(formatted) {
6861
+ const path = this.logFilePath || getGlobalLogFilePath();
6862
+ if (!path)
6863
+ return;
6808
6864
  const timestamp2 = new Date().toISOString();
6809
- appendFileSync(path, `${timestamp2} ${formatted}`);
6810
- } catch {}
6811
- }
6812
- debug(message, ...args) {
6813
- if (this.level > 0 /* DEBUG */)
6814
- return;
6815
- const formatted = this.format(`[DEBUG] ${message}`, args);
6816
- if (this.isFileLoggingActive()) {
6817
- this.writeToFile(formatted);
6818
- } else {
6819
- getOutputSink().writeErr(formatted);
6865
+ catchError(() => appendFileSync(path, `${timestamp2} ${formatted}`));
6820
6866
  }
6821
- }
6822
- info(message, ...args) {
6823
- if (this.level > 1 /* INFO */)
6824
- return;
6825
- const formatted = this.format(message, args);
6826
- if (this.isFileLoggingActive()) {
6827
- this.writeToFile(formatted);
6828
- } else {
6829
- getOutputSink().writeErr(formatted);
6867
+ debug(message, ...args) {
6868
+ if (this.level > 0 /* DEBUG */)
6869
+ return;
6870
+ const formatted = this.format(`[DEBUG] ${message}`, args);
6871
+ if (this.isFileLoggingActive()) {
6872
+ this.writeToFile(formatted);
6873
+ } else {
6874
+ getOutputSink().writeErr(formatted);
6875
+ }
6830
6876
  }
6831
- }
6832
- warn(message, ...args) {
6833
- if (this.level > 2 /* WARN */)
6834
- return;
6835
- const formatted = this.format(`[WARN] ${message}`, args);
6836
- if (this.isFileLoggingActive()) {
6837
- this.writeToFile(formatted);
6838
- } else {
6839
- getOutputSink().writeErr(formatted);
6877
+ info(message, ...args) {
6878
+ if (this.level > 1 /* INFO */)
6879
+ return;
6880
+ const formatted = this.format(message, args);
6881
+ if (this.isFileLoggingActive()) {
6882
+ this.writeToFile(formatted);
6883
+ } else {
6884
+ getOutputSink().writeErr(formatted);
6885
+ }
6840
6886
  }
6841
- }
6842
- error(message, ...args) {
6843
- if (this.level > 3 /* ERROR */)
6844
- return;
6845
- const formatted = this.format(`[ERROR] ${message}`, args);
6846
- if (this.isFileLoggingActive()) {
6847
- this.writeToFile(formatted);
6848
- } else {
6849
- getOutputSink().writeErr(formatted);
6887
+ warn(message, ...args) {
6888
+ if (this.level > 2 /* WARN */)
6889
+ return;
6890
+ const formatted = this.format(`[WARN] ${message}`, args);
6891
+ if (this.isFileLoggingActive()) {
6892
+ this.writeToFile(formatted);
6893
+ } else {
6894
+ getOutputSink().writeErr(formatted);
6895
+ }
6850
6896
  }
6851
- }
6852
- getLevel() {
6853
- return this.level;
6854
- }
6855
- setLevel(level) {
6856
- this.level = level;
6857
- }
6858
- setFileLogging(enabled) {
6859
- this.fileLoggingEnabled = enabled;
6860
- if (!enabled) {
6861
- this.logFilePath = "";
6862
- setGlobalLogFilePath("");
6897
+ error(message, ...args) {
6898
+ if (this.level > 3 /* ERROR */)
6899
+ return;
6900
+ const formatted = this.format(`[ERROR] ${message}`, args);
6901
+ if (this.isFileLoggingActive()) {
6902
+ this.writeToFile(formatted);
6903
+ } else {
6904
+ getOutputSink().writeErr(formatted);
6905
+ }
6863
6906
  }
6864
- }
6865
- setLogFile(path) {
6866
- this.logFilePath = path;
6867
- setGlobalLogFilePath(path);
6868
- if (!path)
6869
- return;
6870
- try {
6871
- mkdirSync(dirname(path), { recursive: true });
6872
- writeFileSync(path, "");
6873
- this.fileLoggingEnabled = true;
6874
- } catch {
6875
- this.fileLoggingEnabled = false;
6907
+ getLevel() {
6908
+ return this.level;
6876
6909
  }
6877
- }
6878
- getLogFilePath() {
6879
- return this.logFilePath || getGlobalLogFilePath();
6880
- }
6881
- handleLog = (logMessage) => {
6882
- const parts = [];
6883
- if (logMessage.source) {
6884
- parts.push(`[${logMessage.source}]`);
6910
+ setLevel(level) {
6911
+ this.level = level;
6885
6912
  }
6886
- if (logMessage.sourceTarget) {
6887
- parts.push(`[${logMessage.sourceTarget}]`);
6913
+ setFileLogging(enabled) {
6914
+ this.fileLoggingEnabled = enabled;
6915
+ if (!enabled) {
6916
+ this.logFilePath = "";
6917
+ setGlobalLogFilePath("");
6918
+ }
6888
6919
  }
6889
- parts.push(logMessage.message);
6890
- const msg = parts.join(" ");
6891
- switch (logMessage.logLevel) {
6892
- case "Debug":
6893
- this.debug(msg);
6894
- break;
6895
- case "Warning":
6896
- this.warn(msg);
6897
- break;
6898
- case "Error":
6899
- this.error(msg);
6900
- break;
6901
- default:
6902
- this.info(msg);
6903
- break;
6920
+ setLogFile(path) {
6921
+ this.logFilePath = path;
6922
+ setGlobalLogFilePath(path);
6923
+ if (!path)
6924
+ return;
6925
+ const [error] = catchError(() => {
6926
+ mkdirSync(dirname(path), { recursive: true });
6927
+ writeFileSync(path, "");
6928
+ });
6929
+ this.fileLoggingEnabled = !error;
6904
6930
  }
6931
+ getLogFilePath() {
6932
+ return this.logFilePath || getGlobalLogFilePath();
6933
+ }
6934
+ handleLog = (logMessage) => {
6935
+ const parts = [];
6936
+ if (logMessage.source) {
6937
+ parts.push(`[${logMessage.source}]`);
6938
+ }
6939
+ if (logMessage.sourceTarget) {
6940
+ parts.push(`[${logMessage.sourceTarget}]`);
6941
+ }
6942
+ parts.push(logMessage.message);
6943
+ const msg = parts.join(" ");
6944
+ switch (logMessage.logLevel) {
6945
+ case "Debug":
6946
+ this.debug(msg);
6947
+ break;
6948
+ case "Warning":
6949
+ this.warn(msg);
6950
+ break;
6951
+ case "Error":
6952
+ this.error(msg);
6953
+ break;
6954
+ default:
6955
+ this.info(msg);
6956
+ break;
6957
+ }
6958
+ };
6905
6959
  };
6906
- }
6907
- function getLogFilePath() {
6908
- return logger.getLogFilePath();
6909
- }
6910
- var GLOBAL_KEY = "__uipcli_log_file_path__", logger;
6911
- var init_logger = __esm(() => {
6912
- init_output_context();
6960
+ loggerSingleton = singleton(SimpleLogger);
6913
6961
  logger = SimpleLogger.getInstance();
6914
6962
  });
6915
6963
 
6916
6964
  // ../common/src/output-format-context.ts
6917
6965
  function getOutputFormat() {
6918
- return globalThis[FORMAT_KEY] ?? "table";
6966
+ return formatSlot.get("table");
6919
6967
  }
6920
6968
  function getOutputFilter() {
6921
- return globalThis[FILTER_KEY];
6969
+ return filterSlot.get();
6922
6970
  }
6923
- var FORMAT_KEY, FILTER_KEY;
6971
+ var formatSlot, filterSlot;
6924
6972
  var init_output_format_context = __esm(() => {
6925
- FORMAT_KEY = Symbol.for("@uipath/common/output-format");
6926
- FILTER_KEY = Symbol.for("@uipath/common/output-filter");
6973
+ init_singleton();
6974
+ formatSlot = singleton("OutputFormat");
6975
+ filterSlot = singleton("OutputFilter");
6927
6976
  });
6928
-
6929
- // ../../node_modules/@uipath/telemetry/dist/node.js
6930
- import { AsyncLocalStorage } from "async_hooks";
6931
- function node_context_storage_define_property(obj, key, value) {
6932
- if (key in obj)
6933
- Object.defineProperty(obj, key, {
6934
- value,
6935
- enumerable: true,
6936
- configurable: true,
6937
- writable: true
6938
- });
6939
- else
6940
- obj[key] = value;
6941
- return obj;
6942
- }
6977
+ // ../telemetry/src/contextstorage/adapters/node-context-storage.ts
6978
+ import { AsyncLocalStorage } from "node:async_hooks";
6943
6979
 
6944
6980
  class NodeContextStorage {
6981
+ storage = new AsyncLocalStorage;
6945
6982
  run(context, fn) {
6946
6983
  return this.storage.run(context, fn);
6947
6984
  }
6948
6985
  getContext() {
6949
6986
  return this.storage.getStore();
6950
6987
  }
6951
- constructor() {
6952
- node_context_storage_define_property(this, "storage", new AsyncLocalStorage);
6953
- }
6954
- }
6955
- function telemetry_service_define_property(obj, key, value) {
6956
- if (key in obj)
6957
- Object.defineProperty(obj, key, {
6958
- value,
6959
- enumerable: true,
6960
- configurable: true,
6961
- writable: true
6962
- });
6963
- else
6964
- obj[key] = value;
6965
- return obj;
6966
6988
  }
6989
+ var init_node_context_storage = () => {};
6967
6990
 
6991
+ // ../telemetry/src/telemetry-service.ts
6968
6992
  class TelemetryService {
6993
+ telemetryProvider;
6994
+ contextStorage;
6995
+ operationId;
6996
+ defaultProperties;
6997
+ constructor(telemetryProvider, contextStorage) {
6998
+ this.telemetryProvider = telemetryProvider;
6999
+ this.contextStorage = contextStorage;
7000
+ }
6969
7001
  setOperationId(operationId) {
6970
7002
  this.operationId = operationId;
6971
7003
  }
@@ -7000,18 +7032,16 @@ class TelemetryService {
7000
7032
  } catch (error) {
7001
7033
  const durationMs = performance.now() - startTime;
7002
7034
  const err = error instanceof Error ? error : new Error(String(error));
7003
- const enrichedProperties = this.enrichPropertiesWithContext({
7004
- ...properties,
7005
- errorMessage: err.message
7006
- }, context);
7035
+ const enrichedProperties = this.enrichPropertiesWithContext({ ...properties, errorMessage: err.message }, context);
7007
7036
  await this.telemetryProvider.trackRequest(name, durationMs, false, enrichedProperties);
7008
7037
  throw error;
7009
7038
  }
7010
7039
  }
7011
7040
  async trackDependencyOperation(name, type2, fn, properties) {
7012
7041
  const parentContext = this.getCurrentContext();
7013
- if (!parentContext)
7042
+ if (!parentContext) {
7014
7043
  throw new Error("trackDependencyOperation must be called within a trackRequest block.");
7044
+ }
7015
7045
  const childContext = {
7016
7046
  operationId: parentContext.operationId,
7017
7047
  parentId: parentContext.id,
@@ -7027,10 +7057,7 @@ class TelemetryService {
7027
7057
  } catch (error) {
7028
7058
  const durationMs = performance.now() - startTime;
7029
7059
  const err = error instanceof Error ? error : new Error(String(error));
7030
- const enrichedProperties = this.enrichPropertiesWithContext({
7031
- ...properties,
7032
- errorMessage: err.message
7033
- }, childContext);
7060
+ const enrichedProperties = this.enrichPropertiesWithContext({ ...properties, errorMessage: err.message }, childContext);
7034
7061
  await this.telemetryProvider.trackDependency(name, type2, durationMs, false, enrichedProperties);
7035
7062
  throw error;
7036
7063
  }
@@ -7048,16 +7075,12 @@ class TelemetryService {
7048
7075
  generateId() {
7049
7076
  return crypto.randomUUID().replaceAll("-", "");
7050
7077
  }
7051
- constructor(telemetryProvider, contextStorage) {
7052
- telemetry_service_define_property(this, "telemetryProvider", undefined);
7053
- telemetry_service_define_property(this, "contextStorage", undefined);
7054
- telemetry_service_define_property(this, "operationId", undefined);
7055
- telemetry_service_define_property(this, "defaultProperties", undefined);
7056
- this.telemetryProvider = telemetryProvider;
7057
- this.contextStorage = contextStorage;
7058
- }
7059
7078
  }
7060
- var init_node = () => {};
7079
+
7080
+ // ../telemetry/src/node.ts
7081
+ var init_node = __esm(() => {
7082
+ init_node_context_storage();
7083
+ });
7061
7084
 
7062
7085
  // ../common/src/registry.ts
7063
7086
  import { execFileSync } from "node:child_process";
@@ -7065,16 +7088,15 @@ function readRegistryValue(keyPath, valueName) {
7065
7088
  if (process.platform !== "win32") {
7066
7089
  return "";
7067
7090
  }
7068
- try {
7069
- const output = execFileSync("reg", ["query", keyPath, "/v", valueName], {
7070
- encoding: "utf-8",
7071
- stdio: ["pipe", "pipe", "pipe"]
7072
- });
7073
- const match = output.match(new RegExp(`${valueName}\\s+REG_SZ\\s+(.+)`));
7074
- return match?.[1]?.trim() ?? "";
7075
- } catch {
7091
+ const [error, output] = catchError(() => execFileSync("reg", ["query", keyPath, "/v", valueName], {
7092
+ encoding: "utf-8",
7093
+ stdio: ["pipe", "pipe", "pipe"]
7094
+ }));
7095
+ if (error) {
7076
7096
  return "";
7077
7097
  }
7098
+ const match = output.match(new RegExp(`${valueName}\\s+REG_SZ\\s+(.+)`));
7099
+ return match?.[1]?.trim() ?? "";
7078
7100
  }
7079
7101
  var init_registry = () => {};
7080
7102
 
@@ -7091,7 +7113,7 @@ class LoggerTelemetryProvider {
7091
7113
  };
7092
7114
  }
7093
7115
  async trackEvent(eventName, properties) {
7094
- logger.info(formatMessage("Event", eventName, this.enrich(properties)));
7116
+ logger.debug(formatMessage("Event", eventName, this.enrich(properties)));
7095
7117
  }
7096
7118
  async trackException(error, properties) {
7097
7119
  logger.error(formatMessage("Exception", error.message, this.enrich({
@@ -7100,7 +7122,7 @@ class LoggerTelemetryProvider {
7100
7122
  })));
7101
7123
  }
7102
7124
  async trackRequest(name, duration, success, properties) {
7103
- logger.info(formatMessage("Request", name, this.enrich({
7125
+ logger.debug(formatMessage("Request", name, this.enrich({
7104
7126
  ...properties,
7105
7127
  duration: `${duration}ms`,
7106
7128
  success
@@ -7133,30 +7155,22 @@ var init_logger_telemetry_provider = __esm(() => {
7133
7155
  // ../common/src/node-appinsights-telemetry-provider.ts
7134
7156
  function setGlobalTelemetryProperties(properties) {
7135
7157
  const existing = getGlobalTelemetryProperties();
7136
- globalThis[GLOBAL_TELEMETRY_PROPS_KEY] = {
7137
- ...existing,
7138
- ...properties
7139
- };
7158
+ telemetryPropsSlot.set({ ...existing, ...properties });
7140
7159
  }
7141
7160
  function getGlobalTelemetryProperties() {
7142
- return globalThis[GLOBAL_TELEMETRY_PROPS_KEY];
7161
+ return telemetryPropsSlot.get();
7143
7162
  }
7144
- var GLOBAL_TELEMETRY_PROPS_KEY = "__uipcli_telemetry_default_props__";
7163
+ var telemetryPropsSlot, providerSlot;
7145
7164
  var init_node_appinsights_telemetry_provider = __esm(() => {
7146
7165
  init_logger();
7166
+ init_singleton();
7167
+ telemetryPropsSlot = singleton("TelemetryDefaultProps");
7168
+ providerSlot = singleton("TelemetryProvider");
7147
7169
  });
7148
7170
 
7149
7171
  // ../common/src/telemetry.ts
7150
- function getOrCreateSessionId() {
7151
- const existing = globalThis[GLOBAL_SESSION_ID_KEY];
7152
- if (typeof existing === "string")
7153
- return existing;
7154
- const id = crypto.randomUUID();
7155
- globalThis[GLOBAL_SESSION_ID_KEY] = id;
7156
- return id;
7157
- }
7158
7172
  function getGlobalTelemetryInstance() {
7159
- const existing = globalThis[GLOBAL_TELEMETRY_INSTANCE_KEY];
7173
+ const existing = telemetryInstanceSlot.get();
7160
7174
  if (existing && typeof existing === "object" && "trackEvent" in existing && typeof existing.trackEvent === "function") {
7161
7175
  return existing;
7162
7176
  }
@@ -7171,14 +7185,15 @@ function getTelemetryInstance() {
7171
7185
  }
7172
7186
  return _localTelemetryInstance;
7173
7187
  }
7174
- var GLOBAL_SESSION_ID_KEY = "__uipcli_telemetry_session_id__", GLOBAL_TELEMETRY_INSTANCE_KEY = "__uipcli_telemetry_instance__", sessionId, DEFAULT_AI_CONNECTION_STRING, _localTelemetryInstance, telemetry;
7188
+ var telemetryInstanceSlot, DEFAULT_AI_CONNECTION_STRING, _localTelemetryInstance, telemetry;
7175
7189
  var init_telemetry = __esm(() => {
7176
7190
  init_node();
7177
7191
  init_logger();
7178
7192
  init_logger_telemetry_provider();
7179
7193
  init_node_appinsights_telemetry_provider();
7180
- sessionId = getOrCreateSessionId();
7181
- DEFAULT_AI_CONNECTION_STRING = Buffer.from("SW5zdHJ1bWVudGF0aW9uS2V5PTYwNjQ5ZGY3LTk4ZmYtNDk2My1iMWQ0LWE3MGQwMzA2MTc0ZjtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9ZjlmYWNiNTctM2QxMS00Njc4LWJiOGItMDI0YmJhYmM1Y2Fl", "base64").toString("utf-8");
7194
+ init_singleton();
7195
+ telemetryInstanceSlot = singleton("TelemetryService");
7196
+ DEFAULT_AI_CONNECTION_STRING = Buffer.from("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj", "base64").toString("utf-8");
7182
7197
  telemetry = new Proxy({}, {
7183
7198
  get(_, prop) {
7184
7199
  const instance = getTelemetryInstance();
@@ -7192,12 +7207,12 @@ var init_telemetry = __esm(() => {
7192
7207
  var CommonTelemetryEvents;
7193
7208
  var init_telemetry_events = __esm(() => {
7194
7209
  CommonTelemetryEvents = {
7195
- Error: "Error"
7210
+ Error: "uip.error"
7196
7211
  };
7197
7212
  });
7198
7213
 
7199
7214
  // ../common/src/formatter.ts
7200
- function printOutput(data, format = "table", logFn = console.log) {
7215
+ function printOutput(data, format = "table", logFn) {
7201
7216
  if (!data) {
7202
7217
  logFn("Empty response object. No data to display.");
7203
7218
  return;
@@ -7216,8 +7231,6 @@ function printOutput(data, format = "table", logFn = console.log) {
7216
7231
  const values = Object.values(item).map((v) => v ?? "").join("\t");
7217
7232
  logFn(values);
7218
7233
  });
7219
- } else if ("Message" in data && !("Result" in data)) {
7220
- logFn(data.Message);
7221
7234
  } else {
7222
7235
  const values = Object.values(data).map((v) => v ?? "").join("\t");
7223
7236
  logFn(values);
@@ -7225,12 +7238,13 @@ function printOutput(data, format = "table", logFn = console.log) {
7225
7238
  break;
7226
7239
  }
7227
7240
  default: {
7228
- if ("Data" in data && data.Data != null) {
7229
- const items = Array.isArray(data.Data) ? data.Data : [data.Data];
7230
- const logValue = "Log" in data ? data.Log : undefined;
7231
- printTable(items, logFn, logValue);
7232
- } else if ("Message" in data && !("Result" in data)) {
7233
- logFn(data.Message);
7241
+ if ("Data" in data && data.Data != null && !(Array.isArray(data.Data) && data.Data.length === 0)) {
7242
+ const logValue = data.Log;
7243
+ if (Array.isArray(data.Data)) {
7244
+ printResizableTable(data.Data, logFn, logValue);
7245
+ } else {
7246
+ printVerticalTable(data.Data, logFn, logValue);
7247
+ }
7234
7248
  } else {
7235
7249
  printTable([{ ...data }], logFn);
7236
7250
  }
@@ -7243,16 +7257,22 @@ function logOutput(data, format = "table") {
7243
7257
  printOutput(data, format, (msg) => sink.writeOut(`${msg}
7244
7258
  `));
7245
7259
  }
7246
- function errorOutput(data, format = "table") {
7247
- const sink = getOutputSink();
7248
- printOutput(data, format, (msg) => sink.writeErr(`${msg}
7249
- `));
7260
+ function cellToString(val) {
7261
+ return val != null && typeof val === "object" ? JSON.stringify(val) : String(val ?? "");
7262
+ }
7263
+ function wrapText(text, width) {
7264
+ if (text.length <= width)
7265
+ return [text];
7266
+ const lines = [];
7267
+ for (let pos = 0;pos < text.length; pos += width) {
7268
+ lines.push(text.substring(pos, pos + width));
7269
+ }
7270
+ return lines;
7250
7271
  }
7251
- function printTable(data, logFn = console.log, externalLogValue) {
7272
+ function printTable(data, logFn, externalLogValue) {
7252
7273
  if (data.length === 0)
7253
7274
  return;
7254
7275
  const keys = Object.keys(data[0]).filter((key) => key !== "Code" && key !== "Log");
7255
- const cellToString = (val) => val != null && typeof val === "object" ? JSON.stringify(val) : String(val ?? "");
7256
7276
  const maxWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
7257
7277
  const header = keys.map((key, i2) => key.padEnd(maxWidths[i2])).join(" | ");
7258
7278
  logFn(header);
@@ -7266,6 +7286,96 @@ function printTable(data, logFn = console.log, externalLogValue) {
7266
7286
  logFn(`Log: ${externalLogValue}`);
7267
7287
  }
7268
7288
  }
7289
+ function printVerticalTable(data, logFn = console.log, externalLogValue) {
7290
+ const keys = Object.keys(data).filter((key) => key !== "Code" && key !== "Log");
7291
+ if (keys.length === 0)
7292
+ return;
7293
+ const maxKeyWidth = Math.max(...keys.map((key) => key.length));
7294
+ keys.forEach((key) => {
7295
+ const keyCol = key.padEnd(maxKeyWidth);
7296
+ logFn(`${keyCol} | ${cellToString(data[key])}`);
7297
+ });
7298
+ if (externalLogValue) {
7299
+ logFn("");
7300
+ logFn(`Log: ${externalLogValue}`);
7301
+ }
7302
+ }
7303
+ function printResizableTable(data, logFn = console.log, externalLogValue) {
7304
+ if (data.length === 0)
7305
+ return;
7306
+ const keys = Object.keys(data[0]).filter((key) => key !== "Code" && key !== "Log");
7307
+ if (keys.length === 0)
7308
+ return;
7309
+ if (!process.stdout.isTTY) {
7310
+ printTable(data, logFn, externalLogValue);
7311
+ return;
7312
+ }
7313
+ const naturalWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
7314
+ const separatorTotal = (keys.length - 1) * 3;
7315
+ const totalWidth = naturalWidths.reduce((a, b) => a + b, 0) + separatorTotal;
7316
+ const termWidth = process.stdout.columns || 120;
7317
+ if (totalWidth <= termWidth) {
7318
+ printTable(data, logFn, externalLogValue);
7319
+ return;
7320
+ }
7321
+ const overflow = totalWidth - termWidth;
7322
+ const MIN_COL_WIDTH = 10;
7323
+ const minWidths = keys.map((key) => Math.max(key.length, MIN_COL_WIDTH));
7324
+ let bestCol = -1;
7325
+ let bestCost = Infinity;
7326
+ for (let i2 = 0;i2 < keys.length; i2++) {
7327
+ const maxShrink = naturalWidths[i2] - minWidths[i2];
7328
+ if (maxShrink < overflow)
7329
+ continue;
7330
+ const newWidth = naturalWidths[i2] - overflow;
7331
+ let extraRows = 0;
7332
+ for (const item of data) {
7333
+ const cellLen = cellToString(item[keys[i2]]).length;
7334
+ if (cellLen > newWidth) {
7335
+ extraRows += Math.ceil(cellLen / newWidth) - 1;
7336
+ }
7337
+ }
7338
+ if (extraRows < bestCost) {
7339
+ bestCost = extraRows;
7340
+ bestCol = i2;
7341
+ }
7342
+ }
7343
+ const finalWidths = [...naturalWidths];
7344
+ if (bestCol !== -1) {
7345
+ finalWidths[bestCol] = naturalWidths[bestCol] - overflow;
7346
+ } else {
7347
+ let remaining = overflow;
7348
+ const colsByShrinkPotential = keys.map((_, i2) => ({
7349
+ index: i2,
7350
+ potential: naturalWidths[i2] - minWidths[i2]
7351
+ })).filter((c) => c.potential > 0).sort((a, b) => b.potential - a.potential);
7352
+ for (const col of colsByShrinkPotential) {
7353
+ if (remaining <= 0)
7354
+ break;
7355
+ const shrink = Math.min(remaining, col.potential);
7356
+ finalWidths[col.index] -= shrink;
7357
+ remaining -= shrink;
7358
+ }
7359
+ }
7360
+ const header = keys.map((key, i2) => key.padEnd(finalWidths[i2])).join(" | ");
7361
+ logFn(header);
7362
+ logFn(keys.map((_, i2) => "-".repeat(finalWidths[i2])).join("-|-"));
7363
+ data.forEach((item) => {
7364
+ const cellLines = keys.map((key, i2) => wrapText(cellToString(item[key]), finalWidths[i2]));
7365
+ const lineCount = Math.max(...cellLines.map((l) => l.length));
7366
+ for (let line = 0;line < lineCount; line++) {
7367
+ const row = keys.map((_, i2) => {
7368
+ const val = line < cellLines[i2].length ? cellLines[i2][line] : "";
7369
+ return val.padEnd(finalWidths[i2]);
7370
+ }).join(" | ");
7371
+ logFn(row);
7372
+ }
7373
+ });
7374
+ if (externalLogValue) {
7375
+ logFn("");
7376
+ logFn(`Log: ${externalLogValue}`);
7377
+ }
7378
+ }
7269
7379
  function toYaml(data) {
7270
7380
  return dump(data);
7271
7381
  }
@@ -7310,16 +7420,19 @@ var init_formatter = __esm(() => {
7310
7420
  result: data.Result,
7311
7421
  message: data.Message
7312
7422
  });
7313
- errorOutput(data, getOutputFormat());
7423
+ logOutput(data, getOutputFormat());
7314
7424
  }
7315
7425
  OutputFormatter.error = error;
7316
7426
  function log(data) {
7317
7427
  const format = getOutputFormat();
7428
+ const sink = getOutputSink();
7318
7429
  if (format === "json") {
7319
- console.error(JSON.stringify(data));
7430
+ sink.writeErr(`${JSON.stringify(data)}
7431
+ `);
7320
7432
  } else {
7321
7433
  for (const [key, value] of Object.entries(data)) {
7322
- console.error(`${key}: ${value}`);
7434
+ sink.writeErr(`${key}: ${value}
7435
+ `);
7323
7436
  }
7324
7437
  }
7325
7438
  }
@@ -7348,6 +7461,23 @@ var init_command_help = __esm(() => {
7348
7461
  init_output_format_context();
7349
7462
  });
7350
7463
 
7464
+ // ../common/src/console-guard.ts
7465
+ var guardInstalledSlot, savedOriginalsSlot;
7466
+ var init_console_guard = __esm(() => {
7467
+ init_output_context();
7468
+ init_singleton();
7469
+ guardInstalledSlot = singleton("ConsoleGuardInstalled");
7470
+ savedOriginalsSlot = singleton("ConsoleGuardOriginals");
7471
+ });
7472
+
7473
+ // ../common/src/constants.ts
7474
+ var UIPATH_HOME_DIR = ".uipath", AUTH_FILENAME = ".auth", CONFIG_FILENAME = "config.json", LOCAL_CONFIG_FILENAME = "uipath.config.json", DEFAULT_BASE_URL = "https://cloud.uipath.com", DEFAULT_AUTH_TIMEOUT_MS;
7475
+ var init_constants = __esm(() => {
7476
+ DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
7477
+ });
7478
+ // ../common/src/error-handler.ts
7479
+ var init_error_handler = () => {};
7480
+
7351
7481
  // ../../node_modules/jsonpath-plus/dist/index-node-esm.js
7352
7482
  import vm from "vm";
7353
7483
 
@@ -8752,14 +8882,97 @@ var init_index_node_esm = __esm(() => {
8752
8882
  var init_jsonpath = __esm(() => {
8753
8883
  init_index_node_esm();
8754
8884
  });
8885
+ // ../common/src/polling/abort-controller.ts
8886
+ var init_abort_controller = __esm(() => {
8887
+ init_logger();
8888
+ });
8889
+ // ../common/src/polling/types.ts
8890
+ var init_types = () => {};
8891
+
8892
+ // ../common/src/polling/poll-until.ts
8893
+ var init_poll_until = __esm(() => {
8894
+ init_logger();
8895
+ init_types();
8896
+ });
8897
+
8898
+ // ../common/src/polling/terminal-statuses.ts
8899
+ var TERMINAL_STATUSES, FAILURE_STATUSES;
8900
+ var init_terminal_statuses = __esm(() => {
8901
+ TERMINAL_STATUSES = new Set([
8902
+ "completed",
8903
+ "successful",
8904
+ "faulted",
8905
+ "failed",
8906
+ "cancelled",
8907
+ "canceled",
8908
+ "stopped",
8909
+ "finished"
8910
+ ]);
8911
+ FAILURE_STATUSES = new Set([
8912
+ "faulted",
8913
+ "failed",
8914
+ "cancelled",
8915
+ "canceled",
8916
+ "stopped"
8917
+ ]);
8918
+ });
8919
+
8920
+ // ../common/src/polling/index.ts
8921
+ var init_polling = __esm(() => {
8922
+ init_abort_controller();
8923
+ init_poll_until();
8924
+ init_terminal_statuses();
8925
+ init_types();
8926
+ });
8927
+
8928
+ // ../common/src/screen-logger.ts
8929
+ var ScreenLogger;
8930
+ var init_screen_logger = __esm(() => {
8931
+ init_output_context();
8932
+ ((ScreenLogger) => {
8933
+ function progress(message) {
8934
+ getOutputSink().writeErr(`${message}
8935
+ `);
8936
+ }
8937
+ ScreenLogger.progress = progress;
8938
+ })(ScreenLogger ||= {});
8939
+ });
8940
+
8941
+ // ../common/src/tool-provider.ts
8942
+ var factorySlot;
8943
+ var init_tool_provider = __esm(() => {
8944
+ init_singleton();
8945
+ factorySlot = singleton("PackagerFactoryProvider");
8946
+ });
8947
+
8755
8948
  // ../common/src/trackedAction.ts
8949
+ function deriveCommandPath(cmd) {
8950
+ const parts = [];
8951
+ let current = cmd;
8952
+ while (current) {
8953
+ const name = current.name();
8954
+ if (name) {
8955
+ parts.unshift(name);
8956
+ }
8957
+ current = current.parent;
8958
+ }
8959
+ if (parts.length > 1) {
8960
+ parts.shift();
8961
+ }
8962
+ return ["uip", ...parts.filter((p) => p !== "uip")].join(".");
8963
+ }
8964
+ var pollSignalSlot;
8756
8965
  var init_trackedAction = __esm(() => {
8757
8966
  init_esm();
8758
8967
  init_formatter();
8759
8968
  init_logger();
8969
+ init_singleton();
8760
8970
  init_telemetry();
8761
- Command.prototype.trackedAction = function(context, telemetryName, fn, properties) {
8971
+ pollSignalSlot = singleton("PollSignal");
8972
+ Command.prototype.trackedAction = function(context, fn, properties) {
8973
+ const command = this;
8762
8974
  return this.action(async (...args) => {
8975
+ const telemetryName = deriveCommandPath(command);
8763
8976
  const props = typeof properties === "function" ? properties(...args) : properties;
8764
8977
  const startTime = performance.now();
8765
8978
  let errorMessage;
@@ -8788,16 +9001,22 @@ var init_trackedAction = __esm(() => {
8788
9001
 
8789
9002
  // ../common/src/index.ts
8790
9003
  var init_src = __esm(() => {
9004
+ init_console_guard();
8791
9005
  init_node_appinsights_telemetry_provider();
8792
9006
  init_command_help();
9007
+ init_constants();
9008
+ init_error_handler();
8793
9009
  init_formatter();
8794
9010
  init_jsonpath();
8795
9011
  init_logger();
8796
9012
  init_output_context();
8797
9013
  init_output_format_context();
9014
+ init_polling();
8798
9015
  init_registry();
9016
+ init_screen_logger();
8799
9017
  init_telemetry();
8800
9018
  init_telemetry_events();
9019
+ init_tool_provider();
8801
9020
  init_trackedAction();
8802
9021
  });
8803
9022
 
@@ -9568,64 +9787,6 @@ var init_src2 = __esm(() => {
9568
9787
  init_node2();
9569
9788
  fsInstance = new NodeFileSystem;
9570
9789
  });
9571
- // ../../node_modules/sisteransi/src/index.js
9572
- var require_src = __commonJS((exports, module) => {
9573
- var ESC = "\x1B";
9574
- var CSI = `${ESC}[`;
9575
- var beep = "\x07";
9576
- var cursor = {
9577
- to(x, y) {
9578
- if (!y)
9579
- return `${CSI}${x + 1}G`;
9580
- return `${CSI}${y + 1};${x + 1}H`;
9581
- },
9582
- move(x, y) {
9583
- let ret = "";
9584
- if (x < 0)
9585
- ret += `${CSI}${-x}D`;
9586
- else if (x > 0)
9587
- ret += `${CSI}${x}C`;
9588
- if (y < 0)
9589
- ret += `${CSI}${-y}A`;
9590
- else if (y > 0)
9591
- ret += `${CSI}${y}B`;
9592
- return ret;
9593
- },
9594
- up: (count = 1) => `${CSI}${count}A`,
9595
- down: (count = 1) => `${CSI}${count}B`,
9596
- forward: (count = 1) => `${CSI}${count}C`,
9597
- backward: (count = 1) => `${CSI}${count}D`,
9598
- nextLine: (count = 1) => `${CSI}E`.repeat(count),
9599
- prevLine: (count = 1) => `${CSI}F`.repeat(count),
9600
- left: `${CSI}G`,
9601
- hide: `${CSI}?25l`,
9602
- show: `${CSI}?25h`,
9603
- save: `${ESC}7`,
9604
- restore: `${ESC}8`
9605
- };
9606
- var scroll = {
9607
- up: (count = 1) => `${CSI}S`.repeat(count),
9608
- down: (count = 1) => `${CSI}T`.repeat(count)
9609
- };
9610
- var erase = {
9611
- screen: `${CSI}2J`,
9612
- up: (count = 1) => `${CSI}1J`.repeat(count),
9613
- down: (count = 1) => `${CSI}J`.repeat(count),
9614
- line: `${CSI}2K`,
9615
- lineEnd: `${CSI}K`,
9616
- lineStart: `${CSI}1K`,
9617
- lines(count) {
9618
- let clear = "";
9619
- for (let i2 = 0;i2 < count; i2++)
9620
- clear += this.line + (i2 < count - 1 ? cursor.up() : "");
9621
- if (count)
9622
- clear += cursor.left;
9623
- return clear;
9624
- }
9625
- };
9626
- module.exports = { cursor, scroll, erase, beep };
9627
- });
9628
-
9629
9790
  // generated/connections/src/runtime.ts
9630
9791
  var BASE_PATH = "https://alpha.uipath.com/entity/Azure/connections_".replace(/\/+$/, "");
9631
9792
 
@@ -29269,6 +29430,12 @@ class ElementsApi extends BaseAPI2 {
29269
29430
  await this.upsertActivityPackVersionRaw(requestParameters, initOverrides);
29270
29431
  }
29271
29432
  }
29433
+ // ../auth/src/index.ts
29434
+ init_src();
29435
+
29436
+ // ../auth/src/config.ts
29437
+ init_src();
29438
+
29272
29439
  // ../auth/src/utils/loadConfig.ts
29273
29440
  init_src();
29274
29441
 
@@ -42855,11 +43022,11 @@ var loadConfigAsync = async () => {
42855
43022
  const fs7 = await getFs();
42856
43023
  let configPath = fs7.env.getenv("UIPATH_CONFIG_PATH");
42857
43024
  if (!configPath) {
42858
- const localPath = fs7.path.join(fs7.env.cwd(), "uipath.config.json");
43025
+ const localPath = fs7.path.join(fs7.env.cwd(), LOCAL_CONFIG_FILENAME);
42859
43026
  if (await fs7.exists(localPath)) {
42860
43027
  configPath = localPath;
42861
43028
  } else {
42862
- configPath = fs7.path.join(fs7.env.homedir(), ".uipcli", "config.json");
43029
+ configPath = fs7.path.join(fs7.env.homedir(), UIPATH_HOME_DIR, CONFIG_FILENAME);
42863
43030
  }
42864
43031
  }
42865
43032
  if (!await fs7.exists(configPath)) {
@@ -42892,7 +43059,6 @@ Please ensure your config file contains valid JSON.`;
42892
43059
  };
42893
43060
 
42894
43061
  // ../auth/src/config.ts
42895
- var DEFAULT_BASE_URL = "https://cloud.uipath.com";
42896
43062
  var DEFAULT_CLIENT_ID = "36dea5b8-e8bb-423d-8e7b-c808df8f1c00";
42897
43063
 
42898
43064
  class InvalidBaseUrlError extends Error {
@@ -42936,25 +43102,19 @@ var resolveConfigAsync = async ({
42936
43102
  while (baseUrl.endsWith("/")) {
42937
43103
  baseUrl = baseUrl.slice(0, -1);
42938
43104
  }
42939
- try {
42940
- const url2 = new URL(baseUrl);
42941
- const isValidUiPathDomain = url2.hostname === "uipath.com" || url2.hostname.endsWith(".uipath.com");
42942
- if (!isValidUiPathDomain) {
42943
- throw new InvalidBaseUrlError(baseUrl, `Domain "${url2.hostname}" is not a valid UiPath domain. Only uipath.com and its subdomains are allowed.`);
42944
- }
42945
- if (url2.pathname.length > 1) {
42946
- baseUrl = url2.origin;
42947
- }
42948
- } catch (error48) {
42949
- if (error48 instanceof InvalidBaseUrlError) {
42950
- throw error48;
42951
- }
42952
- throw new InvalidBaseUrlError(baseUrl, `Malformed URL. ${error48 instanceof Error ? error48.message : "Unknown error"}`);
43105
+ const resolvedBaseUrl = baseUrl;
43106
+ const [urlError, url2] = catchError(() => new URL(resolvedBaseUrl));
43107
+ if (urlError) {
43108
+ throw new InvalidBaseUrlError(baseUrl, `Malformed URL. ${urlError instanceof Error ? urlError.message : "Unknown error"}`);
42953
43109
  }
42954
- let clientId = customClientId;
42955
- if (!clientId) {
42956
- clientId = process.env.UIPATH_CLIENT_ID;
43110
+ const isValidUiPathDomain = url2.hostname === "uipath.com" || url2.hostname.endsWith(".uipath.com");
43111
+ if (!isValidUiPathDomain) {
43112
+ throw new InvalidBaseUrlError(baseUrl, `Domain "${url2.hostname}" is not a valid UiPath domain. Only uipath.com and its subdomains are allowed.`);
43113
+ }
43114
+ if (url2.pathname.length > 1) {
43115
+ baseUrl = url2.origin;
42957
43116
  }
43117
+ let clientId = customClientId;
42958
43118
  if (!clientId && config2.auth?.clientId) {
42959
43119
  clientId = config2.auth.clientId;
42960
43120
  }
@@ -42962,9 +43122,6 @@ var resolveConfigAsync = async ({
42962
43122
  clientId = DEFAULT_CLIENT_ID;
42963
43123
  }
42964
43124
  let clientSecret = customClientSecret;
42965
- if (!clientSecret) {
42966
- clientSecret = process.env.UIPATH_CLIENT_SECRET;
42967
- }
42968
43125
  if (!clientSecret && config2.auth?.clientSecret) {
42969
43126
  clientSecret = config2.auth.clientSecret;
42970
43127
  }
@@ -42987,533 +43144,19 @@ init_src2();
42987
43144
 
42988
43145
  // ../auth/src/telemetry-events.ts
42989
43146
  var AuthTelemetryEvents = {
42990
- Login: "Auth.Login",
42991
- TenantSelected: "Auth.TenantSelected",
42992
- TokenRefresh: "Auth.TokenRefresh",
42993
- Logout: "Auth.Logout"
43147
+ Login: "uip.auth.login",
43148
+ TenantSelected: "uip.auth.tenant-selected",
43149
+ TokenRefresh: "uip.auth.token-refresh",
43150
+ Logout: "uip.auth.logout"
42994
43151
  };
42995
43152
 
42996
43153
  // ../auth/src/tenantSelection.ts
42997
43154
  init_src();
42998
43155
 
42999
- // ../../node_modules/@clack/core/dist/index.mjs
43000
- import { styleText as D } from "node:util";
43001
- import { stdout as R, stdin as q } from "node:process";
43002
- var import_sisteransi = __toESM(require_src(), 1);
43003
- import ot from "node:readline";
43004
- function x(t, e, s) {
43005
- if (!s.some((u) => !u.disabled))
43006
- return t;
43007
- const i2 = t + e, r = Math.max(s.length - 1, 0), n = i2 < 0 ? r : i2 > r ? 0 : i2;
43008
- return s[n].disabled ? x(n, e < 0 ? -1 : 1, s) : n;
43009
- }
43010
- var at = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109;
43011
- var lt = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510;
43012
- var ht = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141;
43013
- var O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
43014
- var y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
43015
- var L = /\t{1,1000}/y;
43016
- var P = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
43017
- var M = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
43018
- var ct = /\p{M}+/gu;
43019
- var ft = { limit: 1 / 0, ellipsis: "" };
43020
- var X = (t, e = {}, s = {}) => {
43021
- const i2 = e.limit ?? 1 / 0, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X(r, ft, s).width : 0), u = s.ansiWidth ?? 0, a = s.controlWidth ?? 0, l = s.tabWidth ?? 8, E = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, m = s.fullWidthWidth ?? 2, A = s.regularWidth ?? 1, V = s.wideWidth ?? 2;
43022
- let h = 0, o = 0, p = t.length, v = 0, F = false, d = p, b = Math.max(0, i2 - n), C = 0, w = 0, c = 0, f = 0;
43023
- t:
43024
- for (;; ) {
43025
- if (w > C || o >= p && o > h) {
43026
- const ut = t.slice(C, w) || t.slice(h, o);
43027
- v = 0;
43028
- for (const Y of ut.replaceAll(ct, "")) {
43029
- const $ = Y.codePointAt(0) || 0;
43030
- if (lt($) ? f = m : ht($) ? f = V : E !== A && at($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h) + v)), c + f > i2) {
43031
- F = true;
43032
- break t;
43033
- }
43034
- v += Y.length, c += f;
43035
- }
43036
- C = w = 0;
43037
- }
43038
- if (o >= p)
43039
- break;
43040
- if (M.lastIndex = o, M.test(t)) {
43041
- if (v = M.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i2) {
43042
- F = true;
43043
- break;
43044
- }
43045
- c += f, C = h, w = o, o = h = M.lastIndex;
43046
- continue;
43047
- }
43048
- if (O.lastIndex = o, O.test(t)) {
43049
- if (c + u > b && (d = Math.min(d, o)), c + u > i2) {
43050
- F = true;
43051
- break;
43052
- }
43053
- c += u, C = h, w = o, o = h = O.lastIndex;
43054
- continue;
43055
- }
43056
- if (y.lastIndex = o, y.test(t)) {
43057
- if (v = y.lastIndex - o, f = v * a, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + f > i2) {
43058
- F = true;
43059
- break;
43060
- }
43061
- c += f, C = h, w = o, o = h = y.lastIndex;
43062
- continue;
43063
- }
43064
- if (L.lastIndex = o, L.test(t)) {
43065
- if (v = L.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i2) {
43066
- F = true;
43067
- break;
43068
- }
43069
- c += f, C = h, w = o, o = h = L.lastIndex;
43070
- continue;
43071
- }
43072
- if (P.lastIndex = o, P.test(t)) {
43073
- if (c + g > b && (d = Math.min(d, o)), c + g > i2) {
43074
- F = true;
43075
- break;
43076
- }
43077
- c += g, C = h, w = o, o = h = P.lastIndex;
43078
- continue;
43079
- }
43080
- o += 1;
43081
- }
43082
- return { width: F ? b : c, index: F ? d : p, truncated: F, ellipsed: F && i2 >= n };
43083
- };
43084
- var pt = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
43085
- var S = (t, e = {}) => X(t, pt, e).width;
43086
- var T = "\x1B";
43087
- var Z = "›";
43088
- var Ft = 39;
43089
- var j = "\x07";
43090
- var Q = "[";
43091
- var dt = "]";
43092
- var tt = "m";
43093
- var U = `${dt}8;;`;
43094
- var et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${j})`, "y");
43095
- var mt = (t) => {
43096
- if (t >= 30 && t <= 37 || t >= 90 && t <= 97)
43097
- return 39;
43098
- if (t >= 40 && t <= 47 || t >= 100 && t <= 107)
43099
- return 49;
43100
- if (t === 1 || t === 2)
43101
- return 22;
43102
- if (t === 3)
43103
- return 23;
43104
- if (t === 4)
43105
- return 24;
43106
- if (t === 7)
43107
- return 27;
43108
- if (t === 8)
43109
- return 28;
43110
- if (t === 9)
43111
- return 29;
43112
- if (t === 0)
43113
- return 0;
43114
- };
43115
- var st = (t) => `${T}${Q}${t}${tt}`;
43116
- var it = (t) => `${T}${U}${t}${j}`;
43117
- var gt = (t) => t.map((e) => S(e));
43118
- var G = (t, e, s) => {
43119
- const i2 = e[Symbol.iterator]();
43120
- let r = false, n = false, u = t.at(-1), a = u === undefined ? 0 : S(u), l = i2.next(), E = i2.next(), g = 0;
43121
- for (;!l.done; ) {
43122
- const m = l.value, A = S(m);
43123
- a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === T || m === Z) && (r = true, n = e.startsWith(U, g + 1)), r ? n ? m === j && (r = false, n = false) : m === tt && (r = false) : (a += A, a === s && !E.done && (t.push(""), a = 0)), l = E, E = i2.next(), g += m.length;
43124
- }
43125
- u = t.at(-1), !a && u !== undefined && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
43126
- };
43127
- var vt = (t) => {
43128
- const e = t.split(" ");
43129
- let s = e.length;
43130
- for (;s > 0 && !(S(e[s - 1]) > 0); )
43131
- s--;
43132
- return s === e.length ? t : e.slice(0, s).join(" ") + e.slice(s).join("");
43133
- };
43134
- var Et = (t, e, s = {}) => {
43135
- if (s.trim !== false && t.trim() === "")
43136
- return "";
43137
- let i2 = "", r, n;
43138
- const u = t.split(" "), a = gt(u);
43139
- let l = [""];
43140
- for (const [h, o] of u.entries()) {
43141
- s.trim !== false && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
43142
- let p = S(l.at(-1) ?? "");
43143
- if (h !== 0 && (p >= e && (s.wordWrap === false || s.trim === false) && (l.push(""), p = 0), (p > 0 || s.trim === false) && (l[l.length - 1] += " ", p++)), s.hard && a[h] > e) {
43144
- const v = e - p, F = 1 + Math.floor((a[h] - v - 1) / e);
43145
- Math.floor((a[h] - 1) / e) < F && l.push(""), G(l, o, e);
43146
- continue;
43147
- }
43148
- if (p + a[h] > e && p > 0 && a[h] > 0) {
43149
- if (s.wordWrap === false && p < e) {
43150
- G(l, o, e);
43151
- continue;
43152
- }
43153
- l.push("");
43154
- }
43155
- if (p + a[h] > e && s.wordWrap === false) {
43156
- G(l, o, e);
43157
- continue;
43158
- }
43159
- l[l.length - 1] += o;
43160
- }
43161
- s.trim !== false && (l = l.map((h) => vt(h)));
43162
- const E = l.join(`
43163
- `), g = E[Symbol.iterator]();
43164
- let m = g.next(), A = g.next(), V = 0;
43165
- for (;!m.done; ) {
43166
- const h = m.value, o = A.value;
43167
- if (i2 += h, h === T || h === Z) {
43168
- et.lastIndex = V + 1;
43169
- const F = et.exec(E)?.groups;
43170
- if (F?.code !== undefined) {
43171
- const d = Number.parseFloat(F.code);
43172
- r = d === Ft ? undefined : d;
43173
- } else
43174
- F?.uri !== undefined && (n = F.uri.length === 0 ? undefined : F.uri);
43175
- }
43176
- const p = r ? mt(r) : undefined;
43177
- o === `
43178
- ` ? (n && (i2 += it("")), r && p && (i2 += st(p))) : h === `
43179
- ` && (r && p && (i2 += st(r)), n && (i2 += it(n))), V += h.length, m = A, A = g.next();
43180
- }
43181
- return i2;
43182
- };
43183
- function K(t, e, s) {
43184
- return String(t).normalize().replaceAll(`\r
43185
- `, `
43186
- `).split(`
43187
- `).map((i2) => Et(i2, e, s)).join(`
43188
- `);
43189
- }
43190
- var At = ["up", "down", "left", "right", "space", "enter", "cancel"];
43191
- var _ = { actions: new Set(At), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true };
43192
- function H(t, e) {
43193
- if (typeof t == "string")
43194
- return _.aliases.get(t) === e;
43195
- for (const s of t)
43196
- if (s !== undefined && H(s, e))
43197
- return true;
43198
- return false;
43199
- }
43200
- function _t(t, e) {
43201
- if (t === e)
43202
- return;
43203
- const s = t.split(`
43204
- `), i2 = e.split(`
43205
- `), r = Math.max(s.length, i2.length), n = [];
43206
- for (let u = 0;u < r; u++)
43207
- s[u] !== i2[u] && n.push(u);
43208
- return { lines: n, numLinesBefore: s.length, numLinesAfter: i2.length, numLines: r };
43209
- }
43210
- var bt = globalThis.process.platform.startsWith("win");
43211
- var z2 = Symbol("clack:cancel");
43212
- function W(t, e) {
43213
- const s = t;
43214
- s.isTTY && s.setRawMode(e);
43215
- }
43216
- var nt = (t) => ("rows" in t) && typeof t.rows == "number" ? t.rows : 20;
43217
- class B {
43218
- input;
43219
- output;
43220
- _abortSignal;
43221
- rl;
43222
- opts;
43223
- _render;
43224
- _track = false;
43225
- _prevFrame = "";
43226
- _subscribers = new Map;
43227
- _cursor = 0;
43228
- state = "initial";
43229
- error = "";
43230
- value;
43231
- userInput = "";
43232
- constructor(e, s = true) {
43233
- const { input: i2 = q, output: r = R, render: n, signal: u, ...a } = e;
43234
- this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = s, this._abortSignal = u, this.input = i2, this.output = r;
43235
- }
43236
- unsubscribe() {
43237
- this._subscribers.clear();
43238
- }
43239
- setSubscriber(e, s) {
43240
- const i2 = this._subscribers.get(e) ?? [];
43241
- i2.push(s), this._subscribers.set(e, i2);
43242
- }
43243
- on(e, s) {
43244
- this.setSubscriber(e, { cb: s });
43245
- }
43246
- once(e, s) {
43247
- this.setSubscriber(e, { cb: s, once: true });
43248
- }
43249
- emit(e, ...s) {
43250
- const i2 = this._subscribers.get(e) ?? [], r = [];
43251
- for (const n of i2)
43252
- n.cb(...s), n.once && r.push(() => i2.splice(i2.indexOf(n), 1));
43253
- for (const n of r)
43254
- n();
43255
- }
43256
- prompt() {
43257
- return new Promise((e) => {
43258
- if (this._abortSignal) {
43259
- if (this._abortSignal.aborted)
43260
- return this.state = "cancel", this.close(), e(z2);
43261
- this._abortSignal.addEventListener("abort", () => {
43262
- this.state = "cancel", this.close();
43263
- }, { once: true });
43264
- }
43265
- this.rl = ot.createInterface({ input: this.input, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), this.rl.prompt(), this.opts.initialUserInput !== undefined && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), W(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
43266
- this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), W(this.input, false), e(this.value);
43267
- }), this.once("cancel", () => {
43268
- this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), W(this.input, false), e(z2);
43269
- });
43270
- });
43271
- }
43272
- _isActionKey(e, s) {
43273
- return e === "\t";
43274
- }
43275
- _setValue(e) {
43276
- this.value = e, this.emit("value", this.value);
43277
- }
43278
- _setUserInput(e, s) {
43279
- this.userInput = e ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
43280
- }
43281
- _clearUserInput() {
43282
- this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
43283
- }
43284
- onKeypress(e, s) {
43285
- if (this._track && s.name !== "return" && (s.name && this._isActionKey(e, s) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), s?.name && (!this._track && _.aliases.has(s.name) && this.emit("cursor", _.aliases.get(s.name)), _.actions.has(s.name) && this.emit("cursor", s.name)), e && (e.toLowerCase() === "y" || e.toLowerCase() === "n") && this.emit("confirm", e.toLowerCase() === "y"), this.emit("key", e?.toLowerCase(), s), s?.name === "return") {
43286
- if (this.opts.validate) {
43287
- const i2 = this.opts.validate(this.value);
43288
- i2 && (this.error = i2 instanceof Error ? i2.message : i2, this.state = "error", this.rl?.write(this.userInput));
43289
- }
43290
- this.state !== "error" && (this.state = "submit");
43291
- }
43292
- H([e, s?.name, s?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
43293
- }
43294
- close() {
43295
- this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
43296
- `), W(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
43297
- }
43298
- restoreCursor() {
43299
- const e = K(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
43300
- `).length - 1;
43301
- this.output.write(import_sisteransi.cursor.move(-999, e * -1));
43302
- }
43303
- render() {
43304
- const e = K(this._render(this) ?? "", process.stdout.columns, { hard: true, trim: false });
43305
- if (e !== this._prevFrame) {
43306
- if (this.state === "initial")
43307
- this.output.write(import_sisteransi.cursor.hide);
43308
- else {
43309
- const s = _t(this._prevFrame, e), i2 = nt(this.output);
43310
- if (this.restoreCursor(), s) {
43311
- const r = Math.max(0, s.numLinesAfter - i2), n = Math.max(0, s.numLinesBefore - i2);
43312
- let u = s.lines.find((a) => a >= r);
43313
- if (u === undefined) {
43314
- this._prevFrame = e;
43315
- return;
43316
- }
43317
- if (s.lines.length === 1) {
43318
- this.output.write(import_sisteransi.cursor.move(0, u - n)), this.output.write(import_sisteransi.erase.lines(1));
43319
- const a = e.split(`
43320
- `);
43321
- this.output.write(a[u]), this._prevFrame = e, this.output.write(import_sisteransi.cursor.move(0, a.length - u - 1));
43322
- return;
43323
- } else if (s.lines.length > 1) {
43324
- if (r < n)
43325
- u = r;
43326
- else {
43327
- const l = u - n;
43328
- l > 0 && this.output.write(import_sisteransi.cursor.move(0, l));
43329
- }
43330
- this.output.write(import_sisteransi.erase.down());
43331
- const a = e.split(`
43332
- `).slice(u);
43333
- this.output.write(a.join(`
43334
- `)), this._prevFrame = e;
43335
- return;
43336
- }
43337
- }
43338
- this.output.write(import_sisteransi.erase.down());
43339
- }
43340
- this.output.write(e), this.state === "initial" && (this.state = "active"), this._prevFrame = e;
43341
- }
43342
- }
43343
- }
43344
- function wt(t, e) {
43345
- if (t === undefined || e.length === 0)
43346
- return 0;
43347
- const s = e.findIndex((i2) => i2.value === t);
43348
- return s !== -1 ? s : 0;
43349
- }
43350
- function Dt(t, e) {
43351
- return (e.label ?? String(e.value)).toLowerCase().includes(t.toLowerCase());
43352
- }
43353
- function St(t, e) {
43354
- if (e)
43355
- return t ? e : e[0];
43356
- }
43357
-
43358
- class Vt extends B {
43359
- filteredOptions;
43360
- multiple;
43361
- isNavigating = false;
43362
- selectedValues = [];
43363
- focusedValue;
43364
- #t = 0;
43365
- #s = "";
43366
- #i;
43367
- #e;
43368
- get cursor() {
43369
- return this.#t;
43370
- }
43371
- get userInputWithCursor() {
43372
- if (!this.userInput)
43373
- return D(["inverse", "hidden"], "_");
43374
- if (this._cursor >= this.userInput.length)
43375
- return `${this.userInput}█`;
43376
- const e = this.userInput.slice(0, this._cursor), [s, ...i2] = this.userInput.slice(this._cursor);
43377
- return `${e}${D("inverse", s)}${i2.join("")}`;
43378
- }
43379
- get options() {
43380
- return typeof this.#e == "function" ? this.#e() : this.#e;
43381
- }
43382
- constructor(e) {
43383
- super(e), this.#e = e.options;
43384
- const s = this.options;
43385
- this.filteredOptions = [...s], this.multiple = e.multiple === true, this.#i = e.filter ?? Dt;
43386
- let i2;
43387
- if (e.initialValue && Array.isArray(e.initialValue) ? this.multiple ? i2 = e.initialValue : i2 = e.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i2 = [this.options[0].value]), i2)
43388
- for (const r of i2) {
43389
- const n = s.findIndex((u) => u.value === r);
43390
- n !== -1 && (this.toggleSelected(r), this.#t = n);
43391
- }
43392
- this.focusedValue = this.options[this.#t]?.value, this.on("key", (r, n) => this.#r(r, n)), this.on("userInput", (r) => this.#n(r));
43393
- }
43394
- _isActionKey(e, s) {
43395
- return e === "\t" || this.multiple && this.isNavigating && s.name === "space" && e !== undefined && e !== "";
43396
- }
43397
- #r(e, s) {
43398
- const i2 = s.name === "up", r = s.name === "down", n = s.name === "return";
43399
- i2 || r ? (this.#t = x(this.#t, i2 ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = St(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== undefined && (s.name === "tab" || this.isNavigating && s.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
43400
- }
43401
- deselectAll() {
43402
- this.selectedValues = [];
43403
- }
43404
- toggleSelected(e) {
43405
- this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((s) => s !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);
43406
- }
43407
- #n(e) {
43408
- if (e !== this.#s) {
43409
- this.#s = e;
43410
- const s = this.options;
43411
- e ? this.filteredOptions = s.filter((n) => this.#i(e, n)) : this.filteredOptions = [...s];
43412
- const i2 = wt(this.focusedValue, this.filteredOptions);
43413
- this.#t = x(i2, 0, this.filteredOptions);
43414
- const r = this.filteredOptions[this.#t];
43415
- r && !r.disabled ? this.focusedValue = r.value : this.focusedValue = undefined, this.multiple || (this.focusedValue !== undefined ? this.toggleSelected(this.focusedValue) : this.deselectAll());
43416
- }
43417
- }
43418
- }
43419
- class yt extends B {
43420
- options;
43421
- cursor = 0;
43422
- #t;
43423
- getGroupItems(e) {
43424
- return this.options.filter((s) => s.group === e);
43425
- }
43426
- isGroupSelected(e) {
43427
- const s = this.getGroupItems(e), i2 = this.value;
43428
- return i2 === undefined ? false : s.every((r) => i2.includes(r.value));
43429
- }
43430
- toggleValue() {
43431
- const e = this.options[this.cursor];
43432
- if (this.value === undefined && (this.value = []), e.group === true) {
43433
- const s = e.value, i2 = this.getGroupItems(s);
43434
- this.isGroupSelected(s) ? this.value = this.value.filter((r) => i2.findIndex((n) => n.value === r) === -1) : this.value = [...this.value, ...i2.map((r) => r.value)], this.value = Array.from(new Set(this.value));
43435
- } else {
43436
- const s = this.value.includes(e.value);
43437
- this.value = s ? this.value.filter((i2) => i2 !== e.value) : [...this.value, e.value];
43438
- }
43439
- }
43440
- constructor(e) {
43441
- super(e, false);
43442
- const { options: s } = e;
43443
- this.#t = e.selectableGroups !== false, this.options = Object.entries(s).flatMap(([i2, r]) => [{ value: i2, group: true, label: i2 }, ...r.map((n) => ({ ...n, group: i2 }))]), this.value = [...e.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: i2 }) => i2 === e.cursorAt), this.#t ? 0 : 1), this.on("cursor", (i2) => {
43444
- switch (i2) {
43445
- case "left":
43446
- case "up": {
43447
- this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
43448
- const r = this.options[this.cursor]?.group === true;
43449
- !this.#t && r && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
43450
- break;
43451
- }
43452
- case "down":
43453
- case "right": {
43454
- this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
43455
- const r = this.options[this.cursor]?.group === true;
43456
- !this.#t && r && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
43457
- break;
43458
- }
43459
- case "space":
43460
- this.toggleValue();
43461
- break;
43462
- }
43463
- });
43464
- }
43465
- }
43466
-
43467
- // ../../node_modules/@clack/prompts/dist/index.mjs
43468
- import { styleText as t, stripVTControlCharacters as ue } from "node:util";
43469
- import N2 from "node:process";
43470
- var import_sisteransi2 = __toESM(require_src(), 1);
43471
- function pt2() {
43472
- return N2.platform !== "win32" ? N2.env.TERM !== "linux" : !!N2.env.CI || !!N2.env.WT_SESSION || !!N2.env.TERMINUS_SUBLIME || N2.env.ConEmuTask === "{cmd::Cmder}" || N2.env.TERM_PROGRAM === "Terminus-Sublime" || N2.env.TERM_PROGRAM === "vscode" || N2.env.TERM === "xterm-256color" || N2.env.TERM === "alacritty" || N2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
43473
- }
43474
- var ee = pt2();
43475
- var I2 = (e, r) => ee ? e : r;
43476
- var Re = I2("◆", "*");
43477
- var $e = I2("■", "x");
43478
- var de = I2("▲", "x");
43479
- var V = I2("◇", "o");
43480
- var he = I2("┌", "T");
43481
- var h = I2("│", "|");
43482
- var x2 = I2("└", "—");
43483
- var Oe = I2("┐", "T");
43484
- var Pe = I2("┘", "—");
43485
- var z3 = I2("●", ">");
43486
- var H2 = I2("○", " ");
43487
- var te = I2("◻", "[•]");
43488
- var U2 = I2("◼", "[+]");
43489
- var q2 = I2("◻", "[ ]");
43490
- var Ne = I2("▪", "•");
43491
- var se = I2("─", "-");
43492
- var pe = I2("╮", "+");
43493
- var We = I2("├", "+");
43494
- var me = I2("╯", "+");
43495
- var ge = I2("╰", "+");
43496
- var Ge = I2("╭", "+");
43497
- var fe = I2("●", "•");
43498
- var Fe = I2("◆", "*");
43499
- var ye = I2("▲", "!");
43500
- var Ee = I2("■", "x");
43501
- var yt2 = { limit: 1 / 0, ellipsis: "" };
43502
- var Et2 = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
43503
- var Ce = "\x07";
43504
- var ke = "[";
43505
- var wt2 = "]";
43506
- var Se = `${wt2}8;;`;
43507
- var He = new RegExp(`(?:\\${ke}(?<code>\\d+)m|\\${Se}(?<uri>.*)${Ce})`, "y");
43508
- var ze = { light: I2("─", "-"), heavy: I2("━", "="), block: I2("█", "#") };
43509
- var Qe = `${t("gray", h)} `;
43510
-
43511
43156
  // ../auth/src/utils/envFile.ts
43512
43157
  init_src();
43513
43158
  init_src2();
43514
- var DEFAULT_AUTH_FILENAME = ".auth";
43515
- var DEFAULT_AUTH_DIR = ".uipath";
43516
- var DEFAULT_ENV_FILENAME = `${DEFAULT_AUTH_DIR}/${DEFAULT_AUTH_FILENAME}`;
43159
+ var DEFAULT_ENV_FILENAME = `${UIPATH_HOME_DIR}/${AUTH_FILENAME}`;
43517
43160
  var resolveEnvFilePathAsync = async (envFilePath = DEFAULT_ENV_FILENAME) => {
43518
43161
  const fs7 = getFileSystem();
43519
43162
  if (fs7.path.isAbsolute(envFilePath)) {
@@ -43681,11 +43324,7 @@ var getUserIdFromToken = (accessToken) => {
43681
43324
  }
43682
43325
  };
43683
43326
  var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
43684
- const {
43685
- envFilePath = DEFAULT_ENV_FILENAME,
43686
- log = { verbose: false, format: "text", level: 1 },
43687
- ensureTokenValidityMinutes
43688
- } = options;
43327
+ const { envFilePath = DEFAULT_ENV_FILENAME, ensureTokenValidityMinutes } = options;
43689
43328
  const {
43690
43329
  resolveEnvFilePath = resolveEnvFilePathAsync,
43691
43330
  loadEnvFile = loadEnvFileAsync,
@@ -43697,7 +43336,7 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
43697
43336
  try {
43698
43337
  const { absolutePath, errorMessage } = await resolveEnvFilePath(envFilePath);
43699
43338
  if (absolutePath === undefined) {
43700
- logger.error(errorMessage ?? "Failed to resolve env file path");
43339
+ logger.debug(errorMessage ?? "Failed to resolve env file path");
43701
43340
  return { loginStatus: "Not logged in" };
43702
43341
  }
43703
43342
  const credentials = await loadEnvFile({ envPath: absolutePath });
@@ -43716,8 +43355,7 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
43716
43355
  const refreshed = await refreshTokenFn({
43717
43356
  refreshToken,
43718
43357
  tokenEndpoint: config2.tokenEndpoint,
43719
- clientId: config2.clientId,
43720
- log
43358
+ clientId: config2.clientId
43721
43359
  });
43722
43360
  accessToken = refreshed.accessToken;
43723
43361
  refreshToken = refreshed.refreshToken;
@@ -43757,7 +43395,6 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
43757
43395
  if (result.loginStatus === "Logged in") {
43758
43396
  const userId = getUserIdFromToken(accessToken);
43759
43397
  const defaultProps = {
43760
- sessionId,
43761
43398
  ...userId ? { userId } : {},
43762
43399
  ...result.tenantId ? { tenantId: result.tenantId } : {},
43763
43400
  ...result.organizationId ? { organizationId: result.organizationId } : {},
@@ -43874,9 +43511,13 @@ async function executeOperation(options, connectionId, objectName, httpMethod =
43874
43511
  function folderOverride(folderKey) {
43875
43512
  if (!folderKey)
43876
43513
  return;
43877
- return {
43878
- headers: { "x-uipath-folderkey": folderKey }
43879
- };
43514
+ return async ({ init }) => ({
43515
+ ...init,
43516
+ headers: {
43517
+ ...init.headers,
43518
+ "x-uipath-folderkey": folderKey
43519
+ }
43520
+ });
43880
43521
  }
43881
43522
  // src/scripts/generate-sdk.ts
43882
43523
  import { execSync } from "node:child_process";