@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
@@ -384,6 +384,24 @@ var TaskActivityType;
384
384
  TaskActivityType["BulkCompleted"] = "BulkCompleted";
385
385
  TaskActivityType["FirstOpened"] = "FirstOpened";
386
386
  })(TaskActivityType || (TaskActivityType = {}));
387
+ /**
388
+ * Defines how a task assignment is distributed.
389
+ *
390
+ * Defaults to {@link TaskAssignmentCriteria.SingleUser} (a direct single-user
391
+ * assignment) when not specified. The group-based criteria tell Action Center
392
+ * how to distribute the task across the members of a directory group.
393
+ */
394
+ var TaskAssignmentCriteria;
395
+ (function (TaskAssignmentCriteria) {
396
+ /** Assigned to a single user, like a direct assignment. */
397
+ TaskAssignmentCriteria["SingleUser"] = "SingleUser";
398
+ /** Assigned to the group member with the fewest pending tasks. */
399
+ TaskAssignmentCriteria["Workload"] = "Workload";
400
+ /** Assigned to all users in the group. */
401
+ TaskAssignmentCriteria["AllUsers"] = "AllUsers";
402
+ /** Assigned in a round-robin manner across the group's members. */
403
+ TaskAssignmentCriteria["RoundRobin"] = "RoundRobin";
404
+ })(TaskAssignmentCriteria || (TaskAssignmentCriteria = {}));
387
405
 
388
406
  /**
389
407
  * Maps numeric TaskStatus values (from API) to TaskStatus enum values.
@@ -461,17 +479,19 @@ function createTaskMethods(taskData, service) {
461
479
  async assign(options) {
462
480
  if (!taskData.id)
463
481
  throw new Error('Task ID is undefined');
482
+ const criteria = options.assignmentCriteria !== undefined ? { assignmentCriteria: options.assignmentCriteria } : {};
464
483
  const assignmentOptions = 'userId' in options && options.userId !== undefined
465
- ? { taskId: taskData.id, userId: options.userId }
466
- : { taskId: taskData.id, userNameOrEmail: options.userNameOrEmail };
484
+ ? { taskId: taskData.id, userId: options.userId, ...criteria }
485
+ : { taskId: taskData.id, userNameOrEmail: options.userNameOrEmail, ...criteria };
467
486
  return service.assign(assignmentOptions);
468
487
  },
469
488
  async reassign(options) {
470
489
  if (!taskData.id)
471
490
  throw new Error('Task ID is undefined');
491
+ const criteria = options.assignmentCriteria !== undefined ? { assignmentCriteria: options.assignmentCriteria } : {};
472
492
  const assignmentOptions = 'userId' in options && options.userId !== undefined
473
- ? { taskId: taskData.id, userId: options.userId }
474
- : { taskId: taskData.id, userNameOrEmail: options.userNameOrEmail };
493
+ ? { taskId: taskData.id, userId: options.userId, ...criteria }
494
+ : { taskId: taskData.id, userNameOrEmail: options.userNameOrEmail, ...criteria };
475
495
  return service.reassign(assignmentOptions);
476
496
  },
477
497
  async unassign() {
@@ -977,6 +997,32 @@ function getLimitedPageSize(pageSize) {
977
997
  */
978
998
  const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
979
999
  isBrowser && window.self != window.top && window.location.href.includes('source=ActionCenter');
1000
+ const _params = isBrowser ? new URLSearchParams(window.location.search) : null;
1001
+ /**
1002
+ * True when the coded app has been loaded inside a host frame that explicitly
1003
+ * opted into token delegation by adding `?host=embed` to the iframe src URL.
1004
+ */
1005
+ const isHostEmbedded = isBrowser && window.self !== window.top && _params?.get('host') === 'embed';
1006
+ /**
1007
+ * The validated parent origin, read from the `?basedomain=` query param set
1008
+ * by the embedding host in the iframe src URL.
1009
+ * Mirrors the same mechanism used by ActionCenterTokenManager.
1010
+ * Non-null only when `?host=embed` is present and `?basedomain=` is a valid URL.
1011
+ */
1012
+ (() => {
1013
+ if (!isHostEmbedded)
1014
+ return null;
1015
+ const basedomain = _params?.get('basedomain');
1016
+ if (!basedomain)
1017
+ return null;
1018
+ try {
1019
+ return new URL(basedomain).origin;
1020
+ }
1021
+ catch {
1022
+ console.warn('embeddingOrigin: basedomain query param is not a valid URL', basedomain);
1023
+ return null;
1024
+ }
1025
+ })();
980
1026
 
981
1027
  /**
982
1028
  * Base64 encoding/decoding
@@ -1157,12 +1203,18 @@ class PaginationHelpers {
1157
1203
  * @returns Promise resolving to a paginated result
1158
1204
  */
1159
1205
  static async getAllPaginated(params) {
1160
- const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1206
+ const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1161
1207
  const endpoint = getEndpoint(folderId);
1162
1208
  const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1209
+ // On POST, the caller's options go in the body; queryParams stays in the URL.
1210
+ // On GET, everything is URL — queryParams merges with additionalParams.
1211
+ const isPost = method === HTTP_METHODS.POST;
1212
+ const requestSpec = isPost
1213
+ ? { body: additionalParams, params: queryParams }
1214
+ : { params: { ...additionalParams, ...queryParams } };
1163
1215
  const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
1164
1216
  headers,
1165
- params: additionalParams,
1217
+ ...requestSpec,
1166
1218
  pagination: {
1167
1219
  paginationType: options.paginationType || PaginationType.OFFSET,
1168
1220
  itemsField: options.itemsField || DEFAULT_ITEMS_FIELD,
@@ -1187,7 +1239,7 @@ class PaginationHelpers {
1187
1239
  * @returns Promise resolving to an object with data and totalCount
1188
1240
  */
1189
1241
  static async getAllNonPaginated(params) {
1190
- const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1242
+ const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1191
1243
  // Set default field names
1192
1244
  const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
1193
1245
  const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
@@ -1197,17 +1249,18 @@ class PaginationHelpers {
1197
1249
  // Make the API call based on method
1198
1250
  let response;
1199
1251
  if (method === HTTP_METHODS.POST) {
1200
- response = await serviceAccess.post(endpoint, additionalParams, { headers });
1252
+ response = await serviceAccess.post(endpoint, additionalParams, { headers, params: queryParams });
1201
1253
  }
1202
1254
  else {
1203
1255
  response = await serviceAccess.get(endpoint, {
1204
- params: additionalParams,
1256
+ params: { ...additionalParams, ...queryParams },
1205
1257
  headers
1206
1258
  });
1207
1259
  }
1208
1260
  // Extract and transform items from response
1209
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1210
- const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
1261
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
1262
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
1263
+ const rawItems = Array.isArray(response.data) ? response.data : resolveNestedField(response.data, itemsField);
1211
1264
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1212
1265
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1213
1266
  // Parse items - automatically handle JSON string responses
@@ -1253,8 +1306,9 @@ class PaginationHelpers {
1253
1306
  getEndpoint: config.getEndpoint,
1254
1307
  folderId,
1255
1308
  headers: config.headers,
1256
- paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1309
+ paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
1257
1310
  additionalParams: prefixedOptions,
1311
+ queryParams: config.queryParams,
1258
1312
  transformFn: config.transformFn,
1259
1313
  method: config.method,
1260
1314
  options: {
@@ -1272,6 +1326,7 @@ class PaginationHelpers {
1272
1326
  folderId,
1273
1327
  headers: config.headers,
1274
1328
  additionalParams: prefixedOptions,
1329
+ queryParams: config.queryParams,
1275
1330
  transformFn: config.transformFn,
1276
1331
  method: config.method,
1277
1332
  options: {
@@ -1894,18 +1949,17 @@ class BaseService {
1894
1949
  const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
1895
1950
  // Prepare request parameters based on pagination type
1896
1951
  const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
1897
- // For POST requests, merge pagination params into body and set params to undefined; for GET, use query params
1952
+ // Route pagination state to wherever the API expects it (body for POST, URL for GET).
1953
+ // Caller-supplied options.body / options.params are respected as-is — the api-client
1954
+ // already handles params (URL) and body (request body) independently for every method.
1898
1955
  if (method.toUpperCase() === 'POST') {
1899
1956
  const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
1900
1957
  options.body = {
1901
1958
  ...existingBody,
1902
- ...options.params,
1903
1959
  ...requestParams
1904
1960
  };
1905
- options.params = undefined;
1906
1961
  }
1907
1962
  else {
1908
- // Merge pagination parameters with existing parameters
1909
1963
  options.params = {
1910
1964
  ...options.params,
1911
1965
  ...requestParams
@@ -1942,6 +1996,8 @@ class BaseService {
1942
1996
  // When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
1943
1997
  // When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
1944
1998
  const convertToSkip = paginationParams?.convertToSkip ?? true;
1999
+ // When true, sends pageNumber - 1 (for 0-based APIs). Default false (1-based).
2000
+ const zeroBased = paginationParams?.zeroBased ?? false;
1945
2001
  requestParams[pageSizeParam] = limitedPageSize;
1946
2002
  if (convertToSkip) {
1947
2003
  if (params.pageNumber && params.pageNumber > 1) {
@@ -1949,7 +2005,8 @@ class BaseService {
1949
2005
  }
1950
2006
  }
1951
2007
  else {
1952
- requestParams[offsetParam] = params.pageNumber || 1;
2008
+ const sdkPageNumber = params.pageNumber || 1;
2009
+ requestParams[offsetParam] = zeroBased ? sdkPageNumber - 1 : sdkPageNumber;
1953
2010
  }
1954
2011
  {
1955
2012
  requestParams[countParam] = true;
@@ -1978,8 +2035,9 @@ class BaseService {
1978
2035
  const totalCountField = fields.totalCountField || 'totalRecordCount';
1979
2036
  const continuationTokenField = fields.continuationTokenField || 'continuationToken';
1980
2037
  // Extract items and metadata
1981
- // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1982
- const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
2038
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
2039
+ // itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
2040
+ const items = Array.isArray(response.data) ? response.data : (resolveNestedField(response.data, itemsField) || []);
1983
2041
  const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
1984
2042
  const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
1985
2043
  const continuationToken = response.data[continuationTokenField];
@@ -2304,6 +2362,26 @@ class TaskService extends BaseService {
2304
2362
  * }
2305
2363
  * ]);
2306
2364
  * ```
2365
+ *
2366
+ * @example Group assignment
2367
+ * ```typescript
2368
+ * import { TaskAssignmentCriteria } from '@uipath/uipath-typescript/tasks';
2369
+ *
2370
+ * // Assign to a directory group by userId + criteria — Action Center
2371
+ * // distributes the task across the group's members based on the criteria
2372
+ * const result = await tasks.assign({
2373
+ * taskId: 123,
2374
+ * userId: 456, // a DirectoryGroup id from tasks.getUsers()
2375
+ * assignmentCriteria: TaskAssignmentCriteria.AllUsers
2376
+ * });
2377
+ *
2378
+ * // ...or identify the group by name instead of id
2379
+ * const result2 = await tasks.assign({
2380
+ * taskId: 123,
2381
+ * userNameOrEmail: "My Group",
2382
+ * assignmentCriteria: TaskAssignmentCriteria.AllUsers
2383
+ * });
2384
+ * ```
2307
2385
  */
2308
2386
  async assign(taskAssignments) {
2309
2387
  // Normalize input to array
@@ -2355,6 +2433,25 @@ class TaskService extends BaseService {
2355
2433
  * }
2356
2434
  * ]);
2357
2435
  * ```
2436
+ *
2437
+ * @example Group reassignment
2438
+ * ```typescript
2439
+ * import { TaskAssignmentCriteria } from '@uipath/uipath-typescript/tasks';
2440
+ *
2441
+ * // Reassign to a directory group by userId + criteria
2442
+ * const result = await tasks.reassign({
2443
+ * taskId: 123,
2444
+ * userId: 456, // a DirectoryGroup id from tasks.getUsers()
2445
+ * assignmentCriteria: TaskAssignmentCriteria.AllUsers
2446
+ * });
2447
+ *
2448
+ * // ...or identify the group by name instead of id
2449
+ * const result2 = await tasks.reassign({
2450
+ * taskId: 123,
2451
+ * userNameOrEmail: "My Group",
2452
+ * assignmentCriteria: TaskAssignmentCriteria.AllUsers
2453
+ * });
2454
+ * ```
2358
2455
  */
2359
2456
  async reassign(taskAssignments) {
2360
2457
  // Normalize input to array
@@ -2520,4 +2617,4 @@ __decorate([
2520
2617
  track('Tasks.Complete')
2521
2618
  ], TaskService.prototype, "complete", null);
2522
2619
 
2523
- export { TaskActivityType, TaskPriority, TaskService, TaskSlaCriteria, TaskSlaStatus, TaskSourceName, TaskStatus, TaskType, TaskUserType, TaskService as Tasks, createTaskWithMethods };
2620
+ export { TaskActivityType, TaskAssignmentCriteria, TaskPriority, TaskService, TaskSlaCriteria, TaskSlaStatus, TaskSourceName, TaskStatus, TaskType, TaskUserType, TaskService as Tasks, createTaskWithMethods };