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