@uipath/tasks-tool 1.196.0 → 1.197.0-preview.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.js +2 -0
  2. package/dist/tool.js +1653 -2104
  3. package/package.json +2 -2
package/dist/tool.js CHANGED
@@ -13520,8 +13520,8 @@ var require_Subscription = __commonJS((exports) => {
13520
13520
  if (_parentOrParents instanceof Subscription2) {
13521
13521
  _parentOrParents.remove(this);
13522
13522
  } else if (_parentOrParents !== null) {
13523
- for (var index2 = 0;index2 < _parentOrParents.length; ++index2) {
13524
- var parent_1 = _parentOrParents[index2];
13523
+ for (var index = 0;index < _parentOrParents.length; ++index) {
13524
+ var parent_1 = _parentOrParents[index];
13525
13525
  parent_1.remove(this);
13526
13526
  }
13527
13527
  }
@@ -13536,10 +13536,10 @@ var require_Subscription = __commonJS((exports) => {
13536
13536
  }
13537
13537
  }
13538
13538
  if (isArray_1.isArray(_subscriptions)) {
13539
- var index2 = -1;
13539
+ var index = -1;
13540
13540
  var len = _subscriptions.length;
13541
- while (++index2 < len) {
13542
- var sub2 = _subscriptions[index2];
13541
+ while (++index < len) {
13542
+ var sub2 = _subscriptions[index];
13543
13543
  if (isObject_1.isObject(sub2)) {
13544
13544
  try {
13545
13545
  sub2.unsubscribe();
@@ -14969,13 +14969,13 @@ var require_AsyncAction = __commonJS((exports) => {
14969
14969
  var id = this.id;
14970
14970
  var scheduler = this.scheduler;
14971
14971
  var actions = scheduler.actions;
14972
- var index2 = actions.indexOf(this);
14972
+ var index = actions.indexOf(this);
14973
14973
  this.work = null;
14974
14974
  this.state = null;
14975
14975
  this.pending = false;
14976
14976
  this.scheduler = null;
14977
- if (index2 !== -1) {
14978
- actions.splice(index2, 1);
14977
+ if (index !== -1) {
14978
+ actions.splice(index, 1);
14979
14979
  }
14980
14980
  if (id != null) {
14981
14981
  this.id = this.recycleAsyncId(scheduler, id, null);
@@ -15819,17 +15819,17 @@ var require_AsapScheduler = __commonJS((exports) => {
15819
15819
  this.scheduled = undefined;
15820
15820
  var actions = this.actions;
15821
15821
  var error;
15822
- var index2 = -1;
15822
+ var index = -1;
15823
15823
  var count = actions.length;
15824
15824
  action = action || actions.shift();
15825
15825
  do {
15826
15826
  if (error = action.execute(action.state, action.delay)) {
15827
15827
  break;
15828
15828
  }
15829
- } while (++index2 < count && (action = actions.shift()));
15829
+ } while (++index < count && (action = actions.shift()));
15830
15830
  this.active = false;
15831
15831
  if (error) {
15832
- while (++index2 < count && (action = actions.shift())) {
15832
+ while (++index < count && (action = actions.shift())) {
15833
15833
  action.unsubscribe();
15834
15834
  }
15835
15835
  throw error;
@@ -15952,17 +15952,17 @@ var require_AnimationFrameScheduler = __commonJS((exports) => {
15952
15952
  this.scheduled = undefined;
15953
15953
  var actions = this.actions;
15954
15954
  var error;
15955
- var index2 = -1;
15955
+ var index = -1;
15956
15956
  var count = actions.length;
15957
15957
  action = action || actions.shift();
15958
15958
  do {
15959
15959
  if (error = action.execute(action.state, action.delay)) {
15960
15960
  break;
15961
15961
  }
15962
- } while (++index2 < count && (action = actions.shift()));
15962
+ } while (++index < count && (action = actions.shift()));
15963
15963
  this.active = false;
15964
15964
  if (error) {
15965
- while (++index2 < count && (action = actions.shift())) {
15965
+ while (++index < count && (action = actions.shift())) {
15966
15966
  action.unsubscribe();
15967
15967
  }
15968
15968
  throw error;
@@ -16046,16 +16046,16 @@ var require_VirtualTimeScheduler = __commonJS((exports) => {
16046
16046
  exports.VirtualTimeScheduler = VirtualTimeScheduler;
16047
16047
  var VirtualAction = function(_super) {
16048
16048
  __extends(VirtualAction2, _super);
16049
- function VirtualAction2(scheduler, work, index2) {
16050
- if (index2 === undefined) {
16051
- index2 = scheduler.index += 1;
16049
+ function VirtualAction2(scheduler, work, index) {
16050
+ if (index === undefined) {
16051
+ index = scheduler.index += 1;
16052
16052
  }
16053
16053
  var _this = _super.call(this, scheduler, work) || this;
16054
16054
  _this.scheduler = scheduler;
16055
16055
  _this.work = work;
16056
- _this.index = index2;
16056
+ _this.index = index;
16057
16057
  _this.active = true;
16058
- _this.index = scheduler.index = index2;
16058
+ _this.index = scheduler.index = index;
16059
16059
  return _this;
16060
16060
  }
16061
16061
  VirtualAction2.prototype.schedule = function(state, delay) {
@@ -17202,9 +17202,9 @@ var require_mergeMap = __commonJS((exports) => {
17202
17202
  };
17203
17203
  MergeMapSubscriber2.prototype._tryNext = function(value) {
17204
17204
  var result;
17205
- var index2 = this.index++;
17205
+ var index = this.index++;
17206
17206
  try {
17207
- result = this.project(value, index2);
17207
+ result = this.project(value, index);
17208
17208
  } catch (err) {
17209
17209
  this.destination.error(err);
17210
17210
  return;
@@ -17784,12 +17784,12 @@ var require_pairs2 = __commonJS((exports) => {
17784
17784
  }
17785
17785
  exports.pairs = pairs;
17786
17786
  function dispatch(state) {
17787
- var { keys, index: index2, subscriber, subscription, obj } = state;
17787
+ var { keys, index, subscriber, subscription, obj } = state;
17788
17788
  if (!subscriber.closed) {
17789
- if (index2 < keys.length) {
17790
- var key = keys[index2];
17789
+ if (index < keys.length) {
17790
+ var key = keys[index];
17791
17791
  subscriber.next([key, obj[key]]);
17792
- subscription.add(this.schedule({ keys, index: index2 + 1, subscriber, subscription, obj }));
17792
+ subscription.add(this.schedule({ keys, index: index + 1, subscriber, subscription, obj }));
17793
17793
  } else {
17794
17794
  subscriber.complete();
17795
17795
  }
@@ -18002,18 +18002,18 @@ var require_range = __commonJS((exports) => {
18002
18002
  count = start;
18003
18003
  start = 0;
18004
18004
  }
18005
- var index2 = 0;
18005
+ var index = 0;
18006
18006
  var current = start;
18007
18007
  if (scheduler) {
18008
18008
  return scheduler.schedule(dispatch, 0, {
18009
- index: index2,
18009
+ index,
18010
18010
  count,
18011
18011
  start,
18012
18012
  subscriber
18013
18013
  });
18014
18014
  } else {
18015
18015
  do {
18016
- if (index2++ >= count) {
18016
+ if (index++ >= count) {
18017
18017
  subscriber.complete();
18018
18018
  break;
18019
18019
  }
@@ -18028,8 +18028,8 @@ var require_range = __commonJS((exports) => {
18028
18028
  }
18029
18029
  exports.range = range;
18030
18030
  function dispatch(state) {
18031
- var { start, index: index2, count, subscriber } = state;
18032
- if (index2 >= count) {
18031
+ var { start, index, count, subscriber } = state;
18032
+ if (index >= count) {
18033
18033
  subscriber.complete();
18034
18034
  return;
18035
18035
  }
@@ -18037,7 +18037,7 @@ var require_range = __commonJS((exports) => {
18037
18037
  if (subscriber.closed) {
18038
18038
  return;
18039
18039
  }
18040
- state.index = index2 + 1;
18040
+ state.index = index + 1;
18041
18041
  state.start = start + 1;
18042
18042
  this.schedule(state);
18043
18043
  }
@@ -18075,14 +18075,14 @@ var require_timer = __commonJS((exports) => {
18075
18075
  }
18076
18076
  exports.timer = timer;
18077
18077
  function dispatch(state) {
18078
- var { index: index2, period, subscriber } = state;
18079
- subscriber.next(index2);
18078
+ var { index, period, subscriber } = state;
18079
+ subscriber.next(index);
18080
18080
  if (subscriber.closed) {
18081
18081
  return;
18082
18082
  } else if (period === -1) {
18083
18083
  return subscriber.complete();
18084
18084
  }
18085
- state.index = index2 + 1;
18085
+ state.index = index + 1;
18086
18086
  this.schedule(state, period);
18087
18087
  }
18088
18088
  });
@@ -24638,9 +24638,9 @@ var require_resource = __commonJS((exports) => {
24638
24638
  // ../../node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.js
24639
24639
  var require_stable_attributes = __commonJS((exports) => {
24640
24640
  Object.defineProperty(exports, "__esModule", { value: true });
24641
- exports.ATTR_EXCEPTION_TYPE = exports.ATTR_EXCEPTION_STACKTRACE = exports.ATTR_EXCEPTION_MESSAGE = exports.ATTR_EXCEPTION_ESCAPED = exports.ERROR_TYPE_VALUE_OTHER = exports.ATTR_ERROR_TYPE = exports.DOTNET_GC_HEAP_GENERATION_VALUE_POH = exports.DOTNET_GC_HEAP_GENERATION_VALUE_LOH = exports.DOTNET_GC_HEAP_GENERATION_VALUE_GEN2 = exports.DOTNET_GC_HEAP_GENERATION_VALUE_GEN1 = exports.DOTNET_GC_HEAP_GENERATION_VALUE_GEN0 = exports.ATTR_DOTNET_GC_HEAP_GENERATION = exports.DB_SYSTEM_NAME_VALUE_POSTGRESQL = exports.DB_SYSTEM_NAME_VALUE_MYSQL = exports.DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER = exports.DB_SYSTEM_NAME_VALUE_MARIADB = exports.ATTR_DB_SYSTEM_NAME = exports.ATTR_DB_STORED_PROCEDURE_NAME = exports.ATTR_DB_RESPONSE_STATUS_CODE = exports.ATTR_DB_QUERY_TEXT = exports.ATTR_DB_QUERY_SUMMARY = exports.ATTR_DB_OPERATION_NAME = exports.ATTR_DB_OPERATION_BATCH_SIZE = exports.ATTR_DB_NAMESPACE = exports.ATTR_DB_COLLECTION_NAME = exports.ATTR_CODE_STACKTRACE = exports.ATTR_CODE_LINE_NUMBER = exports.ATTR_CODE_FUNCTION_NAME = exports.ATTR_CODE_FILE_PATH = exports.ATTR_CODE_COLUMN_NUMBER = exports.ATTR_CLIENT_PORT = exports.ATTR_CLIENT_ADDRESS = exports.ATTR_ASPNETCORE_USER_IS_AUTHENTICATED = exports.ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_SUCCESS = exports.ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_FAILURE = exports.ATTR_ASPNETCORE_ROUTING_MATCH_STATUS = exports.ATTR_ASPNETCORE_ROUTING_IS_FALLBACK = exports.ATTR_ASPNETCORE_REQUEST_IS_UNHANDLED = exports.ASPNETCORE_RATE_LIMITING_RESULT_VALUE_REQUEST_CANCELED = exports.ASPNETCORE_RATE_LIMITING_RESULT_VALUE_GLOBAL_LIMITER = exports.ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ENDPOINT_LIMITER = exports.ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ACQUIRED = exports.ATTR_ASPNETCORE_RATE_LIMITING_RESULT = exports.ATTR_ASPNETCORE_RATE_LIMITING_POLICY = exports.ATTR_ASPNETCORE_DIAGNOSTICS_HANDLER_TYPE = exports.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_UNHANDLED = exports.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_SKIPPED = exports.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_HANDLED = exports.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_ABORTED = exports.ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT = undefined;
24642
- exports.OTEL_STATUS_CODE_VALUE_ERROR = exports.ATTR_OTEL_STATUS_CODE = exports.ATTR_OTEL_SCOPE_VERSION = exports.ATTR_OTEL_SCOPE_NAME = exports.NETWORK_TYPE_VALUE_IPV6 = exports.NETWORK_TYPE_VALUE_IPV4 = exports.ATTR_NETWORK_TYPE = exports.NETWORK_TRANSPORT_VALUE_UNIX = exports.NETWORK_TRANSPORT_VALUE_UDP = exports.NETWORK_TRANSPORT_VALUE_TCP = exports.NETWORK_TRANSPORT_VALUE_QUIC = exports.NETWORK_TRANSPORT_VALUE_PIPE = exports.ATTR_NETWORK_TRANSPORT = exports.ATTR_NETWORK_PROTOCOL_VERSION = exports.ATTR_NETWORK_PROTOCOL_NAME = exports.ATTR_NETWORK_PEER_PORT = exports.ATTR_NETWORK_PEER_ADDRESS = exports.ATTR_NETWORK_LOCAL_PORT = exports.ATTR_NETWORK_LOCAL_ADDRESS = exports.JVM_THREAD_STATE_VALUE_WAITING = exports.JVM_THREAD_STATE_VALUE_TIMED_WAITING = exports.JVM_THREAD_STATE_VALUE_TERMINATED = exports.JVM_THREAD_STATE_VALUE_RUNNABLE = exports.JVM_THREAD_STATE_VALUE_NEW = exports.JVM_THREAD_STATE_VALUE_BLOCKED = exports.ATTR_JVM_THREAD_STATE = exports.ATTR_JVM_THREAD_DAEMON = exports.JVM_MEMORY_TYPE_VALUE_NON_HEAP = exports.JVM_MEMORY_TYPE_VALUE_HEAP = exports.ATTR_JVM_MEMORY_TYPE = exports.ATTR_JVM_MEMORY_POOL_NAME = exports.ATTR_JVM_GC_NAME = exports.ATTR_JVM_GC_ACTION = exports.ATTR_HTTP_ROUTE = exports.ATTR_HTTP_RESPONSE_STATUS_CODE = exports.ATTR_HTTP_RESPONSE_HEADER = exports.ATTR_HTTP_REQUEST_RESEND_COUNT = exports.ATTR_HTTP_REQUEST_METHOD_ORIGINAL = exports.HTTP_REQUEST_METHOD_VALUE_TRACE = exports.HTTP_REQUEST_METHOD_VALUE_PUT = exports.HTTP_REQUEST_METHOD_VALUE_POST = exports.HTTP_REQUEST_METHOD_VALUE_PATCH = exports.HTTP_REQUEST_METHOD_VALUE_OPTIONS = exports.HTTP_REQUEST_METHOD_VALUE_HEAD = exports.HTTP_REQUEST_METHOD_VALUE_GET = exports.HTTP_REQUEST_METHOD_VALUE_DELETE = exports.HTTP_REQUEST_METHOD_VALUE_CONNECT = exports.HTTP_REQUEST_METHOD_VALUE_OTHER = exports.ATTR_HTTP_REQUEST_METHOD = exports.ATTR_HTTP_REQUEST_HEADER = undefined;
24643
- exports.ATTR_USER_AGENT_ORIGINAL = exports.ATTR_URL_SCHEME = exports.ATTR_URL_QUERY = exports.ATTR_URL_PATH = exports.ATTR_URL_FULL = exports.ATTR_URL_FRAGMENT = exports.ATTR_TELEMETRY_SDK_VERSION = exports.ATTR_TELEMETRY_SDK_NAME = exports.TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS = exports.TELEMETRY_SDK_LANGUAGE_VALUE_SWIFT = exports.TELEMETRY_SDK_LANGUAGE_VALUE_RUST = exports.TELEMETRY_SDK_LANGUAGE_VALUE_RUBY = exports.TELEMETRY_SDK_LANGUAGE_VALUE_PYTHON = exports.TELEMETRY_SDK_LANGUAGE_VALUE_PHP = exports.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS = exports.TELEMETRY_SDK_LANGUAGE_VALUE_JAVA = exports.TELEMETRY_SDK_LANGUAGE_VALUE_GO = exports.TELEMETRY_SDK_LANGUAGE_VALUE_ERLANG = exports.TELEMETRY_SDK_LANGUAGE_VALUE_DOTNET = exports.TELEMETRY_SDK_LANGUAGE_VALUE_CPP = exports.ATTR_TELEMETRY_SDK_LANGUAGE = exports.SIGNALR_TRANSPORT_VALUE_WEB_SOCKETS = exports.SIGNALR_TRANSPORT_VALUE_SERVER_SENT_EVENTS = exports.SIGNALR_TRANSPORT_VALUE_LONG_POLLING = exports.ATTR_SIGNALR_TRANSPORT = exports.SIGNALR_CONNECTION_STATUS_VALUE_TIMEOUT = exports.SIGNALR_CONNECTION_STATUS_VALUE_NORMAL_CLOSURE = exports.SIGNALR_CONNECTION_STATUS_VALUE_APP_SHUTDOWN = exports.ATTR_SIGNALR_CONNECTION_STATUS = exports.ATTR_SERVICE_VERSION = exports.ATTR_SERVICE_NAMESPACE = exports.ATTR_SERVICE_NAME = exports.ATTR_SERVICE_INSTANCE_ID = exports.ATTR_SERVER_PORT = exports.ATTR_SERVER_ADDRESS = exports.ATTR_OTEL_STATUS_DESCRIPTION = exports.OTEL_STATUS_CODE_VALUE_OK = undefined;
24641
+ exports.ATTR_ERROR_TYPE = exports.DOTNET_GC_HEAP_GENERATION_VALUE_POH = exports.DOTNET_GC_HEAP_GENERATION_VALUE_LOH = exports.DOTNET_GC_HEAP_GENERATION_VALUE_GEN2 = exports.DOTNET_GC_HEAP_GENERATION_VALUE_GEN1 = exports.DOTNET_GC_HEAP_GENERATION_VALUE_GEN0 = exports.ATTR_DOTNET_GC_HEAP_GENERATION = exports.DEPLOYMENT_ENVIRONMENT_NAME_VALUE_TEST = exports.DEPLOYMENT_ENVIRONMENT_NAME_VALUE_STAGING = exports.DEPLOYMENT_ENVIRONMENT_NAME_VALUE_PRODUCTION = exports.DEPLOYMENT_ENVIRONMENT_NAME_VALUE_DEVELOPMENT = exports.ATTR_DEPLOYMENT_ENVIRONMENT_NAME = exports.DB_SYSTEM_NAME_VALUE_POSTGRESQL = exports.DB_SYSTEM_NAME_VALUE_MYSQL = exports.DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER = exports.DB_SYSTEM_NAME_VALUE_MARIADB = exports.ATTR_DB_SYSTEM_NAME = exports.ATTR_DB_STORED_PROCEDURE_NAME = exports.ATTR_DB_RESPONSE_STATUS_CODE = exports.ATTR_DB_QUERY_TEXT = exports.ATTR_DB_QUERY_SUMMARY = exports.ATTR_DB_OPERATION_NAME = exports.ATTR_DB_OPERATION_BATCH_SIZE = exports.ATTR_DB_NAMESPACE = exports.ATTR_DB_COLLECTION_NAME = exports.ATTR_CODE_STACKTRACE = exports.ATTR_CODE_LINE_NUMBER = exports.ATTR_CODE_FUNCTION_NAME = exports.ATTR_CODE_FILE_PATH = exports.ATTR_CODE_COLUMN_NUMBER = exports.ATTR_CLIENT_PORT = exports.ATTR_CLIENT_ADDRESS = exports.ATTR_ASPNETCORE_USER_IS_AUTHENTICATED = exports.ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_SUCCESS = exports.ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_FAILURE = exports.ATTR_ASPNETCORE_ROUTING_MATCH_STATUS = exports.ATTR_ASPNETCORE_ROUTING_IS_FALLBACK = exports.ATTR_ASPNETCORE_REQUEST_IS_UNHANDLED = exports.ASPNETCORE_RATE_LIMITING_RESULT_VALUE_REQUEST_CANCELED = exports.ASPNETCORE_RATE_LIMITING_RESULT_VALUE_GLOBAL_LIMITER = exports.ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ENDPOINT_LIMITER = exports.ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ACQUIRED = exports.ATTR_ASPNETCORE_RATE_LIMITING_RESULT = exports.ATTR_ASPNETCORE_RATE_LIMITING_POLICY = exports.ATTR_ASPNETCORE_DIAGNOSTICS_HANDLER_TYPE = exports.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_UNHANDLED = exports.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_SKIPPED = exports.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_HANDLED = exports.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_ABORTED = exports.ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT = undefined;
24642
+ exports.NETWORK_TYPE_VALUE_IPV4 = exports.ATTR_NETWORK_TYPE = exports.NETWORK_TRANSPORT_VALUE_UNIX = exports.NETWORK_TRANSPORT_VALUE_UDP = exports.NETWORK_TRANSPORT_VALUE_TCP = exports.NETWORK_TRANSPORT_VALUE_QUIC = exports.NETWORK_TRANSPORT_VALUE_PIPE = exports.ATTR_NETWORK_TRANSPORT = exports.ATTR_NETWORK_PROTOCOL_VERSION = exports.ATTR_NETWORK_PROTOCOL_NAME = exports.ATTR_NETWORK_PEER_PORT = exports.ATTR_NETWORK_PEER_ADDRESS = exports.ATTR_NETWORK_LOCAL_PORT = exports.ATTR_NETWORK_LOCAL_ADDRESS = exports.JVM_THREAD_STATE_VALUE_WAITING = exports.JVM_THREAD_STATE_VALUE_TIMED_WAITING = exports.JVM_THREAD_STATE_VALUE_TERMINATED = exports.JVM_THREAD_STATE_VALUE_RUNNABLE = exports.JVM_THREAD_STATE_VALUE_NEW = exports.JVM_THREAD_STATE_VALUE_BLOCKED = exports.ATTR_JVM_THREAD_STATE = exports.ATTR_JVM_THREAD_DAEMON = exports.JVM_MEMORY_TYPE_VALUE_NON_HEAP = exports.JVM_MEMORY_TYPE_VALUE_HEAP = exports.ATTR_JVM_MEMORY_TYPE = exports.ATTR_JVM_MEMORY_POOL_NAME = exports.ATTR_JVM_GC_NAME = exports.ATTR_JVM_GC_ACTION = exports.ATTR_HTTP_ROUTE = exports.ATTR_HTTP_RESPONSE_STATUS_CODE = exports.ATTR_HTTP_RESPONSE_HEADER = exports.ATTR_HTTP_REQUEST_RESEND_COUNT = exports.ATTR_HTTP_REQUEST_METHOD_ORIGINAL = exports.HTTP_REQUEST_METHOD_VALUE_TRACE = exports.HTTP_REQUEST_METHOD_VALUE_PUT = exports.HTTP_REQUEST_METHOD_VALUE_POST = exports.HTTP_REQUEST_METHOD_VALUE_PATCH = exports.HTTP_REQUEST_METHOD_VALUE_OPTIONS = exports.HTTP_REQUEST_METHOD_VALUE_HEAD = exports.HTTP_REQUEST_METHOD_VALUE_GET = exports.HTTP_REQUEST_METHOD_VALUE_DELETE = exports.HTTP_REQUEST_METHOD_VALUE_CONNECT = exports.HTTP_REQUEST_METHOD_VALUE_OTHER = exports.ATTR_HTTP_REQUEST_METHOD = exports.ATTR_HTTP_REQUEST_HEADER = exports.ATTR_EXCEPTION_TYPE = exports.ATTR_EXCEPTION_STACKTRACE = exports.ATTR_EXCEPTION_MESSAGE = exports.ATTR_EXCEPTION_ESCAPED = exports.ERROR_TYPE_VALUE_OTHER = undefined;
24643
+ exports.ATTR_USER_AGENT_ORIGINAL = exports.ATTR_URL_SCHEME = exports.ATTR_URL_QUERY = exports.ATTR_URL_PATH = exports.ATTR_URL_FULL = exports.ATTR_URL_FRAGMENT = exports.ATTR_TELEMETRY_SDK_VERSION = exports.ATTR_TELEMETRY_SDK_NAME = exports.TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS = exports.TELEMETRY_SDK_LANGUAGE_VALUE_SWIFT = exports.TELEMETRY_SDK_LANGUAGE_VALUE_RUST = exports.TELEMETRY_SDK_LANGUAGE_VALUE_RUBY = exports.TELEMETRY_SDK_LANGUAGE_VALUE_PYTHON = exports.TELEMETRY_SDK_LANGUAGE_VALUE_PHP = exports.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS = exports.TELEMETRY_SDK_LANGUAGE_VALUE_JAVA = exports.TELEMETRY_SDK_LANGUAGE_VALUE_GO = exports.TELEMETRY_SDK_LANGUAGE_VALUE_ERLANG = exports.TELEMETRY_SDK_LANGUAGE_VALUE_DOTNET = exports.TELEMETRY_SDK_LANGUAGE_VALUE_CPP = exports.ATTR_TELEMETRY_SDK_LANGUAGE = exports.ATTR_TELEMETRY_DISTRO_VERSION = exports.ATTR_TELEMETRY_DISTRO_NAME = exports.SIGNALR_TRANSPORT_VALUE_WEB_SOCKETS = exports.SIGNALR_TRANSPORT_VALUE_SERVER_SENT_EVENTS = exports.SIGNALR_TRANSPORT_VALUE_LONG_POLLING = exports.ATTR_SIGNALR_TRANSPORT = exports.SIGNALR_CONNECTION_STATUS_VALUE_TIMEOUT = exports.SIGNALR_CONNECTION_STATUS_VALUE_NORMAL_CLOSURE = exports.SIGNALR_CONNECTION_STATUS_VALUE_APP_SHUTDOWN = exports.ATTR_SIGNALR_CONNECTION_STATUS = exports.ATTR_SERVICE_VERSION = exports.ATTR_SERVICE_NAMESPACE = exports.ATTR_SERVICE_NAME = exports.ATTR_SERVICE_INSTANCE_ID = exports.ATTR_SERVER_PORT = exports.ATTR_SERVER_ADDRESS = exports.ATTR_OTEL_STATUS_DESCRIPTION = exports.OTEL_STATUS_CODE_VALUE_OK = exports.OTEL_STATUS_CODE_VALUE_ERROR = exports.ATTR_OTEL_STATUS_CODE = exports.ATTR_OTEL_SCOPE_VERSION = exports.ATTR_OTEL_SCOPE_NAME = exports.ATTR_OTEL_EVENT_NAME = exports.NETWORK_TYPE_VALUE_IPV6 = undefined;
24644
24644
  exports.ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT = "aspnetcore.diagnostics.exception.result";
24645
24645
  exports.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_ABORTED = "aborted";
24646
24646
  exports.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_HANDLED = "handled";
@@ -24679,6 +24679,11 @@ var require_stable_attributes = __commonJS((exports) => {
24679
24679
  exports.DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER = "microsoft.sql_server";
24680
24680
  exports.DB_SYSTEM_NAME_VALUE_MYSQL = "mysql";
24681
24681
  exports.DB_SYSTEM_NAME_VALUE_POSTGRESQL = "postgresql";
24682
+ exports.ATTR_DEPLOYMENT_ENVIRONMENT_NAME = "deployment.environment.name";
24683
+ exports.DEPLOYMENT_ENVIRONMENT_NAME_VALUE_DEVELOPMENT = "development";
24684
+ exports.DEPLOYMENT_ENVIRONMENT_NAME_VALUE_PRODUCTION = "production";
24685
+ exports.DEPLOYMENT_ENVIRONMENT_NAME_VALUE_STAGING = "staging";
24686
+ exports.DEPLOYMENT_ENVIRONMENT_NAME_VALUE_TEST = "test";
24682
24687
  exports.ATTR_DOTNET_GC_HEAP_GENERATION = "dotnet.gc.heap.generation";
24683
24688
  exports.DOTNET_GC_HEAP_GENERATION_VALUE_GEN0 = "gen0";
24684
24689
  exports.DOTNET_GC_HEAP_GENERATION_VALUE_GEN1 = "gen1";
@@ -24739,6 +24744,7 @@ var require_stable_attributes = __commonJS((exports) => {
24739
24744
  exports.ATTR_NETWORK_TYPE = "network.type";
24740
24745
  exports.NETWORK_TYPE_VALUE_IPV4 = "ipv4";
24741
24746
  exports.NETWORK_TYPE_VALUE_IPV6 = "ipv6";
24747
+ exports.ATTR_OTEL_EVENT_NAME = "otel.event.name";
24742
24748
  exports.ATTR_OTEL_SCOPE_NAME = "otel.scope.name";
24743
24749
  exports.ATTR_OTEL_SCOPE_VERSION = "otel.scope.version";
24744
24750
  exports.ATTR_OTEL_STATUS_CODE = "otel.status_code";
@@ -24759,6 +24765,8 @@ var require_stable_attributes = __commonJS((exports) => {
24759
24765
  exports.SIGNALR_TRANSPORT_VALUE_LONG_POLLING = "long_polling";
24760
24766
  exports.SIGNALR_TRANSPORT_VALUE_SERVER_SENT_EVENTS = "server_sent_events";
24761
24767
  exports.SIGNALR_TRANSPORT_VALUE_WEB_SOCKETS = "web_sockets";
24768
+ exports.ATTR_TELEMETRY_DISTRO_NAME = "telemetry.distro.name";
24769
+ exports.ATTR_TELEMETRY_DISTRO_VERSION = "telemetry.distro.version";
24762
24770
  exports.ATTR_TELEMETRY_SDK_LANGUAGE = "telemetry.sdk.language";
24763
24771
  exports.TELEMETRY_SDK_LANGUAGE_VALUE_CPP = "cpp";
24764
24772
  exports.TELEMETRY_SDK_LANGUAGE_VALUE_DOTNET = "dotnet";
@@ -25197,13 +25205,13 @@ var require_TraceState = __commonJS((exports) => {
25197
25205
  }
25198
25206
  serialize() {
25199
25207
  let serialized = "";
25200
- let index2 = 0;
25208
+ let index = 0;
25201
25209
  for (const entry of this._getState()) {
25202
- if (index2 > 0) {
25210
+ if (index > 0) {
25203
25211
  serialized = LIST_MEMBERS_SEPARATOR + serialized;
25204
25212
  }
25205
25213
  serialized = `${entry[0]}${LIST_MEMBER_KEY_VALUE_SPLITTER}${entry[1]}` + serialized;
25206
- index2++;
25214
+ index++;
25207
25215
  }
25208
25216
  return serialized;
25209
25217
  }
@@ -27236,7 +27244,7 @@ var require_src6 = __commonJS((exports) => {
27236
27244
  var package_default = {
27237
27245
  name: "@uipath/tasks-tool",
27238
27246
  license: "MIT",
27239
- version: "1.196.0",
27247
+ version: "1.197.0-preview.59",
27240
27248
  description: "Manage Action Center tasks.",
27241
27249
  type: "module",
27242
27250
  main: "./dist/tool.js",
@@ -27257,7 +27265,7 @@ var package_default = {
27257
27265
  "@types/node": "^25.5.2",
27258
27266
  "@uipath/auth": "workspace:*",
27259
27267
  "@uipath/common": "workspace:*",
27260
- "@uipath/uipath-typescript": "^1.3.11",
27268
+ "@uipath/uipath-typescript": "^1.4.1",
27261
27269
  commander: "^14.0.3",
27262
27270
  typescript: "^6.0.2"
27263
27271
  }
@@ -27310,27 +27318,54 @@ var NETWORK_ERROR_CODES = new Set([
27310
27318
  "ENETUNREACH",
27311
27319
  "EAI_FAIL"
27312
27320
  ]);
27313
- function isHtmlDocument(body) {
27314
- return /^\s*(<!doctype html|<html\b)/i.test(body);
27315
- }
27316
- function extractNetworkErrorCode(error) {
27317
- if (error === null || typeof error !== "object") {
27318
- return;
27319
- }
27320
- const err = error;
27321
- const code = typeof err.code === "string" ? err.code : undefined;
27322
- if (code && NETWORK_ERROR_CODES.has(code)) {
27323
- return code;
27324
- }
27325
- const cause = err.cause;
27326
- if (cause !== null && typeof cause === "object") {
27327
- const causeCode = cause.code;
27328
- if (typeof causeCode === "string" && NETWORK_ERROR_CODES.has(causeCode)) {
27329
- return causeCode;
27321
+ var TLS_ERROR_CODES = new Set([
27322
+ "SELF_SIGNED_CERT_IN_CHAIN",
27323
+ "DEPTH_ZERO_SELF_SIGNED_CERT",
27324
+ "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
27325
+ "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
27326
+ "UNABLE_TO_GET_ISSUER_CERT",
27327
+ "CERT_HAS_EXPIRED",
27328
+ "CERT_UNTRUSTED",
27329
+ "ERR_TLS_CERT_ALTNAME_INVALID"
27330
+ ]);
27331
+ var TLS_INSTRUCTIONS = "The server's TLS certificate could not be verified. Most often a " + "corporate proxy/firewall re-signs HTTPS with a root CA that Node does " + "not trust — set NODE_EXTRA_CA_CERTS to that CA's PEM file (and HTTPS_PROXY " + "if you connect through a proxy). If the certificate is instead expired or " + "its hostname does not match, fix the endpoint URL or the system clock. " + "Then retry.";
27332
+ var NETWORK_INSTRUCTIONS = "Could not reach the UiPath service. Check your network connection and " + "VPN, confirm any HTTP_PROXY/HTTPS_PROXY/NO_PROXY settings are correct, " + "then retry.";
27333
+ function describeConnectivityError(error) {
27334
+ let current = error;
27335
+ for (let depth = 0;depth < 5 && current !== null && typeof current === "object"; depth++) {
27336
+ const cur = current;
27337
+ const code = typeof cur.code === "string" ? cur.code : undefined;
27338
+ const message = typeof cur.message === "string" ? cur.message : undefined;
27339
+ if (code && TLS_ERROR_CODES.has(code)) {
27340
+ return {
27341
+ code,
27342
+ kind: "tls",
27343
+ message: message ?? code,
27344
+ instructions: TLS_INSTRUCTIONS
27345
+ };
27346
+ }
27347
+ if (code && NETWORK_ERROR_CODES.has(code)) {
27348
+ return {
27349
+ code,
27350
+ kind: "network",
27351
+ message: message ?? code,
27352
+ instructions: NETWORK_INSTRUCTIONS
27353
+ };
27330
27354
  }
27355
+ current = cur.cause;
27331
27356
  }
27332
27357
  return;
27333
27358
  }
27359
+ function parseHttpStatusFromMessage(message) {
27360
+ const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
27361
+ if (!match)
27362
+ return;
27363
+ const status = Number(match[1]);
27364
+ return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
27365
+ }
27366
+ function isHtmlDocument(body) {
27367
+ return /^\s*(<!doctype html|<html\b)/i.test(body);
27368
+ }
27334
27369
  function retryHintForRetryAfter(seconds) {
27335
27370
  if (seconds <= 1) {
27336
27371
  return "RetryAfter1Second";
@@ -27371,15 +27406,28 @@ function classifyError(status, error) {
27371
27406
  if (status !== undefined && status >= 500 && status < 600) {
27372
27407
  return { errorCode: "server_error", retry: "RetryLater" };
27373
27408
  }
27374
- if (extractNetworkErrorCode(error)) {
27375
- return { errorCode: "network_error", retry: "RetryLater" };
27409
+ const connectivity = describeConnectivityError(error);
27410
+ if (connectivity) {
27411
+ return {
27412
+ errorCode: "network_error",
27413
+ retry: connectivity.kind === "tls" ? "RetryWillNotFix" : "RetryLater"
27414
+ };
27376
27415
  }
27377
27416
  return { errorCode: "unknown_error", retry: "RetryWillNotFix" };
27378
27417
  }
27418
+ function formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus) {
27419
+ if (extractedMessage) {
27420
+ return `HTTP ${status}: ${extractedMessage}`;
27421
+ }
27422
+ return inferredStatus !== undefined ? rawMessage : `HTTP ${status}: ${rawMessage}`;
27423
+ }
27379
27424
  async function extractErrorDetails(error, options) {
27380
27425
  const err = error !== null && error !== undefined && typeof error === "object" ? error : {};
27381
27426
  const response = err.response;
27382
- const status = err.status ?? response?.status;
27427
+ const rawMessage = typeof err.message === "string" ? err.message : "Unknown error";
27428
+ const explicitStatus = err.status ?? response?.status;
27429
+ const inferredStatus = explicitStatus === undefined ? parseHttpStatusFromMessage(rawMessage) : undefined;
27430
+ const status = explicitStatus ?? inferredStatus;
27383
27431
  const isSuccessfulResponse = status !== undefined && status >= 200 && status < 300;
27384
27432
  let rawBody;
27385
27433
  let extractedMessage;
@@ -27414,7 +27462,6 @@ async function extractErrorDetails(error, options) {
27414
27462
  }
27415
27463
  }
27416
27464
  }
27417
- const rawMessage = typeof err.message === "string" ? err.message : "Unknown error";
27418
27465
  let message;
27419
27466
  let result = "Failure";
27420
27467
  const classification = classifyError(status, error);
@@ -27428,10 +27475,10 @@ async function extractErrorDetails(error, options) {
27428
27475
  } else if (status === 405) {
27429
27476
  message = DEFAULT_405;
27430
27477
  } else if (status === 400 || status === 422) {
27431
- message = extractedMessage ? `HTTP ${status}: ${extractedMessage}` : `HTTP ${status}: ${rawMessage}`;
27478
+ message = formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus);
27432
27479
  result = "ValidationError";
27433
27480
  } else if (status === 429) {
27434
- message = extractedMessage ? `HTTP ${status}: ${extractedMessage}` : `HTTP ${status}: ${rawMessage}`;
27481
+ message = formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus);
27435
27482
  } else if (extractedMessage) {
27436
27483
  if (isSuccessfulResponse && rawMessage !== "Unknown error") {
27437
27484
  message = rawMessage;
@@ -27439,7 +27486,9 @@ async function extractErrorDetails(error, options) {
27439
27486
  message = status ? `HTTP ${status}: ${extractedMessage}` : extractedMessage;
27440
27487
  }
27441
27488
  } else if (status) {
27442
- if (rawMessage === "Unknown error" && response) {
27489
+ if (inferredStatus !== undefined) {
27490
+ message = rawMessage;
27491
+ } else if (rawMessage === "Unknown error" && response) {
27443
27492
  const statusText = response.statusText;
27444
27493
  message = statusText ? `HTTP ${status} ${statusText}` : `HTTP ${status} - request failed`;
27445
27494
  } else {
@@ -27448,6 +27497,12 @@ async function extractErrorDetails(error, options) {
27448
27497
  } else {
27449
27498
  message = rawMessage;
27450
27499
  }
27500
+ if (status === undefined) {
27501
+ const connectivity = describeConnectivityError(error);
27502
+ if (connectivity && connectivity.message !== message && !message.includes(connectivity.message)) {
27503
+ message = `${message}: ${connectivity.message}`;
27504
+ }
27505
+ }
27451
27506
  let details = rawMessage;
27452
27507
  if (rawBody) {
27453
27508
  if (parsedBody) {
@@ -27629,6 +27684,7 @@ var CONSOLE_FALLBACK = {
27629
27684
  writeLog: (str) => process.stdout.write(str),
27630
27685
  capabilities: {
27631
27686
  isInteractive: false,
27687
+ canReadInput: false,
27632
27688
  supportsColor: false,
27633
27689
  outputWidth: 80
27634
27690
  }
@@ -32829,6 +32885,29 @@ function isPlainRecord(value) {
32829
32885
  const prototype = Object.getPrototypeOf(value);
32830
32886
  return prototype === Object.prototype || prototype === null;
32831
32887
  }
32888
+ function extractPagedRows(value) {
32889
+ if (Array.isArray(value) || !isPlainRecord(value))
32890
+ return null;
32891
+ const entries = Object.values(value);
32892
+ if (entries.length === 0)
32893
+ return null;
32894
+ let rows = null;
32895
+ let hasScalarSibling = false;
32896
+ for (const entry of entries) {
32897
+ if (Array.isArray(entry)) {
32898
+ if (rows !== null)
32899
+ return null;
32900
+ rows = entry;
32901
+ } else if (entry !== null && typeof entry === "object") {
32902
+ return null;
32903
+ } else {
32904
+ hasScalarSibling = true;
32905
+ }
32906
+ }
32907
+ if (rows === null || !hasScalarSibling)
32908
+ return null;
32909
+ return rows;
32910
+ }
32832
32911
  function toLowerCamelCaseKey(key) {
32833
32912
  if (!key)
32834
32913
  return key;
@@ -32893,7 +32972,8 @@ function printOutput(data, format = "json", logFn, asciiSafe = false) {
32893
32972
  break;
32894
32973
  case "plain": {
32895
32974
  if ("Data" in data && data.Data != null) {
32896
- const items = Array.isArray(data.Data) ? data.Data : [data.Data];
32975
+ const pagedRows = extractPagedRows(data.Data);
32976
+ const items = pagedRows ?? (Array.isArray(data.Data) ? data.Data : [data.Data]);
32897
32977
  items.forEach((item) => {
32898
32978
  const values = Object.values(item).map((v) => v ?? "").join("\t");
32899
32979
  logFn(values);
@@ -32905,10 +32985,13 @@ function printOutput(data, format = "json", logFn, asciiSafe = false) {
32905
32985
  break;
32906
32986
  }
32907
32987
  default: {
32908
- if ("Data" in data && data.Data != null && !(Array.isArray(data.Data) && data.Data.length === 0)) {
32988
+ const hasData = "Data" in data && data.Data != null;
32989
+ const pagedRows = hasData ? extractPagedRows(data.Data) : null;
32990
+ const rows = pagedRows ? pagedRows : Array.isArray(data.Data) ? data.Data : null;
32991
+ if (hasData && !(rows !== null && rows.length === 0)) {
32909
32992
  const logValue = data.Log;
32910
- if (Array.isArray(data.Data)) {
32911
- printResizableTable(data.Data, logFn, logValue);
32993
+ if (rows !== null) {
32994
+ printResizableTable(rows, logFn, logValue);
32912
32995
  } else {
32913
32996
  printVerticalTable(data.Data, logFn, logValue);
32914
32997
  }
@@ -33096,6 +33179,44 @@ function defaultErrorCodeForResult(result) {
33096
33179
  return "unknown_error";
33097
33180
  }
33098
33181
  }
33182
+ function parseHttpStatusFromMessage2(message) {
33183
+ const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
33184
+ if (!match)
33185
+ return;
33186
+ const status = Number(match[1]);
33187
+ return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
33188
+ }
33189
+ function defaultErrorCodeForHttpStatus(status) {
33190
+ if (status === undefined)
33191
+ return;
33192
+ if (status === 400 || status === 409 || status === 422) {
33193
+ return "invalid_argument";
33194
+ }
33195
+ if (status === 401)
33196
+ return "authentication_required";
33197
+ if (status === 403)
33198
+ return "permission_denied";
33199
+ if (status === 404)
33200
+ return "not_found";
33201
+ if (status === 405)
33202
+ return "method_not_allowed";
33203
+ if (status === 408)
33204
+ return "timeout";
33205
+ if (status === 429)
33206
+ return "rate_limited";
33207
+ if (status >= 500 && status < 600)
33208
+ return "server_error";
33209
+ return;
33210
+ }
33211
+ function defaultErrorCodeForFailure(data) {
33212
+ if (data.Result === RESULTS.Failure) {
33213
+ const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
33214
+ const errorCode = defaultErrorCodeForHttpStatus(status);
33215
+ if (errorCode)
33216
+ return errorCode;
33217
+ }
33218
+ return defaultErrorCodeForResult(data.Result);
33219
+ }
33099
33220
  function defaultRetryForErrorCode(errorCode) {
33100
33221
  switch (errorCode) {
33101
33222
  case "network_error":
@@ -33125,16 +33246,19 @@ var OutputFormatter;
33125
33246
  OutputFormatter.success = success;
33126
33247
  function error(data) {
33127
33248
  data.Log ??= getLogFilePath() || undefined;
33128
- data.ErrorCode ??= defaultErrorCodeForResult(data.Result);
33249
+ data.ErrorCode ??= defaultErrorCodeForFailure(data);
33129
33250
  data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
33130
33251
  process.exitCode = EXIT_CODES[data.Result] ?? 1;
33131
- telemetry.trackEvent(CommonTelemetryEvents.Error, {
33132
- result: data.Result,
33133
- errorCode: data.ErrorCode,
33134
- retry: data.Retry,
33135
- message: data.Message
33136
- });
33137
- logOutput(normalizeOutputKeys(data), getOutputFormat());
33252
+ const { SuppressTelemetry, ...envelope } = data;
33253
+ if (!SuppressTelemetry) {
33254
+ telemetry.trackEvent(CommonTelemetryEvents.Error, {
33255
+ result: data.Result,
33256
+ errorCode: data.ErrorCode,
33257
+ retry: data.Retry,
33258
+ message: data.Message
33259
+ });
33260
+ }
33261
+ logOutput(normalizeOutputKeys(envelope), getOutputFormat());
33138
33262
  }
33139
33263
  OutputFormatter.error = error;
33140
33264
  function emitList(code, items, opts) {
@@ -33424,1577 +33548,261 @@ var savedOriginalsSlot = singleton("ConsoleGuardOriginals");
33424
33548
  var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
33425
33549
  // ../common/src/interactivity-context.ts
33426
33550
  var modeSlot = singleton("InteractivityMode");
33427
- // ../../node_modules/jsonpath-plus/dist/index-node-esm.js
33428
- import vm from "vm";
33429
-
33430
- class Hooks {
33431
- add(name, callback, first) {
33432
- if (typeof arguments[0] != "string") {
33433
- for (let name2 in arguments[0]) {
33434
- this.add(name2, arguments[0][name2], arguments[1]);
33435
- }
33436
- } else {
33437
- (Array.isArray(name) ? name : [name]).forEach(function(name2) {
33438
- this[name2] = this[name2] || [];
33439
- if (callback) {
33440
- this[name2][first ? "unshift" : "push"](callback);
33441
- }
33442
- }, this);
33443
- }
33444
- }
33445
- run(name, env) {
33446
- this[name] = this[name] || [];
33447
- this[name].forEach(function(callback) {
33448
- callback.call(env && env.context ? env.context : env, env);
33449
- });
33450
- }
33551
+ // ../common/src/option-aliases.ts
33552
+ function warnDeprecatedOptionAlias(deprecatedFlag, preferredFlag) {
33553
+ getOutputSink().writeErr(`[WARN] ${deprecatedFlag} is deprecated. Use ${preferredFlag} instead.
33554
+ `);
33451
33555
  }
33452
-
33453
- class Plugins {
33454
- constructor(jsep) {
33455
- this.jsep = jsep;
33456
- this.registered = {};
33457
- }
33458
- register(...plugins) {
33459
- plugins.forEach((plugin) => {
33460
- if (typeof plugin !== "object" || !plugin.name || !plugin.init) {
33461
- throw new Error("Invalid JSEP plugin format");
33462
- }
33463
- if (this.registered[plugin.name]) {
33464
- return;
33465
- }
33466
- plugin.init(this.jsep);
33467
- this.registered[plugin.name] = plugin;
33468
- });
33469
- }
33556
+ var TENANT_SWITCH_COMMAND = "uip login tenant set <tenant>";
33557
+ function createHiddenDeprecatedTenantOption(flags = "-t, --tenant <tenant-name>") {
33558
+ return new Option(flags, `Tenant name. Deprecated; use ${TENANT_SWITCH_COMMAND} to switch active tenants.`).hideHelp().argParser((tenant) => {
33559
+ warnDeprecatedTenantOption(tenant);
33560
+ return tenant;
33561
+ });
33562
+ }
33563
+ function warnDeprecatedTenantOption(tenant) {
33564
+ if (tenant === undefined)
33565
+ return;
33566
+ warnDeprecatedOptionAlias("--tenant", TENANT_SWITCH_COMMAND);
33470
33567
  }
33568
+ // ../common/src/polling/types.ts
33569
+ var PollOutcome = {
33570
+ Completed: "completed",
33571
+ Timeout: "timeout",
33572
+ Interrupted: "interrupted",
33573
+ Aborted: "aborted",
33574
+ Failed: "failed"
33575
+ };
33471
33576
 
33472
- class Jsep {
33473
- static get version() {
33474
- return "1.4.0";
33475
- }
33476
- static toString() {
33477
- return "JavaScript Expression Parser (JSEP) v" + Jsep.version;
33478
- }
33479
- static addUnaryOp(op_name) {
33480
- Jsep.max_unop_len = Math.max(op_name.length, Jsep.max_unop_len);
33481
- Jsep.unary_ops[op_name] = 1;
33482
- return Jsep;
33483
- }
33484
- static addBinaryOp(op_name, precedence, isRightAssociative) {
33485
- Jsep.max_binop_len = Math.max(op_name.length, Jsep.max_binop_len);
33486
- Jsep.binary_ops[op_name] = precedence;
33487
- if (isRightAssociative) {
33488
- Jsep.right_associative.add(op_name);
33489
- } else {
33490
- Jsep.right_associative.delete(op_name);
33491
- }
33492
- return Jsep;
33577
+ // ../common/src/polling/poll-failure-mapping.ts
33578
+ var REASON_BY_OUTCOME = {
33579
+ [PollOutcome.Timeout]: "poll_timeout",
33580
+ [PollOutcome.Failed]: "poll_failed",
33581
+ [PollOutcome.Interrupted]: "poll_failed",
33582
+ [PollOutcome.Aborted]: "poll_aborted"
33583
+ };
33584
+ // ../common/src/polling/terminal-statuses.ts
33585
+ var TERMINAL_STATUSES = new Set([
33586
+ "completed",
33587
+ "successful",
33588
+ "faulted",
33589
+ "failed",
33590
+ "cancelled",
33591
+ "canceled",
33592
+ "stopped",
33593
+ "finished"
33594
+ ]);
33595
+ var FAILURE_STATUSES = new Set([
33596
+ "faulted",
33597
+ "failed",
33598
+ "cancelled",
33599
+ "canceled",
33600
+ "stopped"
33601
+ ]);
33602
+ // ../common/src/preview.ts
33603
+ var previewSlot = singleton("PreviewBuild");
33604
+ function isPreviewBuild() {
33605
+ return previewSlot.get(false) ?? false;
33606
+ }
33607
+ Command.prototype.previewCommand = function(nameAndArgs, opts) {
33608
+ if (isPreviewBuild()) {
33609
+ return this.command(nameAndArgs, opts);
33493
33610
  }
33494
- static addIdentifierChar(char) {
33495
- Jsep.additional_identifier_chars.add(char);
33496
- return Jsep;
33611
+ return new Command(nameAndArgs.split(/\s+/)[0] ?? nameAndArgs);
33612
+ };
33613
+ // ../common/src/screen-logger.ts
33614
+ var ScreenLogger;
33615
+ ((ScreenLogger) => {
33616
+ function progress(message) {
33617
+ getOutputSink().writeErr(`${message}
33618
+ `);
33497
33619
  }
33498
- static addLiteral(literal_name, literal_value) {
33499
- Jsep.literals[literal_name] = literal_value;
33500
- return Jsep;
33620
+ ScreenLogger.progress = progress;
33621
+ })(ScreenLogger ||= {});
33622
+ // ../common/src/sdk-user-agent.ts
33623
+ var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
33624
+ // ../common/src/tool-provider.ts
33625
+ var factorySlot = singleton("PackagerFactoryProvider");
33626
+ // ../auth/src/config.ts
33627
+ init_constants();
33628
+ var DEFAULT_CLIENT_ID = "36dea5b8-e8bb-423d-8e7b-c808df8f1c00";
33629
+ var AUTH_FILE_CONFIG_KEY = Symbol.for("@uipath/auth/AuthFileConfig");
33630
+ var globalSlot = globalThis;
33631
+ var getAuthFileConfig = () => globalSlot[AUTH_FILE_CONFIG_KEY] ?? {};
33632
+
33633
+ class InvalidBaseUrlError extends Error {
33634
+ url;
33635
+ reason;
33636
+ constructor(url, reason) {
33637
+ super(`Invalid base URL: "${url}"
33638
+ ` + `Reason: ${reason}
33639
+
33640
+ ` + `Expected format: an https:// URL, e.g. https://cloud.uipath.com (commercial), https://govcloud.uipath.us (Public Sector), or your Automation Suite host (https://<your-host>).
33641
+ ` + `You can specify the URL via:
33642
+ ` + ` • --authority flag
33643
+ ` + ` • UIPATH_URL environment variable
33644
+ ` + ` • auth.authority in config file`);
33645
+ this.url = url;
33646
+ this.reason = reason;
33647
+ this.name = "InvalidBaseUrlError";
33501
33648
  }
33502
- static removeUnaryOp(op_name) {
33503
- delete Jsep.unary_ops[op_name];
33504
- if (op_name.length === Jsep.max_unop_len) {
33505
- Jsep.max_unop_len = Jsep.getMaxKeyLen(Jsep.unary_ops);
33506
- }
33507
- return Jsep;
33649
+ }
33650
+ var DEFAULT_SCOPES = ["openid", "profile", "offline_access"];
33651
+ var normalizeAndValidateBaseUrl = (rawUrl) => {
33652
+ let baseUrl = rawUrl;
33653
+ if (baseUrl.endsWith("/identity_/")) {
33654
+ baseUrl = baseUrl.slice(0, -11);
33655
+ } else if (baseUrl.endsWith("/identity_")) {
33656
+ baseUrl = baseUrl.slice(0, -10);
33508
33657
  }
33509
- static removeAllUnaryOps() {
33510
- Jsep.unary_ops = {};
33511
- Jsep.max_unop_len = 0;
33512
- return Jsep;
33658
+ while (baseUrl.endsWith("/")) {
33659
+ baseUrl = baseUrl.slice(0, -1);
33513
33660
  }
33514
- static removeIdentifierChar(char) {
33515
- Jsep.additional_identifier_chars.delete(char);
33516
- return Jsep;
33661
+ const resolvedBaseUrl = baseUrl;
33662
+ const [urlError, url] = catchError2(() => new URL(resolvedBaseUrl));
33663
+ if (urlError) {
33664
+ throw new InvalidBaseUrlError(baseUrl, `Malformed URL. ${urlError instanceof Error ? urlError.message : "Unknown error"}`);
33517
33665
  }
33518
- static removeBinaryOp(op_name) {
33519
- delete Jsep.binary_ops[op_name];
33520
- if (op_name.length === Jsep.max_binop_len) {
33521
- Jsep.max_binop_len = Jsep.getMaxKeyLen(Jsep.binary_ops);
33522
- }
33523
- Jsep.right_associative.delete(op_name);
33524
- return Jsep;
33666
+ if (url.protocol !== "https:") {
33667
+ throw new InvalidBaseUrlError(baseUrl, `Authority must use https:// scheme, got ${url.protocol}//. OIDC token exchange requires TLS end-to-end.`);
33525
33668
  }
33526
- static removeAllBinaryOps() {
33527
- Jsep.binary_ops = {};
33528
- Jsep.max_binop_len = 0;
33529
- return Jsep;
33669
+ return url.pathname.length > 1 ? url.origin : baseUrl;
33670
+ };
33671
+ var resolveScopes = (isExternalAppAuth, customScopes, fileScopes) => {
33672
+ const requestedScopes = customScopes?.length ? customScopes : fileScopes ?? [];
33673
+ if (isExternalAppAuth)
33674
+ return requestedScopes;
33675
+ return [...new Set([...DEFAULT_SCOPES, ...requestedScopes])];
33676
+ };
33677
+ var resolveConfigAsync = async ({
33678
+ customAuthority,
33679
+ customClientId,
33680
+ customClientSecret,
33681
+ customScopes
33682
+ } = {}) => {
33683
+ const fileAuth = getAuthFileConfig();
33684
+ let baseUrl = customAuthority;
33685
+ if (!baseUrl) {
33686
+ baseUrl = process.env.UIPATH_URL;
33530
33687
  }
33531
- static removeLiteral(literal_name) {
33532
- delete Jsep.literals[literal_name];
33533
- return Jsep;
33688
+ if (!baseUrl && fileAuth.authority) {
33689
+ baseUrl = fileAuth.authority;
33534
33690
  }
33535
- static removeAllLiterals() {
33536
- Jsep.literals = {};
33537
- return Jsep;
33691
+ if (!baseUrl) {
33692
+ baseUrl = DEFAULT_BASE_URL;
33538
33693
  }
33539
- get char() {
33540
- return this.expr.charAt(this.index);
33694
+ baseUrl = normalizeAndValidateBaseUrl(baseUrl);
33695
+ let clientId = customClientId;
33696
+ if (!clientId && fileAuth.clientId) {
33697
+ clientId = fileAuth.clientId;
33541
33698
  }
33542
- get code() {
33543
- return this.expr.charCodeAt(this.index);
33699
+ if (!clientId) {
33700
+ clientId = DEFAULT_CLIENT_ID;
33544
33701
  }
33545
- constructor(expr) {
33546
- this.expr = expr;
33547
- this.index = 0;
33702
+ let clientSecret = customClientSecret;
33703
+ if (!clientSecret && fileAuth.clientSecret) {
33704
+ clientSecret = fileAuth.clientSecret;
33548
33705
  }
33549
- static parse(expr) {
33550
- return new Jsep(expr).parse();
33706
+ const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && Boolean(clientSecret);
33707
+ const scopes = resolveScopes(isExternalAppAuth, customScopes, fileAuth.scopes);
33708
+ return {
33709
+ clientId,
33710
+ clientSecret,
33711
+ scopes,
33712
+ baseUrl,
33713
+ authorizationEndpoint: `${baseUrl}/identity_/connect/authorize`,
33714
+ tokenEndpoint: `${baseUrl}/identity_/connect/token`
33715
+ };
33716
+ };
33717
+
33718
+ // ../auth/src/index.ts
33719
+ init_constants();
33720
+ // ../auth/src/loginStatus.ts
33721
+ init_src();
33722
+
33723
+ // ../auth/src/authProfile.ts
33724
+ init_src();
33725
+ init_constants();
33726
+ var DEFAULT_AUTH_PROFILE = "default";
33727
+ var PROFILE_DIR = "profiles";
33728
+ var PROFILE_NAME_RE = /^[A-Za-z0-9._-]+$/;
33729
+ var ACTIVE_AUTH_PROFILE_KEY = Symbol.for("@uipath/auth/ActiveAuthProfile");
33730
+ var AUTH_PROFILE_STORAGE_KEY = Symbol.for("@uipath/auth/ProfileStorage");
33731
+ var globalSlot2 = globalThis;
33732
+ function isAuthProfileStorage(value) {
33733
+ return value !== null && typeof value === "object" && "getStore" in value && "run" in value;
33734
+ }
33735
+ function createProfileStorage() {
33736
+ const [error, mod2] = catchError2(() => __require("node:async_hooks"));
33737
+ if (error || typeof mod2?.AsyncLocalStorage !== "function") {
33738
+ return {
33739
+ getStore: () => {
33740
+ return;
33741
+ },
33742
+ run: (_store, fn) => fn()
33743
+ };
33551
33744
  }
33552
- static getMaxKeyLen(obj) {
33553
- return Math.max(0, ...Object.keys(obj).map((k) => k.length));
33745
+ return new mod2.AsyncLocalStorage;
33746
+ }
33747
+ function getProfileStorage() {
33748
+ const existing = globalSlot2[AUTH_PROFILE_STORAGE_KEY];
33749
+ if (isAuthProfileStorage(existing)) {
33750
+ return existing;
33554
33751
  }
33555
- static isDecimalDigit(ch) {
33556
- return ch >= 48 && ch <= 57;
33752
+ const storage = createProfileStorage();
33753
+ globalSlot2[AUTH_PROFILE_STORAGE_KEY] = storage;
33754
+ return storage;
33755
+ }
33756
+ var profileStorage = getProfileStorage();
33757
+
33758
+ class AuthProfileValidationError extends Error {
33759
+ constructor(message) {
33760
+ super(message);
33761
+ this.name = "AuthProfileValidationError";
33557
33762
  }
33558
- static binaryPrecedence(op_val) {
33559
- return Jsep.binary_ops[op_val] || 0;
33763
+ }
33764
+ function normalizeAuthProfileName(profile) {
33765
+ if (profile === undefined || profile === DEFAULT_AUTH_PROFILE) {
33766
+ return;
33560
33767
  }
33561
- static isIdentifierStart(ch) {
33562
- return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 128 && !Jsep.binary_ops[String.fromCharCode(ch)] || Jsep.additional_identifier_chars.has(String.fromCharCode(ch));
33768
+ if (profile.length === 0 || profile === "." || profile === ".." || !PROFILE_NAME_RE.test(profile)) {
33769
+ throw new AuthProfileValidationError(`Invalid profile name "${profile}". Profile names may contain only letters, numbers, '.', '_', and '-'.`);
33563
33770
  }
33564
- static isIdentifierPart(ch) {
33565
- return Jsep.isIdentifierStart(ch) || Jsep.isDecimalDigit(ch);
33771
+ return profile;
33772
+ }
33773
+ function getActiveAuthProfile() {
33774
+ const scopedState = profileStorage.getStore();
33775
+ if (scopedState !== undefined) {
33776
+ return scopedState.profile;
33566
33777
  }
33567
- throwError(message) {
33568
- const error = new Error(message + " at character " + this.index);
33569
- error.index = this.index;
33570
- error.description = message;
33571
- throw error;
33778
+ return globalSlot2[ACTIVE_AUTH_PROFILE_KEY]?.profile;
33779
+ }
33780
+ function resolveAuthProfileFilePath(profile) {
33781
+ const normalized = normalizeAuthProfileName(profile);
33782
+ if (normalized === undefined) {
33783
+ throw new AuthProfileValidationError(`"${DEFAULT_AUTH_PROFILE}" is the built-in profile and does not have a profile file path.`);
33572
33784
  }
33573
- runHook(name, node) {
33574
- if (Jsep.hooks[name]) {
33575
- const env = {
33576
- context: this,
33577
- node
33578
- };
33579
- Jsep.hooks.run(name, env);
33580
- return env.node;
33581
- }
33582
- return node;
33583
- }
33584
- searchHook(name) {
33585
- if (Jsep.hooks[name]) {
33586
- const env = {
33587
- context: this
33588
- };
33589
- Jsep.hooks[name].find(function(callback) {
33590
- callback.call(env.context, env);
33591
- return env.node;
33592
- });
33593
- return env.node;
33594
- }
33595
- }
33596
- gobbleSpaces() {
33597
- let ch = this.code;
33598
- while (ch === Jsep.SPACE_CODE || ch === Jsep.TAB_CODE || ch === Jsep.LF_CODE || ch === Jsep.CR_CODE) {
33599
- ch = this.expr.charCodeAt(++this.index);
33600
- }
33601
- this.runHook("gobble-spaces");
33602
- }
33603
- parse() {
33604
- this.runHook("before-all");
33605
- const nodes = this.gobbleExpressions();
33606
- const node = nodes.length === 1 ? nodes[0] : {
33607
- type: Jsep.COMPOUND,
33608
- body: nodes
33609
- };
33610
- return this.runHook("after-all", node);
33611
- }
33612
- gobbleExpressions(untilICode) {
33613
- let nodes = [], ch_i, node;
33614
- while (this.index < this.expr.length) {
33615
- ch_i = this.code;
33616
- if (ch_i === Jsep.SEMCOL_CODE || ch_i === Jsep.COMMA_CODE) {
33617
- this.index++;
33618
- } else {
33619
- if (node = this.gobbleExpression()) {
33620
- nodes.push(node);
33621
- } else if (this.index < this.expr.length) {
33622
- if (ch_i === untilICode) {
33623
- break;
33624
- }
33625
- this.throwError('Unexpected "' + this.char + '"');
33626
- }
33627
- }
33628
- }
33629
- return nodes;
33630
- }
33631
- gobbleExpression() {
33632
- const node = this.searchHook("gobble-expression") || this.gobbleBinaryExpression();
33633
- this.gobbleSpaces();
33634
- return this.runHook("after-expression", node);
33635
- }
33636
- gobbleBinaryOp() {
33637
- this.gobbleSpaces();
33638
- let to_check = this.expr.substr(this.index, Jsep.max_binop_len);
33639
- let tc_len = to_check.length;
33640
- while (tc_len > 0) {
33641
- if (Jsep.binary_ops.hasOwnProperty(to_check) && (!Jsep.isIdentifierStart(this.code) || this.index + to_check.length < this.expr.length && !Jsep.isIdentifierPart(this.expr.charCodeAt(this.index + to_check.length)))) {
33642
- this.index += tc_len;
33643
- return to_check;
33644
- }
33645
- to_check = to_check.substr(0, --tc_len);
33646
- }
33647
- return false;
33648
- }
33649
- gobbleBinaryExpression() {
33650
- let node, biop, prec, stack, biop_info, left, right, i, cur_biop;
33651
- left = this.gobbleToken();
33652
- if (!left) {
33653
- return left;
33654
- }
33655
- biop = this.gobbleBinaryOp();
33656
- if (!biop) {
33657
- return left;
33658
- }
33659
- biop_info = {
33660
- value: biop,
33661
- prec: Jsep.binaryPrecedence(biop),
33662
- right_a: Jsep.right_associative.has(biop)
33663
- };
33664
- right = this.gobbleToken();
33665
- if (!right) {
33666
- this.throwError("Expected expression after " + biop);
33667
- }
33668
- stack = [left, biop_info, right];
33669
- while (biop = this.gobbleBinaryOp()) {
33670
- prec = Jsep.binaryPrecedence(biop);
33671
- if (prec === 0) {
33672
- this.index -= biop.length;
33673
- break;
33674
- }
33675
- biop_info = {
33676
- value: biop,
33677
- prec,
33678
- right_a: Jsep.right_associative.has(biop)
33679
- };
33680
- cur_biop = biop;
33681
- const comparePrev = (prev) => biop_info.right_a && prev.right_a ? prec > prev.prec : prec <= prev.prec;
33682
- while (stack.length > 2 && comparePrev(stack[stack.length - 2])) {
33683
- right = stack.pop();
33684
- biop = stack.pop().value;
33685
- left = stack.pop();
33686
- node = {
33687
- type: Jsep.BINARY_EXP,
33688
- operator: biop,
33689
- left,
33690
- right
33691
- };
33692
- stack.push(node);
33693
- }
33694
- node = this.gobbleToken();
33695
- if (!node) {
33696
- this.throwError("Expected expression after " + cur_biop);
33697
- }
33698
- stack.push(biop_info, node);
33699
- }
33700
- i = stack.length - 1;
33701
- node = stack[i];
33702
- while (i > 1) {
33703
- node = {
33704
- type: Jsep.BINARY_EXP,
33705
- operator: stack[i - 1].value,
33706
- left: stack[i - 2],
33707
- right: node
33708
- };
33709
- i -= 2;
33710
- }
33711
- return node;
33712
- }
33713
- gobbleToken() {
33714
- let ch, to_check, tc_len, node;
33715
- this.gobbleSpaces();
33716
- node = this.searchHook("gobble-token");
33717
- if (node) {
33718
- return this.runHook("after-token", node);
33719
- }
33720
- ch = this.code;
33721
- if (Jsep.isDecimalDigit(ch) || ch === Jsep.PERIOD_CODE) {
33722
- return this.gobbleNumericLiteral();
33723
- }
33724
- if (ch === Jsep.SQUOTE_CODE || ch === Jsep.DQUOTE_CODE) {
33725
- node = this.gobbleStringLiteral();
33726
- } else if (ch === Jsep.OBRACK_CODE) {
33727
- node = this.gobbleArray();
33728
- } else {
33729
- to_check = this.expr.substr(this.index, Jsep.max_unop_len);
33730
- tc_len = to_check.length;
33731
- while (tc_len > 0) {
33732
- if (Jsep.unary_ops.hasOwnProperty(to_check) && (!Jsep.isIdentifierStart(this.code) || this.index + to_check.length < this.expr.length && !Jsep.isIdentifierPart(this.expr.charCodeAt(this.index + to_check.length)))) {
33733
- this.index += tc_len;
33734
- const argument = this.gobbleToken();
33735
- if (!argument) {
33736
- this.throwError("missing unaryOp argument");
33737
- }
33738
- return this.runHook("after-token", {
33739
- type: Jsep.UNARY_EXP,
33740
- operator: to_check,
33741
- argument,
33742
- prefix: true
33743
- });
33744
- }
33745
- to_check = to_check.substr(0, --tc_len);
33746
- }
33747
- if (Jsep.isIdentifierStart(ch)) {
33748
- node = this.gobbleIdentifier();
33749
- if (Jsep.literals.hasOwnProperty(node.name)) {
33750
- node = {
33751
- type: Jsep.LITERAL,
33752
- value: Jsep.literals[node.name],
33753
- raw: node.name
33754
- };
33755
- } else if (node.name === Jsep.this_str) {
33756
- node = {
33757
- type: Jsep.THIS_EXP
33758
- };
33759
- }
33760
- } else if (ch === Jsep.OPAREN_CODE) {
33761
- node = this.gobbleGroup();
33762
- }
33763
- }
33764
- if (!node) {
33765
- return this.runHook("after-token", false);
33766
- }
33767
- node = this.gobbleTokenProperty(node);
33768
- return this.runHook("after-token", node);
33769
- }
33770
- gobbleTokenProperty(node) {
33771
- this.gobbleSpaces();
33772
- let ch = this.code;
33773
- while (ch === Jsep.PERIOD_CODE || ch === Jsep.OBRACK_CODE || ch === Jsep.OPAREN_CODE || ch === Jsep.QUMARK_CODE) {
33774
- let optional;
33775
- if (ch === Jsep.QUMARK_CODE) {
33776
- if (this.expr.charCodeAt(this.index + 1) !== Jsep.PERIOD_CODE) {
33777
- break;
33778
- }
33779
- optional = true;
33780
- this.index += 2;
33781
- this.gobbleSpaces();
33782
- ch = this.code;
33783
- }
33784
- this.index++;
33785
- if (ch === Jsep.OBRACK_CODE) {
33786
- node = {
33787
- type: Jsep.MEMBER_EXP,
33788
- computed: true,
33789
- object: node,
33790
- property: this.gobbleExpression()
33791
- };
33792
- if (!node.property) {
33793
- this.throwError('Unexpected "' + this.char + '"');
33794
- }
33795
- this.gobbleSpaces();
33796
- ch = this.code;
33797
- if (ch !== Jsep.CBRACK_CODE) {
33798
- this.throwError("Unclosed [");
33799
- }
33800
- this.index++;
33801
- } else if (ch === Jsep.OPAREN_CODE) {
33802
- node = {
33803
- type: Jsep.CALL_EXP,
33804
- arguments: this.gobbleArguments(Jsep.CPAREN_CODE),
33805
- callee: node
33806
- };
33807
- } else if (ch === Jsep.PERIOD_CODE || optional) {
33808
- if (optional) {
33809
- this.index--;
33810
- }
33811
- this.gobbleSpaces();
33812
- node = {
33813
- type: Jsep.MEMBER_EXP,
33814
- computed: false,
33815
- object: node,
33816
- property: this.gobbleIdentifier()
33817
- };
33818
- }
33819
- if (optional) {
33820
- node.optional = true;
33821
- }
33822
- this.gobbleSpaces();
33823
- ch = this.code;
33824
- }
33825
- return node;
33826
- }
33827
- gobbleNumericLiteral() {
33828
- let number = "", ch, chCode;
33829
- while (Jsep.isDecimalDigit(this.code)) {
33830
- number += this.expr.charAt(this.index++);
33831
- }
33832
- if (this.code === Jsep.PERIOD_CODE) {
33833
- number += this.expr.charAt(this.index++);
33834
- while (Jsep.isDecimalDigit(this.code)) {
33835
- number += this.expr.charAt(this.index++);
33836
- }
33837
- }
33838
- ch = this.char;
33839
- if (ch === "e" || ch === "E") {
33840
- number += this.expr.charAt(this.index++);
33841
- ch = this.char;
33842
- if (ch === "+" || ch === "-") {
33843
- number += this.expr.charAt(this.index++);
33844
- }
33845
- while (Jsep.isDecimalDigit(this.code)) {
33846
- number += this.expr.charAt(this.index++);
33847
- }
33848
- if (!Jsep.isDecimalDigit(this.expr.charCodeAt(this.index - 1))) {
33849
- this.throwError("Expected exponent (" + number + this.char + ")");
33850
- }
33851
- }
33852
- chCode = this.code;
33853
- if (Jsep.isIdentifierStart(chCode)) {
33854
- this.throwError("Variable names cannot start with a number (" + number + this.char + ")");
33855
- } else if (chCode === Jsep.PERIOD_CODE || number.length === 1 && number.charCodeAt(0) === Jsep.PERIOD_CODE) {
33856
- this.throwError("Unexpected period");
33857
- }
33858
- return {
33859
- type: Jsep.LITERAL,
33860
- value: parseFloat(number),
33861
- raw: number
33862
- };
33863
- }
33864
- gobbleStringLiteral() {
33865
- let str = "";
33866
- const startIndex = this.index;
33867
- const quote = this.expr.charAt(this.index++);
33868
- let closed = false;
33869
- while (this.index < this.expr.length) {
33870
- let ch = this.expr.charAt(this.index++);
33871
- if (ch === quote) {
33872
- closed = true;
33873
- break;
33874
- } else if (ch === "\\") {
33875
- ch = this.expr.charAt(this.index++);
33876
- switch (ch) {
33877
- case "n":
33878
- str += `
33879
- `;
33880
- break;
33881
- case "r":
33882
- str += "\r";
33883
- break;
33884
- case "t":
33885
- str += "\t";
33886
- break;
33887
- case "b":
33888
- str += "\b";
33889
- break;
33890
- case "f":
33891
- str += "\f";
33892
- break;
33893
- case "v":
33894
- str += "\v";
33895
- break;
33896
- default:
33897
- str += ch;
33898
- }
33899
- } else {
33900
- str += ch;
33901
- }
33902
- }
33903
- if (!closed) {
33904
- this.throwError('Unclosed quote after "' + str + '"');
33905
- }
33906
- return {
33907
- type: Jsep.LITERAL,
33908
- value: str,
33909
- raw: this.expr.substring(startIndex, this.index)
33910
- };
33911
- }
33912
- gobbleIdentifier() {
33913
- let ch = this.code, start = this.index;
33914
- if (Jsep.isIdentifierStart(ch)) {
33915
- this.index++;
33916
- } else {
33917
- this.throwError("Unexpected " + this.char);
33918
- }
33919
- while (this.index < this.expr.length) {
33920
- ch = this.code;
33921
- if (Jsep.isIdentifierPart(ch)) {
33922
- this.index++;
33923
- } else {
33924
- break;
33925
- }
33926
- }
33927
- return {
33928
- type: Jsep.IDENTIFIER,
33929
- name: this.expr.slice(start, this.index)
33930
- };
33931
- }
33932
- gobbleArguments(termination) {
33933
- const args = [];
33934
- let closed = false;
33935
- let separator_count = 0;
33936
- while (this.index < this.expr.length) {
33937
- this.gobbleSpaces();
33938
- let ch_i = this.code;
33939
- if (ch_i === termination) {
33940
- closed = true;
33941
- this.index++;
33942
- if (termination === Jsep.CPAREN_CODE && separator_count && separator_count >= args.length) {
33943
- this.throwError("Unexpected token " + String.fromCharCode(termination));
33944
- }
33945
- break;
33946
- } else if (ch_i === Jsep.COMMA_CODE) {
33947
- this.index++;
33948
- separator_count++;
33949
- if (separator_count !== args.length) {
33950
- if (termination === Jsep.CPAREN_CODE) {
33951
- this.throwError("Unexpected token ,");
33952
- } else if (termination === Jsep.CBRACK_CODE) {
33953
- for (let arg = args.length;arg < separator_count; arg++) {
33954
- args.push(null);
33955
- }
33956
- }
33957
- }
33958
- } else if (args.length !== separator_count && separator_count !== 0) {
33959
- this.throwError("Expected comma");
33960
- } else {
33961
- const node = this.gobbleExpression();
33962
- if (!node || node.type === Jsep.COMPOUND) {
33963
- this.throwError("Expected comma");
33964
- }
33965
- args.push(node);
33966
- }
33967
- }
33968
- if (!closed) {
33969
- this.throwError("Expected " + String.fromCharCode(termination));
33970
- }
33971
- return args;
33972
- }
33973
- gobbleGroup() {
33974
- this.index++;
33975
- let nodes = this.gobbleExpressions(Jsep.CPAREN_CODE);
33976
- if (this.code === Jsep.CPAREN_CODE) {
33977
- this.index++;
33978
- if (nodes.length === 1) {
33979
- return nodes[0];
33980
- } else if (!nodes.length) {
33981
- return false;
33982
- } else {
33983
- return {
33984
- type: Jsep.SEQUENCE_EXP,
33985
- expressions: nodes
33986
- };
33987
- }
33988
- } else {
33989
- this.throwError("Unclosed (");
33990
- }
33991
- }
33992
- gobbleArray() {
33993
- this.index++;
33994
- return {
33995
- type: Jsep.ARRAY_EXP,
33996
- elements: this.gobbleArguments(Jsep.CBRACK_CODE)
33997
- };
33998
- }
33999
- }
34000
- var hooks = new Hooks;
34001
- Object.assign(Jsep, {
34002
- hooks,
34003
- plugins: new Plugins(Jsep),
34004
- COMPOUND: "Compound",
34005
- SEQUENCE_EXP: "SequenceExpression",
34006
- IDENTIFIER: "Identifier",
34007
- MEMBER_EXP: "MemberExpression",
34008
- LITERAL: "Literal",
34009
- THIS_EXP: "ThisExpression",
34010
- CALL_EXP: "CallExpression",
34011
- UNARY_EXP: "UnaryExpression",
34012
- BINARY_EXP: "BinaryExpression",
34013
- ARRAY_EXP: "ArrayExpression",
34014
- TAB_CODE: 9,
34015
- LF_CODE: 10,
34016
- CR_CODE: 13,
34017
- SPACE_CODE: 32,
34018
- PERIOD_CODE: 46,
34019
- COMMA_CODE: 44,
34020
- SQUOTE_CODE: 39,
34021
- DQUOTE_CODE: 34,
34022
- OPAREN_CODE: 40,
34023
- CPAREN_CODE: 41,
34024
- OBRACK_CODE: 91,
34025
- CBRACK_CODE: 93,
34026
- QUMARK_CODE: 63,
34027
- SEMCOL_CODE: 59,
34028
- COLON_CODE: 58,
34029
- unary_ops: {
34030
- "-": 1,
34031
- "!": 1,
34032
- "~": 1,
34033
- "+": 1
34034
- },
34035
- binary_ops: {
34036
- "||": 1,
34037
- "??": 1,
34038
- "&&": 2,
34039
- "|": 3,
34040
- "^": 4,
34041
- "&": 5,
34042
- "==": 6,
34043
- "!=": 6,
34044
- "===": 6,
34045
- "!==": 6,
34046
- "<": 7,
34047
- ">": 7,
34048
- "<=": 7,
34049
- ">=": 7,
34050
- "<<": 8,
34051
- ">>": 8,
34052
- ">>>": 8,
34053
- "+": 9,
34054
- "-": 9,
34055
- "*": 10,
34056
- "/": 10,
34057
- "%": 10,
34058
- "**": 11
34059
- },
34060
- right_associative: new Set(["**"]),
34061
- additional_identifier_chars: new Set(["$", "_"]),
34062
- literals: {
34063
- true: true,
34064
- false: false,
34065
- null: null
34066
- },
34067
- this_str: "this"
34068
- });
34069
- Jsep.max_unop_len = Jsep.getMaxKeyLen(Jsep.unary_ops);
34070
- Jsep.max_binop_len = Jsep.getMaxKeyLen(Jsep.binary_ops);
34071
- var jsep = (expr) => new Jsep(expr).parse();
34072
- var stdClassProps = Object.getOwnPropertyNames(class Test {
34073
- });
34074
- Object.getOwnPropertyNames(Jsep).filter((prop) => !stdClassProps.includes(prop) && jsep[prop] === undefined).forEach((m) => {
34075
- jsep[m] = Jsep[m];
34076
- });
34077
- jsep.Jsep = Jsep;
34078
- var CONDITIONAL_EXP = "ConditionalExpression";
34079
- var ternary = {
34080
- name: "ternary",
34081
- init(jsep2) {
34082
- jsep2.hooks.add("after-expression", function gobbleTernary(env) {
34083
- if (env.node && this.code === jsep2.QUMARK_CODE) {
34084
- this.index++;
34085
- const test = env.node;
34086
- const consequent = this.gobbleExpression();
34087
- if (!consequent) {
34088
- this.throwError("Expected expression");
34089
- }
34090
- this.gobbleSpaces();
34091
- if (this.code === jsep2.COLON_CODE) {
34092
- this.index++;
34093
- const alternate = this.gobbleExpression();
34094
- if (!alternate) {
34095
- this.throwError("Expected expression");
34096
- }
34097
- env.node = {
34098
- type: CONDITIONAL_EXP,
34099
- test,
34100
- consequent,
34101
- alternate
34102
- };
34103
- if (test.operator && jsep2.binary_ops[test.operator] <= 0.9) {
34104
- let newTest = test;
34105
- while (newTest.right.operator && jsep2.binary_ops[newTest.right.operator] <= 0.9) {
34106
- newTest = newTest.right;
34107
- }
34108
- env.node.test = newTest.right;
34109
- newTest.right = env.node;
34110
- env.node = test;
34111
- }
34112
- } else {
34113
- this.throwError("Expected :");
34114
- }
34115
- }
34116
- });
34117
- }
34118
- };
34119
- jsep.plugins.register(ternary);
34120
- var FSLASH_CODE = 47;
34121
- var BSLASH_CODE = 92;
34122
- var index = {
34123
- name: "regex",
34124
- init(jsep2) {
34125
- jsep2.hooks.add("gobble-token", function gobbleRegexLiteral(env) {
34126
- if (this.code === FSLASH_CODE) {
34127
- const patternIndex = ++this.index;
34128
- let inCharSet = false;
34129
- while (this.index < this.expr.length) {
34130
- if (this.code === FSLASH_CODE && !inCharSet) {
34131
- const pattern = this.expr.slice(patternIndex, this.index);
34132
- let flags = "";
34133
- while (++this.index < this.expr.length) {
34134
- const code = this.code;
34135
- if (code >= 97 && code <= 122 || code >= 65 && code <= 90 || code >= 48 && code <= 57) {
34136
- flags += this.char;
34137
- } else {
34138
- break;
34139
- }
34140
- }
34141
- let value;
34142
- try {
34143
- value = new RegExp(pattern, flags);
34144
- } catch (e) {
34145
- this.throwError(e.message);
34146
- }
34147
- env.node = {
34148
- type: jsep2.LITERAL,
34149
- value,
34150
- raw: this.expr.slice(patternIndex - 1, this.index)
34151
- };
34152
- env.node = this.gobbleTokenProperty(env.node);
34153
- return env.node;
34154
- }
34155
- if (this.code === jsep2.OBRACK_CODE) {
34156
- inCharSet = true;
34157
- } else if (inCharSet && this.code === jsep2.CBRACK_CODE) {
34158
- inCharSet = false;
34159
- }
34160
- this.index += this.code === BSLASH_CODE ? 2 : 1;
34161
- }
34162
- this.throwError("Unclosed Regex");
34163
- }
34164
- });
34165
- }
34166
- };
34167
- var PLUS_CODE = 43;
34168
- var MINUS_CODE = 45;
34169
- var plugin = {
34170
- name: "assignment",
34171
- assignmentOperators: new Set(["=", "*=", "**=", "/=", "%=", "+=", "-=", "<<=", ">>=", ">>>=", "&=", "^=", "|=", "||=", "&&=", "??="]),
34172
- updateOperators: [PLUS_CODE, MINUS_CODE],
34173
- assignmentPrecedence: 0.9,
34174
- init(jsep2) {
34175
- const updateNodeTypes = [jsep2.IDENTIFIER, jsep2.MEMBER_EXP];
34176
- plugin.assignmentOperators.forEach((op) => jsep2.addBinaryOp(op, plugin.assignmentPrecedence, true));
34177
- jsep2.hooks.add("gobble-token", function gobbleUpdatePrefix(env) {
34178
- const code = this.code;
34179
- if (plugin.updateOperators.some((c) => c === code && c === this.expr.charCodeAt(this.index + 1))) {
34180
- this.index += 2;
34181
- env.node = {
34182
- type: "UpdateExpression",
34183
- operator: code === PLUS_CODE ? "++" : "--",
34184
- argument: this.gobbleTokenProperty(this.gobbleIdentifier()),
34185
- prefix: true
34186
- };
34187
- if (!env.node.argument || !updateNodeTypes.includes(env.node.argument.type)) {
34188
- this.throwError(`Unexpected ${env.node.operator}`);
34189
- }
34190
- }
34191
- });
34192
- jsep2.hooks.add("after-token", function gobbleUpdatePostfix(env) {
34193
- if (env.node) {
34194
- const code = this.code;
34195
- if (plugin.updateOperators.some((c) => c === code && c === this.expr.charCodeAt(this.index + 1))) {
34196
- if (!updateNodeTypes.includes(env.node.type)) {
34197
- this.throwError(`Unexpected ${env.node.operator}`);
34198
- }
34199
- this.index += 2;
34200
- env.node = {
34201
- type: "UpdateExpression",
34202
- operator: code === PLUS_CODE ? "++" : "--",
34203
- argument: env.node,
34204
- prefix: false
34205
- };
34206
- }
34207
- }
34208
- });
34209
- jsep2.hooks.add("after-expression", function gobbleAssignment(env) {
34210
- if (env.node) {
34211
- updateBinariesToAssignments(env.node);
34212
- }
34213
- });
34214
- function updateBinariesToAssignments(node) {
34215
- if (plugin.assignmentOperators.has(node.operator)) {
34216
- node.type = "AssignmentExpression";
34217
- updateBinariesToAssignments(node.left);
34218
- updateBinariesToAssignments(node.right);
34219
- } else if (!node.operator) {
34220
- Object.values(node).forEach((val) => {
34221
- if (val && typeof val === "object") {
34222
- updateBinariesToAssignments(val);
34223
- }
34224
- });
34225
- }
34226
- }
34227
- }
34228
- };
34229
- jsep.plugins.register(index, plugin);
34230
- jsep.addUnaryOp("typeof");
34231
- jsep.addUnaryOp("void");
34232
- jsep.addLiteral("null", null);
34233
- jsep.addLiteral("undefined", undefined);
34234
- var BLOCKED_PROTO_PROPERTIES = new Set(["constructor", "__proto__", "__defineGetter__", "__defineSetter__", "__lookupGetter__", "__lookupSetter__"]);
34235
- var SafeEval = {
34236
- evalAst(ast, subs) {
34237
- switch (ast.type) {
34238
- case "BinaryExpression":
34239
- case "LogicalExpression":
34240
- return SafeEval.evalBinaryExpression(ast, subs);
34241
- case "Compound":
34242
- return SafeEval.evalCompound(ast, subs);
34243
- case "ConditionalExpression":
34244
- return SafeEval.evalConditionalExpression(ast, subs);
34245
- case "Identifier":
34246
- return SafeEval.evalIdentifier(ast, subs);
34247
- case "Literal":
34248
- return SafeEval.evalLiteral(ast, subs);
34249
- case "MemberExpression":
34250
- return SafeEval.evalMemberExpression(ast, subs);
34251
- case "UnaryExpression":
34252
- return SafeEval.evalUnaryExpression(ast, subs);
34253
- case "ArrayExpression":
34254
- return SafeEval.evalArrayExpression(ast, subs);
34255
- case "CallExpression":
34256
- return SafeEval.evalCallExpression(ast, subs);
34257
- case "AssignmentExpression":
34258
- return SafeEval.evalAssignmentExpression(ast, subs);
34259
- default:
34260
- throw SyntaxError("Unexpected expression", ast);
34261
- }
34262
- },
34263
- evalBinaryExpression(ast, subs) {
34264
- const result = {
34265
- "||": (a, b) => a || b(),
34266
- "&&": (a, b) => a && b(),
34267
- "|": (a, b) => a | b(),
34268
- "^": (a, b) => a ^ b(),
34269
- "&": (a, b) => a & b(),
34270
- "==": (a, b) => a == b(),
34271
- "!=": (a, b) => a != b(),
34272
- "===": (a, b) => a === b(),
34273
- "!==": (a, b) => a !== b(),
34274
- "<": (a, b) => a < b(),
34275
- ">": (a, b) => a > b(),
34276
- "<=": (a, b) => a <= b(),
34277
- ">=": (a, b) => a >= b(),
34278
- "<<": (a, b) => a << b(),
34279
- ">>": (a, b) => a >> b(),
34280
- ">>>": (a, b) => a >>> b(),
34281
- "+": (a, b) => a + b(),
34282
- "-": (a, b) => a - b(),
34283
- "*": (a, b) => a * b(),
34284
- "/": (a, b) => a / b(),
34285
- "%": (a, b) => a % b()
34286
- }[ast.operator](SafeEval.evalAst(ast.left, subs), () => SafeEval.evalAst(ast.right, subs));
34287
- return result;
34288
- },
34289
- evalCompound(ast, subs) {
34290
- let last;
34291
- for (let i = 0;i < ast.body.length; i++) {
34292
- if (ast.body[i].type === "Identifier" && ["var", "let", "const"].includes(ast.body[i].name) && ast.body[i + 1] && ast.body[i + 1].type === "AssignmentExpression") {
34293
- i += 1;
34294
- }
34295
- const expr = ast.body[i];
34296
- last = SafeEval.evalAst(expr, subs);
34297
- }
34298
- return last;
34299
- },
34300
- evalConditionalExpression(ast, subs) {
34301
- if (SafeEval.evalAst(ast.test, subs)) {
34302
- return SafeEval.evalAst(ast.consequent, subs);
34303
- }
34304
- return SafeEval.evalAst(ast.alternate, subs);
34305
- },
34306
- evalIdentifier(ast, subs) {
34307
- if (Object.hasOwn(subs, ast.name)) {
34308
- return subs[ast.name];
34309
- }
34310
- throw ReferenceError(`${ast.name} is not defined`);
34311
- },
34312
- evalLiteral(ast) {
34313
- return ast.value;
34314
- },
34315
- evalMemberExpression(ast, subs) {
34316
- const prop = String(ast.computed ? SafeEval.evalAst(ast.property) : ast.property.name);
34317
- const obj = SafeEval.evalAst(ast.object, subs);
34318
- if (obj === undefined || obj === null) {
34319
- throw TypeError(`Cannot read properties of ${obj} (reading '${prop}')`);
34320
- }
34321
- if (!Object.hasOwn(obj, prop) && BLOCKED_PROTO_PROPERTIES.has(prop)) {
34322
- throw TypeError(`Cannot read properties of ${obj} (reading '${prop}')`);
34323
- }
34324
- const result = obj[prop];
34325
- if (typeof result === "function") {
34326
- return result.bind(obj);
34327
- }
34328
- return result;
34329
- },
34330
- evalUnaryExpression(ast, subs) {
34331
- const result = {
34332
- "-": (a) => -SafeEval.evalAst(a, subs),
34333
- "!": (a) => !SafeEval.evalAst(a, subs),
34334
- "~": (a) => ~SafeEval.evalAst(a, subs),
34335
- "+": (a) => +SafeEval.evalAst(a, subs),
34336
- typeof: (a) => typeof SafeEval.evalAst(a, subs),
34337
- void: (a) => void SafeEval.evalAst(a, subs)
34338
- }[ast.operator](ast.argument);
34339
- return result;
34340
- },
34341
- evalArrayExpression(ast, subs) {
34342
- return ast.elements.map((el) => SafeEval.evalAst(el, subs));
34343
- },
34344
- evalCallExpression(ast, subs) {
34345
- const args = ast.arguments.map((arg) => SafeEval.evalAst(arg, subs));
34346
- const func = SafeEval.evalAst(ast.callee, subs);
34347
- if (func === Function) {
34348
- throw new Error("Function constructor is disabled");
34349
- }
34350
- return func(...args);
34351
- },
34352
- evalAssignmentExpression(ast, subs) {
34353
- if (ast.left.type !== "Identifier") {
34354
- throw SyntaxError("Invalid left-hand side in assignment");
34355
- }
34356
- const id = ast.left.name;
34357
- const value = SafeEval.evalAst(ast.right, subs);
34358
- subs[id] = value;
34359
- return subs[id];
34360
- }
34361
- };
34362
-
34363
- class SafeScript {
34364
- constructor(expr) {
34365
- this.code = expr;
34366
- this.ast = jsep(this.code);
34367
- }
34368
- runInNewContext(context) {
34369
- const keyMap = Object.assign(Object.create(null), context);
34370
- return SafeEval.evalAst(this.ast, keyMap);
34371
- }
34372
- }
34373
- function push(arr, item) {
34374
- arr = arr.slice();
34375
- arr.push(item);
34376
- return arr;
34377
- }
34378
- function unshift(item, arr) {
34379
- arr = arr.slice();
34380
- arr.unshift(item);
34381
- return arr;
34382
- }
34383
-
34384
- class NewError extends Error {
34385
- constructor(value) {
34386
- super('JSONPath should not be called with "new" (it prevents return ' + "of (unwrapped) scalar values)");
34387
- this.avoidNew = true;
34388
- this.value = value;
34389
- this.name = "NewError";
34390
- }
34391
- }
34392
- function JSONPath(opts, expr, obj, callback, otherTypeCallback) {
34393
- if (!(this instanceof JSONPath)) {
34394
- try {
34395
- return new JSONPath(opts, expr, obj, callback, otherTypeCallback);
34396
- } catch (e) {
34397
- if (!e.avoidNew) {
34398
- throw e;
34399
- }
34400
- return e.value;
34401
- }
34402
- }
34403
- if (typeof opts === "string") {
34404
- otherTypeCallback = callback;
34405
- callback = obj;
34406
- obj = expr;
34407
- expr = opts;
34408
- opts = null;
34409
- }
34410
- const optObj = opts && typeof opts === "object";
34411
- opts = opts || {};
34412
- this.json = opts.json || obj;
34413
- this.path = opts.path || expr;
34414
- this.resultType = opts.resultType || "value";
34415
- this.flatten = opts.flatten || false;
34416
- this.wrap = Object.hasOwn(opts, "wrap") ? opts.wrap : true;
34417
- this.sandbox = opts.sandbox || {};
34418
- this.eval = opts.eval === undefined ? "safe" : opts.eval;
34419
- this.ignoreEvalErrors = typeof opts.ignoreEvalErrors === "undefined" ? false : opts.ignoreEvalErrors;
34420
- this.parent = opts.parent || null;
34421
- this.parentProperty = opts.parentProperty || null;
34422
- this.callback = opts.callback || callback || null;
34423
- this.otherTypeCallback = opts.otherTypeCallback || otherTypeCallback || function() {
34424
- throw new TypeError("You must supply an otherTypeCallback callback option " + "with the @other() operator.");
34425
- };
34426
- if (opts.autostart !== false) {
34427
- const args = {
34428
- path: optObj ? opts.path : expr
34429
- };
34430
- if (!optObj) {
34431
- args.json = obj;
34432
- } else if ("json" in opts) {
34433
- args.json = opts.json;
34434
- }
34435
- const ret = this.evaluate(args);
34436
- if (!ret || typeof ret !== "object") {
34437
- throw new NewError(ret);
34438
- }
34439
- return ret;
34440
- }
34441
- }
34442
- JSONPath.prototype.evaluate = function(expr, json, callback, otherTypeCallback) {
34443
- let currParent = this.parent, currParentProperty = this.parentProperty;
34444
- let {
34445
- flatten,
34446
- wrap
34447
- } = this;
34448
- this.currResultType = this.resultType;
34449
- this.currEval = this.eval;
34450
- this.currSandbox = this.sandbox;
34451
- callback = callback || this.callback;
34452
- this.currOtherTypeCallback = otherTypeCallback || this.otherTypeCallback;
34453
- json = json || this.json;
34454
- expr = expr || this.path;
34455
- if (expr && typeof expr === "object" && !Array.isArray(expr)) {
34456
- if (!expr.path && expr.path !== "") {
34457
- throw new TypeError('You must supply a "path" property when providing an object ' + "argument to JSONPath.evaluate().");
34458
- }
34459
- if (!Object.hasOwn(expr, "json")) {
34460
- throw new TypeError('You must supply a "json" property when providing an object ' + "argument to JSONPath.evaluate().");
34461
- }
34462
- ({
34463
- json
34464
- } = expr);
34465
- flatten = Object.hasOwn(expr, "flatten") ? expr.flatten : flatten;
34466
- this.currResultType = Object.hasOwn(expr, "resultType") ? expr.resultType : this.currResultType;
34467
- this.currSandbox = Object.hasOwn(expr, "sandbox") ? expr.sandbox : this.currSandbox;
34468
- wrap = Object.hasOwn(expr, "wrap") ? expr.wrap : wrap;
34469
- this.currEval = Object.hasOwn(expr, "eval") ? expr.eval : this.currEval;
34470
- callback = Object.hasOwn(expr, "callback") ? expr.callback : callback;
34471
- this.currOtherTypeCallback = Object.hasOwn(expr, "otherTypeCallback") ? expr.otherTypeCallback : this.currOtherTypeCallback;
34472
- currParent = Object.hasOwn(expr, "parent") ? expr.parent : currParent;
34473
- currParentProperty = Object.hasOwn(expr, "parentProperty") ? expr.parentProperty : currParentProperty;
34474
- expr = expr.path;
34475
- }
34476
- currParent = currParent || null;
34477
- currParentProperty = currParentProperty || null;
34478
- if (Array.isArray(expr)) {
34479
- expr = JSONPath.toPathString(expr);
34480
- }
34481
- if (!expr && expr !== "" || !json) {
34482
- return;
34483
- }
34484
- const exprList = JSONPath.toPathArray(expr);
34485
- if (exprList[0] === "$" && exprList.length > 1) {
34486
- exprList.shift();
34487
- }
34488
- this._hasParentSelector = null;
34489
- const result = this._trace(exprList, json, ["$"], currParent, currParentProperty, callback).filter(function(ea) {
34490
- return ea && !ea.isParentSelector;
34491
- });
34492
- if (!result.length) {
34493
- return wrap ? [] : undefined;
34494
- }
34495
- if (!wrap && result.length === 1 && !result[0].hasArrExpr) {
34496
- return this._getPreferredOutput(result[0]);
34497
- }
34498
- return result.reduce((rslt, ea) => {
34499
- const valOrPath = this._getPreferredOutput(ea);
34500
- if (flatten && Array.isArray(valOrPath)) {
34501
- rslt = rslt.concat(valOrPath);
34502
- } else {
34503
- rslt.push(valOrPath);
34504
- }
34505
- return rslt;
34506
- }, []);
34507
- };
34508
- JSONPath.prototype._getPreferredOutput = function(ea) {
34509
- const resultType = this.currResultType;
34510
- switch (resultType) {
34511
- case "all": {
34512
- const path3 = Array.isArray(ea.path) ? ea.path : JSONPath.toPathArray(ea.path);
34513
- ea.pointer = JSONPath.toPointer(path3);
34514
- ea.path = typeof ea.path === "string" ? ea.path : JSONPath.toPathString(ea.path);
34515
- return ea;
34516
- }
34517
- case "value":
34518
- case "parent":
34519
- case "parentProperty":
34520
- return ea[resultType];
34521
- case "path":
34522
- return JSONPath.toPathString(ea[resultType]);
34523
- case "pointer":
34524
- return JSONPath.toPointer(ea.path);
34525
- default:
34526
- throw new TypeError("Unknown result type");
34527
- }
34528
- };
34529
- JSONPath.prototype._handleCallback = function(fullRetObj, callback, type) {
34530
- if (callback) {
34531
- const preferredOutput = this._getPreferredOutput(fullRetObj);
34532
- fullRetObj.path = typeof fullRetObj.path === "string" ? fullRetObj.path : JSONPath.toPathString(fullRetObj.path);
34533
- callback(preferredOutput, type, fullRetObj);
34534
- }
34535
- };
34536
- JSONPath.prototype._trace = function(expr, val, path3, parent, parentPropName, callback, hasArrExpr, literalPriority) {
34537
- let retObj;
34538
- if (!expr.length) {
34539
- retObj = {
34540
- path: path3,
34541
- value: val,
34542
- parent,
34543
- parentProperty: parentPropName,
34544
- hasArrExpr
34545
- };
34546
- this._handleCallback(retObj, callback, "value");
34547
- return retObj;
34548
- }
34549
- const loc = expr[0], x = expr.slice(1);
34550
- const ret = [];
34551
- function addRet(elems) {
34552
- if (Array.isArray(elems)) {
34553
- elems.forEach((t) => {
34554
- ret.push(t);
34555
- });
34556
- } else {
34557
- ret.push(elems);
34558
- }
34559
- }
34560
- if ((typeof loc !== "string" || literalPriority) && val && Object.hasOwn(val, loc)) {
34561
- addRet(this._trace(x, val[loc], push(path3, loc), val, loc, callback, hasArrExpr));
34562
- } else if (loc === "*") {
34563
- this._walk(val, (m) => {
34564
- addRet(this._trace(x, val[m], push(path3, m), val, m, callback, true, true));
34565
- });
34566
- } else if (loc === "..") {
34567
- addRet(this._trace(x, val, path3, parent, parentPropName, callback, hasArrExpr));
34568
- this._walk(val, (m) => {
34569
- if (typeof val[m] === "object") {
34570
- addRet(this._trace(expr.slice(), val[m], push(path3, m), val, m, callback, true));
34571
- }
34572
- });
34573
- } else if (loc === "^") {
34574
- this._hasParentSelector = true;
34575
- return {
34576
- path: path3.slice(0, -1),
34577
- expr: x,
34578
- isParentSelector: true
34579
- };
34580
- } else if (loc === "~") {
34581
- retObj = {
34582
- path: push(path3, loc),
34583
- value: parentPropName,
34584
- parent,
34585
- parentProperty: null
34586
- };
34587
- this._handleCallback(retObj, callback, "property");
34588
- return retObj;
34589
- } else if (loc === "$") {
34590
- addRet(this._trace(x, val, path3, null, null, callback, hasArrExpr));
34591
- } else if (/^(-?\d*):(-?\d*):?(\d*)$/u.test(loc)) {
34592
- addRet(this._slice(loc, x, val, path3, parent, parentPropName, callback));
34593
- } else if (loc.indexOf("?(") === 0) {
34594
- if (this.currEval === false) {
34595
- throw new Error("Eval [?(expr)] prevented in JSONPath expression.");
34596
- }
34597
- const safeLoc = loc.replace(/^\?\((.*?)\)$/u, "$1");
34598
- const nested = /@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(safeLoc);
34599
- if (nested) {
34600
- this._walk(val, (m) => {
34601
- const npath = [nested[2]];
34602
- const nvalue = nested[1] ? val[m][nested[1]] : val[m];
34603
- const filterResults = this._trace(npath, nvalue, path3, parent, parentPropName, callback, true);
34604
- if (filterResults.length > 0) {
34605
- addRet(this._trace(x, val[m], push(path3, m), val, m, callback, true));
34606
- }
34607
- });
34608
- } else {
34609
- this._walk(val, (m) => {
34610
- if (this._eval(safeLoc, val[m], m, path3, parent, parentPropName)) {
34611
- addRet(this._trace(x, val[m], push(path3, m), val, m, callback, true));
34612
- }
34613
- });
34614
- }
34615
- } else if (loc[0] === "(") {
34616
- if (this.currEval === false) {
34617
- throw new Error("Eval [(expr)] prevented in JSONPath expression.");
34618
- }
34619
- addRet(this._trace(unshift(this._eval(loc, val, path3.at(-1), path3.slice(0, -1), parent, parentPropName), x), val, path3, parent, parentPropName, callback, hasArrExpr));
34620
- } else if (loc[0] === "@") {
34621
- let addType = false;
34622
- const valueType = loc.slice(1, -2);
34623
- switch (valueType) {
34624
- case "scalar":
34625
- if (!val || !["object", "function"].includes(typeof val)) {
34626
- addType = true;
34627
- }
34628
- break;
34629
- case "boolean":
34630
- case "string":
34631
- case "undefined":
34632
- case "function":
34633
- if (typeof val === valueType) {
34634
- addType = true;
34635
- }
34636
- break;
34637
- case "integer":
34638
- if (Number.isFinite(val) && !(val % 1)) {
34639
- addType = true;
34640
- }
34641
- break;
34642
- case "number":
34643
- if (Number.isFinite(val)) {
34644
- addType = true;
34645
- }
34646
- break;
34647
- case "nonFinite":
34648
- if (typeof val === "number" && !Number.isFinite(val)) {
34649
- addType = true;
34650
- }
34651
- break;
34652
- case "object":
34653
- if (val && typeof val === valueType) {
34654
- addType = true;
34655
- }
34656
- break;
34657
- case "array":
34658
- if (Array.isArray(val)) {
34659
- addType = true;
34660
- }
34661
- break;
34662
- case "other":
34663
- addType = this.currOtherTypeCallback(val, path3, parent, parentPropName);
34664
- break;
34665
- case "null":
34666
- if (val === null) {
34667
- addType = true;
34668
- }
34669
- break;
34670
- default:
34671
- throw new TypeError("Unknown value type " + valueType);
34672
- }
34673
- if (addType) {
34674
- retObj = {
34675
- path: path3,
34676
- value: val,
34677
- parent,
34678
- parentProperty: parentPropName
34679
- };
34680
- this._handleCallback(retObj, callback, "value");
34681
- return retObj;
34682
- }
34683
- } else if (loc[0] === "`" && val && Object.hasOwn(val, loc.slice(1))) {
34684
- const locProp = loc.slice(1);
34685
- addRet(this._trace(x, val[locProp], push(path3, locProp), val, locProp, callback, hasArrExpr, true));
34686
- } else if (loc.includes(",")) {
34687
- const parts = loc.split(",");
34688
- for (const part of parts) {
34689
- addRet(this._trace(unshift(part, x), val, path3, parent, parentPropName, callback, true));
34690
- }
34691
- } else if (!literalPriority && val && Object.hasOwn(val, loc)) {
34692
- addRet(this._trace(x, val[loc], push(path3, loc), val, loc, callback, hasArrExpr, true));
34693
- }
34694
- if (this._hasParentSelector) {
34695
- for (let t = 0;t < ret.length; t++) {
34696
- const rett = ret[t];
34697
- if (rett && rett.isParentSelector) {
34698
- const tmp = this._trace(rett.expr, val, rett.path, parent, parentPropName, callback, hasArrExpr);
34699
- if (Array.isArray(tmp)) {
34700
- ret[t] = tmp[0];
34701
- const tl = tmp.length;
34702
- for (let tt = 1;tt < tl; tt++) {
34703
- t++;
34704
- ret.splice(t, 0, tmp[tt]);
34705
- }
34706
- } else {
34707
- ret[t] = tmp;
34708
- }
34709
- }
34710
- }
34711
- }
34712
- return ret;
34713
- };
34714
- JSONPath.prototype._walk = function(val, f) {
34715
- if (Array.isArray(val)) {
34716
- const n = val.length;
34717
- for (let i = 0;i < n; i++) {
34718
- f(i);
34719
- }
34720
- } else if (val && typeof val === "object") {
34721
- Object.keys(val).forEach((m) => {
34722
- f(m);
34723
- });
34724
- }
34725
- };
34726
- JSONPath.prototype._slice = function(loc, expr, val, path3, parent, parentPropName, callback) {
34727
- if (!Array.isArray(val)) {
34728
- return;
34729
- }
34730
- const len = val.length, parts = loc.split(":"), step = parts[2] && Number.parseInt(parts[2]) || 1;
34731
- let start = parts[0] && Number.parseInt(parts[0]) || 0, end = parts[1] && Number.parseInt(parts[1]) || len;
34732
- start = start < 0 ? Math.max(0, start + len) : Math.min(len, start);
34733
- end = end < 0 ? Math.max(0, end + len) : Math.min(len, end);
34734
- const ret = [];
34735
- for (let i = start;i < end; i += step) {
34736
- const tmp = this._trace(unshift(i, expr), val, path3, parent, parentPropName, callback, true);
34737
- tmp.forEach((t) => {
34738
- ret.push(t);
34739
- });
34740
- }
34741
- return ret;
34742
- };
34743
- JSONPath.prototype._eval = function(code, _v, _vname, path3, parent, parentPropName) {
34744
- this.currSandbox._$_parentProperty = parentPropName;
34745
- this.currSandbox._$_parent = parent;
34746
- this.currSandbox._$_property = _vname;
34747
- this.currSandbox._$_root = this.json;
34748
- this.currSandbox._$_v = _v;
34749
- const containsPath = code.includes("@path");
34750
- if (containsPath) {
34751
- this.currSandbox._$_path = JSONPath.toPathString(path3.concat([_vname]));
34752
- }
34753
- const scriptCacheKey = this.currEval + "Script:" + code;
34754
- if (!JSONPath.cache[scriptCacheKey]) {
34755
- let script = code.replaceAll("@parentProperty", "_$_parentProperty").replaceAll("@parent", "_$_parent").replaceAll("@property", "_$_property").replaceAll("@root", "_$_root").replaceAll(/@([.\s)[])/gu, "_$_v$1");
34756
- if (containsPath) {
34757
- script = script.replaceAll("@path", "_$_path");
34758
- }
34759
- if (this.currEval === "safe" || this.currEval === true || this.currEval === undefined) {
34760
- JSONPath.cache[scriptCacheKey] = new this.safeVm.Script(script);
34761
- } else if (this.currEval === "native") {
34762
- JSONPath.cache[scriptCacheKey] = new this.vm.Script(script);
34763
- } else if (typeof this.currEval === "function" && this.currEval.prototype && Object.hasOwn(this.currEval.prototype, "runInNewContext")) {
34764
- const CurrEval = this.currEval;
34765
- JSONPath.cache[scriptCacheKey] = new CurrEval(script);
34766
- } else if (typeof this.currEval === "function") {
34767
- JSONPath.cache[scriptCacheKey] = {
34768
- runInNewContext: (context) => this.currEval(script, context)
34769
- };
34770
- } else {
34771
- throw new TypeError(`Unknown "eval" property "${this.currEval}"`);
34772
- }
34773
- }
34774
- try {
34775
- return JSONPath.cache[scriptCacheKey].runInNewContext(this.currSandbox);
34776
- } catch (e) {
34777
- if (this.ignoreEvalErrors) {
34778
- return false;
34779
- }
34780
- throw new Error("jsonPath: " + e.message + ": " + code);
34781
- }
34782
- };
34783
- JSONPath.cache = {};
34784
- JSONPath.toPathString = function(pathArr) {
34785
- const x = pathArr, n = x.length;
34786
- let p = "$";
34787
- for (let i = 1;i < n; i++) {
34788
- if (!/^(~|\^|@.*?\(\))$/u.test(x[i])) {
34789
- p += /^[0-9*]+$/u.test(x[i]) ? "[" + x[i] + "]" : "['" + x[i] + "']";
34790
- }
34791
- }
34792
- return p;
34793
- };
34794
- JSONPath.toPointer = function(pointer) {
34795
- const x = pointer, n = x.length;
34796
- let p = "";
34797
- for (let i = 1;i < n; i++) {
34798
- if (!/^(~|\^|@.*?\(\))$/u.test(x[i])) {
34799
- p += "/" + x[i].toString().replaceAll("~", "~0").replaceAll("/", "~1");
34800
- }
34801
- }
34802
- return p;
34803
- };
34804
- JSONPath.toPathArray = function(expr) {
34805
- const {
34806
- cache
34807
- } = JSONPath;
34808
- if (cache[expr]) {
34809
- return cache[expr].concat();
34810
- }
34811
- const subx = [];
34812
- const normalized = expr.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu, ";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu, function($0, $1) {
34813
- return "[#" + (subx.push($1) - 1) + "]";
34814
- }).replaceAll(/\[['"]([^'\]]*)['"]\]/gu, function($0, prop) {
34815
- return "['" + prop.replaceAll(".", "%@%").replaceAll("~", "%%@@%%") + "']";
34816
- }).replaceAll("~", ";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu, ";").replaceAll("%@%", ".").replaceAll("%%@@%%", "~").replaceAll(/(?:;)?(\^+)(?:;)?/gu, function($0, ups) {
34817
- return ";" + ups.split("").join(";") + ";";
34818
- }).replaceAll(/;;;|;;/gu, ";..;").replaceAll(/;$|'?\]|'$/gu, "");
34819
- const exprList = normalized.split(";").map(function(exp) {
34820
- const match = exp.match(/#(\d+)/u);
34821
- return !match || !match[1] ? exp : subx[match[1]];
34822
- });
34823
- cache[expr] = exprList;
34824
- return cache[expr].concat();
34825
- };
34826
- JSONPath.prototype.safeVm = {
34827
- Script: SafeScript
34828
- };
34829
- JSONPath.prototype.vm = vm;
34830
- // ../common/src/option-aliases.ts
34831
- function warnDeprecatedOptionAlias(deprecatedFlag, preferredFlag) {
34832
- getOutputSink().writeErr(`[WARN] ${deprecatedFlag} is deprecated. Use ${preferredFlag} instead.
34833
- `);
34834
- }
34835
- var TENANT_SWITCH_COMMAND = "uip login tenant set <tenant>";
34836
- function createHiddenDeprecatedTenantOption(flags = "-t, --tenant <tenant-name>") {
34837
- return new Option(flags, `Tenant name. Deprecated; use ${TENANT_SWITCH_COMMAND} to switch active tenants.`).hideHelp().argParser((tenant) => {
34838
- warnDeprecatedTenantOption(tenant);
34839
- return tenant;
34840
- });
34841
- }
34842
- function warnDeprecatedTenantOption(tenant) {
34843
- if (tenant === undefined)
34844
- return;
34845
- warnDeprecatedOptionAlias("--tenant", TENANT_SWITCH_COMMAND);
34846
- }
34847
- // ../common/src/polling/types.ts
34848
- var PollOutcome = {
34849
- Completed: "completed",
34850
- Timeout: "timeout",
34851
- Interrupted: "interrupted",
34852
- Aborted: "aborted",
34853
- Failed: "failed"
34854
- };
34855
-
34856
- // ../common/src/polling/poll-failure-mapping.ts
34857
- var REASON_BY_OUTCOME = {
34858
- [PollOutcome.Timeout]: "poll_timeout",
34859
- [PollOutcome.Failed]: "poll_failed",
34860
- [PollOutcome.Interrupted]: "poll_failed",
34861
- [PollOutcome.Aborted]: "poll_aborted"
34862
- };
34863
- // ../common/src/polling/terminal-statuses.ts
34864
- var TERMINAL_STATUSES = new Set([
34865
- "completed",
34866
- "successful",
34867
- "faulted",
34868
- "failed",
34869
- "cancelled",
34870
- "canceled",
34871
- "stopped",
34872
- "finished"
34873
- ]);
34874
- var FAILURE_STATUSES = new Set([
34875
- "faulted",
34876
- "failed",
34877
- "cancelled",
34878
- "canceled",
34879
- "stopped"
34880
- ]);
34881
- // ../common/src/screen-logger.ts
34882
- var ScreenLogger;
34883
- ((ScreenLogger) => {
34884
- function progress(message) {
34885
- getOutputSink().writeErr(`${message}
34886
- `);
34887
- }
34888
- ScreenLogger.progress = progress;
34889
- })(ScreenLogger ||= {});
34890
- // ../common/src/sdk-user-agent.ts
34891
- var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
34892
- // ../common/src/tool-provider.ts
34893
- var factorySlot = singleton("PackagerFactoryProvider");
34894
- // ../auth/src/config.ts
34895
- init_constants();
34896
- var DEFAULT_CLIENT_ID = "36dea5b8-e8bb-423d-8e7b-c808df8f1c00";
34897
- var AUTH_FILE_CONFIG_KEY = Symbol.for("@uipath/auth/AuthFileConfig");
34898
- var globalSlot = globalThis;
34899
- var getAuthFileConfig = () => globalSlot[AUTH_FILE_CONFIG_KEY] ?? {};
34900
-
34901
- class InvalidBaseUrlError extends Error {
34902
- url;
34903
- reason;
34904
- constructor(url, reason) {
34905
- super(`Invalid base URL: "${url}"
34906
- ` + `Reason: ${reason}
34907
-
34908
- ` + `Expected format: an https:// URL, e.g. https://cloud.uipath.com (commercial), https://govcloud.uipath.us (Public Sector), or your Automation Suite host (https://<your-host>).
34909
- ` + `You can specify the URL via:
34910
- ` + ` • --authority flag
34911
- ` + ` • UIPATH_URL environment variable
34912
- ` + ` • auth.authority in config file`);
34913
- this.url = url;
34914
- this.reason = reason;
34915
- this.name = "InvalidBaseUrlError";
34916
- }
34917
- }
34918
- var DEFAULT_SCOPES = ["openid", "profile", "offline_access"];
34919
- var normalizeAndValidateBaseUrl = (rawUrl) => {
34920
- let baseUrl = rawUrl;
34921
- if (baseUrl.endsWith("/identity_/")) {
34922
- baseUrl = baseUrl.slice(0, -11);
34923
- } else if (baseUrl.endsWith("/identity_")) {
34924
- baseUrl = baseUrl.slice(0, -10);
34925
- }
34926
- while (baseUrl.endsWith("/")) {
34927
- baseUrl = baseUrl.slice(0, -1);
34928
- }
34929
- const resolvedBaseUrl = baseUrl;
34930
- const [urlError, url] = catchError2(() => new URL(resolvedBaseUrl));
34931
- if (urlError) {
34932
- throw new InvalidBaseUrlError(baseUrl, `Malformed URL. ${urlError instanceof Error ? urlError.message : "Unknown error"}`);
34933
- }
34934
- if (url.protocol !== "https:") {
34935
- throw new InvalidBaseUrlError(baseUrl, `Authority must use https:// scheme, got ${url.protocol}//. OIDC token exchange requires TLS end-to-end.`);
34936
- }
34937
- return url.pathname.length > 1 ? url.origin : baseUrl;
34938
- };
34939
- var resolveConfigAsync = async ({
34940
- customAuthority,
34941
- customClientId,
34942
- customClientSecret,
34943
- customScopes
34944
- } = {}) => {
34945
- const fileAuth = getAuthFileConfig();
34946
- let baseUrl = customAuthority;
34947
- if (!baseUrl) {
34948
- baseUrl = process.env.UIPATH_URL;
34949
- }
34950
- if (!baseUrl && fileAuth.authority) {
34951
- baseUrl = fileAuth.authority;
34952
- }
34953
- if (!baseUrl) {
34954
- baseUrl = DEFAULT_BASE_URL;
34955
- }
34956
- baseUrl = normalizeAndValidateBaseUrl(baseUrl);
34957
- let clientId = customClientId;
34958
- if (!clientId && fileAuth.clientId) {
34959
- clientId = fileAuth.clientId;
34960
- }
34961
- if (!clientId) {
34962
- clientId = DEFAULT_CLIENT_ID;
34963
- }
34964
- let clientSecret = customClientSecret;
34965
- if (!clientSecret && fileAuth.clientSecret) {
34966
- clientSecret = fileAuth.clientSecret;
34967
- }
34968
- const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && Boolean(clientSecret);
34969
- const scopes = customScopes && customScopes.length > 0 ? customScopes : fileAuth.scopes && fileAuth.scopes.length > 0 ? fileAuth.scopes : isExternalAppAuth ? [] : DEFAULT_SCOPES;
34970
- return {
34971
- clientId,
34972
- clientSecret,
34973
- scopes,
34974
- baseUrl,
34975
- authorizationEndpoint: `${baseUrl}/identity_/connect/authorize`,
34976
- tokenEndpoint: `${baseUrl}/identity_/connect/token`
34977
- };
34978
- };
34979
-
34980
- // ../auth/src/index.ts
34981
- init_constants();
34982
- // ../auth/src/loginStatus.ts
34983
- init_src();
34984
- // ../auth/src/utils/jwt.ts
34985
- class InvalidIssuerError extends Error {
34986
- expected;
34987
- actual;
34988
- constructor(expected, actual) {
34989
- const actualText = actual ?? "<missing>";
34990
- super(`Token issuer does not match the authority used to log in.
34991
- ` + `Expected: ${expected}
34992
- ` + `Actual: ${actualText}
34993
-
34994
- ` + `The identity server that issued this token is not the one ` + `you pointed --authority at. Refusing to save credentials.`);
34995
- this.expected = expected;
34996
- this.actual = actual;
34997
- this.name = "InvalidIssuerError";
33785
+ const fs7 = getFileSystem();
33786
+ return fs7.path.join(fs7.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR, normalized, AUTH_FILENAME);
33787
+ }
33788
+ function getActiveAuthProfileFilePath() {
33789
+ const profile = getActiveAuthProfile();
33790
+ return profile ? resolveAuthProfileFilePath(profile) : undefined;
33791
+ }
33792
+ // ../auth/src/utils/jwt.ts
33793
+ class InvalidIssuerError extends Error {
33794
+ expected;
33795
+ actual;
33796
+ constructor(expected, actual) {
33797
+ const actualText = actual ?? "<missing>";
33798
+ super(`Token issuer does not match the authority used to log in.
33799
+ ` + `Expected: ${expected}
33800
+ ` + `Actual: ${actualText}
33801
+
33802
+ ` + `The identity server that issued this token is not the one ` + `you pointed --authority at. Refusing to save credentials.`);
33803
+ this.expected = expected;
33804
+ this.actual = actual;
33805
+ this.name = "InvalidIssuerError";
34998
33806
  }
34999
33807
  }
35000
33808
  var parseJWT = (token) => {
@@ -35109,23 +33917,74 @@ var readAuthFromEnv = () => {
35109
33917
  organizationId,
35110
33918
  tenantName,
35111
33919
  tenantId,
35112
- expiration
33920
+ expiration,
33921
+ source: "env" /* Env */
35113
33922
  };
35114
33923
  };
35115
33924
 
33925
+ // ../auth/src/refreshCircuitBreaker.ts
33926
+ init_src();
33927
+ var BREAKER_SUFFIX = ".refresh-state";
33928
+ var BACKOFF_BASE_MS = 60000;
33929
+ var BACKOFF_CAP_MS = 60 * 60 * 1000;
33930
+ var SURFACE_WINDOW_MS = 60 * 60 * 1000;
33931
+ async function refreshTokenFingerprint(refreshToken) {
33932
+ const bytes = new TextEncoder().encode(refreshToken);
33933
+ if (globalThis.crypto?.subtle) {
33934
+ const digest = await globalThis.crypto.subtle.digest("SHA-256", bytes);
33935
+ return Array.from(new Uint8Array(digest), (b) => b.toString(16).padStart(2, "0")).join("").slice(0, 16);
33936
+ }
33937
+ const { createHash } = await import("node:crypto");
33938
+ return createHash("sha256").update(refreshToken).digest("hex").slice(0, 16);
33939
+ }
33940
+ function breakerPathFor(authPath) {
33941
+ return `${authPath}${BREAKER_SUFFIX}`;
33942
+ }
33943
+ async function loadRefreshBreaker(authPath) {
33944
+ const fs7 = getFileSystem();
33945
+ try {
33946
+ const content = await fs7.readFile(breakerPathFor(authPath), "utf-8");
33947
+ if (!content)
33948
+ return {};
33949
+ const parsed = JSON.parse(content);
33950
+ return parsed && typeof parsed === "object" ? parsed : {};
33951
+ } catch {
33952
+ return {};
33953
+ }
33954
+ }
33955
+ async function saveRefreshBreaker(authPath, state) {
33956
+ try {
33957
+ const fs7 = getFileSystem();
33958
+ const path3 = breakerPathFor(authPath);
33959
+ await fs7.mkdir(fs7.path.dirname(path3));
33960
+ const tempPath = `${path3}.tmp`;
33961
+ await fs7.writeFile(tempPath, JSON.stringify(state));
33962
+ await fs7.rename(tempPath, path3);
33963
+ } catch {}
33964
+ }
33965
+ async function clearRefreshBreaker(authPath) {
33966
+ const fs7 = getFileSystem();
33967
+ const path3 = breakerPathFor(authPath);
33968
+ try {
33969
+ if (await fs7.exists(path3)) {
33970
+ await fs7.rm(path3);
33971
+ }
33972
+ } catch {}
33973
+ }
33974
+ function nextBackoffMs(attempts) {
33975
+ const shift = Math.max(0, attempts - 1);
33976
+ return Math.min(BACKOFF_BASE_MS * 2 ** shift, BACKOFF_CAP_MS);
33977
+ }
33978
+ function shouldSurface(state, nowMs) {
33979
+ if (state.lastSurfacedAtMs === undefined)
33980
+ return true;
33981
+ return nowMs - state.lastSurfacedAtMs >= SURFACE_WINDOW_MS;
33982
+ }
33983
+
35116
33984
  // ../auth/src/robotClientFallback.ts
35117
33985
  init_src();
35118
33986
  var DEFAULT_TIMEOUT_MS = 1000;
35119
33987
  var CLOSE_TIMEOUT_MS = 500;
35120
- var NOTICE_SENTINEL = Symbol.for("@uipath/auth/robotFallbackNoticePrinted");
35121
- var printNoticeOnce = () => {
35122
- const slot = globalThis;
35123
- if (slot[NOTICE_SENTINEL])
35124
- return;
35125
- slot[NOTICE_SENTINEL] = true;
35126
- catchError2(() => process.stderr.write(`Using UiPath Robot credentials. Run 'uip login' for a dedicated session.
35127
- `));
35128
- };
35129
33988
  var ROBOT_USER_SERVICES_PIPE = "UiPathUserServices";
35130
33989
  var ROBOT_USER_SERVICES_ALTERNATE_PIPE = `${ROBOT_USER_SERVICES_PIPE}Alternate`;
35131
33990
  var PIPE_NAME_MAX_LENGTH = 103;
@@ -35241,7 +34100,6 @@ var tryRobotClientFallback = async (options = {}) => {
35241
34100
  issuerFromToken = issClaim;
35242
34101
  }
35243
34102
  }
35244
- printNoticeOnce();
35245
34103
  return {
35246
34104
  accessToken,
35247
34105
  baseUrl: parsedUrl.baseUrl,
@@ -35466,17 +34324,326 @@ var saveEnvFileAsync = async ({
35466
34324
  };
35467
34325
 
35468
34326
  // ../auth/src/loginStatus.ts
35469
- function normalizeTokenRefreshFailure() {
35470
- return "stored refresh token is invalid or expired";
34327
+ var getLoginStatusAsync = async (options = {}) => {
34328
+ return getLoginStatusWithDeps(options);
34329
+ };
34330
+ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
34331
+ const {
34332
+ resolveEnvFilePath = resolveEnvFilePathAsync,
34333
+ loadEnvFile = loadEnvFileAsync,
34334
+ saveEnvFile = saveEnvFileAsync,
34335
+ getFs = getFileSystem,
34336
+ refreshToken: refreshTokenFn = refreshAccessToken,
34337
+ resolveConfig = resolveConfigAsync,
34338
+ robotFallback = tryRobotClientFallback,
34339
+ loadBreaker = loadRefreshBreaker,
34340
+ saveBreaker = saveRefreshBreaker,
34341
+ clearBreaker = clearRefreshBreaker
34342
+ } = deps;
34343
+ if (isRobotAuthEnforced()) {
34344
+ return resolveRobotEnforcedStatus(robotFallback);
34345
+ }
34346
+ if (isEnvAuthEnabled()) {
34347
+ return readAuthFromEnv();
34348
+ }
34349
+ const activeProfile = getActiveAuthProfile();
34350
+ const activeProfileFilePath = getActiveAuthProfileFilePath();
34351
+ const usingActiveProfile = activeProfile !== undefined && (options.envFilePath === undefined || options.envFilePath === activeProfileFilePath);
34352
+ const envFilePath = options.envFilePath ?? activeProfileFilePath ?? DEFAULT_ENV_FILENAME;
34353
+ const { ensureTokenValidityMinutes } = options;
34354
+ const { absolutePath } = await resolveEnvFilePath(envFilePath);
34355
+ if (absolutePath === undefined) {
34356
+ if (usingActiveProfile) {
34357
+ return {
34358
+ loginStatus: "Not logged in",
34359
+ hint: `No credentials found for profile "${activeProfile}". Run 'uip login --profile ${activeProfile}' to authenticate this profile.`
34360
+ };
34361
+ }
34362
+ return resolveBorrowedRobotStatus(robotFallback);
34363
+ }
34364
+ const loaded = await loadFileCredentials(loadEnvFile, absolutePath);
34365
+ if ("status" in loaded) {
34366
+ return loaded.status;
34367
+ }
34368
+ const { credentials } = loaded;
34369
+ const globalHint = () => usingActiveProfile ? Promise.resolve(undefined) : getGlobalCredsHint(getFs, loadEnvFile, absolutePath, envFilePath);
34370
+ const expiration = getTokenExpiration(credentials.UIPATH_ACCESS_TOKEN);
34371
+ const outerThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
34372
+ let tokens = {
34373
+ accessToken: credentials.UIPATH_ACCESS_TOKEN,
34374
+ refreshToken: credentials.UIPATH_REFRESH_TOKEN,
34375
+ expiration,
34376
+ lockReleaseFailed: false
34377
+ };
34378
+ const refreshToken = credentials.UIPATH_REFRESH_TOKEN;
34379
+ if (expiration && expiration <= outerThreshold && refreshToken) {
34380
+ const refreshed = await attemptRefresh({
34381
+ absolutePath,
34382
+ credentials,
34383
+ accessToken: credentials.UIPATH_ACCESS_TOKEN,
34384
+ refreshToken,
34385
+ expiration,
34386
+ ensureTokenValidityMinutes,
34387
+ getFs,
34388
+ loadEnvFile,
34389
+ saveEnvFile,
34390
+ refreshFn: refreshTokenFn,
34391
+ resolveConfig,
34392
+ loadBreaker,
34393
+ saveBreaker,
34394
+ clearBreaker,
34395
+ globalHint
34396
+ });
34397
+ if (refreshed.kind === "terminal") {
34398
+ return refreshed.status;
34399
+ }
34400
+ tokens = refreshed.tokens;
34401
+ }
34402
+ return buildFileStatus(tokens, credentials, globalHint);
34403
+ };
34404
+ async function resolveRobotEnforcedStatus(robotFallback) {
34405
+ if (isEnvAuthEnabled()) {
34406
+ throw new EnvAuthConfigError(`${ENV_AUTH_ENABLE_VAR}=true and ${ENFORCE_ROBOT_AUTH_VAR}=true ` + `are mutually exclusive. Unset one of them and re-run.`);
34407
+ }
34408
+ const robotCreds = await robotFallback({ force: true });
34409
+ if (!robotCreds) {
34410
+ return {
34411
+ loginStatus: "Not logged in",
34412
+ hint: `${ENFORCE_ROBOT_AUTH_VAR}=true but the UiPath Robot ` + `session is unavailable. Start and sign in to the Assistant, ` + `or unset ${ENFORCE_ROBOT_AUTH_VAR} to fall back to file or ` + `env-var authentication.`
34413
+ };
34414
+ }
34415
+ return buildRobotStatus(robotCreds);
35471
34416
  }
35472
- function normalizeTokenRefreshUnavailableFailure() {
35473
- return "token refresh failed before authentication completed";
34417
+ async function resolveBorrowedRobotStatus(robotFallback) {
34418
+ const robotCreds = await robotFallback();
34419
+ return robotCreds ? buildRobotStatus(robotCreds) : { loginStatus: "Not logged in" };
35474
34420
  }
35475
- function errorMessage(error) {
35476
- return error instanceof Error ? error.message : String(error);
34421
+ async function loadFileCredentials(loadEnvFile, absolutePath) {
34422
+ let credentials;
34423
+ try {
34424
+ credentials = await loadEnvFile({ envPath: absolutePath });
34425
+ } catch (error) {
34426
+ if (isFileNotFoundError(error)) {
34427
+ return { status: { loginStatus: "Not logged in" } };
34428
+ }
34429
+ throw error;
34430
+ }
34431
+ if (!credentials.UIPATH_ACCESS_TOKEN) {
34432
+ return { status: { loginStatus: "Not logged in" } };
34433
+ }
34434
+ return { credentials };
34435
+ }
34436
+ async function getGlobalCredsHint(getFs, loadEnvFile, absolutePath, envFilePath) {
34437
+ const fs7 = getFs();
34438
+ const globalPath = fs7.path.join(fs7.env.homedir(), envFilePath);
34439
+ if (absolutePath === globalPath)
34440
+ return;
34441
+ if (!await fs7.exists(globalPath))
34442
+ return;
34443
+ try {
34444
+ const globalCreds = await loadEnvFile({ envPath: globalPath });
34445
+ if (!globalCreds.UIPATH_ACCESS_TOKEN)
34446
+ return;
34447
+ const globalExp = getTokenExpiration(globalCreds.UIPATH_ACCESS_TOKEN);
34448
+ if (globalExp && globalExp <= new Date)
34449
+ return;
34450
+ 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.`;
34451
+ } catch {
34452
+ return;
34453
+ }
34454
+ }
34455
+ function computeExpirationThreshold(ensureTokenValidityMinutes) {
34456
+ return new Date(Date.now() + (ensureTokenValidityMinutes ?? 0) * 60 * 1000);
34457
+ }
34458
+ async function attemptRefresh(ctx) {
34459
+ const shortCircuit = await circuitBreakerShortCircuit(ctx);
34460
+ if (shortCircuit) {
34461
+ return { kind: "terminal", status: shortCircuit };
34462
+ }
34463
+ let release;
34464
+ try {
34465
+ release = await ctx.getFs().acquireLock(ctx.absolutePath);
34466
+ } catch (error) {
34467
+ return {
34468
+ kind: "terminal",
34469
+ status: await lockAcquireFailureStatus(ctx, error)
34470
+ };
34471
+ }
34472
+ let lockedFailure;
34473
+ let lockReleaseFailed = false;
34474
+ let success;
34475
+ try {
34476
+ const outcome = await runRefreshLocked({
34477
+ absolutePath: ctx.absolutePath,
34478
+ refreshToken: ctx.refreshToken,
34479
+ customAuthority: ctx.credentials.UIPATH_URL,
34480
+ ensureTokenValidityMinutes: ctx.ensureTokenValidityMinutes,
34481
+ loadEnvFile: ctx.loadEnvFile,
34482
+ saveEnvFile: ctx.saveEnvFile,
34483
+ refreshFn: ctx.refreshFn,
34484
+ resolveConfig: ctx.resolveConfig,
34485
+ loadBreaker: ctx.loadBreaker,
34486
+ saveBreaker: ctx.saveBreaker,
34487
+ clearBreaker: ctx.clearBreaker
34488
+ });
34489
+ if (outcome.kind === "fail") {
34490
+ lockedFailure = outcome.status;
34491
+ } else {
34492
+ success = outcome;
34493
+ }
34494
+ } finally {
34495
+ try {
34496
+ await release();
34497
+ } catch {
34498
+ lockReleaseFailed = true;
34499
+ }
34500
+ }
34501
+ if (lockedFailure) {
34502
+ const globalHint = await ctx.globalHint();
34503
+ const base = globalHint ? { ...lockedFailure, loginStatus: "Expired", hint: globalHint } : lockedFailure;
34504
+ return {
34505
+ kind: "terminal",
34506
+ status: lockReleaseFailed ? { ...base, lockReleaseFailed: true } : base
34507
+ };
34508
+ }
34509
+ return {
34510
+ kind: "refreshed",
34511
+ tokens: {
34512
+ accessToken: success?.accessToken,
34513
+ refreshToken: success?.refreshToken,
34514
+ expiration: success?.expiration,
34515
+ tokenRefresh: success?.tokenRefresh,
34516
+ persistenceWarning: success?.persistenceWarning,
34517
+ lockReleaseFailed
34518
+ }
34519
+ };
34520
+ }
34521
+ async function buildFileStatus(tokens, credentials, globalHint) {
34522
+ const result = {
34523
+ loginStatus: tokens.expiration && tokens.expiration <= new Date ? "Expired" : "Logged in",
34524
+ accessToken: tokens.accessToken,
34525
+ refreshToken: tokens.refreshToken,
34526
+ baseUrl: credentials.UIPATH_URL,
34527
+ organizationName: credentials.UIPATH_ORGANIZATION_NAME,
34528
+ organizationId: credentials.UIPATH_ORGANIZATION_ID,
34529
+ tenantName: credentials.UIPATH_TENANT_NAME,
34530
+ tenantId: credentials.UIPATH_TENANT_ID,
34531
+ expiration: tokens.expiration,
34532
+ source: "file" /* File */,
34533
+ ...tokens.persistenceWarning ? { hint: tokens.persistenceWarning, persistenceFailed: true } : {},
34534
+ ...tokens.lockReleaseFailed ? { lockReleaseFailed: true } : {},
34535
+ ...tokens.tokenRefresh ? { tokenRefresh: tokens.tokenRefresh } : {}
34536
+ };
34537
+ if (result.loginStatus === "Expired") {
34538
+ const hint = await globalHint();
34539
+ if (hint) {
34540
+ result.hint = hint;
34541
+ }
34542
+ }
34543
+ return result;
34544
+ }
34545
+ function buildRobotStatus(robotCreds) {
34546
+ return {
34547
+ loginStatus: "Logged in",
34548
+ accessToken: robotCreds.accessToken,
34549
+ baseUrl: robotCreds.baseUrl,
34550
+ organizationName: robotCreds.organizationName,
34551
+ organizationId: robotCreds.organizationId,
34552
+ tenantName: robotCreds.tenantName,
34553
+ tenantId: robotCreds.tenantId,
34554
+ issuer: robotCreds.issuer,
34555
+ expiration: getTokenExpiration(robotCreds.accessToken),
34556
+ source: "robot" /* Robot */
34557
+ };
34558
+ }
34559
+ var isFileNotFoundError = (error) => {
34560
+ if (!(error instanceof Object))
34561
+ return false;
34562
+ return error.code === "ENOENT";
34563
+ };
34564
+ async function circuitBreakerShortCircuit(ctx) {
34565
+ const {
34566
+ absolutePath,
34567
+ refreshToken,
34568
+ accessToken,
34569
+ credentials,
34570
+ expiration,
34571
+ loadBreaker,
34572
+ saveBreaker,
34573
+ clearBreaker
34574
+ } = ctx;
34575
+ const fingerprint = await refreshTokenFingerprint(refreshToken);
34576
+ const breaker = await loadBreaker(absolutePath).catch(() => ({}));
34577
+ if (breaker.deadTokenFp && breaker.deadTokenFp !== fingerprint) {
34578
+ await clearBreaker(absolutePath);
34579
+ breaker.deadTokenFp = undefined;
34580
+ }
34581
+ const nowMs = Date.now();
34582
+ const tokenIsDead = breaker.deadTokenFp === fingerprint;
34583
+ const inBackoff = breaker.backoffUntilMs !== undefined && nowMs < breaker.backoffUntilMs;
34584
+ if (!tokenIsDead && !inBackoff)
34585
+ return;
34586
+ const globalHint = await ctx.globalHint();
34587
+ const suppressed = !shouldSurface(breaker, nowMs);
34588
+ if (!suppressed) {
34589
+ await saveBreaker(absolutePath, {
34590
+ ...breaker,
34591
+ lastSurfacedAtMs: nowMs
34592
+ });
34593
+ }
34594
+ const deadHint = "Run 'uip login' to re-authenticate — the stored refresh token is invalid or expired. In a non-interactive context, authenticate with: uip login --client-id <id> --client-secret <secret> -t <tenant>.";
34595
+ const backoffHint = "Token refresh is temporarily backed off after a recent network error and will retry automatically once the backoff window elapses.";
34596
+ return {
34597
+ loginStatus: globalHint ? "Expired" : "Refresh Failed",
34598
+ ...globalHint ? {
34599
+ accessToken,
34600
+ refreshToken,
34601
+ baseUrl: credentials.UIPATH_URL,
34602
+ organizationName: credentials.UIPATH_ORGANIZATION_NAME,
34603
+ organizationId: credentials.UIPATH_ORGANIZATION_ID,
34604
+ tenantName: credentials.UIPATH_TENANT_NAME,
34605
+ tenantId: credentials.UIPATH_TENANT_ID,
34606
+ expiration,
34607
+ source: "file" /* File */
34608
+ } : {},
34609
+ hint: globalHint ?? (tokenIsDead ? deadHint : backoffHint),
34610
+ refreshCircuitOpen: true,
34611
+ refreshTelemetrySuppressed: suppressed,
34612
+ tokenRefresh: { attempted: false, success: false }
34613
+ };
35477
34614
  }
35478
- function computeExpirationThreshold(ensureTokenValidityMinutes) {
35479
- return new Date(Date.now() + (ensureTokenValidityMinutes ?? 0) * 60 * 1000);
34615
+ async function lockAcquireFailureStatus(ctx, error) {
34616
+ const msg = errorMessage(error);
34617
+ const globalHint = await ctx.globalHint();
34618
+ if (globalHint) {
34619
+ return {
34620
+ loginStatus: "Expired",
34621
+ accessToken: ctx.accessToken,
34622
+ refreshToken: ctx.refreshToken,
34623
+ baseUrl: ctx.credentials.UIPATH_URL,
34624
+ organizationName: ctx.credentials.UIPATH_ORGANIZATION_NAME,
34625
+ organizationId: ctx.credentials.UIPATH_ORGANIZATION_ID,
34626
+ tenantName: ctx.credentials.UIPATH_TENANT_NAME,
34627
+ tenantId: ctx.credentials.UIPATH_TENANT_ID,
34628
+ expiration: ctx.expiration,
34629
+ source: "file" /* File */,
34630
+ hint: globalHint,
34631
+ tokenRefresh: {
34632
+ attempted: false,
34633
+ success: false,
34634
+ errorMessage: `lock acquisition failed: ${msg}`
34635
+ }
34636
+ };
34637
+ }
34638
+ return {
34639
+ loginStatus: "Refresh Failed",
34640
+ 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.",
34641
+ tokenRefresh: {
34642
+ attempted: false,
34643
+ success: false,
34644
+ errorMessage: `lock acquisition failed: ${msg}`
34645
+ }
34646
+ };
35480
34647
  }
35481
34648
  async function runRefreshLocked(inputs) {
35482
34649
  const {
@@ -35487,7 +34654,10 @@ async function runRefreshLocked(inputs) {
35487
34654
  loadEnvFile,
35488
34655
  saveEnvFile,
35489
34656
  refreshFn,
35490
- resolveConfig
34657
+ resolveConfig,
34658
+ loadBreaker,
34659
+ saveBreaker,
34660
+ clearBreaker
35491
34661
  } = inputs;
35492
34662
  const expirationThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
35493
34663
  let fresh;
@@ -35510,6 +34680,7 @@ async function runRefreshLocked(inputs) {
35510
34680
  const freshAccess = fresh.UIPATH_ACCESS_TOKEN;
35511
34681
  const freshExp = freshAccess ? getTokenExpiration(freshAccess) : undefined;
35512
34682
  if (freshAccess && freshExp && freshExp > expirationThreshold) {
34683
+ await clearBreaker(absolutePath);
35513
34684
  return {
35514
34685
  kind: "ok",
35515
34686
  accessToken: freshAccess,
@@ -35533,8 +34704,21 @@ async function runRefreshLocked(inputs) {
35533
34704
  refreshedRefresh = refreshed.refreshToken;
35534
34705
  } catch (error) {
35535
34706
  const isOAuthFailure = isTokenRefreshOAuthFailure(error);
35536
- 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.";
34707
+ const hint = isOAuthFailure ? "Run 'uip login' to re-authenticate — the stored refresh token is invalid or expired. In a non-interactive context, authenticate with: uip login --client-id <id> --client-secret <secret> -t <tenant>." : "Token refresh failed. Check your network connection, then retry or run 'uip login' to re-authenticate.";
35537
34708
  const message = isOAuthFailure ? normalizeTokenRefreshFailure() : normalizeTokenRefreshUnavailableFailure();
34709
+ const fp = await refreshTokenFingerprint(tokenForIdP);
34710
+ if (isOAuthFailure) {
34711
+ await saveBreaker(absolutePath, { deadTokenFp: fp });
34712
+ } else {
34713
+ const prior = await loadBreaker(absolutePath).catch(() => ({}));
34714
+ const attempts = (prior.attempts ?? 0) + 1;
34715
+ await saveBreaker(absolutePath, {
34716
+ ...prior,
34717
+ deadTokenFp: undefined,
34718
+ attempts,
34719
+ backoffUntilMs: Date.now() + nextBackoffMs(attempts)
34720
+ });
34721
+ }
35538
34722
  return {
35539
34723
  kind: "fail",
35540
34724
  status: {
@@ -35563,6 +34747,7 @@ async function runRefreshLocked(inputs) {
35563
34747
  }
35564
34748
  };
35565
34749
  }
34750
+ await clearBreaker(absolutePath);
35566
34751
  try {
35567
34752
  await saveEnvFile({
35568
34753
  envPath: absolutePath,
@@ -35595,214 +34780,25 @@ async function runRefreshLocked(inputs) {
35595
34780
  };
35596
34781
  }
35597
34782
  }
35598
- var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
35599
- const {
35600
- resolveEnvFilePath = resolveEnvFilePathAsync,
35601
- loadEnvFile = loadEnvFileAsync,
35602
- saveEnvFile = saveEnvFileAsync,
35603
- getFs = getFileSystem,
35604
- refreshToken: refreshTokenFn = refreshAccessToken,
35605
- resolveConfig = resolveConfigAsync,
35606
- robotFallback = tryRobotClientFallback
35607
- } = deps;
35608
- if (isRobotAuthEnforced()) {
35609
- if (isEnvAuthEnabled()) {
35610
- throw new EnvAuthConfigError(`${ENV_AUTH_ENABLE_VAR}=true and ${ENFORCE_ROBOT_AUTH_VAR}=true ` + `are mutually exclusive. Unset one of them and re-run.`);
35611
- }
35612
- const robotCreds = await robotFallback({ force: true });
35613
- if (!robotCreds) {
35614
- return {
35615
- loginStatus: "Not logged in",
35616
- hint: `${ENFORCE_ROBOT_AUTH_VAR}=true but the UiPath Robot ` + `session is unavailable. Start and sign in to the Assistant, ` + `or unset ${ENFORCE_ROBOT_AUTH_VAR} to fall back to file or ` + `env-var authentication.`
35617
- };
35618
- }
35619
- const expiration2 = getTokenExpiration(robotCreds.accessToken);
35620
- return {
35621
- loginStatus: "Logged in",
35622
- accessToken: robotCreds.accessToken,
35623
- baseUrl: robotCreds.baseUrl,
35624
- organizationName: robotCreds.organizationName,
35625
- organizationId: robotCreds.organizationId,
35626
- tenantName: robotCreds.tenantName,
35627
- tenantId: robotCreds.tenantId,
35628
- issuer: robotCreds.issuer,
35629
- expiration: expiration2,
35630
- source: "robot" /* Robot */
35631
- };
35632
- }
35633
- if (isEnvAuthEnabled()) {
35634
- return readAuthFromEnv();
35635
- }
35636
- const { envFilePath = DEFAULT_ENV_FILENAME, ensureTokenValidityMinutes } = options;
35637
- const { absolutePath } = await resolveEnvFilePath(envFilePath);
35638
- if (absolutePath === undefined) {
35639
- const robotCreds = await robotFallback();
35640
- if (robotCreds) {
35641
- const expiration2 = getTokenExpiration(robotCreds.accessToken);
35642
- const status = {
35643
- loginStatus: "Logged in",
35644
- accessToken: robotCreds.accessToken,
35645
- baseUrl: robotCreds.baseUrl,
35646
- organizationName: robotCreds.organizationName,
35647
- organizationId: robotCreds.organizationId,
35648
- tenantName: robotCreds.tenantName,
35649
- tenantId: robotCreds.tenantId,
35650
- issuer: robotCreds.issuer,
35651
- expiration: expiration2,
35652
- source: "robot" /* Robot */
35653
- };
35654
- return status;
35655
- }
35656
- return { loginStatus: "Not logged in" };
35657
- }
35658
- let credentials;
35659
- try {
35660
- credentials = await loadEnvFile({ envPath: absolutePath });
35661
- } catch (error) {
35662
- if (isFileNotFoundError(error)) {
35663
- return { loginStatus: "Not logged in" };
35664
- }
35665
- throw error;
35666
- }
35667
- if (!credentials.UIPATH_ACCESS_TOKEN) {
35668
- return { loginStatus: "Not logged in" };
35669
- }
35670
- let accessToken = credentials.UIPATH_ACCESS_TOKEN;
35671
- let refreshToken = credentials.UIPATH_REFRESH_TOKEN;
35672
- let expiration = getTokenExpiration(accessToken);
35673
- let persistenceWarning;
35674
- let lockReleaseFailed = false;
35675
- let tokenRefresh;
35676
- const outerThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
35677
- const tryGlobalCredsHint = async () => {
35678
- const fs7 = getFs();
35679
- const globalPath = fs7.path.join(fs7.env.homedir(), envFilePath);
35680
- if (absolutePath === globalPath)
35681
- return;
35682
- if (!await fs7.exists(globalPath))
35683
- return;
35684
- try {
35685
- const globalCreds = await loadEnvFile({ envPath: globalPath });
35686
- if (!globalCreds.UIPATH_ACCESS_TOKEN)
35687
- return;
35688
- const globalExp = getTokenExpiration(globalCreds.UIPATH_ACCESS_TOKEN);
35689
- if (globalExp && globalExp <= new Date)
35690
- return;
35691
- 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.`;
35692
- } catch {
35693
- return;
35694
- }
35695
- };
35696
- if (expiration && expiration <= outerThreshold && refreshToken) {
35697
- let release;
35698
- try {
35699
- release = await getFs().acquireLock(absolutePath);
35700
- } catch (error) {
35701
- const msg = errorMessage(error);
35702
- const globalHint = await tryGlobalCredsHint();
35703
- if (globalHint) {
35704
- return {
35705
- loginStatus: "Expired",
35706
- accessToken,
35707
- refreshToken,
35708
- baseUrl: credentials.UIPATH_URL,
35709
- organizationName: credentials.UIPATH_ORGANIZATION_NAME,
35710
- organizationId: credentials.UIPATH_ORGANIZATION_ID,
35711
- tenantName: credentials.UIPATH_TENANT_NAME,
35712
- tenantId: credentials.UIPATH_TENANT_ID,
35713
- expiration,
35714
- source: "file" /* File */,
35715
- hint: globalHint,
35716
- tokenRefresh: {
35717
- attempted: false,
35718
- success: false,
35719
- errorMessage: `lock acquisition failed: ${msg}`
35720
- }
35721
- };
35722
- }
35723
- return {
35724
- loginStatus: "Refresh Failed",
35725
- 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.",
35726
- tokenRefresh: {
35727
- attempted: false,
35728
- success: false,
35729
- errorMessage: `lock acquisition failed: ${msg}`
35730
- }
35731
- };
35732
- }
35733
- let lockedFailure;
35734
- try {
35735
- const outcome = await runRefreshLocked({
35736
- absolutePath,
35737
- refreshToken,
35738
- customAuthority: credentials.UIPATH_URL,
35739
- ensureTokenValidityMinutes,
35740
- loadEnvFile,
35741
- saveEnvFile,
35742
- refreshFn: refreshTokenFn,
35743
- resolveConfig
35744
- });
35745
- if (outcome.kind === "fail") {
35746
- lockedFailure = outcome.status;
35747
- } else {
35748
- accessToken = outcome.accessToken;
35749
- refreshToken = outcome.refreshToken;
35750
- expiration = outcome.expiration;
35751
- tokenRefresh = outcome.tokenRefresh;
35752
- if (outcome.persistenceWarning) {
35753
- persistenceWarning = outcome.persistenceWarning;
35754
- }
35755
- }
35756
- } finally {
35757
- try {
35758
- await release();
35759
- } catch {
35760
- lockReleaseFailed = true;
35761
- }
35762
- }
35763
- if (lockedFailure) {
35764
- const globalHint = await tryGlobalCredsHint();
35765
- const base = globalHint ? {
35766
- ...lockedFailure,
35767
- loginStatus: "Expired",
35768
- hint: globalHint
35769
- } : lockedFailure;
35770
- return lockReleaseFailed ? { ...base, lockReleaseFailed: true } : base;
35771
- }
35772
- }
35773
- const result = {
35774
- loginStatus: expiration && expiration <= new Date ? "Expired" : "Logged in",
35775
- accessToken,
35776
- refreshToken,
35777
- baseUrl: credentials.UIPATH_URL,
35778
- organizationName: credentials.UIPATH_ORGANIZATION_NAME,
35779
- organizationId: credentials.UIPATH_ORGANIZATION_ID,
35780
- tenantName: credentials.UIPATH_TENANT_NAME,
35781
- tenantId: credentials.UIPATH_TENANT_ID,
35782
- expiration,
35783
- source: "file" /* File */,
35784
- ...persistenceWarning ? { hint: persistenceWarning, persistenceFailed: true } : {},
35785
- ...lockReleaseFailed ? { lockReleaseFailed: true } : {},
35786
- ...tokenRefresh ? { tokenRefresh } : {}
35787
- };
35788
- if (result.loginStatus === "Expired") {
35789
- const globalHint = await tryGlobalCredsHint();
35790
- if (globalHint) {
35791
- result.hint = globalHint;
35792
- }
35793
- }
35794
- return result;
35795
- };
35796
- var isFileNotFoundError = (error) => {
35797
- if (!(error instanceof Object))
35798
- return false;
35799
- return error.code === "ENOENT";
35800
- };
35801
- var getLoginStatusAsync = async (options = {}) => {
35802
- return getLoginStatusWithDeps(options);
35803
- };
34783
+ function normalizeTokenRefreshFailure() {
34784
+ return "stored refresh token is invalid or expired";
34785
+ }
34786
+ function normalizeTokenRefreshUnavailableFailure() {
34787
+ return "token refresh failed before authentication completed";
34788
+ }
34789
+ function errorMessage(error) {
34790
+ return error instanceof Error ? error.message : String(error);
34791
+ }
35804
34792
  // ../auth/src/interactive.ts
35805
34793
  init_src();
34794
+
34795
+ // ../auth/src/selectTenant.ts
34796
+ var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
34797
+ var INVALID_TENANT_CODE = "INVALID_TENANT";
34798
+ var TENANT_SELECTION_CODES = new Set([
34799
+ TENANT_SELECTION_REQUIRED_CODE,
34800
+ INVALID_TENANT_CODE
34801
+ ]);
35806
34802
  // ../auth/src/logout.ts
35807
34803
  init_src();
35808
34804
 
@@ -35816,6 +34812,9 @@ var VERSION = "Version";
35816
34812
  var SERVICE = "Service";
35817
34813
  var CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
35818
34814
  var CLOUD_TENANT_NAME = "CloudTenantName";
34815
+ var CLOUD_ORGANIZATION_ID = "CloudOrganizationId";
34816
+ var CLOUD_TENANT_ID = "CloudTenantId";
34817
+ var CLOUD_USER_ID = "CloudUserId";
35819
34818
  var CLOUD_URL = "CloudUrl";
35820
34819
  var CLOUD_CLIENT_ID = "CloudClientId";
35821
34820
  var CLOUD_REDIRECT_URI = "CloudRedirectUri";
@@ -35942,6 +34941,11 @@ class TelemetryClient {
35942
34941
  getDefaultEventName() {
35943
34942
  return this.options?.defaultEventName;
35944
34943
  }
34944
+ setUserId(userId) {
34945
+ if (userId) {
34946
+ this.cloudUserId = userId;
34947
+ }
34948
+ }
35945
34949
  setupTelemetryProvider(connectionString) {
35946
34950
  const opts = this.options;
35947
34951
  const exporter = new ApplicationInsightsEventExporter(connectionString, {
@@ -35966,6 +34970,9 @@ class TelemetryClient {
35966
34970
  [CLOUD_URL]: this.createCloudUrl(),
35967
34971
  [CLOUD_ORGANIZATION_NAME]: this.telemetryContext?.orgName ?? UNKNOWN,
35968
34972
  [CLOUD_TENANT_NAME]: this.telemetryContext?.tenantName ?? UNKNOWN,
34973
+ [CLOUD_ORGANIZATION_ID]: this.telemetryContext?.orgId ?? UNKNOWN,
34974
+ [CLOUD_TENANT_ID]: this.telemetryContext?.tenantId ?? UNKNOWN,
34975
+ [CLOUD_USER_ID]: this.cloudUserId ?? UNKNOWN,
35969
34976
  [CLOUD_REDIRECT_URI]: this.telemetryContext?.redirectUri ?? UNKNOWN,
35970
34977
  [CLOUD_CLIENT_ID]: this.telemetryContext?.clientId ?? UNKNOWN,
35971
34978
  ...extraAttributes
@@ -35973,12 +34980,12 @@ class TelemetryClient {
35973
34980
  }
35974
34981
  createCloudUrl() {
35975
34982
  const baseUrl = this.telemetryContext?.baseUrl;
35976
- const orgId = this.telemetryContext?.orgName;
35977
- const tenantId = this.telemetryContext?.tenantName;
35978
- if (!baseUrl || !orgId || !tenantId) {
34983
+ const org = this.telemetryContext?.orgId || this.telemetryContext?.orgName;
34984
+ const tenant = this.telemetryContext?.tenantId || this.telemetryContext?.tenantName;
34985
+ if (!baseUrl || !org || !tenant) {
35979
34986
  return UNKNOWN;
35980
34987
  }
35981
- return `${baseUrl}/${orgId}/${tenantId}`;
34988
+ return `${baseUrl}/${org}/${tenant}`;
35982
34989
  }
35983
34990
  }
35984
34991
  var REGISTRY_KEY = Symbol.for("@uipath/core-telemetry/clients");
@@ -37378,11 +36385,11 @@ var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
37378
36385
  return payload;
37379
36386
  };
37380
36387
  });
37381
- function handleArrayResult(result, final, index2) {
36388
+ function handleArrayResult(result, final, index) {
37382
36389
  if (result.issues.length) {
37383
- final.issues.push(...prefixIssues(index2, result.issues));
36390
+ final.issues.push(...prefixIssues(index, result.issues));
37384
36391
  }
37385
- final.value[index2] = result.value;
36392
+ final.value[index] = result.value;
37386
36393
  }
37387
36394
  var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
37388
36395
  $ZodType.init(inst, def);
@@ -37753,14 +36760,14 @@ function mergeValues(a, b) {
37753
36760
  return { valid: false, mergeErrorPath: [] };
37754
36761
  }
37755
36762
  const newArray = [];
37756
- for (let index2 = 0;index2 < a.length; index2++) {
37757
- const itemA = a[index2];
37758
- const itemB = b[index2];
36763
+ for (let index = 0;index < a.length; index++) {
36764
+ const itemA = a[index];
36765
+ const itemB = b[index];
37759
36766
  const sharedValue = mergeValues(itemA, itemB);
37760
36767
  if (!sharedValue.valid) {
37761
36768
  return {
37762
36769
  valid: false,
37763
- mergeErrorPath: [index2, ...sharedValue.mergeErrorPath]
36770
+ mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
37764
36771
  };
37765
36772
  }
37766
36773
  newArray.push(sharedValue.data);
@@ -39706,6 +38713,21 @@ class ExecutionContext {
39706
38713
  }
39707
38714
  var isBrowser2 = typeof window !== "undefined" && typeof window.document !== "undefined";
39708
38715
  var isInActionCenter = isBrowser2 && window.self != window.top && window.location.href.includes("source=ActionCenter");
38716
+ var _params = isBrowser2 ? new URLSearchParams(window.location.search) : null;
38717
+ var isHostEmbedded = isBrowser2 && window.self !== window.top && _params?.get("host") === "embed";
38718
+ var embeddingOrigin = (() => {
38719
+ if (!isHostEmbedded)
38720
+ return null;
38721
+ const basedomain = _params?.get("basedomain");
38722
+ if (!basedomain)
38723
+ return null;
38724
+ try {
38725
+ return new URL(basedomain).origin;
38726
+ } catch {
38727
+ console.warn("embeddingOrigin: basedomain query param is not a valid URL", basedomain);
38728
+ return null;
38729
+ }
38730
+ })();
39709
38731
  var AUTH_STORAGE_KEYS = {
39710
38732
  TOKEN_PREFIX: "uipath_sdk_user_token-",
39711
38733
  OAUTH_CONTEXT: "uipath_sdk_oauth_context",
@@ -39923,10 +38945,18 @@ var TaskActivityType;
39923
38945
  TaskActivityType2["BulkCompleted"] = "BulkCompleted";
39924
38946
  TaskActivityType2["FirstOpened"] = "FirstOpened";
39925
38947
  })(TaskActivityType || (TaskActivityType = {}));
38948
+ var TaskAssignmentCriteria;
38949
+ (function(TaskAssignmentCriteria2) {
38950
+ TaskAssignmentCriteria2["SingleUser"] = "SingleUser";
38951
+ TaskAssignmentCriteria2["Workload"] = "Workload";
38952
+ TaskAssignmentCriteria2["AllUsers"] = "AllUsers";
38953
+ TaskAssignmentCriteria2["RoundRobin"] = "RoundRobin";
38954
+ })(TaskAssignmentCriteria || (TaskAssignmentCriteria = {}));
39926
38955
  var ORCHESTRATOR_BASE = "orchestrator_";
39927
38956
  var PIMS_BASE = "pims_";
39928
38957
  var DATAFABRIC_BASE = "datafabric_";
39929
38958
  var IDENTITY_BASE = "identity_";
38959
+ var LLMOPS_BASE = "llmopstenant_";
39930
38960
  var INSIGHTS_RTM_BASE = "insightsrtm_";
39931
38961
  var TASK_ENDPOINTS = {
39932
38962
  CREATE_GENERIC_TASK: `${ORCHESTRATOR_BASE}/tasks/GenericTasks/CreateTask`,
@@ -39987,7 +39017,7 @@ var MAESTRO_ENDPOINTS = {
39987
39017
  INSTANCES: {
39988
39018
  GET_ALL: `${PIMS_BASE}/api/v1/instances`,
39989
39019
  GET_BY_ID: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}`,
39990
- GET_EXECUTION_HISTORY: (instanceId) => `${PIMS_BASE}/api/v1/spans/${instanceId}`,
39020
+ GET_ELEMENT_EXECUTIONS: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/element-executions`,
39991
39021
  GET_BPMN: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/bpmn`,
39992
39022
  GET_VARIABLES: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/variables`,
39993
39023
  CANCEL: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/cancel`,
@@ -39999,6 +39029,9 @@ var MAESTRO_ENDPOINTS = {
39999
39029
  GET_BY_PROCESS: (processKey) => `${PIMS_BASE}/api/v1/incidents/process/${processKey}`,
40000
39030
  GET_BY_INSTANCE: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/incidents`
40001
39031
  },
39032
+ TRACES: {
39033
+ GET_SPANS: (traceId) => `${LLMOPS_BASE}/api/Traces/spans?traceId=${traceId}`
39034
+ },
40002
39035
  CASES: {
40003
39036
  GET_CASE_JSON: (instanceId) => `${PIMS_BASE}/api/v1/cases/${instanceId}/case-json`,
40004
39037
  GET_ELEMENT_EXECUTIONS: (instanceId) => `${PIMS_BASE}/api/v1/element-executions/case-instances/${instanceId}`,
@@ -40011,13 +39044,15 @@ var MAESTRO_ENDPOINTS = {
40011
39044
  TOP_PROCESSES_WITH_FAILURE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcesseswithFailure`,
40012
39045
  TOP_ELEMENTS_WITH_FAILURE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopElementswithFailure`,
40013
39046
  INSTANCE_STATUS_BY_DATE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/InstanceStatusByDate`,
40014
- TOP_PROCESSES_BY_DURATION: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByDuration`
39047
+ TOP_PROCESSES_BY_DURATION: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByDuration`,
39048
+ ELEMENT_COUNT_BY_STATUS: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/ElementCountByStatus`
40015
39049
  }
40016
39050
  };
40017
39051
  var DATA_FABRIC_TENANT_FOLDER_ID = "00000000-0000-0000-0000-000000000000";
40018
39052
  var DATA_FABRIC_ENDPOINTS = {
40019
39053
  ENTITY: {
40020
39054
  GET_ALL: `${DATAFABRIC_BASE}/api/Entity`,
39055
+ GET_ALL_V2: `${DATAFABRIC_BASE}/api/v2/Entity`,
40021
39056
  GET_ENTITY_RECORDS: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/read`,
40022
39057
  GET_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/Entity/${entityId}`,
40023
39058
  GET_RECORD_BY_ID: (entityId, recordId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/read/${recordId}`,
@@ -40065,6 +39100,75 @@ var ActionCenterEventNames;
40065
39100
  ActionCenterEventNames2["REFRESHTOKEN"] = "AC.refreshToken";
40066
39101
  })(ActionCenterEventNames || (ActionCenterEventNames = {}));
40067
39102
  var AUTHENTICATION_TIMEOUT = 8000;
39103
+ var ALLOWED_HOST_ORIGINS = new Set([
39104
+ "https://alpha.uipath.com",
39105
+ "https://staging.uipath.com",
39106
+ "https://cloud.uipath.com"
39107
+ ]);
39108
+ function isValidHostOrigin(origin) {
39109
+ if (!origin)
39110
+ return false;
39111
+ if (ALLOWED_HOST_ORIGINS.has(origin))
39112
+ return true;
39113
+ try {
39114
+ return new URL(origin).hostname === "localhost";
39115
+ } catch {
39116
+ console.warn("isValidHostOrigin: received a malformed origin URL", origin);
39117
+ return false;
39118
+ }
39119
+ }
39120
+ function isTokenExpired(tokenInfo) {
39121
+ if (!tokenInfo?.expiresAt)
39122
+ return true;
39123
+ return new Date >= tokenInfo.expiresAt;
39124
+ }
39125
+ var trustedEmbeddingOrigin = isHostEmbedded && embeddingOrigin && isValidHostOrigin(embeddingOrigin) ? embeddingOrigin : null;
39126
+ function waitForMessage(filter, signal) {
39127
+ return new Promise((resolve2, reject) => {
39128
+ const handler = (event) => {
39129
+ if (!filter(event))
39130
+ return;
39131
+ window.removeEventListener("message", handler);
39132
+ resolve2(event);
39133
+ };
39134
+ signal.addEventListener("abort", () => {
39135
+ window.removeEventListener("message", handler);
39136
+ reject(signal.reason);
39137
+ }, { once: true });
39138
+ window.addEventListener("message", handler);
39139
+ });
39140
+ }
39141
+ function requestHostToken(options) {
39142
+ const { pinnedOrigin, sendRequest, responseEventType, extractToken, onTokenRefreshed } = options;
39143
+ const controller = new AbortController;
39144
+ const cancel = () => controller.abort(new AuthenticationError({
39145
+ message: "Token refresh cancelled",
39146
+ statusCode: HttpStatus.UNAUTHORIZED
39147
+ }));
39148
+ const promise = (async () => {
39149
+ const timer = setTimeout(() => controller.abort(new AuthenticationError({
39150
+ message: `Token refresh timed out after ${AUTHENTICATION_TIMEOUT}ms waiting for host response`,
39151
+ statusCode: HttpStatus.UNAUTHORIZED
39152
+ })), AUTHENTICATION_TIMEOUT);
39153
+ try {
39154
+ const responsePromise = waitForMessage((event2) => event2.origin === pinnedOrigin && event2.data?.eventType === responseEventType, controller.signal);
39155
+ sendRequest();
39156
+ const event = await responsePromise;
39157
+ const token = extractToken(event.data);
39158
+ if (!token) {
39159
+ throw new AuthenticationError({
39160
+ message: "Host responded but did not include a valid access token",
39161
+ statusCode: HttpStatus.UNAUTHORIZED
39162
+ });
39163
+ }
39164
+ onTokenRefreshed({ token: token.accessToken, type: "secret", expiresAt: token.expiresAt });
39165
+ return token.accessToken;
39166
+ } finally {
39167
+ clearTimeout(timer);
39168
+ }
39169
+ })();
39170
+ return { promise, cancel };
39171
+ }
40068
39172
 
40069
39173
  class ActionCenterTokenManager {
40070
39174
  constructor(config2, onTokenRefreshed) {
@@ -40074,81 +39178,205 @@ class ActionCenterTokenManager {
40074
39178
  this.refreshPromise = null;
40075
39179
  }
40076
39180
  async refreshAccessToken(tokenInfo) {
40077
- if (!this.isTokenExpired(tokenInfo)) {
39181
+ if (!isTokenExpired(tokenInfo)) {
40078
39182
  return tokenInfo.token;
40079
39183
  }
40080
39184
  if (this.refreshPromise) {
40081
39185
  return this.refreshPromise;
40082
39186
  }
40083
- this.refreshPromise = new Promise((resolve2, reject) => {
40084
- const content = {
39187
+ const parentOrigin = this.parentOrigin;
39188
+ if (!parentOrigin) {
39189
+ return Promise.reject(new AuthenticationError({
39190
+ message: "Cannot refresh token: basedomain query parameter is missing",
39191
+ statusCode: HttpStatus.UNAUTHORIZED
39192
+ }));
39193
+ }
39194
+ if (!isValidHostOrigin(parentOrigin)) {
39195
+ return Promise.reject(new AuthenticationError({
39196
+ message: "Cannot refresh token: basedomain is not a trusted UiPath host origin",
39197
+ statusCode: HttpStatus.UNAUTHORIZED
39198
+ }));
39199
+ }
39200
+ const { promise } = requestHostToken({
39201
+ pinnedOrigin: parentOrigin,
39202
+ sendRequest: () => this.sendMessageToParent(ActionCenterEventNames.REFRESHTOKEN, {
40085
39203
  clientId: this.config.clientId,
40086
39204
  scope: this.config.scope
40087
- };
40088
- this.sendMessageToParent(ActionCenterEventNames.REFRESHTOKEN, content);
40089
- const messageListener = (event) => {
40090
- if (event.origin !== this.parentOrigin)
40091
- return;
40092
- if (event.data?.eventType !== ActionCenterEventNames.TOKENREFRESHED)
39205
+ }),
39206
+ responseEventType: ActionCenterEventNames.TOKENREFRESHED,
39207
+ extractToken: (data) => {
39208
+ const token = data?.content?.token;
39209
+ if (!token?.accessToken)
40093
39210
  return;
40094
- clearTimeout(timer);
40095
- if (event.data?.content?.token) {
40096
- const { accessToken, expiresAt } = event.data.content.token;
40097
- this.onTokenRefreshed({ token: accessToken, type: "secret", expiresAt });
40098
- resolve2(accessToken);
40099
- } else {
40100
- reject(new AuthenticationError({
40101
- message: "Failed to fetch access token",
40102
- statusCode: HttpStatus.UNAUTHORIZED
40103
- }));
40104
- }
40105
- this.refreshPromise = null;
40106
- this.cleanup(messageListener);
40107
- };
40108
- const timer = setTimeout(() => {
40109
- reject(new AuthenticationError({
40110
- message: "Failed to fetch access token",
40111
- statusCode: HttpStatus.UNAUTHORIZED
40112
- }));
40113
- this.refreshPromise = null;
40114
- this.cleanup(messageListener);
40115
- }, AUTHENTICATION_TIMEOUT);
40116
- window.addEventListener("message", messageListener);
39211
+ return { accessToken: token.accessToken, expiresAt: token.expiresAt };
39212
+ },
39213
+ onTokenRefreshed: this.onTokenRefreshed
40117
39214
  });
40118
- return this.refreshPromise;
40119
- }
40120
- isTokenExpired(tokenInfo) {
40121
- if (!tokenInfo?.expiresAt) {
40122
- return true;
39215
+ this.refreshPromise = promise;
39216
+ try {
39217
+ return await this.refreshPromise;
39218
+ } finally {
39219
+ this.refreshPromise = null;
40123
39220
  }
40124
- return new Date >= tokenInfo.expiresAt;
40125
39221
  }
40126
39222
  sendMessageToParent(eventType, content) {
40127
- if (window.parent && this.isValidOrigin(this.parentOrigin)) {
39223
+ if (window.parent && isValidHostOrigin(this.parentOrigin)) {
40128
39224
  try {
40129
39225
  window.parent.postMessage({ eventType, content }, this.parentOrigin);
40130
39226
  } catch (error) {
40131
- console.warn("Failed to send message to Action Center", JSON.stringify(error));
39227
+ console.warn("ActionCenterTokenManager: postMessage to host failed", JSON.stringify(error));
40132
39228
  }
40133
39229
  }
40134
39230
  }
40135
- cleanup(messageListener) {
40136
- window.removeEventListener("message", messageListener);
39231
+ }
39232
+ var UipEmbeddedEventNames;
39233
+ (function(UipEmbeddedEventNames2) {
39234
+ UipEmbeddedEventNames2["REFRESH_TOKEN"] = "UIP.refreshToken";
39235
+ UipEmbeddedEventNames2["TOKEN_REFRESHED"] = "UIP.tokenRefreshed";
39236
+ })(UipEmbeddedEventNames || (UipEmbeddedEventNames = {}));
39237
+ function parseExpiresAt(raw) {
39238
+ const d = new Date(raw);
39239
+ if (isNaN(d.getTime())) {
39240
+ console.warn("EmbeddedTokenManager: host sent a malformed expiresAt value — treating token as already expired", raw);
39241
+ return new Date(0);
39242
+ }
39243
+ return d;
39244
+ }
39245
+ function extractToken(data) {
39246
+ const token = data?.content?.token;
39247
+ if (!token?.accessToken)
39248
+ return;
39249
+ return { accessToken: token.accessToken, expiresAt: parseExpiresAt(token.expiresAt) };
39250
+ }
39251
+
39252
+ class EmbeddedTokenManager {
39253
+ constructor(parentOrigin, config2, onTokenRefreshed) {
39254
+ this.parentOrigin = parentOrigin;
39255
+ this.onTokenRefreshed = onTokenRefreshed;
39256
+ this.refreshPromise = null;
39257
+ this.cancelRefresh = null;
39258
+ if (!config2.clientId || !config2.scope) {
39259
+ throw new ValidationError({
39260
+ message: "EmbeddedTokenManager requires clientId and scope to be configured for host-delegated authentication"
39261
+ });
39262
+ }
39263
+ this.clientId = config2.clientId;
39264
+ this.scope = config2.scope;
39265
+ }
39266
+ async refreshAccessToken(tokenInfo) {
39267
+ if (!isTokenExpired(tokenInfo)) {
39268
+ return tokenInfo.token;
39269
+ }
39270
+ if (this.refreshPromise) {
39271
+ return this.refreshPromise;
39272
+ }
39273
+ const { promise, cancel } = requestHostToken({
39274
+ pinnedOrigin: this.parentOrigin,
39275
+ sendRequest: () => {
39276
+ try {
39277
+ const message = {
39278
+ eventType: UipEmbeddedEventNames.REFRESH_TOKEN,
39279
+ content: { clientId: this.clientId, scope: this.scope }
39280
+ };
39281
+ window.parent.postMessage(message, this.parentOrigin);
39282
+ } catch (error) {
39283
+ console.warn("EmbeddedTokenManager: postMessage to host failed", error);
39284
+ }
39285
+ },
39286
+ responseEventType: UipEmbeddedEventNames.TOKEN_REFRESHED,
39287
+ extractToken,
39288
+ onTokenRefreshed: this.onTokenRefreshed
39289
+ });
39290
+ this.cancelRefresh = cancel;
39291
+ this.refreshPromise = promise;
39292
+ try {
39293
+ return await this.refreshPromise;
39294
+ } finally {
39295
+ this.refreshPromise = null;
39296
+ this.cancelRefresh = null;
39297
+ }
39298
+ }
39299
+ destroy() {
39300
+ this.cancelRefresh?.();
39301
+ }
39302
+ }
39303
+ var SDK_VERSION = "1.4.2";
39304
+ var CLOUD_ROLE_NAME = "uipath-ts-sdk";
39305
+ var SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
39306
+ var SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
39307
+ var SDK_RUN_EVENT = "Sdk.Run";
39308
+ var sdkClient = getOrCreateClient(CLOUD_ROLE_NAME);
39309
+ var track = createTrack(sdkClient);
39310
+ var trackEvent = createTrackEvent(sdkClient);
39311
+ var telemetryClient = {
39312
+ initialize(context) {
39313
+ sdkClient.initialize({
39314
+ sdkVersion: SDK_VERSION,
39315
+ serviceName: SDK_SERVICE_NAME,
39316
+ cloudRoleName: CLOUD_ROLE_NAME,
39317
+ loggerName: SDK_LOGGER_NAME,
39318
+ defaultEventName: SDK_RUN_EVENT,
39319
+ context
39320
+ });
39321
+ },
39322
+ setUserId(userId) {
39323
+ sdkClient.setUserId(userId);
39324
+ }
39325
+ };
39326
+ function encodeBase64(str) {
39327
+ const encoder = new TextEncoder;
39328
+ const data = encoder.encode(str);
39329
+ if (isBrowser2) {
39330
+ const binaryString = Array.from(data, (byte) => String.fromCharCode(byte)).join("");
39331
+ return btoa(binaryString);
39332
+ } else {
39333
+ return Buffer.from(data).toString("base64");
39334
+ }
39335
+ }
39336
+ function decodeBase64(base642) {
39337
+ let bytes;
39338
+ if (isBrowser2) {
39339
+ const binaryString = atob(base642);
39340
+ bytes = new Uint8Array(binaryString.length);
39341
+ for (let i = 0;i < binaryString.length; i++) {
39342
+ bytes[i] = binaryString.charCodeAt(i);
39343
+ }
39344
+ } else {
39345
+ bytes = new Uint8Array(Buffer.from(base642, "base64"));
39346
+ }
39347
+ const decoder = new TextDecoder;
39348
+ return decoder.decode(bytes);
39349
+ }
39350
+ function encodeFolderPathHeader(folderPath) {
39351
+ const buf = new ArrayBuffer(folderPath.length * 2);
39352
+ const view = new DataView(buf);
39353
+ for (let i = 0;i < folderPath.length; i++) {
39354
+ view.setUint16(i * 2, folderPath.charCodeAt(i), true);
40137
39355
  }
40138
- isValidOrigin(origin) {
40139
- const ALLOWED_ORIGINS = ["https://alpha.uipath.com", "https://staging.uipath.com", "https://cloud.uipath.com"];
40140
- if (!origin) {
40141
- return false;
40142
- }
40143
- if (ALLOWED_ORIGINS.includes(origin)) {
40144
- return true;
40145
- }
40146
- try {
40147
- const url = new URL(origin);
40148
- return url.hostname === "localhost";
40149
- } catch {
40150
- return false;
39356
+ const bytes = new Uint8Array(buf);
39357
+ let binary = "";
39358
+ for (let i = 0;i < bytes.byteLength; i++) {
39359
+ binary += String.fromCharCode(bytes[i]);
39360
+ }
39361
+ return btoa(binary);
39362
+ }
39363
+ var BASE64URL_DASH_RE = /-/g;
39364
+ var BASE64URL_UNDERSCORE_RE = /_/g;
39365
+ function base64UrlToBase64(value) {
39366
+ const base642 = value.replace(BASE64URL_DASH_RE, "+").replace(BASE64URL_UNDERSCORE_RE, "/");
39367
+ return base642.padEnd(base642.length + (4 - base642.length % 4) % 4, "=");
39368
+ }
39369
+ function extractUserIdFromToken(token) {
39370
+ try {
39371
+ const payload = token.split(".")[1];
39372
+ if (!payload) {
39373
+ return "";
40151
39374
  }
39375
+ const claims = JSON.parse(decodeBase64(base64UrlToBase64(payload)));
39376
+ const sub2 = claims["sub"];
39377
+ return typeof sub2 === "string" && sub2 ? sub2 : "";
39378
+ } catch {
39379
+ return "";
40152
39380
  }
40153
39381
  }
40154
39382
 
@@ -40159,9 +39387,13 @@ class TokenManager {
40159
39387
  this.isOAuth = isOAuth;
40160
39388
  this.refreshPromise = null;
40161
39389
  this.actionCenterTokenManager = null;
39390
+ this.embeddedTokenManager = null;
40162
39391
  if (isInActionCenter) {
40163
39392
  this.actionCenterTokenManager = new ActionCenterTokenManager(config2, (tokenInfo) => this.setToken(tokenInfo));
40164
39393
  this.isOAuth = false;
39394
+ } else if (trustedEmbeddingOrigin) {
39395
+ this.embeddedTokenManager = new EmbeddedTokenManager(trustedEmbeddingOrigin, config2, (tokenInfo) => this.setToken(tokenInfo));
39396
+ this.isOAuth = false;
40165
39397
  }
40166
39398
  }
40167
39399
  isTokenExpired(tokenInfo) {
@@ -40180,6 +39412,9 @@ class TokenManager {
40180
39412
  if (this.actionCenterTokenManager) {
40181
39413
  return await this.actionCenterTokenManager.refreshAccessToken(tokenInfo);
40182
39414
  }
39415
+ if (this.embeddedTokenManager) {
39416
+ return await this.embeddedTokenManager.refreshAccessToken(tokenInfo);
39417
+ }
40183
39418
  if (tokenInfo.type === "secret") {
40184
39419
  return tokenInfo.token;
40185
39420
  }
@@ -40277,6 +39512,9 @@ class TokenManager {
40277
39512
  }
40278
39513
  return true;
40279
39514
  }
39515
+ destroy() {
39516
+ this.embeddedTokenManager?.destroy();
39517
+ }
40280
39518
  clearToken() {
40281
39519
  this.currentToken = undefined;
40282
39520
  this.executionContext.set("tokenInfo", undefined);
@@ -40290,6 +39528,7 @@ class TokenManager {
40290
39528
  }
40291
39529
  _updateExecutionContext(tokenInfo) {
40292
39530
  this.executionContext.set("tokenInfo", tokenInfo);
39531
+ telemetryClient.setUserId(extractUserIdFromToken(tokenInfo.token));
40293
39532
  }
40294
39533
  async refreshAccessToken() {
40295
39534
  if (this.refreshPromise) {
@@ -40304,6 +39543,7 @@ class TokenManager {
40304
39543
  }
40305
39544
  }
40306
39545
  async _doRefreshToken() {
39546
+ const { orgName, baseUrl } = this.config;
40307
39547
  if (!hasOAuthConfig(this.config)) {
40308
39548
  throw new Error("refreshAccessToken is only available in OAuth flow");
40309
39549
  }
@@ -40311,13 +39551,12 @@ class TokenManager {
40311
39551
  if (!tokenInfo?.refreshToken) {
40312
39552
  throw new Error("No refresh token available. User may need to re-authenticate.");
40313
39553
  }
40314
- const orgName = this.config.orgName;
40315
39554
  const body = new URLSearchParams({
40316
39555
  grant_type: "refresh_token",
40317
39556
  client_id: this.config.clientId,
40318
39557
  refresh_token: tokenInfo.refreshToken
40319
39558
  });
40320
- const response = await fetch(`${this.config.baseUrl}/${orgName}/identity_/connect/token`, {
39559
+ const response = await fetch(`${baseUrl}/${orgName}/identity_/connect/token`, {
40321
39560
  method: "POST",
40322
39561
  headers: {
40323
39562
  "Content-Type": "application/x-www-form-urlencoded"
@@ -40641,26 +39880,6 @@ function isCompleteConfig(config2) {
40641
39880
  function normalizeBaseUrl(url) {
40642
39881
  return url.endsWith("/") ? url.slice(0, -1) : url;
40643
39882
  }
40644
- var SDK_VERSION = "1.3.11";
40645
- var CLOUD_ROLE_NAME = "uipath-ts-sdk";
40646
- var SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
40647
- var SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
40648
- var SDK_RUN_EVENT = "Sdk.Run";
40649
- var sdkClient = getOrCreateClient(CLOUD_ROLE_NAME);
40650
- var track = createTrack(sdkClient);
40651
- var trackEvent = createTrackEvent(sdkClient);
40652
- var telemetryClient = {
40653
- initialize(context) {
40654
- sdkClient.initialize({
40655
- sdkVersion: SDK_VERSION,
40656
- serviceName: SDK_SERVICE_NAME,
40657
- cloudRoleName: CLOUD_ROLE_NAME,
40658
- loggerName: SDK_LOGGER_NAME,
40659
- defaultEventName: SDK_RUN_EVENT,
40660
- context
40661
- });
40662
- }
40663
- };
40664
39883
  var REGISTRY_KEY2 = Symbol.for("@uipath/sdk-internals-registry");
40665
39884
  var getGlobalStore = () => {
40666
39885
  const globalObj = globalThis;
@@ -40724,6 +39943,8 @@ var _UiPath_initialized;
40724
39943
  var _UiPath_partialConfig;
40725
39944
  var _UiPath_multiLogin;
40726
39945
  var _UiPath_metaFolderKey;
39946
+ var _UiPath_metaOrgId;
39947
+ var _UiPath_metaTenantId;
40727
39948
  var _UiPath_initializeWithConfig;
40728
39949
  var _UiPath_loadConfig;
40729
39950
  var UiPath$1 = class UiPath {
@@ -40735,8 +39956,12 @@ var UiPath$1 = class UiPath {
40735
39956
  _UiPath_partialConfig.set(this, undefined);
40736
39957
  _UiPath_multiLogin.set(this, false);
40737
39958
  _UiPath_metaFolderKey.set(this, undefined);
39959
+ _UiPath_metaOrgId.set(this, undefined);
39960
+ _UiPath_metaTenantId.set(this, undefined);
40738
39961
  const configFromMetaTags = loadFromMetaTags();
40739
39962
  __classPrivateFieldSet(this, _UiPath_metaFolderKey, configFromMetaTags?.folderKey, "f");
39963
+ __classPrivateFieldSet(this, _UiPath_metaOrgId, configFromMetaTags?.orgName, "f");
39964
+ __classPrivateFieldSet(this, _UiPath_metaTenantId, configFromMetaTags?.tenantName, "f");
40740
39965
  const mergedConfig = config2 ? { ...configFromMetaTags, ...config2 } : configFromMetaTags;
40741
39966
  if (mergedConfig && isCompleteConfig(mergedConfig)) {
40742
39967
  __classPrivateFieldGet(this, _UiPath_instances, "m", _UiPath_initializeWithConfig).call(this, mergedConfig);
@@ -40807,6 +40032,9 @@ var UiPath$1 = class UiPath {
40807
40032
  getToken() {
40808
40033
  return __classPrivateFieldGet(this, _UiPath_authService, "f")?.getToken();
40809
40034
  }
40035
+ destroy() {
40036
+ __classPrivateFieldGet(this, _UiPath_authService, "f")?.getTokenManager()?.destroy();
40037
+ }
40810
40038
  logout() {
40811
40039
  if (__classPrivateFieldGet(this, _UiPath_config, "f") && hasSecretConfig(__classPrivateFieldGet(this, _UiPath_config, "f"))) {
40812
40040
  return;
@@ -40818,7 +40046,7 @@ var UiPath$1 = class UiPath {
40818
40046
  __classPrivateFieldGet(this, _UiPath_authService, "f")?.updateToken(tokenInfo);
40819
40047
  }
40820
40048
  };
40821
- _UiPath_config = new WeakMap, _UiPath_authService = new WeakMap, _UiPath_initialized = new WeakMap, _UiPath_partialConfig = new WeakMap, _UiPath_multiLogin = new WeakMap, _UiPath_metaFolderKey = new WeakMap, _UiPath_instances = new WeakSet, _UiPath_initializeWithConfig = function _UiPath_initializeWithConfig2(config2) {
40049
+ _UiPath_config = new WeakMap, _UiPath_authService = new WeakMap, _UiPath_initialized = new WeakMap, _UiPath_partialConfig = new WeakMap, _UiPath_multiLogin = new WeakMap, _UiPath_metaFolderKey = new WeakMap, _UiPath_metaOrgId = new WeakMap, _UiPath_metaTenantId = new WeakMap, _UiPath_instances = new WeakSet, _UiPath_initializeWithConfig = function _UiPath_initializeWithConfig2(config2) {
40822
40050
  validateConfig(config2);
40823
40051
  const hasSecretAuth = hasSecretConfig(config2);
40824
40052
  const hasOAuthAuth = hasOAuthConfig(config2);
@@ -40850,19 +40078,23 @@ _UiPath_config = new WeakMap, _UiPath_authService = new WeakMap, _UiPath_initial
40850
40078
  };
40851
40079
  telemetryClient.initialize({
40852
40080
  baseUrl: config2.baseUrl,
40081
+ orgId: __classPrivateFieldGet(this, _UiPath_metaOrgId, "f"),
40082
+ tenantId: __classPrivateFieldGet(this, _UiPath_metaTenantId, "f"),
40853
40083
  orgName: config2.orgName,
40854
40084
  tenantName: config2.tenantName,
40855
40085
  clientId: hasOAuthAuth ? config2.clientId : undefined,
40856
40086
  redirectUri: hasOAuthAuth ? config2.redirectUri : undefined
40857
40087
  });
40858
40088
  trackEvent("Sdk.Auth");
40859
- if (hasSecretAuth || isInActionCenter) {
40089
+ if (hasSecretAuth || isInActionCenter || trustedEmbeddingOrigin) {
40860
40090
  __classPrivateFieldGet(this, _UiPath_authService, "f").authenticateWithSecret(config2.secret ?? "");
40861
40091
  __classPrivateFieldSet(this, _UiPath_initialized, true, "f");
40862
40092
  }
40863
40093
  }, _UiPath_loadConfig = function _UiPath_loadConfig2() {
40864
40094
  const metaConfig = loadFromMetaTags();
40865
40095
  __classPrivateFieldSet(this, _UiPath_metaFolderKey, metaConfig?.folderKey, "f");
40096
+ __classPrivateFieldSet(this, _UiPath_metaOrgId, metaConfig?.orgName, "f");
40097
+ __classPrivateFieldSet(this, _UiPath_metaTenantId, metaConfig?.tenantName, "f");
40866
40098
  const merged = { ...metaConfig, ...__classPrivateFieldGet(this, _UiPath_partialConfig, "f") };
40867
40099
  if (!isCompleteConfig(merged)) {
40868
40100
  throw new Error("UiPath SDK configuration not found. " + "Ensure @uipath/coded-apps plugin is set up in your bundler to inject configuration during development and build.");
@@ -41195,30 +40427,6 @@ function processODataArrayResponse(oDataResponse, successData) {
41195
40427
  data: oDataResponse.value
41196
40428
  };
41197
40429
  }
41198
- function encodeBase64(str) {
41199
- const encoder = new TextEncoder;
41200
- const data = encoder.encode(str);
41201
- if (isBrowser2) {
41202
- const binaryString = Array.from(data, (byte) => String.fromCharCode(byte)).join("");
41203
- return btoa(binaryString);
41204
- } else {
41205
- return Buffer.from(data).toString("base64");
41206
- }
41207
- }
41208
- function decodeBase64(base642) {
41209
- let bytes;
41210
- if (isBrowser2) {
41211
- const binaryString = atob(base642);
41212
- bytes = new Uint8Array(binaryString.length);
41213
- for (let i = 0;i < binaryString.length; i++) {
41214
- bytes[i] = binaryString.charCodeAt(i);
41215
- }
41216
- } else {
41217
- bytes = new Uint8Array(Buffer.from(base642, "base64"));
41218
- }
41219
- const decoder = new TextDecoder;
41220
- return decoder.decode(bytes);
41221
- }
41222
40430
 
41223
40431
  class PaginationManager {
41224
40432
  static createCursor({ pageInfo, type }) {
@@ -41545,12 +40753,14 @@ class PaginationHelpers {
41545
40753
  }
41546
40754
  }
41547
40755
  static async getAllPaginated(params) {
41548
- const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
40756
+ const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
41549
40757
  const endpoint = getEndpoint(folderId);
41550
40758
  const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
40759
+ const isPost = method === HTTP_METHODS.POST;
40760
+ const requestSpec = isPost ? { body: additionalParams, params: queryParams } : { params: { ...additionalParams, ...queryParams } };
41551
40761
  const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
41552
40762
  headers,
41553
- params: additionalParams,
40763
+ ...requestSpec,
41554
40764
  pagination: {
41555
40765
  paginationType: options.paginationType || PaginationType.OFFSET,
41556
40766
  itemsField: options.itemsField || DEFAULT_ITEMS_FIELD,
@@ -41568,21 +40778,21 @@ class PaginationHelpers {
41568
40778
  };
41569
40779
  }
41570
40780
  static async getAllNonPaginated(params) {
41571
- const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
40781
+ const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
41572
40782
  const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
41573
40783
  const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
41574
40784
  const endpoint = folderId ? getByFolderEndpoint : getAllEndpoint;
41575
40785
  const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
41576
40786
  let response;
41577
40787
  if (method === HTTP_METHODS.POST) {
41578
- response = await serviceAccess.post(endpoint, additionalParams, { headers });
40788
+ response = await serviceAccess.post(endpoint, additionalParams, { headers, params: queryParams });
41579
40789
  } else {
41580
40790
  response = await serviceAccess.get(endpoint, {
41581
- params: additionalParams,
40791
+ params: { ...additionalParams, ...queryParams },
41582
40792
  headers
41583
40793
  });
41584
40794
  }
41585
- const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
40795
+ const rawItems = Array.isArray(response.data) ? response.data : resolveNestedField(response.data, itemsField);
41586
40796
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
41587
40797
  const totalCount = typeof rawTotalCount === "number" ? rawTotalCount : undefined;
41588
40798
  const parsedItems = typeof rawItems === "string" ? JSON.parse(rawItems) : rawItems || [];
@@ -41615,8 +40825,9 @@ class PaginationHelpers {
41615
40825
  getEndpoint: config2.getEndpoint,
41616
40826
  folderId,
41617
40827
  headers: config2.headers,
41618
- paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
40828
+ paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
41619
40829
  additionalParams: prefixedOptions,
40830
+ queryParams: config2.queryParams,
41620
40831
  transformFn: config2.transformFn,
41621
40832
  method: config2.method,
41622
40833
  options: {
@@ -41633,6 +40844,7 @@ class PaginationHelpers {
41633
40844
  folderId,
41634
40845
  headers: config2.headers,
41635
40846
  additionalParams: prefixedOptions,
40847
+ queryParams: config2.queryParams,
41636
40848
  transformFn: config2.transformFn,
41637
40849
  method: config2.method,
41638
40850
  options: {
@@ -41711,10 +40923,8 @@ class BaseService {
41711
40923
  const existingBody = options.body && typeof options.body === "object" ? options.body : {};
41712
40924
  options.body = {
41713
40925
  ...existingBody,
41714
- ...options.params,
41715
40926
  ...requestParams
41716
40927
  };
41717
- options.params = undefined;
41718
40928
  } else {
41719
40929
  options.params = {
41720
40930
  ...options.params,
@@ -41742,13 +40952,15 @@ class BaseService {
41742
40952
  const offsetParam = paginationParams?.offsetParam || ODATA_OFFSET_PARAMS.OFFSET_PARAM;
41743
40953
  const countParam = paginationParams?.countParam || ODATA_OFFSET_PARAMS.COUNT_PARAM;
41744
40954
  const convertToSkip = paginationParams?.convertToSkip ?? true;
40955
+ const zeroBased = paginationParams?.zeroBased ?? false;
41745
40956
  requestParams[pageSizeParam] = limitedPageSize;
41746
40957
  if (convertToSkip) {
41747
40958
  if (params.pageNumber && params.pageNumber > 1) {
41748
40959
  requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
41749
40960
  }
41750
40961
  } else {
41751
- requestParams[offsetParam] = params.pageNumber || 1;
40962
+ const sdkPageNumber = params.pageNumber || 1;
40963
+ requestParams[offsetParam] = zeroBased ? sdkPageNumber - 1 : sdkPageNumber;
41752
40964
  }
41753
40965
  {
41754
40966
  requestParams[countParam] = true;
@@ -41771,7 +40983,7 @@ class BaseService {
41771
40983
  const itemsField = fields.itemsField || (paginationType === PaginationType.TOKEN ? "items" : "value");
41772
40984
  const totalCountField = fields.totalCountField || "totalRecordCount";
41773
40985
  const continuationTokenField = fields.continuationTokenField || "continuationToken";
41774
- const items = Array.isArray(response.data) ? response.data : response.data[itemsField] || [];
40986
+ const items = Array.isArray(response.data) ? response.data : resolveNestedField(response.data, itemsField) || [];
41775
40987
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
41776
40988
  const totalCount = typeof rawTotalCount === "number" ? rawTotalCount : undefined;
41777
40989
  const continuationToken = response.data[continuationTokenField];
@@ -41838,12 +41050,12 @@ function createEntityMethods(entityData, service) {
41838
41050
  throw new Error("Entity ID is undefined");
41839
41051
  return service.deleteRecordsById(entityData.id, recordIds, options);
41840
41052
  },
41841
- async deleteRecord(recordId) {
41053
+ async deleteRecord(recordId, options) {
41842
41054
  if (!entityData.id)
41843
41055
  throw new Error("Entity ID is undefined");
41844
41056
  if (!recordId)
41845
41057
  throw new Error("Record ID is undefined");
41846
- return service.deleteRecordById(entityData.id, recordId);
41058
+ return service.deleteRecordById(entityData.id, recordId, options);
41847
41059
  },
41848
41060
  async getAllRecords(options) {
41849
41061
  if (!entityData.id)
@@ -41857,30 +41069,30 @@ function createEntityMethods(entityData, service) {
41857
41069
  throw new Error("Record ID is undefined");
41858
41070
  return service.getRecordById(entityData.id, recordId, options);
41859
41071
  },
41860
- async downloadAttachment(recordId, fieldName) {
41072
+ async downloadAttachment(recordId, fieldName, options) {
41861
41073
  if (!entityData.id)
41862
41074
  throw new Error("Entity ID is undefined");
41863
- return service.downloadAttachment(entityData.id, recordId, fieldName);
41075
+ return service.downloadAttachment(entityData.id, recordId, fieldName, options);
41864
41076
  },
41865
41077
  async uploadAttachment(recordId, fieldName, file, options) {
41866
41078
  if (!entityData.id)
41867
41079
  throw new Error("Entity ID is undefined");
41868
41080
  return service.uploadAttachment(entityData.id, recordId, fieldName, file, options);
41869
41081
  },
41870
- async deleteAttachment(recordId, fieldName) {
41082
+ async deleteAttachment(recordId, fieldName, options) {
41871
41083
  if (!entityData.id)
41872
41084
  throw new Error("Entity ID is undefined");
41873
- return service.deleteAttachment(entityData.id, recordId, fieldName);
41085
+ return service.deleteAttachment(entityData.id, recordId, fieldName, options);
41874
41086
  },
41875
41087
  async queryRecords(options) {
41876
41088
  if (!entityData.id)
41877
41089
  throw new Error("Entity ID is undefined");
41878
41090
  return service.queryRecordsById(entityData.id, options);
41879
41091
  },
41880
- async importRecords(file) {
41092
+ async importRecords(file, options) {
41881
41093
  if (!entityData.id)
41882
41094
  throw new Error("Entity ID is undefined");
41883
- return service.importRecordsById(entityData.id, file);
41095
+ return service.importRecordsById(entityData.id, file, options);
41884
41096
  },
41885
41097
  async insert(data, options) {
41886
41098
  return this.insertRecord(data, options);
@@ -41891,10 +41103,10 @@ function createEntityMethods(entityData, service) {
41891
41103
  async getRecords(options) {
41892
41104
  return this.getAllRecords(options);
41893
41105
  },
41894
- async delete() {
41106
+ async delete(options) {
41895
41107
  if (!entityData.id)
41896
41108
  throw new Error("Entity ID is undefined");
41897
- return service.deleteById(entityData.id);
41109
+ return service.deleteById(entityData.id, options);
41898
41110
  },
41899
41111
  async update(options) {
41900
41112
  if (!entityData.id)
@@ -42015,6 +41227,9 @@ var SqlFieldType;
42015
41227
  SqlFieldType2["DECIMAL"] = "DECIMAL";
42016
41228
  SqlFieldType2["MULTILINE"] = "MULTILINE";
42017
41229
  })(SqlFieldType || (SqlFieldType = {}));
41230
+ var ENTITY_TYPE_IDS = {
41231
+ [EntityType.ChoiceSet]: 1
41232
+ };
42018
41233
  var EntityMap = {
42019
41234
  createTime: "createdTime",
42020
41235
  updateTime: "updatedTime",
@@ -42106,16 +41321,19 @@ var EntityFieldTypeMap = {
42106
41321
  };
42107
41322
 
42108
41323
  class EntityService extends BaseService {
42109
- async getById(id) {
42110
- const response = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_ID(id));
41324
+ async getById(id, options) {
41325
+ const response = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_ID(id), { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
42111
41326
  const metadata = transformData(response.data, EntityMap);
42112
41327
  this.applyFieldMappings(metadata);
42113
41328
  return createEntityWithMethods(metadata, this);
42114
41329
  }
42115
41330
  async getAllRecords(entityId, options) {
41331
+ const { folderKey, ...rest } = options ?? {};
41332
+ const downstreamOptions = options === undefined ? undefined : rest;
42116
41333
  return PaginationHelpers.getAll({
42117
41334
  serviceAccess: this.createPaginationServiceAccess(),
42118
41335
  getEndpoint: () => DATA_FABRIC_ENDPOINTS.ENTITY.GET_ENTITY_RECORDS(entityId),
41336
+ headers: createHeaders({ [FOLDER_KEY]: folderKey }),
42119
41337
  pagination: {
42120
41338
  paginationType: PaginationType.OFFSET,
42121
41339
  itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
@@ -42127,13 +41345,13 @@ class EntityService extends BaseService {
42127
41345
  }
42128
41346
  },
42129
41347
  excludeFromPrefix: ["expansionLevel"]
42130
- }, options);
41348
+ }, downstreamOptions);
42131
41349
  }
42132
41350
  async getRecordById(entityId, recordId, options = {}) {
42133
41351
  const params = createParams({
42134
41352
  expansionLevel: options.expansionLevel
42135
41353
  });
42136
- const response = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.GET_RECORD_BY_ID(entityId, recordId), { params });
41354
+ const response = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.GET_RECORD_BY_ID(entityId, recordId), { params, headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
42137
41355
  return response.data;
42138
41356
  }
42139
41357
  async insertRecordById(id, data, options = {}) {
@@ -42142,7 +41360,7 @@ class EntityService extends BaseService {
42142
41360
  });
42143
41361
  const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.INSERT_BY_ID(id), data, {
42144
41362
  params,
42145
- ...options
41363
+ headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
42146
41364
  });
42147
41365
  return response.data;
42148
41366
  }
@@ -42153,7 +41371,7 @@ class EntityService extends BaseService {
42153
41371
  });
42154
41372
  const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.BATCH_INSERT_BY_ID(id), data, {
42155
41373
  params,
42156
- ...options
41374
+ headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
42157
41375
  });
42158
41376
  return response.data;
42159
41377
  }
@@ -42163,7 +41381,7 @@ class EntityService extends BaseService {
42163
41381
  });
42164
41382
  const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_RECORD_BY_ID(entityId, recordId), data, {
42165
41383
  params,
42166
- ...options
41384
+ headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
42167
41385
  });
42168
41386
  return response.data;
42169
41387
  }
@@ -42174,7 +41392,7 @@ class EntityService extends BaseService {
42174
41392
  });
42175
41393
  const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_BY_ID(id), data, {
42176
41394
  params,
42177
- ...options
41395
+ headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
42178
41396
  });
42179
41397
  return response.data;
42180
41398
  }
@@ -42184,15 +41402,16 @@ class EntityService extends BaseService {
42184
41402
  });
42185
41403
  const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_BY_ID(id), recordIds, {
42186
41404
  params,
42187
- ...options
41405
+ headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
42188
41406
  });
42189
41407
  return response.data;
42190
41408
  }
42191
- async deleteRecordById(entityId, recordId) {
42192
- await this.delete(DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_RECORD_BY_ID(entityId, recordId));
41409
+ async deleteRecordById(entityId, recordId, options) {
41410
+ await this.delete(DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_RECORD_BY_ID(entityId, recordId), { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
42193
41411
  }
42194
- async getAll() {
42195
- const response = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.GET_ALL);
41412
+ async getAll(options) {
41413
+ const endpoint = !options?.folderKey && options?.includeFolderEntities ? DATA_FABRIC_ENDPOINTS.ENTITY.GET_ALL_V2 : DATA_FABRIC_ENDPOINTS.ENTITY.GET_ALL;
41414
+ const response = await this.get(endpoint, { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
42196
41415
  const entities = response.data.map((entity) => {
42197
41416
  const metadata = transformData(entity, EntityMap);
42198
41417
  this.applyFieldMappings(metadata);
@@ -42201,10 +41420,14 @@ class EntityService extends BaseService {
42201
41420
  return entities;
42202
41421
  }
42203
41422
  async queryRecordsById(id, options) {
41423
+ const { folderKey, expansionLevel, ...rest } = options ?? {};
41424
+ const downstreamOptions = options === undefined ? undefined : rest;
42204
41425
  return PaginationHelpers.getAll({
42205
41426
  serviceAccess: this.createPaginationServiceAccess(),
42206
41427
  getEndpoint: () => DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_ID(id),
42207
41428
  method: HTTP_METHODS.POST,
41429
+ headers: createHeaders({ [FOLDER_KEY]: folderKey }),
41430
+ queryParams: createParams({ expansionLevel }),
42208
41431
  pagination: {
42209
41432
  paginationType: PaginationType.OFFSET,
42210
41433
  itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
@@ -42215,22 +41438,23 @@ class EntityService extends BaseService {
42215
41438
  countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
42216
41439
  }
42217
41440
  },
42218
- excludeFromPrefix: ["expansionLevel", "filterGroup", "selectedFields", "sortOptions", "aggregates", "groupBy"]
42219
- }, options);
41441
+ excludeFromPrefix: ["filterGroup", "selectedFields", "sortOptions", "aggregates", "groupBy"]
41442
+ }, downstreamOptions);
42220
41443
  }
42221
- async importRecordsById(id, file) {
41444
+ async importRecordsById(id, file, options) {
42222
41445
  const formData = new FormData;
42223
41446
  if (file instanceof Uint8Array) {
42224
41447
  formData.append("file", new Blob([file.buffer]));
42225
41448
  } else {
42226
41449
  formData.append("file", file);
42227
41450
  }
42228
- const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.BULK_UPLOAD_BY_ID(id), formData);
41451
+ const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.BULK_UPLOAD_BY_ID(id), formData, { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
42229
41452
  return response.data;
42230
41453
  }
42231
- async downloadAttachment(entityId, recordId, fieldName) {
41454
+ async downloadAttachment(entityId, recordId, fieldName, options) {
42232
41455
  const response = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.DOWNLOAD_ATTACHMENT(entityId, recordId, fieldName), {
42233
- responseType: RESPONSE_TYPES.BLOB
41456
+ responseType: RESPONSE_TYPES.BLOB,
41457
+ headers: createHeaders({ [FOLDER_KEY]: options?.folderKey })
42234
41458
  });
42235
41459
  return response.data;
42236
41460
  }
@@ -42242,11 +41466,14 @@ class EntityService extends BaseService {
42242
41466
  formData.append("file", file);
42243
41467
  }
42244
41468
  const params = createParams({ expansionLevel: options?.expansionLevel });
42245
- const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPLOAD_ATTACHMENT(entityId, recordId, fieldName), formData, { params });
41469
+ const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPLOAD_ATTACHMENT(entityId, recordId, fieldName), formData, {
41470
+ params,
41471
+ headers: createHeaders({ [FOLDER_KEY]: options?.folderKey })
41472
+ });
42246
41473
  return response.data;
42247
41474
  }
42248
- async deleteAttachment(entityId, recordId, fieldName) {
42249
- const response = await this.delete(DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_ATTACHMENT(entityId, recordId, fieldName));
41475
+ async deleteAttachment(entityId, recordId, fieldName, options) {
41476
+ const response = await this.delete(DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_ATTACHMENT(entityId, recordId, fieldName), { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
42250
41477
  return response.data;
42251
41478
  }
42252
41479
  async getRecordsById(entityId, options) {
@@ -42260,23 +41487,24 @@ class EntityService extends BaseService {
42260
41487
  }
42261
41488
  async create(name, fields, options) {
42262
41489
  const opts = options ?? {};
41490
+ const fieldPayloads = await this.buildFieldsWithReferenceMeta(fields);
42263
41491
  const payload = {
42264
41492
  ...opts.description !== undefined && { description: opts.description },
42265
41493
  displayName: opts.displayName ?? name,
42266
41494
  entityDefinition: {
42267
41495
  name,
42268
- fields: fields.map((f) => this.buildSchemaFieldPayload(f)),
41496
+ fields: fieldPayloads,
42269
41497
  folderId: opts.folderKey ?? DATA_FABRIC_TENANT_FOLDER_ID,
42270
41498
  isRbacEnabled: opts.isRbacEnabled ?? false,
42271
41499
  isInsightsEnabled: opts.isAnalyticsEnabled ?? false,
42272
41500
  externalFields: opts.externalFields ?? []
42273
41501
  }
42274
41502
  };
42275
- const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPSERT, payload);
41503
+ const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPSERT, payload, { headers: createHeaders({ [FOLDER_KEY]: opts.folderKey }) });
42276
41504
  return response.data;
42277
41505
  }
42278
- async deleteById(id) {
42279
- await this.delete(DATA_FABRIC_ENDPOINTS.ENTITY.DELETE(id));
41506
+ async deleteById(id, options) {
41507
+ await this.delete(DATA_FABRIC_ENDPOINTS.ENTITY.DELETE(id), { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
42280
41508
  }
42281
41509
  async updateById(id, options) {
42282
41510
  const opts = options ?? {};
@@ -42290,11 +41518,12 @@ class EntityService extends BaseService {
42290
41518
  ...opts.displayName !== undefined && { displayName: opts.displayName },
42291
41519
  ...opts.description !== undefined && { description: opts.description },
42292
41520
  ...opts.isRbacEnabled !== undefined && { isRbacEnabled: opts.isRbacEnabled }
42293
- });
41521
+ }, { headers: createHeaders({ [FOLDER_KEY]: opts.folderKey }) });
42294
41522
  }
42295
41523
  }
42296
41524
  async applySchemaUpdate(entityId, options) {
42297
- const entityResponse = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_ID(entityId));
41525
+ const folderHeaders = createHeaders({ [FOLDER_KEY]: options.folderKey });
41526
+ const entityResponse = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_ID(entityId), { headers: folderHeaders });
42298
41527
  const raw = entityResponse.data;
42299
41528
  let fields = (raw.fields ?? []).filter((f) => !f.isSystemField && !f.isPrimaryKey);
42300
41529
  if (options.removeFields?.length) {
@@ -42338,7 +41567,7 @@ class EntityService extends BaseService {
42338
41567
  }
42339
41568
  const newFields = [];
42340
41569
  if (options.addFields?.length) {
42341
- newFields.push(...options.addFields.map((f) => this.buildSchemaFieldPayload(f)));
41570
+ newFields.push(...await this.buildFieldsWithReferenceMeta(options.addFields));
42342
41571
  }
42343
41572
  await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPSERT, {
42344
41573
  displayName: raw.displayName,
@@ -42352,7 +41581,7 @@ class EntityService extends BaseService {
42352
41581
  isInsightsEnabled: raw.isInsightsEnabled ?? false,
42353
41582
  externalFields: raw.externalFields ?? []
42354
41583
  }
42355
- });
41584
+ }, { headers: folderHeaders });
42356
41585
  }
42357
41586
  applyFieldMappings(metadata) {
42358
41587
  this.mapFieldTypes(metadata);
@@ -42407,7 +41636,34 @@ class EntityService extends BaseService {
42407
41636
  return externalSource;
42408
41637
  });
42409
41638
  }
42410
- buildSchemaFieldPayload(field) {
41639
+ async buildFieldsWithReferenceMeta(fields) {
41640
+ const metas = await Promise.all(fields.map((f) => this.buildReferenceMeta(f)));
41641
+ return fields.map((f, i) => this.buildSchemaFieldPayload(f, metas[i]));
41642
+ }
41643
+ async buildReferenceMeta(field) {
41644
+ if (field.referenceFolderKey === undefined)
41645
+ return;
41646
+ if (field.referenceEntityId === undefined && field.choiceSetId === undefined)
41647
+ return;
41648
+ const folderId = field.referenceFolderKey;
41649
+ const meta = {};
41650
+ if (field.referenceEntityId !== undefined) {
41651
+ meta.referenceEntity = { id: field.referenceEntityId, folderId };
41652
+ }
41653
+ if (field.choiceSetId !== undefined) {
41654
+ const lookupFolderKey = folderId === DATA_FABRIC_TENANT_FOLDER_ID ? undefined : folderId;
41655
+ const target = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_ID(field.choiceSetId), { headers: createHeaders({ [FOLDER_KEY]: lookupFolderKey }) });
41656
+ meta.referenceChoiceSet = {
41657
+ id: field.choiceSetId,
41658
+ name: target.data.name,
41659
+ folderId,
41660
+ entityType: EntityType.ChoiceSet,
41661
+ entityTypeId: ENTITY_TYPE_IDS[EntityType.ChoiceSet]
41662
+ };
41663
+ }
41664
+ return meta;
41665
+ }
41666
+ buildSchemaFieldPayload(field, refMeta) {
42411
41667
  const fieldType = field.type ?? EntityFieldDataType.STRING;
42412
41668
  this.validateFieldConstraints(fieldType, field, field.fieldName);
42413
41669
  const isRelationship = fieldType === EntityFieldDataType.RELATIONSHIP;
@@ -42418,6 +41674,8 @@ class EntityService extends BaseService {
42418
41674
  });
42419
41675
  }
42420
41676
  const mapping = EntitySchemaFieldTypeMap[fieldType];
41677
+ const referenceEntityBody = refMeta?.referenceEntity ?? (field.referenceEntityId === undefined ? undefined : { id: field.referenceEntityId });
41678
+ const referenceChoiceSetBody = refMeta?.referenceChoiceSet;
42421
41679
  return {
42422
41680
  name: field.fieldName,
42423
41681
  displayName: field.displayName ?? field.fieldName,
@@ -42436,7 +41694,8 @@ class EntityService extends BaseService {
42436
41694
  ...field.choiceSetId !== undefined && { choiceSetId: field.choiceSetId },
42437
41695
  ...(isRelationship || isFile) && { isForeignKey: true },
42438
41696
  ...isRelationship && { referenceType: ReferenceType.ManyToOne },
42439
- ...field.referenceEntityId !== undefined && { referenceEntity: { id: field.referenceEntityId } },
41697
+ ...referenceEntityBody !== undefined && { referenceEntity: referenceEntityBody },
41698
+ ...referenceChoiceSetBody !== undefined && { referenceChoiceSet: referenceChoiceSetBody },
42440
41699
  ...field.referenceFieldId !== undefined && { referenceField: { id: field.referenceFieldId } }
42441
41700
  };
42442
41701
  }
@@ -42573,8 +41832,12 @@ __decorate([
42573
41832
  ], EntityService.prototype, "updateById", null);
42574
41833
 
42575
41834
  class ChoiceSetService extends BaseService {
42576
- async getAll() {
42577
- const rawResponse = await this.get(DATA_FABRIC_ENDPOINTS.CHOICESETS.GET_ALL);
41835
+ async getAll(options) {
41836
+ return this.fetchAllChoiceSets(options);
41837
+ }
41838
+ async fetchAllChoiceSets(options) {
41839
+ const folderKey = options?.folderKey ?? (options?.includeFolderChoiceSets ? undefined : DATA_FABRIC_TENANT_FOLDER_ID);
41840
+ const rawResponse = await this.get(DATA_FABRIC_ENDPOINTS.CHOICESETS.GET_ALL, { headers: createHeaders({ [FOLDER_KEY]: folderKey }) });
42578
41841
  const data = rawResponse.data || [];
42579
41842
  return data.map((choiceSet) => transformData(choiceSet, EntityMap));
42580
41843
  }
@@ -42583,11 +41846,14 @@ class ChoiceSetService extends BaseService {
42583
41846
  const camelCased = pascalToCamelCaseKeys(item);
42584
41847
  return transformData(camelCased, EntityMap);
42585
41848
  };
41849
+ const { folderKey, ...rest } = options ?? {};
41850
+ const downstreamOptions = options === undefined ? undefined : rest;
42586
41851
  return PaginationHelpers.getAll({
42587
41852
  serviceAccess: this.createPaginationServiceAccess(),
42588
41853
  getEndpoint: () => DATA_FABRIC_ENDPOINTS.CHOICESETS.GET_BY_ID(choiceSetId),
42589
41854
  transformFn,
42590
41855
  method: HTTP_METHODS.POST,
41856
+ headers: createHeaders({ [FOLDER_KEY]: folderKey }),
42591
41857
  pagination: {
42592
41858
  paginationType: PaginationType.OFFSET,
42593
41859
  itemsField: CHOICESET_VALUES_PAGINATION.ITEMS_FIELD,
@@ -42598,7 +41864,7 @@ class ChoiceSetService extends BaseService {
42598
41864
  countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
42599
41865
  }
42600
41866
  }
42601
- }, options);
41867
+ }, downstreamOptions);
42602
41868
  }
42603
41869
  async create(name, options) {
42604
41870
  const opts = options ?? {};
@@ -42611,7 +41877,7 @@ class ChoiceSetService extends BaseService {
42611
41877
  folderId: opts.folderKey ?? DATA_FABRIC_TENANT_FOLDER_ID
42612
41878
  }
42613
41879
  };
42614
- const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.CREATE, payload);
41880
+ const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.CREATE, payload, { headers: createHeaders({ [FOLDER_KEY]: opts.folderKey }) });
42615
41881
  return response.data;
42616
41882
  }
42617
41883
  async updateById(choiceSetId, options) {
@@ -42623,33 +41889,33 @@ class ChoiceSetService extends BaseService {
42623
41889
  await this.patch(DATA_FABRIC_ENDPOINTS.CHOICESETS.UPDATE(choiceSetId), {
42624
41890
  ...options.displayName !== undefined && { displayName: options.displayName },
42625
41891
  ...options.description !== undefined && { description: options.description }
42626
- });
41892
+ }, { headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
42627
41893
  }
42628
- async deleteById(choiceSetId) {
42629
- await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.DELETE(choiceSetId), {});
41894
+ async deleteById(choiceSetId, options) {
41895
+ await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.DELETE(choiceSetId), {}, { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
42630
41896
  }
42631
41897
  async insertValueById(choiceSetId, name, options) {
42632
- const choiceSetName = await this.resolveChoiceSetName(choiceSetId);
41898
+ const choiceSetName = await this.resolveChoiceSetName(choiceSetId, options?.folderKey);
42633
41899
  const payload = {
42634
41900
  Name: name,
42635
41901
  ...options?.displayName !== undefined && { DisplayName: options.displayName }
42636
41902
  };
42637
- const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.INSERT_BY_NAME(choiceSetName), payload);
41903
+ const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.INSERT_BY_NAME(choiceSetName), payload, { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
42638
41904
  const camelCased = pascalToCamelCaseKeys(response.data);
42639
41905
  return transformData(camelCased, EntityMap);
42640
41906
  }
42641
- async updateValueById(choiceSetId, valueId, displayName) {
42642
- const choiceSetName = await this.resolveChoiceSetName(choiceSetId);
41907
+ async updateValueById(choiceSetId, valueId, displayName, options) {
41908
+ const choiceSetName = await this.resolveChoiceSetName(choiceSetId, options?.folderKey);
42643
41909
  const payload = { DisplayName: displayName };
42644
- const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.UPDATE_BY_NAME(choiceSetName, valueId), payload);
41910
+ const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.UPDATE_BY_NAME(choiceSetName, valueId), payload, { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
42645
41911
  const camelCased = pascalToCamelCaseKeys(response.data);
42646
41912
  return transformData(camelCased, EntityMap);
42647
41913
  }
42648
- async deleteValuesById(choiceSetId, valueIds) {
42649
- await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.DELETE_BY_ID(choiceSetId), valueIds);
41914
+ async deleteValuesById(choiceSetId, valueIds, options) {
41915
+ await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.DELETE_BY_ID(choiceSetId), valueIds, { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
42650
41916
  }
42651
- async resolveChoiceSetName(choiceSetId) {
42652
- const all = await this.getAll();
41917
+ async resolveChoiceSetName(choiceSetId, folderKey) {
41918
+ const all = await this.fetchAllChoiceSets(folderKey === undefined ? undefined : { folderKey });
42653
41919
  const match = all.find((cs) => cs.id === choiceSetId);
42654
41920
  if (!match) {
42655
41921
  throw new NotFoundError({ message: `Choice set with id '${choiceSetId}' not found.` });
@@ -42689,6 +41955,13 @@ function createProcessMethods(processData, service) {
42689
41955
  if (!processData.folderKey)
42690
41956
  throw new Error("Folder key is undefined");
42691
41957
  return service.getIncidents(processData.processKey, processData.folderKey);
41958
+ },
41959
+ getElementStats(startTime, endTime, packageVersion) {
41960
+ if (!processData.processKey)
41961
+ throw new Error("Process key is undefined");
41962
+ if (!processData.packageId)
41963
+ throw new Error("Package ID is undefined");
41964
+ return service.getElementStats(processData.processKey, processData.packageId, startTime, endTime, packageVersion);
42692
41965
  }
42693
41966
  };
42694
41967
  }
@@ -42720,6 +41993,17 @@ async function fetchInstanceStatusTimeline(postFn, startTime, endTime, isCaseMan
42720
41993
  });
42721
41994
  return response.data ?? [];
42722
41995
  }
41996
+ function buildElementCountByStatusBody(processKey, packageId, startTime, endTime, packageVersion) {
41997
+ return {
41998
+ commonParams: {
41999
+ processKey,
42000
+ packageId,
42001
+ startTime: startTime.getTime(),
42002
+ endTime: endTime.getTime(),
42003
+ version: packageVersion
42004
+ }
42005
+ };
42006
+ }
42723
42007
  var ProcessIncidentMap = {
42724
42008
  errorTimeUtc: "errorTime"
42725
42009
  };
@@ -42833,7 +42117,9 @@ function createProcessInstanceMethods(instanceData, service) {
42833
42117
  async getExecutionHistory() {
42834
42118
  if (!instanceData.instanceId)
42835
42119
  throw new Error("Process instance ID is undefined");
42836
- return service.getExecutionHistory(instanceData.instanceId);
42120
+ if (!instanceData.folderKey)
42121
+ throw new Error("Process instance folder key is undefined");
42122
+ return service.getExecutionHistory(instanceData.instanceId, instanceData.folderKey);
42837
42123
  },
42838
42124
  async getBpmn() {
42839
42125
  if (!instanceData.instanceId)
@@ -42878,6 +42164,21 @@ var DebugMode;
42878
42164
  DebugMode2["StepByStep"] = "StepByStep";
42879
42165
  DebugMode2["SingleStep"] = "SingleStep";
42880
42166
  })(DebugMode || (DebugMode = {}));
42167
+ function createCaseMethods(caseData, service) {
42168
+ return {
42169
+ getElementStats(startTime, endTime, packageVersion) {
42170
+ if (!caseData.processKey)
42171
+ throw new Error("Process key is undefined");
42172
+ if (!caseData.packageId)
42173
+ throw new Error("Package ID is undefined");
42174
+ return service.getElementStats(caseData.processKey, caseData.packageId, startTime, endTime, packageVersion);
42175
+ }
42176
+ };
42177
+ }
42178
+ function createCaseWithMethods(caseData, service) {
42179
+ const methods = createCaseMethods(caseData, service);
42180
+ return Object.assign({}, caseData, methods);
42181
+ }
42881
42182
  var SlaSummaryStatus;
42882
42183
  (function(SlaSummaryStatus2) {
42883
42184
  SlaSummaryStatus2["ON_TRACK"] = "On Track";
@@ -43016,9 +42317,6 @@ var ProcessInstanceMap = {
43016
42317
  createdAt: "createdTime",
43017
42318
  updatedAt: "updatedTime"
43018
42319
  };
43019
- var ProcessInstanceExecutionHistoryMap = {
43020
- startTime: "startedTime"
43021
- };
43022
42320
 
43023
42321
  class ProcessInstancesService extends BaseService {
43024
42322
  async getAll(options) {
@@ -43049,9 +42347,43 @@ class ProcessInstancesService extends BaseService {
43049
42347
  const rawInstance = transformData(response.data, ProcessInstanceMap);
43050
42348
  return createProcessInstanceWithMethods(rawInstance, this);
43051
42349
  }
43052
- async getExecutionHistory(instanceId) {
43053
- const response = await this.get(MAESTRO_ENDPOINTS.INSTANCES.GET_EXECUTION_HISTORY(instanceId));
43054
- return response.data.map((historyItem) => transformData(historyItem, ProcessInstanceExecutionHistoryMap));
42350
+ async getExecutionHistory(instanceId, folderKey) {
42351
+ const headers = createHeaders({ [FOLDER_KEY]: folderKey });
42352
+ const elementExecResponse = await this.get(MAESTRO_ENDPOINTS.INSTANCES.GET_ELEMENT_EXECUTIONS(instanceId), { headers });
42353
+ const traceId = elementExecResponse.data.traceId;
42354
+ const spansResponse = await this.get(MAESTRO_ENDPOINTS.TRACES.GET_SPANS(traceId), { headers });
42355
+ const spanMap = new Map;
42356
+ for (const span of spansResponse.data) {
42357
+ try {
42358
+ const attrs = span.Attributes ? JSON.parse(span.Attributes) : null;
42359
+ if (attrs?.elementRunId) {
42360
+ spanMap.set(attrs.elementRunId, span);
42361
+ }
42362
+ } catch {}
42363
+ }
42364
+ const results = [];
42365
+ for (const elementExec of elementExecResponse.data.elementExecutions) {
42366
+ for (const run of elementExec.elementRuns) {
42367
+ const span = spanMap.get(run.elementRunId);
42368
+ if (span) {
42369
+ results.push(this.mapSpanToHistory(span));
42370
+ }
42371
+ }
42372
+ }
42373
+ return results;
42374
+ }
42375
+ mapSpanToHistory(span) {
42376
+ return {
42377
+ id: span.Id,
42378
+ traceId: span.TraceId,
42379
+ parentId: span.ParentId,
42380
+ name: span.Name,
42381
+ startedTime: span.StartTime,
42382
+ endTime: span.EndTime,
42383
+ attributes: span.Attributes,
42384
+ updatedTime: span.UpdatedAt,
42385
+ expiredTime: span.ExpiryTimeUtc
42386
+ };
43055
42387
  }
43056
42388
  async getBpmn(instanceId, folderKey) {
43057
42389
  const response = await this.get(MAESTRO_ENDPOINTS.INSTANCES.GET_BPMN(instanceId), {
@@ -43253,6 +42585,10 @@ class MaestroProcessesService extends BaseService {
43253
42585
  const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_DURATION, buildInsightsTopBody(startTime, endTime, false, options));
43254
42586
  return (data ?? []).map((process10) => ({ ...process10, name: process10.packageId }));
43255
42587
  }
42588
+ async getElementStats(processKey, packageId, startTime, endTime, packageVersion) {
42589
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.ELEMENT_COUNT_BY_STATUS, buildElementCountByStatusBody(processKey, packageId, startTime, endTime, packageVersion));
42590
+ return data ?? [];
42591
+ }
43256
42592
  }
43257
42593
  __decorate([
43258
42594
  track("MaestroProcesses.GetAll")
@@ -43275,6 +42611,9 @@ __decorate([
43275
42611
  __decorate([
43276
42612
  track("MaestroProcesses.GetTopExecutionDuration")
43277
42613
  ], MaestroProcessesService.prototype, "getTopExecutionDuration", null);
42614
+ __decorate([
42615
+ track("MaestroProcesses.GetElementStats")
42616
+ ], MaestroProcessesService.prototype, "getElementStats", null);
43278
42617
 
43279
42618
  class ProcessIncidentsService extends BaseService {
43280
42619
  async getAll() {
@@ -43298,10 +42637,10 @@ class CasesService extends BaseService {
43298
42637
  });
43299
42638
  const response = await this.get(MAESTRO_ENDPOINTS.PROCESSES.GET_ALL, { params });
43300
42639
  const cases = response.data?.processes || [];
43301
- return cases.map((caseItem) => ({
42640
+ return cases.map((caseItem) => createCaseWithMethods({
43302
42641
  ...caseItem,
43303
42642
  name: this.extractCaseName(caseItem.packageId)
43304
- }));
42643
+ }, this));
43305
42644
  }
43306
42645
  async getTopRunCount(startTime, endTime, options) {
43307
42646
  const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_RUN_COUNT, buildInsightsTopBody(startTime, endTime, true, options));
@@ -43332,6 +42671,10 @@ class CasesService extends BaseService {
43332
42671
  const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_DURATION, buildInsightsTopBody(startTime, endTime, true, options));
43333
42672
  return (data ?? []).map((process10) => ({ ...process10, name: this.extractCaseName(process10.packageId) }));
43334
42673
  }
42674
+ async getElementStats(processKey, packageId, startTime, endTime, packageVersion) {
42675
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.ELEMENT_COUNT_BY_STATUS, buildElementCountByStatusBody(processKey, packageId, startTime, endTime, packageVersion));
42676
+ return data ?? [];
42677
+ }
43335
42678
  extractCaseName(packageId) {
43336
42679
  const caseManagementIndex = packageId.indexOf("CaseManagement.");
43337
42680
  if (caseManagementIndex !== -1) {
@@ -43359,6 +42702,9 @@ __decorate([
43359
42702
  __decorate([
43360
42703
  track("Cases.GetTopExecutionDuration")
43361
42704
  ], CasesService.prototype, "getTopExecutionDuration", null);
42705
+ __decorate([
42706
+ track("Cases.GetElementStats")
42707
+ ], CasesService.prototype, "getElementStats", null);
43362
42708
  var CaseInstanceMap = {
43363
42709
  startedTimeUtc: "startedTime",
43364
42710
  completedTimeUtc: "completedTime",
@@ -43403,13 +42749,15 @@ function createTaskMethods(taskData, service) {
43403
42749
  async assign(options) {
43404
42750
  if (!taskData.id)
43405
42751
  throw new Error("Task ID is undefined");
43406
- const assignmentOptions = "userId" in options && options.userId !== undefined ? { taskId: taskData.id, userId: options.userId } : { taskId: taskData.id, userNameOrEmail: options.userNameOrEmail };
42752
+ const criteria = options.assignmentCriteria !== undefined ? { assignmentCriteria: options.assignmentCriteria } : {};
42753
+ const assignmentOptions = "userId" in options && options.userId !== undefined ? { taskId: taskData.id, userId: options.userId, ...criteria } : { taskId: taskData.id, userNameOrEmail: options.userNameOrEmail, ...criteria };
43407
42754
  return service.assign(assignmentOptions);
43408
42755
  },
43409
42756
  async reassign(options) {
43410
42757
  if (!taskData.id)
43411
42758
  throw new Error("Task ID is undefined");
43412
- const assignmentOptions = "userId" in options && options.userId !== undefined ? { taskId: taskData.id, userId: options.userId } : { taskId: taskData.id, userNameOrEmail: options.userNameOrEmail };
42759
+ const criteria = options.assignmentCriteria !== undefined ? { assignmentCriteria: options.assignmentCriteria } : {};
42760
+ const assignmentOptions = "userId" in options && options.userId !== undefined ? { taskId: taskData.id, userId: options.userId, ...criteria } : { taskId: taskData.id, userNameOrEmail: options.userNameOrEmail, ...criteria };
43413
42761
  return service.reassign(assignmentOptions);
43414
42762
  },
43415
42763
  async unassign() {
@@ -43943,19 +43291,6 @@ function validateName(resourceType, name) {
43943
43291
  }
43944
43292
  return trimmed;
43945
43293
  }
43946
- function encodeFolderPathHeader(folderPath) {
43947
- const buf = new ArrayBuffer(folderPath.length * 2);
43948
- const view = new DataView(buf);
43949
- for (let i = 0;i < folderPath.length; i++) {
43950
- view.setUint16(i * 2, folderPath.charCodeAt(i), true);
43951
- }
43952
- const bytes = new Uint8Array(buf);
43953
- let binary = "";
43954
- for (let i = 0;i < bytes.byteLength; i++) {
43955
- binary += String.fromCharCode(bytes[i]);
43956
- }
43957
- return btoa(binary);
43958
- }
43959
43294
  function resolveFolderHeaders(input) {
43960
43295
  const { folderId, folderKey, folderPath, resourceType, fallbackFolderKey } = input;
43961
43296
  const trimmedKey = folderKey?.trim();
@@ -44036,6 +43371,19 @@ function describeFolderForError(folderId, folderKey, folderPath) {
44036
43371
  return ` in folder (id: ${folderId})`;
44037
43372
  return "";
44038
43373
  }
43374
+ var AssetValueScope;
43375
+ (function(AssetValueScope2) {
43376
+ AssetValueScope2["Global"] = "Global";
43377
+ AssetValueScope2["PerRobot"] = "PerRobot";
43378
+ })(AssetValueScope || (AssetValueScope = {}));
43379
+ var AssetValueType;
43380
+ (function(AssetValueType2) {
43381
+ AssetValueType2["Text"] = "Text";
43382
+ AssetValueType2["Bool"] = "Bool";
43383
+ AssetValueType2["Integer"] = "Integer";
43384
+ AssetValueType2["Credential"] = "Credential";
43385
+ AssetValueType2["Secret"] = "Secret";
43386
+ })(AssetValueType || (AssetValueType = {}));
44039
43387
  var AssetMap = {
44040
43388
  creationTime: "createdTime",
44041
43389
  lastModificationTime: "lastModifiedTime"
@@ -44075,6 +43423,33 @@ class AssetService extends FolderScopedService {
44075
43423
  async getByName(name, options = {}) {
44076
43424
  return this.getByNameLookup("Asset", ASSET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap));
44077
43425
  }
43426
+ async updateValueById(id, newValue, options) {
43427
+ if (!id) {
43428
+ throw new ValidationError({ message: "id is required for updateValueById" });
43429
+ }
43430
+ if (newValue === null || newValue === undefined) {
43431
+ throw new ValidationError({ message: "newValue is required for updateValueById" });
43432
+ }
43433
+ const headers = resolveFolderHeaders({
43434
+ folderId: options?.folderId,
43435
+ folderKey: options?.folderKey,
43436
+ folderPath: options?.folderPath,
43437
+ resourceType: "Assets.updateValueById",
43438
+ fallbackFolderKey: this.config.folderKey
43439
+ });
43440
+ const existingResponse = await this.get(ASSET_ENDPOINTS.GET_BY_ID(id), { headers });
43441
+ const existing = existingResponse.data;
43442
+ const valueField = resolveValueField(id, existing.ValueType, newValue);
43443
+ const body = {
43444
+ Id: id,
43445
+ Name: existing.Name,
43446
+ ValueScope: existing.ValueScope,
43447
+ ValueType: existing.ValueType,
43448
+ Description: existing.Description,
43449
+ [valueField]: newValue
43450
+ };
43451
+ await this.put(ASSET_ENDPOINTS.GET_BY_ID(id), body, { headers });
43452
+ }
44078
43453
  }
44079
43454
  __decorate([
44080
43455
  track("Assets.GetAll")
@@ -44085,23 +43460,38 @@ __decorate([
44085
43460
  __decorate([
44086
43461
  track("Assets.GetByName")
44087
43462
  ], AssetService.prototype, "getByName", null);
44088
- var AssetValueScope;
44089
- (function(AssetValueScope2) {
44090
- AssetValueScope2["Global"] = "Global";
44091
- AssetValueScope2["PerRobot"] = "PerRobot";
44092
- })(AssetValueScope || (AssetValueScope = {}));
44093
- var AssetValueType;
44094
- (function(AssetValueType2) {
44095
- AssetValueType2["DBConnectionString"] = "DBConnectionString";
44096
- AssetValueType2["HttpConnectionString"] = "HttpConnectionString";
44097
- AssetValueType2["Text"] = "Text";
44098
- AssetValueType2["Bool"] = "Bool";
44099
- AssetValueType2["Integer"] = "Integer";
44100
- AssetValueType2["Credential"] = "Credential";
44101
- AssetValueType2["WindowsCredential"] = "WindowsCredential";
44102
- AssetValueType2["KeyValueList"] = "KeyValueList";
44103
- AssetValueType2["Secret"] = "Secret";
44104
- })(AssetValueType || (AssetValueType = {}));
43463
+ __decorate([
43464
+ track("Assets.UpdateValueById")
43465
+ ], AssetService.prototype, "updateValueById", null);
43466
+ function resolveValueField(id, valueType, newValue) {
43467
+ switch (valueType) {
43468
+ case AssetValueType.Text:
43469
+ if (typeof newValue !== "string") {
43470
+ throw new ValidationError({
43471
+ message: `Asset ${id} has valueType Text; newValue must be a string, got ${typeof newValue}`
43472
+ });
43473
+ }
43474
+ return "StringValue";
43475
+ case AssetValueType.Integer:
43476
+ if (typeof newValue !== "number" || !Number.isInteger(newValue)) {
43477
+ throw new ValidationError({
43478
+ message: `Asset ${id} has valueType Integer; newValue must be an integer number, got ${typeof newValue}`
43479
+ });
43480
+ }
43481
+ return "IntValue";
43482
+ case AssetValueType.Bool:
43483
+ if (typeof newValue !== "boolean") {
43484
+ throw new ValidationError({
43485
+ message: `Asset ${id} has valueType Bool; newValue must be a boolean, got ${typeof newValue}`
43486
+ });
43487
+ }
43488
+ return "BoolValue";
43489
+ default:
43490
+ throw new ValidationError({
43491
+ message: `updateValueById only supports Text, Integer, or Bool assets; asset ${id} has valueType ${valueType}`
43492
+ });
43493
+ }
43494
+ }
44105
43495
  var BucketMap = {
44106
43496
  fullPath: "path",
44107
43497
  items: "blobItems",
@@ -44147,13 +43537,28 @@ class BucketService extends FolderScopedService {
44147
43537
  }
44148
43538
  }, options);
44149
43539
  }
44150
- async getFileMetaData(bucketId, folderId, options) {
43540
+ async getFileMetaData(bucketId, optionsOrFolderId, legacyOptions) {
44151
43541
  if (!bucketId) {
44152
43542
  throw new ValidationError({ message: "bucketId is required for getFileMetaData" });
44153
43543
  }
44154
- if (!folderId) {
44155
- throw new ValidationError({ message: "folderId is required for getFileMetaData" });
43544
+ let folderId;
43545
+ let folderKey;
43546
+ let folderPath;
43547
+ let restOptions;
43548
+ if (typeof optionsOrFolderId === "number") {
43549
+ folderId = optionsOrFolderId;
43550
+ restOptions = legacyOptions ?? {};
43551
+ } else {
43552
+ const opts = optionsOrFolderId ?? {};
43553
+ ({ folderId, folderKey, folderPath, ...restOptions } = opts);
44156
43554
  }
43555
+ const headers = resolveFolderHeaders({
43556
+ folderId,
43557
+ folderKey,
43558
+ folderPath,
43559
+ resourceType: "Buckets.getFileMetaData",
43560
+ fallbackFolderKey: this.config.folderKey
43561
+ });
44157
43562
  const transformBlobItem = (item) => transformData(item, BucketMap);
44158
43563
  return PaginationHelpers.getAll({
44159
43564
  serviceAccess: this.createPaginationServiceAccess(),
@@ -44168,41 +43573,88 @@ class BucketService extends FolderScopedService {
44168
43573
  tokenParam: BUCKET_TOKEN_PARAMS.TOKEN_PARAM
44169
43574
  }
44170
43575
  },
44171
- excludeFromPrefix: ["prefix"]
44172
- }, { ...options, folderId });
43576
+ excludeFromPrefix: ["prefix"],
43577
+ headers
43578
+ }, restOptions);
44173
43579
  }
44174
- async uploadFile(options) {
44175
- const { bucketId, folderId, path: path3, content } = options;
43580
+ async uploadFile(bucketIdOrOptions, path3, content, options) {
43581
+ let bucketId;
43582
+ let resolvedPath;
43583
+ let resolvedContent;
43584
+ let folderId;
43585
+ let folderKey;
43586
+ let folderPath;
43587
+ if (bucketIdOrOptions !== null && typeof bucketIdOrOptions === "object") {
43588
+ ({ bucketId, path: resolvedPath, content: resolvedContent, folderId, folderKey, folderPath } = bucketIdOrOptions);
43589
+ } else {
43590
+ bucketId = bucketIdOrOptions;
43591
+ resolvedPath = path3;
43592
+ resolvedContent = content;
43593
+ const opts = options ?? {};
43594
+ ({ folderId, folderKey, folderPath } = opts);
43595
+ }
44176
43596
  if (!bucketId) {
44177
43597
  throw new ValidationError({ message: "bucketId is required for uploadFile" });
44178
43598
  }
44179
- if (!folderId) {
44180
- throw new ValidationError({ message: "folderId is required for uploadFile" });
44181
- }
44182
- if (!path3) {
43599
+ if (!resolvedPath) {
44183
43600
  throw new ValidationError({ message: "path is required for uploadFile" });
44184
43601
  }
44185
- if (!content) {
43602
+ if (!resolvedContent) {
44186
43603
  throw new ValidationError({ message: "content is required for uploadFile" });
44187
43604
  }
43605
+ const headers = resolveFolderHeaders({
43606
+ folderId,
43607
+ folderKey,
43608
+ folderPath,
43609
+ resourceType: "Buckets.uploadFile",
43610
+ fallbackFolderKey: this.config.folderKey
43611
+ });
44188
43612
  const uriResponse = await this._getWriteUri({
44189
43613
  bucketId,
44190
- folderId,
44191
- path: path3
43614
+ path: resolvedPath,
43615
+ headers
44192
43616
  });
44193
- const response = await this._uploadToUri(uriResponse, content);
43617
+ const response = await this._uploadToUri(uriResponse, resolvedContent);
44194
43618
  return {
44195
43619
  success: response.status >= 200 && response.status < 300,
44196
43620
  statusCode: response.status
44197
43621
  };
44198
43622
  }
44199
- async getReadUri(options) {
44200
- const { bucketId, folderId, path: path3, expiryInMinutes, ...restOptions } = options;
43623
+ async getReadUri(bucketIdOrOptions, path3, options) {
43624
+ let bucketId;
43625
+ let resolvedPath;
43626
+ let folderId;
43627
+ let folderKey;
43628
+ let folderPath;
43629
+ let expiryInMinutes;
43630
+ let restOptions;
43631
+ if (bucketIdOrOptions !== null && typeof bucketIdOrOptions === "object") {
43632
+ const { bucketId: bid, path: p, expiryInMinutes: e, folderId: fid, folderKey: fkey, folderPath: fpath, ...rest } = bucketIdOrOptions;
43633
+ bucketId = bid;
43634
+ resolvedPath = p;
43635
+ expiryInMinutes = e;
43636
+ folderId = fid;
43637
+ folderKey = fkey;
43638
+ folderPath = fpath;
43639
+ restOptions = rest;
43640
+ } else {
43641
+ bucketId = bucketIdOrOptions;
43642
+ resolvedPath = path3;
43643
+ const opts = options ?? {};
43644
+ ({ expiryInMinutes, folderId, folderKey, folderPath, ...restOptions } = opts);
43645
+ }
43646
+ const headers = resolveFolderHeaders({
43647
+ folderId,
43648
+ folderKey,
43649
+ folderPath,
43650
+ resourceType: "Buckets.getReadUri",
43651
+ fallbackFolderKey: this.config.folderKey
43652
+ });
44201
43653
  const queryOptions = {
44202
43654
  expiryInMinutes,
44203
43655
  ...addPrefixToKeys(restOptions, ODATA_PREFIX, Object.keys(restOptions))
44204
43656
  };
44205
- return this._getUri(BUCKET_ENDPOINTS.GET_READ_URI(bucketId), bucketId, folderId, path3, queryOptions);
43657
+ return this._getUri(BUCKET_ENDPOINTS.GET_READ_URI(bucketId), bucketId, resolvedPath, headers, queryOptions);
44206
43658
  }
44207
43659
  async _uploadToUri(uriResponse, content) {
44208
43660
  const { uri, headers = {}, requiresAuth } = uriResponse;
@@ -44220,17 +43672,13 @@ class BucketService extends FolderScopedService {
44220
43672
  headers: createHeaders(requestHeaders)
44221
43673
  });
44222
43674
  }
44223
- async _getUri(endpoint, bucketId, folderId, path3, queryOptions = {}) {
43675
+ async _getUri(endpoint, bucketId, path3, headers, queryOptions = {}) {
44224
43676
  if (!bucketId) {
44225
43677
  throw new ValidationError({ message: "bucketId is required for getUri" });
44226
43678
  }
44227
- if (!folderId) {
44228
- throw new ValidationError({ message: "folderId is required for getUri" });
44229
- }
44230
43679
  if (!path3) {
44231
43680
  throw new ValidationError({ message: "path is required for getUri" });
44232
43681
  }
44233
- const headers = createHeaders({ [FOLDER_ID]: folderId });
44234
43682
  const queryParams = filterUndefined({
44235
43683
  path: path3,
44236
43684
  ...queryOptions
@@ -44296,12 +43744,12 @@ class BucketService extends FolderScopedService {
44296
43744
  });
44297
43745
  }
44298
43746
  async _getWriteUri(options) {
44299
- const { bucketId, folderId, path: path3, expiryInMinutes, ...restOptions } = options;
43747
+ const { bucketId, path: path3, expiryInMinutes, headers, ...restOptions } = options;
44300
43748
  const queryOptions = {
44301
43749
  expiryInMinutes,
44302
43750
  ...addPrefixToKeys(restOptions, ODATA_PREFIX, Object.keys(restOptions))
44303
43751
  };
44304
- return this._getUri(BUCKET_ENDPOINTS.GET_WRITE_URI(bucketId), bucketId, folderId, path3, queryOptions);
43752
+ return this._getUri(BUCKET_ENDPOINTS.GET_WRITE_URI(bucketId), bucketId, path3, headers, queryOptions);
44305
43753
  }
44306
43754
  }
44307
43755
  __decorate([
@@ -44997,6 +44445,38 @@ var FeedbackStatus;
44997
44445
  FeedbackStatus2[FeedbackStatus2["Approved"] = 1] = "Approved";
44998
44446
  FeedbackStatus2[FeedbackStatus2["Dismissed"] = 2] = "Dismissed";
44999
44447
  })(FeedbackStatus || (FeedbackStatus = {}));
44448
+ var AgentListSortColumn;
44449
+ (function(AgentListSortColumn2) {
44450
+ AgentListSortColumn2["AgentName"] = "AgentName";
44451
+ AgentListSortColumn2["ParentProcess"] = "ParentProcess";
44452
+ AgentListSortColumn2["LastRun"] = "LastRun";
44453
+ AgentListSortColumn2["HealthScore"] = "HealthScore";
44454
+ AgentListSortColumn2["LastIncident"] = "LastIncident";
44455
+ AgentListSortColumn2["FolderName"] = "FolderName";
44456
+ AgentListSortColumn2["QuantityAGU"] = "QuantityAGU";
44457
+ AgentListSortColumn2["QuantityPLTU"] = "QuantityPLTU";
44458
+ AgentListSortColumn2["FolderPath"] = "FolderPath";
44459
+ })(AgentListSortColumn || (AgentListSortColumn = {}));
44460
+ var AgentErrorSortColumn;
44461
+ (function(AgentErrorSortColumn2) {
44462
+ AgentErrorSortColumn2["AgentId"] = "AgentId";
44463
+ AgentErrorSortColumn2["AgentName"] = "AgentName";
44464
+ AgentErrorSortColumn2["ParentProcessName"] = "ParentProcessName";
44465
+ AgentErrorSortColumn2["ErrorTitle"] = "ErrorTitle";
44466
+ AgentErrorSortColumn2["FirstSeenStartTime"] = "FirstSeenStartTime";
44467
+ AgentErrorSortColumn2["ExecutionCount"] = "ExecutionCount";
44468
+ AgentErrorSortColumn2["Type"] = "Type";
44469
+ AgentErrorSortColumn2["FirstSeenFolderName"] = "FirstSeenFolderName";
44470
+ AgentErrorSortColumn2["FirstSeenFolderPath"] = "FirstSeenFolderPath";
44471
+ AgentErrorSortColumn2["LastSeenStartTime"] = "LastSeenStartTime";
44472
+ AgentErrorSortColumn2["LastSeenFolderName"] = "LastSeenFolderName";
44473
+ AgentErrorSortColumn2["LastSeenFolderPath"] = "LastSeenFolderPath";
44474
+ })(AgentErrorSortColumn || (AgentErrorSortColumn = {}));
44475
+ var AgentMemoryExecutionType;
44476
+ (function(AgentMemoryExecutionType2) {
44477
+ AgentMemoryExecutionType2["Debug"] = "Debug";
44478
+ AgentMemoryExecutionType2["Runtime"] = "Runtime";
44479
+ })(AgentMemoryExecutionType || (AgentMemoryExecutionType = {}));
45000
44480
  var DocumentActionPriority;
45001
44481
  (function(DocumentActionPriority2) {
45002
44482
  DocumentActionPriority2["Low"] = "Low";
@@ -45218,6 +44698,73 @@ var ActionStatus;
45218
44698
  ActionStatus2["Pending"] = "Pending";
45219
44699
  ActionStatus2["Completed"] = "Completed";
45220
44700
  })(ActionStatus || (ActionStatus = {}));
44701
+ var PolicyEvaluationResult;
44702
+ (function(PolicyEvaluationResult2) {
44703
+ PolicyEvaluationResult2["Allow"] = "Allow";
44704
+ PolicyEvaluationResult2["Deny"] = "Deny";
44705
+ PolicyEvaluationResult2["SimulatedAllow"] = "SimulatedAllow";
44706
+ PolicyEvaluationResult2["SimulatedDeny"] = "SimulatedDeny";
44707
+ })(PolicyEvaluationResult || (PolicyEvaluationResult = {}));
44708
+ var SpanStatus;
44709
+ (function(SpanStatus2) {
44710
+ SpanStatus2["Unset"] = "Unset";
44711
+ SpanStatus2["Ok"] = "Ok";
44712
+ SpanStatus2["Error"] = "Error";
44713
+ SpanStatus2["Running"] = "Running";
44714
+ SpanStatus2["Restricted"] = "Restricted";
44715
+ SpanStatus2["Cancelled"] = "Cancelled";
44716
+ })(SpanStatus || (SpanStatus = {}));
44717
+ var SpanSource;
44718
+ (function(SpanSource2) {
44719
+ SpanSource2["Testing"] = "Testing";
44720
+ SpanSource2["Agents"] = "Agents";
44721
+ SpanSource2["ProcessOrchestration"] = "ProcessOrchestration";
44722
+ SpanSource2["ApiWorkflows"] = "ApiWorkflows";
44723
+ SpanSource2["Robots"] = "Robots";
44724
+ SpanSource2["ConversationalAgentsService"] = "ConversationalAgentsService";
44725
+ SpanSource2["IntegrationServiceTrigger"] = "IntegrationServiceTrigger";
44726
+ SpanSource2["Playground"] = "Playground";
44727
+ SpanSource2["Governance"] = "Governance";
44728
+ SpanSource2["IXPUnstructuredAndComplexDocuments"] = "IXPUnstructuredAndComplexDocuments";
44729
+ SpanSource2["CodedAgents"] = "CodedAgents";
44730
+ SpanSource2["IXPCommunicationsMining"] = "IXPCommunicationsMining";
44731
+ SpanSource2["EnterpriseContextService"] = "EnterpriseContextService";
44732
+ SpanSource2["MCP"] = "MCP";
44733
+ SpanSource2["A2A"] = "A2A";
44734
+ SpanSource2["Serverless"] = "Serverless";
44735
+ })(SpanSource || (SpanSource = {}));
44736
+ var SpanVerbosityLevel;
44737
+ (function(SpanVerbosityLevel2) {
44738
+ SpanVerbosityLevel2["Verbose"] = "Verbose";
44739
+ SpanVerbosityLevel2["Trace"] = "Trace";
44740
+ SpanVerbosityLevel2["Information"] = "Information";
44741
+ SpanVerbosityLevel2["Warning"] = "Warning";
44742
+ SpanVerbosityLevel2["Error"] = "Error";
44743
+ SpanVerbosityLevel2["Critical"] = "Critical";
44744
+ SpanVerbosityLevel2["Off"] = "Off";
44745
+ })(SpanVerbosityLevel || (SpanVerbosityLevel = {}));
44746
+ var SpanExecutionType;
44747
+ (function(SpanExecutionType2) {
44748
+ SpanExecutionType2["Debug"] = "Debug";
44749
+ SpanExecutionType2["Runtime"] = "Runtime";
44750
+ })(SpanExecutionType || (SpanExecutionType = {}));
44751
+ var SpanPermissionStatus;
44752
+ (function(SpanPermissionStatus2) {
44753
+ SpanPermissionStatus2["Allow"] = "Allow";
44754
+ SpanPermissionStatus2["PartialBlock"] = "PartialBlock";
44755
+ SpanPermissionStatus2["Block"] = "Block";
44756
+ })(SpanPermissionStatus || (SpanPermissionStatus = {}));
44757
+ var SpanAttachmentProvider;
44758
+ (function(SpanAttachmentProvider2) {
44759
+ SpanAttachmentProvider2["Orchestrator"] = "Orchestrator";
44760
+ SpanAttachmentProvider2["LLMOps"] = "LLMOps";
44761
+ })(SpanAttachmentProvider || (SpanAttachmentProvider = {}));
44762
+ var SpanAttachmentDirection;
44763
+ (function(SpanAttachmentDirection2) {
44764
+ SpanAttachmentDirection2["None"] = "None";
44765
+ SpanAttachmentDirection2["In"] = "In";
44766
+ SpanAttachmentDirection2["Out"] = "Out";
44767
+ })(SpanAttachmentDirection || (SpanAttachmentDirection = {}));
45221
44768
 
45222
44769
  // src/utils/sdk-client.ts
45223
44770
  var createTasksClient = async (tenantOverride) => {
@@ -45673,3 +45220,5 @@ export {
45673
45220
  registerCommands,
45674
45221
  metadata
45675
45222
  };
45223
+
45224
+ //# debugId=D170E1CB2095B45D64756E2164756E21