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