@@ -94,14 +94,18 @@ export abstract class TSProxy<Data, Payload, Error = string> {
9494 private readonly context : IProxyContext < Data , Payload , Error > ,
9595 ) { }
9696
97- private async canExecute ( data : Data ) : Promise < Result < boolean , Error > > {
97+ private async canExecute (
98+ data : Data ,
99+ ) : Promise < Result < boolean | null , Error > > {
98100 if ( ! this . context . canExecute ) {
99101 return Result . Ok ( true ) ;
100102 }
101103 return this . context . canExecute . execute ( data ) ;
102104 }
103105
104- private async beforeExecute ( data : Data ) : Promise < Result < Data , Error > > {
106+ private async beforeExecute (
107+ data : Data ,
108+ ) : Promise < Result < Data | null , Error > > {
105109 if ( ! this . context . beforeExecute ) {
106110 return Result . Ok ( data ) ;
107111 }
@@ -118,7 +122,7 @@ export abstract class TSProxy<Data, Payload, Error = string> {
118122 return this . context . afterExecute . execute ( Result . Ok ( data . value ( ) ) ) ;
119123 }
120124
121- async execute ( data : Data ) : Promise < Result < Payload , Error > > {
125+ async execute ( data : Data ) : Promise < Result < Payload | null , Error > > {
122126 const beforePayload = await this . beforeExecute ( data ) ;
123127
124128 if ( beforePayload . isFail ( ) ) {
@@ -142,7 +146,7 @@ export abstract class TSProxy<Data, Payload, Error = string> {
142146
143147 const param = beforePayload ?. value ( ) ? beforePayload ?. value ( ) : data ;
144148
145- const executeResult = await this . context . execute . execute ( param ) ;
149+ const executeResult = await this . context . execute . execute ( param as Data ) ;
146150
147151 if ( executeResult . isFail ( ) ) {
148152 const error = executeResult ?. error ( ) ?? 'error on execute proxy' ;
0 commit comments