effect 4.0.3 → 4.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/AGENTS.md +24 -0
  2. package/CLAUDE.md +24 -0
  3. package/ai-docs/package.json +2 -2
  4. package/ai-docs/src/52_graphql/10_basics.ts +111 -0
  5. package/ai-docs/src/52_graphql/20_testing.ts +45 -0
  6. package/ai-docs/src/52_graphql/30_batching.ts +116 -0
  7. package/ai-docs/src/52_graphql/40_aliased-batching.ts +122 -0
  8. package/ai-docs/src/52_graphql/50_errors-and-retries.ts +74 -0
  9. package/ai-docs/src/52_graphql/index.md +6 -0
  10. package/dist/Context.d.ts.map +1 -1
  11. package/dist/Context.js +9 -0
  12. package/dist/Context.js.map +1 -1
  13. package/dist/RequestResolver.d.ts.map +1 -1
  14. package/dist/RequestResolver.js +4 -10
  15. package/dist/RequestResolver.js.map +1 -1
  16. package/dist/Scheduler.d.ts +9 -0
  17. package/dist/Scheduler.d.ts.map +1 -1
  18. package/dist/Scheduler.js +9 -0
  19. package/dist/Scheduler.js.map +1 -1
  20. package/dist/Schema.d.ts +8 -0
  21. package/dist/Schema.d.ts.map +1 -1
  22. package/dist/Schema.js +7 -0
  23. package/dist/Schema.js.map +1 -1
  24. package/dist/SchemaGetter.d.ts +4 -0
  25. package/dist/SchemaGetter.d.ts.map +1 -1
  26. package/dist/SchemaGetter.js +52 -33
  27. package/dist/SchemaGetter.js.map +1 -1
  28. package/dist/Sink.d.ts.map +1 -1
  29. package/dist/Sink.js +38 -17
  30. package/dist/Sink.js.map +1 -1
  31. package/dist/Stream.d.ts +11 -0
  32. package/dist/Stream.d.ts.map +1 -1
  33. package/dist/Stream.js +16 -1
  34. package/dist/Stream.js.map +1 -1
  35. package/dist/Utils.js +8 -3
  36. package/dist/Utils.js.map +1 -1
  37. package/dist/ai/AnthropicStructuredOutput.js +0 -2
  38. package/dist/ai/AnthropicStructuredOutput.js.map +1 -1
  39. package/dist/ai/Chat.d.ts +2 -2
  40. package/dist/ai/Chat.d.ts.map +1 -1
  41. package/dist/ai/LanguageModel.d.ts +38 -7
  42. package/dist/ai/LanguageModel.d.ts.map +1 -1
  43. package/dist/ai/LanguageModel.js +25 -7
  44. package/dist/ai/LanguageModel.js.map +1 -1
  45. package/dist/ai/McpServer.d.ts +55 -0
  46. package/dist/ai/McpServer.d.ts.map +1 -1
  47. package/dist/ai/McpServer.js +132 -22
  48. package/dist/ai/McpServer.js.map +1 -1
  49. package/dist/ai/Prompt.d.ts.map +1 -1
  50. package/dist/ai/Prompt.js +28 -5
  51. package/dist/ai/Prompt.js.map +1 -1
  52. package/dist/ai/Response.d.ts +4 -3
  53. package/dist/ai/Response.d.ts.map +1 -1
  54. package/dist/ai/Response.js.map +1 -1
  55. package/dist/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  56. package/dist/cluster/ClusterWorkflowEngine.js +46 -8
  57. package/dist/cluster/ClusterWorkflowEngine.js.map +1 -1
  58. package/dist/cluster/Sharding.d.ts.map +1 -1
  59. package/dist/cluster/Sharding.js +6 -4
  60. package/dist/cluster/Sharding.js.map +1 -1
  61. package/dist/encoding/Sse.d.ts +6 -0
  62. package/dist/encoding/Sse.d.ts.map +1 -1
  63. package/dist/encoding/Sse.js +62 -70
  64. package/dist/encoding/Sse.js.map +1 -1
  65. package/dist/graphql/GraphQL.d.ts +349 -0
  66. package/dist/graphql/GraphQL.d.ts.map +1 -0
  67. package/dist/graphql/GraphQL.js +207 -0
  68. package/dist/graphql/GraphQL.js.map +1 -0
  69. package/dist/graphql/GraphQLClient.d.ts +562 -0
  70. package/dist/graphql/GraphQLClient.d.ts.map +1 -0
  71. package/dist/graphql/GraphQLClient.js +498 -0
  72. package/dist/graphql/GraphQLClient.js.map +1 -0
  73. package/dist/graphql/GraphQLClientError.d.ts +445 -0
  74. package/dist/graphql/GraphQLClientError.d.ts.map +1 -0
  75. package/dist/graphql/GraphQLClientError.js +479 -0
  76. package/dist/graphql/GraphQLClientError.js.map +1 -0
  77. package/dist/graphql/GraphQLGroup.d.ts +118 -0
  78. package/dist/graphql/GraphQLGroup.d.ts.map +1 -0
  79. package/dist/graphql/GraphQLGroup.js +109 -0
  80. package/dist/graphql/GraphQLGroup.js.map +1 -0
  81. package/dist/graphql/GraphQLMiddleware.d.ts +249 -0
  82. package/dist/graphql/GraphQLMiddleware.d.ts.map +1 -0
  83. package/dist/graphql/GraphQLMiddleware.js +130 -0
  84. package/dist/graphql/GraphQLMiddleware.js.map +1 -0
  85. package/dist/graphql/GraphQLProtocol.d.ts +731 -0
  86. package/dist/graphql/GraphQLProtocol.d.ts.map +1 -0
  87. package/dist/graphql/GraphQLProtocol.js +719 -0
  88. package/dist/graphql/GraphQLProtocol.js.map +1 -0
  89. package/dist/graphql/GraphQLResolver.d.ts +453 -0
  90. package/dist/graphql/GraphQLResolver.d.ts.map +1 -0
  91. package/dist/graphql/GraphQLResolver.js +552 -0
  92. package/dist/graphql/GraphQLResolver.js.map +1 -0
  93. package/dist/graphql/index.d.ts +40 -0
  94. package/dist/graphql/index.d.ts.map +1 -0
  95. package/dist/graphql/index.js +41 -0
  96. package/dist/graphql/index.js.map +1 -0
  97. package/dist/http/HttpClient.d.ts +15 -0
  98. package/dist/http/HttpClient.d.ts.map +1 -1
  99. package/dist/http/HttpClient.js +24 -10
  100. package/dist/http/HttpClient.js.map +1 -1
  101. package/dist/http/HttpEffect.d.ts.map +1 -1
  102. package/dist/http/HttpEffect.js +14 -7
  103. package/dist/http/HttpEffect.js.map +1 -1
  104. package/dist/http/HttpMiddleware.d.ts.map +1 -1
  105. package/dist/http/HttpMiddleware.js +31 -32
  106. package/dist/http/HttpMiddleware.js.map +1 -1
  107. package/dist/http/HttpRouter.d.ts +35 -0
  108. package/dist/http/HttpRouter.d.ts.map +1 -1
  109. package/dist/http/HttpRouter.js +35 -0
  110. package/dist/http/HttpRouter.js.map +1 -1
  111. package/dist/http/HttpServerResponse.d.ts +8 -6
  112. package/dist/http/HttpServerResponse.d.ts.map +1 -1
  113. package/dist/http/HttpServerResponse.js +27 -16
  114. package/dist/http/HttpServerResponse.js.map +1 -1
  115. package/dist/http/Multipart.d.ts.map +1 -1
  116. package/dist/http/Multipart.js +15 -1
  117. package/dist/http/Multipart.js.map +1 -1
  118. package/dist/http-api/HttpApiScalar.d.ts +5 -0
  119. package/dist/http-api/HttpApiScalar.d.ts.map +1 -1
  120. package/dist/http-api/HttpApiScalar.js.map +1 -1
  121. package/dist/internal/dateTime.js +40 -35
  122. package/dist/internal/dateTime.js.map +1 -1
  123. package/dist/internal/effect.js +8 -3
  124. package/dist/internal/effect.js.map +1 -1
  125. package/dist/internal/graphql.d.ts +2 -0
  126. package/dist/internal/graphql.d.ts.map +1 -0
  127. package/dist/internal/graphql.js +195 -0
  128. package/dist/internal/graphql.js.map +1 -0
  129. package/dist/internal/graphqlHeaders.d.ts +4 -0
  130. package/dist/internal/graphqlHeaders.d.ts.map +1 -0
  131. package/dist/internal/graphqlHeaders.js +11 -0
  132. package/dist/internal/graphqlHeaders.js.map +1 -0
  133. package/dist/internal/request.js +20 -1
  134. package/dist/internal/request.js.map +1 -1
  135. package/dist/internal/schema/toCodeDocument.js +4 -1
  136. package/dist/internal/schema/toCodeDocument.js.map +1 -1
  137. package/dist/internal/schema/toJsonSchemaDocument.js +29 -5
  138. package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
  139. package/dist/internal/version.js +1 -1
  140. package/dist/net/Host.d.ts +49 -0
  141. package/dist/net/Host.d.ts.map +1 -1
  142. package/dist/net/Host.js +55 -0
  143. package/dist/net/Host.js.map +1 -1
  144. package/dist/net/NetAddress.d.ts +8 -0
  145. package/dist/net/NetAddress.d.ts.map +1 -1
  146. package/dist/net/NetAddress.js +8 -0
  147. package/dist/net/NetAddress.js.map +1 -1
  148. package/dist/rpc/RpcServer.d.ts.map +1 -1
  149. package/dist/rpc/RpcServer.js +36 -9
  150. package/dist/rpc/RpcServer.js.map +1 -1
  151. package/dist/socket/Socket.d.ts +6 -0
  152. package/dist/socket/Socket.d.ts.map +1 -1
  153. package/dist/socket/Socket.js.map +1 -1
  154. package/dist/workflow/DurableDeferred.d.ts.map +1 -1
  155. package/dist/workflow/DurableDeferred.js +32 -3
  156. package/dist/workflow/DurableDeferred.js.map +1 -1
  157. package/dist/workflow/WorkflowEngine.d.ts +24 -2
  158. package/dist/workflow/WorkflowEngine.d.ts.map +1 -1
  159. package/dist/workflow/WorkflowEngine.js +11 -2
  160. package/dist/workflow/WorkflowEngine.js.map +1 -1
  161. package/package.json +6 -3
  162. package/src/Context.ts +9 -0
  163. package/src/RequestResolver.ts +4 -10
  164. package/src/Scheduler.ts +9 -0
  165. package/src/Schema.ts +8 -0
  166. package/src/SchemaGetter.ts +47 -35
  167. package/src/Sink.ts +45 -18
  168. package/src/Stream.ts +33 -4
  169. package/src/Utils.ts +8 -5
  170. package/src/ai/AnthropicStructuredOutput.ts +2 -2
  171. package/src/ai/Chat.ts +2 -2
  172. package/src/ai/LanguageModel.ts +96 -24
  173. package/src/ai/McpServer.ts +244 -90
  174. package/src/ai/Prompt.ts +24 -10
  175. package/src/ai/Response.ts +6 -3
  176. package/src/cluster/ClusterWorkflowEngine.ts +51 -12
  177. package/src/cluster/Sharding.ts +12 -9
  178. package/src/encoding/Sse.ts +69 -79
  179. package/src/graphql/GraphQL.ts +494 -0
  180. package/src/graphql/GraphQLClient.ts +912 -0
  181. package/src/graphql/GraphQLClientError.ts +542 -0
  182. package/src/graphql/GraphQLGroup.ts +167 -0
  183. package/src/graphql/GraphQLMiddleware.ts +253 -0
  184. package/src/graphql/GraphQLProtocol.ts +1286 -0
  185. package/src/graphql/GraphQLResolver.ts +1010 -0
  186. package/src/graphql/index.ts +48 -0
  187. package/src/http/HttpClient.ts +54 -10
  188. package/src/http/HttpEffect.ts +11 -5
  189. package/src/http/HttpMiddleware.ts +33 -34
  190. package/src/http/HttpRouter.ts +35 -0
  191. package/src/http/HttpServerResponse.ts +28 -16
  192. package/src/http/Multipart.ts +17 -1
  193. package/src/http-api/HttpApiScalar.ts +5 -0
  194. package/src/internal/dateTime.ts +13 -10
  195. package/src/internal/effect.ts +8 -3
  196. package/src/internal/graphql.ts +263 -0
  197. package/src/internal/graphqlHeaders.ts +11 -0
  198. package/src/internal/request.ts +31 -3
  199. package/src/internal/schema/toCodeDocument.ts +7 -1
  200. package/src/internal/schema/toJsonSchemaDocument.ts +34 -2
  201. package/src/internal/version.ts +1 -1
  202. package/src/net/Host.ts +72 -0
  203. package/src/net/NetAddress.ts +9 -0
  204. package/src/rpc/RpcServer.ts +55 -15
  205. package/src/socket/Socket.ts +6 -0
  206. package/src/workflow/DurableDeferred.ts +43 -5
  207. package/src/workflow/WorkflowEngine.ts +48 -4
@@ -0,0 +1,253 @@
1
+ /**
2
+ * GraphQL-level middleware provided as `Context.Service` implementations.
3
+ * Middleware can rewrite requests and inspect raw results, including response
4
+ * extensions and HTTP headers. Provide implementations with `Layer.succeed`
5
+ * or `Layer.effect`.
6
+ *
7
+ * @stability experimental
8
+ * @since 4.0.0
9
+ */
10
+ import * as Context from "../Context.ts"
11
+ import * as Effect from "../Effect.ts"
12
+ import * as Stream from "../Stream.ts"
13
+ import type * as Types from "../Types.ts"
14
+ import type * as GraphQL from "./GraphQL.ts"
15
+ import type { GraphQLClientError } from "./GraphQLClientError.ts"
16
+ import type { ExecutionResult, GraphQLRequest } from "./GraphQLProtocol.ts"
17
+
18
+ const TypeId = "~effect/graphql/GraphQLMiddleware"
19
+
20
+ /**
21
+ * Middleware handlers for queries, mutations and subscriptions. Both
22
+ * `execute` and `subscribe` are required.
23
+ *
24
+ * **Details**
25
+ *
26
+ * `execute` runs once per query or mutation. `subscribe` runs once per
27
+ * subscription attempt (the client re-runs the whole chain when it retries a
28
+ * subscription) and can map or tap the event stream.
29
+ *
30
+ * Both receive the operation being run, the request so far, and `next`, which
31
+ * runs the rest of the chain with the given request and returns the raw
32
+ * `ExecutionResult` (or, for `subscribe`, the stream of them). Its `status`
33
+ * and `headers` are the HTTP status and response headers the transport
34
+ * reported, if any; a middleware may rewrite them, and a failed call's
35
+ * `ResponseError` carries the final values. Request and response headers
36
+ * are `Headers.Headers` values; use `Headers.set` to rewrite them.
37
+ *
38
+ * `next` fails with `GraphQLClientError`, or with the error of a middleware
39
+ * further in, which is typed as `Types.unhandled`, as in `RpcMiddleware`.
40
+ * Narrow it, for example with `Effect.catchTag("GraphQLClientError", ...)`,
41
+ * before reading `reason`.
42
+ *
43
+ * Use {@link mapRequest} when the middleware only needs to transform the
44
+ * request.
45
+ *
46
+ * **Example** (Reading a rate-limit header)
47
+ *
48
+ * ```ts import.meta.vitest
49
+ * import { Effect } from "effect"
50
+ * import { GraphQLMiddleware } from "effect/graphql"
51
+ * import { Headers } from "effect/http"
52
+ *
53
+ * const rateLimit: GraphQLMiddleware.Implementation = {
54
+ * execute: ({ next, request }) =>
55
+ * Effect.tap(next(request), (result) =>
56
+ * Effect.log(result.headers === undefined ? undefined : Headers.get(result.headers, "x-ratelimit-remaining"))
57
+ * ),
58
+ * subscribe: ({ next, request }) => next(request)
59
+ * }
60
+ * ```
61
+ *
62
+ * @stability experimental
63
+ * @category models
64
+ * @since 4.0.0
65
+ */
66
+ export interface Implementation<E = never, R = never> {
67
+ readonly execute: (options: {
68
+ readonly operation: GraphQL.Any
69
+ readonly request: GraphQLRequest
70
+ readonly next: (request: GraphQLRequest) => Effect.Effect<ExecutionResult, GraphQLClientError | Types.unhandled>
71
+ }) => Effect.Effect<ExecutionResult, GraphQLClientError | Types.unhandled | E, R>
72
+ readonly subscribe: (options: {
73
+ readonly operation: GraphQL.Any
74
+ readonly request: GraphQLRequest
75
+ readonly next: (request: GraphQLRequest) => Stream.Stream<ExecutionResult, GraphQLClientError | Types.unhandled>
76
+ }) => Stream.Stream<ExecutionResult, GraphQLClientError | Types.unhandled | E, R>
77
+ }
78
+
79
+ /**
80
+ * The class returned by {@link Service}: a `Context.Service` for an
81
+ * {@link Implementation}, carrying the declared `error` and `requires` types.
82
+ *
83
+ * @stability experimental
84
+ * @category services
85
+ * @since 4.0.0
86
+ */
87
+ export interface ServiceClass<Self, Key extends string, E, R> extends Context.Service<Self, Implementation<E, R>> {
88
+ new(_: never): Context.ServiceClass.Shape<Key, Implementation<E, R>> & {
89
+ readonly [TypeId]: { readonly error: E; readonly requires: R }
90
+ }
91
+ readonly [TypeId]: { readonly error: E; readonly requires: R }
92
+ readonly key: Key
93
+ }
94
+
95
+ /**
96
+ * Any middleware service class, with its error and requirement types erased.
97
+ *
98
+ * @stability experimental
99
+ * @category utility types
100
+ * @since 4.0.0
101
+ */
102
+ export interface AnyService extends Context.Service<any, Implementation<any, any>> {
103
+ readonly [TypeId]: { readonly error: any; readonly requires: any }
104
+ }
105
+
106
+ /**
107
+ * Extracts the service identifier of a middleware, which is what
108
+ * `GraphQLClient.make` requires.
109
+ *
110
+ * @stability experimental
111
+ * @category utility types
112
+ * @since 4.0.0
113
+ */
114
+ export type Identifier<M> = M extends Context.Service<infer I, any> ? I : never
115
+
116
+ /**
117
+ * Extracts the error type a middleware declared.
118
+ *
119
+ * @stability experimental
120
+ * @category utility types
121
+ * @since 4.0.0
122
+ */
123
+ export type Error<M> = M extends { readonly [TypeId]: { readonly error: infer E } } ? E : never
124
+
125
+ /**
126
+ * Extracts the services a middleware declared it requires per call.
127
+ *
128
+ * @stability experimental
129
+ * @category utility types
130
+ * @since 4.0.0
131
+ */
132
+ export type Requires<M> = M extends { readonly [TypeId]: { readonly requires: infer R } } ? R : never
133
+
134
+ /**
135
+ * Declares a middleware tag. `requires` are services the implementation needs
136
+ * on every call, and `error` is what it can fail with; both show up on the
137
+ * requirements and error type of every client method the middleware is
138
+ * attached to.
139
+ *
140
+ * **Example** (An auth middleware that needs the current user)
141
+ *
142
+ * ```ts import.meta.vitest
143
+ * import { Context, Effect, Layer, Schema, Stream } from "effect"
144
+ * import { GraphQL, GraphQLClient, GraphQLGroup, GraphQLMiddleware, GraphQLProtocol } from "effect/graphql"
145
+ * import { Headers } from "effect/http"
146
+ *
147
+ * class CurrentUser extends Context.Service<CurrentUser, { readonly token: string }>()("CurrentUser") {}
148
+ * class TokenExpired extends Schema.TaggedError<TokenExpired>()("TokenExpired", {}) {}
149
+ *
150
+ * class Auth extends GraphQLMiddleware.Service<Auth, {
151
+ * requires: CurrentUser
152
+ * error: TokenExpired
153
+ * }>()("app/Auth") {}
154
+ *
155
+ * const AuthLive = Layer.succeed(
156
+ * Auth,
157
+ * GraphQLMiddleware.mapRequest(Effect.fnUntraced(function*(request) {
158
+ * const user = yield* CurrentUser
159
+ * if (user.token === "") return yield* new TokenExpired()
160
+ * return { ...request, headers: Headers.set(request.headers, "authorization", `Bearer ${user.token}`) }
161
+ * }))
162
+ * )
163
+ *
164
+ * const Viewer = GraphQL.query("Viewer", {
165
+ * document: "query Viewer{viewer{login}}",
166
+ * result: Schema.Struct({ viewer: Schema.Struct({ login: Schema.String }) })
167
+ * })
168
+ *
169
+ * const Scripted = Layer.succeed(GraphQLProtocol.GraphQLProtocol, {
170
+ * execute: (request) => Effect.succeed({ body: { data: { viewer: { login: request.headers.authorization } } } }),
171
+ * subscribe: () => Stream.empty
172
+ * })
173
+ *
174
+ * const program = Effect.gen(function*() {
175
+ * const client = yield* GraphQLClient.make(GraphQLGroup.make(Viewer).middleware(Auth))
176
+ * // CurrentUser is required by the method because Auth is attached
177
+ * return yield* client.Viewer().pipe(Effect.provideService(CurrentUser, { token: "abc" }))
178
+ * })
179
+ *
180
+ * await Effect.runPromise(program.pipe(Effect.provide([Scripted, AuthLive]))) // => { viewer: { login: "Bearer abc" } }
181
+ * ```
182
+ *
183
+ * @stability experimental
184
+ * @category constructors
185
+ * @since 4.0.0
186
+ */
187
+ export const Service = <
188
+ Self,
189
+ Config extends {
190
+ readonly requires?: any
191
+ readonly error?: any
192
+ } = {}
193
+ >(): <const Key extends string>(key: Key) => ServiceClass<
194
+ Self,
195
+ Key,
196
+ Config extends { readonly error: infer E } ? E : never,
197
+ Config extends { readonly requires: infer R } ? R : never
198
+ > =>
199
+ (key: string) => {
200
+ function ServiceClass() {}
201
+ Object.setPrototypeOf(ServiceClass, Object.getPrototypeOf(Context.Service<Self, any>(key)))
202
+ return Object.assign(ServiceClass, { key, [TypeId]: TypeId }) as any
203
+ }
204
+
205
+ /**
206
+ * Builds an {@link Implementation} that transforms requests for queries,
207
+ * mutations and subscriptions. Use it to set headers, auth or extensions.
208
+ *
209
+ * **Example** (Adding a header to every request)
210
+ *
211
+ * ```ts import.meta.vitest
212
+ * import { Effect, Layer, Schema, Stream } from "effect"
213
+ * import { GraphQL, GraphQLClient, GraphQLGroup, GraphQLMiddleware, GraphQLProtocol } from "effect/graphql"
214
+ * import { Headers } from "effect/http"
215
+ *
216
+ * class RequestId extends GraphQLMiddleware.Service<RequestId>()("app/RequestId") {}
217
+ *
218
+ * const RequestIdLive = Layer.succeed(
219
+ * RequestId,
220
+ * GraphQLMiddleware.mapRequest((request) =>
221
+ * Effect.succeed({ ...request, headers: Headers.set(request.headers, "x-request-id", "abc") })
222
+ * )
223
+ * )
224
+ *
225
+ * const Viewer = GraphQL.query("Viewer", {
226
+ * document: "query Viewer{viewer{login}}",
227
+ * result: Schema.Struct({ viewer: Schema.Struct({ login: Schema.String }) })
228
+ * })
229
+ *
230
+ * const Scripted = Layer.succeed(GraphQLProtocol.GraphQLProtocol, {
231
+ * execute: (request) =>
232
+ * Effect.succeed({ body: { data: { viewer: { login: request.headers["x-request-id"] } } } }),
233
+ * subscribe: () => Stream.empty
234
+ * })
235
+ *
236
+ * const program = Effect.gen(function*() {
237
+ * const client = yield* GraphQLClient.make(GraphQLGroup.make(Viewer).middleware(RequestId))
238
+ * return yield* client.Viewer()
239
+ * })
240
+ *
241
+ * await Effect.runPromise(program.pipe(Effect.provide([Scripted, RequestIdLive]))) // => { viewer: { login: "abc" } }
242
+ * ```
243
+ *
244
+ * @stability experimental
245
+ * @category constructors
246
+ * @since 4.0.0
247
+ */
248
+ export const mapRequest = <E = never, R = never>(
249
+ f: (request: GraphQLRequest, operation: GraphQL.Any) => Effect.Effect<GraphQLRequest, E, R>
250
+ ): Implementation<E, R> => ({
251
+ execute: ({ next, operation, request }) => Effect.flatMap(f(request, operation), next),
252
+ subscribe: ({ next, operation, request }) => Stream.unwrap(Effect.map(f(request, operation), next))
253
+ })