@uipath/uipath-typescript 1.3.7 → 1.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/assets/index.cjs +64 -274
  2. package/dist/assets/index.d.ts +1 -0
  3. package/dist/assets/index.mjs +64 -274
  4. package/dist/attachments/index.cjs +62 -271
  5. package/dist/attachments/index.d.ts +1 -0
  6. package/dist/attachments/index.mjs +62 -271
  7. package/dist/buckets/index.cjs +93 -274
  8. package/dist/buckets/index.d.ts +51 -1
  9. package/dist/buckets/index.mjs +93 -274
  10. package/dist/cases/index.cjs +580 -336
  11. package/dist/cases/index.d.ts +690 -3
  12. package/dist/cases/index.mjs +581 -337
  13. package/dist/conversational-agent/index.cjs +110 -285
  14. package/dist/conversational-agent/index.d.ts +63 -12
  15. package/dist/conversational-agent/index.mjs +110 -286
  16. package/dist/core/index.cjs +39 -289
  17. package/dist/core/index.d.ts +9 -98
  18. package/dist/core/index.mjs +40 -275
  19. package/dist/document-understanding/index.cjs +18 -1
  20. package/dist/document-understanding/index.d.ts +636 -610
  21. package/dist/document-understanding/index.mjs +18 -1
  22. package/dist/entities/index.cjs +64 -274
  23. package/dist/entities/index.d.ts +1 -0
  24. package/dist/entities/index.mjs +64 -274
  25. package/dist/feedback/index.cjs +313 -276
  26. package/dist/feedback/index.d.ts +418 -12
  27. package/dist/feedback/index.mjs +313 -276
  28. package/dist/index.cjs +777 -297
  29. package/dist/index.d.ts +2005 -721
  30. package/dist/index.mjs +777 -283
  31. package/dist/index.umd.js +966 -162
  32. package/dist/jobs/index.cjs +64 -274
  33. package/dist/jobs/index.d.ts +1 -0
  34. package/dist/jobs/index.mjs +64 -274
  35. package/dist/maestro-processes/index.cjs +1789 -1686
  36. package/dist/maestro-processes/index.d.ts +431 -2
  37. package/dist/maestro-processes/index.mjs +1790 -1687
  38. package/dist/processes/index.cjs +64 -274
  39. package/dist/processes/index.d.ts +1 -0
  40. package/dist/processes/index.mjs +64 -274
  41. package/dist/queues/index.cjs +64 -274
  42. package/dist/queues/index.d.ts +1 -0
  43. package/dist/queues/index.mjs +64 -274
  44. package/dist/tasks/index.cjs +64 -274
  45. package/dist/tasks/index.d.ts +1 -0
  46. package/dist/tasks/index.mjs +64 -274
  47. package/package.json +8 -10
@@ -1,4 +1,4 @@
1
- import { BatchLogRecordProcessor, LoggerProvider } from '@opentelemetry/sdk-logs';
1
+ import { getOrCreateClient, createTrack, createTrackEvent } from '@uipath/core-telemetry';
2
2
 
3
3
  /******************************************************************************
4
4
  Copyright (c) Microsoft Corporation.
@@ -5300,284 +5300,49 @@ function normalizeBaseUrl(url) {
5300
5300
  }
5301
5301
 
5302
5302
  /**
5303
- * SDK Telemetry constants
5304
- */
5305
- // Connection string placeholder that will be replaced during build
5306
- 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";
5307
- // SDK Version placeholder
5308
- const SDK_VERSION = "1.3.7";
5309
- const VERSION = "Version";
5310
- const SERVICE = "Service";
5311
- const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
5312
- const CLOUD_TENANT_NAME = "CloudTenantName";
5313
- const CLOUD_URL = "CloudUrl";
5314
- const CLOUD_CLIENT_ID = "CloudClientId";
5315
- const CLOUD_REDIRECT_URI = "CloudRedirectUri";
5316
- const APP_NAME = "ApplicationName";
5317
- const CLOUD_ROLE_NAME = "uipath-ts-sdk";
5318
- // Service and logger names
5319
- const SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
5320
- const SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
5321
- // Event names
5322
- const SDK_RUN_EVENT = "Sdk.Run";
5323
- // Default value for unknown/empty attributes
5324
- const UNKNOWN = "";
5325
-
5326
- /**
5327
- * Log exporter that sends ALL logs as Application Insights custom events
5328
- */
5329
- class ApplicationInsightsEventExporter {
5330
- constructor(connectionString) {
5331
- this.connectionString = connectionString;
5332
- }
5333
- export(logs, resultCallback) {
5334
- try {
5335
- logs.forEach(logRecord => {
5336
- this.sendAsCustomEvent(logRecord);
5337
- });
5338
- resultCallback({ code: 0 });
5339
- }
5340
- catch (error) {
5341
- console.debug('Failed to export logs to Application Insights:', error);
5342
- resultCallback({ code: 2, error });
5343
- }
5344
- }
5345
- shutdown() {
5346
- return Promise.resolve();
5347
- }
5348
- sendAsCustomEvent(logRecord) {
5349
- // Get event name from body or attributes
5350
- const eventName = logRecord.body || SDK_RUN_EVENT;
5351
- const payload = {
5352
- name: 'Microsoft.ApplicationInsights.Event',
5353
- time: new Date().toISOString(),
5354
- iKey: this.extractInstrumentationKey(),
5355
- data: {
5356
- baseType: 'EventData',
5357
- baseData: {
5358
- ver: 2,
5359
- name: eventName,
5360
- properties: this.convertAttributesToProperties(logRecord.attributes || {})
5361
- }
5362
- },
5363
- tags: {
5364
- 'ai.cloud.role': CLOUD_ROLE_NAME,
5365
- 'ai.cloud.roleInstance': SDK_VERSION
5366
- }
5367
- };
5368
- this.sendToApplicationInsights(payload);
5369
- }
5370
- extractInstrumentationKey() {
5371
- const match = this.connectionString.match(/InstrumentationKey=([^;]+)/);
5372
- return match ? match[1] : '';
5373
- }
5374
- convertAttributesToProperties(attributes) {
5375
- const properties = {};
5376
- Object.entries(attributes || {}).forEach(([key, value]) => {
5377
- properties[key] = String(value);
5378
- });
5379
- return properties;
5380
- }
5381
- async sendToApplicationInsights(payload) {
5382
- try {
5383
- const ingestionEndpoint = this.extractIngestionEndpoint();
5384
- if (!ingestionEndpoint) {
5385
- console.debug('No ingestion endpoint found in connection string');
5386
- return;
5387
- }
5388
- const url = `${ingestionEndpoint}/v2/track`;
5389
- const response = await fetch(url, {
5390
- method: 'POST',
5391
- headers: {
5392
- 'Content-Type': 'application/json',
5393
- },
5394
- body: JSON.stringify(payload)
5395
- });
5396
- if (!response.ok) {
5397
- console.debug(`Failed to send event telemetry: ${response.status} ${response.statusText}`);
5398
- }
5399
- }
5400
- catch (error) {
5401
- console.debug('Error sending event telemetry to Application Insights:', error);
5402
- }
5403
- }
5404
- extractIngestionEndpoint() {
5405
- const match = this.connectionString.match(/IngestionEndpoint=([^;]+)/);
5406
- return match ? match[1] : '';
5407
- }
5408
- }
5409
- /**
5410
- * Singleton telemetry client
5303
+ * SDK Telemetry constants.
5304
+ *
5305
+ * Only the SDK's identity (version, service name, role name, …) lives
5306
+ * here. The Application Insights connection string is injected into
5307
+ * `@uipath/core-telemetry` itself at publish time, and the generic attribute
5308
+ * keys (`Version`, `Service`, `CloudOrganizationName`, …) are owned by
5309
+ * `@uipath/core-telemetry` and consumed there — they are not part of the
5310
+ * SDK's public API.
5411
5311
  */
5412
- class TelemetryClient {
5413
- constructor() {
5414
- this.isInitialized = false;
5415
- }
5416
- static getInstance() {
5417
- if (!TelemetryClient.instance) {
5418
- TelemetryClient.instance = new TelemetryClient();
5419
- }
5420
- return TelemetryClient.instance;
5421
- }
5422
- /**
5423
- * Initialize telemetry
5424
- */
5425
- initialize(config) {
5426
- if (this.isInitialized) {
5427
- return;
5428
- }
5429
- this.isInitialized = true;
5430
- if (config) {
5431
- this.telemetryContext = config;
5432
- }
5433
- try {
5434
- const connectionString = this.getConnectionString();
5435
- if (!connectionString) {
5436
- return;
5437
- }
5438
- this.setupTelemetryProvider(connectionString);
5439
- }
5440
- catch (error) {
5441
- // Silent failure - telemetry errors shouldn't break functionality
5442
- console.debug('Failed to initialize OpenTelemetry:', error);
5443
- }
5444
- }
5445
- getConnectionString() {
5446
- const connectionString = CONNECTION_STRING;
5447
- return connectionString;
5448
- }
5449
- setupTelemetryProvider(connectionString) {
5450
- const exporter = new ApplicationInsightsEventExporter(connectionString);
5451
- const processor = new BatchLogRecordProcessor(exporter);
5452
- this.logProvider = new LoggerProvider({
5453
- processors: [processor]
5454
- });
5455
- this.logger = this.logProvider.getLogger(SDK_LOGGER_NAME);
5456
- }
5457
- /**
5458
- * Track a telemetry event
5459
- */
5460
- track(eventName, name, extraAttributes = {}) {
5461
- try {
5462
- // Skip if logger not initialized
5463
- if (!this.logger) {
5464
- return;
5465
- }
5466
- const finalDisplayName = name || eventName;
5467
- const attributes = this.getEnrichedAttributes(extraAttributes, eventName);
5468
- // Emit as log
5469
- this.logger.emit({
5470
- body: finalDisplayName,
5471
- attributes: attributes,
5472
- timestamp: Date.now(),
5473
- });
5474
- }
5475
- catch (error) {
5476
- // Silent failure
5477
- console.debug('Failed to track telemetry event:', error);
5478
- }
5479
- }
5480
- /**
5481
- * Get enriched attributes for telemetry events
5482
- */
5483
- getEnrichedAttributes(extraAttributes, eventName) {
5484
- const attributes = {
5485
- [APP_NAME]: SDK_SERVICE_NAME,
5486
- [VERSION]: SDK_VERSION,
5487
- [SERVICE]: eventName,
5488
- [CLOUD_URL]: this.createCloudUrl(),
5489
- [CLOUD_ORGANIZATION_NAME]: this.telemetryContext?.orgName || UNKNOWN,
5490
- [CLOUD_TENANT_NAME]: this.telemetryContext?.tenantName || UNKNOWN,
5491
- [CLOUD_REDIRECT_URI]: this.telemetryContext?.redirectUri || UNKNOWN,
5492
- [CLOUD_CLIENT_ID]: this.telemetryContext?.clientId || UNKNOWN,
5493
- ...extraAttributes,
5494
- };
5495
- return attributes;
5496
- }
5497
- /**
5498
- * Create cloud URL from base URL, organization ID, and tenant ID
5499
- */
5500
- createCloudUrl() {
5501
- const baseUrl = this.telemetryContext?.baseUrl;
5502
- const orgId = this.telemetryContext?.orgName;
5503
- const tenantId = this.telemetryContext?.tenantName;
5504
- if (!baseUrl || !orgId || !tenantId) {
5505
- return UNKNOWN;
5506
- }
5507
- return `${baseUrl}/${orgId}/${tenantId}`;
5508
- }
5509
- }
5510
- // Export singleton instance
5511
- const telemetryClient = TelemetryClient.getInstance();
5312
+ /** SDK version placeholder — patched by the SDK publish workflow. */
5313
+ const SDK_VERSION = '1.3.9';
5314
+ const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
5315
+ const SDK_SERVICE_NAME = 'UiPath.TypeScript.Sdk';
5316
+ const SDK_LOGGER_NAME = 'uipath-ts-sdk-telemetry';
5317
+ const SDK_RUN_EVENT = 'Sdk.Run';
5512
5318
 
5513
5319
  /**
5514
- * SDK Track decorator and function for telemetry
5515
- */
5516
- /**
5517
- * Common tracking logic shared between method and function decorators
5518
- */
5519
- function createTrackedFunction(originalFunction, nameOrOptions, fallbackName, opts) {
5520
- return function (...args) {
5521
- // Determine if we should track this call
5522
- let shouldTrack = true;
5523
- if (opts.condition !== undefined) {
5524
- if (typeof opts.condition === 'function') {
5525
- shouldTrack = opts.condition.apply(this, args);
5526
- }
5527
- else {
5528
- shouldTrack = opts.condition;
5529
- }
5530
- }
5531
- // Track the event if enabled
5532
- if (shouldTrack) {
5533
- // Use the full name provided in the decorator (e.g., "Queue.GetAll")
5534
- const serviceMethod = typeof nameOrOptions === 'string'
5535
- ? nameOrOptions
5536
- : fallbackName;
5537
- // Use 'Sdk.Run' as the name and serviceMethod as the service
5538
- telemetryClient.track(serviceMethod, SDK_RUN_EVENT, opts.attributes);
5539
- }
5540
- // Execute the original function
5541
- return originalFunction.apply(this, args);
5542
- };
5543
- }
5544
- /**
5545
- * Track decorator that can be used to automatically track function calls
5320
+ * UiPath TypeScript SDK Telemetry
5546
5321
  *
5547
- * Usage:
5548
- * @track("Service.Method")
5549
- * function myFunction() { ... }
5550
- *
5551
- * @track("Queue.GetAll")
5552
- * async getAll() { ... }
5553
- *
5554
- * @track("Tasks.Create")
5555
- * async create() { ... }
5556
- *
5557
- * @track("Assets.Update", { condition: false })
5558
- * function myFunction() { ... }
5559
- *
5560
- * @track("Processes.Start", { attributes: { customProp: "value" } })
5561
- * function myFunction() { ... }
5322
+ * Constructs the SDK's own `TelemetryClient` and binds the SDK-local
5323
+ * `track` / `trackEvent` to it. Each consumer of `@uipath/core-telemetry`
5324
+ * does this independently, so events carry their own consumer's identity
5325
+ * and tenant context.
5562
5326
  */
5563
- function track(nameOrOptions, options) {
5564
- return function decorator(_target, propertyKey, descriptor) {
5565
- const opts = typeof nameOrOptions === 'object' ? nameOrOptions : options || {};
5566
- if (descriptor && typeof descriptor.value === 'function') {
5567
- // Method decorator
5568
- descriptor.value = createTrackedFunction(descriptor.value, nameOrOptions, propertyKey || 'unknown_method', opts);
5569
- return descriptor;
5570
- }
5571
- // Function decorator
5572
- return (originalFunction) => createTrackedFunction(originalFunction, nameOrOptions, originalFunction.name || 'unknown_function', opts);
5573
- };
5574
- }
5575
- /**
5576
- * Direct tracking function
5577
- */
5578
- function trackEvent(eventName, name, attributes) {
5579
- telemetryClient.track(eventName, name, attributes);
5580
- }
5327
+ // Keyed by `CLOUD_ROLE_NAME` so every SDK subpath bundle resolves to the
5328
+ // same `TelemetryClient` instance at runtime. A single `initialize(...)`
5329
+ // from the `UiPath` constructor therefore wires up `@track` decorators
5330
+ // across every subpath bundle (`assets`, `feedback`, `tasks`, …).
5331
+ const sdkClient = getOrCreateClient(CLOUD_ROLE_NAME);
5332
+ const track = createTrack(sdkClient);
5333
+ const trackEvent = createTrackEvent(sdkClient);
5334
+ const telemetryClient = {
5335
+ initialize(context) {
5336
+ sdkClient.initialize({
5337
+ sdkVersion: SDK_VERSION,
5338
+ serviceName: SDK_SERVICE_NAME,
5339
+ cloudRoleName: CLOUD_ROLE_NAME,
5340
+ loggerName: SDK_LOGGER_NAME,
5341
+ defaultEventName: SDK_RUN_EVENT,
5342
+ context,
5343
+ });
5344
+ },
5345
+ };
5581
5346
 
5582
5347
  /**
5583
5348
  * SDK Internals Registry - Internal registry for SDK instances
@@ -5953,4 +5718,4 @@ function getLimitedPageSize(pageSize) {
5953
5718
  return Math.max(1, Math.min(pageSize, MAX_PAGE_SIZE));
5954
5719
  }
5955
5720
 
5956
- export { APP_NAME, AuthenticationError, AuthorizationError, CLOUD_CLIENT_ID, CLOUD_ORGANIZATION_NAME, CLOUD_REDIRECT_URI, CLOUD_ROLE_NAME, CLOUD_TENANT_NAME, CLOUD_URL, CONNECTION_STRING, DEFAULT_ITEMS_FIELD, DEFAULT_PAGE_SIZE, DEFAULT_TOTAL_COUNT_FIELD, ErrorType, HttpStatus, MAX_PAGE_SIZE, NetworkError, NotFoundError, RateLimitError, SDK_LOGGER_NAME, SDK_RUN_EVENT, SDK_SERVICE_NAME, SDK_VERSION, SERVICE, ServerError, UNKNOWN, UiPath, UiPathError, VERSION, ValidationError, getErrorDetails, getLimitedPageSize, isAuthenticationError, isAuthorizationError, isNetworkError, isNotFoundError, isRateLimitError, isServerError, isUiPathError, isValidationError, telemetryClient, track, trackEvent };
5721
+ export { AuthenticationError, AuthorizationError, DEFAULT_ITEMS_FIELD, DEFAULT_PAGE_SIZE, DEFAULT_TOTAL_COUNT_FIELD, ErrorType, HttpStatus, MAX_PAGE_SIZE, NetworkError, NotFoundError, RateLimitError, ServerError, UiPath, UiPathError, ValidationError, getErrorDetails, getLimitedPageSize, isAuthenticationError, isAuthorizationError, isNetworkError, isNotFoundError, isRateLimitError, isServerError, isUiPathError, isValidationError, telemetryClient, track, trackEvent };
@@ -114,8 +114,8 @@ var WordGroupType;
114
114
  // Auto-generated from the OpenAPI spec — do not edit manually.
115
115
  var ModelKind;
116
116
  (function (ModelKind) {
117
- ModelKind["Classifier"] = "Classifier";
118
117
  ModelKind["Extractor"] = "Extractor";
118
+ ModelKind["Classifier"] = "Classifier";
119
119
  })(ModelKind || (ModelKind = {}));
120
120
  var ModelType;
121
121
  (function (ModelType) {
@@ -124,6 +124,14 @@ var ModelType;
124
124
  ModelType["Predefined"] = "Predefined";
125
125
  })(ModelType || (ModelType = {}));
126
126
 
127
+ // Auto-generated from the OpenAPI spec — do not edit manually.
128
+ var ErrorSeverity;
129
+ (function (ErrorSeverity) {
130
+ ErrorSeverity["Info"] = "Info";
131
+ ErrorSeverity["Warning"] = "Warning";
132
+ ErrorSeverity["Error"] = "Error";
133
+ })(ErrorSeverity || (ErrorSeverity = {}));
134
+
127
135
  // Auto-generated from the OpenAPI spec — do not edit manually.
128
136
  var ClassifierDocumentTypeType;
129
137
  (function (ClassifierDocumentTypeType) {
@@ -148,6 +156,13 @@ var GptFieldType;
148
156
  GptFieldType["Number"] = "Number";
149
157
  GptFieldType["Text"] = "Text";
150
158
  })(GptFieldType || (GptFieldType = {}));
159
+ var JobStatus;
160
+ (function (JobStatus) {
161
+ JobStatus["Succeeded"] = "Succeeded";
162
+ JobStatus["Failed"] = "Failed";
163
+ JobStatus["Running"] = "Running";
164
+ JobStatus["NotStarted"] = "NotStarted";
165
+ })(JobStatus || (JobStatus = {}));
151
166
  var ValidationDisplayMode;
152
167
  (function (ValidationDisplayMode) {
153
168
  ValidationDisplayMode["Classic"] = "Classic";
@@ -234,8 +249,10 @@ var index = /*#__PURE__*/Object.freeze({
234
249
  get DocumentActionPriority () { return DocumentActionPriority; },
235
250
  get DocumentActionStatus () { return DocumentActionStatus; },
236
251
  get DocumentActionType () { return DocumentActionType; },
252
+ get ErrorSeverity () { return ErrorSeverity; },
237
253
  get FieldType () { return FieldType; },
238
254
  get GptFieldType () { return GptFieldType; },
255
+ get JobStatus () { return JobStatus; },
239
256
  get LogicalOperator () { return LogicalOperator; },
240
257
  get MarkupType () { return MarkupType; },
241
258
  get ModelKind () { return ModelKind; },