@uipath/vertical-solutions-tool 1.202.0 → 1.202.1-preview.167

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.
@@ -6864,7 +6864,7 @@ var require_src6 = __commonJS(function(exports) {
6864
6864
  var package_default = {
6865
6865
  name: "@uipath/vertical-solutions-tool",
6866
6866
  license: "SEE LICENSE IN LICENSE.txt",
6867
- version: "1.202.0",
6867
+ version: "1.202.1-preview.167",
6868
6868
  description: "Scaffold and generate Vertical Solution projects.",
6869
6869
  private: false,
6870
6870
  repository: {
@@ -6909,7 +6909,7 @@ var package_default = {
6909
6909
  "@uipath/auth": "workspace:*",
6910
6910
  "@uipath/common": "workspace:*",
6911
6911
  "@uipath/filesystem": "workspace:*",
6912
- "@uipath/uipath-typescript": "^1.6.1",
6912
+ "@uipath/uipath-typescript": "^1.7.1",
6913
6913
  "@inquirer/prompts": "^8.3.2",
6914
6914
  "@types/node": "^25.5.2",
6915
6915
  commander: "^14.0.3",
@@ -32437,7 +32437,7 @@ var allowsEval2 = cached2(() => {
32437
32437
  return false;
32438
32438
  }
32439
32439
  });
32440
- function isPlainObject4(o) {
32440
+ function isPlainObject$1(o) {
32441
32441
  if (isObject2(o) === false)
32442
32442
  return false;
32443
32443
  const ctor = o.constructor;
@@ -32454,7 +32454,7 @@ function isPlainObject4(o) {
32454
32454
  return true;
32455
32455
  }
32456
32456
  function shallowClone2(o) {
32457
- if (isPlainObject4(o))
32457
+ if (isPlainObject$1(o))
32458
32458
  return { ...o };
32459
32459
  if (Array.isArray(o))
32460
32460
  return [...o];
@@ -32542,7 +32542,7 @@ function omit2(schema, mask) {
32542
32542
  return clone2(schema, def);
32543
32543
  }
32544
32544
  function extend2(schema, shape) {
32545
- if (!isPlainObject4(shape)) {
32545
+ if (!isPlainObject$1(shape)) {
32546
32546
  throw new Error("Invalid input to extend: expected a plain object");
32547
32547
  }
32548
32548
  const checks3 = schema._zod.def.checks;
@@ -32565,7 +32565,7 @@ function extend2(schema, shape) {
32565
32565
  return clone2(schema, def);
32566
32566
  }
32567
32567
  function safeExtend2(schema, shape) {
32568
- if (!isPlainObject4(shape)) {
32568
+ if (!isPlainObject$1(shape)) {
32569
32569
  throw new Error("Invalid input to safeExtend: expected a plain object");
32570
32570
  }
32571
32571
  const def = mergeDefs2(schema._zod.def, {
@@ -32902,6 +32902,7 @@ var string$1 = (params) => {
32902
32902
  const regex2 = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
32903
32903
  return new RegExp(`^${regex2}$`);
32904
32904
  };
32905
+ var boolean$1 = /^(?:true|false)$/i;
32905
32906
  var lowercase2 = /^[^A-Z]*$/;
32906
32907
  var uppercase2 = /^[^a-z]*$/;
32907
32908
  var $ZodCheck2 = /* @__PURE__ */ $constructor2("$ZodCheck", (inst, def) => {
@@ -33570,6 +33571,26 @@ var $ZodJWT2 = /* @__PURE__ */ $constructor2("$ZodJWT", (inst, def) => {
33570
33571
  });
33571
33572
  };
33572
33573
  });
33574
+ var $ZodBoolean2 = /* @__PURE__ */ $constructor2("$ZodBoolean", (inst, def) => {
33575
+ $ZodType2.init(inst, def);
33576
+ inst._zod.pattern = boolean$1;
33577
+ inst._zod.parse = (payload, _ctx) => {
33578
+ if (def.coerce)
33579
+ try {
33580
+ payload.value = Boolean(payload.value);
33581
+ } catch (_) {}
33582
+ const input = payload.value;
33583
+ if (typeof input === "boolean")
33584
+ return payload;
33585
+ payload.issues.push({
33586
+ expected: "boolean",
33587
+ code: "invalid_type",
33588
+ input,
33589
+ inst
33590
+ });
33591
+ return payload;
33592
+ };
33593
+ });
33573
33594
  var $ZodUnknown2 = /* @__PURE__ */ $constructor2("$ZodUnknown", (inst, def) => {
33574
33595
  $ZodType2.init(inst, def);
33575
33596
  inst._zod.parse = (payload) => payload;
@@ -33940,7 +33961,7 @@ function mergeValues2(a, b) {
33940
33961
  if (a instanceof Date && b instanceof Date && +a === +b) {
33941
33962
  return { valid: true, data: a };
33942
33963
  }
33943
- if (isPlainObject4(a) && isPlainObject4(b)) {
33964
+ if (isPlainObject$1(a) && isPlainObject$1(b)) {
33944
33965
  const bKeys = Object.keys(b);
33945
33966
  const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
33946
33967
  const newObj = { ...a, ...b };
@@ -34295,7 +34316,7 @@ function handleRefineResult2(result, payload, input, inst) {
34295
34316
  payload.issues.push(issue2(_iss));
34296
34317
  }
34297
34318
  }
34298
- var _a3;
34319
+ var _a$1;
34299
34320
 
34300
34321
  class $ZodRegistry2 {
34301
34322
  constructor() {
@@ -34340,7 +34361,7 @@ class $ZodRegistry2 {
34340
34361
  function registry3() {
34341
34362
  return new $ZodRegistry2;
34342
34363
  }
34343
- (_a3 = globalThis).__zod_globalRegistry ?? (_a3.__zod_globalRegistry = registry3());
34364
+ (_a$1 = globalThis).__zod_globalRegistry ?? (_a$1.__zod_globalRegistry = registry3());
34344
34365
  var globalRegistry2 = globalThis.__zod_globalRegistry;
34345
34366
  function _string2(Class2, params) {
34346
34367
  return new Class2({
@@ -34585,6 +34606,12 @@ function _isoDuration2(Class2, params) {
34585
34606
  ...normalizeParams2(params)
34586
34607
  });
34587
34608
  }
34609
+ function _boolean2(Class2, params) {
34610
+ return new Class2({
34611
+ type: "boolean",
34612
+ ...normalizeParams2(params)
34613
+ });
34614
+ }
34588
34615
  function _unknown2(Class2) {
34589
34616
  return new Class2({
34590
34617
  type: "unknown"
@@ -34750,7 +34777,7 @@ function initializeContext2(params) {
34750
34777
  };
34751
34778
  }
34752
34779
  function process13(schema, ctx, _params = { path: [], schemaPath: [] }) {
34753
- var _a4;
34780
+ var _a3;
34754
34781
  const def = schema._zod.def;
34755
34782
  const seen = ctx.seen.get(schema);
34756
34783
  if (seen) {
@@ -34798,7 +34825,7 @@ function process13(schema, ctx, _params = { path: [], schemaPath: [] }) {
34798
34825
  delete result.schema.default;
34799
34826
  }
34800
34827
  if (ctx.io === "input" && result.schema._prefault)
34801
- (_a4 = result.schema).default ?? (_a4.default = result.schema._prefault);
34828
+ (_a3 = result.schema).default ?? (_a3.default = result.schema._prefault);
34802
34829
  delete result.schema._prefault;
34803
34830
  const _result = ctx.seen.get(schema);
34804
34831
  return _result.schema;
@@ -35115,6 +35142,9 @@ var stringProcessor2 = (schema, ctx, _json, _params) => {
35115
35142
  }
35116
35143
  }
35117
35144
  };
35145
+ var booleanProcessor2 = (_schema, _ctx, json2, _params) => {
35146
+ json2.type = "boolean";
35147
+ };
35118
35148
  var neverProcessor2 = (_schema, _ctx, json2, _params) => {
35119
35149
  json2.not = {};
35120
35150
  };
@@ -35573,6 +35603,14 @@ var ZodJWT2 = /* @__PURE__ */ $constructor2("ZodJWT", (inst, def) => {
35573
35603
  $ZodJWT2.init(inst, def);
35574
35604
  ZodStringFormat2.init(inst, def);
35575
35605
  });
35606
+ var ZodBoolean2 = /* @__PURE__ */ $constructor2("ZodBoolean", (inst, def) => {
35607
+ $ZodBoolean2.init(inst, def);
35608
+ ZodType2.init(inst, def);
35609
+ inst._zod.processJSONSchema = (ctx, json2, params) => booleanProcessor2(inst, ctx, json2);
35610
+ });
35611
+ function boolean4(params) {
35612
+ return _boolean2(ZodBoolean2, params);
35613
+ }
35576
35614
  var ZodUnknown2 = /* @__PURE__ */ $constructor2("ZodUnknown", (inst, def) => {
35577
35615
  $ZodUnknown2.init(inst, def);
35578
35616
  ZodType2.init(inst, def);
@@ -35883,7 +35921,8 @@ object2({
35883
35921
  secret: string4().optional(),
35884
35922
  clientId: string4().optional(),
35885
35923
  redirectUri: string4().url().optional(),
35886
- scope: string4().optional()
35924
+ scope: string4().optional(),
35925
+ enforceSso: boolean4().optional()
35887
35926
  });
35888
35927
 
35889
35928
  class UiPathConfig {
@@ -35895,6 +35934,7 @@ class UiPathConfig {
35895
35934
  this.clientId = options.clientId;
35896
35935
  this.redirectUri = options.redirectUri;
35897
35936
  this.scope = options.scope;
35937
+ this.enforceSso = options.enforceSso;
35898
35938
  }
35899
35939
  }
35900
35940
 
@@ -36097,6 +36137,7 @@ var TaskType;
36097
36137
  TaskType2["DocumentValidation"] = "DocumentValidationTask";
36098
36138
  TaskType2["DocumentClassification"] = "DocumentClassificationTask";
36099
36139
  TaskType2["DataLabeling"] = "DataLabelingTask";
36140
+ TaskType2["QuickForm"] = "QuickFormTask";
36100
36141
  })(TaskType || (TaskType = {}));
36101
36142
  var TaskPriority;
36102
36143
  (function(TaskPriority2) {
@@ -36209,7 +36250,11 @@ var PROCESS_ENDPOINTS = {
36209
36250
  var QUEUE_ENDPOINTS = {
36210
36251
  GET_BY_FOLDER: `${ORCHESTRATOR_BASE}/odata/QueueDefinitions`,
36211
36252
  GET_ALL: `${ORCHESTRATOR_BASE}/odata/QueueDefinitions/UiPath.Server.Configuration.OData.GetQueuesAcrossFolders`,
36212
- GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/QueueDefinitions(${id})`
36253
+ GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/QueueDefinitions(${id})`,
36254
+ GET_ITEMS: `${ORCHESTRATOR_BASE}/odata/QueueItems`,
36255
+ ADD_ITEM: `${ORCHESTRATOR_BASE}/odata/Queues/UiPathODataSvc.AddQueueItem`,
36256
+ START_TRANSACTION: `${ORCHESTRATOR_BASE}/odata/Queues/UiPathODataSvc.StartTransaction`,
36257
+ SET_TRANSACTION_RESULT: (itemId) => `${ORCHESTRATOR_BASE}/odata/Queues(${itemId})/UiPathODataSvc.SetTransactionResult`
36213
36258
  };
36214
36259
  var JOB_ENDPOINTS = {
36215
36260
  GET_ALL: `${ORCHESTRATOR_BASE}/odata/Jobs`,
@@ -36256,6 +36301,10 @@ var MAESTRO_ENDPOINTS = {
36256
36301
  TRACES: {
36257
36302
  GET_SPANS: (traceId) => `${LLMOPS_BASE}/api/Traces/spans?traceId=${traceId}`
36258
36303
  },
36304
+ BUSINESS_APPS: {
36305
+ COLLECTION: `${PIMS_BASE}/api/v1/business-apps`,
36306
+ BY_ID: (businessAppId) => `${PIMS_BASE}/api/v1/business-apps/${businessAppId}`
36307
+ },
36259
36308
  CASES: {
36260
36309
  GET_CASE_JSON: (instanceId) => `${PIMS_BASE}/api/v1/cases/${instanceId}/case-json`,
36261
36310
  GET_ELEMENT_EXECUTIONS: (instanceId) => `${PIMS_BASE}/api/v1/element-executions/case-instances/${instanceId}`,
@@ -36290,13 +36339,24 @@ var DATA_FABRIC_ENDPOINTS = {
36290
36339
  DELETE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/delete-batch`,
36291
36340
  UPSERT: `${DATAFABRIC_BASE}/api/Entity`,
36292
36341
  DELETE: (entityId) => `${DATAFABRIC_BASE}/api/Entity/${entityId}`,
36293
- UPDATE_METADATA: (entityId) => `${DATAFABRIC_BASE}/api/Entity/${entityId}/metadata`,
36342
+ UPDATE: (entityId) => `${DATAFABRIC_BASE}/api/Entity/${entityId}/metadata`,
36294
36343
  QUERY_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/query`,
36295
36344
  QUERY_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/query`,
36296
36345
  BULK_UPLOAD_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/bulk-upload`,
36297
36346
  DOWNLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
36298
36347
  UPLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
36299
- DELETE_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`
36348
+ DELETE_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
36349
+ GET_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/Entity/${entityName}/metadata`,
36350
+ GET_ENTITY_RECORDS_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/read`,
36351
+ GET_RECORD_BY_NAME: (entityName, recordId) => `${DATAFABRIC_BASE}/api/v2/EntityService/${entityName}/read/${recordId}`,
36352
+ INSERT_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/insert`,
36353
+ BATCH_INSERT_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/insert-batch`,
36354
+ UPDATE_RECORD_BY_NAME: (entityName, recordId) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/update/${recordId}`,
36355
+ UPDATE_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/update-batch`,
36356
+ DELETE_RECORD_BY_NAME: (entityName, recordId) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/delete/${recordId}`,
36357
+ DELETE_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/delete-batch`,
36358
+ BULK_UPLOAD_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/bulk-upload`,
36359
+ ATTACHMENT_BY_NAME: (entityName, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/${entityName}/${recordId}/${fieldName}`
36300
36360
  },
36301
36361
  CHOICESETS: {
36302
36362
  GET_ALL: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
@@ -36319,7 +36379,8 @@ var DATA_FABRIC_ENDPOINTS = {
36319
36379
  };
36320
36380
  var IDENTITY_ENDPOINTS = {
36321
36381
  TOKEN: `${IDENTITY_BASE}/connect/token`,
36322
- AUTHORIZE: `${IDENTITY_BASE}/connect/authorize`
36382
+ AUTHORIZE: `${IDENTITY_BASE}/connect/authorize`,
36383
+ END_SESSION: `${IDENTITY_BASE}/connect/endsession`
36323
36384
  };
36324
36385
  var TASK_TYPE_ENDPOINTS = {
36325
36386
  [TaskType.Form]: TASK_ENDPOINTS.GET_TASK_FORM_BY_ID,
@@ -36327,7 +36388,8 @@ var TASK_TYPE_ENDPOINTS = {
36327
36388
  [TaskType.DocumentValidation]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
36328
36389
  [TaskType.DocumentClassification]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
36329
36390
  [TaskType.External]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
36330
- [TaskType.DataLabeling]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID
36391
+ [TaskType.DataLabeling]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
36392
+ [TaskType.QuickForm]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID
36331
36393
  };
36332
36394
  var ActionCenterEventNames;
36333
36395
  (function(ActionCenterEventNames2) {
@@ -36335,29 +36397,12 @@ var ActionCenterEventNames;
36335
36397
  ActionCenterEventNames2["REFRESHTOKEN"] = "AC.refreshToken";
36336
36398
  })(ActionCenterEventNames || (ActionCenterEventNames = {}));
36337
36399
  var AUTHENTICATION_TIMEOUT = 8000;
36338
- var ALLOWED_HOST_ORIGINS = new Set([
36339
- "https://alpha.uipath.com",
36340
- "https://staging.uipath.com",
36341
- "https://cloud.uipath.com"
36342
- ]);
36343
- function isValidHostOrigin(origin) {
36344
- if (!origin)
36345
- return false;
36346
- if (ALLOWED_HOST_ORIGINS.has(origin))
36347
- return true;
36348
- try {
36349
- return new URL(origin).hostname === "localhost";
36350
- } catch {
36351
- console.warn("isValidHostOrigin: received a malformed origin URL", origin);
36352
- return false;
36353
- }
36354
- }
36355
36400
  function isTokenExpired(tokenInfo) {
36356
36401
  if (!tokenInfo?.expiresAt)
36357
36402
  return true;
36358
36403
  return new Date >= tokenInfo.expiresAt;
36359
36404
  }
36360
- var trustedEmbeddingOrigin = isHostEmbedded && embeddingOrigin && isValidHostOrigin(embeddingOrigin) ? embeddingOrigin : null;
36405
+ var hostEmbeddingOrigin = isHostEmbedded && embeddingOrigin ? embeddingOrigin : null;
36361
36406
  function waitForMessage(filter, signal) {
36362
36407
  return new Promise((resolve2, reject) => {
36363
36408
  const handler = (event) => {
@@ -36426,12 +36471,6 @@ class ActionCenterTokenManager {
36426
36471
  statusCode: HttpStatus.UNAUTHORIZED
36427
36472
  }));
36428
36473
  }
36429
- if (!isValidHostOrigin(parentOrigin)) {
36430
- return Promise.reject(new AuthenticationError({
36431
- message: "Cannot refresh token: basedomain is not a trusted UiPath host origin",
36432
- statusCode: HttpStatus.UNAUTHORIZED
36433
- }));
36434
- }
36435
36474
  const { promise: promise2 } = requestHostToken({
36436
36475
  pinnedOrigin: parentOrigin,
36437
36476
  sendRequest: () => this.sendMessageToParent(ActionCenterEventNames.REFRESHTOKEN, {
@@ -36455,7 +36494,7 @@ class ActionCenterTokenManager {
36455
36494
  }
36456
36495
  }
36457
36496
  sendMessageToParent(eventType, content) {
36458
- if (window.parent && isValidHostOrigin(this.parentOrigin)) {
36497
+ if (window.parent && this.parentOrigin) {
36459
36498
  try {
36460
36499
  window.parent.postMessage({ eventType, content }, this.parentOrigin);
36461
36500
  } catch (error52) {
@@ -36535,7 +36574,7 @@ class EmbeddedTokenManager {
36535
36574
  this.cancelRefresh?.();
36536
36575
  }
36537
36576
  }
36538
- var SDK_VERSION = "1.6.1";
36577
+ var SDK_VERSION = "1.7.1";
36539
36578
  var CLOUD_ROLE_NAME = "uipath-ts-sdk";
36540
36579
  var SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
36541
36580
  var SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
@@ -36601,19 +36640,21 @@ function base64UrlToBase64(value) {
36601
36640
  const base644 = value.replace(BASE64URL_DASH_RE, "+").replace(BASE64URL_UNDERSCORE_RE, "/");
36602
36641
  return base644.padEnd(base644.length + (4 - base644.length % 4) % 4, "=");
36603
36642
  }
36604
- function extractUserIdFromToken(token) {
36643
+ function decodeJwtClaims(token) {
36605
36644
  try {
36606
- const payload = token.split(".")[1];
36645
+ const payload = token?.split(".")[1];
36607
36646
  if (!payload) {
36608
- return "";
36647
+ return;
36609
36648
  }
36610
- const claims = JSON.parse(decodeBase64(base64UrlToBase64(payload)));
36611
- const sub = claims["sub"];
36612
- return typeof sub === "string" && sub ? sub : "";
36649
+ return JSON.parse(decodeBase64(base64UrlToBase64(payload)));
36613
36650
  } catch {
36614
- return "";
36651
+ return;
36615
36652
  }
36616
36653
  }
36654
+ function extractUserIdFromToken(token) {
36655
+ const sub = decodeJwtClaims(token)?.["sub"];
36656
+ return typeof sub === "string" && sub ? sub : "";
36657
+ }
36617
36658
 
36618
36659
  class TokenManager {
36619
36660
  constructor(executionContext, config3, isOAuth = false) {
@@ -36626,8 +36667,8 @@ class TokenManager {
36626
36667
  if (isInActionCenter) {
36627
36668
  this.actionCenterTokenManager = new ActionCenterTokenManager(config3, (tokenInfo) => this.setToken(tokenInfo));
36628
36669
  this.isOAuth = false;
36629
- } else if (trustedEmbeddingOrigin) {
36630
- this.embeddedTokenManager = new EmbeddedTokenManager(trustedEmbeddingOrigin, config3, (tokenInfo) => this.setToken(tokenInfo));
36670
+ } else if (hostEmbeddingOrigin) {
36671
+ this.embeddedTokenManager = new EmbeddedTokenManager(hostEmbeddingOrigin, config3, (tokenInfo) => this.setToken(tokenInfo));
36631
36672
  this.isOAuth = false;
36632
36673
  }
36633
36674
  }
@@ -36738,6 +36779,9 @@ class TokenManager {
36738
36779
  getToken() {
36739
36780
  return this.currentToken?.token;
36740
36781
  }
36782
+ getIdToken() {
36783
+ return this.currentToken?.idToken;
36784
+ }
36741
36785
  hasValidToken() {
36742
36786
  if (!this.currentToken) {
36743
36787
  return false;
@@ -36809,11 +36853,13 @@ class TokenManager {
36809
36853
  token: token.access_token,
36810
36854
  type: "oauth",
36811
36855
  expiresAt: new Date(Date.now() + token.expires_in * 1000),
36812
- refreshToken: token.refresh_token
36856
+ refreshToken: token.refresh_token,
36857
+ idToken: token.id_token ?? tokenInfo.idToken
36813
36858
  });
36814
36859
  return token;
36815
36860
  }
36816
36861
  }
36862
+ var GUID_REGEX$1 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
36817
36863
 
36818
36864
  class AuthService {
36819
36865
  constructor(config3, executionContext) {
@@ -36947,7 +36993,11 @@ class AuthService {
36947
36993
  hasValidToken() {
36948
36994
  return this.tokenManager.hasValidToken();
36949
36995
  }
36950
- logout() {
36996
+ logout(options) {
36997
+ const idTokenHint = options?.endSession ? this.tokenManager.getIdToken() : undefined;
36998
+ if (options?.endSession && isBrowser2 && !idTokenHint) {
36999
+ console.warn("endSession skipped — no OIDC ID token is available for this " + "session. Sign in again to enable it; only local authentication " + "state was cleared.");
37000
+ }
36951
37001
  this.tokenManager.clearToken();
36952
37002
  if (isBrowser2) {
36953
37003
  try {
@@ -36957,6 +37007,12 @@ class AuthService {
36957
37007
  console.warn("Failed to clear OAuth context from session storage", error52);
36958
37008
  }
36959
37009
  }
37010
+ if (options?.endSession && isBrowser2 && idTokenHint) {
37011
+ window.location.href = this._buildEndSessionUrl({
37012
+ idTokenHint,
37013
+ postLogoutRedirectUri: this.config.redirectUri
37014
+ });
37015
+ }
36960
37016
  }
36961
37017
  getToken() {
36962
37018
  if (!this.tokenManager.hasValidToken()) {
@@ -37000,10 +37056,27 @@ class AuthService {
37000
37056
  redirect_uri: params.redirectUri,
37001
37057
  code_challenge: params.codeChallenge,
37002
37058
  code_challenge_method: "S256",
37003
- scope: params.scope + " offline_access",
37059
+ scope: params.scope + " offline_access openid",
37004
37060
  state: params.state || this.generateCodeVerifier().slice(0, 16)
37005
37061
  });
37006
- return `${this.config.baseUrl}/${IDENTITY_ENDPOINTS.AUTHORIZE}?${queryParams.toString()}`;
37062
+ const authorizeUrl = `${this.config.baseUrl}/${IDENTITY_ENDPOINTS.AUTHORIZE}?${queryParams.toString()}`;
37063
+ if (!this.config.enforceSso) {
37064
+ return authorizeUrl;
37065
+ }
37066
+ const orgName = this.config.orgName;
37067
+ if (!GUID_REGEX$1.test(orgName)) {
37068
+ console.warn(`[UiPath SDK] enforceSso was ignored: orgName "${orgName}" is not an organization id. ` + "Pass the organization id (GUID) as orgName to sign in through the org's identity provider.");
37069
+ return authorizeUrl;
37070
+ }
37071
+ return `${authorizeUrl}&acr_values=${encodeURIComponent(`tenant:${orgName}`)}`;
37072
+ }
37073
+ _buildEndSessionUrl(params) {
37074
+ const queryParams = new URLSearchParams;
37075
+ queryParams.set("id_token_hint", params.idTokenHint);
37076
+ if (params.postLogoutRedirectUri) {
37077
+ queryParams.set("post_logout_redirect_uri", params.postLogoutRedirectUri);
37078
+ }
37079
+ return `${this.config.baseUrl}/${IDENTITY_ENDPOINTS.END_SESSION}?${queryParams.toString()}`;
37007
37080
  }
37008
37081
  async _getAccessToken(params) {
37009
37082
  const body = new URLSearchParams({
@@ -37030,7 +37103,8 @@ class AuthService {
37030
37103
  token: token.access_token,
37031
37104
  type: "oauth",
37032
37105
  expiresAt: token.expires_in ? new Date(Date.now() + token.expires_in * 1000) : undefined,
37033
- refreshToken: token.refresh_token
37106
+ refreshToken: token.refresh_token,
37107
+ idToken: token.id_token
37034
37108
  });
37035
37109
  return token;
37036
37110
  }
@@ -37103,9 +37177,18 @@ function validateConfig(config3) {
37103
37177
  function isCompleteConfig(config3) {
37104
37178
  return hasRequiredBaseFields(config3) && hasValidAuthConfig(config3);
37105
37179
  }
37180
+ function compactConfig(config3) {
37181
+ return Object.fromEntries(Object.entries(config3).filter(([, value]) => value !== undefined));
37182
+ }
37106
37183
  function normalizeBaseUrl2(url2) {
37107
37184
  return url2.endsWith("/") ? url2.slice(0, -1) : url2;
37108
37185
  }
37186
+ function missingConfigMessage() {
37187
+ if (isBrowser2) {
37188
+ return "UiPath SDK configuration not found. " + "Ensure @uipath/coded-apps plugin is set up in your bundler to inject configuration during development and build.";
37189
+ }
37190
+ return "UiPath SDK configuration not found. " + "In a UiPath coded function, pass the handler context: new UiPath(ctx). " + "Otherwise pass { baseUrl, orgName, tenantName, secret }, " + "or set UIPATH_BASE_URL, UIPATH_ORG_NAME, UIPATH_TENANT_NAME and UIPATH_ACCESS_TOKEN.";
37191
+ }
37109
37192
  var REGISTRY_KEY2 = Symbol.for("@uipath/sdk-internals-registry");
37110
37193
  var getGlobalStore = () => {
37111
37194
  const globalObj = globalThis;
@@ -37114,6 +37197,7 @@ var getGlobalStore = () => {
37114
37197
  }
37115
37198
  return globalObj[REGISTRY_KEY2];
37116
37199
  };
37200
+ var looksLikeUiPath = (instance) => typeof instance.initialize === "function";
37117
37201
 
37118
37202
  class SDKInternalsRegistry {
37119
37203
  static get store() {
@@ -37125,6 +37209,9 @@ class SDKInternalsRegistry {
37125
37209
  static get(instance) {
37126
37210
  const internals = this.store.get(instance);
37127
37211
  if (!internals) {
37212
+ if (looksLikeUiPath(instance)) {
37213
+ throw new Error("Cannot create a service: the UiPath instance was never configured. " + missingConfigMessage());
37214
+ }
37128
37215
  throw new Error("Invalid SDK instance. Make sure to pass a valid UiPath instance to the service constructor.");
37129
37216
  }
37130
37217
  return internals;
@@ -37142,6 +37229,10 @@ var UiPathMetaTags;
37142
37229
  UiPathMetaTags2["APP_BASE"] = "uipath:app-base";
37143
37230
  UiPathMetaTags2["FOLDER_KEY"] = "uipath:folder-key";
37144
37231
  })(UiPathMetaTags || (UiPathMetaTags = {}));
37232
+ var UiPathElementIds;
37233
+ (function(UiPathElementIds2) {
37234
+ UiPathElementIds2["RESOURCE_OVERRIDES"] = "uipath-overrides";
37235
+ })(UiPathElementIds || (UiPathElementIds = {}));
37145
37236
  function getMetaTagContent(name) {
37146
37237
  if (!isBrowser2)
37147
37238
  return;
@@ -37162,7 +37253,54 @@ function loadFromMetaTags() {
37162
37253
  const hasAnyValue = Object.values(config3).some(Boolean);
37163
37254
  return hasAnyValue ? config3 : null;
37164
37255
  }
37256
+ function readEnv(name) {
37257
+ const globals = globalThis;
37258
+ try {
37259
+ const fromNode = globals.process?.env?.[name];
37260
+ if (fromNode)
37261
+ return fromNode;
37262
+ } catch {}
37263
+ try {
37264
+ const fromDeno = globals.Deno?.env?.get?.(name);
37265
+ if (fromDeno)
37266
+ return fromDeno;
37267
+ } catch {}
37268
+ return;
37269
+ }
37270
+ var UiPathEnvVars = {
37271
+ BASE_URL: "UIPATH_BASE_URL",
37272
+ ORG_NAME: "UIPATH_ORG_NAME",
37273
+ TENANT_NAME: "UIPATH_TENANT_NAME",
37274
+ ACCESS_TOKEN: "UIPATH_ACCESS_TOKEN"
37275
+ };
37276
+ function loadFromEnvironment() {
37277
+ if (isBrowser2)
37278
+ return null;
37279
+ const config3 = {
37280
+ baseUrl: readEnv(UiPathEnvVars.BASE_URL),
37281
+ orgName: readEnv(UiPathEnvVars.ORG_NAME),
37282
+ tenantName: readEnv(UiPathEnvVars.TENANT_NAME),
37283
+ secret: readEnv(UiPathEnvVars.ACCESS_TOKEN)
37284
+ };
37285
+ return Object.values(config3).some(Boolean) ? config3 : null;
37286
+ }
37287
+ function isFunctionContext(value) {
37288
+ return "platform" in value || "robot" in value;
37289
+ }
37290
+ function configFromFunctionContext(context) {
37291
+ const { platform, robot } = context;
37292
+ if (!platform)
37293
+ return null;
37294
+ const config3 = {
37295
+ baseUrl: platform.baseUrl,
37296
+ orgName: platform.orgId,
37297
+ tenantName: platform.tenantId,
37298
+ secret: robot?.accessToken ?? undefined
37299
+ };
37300
+ return Object.values(config3).some(Boolean) ? config3 : null;
37301
+ }
37165
37302
  var _UiPath_instances;
37303
+ var _a3;
37166
37304
  var _UiPath_config;
37167
37305
  var _UiPath_authService;
37168
37306
  var _UiPath_initialized;
@@ -37171,6 +37309,7 @@ var _UiPath_metaFolderKey;
37171
37309
  var _UiPath_metaOrgId;
37172
37310
  var _UiPath_metaTenantId;
37173
37311
  var _UiPath_initializeWithConfig;
37312
+ var _UiPath_mergeConfigSources;
37174
37313
  var _UiPath_loadConfig;
37175
37314
  var UiPath$1 = class UiPath {
37176
37315
  constructor(config3) {
@@ -37182,15 +37321,16 @@ var UiPath$1 = class UiPath {
37182
37321
  _UiPath_metaFolderKey.set(this, undefined);
37183
37322
  _UiPath_metaOrgId.set(this, undefined);
37184
37323
  _UiPath_metaTenantId.set(this, undefined);
37324
+ const resolved = config3 && isFunctionContext(config3) ? configFromFunctionContext(config3) ?? undefined : config3;
37185
37325
  const configFromMetaTags = loadFromMetaTags();
37186
37326
  __classPrivateFieldSet(this, _UiPath_metaFolderKey, configFromMetaTags?.folderKey, "f");
37187
37327
  __classPrivateFieldSet(this, _UiPath_metaOrgId, configFromMetaTags?.orgName, "f");
37188
37328
  __classPrivateFieldSet(this, _UiPath_metaTenantId, configFromMetaTags?.tenantName, "f");
37189
- const mergedConfig = config3 ? { ...configFromMetaTags, ...config3 } : configFromMetaTags;
37329
+ const mergedConfig = __classPrivateFieldGet(_a3, _a3, "m", _UiPath_mergeConfigSources).call(_a3, configFromMetaTags, resolved);
37190
37330
  if (mergedConfig && isCompleteConfig(mergedConfig)) {
37191
37331
  __classPrivateFieldGet(this, _UiPath_instances, "m", _UiPath_initializeWithConfig).call(this, mergedConfig);
37192
- } else if (config3) {
37193
- __classPrivateFieldSet(this, _UiPath_partialConfig, config3, "f");
37332
+ } else if (resolved) {
37333
+ __classPrivateFieldSet(this, _UiPath_partialConfig, resolved, "f");
37194
37334
  }
37195
37335
  }
37196
37336
  async initialize() {
@@ -37255,18 +37395,18 @@ var UiPath$1 = class UiPath {
37255
37395
  destroy() {
37256
37396
  __classPrivateFieldGet(this, _UiPath_authService, "f")?.getTokenManager()?.destroy();
37257
37397
  }
37258
- logout() {
37398
+ logout(options) {
37259
37399
  if (__classPrivateFieldGet(this, _UiPath_config, "f") && hasSecretConfig(__classPrivateFieldGet(this, _UiPath_config, "f"))) {
37260
37400
  return;
37261
37401
  }
37262
- __classPrivateFieldGet(this, _UiPath_authService, "f")?.logout();
37402
+ __classPrivateFieldGet(this, _UiPath_authService, "f")?.logout(options);
37263
37403
  __classPrivateFieldSet(this, _UiPath_initialized, false, "f");
37264
37404
  }
37265
37405
  updateToken(tokenInfo) {
37266
37406
  __classPrivateFieldGet(this, _UiPath_authService, "f")?.updateToken(tokenInfo);
37267
37407
  }
37268
37408
  };
37269
- _UiPath_config = new WeakMap, _UiPath_authService = new WeakMap, _UiPath_initialized = new WeakMap, _UiPath_partialConfig = new WeakMap, _UiPath_metaFolderKey = new WeakMap, _UiPath_metaOrgId = new WeakMap, _UiPath_metaTenantId = new WeakMap, _UiPath_instances = new WeakSet, _UiPath_initializeWithConfig = function _UiPath_initializeWithConfig2(config3) {
37409
+ _a3 = UiPath$1, _UiPath_config = new WeakMap, _UiPath_authService = new WeakMap, _UiPath_initialized = new WeakMap, _UiPath_partialConfig = new WeakMap, _UiPath_metaFolderKey = new WeakMap, _UiPath_metaOrgId = new WeakMap, _UiPath_metaTenantId = new WeakMap, _UiPath_instances = new WeakSet, _UiPath_initializeWithConfig = function _UiPath_initializeWithConfig2(config3) {
37270
37410
  validateConfig(config3);
37271
37411
  const hasSecretAuth = hasSecretConfig(config3);
37272
37412
  const hasOAuthAuth = hasOAuthConfig(config3);
@@ -37277,7 +37417,8 @@ _UiPath_config = new WeakMap, _UiPath_authService = new WeakMap, _UiPath_initial
37277
37417
  secret: hasSecretAuth ? config3.secret : undefined,
37278
37418
  clientId: hasOAuthAuth ? config3.clientId : undefined,
37279
37419
  redirectUri: hasOAuthAuth ? config3.redirectUri : undefined,
37280
- scope: hasOAuthAuth ? config3.scope : undefined
37420
+ scope: hasOAuthAuth ? config3.scope : undefined,
37421
+ enforceSso: config3.enforceSso
37281
37422
  });
37282
37423
  const executionContext = new ExecutionContext;
37283
37424
  __classPrivateFieldSet(this, _UiPath_authService, new AuthService(internalConfig, executionContext), "f");
@@ -37303,18 +37444,35 @@ _UiPath_config = new WeakMap, _UiPath_authService = new WeakMap, _UiPath_initial
37303
37444
  redirectUri: hasOAuthAuth ? config3.redirectUri : undefined
37304
37445
  });
37305
37446
  trackEvent("Sdk.Auth");
37306
- if (hasSecretAuth || isInActionCenter || trustedEmbeddingOrigin) {
37447
+ if (hasSecretAuth || isInActionCenter || hostEmbeddingOrigin) {
37307
37448
  __classPrivateFieldGet(this, _UiPath_authService, "f").authenticateWithSecret(config3.secret ?? "");
37308
37449
  __classPrivateFieldSet(this, _UiPath_initialized, true, "f");
37309
37450
  }
37451
+ }, _UiPath_mergeConfigSources = function _UiPath_mergeConfigSources2(metaConfig, config3) {
37452
+ const layers = [loadFromEnvironment(), metaConfig, config3].filter((layer) => Boolean(layer)).map((layer) => compactConfig(layer));
37453
+ if (layers.length === 0)
37454
+ return;
37455
+ const merged = layers.reduce((acc, layer) => ({ ...acc, ...layer }), {});
37456
+ const namesSecret = config3 ? hasSecretConfig(config3) : false;
37457
+ const namesOAuth = Boolean(config3?.clientId || config3?.redirectUri || config3?.scope);
37458
+ if (namesSecret !== namesOAuth) {
37459
+ if (namesSecret) {
37460
+ delete merged.clientId;
37461
+ delete merged.redirectUri;
37462
+ delete merged.scope;
37463
+ } else {
37464
+ delete merged.secret;
37465
+ }
37466
+ }
37467
+ return merged;
37310
37468
  }, _UiPath_loadConfig = function _UiPath_loadConfig2() {
37311
37469
  const metaConfig = loadFromMetaTags();
37312
37470
  __classPrivateFieldSet(this, _UiPath_metaFolderKey, metaConfig?.folderKey, "f");
37313
37471
  __classPrivateFieldSet(this, _UiPath_metaOrgId, metaConfig?.orgName, "f");
37314
37472
  __classPrivateFieldSet(this, _UiPath_metaTenantId, metaConfig?.tenantName, "f");
37315
- const merged = { ...metaConfig, ...__classPrivateFieldGet(this, _UiPath_partialConfig, "f") };
37316
- if (!isCompleteConfig(merged)) {
37317
- 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.");
37473
+ const merged = __classPrivateFieldGet(_a3, _a3, "m", _UiPath_mergeConfigSources).call(_a3, metaConfig, __classPrivateFieldGet(this, _UiPath_partialConfig, "f"));
37474
+ if (!merged || !isCompleteConfig(merged)) {
37475
+ throw new Error(missingConfigMessage());
37318
37476
  }
37319
37477
  return merged;
37320
37478
  };
@@ -37492,8 +37650,177 @@ var RESPONSE_TYPES = {
37492
37650
  JSON: "json",
37493
37651
  TEXT: "text",
37494
37652
  BLOB: "blob",
37495
- ARRAYBUFFER: "arraybuffer"
37653
+ ARRAYBUFFER: "arraybuffer",
37654
+ STREAM: "stream"
37496
37655
  };
37656
+ function createParams(paramsObj = {}) {
37657
+ const params = {};
37658
+ for (const [key, value] of Object.entries(paramsObj)) {
37659
+ if (value !== undefined && value !== null) {
37660
+ params[key] = value;
37661
+ }
37662
+ }
37663
+ return params;
37664
+ }
37665
+ function toSearchParams(params) {
37666
+ const searchParams = new URLSearchParams;
37667
+ if (!params)
37668
+ return searchParams;
37669
+ for (const [key, value] of Object.entries(params)) {
37670
+ if (value === undefined || value === null)
37671
+ continue;
37672
+ if (Array.isArray(value)) {
37673
+ value.forEach((item) => {
37674
+ if (item !== undefined && item !== null)
37675
+ searchParams.append(key, String(item));
37676
+ });
37677
+ } else {
37678
+ searchParams.append(key, String(value));
37679
+ }
37680
+ }
37681
+ return searchParams;
37682
+ }
37683
+ var DEFAULT_RETRYABLE_STATUS_CODES = [408, 429, 500, 502, 503, 504];
37684
+ var DEFAULT_RETRY_METHODS = ["GET", "HEAD", "PUT", "DELETE", "OPTIONS"];
37685
+ var DEFAULT_RETRY_OPTIONS = {
37686
+ maxRetries: 2,
37687
+ initialDelayMs: 500,
37688
+ backoffStrategy: "exponential",
37689
+ backoffFactor: 2,
37690
+ backoffMaxDelayMs: 30000,
37691
+ retryableStatusCodes: DEFAULT_RETRYABLE_STATUS_CODES,
37692
+ retryMethods: DEFAULT_RETRY_METHODS,
37693
+ retryNetworkErrors: true,
37694
+ respectRetryAfter: true,
37695
+ maxRetryAfterMs: Infinity
37696
+ };
37697
+ var DEFAULT_API_CLIENT_RETRY = {
37698
+ ...DEFAULT_RETRY_OPTIONS,
37699
+ maxRetries: 0
37700
+ };
37701
+ function resolveRetryOptions(settings, defaults = DEFAULT_RETRY_OPTIONS) {
37702
+ if (!settings)
37703
+ return defaults;
37704
+ const { retryDelay, useExponentialBackoff, ...live } = settings;
37705
+ const resolved = { ...defaults };
37706
+ for (const [key, value] of Object.entries(live)) {
37707
+ if (value !== undefined) {
37708
+ resolved[key] = value;
37709
+ }
37710
+ }
37711
+ if (retryDelay !== undefined && live.initialDelayMs === undefined) {
37712
+ resolved.initialDelayMs = retryDelay;
37713
+ }
37714
+ if (useExponentialBackoff !== undefined && live.backoffStrategy === undefined) {
37715
+ resolved.backoffStrategy = useExponentialBackoff ? "exponential" : "constant";
37716
+ }
37717
+ return resolved;
37718
+ }
37719
+ function computeBackoffDelay(attempt, settings) {
37720
+ const base = Math.max(0, settings.initialDelayMs);
37721
+ let delay;
37722
+ switch (settings.backoffStrategy) {
37723
+ case "constant":
37724
+ delay = base;
37725
+ break;
37726
+ case "linear":
37727
+ delay = base * (attempt + 1);
37728
+ break;
37729
+ default:
37730
+ delay = base * Math.pow(settings.backoffFactor, attempt);
37731
+ }
37732
+ return Math.min(delay, settings.backoffMaxDelayMs);
37733
+ }
37734
+ function parseRetryAfter(value, now = Date.now()) {
37735
+ const trimmed = value?.trim();
37736
+ if (!trimmed)
37737
+ return;
37738
+ const seconds = Number(trimmed);
37739
+ if (Number.isFinite(seconds))
37740
+ return Math.max(0, seconds * 1000);
37741
+ const date6 = Date.parse(trimmed);
37742
+ if (Number.isNaN(date6))
37743
+ return;
37744
+ return Math.max(0, date6 - now);
37745
+ }
37746
+ function wait(durationMs) {
37747
+ return new Promise((resolve2) => setTimeout(resolve2, Math.max(0, durationMs)));
37748
+ }
37749
+ var RETRY_AFTER = "retry-after";
37750
+ function createAttemptSignal(timeoutMs, external2) {
37751
+ if (timeoutMs === undefined || !Number.isFinite(timeoutMs))
37752
+ return { signal: external2, dispose: () => {} };
37753
+ const controller = new AbortController;
37754
+ const timer = setTimeout(() => controller.abort(new Error(`Request timeout after ${timeoutMs}ms`)), timeoutMs);
37755
+ const onExternalAbort = () => controller.abort(external2?.reason);
37756
+ if (external2) {
37757
+ if (external2.aborted) {
37758
+ controller.abort(external2.reason);
37759
+ } else {
37760
+ external2.addEventListener("abort", onExternalAbort);
37761
+ }
37762
+ }
37763
+ return {
37764
+ signal: controller.signal,
37765
+ dispose: () => {
37766
+ clearTimeout(timer);
37767
+ external2?.removeEventListener("abort", onExternalAbort);
37768
+ }
37769
+ };
37770
+ }
37771
+ function delayBeforeRetry(durationMs, signal) {
37772
+ if (!signal)
37773
+ return wait(durationMs);
37774
+ if (signal.aborted)
37775
+ return Promise.reject(signal.reason);
37776
+ return new Promise((resolve2, reject) => {
37777
+ const onAbort = () => {
37778
+ clearTimeout(timer);
37779
+ reject(signal.reason);
37780
+ };
37781
+ const timer = setTimeout(() => {
37782
+ signal.removeEventListener("abort", onAbort);
37783
+ resolve2();
37784
+ }, Math.max(0, durationMs));
37785
+ signal.addEventListener("abort", onAbort);
37786
+ });
37787
+ }
37788
+ async function fetchWithRetry(url2, init, options) {
37789
+ const settings = options.retry;
37790
+ const method = (init.method ?? "GET").toUpperCase();
37791
+ const retriesAllowed = settings.retryMethods.includes(method) ? Math.max(0, settings.maxRetries) : 0;
37792
+ let attempt = 0;
37793
+ for (;; ) {
37794
+ const { signal, dispose } = createAttemptSignal(options.timeoutMs, options.signal);
37795
+ let response;
37796
+ let failure;
37797
+ try {
37798
+ response = await fetch(url2, { ...init, signal });
37799
+ } catch (error52) {
37800
+ failure = error52;
37801
+ } finally {
37802
+ dispose();
37803
+ }
37804
+ if (options.signal?.aborted && failure !== undefined)
37805
+ throw failure;
37806
+ if (response && !settings.retryableStatusCodes.includes(response.status))
37807
+ return response;
37808
+ if (failure !== undefined && !settings.retryNetworkErrors)
37809
+ throw failure;
37810
+ if (attempt >= retriesAllowed) {
37811
+ if (response)
37812
+ return response;
37813
+ throw failure;
37814
+ }
37815
+ const retryAfter = settings.respectRetryAfter && response ? parseRetryAfter(response.headers.get(RETRY_AFTER)) : undefined;
37816
+ const delay = retryAfter !== undefined ? Math.min(retryAfter, settings.maxRetryAfterMs) : computeBackoffDelay(attempt, settings);
37817
+ response?.body?.cancel().catch((error52) => {
37818
+ console.warn("[UiPath SDK] Could not release a discarded response body:", error52);
37819
+ });
37820
+ await delayBeforeRetry(delay, options.signal);
37821
+ attempt++;
37822
+ }
37823
+ }
37497
37824
 
37498
37825
  class ApiClient {
37499
37826
  constructor(config3, executionContext, tokenManager, clientConfig = {}) {
@@ -37528,28 +37855,16 @@ class ApiClient {
37528
37855
  [UIPATH_TRACEPARENT_ID]: traceparentValue,
37529
37856
  ...options.headers
37530
37857
  };
37531
- const searchParams = new URLSearchParams;
37532
- if (options.params) {
37533
- Object.entries(options.params).forEach(([key, value]) => {
37534
- if (Array.isArray(value)) {
37535
- value.forEach((item) => searchParams.append(key, String(item)));
37536
- } else {
37537
- searchParams.append(key, String(value));
37538
- }
37539
- });
37540
- }
37858
+ const searchParams = toSearchParams(options.params);
37541
37859
  const fullUrl = searchParams.toString() ? `${url2}?${searchParams.toString()}` : url2;
37542
37860
  let body = undefined;
37543
37861
  if (options.body) {
37544
37862
  body = isFormData ? options.body : JSON.stringify(options.body);
37545
37863
  }
37864
+ const retrySettings = resolveRetryOptions(options.retry ?? options.retryOptions, DEFAULT_API_CLIENT_RETRY);
37865
+ const timeoutMs = options.timeoutMs ?? options.timeoutOptions?.timeout;
37546
37866
  try {
37547
- const response = await fetch(fullUrl, {
37548
- method,
37549
- headers,
37550
- body,
37551
- signal: options.signal
37552
- });
37867
+ const response = await fetchWithRetry(fullUrl, { method, headers, body }, { retry: retrySettings, timeoutMs, signal: options.signal });
37553
37868
  if (!response.ok) {
37554
37869
  const errorInfo = await errorResponseParser.parse(response);
37555
37870
  throw ErrorFactory.createFromHttpStatus(response.status, errorInfo);
@@ -38265,36 +38580,36 @@ function createEntityMethods(entityData, service) {
38265
38580
  async insertRecord(data, options) {
38266
38581
  if (!entityData.id)
38267
38582
  throw new Error("Entity ID is undefined");
38268
- return service.insertRecordById(entityData.id, data, options);
38583
+ return service.insertRecord({ id: entityData.id }, data, options);
38269
38584
  },
38270
38585
  async insertRecords(data, options) {
38271
38586
  if (!entityData.id)
38272
38587
  throw new Error("Entity ID is undefined");
38273
- return service.insertRecordsById(entityData.id, data, options);
38588
+ return service.insertRecords({ id: entityData.id }, data, options);
38274
38589
  },
38275
38590
  async updateRecord(recordId, data, options) {
38276
38591
  if (!entityData.id)
38277
38592
  throw new Error("Entity ID is undefined");
38278
38593
  if (!recordId)
38279
38594
  throw new Error("Record ID is undefined");
38280
- return service.updateRecordById(entityData.id, recordId, data, options);
38595
+ return service.updateRecord({ id: entityData.id }, recordId, data, options);
38281
38596
  },
38282
38597
  async updateRecords(data, options) {
38283
38598
  if (!entityData.id)
38284
38599
  throw new Error("Entity ID is undefined");
38285
- return service.updateRecordsById(entityData.id, data, options);
38600
+ return service.updateRecords({ id: entityData.id }, data, options);
38286
38601
  },
38287
38602
  async deleteRecords(recordIds, options) {
38288
38603
  if (!entityData.id)
38289
38604
  throw new Error("Entity ID is undefined");
38290
- return service.deleteRecordsById(entityData.id, recordIds, options);
38605
+ return service.deleteRecords({ id: entityData.id }, recordIds, options);
38291
38606
  },
38292
38607
  async deleteRecord(recordId, options) {
38293
38608
  if (!entityData.id)
38294
38609
  throw new Error("Entity ID is undefined");
38295
38610
  if (!recordId)
38296
38611
  throw new Error("Record ID is undefined");
38297
- return service.deleteRecordById(entityData.id, recordId, options);
38612
+ return service.deleteRecord({ id: entityData.id }, recordId, options);
38298
38613
  },
38299
38614
  async getAllRecords(options) {
38300
38615
  if (!entityData.id)
@@ -38311,27 +38626,27 @@ function createEntityMethods(entityData, service) {
38311
38626
  async downloadAttachment(recordId, fieldName, options) {
38312
38627
  if (!entityData.id)
38313
38628
  throw new Error("Entity ID is undefined");
38314
- return service.downloadAttachment(entityData.id, recordId, fieldName, options);
38629
+ return service.downloadAttachment({ id: entityData.id }, recordId, fieldName, options);
38315
38630
  },
38316
38631
  async uploadAttachment(recordId, fieldName, file2, options) {
38317
38632
  if (!entityData.id)
38318
38633
  throw new Error("Entity ID is undefined");
38319
- return service.uploadAttachment(entityData.id, recordId, fieldName, file2, options);
38634
+ return service.uploadAttachment({ id: entityData.id }, recordId, fieldName, file2, options);
38320
38635
  },
38321
38636
  async deleteAttachment(recordId, fieldName, options) {
38322
38637
  if (!entityData.id)
38323
38638
  throw new Error("Entity ID is undefined");
38324
- return service.deleteAttachment(entityData.id, recordId, fieldName, options);
38639
+ return service.deleteAttachment({ id: entityData.id }, recordId, fieldName, options);
38325
38640
  },
38326
38641
  async queryRecords(options) {
38327
38642
  if (!entityData.id)
38328
38643
  throw new Error("Entity ID is undefined");
38329
- return service.queryRecordsById(entityData.id, options);
38644
+ return service.queryRecords({ id: entityData.id }, options);
38330
38645
  },
38331
38646
  async importRecords(file2, options) {
38332
38647
  if (!entityData.id)
38333
38648
  throw new Error("Entity ID is undefined");
38334
- return service.importRecordsById(entityData.id, file2, options);
38649
+ return service.importRecords({ id: entityData.id }, file2, options);
38335
38650
  },
38336
38651
  async insert(data, options) {
38337
38652
  return this.insertRecord(data, options);
@@ -38407,6 +38722,15 @@ var EntityAggregateFunction;
38407
38722
  EntityAggregateFunction2["Min"] = "MIN";
38408
38723
  EntityAggregateFunction2["Max"] = "MAX";
38409
38724
  })(EntityAggregateFunction || (EntityAggregateFunction = {}));
38725
+ var EntityHavingOperator;
38726
+ (function(EntityHavingOperator2) {
38727
+ EntityHavingOperator2["Equals"] = "=";
38728
+ EntityHavingOperator2["NotEquals"] = "!=";
38729
+ EntityHavingOperator2["GreaterThan"] = ">";
38730
+ EntityHavingOperator2["GreaterThanOrEqual"] = ">=";
38731
+ EntityHavingOperator2["LessThan"] = "<";
38732
+ EntityHavingOperator2["LessThanOrEqual"] = "<=";
38733
+ })(EntityHavingOperator || (EntityHavingOperator = {}));
38410
38734
  var EntityType;
38411
38735
  (function(EntityType2) {
38412
38736
  EntityType2["Entity"] = "Entity";
@@ -38437,15 +38761,6 @@ var JoinType;
38437
38761
  JoinType2["LeftJoin"] = "LeftJoin";
38438
38762
  JoinType2["InnerJoin"] = "InnerJoin";
38439
38763
  })(JoinType || (JoinType = {}));
38440
- function createParams(paramsObj = {}) {
38441
- const params = {};
38442
- for (const [key, value] of Object.entries(paramsObj)) {
38443
- if (value !== undefined && value !== null) {
38444
- params[key] = value;
38445
- }
38446
- }
38447
- return params;
38448
- }
38449
38764
  var EntityFieldConstraint;
38450
38765
  (function(EntityFieldConstraint2) {
38451
38766
  EntityFieldConstraint2["LengthLimit"] = "lengthLimit";
@@ -38584,95 +38899,84 @@ function toWireJoin(join2, baseEntityName) {
38584
38899
  }
38585
38900
  };
38586
38901
  }
38902
+ function unwrapEntityRef(entityRef, callerLabel) {
38903
+ const { id, name } = entityRef ?? {};
38904
+ if (id && name) {
38905
+ throw new ValidationError3({
38906
+ message: `${callerLabel}: entityRef must supply exactly one of 'id' or 'name', not both.`
38907
+ });
38908
+ }
38909
+ if (id) {
38910
+ return { byId: true, identifier: id };
38911
+ }
38912
+ if (name) {
38913
+ return { byId: false, identifier: name };
38914
+ }
38915
+ throw new ValidationError3({
38916
+ message: `${callerLabel}: entityRef must supply exactly one of 'id' or 'name'.`
38917
+ });
38918
+ }
38587
38919
 
38588
38920
  class EntityService extends BaseService {
38589
38921
  async getById(id, options) {
38590
- const response = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_ID(id), { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
38591
- const metadata = transformData(response.data, EntityMap);
38592
- this.applyFieldMappings(metadata);
38593
- return createEntityWithMethods(metadata, this);
38922
+ return this.fetchEntityMetadata(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_ID(id), options?.folderKey);
38923
+ }
38924
+ async getByName(entityName, options) {
38925
+ return this.fetchEntityMetadata(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_NAME(entityName), options?.folderKey);
38594
38926
  }
38595
38927
  async getAllRecords(entityId, options) {
38596
- const { folderKey, ...rest } = options ?? {};
38597
- const downstreamOptions = options === undefined ? undefined : rest;
38598
- return PaginationHelpers.getAll({
38599
- serviceAccess: this.createPaginationServiceAccess(),
38600
- getEndpoint: () => DATA_FABRIC_ENDPOINTS.ENTITY.GET_ENTITY_RECORDS(entityId),
38601
- headers: createHeaders({ [FOLDER_KEY]: folderKey }),
38602
- pagination: {
38603
- paginationType: PaginationType.OFFSET,
38604
- itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
38605
- totalCountField: ENTITY_PAGINATION.TOTAL_COUNT_FIELD,
38606
- paginationParams: {
38607
- pageSizeParam: ENTITY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
38608
- offsetParam: ENTITY_OFFSET_PARAMS.OFFSET_PARAM,
38609
- countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
38610
- }
38611
- },
38612
- excludeFromPrefix: ["expansionLevel"]
38613
- }, downstreamOptions);
38928
+ return this.getRecordsImpl(true, entityId, options);
38929
+ }
38930
+ async getRecordsByName(entityName, options) {
38931
+ return this.getRecordsImpl(false, entityName, options);
38614
38932
  }
38615
38933
  async getRecordById(entityId, recordId, options = {}) {
38616
- const params = createParams({
38617
- expansionLevel: options.expansionLevel
38618
- });
38619
- const response = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.GET_RECORD_BY_ID(entityId, recordId), { params, headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
38620
- return response.data;
38934
+ return this.getRecordImpl(true, entityId, recordId, options);
38935
+ }
38936
+ async getRecordByName(entityName, recordId, options = {}) {
38937
+ return this.getRecordImpl(false, entityName, recordId, options);
38938
+ }
38939
+ async insertRecord(entityRef, data, options = {}) {
38940
+ const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.insertRecord");
38941
+ return this.insertRecordImpl(byId, identifier, data, options);
38621
38942
  }
38622
38943
  async insertRecordById(id, data, options = {}) {
38623
- const params = createParams({
38624
- expansionLevel: options.expansionLevel
38625
- });
38626
- const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.INSERT_BY_ID(id), data, {
38627
- params,
38628
- headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
38629
- });
38630
- return response.data;
38944
+ return this.insertRecordImpl(true, id, data, options);
38945
+ }
38946
+ async insertRecords(entityRef, data, options = {}) {
38947
+ const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.insertRecords");
38948
+ return this.insertRecordsImpl(byId, identifier, data, options);
38631
38949
  }
38632
38950
  async insertRecordsById(id, data, options = {}) {
38633
- const params = createParams({
38634
- expansionLevel: options.expansionLevel,
38635
- failOnFirst: options.failOnFirst
38636
- });
38637
- const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.BATCH_INSERT_BY_ID(id), data, {
38638
- params,
38639
- headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
38640
- });
38641
- return response.data;
38951
+ return this.insertRecordsImpl(true, id, data, options);
38952
+ }
38953
+ async updateRecord(entityRef, recordId, data, options = {}) {
38954
+ const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.updateRecord");
38955
+ return this.updateRecordImpl(byId, identifier, recordId, data, options);
38642
38956
  }
38643
38957
  async updateRecordById(entityId, recordId, data, options = {}) {
38644
- const params = createParams({
38645
- expansionLevel: options.expansionLevel
38646
- });
38647
- const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_RECORD_BY_ID(entityId, recordId), data, {
38648
- params,
38649
- headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
38650
- });
38651
- return response.data;
38958
+ return this.updateRecordImpl(true, entityId, recordId, data, options);
38959
+ }
38960
+ async updateRecords(entityRef, data, options = {}) {
38961
+ const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.updateRecords");
38962
+ return this.updateRecordsImpl(byId, identifier, data, options);
38652
38963
  }
38653
38964
  async updateRecordsById(id, data, options = {}) {
38654
- const params = createParams({
38655
- expansionLevel: options.expansionLevel,
38656
- failOnFirst: options.failOnFirst
38657
- });
38658
- const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_BY_ID(id), data, {
38659
- params,
38660
- headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
38661
- });
38662
- return response.data;
38965
+ return this.updateRecordsImpl(true, id, data, options);
38966
+ }
38967
+ async deleteRecords(entityRef, recordIds, options = {}) {
38968
+ const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.deleteRecords");
38969
+ return this.deleteRecordsImpl(byId, identifier, recordIds, options);
38663
38970
  }
38664
38971
  async deleteRecordsById(id, recordIds, options = {}) {
38665
- const params = createParams({
38666
- failOnFirst: options.failOnFirst
38667
- });
38668
- const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_BY_ID(id), recordIds, {
38669
- params,
38670
- headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
38671
- });
38672
- return response.data;
38972
+ return this.deleteRecordsImpl(true, id, recordIds, options);
38973
+ }
38974
+ async deleteRecord(entityRef, recordId, options) {
38975
+ const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.deleteRecord");
38976
+ return this.deleteRecordImpl(byId, identifier, recordId, options);
38673
38977
  }
38674
38978
  async deleteRecordById(entityId, recordId, options) {
38675
- await this.delete(DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_RECORD_BY_ID(entityId, recordId), { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
38979
+ return this.deleteRecordImpl(true, entityId, recordId, options);
38676
38980
  }
38677
38981
  async getAll(options) {
38678
38982
  const endpoint = !options?.folderKey && options?.includeFolderEntities ? DATA_FABRIC_ENDPOINTS.ENTITY.GET_ALL_V2 : DATA_FABRIC_ENDPOINTS.ENTITY.GET_ALL;
@@ -38684,62 +38988,30 @@ class EntityService extends BaseService {
38684
38988
  });
38685
38989
  return entities;
38686
38990
  }
38991
+ async queryRecords(entityRef, options) {
38992
+ const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.queryRecords");
38993
+ return this.queryRecordsImpl(byId, identifier, options);
38994
+ }
38687
38995
  async queryRecordsById(id, options) {
38688
- if (options?.joins && options.joins.length > MAX_QUERY_JOINS) {
38689
- throw new ValidationError3({
38690
- message: `A maximum of ${MAX_QUERY_JOINS} joins is supported per query (received ${options.joins.length})`
38691
- });
38692
- }
38693
- if (options?.joins && options.joins.length > 0 && !options.selectedFields?.length && !options.aggregates?.length) {
38694
- throw new ValidationError3({
38695
- message: 'Join queries require selectedFields or aggregates — reference fields as "<EntityName>.<FieldName>" (e.g. "Customer.name")'
38696
- });
38697
- }
38698
- const { folderKey, expansionLevel, ...rest } = options ?? {};
38699
- let getEndpoint = () => DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_ID(id);
38700
- if (options?.joins && options.joins.length > 0) {
38701
- const baseEntityName = await this.resolveEntityName(id, folderKey);
38702
- rest.joins = options.joins.map((join2) => toWireJoin(join2, baseEntityName));
38703
- getEndpoint = () => DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_NAME(baseEntityName);
38704
- }
38705
- const downstreamOptions = options === undefined ? undefined : rest;
38706
- return PaginationHelpers.getAll({
38707
- serviceAccess: this.createPaginationServiceAccess(),
38708
- getEndpoint,
38709
- method: HTTP_METHODS.POST,
38710
- headers: createHeaders({ [FOLDER_KEY]: folderKey }),
38711
- queryParams: createParams({ expansionLevel }),
38712
- pagination: {
38713
- paginationType: PaginationType.OFFSET,
38714
- itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
38715
- totalCountField: ENTITY_PAGINATION.TOTAL_COUNT_FIELD,
38716
- paginationParams: {
38717
- pageSizeParam: ENTITY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
38718
- offsetParam: ENTITY_OFFSET_PARAMS.OFFSET_PARAM,
38719
- countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
38720
- }
38721
- },
38722
- excludeFromPrefix: ["filterGroup", "selectedFields", "sortOptions", "aggregates", "groupBy", "joins"]
38723
- }, downstreamOptions);
38996
+ return this.queryRecordsImpl(true, id, options);
38997
+ }
38998
+ async importRecords(entityRef, file2, options) {
38999
+ const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.importRecords");
39000
+ return this.importRecordsImpl(byId, identifier, file2, options);
38724
39001
  }
38725
39002
  async importRecordsById(id, file2, options) {
38726
- const formData = new FormData;
38727
- if (file2 instanceof Uint8Array) {
38728
- formData.append("file", new Blob([file2.buffer]));
38729
- } else {
38730
- formData.append("file", file2);
38731
- }
38732
- const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.BULK_UPLOAD_BY_ID(id), formData, { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
38733
- return response.data;
39003
+ return this.importRecordsImpl(true, id, file2, options);
38734
39004
  }
38735
- async downloadAttachment(entityId, recordId, fieldName, options) {
38736
- const response = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.DOWNLOAD_ATTACHMENT(entityId, recordId, fieldName), {
39005
+ async downloadAttachment(entityRef, recordId, fieldName, options) {
39006
+ const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.downloadAttachment");
39007
+ const response = await this.get(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.DOWNLOAD_ATTACHMENT(identifier, recordId, fieldName) : DATA_FABRIC_ENDPOINTS.ENTITY.ATTACHMENT_BY_NAME(identifier, recordId, fieldName), {
38737
39008
  responseType: RESPONSE_TYPES.BLOB,
38738
39009
  headers: createHeaders({ [FOLDER_KEY]: options?.folderKey })
38739
39010
  });
38740
39011
  return response.data;
38741
39012
  }
38742
- async uploadAttachment(entityId, recordId, fieldName, file2, options) {
39013
+ async uploadAttachment(entityRef, recordId, fieldName, file2, options) {
39014
+ const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.uploadAttachment");
38743
39015
  const formData = new FormData;
38744
39016
  if (file2 instanceof Uint8Array) {
38745
39017
  formData.append("file", new Blob([file2.buffer]));
@@ -38747,14 +39019,15 @@ class EntityService extends BaseService {
38747
39019
  formData.append("file", file2);
38748
39020
  }
38749
39021
  const params = createParams({ expansionLevel: options?.expansionLevel });
38750
- const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPLOAD_ATTACHMENT(entityId, recordId, fieldName), formData, {
39022
+ const response = await this.post(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.UPLOAD_ATTACHMENT(identifier, recordId, fieldName) : DATA_FABRIC_ENDPOINTS.ENTITY.ATTACHMENT_BY_NAME(identifier, recordId, fieldName), formData, {
38751
39023
  params,
38752
39024
  headers: createHeaders({ [FOLDER_KEY]: options?.folderKey })
38753
39025
  });
38754
39026
  return response.data;
38755
39027
  }
38756
- async deleteAttachment(entityId, recordId, fieldName, options) {
38757
- const response = await this.delete(DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_ATTACHMENT(entityId, recordId, fieldName), { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
39028
+ async deleteAttachment(entityRef, recordId, fieldName, options) {
39029
+ const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.deleteAttachment");
39030
+ const response = await this.delete(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_ATTACHMENT(identifier, recordId, fieldName) : DATA_FABRIC_ENDPOINTS.ENTITY.ATTACHMENT_BY_NAME(identifier, recordId, fieldName), { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
38758
39031
  return response.data;
38759
39032
  }
38760
39033
  async getRecordsById(entityId, options) {
@@ -38791,11 +39064,16 @@ class EntityService extends BaseService {
38791
39064
  const opts = options ?? {};
38792
39065
  const hasSchemaChanges = !!(opts.addFields?.length || opts.removeFields?.length || opts.updateFields?.length);
38793
39066
  const hasMetadataChanges = opts.displayName !== undefined || opts.description !== undefined || opts.isRbacEnabled !== undefined;
39067
+ if (!hasSchemaChanges && !hasMetadataChanges) {
39068
+ throw new ValidationError3({
39069
+ message: "updateById requires at least one change — pass addFields, removeFields, updateFields, displayName, description, or isRbacEnabled."
39070
+ });
39071
+ }
38794
39072
  if (hasSchemaChanges) {
38795
39073
  await this.applySchemaUpdate(id, opts);
38796
39074
  }
38797
39075
  if (hasMetadataChanges) {
38798
- await this.patch(DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_METADATA(id), {
39076
+ await this.patch(DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE(id), {
38799
39077
  ...opts.displayName !== undefined && { displayName: opts.displayName },
38800
39078
  ...opts.description !== undefined && { description: opts.description },
38801
39079
  ...opts.isRbacEnabled !== undefined && { isRbacEnabled: opts.isRbacEnabled }
@@ -38808,10 +39086,24 @@ class EntityService extends BaseService {
38808
39086
  const raw = entityResponse.data;
38809
39087
  let fields = (raw.fields ?? []).filter((f) => !f.isSystemField && !f.isPrimaryKey);
38810
39088
  if (options.removeFields?.length) {
39089
+ const existingNames = new Set(fields.map((f) => f.name));
39090
+ const missing = options.removeFields.filter((r) => !existingNames.has(r.name)).map((r) => r.name);
39091
+ if (missing.length) {
39092
+ throw new ValidationError3({
39093
+ message: `Cannot remove field(s) — no matching non-system field found for name(s): ${missing.join(", ")}.`
39094
+ });
39095
+ }
38811
39096
  const removeSet = new Set(options.removeFields.map((r) => r.name));
38812
39097
  fields = fields.filter((f) => !removeSet.has(f.name));
38813
39098
  }
38814
39099
  if (options.updateFields?.length) {
39100
+ const existingIds = new Set(fields.map((f) => f.id));
39101
+ const missing = options.updateFields.filter((u) => !existingIds.has(u.id)).map((u) => u.id);
39102
+ if (missing.length) {
39103
+ throw new ValidationError3({
39104
+ message: `Cannot update field(s) — no matching non-system field found for id(s): ${missing.join(", ")}.`
39105
+ });
39106
+ }
38815
39107
  const updateMap = new Map(options.updateFields.map((u) => [u.id, u]));
38816
39108
  fields = fields.map((f) => {
38817
39109
  const update = updateMap.get(f.id ?? "");
@@ -39061,40 +39353,185 @@ class EntityService extends BaseService {
39061
39353
  return {};
39062
39354
  }
39063
39355
  }
39356
+ async fetchEntityMetadata(endpoint, folderKey) {
39357
+ const response = await this.get(endpoint, { headers: createHeaders({ [FOLDER_KEY]: folderKey }) });
39358
+ const metadata = transformData(response.data, EntityMap);
39359
+ this.applyFieldMappings(metadata);
39360
+ return createEntityWithMethods(metadata, this);
39361
+ }
39362
+ getRecordsImpl(byId, identifier, options) {
39363
+ const { folderKey, ...rest } = options ?? {};
39364
+ const downstreamOptions = options === undefined ? undefined : rest;
39365
+ return PaginationHelpers.getAll({
39366
+ serviceAccess: this.createPaginationServiceAccess(),
39367
+ getEndpoint: () => byId ? DATA_FABRIC_ENDPOINTS.ENTITY.GET_ENTITY_RECORDS(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.GET_ENTITY_RECORDS_BY_NAME(identifier),
39368
+ headers: createHeaders({ [FOLDER_KEY]: folderKey }),
39369
+ pagination: {
39370
+ paginationType: PaginationType.OFFSET,
39371
+ itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
39372
+ totalCountField: ENTITY_PAGINATION.TOTAL_COUNT_FIELD,
39373
+ paginationParams: {
39374
+ pageSizeParam: ENTITY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
39375
+ offsetParam: ENTITY_OFFSET_PARAMS.OFFSET_PARAM,
39376
+ countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
39377
+ }
39378
+ },
39379
+ excludeFromPrefix: ["expansionLevel"]
39380
+ }, downstreamOptions);
39381
+ }
39382
+ async getRecordImpl(byId, identifier, recordId, options) {
39383
+ const params = createParams({ expansionLevel: options.expansionLevel });
39384
+ const response = await this.get(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.GET_RECORD_BY_ID(identifier, recordId) : DATA_FABRIC_ENDPOINTS.ENTITY.GET_RECORD_BY_NAME(identifier, recordId), { params, headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
39385
+ return response.data;
39386
+ }
39387
+ async insertRecordImpl(byId, identifier, data, options) {
39388
+ const params = createParams({ expansionLevel: options.expansionLevel });
39389
+ const response = await this.post(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.INSERT_BY_ID(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.INSERT_BY_NAME(identifier), data, { params, headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
39390
+ return response.data;
39391
+ }
39392
+ async insertRecordsImpl(byId, identifier, data, options) {
39393
+ const params = createParams({ expansionLevel: options.expansionLevel, failOnFirst: options.failOnFirst });
39394
+ const response = await this.post(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.BATCH_INSERT_BY_ID(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.BATCH_INSERT_BY_NAME(identifier), data, { params, headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
39395
+ return response.data;
39396
+ }
39397
+ async updateRecordImpl(byId, identifier, recordId, data, options) {
39398
+ const params = createParams({ expansionLevel: options.expansionLevel });
39399
+ const response = await this.post(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_RECORD_BY_ID(identifier, recordId) : DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_RECORD_BY_NAME(identifier, recordId), data, { params, headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
39400
+ return response.data;
39401
+ }
39402
+ async updateRecordsImpl(byId, identifier, data, options) {
39403
+ const params = createParams({ expansionLevel: options.expansionLevel, failOnFirst: options.failOnFirst });
39404
+ const response = await this.post(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_BY_ID(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_BY_NAME(identifier), data, { params, headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
39405
+ return response.data;
39406
+ }
39407
+ async deleteRecordsImpl(byId, identifier, recordIds, options) {
39408
+ const params = createParams({ failOnFirst: options.failOnFirst });
39409
+ const response = await this.post(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_BY_ID(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_BY_NAME(identifier), recordIds, { params, headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
39410
+ return response.data;
39411
+ }
39412
+ async deleteRecordImpl(byId, identifier, recordId, options) {
39413
+ await this.delete(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_RECORD_BY_ID(identifier, recordId) : DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_RECORD_BY_NAME(identifier, recordId), { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
39414
+ }
39415
+ async queryRecordsImpl(byId, identifier, options) {
39416
+ if (options?.joins && options.joins.length > MAX_QUERY_JOINS) {
39417
+ throw new ValidationError3({
39418
+ message: `A maximum of ${MAX_QUERY_JOINS} joins is supported per query (received ${options.joins.length})`
39419
+ });
39420
+ }
39421
+ if (options?.joins && options.joins.length > 0 && !options.selectedFields?.length && !options.aggregates?.length) {
39422
+ throw new ValidationError3({
39423
+ message: 'Join queries require selectedFields or aggregates — reference fields as "<EntityName>.<FieldName>" (e.g. "Customer.name")'
39424
+ });
39425
+ }
39426
+ if (options?.havingFilter && (!options.aggregates?.length || !options.groupBy?.length)) {
39427
+ throw new ValidationError3({
39428
+ message: "havingFilter requires aggregates and groupBy — conditions reference declared aggregate aliases; use filterGroup for row-level conditions"
39429
+ });
39430
+ }
39431
+ const { folderKey, expansionLevel, ...rest } = options ?? {};
39432
+ let getEndpoint = () => byId ? DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_ID(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_NAME(identifier);
39433
+ if (options?.joins && options.joins.length > 0) {
39434
+ const baseEntityName = byId ? await this.resolveEntityName(identifier, folderKey) : identifier;
39435
+ rest.joins = options.joins.map((join2) => toWireJoin(join2, baseEntityName));
39436
+ getEndpoint = () => DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_NAME(baseEntityName);
39437
+ }
39438
+ const downstreamOptions = options === undefined ? undefined : rest;
39439
+ return PaginationHelpers.getAll({
39440
+ serviceAccess: this.createPaginationServiceAccess(),
39441
+ getEndpoint,
39442
+ method: HTTP_METHODS.POST,
39443
+ headers: createHeaders({ [FOLDER_KEY]: folderKey }),
39444
+ queryParams: createParams({ expansionLevel }),
39445
+ pagination: {
39446
+ paginationType: PaginationType.OFFSET,
39447
+ itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
39448
+ totalCountField: ENTITY_PAGINATION.TOTAL_COUNT_FIELD,
39449
+ paginationParams: {
39450
+ pageSizeParam: ENTITY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
39451
+ offsetParam: ENTITY_OFFSET_PARAMS.OFFSET_PARAM,
39452
+ countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
39453
+ }
39454
+ },
39455
+ excludeFromPrefix: ["filterGroup", "selectedFields", "sortOptions", "aggregates", "groupBy", "joins", "havingFilter"]
39456
+ }, downstreamOptions);
39457
+ }
39458
+ async importRecordsImpl(byId, identifier, file2, options) {
39459
+ const formData = new FormData;
39460
+ if (file2 instanceof Uint8Array) {
39461
+ formData.append("file", new Blob([file2.buffer]));
39462
+ } else {
39463
+ formData.append("file", file2);
39464
+ }
39465
+ const response = await this.post(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.BULK_UPLOAD_BY_ID(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.BULK_UPLOAD_BY_NAME(identifier), formData, { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
39466
+ return response.data;
39467
+ }
39064
39468
  }
39065
39469
  __decorate([
39066
39470
  track("Entities.GetById")
39067
39471
  ], EntityService.prototype, "getById", null);
39472
+ __decorate([
39473
+ track("Entities.GetByName")
39474
+ ], EntityService.prototype, "getByName", null);
39068
39475
  __decorate([
39069
39476
  track("Entities.GetAllRecords")
39070
39477
  ], EntityService.prototype, "getAllRecords", null);
39478
+ __decorate([
39479
+ track("Entities.GetRecordsByName")
39480
+ ], EntityService.prototype, "getRecordsByName", null);
39071
39481
  __decorate([
39072
39482
  track("Entities.GetRecordById")
39073
39483
  ], EntityService.prototype, "getRecordById", null);
39484
+ __decorate([
39485
+ track("Entities.GetRecordByName")
39486
+ ], EntityService.prototype, "getRecordByName", null);
39487
+ __decorate([
39488
+ track("Entities.InsertRecord")
39489
+ ], EntityService.prototype, "insertRecord", null);
39074
39490
  __decorate([
39075
39491
  track("Entities.InsertRecordById")
39076
39492
  ], EntityService.prototype, "insertRecordById", null);
39493
+ __decorate([
39494
+ track("Entities.InsertRecords")
39495
+ ], EntityService.prototype, "insertRecords", null);
39077
39496
  __decorate([
39078
39497
  track("Entities.InsertRecordsById")
39079
39498
  ], EntityService.prototype, "insertRecordsById", null);
39499
+ __decorate([
39500
+ track("Entities.UpdateRecord")
39501
+ ], EntityService.prototype, "updateRecord", null);
39080
39502
  __decorate([
39081
39503
  track("Entities.UpdateRecordById")
39082
39504
  ], EntityService.prototype, "updateRecordById", null);
39505
+ __decorate([
39506
+ track("Entities.UpdateRecords")
39507
+ ], EntityService.prototype, "updateRecords", null);
39083
39508
  __decorate([
39084
39509
  track("Entities.UpdateRecordsById")
39085
39510
  ], EntityService.prototype, "updateRecordsById", null);
39511
+ __decorate([
39512
+ track("Entities.DeleteRecords")
39513
+ ], EntityService.prototype, "deleteRecords", null);
39086
39514
  __decorate([
39087
39515
  track("Entities.DeleteRecordsById")
39088
39516
  ], EntityService.prototype, "deleteRecordsById", null);
39517
+ __decorate([
39518
+ track("Entities.DeleteRecord")
39519
+ ], EntityService.prototype, "deleteRecord", null);
39089
39520
  __decorate([
39090
39521
  track("Entities.DeleteRecordById")
39091
39522
  ], EntityService.prototype, "deleteRecordById", null);
39092
39523
  __decorate([
39093
39524
  track("Entities.GetAll")
39094
39525
  ], EntityService.prototype, "getAll", null);
39526
+ __decorate([
39527
+ track("Entities.QueryRecords")
39528
+ ], EntityService.prototype, "queryRecords", null);
39095
39529
  __decorate([
39096
39530
  track("Entities.QueryRecordsById")
39097
39531
  ], EntityService.prototype, "queryRecordsById", null);
39532
+ __decorate([
39533
+ track("Entities.ImportRecords")
39534
+ ], EntityService.prototype, "importRecords", null);
39098
39535
  __decorate([
39099
39536
  track("Entities.ImportRecordsById")
39100
39537
  ], EntityService.prototype, "importRecordsById", null);
@@ -40538,6 +40975,74 @@ function validateName(resourceType, name) {
40538
40975
  }
40539
40976
  return trimmed;
40540
40977
  }
40978
+ var GUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
40979
+ function isPlainObject4(value) {
40980
+ return typeof value === "object" && value !== null && !Array.isArray(value);
40981
+ }
40982
+ function asResourceOverrides(value) {
40983
+ if (!isPlainObject4(value))
40984
+ return;
40985
+ const table = {};
40986
+ for (const [key, properties] of Object.entries(value)) {
40987
+ if (!isPlainObject4(properties))
40988
+ continue;
40989
+ const bag = {};
40990
+ for (const [property, propertyValue] of Object.entries(properties)) {
40991
+ if (typeof propertyValue === "string")
40992
+ bag[property] = propertyValue;
40993
+ }
40994
+ table[key] = bag;
40995
+ }
40996
+ return Object.keys(table).length > 0 ? table : undefined;
40997
+ }
40998
+ function readFromDocument() {
40999
+ if (!isBrowser2)
41000
+ return;
41001
+ const text = document.getElementById(UiPathElementIds.RESOURCE_OVERRIDES)?.textContent;
41002
+ if (!text)
41003
+ return;
41004
+ try {
41005
+ return asResourceOverrides(JSON.parse(text));
41006
+ } catch (error52) {
41007
+ console.warn(`[UiPath SDK] Failed to parse <script id="${UiPathElementIds.RESOURCE_OVERRIDES}"> as JSON — proceeding without overrides:`, error52);
41008
+ return;
41009
+ }
41010
+ }
41011
+ var table;
41012
+ var loaded = false;
41013
+ var pageOverrides = () => {
41014
+ if (!loaded) {
41015
+ loaded = true;
41016
+ table = readFromDocument();
41017
+ }
41018
+ return table;
41019
+ };
41020
+ var RESOURCE_OVERWRITES_KEY = Symbol.for("uipath.resourceOverwrites.v1");
41021
+ function readOverrides() {
41022
+ const slot2 = globalThis[RESOURCE_OVERWRITES_KEY];
41023
+ const source = typeof slot2 === "function" ? slot2 : pageOverrides;
41024
+ try {
41025
+ return source();
41026
+ } catch (error52) {
41027
+ console.warn("[UiPath SDK] Override source threw — proceeding without overrides:", error52);
41028
+ return;
41029
+ }
41030
+ }
41031
+ function resolveOverride(resourceType, name, folderPath) {
41032
+ const table2 = readOverrides();
41033
+ if (!table2)
41034
+ return;
41035
+ const bindingType = resourceType.toLowerCase();
41036
+ const scopedKey = folderPath ? `${bindingType}.${name}.${folderPath}` : undefined;
41037
+ const unscopedKey = `${bindingType}.${name}`;
41038
+ const entry = (scopedKey && table2[scopedKey]) ?? table2[unscopedKey];
41039
+ if (!entry)
41040
+ return;
41041
+ return {
41042
+ name: entry.name,
41043
+ folderPath: entry.folderPath
41044
+ };
41045
+ }
40541
41046
  var SINGLE_QUOTE_RE = /'/g;
40542
41047
 
40543
41048
  class FolderScopedService extends BaseService {
@@ -40554,20 +41059,23 @@ class FolderScopedService extends BaseService {
40554
41059
  }
40555
41060
  return response.data?.value;
40556
41061
  }
40557
- async getByNameLookup(resourceType, endpoint, name, options, transform3, responseFieldMap) {
41062
+ async getByNameLookup(resourceType, endpoint, name, options, transform3, responseFieldMap, callerLabel) {
40558
41063
  const validatedName = validateName(resourceType, name);
40559
41064
  const { folderId, folderKey, folderPath, ...queryOptions } = options;
41065
+ const override = resolveOverride(resourceType, validatedName, folderPath);
41066
+ const resolvedName = override?.name ?? validatedName;
41067
+ const resolvedFolderPath = override?.folderPath ?? folderPath;
40560
41068
  const headers = resolveFolderHeaders({
40561
41069
  folderId,
40562
41070
  folderKey,
40563
- folderPath,
40564
- resourceType: `${resourceType}.getByName`,
41071
+ folderPath: resolvedFolderPath,
41072
+ resourceType: callerLabel ?? `${resourceType}.getByName`,
40565
41073
  fallbackFolderKey: this.config.folderKey
40566
41074
  });
40567
41075
  const apiFieldOptions = responseFieldMap ? transformOptions(queryOptions, responseFieldMap) : queryOptions;
40568
41076
  const apiOptions = {
40569
41077
  ...addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions)),
40570
- $filter: `Name eq '${validatedName.replace(SINGLE_QUOTE_RE, "''")}'`,
41078
+ $filter: `Name eq '${resolvedName.replace(SINGLE_QUOTE_RE, "''")}'`,
40571
41079
  $top: "1"
40572
41080
  };
40573
41081
  const response = await this.get(endpoint, {
@@ -40576,12 +41084,48 @@ class FolderScopedService extends BaseService {
40576
41084
  });
40577
41085
  const items = response.data?.value;
40578
41086
  if (!items?.length) {
40579
- const folderHint = describeFolderForError(folderId, folderKey, folderPath);
41087
+ const folderHint = describeFolderForError(folderId, folderKey, resolvedFolderPath);
40580
41088
  throw new NotFoundError({
40581
- message: `${resourceType} '${validatedName}' not found${folderHint}.`
41089
+ message: `${resourceType} '${resolvedName}' not found${folderHint}.`
40582
41090
  });
40583
41091
  }
40584
- return transform3(items[0]);
41092
+ return {
41093
+ result: transform3(items[0]),
41094
+ effectiveFolder: { folderId, folderKey, folderPath: resolvedFolderPath }
41095
+ };
41096
+ }
41097
+ async getByKeyLookup(resourceType, endpoint, key, options, transform3, responseFieldMap, callerLabel) {
41098
+ const label = callerLabel ?? `${resourceType}.getByKey`;
41099
+ const trimmedKey = key?.trim();
41100
+ if (!trimmedKey || !GUID_REGEX.test(trimmedKey)) {
41101
+ throw new ValidationError3({ message: `${label}: key must be a GUID.` });
41102
+ }
41103
+ const { folderId, folderKey, folderPath, ...queryOptions } = options;
41104
+ const headers = resolveFolderHeaders({
41105
+ folderId,
41106
+ folderKey,
41107
+ folderPath,
41108
+ resourceType: label,
41109
+ fallbackFolderKey: this.config.folderKey
41110
+ });
41111
+ const apiFieldOptions = responseFieldMap ? transformOptions(queryOptions, responseFieldMap) : queryOptions;
41112
+ const apiOptions = {
41113
+ ...addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions)),
41114
+ $filter: `Key eq ${trimmedKey}`,
41115
+ $top: "1"
41116
+ };
41117
+ const response = await this.get(endpoint, {
41118
+ headers,
41119
+ params: apiOptions
41120
+ });
41121
+ const items = response.data?.value;
41122
+ if (!items?.length) {
41123
+ throw new NotFoundError({ message: `${resourceType} with key '${trimmedKey}' not found.` });
41124
+ }
41125
+ return {
41126
+ result: transform3(items[0]),
41127
+ effectiveFolder: { folderId, folderKey, folderPath }
41128
+ };
40585
41129
  }
40586
41130
  }
40587
41131
  function describeFolderForError(folderId, folderKey, folderPath) {
@@ -40612,12 +41156,16 @@ class TaskService extends FolderScopedService {
40612
41156
  };
40613
41157
  }
40614
41158
  async create(task, folderId) {
41159
+ if (task.type === TaskType.QuickForm && !task.taskSchemaKey) {
41160
+ throw new ValidationError3({ message: "taskSchemaKey is required when creating a QuickForm task." });
41161
+ }
40615
41162
  const headers = createHeaders({ [FOLDER_ID]: folderId });
40616
- const externalTask = {
40617
- ...task,
40618
- type: TaskType.External
40619
- };
40620
- const response = await this.post(TASK_ENDPOINTS.CREATE_GENERIC_TASK, externalTask, { headers });
41163
+ const { labels, type, ...rest } = task;
41164
+ const payload = { ...rest, type: type ?? TaskType.External };
41165
+ if (labels?.length) {
41166
+ payload.tags = labels.map((label) => ({ name: label, displayName: label, displayValue: label }));
41167
+ }
41168
+ const response = await this.post(TASK_ENDPOINTS.CREATE_GENERIC_TASK, payload, { headers });
40621
41169
  const normalizedData = transformData(response.data, TaskMap);
40622
41170
  const transformedData = applyDataTransforms(normalizedData, { field: "status", valueMap: TaskStatusMap });
40623
41171
  return createTaskWithMethods(transformedData, this);
@@ -41249,6 +41797,35 @@ var AssetValueType;
41249
41797
  AssetValueType2["Credential"] = "Credential";
41250
41798
  AssetValueType2["Secret"] = "Secret";
41251
41799
  })(AssetValueType || (AssetValueType = {}));
41800
+ async function resolveRefToId(ref, resolvers, callerLabel) {
41801
+ if (!ref) {
41802
+ throw new ValidationError3({
41803
+ message: `${callerLabel}: ref must supply exactly one of 'id', 'name', or 'key'.`
41804
+ });
41805
+ }
41806
+ if ("id" in ref && ref.id != null) {
41807
+ return { id: ref.id, effectiveFolder: {} };
41808
+ }
41809
+ const stringVariants = [
41810
+ { variant: "name", resolver: resolvers.byName },
41811
+ { variant: "key", resolver: resolvers.byKey }
41812
+ ];
41813
+ for (const { variant, resolver } of stringVariants) {
41814
+ const value = ref[variant];
41815
+ if (!value)
41816
+ continue;
41817
+ if (!resolver) {
41818
+ throw new ValidationError3({
41819
+ message: `${callerLabel}: this method does not support lookup by '${variant}'.`
41820
+ });
41821
+ }
41822
+ const { id, folderId, folderKey, folderPath } = await resolver(value);
41823
+ return { id, effectiveFolder: { folderId, folderKey, folderPath } };
41824
+ }
41825
+ throw new ValidationError3({
41826
+ message: `${callerLabel}: ref must supply exactly one of 'id', 'name', or 'key'.`
41827
+ });
41828
+ }
41252
41829
  var AssetMap = {
41253
41830
  creationTime: "createdTime",
41254
41831
  lastModificationTime: "lastModifiedTime"
@@ -41287,7 +41864,41 @@ class AssetService extends FolderScopedService {
41287
41864
  return transformedAsset;
41288
41865
  }
41289
41866
  async getByName(name, options = {}) {
41290
- return this.getByNameLookup("Asset", ASSET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap), AssetMap);
41867
+ const { result } = await this.getByNameLookup("Asset", ASSET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap), AssetMap);
41868
+ return result;
41869
+ }
41870
+ async getByKey(key, options = {}) {
41871
+ const { result } = await this.getByKeyLookup("Asset", ASSET_ENDPOINTS.GET_BY_FOLDER, key, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap), AssetMap);
41872
+ return result;
41873
+ }
41874
+ async updateValue(assetRef, newValue, options) {
41875
+ if (newValue === null || newValue === undefined) {
41876
+ throw new ValidationError3({ message: "newValue is required for updateValue" });
41877
+ }
41878
+ let preFetched;
41879
+ const { id, effectiveFolder } = await resolveRefToId(assetRef, {
41880
+ byName: async (name) => {
41881
+ const { result: asset, effectiveFolder: folder } = await this.getByNameLookup("Asset", ASSET_ENDPOINTS.GET_BY_FOLDER, name, { folderId: options?.folderId, folderKey: options?.folderKey, folderPath: options?.folderPath }, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap), AssetMap, "Assets.updateValue");
41882
+ preFetched = asset;
41883
+ return { id: asset.id, ...folder };
41884
+ },
41885
+ byKey: async (key) => {
41886
+ const { result: asset, effectiveFolder: folder } = await this.getByKeyLookup("Asset", ASSET_ENDPOINTS.GET_BY_FOLDER, key, { folderId: options?.folderId, folderKey: options?.folderKey, folderPath: options?.folderPath }, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap), AssetMap, "Assets.updateValue");
41887
+ preFetched = asset;
41888
+ return { id: asset.id, ...folder };
41889
+ }
41890
+ }, "Assets.updateValue");
41891
+ if (id <= 0) {
41892
+ throw new ValidationError3({ message: "Assets.updateValue: assetRef.id must be a positive number." });
41893
+ }
41894
+ const headers = resolveFolderHeaders({
41895
+ folderId: effectiveFolder.folderId ?? options?.folderId,
41896
+ folderKey: effectiveFolder.folderKey ?? options?.folderKey,
41897
+ folderPath: effectiveFolder.folderPath ?? options?.folderPath,
41898
+ resourceType: "Assets.updateValue",
41899
+ fallbackFolderKey: this.config.folderKey
41900
+ });
41901
+ await this.updateValueByResolvedId(id, newValue, headers, preFetched);
41291
41902
  }
41292
41903
  async updateValueById(id, newValue, options) {
41293
41904
  if (!id) {
@@ -41303,19 +41914,30 @@ class AssetService extends FolderScopedService {
41303
41914
  resourceType: "Assets.updateValueById",
41304
41915
  fallbackFolderKey: this.config.folderKey
41305
41916
  });
41306
- const existingResponse = await this.get(ASSET_ENDPOINTS.GET_BY_ID(id), { headers });
41307
- const existing = existingResponse.data;
41308
- const valueField = resolveValueField(id, existing.ValueType, newValue);
41917
+ await this.updateValueByResolvedId(id, newValue, headers);
41918
+ }
41919
+ async updateValueByResolvedId(id, newValue, headers, preFetched) {
41920
+ const shape = preFetched ?? await this.fetchAssetShape(id, headers);
41921
+ const valueField = resolveValueField(id, shape.valueType, newValue);
41309
41922
  const body = {
41310
41923
  Id: id,
41311
- Name: existing.Name,
41312
- ValueScope: existing.ValueScope,
41313
- ValueType: existing.ValueType,
41314
- Description: existing.Description,
41924
+ Name: shape.name,
41925
+ ValueScope: shape.valueScope,
41926
+ ValueType: shape.valueType,
41927
+ Description: shape.description,
41315
41928
  [valueField]: newValue
41316
41929
  };
41317
41930
  await this.put(ASSET_ENDPOINTS.GET_BY_ID(id), body, { headers });
41318
41931
  }
41932
+ async fetchAssetShape(id, headers) {
41933
+ const response = await this.get(ASSET_ENDPOINTS.GET_BY_ID(id), { headers });
41934
+ return {
41935
+ name: response.data.Name,
41936
+ valueScope: response.data.ValueScope,
41937
+ valueType: response.data.ValueType,
41938
+ description: response.data.Description
41939
+ };
41940
+ }
41319
41941
  }
41320
41942
  __decorate([
41321
41943
  track("Assets.GetAll")
@@ -41326,6 +41948,12 @@ __decorate([
41326
41948
  __decorate([
41327
41949
  track("Assets.GetByName")
41328
41950
  ], AssetService.prototype, "getByName", null);
41951
+ __decorate([
41952
+ track("Assets.GetByKey")
41953
+ ], AssetService.prototype, "getByKey", null);
41954
+ __decorate([
41955
+ track("Assets.UpdateValue")
41956
+ ], AssetService.prototype, "updateValue", null);
41329
41957
  __decorate([
41330
41958
  track("Assets.UpdateValueById")
41331
41959
  ], AssetService.prototype, "updateValueById", null);
@@ -41354,7 +41982,7 @@ function resolveValueField(id, valueType, newValue) {
41354
41982
  return "BoolValue";
41355
41983
  default:
41356
41984
  throw new ValidationError3({
41357
- message: `updateValueById only supports Text, Integer, or Bool assets; asset ${id} has valueType ${valueType}`
41985
+ message: `Asset ${id} has valueType ${valueType}; only Text, Integer, and Bool are supported`
41358
41986
  });
41359
41987
  }
41360
41988
  }
@@ -41382,7 +42010,8 @@ class BucketService extends FolderScopedService {
41382
42010
  return pascalToCamelCaseKeys(response.data);
41383
42011
  }
41384
42012
  async getByName(name, options = {}) {
41385
- return this.getByNameLookup("Bucket", BUCKET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => pascalToCamelCaseKeys(raw));
42013
+ const { result } = await this.getByNameLookup("Bucket", BUCKET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => pascalToCamelCaseKeys(raw));
42014
+ return result;
41386
42015
  }
41387
42016
  async getAll(options) {
41388
42017
  const transformBucketResponse = (bucket) => pascalToCamelCaseKeys(bucket);
@@ -42249,7 +42878,8 @@ class ProcessService extends FolderScopedService {
42249
42878
  return transformedProcess;
42250
42879
  }
42251
42880
  async getByName(name, options = {}) {
42252
- return this.getByNameLookup("Process", PROCESS_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), ProcessMap), ProcessMap);
42881
+ const { result } = await this.getByNameLookup("Process", PROCESS_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), ProcessMap), ProcessMap);
42882
+ return result;
42253
42883
  }
42254
42884
  }
42255
42885
  __decorate([
@@ -42264,21 +42894,112 @@ __decorate([
42264
42894
  __decorate([
42265
42895
  track("Processes.GetByName")
42266
42896
  ], ProcessService.prototype, "getByName", null);
42897
+ var QueuePriority;
42898
+ (function(QueuePriority2) {
42899
+ QueuePriority2["High"] = "High";
42900
+ QueuePriority2["Normal"] = "Normal";
42901
+ QueuePriority2["Low"] = "Low";
42902
+ })(QueuePriority || (QueuePriority = {}));
42903
+ var QueueItemStatus;
42904
+ (function(QueueItemStatus2) {
42905
+ QueueItemStatus2["New"] = "New";
42906
+ QueueItemStatus2["InProgress"] = "InProgress";
42907
+ QueueItemStatus2["Failed"] = "Failed";
42908
+ QueueItemStatus2["Successful"] = "Successful";
42909
+ QueueItemStatus2["Abandoned"] = "Abandoned";
42910
+ QueueItemStatus2["Retried"] = "Retried";
42911
+ QueueItemStatus2["Deleted"] = "Deleted";
42912
+ })(QueueItemStatus || (QueueItemStatus = {}));
42913
+ var QueueItemReviewStatus;
42914
+ (function(QueueItemReviewStatus2) {
42915
+ QueueItemReviewStatus2["None"] = "None";
42916
+ QueueItemReviewStatus2["InReview"] = "InReview";
42917
+ QueueItemReviewStatus2["Verified"] = "Verified";
42918
+ QueueItemReviewStatus2["Retried"] = "Retried";
42919
+ })(QueueItemReviewStatus || (QueueItemReviewStatus = {}));
42920
+ var QueueExceptionType;
42921
+ (function(QueueExceptionType2) {
42922
+ QueueExceptionType2["ApplicationException"] = "ApplicationException";
42923
+ QueueExceptionType2["BusinessException"] = "BusinessException";
42924
+ })(QueueExceptionType || (QueueExceptionType = {}));
42925
+ var QueueTransactionOutcome;
42926
+ (function(QueueTransactionOutcome2) {
42927
+ QueueTransactionOutcome2["Successful"] = "Successful";
42928
+ QueueTransactionOutcome2["Failed"] = "Failed";
42929
+ })(QueueTransactionOutcome || (QueueTransactionOutcome = {}));
42930
+ function createQueueMethods(queueData, service) {
42931
+ return {
42932
+ async getAllItems(options) {
42933
+ if (!queueData.id)
42934
+ throw new ValidationError3({ message: "Queue ID is undefined" });
42935
+ if (!queueData.folderId)
42936
+ throw new ValidationError3({ message: "Folder ID is undefined" });
42937
+ return service.getAllItems(queueData.id, { ...options, folderId: queueData.folderId });
42938
+ },
42939
+ async insertItem(specificData, options) {
42940
+ if (!queueData.name)
42941
+ throw new ValidationError3({ message: "Queue name is undefined" });
42942
+ if (!queueData.folderId)
42943
+ throw new ValidationError3({ message: "Folder ID is undefined" });
42944
+ return service.insertItemByName(queueData.name, specificData, { ...options, folderId: queueData.folderId });
42945
+ },
42946
+ async startTransaction() {
42947
+ if (!queueData.name)
42948
+ throw new ValidationError3({ message: "Queue name is undefined" });
42949
+ if (!queueData.folderId)
42950
+ throw new ValidationError3({ message: "Folder ID is undefined" });
42951
+ return service.startTransaction({ name: queueData.name }, { folderId: queueData.folderId });
42952
+ },
42953
+ async completeTransaction(itemId, outcome, options) {
42954
+ if (!queueData.folderId)
42955
+ throw new ValidationError3({ message: "Folder ID is undefined" });
42956
+ return service.completeTransaction(itemId, outcome, { ...options, folderId: queueData.folderId });
42957
+ }
42958
+ };
42959
+ }
42960
+ function createQueueWithMethods(queueData, service) {
42961
+ return Object.assign({}, queueData, createQueueMethods(queueData, service));
42962
+ }
42267
42963
  var QueueMap = {
42268
42964
  creationTime: "createdTime",
42269
42965
  organizationUnitId: "folderId",
42270
42966
  organizationUnitFullyQualifiedName: "folderName"
42271
42967
  };
42968
+ var QueueItemMap = {
42969
+ queueDefinitionId: "queueId",
42970
+ creationTime: "createdTime",
42971
+ organizationUnitId: "folderId",
42972
+ organizationUnitFullyQualifiedName: "folderName",
42973
+ startProcessing: "processingStartTime",
42974
+ endProcessing: "processingEndTime",
42975
+ processingException: "processingError"
42976
+ };
42977
+ var QueueItemProcessingErrorMap = {
42978
+ creationTime: "createdTime"
42979
+ };
42980
+ function transformQueueItem(queueItem) {
42981
+ const { SpecificContent, Output, SpecificData: _sd, OutputData: _od, ...rest } = queueItem;
42982
+ const transformed = transformData(pascalToCamelCaseKeys(rest), QueueItemMap);
42983
+ if (transformed.processingError) {
42984
+ transformed.processingError = transformData(transformed.processingError, QueueItemProcessingErrorMap);
42985
+ }
42986
+ transformed.specificData = SpecificContent ?? null;
42987
+ transformed.outputData = Output ?? null;
42988
+ return transformed;
42989
+ }
42272
42990
 
42273
42991
  class QueueService extends FolderScopedService {
42274
42992
  async getAll(options) {
42275
- const transformQueueResponse = (queue) => transformData(pascalToCamelCaseKeys(queue), QueueMap);
42276
- const apiOptions = options ? transformOptions(options, QueueMap) : options;
42993
+ const { folderId, folderKey, folderPath, ...queryOptions } = options ?? {};
42994
+ const hasFolderScope = folderId !== undefined || !!folderKey?.trim() || !!folderPath?.trim();
42995
+ const headers = hasFolderScope ? resolveFolderHeaders({ folderId, folderKey, folderPath, resourceType: "Queues.getAll" }) : undefined;
42996
+ const apiOptions = transformOptions(queryOptions, QueueMap);
42277
42997
  return PaginationHelpers.getAll({
42278
42998
  serviceAccess: this.createPaginationServiceAccess(),
42279
- getEndpoint: (folderId) => folderId ? QUEUE_ENDPOINTS.GET_BY_FOLDER : QUEUE_ENDPOINTS.GET_ALL,
42999
+ getEndpoint: () => hasFolderScope ? QUEUE_ENDPOINTS.GET_BY_FOLDER : QUEUE_ENDPOINTS.GET_ALL,
42280
43000
  getByFolderEndpoint: QUEUE_ENDPOINTS.GET_BY_FOLDER,
42281
- transformFn: transformQueueResponse,
43001
+ headers,
43002
+ transformFn: (queue) => createQueueWithMethods(transformData(pascalToCamelCaseKeys(queue), QueueMap), this),
42282
43003
  pagination: {
42283
43004
  paginationType: PaginationType.OFFSET,
42284
43005
  itemsField: ODATA_PAGINATION.ITEMS_FIELD,
@@ -42291,15 +43012,176 @@ class QueueService extends FolderScopedService {
42291
43012
  }
42292
43013
  }, apiOptions);
42293
43014
  }
42294
- async getById(id, folderId, options = {}) {
42295
- const headers = createHeaders({ [FOLDER_ID]: folderId });
42296
- const apiFieldOptions = transformOptions(options, QueueMap);
43015
+ async getById(id, folderIdOrOptions, options = {}) {
43016
+ if (typeof folderIdOrOptions === "number") {
43017
+ const headers2 = createHeaders({ [FOLDER_ID]: folderIdOrOptions });
43018
+ const apiFieldOptions2 = transformOptions(options, QueueMap);
43019
+ const apiOptions2 = addPrefixToKeys(apiFieldOptions2, ODATA_PREFIX, Object.keys(apiFieldOptions2));
43020
+ const response2 = await this.get(QUEUE_ENDPOINTS.GET_BY_ID(id), {
43021
+ headers: headers2,
43022
+ params: apiOptions2
43023
+ });
43024
+ return transformData(pascalToCamelCaseKeys(response2.data), QueueMap);
43025
+ }
43026
+ const { folderId, folderKey, folderPath, ...queryOptions } = folderIdOrOptions ?? {};
43027
+ const headers = resolveFolderHeaders({
43028
+ folderId,
43029
+ folderKey,
43030
+ folderPath,
43031
+ resourceType: "Queues.getById",
43032
+ fallbackFolderKey: this.config.folderKey
43033
+ });
43034
+ const apiFieldOptions = transformOptions(queryOptions, QueueMap);
42297
43035
  const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
42298
43036
  const response = await this.get(QUEUE_ENDPOINTS.GET_BY_ID(id), {
42299
43037
  headers,
42300
43038
  params: apiOptions
42301
43039
  });
42302
- return transformData(pascalToCamelCaseKeys(response.data), QueueMap);
43040
+ const rawQueue = transformData(pascalToCamelCaseKeys(response.data), QueueMap);
43041
+ return createQueueWithMethods(rawQueue, this);
43042
+ }
43043
+ async getByName(name, options = {}) {
43044
+ const { result } = await this.getByNameLookup("Queue", QUEUE_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => createQueueWithMethods(transformData(pascalToCamelCaseKeys(raw), QueueMap), this), QueueMap);
43045
+ return result;
43046
+ }
43047
+ async getByKey(key, options = {}) {
43048
+ const trimmedKey = key?.trim();
43049
+ if (!trimmedKey || !GUID_REGEX.test(trimmedKey)) {
43050
+ throw new ValidationError3({ message: "key must be a GUID for getByKey" });
43051
+ }
43052
+ const { folderId, folderKey, folderPath, ...queryOptions } = options;
43053
+ const headers = resolveFolderHeaders({
43054
+ folderId,
43055
+ folderKey,
43056
+ folderPath,
43057
+ resourceType: "Queues.getByKey",
43058
+ fallbackFolderKey: this.config.folderKey
43059
+ });
43060
+ const apiFieldOptions = transformOptions(queryOptions, QueueMap);
43061
+ const apiOptions = {
43062
+ ...addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions)),
43063
+ $filter: `Key eq ${trimmedKey}`,
43064
+ $top: "1"
43065
+ };
43066
+ const response = await this.get(QUEUE_ENDPOINTS.GET_BY_FOLDER, { headers, params: apiOptions });
43067
+ const items = response.data?.value;
43068
+ if (!items?.length) {
43069
+ throw new NotFoundError({ message: `Queue with key '${trimmedKey}' not found.` });
43070
+ }
43071
+ return createQueueWithMethods(transformData(pascalToCamelCaseKeys(items[0]), QueueMap), this);
43072
+ }
43073
+ async getAllItems(queueId, options) {
43074
+ if (!queueId) {
43075
+ throw new ValidationError3({ message: "queueId is required for getAllItems" });
43076
+ }
43077
+ const { folderId, folderKey, folderPath, filter, ...restOptions } = options ?? {};
43078
+ const headers = resolveFolderHeaders({
43079
+ folderId,
43080
+ folderKey,
43081
+ folderPath,
43082
+ resourceType: "Queues.getAllItems",
43083
+ fallbackFolderKey: this.config.folderKey
43084
+ });
43085
+ const mergedFilter = filter ? `(${filter}) and queueId eq ${queueId}` : `queueId eq ${queueId}`;
43086
+ const apiOptions = transformOptions({ ...restOptions, filter: mergedFilter }, QueueItemMap);
43087
+ return PaginationHelpers.getAll({
43088
+ serviceAccess: this.createPaginationServiceAccess(),
43089
+ getEndpoint: () => QUEUE_ENDPOINTS.GET_ITEMS,
43090
+ getByFolderEndpoint: QUEUE_ENDPOINTS.GET_ITEMS,
43091
+ headers,
43092
+ transformFn: transformQueueItem,
43093
+ pagination: {
43094
+ paginationType: PaginationType.OFFSET,
43095
+ itemsField: ODATA_PAGINATION.ITEMS_FIELD,
43096
+ totalCountField: ODATA_PAGINATION.TOTAL_COUNT_FIELD,
43097
+ paginationParams: {
43098
+ pageSizeParam: ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM,
43099
+ offsetParam: ODATA_OFFSET_PARAMS.OFFSET_PARAM,
43100
+ countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM
43101
+ }
43102
+ }
43103
+ }, apiOptions);
43104
+ }
43105
+ async insertItemByName(queueName, specificData, options = {}) {
43106
+ if (!queueName) {
43107
+ throw new ValidationError3({ message: "queueName is required for insertItemByName" });
43108
+ }
43109
+ const headers = resolveFolderHeaders({
43110
+ folderId: options.folderId,
43111
+ folderKey: options.folderKey,
43112
+ folderPath: options.folderPath,
43113
+ resourceType: "Queues.insertItemByName",
43114
+ fallbackFolderKey: this.config.folderKey
43115
+ });
43116
+ const response = await this.post(QUEUE_ENDPOINTS.ADD_ITEM, {
43117
+ itemData: {
43118
+ Name: queueName,
43119
+ Priority: options.priority ?? QueuePriority.Normal,
43120
+ Reference: options.reference,
43121
+ Progress: options.progress,
43122
+ DeferDate: options.deferDate?.toISOString(),
43123
+ DueDate: options.dueDate?.toISOString(),
43124
+ RiskSlaDate: options.riskSlaDate?.toISOString(),
43125
+ SpecificContent: specificData
43126
+ }
43127
+ }, { headers });
43128
+ return transformQueueItem(response.data);
43129
+ }
43130
+ async startTransaction(queue, options = {}) {
43131
+ const headers = resolveFolderHeaders({
43132
+ folderId: options.folderId,
43133
+ folderKey: options.folderKey,
43134
+ folderPath: options.folderPath,
43135
+ resourceType: "Queues.startTransaction",
43136
+ fallbackFolderKey: this.config.folderKey
43137
+ });
43138
+ let queueName;
43139
+ if (queue?.name) {
43140
+ queueName = queue.name;
43141
+ } else if (queue?.id != null) {
43142
+ queueName = await this.resolveQueueName(queue.id, headers);
43143
+ } else {
43144
+ throw new ValidationError3({ message: "queue id or name is required for startTransaction" });
43145
+ }
43146
+ const response = await this.post(QUEUE_ENDPOINTS.START_TRANSACTION, {
43147
+ transactionData: { Name: queueName }
43148
+ }, { headers });
43149
+ if (!response.data || typeof response.data !== "object") {
43150
+ return null;
43151
+ }
43152
+ return transformQueueItem(response.data);
43153
+ }
43154
+ async completeTransaction(itemId, outcome, options = {}) {
43155
+ if (!itemId) {
43156
+ throw new ValidationError3({ message: "itemId is required for completeTransaction" });
43157
+ }
43158
+ const headers = resolveFolderHeaders({
43159
+ folderId: options.folderId,
43160
+ folderKey: options.folderKey,
43161
+ folderPath: options.folderPath,
43162
+ resourceType: "Queues.completeTransaction",
43163
+ fallbackFolderKey: this.config.folderKey
43164
+ });
43165
+ const transactionResult = {
43166
+ IsSuccessful: outcome === QueueTransactionOutcome.Successful,
43167
+ ProcessingException: options.processingError && {
43168
+ Reason: options.processingError.reason,
43169
+ Details: options.processingError.details,
43170
+ Type: options.processingError.type,
43171
+ AssociatedImageFilePath: options.processingError.associatedImageFilePath
43172
+ },
43173
+ DeferDate: options.deferDate?.toISOString(),
43174
+ DueDate: options.dueDate?.toISOString(),
43175
+ Progress: options.progress,
43176
+ OperationId: options.operationId,
43177
+ Output: options.outputData,
43178
+ Analytics: options.analytics
43179
+ };
43180
+ await this.post(QUEUE_ENDPOINTS.SET_TRANSACTION_RESULT(itemId), { transactionResult }, { headers });
43181
+ }
43182
+ async resolveQueueName(queueId, headers) {
43183
+ const response = await this.get(QUEUE_ENDPOINTS.GET_BY_ID(queueId), { headers, params: { $select: "Name" } });
43184
+ return response.data.Name;
42303
43185
  }
42304
43186
  }
42305
43187
  __decorate([
@@ -42308,6 +43190,24 @@ __decorate([
42308
43190
  __decorate([
42309
43191
  track("Queues.GetById")
42310
43192
  ], QueueService.prototype, "getById", null);
43193
+ __decorate([
43194
+ track("Queues.GetByName")
43195
+ ], QueueService.prototype, "getByName", null);
43196
+ __decorate([
43197
+ track("Queues.GetByKey")
43198
+ ], QueueService.prototype, "getByKey", null);
43199
+ __decorate([
43200
+ track("Queues.GetAllItems")
43201
+ ], QueueService.prototype, "getAllItems", null);
43202
+ __decorate([
43203
+ track("Queues.InsertItemByName")
43204
+ ], QueueService.prototype, "insertItemByName", null);
43205
+ __decorate([
43206
+ track("Queues.StartTransaction")
43207
+ ], QueueService.prototype, "startTransaction", null);
43208
+ __decorate([
43209
+ track("Queues.CompleteTransaction")
43210
+ ], QueueService.prototype, "completeTransaction", null);
42311
43211
  var TaskCatalogMap = {
42312
43212
  creationTime: "createdTime",
42313
43213
  lastModificationTime: "lastModifiedTime"
@@ -42354,7 +43254,8 @@ class TaskCatalogService extends FolderScopedService {
42354
43254
  return transformData(pascalToCamelCaseKeys(response.data), TaskCatalogMap);
42355
43255
  }
42356
43256
  async getByName(name, options = {}) {
42357
- return this.getByNameLookup("TaskCatalog", TASK_CATALOG_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), TaskCatalogMap), TaskCatalogMap);
43257
+ const { result } = await this.getByNameLookup("TaskCatalog", TASK_CATALOG_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), TaskCatalogMap), TaskCatalogMap);
43258
+ return result;
42358
43259
  }
42359
43260
  async create(name, options = {}) {
42360
43261
  if (!name) {
@@ -42378,7 +43279,7 @@ class TaskCatalogService extends FolderScopedService {
42378
43279
  throw new ValidationError3({ message: "name is required for updateByName" });
42379
43280
  }
42380
43281
  const { folderId, folderKey, folderPath } = options;
42381
- const current = await this.getByNameLookup("TaskCatalog", TASK_CATALOG_ENDPOINTS.GET_ALL, name, { folderId, folderKey, folderPath }, (raw) => transformData(pascalToCamelCaseKeys(raw), TaskCatalogMap), TaskCatalogMap);
43282
+ const { result: current } = await this.getByNameLookup("TaskCatalog", TASK_CATALOG_ENDPOINTS.GET_ALL, name, { folderId, folderKey, folderPath }, (raw) => transformData(pascalToCamelCaseKeys(raw), TaskCatalogMap), TaskCatalogMap);
42382
43283
  return this.update(current, options);
42383
43284
  }
42384
43285
  async update(current, options) {
@@ -42523,6 +43424,13 @@ var AgentMap = {
42523
43424
  var UserSettingsMap = {
42524
43425
  ...CommonFieldMap
42525
43426
  };
43427
+ var ConnectionState;
43428
+ (function(ConnectionState2) {
43429
+ ConnectionState2["Enabled"] = "Enabled";
43430
+ ConnectionState2["Disabled"] = "Disabled";
43431
+ ConnectionState2["Expired"] = "Expired";
43432
+ ConnectionState2["Failed"] = "Failed";
43433
+ })(ConnectionState || (ConnectionState = {}));
42526
43434
  var FeedbackStatus;
42527
43435
  (function(FeedbackStatus2) {
42528
43436
  FeedbackStatus2[FeedbackStatus2["Pending"] = 0] = "Pending";
@@ -43409,4 +44317,4 @@ var registerCommands = async (program2) => {
43409
44317
 
43410
44318
  export { Command, metadata, registerCommands };
43411
44319
 
43412
- //# debugId=AA8CC418A164893E64756E2164756E21
44320
+ //# debugId=A07482DBEC73850A64756E2164756E21