@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.
- package/dist/assets/index.cjs +5 -8
- package/dist/assets/index.d.ts +3 -1
- package/dist/assets/index.mjs +5 -8
- package/dist/attachments/index.cjs +5 -8
- package/dist/attachments/index.d.ts +3 -1
- package/dist/attachments/index.mjs +5 -8
- package/dist/buckets/index.cjs +5 -8
- package/dist/buckets/index.d.ts +3 -1
- package/dist/buckets/index.mjs +5 -8
- package/dist/cases/index.cjs +5 -8
- package/dist/cases/index.d.ts +3 -1
- package/dist/cases/index.mjs +5 -8
- package/dist/conversational-agent/index.cjs +38 -16
- package/dist/conversational-agent/index.d.ts +26 -4
- package/dist/conversational-agent/index.mjs +38 -16
- package/dist/core/index.cjs +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.mjs +2 -2
- package/dist/entities/index.cjs +697 -317
- package/dist/entities/index.d.ts +572 -58
- package/dist/entities/index.mjs +698 -318
- package/dist/index.cjs +727 -161
- package/dist/index.d.ts +697 -69
- package/dist/index.mjs +727 -162
- package/dist/index.umd.js +727 -161
- package/dist/jobs/index.cjs +278 -20
- package/dist/jobs/index.d.ts +214 -19
- package/dist/jobs/index.mjs +278 -21
- package/dist/maestro-processes/index.cjs +5 -8
- package/dist/maestro-processes/index.d.ts +3 -1
- package/dist/maestro-processes/index.mjs +5 -8
- package/dist/processes/index.cjs +5 -8
- package/dist/processes/index.d.ts +3 -1
- package/dist/processes/index.mjs +5 -8
- package/dist/queues/index.cjs +5 -8
- package/dist/queues/index.d.ts +3 -1
- package/dist/queues/index.mjs +5 -8
- package/dist/tasks/index.cjs +5 -8
- package/dist/tasks/index.d.ts +3 -1
- package/dist/tasks/index.mjs +5 -8
- package/package.json +1 -1
package/dist/jobs/index.cjs
CHANGED
|
@@ -526,15 +526,11 @@ const RESPONSE_TYPES = {
|
|
|
526
526
|
|
|
527
527
|
class ApiClient {
|
|
528
528
|
constructor(config, executionContext, tokenManager, clientConfig = {}) {
|
|
529
|
-
this.defaultHeaders = {};
|
|
530
529
|
this.config = config;
|
|
531
530
|
this.executionContext = executionContext;
|
|
532
531
|
this.clientConfig = clientConfig;
|
|
533
532
|
this.tokenManager = tokenManager;
|
|
534
533
|
}
|
|
535
|
-
setDefaultHeaders(headers) {
|
|
536
|
-
this.defaultHeaders = { ...this.defaultHeaders, ...headers };
|
|
537
|
-
}
|
|
538
534
|
/**
|
|
539
535
|
* Gets a valid authentication token, refreshing if necessary.
|
|
540
536
|
* Used internally for API requests and exposed for services that need manual auth headers.
|
|
@@ -550,7 +546,6 @@ class ApiClient {
|
|
|
550
546
|
return {
|
|
551
547
|
'Authorization': `Bearer ${token}`,
|
|
552
548
|
'Content-Type': CONTENT_TYPES.JSON,
|
|
553
|
-
...this.defaultHeaders,
|
|
554
549
|
...this.clientConfig.headers
|
|
555
550
|
};
|
|
556
551
|
}
|
|
@@ -1390,6 +1385,8 @@ class BaseService {
|
|
|
1390
1385
|
*
|
|
1391
1386
|
* @param instance - UiPath SDK instance providing authentication and configuration.
|
|
1392
1387
|
* Services receive this via dependency injection in the modular pattern.
|
|
1388
|
+
* @param headers - Optional default headers to include in every request (e.g. `x-uipath-external-user-id` for
|
|
1389
|
+
* CAS external-app auth)
|
|
1393
1390
|
*
|
|
1394
1391
|
* @example
|
|
1395
1392
|
* ```typescript
|
|
@@ -1409,11 +1406,11 @@ class BaseService {
|
|
|
1409
1406
|
* const entities = new Entities(sdk);
|
|
1410
1407
|
* ```
|
|
1411
1408
|
*/
|
|
1412
|
-
constructor(instance) {
|
|
1409
|
+
constructor(instance, headers) {
|
|
1413
1410
|
// Private field - not visible via Object.keys() or any reflection
|
|
1414
1411
|
_BaseService_apiClient.set(this, void 0);
|
|
1415
1412
|
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
1416
|
-
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager), "f");
|
|
1413
|
+
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
1417
1414
|
}
|
|
1418
1415
|
/**
|
|
1419
1416
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -1644,6 +1641,36 @@ class FolderScopedService extends BaseService {
|
|
|
1644
1641
|
}
|
|
1645
1642
|
}
|
|
1646
1643
|
|
|
1644
|
+
/**
|
|
1645
|
+
* Creates methods for a job response object.
|
|
1646
|
+
*
|
|
1647
|
+
* @param jobData - The raw job data from API
|
|
1648
|
+
* @param service - The job service instance
|
|
1649
|
+
* @returns Object containing job methods
|
|
1650
|
+
*/
|
|
1651
|
+
function createJobMethods(jobData, service) {
|
|
1652
|
+
return {
|
|
1653
|
+
async getOutput() {
|
|
1654
|
+
if (!jobData.key)
|
|
1655
|
+
throw new Error('Job key is undefined');
|
|
1656
|
+
if (!jobData.folderId)
|
|
1657
|
+
throw new Error('Job folderId is undefined');
|
|
1658
|
+
return service.getOutput(jobData.key, jobData.folderId);
|
|
1659
|
+
},
|
|
1660
|
+
};
|
|
1661
|
+
}
|
|
1662
|
+
/**
|
|
1663
|
+
* Creates a job response with bound methods.
|
|
1664
|
+
*
|
|
1665
|
+
* @param jobData - The raw job data from API
|
|
1666
|
+
* @param service - The job service instance
|
|
1667
|
+
* @returns A job object with added methods
|
|
1668
|
+
*/
|
|
1669
|
+
function createJobWithMethods(jobData, service) {
|
|
1670
|
+
const methods = createJobMethods(jobData, service);
|
|
1671
|
+
return Object.assign({}, jobData, methods);
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1647
1674
|
/**
|
|
1648
1675
|
* Base path constants for different services
|
|
1649
1676
|
*/
|
|
@@ -1657,6 +1684,13 @@ const ORCHESTRATOR_BASE = 'orchestrator_';
|
|
|
1657
1684
|
*/
|
|
1658
1685
|
const JOB_ENDPOINTS = {
|
|
1659
1686
|
GET_ALL: `${ORCHESTRATOR_BASE}/odata/Jobs`,
|
|
1687
|
+
GET_BY_KEY: (identifier) => `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.GetByKey(identifier=${identifier})`,
|
|
1688
|
+
};
|
|
1689
|
+
/**
|
|
1690
|
+
* Orchestrator Attachment Service Endpoints
|
|
1691
|
+
*/
|
|
1692
|
+
const ORCHESTRATOR_ATTACHMENT_ENDPOINTS = {
|
|
1693
|
+
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Attachments(${id})`,
|
|
1660
1694
|
};
|
|
1661
1695
|
|
|
1662
1696
|
/**
|
|
@@ -1680,7 +1714,7 @@ const JobMap = {
|
|
|
1680
1714
|
// Connection string placeholder that will be replaced during build
|
|
1681
1715
|
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
1716
|
// SDK Version placeholder
|
|
1683
|
-
const SDK_VERSION = "1.
|
|
1717
|
+
const SDK_VERSION = "1.3.1";
|
|
1684
1718
|
const VERSION = "Version";
|
|
1685
1719
|
const SERVICE = "Service";
|
|
1686
1720
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -1906,8 +1940,9 @@ function createTrackedFunction(originalFunction, nameOrOptions, fallbackName, op
|
|
|
1906
1940
|
// Track the event if enabled
|
|
1907
1941
|
if (shouldTrack) {
|
|
1908
1942
|
// Use the full name provided in the decorator (e.g., "Queue.GetAll")
|
|
1909
|
-
const serviceMethod = nameOrOptions
|
|
1910
|
-
|
|
1943
|
+
const serviceMethod = typeof nameOrOptions === 'string'
|
|
1944
|
+
? nameOrOptions
|
|
1945
|
+
: fallbackName;
|
|
1911
1946
|
// Use 'Sdk.Run' as the name and serviceMethod as the service
|
|
1912
1947
|
telemetryClient.track(serviceMethod, SDK_RUN_EVENT, opts.attributes);
|
|
1913
1948
|
}
|
|
@@ -1936,7 +1971,7 @@ function createTrackedFunction(originalFunction, nameOrOptions, fallbackName, op
|
|
|
1936
1971
|
*/
|
|
1937
1972
|
function track(nameOrOptions, options) {
|
|
1938
1973
|
return function decorator(_target, propertyKey, descriptor) {
|
|
1939
|
-
const opts = {};
|
|
1974
|
+
const opts = typeof nameOrOptions === 'object' ? nameOrOptions : {};
|
|
1940
1975
|
if (descriptor && typeof descriptor.value === 'function') {
|
|
1941
1976
|
// Method decorator
|
|
1942
1977
|
descriptor.value = createTrackedFunction(descriptor.value, nameOrOptions, propertyKey || 'unknown_method', opts);
|
|
@@ -1947,27 +1982,90 @@ function track(nameOrOptions, options) {
|
|
|
1947
1982
|
};
|
|
1948
1983
|
}
|
|
1949
1984
|
|
|
1985
|
+
/**
|
|
1986
|
+
* Maps fields for Attachment entities to ensure consistent naming
|
|
1987
|
+
*/
|
|
1988
|
+
const AttachmentsMap = {
|
|
1989
|
+
creationTime: 'createdTime',
|
|
1990
|
+
lastModificationTime: 'lastModifiedTime'
|
|
1991
|
+
};
|
|
1992
|
+
|
|
1993
|
+
/**
|
|
1994
|
+
* Maps fields for Bucket entities to ensure consistent naming
|
|
1995
|
+
*/
|
|
1996
|
+
const BucketMap = {
|
|
1997
|
+
fullPath: 'path',
|
|
1998
|
+
items: 'blobItems',
|
|
1999
|
+
verb: 'httpMethod'
|
|
2000
|
+
};
|
|
2001
|
+
|
|
2002
|
+
class AttachmentService extends BaseService {
|
|
2003
|
+
/**
|
|
2004
|
+
* Gets an attachment by ID
|
|
2005
|
+
* @param id - The UUID of the attachment to retrieve
|
|
2006
|
+
* @param options - Optional query parameters (expand, select)
|
|
2007
|
+
* @returns Promise resolving to the attachment
|
|
2008
|
+
*
|
|
2009
|
+
* @example
|
|
2010
|
+
* ```typescript
|
|
2011
|
+
* import { Attachments } from '@uipath/uipath-typescript/attachments';
|
|
2012
|
+
*
|
|
2013
|
+
* const attachments = new Attachments(sdk);
|
|
2014
|
+
* const attachment = await attachments.getById('12345678-1234-1234-1234-123456789abc');
|
|
2015
|
+
* ```
|
|
2016
|
+
*/
|
|
2017
|
+
async getById(id, options = {}) {
|
|
2018
|
+
if (!id) {
|
|
2019
|
+
throw new ValidationError({ message: 'id is required for getById' });
|
|
2020
|
+
}
|
|
2021
|
+
// Prefix all keys in options with $ for OData
|
|
2022
|
+
const keysToPrefix = Object.keys(options);
|
|
2023
|
+
const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
|
|
2024
|
+
const response = await this.get(ORCHESTRATOR_ATTACHMENT_ENDPOINTS.GET_BY_ID(id), {
|
|
2025
|
+
params: apiOptions,
|
|
2026
|
+
});
|
|
2027
|
+
// Transform response from PascalCase to camelCase, then apply field maps
|
|
2028
|
+
const camelCased = pascalToCamelCaseKeys(response.data);
|
|
2029
|
+
camelCased.blobFileAccess = transformData(camelCased.blobFileAccess, BucketMap);
|
|
2030
|
+
return transformData(camelCased, AttachmentsMap);
|
|
2031
|
+
}
|
|
2032
|
+
}
|
|
2033
|
+
__decorate([
|
|
2034
|
+
track('Attachments.GetById')
|
|
2035
|
+
], AttachmentService.prototype, "getById", null);
|
|
2036
|
+
|
|
1950
2037
|
/**
|
|
1951
2038
|
* Service for interacting with UiPath Orchestrator Jobs API
|
|
1952
2039
|
*/
|
|
1953
2040
|
class JobService extends FolderScopedService {
|
|
1954
2041
|
/**
|
|
1955
|
-
*
|
|
2042
|
+
* Creates an instance of the Jobs service.
|
|
2043
|
+
*
|
|
2044
|
+
* @param instance - UiPath SDK instance providing authentication and configuration
|
|
2045
|
+
*/
|
|
2046
|
+
constructor(instance) {
|
|
2047
|
+
super(instance);
|
|
2048
|
+
this.attachmentService = new AttachmentService(instance);
|
|
2049
|
+
}
|
|
2050
|
+
/**
|
|
2051
|
+
* Gets all jobs across folders with optional filtering and pagination.
|
|
2052
|
+
*
|
|
2053
|
+
* Returns jobs with full details including state, timing, and input/output arguments.
|
|
2054
|
+
* Pass `folderId` to scope the query to a specific folder.
|
|
1956
2055
|
*
|
|
1957
|
-
*
|
|
1958
|
-
*
|
|
2056
|
+
* !!! info "Input and output fields are not included in `getAll` responses"
|
|
2057
|
+
* 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
2058
|
*
|
|
2059
|
+
* @param options - Query options including optional folderId, filtering, and pagination options
|
|
2060
|
+
* @returns Promise resolving to either an array of jobs {@link NonPaginatedResponse}<{@link JobGetResponse}> or a {@link PaginatedResponse}<{@link JobGetResponse}> when pagination options are used.
|
|
2061
|
+
* {@link JobGetResponse}
|
|
1960
2062
|
* @example
|
|
1961
2063
|
* ```typescript
|
|
1962
|
-
* import { Jobs } from '@uipath/uipath-typescript/jobs';
|
|
1963
|
-
*
|
|
1964
|
-
* const jobs = new Jobs(sdk);
|
|
1965
|
-
*
|
|
1966
2064
|
* // Get all jobs
|
|
1967
2065
|
* const allJobs = await jobs.getAll();
|
|
1968
2066
|
*
|
|
1969
2067
|
* // Get all jobs in a specific folder
|
|
1970
|
-
* const folderJobs = await jobs.getAll({ folderId:
|
|
2068
|
+
* const folderJobs = await jobs.getAll({ folderId: <folderId> });
|
|
1971
2069
|
*
|
|
1972
2070
|
* // With filtering
|
|
1973
2071
|
* const runningJobs = await jobs.getAll({
|
|
@@ -1981,10 +2079,19 @@ class JobService extends FolderScopedService {
|
|
|
1981
2079
|
* if (page1.hasNextPage) {
|
|
1982
2080
|
* const page2 = await jobs.getAll({ cursor: page1.nextCursor });
|
|
1983
2081
|
* }
|
|
2082
|
+
*
|
|
2083
|
+
* // Jump to specific page
|
|
2084
|
+
* const page5 = await jobs.getAll({
|
|
2085
|
+
* jumpToPage: 5,
|
|
2086
|
+
* pageSize: 10
|
|
2087
|
+
* });
|
|
1984
2088
|
* ```
|
|
1985
2089
|
*/
|
|
1986
2090
|
async getAll(options) {
|
|
1987
|
-
const transformJobResponse = (job) =>
|
|
2091
|
+
const transformJobResponse = (job) => {
|
|
2092
|
+
const rawJob = transformData(pascalToCamelCaseKeys(job), JobMap);
|
|
2093
|
+
return createJobWithMethods(rawJob, this);
|
|
2094
|
+
};
|
|
1988
2095
|
return PaginationHelpers.getAll({
|
|
1989
2096
|
serviceAccess: this.createPaginationServiceAccess(),
|
|
1990
2097
|
getEndpoint: () => JOB_ENDPOINTS.GET_ALL,
|
|
@@ -2002,10 +2109,144 @@ class JobService extends FolderScopedService {
|
|
|
2002
2109
|
},
|
|
2003
2110
|
}, options);
|
|
2004
2111
|
}
|
|
2112
|
+
/**
|
|
2113
|
+
* Gets a job by its unique key (GUID).
|
|
2114
|
+
*
|
|
2115
|
+
* Returns the full job details including state, timing, input/output arguments, and error information.
|
|
2116
|
+
* Use `expand` to include related entities like `robot`, or `machine`.
|
|
2117
|
+
*
|
|
2118
|
+
* @param id - The unique key (GUID) of the job to retrieve
|
|
2119
|
+
* @param folderId - The folder ID where the job resides
|
|
2120
|
+
* @param options - Optional query options for expanding or selecting fields
|
|
2121
|
+
* @returns Promise resolving to a {@link JobGetResponse} with full job details and bound methods
|
|
2122
|
+
*
|
|
2123
|
+
* @example
|
|
2124
|
+
* ```typescript
|
|
2125
|
+
* // Get a job by key
|
|
2126
|
+
* const job = await jobs.getById(<id>, <folderId>);
|
|
2127
|
+
* console.log(job.state, job.processName);
|
|
2128
|
+
* ```
|
|
2129
|
+
*
|
|
2130
|
+
* @example
|
|
2131
|
+
* ```typescript
|
|
2132
|
+
* // With expanded related entities
|
|
2133
|
+
* const job = await jobs.getById(<id>, <folderId>, {
|
|
2134
|
+
* expand: 'robot,machine'
|
|
2135
|
+
* });
|
|
2136
|
+
* console.log(job.robot?.name, job.machine?.name);
|
|
2137
|
+
* ```
|
|
2138
|
+
*/
|
|
2139
|
+
async getById(id, folderId, options) {
|
|
2140
|
+
if (!id) {
|
|
2141
|
+
throw new ValidationError({ message: 'id is required for getById' });
|
|
2142
|
+
}
|
|
2143
|
+
if (!folderId) {
|
|
2144
|
+
throw new ValidationError({ message: 'folderId is required for getById' });
|
|
2145
|
+
}
|
|
2146
|
+
const headers = createHeaders({ [FOLDER_ID]: folderId });
|
|
2147
|
+
const keysToPrefix = Object.keys(options ?? {});
|
|
2148
|
+
const apiOptions = options ? addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix) : {};
|
|
2149
|
+
const response = await this.get(JOB_ENDPOINTS.GET_BY_KEY(id), {
|
|
2150
|
+
params: apiOptions,
|
|
2151
|
+
headers,
|
|
2152
|
+
});
|
|
2153
|
+
const rawJob = transformData(pascalToCamelCaseKeys(response.data), JobMap);
|
|
2154
|
+
return createJobWithMethods(rawJob, this);
|
|
2155
|
+
}
|
|
2156
|
+
/**
|
|
2157
|
+
* Gets the output of a completed job.
|
|
2158
|
+
*
|
|
2159
|
+
* Retrieves the job's output arguments, handling both inline output (stored directly on the job
|
|
2160
|
+
* as a JSON string in `outputArguments`) and file-based output (stored as a blob attachment for
|
|
2161
|
+
* large outputs). Returns the parsed JSON output or `null` if the job has no output.
|
|
2162
|
+
*
|
|
2163
|
+
* @param jobKey - The unique key (GUID) of the job to retrieve output from
|
|
2164
|
+
* @param folderId - The folder ID where the job resides
|
|
2165
|
+
* @returns Promise resolving to the parsed output as `Record<string, unknown>`, or `null` if no output exists
|
|
2166
|
+
*
|
|
2167
|
+
* @example
|
|
2168
|
+
* ```typescript
|
|
2169
|
+
* // Get output from a completed job
|
|
2170
|
+
* const output = await jobs.getOutput(<jobKey>, <folderId>);
|
|
2171
|
+
*
|
|
2172
|
+
* if (output) {
|
|
2173
|
+
* console.log('Job output:', output);
|
|
2174
|
+
* }
|
|
2175
|
+
* ```
|
|
2176
|
+
*
|
|
2177
|
+
* @example
|
|
2178
|
+
* ```typescript
|
|
2179
|
+
* // Get output using bound method (jobKey and folderId are taken from the job object)
|
|
2180
|
+
* const allJobs = await jobs.getAll();
|
|
2181
|
+
* const completedJob = allJobs.items.find(j => j.state === JobState.Successful);
|
|
2182
|
+
*
|
|
2183
|
+
* if (completedJob) {
|
|
2184
|
+
* const output = await completedJob.getOutput();
|
|
2185
|
+
* }
|
|
2186
|
+
* ```
|
|
2187
|
+
*/
|
|
2188
|
+
async getOutput(jobKey, folderId) {
|
|
2189
|
+
if (!jobKey) {
|
|
2190
|
+
throw new ValidationError({ message: 'jobKey is required for getOutput' });
|
|
2191
|
+
}
|
|
2192
|
+
const job = await this.getById(jobKey, folderId, { select: 'outputArguments,outputFile' });
|
|
2193
|
+
if (job.outputArguments) {
|
|
2194
|
+
try {
|
|
2195
|
+
return JSON.parse(job.outputArguments);
|
|
2196
|
+
}
|
|
2197
|
+
catch {
|
|
2198
|
+
throw new ServerError({ message: 'Failed to parse job output arguments as JSON' });
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
if (job.outputFile) {
|
|
2202
|
+
return this.downloadOutputFile(job.outputFile);
|
|
2203
|
+
}
|
|
2204
|
+
return null;
|
|
2205
|
+
}
|
|
2206
|
+
/**
|
|
2207
|
+
* Downloads the output file content via the Attachments API.
|
|
2208
|
+
* 1. Fetches blob access info from the attachment using AttachmentService
|
|
2209
|
+
* 2. Downloads content from the presigned blob URI
|
|
2210
|
+
* 3. Parses and returns the JSON content
|
|
2211
|
+
*/
|
|
2212
|
+
async downloadOutputFile(outputFileKey) {
|
|
2213
|
+
const attachment = await this.attachmentService.getById(outputFileKey);
|
|
2214
|
+
const blobAccess = attachment.blobFileAccess;
|
|
2215
|
+
if (!blobAccess?.uri) {
|
|
2216
|
+
return null;
|
|
2217
|
+
}
|
|
2218
|
+
const blobHeaders = { ...blobAccess.headers };
|
|
2219
|
+
// Add auth header if the blob URI requires authenticated access
|
|
2220
|
+
if (blobAccess.requiresAuth) {
|
|
2221
|
+
const token = await this.getValidAuthToken();
|
|
2222
|
+
blobHeaders['Authorization'] = `Bearer ${token}`;
|
|
2223
|
+
}
|
|
2224
|
+
const blobResponse = await fetch(blobAccess.uri, {
|
|
2225
|
+
method: 'GET',
|
|
2226
|
+
headers: blobHeaders,
|
|
2227
|
+
});
|
|
2228
|
+
if (!blobResponse.ok) {
|
|
2229
|
+
const errorInfo = await errorResponseParser.parse(blobResponse);
|
|
2230
|
+
throw ErrorFactory.createFromHttpStatus(blobResponse.status, errorInfo);
|
|
2231
|
+
}
|
|
2232
|
+
const content = await blobResponse.text();
|
|
2233
|
+
try {
|
|
2234
|
+
return JSON.parse(content);
|
|
2235
|
+
}
|
|
2236
|
+
catch {
|
|
2237
|
+
throw new ServerError({ message: 'Failed to parse job output file as JSON' });
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2005
2240
|
}
|
|
2006
2241
|
__decorate([
|
|
2007
2242
|
track('Jobs.GetAll')
|
|
2008
2243
|
], JobService.prototype, "getAll", null);
|
|
2244
|
+
__decorate([
|
|
2245
|
+
track('Jobs.GetById')
|
|
2246
|
+
], JobService.prototype, "getById", null);
|
|
2247
|
+
__decorate([
|
|
2248
|
+
track('Jobs.GetOutput')
|
|
2249
|
+
], JobService.prototype, "getOutput", null);
|
|
2009
2250
|
|
|
2010
2251
|
/**
|
|
2011
2252
|
* Enum for job sub-state
|
|
@@ -2032,5 +2273,22 @@ exports.ServerlessJobType = void 0;
|
|
|
2032
2273
|
ServerlessJobType["PythonAgent"] = "PythonAgent";
|
|
2033
2274
|
})(exports.ServerlessJobType || (exports.ServerlessJobType = {}));
|
|
2034
2275
|
|
|
2276
|
+
/**
|
|
2277
|
+
* Common enum for job state used across services
|
|
2278
|
+
*/
|
|
2279
|
+
exports.JobState = void 0;
|
|
2280
|
+
(function (JobState) {
|
|
2281
|
+
JobState["Pending"] = "Pending";
|
|
2282
|
+
JobState["Running"] = "Running";
|
|
2283
|
+
JobState["Stopping"] = "Stopping";
|
|
2284
|
+
JobState["Terminating"] = "Terminating";
|
|
2285
|
+
JobState["Faulted"] = "Faulted";
|
|
2286
|
+
JobState["Successful"] = "Successful";
|
|
2287
|
+
JobState["Stopped"] = "Stopped";
|
|
2288
|
+
JobState["Suspended"] = "Suspended";
|
|
2289
|
+
JobState["Resumed"] = "Resumed";
|
|
2290
|
+
})(exports.JobState || (exports.JobState = {}));
|
|
2291
|
+
|
|
2035
2292
|
exports.JobService = JobService;
|
|
2036
2293
|
exports.Jobs = JobService;
|
|
2294
|
+
exports.createJobWithMethods = createJobWithMethods;
|