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