@uipath/uipath-typescript 1.3.0 → 1.3.2
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 +7 -5
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.mjs +7 -5
- package/dist/entities/index.cjs +680 -284
- package/dist/entities/index.d.ts +559 -45
- package/dist/entities/index.mjs +681 -285
- package/dist/index.cjs +520 -89
- package/dist/index.d.ts +604 -52
- package/dist/index.mjs +521 -90
- package/dist/index.umd.js +520 -89
- package/dist/jobs/index.cjs +57 -27
- package/dist/jobs/index.d.ts +70 -11
- package/dist/jobs/index.mjs +57 -27
- 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.
|
|
@@ -1717,7 +1714,7 @@ const JobMap = {
|
|
|
1717
1714
|
// Connection string placeholder that will be replaced during build
|
|
1718
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";
|
|
1719
1716
|
// SDK Version placeholder
|
|
1720
|
-
const SDK_VERSION = "1.3.
|
|
1717
|
+
const SDK_VERSION = "1.3.2";
|
|
1721
1718
|
const VERSION = "Version";
|
|
1722
1719
|
const SERVICE = "Service";
|
|
1723
1720
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -2112,6 +2109,50 @@ class JobService extends FolderScopedService {
|
|
|
2112
2109
|
},
|
|
2113
2110
|
}, options);
|
|
2114
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
|
+
}
|
|
2115
2156
|
/**
|
|
2116
2157
|
* Gets the output of a completed job.
|
|
2117
2158
|
*
|
|
@@ -2148,34 +2189,20 @@ class JobService extends FolderScopedService {
|
|
|
2148
2189
|
if (!jobKey) {
|
|
2149
2190
|
throw new ValidationError({ message: 'jobKey is required for getOutput' });
|
|
2150
2191
|
}
|
|
2151
|
-
const job = await this.
|
|
2152
|
-
if (job.
|
|
2192
|
+
const job = await this.getById(jobKey, folderId, { select: 'outputArguments,outputFile' });
|
|
2193
|
+
if (job.outputArguments) {
|
|
2153
2194
|
try {
|
|
2154
|
-
return JSON.parse(job.
|
|
2195
|
+
return JSON.parse(job.outputArguments);
|
|
2155
2196
|
}
|
|
2156
2197
|
catch {
|
|
2157
2198
|
throw new ServerError({ message: 'Failed to parse job output arguments as JSON' });
|
|
2158
2199
|
}
|
|
2159
2200
|
}
|
|
2160
|
-
if (job.
|
|
2161
|
-
return this.downloadOutputFile(job.
|
|
2201
|
+
if (job.outputFile) {
|
|
2202
|
+
return this.downloadOutputFile(job.outputFile);
|
|
2162
2203
|
}
|
|
2163
2204
|
return null;
|
|
2164
2205
|
}
|
|
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
2206
|
/**
|
|
2180
2207
|
* Downloads the output file content via the Attachments API.
|
|
2181
2208
|
* 1. Fetches blob access info from the attachment using AttachmentService
|
|
@@ -2214,6 +2241,9 @@ class JobService extends FolderScopedService {
|
|
|
2214
2241
|
__decorate([
|
|
2215
2242
|
track('Jobs.GetAll')
|
|
2216
2243
|
], JobService.prototype, "getAll", null);
|
|
2244
|
+
__decorate([
|
|
2245
|
+
track('Jobs.GetById')
|
|
2246
|
+
], JobService.prototype, "getById", null);
|
|
2217
2247
|
__decorate([
|
|
2218
2248
|
track('Jobs.GetOutput')
|
|
2219
2249
|
], JobService.prototype, "getOutput", null);
|
package/dist/jobs/index.d.ts
CHANGED
|
@@ -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: "
|
|
511
|
+
* Available when using 'expand: "release"' in the query.
|
|
510
512
|
*/
|
|
511
513
|
interface ProcessMetadata {
|
|
512
514
|
/** The unique key of the release */
|
|
@@ -610,11 +612,11 @@ interface RawJobGetResponse extends FolderProperties {
|
|
|
610
612
|
parentSpanId: string | null;
|
|
611
613
|
/** The error code associated with a failed job */
|
|
612
614
|
errorCode: string | null;
|
|
613
|
-
/** The machine associated with the job (available when using expand=
|
|
615
|
+
/** The machine associated with the job (available when using expand=machine) */
|
|
614
616
|
machine?: Machine;
|
|
615
|
-
/** The robot associated with the job (available when using expand=
|
|
617
|
+
/** The robot associated with the job (available when using expand=robot) */
|
|
616
618
|
robot?: RobotMetadata;
|
|
617
|
-
/** The process metadata associated with the job
|
|
619
|
+
/** The process metadata associated with the job */
|
|
618
620
|
process?: ProcessMetadata | null;
|
|
619
621
|
/** Error details for the job, or null if the job has no errors */
|
|
620
622
|
jobError: JobError | null;
|
|
@@ -628,7 +630,13 @@ type JobGetAllOptions = RequestOptions & PaginationOptions & {
|
|
|
628
630
|
*/
|
|
629
631
|
folderId?: number;
|
|
630
632
|
};
|
|
633
|
+
/**
|
|
634
|
+
* Options for getting a job by ID
|
|
635
|
+
*/
|
|
636
|
+
interface JobGetByIdOptions extends BaseOptions {
|
|
637
|
+
}
|
|
631
638
|
|
|
639
|
+
/** Combined response type for job data with bound methods. */
|
|
632
640
|
type JobGetResponse = RawJobGetResponse & JobMethods;
|
|
633
641
|
/**
|
|
634
642
|
* Service for managing UiPath Orchestrator Jobs.
|
|
@@ -688,6 +696,34 @@ interface JobServiceModel {
|
|
|
688
696
|
* ```
|
|
689
697
|
*/
|
|
690
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>;
|
|
691
727
|
/**
|
|
692
728
|
* Gets the output of a completed job.
|
|
693
729
|
*
|
|
@@ -809,6 +845,34 @@ declare class JobService extends FolderScopedService implements JobServiceModel
|
|
|
809
845
|
* ```
|
|
810
846
|
*/
|
|
811
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>;
|
|
812
876
|
/**
|
|
813
877
|
* Gets the output of a completed job.
|
|
814
878
|
*
|
|
@@ -842,11 +906,6 @@ declare class JobService extends FolderScopedService implements JobServiceModel
|
|
|
842
906
|
* ```
|
|
843
907
|
*/
|
|
844
908
|
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
909
|
/**
|
|
851
910
|
* Downloads the output file content via the Attachments API.
|
|
852
911
|
* 1. Fetches blob access info from the attachment using AttachmentService
|
|
@@ -857,4 +916,4 @@ declare class JobService extends FolderScopedService implements JobServiceModel
|
|
|
857
916
|
}
|
|
858
917
|
|
|
859
918
|
export { JobService, JobState, JobSubState, JobService as Jobs, ServerlessJobType, createJobWithMethods };
|
|
860
|
-
export type { JobGetAllOptions, JobGetResponse, JobMethods, JobServiceModel, ProcessMetadata, RawJobGetResponse };
|
|
919
|
+
export type { JobGetAllOptions, JobGetByIdOptions, JobGetResponse, JobMethods, JobServiceModel, ProcessMetadata, RawJobGetResponse };
|
package/dist/jobs/index.mjs
CHANGED
|
@@ -524,15 +524,11 @@ const RESPONSE_TYPES = {
|
|
|
524
524
|
|
|
525
525
|
class ApiClient {
|
|
526
526
|
constructor(config, executionContext, tokenManager, clientConfig = {}) {
|
|
527
|
-
this.defaultHeaders = {};
|
|
528
527
|
this.config = config;
|
|
529
528
|
this.executionContext = executionContext;
|
|
530
529
|
this.clientConfig = clientConfig;
|
|
531
530
|
this.tokenManager = tokenManager;
|
|
532
531
|
}
|
|
533
|
-
setDefaultHeaders(headers) {
|
|
534
|
-
this.defaultHeaders = { ...this.defaultHeaders, ...headers };
|
|
535
|
-
}
|
|
536
532
|
/**
|
|
537
533
|
* Gets a valid authentication token, refreshing if necessary.
|
|
538
534
|
* Used internally for API requests and exposed for services that need manual auth headers.
|
|
@@ -548,7 +544,6 @@ class ApiClient {
|
|
|
548
544
|
return {
|
|
549
545
|
'Authorization': `Bearer ${token}`,
|
|
550
546
|
'Content-Type': CONTENT_TYPES.JSON,
|
|
551
|
-
...this.defaultHeaders,
|
|
552
547
|
...this.clientConfig.headers
|
|
553
548
|
};
|
|
554
549
|
}
|
|
@@ -1388,6 +1383,8 @@ class BaseService {
|
|
|
1388
1383
|
*
|
|
1389
1384
|
* @param instance - UiPath SDK instance providing authentication and configuration.
|
|
1390
1385
|
* Services receive this via dependency injection in the modular pattern.
|
|
1386
|
+
* @param headers - Optional default headers to include in every request (e.g. `x-uipath-external-user-id` for
|
|
1387
|
+
* CAS external-app auth)
|
|
1391
1388
|
*
|
|
1392
1389
|
* @example
|
|
1393
1390
|
* ```typescript
|
|
@@ -1407,11 +1404,11 @@ class BaseService {
|
|
|
1407
1404
|
* const entities = new Entities(sdk);
|
|
1408
1405
|
* ```
|
|
1409
1406
|
*/
|
|
1410
|
-
constructor(instance) {
|
|
1407
|
+
constructor(instance, headers) {
|
|
1411
1408
|
// Private field - not visible via Object.keys() or any reflection
|
|
1412
1409
|
_BaseService_apiClient.set(this, void 0);
|
|
1413
1410
|
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
1414
|
-
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager), "f");
|
|
1411
|
+
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
1415
1412
|
}
|
|
1416
1413
|
/**
|
|
1417
1414
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -1715,7 +1712,7 @@ const JobMap = {
|
|
|
1715
1712
|
// Connection string placeholder that will be replaced during build
|
|
1716
1713
|
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";
|
|
1717
1714
|
// SDK Version placeholder
|
|
1718
|
-
const SDK_VERSION = "1.3.
|
|
1715
|
+
const SDK_VERSION = "1.3.2";
|
|
1719
1716
|
const VERSION = "Version";
|
|
1720
1717
|
const SERVICE = "Service";
|
|
1721
1718
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -2110,6 +2107,50 @@ class JobService extends FolderScopedService {
|
|
|
2110
2107
|
},
|
|
2111
2108
|
}, options);
|
|
2112
2109
|
}
|
|
2110
|
+
/**
|
|
2111
|
+
* Gets a job by its unique key (GUID).
|
|
2112
|
+
*
|
|
2113
|
+
* Returns the full job details including state, timing, input/output arguments, and error information.
|
|
2114
|
+
* Use `expand` to include related entities like `robot`, or `machine`.
|
|
2115
|
+
*
|
|
2116
|
+
* @param id - The unique key (GUID) of the job to retrieve
|
|
2117
|
+
* @param folderId - The folder ID where the job resides
|
|
2118
|
+
* @param options - Optional query options for expanding or selecting fields
|
|
2119
|
+
* @returns Promise resolving to a {@link JobGetResponse} with full job details and bound methods
|
|
2120
|
+
*
|
|
2121
|
+
* @example
|
|
2122
|
+
* ```typescript
|
|
2123
|
+
* // Get a job by key
|
|
2124
|
+
* const job = await jobs.getById(<id>, <folderId>);
|
|
2125
|
+
* console.log(job.state, job.processName);
|
|
2126
|
+
* ```
|
|
2127
|
+
*
|
|
2128
|
+
* @example
|
|
2129
|
+
* ```typescript
|
|
2130
|
+
* // With expanded related entities
|
|
2131
|
+
* const job = await jobs.getById(<id>, <folderId>, {
|
|
2132
|
+
* expand: 'robot,machine'
|
|
2133
|
+
* });
|
|
2134
|
+
* console.log(job.robot?.name, job.machine?.name);
|
|
2135
|
+
* ```
|
|
2136
|
+
*/
|
|
2137
|
+
async getById(id, folderId, options) {
|
|
2138
|
+
if (!id) {
|
|
2139
|
+
throw new ValidationError({ message: 'id is required for getById' });
|
|
2140
|
+
}
|
|
2141
|
+
if (!folderId) {
|
|
2142
|
+
throw new ValidationError({ message: 'folderId is required for getById' });
|
|
2143
|
+
}
|
|
2144
|
+
const headers = createHeaders({ [FOLDER_ID]: folderId });
|
|
2145
|
+
const keysToPrefix = Object.keys(options ?? {});
|
|
2146
|
+
const apiOptions = options ? addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix) : {};
|
|
2147
|
+
const response = await this.get(JOB_ENDPOINTS.GET_BY_KEY(id), {
|
|
2148
|
+
params: apiOptions,
|
|
2149
|
+
headers,
|
|
2150
|
+
});
|
|
2151
|
+
const rawJob = transformData(pascalToCamelCaseKeys(response.data), JobMap);
|
|
2152
|
+
return createJobWithMethods(rawJob, this);
|
|
2153
|
+
}
|
|
2113
2154
|
/**
|
|
2114
2155
|
* Gets the output of a completed job.
|
|
2115
2156
|
*
|
|
@@ -2146,34 +2187,20 @@ class JobService extends FolderScopedService {
|
|
|
2146
2187
|
if (!jobKey) {
|
|
2147
2188
|
throw new ValidationError({ message: 'jobKey is required for getOutput' });
|
|
2148
2189
|
}
|
|
2149
|
-
const job = await this.
|
|
2150
|
-
if (job.
|
|
2190
|
+
const job = await this.getById(jobKey, folderId, { select: 'outputArguments,outputFile' });
|
|
2191
|
+
if (job.outputArguments) {
|
|
2151
2192
|
try {
|
|
2152
|
-
return JSON.parse(job.
|
|
2193
|
+
return JSON.parse(job.outputArguments);
|
|
2153
2194
|
}
|
|
2154
2195
|
catch {
|
|
2155
2196
|
throw new ServerError({ message: 'Failed to parse job output arguments as JSON' });
|
|
2156
2197
|
}
|
|
2157
2198
|
}
|
|
2158
|
-
if (job.
|
|
2159
|
-
return this.downloadOutputFile(job.
|
|
2199
|
+
if (job.outputFile) {
|
|
2200
|
+
return this.downloadOutputFile(job.outputFile);
|
|
2160
2201
|
}
|
|
2161
2202
|
return null;
|
|
2162
2203
|
}
|
|
2163
|
-
/**
|
|
2164
|
-
* Fetches a job by its Key (GUID) using the GetByKey endpoint.
|
|
2165
|
-
* Only selects fields needed for output extraction.
|
|
2166
|
-
*/
|
|
2167
|
-
async fetchJobByKey(jobKey, folderId) {
|
|
2168
|
-
const headers = createHeaders({ [FOLDER_ID]: folderId });
|
|
2169
|
-
const response = await this.get(JOB_ENDPOINTS.GET_BY_KEY(jobKey), {
|
|
2170
|
-
params: {
|
|
2171
|
-
$select: 'OutputArguments,OutputFile',
|
|
2172
|
-
},
|
|
2173
|
-
headers,
|
|
2174
|
-
});
|
|
2175
|
-
return response.data;
|
|
2176
|
-
}
|
|
2177
2204
|
/**
|
|
2178
2205
|
* Downloads the output file content via the Attachments API.
|
|
2179
2206
|
* 1. Fetches blob access info from the attachment using AttachmentService
|
|
@@ -2212,6 +2239,9 @@ class JobService extends FolderScopedService {
|
|
|
2212
2239
|
__decorate([
|
|
2213
2240
|
track('Jobs.GetAll')
|
|
2214
2241
|
], JobService.prototype, "getAll", null);
|
|
2242
|
+
__decorate([
|
|
2243
|
+
track('Jobs.GetById')
|
|
2244
|
+
], JobService.prototype, "getById", null);
|
|
2215
2245
|
__decorate([
|
|
2216
2246
|
track('Jobs.GetOutput')
|
|
2217
2247
|
], JobService.prototype, "getOutput", null);
|
|
@@ -527,15 +527,11 @@ const RESPONSE_TYPES = {
|
|
|
527
527
|
|
|
528
528
|
class ApiClient {
|
|
529
529
|
constructor(config, executionContext, tokenManager, clientConfig = {}) {
|
|
530
|
-
this.defaultHeaders = {};
|
|
531
530
|
this.config = config;
|
|
532
531
|
this.executionContext = executionContext;
|
|
533
532
|
this.clientConfig = clientConfig;
|
|
534
533
|
this.tokenManager = tokenManager;
|
|
535
534
|
}
|
|
536
|
-
setDefaultHeaders(headers) {
|
|
537
|
-
this.defaultHeaders = { ...this.defaultHeaders, ...headers };
|
|
538
|
-
}
|
|
539
535
|
/**
|
|
540
536
|
* Gets a valid authentication token, refreshing if necessary.
|
|
541
537
|
* Used internally for API requests and exposed for services that need manual auth headers.
|
|
@@ -551,7 +547,6 @@ class ApiClient {
|
|
|
551
547
|
return {
|
|
552
548
|
'Authorization': `Bearer ${token}`,
|
|
553
549
|
'Content-Type': CONTENT_TYPES.JSON,
|
|
554
|
-
...this.defaultHeaders,
|
|
555
550
|
...this.clientConfig.headers
|
|
556
551
|
};
|
|
557
552
|
}
|
|
@@ -1320,6 +1315,8 @@ class BaseService {
|
|
|
1320
1315
|
*
|
|
1321
1316
|
* @param instance - UiPath SDK instance providing authentication and configuration.
|
|
1322
1317
|
* Services receive this via dependency injection in the modular pattern.
|
|
1318
|
+
* @param headers - Optional default headers to include in every request (e.g. `x-uipath-external-user-id` for
|
|
1319
|
+
* CAS external-app auth)
|
|
1323
1320
|
*
|
|
1324
1321
|
* @example
|
|
1325
1322
|
* ```typescript
|
|
@@ -1339,11 +1336,11 @@ class BaseService {
|
|
|
1339
1336
|
* const entities = new Entities(sdk);
|
|
1340
1337
|
* ```
|
|
1341
1338
|
*/
|
|
1342
|
-
constructor(instance) {
|
|
1339
|
+
constructor(instance, headers) {
|
|
1343
1340
|
// Private field - not visible via Object.keys() or any reflection
|
|
1344
1341
|
_BaseService_apiClient.set(this, void 0);
|
|
1345
1342
|
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
1346
|
-
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager), "f");
|
|
1343
|
+
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
1347
1344
|
}
|
|
1348
1345
|
/**
|
|
1349
1346
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -1732,7 +1729,7 @@ class BpmnHelpers {
|
|
|
1732
1729
|
// Connection string placeholder that will be replaced during build
|
|
1733
1730
|
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";
|
|
1734
1731
|
// SDK Version placeholder
|
|
1735
|
-
const SDK_VERSION = "1.3.
|
|
1732
|
+
const SDK_VERSION = "1.3.2";
|
|
1736
1733
|
const VERSION = "Version";
|
|
1737
1734
|
const SERVICE = "Service";
|
|
1738
1735
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -871,6 +871,8 @@ declare class BaseService {
|
|
|
871
871
|
*
|
|
872
872
|
* @param instance - UiPath SDK instance providing authentication and configuration.
|
|
873
873
|
* Services receive this via dependency injection in the modular pattern.
|
|
874
|
+
* @param headers - Optional default headers to include in every request (e.g. `x-uipath-external-user-id` for
|
|
875
|
+
* CAS external-app auth)
|
|
874
876
|
*
|
|
875
877
|
* @example
|
|
876
878
|
* ```typescript
|
|
@@ -890,7 +892,7 @@ declare class BaseService {
|
|
|
890
892
|
* const entities = new Entities(sdk);
|
|
891
893
|
* ```
|
|
892
894
|
*/
|
|
893
|
-
constructor(instance: IUiPath);
|
|
895
|
+
constructor(instance: IUiPath, headers?: Record<string, string>);
|
|
894
896
|
/**
|
|
895
897
|
* Gets a valid authentication token, refreshing if necessary.
|
|
896
898
|
* Use this when you need to manually add Authorization headers (e.g., direct uploads).
|
|
@@ -525,15 +525,11 @@ const RESPONSE_TYPES = {
|
|
|
525
525
|
|
|
526
526
|
class ApiClient {
|
|
527
527
|
constructor(config, executionContext, tokenManager, clientConfig = {}) {
|
|
528
|
-
this.defaultHeaders = {};
|
|
529
528
|
this.config = config;
|
|
530
529
|
this.executionContext = executionContext;
|
|
531
530
|
this.clientConfig = clientConfig;
|
|
532
531
|
this.tokenManager = tokenManager;
|
|
533
532
|
}
|
|
534
|
-
setDefaultHeaders(headers) {
|
|
535
|
-
this.defaultHeaders = { ...this.defaultHeaders, ...headers };
|
|
536
|
-
}
|
|
537
533
|
/**
|
|
538
534
|
* Gets a valid authentication token, refreshing if necessary.
|
|
539
535
|
* Used internally for API requests and exposed for services that need manual auth headers.
|
|
@@ -549,7 +545,6 @@ class ApiClient {
|
|
|
549
545
|
return {
|
|
550
546
|
'Authorization': `Bearer ${token}`,
|
|
551
547
|
'Content-Type': CONTENT_TYPES.JSON,
|
|
552
|
-
...this.defaultHeaders,
|
|
553
548
|
...this.clientConfig.headers
|
|
554
549
|
};
|
|
555
550
|
}
|
|
@@ -1318,6 +1313,8 @@ class BaseService {
|
|
|
1318
1313
|
*
|
|
1319
1314
|
* @param instance - UiPath SDK instance providing authentication and configuration.
|
|
1320
1315
|
* Services receive this via dependency injection in the modular pattern.
|
|
1316
|
+
* @param headers - Optional default headers to include in every request (e.g. `x-uipath-external-user-id` for
|
|
1317
|
+
* CAS external-app auth)
|
|
1321
1318
|
*
|
|
1322
1319
|
* @example
|
|
1323
1320
|
* ```typescript
|
|
@@ -1337,11 +1334,11 @@ class BaseService {
|
|
|
1337
1334
|
* const entities = new Entities(sdk);
|
|
1338
1335
|
* ```
|
|
1339
1336
|
*/
|
|
1340
|
-
constructor(instance) {
|
|
1337
|
+
constructor(instance, headers) {
|
|
1341
1338
|
// Private field - not visible via Object.keys() or any reflection
|
|
1342
1339
|
_BaseService_apiClient.set(this, void 0);
|
|
1343
1340
|
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
1344
|
-
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager), "f");
|
|
1341
|
+
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
1345
1342
|
}
|
|
1346
1343
|
/**
|
|
1347
1344
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -1730,7 +1727,7 @@ class BpmnHelpers {
|
|
|
1730
1727
|
// Connection string placeholder that will be replaced during build
|
|
1731
1728
|
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";
|
|
1732
1729
|
// SDK Version placeholder
|
|
1733
|
-
const SDK_VERSION = "1.3.
|
|
1730
|
+
const SDK_VERSION = "1.3.2";
|
|
1734
1731
|
const VERSION = "Version";
|
|
1735
1732
|
const SERVICE = "Service";
|
|
1736
1733
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
package/dist/processes/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
|
}
|
|
@@ -1453,6 +1448,8 @@ class BaseService {
|
|
|
1453
1448
|
*
|
|
1454
1449
|
* @param instance - UiPath SDK instance providing authentication and configuration.
|
|
1455
1450
|
* Services receive this via dependency injection in the modular pattern.
|
|
1451
|
+
* @param headers - Optional default headers to include in every request (e.g. `x-uipath-external-user-id` for
|
|
1452
|
+
* CAS external-app auth)
|
|
1456
1453
|
*
|
|
1457
1454
|
* @example
|
|
1458
1455
|
* ```typescript
|
|
@@ -1472,11 +1469,11 @@ class BaseService {
|
|
|
1472
1469
|
* const entities = new Entities(sdk);
|
|
1473
1470
|
* ```
|
|
1474
1471
|
*/
|
|
1475
|
-
constructor(instance) {
|
|
1472
|
+
constructor(instance, headers) {
|
|
1476
1473
|
// Private field - not visible via Object.keys() or any reflection
|
|
1477
1474
|
_BaseService_apiClient.set(this, void 0);
|
|
1478
1475
|
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
1479
|
-
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager), "f");
|
|
1476
|
+
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
1480
1477
|
}
|
|
1481
1478
|
/**
|
|
1482
1479
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -1712,7 +1709,7 @@ const PROCESS_ENDPOINTS = {
|
|
|
1712
1709
|
// Connection string placeholder that will be replaced during build
|
|
1713
1710
|
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";
|
|
1714
1711
|
// SDK Version placeholder
|
|
1715
|
-
const SDK_VERSION = "1.3.
|
|
1712
|
+
const SDK_VERSION = "1.3.2";
|
|
1716
1713
|
const VERSION = "Version";
|
|
1717
1714
|
const SERVICE = "Service";
|
|
1718
1715
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -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).
|