@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.umd.js CHANGED
@@ -4625,6 +4625,7 @@
4625
4625
  CANCEL: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/cancel`,
4626
4626
  PAUSE: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/pause`,
4627
4627
  RESUME: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/resume`,
4628
+ RETRY: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/retry`,
4628
4629
  },
4629
4630
  INCIDENTS: {
4630
4631
  GET_ALL: `${PIMS_BASE}/api/v1/incidents/summary`,
@@ -4654,8 +4655,12 @@
4654
4655
  INSTANCE_STATUS_BY_DATE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/InstanceStatusByDate`,
4655
4656
  /** Top processes ranked by total duration */
4656
4657
  TOP_PROCESSES_BY_DURATION: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByDuration`,
4658
+ /** Instance stats (counts by status + duration percentiles) */
4659
+ INSTANCE_COUNT_BY_STATUS: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/InstanceCountByStatus`,
4657
4660
  /** Element count by status for agentic instances (process and case) */
4658
4661
  ELEMENT_COUNT_BY_STATUS: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/ElementCountByStatus`,
4662
+ /** Incident counts aggregated by time bucket for time-series charts */
4663
+ INCIDENTS_BY_TIME_WINDOW: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/IncidentsByTimeWindow`,
4659
4664
  },
4660
4665
  };
4661
4666
 
@@ -4705,6 +4710,14 @@
4705
4710
  UPDATE_BY_NAME: (choiceSetName, valueId) => `${DATAFABRIC_BASE}/api/EntityService/${choiceSetName}/choiceset/${valueId}/update`,
4706
4711
  DELETE_BY_ID: (choiceSetId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${choiceSetId}/choiceset/delete`,
4707
4712
  },
4713
+ ROLES: {
4714
+ GET_ALL: `${DATAFABRIC_BASE}/api/v2/Role`,
4715
+ },
4716
+ DIRECTORY: {
4717
+ GET_ALL: `${DATAFABRIC_BASE}/api/Directory`,
4718
+ ASSIGN_ROLES: `${DATAFABRIC_BASE}/api/Directory/Role`,
4719
+ REVOKE_ROLES: `${DATAFABRIC_BASE}/api/Directory/RevokeRole`,
4720
+ },
4708
4721
  };
4709
4722
 
4710
4723
  /**
@@ -9111,7 +9124,7 @@
9111
9124
  * SDK's public API.
9112
9125
  */
9113
9126
  /** SDK version placeholder — patched by the SDK publish workflow. */
9114
- const SDK_VERSION = '1.4.2';
9127
+ const SDK_VERSION = '1.5.1';
9115
9128
  const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
9116
9129
  const SDK_SERVICE_NAME = 'UiPath.TypeScript.Sdk';
9117
9130
  const SDK_LOGGER_NAME = 'uipath-ts-sdk-telemetry';
@@ -11078,7 +11091,16 @@
11078
11091
  return isNaN(date.getTime()) ? value : date.toISOString();
11079
11092
  }
11080
11093
  /**
11081
- * Transforms data by mapping fields according to the provided field mapping
11094
+ * Transforms data by renaming each key in `data` exactly once, using the
11095
+ * mapping (`sourceField → targetField`). Keys not present in the mapping
11096
+ * pass through unchanged. The original (pre-rename) key is dropped — the
11097
+ * result contains only the renamed key.
11098
+ *
11099
+ * Each rename is independent. If the mapping happens to contain chained
11100
+ * entries (`a → b` and `b → c`), they do NOT compose: a field named `a`
11101
+ * in `data` becomes `b` (not `c`), because the renames are applied based
11102
+ * on the original data's keys, not the running result.
11103
+ *
11082
11104
  * @param data The source data to transform
11083
11105
  * @param fieldMapping Object mapping source field names to target field names
11084
11106
  * @returns Transformed data with mapped field names
@@ -11101,21 +11123,28 @@
11101
11123
  * // { userId: '123', name: 'john' },
11102
11124
  * // { userId: '456', name: 'jane' }
11103
11125
  * // ]
11126
+ *
11127
+ * // No chaining — `a → b` does not become `a → c` even if the map has `b → c`.
11128
+ * transformData({ a: 1 }, { a: 'b', b: 'c' });
11129
+ * // result = { b: 1 }
11104
11130
  * ```
11105
11131
  */
11106
11132
  function transformData(data, fieldMapping) {
11133
+ // Pass null/undefined through unchanged — callers (e.g. AttachmentService.getById)
11134
+ // may invoke this on optional fields that an OData `select` excluded.
11135
+ if (data == null) {
11136
+ return data;
11137
+ }
11107
11138
  // Handle array of objects
11108
11139
  if (Array.isArray(data)) {
11109
11140
  return data.map(item => transformData(item, fieldMapping));
11110
11141
  }
11111
- // Handle single object
11112
- const result = { ...data };
11113
- for (const [sourceField, targetField] of Object.entries(fieldMapping)) {
11114
- if (sourceField in result) {
11115
- const value = result[sourceField];
11116
- delete result[sourceField];
11117
- result[targetField] = value;
11118
- }
11142
+ // Walk the ORIGINAL data's keys, look up each in the mapping. One rename
11143
+ // per data key — no mutation of an in-progress result, so chains can't form.
11144
+ const result = {};
11145
+ for (const [key, value] of Object.entries(data)) {
11146
+ const renamedKey = fieldMapping[key] ?? key;
11147
+ result[renamedKey] = value;
11119
11148
  }
11120
11149
  return result;
11121
11150
  }
@@ -11393,6 +11422,79 @@
11393
11422
  }
11394
11423
  return result;
11395
11424
  }
11425
+ /**
11426
+ * OData query-string keys whose values may contain field identifiers that
11427
+ * need rewriting from SDK names → API names.
11428
+ */
11429
+ const ODATA_FIELD_PARAM_KEYS = ['filter', 'orderby', 'select', 'expand'];
11430
+ /**
11431
+ * Matches one token at a time in an OData expression:
11432
+ * 1. A single-quoted string literal, allowing the `''` escape sequence —
11433
+ * consumed atomically so identifiers inside the literal can't match.
11434
+ * 2. An OData identifier (`[A-Za-z_][A-Za-z0-9_]*`).
11435
+ * Anything else (whitespace, operators, parens, commas) is left alone by
11436
+ * `String.prototype.replace`, which only substitutes matched substrings.
11437
+ */
11438
+ const ODATA_TOKEN_RE = /'(?:[^']|'')*'|[A-Za-z_][A-Za-z0-9_]*/g;
11439
+ /**
11440
+ * Rewrites SDK field identifiers to API field identifiers inside an OData
11441
+ * expression string (`$filter`, `$orderby`, `$select`, `$expand`).
11442
+ *
11443
+ * Field maps (e.g. `JobMap`) rename API fields → SDK fields on responses, so
11444
+ * SDK consumers see the renamed names. Without this rewrite, the same name
11445
+ * in a `filter` string would be forwarded verbatim and the API (which still
11446
+ * uses the original name) would reject it.
11447
+ *
11448
+ * Quoted string literals (with the OData `''` escape) are preserved exactly:
11449
+ * the token regex consumes them whole, so identifiers inside literals never
11450
+ * match. Identifier tokens are looked up in the reversed field map.
11451
+ *
11452
+ * @example
11453
+ * ```typescript
11454
+ * const requestMap = { processName: 'releaseName' };
11455
+ * rewriteODataIdentifiers("processName eq 'processName'", requestMap);
11456
+ * // "releaseName eq 'processName'" — identifier rewritten, literal preserved
11457
+ * ```
11458
+ */
11459
+ function rewriteODataIdentifiers(expression, requestMap) {
11460
+ if (!expression)
11461
+ return expression;
11462
+ return expression.replace(ODATA_TOKEN_RE, (match) => match.startsWith("'") ? match : (requestMap[match] ?? match));
11463
+ }
11464
+ /**
11465
+ * Symmetric counterpart of {@link transformRequest} for OData query options:
11466
+ * rewrites SDK field identifiers inside the recognized OData string params
11467
+ * (`filter`, `orderby`, `select`, `expand`) to their API names using the
11468
+ * reversed form of a response field map. Returns a shallow copy with the
11469
+ * relevant values rewritten; other keys pass through unchanged.
11470
+ *
11471
+ * Use at the OData edge so SDK consumers can refer to renamed fields by
11472
+ * their SDK name throughout — for reading the response and for filtering /
11473
+ * sorting / projecting / expanding.
11474
+ *
11475
+ * @param options The OData query options as authored with SDK field names
11476
+ * @param responseMap The response field map (API → SDK); reversed internally
11477
+ *
11478
+ * @example
11479
+ * ```typescript
11480
+ * // JobMap renames releaseName → processName on responses.
11481
+ * transformOptions({ filter: "processName eq 'X'" }, JobMap);
11482
+ * // { filter: "releaseName eq 'X'" }
11483
+ * ```
11484
+ */
11485
+ function transformOptions(options, responseMap) {
11486
+ const requestMap = reverseMap(responseMap);
11487
+ if (Object.keys(requestMap).length === 0)
11488
+ return options;
11489
+ const result = { ...options };
11490
+ for (const key of ODATA_FIELD_PARAM_KEYS) {
11491
+ const value = result[key];
11492
+ if (typeof value === 'string') {
11493
+ result[key] = rewriteODataIdentifiers(value, requestMap);
11494
+ }
11495
+ }
11496
+ return result;
11497
+ }
11396
11498
  /**
11397
11499
  * Transforms an array-based dictionary with separate keys and values arrays
11398
11500
  * into a standard JavaScript object/record
@@ -13959,6 +14061,434 @@
13959
14061
  track('Choicesets.DeleteValuesById')
13960
14062
  ], ChoiceSetService.prototype, "deleteValuesById", null);
13961
14063
 
14064
+ /**
14065
+ * @internal
14066
+ */
14067
+ var DataFabricRoleType;
14068
+ (function (DataFabricRoleType) {
14069
+ DataFabricRoleType["System"] = "System";
14070
+ DataFabricRoleType["UserDefined"] = "UserDefined";
14071
+ })(DataFabricRoleType || (DataFabricRoleType = {}));
14072
+
14073
+ function isRecord$1(value) {
14074
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
14075
+ }
14076
+ function isDataFabricRole(value) {
14077
+ if (!isRecord$1(value)) {
14078
+ return false;
14079
+ }
14080
+ const { id, name, type, directoryEntityCount, folderId } = value;
14081
+ const hasValidDirectoryEntityCount = directoryEntityCount === undefined ||
14082
+ directoryEntityCount === null ||
14083
+ typeof directoryEntityCount === 'number';
14084
+ const hasValidFolderId = folderId === undefined || typeof folderId === 'string';
14085
+ return typeof id === 'string' &&
14086
+ typeof name === 'string' &&
14087
+ (type === DataFabricRoleType.System || type === DataFabricRoleType.UserDefined) &&
14088
+ hasValidDirectoryEntityCount &&
14089
+ hasValidFolderId;
14090
+ }
14091
+ function validateRolesResponse(data) {
14092
+ if (Array.isArray(data) && data.every(isDataFabricRole)) {
14093
+ return data;
14094
+ }
14095
+ throw new ServerError({
14096
+ message: 'Invalid Data Fabric roles response format.',
14097
+ });
14098
+ }
14099
+ /**
14100
+ * @internal
14101
+ */
14102
+ class DataFabricRoleService extends BaseService {
14103
+ /**
14104
+ * Lists Data Fabric access roles.
14105
+ *
14106
+ * Returns tenant Data Fabric roles such as Admin, Designer, DataWriter, and
14107
+ * DataReader. Role IDs from this method can be passed to
14108
+ * `DataFabricDirectoryService.assignRoles()`.
14109
+ *
14110
+ * @param options - Optional query options
14111
+ * @returns Promise resolving to an array of {@link DataFabricRole}
14112
+ *
14113
+ * @example
14114
+ * ```typescript
14115
+ * import { DataFabricRoleService } from '@uipath/uipath-typescript/entities';
14116
+ *
14117
+ * const roles = new DataFabricRoleService(sdk);
14118
+ * const allRoles = await roles.getAll();
14119
+ * const dataWriter = allRoles.find(role => role.name === 'DataWriter');
14120
+ * ```
14121
+ *
14122
+ * @example
14123
+ * ```typescript
14124
+ * const rolesWithoutStats = await roles.getAll({ stats: false });
14125
+ * ```
14126
+ *
14127
+ * @example
14128
+ * ```typescript
14129
+ * const folderRoles = await roles.getAll({ folderKey: '<folder-key>' });
14130
+ * ```
14131
+ *
14132
+ * @internal
14133
+ */
14134
+ async getAll(options = {}) {
14135
+ const params = createParams({
14136
+ stats: options.stats ?? true,
14137
+ });
14138
+ const headers = createHeaders({ [FOLDER_KEY]: options.folderKey });
14139
+ const response = await this.get(DATA_FABRIC_ENDPOINTS.ROLES.GET_ALL, { params, headers });
14140
+ return validateRolesResponse(response.data);
14141
+ }
14142
+ }
14143
+ __decorate([
14144
+ track('DataFabricRoles.GetAll')
14145
+ ], DataFabricRoleService.prototype, "getAll", null);
14146
+
14147
+ /**
14148
+ * @internal
14149
+ */
14150
+ var DataFabricDirectoryEntityType;
14151
+ (function (DataFabricDirectoryEntityType) {
14152
+ /** Identity user, robot user, or directory robot principal. */
14153
+ DataFabricDirectoryEntityType[DataFabricDirectoryEntityType["User"] = 0] = "User";
14154
+ /** Identity group principal. */
14155
+ DataFabricDirectoryEntityType[DataFabricDirectoryEntityType["Group"] = 1] = "Group";
14156
+ /** External application principal. */
14157
+ DataFabricDirectoryEntityType[DataFabricDirectoryEntityType["Application"] = 2] = "Application";
14158
+ })(DataFabricDirectoryEntityType || (DataFabricDirectoryEntityType = {}));
14159
+ /**
14160
+ * @internal
14161
+ */
14162
+ var DataFabricDirectoryEntityTypeName;
14163
+ (function (DataFabricDirectoryEntityTypeName) {
14164
+ DataFabricDirectoryEntityTypeName["User"] = "User";
14165
+ DataFabricDirectoryEntityTypeName["Group"] = "Group";
14166
+ DataFabricDirectoryEntityTypeName["Application"] = "Application";
14167
+ })(DataFabricDirectoryEntityTypeName || (DataFabricDirectoryEntityTypeName = {}));
14168
+
14169
+ const DEFAULT_DIRECTORY_PAGE_SIZE = 100;
14170
+ const MAX_DIRECTORY_PAGE_SIZE = 100;
14171
+ function validateDirectoryListResponse(data) {
14172
+ if (data === null || typeof data !== 'object' || Array.isArray(data)) {
14173
+ throw new ServerError({
14174
+ message: 'Invalid Data Fabric directory response format.',
14175
+ });
14176
+ }
14177
+ const response = data;
14178
+ if (typeof response.totalCount !== 'number' || !Array.isArray(response.results)) {
14179
+ throw new ServerError({
14180
+ message: 'Invalid Data Fabric directory response format.',
14181
+ });
14182
+ }
14183
+ return {
14184
+ totalCount: response.totalCount,
14185
+ results: response.results,
14186
+ };
14187
+ }
14188
+ function isRecord(value) {
14189
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
14190
+ }
14191
+ function isDirectoryEntityTypeName(value) {
14192
+ return value === DataFabricDirectoryEntityTypeName.User ||
14193
+ value === DataFabricDirectoryEntityTypeName.Group ||
14194
+ value === DataFabricDirectoryEntityTypeName.Application;
14195
+ }
14196
+ function isDirectoryRole(value) {
14197
+ if (!isRecord(value)) {
14198
+ return false;
14199
+ }
14200
+ return typeof value.id === 'string' && typeof value.name === 'string';
14201
+ }
14202
+ function normalizeDirectoryEntry(entry) {
14203
+ if (!isRecord(entry) ||
14204
+ typeof entry.externalId !== 'string' ||
14205
+ typeof entry.name !== 'string' ||
14206
+ !isDirectoryEntityTypeName(entry.type) ||
14207
+ (entry.email !== undefined && entry.email !== null && typeof entry.email !== 'string') ||
14208
+ (entry.objectType !== undefined && entry.objectType !== null && typeof entry.objectType !== 'string') ||
14209
+ (entry.isUIEnabled !== undefined && typeof entry.isUIEnabled !== 'boolean') ||
14210
+ (entry.roles !== undefined && entry.roles !== null && (!Array.isArray(entry.roles) || !entry.roles.every(isDirectoryRole)))) {
14211
+ throw new ServerError({
14212
+ message: 'Invalid Data Fabric directory entry response format.',
14213
+ });
14214
+ }
14215
+ const normalized = {
14216
+ externalId: entry.externalId,
14217
+ name: entry.name,
14218
+ type: entry.type,
14219
+ roles: entry.roles ?? [],
14220
+ isUIEnabled: entry.isUIEnabled ?? true,
14221
+ };
14222
+ if (entry.email !== undefined) {
14223
+ normalized.email = entry.email;
14224
+ }
14225
+ if (entry.objectType !== undefined) {
14226
+ normalized.objectType = entry.objectType;
14227
+ }
14228
+ return normalized;
14229
+ }
14230
+ function normalizePrincipalIds(principalIds) {
14231
+ const ids = Array.isArray(principalIds) ? principalIds : [principalIds];
14232
+ return [...new Set(ids.map(id => id.trim()).filter(Boolean))];
14233
+ }
14234
+ function normalizeRoleIds(roleIds) {
14235
+ return [...new Set(roleIds.map(id => id.trim()).filter(Boolean))];
14236
+ }
14237
+ function normalizePrincipalType(type) {
14238
+ if (typeof type === 'number') {
14239
+ if (type === DataFabricDirectoryEntityType.User ||
14240
+ type === DataFabricDirectoryEntityType.Group ||
14241
+ type === DataFabricDirectoryEntityType.Application) {
14242
+ return type;
14243
+ }
14244
+ throw new ValidationError({
14245
+ message: 'Invalid Data Fabric principal type.',
14246
+ });
14247
+ }
14248
+ switch (type) {
14249
+ case DataFabricDirectoryEntityTypeName.User:
14250
+ return DataFabricDirectoryEntityType.User;
14251
+ case DataFabricDirectoryEntityTypeName.Group:
14252
+ return DataFabricDirectoryEntityType.Group;
14253
+ case DataFabricDirectoryEntityTypeName.Application:
14254
+ return DataFabricDirectoryEntityType.Application;
14255
+ default:
14256
+ throw new ValidationError({
14257
+ message: 'Invalid Data Fabric principal type.',
14258
+ });
14259
+ }
14260
+ }
14261
+ function roleIdsFromEntry(entry) {
14262
+ if (!entry) {
14263
+ return [];
14264
+ }
14265
+ return normalizeRoleIds(entry.roles.map(role => role.id));
14266
+ }
14267
+ function clampDirectoryPageSize(pageSize) {
14268
+ return Math.max(1, Math.min(pageSize ?? DEFAULT_DIRECTORY_PAGE_SIZE, MAX_DIRECTORY_PAGE_SIZE));
14269
+ }
14270
+ /**
14271
+ * @internal
14272
+ */
14273
+ class DataFabricDirectoryService extends BaseService {
14274
+ async fetchAllEntries(options = {}) {
14275
+ const top = clampDirectoryPageSize(options.pageSize);
14276
+ const entries = [];
14277
+ let skip = 0;
14278
+ while (true) {
14279
+ const page = await this.list(skip === 0 ? { top } : { top, skip });
14280
+ entries.push(...page.results);
14281
+ if (page.results.length < top || (page.totalCount !== undefined && entries.length >= page.totalCount)) {
14282
+ return entries;
14283
+ }
14284
+ skip += top;
14285
+ }
14286
+ }
14287
+ /**
14288
+ * Lists one page of Data Fabric directory principals and their current roles.
14289
+ *
14290
+ * Returns directory entries with external IDs, principal metadata, and
14291
+ * assigned Data Fabric roles.
14292
+ *
14293
+ * @param options - Optional offset paging options
14294
+ * @returns Promise resolving to {@link DataFabricDirectoryListResponse}
14295
+ *
14296
+ * @example
14297
+ * ```typescript
14298
+ * import { DataFabricDirectoryService } from '@uipath/uipath-typescript/entities';
14299
+ *
14300
+ * const directory = new DataFabricDirectoryService(sdk);
14301
+ * const page = await directory.list({ skip: 0, top: 50 });
14302
+ * const firstPrincipal = page.results[0];
14303
+ * ```
14304
+ *
14305
+ * @internal
14306
+ */
14307
+ async list(options = {}) {
14308
+ const params = createParams({
14309
+ skip: options.skip,
14310
+ top: clampDirectoryPageSize(options.top),
14311
+ });
14312
+ const response = await this.get(DATA_FABRIC_ENDPOINTS.DIRECTORY.GET_ALL, { params });
14313
+ const data = validateDirectoryListResponse(response.data);
14314
+ const results = data.results.map(normalizeDirectoryEntry);
14315
+ return {
14316
+ totalCount: data.totalCount,
14317
+ results,
14318
+ };
14319
+ }
14320
+ /**
14321
+ * Lists all Data Fabric directory principals and their current roles.
14322
+ *
14323
+ * Follows the Data Fabric directory top/skip pagination and returns
14324
+ * normalized entries. Entries without assigned roles include an empty
14325
+ * `roles` array.
14326
+ *
14327
+ * @param options - Optional page-size options
14328
+ * @returns Promise resolving to an array of {@link DataFabricDirectoryEntry}
14329
+ *
14330
+ * @example
14331
+ * ```typescript
14332
+ * import { DataFabricDirectoryService } from '@uipath/uipath-typescript/entities';
14333
+ *
14334
+ * const directory = new DataFabricDirectoryService(sdk);
14335
+ * const principals = await directory.getAll({ pageSize: 100 });
14336
+ * ```
14337
+ *
14338
+ * @internal
14339
+ */
14340
+ async getAll(options = {}) {
14341
+ return this.fetchAllEntries(options);
14342
+ }
14343
+ /**
14344
+ * Assigns Data Fabric roles to one or more principals.
14345
+ *
14346
+ * The Data Fabric API replaces the role set for each principal, so this
14347
+ * method preserves existing roles by default and posts the union of current
14348
+ * and requested role IDs.
14349
+ *
14350
+ * Role IDs can be discovered with `DataFabricRoleService.getAll()`. Set
14351
+ * `preserveExisting: false` only when intentionally replacing a principal's
14352
+ * Data Fabric role set.
14353
+ *
14354
+ * @param principalIds - Principal external ID or IDs
14355
+ * @param principalType - Principal type
14356
+ * @param roleIds - Data Fabric role IDs to assign
14357
+ * @param options - Optional assignment behavior
14358
+ * @returns Promise resolving to an array of {@link DataFabricDirectoryAssignmentResult}
14359
+ *
14360
+ * @example
14361
+ * ```typescript
14362
+ * import { DataFabricDirectoryEntityTypeName, DataFabricDirectoryService, DataFabricRoleService } from '@uipath/uipath-typescript/entities';
14363
+ *
14364
+ * const roles = new DataFabricRoleService(sdk);
14365
+ * const directory = new DataFabricDirectoryService(sdk);
14366
+ *
14367
+ * const dataWriter = (await roles.getAll()).find(role => role.name === 'DataWriter');
14368
+ * if (!dataWriter) {
14369
+ * throw new Error('DataWriter role not found');
14370
+ * }
14371
+ *
14372
+ * await directory.assignRoles('<identity-group-id>', DataFabricDirectoryEntityTypeName.Group, [dataWriter.id]);
14373
+ * ```
14374
+ *
14375
+ * @example
14376
+ * ```typescript
14377
+ * await directory.assignRoles('<identity-user-id>', DataFabricDirectoryEntityTypeName.User, ['<role-id>'], {
14378
+ * preserveExisting: false,
14379
+ * });
14380
+ * ```
14381
+ *
14382
+ * @internal
14383
+ */
14384
+ async assignRoles(principalIds, principalType, roleIds, options = {}) {
14385
+ const normalizedPrincipalIds = normalizePrincipalIds(principalIds);
14386
+ const normalizedRoleIds = normalizeRoleIds(roleIds);
14387
+ if (normalizedPrincipalIds.length === 0) {
14388
+ throw new ValidationError({ message: 'At least one principal ID is required.' });
14389
+ }
14390
+ if (normalizedRoleIds.length === 0) {
14391
+ throw new ValidationError({ message: 'At least one Data Fabric role ID is required.' });
14392
+ }
14393
+ const type = normalizePrincipalType(principalType);
14394
+ const preserveExisting = options.preserveExisting ?? true;
14395
+ const existingById = new Map();
14396
+ if (preserveExisting) {
14397
+ for (const entry of await this.fetchAllEntries()) {
14398
+ existingById.set(entry.externalId.toLowerCase(), entry);
14399
+ }
14400
+ }
14401
+ return Promise.all(normalizedPrincipalIds.map(async (principalId) => {
14402
+ const existing = existingById.get(principalId.toLowerCase());
14403
+ const mergedRoleIds = preserveExisting
14404
+ ? normalizeRoleIds([...roleIdsFromEntry(existing), ...normalizedRoleIds])
14405
+ : normalizedRoleIds;
14406
+ const payload = {
14407
+ directoryEntities: [
14408
+ {
14409
+ externalId: principalId,
14410
+ type,
14411
+ resolved: true,
14412
+ },
14413
+ ],
14414
+ roles: mergedRoleIds,
14415
+ isUIEnabled: options.uiEnabled ?? true,
14416
+ };
14417
+ await this.post(DATA_FABRIC_ENDPOINTS.DIRECTORY.ASSIGN_ROLES, payload);
14418
+ return {
14419
+ principalId,
14420
+ roleIds: mergedRoleIds,
14421
+ };
14422
+ }));
14423
+ }
14424
+ /**
14425
+ * Revokes all direct Data Fabric roles from one or more principals.
14426
+ *
14427
+ * The Data Fabric API removes all role assignments for each supplied external
14428
+ * ID. Use this when a principal should no longer have direct Data Fabric
14429
+ * access. Inherited access through groups is not changed.
14430
+ *
14431
+ * @param principalIds - Principal external ID or IDs
14432
+ * @returns Promise resolving when the roles are revoked
14433
+ *
14434
+ * @example
14435
+ * ```typescript
14436
+ * import { DataFabricDirectoryService } from '@uipath/uipath-typescript/entities';
14437
+ *
14438
+ * const directory = new DataFabricDirectoryService(sdk);
14439
+ *
14440
+ * await directory.revokeRoles('<identity-user-id>');
14441
+ * ```
14442
+ *
14443
+ * @example
14444
+ * ```typescript
14445
+ * await directory.revokeRoles([
14446
+ * '<identity-user-id>',
14447
+ * '<identity-group-id>',
14448
+ * ]);
14449
+ * ```
14450
+ *
14451
+ * @internal
14452
+ */
14453
+ async revokeRoles(principalIds) {
14454
+ const normalizedPrincipalIds = normalizePrincipalIds(principalIds);
14455
+ if (normalizedPrincipalIds.length === 0) {
14456
+ throw new ValidationError({ message: 'At least one principal ID is required.' });
14457
+ }
14458
+ const payload = {
14459
+ externalIds: normalizedPrincipalIds,
14460
+ };
14461
+ await this.post(DATA_FABRIC_ENDPOINTS.DIRECTORY.REVOKE_ROLES, payload);
14462
+ }
14463
+ }
14464
+ __decorate([
14465
+ track('DataFabricDirectory.List')
14466
+ ], DataFabricDirectoryService.prototype, "list", null);
14467
+ __decorate([
14468
+ track('DataFabricDirectory.GetAll')
14469
+ ], DataFabricDirectoryService.prototype, "getAll", null);
14470
+ __decorate([
14471
+ track('DataFabricDirectory.AssignRoles')
14472
+ ], DataFabricDirectoryService.prototype, "assignRoles", null);
14473
+ __decorate([
14474
+ track('DataFabricDirectory.RevokeRoles')
14475
+ ], DataFabricDirectoryService.prototype, "revokeRoles", null);
14476
+
14477
+ /**
14478
+ * Maps API field names (countOf*) to SDK field names (*Count) for InstanceStats,
14479
+ * aligning naming with ElementStats and other count-suffixed conventions.
14480
+ */
14481
+ const InstanceStatsMap = {
14482
+ countOfAllInstances: 'totalCount',
14483
+ countOfRunning: 'runningCount',
14484
+ countOfTransitioning: 'transitioningCount',
14485
+ countOfPaused: 'pausedCount',
14486
+ countOfFaulted: 'faultedCount',
14487
+ countOfCompleted: 'completedCount',
14488
+ countOfCancelled: 'cancelledCount',
14489
+ countOfDeleted: 'deletedCount'
14490
+ };
14491
+
13962
14492
  /**
13963
14493
  * Maestro Process Models
13964
14494
  * Model classes for Maestro processes
@@ -13984,7 +14514,36 @@
13984
14514
  throw new Error('Process key is undefined');
13985
14515
  if (!processData.packageId)
13986
14516
  throw new Error('Package ID is undefined');
13987
- return service.getElementStats(processData.processKey, processData.packageId, startTime, endTime, packageVersion);
14517
+ return service.getElementStats({
14518
+ processKey: processData.processKey,
14519
+ packageId: processData.packageId,
14520
+ packageVersion,
14521
+ startTime,
14522
+ endTime,
14523
+ });
14524
+ },
14525
+ getInstanceStats(startTime, endTime, packageVersion) {
14526
+ if (!processData.processKey)
14527
+ throw new Error('Process key is undefined');
14528
+ if (!processData.packageId)
14529
+ throw new Error('Package ID is undefined');
14530
+ return service.getInstanceStats({
14531
+ processKey: processData.processKey,
14532
+ packageId: processData.packageId,
14533
+ packageVersion,
14534
+ startTime,
14535
+ endTime,
14536
+ });
14537
+ },
14538
+ getInstanceStatusTimeline(startTime, endTime, options) {
14539
+ if (!processData.processKey)
14540
+ throw new Error('Process key is undefined');
14541
+ return service.getInstanceStatusTimeline(startTime, endTime, { ...options, processKeys: [processData.processKey] });
14542
+ },
14543
+ getIncidentsTimeline(startTime, endTime, options) {
14544
+ if (!processData.processKey)
14545
+ throw new Error('Process key is undefined');
14546
+ return service.getIncidentsTimeline(startTime, endTime, { ...options, processKeys: [processData.processKey] });
13988
14547
  }
13989
14548
  };
13990
14549
  }
@@ -14001,205 +14560,13 @@
14001
14560
  }
14002
14561
 
14003
14562
  /**
14004
- * Builds the request body for Insights RTM "top" endpoints.
14563
+ * Creates methods for a process instance
14005
14564
  *
14006
- * @param startTime - Start of the time range to query
14007
- * @param endTime - End of the time range to query
14008
- * @param isCaseManagement - Whether to filter for case management processes
14009
- * @param options - Optional filters (packageId, processKey, version)
14010
- * @returns Request body for the Insights RTM endpoint
14011
- * @internal
14565
+ * @param instanceData - The process instance data (response from API)
14566
+ * @param service - The process instance service instance
14567
+ * @returns Object containing process instance methods
14012
14568
  */
14013
- function buildInsightsTopBody(startTime, endTime, isCaseManagement, options) {
14014
- return {
14015
- commonParams: {
14016
- startTime: startTime.getTime(),
14017
- endTime: endTime.getTime(),
14018
- isCaseManagement,
14019
- ...(options?.packageId ? { packageId: options.packageId } : {}),
14020
- ...(options?.processKey ? { processKey: options.processKey } : {}),
14021
- ...(options?.version ? { version: options.version } : {}),
14022
- }
14023
- };
14024
- }
14025
- /**
14026
- * Fetches instance status timeline from the Insights API.
14027
- * Shared implementation used by both MaestroProcessesService and CasesService.
14028
- *
14029
- * @param postFn - Bound post method from a BaseService subclass
14030
- * @param startTime - Start of the time range to query
14031
- * @param endTime - End of the time range to query
14032
- * @param isCaseManagement - Whether to filter for case management processes
14033
- * @param options - Optional settings for time bucketing granularity
14034
- * @returns Promise resolving to an array of instance status timeline entries
14035
- * @internal
14036
- */
14037
- async function fetchInstanceStatusTimeline(postFn, startTime, endTime, isCaseManagement, options) {
14038
- const response = await postFn(MAESTRO_ENDPOINTS.INSIGHTS.INSTANCE_STATUS_BY_DATE, {
14039
- commonParams: {
14040
- startTime: startTime.getTime(),
14041
- endTime: endTime.getTime(),
14042
- isCaseManagement,
14043
- },
14044
- timeSliceUnit: options?.groupBy,
14045
- timezoneOffset: new Date().getTimezoneOffset() * -1,
14046
- });
14047
- return response.data ?? [];
14048
- }
14049
- /**
14050
- * Builds the request body for the ElementCountByStatus endpoint.
14051
- *
14052
- * @param processKey - Process key to filter by
14053
- * @param packageId - Package identifier
14054
- * @param startTime - Start of the time range to query
14055
- * @param endTime - End of the time range to query
14056
- * @param packageVersion - Package version to filter by
14057
- * @returns Request body for the ElementCountByStatus endpoint
14058
- * @internal
14059
- */
14060
- function buildElementCountByStatusBody(processKey, packageId, startTime, endTime, packageVersion) {
14061
- return {
14062
- commonParams: {
14063
- processKey,
14064
- packageId,
14065
- startTime: startTime.getTime(),
14066
- endTime: endTime.getTime(),
14067
- version: packageVersion
14068
- }
14069
- };
14070
- }
14071
-
14072
- /**
14073
- * Maps fields for Incident entities
14074
- */
14075
- const ProcessIncidentMap = {
14076
- errorTimeUtc: 'errorTime'
14077
- };
14078
- /**
14079
- * Maps fields for Incident Summary entities
14080
- */
14081
- const ProcessIncidentSummaryMap = {
14082
- firstTimeUtc: 'firstOccuranceTime'
14083
- };
14084
-
14085
- /**
14086
- * Helpers for fetching BPMN XML and extracting element details used to annotate responses
14087
- */
14088
- class BpmnHelpers {
14089
- /**
14090
- * Parse BPMN XML and extract element id → {name,type} used for incidents
14091
- */
14092
- static parseBpmnElementsForIncidents(bpmnXml) {
14093
- const elementInfo = {};
14094
- try {
14095
- // Find <bpmn:...> start tags and capture the element type.
14096
- // Then read 'id' and 'name' attributes from each tag.
14097
- const bpmnOpenTagRegex = /<bpmn:([A-Za-z][\w.-]*)\b[^>]*>/g;
14098
- for (const tagMatch of bpmnXml.matchAll(bpmnOpenTagRegex)) {
14099
- const [fullTag, elementType] = tagMatch;
14100
- // Extract attributes from the current tag text.
14101
- const idMatch = /\bid\s*=\s*"([^"]*)"/.exec(fullTag);
14102
- if (!idMatch) {
14103
- continue;
14104
- }
14105
- const elementId = idMatch[1];
14106
- const nameMatch = /\bname\s*=\s*"([^"]*)"/.exec(fullTag);
14107
- const name = nameMatch ? nameMatch[1] : '';
14108
- // Convert BPMN element type to human-readable format
14109
- const activityType = this.formatActivityTypeForIncidents(elementType);
14110
- const activityName = name || elementId;
14111
- elementInfo[elementId] = {
14112
- type: activityType,
14113
- name: activityName
14114
- };
14115
- }
14116
- }
14117
- catch (error) {
14118
- console.warn('Failed to parse BPMN XML for incidents:', error);
14119
- }
14120
- return elementInfo;
14121
- }
14122
- /**
14123
- * Format BPMN element type to human-readable activity type for incidents
14124
- */
14125
- static formatActivityTypeForIncidents(elementType) {
14126
- // Convert camelCase BPMN element types to human-readable format
14127
- // e.g., "serviceTask" -> "Service Task", "exclusiveGateway" -> "Exclusive Gateway"
14128
- return elementType
14129
- .replace(/([A-Z])/g, ' $1') // Add space before uppercase letters
14130
- .replace(/^./, str => str.toUpperCase()) // Capitalize first letter
14131
- .trim(); // Remove any leading/trailing spaces
14132
- }
14133
- /**
14134
- * Fetch BPMN via getBpmn and add element name/type to each incident
14135
- */
14136
- static async enrichIncidentsWithBpmnData(incidents, folderKey, service) {
14137
- // Check if all incidents have the same instanceId
14138
- const uniqueInstanceIds = [...new Set(incidents.map(i => i.instanceId))];
14139
- if (uniqueInstanceIds.length === 1) {
14140
- // Single instance optimization (in case of process instance incidents)
14141
- const elementInfo = await this.getBpmnElementInfo(uniqueInstanceIds[0], folderKey, service);
14142
- return incidents.map((incident) => this.transformIncidentWithBpmn(incident, elementInfo));
14143
- }
14144
- else {
14145
- // Multiple instances optimization (in case of process incidents)
14146
- return this.enrichMultipleInstanceIncidents(incidents, folderKey, service);
14147
- }
14148
- }
14149
- /**
14150
- * When incidents span multiple instances, fetch BPMN per instance and annotate
14151
- */
14152
- static async enrichMultipleInstanceIncidents(incidents, folderKey, service) {
14153
- const groups = incidents.reduce((acc, incident) => {
14154
- const id = incident.instanceId || NO_INSTANCE;
14155
- (acc[id] = acc[id] || []).push(incident);
14156
- return acc;
14157
- }, {});
14158
- const results = await Promise.all(Object.entries(groups).map(async (entry) => {
14159
- const [instanceId, groupIncidents] = entry;
14160
- const elementInfo = await this.getBpmnElementInfo(instanceId, folderKey, service);
14161
- return groupIncidents.map((incident) => this.transformIncidentWithBpmn(incident, elementInfo));
14162
- }));
14163
- return results.flat();
14164
- }
14165
- /**
14166
- * Retrieve BPMN XML for an instance and derive element id → {name,type}
14167
- */
14168
- static async getBpmnElementInfo(instanceId, folderKey, service) {
14169
- if (!instanceId || instanceId === NO_INSTANCE) {
14170
- return {};
14171
- }
14172
- try {
14173
- const bpmnXml = await service.getBpmn(instanceId, folderKey);
14174
- return this.parseBpmnElementsForIncidents(bpmnXml);
14175
- }
14176
- catch (error) {
14177
- console.warn(`Failed to get BPMN for instance ${instanceId}:`, error);
14178
- return {};
14179
- }
14180
- }
14181
- /**
14182
- * Transform a raw incident by attaching element name/type from BPMN
14183
- */
14184
- static transformIncidentWithBpmn(incident, elementInfo) {
14185
- const element = elementInfo[incident.elementId];
14186
- const transformed = transformData(incident, ProcessIncidentMap);
14187
- return {
14188
- ...transformed,
14189
- incidentElementActivityType: element?.type || UNKNOWN,
14190
- incidentElementActivityName: element?.name || UNKNOWN
14191
- };
14192
- }
14193
- }
14194
-
14195
- /**
14196
- * Creates methods for a process instance
14197
- *
14198
- * @param instanceData - The process instance data (response from API)
14199
- * @param service - The process instance service instance
14200
- * @returns Object containing process instance methods
14201
- */
14202
- function createProcessInstanceMethods(instanceData, service) {
14569
+ function createProcessInstanceMethods(instanceData, service) {
14203
14570
  return {
14204
14571
  async cancel(options) {
14205
14572
  if (!instanceData.instanceId)
@@ -14222,6 +14589,13 @@
14222
14589
  throw new Error('Process instance folder key is undefined');
14223
14590
  return service.resume(instanceData.instanceId, instanceData.folderKey, options);
14224
14591
  },
14592
+ async retry(options) {
14593
+ if (!instanceData.instanceId)
14594
+ throw new Error('Process instance ID is undefined');
14595
+ if (!instanceData.folderKey)
14596
+ throw new Error('Process instance folder key is undefined');
14597
+ return service.retry(instanceData.instanceId, instanceData.folderKey, options);
14598
+ },
14225
14599
  async getIncidents() {
14226
14600
  if (!instanceData.instanceId)
14227
14601
  throw new Error('Process instance ID is undefined');
@@ -14318,7 +14692,36 @@
14318
14692
  throw new Error('Process key is undefined');
14319
14693
  if (!caseData.packageId)
14320
14694
  throw new Error('Package ID is undefined');
14321
- return service.getElementStats(caseData.processKey, caseData.packageId, startTime, endTime, packageVersion);
14695
+ return service.getElementStats({
14696
+ processKey: caseData.processKey,
14697
+ packageId: caseData.packageId,
14698
+ packageVersion,
14699
+ startTime,
14700
+ endTime,
14701
+ });
14702
+ },
14703
+ getInstanceStats(startTime, endTime, packageVersion) {
14704
+ if (!caseData.processKey)
14705
+ throw new Error('Process key is undefined');
14706
+ if (!caseData.packageId)
14707
+ throw new Error('Package ID is undefined');
14708
+ return service.getInstanceStats({
14709
+ processKey: caseData.processKey,
14710
+ packageId: caseData.packageId,
14711
+ packageVersion,
14712
+ startTime,
14713
+ endTime,
14714
+ });
14715
+ },
14716
+ getInstanceStatusTimeline(startTime, endTime, options) {
14717
+ if (!caseData.processKey)
14718
+ throw new Error('Process key is undefined');
14719
+ return service.getInstanceStatusTimeline(startTime, endTime, { ...options, processKeys: [caseData.processKey] });
14720
+ },
14721
+ getIncidentsTimeline(startTime, endTime, options) {
14722
+ if (!caseData.processKey)
14723
+ throw new Error('Process key is undefined');
14724
+ return service.getIncidentsTimeline(startTime, endTime, { ...options, processKeys: [caseData.processKey] });
14322
14725
  }
14323
14726
  };
14324
14727
  }
@@ -14535,6 +14938,196 @@
14535
14938
  InstanceFinalStatus["Cancelled"] = "Cancelled";
14536
14939
  })(exports.InstanceFinalStatus || (exports.InstanceFinalStatus = {}));
14537
14940
 
14941
+ /**
14942
+ * Builds the request body for Insights RTM "top" endpoints.
14943
+ *
14944
+ * @param startTime - Start of the time range to query
14945
+ * @param endTime - End of the time range to query
14946
+ * @param isCaseManagement - Whether to filter for case management processes
14947
+ * @param options - Optional filters (packageId, processKey, version)
14948
+ * @returns Request body for the Insights RTM endpoint
14949
+ * @internal
14950
+ */
14951
+ function buildInsightsTopBody(startTime, endTime, isCaseManagement, options) {
14952
+ return {
14953
+ commonParams: {
14954
+ startTime: startTime.getTime(),
14955
+ endTime: endTime.getTime(),
14956
+ isCaseManagement,
14957
+ ...(options?.packageId ? { packageId: options.packageId } : {}),
14958
+ ...(options?.processKey ? { processKey: options.processKey } : {}),
14959
+ ...(options?.version ? { version: options.version } : {}),
14960
+ }
14961
+ };
14962
+ }
14963
+ /**
14964
+ * Builds the request body for Insights RTM timeline endpoints
14965
+ * (`InstanceStatusByDate`, `IncidentsByTimeWindow`).
14966
+ *
14967
+ * @param startTime - Start of the time range to query
14968
+ * @param endTime - End of the time range to query
14969
+ * @param isCaseManagement - Whether to filter for case management processes
14970
+ * @param options - Optional time bucketing and filtering settings
14971
+ * @returns Request body for the Insights RTM timeline endpoint
14972
+ * @internal
14973
+ */
14974
+ function buildInsightsTimelineBody(startTime, endTime, isCaseManagement, options) {
14975
+ return {
14976
+ commonParams: {
14977
+ startTime: startTime.getTime(),
14978
+ endTime: endTime.getTime(),
14979
+ isCaseManagement,
14980
+ ...(options?.packageId ? { packageId: options.packageId } : {}),
14981
+ ...(options?.version ? { version: options.version } : {}),
14982
+ ...(options?.processKeys ? { processKeys: options.processKeys } : {}),
14983
+ },
14984
+ timeSliceUnit: options?.groupBy ?? exports.TimeInterval.Day,
14985
+ timezoneOffset: new Date().getTimezoneOffset() * -1,
14986
+ };
14987
+ }
14988
+ /**
14989
+ * Builds the commonParams request body for Insights RTM endpoints
14990
+ * that filter by process key, package, time range, and version.
14991
+ *
14992
+ * @param request - Process scope + time range to aggregate over
14993
+ * @returns Request body with commonParams
14994
+ * @internal
14995
+ */
14996
+ function buildInsightsCommonBody(request) {
14997
+ return {
14998
+ commonParams: {
14999
+ processKey: request.processKey,
15000
+ packageId: request.packageId,
15001
+ startTime: request.startTime.getTime(),
15002
+ endTime: request.endTime.getTime(),
15003
+ version: request.packageVersion
15004
+ }
15005
+ };
15006
+ }
15007
+
15008
+ /**
15009
+ * Maps fields for Incident entities
15010
+ */
15011
+ const ProcessIncidentMap = {
15012
+ errorTimeUtc: 'errorTime'
15013
+ };
15014
+ /**
15015
+ * Maps fields for Incident Summary entities
15016
+ */
15017
+ const ProcessIncidentSummaryMap = {
15018
+ firstTimeUtc: 'firstOccuranceTime'
15019
+ };
15020
+
15021
+ /**
15022
+ * Helpers for fetching BPMN XML and extracting element details used to annotate responses
15023
+ */
15024
+ class BpmnHelpers {
15025
+ /**
15026
+ * Parse BPMN XML and extract element id → {name,type} used for incidents
15027
+ */
15028
+ static parseBpmnElementsForIncidents(bpmnXml) {
15029
+ const elementInfo = {};
15030
+ try {
15031
+ // Find <bpmn:...> start tags and capture the element type.
15032
+ // Then read 'id' and 'name' attributes from each tag.
15033
+ const bpmnOpenTagRegex = /<bpmn:([A-Za-z][\w.-]*)\b[^>]*>/g;
15034
+ for (const tagMatch of bpmnXml.matchAll(bpmnOpenTagRegex)) {
15035
+ const [fullTag, elementType] = tagMatch;
15036
+ // Extract attributes from the current tag text.
15037
+ const idMatch = /\bid\s*=\s*"([^"]*)"/.exec(fullTag);
15038
+ if (!idMatch) {
15039
+ continue;
15040
+ }
15041
+ const elementId = idMatch[1];
15042
+ const nameMatch = /\bname\s*=\s*"([^"]*)"/.exec(fullTag);
15043
+ const name = nameMatch ? nameMatch[1] : '';
15044
+ // Convert BPMN element type to human-readable format
15045
+ const activityType = this.formatActivityTypeForIncidents(elementType);
15046
+ const activityName = name || elementId;
15047
+ elementInfo[elementId] = {
15048
+ type: activityType,
15049
+ name: activityName
15050
+ };
15051
+ }
15052
+ }
15053
+ catch (error) {
15054
+ console.warn('Failed to parse BPMN XML for incidents:', error);
15055
+ }
15056
+ return elementInfo;
15057
+ }
15058
+ /**
15059
+ * Format BPMN element type to human-readable activity type for incidents
15060
+ */
15061
+ static formatActivityTypeForIncidents(elementType) {
15062
+ // Convert camelCase BPMN element types to human-readable format
15063
+ // e.g., "serviceTask" -> "Service Task", "exclusiveGateway" -> "Exclusive Gateway"
15064
+ return elementType
15065
+ .replace(/([A-Z])/g, ' $1') // Add space before uppercase letters
15066
+ .replace(/^./, str => str.toUpperCase()) // Capitalize first letter
15067
+ .trim(); // Remove any leading/trailing spaces
15068
+ }
15069
+ /**
15070
+ * Fetch BPMN via getBpmn and add element name/type to each incident
15071
+ */
15072
+ static async enrichIncidentsWithBpmnData(incidents, folderKey, service) {
15073
+ // Check if all incidents have the same instanceId
15074
+ const uniqueInstanceIds = [...new Set(incidents.map(i => i.instanceId))];
15075
+ if (uniqueInstanceIds.length === 1) {
15076
+ // Single instance optimization (in case of process instance incidents)
15077
+ const elementInfo = await this.getBpmnElementInfo(uniqueInstanceIds[0], folderKey, service);
15078
+ return incidents.map((incident) => this.transformIncidentWithBpmn(incident, elementInfo));
15079
+ }
15080
+ else {
15081
+ // Multiple instances optimization (in case of process incidents)
15082
+ return this.enrichMultipleInstanceIncidents(incidents, folderKey, service);
15083
+ }
15084
+ }
15085
+ /**
15086
+ * When incidents span multiple instances, fetch BPMN per instance and annotate
15087
+ */
15088
+ static async enrichMultipleInstanceIncidents(incidents, folderKey, service) {
15089
+ const groups = incidents.reduce((acc, incident) => {
15090
+ const id = incident.instanceId || NO_INSTANCE;
15091
+ (acc[id] = acc[id] || []).push(incident);
15092
+ return acc;
15093
+ }, {});
15094
+ const results = await Promise.all(Object.entries(groups).map(async (entry) => {
15095
+ const [instanceId, groupIncidents] = entry;
15096
+ const elementInfo = await this.getBpmnElementInfo(instanceId, folderKey, service);
15097
+ return groupIncidents.map((incident) => this.transformIncidentWithBpmn(incident, elementInfo));
15098
+ }));
15099
+ return results.flat();
15100
+ }
15101
+ /**
15102
+ * Retrieve BPMN XML for an instance and derive element id → {name,type}
15103
+ */
15104
+ static async getBpmnElementInfo(instanceId, folderKey, service) {
15105
+ if (!instanceId || instanceId === NO_INSTANCE) {
15106
+ return {};
15107
+ }
15108
+ try {
15109
+ const bpmnXml = await service.getBpmn(instanceId, folderKey);
15110
+ return this.parseBpmnElementsForIncidents(bpmnXml);
15111
+ }
15112
+ catch (error) {
15113
+ console.warn(`Failed to get BPMN for instance ${instanceId}:`, error);
15114
+ return {};
15115
+ }
15116
+ }
15117
+ /**
15118
+ * Transform a raw incident by attaching element name/type from BPMN
15119
+ */
15120
+ static transformIncidentWithBpmn(incident, elementInfo) {
15121
+ const element = elementInfo[incident.elementId];
15122
+ const transformed = transformData(incident, ProcessIncidentMap);
15123
+ return {
15124
+ ...transformed,
15125
+ incidentElementActivityType: element?.type || UNKNOWN,
15126
+ incidentElementActivityName: element?.name || UNKNOWN
15127
+ };
15128
+ }
15129
+ }
15130
+
14538
15131
  /**
14539
15132
  * Maps fields for Process Instance entities to ensure consistent naming
14540
15133
  */
@@ -14610,7 +15203,7 @@
14610
15203
  }, options);
14611
15204
  }
14612
15205
  /**
14613
- * Get a process instance by ID with operation methods (cancel, pause, resume)
15206
+ * Get a process instance by ID with operation methods (cancel, pause, resume, retry)
14614
15207
  * @param id The ID of the instance to retrieve
14615
15208
  * @param folderKey The folder key for authorization
14616
15209
  * @returns Promise<ProcessInstanceGetResponse>
@@ -14749,6 +15342,25 @@
14749
15342
  data: response.data
14750
15343
  };
14751
15344
  }
15345
+ /**
15346
+ * Retry a faulted process instance
15347
+ *
15348
+ * Re-runs the failed elements of the instance (and the elements that follow) within
15349
+ * the same instance, spawning new jobs. Use to recover from transient/flaky failures.
15350
+ * @param instanceId The ID of the instance to retry
15351
+ * @param folderKey The folder key for authorization
15352
+ * @param options Optional retry options with comment
15353
+ * @returns Promise resolving to operation result with updated instance data
15354
+ */
15355
+ async retry(instanceId, folderKey, options) {
15356
+ const response = await this.post(MAESTRO_ENDPOINTS.INSTANCES.RETRY(instanceId), options || {}, {
15357
+ headers: createHeaders({ [FOLDER_KEY]: folderKey })
15358
+ });
15359
+ return {
15360
+ success: true,
15361
+ data: response.data
15362
+ };
15363
+ }
14752
15364
  /**
14753
15365
  * Parses BPMN XML to extract variable metadata from uipath:inputOutput elements
14754
15366
  * @private
@@ -14899,6 +15511,9 @@
14899
15511
  __decorate([
14900
15512
  track('ProcessInstances.Resume')
14901
15513
  ], ProcessInstancesService.prototype, "resume", null);
15514
+ __decorate([
15515
+ track('ProcessInstances.Retry')
15516
+ ], ProcessInstancesService.prototype, "retry", null);
14902
15517
  __decorate([
14903
15518
  track('ProcessInstances.GetVariables')
14904
15519
  ], ProcessInstancesService.prototype, "getVariables", null);
@@ -15055,7 +15670,7 @@
15055
15670
  *
15056
15671
  * @param startTime - Start of the time range to query
15057
15672
  * @param endTime - End of the time range to query
15058
- * @param options - Optional settings for time bucketing granularity
15673
+ * @param options - Optional settings for filtering and time bucket granularity
15059
15674
  * @returns Promise resolving to an array of {@link InstanceStatusTimelineResponse}
15060
15675
  *
15061
15676
  * @example
@@ -15082,12 +15697,67 @@
15082
15697
  *
15083
15698
  * @example
15084
15699
  * ```typescript
15700
+ * // Filter to a specific process
15701
+ * const filtered = await maestroProcesses.getInstanceStatusTimeline(startTime, endTime, {
15702
+ * processKeys: ['<processKey>'],
15703
+ * });
15704
+ * ```
15705
+ *
15706
+ * @example
15707
+ * ```typescript
15085
15708
  * // Get all-time data (from Unix epoch to now)
15086
15709
  * const allTime = await maestroProcesses.getInstanceStatusTimeline(new Date(0), new Date());
15087
15710
  * ```
15088
15711
  */
15089
15712
  async getInstanceStatusTimeline(startTime, endTime, options) {
15090
- return fetchInstanceStatusTimeline(this.post.bind(this), startTime, endTime, false, options);
15713
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.INSTANCE_STATUS_BY_DATE, buildInsightsTimelineBody(startTime, endTime, false, options));
15714
+ return data ?? [];
15715
+ }
15716
+ /**
15717
+ * Get incident counts aggregated by time bucket for maestro processes.
15718
+ *
15719
+ * Returns time-grouped counts of incidents that occurred within each bucket,
15720
+ * useful for rendering incident time-series charts. Use `groupBy` to control
15721
+ * the time bucket size (hour, day, or week) — defaults to day if not provided.
15722
+ *
15723
+ * @param startTime - Start of the time range to query
15724
+ * @param endTime - End of the time range to query
15725
+ * @param options - Optional settings for filtering and time bucket granularity
15726
+ * @returns Promise resolving to an array of {@link IncidentTimelineResponse}
15727
+ *
15728
+ * @example
15729
+ * ```typescript
15730
+ * // Get daily incident counts for the last 7 days
15731
+ * const now = new Date();
15732
+ * const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
15733
+ * const incidents = await maestroProcesses.getIncidentsTimeline(sevenDaysAgo, now);
15734
+ *
15735
+ * for (const incident of incidents) {
15736
+ * console.log(`${incident.startTime} → ${incident.endTime}: ${incident.count} incidents`);
15737
+ * }
15738
+ * ```
15739
+ *
15740
+ * @example
15741
+ * ```typescript
15742
+ * import { TimeInterval } from '@uipath/uipath-typescript/maestro-processes';
15743
+ *
15744
+ * // Get weekly breakdown
15745
+ * const incidents = await maestroProcesses.getIncidentsTimeline(startTime, endTime, {
15746
+ * groupBy: TimeInterval.Week,
15747
+ * });
15748
+ * ```
15749
+ *
15750
+ * @example
15751
+ * ```typescript
15752
+ * // Filter to a specific process
15753
+ * const filtered = await maestroProcesses.getIncidentsTimeline(startTime, endTime, {
15754
+ * processKeys: ['<processKey>'],
15755
+ * });
15756
+ * ```
15757
+ */
15758
+ async getIncidentsTimeline(startTime, endTime, options) {
15759
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.INCIDENTS_BY_TIME_WINDOW, buildInsightsTimelineBody(startTime, endTime, false, options));
15760
+ return data?.dataPoints ?? [];
15091
15761
  }
15092
15762
  /**
15093
15763
  * Get the top 10 processes ranked by failure count within a time range.
@@ -15182,22 +15852,22 @@
15182
15852
  * Returns per-element execution counts (success, fail, terminated, paused, in-progress) and
15183
15853
  * duration percentile metrics (min, max, avg, p50, p95, p99) for BPMN elements within a process.
15184
15854
  *
15185
- * @param processKey - Process key to filter by
15186
- * @param packageId - Package identifier
15187
- * @param startTime - Start of the time range to query
15188
- * @param endTime - End of the time range to query
15189
- * @param packageVersion - Package version to filter by
15855
+ * @param request - Process scope + time range to aggregate over
15190
15856
  * @returns Promise resolving to an array of {@link ElementStats}
15191
15857
  * @example
15192
15858
  * ```typescript
15193
- * // Get element metrics for a process
15194
- * const elements = await maestroProcesses.getElementStats(
15195
- * '<processKey>',
15196
- * '<packageId>',
15197
- * new Date('2026-04-01'),
15198
- * new Date(),
15199
- * '1.0.1'
15200
- * );
15859
+ * // First, list processes to find the processKey, packageId, and available versions
15860
+ * const processes = await maestroProcesses.getAll();
15861
+ * const process = processes[0];
15862
+ *
15863
+ * // Get element metrics for that process
15864
+ * const elements = await maestroProcesses.getElementStats({
15865
+ * processKey: process.processKey,
15866
+ * packageId: process.packageId,
15867
+ * packageVersion: process.packageVersions[0],
15868
+ * startTime: new Date('2026-04-01'),
15869
+ * endTime: new Date(),
15870
+ * });
15201
15871
  *
15202
15872
  * // Analyze element performance
15203
15873
  * for (const element of elements) {
@@ -15205,12 +15875,58 @@
15205
15875
  * console.log(` Success: ${element.successCount}, Failed: ${element.failCount}`);
15206
15876
  * console.log(` Avg duration: ${element.avgDurationMs}ms, P95: ${element.p95DurationMs}ms`);
15207
15877
  * }
15878
+ *
15879
+ * // Using bound method on a process — auto-fills processKey and packageId
15880
+ * const boundElements = await process.getElementStats(
15881
+ * new Date('2026-04-01'),
15882
+ * new Date(),
15883
+ * process.packageVersions[0]
15884
+ * );
15208
15885
  * ```
15209
15886
  */
15210
- async getElementStats(processKey, packageId, startTime, endTime, packageVersion) {
15211
- const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.ELEMENT_COUNT_BY_STATUS, buildElementCountByStatusBody(processKey, packageId, startTime, endTime, packageVersion));
15887
+ async getElementStats(request) {
15888
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.ELEMENT_COUNT_BY_STATUS, buildInsightsCommonBody(request));
15212
15889
  return data ?? [];
15213
15890
  }
15891
+ /**
15892
+ * Get instance stats for a process.
15893
+ *
15894
+ * Returns total instance counts broken down by status (running, completed, faulted, etc.)
15895
+ * and the average execution duration for all instances of a process within a time range.
15896
+ *
15897
+ * @param request - Process scope + time range to aggregate over
15898
+ * @returns Promise resolving to {@link InstanceStats}
15899
+ * @example
15900
+ * ```typescript
15901
+ * // First, list processes to find the processKey, packageId, and available versions
15902
+ * const processes = await maestroProcesses.getAll();
15903
+ * const process = processes[0];
15904
+ *
15905
+ * // Get instance status breakdown for that process
15906
+ * const counts = await maestroProcesses.getInstanceStats({
15907
+ * processKey: process.processKey,
15908
+ * packageId: process.packageId,
15909
+ * packageVersion: process.packageVersions[0],
15910
+ * startTime: new Date('2026-04-01'),
15911
+ * endTime: new Date(),
15912
+ * });
15913
+ *
15914
+ * console.log(`Total: ${counts.totalCount}`);
15915
+ * console.log(`Running: ${counts.runningCount}, Completed: ${counts.completedCount}`);
15916
+ * console.log(`Faulted: ${counts.faultedCount}, Avg duration: ${counts.avgDurationMs}ms`);
15917
+ *
15918
+ * // Using bound method on a process — auto-fills processKey and packageId
15919
+ * const boundCounts = await process.getInstanceStats(
15920
+ * new Date('2026-04-01'),
15921
+ * new Date(),
15922
+ * process.packageVersions[0]
15923
+ * );
15924
+ * ```
15925
+ */
15926
+ async getInstanceStats(request) {
15927
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.INSTANCE_COUNT_BY_STATUS, buildInsightsCommonBody(request));
15928
+ return transformData(data, InstanceStatsMap);
15929
+ }
15214
15930
  }
15215
15931
  __decorate([
15216
15932
  track('MaestroProcesses.GetAll')
@@ -15227,6 +15943,9 @@
15227
15943
  __decorate([
15228
15944
  track('MaestroProcesses.GetInstanceStatusTimeline')
15229
15945
  ], MaestroProcessesService.prototype, "getInstanceStatusTimeline", null);
15946
+ __decorate([
15947
+ track('MaestroProcesses.GetIncidentsTimeline')
15948
+ ], MaestroProcessesService.prototype, "getIncidentsTimeline", null);
15230
15949
  __decorate([
15231
15950
  track('MaestroProcesses.GetTopFaultedCount')
15232
15951
  ], MaestroProcessesService.prototype, "getTopFaultedCount", null);
@@ -15236,6 +15955,9 @@
15236
15955
  __decorate([
15237
15956
  track('MaestroProcesses.GetElementStats')
15238
15957
  ], MaestroProcessesService.prototype, "getElementStats", null);
15958
+ __decorate([
15959
+ track('MaestroProcesses.GetInstanceStats')
15960
+ ], MaestroProcessesService.prototype, "getInstanceStats", null);
15239
15961
 
15240
15962
  /**
15241
15963
  * Service class for Maestro Process Incidents
@@ -15416,7 +16138,7 @@
15416
16138
  *
15417
16139
  * @param startTime - Start of the time range to query
15418
16140
  * @param endTime - End of the time range to query
15419
- * @param options - Optional settings for time bucketing granularity
16141
+ * @param options - Optional settings for filtering and time bucket granularity
15420
16142
  * @returns Promise resolving to an array of {@link InstanceStatusTimelineResponse}
15421
16143
  *
15422
16144
  * @example
@@ -15443,12 +16165,67 @@
15443
16165
  *
15444
16166
  * @example
15445
16167
  * ```typescript
16168
+ * // Filter to a specific case process
16169
+ * const filtered = await cases.getInstanceStatusTimeline(startTime, endTime, {
16170
+ * processKeys: ['<processKey>'],
16171
+ * });
16172
+ * ```
16173
+ *
16174
+ * @example
16175
+ * ```typescript
15446
16176
  * // Get all-time data (from Unix epoch to now)
15447
16177
  * const allTime = await cases.getInstanceStatusTimeline(new Date(0), new Date());
15448
16178
  * ```
15449
16179
  */
15450
16180
  async getInstanceStatusTimeline(startTime, endTime, options) {
15451
- return fetchInstanceStatusTimeline(this.post.bind(this), startTime, endTime, true, options);
16181
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.INSTANCE_STATUS_BY_DATE, buildInsightsTimelineBody(startTime, endTime, true, options));
16182
+ return data ?? [];
16183
+ }
16184
+ /**
16185
+ * Get incident counts aggregated by time bucket for case management processes.
16186
+ *
16187
+ * Returns time-grouped counts of incidents that occurred within each bucket,
16188
+ * useful for rendering incident time-series charts. Use `groupBy` to control
16189
+ * the time bucket size (hour, day, or week) — defaults to day if not provided.
16190
+ *
16191
+ * @param startTime - Start of the time range to query
16192
+ * @param endTime - End of the time range to query
16193
+ * @param options - Optional settings for filtering and time bucket granularity
16194
+ * @returns Promise resolving to an array of {@link IncidentTimelineResponse}
16195
+ *
16196
+ * @example
16197
+ * ```typescript
16198
+ * // Get daily incident counts for the last 7 days
16199
+ * const now = new Date();
16200
+ * const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
16201
+ * const incidents = await cases.getIncidentsTimeline(sevenDaysAgo, now);
16202
+ *
16203
+ * for (const incident of incidents) {
16204
+ * console.log(`${incident.startTime} → ${incident.endTime}: ${incident.count} incidents`);
16205
+ * }
16206
+ * ```
16207
+ *
16208
+ * @example
16209
+ * ```typescript
16210
+ * import { TimeInterval } from '@uipath/uipath-typescript/cases';
16211
+ *
16212
+ * // Get weekly breakdown
16213
+ * const incidents = await cases.getIncidentsTimeline(startTime, endTime, {
16214
+ * groupBy: TimeInterval.Week,
16215
+ * });
16216
+ * ```
16217
+ *
16218
+ * @example
16219
+ * ```typescript
16220
+ * // Filter to a specific case process
16221
+ * const filtered = await cases.getIncidentsTimeline(startTime, endTime, {
16222
+ * processKeys: ['<processKey>'],
16223
+ * });
16224
+ * ```
16225
+ */
16226
+ async getIncidentsTimeline(startTime, endTime, options) {
16227
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.INCIDENTS_BY_TIME_WINDOW, buildInsightsTimelineBody(startTime, endTime, true, options));
16228
+ return data?.dataPoints ?? [];
15452
16229
  }
15453
16230
  /**
15454
16231
  * Get the top 10 case processes ranked by failure count within a time range.
@@ -15543,34 +16320,79 @@
15543
16320
  * Returns per-element execution counts (success, fail, terminated, paused, in-progress) and
15544
16321
  * duration percentile metrics (min, max, avg, p50, p95, p99) for BPMN elements within a case.
15545
16322
  *
15546
- * @param processKey - Process key to filter by
15547
- * @param packageId - Package identifier
15548
- * @param startTime - Start of the time range to query
15549
- * @param endTime - End of the time range to query
15550
- * @param packageVersion - Package version to filter by
16323
+ * @param request - Process scope + time range to aggregate over
15551
16324
  * @returns Promise resolving to an array of {@link ElementStats}
15552
16325
  * @example
15553
16326
  * ```typescript
15554
- * // Get element metrics for a case
15555
- * const elements = await cases.getElementStats(
15556
- * '<processKey>',
15557
- * '<packageId>',
15558
- * new Date('2026-04-01'),
15559
- * new Date(),
15560
- * '1.0.1'
15561
- * );
16327
+ * // First, list cases to find the processKey, packageId, and available versions
16328
+ * const allCases = await cases.getAll();
16329
+ * const caseItem = allCases[0];
16330
+ *
16331
+ * // Get element metrics for that case
16332
+ * const elements = await cases.getElementStats({
16333
+ * processKey: caseItem.processKey,
16334
+ * packageId: caseItem.packageId,
16335
+ * packageVersion: caseItem.packageVersions[0],
16336
+ * startTime: new Date('2026-04-01'),
16337
+ * endTime: new Date(),
16338
+ * });
15562
16339
  *
15563
16340
  * // Find elements with failures
15564
16341
  * const failedElements = elements.filter(e => e.failCount > 0);
15565
16342
  * for (const element of failedElements) {
15566
16343
  * console.log(`Failed element: ${element.elementId}, failures: ${element.failCount}`);
15567
16344
  * }
16345
+ *
16346
+ * // Using bound method on a case — auto-fills processKey and packageId
16347
+ * const boundElements = await caseItem.getElementStats(
16348
+ * new Date('2026-04-01'),
16349
+ * new Date(),
16350
+ * caseItem.packageVersions[0]
16351
+ * );
15568
16352
  * ```
15569
16353
  */
15570
- async getElementStats(processKey, packageId, startTime, endTime, packageVersion) {
15571
- const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.ELEMENT_COUNT_BY_STATUS, buildElementCountByStatusBody(processKey, packageId, startTime, endTime, packageVersion));
16354
+ async getElementStats(request) {
16355
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.ELEMENT_COUNT_BY_STATUS, buildInsightsCommonBody(request));
15572
16356
  return data ?? [];
15573
16357
  }
16358
+ /**
16359
+ * Get instance stats for a case.
16360
+ *
16361
+ * Returns total instance counts broken down by status (running, completed, faulted, etc.)
16362
+ * and the average execution duration for all instances of a case within a time range.
16363
+ *
16364
+ * @param request - Process scope + time range to aggregate over
16365
+ * @returns Promise resolving to {@link InstanceStats}
16366
+ * @example
16367
+ * ```typescript
16368
+ * // First, list cases to find the processKey, packageId, and available versions
16369
+ * const allCases = await cases.getAll();
16370
+ * const caseItem = allCases[0];
16371
+ *
16372
+ * // Get instance status breakdown for that case
16373
+ * const counts = await cases.getInstanceStats({
16374
+ * processKey: caseItem.processKey,
16375
+ * packageId: caseItem.packageId,
16376
+ * packageVersion: caseItem.packageVersions[0],
16377
+ * startTime: new Date('2026-04-01'),
16378
+ * endTime: new Date(),
16379
+ * });
16380
+ *
16381
+ * console.log(`Total: ${counts.totalCount}`);
16382
+ * console.log(`Completed: ${counts.completedCount}, Faulted: ${counts.faultedCount}`);
16383
+ *
16384
+ * // Using bound method on a case — auto-fills processKey and packageId
16385
+ * const boundCounts = await caseItem.getInstanceStats(
16386
+ * new Date('2026-04-01'),
16387
+ * new Date(),
16388
+ * caseItem.packageVersions[0]
16389
+ * );
16390
+ * ```
16391
+ */
16392
+ async getInstanceStats(request) {
16393
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.INSTANCE_COUNT_BY_STATUS, buildInsightsCommonBody(request));
16394
+ return transformData(data, InstanceStatsMap);
16395
+ }
15574
16396
  /**
15575
16397
  * Extract a readable case name from the packageId
15576
16398
  * @param packageId - The full package identifier
@@ -15602,6 +16424,9 @@
15602
16424
  __decorate([
15603
16425
  track('Cases.GetInstanceStatusTimeline')
15604
16426
  ], CasesService.prototype, "getInstanceStatusTimeline", null);
16427
+ __decorate([
16428
+ track('Cases.GetIncidentsTimeline')
16429
+ ], CasesService.prototype, "getIncidentsTimeline", null);
15605
16430
  __decorate([
15606
16431
  track('Cases.GetTopFaultedCount')
15607
16432
  ], CasesService.prototype, "getTopFaultedCount", null);
@@ -15611,6 +16436,9 @@
15611
16436
  __decorate([
15612
16437
  track('Cases.GetElementStats')
15613
16438
  ], CasesService.prototype, "getElementStats", null);
16439
+ __decorate([
16440
+ track('Cases.GetInstanceStats')
16441
+ ], CasesService.prototype, "getInstanceStats", null);
15614
16442
 
15615
16443
  /**
15616
16444
  * Maps fields for Case Instance entities to ensure consistent naming
@@ -15916,6 +16744,10 @@
15916
16744
  const transformedTask = transformData(pascalToCamelCaseKeys(task), TaskMap);
15917
16745
  return createTaskWithMethods(applyDataTransforms(transformedTask, { field: 'status', valueMap: TaskStatusMap }), this);
15918
16746
  };
16747
+ // Rewrite renamed SDK field names → API names inside OData strings
16748
+ // before delegating, mirroring the transformRequest pattern used for
16749
+ // request bodies.
16750
+ const apiOptions = options ? transformOptions(options, TaskMap) : options;
15919
16751
  return PaginationHelpers.getAll({
15920
16752
  serviceAccess: this.createPaginationServiceAccess(),
15921
16753
  getEndpoint: () => endpoint,
@@ -15932,7 +16764,7 @@
15932
16764
  countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM // OData OFFSET parameter
15933
16765
  }
15934
16766
  }
15935
- }, options);
16767
+ }, apiOptions);
15936
16768
  }
15937
16769
  /**
15938
16770
  * Gets a task by ID
@@ -15968,9 +16800,10 @@
15968
16800
  const headers = createHeaders({ [FOLDER_ID]: folderId });
15969
16801
  // Add default expand parameters
15970
16802
  const modifiedOptions = this.addDefaultExpand(restOptions);
15971
- // prefix all keys in options
15972
- const keysToPrefix = Object.keys(modifiedOptions);
15973
- const apiOptions = addPrefixToKeys(modifiedOptions, ODATA_PREFIX, keysToPrefix);
16803
+ // Rewrite renamed SDK field names → API names inside OData strings,
16804
+ // then prefix all keys for OData.
16805
+ const apiFieldOptions = transformOptions(modifiedOptions, TaskMap);
16806
+ const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
15974
16807
  const response = await this.get(TASK_ENDPOINTS.GET_BY_ID(id), {
15975
16808
  params: apiOptions,
15976
16809
  headers
@@ -16963,9 +17796,12 @@
16963
17796
  * @param name - Resource name to search for
16964
17797
  * @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) + OData query options (`expand`, `select`)
16965
17798
  * @param transform - Maps a raw OData item to the typed response (e.g. PascalCase → camelCase via field map)
17799
+ * @param responseFieldMap - Optional response field map (API → SDK), reversed internally by
17800
+ * `transformOptions` to rewrite SDK field names back to API names in user-supplied
17801
+ * `expand` / `select` (symmetric counterpart to `transform`)
16966
17802
  * @throws ValidationError when inputs are malformed; NotFoundError when no match
16967
17803
  */
16968
- async getByNameLookup(resourceType, endpoint, name, options, transform) {
17804
+ async getByNameLookup(resourceType, endpoint, name, options, transform, responseFieldMap) {
16969
17805
  const validatedName = validateName(resourceType, name);
16970
17806
  const { folderId, folderKey, folderPath, ...queryOptions } = options;
16971
17807
  const headers = resolveFolderHeaders({
@@ -16975,8 +17811,11 @@
16975
17811
  resourceType: `${resourceType}.getByName`,
16976
17812
  fallbackFolderKey: this.config.folderKey,
16977
17813
  });
17814
+ const apiFieldOptions = responseFieldMap
17815
+ ? transformOptions(queryOptions, responseFieldMap)
17816
+ : queryOptions;
16978
17817
  const apiOptions = {
16979
- ...addPrefixToKeys(queryOptions, ODATA_PREFIX, Object.keys(queryOptions)),
17818
+ ...addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions)),
16980
17819
  '$filter': `Name eq '${validatedName.replace(SINGLE_QUOTE_RE, "''")}'`,
16981
17820
  '$top': '1',
16982
17821
  };
@@ -17076,6 +17915,10 @@
17076
17915
  async getAll(options) {
17077
17916
  // Transformation function for assets
17078
17917
  const transformAssetResponse = (asset) => transformData(pascalToCamelCaseKeys(asset), AssetMap);
17918
+ // Rewrite renamed SDK field names → API names inside OData strings
17919
+ // before delegating, mirroring the transformRequest pattern used for
17920
+ // request bodies.
17921
+ const apiOptions = options ? transformOptions(options, AssetMap) : options;
17079
17922
  return PaginationHelpers.getAll({
17080
17923
  serviceAccess: this.createPaginationServiceAccess(),
17081
17924
  getEndpoint: (folderId) => folderId ? ASSET_ENDPOINTS.GET_BY_FOLDER : ASSET_ENDPOINTS.GET_ALL,
@@ -17091,7 +17934,7 @@
17091
17934
  countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM
17092
17935
  }
17093
17936
  }
17094
- }, options);
17937
+ }, apiOptions);
17095
17938
  }
17096
17939
  /**
17097
17940
  * Gets a single asset by ID
@@ -17113,8 +17956,8 @@
17113
17956
  */
17114
17957
  async getById(id, folderId, options = {}) {
17115
17958
  const headers = createHeaders({ [FOLDER_ID]: folderId });
17116
- const keysToPrefix = Object.keys(options);
17117
- const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
17959
+ const apiFieldOptions = transformOptions(options, AssetMap);
17960
+ const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
17118
17961
  const response = await this.get(ASSET_ENDPOINTS.GET_BY_ID(id), {
17119
17962
  headers,
17120
17963
  params: apiOptions
@@ -17149,7 +17992,7 @@
17149
17992
  * ```
17150
17993
  */
17151
17994
  async getByName(name, options = {}) {
17152
- return this.getByNameLookup('Asset', ASSET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap));
17995
+ return this.getByNameLookup('Asset', ASSET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap), AssetMap);
17153
17996
  }
17154
17997
  /**
17155
17998
  * Updates the value of an existing asset by ID.
@@ -17423,6 +18266,9 @@
17423
18266
  });
17424
18267
  // Transformation function for blob items
17425
18268
  const transformBlobItem = (item) => transformData(item, BucketMap);
18269
+ // Rewrite renamed SDK field names → API names inside OData strings
18270
+ // before delegating.
18271
+ const apiRestOptions = transformOptions(restOptions, BucketMap);
17426
18272
  return PaginationHelpers.getAll({
17427
18273
  serviceAccess: this.createPaginationServiceAccess(),
17428
18274
  getEndpoint: () => BUCKET_ENDPOINTS.GET_FILE_META_DATA(bucketId),
@@ -17438,7 +18284,7 @@
17438
18284
  },
17439
18285
  excludeFromPrefix: ['prefix'], // Bucket-specific param, not OData
17440
18286
  headers,
17441
- }, restOptions);
18287
+ }, apiRestOptions);
17442
18288
  }
17443
18289
  async uploadFile(bucketIdOrOptions, path, content, options) {
17444
18290
  // Normalize the two overload forms into a single internal shape.
@@ -17522,9 +18368,10 @@
17522
18368
  resourceType: 'Buckets.getReadUri',
17523
18369
  fallbackFolderKey: this.config.folderKey,
17524
18370
  });
18371
+ const apiRestOptions = transformOptions(restOptions, BucketMap);
17525
18372
  const queryOptions = {
17526
18373
  expiryInMinutes,
17527
- ...addPrefixToKeys(restOptions, ODATA_PREFIX, Object.keys(restOptions))
18374
+ ...addPrefixToKeys(apiRestOptions, ODATA_PREFIX, Object.keys(apiRestOptions))
17528
18375
  };
17529
18376
  return this._getUri(BUCKET_ENDPOINTS.GET_READ_URI(bucketId), bucketId, resolvedPath, headers, queryOptions);
17530
18377
  }
@@ -17644,6 +18491,9 @@
17644
18491
  fallbackFolderKey: this.config.folderKey,
17645
18492
  });
17646
18493
  const transformBucketFile = (file) => transformData(pascalToCamelCaseKeys(file), BucketMap);
18494
+ // Rewrite renamed SDK field names → API names inside OData strings
18495
+ // before delegating.
18496
+ const apiRestOptions = transformOptions(restOptions, BucketMap);
17647
18497
  return PaginationHelpers.getAll({
17648
18498
  serviceAccess: this.createPaginationServiceAccess(),
17649
18499
  getEndpoint: () => BUCKET_ENDPOINTS.GET_FILES(bucketId),
@@ -17660,7 +18510,7 @@
17660
18510
  },
17661
18511
  excludeFromPrefix: ['directory', 'recursive', 'fileNameRegex'],
17662
18512
  headers,
17663
- }, { ...restOptions, directory: '/', recursive: true });
18513
+ }, { ...apiRestOptions, directory: '/', recursive: true });
17664
18514
  }
17665
18515
  /**
17666
18516
  * Deletes a file from a bucket
@@ -17707,9 +18557,10 @@
17707
18557
  */
17708
18558
  async _getWriteUri(options) {
17709
18559
  const { bucketId, path, expiryInMinutes, headers, ...restOptions } = options;
18560
+ const apiRestOptions = transformOptions(restOptions, BucketMap);
17710
18561
  const queryOptions = {
17711
18562
  expiryInMinutes,
17712
- ...addPrefixToKeys(restOptions, ODATA_PREFIX, Object.keys(restOptions))
18563
+ ...addPrefixToKeys(apiRestOptions, ODATA_PREFIX, Object.keys(apiRestOptions))
17713
18564
  };
17714
18565
  return this._getUri(BUCKET_ENDPOINTS.GET_WRITE_URI(bucketId), bucketId, path, headers, queryOptions);
17715
18566
  }
@@ -17842,9 +18693,10 @@
17842
18693
  if (!id) {
17843
18694
  throw new ValidationError({ message: 'id is required for getById' });
17844
18695
  }
17845
- // Prefix all keys in options with $ for OData
17846
- const keysToPrefix = Object.keys(options);
17847
- const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
18696
+ // Response applies both maps (BucketMap on blobFileAccess, AttachmentsMap on top-level);
18697
+ // merge so SDK names from either are rewritten in one pass.
18698
+ const apiFieldOptions = transformOptions(options, { ...AttachmentsMap, ...BucketMap });
18699
+ const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
17848
18700
  const response = await this.get(ORCHESTRATOR_ATTACHMENT_ENDPOINTS.GET_BY_ID(id), {
17849
18701
  params: apiOptions,
17850
18702
  });
@@ -18068,8 +18920,9 @@
18068
18920
  * const folderJobs = await jobs.getAll({ folderId: <folderId> });
18069
18921
  *
18070
18922
  * // With filtering
18071
- * const runningJobs = await jobs.getAll({
18072
- * filter: "state eq 'Running'"
18923
+ * const recentInvoiceJobs = await jobs.getAll({
18924
+ * filter: "processName eq 'InvoiceBot'",
18925
+ * orderby: 'createdTime desc',
18073
18926
  * });
18074
18927
  *
18075
18928
  * // First page with pagination
@@ -18092,6 +18945,10 @@
18092
18945
  const rawJob = transformData(pascalToCamelCaseKeys(job), JobMap);
18093
18946
  return createJobWithMethods(rawJob, this);
18094
18947
  };
18948
+ // Rewrite renamed SDK field names → API names inside OData strings
18949
+ // before delegating, mirroring the transformRequest pattern used for
18950
+ // request bodies.
18951
+ const apiOptions = options ? transformOptions(options, JobMap) : options;
18095
18952
  return PaginationHelpers.getAll({
18096
18953
  serviceAccess: this.createPaginationServiceAccess(),
18097
18954
  getEndpoint: () => JOB_ENDPOINTS.GET_ALL,
@@ -18107,7 +18964,7 @@
18107
18964
  countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM,
18108
18965
  },
18109
18966
  },
18110
- }, options);
18967
+ }, apiOptions);
18111
18968
  }
18112
18969
  /**
18113
18970
  * Gets a job by its unique key (GUID).
@@ -18144,8 +19001,8 @@
18144
19001
  throw new ValidationError({ message: 'folderId is required for getById' });
18145
19002
  }
18146
19003
  const headers = createHeaders({ [FOLDER_ID]: folderId });
18147
- const keysToPrefix = Object.keys(options ?? {});
18148
- const apiOptions = options ? addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix) : {};
19004
+ const apiFieldOptions = options ? transformOptions(options, JobMap) : {};
19005
+ const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
18149
19006
  const response = await this.get(JOB_ENDPOINTS.GET_BY_KEY(id), {
18150
19007
  params: apiOptions,
18151
19008
  headers,
@@ -18448,6 +19305,9 @@
18448
19305
  JobState["Stopped"] = "Stopped";
18449
19306
  JobState["Suspended"] = "Suspended";
18450
19307
  JobState["Resumed"] = "Resumed";
19308
+ JobState["Cancelled"] = "Cancelled";
19309
+ /** Server-side fallback for an unrecognized or missing job state. */
19310
+ JobState["Unknown"] = "Unknown";
18451
19311
  })(exports.JobState || (exports.JobState = {}));
18452
19312
 
18453
19313
  /**
@@ -18518,6 +19378,10 @@
18518
19378
  async getAll(options) {
18519
19379
  // Transformation function for processes
18520
19380
  const transformProcessResponse = (process) => transformData(pascalToCamelCaseKeys(process), ProcessMap);
19381
+ // Rewrite renamed SDK field names → API names inside OData strings
19382
+ // before delegating, mirroring the transformRequest pattern used for
19383
+ // request bodies.
19384
+ const apiOptions = options ? transformOptions(options, ProcessMap) : options;
18521
19385
  return PaginationHelpers.getAll({
18522
19386
  serviceAccess: this.createPaginationServiceAccess(),
18523
19387
  getEndpoint: () => PROCESS_ENDPOINTS.GET_ALL,
@@ -18533,7 +19397,7 @@
18533
19397
  countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM
18534
19398
  }
18535
19399
  }
18536
- }, options);
19400
+ }, apiOptions);
18537
19401
  }
18538
19402
  async start(request, optionsOrFolderId, legacyOptions) {
18539
19403
  // Normalize the two overload forms into a single internal shape.
@@ -18567,9 +19431,10 @@
18567
19431
  const requestBody = {
18568
19432
  startInfo: apiRequest
18569
19433
  };
18570
- // Prefix all query parameter keys with '$' for OData
18571
- const keysToPrefix = Object.keys(queryOptions);
18572
- const apiOptions = addPrefixToKeys(queryOptions, ODATA_PREFIX, keysToPrefix);
19434
+ // Rewrite renamed SDK field names API names inside OData strings,
19435
+ // then prefix all query parameter keys with '$' for OData.
19436
+ const apiFieldOptions = transformOptions(queryOptions, ProcessMap);
19437
+ const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
18573
19438
  const response = await this.post(PROCESS_ENDPOINTS.START_PROCESS, requestBody, {
18574
19439
  params: apiOptions,
18575
19440
  headers
@@ -18597,8 +19462,8 @@
18597
19462
  */
18598
19463
  async getById(id, folderId, options = {}) {
18599
19464
  const headers = createHeaders({ [FOLDER_ID]: folderId });
18600
- const keysToPrefix = Object.keys(options);
18601
- const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
19465
+ const apiFieldOptions = transformOptions(options, ProcessMap);
19466
+ const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
18602
19467
  const response = await this.get(PROCESS_ENDPOINTS.GET_BY_ID(id), {
18603
19468
  headers,
18604
19469
  params: apiOptions
@@ -18633,7 +19498,7 @@
18633
19498
  * ```
18634
19499
  */
18635
19500
  async getByName(name, options = {}) {
18636
- return this.getByNameLookup('Process', PROCESS_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), ProcessMap));
19501
+ return this.getByNameLookup('Process', PROCESS_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), ProcessMap), ProcessMap);
18637
19502
  }
18638
19503
  }
18639
19504
  __decorate([
@@ -18709,6 +19574,10 @@
18709
19574
  async getAll(options) {
18710
19575
  // Transformation function for queues
18711
19576
  const transformQueueResponse = (queue) => transformData(pascalToCamelCaseKeys(queue), QueueMap);
19577
+ // Rewrite renamed SDK field names → API names inside OData strings
19578
+ // before delegating, mirroring the transformRequest pattern used for
19579
+ // request bodies.
19580
+ const apiOptions = options ? transformOptions(options, QueueMap) : options;
18712
19581
  return PaginationHelpers.getAll({
18713
19582
  serviceAccess: this.createPaginationServiceAccess(),
18714
19583
  getEndpoint: (folderId) => folderId ? QUEUE_ENDPOINTS.GET_BY_FOLDER : QUEUE_ENDPOINTS.GET_ALL,
@@ -18724,7 +19593,7 @@
18724
19593
  countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM
18725
19594
  }
18726
19595
  }
18727
- }, options);
19596
+ }, apiOptions);
18728
19597
  }
18729
19598
  /**
18730
19599
  * Gets a single queue by ID
@@ -18745,8 +19614,8 @@
18745
19614
  */
18746
19615
  async getById(id, folderId, options = {}) {
18747
19616
  const headers = createHeaders({ [FOLDER_ID]: folderId });
18748
- const keysToPrefix = Object.keys(options);
18749
- const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
19617
+ const apiFieldOptions = transformOptions(options, QueueMap);
19618
+ const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
18750
19619
  const response = await this.get(QUEUE_ENDPOINTS.GET_BY_ID(id), {
18751
19620
  headers,
18752
19621
  params: apiOptions
@@ -18841,7 +19710,19 @@
18841
19710
  /**
18842
19711
  * Access to ChoiceSet service for managing choice sets
18843
19712
  */
18844
- choicesets: this.getService(ChoiceSetService)
19713
+ choicesets: this.getService(ChoiceSetService),
19714
+ /**
19715
+ * Access to Data Fabric roles for manage-access flows
19716
+ *
19717
+ * @internal
19718
+ */
19719
+ roles: this.getService(DataFabricRoleService),
19720
+ /**
19721
+ * Access to Data Fabric directory principals and role assignments
19722
+ *
19723
+ * @internal
19724
+ */
19725
+ directory: this.getService(DataFabricDirectoryService)
18845
19726
  });
18846
19727
  }
18847
19728
  /**
@@ -19169,9 +20050,9 @@
19169
20050
  AgentListSortColumn["HealthScore"] = "HealthScore";
19170
20051
  AgentListSortColumn["LastIncident"] = "LastIncident";
19171
20052
  AgentListSortColumn["FolderName"] = "FolderName";
19172
- /** Quantity of AGU (Agent Units) consumed */
20053
+ /** Quantity of Agent Units consumed */
19173
20054
  AgentListSortColumn["QuantityAGU"] = "QuantityAGU";
19174
- /** Quantity of PLTU (Platform Units) consumed */
20055
+ /** Quantity of Platform Units consumed */
19175
20056
  AgentListSortColumn["QuantityPLTU"] = "QuantityPLTU";
19176
20057
  AgentListSortColumn["FolderPath"] = "FolderPath";
19177
20058
  })(exports.AgentListSortColumn || (exports.AgentListSortColumn = {}));
@@ -19193,6 +20074,30 @@
19193
20074
  AgentErrorSortColumn["LastSeenFolderName"] = "LastSeenFolderName";
19194
20075
  AgentErrorSortColumn["LastSeenFolderPath"] = "LastSeenFolderPath";
19195
20076
  })(exports.AgentErrorSortColumn || (exports.AgentErrorSortColumn = {}));
20077
+ /**
20078
+ * Agent type, used to filter consumption results.
20079
+ *
20080
+ * Wire format is the string name, per the API's `StringEnumConverter` serialization.
20081
+ */
20082
+ exports.AgentType = void 0;
20083
+ (function (AgentType) {
20084
+ AgentType["Autonomous"] = "Autonomous";
20085
+ AgentType["Conversational"] = "Conversational";
20086
+ AgentType["Coded"] = "Coded";
20087
+ })(exports.AgentType || (exports.AgentType = {}));
20088
+ /**
20089
+ * Job execution mode filter accepted by the summary endpoints.
20090
+ *
20091
+ * Wire format is the string name (`"Debug"` / `"Runtime"`), per the API's
20092
+ * `StringEnumConverter` serialization.
20093
+ */
20094
+ exports.AgentExecutionType = void 0;
20095
+ (function (AgentExecutionType) {
20096
+ /** Test runs */
20097
+ AgentExecutionType["Debug"] = "Debug";
20098
+ /** Production runs */
20099
+ AgentExecutionType["Runtime"] = "Runtime";
20100
+ })(exports.AgentExecutionType || (exports.AgentExecutionType = {}));
19196
20101
 
19197
20102
  /**
19198
20103
  * Types for the Agent Memory metrics service.
@@ -19577,6 +20482,52 @@
19577
20482
  SpanAttachmentDirection["Out"] = "Out";
19578
20483
  })(exports.SpanAttachmentDirection || (exports.SpanAttachmentDirection = {}));
19579
20484
 
20485
+ // ─── Governance ─────────────────────────────────────────────────────
20486
+ /**
20487
+ * Evaluation mode of a governance decision.
20488
+ */
20489
+ exports.AgentGovernanceMode = void 0;
20490
+ (function (AgentGovernanceMode) {
20491
+ /** Policy evaluated and logged, but not enforced. */
20492
+ AgentGovernanceMode["Audit"] = "AUDIT";
20493
+ /** Policy evaluated and enforced. */
20494
+ AgentGovernanceMode["Enforce"] = "ENFORCE";
20495
+ /** Unrecognized or missing mode. */
20496
+ AgentGovernanceMode["Unknown"] = "Unknown";
20497
+ })(exports.AgentGovernanceMode || (exports.AgentGovernanceMode = {}));
20498
+ /**
20499
+ * Verdict of a governance decision (`Deny` = violation).
20500
+ */
20501
+ exports.AgentGovernanceVerdict = void 0;
20502
+ (function (AgentGovernanceVerdict) {
20503
+ /** Allowed — not a violation. */
20504
+ AgentGovernanceVerdict["Allow"] = "ALLOW";
20505
+ /** Denied — counts as a violation. */
20506
+ AgentGovernanceVerdict["Deny"] = "DENY";
20507
+ /** Unrecognized or missing verdict. */
20508
+ AgentGovernanceVerdict["Unknown"] = "Unknown";
20509
+ })(exports.AgentGovernanceVerdict || (exports.AgentGovernanceVerdict = {}));
20510
+ /**
20511
+ * Sections the governance summary can compute. `action` and `mode` are opt-in.
20512
+ */
20513
+ exports.AgentGovernanceSection = void 0;
20514
+ (function (AgentGovernanceSection) {
20515
+ /** Scalar totals (`total`, `violations`). */
20516
+ AgentGovernanceSection["Totals"] = "totals";
20517
+ /** Breakdown by governance hook. */
20518
+ AgentGovernanceSection["Hook"] = "hook";
20519
+ /** Breakdown by agent. */
20520
+ AgentGovernanceSection["Agent"] = "agent";
20521
+ /** Breakdown by policy. */
20522
+ AgentGovernanceSection["Policy"] = "policy";
20523
+ /** Breakdown by governance pack. */
20524
+ AgentGovernanceSection["Pack"] = "pack";
20525
+ /** Breakdown by enforcement action (opt-in). */
20526
+ AgentGovernanceSection["Action"] = "action";
20527
+ /** Breakdown by evaluation mode (opt-in). */
20528
+ AgentGovernanceSection["Mode"] = "mode";
20529
+ })(exports.AgentGovernanceSection || (exports.AgentGovernanceSection = {}));
20530
+
19580
20531
  /**
19581
20532
  * Asset resolution utilities for UiPath Coded Apps
19582
20533
  *