@uipath/uipath-typescript 1.5.0 → 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 (45) hide show
  1. package/README.md +7 -1
  2. package/dist/assets/index.cjs +107 -6
  3. package/dist/assets/index.d.ts +12 -1
  4. package/dist/assets/index.mjs +107 -6
  5. package/dist/attachments/index.cjs +95 -3
  6. package/dist/attachments/index.mjs +95 -3
  7. package/dist/buckets/index.cjs +111 -6
  8. package/dist/buckets/index.d.ts +12 -1
  9. package/dist/buckets/index.mjs +111 -6
  10. package/dist/cases/index.cjs +434 -266
  11. package/dist/cases/index.d.ts +140 -3
  12. package/dist/cases/index.mjs +434 -266
  13. package/dist/conversational-agent/index.cjs +23 -1
  14. package/dist/conversational-agent/index.d.ts +117 -6
  15. package/dist/conversational-agent/index.mjs +23 -1
  16. package/dist/core/index.cjs +1 -1
  17. package/dist/core/index.mjs +1 -1
  18. package/dist/entities/index.cjs +423 -0
  19. package/dist/entities/index.d.ts +441 -1
  20. package/dist/entities/index.mjs +422 -1
  21. package/dist/index.cjs +974 -293
  22. package/dist/index.d.ts +1150 -43
  23. package/dist/index.mjs +975 -294
  24. package/dist/index.umd.js +974 -293
  25. package/dist/jobs/index.cjs +12 -5
  26. package/dist/jobs/index.d.ts +12 -1
  27. package/dist/jobs/index.mjs +12 -5
  28. package/dist/maestro-processes/index.cjs +344 -243
  29. package/dist/maestro-processes/index.d.ts +189 -5
  30. package/dist/maestro-processes/index.mjs +344 -243
  31. package/dist/notifications/index.cjs +2012 -0
  32. package/dist/notifications/index.d.ts +615 -0
  33. package/dist/notifications/index.mjs +2010 -0
  34. package/dist/processes/index.cjs +93 -9
  35. package/dist/processes/index.d.ts +12 -1
  36. package/dist/processes/index.mjs +93 -9
  37. package/dist/queues/index.cjs +106 -5
  38. package/dist/queues/index.d.ts +12 -1
  39. package/dist/queues/index.mjs +106 -5
  40. package/dist/tasks/index.cjs +100 -4
  41. package/dist/tasks/index.mjs +100 -4
  42. package/dist/traces/index.cjs +218 -4
  43. package/dist/traces/index.d.ts +357 -22
  44. package/dist/traces/index.mjs +219 -5
  45. package/package.json +14 -4
@@ -336,6 +336,97 @@ function addPrefixToKeys(obj, prefix, keys) {
336
336
  }
337
337
  return result;
338
338
  }
339
+ /**
340
+ * Creates a new map with the keys and values reversed
341
+ * @param map The original map to reverse
342
+ * @returns A new map with keys and values swapped
343
+ *
344
+ * @example
345
+ * ```typescript
346
+ * const original = { key1: 'value1', key2: 'value2' };
347
+ * const reversed = reverseMap(original);
348
+ * // reversed = { value1: 'key1', value2: 'key2' }
349
+ * ```
350
+ */
351
+ function reverseMap(map) {
352
+ return Object.entries(map).reduce((acc, [key, value]) => {
353
+ acc[value] = key;
354
+ return acc;
355
+ }, {});
356
+ }
357
+ /**
358
+ * OData query-string keys whose values may contain field identifiers that
359
+ * need rewriting from SDK names → API names.
360
+ */
361
+ const ODATA_FIELD_PARAM_KEYS = ['filter', 'orderby', 'select', 'expand'];
362
+ /**
363
+ * Matches one token at a time in an OData expression:
364
+ * 1. A single-quoted string literal, allowing the `''` escape sequence —
365
+ * consumed atomically so identifiers inside the literal can't match.
366
+ * 2. An OData identifier (`[A-Za-z_][A-Za-z0-9_]*`).
367
+ * Anything else (whitespace, operators, parens, commas) is left alone by
368
+ * `String.prototype.replace`, which only substitutes matched substrings.
369
+ */
370
+ const ODATA_TOKEN_RE = /'(?:[^']|'')*'|[A-Za-z_][A-Za-z0-9_]*/g;
371
+ /**
372
+ * Rewrites SDK field identifiers to API field identifiers inside an OData
373
+ * expression string (`$filter`, `$orderby`, `$select`, `$expand`).
374
+ *
375
+ * Field maps (e.g. `JobMap`) rename API fields → SDK fields on responses, so
376
+ * SDK consumers see the renamed names. Without this rewrite, the same name
377
+ * in a `filter` string would be forwarded verbatim and the API (which still
378
+ * uses the original name) would reject it.
379
+ *
380
+ * Quoted string literals (with the OData `''` escape) are preserved exactly:
381
+ * the token regex consumes them whole, so identifiers inside literals never
382
+ * match. Identifier tokens are looked up in the reversed field map.
383
+ *
384
+ * @example
385
+ * ```typescript
386
+ * const requestMap = { processName: 'releaseName' };
387
+ * rewriteODataIdentifiers("processName eq 'processName'", requestMap);
388
+ * // "releaseName eq 'processName'" — identifier rewritten, literal preserved
389
+ * ```
390
+ */
391
+ function rewriteODataIdentifiers(expression, requestMap) {
392
+ if (!expression)
393
+ return expression;
394
+ return expression.replace(ODATA_TOKEN_RE, (match) => match.startsWith("'") ? match : (requestMap[match] ?? match));
395
+ }
396
+ /**
397
+ * Symmetric counterpart of {@link transformRequest} for OData query options:
398
+ * rewrites SDK field identifiers inside the recognized OData string params
399
+ * (`filter`, `orderby`, `select`, `expand`) to their API names using the
400
+ * reversed form of a response field map. Returns a shallow copy with the
401
+ * relevant values rewritten; other keys pass through unchanged.
402
+ *
403
+ * Use at the OData edge so SDK consumers can refer to renamed fields by
404
+ * their SDK name throughout — for reading the response and for filtering /
405
+ * sorting / projecting / expanding.
406
+ *
407
+ * @param options The OData query options as authored with SDK field names
408
+ * @param responseMap The response field map (API → SDK); reversed internally
409
+ *
410
+ * @example
411
+ * ```typescript
412
+ * // JobMap renames releaseName → processName on responses.
413
+ * transformOptions({ filter: "processName eq 'X'" }, JobMap);
414
+ * // { filter: "releaseName eq 'X'" }
415
+ * ```
416
+ */
417
+ function transformOptions(options, responseMap) {
418
+ const requestMap = reverseMap(responseMap);
419
+ if (Object.keys(requestMap).length === 0)
420
+ return options;
421
+ const result = { ...options };
422
+ for (const key of ODATA_FIELD_PARAM_KEYS) {
423
+ const value = result[key];
424
+ if (typeof value === 'string') {
425
+ result[key] = rewriteODataIdentifiers(value, requestMap);
426
+ }
427
+ }
428
+ return result;
429
+ }
339
430
 
340
431
  /**
341
432
  * Internal types for Maestro Cases
@@ -400,6 +491,7 @@ const MAESTRO_ENDPOINTS = {
400
491
  CANCEL: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/cancel`,
401
492
  PAUSE: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/pause`,
402
493
  RESUME: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/resume`,
494
+ RETRY: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/retry`,
403
495
  },
404
496
  INCIDENTS: {
405
497
  GET_ALL: `${PIMS_BASE}/api/v1/incidents/summary`,
@@ -433,6 +525,8 @@ const MAESTRO_ENDPOINTS = {
433
525
  INSTANCE_COUNT_BY_STATUS: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/InstanceCountByStatus`,
434
526
  /** Element count by status for agentic instances (process and case) */
435
527
  ELEMENT_COUNT_BY_STATUS: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/ElementCountByStatus`,
528
+ /** Incident counts aggregated by time bucket for time-series charts */
529
+ INCIDENTS_BY_TIME_WINDOW: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/IncidentsByTimeWindow`,
436
530
  },
437
531
  };
438
532
 
@@ -474,6 +568,16 @@ function createCaseMethods(caseData, service) {
474
568
  startTime,
475
569
  endTime,
476
570
  });
571
+ },
572
+ getInstanceStatusTimeline(startTime, endTime, options) {
573
+ if (!caseData.processKey)
574
+ throw new Error('Process key is undefined');
575
+ return service.getInstanceStatusTimeline(startTime, endTime, { ...options, processKeys: [caseData.processKey] });
576
+ },
577
+ getIncidentsTimeline(startTime, endTime, options) {
578
+ if (!caseData.processKey)
579
+ throw new Error('Process key is undefined');
580
+ return service.getIncidentsTimeline(startTime, endTime, { ...options, processKeys: [caseData.processKey] });
477
581
  }
478
582
  };
479
583
  }
@@ -489,6 +593,243 @@ function createCaseWithMethods(caseData, service) {
489
593
  return Object.assign({}, caseData, methods);
490
594
  }
491
595
 
596
+ /**
597
+ * Process Incident Status
598
+ */
599
+ var ProcessIncidentStatus;
600
+ (function (ProcessIncidentStatus) {
601
+ ProcessIncidentStatus["Open"] = "Open";
602
+ ProcessIncidentStatus["Closed"] = "Closed";
603
+ })(ProcessIncidentStatus || (ProcessIncidentStatus = {}));
604
+ /**
605
+ * Process Incident Type
606
+ */
607
+ var ProcessIncidentType;
608
+ (function (ProcessIncidentType) {
609
+ ProcessIncidentType["System"] = "System";
610
+ ProcessIncidentType["User"] = "User";
611
+ ProcessIncidentType["Deployment"] = "Deployment";
612
+ })(ProcessIncidentType || (ProcessIncidentType = {}));
613
+ /**
614
+ * Process Incident Severity
615
+ */
616
+ var ProcessIncidentSeverity;
617
+ (function (ProcessIncidentSeverity) {
618
+ ProcessIncidentSeverity["Error"] = "Error";
619
+ ProcessIncidentSeverity["Warning"] = "Warning";
620
+ })(ProcessIncidentSeverity || (ProcessIncidentSeverity = {}));
621
+ /**
622
+ * Process Incident Debug Mode
623
+ */
624
+ var DebugMode;
625
+ (function (DebugMode) {
626
+ DebugMode["None"] = "None";
627
+ DebugMode["Default"] = "Default";
628
+ DebugMode["StepByStep"] = "StepByStep";
629
+ DebugMode["SingleStep"] = "SingleStep";
630
+ })(DebugMode || (DebugMode = {}));
631
+
632
+ /**
633
+ * Case Instance Types
634
+ * Types and interfaces for Maestro case instance management
635
+ */
636
+ /**
637
+ * SLA status for a case instance
638
+ */
639
+ exports.SlaSummaryStatus = void 0;
640
+ (function (SlaSummaryStatus) {
641
+ /** Case is within SLA deadline */
642
+ SlaSummaryStatus["ON_TRACK"] = "On Track";
643
+ /** Case is approaching SLA deadline based on at-risk percentage threshold */
644
+ SlaSummaryStatus["AT_RISK"] = "At Risk";
645
+ /** Case has exceeded SLA deadline */
646
+ SlaSummaryStatus["OVERDUE"] = "Overdue";
647
+ /** Case instance has completed */
648
+ SlaSummaryStatus["COMPLETED"] = "Completed";
649
+ /** SLA status cannot be determined (no SLA deadline defined) */
650
+ SlaSummaryStatus["UNKNOWN"] = "Unknown";
651
+ })(exports.SlaSummaryStatus || (exports.SlaSummaryStatus = {}));
652
+ /**
653
+ * Instance status values for case instances and process instances
654
+ */
655
+ exports.InstanceStatus = void 0;
656
+ (function (InstanceStatus) {
657
+ /** Instance status not yet populated by the backend */
658
+ InstanceStatus["UNKNOWN"] = "";
659
+ InstanceStatus["CANCELLED"] = "Cancelled";
660
+ InstanceStatus["CANCELING"] = "Canceling";
661
+ InstanceStatus["COMPLETED"] = "Completed";
662
+ InstanceStatus["FAULTED"] = "Faulted";
663
+ InstanceStatus["PAUSED"] = "Paused";
664
+ InstanceStatus["PAUSING"] = "Pausing";
665
+ InstanceStatus["PENDING"] = "Pending";
666
+ InstanceStatus["RESUMING"] = "Resuming";
667
+ InstanceStatus["RETRYING"] = "Retrying";
668
+ InstanceStatus["RUNNING"] = "Running";
669
+ InstanceStatus["UPGRADING"] = "Upgrading";
670
+ })(exports.InstanceStatus || (exports.InstanceStatus = {}));
671
+ /**
672
+ * Case stage task type
673
+ */
674
+ exports.StageTaskType = void 0;
675
+ (function (StageTaskType) {
676
+ StageTaskType["EXTERNAL_AGENT"] = "external-agent";
677
+ StageTaskType["RPA"] = "rpa";
678
+ StageTaskType["AGENTIC_PROCESS"] = "process";
679
+ StageTaskType["AGENT"] = "agent";
680
+ StageTaskType["ACTION"] = "action";
681
+ StageTaskType["API_WORKFLOW"] = "api-workflow";
682
+ })(exports.StageTaskType || (exports.StageTaskType = {}));
683
+ /**
684
+ * Escalation recipient scope
685
+ */
686
+ exports.EscalationRecipientScope = void 0;
687
+ (function (EscalationRecipientScope) {
688
+ EscalationRecipientScope["USER"] = "user";
689
+ EscalationRecipientScope["USER_GROUP"] = "usergroup";
690
+ })(exports.EscalationRecipientScope || (exports.EscalationRecipientScope = {}));
691
+ /**
692
+ * Escalation action type
693
+ */
694
+ exports.EscalationActionType = void 0;
695
+ (function (EscalationActionType) {
696
+ EscalationActionType["NOTIFICATION"] = "notification";
697
+ })(exports.EscalationActionType || (exports.EscalationActionType = {}));
698
+ /**
699
+ * Escalation rule trigger type
700
+ */
701
+ exports.EscalationTriggerType = void 0;
702
+ (function (EscalationTriggerType) {
703
+ EscalationTriggerType["SLA_BREACHED"] = "sla-breached";
704
+ EscalationTriggerType["AT_RISK"] = "at-risk";
705
+ /** Default value when no escalation rule is defined */
706
+ EscalationTriggerType["NONE"] = "None";
707
+ })(exports.EscalationTriggerType || (exports.EscalationTriggerType = {}));
708
+ /**
709
+ * SLA duration unit
710
+ */
711
+ exports.SLADurationUnit = void 0;
712
+ (function (SLADurationUnit) {
713
+ SLADurationUnit["HOURS"] = "h";
714
+ SLADurationUnit["DAYS"] = "d";
715
+ SLADurationUnit["WEEKS"] = "w";
716
+ SLADurationUnit["MONTHS"] = "m";
717
+ })(exports.SLADurationUnit || (exports.SLADurationUnit = {}));
718
+
719
+ /**
720
+ * Creates methods for a case instance
721
+ *
722
+ * @param instanceData - The case instance data (response from API)
723
+ * @param service - The case instance service instance
724
+ * @returns Object containing case instance methods
725
+ */
726
+ function createCaseInstanceMethods(instanceData, service) {
727
+ return {
728
+ async close(options) {
729
+ if (!instanceData.instanceId)
730
+ throw new Error('Case instance ID is undefined');
731
+ if (!instanceData.folderKey)
732
+ throw new Error('Case instance folder key is undefined');
733
+ return service.close(instanceData.instanceId, instanceData.folderKey, options);
734
+ },
735
+ async pause(options) {
736
+ if (!instanceData.instanceId)
737
+ throw new Error('Case instance ID is undefined');
738
+ if (!instanceData.folderKey)
739
+ throw new Error('Case instance folder key is undefined');
740
+ return service.pause(instanceData.instanceId, instanceData.folderKey, options);
741
+ },
742
+ async reopen(options) {
743
+ if (!instanceData.instanceId)
744
+ throw new Error('Case instance ID is undefined');
745
+ if (!instanceData.folderKey)
746
+ throw new Error('Case instance folder key is undefined');
747
+ return service.reopen(instanceData.instanceId, instanceData.folderKey, options);
748
+ },
749
+ async resume(options) {
750
+ if (!instanceData.instanceId)
751
+ throw new Error('Case instance ID is undefined');
752
+ if (!instanceData.folderKey)
753
+ throw new Error('Case instance folder key is undefined');
754
+ return service.resume(instanceData.instanceId, instanceData.folderKey, options);
755
+ },
756
+ async getExecutionHistory() {
757
+ if (!instanceData.instanceId)
758
+ throw new Error('Case instance ID is undefined');
759
+ if (!instanceData.folderKey)
760
+ throw new Error('Case instance folder key is undefined');
761
+ return service.getExecutionHistory(instanceData.instanceId, instanceData.folderKey);
762
+ },
763
+ async getStages() {
764
+ if (!instanceData.instanceId)
765
+ throw new Error('Case instance ID is undefined');
766
+ if (!instanceData.folderKey)
767
+ throw new Error('Case instance folder key is undefined');
768
+ return service.getStages(instanceData.instanceId, instanceData.folderKey);
769
+ },
770
+ async getActionTasks(options) {
771
+ if (!instanceData.instanceId)
772
+ throw new Error('Case instance ID is undefined');
773
+ return service.getActionTasks(instanceData.instanceId, options);
774
+ },
775
+ async getSlaSummary(options) {
776
+ if (!instanceData.instanceId)
777
+ throw new Error('Case instance ID is undefined');
778
+ return service.getSlaSummary({ ...options, caseInstanceId: instanceData.instanceId });
779
+ },
780
+ async getStagesSlaSummary() {
781
+ if (!instanceData.instanceId)
782
+ throw new Error('Case instance ID is undefined');
783
+ return service.getStagesSlaSummary({ caseInstanceId: instanceData.instanceId });
784
+ }
785
+ };
786
+ }
787
+ /**
788
+ * Creates an actionable case instance by combining API case instance data with operational methods.
789
+ *
790
+ * @param instanceData - The case instance data from API
791
+ * @param service - The case instance service instance
792
+ * @returns A case instance object with added methods
793
+ */
794
+ function createCaseInstanceWithMethods(instanceData, service) {
795
+ const methods = createCaseInstanceMethods(instanceData, service);
796
+ return Object.assign({}, instanceData, methods);
797
+ }
798
+
799
+ /**
800
+ * Insights Types
801
+ * Shared types for Maestro insights analytics endpoints
802
+ */
803
+ /**
804
+ * Time bucketing granularity for insights time-series queries.
805
+ *
806
+ * Controls how data points are grouped on the time axis.
807
+ */
808
+ exports.TimeInterval = void 0;
809
+ (function (TimeInterval) {
810
+ /** Group data points by hour */
811
+ TimeInterval["Hour"] = "HOUR";
812
+ /** Group data points by day */
813
+ TimeInterval["Day"] = "DAY";
814
+ /** Group data points by week */
815
+ TimeInterval["Week"] = "WEEK";
816
+ })(exports.TimeInterval || (exports.TimeInterval = {}));
817
+ /**
818
+ * Final instance statuses returned by the instance status timeline endpoint.
819
+ *
820
+ * Only includes statuses where the instance has finished execution — Completed, Faulted, or Cancelled.
821
+ * Active statuses like Running or Paused are not included.
822
+ */
823
+ exports.InstanceFinalStatus = void 0;
824
+ (function (InstanceFinalStatus) {
825
+ /** Instance completed successfully */
826
+ InstanceFinalStatus["Completed"] = "Completed";
827
+ /** Instance encountered an error */
828
+ InstanceFinalStatus["Faulted"] = "Faulted";
829
+ /** Instance was cancelled */
830
+ InstanceFinalStatus["Cancelled"] = "Cancelled";
831
+ })(exports.InstanceFinalStatus || (exports.InstanceFinalStatus = {}));
832
+
492
833
  /**
493
834
  * Builds the request body for Insights RTM "top" endpoints.
494
835
  *
@@ -512,28 +853,29 @@ function buildInsightsTopBody(startTime, endTime, isCaseManagement, options) {
512
853
  };
513
854
  }
514
855
  /**
515
- * Fetches instance status timeline from the Insights API.
516
- * Shared implementation used by both MaestroProcessesService and CasesService.
856
+ * Builds the request body for Insights RTM timeline endpoints
857
+ * (`InstanceStatusByDate`, `IncidentsByTimeWindow`).
517
858
  *
518
- * @param postFn - Bound post method from a BaseService subclass
519
859
  * @param startTime - Start of the time range to query
520
860
  * @param endTime - End of the time range to query
521
861
  * @param isCaseManagement - Whether to filter for case management processes
522
- * @param options - Optional settings for time bucketing granularity
523
- * @returns Promise resolving to an array of instance status timeline entries
862
+ * @param options - Optional time bucketing and filtering settings
863
+ * @returns Request body for the Insights RTM timeline endpoint
524
864
  * @internal
525
865
  */
526
- async function fetchInstanceStatusTimeline(postFn, startTime, endTime, isCaseManagement, options) {
527
- const response = await postFn(MAESTRO_ENDPOINTS.INSIGHTS.INSTANCE_STATUS_BY_DATE, {
866
+ function buildInsightsTimelineBody(startTime, endTime, isCaseManagement, options) {
867
+ return {
528
868
  commonParams: {
529
869
  startTime: startTime.getTime(),
530
870
  endTime: endTime.getTime(),
531
871
  isCaseManagement,
872
+ ...(options?.packageId ? { packageId: options.packageId } : {}),
873
+ ...(options?.version ? { version: options.version } : {}),
874
+ ...(options?.processKeys ? { processKeys: options.processKeys } : {}),
532
875
  },
533
- timeSliceUnit: options?.groupBy,
876
+ timeSliceUnit: options?.groupBy ?? exports.TimeInterval.Day,
534
877
  timezoneOffset: new Date().getTimezoneOffset() * -1,
535
- });
536
- return response.data ?? [];
878
+ };
537
879
  }
538
880
  /**
539
881
  * Builds the commonParams request body for Insights RTM endpoints
@@ -2309,26 +2651,78 @@ class CasesService extends BaseService {
2309
2651
  }));
2310
2652
  }
2311
2653
  /**
2312
- * Get all instances status counts aggregated by date for case management processes.
2654
+ * Get all instances status counts aggregated by date for case management processes.
2655
+ *
2656
+ * Returns time-grouped counts of case instances grouped by status (Completed, Faulted, Cancelled),
2657
+ * useful for rendering time-series charts. Use `groupBy` to control the time bucket size
2658
+ * (hour, day, or week) — defaults to day if not provided.
2659
+ *
2660
+ * @param startTime - Start of the time range to query
2661
+ * @param endTime - End of the time range to query
2662
+ * @param options - Optional settings for filtering and time bucket granularity
2663
+ * @returns Promise resolving to an array of {@link InstanceStatusTimelineResponse}
2664
+ *
2665
+ * @example
2666
+ * ```typescript
2667
+ * // Get daily instance status for the last 7 days
2668
+ * const now = new Date();
2669
+ * const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
2670
+ * const statuses = await cases.getInstanceStatusTimeline(sevenDaysAgo, now);
2671
+ *
2672
+ * for (const entry of statuses) {
2673
+ * console.log(`${entry.startTime} — ${entry.status}: ${entry.count}`);
2674
+ * }
2675
+ * ```
2676
+ *
2677
+ * @example
2678
+ * ```typescript
2679
+ * import { TimeInterval } from '@uipath/uipath-typescript/cases';
2680
+ *
2681
+ * // Get weekly breakdown
2682
+ * const statuses = await cases.getInstanceStatusTimeline(startTime, endTime, {
2683
+ * groupBy: TimeInterval.Week,
2684
+ * });
2685
+ * ```
2686
+ *
2687
+ * @example
2688
+ * ```typescript
2689
+ * // Filter to a specific case process
2690
+ * const filtered = await cases.getInstanceStatusTimeline(startTime, endTime, {
2691
+ * processKeys: ['<processKey>'],
2692
+ * });
2693
+ * ```
2694
+ *
2695
+ * @example
2696
+ * ```typescript
2697
+ * // Get all-time data (from Unix epoch to now)
2698
+ * const allTime = await cases.getInstanceStatusTimeline(new Date(0), new Date());
2699
+ * ```
2700
+ */
2701
+ async getInstanceStatusTimeline(startTime, endTime, options) {
2702
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.INSTANCE_STATUS_BY_DATE, buildInsightsTimelineBody(startTime, endTime, true, options));
2703
+ return data ?? [];
2704
+ }
2705
+ /**
2706
+ * Get incident counts aggregated by time bucket for case management processes.
2313
2707
  *
2314
- * Returns time-grouped counts of case instances grouped by status (Completed, Faulted, Cancelled),
2315
- * useful for rendering time-series charts. Use `groupBy` to control the time bucket size
2316
- * (hour, day, or week) — defaults to day if not provided.
2708
+ * Returns time-grouped counts of incidents that occurred within each bucket,
2709
+ * useful for rendering incident time-series charts. Use `groupBy` to control
2710
+ * the time bucket size (hour, day, or week) — defaults to day if not provided.
2317
2711
  *
2318
2712
  * @param startTime - Start of the time range to query
2319
2713
  * @param endTime - End of the time range to query
2320
- * @param options - Optional settings for time bucketing granularity
2321
- * @returns Promise resolving to an array of {@link InstanceStatusTimelineResponse}
2714
+ * @param options - Optional settings for filtering and time bucket granularity
2715
+ * @returns Promise resolving to an array of {@link IncidentTimelineResponse}
2322
2716
  *
2323
2717
  * @example
2324
2718
  * ```typescript
2325
- * // Get daily instance status for the last 7 days
2719
+ * // Get daily incident counts for the last 7 days
2326
2720
  * const now = new Date();
2327
2721
  * const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
2328
- * const statuses = await cases.getInstanceStatusTimeline(sevenDaysAgo, now);
2722
+ * const incidents = await cases.getIncidentsTimeline(sevenDaysAgo, now);
2329
2723
  *
2330
- * for (const entry of statuses) {
2331
- * console.log(`${entry.startTime} ${entry.status}: ${entry.count}`);
2724
+ * for (const incident of incidents) {
2725
+ * console.log(`${incident.startTime} ${incident.endTime}: ${incident.count} incidents`);
2332
2726
  * }
2333
2727
  * ```
2334
2728
  *
@@ -2337,19 +2731,22 @@ class CasesService extends BaseService {
2337
2731
  * import { TimeInterval } from '@uipath/uipath-typescript/cases';
2338
2732
  *
2339
2733
  * // Get weekly breakdown
2340
- * const statuses = await cases.getInstanceStatusTimeline(startTime, endTime, {
2734
+ * const incidents = await cases.getIncidentsTimeline(startTime, endTime, {
2341
2735
  * groupBy: TimeInterval.Week,
2342
2736
  * });
2343
2737
  * ```
2344
2738
  *
2345
2739
  * @example
2346
2740
  * ```typescript
2347
- * // Get all-time data (from Unix epoch to now)
2348
- * const allTime = await cases.getInstanceStatusTimeline(new Date(0), new Date());
2741
+ * // Filter to a specific case process
2742
+ * const filtered = await cases.getIncidentsTimeline(startTime, endTime, {
2743
+ * processKeys: ['<processKey>'],
2744
+ * });
2349
2745
  * ```
2350
2746
  */
2351
- async getInstanceStatusTimeline(startTime, endTime, options) {
2352
- return fetchInstanceStatusTimeline(this.post.bind(this), startTime, endTime, true, options);
2747
+ async getIncidentsTimeline(startTime, endTime, options) {
2748
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.INCIDENTS_BY_TIME_WINDOW, buildInsightsTimelineBody(startTime, endTime, true, options));
2749
+ return data?.dataPoints ?? [];
2353
2750
  }
2354
2751
  /**
2355
2752
  * Get the top 10 case processes ranked by failure count within a time range.
@@ -2548,6 +2945,9 @@ __decorate([
2548
2945
  __decorate([
2549
2946
  track('Cases.GetInstanceStatusTimeline')
2550
2947
  ], CasesService.prototype, "getInstanceStatusTimeline", null);
2948
+ __decorate([
2949
+ track('Cases.GetIncidentsTimeline')
2950
+ ], CasesService.prototype, "getIncidentsTimeline", null);
2551
2951
  __decorate([
2552
2952
  track('Cases.GetTopFaultedCount')
2553
2953
  ], CasesService.prototype, "getTopFaultedCount", null);
@@ -2561,243 +2961,6 @@ __decorate([
2561
2961
  track('Cases.GetInstanceStats')
2562
2962
  ], CasesService.prototype, "getInstanceStats", null);
2563
2963
 
2564
- /**
2565
- * Process Incident Status
2566
- */
2567
- var ProcessIncidentStatus;
2568
- (function (ProcessIncidentStatus) {
2569
- ProcessIncidentStatus["Open"] = "Open";
2570
- ProcessIncidentStatus["Closed"] = "Closed";
2571
- })(ProcessIncidentStatus || (ProcessIncidentStatus = {}));
2572
- /**
2573
- * Process Incident Type
2574
- */
2575
- var ProcessIncidentType;
2576
- (function (ProcessIncidentType) {
2577
- ProcessIncidentType["System"] = "System";
2578
- ProcessIncidentType["User"] = "User";
2579
- ProcessIncidentType["Deployment"] = "Deployment";
2580
- })(ProcessIncidentType || (ProcessIncidentType = {}));
2581
- /**
2582
- * Process Incident Severity
2583
- */
2584
- var ProcessIncidentSeverity;
2585
- (function (ProcessIncidentSeverity) {
2586
- ProcessIncidentSeverity["Error"] = "Error";
2587
- ProcessIncidentSeverity["Warning"] = "Warning";
2588
- })(ProcessIncidentSeverity || (ProcessIncidentSeverity = {}));
2589
- /**
2590
- * Process Incident Debug Mode
2591
- */
2592
- var DebugMode;
2593
- (function (DebugMode) {
2594
- DebugMode["None"] = "None";
2595
- DebugMode["Default"] = "Default";
2596
- DebugMode["StepByStep"] = "StepByStep";
2597
- DebugMode["SingleStep"] = "SingleStep";
2598
- })(DebugMode || (DebugMode = {}));
2599
-
2600
- /**
2601
- * Case Instance Types
2602
- * Types and interfaces for Maestro case instance management
2603
- */
2604
- /**
2605
- * SLA status for a case instance
2606
- */
2607
- exports.SlaSummaryStatus = void 0;
2608
- (function (SlaSummaryStatus) {
2609
- /** Case is within SLA deadline */
2610
- SlaSummaryStatus["ON_TRACK"] = "On Track";
2611
- /** Case is approaching SLA deadline based on at-risk percentage threshold */
2612
- SlaSummaryStatus["AT_RISK"] = "At Risk";
2613
- /** Case has exceeded SLA deadline */
2614
- SlaSummaryStatus["OVERDUE"] = "Overdue";
2615
- /** Case instance has completed */
2616
- SlaSummaryStatus["COMPLETED"] = "Completed";
2617
- /** SLA status cannot be determined (no SLA deadline defined) */
2618
- SlaSummaryStatus["UNKNOWN"] = "Unknown";
2619
- })(exports.SlaSummaryStatus || (exports.SlaSummaryStatus = {}));
2620
- /**
2621
- * Instance status values for case instances and process instances
2622
- */
2623
- exports.InstanceStatus = void 0;
2624
- (function (InstanceStatus) {
2625
- /** Instance status not yet populated by the backend */
2626
- InstanceStatus["UNKNOWN"] = "";
2627
- InstanceStatus["CANCELLED"] = "Cancelled";
2628
- InstanceStatus["CANCELING"] = "Canceling";
2629
- InstanceStatus["COMPLETED"] = "Completed";
2630
- InstanceStatus["FAULTED"] = "Faulted";
2631
- InstanceStatus["PAUSED"] = "Paused";
2632
- InstanceStatus["PAUSING"] = "Pausing";
2633
- InstanceStatus["PENDING"] = "Pending";
2634
- InstanceStatus["RESUMING"] = "Resuming";
2635
- InstanceStatus["RETRYING"] = "Retrying";
2636
- InstanceStatus["RUNNING"] = "Running";
2637
- InstanceStatus["UPGRADING"] = "Upgrading";
2638
- })(exports.InstanceStatus || (exports.InstanceStatus = {}));
2639
- /**
2640
- * Case stage task type
2641
- */
2642
- exports.StageTaskType = void 0;
2643
- (function (StageTaskType) {
2644
- StageTaskType["EXTERNAL_AGENT"] = "external-agent";
2645
- StageTaskType["RPA"] = "rpa";
2646
- StageTaskType["AGENTIC_PROCESS"] = "process";
2647
- StageTaskType["AGENT"] = "agent";
2648
- StageTaskType["ACTION"] = "action";
2649
- StageTaskType["API_WORKFLOW"] = "api-workflow";
2650
- })(exports.StageTaskType || (exports.StageTaskType = {}));
2651
- /**
2652
- * Escalation recipient scope
2653
- */
2654
- exports.EscalationRecipientScope = void 0;
2655
- (function (EscalationRecipientScope) {
2656
- EscalationRecipientScope["USER"] = "user";
2657
- EscalationRecipientScope["USER_GROUP"] = "usergroup";
2658
- })(exports.EscalationRecipientScope || (exports.EscalationRecipientScope = {}));
2659
- /**
2660
- * Escalation action type
2661
- */
2662
- exports.EscalationActionType = void 0;
2663
- (function (EscalationActionType) {
2664
- EscalationActionType["NOTIFICATION"] = "notification";
2665
- })(exports.EscalationActionType || (exports.EscalationActionType = {}));
2666
- /**
2667
- * Escalation rule trigger type
2668
- */
2669
- exports.EscalationTriggerType = void 0;
2670
- (function (EscalationTriggerType) {
2671
- EscalationTriggerType["SLA_BREACHED"] = "sla-breached";
2672
- EscalationTriggerType["AT_RISK"] = "at-risk";
2673
- /** Default value when no escalation rule is defined */
2674
- EscalationTriggerType["NONE"] = "None";
2675
- })(exports.EscalationTriggerType || (exports.EscalationTriggerType = {}));
2676
- /**
2677
- * SLA duration unit
2678
- */
2679
- exports.SLADurationUnit = void 0;
2680
- (function (SLADurationUnit) {
2681
- SLADurationUnit["HOURS"] = "h";
2682
- SLADurationUnit["DAYS"] = "d";
2683
- SLADurationUnit["WEEKS"] = "w";
2684
- SLADurationUnit["MONTHS"] = "m";
2685
- })(exports.SLADurationUnit || (exports.SLADurationUnit = {}));
2686
-
2687
- /**
2688
- * Creates methods for a case instance
2689
- *
2690
- * @param instanceData - The case instance data (response from API)
2691
- * @param service - The case instance service instance
2692
- * @returns Object containing case instance methods
2693
- */
2694
- function createCaseInstanceMethods(instanceData, service) {
2695
- return {
2696
- async close(options) {
2697
- if (!instanceData.instanceId)
2698
- throw new Error('Case instance ID is undefined');
2699
- if (!instanceData.folderKey)
2700
- throw new Error('Case instance folder key is undefined');
2701
- return service.close(instanceData.instanceId, instanceData.folderKey, options);
2702
- },
2703
- async pause(options) {
2704
- if (!instanceData.instanceId)
2705
- throw new Error('Case instance ID is undefined');
2706
- if (!instanceData.folderKey)
2707
- throw new Error('Case instance folder key is undefined');
2708
- return service.pause(instanceData.instanceId, instanceData.folderKey, options);
2709
- },
2710
- async reopen(options) {
2711
- if (!instanceData.instanceId)
2712
- throw new Error('Case instance ID is undefined');
2713
- if (!instanceData.folderKey)
2714
- throw new Error('Case instance folder key is undefined');
2715
- return service.reopen(instanceData.instanceId, instanceData.folderKey, options);
2716
- },
2717
- async resume(options) {
2718
- if (!instanceData.instanceId)
2719
- throw new Error('Case instance ID is undefined');
2720
- if (!instanceData.folderKey)
2721
- throw new Error('Case instance folder key is undefined');
2722
- return service.resume(instanceData.instanceId, instanceData.folderKey, options);
2723
- },
2724
- async getExecutionHistory() {
2725
- if (!instanceData.instanceId)
2726
- throw new Error('Case instance ID is undefined');
2727
- if (!instanceData.folderKey)
2728
- throw new Error('Case instance folder key is undefined');
2729
- return service.getExecutionHistory(instanceData.instanceId, instanceData.folderKey);
2730
- },
2731
- async getStages() {
2732
- if (!instanceData.instanceId)
2733
- throw new Error('Case instance ID is undefined');
2734
- if (!instanceData.folderKey)
2735
- throw new Error('Case instance folder key is undefined');
2736
- return service.getStages(instanceData.instanceId, instanceData.folderKey);
2737
- },
2738
- async getActionTasks(options) {
2739
- if (!instanceData.instanceId)
2740
- throw new Error('Case instance ID is undefined');
2741
- return service.getActionTasks(instanceData.instanceId, options);
2742
- },
2743
- async getSlaSummary(options) {
2744
- if (!instanceData.instanceId)
2745
- throw new Error('Case instance ID is undefined');
2746
- return service.getSlaSummary({ ...options, caseInstanceId: instanceData.instanceId });
2747
- },
2748
- async getStagesSlaSummary() {
2749
- if (!instanceData.instanceId)
2750
- throw new Error('Case instance ID is undefined');
2751
- return service.getStagesSlaSummary({ caseInstanceId: instanceData.instanceId });
2752
- }
2753
- };
2754
- }
2755
- /**
2756
- * Creates an actionable case instance by combining API case instance data with operational methods.
2757
- *
2758
- * @param instanceData - The case instance data from API
2759
- * @param service - The case instance service instance
2760
- * @returns A case instance object with added methods
2761
- */
2762
- function createCaseInstanceWithMethods(instanceData, service) {
2763
- const methods = createCaseInstanceMethods(instanceData, service);
2764
- return Object.assign({}, instanceData, methods);
2765
- }
2766
-
2767
- /**
2768
- * Insights Types
2769
- * Shared types for Maestro insights analytics endpoints
2770
- */
2771
- /**
2772
- * Time bucketing granularity for insights time-series queries.
2773
- *
2774
- * Controls how data points are grouped on the time axis.
2775
- */
2776
- exports.TimeInterval = void 0;
2777
- (function (TimeInterval) {
2778
- /** Group data points by hour */
2779
- TimeInterval["Hour"] = "HOUR";
2780
- /** Group data points by day */
2781
- TimeInterval["Day"] = "DAY";
2782
- /** Group data points by week */
2783
- TimeInterval["Week"] = "WEEK";
2784
- })(exports.TimeInterval || (exports.TimeInterval = {}));
2785
- /**
2786
- * Final instance statuses returned by the instance status timeline endpoint.
2787
- *
2788
- * Only includes statuses where the instance has finished execution — Completed, Faulted, or Cancelled.
2789
- * Active statuses like Running or Paused are not included.
2790
- */
2791
- exports.InstanceFinalStatus = void 0;
2792
- (function (InstanceFinalStatus) {
2793
- /** Instance completed successfully */
2794
- InstanceFinalStatus["Completed"] = "Completed";
2795
- /** Instance encountered an error */
2796
- InstanceFinalStatus["Faulted"] = "Faulted";
2797
- /** Instance was cancelled */
2798
- InstanceFinalStatus["Cancelled"] = "Cancelled";
2799
- })(exports.InstanceFinalStatus || (exports.InstanceFinalStatus = {}));
2800
-
2801
2964
  /**
2802
2965
  * Maps fields for Case Instance entities to ensure consistent naming
2803
2966
  */
@@ -3220,6 +3383,10 @@ class TaskService extends BaseService {
3220
3383
  const transformedTask = transformData(pascalToCamelCaseKeys(task), TaskMap);
3221
3384
  return createTaskWithMethods(applyDataTransforms(transformedTask, { field: 'status', valueMap: TaskStatusMap }), this);
3222
3385
  };
3386
+ // Rewrite renamed SDK field names → API names inside OData strings
3387
+ // before delegating, mirroring the transformRequest pattern used for
3388
+ // request bodies.
3389
+ const apiOptions = options ? transformOptions(options, TaskMap) : options;
3223
3390
  return PaginationHelpers.getAll({
3224
3391
  serviceAccess: this.createPaginationServiceAccess(),
3225
3392
  getEndpoint: () => endpoint,
@@ -3236,7 +3403,7 @@ class TaskService extends BaseService {
3236
3403
  countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM // OData OFFSET parameter
3237
3404
  }
3238
3405
  }
3239
- }, options);
3406
+ }, apiOptions);
3240
3407
  }
3241
3408
  /**
3242
3409
  * Gets a task by ID
@@ -3272,9 +3439,10 @@ class TaskService extends BaseService {
3272
3439
  const headers = createHeaders({ [FOLDER_ID]: folderId });
3273
3440
  // Add default expand parameters
3274
3441
  const modifiedOptions = this.addDefaultExpand(restOptions);
3275
- // prefix all keys in options
3276
- const keysToPrefix = Object.keys(modifiedOptions);
3277
- const apiOptions = addPrefixToKeys(modifiedOptions, ODATA_PREFIX, keysToPrefix);
3442
+ // Rewrite renamed SDK field names → API names inside OData strings,
3443
+ // then prefix all keys for OData.
3444
+ const apiFieldOptions = transformOptions(modifiedOptions, TaskMap);
3445
+ const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
3278
3446
  const response = await this.get(TASK_ENDPOINTS.GET_BY_ID(id), {
3279
3447
  params: apiOptions,
3280
3448
  headers