@@ -58,7 +58,7 @@ export class AutoExecutor {
58
58
if ( this . executingStep ) {
59
59
throw new WorkflowError (
60
60
"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 } '`
62
62
) ;
63
63
}
64
64
@@ -171,7 +171,7 @@ export class AutoExecutor {
171
171
// user has added/removed a parallel step
172
172
throw new WorkflowError (
173
173
`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.`
175
175
) ;
176
176
}
177
177
@@ -206,7 +206,7 @@ export class AutoExecutor {
206
206
if ( ! planStep || planStep . targetStep === undefined ) {
207
207
throw new WorkflowError (
208
208
`There must be a last step and it should have targetStep larger than 0.` +
209
- `Received: ${ JSON . stringify ( planStep ) } `
209
+ `Received: ${ JSON . stringify ( planStep ) } `
210
210
) ;
211
211
}
212
212
const stepIndex = planStep . targetStep - initialStepCount ;
@@ -350,6 +350,7 @@ export class AutoExecutor {
350
350
failureUrl : this . context . failureUrl ,
351
351
retries : this . context . retries ,
352
352
telemetry : this . telemetry ,
353
+ flowControl : this . context . flowControl
353
354
} ) ;
354
355
355
356
// call wait
@@ -393,37 +394,39 @@ export class AutoExecutor {
393
394
callRetries : lazyStep instanceof LazyCallStep ? lazyStep . retries : undefined ,
394
395
callTimeout : lazyStep instanceof LazyCallStep ? lazyStep . timeout : undefined ,
395
396
telemetry : this . telemetry ,
397
+ flowControl : this . context . flowControl ,
398
+ callFlowControl : lazyStep instanceof LazyCallStep ? lazyStep . flowControl : undefined ,
396
399
} ) ;
397
400
398
401
// if the step is a single step execution or a plan step, we can add sleep headers
399
402
const willWait = singleStep . concurrent === NO_CONCURRENCY || singleStep . stepId === 0 ;
400
403
401
404
singleStep . out = JSON . stringify ( singleStep . out ) ;
402
405
403
- return singleStep . callUrl
406
+ return singleStep . callUrl && lazyStep instanceof LazyCallStep
404
407
? // 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
+ }
416
419
: // 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
+ } ;
427
430
} )
428
431
) ;
429
432
@@ -496,14 +499,14 @@ const validateStep = (lazyStep: BaseLazyStep, stepFromRequest: Step): void => {
496
499
if ( lazyStep . stepName !== stepFromRequest . stepName ) {
497
500
throw new WorkflowError (
498
501
`Incompatible step name. Expected '${ lazyStep . stepName } ',` +
499
- ` got '${ stepFromRequest . stepName } ' from the request`
502
+ ` got '${ stepFromRequest . stepName } ' from the request`
500
503
) ;
501
504
}
502
505
// check type name
503
506
if ( lazyStep . stepType !== stepFromRequest . stepType ) {
504
507
throw new WorkflowError (
505
508
`Incompatible step type. Expected '${ lazyStep . stepType } ',` +
506
- ` got '${ stepFromRequest . stepType } ' from the request`
509
+ ` got '${ stepFromRequest . stepType } ' from the request`
507
510
) ;
508
511
}
509
512
} ;
@@ -531,10 +534,10 @@ const validateParallelSteps = (lazySteps: BaseLazyStep[], stepsFromRequest: Step
531
534
const requestStepTypes = stepsFromRequest . map ( ( step ) => step . stepType ) ;
532
535
throw new WorkflowError (
533
536
`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 ) } `
538
541
) ;
539
542
}
540
543
throw error ;
0 commit comments