@uipath/uipath-typescript 1.3.8 → 1.3.10

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 (41) hide show
  1. package/dist/assets/index.cjs +44 -276
  2. package/dist/assets/index.mjs +44 -276
  3. package/dist/attachments/index.cjs +42 -273
  4. package/dist/attachments/index.mjs +42 -273
  5. package/dist/buckets/index.cjs +195 -276
  6. package/dist/buckets/index.d.ts +213 -1
  7. package/dist/buckets/index.mjs +195 -276
  8. package/dist/cases/index.cjs +427 -343
  9. package/dist/cases/index.d.ts +534 -2
  10. package/dist/cases/index.mjs +428 -344
  11. package/dist/conversational-agent/index.cjs +90 -287
  12. package/dist/conversational-agent/index.d.ts +62 -12
  13. package/dist/conversational-agent/index.mjs +90 -288
  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 +251 -277
  21. package/dist/entities/index.d.ts +305 -2
  22. package/dist/entities/index.mjs +251 -277
  23. package/dist/feedback/index.cjs +42 -274
  24. package/dist/feedback/index.mjs +42 -274
  25. package/dist/index.cjs +998 -351
  26. package/dist/index.d.ts +2159 -762
  27. package/dist/index.mjs +998 -337
  28. package/dist/index.umd.js +1208 -237
  29. package/dist/jobs/index.cjs +44 -276
  30. package/dist/jobs/index.mjs +44 -276
  31. package/dist/maestro-processes/index.cjs +1761 -1717
  32. package/dist/maestro-processes/index.d.ts +430 -2
  33. package/dist/maestro-processes/index.mjs +1762 -1718
  34. package/dist/processes/index.cjs +72 -305
  35. package/dist/processes/index.d.ts +76 -26
  36. package/dist/processes/index.mjs +72 -305
  37. package/dist/queues/index.cjs +44 -276
  38. package/dist/queues/index.mjs +44 -276
  39. package/dist/tasks/index.cjs +44 -276
  40. package/dist/tasks/index.mjs +44 -276
  41. package/package.json +8 -10
package/dist/index.umd.js CHANGED
@@ -4516,6 +4516,8 @@
4516
4516
  GET_FILE_META_DATA: (id) => `${ORCHESTRATOR_BASE}/api/Buckets/${id}/ListFiles`,
4517
4517
  GET_READ_URI: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.GetReadUri`,
4518
4518
  GET_WRITE_URI: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.GetWriteUri`,
4519
+ DELETE_FILE: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.DeleteFile`,
4520
+ GET_FILES: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.GetFiles`,
4519
4521
  };
4520
4522
  /**
4521
4523
  * Orchestrator Process Service Endpoints
@@ -4592,6 +4594,16 @@
4592
4594
  INSIGHTS: {
4593
4595
  /** SLA summary for case instances */
4594
4596
  SLA_SUMMARY: `${INSIGHTS_RTM_BASE}/caseManagement/slaSummary`,
4597
+ /** Stages summary for case instances */
4598
+ STAGES_SUMMARY: `${INSIGHTS_RTM_BASE}/caseManagement/stages`,
4599
+ /** Top processes ranked by run count */
4600
+ TOP_PROCESSES_BY_RUN_COUNT: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByRunCount`,
4601
+ /** Top processes ranked by failure count */
4602
+ TOP_PROCESSES_WITH_FAILURE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcesseswithFailure`,
4603
+ /** Instance status aggregated by date for time-series charts */
4604
+ INSTANCE_STATUS_BY_DATE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/InstanceStatusByDate`,
4605
+ /** Top processes ranked by total duration */
4606
+ TOP_PROCESSES_BY_DURATION: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByDuration`,
4595
4607
  },
4596
4608
  };
4597
4609
 
@@ -4631,6 +4643,12 @@
4631
4643
  CHOICESETS: {
4632
4644
  GET_ALL: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
4633
4645
  GET_BY_ID: (choiceSetId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${choiceSetId}/query_expansion`,
4646
+ CREATE: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
4647
+ UPDATE: (choiceSetId) => `${DATAFABRIC_BASE}/api/Entity/${choiceSetId}/metadata`,
4648
+ DELETE: (choiceSetId) => `${DATAFABRIC_BASE}/api/Entity/${choiceSetId}/delete`,
4649
+ INSERT_BY_NAME: (choiceSetName) => `${DATAFABRIC_BASE}/api/EntityService/${choiceSetName}/choiceset/insert`,
4650
+ UPDATE_BY_NAME: (choiceSetName, valueId) => `${DATAFABRIC_BASE}/api/EntityService/${choiceSetName}/choiceset/${valueId}/update`,
4651
+ DELETE_BY_ID: (choiceSetId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${choiceSetId}/choiceset/delete`,
4634
4652
  },
4635
4653
  };
4636
4654
 
@@ -9221,54 +9239,56 @@
9221
9239
  }
9222
9240
 
9223
9241
  /**
9224
- * SDK Telemetry constants
9242
+ * Common telemetry attribute keys + Application Insights connection string.
9243
+ *
9244
+ * Producer-specific identity (SDK version, role name, etc.) is supplied at
9245
+ * runtime via `TelemetryClient.initialize(...)` so the same package can be
9246
+ * reused by multiple packages. The Application Insights connection string is
9247
+ * shared across all consumers and is patched into this file at publish time.
9225
9248
  */
9226
9249
  // 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 = "";
9250
+ const CONNECTION_STRING = '$CONNECTION_STRING';
9251
+ const VERSION = 'Version';
9252
+ const SERVICE = 'Service';
9253
+ const CLOUD_ORGANIZATION_NAME = 'CloudOrganizationName';
9254
+ const CLOUD_TENANT_NAME = 'CloudTenantName';
9255
+ const CLOUD_URL = 'CloudUrl';
9256
+ const CLOUD_CLIENT_ID = 'CloudClientId';
9257
+ const CLOUD_REDIRECT_URI = 'CloudRedirectUri';
9258
+ const APP_NAME = 'ApplicationName';
9259
+ /** Default value used when an attribute has no resolved value. */
9260
+ const UNKNOWN$1 = '';
9246
9261
 
9262
+ const INSTRUMENTATION_KEY_RE = /InstrumentationKey=([^;]+)/;
9263
+ const INGESTION_ENDPOINT_RE = /IngestionEndpoint=([^;]+)/;
9247
9264
  /**
9248
- * Log exporter that sends ALL logs as Application Insights custom events
9265
+ * Sends every emitted log record as an Application Insights custom event.
9266
+ * Plugged into OpenTelemetry's `BatchLogRecordProcessor`, which buffers and
9267
+ * flushes log records to this exporter on its own schedule.
9249
9268
  */
9250
9269
  class ApplicationInsightsEventExporter {
9251
- constructor(connectionString) {
9270
+ constructor(connectionString, tags) {
9252
9271
  this.connectionString = connectionString;
9272
+ this.tags = tags;
9253
9273
  }
9254
9274
  export(logs, resultCallback) {
9255
9275
  try {
9256
- logs.forEach(logRecord => {
9257
- this.sendAsCustomEvent(logRecord);
9258
- });
9276
+ for (const log of logs) {
9277
+ this.sendAsCustomEvent(log);
9278
+ }
9259
9279
  resultCallback({ code: 0 });
9260
9280
  }
9261
9281
  catch (error) {
9262
- console.debug('Failed to export logs to Application Insights:', error);
9263
- resultCallback({ code: 2, error });
9282
+ const err = error instanceof Error ? error : new Error(String(error));
9283
+ console.debug('Failed to export logs to Application Insights:', err);
9284
+ resultCallback({ code: 1, error: err });
9264
9285
  }
9265
9286
  }
9266
9287
  shutdown() {
9267
9288
  return Promise.resolve();
9268
9289
  }
9269
9290
  sendAsCustomEvent(logRecord) {
9270
- // Get event name from body or attributes
9271
- const eventName = logRecord.body || SDK_RUN_EVENT;
9291
+ const eventName = String(logRecord.body);
9272
9292
  const payload = {
9273
9293
  name: 'Microsoft.ApplicationInsights.Event',
9274
9294
  time: new Date().toISOString(),
@@ -9278,25 +9298,25 @@
9278
9298
  baseData: {
9279
9299
  ver: 2,
9280
9300
  name: eventName,
9281
- properties: this.convertAttributesToProperties(logRecord.attributes || {})
9282
- }
9301
+ properties: this.convertAttributesToProperties(logRecord.attributes),
9302
+ },
9283
9303
  },
9284
9304
  tags: {
9285
- 'ai.cloud.role': CLOUD_ROLE_NAME,
9286
- 'ai.cloud.roleInstance': SDK_VERSION
9287
- }
9305
+ 'ai.cloud.role': this.tags.cloudRoleName,
9306
+ 'ai.cloud.roleInstance': this.tags.cloudRoleInstance,
9307
+ },
9288
9308
  };
9289
- this.sendToApplicationInsights(payload);
9309
+ void this.sendToApplicationInsights(payload);
9290
9310
  }
9291
9311
  extractInstrumentationKey() {
9292
- const match = this.connectionString.match(/InstrumentationKey=([^;]+)/);
9312
+ const match = INSTRUMENTATION_KEY_RE.exec(this.connectionString);
9293
9313
  return match ? match[1] : '';
9294
9314
  }
9295
9315
  convertAttributesToProperties(attributes) {
9296
9316
  const properties = {};
9297
- Object.entries(attributes || {}).forEach(([key, value]) => {
9317
+ for (const [key, value] of Object.entries(attributes ?? {})) {
9298
9318
  properties[key] = String(value);
9299
- });
9319
+ }
9300
9320
  return properties;
9301
9321
  }
9302
9322
  async sendToApplicationInsights(payload) {
@@ -9309,10 +9329,8 @@
9309
9329
  const url = `${ingestionEndpoint}/v2/track`;
9310
9330
  const response = await fetch(url, {
9311
9331
  method: 'POST',
9312
- headers: {
9313
- 'Content-Type': 'application/json',
9314
- },
9315
- body: JSON.stringify(payload)
9332
+ headers: { 'Content-Type': 'application/json' },
9333
+ body: JSON.stringify(payload),
9316
9334
  });
9317
9335
  if (!response.ok) {
9318
9336
  console.debug(`Failed to send event telemetry: ${response.status} ${response.statusText}`);
@@ -9323,101 +9341,102 @@
9323
9341
  }
9324
9342
  }
9325
9343
  extractIngestionEndpoint() {
9326
- const match = this.connectionString.match(/IngestionEndpoint=([^;]+)/);
9344
+ const match = INGESTION_ENDPOINT_RE.exec(this.connectionString);
9327
9345
  return match ? match[1] : '';
9328
9346
  }
9329
9347
  }
9330
9348
  /**
9331
- * Singleton telemetry client
9349
+ * Telemetry client owned by a single consumer (e.g. the SDK or the Coded
9350
+ * Action Apps package). Each consumer instantiates its own client so that
9351
+ * its identity (`cloudRoleName`, `serviceName`, `sdkVersion`, …) and tenant
9352
+ * context flow through to its own `Logger` and exporter pipeline. Two
9353
+ * consumers running in the same process emit independent events — they
9354
+ * share the Application Insights connection string but nothing else.
9355
+ *
9356
+ * Records are emitted via `Logger.emit` and batched by
9357
+ * `BatchLogRecordProcessor` before being handed to the Application Insights
9358
+ * exporter.
9332
9359
  */
9333
9360
  class TelemetryClient {
9334
9361
  constructor() {
9335
9362
  this.isInitialized = false;
9336
9363
  }
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) {
9364
+ initialize(options) {
9347
9365
  if (this.isInitialized) {
9366
+ console.debug('Telemetry client has already been initialized');
9348
9367
  return;
9349
9368
  }
9350
9369
  this.isInitialized = true;
9351
- if (config) {
9352
- this.telemetryContext = config;
9353
- }
9370
+ this.options = options;
9371
+ this.telemetryContext = options.context;
9354
9372
  try {
9355
- const connectionString = this.getConnectionString();
9356
- if (!connectionString) {
9373
+ if (!this.isValidConnectionString(CONNECTION_STRING)) {
9357
9374
  return;
9358
9375
  }
9359
- this.setupTelemetryProvider(connectionString);
9376
+ this.setupTelemetryProvider(CONNECTION_STRING);
9360
9377
  }
9361
9378
  catch (error) {
9362
- // Silent failure - telemetry errors shouldn't break functionality
9363
- console.debug('Failed to initialize OpenTelemetry:', error);
9379
+ console.debug('Failed to initialize telemetry:', error);
9364
9380
  }
9365
9381
  }
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
9382
  track(eventName, name, extraAttributes = {}) {
9382
9383
  try {
9383
- // Skip if logger not initialized
9384
9384
  if (!this.logger) {
9385
9385
  return;
9386
9386
  }
9387
- const finalDisplayName = name || eventName;
9387
+ const finalDisplayName = name ?? eventName;
9388
9388
  const attributes = this.getEnrichedAttributes(extraAttributes, eventName);
9389
- // Emit as log
9390
9389
  this.logger.emit({
9391
9390
  body: finalDisplayName,
9392
- attributes: attributes,
9391
+ attributes,
9393
9392
  timestamp: Date.now(),
9394
9393
  });
9395
9394
  }
9396
9395
  catch (error) {
9397
- // Silent failure
9398
9396
  console.debug('Failed to track telemetry event:', error);
9399
9397
  }
9400
9398
  }
9401
9399
  /**
9402
- * Get enriched attributes for telemetry events
9400
+ * Default event name (e.g. `Sdk.Run`) used when a tracker fires without
9401
+ * an explicit display name. Returns `undefined` until `initialize` runs.
9403
9402
  */
9403
+ getDefaultEventName() {
9404
+ return this.options?.defaultEventName;
9405
+ }
9406
+ setupTelemetryProvider(connectionString) {
9407
+ // `setupTelemetryProvider` is only called from `initialize` after
9408
+ // `this.options` has been assigned, so the non-null assertion is safe.
9409
+ const opts = this.options;
9410
+ const exporter = new ApplicationInsightsEventExporter(connectionString, {
9411
+ cloudRoleName: opts.cloudRoleName,
9412
+ cloudRoleInstance: opts.sdkVersion,
9413
+ });
9414
+ const processor = new BatchLogRecordProcessor(exporter);
9415
+ this.logProvider = new LoggerProvider({
9416
+ processors: [processor],
9417
+ });
9418
+ this.logger = this.logProvider.getLogger(opts.loggerName);
9419
+ }
9420
+ isValidConnectionString(connectionString) {
9421
+ // Build placeholders are emitted as `$CONNECTION_STRING` literally
9422
+ // until the publish workflow patches them. Treat any unsubstituted
9423
+ // placeholder as "no connection string available".
9424
+ return Boolean(connectionString) && !connectionString.startsWith('$');
9425
+ }
9404
9426
  getEnrichedAttributes(extraAttributes, eventName) {
9405
- const attributes = {
9406
- [APP_NAME]: SDK_SERVICE_NAME,
9407
- [VERSION]: SDK_VERSION,
9427
+ const opts = this.options;
9428
+ return {
9429
+ [APP_NAME]: opts?.serviceName ?? UNKNOWN$1,
9430
+ [VERSION]: opts?.sdkVersion ?? UNKNOWN$1,
9408
9431
  [SERVICE]: eventName,
9409
9432
  [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,
9433
+ [CLOUD_ORGANIZATION_NAME]: this.telemetryContext?.orgName ?? UNKNOWN$1,
9434
+ [CLOUD_TENANT_NAME]: this.telemetryContext?.tenantName ?? UNKNOWN$1,
9435
+ [CLOUD_REDIRECT_URI]: this.telemetryContext?.redirectUri ?? UNKNOWN$1,
9436
+ [CLOUD_CLIENT_ID]: this.telemetryContext?.clientId ?? UNKNOWN$1,
9414
9437
  ...extraAttributes,
9415
9438
  };
9416
- return attributes;
9417
9439
  }
9418
- /**
9419
- * Create cloud URL from base URL, organization ID, and tenant ID
9420
- */
9421
9440
  createCloudUrl() {
9422
9441
  const baseUrl = this.telemetryContext?.baseUrl;
9423
9442
  const orgId = this.telemetryContext?.orgName;
@@ -9428,78 +9447,166 @@
9428
9447
  return `${baseUrl}/${orgId}/${tenantId}`;
9429
9448
  }
9430
9449
  }
9431
- // Export singleton instance
9432
- const telemetryClient = TelemetryClient.getInstance();
9433
9450
 
9434
9451
  /**
9435
- * SDK Track decorator and function for telemetry
9452
+ * Each consumer ships as multiple subpath bundles and Rollup inlines this
9453
+ * shim into every one — `new TelemetryClient()` would hand each bundle its
9454
+ * own (uninitialized) client. `getOrCreateClient(name)` instead parks the
9455
+ * client on `globalThis` so every bundle shares one client per name.
9456
+ */
9457
+ const REGISTRY_KEY$1 = Symbol.for('@uipath/core-telemetry/clients');
9458
+ function getGlobalRegistry() {
9459
+ const holder = globalThis;
9460
+ let registry = holder[REGISTRY_KEY$1];
9461
+ if (!registry) {
9462
+ registry = {};
9463
+ holder[REGISTRY_KEY$1] = registry;
9464
+ }
9465
+ return registry;
9466
+ }
9467
+ /**
9468
+ * Returns the named `TelemetryClient`, creating it on first access.
9469
+ *
9470
+ * @param name Stable identifier for the consumer (e.g. `"uipath-ts-sdk"`,
9471
+ * `"uipath-ts-coded-action-apps"`). Subpath bundles within the same
9472
+ * consumer share a client by passing the same name.
9436
9473
  */
9474
+ function getOrCreateClient(name) {
9475
+ const registry = getGlobalRegistry();
9476
+ if (!registry[name]) {
9477
+ registry[name] = new TelemetryClient();
9478
+ }
9479
+ return registry[name];
9480
+ }
9481
+
9437
9482
  /**
9438
- * Common tracking logic shared between method and function decorators
9483
+ * `@track` decorator and `trackEvent` function factories.
9439
9484
  */
9440
- function createTrackedFunction(originalFunction, nameOrOptions, fallbackName, opts) {
9441
- return function (...args) {
9442
- // Determine if we should track this call
9485
+ function createTrackedFunction(originalFunction, { client, nameOrOptions, fallbackName, opts }) {
9486
+ const wrapped = function (...args) {
9443
9487
  let shouldTrack = true;
9444
9488
  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
- }
9489
+ shouldTrack =
9490
+ typeof opts.condition === 'function'
9491
+ ? opts.condition.apply(this, args)
9492
+ : opts.condition;
9451
9493
  }
9452
- // Track the event if enabled
9453
9494
  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
9495
+ const serviceMethod = typeof nameOrOptions === 'string' ? nameOrOptions : fallbackName;
9496
+ client.track(serviceMethod, client.getDefaultEventName(), opts.attributes);
9497
+ }
9462
9498
  return originalFunction.apply(this, args);
9463
9499
  };
9500
+ return wrapped;
9464
9501
  }
9465
9502
  /**
9466
- * Track decorator that can be used to automatically track function calls
9503
+ * Factory: returns a `track` decorator bound to a specific
9504
+ * `TelemetryClient`. Each consumer creates its own decorator from its own
9505
+ * client so events carry that consumer's identity.
9467
9506
  *
9468
- * Usage:
9469
- * @track("Service.Method")
9470
- * function myFunction() { ... }
9507
+ * @example
9508
+ * ```ts
9509
+ * const sdkClient = new TelemetryClient();
9510
+ * sdkClient.initialize({ ... });
9511
+ * export const track = createTrack(sdkClient);
9471
9512
  *
9472
- * @track("Queue.GetAll")
9513
+ * // Consumer code
9514
+ * @track('Queue.GetAll')
9473
9515
  * async getAll() { ... }
9474
9516
  *
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() { ... }
9517
+ * @track('Assets.Update', { condition: false })
9518
+ * async update() { ... }
9519
+ * ```
9483
9520
  */
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;
9521
+ function createTrack(client) {
9522
+ function trackFactory(nameOrOptions, options) {
9523
+ const opts = typeof nameOrOptions === 'object' ? nameOrOptions : options ?? {};
9524
+ function decoratorImpl(target, propertyKey, descriptor) {
9525
+ if (descriptor && typeof descriptor.value === 'function') {
9526
+ const original = descriptor.value;
9527
+ descriptor.value = createTrackedFunction(original, {
9528
+ client,
9529
+ nameOrOptions,
9530
+ fallbackName: typeof propertyKey === 'string'
9531
+ ? propertyKey
9532
+ : 'unknown_method',
9533
+ opts,
9534
+ });
9535
+ return descriptor;
9536
+ }
9537
+ const fn = target;
9538
+ return createTrackedFunction(fn, {
9539
+ client,
9540
+ nameOrOptions,
9541
+ fallbackName: fn.name || 'unknown_function',
9542
+ opts,
9543
+ });
9491
9544
  }
9492
- // Function decorator
9493
- return (originalFunction) => createTrackedFunction(originalFunction, nameOrOptions, originalFunction.name || 'unknown_function', opts);
9494
- };
9545
+ return decoratorImpl;
9546
+ }
9547
+ return trackFactory;
9495
9548
  }
9496
9549
  /**
9497
- * Direct tracking function
9550
+ * Factory: returns a `trackEvent` function bound to a specific
9551
+ * `TelemetryClient`. Use for ad-hoc tracking outside method boundaries.
9552
+ *
9553
+ * @example
9554
+ * ```ts
9555
+ * const trackEvent = createTrackEvent(sdkClient);
9556
+ * trackEvent('Sdk.Auth');
9557
+ * ```
9498
9558
  */
9499
- function trackEvent(eventName, name, attributes) {
9500
- telemetryClient.track(eventName, name, attributes);
9559
+ function createTrackEvent(client) {
9560
+ return function trackEvent(eventName, name, attributes) {
9561
+ client.track(eventName, name, attributes);
9562
+ };
9501
9563
  }
9502
9564
 
9565
+ /**
9566
+ * SDK Telemetry constants.
9567
+ *
9568
+ * Only the SDK's identity (version, service name, role name, …) lives
9569
+ * here. The Application Insights connection string is injected into
9570
+ * `@uipath/core-telemetry` itself at publish time, and the generic attribute
9571
+ * keys (`Version`, `Service`, `CloudOrganizationName`, …) are owned by
9572
+ * `@uipath/core-telemetry` and consumed there — they are not part of the
9573
+ * SDK's public API.
9574
+ */
9575
+ /** SDK version placeholder — patched by the SDK publish workflow. */
9576
+ const SDK_VERSION = '1.3.10';
9577
+ const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
9578
+ const SDK_SERVICE_NAME = 'UiPath.TypeScript.Sdk';
9579
+ const SDK_LOGGER_NAME = 'uipath-ts-sdk-telemetry';
9580
+ const SDK_RUN_EVENT = 'Sdk.Run';
9581
+
9582
+ /**
9583
+ * UiPath TypeScript SDK Telemetry
9584
+ *
9585
+ * Constructs the SDK's own `TelemetryClient` and binds the SDK-local
9586
+ * `track` / `trackEvent` to it. Each consumer of `@uipath/core-telemetry`
9587
+ * does this independently, so events carry their own consumer's identity
9588
+ * and tenant context.
9589
+ */
9590
+ // Keyed by `CLOUD_ROLE_NAME` so every SDK subpath bundle resolves to the
9591
+ // same `TelemetryClient` instance at runtime. A single `initialize(...)`
9592
+ // from the `UiPath` constructor therefore wires up `@track` decorators
9593
+ // across every subpath bundle (`assets`, `feedback`, `tasks`, …).
9594
+ const sdkClient = getOrCreateClient(CLOUD_ROLE_NAME);
9595
+ const track = createTrack(sdkClient);
9596
+ const trackEvent = createTrackEvent(sdkClient);
9597
+ const telemetryClient = {
9598
+ initialize(context) {
9599
+ sdkClient.initialize({
9600
+ sdkVersion: SDK_VERSION,
9601
+ serviceName: SDK_SERVICE_NAME,
9602
+ cloudRoleName: CLOUD_ROLE_NAME,
9603
+ loggerName: SDK_LOGGER_NAME,
9604
+ defaultEventName: SDK_RUN_EVENT,
9605
+ context,
9606
+ });
9607
+ },
9608
+ };
9609
+
9503
9610
  /**
9504
9611
  * SDK Internals Registry - Internal registry for SDK instances
9505
9612
  *
@@ -10192,14 +10299,25 @@
10192
10299
  if (!text) {
10193
10300
  return undefined;
10194
10301
  }
10195
- return JSON.parse(text);
10302
+ try {
10303
+ return JSON.parse(text);
10304
+ }
10305
+ catch (error) {
10306
+ if (error instanceof SyntaxError) {
10307
+ throw new ServerError({
10308
+ message: `Server returned non-JSON response (${response.status} ${response.url}): ${error.message}`,
10309
+ statusCode: response.status,
10310
+ });
10311
+ }
10312
+ throw error;
10313
+ }
10196
10314
  }
10197
10315
  catch (error) {
10198
10316
  // If it's already one of our errors, re-throw it
10199
10317
  if (error.type && error.type.includes('Error')) {
10200
10318
  throw error;
10201
10319
  }
10202
- // Otherwise, it's likely a network error
10320
+ // Otherwise, it's a genuine network/fetch failure
10203
10321
  throw ErrorFactory.createNetworkError(error);
10204
10322
  }
10205
10323
  }
@@ -11095,9 +11213,9 @@
11095
11213
  * @returns Promise resolving to a paginated result
11096
11214
  */
11097
11215
  static async getAllPaginated(params) {
11098
- const { serviceAccess, getEndpoint, folderId, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
11216
+ const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
11099
11217
  const endpoint = getEndpoint(folderId);
11100
- const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
11218
+ const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
11101
11219
  const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
11102
11220
  headers,
11103
11221
  params: additionalParams,
@@ -11125,13 +11243,13 @@
11125
11243
  * @returns Promise resolving to an object with data and totalCount
11126
11244
  */
11127
11245
  static async getAllNonPaginated(params) {
11128
- const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
11246
+ const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
11129
11247
  // Set default field names
11130
11248
  const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
11131
11249
  const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
11132
11250
  // Determine endpoint and headers based on folderId
11133
11251
  const endpoint = folderId ? getByFolderEndpoint : getAllEndpoint;
11134
- const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
11252
+ const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
11135
11253
  // Make the API call based on method
11136
11254
  let response;
11137
11255
  if (method === HTTP_METHODS.POST) {
@@ -11190,6 +11308,7 @@
11190
11308
  serviceAccess: config.serviceAccess,
11191
11309
  getEndpoint: config.getEndpoint,
11192
11310
  folderId,
11311
+ headers: config.headers,
11193
11312
  paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
11194
11313
  additionalParams: prefixedOptions,
11195
11314
  transformFn: config.transformFn,
@@ -11207,6 +11326,7 @@
11207
11326
  getAllEndpoint: config.getEndpoint(),
11208
11327
  getByFolderEndpoint: byFolderEndpoint,
11209
11328
  folderId,
11329
+ headers: config.headers,
11210
11330
  additionalParams: prefixedOptions,
11211
11331
  transformFn: config.transformFn,
11212
11332
  method: config.method,
@@ -12994,7 +13114,7 @@
12994
13114
  *
12995
13115
  * @example
12996
13116
  * ```typescript
12997
- * import { ChoiceSets } from '@uipath/uipath-typescript/choicesets';
13117
+ * import { ChoiceSets } from '@uipath/uipath-typescript/entities';
12998
13118
  *
12999
13119
  * const choiceSets = new ChoiceSets(sdk);
13000
13120
  *
@@ -13043,6 +13163,188 @@
13043
13163
  }
13044
13164
  }, options);
13045
13165
  }
13166
+ /**
13167
+ * Creates a new Data Fabric choice set
13168
+ *
13169
+ * @param name - Choice set name. Must start with a
13170
+ * letter, may contain only letters, numbers, and underscores, length
13171
+ * 3–100 characters (e.g., `"expenseTypes"`).
13172
+ * @param options - Optional choice-set-level settings ({@link ChoiceSetCreateOptions})
13173
+ * @returns Promise resolving to the UUID of the created choice set
13174
+ *
13175
+ * @example
13176
+ * ```typescript
13177
+ * import { ChoiceSets } from '@uipath/uipath-typescript/entities';
13178
+ *
13179
+ * const choicesets = new ChoiceSets(sdk);
13180
+ *
13181
+ * // Minimal create
13182
+ * const expenseTypesId = await choicesets.create("expense_types");
13183
+ *
13184
+ * // With display name and description
13185
+ * const priorityLevelsId = await choicesets.create("priority_levels", {
13186
+ * displayName: "Priority Levels",
13187
+ * description: "Ticket priority categories",
13188
+ * });
13189
+ * ```
13190
+ * @internal
13191
+ */
13192
+ async create(name, options) {
13193
+ const opts = options ?? {};
13194
+ const payload = {
13195
+ ...(opts.description !== undefined && { description: opts.description }),
13196
+ ...(opts.displayName !== undefined && { displayName: opts.displayName }),
13197
+ entityDefinition: {
13198
+ name,
13199
+ fields: [],
13200
+ folderId: opts.folderKey ?? DATA_FABRIC_TENANT_FOLDER_ID,
13201
+ },
13202
+ };
13203
+ const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.CREATE, payload);
13204
+ return response.data;
13205
+ }
13206
+ /**
13207
+ * Updates an existing choice set's metadata (display name and/or description).
13208
+ *
13209
+ * **At least one of `displayName` or `description` must be provided** —
13210
+ * the call throws `ValidationError` if both are omitted.
13211
+ *
13212
+ * @param choiceSetId - UUID of the choice set to update
13213
+ * @param options - Metadata fields to change ({@link ChoiceSetUpdateOptions})
13214
+ * @returns Promise resolving when the update is complete
13215
+ *
13216
+ * @example
13217
+ * ```typescript
13218
+ * // First, get the choice set ID using getAll()
13219
+ * const allChoiceSets = await choicesets.getAll();
13220
+ * const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
13221
+ *
13222
+ * await choicesets.updateById(expenseTypes.id, {
13223
+ * displayName: "Expense Categories",
13224
+ * description: "Updated description",
13225
+ * });
13226
+ * ```
13227
+ * @internal
13228
+ */
13229
+ async updateById(choiceSetId, options) {
13230
+ if (options.displayName === undefined && options.description === undefined) {
13231
+ throw new ValidationError({
13232
+ message: 'updateById requires at least one of displayName or description.',
13233
+ });
13234
+ }
13235
+ await this.patch(DATA_FABRIC_ENDPOINTS.CHOICESETS.UPDATE(choiceSetId), {
13236
+ ...(options.displayName !== undefined && { displayName: options.displayName }),
13237
+ ...(options.description !== undefined && { description: options.description }),
13238
+ });
13239
+ }
13240
+ /**
13241
+ * Deletes a Data Fabric choice set and all its values.
13242
+ *
13243
+ * @param choiceSetId - UUID of the choice set to delete
13244
+ * @returns Promise resolving when the choice set is deleted
13245
+ *
13246
+ * @example
13247
+ * ```typescript
13248
+ * // First, get the choice set ID using getAll()
13249
+ * const allChoiceSets = await choicesets.getAll();
13250
+ * const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
13251
+ *
13252
+ * await choicesets.deleteById(expenseTypes.id);
13253
+ * ```
13254
+ * @internal
13255
+ */
13256
+ async deleteById(choiceSetId) {
13257
+ await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.DELETE(choiceSetId), {});
13258
+ }
13259
+ /**
13260
+ * Inserts a single value into a choice set.
13261
+ *
13262
+ * @param choiceSetId - UUID of the parent choice set
13263
+ * @param name - Identifier name of the new value (e.g., `"TRAVEL"`)
13264
+ * @param options - Optional fields ({@link ChoiceSetValueInsertOptions})
13265
+ * @returns Promise resolving to the inserted value ({@link ChoiceSetValueInsertResponse})
13266
+ *
13267
+ * @example
13268
+ * ```typescript
13269
+ * // First, get the choice set ID using getAll()
13270
+ * const allChoiceSets = await choicesets.getAll();
13271
+ * const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
13272
+ *
13273
+ * const inserted = await choicesets.insertValueById(expenseTypes.id, 'TRAVEL', {
13274
+ * displayName: 'Travel',
13275
+ * });
13276
+ * console.log(inserted.id);
13277
+ * ```
13278
+ * @internal
13279
+ */
13280
+ async insertValueById(choiceSetId, name, options) {
13281
+ const choiceSetName = await this.resolveChoiceSetName(choiceSetId);
13282
+ const payload = {
13283
+ Name: name,
13284
+ ...(options?.displayName !== undefined && { DisplayName: options.displayName }),
13285
+ };
13286
+ const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.INSERT_BY_NAME(choiceSetName), payload);
13287
+ const camelCased = pascalToCamelCaseKeys(response.data);
13288
+ return transformData(camelCased, EntityMap);
13289
+ }
13290
+ /**
13291
+ * Updates an existing choice-set value's display name.
13292
+ *
13293
+ * Only `displayName` is mutable; the value's `name` (identifier) is fixed at
13294
+ * insert time and cannot be changed.
13295
+ *
13296
+ * @param choiceSetId - UUID of the parent choice set
13297
+ * @param valueId - UUID of the value to update
13298
+ * @param displayName - New human-readable display name for the value
13299
+ * @returns Promise resolving to the updated value ({@link ChoiceSetValueUpdateResponse})
13300
+ *
13301
+ * @example
13302
+ * ```typescript
13303
+ * // Get the choice set ID from getAll() and the value ID from getById()
13304
+ * const allChoiceSets = await choicesets.getAll();
13305
+ * const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
13306
+ * const values = await choicesets.getById(expenseTypes.id);
13307
+ * const travel = values.items.find(v => v.name === 'TRAVEL');
13308
+ *
13309
+ * await choicesets.updateValueById(expenseTypes.id, travel.id, 'Business Travel');
13310
+ * ```
13311
+ * @internal
13312
+ */
13313
+ async updateValueById(choiceSetId, valueId, displayName) {
13314
+ const choiceSetName = await this.resolveChoiceSetName(choiceSetId);
13315
+ const payload = { DisplayName: displayName };
13316
+ const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.UPDATE_BY_NAME(choiceSetName, valueId), payload);
13317
+ const camelCased = pascalToCamelCaseKeys(response.data);
13318
+ return transformData(camelCased, EntityMap);
13319
+ }
13320
+ /**
13321
+ * Deletes one or more values from a choice set.
13322
+ *
13323
+ * @param choiceSetId - UUID of the parent choice set
13324
+ * @param valueIds - Array of value UUIDs to delete
13325
+ * @returns Promise resolving when the values are deleted
13326
+ *
13327
+ * @example
13328
+ * ```typescript
13329
+ * // Get the value IDs from getById()
13330
+ * const values = await choicesets.getById('<choiceSetId>');
13331
+ * const idsToDelete = values.items.slice(0, 2).map(v => v.id);
13332
+ *
13333
+ * await choicesets.deleteValuesById('<choiceSetId>', idsToDelete);
13334
+ * ```
13335
+ * @internal
13336
+ */
13337
+ async deleteValuesById(choiceSetId, valueIds) {
13338
+ await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.DELETE_BY_ID(choiceSetId), valueIds);
13339
+ }
13340
+ async resolveChoiceSetName(choiceSetId) {
13341
+ const all = await this.getAll();
13342
+ const match = all.find(cs => cs.id === choiceSetId);
13343
+ if (!match) {
13344
+ throw new NotFoundError({ message: `Choice set with id '${choiceSetId}' not found.` });
13345
+ }
13346
+ return match.name;
13347
+ }
13046
13348
  }
13047
13349
  __decorate([
13048
13350
  track('Choicesets.GetAll')
@@ -13050,6 +13352,24 @@
13050
13352
  __decorate([
13051
13353
  track('Choicesets.GetById')
13052
13354
  ], ChoiceSetService.prototype, "getById", null);
13355
+ __decorate([
13356
+ track('Choicesets.Create')
13357
+ ], ChoiceSetService.prototype, "create", null);
13358
+ __decorate([
13359
+ track('Choicesets.UpdateById')
13360
+ ], ChoiceSetService.prototype, "updateById", null);
13361
+ __decorate([
13362
+ track('Choicesets.DeleteById')
13363
+ ], ChoiceSetService.prototype, "deleteById", null);
13364
+ __decorate([
13365
+ track('Choicesets.InsertValueById')
13366
+ ], ChoiceSetService.prototype, "insertValueById", null);
13367
+ __decorate([
13368
+ track('Choicesets.UpdateValueById')
13369
+ ], ChoiceSetService.prototype, "updateValueById", null);
13370
+ __decorate([
13371
+ track('Choicesets.DeleteValuesById')
13372
+ ], ChoiceSetService.prototype, "deleteValuesById", null);
13053
13373
 
13054
13374
  /**
13055
13375
  * Maestro Process Models
@@ -13085,6 +13405,53 @@
13085
13405
  return Object.assign({}, processData, methods);
13086
13406
  }
13087
13407
 
13408
+ /**
13409
+ * Builds the request body for Insights RTM "top" endpoints.
13410
+ *
13411
+ * @param startTime - Start of the time range to query
13412
+ * @param endTime - End of the time range to query
13413
+ * @param isCaseManagement - Whether to filter for case management processes
13414
+ * @param options - Optional filters (packageId, processKey, version)
13415
+ * @returns Request body for the Insights RTM endpoint
13416
+ * @internal
13417
+ */
13418
+ function buildInsightsTopBody(startTime, endTime, isCaseManagement, options) {
13419
+ return {
13420
+ commonParams: {
13421
+ startTime: startTime.getTime(),
13422
+ endTime: endTime.getTime(),
13423
+ isCaseManagement,
13424
+ ...(options?.packageId ? { packageId: options.packageId } : {}),
13425
+ ...(options?.processKey ? { processKey: options.processKey } : {}),
13426
+ ...(options?.version ? { version: options.version } : {}),
13427
+ }
13428
+ };
13429
+ }
13430
+ /**
13431
+ * Fetches instance status timeline from the Insights API.
13432
+ * Shared implementation used by both MaestroProcessesService and CasesService.
13433
+ *
13434
+ * @param postFn - Bound post method from a BaseService subclass
13435
+ * @param startTime - Start of the time range to query
13436
+ * @param endTime - End of the time range to query
13437
+ * @param isCaseManagement - Whether to filter for case management processes
13438
+ * @param options - Optional settings for time bucketing granularity
13439
+ * @returns Promise resolving to an array of instance status timeline entries
13440
+ * @internal
13441
+ */
13442
+ async function fetchInstanceStatusTimeline(postFn, startTime, endTime, isCaseManagement, options) {
13443
+ const response = await postFn(MAESTRO_ENDPOINTS.INSIGHTS.INSTANCE_STATUS_BY_DATE, {
13444
+ commonParams: {
13445
+ startTime: startTime.getTime(),
13446
+ endTime: endTime.getTime(),
13447
+ isCaseManagement,
13448
+ },
13449
+ timeSliceUnit: options?.groupBy,
13450
+ timezoneOffset: new Date().getTimezoneOffset() * -1,
13451
+ });
13452
+ return response.data ?? [];
13453
+ }
13454
+
13088
13455
  /**
13089
13456
  * Maps fields for Incident entities
13090
13457
  */
@@ -13461,6 +13828,11 @@
13461
13828
  if (!instanceData.instanceId)
13462
13829
  throw new Error('Case instance ID is undefined');
13463
13830
  return service.getSlaSummary({ ...options, caseInstanceId: instanceData.instanceId });
13831
+ },
13832
+ async getStagesSlaSummary() {
13833
+ if (!instanceData.instanceId)
13834
+ throw new Error('Case instance ID is undefined');
13835
+ return service.getStagesSlaSummary({ caseInstanceId: instanceData.instanceId });
13464
13836
  }
13465
13837
  };
13466
13838
  }
@@ -13476,6 +13848,40 @@
13476
13848
  return Object.assign({}, instanceData, methods);
13477
13849
  }
13478
13850
 
13851
+ /**
13852
+ * Insights Types
13853
+ * Shared types for Maestro insights analytics endpoints
13854
+ */
13855
+ /**
13856
+ * Time bucketing granularity for insights time-series queries.
13857
+ *
13858
+ * Controls how data points are grouped on the time axis.
13859
+ */
13860
+ exports.TimeInterval = void 0;
13861
+ (function (TimeInterval) {
13862
+ /** Group data points by hour */
13863
+ TimeInterval["Hour"] = "HOUR";
13864
+ /** Group data points by day */
13865
+ TimeInterval["Day"] = "DAY";
13866
+ /** Group data points by week */
13867
+ TimeInterval["Week"] = "WEEK";
13868
+ })(exports.TimeInterval || (exports.TimeInterval = {}));
13869
+ /**
13870
+ * Final instance statuses returned by the instance status timeline endpoint.
13871
+ *
13872
+ * Only includes statuses where the instance has finished execution — Completed, Faulted, or Cancelled.
13873
+ * Active statuses like Running or Paused are not included.
13874
+ */
13875
+ exports.InstanceFinalStatus = void 0;
13876
+ (function (InstanceFinalStatus) {
13877
+ /** Instance completed successfully */
13878
+ InstanceFinalStatus["Completed"] = "Completed";
13879
+ /** Instance encountered an error */
13880
+ InstanceFinalStatus["Faulted"] = "Faulted";
13881
+ /** Instance was cancelled */
13882
+ InstanceFinalStatus["Cancelled"] = "Cancelled";
13883
+ })(exports.InstanceFinalStatus || (exports.InstanceFinalStatus = {}));
13884
+
13479
13885
  /**
13480
13886
  * Maps fields for Process Instance entities to ensure consistent naming
13481
13887
  */
@@ -13851,59 +14257,242 @@
13851
14257
  // Fetch BPMN XML and add element name/type to each incident
13852
14258
  return BpmnHelpers.enrichIncidentsWithBpmnData(rawResponse.data || [], folderKey, this.processInstancesService);
13853
14259
  }
13854
- }
13855
- __decorate([
13856
- track('MaestroProcesses.GetAll')
13857
- ], MaestroProcessesService.prototype, "getAll", null);
13858
- __decorate([
13859
- track('MaestroProcesses.GetIncidents')
13860
- ], MaestroProcessesService.prototype, "getIncidents", null);
13861
-
13862
- /**
13863
- * Service class for Maestro Process Incidents
13864
- */
13865
- class ProcessIncidentsService extends BaseService {
13866
14260
  /**
13867
- * Get all process incidents across all folders
14261
+ * Get the top 5 processes ranked by run count within a time range.
13868
14262
  *
13869
- * @returns Promise resolving to array of process incident
13870
- * {@link ProcessIncidentGetAllResponse}
14263
+ * Returns an array of up to 5 processes sorted by how many times they were executed,
14264
+ * useful for identifying the most active processes in a given period.
14265
+ *
14266
+ * @param startTime - Start of the time range to query
14267
+ * @param endTime - End of the time range to query
14268
+ * @param options - Optional filters (packageId, processKey, version)
14269
+ * @returns Promise resolving to an array of {@link ProcessGetTopRunCountResponse}
13871
14270
  * @example
13872
14271
  * ```typescript
13873
- * import { ProcessIncidents } from '@uipath/uipath-typescript/maestro-processes';
14272
+ * import { MaestroProcesses } from '@uipath/uipath-typescript/maestro-processes';
13874
14273
  *
13875
- * const processIncidents = new ProcessIncidents(sdk);
13876
- * const incidents = await processIncidents.getAll();
14274
+ * const maestroProcesses = new MaestroProcesses(sdk);
13877
14275
  *
13878
- * // Access process incident information
13879
- * for (const incident of incidents) {
13880
- * console.log(`Process: ${incident.processKey}`);
13881
- * console.log(`Error: ${incident.errorMessage}`);
13882
- * console.log(`Count: ${incident.count}`);
13883
- * console.log(`First occurrence: ${incident.firstOccuranceTime}`);
14276
+ * // Get top processes by run count for the last 7 days
14277
+ * const topProcesses = await maestroProcesses.getTopRunCount(
14278
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
14279
+ * new Date()
14280
+ * );
14281
+ *
14282
+ * for (const process of topProcesses) {
14283
+ * console.log(`${process.packageId}: ${process.runCount} runs`);
13884
14284
  * }
13885
14285
  * ```
14286
+ *
14287
+ * @example
14288
+ * ```typescript
14289
+ * // Get top processes by run count for a specific package
14290
+ * const filtered = await maestroProcesses.getTopRunCount(
14291
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
14292
+ * new Date(),
14293
+ * { packageId: '<packageId>' }
14294
+ * );
14295
+ * ```
13886
14296
  */
13887
- async getAll() {
13888
- const rawResponse = await this.get(MAESTRO_ENDPOINTS.INCIDENTS.GET_ALL);
13889
- // Transform field names
13890
- const data = rawResponse.data || [];
13891
- return data.map(incident => transformData(incident, ProcessIncidentSummaryMap));
14297
+ async getTopRunCount(startTime, endTime, options) {
14298
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_RUN_COUNT, buildInsightsTopBody(startTime, endTime, false, options));
14299
+ return (data ?? []).map(process => ({ ...process, name: process.packageId }));
13892
14300
  }
13893
- }
13894
- __decorate([
13895
- track('ProcessIncidents.getAll')
13896
- ], ProcessIncidentsService.prototype, "getAll", null);
13897
-
13898
- /**
13899
- * Internal types for Maestro Cases
13900
- * These types are used internally by the cases service
13901
- */
13902
- /**
13903
- * Process type enum for filtering
13904
- */
13905
- var ProcessType;
13906
- (function (ProcessType) {
14301
+ /**
14302
+ * Get all instances status counts aggregated by date for maestro processes.
14303
+ *
14304
+ * Returns time-grouped counts of instances grouped by status (Completed, Faulted, Cancelled),
14305
+ * useful for rendering time-series charts. Use `groupBy` to control the time bucket size
14306
+ * (hour, day, or week) — defaults to day if not provided.
14307
+ *
14308
+ * @param startTime - Start of the time range to query
14309
+ * @param endTime - End of the time range to query
14310
+ * @param options - Optional settings for time bucketing granularity
14311
+ * @returns Promise resolving to an array of {@link InstanceStatusTimelineResponse}
14312
+ *
14313
+ * @example
14314
+ * ```typescript
14315
+ * // Get daily instance status for the last 7 days
14316
+ * const now = new Date();
14317
+ * const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
14318
+ * const statuses = await maestroProcesses.getInstanceStatusTimeline(sevenDaysAgo, now);
14319
+ *
14320
+ * for (const entry of statuses) {
14321
+ * console.log(`${entry.startTime} — ${entry.status}: ${entry.count}`);
14322
+ * }
14323
+ * ```
14324
+ *
14325
+ * @example
14326
+ * ```typescript
14327
+ * import { TimeInterval } from '@uipath/uipath-typescript/maestro-processes';
14328
+ *
14329
+ * // Get hourly breakdown
14330
+ * const statuses = await maestroProcesses.getInstanceStatusTimeline(startTime, endTime, {
14331
+ * groupBy: TimeInterval.Hour,
14332
+ * });
14333
+ * ```
14334
+ *
14335
+ * @example
14336
+ * ```typescript
14337
+ * // Get all-time data (from Unix epoch to now)
14338
+ * const allTime = await maestroProcesses.getInstanceStatusTimeline(new Date(0), new Date());
14339
+ * ```
14340
+ */
14341
+ async getInstanceStatusTimeline(startTime, endTime, options) {
14342
+ return fetchInstanceStatusTimeline(this.post.bind(this), startTime, endTime, false, options);
14343
+ }
14344
+ /**
14345
+ * Get the top 10 processes ranked by failure count within a time range.
14346
+ *
14347
+ * Returns an array of up to 10 processes sorted by how many instances faulted,
14348
+ * useful for identifying the most error-prone processes in a given period.
14349
+ *
14350
+ * @param startTime - Start of the time range to query
14351
+ * @param endTime - End of the time range to query
14352
+ * @param options - Optional filters (packageId, processKey, version)
14353
+ * @returns Promise resolving to an array of {@link ProcessGetTopFaultedCountResponse}
14354
+ * @example
14355
+ * ```typescript
14356
+ * import { MaestroProcesses } from '@uipath/uipath-typescript/maestro-processes';
14357
+ *
14358
+ * const maestroProcesses = new MaestroProcesses(sdk);
14359
+ *
14360
+ * // Get top processes by faulted count for the last 7 days
14361
+ * const topFailing = await maestroProcesses.getTopFaultedCount(
14362
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
14363
+ * new Date()
14364
+ * );
14365
+ *
14366
+ * for (const process of topFailing) {
14367
+ * console.log(`${process.packageId}: ${process.faultedCount} failures`);
14368
+ * }
14369
+ * ```
14370
+ *
14371
+ * @example
14372
+ * ```typescript
14373
+ * // Get top processes by faulted count for a specific package
14374
+ * const filtered = await maestroProcesses.getTopFaultedCount(
14375
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
14376
+ * new Date(),
14377
+ * { packageId: '<packageId>' }
14378
+ * );
14379
+ * ```
14380
+ */
14381
+ async getTopFaultedCount(startTime, endTime, options) {
14382
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_WITH_FAILURE, buildInsightsTopBody(startTime, endTime, false, options));
14383
+ return (data ?? []).map(item => ({
14384
+ packageId: item.packageId,
14385
+ processKey: item.processKey,
14386
+ faultedCount: item.runCount,
14387
+ name: item.packageId,
14388
+ }));
14389
+ }
14390
+ /**
14391
+ * Get the top 5 processes ranked by total duration within a time range.
14392
+ *
14393
+ * Returns an array of up to 5 processes sorted by their total execution time,
14394
+ * useful for identifying the longest-running processes in a given period.
14395
+ *
14396
+ * @param startTime - Start of the time range to query
14397
+ * @param endTime - End of the time range to query
14398
+ * @param options - Optional filters (packageId, processKey, version)
14399
+ * @returns Promise resolving to an array of {@link ProcessGetTopDurationResponse}
14400
+ * @example
14401
+ * ```typescript
14402
+ * import { MaestroProcesses } from '@uipath/uipath-typescript/maestro-processes';
14403
+ *
14404
+ * const maestroProcesses = new MaestroProcesses(sdk);
14405
+ *
14406
+ * // Get top processes by duration for the last 7 days
14407
+ * const topProcesses = await maestroProcesses.getTopExecutionDuration(
14408
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
14409
+ * new Date()
14410
+ * );
14411
+ *
14412
+ * for (const process of topProcesses) {
14413
+ * console.log(`${process.packageId}: ${process.duration}ms total`);
14414
+ * }
14415
+ * ```
14416
+ *
14417
+ * @example
14418
+ * ```typescript
14419
+ * // Get top processes by duration for a specific package
14420
+ * const filtered = await maestroProcesses.getTopExecutionDuration(
14421
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
14422
+ * new Date(),
14423
+ * { packageId: '<packageId>' }
14424
+ * );
14425
+ * ```
14426
+ */
14427
+ async getTopExecutionDuration(startTime, endTime, options) {
14428
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_DURATION, buildInsightsTopBody(startTime, endTime, false, options));
14429
+ return (data ?? []).map(process => ({ ...process, name: process.packageId }));
14430
+ }
14431
+ }
14432
+ __decorate([
14433
+ track('MaestroProcesses.GetAll')
14434
+ ], MaestroProcessesService.prototype, "getAll", null);
14435
+ __decorate([
14436
+ track('MaestroProcesses.GetIncidents')
14437
+ ], MaestroProcessesService.prototype, "getIncidents", null);
14438
+ __decorate([
14439
+ track('MaestroProcesses.GetTopRunCount')
14440
+ ], MaestroProcessesService.prototype, "getTopRunCount", null);
14441
+ __decorate([
14442
+ track('MaestroProcesses.GetInstanceStatusTimeline')
14443
+ ], MaestroProcessesService.prototype, "getInstanceStatusTimeline", null);
14444
+ __decorate([
14445
+ track('MaestroProcesses.GetTopFaultedCount')
14446
+ ], MaestroProcessesService.prototype, "getTopFaultedCount", null);
14447
+ __decorate([
14448
+ track('MaestroProcesses.GetTopExecutionDuration')
14449
+ ], MaestroProcessesService.prototype, "getTopExecutionDuration", null);
14450
+
14451
+ /**
14452
+ * Service class for Maestro Process Incidents
14453
+ */
14454
+ class ProcessIncidentsService extends BaseService {
14455
+ /**
14456
+ * Get all process incidents across all folders
14457
+ *
14458
+ * @returns Promise resolving to array of process incident
14459
+ * {@link ProcessIncidentGetAllResponse}
14460
+ * @example
14461
+ * ```typescript
14462
+ * import { ProcessIncidents } from '@uipath/uipath-typescript/maestro-processes';
14463
+ *
14464
+ * const processIncidents = new ProcessIncidents(sdk);
14465
+ * const incidents = await processIncidents.getAll();
14466
+ *
14467
+ * // Access process incident information
14468
+ * for (const incident of incidents) {
14469
+ * console.log(`Process: ${incident.processKey}`);
14470
+ * console.log(`Error: ${incident.errorMessage}`);
14471
+ * console.log(`Count: ${incident.count}`);
14472
+ * console.log(`First occurrence: ${incident.firstOccuranceTime}`);
14473
+ * }
14474
+ * ```
14475
+ */
14476
+ async getAll() {
14477
+ const rawResponse = await this.get(MAESTRO_ENDPOINTS.INCIDENTS.GET_ALL);
14478
+ // Transform field names
14479
+ const data = rawResponse.data || [];
14480
+ return data.map(incident => transformData(incident, ProcessIncidentSummaryMap));
14481
+ }
14482
+ }
14483
+ __decorate([
14484
+ track('ProcessIncidents.getAll')
14485
+ ], ProcessIncidentsService.prototype, "getAll", null);
14486
+
14487
+ /**
14488
+ * Internal types for Maestro Cases
14489
+ * These types are used internally by the cases service
14490
+ */
14491
+ /**
14492
+ * Process type enum for filtering
14493
+ */
14494
+ var ProcessType;
14495
+ (function (ProcessType) {
13907
14496
  ProcessType["CaseManagement"] = "CaseManagement";
13908
14497
  })(ProcessType || (ProcessType = {}));
13909
14498
 
@@ -13942,6 +14531,177 @@
13942
14531
  name: this.extractCaseName(caseItem.packageId)
13943
14532
  }));
13944
14533
  }
14534
+ /**
14535
+ * Get the top 5 case processes ranked by run count within a time range.
14536
+ *
14537
+ * Returns an array of up to 5 case processes sorted by how many times they were executed,
14538
+ * useful for identifying the most active case processes in a given period.
14539
+ *
14540
+ * @param startTime - Start of the time range to query
14541
+ * @param endTime - End of the time range to query
14542
+ * @param options - Optional filters (packageId, processKey, version)
14543
+ * @returns Promise resolving to an array of {@link CaseGetTopRunCountResponse}
14544
+ * @example
14545
+ * ```typescript
14546
+ * import { Cases } from '@uipath/uipath-typescript/cases';
14547
+ *
14548
+ * const cases = new Cases(sdk);
14549
+ *
14550
+ * // Get top case processes by run count for the last 7 days
14551
+ * const topProcesses = await cases.getTopRunCount(
14552
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
14553
+ * new Date()
14554
+ * );
14555
+ *
14556
+ * for (const process of topProcesses) {
14557
+ * console.log(`${process.packageId}: ${process.runCount} runs`);
14558
+ * }
14559
+ * ```
14560
+ *
14561
+ * @example
14562
+ * ```typescript
14563
+ * // Get top case processes by run count for a specific package
14564
+ * const filtered = await cases.getTopRunCount(
14565
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
14566
+ * new Date(),
14567
+ * { packageId: '<packageId>' }
14568
+ * );
14569
+ * ```
14570
+ */
14571
+ async getTopRunCount(startTime, endTime, options) {
14572
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_RUN_COUNT, buildInsightsTopBody(startTime, endTime, true, options));
14573
+ return (data ?? []).map(process => ({ ...process, name: this.extractCaseName(process.packageId) }));
14574
+ }
14575
+ /**
14576
+ * Get all instances status counts aggregated by date for case management processes.
14577
+ *
14578
+ * Returns time-grouped counts of case instances grouped by status (Completed, Faulted, Cancelled),
14579
+ * useful for rendering time-series charts. Use `groupBy` to control the time bucket size
14580
+ * (hour, day, or week) — defaults to day if not provided.
14581
+ *
14582
+ * @param startTime - Start of the time range to query
14583
+ * @param endTime - End of the time range to query
14584
+ * @param options - Optional settings for time bucketing granularity
14585
+ * @returns Promise resolving to an array of {@link InstanceStatusTimelineResponse}
14586
+ *
14587
+ * @example
14588
+ * ```typescript
14589
+ * // Get daily instance status for the last 7 days
14590
+ * const now = new Date();
14591
+ * const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
14592
+ * const statuses = await cases.getInstanceStatusTimeline(sevenDaysAgo, now);
14593
+ *
14594
+ * for (const entry of statuses) {
14595
+ * console.log(`${entry.startTime} — ${entry.status}: ${entry.count}`);
14596
+ * }
14597
+ * ```
14598
+ *
14599
+ * @example
14600
+ * ```typescript
14601
+ * import { TimeInterval } from '@uipath/uipath-typescript/cases';
14602
+ *
14603
+ * // Get weekly breakdown
14604
+ * const statuses = await cases.getInstanceStatusTimeline(startTime, endTime, {
14605
+ * groupBy: TimeInterval.Week,
14606
+ * });
14607
+ * ```
14608
+ *
14609
+ * @example
14610
+ * ```typescript
14611
+ * // Get all-time data (from Unix epoch to now)
14612
+ * const allTime = await cases.getInstanceStatusTimeline(new Date(0), new Date());
14613
+ * ```
14614
+ */
14615
+ async getInstanceStatusTimeline(startTime, endTime, options) {
14616
+ return fetchInstanceStatusTimeline(this.post.bind(this), startTime, endTime, true, options);
14617
+ }
14618
+ /**
14619
+ * Get the top 10 case processes ranked by failure count within a time range.
14620
+ *
14621
+ * Returns an array of up to 10 case processes sorted by how many instances faulted,
14622
+ * useful for identifying the most error-prone case processes in a given period.
14623
+ *
14624
+ * @param startTime - Start of the time range to query
14625
+ * @param endTime - End of the time range to query
14626
+ * @param options - Optional filters (packageId, processKey, version)
14627
+ * @returns Promise resolving to an array of {@link CaseGetTopFaultedCountResponse}
14628
+ * @example
14629
+ * ```typescript
14630
+ * import { Cases } from '@uipath/uipath-typescript/cases';
14631
+ *
14632
+ * const cases = new Cases(sdk);
14633
+ *
14634
+ * // Get top case processes by faulted count for the last 7 days
14635
+ * const topFailing = await cases.getTopFaultedCount(
14636
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
14637
+ * new Date()
14638
+ * );
14639
+ *
14640
+ * for (const process of topFailing) {
14641
+ * console.log(`${process.packageId}: ${process.faultedCount} failures`);
14642
+ * }
14643
+ * ```
14644
+ *
14645
+ * @example
14646
+ * ```typescript
14647
+ * // Get top case processes by faulted count for a specific package
14648
+ * const filtered = await cases.getTopFaultedCount(
14649
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
14650
+ * new Date(),
14651
+ * { packageId: '<packageId>' }
14652
+ * );
14653
+ * ```
14654
+ */
14655
+ async getTopFaultedCount(startTime, endTime, options) {
14656
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_WITH_FAILURE, buildInsightsTopBody(startTime, endTime, true, options));
14657
+ return (data ?? []).map(item => ({
14658
+ packageId: item.packageId,
14659
+ processKey: item.processKey,
14660
+ faultedCount: item.runCount,
14661
+ name: this.extractCaseName(item.packageId),
14662
+ }));
14663
+ }
14664
+ /**
14665
+ * Get the top 5 case processes ranked by total duration within a time range.
14666
+ *
14667
+ * Returns an array of up to 5 case processes sorted by their total execution time,
14668
+ * useful for identifying the longest-running case processes in a given period.
14669
+ *
14670
+ * @param startTime - Start of the time range to query
14671
+ * @param endTime - End of the time range to query
14672
+ * @param options - Optional filters (packageId, processKey, version)
14673
+ * @returns Promise resolving to an array of {@link CaseGetTopDurationResponse}
14674
+ * @example
14675
+ * ```typescript
14676
+ * import { Cases } from '@uipath/uipath-typescript/cases';
14677
+ *
14678
+ * const cases = new Cases(sdk);
14679
+ *
14680
+ * // Get top case processes by duration for the last 7 days
14681
+ * const topProcesses = await cases.getTopExecutionDuration(
14682
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
14683
+ * new Date()
14684
+ * );
14685
+ *
14686
+ * for (const process of topProcesses) {
14687
+ * console.log(`${process.packageId}: ${process.duration}ms total`);
14688
+ * }
14689
+ * ```
14690
+ *
14691
+ * @example
14692
+ * ```typescript
14693
+ * // Get top case processes by duration for a specific package
14694
+ * const filtered = await cases.getTopExecutionDuration(
14695
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
14696
+ * new Date(),
14697
+ * { packageId: '<packageId>' }
14698
+ * );
14699
+ * ```
14700
+ */
14701
+ async getTopExecutionDuration(startTime, endTime, options) {
14702
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_DURATION, buildInsightsTopBody(startTime, endTime, true, options));
14703
+ return (data ?? []).map(process => ({ ...process, name: this.extractCaseName(process.packageId) }));
14704
+ }
13945
14705
  /**
13946
14706
  * Extract a readable case name from the packageId
13947
14707
  * @param packageId - The full package identifier
@@ -13964,6 +14724,18 @@
13964
14724
  __decorate([
13965
14725
  track('Cases.GetAll')
13966
14726
  ], CasesService.prototype, "getAll", null);
14727
+ __decorate([
14728
+ track('Cases.GetTopRunCount')
14729
+ ], CasesService.prototype, "getTopRunCount", null);
14730
+ __decorate([
14731
+ track('Cases.GetInstanceStatusTimeline')
14732
+ ], CasesService.prototype, "getInstanceStatusTimeline", null);
14733
+ __decorate([
14734
+ track('Cases.GetTopFaultedCount')
14735
+ ], CasesService.prototype, "getTopFaultedCount", null);
14736
+ __decorate([
14737
+ track('Cases.GetTopExecutionDuration')
14738
+ ], CasesService.prototype, "getTopExecutionDuration", null);
13967
14739
 
13968
14740
  /**
13969
14741
  * Maps fields for Case Instance entities to ensure consistent naming
@@ -15079,6 +15851,40 @@
15079
15851
  }
15080
15852
  }, apiOptions);
15081
15853
  }
15854
+ /**
15855
+ * Get stages SLA summary for case instances across folders.
15856
+ *
15857
+ * Returns stage-level SLA status and escalation information for each case instance, aggregated from Insights Real-Time Monitoring.
15858
+ *
15859
+ * @param options - Optional filtering options
15860
+ * @returns Promise resolving to an array of {@link CaseInstanceStageSLAResponse}
15861
+ * @example
15862
+ * ```typescript
15863
+ * // Get stages SLA summary for all case instances
15864
+ * const stagesSla = await caseInstances.getStagesSlaSummary();
15865
+ * for (const item of stagesSla) {
15866
+ * console.log(`Instance: ${item.caseInstanceId}`);
15867
+ * for (const stage of item.stages) {
15868
+ * console.log(` Stage: ${stage.name} - SLA Status: ${stage.slaStatus}, Due: ${stage.slaDueTime}`);
15869
+ * }
15870
+ * }
15871
+ *
15872
+ * // Filter by case instance ID
15873
+ * const filtered = await caseInstances.getStagesSlaSummary({
15874
+ * caseInstanceId: '<caseInstanceId>'
15875
+ * });
15876
+ *
15877
+ * // Using bound method on a case instance
15878
+ * const instance = await caseInstances.getById('<instanceId>', '<folderKey>');
15879
+ * const stagesSla = await instance.getStagesSlaSummary();
15880
+ * ```
15881
+ */
15882
+ async getStagesSlaSummary(options) {
15883
+ const response = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.STAGES_SUMMARY, {
15884
+ caseInstanceId: options?.caseInstanceId,
15885
+ });
15886
+ return response.data ?? [];
15887
+ }
15082
15888
  }
15083
15889
  __decorate([
15084
15890
  track('CaseInstances.GetAll')
@@ -15110,6 +15916,9 @@
15110
15916
  __decorate([
15111
15917
  track('CaseInstances.GetSlaSummary')
15112
15918
  ], CaseInstancesService.prototype, "getSlaSummary", null);
15919
+ __decorate([
15920
+ track('CaseInstances.GetStagesSlaSummary')
15921
+ ], CaseInstancesService.prototype, "getStagesSlaSummary", null);
15113
15922
 
15114
15923
  /**
15115
15924
  * Validates the `name` argument passed to a `getByName(name, ...)` method.
@@ -15517,6 +16326,32 @@
15517
16326
  // Transform response from PascalCase to camelCase
15518
16327
  return pascalToCamelCaseKeys(response.data);
15519
16328
  }
16329
+ /**
16330
+ * Retrieves a single orchestrator storage bucket by name.
16331
+ *
16332
+ * @param name - Bucket name to search for
16333
+ * @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
16334
+ * @returns Promise resolving to a single bucket
16335
+ * {@link BucketGetResponse}
16336
+ * @example
16337
+ * ```typescript
16338
+ * import { Buckets } from '@uipath/uipath-typescript/buckets';
16339
+ *
16340
+ * const buckets = new Buckets(sdk);
16341
+ *
16342
+ * // By folder ID
16343
+ * await buckets.getByName('MyBucket', { folderId: <folderId> });
16344
+ *
16345
+ * // By folder key (GUID)
16346
+ * await buckets.getByName('MyBucket', { folderKey: '<folderKey>' });
16347
+ *
16348
+ * // By folder path
16349
+ * await buckets.getByName('MyBucket', { folderPath: '<folderPath>' });
16350
+ * ```
16351
+ */
16352
+ async getByName(name, options = {}) {
16353
+ return this.getByNameLookup('Bucket', BUCKET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => pascalToCamelCaseKeys(raw));
16354
+ }
15520
16355
  /**
15521
16356
  * Gets all buckets across folders with optional filtering and folder scoping
15522
16357
  *
@@ -15788,6 +16623,120 @@
15788
16623
  }
15789
16624
  return transformedData;
15790
16625
  }
16626
+ /**
16627
+ * Lists all files in a bucket.
16628
+ *
16629
+ * Returns a flat, recursive listing of all files in the bucket. Supports regex filtering
16630
+ * and filter / orderby / select / expand. {@link BucketFile} entries include
16631
+ * `isDirectory` so callers can distinguish folders from files.
16632
+ *
16633
+ * The method returns either:
16634
+ * - A NonPaginatedResponse with items array (when no pagination parameters are provided)
16635
+ * - A PaginatedResponse with navigation cursors (when any pagination parameter is provided)
16636
+ *
16637
+ * @param bucketId - The ID of the bucket
16638
+ * @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional parameters for regex filtering, query options, and pagination
16639
+ * @returns Promise resolving to either an array of files NonPaginatedResponse<BucketFile> or a PaginatedResponse<BucketFile> when pagination options are used.
16640
+ *
16641
+ * @example
16642
+ * ```typescript
16643
+ * import { Buckets } from '@uipath/uipath-typescript/buckets';
16644
+ *
16645
+ * const buckets = new Buckets(sdk);
16646
+ *
16647
+ * // List all files in the bucket
16648
+ * const files = await buckets.getFiles(<bucketId>, { folderId: <folderId> });
16649
+ *
16650
+ * // Filter by regex pattern
16651
+ * const pdfs = await buckets.getFiles(<bucketId>, {
16652
+ * folderId: <folderId>,
16653
+ * fileNameRegex: '.*\\.pdf$'
16654
+ * });
16655
+ *
16656
+ * // First page with pagination
16657
+ * const page1 = await buckets.getFiles(<bucketId>, { folderId: <folderId>, pageSize: 10 });
16658
+ *
16659
+ * // Navigate using cursor
16660
+ * if (page1.hasNextPage) {
16661
+ * const page2 = await buckets.getFiles(<bucketId>, { folderId: <folderId>, cursor: page1.nextCursor });
16662
+ * }
16663
+ *
16664
+ * // Jump to specific page
16665
+ * const page5 = await buckets.getFiles(<bucketId>, {
16666
+ * folderId: <folderId>,
16667
+ * jumpToPage: 5,
16668
+ * pageSize: 10
16669
+ * });
16670
+ * ```
16671
+ */
16672
+ async getFiles(bucketId, options) {
16673
+ if (!bucketId) {
16674
+ throw new ValidationError({ message: 'bucketId is required for getFiles' });
16675
+ }
16676
+ const { folderId, folderKey, folderPath, ...restOptions } = options ?? {};
16677
+ const headers = resolveFolderHeaders({
16678
+ folderId,
16679
+ folderKey,
16680
+ folderPath,
16681
+ resourceType: 'Buckets.getFiles',
16682
+ fallbackFolderKey: this.config.folderKey,
16683
+ });
16684
+ const transformBucketFile = (file) => transformData(pascalToCamelCaseKeys(file), BucketMap);
16685
+ return PaginationHelpers.getAll({
16686
+ serviceAccess: this.createPaginationServiceAccess(),
16687
+ getEndpoint: () => BUCKET_ENDPOINTS.GET_FILES(bucketId),
16688
+ transformFn: transformBucketFile,
16689
+ pagination: {
16690
+ paginationType: PaginationType.OFFSET,
16691
+ itemsField: ODATA_PAGINATION.ITEMS_FIELD,
16692
+ totalCountField: ODATA_PAGINATION.TOTAL_COUNT_FIELD,
16693
+ paginationParams: {
16694
+ pageSizeParam: ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM,
16695
+ offsetParam: ODATA_OFFSET_PARAMS.OFFSET_PARAM,
16696
+ countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM,
16697
+ },
16698
+ },
16699
+ excludeFromPrefix: ['directory', 'recursive', 'fileNameRegex'],
16700
+ headers,
16701
+ }, { ...restOptions, directory: '/', recursive: true });
16702
+ }
16703
+ /**
16704
+ * Deletes a file from a bucket
16705
+ *
16706
+ * @param bucketId - The ID of the bucket
16707
+ * @param path - The full path to the file to delete
16708
+ * @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`)
16709
+ * @returns Promise resolving when the file is deleted
16710
+ *
16711
+ * @example
16712
+ * ```typescript
16713
+ * import { Buckets } from '@uipath/uipath-typescript/buckets';
16714
+ *
16715
+ * const buckets = new Buckets(sdk);
16716
+ *
16717
+ * // Delete a file from a bucket
16718
+ * await buckets.deleteFile(<bucketId>, '/folder/file.pdf', { folderId: <folderId> });
16719
+ * ```
16720
+ */
16721
+ async deleteFile(bucketId, path, options) {
16722
+ if (!bucketId) {
16723
+ throw new ValidationError({ message: 'bucketId is required for deleteFile' });
16724
+ }
16725
+ if (!path) {
16726
+ throw new ValidationError({ message: 'path is required for deleteFile' });
16727
+ }
16728
+ const headers = resolveFolderHeaders({
16729
+ folderId: options?.folderId,
16730
+ folderKey: options?.folderKey,
16731
+ folderPath: options?.folderPath,
16732
+ resourceType: 'Buckets.deleteFile',
16733
+ fallbackFolderKey: this.config.folderKey,
16734
+ });
16735
+ await this.delete(BUCKET_ENDPOINTS.DELETE_FILE(bucketId), {
16736
+ params: { path },
16737
+ headers,
16738
+ });
16739
+ }
15791
16740
  /**
15792
16741
  * Gets a direct upload URL for a file in the bucket
15793
16742
  *
@@ -15806,6 +16755,9 @@
15806
16755
  __decorate([
15807
16756
  track('Buckets.GetById')
15808
16757
  ], BucketService.prototype, "getById", null);
16758
+ __decorate([
16759
+ track('Buckets.GetByName')
16760
+ ], BucketService.prototype, "getByName", null);
15809
16761
  __decorate([
15810
16762
  track('Buckets.GetAll')
15811
16763
  ], BucketService.prototype, "getAll", null);
@@ -15818,6 +16770,12 @@
15818
16770
  __decorate([
15819
16771
  track('Buckets.GetReadUri')
15820
16772
  ], BucketService.prototype, "getReadUri", null);
16773
+ __decorate([
16774
+ track('Buckets.GetFiles')
16775
+ ], BucketService.prototype, "getFiles", null);
16776
+ __decorate([
16777
+ track('Buckets.DeleteFile')
16778
+ ], BucketService.prototype, "deleteFile", null);
15821
16779
 
15822
16780
  exports.BucketOptions = void 0;
15823
16781
  (function (BucketOptions) {
@@ -16615,33 +17573,32 @@
16615
17573
  }
16616
17574
  }, options);
16617
17575
  }
16618
- /**
16619
- * Starts a process execution (job)
16620
- *
16621
- * @param request - Process start request body
16622
- * @param folderId - Required folder ID
16623
- * @param options - Optional query parameters
16624
- * @returns Promise resolving to the created jobs
16625
- *
16626
- * @example
16627
- * ```typescript
16628
- * import { Processes } from '@uipath/uipath-typescript/processes';
16629
- *
16630
- * const processes = new Processes(sdk);
16631
- *
16632
- * // Start a process by process key
16633
- * const jobs = await processes.start({
16634
- * processKey: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
16635
- * }, 123); // folderId is required
16636
- *
16637
- * // Start a process by name with specific robots
16638
- * const jobs = await processes.start({
16639
- * processName: "MyProcess"
16640
- * }, 123); // folderId is required
16641
- * ```
16642
- */
16643
- async start(request, folderId, options = {}) {
16644
- const headers = createHeaders({ [FOLDER_ID]: folderId });
17576
+ async start(request, optionsOrFolderId, legacyOptions) {
17577
+ // Normalize the two overload forms into a single internal shape.
17578
+ let folderId;
17579
+ let folderKey;
17580
+ let folderPath;
17581
+ let queryOptions;
17582
+ if (typeof optionsOrFolderId === 'number') {
17583
+ // Deprecated positional form: start(request, folderId, options?)
17584
+ folderId = optionsOrFolderId;
17585
+ queryOptions = legacyOptions ?? {};
17586
+ }
17587
+ else {
17588
+ // Preferred form: start(request, options?)
17589
+ const { folderId: fid, folderKey: fkey, folderPath: fpath, ...rest } = optionsOrFolderId ?? {};
17590
+ folderId = fid;
17591
+ folderKey = fkey;
17592
+ folderPath = fpath;
17593
+ queryOptions = rest;
17594
+ }
17595
+ const headers = resolveFolderHeaders({
17596
+ folderId,
17597
+ folderKey,
17598
+ folderPath,
17599
+ resourceType: 'processes.start',
17600
+ fallbackFolderKey: this.config.folderKey,
17601
+ });
16645
17602
  // Transform SDK field names to API field names (e.g., processKey → releaseKey)
16646
17603
  const apiRequest = transformRequest(request, ProcessMap);
16647
17604
  // Create the request object according to API spec
@@ -16649,8 +17606,8 @@
16649
17606
  startInfo: apiRequest
16650
17607
  };
16651
17608
  // Prefix all query parameter keys with '$' for OData
16652
- const keysToPrefix = Object.keys(options);
16653
- const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
17609
+ const keysToPrefix = Object.keys(queryOptions);
17610
+ const apiOptions = addPrefixToKeys(queryOptions, ODATA_PREFIX, keysToPrefix);
16654
17611
  const response = await this.post(PROCESS_ENDPOINTS.START_PROCESS, requestBody, {
16655
17612
  params: apiOptions,
16656
17613
  headers
@@ -16983,6 +17940,17 @@
16983
17940
  lastActivityAt: 'lastActivityTime',
16984
17941
  agentReleaseId: 'agentId'
16985
17942
  };
17943
+ /**
17944
+ * Maps API filter param names (left) to SDK-facing names (right) for the conversation list endpoint.
17945
+ * Used by `getAll` to translate SDK filters to the field names the backend expects. Kept separate
17946
+ * from `ConversationMap` because `label`/`search` would otherwise collide with the `label` field
17947
+ * on create/update payloads.
17948
+ */
17949
+ const ConversationGetAllFilterMap = {
17950
+ agentReleaseKey: 'agentKey',
17951
+ agentReleaseId: 'agentId',
17952
+ search: 'label'
17953
+ };
16986
17954
  /**
16987
17955
  * Maps fields for Exchange entity to ensure consistent SDK naming
16988
17956
  */
@@ -17342,8 +18310,8 @@
17342
18310
  // Auto-generated from the OpenAPI spec — do not edit manually.
17343
18311
  var ModelKind;
17344
18312
  (function (ModelKind) {
17345
- ModelKind["Classifier"] = "Classifier";
17346
18313
  ModelKind["Extractor"] = "Extractor";
18314
+ ModelKind["Classifier"] = "Classifier";
17347
18315
  })(ModelKind || (ModelKind = {}));
17348
18316
  var ModelType;
17349
18317
  (function (ModelType) {
@@ -17352,6 +18320,14 @@
17352
18320
  ModelType["Predefined"] = "Predefined";
17353
18321
  })(ModelType || (ModelType = {}));
17354
18322
 
18323
+ // Auto-generated from the OpenAPI spec — do not edit manually.
18324
+ var ErrorSeverity;
18325
+ (function (ErrorSeverity) {
18326
+ ErrorSeverity["Info"] = "Info";
18327
+ ErrorSeverity["Warning"] = "Warning";
18328
+ ErrorSeverity["Error"] = "Error";
18329
+ })(ErrorSeverity || (ErrorSeverity = {}));
18330
+
17355
18331
  // Auto-generated from the OpenAPI spec — do not edit manually.
17356
18332
  var ClassifierDocumentTypeType;
17357
18333
  (function (ClassifierDocumentTypeType) {
@@ -17376,6 +18352,13 @@
17376
18352
  GptFieldType["Number"] = "Number";
17377
18353
  GptFieldType["Text"] = "Text";
17378
18354
  })(GptFieldType || (GptFieldType = {}));
18355
+ var JobStatus;
18356
+ (function (JobStatus) {
18357
+ JobStatus["Succeeded"] = "Succeeded";
18358
+ JobStatus["Failed"] = "Failed";
18359
+ JobStatus["Running"] = "Running";
18360
+ JobStatus["NotStarted"] = "NotStarted";
18361
+ })(JobStatus || (JobStatus = {}));
17379
18362
  var ValidationDisplayMode;
17380
18363
  (function (ValidationDisplayMode) {
17381
18364
  ValidationDisplayMode["Classic"] = "Classic";
@@ -17462,8 +18445,10 @@
17462
18445
  get DocumentActionPriority () { return DocumentActionPriority; },
17463
18446
  get DocumentActionStatus () { return DocumentActionStatus; },
17464
18447
  get DocumentActionType () { return DocumentActionType; },
18448
+ get ErrorSeverity () { return ErrorSeverity; },
17465
18449
  get FieldType () { return FieldType; },
17466
18450
  get GptFieldType () { return GptFieldType; },
18451
+ get JobStatus () { return JobStatus; },
17467
18452
  get LogicalOperator () { return LogicalOperator; },
17468
18453
  get MarkupType () { return MarkupType; },
17469
18454
  get ModelKind () { return ModelKind; },
@@ -17557,17 +18542,10 @@
17557
18542
  return getMetaTagContent(exports.UiPathMetaTags.APP_BASE) || '/';
17558
18543
  }
17559
18544
 
17560
- exports.APP_NAME = APP_NAME;
17561
18545
  exports.AgentMap = AgentMap;
17562
18546
  exports.AuthenticationError = AuthenticationError;
17563
18547
  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;
18548
+ exports.ConversationGetAllFilterMap = ConversationGetAllFilterMap;
17571
18549
  exports.ConversationMap = ConversationMap;
17572
18550
  exports.DEFAULT_ITEMS_FIELD = DEFAULT_ITEMS_FIELD;
17573
18551
  exports.DEFAULT_PAGE_SIZE = DEFAULT_PAGE_SIZE;
@@ -17581,17 +18559,10 @@
17581
18559
  exports.NetworkError = NetworkError;
17582
18560
  exports.NotFoundError = NotFoundError;
17583
18561
  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
18562
  exports.ServerError = ServerError;
17590
- exports.UNKNOWN = UNKNOWN$1;
17591
18563
  exports.UiPath = UiPath;
17592
18564
  exports.UiPathError = UiPathError;
17593
18565
  exports.UserSettingsMap = UserSettingsMap;
17594
- exports.VERSION = VERSION;
17595
18566
  exports.ValidationError = ValidationError;
17596
18567
  exports.createAgentWithMethods = createAgentWithMethods;
17597
18568
  exports.createCaseInstanceWithMethods = createCaseInstanceWithMethods;