@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,513 @@
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
+ * Enum for Asset Value Scope
329
+ */
330
+ declare enum AssetValueScope {
331
+ Global = "Global",
332
+ PerRobot = "PerRobot"
333
+ }
334
+ /**
335
+ * Enum for Asset Value Type
336
+ */
337
+ declare enum AssetValueType {
338
+ DBConnectionString = "DBConnectionString",
339
+ HttpConnectionString = "HttpConnectionString",
340
+ Text = "Text",
341
+ Bool = "Bool",
342
+ Integer = "Integer",
343
+ Credential = "Credential",
344
+ WindowsCredential = "WindowsCredential",
345
+ KeyValueList = "KeyValueList",
346
+ Secret = "Secret"
347
+ }
348
+ /**
349
+ * Interface for key-value pair used in assets
350
+ */
351
+ interface CustomKeyValuePair {
352
+ key?: string;
353
+ value?: string;
354
+ }
355
+ /**
356
+ * Interface for asset response
357
+ */
358
+ interface AssetGetResponse {
359
+ key: string;
360
+ name: string;
361
+ id: number;
362
+ canBeDeleted: boolean;
363
+ valueScope: AssetValueScope;
364
+ valueType: AssetValueType;
365
+ value: string | null;
366
+ credentialStoreId: number | null;
367
+ keyValueList: CustomKeyValuePair[];
368
+ hasDefaultValue: boolean;
369
+ description: string | null;
370
+ foldersCount: number;
371
+ lastModifiedTime: string | null;
372
+ lastModifierUserId: number | null;
373
+ createdTime: string;
374
+ creatorUserId: number;
375
+ }
376
+ /**
377
+ * Options for getting assets across folders
378
+ */
379
+ type AssetGetAllOptions = RequestOptions & PaginationOptions & {
380
+ /**
381
+ * Optional folder ID to filter assets by folder
382
+ */
383
+ folderId?: number;
384
+ };
385
+ /**
386
+ * Options for getting a single asset by ID
387
+ */
388
+ type AssetGetByIdOptions = BaseOptions;
389
+
390
+ /**
391
+ * Service for managing UiPath Assets.
392
+ *
393
+ * Assets are key-value pairs that can be used to store configuration data, credentials, and other settings used by automation processes. [UiPath Assets Guide](https://docs.uipath.com/orchestrator/automation-cloud/latest/user-guide/about-assets)
394
+ *
395
+ * ### Usage
396
+ *
397
+ * Prerequisites: Initialize the SDK first - see [Getting Started](/uipath-typescript/getting-started/#import-initialize)
398
+ *
399
+ * ```typescript
400
+ * import { Assets } from '@uipath/uipath-typescript/assets';
401
+ *
402
+ * const assets = new Assets(sdk);
403
+ * const allAssets = await assets.getAll();
404
+ * ```
405
+ */
406
+ interface AssetServiceModel {
407
+ /**
408
+ * Gets all assets across folders with optional filtering
409
+ *
410
+ * @param options Query options including optional folderId and pagination options
411
+ * @returns Promise resolving to either an array of assets NonPaginatedResponse<AssetGetResponse> or a PaginatedResponse<AssetGetResponse> when pagination options are used.
412
+ * {@link AssetGetResponse}
413
+ * @example
414
+ * ```typescript
415
+ * // Standard array return
416
+ * // With folder
417
+ * const folderAssets = await assets.getAll({ folderId: <folderId> });
418
+ *
419
+ * // First page with pagination
420
+ * const page1 = await assets.getAll({ pageSize: 10 });
421
+ *
422
+ * // Navigate using cursor
423
+ * if (page1.hasNextPage) {
424
+ * const page2 = await assets.getAll({ cursor: page1.nextCursor });
425
+ * }
426
+ *
427
+ * // Jump to specific page
428
+ * const page5 = await assets.getAll({
429
+ * jumpToPage: 5,
430
+ * pageSize: 10
431
+ * });
432
+ * ```
433
+ */
434
+ getAll<T extends AssetGetAllOptions = AssetGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<AssetGetResponse> : NonPaginatedResponse<AssetGetResponse>>;
435
+ /**
436
+ * Gets a single asset by ID
437
+ *
438
+ * @param id - Asset ID
439
+ * @param folderId - Required folder ID
440
+ * @param options - Optional query parameters (expand, select)
441
+ * @returns Promise resolving to a single asset
442
+ * {@link AssetGetResponse}
443
+ * @example
444
+ * ```typescript
445
+ * // Get asset by ID
446
+ * const asset = await assets.getById(<assetId>, <folderId>);
447
+ * ```
448
+ */
449
+ getById(id: number, folderId: number, options?: AssetGetByIdOptions): Promise<AssetGetResponse>;
450
+ }
451
+
452
+ /**
453
+ * Service for interacting with UiPath Orchestrator Assets API
454
+ */
455
+ declare class AssetService extends FolderScopedService implements AssetServiceModel {
456
+ /**
457
+ * Gets all assets across folders with optional filtering and folder scoping
458
+ *
459
+ * @signature getAll(options?) -> Promise<AssetGetResponse[]>
460
+ * @param options Query options including optional folderId and pagination options
461
+ * @returns Promise resolving to array of assets or paginated response
462
+ *
463
+ * @example
464
+ * ```typescript
465
+ * import { Assets } from '@uipath/uipath-typescript/assets';
466
+ *
467
+ * const assets = new Assets(sdk);
468
+ *
469
+ * // Standard array return
470
+ * const allAssets = await assets.getAll();
471
+ *
472
+ * // With folder
473
+ * const folderAssets = await assets.getAll({ folderId: 123 });
474
+ *
475
+ * // First page with pagination
476
+ * const page1 = await assets.getAll({ pageSize: 10 });
477
+ *
478
+ * // Navigate using cursor
479
+ * if (page1.hasNextPage) {
480
+ * const page2 = await assets.getAll({ cursor: page1.nextCursor });
481
+ * }
482
+ *
483
+ * // Jump to specific page
484
+ * const page5 = await assets.getAll({
485
+ * jumpToPage: 5,
486
+ * pageSize: 10
487
+ * });
488
+ * ```
489
+ */
490
+ getAll<T extends AssetGetAllOptions = AssetGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<AssetGetResponse> : NonPaginatedResponse<AssetGetResponse>>;
491
+ /**
492
+ * Gets a single asset by ID
493
+ *
494
+ * @param id - Asset ID
495
+ * @param folderId - Required folder ID
496
+ * @param options - Optional query parameters (expand, select)
497
+ * @returns Promise resolving to a single asset
498
+ *
499
+ * @example
500
+ * ```typescript
501
+ * import { Assets } from '@uipath/uipath-typescript/assets';
502
+ *
503
+ * const assets = new Assets(sdk);
504
+ *
505
+ * // Get asset by ID
506
+ * const asset = await assets.getById(123, 456);
507
+ * ```
508
+ */
509
+ getById(id: number, folderId: number, options?: AssetGetByIdOptions): Promise<AssetGetResponse>;
510
+ }
511
+
512
+ export { AssetService, AssetValueScope, AssetValueType, AssetService as Assets };
513
+ export type { AssetGetAllOptions, AssetGetByIdOptions, AssetGetResponse, AssetServiceModel, CustomKeyValuePair };