@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
@@ -59,6 +59,7 @@ var ProcessType;
59
59
  */
60
60
  const ORCHESTRATOR_BASE = 'orchestrator_';
61
61
  const PIMS_BASE = 'pims_';
62
+ const LLMOPS_BASE = 'llmopstenant_';
62
63
  const INSIGHTS_RTM_BASE = 'insightsrtm_';
63
64
 
64
65
  /**
@@ -98,7 +99,7 @@ const MAESTRO_ENDPOINTS = {
98
99
  INSTANCES: {
99
100
  GET_ALL: `${PIMS_BASE}/api/v1/instances`,
100
101
  GET_BY_ID: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}`,
101
- GET_EXECUTION_HISTORY: (instanceId) => `${PIMS_BASE}/api/v1/spans/${instanceId}`,
102
+ GET_ELEMENT_EXECUTIONS: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/element-executions`,
102
103
  GET_BPMN: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/bpmn`,
103
104
  GET_VARIABLES: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/variables`,
104
105
  CANCEL: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/cancel`,
@@ -110,6 +111,9 @@ const MAESTRO_ENDPOINTS = {
110
111
  GET_BY_PROCESS: (processKey) => `${PIMS_BASE}/api/v1/incidents/process/${processKey}`,
111
112
  GET_BY_INSTANCE: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/incidents`,
112
113
  },
114
+ TRACES: {
115
+ GET_SPANS: (traceId) => `${LLMOPS_BASE}/api/Traces/spans?traceId=${traceId}`,
116
+ },
113
117
  CASES: {
114
118
  GET_CASE_JSON: (instanceId) => `${PIMS_BASE}/api/v1/cases/${instanceId}/case-json`,
115
119
  GET_ELEMENT_EXECUTIONS: (instanceId) => `${PIMS_BASE}/api/v1/element-executions/case-instances/${instanceId}`,
@@ -130,9 +134,45 @@ const MAESTRO_ENDPOINTS = {
130
134
  INSTANCE_STATUS_BY_DATE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/InstanceStatusByDate`,
131
135
  /** Top processes ranked by total duration */
132
136
  TOP_PROCESSES_BY_DURATION: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByDuration`,
137
+ /** Element count by status for agentic instances (process and case) */
138
+ ELEMENT_COUNT_BY_STATUS: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/ElementCountByStatus`,
133
139
  },
134
140
  };
135
141
 
142
+ /**
143
+ * Maestro Cases Models
144
+ * Model classes for Maestro cases
145
+ */
146
+ /**
147
+ * Creates methods for a case object
148
+ *
149
+ * @param caseData - The case data (response from API)
150
+ * @param service - The cases service instance
151
+ * @returns Object containing case methods
152
+ */
153
+ function createCaseMethods(caseData, service) {
154
+ return {
155
+ getElementStats(startTime, endTime, packageVersion) {
156
+ if (!caseData.processKey)
157
+ throw new Error('Process key is undefined');
158
+ if (!caseData.packageId)
159
+ throw new Error('Package ID is undefined');
160
+ return service.getElementStats(caseData.processKey, caseData.packageId, startTime, endTime, packageVersion);
161
+ }
162
+ };
163
+ }
164
+ /**
165
+ * Creates an actionable case by combining API case data with operational methods.
166
+ *
167
+ * @param caseData - The case data from API
168
+ * @param service - The cases service instance
169
+ * @returns A case object with added methods
170
+ */
171
+ function createCaseWithMethods(caseData, service) {
172
+ const methods = createCaseMethods(caseData, service);
173
+ return Object.assign({}, caseData, methods);
174
+ }
175
+
136
176
  /**
137
177
  * Builds the request body for Insights RTM "top" endpoints.
138
178
  *
@@ -179,6 +219,28 @@ async function fetchInstanceStatusTimeline(postFn, startTime, endTime, isCaseMan
179
219
  });
180
220
  return response.data ?? [];
181
221
  }
222
+ /**
223
+ * Builds the request body for the ElementCountByStatus endpoint.
224
+ *
225
+ * @param processKey - Process key to filter by
226
+ * @param packageId - Package identifier
227
+ * @param startTime - Start of the time range to query
228
+ * @param endTime - End of the time range to query
229
+ * @param packageVersion - Package version to filter by
230
+ * @returns Request body for the ElementCountByStatus endpoint
231
+ * @internal
232
+ */
233
+ function buildElementCountByStatusBody(processKey, packageId, startTime, endTime, packageVersion) {
234
+ return {
235
+ commonParams: {
236
+ processKey,
237
+ packageId,
238
+ startTime: startTime.getTime(),
239
+ endTime: endTime.getTime(),
240
+ version: packageVersion
241
+ }
242
+ };
243
+ }
182
244
 
183
245
  /**
184
246
  * Type guards for error response types
@@ -875,6 +937,32 @@ function processODataArrayResponse(oDataResponse, successData) {
875
937
  */
876
938
  const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
877
939
  isBrowser && window.self != window.top && window.location.href.includes('source=ActionCenter');
940
+ const _params = isBrowser ? new URLSearchParams(window.location.search) : null;
941
+ /**
942
+ * True when the coded app has been loaded inside a host frame that explicitly
943
+ * opted into token delegation by adding `?host=embed` to the iframe src URL.
944
+ */
945
+ const isHostEmbedded = isBrowser && window.self !== window.top && _params?.get('host') === 'embed';
946
+ /**
947
+ * The validated parent origin, read from the `?basedomain=` query param set
948
+ * by the embedding host in the iframe src URL.
949
+ * Mirrors the same mechanism used by ActionCenterTokenManager.
950
+ * Non-null only when `?host=embed` is present and `?basedomain=` is a valid URL.
951
+ */
952
+ (() => {
953
+ if (!isHostEmbedded)
954
+ return null;
955
+ const basedomain = _params?.get('basedomain');
956
+ if (!basedomain)
957
+ return null;
958
+ try {
959
+ return new URL(basedomain).origin;
960
+ }
961
+ catch {
962
+ console.warn('embeddingOrigin: basedomain query param is not a valid URL', basedomain);
963
+ return null;
964
+ }
965
+ })();
878
966
 
879
967
  /**
880
968
  * Base64 encoding/decoding
@@ -1533,12 +1621,18 @@ class PaginationHelpers {
1533
1621
  * @returns Promise resolving to a paginated result
1534
1622
  */
1535
1623
  static async getAllPaginated(params) {
1536
- const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1624
+ const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1537
1625
  const endpoint = getEndpoint(folderId);
1538
1626
  const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1627
+ // On POST, the caller's options go in the body; queryParams stays in the URL.
1628
+ // On GET, everything is URL — queryParams merges with additionalParams.
1629
+ const isPost = method === HTTP_METHODS.POST;
1630
+ const requestSpec = isPost
1631
+ ? { body: additionalParams, params: queryParams }
1632
+ : { params: { ...additionalParams, ...queryParams } };
1539
1633
  const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
1540
1634
  headers,
1541
- params: additionalParams,
1635
+ ...requestSpec,
1542
1636
  pagination: {
1543
1637
  paginationType: options.paginationType || PaginationType.OFFSET,
1544
1638
  itemsField: options.itemsField || DEFAULT_ITEMS_FIELD,
@@ -1563,7 +1657,7 @@ class PaginationHelpers {
1563
1657
  * @returns Promise resolving to an object with data and totalCount
1564
1658
  */
1565
1659
  static async getAllNonPaginated(params) {
1566
- const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1660
+ const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1567
1661
  // Set default field names
1568
1662
  const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
1569
1663
  const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
@@ -1573,17 +1667,18 @@ class PaginationHelpers {
1573
1667
  // Make the API call based on method
1574
1668
  let response;
1575
1669
  if (method === HTTP_METHODS.POST) {
1576
- response = await serviceAccess.post(endpoint, additionalParams, { headers });
1670
+ response = await serviceAccess.post(endpoint, additionalParams, { headers, params: queryParams });
1577
1671
  }
1578
1672
  else {
1579
1673
  response = await serviceAccess.get(endpoint, {
1580
- params: additionalParams,
1674
+ params: { ...additionalParams, ...queryParams },
1581
1675
  headers
1582
1676
  });
1583
1677
  }
1584
1678
  // Extract and transform items from response
1585
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1586
- const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
1679
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1680
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1681
+ const rawItems = Array.isArray(response.data) ? response.data : resolveNestedField(response.data, itemsField);
1587
1682
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1588
1683
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1589
1684
  // Parse items - automatically handle JSON string responses
@@ -1629,8 +1724,9 @@ class PaginationHelpers {
1629
1724
  getEndpoint: config.getEndpoint,
1630
1725
  folderId,
1631
1726
  headers: config.headers,
1632
- paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1727
+ paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
1633
1728
  additionalParams: prefixedOptions,
1729
+ queryParams: config.queryParams,
1634
1730
  transformFn: config.transformFn,
1635
1731
  method: config.method,
1636
1732
  options: {
@@ -1648,6 +1744,7 @@ class PaginationHelpers {
1648
1744
  folderId,
1649
1745
  headers: config.headers,
1650
1746
  additionalParams: prefixedOptions,
1747
+ queryParams: config.queryParams,
1651
1748
  transformFn: config.transformFn,
1652
1749
  method: config.method,
1653
1750
  options: {
@@ -1839,18 +1936,17 @@ class BaseService {
1839
1936
  const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
1840
1937
  // Prepare request parameters based on pagination type
1841
1938
  const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
1842
- // For POST requests, merge pagination params into body and set params to undefined; for GET, use query params
1939
+ // Route pagination state to wherever the API expects it (body for POST, URL for GET).
1940
+ // Caller-supplied options.body / options.params are respected as-is — the api-client
1941
+ // already handles params (URL) and body (request body) independently for every method.
1843
1942
  if (method.toUpperCase() === 'POST') {
1844
1943
  const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
1845
1944
  options.body = {
1846
1945
  ...existingBody,
1847
- ...options.params,
1848
1946
  ...requestParams
1849
1947
  };
1850
- options.params = undefined;
1851
1948
  }
1852
1949
  else {
1853
- // Merge pagination parameters with existing parameters
1854
1950
  options.params = {
1855
1951
  ...options.params,
1856
1952
  ...requestParams
@@ -1887,6 +1983,8 @@ class BaseService {
1887
1983
  // When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
1888
1984
  // When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
1889
1985
  const convertToSkip = paginationParams?.convertToSkip ?? true;
1986
+ // When true, sends pageNumber - 1 (for 0-based APIs). Default false (1-based).
1987
+ const zeroBased = paginationParams?.zeroBased ?? false;
1890
1988
  requestParams[pageSizeParam] = limitedPageSize;
1891
1989
  if (convertToSkip) {
1892
1990
  if (params.pageNumber && params.pageNumber > 1) {
@@ -1894,7 +1992,8 @@ class BaseService {
1894
1992
  }
1895
1993
  }
1896
1994
  else {
1897
- requestParams[offsetParam] = params.pageNumber || 1;
1995
+ const sdkPageNumber = params.pageNumber || 1;
1996
+ requestParams[offsetParam] = zeroBased ? sdkPageNumber - 1 : sdkPageNumber;
1898
1997
  }
1899
1998
  {
1900
1999
  requestParams[countParam] = true;
@@ -1923,8 +2022,9 @@ class BaseService {
1923
2022
  const totalCountField = fields.totalCountField || 'totalRecordCount';
1924
2023
  const continuationTokenField = fields.continuationTokenField || 'continuationToken';
1925
2024
  // Extract items and metadata
1926
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1927
- const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
2025
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
2026
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
2027
+ const items = Array.isArray(response.data) ? response.data : (resolveNestedField(response.data, itemsField) || []);
1928
2028
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1929
2029
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1930
2030
  const continuationToken = response.data[continuationTokenField];
@@ -2041,7 +2141,7 @@ function createParams(paramsObj = {}) {
2041
2141
  class CasesService extends BaseService {
2042
2142
  /**
2043
2143
  * Get all case management processes with their instance statistics
2044
- * @returns Promise resolving to array of Case objects
2144
+ * @returns Promise resolving to an array of {@link CaseGetAllWithMethodsResponse}
2045
2145
  *
2046
2146
  * @example
2047
2147
  * ```typescript
@@ -2065,10 +2165,10 @@ class CasesService extends BaseService {
2065
2165
  const response = await this.get(MAESTRO_ENDPOINTS.PROCESSES.GET_ALL, { params });
2066
2166
  // Extract processes array from response data and add name field
2067
2167
  const cases = response.data?.processes || [];
2068
- return cases.map(caseItem => ({
2168
+ return cases.map(caseItem => createCaseWithMethods({
2069
2169
  ...caseItem,
2070
2170
  name: this.extractCaseName(caseItem.packageId)
2071
- }));
2171
+ }, this));
2072
2172
  }
2073
2173
  /**
2074
2174
  * Get the top 5 case processes ranked by run count within a time range.
@@ -2287,6 +2387,40 @@ class CasesService extends BaseService {
2287
2387
  const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_DURATION, buildInsightsTopBody(startTime, endTime, true, options));
2288
2388
  return (data ?? []).map(process => ({ ...process, name: this.extractCaseName(process.packageId) }));
2289
2389
  }
2390
+ /**
2391
+ * Get element stats for case instances
2392
+ *
2393
+ * Returns per-element execution counts (success, fail, terminated, paused, in-progress) and
2394
+ * duration percentile metrics (min, max, avg, p50, p95, p99) for BPMN elements within a case.
2395
+ *
2396
+ * @param processKey - Process key to filter by
2397
+ * @param packageId - Package identifier
2398
+ * @param startTime - Start of the time range to query
2399
+ * @param endTime - End of the time range to query
2400
+ * @param packageVersion - Package version to filter by
2401
+ * @returns Promise resolving to an array of {@link ElementStats}
2402
+ * @example
2403
+ * ```typescript
2404
+ * // Get element metrics for a case
2405
+ * const elements = await cases.getElementStats(
2406
+ * '<processKey>',
2407
+ * '<packageId>',
2408
+ * new Date('2026-04-01'),
2409
+ * new Date(),
2410
+ * '1.0.1'
2411
+ * );
2412
+ *
2413
+ * // Find elements with failures
2414
+ * const failedElements = elements.filter(e => e.failCount > 0);
2415
+ * for (const element of failedElements) {
2416
+ * console.log(`Failed element: ${element.elementId}, failures: ${element.failCount}`);
2417
+ * }
2418
+ * ```
2419
+ */
2420
+ async getElementStats(processKey, packageId, startTime, endTime, packageVersion) {
2421
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.ELEMENT_COUNT_BY_STATUS, buildElementCountByStatusBody(processKey, packageId, startTime, endTime, packageVersion));
2422
+ return data ?? [];
2423
+ }
2290
2424
  /**
2291
2425
  * Extract a readable case name from the packageId
2292
2426
  * @param packageId - The full package identifier
@@ -2324,6 +2458,9 @@ __decorate([
2324
2458
  __decorate([
2325
2459
  track('Cases.GetTopExecutionDuration')
2326
2460
  ], CasesService.prototype, "getTopExecutionDuration", null);
2461
+ __decorate([
2462
+ track('Cases.GetElementStats')
2463
+ ], CasesService.prototype, "getElementStats", null);
2327
2464
 
2328
2465
  /**
2329
2466
  * Process Incident Status
@@ -2696,6 +2833,24 @@ var TaskActivityType;
2696
2833
  TaskActivityType["BulkCompleted"] = "BulkCompleted";
2697
2834
  TaskActivityType["FirstOpened"] = "FirstOpened";
2698
2835
  })(TaskActivityType || (TaskActivityType = {}));
2836
+ /**
2837
+ * Defines how a task assignment is distributed.
2838
+ *
2839
+ * Defaults to {@link TaskAssignmentCriteria.SingleUser} (a direct single-user
2840
+ * assignment) when not specified. The group-based criteria tell Action Center
2841
+ * how to distribute the task across the members of a directory group.
2842
+ */
2843
+ var TaskAssignmentCriteria;
2844
+ (function (TaskAssignmentCriteria) {
2845
+ /** Assigned to a single user, like a direct assignment. */
2846
+ TaskAssignmentCriteria["SingleUser"] = "SingleUser";
2847
+ /** Assigned to the group member with the fewest pending tasks. */
2848
+ TaskAssignmentCriteria["Workload"] = "Workload";
2849
+ /** Assigned to all users in the group. */
2850
+ TaskAssignmentCriteria["AllUsers"] = "AllUsers";
2851
+ /** Assigned in a round-robin manner across the group's members. */
2852
+ TaskAssignmentCriteria["RoundRobin"] = "RoundRobin";
2853
+ })(TaskAssignmentCriteria || (TaskAssignmentCriteria = {}));
2699
2854
 
2700
2855
  /**
2701
2856
  * Maps numeric TaskStatus values (from API) to TaskStatus enum values.
@@ -2745,17 +2900,19 @@ function createTaskMethods(taskData, service) {
2745
2900
  async assign(options) {
2746
2901
  if (!taskData.id)
2747
2902
  throw new Error('Task ID is undefined');
2903
+ const criteria = options.assignmentCriteria !== undefined ? { assignmentCriteria: options.assignmentCriteria } : {};
2748
2904
  const assignmentOptions = 'userId' in options && options.userId !== undefined
2749
- ? { taskId: taskData.id, userId: options.userId }
2750
- : { taskId: taskData.id, userNameOrEmail: options.userNameOrEmail };
2905
+ ? { taskId: taskData.id, userId: options.userId, ...criteria }
2906
+ : { taskId: taskData.id, userNameOrEmail: options.userNameOrEmail, ...criteria };
2751
2907
  return service.assign(assignmentOptions);
2752
2908
  },
2753
2909
  async reassign(options) {
2754
2910
  if (!taskData.id)
2755
2911
  throw new Error('Task ID is undefined');
2912
+ const criteria = options.assignmentCriteria !== undefined ? { assignmentCriteria: options.assignmentCriteria } : {};
2756
2913
  const assignmentOptions = 'userId' in options && options.userId !== undefined
2757
- ? { taskId: taskData.id, userId: options.userId }
2758
- : { taskId: taskData.id, userNameOrEmail: options.userNameOrEmail };
2914
+ ? { taskId: taskData.id, userId: options.userId, ...criteria }
2915
+ : { taskId: taskData.id, userNameOrEmail: options.userNameOrEmail, ...criteria };
2759
2916
  return service.reassign(assignmentOptions);
2760
2917
  },
2761
2918
  async unassign() {
@@ -3068,6 +3225,26 @@ class TaskService extends BaseService {
3068
3225
  * }
3069
3226
  * ]);
3070
3227
  * ```
3228
+ *
3229
+ * @example Group assignment
3230
+ * ```typescript
3231
+ * import { TaskAssignmentCriteria } from '@uipath/uipath-typescript/tasks';
3232
+ *
3233
+ * // Assign to a directory group by userId + criteria — Action Center
3234
+ * // distributes the task across the group's members based on the criteria
3235
+ * const result = await tasks.assign({
3236
+ * taskId: 123,
3237
+ * userId: 456, // a DirectoryGroup id from tasks.getUsers()
3238
+ * assignmentCriteria: TaskAssignmentCriteria.AllUsers
3239
+ * });
3240
+ *
3241
+ * // ...or identify the group by name instead of id
3242
+ * const result2 = await tasks.assign({
3243
+ * taskId: 123,
3244
+ * userNameOrEmail: "My Group",
3245
+ * assignmentCriteria: TaskAssignmentCriteria.AllUsers
3246
+ * });
3247
+ * ```
3071
3248
  */
3072
3249
  async assign(taskAssignments) {
3073
3250
  // Normalize input to array
@@ -3119,6 +3296,25 @@ class TaskService extends BaseService {
3119
3296
  * }
3120
3297
  * ]);
3121
3298
  * ```
3299
+ *
3300
+ * @example Group reassignment
3301
+ * ```typescript
3302
+ * import { TaskAssignmentCriteria } from '@uipath/uipath-typescript/tasks';
3303
+ *
3304
+ * // Reassign to a directory group by userId + criteria
3305
+ * const result = await tasks.reassign({
3306
+ * taskId: 123,
3307
+ * userId: 456, // a DirectoryGroup id from tasks.getUsers()
3308
+ * assignmentCriteria: TaskAssignmentCriteria.AllUsers
3309
+ * });
3310
+ *
3311
+ * // ...or identify the group by name instead of id
3312
+ * const result2 = await tasks.reassign({
3313
+ * taskId: 123,
3314
+ * userNameOrEmail: "My Group",
3315
+ * assignmentCriteria: TaskAssignmentCriteria.AllUsers
3316
+ * });
3317
+ * ```
3122
3318
  */
3123
3319
  async reassign(taskAssignments) {
3124
3320
  // Normalize input to array
@@ -3845,4 +4041,4 @@ __decorate([
3845
4041
  track('CaseInstances.GetStagesSlaSummary')
3846
4042
  ], CaseInstancesService.prototype, "getStagesSlaSummary", null);
3847
4043
 
3848
- export { CaseInstancesService as CaseInstances, CaseInstancesService, CasesService as Cases, CasesService, EscalationActionType, EscalationRecipientScope, EscalationTriggerType, InstanceFinalStatus, InstanceStatus, SLADurationUnit, SlaSummaryStatus, StageTaskType, TimeInterval, createCaseInstanceWithMethods };
4044
+ export { CaseInstancesService as CaseInstances, CaseInstancesService, CasesService as Cases, CasesService, EscalationActionType, EscalationRecipientScope, EscalationTriggerType, InstanceFinalStatus, InstanceStatus, SLADurationUnit, SlaSummaryStatus, StageTaskType, TimeInterval, createCaseInstanceWithMethods, createCaseWithMethods };