@uipath/uipath-typescript 1.3.8 → 1.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/assets/index.cjs +25 -270
  2. package/dist/assets/index.mjs +25 -270
  3. package/dist/attachments/index.cjs +23 -267
  4. package/dist/attachments/index.mjs +23 -267
  5. package/dist/buckets/index.cjs +54 -270
  6. package/dist/buckets/index.d.ts +50 -1
  7. package/dist/buckets/index.mjs +54 -270
  8. package/dist/cases/index.cjs +408 -337
  9. package/dist/cases/index.d.ts +534 -2
  10. package/dist/cases/index.mjs +409 -338
  11. package/dist/conversational-agent/index.cjs +71 -281
  12. package/dist/conversational-agent/index.d.ts +62 -12
  13. package/dist/conversational-agent/index.mjs +71 -282
  14. package/dist/core/index.cjs +39 -289
  15. package/dist/core/index.d.ts +9 -98
  16. package/dist/core/index.mjs +40 -275
  17. package/dist/document-understanding/index.cjs +18 -1
  18. package/dist/document-understanding/index.d.ts +636 -610
  19. package/dist/document-understanding/index.mjs +18 -1
  20. package/dist/entities/index.cjs +25 -270
  21. package/dist/entities/index.mjs +25 -270
  22. package/dist/feedback/index.cjs +23 -268
  23. package/dist/feedback/index.mjs +23 -268
  24. package/dist/index.cjs +600 -293
  25. package/dist/index.d.ts +1603 -722
  26. package/dist/index.mjs +600 -279
  27. package/dist/index.umd.js +789 -158
  28. package/dist/jobs/index.cjs +25 -270
  29. package/dist/jobs/index.mjs +25 -270
  30. package/dist/maestro-processes/index.cjs +1751 -1720
  31. package/dist/maestro-processes/index.d.ts +430 -2
  32. package/dist/maestro-processes/index.mjs +1752 -1721
  33. package/dist/processes/index.cjs +25 -270
  34. package/dist/processes/index.mjs +25 -270
  35. package/dist/queues/index.cjs +25 -270
  36. package/dist/queues/index.mjs +25 -270
  37. package/dist/tasks/index.cjs +25 -270
  38. package/dist/tasks/index.mjs +25 -270
  39. package/package.json +8 -10
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var sdkLogs = require('@opentelemetry/sdk-logs');
3
+ var coreTelemetry = require('@uipath/core-telemetry');
4
4
 
5
5
  /******************************************************************************
6
6
  Copyright (c) Microsoft Corporation.
@@ -273,278 +273,33 @@ class NetworkError extends UiPathError {
273
273
  }
274
274
 
275
275
  /**
276
- * SDK Telemetry constants
277
- */
278
- // Connection string placeholder that will be replaced during build
279
- 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";
280
- // SDK Version placeholder
281
- const SDK_VERSION = "1.3.8";
282
- const VERSION = "Version";
283
- const SERVICE = "Service";
284
- const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
285
- const CLOUD_TENANT_NAME = "CloudTenantName";
286
- const CLOUD_URL = "CloudUrl";
287
- const CLOUD_CLIENT_ID = "CloudClientId";
288
- const CLOUD_REDIRECT_URI = "CloudRedirectUri";
289
- const APP_NAME = "ApplicationName";
290
- const CLOUD_ROLE_NAME = "uipath-ts-sdk";
291
- // Service and logger names
292
- const SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
293
- const SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
294
- // Event names
295
- const SDK_RUN_EVENT = "Sdk.Run";
296
- // Default value for unknown/empty attributes
297
- const UNKNOWN = "";
298
-
299
- /**
300
- * Log exporter that sends ALL logs as Application Insights custom events
301
- */
302
- class ApplicationInsightsEventExporter {
303
- constructor(connectionString) {
304
- this.connectionString = connectionString;
305
- }
306
- export(logs, resultCallback) {
307
- try {
308
- logs.forEach(logRecord => {
309
- this.sendAsCustomEvent(logRecord);
310
- });
311
- resultCallback({ code: 0 });
312
- }
313
- catch (error) {
314
- console.debug('Failed to export logs to Application Insights:', error);
315
- resultCallback({ code: 2, error });
316
- }
317
- }
318
- shutdown() {
319
- return Promise.resolve();
320
- }
321
- sendAsCustomEvent(logRecord) {
322
- // Get event name from body or attributes
323
- const eventName = logRecord.body || SDK_RUN_EVENT;
324
- const payload = {
325
- name: 'Microsoft.ApplicationInsights.Event',
326
- time: new Date().toISOString(),
327
- iKey: this.extractInstrumentationKey(),
328
- data: {
329
- baseType: 'EventData',
330
- baseData: {
331
- ver: 2,
332
- name: eventName,
333
- properties: this.convertAttributesToProperties(logRecord.attributes || {})
334
- }
335
- },
336
- tags: {
337
- 'ai.cloud.role': CLOUD_ROLE_NAME,
338
- 'ai.cloud.roleInstance': SDK_VERSION
339
- }
340
- };
341
- this.sendToApplicationInsights(payload);
342
- }
343
- extractInstrumentationKey() {
344
- const match = this.connectionString.match(/InstrumentationKey=([^;]+)/);
345
- return match ? match[1] : '';
346
- }
347
- convertAttributesToProperties(attributes) {
348
- const properties = {};
349
- Object.entries(attributes || {}).forEach(([key, value]) => {
350
- properties[key] = String(value);
351
- });
352
- return properties;
353
- }
354
- async sendToApplicationInsights(payload) {
355
- try {
356
- const ingestionEndpoint = this.extractIngestionEndpoint();
357
- if (!ingestionEndpoint) {
358
- console.debug('No ingestion endpoint found in connection string');
359
- return;
360
- }
361
- const url = `${ingestionEndpoint}/v2/track`;
362
- const response = await fetch(url, {
363
- method: 'POST',
364
- headers: {
365
- 'Content-Type': 'application/json',
366
- },
367
- body: JSON.stringify(payload)
368
- });
369
- if (!response.ok) {
370
- console.debug(`Failed to send event telemetry: ${response.status} ${response.statusText}`);
371
- }
372
- }
373
- catch (error) {
374
- console.debug('Error sending event telemetry to Application Insights:', error);
375
- }
376
- }
377
- extractIngestionEndpoint() {
378
- const match = this.connectionString.match(/IngestionEndpoint=([^;]+)/);
379
- return match ? match[1] : '';
380
- }
381
- }
382
- /**
383
- * Singleton telemetry client
384
- */
385
- class TelemetryClient {
386
- constructor() {
387
- this.isInitialized = false;
388
- }
389
- static getInstance() {
390
- if (!TelemetryClient.instance) {
391
- TelemetryClient.instance = new TelemetryClient();
392
- }
393
- return TelemetryClient.instance;
394
- }
395
- /**
396
- * Initialize telemetry
397
- */
398
- initialize(config) {
399
- if (this.isInitialized) {
400
- return;
401
- }
402
- this.isInitialized = true;
403
- if (config) {
404
- this.telemetryContext = config;
405
- }
406
- try {
407
- const connectionString = this.getConnectionString();
408
- if (!connectionString) {
409
- return;
410
- }
411
- this.setupTelemetryProvider(connectionString);
412
- }
413
- catch (error) {
414
- // Silent failure - telemetry errors shouldn't break functionality
415
- console.debug('Failed to initialize OpenTelemetry:', error);
416
- }
417
- }
418
- getConnectionString() {
419
- const connectionString = CONNECTION_STRING;
420
- return connectionString;
421
- }
422
- setupTelemetryProvider(connectionString) {
423
- const exporter = new ApplicationInsightsEventExporter(connectionString);
424
- const processor = new sdkLogs.BatchLogRecordProcessor(exporter);
425
- this.logProvider = new sdkLogs.LoggerProvider({
426
- processors: [processor]
427
- });
428
- this.logger = this.logProvider.getLogger(SDK_LOGGER_NAME);
429
- }
430
- /**
431
- * Track a telemetry event
432
- */
433
- track(eventName, name, extraAttributes = {}) {
434
- try {
435
- // Skip if logger not initialized
436
- if (!this.logger) {
437
- return;
438
- }
439
- const finalDisplayName = name || eventName;
440
- const attributes = this.getEnrichedAttributes(extraAttributes, eventName);
441
- // Emit as log
442
- this.logger.emit({
443
- body: finalDisplayName,
444
- attributes: attributes,
445
- timestamp: Date.now(),
446
- });
447
- }
448
- catch (error) {
449
- // Silent failure
450
- console.debug('Failed to track telemetry event:', error);
451
- }
452
- }
453
- /**
454
- * Get enriched attributes for telemetry events
455
- */
456
- getEnrichedAttributes(extraAttributes, eventName) {
457
- const attributes = {
458
- [APP_NAME]: SDK_SERVICE_NAME,
459
- [VERSION]: SDK_VERSION,
460
- [SERVICE]: eventName,
461
- [CLOUD_URL]: this.createCloudUrl(),
462
- [CLOUD_ORGANIZATION_NAME]: this.telemetryContext?.orgName || UNKNOWN,
463
- [CLOUD_TENANT_NAME]: this.telemetryContext?.tenantName || UNKNOWN,
464
- [CLOUD_REDIRECT_URI]: this.telemetryContext?.redirectUri || UNKNOWN,
465
- [CLOUD_CLIENT_ID]: this.telemetryContext?.clientId || UNKNOWN,
466
- ...extraAttributes,
467
- };
468
- return attributes;
469
- }
470
- /**
471
- * Create cloud URL from base URL, organization ID, and tenant ID
472
- */
473
- createCloudUrl() {
474
- const baseUrl = this.telemetryContext?.baseUrl;
475
- const orgId = this.telemetryContext?.orgName;
476
- const tenantId = this.telemetryContext?.tenantName;
477
- if (!baseUrl || !orgId || !tenantId) {
478
- return UNKNOWN;
479
- }
480
- return `${baseUrl}/${orgId}/${tenantId}`;
481
- }
482
- }
483
- // Export singleton instance
484
- const telemetryClient = TelemetryClient.getInstance();
276
+ * SDK Telemetry constants.
277
+ *
278
+ * Only the SDK's identity (version, service name, role name, …) lives
279
+ * here. The Application Insights connection string is injected into
280
+ * `@uipath/core-telemetry` itself at publish time, and the generic attribute
281
+ * keys (`Version`, `Service`, `CloudOrganizationName`, …) are owned by
282
+ * `@uipath/core-telemetry` and consumed there — they are not part of the
283
+ * SDK's public API.
284
+ */
285
+ /** SDK version placeholder — patched by the SDK publish workflow. */
286
+ const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
485
287
 
486
288
  /**
487
- * SDK Track decorator and function for telemetry
488
- */
489
- /**
490
- * Common tracking logic shared between method and function decorators
491
- */
492
- function createTrackedFunction(originalFunction, nameOrOptions, fallbackName, opts) {
493
- return function (...args) {
494
- // Determine if we should track this call
495
- let shouldTrack = true;
496
- if (opts.condition !== undefined) {
497
- if (typeof opts.condition === 'function') {
498
- shouldTrack = opts.condition.apply(this, args);
499
- }
500
- else {
501
- shouldTrack = opts.condition;
502
- }
503
- }
504
- // Track the event if enabled
505
- if (shouldTrack) {
506
- // Use the full name provided in the decorator (e.g., "Queue.GetAll")
507
- const serviceMethod = typeof nameOrOptions === 'string'
508
- ? nameOrOptions
509
- : fallbackName;
510
- // Use 'Sdk.Run' as the name and serviceMethod as the service
511
- telemetryClient.track(serviceMethod, SDK_RUN_EVENT, opts.attributes);
512
- }
513
- // Execute the original function
514
- return originalFunction.apply(this, args);
515
- };
516
- }
517
- /**
518
- * Track decorator that can be used to automatically track function calls
519
- *
520
- * Usage:
521
- * @track("Service.Method")
522
- * function myFunction() { ... }
523
- *
524
- * @track("Queue.GetAll")
525
- * async getAll() { ... }
289
+ * UiPath TypeScript SDK Telemetry
526
290
  *
527
- * @track("Tasks.Create")
528
- * async create() { ... }
529
- *
530
- * @track("Assets.Update", { condition: false })
531
- * function myFunction() { ... }
532
- *
533
- * @track("Processes.Start", { attributes: { customProp: "value" } })
534
- * function myFunction() { ... }
535
- */
536
- function track(nameOrOptions, options) {
537
- return function decorator(_target, propertyKey, descriptor) {
538
- const opts = typeof nameOrOptions === 'object' ? nameOrOptions : {};
539
- if (descriptor && typeof descriptor.value === 'function') {
540
- // Method decorator
541
- descriptor.value = createTrackedFunction(descriptor.value, nameOrOptions, propertyKey || 'unknown_method', opts);
542
- return descriptor;
543
- }
544
- // Function decorator
545
- return (originalFunction) => createTrackedFunction(originalFunction, nameOrOptions, originalFunction.name || 'unknown_function', opts);
546
- };
547
- }
291
+ * Constructs the SDK's own `TelemetryClient` and binds the SDK-local
292
+ * `track` / `trackEvent` to it. Each consumer of `@uipath/core-telemetry`
293
+ * does this independently, so events carry their own consumer's identity
294
+ * and tenant context.
295
+ */
296
+ // Keyed by `CLOUD_ROLE_NAME` so every SDK subpath bundle resolves to the
297
+ // same `TelemetryClient` instance at runtime. A single `initialize(...)`
298
+ // from the `UiPath` constructor therefore wires up `@track` decorators
299
+ // across every subpath bundle (`assets`, `feedback`, `tasks`, …).
300
+ const sdkClient = coreTelemetry.getOrCreateClient(CLOUD_ROLE_NAME);
301
+ const track = coreTelemetry.createTrack(sdkClient);
302
+ coreTelemetry.createTrackEvent(sdkClient);
548
303
 
549
304
  exports.TaskUserType = void 0;
550
305
  (function (TaskUserType) {
@@ -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.
@@ -271,278 +271,33 @@ class NetworkError extends UiPathError {
271
271
  }
272
272
 
273
273
  /**
274
- * SDK Telemetry constants
275
- */
276
- // Connection string placeholder that will be replaced during build
277
- 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";
278
- // SDK Version placeholder
279
- const SDK_VERSION = "1.3.8";
280
- const VERSION = "Version";
281
- const SERVICE = "Service";
282
- const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
283
- const CLOUD_TENANT_NAME = "CloudTenantName";
284
- const CLOUD_URL = "CloudUrl";
285
- const CLOUD_CLIENT_ID = "CloudClientId";
286
- const CLOUD_REDIRECT_URI = "CloudRedirectUri";
287
- const APP_NAME = "ApplicationName";
288
- const CLOUD_ROLE_NAME = "uipath-ts-sdk";
289
- // Service and logger names
290
- const SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
291
- const SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
292
- // Event names
293
- const SDK_RUN_EVENT = "Sdk.Run";
294
- // Default value for unknown/empty attributes
295
- const UNKNOWN = "";
296
-
297
- /**
298
- * Log exporter that sends ALL logs as Application Insights custom events
299
- */
300
- class ApplicationInsightsEventExporter {
301
- constructor(connectionString) {
302
- this.connectionString = connectionString;
303
- }
304
- export(logs, resultCallback) {
305
- try {
306
- logs.forEach(logRecord => {
307
- this.sendAsCustomEvent(logRecord);
308
- });
309
- resultCallback({ code: 0 });
310
- }
311
- catch (error) {
312
- console.debug('Failed to export logs to Application Insights:', error);
313
- resultCallback({ code: 2, error });
314
- }
315
- }
316
- shutdown() {
317
- return Promise.resolve();
318
- }
319
- sendAsCustomEvent(logRecord) {
320
- // Get event name from body or attributes
321
- const eventName = logRecord.body || SDK_RUN_EVENT;
322
- const payload = {
323
- name: 'Microsoft.ApplicationInsights.Event',
324
- time: new Date().toISOString(),
325
- iKey: this.extractInstrumentationKey(),
326
- data: {
327
- baseType: 'EventData',
328
- baseData: {
329
- ver: 2,
330
- name: eventName,
331
- properties: this.convertAttributesToProperties(logRecord.attributes || {})
332
- }
333
- },
334
- tags: {
335
- 'ai.cloud.role': CLOUD_ROLE_NAME,
336
- 'ai.cloud.roleInstance': SDK_VERSION
337
- }
338
- };
339
- this.sendToApplicationInsights(payload);
340
- }
341
- extractInstrumentationKey() {
342
- const match = this.connectionString.match(/InstrumentationKey=([^;]+)/);
343
- return match ? match[1] : '';
344
- }
345
- convertAttributesToProperties(attributes) {
346
- const properties = {};
347
- Object.entries(attributes || {}).forEach(([key, value]) => {
348
- properties[key] = String(value);
349
- });
350
- return properties;
351
- }
352
- async sendToApplicationInsights(payload) {
353
- try {
354
- const ingestionEndpoint = this.extractIngestionEndpoint();
355
- if (!ingestionEndpoint) {
356
- console.debug('No ingestion endpoint found in connection string');
357
- return;
358
- }
359
- const url = `${ingestionEndpoint}/v2/track`;
360
- const response = await fetch(url, {
361
- method: 'POST',
362
- headers: {
363
- 'Content-Type': 'application/json',
364
- },
365
- body: JSON.stringify(payload)
366
- });
367
- if (!response.ok) {
368
- console.debug(`Failed to send event telemetry: ${response.status} ${response.statusText}`);
369
- }
370
- }
371
- catch (error) {
372
- console.debug('Error sending event telemetry to Application Insights:', error);
373
- }
374
- }
375
- extractIngestionEndpoint() {
376
- const match = this.connectionString.match(/IngestionEndpoint=([^;]+)/);
377
- return match ? match[1] : '';
378
- }
379
- }
380
- /**
381
- * Singleton telemetry client
382
- */
383
- class TelemetryClient {
384
- constructor() {
385
- this.isInitialized = false;
386
- }
387
- static getInstance() {
388
- if (!TelemetryClient.instance) {
389
- TelemetryClient.instance = new TelemetryClient();
390
- }
391
- return TelemetryClient.instance;
392
- }
393
- /**
394
- * Initialize telemetry
395
- */
396
- initialize(config) {
397
- if (this.isInitialized) {
398
- return;
399
- }
400
- this.isInitialized = true;
401
- if (config) {
402
- this.telemetryContext = config;
403
- }
404
- try {
405
- const connectionString = this.getConnectionString();
406
- if (!connectionString) {
407
- return;
408
- }
409
- this.setupTelemetryProvider(connectionString);
410
- }
411
- catch (error) {
412
- // Silent failure - telemetry errors shouldn't break functionality
413
- console.debug('Failed to initialize OpenTelemetry:', error);
414
- }
415
- }
416
- getConnectionString() {
417
- const connectionString = CONNECTION_STRING;
418
- return connectionString;
419
- }
420
- setupTelemetryProvider(connectionString) {
421
- const exporter = new ApplicationInsightsEventExporter(connectionString);
422
- const processor = new BatchLogRecordProcessor(exporter);
423
- this.logProvider = new LoggerProvider({
424
- processors: [processor]
425
- });
426
- this.logger = this.logProvider.getLogger(SDK_LOGGER_NAME);
427
- }
428
- /**
429
- * Track a telemetry event
430
- */
431
- track(eventName, name, extraAttributes = {}) {
432
- try {
433
- // Skip if logger not initialized
434
- if (!this.logger) {
435
- return;
436
- }
437
- const finalDisplayName = name || eventName;
438
- const attributes = this.getEnrichedAttributes(extraAttributes, eventName);
439
- // Emit as log
440
- this.logger.emit({
441
- body: finalDisplayName,
442
- attributes: attributes,
443
- timestamp: Date.now(),
444
- });
445
- }
446
- catch (error) {
447
- // Silent failure
448
- console.debug('Failed to track telemetry event:', error);
449
- }
450
- }
451
- /**
452
- * Get enriched attributes for telemetry events
453
- */
454
- getEnrichedAttributes(extraAttributes, eventName) {
455
- const attributes = {
456
- [APP_NAME]: SDK_SERVICE_NAME,
457
- [VERSION]: SDK_VERSION,
458
- [SERVICE]: eventName,
459
- [CLOUD_URL]: this.createCloudUrl(),
460
- [CLOUD_ORGANIZATION_NAME]: this.telemetryContext?.orgName || UNKNOWN,
461
- [CLOUD_TENANT_NAME]: this.telemetryContext?.tenantName || UNKNOWN,
462
- [CLOUD_REDIRECT_URI]: this.telemetryContext?.redirectUri || UNKNOWN,
463
- [CLOUD_CLIENT_ID]: this.telemetryContext?.clientId || UNKNOWN,
464
- ...extraAttributes,
465
- };
466
- return attributes;
467
- }
468
- /**
469
- * Create cloud URL from base URL, organization ID, and tenant ID
470
- */
471
- createCloudUrl() {
472
- const baseUrl = this.telemetryContext?.baseUrl;
473
- const orgId = this.telemetryContext?.orgName;
474
- const tenantId = this.telemetryContext?.tenantName;
475
- if (!baseUrl || !orgId || !tenantId) {
476
- return UNKNOWN;
477
- }
478
- return `${baseUrl}/${orgId}/${tenantId}`;
479
- }
480
- }
481
- // Export singleton instance
482
- const telemetryClient = TelemetryClient.getInstance();
274
+ * SDK Telemetry constants.
275
+ *
276
+ * Only the SDK's identity (version, service name, role name, …) lives
277
+ * here. The Application Insights connection string is injected into
278
+ * `@uipath/core-telemetry` itself at publish time, and the generic attribute
279
+ * keys (`Version`, `Service`, `CloudOrganizationName`, …) are owned by
280
+ * `@uipath/core-telemetry` and consumed there — they are not part of the
281
+ * SDK's public API.
282
+ */
283
+ /** SDK version placeholder — patched by the SDK publish workflow. */
284
+ const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
483
285
 
484
286
  /**
485
- * SDK Track decorator and function for telemetry
486
- */
487
- /**
488
- * Common tracking logic shared between method and function decorators
489
- */
490
- function createTrackedFunction(originalFunction, nameOrOptions, fallbackName, opts) {
491
- return function (...args) {
492
- // Determine if we should track this call
493
- let shouldTrack = true;
494
- if (opts.condition !== undefined) {
495
- if (typeof opts.condition === 'function') {
496
- shouldTrack = opts.condition.apply(this, args);
497
- }
498
- else {
499
- shouldTrack = opts.condition;
500
- }
501
- }
502
- // Track the event if enabled
503
- if (shouldTrack) {
504
- // Use the full name provided in the decorator (e.g., "Queue.GetAll")
505
- const serviceMethod = typeof nameOrOptions === 'string'
506
- ? nameOrOptions
507
- : fallbackName;
508
- // Use 'Sdk.Run' as the name and serviceMethod as the service
509
- telemetryClient.track(serviceMethod, SDK_RUN_EVENT, opts.attributes);
510
- }
511
- // Execute the original function
512
- return originalFunction.apply(this, args);
513
- };
514
- }
515
- /**
516
- * Track decorator that can be used to automatically track function calls
517
- *
518
- * Usage:
519
- * @track("Service.Method")
520
- * function myFunction() { ... }
521
- *
522
- * @track("Queue.GetAll")
523
- * async getAll() { ... }
287
+ * UiPath TypeScript SDK Telemetry
524
288
  *
525
- * @track("Tasks.Create")
526
- * async create() { ... }
527
- *
528
- * @track("Assets.Update", { condition: false })
529
- * function myFunction() { ... }
530
- *
531
- * @track("Processes.Start", { attributes: { customProp: "value" } })
532
- * function myFunction() { ... }
533
- */
534
- function track(nameOrOptions, options) {
535
- return function decorator(_target, propertyKey, descriptor) {
536
- const opts = typeof nameOrOptions === 'object' ? nameOrOptions : {};
537
- if (descriptor && typeof descriptor.value === 'function') {
538
- // Method decorator
539
- descriptor.value = createTrackedFunction(descriptor.value, nameOrOptions, propertyKey || 'unknown_method', opts);
540
- return descriptor;
541
- }
542
- // Function decorator
543
- return (originalFunction) => createTrackedFunction(originalFunction, nameOrOptions, originalFunction.name || 'unknown_function', opts);
544
- };
545
- }
289
+ * Constructs the SDK's own `TelemetryClient` and binds the SDK-local
290
+ * `track` / `trackEvent` to it. Each consumer of `@uipath/core-telemetry`
291
+ * does this independently, so events carry their own consumer's identity
292
+ * and tenant context.
293
+ */
294
+ // Keyed by `CLOUD_ROLE_NAME` so every SDK subpath bundle resolves to the
295
+ // same `TelemetryClient` instance at runtime. A single `initialize(...)`
296
+ // from the `UiPath` constructor therefore wires up `@track` decorators
297
+ // across every subpath bundle (`assets`, `feedback`, `tasks`, …).
298
+ const sdkClient = getOrCreateClient(CLOUD_ROLE_NAME);
299
+ const track = createTrack(sdkClient);
300
+ createTrackEvent(sdkClient);
546
301
 
547
302
  var TaskUserType;
548
303
  (function (TaskUserType) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/uipath-typescript",
3
- "version": "1.3.8",
3
+ "version": "1.3.9",
4
4
  "description": "UiPath TypeScript SDK",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -177,14 +177,15 @@
177
177
  "build": "rollup -c",
178
178
  "build:watch": "rollup -c -w",
179
179
  "clean": "rimraf dist && rimraf node_modules && rimraf package-lock.json",
180
- "docs:api": "typedoc && npm run docs:post-process && npm run docs:coded-action-apps",
181
- "docs:coded-action-apps": "npm run docs --prefix packages/coded-action-apps",
180
+ "docs:api": "typedoc && npm run docs:post-process && npm run docs:coded-action-app",
181
+ "docs:coded-action-app": "npm run docs --prefix packages/coded-action-app",
182
182
  "docs:post-process": "node scripts/docs-post-process.mjs",
183
183
  "lint": "oxlint",
184
184
  "typecheck": "tsc --noEmit",
185
185
  "test": "vitest",
186
- "test:unit": "vitest tests/unit",
186
+ "test:unit": "vitest run",
187
187
  "test:integration": "vitest --config vitest.integration.config.ts",
188
+ "test:integration:coverage": "vitest --config vitest.integration.config.ts --coverage",
188
189
  "test:integration:v0": "vitest --config vitest.integration.config.ts --testNamePattern='\\[v0\\]'",
189
190
  "test:integration:v1": "vitest --config vitest.integration.config.ts --testNamePattern='\\[v1\\]'",
190
191
  "test:integration:smoke": "vitest tests/integration/shared/smoke.integration.test.ts --config vitest.integration.config.ts",
@@ -195,7 +196,7 @@
195
196
  "test:coverage": "vitest --coverage"
196
197
  },
197
198
  "dependencies": {
198
- "@opentelemetry/sdk-logs": "^0.204.0",
199
+ "@uipath/core-telemetry": "^1.0.0-beta.1",
199
200
  "socket.io-client": "^4.8.1"
200
201
  },
201
202
  "peerDependencies": {
@@ -215,7 +216,7 @@
215
216
  "dotenv": "^17.2.0",
216
217
  "oxlint": "^1.43.0",
217
218
  "rimraf": "^6.0.1",
218
- "rollup": "^4.60.2",
219
+ "rollup": "^4.60.4",
219
220
  "rollup-plugin-dts": "^6.1.0",
220
221
  "tslib": "^2.8.1",
221
222
  "typedoc": "^0.28.13",
@@ -226,8 +227,5 @@
226
227
  "repository": {
227
228
  "type": "git",
228
229
  "url": "git+https://github.com/UiPath/uipath-typescript.git"
229
- },
230
- "workspaces": [
231
- "packages/*"
232
- ]
230
+ }
233
231
  }