@uipath/uipath-typescript 1.2.1 → 1.3.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 (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 +11 -27
  20. package/dist/entities/index.d.ts +38 -26
  21. package/dist/entities/index.mjs +11 -27
  22. package/dist/index.cjs +683 -284
  23. package/dist/index.d.ts +549 -75
  24. package/dist/index.mjs +683 -285
  25. package/dist/index.umd.js +680 -281
  26. package/dist/jobs/index.cjs +2264 -0
  27. package/dist/jobs/index.d.ts +860 -0
  28. package/dist/jobs/index.mjs +2260 -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
@@ -1,5 +1,45 @@
1
1
  import { IUiPath } from '../core/index';
2
2
 
3
+ /**
4
+ * Standardized result interface for all operation methods (pause, cancel, complete, update, upload, etc.)
5
+ * Success responses include data from the request context or API response
6
+ */
7
+ interface OperationResponse<TData> {
8
+ /**
9
+ * Whether the operation was successful
10
+ */
11
+ success: boolean;
12
+ /**
13
+ * Response data (can contain error details in case of failure)
14
+ */
15
+ data: TData;
16
+ }
17
+ /**
18
+ * Common enum for job state used across services
19
+ */
20
+ declare enum JobState {
21
+ Pending = "Pending",
22
+ Running = "Running",
23
+ Stopping = "Stopping",
24
+ Terminating = "Terminating",
25
+ Faulted = "Faulted",
26
+ Successful = "Successful",
27
+ Stopped = "Stopped",
28
+ Suspended = "Suspended",
29
+ Resumed = "Resumed"
30
+ }
31
+ interface BaseOptions {
32
+ expand?: string;
33
+ select?: string;
34
+ }
35
+ /**
36
+ * Common request options interface used across services for querying data
37
+ */
38
+ interface RequestOptions extends BaseOptions {
39
+ filter?: string;
40
+ orderby?: string;
41
+ }
42
+
3
43
  /**
4
44
  * Simplified universal pagination cursor
5
45
  * Used to fetch next/previous pages
@@ -64,270 +104,9 @@ type HasPaginationOptions<T> = (T & {
64
104
  pageSize: number;
65
105
  }) | (T & {
66
106
  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
- * Standardized result interface for all operation methods (pause, cancel, complete, update, upload, etc.)
294
- * Success responses include data from the request context or API response
295
- */
296
- interface OperationResponse<TData> {
297
- /**
298
- * Whether the operation was successful
299
- */
300
- success: boolean;
301
- /**
302
- * Response data (can contain error details in case of failure)
303
- */
304
- data: TData;
305
- }
306
- /**
307
- * Common enum for job state used across services
308
- */
309
- declare enum JobState {
310
- Pending = "Pending",
311
- Running = "Running",
312
- Stopping = "Stopping",
313
- Terminating = "Terminating",
314
- Faulted = "Faulted",
315
- Successful = "Successful",
316
- Stopped = "Stopped",
317
- Suspended = "Suspended",
318
- Resumed = "Resumed"
319
- }
320
- interface BaseOptions {
321
- expand?: string;
322
- select?: string;
323
- }
324
- /**
325
- * Common request options interface used across services for querying data
326
- */
327
- interface RequestOptions extends BaseOptions {
328
- filter?: string;
329
- orderby?: string;
330
- }
107
+ }) | (T & {
108
+ jumpToPage: number;
109
+ });
331
110
 
332
111
  interface UserLoginInfo {
333
112
  name: string;
@@ -337,10 +116,23 @@ interface UserLoginInfo {
337
116
  displayName: string;
338
117
  id: number;
339
118
  }
119
+ /**
120
+ * Types of tasks available in Action Center.
121
+ * Each type determines the task's behavior, UI rendering, and completion requirements.
122
+ */
340
123
  declare enum TaskType {
124
+ /** A form-based task that renders a UiPath form layout for user input */
341
125
  Form = "FormTask",
126
+ /** An externally managed task handled outside of Action Center */
342
127
  External = "ExternalTask",
343
- App = "AppTask"
128
+ /** A task powered by a UiPath App */
129
+ App = "AppTask",
130
+ /** A document validation task for reviewing and correcting extracted document data */
131
+ DocumentValidation = "DocumentValidationTask",
132
+ /** A document classification task for categorizing documents */
133
+ DocumentClassification = "DocumentClassificationTask",
134
+ /** A data labeling task for annotating training data */
135
+ DataLabeling = "DataLabelingTask"
344
136
  }
345
137
  declare enum TaskPriority {
346
138
  Low = "Low",
@@ -520,7 +312,23 @@ type TaskCompleteOptions = {
520
312
  data?: any;
521
313
  action?: string;
522
314
  } | {
523
- type: Exclude<TaskType, TaskType.External>;
315
+ type: TaskType.DocumentValidation;
316
+ data?: any;
317
+ action?: string;
318
+ } | {
319
+ type: TaskType.DocumentClassification;
320
+ data?: any;
321
+ action?: string;
322
+ } | {
323
+ type: TaskType.DataLabeling;
324
+ data?: any;
325
+ action?: string;
326
+ } | {
327
+ type: TaskType.Form;
328
+ data: any;
329
+ action: string;
330
+ } | {
331
+ type: TaskType.App;
524
332
  data: any;
525
333
  action: string;
526
334
  };
@@ -551,7 +359,14 @@ type TaskGetAllOptions = RequestOptions & PaginationOptions & {
551
359
  /**
552
360
  * Query options for getting a task by ID
553
361
  */
554
- type TaskGetByIdOptions = BaseOptions;
362
+ interface TaskGetByIdOptions extends BaseOptions {
363
+ /**
364
+ * Optional task type. When not provided, method will automatically identify the
365
+ * task type and resolve accordingly, but it will be slower.
366
+ * When provided, it will skip the step to identify the task type, so it will be faster.
367
+ */
368
+ taskType?: TaskType;
369
+ }
555
370
  /**
556
371
  * Options for getting users with task permissions
557
372
  */
@@ -620,10 +435,9 @@ interface TaskServiceModel {
620
435
  getAll<T extends TaskGetAllOptions = TaskGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<TaskGetResponse> : NonPaginatedResponse<TaskGetResponse>>;
621
436
  /**
622
437
  * Gets a task by ID
623
- * IMPORTANT: For form tasks, folderId must be provided.
624
438
  * @param id - The ID of the task to retrieve
625
- * @param options - Optional query parameters
626
- * @param folderId - Optional folder ID (REQUIRED for form tasks)
439
+ * @param options - Optional query parameters including taskType for faster retrieval {@link TaskGetByIdOptions}
440
+ * @param folderId - Optional folder ID (REQUIRED when options.taskType is provided)
627
441
  * @returns Promise resolving to the task
628
442
  * {@link TaskGetResponse}
629
443
  * @example
@@ -632,10 +446,13 @@ interface TaskServiceModel {
632
446
  * const task = await tasks.getById(<taskId>);
633
447
  *
634
448
  * // Get a form task by ID
635
- * const formTask = await tasks.getById(<taskId>, <folderId>);
449
+ * const formTask = await tasks.getById(<taskId>, {}, <folderId>);
636
450
  *
637
451
  * // Access form task properties
638
452
  * console.log(formTask.formLayout);
453
+ *
454
+ * // Get a document validation task by ID (faster with taskType provided in the options)
455
+ * const dvTask = await tasks.getById(<taskId>, { taskType: TaskType.DocumentValidation }, <folderId>);
639
456
  * ```
640
457
  */
641
458
  getById(id: number, options?: TaskGetByIdOptions, folderId?: number): Promise<TaskGetResponse>;
@@ -834,6 +651,227 @@ type TaskCreateResponse = RawTaskCreateResponse & TaskMethods;
834
651
  */
835
652
  declare function createTaskWithMethods(taskData: RawTaskGetResponse | RawTaskCreateResponse, service: TaskServiceModel): TaskGetResponse | TaskCreateResponse;
836
653
 
654
+ /**
655
+ * Pagination types supported by the SDK
656
+ */
657
+ declare enum PaginationType {
658
+ OFFSET = "offset",
659
+ TOKEN = "token"
660
+ }
661
+ /**
662
+ * Interface for service access methods needed by pagination helpers
663
+ */
664
+ interface PaginationServiceAccess {
665
+ get<T>(path: string, options?: any): Promise<{
666
+ data: T;
667
+ }>;
668
+ post<T>(path: string, body?: any, options?: any): Promise<{
669
+ data: T;
670
+ }>;
671
+ requestWithPagination<T>(method: string, path: string, paginationOptions: PaginationOptions, options: RequestWithPaginationOptions): Promise<PaginatedResponse<T>>;
672
+ }
673
+ /**
674
+ * Field names for extracting data from paginated responses.
675
+ */
676
+ interface PaginationFieldNames {
677
+ itemsField?: string;
678
+ totalCountField?: string;
679
+ continuationTokenField?: string;
680
+ }
681
+ /**
682
+ * Options for the requestWithPagination method in BaseService.
683
+ */
684
+ interface RequestWithPaginationOptions extends RequestSpec {
685
+ pagination: PaginationFieldNames & {
686
+ paginationType: PaginationType;
687
+ paginationParams?: {
688
+ pageSizeParam?: string;
689
+ offsetParam?: string;
690
+ tokenParam?: string;
691
+ countParam?: string;
692
+ };
693
+ };
694
+ }
695
+
696
+ /**
697
+ * HTTP methods supported by the API client
698
+ */
699
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
700
+ /**
701
+ * Supported response types for API requests
702
+ */
703
+ type ResponseType = 'json' | 'text' | 'blob' | 'arraybuffer' | 'stream';
704
+ /**
705
+ * Query parameters type with support for arrays and nested objects
706
+ */
707
+ type QueryParams = Record<string, string | number | boolean | Array<string | number | boolean> | null | undefined>;
708
+ /**
709
+ * Standard HTTP headers type
710
+ */
711
+ type Headers = Record<string, string>;
712
+ /**
713
+ * Options for request retries
714
+ */
715
+ interface RetryOptions {
716
+ /** Maximum number of retry attempts */
717
+ maxRetries?: number;
718
+ /** Base delay between retries in milliseconds */
719
+ retryDelay?: number;
720
+ /** Whether to use exponential backoff */
721
+ useExponentialBackoff?: boolean;
722
+ /** Status codes that should trigger a retry */
723
+ retryableStatusCodes?: number[];
724
+ }
725
+ /**
726
+ * Options for request timeouts
727
+ */
728
+ interface TimeoutOptions {
729
+ /** Request timeout in milliseconds */
730
+ timeout?: number;
731
+ /** Whether to abort the request on timeout */
732
+ abortOnTimeout?: boolean;
733
+ }
734
+ /**
735
+ * Options for request body transformation
736
+ */
737
+ interface BodyOptions {
738
+ /** Whether to stringify the body */
739
+ stringify?: boolean;
740
+ /** Content type override */
741
+ contentType?: string;
742
+ }
743
+ /**
744
+ * Pagination metadata for API requests
745
+ */
746
+ interface PaginationMetadata {
747
+ /** Type of pagination used by the API endpoint */
748
+ paginationType: PaginationType;
749
+ /** Response field containing items array (defaults to 'value') */
750
+ itemsField?: string;
751
+ /** Response field containing total count (defaults to '@odata.count') */
752
+ totalCountField?: string;
753
+ /** Response field containing continuation token (defaults to 'continuationToken') */
754
+ continuationTokenField?: string;
755
+ }
756
+ /**
757
+ * Base interface for all API requests
758
+ */
759
+ interface RequestSpec {
760
+ /** HTTP method for the request */
761
+ method?: HttpMethod;
762
+ /** URL endpoint for the request */
763
+ url?: string;
764
+ /** Query parameters to be appended to the URL */
765
+ params?: QueryParams;
766
+ /** HTTP headers to include with the request */
767
+ headers?: Headers;
768
+ /** Raw body content (takes precedence over data) */
769
+ body?: unknown;
770
+ /** Expected response type */
771
+ responseType?: ResponseType;
772
+ /** Request timeout options */
773
+ timeoutOptions?: TimeoutOptions;
774
+ /** Retry behavior options */
775
+ retryOptions?: RetryOptions;
776
+ /** Body transformation options */
777
+ bodyOptions?: BodyOptions;
778
+ /** AbortSignal for cancelling the request */
779
+ signal?: AbortSignal;
780
+ /** Pagination metadata for the request */
781
+ pagination?: PaginationMetadata;
782
+ }
783
+
784
+ interface ApiResponse<T> {
785
+ data: T;
786
+ }
787
+ /**
788
+ * Base class for all UiPath SDK services.
789
+ *
790
+ * Provides common functionality for authentication, configuration, and API communication.
791
+ * All service classes extend this base to inherit dependency injection and HTTP client access.
792
+ *
793
+ * This class implements the dependency injection pattern where services receive a configured
794
+ * UiPath instance. The ApiClient is created internally and handles all HTTP operations
795
+ * including authentication token management.
796
+ *
797
+ * @remarks
798
+ * Service classes should extend this base and call `super(uiPath)` in their constructor.
799
+ * Protected HTTP methods (get, post, put, patch, delete) are available to all subclasses.
800
+ *
801
+ */
802
+ declare class BaseService {
803
+ #private;
804
+ /**
805
+ * Creates a base service instance with dependency injection.
806
+ *
807
+ * Extracts configuration, execution context, and token manager from the UiPath instance
808
+ * to initialize an authenticated API client. The ApiClient handles all HTTP operations
809
+ * and token management internally.
810
+ *
811
+ * @param instance - UiPath SDK instance providing authentication and configuration.
812
+ * Services receive this via dependency injection in the modular pattern.
813
+ *
814
+ * @example
815
+ * ```typescript
816
+ * // Services automatically call this via super()
817
+ * export class EntityService extends BaseService {
818
+ * constructor(instance: IUiPath) {
819
+ * super(instance); // Initializes the internal ApiClient
820
+ * }
821
+ * }
822
+ *
823
+ * // Usage in modular pattern
824
+ * import { UiPath } from '@uipath/uipath-typescript/core';
825
+ * import { Entities } from '@uipath/uipath-typescript/entities';
826
+ *
827
+ * const sdk = new UiPath(config);
828
+ * await sdk.initialize();
829
+ * const entities = new Entities(sdk);
830
+ * ```
831
+ */
832
+ constructor(instance: IUiPath);
833
+ /**
834
+ * Gets a valid authentication token, refreshing if necessary.
835
+ * Use this when you need to manually add Authorization headers (e.g., direct uploads).
836
+ *
837
+ * @returns Promise resolving to a valid access token string
838
+ * @throws AuthenticationError if no token is available or refresh fails
839
+ */
840
+ protected getValidAuthToken(): Promise<string>;
841
+ /**
842
+ * Creates a service accessor for pagination helpers
843
+ * This allows pagination helpers to access protected methods without making them public
844
+ */
845
+ protected createPaginationServiceAccess(): PaginationServiceAccess;
846
+ protected request<T>(method: string, path: string, options?: RequestSpec): Promise<ApiResponse<T>>;
847
+ protected requestWithSpec<T>(spec: RequestSpec): Promise<ApiResponse<T>>;
848
+ protected get<T>(path: string, options?: RequestSpec): Promise<ApiResponse<T>>;
849
+ protected post<T>(path: string, data?: unknown, options?: RequestSpec): Promise<ApiResponse<T>>;
850
+ protected put<T>(path: string, data?: unknown, options?: RequestSpec): Promise<ApiResponse<T>>;
851
+ protected patch<T>(path: string, data?: unknown, options?: RequestSpec): Promise<ApiResponse<T>>;
852
+ protected delete<T>(path: string, options?: RequestSpec): Promise<ApiResponse<T>>;
853
+ /**
854
+ * Execute a request with cursor-based pagination
855
+ */
856
+ protected requestWithPagination<T>(method: string, path: string, paginationOptions: PaginationOptions, options: RequestWithPaginationOptions): Promise<PaginatedResponse<T>>;
857
+ /**
858
+ * Validates and prepares pagination parameters from options
859
+ */
860
+ private validateAndPreparePaginationParams;
861
+ /**
862
+ * Prepares request parameters for pagination based on pagination type
863
+ */
864
+ private preparePaginationRequestParams;
865
+ /**
866
+ * Creates a paginated response from API response
867
+ */
868
+ private createPaginatedResponseFromResponse;
869
+ /**
870
+ * Determines if there are more pages based on pagination type and metadata
871
+ */
872
+ private determineHasMorePages;
873
+ }
874
+
837
875
  /**
838
876
  * Service for interacting with UiPath Tasks API
839
877
  */
@@ -945,23 +983,24 @@ declare class TaskService extends BaseService implements TaskServiceModel {
945
983
  getAll<T extends TaskGetAllOptions = TaskGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<TaskGetResponse> : NonPaginatedResponse<TaskGetResponse>>;
946
984
  /**
947
985
  * Gets a task by ID
948
- * IMPORTANT: For form tasks, folderId must be provided.
949
- *
950
986
  * @param id - The ID of the task to retrieve
951
- * @param options - Optional query parameters
952
- * @param folderId - Optional folder ID (REQUIRED for form tasks)
953
- * @returns Promise resolving to the task (form tasks will return form-specific data)
954
- *
987
+ * @param options - Optional query parameters including taskType for faster retrieval {@link TaskGetByIdOptions}
988
+ * @param folderId - Optional folder ID (REQUIRED when options.taskType is provided)
989
+ * @returns Promise resolving to the task
990
+ * {@link TaskGetResponse}
955
991
  * @example
956
992
  * ```typescript
957
- * import { Tasks } from '@uipath/uipath-typescript/tasks';
993
+ * // Get a task by ID
994
+ * const task = await tasks.getById(<taskId>);
958
995
  *
959
- * const tasks = new Tasks(sdk);
996
+ * // Get a form task by ID
997
+ * const formTask = await tasks.getById(<taskId>, {}, <folderId>);
960
998
  *
961
- * // Get task by ID
962
- * const task = await tasks.getById(123);
999
+ * // Access form task properties
1000
+ * console.log(formTask.formLayout);
963
1001
  *
964
- * // If the task is a form task, it will automatically return form-specific data
1002
+ * // Get a document validation task by ID (faster with taskType provided in the options)
1003
+ * const dvTask = await tasks.getById(<taskId>, { taskType: TaskType.DocumentValidation }, <folderId>);
965
1004
  * ```
966
1005
  */
967
1006
  getById(id: number, options?: TaskGetByIdOptions, folderId?: number): Promise<TaskGetResponse>;
@@ -1093,14 +1132,19 @@ declare class TaskService extends BaseService implements TaskServiceModel {
1093
1132
  */
1094
1133
  complete(options: TaskCompletionOptions, folderId: number): Promise<OperationResponse<TaskCompletionOptions>>;
1095
1134
  /**
1096
- * Gets a form task by ID (private method)
1135
+ * Routes to the type-specific endpoint based on task type.
1136
+ */
1137
+ private getByTaskType;
1138
+ /**
1139
+ * Fetches a task from a type-specific endpoint.
1097
1140
  *
1098
- * @param id - The ID of the form task to retrieve
1141
+ * @param id - The task ID
1099
1142
  * @param folderId - Required folder ID
1100
- * @param options - Optional query parameters
1101
- * @returns Promise resolving to the form task
1143
+ * @param endpoint - The type-specific endpoint to call
1144
+ * @param extraParams - Additional query parameters (e.g. form options)
1145
+ * @returns Promise resolving to the task
1102
1146
  */
1103
- private getFormTaskById;
1147
+ private getTaskByTypeEndpoint;
1104
1148
  /**
1105
1149
  * Process parameters for task queries with folder filtering
1106
1150
  * @param options - The REST API options to process