@uipath/uipath-typescript 1.4.2 → 1.5.0

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 (43) hide show
  1. package/dist/agent-memory/index.d.ts +4 -1
  2. package/dist/agents/index.cjs +341 -6
  3. package/dist/agents/index.d.ts +717 -16
  4. package/dist/agents/index.mjs +342 -7
  5. package/dist/assets/index.cjs +25 -9
  6. package/dist/assets/index.mjs +25 -9
  7. package/dist/attachments/index.cjs +25 -9
  8. package/dist/attachments/index.mjs +25 -9
  9. package/dist/buckets/index.cjs +25 -9
  10. package/dist/buckets/index.mjs +25 -9
  11. package/dist/cases/index.cjs +621 -524
  12. package/dist/cases/index.d.ts +186 -43
  13. package/dist/cases/index.mjs +621 -524
  14. package/dist/conversational-agent/index.cjs +25 -9
  15. package/dist/conversational-agent/index.mjs +25 -9
  16. package/dist/core/index.cjs +1 -1
  17. package/dist/core/index.mjs +1 -1
  18. package/dist/entities/index.cjs +25 -9
  19. package/dist/entities/index.mjs +25 -9
  20. package/dist/feedback/index.cjs +25 -9
  21. package/dist/feedback/index.mjs +25 -9
  22. package/dist/index.cjs +332 -62
  23. package/dist/index.d.ts +827 -89
  24. package/dist/index.mjs +333 -63
  25. package/dist/index.umd.js +332 -62
  26. package/dist/jobs/index.cjs +129 -14
  27. package/dist/jobs/index.d.ts +10 -5
  28. package/dist/jobs/index.mjs +129 -14
  29. package/dist/maestro-processes/index.cjs +198 -100
  30. package/dist/maestro-processes/index.d.ts +188 -43
  31. package/dist/maestro-processes/index.mjs +198 -100
  32. package/dist/processes/index.cjs +25 -9
  33. package/dist/processes/index.d.ts +6 -1
  34. package/dist/processes/index.mjs +25 -9
  35. package/dist/queues/index.cjs +25 -9
  36. package/dist/queues/index.mjs +25 -9
  37. package/dist/tasks/index.cjs +25 -9
  38. package/dist/tasks/index.d.ts +4 -1
  39. package/dist/tasks/index.mjs +25 -9
  40. package/dist/traces/index.cjs +2 -2
  41. package/dist/traces/index.d.ts +3 -3
  42. package/dist/traces/index.mjs +2 -2
  43. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -4650,6 +4650,8 @@ const MAESTRO_ENDPOINTS = {
4650
4650
  INSTANCE_STATUS_BY_DATE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/InstanceStatusByDate`,
4651
4651
  /** Top processes ranked by total duration */
4652
4652
  TOP_PROCESSES_BY_DURATION: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByDuration`,
4653
+ /** Instance stats (counts by status + duration percentiles) */
4654
+ INSTANCE_COUNT_BY_STATUS: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/InstanceCountByStatus`,
4653
4655
  /** Element count by status for agentic instances (process and case) */
4654
4656
  ELEMENT_COUNT_BY_STATUS: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/ElementCountByStatus`,
4655
4657
  },
@@ -5011,7 +5013,7 @@ class EmbeddedTokenManager {
5011
5013
  * SDK's public API.
5012
5014
  */
5013
5015
  /** SDK version placeholder — patched by the SDK publish workflow. */
5014
- const SDK_VERSION = '1.4.2';
5016
+ const SDK_VERSION = '1.5.0';
5015
5017
  const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
5016
5018
  const SDK_SERVICE_NAME = 'UiPath.TypeScript.Sdk';
5017
5019
  const SDK_LOGGER_NAME = 'uipath-ts-sdk-telemetry';
@@ -6978,7 +6980,16 @@ function toISOUtc(value) {
6978
6980
  return isNaN(date.getTime()) ? value : date.toISOString();
6979
6981
  }
6980
6982
  /**
6981
- * Transforms data by mapping fields according to the provided field mapping
6983
+ * Transforms data by renaming each key in `data` exactly once, using the
6984
+ * mapping (`sourceField → targetField`). Keys not present in the mapping
6985
+ * pass through unchanged. The original (pre-rename) key is dropped — the
6986
+ * result contains only the renamed key.
6987
+ *
6988
+ * Each rename is independent. If the mapping happens to contain chained
6989
+ * entries (`a → b` and `b → c`), they do NOT compose: a field named `a`
6990
+ * in `data` becomes `b` (not `c`), because the renames are applied based
6991
+ * on the original data's keys, not the running result.
6992
+ *
6982
6993
  * @param data The source data to transform
6983
6994
  * @param fieldMapping Object mapping source field names to target field names
6984
6995
  * @returns Transformed data with mapped field names
@@ -7001,21 +7012,28 @@ function toISOUtc(value) {
7001
7012
  * // { userId: '123', name: 'john' },
7002
7013
  * // { userId: '456', name: 'jane' }
7003
7014
  * // ]
7015
+ *
7016
+ * // No chaining — `a → b` does not become `a → c` even if the map has `b → c`.
7017
+ * transformData({ a: 1 }, { a: 'b', b: 'c' });
7018
+ * // result = { b: 1 }
7004
7019
  * ```
7005
7020
  */
7006
7021
  function transformData(data, fieldMapping) {
7022
+ // Pass null/undefined through unchanged — callers (e.g. AttachmentService.getById)
7023
+ // may invoke this on optional fields that an OData `select` excluded.
7024
+ if (data == null) {
7025
+ return data;
7026
+ }
7007
7027
  // Handle array of objects
7008
7028
  if (Array.isArray(data)) {
7009
7029
  return data.map(item => transformData(item, fieldMapping));
7010
7030
  }
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
- }
7031
+ // Walk the ORIGINAL data's keys, look up each in the mapping. One rename
7032
+ // per data key — no mutation of an in-progress result, so chains can't form.
7033
+ const result = {};
7034
+ for (const [key, value] of Object.entries(data)) {
7035
+ const renamedKey = fieldMapping[key] ?? key;
7036
+ result[renamedKey] = value;
7019
7037
  }
7020
7038
  return result;
7021
7039
  }
@@ -7293,6 +7311,79 @@ function transformRequest(data, responseMap) {
7293
7311
  }
7294
7312
  return result;
7295
7313
  }
7314
+ /**
7315
+ * OData query-string keys whose values may contain field identifiers that
7316
+ * need rewriting from SDK names → API names.
7317
+ */
7318
+ const ODATA_FIELD_PARAM_KEYS = ['filter', 'orderby', 'select', 'expand'];
7319
+ /**
7320
+ * Matches one token at a time in an OData expression:
7321
+ * 1. A single-quoted string literal, allowing the `''` escape sequence —
7322
+ * consumed atomically so identifiers inside the literal can't match.
7323
+ * 2. An OData identifier (`[A-Za-z_][A-Za-z0-9_]*`).
7324
+ * Anything else (whitespace, operators, parens, commas) is left alone by
7325
+ * `String.prototype.replace`, which only substitutes matched substrings.
7326
+ */
7327
+ const ODATA_TOKEN_RE = /'(?:[^']|'')*'|[A-Za-z_][A-Za-z0-9_]*/g;
7328
+ /**
7329
+ * Rewrites SDK field identifiers to API field identifiers inside an OData
7330
+ * expression string (`$filter`, `$orderby`, `$select`, `$expand`).
7331
+ *
7332
+ * Field maps (e.g. `JobMap`) rename API fields → SDK fields on responses, so
7333
+ * SDK consumers see the renamed names. Without this rewrite, the same name
7334
+ * in a `filter` string would be forwarded verbatim and the API (which still
7335
+ * uses the original name) would reject it.
7336
+ *
7337
+ * Quoted string literals (with the OData `''` escape) are preserved exactly:
7338
+ * the token regex consumes them whole, so identifiers inside literals never
7339
+ * match. Identifier tokens are looked up in the reversed field map.
7340
+ *
7341
+ * @example
7342
+ * ```typescript
7343
+ * const requestMap = { processName: 'releaseName' };
7344
+ * rewriteODataIdentifiers("processName eq 'processName'", requestMap);
7345
+ * // "releaseName eq 'processName'" — identifier rewritten, literal preserved
7346
+ * ```
7347
+ */
7348
+ function rewriteODataIdentifiers(expression, requestMap) {
7349
+ if (!expression)
7350
+ return expression;
7351
+ return expression.replace(ODATA_TOKEN_RE, (match) => match.startsWith("'") ? match : (requestMap[match] ?? match));
7352
+ }
7353
+ /**
7354
+ * Symmetric counterpart of {@link transformRequest} for OData query options:
7355
+ * rewrites SDK field identifiers inside the recognized OData string params
7356
+ * (`filter`, `orderby`, `select`, `expand`) to their API names using the
7357
+ * reversed form of a response field map. Returns a shallow copy with the
7358
+ * relevant values rewritten; other keys pass through unchanged.
7359
+ *
7360
+ * Use at the OData edge so SDK consumers can refer to renamed fields by
7361
+ * their SDK name throughout — for reading the response and for filtering /
7362
+ * sorting / projecting / expanding.
7363
+ *
7364
+ * @param options The OData query options as authored with SDK field names
7365
+ * @param responseMap The response field map (API → SDK); reversed internally
7366
+ *
7367
+ * @example
7368
+ * ```typescript
7369
+ * // JobMap renames releaseName → processName on responses.
7370
+ * transformOptions({ filter: "processName eq 'X'" }, JobMap);
7371
+ * // { filter: "releaseName eq 'X'" }
7372
+ * ```
7373
+ */
7374
+ function transformOptions(options, responseMap) {
7375
+ const requestMap = reverseMap(responseMap);
7376
+ if (Object.keys(requestMap).length === 0)
7377
+ return options;
7378
+ const result = { ...options };
7379
+ for (const key of ODATA_FIELD_PARAM_KEYS) {
7380
+ const value = result[key];
7381
+ if (typeof value === 'string') {
7382
+ result[key] = rewriteODataIdentifiers(value, requestMap);
7383
+ }
7384
+ }
7385
+ return result;
7386
+ }
7296
7387
  /**
7297
7388
  * Transforms an array-based dictionary with separate keys and values arrays
7298
7389
  * into a standard JavaScript object/record
@@ -9859,6 +9950,21 @@ __decorate([
9859
9950
  track('Choicesets.DeleteValuesById')
9860
9951
  ], ChoiceSetService.prototype, "deleteValuesById", null);
9861
9952
 
9953
+ /**
9954
+ * Maps API field names (countOf*) to SDK field names (*Count) for InstanceStats,
9955
+ * aligning naming with ElementStats and other count-suffixed conventions.
9956
+ */
9957
+ const InstanceStatsMap = {
9958
+ countOfAllInstances: 'totalCount',
9959
+ countOfRunning: 'runningCount',
9960
+ countOfTransitioning: 'transitioningCount',
9961
+ countOfPaused: 'pausedCount',
9962
+ countOfFaulted: 'faultedCount',
9963
+ countOfCompleted: 'completedCount',
9964
+ countOfCancelled: 'cancelledCount',
9965
+ countOfDeleted: 'deletedCount'
9966
+ };
9967
+
9862
9968
  /**
9863
9969
  * Maestro Process Models
9864
9970
  * Model classes for Maestro processes
@@ -9884,7 +9990,26 @@ function createProcessMethods(processData, service) {
9884
9990
  throw new Error('Process key is undefined');
9885
9991
  if (!processData.packageId)
9886
9992
  throw new Error('Package ID is undefined');
9887
- return service.getElementStats(processData.processKey, processData.packageId, startTime, endTime, packageVersion);
9993
+ return service.getElementStats({
9994
+ processKey: processData.processKey,
9995
+ packageId: processData.packageId,
9996
+ packageVersion,
9997
+ startTime,
9998
+ endTime,
9999
+ });
10000
+ },
10001
+ getInstanceStats(startTime, endTime, packageVersion) {
10002
+ if (!processData.processKey)
10003
+ throw new Error('Process key is undefined');
10004
+ if (!processData.packageId)
10005
+ throw new Error('Package ID is undefined');
10006
+ return service.getInstanceStats({
10007
+ processKey: processData.processKey,
10008
+ packageId: processData.packageId,
10009
+ packageVersion,
10010
+ startTime,
10011
+ endTime,
10012
+ });
9888
10013
  }
9889
10014
  };
9890
10015
  }
@@ -9947,24 +10072,21 @@ async function fetchInstanceStatusTimeline(postFn, startTime, endTime, isCaseMan
9947
10072
  return response.data ?? [];
9948
10073
  }
9949
10074
  /**
9950
- * Builds the request body for the ElementCountByStatus endpoint.
10075
+ * Builds the commonParams request body for Insights RTM endpoints
10076
+ * that filter by process key, package, time range, and version.
9951
10077
  *
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
10078
+ * @param request - Process scope + time range to aggregate over
10079
+ * @returns Request body with commonParams
9958
10080
  * @internal
9959
10081
  */
9960
- function buildElementCountByStatusBody(processKey, packageId, startTime, endTime, packageVersion) {
10082
+ function buildInsightsCommonBody(request) {
9961
10083
  return {
9962
10084
  commonParams: {
9963
- processKey,
9964
- packageId,
9965
- startTime: startTime.getTime(),
9966
- endTime: endTime.getTime(),
9967
- version: packageVersion
10085
+ processKey: request.processKey,
10086
+ packageId: request.packageId,
10087
+ startTime: request.startTime.getTime(),
10088
+ endTime: request.endTime.getTime(),
10089
+ version: request.packageVersion
9968
10090
  }
9969
10091
  };
9970
10092
  }
@@ -10218,7 +10340,26 @@ function createCaseMethods(caseData, service) {
10218
10340
  throw new Error('Process key is undefined');
10219
10341
  if (!caseData.packageId)
10220
10342
  throw new Error('Package ID is undefined');
10221
- return service.getElementStats(caseData.processKey, caseData.packageId, startTime, endTime, packageVersion);
10343
+ return service.getElementStats({
10344
+ processKey: caseData.processKey,
10345
+ packageId: caseData.packageId,
10346
+ packageVersion,
10347
+ startTime,
10348
+ endTime,
10349
+ });
10350
+ },
10351
+ getInstanceStats(startTime, endTime, packageVersion) {
10352
+ if (!caseData.processKey)
10353
+ throw new Error('Process key is undefined');
10354
+ if (!caseData.packageId)
10355
+ throw new Error('Package ID is undefined');
10356
+ return service.getInstanceStats({
10357
+ processKey: caseData.processKey,
10358
+ packageId: caseData.packageId,
10359
+ packageVersion,
10360
+ startTime,
10361
+ endTime,
10362
+ });
10222
10363
  }
10223
10364
  };
10224
10365
  }
@@ -11082,22 +11223,22 @@ class MaestroProcessesService extends BaseService {
11082
11223
  * Returns per-element execution counts (success, fail, terminated, paused, in-progress) and
11083
11224
  * duration percentile metrics (min, max, avg, p50, p95, p99) for BPMN elements within a process.
11084
11225
  *
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
11226
+ * @param request - Process scope + time range to aggregate over
11090
11227
  * @returns Promise resolving to an array of {@link ElementStats}
11091
11228
  * @example
11092
11229
  * ```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
- * );
11230
+ * // First, list processes to find the processKey, packageId, and available versions
11231
+ * const processes = await maestroProcesses.getAll();
11232
+ * const process = processes[0];
11233
+ *
11234
+ * // Get element metrics for that process
11235
+ * const elements = await maestroProcesses.getElementStats({
11236
+ * processKey: process.processKey,
11237
+ * packageId: process.packageId,
11238
+ * packageVersion: process.packageVersions[0],
11239
+ * startTime: new Date('2026-04-01'),
11240
+ * endTime: new Date(),
11241
+ * });
11101
11242
  *
11102
11243
  * // Analyze element performance
11103
11244
  * for (const element of elements) {
@@ -11105,12 +11246,58 @@ class MaestroProcessesService extends BaseService {
11105
11246
  * console.log(` Success: ${element.successCount}, Failed: ${element.failCount}`);
11106
11247
  * console.log(` Avg duration: ${element.avgDurationMs}ms, P95: ${element.p95DurationMs}ms`);
11107
11248
  * }
11249
+ *
11250
+ * // Using bound method on a process — auto-fills processKey and packageId
11251
+ * const boundElements = await process.getElementStats(
11252
+ * new Date('2026-04-01'),
11253
+ * new Date(),
11254
+ * process.packageVersions[0]
11255
+ * );
11108
11256
  * ```
11109
11257
  */
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));
11258
+ async getElementStats(request) {
11259
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.ELEMENT_COUNT_BY_STATUS, buildInsightsCommonBody(request));
11112
11260
  return data ?? [];
11113
11261
  }
11262
+ /**
11263
+ * Get instance stats for a process.
11264
+ *
11265
+ * Returns total instance counts broken down by status (running, completed, faulted, etc.)
11266
+ * and the average execution duration for all instances of a process within a time range.
11267
+ *
11268
+ * @param request - Process scope + time range to aggregate over
11269
+ * @returns Promise resolving to {@link InstanceStats}
11270
+ * @example
11271
+ * ```typescript
11272
+ * // First, list processes to find the processKey, packageId, and available versions
11273
+ * const processes = await maestroProcesses.getAll();
11274
+ * const process = processes[0];
11275
+ *
11276
+ * // Get instance status breakdown for that process
11277
+ * const counts = await maestroProcesses.getInstanceStats({
11278
+ * processKey: process.processKey,
11279
+ * packageId: process.packageId,
11280
+ * packageVersion: process.packageVersions[0],
11281
+ * startTime: new Date('2026-04-01'),
11282
+ * endTime: new Date(),
11283
+ * });
11284
+ *
11285
+ * console.log(`Total: ${counts.totalCount}`);
11286
+ * console.log(`Running: ${counts.runningCount}, Completed: ${counts.completedCount}`);
11287
+ * console.log(`Faulted: ${counts.faultedCount}, Avg duration: ${counts.avgDurationMs}ms`);
11288
+ *
11289
+ * // Using bound method on a process — auto-fills processKey and packageId
11290
+ * const boundCounts = await process.getInstanceStats(
11291
+ * new Date('2026-04-01'),
11292
+ * new Date(),
11293
+ * process.packageVersions[0]
11294
+ * );
11295
+ * ```
11296
+ */
11297
+ async getInstanceStats(request) {
11298
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.INSTANCE_COUNT_BY_STATUS, buildInsightsCommonBody(request));
11299
+ return transformData(data, InstanceStatsMap);
11300
+ }
11114
11301
  }
11115
11302
  __decorate([
11116
11303
  track('MaestroProcesses.GetAll')
@@ -11136,6 +11323,9 @@ __decorate([
11136
11323
  __decorate([
11137
11324
  track('MaestroProcesses.GetElementStats')
11138
11325
  ], MaestroProcessesService.prototype, "getElementStats", null);
11326
+ __decorate([
11327
+ track('MaestroProcesses.GetInstanceStats')
11328
+ ], MaestroProcessesService.prototype, "getInstanceStats", null);
11139
11329
 
11140
11330
  /**
11141
11331
  * Service class for Maestro Process Incidents
@@ -11443,34 +11633,79 @@ class CasesService extends BaseService {
11443
11633
  * Returns per-element execution counts (success, fail, terminated, paused, in-progress) and
11444
11634
  * duration percentile metrics (min, max, avg, p50, p95, p99) for BPMN elements within a case.
11445
11635
  *
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
11636
+ * @param request - Process scope + time range to aggregate over
11451
11637
  * @returns Promise resolving to an array of {@link ElementStats}
11452
11638
  * @example
11453
11639
  * ```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
- * );
11640
+ * // First, list cases to find the processKey, packageId, and available versions
11641
+ * const allCases = await cases.getAll();
11642
+ * const caseItem = allCases[0];
11643
+ *
11644
+ * // Get element metrics for that case
11645
+ * const elements = await cases.getElementStats({
11646
+ * processKey: caseItem.processKey,
11647
+ * packageId: caseItem.packageId,
11648
+ * packageVersion: caseItem.packageVersions[0],
11649
+ * startTime: new Date('2026-04-01'),
11650
+ * endTime: new Date(),
11651
+ * });
11462
11652
  *
11463
11653
  * // Find elements with failures
11464
11654
  * const failedElements = elements.filter(e => e.failCount > 0);
11465
11655
  * for (const element of failedElements) {
11466
11656
  * console.log(`Failed element: ${element.elementId}, failures: ${element.failCount}`);
11467
11657
  * }
11658
+ *
11659
+ * // Using bound method on a case — auto-fills processKey and packageId
11660
+ * const boundElements = await caseItem.getElementStats(
11661
+ * new Date('2026-04-01'),
11662
+ * new Date(),
11663
+ * caseItem.packageVersions[0]
11664
+ * );
11468
11665
  * ```
11469
11666
  */
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));
11667
+ async getElementStats(request) {
11668
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.ELEMENT_COUNT_BY_STATUS, buildInsightsCommonBody(request));
11472
11669
  return data ?? [];
11473
11670
  }
11671
+ /**
11672
+ * Get instance stats for a case.
11673
+ *
11674
+ * Returns total instance counts broken down by status (running, completed, faulted, etc.)
11675
+ * and the average execution duration for all instances of a case within a time range.
11676
+ *
11677
+ * @param request - Process scope + time range to aggregate over
11678
+ * @returns Promise resolving to {@link InstanceStats}
11679
+ * @example
11680
+ * ```typescript
11681
+ * // First, list cases to find the processKey, packageId, and available versions
11682
+ * const allCases = await cases.getAll();
11683
+ * const caseItem = allCases[0];
11684
+ *
11685
+ * // Get instance status breakdown for that case
11686
+ * const counts = await cases.getInstanceStats({
11687
+ * processKey: caseItem.processKey,
11688
+ * packageId: caseItem.packageId,
11689
+ * packageVersion: caseItem.packageVersions[0],
11690
+ * startTime: new Date('2026-04-01'),
11691
+ * endTime: new Date(),
11692
+ * });
11693
+ *
11694
+ * console.log(`Total: ${counts.totalCount}`);
11695
+ * console.log(`Completed: ${counts.completedCount}, Faulted: ${counts.faultedCount}`);
11696
+ *
11697
+ * // Using bound method on a case — auto-fills processKey and packageId
11698
+ * const boundCounts = await caseItem.getInstanceStats(
11699
+ * new Date('2026-04-01'),
11700
+ * new Date(),
11701
+ * caseItem.packageVersions[0]
11702
+ * );
11703
+ * ```
11704
+ */
11705
+ async getInstanceStats(request) {
11706
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.INSTANCE_COUNT_BY_STATUS, buildInsightsCommonBody(request));
11707
+ return transformData(data, InstanceStatsMap);
11708
+ }
11474
11709
  /**
11475
11710
  * Extract a readable case name from the packageId
11476
11711
  * @param packageId - The full package identifier
@@ -11511,6 +11746,9 @@ __decorate([
11511
11746
  __decorate([
11512
11747
  track('Cases.GetElementStats')
11513
11748
  ], CasesService.prototype, "getElementStats", null);
11749
+ __decorate([
11750
+ track('Cases.GetInstanceStats')
11751
+ ], CasesService.prototype, "getInstanceStats", null);
11514
11752
 
11515
11753
  /**
11516
11754
  * Maps fields for Case Instance entities to ensure consistent naming
@@ -13968,8 +14206,9 @@ class JobService extends FolderScopedService {
13968
14206
  * const folderJobs = await jobs.getAll({ folderId: <folderId> });
13969
14207
  *
13970
14208
  * // With filtering
13971
- * const runningJobs = await jobs.getAll({
13972
- * filter: "state eq 'Running'"
14209
+ * const recentInvoiceJobs = await jobs.getAll({
14210
+ * filter: "processName eq 'InvoiceBot'",
14211
+ * orderby: 'createdTime desc',
13973
14212
  * });
13974
14213
  *
13975
14214
  * // First page with pagination
@@ -13992,6 +14231,10 @@ class JobService extends FolderScopedService {
13992
14231
  const rawJob = transformData(pascalToCamelCaseKeys(job), JobMap);
13993
14232
  return createJobWithMethods(rawJob, this);
13994
14233
  };
14234
+ // Rewrite renamed SDK field names → API names inside OData strings
14235
+ // before delegating, mirroring the transformRequest pattern used for
14236
+ // request bodies.
14237
+ const apiOptions = options ? transformOptions(options, JobMap) : options;
13995
14238
  return PaginationHelpers.getAll({
13996
14239
  serviceAccess: this.createPaginationServiceAccess(),
13997
14240
  getEndpoint: () => JOB_ENDPOINTS.GET_ALL,
@@ -14007,7 +14250,7 @@ class JobService extends FolderScopedService {
14007
14250
  countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM,
14008
14251
  },
14009
14252
  },
14010
- }, options);
14253
+ }, apiOptions);
14011
14254
  }
14012
14255
  /**
14013
14256
  * Gets a job by its unique key (GUID).
@@ -14044,8 +14287,8 @@ class JobService extends FolderScopedService {
14044
14287
  throw new ValidationError({ message: 'folderId is required for getById' });
14045
14288
  }
14046
14289
  const headers = createHeaders({ [FOLDER_ID]: folderId });
14047
- const keysToPrefix = Object.keys(options ?? {});
14048
- const apiOptions = options ? addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix) : {};
14290
+ const apiFieldOptions = options ? transformOptions(options, JobMap) : {};
14291
+ const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
14049
14292
  const response = await this.get(JOB_ENDPOINTS.GET_BY_KEY(id), {
14050
14293
  params: apiOptions,
14051
14294
  headers,
@@ -14348,6 +14591,9 @@ var JobState;
14348
14591
  JobState["Stopped"] = "Stopped";
14349
14592
  JobState["Suspended"] = "Suspended";
14350
14593
  JobState["Resumed"] = "Resumed";
14594
+ JobState["Cancelled"] = "Cancelled";
14595
+ /** Server-side fallback for an unrecognized or missing job state. */
14596
+ JobState["Unknown"] = "Unknown";
14351
14597
  })(JobState || (JobState = {}));
14352
14598
 
14353
14599
  /**
@@ -15069,9 +15315,9 @@ var AgentListSortColumn;
15069
15315
  AgentListSortColumn["HealthScore"] = "HealthScore";
15070
15316
  AgentListSortColumn["LastIncident"] = "LastIncident";
15071
15317
  AgentListSortColumn["FolderName"] = "FolderName";
15072
- /** Quantity of AGU (Agent Units) consumed */
15318
+ /** Quantity of Agent Units consumed */
15073
15319
  AgentListSortColumn["QuantityAGU"] = "QuantityAGU";
15074
- /** Quantity of PLTU (Platform Units) consumed */
15320
+ /** Quantity of Platform Units consumed */
15075
15321
  AgentListSortColumn["QuantityPLTU"] = "QuantityPLTU";
15076
15322
  AgentListSortColumn["FolderPath"] = "FolderPath";
15077
15323
  })(AgentListSortColumn || (AgentListSortColumn = {}));
@@ -15093,6 +15339,30 @@ var AgentErrorSortColumn;
15093
15339
  AgentErrorSortColumn["LastSeenFolderName"] = "LastSeenFolderName";
15094
15340
  AgentErrorSortColumn["LastSeenFolderPath"] = "LastSeenFolderPath";
15095
15341
  })(AgentErrorSortColumn || (AgentErrorSortColumn = {}));
15342
+ /**
15343
+ * Agent type, used to filter consumption results.
15344
+ *
15345
+ * Wire format is the string name, per the API's `StringEnumConverter` serialization.
15346
+ */
15347
+ var AgentType;
15348
+ (function (AgentType) {
15349
+ AgentType["Autonomous"] = "Autonomous";
15350
+ AgentType["Conversational"] = "Conversational";
15351
+ AgentType["Coded"] = "Coded";
15352
+ })(AgentType || (AgentType = {}));
15353
+ /**
15354
+ * Job execution mode filter accepted by the summary endpoints.
15355
+ *
15356
+ * Wire format is the string name (`"Debug"` / `"Runtime"`), per the API's
15357
+ * `StringEnumConverter` serialization.
15358
+ */
15359
+ var AgentExecutionType;
15360
+ (function (AgentExecutionType) {
15361
+ /** Test runs */
15362
+ AgentExecutionType["Debug"] = "Debug";
15363
+ /** Production runs */
15364
+ AgentExecutionType["Runtime"] = "Runtime";
15365
+ })(AgentExecutionType || (AgentExecutionType = {}));
15096
15366
 
15097
15367
  /**
15098
15368
  * Types for the Agent Memory metrics service.
@@ -15552,4 +15822,4 @@ function getAppBase() {
15552
15822
  return getMetaTagContent(UiPathMetaTags.APP_BASE) || '/';
15553
15823
  }
15554
15824
 
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 };
15825
+ export { AgentErrorSortColumn, AgentExecutionType, 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 };