@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
@@ -0,0 +1,860 @@
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
+ /**
316
+ * Common enum for job state used across services
317
+ */
318
+ declare enum JobState {
319
+ Pending = "Pending",
320
+ Running = "Running",
321
+ Stopping = "Stopping",
322
+ Terminating = "Terminating",
323
+ Faulted = "Faulted",
324
+ Successful = "Successful",
325
+ Stopped = "Stopped",
326
+ Suspended = "Suspended",
327
+ Resumed = "Resumed"
328
+ }
329
+ interface BaseOptions {
330
+ expand?: string;
331
+ select?: string;
332
+ }
333
+ /**
334
+ * Common request options interface used across services for querying data
335
+ */
336
+ interface RequestOptions extends BaseOptions {
337
+ filter?: string;
338
+ orderby?: string;
339
+ }
340
+
341
+ /**
342
+ * Enum for package types
343
+ */
344
+ declare enum PackageType {
345
+ Undefined = "Undefined",
346
+ Process = "Process",
347
+ ProcessOrchestration = "ProcessOrchestration",
348
+ WebApp = "WebApp",
349
+ Agent = "Agent",
350
+ TestAutomationProcess = "TestAutomationProcess",
351
+ Api = "Api",
352
+ MCPServer = "MCPServer",
353
+ BusinessRules = "BusinessRules",
354
+ CaseManagement = "CaseManagement",
355
+ Flow = "Flow",
356
+ Function = "Function"
357
+ }
358
+ /**
359
+ * Enum for job priority
360
+ */
361
+ declare enum JobPriority {
362
+ Low = "Low",
363
+ Normal = "Normal",
364
+ High = "High"
365
+ }
366
+ /**
367
+ * Enum for remote control access
368
+ */
369
+ declare enum RemoteControlAccess {
370
+ None = "None",
371
+ ReadOnly = "ReadOnly",
372
+ Full = "Full"
373
+ }
374
+ /**
375
+ * Enum for job source type
376
+ */
377
+ declare enum JobSourceType {
378
+ Manual = "Manual",
379
+ Schedule = "Schedule",
380
+ Agent = "Agent",
381
+ Queue = "Queue",
382
+ StudioWeb = "StudioWeb",
383
+ IntegrationTrigger = "IntegrationTrigger",
384
+ StudioDesktop = "StudioDesktop",
385
+ AutomationOpsPipelines = "AutomationOpsPipelines",
386
+ Apps = "Apps",
387
+ SAP = "SAP",
388
+ HttpTrigger = "HttpTrigger",
389
+ HttpTriggerCallback = "HttpTriggerCallback",
390
+ RobotAPI = "RobotAPI",
391
+ CommandLine = "CommandLine",
392
+ RobotNetAPI = "RobotNetAPI",
393
+ Autopilot = "Autopilot",
394
+ TestManager = "TestManager",
395
+ AgentService = "AgentService",
396
+ ProcessOrchestration = "ProcessOrchestration",
397
+ PluginEcosystem = "PluginEcosystem",
398
+ PerformanceTesting = "PerformanceTesting",
399
+ AgentHub = "AgentHub",
400
+ ApiWorkflow = "ApiWorkflow",
401
+ CaseManagement = "CaseManagement"
402
+ }
403
+ /**
404
+ * Enum for stop strategy
405
+ */
406
+ declare enum StopStrategy {
407
+ SoftStop = "SoftStop",
408
+ Kill = "Kill"
409
+ }
410
+ /**
411
+ * Enum for runtime type
412
+ */
413
+ declare enum RuntimeType {
414
+ NonProduction = "NonProduction",
415
+ Attended = "Attended",
416
+ Unattended = "Unattended",
417
+ Development = "Development",
418
+ Studio = "Studio",
419
+ RpaDeveloper = "RpaDeveloper",
420
+ StudioX = "StudioX",
421
+ CitizenDeveloper = "CitizenDeveloper",
422
+ Headless = "Headless",
423
+ StudioPro = "StudioPro",
424
+ RpaDeveloperPro = "RpaDeveloperPro",
425
+ TestAutomation = "TestAutomation",
426
+ AutomationCloud = "AutomationCloud",
427
+ Serverless = "Serverless",
428
+ AutomationKit = "AutomationKit",
429
+ ServerlessTestAutomation = "ServerlessTestAutomation",
430
+ AutomationCloudTestAutomation = "AutomationCloudTestAutomation",
431
+ AttendedStudioWeb = "AttendedStudioWeb",
432
+ Hosting = "Hosting",
433
+ AssistantWeb = "AssistantWeb",
434
+ ProcessOrchestration = "ProcessOrchestration",
435
+ AgentService = "AgentService",
436
+ AppTest = "AppTest",
437
+ PerformanceTest = "PerformanceTest",
438
+ BusinessRule = "BusinessRule",
439
+ CaseManagement = "CaseManagement",
440
+ Flow = "Flow"
441
+ }
442
+ /**
443
+ * Interface for common folder properties
444
+ */
445
+ interface FolderProperties {
446
+ folderId: number;
447
+ folderName: string | null;
448
+ }
449
+ /**
450
+ * Interface for robot metadata
451
+ */
452
+ interface RobotMetadata {
453
+ id: number;
454
+ name?: string;
455
+ username?: string;
456
+ }
457
+ /**
458
+ * Interface for machine
459
+ */
460
+ interface Machine {
461
+ id: number;
462
+ name?: string;
463
+ }
464
+ /**
465
+ * Interface for job error
466
+ */
467
+ interface JobError {
468
+ code?: string;
469
+ title?: string;
470
+ detail?: string;
471
+ category?: string;
472
+ status?: number;
473
+ timestamp?: string;
474
+ }
475
+ /**
476
+ * Enum for job type
477
+ */
478
+ declare enum JobType {
479
+ Unattended = "Unattended",
480
+ Attended = "Attended",
481
+ ServerlessGeneric = "ServerlessGeneric"
482
+ }
483
+
484
+ /**
485
+ * Enum for job sub-state
486
+ */
487
+ declare enum JobSubState {
488
+ WithFaults = "WITH_FAULTS",
489
+ Manually = "MANUALLY"
490
+ }
491
+ /**
492
+ * Enum for serverless job type
493
+ */
494
+ declare enum ServerlessJobType {
495
+ RobotJob = "RobotJob",
496
+ WebApp = "WebApp",
497
+ LoadTest = "LoadTest",
498
+ StudioWebDesigner = "StudioWebDesigner",
499
+ PublishStudioProject = "PublishStudioProject",
500
+ JsApi = "JsApi",
501
+ PythonCodedAgent = "PythonCodedAgent",
502
+ MCPServer = "MCPServer",
503
+ PythonCodedSystemAgent = "PythonCodedSystemAgent",
504
+ PythonAgent = "PythonAgent"
505
+ }
506
+ /**
507
+ * Interface for process metadata associated with a job.
508
+ * Represents a lightweight summary of the process (release) linked to a job.
509
+ * Available when using 'expand: "Release"' in the query.
510
+ */
511
+ interface ProcessMetadata {
512
+ /** The unique key of the release */
513
+ key?: string;
514
+ /** The process key identifying the package */
515
+ processKey?: string;
516
+ /** The version of the process package */
517
+ processVersion?: string;
518
+ /** Whether this is the latest version of the process */
519
+ isLatestVersion?: boolean;
520
+ /** The display name of the process */
521
+ name?: string;
522
+ /** The numeric ID of the release */
523
+ id?: number;
524
+ }
525
+ /**
526
+ * Raw job response from the API before method attachment
527
+ */
528
+ interface RawJobGetResponse extends FolderProperties {
529
+ /** The unique numeric identifier of the job */
530
+ id: number;
531
+ /** The unique job identifier (GUID) */
532
+ key: string;
533
+ /** The current execution state of the job */
534
+ state: JobState;
535
+ /** The date and time when the job was created */
536
+ createdTime: string;
537
+ /** The date and time when the job execution started, or null if the job hasn't started yet */
538
+ startTime: string | null;
539
+ /** The date and time when the job execution ended, or null if the job hasn't ended yet */
540
+ endTime: string | null;
541
+ /** The date and time when the job was last modified */
542
+ lastModifiedTime: string | null;
543
+ /** The date and time when the job was resumed after suspension */
544
+ resumeTime: string | null;
545
+ /** The name of the process (release) associated with the job */
546
+ processName: string | null;
547
+ /** Path to the entry point workflow (XAML) that will be executed by the robot */
548
+ entryPointPath: string | null;
549
+ /** The name of the machine where the robot ran the job */
550
+ hostMachineName: string | null;
551
+ /** Input parameters as a JSON string passed to job execution */
552
+ inputArguments: string | null;
553
+ /** Output parameters as a JSON string resulted from job execution */
554
+ outputArguments: string | null;
555
+ /** Attachment key for file-based output when output is too large for inline arguments */
556
+ outputFile: string | null;
557
+ /** Environment variables as a JSON string passed to the job execution */
558
+ environmentVariables: string | null;
559
+ /** Additional information about the current job */
560
+ info: string | null;
561
+ /** The source name of the job, describing how the job was triggered */
562
+ source: string | null;
563
+ /** Reference identifier for the job, used for external correlation */
564
+ reference: string | null;
565
+ /** The execution priority of the job */
566
+ jobPriority: JobPriority | null;
567
+ /** Value for more granular control over execution priority (1-100) */
568
+ specificPriorityValue: number | null;
569
+ /** The type of the job - Attended if started via the robot, Unattended otherwise */
570
+ type: JobType;
571
+ /** The package type of the process associated with the job */
572
+ packageType: PackageType;
573
+ /** The runtime type of the robot which can pick up the job */
574
+ runtimeType: RuntimeType | null;
575
+ /** The source type indicating how the job was triggered */
576
+ sourceType: JobSourceType;
577
+ /** The type of the serverless job, or null for non-serverless jobs */
578
+ serverlessJobType: ServerlessJobType | null;
579
+ /** The stop strategy for the job */
580
+ stopStrategy: StopStrategy | null;
581
+ /** The remote control access level for the job */
582
+ remoteControlAccess: RemoteControlAccess;
583
+ /** The folder key (GUID) of the folder this job is part of */
584
+ folderKey: string | null;
585
+ /** The unique identifier grouping multiple jobs, usually generated when started by a schedule */
586
+ batchExecutionKey: string;
587
+ /** The parent job key (GUID), set when the job was started by another job */
588
+ parentJobKey: string | null;
589
+ /** The ID of the schedule that started the job, or null if started by the user */
590
+ startingScheduleId: number | null;
591
+ /** The starting trigger ID, can be ApiTriggerId or HttpTriggerId */
592
+ startingTriggerId: string | null;
593
+ /** The process version ID */
594
+ processVersionId: number | null;
595
+ /** Expected maximum running time in seconds before the job is flagged */
596
+ maxExpectedRunningTimeSeconds: number | null;
597
+ /** Whether the job requires user interaction */
598
+ requiresUserInteraction: boolean;
599
+ /** If set, the job will resume on the same robot-machine pair on which it initially ran */
600
+ resumeOnSameContext: boolean;
601
+ /** Distinguishes between multiple job suspend/resume cycles */
602
+ resumeVersion: number | null;
603
+ /** The sub-state in which the job is, providing more granular status information */
604
+ subState: JobSubState | null;
605
+ /** The target runtime for the job */
606
+ targetRuntime: string | null;
607
+ /** The trace ID for distributed tracing */
608
+ traceId: string | null;
609
+ /** The parent span ID for distributed tracing */
610
+ parentSpanId: string | null;
611
+ /** The error code associated with a failed job */
612
+ errorCode: string | null;
613
+ /** The machine associated with the job (available when using expand=Machine) */
614
+ machine?: Machine;
615
+ /** The robot associated with the job (available when using expand=Robot) */
616
+ robot?: RobotMetadata;
617
+ /** The process metadata associated with the job (available when using expand=Release) */
618
+ process?: ProcessMetadata | null;
619
+ /** Error details for the job, or null if the job has no errors */
620
+ jobError: JobError | null;
621
+ }
622
+ /**
623
+ * Options for getting all jobs
624
+ */
625
+ type JobGetAllOptions = RequestOptions & PaginationOptions & {
626
+ /**
627
+ * Optional folder ID to filter jobs by folder
628
+ */
629
+ folderId?: number;
630
+ };
631
+
632
+ type JobGetResponse = RawJobGetResponse & JobMethods;
633
+ /**
634
+ * Service for managing UiPath Orchestrator Jobs.
635
+ *
636
+ * Jobs represent the execution of a process (automation) on a UiPath Robot. Each job tracks the lifecycle of a single process run, including its state, timing, input/output arguments, and associated resources. [UiPath Jobs Guide](https://docs.uipath.com/orchestrator/automation-cloud/latest/user-guide/about-jobs)
637
+ *
638
+ * ### Usage
639
+ *
640
+ * Prerequisites: Initialize the SDK first - see [Getting Started](/uipath-typescript/getting-started/#import-initialize)
641
+ *
642
+ * ```typescript
643
+ * import { Jobs } from '@uipath/uipath-typescript/jobs';
644
+ *
645
+ * const jobs = new Jobs(sdk);
646
+ * const allJobs = await jobs.getAll();
647
+ * ```
648
+ */
649
+ interface JobServiceModel {
650
+ /**
651
+ * Gets all jobs across folders with optional filtering and pagination.
652
+ *
653
+ * Returns jobs with full details including state, timing, and input/output arguments.
654
+ * Pass `folderId` to scope the query to a specific folder.
655
+ *
656
+ * !!! info "Input and output fields are not included in `getAll` responses"
657
+ * The `inputArguments`, `inputFile`, `outputArguments`, and `outputFile` fields will always be `null` in the `getAll` response. To retrieve a job's output, use the {@link getOutput} method with the job's `key` and `folderId`.
658
+ *
659
+ * @param options - Query options including optional folderId, filtering, and pagination options
660
+ * @returns Promise resolving to either an array of jobs {@link NonPaginatedResponse}<{@link JobGetResponse}> or a {@link PaginatedResponse}<{@link JobGetResponse}> when pagination options are used.
661
+ * {@link JobGetResponse}
662
+ * @example
663
+ * ```typescript
664
+ * // Get all jobs
665
+ * const allJobs = await jobs.getAll();
666
+ *
667
+ * // Get all jobs in a specific folder
668
+ * const folderJobs = await jobs.getAll({ folderId: <folderId> });
669
+ *
670
+ * // With filtering
671
+ * const runningJobs = await jobs.getAll({
672
+ * filter: "state eq 'Running'"
673
+ * });
674
+ *
675
+ * // First page with pagination
676
+ * const page1 = await jobs.getAll({ pageSize: 10 });
677
+ *
678
+ * // Navigate using cursor
679
+ * if (page1.hasNextPage) {
680
+ * const page2 = await jobs.getAll({ cursor: page1.nextCursor });
681
+ * }
682
+ *
683
+ * // Jump to specific page
684
+ * const page5 = await jobs.getAll({
685
+ * jumpToPage: 5,
686
+ * pageSize: 10
687
+ * });
688
+ * ```
689
+ */
690
+ getAll<T extends JobGetAllOptions = JobGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<JobGetResponse> : NonPaginatedResponse<JobGetResponse>>;
691
+ /**
692
+ * Gets the output of a completed job.
693
+ *
694
+ * Retrieves the job's output arguments, handling both inline output (stored directly on the job
695
+ * as a JSON string in `outputArguments`) and file-based output (stored as a blob attachment for
696
+ * large outputs). Returns the parsed JSON output or `null` if the job has no output.
697
+ *
698
+ * @param jobKey - The unique key (GUID) of the job to retrieve output from
699
+ * @param folderId - The folder ID where the job resides
700
+ * @returns Promise resolving to the parsed output as `Record<string, unknown>`, or `null` if no output exists
701
+ *
702
+ * @example
703
+ * ```typescript
704
+ * // Get output from a completed job
705
+ * const output = await jobs.getOutput(<jobKey>, <folderId>);
706
+ *
707
+ * if (output) {
708
+ * console.log('Job output:', output);
709
+ * }
710
+ * ```
711
+ *
712
+ * @example
713
+ * ```typescript
714
+ * // Get output using bound method (jobKey and folderId are taken from the job object)
715
+ * const allJobs = await jobs.getAll();
716
+ * const completedJob = allJobs.items.find(j => j.state === JobState.Successful);
717
+ *
718
+ * if (completedJob) {
719
+ * const output = await completedJob.getOutput();
720
+ * }
721
+ * ```
722
+ */
723
+ getOutput(jobKey: string, folderId: number): Promise<Record<string, unknown> | null>;
724
+ }
725
+ /**
726
+ * Methods available on job response objects.
727
+ * These are bound to the job data and delegate to the service.
728
+ */
729
+ interface JobMethods {
730
+ /**
731
+ * Gets the output of this job.
732
+ *
733
+ * Retrieves the job's output arguments, handling both inline output (stored directly on the job
734
+ * as a JSON string in `outputArguments`) and file-based output (stored as a blob attachment for
735
+ * large outputs). Returns the parsed JSON output or `null` if the job has no output.
736
+ *
737
+ * @returns Promise resolving to the parsed output as `Record<string, unknown>`, or `null` if no output exists
738
+ *
739
+ * @example
740
+ * ```typescript
741
+ * const allJobs = await jobs.getAll();
742
+ * const completedJob = allJobs.items.find(j => j.state === JobState.Successful);
743
+ *
744
+ * if (completedJob) {
745
+ * const output = await completedJob.getOutput();
746
+ * }
747
+ * ```
748
+ */
749
+ getOutput(): Promise<Record<string, unknown> | null>;
750
+ }
751
+ /**
752
+ * Creates a job response with bound methods.
753
+ *
754
+ * @param jobData - The raw job data from API
755
+ * @param service - The job service instance
756
+ * @returns A job object with added methods
757
+ */
758
+ declare function createJobWithMethods(jobData: RawJobGetResponse, service: JobServiceModel): JobGetResponse;
759
+
760
+ /**
761
+ * Service for interacting with UiPath Orchestrator Jobs API
762
+ */
763
+ declare class JobService extends FolderScopedService implements JobServiceModel {
764
+ private attachmentService;
765
+ /**
766
+ * Creates an instance of the Jobs service.
767
+ *
768
+ * @param instance - UiPath SDK instance providing authentication and configuration
769
+ */
770
+ constructor(instance: IUiPath);
771
+ /**
772
+ * Gets all jobs across folders with optional filtering and pagination.
773
+ *
774
+ * Returns jobs with full details including state, timing, and input/output arguments.
775
+ * Pass `folderId` to scope the query to a specific folder.
776
+ *
777
+ * !!! info "Input and output fields are not included in `getAll` responses"
778
+ * The `inputArguments`, `inputFile`, `outputArguments`, and `outputFile` fields will always be `null` in the `getAll` response. To retrieve a job's output, use the {@link getOutput} method with the job's `key` and `folderId`.
779
+ *
780
+ * @param options - Query options including optional folderId, filtering, and pagination options
781
+ * @returns Promise resolving to either an array of jobs {@link NonPaginatedResponse}<{@link JobGetResponse}> or a {@link PaginatedResponse}<{@link JobGetResponse}> when pagination options are used.
782
+ * {@link JobGetResponse}
783
+ * @example
784
+ * ```typescript
785
+ * // Get all jobs
786
+ * const allJobs = await jobs.getAll();
787
+ *
788
+ * // Get all jobs in a specific folder
789
+ * const folderJobs = await jobs.getAll({ folderId: <folderId> });
790
+ *
791
+ * // With filtering
792
+ * const runningJobs = await jobs.getAll({
793
+ * filter: "state eq 'Running'"
794
+ * });
795
+ *
796
+ * // First page with pagination
797
+ * const page1 = await jobs.getAll({ pageSize: 10 });
798
+ *
799
+ * // Navigate using cursor
800
+ * if (page1.hasNextPage) {
801
+ * const page2 = await jobs.getAll({ cursor: page1.nextCursor });
802
+ * }
803
+ *
804
+ * // Jump to specific page
805
+ * const page5 = await jobs.getAll({
806
+ * jumpToPage: 5,
807
+ * pageSize: 10
808
+ * });
809
+ * ```
810
+ */
811
+ getAll<T extends JobGetAllOptions = JobGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<JobGetResponse> : NonPaginatedResponse<JobGetResponse>>;
812
+ /**
813
+ * Gets the output of a completed job.
814
+ *
815
+ * Retrieves the job's output arguments, handling both inline output (stored directly on the job
816
+ * as a JSON string in `outputArguments`) and file-based output (stored as a blob attachment for
817
+ * large outputs). Returns the parsed JSON output or `null` if the job has no output.
818
+ *
819
+ * @param jobKey - The unique key (GUID) of the job to retrieve output from
820
+ * @param folderId - The folder ID where the job resides
821
+ * @returns Promise resolving to the parsed output as `Record<string, unknown>`, or `null` if no output exists
822
+ *
823
+ * @example
824
+ * ```typescript
825
+ * // Get output from a completed job
826
+ * const output = await jobs.getOutput(<jobKey>, <folderId>);
827
+ *
828
+ * if (output) {
829
+ * console.log('Job output:', output);
830
+ * }
831
+ * ```
832
+ *
833
+ * @example
834
+ * ```typescript
835
+ * // Get output using bound method (jobKey and folderId are taken from the job object)
836
+ * const allJobs = await jobs.getAll();
837
+ * const completedJob = allJobs.items.find(j => j.state === JobState.Successful);
838
+ *
839
+ * if (completedJob) {
840
+ * const output = await completedJob.getOutput();
841
+ * }
842
+ * ```
843
+ */
844
+ getOutput(jobKey: string, folderId: number): Promise<Record<string, unknown> | null>;
845
+ /**
846
+ * Fetches a job by its Key (GUID) using the GetByKey endpoint.
847
+ * Only selects fields needed for output extraction.
848
+ */
849
+ private fetchJobByKey;
850
+ /**
851
+ * Downloads the output file content via the Attachments API.
852
+ * 1. Fetches blob access info from the attachment using AttachmentService
853
+ * 2. Downloads content from the presigned blob URI
854
+ * 3. Parses and returns the JSON content
855
+ */
856
+ private downloadOutputFile;
857
+ }
858
+
859
+ export { JobService, JobState, JobSubState, JobService as Jobs, ServerlessJobType, createJobWithMethods };
860
+ export type { JobGetAllOptions, JobGetResponse, JobMethods, JobServiceModel, ProcessMetadata, RawJobGetResponse };