@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
@@ -61,6 +61,7 @@ var ProcessType;
61
61
  */
62
62
  const ORCHESTRATOR_BASE = 'orchestrator_';
63
63
  const PIMS_BASE = 'pims_';
64
+ const LLMOPS_BASE = 'llmopstenant_';
64
65
  const INSIGHTS_RTM_BASE = 'insightsrtm_';
65
66
 
66
67
  /**
@@ -100,7 +101,7 @@ const MAESTRO_ENDPOINTS = {
100
101
  INSTANCES: {
101
102
  GET_ALL: `${PIMS_BASE}/api/v1/instances`,
102
103
  GET_BY_ID: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}`,
103
- GET_EXECUTION_HISTORY: (instanceId) => `${PIMS_BASE}/api/v1/spans/${instanceId}`,
104
+ GET_ELEMENT_EXECUTIONS: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/element-executions`,
104
105
  GET_BPMN: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/bpmn`,
105
106
  GET_VARIABLES: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/variables`,
106
107
  CANCEL: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/cancel`,
@@ -112,6 +113,9 @@ const MAESTRO_ENDPOINTS = {
112
113
  GET_BY_PROCESS: (processKey) => `${PIMS_BASE}/api/v1/incidents/process/${processKey}`,
113
114
  GET_BY_INSTANCE: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/incidents`,
114
115
  },
116
+ TRACES: {
117
+ GET_SPANS: (traceId) => `${LLMOPS_BASE}/api/Traces/spans?traceId=${traceId}`,
118
+ },
115
119
  CASES: {
116
120
  GET_CASE_JSON: (instanceId) => `${PIMS_BASE}/api/v1/cases/${instanceId}/case-json`,
117
121
  GET_ELEMENT_EXECUTIONS: (instanceId) => `${PIMS_BASE}/api/v1/element-executions/case-instances/${instanceId}`,
@@ -132,9 +136,45 @@ const MAESTRO_ENDPOINTS = {
132
136
  INSTANCE_STATUS_BY_DATE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/InstanceStatusByDate`,
133
137
  /** Top processes ranked by total duration */
134
138
  TOP_PROCESSES_BY_DURATION: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByDuration`,
139
+ /** Element count by status for agentic instances (process and case) */
140
+ ELEMENT_COUNT_BY_STATUS: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/ElementCountByStatus`,
135
141
  },
136
142
  };
137
143
 
144
+ /**
145
+ * Maestro Cases Models
146
+ * Model classes for Maestro cases
147
+ */
148
+ /**
149
+ * Creates methods for a case object
150
+ *
151
+ * @param caseData - The case data (response from API)
152
+ * @param service - The cases service instance
153
+ * @returns Object containing case methods
154
+ */
155
+ function createCaseMethods(caseData, service) {
156
+ return {
157
+ getElementStats(startTime, endTime, packageVersion) {
158
+ if (!caseData.processKey)
159
+ throw new Error('Process key is undefined');
160
+ if (!caseData.packageId)
161
+ throw new Error('Package ID is undefined');
162
+ return service.getElementStats(caseData.processKey, caseData.packageId, startTime, endTime, packageVersion);
163
+ }
164
+ };
165
+ }
166
+ /**
167
+ * Creates an actionable case by combining API case data with operational methods.
168
+ *
169
+ * @param caseData - The case data from API
170
+ * @param service - The cases service instance
171
+ * @returns A case object with added methods
172
+ */
173
+ function createCaseWithMethods(caseData, service) {
174
+ const methods = createCaseMethods(caseData, service);
175
+ return Object.assign({}, caseData, methods);
176
+ }
177
+
138
178
  /**
139
179
  * Builds the request body for Insights RTM "top" endpoints.
140
180
  *
@@ -181,6 +221,28 @@ async function fetchInstanceStatusTimeline(postFn, startTime, endTime, isCaseMan
181
221
  });
182
222
  return response.data ?? [];
183
223
  }
224
+ /**
225
+ * Builds the request body for the ElementCountByStatus endpoint.
226
+ *
227
+ * @param processKey - Process key to filter by
228
+ * @param packageId - Package identifier
229
+ * @param startTime - Start of the time range to query
230
+ * @param endTime - End of the time range to query
231
+ * @param packageVersion - Package version to filter by
232
+ * @returns Request body for the ElementCountByStatus endpoint
233
+ * @internal
234
+ */
235
+ function buildElementCountByStatusBody(processKey, packageId, startTime, endTime, packageVersion) {
236
+ return {
237
+ commonParams: {
238
+ processKey,
239
+ packageId,
240
+ startTime: startTime.getTime(),
241
+ endTime: endTime.getTime(),
242
+ version: packageVersion
243
+ }
244
+ };
245
+ }
184
246
 
185
247
  /**
186
248
  * Type guards for error response types
@@ -877,6 +939,32 @@ function processODataArrayResponse(oDataResponse, successData) {
877
939
  */
878
940
  const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
879
941
  isBrowser && window.self != window.top && window.location.href.includes('source=ActionCenter');
942
+ const _params = isBrowser ? new URLSearchParams(window.location.search) : null;
943
+ /**
944
+ * True when the coded app has been loaded inside a host frame that explicitly
945
+ * opted into token delegation by adding `?host=embed` to the iframe src URL.
946
+ */
947
+ const isHostEmbedded = isBrowser && window.self !== window.top && _params?.get('host') === 'embed';
948
+ /**
949
+ * The validated parent origin, read from the `?basedomain=` query param set
950
+ * by the embedding host in the iframe src URL.
951
+ * Mirrors the same mechanism used by ActionCenterTokenManager.
952
+ * Non-null only when `?host=embed` is present and `?basedomain=` is a valid URL.
953
+ */
954
+ (() => {
955
+ if (!isHostEmbedded)
956
+ return null;
957
+ const basedomain = _params?.get('basedomain');
958
+ if (!basedomain)
959
+ return null;
960
+ try {
961
+ return new URL(basedomain).origin;
962
+ }
963
+ catch {
964
+ console.warn('embeddingOrigin: basedomain query param is not a valid URL', basedomain);
965
+ return null;
966
+ }
967
+ })();
880
968
 
881
969
  /**
882
970
  * Base64 encoding/decoding
@@ -1535,12 +1623,18 @@ class PaginationHelpers {
1535
1623
  * @returns Promise resolving to a paginated result
1536
1624
  */
1537
1625
  static async getAllPaginated(params) {
1538
- const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1626
+ const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1539
1627
  const endpoint = getEndpoint(folderId);
1540
1628
  const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1629
+ // On POST, the caller's options go in the body; queryParams stays in the URL.
1630
+ // On GET, everything is URL — queryParams merges with additionalParams.
1631
+ const isPost = method === HTTP_METHODS.POST;
1632
+ const requestSpec = isPost
1633
+ ? { body: additionalParams, params: queryParams }
1634
+ : { params: { ...additionalParams, ...queryParams } };
1541
1635
  const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
1542
1636
  headers,
1543
- params: additionalParams,
1637
+ ...requestSpec,
1544
1638
  pagination: {
1545
1639
  paginationType: options.paginationType || PaginationType.OFFSET,
1546
1640
  itemsField: options.itemsField || DEFAULT_ITEMS_FIELD,
@@ -1565,7 +1659,7 @@ class PaginationHelpers {
1565
1659
  * @returns Promise resolving to an object with data and totalCount
1566
1660
  */
1567
1661
  static async getAllNonPaginated(params) {
1568
- const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1662
+ const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1569
1663
  // Set default field names
1570
1664
  const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
1571
1665
  const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
@@ -1575,17 +1669,18 @@ class PaginationHelpers {
1575
1669
  // Make the API call based on method
1576
1670
  let response;
1577
1671
  if (method === HTTP_METHODS.POST) {
1578
- response = await serviceAccess.post(endpoint, additionalParams, { headers });
1672
+ response = await serviceAccess.post(endpoint, additionalParams, { headers, params: queryParams });
1579
1673
  }
1580
1674
  else {
1581
1675
  response = await serviceAccess.get(endpoint, {
1582
- params: additionalParams,
1676
+ params: { ...additionalParams, ...queryParams },
1583
1677
  headers
1584
1678
  });
1585
1679
  }
1586
1680
  // Extract and transform items from response
1587
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1588
- const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
1681
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1682
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1683
+ const rawItems = Array.isArray(response.data) ? response.data : resolveNestedField(response.data, itemsField);
1589
1684
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1590
1685
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1591
1686
  // Parse items - automatically handle JSON string responses
@@ -1631,8 +1726,9 @@ class PaginationHelpers {
1631
1726
  getEndpoint: config.getEndpoint,
1632
1727
  folderId,
1633
1728
  headers: config.headers,
1634
- paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1729
+ paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
1635
1730
  additionalParams: prefixedOptions,
1731
+ queryParams: config.queryParams,
1636
1732
  transformFn: config.transformFn,
1637
1733
  method: config.method,
1638
1734
  options: {
@@ -1650,6 +1746,7 @@ class PaginationHelpers {
1650
1746
  folderId,
1651
1747
  headers: config.headers,
1652
1748
  additionalParams: prefixedOptions,
1749
+ queryParams: config.queryParams,
1653
1750
  transformFn: config.transformFn,
1654
1751
  method: config.method,
1655
1752
  options: {
@@ -1841,18 +1938,17 @@ class BaseService {
1841
1938
  const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
1842
1939
  // Prepare request parameters based on pagination type
1843
1940
  const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
1844
- // For POST requests, merge pagination params into body and set params to undefined; for GET, use query params
1941
+ // Route pagination state to wherever the API expects it (body for POST, URL for GET).
1942
+ // Caller-supplied options.body / options.params are respected as-is — the api-client
1943
+ // already handles params (URL) and body (request body) independently for every method.
1845
1944
  if (method.toUpperCase() === 'POST') {
1846
1945
  const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
1847
1946
  options.body = {
1848
1947
  ...existingBody,
1849
- ...options.params,
1850
1948
  ...requestParams
1851
1949
  };
1852
- options.params = undefined;
1853
1950
  }
1854
1951
  else {
1855
- // Merge pagination parameters with existing parameters
1856
1952
  options.params = {
1857
1953
  ...options.params,
1858
1954
  ...requestParams
@@ -1889,6 +1985,8 @@ class BaseService {
1889
1985
  // When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
1890
1986
  // When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
1891
1987
  const convertToSkip = paginationParams?.convertToSkip ?? true;
1988
+ // When true, sends pageNumber - 1 (for 0-based APIs). Default false (1-based).
1989
+ const zeroBased = paginationParams?.zeroBased ?? false;
1892
1990
  requestParams[pageSizeParam] = limitedPageSize;
1893
1991
  if (convertToSkip) {
1894
1992
  if (params.pageNumber && params.pageNumber > 1) {
@@ -1896,7 +1994,8 @@ class BaseService {
1896
1994
  }
1897
1995
  }
1898
1996
  else {
1899
- requestParams[offsetParam] = params.pageNumber || 1;
1997
+ const sdkPageNumber = params.pageNumber || 1;
1998
+ requestParams[offsetParam] = zeroBased ? sdkPageNumber - 1 : sdkPageNumber;
1900
1999
  }
1901
2000
  {
1902
2001
  requestParams[countParam] = true;
@@ -1925,8 +2024,9 @@ class BaseService {
1925
2024
  const totalCountField = fields.totalCountField || 'totalRecordCount';
1926
2025
  const continuationTokenField = fields.continuationTokenField || 'continuationToken';
1927
2026
  // Extract items and metadata
1928
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1929
- const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
2027
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
2028
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
2029
+ const items = Array.isArray(response.data) ? response.data : (resolveNestedField(response.data, itemsField) || []);
1930
2030
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1931
2031
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1932
2032
  const continuationToken = response.data[continuationTokenField];
@@ -2043,7 +2143,7 @@ function createParams(paramsObj = {}) {
2043
2143
  class CasesService extends BaseService {
2044
2144
  /**
2045
2145
  * Get all case management processes with their instance statistics
2046
- * @returns Promise resolving to array of Case objects
2146
+ * @returns Promise resolving to an array of {@link CaseGetAllWithMethodsResponse}
2047
2147
  *
2048
2148
  * @example
2049
2149
  * ```typescript
@@ -2067,10 +2167,10 @@ class CasesService extends BaseService {
2067
2167
  const response = await this.get(MAESTRO_ENDPOINTS.PROCESSES.GET_ALL, { params });
2068
2168
  // Extract processes array from response data and add name field
2069
2169
  const cases = response.data?.processes || [];
2070
- return cases.map(caseItem => ({
2170
+ return cases.map(caseItem => createCaseWithMethods({
2071
2171
  ...caseItem,
2072
2172
  name: this.extractCaseName(caseItem.packageId)
2073
- }));
2173
+ }, this));
2074
2174
  }
2075
2175
  /**
2076
2176
  * Get the top 5 case processes ranked by run count within a time range.
@@ -2289,6 +2389,40 @@ class CasesService extends BaseService {
2289
2389
  const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_DURATION, buildInsightsTopBody(startTime, endTime, true, options));
2290
2390
  return (data ?? []).map(process => ({ ...process, name: this.extractCaseName(process.packageId) }));
2291
2391
  }
2392
+ /**
2393
+ * Get element stats for case instances
2394
+ *
2395
+ * Returns per-element execution counts (success, fail, terminated, paused, in-progress) and
2396
+ * duration percentile metrics (min, max, avg, p50, p95, p99) for BPMN elements within a case.
2397
+ *
2398
+ * @param processKey - Process key to filter by
2399
+ * @param packageId - Package identifier
2400
+ * @param startTime - Start of the time range to query
2401
+ * @param endTime - End of the time range to query
2402
+ * @param packageVersion - Package version to filter by
2403
+ * @returns Promise resolving to an array of {@link ElementStats}
2404
+ * @example
2405
+ * ```typescript
2406
+ * // Get element metrics for a case
2407
+ * const elements = await cases.getElementStats(
2408
+ * '<processKey>',
2409
+ * '<packageId>',
2410
+ * new Date('2026-04-01'),
2411
+ * new Date(),
2412
+ * '1.0.1'
2413
+ * );
2414
+ *
2415
+ * // Find elements with failures
2416
+ * const failedElements = elements.filter(e => e.failCount > 0);
2417
+ * for (const element of failedElements) {
2418
+ * console.log(`Failed element: ${element.elementId}, failures: ${element.failCount}`);
2419
+ * }
2420
+ * ```
2421
+ */
2422
+ async getElementStats(processKey, packageId, startTime, endTime, packageVersion) {
2423
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.ELEMENT_COUNT_BY_STATUS, buildElementCountByStatusBody(processKey, packageId, startTime, endTime, packageVersion));
2424
+ return data ?? [];
2425
+ }
2292
2426
  /**
2293
2427
  * Extract a readable case name from the packageId
2294
2428
  * @param packageId - The full package identifier
@@ -2326,6 +2460,9 @@ __decorate([
2326
2460
  __decorate([
2327
2461
  track('Cases.GetTopExecutionDuration')
2328
2462
  ], CasesService.prototype, "getTopExecutionDuration", null);
2463
+ __decorate([
2464
+ track('Cases.GetElementStats')
2465
+ ], CasesService.prototype, "getElementStats", null);
2329
2466
 
2330
2467
  /**
2331
2468
  * Process Incident Status
@@ -2698,6 +2835,24 @@ var TaskActivityType;
2698
2835
  TaskActivityType["BulkCompleted"] = "BulkCompleted";
2699
2836
  TaskActivityType["FirstOpened"] = "FirstOpened";
2700
2837
  })(TaskActivityType || (TaskActivityType = {}));
2838
+ /**
2839
+ * Defines how a task assignment is distributed.
2840
+ *
2841
+ * Defaults to {@link TaskAssignmentCriteria.SingleUser} (a direct single-user
2842
+ * assignment) when not specified. The group-based criteria tell Action Center
2843
+ * how to distribute the task across the members of a directory group.
2844
+ */
2845
+ var TaskAssignmentCriteria;
2846
+ (function (TaskAssignmentCriteria) {
2847
+ /** Assigned to a single user, like a direct assignment. */
2848
+ TaskAssignmentCriteria["SingleUser"] = "SingleUser";
2849
+ /** Assigned to the group member with the fewest pending tasks. */
2850
+ TaskAssignmentCriteria["Workload"] = "Workload";
2851
+ /** Assigned to all users in the group. */
2852
+ TaskAssignmentCriteria["AllUsers"] = "AllUsers";
2853
+ /** Assigned in a round-robin manner across the group's members. */
2854
+ TaskAssignmentCriteria["RoundRobin"] = "RoundRobin";
2855
+ })(TaskAssignmentCriteria || (TaskAssignmentCriteria = {}));
2701
2856
 
2702
2857
  /**
2703
2858
  * Maps numeric TaskStatus values (from API) to TaskStatus enum values.
@@ -2747,17 +2902,19 @@ function createTaskMethods(taskData, service) {
2747
2902
  async assign(options) {
2748
2903
  if (!taskData.id)
2749
2904
  throw new Error('Task ID is undefined');
2905
+ const criteria = options.assignmentCriteria !== undefined ? { assignmentCriteria: options.assignmentCriteria } : {};
2750
2906
  const assignmentOptions = 'userId' in options && options.userId !== undefined
2751
- ? { taskId: taskData.id, userId: options.userId }
2752
- : { taskId: taskData.id, userNameOrEmail: options.userNameOrEmail };
2907
+ ? { taskId: taskData.id, userId: options.userId, ...criteria }
2908
+ : { taskId: taskData.id, userNameOrEmail: options.userNameOrEmail, ...criteria };
2753
2909
  return service.assign(assignmentOptions);
2754
2910
  },
2755
2911
  async reassign(options) {
2756
2912
  if (!taskData.id)
2757
2913
  throw new Error('Task ID is undefined');
2914
+ const criteria = options.assignmentCriteria !== undefined ? { assignmentCriteria: options.assignmentCriteria } : {};
2758
2915
  const assignmentOptions = 'userId' in options && options.userId !== undefined
2759
- ? { taskId: taskData.id, userId: options.userId }
2760
- : { taskId: taskData.id, userNameOrEmail: options.userNameOrEmail };
2916
+ ? { taskId: taskData.id, userId: options.userId, ...criteria }
2917
+ : { taskId: taskData.id, userNameOrEmail: options.userNameOrEmail, ...criteria };
2761
2918
  return service.reassign(assignmentOptions);
2762
2919
  },
2763
2920
  async unassign() {
@@ -3070,6 +3227,26 @@ class TaskService extends BaseService {
3070
3227
  * }
3071
3228
  * ]);
3072
3229
  * ```
3230
+ *
3231
+ * @example Group assignment
3232
+ * ```typescript
3233
+ * import { TaskAssignmentCriteria } from '@uipath/uipath-typescript/tasks';
3234
+ *
3235
+ * // Assign to a directory group by userId + criteria — Action Center
3236
+ * // distributes the task across the group's members based on the criteria
3237
+ * const result = await tasks.assign({
3238
+ * taskId: 123,
3239
+ * userId: 456, // a DirectoryGroup id from tasks.getUsers()
3240
+ * assignmentCriteria: TaskAssignmentCriteria.AllUsers
3241
+ * });
3242
+ *
3243
+ * // ...or identify the group by name instead of id
3244
+ * const result2 = await tasks.assign({
3245
+ * taskId: 123,
3246
+ * userNameOrEmail: "My Group",
3247
+ * assignmentCriteria: TaskAssignmentCriteria.AllUsers
3248
+ * });
3249
+ * ```
3073
3250
  */
3074
3251
  async assign(taskAssignments) {
3075
3252
  // Normalize input to array
@@ -3121,6 +3298,25 @@ class TaskService extends BaseService {
3121
3298
  * }
3122
3299
  * ]);
3123
3300
  * ```
3301
+ *
3302
+ * @example Group reassignment
3303
+ * ```typescript
3304
+ * import { TaskAssignmentCriteria } from '@uipath/uipath-typescript/tasks';
3305
+ *
3306
+ * // Reassign to a directory group by userId + criteria
3307
+ * const result = await tasks.reassign({
3308
+ * taskId: 123,
3309
+ * userId: 456, // a DirectoryGroup id from tasks.getUsers()
3310
+ * assignmentCriteria: TaskAssignmentCriteria.AllUsers
3311
+ * });
3312
+ *
3313
+ * // ...or identify the group by name instead of id
3314
+ * const result2 = await tasks.reassign({
3315
+ * taskId: 123,
3316
+ * userNameOrEmail: "My Group",
3317
+ * assignmentCriteria: TaskAssignmentCriteria.AllUsers
3318
+ * });
3319
+ * ```
3124
3320
  */
3125
3321
  async reassign(taskAssignments) {
3126
3322
  // Normalize input to array
@@ -3852,3 +4048,4 @@ exports.CaseInstancesService = CaseInstancesService;
3852
4048
  exports.Cases = CasesService;
3853
4049
  exports.CasesService = CasesService;
3854
4050
  exports.createCaseInstanceWithMethods = createCaseInstanceWithMethods;
4051
+ exports.createCaseWithMethods = createCaseWithMethods;
@@ -109,6 +109,35 @@ interface GetTopDurationResponse extends GetTopBaseResponse {
109
109
  /** Total execution duration in milliseconds */
110
110
  duration: number;
111
111
  }
112
+ /**
113
+ * Element count by status for a BPMN element within a process or case
114
+ */
115
+ interface ElementStats {
116
+ /** BPMN element identifier */
117
+ elementId: string;
118
+ /** Number of successful executions */
119
+ successCount: number;
120
+ /** Number of failed executions */
121
+ failCount: number;
122
+ /** Number of terminated executions */
123
+ terminatedCount: number;
124
+ /** Number of paused executions */
125
+ pausedCount: number;
126
+ /** Number of in-progress executions */
127
+ inProgressCount: number;
128
+ /** Minimum duration in milliseconds */
129
+ minDurationMs: number;
130
+ /** Maximum duration in milliseconds */
131
+ maxDurationMs: number;
132
+ /** Average duration in milliseconds */
133
+ avgDurationMs: number;
134
+ /** 50th percentile (median) duration in milliseconds */
135
+ p50DurationMs: number;
136
+ /** 95th percentile duration in milliseconds */
137
+ p95DurationMs: number;
138
+ /** 99th percentile duration in milliseconds */
139
+ p99DurationMs: number;
140
+ }
112
141
 
113
142
  /**
114
143
  * Simplified universal pagination cursor
@@ -293,8 +322,7 @@ interface CaseGetTopDurationResponse extends GetTopDurationResponse {
293
322
  */
294
323
  interface CasesServiceModel {
295
324
  /**
296
- * @returns Promise resolving to array of Case objects
297
- * {@link CaseGetAllResponse}
325
+ * @returns Promise resolving to an array of {@link CaseGetAllWithMethodsResponse}
298
326
  * @example
299
327
  * ```typescript
300
328
  * // Get all case management processes
@@ -308,7 +336,7 @@ interface CasesServiceModel {
308
336
  * }
309
337
  * ```
310
338
  */
311
- getAll(): Promise<CaseGetAllResponse[]>;
339
+ getAll(): Promise<CaseGetAllWithMethodsResponse[]>;
312
340
  /**
313
341
  * Get the top 5 case processes ranked by run count within a time range.
314
342
  *
@@ -502,7 +530,58 @@ interface CasesServiceModel {
502
530
  * ```
503
531
  */
504
532
  getTopExecutionDuration(startTime: Date, endTime: Date, options?: TopQueryOptions): Promise<CaseGetTopDurationResponse[]>;
533
+ /**
534
+ * Get element stats for case instances
535
+ *
536
+ * Returns per-element execution counts (success, fail, terminated, paused, in-progress) and
537
+ * duration percentile metrics (min, max, avg, p50, p95, p99) for BPMN elements within a case.
538
+ *
539
+ * @param processKey - Process key to filter by
540
+ * @param packageId - Package identifier
541
+ * @param startTime - Start of the time range to query
542
+ * @param endTime - End of the time range to query
543
+ * @param packageVersion - Package version to filter by
544
+ * @returns Promise resolving to an array of {@link ElementStats}
545
+ * @example
546
+ * ```typescript
547
+ * // Get element metrics for a case
548
+ * const elements = await cases.getElementStats(
549
+ * '<processKey>',
550
+ * '<packageId>',
551
+ * new Date('2026-04-01'),
552
+ * new Date(),
553
+ * '1.0.1'
554
+ * );
555
+ *
556
+ * // Find elements with failures
557
+ * const failedElements = elements.filter(e => e.failCount > 0);
558
+ * for (const element of failedElements) {
559
+ * console.log(`Failed element: ${element.elementId}, failures: ${element.failCount}`);
560
+ * }
561
+ * ```
562
+ */
563
+ getElementStats(processKey: string, packageId: string, startTime: Date, endTime: Date, packageVersion: string): Promise<ElementStats[]>;
564
+ }
565
+ interface CaseMethods {
566
+ /**
567
+ * Get element stats for this case
568
+ *
569
+ * @param startTime - Start of the time range to query
570
+ * @param endTime - End of the time range to query
571
+ * @param packageVersion - Package version to filter by
572
+ * @returns Promise resolving to an array of {@link ElementStats}
573
+ */
574
+ getElementStats(startTime: Date, endTime: Date, packageVersion: string): Promise<ElementStats[]>;
505
575
  }
576
+ type CaseGetAllWithMethodsResponse = CaseGetAllResponse & CaseMethods;
577
+ /**
578
+ * Creates an actionable case by combining API case data with operational methods.
579
+ *
580
+ * @param caseData - The case data from API
581
+ * @param service - The cases service instance
582
+ * @returns A case object with added methods
583
+ */
584
+ declare function createCaseWithMethods(caseData: CaseGetAllResponse, service: CasesServiceModel): CaseGetAllWithMethodsResponse;
506
585
 
507
586
  /**
508
587
  * Case Instance Types
@@ -1011,22 +1090,49 @@ interface RawTaskGetResponse extends TaskBaseResponse {
1011
1090
  actionLabel?: string | null;
1012
1091
  taskSlaDetails?: TaskSlaDetail[] | null;
1013
1092
  completedByUser?: UserLoginInfo | null;
1014
- taskAssignmentCriteria?: string;
1093
+ taskAssignmentCriteria?: TaskAssignmentCriteria;
1015
1094
  taskAssignees?: UserLoginInfo[] | null;
1016
1095
  taskSource?: TaskSource | null;
1017
1096
  processingTime?: number | null;
1018
1097
  data?: Record<string, unknown> | null;
1019
1098
  }
1099
+ /**
1100
+ * Defines how a task assignment is distributed.
1101
+ *
1102
+ * Defaults to {@link TaskAssignmentCriteria.SingleUser} (a direct single-user
1103
+ * assignment) when not specified. The group-based criteria tell Action Center
1104
+ * how to distribute the task across the members of a directory group.
1105
+ */
1106
+ declare enum TaskAssignmentCriteria {
1107
+ /** Assigned to a single user, like a direct assignment. */
1108
+ SingleUser = "SingleUser",
1109
+ /** Assigned to the group member with the fewest pending tasks. */
1110
+ Workload = "Workload",
1111
+ /** Assigned to all users in the group. */
1112
+ AllUsers = "AllUsers",
1113
+ /** Assigned in a round-robin manner across the group's members. */
1114
+ RoundRobin = "RoundRobin"
1115
+ }
1020
1116
  /**
1021
1117
  * Options for task assignment operations when called from a task instance
1022
- * Requires either userId or userNameOrEmail, but not both
1118
+ * Requires either userId or userNameOrEmail, but not both. Optionally accepts
1119
+ * an assignment criteria; defaults to a single-user assignment, set a group
1120
+ * criteria (e.g. {@link TaskAssignmentCriteria.AllUsers}) for a directory group.
1023
1121
  */
1024
- type TaskAssignOptions = {
1122
+ type TaskAssignOptions = ({
1025
1123
  userId: number;
1026
1124
  userNameOrEmail?: never;
1027
1125
  } | {
1028
1126
  userId?: never;
1029
1127
  userNameOrEmail: string;
1128
+ }) & {
1129
+ /**
1130
+ * How the assignment is distributed. Optional — defaults to
1131
+ * {@link TaskAssignmentCriteria.SingleUser} (a direct single-user assignment).
1132
+ * Set a group criteria (e.g. {@link TaskAssignmentCriteria.AllUsers}) to
1133
+ * distribute the task across a directory group's members.
1134
+ */
1135
+ assignmentCriteria?: TaskAssignmentCriteria;
1030
1136
  };
1031
1137
  /**
1032
1138
  * Options for task assignment operations when called from the service
@@ -1557,6 +1663,7 @@ interface RequestWithPaginationOptions extends RequestSpec {
1557
1663
  tokenParam?: string;
1558
1664
  countParam?: string;
1559
1665
  convertToSkip?: boolean;
1666
+ zeroBased?: boolean;
1560
1667
  };
1561
1668
  };
1562
1669
  }
@@ -1755,7 +1862,7 @@ declare class BaseService {
1755
1862
  declare class CasesService extends BaseService implements CasesServiceModel {
1756
1863
  /**
1757
1864
  * Get all case management processes with their instance statistics
1758
- * @returns Promise resolving to array of Case objects
1865
+ * @returns Promise resolving to an array of {@link CaseGetAllWithMethodsResponse}
1759
1866
  *
1760
1867
  * @example
1761
1868
  * ```typescript
@@ -1772,7 +1879,7 @@ declare class CasesService extends BaseService implements CasesServiceModel {
1772
1879
  * }
1773
1880
  * ```
1774
1881
  */
1775
- getAll(): Promise<CaseGetAllResponse[]>;
1882
+ getAll(): Promise<CaseGetAllWithMethodsResponse[]>;
1776
1883
  /**
1777
1884
  * Get the top 5 case processes ranked by run count within a time range.
1778
1885
  *
@@ -1966,6 +2073,37 @@ declare class CasesService extends BaseService implements CasesServiceModel {
1966
2073
  * ```
1967
2074
  */
1968
2075
  getTopExecutionDuration(startTime: Date, endTime: Date, options?: TopQueryOptions): Promise<CaseGetTopDurationResponse[]>;
2076
+ /**
2077
+ * Get element stats for case instances
2078
+ *
2079
+ * Returns per-element execution counts (success, fail, terminated, paused, in-progress) and
2080
+ * duration percentile metrics (min, max, avg, p50, p95, p99) for BPMN elements within a case.
2081
+ *
2082
+ * @param processKey - Process key to filter by
2083
+ * @param packageId - Package identifier
2084
+ * @param startTime - Start of the time range to query
2085
+ * @param endTime - End of the time range to query
2086
+ * @param packageVersion - Package version to filter by
2087
+ * @returns Promise resolving to an array of {@link ElementStats}
2088
+ * @example
2089
+ * ```typescript
2090
+ * // Get element metrics for a case
2091
+ * const elements = await cases.getElementStats(
2092
+ * '<processKey>',
2093
+ * '<packageId>',
2094
+ * new Date('2026-04-01'),
2095
+ * new Date(),
2096
+ * '1.0.1'
2097
+ * );
2098
+ *
2099
+ * // Find elements with failures
2100
+ * const failedElements = elements.filter(e => e.failCount > 0);
2101
+ * for (const element of failedElements) {
2102
+ * console.log(`Failed element: ${element.elementId}, failures: ${element.failCount}`);
2103
+ * }
2104
+ * ```
2105
+ */
2106
+ getElementStats(processKey: string, packageId: string, startTime: Date, endTime: Date, packageVersion: string): Promise<ElementStats[]>;
1969
2107
  /**
1970
2108
  * Extract a readable case name from the packageId
1971
2109
  * @param packageId - The full package identifier
@@ -2223,5 +2361,5 @@ declare class CaseInstancesService extends BaseService implements CaseInstancesS
2223
2361
  getStagesSlaSummary(options?: CaseInstanceStageSLAOptions): Promise<CaseInstanceStageSLAResponse[]>;
2224
2362
  }
2225
2363
 
2226
- export { CaseInstancesService as CaseInstances, CaseInstancesService, CasesService as Cases, CasesService, EscalationActionType, EscalationRecipientScope, EscalationTriggerType, InstanceFinalStatus, InstanceStatus, SLADurationUnit, SlaSummaryStatus, StageTaskType, TimeInterval, createCaseInstanceWithMethods };
2227
- export type { CaseAppConfig, CaseAppOverview, CaseGetAllResponse, CaseGetStageResponse, CaseGetTopDurationResponse, CaseGetTopFaultedCountResponse, CaseGetTopRunCountResponse, CaseInstanceExecutionHistoryResponse, CaseInstanceGetAllOptions, CaseInstanceGetAllWithPaginationOptions, CaseInstanceGetResponse, CaseInstanceMethods, CaseInstanceOperationOptions, CaseInstanceOperationResponse, CaseInstanceReopenOptions, CaseInstanceRun, CaseInstanceSlaSummaryOptions, CaseInstanceStageSLAOptions, CaseInstanceStageSLAResponse, CaseInstanceStageSLAStage, CaseInstancesServiceModel, CasesServiceModel, ElementExecutionMetadata, ElementGetTopFailedCountResponse, ElementRunMetadata, EscalationAction, EscalationRecipient, EscalationRule, EscalationTriggerMetadata, GetTopBaseResponse, GetTopDurationResponse, GetTopFaultedCountResponse, GetTopRunCountResponse, InstanceStatusTimelineResponse, RawCaseInstanceGetResponse, SlaSummaryResponse, StageSLA, StageTask, TimelineOptions, TopQueryOptions };
2364
+ export { CaseInstancesService as CaseInstances, CaseInstancesService, CasesService as Cases, CasesService, EscalationActionType, EscalationRecipientScope, EscalationTriggerType, InstanceFinalStatus, InstanceStatus, SLADurationUnit, SlaSummaryStatus, StageTaskType, TimeInterval, createCaseInstanceWithMethods, createCaseWithMethods };
2365
+ export type { CaseAppConfig, CaseAppOverview, CaseGetAllResponse, CaseGetAllWithMethodsResponse, CaseGetStageResponse, CaseGetTopDurationResponse, CaseGetTopFaultedCountResponse, CaseGetTopRunCountResponse, CaseInstanceExecutionHistoryResponse, CaseInstanceGetAllOptions, CaseInstanceGetAllWithPaginationOptions, CaseInstanceGetResponse, CaseInstanceMethods, CaseInstanceOperationOptions, CaseInstanceOperationResponse, CaseInstanceReopenOptions, CaseInstanceRun, CaseInstanceSlaSummaryOptions, CaseInstanceStageSLAOptions, CaseInstanceStageSLAResponse, CaseInstanceStageSLAStage, CaseInstancesServiceModel, CaseMethods, CasesServiceModel, ElementExecutionMetadata, ElementGetTopFailedCountResponse, ElementRunMetadata, ElementStats, EscalationAction, EscalationRecipient, EscalationRule, EscalationTriggerMetadata, GetTopBaseResponse, GetTopDurationResponse, GetTopFaultedCountResponse, GetTopRunCountResponse, InstanceStatusTimelineResponse, RawCaseInstanceGetResponse, SlaSummaryResponse, StageSLA, StageTask, TimelineOptions, TopQueryOptions };