@uipath/uipath-typescript 1.1.0 → 1.1.2

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.
@@ -16,6 +16,9 @@ type UiPathSDKConfig = BaseConfig & ({
16
16
  } | ({
17
17
  secret?: never;
18
18
  } & OAuthFields));
19
+ type PartialUiPathConfig = Partial<BaseConfig & OAuthFields & {
20
+ secret: string;
21
+ }>;
19
22
 
20
23
  /**
21
24
  * IUiPath - Interface for UiPath SDK instance
@@ -56,6 +59,11 @@ interface IUiPath {
56
59
  * Get the current authentication token
57
60
  */
58
61
  getToken(): string | undefined;
62
+ /**
63
+ * Logout from the SDK, clearing all authentication state.
64
+ * After calling this method, the user will need to re-initialize to authenticate again.
65
+ */
66
+ logout(): void;
59
67
  }
60
68
 
61
69
  /**
@@ -64,12 +72,13 @@ interface IUiPath {
64
72
  * Handles authentication, configuration, and provides access to SDK internals
65
73
  * for service instantiation in the modular pattern.
66
74
  *
75
+ * Supports two usage patterns:
76
+ * 1. Full config in constructor — for server-side or explicit configuration
77
+ * 2. No config / partial config — loads from meta tags injected by @uipath/coded-apps plugin
78
+ *
67
79
  * @example
68
80
  * ```typescript
69
- * // Modular pattern
70
- * import { UiPath } from '@uipath/uipath-typescript/core';
71
- * import { Entities } from '@uipath/uipath-typescript/entities';
72
- *
81
+ * // Explicit config
73
82
  * const sdk = new UiPath({
74
83
  * baseUrl: 'https://cloud.uipath.com',
75
84
  * orgName: 'myorg',
@@ -78,22 +87,26 @@ interface IUiPath {
78
87
  * redirectUri: 'http://localhost:3000/callback',
79
88
  * scope: 'OR.Users OR.Robots'
80
89
  * });
81
- *
82
90
  * await sdk.initialize();
91
+ * ```
83
92
  *
84
- * const entitiesService = new Entities(sdk);
85
- * const allEntities = await entitiesService.getAll();
93
+ * @example
94
+ * ```typescript
95
+ * // Auto-load from meta tags (coded apps)
96
+ * const sdk = new UiPath();
97
+ * await sdk.initialize();
86
98
  * ```
87
99
  */
88
100
  declare class UiPath implements IUiPath {
89
101
  #private;
90
102
  /** Read-only config for user convenience */
91
103
  readonly config: Readonly<BaseConfig>;
92
- constructor(config: UiPathSDKConfig);
104
+ constructor(config?: PartialUiPathConfig);
93
105
  /**
94
106
  * Initialize the SDK based on the provided configuration.
95
107
  * This method handles both OAuth flow initiation and completion automatically.
96
108
  * For secret-based authentication, initialization is automatic and this returns immediately.
109
+ * If no config was provided in constructor, loads from meta tags.
97
110
  */
98
111
  initialize(): Promise<void>;
99
112
  /**
@@ -116,6 +129,11 @@ declare class UiPath implements IUiPath {
116
129
  * Get the current authentication token
117
130
  */
118
131
  getToken(): string | undefined;
132
+ /**
133
+ * Logout from the SDK, clearing all authentication state.
134
+ * After calling this method, the user will need to re-initialize to authenticate again.
135
+ */
136
+ logout(): void;
119
137
  }
120
138
 
121
139
  /**
@@ -394,5 +412,103 @@ declare const DEFAULT_TOTAL_COUNT_FIELD = "@odata.count";
394
412
  */
395
413
  declare function getLimitedPageSize(pageSize?: number): number;
396
414
 
397
- 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 };
415
+ /**
416
+ * Telemetry type definitions
417
+ */
418
+ interface TelemetryAttributes {
419
+ [key: string]: string | number | boolean;
420
+ }
421
+ interface TelemetryConfig {
422
+ baseUrl?: string;
423
+ orgName?: string;
424
+ tenantName?: string;
425
+ clientId?: string;
426
+ redirectUri?: string;
427
+ }
428
+ interface TrackOptions {
429
+ condition?: boolean | ((...args: any[]) => boolean);
430
+ attributes?: TelemetryAttributes;
431
+ }
432
+
433
+ /**
434
+ * SDK Track decorator and function for telemetry
435
+ */
436
+
437
+ /**
438
+ * Track decorator that can be used to automatically track function calls
439
+ *
440
+ * Usage:
441
+ * @track("Service.Method")
442
+ * function myFunction() { ... }
443
+ *
444
+ * @track("Queue.GetAll")
445
+ * async getAll() { ... }
446
+ *
447
+ * @track("Tasks.Create")
448
+ * async create() { ... }
449
+ *
450
+ * @track("Assets.Update", { condition: false })
451
+ * function myFunction() { ... }
452
+ *
453
+ * @track("Processes.Start", { attributes: { customProp: "value" } })
454
+ * function myFunction() { ... }
455
+ */
456
+ declare function track(nameOrOptions?: string | TrackOptions, options?: TrackOptions): MethodDecorator | ((target: any) => any);
457
+ /**
458
+ * Direct tracking function
459
+ */
460
+ declare function trackEvent(eventName: string, name?: string, attributes?: TelemetryAttributes): void;
461
+
462
+ /**
463
+ * Singleton telemetry client
464
+ */
465
+ declare class TelemetryClient {
466
+ private static instance;
467
+ private isInitialized;
468
+ private logProvider?;
469
+ private logger?;
470
+ private telemetryContext?;
471
+ private constructor();
472
+ static getInstance(): TelemetryClient;
473
+ /**
474
+ * Initialize telemetry
475
+ */
476
+ initialize(config?: TelemetryConfig): void;
477
+ private getConnectionString;
478
+ private setupTelemetryProvider;
479
+ /**
480
+ * Track a telemetry event
481
+ */
482
+ track(eventName: string, name?: string, extraAttributes?: TelemetryAttributes): void;
483
+ /**
484
+ * Get enriched attributes for telemetry events
485
+ */
486
+ private getEnrichedAttributes;
487
+ /**
488
+ * Create cloud URL from base URL, organization ID, and tenant ID
489
+ */
490
+ private createCloudUrl;
491
+ }
492
+ declare const telemetryClient: TelemetryClient;
493
+
494
+ /**
495
+ * SDK Telemetry constants
496
+ */
497
+ 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";
498
+ declare const SDK_VERSION = "1.1.2";
499
+ declare const VERSION = "Version";
500
+ declare const SERVICE = "Service";
501
+ declare const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
502
+ declare const CLOUD_TENANT_NAME = "CloudTenantName";
503
+ declare const CLOUD_URL = "CloudUrl";
504
+ declare const CLOUD_CLIENT_ID = "CloudClientId";
505
+ declare const CLOUD_REDIRECT_URI = "CloudRedirectUri";
506
+ declare const APP_NAME = "ApplicationName";
507
+ declare const CLOUD_ROLE_NAME = "uipath-ts-sdk";
508
+ declare const SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
509
+ declare const SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
510
+ declare const SDK_RUN_EVENT = "Sdk.Run";
511
+ declare const UNKNOWN = "";
512
+
513
+ 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 };
398
514
  export type { HasPaginationOptions, NonPaginatedResponse, PaginatedResponse, PaginationCursor, PaginationMethodUnion, PaginationOptions, UiPathSDKConfig };