@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
@@ -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];
@@ -1870,6 +1908,26 @@ function describeFolderForError(folderId, folderKey, folderPath) {
1870
1908
  return '';
1871
1909
  }
1872
1910
 
1911
+ /**
1912
+ * Enum for Asset Value Scope
1913
+ */
1914
+ var AssetValueScope;
1915
+ (function (AssetValueScope) {
1916
+ AssetValueScope["Global"] = "Global";
1917
+ AssetValueScope["PerRobot"] = "PerRobot";
1918
+ })(AssetValueScope || (AssetValueScope = {}));
1919
+ /**
1920
+ * Enum for Asset Value Type
1921
+ */
1922
+ var AssetValueType;
1923
+ (function (AssetValueType) {
1924
+ AssetValueType["Text"] = "Text";
1925
+ AssetValueType["Bool"] = "Bool";
1926
+ AssetValueType["Integer"] = "Integer";
1927
+ AssetValueType["Credential"] = "Credential";
1928
+ AssetValueType["Secret"] = "Secret";
1929
+ })(AssetValueType || (AssetValueType = {}));
1930
+
1873
1931
  /**
1874
1932
  * Base path constants for different services
1875
1933
  */
@@ -2040,6 +2098,68 @@ class AssetService extends FolderScopedService {
2040
2098
  async getByName(name, options = {}) {
2041
2099
  return this.getByNameLookup('Asset', ASSET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap));
2042
2100
  }
2101
+ /**
2102
+ * Updates the value of an existing asset by ID.
2103
+ *
2104
+ * Fetches the asset internally to determine its type, then updates only the value while
2105
+ * preserving the asset's name, scope, and description.
2106
+ *
2107
+ * **Supported value types:** `Text`, `Integer`, and `Bool` only. Other types
2108
+ * (`Credential`, `Secret`) throw a `ValidationError`.
2109
+ *
2110
+ * The `newValue` runtime type must match the asset's `valueType`:
2111
+ * - `Text` → `string`
2112
+ * - `Integer` → `number` (integer)
2113
+ * - `Bool` → `boolean`
2114
+ *
2115
+ * @param id - Asset ID
2116
+ * @param newValue - New value to apply (string for `Text`, number for `Integer`, boolean for `Bool`)
2117
+ * @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`)
2118
+ * @returns Promise resolving when the asset has been updated
2119
+ *
2120
+ * @example
2121
+ * ```typescript
2122
+ * import { Assets } from '@uipath/uipath-typescript/assets';
2123
+ *
2124
+ * const assets = new Assets(sdk);
2125
+ *
2126
+ * // Update a Text asset by folder ID
2127
+ * await assets.updateValueById(<assetId>, 'new-value', { folderId: <folderId> });
2128
+ *
2129
+ * // Update an Integer asset by folder key (GUID)
2130
+ * await assets.updateValueById(<assetId>, 42, { folderKey: '5f6dadf1-3677-49dc-8aca-c2999dd4b3ba' });
2131
+ *
2132
+ * // Update a Bool asset by folder path
2133
+ * await assets.updateValueById(<assetId>, true, { folderPath: 'Shared/Finance' });
2134
+ * ```
2135
+ */
2136
+ async updateValueById(id, newValue, options) {
2137
+ if (!id) {
2138
+ throw new ValidationError({ message: 'id is required for updateValueById' });
2139
+ }
2140
+ if (newValue === null || newValue === undefined) {
2141
+ throw new ValidationError({ message: 'newValue is required for updateValueById' });
2142
+ }
2143
+ const headers = resolveFolderHeaders({
2144
+ folderId: options?.folderId,
2145
+ folderKey: options?.folderKey,
2146
+ folderPath: options?.folderPath,
2147
+ resourceType: 'Assets.updateValueById',
2148
+ fallbackFolderKey: this.config.folderKey,
2149
+ });
2150
+ const existingResponse = await this.get(ASSET_ENDPOINTS.GET_BY_ID(id), { headers });
2151
+ const existing = existingResponse.data;
2152
+ const valueField = resolveValueField(id, existing.ValueType, newValue);
2153
+ const body = {
2154
+ Id: id,
2155
+ Name: existing.Name,
2156
+ ValueScope: existing.ValueScope,
2157
+ ValueType: existing.ValueType,
2158
+ Description: existing.Description,
2159
+ [valueField]: newValue,
2160
+ };
2161
+ await this.put(ASSET_ENDPOINTS.GET_BY_ID(id), body, { headers });
2162
+ }
2043
2163
  }
2044
2164
  __decorate([
2045
2165
  track('Assets.GetAll')
@@ -2050,29 +2170,41 @@ __decorate([
2050
2170
  __decorate([
2051
2171
  track('Assets.GetByName')
2052
2172
  ], AssetService.prototype, "getByName", null);
2053
-
2054
- /**
2055
- * Enum for Asset Value Scope
2056
- */
2057
- var AssetValueScope;
2058
- (function (AssetValueScope) {
2059
- AssetValueScope["Global"] = "Global";
2060
- AssetValueScope["PerRobot"] = "PerRobot";
2061
- })(AssetValueScope || (AssetValueScope = {}));
2062
- /**
2063
- * Enum for Asset Value Type
2064
- */
2065
- var AssetValueType;
2066
- (function (AssetValueType) {
2067
- AssetValueType["DBConnectionString"] = "DBConnectionString";
2068
- AssetValueType["HttpConnectionString"] = "HttpConnectionString";
2069
- AssetValueType["Text"] = "Text";
2070
- AssetValueType["Bool"] = "Bool";
2071
- AssetValueType["Integer"] = "Integer";
2072
- AssetValueType["Credential"] = "Credential";
2073
- AssetValueType["WindowsCredential"] = "WindowsCredential";
2074
- AssetValueType["KeyValueList"] = "KeyValueList";
2075
- AssetValueType["Secret"] = "Secret";
2076
- })(AssetValueType || (AssetValueType = {}));
2173
+ __decorate([
2174
+ track('Assets.UpdateValueById')
2175
+ ], AssetService.prototype, "updateValueById", null);
2176
+ /**
2177
+ * Maps the asset's `valueType` to the PUT body field carrying the new value, validating
2178
+ * that the new value's runtime type matches the asset type.
2179
+ */
2180
+ function resolveValueField(id, valueType, newValue) {
2181
+ switch (valueType) {
2182
+ case AssetValueType.Text:
2183
+ if (typeof newValue !== 'string') {
2184
+ throw new ValidationError({
2185
+ message: `Asset ${id} has valueType Text; newValue must be a string, got ${typeof newValue}`,
2186
+ });
2187
+ }
2188
+ return 'StringValue';
2189
+ case AssetValueType.Integer:
2190
+ if (typeof newValue !== 'number' || !Number.isInteger(newValue)) {
2191
+ throw new ValidationError({
2192
+ message: `Asset ${id} has valueType Integer; newValue must be an integer number, got ${typeof newValue}`,
2193
+ });
2194
+ }
2195
+ return 'IntValue';
2196
+ case AssetValueType.Bool:
2197
+ if (typeof newValue !== 'boolean') {
2198
+ throw new ValidationError({
2199
+ message: `Asset ${id} has valueType Bool; newValue must be a boolean, got ${typeof newValue}`,
2200
+ });
2201
+ }
2202
+ return 'BoolValue';
2203
+ default:
2204
+ throw new ValidationError({
2205
+ message: `updateValueById only supports Text, Integer, or Bool assets; asset ${id} has valueType ${valueType}`,
2206
+ });
2207
+ }
2208
+ }
2077
2209
 
2078
2210
  export { AssetService, AssetValueScope, AssetValueType, AssetService as Assets };
@@ -958,6 +958,32 @@ function filterUndefined(obj) {
958
958
  */
959
959
  const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
960
960
  isBrowser && window.self != window.top && window.location.href.includes('source=ActionCenter');
961
+ const _params = isBrowser ? new URLSearchParams(window.location.search) : null;
962
+ /**
963
+ * True when the coded app has been loaded inside a host frame that explicitly
964
+ * opted into token delegation by adding `?host=embed` to the iframe src URL.
965
+ */
966
+ const isHostEmbedded = isBrowser && window.self !== window.top && _params?.get('host') === 'embed';
967
+ /**
968
+ * The validated parent origin, read from the `?basedomain=` query param set
969
+ * by the embedding host in the iframe src URL.
970
+ * Mirrors the same mechanism used by ActionCenterTokenManager.
971
+ * Non-null only when `?host=embed` is present and `?basedomain=` is a valid URL.
972
+ */
973
+ (() => {
974
+ if (!isHostEmbedded)
975
+ return null;
976
+ const basedomain = _params?.get('basedomain');
977
+ if (!basedomain)
978
+ return null;
979
+ try {
980
+ return new URL(basedomain).origin;
981
+ }
982
+ catch {
983
+ console.warn('embeddingOrigin: basedomain query param is not a valid URL', basedomain);
984
+ return null;
985
+ }
986
+ })();
961
987
 
962
988
  /**
963
989
  * Base64 encoding/decoding
@@ -1273,12 +1299,18 @@ class PaginationHelpers {
1273
1299
  * @returns Promise resolving to a paginated result
1274
1300
  */
1275
1301
  static async getAllPaginated(params) {
1276
- const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1302
+ const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1277
1303
  const endpoint = getEndpoint(folderId);
1278
1304
  const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1305
+ // On POST, the caller's options go in the body; queryParams stays in the URL.
1306
+ // On GET, everything is URL — queryParams merges with additionalParams.
1307
+ const isPost = method === HTTP_METHODS.POST;
1308
+ const requestSpec = isPost
1309
+ ? { body: additionalParams, params: queryParams }
1310
+ : { params: { ...additionalParams, ...queryParams } };
1279
1311
  const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
1280
1312
  headers,
1281
- params: additionalParams,
1313
+ ...requestSpec,
1282
1314
  pagination: {
1283
1315
  paginationType: options.paginationType || PaginationType.OFFSET,
1284
1316
  itemsField: options.itemsField || DEFAULT_ITEMS_FIELD,
@@ -1303,7 +1335,7 @@ class PaginationHelpers {
1303
1335
  * @returns Promise resolving to an object with data and totalCount
1304
1336
  */
1305
1337
  static async getAllNonPaginated(params) {
1306
- const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1338
+ const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1307
1339
  // Set default field names
1308
1340
  const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
1309
1341
  const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
@@ -1313,17 +1345,18 @@ class PaginationHelpers {
1313
1345
  // Make the API call based on method
1314
1346
  let response;
1315
1347
  if (method === HTTP_METHODS.POST) {
1316
- response = await serviceAccess.post(endpoint, additionalParams, { headers });
1348
+ response = await serviceAccess.post(endpoint, additionalParams, { headers, params: queryParams });
1317
1349
  }
1318
1350
  else {
1319
1351
  response = await serviceAccess.get(endpoint, {
1320
- params: additionalParams,
1352
+ params: { ...additionalParams, ...queryParams },
1321
1353
  headers
1322
1354
  });
1323
1355
  }
1324
1356
  // Extract and transform items from response
1325
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1326
- const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
1357
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1358
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1359
+ const rawItems = Array.isArray(response.data) ? response.data : resolveNestedField(response.data, itemsField);
1327
1360
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1328
1361
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1329
1362
  // Parse items - automatically handle JSON string responses
@@ -1369,8 +1402,9 @@ class PaginationHelpers {
1369
1402
  getEndpoint: config.getEndpoint,
1370
1403
  folderId,
1371
1404
  headers: config.headers,
1372
- paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1405
+ paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
1373
1406
  additionalParams: prefixedOptions,
1407
+ queryParams: config.queryParams,
1374
1408
  transformFn: config.transformFn,
1375
1409
  method: config.method,
1376
1410
  options: {
@@ -1388,6 +1422,7 @@ class PaginationHelpers {
1388
1422
  folderId,
1389
1423
  headers: config.headers,
1390
1424
  additionalParams: prefixedOptions,
1425
+ queryParams: config.queryParams,
1391
1426
  transformFn: config.transformFn,
1392
1427
  method: config.method,
1393
1428
  options: {
@@ -1579,18 +1614,17 @@ class BaseService {
1579
1614
  const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
1580
1615
  // Prepare request parameters based on pagination type
1581
1616
  const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
1582
- // For POST requests, merge pagination params into body and set params to undefined; for GET, use query params
1617
+ // Route pagination state to wherever the API expects it (body for POST, URL for GET).
1618
+ // Caller-supplied options.body / options.params are respected as-is — the api-client
1619
+ // already handles params (URL) and body (request body) independently for every method.
1583
1620
  if (method.toUpperCase() === 'POST') {
1584
1621
  const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
1585
1622
  options.body = {
1586
1623
  ...existingBody,
1587
- ...options.params,
1588
1624
  ...requestParams
1589
1625
  };
1590
- options.params = undefined;
1591
1626
  }
1592
1627
  else {
1593
- // Merge pagination parameters with existing parameters
1594
1628
  options.params = {
1595
1629
  ...options.params,
1596
1630
  ...requestParams
@@ -1627,6 +1661,8 @@ class BaseService {
1627
1661
  // When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
1628
1662
  // When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
1629
1663
  const convertToSkip = paginationParams?.convertToSkip ?? true;
1664
+ // When true, sends pageNumber - 1 (for 0-based APIs). Default false (1-based).
1665
+ const zeroBased = paginationParams?.zeroBased ?? false;
1630
1666
  requestParams[pageSizeParam] = limitedPageSize;
1631
1667
  if (convertToSkip) {
1632
1668
  if (params.pageNumber && params.pageNumber > 1) {
@@ -1634,7 +1670,8 @@ class BaseService {
1634
1670
  }
1635
1671
  }
1636
1672
  else {
1637
- requestParams[offsetParam] = params.pageNumber || 1;
1673
+ const sdkPageNumber = params.pageNumber || 1;
1674
+ requestParams[offsetParam] = zeroBased ? sdkPageNumber - 1 : sdkPageNumber;
1638
1675
  }
1639
1676
  {
1640
1677
  requestParams[countParam] = true;
@@ -1663,8 +1700,9 @@ class BaseService {
1663
1700
  const totalCountField = fields.totalCountField || 'totalRecordCount';
1664
1701
  const continuationTokenField = fields.continuationTokenField || 'continuationToken';
1665
1702
  // Extract items and metadata
1666
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1667
- const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
1703
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1704
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1705
+ const items = Array.isArray(response.data) ? response.data : (resolveNestedField(response.data, itemsField) || []);
1668
1706
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1669
1707
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1670
1708
  const continuationToken = response.data[continuationTokenField];
@@ -195,6 +195,7 @@ interface RequestWithPaginationOptions extends RequestSpec {
195
195
  tokenParam?: string;
196
196
  countParam?: string;
197
197
  convertToSkip?: boolean;
198
+ zeroBased?: boolean;
198
199
  };
199
200
  };
200
201
  }
@@ -956,6 +956,32 @@ function filterUndefined(obj) {
956
956
  */
957
957
  const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
958
958
  isBrowser && window.self != window.top && window.location.href.includes('source=ActionCenter');
959
+ const _params = isBrowser ? new URLSearchParams(window.location.search) : null;
960
+ /**
961
+ * True when the coded app has been loaded inside a host frame that explicitly
962
+ * opted into token delegation by adding `?host=embed` to the iframe src URL.
963
+ */
964
+ const isHostEmbedded = isBrowser && window.self !== window.top && _params?.get('host') === 'embed';
965
+ /**
966
+ * The validated parent origin, read from the `?basedomain=` query param set
967
+ * by the embedding host in the iframe src URL.
968
+ * Mirrors the same mechanism used by ActionCenterTokenManager.
969
+ * Non-null only when `?host=embed` is present and `?basedomain=` is a valid URL.
970
+ */
971
+ (() => {
972
+ if (!isHostEmbedded)
973
+ return null;
974
+ const basedomain = _params?.get('basedomain');
975
+ if (!basedomain)
976
+ return null;
977
+ try {
978
+ return new URL(basedomain).origin;
979
+ }
980
+ catch {
981
+ console.warn('embeddingOrigin: basedomain query param is not a valid URL', basedomain);
982
+ return null;
983
+ }
984
+ })();
959
985
 
960
986
  /**
961
987
  * Base64 encoding/decoding
@@ -1271,12 +1297,18 @@ class PaginationHelpers {
1271
1297
  * @returns Promise resolving to a paginated result
1272
1298
  */
1273
1299
  static async getAllPaginated(params) {
1274
- const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1300
+ const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1275
1301
  const endpoint = getEndpoint(folderId);
1276
1302
  const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1303
+ // On POST, the caller's options go in the body; queryParams stays in the URL.
1304
+ // On GET, everything is URL — queryParams merges with additionalParams.
1305
+ const isPost = method === HTTP_METHODS.POST;
1306
+ const requestSpec = isPost
1307
+ ? { body: additionalParams, params: queryParams }
1308
+ : { params: { ...additionalParams, ...queryParams } };
1277
1309
  const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
1278
1310
  headers,
1279
- params: additionalParams,
1311
+ ...requestSpec,
1280
1312
  pagination: {
1281
1313
  paginationType: options.paginationType || PaginationType.OFFSET,
1282
1314
  itemsField: options.itemsField || DEFAULT_ITEMS_FIELD,
@@ -1301,7 +1333,7 @@ class PaginationHelpers {
1301
1333
  * @returns Promise resolving to an object with data and totalCount
1302
1334
  */
1303
1335
  static async getAllNonPaginated(params) {
1304
- const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1336
+ const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1305
1337
  // Set default field names
1306
1338
  const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
1307
1339
  const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
@@ -1311,17 +1343,18 @@ class PaginationHelpers {
1311
1343
  // Make the API call based on method
1312
1344
  let response;
1313
1345
  if (method === HTTP_METHODS.POST) {
1314
- response = await serviceAccess.post(endpoint, additionalParams, { headers });
1346
+ response = await serviceAccess.post(endpoint, additionalParams, { headers, params: queryParams });
1315
1347
  }
1316
1348
  else {
1317
1349
  response = await serviceAccess.get(endpoint, {
1318
- params: additionalParams,
1350
+ params: { ...additionalParams, ...queryParams },
1319
1351
  headers
1320
1352
  });
1321
1353
  }
1322
1354
  // Extract and transform items from response
1323
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1324
- const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
1355
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1356
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1357
+ const rawItems = Array.isArray(response.data) ? response.data : resolveNestedField(response.data, itemsField);
1325
1358
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1326
1359
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1327
1360
  // Parse items - automatically handle JSON string responses
@@ -1367,8 +1400,9 @@ class PaginationHelpers {
1367
1400
  getEndpoint: config.getEndpoint,
1368
1401
  folderId,
1369
1402
  headers: config.headers,
1370
- paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1403
+ paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
1371
1404
  additionalParams: prefixedOptions,
1405
+ queryParams: config.queryParams,
1372
1406
  transformFn: config.transformFn,
1373
1407
  method: config.method,
1374
1408
  options: {
@@ -1386,6 +1420,7 @@ class PaginationHelpers {
1386
1420
  folderId,
1387
1421
  headers: config.headers,
1388
1422
  additionalParams: prefixedOptions,
1423
+ queryParams: config.queryParams,
1389
1424
  transformFn: config.transformFn,
1390
1425
  method: config.method,
1391
1426
  options: {
@@ -1577,18 +1612,17 @@ class BaseService {
1577
1612
  const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
1578
1613
  // Prepare request parameters based on pagination type
1579
1614
  const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
1580
- // For POST requests, merge pagination params into body and set params to undefined; for GET, use query params
1615
+ // Route pagination state to wherever the API expects it (body for POST, URL for GET).
1616
+ // Caller-supplied options.body / options.params are respected as-is — the api-client
1617
+ // already handles params (URL) and body (request body) independently for every method.
1581
1618
  if (method.toUpperCase() === 'POST') {
1582
1619
  const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
1583
1620
  options.body = {
1584
1621
  ...existingBody,
1585
- ...options.params,
1586
1622
  ...requestParams
1587
1623
  };
1588
- options.params = undefined;
1589
1624
  }
1590
1625
  else {
1591
- // Merge pagination parameters with existing parameters
1592
1626
  options.params = {
1593
1627
  ...options.params,
1594
1628
  ...requestParams
@@ -1625,6 +1659,8 @@ class BaseService {
1625
1659
  // When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
1626
1660
  // When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
1627
1661
  const convertToSkip = paginationParams?.convertToSkip ?? true;
1662
+ // When true, sends pageNumber - 1 (for 0-based APIs). Default false (1-based).
1663
+ const zeroBased = paginationParams?.zeroBased ?? false;
1628
1664
  requestParams[pageSizeParam] = limitedPageSize;
1629
1665
  if (convertToSkip) {
1630
1666
  if (params.pageNumber && params.pageNumber > 1) {
@@ -1632,7 +1668,8 @@ class BaseService {
1632
1668
  }
1633
1669
  }
1634
1670
  else {
1635
- requestParams[offsetParam] = params.pageNumber || 1;
1671
+ const sdkPageNumber = params.pageNumber || 1;
1672
+ requestParams[offsetParam] = zeroBased ? sdkPageNumber - 1 : sdkPageNumber;
1636
1673
  }
1637
1674
  {
1638
1675
  requestParams[countParam] = true;
@@ -1661,8 +1698,9 @@ class BaseService {
1661
1698
  const totalCountField = fields.totalCountField || 'totalRecordCount';
1662
1699
  const continuationTokenField = fields.continuationTokenField || 'continuationToken';
1663
1700
  // Extract items and metadata
1664
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1665
- const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
1701
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1702
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1703
+ const items = Array.isArray(response.data) ? response.data : (resolveNestedField(response.data, itemsField) || []);
1666
1704
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1667
1705
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1668
1706
  const continuationToken = response.data[continuationTokenField];