@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,504 @@
1
+ import { IUiPath } from '../core/index';
2
+
3
+ /**
4
+ * Simplified universal pagination cursor
5
+ * Used to fetch next/previous pages
6
+ */
7
+ interface PaginationCursor {
8
+ /** Opaque string containing all information needed to fetch next page */
9
+ value: string;
10
+ }
11
+ /**
12
+ * Discriminated union for pagination methods - ensures cursor and jumpToPage are mutually exclusive
13
+ */
14
+ type PaginationMethodUnion = {
15
+ cursor?: PaginationCursor;
16
+ jumpToPage?: never;
17
+ } | {
18
+ cursor?: never;
19
+ jumpToPage?: number;
20
+ } | {
21
+ cursor?: never;
22
+ jumpToPage?: never;
23
+ };
24
+ /**
25
+ * Pagination options. Users cannot specify both cursor and jumpToPage.
26
+ */
27
+ type PaginationOptions = {
28
+ /** Size of the page to fetch (items per page) */
29
+ pageSize?: number;
30
+ } & PaginationMethodUnion;
31
+ /**
32
+ * Paginated response containing items and navigation information
33
+ */
34
+ interface PaginatedResponse<T> {
35
+ /** The items in the current page */
36
+ items: T[];
37
+ /** Total count of items across all pages (if available) */
38
+ totalCount?: number;
39
+ /** Whether more pages are available */
40
+ hasNextPage: boolean;
41
+ /** Cursor to fetch the next page (if available) */
42
+ nextCursor?: PaginationCursor;
43
+ /** Cursor to fetch the previous page (if available) */
44
+ previousCursor?: PaginationCursor;
45
+ /** Current page number (1-based, if available) */
46
+ currentPage?: number;
47
+ /** Total number of pages (if available) */
48
+ totalPages?: number;
49
+ /** Whether this pagination type supports jumping to arbitrary pages */
50
+ supportsPageJump: boolean;
51
+ }
52
+ /**
53
+ * Response for non-paginated calls that includes both data and total count
54
+ */
55
+ interface NonPaginatedResponse<T> {
56
+ items: T[];
57
+ totalCount?: number;
58
+ }
59
+ /**
60
+ * Helper type for defining paginated method overloads
61
+ * Creates a union type of all ways pagination can be triggered
62
+ */
63
+ type HasPaginationOptions<T> = (T & {
64
+ pageSize: number;
65
+ }) | (T & {
66
+ cursor: PaginationCursor;
67
+ }) | (T & {
68
+ jumpToPage: number;
69
+ });
70
+
71
+ /**
72
+ * Pagination types supported by the SDK
73
+ */
74
+ declare enum PaginationType {
75
+ OFFSET = "offset",
76
+ TOKEN = "token"
77
+ }
78
+ /**
79
+ * Interface for service access methods needed by pagination helpers
80
+ */
81
+ interface PaginationServiceAccess {
82
+ get<T>(path: string, options?: any): Promise<{
83
+ data: T;
84
+ }>;
85
+ post<T>(path: string, body?: any, options?: any): Promise<{
86
+ data: T;
87
+ }>;
88
+ requestWithPagination<T>(method: string, path: string, paginationOptions: PaginationOptions, options: RequestWithPaginationOptions): Promise<PaginatedResponse<T>>;
89
+ }
90
+ /**
91
+ * Field names for extracting data from paginated responses.
92
+ */
93
+ interface PaginationFieldNames {
94
+ itemsField?: string;
95
+ totalCountField?: string;
96
+ continuationTokenField?: string;
97
+ }
98
+ /**
99
+ * Options for the requestWithPagination method in BaseService.
100
+ */
101
+ interface RequestWithPaginationOptions extends RequestSpec {
102
+ pagination: PaginationFieldNames & {
103
+ paginationType: PaginationType;
104
+ paginationParams?: {
105
+ pageSizeParam?: string;
106
+ offsetParam?: string;
107
+ tokenParam?: string;
108
+ countParam?: string;
109
+ };
110
+ };
111
+ }
112
+
113
+ /**
114
+ * HTTP methods supported by the API client
115
+ */
116
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
117
+ /**
118
+ * Supported response types for API requests
119
+ */
120
+ type ResponseType = 'json' | 'text' | 'blob' | 'arraybuffer' | 'stream';
121
+ /**
122
+ * Query parameters type with support for arrays and nested objects
123
+ */
124
+ type QueryParams = Record<string, string | number | boolean | Array<string | number | boolean> | null | undefined>;
125
+ /**
126
+ * Standard HTTP headers type
127
+ */
128
+ type Headers = Record<string, string>;
129
+ /**
130
+ * Options for request retries
131
+ */
132
+ interface RetryOptions {
133
+ /** Maximum number of retry attempts */
134
+ maxRetries?: number;
135
+ /** Base delay between retries in milliseconds */
136
+ retryDelay?: number;
137
+ /** Whether to use exponential backoff */
138
+ useExponentialBackoff?: boolean;
139
+ /** Status codes that should trigger a retry */
140
+ retryableStatusCodes?: number[];
141
+ }
142
+ /**
143
+ * Options for request timeouts
144
+ */
145
+ interface TimeoutOptions {
146
+ /** Request timeout in milliseconds */
147
+ timeout?: number;
148
+ /** Whether to abort the request on timeout */
149
+ abortOnTimeout?: boolean;
150
+ }
151
+ /**
152
+ * Options for request body transformation
153
+ */
154
+ interface BodyOptions {
155
+ /** Whether to stringify the body */
156
+ stringify?: boolean;
157
+ /** Content type override */
158
+ contentType?: string;
159
+ }
160
+ /**
161
+ * Pagination metadata for API requests
162
+ */
163
+ interface PaginationMetadata {
164
+ /** Type of pagination used by the API endpoint */
165
+ paginationType: PaginationType;
166
+ /** Response field containing items array (defaults to 'value') */
167
+ itemsField?: string;
168
+ /** Response field containing total count (defaults to '@odata.count') */
169
+ totalCountField?: string;
170
+ /** Response field containing continuation token (defaults to 'continuationToken') */
171
+ continuationTokenField?: string;
172
+ }
173
+ /**
174
+ * Base interface for all API requests
175
+ */
176
+ interface RequestSpec {
177
+ /** HTTP method for the request */
178
+ method?: HttpMethod;
179
+ /** URL endpoint for the request */
180
+ url?: string;
181
+ /** Query parameters to be appended to the URL */
182
+ params?: QueryParams;
183
+ /** HTTP headers to include with the request */
184
+ headers?: Headers;
185
+ /** Raw body content (takes precedence over data) */
186
+ body?: unknown;
187
+ /** Expected response type */
188
+ responseType?: ResponseType;
189
+ /** Request timeout options */
190
+ timeoutOptions?: TimeoutOptions;
191
+ /** Retry behavior options */
192
+ retryOptions?: RetryOptions;
193
+ /** Body transformation options */
194
+ bodyOptions?: BodyOptions;
195
+ /** AbortSignal for cancelling the request */
196
+ signal?: AbortSignal;
197
+ /** Pagination metadata for the request */
198
+ pagination?: PaginationMetadata;
199
+ }
200
+
201
+ interface ApiResponse<T> {
202
+ data: T;
203
+ }
204
+ /**
205
+ * Base class for all UiPath SDK services.
206
+ *
207
+ * Provides common functionality for authentication, configuration, and API communication.
208
+ * All service classes extend this base to inherit dependency injection and HTTP client access.
209
+ *
210
+ * This class implements the dependency injection pattern where services receive a configured
211
+ * UiPath instance. The ApiClient is created internally and handles all HTTP operations
212
+ * including authentication token management.
213
+ *
214
+ * @remarks
215
+ * Service classes should extend this base and call `super(uiPath)` in their constructor.
216
+ * Protected HTTP methods (get, post, put, patch, delete) are available to all subclasses.
217
+ *
218
+ */
219
+ declare class BaseService {
220
+ #private;
221
+ /**
222
+ * Creates a base service instance with dependency injection.
223
+ *
224
+ * Extracts configuration, execution context, and token manager from the UiPath instance
225
+ * to initialize an authenticated API client. The ApiClient handles all HTTP operations
226
+ * and token management internally.
227
+ *
228
+ * @param instance - UiPath SDK instance providing authentication and configuration.
229
+ * Services receive this via dependency injection in the modular pattern.
230
+ *
231
+ * @example
232
+ * ```typescript
233
+ * // Services automatically call this via super()
234
+ * export class EntityService extends BaseService {
235
+ * constructor(instance: IUiPath) {
236
+ * super(instance); // Initializes the internal ApiClient
237
+ * }
238
+ * }
239
+ *
240
+ * // Usage in modular pattern
241
+ * import { UiPath } from '@uipath/uipath-typescript/core';
242
+ * import { Entities } from '@uipath/uipath-typescript/entities';
243
+ *
244
+ * const sdk = new UiPath(config);
245
+ * await sdk.initialize();
246
+ * const entities = new Entities(sdk);
247
+ * ```
248
+ */
249
+ constructor(instance: IUiPath);
250
+ /**
251
+ * Gets a valid authentication token, refreshing if necessary.
252
+ * Use this when you need to manually add Authorization headers (e.g., direct uploads).
253
+ *
254
+ * @returns Promise resolving to a valid access token string
255
+ * @throws AuthenticationError if no token is available or refresh fails
256
+ */
257
+ protected getValidAuthToken(): Promise<string>;
258
+ /**
259
+ * Creates a service accessor for pagination helpers
260
+ * This allows pagination helpers to access protected methods without making them public
261
+ */
262
+ protected createPaginationServiceAccess(): PaginationServiceAccess;
263
+ protected request<T>(method: string, path: string, options?: RequestSpec): Promise<ApiResponse<T>>;
264
+ protected requestWithSpec<T>(spec: RequestSpec): Promise<ApiResponse<T>>;
265
+ protected get<T>(path: string, options?: RequestSpec): Promise<ApiResponse<T>>;
266
+ protected post<T>(path: string, data?: unknown, options?: RequestSpec): Promise<ApiResponse<T>>;
267
+ protected put<T>(path: string, data?: unknown, options?: RequestSpec): Promise<ApiResponse<T>>;
268
+ protected patch<T>(path: string, data?: unknown, options?: RequestSpec): Promise<ApiResponse<T>>;
269
+ protected delete<T>(path: string, options?: RequestSpec): Promise<ApiResponse<T>>;
270
+ /**
271
+ * Execute a request with cursor-based pagination
272
+ */
273
+ protected requestWithPagination<T>(method: string, path: string, paginationOptions: PaginationOptions, options: RequestWithPaginationOptions): Promise<PaginatedResponse<T>>;
274
+ /**
275
+ * Validates and prepares pagination parameters from options
276
+ */
277
+ private validateAndPreparePaginationParams;
278
+ /**
279
+ * Prepares request parameters for pagination based on pagination type
280
+ */
281
+ private preparePaginationRequestParams;
282
+ /**
283
+ * Creates a paginated response from API response
284
+ */
285
+ private createPaginatedResponseFromResponse;
286
+ /**
287
+ * Determines if there are more pages based on pagination type and metadata
288
+ */
289
+ private determineHasMorePages;
290
+ }
291
+
292
+ /**
293
+ * Base service for services that need folder-specific functionality.
294
+ *
295
+ * Extends BaseService with additional methods for working with folder-scoped resources
296
+ * in UiPath Orchestrator. Services that work with folders (Assets, Queues) extend this class.
297
+ *
298
+ * @remarks
299
+ * This class provides helper methods for making folder-scoped API calls, handling folder IDs
300
+ * in request headers, and managing cross-folder queries.
301
+ */
302
+ declare class FolderScopedService extends BaseService {
303
+ /**
304
+ * Gets resources in a folder with optional query parameters
305
+ *
306
+ * @param endpoint - API endpoint to call
307
+ * @param folderId - required folder ID
308
+ * @param options - Query options
309
+ * @param transformFn - Optional function to transform the response data
310
+ * @returns Promise resolving to an array of resources
311
+ */
312
+ protected _getByFolder<T, R = T>(endpoint: string, folderId: number, options?: Record<string, any>, transformFn?: (item: T) => R): Promise<R[]>;
313
+ }
314
+
315
+ interface BaseOptions {
316
+ expand?: string;
317
+ select?: string;
318
+ }
319
+ /**
320
+ * Common request options interface used across services for querying data
321
+ */
322
+ interface RequestOptions extends BaseOptions {
323
+ filter?: string;
324
+ orderby?: string;
325
+ }
326
+
327
+ /**
328
+ * Interface for queue response
329
+ */
330
+ interface QueueGetResponse {
331
+ key: string;
332
+ name: string;
333
+ id: number;
334
+ description: string;
335
+ maxNumberOfRetries: number;
336
+ acceptAutomaticallyRetry: boolean;
337
+ retryAbandonedItems: boolean;
338
+ enforceUniqueReference: boolean;
339
+ encrypted: boolean;
340
+ specificDataJsonSchema: string | null;
341
+ outputDataJsonSchema: string | null;
342
+ analyticsDataJsonSchema: string | null;
343
+ createdTime: string;
344
+ processScheduleId: number | null;
345
+ slaInMinutes: number;
346
+ riskSlaInMinutes: number;
347
+ releaseId: number | null;
348
+ isProcessInCurrentFolder: boolean | null;
349
+ foldersCount: number;
350
+ folderId: number;
351
+ folderName: string;
352
+ }
353
+ /**
354
+ * Options for getting queues across folders
355
+ */
356
+ type QueueGetAllOptions = RequestOptions & PaginationOptions & {
357
+ /**
358
+ * Optional folder ID to filter queues by folder
359
+ */
360
+ folderId?: number;
361
+ };
362
+ type QueueGetByIdOptions = BaseOptions;
363
+
364
+ /**
365
+ * Service for managing UiPath Queues
366
+ *
367
+ * Queues are a fundamental component of UiPath automation that enable distributed and scalable processing of work items. [UiPath Queues Guide](https://docs.uipath.com/orchestrator/automation-cloud/latest/user-guide/about-queues-and-transactions)
368
+ *
369
+ * ### Usage
370
+ *
371
+ * Prerequisites: Initialize the SDK first - see [Getting Started](/uipath-typescript/getting-started/#import-initialize)
372
+ *
373
+ * ```typescript
374
+ * import { Queues } from '@uipath/uipath-typescript/queues';
375
+ *
376
+ * const queues = new Queues(sdk);
377
+ * const allQueues = await queues.getAll();
378
+ * ```
379
+ */
380
+ interface QueueServiceModel {
381
+ /**
382
+ * Gets all queues across folders with optional filtering and folder scoping
383
+ *
384
+ * @signature getAll(options?) → Promise&lt;QueueGetResponse[]&gt;
385
+ * @param options Query options including optional folderId and pagination options
386
+ * @returns Promise resolving to either an array of queues NonPaginatedResponse<QueueGetResponse> or a PaginatedResponse<QueueGetResponse> when pagination options are used.
387
+ * {@link QueueGetResponse}
388
+ * @example
389
+ * ```typescript
390
+ * // Standard array return
391
+ * const allQueues = await queues.getAll();
392
+ *
393
+ * // Get queues within a specific folder
394
+ * const folderQueues = await queues.getAll({
395
+ * folderId: <folderId>
396
+ * });
397
+ *
398
+ * // Get queues with filtering
399
+ * const filteredQueues = await queues.getAll({
400
+ * filter: "name eq 'MyQueue'"
401
+ * });
402
+ *
403
+ * // First page with pagination
404
+ * const page1 = await queues.getAll({ pageSize: 10 });
405
+ *
406
+ * // Navigate using cursor
407
+ * if (page1.hasNextPage) {
408
+ * const page2 = await queues.getAll({ cursor: page1.nextCursor });
409
+ * }
410
+ *
411
+ * // Jump to specific page
412
+ * const page5 = await queues.getAll({
413
+ * jumpToPage: 5,
414
+ * pageSize: 10
415
+ * });
416
+ * ```
417
+ */
418
+ getAll<T extends QueueGetAllOptions = QueueGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<QueueGetResponse> : NonPaginatedResponse<QueueGetResponse>>;
419
+ /**
420
+ * Gets a single queue by ID
421
+ *
422
+ * @param id - Queue ID
423
+ * @param folderId - Required folder ID
424
+ * @returns Promise resolving to a queue definition
425
+ * @example
426
+ * ```typescript
427
+ * // Get queue by ID
428
+ * const queue = await queues.getById(<queueId>, <folderId>);
429
+ * ```
430
+ */
431
+ getById(id: number, folderId: number, options?: QueueGetByIdOptions): Promise<QueueGetResponse>;
432
+ }
433
+
434
+ /**
435
+ * Service for interacting with UiPath Orchestrator Queues API
436
+ */
437
+ declare class QueueService extends FolderScopedService implements QueueServiceModel {
438
+ /**
439
+ * Gets all queues across folders with optional filtering and folder scoping
440
+ *
441
+ * The method returns either:
442
+ * - An array of queues (when no pagination parameters are provided)
443
+ * - A paginated result with navigation cursors (when any pagination parameter is provided)
444
+ *
445
+ * @param options - Query options including optional folderId
446
+ * @returns Promise resolving to an array of queues or paginated result
447
+ *
448
+ * @example
449
+ * ```typescript
450
+ * import { Queues } from '@uipath/uipath-typescript/queues';
451
+ *
452
+ * const queues = new Queues(sdk);
453
+ *
454
+ * // Standard array return
455
+ * const allQueues = await queues.getAll();
456
+ *
457
+ * // Get queues within a specific folder
458
+ * const folderQueues = await queues.getAll({
459
+ * folderId: 123
460
+ * });
461
+ *
462
+ * // Get queues with filtering
463
+ * const filteredQueues = await queues.getAll({
464
+ * filter: "name eq 'MyQueue'"
465
+ * });
466
+ *
467
+ * // First page with pagination
468
+ * const page1 = await queues.getAll({ pageSize: 10 });
469
+ *
470
+ * // Navigate using cursor
471
+ * if (page1.hasNextPage) {
472
+ * const page2 = await queues.getAll({ cursor: page1.nextCursor });
473
+ * }
474
+ *
475
+ * // Jump to specific page
476
+ * const page5 = await queues.getAll({
477
+ * jumpToPage: 5,
478
+ * pageSize: 10
479
+ * });
480
+ * ```
481
+ */
482
+ getAll<T extends QueueGetAllOptions = QueueGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<QueueGetResponse> : NonPaginatedResponse<QueueGetResponse>>;
483
+ /**
484
+ * Gets a single queue by ID
485
+ *
486
+ * @param id - Queue ID
487
+ * @param folderId - Required folder ID
488
+ * @returns Promise resolving to a queue definition
489
+ *
490
+ * @example
491
+ * ```typescript
492
+ * import { Queues } from '@uipath/uipath-typescript/queues';
493
+ *
494
+ * const queues = new Queues(sdk);
495
+ *
496
+ * // Get queue by ID
497
+ * const queue = await queues.getById(123, 456);
498
+ * ```
499
+ */
500
+ getById(id: number, folderId: number, options?: QueueGetByIdOptions): Promise<QueueGetResponse>;
501
+ }
502
+
503
+ export { QueueService, QueueService as Queues };
504
+ export type { QueueGetAllOptions, QueueGetByIdOptions, QueueGetResponse, QueueServiceModel };