@uipath/uipath-typescript 1.3.11 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/agent-memory/index.cjs +1772 -0
  2. package/dist/agent-memory/index.d.ts +588 -0
  3. package/dist/agent-memory/index.mjs +1770 -0
  4. package/dist/agents/index.cjs +1995 -0
  5. package/dist/agents/index.d.ts +961 -0
  6. package/dist/agents/index.mjs +1993 -0
  7. package/dist/assets/index.cjs +171 -39
  8. package/dist/assets/index.d.ts +84 -5
  9. package/dist/assets/index.mjs +171 -39
  10. package/dist/attachments/index.cjs +53 -15
  11. package/dist/attachments/index.d.ts +1 -0
  12. package/dist/attachments/index.mjs +53 -15
  13. package/dist/buckets/index.cjs +151 -130
  14. package/dist/buckets/index.d.ts +198 -84
  15. package/dist/buckets/index.mjs +151 -130
  16. package/dist/cases/index.cjs +220 -23
  17. package/dist/cases/index.d.ts +148 -10
  18. package/dist/cases/index.mjs +220 -24
  19. package/dist/conversational-agent/index.cjs +140 -66
  20. package/dist/conversational-agent/index.d.ts +190 -122
  21. package/dist/conversational-agent/index.mjs +140 -66
  22. package/dist/core/index.cjs +445 -108
  23. package/dist/core/index.d.ts +15 -0
  24. package/dist/core/index.mjs +445 -108
  25. package/dist/entities/index.cjs +365 -102
  26. package/dist/entities/index.d.ts +446 -114
  27. package/dist/entities/index.mjs +365 -102
  28. package/dist/feedback/index.cjs +53 -15
  29. package/dist/feedback/index.d.ts +1 -0
  30. package/dist/feedback/index.mjs +53 -15
  31. package/dist/governance/index.cjs +1789 -0
  32. package/dist/governance/index.d.ts +598 -0
  33. package/dist/governance/index.mjs +1787 -0
  34. package/dist/index.cjs +1453 -444
  35. package/dist/index.d.ts +4150 -1742
  36. package/dist/index.mjs +1452 -445
  37. package/dist/index.umd.js +5035 -4009
  38. package/dist/jobs/index.cjs +53 -15
  39. package/dist/jobs/index.d.ts +1 -0
  40. package/dist/jobs/index.mjs +53 -15
  41. package/dist/maestro-processes/index.cjs +189 -27
  42. package/dist/maestro-processes/index.d.ts +131 -9
  43. package/dist/maestro-processes/index.mjs +189 -27
  44. package/dist/orchestrator-du-module/index.cjs +1788 -0
  45. package/dist/orchestrator-du-module/index.d.ts +757 -0
  46. package/dist/orchestrator-du-module/index.mjs +1785 -0
  47. package/dist/processes/index.cjs +53 -15
  48. package/dist/processes/index.d.ts +1 -0
  49. package/dist/processes/index.mjs +53 -15
  50. package/dist/queues/index.cjs +53 -15
  51. package/dist/queues/index.d.ts +1 -0
  52. package/dist/queues/index.mjs +53 -15
  53. package/dist/tasks/index.cjs +116 -19
  54. package/dist/tasks/index.d.ts +110 -4
  55. package/dist/tasks/index.mjs +117 -20
  56. package/dist/traces/index.cjs +340 -15
  57. package/dist/traces/index.d.ts +483 -2
  58. package/dist/traces/index.mjs +339 -16
  59. package/package.json +42 -2
@@ -721,6 +721,32 @@ function filterUndefined(obj) {
721
721
  */
722
722
  const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
723
723
  isBrowser && window.self != window.top && window.location.href.includes('source=ActionCenter');
724
+ const _params = isBrowser ? new URLSearchParams(window.location.search) : null;
725
+ /**
726
+ * True when the coded app has been loaded inside a host frame that explicitly
727
+ * opted into token delegation by adding `?host=embed` to the iframe src URL.
728
+ */
729
+ const isHostEmbedded = isBrowser && window.self !== window.top && _params?.get('host') === 'embed';
730
+ /**
731
+ * The validated parent origin, read from the `?basedomain=` query param set
732
+ * by the embedding host in the iframe src URL.
733
+ * Mirrors the same mechanism used by ActionCenterTokenManager.
734
+ * Non-null only when `?host=embed` is present and `?basedomain=` is a valid URL.
735
+ */
736
+ (() => {
737
+ if (!isHostEmbedded)
738
+ return null;
739
+ const basedomain = _params?.get('basedomain');
740
+ if (!basedomain)
741
+ return null;
742
+ try {
743
+ return new URL(basedomain).origin;
744
+ }
745
+ catch {
746
+ console.warn('embeddingOrigin: basedomain query param is not a valid URL', basedomain);
747
+ return null;
748
+ }
749
+ })();
724
750
 
725
751
  /**
726
752
  * Base64 encoding/decoding
@@ -1295,12 +1321,18 @@ class PaginationHelpers {
1295
1321
  * @returns Promise resolving to a paginated result
1296
1322
  */
1297
1323
  static async getAllPaginated(params) {
1298
- const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1324
+ const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1299
1325
  const endpoint = getEndpoint(folderId);
1300
1326
  const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1327
+ // On POST, the caller's options go in the body; queryParams stays in the URL.
1328
+ // On GET, everything is URL — queryParams merges with additionalParams.
1329
+ const isPost = method === HTTP_METHODS.POST;
1330
+ const requestSpec = isPost
1331
+ ? { body: additionalParams, params: queryParams }
1332
+ : { params: { ...additionalParams, ...queryParams } };
1301
1333
  const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
1302
1334
  headers,
1303
- params: additionalParams,
1335
+ ...requestSpec,
1304
1336
  pagination: {
1305
1337
  paginationType: options.paginationType || PaginationType.OFFSET,
1306
1338
  itemsField: options.itemsField || DEFAULT_ITEMS_FIELD,
@@ -1325,7 +1357,7 @@ class PaginationHelpers {
1325
1357
  * @returns Promise resolving to an object with data and totalCount
1326
1358
  */
1327
1359
  static async getAllNonPaginated(params) {
1328
- const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1360
+ const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1329
1361
  // Set default field names
1330
1362
  const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
1331
1363
  const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
@@ -1335,17 +1367,18 @@ class PaginationHelpers {
1335
1367
  // Make the API call based on method
1336
1368
  let response;
1337
1369
  if (method === HTTP_METHODS.POST) {
1338
- response = await serviceAccess.post(endpoint, additionalParams, { headers });
1370
+ response = await serviceAccess.post(endpoint, additionalParams, { headers, params: queryParams });
1339
1371
  }
1340
1372
  else {
1341
1373
  response = await serviceAccess.get(endpoint, {
1342
- params: additionalParams,
1374
+ params: { ...additionalParams, ...queryParams },
1343
1375
  headers
1344
1376
  });
1345
1377
  }
1346
1378
  // Extract and transform items from response
1347
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1348
- const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
1379
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1380
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1381
+ const rawItems = Array.isArray(response.data) ? response.data : resolveNestedField(response.data, itemsField);
1349
1382
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1350
1383
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1351
1384
  // Parse items - automatically handle JSON string responses
@@ -1391,8 +1424,9 @@ class PaginationHelpers {
1391
1424
  getEndpoint: config.getEndpoint,
1392
1425
  folderId,
1393
1426
  headers: config.headers,
1394
- paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1427
+ paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
1395
1428
  additionalParams: prefixedOptions,
1429
+ queryParams: config.queryParams,
1396
1430
  transformFn: config.transformFn,
1397
1431
  method: config.method,
1398
1432
  options: {
@@ -1410,6 +1444,7 @@ class PaginationHelpers {
1410
1444
  folderId,
1411
1445
  headers: config.headers,
1412
1446
  additionalParams: prefixedOptions,
1447
+ queryParams: config.queryParams,
1413
1448
  transformFn: config.transformFn,
1414
1449
  method: config.method,
1415
1450
  options: {
@@ -1601,18 +1636,17 @@ class BaseService {
1601
1636
  const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
1602
1637
  // Prepare request parameters based on pagination type
1603
1638
  const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
1604
- // For POST requests, merge pagination params into body and set params to undefined; for GET, use query params
1639
+ // Route pagination state to wherever the API expects it (body for POST, URL for GET).
1640
+ // Caller-supplied options.body / options.params are respected as-is — the api-client
1641
+ // already handles params (URL) and body (request body) independently for every method.
1605
1642
  if (method.toUpperCase() === 'POST') {
1606
1643
  const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
1607
1644
  options.body = {
1608
1645
  ...existingBody,
1609
- ...options.params,
1610
1646
  ...requestParams
1611
1647
  };
1612
- options.params = undefined;
1613
1648
  }
1614
1649
  else {
1615
- // Merge pagination parameters with existing parameters
1616
1650
  options.params = {
1617
1651
  ...options.params,
1618
1652
  ...requestParams
@@ -1649,6 +1683,8 @@ class BaseService {
1649
1683
  // When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
1650
1684
  // When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
1651
1685
  const convertToSkip = paginationParams?.convertToSkip ?? true;
1686
+ // When true, sends pageNumber - 1 (for 0-based APIs). Default false (1-based).
1687
+ const zeroBased = paginationParams?.zeroBased ?? false;
1652
1688
  requestParams[pageSizeParam] = limitedPageSize;
1653
1689
  if (convertToSkip) {
1654
1690
  if (params.pageNumber && params.pageNumber > 1) {
@@ -1656,7 +1692,8 @@ class BaseService {
1656
1692
  }
1657
1693
  }
1658
1694
  else {
1659
- requestParams[offsetParam] = params.pageNumber || 1;
1695
+ const sdkPageNumber = params.pageNumber || 1;
1696
+ requestParams[offsetParam] = zeroBased ? sdkPageNumber - 1 : sdkPageNumber;
1660
1697
  }
1661
1698
  {
1662
1699
  requestParams[countParam] = true;
@@ -1685,8 +1722,9 @@ class BaseService {
1685
1722
  const totalCountField = fields.totalCountField || 'totalRecordCount';
1686
1723
  const continuationTokenField = fields.continuationTokenField || 'continuationToken';
1687
1724
  // Extract items and metadata
1688
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1689
- const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
1725
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1726
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1727
+ const items = Array.isArray(response.data) ? response.data : (resolveNestedField(response.data, itemsField) || []);
1690
1728
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1691
1729
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1692
1730
  const continuationToken = response.data[continuationTokenField];
@@ -107,6 +107,7 @@ interface RequestWithPaginationOptions extends RequestSpec {
107
107
  tokenParam?: string;
108
108
  countParam?: string;
109
109
  convertToSkip?: boolean;
110
+ zeroBased?: boolean;
110
111
  };
111
112
  };
112
113
  }
@@ -719,6 +719,32 @@ function filterUndefined(obj) {
719
719
  */
720
720
  const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
721
721
  isBrowser && window.self != window.top && window.location.href.includes('source=ActionCenter');
722
+ const _params = isBrowser ? new URLSearchParams(window.location.search) : null;
723
+ /**
724
+ * True when the coded app has been loaded inside a host frame that explicitly
725
+ * opted into token delegation by adding `?host=embed` to the iframe src URL.
726
+ */
727
+ const isHostEmbedded = isBrowser && window.self !== window.top && _params?.get('host') === 'embed';
728
+ /**
729
+ * The validated parent origin, read from the `?basedomain=` query param set
730
+ * by the embedding host in the iframe src URL.
731
+ * Mirrors the same mechanism used by ActionCenterTokenManager.
732
+ * Non-null only when `?host=embed` is present and `?basedomain=` is a valid URL.
733
+ */
734
+ (() => {
735
+ if (!isHostEmbedded)
736
+ return null;
737
+ const basedomain = _params?.get('basedomain');
738
+ if (!basedomain)
739
+ return null;
740
+ try {
741
+ return new URL(basedomain).origin;
742
+ }
743
+ catch {
744
+ console.warn('embeddingOrigin: basedomain query param is not a valid URL', basedomain);
745
+ return null;
746
+ }
747
+ })();
722
748
 
723
749
  /**
724
750
  * Base64 encoding/decoding
@@ -1293,12 +1319,18 @@ class PaginationHelpers {
1293
1319
  * @returns Promise resolving to a paginated result
1294
1320
  */
1295
1321
  static async getAllPaginated(params) {
1296
- const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1322
+ const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1297
1323
  const endpoint = getEndpoint(folderId);
1298
1324
  const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1325
+ // On POST, the caller's options go in the body; queryParams stays in the URL.
1326
+ // On GET, everything is URL — queryParams merges with additionalParams.
1327
+ const isPost = method === HTTP_METHODS.POST;
1328
+ const requestSpec = isPost
1329
+ ? { body: additionalParams, params: queryParams }
1330
+ : { params: { ...additionalParams, ...queryParams } };
1299
1331
  const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
1300
1332
  headers,
1301
- params: additionalParams,
1333
+ ...requestSpec,
1302
1334
  pagination: {
1303
1335
  paginationType: options.paginationType || PaginationType.OFFSET,
1304
1336
  itemsField: options.itemsField || DEFAULT_ITEMS_FIELD,
@@ -1323,7 +1355,7 @@ class PaginationHelpers {
1323
1355
  * @returns Promise resolving to an object with data and totalCount
1324
1356
  */
1325
1357
  static async getAllNonPaginated(params) {
1326
- const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1358
+ const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1327
1359
  // Set default field names
1328
1360
  const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
1329
1361
  const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
@@ -1333,17 +1365,18 @@ class PaginationHelpers {
1333
1365
  // Make the API call based on method
1334
1366
  let response;
1335
1367
  if (method === HTTP_METHODS.POST) {
1336
- response = await serviceAccess.post(endpoint, additionalParams, { headers });
1368
+ response = await serviceAccess.post(endpoint, additionalParams, { headers, params: queryParams });
1337
1369
  }
1338
1370
  else {
1339
1371
  response = await serviceAccess.get(endpoint, {
1340
- params: additionalParams,
1372
+ params: { ...additionalParams, ...queryParams },
1341
1373
  headers
1342
1374
  });
1343
1375
  }
1344
1376
  // Extract and transform items from response
1345
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1346
- const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
1377
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1378
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1379
+ const rawItems = Array.isArray(response.data) ? response.data : resolveNestedField(response.data, itemsField);
1347
1380
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1348
1381
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1349
1382
  // Parse items - automatically handle JSON string responses
@@ -1389,8 +1422,9 @@ class PaginationHelpers {
1389
1422
  getEndpoint: config.getEndpoint,
1390
1423
  folderId,
1391
1424
  headers: config.headers,
1392
- paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1425
+ paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
1393
1426
  additionalParams: prefixedOptions,
1427
+ queryParams: config.queryParams,
1394
1428
  transformFn: config.transformFn,
1395
1429
  method: config.method,
1396
1430
  options: {
@@ -1408,6 +1442,7 @@ class PaginationHelpers {
1408
1442
  folderId,
1409
1443
  headers: config.headers,
1410
1444
  additionalParams: prefixedOptions,
1445
+ queryParams: config.queryParams,
1411
1446
  transformFn: config.transformFn,
1412
1447
  method: config.method,
1413
1448
  options: {
@@ -1599,18 +1634,17 @@ class BaseService {
1599
1634
  const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
1600
1635
  // Prepare request parameters based on pagination type
1601
1636
  const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
1602
- // For POST requests, merge pagination params into body and set params to undefined; for GET, use query params
1637
+ // Route pagination state to wherever the API expects it (body for POST, URL for GET).
1638
+ // Caller-supplied options.body / options.params are respected as-is — the api-client
1639
+ // already handles params (URL) and body (request body) independently for every method.
1603
1640
  if (method.toUpperCase() === 'POST') {
1604
1641
  const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
1605
1642
  options.body = {
1606
1643
  ...existingBody,
1607
- ...options.params,
1608
1644
  ...requestParams
1609
1645
  };
1610
- options.params = undefined;
1611
1646
  }
1612
1647
  else {
1613
- // Merge pagination parameters with existing parameters
1614
1648
  options.params = {
1615
1649
  ...options.params,
1616
1650
  ...requestParams
@@ -1647,6 +1681,8 @@ class BaseService {
1647
1681
  // When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
1648
1682
  // When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
1649
1683
  const convertToSkip = paginationParams?.convertToSkip ?? true;
1684
+ // When true, sends pageNumber - 1 (for 0-based APIs). Default false (1-based).
1685
+ const zeroBased = paginationParams?.zeroBased ?? false;
1650
1686
  requestParams[pageSizeParam] = limitedPageSize;
1651
1687
  if (convertToSkip) {
1652
1688
  if (params.pageNumber && params.pageNumber > 1) {
@@ -1654,7 +1690,8 @@ class BaseService {
1654
1690
  }
1655
1691
  }
1656
1692
  else {
1657
- requestParams[offsetParam] = params.pageNumber || 1;
1693
+ const sdkPageNumber = params.pageNumber || 1;
1694
+ requestParams[offsetParam] = zeroBased ? sdkPageNumber - 1 : sdkPageNumber;
1658
1695
  }
1659
1696
  {
1660
1697
  requestParams[countParam] = true;
@@ -1683,8 +1720,9 @@ class BaseService {
1683
1720
  const totalCountField = fields.totalCountField || 'totalRecordCount';
1684
1721
  const continuationTokenField = fields.continuationTokenField || 'continuationToken';
1685
1722
  // Extract items and metadata
1686
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1687
- const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
1723
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1724
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1725
+ const items = Array.isArray(response.data) ? response.data : (resolveNestedField(response.data, itemsField) || []);
1688
1726
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1689
1727
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1690
1728
  const continuationToken = response.data[continuationTokenField];
@@ -721,6 +721,32 @@ function filterUndefined(obj) {
721
721
  */
722
722
  const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
723
723
  isBrowser && window.self != window.top && window.location.href.includes('source=ActionCenter');
724
+ const _params = isBrowser ? new URLSearchParams(window.location.search) : null;
725
+ /**
726
+ * True when the coded app has been loaded inside a host frame that explicitly
727
+ * opted into token delegation by adding `?host=embed` to the iframe src URL.
728
+ */
729
+ const isHostEmbedded = isBrowser && window.self !== window.top && _params?.get('host') === 'embed';
730
+ /**
731
+ * The validated parent origin, read from the `?basedomain=` query param set
732
+ * by the embedding host in the iframe src URL.
733
+ * Mirrors the same mechanism used by ActionCenterTokenManager.
734
+ * Non-null only when `?host=embed` is present and `?basedomain=` is a valid URL.
735
+ */
736
+ (() => {
737
+ if (!isHostEmbedded)
738
+ return null;
739
+ const basedomain = _params?.get('basedomain');
740
+ if (!basedomain)
741
+ return null;
742
+ try {
743
+ return new URL(basedomain).origin;
744
+ }
745
+ catch {
746
+ console.warn('embeddingOrigin: basedomain query param is not a valid URL', basedomain);
747
+ return null;
748
+ }
749
+ })();
724
750
 
725
751
  /**
726
752
  * Base64 encoding/decoding
@@ -1232,12 +1258,18 @@ class PaginationHelpers {
1232
1258
  * @returns Promise resolving to a paginated result
1233
1259
  */
1234
1260
  static async getAllPaginated(params) {
1235
- const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1261
+ const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1236
1262
  const endpoint = getEndpoint(folderId);
1237
1263
  const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1264
+ // On POST, the caller's options go in the body; queryParams stays in the URL.
1265
+ // On GET, everything is URL — queryParams merges with additionalParams.
1266
+ const isPost = method === HTTP_METHODS.POST;
1267
+ const requestSpec = isPost
1268
+ ? { body: additionalParams, params: queryParams }
1269
+ : { params: { ...additionalParams, ...queryParams } };
1238
1270
  const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
1239
1271
  headers,
1240
- params: additionalParams,
1272
+ ...requestSpec,
1241
1273
  pagination: {
1242
1274
  paginationType: options.paginationType || PaginationType.OFFSET,
1243
1275
  itemsField: options.itemsField || DEFAULT_ITEMS_FIELD,
@@ -1262,7 +1294,7 @@ class PaginationHelpers {
1262
1294
  * @returns Promise resolving to an object with data and totalCount
1263
1295
  */
1264
1296
  static async getAllNonPaginated(params) {
1265
- const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1297
+ const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1266
1298
  // Set default field names
1267
1299
  const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
1268
1300
  const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
@@ -1272,17 +1304,18 @@ class PaginationHelpers {
1272
1304
  // Make the API call based on method
1273
1305
  let response;
1274
1306
  if (method === HTTP_METHODS.POST) {
1275
- response = await serviceAccess.post(endpoint, additionalParams, { headers });
1307
+ response = await serviceAccess.post(endpoint, additionalParams, { headers, params: queryParams });
1276
1308
  }
1277
1309
  else {
1278
1310
  response = await serviceAccess.get(endpoint, {
1279
- params: additionalParams,
1311
+ params: { ...additionalParams, ...queryParams },
1280
1312
  headers
1281
1313
  });
1282
1314
  }
1283
1315
  // Extract and transform items from response
1284
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1285
- const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
1316
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1317
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1318
+ const rawItems = Array.isArray(response.data) ? response.data : resolveNestedField(response.data, itemsField);
1286
1319
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1287
1320
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1288
1321
  // Parse items - automatically handle JSON string responses
@@ -1328,8 +1361,9 @@ class PaginationHelpers {
1328
1361
  getEndpoint: config.getEndpoint,
1329
1362
  folderId,
1330
1363
  headers: config.headers,
1331
- paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1364
+ paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
1332
1365
  additionalParams: prefixedOptions,
1366
+ queryParams: config.queryParams,
1333
1367
  transformFn: config.transformFn,
1334
1368
  method: config.method,
1335
1369
  options: {
@@ -1347,6 +1381,7 @@ class PaginationHelpers {
1347
1381
  folderId,
1348
1382
  headers: config.headers,
1349
1383
  additionalParams: prefixedOptions,
1384
+ queryParams: config.queryParams,
1350
1385
  transformFn: config.transformFn,
1351
1386
  method: config.method,
1352
1387
  options: {
@@ -1538,18 +1573,17 @@ class BaseService {
1538
1573
  const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
1539
1574
  // Prepare request parameters based on pagination type
1540
1575
  const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
1541
- // For POST requests, merge pagination params into body and set params to undefined; for GET, use query params
1576
+ // Route pagination state to wherever the API expects it (body for POST, URL for GET).
1577
+ // Caller-supplied options.body / options.params are respected as-is — the api-client
1578
+ // already handles params (URL) and body (request body) independently for every method.
1542
1579
  if (method.toUpperCase() === 'POST') {
1543
1580
  const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
1544
1581
  options.body = {
1545
1582
  ...existingBody,
1546
- ...options.params,
1547
1583
  ...requestParams
1548
1584
  };
1549
- options.params = undefined;
1550
1585
  }
1551
1586
  else {
1552
- // Merge pagination parameters with existing parameters
1553
1587
  options.params = {
1554
1588
  ...options.params,
1555
1589
  ...requestParams
@@ -1586,6 +1620,8 @@ class BaseService {
1586
1620
  // When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
1587
1621
  // When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
1588
1622
  const convertToSkip = paginationParams?.convertToSkip ?? true;
1623
+ // When true, sends pageNumber - 1 (for 0-based APIs). Default false (1-based).
1624
+ const zeroBased = paginationParams?.zeroBased ?? false;
1589
1625
  requestParams[pageSizeParam] = limitedPageSize;
1590
1626
  if (convertToSkip) {
1591
1627
  if (params.pageNumber && params.pageNumber > 1) {
@@ -1593,7 +1629,8 @@ class BaseService {
1593
1629
  }
1594
1630
  }
1595
1631
  else {
1596
- requestParams[offsetParam] = params.pageNumber || 1;
1632
+ const sdkPageNumber = params.pageNumber || 1;
1633
+ requestParams[offsetParam] = zeroBased ? sdkPageNumber - 1 : sdkPageNumber;
1597
1634
  }
1598
1635
  {
1599
1636
  requestParams[countParam] = true;
@@ -1622,8 +1659,9 @@ class BaseService {
1622
1659
  const totalCountField = fields.totalCountField || 'totalRecordCount';
1623
1660
  const continuationTokenField = fields.continuationTokenField || 'continuationToken';
1624
1661
  // Extract items and metadata
1625
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1626
- const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
1662
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1663
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1664
+ const items = Array.isArray(response.data) ? response.data : (resolveNestedField(response.data, itemsField) || []);
1627
1665
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1628
1666
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1629
1667
  const continuationToken = response.data[continuationTokenField];
@@ -107,6 +107,7 @@ interface RequestWithPaginationOptions extends RequestSpec {
107
107
  tokenParam?: string;
108
108
  countParam?: string;
109
109
  convertToSkip?: boolean;
110
+ zeroBased?: boolean;
110
111
  };
111
112
  };
112
113
  }
@@ -719,6 +719,32 @@ function filterUndefined(obj) {
719
719
  */
720
720
  const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
721
721
  isBrowser && window.self != window.top && window.location.href.includes('source=ActionCenter');
722
+ const _params = isBrowser ? new URLSearchParams(window.location.search) : null;
723
+ /**
724
+ * True when the coded app has been loaded inside a host frame that explicitly
725
+ * opted into token delegation by adding `?host=embed` to the iframe src URL.
726
+ */
727
+ const isHostEmbedded = isBrowser && window.self !== window.top && _params?.get('host') === 'embed';
728
+ /**
729
+ * The validated parent origin, read from the `?basedomain=` query param set
730
+ * by the embedding host in the iframe src URL.
731
+ * Mirrors the same mechanism used by ActionCenterTokenManager.
732
+ * Non-null only when `?host=embed` is present and `?basedomain=` is a valid URL.
733
+ */
734
+ (() => {
735
+ if (!isHostEmbedded)
736
+ return null;
737
+ const basedomain = _params?.get('basedomain');
738
+ if (!basedomain)
739
+ return null;
740
+ try {
741
+ return new URL(basedomain).origin;
742
+ }
743
+ catch {
744
+ console.warn('embeddingOrigin: basedomain query param is not a valid URL', basedomain);
745
+ return null;
746
+ }
747
+ })();
722
748
 
723
749
  /**
724
750
  * Base64 encoding/decoding
@@ -1230,12 +1256,18 @@ class PaginationHelpers {
1230
1256
  * @returns Promise resolving to a paginated result
1231
1257
  */
1232
1258
  static async getAllPaginated(params) {
1233
- const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1259
+ const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1234
1260
  const endpoint = getEndpoint(folderId);
1235
1261
  const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1262
+ // On POST, the caller's options go in the body; queryParams stays in the URL.
1263
+ // On GET, everything is URL — queryParams merges with additionalParams.
1264
+ const isPost = method === HTTP_METHODS.POST;
1265
+ const requestSpec = isPost
1266
+ ? { body: additionalParams, params: queryParams }
1267
+ : { params: { ...additionalParams, ...queryParams } };
1236
1268
  const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
1237
1269
  headers,
1238
- params: additionalParams,
1270
+ ...requestSpec,
1239
1271
  pagination: {
1240
1272
  paginationType: options.paginationType || PaginationType.OFFSET,
1241
1273
  itemsField: options.itemsField || DEFAULT_ITEMS_FIELD,
@@ -1260,7 +1292,7 @@ class PaginationHelpers {
1260
1292
  * @returns Promise resolving to an object with data and totalCount
1261
1293
  */
1262
1294
  static async getAllNonPaginated(params) {
1263
- const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1295
+ const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1264
1296
  // Set default field names
1265
1297
  const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
1266
1298
  const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
@@ -1270,17 +1302,18 @@ class PaginationHelpers {
1270
1302
  // Make the API call based on method
1271
1303
  let response;
1272
1304
  if (method === HTTP_METHODS.POST) {
1273
- response = await serviceAccess.post(endpoint, additionalParams, { headers });
1305
+ response = await serviceAccess.post(endpoint, additionalParams, { headers, params: queryParams });
1274
1306
  }
1275
1307
  else {
1276
1308
  response = await serviceAccess.get(endpoint, {
1277
- params: additionalParams,
1309
+ params: { ...additionalParams, ...queryParams },
1278
1310
  headers
1279
1311
  });
1280
1312
  }
1281
1313
  // Extract and transform items from response
1282
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1283
- const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
1314
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1315
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1316
+ const rawItems = Array.isArray(response.data) ? response.data : resolveNestedField(response.data, itemsField);
1284
1317
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1285
1318
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1286
1319
  // Parse items - automatically handle JSON string responses
@@ -1326,8 +1359,9 @@ class PaginationHelpers {
1326
1359
  getEndpoint: config.getEndpoint,
1327
1360
  folderId,
1328
1361
  headers: config.headers,
1329
- paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1362
+ paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
1330
1363
  additionalParams: prefixedOptions,
1364
+ queryParams: config.queryParams,
1331
1365
  transformFn: config.transformFn,
1332
1366
  method: config.method,
1333
1367
  options: {
@@ -1345,6 +1379,7 @@ class PaginationHelpers {
1345
1379
  folderId,
1346
1380
  headers: config.headers,
1347
1381
  additionalParams: prefixedOptions,
1382
+ queryParams: config.queryParams,
1348
1383
  transformFn: config.transformFn,
1349
1384
  method: config.method,
1350
1385
  options: {
@@ -1536,18 +1571,17 @@ class BaseService {
1536
1571
  const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
1537
1572
  // Prepare request parameters based on pagination type
1538
1573
  const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
1539
- // For POST requests, merge pagination params into body and set params to undefined; for GET, use query params
1574
+ // Route pagination state to wherever the API expects it (body for POST, URL for GET).
1575
+ // Caller-supplied options.body / options.params are respected as-is — the api-client
1576
+ // already handles params (URL) and body (request body) independently for every method.
1540
1577
  if (method.toUpperCase() === 'POST') {
1541
1578
  const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
1542
1579
  options.body = {
1543
1580
  ...existingBody,
1544
- ...options.params,
1545
1581
  ...requestParams
1546
1582
  };
1547
- options.params = undefined;
1548
1583
  }
1549
1584
  else {
1550
- // Merge pagination parameters with existing parameters
1551
1585
  options.params = {
1552
1586
  ...options.params,
1553
1587
  ...requestParams
@@ -1584,6 +1618,8 @@ class BaseService {
1584
1618
  // When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
1585
1619
  // When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
1586
1620
  const convertToSkip = paginationParams?.convertToSkip ?? true;
1621
+ // When true, sends pageNumber - 1 (for 0-based APIs). Default false (1-based).
1622
+ const zeroBased = paginationParams?.zeroBased ?? false;
1587
1623
  requestParams[pageSizeParam] = limitedPageSize;
1588
1624
  if (convertToSkip) {
1589
1625
  if (params.pageNumber && params.pageNumber > 1) {
@@ -1591,7 +1627,8 @@ class BaseService {
1591
1627
  }
1592
1628
  }
1593
1629
  else {
1594
- requestParams[offsetParam] = params.pageNumber || 1;
1630
+ const sdkPageNumber = params.pageNumber || 1;
1631
+ requestParams[offsetParam] = zeroBased ? sdkPageNumber - 1 : sdkPageNumber;
1595
1632
  }
1596
1633
  {
1597
1634
  requestParams[countParam] = true;
@@ -1620,8 +1657,9 @@ class BaseService {
1620
1657
  const totalCountField = fields.totalCountField || 'totalRecordCount';
1621
1658
  const continuationTokenField = fields.continuationTokenField || 'continuationToken';
1622
1659
  // Extract items and metadata
1623
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1624
- const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
1660
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1661
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1662
+ const items = Array.isArray(response.data) ? response.data : (resolveNestedField(response.data, itemsField) || []);
1625
1663
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1626
1664
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1627
1665
  const continuationToken = response.data[continuationTokenField];