@uipath/data-fabric-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.
@@ -6583,7 +6583,7 @@ var require_src6 = __commonJS(function(exports) {
6583
6583
  var package_default = {
6584
6584
  name: "@uipath/data-fabric-tool",
6585
6585
  license: "SEE LICENSE IN LICENSE.txt",
6586
- version: "1.202.0",
6586
+ version: "1.202.1-preview.167",
6587
6587
  description: "Manage Data Fabric entities and records.",
6588
6588
  publishConfig: {
6589
6589
  registry: "https://npm.pkg.github.com/"
@@ -6615,7 +6615,7 @@ var package_default = {
6615
6615
  "@uipath/filesystem": "workspace:*",
6616
6616
  "@uipath/packager-tool-datafabric": "workspace:*",
6617
6617
  "@uipath/solutionpackager-tool-core": "workspace:*",
6618
- "@uipath/uipath-typescript": "^1.6.1",
6618
+ "@uipath/uipath-typescript": "^1.7.1",
6619
6619
  commander: "^14.0.3",
6620
6620
  typescript: "^7.0.2"
6621
6621
  }
@@ -12043,7 +12043,7 @@ var allowsEval = cached(() => {
12043
12043
  return false;
12044
12044
  }
12045
12045
  });
12046
- function isPlainObject(o) {
12046
+ function isPlainObject$1(o) {
12047
12047
  if (isObject(o) === false)
12048
12048
  return false;
12049
12049
  const ctor = o.constructor;
@@ -12060,7 +12060,7 @@ function isPlainObject(o) {
12060
12060
  return true;
12061
12061
  }
12062
12062
  function shallowClone(o) {
12063
- if (isPlainObject(o))
12063
+ if (isPlainObject$1(o))
12064
12064
  return { ...o };
12065
12065
  if (Array.isArray(o))
12066
12066
  return [...o];
@@ -12148,7 +12148,7 @@ function omit(schema, mask) {
12148
12148
  return clone(schema, def);
12149
12149
  }
12150
12150
  function extend(schema, shape) {
12151
- if (!isPlainObject(shape)) {
12151
+ if (!isPlainObject$1(shape)) {
12152
12152
  throw new Error("Invalid input to extend: expected a plain object");
12153
12153
  }
12154
12154
  const checks = schema._zod.def.checks;
@@ -12171,7 +12171,7 @@ function extend(schema, shape) {
12171
12171
  return clone(schema, def);
12172
12172
  }
12173
12173
  function safeExtend(schema, shape) {
12174
- if (!isPlainObject(shape)) {
12174
+ if (!isPlainObject$1(shape)) {
12175
12175
  throw new Error("Invalid input to safeExtend: expected a plain object");
12176
12176
  }
12177
12177
  const def = mergeDefs(schema._zod.def, {
@@ -12508,6 +12508,7 @@ var string$1 = (params) => {
12508
12508
  const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
12509
12509
  return new RegExp(`^${regex}$`);
12510
12510
  };
12511
+ var boolean$1 = /^(?:true|false)$/i;
12511
12512
  var lowercase = /^[^A-Z]*$/;
12512
12513
  var uppercase = /^[^a-z]*$/;
12513
12514
  var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
@@ -13176,6 +13177,26 @@ var $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
13176
13177
  });
13177
13178
  };
13178
13179
  });
13180
+ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
13181
+ $ZodType.init(inst, def);
13182
+ inst._zod.pattern = boolean$1;
13183
+ inst._zod.parse = (payload, _ctx) => {
13184
+ if (def.coerce)
13185
+ try {
13186
+ payload.value = Boolean(payload.value);
13187
+ } catch (_) {}
13188
+ const input = payload.value;
13189
+ if (typeof input === "boolean")
13190
+ return payload;
13191
+ payload.issues.push({
13192
+ expected: "boolean",
13193
+ code: "invalid_type",
13194
+ input,
13195
+ inst
13196
+ });
13197
+ return payload;
13198
+ };
13199
+ });
13179
13200
  var $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
13180
13201
  $ZodType.init(inst, def);
13181
13202
  inst._zod.parse = (payload) => payload;
@@ -13546,7 +13567,7 @@ function mergeValues(a, b) {
13546
13567
  if (a instanceof Date && b instanceof Date && +a === +b) {
13547
13568
  return { valid: true, data: a };
13548
13569
  }
13549
- if (isPlainObject(a) && isPlainObject(b)) {
13570
+ if (isPlainObject$1(a) && isPlainObject$1(b)) {
13550
13571
  const bKeys = Object.keys(b);
13551
13572
  const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
13552
13573
  const newObj = { ...a, ...b };
@@ -13901,7 +13922,7 @@ function handleRefineResult(result, payload, input, inst) {
13901
13922
  payload.issues.push(issue(_iss));
13902
13923
  }
13903
13924
  }
13904
- var _a;
13925
+ var _a$1;
13905
13926
 
13906
13927
  class $ZodRegistry {
13907
13928
  constructor() {
@@ -13946,7 +13967,7 @@ class $ZodRegistry {
13946
13967
  function registry2() {
13947
13968
  return new $ZodRegistry;
13948
13969
  }
13949
- (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry2());
13970
+ (_a$1 = globalThis).__zod_globalRegistry ?? (_a$1.__zod_globalRegistry = registry2());
13950
13971
  var globalRegistry = globalThis.__zod_globalRegistry;
13951
13972
  function _string(Class, params) {
13952
13973
  return new Class({
@@ -14191,6 +14212,12 @@ function _isoDuration(Class, params) {
14191
14212
  ...normalizeParams(params)
14192
14213
  });
14193
14214
  }
14215
+ function _boolean(Class, params) {
14216
+ return new Class({
14217
+ type: "boolean",
14218
+ ...normalizeParams(params)
14219
+ });
14220
+ }
14194
14221
  function _unknown(Class) {
14195
14222
  return new Class({
14196
14223
  type: "unknown"
@@ -14356,7 +14383,7 @@ function initializeContext(params) {
14356
14383
  };
14357
14384
  }
14358
14385
  function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
14359
- var _a2;
14386
+ var _a;
14360
14387
  const def = schema._zod.def;
14361
14388
  const seen = ctx.seen.get(schema);
14362
14389
  if (seen) {
@@ -14404,7 +14431,7 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
14404
14431
  delete result.schema.default;
14405
14432
  }
14406
14433
  if (ctx.io === "input" && result.schema._prefault)
14407
- (_a2 = result.schema).default ?? (_a2.default = result.schema._prefault);
14434
+ (_a = result.schema).default ?? (_a.default = result.schema._prefault);
14408
14435
  delete result.schema._prefault;
14409
14436
  const _result = ctx.seen.get(schema);
14410
14437
  return _result.schema;
@@ -14721,6 +14748,9 @@ var stringProcessor = (schema, ctx, _json, _params) => {
14721
14748
  }
14722
14749
  }
14723
14750
  };
14751
+ var booleanProcessor = (_schema, _ctx, json, _params) => {
14752
+ json.type = "boolean";
14753
+ };
14724
14754
  var neverProcessor = (_schema, _ctx, json, _params) => {
14725
14755
  json.not = {};
14726
14756
  };
@@ -15179,6 +15209,14 @@ var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
15179
15209
  $ZodJWT.init(inst, def);
15180
15210
  ZodStringFormat.init(inst, def);
15181
15211
  });
15212
+ var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
15213
+ $ZodBoolean.init(inst, def);
15214
+ ZodType.init(inst, def);
15215
+ inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json);
15216
+ });
15217
+ function boolean(params) {
15218
+ return _boolean(ZodBoolean, params);
15219
+ }
15182
15220
  var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
15183
15221
  $ZodUnknown.init(inst, def);
15184
15222
  ZodType.init(inst, def);
@@ -15489,7 +15527,8 @@ object({
15489
15527
  secret: string().optional(),
15490
15528
  clientId: string().optional(),
15491
15529
  redirectUri: string().url().optional(),
15492
- scope: string().optional()
15530
+ scope: string().optional(),
15531
+ enforceSso: boolean().optional()
15493
15532
  });
15494
15533
 
15495
15534
  class UiPathConfig {
@@ -15501,6 +15540,7 @@ class UiPathConfig {
15501
15540
  this.clientId = options.clientId;
15502
15541
  this.redirectUri = options.redirectUri;
15503
15542
  this.scope = options.scope;
15543
+ this.enforceSso = options.enforceSso;
15504
15544
  }
15505
15545
  }
15506
15546
 
@@ -15703,6 +15743,7 @@ var TaskType;
15703
15743
  TaskType2["DocumentValidation"] = "DocumentValidationTask";
15704
15744
  TaskType2["DocumentClassification"] = "DocumentClassificationTask";
15705
15745
  TaskType2["DataLabeling"] = "DataLabelingTask";
15746
+ TaskType2["QuickForm"] = "QuickFormTask";
15706
15747
  })(TaskType || (TaskType = {}));
15707
15748
  var TaskPriority;
15708
15749
  (function(TaskPriority2) {
@@ -15815,7 +15856,11 @@ var PROCESS_ENDPOINTS = {
15815
15856
  var QUEUE_ENDPOINTS = {
15816
15857
  GET_BY_FOLDER: `${ORCHESTRATOR_BASE}/odata/QueueDefinitions`,
15817
15858
  GET_ALL: `${ORCHESTRATOR_BASE}/odata/QueueDefinitions/UiPath.Server.Configuration.OData.GetQueuesAcrossFolders`,
15818
- GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/QueueDefinitions(${id})`
15859
+ GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/QueueDefinitions(${id})`,
15860
+ GET_ITEMS: `${ORCHESTRATOR_BASE}/odata/QueueItems`,
15861
+ ADD_ITEM: `${ORCHESTRATOR_BASE}/odata/Queues/UiPathODataSvc.AddQueueItem`,
15862
+ START_TRANSACTION: `${ORCHESTRATOR_BASE}/odata/Queues/UiPathODataSvc.StartTransaction`,
15863
+ SET_TRANSACTION_RESULT: (itemId) => `${ORCHESTRATOR_BASE}/odata/Queues(${itemId})/UiPathODataSvc.SetTransactionResult`
15819
15864
  };
15820
15865
  var JOB_ENDPOINTS = {
15821
15866
  GET_ALL: `${ORCHESTRATOR_BASE}/odata/Jobs`,
@@ -15862,6 +15907,10 @@ var MAESTRO_ENDPOINTS = {
15862
15907
  TRACES: {
15863
15908
  GET_SPANS: (traceId) => `${LLMOPS_BASE}/api/Traces/spans?traceId=${traceId}`
15864
15909
  },
15910
+ BUSINESS_APPS: {
15911
+ COLLECTION: `${PIMS_BASE}/api/v1/business-apps`,
15912
+ BY_ID: (businessAppId) => `${PIMS_BASE}/api/v1/business-apps/${businessAppId}`
15913
+ },
15865
15914
  CASES: {
15866
15915
  GET_CASE_JSON: (instanceId) => `${PIMS_BASE}/api/v1/cases/${instanceId}/case-json`,
15867
15916
  GET_ELEMENT_EXECUTIONS: (instanceId) => `${PIMS_BASE}/api/v1/element-executions/case-instances/${instanceId}`,
@@ -15896,13 +15945,24 @@ var DATA_FABRIC_ENDPOINTS = {
15896
15945
  DELETE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/delete-batch`,
15897
15946
  UPSERT: `${DATAFABRIC_BASE}/api/Entity`,
15898
15947
  DELETE: (entityId) => `${DATAFABRIC_BASE}/api/Entity/${entityId}`,
15899
- UPDATE_METADATA: (entityId) => `${DATAFABRIC_BASE}/api/Entity/${entityId}/metadata`,
15948
+ UPDATE: (entityId) => `${DATAFABRIC_BASE}/api/Entity/${entityId}/metadata`,
15900
15949
  QUERY_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/query`,
15901
15950
  QUERY_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/query`,
15902
15951
  BULK_UPLOAD_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/bulk-upload`,
15903
15952
  DOWNLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
15904
15953
  UPLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
15905
- DELETE_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`
15954
+ DELETE_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
15955
+ GET_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/Entity/${entityName}/metadata`,
15956
+ GET_ENTITY_RECORDS_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/read`,
15957
+ GET_RECORD_BY_NAME: (entityName, recordId) => `${DATAFABRIC_BASE}/api/v2/EntityService/${entityName}/read/${recordId}`,
15958
+ INSERT_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/insert`,
15959
+ BATCH_INSERT_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/insert-batch`,
15960
+ UPDATE_RECORD_BY_NAME: (entityName, recordId) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/update/${recordId}`,
15961
+ UPDATE_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/update-batch`,
15962
+ DELETE_RECORD_BY_NAME: (entityName, recordId) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/delete/${recordId}`,
15963
+ DELETE_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/delete-batch`,
15964
+ BULK_UPLOAD_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/bulk-upload`,
15965
+ ATTACHMENT_BY_NAME: (entityName, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/${entityName}/${recordId}/${fieldName}`
15906
15966
  },
15907
15967
  CHOICESETS: {
15908
15968
  GET_ALL: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
@@ -15925,7 +15985,8 @@ var DATA_FABRIC_ENDPOINTS = {
15925
15985
  };
15926
15986
  var IDENTITY_ENDPOINTS = {
15927
15987
  TOKEN: `${IDENTITY_BASE}/connect/token`,
15928
- AUTHORIZE: `${IDENTITY_BASE}/connect/authorize`
15988
+ AUTHORIZE: `${IDENTITY_BASE}/connect/authorize`,
15989
+ END_SESSION: `${IDENTITY_BASE}/connect/endsession`
15929
15990
  };
15930
15991
  var TASK_TYPE_ENDPOINTS = {
15931
15992
  [TaskType.Form]: TASK_ENDPOINTS.GET_TASK_FORM_BY_ID,
@@ -15933,7 +15994,8 @@ var TASK_TYPE_ENDPOINTS = {
15933
15994
  [TaskType.DocumentValidation]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
15934
15995
  [TaskType.DocumentClassification]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
15935
15996
  [TaskType.External]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
15936
- [TaskType.DataLabeling]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID
15997
+ [TaskType.DataLabeling]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
15998
+ [TaskType.QuickForm]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID
15937
15999
  };
15938
16000
  var ActionCenterEventNames;
15939
16001
  (function(ActionCenterEventNames2) {
@@ -15941,29 +16003,12 @@ var ActionCenterEventNames;
15941
16003
  ActionCenterEventNames2["REFRESHTOKEN"] = "AC.refreshToken";
15942
16004
  })(ActionCenterEventNames || (ActionCenterEventNames = {}));
15943
16005
  var AUTHENTICATION_TIMEOUT = 8000;
15944
- var ALLOWED_HOST_ORIGINS = new Set([
15945
- "https://alpha.uipath.com",
15946
- "https://staging.uipath.com",
15947
- "https://cloud.uipath.com"
15948
- ]);
15949
- function isValidHostOrigin(origin) {
15950
- if (!origin)
15951
- return false;
15952
- if (ALLOWED_HOST_ORIGINS.has(origin))
15953
- return true;
15954
- try {
15955
- return new URL(origin).hostname === "localhost";
15956
- } catch {
15957
- console.warn("isValidHostOrigin: received a malformed origin URL", origin);
15958
- return false;
15959
- }
15960
- }
15961
16006
  function isTokenExpired(tokenInfo) {
15962
16007
  if (!tokenInfo?.expiresAt)
15963
16008
  return true;
15964
16009
  return new Date >= tokenInfo.expiresAt;
15965
16010
  }
15966
- var trustedEmbeddingOrigin = isHostEmbedded && embeddingOrigin && isValidHostOrigin(embeddingOrigin) ? embeddingOrigin : null;
16011
+ var hostEmbeddingOrigin = isHostEmbedded && embeddingOrigin ? embeddingOrigin : null;
15967
16012
  function waitForMessage(filter, signal) {
15968
16013
  return new Promise((resolve2, reject) => {
15969
16014
  const handler = (event) => {
@@ -16032,12 +16077,6 @@ class ActionCenterTokenManager {
16032
16077
  statusCode: HttpStatus.UNAUTHORIZED
16033
16078
  }));
16034
16079
  }
16035
- if (!isValidHostOrigin(parentOrigin)) {
16036
- return Promise.reject(new AuthenticationError({
16037
- message: "Cannot refresh token: basedomain is not a trusted UiPath host origin",
16038
- statusCode: HttpStatus.UNAUTHORIZED
16039
- }));
16040
- }
16041
16080
  const { promise } = requestHostToken({
16042
16081
  pinnedOrigin: parentOrigin,
16043
16082
  sendRequest: () => this.sendMessageToParent(ActionCenterEventNames.REFRESHTOKEN, {
@@ -16061,7 +16100,7 @@ class ActionCenterTokenManager {
16061
16100
  }
16062
16101
  }
16063
16102
  sendMessageToParent(eventType, content) {
16064
- if (window.parent && isValidHostOrigin(this.parentOrigin)) {
16103
+ if (window.parent && this.parentOrigin) {
16065
16104
  try {
16066
16105
  window.parent.postMessage({ eventType, content }, this.parentOrigin);
16067
16106
  } catch (error) {
@@ -16141,7 +16180,7 @@ class EmbeddedTokenManager {
16141
16180
  this.cancelRefresh?.();
16142
16181
  }
16143
16182
  }
16144
- var SDK_VERSION = "1.6.1";
16183
+ var SDK_VERSION = "1.7.1";
16145
16184
  var CLOUD_ROLE_NAME = "uipath-ts-sdk";
16146
16185
  var SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
16147
16186
  var SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
@@ -16207,19 +16246,21 @@ function base64UrlToBase64(value) {
16207
16246
  const base642 = value.replace(BASE64URL_DASH_RE, "+").replace(BASE64URL_UNDERSCORE_RE, "/");
16208
16247
  return base642.padEnd(base642.length + (4 - base642.length % 4) % 4, "=");
16209
16248
  }
16210
- function extractUserIdFromToken(token) {
16249
+ function decodeJwtClaims(token) {
16211
16250
  try {
16212
- const payload = token.split(".")[1];
16251
+ const payload = token?.split(".")[1];
16213
16252
  if (!payload) {
16214
- return "";
16253
+ return;
16215
16254
  }
16216
- const claims = JSON.parse(decodeBase64(base64UrlToBase64(payload)));
16217
- const sub = claims["sub"];
16218
- return typeof sub === "string" && sub ? sub : "";
16255
+ return JSON.parse(decodeBase64(base64UrlToBase64(payload)));
16219
16256
  } catch {
16220
- return "";
16257
+ return;
16221
16258
  }
16222
16259
  }
16260
+ function extractUserIdFromToken(token) {
16261
+ const sub = decodeJwtClaims(token)?.["sub"];
16262
+ return typeof sub === "string" && sub ? sub : "";
16263
+ }
16223
16264
 
16224
16265
  class TokenManager {
16225
16266
  constructor(executionContext, config2, isOAuth = false) {
@@ -16232,8 +16273,8 @@ class TokenManager {
16232
16273
  if (isInActionCenter) {
16233
16274
  this.actionCenterTokenManager = new ActionCenterTokenManager(config2, (tokenInfo) => this.setToken(tokenInfo));
16234
16275
  this.isOAuth = false;
16235
- } else if (trustedEmbeddingOrigin) {
16236
- this.embeddedTokenManager = new EmbeddedTokenManager(trustedEmbeddingOrigin, config2, (tokenInfo) => this.setToken(tokenInfo));
16276
+ } else if (hostEmbeddingOrigin) {
16277
+ this.embeddedTokenManager = new EmbeddedTokenManager(hostEmbeddingOrigin, config2, (tokenInfo) => this.setToken(tokenInfo));
16237
16278
  this.isOAuth = false;
16238
16279
  }
16239
16280
  }
@@ -16344,6 +16385,9 @@ class TokenManager {
16344
16385
  getToken() {
16345
16386
  return this.currentToken?.token;
16346
16387
  }
16388
+ getIdToken() {
16389
+ return this.currentToken?.idToken;
16390
+ }
16347
16391
  hasValidToken() {
16348
16392
  if (!this.currentToken) {
16349
16393
  return false;
@@ -16415,11 +16459,13 @@ class TokenManager {
16415
16459
  token: token.access_token,
16416
16460
  type: "oauth",
16417
16461
  expiresAt: new Date(Date.now() + token.expires_in * 1000),
16418
- refreshToken: token.refresh_token
16462
+ refreshToken: token.refresh_token,
16463
+ idToken: token.id_token ?? tokenInfo.idToken
16419
16464
  });
16420
16465
  return token;
16421
16466
  }
16422
16467
  }
16468
+ 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;
16423
16469
 
16424
16470
  class AuthService {
16425
16471
  constructor(config2, executionContext) {
@@ -16553,7 +16599,11 @@ class AuthService {
16553
16599
  hasValidToken() {
16554
16600
  return this.tokenManager.hasValidToken();
16555
16601
  }
16556
- logout() {
16602
+ logout(options) {
16603
+ const idTokenHint = options?.endSession ? this.tokenManager.getIdToken() : undefined;
16604
+ if (options?.endSession && isBrowser2 && !idTokenHint) {
16605
+ 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.");
16606
+ }
16557
16607
  this.tokenManager.clearToken();
16558
16608
  if (isBrowser2) {
16559
16609
  try {
@@ -16563,6 +16613,12 @@ class AuthService {
16563
16613
  console.warn("Failed to clear OAuth context from session storage", error);
16564
16614
  }
16565
16615
  }
16616
+ if (options?.endSession && isBrowser2 && idTokenHint) {
16617
+ window.location.href = this._buildEndSessionUrl({
16618
+ idTokenHint,
16619
+ postLogoutRedirectUri: this.config.redirectUri
16620
+ });
16621
+ }
16566
16622
  }
16567
16623
  getToken() {
16568
16624
  if (!this.tokenManager.hasValidToken()) {
@@ -16606,10 +16662,27 @@ class AuthService {
16606
16662
  redirect_uri: params.redirectUri,
16607
16663
  code_challenge: params.codeChallenge,
16608
16664
  code_challenge_method: "S256",
16609
- scope: params.scope + " offline_access",
16665
+ scope: params.scope + " offline_access openid",
16610
16666
  state: params.state || this.generateCodeVerifier().slice(0, 16)
16611
16667
  });
16612
- return `${this.config.baseUrl}/${IDENTITY_ENDPOINTS.AUTHORIZE}?${queryParams.toString()}`;
16668
+ const authorizeUrl = `${this.config.baseUrl}/${IDENTITY_ENDPOINTS.AUTHORIZE}?${queryParams.toString()}`;
16669
+ if (!this.config.enforceSso) {
16670
+ return authorizeUrl;
16671
+ }
16672
+ const orgName = this.config.orgName;
16673
+ if (!GUID_REGEX$1.test(orgName)) {
16674
+ 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.");
16675
+ return authorizeUrl;
16676
+ }
16677
+ return `${authorizeUrl}&acr_values=${encodeURIComponent(`tenant:${orgName}`)}`;
16678
+ }
16679
+ _buildEndSessionUrl(params) {
16680
+ const queryParams = new URLSearchParams;
16681
+ queryParams.set("id_token_hint", params.idTokenHint);
16682
+ if (params.postLogoutRedirectUri) {
16683
+ queryParams.set("post_logout_redirect_uri", params.postLogoutRedirectUri);
16684
+ }
16685
+ return `${this.config.baseUrl}/${IDENTITY_ENDPOINTS.END_SESSION}?${queryParams.toString()}`;
16613
16686
  }
16614
16687
  async _getAccessToken(params) {
16615
16688
  const body = new URLSearchParams({
@@ -16636,7 +16709,8 @@ class AuthService {
16636
16709
  token: token.access_token,
16637
16710
  type: "oauth",
16638
16711
  expiresAt: token.expires_in ? new Date(Date.now() + token.expires_in * 1000) : undefined,
16639
- refreshToken: token.refresh_token
16712
+ refreshToken: token.refresh_token,
16713
+ idToken: token.id_token
16640
16714
  });
16641
16715
  return token;
16642
16716
  }
@@ -16709,9 +16783,18 @@ function validateConfig(config2) {
16709
16783
  function isCompleteConfig(config2) {
16710
16784
  return hasRequiredBaseFields(config2) && hasValidAuthConfig(config2);
16711
16785
  }
16786
+ function compactConfig(config2) {
16787
+ return Object.fromEntries(Object.entries(config2).filter(([, value]) => value !== undefined));
16788
+ }
16712
16789
  function normalizeBaseUrl2(url) {
16713
16790
  return url.endsWith("/") ? url.slice(0, -1) : url;
16714
16791
  }
16792
+ function missingConfigMessage() {
16793
+ if (isBrowser2) {
16794
+ return "UiPath SDK configuration not found. " + "Ensure @uipath/coded-apps plugin is set up in your bundler to inject configuration during development and build.";
16795
+ }
16796
+ 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.";
16797
+ }
16715
16798
  var REGISTRY_KEY2 = Symbol.for("@uipath/sdk-internals-registry");
16716
16799
  var getGlobalStore = () => {
16717
16800
  const globalObj = globalThis;
@@ -16720,6 +16803,7 @@ var getGlobalStore = () => {
16720
16803
  }
16721
16804
  return globalObj[REGISTRY_KEY2];
16722
16805
  };
16806
+ var looksLikeUiPath = (instance) => typeof instance.initialize === "function";
16723
16807
 
16724
16808
  class SDKInternalsRegistry {
16725
16809
  static get store() {
@@ -16731,6 +16815,9 @@ class SDKInternalsRegistry {
16731
16815
  static get(instance) {
16732
16816
  const internals = this.store.get(instance);
16733
16817
  if (!internals) {
16818
+ if (looksLikeUiPath(instance)) {
16819
+ throw new Error("Cannot create a service: the UiPath instance was never configured. " + missingConfigMessage());
16820
+ }
16734
16821
  throw new Error("Invalid SDK instance. Make sure to pass a valid UiPath instance to the service constructor.");
16735
16822
  }
16736
16823
  return internals;
@@ -16748,6 +16835,10 @@ var UiPathMetaTags;
16748
16835
  UiPathMetaTags2["APP_BASE"] = "uipath:app-base";
16749
16836
  UiPathMetaTags2["FOLDER_KEY"] = "uipath:folder-key";
16750
16837
  })(UiPathMetaTags || (UiPathMetaTags = {}));
16838
+ var UiPathElementIds;
16839
+ (function(UiPathElementIds2) {
16840
+ UiPathElementIds2["RESOURCE_OVERRIDES"] = "uipath-overrides";
16841
+ })(UiPathElementIds || (UiPathElementIds = {}));
16751
16842
  function getMetaTagContent(name) {
16752
16843
  if (!isBrowser2)
16753
16844
  return;
@@ -16768,7 +16859,54 @@ function loadFromMetaTags() {
16768
16859
  const hasAnyValue = Object.values(config2).some(Boolean);
16769
16860
  return hasAnyValue ? config2 : null;
16770
16861
  }
16862
+ function readEnv(name) {
16863
+ const globals = globalThis;
16864
+ try {
16865
+ const fromNode = globals.process?.env?.[name];
16866
+ if (fromNode)
16867
+ return fromNode;
16868
+ } catch {}
16869
+ try {
16870
+ const fromDeno = globals.Deno?.env?.get?.(name);
16871
+ if (fromDeno)
16872
+ return fromDeno;
16873
+ } catch {}
16874
+ return;
16875
+ }
16876
+ var UiPathEnvVars = {
16877
+ BASE_URL: "UIPATH_BASE_URL",
16878
+ ORG_NAME: "UIPATH_ORG_NAME",
16879
+ TENANT_NAME: "UIPATH_TENANT_NAME",
16880
+ ACCESS_TOKEN: "UIPATH_ACCESS_TOKEN"
16881
+ };
16882
+ function loadFromEnvironment() {
16883
+ if (isBrowser2)
16884
+ return null;
16885
+ const config2 = {
16886
+ baseUrl: readEnv(UiPathEnvVars.BASE_URL),
16887
+ orgName: readEnv(UiPathEnvVars.ORG_NAME),
16888
+ tenantName: readEnv(UiPathEnvVars.TENANT_NAME),
16889
+ secret: readEnv(UiPathEnvVars.ACCESS_TOKEN)
16890
+ };
16891
+ return Object.values(config2).some(Boolean) ? config2 : null;
16892
+ }
16893
+ function isFunctionContext(value) {
16894
+ return "platform" in value || "robot" in value;
16895
+ }
16896
+ function configFromFunctionContext(context) {
16897
+ const { platform, robot } = context;
16898
+ if (!platform)
16899
+ return null;
16900
+ const config2 = {
16901
+ baseUrl: platform.baseUrl,
16902
+ orgName: platform.orgId,
16903
+ tenantName: platform.tenantId,
16904
+ secret: robot?.accessToken ?? undefined
16905
+ };
16906
+ return Object.values(config2).some(Boolean) ? config2 : null;
16907
+ }
16771
16908
  var _UiPath_instances;
16909
+ var _a;
16772
16910
  var _UiPath_config;
16773
16911
  var _UiPath_authService;
16774
16912
  var _UiPath_initialized;
@@ -16777,6 +16915,7 @@ var _UiPath_metaFolderKey;
16777
16915
  var _UiPath_metaOrgId;
16778
16916
  var _UiPath_metaTenantId;
16779
16917
  var _UiPath_initializeWithConfig;
16918
+ var _UiPath_mergeConfigSources;
16780
16919
  var _UiPath_loadConfig;
16781
16920
  var UiPath$1 = class UiPath {
16782
16921
  constructor(config2) {
@@ -16788,15 +16927,16 @@ var UiPath$1 = class UiPath {
16788
16927
  _UiPath_metaFolderKey.set(this, undefined);
16789
16928
  _UiPath_metaOrgId.set(this, undefined);
16790
16929
  _UiPath_metaTenantId.set(this, undefined);
16930
+ const resolved = config2 && isFunctionContext(config2) ? configFromFunctionContext(config2) ?? undefined : config2;
16791
16931
  const configFromMetaTags = loadFromMetaTags();
16792
16932
  __classPrivateFieldSet(this, _UiPath_metaFolderKey, configFromMetaTags?.folderKey, "f");
16793
16933
  __classPrivateFieldSet(this, _UiPath_metaOrgId, configFromMetaTags?.orgName, "f");
16794
16934
  __classPrivateFieldSet(this, _UiPath_metaTenantId, configFromMetaTags?.tenantName, "f");
16795
- const mergedConfig = config2 ? { ...configFromMetaTags, ...config2 } : configFromMetaTags;
16935
+ const mergedConfig = __classPrivateFieldGet(_a, _a, "m", _UiPath_mergeConfigSources).call(_a, configFromMetaTags, resolved);
16796
16936
  if (mergedConfig && isCompleteConfig(mergedConfig)) {
16797
16937
  __classPrivateFieldGet(this, _UiPath_instances, "m", _UiPath_initializeWithConfig).call(this, mergedConfig);
16798
- } else if (config2) {
16799
- __classPrivateFieldSet(this, _UiPath_partialConfig, config2, "f");
16938
+ } else if (resolved) {
16939
+ __classPrivateFieldSet(this, _UiPath_partialConfig, resolved, "f");
16800
16940
  }
16801
16941
  }
16802
16942
  async initialize() {
@@ -16861,18 +17001,18 @@ var UiPath$1 = class UiPath {
16861
17001
  destroy() {
16862
17002
  __classPrivateFieldGet(this, _UiPath_authService, "f")?.getTokenManager()?.destroy();
16863
17003
  }
16864
- logout() {
17004
+ logout(options) {
16865
17005
  if (__classPrivateFieldGet(this, _UiPath_config, "f") && hasSecretConfig(__classPrivateFieldGet(this, _UiPath_config, "f"))) {
16866
17006
  return;
16867
17007
  }
16868
- __classPrivateFieldGet(this, _UiPath_authService, "f")?.logout();
17008
+ __classPrivateFieldGet(this, _UiPath_authService, "f")?.logout(options);
16869
17009
  __classPrivateFieldSet(this, _UiPath_initialized, false, "f");
16870
17010
  }
16871
17011
  updateToken(tokenInfo) {
16872
17012
  __classPrivateFieldGet(this, _UiPath_authService, "f")?.updateToken(tokenInfo);
16873
17013
  }
16874
17014
  };
16875
- _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(config2) {
17015
+ _a = 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(config2) {
16876
17016
  validateConfig(config2);
16877
17017
  const hasSecretAuth = hasSecretConfig(config2);
16878
17018
  const hasOAuthAuth = hasOAuthConfig(config2);
@@ -16883,7 +17023,8 @@ _UiPath_config = new WeakMap, _UiPath_authService = new WeakMap, _UiPath_initial
16883
17023
  secret: hasSecretAuth ? config2.secret : undefined,
16884
17024
  clientId: hasOAuthAuth ? config2.clientId : undefined,
16885
17025
  redirectUri: hasOAuthAuth ? config2.redirectUri : undefined,
16886
- scope: hasOAuthAuth ? config2.scope : undefined
17026
+ scope: hasOAuthAuth ? config2.scope : undefined,
17027
+ enforceSso: config2.enforceSso
16887
17028
  });
16888
17029
  const executionContext = new ExecutionContext;
16889
17030
  __classPrivateFieldSet(this, _UiPath_authService, new AuthService(internalConfig, executionContext), "f");
@@ -16909,18 +17050,35 @@ _UiPath_config = new WeakMap, _UiPath_authService = new WeakMap, _UiPath_initial
16909
17050
  redirectUri: hasOAuthAuth ? config2.redirectUri : undefined
16910
17051
  });
16911
17052
  trackEvent("Sdk.Auth");
16912
- if (hasSecretAuth || isInActionCenter || trustedEmbeddingOrigin) {
17053
+ if (hasSecretAuth || isInActionCenter || hostEmbeddingOrigin) {
16913
17054
  __classPrivateFieldGet(this, _UiPath_authService, "f").authenticateWithSecret(config2.secret ?? "");
16914
17055
  __classPrivateFieldSet(this, _UiPath_initialized, true, "f");
16915
17056
  }
17057
+ }, _UiPath_mergeConfigSources = function _UiPath_mergeConfigSources2(metaConfig, config2) {
17058
+ const layers = [loadFromEnvironment(), metaConfig, config2].filter((layer) => Boolean(layer)).map((layer) => compactConfig(layer));
17059
+ if (layers.length === 0)
17060
+ return;
17061
+ const merged = layers.reduce((acc, layer) => ({ ...acc, ...layer }), {});
17062
+ const namesSecret = config2 ? hasSecretConfig(config2) : false;
17063
+ const namesOAuth = Boolean(config2?.clientId || config2?.redirectUri || config2?.scope);
17064
+ if (namesSecret !== namesOAuth) {
17065
+ if (namesSecret) {
17066
+ delete merged.clientId;
17067
+ delete merged.redirectUri;
17068
+ delete merged.scope;
17069
+ } else {
17070
+ delete merged.secret;
17071
+ }
17072
+ }
17073
+ return merged;
16916
17074
  }, _UiPath_loadConfig = function _UiPath_loadConfig2() {
16917
17075
  const metaConfig = loadFromMetaTags();
16918
17076
  __classPrivateFieldSet(this, _UiPath_metaFolderKey, metaConfig?.folderKey, "f");
16919
17077
  __classPrivateFieldSet(this, _UiPath_metaOrgId, metaConfig?.orgName, "f");
16920
17078
  __classPrivateFieldSet(this, _UiPath_metaTenantId, metaConfig?.tenantName, "f");
16921
- const merged = { ...metaConfig, ...__classPrivateFieldGet(this, _UiPath_partialConfig, "f") };
16922
- if (!isCompleteConfig(merged)) {
16923
- 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.");
17079
+ const merged = __classPrivateFieldGet(_a, _a, "m", _UiPath_mergeConfigSources).call(_a, metaConfig, __classPrivateFieldGet(this, _UiPath_partialConfig, "f"));
17080
+ if (!merged || !isCompleteConfig(merged)) {
17081
+ throw new Error(missingConfigMessage());
16924
17082
  }
16925
17083
  return merged;
16926
17084
  };
@@ -17098,8 +17256,177 @@ var RESPONSE_TYPES = {
17098
17256
  JSON: "json",
17099
17257
  TEXT: "text",
17100
17258
  BLOB: "blob",
17101
- ARRAYBUFFER: "arraybuffer"
17259
+ ARRAYBUFFER: "arraybuffer",
17260
+ STREAM: "stream"
17261
+ };
17262
+ function createParams(paramsObj = {}) {
17263
+ const params = {};
17264
+ for (const [key, value] of Object.entries(paramsObj)) {
17265
+ if (value !== undefined && value !== null) {
17266
+ params[key] = value;
17267
+ }
17268
+ }
17269
+ return params;
17270
+ }
17271
+ function toSearchParams(params) {
17272
+ const searchParams = new URLSearchParams;
17273
+ if (!params)
17274
+ return searchParams;
17275
+ for (const [key, value] of Object.entries(params)) {
17276
+ if (value === undefined || value === null)
17277
+ continue;
17278
+ if (Array.isArray(value)) {
17279
+ value.forEach((item) => {
17280
+ if (item !== undefined && item !== null)
17281
+ searchParams.append(key, String(item));
17282
+ });
17283
+ } else {
17284
+ searchParams.append(key, String(value));
17285
+ }
17286
+ }
17287
+ return searchParams;
17288
+ }
17289
+ var DEFAULT_RETRYABLE_STATUS_CODES = [408, 429, 500, 502, 503, 504];
17290
+ var DEFAULT_RETRY_METHODS = ["GET", "HEAD", "PUT", "DELETE", "OPTIONS"];
17291
+ var DEFAULT_RETRY_OPTIONS = {
17292
+ maxRetries: 2,
17293
+ initialDelayMs: 500,
17294
+ backoffStrategy: "exponential",
17295
+ backoffFactor: 2,
17296
+ backoffMaxDelayMs: 30000,
17297
+ retryableStatusCodes: DEFAULT_RETRYABLE_STATUS_CODES,
17298
+ retryMethods: DEFAULT_RETRY_METHODS,
17299
+ retryNetworkErrors: true,
17300
+ respectRetryAfter: true,
17301
+ maxRetryAfterMs: Infinity
17102
17302
  };
17303
+ var DEFAULT_API_CLIENT_RETRY = {
17304
+ ...DEFAULT_RETRY_OPTIONS,
17305
+ maxRetries: 0
17306
+ };
17307
+ function resolveRetryOptions(settings, defaults = DEFAULT_RETRY_OPTIONS) {
17308
+ if (!settings)
17309
+ return defaults;
17310
+ const { retryDelay, useExponentialBackoff, ...live } = settings;
17311
+ const resolved = { ...defaults };
17312
+ for (const [key, value] of Object.entries(live)) {
17313
+ if (value !== undefined) {
17314
+ resolved[key] = value;
17315
+ }
17316
+ }
17317
+ if (retryDelay !== undefined && live.initialDelayMs === undefined) {
17318
+ resolved.initialDelayMs = retryDelay;
17319
+ }
17320
+ if (useExponentialBackoff !== undefined && live.backoffStrategy === undefined) {
17321
+ resolved.backoffStrategy = useExponentialBackoff ? "exponential" : "constant";
17322
+ }
17323
+ return resolved;
17324
+ }
17325
+ function computeBackoffDelay(attempt, settings) {
17326
+ const base = Math.max(0, settings.initialDelayMs);
17327
+ let delay;
17328
+ switch (settings.backoffStrategy) {
17329
+ case "constant":
17330
+ delay = base;
17331
+ break;
17332
+ case "linear":
17333
+ delay = base * (attempt + 1);
17334
+ break;
17335
+ default:
17336
+ delay = base * Math.pow(settings.backoffFactor, attempt);
17337
+ }
17338
+ return Math.min(delay, settings.backoffMaxDelayMs);
17339
+ }
17340
+ function parseRetryAfter(value, now = Date.now()) {
17341
+ const trimmed = value?.trim();
17342
+ if (!trimmed)
17343
+ return;
17344
+ const seconds = Number(trimmed);
17345
+ if (Number.isFinite(seconds))
17346
+ return Math.max(0, seconds * 1000);
17347
+ const date2 = Date.parse(trimmed);
17348
+ if (Number.isNaN(date2))
17349
+ return;
17350
+ return Math.max(0, date2 - now);
17351
+ }
17352
+ function wait(durationMs) {
17353
+ return new Promise((resolve2) => setTimeout(resolve2, Math.max(0, durationMs)));
17354
+ }
17355
+ var RETRY_AFTER = "retry-after";
17356
+ function createAttemptSignal(timeoutMs, external) {
17357
+ if (timeoutMs === undefined || !Number.isFinite(timeoutMs))
17358
+ return { signal: external, dispose: () => {} };
17359
+ const controller = new AbortController;
17360
+ const timer = setTimeout(() => controller.abort(new Error(`Request timeout after ${timeoutMs}ms`)), timeoutMs);
17361
+ const onExternalAbort = () => controller.abort(external?.reason);
17362
+ if (external) {
17363
+ if (external.aborted) {
17364
+ controller.abort(external.reason);
17365
+ } else {
17366
+ external.addEventListener("abort", onExternalAbort);
17367
+ }
17368
+ }
17369
+ return {
17370
+ signal: controller.signal,
17371
+ dispose: () => {
17372
+ clearTimeout(timer);
17373
+ external?.removeEventListener("abort", onExternalAbort);
17374
+ }
17375
+ };
17376
+ }
17377
+ function delayBeforeRetry(durationMs, signal) {
17378
+ if (!signal)
17379
+ return wait(durationMs);
17380
+ if (signal.aborted)
17381
+ return Promise.reject(signal.reason);
17382
+ return new Promise((resolve2, reject) => {
17383
+ const onAbort = () => {
17384
+ clearTimeout(timer);
17385
+ reject(signal.reason);
17386
+ };
17387
+ const timer = setTimeout(() => {
17388
+ signal.removeEventListener("abort", onAbort);
17389
+ resolve2();
17390
+ }, Math.max(0, durationMs));
17391
+ signal.addEventListener("abort", onAbort);
17392
+ });
17393
+ }
17394
+ async function fetchWithRetry(url, init, options) {
17395
+ const settings = options.retry;
17396
+ const method = (init.method ?? "GET").toUpperCase();
17397
+ const retriesAllowed = settings.retryMethods.includes(method) ? Math.max(0, settings.maxRetries) : 0;
17398
+ let attempt = 0;
17399
+ for (;; ) {
17400
+ const { signal, dispose } = createAttemptSignal(options.timeoutMs, options.signal);
17401
+ let response;
17402
+ let failure;
17403
+ try {
17404
+ response = await fetch(url, { ...init, signal });
17405
+ } catch (error) {
17406
+ failure = error;
17407
+ } finally {
17408
+ dispose();
17409
+ }
17410
+ if (options.signal?.aborted && failure !== undefined)
17411
+ throw failure;
17412
+ if (response && !settings.retryableStatusCodes.includes(response.status))
17413
+ return response;
17414
+ if (failure !== undefined && !settings.retryNetworkErrors)
17415
+ throw failure;
17416
+ if (attempt >= retriesAllowed) {
17417
+ if (response)
17418
+ return response;
17419
+ throw failure;
17420
+ }
17421
+ const retryAfter = settings.respectRetryAfter && response ? parseRetryAfter(response.headers.get(RETRY_AFTER)) : undefined;
17422
+ const delay = retryAfter !== undefined ? Math.min(retryAfter, settings.maxRetryAfterMs) : computeBackoffDelay(attempt, settings);
17423
+ response?.body?.cancel().catch((error) => {
17424
+ console.warn("[UiPath SDK] Could not release a discarded response body:", error);
17425
+ });
17426
+ await delayBeforeRetry(delay, options.signal);
17427
+ attempt++;
17428
+ }
17429
+ }
17103
17430
 
17104
17431
  class ApiClient {
17105
17432
  constructor(config2, executionContext, tokenManager, clientConfig = {}) {
@@ -17134,28 +17461,16 @@ class ApiClient {
17134
17461
  [UIPATH_TRACEPARENT_ID]: traceparentValue,
17135
17462
  ...options.headers
17136
17463
  };
17137
- const searchParams = new URLSearchParams;
17138
- if (options.params) {
17139
- Object.entries(options.params).forEach(([key, value]) => {
17140
- if (Array.isArray(value)) {
17141
- value.forEach((item) => searchParams.append(key, String(item)));
17142
- } else {
17143
- searchParams.append(key, String(value));
17144
- }
17145
- });
17146
- }
17464
+ const searchParams = toSearchParams(options.params);
17147
17465
  const fullUrl = searchParams.toString() ? `${url}?${searchParams.toString()}` : url;
17148
17466
  let body = undefined;
17149
17467
  if (options.body) {
17150
17468
  body = isFormData ? options.body : JSON.stringify(options.body);
17151
17469
  }
17470
+ const retrySettings = resolveRetryOptions(options.retry ?? options.retryOptions, DEFAULT_API_CLIENT_RETRY);
17471
+ const timeoutMs = options.timeoutMs ?? options.timeoutOptions?.timeout;
17152
17472
  try {
17153
- const response = await fetch(fullUrl, {
17154
- method,
17155
- headers,
17156
- body,
17157
- signal: options.signal
17158
- });
17473
+ const response = await fetchWithRetry(fullUrl, { method, headers, body }, { retry: retrySettings, timeoutMs, signal: options.signal });
17159
17474
  if (!response.ok) {
17160
17475
  const errorInfo = await errorResponseParser.parse(response);
17161
17476
  throw ErrorFactory.createFromHttpStatus(response.status, errorInfo);
@@ -17871,36 +18186,36 @@ function createEntityMethods(entityData, service) {
17871
18186
  async insertRecord(data, options) {
17872
18187
  if (!entityData.id)
17873
18188
  throw new Error("Entity ID is undefined");
17874
- return service.insertRecordById(entityData.id, data, options);
18189
+ return service.insertRecord({ id: entityData.id }, data, options);
17875
18190
  },
17876
18191
  async insertRecords(data, options) {
17877
18192
  if (!entityData.id)
17878
18193
  throw new Error("Entity ID is undefined");
17879
- return service.insertRecordsById(entityData.id, data, options);
18194
+ return service.insertRecords({ id: entityData.id }, data, options);
17880
18195
  },
17881
18196
  async updateRecord(recordId, data, options) {
17882
18197
  if (!entityData.id)
17883
18198
  throw new Error("Entity ID is undefined");
17884
18199
  if (!recordId)
17885
18200
  throw new Error("Record ID is undefined");
17886
- return service.updateRecordById(entityData.id, recordId, data, options);
18201
+ return service.updateRecord({ id: entityData.id }, recordId, data, options);
17887
18202
  },
17888
18203
  async updateRecords(data, options) {
17889
18204
  if (!entityData.id)
17890
18205
  throw new Error("Entity ID is undefined");
17891
- return service.updateRecordsById(entityData.id, data, options);
18206
+ return service.updateRecords({ id: entityData.id }, data, options);
17892
18207
  },
17893
18208
  async deleteRecords(recordIds, options) {
17894
18209
  if (!entityData.id)
17895
18210
  throw new Error("Entity ID is undefined");
17896
- return service.deleteRecordsById(entityData.id, recordIds, options);
18211
+ return service.deleteRecords({ id: entityData.id }, recordIds, options);
17897
18212
  },
17898
18213
  async deleteRecord(recordId, options) {
17899
18214
  if (!entityData.id)
17900
18215
  throw new Error("Entity ID is undefined");
17901
18216
  if (!recordId)
17902
18217
  throw new Error("Record ID is undefined");
17903
- return service.deleteRecordById(entityData.id, recordId, options);
18218
+ return service.deleteRecord({ id: entityData.id }, recordId, options);
17904
18219
  },
17905
18220
  async getAllRecords(options) {
17906
18221
  if (!entityData.id)
@@ -17917,27 +18232,27 @@ function createEntityMethods(entityData, service) {
17917
18232
  async downloadAttachment(recordId, fieldName, options) {
17918
18233
  if (!entityData.id)
17919
18234
  throw new Error("Entity ID is undefined");
17920
- return service.downloadAttachment(entityData.id, recordId, fieldName, options);
18235
+ return service.downloadAttachment({ id: entityData.id }, recordId, fieldName, options);
17921
18236
  },
17922
18237
  async uploadAttachment(recordId, fieldName, file, options) {
17923
18238
  if (!entityData.id)
17924
18239
  throw new Error("Entity ID is undefined");
17925
- return service.uploadAttachment(entityData.id, recordId, fieldName, file, options);
18240
+ return service.uploadAttachment({ id: entityData.id }, recordId, fieldName, file, options);
17926
18241
  },
17927
18242
  async deleteAttachment(recordId, fieldName, options) {
17928
18243
  if (!entityData.id)
17929
18244
  throw new Error("Entity ID is undefined");
17930
- return service.deleteAttachment(entityData.id, recordId, fieldName, options);
18245
+ return service.deleteAttachment({ id: entityData.id }, recordId, fieldName, options);
17931
18246
  },
17932
18247
  async queryRecords(options) {
17933
18248
  if (!entityData.id)
17934
18249
  throw new Error("Entity ID is undefined");
17935
- return service.queryRecordsById(entityData.id, options);
18250
+ return service.queryRecords({ id: entityData.id }, options);
17936
18251
  },
17937
18252
  async importRecords(file, options) {
17938
18253
  if (!entityData.id)
17939
18254
  throw new Error("Entity ID is undefined");
17940
- return service.importRecordsById(entityData.id, file, options);
18255
+ return service.importRecords({ id: entityData.id }, file, options);
17941
18256
  },
17942
18257
  async insert(data, options) {
17943
18258
  return this.insertRecord(data, options);
@@ -18013,6 +18328,15 @@ var EntityAggregateFunction;
18013
18328
  EntityAggregateFunction2["Min"] = "MIN";
18014
18329
  EntityAggregateFunction2["Max"] = "MAX";
18015
18330
  })(EntityAggregateFunction || (EntityAggregateFunction = {}));
18331
+ var EntityHavingOperator;
18332
+ (function(EntityHavingOperator2) {
18333
+ EntityHavingOperator2["Equals"] = "=";
18334
+ EntityHavingOperator2["NotEquals"] = "!=";
18335
+ EntityHavingOperator2["GreaterThan"] = ">";
18336
+ EntityHavingOperator2["GreaterThanOrEqual"] = ">=";
18337
+ EntityHavingOperator2["LessThan"] = "<";
18338
+ EntityHavingOperator2["LessThanOrEqual"] = "<=";
18339
+ })(EntityHavingOperator || (EntityHavingOperator = {}));
18016
18340
  var EntityType;
18017
18341
  (function(EntityType2) {
18018
18342
  EntityType2["Entity"] = "Entity";
@@ -18043,15 +18367,6 @@ var JoinType;
18043
18367
  JoinType2["LeftJoin"] = "LeftJoin";
18044
18368
  JoinType2["InnerJoin"] = "InnerJoin";
18045
18369
  })(JoinType || (JoinType = {}));
18046
- function createParams(paramsObj = {}) {
18047
- const params = {};
18048
- for (const [key, value] of Object.entries(paramsObj)) {
18049
- if (value !== undefined && value !== null) {
18050
- params[key] = value;
18051
- }
18052
- }
18053
- return params;
18054
- }
18055
18370
  var EntityFieldConstraint;
18056
18371
  (function(EntityFieldConstraint2) {
18057
18372
  EntityFieldConstraint2["LengthLimit"] = "lengthLimit";
@@ -18190,95 +18505,84 @@ function toWireJoin(join2, baseEntityName) {
18190
18505
  }
18191
18506
  };
18192
18507
  }
18508
+ function unwrapEntityRef(entityRef, callerLabel) {
18509
+ const { id, name } = entityRef ?? {};
18510
+ if (id && name) {
18511
+ throw new ValidationError({
18512
+ message: `${callerLabel}: entityRef must supply exactly one of 'id' or 'name', not both.`
18513
+ });
18514
+ }
18515
+ if (id) {
18516
+ return { byId: true, identifier: id };
18517
+ }
18518
+ if (name) {
18519
+ return { byId: false, identifier: name };
18520
+ }
18521
+ throw new ValidationError({
18522
+ message: `${callerLabel}: entityRef must supply exactly one of 'id' or 'name'.`
18523
+ });
18524
+ }
18193
18525
 
18194
18526
  class EntityService extends BaseService {
18195
18527
  async getById(id, options) {
18196
- const response = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_ID(id), { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
18197
- const metadata = transformData(response.data, EntityMap);
18198
- this.applyFieldMappings(metadata);
18199
- return createEntityWithMethods(metadata, this);
18528
+ return this.fetchEntityMetadata(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_ID(id), options?.folderKey);
18529
+ }
18530
+ async getByName(entityName, options) {
18531
+ return this.fetchEntityMetadata(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_NAME(entityName), options?.folderKey);
18200
18532
  }
18201
18533
  async getAllRecords(entityId, options) {
18202
- const { folderKey, ...rest } = options ?? {};
18203
- const downstreamOptions = options === undefined ? undefined : rest;
18204
- return PaginationHelpers.getAll({
18205
- serviceAccess: this.createPaginationServiceAccess(),
18206
- getEndpoint: () => DATA_FABRIC_ENDPOINTS.ENTITY.GET_ENTITY_RECORDS(entityId),
18207
- headers: createHeaders({ [FOLDER_KEY]: folderKey }),
18208
- pagination: {
18209
- paginationType: PaginationType.OFFSET,
18210
- itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
18211
- totalCountField: ENTITY_PAGINATION.TOTAL_COUNT_FIELD,
18212
- paginationParams: {
18213
- pageSizeParam: ENTITY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
18214
- offsetParam: ENTITY_OFFSET_PARAMS.OFFSET_PARAM,
18215
- countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
18216
- }
18217
- },
18218
- excludeFromPrefix: ["expansionLevel"]
18219
- }, downstreamOptions);
18534
+ return this.getRecordsImpl(true, entityId, options);
18535
+ }
18536
+ async getRecordsByName(entityName, options) {
18537
+ return this.getRecordsImpl(false, entityName, options);
18220
18538
  }
18221
18539
  async getRecordById(entityId, recordId, options = {}) {
18222
- const params = createParams({
18223
- expansionLevel: options.expansionLevel
18224
- });
18225
- const response = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.GET_RECORD_BY_ID(entityId, recordId), { params, headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
18226
- return response.data;
18540
+ return this.getRecordImpl(true, entityId, recordId, options);
18541
+ }
18542
+ async getRecordByName(entityName, recordId, options = {}) {
18543
+ return this.getRecordImpl(false, entityName, recordId, options);
18544
+ }
18545
+ async insertRecord(entityRef, data, options = {}) {
18546
+ const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.insertRecord");
18547
+ return this.insertRecordImpl(byId, identifier, data, options);
18227
18548
  }
18228
18549
  async insertRecordById(id, data, options = {}) {
18229
- const params = createParams({
18230
- expansionLevel: options.expansionLevel
18231
- });
18232
- const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.INSERT_BY_ID(id), data, {
18233
- params,
18234
- headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
18235
- });
18236
- return response.data;
18550
+ return this.insertRecordImpl(true, id, data, options);
18551
+ }
18552
+ async insertRecords(entityRef, data, options = {}) {
18553
+ const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.insertRecords");
18554
+ return this.insertRecordsImpl(byId, identifier, data, options);
18237
18555
  }
18238
18556
  async insertRecordsById(id, data, options = {}) {
18239
- const params = createParams({
18240
- expansionLevel: options.expansionLevel,
18241
- failOnFirst: options.failOnFirst
18242
- });
18243
- const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.BATCH_INSERT_BY_ID(id), data, {
18244
- params,
18245
- headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
18246
- });
18247
- return response.data;
18557
+ return this.insertRecordsImpl(true, id, data, options);
18558
+ }
18559
+ async updateRecord(entityRef, recordId, data, options = {}) {
18560
+ const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.updateRecord");
18561
+ return this.updateRecordImpl(byId, identifier, recordId, data, options);
18248
18562
  }
18249
18563
  async updateRecordById(entityId, recordId, data, options = {}) {
18250
- const params = createParams({
18251
- expansionLevel: options.expansionLevel
18252
- });
18253
- const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_RECORD_BY_ID(entityId, recordId), data, {
18254
- params,
18255
- headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
18256
- });
18257
- return response.data;
18564
+ return this.updateRecordImpl(true, entityId, recordId, data, options);
18565
+ }
18566
+ async updateRecords(entityRef, data, options = {}) {
18567
+ const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.updateRecords");
18568
+ return this.updateRecordsImpl(byId, identifier, data, options);
18258
18569
  }
18259
18570
  async updateRecordsById(id, data, options = {}) {
18260
- const params = createParams({
18261
- expansionLevel: options.expansionLevel,
18262
- failOnFirst: options.failOnFirst
18263
- });
18264
- const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_BY_ID(id), data, {
18265
- params,
18266
- headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
18267
- });
18268
- return response.data;
18571
+ return this.updateRecordsImpl(true, id, data, options);
18572
+ }
18573
+ async deleteRecords(entityRef, recordIds, options = {}) {
18574
+ const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.deleteRecords");
18575
+ return this.deleteRecordsImpl(byId, identifier, recordIds, options);
18269
18576
  }
18270
18577
  async deleteRecordsById(id, recordIds, options = {}) {
18271
- const params = createParams({
18272
- failOnFirst: options.failOnFirst
18273
- });
18274
- const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_BY_ID(id), recordIds, {
18275
- params,
18276
- headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
18277
- });
18278
- return response.data;
18578
+ return this.deleteRecordsImpl(true, id, recordIds, options);
18579
+ }
18580
+ async deleteRecord(entityRef, recordId, options) {
18581
+ const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.deleteRecord");
18582
+ return this.deleteRecordImpl(byId, identifier, recordId, options);
18279
18583
  }
18280
18584
  async deleteRecordById(entityId, recordId, options) {
18281
- await this.delete(DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_RECORD_BY_ID(entityId, recordId), { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
18585
+ return this.deleteRecordImpl(true, entityId, recordId, options);
18282
18586
  }
18283
18587
  async getAll(options) {
18284
18588
  const endpoint = !options?.folderKey && options?.includeFolderEntities ? DATA_FABRIC_ENDPOINTS.ENTITY.GET_ALL_V2 : DATA_FABRIC_ENDPOINTS.ENTITY.GET_ALL;
@@ -18290,62 +18594,30 @@ class EntityService extends BaseService {
18290
18594
  });
18291
18595
  return entities;
18292
18596
  }
18597
+ async queryRecords(entityRef, options) {
18598
+ const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.queryRecords");
18599
+ return this.queryRecordsImpl(byId, identifier, options);
18600
+ }
18293
18601
  async queryRecordsById(id, options) {
18294
- if (options?.joins && options.joins.length > MAX_QUERY_JOINS) {
18295
- throw new ValidationError({
18296
- message: `A maximum of ${MAX_QUERY_JOINS} joins is supported per query (received ${options.joins.length})`
18297
- });
18298
- }
18299
- if (options?.joins && options.joins.length > 0 && !options.selectedFields?.length && !options.aggregates?.length) {
18300
- throw new ValidationError({
18301
- message: 'Join queries require selectedFields or aggregates — reference fields as "<EntityName>.<FieldName>" (e.g. "Customer.name")'
18302
- });
18303
- }
18304
- const { folderKey, expansionLevel, ...rest } = options ?? {};
18305
- let getEndpoint = () => DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_ID(id);
18306
- if (options?.joins && options.joins.length > 0) {
18307
- const baseEntityName = await this.resolveEntityName(id, folderKey);
18308
- rest.joins = options.joins.map((join2) => toWireJoin(join2, baseEntityName));
18309
- getEndpoint = () => DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_NAME(baseEntityName);
18310
- }
18311
- const downstreamOptions = options === undefined ? undefined : rest;
18312
- return PaginationHelpers.getAll({
18313
- serviceAccess: this.createPaginationServiceAccess(),
18314
- getEndpoint,
18315
- method: HTTP_METHODS.POST,
18316
- headers: createHeaders({ [FOLDER_KEY]: folderKey }),
18317
- queryParams: createParams({ expansionLevel }),
18318
- pagination: {
18319
- paginationType: PaginationType.OFFSET,
18320
- itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
18321
- totalCountField: ENTITY_PAGINATION.TOTAL_COUNT_FIELD,
18322
- paginationParams: {
18323
- pageSizeParam: ENTITY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
18324
- offsetParam: ENTITY_OFFSET_PARAMS.OFFSET_PARAM,
18325
- countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
18326
- }
18327
- },
18328
- excludeFromPrefix: ["filterGroup", "selectedFields", "sortOptions", "aggregates", "groupBy", "joins"]
18329
- }, downstreamOptions);
18602
+ return this.queryRecordsImpl(true, id, options);
18603
+ }
18604
+ async importRecords(entityRef, file, options) {
18605
+ const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.importRecords");
18606
+ return this.importRecordsImpl(byId, identifier, file, options);
18330
18607
  }
18331
18608
  async importRecordsById(id, file, options) {
18332
- const formData = new FormData;
18333
- if (file instanceof Uint8Array) {
18334
- formData.append("file", new Blob([file.buffer]));
18335
- } else {
18336
- formData.append("file", file);
18337
- }
18338
- const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.BULK_UPLOAD_BY_ID(id), formData, { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
18339
- return response.data;
18609
+ return this.importRecordsImpl(true, id, file, options);
18340
18610
  }
18341
- async downloadAttachment(entityId, recordId, fieldName, options) {
18342
- const response = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.DOWNLOAD_ATTACHMENT(entityId, recordId, fieldName), {
18611
+ async downloadAttachment(entityRef, recordId, fieldName, options) {
18612
+ const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.downloadAttachment");
18613
+ 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), {
18343
18614
  responseType: RESPONSE_TYPES.BLOB,
18344
18615
  headers: createHeaders({ [FOLDER_KEY]: options?.folderKey })
18345
18616
  });
18346
18617
  return response.data;
18347
18618
  }
18348
- async uploadAttachment(entityId, recordId, fieldName, file, options) {
18619
+ async uploadAttachment(entityRef, recordId, fieldName, file, options) {
18620
+ const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.uploadAttachment");
18349
18621
  const formData = new FormData;
18350
18622
  if (file instanceof Uint8Array) {
18351
18623
  formData.append("file", new Blob([file.buffer]));
@@ -18353,14 +18625,15 @@ class EntityService extends BaseService {
18353
18625
  formData.append("file", file);
18354
18626
  }
18355
18627
  const params = createParams({ expansionLevel: options?.expansionLevel });
18356
- const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPLOAD_ATTACHMENT(entityId, recordId, fieldName), formData, {
18628
+ 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, {
18357
18629
  params,
18358
18630
  headers: createHeaders({ [FOLDER_KEY]: options?.folderKey })
18359
18631
  });
18360
18632
  return response.data;
18361
18633
  }
18362
- async deleteAttachment(entityId, recordId, fieldName, options) {
18363
- const response = await this.delete(DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_ATTACHMENT(entityId, recordId, fieldName), { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
18634
+ async deleteAttachment(entityRef, recordId, fieldName, options) {
18635
+ const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.deleteAttachment");
18636
+ 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 }) });
18364
18637
  return response.data;
18365
18638
  }
18366
18639
  async getRecordsById(entityId, options) {
@@ -18397,11 +18670,16 @@ class EntityService extends BaseService {
18397
18670
  const opts = options ?? {};
18398
18671
  const hasSchemaChanges = !!(opts.addFields?.length || opts.removeFields?.length || opts.updateFields?.length);
18399
18672
  const hasMetadataChanges = opts.displayName !== undefined || opts.description !== undefined || opts.isRbacEnabled !== undefined;
18673
+ if (!hasSchemaChanges && !hasMetadataChanges) {
18674
+ throw new ValidationError({
18675
+ message: "updateById requires at least one change — pass addFields, removeFields, updateFields, displayName, description, or isRbacEnabled."
18676
+ });
18677
+ }
18400
18678
  if (hasSchemaChanges) {
18401
18679
  await this.applySchemaUpdate(id, opts);
18402
18680
  }
18403
18681
  if (hasMetadataChanges) {
18404
- await this.patch(DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_METADATA(id), {
18682
+ await this.patch(DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE(id), {
18405
18683
  ...opts.displayName !== undefined && { displayName: opts.displayName },
18406
18684
  ...opts.description !== undefined && { description: opts.description },
18407
18685
  ...opts.isRbacEnabled !== undefined && { isRbacEnabled: opts.isRbacEnabled }
@@ -18414,10 +18692,24 @@ class EntityService extends BaseService {
18414
18692
  const raw = entityResponse.data;
18415
18693
  let fields = (raw.fields ?? []).filter((f) => !f.isSystemField && !f.isPrimaryKey);
18416
18694
  if (options.removeFields?.length) {
18695
+ const existingNames = new Set(fields.map((f) => f.name));
18696
+ const missing = options.removeFields.filter((r) => !existingNames.has(r.name)).map((r) => r.name);
18697
+ if (missing.length) {
18698
+ throw new ValidationError({
18699
+ message: `Cannot remove field(s) — no matching non-system field found for name(s): ${missing.join(", ")}.`
18700
+ });
18701
+ }
18417
18702
  const removeSet = new Set(options.removeFields.map((r) => r.name));
18418
18703
  fields = fields.filter((f) => !removeSet.has(f.name));
18419
18704
  }
18420
18705
  if (options.updateFields?.length) {
18706
+ const existingIds = new Set(fields.map((f) => f.id));
18707
+ const missing = options.updateFields.filter((u) => !existingIds.has(u.id)).map((u) => u.id);
18708
+ if (missing.length) {
18709
+ throw new ValidationError({
18710
+ message: `Cannot update field(s) — no matching non-system field found for id(s): ${missing.join(", ")}.`
18711
+ });
18712
+ }
18421
18713
  const updateMap = new Map(options.updateFields.map((u) => [u.id, u]));
18422
18714
  fields = fields.map((f) => {
18423
18715
  const update = updateMap.get(f.id ?? "");
@@ -18667,40 +18959,185 @@ class EntityService extends BaseService {
18667
18959
  return {};
18668
18960
  }
18669
18961
  }
18962
+ async fetchEntityMetadata(endpoint, folderKey) {
18963
+ const response = await this.get(endpoint, { headers: createHeaders({ [FOLDER_KEY]: folderKey }) });
18964
+ const metadata = transformData(response.data, EntityMap);
18965
+ this.applyFieldMappings(metadata);
18966
+ return createEntityWithMethods(metadata, this);
18967
+ }
18968
+ getRecordsImpl(byId, identifier, options) {
18969
+ const { folderKey, ...rest } = options ?? {};
18970
+ const downstreamOptions = options === undefined ? undefined : rest;
18971
+ return PaginationHelpers.getAll({
18972
+ serviceAccess: this.createPaginationServiceAccess(),
18973
+ getEndpoint: () => byId ? DATA_FABRIC_ENDPOINTS.ENTITY.GET_ENTITY_RECORDS(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.GET_ENTITY_RECORDS_BY_NAME(identifier),
18974
+ headers: createHeaders({ [FOLDER_KEY]: folderKey }),
18975
+ pagination: {
18976
+ paginationType: PaginationType.OFFSET,
18977
+ itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
18978
+ totalCountField: ENTITY_PAGINATION.TOTAL_COUNT_FIELD,
18979
+ paginationParams: {
18980
+ pageSizeParam: ENTITY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
18981
+ offsetParam: ENTITY_OFFSET_PARAMS.OFFSET_PARAM,
18982
+ countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
18983
+ }
18984
+ },
18985
+ excludeFromPrefix: ["expansionLevel"]
18986
+ }, downstreamOptions);
18987
+ }
18988
+ async getRecordImpl(byId, identifier, recordId, options) {
18989
+ const params = createParams({ expansionLevel: options.expansionLevel });
18990
+ 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 }) });
18991
+ return response.data;
18992
+ }
18993
+ async insertRecordImpl(byId, identifier, data, options) {
18994
+ const params = createParams({ expansionLevel: options.expansionLevel });
18995
+ 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 }) });
18996
+ return response.data;
18997
+ }
18998
+ async insertRecordsImpl(byId, identifier, data, options) {
18999
+ const params = createParams({ expansionLevel: options.expansionLevel, failOnFirst: options.failOnFirst });
19000
+ 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 }) });
19001
+ return response.data;
19002
+ }
19003
+ async updateRecordImpl(byId, identifier, recordId, data, options) {
19004
+ const params = createParams({ expansionLevel: options.expansionLevel });
19005
+ 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 }) });
19006
+ return response.data;
19007
+ }
19008
+ async updateRecordsImpl(byId, identifier, data, options) {
19009
+ const params = createParams({ expansionLevel: options.expansionLevel, failOnFirst: options.failOnFirst });
19010
+ 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 }) });
19011
+ return response.data;
19012
+ }
19013
+ async deleteRecordsImpl(byId, identifier, recordIds, options) {
19014
+ const params = createParams({ failOnFirst: options.failOnFirst });
19015
+ 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 }) });
19016
+ return response.data;
19017
+ }
19018
+ async deleteRecordImpl(byId, identifier, recordId, options) {
19019
+ 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 }) });
19020
+ }
19021
+ async queryRecordsImpl(byId, identifier, options) {
19022
+ if (options?.joins && options.joins.length > MAX_QUERY_JOINS) {
19023
+ throw new ValidationError({
19024
+ message: `A maximum of ${MAX_QUERY_JOINS} joins is supported per query (received ${options.joins.length})`
19025
+ });
19026
+ }
19027
+ if (options?.joins && options.joins.length > 0 && !options.selectedFields?.length && !options.aggregates?.length) {
19028
+ throw new ValidationError({
19029
+ message: 'Join queries require selectedFields or aggregates — reference fields as "<EntityName>.<FieldName>" (e.g. "Customer.name")'
19030
+ });
19031
+ }
19032
+ if (options?.havingFilter && (!options.aggregates?.length || !options.groupBy?.length)) {
19033
+ throw new ValidationError({
19034
+ message: "havingFilter requires aggregates and groupBy — conditions reference declared aggregate aliases; use filterGroup for row-level conditions"
19035
+ });
19036
+ }
19037
+ const { folderKey, expansionLevel, ...rest } = options ?? {};
19038
+ let getEndpoint = () => byId ? DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_ID(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_NAME(identifier);
19039
+ if (options?.joins && options.joins.length > 0) {
19040
+ const baseEntityName = byId ? await this.resolveEntityName(identifier, folderKey) : identifier;
19041
+ rest.joins = options.joins.map((join2) => toWireJoin(join2, baseEntityName));
19042
+ getEndpoint = () => DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_NAME(baseEntityName);
19043
+ }
19044
+ const downstreamOptions = options === undefined ? undefined : rest;
19045
+ return PaginationHelpers.getAll({
19046
+ serviceAccess: this.createPaginationServiceAccess(),
19047
+ getEndpoint,
19048
+ method: HTTP_METHODS.POST,
19049
+ headers: createHeaders({ [FOLDER_KEY]: folderKey }),
19050
+ queryParams: createParams({ expansionLevel }),
19051
+ pagination: {
19052
+ paginationType: PaginationType.OFFSET,
19053
+ itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
19054
+ totalCountField: ENTITY_PAGINATION.TOTAL_COUNT_FIELD,
19055
+ paginationParams: {
19056
+ pageSizeParam: ENTITY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
19057
+ offsetParam: ENTITY_OFFSET_PARAMS.OFFSET_PARAM,
19058
+ countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
19059
+ }
19060
+ },
19061
+ excludeFromPrefix: ["filterGroup", "selectedFields", "sortOptions", "aggregates", "groupBy", "joins", "havingFilter"]
19062
+ }, downstreamOptions);
19063
+ }
19064
+ async importRecordsImpl(byId, identifier, file, options) {
19065
+ const formData = new FormData;
19066
+ if (file instanceof Uint8Array) {
19067
+ formData.append("file", new Blob([file.buffer]));
19068
+ } else {
19069
+ formData.append("file", file);
19070
+ }
19071
+ 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 }) });
19072
+ return response.data;
19073
+ }
18670
19074
  }
18671
19075
  __decorate([
18672
19076
  track("Entities.GetById")
18673
19077
  ], EntityService.prototype, "getById", null);
19078
+ __decorate([
19079
+ track("Entities.GetByName")
19080
+ ], EntityService.prototype, "getByName", null);
18674
19081
  __decorate([
18675
19082
  track("Entities.GetAllRecords")
18676
19083
  ], EntityService.prototype, "getAllRecords", null);
19084
+ __decorate([
19085
+ track("Entities.GetRecordsByName")
19086
+ ], EntityService.prototype, "getRecordsByName", null);
18677
19087
  __decorate([
18678
19088
  track("Entities.GetRecordById")
18679
19089
  ], EntityService.prototype, "getRecordById", null);
19090
+ __decorate([
19091
+ track("Entities.GetRecordByName")
19092
+ ], EntityService.prototype, "getRecordByName", null);
19093
+ __decorate([
19094
+ track("Entities.InsertRecord")
19095
+ ], EntityService.prototype, "insertRecord", null);
18680
19096
  __decorate([
18681
19097
  track("Entities.InsertRecordById")
18682
19098
  ], EntityService.prototype, "insertRecordById", null);
19099
+ __decorate([
19100
+ track("Entities.InsertRecords")
19101
+ ], EntityService.prototype, "insertRecords", null);
18683
19102
  __decorate([
18684
19103
  track("Entities.InsertRecordsById")
18685
19104
  ], EntityService.prototype, "insertRecordsById", null);
19105
+ __decorate([
19106
+ track("Entities.UpdateRecord")
19107
+ ], EntityService.prototype, "updateRecord", null);
18686
19108
  __decorate([
18687
19109
  track("Entities.UpdateRecordById")
18688
19110
  ], EntityService.prototype, "updateRecordById", null);
19111
+ __decorate([
19112
+ track("Entities.UpdateRecords")
19113
+ ], EntityService.prototype, "updateRecords", null);
18689
19114
  __decorate([
18690
19115
  track("Entities.UpdateRecordsById")
18691
19116
  ], EntityService.prototype, "updateRecordsById", null);
19117
+ __decorate([
19118
+ track("Entities.DeleteRecords")
19119
+ ], EntityService.prototype, "deleteRecords", null);
18692
19120
  __decorate([
18693
19121
  track("Entities.DeleteRecordsById")
18694
19122
  ], EntityService.prototype, "deleteRecordsById", null);
19123
+ __decorate([
19124
+ track("Entities.DeleteRecord")
19125
+ ], EntityService.prototype, "deleteRecord", null);
18695
19126
  __decorate([
18696
19127
  track("Entities.DeleteRecordById")
18697
19128
  ], EntityService.prototype, "deleteRecordById", null);
18698
19129
  __decorate([
18699
19130
  track("Entities.GetAll")
18700
19131
  ], EntityService.prototype, "getAll", null);
19132
+ __decorate([
19133
+ track("Entities.QueryRecords")
19134
+ ], EntityService.prototype, "queryRecords", null);
18701
19135
  __decorate([
18702
19136
  track("Entities.QueryRecordsById")
18703
19137
  ], EntityService.prototype, "queryRecordsById", null);
19138
+ __decorate([
19139
+ track("Entities.ImportRecords")
19140
+ ], EntityService.prototype, "importRecords", null);
18704
19141
  __decorate([
18705
19142
  track("Entities.ImportRecordsById")
18706
19143
  ], EntityService.prototype, "importRecordsById", null);
@@ -20144,6 +20581,74 @@ function validateName2(resourceType, name) {
20144
20581
  }
20145
20582
  return trimmed;
20146
20583
  }
20584
+ var GUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
20585
+ function isPlainObject(value) {
20586
+ return typeof value === "object" && value !== null && !Array.isArray(value);
20587
+ }
20588
+ function asResourceOverrides(value) {
20589
+ if (!isPlainObject(value))
20590
+ return;
20591
+ const table = {};
20592
+ for (const [key, properties] of Object.entries(value)) {
20593
+ if (!isPlainObject(properties))
20594
+ continue;
20595
+ const bag = {};
20596
+ for (const [property, propertyValue] of Object.entries(properties)) {
20597
+ if (typeof propertyValue === "string")
20598
+ bag[property] = propertyValue;
20599
+ }
20600
+ table[key] = bag;
20601
+ }
20602
+ return Object.keys(table).length > 0 ? table : undefined;
20603
+ }
20604
+ function readFromDocument() {
20605
+ if (!isBrowser2)
20606
+ return;
20607
+ const text = document.getElementById(UiPathElementIds.RESOURCE_OVERRIDES)?.textContent;
20608
+ if (!text)
20609
+ return;
20610
+ try {
20611
+ return asResourceOverrides(JSON.parse(text));
20612
+ } catch (error) {
20613
+ console.warn(`[UiPath SDK] Failed to parse <script id="${UiPathElementIds.RESOURCE_OVERRIDES}"> as JSON — proceeding without overrides:`, error);
20614
+ return;
20615
+ }
20616
+ }
20617
+ var table;
20618
+ var loaded = false;
20619
+ var pageOverrides = () => {
20620
+ if (!loaded) {
20621
+ loaded = true;
20622
+ table = readFromDocument();
20623
+ }
20624
+ return table;
20625
+ };
20626
+ var RESOURCE_OVERWRITES_KEY = Symbol.for("uipath.resourceOverwrites.v1");
20627
+ function readOverrides() {
20628
+ const slot2 = globalThis[RESOURCE_OVERWRITES_KEY];
20629
+ const source = typeof slot2 === "function" ? slot2 : pageOverrides;
20630
+ try {
20631
+ return source();
20632
+ } catch (error) {
20633
+ console.warn("[UiPath SDK] Override source threw — proceeding without overrides:", error);
20634
+ return;
20635
+ }
20636
+ }
20637
+ function resolveOverride(resourceType, name, folderPath) {
20638
+ const table2 = readOverrides();
20639
+ if (!table2)
20640
+ return;
20641
+ const bindingType = resourceType.toLowerCase();
20642
+ const scopedKey = folderPath ? `${bindingType}.${name}.${folderPath}` : undefined;
20643
+ const unscopedKey = `${bindingType}.${name}`;
20644
+ const entry = (scopedKey && table2[scopedKey]) ?? table2[unscopedKey];
20645
+ if (!entry)
20646
+ return;
20647
+ return {
20648
+ name: entry.name,
20649
+ folderPath: entry.folderPath
20650
+ };
20651
+ }
20147
20652
  var SINGLE_QUOTE_RE = /'/g;
20148
20653
 
20149
20654
  class FolderScopedService extends BaseService {
@@ -20160,20 +20665,23 @@ class FolderScopedService extends BaseService {
20160
20665
  }
20161
20666
  return response.data?.value;
20162
20667
  }
20163
- async getByNameLookup(resourceType, endpoint, name, options, transform2, responseFieldMap) {
20668
+ async getByNameLookup(resourceType, endpoint, name, options, transform2, responseFieldMap, callerLabel) {
20164
20669
  const validatedName = validateName2(resourceType, name);
20165
20670
  const { folderId, folderKey, folderPath, ...queryOptions } = options;
20671
+ const override = resolveOverride(resourceType, validatedName, folderPath);
20672
+ const resolvedName = override?.name ?? validatedName;
20673
+ const resolvedFolderPath = override?.folderPath ?? folderPath;
20166
20674
  const headers = resolveFolderHeaders({
20167
20675
  folderId,
20168
20676
  folderKey,
20169
- folderPath,
20170
- resourceType: `${resourceType}.getByName`,
20677
+ folderPath: resolvedFolderPath,
20678
+ resourceType: callerLabel ?? `${resourceType}.getByName`,
20171
20679
  fallbackFolderKey: this.config.folderKey
20172
20680
  });
20173
20681
  const apiFieldOptions = responseFieldMap ? transformOptions(queryOptions, responseFieldMap) : queryOptions;
20174
20682
  const apiOptions = {
20175
20683
  ...addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions)),
20176
- $filter: `Name eq '${validatedName.replace(SINGLE_QUOTE_RE, "''")}'`,
20684
+ $filter: `Name eq '${resolvedName.replace(SINGLE_QUOTE_RE, "''")}'`,
20177
20685
  $top: "1"
20178
20686
  };
20179
20687
  const response = await this.get(endpoint, {
@@ -20182,12 +20690,48 @@ class FolderScopedService extends BaseService {
20182
20690
  });
20183
20691
  const items = response.data?.value;
20184
20692
  if (!items?.length) {
20185
- const folderHint = describeFolderForError(folderId, folderKey, folderPath);
20693
+ const folderHint = describeFolderForError(folderId, folderKey, resolvedFolderPath);
20186
20694
  throw new NotFoundError({
20187
- message: `${resourceType} '${validatedName}' not found${folderHint}.`
20695
+ message: `${resourceType} '${resolvedName}' not found${folderHint}.`
20188
20696
  });
20189
20697
  }
20190
- return transform2(items[0]);
20698
+ return {
20699
+ result: transform2(items[0]),
20700
+ effectiveFolder: { folderId, folderKey, folderPath: resolvedFolderPath }
20701
+ };
20702
+ }
20703
+ async getByKeyLookup(resourceType, endpoint, key, options, transform2, responseFieldMap, callerLabel) {
20704
+ const label = callerLabel ?? `${resourceType}.getByKey`;
20705
+ const trimmedKey = key?.trim();
20706
+ if (!trimmedKey || !GUID_REGEX.test(trimmedKey)) {
20707
+ throw new ValidationError({ message: `${label}: key must be a GUID.` });
20708
+ }
20709
+ const { folderId, folderKey, folderPath, ...queryOptions } = options;
20710
+ const headers = resolveFolderHeaders({
20711
+ folderId,
20712
+ folderKey,
20713
+ folderPath,
20714
+ resourceType: label,
20715
+ fallbackFolderKey: this.config.folderKey
20716
+ });
20717
+ const apiFieldOptions = responseFieldMap ? transformOptions(queryOptions, responseFieldMap) : queryOptions;
20718
+ const apiOptions = {
20719
+ ...addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions)),
20720
+ $filter: `Key eq ${trimmedKey}`,
20721
+ $top: "1"
20722
+ };
20723
+ const response = await this.get(endpoint, {
20724
+ headers,
20725
+ params: apiOptions
20726
+ });
20727
+ const items = response.data?.value;
20728
+ if (!items?.length) {
20729
+ throw new NotFoundError({ message: `${resourceType} with key '${trimmedKey}' not found.` });
20730
+ }
20731
+ return {
20732
+ result: transform2(items[0]),
20733
+ effectiveFolder: { folderId, folderKey, folderPath }
20734
+ };
20191
20735
  }
20192
20736
  }
20193
20737
  function describeFolderForError(folderId, folderKey, folderPath) {
@@ -20218,12 +20762,16 @@ class TaskService extends FolderScopedService {
20218
20762
  };
20219
20763
  }
20220
20764
  async create(task, folderId) {
20765
+ if (task.type === TaskType.QuickForm && !task.taskSchemaKey) {
20766
+ throw new ValidationError({ message: "taskSchemaKey is required when creating a QuickForm task." });
20767
+ }
20221
20768
  const headers = createHeaders({ [FOLDER_ID]: folderId });
20222
- const externalTask = {
20223
- ...task,
20224
- type: TaskType.External
20225
- };
20226
- const response = await this.post(TASK_ENDPOINTS.CREATE_GENERIC_TASK, externalTask, { headers });
20769
+ const { labels, type, ...rest } = task;
20770
+ const payload = { ...rest, type: type ?? TaskType.External };
20771
+ if (labels?.length) {
20772
+ payload.tags = labels.map((label) => ({ name: label, displayName: label, displayValue: label }));
20773
+ }
20774
+ const response = await this.post(TASK_ENDPOINTS.CREATE_GENERIC_TASK, payload, { headers });
20227
20775
  const normalizedData = transformData(response.data, TaskMap);
20228
20776
  const transformedData = applyDataTransforms(normalizedData, { field: "status", valueMap: TaskStatusMap });
20229
20777
  return createTaskWithMethods(transformedData, this);
@@ -20855,6 +21403,35 @@ var AssetValueType;
20855
21403
  AssetValueType2["Credential"] = "Credential";
20856
21404
  AssetValueType2["Secret"] = "Secret";
20857
21405
  })(AssetValueType || (AssetValueType = {}));
21406
+ async function resolveRefToId(ref, resolvers, callerLabel) {
21407
+ if (!ref) {
21408
+ throw new ValidationError({
21409
+ message: `${callerLabel}: ref must supply exactly one of 'id', 'name', or 'key'.`
21410
+ });
21411
+ }
21412
+ if ("id" in ref && ref.id != null) {
21413
+ return { id: ref.id, effectiveFolder: {} };
21414
+ }
21415
+ const stringVariants = [
21416
+ { variant: "name", resolver: resolvers.byName },
21417
+ { variant: "key", resolver: resolvers.byKey }
21418
+ ];
21419
+ for (const { variant, resolver } of stringVariants) {
21420
+ const value = ref[variant];
21421
+ if (!value)
21422
+ continue;
21423
+ if (!resolver) {
21424
+ throw new ValidationError({
21425
+ message: `${callerLabel}: this method does not support lookup by '${variant}'.`
21426
+ });
21427
+ }
21428
+ const { id, folderId, folderKey, folderPath } = await resolver(value);
21429
+ return { id, effectiveFolder: { folderId, folderKey, folderPath } };
21430
+ }
21431
+ throw new ValidationError({
21432
+ message: `${callerLabel}: ref must supply exactly one of 'id', 'name', or 'key'.`
21433
+ });
21434
+ }
20858
21435
  var AssetMap = {
20859
21436
  creationTime: "createdTime",
20860
21437
  lastModificationTime: "lastModifiedTime"
@@ -20893,7 +21470,41 @@ class AssetService extends FolderScopedService {
20893
21470
  return transformedAsset;
20894
21471
  }
20895
21472
  async getByName(name, options = {}) {
20896
- return this.getByNameLookup("Asset", ASSET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap), AssetMap);
21473
+ const { result } = await this.getByNameLookup("Asset", ASSET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap), AssetMap);
21474
+ return result;
21475
+ }
21476
+ async getByKey(key, options = {}) {
21477
+ const { result } = await this.getByKeyLookup("Asset", ASSET_ENDPOINTS.GET_BY_FOLDER, key, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap), AssetMap);
21478
+ return result;
21479
+ }
21480
+ async updateValue(assetRef, newValue, options) {
21481
+ if (newValue === null || newValue === undefined) {
21482
+ throw new ValidationError({ message: "newValue is required for updateValue" });
21483
+ }
21484
+ let preFetched;
21485
+ const { id, effectiveFolder } = await resolveRefToId(assetRef, {
21486
+ byName: async (name) => {
21487
+ 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");
21488
+ preFetched = asset;
21489
+ return { id: asset.id, ...folder };
21490
+ },
21491
+ byKey: async (key) => {
21492
+ 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");
21493
+ preFetched = asset;
21494
+ return { id: asset.id, ...folder };
21495
+ }
21496
+ }, "Assets.updateValue");
21497
+ if (id <= 0) {
21498
+ throw new ValidationError({ message: "Assets.updateValue: assetRef.id must be a positive number." });
21499
+ }
21500
+ const headers = resolveFolderHeaders({
21501
+ folderId: effectiveFolder.folderId ?? options?.folderId,
21502
+ folderKey: effectiveFolder.folderKey ?? options?.folderKey,
21503
+ folderPath: effectiveFolder.folderPath ?? options?.folderPath,
21504
+ resourceType: "Assets.updateValue",
21505
+ fallbackFolderKey: this.config.folderKey
21506
+ });
21507
+ await this.updateValueByResolvedId(id, newValue, headers, preFetched);
20897
21508
  }
20898
21509
  async updateValueById(id, newValue, options) {
20899
21510
  if (!id) {
@@ -20909,19 +21520,30 @@ class AssetService extends FolderScopedService {
20909
21520
  resourceType: "Assets.updateValueById",
20910
21521
  fallbackFolderKey: this.config.folderKey
20911
21522
  });
20912
- const existingResponse = await this.get(ASSET_ENDPOINTS.GET_BY_ID(id), { headers });
20913
- const existing = existingResponse.data;
20914
- const valueField = resolveValueField(id, existing.ValueType, newValue);
21523
+ await this.updateValueByResolvedId(id, newValue, headers);
21524
+ }
21525
+ async updateValueByResolvedId(id, newValue, headers, preFetched) {
21526
+ const shape = preFetched ?? await this.fetchAssetShape(id, headers);
21527
+ const valueField = resolveValueField(id, shape.valueType, newValue);
20915
21528
  const body = {
20916
21529
  Id: id,
20917
- Name: existing.Name,
20918
- ValueScope: existing.ValueScope,
20919
- ValueType: existing.ValueType,
20920
- Description: existing.Description,
21530
+ Name: shape.name,
21531
+ ValueScope: shape.valueScope,
21532
+ ValueType: shape.valueType,
21533
+ Description: shape.description,
20921
21534
  [valueField]: newValue
20922
21535
  };
20923
21536
  await this.put(ASSET_ENDPOINTS.GET_BY_ID(id), body, { headers });
20924
21537
  }
21538
+ async fetchAssetShape(id, headers) {
21539
+ const response = await this.get(ASSET_ENDPOINTS.GET_BY_ID(id), { headers });
21540
+ return {
21541
+ name: response.data.Name,
21542
+ valueScope: response.data.ValueScope,
21543
+ valueType: response.data.ValueType,
21544
+ description: response.data.Description
21545
+ };
21546
+ }
20925
21547
  }
20926
21548
  __decorate([
20927
21549
  track("Assets.GetAll")
@@ -20932,6 +21554,12 @@ __decorate([
20932
21554
  __decorate([
20933
21555
  track("Assets.GetByName")
20934
21556
  ], AssetService.prototype, "getByName", null);
21557
+ __decorate([
21558
+ track("Assets.GetByKey")
21559
+ ], AssetService.prototype, "getByKey", null);
21560
+ __decorate([
21561
+ track("Assets.UpdateValue")
21562
+ ], AssetService.prototype, "updateValue", null);
20935
21563
  __decorate([
20936
21564
  track("Assets.UpdateValueById")
20937
21565
  ], AssetService.prototype, "updateValueById", null);
@@ -20960,7 +21588,7 @@ function resolveValueField(id, valueType, newValue) {
20960
21588
  return "BoolValue";
20961
21589
  default:
20962
21590
  throw new ValidationError({
20963
- message: `updateValueById only supports Text, Integer, or Bool assets; asset ${id} has valueType ${valueType}`
21591
+ message: `Asset ${id} has valueType ${valueType}; only Text, Integer, and Bool are supported`
20964
21592
  });
20965
21593
  }
20966
21594
  }
@@ -20988,7 +21616,8 @@ class BucketService extends FolderScopedService {
20988
21616
  return pascalToCamelCaseKeys(response.data);
20989
21617
  }
20990
21618
  async getByName(name, options = {}) {
20991
- return this.getByNameLookup("Bucket", BUCKET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => pascalToCamelCaseKeys(raw));
21619
+ const { result } = await this.getByNameLookup("Bucket", BUCKET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => pascalToCamelCaseKeys(raw));
21620
+ return result;
20992
21621
  }
20993
21622
  async getAll(options) {
20994
21623
  const transformBucketResponse = (bucket) => pascalToCamelCaseKeys(bucket);
@@ -21855,7 +22484,8 @@ class ProcessService extends FolderScopedService {
21855
22484
  return transformedProcess;
21856
22485
  }
21857
22486
  async getByName(name, options = {}) {
21858
- return this.getByNameLookup("Process", PROCESS_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), ProcessMap), ProcessMap);
22487
+ const { result } = await this.getByNameLookup("Process", PROCESS_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), ProcessMap), ProcessMap);
22488
+ return result;
21859
22489
  }
21860
22490
  }
21861
22491
  __decorate([
@@ -21870,21 +22500,112 @@ __decorate([
21870
22500
  __decorate([
21871
22501
  track("Processes.GetByName")
21872
22502
  ], ProcessService.prototype, "getByName", null);
22503
+ var QueuePriority;
22504
+ (function(QueuePriority2) {
22505
+ QueuePriority2["High"] = "High";
22506
+ QueuePriority2["Normal"] = "Normal";
22507
+ QueuePriority2["Low"] = "Low";
22508
+ })(QueuePriority || (QueuePriority = {}));
22509
+ var QueueItemStatus;
22510
+ (function(QueueItemStatus2) {
22511
+ QueueItemStatus2["New"] = "New";
22512
+ QueueItemStatus2["InProgress"] = "InProgress";
22513
+ QueueItemStatus2["Failed"] = "Failed";
22514
+ QueueItemStatus2["Successful"] = "Successful";
22515
+ QueueItemStatus2["Abandoned"] = "Abandoned";
22516
+ QueueItemStatus2["Retried"] = "Retried";
22517
+ QueueItemStatus2["Deleted"] = "Deleted";
22518
+ })(QueueItemStatus || (QueueItemStatus = {}));
22519
+ var QueueItemReviewStatus;
22520
+ (function(QueueItemReviewStatus2) {
22521
+ QueueItemReviewStatus2["None"] = "None";
22522
+ QueueItemReviewStatus2["InReview"] = "InReview";
22523
+ QueueItemReviewStatus2["Verified"] = "Verified";
22524
+ QueueItemReviewStatus2["Retried"] = "Retried";
22525
+ })(QueueItemReviewStatus || (QueueItemReviewStatus = {}));
22526
+ var QueueExceptionType;
22527
+ (function(QueueExceptionType2) {
22528
+ QueueExceptionType2["ApplicationException"] = "ApplicationException";
22529
+ QueueExceptionType2["BusinessException"] = "BusinessException";
22530
+ })(QueueExceptionType || (QueueExceptionType = {}));
22531
+ var QueueTransactionOutcome;
22532
+ (function(QueueTransactionOutcome2) {
22533
+ QueueTransactionOutcome2["Successful"] = "Successful";
22534
+ QueueTransactionOutcome2["Failed"] = "Failed";
22535
+ })(QueueTransactionOutcome || (QueueTransactionOutcome = {}));
22536
+ function createQueueMethods(queueData, service) {
22537
+ return {
22538
+ async getAllItems(options) {
22539
+ if (!queueData.id)
22540
+ throw new ValidationError({ message: "Queue ID is undefined" });
22541
+ if (!queueData.folderId)
22542
+ throw new ValidationError({ message: "Folder ID is undefined" });
22543
+ return service.getAllItems(queueData.id, { ...options, folderId: queueData.folderId });
22544
+ },
22545
+ async insertItem(specificData, options) {
22546
+ if (!queueData.name)
22547
+ throw new ValidationError({ message: "Queue name is undefined" });
22548
+ if (!queueData.folderId)
22549
+ throw new ValidationError({ message: "Folder ID is undefined" });
22550
+ return service.insertItemByName(queueData.name, specificData, { ...options, folderId: queueData.folderId });
22551
+ },
22552
+ async startTransaction() {
22553
+ if (!queueData.name)
22554
+ throw new ValidationError({ message: "Queue name is undefined" });
22555
+ if (!queueData.folderId)
22556
+ throw new ValidationError({ message: "Folder ID is undefined" });
22557
+ return service.startTransaction({ name: queueData.name }, { folderId: queueData.folderId });
22558
+ },
22559
+ async completeTransaction(itemId, outcome, options) {
22560
+ if (!queueData.folderId)
22561
+ throw new ValidationError({ message: "Folder ID is undefined" });
22562
+ return service.completeTransaction(itemId, outcome, { ...options, folderId: queueData.folderId });
22563
+ }
22564
+ };
22565
+ }
22566
+ function createQueueWithMethods(queueData, service) {
22567
+ return Object.assign({}, queueData, createQueueMethods(queueData, service));
22568
+ }
21873
22569
  var QueueMap = {
21874
22570
  creationTime: "createdTime",
21875
22571
  organizationUnitId: "folderId",
21876
22572
  organizationUnitFullyQualifiedName: "folderName"
21877
22573
  };
22574
+ var QueueItemMap = {
22575
+ queueDefinitionId: "queueId",
22576
+ creationTime: "createdTime",
22577
+ organizationUnitId: "folderId",
22578
+ organizationUnitFullyQualifiedName: "folderName",
22579
+ startProcessing: "processingStartTime",
22580
+ endProcessing: "processingEndTime",
22581
+ processingException: "processingError"
22582
+ };
22583
+ var QueueItemProcessingErrorMap = {
22584
+ creationTime: "createdTime"
22585
+ };
22586
+ function transformQueueItem(queueItem) {
22587
+ const { SpecificContent, Output, SpecificData: _sd, OutputData: _od, ...rest } = queueItem;
22588
+ const transformed = transformData(pascalToCamelCaseKeys(rest), QueueItemMap);
22589
+ if (transformed.processingError) {
22590
+ transformed.processingError = transformData(transformed.processingError, QueueItemProcessingErrorMap);
22591
+ }
22592
+ transformed.specificData = SpecificContent ?? null;
22593
+ transformed.outputData = Output ?? null;
22594
+ return transformed;
22595
+ }
21878
22596
 
21879
22597
  class QueueService extends FolderScopedService {
21880
22598
  async getAll(options) {
21881
- const transformQueueResponse = (queue) => transformData(pascalToCamelCaseKeys(queue), QueueMap);
21882
- const apiOptions = options ? transformOptions(options, QueueMap) : options;
22599
+ const { folderId, folderKey, folderPath, ...queryOptions } = options ?? {};
22600
+ const hasFolderScope = folderId !== undefined || !!folderKey?.trim() || !!folderPath?.trim();
22601
+ const headers = hasFolderScope ? resolveFolderHeaders({ folderId, folderKey, folderPath, resourceType: "Queues.getAll" }) : undefined;
22602
+ const apiOptions = transformOptions(queryOptions, QueueMap);
21883
22603
  return PaginationHelpers.getAll({
21884
22604
  serviceAccess: this.createPaginationServiceAccess(),
21885
- getEndpoint: (folderId) => folderId ? QUEUE_ENDPOINTS.GET_BY_FOLDER : QUEUE_ENDPOINTS.GET_ALL,
22605
+ getEndpoint: () => hasFolderScope ? QUEUE_ENDPOINTS.GET_BY_FOLDER : QUEUE_ENDPOINTS.GET_ALL,
21886
22606
  getByFolderEndpoint: QUEUE_ENDPOINTS.GET_BY_FOLDER,
21887
- transformFn: transformQueueResponse,
22607
+ headers,
22608
+ transformFn: (queue) => createQueueWithMethods(transformData(pascalToCamelCaseKeys(queue), QueueMap), this),
21888
22609
  pagination: {
21889
22610
  paginationType: PaginationType.OFFSET,
21890
22611
  itemsField: ODATA_PAGINATION.ITEMS_FIELD,
@@ -21897,15 +22618,176 @@ class QueueService extends FolderScopedService {
21897
22618
  }
21898
22619
  }, apiOptions);
21899
22620
  }
21900
- async getById(id, folderId, options = {}) {
21901
- const headers = createHeaders({ [FOLDER_ID]: folderId });
21902
- const apiFieldOptions = transformOptions(options, QueueMap);
22621
+ async getById(id, folderIdOrOptions, options = {}) {
22622
+ if (typeof folderIdOrOptions === "number") {
22623
+ const headers2 = createHeaders({ [FOLDER_ID]: folderIdOrOptions });
22624
+ const apiFieldOptions2 = transformOptions(options, QueueMap);
22625
+ const apiOptions2 = addPrefixToKeys(apiFieldOptions2, ODATA_PREFIX, Object.keys(apiFieldOptions2));
22626
+ const response2 = await this.get(QUEUE_ENDPOINTS.GET_BY_ID(id), {
22627
+ headers: headers2,
22628
+ params: apiOptions2
22629
+ });
22630
+ return transformData(pascalToCamelCaseKeys(response2.data), QueueMap);
22631
+ }
22632
+ const { folderId, folderKey, folderPath, ...queryOptions } = folderIdOrOptions ?? {};
22633
+ const headers = resolveFolderHeaders({
22634
+ folderId,
22635
+ folderKey,
22636
+ folderPath,
22637
+ resourceType: "Queues.getById",
22638
+ fallbackFolderKey: this.config.folderKey
22639
+ });
22640
+ const apiFieldOptions = transformOptions(queryOptions, QueueMap);
21903
22641
  const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
21904
22642
  const response = await this.get(QUEUE_ENDPOINTS.GET_BY_ID(id), {
21905
22643
  headers,
21906
22644
  params: apiOptions
21907
22645
  });
21908
- return transformData(pascalToCamelCaseKeys(response.data), QueueMap);
22646
+ const rawQueue = transformData(pascalToCamelCaseKeys(response.data), QueueMap);
22647
+ return createQueueWithMethods(rawQueue, this);
22648
+ }
22649
+ async getByName(name, options = {}) {
22650
+ const { result } = await this.getByNameLookup("Queue", QUEUE_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => createQueueWithMethods(transformData(pascalToCamelCaseKeys(raw), QueueMap), this), QueueMap);
22651
+ return result;
22652
+ }
22653
+ async getByKey(key, options = {}) {
22654
+ const trimmedKey = key?.trim();
22655
+ if (!trimmedKey || !GUID_REGEX.test(trimmedKey)) {
22656
+ throw new ValidationError({ message: "key must be a GUID for getByKey" });
22657
+ }
22658
+ const { folderId, folderKey, folderPath, ...queryOptions } = options;
22659
+ const headers = resolveFolderHeaders({
22660
+ folderId,
22661
+ folderKey,
22662
+ folderPath,
22663
+ resourceType: "Queues.getByKey",
22664
+ fallbackFolderKey: this.config.folderKey
22665
+ });
22666
+ const apiFieldOptions = transformOptions(queryOptions, QueueMap);
22667
+ const apiOptions = {
22668
+ ...addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions)),
22669
+ $filter: `Key eq ${trimmedKey}`,
22670
+ $top: "1"
22671
+ };
22672
+ const response = await this.get(QUEUE_ENDPOINTS.GET_BY_FOLDER, { headers, params: apiOptions });
22673
+ const items = response.data?.value;
22674
+ if (!items?.length) {
22675
+ throw new NotFoundError({ message: `Queue with key '${trimmedKey}' not found.` });
22676
+ }
22677
+ return createQueueWithMethods(transformData(pascalToCamelCaseKeys(items[0]), QueueMap), this);
22678
+ }
22679
+ async getAllItems(queueId, options) {
22680
+ if (!queueId) {
22681
+ throw new ValidationError({ message: "queueId is required for getAllItems" });
22682
+ }
22683
+ const { folderId, folderKey, folderPath, filter, ...restOptions } = options ?? {};
22684
+ const headers = resolveFolderHeaders({
22685
+ folderId,
22686
+ folderKey,
22687
+ folderPath,
22688
+ resourceType: "Queues.getAllItems",
22689
+ fallbackFolderKey: this.config.folderKey
22690
+ });
22691
+ const mergedFilter = filter ? `(${filter}) and queueId eq ${queueId}` : `queueId eq ${queueId}`;
22692
+ const apiOptions = transformOptions({ ...restOptions, filter: mergedFilter }, QueueItemMap);
22693
+ return PaginationHelpers.getAll({
22694
+ serviceAccess: this.createPaginationServiceAccess(),
22695
+ getEndpoint: () => QUEUE_ENDPOINTS.GET_ITEMS,
22696
+ getByFolderEndpoint: QUEUE_ENDPOINTS.GET_ITEMS,
22697
+ headers,
22698
+ transformFn: transformQueueItem,
22699
+ pagination: {
22700
+ paginationType: PaginationType.OFFSET,
22701
+ itemsField: ODATA_PAGINATION.ITEMS_FIELD,
22702
+ totalCountField: ODATA_PAGINATION.TOTAL_COUNT_FIELD,
22703
+ paginationParams: {
22704
+ pageSizeParam: ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM,
22705
+ offsetParam: ODATA_OFFSET_PARAMS.OFFSET_PARAM,
22706
+ countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM
22707
+ }
22708
+ }
22709
+ }, apiOptions);
22710
+ }
22711
+ async insertItemByName(queueName, specificData, options = {}) {
22712
+ if (!queueName) {
22713
+ throw new ValidationError({ message: "queueName is required for insertItemByName" });
22714
+ }
22715
+ const headers = resolveFolderHeaders({
22716
+ folderId: options.folderId,
22717
+ folderKey: options.folderKey,
22718
+ folderPath: options.folderPath,
22719
+ resourceType: "Queues.insertItemByName",
22720
+ fallbackFolderKey: this.config.folderKey
22721
+ });
22722
+ const response = await this.post(QUEUE_ENDPOINTS.ADD_ITEM, {
22723
+ itemData: {
22724
+ Name: queueName,
22725
+ Priority: options.priority ?? QueuePriority.Normal,
22726
+ Reference: options.reference,
22727
+ Progress: options.progress,
22728
+ DeferDate: options.deferDate?.toISOString(),
22729
+ DueDate: options.dueDate?.toISOString(),
22730
+ RiskSlaDate: options.riskSlaDate?.toISOString(),
22731
+ SpecificContent: specificData
22732
+ }
22733
+ }, { headers });
22734
+ return transformQueueItem(response.data);
22735
+ }
22736
+ async startTransaction(queue, options = {}) {
22737
+ const headers = resolveFolderHeaders({
22738
+ folderId: options.folderId,
22739
+ folderKey: options.folderKey,
22740
+ folderPath: options.folderPath,
22741
+ resourceType: "Queues.startTransaction",
22742
+ fallbackFolderKey: this.config.folderKey
22743
+ });
22744
+ let queueName;
22745
+ if (queue?.name) {
22746
+ queueName = queue.name;
22747
+ } else if (queue?.id != null) {
22748
+ queueName = await this.resolveQueueName(queue.id, headers);
22749
+ } else {
22750
+ throw new ValidationError({ message: "queue id or name is required for startTransaction" });
22751
+ }
22752
+ const response = await this.post(QUEUE_ENDPOINTS.START_TRANSACTION, {
22753
+ transactionData: { Name: queueName }
22754
+ }, { headers });
22755
+ if (!response.data || typeof response.data !== "object") {
22756
+ return null;
22757
+ }
22758
+ return transformQueueItem(response.data);
22759
+ }
22760
+ async completeTransaction(itemId, outcome, options = {}) {
22761
+ if (!itemId) {
22762
+ throw new ValidationError({ message: "itemId is required for completeTransaction" });
22763
+ }
22764
+ const headers = resolveFolderHeaders({
22765
+ folderId: options.folderId,
22766
+ folderKey: options.folderKey,
22767
+ folderPath: options.folderPath,
22768
+ resourceType: "Queues.completeTransaction",
22769
+ fallbackFolderKey: this.config.folderKey
22770
+ });
22771
+ const transactionResult = {
22772
+ IsSuccessful: outcome === QueueTransactionOutcome.Successful,
22773
+ ProcessingException: options.processingError && {
22774
+ Reason: options.processingError.reason,
22775
+ Details: options.processingError.details,
22776
+ Type: options.processingError.type,
22777
+ AssociatedImageFilePath: options.processingError.associatedImageFilePath
22778
+ },
22779
+ DeferDate: options.deferDate?.toISOString(),
22780
+ DueDate: options.dueDate?.toISOString(),
22781
+ Progress: options.progress,
22782
+ OperationId: options.operationId,
22783
+ Output: options.outputData,
22784
+ Analytics: options.analytics
22785
+ };
22786
+ await this.post(QUEUE_ENDPOINTS.SET_TRANSACTION_RESULT(itemId), { transactionResult }, { headers });
22787
+ }
22788
+ async resolveQueueName(queueId, headers) {
22789
+ const response = await this.get(QUEUE_ENDPOINTS.GET_BY_ID(queueId), { headers, params: { $select: "Name" } });
22790
+ return response.data.Name;
21909
22791
  }
21910
22792
  }
21911
22793
  __decorate([
@@ -21914,6 +22796,24 @@ __decorate([
21914
22796
  __decorate([
21915
22797
  track("Queues.GetById")
21916
22798
  ], QueueService.prototype, "getById", null);
22799
+ __decorate([
22800
+ track("Queues.GetByName")
22801
+ ], QueueService.prototype, "getByName", null);
22802
+ __decorate([
22803
+ track("Queues.GetByKey")
22804
+ ], QueueService.prototype, "getByKey", null);
22805
+ __decorate([
22806
+ track("Queues.GetAllItems")
22807
+ ], QueueService.prototype, "getAllItems", null);
22808
+ __decorate([
22809
+ track("Queues.InsertItemByName")
22810
+ ], QueueService.prototype, "insertItemByName", null);
22811
+ __decorate([
22812
+ track("Queues.StartTransaction")
22813
+ ], QueueService.prototype, "startTransaction", null);
22814
+ __decorate([
22815
+ track("Queues.CompleteTransaction")
22816
+ ], QueueService.prototype, "completeTransaction", null);
21917
22817
  var TaskCatalogMap = {
21918
22818
  creationTime: "createdTime",
21919
22819
  lastModificationTime: "lastModifiedTime"
@@ -21960,7 +22860,8 @@ class TaskCatalogService extends FolderScopedService {
21960
22860
  return transformData(pascalToCamelCaseKeys(response.data), TaskCatalogMap);
21961
22861
  }
21962
22862
  async getByName(name, options = {}) {
21963
- return this.getByNameLookup("TaskCatalog", TASK_CATALOG_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), TaskCatalogMap), TaskCatalogMap);
22863
+ const { result } = await this.getByNameLookup("TaskCatalog", TASK_CATALOG_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), TaskCatalogMap), TaskCatalogMap);
22864
+ return result;
21964
22865
  }
21965
22866
  async create(name, options = {}) {
21966
22867
  if (!name) {
@@ -21984,7 +22885,7 @@ class TaskCatalogService extends FolderScopedService {
21984
22885
  throw new ValidationError({ message: "name is required for updateByName" });
21985
22886
  }
21986
22887
  const { folderId, folderKey, folderPath } = options;
21987
- const current = await this.getByNameLookup("TaskCatalog", TASK_CATALOG_ENDPOINTS.GET_ALL, name, { folderId, folderKey, folderPath }, (raw) => transformData(pascalToCamelCaseKeys(raw), TaskCatalogMap), TaskCatalogMap);
22888
+ const { result: current } = await this.getByNameLookup("TaskCatalog", TASK_CATALOG_ENDPOINTS.GET_ALL, name, { folderId, folderKey, folderPath }, (raw) => transformData(pascalToCamelCaseKeys(raw), TaskCatalogMap), TaskCatalogMap);
21988
22889
  return this.update(current, options);
21989
22890
  }
21990
22891
  async update(current, options) {
@@ -22129,6 +23030,13 @@ var AgentMap = {
22129
23030
  var UserSettingsMap = {
22130
23031
  ...CommonFieldMap
22131
23032
  };
23033
+ var ConnectionState;
23034
+ (function(ConnectionState2) {
23035
+ ConnectionState2["Enabled"] = "Enabled";
23036
+ ConnectionState2["Disabled"] = "Disabled";
23037
+ ConnectionState2["Expired"] = "Expired";
23038
+ ConnectionState2["Failed"] = "Failed";
23039
+ })(ConnectionState || (ConnectionState = {}));
22132
23040
  var FeedbackStatus;
22133
23041
  (function(FeedbackStatus2) {
22134
23042
  FeedbackStatus2[FeedbackStatus2["Pending"] = 0] = "Pending";
@@ -23864,7 +24772,7 @@ var ENTITIES_DELETE_EXAMPLES = [
23864
24772
  ];
23865
24773
  var ENTITIES_CREATE_EXAMPLES = [
23866
24774
  {
23867
- Description: "Create an entity with choice-set, relationship, file, and large-text fields. " + "CHOICE_SET_SINGLE/CHOICE_SET_MULTIPLE require 'choiceSetId' (from 'df choice-sets list'). " + "RELATIONSHIP requires 'referenceEntityId' (UUID of the target entity, from 'df entities list') and 'referenceFieldId' (UUID of the field on the target entity, from 'df entities get <target-id>'). " + "Note: a RELATIONSHIP column on a record always stores the target record's UUID 'Id' (regardless of which 'referenceFieldId' configured the join) — see 'df records insert' for how to write the value. " + "FILE fields take only 'name' and 'type' — the server auto-wires the internal attachment reference; populate them later with 'uip df files upload <entity-id> <record-id> <field-name> --file <path>'. " + "MULTILINE_MAX holds very large text ('lengthLimit' = UTF-16 byte budget, 1-131072; default max ~65,536 chars). Not filterable/sortable; 'records list'/'query' return a size marker — full content via 'records get'. Tenant-gated by the 'MultilineMax' feature flag.",
24775
+ Description: "Create an entity with choice-set, relationship, file, and large-text fields. " + "CHOICE_SET_SINGLE/CHOICE_SET_MULTIPLE require 'choiceSetId' (from 'df choice-sets list'). " + "RELATIONSHIP requires 'referenceEntityId' (UUID of the target entity, from 'df entities list') and 'referenceFieldId' (UUID of the field on the target entity, from 'df entities get <target-id>'). " + "Note: a RELATIONSHIP column on a record always stores the target record's UUID 'Id' (regardless of which 'referenceFieldId' configured the join) — see 'df records insert' for how to write the value. " + "FILE fields take only 'name' and 'type' — the server auto-wires the internal attachment reference; populate them later with 'uip df files upload <entity-id> <record-id> <field-name> --file <path>'. " + "MULTILINE_MAX holds very large text ('lengthLimit' = UTF-16 byte budget, 1-131072; default max ~65,536 chars). Not filterable/sortable; 'records list'/'query' return only a preview (content truncated to 10,000 chars with a '...[Truncated]' suffix, or a 'HasValue=true Length=N' marker, depending on the tenant) — full content via 'records get'. Tenant-gated by the 'MultilineMax' feature flag.",
23868
24776
  Command: `uip df entities create Expense --body '{"displayName":"Expense","fields":[{"name":"category","type":"CHOICE_SET_SINGLE","choiceSetId":"c1d2e3f4-0000-0000-0000-000000000001","isRequired":true},{"name":"tags","type":"CHOICE_SET_MULTIPLE","choiceSetId":"c1d2e3f4-0000-0000-0000-000000000002"},{"name":"submitter","type":"RELATIONSHIP","referenceEntityId":"a1b2c3d4-0000-0000-0000-000000000010","referenceFieldId":"f1000000-0000-0000-0000-000000000100","isRequired":true},{"name":"receipt","type":"FILE"},{"name":"notes","type":"MULTILINE_MAX"}]}'`,
23869
24777
  Output: {
23870
24778
  Code: "EntityCreated",
@@ -24374,7 +25282,7 @@ var registerFilesCommand = (program2) => {
24374
25282
  }
24375
25283
  const fsInst = getFileSystem();
24376
25284
  const fileName = fsInst.path.basename(options.file) || "upload";
24377
- const [uploadError] = await catchError(sdk.entities.uploadAttachment(entityId, recordId, fieldName, new File([fileContent], fileName), options.folderKey !== undefined ? { folderKey: options.folderKey } : undefined));
25285
+ const [uploadError] = await catchError(sdk.entities.uploadAttachment({ id: entityId }, recordId, fieldName, new File([fileContent], fileName), options.folderKey !== undefined ? { folderKey: options.folderKey } : undefined));
24378
25286
  if (uploadError) {
24379
25287
  return fail(`Error uploading file to field '${fieldName}'`, await extractErrorMessage(uploadError));
24380
25288
  }
@@ -24393,7 +25301,7 @@ var registerFilesCommand = (program2) => {
24393
25301
  const sdk = await connectOrFail(options.tenant);
24394
25302
  if (!sdk)
24395
25303
  return;
24396
- const [downloadError, blob] = await catchError(sdk.entities.downloadAttachment(entityId, recordId, fieldName, options.folderKey !== undefined ? { folderKey: options.folderKey } : undefined));
25304
+ const [downloadError, blob] = await catchError(sdk.entities.downloadAttachment({ id: entityId }, recordId, fieldName, options.folderKey !== undefined ? { folderKey: options.folderKey } : undefined));
24397
25305
  if (downloadError) {
24398
25306
  return fail(`Error downloading file from field '${fieldName}'`, await extractErrorMessage(downloadError));
24399
25307
  }
@@ -24424,7 +25332,7 @@ var registerFilesCommand = (program2) => {
24424
25332
  const sdk = await connectOrFail(options.tenant);
24425
25333
  if (!sdk)
24426
25334
  return;
24427
- const [deleteError] = await catchError(sdk.entities.deleteAttachment(entityId, recordId, fieldName, options.folderKey !== undefined ? { folderKey: options.folderKey } : undefined));
25335
+ const [deleteError] = await catchError(sdk.entities.deleteAttachment({ id: entityId }, recordId, fieldName, options.folderKey !== undefined ? { folderKey: options.folderKey } : undefined));
24428
25336
  if (deleteError) {
24429
25337
  return fail(`Error deleting file from field '${fieldName}'`, await extractErrorMessage(deleteError));
24430
25338
  }
@@ -24467,7 +25375,7 @@ async function loadFileFieldNames(sdk, entityId, folderKey) {
24467
25375
  }
24468
25376
  var RECORDS_LIST_EXAMPLES = [
24469
25377
  {
24470
- Description: "List records in an entity. MULTILINE_MAX fields return a size marker (see 'notes' below) — full value via 'records get'.",
25378
+ Description: "List records in an entity. MULTILINE_MAX fields return only a preview (see 'notes' below): content truncated to 10,000 chars with a '...[Truncated]' suffix, or a 'HasValue=true Length=N' marker, depending on the tenant — full value via 'records get'.",
24471
25379
  Command: "uip df records list a1b2c3d4-0000-0000-0000-000000000001 --limit 2",
24472
25380
  Output: {
24473
25381
  Code: "RecordList",
@@ -24476,7 +25384,7 @@ var RECORDS_LIST_EXAMPLES = [
24476
25384
  {
24477
25385
  Id: "b2c3d4e5-0000-0000-0000-000000000001",
24478
25386
  amount: 1500,
24479
- notes: "HasValue=true Length=20000"
25387
+ notes: "Expense report for Q3 travel...[Truncated]"
24480
25388
  },
24481
25389
  {
24482
25390
  Id: "b2c3d4e5-0000-0000-0000-000000000002",
@@ -24665,7 +25573,7 @@ var registerRecordsCommand = (program2) => {
24665
25573
  if (fileErr)
24666
25574
  return fail(fileErr.message, fileErr.instructions);
24667
25575
  if (recordsList.length === 1) {
24668
- const [insertError, result] = await catchError(sdk.entities.insertRecordById(entityId, recordsList[0], folderOptions));
25576
+ const [insertError, result] = await catchError(sdk.entities.insertRecord({ id: entityId }, recordsList[0], folderOptions));
24669
25577
  if (insertError) {
24670
25578
  return fail("Error inserting record", await extractErrorMessage(insertError));
24671
25579
  }
@@ -24675,7 +25583,7 @@ var registerRecordsCommand = (program2) => {
24675
25583
  Data: result
24676
25584
  });
24677
25585
  } else {
24678
- const [insertError, result] = await catchError(sdk.entities.insertRecordsById(entityId, recordsList, folderOptions));
25586
+ const [insertError, result] = await catchError(sdk.entities.insertRecords({ id: entityId }, recordsList, folderOptions));
24679
25587
  if (insertError) {
24680
25588
  return fail("Error inserting records", await extractErrorMessage(insertError));
24681
25589
  }
@@ -24717,7 +25625,7 @@ var registerRecordsCommand = (program2) => {
24717
25625
  if (recordId === undefined || recordId === null) {
24718
25626
  return fail("Record must include an 'Id' field", "Provide the record ID in the JSON data.");
24719
25627
  }
24720
- const [updateError, result] = await catchError(sdk.entities.updateRecordById(entityId, String(recordId), record, folderOptions));
25628
+ const [updateError, result] = await catchError(sdk.entities.updateRecord({ id: entityId }, String(recordId), record, folderOptions));
24721
25629
  if (updateError) {
24722
25630
  return fail("Error updating record", await extractErrorMessage(updateError));
24723
25631
  }
@@ -24731,7 +25639,7 @@ var registerRecordsCommand = (program2) => {
24731
25639
  if (missingId) {
24732
25640
  return fail("All records must include an 'Id' field", "Provide the record ID in each JSON object.");
24733
25641
  }
24734
- const [updateError, result] = await catchError(sdk.entities.updateRecordsById(entityId, recordsList, folderOptions));
25642
+ const [updateError, result] = await catchError(sdk.entities.updateRecords({ id: entityId }, recordsList, folderOptions));
24735
25643
  if (updateError) {
24736
25644
  return fail("Error updating records", await extractErrorMessage(updateError));
24737
25645
  }
@@ -24789,7 +25697,7 @@ var registerRecordsCommand = (program2) => {
24789
25697
  if (!sdk)
24790
25698
  return;
24791
25699
  const queryPaginationOptions = options.cursor !== undefined ? { pageSize, cursor: { value: options.cursor } } : jumpToPage !== undefined ? { pageSize, jumpToPage } : { pageSize };
24792
- const [queryError, result] = await catchError(sdk.entities.queryRecordsById(entityId, {
25700
+ const [queryError, result] = await catchError(sdk.entities.queryRecords({ id: entityId }, {
24793
25701
  ...queryBody !== null && queryBody,
24794
25702
  ...queryPaginationOptions,
24795
25703
  ...options.folderKey !== undefined && {
@@ -24819,7 +25727,7 @@ var registerRecordsCommand = (program2) => {
24819
25727
  const fs2 = getFileSystem();
24820
25728
  const fileName = fs2.path.basename(options.file) || "import.csv";
24821
25729
  const csvFile = new File([fileContent], fileName, { type: "text/csv" });
24822
- const [importError, result] = await catchError(sdk.entities.importRecordsById(entityId, csvFile, options.folderKey !== undefined ? { folderKey: options.folderKey } : undefined));
25730
+ const [importError, result] = await catchError(sdk.entities.importRecords({ id: entityId }, csvFile, options.folderKey !== undefined ? { folderKey: options.folderKey } : undefined));
24823
25731
  if (importError) {
24824
25732
  return fail("Error importing records", await extractErrorMessage(importError));
24825
25733
  }
@@ -24843,7 +25751,7 @@ var registerRecordsCommand = (program2) => {
24843
25751
  const sdk = await connectOrFail(options.tenant);
24844
25752
  if (!sdk)
24845
25753
  return;
24846
- const [deleteError, result] = await catchError(sdk.entities.deleteRecordsById(entityId, recordIds, options.folderKey !== undefined ? { folderKey: options.folderKey } : undefined));
25754
+ const [deleteError, result] = await catchError(sdk.entities.deleteRecords({ id: entityId }, recordIds, options.folderKey !== undefined ? { folderKey: options.folderKey } : undefined));
24847
25755
  if (deleteError) {
24848
25756
  return fail("Error deleting records", await extractErrorMessage(deleteError));
24849
25757
  }
@@ -24935,4 +25843,4 @@ var registerCommands = async (program2) => {
24935
25843
 
24936
25844
  export { Command, metadata, registerCommands };
24937
25845
 
24938
- //# debugId=07DCFCD8FD86D2D164756E2164756E21
25846
+ //# debugId=D95046DB60FF1A9464756E2164756E21