@uipath/uipath-typescript 1.2.2 → 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.
@@ -1644,6 +1644,36 @@ class FolderScopedService extends BaseService {
1644
1644
  }
1645
1645
  }
1646
1646
 
1647
+ /**
1648
+ * Creates methods for a job response object.
1649
+ *
1650
+ * @param jobData - The raw job data from API
1651
+ * @param service - The job service instance
1652
+ * @returns Object containing job methods
1653
+ */
1654
+ function createJobMethods(jobData, service) {
1655
+ return {
1656
+ async getOutput() {
1657
+ if (!jobData.key)
1658
+ throw new Error('Job key is undefined');
1659
+ if (!jobData.folderId)
1660
+ throw new Error('Job folderId is undefined');
1661
+ return service.getOutput(jobData.key, jobData.folderId);
1662
+ },
1663
+ };
1664
+ }
1665
+ /**
1666
+ * Creates a job response with bound methods.
1667
+ *
1668
+ * @param jobData - The raw job data from API
1669
+ * @param service - The job service instance
1670
+ * @returns A job object with added methods
1671
+ */
1672
+ function createJobWithMethods(jobData, service) {
1673
+ const methods = createJobMethods(jobData, service);
1674
+ return Object.assign({}, jobData, methods);
1675
+ }
1676
+
1647
1677
  /**
1648
1678
  * Base path constants for different services
1649
1679
  */
@@ -1657,6 +1687,13 @@ const ORCHESTRATOR_BASE = 'orchestrator_';
1657
1687
  */
1658
1688
  const JOB_ENDPOINTS = {
1659
1689
  GET_ALL: `${ORCHESTRATOR_BASE}/odata/Jobs`,
1690
+ GET_BY_KEY: (identifier) => `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.GetByKey(identifier=${identifier})`,
1691
+ };
1692
+ /**
1693
+ * Orchestrator Attachment Service Endpoints
1694
+ */
1695
+ const ORCHESTRATOR_ATTACHMENT_ENDPOINTS = {
1696
+ GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Attachments(${id})`,
1660
1697
  };
1661
1698
 
1662
1699
  /**
@@ -1680,7 +1717,7 @@ const JobMap = {
1680
1717
  // Connection string placeholder that will be replaced during build
1681
1718
  const CONNECTION_STRING = "InstrumentationKey=a6efa11d-1feb-4508-9738-e13e12dcae5e;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=7c58eb1c-9581-4ba6-839e-11725848a037";
1682
1719
  // SDK Version placeholder
1683
- const SDK_VERSION = "1.2.2";
1720
+ const SDK_VERSION = "1.3.0";
1684
1721
  const VERSION = "Version";
1685
1722
  const SERVICE = "Service";
1686
1723
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -1906,8 +1943,9 @@ function createTrackedFunction(originalFunction, nameOrOptions, fallbackName, op
1906
1943
  // Track the event if enabled
1907
1944
  if (shouldTrack) {
1908
1945
  // Use the full name provided in the decorator (e.g., "Queue.GetAll")
1909
- const serviceMethod = nameOrOptions
1910
- ;
1946
+ const serviceMethod = typeof nameOrOptions === 'string'
1947
+ ? nameOrOptions
1948
+ : fallbackName;
1911
1949
  // Use 'Sdk.Run' as the name and serviceMethod as the service
1912
1950
  telemetryClient.track(serviceMethod, SDK_RUN_EVENT, opts.attributes);
1913
1951
  }
@@ -1936,7 +1974,7 @@ function createTrackedFunction(originalFunction, nameOrOptions, fallbackName, op
1936
1974
  */
1937
1975
  function track(nameOrOptions, options) {
1938
1976
  return function decorator(_target, propertyKey, descriptor) {
1939
- const opts = {};
1977
+ const opts = typeof nameOrOptions === 'object' ? nameOrOptions : {};
1940
1978
  if (descriptor && typeof descriptor.value === 'function') {
1941
1979
  // Method decorator
1942
1980
  descriptor.value = createTrackedFunction(descriptor.value, nameOrOptions, propertyKey || 'unknown_method', opts);
@@ -1947,27 +1985,90 @@ function track(nameOrOptions, options) {
1947
1985
  };
1948
1986
  }
1949
1987
 
1988
+ /**
1989
+ * Maps fields for Attachment entities to ensure consistent naming
1990
+ */
1991
+ const AttachmentsMap = {
1992
+ creationTime: 'createdTime',
1993
+ lastModificationTime: 'lastModifiedTime'
1994
+ };
1995
+
1996
+ /**
1997
+ * Maps fields for Bucket entities to ensure consistent naming
1998
+ */
1999
+ const BucketMap = {
2000
+ fullPath: 'path',
2001
+ items: 'blobItems',
2002
+ verb: 'httpMethod'
2003
+ };
2004
+
2005
+ class AttachmentService extends BaseService {
2006
+ /**
2007
+ * Gets an attachment by ID
2008
+ * @param id - The UUID of the attachment to retrieve
2009
+ * @param options - Optional query parameters (expand, select)
2010
+ * @returns Promise resolving to the attachment
2011
+ *
2012
+ * @example
2013
+ * ```typescript
2014
+ * import { Attachments } from '@uipath/uipath-typescript/attachments';
2015
+ *
2016
+ * const attachments = new Attachments(sdk);
2017
+ * const attachment = await attachments.getById('12345678-1234-1234-1234-123456789abc');
2018
+ * ```
2019
+ */
2020
+ async getById(id, options = {}) {
2021
+ if (!id) {
2022
+ throw new ValidationError({ message: 'id is required for getById' });
2023
+ }
2024
+ // Prefix all keys in options with $ for OData
2025
+ const keysToPrefix = Object.keys(options);
2026
+ const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
2027
+ const response = await this.get(ORCHESTRATOR_ATTACHMENT_ENDPOINTS.GET_BY_ID(id), {
2028
+ params: apiOptions,
2029
+ });
2030
+ // Transform response from PascalCase to camelCase, then apply field maps
2031
+ const camelCased = pascalToCamelCaseKeys(response.data);
2032
+ camelCased.blobFileAccess = transformData(camelCased.blobFileAccess, BucketMap);
2033
+ return transformData(camelCased, AttachmentsMap);
2034
+ }
2035
+ }
2036
+ __decorate([
2037
+ track('Attachments.GetById')
2038
+ ], AttachmentService.prototype, "getById", null);
2039
+
1950
2040
  /**
1951
2041
  * Service for interacting with UiPath Orchestrator Jobs API
1952
2042
  */
1953
2043
  class JobService extends FolderScopedService {
1954
2044
  /**
1955
- * Gets all jobs across folders with optional filtering
2045
+ * Creates an instance of the Jobs service.
2046
+ *
2047
+ * @param instance - UiPath SDK instance providing authentication and configuration
2048
+ */
2049
+ constructor(instance) {
2050
+ super(instance);
2051
+ this.attachmentService = new AttachmentService(instance);
2052
+ }
2053
+ /**
2054
+ * Gets all jobs across folders with optional filtering and pagination.
2055
+ *
2056
+ * Returns jobs with full details including state, timing, and input/output arguments.
2057
+ * Pass `folderId` to scope the query to a specific folder.
1956
2058
  *
1957
- * @param options - Query options including optional folderId and pagination options
1958
- * @returns Promise resolving to array of jobs or paginated response
2059
+ * !!! info "Input and output fields are not included in `getAll` responses"
2060
+ * 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`.
1959
2061
  *
2062
+ * @param options - Query options including optional folderId, filtering, and pagination options
2063
+ * @returns Promise resolving to either an array of jobs {@link NonPaginatedResponse}<{@link JobGetResponse}> or a {@link PaginatedResponse}<{@link JobGetResponse}> when pagination options are used.
2064
+ * {@link JobGetResponse}
1960
2065
  * @example
1961
2066
  * ```typescript
1962
- * import { Jobs } from '@uipath/uipath-typescript/jobs';
1963
- *
1964
- * const jobs = new Jobs(sdk);
1965
- *
1966
2067
  * // Get all jobs
1967
2068
  * const allJobs = await jobs.getAll();
1968
2069
  *
1969
2070
  * // Get all jobs in a specific folder
1970
- * const folderJobs = await jobs.getAll({ folderId: 123 });
2071
+ * const folderJobs = await jobs.getAll({ folderId: <folderId> });
1971
2072
  *
1972
2073
  * // With filtering
1973
2074
  * const runningJobs = await jobs.getAll({
@@ -1981,10 +2082,19 @@ class JobService extends FolderScopedService {
1981
2082
  * if (page1.hasNextPage) {
1982
2083
  * const page2 = await jobs.getAll({ cursor: page1.nextCursor });
1983
2084
  * }
2085
+ *
2086
+ * // Jump to specific page
2087
+ * const page5 = await jobs.getAll({
2088
+ * jumpToPage: 5,
2089
+ * pageSize: 10
2090
+ * });
1984
2091
  * ```
1985
2092
  */
1986
2093
  async getAll(options) {
1987
- const transformJobResponse = (job) => transformData(pascalToCamelCaseKeys(job), JobMap);
2094
+ const transformJobResponse = (job) => {
2095
+ const rawJob = transformData(pascalToCamelCaseKeys(job), JobMap);
2096
+ return createJobWithMethods(rawJob, this);
2097
+ };
1988
2098
  return PaginationHelpers.getAll({
1989
2099
  serviceAccess: this.createPaginationServiceAccess(),
1990
2100
  getEndpoint: () => JOB_ENDPOINTS.GET_ALL,
@@ -2002,10 +2112,111 @@ class JobService extends FolderScopedService {
2002
2112
  },
2003
2113
  }, options);
2004
2114
  }
2115
+ /**
2116
+ * Gets the output of a completed job.
2117
+ *
2118
+ * Retrieves the job's output arguments, handling both inline output (stored directly on the job
2119
+ * as a JSON string in `outputArguments`) and file-based output (stored as a blob attachment for
2120
+ * large outputs). Returns the parsed JSON output or `null` if the job has no output.
2121
+ *
2122
+ * @param jobKey - The unique key (GUID) of the job to retrieve output from
2123
+ * @param folderId - The folder ID where the job resides
2124
+ * @returns Promise resolving to the parsed output as `Record<string, unknown>`, or `null` if no output exists
2125
+ *
2126
+ * @example
2127
+ * ```typescript
2128
+ * // Get output from a completed job
2129
+ * const output = await jobs.getOutput(<jobKey>, <folderId>);
2130
+ *
2131
+ * if (output) {
2132
+ * console.log('Job output:', output);
2133
+ * }
2134
+ * ```
2135
+ *
2136
+ * @example
2137
+ * ```typescript
2138
+ * // Get output using bound method (jobKey and folderId are taken from the job object)
2139
+ * const allJobs = await jobs.getAll();
2140
+ * const completedJob = allJobs.items.find(j => j.state === JobState.Successful);
2141
+ *
2142
+ * if (completedJob) {
2143
+ * const output = await completedJob.getOutput();
2144
+ * }
2145
+ * ```
2146
+ */
2147
+ async getOutput(jobKey, folderId) {
2148
+ if (!jobKey) {
2149
+ throw new ValidationError({ message: 'jobKey is required for getOutput' });
2150
+ }
2151
+ const job = await this.fetchJobByKey(jobKey, folderId);
2152
+ if (job.OutputArguments) {
2153
+ try {
2154
+ return JSON.parse(job.OutputArguments);
2155
+ }
2156
+ catch {
2157
+ throw new ServerError({ message: 'Failed to parse job output arguments as JSON' });
2158
+ }
2159
+ }
2160
+ if (job.OutputFile) {
2161
+ return this.downloadOutputFile(job.OutputFile);
2162
+ }
2163
+ return null;
2164
+ }
2165
+ /**
2166
+ * Fetches a job by its Key (GUID) using the GetByKey endpoint.
2167
+ * Only selects fields needed for output extraction.
2168
+ */
2169
+ async fetchJobByKey(jobKey, folderId) {
2170
+ const headers = createHeaders({ [FOLDER_ID]: folderId });
2171
+ const response = await this.get(JOB_ENDPOINTS.GET_BY_KEY(jobKey), {
2172
+ params: {
2173
+ $select: 'OutputArguments,OutputFile',
2174
+ },
2175
+ headers,
2176
+ });
2177
+ return response.data;
2178
+ }
2179
+ /**
2180
+ * Downloads the output file content via the Attachments API.
2181
+ * 1. Fetches blob access info from the attachment using AttachmentService
2182
+ * 2. Downloads content from the presigned blob URI
2183
+ * 3. Parses and returns the JSON content
2184
+ */
2185
+ async downloadOutputFile(outputFileKey) {
2186
+ const attachment = await this.attachmentService.getById(outputFileKey);
2187
+ const blobAccess = attachment.blobFileAccess;
2188
+ if (!blobAccess?.uri) {
2189
+ return null;
2190
+ }
2191
+ const blobHeaders = { ...blobAccess.headers };
2192
+ // Add auth header if the blob URI requires authenticated access
2193
+ if (blobAccess.requiresAuth) {
2194
+ const token = await this.getValidAuthToken();
2195
+ blobHeaders['Authorization'] = `Bearer ${token}`;
2196
+ }
2197
+ const blobResponse = await fetch(blobAccess.uri, {
2198
+ method: 'GET',
2199
+ headers: blobHeaders,
2200
+ });
2201
+ if (!blobResponse.ok) {
2202
+ const errorInfo = await errorResponseParser.parse(blobResponse);
2203
+ throw ErrorFactory.createFromHttpStatus(blobResponse.status, errorInfo);
2204
+ }
2205
+ const content = await blobResponse.text();
2206
+ try {
2207
+ return JSON.parse(content);
2208
+ }
2209
+ catch {
2210
+ throw new ServerError({ message: 'Failed to parse job output file as JSON' });
2211
+ }
2212
+ }
2005
2213
  }
2006
2214
  __decorate([
2007
2215
  track('Jobs.GetAll')
2008
2216
  ], JobService.prototype, "getAll", null);
2217
+ __decorate([
2218
+ track('Jobs.GetOutput')
2219
+ ], JobService.prototype, "getOutput", null);
2009
2220
 
2010
2221
  /**
2011
2222
  * Enum for job sub-state
@@ -2032,5 +2243,22 @@ exports.ServerlessJobType = void 0;
2032
2243
  ServerlessJobType["PythonAgent"] = "PythonAgent";
2033
2244
  })(exports.ServerlessJobType || (exports.ServerlessJobType = {}));
2034
2245
 
2246
+ /**
2247
+ * Common enum for job state used across services
2248
+ */
2249
+ exports.JobState = void 0;
2250
+ (function (JobState) {
2251
+ JobState["Pending"] = "Pending";
2252
+ JobState["Running"] = "Running";
2253
+ JobState["Stopping"] = "Stopping";
2254
+ JobState["Terminating"] = "Terminating";
2255
+ JobState["Faulted"] = "Faulted";
2256
+ JobState["Successful"] = "Successful";
2257
+ JobState["Stopped"] = "Stopped";
2258
+ JobState["Suspended"] = "Suspended";
2259
+ JobState["Resumed"] = "Resumed";
2260
+ })(exports.JobState || (exports.JobState = {}));
2261
+
2035
2262
  exports.JobService = JobService;
2036
2263
  exports.Jobs = JobService;
2264
+ exports.createJobWithMethods = createJobWithMethods;
@@ -523,9 +523,9 @@ interface ProcessMetadata {
523
523
  id?: number;
524
524
  }
525
525
  /**
526
- * Interface for job response
526
+ * Raw job response from the API before method attachment
527
527
  */
528
- interface JobGetResponse extends FolderProperties {
528
+ interface RawJobGetResponse extends FolderProperties {
529
529
  /** The unique numeric identifier of the job */
530
530
  id: number;
531
531
  /** The unique job identifier (GUID) */
@@ -552,6 +552,8 @@ interface JobGetResponse extends FolderProperties {
552
552
  inputArguments: string | null;
553
553
  /** Output parameters as a JSON string resulted from job execution */
554
554
  outputArguments: string | null;
555
+ /** Attachment key for file-based output when output is too large for inline arguments */
556
+ outputFile: string | null;
555
557
  /** Environment variables as a JSON string passed to the job execution */
556
558
  environmentVariables: string | null;
557
559
  /** Additional information about the current job */
@@ -627,6 +629,7 @@ type JobGetAllOptions = RequestOptions & PaginationOptions & {
627
629
  folderId?: number;
628
630
  };
629
631
 
632
+ type JobGetResponse = RawJobGetResponse & JobMethods;
630
633
  /**
631
634
  * Service for managing UiPath Orchestrator Jobs.
632
635
  *
@@ -645,9 +648,15 @@ type JobGetAllOptions = RequestOptions & PaginationOptions & {
645
648
  */
646
649
  interface JobServiceModel {
647
650
  /**
648
- * Gets all jobs across folders with optional filtering
651
+ * Gets all jobs across folders with optional filtering and pagination.
649
652
  *
650
- * @param options - Query options including optional folderId and pagination options
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
651
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.
652
661
  * {@link JobGetResponse}
653
662
  * @example
@@ -679,29 +688,105 @@ interface JobServiceModel {
679
688
  * ```
680
689
  */
681
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>;
682
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;
683
759
 
684
760
  /**
685
761
  * Service for interacting with UiPath Orchestrator Jobs API
686
762
  */
687
763
  declare class JobService extends FolderScopedService implements JobServiceModel {
764
+ private attachmentService;
688
765
  /**
689
- * Gets all jobs across folders with optional filtering
766
+ * Creates an instance of the Jobs service.
690
767
  *
691
- * @param options - Query options including optional folderId and pagination options
692
- * @returns Promise resolving to array of jobs or paginated response
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.
693
773
  *
694
- * @example
695
- * ```typescript
696
- * import { Jobs } from '@uipath/uipath-typescript/jobs';
774
+ * Returns jobs with full details including state, timing, and input/output arguments.
775
+ * Pass `folderId` to scope the query to a specific folder.
697
776
  *
698
- * const jobs = new Jobs(sdk);
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`.
699
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
700
785
  * // Get all jobs
701
786
  * const allJobs = await jobs.getAll();
702
787
  *
703
788
  * // Get all jobs in a specific folder
704
- * const folderJobs = await jobs.getAll({ folderId: 123 });
789
+ * const folderJobs = await jobs.getAll({ folderId: <folderId> });
705
790
  *
706
791
  * // With filtering
707
792
  * const runningJobs = await jobs.getAll({
@@ -715,10 +800,61 @@ declare class JobService extends FolderScopedService implements JobServiceModel
715
800
  * if (page1.hasNextPage) {
716
801
  * const page2 = await jobs.getAll({ cursor: page1.nextCursor });
717
802
  * }
803
+ *
804
+ * // Jump to specific page
805
+ * const page5 = await jobs.getAll({
806
+ * jumpToPage: 5,
807
+ * pageSize: 10
808
+ * });
718
809
  * ```
719
810
  */
720
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;
721
857
  }
722
858
 
723
- export { JobService, JobSubState, JobService as Jobs, ServerlessJobType };
724
- export type { JobGetAllOptions, JobGetResponse, JobServiceModel, ProcessMetadata };
859
+ export { JobService, JobState, JobSubState, JobService as Jobs, ServerlessJobType, createJobWithMethods };
860
+ export type { JobGetAllOptions, JobGetResponse, JobMethods, JobServiceModel, ProcessMetadata, RawJobGetResponse };