@uipath/uipath-typescript 1.3.8 → 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 (39) hide show
  1. package/dist/assets/index.cjs +25 -270
  2. package/dist/assets/index.mjs +25 -270
  3. package/dist/attachments/index.cjs +23 -267
  4. package/dist/attachments/index.mjs +23 -267
  5. package/dist/buckets/index.cjs +54 -270
  6. package/dist/buckets/index.d.ts +50 -1
  7. package/dist/buckets/index.mjs +54 -270
  8. package/dist/cases/index.cjs +408 -337
  9. package/dist/cases/index.d.ts +534 -2
  10. package/dist/cases/index.mjs +409 -338
  11. package/dist/conversational-agent/index.cjs +71 -281
  12. package/dist/conversational-agent/index.d.ts +62 -12
  13. package/dist/conversational-agent/index.mjs +71 -282
  14. package/dist/core/index.cjs +39 -289
  15. package/dist/core/index.d.ts +9 -98
  16. package/dist/core/index.mjs +40 -275
  17. package/dist/document-understanding/index.cjs +18 -1
  18. package/dist/document-understanding/index.d.ts +636 -610
  19. package/dist/document-understanding/index.mjs +18 -1
  20. package/dist/entities/index.cjs +25 -270
  21. package/dist/entities/index.mjs +25 -270
  22. package/dist/feedback/index.cjs +23 -268
  23. package/dist/feedback/index.mjs +23 -268
  24. package/dist/index.cjs +600 -293
  25. package/dist/index.d.ts +1603 -722
  26. package/dist/index.mjs +600 -279
  27. package/dist/index.umd.js +789 -158
  28. package/dist/jobs/index.cjs +25 -270
  29. package/dist/jobs/index.mjs +25 -270
  30. package/dist/maestro-processes/index.cjs +1751 -1720
  31. package/dist/maestro-processes/index.d.ts +430 -2
  32. package/dist/maestro-processes/index.mjs +1752 -1721
  33. package/dist/processes/index.cjs +25 -270
  34. package/dist/processes/index.mjs +25 -270
  35. package/dist/queues/index.cjs +25 -270
  36. package/dist/queues/index.mjs +25 -270
  37. package/dist/tasks/index.cjs +25 -270
  38. package/dist/tasks/index.mjs +25 -270
  39. package/package.json +8 -10
package/dist/index.umd.js CHANGED
@@ -4592,6 +4592,16 @@
4592
4592
  INSIGHTS: {
4593
4593
  /** SLA summary for case instances */
4594
4594
  SLA_SUMMARY: `${INSIGHTS_RTM_BASE}/caseManagement/slaSummary`,
4595
+ /** Stages summary for case instances */
4596
+ STAGES_SUMMARY: `${INSIGHTS_RTM_BASE}/caseManagement/stages`,
4597
+ /** Top processes ranked by run count */
4598
+ TOP_PROCESSES_BY_RUN_COUNT: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByRunCount`,
4599
+ /** Top processes ranked by failure count */
4600
+ TOP_PROCESSES_WITH_FAILURE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcesseswithFailure`,
4601
+ /** Instance status aggregated by date for time-series charts */
4602
+ INSTANCE_STATUS_BY_DATE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/InstanceStatusByDate`,
4603
+ /** Top processes ranked by total duration */
4604
+ TOP_PROCESSES_BY_DURATION: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByDuration`,
4595
4605
  },
4596
4606
  };
4597
4607
 
@@ -9221,54 +9231,56 @@
9221
9231
  }
9222
9232
 
9223
9233
  /**
9224
- * SDK Telemetry constants
9234
+ * Common telemetry attribute keys + Application Insights connection string.
9235
+ *
9236
+ * Producer-specific identity (SDK version, role name, etc.) is supplied at
9237
+ * runtime via `TelemetryClient.initialize(...)` so the same package can be
9238
+ * reused by multiple packages. The Application Insights connection string is
9239
+ * shared across all consumers and is patched into this file at publish time.
9225
9240
  */
9226
9241
  // Connection string placeholder that will be replaced during build
9227
- 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";
9228
- // SDK Version placeholder
9229
- const SDK_VERSION = "1.3.8";
9230
- const VERSION = "Version";
9231
- const SERVICE = "Service";
9232
- const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
9233
- const CLOUD_TENANT_NAME = "CloudTenantName";
9234
- const CLOUD_URL = "CloudUrl";
9235
- const CLOUD_CLIENT_ID = "CloudClientId";
9236
- const CLOUD_REDIRECT_URI = "CloudRedirectUri";
9237
- const APP_NAME = "ApplicationName";
9238
- const CLOUD_ROLE_NAME = "uipath-ts-sdk";
9239
- // Service and logger names
9240
- const SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
9241
- const SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
9242
- // Event names
9243
- const SDK_RUN_EVENT = "Sdk.Run";
9244
- // Default value for unknown/empty attributes
9245
- const UNKNOWN$1 = "";
9242
+ const CONNECTION_STRING = '$CONNECTION_STRING';
9243
+ const VERSION = 'Version';
9244
+ const SERVICE = 'Service';
9245
+ const CLOUD_ORGANIZATION_NAME = 'CloudOrganizationName';
9246
+ const CLOUD_TENANT_NAME = 'CloudTenantName';
9247
+ const CLOUD_URL = 'CloudUrl';
9248
+ const CLOUD_CLIENT_ID = 'CloudClientId';
9249
+ const CLOUD_REDIRECT_URI = 'CloudRedirectUri';
9250
+ const APP_NAME = 'ApplicationName';
9251
+ /** Default value used when an attribute has no resolved value. */
9252
+ const UNKNOWN$1 = '';
9246
9253
 
9254
+ const INSTRUMENTATION_KEY_RE = /InstrumentationKey=([^;]+)/;
9255
+ const INGESTION_ENDPOINT_RE = /IngestionEndpoint=([^;]+)/;
9247
9256
  /**
9248
- * Log exporter that sends ALL logs as Application Insights custom events
9257
+ * Sends every emitted log record as an Application Insights custom event.
9258
+ * Plugged into OpenTelemetry's `BatchLogRecordProcessor`, which buffers and
9259
+ * flushes log records to this exporter on its own schedule.
9249
9260
  */
9250
9261
  class ApplicationInsightsEventExporter {
9251
- constructor(connectionString) {
9262
+ constructor(connectionString, tags) {
9252
9263
  this.connectionString = connectionString;
9264
+ this.tags = tags;
9253
9265
  }
9254
9266
  export(logs, resultCallback) {
9255
9267
  try {
9256
- logs.forEach(logRecord => {
9257
- this.sendAsCustomEvent(logRecord);
9258
- });
9268
+ for (const log of logs) {
9269
+ this.sendAsCustomEvent(log);
9270
+ }
9259
9271
  resultCallback({ code: 0 });
9260
9272
  }
9261
9273
  catch (error) {
9262
- console.debug('Failed to export logs to Application Insights:', error);
9263
- resultCallback({ code: 2, error });
9274
+ const err = error instanceof Error ? error : new Error(String(error));
9275
+ console.debug('Failed to export logs to Application Insights:', err);
9276
+ resultCallback({ code: 1, error: err });
9264
9277
  }
9265
9278
  }
9266
9279
  shutdown() {
9267
9280
  return Promise.resolve();
9268
9281
  }
9269
9282
  sendAsCustomEvent(logRecord) {
9270
- // Get event name from body or attributes
9271
- const eventName = logRecord.body || SDK_RUN_EVENT;
9283
+ const eventName = String(logRecord.body);
9272
9284
  const payload = {
9273
9285
  name: 'Microsoft.ApplicationInsights.Event',
9274
9286
  time: new Date().toISOString(),
@@ -9278,25 +9290,25 @@
9278
9290
  baseData: {
9279
9291
  ver: 2,
9280
9292
  name: eventName,
9281
- properties: this.convertAttributesToProperties(logRecord.attributes || {})
9282
- }
9293
+ properties: this.convertAttributesToProperties(logRecord.attributes),
9294
+ },
9283
9295
  },
9284
9296
  tags: {
9285
- 'ai.cloud.role': CLOUD_ROLE_NAME,
9286
- 'ai.cloud.roleInstance': SDK_VERSION
9287
- }
9297
+ 'ai.cloud.role': this.tags.cloudRoleName,
9298
+ 'ai.cloud.roleInstance': this.tags.cloudRoleInstance,
9299
+ },
9288
9300
  };
9289
- this.sendToApplicationInsights(payload);
9301
+ void this.sendToApplicationInsights(payload);
9290
9302
  }
9291
9303
  extractInstrumentationKey() {
9292
- const match = this.connectionString.match(/InstrumentationKey=([^;]+)/);
9304
+ const match = INSTRUMENTATION_KEY_RE.exec(this.connectionString);
9293
9305
  return match ? match[1] : '';
9294
9306
  }
9295
9307
  convertAttributesToProperties(attributes) {
9296
9308
  const properties = {};
9297
- Object.entries(attributes || {}).forEach(([key, value]) => {
9309
+ for (const [key, value] of Object.entries(attributes ?? {})) {
9298
9310
  properties[key] = String(value);
9299
- });
9311
+ }
9300
9312
  return properties;
9301
9313
  }
9302
9314
  async sendToApplicationInsights(payload) {
@@ -9309,10 +9321,8 @@
9309
9321
  const url = `${ingestionEndpoint}/v2/track`;
9310
9322
  const response = await fetch(url, {
9311
9323
  method: 'POST',
9312
- headers: {
9313
- 'Content-Type': 'application/json',
9314
- },
9315
- body: JSON.stringify(payload)
9324
+ headers: { 'Content-Type': 'application/json' },
9325
+ body: JSON.stringify(payload),
9316
9326
  });
9317
9327
  if (!response.ok) {
9318
9328
  console.debug(`Failed to send event telemetry: ${response.status} ${response.statusText}`);
@@ -9323,101 +9333,102 @@
9323
9333
  }
9324
9334
  }
9325
9335
  extractIngestionEndpoint() {
9326
- const match = this.connectionString.match(/IngestionEndpoint=([^;]+)/);
9336
+ const match = INGESTION_ENDPOINT_RE.exec(this.connectionString);
9327
9337
  return match ? match[1] : '';
9328
9338
  }
9329
9339
  }
9330
9340
  /**
9331
- * Singleton telemetry client
9341
+ * Telemetry client owned by a single consumer (e.g. the SDK or the Coded
9342
+ * Action Apps package). Each consumer instantiates its own client so that
9343
+ * its identity (`cloudRoleName`, `serviceName`, `sdkVersion`, …) and tenant
9344
+ * context flow through to its own `Logger` and exporter pipeline. Two
9345
+ * consumers running in the same process emit independent events — they
9346
+ * share the Application Insights connection string but nothing else.
9347
+ *
9348
+ * Records are emitted via `Logger.emit` and batched by
9349
+ * `BatchLogRecordProcessor` before being handed to the Application Insights
9350
+ * exporter.
9332
9351
  */
9333
9352
  class TelemetryClient {
9334
9353
  constructor() {
9335
9354
  this.isInitialized = false;
9336
9355
  }
9337
- static getInstance() {
9338
- if (!TelemetryClient.instance) {
9339
- TelemetryClient.instance = new TelemetryClient();
9340
- }
9341
- return TelemetryClient.instance;
9342
- }
9343
- /**
9344
- * Initialize telemetry
9345
- */
9346
- initialize(config) {
9356
+ initialize(options) {
9347
9357
  if (this.isInitialized) {
9358
+ console.debug('Telemetry client has already been initialized');
9348
9359
  return;
9349
9360
  }
9350
9361
  this.isInitialized = true;
9351
- if (config) {
9352
- this.telemetryContext = config;
9353
- }
9362
+ this.options = options;
9363
+ this.telemetryContext = options.context;
9354
9364
  try {
9355
- const connectionString = this.getConnectionString();
9356
- if (!connectionString) {
9365
+ if (!this.isValidConnectionString(CONNECTION_STRING)) {
9357
9366
  return;
9358
9367
  }
9359
- this.setupTelemetryProvider(connectionString);
9368
+ this.setupTelemetryProvider(CONNECTION_STRING);
9360
9369
  }
9361
9370
  catch (error) {
9362
- // Silent failure - telemetry errors shouldn't break functionality
9363
- console.debug('Failed to initialize OpenTelemetry:', error);
9371
+ console.debug('Failed to initialize telemetry:', error);
9364
9372
  }
9365
9373
  }
9366
- getConnectionString() {
9367
- const connectionString = CONNECTION_STRING;
9368
- return connectionString;
9369
- }
9370
- setupTelemetryProvider(connectionString) {
9371
- const exporter = new ApplicationInsightsEventExporter(connectionString);
9372
- const processor = new BatchLogRecordProcessor(exporter);
9373
- this.logProvider = new LoggerProvider({
9374
- processors: [processor]
9375
- });
9376
- this.logger = this.logProvider.getLogger(SDK_LOGGER_NAME);
9377
- }
9378
- /**
9379
- * Track a telemetry event
9380
- */
9381
9374
  track(eventName, name, extraAttributes = {}) {
9382
9375
  try {
9383
- // Skip if logger not initialized
9384
9376
  if (!this.logger) {
9385
9377
  return;
9386
9378
  }
9387
- const finalDisplayName = name || eventName;
9379
+ const finalDisplayName = name ?? eventName;
9388
9380
  const attributes = this.getEnrichedAttributes(extraAttributes, eventName);
9389
- // Emit as log
9390
9381
  this.logger.emit({
9391
9382
  body: finalDisplayName,
9392
- attributes: attributes,
9383
+ attributes,
9393
9384
  timestamp: Date.now(),
9394
9385
  });
9395
9386
  }
9396
9387
  catch (error) {
9397
- // Silent failure
9398
9388
  console.debug('Failed to track telemetry event:', error);
9399
9389
  }
9400
9390
  }
9401
9391
  /**
9402
- * Get enriched attributes for telemetry events
9392
+ * Default event name (e.g. `Sdk.Run`) used when a tracker fires without
9393
+ * an explicit display name. Returns `undefined` until `initialize` runs.
9403
9394
  */
9395
+ getDefaultEventName() {
9396
+ return this.options?.defaultEventName;
9397
+ }
9398
+ setupTelemetryProvider(connectionString) {
9399
+ // `setupTelemetryProvider` is only called from `initialize` after
9400
+ // `this.options` has been assigned, so the non-null assertion is safe.
9401
+ const opts = this.options;
9402
+ const exporter = new ApplicationInsightsEventExporter(connectionString, {
9403
+ cloudRoleName: opts.cloudRoleName,
9404
+ cloudRoleInstance: opts.sdkVersion,
9405
+ });
9406
+ const processor = new BatchLogRecordProcessor(exporter);
9407
+ this.logProvider = new LoggerProvider({
9408
+ processors: [processor],
9409
+ });
9410
+ this.logger = this.logProvider.getLogger(opts.loggerName);
9411
+ }
9412
+ isValidConnectionString(connectionString) {
9413
+ // Build placeholders are emitted as `$CONNECTION_STRING` literally
9414
+ // until the publish workflow patches them. Treat any unsubstituted
9415
+ // placeholder as "no connection string available".
9416
+ return Boolean(connectionString) && !connectionString.startsWith('$');
9417
+ }
9404
9418
  getEnrichedAttributes(extraAttributes, eventName) {
9405
- const attributes = {
9406
- [APP_NAME]: SDK_SERVICE_NAME,
9407
- [VERSION]: SDK_VERSION,
9419
+ const opts = this.options;
9420
+ return {
9421
+ [APP_NAME]: opts?.serviceName ?? UNKNOWN$1,
9422
+ [VERSION]: opts?.sdkVersion ?? UNKNOWN$1,
9408
9423
  [SERVICE]: eventName,
9409
9424
  [CLOUD_URL]: this.createCloudUrl(),
9410
- [CLOUD_ORGANIZATION_NAME]: this.telemetryContext?.orgName || UNKNOWN$1,
9411
- [CLOUD_TENANT_NAME]: this.telemetryContext?.tenantName || UNKNOWN$1,
9412
- [CLOUD_REDIRECT_URI]: this.telemetryContext?.redirectUri || UNKNOWN$1,
9413
- [CLOUD_CLIENT_ID]: this.telemetryContext?.clientId || UNKNOWN$1,
9425
+ [CLOUD_ORGANIZATION_NAME]: this.telemetryContext?.orgName ?? UNKNOWN$1,
9426
+ [CLOUD_TENANT_NAME]: this.telemetryContext?.tenantName ?? UNKNOWN$1,
9427
+ [CLOUD_REDIRECT_URI]: this.telemetryContext?.redirectUri ?? UNKNOWN$1,
9428
+ [CLOUD_CLIENT_ID]: this.telemetryContext?.clientId ?? UNKNOWN$1,
9414
9429
  ...extraAttributes,
9415
9430
  };
9416
- return attributes;
9417
9431
  }
9418
- /**
9419
- * Create cloud URL from base URL, organization ID, and tenant ID
9420
- */
9421
9432
  createCloudUrl() {
9422
9433
  const baseUrl = this.telemetryContext?.baseUrl;
9423
9434
  const orgId = this.telemetryContext?.orgName;
@@ -9428,78 +9439,166 @@
9428
9439
  return `${baseUrl}/${orgId}/${tenantId}`;
9429
9440
  }
9430
9441
  }
9431
- // Export singleton instance
9432
- const telemetryClient = TelemetryClient.getInstance();
9433
9442
 
9434
9443
  /**
9435
- * SDK Track decorator and function for telemetry
9444
+ * Each consumer ships as multiple subpath bundles and Rollup inlines this
9445
+ * shim into every one — `new TelemetryClient()` would hand each bundle its
9446
+ * own (uninitialized) client. `getOrCreateClient(name)` instead parks the
9447
+ * client on `globalThis` so every bundle shares one client per name.
9448
+ */
9449
+ const REGISTRY_KEY$1 = Symbol.for('@uipath/core-telemetry/clients');
9450
+ function getGlobalRegistry() {
9451
+ const holder = globalThis;
9452
+ let registry = holder[REGISTRY_KEY$1];
9453
+ if (!registry) {
9454
+ registry = {};
9455
+ holder[REGISTRY_KEY$1] = registry;
9456
+ }
9457
+ return registry;
9458
+ }
9459
+ /**
9460
+ * Returns the named `TelemetryClient`, creating it on first access.
9461
+ *
9462
+ * @param name Stable identifier for the consumer (e.g. `"uipath-ts-sdk"`,
9463
+ * `"uipath-ts-coded-action-apps"`). Subpath bundles within the same
9464
+ * consumer share a client by passing the same name.
9436
9465
  */
9466
+ function getOrCreateClient(name) {
9467
+ const registry = getGlobalRegistry();
9468
+ if (!registry[name]) {
9469
+ registry[name] = new TelemetryClient();
9470
+ }
9471
+ return registry[name];
9472
+ }
9473
+
9437
9474
  /**
9438
- * Common tracking logic shared between method and function decorators
9475
+ * `@track` decorator and `trackEvent` function factories.
9439
9476
  */
9440
- function createTrackedFunction(originalFunction, nameOrOptions, fallbackName, opts) {
9441
- return function (...args) {
9442
- // Determine if we should track this call
9477
+ function createTrackedFunction(originalFunction, { client, nameOrOptions, fallbackName, opts }) {
9478
+ const wrapped = function (...args) {
9443
9479
  let shouldTrack = true;
9444
9480
  if (opts.condition !== undefined) {
9445
- if (typeof opts.condition === 'function') {
9446
- shouldTrack = opts.condition.apply(this, args);
9447
- }
9448
- else {
9449
- shouldTrack = opts.condition;
9450
- }
9481
+ shouldTrack =
9482
+ typeof opts.condition === 'function'
9483
+ ? opts.condition.apply(this, args)
9484
+ : opts.condition;
9451
9485
  }
9452
- // Track the event if enabled
9453
9486
  if (shouldTrack) {
9454
- // Use the full name provided in the decorator (e.g., "Queue.GetAll")
9455
- const serviceMethod = typeof nameOrOptions === 'string'
9456
- ? nameOrOptions
9457
- : fallbackName;
9458
- // Use 'Sdk.Run' as the name and serviceMethod as the service
9459
- telemetryClient.track(serviceMethod, SDK_RUN_EVENT, opts.attributes);
9460
- }
9461
- // Execute the original function
9487
+ const serviceMethod = typeof nameOrOptions === 'string' ? nameOrOptions : fallbackName;
9488
+ client.track(serviceMethod, client.getDefaultEventName(), opts.attributes);
9489
+ }
9462
9490
  return originalFunction.apply(this, args);
9463
9491
  };
9492
+ return wrapped;
9464
9493
  }
9465
9494
  /**
9466
- * Track decorator that can be used to automatically track function calls
9495
+ * Factory: returns a `track` decorator bound to a specific
9496
+ * `TelemetryClient`. Each consumer creates its own decorator from its own
9497
+ * client so events carry that consumer's identity.
9467
9498
  *
9468
- * Usage:
9469
- * @track("Service.Method")
9470
- * function myFunction() { ... }
9499
+ * @example
9500
+ * ```ts
9501
+ * const sdkClient = new TelemetryClient();
9502
+ * sdkClient.initialize({ ... });
9503
+ * export const track = createTrack(sdkClient);
9471
9504
  *
9472
- * @track("Queue.GetAll")
9505
+ * // Consumer code
9506
+ * @track('Queue.GetAll')
9473
9507
  * async getAll() { ... }
9474
9508
  *
9475
- * @track("Tasks.Create")
9476
- * async create() { ... }
9477
- *
9478
- * @track("Assets.Update", { condition: false })
9479
- * function myFunction() { ... }
9480
- *
9481
- * @track("Processes.Start", { attributes: { customProp: "value" } })
9482
- * function myFunction() { ... }
9509
+ * @track('Assets.Update', { condition: false })
9510
+ * async update() { ... }
9511
+ * ```
9483
9512
  */
9484
- function track(nameOrOptions, options) {
9485
- return function decorator(_target, propertyKey, descriptor) {
9486
- const opts = typeof nameOrOptions === 'object' ? nameOrOptions : options || {};
9487
- if (descriptor && typeof descriptor.value === 'function') {
9488
- // Method decorator
9489
- descriptor.value = createTrackedFunction(descriptor.value, nameOrOptions, propertyKey || 'unknown_method', opts);
9490
- return descriptor;
9513
+ function createTrack(client) {
9514
+ function trackFactory(nameOrOptions, options) {
9515
+ const opts = typeof nameOrOptions === 'object' ? nameOrOptions : options ?? {};
9516
+ function decoratorImpl(target, propertyKey, descriptor) {
9517
+ if (descriptor && typeof descriptor.value === 'function') {
9518
+ const original = descriptor.value;
9519
+ descriptor.value = createTrackedFunction(original, {
9520
+ client,
9521
+ nameOrOptions,
9522
+ fallbackName: typeof propertyKey === 'string'
9523
+ ? propertyKey
9524
+ : 'unknown_method',
9525
+ opts,
9526
+ });
9527
+ return descriptor;
9528
+ }
9529
+ const fn = target;
9530
+ return createTrackedFunction(fn, {
9531
+ client,
9532
+ nameOrOptions,
9533
+ fallbackName: fn.name || 'unknown_function',
9534
+ opts,
9535
+ });
9491
9536
  }
9492
- // Function decorator
9493
- return (originalFunction) => createTrackedFunction(originalFunction, nameOrOptions, originalFunction.name || 'unknown_function', opts);
9494
- };
9537
+ return decoratorImpl;
9538
+ }
9539
+ return trackFactory;
9495
9540
  }
9496
9541
  /**
9497
- * Direct tracking function
9542
+ * Factory: returns a `trackEvent` function bound to a specific
9543
+ * `TelemetryClient`. Use for ad-hoc tracking outside method boundaries.
9544
+ *
9545
+ * @example
9546
+ * ```ts
9547
+ * const trackEvent = createTrackEvent(sdkClient);
9548
+ * trackEvent('Sdk.Auth');
9549
+ * ```
9498
9550
  */
9499
- function trackEvent(eventName, name, attributes) {
9500
- telemetryClient.track(eventName, name, attributes);
9551
+ function createTrackEvent(client) {
9552
+ return function trackEvent(eventName, name, attributes) {
9553
+ client.track(eventName, name, attributes);
9554
+ };
9501
9555
  }
9502
9556
 
9557
+ /**
9558
+ * SDK Telemetry constants.
9559
+ *
9560
+ * Only the SDK's identity (version, service name, role name, …) lives
9561
+ * here. The Application Insights connection string is injected into
9562
+ * `@uipath/core-telemetry` itself at publish time, and the generic attribute
9563
+ * keys (`Version`, `Service`, `CloudOrganizationName`, …) are owned by
9564
+ * `@uipath/core-telemetry` and consumed there — they are not part of the
9565
+ * SDK's public API.
9566
+ */
9567
+ /** SDK version placeholder — patched by the SDK publish workflow. */
9568
+ const SDK_VERSION = '1.3.9';
9569
+ const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
9570
+ const SDK_SERVICE_NAME = 'UiPath.TypeScript.Sdk';
9571
+ const SDK_LOGGER_NAME = 'uipath-ts-sdk-telemetry';
9572
+ const SDK_RUN_EVENT = 'Sdk.Run';
9573
+
9574
+ /**
9575
+ * UiPath TypeScript SDK Telemetry
9576
+ *
9577
+ * Constructs the SDK's own `TelemetryClient` and binds the SDK-local
9578
+ * `track` / `trackEvent` to it. Each consumer of `@uipath/core-telemetry`
9579
+ * does this independently, so events carry their own consumer's identity
9580
+ * and tenant context.
9581
+ */
9582
+ // Keyed by `CLOUD_ROLE_NAME` so every SDK subpath bundle resolves to the
9583
+ // same `TelemetryClient` instance at runtime. A single `initialize(...)`
9584
+ // from the `UiPath` constructor therefore wires up `@track` decorators
9585
+ // across every subpath bundle (`assets`, `feedback`, `tasks`, …).
9586
+ const sdkClient = getOrCreateClient(CLOUD_ROLE_NAME);
9587
+ const track = createTrack(sdkClient);
9588
+ const trackEvent = createTrackEvent(sdkClient);
9589
+ const telemetryClient = {
9590
+ initialize(context) {
9591
+ sdkClient.initialize({
9592
+ sdkVersion: SDK_VERSION,
9593
+ serviceName: SDK_SERVICE_NAME,
9594
+ cloudRoleName: CLOUD_ROLE_NAME,
9595
+ loggerName: SDK_LOGGER_NAME,
9596
+ defaultEventName: SDK_RUN_EVENT,
9597
+ context,
9598
+ });
9599
+ },
9600
+ };
9601
+
9503
9602
  /**
9504
9603
  * SDK Internals Registry - Internal registry for SDK instances
9505
9604
  *
@@ -13085,6 +13184,53 @@
13085
13184
  return Object.assign({}, processData, methods);
13086
13185
  }
13087
13186
 
13187
+ /**
13188
+ * Builds the request body for Insights RTM "top" endpoints.
13189
+ *
13190
+ * @param startTime - Start of the time range to query
13191
+ * @param endTime - End of the time range to query
13192
+ * @param isCaseManagement - Whether to filter for case management processes
13193
+ * @param options - Optional filters (packageId, processKey, version)
13194
+ * @returns Request body for the Insights RTM endpoint
13195
+ * @internal
13196
+ */
13197
+ function buildInsightsTopBody(startTime, endTime, isCaseManagement, options) {
13198
+ return {
13199
+ commonParams: {
13200
+ startTime: startTime.getTime(),
13201
+ endTime: endTime.getTime(),
13202
+ isCaseManagement,
13203
+ ...(options?.packageId ? { packageId: options.packageId } : {}),
13204
+ ...(options?.processKey ? { processKey: options.processKey } : {}),
13205
+ ...(options?.version ? { version: options.version } : {}),
13206
+ }
13207
+ };
13208
+ }
13209
+ /**
13210
+ * Fetches instance status timeline from the Insights API.
13211
+ * Shared implementation used by both MaestroProcessesService and CasesService.
13212
+ *
13213
+ * @param postFn - Bound post method from a BaseService subclass
13214
+ * @param startTime - Start of the time range to query
13215
+ * @param endTime - End of the time range to query
13216
+ * @param isCaseManagement - Whether to filter for case management processes
13217
+ * @param options - Optional settings for time bucketing granularity
13218
+ * @returns Promise resolving to an array of instance status timeline entries
13219
+ * @internal
13220
+ */
13221
+ async function fetchInstanceStatusTimeline(postFn, startTime, endTime, isCaseManagement, options) {
13222
+ const response = await postFn(MAESTRO_ENDPOINTS.INSIGHTS.INSTANCE_STATUS_BY_DATE, {
13223
+ commonParams: {
13224
+ startTime: startTime.getTime(),
13225
+ endTime: endTime.getTime(),
13226
+ isCaseManagement,
13227
+ },
13228
+ timeSliceUnit: options?.groupBy,
13229
+ timezoneOffset: new Date().getTimezoneOffset() * -1,
13230
+ });
13231
+ return response.data ?? [];
13232
+ }
13233
+
13088
13234
  /**
13089
13235
  * Maps fields for Incident entities
13090
13236
  */
@@ -13461,6 +13607,11 @@
13461
13607
  if (!instanceData.instanceId)
13462
13608
  throw new Error('Case instance ID is undefined');
13463
13609
  return service.getSlaSummary({ ...options, caseInstanceId: instanceData.instanceId });
13610
+ },
13611
+ async getStagesSlaSummary() {
13612
+ if (!instanceData.instanceId)
13613
+ throw new Error('Case instance ID is undefined');
13614
+ return service.getStagesSlaSummary({ caseInstanceId: instanceData.instanceId });
13464
13615
  }
13465
13616
  };
13466
13617
  }
@@ -13476,6 +13627,40 @@
13476
13627
  return Object.assign({}, instanceData, methods);
13477
13628
  }
13478
13629
 
13630
+ /**
13631
+ * Insights Types
13632
+ * Shared types for Maestro insights analytics endpoints
13633
+ */
13634
+ /**
13635
+ * Time bucketing granularity for insights time-series queries.
13636
+ *
13637
+ * Controls how data points are grouped on the time axis.
13638
+ */
13639
+ exports.TimeInterval = void 0;
13640
+ (function (TimeInterval) {
13641
+ /** Group data points by hour */
13642
+ TimeInterval["Hour"] = "HOUR";
13643
+ /** Group data points by day */
13644
+ TimeInterval["Day"] = "DAY";
13645
+ /** Group data points by week */
13646
+ TimeInterval["Week"] = "WEEK";
13647
+ })(exports.TimeInterval || (exports.TimeInterval = {}));
13648
+ /**
13649
+ * Final instance statuses returned by the instance status timeline endpoint.
13650
+ *
13651
+ * Only includes statuses where the instance has finished execution — Completed, Faulted, or Cancelled.
13652
+ * Active statuses like Running or Paused are not included.
13653
+ */
13654
+ exports.InstanceFinalStatus = void 0;
13655
+ (function (InstanceFinalStatus) {
13656
+ /** Instance completed successfully */
13657
+ InstanceFinalStatus["Completed"] = "Completed";
13658
+ /** Instance encountered an error */
13659
+ InstanceFinalStatus["Faulted"] = "Faulted";
13660
+ /** Instance was cancelled */
13661
+ InstanceFinalStatus["Cancelled"] = "Cancelled";
13662
+ })(exports.InstanceFinalStatus || (exports.InstanceFinalStatus = {}));
13663
+
13479
13664
  /**
13480
13665
  * Maps fields for Process Instance entities to ensure consistent naming
13481
13666
  */
@@ -13851,6 +14036,177 @@
13851
14036
  // Fetch BPMN XML and add element name/type to each incident
13852
14037
  return BpmnHelpers.enrichIncidentsWithBpmnData(rawResponse.data || [], folderKey, this.processInstancesService);
13853
14038
  }
14039
+ /**
14040
+ * Get the top 5 processes ranked by run count within a time range.
14041
+ *
14042
+ * Returns an array of up to 5 processes sorted by how many times they were executed,
14043
+ * useful for identifying the most active processes in a given period.
14044
+ *
14045
+ * @param startTime - Start of the time range to query
14046
+ * @param endTime - End of the time range to query
14047
+ * @param options - Optional filters (packageId, processKey, version)
14048
+ * @returns Promise resolving to an array of {@link ProcessGetTopRunCountResponse}
14049
+ * @example
14050
+ * ```typescript
14051
+ * import { MaestroProcesses } from '@uipath/uipath-typescript/maestro-processes';
14052
+ *
14053
+ * const maestroProcesses = new MaestroProcesses(sdk);
14054
+ *
14055
+ * // Get top processes by run count for the last 7 days
14056
+ * const topProcesses = await maestroProcesses.getTopRunCount(
14057
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
14058
+ * new Date()
14059
+ * );
14060
+ *
14061
+ * for (const process of topProcesses) {
14062
+ * console.log(`${process.packageId}: ${process.runCount} runs`);
14063
+ * }
14064
+ * ```
14065
+ *
14066
+ * @example
14067
+ * ```typescript
14068
+ * // Get top processes by run count for a specific package
14069
+ * const filtered = await maestroProcesses.getTopRunCount(
14070
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
14071
+ * new Date(),
14072
+ * { packageId: '<packageId>' }
14073
+ * );
14074
+ * ```
14075
+ */
14076
+ async getTopRunCount(startTime, endTime, options) {
14077
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_RUN_COUNT, buildInsightsTopBody(startTime, endTime, false, options));
14078
+ return (data ?? []).map(process => ({ ...process, name: process.packageId }));
14079
+ }
14080
+ /**
14081
+ * Get all instances status counts aggregated by date for maestro processes.
14082
+ *
14083
+ * Returns time-grouped counts of instances grouped by status (Completed, Faulted, Cancelled),
14084
+ * useful for rendering time-series charts. Use `groupBy` to control the time bucket size
14085
+ * (hour, day, or week) — defaults to day if not provided.
14086
+ *
14087
+ * @param startTime - Start of the time range to query
14088
+ * @param endTime - End of the time range to query
14089
+ * @param options - Optional settings for time bucketing granularity
14090
+ * @returns Promise resolving to an array of {@link InstanceStatusTimelineResponse}
14091
+ *
14092
+ * @example
14093
+ * ```typescript
14094
+ * // Get daily instance status for the last 7 days
14095
+ * const now = new Date();
14096
+ * const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
14097
+ * const statuses = await maestroProcesses.getInstanceStatusTimeline(sevenDaysAgo, now);
14098
+ *
14099
+ * for (const entry of statuses) {
14100
+ * console.log(`${entry.startTime} — ${entry.status}: ${entry.count}`);
14101
+ * }
14102
+ * ```
14103
+ *
14104
+ * @example
14105
+ * ```typescript
14106
+ * import { TimeInterval } from '@uipath/uipath-typescript/maestro-processes';
14107
+ *
14108
+ * // Get hourly breakdown
14109
+ * const statuses = await maestroProcesses.getInstanceStatusTimeline(startTime, endTime, {
14110
+ * groupBy: TimeInterval.Hour,
14111
+ * });
14112
+ * ```
14113
+ *
14114
+ * @example
14115
+ * ```typescript
14116
+ * // Get all-time data (from Unix epoch to now)
14117
+ * const allTime = await maestroProcesses.getInstanceStatusTimeline(new Date(0), new Date());
14118
+ * ```
14119
+ */
14120
+ async getInstanceStatusTimeline(startTime, endTime, options) {
14121
+ return fetchInstanceStatusTimeline(this.post.bind(this), startTime, endTime, false, options);
14122
+ }
14123
+ /**
14124
+ * Get the top 10 processes ranked by failure count within a time range.
14125
+ *
14126
+ * Returns an array of up to 10 processes sorted by how many instances faulted,
14127
+ * useful for identifying the most error-prone processes in a given period.
14128
+ *
14129
+ * @param startTime - Start of the time range to query
14130
+ * @param endTime - End of the time range to query
14131
+ * @param options - Optional filters (packageId, processKey, version)
14132
+ * @returns Promise resolving to an array of {@link ProcessGetTopFaultedCountResponse}
14133
+ * @example
14134
+ * ```typescript
14135
+ * import { MaestroProcesses } from '@uipath/uipath-typescript/maestro-processes';
14136
+ *
14137
+ * const maestroProcesses = new MaestroProcesses(sdk);
14138
+ *
14139
+ * // Get top processes by faulted count for the last 7 days
14140
+ * const topFailing = await maestroProcesses.getTopFaultedCount(
14141
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
14142
+ * new Date()
14143
+ * );
14144
+ *
14145
+ * for (const process of topFailing) {
14146
+ * console.log(`${process.packageId}: ${process.faultedCount} failures`);
14147
+ * }
14148
+ * ```
14149
+ *
14150
+ * @example
14151
+ * ```typescript
14152
+ * // Get top processes by faulted count for a specific package
14153
+ * const filtered = await maestroProcesses.getTopFaultedCount(
14154
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
14155
+ * new Date(),
14156
+ * { packageId: '<packageId>' }
14157
+ * );
14158
+ * ```
14159
+ */
14160
+ async getTopFaultedCount(startTime, endTime, options) {
14161
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_WITH_FAILURE, buildInsightsTopBody(startTime, endTime, false, options));
14162
+ return (data ?? []).map(item => ({
14163
+ packageId: item.packageId,
14164
+ processKey: item.processKey,
14165
+ faultedCount: item.runCount,
14166
+ name: item.packageId,
14167
+ }));
14168
+ }
14169
+ /**
14170
+ * Get the top 5 processes ranked by total duration within a time range.
14171
+ *
14172
+ * Returns an array of up to 5 processes sorted by their total execution time,
14173
+ * useful for identifying the longest-running processes in a given period.
14174
+ *
14175
+ * @param startTime - Start of the time range to query
14176
+ * @param endTime - End of the time range to query
14177
+ * @param options - Optional filters (packageId, processKey, version)
14178
+ * @returns Promise resolving to an array of {@link ProcessGetTopDurationResponse}
14179
+ * @example
14180
+ * ```typescript
14181
+ * import { MaestroProcesses } from '@uipath/uipath-typescript/maestro-processes';
14182
+ *
14183
+ * const maestroProcesses = new MaestroProcesses(sdk);
14184
+ *
14185
+ * // Get top processes by duration for the last 7 days
14186
+ * const topProcesses = await maestroProcesses.getTopExecutionDuration(
14187
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
14188
+ * new Date()
14189
+ * );
14190
+ *
14191
+ * for (const process of topProcesses) {
14192
+ * console.log(`${process.packageId}: ${process.duration}ms total`);
14193
+ * }
14194
+ * ```
14195
+ *
14196
+ * @example
14197
+ * ```typescript
14198
+ * // Get top processes by duration for a specific package
14199
+ * const filtered = await maestroProcesses.getTopExecutionDuration(
14200
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
14201
+ * new Date(),
14202
+ * { packageId: '<packageId>' }
14203
+ * );
14204
+ * ```
14205
+ */
14206
+ async getTopExecutionDuration(startTime, endTime, options) {
14207
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_DURATION, buildInsightsTopBody(startTime, endTime, false, options));
14208
+ return (data ?? []).map(process => ({ ...process, name: process.packageId }));
14209
+ }
13854
14210
  }
13855
14211
  __decorate([
13856
14212
  track('MaestroProcesses.GetAll')
@@ -13858,6 +14214,18 @@
13858
14214
  __decorate([
13859
14215
  track('MaestroProcesses.GetIncidents')
13860
14216
  ], MaestroProcessesService.prototype, "getIncidents", null);
14217
+ __decorate([
14218
+ track('MaestroProcesses.GetTopRunCount')
14219
+ ], MaestroProcessesService.prototype, "getTopRunCount", null);
14220
+ __decorate([
14221
+ track('MaestroProcesses.GetInstanceStatusTimeline')
14222
+ ], MaestroProcessesService.prototype, "getInstanceStatusTimeline", null);
14223
+ __decorate([
14224
+ track('MaestroProcesses.GetTopFaultedCount')
14225
+ ], MaestroProcessesService.prototype, "getTopFaultedCount", null);
14226
+ __decorate([
14227
+ track('MaestroProcesses.GetTopExecutionDuration')
14228
+ ], MaestroProcessesService.prototype, "getTopExecutionDuration", null);
13861
14229
 
13862
14230
  /**
13863
14231
  * Service class for Maestro Process Incidents
@@ -13942,6 +14310,177 @@
13942
14310
  name: this.extractCaseName(caseItem.packageId)
13943
14311
  }));
13944
14312
  }
14313
+ /**
14314
+ * Get the top 5 case processes ranked by run count within a time range.
14315
+ *
14316
+ * Returns an array of up to 5 case processes sorted by how many times they were executed,
14317
+ * useful for identifying the most active case processes in a given period.
14318
+ *
14319
+ * @param startTime - Start of the time range to query
14320
+ * @param endTime - End of the time range to query
14321
+ * @param options - Optional filters (packageId, processKey, version)
14322
+ * @returns Promise resolving to an array of {@link CaseGetTopRunCountResponse}
14323
+ * @example
14324
+ * ```typescript
14325
+ * import { Cases } from '@uipath/uipath-typescript/cases';
14326
+ *
14327
+ * const cases = new Cases(sdk);
14328
+ *
14329
+ * // Get top case processes by run count for the last 7 days
14330
+ * const topProcesses = await cases.getTopRunCount(
14331
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
14332
+ * new Date()
14333
+ * );
14334
+ *
14335
+ * for (const process of topProcesses) {
14336
+ * console.log(`${process.packageId}: ${process.runCount} runs`);
14337
+ * }
14338
+ * ```
14339
+ *
14340
+ * @example
14341
+ * ```typescript
14342
+ * // Get top case processes by run count for a specific package
14343
+ * const filtered = await cases.getTopRunCount(
14344
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
14345
+ * new Date(),
14346
+ * { packageId: '<packageId>' }
14347
+ * );
14348
+ * ```
14349
+ */
14350
+ async getTopRunCount(startTime, endTime, options) {
14351
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_RUN_COUNT, buildInsightsTopBody(startTime, endTime, true, options));
14352
+ return (data ?? []).map(process => ({ ...process, name: this.extractCaseName(process.packageId) }));
14353
+ }
14354
+ /**
14355
+ * Get all instances status counts aggregated by date for case management processes.
14356
+ *
14357
+ * Returns time-grouped counts of case instances grouped by status (Completed, Faulted, Cancelled),
14358
+ * useful for rendering time-series charts. Use `groupBy` to control the time bucket size
14359
+ * (hour, day, or week) — defaults to day if not provided.
14360
+ *
14361
+ * @param startTime - Start of the time range to query
14362
+ * @param endTime - End of the time range to query
14363
+ * @param options - Optional settings for time bucketing granularity
14364
+ * @returns Promise resolving to an array of {@link InstanceStatusTimelineResponse}
14365
+ *
14366
+ * @example
14367
+ * ```typescript
14368
+ * // Get daily instance status for the last 7 days
14369
+ * const now = new Date();
14370
+ * const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
14371
+ * const statuses = await cases.getInstanceStatusTimeline(sevenDaysAgo, now);
14372
+ *
14373
+ * for (const entry of statuses) {
14374
+ * console.log(`${entry.startTime} — ${entry.status}: ${entry.count}`);
14375
+ * }
14376
+ * ```
14377
+ *
14378
+ * @example
14379
+ * ```typescript
14380
+ * import { TimeInterval } from '@uipath/uipath-typescript/cases';
14381
+ *
14382
+ * // Get weekly breakdown
14383
+ * const statuses = await cases.getInstanceStatusTimeline(startTime, endTime, {
14384
+ * groupBy: TimeInterval.Week,
14385
+ * });
14386
+ * ```
14387
+ *
14388
+ * @example
14389
+ * ```typescript
14390
+ * // Get all-time data (from Unix epoch to now)
14391
+ * const allTime = await cases.getInstanceStatusTimeline(new Date(0), new Date());
14392
+ * ```
14393
+ */
14394
+ async getInstanceStatusTimeline(startTime, endTime, options) {
14395
+ return fetchInstanceStatusTimeline(this.post.bind(this), startTime, endTime, true, options);
14396
+ }
14397
+ /**
14398
+ * Get the top 10 case processes ranked by failure count within a time range.
14399
+ *
14400
+ * Returns an array of up to 10 case processes sorted by how many instances faulted,
14401
+ * useful for identifying the most error-prone case processes in a given period.
14402
+ *
14403
+ * @param startTime - Start of the time range to query
14404
+ * @param endTime - End of the time range to query
14405
+ * @param options - Optional filters (packageId, processKey, version)
14406
+ * @returns Promise resolving to an array of {@link CaseGetTopFaultedCountResponse}
14407
+ * @example
14408
+ * ```typescript
14409
+ * import { Cases } from '@uipath/uipath-typescript/cases';
14410
+ *
14411
+ * const cases = new Cases(sdk);
14412
+ *
14413
+ * // Get top case processes by faulted count for the last 7 days
14414
+ * const topFailing = await cases.getTopFaultedCount(
14415
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
14416
+ * new Date()
14417
+ * );
14418
+ *
14419
+ * for (const process of topFailing) {
14420
+ * console.log(`${process.packageId}: ${process.faultedCount} failures`);
14421
+ * }
14422
+ * ```
14423
+ *
14424
+ * @example
14425
+ * ```typescript
14426
+ * // Get top case processes by faulted count for a specific package
14427
+ * const filtered = await cases.getTopFaultedCount(
14428
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
14429
+ * new Date(),
14430
+ * { packageId: '<packageId>' }
14431
+ * );
14432
+ * ```
14433
+ */
14434
+ async getTopFaultedCount(startTime, endTime, options) {
14435
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_WITH_FAILURE, buildInsightsTopBody(startTime, endTime, true, options));
14436
+ return (data ?? []).map(item => ({
14437
+ packageId: item.packageId,
14438
+ processKey: item.processKey,
14439
+ faultedCount: item.runCount,
14440
+ name: this.extractCaseName(item.packageId),
14441
+ }));
14442
+ }
14443
+ /**
14444
+ * Get the top 5 case processes ranked by total duration within a time range.
14445
+ *
14446
+ * Returns an array of up to 5 case processes sorted by their total execution time,
14447
+ * useful for identifying the longest-running case processes in a given period.
14448
+ *
14449
+ * @param startTime - Start of the time range to query
14450
+ * @param endTime - End of the time range to query
14451
+ * @param options - Optional filters (packageId, processKey, version)
14452
+ * @returns Promise resolving to an array of {@link CaseGetTopDurationResponse}
14453
+ * @example
14454
+ * ```typescript
14455
+ * import { Cases } from '@uipath/uipath-typescript/cases';
14456
+ *
14457
+ * const cases = new Cases(sdk);
14458
+ *
14459
+ * // Get top case processes by duration for the last 7 days
14460
+ * const topProcesses = await cases.getTopExecutionDuration(
14461
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
14462
+ * new Date()
14463
+ * );
14464
+ *
14465
+ * for (const process of topProcesses) {
14466
+ * console.log(`${process.packageId}: ${process.duration}ms total`);
14467
+ * }
14468
+ * ```
14469
+ *
14470
+ * @example
14471
+ * ```typescript
14472
+ * // Get top case processes by duration for a specific package
14473
+ * const filtered = await cases.getTopExecutionDuration(
14474
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
14475
+ * new Date(),
14476
+ * { packageId: '<packageId>' }
14477
+ * );
14478
+ * ```
14479
+ */
14480
+ async getTopExecutionDuration(startTime, endTime, options) {
14481
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_DURATION, buildInsightsTopBody(startTime, endTime, true, options));
14482
+ return (data ?? []).map(process => ({ ...process, name: this.extractCaseName(process.packageId) }));
14483
+ }
13945
14484
  /**
13946
14485
  * Extract a readable case name from the packageId
13947
14486
  * @param packageId - The full package identifier
@@ -13964,6 +14503,18 @@
13964
14503
  __decorate([
13965
14504
  track('Cases.GetAll')
13966
14505
  ], CasesService.prototype, "getAll", null);
14506
+ __decorate([
14507
+ track('Cases.GetTopRunCount')
14508
+ ], CasesService.prototype, "getTopRunCount", null);
14509
+ __decorate([
14510
+ track('Cases.GetInstanceStatusTimeline')
14511
+ ], CasesService.prototype, "getInstanceStatusTimeline", null);
14512
+ __decorate([
14513
+ track('Cases.GetTopFaultedCount')
14514
+ ], CasesService.prototype, "getTopFaultedCount", null);
14515
+ __decorate([
14516
+ track('Cases.GetTopExecutionDuration')
14517
+ ], CasesService.prototype, "getTopExecutionDuration", null);
13967
14518
 
13968
14519
  /**
13969
14520
  * Maps fields for Case Instance entities to ensure consistent naming
@@ -15079,6 +15630,40 @@
15079
15630
  }
15080
15631
  }, apiOptions);
15081
15632
  }
15633
+ /**
15634
+ * Get stages SLA summary for case instances across folders.
15635
+ *
15636
+ * Returns stage-level SLA status and escalation information for each case instance, aggregated from Insights Real-Time Monitoring.
15637
+ *
15638
+ * @param options - Optional filtering options
15639
+ * @returns Promise resolving to an array of {@link CaseInstanceStageSLAResponse}
15640
+ * @example
15641
+ * ```typescript
15642
+ * // Get stages SLA summary for all case instances
15643
+ * const stagesSla = await caseInstances.getStagesSlaSummary();
15644
+ * for (const item of stagesSla) {
15645
+ * console.log(`Instance: ${item.caseInstanceId}`);
15646
+ * for (const stage of item.stages) {
15647
+ * console.log(` Stage: ${stage.name} - SLA Status: ${stage.slaStatus}, Due: ${stage.slaDueTime}`);
15648
+ * }
15649
+ * }
15650
+ *
15651
+ * // Filter by case instance ID
15652
+ * const filtered = await caseInstances.getStagesSlaSummary({
15653
+ * caseInstanceId: '<caseInstanceId>'
15654
+ * });
15655
+ *
15656
+ * // Using bound method on a case instance
15657
+ * const instance = await caseInstances.getById('<instanceId>', '<folderKey>');
15658
+ * const stagesSla = await instance.getStagesSlaSummary();
15659
+ * ```
15660
+ */
15661
+ async getStagesSlaSummary(options) {
15662
+ const response = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.STAGES_SUMMARY, {
15663
+ caseInstanceId: options?.caseInstanceId,
15664
+ });
15665
+ return response.data ?? [];
15666
+ }
15082
15667
  }
15083
15668
  __decorate([
15084
15669
  track('CaseInstances.GetAll')
@@ -15110,6 +15695,9 @@
15110
15695
  __decorate([
15111
15696
  track('CaseInstances.GetSlaSummary')
15112
15697
  ], CaseInstancesService.prototype, "getSlaSummary", null);
15698
+ __decorate([
15699
+ track('CaseInstances.GetStagesSlaSummary')
15700
+ ], CaseInstancesService.prototype, "getStagesSlaSummary", null);
15113
15701
 
15114
15702
  /**
15115
15703
  * Validates the `name` argument passed to a `getByName(name, ...)` method.
@@ -15517,6 +16105,32 @@
15517
16105
  // Transform response from PascalCase to camelCase
15518
16106
  return pascalToCamelCaseKeys(response.data);
15519
16107
  }
16108
+ /**
16109
+ * Retrieves a single orchestrator storage bucket by name.
16110
+ *
16111
+ * @param name - Bucket name to search for
16112
+ * @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
16113
+ * @returns Promise resolving to a single bucket
16114
+ * {@link BucketGetResponse}
16115
+ * @example
16116
+ * ```typescript
16117
+ * import { Buckets } from '@uipath/uipath-typescript/buckets';
16118
+ *
16119
+ * const buckets = new Buckets(sdk);
16120
+ *
16121
+ * // By folder ID
16122
+ * await buckets.getByName('MyBucket', { folderId: <folderId> });
16123
+ *
16124
+ * // By folder key (GUID)
16125
+ * await buckets.getByName('MyBucket', { folderKey: '<folderKey>' });
16126
+ *
16127
+ * // By folder path
16128
+ * await buckets.getByName('MyBucket', { folderPath: '<folderPath>' });
16129
+ * ```
16130
+ */
16131
+ async getByName(name, options = {}) {
16132
+ return this.getByNameLookup('Bucket', BUCKET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => pascalToCamelCaseKeys(raw));
16133
+ }
15520
16134
  /**
15521
16135
  * Gets all buckets across folders with optional filtering and folder scoping
15522
16136
  *
@@ -15806,6 +16420,9 @@
15806
16420
  __decorate([
15807
16421
  track('Buckets.GetById')
15808
16422
  ], BucketService.prototype, "getById", null);
16423
+ __decorate([
16424
+ track('Buckets.GetByName')
16425
+ ], BucketService.prototype, "getByName", null);
15809
16426
  __decorate([
15810
16427
  track('Buckets.GetAll')
15811
16428
  ], BucketService.prototype, "getAll", null);
@@ -16983,6 +17600,17 @@
16983
17600
  lastActivityAt: 'lastActivityTime',
16984
17601
  agentReleaseId: 'agentId'
16985
17602
  };
17603
+ /**
17604
+ * Maps API filter param names (left) to SDK-facing names (right) for the conversation list endpoint.
17605
+ * Used by `getAll` to translate SDK filters to the field names the backend expects. Kept separate
17606
+ * from `ConversationMap` because `label`/`search` would otherwise collide with the `label` field
17607
+ * on create/update payloads.
17608
+ */
17609
+ const ConversationGetAllFilterMap = {
17610
+ agentReleaseKey: 'agentKey',
17611
+ agentReleaseId: 'agentId',
17612
+ search: 'label'
17613
+ };
16986
17614
  /**
16987
17615
  * Maps fields for Exchange entity to ensure consistent SDK naming
16988
17616
  */
@@ -17342,8 +17970,8 @@
17342
17970
  // Auto-generated from the OpenAPI spec — do not edit manually.
17343
17971
  var ModelKind;
17344
17972
  (function (ModelKind) {
17345
- ModelKind["Classifier"] = "Classifier";
17346
17973
  ModelKind["Extractor"] = "Extractor";
17974
+ ModelKind["Classifier"] = "Classifier";
17347
17975
  })(ModelKind || (ModelKind = {}));
17348
17976
  var ModelType;
17349
17977
  (function (ModelType) {
@@ -17352,6 +17980,14 @@
17352
17980
  ModelType["Predefined"] = "Predefined";
17353
17981
  })(ModelType || (ModelType = {}));
17354
17982
 
17983
+ // Auto-generated from the OpenAPI spec — do not edit manually.
17984
+ var ErrorSeverity;
17985
+ (function (ErrorSeverity) {
17986
+ ErrorSeverity["Info"] = "Info";
17987
+ ErrorSeverity["Warning"] = "Warning";
17988
+ ErrorSeverity["Error"] = "Error";
17989
+ })(ErrorSeverity || (ErrorSeverity = {}));
17990
+
17355
17991
  // Auto-generated from the OpenAPI spec — do not edit manually.
17356
17992
  var ClassifierDocumentTypeType;
17357
17993
  (function (ClassifierDocumentTypeType) {
@@ -17376,6 +18012,13 @@
17376
18012
  GptFieldType["Number"] = "Number";
17377
18013
  GptFieldType["Text"] = "Text";
17378
18014
  })(GptFieldType || (GptFieldType = {}));
18015
+ var JobStatus;
18016
+ (function (JobStatus) {
18017
+ JobStatus["Succeeded"] = "Succeeded";
18018
+ JobStatus["Failed"] = "Failed";
18019
+ JobStatus["Running"] = "Running";
18020
+ JobStatus["NotStarted"] = "NotStarted";
18021
+ })(JobStatus || (JobStatus = {}));
17379
18022
  var ValidationDisplayMode;
17380
18023
  (function (ValidationDisplayMode) {
17381
18024
  ValidationDisplayMode["Classic"] = "Classic";
@@ -17462,8 +18105,10 @@
17462
18105
  get DocumentActionPriority () { return DocumentActionPriority; },
17463
18106
  get DocumentActionStatus () { return DocumentActionStatus; },
17464
18107
  get DocumentActionType () { return DocumentActionType; },
18108
+ get ErrorSeverity () { return ErrorSeverity; },
17465
18109
  get FieldType () { return FieldType; },
17466
18110
  get GptFieldType () { return GptFieldType; },
18111
+ get JobStatus () { return JobStatus; },
17467
18112
  get LogicalOperator () { return LogicalOperator; },
17468
18113
  get MarkupType () { return MarkupType; },
17469
18114
  get ModelKind () { return ModelKind; },
@@ -17557,17 +18202,10 @@
17557
18202
  return getMetaTagContent(exports.UiPathMetaTags.APP_BASE) || '/';
17558
18203
  }
17559
18204
 
17560
- exports.APP_NAME = APP_NAME;
17561
18205
  exports.AgentMap = AgentMap;
17562
18206
  exports.AuthenticationError = AuthenticationError;
17563
18207
  exports.AuthorizationError = AuthorizationError;
17564
- exports.CLOUD_CLIENT_ID = CLOUD_CLIENT_ID;
17565
- exports.CLOUD_ORGANIZATION_NAME = CLOUD_ORGANIZATION_NAME;
17566
- exports.CLOUD_REDIRECT_URI = CLOUD_REDIRECT_URI;
17567
- exports.CLOUD_ROLE_NAME = CLOUD_ROLE_NAME;
17568
- exports.CLOUD_TENANT_NAME = CLOUD_TENANT_NAME;
17569
- exports.CLOUD_URL = CLOUD_URL;
17570
- exports.CONNECTION_STRING = CONNECTION_STRING;
18208
+ exports.ConversationGetAllFilterMap = ConversationGetAllFilterMap;
17571
18209
  exports.ConversationMap = ConversationMap;
17572
18210
  exports.DEFAULT_ITEMS_FIELD = DEFAULT_ITEMS_FIELD;
17573
18211
  exports.DEFAULT_PAGE_SIZE = DEFAULT_PAGE_SIZE;
@@ -17581,17 +18219,10 @@
17581
18219
  exports.NetworkError = NetworkError;
17582
18220
  exports.NotFoundError = NotFoundError;
17583
18221
  exports.RateLimitError = RateLimitError;
17584
- exports.SDK_LOGGER_NAME = SDK_LOGGER_NAME;
17585
- exports.SDK_RUN_EVENT = SDK_RUN_EVENT;
17586
- exports.SDK_SERVICE_NAME = SDK_SERVICE_NAME;
17587
- exports.SDK_VERSION = SDK_VERSION;
17588
- exports.SERVICE = SERVICE;
17589
18222
  exports.ServerError = ServerError;
17590
- exports.UNKNOWN = UNKNOWN$1;
17591
18223
  exports.UiPath = UiPath;
17592
18224
  exports.UiPathError = UiPathError;
17593
18225
  exports.UserSettingsMap = UserSettingsMap;
17594
- exports.VERSION = VERSION;
17595
18226
  exports.ValidationError = ValidationError;
17596
18227
  exports.createAgentWithMethods = createAgentWithMethods;
17597
18228
  exports.createCaseInstanceWithMethods = createCaseInstanceWithMethods;