@uipath/uipath-typescript 1.3.7 → 1.3.9

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 (47) hide show
  1. package/dist/assets/index.cjs +64 -274
  2. package/dist/assets/index.d.ts +1 -0
  3. package/dist/assets/index.mjs +64 -274
  4. package/dist/attachments/index.cjs +62 -271
  5. package/dist/attachments/index.d.ts +1 -0
  6. package/dist/attachments/index.mjs +62 -271
  7. package/dist/buckets/index.cjs +93 -274
  8. package/dist/buckets/index.d.ts +51 -1
  9. package/dist/buckets/index.mjs +93 -274
  10. package/dist/cases/index.cjs +580 -336
  11. package/dist/cases/index.d.ts +690 -3
  12. package/dist/cases/index.mjs +581 -337
  13. package/dist/conversational-agent/index.cjs +110 -285
  14. package/dist/conversational-agent/index.d.ts +63 -12
  15. package/dist/conversational-agent/index.mjs +110 -286
  16. package/dist/core/index.cjs +39 -289
  17. package/dist/core/index.d.ts +9 -98
  18. package/dist/core/index.mjs +40 -275
  19. package/dist/document-understanding/index.cjs +18 -1
  20. package/dist/document-understanding/index.d.ts +636 -610
  21. package/dist/document-understanding/index.mjs +18 -1
  22. package/dist/entities/index.cjs +64 -274
  23. package/dist/entities/index.d.ts +1 -0
  24. package/dist/entities/index.mjs +64 -274
  25. package/dist/feedback/index.cjs +313 -276
  26. package/dist/feedback/index.d.ts +418 -12
  27. package/dist/feedback/index.mjs +313 -276
  28. package/dist/index.cjs +777 -297
  29. package/dist/index.d.ts +2005 -721
  30. package/dist/index.mjs +777 -283
  31. package/dist/index.umd.js +966 -162
  32. package/dist/jobs/index.cjs +64 -274
  33. package/dist/jobs/index.d.ts +1 -0
  34. package/dist/jobs/index.mjs +64 -274
  35. package/dist/maestro-processes/index.cjs +1789 -1686
  36. package/dist/maestro-processes/index.d.ts +431 -2
  37. package/dist/maestro-processes/index.mjs +1790 -1687
  38. package/dist/processes/index.cjs +64 -274
  39. package/dist/processes/index.d.ts +1 -0
  40. package/dist/processes/index.mjs +64 -274
  41. package/dist/queues/index.cjs +64 -274
  42. package/dist/queues/index.d.ts +1 -0
  43. package/dist/queues/index.mjs +64 -274
  44. package/dist/tasks/index.cjs +64 -274
  45. package/dist/tasks/index.d.ts +1 -0
  46. package/dist/tasks/index.mjs +64 -274
  47. package/package.json +8 -10
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { BatchLogRecordProcessor, LoggerProvider } from '@opentelemetry/sdk-logs';
1
+ import { getOrCreateClient, createTrack, createTrackEvent } from '@uipath/core-telemetry';
2
2
 
3
3
  /******************************************************************************
4
4
  Copyright (c) Microsoft Corporation.
@@ -4478,6 +4478,7 @@ const ORCHESTRATOR_BASE = 'orchestrator_';
4478
4478
  const PIMS_BASE = 'pims_';
4479
4479
  const DATAFABRIC_BASE = 'datafabric_';
4480
4480
  const IDENTITY_BASE = 'identity_';
4481
+ const INSIGHTS_RTM_BASE = 'insightsrtm_';
4481
4482
 
4482
4483
  /**
4483
4484
  * Orchestrator Service Endpoints
@@ -4584,6 +4585,20 @@ const MAESTRO_ENDPOINTS = {
4584
4585
  GET_ELEMENT_EXECUTIONS: (instanceId) => `${PIMS_BASE}/api/v1/element-executions/case-instances/${instanceId}`,
4585
4586
  REOPEN: (instanceId) => `${PIMS_BASE}/api/v1/cases/${instanceId}/reopen`,
4586
4587
  },
4588
+ INSIGHTS: {
4589
+ /** SLA summary for case instances */
4590
+ SLA_SUMMARY: `${INSIGHTS_RTM_BASE}/caseManagement/slaSummary`,
4591
+ /** Stages summary for case instances */
4592
+ STAGES_SUMMARY: `${INSIGHTS_RTM_BASE}/caseManagement/stages`,
4593
+ /** Top processes ranked by run count */
4594
+ TOP_PROCESSES_BY_RUN_COUNT: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByRunCount`,
4595
+ /** Top processes ranked by failure count */
4596
+ TOP_PROCESSES_WITH_FAILURE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcesseswithFailure`,
4597
+ /** Instance status aggregated by date for time-series charts */
4598
+ INSTANCE_STATUS_BY_DATE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/InstanceStatusByDate`,
4599
+ /** Top processes ranked by total duration */
4600
+ TOP_PROCESSES_BY_DURATION: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByDuration`,
4601
+ },
4587
4602
  };
4588
4603
 
4589
4604
  /**
@@ -5457,284 +5472,49 @@ function normalizeBaseUrl(url) {
5457
5472
  }
5458
5473
 
5459
5474
  /**
5460
- * SDK Telemetry constants
5461
- */
5462
- // Connection string placeholder that will be replaced during build
5463
- const CONNECTION_STRING = "InstrumentationKey=a6efa11d-1feb-4508-9738-e13e12dcae5e;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=7c58eb1c-9581-4ba6-839e-11725848a037";
5464
- // SDK Version placeholder
5465
- const SDK_VERSION = "1.3.7";
5466
- const VERSION = "Version";
5467
- const SERVICE = "Service";
5468
- const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
5469
- const CLOUD_TENANT_NAME = "CloudTenantName";
5470
- const CLOUD_URL = "CloudUrl";
5471
- const CLOUD_CLIENT_ID = "CloudClientId";
5472
- const CLOUD_REDIRECT_URI = "CloudRedirectUri";
5473
- const APP_NAME = "ApplicationName";
5474
- const CLOUD_ROLE_NAME = "uipath-ts-sdk";
5475
- // Service and logger names
5476
- const SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
5477
- const SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
5478
- // Event names
5479
- const SDK_RUN_EVENT = "Sdk.Run";
5480
- // Default value for unknown/empty attributes
5481
- const UNKNOWN$1 = "";
5482
-
5483
- /**
5484
- * Log exporter that sends ALL logs as Application Insights custom events
5485
- */
5486
- class ApplicationInsightsEventExporter {
5487
- constructor(connectionString) {
5488
- this.connectionString = connectionString;
5489
- }
5490
- export(logs, resultCallback) {
5491
- try {
5492
- logs.forEach(logRecord => {
5493
- this.sendAsCustomEvent(logRecord);
5494
- });
5495
- resultCallback({ code: 0 });
5496
- }
5497
- catch (error) {
5498
- console.debug('Failed to export logs to Application Insights:', error);
5499
- resultCallback({ code: 2, error });
5500
- }
5501
- }
5502
- shutdown() {
5503
- return Promise.resolve();
5504
- }
5505
- sendAsCustomEvent(logRecord) {
5506
- // Get event name from body or attributes
5507
- const eventName = logRecord.body || SDK_RUN_EVENT;
5508
- const payload = {
5509
- name: 'Microsoft.ApplicationInsights.Event',
5510
- time: new Date().toISOString(),
5511
- iKey: this.extractInstrumentationKey(),
5512
- data: {
5513
- baseType: 'EventData',
5514
- baseData: {
5515
- ver: 2,
5516
- name: eventName,
5517
- properties: this.convertAttributesToProperties(logRecord.attributes || {})
5518
- }
5519
- },
5520
- tags: {
5521
- 'ai.cloud.role': CLOUD_ROLE_NAME,
5522
- 'ai.cloud.roleInstance': SDK_VERSION
5523
- }
5524
- };
5525
- this.sendToApplicationInsights(payload);
5526
- }
5527
- extractInstrumentationKey() {
5528
- const match = this.connectionString.match(/InstrumentationKey=([^;]+)/);
5529
- return match ? match[1] : '';
5530
- }
5531
- convertAttributesToProperties(attributes) {
5532
- const properties = {};
5533
- Object.entries(attributes || {}).forEach(([key, value]) => {
5534
- properties[key] = String(value);
5535
- });
5536
- return properties;
5537
- }
5538
- async sendToApplicationInsights(payload) {
5539
- try {
5540
- const ingestionEndpoint = this.extractIngestionEndpoint();
5541
- if (!ingestionEndpoint) {
5542
- console.debug('No ingestion endpoint found in connection string');
5543
- return;
5544
- }
5545
- const url = `${ingestionEndpoint}/v2/track`;
5546
- const response = await fetch(url, {
5547
- method: 'POST',
5548
- headers: {
5549
- 'Content-Type': 'application/json',
5550
- },
5551
- body: JSON.stringify(payload)
5552
- });
5553
- if (!response.ok) {
5554
- console.debug(`Failed to send event telemetry: ${response.status} ${response.statusText}`);
5555
- }
5556
- }
5557
- catch (error) {
5558
- console.debug('Error sending event telemetry to Application Insights:', error);
5559
- }
5560
- }
5561
- extractIngestionEndpoint() {
5562
- const match = this.connectionString.match(/IngestionEndpoint=([^;]+)/);
5563
- return match ? match[1] : '';
5564
- }
5565
- }
5566
- /**
5567
- * Singleton telemetry client
5568
- */
5569
- class TelemetryClient {
5570
- constructor() {
5571
- this.isInitialized = false;
5572
- }
5573
- static getInstance() {
5574
- if (!TelemetryClient.instance) {
5575
- TelemetryClient.instance = new TelemetryClient();
5576
- }
5577
- return TelemetryClient.instance;
5578
- }
5579
- /**
5580
- * Initialize telemetry
5581
- */
5582
- initialize(config) {
5583
- if (this.isInitialized) {
5584
- return;
5585
- }
5586
- this.isInitialized = true;
5587
- if (config) {
5588
- this.telemetryContext = config;
5589
- }
5590
- try {
5591
- const connectionString = this.getConnectionString();
5592
- if (!connectionString) {
5593
- return;
5594
- }
5595
- this.setupTelemetryProvider(connectionString);
5596
- }
5597
- catch (error) {
5598
- // Silent failure - telemetry errors shouldn't break functionality
5599
- console.debug('Failed to initialize OpenTelemetry:', error);
5600
- }
5601
- }
5602
- getConnectionString() {
5603
- const connectionString = CONNECTION_STRING;
5604
- return connectionString;
5605
- }
5606
- setupTelemetryProvider(connectionString) {
5607
- const exporter = new ApplicationInsightsEventExporter(connectionString);
5608
- const processor = new BatchLogRecordProcessor(exporter);
5609
- this.logProvider = new LoggerProvider({
5610
- processors: [processor]
5611
- });
5612
- this.logger = this.logProvider.getLogger(SDK_LOGGER_NAME);
5613
- }
5614
- /**
5615
- * Track a telemetry event
5616
- */
5617
- track(eventName, name, extraAttributes = {}) {
5618
- try {
5619
- // Skip if logger not initialized
5620
- if (!this.logger) {
5621
- return;
5622
- }
5623
- const finalDisplayName = name || eventName;
5624
- const attributes = this.getEnrichedAttributes(extraAttributes, eventName);
5625
- // Emit as log
5626
- this.logger.emit({
5627
- body: finalDisplayName,
5628
- attributes: attributes,
5629
- timestamp: Date.now(),
5630
- });
5631
- }
5632
- catch (error) {
5633
- // Silent failure
5634
- console.debug('Failed to track telemetry event:', error);
5635
- }
5636
- }
5637
- /**
5638
- * Get enriched attributes for telemetry events
5639
- */
5640
- getEnrichedAttributes(extraAttributes, eventName) {
5641
- const attributes = {
5642
- [APP_NAME]: SDK_SERVICE_NAME,
5643
- [VERSION]: SDK_VERSION,
5644
- [SERVICE]: eventName,
5645
- [CLOUD_URL]: this.createCloudUrl(),
5646
- [CLOUD_ORGANIZATION_NAME]: this.telemetryContext?.orgName || UNKNOWN$1,
5647
- [CLOUD_TENANT_NAME]: this.telemetryContext?.tenantName || UNKNOWN$1,
5648
- [CLOUD_REDIRECT_URI]: this.telemetryContext?.redirectUri || UNKNOWN$1,
5649
- [CLOUD_CLIENT_ID]: this.telemetryContext?.clientId || UNKNOWN$1,
5650
- ...extraAttributes,
5651
- };
5652
- return attributes;
5653
- }
5654
- /**
5655
- * Create cloud URL from base URL, organization ID, and tenant ID
5656
- */
5657
- createCloudUrl() {
5658
- const baseUrl = this.telemetryContext?.baseUrl;
5659
- const orgId = this.telemetryContext?.orgName;
5660
- const tenantId = this.telemetryContext?.tenantName;
5661
- if (!baseUrl || !orgId || !tenantId) {
5662
- return UNKNOWN$1;
5663
- }
5664
- return `${baseUrl}/${orgId}/${tenantId}`;
5665
- }
5666
- }
5667
- // Export singleton instance
5668
- const telemetryClient = TelemetryClient.getInstance();
5669
-
5670
- /**
5671
- * SDK Track decorator and function for telemetry
5672
- */
5673
- /**
5674
- * Common tracking logic shared between method and function decorators
5675
- */
5676
- function createTrackedFunction(originalFunction, nameOrOptions, fallbackName, opts) {
5677
- return function (...args) {
5678
- // Determine if we should track this call
5679
- let shouldTrack = true;
5680
- if (opts.condition !== undefined) {
5681
- if (typeof opts.condition === 'function') {
5682
- shouldTrack = opts.condition.apply(this, args);
5683
- }
5684
- else {
5685
- shouldTrack = opts.condition;
5686
- }
5687
- }
5688
- // Track the event if enabled
5689
- if (shouldTrack) {
5690
- // Use the full name provided in the decorator (e.g., "Queue.GetAll")
5691
- const serviceMethod = typeof nameOrOptions === 'string'
5692
- ? nameOrOptions
5693
- : fallbackName;
5694
- // Use 'Sdk.Run' as the name and serviceMethod as the service
5695
- telemetryClient.track(serviceMethod, SDK_RUN_EVENT, opts.attributes);
5696
- }
5697
- // Execute the original function
5698
- return originalFunction.apply(this, args);
5699
- };
5700
- }
5701
- /**
5702
- * Track decorator that can be used to automatically track function calls
5703
- *
5704
- * Usage:
5705
- * @track("Service.Method")
5706
- * function myFunction() { ... }
5475
+ * SDK Telemetry constants.
5707
5476
  *
5708
- * @track("Queue.GetAll")
5709
- * async getAll() { ... }
5477
+ * Only the SDK's identity (version, service name, role name, …) lives
5478
+ * here. The Application Insights connection string is injected into
5479
+ * `@uipath/core-telemetry` itself at publish time, and the generic attribute
5480
+ * keys (`Version`, `Service`, `CloudOrganizationName`, …) are owned by
5481
+ * `@uipath/core-telemetry` and consumed there — they are not part of the
5482
+ * SDK's public API.
5483
+ */
5484
+ /** SDK version placeholder — patched by the SDK publish workflow. */
5485
+ const SDK_VERSION = '1.3.9';
5486
+ const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
5487
+ const SDK_SERVICE_NAME = 'UiPath.TypeScript.Sdk';
5488
+ const SDK_LOGGER_NAME = 'uipath-ts-sdk-telemetry';
5489
+ const SDK_RUN_EVENT = 'Sdk.Run';
5490
+
5491
+ /**
5492
+ * UiPath TypeScript SDK Telemetry
5710
5493
  *
5711
- * @track("Tasks.Create")
5712
- * async create() { ... }
5713
- *
5714
- * @track("Assets.Update", { condition: false })
5715
- * function myFunction() { ... }
5716
- *
5717
- * @track("Processes.Start", { attributes: { customProp: "value" } })
5718
- * function myFunction() { ... }
5719
- */
5720
- function track(nameOrOptions, options) {
5721
- return function decorator(_target, propertyKey, descriptor) {
5722
- const opts = typeof nameOrOptions === 'object' ? nameOrOptions : options || {};
5723
- if (descriptor && typeof descriptor.value === 'function') {
5724
- // Method decorator
5725
- descriptor.value = createTrackedFunction(descriptor.value, nameOrOptions, propertyKey || 'unknown_method', opts);
5726
- return descriptor;
5727
- }
5728
- // Function decorator
5729
- return (originalFunction) => createTrackedFunction(originalFunction, nameOrOptions, originalFunction.name || 'unknown_function', opts);
5730
- };
5731
- }
5732
- /**
5733
- * Direct tracking function
5734
- */
5735
- function trackEvent(eventName, name, attributes) {
5736
- telemetryClient.track(eventName, name, attributes);
5737
- }
5494
+ * Constructs the SDK's own `TelemetryClient` and binds the SDK-local
5495
+ * `track` / `trackEvent` to it. Each consumer of `@uipath/core-telemetry`
5496
+ * does this independently, so events carry their own consumer's identity
5497
+ * and tenant context.
5498
+ */
5499
+ // Keyed by `CLOUD_ROLE_NAME` so every SDK subpath bundle resolves to the
5500
+ // same `TelemetryClient` instance at runtime. A single `initialize(...)`
5501
+ // from the `UiPath` constructor therefore wires up `@track` decorators
5502
+ // across every subpath bundle (`assets`, `feedback`, `tasks`, …).
5503
+ const sdkClient = getOrCreateClient(CLOUD_ROLE_NAME);
5504
+ const track = createTrack(sdkClient);
5505
+ const trackEvent = createTrackEvent(sdkClient);
5506
+ const telemetryClient = {
5507
+ initialize(context) {
5508
+ sdkClient.initialize({
5509
+ sdkVersion: SDK_VERSION,
5510
+ serviceName: SDK_SERVICE_NAME,
5511
+ cloudRoleName: CLOUD_ROLE_NAME,
5512
+ loggerName: SDK_LOGGER_NAME,
5513
+ defaultEventName: SDK_RUN_EVENT,
5514
+ context,
5515
+ });
5516
+ },
5517
+ };
5738
5518
 
5739
5519
  /**
5740
5520
  * SDK Internals Registry - Internal registry for SDK instances
@@ -6468,6 +6248,27 @@ var PaginationType;
6468
6248
  /**
6469
6249
  * Collection of utility functions for working with objects
6470
6250
  */
6251
+ /**
6252
+ * Resolves a field value from an object, supporting both direct keys (e.g., '@odata.count')
6253
+ * and dot-separated nested paths (e.g., 'pagination.totalCount').
6254
+ * Direct key match takes priority over nested traversal.
6255
+ */
6256
+ function resolveNestedField(data, fieldPath) {
6257
+ if (!data) {
6258
+ return undefined;
6259
+ }
6260
+ if (fieldPath in data) {
6261
+ return data[fieldPath];
6262
+ }
6263
+ if (!fieldPath.includes('.')) {
6264
+ return undefined;
6265
+ }
6266
+ let value = data;
6267
+ for (const part of fieldPath.split('.')) {
6268
+ value = value?.[part];
6269
+ }
6270
+ return value;
6271
+ }
6471
6272
  /**
6472
6273
  * Filters out undefined values from an object
6473
6274
  * @param obj The source object
@@ -6727,6 +6528,26 @@ const BUCKET_PAGINATION = {
6727
6528
  /** Field name for continuation token in bucket file metadata response */
6728
6529
  CONTINUATION_TOKEN_FIELD: 'continuationToken'
6729
6530
  };
6531
+ /**
6532
+ * SLA Summary pagination constants for page-number-based pagination
6533
+ */
6534
+ const SLA_SUMMARY_PAGINATION = {
6535
+ /** Field name for items in SLA summary response */
6536
+ ITEMS_FIELD: 'data',
6537
+ /** Dot-notation path for total count in nested pagination object */
6538
+ TOTAL_COUNT_FIELD: 'pagination.totalCount'
6539
+ };
6540
+ /**
6541
+ * SLA Summary OFFSET pagination parameter names (page-number style, no skip conversion)
6542
+ */
6543
+ const SLA_SUMMARY_OFFSET_PARAMS = {
6544
+ /** Page size parameter name */
6545
+ PAGE_SIZE_PARAM: 'PageSize',
6546
+ /** Page number parameter name (sent directly, not converted to skip) */
6547
+ OFFSET_PARAM: 'PageNumber',
6548
+ /** No count param needed */
6549
+ COUNT_PARAM: undefined
6550
+ };
6730
6551
  /**
6731
6552
  * Process Instance pagination constants for token-based pagination
6732
6553
  */
@@ -6777,6 +6598,14 @@ const PROCESS_INSTANCE_TOKEN_PARAMS = {
6777
6598
  TOKEN_PARAM: 'nextPage'
6778
6599
  };
6779
6600
 
6601
+ /**
6602
+ * Converts a UTC timestamp string (e.g., "5/8/2026 11:20:17 AM") to ISO 8601 UTC format.
6603
+ * Returns the original value if parsing fails.
6604
+ */
6605
+ function toISOUtc(value) {
6606
+ const date = new Date(value + ' UTC');
6607
+ return isNaN(date.getTime()) ? value : date.toISOString();
6608
+ }
6780
6609
  /**
6781
6610
  * Transforms data by mapping fields according to the provided field mapping
6782
6611
  * @param data The source data to transform
@@ -7333,7 +7162,8 @@ class PaginationHelpers {
7333
7162
  // Extract and transform items from response
7334
7163
  // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
7335
7164
  const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
7336
- const totalCount = Array.isArray(response.data) ? undefined : response.data?.[totalCountField];
7165
+ const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
7166
+ const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
7337
7167
  // Parse items - automatically handle JSON string responses
7338
7168
  const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
7339
7169
  const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
@@ -7575,9 +7405,17 @@ class BaseService {
7575
7405
  const pageSizeParam = paginationParams?.pageSizeParam || ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM;
7576
7406
  const offsetParam = paginationParams?.offsetParam || ODATA_OFFSET_PARAMS.OFFSET_PARAM;
7577
7407
  const countParam = paginationParams?.countParam || ODATA_OFFSET_PARAMS.COUNT_PARAM;
7408
+ // When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
7409
+ // When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
7410
+ const convertToSkip = paginationParams?.convertToSkip ?? true;
7578
7411
  requestParams[pageSizeParam] = limitedPageSize;
7579
- if (params.pageNumber && params.pageNumber > 1) {
7580
- requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
7412
+ if (convertToSkip) {
7413
+ if (params.pageNumber && params.pageNumber > 1) {
7414
+ requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
7415
+ }
7416
+ }
7417
+ else {
7418
+ requestParams[offsetParam] = params.pageNumber || 1;
7581
7419
  }
7582
7420
  {
7583
7421
  requestParams[countParam] = true;
@@ -7608,7 +7446,8 @@ class BaseService {
7608
7446
  // Extract items and metadata
7609
7447
  // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
7610
7448
  const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
7611
- const totalCount = Array.isArray(response.data) ? undefined : response.data[totalCountField];
7449
+ const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
7450
+ const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
7612
7451
  const continuationToken = response.data[continuationTokenField];
7613
7452
  // Determine if there are more pages
7614
7453
  const hasMore = this.determineHasMorePages(paginationType, {
@@ -9262,6 +9101,53 @@ function createProcessWithMethods(processData, service) {
9262
9101
  return Object.assign({}, processData, methods);
9263
9102
  }
9264
9103
 
9104
+ /**
9105
+ * Builds the request body for Insights RTM "top" endpoints.
9106
+ *
9107
+ * @param startTime - Start of the time range to query
9108
+ * @param endTime - End of the time range to query
9109
+ * @param isCaseManagement - Whether to filter for case management processes
9110
+ * @param options - Optional filters (packageId, processKey, version)
9111
+ * @returns Request body for the Insights RTM endpoint
9112
+ * @internal
9113
+ */
9114
+ function buildInsightsTopBody(startTime, endTime, isCaseManagement, options) {
9115
+ return {
9116
+ commonParams: {
9117
+ startTime: startTime.getTime(),
9118
+ endTime: endTime.getTime(),
9119
+ isCaseManagement,
9120
+ ...(options?.packageId ? { packageId: options.packageId } : {}),
9121
+ ...(options?.processKey ? { processKey: options.processKey } : {}),
9122
+ ...(options?.version ? { version: options.version } : {}),
9123
+ }
9124
+ };
9125
+ }
9126
+ /**
9127
+ * Fetches instance status timeline from the Insights API.
9128
+ * Shared implementation used by both MaestroProcessesService and CasesService.
9129
+ *
9130
+ * @param postFn - Bound post method from a BaseService subclass
9131
+ * @param startTime - Start of the time range to query
9132
+ * @param endTime - End of the time range to query
9133
+ * @param isCaseManagement - Whether to filter for case management processes
9134
+ * @param options - Optional settings for time bucketing granularity
9135
+ * @returns Promise resolving to an array of instance status timeline entries
9136
+ * @internal
9137
+ */
9138
+ async function fetchInstanceStatusTimeline(postFn, startTime, endTime, isCaseManagement, options) {
9139
+ const response = await postFn(MAESTRO_ENDPOINTS.INSIGHTS.INSTANCE_STATUS_BY_DATE, {
9140
+ commonParams: {
9141
+ startTime: startTime.getTime(),
9142
+ endTime: endTime.getTime(),
9143
+ isCaseManagement,
9144
+ },
9145
+ timeSliceUnit: options?.groupBy,
9146
+ timezoneOffset: new Date().getTimezoneOffset() * -1,
9147
+ });
9148
+ return response.data ?? [];
9149
+ }
9150
+
9265
9151
  /**
9266
9152
  * Maps fields for Incident entities
9267
9153
  */
@@ -9495,6 +9381,41 @@ var DebugMode;
9495
9381
  * Case Instance Types
9496
9382
  * Types and interfaces for Maestro case instance management
9497
9383
  */
9384
+ /**
9385
+ * SLA status for a case instance
9386
+ */
9387
+ var SlaSummaryStatus;
9388
+ (function (SlaSummaryStatus) {
9389
+ /** Case is within SLA deadline */
9390
+ SlaSummaryStatus["ON_TRACK"] = "On Track";
9391
+ /** Case is approaching SLA deadline based on at-risk percentage threshold */
9392
+ SlaSummaryStatus["AT_RISK"] = "At Risk";
9393
+ /** Case has exceeded SLA deadline */
9394
+ SlaSummaryStatus["OVERDUE"] = "Overdue";
9395
+ /** Case instance has completed */
9396
+ SlaSummaryStatus["COMPLETED"] = "Completed";
9397
+ /** SLA status cannot be determined (no SLA deadline defined) */
9398
+ SlaSummaryStatus["UNKNOWN"] = "Unknown";
9399
+ })(SlaSummaryStatus || (SlaSummaryStatus = {}));
9400
+ /**
9401
+ * Instance status values for case instances and process instances
9402
+ */
9403
+ var InstanceStatus;
9404
+ (function (InstanceStatus) {
9405
+ /** Instance status not yet populated by the backend */
9406
+ InstanceStatus["UNKNOWN"] = "";
9407
+ InstanceStatus["CANCELLED"] = "Cancelled";
9408
+ InstanceStatus["CANCELING"] = "Canceling";
9409
+ InstanceStatus["COMPLETED"] = "Completed";
9410
+ InstanceStatus["FAULTED"] = "Faulted";
9411
+ InstanceStatus["PAUSED"] = "Paused";
9412
+ InstanceStatus["PAUSING"] = "Pausing";
9413
+ InstanceStatus["PENDING"] = "Pending";
9414
+ InstanceStatus["RESUMING"] = "Resuming";
9415
+ InstanceStatus["RETRYING"] = "Retrying";
9416
+ InstanceStatus["RUNNING"] = "Running";
9417
+ InstanceStatus["UPGRADING"] = "Upgrading";
9418
+ })(InstanceStatus || (InstanceStatus = {}));
9498
9419
  /**
9499
9420
  * Case stage task type
9500
9421
  */
@@ -9529,6 +9450,8 @@ var EscalationTriggerType;
9529
9450
  (function (EscalationTriggerType) {
9530
9451
  EscalationTriggerType["SLA_BREACHED"] = "sla-breached";
9531
9452
  EscalationTriggerType["AT_RISK"] = "at-risk";
9453
+ /** Default value when no escalation rule is defined */
9454
+ EscalationTriggerType["NONE"] = "None";
9532
9455
  })(EscalationTriggerType || (EscalationTriggerType = {}));
9533
9456
  /**
9534
9457
  * SLA duration unit
@@ -9596,6 +9519,16 @@ function createCaseInstanceMethods(instanceData, service) {
9596
9519
  if (!instanceData.instanceId)
9597
9520
  throw new Error('Case instance ID is undefined');
9598
9521
  return service.getActionTasks(instanceData.instanceId, options);
9522
+ },
9523
+ async getSlaSummary(options) {
9524
+ if (!instanceData.instanceId)
9525
+ throw new Error('Case instance ID is undefined');
9526
+ return service.getSlaSummary({ ...options, caseInstanceId: instanceData.instanceId });
9527
+ },
9528
+ async getStagesSlaSummary() {
9529
+ if (!instanceData.instanceId)
9530
+ throw new Error('Case instance ID is undefined');
9531
+ return service.getStagesSlaSummary({ caseInstanceId: instanceData.instanceId });
9599
9532
  }
9600
9533
  };
9601
9534
  }
@@ -9611,6 +9544,40 @@ function createCaseInstanceWithMethods(instanceData, service) {
9611
9544
  return Object.assign({}, instanceData, methods);
9612
9545
  }
9613
9546
 
9547
+ /**
9548
+ * Insights Types
9549
+ * Shared types for Maestro insights analytics endpoints
9550
+ */
9551
+ /**
9552
+ * Time bucketing granularity for insights time-series queries.
9553
+ *
9554
+ * Controls how data points are grouped on the time axis.
9555
+ */
9556
+ var TimeInterval;
9557
+ (function (TimeInterval) {
9558
+ /** Group data points by hour */
9559
+ TimeInterval["Hour"] = "HOUR";
9560
+ /** Group data points by day */
9561
+ TimeInterval["Day"] = "DAY";
9562
+ /** Group data points by week */
9563
+ TimeInterval["Week"] = "WEEK";
9564
+ })(TimeInterval || (TimeInterval = {}));
9565
+ /**
9566
+ * Final instance statuses returned by the instance status timeline endpoint.
9567
+ *
9568
+ * Only includes statuses where the instance has finished execution — Completed, Faulted, or Cancelled.
9569
+ * Active statuses like Running or Paused are not included.
9570
+ */
9571
+ var InstanceFinalStatus;
9572
+ (function (InstanceFinalStatus) {
9573
+ /** Instance completed successfully */
9574
+ InstanceFinalStatus["Completed"] = "Completed";
9575
+ /** Instance encountered an error */
9576
+ InstanceFinalStatus["Faulted"] = "Faulted";
9577
+ /** Instance was cancelled */
9578
+ InstanceFinalStatus["Cancelled"] = "Cancelled";
9579
+ })(InstanceFinalStatus || (InstanceFinalStatus = {}));
9580
+
9614
9581
  /**
9615
9582
  * Maps fields for Process Instance entities to ensure consistent naming
9616
9583
  */
@@ -9986,6 +9953,177 @@ class MaestroProcessesService extends BaseService {
9986
9953
  // Fetch BPMN XML and add element name/type to each incident
9987
9954
  return BpmnHelpers.enrichIncidentsWithBpmnData(rawResponse.data || [], folderKey, this.processInstancesService);
9988
9955
  }
9956
+ /**
9957
+ * Get the top 5 processes ranked by run count within a time range.
9958
+ *
9959
+ * Returns an array of up to 5 processes sorted by how many times they were executed,
9960
+ * useful for identifying the most active processes in a given period.
9961
+ *
9962
+ * @param startTime - Start of the time range to query
9963
+ * @param endTime - End of the time range to query
9964
+ * @param options - Optional filters (packageId, processKey, version)
9965
+ * @returns Promise resolving to an array of {@link ProcessGetTopRunCountResponse}
9966
+ * @example
9967
+ * ```typescript
9968
+ * import { MaestroProcesses } from '@uipath/uipath-typescript/maestro-processes';
9969
+ *
9970
+ * const maestroProcesses = new MaestroProcesses(sdk);
9971
+ *
9972
+ * // Get top processes by run count for the last 7 days
9973
+ * const topProcesses = await maestroProcesses.getTopRunCount(
9974
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
9975
+ * new Date()
9976
+ * );
9977
+ *
9978
+ * for (const process of topProcesses) {
9979
+ * console.log(`${process.packageId}: ${process.runCount} runs`);
9980
+ * }
9981
+ * ```
9982
+ *
9983
+ * @example
9984
+ * ```typescript
9985
+ * // Get top processes by run count for a specific package
9986
+ * const filtered = await maestroProcesses.getTopRunCount(
9987
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
9988
+ * new Date(),
9989
+ * { packageId: '<packageId>' }
9990
+ * );
9991
+ * ```
9992
+ */
9993
+ async getTopRunCount(startTime, endTime, options) {
9994
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_RUN_COUNT, buildInsightsTopBody(startTime, endTime, false, options));
9995
+ return (data ?? []).map(process => ({ ...process, name: process.packageId }));
9996
+ }
9997
+ /**
9998
+ * Get all instances status counts aggregated by date for maestro processes.
9999
+ *
10000
+ * Returns time-grouped counts of instances grouped by status (Completed, Faulted, Cancelled),
10001
+ * useful for rendering time-series charts. Use `groupBy` to control the time bucket size
10002
+ * (hour, day, or week) — defaults to day if not provided.
10003
+ *
10004
+ * @param startTime - Start of the time range to query
10005
+ * @param endTime - End of the time range to query
10006
+ * @param options - Optional settings for time bucketing granularity
10007
+ * @returns Promise resolving to an array of {@link InstanceStatusTimelineResponse}
10008
+ *
10009
+ * @example
10010
+ * ```typescript
10011
+ * // Get daily instance status for the last 7 days
10012
+ * const now = new Date();
10013
+ * const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
10014
+ * const statuses = await maestroProcesses.getInstanceStatusTimeline(sevenDaysAgo, now);
10015
+ *
10016
+ * for (const entry of statuses) {
10017
+ * console.log(`${entry.startTime} — ${entry.status}: ${entry.count}`);
10018
+ * }
10019
+ * ```
10020
+ *
10021
+ * @example
10022
+ * ```typescript
10023
+ * import { TimeInterval } from '@uipath/uipath-typescript/maestro-processes';
10024
+ *
10025
+ * // Get hourly breakdown
10026
+ * const statuses = await maestroProcesses.getInstanceStatusTimeline(startTime, endTime, {
10027
+ * groupBy: TimeInterval.Hour,
10028
+ * });
10029
+ * ```
10030
+ *
10031
+ * @example
10032
+ * ```typescript
10033
+ * // Get all-time data (from Unix epoch to now)
10034
+ * const allTime = await maestroProcesses.getInstanceStatusTimeline(new Date(0), new Date());
10035
+ * ```
10036
+ */
10037
+ async getInstanceStatusTimeline(startTime, endTime, options) {
10038
+ return fetchInstanceStatusTimeline(this.post.bind(this), startTime, endTime, false, options);
10039
+ }
10040
+ /**
10041
+ * Get the top 10 processes ranked by failure count within a time range.
10042
+ *
10043
+ * Returns an array of up to 10 processes sorted by how many instances faulted,
10044
+ * useful for identifying the most error-prone processes in a given period.
10045
+ *
10046
+ * @param startTime - Start of the time range to query
10047
+ * @param endTime - End of the time range to query
10048
+ * @param options - Optional filters (packageId, processKey, version)
10049
+ * @returns Promise resolving to an array of {@link ProcessGetTopFaultedCountResponse}
10050
+ * @example
10051
+ * ```typescript
10052
+ * import { MaestroProcesses } from '@uipath/uipath-typescript/maestro-processes';
10053
+ *
10054
+ * const maestroProcesses = new MaestroProcesses(sdk);
10055
+ *
10056
+ * // Get top processes by faulted count for the last 7 days
10057
+ * const topFailing = await maestroProcesses.getTopFaultedCount(
10058
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
10059
+ * new Date()
10060
+ * );
10061
+ *
10062
+ * for (const process of topFailing) {
10063
+ * console.log(`${process.packageId}: ${process.faultedCount} failures`);
10064
+ * }
10065
+ * ```
10066
+ *
10067
+ * @example
10068
+ * ```typescript
10069
+ * // Get top processes by faulted count for a specific package
10070
+ * const filtered = await maestroProcesses.getTopFaultedCount(
10071
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
10072
+ * new Date(),
10073
+ * { packageId: '<packageId>' }
10074
+ * );
10075
+ * ```
10076
+ */
10077
+ async getTopFaultedCount(startTime, endTime, options) {
10078
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_WITH_FAILURE, buildInsightsTopBody(startTime, endTime, false, options));
10079
+ return (data ?? []).map(item => ({
10080
+ packageId: item.packageId,
10081
+ processKey: item.processKey,
10082
+ faultedCount: item.runCount,
10083
+ name: item.packageId,
10084
+ }));
10085
+ }
10086
+ /**
10087
+ * Get the top 5 processes ranked by total duration within a time range.
10088
+ *
10089
+ * Returns an array of up to 5 processes sorted by their total execution time,
10090
+ * useful for identifying the longest-running processes in a given period.
10091
+ *
10092
+ * @param startTime - Start of the time range to query
10093
+ * @param endTime - End of the time range to query
10094
+ * @param options - Optional filters (packageId, processKey, version)
10095
+ * @returns Promise resolving to an array of {@link ProcessGetTopDurationResponse}
10096
+ * @example
10097
+ * ```typescript
10098
+ * import { MaestroProcesses } from '@uipath/uipath-typescript/maestro-processes';
10099
+ *
10100
+ * const maestroProcesses = new MaestroProcesses(sdk);
10101
+ *
10102
+ * // Get top processes by duration for the last 7 days
10103
+ * const topProcesses = await maestroProcesses.getTopExecutionDuration(
10104
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
10105
+ * new Date()
10106
+ * );
10107
+ *
10108
+ * for (const process of topProcesses) {
10109
+ * console.log(`${process.packageId}: ${process.duration}ms total`);
10110
+ * }
10111
+ * ```
10112
+ *
10113
+ * @example
10114
+ * ```typescript
10115
+ * // Get top processes by duration for a specific package
10116
+ * const filtered = await maestroProcesses.getTopExecutionDuration(
10117
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
10118
+ * new Date(),
10119
+ * { packageId: '<packageId>' }
10120
+ * );
10121
+ * ```
10122
+ */
10123
+ async getTopExecutionDuration(startTime, endTime, options) {
10124
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_DURATION, buildInsightsTopBody(startTime, endTime, false, options));
10125
+ return (data ?? []).map(process => ({ ...process, name: process.packageId }));
10126
+ }
9989
10127
  }
9990
10128
  __decorate([
9991
10129
  track('MaestroProcesses.GetAll')
@@ -9993,6 +10131,18 @@ __decorate([
9993
10131
  __decorate([
9994
10132
  track('MaestroProcesses.GetIncidents')
9995
10133
  ], MaestroProcessesService.prototype, "getIncidents", null);
10134
+ __decorate([
10135
+ track('MaestroProcesses.GetTopRunCount')
10136
+ ], MaestroProcessesService.prototype, "getTopRunCount", null);
10137
+ __decorate([
10138
+ track('MaestroProcesses.GetInstanceStatusTimeline')
10139
+ ], MaestroProcessesService.prototype, "getInstanceStatusTimeline", null);
10140
+ __decorate([
10141
+ track('MaestroProcesses.GetTopFaultedCount')
10142
+ ], MaestroProcessesService.prototype, "getTopFaultedCount", null);
10143
+ __decorate([
10144
+ track('MaestroProcesses.GetTopExecutionDuration')
10145
+ ], MaestroProcessesService.prototype, "getTopExecutionDuration", null);
9996
10146
 
9997
10147
  /**
9998
10148
  * Service class for Maestro Process Incidents
@@ -10077,6 +10227,177 @@ class CasesService extends BaseService {
10077
10227
  name: this.extractCaseName(caseItem.packageId)
10078
10228
  }));
10079
10229
  }
10230
+ /**
10231
+ * Get the top 5 case processes ranked by run count within a time range.
10232
+ *
10233
+ * Returns an array of up to 5 case processes sorted by how many times they were executed,
10234
+ * useful for identifying the most active case processes in a given period.
10235
+ *
10236
+ * @param startTime - Start of the time range to query
10237
+ * @param endTime - End of the time range to query
10238
+ * @param options - Optional filters (packageId, processKey, version)
10239
+ * @returns Promise resolving to an array of {@link CaseGetTopRunCountResponse}
10240
+ * @example
10241
+ * ```typescript
10242
+ * import { Cases } from '@uipath/uipath-typescript/cases';
10243
+ *
10244
+ * const cases = new Cases(sdk);
10245
+ *
10246
+ * // Get top case processes by run count for the last 7 days
10247
+ * const topProcesses = await cases.getTopRunCount(
10248
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
10249
+ * new Date()
10250
+ * );
10251
+ *
10252
+ * for (const process of topProcesses) {
10253
+ * console.log(`${process.packageId}: ${process.runCount} runs`);
10254
+ * }
10255
+ * ```
10256
+ *
10257
+ * @example
10258
+ * ```typescript
10259
+ * // Get top case processes by run count for a specific package
10260
+ * const filtered = await cases.getTopRunCount(
10261
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
10262
+ * new Date(),
10263
+ * { packageId: '<packageId>' }
10264
+ * );
10265
+ * ```
10266
+ */
10267
+ async getTopRunCount(startTime, endTime, options) {
10268
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_RUN_COUNT, buildInsightsTopBody(startTime, endTime, true, options));
10269
+ return (data ?? []).map(process => ({ ...process, name: this.extractCaseName(process.packageId) }));
10270
+ }
10271
+ /**
10272
+ * Get all instances status counts aggregated by date for case management processes.
10273
+ *
10274
+ * Returns time-grouped counts of case instances grouped by status (Completed, Faulted, Cancelled),
10275
+ * useful for rendering time-series charts. Use `groupBy` to control the time bucket size
10276
+ * (hour, day, or week) — defaults to day if not provided.
10277
+ *
10278
+ * @param startTime - Start of the time range to query
10279
+ * @param endTime - End of the time range to query
10280
+ * @param options - Optional settings for time bucketing granularity
10281
+ * @returns Promise resolving to an array of {@link InstanceStatusTimelineResponse}
10282
+ *
10283
+ * @example
10284
+ * ```typescript
10285
+ * // Get daily instance status for the last 7 days
10286
+ * const now = new Date();
10287
+ * const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
10288
+ * const statuses = await cases.getInstanceStatusTimeline(sevenDaysAgo, now);
10289
+ *
10290
+ * for (const entry of statuses) {
10291
+ * console.log(`${entry.startTime} — ${entry.status}: ${entry.count}`);
10292
+ * }
10293
+ * ```
10294
+ *
10295
+ * @example
10296
+ * ```typescript
10297
+ * import { TimeInterval } from '@uipath/uipath-typescript/cases';
10298
+ *
10299
+ * // Get weekly breakdown
10300
+ * const statuses = await cases.getInstanceStatusTimeline(startTime, endTime, {
10301
+ * groupBy: TimeInterval.Week,
10302
+ * });
10303
+ * ```
10304
+ *
10305
+ * @example
10306
+ * ```typescript
10307
+ * // Get all-time data (from Unix epoch to now)
10308
+ * const allTime = await cases.getInstanceStatusTimeline(new Date(0), new Date());
10309
+ * ```
10310
+ */
10311
+ async getInstanceStatusTimeline(startTime, endTime, options) {
10312
+ return fetchInstanceStatusTimeline(this.post.bind(this), startTime, endTime, true, options);
10313
+ }
10314
+ /**
10315
+ * Get the top 10 case processes ranked by failure count within a time range.
10316
+ *
10317
+ * Returns an array of up to 10 case processes sorted by how many instances faulted,
10318
+ * useful for identifying the most error-prone case processes in a given period.
10319
+ *
10320
+ * @param startTime - Start of the time range to query
10321
+ * @param endTime - End of the time range to query
10322
+ * @param options - Optional filters (packageId, processKey, version)
10323
+ * @returns Promise resolving to an array of {@link CaseGetTopFaultedCountResponse}
10324
+ * @example
10325
+ * ```typescript
10326
+ * import { Cases } from '@uipath/uipath-typescript/cases';
10327
+ *
10328
+ * const cases = new Cases(sdk);
10329
+ *
10330
+ * // Get top case processes by faulted count for the last 7 days
10331
+ * const topFailing = await cases.getTopFaultedCount(
10332
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
10333
+ * new Date()
10334
+ * );
10335
+ *
10336
+ * for (const process of topFailing) {
10337
+ * console.log(`${process.packageId}: ${process.faultedCount} failures`);
10338
+ * }
10339
+ * ```
10340
+ *
10341
+ * @example
10342
+ * ```typescript
10343
+ * // Get top case processes by faulted count for a specific package
10344
+ * const filtered = await cases.getTopFaultedCount(
10345
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
10346
+ * new Date(),
10347
+ * { packageId: '<packageId>' }
10348
+ * );
10349
+ * ```
10350
+ */
10351
+ async getTopFaultedCount(startTime, endTime, options) {
10352
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_WITH_FAILURE, buildInsightsTopBody(startTime, endTime, true, options));
10353
+ return (data ?? []).map(item => ({
10354
+ packageId: item.packageId,
10355
+ processKey: item.processKey,
10356
+ faultedCount: item.runCount,
10357
+ name: this.extractCaseName(item.packageId),
10358
+ }));
10359
+ }
10360
+ /**
10361
+ * Get the top 5 case processes ranked by total duration within a time range.
10362
+ *
10363
+ * Returns an array of up to 5 case processes sorted by their total execution time,
10364
+ * useful for identifying the longest-running case processes in a given period.
10365
+ *
10366
+ * @param startTime - Start of the time range to query
10367
+ * @param endTime - End of the time range to query
10368
+ * @param options - Optional filters (packageId, processKey, version)
10369
+ * @returns Promise resolving to an array of {@link CaseGetTopDurationResponse}
10370
+ * @example
10371
+ * ```typescript
10372
+ * import { Cases } from '@uipath/uipath-typescript/cases';
10373
+ *
10374
+ * const cases = new Cases(sdk);
10375
+ *
10376
+ * // Get top case processes by duration for the last 7 days
10377
+ * const topProcesses = await cases.getTopExecutionDuration(
10378
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
10379
+ * new Date()
10380
+ * );
10381
+ *
10382
+ * for (const process of topProcesses) {
10383
+ * console.log(`${process.packageId}: ${process.duration}ms total`);
10384
+ * }
10385
+ * ```
10386
+ *
10387
+ * @example
10388
+ * ```typescript
10389
+ * // Get top case processes by duration for a specific package
10390
+ * const filtered = await cases.getTopExecutionDuration(
10391
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
10392
+ * new Date(),
10393
+ * { packageId: '<packageId>' }
10394
+ * );
10395
+ * ```
10396
+ */
10397
+ async getTopExecutionDuration(startTime, endTime, options) {
10398
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_DURATION, buildInsightsTopBody(startTime, endTime, true, options));
10399
+ return (data ?? []).map(process => ({ ...process, name: this.extractCaseName(process.packageId) }));
10400
+ }
10080
10401
  /**
10081
10402
  * Extract a readable case name from the packageId
10082
10403
  * @param packageId - The full package identifier
@@ -10099,6 +10420,18 @@ class CasesService extends BaseService {
10099
10420
  __decorate([
10100
10421
  track('Cases.GetAll')
10101
10422
  ], CasesService.prototype, "getAll", null);
10423
+ __decorate([
10424
+ track('Cases.GetTopRunCount')
10425
+ ], CasesService.prototype, "getTopRunCount", null);
10426
+ __decorate([
10427
+ track('Cases.GetInstanceStatusTimeline')
10428
+ ], CasesService.prototype, "getInstanceStatusTimeline", null);
10429
+ __decorate([
10430
+ track('Cases.GetTopFaultedCount')
10431
+ ], CasesService.prototype, "getTopFaultedCount", null);
10432
+ __decorate([
10433
+ track('Cases.GetTopExecutionDuration')
10434
+ ], CasesService.prototype, "getTopExecutionDuration", null);
10102
10435
 
10103
10436
  /**
10104
10437
  * Maps fields for Case Instance entities to ensure consistent naming
@@ -11150,6 +11483,104 @@ class CaseInstancesService extends BaseService {
11150
11483
  };
11151
11484
  return await this.taskService.getAll(enhancedOptions);
11152
11485
  }
11486
+ /**
11487
+ * Get SLA summary for all case instances across folders.
11488
+ *
11489
+ * Returns SLA status, due times, escalation info, and instance metadata for each case instance.
11490
+ * The default page size is 50, so only the top 50 items are returned when no pagination options are provided.
11491
+ *
11492
+ * @param options - Optional filtering and pagination options
11493
+ * @returns Promise resolving to {@link SlaSummaryResponse}, paginated or non-paginated based on options
11494
+ * @example
11495
+ * ```typescript
11496
+ * // Non-paginated (returns top 50 items by default)
11497
+ * const summary = await caseInstances.getSlaSummary();
11498
+ * console.log(`Found ${summary.totalCount} cases`);
11499
+ *
11500
+ * // Filter by case instance ID
11501
+ * const filtered = await caseInstances.getSlaSummary({
11502
+ * caseInstanceId: '<caseInstanceId>'
11503
+ * });
11504
+ *
11505
+ * // Filter by time range
11506
+ * const timeFiltered = await caseInstances.getSlaSummary({
11507
+ * startTimeUtc: new Date('2026-01-01'),
11508
+ * endTimeUtc: new Date('2026-01-31')
11509
+ * });
11510
+ *
11511
+ * // With pagination
11512
+ * const page1 = await caseInstances.getSlaSummary({ pageSize: 25 });
11513
+ * if (page1.hasNextPage) {
11514
+ * const page2 = await caseInstances.getSlaSummary({ cursor: page1.nextCursor });
11515
+ * }
11516
+ *
11517
+ * // Jump to specific page
11518
+ * const page3 = await caseInstances.getSlaSummary({ jumpToPage: 3, pageSize: 25 });
11519
+ * ```
11520
+ */
11521
+ async getSlaSummary(options) {
11522
+ const apiOptions = options ? {
11523
+ ...options,
11524
+ startTimeUtc: options.startTimeUtc?.toISOString(),
11525
+ endTimeUtc: options.endTimeUtc?.toISOString()
11526
+ } : undefined;
11527
+ return PaginationHelpers.getAll({
11528
+ serviceAccess: this.createPaginationServiceAccess(),
11529
+ getEndpoint: () => MAESTRO_ENDPOINTS.INSIGHTS.SLA_SUMMARY,
11530
+ method: HTTP_METHODS.POST,
11531
+ excludeFromPrefix: ['caseInstanceId', 'startTimeUtc', 'endTimeUtc'],
11532
+ transformFn: (item) => ({
11533
+ ...item,
11534
+ slaDueTime: toISOUtc(item.slaDueTime),
11535
+ lastModifiedTime: toISOUtc(item.lastModifiedTime)
11536
+ }),
11537
+ pagination: {
11538
+ paginationType: PaginationType.OFFSET,
11539
+ itemsField: SLA_SUMMARY_PAGINATION.ITEMS_FIELD,
11540
+ totalCountField: SLA_SUMMARY_PAGINATION.TOTAL_COUNT_FIELD,
11541
+ paginationParams: {
11542
+ pageSizeParam: SLA_SUMMARY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
11543
+ offsetParam: SLA_SUMMARY_OFFSET_PARAMS.OFFSET_PARAM,
11544
+ countParam: SLA_SUMMARY_OFFSET_PARAMS.COUNT_PARAM,
11545
+ convertToSkip: false
11546
+ }
11547
+ }
11548
+ }, apiOptions);
11549
+ }
11550
+ /**
11551
+ * Get stages SLA summary for case instances across folders.
11552
+ *
11553
+ * Returns stage-level SLA status and escalation information for each case instance, aggregated from Insights Real-Time Monitoring.
11554
+ *
11555
+ * @param options - Optional filtering options
11556
+ * @returns Promise resolving to an array of {@link CaseInstanceStageSLAResponse}
11557
+ * @example
11558
+ * ```typescript
11559
+ * // Get stages SLA summary for all case instances
11560
+ * const stagesSla = await caseInstances.getStagesSlaSummary();
11561
+ * for (const item of stagesSla) {
11562
+ * console.log(`Instance: ${item.caseInstanceId}`);
11563
+ * for (const stage of item.stages) {
11564
+ * console.log(` Stage: ${stage.name} - SLA Status: ${stage.slaStatus}, Due: ${stage.slaDueTime}`);
11565
+ * }
11566
+ * }
11567
+ *
11568
+ * // Filter by case instance ID
11569
+ * const filtered = await caseInstances.getStagesSlaSummary({
11570
+ * caseInstanceId: '<caseInstanceId>'
11571
+ * });
11572
+ *
11573
+ * // Using bound method on a case instance
11574
+ * const instance = await caseInstances.getById('<instanceId>', '<folderKey>');
11575
+ * const stagesSla = await instance.getStagesSlaSummary();
11576
+ * ```
11577
+ */
11578
+ async getStagesSlaSummary(options) {
11579
+ const response = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.STAGES_SUMMARY, {
11580
+ caseInstanceId: options?.caseInstanceId,
11581
+ });
11582
+ return response.data ?? [];
11583
+ }
11153
11584
  }
11154
11585
  __decorate([
11155
11586
  track('CaseInstances.GetAll')
@@ -11178,6 +11609,12 @@ __decorate([
11178
11609
  __decorate([
11179
11610
  track('CaseInstances.GetActionTasks')
11180
11611
  ], CaseInstancesService.prototype, "getActionTasks", null);
11612
+ __decorate([
11613
+ track('CaseInstances.GetSlaSummary')
11614
+ ], CaseInstancesService.prototype, "getSlaSummary", null);
11615
+ __decorate([
11616
+ track('CaseInstances.GetStagesSlaSummary')
11617
+ ], CaseInstancesService.prototype, "getStagesSlaSummary", null);
11181
11618
 
11182
11619
  /**
11183
11620
  * Validates the `name` argument passed to a `getByName(name, ...)` method.
@@ -11585,6 +12022,32 @@ class BucketService extends FolderScopedService {
11585
12022
  // Transform response from PascalCase to camelCase
11586
12023
  return pascalToCamelCaseKeys(response.data);
11587
12024
  }
12025
+ /**
12026
+ * Retrieves a single orchestrator storage bucket by name.
12027
+ *
12028
+ * @param name - Bucket name to search for
12029
+ * @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
12030
+ * @returns Promise resolving to a single bucket
12031
+ * {@link BucketGetResponse}
12032
+ * @example
12033
+ * ```typescript
12034
+ * import { Buckets } from '@uipath/uipath-typescript/buckets';
12035
+ *
12036
+ * const buckets = new Buckets(sdk);
12037
+ *
12038
+ * // By folder ID
12039
+ * await buckets.getByName('MyBucket', { folderId: <folderId> });
12040
+ *
12041
+ * // By folder key (GUID)
12042
+ * await buckets.getByName('MyBucket', { folderKey: '<folderKey>' });
12043
+ *
12044
+ * // By folder path
12045
+ * await buckets.getByName('MyBucket', { folderPath: '<folderPath>' });
12046
+ * ```
12047
+ */
12048
+ async getByName(name, options = {}) {
12049
+ return this.getByNameLookup('Bucket', BUCKET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => pascalToCamelCaseKeys(raw));
12050
+ }
11588
12051
  /**
11589
12052
  * Gets all buckets across folders with optional filtering and folder scoping
11590
12053
  *
@@ -11874,6 +12337,9 @@ class BucketService extends FolderScopedService {
11874
12337
  __decorate([
11875
12338
  track('Buckets.GetById')
11876
12339
  ], BucketService.prototype, "getById", null);
12340
+ __decorate([
12341
+ track('Buckets.GetByName')
12342
+ ], BucketService.prototype, "getByName", null);
11877
12343
  __decorate([
11878
12344
  track('Buckets.GetAll')
11879
12345
  ], BucketService.prototype, "getAll", null);
@@ -13051,6 +13517,17 @@ const ConversationMap = {
13051
13517
  lastActivityAt: 'lastActivityTime',
13052
13518
  agentReleaseId: 'agentId'
13053
13519
  };
13520
+ /**
13521
+ * Maps API filter param names (left) to SDK-facing names (right) for the conversation list endpoint.
13522
+ * Used by `getAll` to translate SDK filters to the field names the backend expects. Kept separate
13523
+ * from `ConversationMap` because `label`/`search` would otherwise collide with the `label` field
13524
+ * on create/update payloads.
13525
+ */
13526
+ const ConversationGetAllFilterMap = {
13527
+ agentReleaseKey: 'agentKey',
13528
+ agentReleaseId: 'agentId',
13529
+ search: 'label'
13530
+ };
13054
13531
  /**
13055
13532
  * Maps fields for Exchange entity to ensure consistent SDK naming
13056
13533
  */
@@ -13410,8 +13887,8 @@ var WordGroupType;
13410
13887
  // Auto-generated from the OpenAPI spec — do not edit manually.
13411
13888
  var ModelKind;
13412
13889
  (function (ModelKind) {
13413
- ModelKind["Classifier"] = "Classifier";
13414
13890
  ModelKind["Extractor"] = "Extractor";
13891
+ ModelKind["Classifier"] = "Classifier";
13415
13892
  })(ModelKind || (ModelKind = {}));
13416
13893
  var ModelType;
13417
13894
  (function (ModelType) {
@@ -13420,6 +13897,14 @@ var ModelType;
13420
13897
  ModelType["Predefined"] = "Predefined";
13421
13898
  })(ModelType || (ModelType = {}));
13422
13899
 
13900
+ // Auto-generated from the OpenAPI spec — do not edit manually.
13901
+ var ErrorSeverity;
13902
+ (function (ErrorSeverity) {
13903
+ ErrorSeverity["Info"] = "Info";
13904
+ ErrorSeverity["Warning"] = "Warning";
13905
+ ErrorSeverity["Error"] = "Error";
13906
+ })(ErrorSeverity || (ErrorSeverity = {}));
13907
+
13423
13908
  // Auto-generated from the OpenAPI spec — do not edit manually.
13424
13909
  var ClassifierDocumentTypeType;
13425
13910
  (function (ClassifierDocumentTypeType) {
@@ -13444,6 +13929,13 @@ var GptFieldType;
13444
13929
  GptFieldType["Number"] = "Number";
13445
13930
  GptFieldType["Text"] = "Text";
13446
13931
  })(GptFieldType || (GptFieldType = {}));
13932
+ var JobStatus;
13933
+ (function (JobStatus) {
13934
+ JobStatus["Succeeded"] = "Succeeded";
13935
+ JobStatus["Failed"] = "Failed";
13936
+ JobStatus["Running"] = "Running";
13937
+ JobStatus["NotStarted"] = "NotStarted";
13938
+ })(JobStatus || (JobStatus = {}));
13447
13939
  var ValidationDisplayMode;
13448
13940
  (function (ValidationDisplayMode) {
13449
13941
  ValidationDisplayMode["Classic"] = "Classic";
@@ -13530,8 +14022,10 @@ var index = /*#__PURE__*/Object.freeze({
13530
14022
  get DocumentActionPriority () { return DocumentActionPriority; },
13531
14023
  get DocumentActionStatus () { return DocumentActionStatus; },
13532
14024
  get DocumentActionType () { return DocumentActionType; },
14025
+ get ErrorSeverity () { return ErrorSeverity; },
13533
14026
  get FieldType () { return FieldType; },
13534
14027
  get GptFieldType () { return GptFieldType; },
14028
+ get JobStatus () { return JobStatus; },
13535
14029
  get LogicalOperator () { return LogicalOperator; },
13536
14030
  get MarkupType () { return MarkupType; },
13537
14031
  get ModelKind () { return ModelKind; },
@@ -13625,4 +14119,4 @@ function getAppBase() {
13625
14119
  return getMetaTagContent(UiPathMetaTags.APP_BASE) || '/';
13626
14120
  }
13627
14121
 
13628
- export { APP_NAME, AgentMap, AssetValueScope, AssetValueType, AuthenticationError, AuthorizationError, BucketOptions, CLOUD_CLIENT_ID, CLOUD_ORGANIZATION_NAME, CLOUD_REDIRECT_URI, CLOUD_ROLE_NAME, CLOUD_TENANT_NAME, CLOUD_URL, CONNECTION_STRING, CitationErrorType, ConversationMap, DEFAULT_ITEMS_FIELD, DEFAULT_PAGE_SIZE, DEFAULT_TOTAL_COUNT_FIELD, DataDirectionType, DebugMode, index as DuFramework, EntityAggregateFunction, EntityFieldDataType, EntityType, ErrorType, EscalationActionType, EscalationRecipientScope, EscalationTriggerType, ExchangeMap, FeedbackRating, FeedbackStatus, FieldDisplayType, HttpStatus, InputStreamSpeechSensitivity, InterruptType, JobPriority, JobSourceType, JobState, JobSubState, JobType, JoinType, LogicalOperator$1 as LogicalOperator, MAX_PAGE_SIZE, MessageMap, MessageRole, NetworkError, NotFoundError, PackageSourceType, PackageType, ProcessIncidentSeverity, ProcessIncidentStatus, ProcessIncidentType, QueryFilterOperator, RateLimitError, ReferenceType, RemoteControlAccess, RobotSize, RuntimeType, SDK_LOGGER_NAME, SDK_RUN_EVENT, SDK_SERVICE_NAME, SDK_VERSION, SERVICE, SLADurationUnit, ServerError, ServerlessJobType, SortOrder, StageTaskType, StartStrategy, StopStrategy, TargetFramework, TaskActivityType, TaskPriority, TaskSlaCriteria, TaskSlaStatus, TaskSourceName, TaskStatus, TaskType, TaskUserType, UNKNOWN$1 as UNKNOWN, UiPath, UiPathError, UiPathMetaTags, UserSettingsMap, VERSION, ValidationError, createAgentWithMethods, createCaseInstanceWithMethods, createConversationWithMethods, createEntityWithMethods, createJobWithMethods, createProcessInstanceWithMethods, createProcessWithMethods, createTaskWithMethods, getAppBase, getAsset, getErrorDetails, getLimitedPageSize, isAuthenticationError, isAuthorizationError, isNetworkError, isNotFoundError, isRateLimitError, isServerError, isUiPathError, isValidationError, loadFromMetaTags, telemetryClient, track, trackEvent };
14122
+ export { AgentMap, AssetValueScope, AssetValueType, AuthenticationError, AuthorizationError, BucketOptions, CitationErrorType, ConversationGetAllFilterMap, ConversationMap, DEFAULT_ITEMS_FIELD, DEFAULT_PAGE_SIZE, DEFAULT_TOTAL_COUNT_FIELD, DataDirectionType, DebugMode, index as DuFramework, EntityAggregateFunction, EntityFieldDataType, EntityType, ErrorType, EscalationActionType, EscalationRecipientScope, EscalationTriggerType, ExchangeMap, FeedbackRating, FeedbackStatus, FieldDisplayType, HttpStatus, InputStreamSpeechSensitivity, InstanceFinalStatus, InstanceStatus, InterruptType, JobPriority, JobSourceType, JobState, JobSubState, JobType, JoinType, LogicalOperator$1 as LogicalOperator, MAX_PAGE_SIZE, MessageMap, MessageRole, NetworkError, NotFoundError, PackageSourceType, PackageType, ProcessIncidentSeverity, ProcessIncidentStatus, ProcessIncidentType, QueryFilterOperator, RateLimitError, ReferenceType, RemoteControlAccess, RobotSize, RuntimeType, SLADurationUnit, ServerError, ServerlessJobType, SlaSummaryStatus, SortOrder, StageTaskType, StartStrategy, StopStrategy, TargetFramework, TaskActivityType, TaskPriority, TaskSlaCriteria, TaskSlaStatus, TaskSourceName, TaskStatus, TaskType, TaskUserType, TimeInterval, UiPath, UiPathError, UiPathMetaTags, UserSettingsMap, ValidationError, createAgentWithMethods, createCaseInstanceWithMethods, createConversationWithMethods, createEntityWithMethods, createJobWithMethods, createProcessInstanceWithMethods, createProcessWithMethods, createTaskWithMethods, getAppBase, getAsset, getErrorDetails, getLimitedPageSize, isAuthenticationError, isAuthorizationError, isNetworkError, isNotFoundError, isRateLimitError, isServerError, isUiPathError, isValidationError, loadFromMetaTags, telemetryClient, track, trackEvent };