@@ -66,9 +66,12 @@ export default class JobRun extends JobCommand<typeof JobRun> {
6666 } ) ,
6767 } ;
6868
69- protected async executeJob ( jobId : string , options : Parameters < typeof executeJob > [ 2 ] ) {
70- return executeJob ( this . instance , jobId , options ) ;
71- }
69+ protected operations = {
70+ executeJob : async ( jobId : string , options : Parameters < typeof executeJob > [ 2 ] ) =>
71+ executeJob ( this . instance , jobId , options ) ,
72+ waitForJob : async ( jobId : string , executionId : string , options : Parameters < typeof waitForJob > [ 3 ] ) =>
73+ waitForJob ( this . instance , jobId , executionId , options ) ,
74+ } ;
7275
7376 async run ( ) : Promise < JobExecution > {
7477 this . requireOAuthCredentials ( ) ;
@@ -110,7 +113,7 @@ export default class JobRun extends JobCommand<typeof JobRun> {
110113
111114 let execution : JobExecution ;
112115 try {
113- execution = await this . executeJob ( jobId , {
116+ execution = await this . operations . executeJob ( jobId , {
114117 parameters : rawBody ? undefined : parameters ,
115118 body : rawBody ,
116119 waitForRunning : ! noWaitRunning ,
@@ -147,10 +150,6 @@ export default class JobRun extends JobCommand<typeof JobRun> {
147150 return execution ;
148151 }
149152
150- protected async waitForJob ( jobId : string , executionId : string , options : Parameters < typeof waitForJob > [ 3 ] ) {
151- return waitForJob ( this . instance , jobId , executionId , options ) ;
152- }
153-
154153 private handleExecutionError ( error : unknown , context : B2COperationContext ) : never {
155154 // Run afterOperation hooks with failure (fire-and-forget, errors ignored)
156155 this . runAfterHooks ( context , {
@@ -221,7 +220,7 @@ export default class JobRun extends JobCommand<typeof JobRun> {
221220 this . log ( t ( 'commands.job.run.waiting' , 'Waiting for job to complete...' ) ) ;
222221
223222 try {
224- const execution = await this . waitForJob ( jobId , executionId , {
223+ const execution = await this . operations . waitForJob ( jobId , executionId , {
225224 timeout : timeout ? timeout * 1000 : undefined ,
226225 onProgress : ( exec , elapsed ) => {
227226 if ( ! this . jsonEnabled ( ) ) {
0 commit comments