@uipath/uipath-typescript 1.2.1 → 1.2.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.
Files changed (40) hide show
  1. package/dist/assets/index.cjs +1 -1
  2. package/dist/assets/index.d.ts +2 -1
  3. package/dist/assets/index.mjs +1 -1
  4. package/dist/attachments/index.cjs +1944 -0
  5. package/dist/attachments/index.d.ts +399 -0
  6. package/dist/attachments/index.mjs +1941 -0
  7. package/dist/buckets/index.cjs +1 -1
  8. package/dist/buckets/index.d.ts +4 -2
  9. package/dist/buckets/index.mjs +1 -1
  10. package/dist/cases/index.cjs +95 -48
  11. package/dist/cases/index.d.ts +31 -2
  12. package/dist/cases/index.mjs +95 -48
  13. package/dist/conversational-agent/index.cjs +1 -1
  14. package/dist/conversational-agent/index.d.ts +10 -5
  15. package/dist/conversational-agent/index.mjs +1 -1
  16. package/dist/core/index.cjs +109 -17
  17. package/dist/core/index.d.ts +1 -1
  18. package/dist/core/index.mjs +109 -17
  19. package/dist/entities/index.cjs +1 -1
  20. package/dist/entities/index.d.ts +33 -21
  21. package/dist/entities/index.mjs +1 -1
  22. package/dist/index.cjs +569 -307
  23. package/dist/index.d.ts +468 -70
  24. package/dist/index.mjs +570 -308
  25. package/dist/index.umd.js +566 -304
  26. package/dist/jobs/index.cjs +2036 -0
  27. package/dist/jobs/index.d.ts +724 -0
  28. package/dist/jobs/index.mjs +2033 -0
  29. package/dist/maestro-processes/index.cjs +1 -1
  30. package/dist/maestro-processes/index.mjs +1 -1
  31. package/dist/processes/index.cjs +67 -1
  32. package/dist/processes/index.d.ts +80 -15
  33. package/dist/processes/index.mjs +68 -2
  34. package/dist/queues/index.cjs +1 -1
  35. package/dist/queues/index.d.ts +2 -1
  36. package/dist/queues/index.mjs +1 -1
  37. package/dist/tasks/index.cjs +1319 -1272
  38. package/dist/tasks/index.d.ts +331 -287
  39. package/dist/tasks/index.mjs +1319 -1272
  40. package/package.json +23 -2
@@ -0,0 +1,399 @@
1
+ import { IUiPath } from '../core/index';
2
+
3
+ interface BaseOptions {
4
+ expand?: string;
5
+ select?: string;
6
+ }
7
+
8
+ /**
9
+ * Simplified universal pagination cursor
10
+ * Used to fetch next/previous pages
11
+ */
12
+ interface PaginationCursor {
13
+ /** Opaque string containing all information needed to fetch next page */
14
+ value: string;
15
+ }
16
+ /**
17
+ * Discriminated union for pagination methods - ensures cursor and jumpToPage are mutually exclusive
18
+ */
19
+ type PaginationMethodUnion = {
20
+ cursor?: PaginationCursor;
21
+ jumpToPage?: never;
22
+ } | {
23
+ cursor?: never;
24
+ jumpToPage?: number;
25
+ } | {
26
+ cursor?: never;
27
+ jumpToPage?: never;
28
+ };
29
+ /**
30
+ * Pagination options. Users cannot specify both cursor and jumpToPage.
31
+ */
32
+ type PaginationOptions = {
33
+ /** Size of the page to fetch (items per page) */
34
+ pageSize?: number;
35
+ } & PaginationMethodUnion;
36
+ /**
37
+ * Paginated response containing items and navigation information
38
+ */
39
+ interface PaginatedResponse<T> {
40
+ /** The items in the current page */
41
+ items: T[];
42
+ /** Total count of items across all pages (if available) */
43
+ totalCount?: number;
44
+ /** Whether more pages are available */
45
+ hasNextPage: boolean;
46
+ /** Cursor to fetch the next page (if available) */
47
+ nextCursor?: PaginationCursor;
48
+ /** Cursor to fetch the previous page (if available) */
49
+ previousCursor?: PaginationCursor;
50
+ /** Current page number (1-based, if available) */
51
+ currentPage?: number;
52
+ /** Total number of pages (if available) */
53
+ totalPages?: number;
54
+ /** Whether this pagination type supports jumping to arbitrary pages */
55
+ supportsPageJump: boolean;
56
+ }
57
+
58
+ /**
59
+ * Maps header names to their values
60
+ *
61
+ * @example
62
+ * ```typescript
63
+ * {
64
+ * "x-ms-blob-type": "BlockBlob"
65
+ * }
66
+ * ```
67
+ */
68
+ type ResponseDictionary = Record<string, string>;
69
+ /**
70
+ * Response from the GetReadUri API
71
+ */
72
+ interface BucketGetUriResponse {
73
+ /**
74
+ * The URI for accessing the blob file
75
+ */
76
+ uri: string;
77
+ /**
78
+ * HTTP method to use with the URI
79
+ */
80
+ httpMethod: string;
81
+ /**
82
+ * Whether authentication is required to access the URI
83
+ */
84
+ requiresAuth: boolean;
85
+ /**
86
+ * Headers to be included in the request
87
+ */
88
+ headers: ResponseDictionary;
89
+ }
90
+
91
+ /**
92
+ * Attachment response from the API
93
+ */
94
+ interface AttachmentResponse {
95
+ /**
96
+ * UUID of the attachment
97
+ */
98
+ id: string;
99
+ /**
100
+ * Name of the attachment
101
+ */
102
+ name: string;
103
+ /**
104
+ * Optional job key to link the attachment to a job when creating it.
105
+ */
106
+ jobKey?: string;
107
+ /**
108
+ * Optional category for the attachment when linking to a job.
109
+ */
110
+ attachmentCategory?: string;
111
+ /**
112
+ * When the attachment was last modified
113
+ */
114
+ lastModifiedTime?: string;
115
+ /**
116
+ * User ID who last modified the attachment
117
+ */
118
+ lastModifierUserId?: number;
119
+ /**
120
+ * When the attachment was created
121
+ */
122
+ createdTime?: string;
123
+ /**
124
+ * User ID who created the attachment
125
+ */
126
+ creatorUserId?: number;
127
+ blobFileAccess: BucketGetUriResponse;
128
+ }
129
+ /**
130
+ * Options for getting an attachment by ID
131
+ */
132
+ interface AttachmentGetByIdOptions extends BaseOptions {
133
+ }
134
+
135
+ /**
136
+ * Service for managing UiPath Orchestrator Attachments.
137
+ *
138
+ * Attachments are files that can be associated with Orchestrator jobs.
139
+ */
140
+ interface AttachmentServiceModel {
141
+ /**
142
+ * Gets an attachment by ID
143
+ *
144
+ * @param id - The UUID of the attachment to retrieve
145
+ * @param options - Optional query parameters (expand, select)
146
+ * @returns Promise resolving to the attachment
147
+ * {@link AttachmentResponse}
148
+ * @example
149
+ * ```typescript
150
+ * import { Attachments } from '@uipath/uipath-typescript/attachments';
151
+ *
152
+ * const attachments = new Attachments(sdk);
153
+ * const attachment = await attachments.getById('12345678-1234-1234-1234-123456789abc');
154
+ * ```
155
+ */
156
+ getById(id: string, options?: AttachmentGetByIdOptions): Promise<AttachmentResponse>;
157
+ }
158
+
159
+ /**
160
+ * Pagination types supported by the SDK
161
+ */
162
+ declare enum PaginationType {
163
+ OFFSET = "offset",
164
+ TOKEN = "token"
165
+ }
166
+ /**
167
+ * Interface for service access methods needed by pagination helpers
168
+ */
169
+ interface PaginationServiceAccess {
170
+ get<T>(path: string, options?: any): Promise<{
171
+ data: T;
172
+ }>;
173
+ post<T>(path: string, body?: any, options?: any): Promise<{
174
+ data: T;
175
+ }>;
176
+ requestWithPagination<T>(method: string, path: string, paginationOptions: PaginationOptions, options: RequestWithPaginationOptions): Promise<PaginatedResponse<T>>;
177
+ }
178
+ /**
179
+ * Field names for extracting data from paginated responses.
180
+ */
181
+ interface PaginationFieldNames {
182
+ itemsField?: string;
183
+ totalCountField?: string;
184
+ continuationTokenField?: string;
185
+ }
186
+ /**
187
+ * Options for the requestWithPagination method in BaseService.
188
+ */
189
+ interface RequestWithPaginationOptions extends RequestSpec {
190
+ pagination: PaginationFieldNames & {
191
+ paginationType: PaginationType;
192
+ paginationParams?: {
193
+ pageSizeParam?: string;
194
+ offsetParam?: string;
195
+ tokenParam?: string;
196
+ countParam?: string;
197
+ };
198
+ };
199
+ }
200
+
201
+ /**
202
+ * HTTP methods supported by the API client
203
+ */
204
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
205
+ /**
206
+ * Supported response types for API requests
207
+ */
208
+ type ResponseType = 'json' | 'text' | 'blob' | 'arraybuffer' | 'stream';
209
+ /**
210
+ * Query parameters type with support for arrays and nested objects
211
+ */
212
+ type QueryParams = Record<string, string | number | boolean | Array<string | number | boolean> | null | undefined>;
213
+ /**
214
+ * Standard HTTP headers type
215
+ */
216
+ type Headers = Record<string, string>;
217
+ /**
218
+ * Options for request retries
219
+ */
220
+ interface RetryOptions {
221
+ /** Maximum number of retry attempts */
222
+ maxRetries?: number;
223
+ /** Base delay between retries in milliseconds */
224
+ retryDelay?: number;
225
+ /** Whether to use exponential backoff */
226
+ useExponentialBackoff?: boolean;
227
+ /** Status codes that should trigger a retry */
228
+ retryableStatusCodes?: number[];
229
+ }
230
+ /**
231
+ * Options for request timeouts
232
+ */
233
+ interface TimeoutOptions {
234
+ /** Request timeout in milliseconds */
235
+ timeout?: number;
236
+ /** Whether to abort the request on timeout */
237
+ abortOnTimeout?: boolean;
238
+ }
239
+ /**
240
+ * Options for request body transformation
241
+ */
242
+ interface BodyOptions {
243
+ /** Whether to stringify the body */
244
+ stringify?: boolean;
245
+ /** Content type override */
246
+ contentType?: string;
247
+ }
248
+ /**
249
+ * Pagination metadata for API requests
250
+ */
251
+ interface PaginationMetadata {
252
+ /** Type of pagination used by the API endpoint */
253
+ paginationType: PaginationType;
254
+ /** Response field containing items array (defaults to 'value') */
255
+ itemsField?: string;
256
+ /** Response field containing total count (defaults to '@odata.count') */
257
+ totalCountField?: string;
258
+ /** Response field containing continuation token (defaults to 'continuationToken') */
259
+ continuationTokenField?: string;
260
+ }
261
+ /**
262
+ * Base interface for all API requests
263
+ */
264
+ interface RequestSpec {
265
+ /** HTTP method for the request */
266
+ method?: HttpMethod;
267
+ /** URL endpoint for the request */
268
+ url?: string;
269
+ /** Query parameters to be appended to the URL */
270
+ params?: QueryParams;
271
+ /** HTTP headers to include with the request */
272
+ headers?: Headers;
273
+ /** Raw body content (takes precedence over data) */
274
+ body?: unknown;
275
+ /** Expected response type */
276
+ responseType?: ResponseType;
277
+ /** Request timeout options */
278
+ timeoutOptions?: TimeoutOptions;
279
+ /** Retry behavior options */
280
+ retryOptions?: RetryOptions;
281
+ /** Body transformation options */
282
+ bodyOptions?: BodyOptions;
283
+ /** AbortSignal for cancelling the request */
284
+ signal?: AbortSignal;
285
+ /** Pagination metadata for the request */
286
+ pagination?: PaginationMetadata;
287
+ }
288
+
289
+ interface ApiResponse<T> {
290
+ data: T;
291
+ }
292
+ /**
293
+ * Base class for all UiPath SDK services.
294
+ *
295
+ * Provides common functionality for authentication, configuration, and API communication.
296
+ * All service classes extend this base to inherit dependency injection and HTTP client access.
297
+ *
298
+ * This class implements the dependency injection pattern where services receive a configured
299
+ * UiPath instance. The ApiClient is created internally and handles all HTTP operations
300
+ * including authentication token management.
301
+ *
302
+ * @remarks
303
+ * Service classes should extend this base and call `super(uiPath)` in their constructor.
304
+ * Protected HTTP methods (get, post, put, patch, delete) are available to all subclasses.
305
+ *
306
+ */
307
+ declare class BaseService {
308
+ #private;
309
+ /**
310
+ * Creates a base service instance with dependency injection.
311
+ *
312
+ * Extracts configuration, execution context, and token manager from the UiPath instance
313
+ * to initialize an authenticated API client. The ApiClient handles all HTTP operations
314
+ * and token management internally.
315
+ *
316
+ * @param instance - UiPath SDK instance providing authentication and configuration.
317
+ * Services receive this via dependency injection in the modular pattern.
318
+ *
319
+ * @example
320
+ * ```typescript
321
+ * // Services automatically call this via super()
322
+ * export class EntityService extends BaseService {
323
+ * constructor(instance: IUiPath) {
324
+ * super(instance); // Initializes the internal ApiClient
325
+ * }
326
+ * }
327
+ *
328
+ * // Usage in modular pattern
329
+ * import { UiPath } from '@uipath/uipath-typescript/core';
330
+ * import { Entities } from '@uipath/uipath-typescript/entities';
331
+ *
332
+ * const sdk = new UiPath(config);
333
+ * await sdk.initialize();
334
+ * const entities = new Entities(sdk);
335
+ * ```
336
+ */
337
+ constructor(instance: IUiPath);
338
+ /**
339
+ * Gets a valid authentication token, refreshing if necessary.
340
+ * Use this when you need to manually add Authorization headers (e.g., direct uploads).
341
+ *
342
+ * @returns Promise resolving to a valid access token string
343
+ * @throws AuthenticationError if no token is available or refresh fails
344
+ */
345
+ protected getValidAuthToken(): Promise<string>;
346
+ /**
347
+ * Creates a service accessor for pagination helpers
348
+ * This allows pagination helpers to access protected methods without making them public
349
+ */
350
+ protected createPaginationServiceAccess(): PaginationServiceAccess;
351
+ protected request<T>(method: string, path: string, options?: RequestSpec): Promise<ApiResponse<T>>;
352
+ protected requestWithSpec<T>(spec: RequestSpec): Promise<ApiResponse<T>>;
353
+ protected get<T>(path: string, options?: RequestSpec): Promise<ApiResponse<T>>;
354
+ protected post<T>(path: string, data?: unknown, options?: RequestSpec): Promise<ApiResponse<T>>;
355
+ protected put<T>(path: string, data?: unknown, options?: RequestSpec): Promise<ApiResponse<T>>;
356
+ protected patch<T>(path: string, data?: unknown, options?: RequestSpec): Promise<ApiResponse<T>>;
357
+ protected delete<T>(path: string, options?: RequestSpec): Promise<ApiResponse<T>>;
358
+ /**
359
+ * Execute a request with cursor-based pagination
360
+ */
361
+ protected requestWithPagination<T>(method: string, path: string, paginationOptions: PaginationOptions, options: RequestWithPaginationOptions): Promise<PaginatedResponse<T>>;
362
+ /**
363
+ * Validates and prepares pagination parameters from options
364
+ */
365
+ private validateAndPreparePaginationParams;
366
+ /**
367
+ * Prepares request parameters for pagination based on pagination type
368
+ */
369
+ private preparePaginationRequestParams;
370
+ /**
371
+ * Creates a paginated response from API response
372
+ */
373
+ private createPaginatedResponseFromResponse;
374
+ /**
375
+ * Determines if there are more pages based on pagination type and metadata
376
+ */
377
+ private determineHasMorePages;
378
+ }
379
+
380
+ declare class AttachmentService extends BaseService implements AttachmentServiceModel {
381
+ /**
382
+ * Gets an attachment by ID
383
+ * @param id - The UUID of the attachment to retrieve
384
+ * @param options - Optional query parameters (expand, select)
385
+ * @returns Promise resolving to the attachment
386
+ *
387
+ * @example
388
+ * ```typescript
389
+ * import { Attachments } from '@uipath/uipath-typescript/attachments';
390
+ *
391
+ * const attachments = new Attachments(sdk);
392
+ * const attachment = await attachments.getById('12345678-1234-1234-1234-123456789abc');
393
+ * ```
394
+ */
395
+ getById(id: string, options?: AttachmentGetByIdOptions): Promise<AttachmentResponse>;
396
+ }
397
+
398
+ export { AttachmentService, AttachmentService as Attachments };
399
+ export type { AttachmentGetByIdOptions, AttachmentResponse, AttachmentServiceModel };