@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
@@ -777,6 +777,32 @@ function filterUndefined(obj) {
777
777
  */
778
778
  const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
779
779
  isBrowser && window.self != window.top && window.location.href.includes('source=ActionCenter');
780
+ const _params = isBrowser ? new URLSearchParams(window.location.search) : null;
781
+ /**
782
+ * True when the coded app has been loaded inside a host frame that explicitly
783
+ * opted into token delegation by adding `?host=embed` to the iframe src URL.
784
+ */
785
+ const isHostEmbedded = isBrowser && window.self !== window.top && _params?.get('host') === 'embed';
786
+ /**
787
+ * The validated parent origin, read from the `?basedomain=` query param set
788
+ * by the embedding host in the iframe src URL.
789
+ * Mirrors the same mechanism used by ActionCenterTokenManager.
790
+ * Non-null only when `?host=embed` is present and `?basedomain=` is a valid URL.
791
+ */
792
+ (() => {
793
+ if (!isHostEmbedded)
794
+ return null;
795
+ const basedomain = _params?.get('basedomain');
796
+ if (!basedomain)
797
+ return null;
798
+ try {
799
+ return new URL(basedomain).origin;
800
+ }
801
+ catch {
802
+ console.warn('embeddingOrigin: basedomain query param is not a valid URL', basedomain);
803
+ return null;
804
+ }
805
+ })();
780
806
 
781
807
  /**
782
808
  * Base64 encoding/decoding
@@ -1361,8 +1387,9 @@ class PaginationHelpers {
1361
1387
  });
1362
1388
  }
1363
1389
  // Extract and transform items from response
1364
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1365
- const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
1390
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1391
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1392
+ const rawItems = Array.isArray(response.data) ? response.data : resolveNestedField(response.data, itemsField);
1366
1393
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1367
1394
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1368
1395
  // Parse items - automatically handle JSON string responses
@@ -1408,7 +1435,7 @@ class PaginationHelpers {
1408
1435
  getEndpoint: config.getEndpoint,
1409
1436
  folderId,
1410
1437
  headers: config.headers,
1411
- paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1438
+ paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
1412
1439
  additionalParams: prefixedOptions,
1413
1440
  transformFn: config.transformFn,
1414
1441
  method: config.method,
@@ -1666,6 +1693,8 @@ class BaseService {
1666
1693
  // When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
1667
1694
  // When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
1668
1695
  const convertToSkip = paginationParams?.convertToSkip ?? true;
1696
+ // When true, sends pageNumber - 1 (for 0-based APIs). Default false (1-based).
1697
+ const zeroBased = paginationParams?.zeroBased ?? false;
1669
1698
  requestParams[pageSizeParam] = limitedPageSize;
1670
1699
  if (convertToSkip) {
1671
1700
  if (params.pageNumber && params.pageNumber > 1) {
@@ -1673,7 +1702,8 @@ class BaseService {
1673
1702
  }
1674
1703
  }
1675
1704
  else {
1676
- requestParams[offsetParam] = params.pageNumber || 1;
1705
+ const sdkPageNumber = params.pageNumber || 1;
1706
+ requestParams[offsetParam] = zeroBased ? sdkPageNumber - 1 : sdkPageNumber;
1677
1707
  }
1678
1708
  {
1679
1709
  requestParams[countParam] = true;
@@ -1702,8 +1732,9 @@ class BaseService {
1702
1732
  const totalCountField = fields.totalCountField || 'totalRecordCount';
1703
1733
  const continuationTokenField = fields.continuationTokenField || 'continuationToken';
1704
1734
  // Extract items and metadata
1705
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1706
- const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
1735
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1736
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1737
+ const items = Array.isArray(response.data) ? response.data : (resolveNestedField(response.data, itemsField) || []);
1707
1738
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1708
1739
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1709
1740
  const continuationToken = response.data[continuationTokenField];
@@ -4945,37 +4976,58 @@ class ExchangeService extends BaseService {
4945
4976
  super(instance, buildConversationalAgentHeaders(options));
4946
4977
  }
4947
4978
  /**
4948
- * Gets all exchanges for a conversation with optional filtering and pagination
4979
+ * Gets exchanges for a conversation with pagination and optional sort parameters
4949
4980
  *
4950
- * The method returns either:
4951
- * - A NonPaginatedResponse with items array (when no pagination parameters are provided)
4952
- * - A PaginatedResponse with navigation cursors (when any pagination parameter is provided)
4981
+ * Returns a paginated response. When called without `pageSize`/`cursor`, the
4982
+ * backend applies its default page size inspect `hasNextPage`/`nextCursor`
4983
+ * to navigate further pages.
4953
4984
  *
4954
4985
  * @param conversationId - The conversation ID to get exchanges for
4955
4986
  * @param options - Options for querying exchanges including optional pagination parameters
4956
- * @returns Promise resolving to either an array of exchanges {@link NonPaginatedResponse}<{@link ExchangeGetResponse}> or a {@link PaginatedResponse}<{@link ExchangeGetResponse}> when pagination options are used
4987
+ * @returns Promise resolving to a {@link PaginatedResponse}<{@link ExchangeGetResponse}>
4957
4988
  *
4958
- * @example
4989
+ * @example Basic usage - default page size and sort order
4959
4990
  * ```typescript
4960
- * // Get all exchanges (non-paginated)
4961
- * const conversationExchanges = await exchanges.getAll(conversationId);
4962
- *
4963
- * // First page with pagination
4964
- * const firstPageOfExchanges = await exchanges.getAll(conversationId, { pageSize: 10 });
4991
+ * // First page
4992
+ * const firstPage = await exchanges.getAll(conversationId);
4965
4993
  *
4966
4994
  * // Navigate using cursor
4967
- * if (firstPageOfExchanges.hasNextPage) {
4968
- * const nextPageOfExchanges = await exchanges.getAll(conversationId, { cursor: firstPageOfExchanges.nextCursor });
4995
+ * if (firstPage.hasNextPage) {
4996
+ * const nextPage = await exchanges.getAll(conversationId, { cursor: firstPage.nextCursor });
4997
+ * }
4998
+ * ```
4999
+ *
5000
+ * @example With explicit page size and exchange/message sort orders
5001
+ * ```typescript
5002
+ * import { SortOrder } from '@uipath/uipath-typescript/conversational-agent';
5003
+ *
5004
+ * const firstPage = await exchanges.getAll(conversationId, {
5005
+ * pageSize: 10,
5006
+ * exchangeSort: SortOrder.Descending,
5007
+ * messageSort: SortOrder.Ascending
5008
+ * });
5009
+ *
5010
+ * // Navigate using cursor and same parameters
5011
+ * if (firstPage.hasNextPage) {
5012
+ * const nextPage = await exchanges.getAll(conversationId, {
5013
+ * pageSize: 10,
5014
+ * exchangeSort: SortOrder.Descending,
5015
+ * messageSort: SortOrder.Ascending,
5016
+ * cursor: firstPage.nextCursor
5017
+ * });
4969
5018
  * }
4970
5019
  * ```
4971
5020
  */
4972
5021
  async getAll(conversationId, options) {
4973
- const transformFn = transformExchange;
4974
- return PaginationHelpers.getAll({
5022
+ const { pageSize, cursor, jumpToPage, ...additionalParams } = options ?? {};
5023
+ const paginationParams = cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize };
5024
+ return PaginationHelpers.getAllPaginated({
4975
5025
  serviceAccess: this.createPaginationServiceAccess(),
4976
5026
  getEndpoint: () => EXCHANGE_ENDPOINTS.LIST(conversationId),
4977
- transformFn,
4978
- pagination: {
5027
+ paginationParams,
5028
+ additionalParams,
5029
+ transformFn: transformExchange,
5030
+ options: {
4979
5031
  paginationType: PaginationType.TOKEN,
4980
5032
  itemsField: CONVERSATIONAL_PAGINATION.ITEMS_FIELD,
4981
5033
  continuationTokenField: CONVERSATIONAL_PAGINATION.CONTINUATION_TOKEN_FIELD,
@@ -4983,9 +5035,8 @@ class ExchangeService extends BaseService {
4983
5035
  pageSizeParam: CONVERSATIONAL_TOKEN_PARAMS.PAGE_SIZE_PARAM,
4984
5036
  tokenParam: CONVERSATIONAL_TOKEN_PARAMS.TOKEN_PARAM
4985
5037
  }
4986
- },
4987
- excludeFromPrefix: Object.keys(options || {}) // Conversational params are not OData
4988
- }, options);
5038
+ }
5039
+ });
4989
5040
  }
4990
5041
  /**
4991
5042
  * Gets an exchange by ID with its messages
@@ -5967,28 +6018,23 @@ class ConversationService extends BaseService {
5967
6018
  return createConversationWithMethods(transformedData, this, this, this._exchangeService);
5968
6019
  }
5969
6020
  /**
5970
- * Gets all conversations with optional filtering and pagination
6021
+ * Gets conversations with pagination and optional sort/filter parameters
5971
6022
  *
5972
- * The method returns either:
5973
- * - A NonPaginatedResponse with items array (when no pagination parameters are provided)
5974
- * - A PaginatedResponse with navigation cursors (when any pagination parameter is provided)
6023
+ * Returns a paginated response. When called without `pageSize`/`cursor`, a
6024
+ * default page size is applied - inspect `hasNextPage`/`nextCursor`
6025
+ * to navigate further pages.
5975
6026
  *
5976
- * @param options - Options for querying conversations including optional pagination parameters
5977
- * @returns Promise resolving to either an array of conversations {@link NonPaginatedResponse}<{@link ConversationGetResponse}> or a {@link PaginatedResponse}<{@link ConversationGetResponse}> when pagination options are used
6027
+ * @param options - Options for querying conversations
6028
+ * @returns Promise resolving to a {@link PaginatedResponse}<{@link ConversationGetResponse}>
5978
6029
  *
5979
- * @example Basic usage - get all conversations
6030
+ * @example Basic usage - default sort, pagination, and without filtering
5980
6031
  * ```typescript
5981
- * const allConversations = await conversationalAgent.conversations.getAll();
6032
+ * // First page
6033
+ * const firstPage = await conversationalAgent.conversations.getAll();
5982
6034
  *
5983
- * for (const conversation of allConversations.items) {
6035
+ * for (const conversation of firstPage.items) {
5984
6036
  * console.log(`${conversation.label} - created: ${conversation.createdTime}`);
5985
6037
  * }
5986
- * ```
5987
- *
5988
- * @example With pagination
5989
- * ```typescript
5990
- * // First page
5991
- * const firstPage = await conversationalAgent.conversations.getAll({ pageSize: 10 });
5992
6038
  *
5993
6039
  * // Navigate using cursor
5994
6040
  * if (firstPage.hasNextPage) {
@@ -5998,37 +6044,59 @@ class ConversationService extends BaseService {
5998
6044
  * }
5999
6045
  * ```
6000
6046
  *
6001
- * @example Sorted with limit
6047
+ * @example With explicit page size and sort order (by last-activity timestamp)
6002
6048
  * ```typescript
6003
- * const result = await conversationalAgent.conversations.getAll({
6004
- * sort: SortOrder.Descending,
6005
- * pageSize: 20
6049
+ * import { SortOrder } from '@uipath/uipath-typescript/conversational-agent';
6050
+ *
6051
+ * // First page
6052
+ * const firstPage = await conversationalAgent.conversations.getAll({
6053
+ * pageSize: 10,
6054
+ * sort: SortOrder.Descending
6006
6055
  * });
6056
+ *
6057
+ * // Navigate using cursor and same parameters
6058
+ * if (firstPage.hasNextPage) {
6059
+ * const nextPage = await conversationalAgent.conversations.getAll({
6060
+ * pageSize: 10,
6061
+ * sort: SortOrder.Descending,
6062
+ * cursor: firstPage.nextCursor
6063
+ * });
6064
+ * }
6007
6065
  * ```
6008
6066
  *
6009
- * @example Filter by agent and search by label
6067
+ * @example With agent-filter and label-search
6010
6068
  * ```typescript
6011
- * const filtered = await conversationalAgent.conversations.getAll({
6069
+ * const firstPage = await conversationalAgent.conversations.getAll({
6012
6070
  * agentId: <agentId>,
6013
6071
  * label: 'budget'
6014
6072
  * });
6073
+ *
6074
+ * // Navigate using cursor and same parameters
6075
+ * if (firstPage.hasNextPage) {
6076
+ * const nextPage = await conversationalAgent.conversations.getAll({
6077
+ * agentId: <agentId>,
6078
+ * label: 'budget',
6079
+ * cursor: firstPage.nextCursor
6080
+ * });
6081
+ * }
6015
6082
  * ```
6016
6083
  */
6017
6084
  async getAll(options) {
6018
- // Transform function to convert API timestamps to SDK naming convention and add methods
6019
6085
  const transformFn = (conversation) => {
6020
6086
  const transformedData = transformData(conversation, ConversationMap);
6021
6087
  return createConversationWithMethods(transformedData, this, this, this._exchangeService);
6022
6088
  };
6089
+ const { pageSize, cursor, jumpToPage, ...filterOptions } = options ?? {};
6023
6090
  // Translate SDK filter names (agentKey/agentId/label) to backend names before forwarding
6024
- const apiOptions = options
6025
- ? transformRequest(options, ConversationGetAllFilterMap)
6026
- : undefined;
6027
- return PaginationHelpers.getAll({
6091
+ const additionalParams = transformRequest(filterOptions, ConversationGetAllFilterMap);
6092
+ const paginationParams = cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize };
6093
+ return PaginationHelpers.getAllPaginated({
6028
6094
  serviceAccess: this.createPaginationServiceAccess(),
6029
6095
  getEndpoint: () => CONVERSATION_ENDPOINTS.LIST,
6096
+ paginationParams,
6097
+ additionalParams,
6030
6098
  transformFn,
6031
- pagination: {
6099
+ options: {
6032
6100
  paginationType: PaginationType.TOKEN,
6033
6101
  itemsField: CONVERSATIONAL_PAGINATION.ITEMS_FIELD,
6034
6102
  continuationTokenField: CONVERSATIONAL_PAGINATION.CONTINUATION_TOKEN_FIELD,
@@ -6036,9 +6104,8 @@ class ConversationService extends BaseService {
6036
6104
  pageSizeParam: CONVERSATIONAL_TOKEN_PARAMS.PAGE_SIZE_PARAM,
6037
6105
  tokenParam: CONVERSATIONAL_TOKEN_PARAMS.TOKEN_PARAM
6038
6106
  }
6039
- },
6040
- excludeFromPrefix: Object.keys(apiOptions || {}) // Conversational params are not OData
6041
- }, apiOptions);
6107
+ }
6108
+ });
6042
6109
  }
6043
6110
  /**
6044
6111
  * Updates a conversation by ID
@@ -6072,7 +6139,7 @@ class ConversationService extends BaseService {
6072
6139
  */
6073
6140
  async deleteById(id) {
6074
6141
  const response = await this.delete(CONVERSATION_ENDPOINTS.DELETE(id));
6075
- return response.data;
6142
+ return transformData(response.data, ConversationMap);
6076
6143
  }
6077
6144
  // ==================== Attachments ====================
6078
6145
  /**