@@ -58,7 +58,7 @@ export class AutoExecutor {
5858 if ( this . executingStep ) {
5959 throw new WorkflowError (
6060 "A step can not be run inside another step." +
61- ` Tried to run '${ stepInfo . stepName } ' inside '${ this . executingStep } '`
61+ ` Tried to run '${ stepInfo . stepName } ' inside '${ this . executingStep } '`
6262 ) ;
6363 }
6464
@@ -171,7 +171,7 @@ export class AutoExecutor {
171171 // user has added/removed a parallel step
172172 throw new WorkflowError (
173173 `Incompatible number of parallel steps when call state was '${ parallelCallState } '.` +
174- ` Expected ${ parallelSteps . length } , got ${ plannedParallelStepCount } from the request.`
174+ ` Expected ${ parallelSteps . length } , got ${ plannedParallelStepCount } from the request.`
175175 ) ;
176176 }
177177
@@ -206,7 +206,7 @@ export class AutoExecutor {
206206 if ( ! planStep || planStep . targetStep === undefined ) {
207207 throw new WorkflowError (
208208 `There must be a last step and it should have targetStep larger than 0.` +
209- `Received: ${ JSON . stringify ( planStep ) } `
209+ `Received: ${ JSON . stringify ( planStep ) } `
210210 ) ;
211211 }
212212 const stepIndex = planStep . targetStep - initialStepCount ;
@@ -350,6 +350,7 @@ export class AutoExecutor {
350350 failureUrl : this . context . failureUrl ,
351351 retries : this . context . retries ,
352352 telemetry : this . telemetry ,
353+ flowControl : this . context . flowControl
353354 } ) ;
354355
355356 // call wait
@@ -393,37 +394,39 @@ export class AutoExecutor {
393394 callRetries : lazyStep instanceof LazyCallStep ? lazyStep . retries : undefined ,
394395 callTimeout : lazyStep instanceof LazyCallStep ? lazyStep . timeout : undefined ,
395396 telemetry : this . telemetry ,
397+ flowControl : this . context . flowControl ,
398+ callFlowControl : lazyStep instanceof LazyCallStep ? lazyStep . flowControl : undefined ,
396399 } ) ;
397400
398401 // if the step is a single step execution or a plan step, we can add sleep headers
399402 const willWait = singleStep . concurrent === NO_CONCURRENCY || singleStep . stepId === 0 ;
400403
401404 singleStep . out = JSON . stringify ( singleStep . out ) ;
402405
403- return singleStep . callUrl
406+ return singleStep . callUrl && lazyStep instanceof LazyCallStep
404407 ? // if the step is a third party call, we call the third party
405- // url (singleStep.callUrl) and pass information about the workflow
406- // in the headers (handled in getHeaders). QStash makes the request
407- // to callUrl and returns the result to Workflow endpoint.
408- // handleThirdPartyCallResult method sends the result of the third
409- // party call to QStash.
410- {
411- headers,
412- method : singleStep . callMethod ,
413- body : singleStep . callBody ,
414- url : singleStep . callUrl ,
415- }
408+ // url (singleStep.callUrl) and pass information about the workflow
409+ // in the headers (handled in getHeaders). QStash makes the request
410+ // to callUrl and returns the result to Workflow endpoint.
411+ // handleThirdPartyCallResult method sends the result of the third
412+ // party call to QStash.
413+ {
414+ headers,
415+ method : singleStep . callMethod ,
416+ body : singleStep . callBody ,
417+ url : singleStep . callUrl ,
418+ }
416419 : // if the step is not a third party call, we use workflow
417- // endpoint (context.url) as URL when calling QStash. QStash
418- // calls us back with the updated steps list.
419- {
420- headers,
421- method : "POST" ,
422- body : singleStep ,
423- url : this . context . url ,
424- notBefore : willWait ? singleStep . sleepUntil : undefined ,
425- delay : willWait ? singleStep . sleepFor : undefined ,
426- } ;
420+ // endpoint (context.url) as URL when calling QStash. QStash
421+ // calls us back with the updated steps list.
422+ {
423+ headers,
424+ method : "POST" ,
425+ body : singleStep ,
426+ url : this . context . url ,
427+ notBefore : willWait ? singleStep . sleepUntil : undefined ,
428+ delay : willWait ? singleStep . sleepFor : undefined ,
429+ } ;
427430 } )
428431 ) ;
429432
@@ -496,14 +499,14 @@ const validateStep = (lazyStep: BaseLazyStep, stepFromRequest: Step): void => {
496499 if ( lazyStep . stepName !== stepFromRequest . stepName ) {
497500 throw new WorkflowError (
498501 `Incompatible step name. Expected '${ lazyStep . stepName } ',` +
499- ` got '${ stepFromRequest . stepName } ' from the request`
502+ ` got '${ stepFromRequest . stepName } ' from the request`
500503 ) ;
501504 }
502505 // check type name
503506 if ( lazyStep . stepType !== stepFromRequest . stepType ) {
504507 throw new WorkflowError (
505508 `Incompatible step type. Expected '${ lazyStep . stepType } ',` +
506- ` got '${ stepFromRequest . stepType } ' from the request`
509+ ` got '${ stepFromRequest . stepType } ' from the request`
507510 ) ;
508511 }
509512} ;
@@ -531,10 +534,10 @@ const validateParallelSteps = (lazySteps: BaseLazyStep[], stepsFromRequest: Step
531534 const requestStepTypes = stepsFromRequest . map ( ( step ) => step . stepType ) ;
532535 throw new WorkflowError (
533536 `Incompatible steps detected in parallel execution: ${ error . message } ` +
534- `\n > Step Names from the request: ${ JSON . stringify ( requestStepNames ) } ` +
535- `\n Step Types from the request: ${ JSON . stringify ( requestStepTypes ) } ` +
536- `\n > Step Names expected: ${ JSON . stringify ( lazyStepNames ) } ` +
537- `\n Step Types expected: ${ JSON . stringify ( lazyStepTypes ) } `
537+ `\n > Step Names from the request: ${ JSON . stringify ( requestStepNames ) } ` +
538+ `\n Step Types from the request: ${ JSON . stringify ( requestStepTypes ) } ` +
539+ `\n > Step Names expected: ${ JSON . stringify ( lazyStepNames ) } ` +
540+ `\n Step Types expected: ${ JSON . stringify ( lazyStepTypes ) } `
538541 ) ;
539542 }
540543 throw error ;
0 commit comments