@uipath/vertical-solutions-tool 1.1.0 → 1.195.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 (2) hide show
  1. package/dist/tool.js +1174 -388
  2. package/package.json +36 -47
package/dist/tool.js CHANGED
@@ -680,6 +680,7 @@ var init_open = __esm(() => {
680
680
  });
681
681
 
682
682
  // ../filesystem/src/node.ts
683
+ import { randomUUID } from "node:crypto";
683
684
  import { existsSync } from "node:fs";
684
685
  import * as fs6 from "node:fs/promises";
685
686
  import * as os2 from "node:os";
@@ -761,6 +762,90 @@ class NodeFileSystem {
761
762
  async mkdir(dirPath) {
762
763
  await fs6.mkdir(dirPath, { recursive: true });
763
764
  }
765
+ async acquireLock(lockPath) {
766
+ const canonicalPath = await this.canonicalizeLockTarget(lockPath);
767
+ const lockFile = `${canonicalPath}.lock`;
768
+ const ownerId = randomUUID();
769
+ const start = Date.now();
770
+ while (true) {
771
+ try {
772
+ await fs6.writeFile(lockFile, ownerId, { flag: "wx" });
773
+ return this.createLockRelease(lockFile, ownerId);
774
+ } catch (error) {
775
+ if (!this.hasErrnoCode(error, "EEXIST")) {
776
+ throw error;
777
+ }
778
+ const stats = await fs6.stat(lockFile).catch(() => null);
779
+ if (stats && Date.now() - stats.mtimeMs > LOCK_STALE_MS) {
780
+ const reclaimed = await fs6.rm(lockFile, { force: true }).then(() => true).catch(() => false);
781
+ if (reclaimed)
782
+ continue;
783
+ }
784
+ if (Date.now() - start > LOCK_MAX_WAIT_MS) {
785
+ throw new Error(`ELOCKED: timed out waiting for lock on ${canonicalPath}`);
786
+ }
787
+ await new Promise((resolve2) => setTimeout(resolve2, LOCK_RETRY_MIN_MS + Math.random() * LOCK_RETRY_JITTER_MS));
788
+ }
789
+ }
790
+ }
791
+ async canonicalizeLockTarget(lockPath) {
792
+ const absolute = path2.resolve(lockPath);
793
+ const fullReal = await fs6.realpath(absolute).catch(() => null);
794
+ if (fullReal)
795
+ return fullReal;
796
+ const parent = path2.dirname(absolute);
797
+ const base = path2.basename(absolute);
798
+ const canonicalParent = await fs6.realpath(parent).catch(() => parent);
799
+ return path2.join(canonicalParent, base);
800
+ }
801
+ createLockRelease(lockFile, ownerId) {
802
+ const heartbeatStart = Date.now();
803
+ let heartbeatTimer;
804
+ let stopped = false;
805
+ const stopHeartbeat = () => {
806
+ stopped = true;
807
+ if (heartbeatTimer)
808
+ clearTimeout(heartbeatTimer);
809
+ };
810
+ const scheduleNextHeartbeat = () => {
811
+ if (stopped)
812
+ return;
813
+ if (Date.now() - heartbeatStart >= LOCK_MAX_HOLD_MS) {
814
+ stopped = true;
815
+ return;
816
+ }
817
+ heartbeatTimer = setTimeout(() => {
818
+ runHeartbeat();
819
+ }, LOCK_HEARTBEAT_MS);
820
+ heartbeatTimer.unref?.();
821
+ };
822
+ const runHeartbeat = async () => {
823
+ if (stopped)
824
+ return;
825
+ const current = await fs6.readFile(lockFile, "utf-8").catch(() => null);
826
+ if (stopped)
827
+ return;
828
+ if (current !== ownerId) {
829
+ stopped = true;
830
+ return;
831
+ }
832
+ const now = Date.now() / 1000;
833
+ await fs6.utimes(lockFile, now, now).catch(() => {});
834
+ scheduleNextHeartbeat();
835
+ };
836
+ scheduleNextHeartbeat();
837
+ let released = false;
838
+ return async () => {
839
+ if (released)
840
+ return;
841
+ released = true;
842
+ stopHeartbeat();
843
+ const current = await fs6.readFile(lockFile, "utf-8").catch(() => null);
844
+ if (current === ownerId) {
845
+ await fs6.rm(lockFile, { force: true });
846
+ }
847
+ };
848
+ }
764
849
  async rm(filePath) {
765
850
  await fs6.rm(filePath, { recursive: true, force: true });
766
851
  }
@@ -806,9 +891,13 @@ class NodeFileSystem {
806
891
  }
807
892
  }
808
893
  isEnoent(error) {
809
- return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
894
+ return this.hasErrnoCode(error, "ENOENT");
895
+ }
896
+ hasErrnoCode(error, code) {
897
+ return typeof error === "object" && error !== null && "code" in error && error.code === code;
810
898
  }
811
899
  }
900
+ 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;
812
901
  var init_node = __esm(() => {
813
902
  init_open();
814
903
  });
@@ -3234,7 +3323,7 @@ function isBrowser() {
3234
3323
 
3235
3324
  // ../../node_modules/@uipath/coreipc/index.js
3236
3325
  var require_coreipc = __commonJS((exports, module) => {
3237
- var __dirname = "/Users/alexandru.oltean/github/cli/node_modules/@uipath/coreipc";
3326
+ var __dirname = "/home/runner/work/cli/cli/node_modules/@uipath/coreipc";
3238
3327
  /*! For license information please see index.js.LICENSE.txt */
3239
3328
  (function(e, t) {
3240
3329
  typeof exports == "object" && typeof module == "object" ? module.exports = t() : typeof define == "function" && define.amd ? define([], t) : typeof exports == "object" ? exports.ipc = t() : e.ipc = t();
@@ -21426,6 +21515,10 @@ var require_dist = __commonJS((exports) => {
21426
21515
  exports.RobotProxyConstructor = RobotProxyConstructor;
21427
21516
  __exportStar(require_agent(), exports);
21428
21517
  });
21518
+ // ../auth/src/server.ts
21519
+ var init_server = __esm(() => {
21520
+ init_constants();
21521
+ });
21429
21522
 
21430
21523
  // ../../node_modules/@opentelemetry/api/build/src/version.js
21431
21524
  var require_version = __commonJS((exports) => {
@@ -22907,7 +23000,7 @@ var require_src = __commonJS((exports) => {
22907
23000
  };
22908
23001
  });
22909
23002
 
22910
- // ../../node_modules/@opentelemetry/api-logs/build/src/types/LogRecord.js
23003
+ // ../../node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/api-logs/build/src/types/LogRecord.js
22911
23004
  var require_LogRecord = __commonJS((exports) => {
22912
23005
  Object.defineProperty(exports, "__esModule", { value: true });
22913
23006
  exports.SeverityNumber = undefined;
@@ -22941,7 +23034,7 @@ var require_LogRecord = __commonJS((exports) => {
22941
23034
  })(SeverityNumber = exports.SeverityNumber || (exports.SeverityNumber = {}));
22942
23035
  });
22943
23036
 
22944
- // ../../node_modules/@opentelemetry/api-logs/build/src/NoopLogger.js
23037
+ // ../../node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/api-logs/build/src/NoopLogger.js
22945
23038
  var require_NoopLogger = __commonJS((exports) => {
22946
23039
  Object.defineProperty(exports, "__esModule", { value: true });
22947
23040
  exports.NOOP_LOGGER = exports.NoopLogger = undefined;
@@ -22953,7 +23046,7 @@ var require_NoopLogger = __commonJS((exports) => {
22953
23046
  exports.NOOP_LOGGER = new NoopLogger;
22954
23047
  });
22955
23048
 
22956
- // ../../node_modules/@opentelemetry/api-logs/build/src/NoopLoggerProvider.js
23049
+ // ../../node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/api-logs/build/src/NoopLoggerProvider.js
22957
23050
  var require_NoopLoggerProvider = __commonJS((exports) => {
22958
23051
  Object.defineProperty(exports, "__esModule", { value: true });
22959
23052
  exports.NOOP_LOGGER_PROVIDER = exports.NoopLoggerProvider = undefined;
@@ -22968,7 +23061,7 @@ var require_NoopLoggerProvider = __commonJS((exports) => {
22968
23061
  exports.NOOP_LOGGER_PROVIDER = new NoopLoggerProvider;
22969
23062
  });
22970
23063
 
22971
- // ../../node_modules/@opentelemetry/api-logs/build/src/ProxyLogger.js
23064
+ // ../../node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/api-logs/build/src/ProxyLogger.js
22972
23065
  var require_ProxyLogger = __commonJS((exports) => {
22973
23066
  Object.defineProperty(exports, "__esModule", { value: true });
22974
23067
  exports.ProxyLogger = undefined;
@@ -22999,7 +23092,7 @@ var require_ProxyLogger = __commonJS((exports) => {
22999
23092
  exports.ProxyLogger = ProxyLogger;
23000
23093
  });
23001
23094
 
23002
- // ../../node_modules/@opentelemetry/api-logs/build/src/ProxyLoggerProvider.js
23095
+ // ../../node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/api-logs/build/src/ProxyLoggerProvider.js
23003
23096
  var require_ProxyLoggerProvider = __commonJS((exports) => {
23004
23097
  Object.defineProperty(exports, "__esModule", { value: true });
23005
23098
  exports.ProxyLoggerProvider = undefined;
@@ -23026,14 +23119,14 @@ var require_ProxyLoggerProvider = __commonJS((exports) => {
23026
23119
  exports.ProxyLoggerProvider = ProxyLoggerProvider;
23027
23120
  });
23028
23121
 
23029
- // ../../node_modules/@opentelemetry/api-logs/build/src/platform/node/globalThis.js
23122
+ // ../../node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/api-logs/build/src/platform/node/globalThis.js
23030
23123
  var require_globalThis = __commonJS((exports) => {
23031
23124
  Object.defineProperty(exports, "__esModule", { value: true });
23032
23125
  exports._globalThis = undefined;
23033
23126
  exports._globalThis = typeof globalThis === "object" ? globalThis : global;
23034
23127
  });
23035
23128
 
23036
- // ../../node_modules/@opentelemetry/api-logs/build/src/platform/node/index.js
23129
+ // ../../node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/api-logs/build/src/platform/node/index.js
23037
23130
  var require_node = __commonJS((exports) => {
23038
23131
  Object.defineProperty(exports, "__esModule", { value: true });
23039
23132
  exports._globalThis = undefined;
@@ -23043,7 +23136,7 @@ var require_node = __commonJS((exports) => {
23043
23136
  } });
23044
23137
  });
23045
23138
 
23046
- // ../../node_modules/@opentelemetry/api-logs/build/src/platform/index.js
23139
+ // ../../node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/api-logs/build/src/platform/index.js
23047
23140
  var require_platform = __commonJS((exports) => {
23048
23141
  Object.defineProperty(exports, "__esModule", { value: true });
23049
23142
  exports._globalThis = undefined;
@@ -23053,7 +23146,7 @@ var require_platform = __commonJS((exports) => {
23053
23146
  } });
23054
23147
  });
23055
23148
 
23056
- // ../../node_modules/@opentelemetry/api-logs/build/src/internal/global-utils.js
23149
+ // ../../node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/api-logs/build/src/internal/global-utils.js
23057
23150
  var require_global_utils2 = __commonJS((exports) => {
23058
23151
  Object.defineProperty(exports, "__esModule", { value: true });
23059
23152
  exports.API_BACKWARDS_COMPATIBILITY_VERSION = exports.makeGetter = exports._global = exports.GLOBAL_LOGS_API_KEY = undefined;
@@ -23067,7 +23160,7 @@ var require_global_utils2 = __commonJS((exports) => {
23067
23160
  exports.API_BACKWARDS_COMPATIBILITY_VERSION = 1;
23068
23161
  });
23069
23162
 
23070
- // ../../node_modules/@opentelemetry/api-logs/build/src/api/logs.js
23163
+ // ../../node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/api-logs/build/src/api/logs.js
23071
23164
  var require_logs = __commonJS((exports) => {
23072
23165
  Object.defineProperty(exports, "__esModule", { value: true });
23073
23166
  exports.LogsAPI = undefined;
@@ -23108,7 +23201,7 @@ var require_logs = __commonJS((exports) => {
23108
23201
  exports.LogsAPI = LogsAPI;
23109
23202
  });
23110
23203
 
23111
- // ../../node_modules/@opentelemetry/api-logs/build/src/index.js
23204
+ // ../../node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/api-logs/build/src/index.js
23112
23205
  var require_src2 = __commonJS((exports) => {
23113
23206
  Object.defineProperty(exports, "__esModule", { value: true });
23114
23207
  exports.logs = exports.ProxyLoggerProvider = exports.ProxyLogger = exports.NoopLoggerProvider = exports.NOOP_LOGGER_PROVIDER = exports.NoopLogger = exports.NOOP_LOGGER = exports.SeverityNumber = undefined;
@@ -27362,7 +27455,8 @@ var require_src6 = __commonJS((exports) => {
27362
27455
  // package.json
27363
27456
  var package_default = {
27364
27457
  name: "@uipath/vertical-solutions-tool",
27365
- version: "1.1.0",
27458
+ license: "MIT",
27459
+ version: "1.195.0",
27366
27460
  description: "Scaffold and generate Vertical Solution projects.",
27367
27461
  private: false,
27368
27462
  repository: {
@@ -27407,7 +27501,7 @@ var package_default = {
27407
27501
  "@uipath/auth": "workspace:*",
27408
27502
  "@uipath/common": "workspace:*",
27409
27503
  "@uipath/filesystem": "workspace:*",
27410
- "@uipath/uipath-typescript": "^1.3.7",
27504
+ "@uipath/uipath-typescript": "^1.3.11",
27411
27505
  "@inquirer/prompts": "^8.3.2",
27412
27506
  "@types/node": "^25.5.2",
27413
27507
  commander: "^14.0.3",
@@ -32588,6 +32682,60 @@ function escapeNonAscii(jsonText) {
32588
32682
  function needsAsciiSafeJson(sink) {
32589
32683
  return process.platform === "win32" && !sink.capabilities.isInteractive;
32590
32684
  }
32685
+ function isPlainRecord(value) {
32686
+ if (value === null || typeof value !== "object")
32687
+ return false;
32688
+ const prototype = Object.getPrototypeOf(value);
32689
+ return prototype === Object.prototype || prototype === null;
32690
+ }
32691
+ function toLowerCamelCaseKey(key) {
32692
+ if (!key)
32693
+ return key;
32694
+ if (/[_\-\s]/.test(key)) {
32695
+ const [firstPart, ...restParts] = key.split(/[_\-\s]+/).filter(Boolean);
32696
+ if (!firstPart)
32697
+ return key;
32698
+ return [
32699
+ toLowerCamelCaseSimpleKey(firstPart),
32700
+ ...restParts.map((part) => {
32701
+ const normalized = toLowerCamelCaseSimpleKey(part);
32702
+ return normalized.charAt(0).toUpperCase() + normalized.slice(1);
32703
+ })
32704
+ ].join("");
32705
+ }
32706
+ return toLowerCamelCaseSimpleKey(key);
32707
+ }
32708
+ function toLowerCamelCaseSimpleKey(key) {
32709
+ if (/^[A-Z0-9]+$/.test(key))
32710
+ return key.toLowerCase();
32711
+ return key.replace(/^[A-Z]+(?=[A-Z][a-z]|\d|$)|^[A-Z]/, (match) => match.toLowerCase());
32712
+ }
32713
+ function toPascalCaseKey(key) {
32714
+ const lowerCamelKey = toLowerCamelCaseKey(key);
32715
+ return lowerCamelKey ? lowerCamelKey.charAt(0).toUpperCase() + lowerCamelKey.slice(1) : lowerCamelKey;
32716
+ }
32717
+ function toPascalCaseData(value) {
32718
+ if (Array.isArray(value))
32719
+ return value.map(toPascalCaseData);
32720
+ if (!isPlainRecord(value))
32721
+ return value;
32722
+ const result = {};
32723
+ for (const [key, nestedValue] of Object.entries(value)) {
32724
+ result[toPascalCaseKey(key)] = toPascalCaseData(nestedValue);
32725
+ }
32726
+ return result;
32727
+ }
32728
+ function normalizeDataKeys(data) {
32729
+ return toPascalCaseData(data);
32730
+ }
32731
+ function normalizeOutputKeys(data) {
32732
+ const result = {};
32733
+ for (const [key, value] of Object.entries(data)) {
32734
+ const pascalKey = toPascalCaseKey(key);
32735
+ result[pascalKey] = pascalKey === "Data" ? value : toPascalCaseData(value);
32736
+ }
32737
+ return result;
32738
+ }
32591
32739
  function printOutput(data, format = "json", logFn, asciiSafe = false) {
32592
32740
  if (!data) {
32593
32741
  logFn("Empty response object. No data to display.");
@@ -32650,7 +32798,7 @@ function wrapText(text, width) {
32650
32798
  function printTable(data, logFn, externalLogValue) {
32651
32799
  if (data.length === 0)
32652
32800
  return;
32653
- const keys = Object.keys(data[0]).filter((key) => key !== "Code" && key !== "Log");
32801
+ const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
32654
32802
  const maxWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
32655
32803
  const header = keys.map((key, i2) => key.padEnd(maxWidths[i2])).join(" | ");
32656
32804
  logFn(header);
@@ -32665,7 +32813,7 @@ function printTable(data, logFn, externalLogValue) {
32665
32813
  }
32666
32814
  }
32667
32815
  function printVerticalTable(data, logFn = console.log, externalLogValue) {
32668
- const keys = Object.keys(data).filter((key) => key !== "Code" && key !== "Log");
32816
+ const keys = Object.keys(data).filter((key) => !["code", "log"].includes(key.toLowerCase()));
32669
32817
  if (keys.length === 0)
32670
32818
  return;
32671
32819
  const maxKeyWidth = Math.max(...keys.map((key) => key.length));
@@ -32681,7 +32829,7 @@ function printVerticalTable(data, logFn = console.log, externalLogValue) {
32681
32829
  function printResizableTable(data, logFn = console.log, externalLogValue) {
32682
32830
  if (data.length === 0)
32683
32831
  return;
32684
- const keys = Object.keys(data[0]).filter((key) => key !== "Code" && key !== "Log");
32832
+ const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
32685
32833
  if (keys.length === 0)
32686
32834
  return;
32687
32835
  if (!process.stdout.isTTY) {
@@ -32757,8 +32905,26 @@ function printResizableTable(data, logFn = console.log, externalLogValue) {
32757
32905
  function toYaml(data) {
32758
32906
  return dump(data);
32759
32907
  }
32908
+ class FilterEvaluationError extends Error {
32909
+ __brand = "FilterEvaluationError";
32910
+ filter;
32911
+ instructions;
32912
+ result = RESULTS.ValidationError;
32913
+ constructor(filter, cause) {
32914
+ const underlying = cause instanceof Error ? cause.message : String(cause);
32915
+ super(`Filter '${filter}' failed to evaluate: ${underlying}`);
32916
+ this.name = "FilterEvaluationError";
32917
+ this.filter = filter;
32918
+ 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(@)'.";
32919
+ }
32920
+ }
32760
32921
  function applyFilter(data, filter) {
32761
- const result = search(data, filter);
32922
+ let result;
32923
+ try {
32924
+ result = search(data, filter);
32925
+ } catch (err) {
32926
+ throw new FilterEvaluationError(filter, err);
32927
+ }
32762
32928
  if (result == null)
32763
32929
  return [];
32764
32930
  if (Array.isArray(result)) {
@@ -32775,13 +32941,18 @@ function applyFilter(data, filter) {
32775
32941
  }
32776
32942
  var OutputFormatter;
32777
32943
  ((OutputFormatter) => {
32778
- function success(data) {
32944
+ function success(data, options) {
32779
32945
  data.Log ??= getLogFilePath() || undefined;
32946
+ const normalize = !options?.preserveDataKeys;
32947
+ if (normalize) {
32948
+ data.Data = normalizeDataKeys(data.Data);
32949
+ }
32780
32950
  const filter = getOutputFilter();
32781
32951
  if (filter) {
32782
- data.Data = applyFilter(data.Data, filter);
32952
+ const filtered = applyFilter(data.Data, filter);
32953
+ data.Data = normalize ? normalizeDataKeys(filtered) : filtered;
32783
32954
  }
32784
- logOutput(data, getOutputFormat());
32955
+ logOutput(normalizeOutputKeys(data), getOutputFormat());
32785
32956
  }
32786
32957
  OutputFormatter.success = success;
32787
32958
  function error(data) {
@@ -32791,7 +32962,7 @@ var OutputFormatter;
32791
32962
  result: data.Result,
32792
32963
  message: data.Message
32793
32964
  });
32794
- logOutput(data, getOutputFormat());
32965
+ logOutput(normalizeOutputKeys(data), getOutputFormat());
32795
32966
  }
32796
32967
  OutputFormatter.error = error;
32797
32968
  function emitList(code, items, opts) {
@@ -32812,13 +32983,14 @@ var OutputFormatter;
32812
32983
  function log(data) {
32813
32984
  const format = getOutputFormat();
32814
32985
  const sink = getOutputSink();
32986
+ const normalized = toPascalCaseData(data);
32815
32987
  if (format === "json") {
32816
- const json2 = JSON.stringify(data);
32988
+ const json2 = JSON.stringify(normalized);
32817
32989
  const safe = needsAsciiSafeJson(sink) ? escapeNonAscii(json2) : json2;
32818
32990
  sink.writeErr(`${safe}
32819
32991
  `);
32820
32992
  } else {
32821
- for (const [key, value] of Object.entries(data)) {
32993
+ for (const [key, value] of Object.entries(normalized)) {
32822
32994
  sink.writeErr(`${key}: ${value}
32823
32995
  `);
32824
32996
  }
@@ -32827,12 +32999,16 @@ var OutputFormatter;
32827
32999
  OutputFormatter.log = log;
32828
33000
  function formatToString(data) {
32829
33001
  const filter = getOutputFilter();
32830
- if (filter && "Data" in data && data.Data != null) {
32831
- data.Data = applyFilter(data.Data, filter);
33002
+ if ("Data" in data && data.Data != null) {
33003
+ data.Data = normalizeDataKeys(data.Data);
33004
+ if (filter) {
33005
+ data.Data = normalizeDataKeys(applyFilter(data.Data, filter));
33006
+ }
32832
33007
  }
33008
+ const output = normalizeOutputKeys(data);
32833
33009
  const lines = [];
32834
33010
  const sink = getOutputSink();
32835
- printOutput(data, getOutputFormat(), (msg) => {
33011
+ printOutput(output, getOutputFormat(), (msg) => {
32836
33012
  lines.push(msg);
32837
33013
  }, needsAsciiSafeJson(sink));
32838
33014
  return lines.join(`
@@ -34243,6 +34419,22 @@ JSONPath.prototype.safeVm = {
34243
34419
  Script: SafeScript
34244
34420
  };
34245
34421
  JSONPath.prototype.vm = vm;
34422
+ // ../common/src/polling/types.ts
34423
+ var PollOutcome = {
34424
+ Completed: "completed",
34425
+ Timeout: "timeout",
34426
+ Interrupted: "interrupted",
34427
+ Aborted: "aborted",
34428
+ Failed: "failed"
34429
+ };
34430
+
34431
+ // ../common/src/polling/poll-failure-mapping.ts
34432
+ var REASON_BY_OUTCOME = {
34433
+ [PollOutcome.Timeout]: "poll_timeout",
34434
+ [PollOutcome.Failed]: "poll_failed",
34435
+ [PollOutcome.Interrupted]: "poll_failed",
34436
+ [PollOutcome.Aborted]: "poll_aborted"
34437
+ };
34246
34438
  // ../common/src/polling/terminal-statuses.ts
34247
34439
  var TERMINAL_STATUSES = new Set([
34248
34440
  "completed",
@@ -34270,6 +34462,8 @@ var ScreenLogger;
34270
34462
  }
34271
34463
  ScreenLogger.progress = progress;
34272
34464
  })(ScreenLogger ||= {});
34465
+ // ../common/src/sdk-user-agent.ts
34466
+ var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
34273
34467
  // ../common/src/tool-provider.ts
34274
34468
  var factorySlot = singleton("PackagerFactoryProvider");
34275
34469
  // ../common/src/telemetry/pii-redactor.ts
@@ -34452,13 +34646,17 @@ Command.prototype.trackedAction = function(context, fn, properties) {
34452
34646
  const [error] = await catchError(fn(...args));
34453
34647
  if (error) {
34454
34648
  errorMessage = error instanceof Error ? error.message : String(error);
34455
- logger.error(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
34649
+ logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
34650
+ const typed = error;
34651
+ const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
34652
+ const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
34653
+ const finalResult = customResult ?? RESULTS.Failure;
34456
34654
  OutputFormatter.error({
34457
- Result: RESULTS.Failure,
34655
+ Result: finalResult,
34458
34656
  Message: errorMessage,
34459
- Instructions: "An unexpected error occurred. Run with --log-level debug for details."
34657
+ Instructions: customInstructions ?? "An unexpected error occurred. Run with --log-level debug for details."
34460
34658
  });
34461
- context.exit(1);
34659
+ context.exit(EXIT_CODES[finalResult]);
34462
34660
  }
34463
34661
  const durationMs = performance.now() - startTime;
34464
34662
  const success = !error && (process.exitCode === undefined || process.exitCode === 0);
@@ -54982,32 +55180,7 @@ class InvalidBaseUrlError extends Error {
54982
55180
  this.name = "InvalidBaseUrlError";
54983
55181
  }
54984
55182
  }
54985
- var DEFAULT_SCOPES = [
54986
- "offline_access",
54987
- "ProcessMining",
54988
- "OrchestratorApiUserAccess",
54989
- "StudioWebBackend",
54990
- "IdentityServerApi",
54991
- "ConnectionService",
54992
- "DataService",
54993
- "DataServiceApiUserAccess",
54994
- "DocumentUnderstanding",
54995
- "EnterpriseContextService",
54996
- "Directory",
54997
- "JamJamApi",
54998
- "LLMGateway",
54999
- "LLMOps",
55000
- "OMS",
55001
- "RCS.FolderAuthorization",
55002
- "RCS.TagsManagement",
55003
- "TestmanagerApiUserAccess",
55004
- "AutomationSolutions",
55005
- "StudioWebTypeCacheService",
55006
- "Docs.GPT.Search",
55007
- "Insights",
55008
- "ReferenceToken",
55009
- "Audit.Read"
55010
- ];
55183
+ var DEFAULT_SCOPES = ["openid", "profile", "offline_access"];
55011
55184
  var normalizeAndValidateBaseUrl = (rawUrl) => {
55012
55185
  let baseUrl = rawUrl;
55013
55186
  if (baseUrl.endsWith("/identity_/")) {
@@ -55057,7 +55230,8 @@ var resolveConfigAsync = async ({
55057
55230
  if (!clientSecret && fileAuth.clientSecret) {
55058
55231
  clientSecret = fileAuth.clientSecret;
55059
55232
  }
55060
- const scopes = customScopes && customScopes.length > 0 ? customScopes : fileAuth.scopes && fileAuth.scopes.length > 0 ? fileAuth.scopes : DEFAULT_SCOPES;
55233
+ const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && Boolean(clientSecret);
55234
+ const scopes = customScopes && customScopes.length > 0 ? customScopes : fileAuth.scopes && fileAuth.scopes.length > 0 ? fileAuth.scopes : isExternalAppAuth ? [] : DEFAULT_SCOPES;
55061
55235
  return {
55062
55236
  clientId,
55063
55237
  clientSecret,
@@ -55557,6 +55731,129 @@ function normalizeTokenRefreshFailure() {
55557
55731
  function normalizeTokenRefreshUnavailableFailure() {
55558
55732
  return "token refresh failed before authentication completed";
55559
55733
  }
55734
+ function errorMessage(error52) {
55735
+ return error52 instanceof Error ? error52.message : String(error52);
55736
+ }
55737
+ function computeExpirationThreshold(ensureTokenValidityMinutes) {
55738
+ return new Date(Date.now() + (ensureTokenValidityMinutes ?? 0) * 60 * 1000);
55739
+ }
55740
+ async function runRefreshLocked(inputs) {
55741
+ const {
55742
+ absolutePath,
55743
+ refreshToken: callerRefreshToken,
55744
+ customAuthority,
55745
+ ensureTokenValidityMinutes,
55746
+ loadEnvFile,
55747
+ saveEnvFile,
55748
+ refreshFn,
55749
+ resolveConfig
55750
+ } = inputs;
55751
+ const expirationThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
55752
+ let fresh;
55753
+ try {
55754
+ fresh = await loadEnvFile({ envPath: absolutePath });
55755
+ } catch (error52) {
55756
+ return {
55757
+ kind: "fail",
55758
+ status: {
55759
+ loginStatus: "Refresh Failed",
55760
+ hint: "Could not read the auth file while refreshing. Retry, or run 'uip login' to re-authenticate.",
55761
+ tokenRefresh: {
55762
+ attempted: false,
55763
+ success: false,
55764
+ errorMessage: `auth file read failed: ${errorMessage(error52)}`
55765
+ }
55766
+ }
55767
+ };
55768
+ }
55769
+ const freshAccess = fresh.UIPATH_ACCESS_TOKEN;
55770
+ const freshExp = freshAccess ? getTokenExpiration(freshAccess) : undefined;
55771
+ if (freshAccess && freshExp && freshExp > expirationThreshold) {
55772
+ return {
55773
+ kind: "ok",
55774
+ accessToken: freshAccess,
55775
+ refreshToken: fresh.UIPATH_REFRESH_TOKEN ?? callerRefreshToken,
55776
+ expiration: freshExp,
55777
+ tokenRefresh: { attempted: false, success: true }
55778
+ };
55779
+ }
55780
+ const tokenForIdP = fresh.UIPATH_REFRESH_TOKEN ?? callerRefreshToken;
55781
+ let refreshedAccess;
55782
+ let refreshedRefresh;
55783
+ try {
55784
+ const config2 = await resolveConfig({ customAuthority });
55785
+ const refreshed = await refreshFn({
55786
+ refreshToken: tokenForIdP,
55787
+ tokenEndpoint: config2.tokenEndpoint,
55788
+ clientId: config2.clientId,
55789
+ expectedAuthority: customAuthority
55790
+ });
55791
+ refreshedAccess = refreshed.accessToken;
55792
+ refreshedRefresh = refreshed.refreshToken;
55793
+ } catch (error52) {
55794
+ const isOAuthFailure = isTokenRefreshOAuthFailure(error52);
55795
+ 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.";
55796
+ const message = isOAuthFailure ? normalizeTokenRefreshFailure() : normalizeTokenRefreshUnavailableFailure();
55797
+ return {
55798
+ kind: "fail",
55799
+ status: {
55800
+ loginStatus: "Refresh Failed",
55801
+ hint,
55802
+ tokenRefresh: {
55803
+ attempted: true,
55804
+ success: false,
55805
+ errorMessage: message
55806
+ }
55807
+ }
55808
+ };
55809
+ }
55810
+ const refreshedExp = getTokenExpiration(refreshedAccess);
55811
+ if (!refreshedExp || refreshedExp <= new Date) {
55812
+ return {
55813
+ kind: "fail",
55814
+ status: {
55815
+ loginStatus: "Refresh Failed",
55816
+ hint: "The identity server returned an unusable token. Run 'uip login' to re-authenticate.",
55817
+ tokenRefresh: {
55818
+ attempted: true,
55819
+ success: false,
55820
+ errorMessage: "refreshed token has no valid expiration claim"
55821
+ }
55822
+ }
55823
+ };
55824
+ }
55825
+ try {
55826
+ await saveEnvFile({
55827
+ envPath: absolutePath,
55828
+ data: {
55829
+ UIPATH_ACCESS_TOKEN: refreshedAccess,
55830
+ UIPATH_REFRESH_TOKEN: refreshedRefresh
55831
+ },
55832
+ merge: true
55833
+ });
55834
+ return {
55835
+ kind: "ok",
55836
+ accessToken: refreshedAccess,
55837
+ refreshToken: refreshedRefresh,
55838
+ expiration: refreshedExp,
55839
+ tokenRefresh: { attempted: true, success: true }
55840
+ };
55841
+ } catch (error52) {
55842
+ const msg = errorMessage(error52);
55843
+ return {
55844
+ kind: "ok",
55845
+ accessToken: refreshedAccess,
55846
+ refreshToken: refreshedRefresh,
55847
+ expiration: refreshedExp,
55848
+ 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.`,
55849
+ tokenRefresh: {
55850
+ attempted: true,
55851
+ success: true,
55852
+ errorMessage: `persistence failed: ${msg}`
55853
+ }
55854
+ };
55855
+ }
55856
+ }
55560
55857
  var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
55561
55858
  const {
55562
55859
  resolveEnvFilePath = resolveEnvFilePathAsync,
@@ -55631,73 +55928,103 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
55631
55928
  let refreshToken = credentials.UIPATH_REFRESH_TOKEN;
55632
55929
  let expiration = getTokenExpiration(accessToken);
55633
55930
  let persistenceWarning;
55931
+ let lockReleaseFailed = false;
55634
55932
  let tokenRefresh;
55635
- const expirationThreshold = new Date(Date.now() + (ensureTokenValidityMinutes ?? 0) * 60 * 1000);
55636
- if (expiration && expiration <= expirationThreshold && refreshToken) {
55637
- let refreshedAccess;
55638
- let refreshedRefresh;
55933
+ const outerThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
55934
+ const tryGlobalCredsHint = async () => {
55935
+ const fs7 = getFs();
55936
+ const globalPath = fs7.path.join(fs7.env.homedir(), envFilePath);
55937
+ if (absolutePath === globalPath)
55938
+ return;
55939
+ if (!await fs7.exists(globalPath))
55940
+ return;
55639
55941
  try {
55640
- const config2 = await resolveConfig({
55641
- customAuthority: credentials.UIPATH_URL
55642
- });
55643
- const refreshed = await refreshTokenFn({
55644
- refreshToken,
55645
- tokenEndpoint: config2.tokenEndpoint,
55646
- clientId: config2.clientId,
55647
- expectedAuthority: credentials.UIPATH_URL
55648
- });
55649
- refreshedAccess = refreshed.accessToken;
55650
- refreshedRefresh = refreshed.refreshToken;
55651
- } catch (error52) {
55652
- const isOAuthFailure = isTokenRefreshOAuthFailure(error52);
55653
- 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.";
55654
- const errorMessage = isOAuthFailure ? normalizeTokenRefreshFailure() : normalizeTokenRefreshUnavailableFailure();
55655
- return {
55656
- loginStatus: "Refresh Failed",
55657
- hint,
55658
- tokenRefresh: {
55659
- attempted: true,
55660
- success: false,
55661
- errorMessage
55662
- }
55663
- };
55942
+ const globalCreds = await loadEnvFile({ envPath: globalPath });
55943
+ if (!globalCreds.UIPATH_ACCESS_TOKEN)
55944
+ return;
55945
+ const globalExp = getTokenExpiration(globalCreds.UIPATH_ACCESS_TOKEN);
55946
+ if (globalExp && globalExp <= new Date)
55947
+ return;
55948
+ 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.`;
55949
+ } catch {
55950
+ return;
55664
55951
  }
55665
- const refreshedExp = getTokenExpiration(refreshedAccess);
55666
- if (!refreshedExp || refreshedExp <= new Date) {
55952
+ };
55953
+ if (expiration && expiration <= outerThreshold && refreshToken) {
55954
+ let release;
55955
+ try {
55956
+ release = await getFs().acquireLock(absolutePath);
55957
+ } catch (error52) {
55958
+ const msg = errorMessage(error52);
55959
+ const globalHint = await tryGlobalCredsHint();
55960
+ if (globalHint) {
55961
+ return {
55962
+ loginStatus: "Expired",
55963
+ accessToken,
55964
+ refreshToken,
55965
+ baseUrl: credentials.UIPATH_URL,
55966
+ organizationName: credentials.UIPATH_ORGANIZATION_NAME,
55967
+ organizationId: credentials.UIPATH_ORGANIZATION_ID,
55968
+ tenantName: credentials.UIPATH_TENANT_NAME,
55969
+ tenantId: credentials.UIPATH_TENANT_ID,
55970
+ expiration,
55971
+ source: "file" /* File */,
55972
+ hint: globalHint,
55973
+ tokenRefresh: {
55974
+ attempted: false,
55975
+ success: false,
55976
+ errorMessage: `lock acquisition failed: ${msg}`
55977
+ }
55978
+ };
55979
+ }
55667
55980
  return {
55668
55981
  loginStatus: "Refresh Failed",
55669
- hint: "The identity server returned an unusable token. Run 'uip login' to re-authenticate.",
55982
+ 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.",
55670
55983
  tokenRefresh: {
55671
- attempted: true,
55984
+ attempted: false,
55672
55985
  success: false,
55673
- errorMessage: "refreshed token has no valid expiration claim"
55986
+ errorMessage: `lock acquisition failed: ${msg}`
55674
55987
  }
55675
55988
  };
55676
55989
  }
55677
- accessToken = refreshedAccess;
55678
- refreshToken = refreshedRefresh;
55679
- expiration = refreshedExp;
55990
+ let lockedFailure;
55680
55991
  try {
55681
- await saveEnvFile({
55682
- envPath: absolutePath,
55683
- data: {
55684
- UIPATH_ACCESS_TOKEN: accessToken,
55685
- UIPATH_REFRESH_TOKEN: refreshToken
55686
- },
55687
- merge: true
55992
+ const outcome = await runRefreshLocked({
55993
+ absolutePath,
55994
+ refreshToken,
55995
+ customAuthority: credentials.UIPATH_URL,
55996
+ ensureTokenValidityMinutes,
55997
+ loadEnvFile,
55998
+ saveEnvFile,
55999
+ refreshFn: refreshTokenFn,
56000
+ resolveConfig
55688
56001
  });
55689
- tokenRefresh = {
55690
- attempted: true,
55691
- success: true
55692
- };
55693
- } catch (error52) {
55694
- const msg = error52 instanceof Error ? error52.message : String(error52);
55695
- 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.`;
55696
- tokenRefresh = {
55697
- attempted: true,
55698
- success: true,
55699
- errorMessage: `persistence failed: ${msg}`
55700
- };
56002
+ if (outcome.kind === "fail") {
56003
+ lockedFailure = outcome.status;
56004
+ } else {
56005
+ accessToken = outcome.accessToken;
56006
+ refreshToken = outcome.refreshToken;
56007
+ expiration = outcome.expiration;
56008
+ tokenRefresh = outcome.tokenRefresh;
56009
+ if (outcome.persistenceWarning) {
56010
+ persistenceWarning = outcome.persistenceWarning;
56011
+ }
56012
+ }
56013
+ } finally {
56014
+ try {
56015
+ await release();
56016
+ } catch {
56017
+ lockReleaseFailed = true;
56018
+ }
56019
+ }
56020
+ if (lockedFailure) {
56021
+ const globalHint = await tryGlobalCredsHint();
56022
+ const base = globalHint ? {
56023
+ ...lockedFailure,
56024
+ loginStatus: "Expired",
56025
+ hint: globalHint
56026
+ } : lockedFailure;
56027
+ return lockReleaseFailed ? { ...base, lockReleaseFailed: true } : base;
55701
56028
  }
55702
56029
  }
55703
56030
  const result = {
@@ -55712,23 +56039,13 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
55712
56039
  expiration,
55713
56040
  source: "file" /* File */,
55714
56041
  ...persistenceWarning ? { hint: persistenceWarning, persistenceFailed: true } : {},
56042
+ ...lockReleaseFailed ? { lockReleaseFailed: true } : {},
55715
56043
  ...tokenRefresh ? { tokenRefresh } : {}
55716
56044
  };
55717
56045
  if (result.loginStatus === "Expired") {
55718
- const fs7 = getFs();
55719
- const globalPath = fs7.path.join(fs7.env.homedir(), envFilePath);
55720
- if (absolutePath !== globalPath && await fs7.exists(globalPath)) {
55721
- try {
55722
- const globalCreds = await loadEnvFile({
55723
- envPath: globalPath
55724
- });
55725
- if (globalCreds.UIPATH_ACCESS_TOKEN) {
55726
- const globalExp = getTokenExpiration(globalCreds.UIPATH_ACCESS_TOKEN);
55727
- if (!globalExp || globalExp > new Date) {
55728
- 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.`;
55729
- }
55730
- }
55731
- } catch {}
56046
+ const globalHint = await tryGlobalCredsHint();
56047
+ if (globalHint) {
56048
+ result.hint = globalHint;
55732
56049
  }
55733
56050
  }
55734
56051
  return result;
@@ -55776,8 +56093,246 @@ var getAuthContext = async (options = {}) => {
55776
56093
  init_src();
55777
56094
  // ../auth/src/logout.ts
55778
56095
  init_src();
55779
- // ../../node_modules/@uipath/uipath-typescript/dist/index.mjs
56096
+
56097
+ // ../auth/src/index.ts
56098
+ init_server();
56099
+
56100
+ // ../../node_modules/@uipath/core-telemetry/dist/index.mjs
55780
56101
  var import_sdk_logs = __toESM(require_src6(), 1);
56102
+ var CONNECTION_STRING = "InstrumentationKey=a6efa11d-1feb-4508-9738-e13e12dcae5e;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=7c58eb1c-9581-4ba6-839e-11725848a037";
56103
+ var VERSION = "Version";
56104
+ var SERVICE = "Service";
56105
+ var CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
56106
+ var CLOUD_TENANT_NAME = "CloudTenantName";
56107
+ var CLOUD_URL = "CloudUrl";
56108
+ var CLOUD_CLIENT_ID = "CloudClientId";
56109
+ var CLOUD_REDIRECT_URI = "CloudRedirectUri";
56110
+ var APP_NAME = "ApplicationName";
56111
+ var UNKNOWN = "";
56112
+ var INSTRUMENTATION_KEY_RE = /InstrumentationKey=([^;]+)/;
56113
+ var INGESTION_ENDPOINT_RE = /IngestionEndpoint=([^;]+)/;
56114
+
56115
+ class ApplicationInsightsEventExporter {
56116
+ constructor(connectionString, tags) {
56117
+ this.connectionString = connectionString;
56118
+ this.tags = tags;
56119
+ }
56120
+ export(logs, resultCallback) {
56121
+ try {
56122
+ for (const log of logs) {
56123
+ this.sendAsCustomEvent(log);
56124
+ }
56125
+ resultCallback({ code: 0 });
56126
+ } catch (error52) {
56127
+ const err = error52 instanceof Error ? error52 : new Error(String(error52));
56128
+ console.debug("Failed to export logs to Application Insights:", err);
56129
+ resultCallback({ code: 1, error: err });
56130
+ }
56131
+ }
56132
+ shutdown() {
56133
+ return Promise.resolve();
56134
+ }
56135
+ sendAsCustomEvent(logRecord) {
56136
+ const eventName = String(logRecord.body);
56137
+ const payload = {
56138
+ name: "Microsoft.ApplicationInsights.Event",
56139
+ time: new Date().toISOString(),
56140
+ iKey: this.extractInstrumentationKey(),
56141
+ data: {
56142
+ baseType: "EventData",
56143
+ baseData: {
56144
+ ver: 2,
56145
+ name: eventName,
56146
+ properties: this.convertAttributesToProperties(logRecord.attributes)
56147
+ }
56148
+ },
56149
+ tags: {
56150
+ "ai.cloud.role": this.tags.cloudRoleName,
56151
+ "ai.cloud.roleInstance": this.tags.cloudRoleInstance
56152
+ }
56153
+ };
56154
+ this.sendToApplicationInsights(payload);
56155
+ }
56156
+ extractInstrumentationKey() {
56157
+ const match = INSTRUMENTATION_KEY_RE.exec(this.connectionString);
56158
+ return match ? match[1] : "";
56159
+ }
56160
+ convertAttributesToProperties(attributes) {
56161
+ const properties = {};
56162
+ for (const [key, value] of Object.entries(attributes ?? {})) {
56163
+ properties[key] = String(value);
56164
+ }
56165
+ return properties;
56166
+ }
56167
+ async sendToApplicationInsights(payload) {
56168
+ try {
56169
+ const ingestionEndpoint = this.extractIngestionEndpoint();
56170
+ if (!ingestionEndpoint) {
56171
+ console.debug("No ingestion endpoint found in connection string");
56172
+ return;
56173
+ }
56174
+ const url2 = `${ingestionEndpoint}/v2/track`;
56175
+ const response = await fetch(url2, {
56176
+ method: "POST",
56177
+ headers: { "Content-Type": "application/json" },
56178
+ body: JSON.stringify(payload)
56179
+ });
56180
+ if (!response.ok) {
56181
+ console.debug(`Failed to send event telemetry: ${response.status} ${response.statusText}`);
56182
+ }
56183
+ } catch (error52) {
56184
+ console.debug("Error sending event telemetry to Application Insights:", error52);
56185
+ }
56186
+ }
56187
+ extractIngestionEndpoint() {
56188
+ const match = INGESTION_ENDPOINT_RE.exec(this.connectionString);
56189
+ return match ? match[1] : "";
56190
+ }
56191
+ }
56192
+
56193
+ class TelemetryClient {
56194
+ constructor() {
56195
+ this.isInitialized = false;
56196
+ }
56197
+ initialize(options) {
56198
+ if (this.isInitialized) {
56199
+ console.debug("Telemetry client has already been initialized");
56200
+ return;
56201
+ }
56202
+ this.isInitialized = true;
56203
+ this.options = options;
56204
+ this.telemetryContext = options.context;
56205
+ try {
56206
+ if (!this.isValidConnectionString(CONNECTION_STRING)) {
56207
+ return;
56208
+ }
56209
+ this.setupTelemetryProvider(CONNECTION_STRING);
56210
+ } catch (error52) {
56211
+ console.debug("Failed to initialize telemetry:", error52);
56212
+ }
56213
+ }
56214
+ track(eventName, name, extraAttributes = {}) {
56215
+ try {
56216
+ if (!this.logger) {
56217
+ return;
56218
+ }
56219
+ const finalDisplayName = name ?? eventName;
56220
+ const attributes = this.getEnrichedAttributes(extraAttributes, eventName);
56221
+ this.logger.emit({
56222
+ body: finalDisplayName,
56223
+ attributes,
56224
+ timestamp: Date.now()
56225
+ });
56226
+ } catch (error52) {
56227
+ console.debug("Failed to track telemetry event:", error52);
56228
+ }
56229
+ }
56230
+ getDefaultEventName() {
56231
+ return this.options?.defaultEventName;
56232
+ }
56233
+ setupTelemetryProvider(connectionString) {
56234
+ const opts = this.options;
56235
+ const exporter = new ApplicationInsightsEventExporter(connectionString, {
56236
+ cloudRoleName: opts.cloudRoleName,
56237
+ cloudRoleInstance: opts.sdkVersion
56238
+ });
56239
+ const processor = new import_sdk_logs.BatchLogRecordProcessor(exporter);
56240
+ this.logProvider = new import_sdk_logs.LoggerProvider({
56241
+ processors: [processor]
56242
+ });
56243
+ this.logger = this.logProvider.getLogger(opts.loggerName);
56244
+ }
56245
+ isValidConnectionString(connectionString) {
56246
+ return Boolean(connectionString) && !connectionString.startsWith("$");
56247
+ }
56248
+ getEnrichedAttributes(extraAttributes, eventName) {
56249
+ const opts = this.options;
56250
+ return {
56251
+ [APP_NAME]: opts?.serviceName ?? UNKNOWN,
56252
+ [VERSION]: opts?.sdkVersion ?? UNKNOWN,
56253
+ [SERVICE]: eventName,
56254
+ [CLOUD_URL]: this.createCloudUrl(),
56255
+ [CLOUD_ORGANIZATION_NAME]: this.telemetryContext?.orgName ?? UNKNOWN,
56256
+ [CLOUD_TENANT_NAME]: this.telemetryContext?.tenantName ?? UNKNOWN,
56257
+ [CLOUD_REDIRECT_URI]: this.telemetryContext?.redirectUri ?? UNKNOWN,
56258
+ [CLOUD_CLIENT_ID]: this.telemetryContext?.clientId ?? UNKNOWN,
56259
+ ...extraAttributes
56260
+ };
56261
+ }
56262
+ createCloudUrl() {
56263
+ const baseUrl = this.telemetryContext?.baseUrl;
56264
+ const orgId = this.telemetryContext?.orgName;
56265
+ const tenantId = this.telemetryContext?.tenantName;
56266
+ if (!baseUrl || !orgId || !tenantId) {
56267
+ return UNKNOWN;
56268
+ }
56269
+ return `${baseUrl}/${orgId}/${tenantId}`;
56270
+ }
56271
+ }
56272
+ var REGISTRY_KEY = Symbol.for("@uipath/core-telemetry/clients");
56273
+ function getGlobalRegistry() {
56274
+ const holder = globalThis;
56275
+ let registry3 = holder[REGISTRY_KEY];
56276
+ if (!registry3) {
56277
+ registry3 = {};
56278
+ holder[REGISTRY_KEY] = registry3;
56279
+ }
56280
+ return registry3;
56281
+ }
56282
+ function getOrCreateClient(name) {
56283
+ const registry3 = getGlobalRegistry();
56284
+ if (!registry3[name]) {
56285
+ registry3[name] = new TelemetryClient;
56286
+ }
56287
+ return registry3[name];
56288
+ }
56289
+ function createTrackedFunction(originalFunction, { client, nameOrOptions, fallbackName, opts }) {
56290
+ const wrapped = function(...args) {
56291
+ let shouldTrack = true;
56292
+ if (opts.condition !== undefined) {
56293
+ shouldTrack = typeof opts.condition === "function" ? opts.condition.apply(this, args) : opts.condition;
56294
+ }
56295
+ if (shouldTrack) {
56296
+ const serviceMethod = typeof nameOrOptions === "string" ? nameOrOptions : fallbackName;
56297
+ client.track(serviceMethod, client.getDefaultEventName(), opts.attributes);
56298
+ }
56299
+ return originalFunction.apply(this, args);
56300
+ };
56301
+ return wrapped;
56302
+ }
56303
+ function createTrack(client) {
56304
+ function trackFactory(nameOrOptions, options) {
56305
+ const opts = typeof nameOrOptions === "object" ? nameOrOptions : options ?? {};
56306
+ function decoratorImpl(target, propertyKey, descriptor) {
56307
+ if (descriptor && typeof descriptor.value === "function") {
56308
+ const original = descriptor.value;
56309
+ descriptor.value = createTrackedFunction(original, {
56310
+ client,
56311
+ nameOrOptions,
56312
+ fallbackName: typeof propertyKey === "string" ? propertyKey : "unknown_method",
56313
+ opts
56314
+ });
56315
+ return descriptor;
56316
+ }
56317
+ const fn = target;
56318
+ return createTrackedFunction(fn, {
56319
+ client,
56320
+ nameOrOptions,
56321
+ fallbackName: fn.name || "unknown_function",
56322
+ opts
56323
+ });
56324
+ }
56325
+ return decoratorImpl;
56326
+ }
56327
+ return trackFactory;
56328
+ }
56329
+ function createTrackEvent(client) {
56330
+ return function trackEvent(eventName, name, attributes) {
56331
+ client.track(eventName, name, attributes);
56332
+ };
56333
+ }
56334
+
56335
+ // ../../node_modules/@uipath/uipath-typescript/dist/index.mjs
55781
56336
  function __decorate(decorators, target, key, desc) {
55782
56337
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
55783
56338
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -59660,6 +60215,7 @@ var ORCHESTRATOR_BASE = "orchestrator_";
59660
60215
  var PIMS_BASE = "pims_";
59661
60216
  var DATAFABRIC_BASE = "datafabric_";
59662
60217
  var IDENTITY_BASE = "identity_";
60218
+ var INSIGHTS_RTM_BASE = "insightsrtm_";
59663
60219
  var TASK_ENDPOINTS = {
59664
60220
  CREATE_GENERIC_TASK: `${ORCHESTRATOR_BASE}/tasks/GenericTasks/CreateTask`,
59665
60221
  GET_TASK_USERS: (folderId) => `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.GetTaskUsers(organizationUnitId=${folderId})`,
@@ -59682,7 +60238,9 @@ var BUCKET_ENDPOINTS = {
59682
60238
  GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})`,
59683
60239
  GET_FILE_META_DATA: (id) => `${ORCHESTRATOR_BASE}/api/Buckets/${id}/ListFiles`,
59684
60240
  GET_READ_URI: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.GetReadUri`,
59685
- GET_WRITE_URI: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.GetWriteUri`
60241
+ GET_WRITE_URI: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.GetWriteUri`,
60242
+ DELETE_FILE: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.DeleteFile`,
60243
+ GET_FILES: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.GetFiles`
59686
60244
  };
59687
60245
  var PROCESS_ENDPOINTS = {
59688
60246
  GET_ALL: `${ORCHESTRATOR_BASE}/odata/Releases`,
@@ -59733,6 +60291,15 @@ var MAESTRO_ENDPOINTS = {
59733
60291
  GET_CASE_JSON: (instanceId) => `${PIMS_BASE}/api/v1/cases/${instanceId}/case-json`,
59734
60292
  GET_ELEMENT_EXECUTIONS: (instanceId) => `${PIMS_BASE}/api/v1/element-executions/case-instances/${instanceId}`,
59735
60293
  REOPEN: (instanceId) => `${PIMS_BASE}/api/v1/cases/${instanceId}/reopen`
60294
+ },
60295
+ INSIGHTS: {
60296
+ SLA_SUMMARY: `${INSIGHTS_RTM_BASE}/caseManagement/slaSummary`,
60297
+ STAGES_SUMMARY: `${INSIGHTS_RTM_BASE}/caseManagement/stages`,
60298
+ TOP_PROCESSES_BY_RUN_COUNT: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByRunCount`,
60299
+ TOP_PROCESSES_WITH_FAILURE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcesseswithFailure`,
60300
+ TOP_ELEMENTS_WITH_FAILURE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopElementswithFailure`,
60301
+ INSTANCE_STATUS_BY_DATE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/InstanceStatusByDate`,
60302
+ TOP_PROCESSES_BY_DURATION: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByDuration`
59736
60303
  }
59737
60304
  };
59738
60305
  var DATA_FABRIC_TENANT_FOLDER_ID = "00000000-0000-0000-0000-000000000000";
@@ -59759,7 +60326,13 @@ var DATA_FABRIC_ENDPOINTS = {
59759
60326
  },
59760
60327
  CHOICESETS: {
59761
60328
  GET_ALL: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
59762
- GET_BY_ID: (choiceSetId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${choiceSetId}/query_expansion`
60329
+ GET_BY_ID: (choiceSetId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${choiceSetId}/query_expansion`,
60330
+ CREATE: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
60331
+ UPDATE: (choiceSetId) => `${DATAFABRIC_BASE}/api/Entity/${choiceSetId}/metadata`,
60332
+ DELETE: (choiceSetId) => `${DATAFABRIC_BASE}/api/Entity/${choiceSetId}/delete`,
60333
+ INSERT_BY_NAME: (choiceSetName) => `${DATAFABRIC_BASE}/api/EntityService/${choiceSetName}/choiceset/insert`,
60334
+ UPDATE_BY_NAME: (choiceSetName, valueId) => `${DATAFABRIC_BASE}/api/EntityService/${choiceSetName}/choiceset/${valueId}/update`,
60335
+ DELETE_BY_ID: (choiceSetId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${choiceSetId}/choiceset/delete`
59763
60336
  }
59764
60337
  };
59765
60338
  var IDENTITY_ENDPOINTS = {
@@ -60356,218 +60929,33 @@ function isCompleteConfig(config3) {
60356
60929
  function normalizeBaseUrl(url2) {
60357
60930
  return url2.endsWith("/") ? url2.slice(0, -1) : url2;
60358
60931
  }
60359
- var CONNECTION_STRING = "InstrumentationKey=a6efa11d-1feb-4508-9738-e13e12dcae5e;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=7c58eb1c-9581-4ba6-839e-11725848a037";
60360
- var SDK_VERSION = "1.3.7";
60361
- var VERSION = "Version";
60362
- var SERVICE = "Service";
60363
- var CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
60364
- var CLOUD_TENANT_NAME = "CloudTenantName";
60365
- var CLOUD_URL = "CloudUrl";
60366
- var CLOUD_CLIENT_ID = "CloudClientId";
60367
- var CLOUD_REDIRECT_URI = "CloudRedirectUri";
60368
- var APP_NAME = "ApplicationName";
60932
+ var SDK_VERSION = "1.3.11";
60369
60933
  var CLOUD_ROLE_NAME = "uipath-ts-sdk";
60370
60934
  var SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
60371
60935
  var SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
60372
60936
  var SDK_RUN_EVENT = "Sdk.Run";
60373
- var UNKNOWN$1 = "";
60374
-
60375
- class ApplicationInsightsEventExporter {
60376
- constructor(connectionString) {
60377
- this.connectionString = connectionString;
60378
- }
60379
- export(logs, resultCallback) {
60380
- try {
60381
- logs.forEach((logRecord) => {
60382
- this.sendAsCustomEvent(logRecord);
60383
- });
60384
- resultCallback({ code: 0 });
60385
- } catch (error52) {
60386
- console.debug("Failed to export logs to Application Insights:", error52);
60387
- resultCallback({ code: 2, error: error52 });
60388
- }
60389
- }
60390
- shutdown() {
60391
- return Promise.resolve();
60392
- }
60393
- sendAsCustomEvent(logRecord) {
60394
- const eventName = logRecord.body || SDK_RUN_EVENT;
60395
- const payload = {
60396
- name: "Microsoft.ApplicationInsights.Event",
60397
- time: new Date().toISOString(),
60398
- iKey: this.extractInstrumentationKey(),
60399
- data: {
60400
- baseType: "EventData",
60401
- baseData: {
60402
- ver: 2,
60403
- name: eventName,
60404
- properties: this.convertAttributesToProperties(logRecord.attributes || {})
60405
- }
60406
- },
60407
- tags: {
60408
- "ai.cloud.role": CLOUD_ROLE_NAME,
60409
- "ai.cloud.roleInstance": SDK_VERSION
60410
- }
60411
- };
60412
- this.sendToApplicationInsights(payload);
60413
- }
60414
- extractInstrumentationKey() {
60415
- const match = this.connectionString.match(/InstrumentationKey=([^;]+)/);
60416
- return match ? match[1] : "";
60417
- }
60418
- convertAttributesToProperties(attributes) {
60419
- const properties = {};
60420
- Object.entries(attributes || {}).forEach(([key, value]) => {
60421
- properties[key] = String(value);
60937
+ var sdkClient = getOrCreateClient(CLOUD_ROLE_NAME);
60938
+ var track = createTrack(sdkClient);
60939
+ var trackEvent = createTrackEvent(sdkClient);
60940
+ var telemetryClient = {
60941
+ initialize(context) {
60942
+ sdkClient.initialize({
60943
+ sdkVersion: SDK_VERSION,
60944
+ serviceName: SDK_SERVICE_NAME,
60945
+ cloudRoleName: CLOUD_ROLE_NAME,
60946
+ loggerName: SDK_LOGGER_NAME,
60947
+ defaultEventName: SDK_RUN_EVENT,
60948
+ context
60422
60949
  });
60423
- return properties;
60424
- }
60425
- async sendToApplicationInsights(payload) {
60426
- try {
60427
- const ingestionEndpoint = this.extractIngestionEndpoint();
60428
- if (!ingestionEndpoint) {
60429
- console.debug("No ingestion endpoint found in connection string");
60430
- return;
60431
- }
60432
- const url2 = `${ingestionEndpoint}/v2/track`;
60433
- const response = await fetch(url2, {
60434
- method: "POST",
60435
- headers: {
60436
- "Content-Type": "application/json"
60437
- },
60438
- body: JSON.stringify(payload)
60439
- });
60440
- if (!response.ok) {
60441
- console.debug(`Failed to send event telemetry: ${response.status} ${response.statusText}`);
60442
- }
60443
- } catch (error52) {
60444
- console.debug("Error sending event telemetry to Application Insights:", error52);
60445
- }
60446
60950
  }
60447
- extractIngestionEndpoint() {
60448
- const match = this.connectionString.match(/IngestionEndpoint=([^;]+)/);
60449
- return match ? match[1] : "";
60450
- }
60451
- }
60452
-
60453
- class TelemetryClient {
60454
- constructor() {
60455
- this.isInitialized = false;
60456
- }
60457
- static getInstance() {
60458
- if (!TelemetryClient.instance) {
60459
- TelemetryClient.instance = new TelemetryClient;
60460
- }
60461
- return TelemetryClient.instance;
60462
- }
60463
- initialize(config3) {
60464
- if (this.isInitialized) {
60465
- return;
60466
- }
60467
- this.isInitialized = true;
60468
- if (config3) {
60469
- this.telemetryContext = config3;
60470
- }
60471
- try {
60472
- const connectionString = this.getConnectionString();
60473
- if (!connectionString) {
60474
- return;
60475
- }
60476
- this.setupTelemetryProvider(connectionString);
60477
- } catch (error52) {
60478
- console.debug("Failed to initialize OpenTelemetry:", error52);
60479
- }
60480
- }
60481
- getConnectionString() {
60482
- const connectionString = CONNECTION_STRING;
60483
- return connectionString;
60484
- }
60485
- setupTelemetryProvider(connectionString) {
60486
- const exporter = new ApplicationInsightsEventExporter(connectionString);
60487
- const processor = new import_sdk_logs.BatchLogRecordProcessor(exporter);
60488
- this.logProvider = new import_sdk_logs.LoggerProvider({
60489
- processors: [processor]
60490
- });
60491
- this.logger = this.logProvider.getLogger(SDK_LOGGER_NAME);
60492
- }
60493
- track(eventName, name, extraAttributes = {}) {
60494
- try {
60495
- if (!this.logger) {
60496
- return;
60497
- }
60498
- const finalDisplayName = name || eventName;
60499
- const attributes = this.getEnrichedAttributes(extraAttributes, eventName);
60500
- this.logger.emit({
60501
- body: finalDisplayName,
60502
- attributes,
60503
- timestamp: Date.now()
60504
- });
60505
- } catch (error52) {
60506
- console.debug("Failed to track telemetry event:", error52);
60507
- }
60508
- }
60509
- getEnrichedAttributes(extraAttributes, eventName) {
60510
- const attributes = {
60511
- [APP_NAME]: SDK_SERVICE_NAME,
60512
- [VERSION]: SDK_VERSION,
60513
- [SERVICE]: eventName,
60514
- [CLOUD_URL]: this.createCloudUrl(),
60515
- [CLOUD_ORGANIZATION_NAME]: this.telemetryContext?.orgName || UNKNOWN$1,
60516
- [CLOUD_TENANT_NAME]: this.telemetryContext?.tenantName || UNKNOWN$1,
60517
- [CLOUD_REDIRECT_URI]: this.telemetryContext?.redirectUri || UNKNOWN$1,
60518
- [CLOUD_CLIENT_ID]: this.telemetryContext?.clientId || UNKNOWN$1,
60519
- ...extraAttributes
60520
- };
60521
- return attributes;
60522
- }
60523
- createCloudUrl() {
60524
- const baseUrl = this.telemetryContext?.baseUrl;
60525
- const orgId = this.telemetryContext?.orgName;
60526
- const tenantId = this.telemetryContext?.tenantName;
60527
- if (!baseUrl || !orgId || !tenantId) {
60528
- return UNKNOWN$1;
60529
- }
60530
- return `${baseUrl}/${orgId}/${tenantId}`;
60531
- }
60532
- }
60533
- var telemetryClient = TelemetryClient.getInstance();
60534
- function createTrackedFunction(originalFunction, nameOrOptions, fallbackName, opts) {
60535
- return function(...args) {
60536
- let shouldTrack = true;
60537
- if (opts.condition !== undefined) {
60538
- if (typeof opts.condition === "function") {
60539
- shouldTrack = opts.condition.apply(this, args);
60540
- } else {
60541
- shouldTrack = opts.condition;
60542
- }
60543
- }
60544
- if (shouldTrack) {
60545
- const serviceMethod = typeof nameOrOptions === "string" ? nameOrOptions : fallbackName;
60546
- telemetryClient.track(serviceMethod, SDK_RUN_EVENT, opts.attributes);
60547
- }
60548
- return originalFunction.apply(this, args);
60549
- };
60550
- }
60551
- function track(nameOrOptions, options) {
60552
- return function decorator(_target, propertyKey, descriptor) {
60553
- const opts = typeof nameOrOptions === "object" ? nameOrOptions : options || {};
60554
- if (descriptor && typeof descriptor.value === "function") {
60555
- descriptor.value = createTrackedFunction(descriptor.value, nameOrOptions, propertyKey || "unknown_method", opts);
60556
- return descriptor;
60557
- }
60558
- return (originalFunction) => createTrackedFunction(originalFunction, nameOrOptions, originalFunction.name || "unknown_function", opts);
60559
- };
60560
- }
60561
- function trackEvent(eventName, name, attributes) {
60562
- telemetryClient.track(eventName, name, attributes);
60563
- }
60564
- var REGISTRY_KEY = Symbol.for("@uipath/sdk-internals-registry");
60951
+ };
60952
+ var REGISTRY_KEY2 = Symbol.for("@uipath/sdk-internals-registry");
60565
60953
  var getGlobalStore = () => {
60566
60954
  const globalObj = globalThis;
60567
- if (!globalObj[REGISTRY_KEY]) {
60568
- globalObj[REGISTRY_KEY] = new WeakMap;
60955
+ if (!globalObj[REGISTRY_KEY2]) {
60956
+ globalObj[REGISTRY_KEY2] = new WeakMap;
60569
60957
  }
60570
- return globalObj[REGISTRY_KEY];
60958
+ return globalObj[REGISTRY_KEY2];
60571
60959
  };
60572
60960
 
60573
60961
  class SDKInternalsRegistry {
@@ -60667,8 +61055,8 @@ var UiPath$1 = class UiPath {
60667
61055
  __classPrivateFieldSet(this, _UiPath_initialized, true, "f");
60668
61056
  }
60669
61057
  } catch (error52) {
60670
- const errorMessage = error52 instanceof Error ? error52.message : "An unknown error occurred";
60671
- throw new Error(`Failed to initialize UiPath SDK: ${errorMessage}`);
61058
+ const errorMessage2 = error52 instanceof Error ? error52.message : "An unknown error occurred";
61059
+ throw new Error(`Failed to initialize UiPath SDK: ${errorMessage2}`);
60672
61060
  }
60673
61061
  }
60674
61062
  setMultiLogin() {
@@ -60697,8 +61085,8 @@ var UiPath$1 = class UiPath {
60697
61085
  }
60698
61086
  return false;
60699
61087
  } catch (error52) {
60700
- const errorMessage = error52 instanceof Error ? error52.message : "An unknown error occurred";
60701
- throw new Error(`Failed to complete OAuth: ${errorMessage}`);
61088
+ const errorMessage2 = error52 instanceof Error ? error52.message : "An unknown error occurred";
61089
+ throw new Error(`Failed to complete OAuth: ${errorMessage2}`);
60702
61090
  }
60703
61091
  }
60704
61092
  isAuthenticated() {
@@ -61019,7 +61407,17 @@ class ApiClient {
61019
61407
  if (!text) {
61020
61408
  return;
61021
61409
  }
61022
- return JSON.parse(text);
61410
+ try {
61411
+ return JSON.parse(text);
61412
+ } catch (error52) {
61413
+ if (error52 instanceof SyntaxError) {
61414
+ throw new ServerError({
61415
+ message: `Server returned non-JSON response (${response.status} ${response.url}): ${error52.message}`,
61416
+ statusCode: response.status
61417
+ });
61418
+ }
61419
+ throw error52;
61420
+ }
61023
61421
  } catch (error52) {
61024
61422
  if (error52.type && error52.type.includes("Error")) {
61025
61423
  throw error52;
@@ -61048,6 +61446,22 @@ var PaginationType;
61048
61446
  PaginationType2["OFFSET"] = "offset";
61049
61447
  PaginationType2["TOKEN"] = "token";
61050
61448
  })(PaginationType || (PaginationType = {}));
61449
+ function resolveNestedField(data, fieldPath) {
61450
+ if (!data) {
61451
+ return;
61452
+ }
61453
+ if (fieldPath in data) {
61454
+ return data[fieldPath];
61455
+ }
61456
+ if (!fieldPath.includes(".")) {
61457
+ return;
61458
+ }
61459
+ let value = data;
61460
+ for (const part of fieldPath.split(".")) {
61461
+ value = value?.[part];
61462
+ }
61463
+ return value;
61464
+ }
61051
61465
  function filterUndefined(obj) {
61052
61466
  const result = {};
61053
61467
  for (const [key, value] of Object.entries(obj)) {
@@ -61162,7 +61576,7 @@ function createHeaders(headersObj) {
61162
61576
  return headers;
61163
61577
  }
61164
61578
  var ODATA_PREFIX = "$";
61165
- var UNKNOWN = "Unknown";
61579
+ var UNKNOWN2 = "Unknown";
61166
61580
  var NO_INSTANCE = "no-instance";
61167
61581
  var HTTP_METHODS = {
61168
61582
  GET: "GET",
@@ -61184,6 +61598,15 @@ var BUCKET_PAGINATION = {
61184
61598
  ITEMS_FIELD: "items",
61185
61599
  CONTINUATION_TOKEN_FIELD: "continuationToken"
61186
61600
  };
61601
+ var SLA_SUMMARY_PAGINATION = {
61602
+ ITEMS_FIELD: "data",
61603
+ TOTAL_COUNT_FIELD: "pagination.totalCount"
61604
+ };
61605
+ var SLA_SUMMARY_OFFSET_PARAMS = {
61606
+ PAGE_SIZE_PARAM: "PageSize",
61607
+ OFFSET_PARAM: "PageNumber",
61608
+ COUNT_PARAM: undefined
61609
+ };
61187
61610
  var PROCESS_INSTANCE_PAGINATION = {
61188
61611
  ITEMS_FIELD: "instances",
61189
61612
  CONTINUATION_TOKEN_FIELD: "nextPage"
@@ -61206,6 +61629,10 @@ var PROCESS_INSTANCE_TOKEN_PARAMS = {
61206
61629
  PAGE_SIZE_PARAM: "pageSize",
61207
61630
  TOKEN_PARAM: "nextPage"
61208
61631
  };
61632
+ function toISOUtc(value) {
61633
+ const date6 = new Date(value + " UTC");
61634
+ return isNaN(date6.getTime()) ? value : date6.toISOString();
61635
+ }
61209
61636
  function transformData(data, fieldMapping) {
61210
61637
  if (Array.isArray(data)) {
61211
61638
  return data.map((item) => transformData(item, fieldMapping));
@@ -61406,9 +61833,9 @@ class PaginationHelpers {
61406
61833
  }
61407
61834
  }
61408
61835
  static async getAllPaginated(params) {
61409
- const { serviceAccess, getEndpoint, folderId, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
61836
+ const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
61410
61837
  const endpoint = getEndpoint(folderId);
61411
- const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
61838
+ const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
61412
61839
  const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
61413
61840
  headers,
61414
61841
  params: additionalParams,
@@ -61429,11 +61856,11 @@ class PaginationHelpers {
61429
61856
  };
61430
61857
  }
61431
61858
  static async getAllNonPaginated(params) {
61432
- const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
61859
+ const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
61433
61860
  const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
61434
61861
  const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
61435
61862
  const endpoint = folderId ? getByFolderEndpoint : getAllEndpoint;
61436
- const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
61863
+ const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
61437
61864
  let response;
61438
61865
  if (method === HTTP_METHODS.POST) {
61439
61866
  response = await serviceAccess.post(endpoint, additionalParams, { headers });
@@ -61444,7 +61871,8 @@ class PaginationHelpers {
61444
61871
  });
61445
61872
  }
61446
61873
  const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
61447
- const totalCount = Array.isArray(response.data) ? undefined : response.data?.[totalCountField];
61874
+ const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
61875
+ const totalCount = typeof rawTotalCount === "number" ? rawTotalCount : undefined;
61448
61876
  const parsedItems = typeof rawItems === "string" ? JSON.parse(rawItems) : rawItems || [];
61449
61877
  const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
61450
61878
  return {
@@ -61474,6 +61902,7 @@ class PaginationHelpers {
61474
61902
  serviceAccess: config3.serviceAccess,
61475
61903
  getEndpoint: config3.getEndpoint,
61476
61904
  folderId,
61905
+ headers: config3.headers,
61477
61906
  paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
61478
61907
  additionalParams: prefixedOptions,
61479
61908
  transformFn: config3.transformFn,
@@ -61490,6 +61919,7 @@ class PaginationHelpers {
61490
61919
  getAllEndpoint: config3.getEndpoint(),
61491
61920
  getByFolderEndpoint: byFolderEndpoint,
61492
61921
  folderId,
61922
+ headers: config3.headers,
61493
61923
  additionalParams: prefixedOptions,
61494
61924
  transformFn: config3.transformFn,
61495
61925
  method: config3.method,
@@ -61599,9 +62029,14 @@ class BaseService {
61599
62029
  const pageSizeParam = paginationParams?.pageSizeParam || ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM;
61600
62030
  const offsetParam = paginationParams?.offsetParam || ODATA_OFFSET_PARAMS.OFFSET_PARAM;
61601
62031
  const countParam = paginationParams?.countParam || ODATA_OFFSET_PARAMS.COUNT_PARAM;
62032
+ const convertToSkip = paginationParams?.convertToSkip ?? true;
61602
62033
  requestParams[pageSizeParam] = limitedPageSize;
61603
- if (params.pageNumber && params.pageNumber > 1) {
61604
- requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
62034
+ if (convertToSkip) {
62035
+ if (params.pageNumber && params.pageNumber > 1) {
62036
+ requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
62037
+ }
62038
+ } else {
62039
+ requestParams[offsetParam] = params.pageNumber || 1;
61605
62040
  }
61606
62041
  {
61607
62042
  requestParams[countParam] = true;
@@ -61625,7 +62060,8 @@ class BaseService {
61625
62060
  const totalCountField = fields.totalCountField || "totalRecordCount";
61626
62061
  const continuationTokenField = fields.continuationTokenField || "continuationToken";
61627
62062
  const items = Array.isArray(response.data) ? response.data : response.data[itemsField] || [];
61628
- const totalCount = Array.isArray(response.data) ? undefined : response.data[totalCountField];
62063
+ const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
62064
+ const totalCount = typeof rawTotalCount === "number" ? rawTotalCount : undefined;
61629
62065
  const continuationToken = response.data[continuationTokenField];
61630
62066
  const hasMore = this.determineHasMorePages(paginationType, {
61631
62067
  totalCount,
@@ -62111,10 +62547,6 @@ class EntityService extends BaseService {
62111
62547
  return this.insertRecordsById(id, data, options);
62112
62548
  }
62113
62549
  async create(name, fields, options) {
62114
- this.validateName(name, "entity");
62115
- for (const field of fields) {
62116
- this.validateName(field.fieldName, "field");
62117
- }
62118
62550
  const opts = options ?? {};
62119
62551
  const payload = {
62120
62552
  ...opts.description !== undefined && { description: opts.description },
@@ -62186,6 +62618,7 @@ class EntityService extends BaseService {
62186
62618
  ...update.isUnique !== undefined && { isUnique: update.isUnique },
62187
62619
  ...update.isRbacEnabled !== undefined && { isRbacEnabled: update.isRbacEnabled },
62188
62620
  ...update.isEncrypted !== undefined && { isEncrypted: update.isEncrypted },
62621
+ ...update.isHiddenField !== undefined && { isHiddenField: update.isHiddenField },
62189
62622
  ...update.defaultValue !== undefined && { defaultValue: update.defaultValue },
62190
62623
  ...hasConstraintUpdate && f.sqlType && { sqlType: { ...f.sqlType, ...constraintUpdate } }
62191
62624
  };
@@ -62193,9 +62626,6 @@ class EntityService extends BaseService {
62193
62626
  }
62194
62627
  const newFields = [];
62195
62628
  if (options.addFields?.length) {
62196
- for (const field of options.addFields) {
62197
- this.validateName(field.fieldName, "field");
62198
- }
62199
62629
  newFields.push(...options.addFields.map((f) => this.buildSchemaFieldPayload(f)));
62200
62630
  }
62201
62631
  await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPSERT, {
@@ -62266,9 +62696,15 @@ class EntityService extends BaseService {
62266
62696
  });
62267
62697
  }
62268
62698
  buildSchemaFieldPayload(field) {
62269
- this.validateName(field.fieldName, "field");
62270
62699
  const fieldType = field.type ?? EntityFieldDataType.STRING;
62271
62700
  this.validateFieldConstraints(fieldType, field, field.fieldName);
62701
+ const isRelationship = fieldType === EntityFieldDataType.RELATIONSHIP;
62702
+ const isFile = fieldType === EntityFieldDataType.FILE;
62703
+ if ((isRelationship || isFile) && (!field.referenceEntityId || !field.referenceFieldId)) {
62704
+ throw new ValidationError3({
62705
+ message: `Field '${field.fieldName}' of type ${fieldType} requires both referenceEntityId and referenceFieldId (UUIDs of the target entity and field).`
62706
+ });
62707
+ }
62272
62708
  const mapping = EntitySchemaFieldTypeMap[fieldType];
62273
62709
  return {
62274
62710
  name: field.fieldName,
@@ -62283,10 +62719,13 @@ class EntityService extends BaseService {
62283
62719
  isUnique: field.isUnique ?? false,
62284
62720
  isRbacEnabled: field.isRbacEnabled ?? false,
62285
62721
  isEncrypted: field.isEncrypted ?? false,
62722
+ isHiddenField: field.isHiddenField ?? false,
62286
62723
  ...field.defaultValue !== undefined && { defaultValue: field.defaultValue },
62287
62724
  ...field.choiceSetId !== undefined && { choiceSetId: field.choiceSetId },
62288
- ...field.referenceEntityName !== undefined && { referenceEntityName: field.referenceEntityName },
62289
- ...field.referenceFieldName !== undefined && { referenceFieldName: field.referenceFieldName }
62725
+ ...(isRelationship || isFile) && { isForeignKey: true },
62726
+ ...isRelationship && { referenceType: ReferenceType.ManyToOne },
62727
+ ...field.referenceEntityId !== undefined && { referenceEntity: { id: field.referenceEntityId } },
62728
+ ...field.referenceFieldId !== undefined && { referenceField: { id: field.referenceFieldId } }
62290
62729
  };
62291
62730
  }
62292
62731
  resolveFieldDataType(f) {
@@ -62365,28 +62804,7 @@ class EntityService extends BaseService {
62365
62804
  return {};
62366
62805
  }
62367
62806
  }
62368
- validateName(name, context) {
62369
- if (name.length < 3 || name.length > 100 || !/^[a-zA-Z]\w*$/.test(name)) {
62370
- const suggestion = name.replace(/\W/g, "").replace(/^[0-9_]+/, "");
62371
- const defaultName = `My${context.charAt(0).toUpperCase() + context.slice(1)}`;
62372
- throw new ValidationError3({
62373
- message: `Invalid ${context} name '${name}'. Must start with a letter, contain only letters, numbers, and underscores, 3–100 characters (e.g., "${suggestion || defaultName}").`
62374
- });
62375
- }
62376
- if (context === "field" && EntityService.RESERVED_FIELD_NAMES.has(name)) {
62377
- throw new ValidationError3({
62378
- message: `Field name '${name}' is reserved. Reserved names: ${[...EntityService.RESERVED_FIELD_NAMES].join(", ")}.`
62379
- });
62380
- }
62381
- }
62382
62807
  }
62383
- EntityService.RESERVED_FIELD_NAMES = new Set([
62384
- "Id",
62385
- "CreatedBy",
62386
- "CreateTime",
62387
- "UpdatedBy",
62388
- "UpdateTime"
62389
- ]);
62390
62808
  __decorate([
62391
62809
  track("Entities.GetById")
62392
62810
  ], EntityService.prototype, "getById", null);
@@ -62470,6 +62888,62 @@ class ChoiceSetService extends BaseService {
62470
62888
  }
62471
62889
  }, options);
62472
62890
  }
62891
+ async create(name, options) {
62892
+ const opts = options ?? {};
62893
+ const payload = {
62894
+ ...opts.description !== undefined && { description: opts.description },
62895
+ ...opts.displayName !== undefined && { displayName: opts.displayName },
62896
+ entityDefinition: {
62897
+ name,
62898
+ fields: [],
62899
+ folderId: opts.folderKey ?? DATA_FABRIC_TENANT_FOLDER_ID
62900
+ }
62901
+ };
62902
+ const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.CREATE, payload);
62903
+ return response.data;
62904
+ }
62905
+ async updateById(choiceSetId, options) {
62906
+ if (options.displayName === undefined && options.description === undefined) {
62907
+ throw new ValidationError3({
62908
+ message: "updateById requires at least one of displayName or description."
62909
+ });
62910
+ }
62911
+ await this.patch(DATA_FABRIC_ENDPOINTS.CHOICESETS.UPDATE(choiceSetId), {
62912
+ ...options.displayName !== undefined && { displayName: options.displayName },
62913
+ ...options.description !== undefined && { description: options.description }
62914
+ });
62915
+ }
62916
+ async deleteById(choiceSetId) {
62917
+ await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.DELETE(choiceSetId), {});
62918
+ }
62919
+ async insertValueById(choiceSetId, name, options) {
62920
+ const choiceSetName = await this.resolveChoiceSetName(choiceSetId);
62921
+ const payload = {
62922
+ Name: name,
62923
+ ...options?.displayName !== undefined && { DisplayName: options.displayName }
62924
+ };
62925
+ const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.INSERT_BY_NAME(choiceSetName), payload);
62926
+ const camelCased = pascalToCamelCaseKeys(response.data);
62927
+ return transformData(camelCased, EntityMap);
62928
+ }
62929
+ async updateValueById(choiceSetId, valueId, displayName) {
62930
+ const choiceSetName = await this.resolveChoiceSetName(choiceSetId);
62931
+ const payload = { DisplayName: displayName };
62932
+ const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.UPDATE_BY_NAME(choiceSetName, valueId), payload);
62933
+ const camelCased = pascalToCamelCaseKeys(response.data);
62934
+ return transformData(camelCased, EntityMap);
62935
+ }
62936
+ async deleteValuesById(choiceSetId, valueIds) {
62937
+ await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.DELETE_BY_ID(choiceSetId), valueIds);
62938
+ }
62939
+ async resolveChoiceSetName(choiceSetId) {
62940
+ const all = await this.getAll();
62941
+ const match = all.find((cs) => cs.id === choiceSetId);
62942
+ if (!match) {
62943
+ throw new NotFoundError({ message: `Choice set with id '${choiceSetId}' not found.` });
62944
+ }
62945
+ return match.name;
62946
+ }
62473
62947
  }
62474
62948
  __decorate([
62475
62949
  track("Choicesets.GetAll")
@@ -62477,6 +62951,24 @@ __decorate([
62477
62951
  __decorate([
62478
62952
  track("Choicesets.GetById")
62479
62953
  ], ChoiceSetService.prototype, "getById", null);
62954
+ __decorate([
62955
+ track("Choicesets.Create")
62956
+ ], ChoiceSetService.prototype, "create", null);
62957
+ __decorate([
62958
+ track("Choicesets.UpdateById")
62959
+ ], ChoiceSetService.prototype, "updateById", null);
62960
+ __decorate([
62961
+ track("Choicesets.DeleteById")
62962
+ ], ChoiceSetService.prototype, "deleteById", null);
62963
+ __decorate([
62964
+ track("Choicesets.InsertValueById")
62965
+ ], ChoiceSetService.prototype, "insertValueById", null);
62966
+ __decorate([
62967
+ track("Choicesets.UpdateValueById")
62968
+ ], ChoiceSetService.prototype, "updateValueById", null);
62969
+ __decorate([
62970
+ track("Choicesets.DeleteValuesById")
62971
+ ], ChoiceSetService.prototype, "deleteValuesById", null);
62480
62972
  function createProcessMethods(processData, service) {
62481
62973
  return {
62482
62974
  async getIncidents() {
@@ -62492,6 +62984,30 @@ function createProcessWithMethods(processData, service) {
62492
62984
  const methods = createProcessMethods(processData, service);
62493
62985
  return Object.assign({}, processData, methods);
62494
62986
  }
62987
+ function buildInsightsTopBody(startTime, endTime, isCaseManagement, options) {
62988
+ return {
62989
+ commonParams: {
62990
+ startTime: startTime.getTime(),
62991
+ endTime: endTime.getTime(),
62992
+ isCaseManagement,
62993
+ ...options?.packageId ? { packageId: options.packageId } : {},
62994
+ ...options?.processKey ? { processKey: options.processKey } : {},
62995
+ ...options?.version ? { version: options.version } : {}
62996
+ }
62997
+ };
62998
+ }
62999
+ async function fetchInstanceStatusTimeline(postFn, startTime, endTime, isCaseManagement, options) {
63000
+ const response = await postFn(MAESTRO_ENDPOINTS.INSIGHTS.INSTANCE_STATUS_BY_DATE, {
63001
+ commonParams: {
63002
+ startTime: startTime.getTime(),
63003
+ endTime: endTime.getTime(),
63004
+ isCaseManagement
63005
+ },
63006
+ timeSliceUnit: options?.groupBy,
63007
+ timezoneOffset: new Date().getTimezoneOffset() * -1
63008
+ });
63009
+ return response.data ?? [];
63010
+ }
62495
63011
  var ProcessIncidentMap = {
62496
63012
  errorTimeUtc: "errorTime"
62497
63013
  };
@@ -62567,8 +63083,8 @@ class BpmnHelpers {
62567
63083
  const transformed = transformData(incident, ProcessIncidentMap);
62568
63084
  return {
62569
63085
  ...transformed,
62570
- incidentElementActivityType: element?.type || UNKNOWN,
62571
- incidentElementActivityName: element?.name || UNKNOWN
63086
+ incidentElementActivityType: element?.type || UNKNOWN2,
63087
+ incidentElementActivityName: element?.name || UNKNOWN2
62572
63088
  };
62573
63089
  }
62574
63090
  }
@@ -62650,6 +63166,29 @@ var DebugMode;
62650
63166
  DebugMode2["StepByStep"] = "StepByStep";
62651
63167
  DebugMode2["SingleStep"] = "SingleStep";
62652
63168
  })(DebugMode || (DebugMode = {}));
63169
+ var SlaSummaryStatus;
63170
+ (function(SlaSummaryStatus2) {
63171
+ SlaSummaryStatus2["ON_TRACK"] = "On Track";
63172
+ SlaSummaryStatus2["AT_RISK"] = "At Risk";
63173
+ SlaSummaryStatus2["OVERDUE"] = "Overdue";
63174
+ SlaSummaryStatus2["COMPLETED"] = "Completed";
63175
+ SlaSummaryStatus2["UNKNOWN"] = "Unknown";
63176
+ })(SlaSummaryStatus || (SlaSummaryStatus = {}));
63177
+ var InstanceStatus;
63178
+ (function(InstanceStatus2) {
63179
+ InstanceStatus2["UNKNOWN"] = "";
63180
+ InstanceStatus2["CANCELLED"] = "Cancelled";
63181
+ InstanceStatus2["CANCELING"] = "Canceling";
63182
+ InstanceStatus2["COMPLETED"] = "Completed";
63183
+ InstanceStatus2["FAULTED"] = "Faulted";
63184
+ InstanceStatus2["PAUSED"] = "Paused";
63185
+ InstanceStatus2["PAUSING"] = "Pausing";
63186
+ InstanceStatus2["PENDING"] = "Pending";
63187
+ InstanceStatus2["RESUMING"] = "Resuming";
63188
+ InstanceStatus2["RETRYING"] = "Retrying";
63189
+ InstanceStatus2["RUNNING"] = "Running";
63190
+ InstanceStatus2["UPGRADING"] = "Upgrading";
63191
+ })(InstanceStatus || (InstanceStatus = {}));
62653
63192
  var StageTaskType;
62654
63193
  (function(StageTaskType2) {
62655
63194
  StageTaskType2["EXTERNAL_AGENT"] = "external-agent";
@@ -62672,6 +63211,7 @@ var EscalationTriggerType;
62672
63211
  (function(EscalationTriggerType2) {
62673
63212
  EscalationTriggerType2["SLA_BREACHED"] = "sla-breached";
62674
63213
  EscalationTriggerType2["AT_RISK"] = "at-risk";
63214
+ EscalationTriggerType2["NONE"] = "None";
62675
63215
  })(EscalationTriggerType || (EscalationTriggerType = {}));
62676
63216
  var SLADurationUnit;
62677
63217
  (function(SLADurationUnit2) {
@@ -62728,6 +63268,16 @@ function createCaseInstanceMethods(instanceData, service) {
62728
63268
  if (!instanceData.instanceId)
62729
63269
  throw new Error("Case instance ID is undefined");
62730
63270
  return service.getActionTasks(instanceData.instanceId, options);
63271
+ },
63272
+ async getSlaSummary(options) {
63273
+ if (!instanceData.instanceId)
63274
+ throw new Error("Case instance ID is undefined");
63275
+ return service.getSlaSummary({ ...options, caseInstanceId: instanceData.instanceId });
63276
+ },
63277
+ async getStagesSlaSummary() {
63278
+ if (!instanceData.instanceId)
63279
+ throw new Error("Case instance ID is undefined");
63280
+ return service.getStagesSlaSummary({ caseInstanceId: instanceData.instanceId });
62731
63281
  }
62732
63282
  };
62733
63283
  }
@@ -62735,6 +63285,18 @@ function createCaseInstanceWithMethods(instanceData, service) {
62735
63285
  const methods = createCaseInstanceMethods(instanceData, service);
62736
63286
  return Object.assign({}, instanceData, methods);
62737
63287
  }
63288
+ var TimeInterval;
63289
+ (function(TimeInterval2) {
63290
+ TimeInterval2["Hour"] = "HOUR";
63291
+ TimeInterval2["Day"] = "DAY";
63292
+ TimeInterval2["Week"] = "WEEK";
63293
+ })(TimeInterval || (TimeInterval = {}));
63294
+ var InstanceFinalStatus;
63295
+ (function(InstanceFinalStatus2) {
63296
+ InstanceFinalStatus2["Completed"] = "Completed";
63297
+ InstanceFinalStatus2["Faulted"] = "Faulted";
63298
+ InstanceFinalStatus2["Cancelled"] = "Cancelled";
63299
+ })(InstanceFinalStatus || (InstanceFinalStatus = {}));
62738
63300
  var ProcessInstanceMap = {
62739
63301
  startedTimeUtc: "startedTime",
62740
63302
  completedTimeUtc: "completedTime",
@@ -62950,6 +63512,35 @@ class MaestroProcessesService extends BaseService {
62950
63512
  });
62951
63513
  return BpmnHelpers.enrichIncidentsWithBpmnData(rawResponse.data || [], folderKey, this.processInstancesService);
62952
63514
  }
63515
+ async getTopRunCount(startTime, endTime, options) {
63516
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_RUN_COUNT, buildInsightsTopBody(startTime, endTime, false, options));
63517
+ return (data ?? []).map((process21) => ({ ...process21, name: process21.packageId }));
63518
+ }
63519
+ async getTopElementFailedCount(startTime, endTime, options) {
63520
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_ELEMENTS_WITH_FAILURE, buildInsightsTopBody(startTime, endTime, false, options));
63521
+ return (data ?? []).map((item) => ({
63522
+ elementName: item.elementName,
63523
+ elementType: item.elementType,
63524
+ processKey: item.processKey,
63525
+ failedCount: item.count
63526
+ }));
63527
+ }
63528
+ async getInstanceStatusTimeline(startTime, endTime, options) {
63529
+ return fetchInstanceStatusTimeline(this.post.bind(this), startTime, endTime, false, options);
63530
+ }
63531
+ async getTopFaultedCount(startTime, endTime, options) {
63532
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_WITH_FAILURE, buildInsightsTopBody(startTime, endTime, false, options));
63533
+ return (data ?? []).map((item) => ({
63534
+ packageId: item.packageId,
63535
+ processKey: item.processKey,
63536
+ faultedCount: item.runCount,
63537
+ name: item.packageId
63538
+ }));
63539
+ }
63540
+ async getTopExecutionDuration(startTime, endTime, options) {
63541
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_DURATION, buildInsightsTopBody(startTime, endTime, false, options));
63542
+ return (data ?? []).map((process21) => ({ ...process21, name: process21.packageId }));
63543
+ }
62953
63544
  }
62954
63545
  __decorate([
62955
63546
  track("MaestroProcesses.GetAll")
@@ -62957,6 +63548,21 @@ __decorate([
62957
63548
  __decorate([
62958
63549
  track("MaestroProcesses.GetIncidents")
62959
63550
  ], MaestroProcessesService.prototype, "getIncidents", null);
63551
+ __decorate([
63552
+ track("MaestroProcesses.GetTopRunCount")
63553
+ ], MaestroProcessesService.prototype, "getTopRunCount", null);
63554
+ __decorate([
63555
+ track("MaestroProcesses.GetTopElementFailedCount")
63556
+ ], MaestroProcessesService.prototype, "getTopElementFailedCount", null);
63557
+ __decorate([
63558
+ track("MaestroProcesses.GetInstanceStatusTimeline")
63559
+ ], MaestroProcessesService.prototype, "getInstanceStatusTimeline", null);
63560
+ __decorate([
63561
+ track("MaestroProcesses.GetTopFaultedCount")
63562
+ ], MaestroProcessesService.prototype, "getTopFaultedCount", null);
63563
+ __decorate([
63564
+ track("MaestroProcesses.GetTopExecutionDuration")
63565
+ ], MaestroProcessesService.prototype, "getTopExecutionDuration", null);
62960
63566
 
62961
63567
  class ProcessIncidentsService extends BaseService {
62962
63568
  async getAll() {
@@ -62985,6 +63591,35 @@ class CasesService extends BaseService {
62985
63591
  name: this.extractCaseName(caseItem.packageId)
62986
63592
  }));
62987
63593
  }
63594
+ async getTopRunCount(startTime, endTime, options) {
63595
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_RUN_COUNT, buildInsightsTopBody(startTime, endTime, true, options));
63596
+ return (data ?? []).map((process21) => ({ ...process21, name: this.extractCaseName(process21.packageId) }));
63597
+ }
63598
+ async getTopElementFailedCount(startTime, endTime, options) {
63599
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_ELEMENTS_WITH_FAILURE, buildInsightsTopBody(startTime, endTime, true, options));
63600
+ return (data ?? []).map((item) => ({
63601
+ elementName: item.elementName,
63602
+ elementType: item.elementType,
63603
+ processKey: item.processKey,
63604
+ failedCount: item.count
63605
+ }));
63606
+ }
63607
+ async getInstanceStatusTimeline(startTime, endTime, options) {
63608
+ return fetchInstanceStatusTimeline(this.post.bind(this), startTime, endTime, true, options);
63609
+ }
63610
+ async getTopFaultedCount(startTime, endTime, options) {
63611
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_WITH_FAILURE, buildInsightsTopBody(startTime, endTime, true, options));
63612
+ return (data ?? []).map((item) => ({
63613
+ packageId: item.packageId,
63614
+ processKey: item.processKey,
63615
+ faultedCount: item.runCount,
63616
+ name: this.extractCaseName(item.packageId)
63617
+ }));
63618
+ }
63619
+ async getTopExecutionDuration(startTime, endTime, options) {
63620
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_DURATION, buildInsightsTopBody(startTime, endTime, true, options));
63621
+ return (data ?? []).map((process21) => ({ ...process21, name: this.extractCaseName(process21.packageId) }));
63622
+ }
62988
63623
  extractCaseName(packageId) {
62989
63624
  const caseManagementIndex = packageId.indexOf("CaseManagement.");
62990
63625
  if (caseManagementIndex !== -1) {
@@ -62997,6 +63632,21 @@ class CasesService extends BaseService {
62997
63632
  __decorate([
62998
63633
  track("Cases.GetAll")
62999
63634
  ], CasesService.prototype, "getAll", null);
63635
+ __decorate([
63636
+ track("Cases.GetTopRunCount")
63637
+ ], CasesService.prototype, "getTopRunCount", null);
63638
+ __decorate([
63639
+ track("Cases.GetTopElementFailedCount")
63640
+ ], CasesService.prototype, "getTopElementFailedCount", null);
63641
+ __decorate([
63642
+ track("Cases.GetInstanceStatusTimeline")
63643
+ ], CasesService.prototype, "getInstanceStatusTimeline", null);
63644
+ __decorate([
63645
+ track("Cases.GetTopFaultedCount")
63646
+ ], CasesService.prototype, "getTopFaultedCount", null);
63647
+ __decorate([
63648
+ track("Cases.GetTopExecutionDuration")
63649
+ ], CasesService.prototype, "getTopExecutionDuration", null);
63000
63650
  var CaseInstanceMap = {
63001
63651
  startedTimeUtc: "startedTime",
63002
63652
  completedTimeUtc: "completedTime",
@@ -63498,6 +64148,41 @@ class CaseInstancesService extends BaseService {
63498
64148
  };
63499
64149
  return await this.taskService.getAll(enhancedOptions);
63500
64150
  }
64151
+ async getSlaSummary(options) {
64152
+ const apiOptions = options ? {
64153
+ ...options,
64154
+ startTimeUtc: options.startTimeUtc?.toISOString(),
64155
+ endTimeUtc: options.endTimeUtc?.toISOString()
64156
+ } : undefined;
64157
+ return PaginationHelpers.getAll({
64158
+ serviceAccess: this.createPaginationServiceAccess(),
64159
+ getEndpoint: () => MAESTRO_ENDPOINTS.INSIGHTS.SLA_SUMMARY,
64160
+ method: HTTP_METHODS.POST,
64161
+ excludeFromPrefix: ["caseInstanceId", "startTimeUtc", "endTimeUtc"],
64162
+ transformFn: (item) => ({
64163
+ ...item,
64164
+ slaDueTime: toISOUtc(item.slaDueTime),
64165
+ lastModifiedTime: toISOUtc(item.lastModifiedTime)
64166
+ }),
64167
+ pagination: {
64168
+ paginationType: PaginationType.OFFSET,
64169
+ itemsField: SLA_SUMMARY_PAGINATION.ITEMS_FIELD,
64170
+ totalCountField: SLA_SUMMARY_PAGINATION.TOTAL_COUNT_FIELD,
64171
+ paginationParams: {
64172
+ pageSizeParam: SLA_SUMMARY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
64173
+ offsetParam: SLA_SUMMARY_OFFSET_PARAMS.OFFSET_PARAM,
64174
+ countParam: SLA_SUMMARY_OFFSET_PARAMS.COUNT_PARAM,
64175
+ convertToSkip: false
64176
+ }
64177
+ }
64178
+ }, apiOptions);
64179
+ }
64180
+ async getStagesSlaSummary(options) {
64181
+ const response = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.STAGES_SUMMARY, {
64182
+ caseInstanceId: options?.caseInstanceId
64183
+ });
64184
+ return response.data ?? [];
64185
+ }
63501
64186
  }
63502
64187
  __decorate([
63503
64188
  track("CaseInstances.GetAll")
@@ -63526,6 +64211,12 @@ __decorate([
63526
64211
  __decorate([
63527
64212
  track("CaseInstances.GetActionTasks")
63528
64213
  ], CaseInstancesService.prototype, "getActionTasks", null);
64214
+ __decorate([
64215
+ track("CaseInstances.GetSlaSummary")
64216
+ ], CaseInstancesService.prototype, "getSlaSummary", null);
64217
+ __decorate([
64218
+ track("CaseInstances.GetStagesSlaSummary")
64219
+ ], CaseInstancesService.prototype, "getStagesSlaSummary", null);
63529
64220
  function validateName(resourceType, name) {
63530
64221
  if (!name) {
63531
64222
  throw new ValidationError3({
@@ -63722,6 +64413,9 @@ class BucketService extends FolderScopedService {
63722
64413
  });
63723
64414
  return pascalToCamelCaseKeys(response.data);
63724
64415
  }
64416
+ async getByName(name, options = {}) {
64417
+ return this.getByNameLookup("Bucket", BUCKET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => pascalToCamelCaseKeys(raw));
64418
+ }
63725
64419
  async getAll(options) {
63726
64420
  const transformBucketResponse = (bucket) => pascalToCamelCaseKeys(bucket);
63727
64421
  return PaginationHelpers.getAll({
@@ -63839,6 +64533,56 @@ class BucketService extends FolderScopedService {
63839
64533
  }
63840
64534
  return transformedData;
63841
64535
  }
64536
+ async getFiles(bucketId, options) {
64537
+ if (!bucketId) {
64538
+ throw new ValidationError3({ message: "bucketId is required for getFiles" });
64539
+ }
64540
+ const { folderId, folderKey, folderPath, ...restOptions } = options ?? {};
64541
+ const headers = resolveFolderHeaders({
64542
+ folderId,
64543
+ folderKey,
64544
+ folderPath,
64545
+ resourceType: "Buckets.getFiles",
64546
+ fallbackFolderKey: this.config.folderKey
64547
+ });
64548
+ const transformBucketFile = (file2) => transformData(pascalToCamelCaseKeys(file2), BucketMap);
64549
+ return PaginationHelpers.getAll({
64550
+ serviceAccess: this.createPaginationServiceAccess(),
64551
+ getEndpoint: () => BUCKET_ENDPOINTS.GET_FILES(bucketId),
64552
+ transformFn: transformBucketFile,
64553
+ pagination: {
64554
+ paginationType: PaginationType.OFFSET,
64555
+ itemsField: ODATA_PAGINATION.ITEMS_FIELD,
64556
+ totalCountField: ODATA_PAGINATION.TOTAL_COUNT_FIELD,
64557
+ paginationParams: {
64558
+ pageSizeParam: ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM,
64559
+ offsetParam: ODATA_OFFSET_PARAMS.OFFSET_PARAM,
64560
+ countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM
64561
+ }
64562
+ },
64563
+ excludeFromPrefix: ["directory", "recursive", "fileNameRegex"],
64564
+ headers
64565
+ }, { ...restOptions, directory: "/", recursive: true });
64566
+ }
64567
+ async deleteFile(bucketId, path5, options) {
64568
+ if (!bucketId) {
64569
+ throw new ValidationError3({ message: "bucketId is required for deleteFile" });
64570
+ }
64571
+ if (!path5) {
64572
+ throw new ValidationError3({ message: "path is required for deleteFile" });
64573
+ }
64574
+ const headers = resolveFolderHeaders({
64575
+ folderId: options?.folderId,
64576
+ folderKey: options?.folderKey,
64577
+ folderPath: options?.folderPath,
64578
+ resourceType: "Buckets.deleteFile",
64579
+ fallbackFolderKey: this.config.folderKey
64580
+ });
64581
+ await this.delete(BUCKET_ENDPOINTS.DELETE_FILE(bucketId), {
64582
+ params: { path: path5 },
64583
+ headers
64584
+ });
64585
+ }
63842
64586
  async _getWriteUri(options) {
63843
64587
  const { bucketId, folderId, path: path5, expiryInMinutes, ...restOptions } = options;
63844
64588
  const queryOptions = {
@@ -63851,6 +64595,9 @@ class BucketService extends FolderScopedService {
63851
64595
  __decorate([
63852
64596
  track("Buckets.GetById")
63853
64597
  ], BucketService.prototype, "getById", null);
64598
+ __decorate([
64599
+ track("Buckets.GetByName")
64600
+ ], BucketService.prototype, "getByName", null);
63854
64601
  __decorate([
63855
64602
  track("Buckets.GetAll")
63856
64603
  ], BucketService.prototype, "getAll", null);
@@ -63863,6 +64610,12 @@ __decorate([
63863
64610
  __decorate([
63864
64611
  track("Buckets.GetReadUri")
63865
64612
  ], BucketService.prototype, "getReadUri", null);
64613
+ __decorate([
64614
+ track("Buckets.GetFiles")
64615
+ ], BucketService.prototype, "getFiles", null);
64616
+ __decorate([
64617
+ track("Buckets.DeleteFile")
64618
+ ], BucketService.prototype, "deleteFile", null);
63866
64619
  var BucketOptions;
63867
64620
  (function(BucketOptions2) {
63868
64621
  BucketOptions2["None"] = "None";
@@ -64322,14 +65075,34 @@ class ProcessService extends FolderScopedService {
64322
65075
  }
64323
65076
  }, options);
64324
65077
  }
64325
- async start(request, folderId, options = {}) {
64326
- const headers = createHeaders({ [FOLDER_ID]: folderId });
65078
+ async start(request, optionsOrFolderId, legacyOptions) {
65079
+ let folderId;
65080
+ let folderKey;
65081
+ let folderPath;
65082
+ let queryOptions;
65083
+ if (typeof optionsOrFolderId === "number") {
65084
+ folderId = optionsOrFolderId;
65085
+ queryOptions = legacyOptions ?? {};
65086
+ } else {
65087
+ const { folderId: fid, folderKey: fkey, folderPath: fpath, ...rest } = optionsOrFolderId ?? {};
65088
+ folderId = fid;
65089
+ folderKey = fkey;
65090
+ folderPath = fpath;
65091
+ queryOptions = rest;
65092
+ }
65093
+ const headers = resolveFolderHeaders({
65094
+ folderId,
65095
+ folderKey,
65096
+ folderPath,
65097
+ resourceType: "processes.start",
65098
+ fallbackFolderKey: this.config.folderKey
65099
+ });
64327
65100
  const apiRequest = transformRequest(request, ProcessMap);
64328
65101
  const requestBody = {
64329
65102
  startInfo: apiRequest
64330
65103
  };
64331
- const keysToPrefix = Object.keys(options);
64332
- const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
65104
+ const keysToPrefix = Object.keys(queryOptions);
65105
+ const apiOptions = addPrefixToKeys(queryOptions, ODATA_PREFIX, keysToPrefix);
64333
65106
  const response = await this.post(PROCESS_ENDPOINTS.START_PROCESS, requestBody, {
64334
65107
  params: apiOptions,
64335
65108
  headers
@@ -64619,8 +65392,8 @@ var WordGroupType;
64619
65392
  })(WordGroupType || (WordGroupType = {}));
64620
65393
  var ModelKind;
64621
65394
  (function(ModelKind2) {
64622
- ModelKind2["Classifier"] = "Classifier";
64623
65395
  ModelKind2["Extractor"] = "Extractor";
65396
+ ModelKind2["Classifier"] = "Classifier";
64624
65397
  })(ModelKind || (ModelKind = {}));
64625
65398
  var ModelType;
64626
65399
  (function(ModelType2) {
@@ -64628,6 +65401,12 @@ var ModelType;
64628
65401
  ModelType2["Modern"] = "Modern";
64629
65402
  ModelType2["Predefined"] = "Predefined";
64630
65403
  })(ModelType || (ModelType = {}));
65404
+ var ErrorSeverity;
65405
+ (function(ErrorSeverity2) {
65406
+ ErrorSeverity2["Info"] = "Info";
65407
+ ErrorSeverity2["Warning"] = "Warning";
65408
+ ErrorSeverity2["Error"] = "Error";
65409
+ })(ErrorSeverity || (ErrorSeverity = {}));
64631
65410
  var ClassifierDocumentTypeType;
64632
65411
  (function(ClassifierDocumentTypeType2) {
64633
65412
  ClassifierDocumentTypeType2["FormsAi"] = "FormsAi";
@@ -64651,6 +65430,13 @@ var GptFieldType;
64651
65430
  GptFieldType2["Number"] = "Number";
64652
65431
  GptFieldType2["Text"] = "Text";
64653
65432
  })(GptFieldType || (GptFieldType = {}));
65433
+ var JobStatus;
65434
+ (function(JobStatus2) {
65435
+ JobStatus2["Succeeded"] = "Succeeded";
65436
+ JobStatus2["Failed"] = "Failed";
65437
+ JobStatus2["Running"] = "Running";
65438
+ JobStatus2["NotStarted"] = "NotStarted";
65439
+ })(JobStatus || (JobStatus = {}));
64654
65440
  var ValidationDisplayMode;
64655
65441
  (function(ValidationDisplayMode2) {
64656
65442
  ValidationDisplayMode2["Classic"] = "Classic";
@@ -64843,7 +65629,7 @@ var addProcess = async ({ targetPath }) => {
64843
65629
 
64844
65630
  // src/schema/addDataFabricEntity.ts
64845
65631
  init_src();
64846
- import { randomUUID } from "node:crypto";
65632
+ import { randomUUID as randomUUID2 } from "node:crypto";
64847
65633
  var FIELD_TYPE_MAP = {
64848
65634
  string: { name: "NVARCHAR", lengthLimit: 200 },
64849
65635
  text: { name: "NVARCHAR", lengthLimit: 2000 },
@@ -64924,7 +65710,7 @@ async function addDataFabricEntity({
64924
65710
  throw new Error(`Entity "${name}" already exists.`);
64925
65711
  }
64926
65712
  const entity = {
64927
- id: randomUUID(),
65713
+ id: randomUUID2(),
64928
65714
  name,
64929
65715
  displayName: name,
64930
65716
  fields: parsedFields