@uipath/uipath-typescript 1.0.0 → 1.1.1

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.
@@ -56,6 +56,11 @@ interface IUiPath {
56
56
  * Get the current authentication token
57
57
  */
58
58
  getToken(): string | undefined;
59
+ /**
60
+ * Logout from the SDK, clearing all authentication state.
61
+ * After calling this method, the user will need to re-initialize to authenticate again.
62
+ */
63
+ logout(): void;
59
64
  }
60
65
 
61
66
  /**
@@ -116,6 +121,11 @@ declare class UiPath implements IUiPath {
116
121
  * Get the current authentication token
117
122
  */
118
123
  getToken(): string | undefined;
124
+ /**
125
+ * Logout from the SDK, clearing all authentication state.
126
+ * After calling this method, the user will need to re-initialize to authenticate again.
127
+ */
128
+ logout(): void;
119
129
  }
120
130
 
121
131
  /**
@@ -187,17 +197,13 @@ interface ErrorParams {
187
197
 
188
198
  /**
189
199
  * Base error class for all UiPath SDK errors
190
- * Pure TypeScript class with clean interface
200
+ * Extends Error for standard error handling compatibility
191
201
  */
192
- declare abstract class UiPathError {
202
+ declare abstract class UiPathError extends Error {
193
203
  /**
194
204
  * Error type identifier (e.g., "AuthenticationError", "ValidationError")
195
205
  */
196
206
  readonly type: string;
197
- /**
198
- * Error message describing what went wrong
199
- */
200
- readonly message: string;
201
207
  /**
202
208
  * HTTP status code (400, 401, 403, 404, 500, etc.)
203
209
  */
@@ -210,10 +216,6 @@ declare abstract class UiPathError {
210
216
  * Timestamp when the error occurred
211
217
  */
212
218
  readonly timestamp: Date;
213
- /**
214
- * Stack trace for debugging
215
- */
216
- readonly stack?: string;
217
219
  protected constructor(type: string, params: ErrorParams);
218
220
  /**
219
221
  * Returns a clean JSON representation of the error
@@ -402,5 +404,103 @@ declare const DEFAULT_TOTAL_COUNT_FIELD = "@odata.count";
402
404
  */
403
405
  declare function getLimitedPageSize(pageSize?: number): number;
404
406
 
405
- 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 };
407
+ /**
408
+ * Telemetry type definitions
409
+ */
410
+ interface TelemetryAttributes {
411
+ [key: string]: string | number | boolean;
412
+ }
413
+ interface TelemetryConfig {
414
+ baseUrl?: string;
415
+ orgName?: string;
416
+ tenantName?: string;
417
+ clientId?: string;
418
+ redirectUri?: string;
419
+ }
420
+ interface TrackOptions {
421
+ condition?: boolean | ((...args: any[]) => boolean);
422
+ attributes?: TelemetryAttributes;
423
+ }
424
+
425
+ /**
426
+ * SDK Track decorator and function for telemetry
427
+ */
428
+
429
+ /**
430
+ * Track decorator that can be used to automatically track function calls
431
+ *
432
+ * Usage:
433
+ * @track("Service.Method")
434
+ * function myFunction() { ... }
435
+ *
436
+ * @track("Queue.GetAll")
437
+ * async getAll() { ... }
438
+ *
439
+ * @track("Tasks.Create")
440
+ * async create() { ... }
441
+ *
442
+ * @track("Assets.Update", { condition: false })
443
+ * function myFunction() { ... }
444
+ *
445
+ * @track("Processes.Start", { attributes: { customProp: "value" } })
446
+ * function myFunction() { ... }
447
+ */
448
+ declare function track(nameOrOptions?: string | TrackOptions, options?: TrackOptions): MethodDecorator | ((target: any) => any);
449
+ /**
450
+ * Direct tracking function
451
+ */
452
+ declare function trackEvent(eventName: string, name?: string, attributes?: TelemetryAttributes): void;
453
+
454
+ /**
455
+ * Singleton telemetry client
456
+ */
457
+ declare class TelemetryClient {
458
+ private static instance;
459
+ private isInitialized;
460
+ private logProvider?;
461
+ private logger?;
462
+ private telemetryContext?;
463
+ private constructor();
464
+ static getInstance(): TelemetryClient;
465
+ /**
466
+ * Initialize telemetry
467
+ */
468
+ initialize(config?: TelemetryConfig): void;
469
+ private getConnectionString;
470
+ private setupTelemetryProvider;
471
+ /**
472
+ * Track a telemetry event
473
+ */
474
+ track(eventName: string, name?: string, extraAttributes?: TelemetryAttributes): void;
475
+ /**
476
+ * Get enriched attributes for telemetry events
477
+ */
478
+ private getEnrichedAttributes;
479
+ /**
480
+ * Create cloud URL from base URL, organization ID, and tenant ID
481
+ */
482
+ private createCloudUrl;
483
+ }
484
+ declare const telemetryClient: TelemetryClient;
485
+
486
+ /**
487
+ * SDK Telemetry constants
488
+ */
489
+ declare 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";
490
+ declare const SDK_VERSION = "1.1.1";
491
+ declare const VERSION = "Version";
492
+ declare const SERVICE = "Service";
493
+ declare const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
494
+ declare const CLOUD_TENANT_NAME = "CloudTenantName";
495
+ declare const CLOUD_URL = "CloudUrl";
496
+ declare const CLOUD_CLIENT_ID = "CloudClientId";
497
+ declare const CLOUD_REDIRECT_URI = "CloudRedirectUri";
498
+ declare const APP_NAME = "ApplicationName";
499
+ declare const CLOUD_ROLE_NAME = "uipath-ts-sdk";
500
+ declare const SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
501
+ declare const SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
502
+ declare const SDK_RUN_EVENT = "Sdk.Run";
503
+ declare const UNKNOWN = "";
504
+
505
+ 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 };
406
506
  export type { HasPaginationOptions, NonPaginatedResponse, PaginatedResponse, PaginationCursor, PaginationMethodUnion, PaginationOptions, UiPathSDKConfig };