@uipath/uipath-typescript 1.0.0-beta.18 → 1.0.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.
@@ -0,0 +1,1127 @@
1
+ import { IUiPath } from '../core/index';
2
+
3
+ /**
4
+ * Maestro Process Types
5
+ * Types and interfaces for Maestro process management
6
+ */
7
+ /**
8
+ * Process information with instance statistics
9
+ */
10
+ interface RawMaestroProcessGetAllResponse {
11
+ /** Unique key identifying the process */
12
+ processKey: string;
13
+ /** Package identifier */
14
+ packageId: string;
15
+ /** Process name */
16
+ name: string;
17
+ /** Folder key where process is located */
18
+ folderKey: string;
19
+ /** Folder name */
20
+ folderName: string;
21
+ /** Available package versions */
22
+ packageVersions: string[];
23
+ /** Total number of versions */
24
+ versionCount: number;
25
+ /** Process instance count - pending */
26
+ pendingCount: number;
27
+ /** Process instance count - running */
28
+ runningCount: number;
29
+ /** Process instance count - completed */
30
+ completedCount: number;
31
+ /** Process instance count - paused */
32
+ pausedCount: number;
33
+ /** Process instance count - cancelled */
34
+ cancelledCount: number;
35
+ /** Process instance count - faulted */
36
+ faultedCount: number;
37
+ /** Process instance count - retrying */
38
+ retryingCount: number;
39
+ /** Process instance count - resuming */
40
+ resumingCount: number;
41
+ /** Process instance count - pausing */
42
+ pausingCount: number;
43
+ /** Process instance count - canceling */
44
+ cancelingCount: number;
45
+ }
46
+
47
+ /**
48
+ * Process Incident Status
49
+ */
50
+ declare enum ProcessIncidentStatus {
51
+ Open = "Open",
52
+ Closed = "Closed"
53
+ }
54
+ /**
55
+ * Process Incident Type
56
+ */
57
+ declare enum ProcessIncidentType {
58
+ System = "System",
59
+ User = "User",
60
+ Deployment = "Deployment"
61
+ }
62
+ /**
63
+ * Process Incident Severity
64
+ */
65
+ declare enum ProcessIncidentSeverity {
66
+ Error = "Error",
67
+ Warning = "Warning"
68
+ }
69
+ /**
70
+ * Process Incident Debug Mode
71
+ */
72
+ declare enum DebugMode {
73
+ None = "None",
74
+ Default = "Default",
75
+ StepByStep = "StepByStep",
76
+ SingleStep = "SingleStep"
77
+ }
78
+ /**
79
+ * Process Incident Get Response
80
+ */
81
+ interface ProcessIncidentGetResponse {
82
+ instanceId: string;
83
+ elementId: string;
84
+ folderKey: string;
85
+ processKey: string;
86
+ incidentId: string;
87
+ incidentStatus: ProcessIncidentStatus;
88
+ incidentType: ProcessIncidentType | null;
89
+ errorCode: string;
90
+ errorMessage: string;
91
+ errorTime: string;
92
+ errorDetails: string;
93
+ debugMode: DebugMode;
94
+ incidentSeverity: ProcessIncidentSeverity | null;
95
+ incidentElementActivityType: string;
96
+ incidentElementActivityName: string;
97
+ }
98
+ /**
99
+ * Process Incident Summary Get Response
100
+ */
101
+ interface ProcessIncidentGetAllResponse {
102
+ count: number;
103
+ errorMessage: string;
104
+ errorCode: string;
105
+ firstOccuranceTime: string;
106
+ processKey: string;
107
+ }
108
+
109
+ /**
110
+ * Maestro Process Models
111
+ * Model classes for Maestro processes
112
+ */
113
+
114
+ /**
115
+ * Service for managing UiPath Maestro Processes
116
+ *
117
+ * UiPath Maestro is a cloud-native orchestration layer that coordinates bots, AI agents, and humans for seamless, intelligent automation of complex workflows. [UiPath Maestro Guide](https://docs.uipath.com/maestro/automation-cloud/latest/user-guide/introduction-to-maestro)
118
+ *
119
+ * ### Usage
120
+ *
121
+ * Prerequisites: Initialize the SDK first - see [Getting Started](/uipath-typescript/getting-started/#import-initialize)
122
+ *
123
+ * ```typescript
124
+ * import { MaestroProcesses } from '@uipath/uipath-typescript/maestro-processes';
125
+ *
126
+ * const maestroProcesses = new MaestroProcesses(sdk);
127
+ * const allProcesses = await maestroProcesses.getAll();
128
+ * ```
129
+ */
130
+ interface MaestroProcessesServiceModel {
131
+ /**
132
+ * @returns Promise resolving to array of MaestroProcess objects with methods
133
+ * {@link MaestroProcessGetAllResponse}
134
+ * @example
135
+ * ```typescript
136
+ * // Get all processes
137
+ * const allProcesses = await maestroProcesses.getAll();
138
+ *
139
+ * // Access process information and incidents
140
+ * for (const process of allProcesses) {
141
+ * console.log(`Process: ${process.processKey}`);
142
+ * console.log(`Running instances: ${process.runningCount}`);
143
+ * console.log(`Faulted instances: ${process.faultedCount}`);
144
+ *
145
+ * // Get incidents for this process
146
+ * const incidents = await process.getIncidents();
147
+ * console.log(`Incidents: ${incidents.length}`);
148
+ * }
149
+ * ```
150
+ */
151
+ getAll(): Promise<MaestroProcessGetAllResponse[]>;
152
+ /**
153
+ * Get incidents for a specific process
154
+ *
155
+ * @param processKey The key of the process to get incidents for
156
+ * @param folderKey The folder key for authorization
157
+ * @returns Promise resolving to array of incidents for the process
158
+ * {@link ProcessIncidentGetResponse}
159
+ * @example
160
+ * ```typescript
161
+ * // Get incidents for a specific process
162
+ * const incidents = await maestroProcesses.getIncidents('<processKey>', '<folderKey>');
163
+ *
164
+ * // Access incident details
165
+ * for (const incident of incidents) {
166
+ * console.log(`Element: ${incident.incidentElementActivityName} (${incident.incidentElementActivityType})`);
167
+ * console.log(`Status: ${incident.incidentStatus}`);
168
+ * console.log(`Error: ${incident.errorMessage}`);
169
+ * }
170
+ * ```
171
+ */
172
+ getIncidents(processKey: string, folderKey: string): Promise<ProcessIncidentGetResponse[]>;
173
+ }
174
+ interface ProcessMethods {
175
+ /**
176
+ * Gets incidents for this process
177
+ *
178
+ * @returns Promise resolving to array of process incidents
179
+ */
180
+ getIncidents(): Promise<ProcessIncidentGetResponse[]>;
181
+ }
182
+ type MaestroProcessGetAllResponse = RawMaestroProcessGetAllResponse & ProcessMethods;
183
+ /**
184
+ * Creates an actionable process by combining API process data with operational methods.
185
+ *
186
+ * @param processData - The process data from API
187
+ * @param service - The process service instance
188
+ * @returns A process object with added methods
189
+ */
190
+ declare function createProcessWithMethods(processData: MaestroProcessGetAllResponse, service: MaestroProcessesServiceModel): MaestroProcessGetAllResponse;
191
+
192
+ /**
193
+ * Simplified universal pagination cursor
194
+ * Used to fetch next/previous pages
195
+ */
196
+ interface PaginationCursor {
197
+ /** Opaque string containing all information needed to fetch next page */
198
+ value: string;
199
+ }
200
+ /**
201
+ * Discriminated union for pagination methods - ensures cursor and jumpToPage are mutually exclusive
202
+ */
203
+ type PaginationMethodUnion = {
204
+ cursor?: PaginationCursor;
205
+ jumpToPage?: never;
206
+ } | {
207
+ cursor?: never;
208
+ jumpToPage?: number;
209
+ } | {
210
+ cursor?: never;
211
+ jumpToPage?: never;
212
+ };
213
+ /**
214
+ * Pagination options. Users cannot specify both cursor and jumpToPage.
215
+ */
216
+ type PaginationOptions = {
217
+ /** Size of the page to fetch (items per page) */
218
+ pageSize?: number;
219
+ } & PaginationMethodUnion;
220
+ /**
221
+ * Paginated response containing items and navigation information
222
+ */
223
+ interface PaginatedResponse<T> {
224
+ /** The items in the current page */
225
+ items: T[];
226
+ /** Total count of items across all pages (if available) */
227
+ totalCount?: number;
228
+ /** Whether more pages are available */
229
+ hasNextPage: boolean;
230
+ /** Cursor to fetch the next page (if available) */
231
+ nextCursor?: PaginationCursor;
232
+ /** Cursor to fetch the previous page (if available) */
233
+ previousCursor?: PaginationCursor;
234
+ /** Current page number (1-based, if available) */
235
+ currentPage?: number;
236
+ /** Total number of pages (if available) */
237
+ totalPages?: number;
238
+ /** Whether this pagination type supports jumping to arbitrary pages */
239
+ supportsPageJump: boolean;
240
+ }
241
+ /**
242
+ * Response for non-paginated calls that includes both data and total count
243
+ */
244
+ interface NonPaginatedResponse<T> {
245
+ items: T[];
246
+ totalCount?: number;
247
+ }
248
+ /**
249
+ * Helper type for defining paginated method overloads
250
+ * Creates a union type of all ways pagination can be triggered
251
+ */
252
+ type HasPaginationOptions<T> = (T & {
253
+ pageSize: number;
254
+ }) | (T & {
255
+ cursor: PaginationCursor;
256
+ }) | (T & {
257
+ jumpToPage: number;
258
+ });
259
+
260
+ /**
261
+ * Process Instance Types
262
+ * Types and interfaces for Maestro process instance management
263
+ */
264
+
265
+ /**
266
+ * Response for getting a single process instance
267
+ */
268
+ interface RawProcessInstanceGetResponse {
269
+ instanceId: string;
270
+ packageKey: string;
271
+ packageId: string;
272
+ packageVersion: string;
273
+ latestRunId: string;
274
+ latestRunStatus: string;
275
+ processKey: string;
276
+ folderKey: string;
277
+ userId: number;
278
+ instanceDisplayName: string;
279
+ startedByUser: string;
280
+ source: string;
281
+ creatorUserKey: string;
282
+ startedTime: string;
283
+ completedTime: string | null;
284
+ instanceRuns: ProcessInstanceRun[];
285
+ }
286
+ /**
287
+ * Query options for getting process instances
288
+ */
289
+ interface ProcessInstanceGetAllOptions {
290
+ packageId?: string;
291
+ packageVersion?: string;
292
+ processKey?: string;
293
+ errorCode?: string;
294
+ }
295
+ /**
296
+ * Query options for getting process instances with pagination support
297
+ */
298
+ type ProcessInstanceGetAllWithPaginationOptions = ProcessInstanceGetAllOptions & PaginationOptions;
299
+ /**
300
+ * Request for process instance operations (cancel, pause, resume)
301
+ */
302
+ interface ProcessInstanceOperationOptions {
303
+ comment?: string;
304
+ }
305
+ /**
306
+ * Response from PIMS operations (cancel, pause, resume)
307
+ */
308
+ interface ProcessInstanceOperationResponse {
309
+ instanceId: string;
310
+ status: string;
311
+ }
312
+ /**
313
+ * Response for process instance execution history
314
+ */
315
+ interface ProcessInstanceExecutionHistoryResponse {
316
+ id: string;
317
+ traceId: string;
318
+ parentId: string | null;
319
+ name: string;
320
+ startedTime: string;
321
+ endTime: string | null;
322
+ attributes: string | null;
323
+ createdTime: string;
324
+ updatedTime?: string;
325
+ expiredTime: string | null;
326
+ }
327
+ /**
328
+ * Process Instance run
329
+ */
330
+ interface ProcessInstanceRun {
331
+ runId: string;
332
+ status: string;
333
+ startedTime: string;
334
+ completedTime: string;
335
+ }
336
+ type BpmnXmlString = string;
337
+ /**
338
+ * Process Instance element metadata
339
+ */
340
+ interface ElementMetaData {
341
+ elementId: string;
342
+ elementRunId: string;
343
+ isMarker: boolean;
344
+ inputs: Record<string, any>;
345
+ inputDefinitions: Record<string, any>;
346
+ outputs: Record<string, any>;
347
+ }
348
+ /**
349
+ * Process Instance global variable metadata
350
+ */
351
+ interface GlobalVariableMetaData {
352
+ id: string;
353
+ name: string;
354
+ /**
355
+ * Common values: "integer", "string", "boolean"
356
+ * May also contain custom types or "any" when type cannot be determined
357
+ */
358
+ type: string;
359
+ elementId: string;
360
+ /** Name of the BPMN node/element */
361
+ source: string;
362
+ value: any;
363
+ }
364
+ /**
365
+ * Response for getting global variables for process instance
366
+ */
367
+ interface ProcessInstanceGetVariablesResponse {
368
+ elements: ElementMetaData[];
369
+ globalVariables: GlobalVariableMetaData[];
370
+ instanceId: string;
371
+ parentElementId: string | null;
372
+ }
373
+ /**
374
+ * Options for getting global variables
375
+ */
376
+ interface ProcessInstanceGetVariablesOptions {
377
+ parentElementId?: string;
378
+ }
379
+
380
+ /**
381
+ * Standardized result interface for all operation methods (pause, cancel, complete, update, upload, etc.)
382
+ * Success responses include data from the request context or API response
383
+ */
384
+ interface OperationResponse<TData> {
385
+ /**
386
+ * Whether the operation was successful
387
+ */
388
+ success: boolean;
389
+ /**
390
+ * Response data (can contain error details in case of failure)
391
+ */
392
+ data: TData;
393
+ }
394
+
395
+ /**
396
+ * Service for managing UiPath Maestro Process instances
397
+ *
398
+ * Maestro process instances are the running instances of Maestro processes. [UiPath Maestro Process Instances Guide](https://docs.uipath.com/maestro/automation-cloud/latest/user-guide/all-instances-view)
399
+ *
400
+ * ### Usage
401
+ *
402
+ * Prerequisites: Initialize the SDK first - see [Getting Started](/uipath-typescript/getting-started/#import-initialize)
403
+ *
404
+ * ```typescript
405
+ * import { ProcessInstances } from '@uipath/uipath-typescript/maestro-processes';
406
+ *
407
+ * const processInstances = new ProcessInstances(sdk);
408
+ * const allInstances = await processInstances.getAll();
409
+ * ```
410
+ */
411
+ interface ProcessInstancesServiceModel {
412
+ /**
413
+ * Get all process instances with optional filtering and pagination
414
+ *
415
+ * The method returns either:
416
+ * - A NonPaginatedResponse with items array (when no pagination parameters are provided)
417
+ * - A PaginatedResponse with navigation cursors (when any pagination parameter is provided)
418
+ *
419
+ * @param options Query parameters for filtering instances and pagination
420
+ * @returns Promise resolving to either an array of process instances NonPaginatedResponse<ProcessInstanceGetResponse> or a PaginatedResponse<ProcessInstanceGetResponse> when pagination options are used.
421
+ * {@link ProcessInstanceGetResponse}
422
+ * @example
423
+ * ```typescript
424
+ * // Get all instances (non-paginated)
425
+ * const instances = await processInstances.getAll();
426
+ *
427
+ * // Cancel faulted instances using methods directly on instances
428
+ * for (const instance of instances.items) {
429
+ * if (instance.latestRunStatus === 'Faulted') {
430
+ * await instance.cancel({ comment: 'Cancelling faulted instance' });
431
+ * }
432
+ * }
433
+ *
434
+ * // With filtering
435
+ * const filteredInstances = await processInstances.getAll({
436
+ * processKey: 'MyProcess'
437
+ * });
438
+ *
439
+ * // First page with pagination
440
+ * const page1 = await processInstances.getAll({ pageSize: 10 });
441
+ *
442
+ * // Navigate using cursor
443
+ * if (page1.hasNextPage) {
444
+ * const page2 = await processInstances.getAll({ cursor: page1.nextCursor });
445
+ * }
446
+ * ```
447
+ */
448
+ getAll<T extends ProcessInstanceGetAllWithPaginationOptions = ProcessInstanceGetAllWithPaginationOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<ProcessInstanceGetResponse> : NonPaginatedResponse<ProcessInstanceGetResponse>>;
449
+ /**
450
+ * Get a process instance by ID with operation methods (cancel, pause, resume)
451
+ * @param id The ID of the instance to retrieve
452
+ * @param folderKey The folder key for authorization
453
+ * @returns Promise resolving to a process instance
454
+ * {@link ProcessInstanceGetResponse}
455
+ * @example
456
+ * ```typescript
457
+ * // Get a specific process instance
458
+ * const instance = await processInstances.getById(
459
+ * <instanceId>,
460
+ * <folderKey>
461
+ * );
462
+ *
463
+ * // Access instance properties
464
+ * console.log(`Status: ${instance.latestRunStatus}`);
465
+ * ```
466
+ */
467
+ getById(id: string, folderKey: string): Promise<ProcessInstanceGetResponse>;
468
+ /**
469
+ * Get execution history (spans) for a process instance
470
+ * @param instanceId The ID of the instance to get history for
471
+ * @returns Promise resolving to execution history
472
+ * {@link ProcessInstanceExecutionHistoryResponse}
473
+ * @example
474
+ * ```typescript
475
+ * // Get execution history for a process instance
476
+ * const history = await processInstances.getExecutionHistory(
477
+ * <instanceId>
478
+ * );
479
+ *
480
+ * // Analyze execution timeline
481
+ * history.forEach(span => {
482
+ * console.log(`Activity: ${span.name}`);
483
+ * console.log(`Start: ${span.startTime}`);
484
+ * console.log(`Duration: ${span.duration}ms`);
485
+ * });
486
+ * ```
487
+ */
488
+ getExecutionHistory(instanceId: string): Promise<ProcessInstanceExecutionHistoryResponse[]>;
489
+ /**
490
+ * Get BPMN XML file for a process instance
491
+ * @param instanceId The ID of the instance to get BPMN for
492
+ * @param folderKey The folder key for authorization
493
+ * @returns Promise resolving to BPMN XML file
494
+ * {@link BpmnXmlString}
495
+ * @example
496
+ * ```typescript
497
+ * // Get BPMN XML for a process instance
498
+ * const bpmnXml = await processInstances.getBpmn(
499
+ * <instanceId>,
500
+ * <folderKey>
501
+ * );
502
+ *
503
+ * // Render BPMN diagram in frontend using bpmn-js
504
+ * import BpmnViewer from 'bpmn-js/lib/Viewer';
505
+ *
506
+ * const viewer = new BpmnViewer({
507
+ * container: '#bpmn-diagram'
508
+ * });
509
+ *
510
+ * await viewer.importXML(bpmnXml);
511
+ *
512
+ * // Zoom to fit the diagram
513
+ * viewer.get('canvas').zoom('fit-viewport');
514
+ * ```
515
+ */
516
+ getBpmn(instanceId: string, folderKey: string): Promise<BpmnXmlString>;
517
+ /**
518
+ * Cancel a process instance
519
+ * @param instanceId The ID of the instance to cancel
520
+ * @param folderKey The folder key for authorization
521
+ * @param options Optional cancellation options with comment
522
+ * @returns Promise resolving to operation result with instance data
523
+ * @example
524
+ * ```typescript
525
+ * // Cancel a process instance
526
+ * const result = await processInstances.cancel(
527
+ * <instanceId>,
528
+ * <folderKey>
529
+ * );
530
+ *
531
+ * // Or using instance method
532
+ * const instance = await processInstances.getById(
533
+ * <instanceId>,
534
+ * <folderKey>
535
+ * );
536
+ * const result = await instance.cancel();
537
+ *
538
+ * console.log(`Cancelled: ${result.success}`);
539
+ *
540
+ * // Cancel with a comment
541
+ * const resultWithComment = await instance.cancel({
542
+ * comment: 'Cancelling due to invalid input data'
543
+ * });
544
+ *
545
+ * if (resultWithComment.success) {
546
+ * console.log(`Instance ${resultWithComment.data.instanceId} status: ${resultWithComment.data.status}`);
547
+ * }
548
+ * ```
549
+ */
550
+ cancel(instanceId: string, folderKey: string, options?: ProcessInstanceOperationOptions): Promise<OperationResponse<ProcessInstanceOperationResponse>>;
551
+ /**
552
+ * Pause a process instance
553
+ * @param instanceId The ID of the instance to pause
554
+ * @param folderKey The folder key for authorization
555
+ * @param options Optional pause options with comment
556
+ * @returns Promise resolving to operation result with instance data
557
+ */
558
+ pause(instanceId: string, folderKey: string, options?: ProcessInstanceOperationOptions): Promise<OperationResponse<ProcessInstanceOperationResponse>>;
559
+ /**
560
+ * Resume a process instance
561
+ * @param instanceId The ID of the instance to resume
562
+ * @param folderKey The folder key for authorization
563
+ * @param options Optional resume options with comment
564
+ * @returns Promise resolving to operation result with instance data
565
+ */
566
+ resume(instanceId: string, folderKey: string, options?: ProcessInstanceOperationOptions): Promise<OperationResponse<ProcessInstanceOperationResponse>>;
567
+ /**
568
+ * Get global variables for a process instance
569
+ *
570
+ * @param instanceId The ID of the instance to get variables for
571
+ * @param folderKey The folder key for authorization
572
+ * @param options Optional options including parentElementId to filter by parent element
573
+ * @returns Promise resolving to variables response with elements and globals
574
+ * {@link ProcessInstanceGetVariablesResponse}
575
+ * @example
576
+ * ```typescript
577
+ * // Get all variables for a process instance
578
+ * const variables = await processInstances.getVariables(
579
+ * <instanceId>,
580
+ * <folderKey>
581
+ * );
582
+ *
583
+ * // Access global variables
584
+ * console.log('Global variables:', variables.globalVariables);
585
+ *
586
+ * // Iterate through global variables with metadata
587
+ * variables.globalVariables?.forEach(variable => {
588
+ * console.log(`Variable: ${variable.name} (${variable.id})`);
589
+ * console.log(` Type: ${variable.type}`);
590
+ * console.log(` Element: ${variable.elementId}`);
591
+ * console.log(` Value: ${variable.value}`);
592
+ * });
593
+ *
594
+ * // Get variables for a specific parent element
595
+ * const elementVariables = await processInstances.getVariables(
596
+ * <instanceId>,
597
+ * <folderKey>,
598
+ * { parentElementId: <parentElementId> }
599
+ * );
600
+ * ```
601
+ */
602
+ getVariables(instanceId: string, folderKey: string, options?: ProcessInstanceGetVariablesOptions): Promise<ProcessInstanceGetVariablesResponse>;
603
+ /**
604
+ * Get incidents for a process instance
605
+ *
606
+ * @param instanceId The ID of the instance to get incidents for
607
+ * @param folderKey The folder key for authorization
608
+ * @returns Promise resolving to array of incidents for the processinstance
609
+ * {@link ProcessIncidentGetResponse}
610
+ * @example
611
+ * ```typescript
612
+ * // Get incidents for a specific instance
613
+ * const incidents = await processInstances.getIncidents('<instanceId>', '<folderKey>');
614
+ *
615
+ * // Access process incident details
616
+ * for (const incident of incidents) {
617
+ * console.log(`Element: ${incident.incidentElementActivityName} (${incident.incidentElementActivityType})`);
618
+ * console.log(`Severity: ${incident.incidentSeverity}`);
619
+ * console.log(`Error: ${incident.errorMessage}`);
620
+ * }
621
+ * ```
622
+ */
623
+ getIncidents(instanceId: string, folderKey: string): Promise<ProcessIncidentGetResponse[]>;
624
+ }
625
+ interface ProcessInstanceMethods {
626
+ /**
627
+ * Cancels this process instance
628
+ *
629
+ * @param options - Optional cancellation options with comment
630
+ * @returns Promise resolving to operation result
631
+ */
632
+ cancel(options?: ProcessInstanceOperationOptions): Promise<OperationResponse<ProcessInstanceOperationResponse>>;
633
+ /**
634
+ * Pauses this process instance
635
+ *
636
+ * @param options - Optional pause options with comment
637
+ * @returns Promise resolving to operation result
638
+ */
639
+ pause(options?: ProcessInstanceOperationOptions): Promise<OperationResponse<ProcessInstanceOperationResponse>>;
640
+ /**
641
+ * Resumes this process instance
642
+ *
643
+ * @param options - Optional resume options with comment
644
+ * @returns Promise resolving to operation result
645
+ */
646
+ resume(options?: ProcessInstanceOperationOptions): Promise<OperationResponse<ProcessInstanceOperationResponse>>;
647
+ /**
648
+ * Gets incidents for this process instance
649
+ *
650
+ * @returns Promise resolving to array of incidents for this instance
651
+ */
652
+ getIncidents(): Promise<ProcessIncidentGetResponse[]>;
653
+ /**
654
+ * Gets execution history (spans) for this process instance
655
+ *
656
+ * @returns Promise resolving to execution history
657
+ */
658
+ getExecutionHistory(): Promise<ProcessInstanceExecutionHistoryResponse[]>;
659
+ /**
660
+ * Gets BPMN XML file for this process instance
661
+ *
662
+ * @returns Promise resolving to BPMN XML file
663
+ */
664
+ getBpmn(): Promise<BpmnXmlString>;
665
+ /**
666
+ * Gets global variables for this process instance
667
+ *
668
+ * @param options - Optional options including parentElementId to filter by parent element
669
+ * @returns Promise resolving to variables response with elements and globals
670
+ */
671
+ getVariables(options?: ProcessInstanceGetVariablesOptions): Promise<ProcessInstanceGetVariablesResponse>;
672
+ }
673
+ type ProcessInstanceGetResponse = RawProcessInstanceGetResponse & ProcessInstanceMethods;
674
+ /**
675
+ * Creates an actionable process instance by combining API process instance data with operational methods.
676
+ *
677
+ * @param instanceData - The process instance data from API
678
+ * @param service - The process instance service instance
679
+ * @returns A process instance object with added methods
680
+ */
681
+ declare function createProcessInstanceWithMethods(instanceData: RawProcessInstanceGetResponse, service: ProcessInstancesServiceModel): ProcessInstanceGetResponse;
682
+
683
+ /**
684
+ * Service for managing UiPath Maestro Process incidents
685
+ *
686
+ * Maestro Process incidents helps you identify, investigate, and resolve errors that occur during process execution. [UiPath Maestro Process Incidents Guide](https://docs.uipath.com/maestro/automation-cloud/latest/user-guide/all-incidents-view)
687
+ */
688
+ interface ProcessIncidentsServiceModel {
689
+ /**
690
+ * Get all process incidents across all folders
691
+ *
692
+ * @returns Promise resolving to array of process incident
693
+ * {@link ProcessIncidentGetAllResponse}
694
+ * @example
695
+ * ```typescript
696
+ * import { ProcessIncidents } from '@uipath/uipath-typescript/maestro-processes';
697
+ *
698
+ * const processIncidents = new ProcessIncidents(sdk);
699
+ *
700
+ * // Get all process incidents across all folders
701
+ * const incidents = await processIncidents.getAll();
702
+ *
703
+ * // Access process incident information
704
+ * for (const incident of incidents) {
705
+ * console.log(`Process: ${incident.processKey}`);
706
+ * console.log(`Error: ${incident.errorMessage}`);
707
+ * console.log(`Count: ${incident.count}`);
708
+ * console.log(`First occurrence: ${incident.firstOccuranceTime}`);
709
+ * }
710
+ * ```
711
+ */
712
+ getAll(): Promise<ProcessIncidentGetAllResponse[]>;
713
+ }
714
+
715
+ /**
716
+ * Pagination types supported by the SDK
717
+ */
718
+ declare enum PaginationType {
719
+ OFFSET = "offset",
720
+ TOKEN = "token"
721
+ }
722
+ /**
723
+ * Interface for service access methods needed by pagination helpers
724
+ */
725
+ interface PaginationServiceAccess {
726
+ get<T>(path: string, options?: any): Promise<{
727
+ data: T;
728
+ }>;
729
+ post<T>(path: string, body?: any, options?: any): Promise<{
730
+ data: T;
731
+ }>;
732
+ requestWithPagination<T>(method: string, path: string, paginationOptions: PaginationOptions, options: RequestWithPaginationOptions): Promise<PaginatedResponse<T>>;
733
+ }
734
+ /**
735
+ * Field names for extracting data from paginated responses.
736
+ */
737
+ interface PaginationFieldNames {
738
+ itemsField?: string;
739
+ totalCountField?: string;
740
+ continuationTokenField?: string;
741
+ }
742
+ /**
743
+ * Options for the requestWithPagination method in BaseService.
744
+ */
745
+ interface RequestWithPaginationOptions extends RequestSpec {
746
+ pagination: PaginationFieldNames & {
747
+ paginationType: PaginationType;
748
+ paginationParams?: {
749
+ pageSizeParam?: string;
750
+ offsetParam?: string;
751
+ tokenParam?: string;
752
+ countParam?: string;
753
+ };
754
+ };
755
+ }
756
+
757
+ /**
758
+ * HTTP methods supported by the API client
759
+ */
760
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
761
+ /**
762
+ * Supported response types for API requests
763
+ */
764
+ type ResponseType = 'json' | 'text' | 'blob' | 'arraybuffer' | 'stream';
765
+ /**
766
+ * Query parameters type with support for arrays and nested objects
767
+ */
768
+ type QueryParams = Record<string, string | number | boolean | Array<string | number | boolean> | null | undefined>;
769
+ /**
770
+ * Standard HTTP headers type
771
+ */
772
+ type Headers = Record<string, string>;
773
+ /**
774
+ * Options for request retries
775
+ */
776
+ interface RetryOptions {
777
+ /** Maximum number of retry attempts */
778
+ maxRetries?: number;
779
+ /** Base delay between retries in milliseconds */
780
+ retryDelay?: number;
781
+ /** Whether to use exponential backoff */
782
+ useExponentialBackoff?: boolean;
783
+ /** Status codes that should trigger a retry */
784
+ retryableStatusCodes?: number[];
785
+ }
786
+ /**
787
+ * Options for request timeouts
788
+ */
789
+ interface TimeoutOptions {
790
+ /** Request timeout in milliseconds */
791
+ timeout?: number;
792
+ /** Whether to abort the request on timeout */
793
+ abortOnTimeout?: boolean;
794
+ }
795
+ /**
796
+ * Options for request body transformation
797
+ */
798
+ interface BodyOptions {
799
+ /** Whether to stringify the body */
800
+ stringify?: boolean;
801
+ /** Content type override */
802
+ contentType?: string;
803
+ }
804
+ /**
805
+ * Pagination metadata for API requests
806
+ */
807
+ interface PaginationMetadata {
808
+ /** Type of pagination used by the API endpoint */
809
+ paginationType: PaginationType;
810
+ /** Response field containing items array (defaults to 'value') */
811
+ itemsField?: string;
812
+ /** Response field containing total count (defaults to '@odata.count') */
813
+ totalCountField?: string;
814
+ /** Response field containing continuation token (defaults to 'continuationToken') */
815
+ continuationTokenField?: string;
816
+ }
817
+ /**
818
+ * Base interface for all API requests
819
+ */
820
+ interface RequestSpec {
821
+ /** HTTP method for the request */
822
+ method?: HttpMethod;
823
+ /** URL endpoint for the request */
824
+ url?: string;
825
+ /** Query parameters to be appended to the URL */
826
+ params?: QueryParams;
827
+ /** HTTP headers to include with the request */
828
+ headers?: Headers;
829
+ /** Raw body content (takes precedence over data) */
830
+ body?: unknown;
831
+ /** Expected response type */
832
+ responseType?: ResponseType;
833
+ /** Request timeout options */
834
+ timeoutOptions?: TimeoutOptions;
835
+ /** Retry behavior options */
836
+ retryOptions?: RetryOptions;
837
+ /** Body transformation options */
838
+ bodyOptions?: BodyOptions;
839
+ /** AbortSignal for cancelling the request */
840
+ signal?: AbortSignal;
841
+ /** Pagination metadata for the request */
842
+ pagination?: PaginationMetadata;
843
+ }
844
+
845
+ interface ApiResponse<T> {
846
+ data: T;
847
+ }
848
+ /**
849
+ * Base class for all UiPath SDK services.
850
+ *
851
+ * Provides common functionality for authentication, configuration, and API communication.
852
+ * All service classes extend this base to inherit dependency injection and HTTP client access.
853
+ *
854
+ * This class implements the dependency injection pattern where services receive a configured
855
+ * UiPath instance. The ApiClient is created internally and handles all HTTP operations
856
+ * including authentication token management.
857
+ *
858
+ * @remarks
859
+ * Service classes should extend this base and call `super(uiPath)` in their constructor.
860
+ * Protected HTTP methods (get, post, put, patch, delete) are available to all subclasses.
861
+ *
862
+ */
863
+ declare class BaseService {
864
+ #private;
865
+ /**
866
+ * Creates a base service instance with dependency injection.
867
+ *
868
+ * Extracts configuration, execution context, and token manager from the UiPath instance
869
+ * to initialize an authenticated API client. The ApiClient handles all HTTP operations
870
+ * and token management internally.
871
+ *
872
+ * @param instance - UiPath SDK instance providing authentication and configuration.
873
+ * Services receive this via dependency injection in the modular pattern.
874
+ *
875
+ * @example
876
+ * ```typescript
877
+ * // Services automatically call this via super()
878
+ * export class EntityService extends BaseService {
879
+ * constructor(instance: IUiPath) {
880
+ * super(instance); // Initializes the internal ApiClient
881
+ * }
882
+ * }
883
+ *
884
+ * // Usage in modular pattern
885
+ * import { UiPath } from '@uipath/uipath-typescript/core';
886
+ * import { Entities } from '@uipath/uipath-typescript/entities';
887
+ *
888
+ * const sdk = new UiPath(config);
889
+ * await sdk.initialize();
890
+ * const entities = new Entities(sdk);
891
+ * ```
892
+ */
893
+ constructor(instance: IUiPath);
894
+ /**
895
+ * Gets a valid authentication token, refreshing if necessary.
896
+ * Use this when you need to manually add Authorization headers (e.g., direct uploads).
897
+ *
898
+ * @returns Promise resolving to a valid access token string
899
+ * @throws AuthenticationError if no token is available or refresh fails
900
+ */
901
+ protected getValidAuthToken(): Promise<string>;
902
+ /**
903
+ * Creates a service accessor for pagination helpers
904
+ * This allows pagination helpers to access protected methods without making them public
905
+ */
906
+ protected createPaginationServiceAccess(): PaginationServiceAccess;
907
+ protected request<T>(method: string, path: string, options?: RequestSpec): Promise<ApiResponse<T>>;
908
+ protected requestWithSpec<T>(spec: RequestSpec): Promise<ApiResponse<T>>;
909
+ protected get<T>(path: string, options?: RequestSpec): Promise<ApiResponse<T>>;
910
+ protected post<T>(path: string, data?: unknown, options?: RequestSpec): Promise<ApiResponse<T>>;
911
+ protected put<T>(path: string, data?: unknown, options?: RequestSpec): Promise<ApiResponse<T>>;
912
+ protected patch<T>(path: string, data?: unknown, options?: RequestSpec): Promise<ApiResponse<T>>;
913
+ protected delete<T>(path: string, options?: RequestSpec): Promise<ApiResponse<T>>;
914
+ /**
915
+ * Execute a request with cursor-based pagination
916
+ */
917
+ protected requestWithPagination<T>(method: string, path: string, paginationOptions: PaginationOptions, options: RequestWithPaginationOptions): Promise<PaginatedResponse<T>>;
918
+ /**
919
+ * Validates and prepares pagination parameters from options
920
+ */
921
+ private validateAndPreparePaginationParams;
922
+ /**
923
+ * Prepares request parameters for pagination based on pagination type
924
+ */
925
+ private preparePaginationRequestParams;
926
+ /**
927
+ * Creates a paginated response from API response
928
+ */
929
+ private createPaginatedResponseFromResponse;
930
+ /**
931
+ * Determines if there are more pages based on pagination type and metadata
932
+ */
933
+ private determineHasMorePages;
934
+ }
935
+
936
+ /**
937
+ * Service for interacting with Maestro Processes
938
+ */
939
+ declare class MaestroProcessesService extends BaseService implements MaestroProcessesServiceModel {
940
+ private processInstancesService;
941
+ /**
942
+ * Creates an instance of the Maestro Processes service.
943
+ *
944
+ * @param instance - UiPath SDK instance providing authentication and configuration
945
+ */
946
+ constructor(instance: IUiPath);
947
+ /**
948
+ * Get all processes with their instance statistics
949
+ * @returns Promise resolving to array of MaestroProcess objects
950
+ *
951
+ * @example
952
+ * ```typescript
953
+ * import { MaestroProcesses } from '@uipath/uipath-typescript/maestro-processes';
954
+ *
955
+ * const maestroProcesses = new MaestroProcesses(sdk);
956
+ * const processes = await maestroProcesses.getAll();
957
+ *
958
+ * // Access process information
959
+ * for (const process of processes) {
960
+ * console.log(`Process: ${process.processKey}`);
961
+ * console.log(`Running instances: ${process.runningCount}`);
962
+ * console.log(`Faulted instances: ${process.faultedCount}`);
963
+ * }
964
+ * ```
965
+ */
966
+ getAll(): Promise<MaestroProcessGetAllResponse[]>;
967
+ /**
968
+ * Get incidents for a specific process
969
+ */
970
+ getIncidents(processKey: string, folderKey: string): Promise<ProcessIncidentGetResponse[]>;
971
+ }
972
+
973
+ declare class ProcessInstancesService extends BaseService implements ProcessInstancesServiceModel {
974
+ /**
975
+ * Get all process instances with optional filtering and pagination
976
+ *
977
+ * The method returns either:
978
+ * - A NonPaginatedResponse with items array (when no pagination parameters are provided)
979
+ * - A PaginatedResponse with navigation cursors (when any pagination parameter is provided)
980
+ *
981
+ * @param options Query parameters for filtering instances and pagination
982
+ * @returns Promise resolving to process instances or paginated result
983
+ *
984
+ * @example
985
+ * ```typescript
986
+ * import { ProcessInstances } from '@uipath/uipath-typescript/maestro-processes';
987
+ *
988
+ * const processInstances = new ProcessInstances(sdk);
989
+ *
990
+ * // Get all instances (non-paginated)
991
+ * const instances = await processInstances.getAll();
992
+ *
993
+ * // Cancel faulted instances using methods directly on instances
994
+ * for (const instance of instances.items) {
995
+ * if (instance.latestRunStatus === 'Faulted') {
996
+ * await instance.cancel({ comment: 'Cancelling faulted instance' });
997
+ * }
998
+ * }
999
+ *
1000
+ * // With filtering
1001
+ * const filtered = await processInstances.getAll({
1002
+ * processKey: 'MyProcess'
1003
+ * });
1004
+ *
1005
+ * // First page with pagination
1006
+ * const page1 = await processInstances.getAll({ pageSize: 10 });
1007
+ *
1008
+ * // Navigate using cursor
1009
+ * if (page1.hasNextPage) {
1010
+ * const page2 = await processInstances.getAll({ cursor: page1.nextCursor });
1011
+ * }
1012
+ * ```
1013
+ */
1014
+ getAll<T extends ProcessInstanceGetAllWithPaginationOptions = ProcessInstanceGetAllWithPaginationOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<ProcessInstanceGetResponse> : NonPaginatedResponse<ProcessInstanceGetResponse>>;
1015
+ /**
1016
+ * Get a process instance by ID with operation methods (cancel, pause, resume)
1017
+ * @param id The ID of the instance to retrieve
1018
+ * @param folderKey The folder key for authorization
1019
+ * @returns Promise<ProcessInstanceGetResponse>
1020
+ */
1021
+ getById(id: string, folderKey: string): Promise<ProcessInstanceGetResponse>;
1022
+ /**
1023
+ * Get execution history (spans) for a process instance
1024
+ * @param instanceId The ID of the instance to get history for
1025
+ * @returns Promise<ProcessInstanceExecutionHistoryResponse[]>
1026
+ */
1027
+ getExecutionHistory(instanceId: string): Promise<ProcessInstanceExecutionHistoryResponse[]>;
1028
+ /**
1029
+ * Get BPMN XML file for a process instance
1030
+ * @param instanceId The ID of the instance to get BPMN for
1031
+ * @param folderKey The folder key for authorization
1032
+ * @returns Promise<BpmnXmlString> The BPMN XML contents as a string
1033
+ */
1034
+ getBpmn(instanceId: string, folderKey: string): Promise<BpmnXmlString>;
1035
+ /**
1036
+ * Cancel a process instance
1037
+ * @param instanceId The ID of the instance to cancel
1038
+ * @param folderKey The folder key for authorization
1039
+ * @param options Optional cancellation options with comment
1040
+ * @returns Promise resolving to operation result with updated instance data
1041
+ */
1042
+ cancel(instanceId: string, folderKey: string, options?: ProcessInstanceOperationOptions): Promise<OperationResponse<ProcessInstanceOperationResponse>>;
1043
+ /**
1044
+ * Pause a process instance
1045
+ * @param instanceId The ID of the instance to pause
1046
+ * @param folderKey The folder key for authorization
1047
+ * @param options Optional pause options with comment
1048
+ * @returns Promise resolving to operation result with updated instance data
1049
+ */
1050
+ pause(instanceId: string, folderKey: string, options?: ProcessInstanceOperationOptions): Promise<OperationResponse<ProcessInstanceOperationResponse>>;
1051
+ /**
1052
+ * Resume a process instance
1053
+ * @param instanceId The ID of the instance to resume
1054
+ * @param folderKey The folder key for authorization
1055
+ * @param options Optional resume options with comment
1056
+ * @returns Promise resolving to operation result with updated instance data
1057
+ */
1058
+ resume(instanceId: string, folderKey: string, options?: ProcessInstanceOperationOptions): Promise<OperationResponse<ProcessInstanceOperationResponse>>;
1059
+ /**
1060
+ * Parses BPMN XML to extract variable metadata from uipath:inputOutput elements
1061
+ * @private
1062
+ * @param bpmnXml The BPMN XML string
1063
+ * @returns Map of variable ID to metadata
1064
+ */
1065
+ private parseBpmnVariables;
1066
+ /**
1067
+ * Extracts element names from BPMN XML and maps them to their element IDs
1068
+ * @private
1069
+ * @param bpmnXml The BPMN XML string
1070
+ * @returns Map of elementId to element name
1071
+ */
1072
+ private getVariableSource;
1073
+ /**
1074
+ * Enriches global variables with metadata from BPMN
1075
+ * @private
1076
+ * @param globals The raw globals object from API response
1077
+ * @param variableMetadata The parsed BPMN variable metadata
1078
+ * @returns Array of global variables
1079
+ */
1080
+ private transformGlobalVariables;
1081
+ /**
1082
+ * Get global variables for a process instance
1083
+ * @param instanceId The ID of the instance to get variables for
1084
+ * @param folderKey The folder key for authorization
1085
+ * @param options Optional options including parentElementId to filter by parent element
1086
+ * @returns Promise<ProcessInstanceGetVariablesResponse>
1087
+ */
1088
+ getVariables(instanceId: string, folderKey: string, options?: ProcessInstanceGetVariablesOptions): Promise<ProcessInstanceGetVariablesResponse>;
1089
+ /**
1090
+ * Get incidents for a process instance
1091
+ * @param instanceId The ID of the instance to get incidents for
1092
+ * @param folderKey The folder key for authorization
1093
+ * @returns Promise<ProcessIncidentGetResponse[]>
1094
+ */
1095
+ getIncidents(instanceId: string, folderKey: string): Promise<ProcessIncidentGetResponse[]>;
1096
+ }
1097
+
1098
+ /**
1099
+ * Service class for Maestro Process Incidents
1100
+ */
1101
+ declare class ProcessIncidentsService extends BaseService implements ProcessIncidentsServiceModel {
1102
+ /**
1103
+ * Get all process incidents across all folders
1104
+ *
1105
+ * @returns Promise resolving to array of process incident
1106
+ * {@link ProcessIncidentGetAllResponse}
1107
+ * @example
1108
+ * ```typescript
1109
+ * import { ProcessIncidents } from '@uipath/uipath-typescript/maestro-processes';
1110
+ *
1111
+ * const processIncidents = new ProcessIncidents(sdk);
1112
+ * const incidents = await processIncidents.getAll();
1113
+ *
1114
+ * // Access process incident information
1115
+ * for (const incident of incidents) {
1116
+ * console.log(`Process: ${incident.processKey}`);
1117
+ * console.log(`Error: ${incident.errorMessage}`);
1118
+ * console.log(`Count: ${incident.count}`);
1119
+ * console.log(`First occurrence: ${incident.firstOccuranceTime}`);
1120
+ * }
1121
+ * ```
1122
+ */
1123
+ getAll(): Promise<ProcessIncidentGetAllResponse[]>;
1124
+ }
1125
+
1126
+ export { DebugMode, MaestroProcessesService as MaestroProcesses, MaestroProcessesService, ProcessIncidentSeverity, ProcessIncidentStatus, ProcessIncidentType, ProcessIncidentsService as ProcessIncidents, ProcessIncidentsService, ProcessInstancesService as ProcessInstances, ProcessInstancesService, createProcessInstanceWithMethods, createProcessWithMethods };
1127
+ export type { BpmnXmlString, ElementMetaData, GlobalVariableMetaData, MaestroProcessGetAllResponse, MaestroProcessesServiceModel, ProcessIncidentGetAllResponse, ProcessIncidentGetResponse, ProcessIncidentsServiceModel, ProcessInstanceExecutionHistoryResponse, ProcessInstanceGetAllOptions, ProcessInstanceGetAllWithPaginationOptions, ProcessInstanceGetResponse, ProcessInstanceGetVariablesOptions, ProcessInstanceGetVariablesResponse, ProcessInstanceMethods, ProcessInstanceOperationOptions, ProcessInstanceOperationResponse, ProcessInstanceRun, ProcessInstancesServiceModel, ProcessMethods, RawMaestroProcessGetAllResponse, RawProcessInstanceGetResponse };