@uipath/uipath-typescript 1.3.11 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/agent-memory/index.cjs +1765 -0
  2. package/dist/agent-memory/index.d.ts +588 -0
  3. package/dist/agent-memory/index.mjs +1763 -0
  4. package/dist/agents/index.cjs +1726 -0
  5. package/dist/agents/index.d.ts +502 -0
  6. package/dist/agents/index.mjs +1724 -0
  7. package/dist/assets/index.cjs +155 -30
  8. package/dist/assets/index.d.ts +84 -5
  9. package/dist/assets/index.mjs +155 -30
  10. package/dist/attachments/index.cjs +37 -6
  11. package/dist/attachments/index.d.ts +1 -0
  12. package/dist/attachments/index.mjs +37 -6
  13. package/dist/buckets/index.cjs +37 -6
  14. package/dist/buckets/index.d.ts +1 -0
  15. package/dist/buckets/index.mjs +37 -6
  16. package/dist/cases/index.cjs +141 -10
  17. package/dist/cases/index.d.ts +118 -7
  18. package/dist/cases/index.mjs +141 -11
  19. package/dist/conversational-agent/index.cjs +124 -57
  20. package/dist/conversational-agent/index.d.ts +190 -122
  21. package/dist/conversational-agent/index.mjs +124 -57
  22. package/dist/core/index.cjs +413 -105
  23. package/dist/core/index.d.ts +15 -0
  24. package/dist/core/index.mjs +413 -105
  25. package/dist/entities/index.cjs +122 -43
  26. package/dist/entities/index.d.ts +140 -35
  27. package/dist/entities/index.mjs +122 -43
  28. package/dist/feedback/index.cjs +37 -6
  29. package/dist/feedback/index.d.ts +1 -0
  30. package/dist/feedback/index.mjs +37 -6
  31. package/dist/governance/index.cjs +1782 -0
  32. package/dist/governance/index.d.ts +598 -0
  33. package/dist/governance/index.mjs +1780 -0
  34. package/dist/index.cjs +956 -283
  35. package/dist/index.d.ts +1138 -121
  36. package/dist/index.mjs +956 -284
  37. package/dist/index.umd.js +3113 -2423
  38. package/dist/jobs/index.cjs +37 -6
  39. package/dist/jobs/index.d.ts +1 -0
  40. package/dist/jobs/index.mjs +37 -6
  41. package/dist/maestro-processes/index.cjs +173 -18
  42. package/dist/maestro-processes/index.d.ts +131 -9
  43. package/dist/maestro-processes/index.mjs +173 -18
  44. package/dist/processes/index.cjs +37 -6
  45. package/dist/processes/index.d.ts +1 -0
  46. package/dist/processes/index.mjs +37 -6
  47. package/dist/queues/index.cjs +37 -6
  48. package/dist/queues/index.d.ts +1 -0
  49. package/dist/queues/index.mjs +37 -6
  50. package/dist/tasks/index.cjs +37 -6
  51. package/dist/tasks/index.d.ts +1 -0
  52. package/dist/tasks/index.mjs +37 -6
  53. package/dist/traces/index.cjs +37 -6
  54. package/dist/traces/index.d.ts +1 -0
  55. package/dist/traces/index.mjs +37 -6
  56. package/package.json +32 -2
@@ -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
@@ -1342,8 +1368,9 @@ class PaginationHelpers {
1342
1368
  });
1343
1369
  }
1344
1370
  // 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];
1371
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1372
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1373
+ const rawItems = Array.isArray(response.data) ? response.data : resolveNestedField(response.data, itemsField);
1347
1374
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1348
1375
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1349
1376
  // Parse items - automatically handle JSON string responses
@@ -1389,7 +1416,7 @@ class PaginationHelpers {
1389
1416
  getEndpoint: config.getEndpoint,
1390
1417
  folderId,
1391
1418
  headers: config.headers,
1392
- paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1419
+ paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
1393
1420
  additionalParams: prefixedOptions,
1394
1421
  transformFn: config.transformFn,
1395
1422
  method: config.method,
@@ -1647,6 +1674,8 @@ class BaseService {
1647
1674
  // When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
1648
1675
  // When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
1649
1676
  const convertToSkip = paginationParams?.convertToSkip ?? true;
1677
+ // When true, sends pageNumber - 1 (for 0-based APIs). Default false (1-based).
1678
+ const zeroBased = paginationParams?.zeroBased ?? false;
1650
1679
  requestParams[pageSizeParam] = limitedPageSize;
1651
1680
  if (convertToSkip) {
1652
1681
  if (params.pageNumber && params.pageNumber > 1) {
@@ -1654,7 +1683,8 @@ class BaseService {
1654
1683
  }
1655
1684
  }
1656
1685
  else {
1657
- requestParams[offsetParam] = params.pageNumber || 1;
1686
+ const sdkPageNumber = params.pageNumber || 1;
1687
+ requestParams[offsetParam] = zeroBased ? sdkPageNumber - 1 : sdkPageNumber;
1658
1688
  }
1659
1689
  {
1660
1690
  requestParams[countParam] = true;
@@ -1683,8 +1713,9 @@ class BaseService {
1683
1713
  const totalCountField = fields.totalCountField || 'totalRecordCount';
1684
1714
  const continuationTokenField = fields.continuationTokenField || 'continuationToken';
1685
1715
  // 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] || []);
1716
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1717
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1718
+ const items = Array.isArray(response.data) ? response.data : (resolveNestedField(response.data, itemsField) || []);
1688
1719
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1689
1720
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1690
1721
  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
@@ -1281,8 +1307,9 @@ class PaginationHelpers {
1281
1307
  });
1282
1308
  }
1283
1309
  // 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];
1310
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1311
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1312
+ const rawItems = Array.isArray(response.data) ? response.data : resolveNestedField(response.data, itemsField);
1286
1313
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1287
1314
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1288
1315
  // Parse items - automatically handle JSON string responses
@@ -1328,7 +1355,7 @@ class PaginationHelpers {
1328
1355
  getEndpoint: config.getEndpoint,
1329
1356
  folderId,
1330
1357
  headers: config.headers,
1331
- paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1358
+ paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
1332
1359
  additionalParams: prefixedOptions,
1333
1360
  transformFn: config.transformFn,
1334
1361
  method: config.method,
@@ -1586,6 +1613,8 @@ class BaseService {
1586
1613
  // When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
1587
1614
  // When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
1588
1615
  const convertToSkip = paginationParams?.convertToSkip ?? true;
1616
+ // When true, sends pageNumber - 1 (for 0-based APIs). Default false (1-based).
1617
+ const zeroBased = paginationParams?.zeroBased ?? false;
1589
1618
  requestParams[pageSizeParam] = limitedPageSize;
1590
1619
  if (convertToSkip) {
1591
1620
  if (params.pageNumber && params.pageNumber > 1) {
@@ -1593,7 +1622,8 @@ class BaseService {
1593
1622
  }
1594
1623
  }
1595
1624
  else {
1596
- requestParams[offsetParam] = params.pageNumber || 1;
1625
+ const sdkPageNumber = params.pageNumber || 1;
1626
+ requestParams[offsetParam] = zeroBased ? sdkPageNumber - 1 : sdkPageNumber;
1597
1627
  }
1598
1628
  {
1599
1629
  requestParams[countParam] = true;
@@ -1622,8 +1652,9 @@ class BaseService {
1622
1652
  const totalCountField = fields.totalCountField || 'totalRecordCount';
1623
1653
  const continuationTokenField = fields.continuationTokenField || 'continuationToken';
1624
1654
  // 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] || []);
1655
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1656
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1657
+ const items = Array.isArray(response.data) ? response.data : (resolveNestedField(response.data, itemsField) || []);
1627
1658
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1628
1659
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1629
1660
  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
@@ -1279,8 +1305,9 @@ class PaginationHelpers {
1279
1305
  });
1280
1306
  }
1281
1307
  // 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];
1308
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1309
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1310
+ const rawItems = Array.isArray(response.data) ? response.data : resolveNestedField(response.data, itemsField);
1284
1311
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1285
1312
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1286
1313
  // Parse items - automatically handle JSON string responses
@@ -1326,7 +1353,7 @@ class PaginationHelpers {
1326
1353
  getEndpoint: config.getEndpoint,
1327
1354
  folderId,
1328
1355
  headers: config.headers,
1329
- paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1356
+ paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
1330
1357
  additionalParams: prefixedOptions,
1331
1358
  transformFn: config.transformFn,
1332
1359
  method: config.method,
@@ -1584,6 +1611,8 @@ class BaseService {
1584
1611
  // When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
1585
1612
  // When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
1586
1613
  const convertToSkip = paginationParams?.convertToSkip ?? true;
1614
+ // When true, sends pageNumber - 1 (for 0-based APIs). Default false (1-based).
1615
+ const zeroBased = paginationParams?.zeroBased ?? false;
1587
1616
  requestParams[pageSizeParam] = limitedPageSize;
1588
1617
  if (convertToSkip) {
1589
1618
  if (params.pageNumber && params.pageNumber > 1) {
@@ -1591,7 +1620,8 @@ class BaseService {
1591
1620
  }
1592
1621
  }
1593
1622
  else {
1594
- requestParams[offsetParam] = params.pageNumber || 1;
1623
+ const sdkPageNumber = params.pageNumber || 1;
1624
+ requestParams[offsetParam] = zeroBased ? sdkPageNumber - 1 : sdkPageNumber;
1595
1625
  }
1596
1626
  {
1597
1627
  requestParams[countParam] = true;
@@ -1620,8 +1650,9 @@ class BaseService {
1620
1650
  const totalCountField = fields.totalCountField || 'totalRecordCount';
1621
1651
  const continuationTokenField = fields.continuationTokenField || 'continuationToken';
1622
1652
  // 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] || []);
1653
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1654
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1655
+ const items = Array.isArray(response.data) ? response.data : (resolveNestedField(response.data, itemsField) || []);
1625
1656
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1626
1657
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1627
1658
  const continuationToken = response.data[continuationTokenField];
@@ -979,6 +979,32 @@ function getLimitedPageSize(pageSize) {
979
979
  */
980
980
  const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
981
981
  isBrowser && window.self != window.top && window.location.href.includes('source=ActionCenter');
982
+ const _params = isBrowser ? new URLSearchParams(window.location.search) : null;
983
+ /**
984
+ * True when the coded app has been loaded inside a host frame that explicitly
985
+ * opted into token delegation by adding `?host=embed` to the iframe src URL.
986
+ */
987
+ const isHostEmbedded = isBrowser && window.self !== window.top && _params?.get('host') === 'embed';
988
+ /**
989
+ * The validated parent origin, read from the `?basedomain=` query param set
990
+ * by the embedding host in the iframe src URL.
991
+ * Mirrors the same mechanism used by ActionCenterTokenManager.
992
+ * Non-null only when `?host=embed` is present and `?basedomain=` is a valid URL.
993
+ */
994
+ (() => {
995
+ if (!isHostEmbedded)
996
+ return null;
997
+ const basedomain = _params?.get('basedomain');
998
+ if (!basedomain)
999
+ return null;
1000
+ try {
1001
+ return new URL(basedomain).origin;
1002
+ }
1003
+ catch {
1004
+ console.warn('embeddingOrigin: basedomain query param is not a valid URL', basedomain);
1005
+ return null;
1006
+ }
1007
+ })();
982
1008
 
983
1009
  /**
984
1010
  * Base64 encoding/decoding
@@ -1208,8 +1234,9 @@ class PaginationHelpers {
1208
1234
  });
1209
1235
  }
1210
1236
  // Extract and transform items from response
1211
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1212
- const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
1237
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1238
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1239
+ const rawItems = Array.isArray(response.data) ? response.data : resolveNestedField(response.data, itemsField);
1213
1240
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1214
1241
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1215
1242
  // Parse items - automatically handle JSON string responses
@@ -1255,7 +1282,7 @@ class PaginationHelpers {
1255
1282
  getEndpoint: config.getEndpoint,
1256
1283
  folderId,
1257
1284
  headers: config.headers,
1258
- paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1285
+ paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
1259
1286
  additionalParams: prefixedOptions,
1260
1287
  transformFn: config.transformFn,
1261
1288
  method: config.method,
@@ -1944,6 +1971,8 @@ class BaseService {
1944
1971
  // When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
1945
1972
  // When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
1946
1973
  const convertToSkip = paginationParams?.convertToSkip ?? true;
1974
+ // When true, sends pageNumber - 1 (for 0-based APIs). Default false (1-based).
1975
+ const zeroBased = paginationParams?.zeroBased ?? false;
1947
1976
  requestParams[pageSizeParam] = limitedPageSize;
1948
1977
  if (convertToSkip) {
1949
1978
  if (params.pageNumber && params.pageNumber > 1) {
@@ -1951,7 +1980,8 @@ class BaseService {
1951
1980
  }
1952
1981
  }
1953
1982
  else {
1954
- requestParams[offsetParam] = params.pageNumber || 1;
1983
+ const sdkPageNumber = params.pageNumber || 1;
1984
+ requestParams[offsetParam] = zeroBased ? sdkPageNumber - 1 : sdkPageNumber;
1955
1985
  }
1956
1986
  {
1957
1987
  requestParams[countParam] = true;
@@ -1980,8 +2010,9 @@ class BaseService {
1980
2010
  const totalCountField = fields.totalCountField || 'totalRecordCount';
1981
2011
  const continuationTokenField = fields.continuationTokenField || 'continuationToken';
1982
2012
  // Extract items and metadata
1983
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1984
- const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
2013
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
2014
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
2015
+ const items = Array.isArray(response.data) ? response.data : (resolveNestedField(response.data, itemsField) || []);
1985
2016
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1986
2017
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1987
2018
  const continuationToken = response.data[continuationTokenField];
@@ -705,6 +705,7 @@ interface RequestWithPaginationOptions extends RequestSpec {
705
705
  tokenParam?: string;
706
706
  countParam?: string;
707
707
  convertToSkip?: boolean;
708
+ zeroBased?: boolean;
708
709
  };
709
710
  };
710
711
  }
@@ -977,6 +977,32 @@ function getLimitedPageSize(pageSize) {
977
977
  */
978
978
  const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
979
979
  isBrowser && window.self != window.top && window.location.href.includes('source=ActionCenter');
980
+ const _params = isBrowser ? new URLSearchParams(window.location.search) : null;
981
+ /**
982
+ * True when the coded app has been loaded inside a host frame that explicitly
983
+ * opted into token delegation by adding `?host=embed` to the iframe src URL.
984
+ */
985
+ const isHostEmbedded = isBrowser && window.self !== window.top && _params?.get('host') === 'embed';
986
+ /**
987
+ * The validated parent origin, read from the `?basedomain=` query param set
988
+ * by the embedding host in the iframe src URL.
989
+ * Mirrors the same mechanism used by ActionCenterTokenManager.
990
+ * Non-null only when `?host=embed` is present and `?basedomain=` is a valid URL.
991
+ */
992
+ (() => {
993
+ if (!isHostEmbedded)
994
+ return null;
995
+ const basedomain = _params?.get('basedomain');
996
+ if (!basedomain)
997
+ return null;
998
+ try {
999
+ return new URL(basedomain).origin;
1000
+ }
1001
+ catch {
1002
+ console.warn('embeddingOrigin: basedomain query param is not a valid URL', basedomain);
1003
+ return null;
1004
+ }
1005
+ })();
980
1006
 
981
1007
  /**
982
1008
  * Base64 encoding/decoding
@@ -1206,8 +1232,9 @@ class PaginationHelpers {
1206
1232
  });
1207
1233
  }
1208
1234
  // Extract and transform items from response
1209
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1210
- const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
1235
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1236
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1237
+ const rawItems = Array.isArray(response.data) ? response.data : resolveNestedField(response.data, itemsField);
1211
1238
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1212
1239
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1213
1240
  // Parse items - automatically handle JSON string responses
@@ -1253,7 +1280,7 @@ class PaginationHelpers {
1253
1280
  getEndpoint: config.getEndpoint,
1254
1281
  folderId,
1255
1282
  headers: config.headers,
1256
- paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1283
+ paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
1257
1284
  additionalParams: prefixedOptions,
1258
1285
  transformFn: config.transformFn,
1259
1286
  method: config.method,
@@ -1942,6 +1969,8 @@ class BaseService {
1942
1969
  // When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
1943
1970
  // When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
1944
1971
  const convertToSkip = paginationParams?.convertToSkip ?? true;
1972
+ // When true, sends pageNumber - 1 (for 0-based APIs). Default false (1-based).
1973
+ const zeroBased = paginationParams?.zeroBased ?? false;
1945
1974
  requestParams[pageSizeParam] = limitedPageSize;
1946
1975
  if (convertToSkip) {
1947
1976
  if (params.pageNumber && params.pageNumber > 1) {
@@ -1949,7 +1978,8 @@ class BaseService {
1949
1978
  }
1950
1979
  }
1951
1980
  else {
1952
- requestParams[offsetParam] = params.pageNumber || 1;
1981
+ const sdkPageNumber = params.pageNumber || 1;
1982
+ requestParams[offsetParam] = zeroBased ? sdkPageNumber - 1 : sdkPageNumber;
1953
1983
  }
1954
1984
  {
1955
1985
  requestParams[countParam] = true;
@@ -1978,8 +2008,9 @@ class BaseService {
1978
2008
  const totalCountField = fields.totalCountField || 'totalRecordCount';
1979
2009
  const continuationTokenField = fields.continuationTokenField || 'continuationToken';
1980
2010
  // Extract items and metadata
1981
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1982
- const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
2011
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
2012
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
2013
+ const items = Array.isArray(response.data) ? response.data : (resolveNestedField(response.data, itemsField) || []);
1983
2014
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1984
2015
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1985
2016
  const continuationToken = response.data[continuationTokenField];
@@ -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
@@ -1228,8 +1254,9 @@ class PaginationHelpers {
1228
1254
  });
1229
1255
  }
1230
1256
  // Extract and transform items from response
1231
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1232
- const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
1257
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1258
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1259
+ const rawItems = Array.isArray(response.data) ? response.data : resolveNestedField(response.data, itemsField);
1233
1260
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1234
1261
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1235
1262
  // Parse items - automatically handle JSON string responses
@@ -1275,7 +1302,7 @@ class PaginationHelpers {
1275
1302
  getEndpoint: config.getEndpoint,
1276
1303
  folderId,
1277
1304
  headers: config.headers,
1278
- paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1305
+ paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
1279
1306
  additionalParams: prefixedOptions,
1280
1307
  transformFn: config.transformFn,
1281
1308
  method: config.method,
@@ -1533,6 +1560,8 @@ class BaseService {
1533
1560
  // When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
1534
1561
  // When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
1535
1562
  const convertToSkip = paginationParams?.convertToSkip ?? true;
1563
+ // When true, sends pageNumber - 1 (for 0-based APIs). Default false (1-based).
1564
+ const zeroBased = paginationParams?.zeroBased ?? false;
1536
1565
  requestParams[pageSizeParam] = limitedPageSize;
1537
1566
  if (convertToSkip) {
1538
1567
  if (params.pageNumber && params.pageNumber > 1) {
@@ -1540,7 +1569,8 @@ class BaseService {
1540
1569
  }
1541
1570
  }
1542
1571
  else {
1543
- requestParams[offsetParam] = params.pageNumber || 1;
1572
+ const sdkPageNumber = params.pageNumber || 1;
1573
+ requestParams[offsetParam] = zeroBased ? sdkPageNumber - 1 : sdkPageNumber;
1544
1574
  }
1545
1575
  {
1546
1576
  requestParams[countParam] = true;
@@ -1569,8 +1599,9 @@ class BaseService {
1569
1599
  const totalCountField = fields.totalCountField || 'totalRecordCount';
1570
1600
  const continuationTokenField = fields.continuationTokenField || 'continuationToken';
1571
1601
  // Extract items and metadata
1572
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1573
- const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
1602
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1603
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1604
+ const items = Array.isArray(response.data) ? response.data : (resolveNestedField(response.data, itemsField) || []);
1574
1605
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1575
1606
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1576
1607
  const continuationToken = response.data[continuationTokenField];
@@ -89,6 +89,7 @@ interface RequestWithPaginationOptions extends RequestSpec {
89
89
  tokenParam?: string;
90
90
  countParam?: string;
91
91
  convertToSkip?: boolean;
92
+ zeroBased?: boolean;
92
93
  };
93
94
  };
94
95
  }
@@ -717,6 +717,32 @@ function filterUndefined(obj) {
717
717
  */
718
718
  const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
719
719
  isBrowser && window.self != window.top && window.location.href.includes('source=ActionCenter');
720
+ const _params = isBrowser ? new URLSearchParams(window.location.search) : null;
721
+ /**
722
+ * True when the coded app has been loaded inside a host frame that explicitly
723
+ * opted into token delegation by adding `?host=embed` to the iframe src URL.
724
+ */
725
+ const isHostEmbedded = isBrowser && window.self !== window.top && _params?.get('host') === 'embed';
726
+ /**
727
+ * The validated parent origin, read from the `?basedomain=` query param set
728
+ * by the embedding host in the iframe src URL.
729
+ * Mirrors the same mechanism used by ActionCenterTokenManager.
730
+ * Non-null only when `?host=embed` is present and `?basedomain=` is a valid URL.
731
+ */
732
+ (() => {
733
+ if (!isHostEmbedded)
734
+ return null;
735
+ const basedomain = _params?.get('basedomain');
736
+ if (!basedomain)
737
+ return null;
738
+ try {
739
+ return new URL(basedomain).origin;
740
+ }
741
+ catch {
742
+ console.warn('embeddingOrigin: basedomain query param is not a valid URL', basedomain);
743
+ return null;
744
+ }
745
+ })();
720
746
 
721
747
  /**
722
748
  * Base64 encoding/decoding
@@ -1226,8 +1252,9 @@ class PaginationHelpers {
1226
1252
  });
1227
1253
  }
1228
1254
  // Extract and transform items from response
1229
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1230
- const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
1255
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1256
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1257
+ const rawItems = Array.isArray(response.data) ? response.data : resolveNestedField(response.data, itemsField);
1231
1258
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1232
1259
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1233
1260
  // Parse items - automatically handle JSON string responses
@@ -1273,7 +1300,7 @@ class PaginationHelpers {
1273
1300
  getEndpoint: config.getEndpoint,
1274
1301
  folderId,
1275
1302
  headers: config.headers,
1276
- paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1303
+ paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
1277
1304
  additionalParams: prefixedOptions,
1278
1305
  transformFn: config.transformFn,
1279
1306
  method: config.method,
@@ -1531,6 +1558,8 @@ class BaseService {
1531
1558
  // When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
1532
1559
  // When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
1533
1560
  const convertToSkip = paginationParams?.convertToSkip ?? true;
1561
+ // When true, sends pageNumber - 1 (for 0-based APIs). Default false (1-based).
1562
+ const zeroBased = paginationParams?.zeroBased ?? false;
1534
1563
  requestParams[pageSizeParam] = limitedPageSize;
1535
1564
  if (convertToSkip) {
1536
1565
  if (params.pageNumber && params.pageNumber > 1) {
@@ -1538,7 +1567,8 @@ class BaseService {
1538
1567
  }
1539
1568
  }
1540
1569
  else {
1541
- requestParams[offsetParam] = params.pageNumber || 1;
1570
+ const sdkPageNumber = params.pageNumber || 1;
1571
+ requestParams[offsetParam] = zeroBased ? sdkPageNumber - 1 : sdkPageNumber;
1542
1572
  }
1543
1573
  {
1544
1574
  requestParams[countParam] = true;
@@ -1567,8 +1597,9 @@ class BaseService {
1567
1597
  const totalCountField = fields.totalCountField || 'totalRecordCount';
1568
1598
  const continuationTokenField = fields.continuationTokenField || 'continuationToken';
1569
1599
  // Extract items and metadata
1570
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1571
- const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
1600
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1601
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1602
+ const items = Array.isArray(response.data) ? response.data : (resolveNestedField(response.data, itemsField) || []);
1572
1603
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1573
1604
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1574
1605
  const continuationToken = response.data[continuationTokenField];