@@ -43,6 +43,7 @@ import {
43
43
WorkflowCancelInput ,
44
44
WorkflowClientCallsInterceptor ,
45
45
WorkflowClientInterceptors ,
46
+ WorkflowDescribeInput ,
46
47
WorkflowQueryInput ,
47
48
WorkflowSignalInput ,
48
49
WorkflowSignalWithStartInput ,
@@ -711,6 +712,22 @@ export class WorkflowClient {
711
712
}
712
713
}
713
714
715
+ /**
716
+ * Uses given input to make describeWorkflowExecution call to the service
717
+ *
718
+ * Used as the final function of the describe interceptor chain
719
+ */
720
+ protected async _describeWorkflowHandler ( input : WorkflowDescribeInput ) : Promise < DescribeWorkflowExecutionResponse > {
721
+ try {
722
+ return await this . service . describeWorkflowExecution ( {
723
+ namespace : this . options . namespace ,
724
+ execution : input . workflowExecution ,
725
+ } ) ;
726
+ } catch ( err ) {
727
+ this . rethrowGrpcError ( err , input . workflowExecution , 'Failed to describe workflow' ) ;
728
+ }
729
+ }
730
+
714
731
/**
715
732
* Create a new workflow handle for new or existing Workflow execution
716
733
*/
@@ -722,8 +739,6 @@ export class WorkflowClient {
722
739
runIdForResult,
723
740
...resultOptions
724
741
} : WorkflowHandleOptions ) : WorkflowHandle < T > {
725
- const namespace = this . options . namespace ;
726
-
727
742
return {
728
743
client : this ,
729
744
workflowId,
@@ -748,12 +763,10 @@ export class WorkflowClient {
748
763
} ) ;
749
764
} ,
750
765
async describe ( ) {
751
- return this . client . service . describeWorkflowExecution ( {
752
- namespace,
753
- execution : {
754
- runId,
755
- workflowId,
756
- } ,
766
+ const next = this . client . _describeWorkflowHandler . bind ( this . client ) ;
767
+ const fn = interceptors . length ? composeInterceptors ( interceptors , 'describe' , next ) : next ;
768
+ return await fn ( {
769
+ workflowExecution : { workflowId, runId } ,
757
770
} ) ;
758
771
} ,
759
772
async signal < Args extends any [ ] > ( def : SignalDefinition < Args > | string , ...args : Args ) : Promise < void > {
0 commit comments