@uipath/uipath-typescript 1.0.0-beta.18 → 1.1.0

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/LICENSE +2 -2
  2. package/README.md +100 -40
  3. package/dist/assets/index.cjs +2068 -0
  4. package/dist/assets/index.d.ts +513 -0
  5. package/dist/assets/index.mjs +2065 -0
  6. package/dist/buckets/index.cjs +2342 -0
  7. package/dist/buckets/index.d.ts +819 -0
  8. package/dist/buckets/index.mjs +2339 -0
  9. package/dist/cases/index.cjs +3475 -0
  10. package/dist/cases/index.d.ts +1397 -0
  11. package/dist/cases/index.mjs +3469 -0
  12. package/dist/conversational-agent/index.cjs +6622 -0
  13. package/dist/conversational-agent/index.d.ts +6579 -0
  14. package/dist/conversational-agent/index.mjs +6575 -0
  15. package/dist/core/index.cjs +5305 -0
  16. package/dist/core/index.d.ts +398 -0
  17. package/dist/core/index.mjs +5279 -0
  18. package/dist/entities/index.cjs +2727 -0
  19. package/dist/entities/index.d.ts +1513 -0
  20. package/dist/entities/index.mjs +2721 -0
  21. package/dist/index.cjs +3651 -2935
  22. package/dist/index.d.ts +5341 -590
  23. package/dist/index.mjs +3644 -2935
  24. package/dist/index.umd.js +8118 -11244
  25. package/dist/maestro-processes/index.cjs +2587 -0
  26. package/dist/maestro-processes/index.d.ts +1127 -0
  27. package/dist/maestro-processes/index.mjs +2578 -0
  28. package/dist/processes/index.cjs +2247 -0
  29. package/dist/processes/index.d.ts +800 -0
  30. package/dist/processes/index.mjs +2244 -0
  31. package/dist/queues/index.cjs +2053 -0
  32. package/dist/queues/index.d.ts +504 -0
  33. package/dist/queues/index.mjs +2050 -0
  34. package/dist/tasks/index.cjs +2653 -0
  35. package/dist/tasks/index.d.ts +1122 -0
  36. package/dist/tasks/index.mjs +2649 -0
  37. package/package.json +118 -6
  38. package/dist/index.d.cts +0 -5463
  39. package/dist/index.d.mts +0 -5463
@@ -0,0 +1,398 @@
1
+ interface BaseConfig {
2
+ baseUrl: string;
3
+ orgName: string;
4
+ tenantName: string;
5
+ }
6
+ interface OAuthFields {
7
+ clientId: string;
8
+ redirectUri: string;
9
+ scope: string;
10
+ }
11
+ type UiPathSDKConfig = BaseConfig & ({
12
+ secret: string;
13
+ clientId?: never;
14
+ redirectUri?: never;
15
+ scope?: never;
16
+ } | ({
17
+ secret?: never;
18
+ } & OAuthFields));
19
+
20
+ /**
21
+ * IUiPath - Interface for UiPath SDK instance
22
+ *
23
+ * This interface defines the public contract for the UiPath SDK.
24
+ * Services depend on this interface rather than the concrete UiPath class,
25
+ * enabling proper type sharing across modular imports without #private field issues.
26
+ *
27
+ * @internal This interface is for internal SDK use only
28
+ */
29
+
30
+ interface IUiPath {
31
+ /** Read-only configuration for the SDK instance */
32
+ readonly config: Readonly<BaseConfig>;
33
+ /**
34
+ * Initialize the SDK based on the provided configuration.
35
+ * For secret-based auth, this returns immediately.
36
+ * For OAuth, this handles the authentication flow.
37
+ */
38
+ initialize(): Promise<void>;
39
+ /**
40
+ * Check if the SDK has been initialized
41
+ */
42
+ isInitialized(): boolean;
43
+ /**
44
+ * Check if we're in an OAuth callback state
45
+ */
46
+ isInOAuthCallback(): boolean;
47
+ /**
48
+ * Complete OAuth authentication flow
49
+ */
50
+ completeOAuth(): Promise<boolean>;
51
+ /**
52
+ * Check if the user is authenticated (has valid token)
53
+ */
54
+ isAuthenticated(): boolean;
55
+ /**
56
+ * Get the current authentication token
57
+ */
58
+ getToken(): string | undefined;
59
+ }
60
+
61
+ /**
62
+ * UiPath - Core SDK class for authentication and configuration management.
63
+ *
64
+ * Handles authentication, configuration, and provides access to SDK internals
65
+ * for service instantiation in the modular pattern.
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * // Modular pattern
70
+ * import { UiPath } from '@uipath/uipath-typescript/core';
71
+ * import { Entities } from '@uipath/uipath-typescript/entities';
72
+ *
73
+ * const sdk = new UiPath({
74
+ * baseUrl: 'https://cloud.uipath.com',
75
+ * orgName: 'myorg',
76
+ * tenantName: 'mytenant',
77
+ * clientId: 'xxx',
78
+ * redirectUri: 'http://localhost:3000/callback',
79
+ * scope: 'OR.Users OR.Robots'
80
+ * });
81
+ *
82
+ * await sdk.initialize();
83
+ *
84
+ * const entitiesService = new Entities(sdk);
85
+ * const allEntities = await entitiesService.getAll();
86
+ * ```
87
+ */
88
+ declare class UiPath implements IUiPath {
89
+ #private;
90
+ /** Read-only config for user convenience */
91
+ readonly config: Readonly<BaseConfig>;
92
+ constructor(config: UiPathSDKConfig);
93
+ /**
94
+ * Initialize the SDK based on the provided configuration.
95
+ * This method handles both OAuth flow initiation and completion automatically.
96
+ * For secret-based authentication, initialization is automatic and this returns immediately.
97
+ */
98
+ initialize(): Promise<void>;
99
+ /**
100
+ * Check if the SDK has been initialized
101
+ */
102
+ isInitialized(): boolean;
103
+ /**
104
+ * Check if we're in an OAuth callback state
105
+ */
106
+ isInOAuthCallback(): boolean;
107
+ /**
108
+ * Complete OAuth authentication flow (only call if isInOAuthCallback() is true)
109
+ */
110
+ completeOAuth(): Promise<boolean>;
111
+ /**
112
+ * Check if the user is authenticated (has valid token)
113
+ */
114
+ isAuthenticated(): boolean;
115
+ /**
116
+ * Get the current authentication token
117
+ */
118
+ getToken(): string | undefined;
119
+ }
120
+
121
+ /**
122
+ * Error thrown when authorization fails (403 errors)
123
+ * Common scenarios:
124
+ * - Insufficient permissions
125
+ * - Access denied to resource
126
+ * - Invalid scope
127
+ */
128
+ declare class AuthorizationError extends UiPathError {
129
+ constructor(params?: Partial<ErrorParams>);
130
+ }
131
+
132
+ /**
133
+ * Error thrown when validation fails (400 errors or client-side validation)
134
+ * Common scenarios:
135
+ * - Invalid input parameters
136
+ * - Missing required fields
137
+ * - Invalid data format
138
+ */
139
+ declare class ValidationError extends UiPathError {
140
+ constructor(params?: Partial<ErrorParams>);
141
+ }
142
+
143
+ /**
144
+ * Error thrown when a resource is not found (404 errors)
145
+ * Common scenarios:
146
+ * - Resource doesn't exist
147
+ * - Invalid ID provided
148
+ * - Resource deleted
149
+ */
150
+ declare class NotFoundError extends UiPathError {
151
+ constructor(params?: Partial<ErrorParams>);
152
+ }
153
+
154
+ /**
155
+ * Error thrown when rate limit is exceeded (429 errors)
156
+ * Common scenarios:
157
+ * - Too many requests in a time window
158
+ * - API throttling
159
+ */
160
+ declare class RateLimitError extends UiPathError {
161
+ constructor(params?: Partial<ErrorParams>);
162
+ }
163
+
164
+ /**
165
+ * Error thrown when server encounters an error (5xx errors)
166
+ * Common scenarios:
167
+ * - Internal server error
168
+ * - Service unavailable
169
+ * - Gateway timeout
170
+ */
171
+ declare class ServerError extends UiPathError {
172
+ constructor(params?: Partial<ErrorParams>);
173
+ /**
174
+ * Checks if this is a temporary error that might succeed on retry
175
+ */
176
+ get isRetryable(): boolean;
177
+ }
178
+
179
+ /**
180
+ * Base error creation parameters - only what's needed
181
+ */
182
+ interface ErrorParams {
183
+ message: string;
184
+ statusCode?: number;
185
+ requestId?: string;
186
+ }
187
+
188
+ /**
189
+ * Base error class for all UiPath SDK errors
190
+ * Extends Error for standard error handling compatibility
191
+ */
192
+ declare abstract class UiPathError extends Error {
193
+ /**
194
+ * Error type identifier (e.g., "AuthenticationError", "ValidationError")
195
+ */
196
+ readonly type: string;
197
+ /**
198
+ * HTTP status code (400, 401, 403, 404, 500, etc.)
199
+ */
200
+ readonly statusCode?: number;
201
+ /**
202
+ * Request ID for tracking with UiPath support
203
+ */
204
+ readonly requestId?: string;
205
+ /**
206
+ * Timestamp when the error occurred
207
+ */
208
+ readonly timestamp: Date;
209
+ protected constructor(type: string, params: ErrorParams);
210
+ /**
211
+ * Returns a clean JSON representation of the error
212
+ */
213
+ private toJSON;
214
+ /**
215
+ * Returns detailed debug information including stack trace
216
+ */
217
+ getDebugInfo(): Record<string, unknown>;
218
+ }
219
+
220
+ /**
221
+ * Error thrown when authentication fails (401 errors)
222
+ * Common scenarios:
223
+ * - Invalid credentials
224
+ * - Expired token
225
+ * - Missing authentication
226
+ */
227
+ declare class AuthenticationError extends UiPathError {
228
+ constructor(params?: Partial<ErrorParams>);
229
+ }
230
+
231
+ /**
232
+ * Error thrown when network/connection issues occur
233
+ * Common scenarios:
234
+ * - Connection timeout
235
+ * - DNS resolution failure
236
+ * - Network unreachable
237
+ * - Request aborted
238
+ */
239
+ declare class NetworkError extends UiPathError {
240
+ constructor(params?: Partial<ErrorParams>);
241
+ }
242
+
243
+ /**
244
+ * Type guard to check if an error is a UiPathError
245
+ */
246
+ declare function isUiPathError(error: unknown): error is UiPathError;
247
+ /**
248
+ * Type guard to check if an error is an AuthenticationError
249
+ */
250
+ declare function isAuthenticationError(error: unknown): error is AuthenticationError;
251
+ /**
252
+ * Type guard to check if an error is an AuthorizationError
253
+ */
254
+ declare function isAuthorizationError(error: unknown): error is AuthorizationError;
255
+ /**
256
+ * Type guard to check if an error is a ValidationError
257
+ */
258
+ declare function isValidationError(error: unknown): error is ValidationError;
259
+ /**
260
+ * Type guard to check if an error is a NotFoundError
261
+ */
262
+ declare function isNotFoundError(error: unknown): error is NotFoundError;
263
+ /**
264
+ * Type guard to check if an error is a RateLimitError
265
+ */
266
+ declare function isRateLimitError(error: unknown): error is RateLimitError;
267
+ /**
268
+ * Type guard to check if an error is a ServerError
269
+ */
270
+ declare function isServerError(error: unknown): error is ServerError;
271
+ /**
272
+ * Type guard to check if an error is a NetworkError
273
+ */
274
+ declare function isNetworkError(error: unknown): error is NetworkError;
275
+ /**
276
+ * Helper to get error details in a safe way
277
+ */
278
+ declare function getErrorDetails(error: unknown): {
279
+ message: string;
280
+ statusCode?: number;
281
+ };
282
+
283
+ /**
284
+ * HTTP status code constants for error handling
285
+ */
286
+ declare const HttpStatus: {
287
+ readonly BAD_REQUEST: 400;
288
+ readonly UNAUTHORIZED: 401;
289
+ readonly FORBIDDEN: 403;
290
+ readonly NOT_FOUND: 404;
291
+ readonly TOO_MANY_REQUESTS: 429;
292
+ readonly INTERNAL_SERVER_ERROR: 500;
293
+ readonly NOT_IMPLEMENTED: 501;
294
+ readonly BAD_GATEWAY: 502;
295
+ readonly SERVICE_UNAVAILABLE: 503;
296
+ readonly GATEWAY_TIMEOUT: 504;
297
+ };
298
+ /**
299
+ * Error type constants for consistent error identification
300
+ */
301
+ declare const ErrorType: {
302
+ readonly AUTHENTICATION: "AuthenticationError";
303
+ readonly AUTHORIZATION: "AuthorizationError";
304
+ readonly VALIDATION: "ValidationError";
305
+ readonly NOT_FOUND: "NotFoundError";
306
+ readonly RATE_LIMIT: "RateLimitError";
307
+ readonly SERVER: "ServerError";
308
+ readonly NETWORK: "NetworkError";
309
+ };
310
+
311
+ /**
312
+ * Simplified universal pagination cursor
313
+ * Used to fetch next/previous pages
314
+ */
315
+ interface PaginationCursor {
316
+ /** Opaque string containing all information needed to fetch next page */
317
+ value: string;
318
+ }
319
+ /**
320
+ * Discriminated union for pagination methods - ensures cursor and jumpToPage are mutually exclusive
321
+ */
322
+ type PaginationMethodUnion = {
323
+ cursor?: PaginationCursor;
324
+ jumpToPage?: never;
325
+ } | {
326
+ cursor?: never;
327
+ jumpToPage?: number;
328
+ } | {
329
+ cursor?: never;
330
+ jumpToPage?: never;
331
+ };
332
+ /**
333
+ * Pagination options. Users cannot specify both cursor and jumpToPage.
334
+ */
335
+ type PaginationOptions = {
336
+ /** Size of the page to fetch (items per page) */
337
+ pageSize?: number;
338
+ } & PaginationMethodUnion;
339
+ /**
340
+ * Paginated response containing items and navigation information
341
+ */
342
+ interface PaginatedResponse<T> {
343
+ /** The items in the current page */
344
+ items: T[];
345
+ /** Total count of items across all pages (if available) */
346
+ totalCount?: number;
347
+ /** Whether more pages are available */
348
+ hasNextPage: boolean;
349
+ /** Cursor to fetch the next page (if available) */
350
+ nextCursor?: PaginationCursor;
351
+ /** Cursor to fetch the previous page (if available) */
352
+ previousCursor?: PaginationCursor;
353
+ /** Current page number (1-based, if available) */
354
+ currentPage?: number;
355
+ /** Total number of pages (if available) */
356
+ totalPages?: number;
357
+ /** Whether this pagination type supports jumping to arbitrary pages */
358
+ supportsPageJump: boolean;
359
+ }
360
+ /**
361
+ * Response for non-paginated calls that includes both data and total count
362
+ */
363
+ interface NonPaginatedResponse<T> {
364
+ items: T[];
365
+ totalCount?: number;
366
+ }
367
+ /**
368
+ * Helper type for defining paginated method overloads
369
+ * Creates a union type of all ways pagination can be triggered
370
+ */
371
+ type HasPaginationOptions<T> = (T & {
372
+ pageSize: number;
373
+ }) | (T & {
374
+ cursor: PaginationCursor;
375
+ }) | (T & {
376
+ jumpToPage: number;
377
+ });
378
+
379
+ /**
380
+ * Constants used throughout the pagination system
381
+ */
382
+ /** Maximum number of items that can be requested in a single page */
383
+ declare const MAX_PAGE_SIZE = 1000;
384
+ /** Default page size when jumpToPage is used without specifying pageSize */
385
+ declare const DEFAULT_PAGE_SIZE = 50;
386
+ /** Default field name for items in a paginated response */
387
+ declare const DEFAULT_ITEMS_FIELD = "value";
388
+ /** Default field name for total count in a paginated response */
389
+ declare const DEFAULT_TOTAL_COUNT_FIELD = "@odata.count";
390
+ /**
391
+ * Limits the page size to the maximum allowed value
392
+ * @param pageSize - Requested page size
393
+ * @returns Limited page size value
394
+ */
395
+ declare function getLimitedPageSize(pageSize?: number): number;
396
+
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 };
398
+ export type { HasPaginationOptions, NonPaginatedResponse, PaginatedResponse, PaginationCursor, PaginationMethodUnion, PaginationOptions, UiPathSDKConfig };