@@ -16,6 +16,8 @@ import {
16
16
WorkflowUpdateAnnotatedType ,
17
17
ProtoFailure ,
18
18
ApplicationFailure ,
19
+ WorkflowUpdateType ,
20
+ WorkflowUpdateValidatorType ,
19
21
} from '@temporalio/common' ;
20
22
import { composeInterceptors } from '@temporalio/common/lib/interceptors' ;
21
23
import { checkExtends } from '@temporalio/common/lib/type-helpers' ;
@@ -668,7 +670,7 @@ export class Activator implements ActivationHandler {
668
670
const validate = composeInterceptors (
669
671
this . interceptors . inbound ,
670
672
'validateUpdate' ,
671
- this . validateUpdateNextHandler . bind ( this )
673
+ this . validateUpdateNextHandler . bind ( this , entry . validator )
672
674
) ;
673
675
validate ( makeInput ( ) ) ;
674
676
}
@@ -678,7 +680,7 @@ export class Activator implements ActivationHandler {
678
680
return ;
679
681
}
680
682
this . acceptUpdate ( protocolInstanceId ) ;
681
- const execute = composeInterceptors ( this . interceptors . inbound , 'handleUpdate' , this . updateNextHandler . bind ( this ) ) ;
683
+ const execute = composeInterceptors ( this . interceptors . inbound , 'handleUpdate' , this . updateNextHandler . bind ( this , entry . handler ) ) ;
682
684
const { unfinishedPolicy } = entry ;
683
685
this . inProgressUpdates . set ( updateId , { name, unfinishedPolicy, id : updateId } ) ;
684
686
const res = execute ( input )
@@ -697,13 +699,11 @@ export class Activator implements ActivationHandler {
697
699
untrackPromise ( UpdateScope . updateWithInfo ( updateId , name , doUpdateImpl ) ) ;
698
700
}
699
701
700
- protected async updateNextHandler ( { name, args } : UpdateInput ) : Promise < unknown > {
701
- const { handler } = this . updateHandlers . get ( name ) ! ;
702
+ protected async updateNextHandler ( handler : WorkflowUpdateType , { args } : UpdateInput ) : Promise < unknown > {
702
703
return await handler ( ...args ) ;
703
704
}
704
705
705
- protected validateUpdateNextHandler ( { name, args } : UpdateInput ) : void {
706
- const { validator } = this . updateHandlers . get ( name ) ?? { } ;
706
+ protected validateUpdateNextHandler ( validator : WorkflowUpdateValidatorType | undefined , { args } : UpdateInput ) : void {
707
707
if ( validator ) {
708
708
validator ( ...args ) ;
709
709
}
0 commit comments