@uipath/uipath-typescript 1.2.2 → 1.3.1

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 (41) hide show
  1. package/dist/assets/index.cjs +5 -8
  2. package/dist/assets/index.d.ts +3 -1
  3. package/dist/assets/index.mjs +5 -8
  4. package/dist/attachments/index.cjs +5 -8
  5. package/dist/attachments/index.d.ts +3 -1
  6. package/dist/attachments/index.mjs +5 -8
  7. package/dist/buckets/index.cjs +5 -8
  8. package/dist/buckets/index.d.ts +3 -1
  9. package/dist/buckets/index.mjs +5 -8
  10. package/dist/cases/index.cjs +5 -8
  11. package/dist/cases/index.d.ts +3 -1
  12. package/dist/cases/index.mjs +5 -8
  13. package/dist/conversational-agent/index.cjs +38 -16
  14. package/dist/conversational-agent/index.d.ts +26 -4
  15. package/dist/conversational-agent/index.mjs +38 -16
  16. package/dist/core/index.cjs +2 -2
  17. package/dist/core/index.d.ts +2 -2
  18. package/dist/core/index.mjs +2 -2
  19. package/dist/entities/index.cjs +697 -317
  20. package/dist/entities/index.d.ts +572 -58
  21. package/dist/entities/index.mjs +698 -318
  22. package/dist/index.cjs +727 -161
  23. package/dist/index.d.ts +697 -69
  24. package/dist/index.mjs +727 -162
  25. package/dist/index.umd.js +727 -161
  26. package/dist/jobs/index.cjs +278 -20
  27. package/dist/jobs/index.d.ts +214 -19
  28. package/dist/jobs/index.mjs +278 -21
  29. package/dist/maestro-processes/index.cjs +5 -8
  30. package/dist/maestro-processes/index.d.ts +3 -1
  31. package/dist/maestro-processes/index.mjs +5 -8
  32. package/dist/processes/index.cjs +5 -8
  33. package/dist/processes/index.d.ts +3 -1
  34. package/dist/processes/index.mjs +5 -8
  35. package/dist/queues/index.cjs +5 -8
  36. package/dist/queues/index.d.ts +3 -1
  37. package/dist/queues/index.mjs +5 -8
  38. package/dist/tasks/index.cjs +5 -8
  39. package/dist/tasks/index.d.ts +3 -1
  40. package/dist/tasks/index.mjs +5 -8
  41. package/package.json +1 -1
@@ -227,6 +227,8 @@ declare class BaseService {
227
227
  *
228
228
  * @param instance - UiPath SDK instance providing authentication and configuration.
229
229
  * Services receive this via dependency injection in the modular pattern.
230
+ * @param headers - Optional default headers to include in every request (e.g. `x-uipath-external-user-id` for
231
+ * CAS external-app auth)
230
232
  *
231
233
  * @example
232
234
  * ```typescript
@@ -246,7 +248,7 @@ declare class BaseService {
246
248
  * const entities = new Entities(sdk);
247
249
  * ```
248
250
  */
249
- constructor(instance: IUiPath);
251
+ constructor(instance: IUiPath, headers?: Record<string, string>);
250
252
  /**
251
253
  * Gets a valid authentication token, refreshing if necessary.
252
254
  * Use this when you need to manually add Authorization headers (e.g., direct uploads).
@@ -506,7 +508,7 @@ declare enum ServerlessJobType {
506
508
  /**
507
509
  * Interface for process metadata associated with a job.
508
510
  * Represents a lightweight summary of the process (release) linked to a job.
509
- * Available when using 'expand: "Release"' in the query.
511
+ * Available when using 'expand: "release"' in the query.
510
512
  */
511
513
  interface ProcessMetadata {
512
514
  /** The unique key of the release */
@@ -523,9 +525,9 @@ interface ProcessMetadata {
523
525
  id?: number;
524
526
  }
525
527
  /**
526
- * Interface for job response
528
+ * Raw job response from the API before method attachment
527
529
  */
528
- interface JobGetResponse extends FolderProperties {
530
+ interface RawJobGetResponse extends FolderProperties {
529
531
  /** The unique numeric identifier of the job */
530
532
  id: number;
531
533
  /** The unique job identifier (GUID) */
@@ -552,6 +554,8 @@ interface JobGetResponse extends FolderProperties {
552
554
  inputArguments: string | null;
553
555
  /** Output parameters as a JSON string resulted from job execution */
554
556
  outputArguments: string | null;
557
+ /** Attachment key for file-based output when output is too large for inline arguments */
558
+ outputFile: string | null;
555
559
  /** Environment variables as a JSON string passed to the job execution */
556
560
  environmentVariables: string | null;
557
561
  /** Additional information about the current job */
@@ -608,11 +612,11 @@ interface JobGetResponse extends FolderProperties {
608
612
  parentSpanId: string | null;
609
613
  /** The error code associated with a failed job */
610
614
  errorCode: string | null;
611
- /** The machine associated with the job (available when using expand=Machine) */
615
+ /** The machine associated with the job (available when using expand=machine) */
612
616
  machine?: Machine;
613
- /** The robot associated with the job (available when using expand=Robot) */
617
+ /** The robot associated with the job (available when using expand=robot) */
614
618
  robot?: RobotMetadata;
615
- /** The process metadata associated with the job (available when using expand=Release) */
619
+ /** The process metadata associated with the job */
616
620
  process?: ProcessMetadata | null;
617
621
  /** Error details for the job, or null if the job has no errors */
618
622
  jobError: JobError | null;
@@ -626,7 +630,14 @@ type JobGetAllOptions = RequestOptions & PaginationOptions & {
626
630
  */
627
631
  folderId?: number;
628
632
  };
633
+ /**
634
+ * Options for getting a job by ID
635
+ */
636
+ interface JobGetByIdOptions extends BaseOptions {
637
+ }
629
638
 
639
+ /** Combined response type for job data with bound methods. */
640
+ type JobGetResponse = RawJobGetResponse & JobMethods;
630
641
  /**
631
642
  * Service for managing UiPath Orchestrator Jobs.
632
643
  *
@@ -645,9 +656,15 @@ type JobGetAllOptions = RequestOptions & PaginationOptions & {
645
656
  */
646
657
  interface JobServiceModel {
647
658
  /**
648
- * Gets all jobs across folders with optional filtering
659
+ * Gets all jobs across folders with optional filtering and pagination.
649
660
  *
650
- * @param options - Query options including optional folderId and pagination options
661
+ * Returns jobs with full details including state, timing, and input/output arguments.
662
+ * Pass `folderId` to scope the query to a specific folder.
663
+ *
664
+ * !!! info "Input and output fields are not included in `getAll` responses"
665
+ * 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`.
666
+ *
667
+ * @param options - Query options including optional folderId, filtering, and pagination options
651
668
  * @returns Promise resolving to either an array of jobs {@link NonPaginatedResponse}<{@link JobGetResponse}> or a {@link PaginatedResponse}<{@link JobGetResponse}> when pagination options are used.
652
669
  * {@link JobGetResponse}
653
670
  * @example
@@ -679,29 +696,133 @@ interface JobServiceModel {
679
696
  * ```
680
697
  */
681
698
  getAll<T extends JobGetAllOptions = JobGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<JobGetResponse> : NonPaginatedResponse<JobGetResponse>>;
699
+ /**
700
+ * Gets a job by its unique key (GUID).
701
+ *
702
+ * Returns the full job details including state, timing, input/output arguments, and error information.
703
+ * Use `expand` to include related entities like `robot`, or `machine`.
704
+ *
705
+ * @param id - The unique key (GUID) of the job to retrieve
706
+ * @param folderId - The folder ID where the job resides
707
+ * @param options - Optional query options for expanding or selecting fields
708
+ * @returns Promise resolving to a {@link JobGetResponse} with full job details and bound methods
709
+ *
710
+ * @example
711
+ * ```typescript
712
+ * // Get a job by key
713
+ * const job = await jobs.getById(<id>, <folderId>);
714
+ * console.log(job.state, job.processName);
715
+ * ```
716
+ *
717
+ * @example
718
+ * ```typescript
719
+ * // With expanded related entities
720
+ * const job = await jobs.getById(<id>, <folderId>, {
721
+ * expand: 'robot,machine'
722
+ * });
723
+ * console.log(job.robot?.name, job.machine?.name);
724
+ * ```
725
+ */
726
+ getById(id: string, folderId: number, options?: JobGetByIdOptions): Promise<JobGetResponse>;
727
+ /**
728
+ * Gets the output of a completed job.
729
+ *
730
+ * Retrieves the job's output arguments, handling both inline output (stored directly on the job
731
+ * as a JSON string in `outputArguments`) and file-based output (stored as a blob attachment for
732
+ * large outputs). Returns the parsed JSON output or `null` if the job has no output.
733
+ *
734
+ * @param jobKey - The unique key (GUID) of the job to retrieve output from
735
+ * @param folderId - The folder ID where the job resides
736
+ * @returns Promise resolving to the parsed output as `Record<string, unknown>`, or `null` if no output exists
737
+ *
738
+ * @example
739
+ * ```typescript
740
+ * // Get output from a completed job
741
+ * const output = await jobs.getOutput(<jobKey>, <folderId>);
742
+ *
743
+ * if (output) {
744
+ * console.log('Job output:', output);
745
+ * }
746
+ * ```
747
+ *
748
+ * @example
749
+ * ```typescript
750
+ * // Get output using bound method (jobKey and folderId are taken from the job object)
751
+ * const allJobs = await jobs.getAll();
752
+ * const completedJob = allJobs.items.find(j => j.state === JobState.Successful);
753
+ *
754
+ * if (completedJob) {
755
+ * const output = await completedJob.getOutput();
756
+ * }
757
+ * ```
758
+ */
759
+ getOutput(jobKey: string, folderId: number): Promise<Record<string, unknown> | null>;
682
760
  }
761
+ /**
762
+ * Methods available on job response objects.
763
+ * These are bound to the job data and delegate to the service.
764
+ */
765
+ interface JobMethods {
766
+ /**
767
+ * Gets the output of this job.
768
+ *
769
+ * Retrieves the job's output arguments, handling both inline output (stored directly on the job
770
+ * as a JSON string in `outputArguments`) and file-based output (stored as a blob attachment for
771
+ * large outputs). Returns the parsed JSON output or `null` if the job has no output.
772
+ *
773
+ * @returns Promise resolving to the parsed output as `Record<string, unknown>`, or `null` if no output exists
774
+ *
775
+ * @example
776
+ * ```typescript
777
+ * const allJobs = await jobs.getAll();
778
+ * const completedJob = allJobs.items.find(j => j.state === JobState.Successful);
779
+ *
780
+ * if (completedJob) {
781
+ * const output = await completedJob.getOutput();
782
+ * }
783
+ * ```
784
+ */
785
+ getOutput(): Promise<Record<string, unknown> | null>;
786
+ }
787
+ /**
788
+ * Creates a job response with bound methods.
789
+ *
790
+ * @param jobData - The raw job data from API
791
+ * @param service - The job service instance
792
+ * @returns A job object with added methods
793
+ */
794
+ declare function createJobWithMethods(jobData: RawJobGetResponse, service: JobServiceModel): JobGetResponse;
683
795
 
684
796
  /**
685
797
  * Service for interacting with UiPath Orchestrator Jobs API
686
798
  */
687
799
  declare class JobService extends FolderScopedService implements JobServiceModel {
800
+ private attachmentService;
688
801
  /**
689
- * Gets all jobs across folders with optional filtering
802
+ * Creates an instance of the Jobs service.
690
803
  *
691
- * @param options - Query options including optional folderId and pagination options
692
- * @returns Promise resolving to array of jobs or paginated response
804
+ * @param instance - UiPath SDK instance providing authentication and configuration
805
+ */
806
+ constructor(instance: IUiPath);
807
+ /**
808
+ * Gets all jobs across folders with optional filtering and pagination.
693
809
  *
694
- * @example
695
- * ```typescript
696
- * import { Jobs } from '@uipath/uipath-typescript/jobs';
810
+ * Returns jobs with full details including state, timing, and input/output arguments.
811
+ * Pass `folderId` to scope the query to a specific folder.
697
812
  *
698
- * const jobs = new Jobs(sdk);
813
+ * !!! info "Input and output fields are not included in `getAll` responses"
814
+ * 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`.
699
815
  *
816
+ * @param options - Query options including optional folderId, filtering, and pagination options
817
+ * @returns Promise resolving to either an array of jobs {@link NonPaginatedResponse}<{@link JobGetResponse}> or a {@link PaginatedResponse}<{@link JobGetResponse}> when pagination options are used.
818
+ * {@link JobGetResponse}
819
+ * @example
820
+ * ```typescript
700
821
  * // Get all jobs
701
822
  * const allJobs = await jobs.getAll();
702
823
  *
703
824
  * // Get all jobs in a specific folder
704
- * const folderJobs = await jobs.getAll({ folderId: 123 });
825
+ * const folderJobs = await jobs.getAll({ folderId: <folderId> });
705
826
  *
706
827
  * // With filtering
707
828
  * const runningJobs = await jobs.getAll({
@@ -715,10 +836,84 @@ declare class JobService extends FolderScopedService implements JobServiceModel
715
836
  * if (page1.hasNextPage) {
716
837
  * const page2 = await jobs.getAll({ cursor: page1.nextCursor });
717
838
  * }
839
+ *
840
+ * // Jump to specific page
841
+ * const page5 = await jobs.getAll({
842
+ * jumpToPage: 5,
843
+ * pageSize: 10
844
+ * });
718
845
  * ```
719
846
  */
720
847
  getAll<T extends JobGetAllOptions = JobGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<JobGetResponse> : NonPaginatedResponse<JobGetResponse>>;
848
+ /**
849
+ * Gets a job by its unique key (GUID).
850
+ *
851
+ * Returns the full job details including state, timing, input/output arguments, and error information.
852
+ * Use `expand` to include related entities like `robot`, or `machine`.
853
+ *
854
+ * @param id - The unique key (GUID) of the job to retrieve
855
+ * @param folderId - The folder ID where the job resides
856
+ * @param options - Optional query options for expanding or selecting fields
857
+ * @returns Promise resolving to a {@link JobGetResponse} with full job details and bound methods
858
+ *
859
+ * @example
860
+ * ```typescript
861
+ * // Get a job by key
862
+ * const job = await jobs.getById(<id>, <folderId>);
863
+ * console.log(job.state, job.processName);
864
+ * ```
865
+ *
866
+ * @example
867
+ * ```typescript
868
+ * // With expanded related entities
869
+ * const job = await jobs.getById(<id>, <folderId>, {
870
+ * expand: 'robot,machine'
871
+ * });
872
+ * console.log(job.robot?.name, job.machine?.name);
873
+ * ```
874
+ */
875
+ getById(id: string, folderId: number, options?: JobGetByIdOptions): Promise<JobGetResponse>;
876
+ /**
877
+ * Gets the output of a completed job.
878
+ *
879
+ * Retrieves the job's output arguments, handling both inline output (stored directly on the job
880
+ * as a JSON string in `outputArguments`) and file-based output (stored as a blob attachment for
881
+ * large outputs). Returns the parsed JSON output or `null` if the job has no output.
882
+ *
883
+ * @param jobKey - The unique key (GUID) of the job to retrieve output from
884
+ * @param folderId - The folder ID where the job resides
885
+ * @returns Promise resolving to the parsed output as `Record<string, unknown>`, or `null` if no output exists
886
+ *
887
+ * @example
888
+ * ```typescript
889
+ * // Get output from a completed job
890
+ * const output = await jobs.getOutput(<jobKey>, <folderId>);
891
+ *
892
+ * if (output) {
893
+ * console.log('Job output:', output);
894
+ * }
895
+ * ```
896
+ *
897
+ * @example
898
+ * ```typescript
899
+ * // Get output using bound method (jobKey and folderId are taken from the job object)
900
+ * const allJobs = await jobs.getAll();
901
+ * const completedJob = allJobs.items.find(j => j.state === JobState.Successful);
902
+ *
903
+ * if (completedJob) {
904
+ * const output = await completedJob.getOutput();
905
+ * }
906
+ * ```
907
+ */
908
+ getOutput(jobKey: string, folderId: number): Promise<Record<string, unknown> | null>;
909
+ /**
910
+ * Downloads the output file content via the Attachments API.
911
+ * 1. Fetches blob access info from the attachment using AttachmentService
912
+ * 2. Downloads content from the presigned blob URI
913
+ * 3. Parses and returns the JSON content
914
+ */
915
+ private downloadOutputFile;
721
916
  }
722
917
 
723
- export { JobService, JobSubState, JobService as Jobs, ServerlessJobType };
724
- export type { JobGetAllOptions, JobGetResponse, JobServiceModel, ProcessMetadata };
918
+ export { JobService, JobState, JobSubState, JobService as Jobs, ServerlessJobType, createJobWithMethods };
919
+ export type { JobGetAllOptions, JobGetByIdOptions, JobGetResponse, JobMethods, JobServiceModel, ProcessMetadata, RawJobGetResponse };