8989
9090### onOperation
9191
92- • ` Optional ` ** onOperation** : (` req ` : [ ` Request ` ] ( Request.md ) <` RawRequest ` \> , ` args ` : ` ExecutionArgs ` , ` result ` : ` ExecutionResult ` <` ObjMap ` <` unknown ` \> , ` ObjMap ` <` unknown ` \>\> ) => ` void ` \| [ ` Response ` ] ( ../README.md#response ) \| ` ExecutionResult ` <` ObjMap ` <` unknown ` \> , ` ObjMap ` <` unknown ` \>\> \| ` Promise ` < ` void ` \| [ ` Response ` ] ( ../README.md#response ) \| ` ExecutionResult ` <` ObjMap ` <` unknown ` \> , ` ObjMap ` <` unknown ` \>\>\>
92+ • ` Optional ` ** onOperation** : (` req ` : [ ` Request ` ] ( Request.md ) <` RawRequest ` \> , ` args ` : ` ExecutionArgs ` , ` result ` : ` ExecutionResult ` <` ObjMap ` <` unknown ` \> , ` ObjMap ` <` unknown ` \>\> ) => ` void ` \| ` ExecutionResult ` <` ObjMap ` <` unknown ` \> , ` ObjMap ` <` unknown ` \>\> \| [ ` Response ` ] ( ../README.md#response ) \| ` Promise ` < ` void ` \| ` ExecutionResult ` <` ObjMap ` <` unknown ` \> , ` ObjMap ` <` unknown ` \>\> \| [ ` Response ` ] ( ../README.md#response ) \>
9393
9494#### Type declaration
9595
96- ▸ (` req ` , ` args ` , ` result ` ): ` void ` \| [ ` Response ` ] ( ../README.md#response ) \| ` ExecutionResult ` <` ObjMap ` <` unknown ` \> , ` ObjMap ` <` unknown ` \>\> \| ` Promise ` < ` void ` \| [ ` Response ` ] ( ../README.md#response ) \| ` ExecutionResult ` <` ObjMap ` <` unknown ` \> , ` ObjMap ` <` unknown ` \>\>\>
96+ ▸ (` req ` , ` args ` , ` result ` ): ` void ` \| ` ExecutionResult ` <` ObjMap ` <` unknown ` \> , ` ObjMap ` <` unknown ` \>\> \| [ ` Response ` ] ( ../README.md#response ) \| ` Promise ` < ` void ` \| ` ExecutionResult ` <` ObjMap ` <` unknown ` \> , ` ObjMap ` <` unknown ` \>\> \| [ ` Response ` ] ( ../README.md#response ) \>
9797
9898Executed after the operation call resolves.
9999
@@ -117,21 +117,25 @@ further execution.
117117
118118##### Returns
119119
120- ` void ` \| [ ` Response ` ] ( ../README.md#response ) \| ` ExecutionResult ` <` ObjMap ` <` unknown ` \> , ` ObjMap ` <` unknown ` \>\> \| ` Promise ` < ` void ` \| [ ` Response ` ] ( ../README.md#response ) \| ` ExecutionResult ` <` ObjMap ` <` unknown ` \> , ` ObjMap ` <` unknown ` \>\>\>
120+ ` void ` \| ` ExecutionResult ` <` ObjMap ` <` unknown ` \> , ` ObjMap ` <` unknown ` \>\> \| [ ` Response ` ] ( ../README.md#response ) \| ` Promise ` < ` void ` \| ` ExecutionResult ` <` ObjMap ` <` unknown ` \> , ` ObjMap ` <` unknown ` \>\> \| [ ` Response ` ] ( ../README.md#response ) \>
121121
122122___
123123
124124### onSubscribe
125125
126- • ` Optional ` ** onSubscribe** : (` req ` : [ ` Request ` ] ( Request.md ) <` RawRequest ` \> , ` params ` : [ ` RequestParams ` ] ( RequestParams.md ) ) => ` void ` \| readonly ` GraphQLError ` [ ] \| [ ` Response ` ] ( ../README.md#response ) \| ` ExecutionArgs ` \| ` Promise ` <` void ` \| readonly ` GraphQLError ` [ ] \| [ ` Response ` ] ( ../README.md#response ) \| ` ExecutionArgs ` \>
126+ • ` Optional ` ** onSubscribe** : (` req ` : [ ` Request ` ] ( Request.md ) <` RawRequest ` \> , ` params ` : [ ` RequestParams ` ] ( RequestParams.md ) ) => ` void ` \| readonly ` GraphQLError ` [ ] \| ` ExecutionResult ` < ` ObjMap ` < ` unknown ` \> , ` ObjMap ` < ` unknown ` \>\> \| [ ` Response ` ] ( ../README.md#response ) \| ` ExecutionArgs ` \| ` Promise ` <` void ` \| readonly ` GraphQLError ` [ ] \| ` ExecutionResult ` < ` ObjMap ` < ` unknown ` \> , ` ObjMap ` < ` unknown ` \>\> \| [ ` Response ` ] ( ../README.md#response ) \| ` ExecutionArgs ` \>
127127
128128#### Type declaration
129129
130- ▸ (` req ` , ` params ` ): ` void ` \| readonly ` GraphQLError ` [ ] \| [ ` Response ` ] ( ../README.md#response ) \| ` ExecutionArgs ` \| ` Promise ` <` void ` \| readonly ` GraphQLError ` [ ] \| [ ` Response ` ] ( ../README.md#response ) \| ` ExecutionArgs ` \>
130+ ▸ (` req ` , ` params ` ): ` void ` \| readonly ` GraphQLError ` [ ] \| ` ExecutionResult ` < ` ObjMap ` < ` unknown ` \> , ` ObjMap ` < ` unknown ` \>\> \| [ ` Response ` ] ( ../README.md#response ) \| ` ExecutionArgs ` \| ` Promise ` <` void ` \| readonly ` GraphQLError ` [ ] \| ` ExecutionResult ` < ` ObjMap ` < ` unknown ` \> , ` ObjMap ` < ` unknown ` \>\> \| [ ` Response ` ] ( ../README.md#response ) \| ` ExecutionArgs ` \>
131131
132132The subscribe callback executed right after processing the request
133133before proceeding with the GraphQL operation execution.
134134
135+ If you return ` ExecutionResult ` from the callback, it will be used
136+ directly for responding to the request. Useful for implementing a response
137+ cache.
138+
135139If you return ` ExecutionArgs ` from the callback, it will be used instead of
136140trying to build one internally. In this case, you are responsible for providing
137141a ready set of arguments which will be directly plugged in the operation execution.
@@ -159,7 +163,7 @@ further execution.
159163
160164##### Returns
161165
162- ` void ` \| readonly ` GraphQLError ` [ ] \| [ ` Response ` ] ( ../README.md#response ) \| ` ExecutionArgs ` \| ` Promise ` <` void ` \| readonly ` GraphQLError ` [ ] \| [ ` Response ` ] ( ../README.md#response ) \| ` ExecutionArgs ` \>
166+ ` void ` \| readonly ` GraphQLError ` [ ] \| ` ExecutionResult ` < ` ObjMap ` < ` unknown ` \> , ` ObjMap ` < ` unknown ` \>\> \| [ ` Response ` ] ( ../README.md#response ) \| ` ExecutionArgs ` \| ` Promise ` <` void ` \| readonly ` GraphQLError ` [ ] \| ` ExecutionResult ` < ` ObjMap ` < ` unknown ` \> , ` ObjMap ` < ` unknown ` \>\> \| [ ` Response ` ] ( ../README.md#response ) \| ` ExecutionArgs ` \>
163167
164168___
165169
0 commit comments