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