@uipath/uipath-typescript 1.4.2 → 1.5.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 (52) hide show
  1. package/README.md +7 -1
  2. package/dist/agent-memory/index.d.ts +4 -1
  3. package/dist/agents/index.cjs +341 -6
  4. package/dist/agents/index.d.ts +717 -16
  5. package/dist/agents/index.mjs +342 -7
  6. package/dist/assets/index.cjs +132 -15
  7. package/dist/assets/index.d.ts +12 -1
  8. package/dist/assets/index.mjs +132 -15
  9. package/dist/attachments/index.cjs +120 -12
  10. package/dist/attachments/index.mjs +120 -12
  11. package/dist/buckets/index.cjs +136 -15
  12. package/dist/buckets/index.d.ts +12 -1
  13. package/dist/buckets/index.mjs +136 -15
  14. package/dist/cases/index.cjs +1203 -938
  15. package/dist/cases/index.d.ts +325 -45
  16. package/dist/cases/index.mjs +1203 -938
  17. package/dist/conversational-agent/index.cjs +48 -10
  18. package/dist/conversational-agent/index.d.ts +117 -6
  19. package/dist/conversational-agent/index.mjs +48 -10
  20. package/dist/core/index.cjs +1 -1
  21. package/dist/core/index.mjs +1 -1
  22. package/dist/entities/index.cjs +448 -9
  23. package/dist/entities/index.d.ts +441 -1
  24. package/dist/entities/index.mjs +447 -10
  25. package/dist/feedback/index.cjs +25 -9
  26. package/dist/feedback/index.mjs +25 -9
  27. package/dist/index.cjs +1281 -330
  28. package/dist/index.d.ts +1988 -143
  29. package/dist/index.mjs +1282 -331
  30. package/dist/index.umd.js +1230 -279
  31. package/dist/jobs/index.cjs +141 -19
  32. package/dist/jobs/index.d.ts +22 -6
  33. package/dist/jobs/index.mjs +141 -19
  34. package/dist/maestro-processes/index.cjs +553 -354
  35. package/dist/maestro-processes/index.d.ts +376 -47
  36. package/dist/maestro-processes/index.mjs +553 -354
  37. package/dist/notifications/index.cjs +2012 -0
  38. package/dist/notifications/index.d.ts +615 -0
  39. package/dist/notifications/index.mjs +2010 -0
  40. package/dist/processes/index.cjs +118 -18
  41. package/dist/processes/index.d.ts +18 -2
  42. package/dist/processes/index.mjs +118 -18
  43. package/dist/queues/index.cjs +131 -14
  44. package/dist/queues/index.d.ts +12 -1
  45. package/dist/queues/index.mjs +131 -14
  46. package/dist/tasks/index.cjs +125 -13
  47. package/dist/tasks/index.d.ts +4 -1
  48. package/dist/tasks/index.mjs +125 -13
  49. package/dist/traces/index.cjs +220 -6
  50. package/dist/traces/index.d.ts +360 -25
  51. package/dist/traces/index.mjs +221 -7
  52. package/package.json +14 -4
package/dist/index.mjs CHANGED
@@ -4621,6 +4621,7 @@ const MAESTRO_ENDPOINTS = {
4621
4621
  CANCEL: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/cancel`,
4622
4622
  PAUSE: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/pause`,
4623
4623
  RESUME: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/resume`,
4624
+ RETRY: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/retry`,
4624
4625
  },
4625
4626
  INCIDENTS: {
4626
4627
  GET_ALL: `${PIMS_BASE}/api/v1/incidents/summary`,
@@ -4650,8 +4651,12 @@ const MAESTRO_ENDPOINTS = {
4650
4651
  INSTANCE_STATUS_BY_DATE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/InstanceStatusByDate`,
4651
4652
  /** Top processes ranked by total duration */
4652
4653
  TOP_PROCESSES_BY_DURATION: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByDuration`,
4654
+ /** Instance stats (counts by status + duration percentiles) */
4655
+ INSTANCE_COUNT_BY_STATUS: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/InstanceCountByStatus`,
4653
4656
  /** Element count by status for agentic instances (process and case) */
4654
4657
  ELEMENT_COUNT_BY_STATUS: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/ElementCountByStatus`,
4658
+ /** Incident counts aggregated by time bucket for time-series charts */
4659
+ INCIDENTS_BY_TIME_WINDOW: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/IncidentsByTimeWindow`,
4655
4660
  },
4656
4661
  };
4657
4662
 
@@ -4701,6 +4706,14 @@ const DATA_FABRIC_ENDPOINTS = {
4701
4706
  UPDATE_BY_NAME: (choiceSetName, valueId) => `${DATAFABRIC_BASE}/api/EntityService/${choiceSetName}/choiceset/${valueId}/update`,
4702
4707
  DELETE_BY_ID: (choiceSetId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${choiceSetId}/choiceset/delete`,
4703
4708
  },
4709
+ ROLES: {
4710
+ GET_ALL: `${DATAFABRIC_BASE}/api/v2/Role`,
4711
+ },
4712
+ DIRECTORY: {
4713
+ GET_ALL: `${DATAFABRIC_BASE}/api/Directory`,
4714
+ ASSIGN_ROLES: `${DATAFABRIC_BASE}/api/Directory/Role`,
4715
+ REVOKE_ROLES: `${DATAFABRIC_BASE}/api/Directory/RevokeRole`,
4716
+ },
4704
4717
  };
4705
4718
 
4706
4719
  /**
@@ -5011,7 +5024,7 @@ class EmbeddedTokenManager {
5011
5024
  * SDK's public API.
5012
5025
  */
5013
5026
  /** SDK version placeholder — patched by the SDK publish workflow. */
5014
- const SDK_VERSION = '1.4.2';
5027
+ const SDK_VERSION = '1.5.1';
5015
5028
  const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
5016
5029
  const SDK_SERVICE_NAME = 'UiPath.TypeScript.Sdk';
5017
5030
  const SDK_LOGGER_NAME = 'uipath-ts-sdk-telemetry';
@@ -6978,7 +6991,16 @@ function toISOUtc(value) {
6978
6991
  return isNaN(date.getTime()) ? value : date.toISOString();
6979
6992
  }
6980
6993
  /**
6981
- * Transforms data by mapping fields according to the provided field mapping
6994
+ * Transforms data by renaming each key in `data` exactly once, using the
6995
+ * mapping (`sourceField → targetField`). Keys not present in the mapping
6996
+ * pass through unchanged. The original (pre-rename) key is dropped — the
6997
+ * result contains only the renamed key.
6998
+ *
6999
+ * Each rename is independent. If the mapping happens to contain chained
7000
+ * entries (`a → b` and `b → c`), they do NOT compose: a field named `a`
7001
+ * in `data` becomes `b` (not `c`), because the renames are applied based
7002
+ * on the original data's keys, not the running result.
7003
+ *
6982
7004
  * @param data The source data to transform
6983
7005
  * @param fieldMapping Object mapping source field names to target field names
6984
7006
  * @returns Transformed data with mapped field names
@@ -7001,21 +7023,28 @@ function toISOUtc(value) {
7001
7023
  * // { userId: '123', name: 'john' },
7002
7024
  * // { userId: '456', name: 'jane' }
7003
7025
  * // ]
7026
+ *
7027
+ * // No chaining — `a → b` does not become `a → c` even if the map has `b → c`.
7028
+ * transformData({ a: 1 }, { a: 'b', b: 'c' });
7029
+ * // result = { b: 1 }
7004
7030
  * ```
7005
7031
  */
7006
7032
  function transformData(data, fieldMapping) {
7033
+ // Pass null/undefined through unchanged — callers (e.g. AttachmentService.getById)
7034
+ // may invoke this on optional fields that an OData `select` excluded.
7035
+ if (data == null) {
7036
+ return data;
7037
+ }
7007
7038
  // Handle array of objects
7008
7039
  if (Array.isArray(data)) {
7009
7040
  return data.map(item => transformData(item, fieldMapping));
7010
7041
  }
7011
- // Handle single object
7012
- const result = { ...data };
7013
- for (const [sourceField, targetField] of Object.entries(fieldMapping)) {
7014
- if (sourceField in result) {
7015
- const value = result[sourceField];
7016
- delete result[sourceField];
7017
- result[targetField] = value;
7018
- }
7042
+ // Walk the ORIGINAL data's keys, look up each in the mapping. One rename
7043
+ // per data key — no mutation of an in-progress result, so chains can't form.
7044
+ const result = {};
7045
+ for (const [key, value] of Object.entries(data)) {
7046
+ const renamedKey = fieldMapping[key] ?? key;
7047
+ result[renamedKey] = value;
7019
7048
  }
7020
7049
  return result;
7021
7050
  }
@@ -7293,6 +7322,79 @@ function transformRequest(data, responseMap) {
7293
7322
  }
7294
7323
  return result;
7295
7324
  }
7325
+ /**
7326
+ * OData query-string keys whose values may contain field identifiers that
7327
+ * need rewriting from SDK names → API names.
7328
+ */
7329
+ const ODATA_FIELD_PARAM_KEYS = ['filter', 'orderby', 'select', 'expand'];
7330
+ /**
7331
+ * Matches one token at a time in an OData expression:
7332
+ * 1. A single-quoted string literal, allowing the `''` escape sequence —
7333
+ * consumed atomically so identifiers inside the literal can't match.
7334
+ * 2. An OData identifier (`[A-Za-z_][A-Za-z0-9_]*`).
7335
+ * Anything else (whitespace, operators, parens, commas) is left alone by
7336
+ * `String.prototype.replace`, which only substitutes matched substrings.
7337
+ */
7338
+ const ODATA_TOKEN_RE = /'(?:[^']|'')*'|[A-Za-z_][A-Za-z0-9_]*/g;
7339
+ /**
7340
+ * Rewrites SDK field identifiers to API field identifiers inside an OData
7341
+ * expression string (`$filter`, `$orderby`, `$select`, `$expand`).
7342
+ *
7343
+ * Field maps (e.g. `JobMap`) rename API fields → SDK fields on responses, so
7344
+ * SDK consumers see the renamed names. Without this rewrite, the same name
7345
+ * in a `filter` string would be forwarded verbatim and the API (which still
7346
+ * uses the original name) would reject it.
7347
+ *
7348
+ * Quoted string literals (with the OData `''` escape) are preserved exactly:
7349
+ * the token regex consumes them whole, so identifiers inside literals never
7350
+ * match. Identifier tokens are looked up in the reversed field map.
7351
+ *
7352
+ * @example
7353
+ * ```typescript
7354
+ * const requestMap = { processName: 'releaseName' };
7355
+ * rewriteODataIdentifiers("processName eq 'processName'", requestMap);
7356
+ * // "releaseName eq 'processName'" — identifier rewritten, literal preserved
7357
+ * ```
7358
+ */
7359
+ function rewriteODataIdentifiers(expression, requestMap) {
7360
+ if (!expression)
7361
+ return expression;
7362
+ return expression.replace(ODATA_TOKEN_RE, (match) => match.startsWith("'") ? match : (requestMap[match] ?? match));
7363
+ }
7364
+ /**
7365
+ * Symmetric counterpart of {@link transformRequest} for OData query options:
7366
+ * rewrites SDK field identifiers inside the recognized OData string params
7367
+ * (`filter`, `orderby`, `select`, `expand`) to their API names using the
7368
+ * reversed form of a response field map. Returns a shallow copy with the
7369
+ * relevant values rewritten; other keys pass through unchanged.
7370
+ *
7371
+ * Use at the OData edge so SDK consumers can refer to renamed fields by
7372
+ * their SDK name throughout — for reading the response and for filtering /
7373
+ * sorting / projecting / expanding.
7374
+ *
7375
+ * @param options The OData query options as authored with SDK field names
7376
+ * @param responseMap The response field map (API → SDK); reversed internally
7377
+ *
7378
+ * @example
7379
+ * ```typescript
7380
+ * // JobMap renames releaseName → processName on responses.
7381
+ * transformOptions({ filter: "processName eq 'X'" }, JobMap);
7382
+ * // { filter: "releaseName eq 'X'" }
7383
+ * ```
7384
+ */
7385
+ function transformOptions(options, responseMap) {
7386
+ const requestMap = reverseMap(responseMap);
7387
+ if (Object.keys(requestMap).length === 0)
7388
+ return options;
7389
+ const result = { ...options };
7390
+ for (const key of ODATA_FIELD_PARAM_KEYS) {
7391
+ const value = result[key];
7392
+ if (typeof value === 'string') {
7393
+ result[key] = rewriteODataIdentifiers(value, requestMap);
7394
+ }
7395
+ }
7396
+ return result;
7397
+ }
7296
7398
  /**
7297
7399
  * Transforms an array-based dictionary with separate keys and values arrays
7298
7400
  * into a standard JavaScript object/record
@@ -9859,6 +9961,434 @@ __decorate([
9859
9961
  track('Choicesets.DeleteValuesById')
9860
9962
  ], ChoiceSetService.prototype, "deleteValuesById", null);
9861
9963
 
9964
+ /**
9965
+ * @internal
9966
+ */
9967
+ var DataFabricRoleType;
9968
+ (function (DataFabricRoleType) {
9969
+ DataFabricRoleType["System"] = "System";
9970
+ DataFabricRoleType["UserDefined"] = "UserDefined";
9971
+ })(DataFabricRoleType || (DataFabricRoleType = {}));
9972
+
9973
+ function isRecord$1(value) {
9974
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
9975
+ }
9976
+ function isDataFabricRole(value) {
9977
+ if (!isRecord$1(value)) {
9978
+ return false;
9979
+ }
9980
+ const { id, name, type, directoryEntityCount, folderId } = value;
9981
+ const hasValidDirectoryEntityCount = directoryEntityCount === undefined ||
9982
+ directoryEntityCount === null ||
9983
+ typeof directoryEntityCount === 'number';
9984
+ const hasValidFolderId = folderId === undefined || typeof folderId === 'string';
9985
+ return typeof id === 'string' &&
9986
+ typeof name === 'string' &&
9987
+ (type === DataFabricRoleType.System || type === DataFabricRoleType.UserDefined) &&
9988
+ hasValidDirectoryEntityCount &&
9989
+ hasValidFolderId;
9990
+ }
9991
+ function validateRolesResponse(data) {
9992
+ if (Array.isArray(data) && data.every(isDataFabricRole)) {
9993
+ return data;
9994
+ }
9995
+ throw new ServerError({
9996
+ message: 'Invalid Data Fabric roles response format.',
9997
+ });
9998
+ }
9999
+ /**
10000
+ * @internal
10001
+ */
10002
+ class DataFabricRoleService extends BaseService {
10003
+ /**
10004
+ * Lists Data Fabric access roles.
10005
+ *
10006
+ * Returns tenant Data Fabric roles such as Admin, Designer, DataWriter, and
10007
+ * DataReader. Role IDs from this method can be passed to
10008
+ * `DataFabricDirectoryService.assignRoles()`.
10009
+ *
10010
+ * @param options - Optional query options
10011
+ * @returns Promise resolving to an array of {@link DataFabricRole}
10012
+ *
10013
+ * @example
10014
+ * ```typescript
10015
+ * import { DataFabricRoleService } from '@uipath/uipath-typescript/entities';
10016
+ *
10017
+ * const roles = new DataFabricRoleService(sdk);
10018
+ * const allRoles = await roles.getAll();
10019
+ * const dataWriter = allRoles.find(role => role.name === 'DataWriter');
10020
+ * ```
10021
+ *
10022
+ * @example
10023
+ * ```typescript
10024
+ * const rolesWithoutStats = await roles.getAll({ stats: false });
10025
+ * ```
10026
+ *
10027
+ * @example
10028
+ * ```typescript
10029
+ * const folderRoles = await roles.getAll({ folderKey: '<folder-key>' });
10030
+ * ```
10031
+ *
10032
+ * @internal
10033
+ */
10034
+ async getAll(options = {}) {
10035
+ const params = createParams({
10036
+ stats: options.stats ?? true,
10037
+ });
10038
+ const headers = createHeaders({ [FOLDER_KEY]: options.folderKey });
10039
+ const response = await this.get(DATA_FABRIC_ENDPOINTS.ROLES.GET_ALL, { params, headers });
10040
+ return validateRolesResponse(response.data);
10041
+ }
10042
+ }
10043
+ __decorate([
10044
+ track('DataFabricRoles.GetAll')
10045
+ ], DataFabricRoleService.prototype, "getAll", null);
10046
+
10047
+ /**
10048
+ * @internal
10049
+ */
10050
+ var DataFabricDirectoryEntityType;
10051
+ (function (DataFabricDirectoryEntityType) {
10052
+ /** Identity user, robot user, or directory robot principal. */
10053
+ DataFabricDirectoryEntityType[DataFabricDirectoryEntityType["User"] = 0] = "User";
10054
+ /** Identity group principal. */
10055
+ DataFabricDirectoryEntityType[DataFabricDirectoryEntityType["Group"] = 1] = "Group";
10056
+ /** External application principal. */
10057
+ DataFabricDirectoryEntityType[DataFabricDirectoryEntityType["Application"] = 2] = "Application";
10058
+ })(DataFabricDirectoryEntityType || (DataFabricDirectoryEntityType = {}));
10059
+ /**
10060
+ * @internal
10061
+ */
10062
+ var DataFabricDirectoryEntityTypeName;
10063
+ (function (DataFabricDirectoryEntityTypeName) {
10064
+ DataFabricDirectoryEntityTypeName["User"] = "User";
10065
+ DataFabricDirectoryEntityTypeName["Group"] = "Group";
10066
+ DataFabricDirectoryEntityTypeName["Application"] = "Application";
10067
+ })(DataFabricDirectoryEntityTypeName || (DataFabricDirectoryEntityTypeName = {}));
10068
+
10069
+ const DEFAULT_DIRECTORY_PAGE_SIZE = 100;
10070
+ const MAX_DIRECTORY_PAGE_SIZE = 100;
10071
+ function validateDirectoryListResponse(data) {
10072
+ if (data === null || typeof data !== 'object' || Array.isArray(data)) {
10073
+ throw new ServerError({
10074
+ message: 'Invalid Data Fabric directory response format.',
10075
+ });
10076
+ }
10077
+ const response = data;
10078
+ if (typeof response.totalCount !== 'number' || !Array.isArray(response.results)) {
10079
+ throw new ServerError({
10080
+ message: 'Invalid Data Fabric directory response format.',
10081
+ });
10082
+ }
10083
+ return {
10084
+ totalCount: response.totalCount,
10085
+ results: response.results,
10086
+ };
10087
+ }
10088
+ function isRecord(value) {
10089
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
10090
+ }
10091
+ function isDirectoryEntityTypeName(value) {
10092
+ return value === DataFabricDirectoryEntityTypeName.User ||
10093
+ value === DataFabricDirectoryEntityTypeName.Group ||
10094
+ value === DataFabricDirectoryEntityTypeName.Application;
10095
+ }
10096
+ function isDirectoryRole(value) {
10097
+ if (!isRecord(value)) {
10098
+ return false;
10099
+ }
10100
+ return typeof value.id === 'string' && typeof value.name === 'string';
10101
+ }
10102
+ function normalizeDirectoryEntry(entry) {
10103
+ if (!isRecord(entry) ||
10104
+ typeof entry.externalId !== 'string' ||
10105
+ typeof entry.name !== 'string' ||
10106
+ !isDirectoryEntityTypeName(entry.type) ||
10107
+ (entry.email !== undefined && entry.email !== null && typeof entry.email !== 'string') ||
10108
+ (entry.objectType !== undefined && entry.objectType !== null && typeof entry.objectType !== 'string') ||
10109
+ (entry.isUIEnabled !== undefined && typeof entry.isUIEnabled !== 'boolean') ||
10110
+ (entry.roles !== undefined && entry.roles !== null && (!Array.isArray(entry.roles) || !entry.roles.every(isDirectoryRole)))) {
10111
+ throw new ServerError({
10112
+ message: 'Invalid Data Fabric directory entry response format.',
10113
+ });
10114
+ }
10115
+ const normalized = {
10116
+ externalId: entry.externalId,
10117
+ name: entry.name,
10118
+ type: entry.type,
10119
+ roles: entry.roles ?? [],
10120
+ isUIEnabled: entry.isUIEnabled ?? true,
10121
+ };
10122
+ if (entry.email !== undefined) {
10123
+ normalized.email = entry.email;
10124
+ }
10125
+ if (entry.objectType !== undefined) {
10126
+ normalized.objectType = entry.objectType;
10127
+ }
10128
+ return normalized;
10129
+ }
10130
+ function normalizePrincipalIds(principalIds) {
10131
+ const ids = Array.isArray(principalIds) ? principalIds : [principalIds];
10132
+ return [...new Set(ids.map(id => id.trim()).filter(Boolean))];
10133
+ }
10134
+ function normalizeRoleIds(roleIds) {
10135
+ return [...new Set(roleIds.map(id => id.trim()).filter(Boolean))];
10136
+ }
10137
+ function normalizePrincipalType(type) {
10138
+ if (typeof type === 'number') {
10139
+ if (type === DataFabricDirectoryEntityType.User ||
10140
+ type === DataFabricDirectoryEntityType.Group ||
10141
+ type === DataFabricDirectoryEntityType.Application) {
10142
+ return type;
10143
+ }
10144
+ throw new ValidationError({
10145
+ message: 'Invalid Data Fabric principal type.',
10146
+ });
10147
+ }
10148
+ switch (type) {
10149
+ case DataFabricDirectoryEntityTypeName.User:
10150
+ return DataFabricDirectoryEntityType.User;
10151
+ case DataFabricDirectoryEntityTypeName.Group:
10152
+ return DataFabricDirectoryEntityType.Group;
10153
+ case DataFabricDirectoryEntityTypeName.Application:
10154
+ return DataFabricDirectoryEntityType.Application;
10155
+ default:
10156
+ throw new ValidationError({
10157
+ message: 'Invalid Data Fabric principal type.',
10158
+ });
10159
+ }
10160
+ }
10161
+ function roleIdsFromEntry(entry) {
10162
+ if (!entry) {
10163
+ return [];
10164
+ }
10165
+ return normalizeRoleIds(entry.roles.map(role => role.id));
10166
+ }
10167
+ function clampDirectoryPageSize(pageSize) {
10168
+ return Math.max(1, Math.min(pageSize ?? DEFAULT_DIRECTORY_PAGE_SIZE, MAX_DIRECTORY_PAGE_SIZE));
10169
+ }
10170
+ /**
10171
+ * @internal
10172
+ */
10173
+ class DataFabricDirectoryService extends BaseService {
10174
+ async fetchAllEntries(options = {}) {
10175
+ const top = clampDirectoryPageSize(options.pageSize);
10176
+ const entries = [];
10177
+ let skip = 0;
10178
+ while (true) {
10179
+ const page = await this.list(skip === 0 ? { top } : { top, skip });
10180
+ entries.push(...page.results);
10181
+ if (page.results.length < top || (page.totalCount !== undefined && entries.length >= page.totalCount)) {
10182
+ return entries;
10183
+ }
10184
+ skip += top;
10185
+ }
10186
+ }
10187
+ /**
10188
+ * Lists one page of Data Fabric directory principals and their current roles.
10189
+ *
10190
+ * Returns directory entries with external IDs, principal metadata, and
10191
+ * assigned Data Fabric roles.
10192
+ *
10193
+ * @param options - Optional offset paging options
10194
+ * @returns Promise resolving to {@link DataFabricDirectoryListResponse}
10195
+ *
10196
+ * @example
10197
+ * ```typescript
10198
+ * import { DataFabricDirectoryService } from '@uipath/uipath-typescript/entities';
10199
+ *
10200
+ * const directory = new DataFabricDirectoryService(sdk);
10201
+ * const page = await directory.list({ skip: 0, top: 50 });
10202
+ * const firstPrincipal = page.results[0];
10203
+ * ```
10204
+ *
10205
+ * @internal
10206
+ */
10207
+ async list(options = {}) {
10208
+ const params = createParams({
10209
+ skip: options.skip,
10210
+ top: clampDirectoryPageSize(options.top),
10211
+ });
10212
+ const response = await this.get(DATA_FABRIC_ENDPOINTS.DIRECTORY.GET_ALL, { params });
10213
+ const data = validateDirectoryListResponse(response.data);
10214
+ const results = data.results.map(normalizeDirectoryEntry);
10215
+ return {
10216
+ totalCount: data.totalCount,
10217
+ results,
10218
+ };
10219
+ }
10220
+ /**
10221
+ * Lists all Data Fabric directory principals and their current roles.
10222
+ *
10223
+ * Follows the Data Fabric directory top/skip pagination and returns
10224
+ * normalized entries. Entries without assigned roles include an empty
10225
+ * `roles` array.
10226
+ *
10227
+ * @param options - Optional page-size options
10228
+ * @returns Promise resolving to an array of {@link DataFabricDirectoryEntry}
10229
+ *
10230
+ * @example
10231
+ * ```typescript
10232
+ * import { DataFabricDirectoryService } from '@uipath/uipath-typescript/entities';
10233
+ *
10234
+ * const directory = new DataFabricDirectoryService(sdk);
10235
+ * const principals = await directory.getAll({ pageSize: 100 });
10236
+ * ```
10237
+ *
10238
+ * @internal
10239
+ */
10240
+ async getAll(options = {}) {
10241
+ return this.fetchAllEntries(options);
10242
+ }
10243
+ /**
10244
+ * Assigns Data Fabric roles to one or more principals.
10245
+ *
10246
+ * The Data Fabric API replaces the role set for each principal, so this
10247
+ * method preserves existing roles by default and posts the union of current
10248
+ * and requested role IDs.
10249
+ *
10250
+ * Role IDs can be discovered with `DataFabricRoleService.getAll()`. Set
10251
+ * `preserveExisting: false` only when intentionally replacing a principal's
10252
+ * Data Fabric role set.
10253
+ *
10254
+ * @param principalIds - Principal external ID or IDs
10255
+ * @param principalType - Principal type
10256
+ * @param roleIds - Data Fabric role IDs to assign
10257
+ * @param options - Optional assignment behavior
10258
+ * @returns Promise resolving to an array of {@link DataFabricDirectoryAssignmentResult}
10259
+ *
10260
+ * @example
10261
+ * ```typescript
10262
+ * import { DataFabricDirectoryEntityTypeName, DataFabricDirectoryService, DataFabricRoleService } from '@uipath/uipath-typescript/entities';
10263
+ *
10264
+ * const roles = new DataFabricRoleService(sdk);
10265
+ * const directory = new DataFabricDirectoryService(sdk);
10266
+ *
10267
+ * const dataWriter = (await roles.getAll()).find(role => role.name === 'DataWriter');
10268
+ * if (!dataWriter) {
10269
+ * throw new Error('DataWriter role not found');
10270
+ * }
10271
+ *
10272
+ * await directory.assignRoles('<identity-group-id>', DataFabricDirectoryEntityTypeName.Group, [dataWriter.id]);
10273
+ * ```
10274
+ *
10275
+ * @example
10276
+ * ```typescript
10277
+ * await directory.assignRoles('<identity-user-id>', DataFabricDirectoryEntityTypeName.User, ['<role-id>'], {
10278
+ * preserveExisting: false,
10279
+ * });
10280
+ * ```
10281
+ *
10282
+ * @internal
10283
+ */
10284
+ async assignRoles(principalIds, principalType, roleIds, options = {}) {
10285
+ const normalizedPrincipalIds = normalizePrincipalIds(principalIds);
10286
+ const normalizedRoleIds = normalizeRoleIds(roleIds);
10287
+ if (normalizedPrincipalIds.length === 0) {
10288
+ throw new ValidationError({ message: 'At least one principal ID is required.' });
10289
+ }
10290
+ if (normalizedRoleIds.length === 0) {
10291
+ throw new ValidationError({ message: 'At least one Data Fabric role ID is required.' });
10292
+ }
10293
+ const type = normalizePrincipalType(principalType);
10294
+ const preserveExisting = options.preserveExisting ?? true;
10295
+ const existingById = new Map();
10296
+ if (preserveExisting) {
10297
+ for (const entry of await this.fetchAllEntries()) {
10298
+ existingById.set(entry.externalId.toLowerCase(), entry);
10299
+ }
10300
+ }
10301
+ return Promise.all(normalizedPrincipalIds.map(async (principalId) => {
10302
+ const existing = existingById.get(principalId.toLowerCase());
10303
+ const mergedRoleIds = preserveExisting
10304
+ ? normalizeRoleIds([...roleIdsFromEntry(existing), ...normalizedRoleIds])
10305
+ : normalizedRoleIds;
10306
+ const payload = {
10307
+ directoryEntities: [
10308
+ {
10309
+ externalId: principalId,
10310
+ type,
10311
+ resolved: true,
10312
+ },
10313
+ ],
10314
+ roles: mergedRoleIds,
10315
+ isUIEnabled: options.uiEnabled ?? true,
10316
+ };
10317
+ await this.post(DATA_FABRIC_ENDPOINTS.DIRECTORY.ASSIGN_ROLES, payload);
10318
+ return {
10319
+ principalId,
10320
+ roleIds: mergedRoleIds,
10321
+ };
10322
+ }));
10323
+ }
10324
+ /**
10325
+ * Revokes all direct Data Fabric roles from one or more principals.
10326
+ *
10327
+ * The Data Fabric API removes all role assignments for each supplied external
10328
+ * ID. Use this when a principal should no longer have direct Data Fabric
10329
+ * access. Inherited access through groups is not changed.
10330
+ *
10331
+ * @param principalIds - Principal external ID or IDs
10332
+ * @returns Promise resolving when the roles are revoked
10333
+ *
10334
+ * @example
10335
+ * ```typescript
10336
+ * import { DataFabricDirectoryService } from '@uipath/uipath-typescript/entities';
10337
+ *
10338
+ * const directory = new DataFabricDirectoryService(sdk);
10339
+ *
10340
+ * await directory.revokeRoles('<identity-user-id>');
10341
+ * ```
10342
+ *
10343
+ * @example
10344
+ * ```typescript
10345
+ * await directory.revokeRoles([
10346
+ * '<identity-user-id>',
10347
+ * '<identity-group-id>',
10348
+ * ]);
10349
+ * ```
10350
+ *
10351
+ * @internal
10352
+ */
10353
+ async revokeRoles(principalIds) {
10354
+ const normalizedPrincipalIds = normalizePrincipalIds(principalIds);
10355
+ if (normalizedPrincipalIds.length === 0) {
10356
+ throw new ValidationError({ message: 'At least one principal ID is required.' });
10357
+ }
10358
+ const payload = {
10359
+ externalIds: normalizedPrincipalIds,
10360
+ };
10361
+ await this.post(DATA_FABRIC_ENDPOINTS.DIRECTORY.REVOKE_ROLES, payload);
10362
+ }
10363
+ }
10364
+ __decorate([
10365
+ track('DataFabricDirectory.List')
10366
+ ], DataFabricDirectoryService.prototype, "list", null);
10367
+ __decorate([
10368
+ track('DataFabricDirectory.GetAll')
10369
+ ], DataFabricDirectoryService.prototype, "getAll", null);
10370
+ __decorate([
10371
+ track('DataFabricDirectory.AssignRoles')
10372
+ ], DataFabricDirectoryService.prototype, "assignRoles", null);
10373
+ __decorate([
10374
+ track('DataFabricDirectory.RevokeRoles')
10375
+ ], DataFabricDirectoryService.prototype, "revokeRoles", null);
10376
+
10377
+ /**
10378
+ * Maps API field names (countOf*) to SDK field names (*Count) for InstanceStats,
10379
+ * aligning naming with ElementStats and other count-suffixed conventions.
10380
+ */
10381
+ const InstanceStatsMap = {
10382
+ countOfAllInstances: 'totalCount',
10383
+ countOfRunning: 'runningCount',
10384
+ countOfTransitioning: 'transitioningCount',
10385
+ countOfPaused: 'pausedCount',
10386
+ countOfFaulted: 'faultedCount',
10387
+ countOfCompleted: 'completedCount',
10388
+ countOfCancelled: 'cancelledCount',
10389
+ countOfDeleted: 'deletedCount'
10390
+ };
10391
+
9862
10392
  /**
9863
10393
  * Maestro Process Models
9864
10394
  * Model classes for Maestro processes
@@ -9884,7 +10414,36 @@ function createProcessMethods(processData, service) {
9884
10414
  throw new Error('Process key is undefined');
9885
10415
  if (!processData.packageId)
9886
10416
  throw new Error('Package ID is undefined');
9887
- return service.getElementStats(processData.processKey, processData.packageId, startTime, endTime, packageVersion);
10417
+ return service.getElementStats({
10418
+ processKey: processData.processKey,
10419
+ packageId: processData.packageId,
10420
+ packageVersion,
10421
+ startTime,
10422
+ endTime,
10423
+ });
10424
+ },
10425
+ getInstanceStats(startTime, endTime, packageVersion) {
10426
+ if (!processData.processKey)
10427
+ throw new Error('Process key is undefined');
10428
+ if (!processData.packageId)
10429
+ throw new Error('Package ID is undefined');
10430
+ return service.getInstanceStats({
10431
+ processKey: processData.processKey,
10432
+ packageId: processData.packageId,
10433
+ packageVersion,
10434
+ startTime,
10435
+ endTime,
10436
+ });
10437
+ },
10438
+ getInstanceStatusTimeline(startTime, endTime, options) {
10439
+ if (!processData.processKey)
10440
+ throw new Error('Process key is undefined');
10441
+ return service.getInstanceStatusTimeline(startTime, endTime, { ...options, processKeys: [processData.processKey] });
10442
+ },
10443
+ getIncidentsTimeline(startTime, endTime, options) {
10444
+ if (!processData.processKey)
10445
+ throw new Error('Process key is undefined');
10446
+ return service.getIncidentsTimeline(startTime, endTime, { ...options, processKeys: [processData.processKey] });
9888
10447
  }
9889
10448
  };
9890
10449
  }
@@ -9901,226 +10460,41 @@ function createProcessWithMethods(processData, service) {
9901
10460
  }
9902
10461
 
9903
10462
  /**
9904
- * Builds the request body for Insights RTM "top" endpoints.
10463
+ * Creates methods for a process instance
9905
10464
  *
9906
- * @param startTime - Start of the time range to query
9907
- * @param endTime - End of the time range to query
9908
- * @param isCaseManagement - Whether to filter for case management processes
9909
- * @param options - Optional filters (packageId, processKey, version)
9910
- * @returns Request body for the Insights RTM endpoint
9911
- * @internal
10465
+ * @param instanceData - The process instance data (response from API)
10466
+ * @param service - The process instance service instance
10467
+ * @returns Object containing process instance methods
9912
10468
  */
9913
- function buildInsightsTopBody(startTime, endTime, isCaseManagement, options) {
10469
+ function createProcessInstanceMethods(instanceData, service) {
9914
10470
  return {
9915
- commonParams: {
9916
- startTime: startTime.getTime(),
9917
- endTime: endTime.getTime(),
9918
- isCaseManagement,
9919
- ...(options?.packageId ? { packageId: options.packageId } : {}),
9920
- ...(options?.processKey ? { processKey: options.processKey } : {}),
9921
- ...(options?.version ? { version: options.version } : {}),
9922
- }
9923
- };
9924
- }
9925
- /**
9926
- * Fetches instance status timeline from the Insights API.
9927
- * Shared implementation used by both MaestroProcessesService and CasesService.
9928
- *
9929
- * @param postFn - Bound post method from a BaseService subclass
9930
- * @param startTime - Start of the time range to query
9931
- * @param endTime - End of the time range to query
9932
- * @param isCaseManagement - Whether to filter for case management processes
9933
- * @param options - Optional settings for time bucketing granularity
9934
- * @returns Promise resolving to an array of instance status timeline entries
9935
- * @internal
9936
- */
9937
- async function fetchInstanceStatusTimeline(postFn, startTime, endTime, isCaseManagement, options) {
9938
- const response = await postFn(MAESTRO_ENDPOINTS.INSIGHTS.INSTANCE_STATUS_BY_DATE, {
9939
- commonParams: {
9940
- startTime: startTime.getTime(),
9941
- endTime: endTime.getTime(),
9942
- isCaseManagement,
10471
+ async cancel(options) {
10472
+ if (!instanceData.instanceId)
10473
+ throw new Error('Process instance ID is undefined');
10474
+ if (!instanceData.folderKey)
10475
+ throw new Error('Process instance folder key is undefined');
10476
+ return service.cancel(instanceData.instanceId, instanceData.folderKey, options);
9943
10477
  },
9944
- timeSliceUnit: options?.groupBy,
9945
- timezoneOffset: new Date().getTimezoneOffset() * -1,
9946
- });
9947
- return response.data ?? [];
9948
- }
9949
- /**
9950
- * Builds the request body for the ElementCountByStatus endpoint.
9951
- *
9952
- * @param processKey - Process key to filter by
9953
- * @param packageId - Package identifier
9954
- * @param startTime - Start of the time range to query
9955
- * @param endTime - End of the time range to query
9956
- * @param packageVersion - Package version to filter by
9957
- * @returns Request body for the ElementCountByStatus endpoint
9958
- * @internal
9959
- */
9960
- function buildElementCountByStatusBody(processKey, packageId, startTime, endTime, packageVersion) {
9961
- return {
9962
- commonParams: {
9963
- processKey,
9964
- packageId,
9965
- startTime: startTime.getTime(),
9966
- endTime: endTime.getTime(),
9967
- version: packageVersion
9968
- }
9969
- };
9970
- }
9971
-
9972
- /**
9973
- * Maps fields for Incident entities
9974
- */
9975
- const ProcessIncidentMap = {
9976
- errorTimeUtc: 'errorTime'
9977
- };
9978
- /**
9979
- * Maps fields for Incident Summary entities
9980
- */
9981
- const ProcessIncidentSummaryMap = {
9982
- firstTimeUtc: 'firstOccuranceTime'
9983
- };
9984
-
9985
- /**
9986
- * Helpers for fetching BPMN XML and extracting element details used to annotate responses
9987
- */
9988
- class BpmnHelpers {
9989
- /**
9990
- * Parse BPMN XML and extract element id → {name,type} used for incidents
9991
- */
9992
- static parseBpmnElementsForIncidents(bpmnXml) {
9993
- const elementInfo = {};
9994
- try {
9995
- // Find <bpmn:...> start tags and capture the element type.
9996
- // Then read 'id' and 'name' attributes from each tag.
9997
- const bpmnOpenTagRegex = /<bpmn:([A-Za-z][\w.-]*)\b[^>]*>/g;
9998
- for (const tagMatch of bpmnXml.matchAll(bpmnOpenTagRegex)) {
9999
- const [fullTag, elementType] = tagMatch;
10000
- // Extract attributes from the current tag text.
10001
- const idMatch = /\bid\s*=\s*"([^"]*)"/.exec(fullTag);
10002
- if (!idMatch) {
10003
- continue;
10004
- }
10005
- const elementId = idMatch[1];
10006
- const nameMatch = /\bname\s*=\s*"([^"]*)"/.exec(fullTag);
10007
- const name = nameMatch ? nameMatch[1] : '';
10008
- // Convert BPMN element type to human-readable format
10009
- const activityType = this.formatActivityTypeForIncidents(elementType);
10010
- const activityName = name || elementId;
10011
- elementInfo[elementId] = {
10012
- type: activityType,
10013
- name: activityName
10014
- };
10015
- }
10016
- }
10017
- catch (error) {
10018
- console.warn('Failed to parse BPMN XML for incidents:', error);
10019
- }
10020
- return elementInfo;
10021
- }
10022
- /**
10023
- * Format BPMN element type to human-readable activity type for incidents
10024
- */
10025
- static formatActivityTypeForIncidents(elementType) {
10026
- // Convert camelCase BPMN element types to human-readable format
10027
- // e.g., "serviceTask" -> "Service Task", "exclusiveGateway" -> "Exclusive Gateway"
10028
- return elementType
10029
- .replace(/([A-Z])/g, ' $1') // Add space before uppercase letters
10030
- .replace(/^./, str => str.toUpperCase()) // Capitalize first letter
10031
- .trim(); // Remove any leading/trailing spaces
10032
- }
10033
- /**
10034
- * Fetch BPMN via getBpmn and add element name/type to each incident
10035
- */
10036
- static async enrichIncidentsWithBpmnData(incidents, folderKey, service) {
10037
- // Check if all incidents have the same instanceId
10038
- const uniqueInstanceIds = [...new Set(incidents.map(i => i.instanceId))];
10039
- if (uniqueInstanceIds.length === 1) {
10040
- // Single instance optimization (in case of process instance incidents)
10041
- const elementInfo = await this.getBpmnElementInfo(uniqueInstanceIds[0], folderKey, service);
10042
- return incidents.map((incident) => this.transformIncidentWithBpmn(incident, elementInfo));
10043
- }
10044
- else {
10045
- // Multiple instances optimization (in case of process incidents)
10046
- return this.enrichMultipleInstanceIncidents(incidents, folderKey, service);
10047
- }
10048
- }
10049
- /**
10050
- * When incidents span multiple instances, fetch BPMN per instance and annotate
10051
- */
10052
- static async enrichMultipleInstanceIncidents(incidents, folderKey, service) {
10053
- const groups = incidents.reduce((acc, incident) => {
10054
- const id = incident.instanceId || NO_INSTANCE;
10055
- (acc[id] = acc[id] || []).push(incident);
10056
- return acc;
10057
- }, {});
10058
- const results = await Promise.all(Object.entries(groups).map(async (entry) => {
10059
- const [instanceId, groupIncidents] = entry;
10060
- const elementInfo = await this.getBpmnElementInfo(instanceId, folderKey, service);
10061
- return groupIncidents.map((incident) => this.transformIncidentWithBpmn(incident, elementInfo));
10062
- }));
10063
- return results.flat();
10064
- }
10065
- /**
10066
- * Retrieve BPMN XML for an instance and derive element id → {name,type}
10067
- */
10068
- static async getBpmnElementInfo(instanceId, folderKey, service) {
10069
- if (!instanceId || instanceId === NO_INSTANCE) {
10070
- return {};
10071
- }
10072
- try {
10073
- const bpmnXml = await service.getBpmn(instanceId, folderKey);
10074
- return this.parseBpmnElementsForIncidents(bpmnXml);
10075
- }
10076
- catch (error) {
10077
- console.warn(`Failed to get BPMN for instance ${instanceId}:`, error);
10078
- return {};
10079
- }
10080
- }
10081
- /**
10082
- * Transform a raw incident by attaching element name/type from BPMN
10083
- */
10084
- static transformIncidentWithBpmn(incident, elementInfo) {
10085
- const element = elementInfo[incident.elementId];
10086
- const transformed = transformData(incident, ProcessIncidentMap);
10087
- return {
10088
- ...transformed,
10089
- incidentElementActivityType: element?.type || UNKNOWN,
10090
- incidentElementActivityName: element?.name || UNKNOWN
10091
- };
10092
- }
10093
- }
10094
-
10095
- /**
10096
- * Creates methods for a process instance
10097
- *
10098
- * @param instanceData - The process instance data (response from API)
10099
- * @param service - The process instance service instance
10100
- * @returns Object containing process instance methods
10101
- */
10102
- function createProcessInstanceMethods(instanceData, service) {
10103
- return {
10104
- async cancel(options) {
10478
+ async pause(options) {
10105
10479
  if (!instanceData.instanceId)
10106
10480
  throw new Error('Process instance ID is undefined');
10107
10481
  if (!instanceData.folderKey)
10108
10482
  throw new Error('Process instance folder key is undefined');
10109
- return service.cancel(instanceData.instanceId, instanceData.folderKey, options);
10483
+ return service.pause(instanceData.instanceId, instanceData.folderKey, options);
10110
10484
  },
10111
- async pause(options) {
10485
+ async resume(options) {
10112
10486
  if (!instanceData.instanceId)
10113
10487
  throw new Error('Process instance ID is undefined');
10114
10488
  if (!instanceData.folderKey)
10115
10489
  throw new Error('Process instance folder key is undefined');
10116
- return service.pause(instanceData.instanceId, instanceData.folderKey, options);
10490
+ return service.resume(instanceData.instanceId, instanceData.folderKey, options);
10117
10491
  },
10118
- async resume(options) {
10492
+ async retry(options) {
10119
10493
  if (!instanceData.instanceId)
10120
10494
  throw new Error('Process instance ID is undefined');
10121
10495
  if (!instanceData.folderKey)
10122
10496
  throw new Error('Process instance folder key is undefined');
10123
- return service.resume(instanceData.instanceId, instanceData.folderKey, options);
10497
+ return service.retry(instanceData.instanceId, instanceData.folderKey, options);
10124
10498
  },
10125
10499
  async getIncidents() {
10126
10500
  if (!instanceData.instanceId)
@@ -10218,7 +10592,36 @@ function createCaseMethods(caseData, service) {
10218
10592
  throw new Error('Process key is undefined');
10219
10593
  if (!caseData.packageId)
10220
10594
  throw new Error('Package ID is undefined');
10221
- return service.getElementStats(caseData.processKey, caseData.packageId, startTime, endTime, packageVersion);
10595
+ return service.getElementStats({
10596
+ processKey: caseData.processKey,
10597
+ packageId: caseData.packageId,
10598
+ packageVersion,
10599
+ startTime,
10600
+ endTime,
10601
+ });
10602
+ },
10603
+ getInstanceStats(startTime, endTime, packageVersion) {
10604
+ if (!caseData.processKey)
10605
+ throw new Error('Process key is undefined');
10606
+ if (!caseData.packageId)
10607
+ throw new Error('Package ID is undefined');
10608
+ return service.getInstanceStats({
10609
+ processKey: caseData.processKey,
10610
+ packageId: caseData.packageId,
10611
+ packageVersion,
10612
+ startTime,
10613
+ endTime,
10614
+ });
10615
+ },
10616
+ getInstanceStatusTimeline(startTime, endTime, options) {
10617
+ if (!caseData.processKey)
10618
+ throw new Error('Process key is undefined');
10619
+ return service.getInstanceStatusTimeline(startTime, endTime, { ...options, processKeys: [caseData.processKey] });
10620
+ },
10621
+ getIncidentsTimeline(startTime, endTime, options) {
10622
+ if (!caseData.processKey)
10623
+ throw new Error('Process key is undefined');
10624
+ return service.getIncidentsTimeline(startTime, endTime, { ...options, processKeys: [caseData.processKey] });
10222
10625
  }
10223
10626
  };
10224
10627
  }
@@ -10387,54 +10790,244 @@ function createCaseInstanceMethods(instanceData, service) {
10387
10790
  throw new Error('Case instance ID is undefined');
10388
10791
  return service.getStagesSlaSummary({ caseInstanceId: instanceData.instanceId });
10389
10792
  }
10390
- };
10391
- }
10392
- /**
10393
- * Creates an actionable case instance by combining API case instance data with operational methods.
10394
- *
10395
- * @param instanceData - The case instance data from API
10396
- * @param service - The case instance service instance
10397
- * @returns A case instance object with added methods
10398
- */
10399
- function createCaseInstanceWithMethods(instanceData, service) {
10400
- const methods = createCaseInstanceMethods(instanceData, service);
10401
- return Object.assign({}, instanceData, methods);
10793
+ };
10794
+ }
10795
+ /**
10796
+ * Creates an actionable case instance by combining API case instance data with operational methods.
10797
+ *
10798
+ * @param instanceData - The case instance data from API
10799
+ * @param service - The case instance service instance
10800
+ * @returns A case instance object with added methods
10801
+ */
10802
+ function createCaseInstanceWithMethods(instanceData, service) {
10803
+ const methods = createCaseInstanceMethods(instanceData, service);
10804
+ return Object.assign({}, instanceData, methods);
10805
+ }
10806
+
10807
+ /**
10808
+ * Insights Types
10809
+ * Shared types for Maestro insights analytics endpoints
10810
+ */
10811
+ /**
10812
+ * Time bucketing granularity for insights time-series queries.
10813
+ *
10814
+ * Controls how data points are grouped on the time axis.
10815
+ */
10816
+ var TimeInterval;
10817
+ (function (TimeInterval) {
10818
+ /** Group data points by hour */
10819
+ TimeInterval["Hour"] = "HOUR";
10820
+ /** Group data points by day */
10821
+ TimeInterval["Day"] = "DAY";
10822
+ /** Group data points by week */
10823
+ TimeInterval["Week"] = "WEEK";
10824
+ })(TimeInterval || (TimeInterval = {}));
10825
+ /**
10826
+ * Final instance statuses returned by the instance status timeline endpoint.
10827
+ *
10828
+ * Only includes statuses where the instance has finished execution — Completed, Faulted, or Cancelled.
10829
+ * Active statuses like Running or Paused are not included.
10830
+ */
10831
+ var InstanceFinalStatus;
10832
+ (function (InstanceFinalStatus) {
10833
+ /** Instance completed successfully */
10834
+ InstanceFinalStatus["Completed"] = "Completed";
10835
+ /** Instance encountered an error */
10836
+ InstanceFinalStatus["Faulted"] = "Faulted";
10837
+ /** Instance was cancelled */
10838
+ InstanceFinalStatus["Cancelled"] = "Cancelled";
10839
+ })(InstanceFinalStatus || (InstanceFinalStatus = {}));
10840
+
10841
+ /**
10842
+ * Builds the request body for Insights RTM "top" endpoints.
10843
+ *
10844
+ * @param startTime - Start of the time range to query
10845
+ * @param endTime - End of the time range to query
10846
+ * @param isCaseManagement - Whether to filter for case management processes
10847
+ * @param options - Optional filters (packageId, processKey, version)
10848
+ * @returns Request body for the Insights RTM endpoint
10849
+ * @internal
10850
+ */
10851
+ function buildInsightsTopBody(startTime, endTime, isCaseManagement, options) {
10852
+ return {
10853
+ commonParams: {
10854
+ startTime: startTime.getTime(),
10855
+ endTime: endTime.getTime(),
10856
+ isCaseManagement,
10857
+ ...(options?.packageId ? { packageId: options.packageId } : {}),
10858
+ ...(options?.processKey ? { processKey: options.processKey } : {}),
10859
+ ...(options?.version ? { version: options.version } : {}),
10860
+ }
10861
+ };
10862
+ }
10863
+ /**
10864
+ * Builds the request body for Insights RTM timeline endpoints
10865
+ * (`InstanceStatusByDate`, `IncidentsByTimeWindow`).
10866
+ *
10867
+ * @param startTime - Start of the time range to query
10868
+ * @param endTime - End of the time range to query
10869
+ * @param isCaseManagement - Whether to filter for case management processes
10870
+ * @param options - Optional time bucketing and filtering settings
10871
+ * @returns Request body for the Insights RTM timeline endpoint
10872
+ * @internal
10873
+ */
10874
+ function buildInsightsTimelineBody(startTime, endTime, isCaseManagement, options) {
10875
+ return {
10876
+ commonParams: {
10877
+ startTime: startTime.getTime(),
10878
+ endTime: endTime.getTime(),
10879
+ isCaseManagement,
10880
+ ...(options?.packageId ? { packageId: options.packageId } : {}),
10881
+ ...(options?.version ? { version: options.version } : {}),
10882
+ ...(options?.processKeys ? { processKeys: options.processKeys } : {}),
10883
+ },
10884
+ timeSliceUnit: options?.groupBy ?? TimeInterval.Day,
10885
+ timezoneOffset: new Date().getTimezoneOffset() * -1,
10886
+ };
10887
+ }
10888
+ /**
10889
+ * Builds the commonParams request body for Insights RTM endpoints
10890
+ * that filter by process key, package, time range, and version.
10891
+ *
10892
+ * @param request - Process scope + time range to aggregate over
10893
+ * @returns Request body with commonParams
10894
+ * @internal
10895
+ */
10896
+ function buildInsightsCommonBody(request) {
10897
+ return {
10898
+ commonParams: {
10899
+ processKey: request.processKey,
10900
+ packageId: request.packageId,
10901
+ startTime: request.startTime.getTime(),
10902
+ endTime: request.endTime.getTime(),
10903
+ version: request.packageVersion
10904
+ }
10905
+ };
10906
+ }
10907
+
10908
+ /**
10909
+ * Maps fields for Incident entities
10910
+ */
10911
+ const ProcessIncidentMap = {
10912
+ errorTimeUtc: 'errorTime'
10913
+ };
10914
+ /**
10915
+ * Maps fields for Incident Summary entities
10916
+ */
10917
+ const ProcessIncidentSummaryMap = {
10918
+ firstTimeUtc: 'firstOccuranceTime'
10919
+ };
10920
+
10921
+ /**
10922
+ * Helpers for fetching BPMN XML and extracting element details used to annotate responses
10923
+ */
10924
+ class BpmnHelpers {
10925
+ /**
10926
+ * Parse BPMN XML and extract element id → {name,type} used for incidents
10927
+ */
10928
+ static parseBpmnElementsForIncidents(bpmnXml) {
10929
+ const elementInfo = {};
10930
+ try {
10931
+ // Find <bpmn:...> start tags and capture the element type.
10932
+ // Then read 'id' and 'name' attributes from each tag.
10933
+ const bpmnOpenTagRegex = /<bpmn:([A-Za-z][\w.-]*)\b[^>]*>/g;
10934
+ for (const tagMatch of bpmnXml.matchAll(bpmnOpenTagRegex)) {
10935
+ const [fullTag, elementType] = tagMatch;
10936
+ // Extract attributes from the current tag text.
10937
+ const idMatch = /\bid\s*=\s*"([^"]*)"/.exec(fullTag);
10938
+ if (!idMatch) {
10939
+ continue;
10940
+ }
10941
+ const elementId = idMatch[1];
10942
+ const nameMatch = /\bname\s*=\s*"([^"]*)"/.exec(fullTag);
10943
+ const name = nameMatch ? nameMatch[1] : '';
10944
+ // Convert BPMN element type to human-readable format
10945
+ const activityType = this.formatActivityTypeForIncidents(elementType);
10946
+ const activityName = name || elementId;
10947
+ elementInfo[elementId] = {
10948
+ type: activityType,
10949
+ name: activityName
10950
+ };
10951
+ }
10952
+ }
10953
+ catch (error) {
10954
+ console.warn('Failed to parse BPMN XML for incidents:', error);
10955
+ }
10956
+ return elementInfo;
10957
+ }
10958
+ /**
10959
+ * Format BPMN element type to human-readable activity type for incidents
10960
+ */
10961
+ static formatActivityTypeForIncidents(elementType) {
10962
+ // Convert camelCase BPMN element types to human-readable format
10963
+ // e.g., "serviceTask" -> "Service Task", "exclusiveGateway" -> "Exclusive Gateway"
10964
+ return elementType
10965
+ .replace(/([A-Z])/g, ' $1') // Add space before uppercase letters
10966
+ .replace(/^./, str => str.toUpperCase()) // Capitalize first letter
10967
+ .trim(); // Remove any leading/trailing spaces
10968
+ }
10969
+ /**
10970
+ * Fetch BPMN via getBpmn and add element name/type to each incident
10971
+ */
10972
+ static async enrichIncidentsWithBpmnData(incidents, folderKey, service) {
10973
+ // Check if all incidents have the same instanceId
10974
+ const uniqueInstanceIds = [...new Set(incidents.map(i => i.instanceId))];
10975
+ if (uniqueInstanceIds.length === 1) {
10976
+ // Single instance optimization (in case of process instance incidents)
10977
+ const elementInfo = await this.getBpmnElementInfo(uniqueInstanceIds[0], folderKey, service);
10978
+ return incidents.map((incident) => this.transformIncidentWithBpmn(incident, elementInfo));
10979
+ }
10980
+ else {
10981
+ // Multiple instances optimization (in case of process incidents)
10982
+ return this.enrichMultipleInstanceIncidents(incidents, folderKey, service);
10983
+ }
10984
+ }
10985
+ /**
10986
+ * When incidents span multiple instances, fetch BPMN per instance and annotate
10987
+ */
10988
+ static async enrichMultipleInstanceIncidents(incidents, folderKey, service) {
10989
+ const groups = incidents.reduce((acc, incident) => {
10990
+ const id = incident.instanceId || NO_INSTANCE;
10991
+ (acc[id] = acc[id] || []).push(incident);
10992
+ return acc;
10993
+ }, {});
10994
+ const results = await Promise.all(Object.entries(groups).map(async (entry) => {
10995
+ const [instanceId, groupIncidents] = entry;
10996
+ const elementInfo = await this.getBpmnElementInfo(instanceId, folderKey, service);
10997
+ return groupIncidents.map((incident) => this.transformIncidentWithBpmn(incident, elementInfo));
10998
+ }));
10999
+ return results.flat();
11000
+ }
11001
+ /**
11002
+ * Retrieve BPMN XML for an instance and derive element id → {name,type}
11003
+ */
11004
+ static async getBpmnElementInfo(instanceId, folderKey, service) {
11005
+ if (!instanceId || instanceId === NO_INSTANCE) {
11006
+ return {};
11007
+ }
11008
+ try {
11009
+ const bpmnXml = await service.getBpmn(instanceId, folderKey);
11010
+ return this.parseBpmnElementsForIncidents(bpmnXml);
11011
+ }
11012
+ catch (error) {
11013
+ console.warn(`Failed to get BPMN for instance ${instanceId}:`, error);
11014
+ return {};
11015
+ }
11016
+ }
11017
+ /**
11018
+ * Transform a raw incident by attaching element name/type from BPMN
11019
+ */
11020
+ static transformIncidentWithBpmn(incident, elementInfo) {
11021
+ const element = elementInfo[incident.elementId];
11022
+ const transformed = transformData(incident, ProcessIncidentMap);
11023
+ return {
11024
+ ...transformed,
11025
+ incidentElementActivityType: element?.type || UNKNOWN,
11026
+ incidentElementActivityName: element?.name || UNKNOWN
11027
+ };
11028
+ }
10402
11029
  }
10403
11030
 
10404
- /**
10405
- * Insights Types
10406
- * Shared types for Maestro insights analytics endpoints
10407
- */
10408
- /**
10409
- * Time bucketing granularity for insights time-series queries.
10410
- *
10411
- * Controls how data points are grouped on the time axis.
10412
- */
10413
- var TimeInterval;
10414
- (function (TimeInterval) {
10415
- /** Group data points by hour */
10416
- TimeInterval["Hour"] = "HOUR";
10417
- /** Group data points by day */
10418
- TimeInterval["Day"] = "DAY";
10419
- /** Group data points by week */
10420
- TimeInterval["Week"] = "WEEK";
10421
- })(TimeInterval || (TimeInterval = {}));
10422
- /**
10423
- * Final instance statuses returned by the instance status timeline endpoint.
10424
- *
10425
- * Only includes statuses where the instance has finished execution — Completed, Faulted, or Cancelled.
10426
- * Active statuses like Running or Paused are not included.
10427
- */
10428
- var InstanceFinalStatus;
10429
- (function (InstanceFinalStatus) {
10430
- /** Instance completed successfully */
10431
- InstanceFinalStatus["Completed"] = "Completed";
10432
- /** Instance encountered an error */
10433
- InstanceFinalStatus["Faulted"] = "Faulted";
10434
- /** Instance was cancelled */
10435
- InstanceFinalStatus["Cancelled"] = "Cancelled";
10436
- })(InstanceFinalStatus || (InstanceFinalStatus = {}));
10437
-
10438
11031
  /**
10439
11032
  * Maps fields for Process Instance entities to ensure consistent naming
10440
11033
  */
@@ -10510,7 +11103,7 @@ class ProcessInstancesService extends BaseService {
10510
11103
  }, options);
10511
11104
  }
10512
11105
  /**
10513
- * Get a process instance by ID with operation methods (cancel, pause, resume)
11106
+ * Get a process instance by ID with operation methods (cancel, pause, resume, retry)
10514
11107
  * @param id The ID of the instance to retrieve
10515
11108
  * @param folderKey The folder key for authorization
10516
11109
  * @returns Promise<ProcessInstanceGetResponse>
@@ -10649,6 +11242,25 @@ class ProcessInstancesService extends BaseService {
10649
11242
  data: response.data
10650
11243
  };
10651
11244
  }
11245
+ /**
11246
+ * Retry a faulted process instance
11247
+ *
11248
+ * Re-runs the failed elements of the instance (and the elements that follow) within
11249
+ * the same instance, spawning new jobs. Use to recover from transient/flaky failures.
11250
+ * @param instanceId The ID of the instance to retry
11251
+ * @param folderKey The folder key for authorization
11252
+ * @param options Optional retry options with comment
11253
+ * @returns Promise resolving to operation result with updated instance data
11254
+ */
11255
+ async retry(instanceId, folderKey, options) {
11256
+ const response = await this.post(MAESTRO_ENDPOINTS.INSTANCES.RETRY(instanceId), options || {}, {
11257
+ headers: createHeaders({ [FOLDER_KEY]: folderKey })
11258
+ });
11259
+ return {
11260
+ success: true,
11261
+ data: response.data
11262
+ };
11263
+ }
10652
11264
  /**
10653
11265
  * Parses BPMN XML to extract variable metadata from uipath:inputOutput elements
10654
11266
  * @private
@@ -10799,6 +11411,9 @@ __decorate([
10799
11411
  __decorate([
10800
11412
  track('ProcessInstances.Resume')
10801
11413
  ], ProcessInstancesService.prototype, "resume", null);
11414
+ __decorate([
11415
+ track('ProcessInstances.Retry')
11416
+ ], ProcessInstancesService.prototype, "retry", null);
10802
11417
  __decorate([
10803
11418
  track('ProcessInstances.GetVariables')
10804
11419
  ], ProcessInstancesService.prototype, "getVariables", null);
@@ -10955,7 +11570,7 @@ class MaestroProcessesService extends BaseService {
10955
11570
  *
10956
11571
  * @param startTime - Start of the time range to query
10957
11572
  * @param endTime - End of the time range to query
10958
- * @param options - Optional settings for time bucketing granularity
11573
+ * @param options - Optional settings for filtering and time bucket granularity
10959
11574
  * @returns Promise resolving to an array of {@link InstanceStatusTimelineResponse}
10960
11575
  *
10961
11576
  * @example
@@ -10982,12 +11597,67 @@ class MaestroProcessesService extends BaseService {
10982
11597
  *
10983
11598
  * @example
10984
11599
  * ```typescript
11600
+ * // Filter to a specific process
11601
+ * const filtered = await maestroProcesses.getInstanceStatusTimeline(startTime, endTime, {
11602
+ * processKeys: ['<processKey>'],
11603
+ * });
11604
+ * ```
11605
+ *
11606
+ * @example
11607
+ * ```typescript
10985
11608
  * // Get all-time data (from Unix epoch to now)
10986
11609
  * const allTime = await maestroProcesses.getInstanceStatusTimeline(new Date(0), new Date());
10987
11610
  * ```
10988
11611
  */
10989
11612
  async getInstanceStatusTimeline(startTime, endTime, options) {
10990
- return fetchInstanceStatusTimeline(this.post.bind(this), startTime, endTime, false, options);
11613
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.INSTANCE_STATUS_BY_DATE, buildInsightsTimelineBody(startTime, endTime, false, options));
11614
+ return data ?? [];
11615
+ }
11616
+ /**
11617
+ * Get incident counts aggregated by time bucket for maestro processes.
11618
+ *
11619
+ * Returns time-grouped counts of incidents that occurred within each bucket,
11620
+ * useful for rendering incident time-series charts. Use `groupBy` to control
11621
+ * the time bucket size (hour, day, or week) — defaults to day if not provided.
11622
+ *
11623
+ * @param startTime - Start of the time range to query
11624
+ * @param endTime - End of the time range to query
11625
+ * @param options - Optional settings for filtering and time bucket granularity
11626
+ * @returns Promise resolving to an array of {@link IncidentTimelineResponse}
11627
+ *
11628
+ * @example
11629
+ * ```typescript
11630
+ * // Get daily incident counts for the last 7 days
11631
+ * const now = new Date();
11632
+ * const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
11633
+ * const incidents = await maestroProcesses.getIncidentsTimeline(sevenDaysAgo, now);
11634
+ *
11635
+ * for (const incident of incidents) {
11636
+ * console.log(`${incident.startTime} → ${incident.endTime}: ${incident.count} incidents`);
11637
+ * }
11638
+ * ```
11639
+ *
11640
+ * @example
11641
+ * ```typescript
11642
+ * import { TimeInterval } from '@uipath/uipath-typescript/maestro-processes';
11643
+ *
11644
+ * // Get weekly breakdown
11645
+ * const incidents = await maestroProcesses.getIncidentsTimeline(startTime, endTime, {
11646
+ * groupBy: TimeInterval.Week,
11647
+ * });
11648
+ * ```
11649
+ *
11650
+ * @example
11651
+ * ```typescript
11652
+ * // Filter to a specific process
11653
+ * const filtered = await maestroProcesses.getIncidentsTimeline(startTime, endTime, {
11654
+ * processKeys: ['<processKey>'],
11655
+ * });
11656
+ * ```
11657
+ */
11658
+ async getIncidentsTimeline(startTime, endTime, options) {
11659
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.INCIDENTS_BY_TIME_WINDOW, buildInsightsTimelineBody(startTime, endTime, false, options));
11660
+ return data?.dataPoints ?? [];
10991
11661
  }
10992
11662
  /**
10993
11663
  * Get the top 10 processes ranked by failure count within a time range.
@@ -11082,22 +11752,22 @@ class MaestroProcessesService extends BaseService {
11082
11752
  * Returns per-element execution counts (success, fail, terminated, paused, in-progress) and
11083
11753
  * duration percentile metrics (min, max, avg, p50, p95, p99) for BPMN elements within a process.
11084
11754
  *
11085
- * @param processKey - Process key to filter by
11086
- * @param packageId - Package identifier
11087
- * @param startTime - Start of the time range to query
11088
- * @param endTime - End of the time range to query
11089
- * @param packageVersion - Package version to filter by
11755
+ * @param request - Process scope + time range to aggregate over
11090
11756
  * @returns Promise resolving to an array of {@link ElementStats}
11091
11757
  * @example
11092
11758
  * ```typescript
11093
- * // Get element metrics for a process
11094
- * const elements = await maestroProcesses.getElementStats(
11095
- * '<processKey>',
11096
- * '<packageId>',
11097
- * new Date('2026-04-01'),
11098
- * new Date(),
11099
- * '1.0.1'
11100
- * );
11759
+ * // First, list processes to find the processKey, packageId, and available versions
11760
+ * const processes = await maestroProcesses.getAll();
11761
+ * const process = processes[0];
11762
+ *
11763
+ * // Get element metrics for that process
11764
+ * const elements = await maestroProcesses.getElementStats({
11765
+ * processKey: process.processKey,
11766
+ * packageId: process.packageId,
11767
+ * packageVersion: process.packageVersions[0],
11768
+ * startTime: new Date('2026-04-01'),
11769
+ * endTime: new Date(),
11770
+ * });
11101
11771
  *
11102
11772
  * // Analyze element performance
11103
11773
  * for (const element of elements) {
@@ -11105,12 +11775,58 @@ class MaestroProcessesService extends BaseService {
11105
11775
  * console.log(` Success: ${element.successCount}, Failed: ${element.failCount}`);
11106
11776
  * console.log(` Avg duration: ${element.avgDurationMs}ms, P95: ${element.p95DurationMs}ms`);
11107
11777
  * }
11778
+ *
11779
+ * // Using bound method on a process — auto-fills processKey and packageId
11780
+ * const boundElements = await process.getElementStats(
11781
+ * new Date('2026-04-01'),
11782
+ * new Date(),
11783
+ * process.packageVersions[0]
11784
+ * );
11108
11785
  * ```
11109
11786
  */
11110
- async getElementStats(processKey, packageId, startTime, endTime, packageVersion) {
11111
- const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.ELEMENT_COUNT_BY_STATUS, buildElementCountByStatusBody(processKey, packageId, startTime, endTime, packageVersion));
11787
+ async getElementStats(request) {
11788
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.ELEMENT_COUNT_BY_STATUS, buildInsightsCommonBody(request));
11112
11789
  return data ?? [];
11113
11790
  }
11791
+ /**
11792
+ * Get instance stats for a process.
11793
+ *
11794
+ * Returns total instance counts broken down by status (running, completed, faulted, etc.)
11795
+ * and the average execution duration for all instances of a process within a time range.
11796
+ *
11797
+ * @param request - Process scope + time range to aggregate over
11798
+ * @returns Promise resolving to {@link InstanceStats}
11799
+ * @example
11800
+ * ```typescript
11801
+ * // First, list processes to find the processKey, packageId, and available versions
11802
+ * const processes = await maestroProcesses.getAll();
11803
+ * const process = processes[0];
11804
+ *
11805
+ * // Get instance status breakdown for that process
11806
+ * const counts = await maestroProcesses.getInstanceStats({
11807
+ * processKey: process.processKey,
11808
+ * packageId: process.packageId,
11809
+ * packageVersion: process.packageVersions[0],
11810
+ * startTime: new Date('2026-04-01'),
11811
+ * endTime: new Date(),
11812
+ * });
11813
+ *
11814
+ * console.log(`Total: ${counts.totalCount}`);
11815
+ * console.log(`Running: ${counts.runningCount}, Completed: ${counts.completedCount}`);
11816
+ * console.log(`Faulted: ${counts.faultedCount}, Avg duration: ${counts.avgDurationMs}ms`);
11817
+ *
11818
+ * // Using bound method on a process — auto-fills processKey and packageId
11819
+ * const boundCounts = await process.getInstanceStats(
11820
+ * new Date('2026-04-01'),
11821
+ * new Date(),
11822
+ * process.packageVersions[0]
11823
+ * );
11824
+ * ```
11825
+ */
11826
+ async getInstanceStats(request) {
11827
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.INSTANCE_COUNT_BY_STATUS, buildInsightsCommonBody(request));
11828
+ return transformData(data, InstanceStatsMap);
11829
+ }
11114
11830
  }
11115
11831
  __decorate([
11116
11832
  track('MaestroProcesses.GetAll')
@@ -11127,6 +11843,9 @@ __decorate([
11127
11843
  __decorate([
11128
11844
  track('MaestroProcesses.GetInstanceStatusTimeline')
11129
11845
  ], MaestroProcessesService.prototype, "getInstanceStatusTimeline", null);
11846
+ __decorate([
11847
+ track('MaestroProcesses.GetIncidentsTimeline')
11848
+ ], MaestroProcessesService.prototype, "getIncidentsTimeline", null);
11130
11849
  __decorate([
11131
11850
  track('MaestroProcesses.GetTopFaultedCount')
11132
11851
  ], MaestroProcessesService.prototype, "getTopFaultedCount", null);
@@ -11136,6 +11855,9 @@ __decorate([
11136
11855
  __decorate([
11137
11856
  track('MaestroProcesses.GetElementStats')
11138
11857
  ], MaestroProcessesService.prototype, "getElementStats", null);
11858
+ __decorate([
11859
+ track('MaestroProcesses.GetInstanceStats')
11860
+ ], MaestroProcessesService.prototype, "getInstanceStats", null);
11139
11861
 
11140
11862
  /**
11141
11863
  * Service class for Maestro Process Incidents
@@ -11316,7 +12038,7 @@ class CasesService extends BaseService {
11316
12038
  *
11317
12039
  * @param startTime - Start of the time range to query
11318
12040
  * @param endTime - End of the time range to query
11319
- * @param options - Optional settings for time bucketing granularity
12041
+ * @param options - Optional settings for filtering and time bucket granularity
11320
12042
  * @returns Promise resolving to an array of {@link InstanceStatusTimelineResponse}
11321
12043
  *
11322
12044
  * @example
@@ -11343,12 +12065,67 @@ class CasesService extends BaseService {
11343
12065
  *
11344
12066
  * @example
11345
12067
  * ```typescript
12068
+ * // Filter to a specific case process
12069
+ * const filtered = await cases.getInstanceStatusTimeline(startTime, endTime, {
12070
+ * processKeys: ['<processKey>'],
12071
+ * });
12072
+ * ```
12073
+ *
12074
+ * @example
12075
+ * ```typescript
11346
12076
  * // Get all-time data (from Unix epoch to now)
11347
12077
  * const allTime = await cases.getInstanceStatusTimeline(new Date(0), new Date());
11348
12078
  * ```
11349
12079
  */
11350
12080
  async getInstanceStatusTimeline(startTime, endTime, options) {
11351
- return fetchInstanceStatusTimeline(this.post.bind(this), startTime, endTime, true, options);
12081
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.INSTANCE_STATUS_BY_DATE, buildInsightsTimelineBody(startTime, endTime, true, options));
12082
+ return data ?? [];
12083
+ }
12084
+ /**
12085
+ * Get incident counts aggregated by time bucket for case management processes.
12086
+ *
12087
+ * Returns time-grouped counts of incidents that occurred within each bucket,
12088
+ * useful for rendering incident time-series charts. Use `groupBy` to control
12089
+ * the time bucket size (hour, day, or week) — defaults to day if not provided.
12090
+ *
12091
+ * @param startTime - Start of the time range to query
12092
+ * @param endTime - End of the time range to query
12093
+ * @param options - Optional settings for filtering and time bucket granularity
12094
+ * @returns Promise resolving to an array of {@link IncidentTimelineResponse}
12095
+ *
12096
+ * @example
12097
+ * ```typescript
12098
+ * // Get daily incident counts for the last 7 days
12099
+ * const now = new Date();
12100
+ * const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
12101
+ * const incidents = await cases.getIncidentsTimeline(sevenDaysAgo, now);
12102
+ *
12103
+ * for (const incident of incidents) {
12104
+ * console.log(`${incident.startTime} → ${incident.endTime}: ${incident.count} incidents`);
12105
+ * }
12106
+ * ```
12107
+ *
12108
+ * @example
12109
+ * ```typescript
12110
+ * import { TimeInterval } from '@uipath/uipath-typescript/cases';
12111
+ *
12112
+ * // Get weekly breakdown
12113
+ * const incidents = await cases.getIncidentsTimeline(startTime, endTime, {
12114
+ * groupBy: TimeInterval.Week,
12115
+ * });
12116
+ * ```
12117
+ *
12118
+ * @example
12119
+ * ```typescript
12120
+ * // Filter to a specific case process
12121
+ * const filtered = await cases.getIncidentsTimeline(startTime, endTime, {
12122
+ * processKeys: ['<processKey>'],
12123
+ * });
12124
+ * ```
12125
+ */
12126
+ async getIncidentsTimeline(startTime, endTime, options) {
12127
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.INCIDENTS_BY_TIME_WINDOW, buildInsightsTimelineBody(startTime, endTime, true, options));
12128
+ return data?.dataPoints ?? [];
11352
12129
  }
11353
12130
  /**
11354
12131
  * Get the top 10 case processes ranked by failure count within a time range.
@@ -11443,34 +12220,79 @@ class CasesService extends BaseService {
11443
12220
  * Returns per-element execution counts (success, fail, terminated, paused, in-progress) and
11444
12221
  * duration percentile metrics (min, max, avg, p50, p95, p99) for BPMN elements within a case.
11445
12222
  *
11446
- * @param processKey - Process key to filter by
11447
- * @param packageId - Package identifier
11448
- * @param startTime - Start of the time range to query
11449
- * @param endTime - End of the time range to query
11450
- * @param packageVersion - Package version to filter by
12223
+ * @param request - Process scope + time range to aggregate over
11451
12224
  * @returns Promise resolving to an array of {@link ElementStats}
11452
12225
  * @example
11453
12226
  * ```typescript
11454
- * // Get element metrics for a case
11455
- * const elements = await cases.getElementStats(
11456
- * '<processKey>',
11457
- * '<packageId>',
11458
- * new Date('2026-04-01'),
11459
- * new Date(),
11460
- * '1.0.1'
11461
- * );
12227
+ * // First, list cases to find the processKey, packageId, and available versions
12228
+ * const allCases = await cases.getAll();
12229
+ * const caseItem = allCases[0];
12230
+ *
12231
+ * // Get element metrics for that case
12232
+ * const elements = await cases.getElementStats({
12233
+ * processKey: caseItem.processKey,
12234
+ * packageId: caseItem.packageId,
12235
+ * packageVersion: caseItem.packageVersions[0],
12236
+ * startTime: new Date('2026-04-01'),
12237
+ * endTime: new Date(),
12238
+ * });
11462
12239
  *
11463
12240
  * // Find elements with failures
11464
12241
  * const failedElements = elements.filter(e => e.failCount > 0);
11465
12242
  * for (const element of failedElements) {
11466
12243
  * console.log(`Failed element: ${element.elementId}, failures: ${element.failCount}`);
11467
12244
  * }
12245
+ *
12246
+ * // Using bound method on a case — auto-fills processKey and packageId
12247
+ * const boundElements = await caseItem.getElementStats(
12248
+ * new Date('2026-04-01'),
12249
+ * new Date(),
12250
+ * caseItem.packageVersions[0]
12251
+ * );
11468
12252
  * ```
11469
12253
  */
11470
- async getElementStats(processKey, packageId, startTime, endTime, packageVersion) {
11471
- const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.ELEMENT_COUNT_BY_STATUS, buildElementCountByStatusBody(processKey, packageId, startTime, endTime, packageVersion));
12254
+ async getElementStats(request) {
12255
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.ELEMENT_COUNT_BY_STATUS, buildInsightsCommonBody(request));
11472
12256
  return data ?? [];
11473
12257
  }
12258
+ /**
12259
+ * Get instance stats for a case.
12260
+ *
12261
+ * Returns total instance counts broken down by status (running, completed, faulted, etc.)
12262
+ * and the average execution duration for all instances of a case within a time range.
12263
+ *
12264
+ * @param request - Process scope + time range to aggregate over
12265
+ * @returns Promise resolving to {@link InstanceStats}
12266
+ * @example
12267
+ * ```typescript
12268
+ * // First, list cases to find the processKey, packageId, and available versions
12269
+ * const allCases = await cases.getAll();
12270
+ * const caseItem = allCases[0];
12271
+ *
12272
+ * // Get instance status breakdown for that case
12273
+ * const counts = await cases.getInstanceStats({
12274
+ * processKey: caseItem.processKey,
12275
+ * packageId: caseItem.packageId,
12276
+ * packageVersion: caseItem.packageVersions[0],
12277
+ * startTime: new Date('2026-04-01'),
12278
+ * endTime: new Date(),
12279
+ * });
12280
+ *
12281
+ * console.log(`Total: ${counts.totalCount}`);
12282
+ * console.log(`Completed: ${counts.completedCount}, Faulted: ${counts.faultedCount}`);
12283
+ *
12284
+ * // Using bound method on a case — auto-fills processKey and packageId
12285
+ * const boundCounts = await caseItem.getInstanceStats(
12286
+ * new Date('2026-04-01'),
12287
+ * new Date(),
12288
+ * caseItem.packageVersions[0]
12289
+ * );
12290
+ * ```
12291
+ */
12292
+ async getInstanceStats(request) {
12293
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.INSTANCE_COUNT_BY_STATUS, buildInsightsCommonBody(request));
12294
+ return transformData(data, InstanceStatsMap);
12295
+ }
11474
12296
  /**
11475
12297
  * Extract a readable case name from the packageId
11476
12298
  * @param packageId - The full package identifier
@@ -11502,6 +12324,9 @@ __decorate([
11502
12324
  __decorate([
11503
12325
  track('Cases.GetInstanceStatusTimeline')
11504
12326
  ], CasesService.prototype, "getInstanceStatusTimeline", null);
12327
+ __decorate([
12328
+ track('Cases.GetIncidentsTimeline')
12329
+ ], CasesService.prototype, "getIncidentsTimeline", null);
11505
12330
  __decorate([
11506
12331
  track('Cases.GetTopFaultedCount')
11507
12332
  ], CasesService.prototype, "getTopFaultedCount", null);
@@ -11511,6 +12336,9 @@ __decorate([
11511
12336
  __decorate([
11512
12337
  track('Cases.GetElementStats')
11513
12338
  ], CasesService.prototype, "getElementStats", null);
12339
+ __decorate([
12340
+ track('Cases.GetInstanceStats')
12341
+ ], CasesService.prototype, "getInstanceStats", null);
11514
12342
 
11515
12343
  /**
11516
12344
  * Maps fields for Case Instance entities to ensure consistent naming
@@ -11816,6 +12644,10 @@ class TaskService extends BaseService {
11816
12644
  const transformedTask = transformData(pascalToCamelCaseKeys(task), TaskMap);
11817
12645
  return createTaskWithMethods(applyDataTransforms(transformedTask, { field: 'status', valueMap: TaskStatusMap }), this);
11818
12646
  };
12647
+ // Rewrite renamed SDK field names → API names inside OData strings
12648
+ // before delegating, mirroring the transformRequest pattern used for
12649
+ // request bodies.
12650
+ const apiOptions = options ? transformOptions(options, TaskMap) : options;
11819
12651
  return PaginationHelpers.getAll({
11820
12652
  serviceAccess: this.createPaginationServiceAccess(),
11821
12653
  getEndpoint: () => endpoint,
@@ -11832,7 +12664,7 @@ class TaskService extends BaseService {
11832
12664
  countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM // OData OFFSET parameter
11833
12665
  }
11834
12666
  }
11835
- }, options);
12667
+ }, apiOptions);
11836
12668
  }
11837
12669
  /**
11838
12670
  * Gets a task by ID
@@ -11868,9 +12700,10 @@ class TaskService extends BaseService {
11868
12700
  const headers = createHeaders({ [FOLDER_ID]: folderId });
11869
12701
  // Add default expand parameters
11870
12702
  const modifiedOptions = this.addDefaultExpand(restOptions);
11871
- // prefix all keys in options
11872
- const keysToPrefix = Object.keys(modifiedOptions);
11873
- const apiOptions = addPrefixToKeys(modifiedOptions, ODATA_PREFIX, keysToPrefix);
12703
+ // Rewrite renamed SDK field names → API names inside OData strings,
12704
+ // then prefix all keys for OData.
12705
+ const apiFieldOptions = transformOptions(modifiedOptions, TaskMap);
12706
+ const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
11874
12707
  const response = await this.get(TASK_ENDPOINTS.GET_BY_ID(id), {
11875
12708
  params: apiOptions,
11876
12709
  headers
@@ -12863,9 +13696,12 @@ class FolderScopedService extends BaseService {
12863
13696
  * @param name - Resource name to search for
12864
13697
  * @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) + OData query options (`expand`, `select`)
12865
13698
  * @param transform - Maps a raw OData item to the typed response (e.g. PascalCase → camelCase via field map)
13699
+ * @param responseFieldMap - Optional response field map (API → SDK), reversed internally by
13700
+ * `transformOptions` to rewrite SDK field names back to API names in user-supplied
13701
+ * `expand` / `select` (symmetric counterpart to `transform`)
12866
13702
  * @throws ValidationError when inputs are malformed; NotFoundError when no match
12867
13703
  */
12868
- async getByNameLookup(resourceType, endpoint, name, options, transform) {
13704
+ async getByNameLookup(resourceType, endpoint, name, options, transform, responseFieldMap) {
12869
13705
  const validatedName = validateName(resourceType, name);
12870
13706
  const { folderId, folderKey, folderPath, ...queryOptions } = options;
12871
13707
  const headers = resolveFolderHeaders({
@@ -12875,8 +13711,11 @@ class FolderScopedService extends BaseService {
12875
13711
  resourceType: `${resourceType}.getByName`,
12876
13712
  fallbackFolderKey: this.config.folderKey,
12877
13713
  });
13714
+ const apiFieldOptions = responseFieldMap
13715
+ ? transformOptions(queryOptions, responseFieldMap)
13716
+ : queryOptions;
12878
13717
  const apiOptions = {
12879
- ...addPrefixToKeys(queryOptions, ODATA_PREFIX, Object.keys(queryOptions)),
13718
+ ...addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions)),
12880
13719
  '$filter': `Name eq '${validatedName.replace(SINGLE_QUOTE_RE, "''")}'`,
12881
13720
  '$top': '1',
12882
13721
  };
@@ -12976,6 +13815,10 @@ class AssetService extends FolderScopedService {
12976
13815
  async getAll(options) {
12977
13816
  // Transformation function for assets
12978
13817
  const transformAssetResponse = (asset) => transformData(pascalToCamelCaseKeys(asset), AssetMap);
13818
+ // Rewrite renamed SDK field names → API names inside OData strings
13819
+ // before delegating, mirroring the transformRequest pattern used for
13820
+ // request bodies.
13821
+ const apiOptions = options ? transformOptions(options, AssetMap) : options;
12979
13822
  return PaginationHelpers.getAll({
12980
13823
  serviceAccess: this.createPaginationServiceAccess(),
12981
13824
  getEndpoint: (folderId) => folderId ? ASSET_ENDPOINTS.GET_BY_FOLDER : ASSET_ENDPOINTS.GET_ALL,
@@ -12991,7 +13834,7 @@ class AssetService extends FolderScopedService {
12991
13834
  countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM
12992
13835
  }
12993
13836
  }
12994
- }, options);
13837
+ }, apiOptions);
12995
13838
  }
12996
13839
  /**
12997
13840
  * Gets a single asset by ID
@@ -13013,8 +13856,8 @@ class AssetService extends FolderScopedService {
13013
13856
  */
13014
13857
  async getById(id, folderId, options = {}) {
13015
13858
  const headers = createHeaders({ [FOLDER_ID]: folderId });
13016
- const keysToPrefix = Object.keys(options);
13017
- const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
13859
+ const apiFieldOptions = transformOptions(options, AssetMap);
13860
+ const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
13018
13861
  const response = await this.get(ASSET_ENDPOINTS.GET_BY_ID(id), {
13019
13862
  headers,
13020
13863
  params: apiOptions
@@ -13049,7 +13892,7 @@ class AssetService extends FolderScopedService {
13049
13892
  * ```
13050
13893
  */
13051
13894
  async getByName(name, options = {}) {
13052
- return this.getByNameLookup('Asset', ASSET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap));
13895
+ return this.getByNameLookup('Asset', ASSET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap), AssetMap);
13053
13896
  }
13054
13897
  /**
13055
13898
  * Updates the value of an existing asset by ID.
@@ -13323,6 +14166,9 @@ class BucketService extends FolderScopedService {
13323
14166
  });
13324
14167
  // Transformation function for blob items
13325
14168
  const transformBlobItem = (item) => transformData(item, BucketMap);
14169
+ // Rewrite renamed SDK field names → API names inside OData strings
14170
+ // before delegating.
14171
+ const apiRestOptions = transformOptions(restOptions, BucketMap);
13326
14172
  return PaginationHelpers.getAll({
13327
14173
  serviceAccess: this.createPaginationServiceAccess(),
13328
14174
  getEndpoint: () => BUCKET_ENDPOINTS.GET_FILE_META_DATA(bucketId),
@@ -13338,7 +14184,7 @@ class BucketService extends FolderScopedService {
13338
14184
  },
13339
14185
  excludeFromPrefix: ['prefix'], // Bucket-specific param, not OData
13340
14186
  headers,
13341
- }, restOptions);
14187
+ }, apiRestOptions);
13342
14188
  }
13343
14189
  async uploadFile(bucketIdOrOptions, path, content, options) {
13344
14190
  // Normalize the two overload forms into a single internal shape.
@@ -13422,9 +14268,10 @@ class BucketService extends FolderScopedService {
13422
14268
  resourceType: 'Buckets.getReadUri',
13423
14269
  fallbackFolderKey: this.config.folderKey,
13424
14270
  });
14271
+ const apiRestOptions = transformOptions(restOptions, BucketMap);
13425
14272
  const queryOptions = {
13426
14273
  expiryInMinutes,
13427
- ...addPrefixToKeys(restOptions, ODATA_PREFIX, Object.keys(restOptions))
14274
+ ...addPrefixToKeys(apiRestOptions, ODATA_PREFIX, Object.keys(apiRestOptions))
13428
14275
  };
13429
14276
  return this._getUri(BUCKET_ENDPOINTS.GET_READ_URI(bucketId), bucketId, resolvedPath, headers, queryOptions);
13430
14277
  }
@@ -13544,6 +14391,9 @@ class BucketService extends FolderScopedService {
13544
14391
  fallbackFolderKey: this.config.folderKey,
13545
14392
  });
13546
14393
  const transformBucketFile = (file) => transformData(pascalToCamelCaseKeys(file), BucketMap);
14394
+ // Rewrite renamed SDK field names → API names inside OData strings
14395
+ // before delegating.
14396
+ const apiRestOptions = transformOptions(restOptions, BucketMap);
13547
14397
  return PaginationHelpers.getAll({
13548
14398
  serviceAccess: this.createPaginationServiceAccess(),
13549
14399
  getEndpoint: () => BUCKET_ENDPOINTS.GET_FILES(bucketId),
@@ -13560,7 +14410,7 @@ class BucketService extends FolderScopedService {
13560
14410
  },
13561
14411
  excludeFromPrefix: ['directory', 'recursive', 'fileNameRegex'],
13562
14412
  headers,
13563
- }, { ...restOptions, directory: '/', recursive: true });
14413
+ }, { ...apiRestOptions, directory: '/', recursive: true });
13564
14414
  }
13565
14415
  /**
13566
14416
  * Deletes a file from a bucket
@@ -13607,9 +14457,10 @@ class BucketService extends FolderScopedService {
13607
14457
  */
13608
14458
  async _getWriteUri(options) {
13609
14459
  const { bucketId, path, expiryInMinutes, headers, ...restOptions } = options;
14460
+ const apiRestOptions = transformOptions(restOptions, BucketMap);
13610
14461
  const queryOptions = {
13611
14462
  expiryInMinutes,
13612
- ...addPrefixToKeys(restOptions, ODATA_PREFIX, Object.keys(restOptions))
14463
+ ...addPrefixToKeys(apiRestOptions, ODATA_PREFIX, Object.keys(apiRestOptions))
13613
14464
  };
13614
14465
  return this._getUri(BUCKET_ENDPOINTS.GET_WRITE_URI(bucketId), bucketId, path, headers, queryOptions);
13615
14466
  }
@@ -13742,9 +14593,10 @@ class AttachmentService extends BaseService {
13742
14593
  if (!id) {
13743
14594
  throw new ValidationError({ message: 'id is required for getById' });
13744
14595
  }
13745
- // Prefix all keys in options with $ for OData
13746
- const keysToPrefix = Object.keys(options);
13747
- const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
14596
+ // Response applies both maps (BucketMap on blobFileAccess, AttachmentsMap on top-level);
14597
+ // merge so SDK names from either are rewritten in one pass.
14598
+ const apiFieldOptions = transformOptions(options, { ...AttachmentsMap, ...BucketMap });
14599
+ const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
13748
14600
  const response = await this.get(ORCHESTRATOR_ATTACHMENT_ENDPOINTS.GET_BY_ID(id), {
13749
14601
  params: apiOptions,
13750
14602
  });
@@ -13968,8 +14820,9 @@ class JobService extends FolderScopedService {
13968
14820
  * const folderJobs = await jobs.getAll({ folderId: <folderId> });
13969
14821
  *
13970
14822
  * // With filtering
13971
- * const runningJobs = await jobs.getAll({
13972
- * filter: "state eq 'Running'"
14823
+ * const recentInvoiceJobs = await jobs.getAll({
14824
+ * filter: "processName eq 'InvoiceBot'",
14825
+ * orderby: 'createdTime desc',
13973
14826
  * });
13974
14827
  *
13975
14828
  * // First page with pagination
@@ -13992,6 +14845,10 @@ class JobService extends FolderScopedService {
13992
14845
  const rawJob = transformData(pascalToCamelCaseKeys(job), JobMap);
13993
14846
  return createJobWithMethods(rawJob, this);
13994
14847
  };
14848
+ // Rewrite renamed SDK field names → API names inside OData strings
14849
+ // before delegating, mirroring the transformRequest pattern used for
14850
+ // request bodies.
14851
+ const apiOptions = options ? transformOptions(options, JobMap) : options;
13995
14852
  return PaginationHelpers.getAll({
13996
14853
  serviceAccess: this.createPaginationServiceAccess(),
13997
14854
  getEndpoint: () => JOB_ENDPOINTS.GET_ALL,
@@ -14007,7 +14864,7 @@ class JobService extends FolderScopedService {
14007
14864
  countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM,
14008
14865
  },
14009
14866
  },
14010
- }, options);
14867
+ }, apiOptions);
14011
14868
  }
14012
14869
  /**
14013
14870
  * Gets a job by its unique key (GUID).
@@ -14044,8 +14901,8 @@ class JobService extends FolderScopedService {
14044
14901
  throw new ValidationError({ message: 'folderId is required for getById' });
14045
14902
  }
14046
14903
  const headers = createHeaders({ [FOLDER_ID]: folderId });
14047
- const keysToPrefix = Object.keys(options ?? {});
14048
- const apiOptions = options ? addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix) : {};
14904
+ const apiFieldOptions = options ? transformOptions(options, JobMap) : {};
14905
+ const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
14049
14906
  const response = await this.get(JOB_ENDPOINTS.GET_BY_KEY(id), {
14050
14907
  params: apiOptions,
14051
14908
  headers,
@@ -14348,6 +15205,9 @@ var JobState;
14348
15205
  JobState["Stopped"] = "Stopped";
14349
15206
  JobState["Suspended"] = "Suspended";
14350
15207
  JobState["Resumed"] = "Resumed";
15208
+ JobState["Cancelled"] = "Cancelled";
15209
+ /** Server-side fallback for an unrecognized or missing job state. */
15210
+ JobState["Unknown"] = "Unknown";
14351
15211
  })(JobState || (JobState = {}));
14352
15212
 
14353
15213
  /**
@@ -14418,6 +15278,10 @@ class ProcessService extends FolderScopedService {
14418
15278
  async getAll(options) {
14419
15279
  // Transformation function for processes
14420
15280
  const transformProcessResponse = (process) => transformData(pascalToCamelCaseKeys(process), ProcessMap);
15281
+ // Rewrite renamed SDK field names → API names inside OData strings
15282
+ // before delegating, mirroring the transformRequest pattern used for
15283
+ // request bodies.
15284
+ const apiOptions = options ? transformOptions(options, ProcessMap) : options;
14421
15285
  return PaginationHelpers.getAll({
14422
15286
  serviceAccess: this.createPaginationServiceAccess(),
14423
15287
  getEndpoint: () => PROCESS_ENDPOINTS.GET_ALL,
@@ -14433,7 +15297,7 @@ class ProcessService extends FolderScopedService {
14433
15297
  countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM
14434
15298
  }
14435
15299
  }
14436
- }, options);
15300
+ }, apiOptions);
14437
15301
  }
14438
15302
  async start(request, optionsOrFolderId, legacyOptions) {
14439
15303
  // Normalize the two overload forms into a single internal shape.
@@ -14467,9 +15331,10 @@ class ProcessService extends FolderScopedService {
14467
15331
  const requestBody = {
14468
15332
  startInfo: apiRequest
14469
15333
  };
14470
- // Prefix all query parameter keys with '$' for OData
14471
- const keysToPrefix = Object.keys(queryOptions);
14472
- const apiOptions = addPrefixToKeys(queryOptions, ODATA_PREFIX, keysToPrefix);
15334
+ // Rewrite renamed SDK field names API names inside OData strings,
15335
+ // then prefix all query parameter keys with '$' for OData.
15336
+ const apiFieldOptions = transformOptions(queryOptions, ProcessMap);
15337
+ const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
14473
15338
  const response = await this.post(PROCESS_ENDPOINTS.START_PROCESS, requestBody, {
14474
15339
  params: apiOptions,
14475
15340
  headers
@@ -14497,8 +15362,8 @@ class ProcessService extends FolderScopedService {
14497
15362
  */
14498
15363
  async getById(id, folderId, options = {}) {
14499
15364
  const headers = createHeaders({ [FOLDER_ID]: folderId });
14500
- const keysToPrefix = Object.keys(options);
14501
- const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
15365
+ const apiFieldOptions = transformOptions(options, ProcessMap);
15366
+ const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
14502
15367
  const response = await this.get(PROCESS_ENDPOINTS.GET_BY_ID(id), {
14503
15368
  headers,
14504
15369
  params: apiOptions
@@ -14533,7 +15398,7 @@ class ProcessService extends FolderScopedService {
14533
15398
  * ```
14534
15399
  */
14535
15400
  async getByName(name, options = {}) {
14536
- return this.getByNameLookup('Process', PROCESS_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), ProcessMap));
15401
+ return this.getByNameLookup('Process', PROCESS_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), ProcessMap), ProcessMap);
14537
15402
  }
14538
15403
  }
14539
15404
  __decorate([
@@ -14609,6 +15474,10 @@ class QueueService extends FolderScopedService {
14609
15474
  async getAll(options) {
14610
15475
  // Transformation function for queues
14611
15476
  const transformQueueResponse = (queue) => transformData(pascalToCamelCaseKeys(queue), QueueMap);
15477
+ // Rewrite renamed SDK field names → API names inside OData strings
15478
+ // before delegating, mirroring the transformRequest pattern used for
15479
+ // request bodies.
15480
+ const apiOptions = options ? transformOptions(options, QueueMap) : options;
14612
15481
  return PaginationHelpers.getAll({
14613
15482
  serviceAccess: this.createPaginationServiceAccess(),
14614
15483
  getEndpoint: (folderId) => folderId ? QUEUE_ENDPOINTS.GET_BY_FOLDER : QUEUE_ENDPOINTS.GET_ALL,
@@ -14624,7 +15493,7 @@ class QueueService extends FolderScopedService {
14624
15493
  countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM
14625
15494
  }
14626
15495
  }
14627
- }, options);
15496
+ }, apiOptions);
14628
15497
  }
14629
15498
  /**
14630
15499
  * Gets a single queue by ID
@@ -14645,8 +15514,8 @@ class QueueService extends FolderScopedService {
14645
15514
  */
14646
15515
  async getById(id, folderId, options = {}) {
14647
15516
  const headers = createHeaders({ [FOLDER_ID]: folderId });
14648
- const keysToPrefix = Object.keys(options);
14649
- const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
15517
+ const apiFieldOptions = transformOptions(options, QueueMap);
15518
+ const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
14650
15519
  const response = await this.get(QUEUE_ENDPOINTS.GET_BY_ID(id), {
14651
15520
  headers,
14652
15521
  params: apiOptions
@@ -14741,7 +15610,19 @@ class UiPath extends UiPath$1 {
14741
15610
  /**
14742
15611
  * Access to ChoiceSet service for managing choice sets
14743
15612
  */
14744
- choicesets: this.getService(ChoiceSetService)
15613
+ choicesets: this.getService(ChoiceSetService),
15614
+ /**
15615
+ * Access to Data Fabric roles for manage-access flows
15616
+ *
15617
+ * @internal
15618
+ */
15619
+ roles: this.getService(DataFabricRoleService),
15620
+ /**
15621
+ * Access to Data Fabric directory principals and role assignments
15622
+ *
15623
+ * @internal
15624
+ */
15625
+ directory: this.getService(DataFabricDirectoryService)
14745
15626
  });
14746
15627
  }
14747
15628
  /**
@@ -15069,9 +15950,9 @@ var AgentListSortColumn;
15069
15950
  AgentListSortColumn["HealthScore"] = "HealthScore";
15070
15951
  AgentListSortColumn["LastIncident"] = "LastIncident";
15071
15952
  AgentListSortColumn["FolderName"] = "FolderName";
15072
- /** Quantity of AGU (Agent Units) consumed */
15953
+ /** Quantity of Agent Units consumed */
15073
15954
  AgentListSortColumn["QuantityAGU"] = "QuantityAGU";
15074
- /** Quantity of PLTU (Platform Units) consumed */
15955
+ /** Quantity of Platform Units consumed */
15075
15956
  AgentListSortColumn["QuantityPLTU"] = "QuantityPLTU";
15076
15957
  AgentListSortColumn["FolderPath"] = "FolderPath";
15077
15958
  })(AgentListSortColumn || (AgentListSortColumn = {}));
@@ -15093,6 +15974,30 @@ var AgentErrorSortColumn;
15093
15974
  AgentErrorSortColumn["LastSeenFolderName"] = "LastSeenFolderName";
15094
15975
  AgentErrorSortColumn["LastSeenFolderPath"] = "LastSeenFolderPath";
15095
15976
  })(AgentErrorSortColumn || (AgentErrorSortColumn = {}));
15977
+ /**
15978
+ * Agent type, used to filter consumption results.
15979
+ *
15980
+ * Wire format is the string name, per the API's `StringEnumConverter` serialization.
15981
+ */
15982
+ var AgentType;
15983
+ (function (AgentType) {
15984
+ AgentType["Autonomous"] = "Autonomous";
15985
+ AgentType["Conversational"] = "Conversational";
15986
+ AgentType["Coded"] = "Coded";
15987
+ })(AgentType || (AgentType = {}));
15988
+ /**
15989
+ * Job execution mode filter accepted by the summary endpoints.
15990
+ *
15991
+ * Wire format is the string name (`"Debug"` / `"Runtime"`), per the API's
15992
+ * `StringEnumConverter` serialization.
15993
+ */
15994
+ var AgentExecutionType;
15995
+ (function (AgentExecutionType) {
15996
+ /** Test runs */
15997
+ AgentExecutionType["Debug"] = "Debug";
15998
+ /** Production runs */
15999
+ AgentExecutionType["Runtime"] = "Runtime";
16000
+ })(AgentExecutionType || (AgentExecutionType = {}));
15096
16001
 
15097
16002
  /**
15098
16003
  * Types for the Agent Memory metrics service.
@@ -15477,6 +16382,52 @@ var SpanAttachmentDirection;
15477
16382
  SpanAttachmentDirection["Out"] = "Out";
15478
16383
  })(SpanAttachmentDirection || (SpanAttachmentDirection = {}));
15479
16384
 
16385
+ // ─── Governance ─────────────────────────────────────────────────────
16386
+ /**
16387
+ * Evaluation mode of a governance decision.
16388
+ */
16389
+ var AgentGovernanceMode;
16390
+ (function (AgentGovernanceMode) {
16391
+ /** Policy evaluated and logged, but not enforced. */
16392
+ AgentGovernanceMode["Audit"] = "AUDIT";
16393
+ /** Policy evaluated and enforced. */
16394
+ AgentGovernanceMode["Enforce"] = "ENFORCE";
16395
+ /** Unrecognized or missing mode. */
16396
+ AgentGovernanceMode["Unknown"] = "Unknown";
16397
+ })(AgentGovernanceMode || (AgentGovernanceMode = {}));
16398
+ /**
16399
+ * Verdict of a governance decision (`Deny` = violation).
16400
+ */
16401
+ var AgentGovernanceVerdict;
16402
+ (function (AgentGovernanceVerdict) {
16403
+ /** Allowed — not a violation. */
16404
+ AgentGovernanceVerdict["Allow"] = "ALLOW";
16405
+ /** Denied — counts as a violation. */
16406
+ AgentGovernanceVerdict["Deny"] = "DENY";
16407
+ /** Unrecognized or missing verdict. */
16408
+ AgentGovernanceVerdict["Unknown"] = "Unknown";
16409
+ })(AgentGovernanceVerdict || (AgentGovernanceVerdict = {}));
16410
+ /**
16411
+ * Sections the governance summary can compute. `action` and `mode` are opt-in.
16412
+ */
16413
+ var AgentGovernanceSection;
16414
+ (function (AgentGovernanceSection) {
16415
+ /** Scalar totals (`total`, `violations`). */
16416
+ AgentGovernanceSection["Totals"] = "totals";
16417
+ /** Breakdown by governance hook. */
16418
+ AgentGovernanceSection["Hook"] = "hook";
16419
+ /** Breakdown by agent. */
16420
+ AgentGovernanceSection["Agent"] = "agent";
16421
+ /** Breakdown by policy. */
16422
+ AgentGovernanceSection["Policy"] = "policy";
16423
+ /** Breakdown by governance pack. */
16424
+ AgentGovernanceSection["Pack"] = "pack";
16425
+ /** Breakdown by enforcement action (opt-in). */
16426
+ AgentGovernanceSection["Action"] = "action";
16427
+ /** Breakdown by evaluation mode (opt-in). */
16428
+ AgentGovernanceSection["Mode"] = "mode";
16429
+ })(AgentGovernanceSection || (AgentGovernanceSection = {}));
16430
+
15480
16431
  /**
15481
16432
  * Asset resolution utilities for UiPath Coded Apps
15482
16433
  *
@@ -15552,4 +16503,4 @@ function getAppBase() {
15552
16503
  return getMetaTagContent(UiPathMetaTags.APP_BASE) || '/';
15553
16504
  }
15554
16505
 
15555
- export { AgentErrorSortColumn, AgentListSortColumn, AgentMap, AgentMemoryExecutionType, SpanExecutionType as AgentTraceExecutionType, AssetValueScope, AssetValueType, AuthenticationError, AuthorizationError, BucketOptions, CitationErrorType, ConversationGetAllFilterMap, ConversationMap, DEFAULT_ITEMS_FIELD, DEFAULT_PAGE_SIZE, DEFAULT_TOTAL_COUNT_FIELD, DataDirectionType, DebugMode, index as DuFramework, EntityAggregateFunction, EntityFieldDataType, EntityType, ErrorType, EscalationActionType, EscalationRecipientScope, EscalationTriggerType, ExchangeMap, FeedbackRating, FeedbackStatus, FieldDisplayType, HttpStatus, InputStreamSpeechSensitivity, InstanceFinalStatus, InstanceStatus, InterruptType, JobPriority, JobSourceType, JobState, JobSubState, JobType, JoinType, LogicalOperator$1 as LogicalOperator, MAX_PAGE_SIZE, MessageMap, MessageRole, NetworkError, NotFoundError, PackageSourceType, PackageType, PolicyEvaluationResult, ProcessIncidentSeverity, ProcessIncidentStatus, ProcessIncidentType, QueryFilterOperator, RateLimitError, ReferenceType, RemoteControlAccess, RobotSize, RuntimeType, SLADurationUnit, ServerError, ServerlessJobType, SlaSummaryStatus, SortOrder, SpanAttachmentDirection, SpanAttachmentProvider, SpanExecutionType, SpanPermissionStatus, SpanSource, SpanStatus, SpanVerbosityLevel, StageTaskType, StartStrategy, StopStrategy, TargetFramework, TaskActivityType, TaskAssignmentCriteria, TaskPriority, TaskSlaCriteria, TaskSlaStatus, TaskSourceName, TaskStatus, TaskType, TaskUserType, TimeInterval, UiPath, UiPathError, UiPathMetaTags, UserSettingsMap, ValidationError, createAgentWithMethods, createCaseInstanceWithMethods, createCaseWithMethods, createConversationWithMethods, createEntityWithMethods, createJobWithMethods, createProcessInstanceWithMethods, createProcessWithMethods, createTaskWithMethods, getAppBase, getAsset, getErrorDetails, getLimitedPageSize, isAuthenticationError, isAuthorizationError, isNetworkError, isNotFoundError, isRateLimitError, isServerError, isUiPathError, isValidationError, loadFromMetaTags, telemetryClient, track, trackEvent };
16506
+ export { AgentErrorSortColumn, AgentExecutionType, AgentGovernanceMode, AgentGovernanceSection, AgentGovernanceVerdict, AgentListSortColumn, AgentMap, AgentMemoryExecutionType, SpanExecutionType as AgentTraceExecutionType, AgentType, AssetValueScope, AssetValueType, AuthenticationError, AuthorizationError, BucketOptions, CitationErrorType, ConversationGetAllFilterMap, ConversationMap, DEFAULT_ITEMS_FIELD, DEFAULT_PAGE_SIZE, DEFAULT_TOTAL_COUNT_FIELD, DataDirectionType, DebugMode, index as DuFramework, EntityAggregateFunction, EntityFieldDataType, EntityType, ErrorType, EscalationActionType, EscalationRecipientScope, EscalationTriggerType, ExchangeMap, FeedbackRating, FeedbackStatus, FieldDisplayType, HttpStatus, InputStreamSpeechSensitivity, InstanceFinalStatus, InstanceStatus, InterruptType, JobPriority, JobSourceType, JobState, JobSubState, JobType, JoinType, LogicalOperator$1 as LogicalOperator, MAX_PAGE_SIZE, MessageMap, MessageRole, NetworkError, NotFoundError, PackageSourceType, PackageType, PolicyEvaluationResult, ProcessIncidentSeverity, ProcessIncidentStatus, ProcessIncidentType, QueryFilterOperator, RateLimitError, ReferenceType, RemoteControlAccess, RobotSize, RuntimeType, SLADurationUnit, ServerError, ServerlessJobType, SlaSummaryStatus, SortOrder, SpanAttachmentDirection, SpanAttachmentProvider, SpanExecutionType, SpanPermissionStatus, SpanSource, SpanStatus, SpanVerbosityLevel, StageTaskType, StartStrategy, StopStrategy, TargetFramework, TaskActivityType, TaskAssignmentCriteria, TaskPriority, TaskSlaCriteria, TaskSlaStatus, TaskSourceName, TaskStatus, TaskType, TaskUserType, TimeInterval, UiPath, UiPathError, UiPathMetaTags, UserSettingsMap, ValidationError, createAgentWithMethods, createCaseInstanceWithMethods, createCaseWithMethods, createConversationWithMethods, createEntityWithMethods, createJobWithMethods, createProcessInstanceWithMethods, createProcessWithMethods, createTaskWithMethods, getAppBase, getAsset, getErrorDetails, getLimitedPageSize, isAuthenticationError, isAuthorizationError, isNetworkError, isNotFoundError, isRateLimitError, isServerError, isUiPathError, isValidationError, loadFromMetaTags, telemetryClient, track, trackEvent };