Skip to content

Commit a0a2ef8

Browse files
chore: address comments
1 parent 84b79ca commit a0a2ef8

7 files changed

Lines changed: 53 additions & 26 deletions

File tree

.claude/skills/onboard-api/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Use the appropriate checklist based on the ticket type detected in Step 1. You m
7171
- Swagger/OpenAPI URL + endpoint paths → use directly
7272
- Missing either → stop and ask
7373

74-
**If Jira ticket:** Parse description for URLs ending in `.json`/`.yaml`/`swagger.json`/`openapi.json`, HTTP method + path patterns, scope strings (e.g., `OR.Jobs`), and whether each endpoint requires a `folderId`. If Swagger URL missing, stop and report.
74+
**If Jira ticket:** Parse description for URLs ending in `.json`/`.yaml`/`swagger.json`/`openapi.json`, HTTP method + path patterns, scope strings (e.g., `OR.Jobs`), and whether each endpoint requires a `folderId` or `folderKey`. If Swagger URL missing, stop and report.
7575

7676
**Ticket type detection:**
7777
- `API:` field present → **Direct API** (existing workflow)

src/models/orchestrator/jobs.models.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export interface JobServiceModel {
7171
* Gets a job by its unique key (GUID).
7272
*
7373
* Returns the full job details including state, timing, input/output arguments, and error information.
74-
* Use `expand` to include related entities like Robot, Machine, or Release.
74+
* Use `expand` to include related entities like `robot`, or `machine`.
7575
*
7676
* @param id - The unique key (GUID) of the job to retrieve
7777
* @param folderId - The folder ID where the job resides
@@ -89,7 +89,7 @@ export interface JobServiceModel {
8989
* ```typescript
9090
* // With expanded related entities
9191
* const job = await jobs.getById(<id>, <folderId>, {
92-
* expand: 'Robot,Machine,Release'
92+
* expand: 'robot,machine'
9393
* });
9494
* console.log(job.robot?.name, job.machine?.name);
9595
* ```

src/models/orchestrator/jobs.types.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export enum ServerlessJobType {
4141
/**
4242
* Interface for process metadata associated with a job.
4343
* Represents a lightweight summary of the process (release) linked to a job.
44-
* Available when using 'expand: "Release"' in the query.
44+
* Available when using 'expand: "release"' in the query.
4545
*/
4646
export interface ProcessMetadata {
4747
/** The unique key of the release */
@@ -146,11 +146,11 @@ export interface RawJobGetResponse extends FolderProperties {
146146
parentSpanId: string | null;
147147
/** The error code associated with a failed job */
148148
errorCode: string | null;
149-
/** The machine associated with the job (available when using expand=Machine) */
149+
/** The machine associated with the job (available when using expand=machine) */
150150
machine?: Machine;
151-
/** The robot associated with the job (available when using expand=Robot) */
151+
/** The robot associated with the job (available when using expand=robot) */
152152
robot?: RobotMetadata;
153-
/** The process metadata associated with the job (available when using expand=Release) */
153+
/** The process metadata associated with the job */
154154
process?: ProcessMetadata | null;
155155
/** Error details for the job, or null if the job has no errors */
156156
jobError: JobError | null;

src/services/orchestrator/jobs/jobs.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export class JobService extends FolderScopedService implements JobServiceModel {
108108
* Gets a job by its unique key (GUID).
109109
*
110110
* Returns the full job details including state, timing, input/output arguments, and error information.
111-
* Use `expand` to include related entities like Robot, Machine, or Release.
111+
* Use `expand` to include related entities like `robot`, or `machine`.
112112
*
113113
* @param id - The unique key (GUID) of the job to retrieve
114114
* @param folderId - The folder ID where the job resides
@@ -126,7 +126,7 @@ export class JobService extends FolderScopedService implements JobServiceModel {
126126
* ```typescript
127127
* // With expanded related entities
128128
* const job = await jobs.getById(<id>, <folderId>, {
129-
* expand: 'Robot,Machine,Release'
129+
* expand: 'robot,machine'
130130
* });
131131
* console.log(job.robot?.name, job.machine?.name);
132132
* ```
@@ -191,8 +191,7 @@ export class JobService extends FolderScopedService implements JobServiceModel {
191191
throw new ValidationError({ message: 'jobKey is required for getOutput' });
192192
}
193193

194-
// OData $select expects raw API field names (PascalCase), not SDK camelCase names
195-
const job = await this.getById(jobKey, folderId, { select: 'OutputArguments,OutputFile' });
194+
const job = await this.getById(jobKey, folderId, { select: 'outputArguments,outputFile' });
196195

197196
if (job.outputArguments) {
198197
try {

tests/integration/shared/orchestrator/jobs.integration.test.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ describe.each(modes)('Orchestrator Jobs - Integration Tests [%s]', (mode) => {
7777
});
7878

7979
if (allJobs.items.length === 0) {
80-
console.warn('No jobs available to test getById — skipping.');
81-
return;
80+
throw new Error('No jobs available in the test environment to test getById.');
8281
}
8382

8483
const jobKey = allJobs.items[0].key;
@@ -119,13 +118,12 @@ describe.each(modes)('Orchestrator Jobs - Integration Tests [%s]', (mode) => {
119118
});
120119

121120
if (allJobs.items.length === 0) {
122-
console.warn('No jobs available to test getById with expand — skipping.');
123-
return;
121+
throw new Error('No jobs available in the test environment to test getById with expand.');
124122
}
125123

126124
const jobKey = allJobs.items[0].key;
127125
const job = await jobs.getById(jobKey, folderId, {
128-
expand: 'Robot,Machine,Release',
126+
expand: 'robot,machine',
129127
});
130128

131129
expect(job).toBeDefined();
@@ -139,9 +137,6 @@ describe.each(modes)('Orchestrator Jobs - Integration Tests [%s]', (mode) => {
139137
if (job.machine) {
140138
expect(job.machine.id).toBeDefined();
141139
}
142-
if (job.process) {
143-
expect(job.process.id).toBeDefined();
144-
}
145140
});
146141
});
147142

@@ -161,8 +156,7 @@ describe.each(modes)('Orchestrator Jobs - Integration Tests [%s]', (mode) => {
161156
});
162157

163158
if (result.items.length === 0) {
164-
console.warn('No successful jobs found to test getOutput — skipping.');
165-
return;
159+
throw new Error('No successful jobs found in the test environment to test getOutput.');
166160
}
167161

168162
const job = result.items[0];

tests/unit/services/orchestrator/jobs.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ describe('JobService Unit Tests', () => {
230230
mockApiClient.get.mockResolvedValueOnce(mockRawJob);
231231

232232
const options: JobGetByIdOptions = {
233-
expand: 'Robot,Machine,Release',
234-
select: 'Key,State,ReleaseName',
233+
expand: 'robot,machine',
234+
select: 'key,state',
235235
};
236236

237237
await jobService.getById(JOB_TEST_CONSTANTS.JOB_KEY, TEST_CONSTANTS.FOLDER_ID, options);
@@ -240,8 +240,8 @@ describe('JobService Unit Tests', () => {
240240
JOB_ENDPOINTS.GET_BY_KEY(JOB_TEST_CONSTANTS.JOB_KEY),
241241
expect.objectContaining({
242242
params: {
243-
$expand: 'Robot,Machine,Release',
244-
$select: 'Key,State,ReleaseName',
243+
$expand: 'robot,machine',
244+
$select: 'key,state',
245245
},
246246
})
247247
);
@@ -277,7 +277,7 @@ describe('JobService Unit Tests', () => {
277277
JOB_ENDPOINTS.GET_BY_KEY(JOB_TEST_CONSTANTS.JOB_KEY),
278278
expect.objectContaining({
279279
params: {
280-
$select: 'OutputArguments,OutputFile',
280+
$select: 'outputArguments,outputFile',
281281
},
282282
headers: expect.objectContaining({
283283
'X-UIPATH-OrganizationUnitId': String(TEST_CONSTANTS.FOLDER_ID),

tests/utils/mocks/jobs.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,54 @@ export const createMockRawJob = (overrides: Partial<any> = {}): any => {
2525
HostMachineName: JOB_TEST_CONSTANTS.HOST_MACHINE_NAME,
2626
EntryPointPath: JOB_TEST_CONSTANTS.ENTRY_POINT_PATH,
2727
JobPriority: JobPriority.Normal,
28+
SpecificPriorityValue: 45,
2829
Type: JobType.Unattended,
2930
Source: 'Manual',
31+
SourceType: JobSourceType.Manual,
32+
ServerlessJobType: null,
3033
Info: null,
34+
Reference: '',
3135
InputArguments: null,
3236
OutputArguments: null,
37+
OutputFile: null,
38+
EnvironmentVariables: null,
3339
// Using raw API field names that should be transformed
3440
CreationTime: JOB_TEST_CONSTANTS.CREATED_TIME,
3541
StartTime: JOB_TEST_CONSTANTS.START_TIME,
3642
EndTime: JOB_TEST_CONSTANTS.END_TIME,
3743
LastModificationTime: JOB_TEST_CONSTANTS.LAST_MODIFIED_TIME,
44+
ResumeTime: null,
3845
OrganizationUnitId: TEST_CONSTANTS.FOLDER_ID,
3946
OrganizationUnitFullyQualifiedName: TEST_CONSTANTS.FOLDER_NAME,
47+
FolderKey: null,
48+
BatchExecutionKey: '00000000-0000-0000-0000-000000000000',
49+
ParentJobKey: null,
50+
StartingScheduleId: null,
51+
StartingTriggerId: null,
52+
ReleaseVersionId: null,
53+
MaxExpectedRunningTimeSeconds: null,
54+
RequiresUserInteraction: false,
55+
ResumeOnSameContext: false,
56+
ResumeVersion: null,
57+
SubState: null,
58+
RuntimeType: null,
59+
TargetRuntime: null,
60+
StopStrategy: null,
61+
RemoteControlAccess: RemoteControlAccess.None,
62+
TraceId: null,
63+
ParentSpanId: null,
64+
ErrorCode: null,
4065
Machine: { Id: 1, Name: 'ROBOT-01' },
4166
Robot: { Id: 1, Name: 'Robot1', Username: String.raw`domain\robot1` },
67+
Release: {
68+
Key: 'release-key-001',
69+
ProcessKey: 'process-key-001',
70+
ProcessVersion: '1.0.0',
71+
IsLatestVersion: true,
72+
Name: JOB_TEST_CONSTANTS.PROCESS_NAME,
73+
Id: 1,
74+
},
75+
ProcessType: PackageType.Process,
4276
JobError: null,
4377
}, overrides);
4478
};

0 commit comments

Comments
 (0)