MCPcopy Create free account
hub / github.com/Effect-TS/effect / execute

Function execute

packages/effect/src/graphql/GraphQLClient.ts:385–406  ·  view source on GitHub ↗
(
    index: number,
    request: GraphQLRequest,
    forcePost: boolean,
    resolvedUrl: internalGraphQL.ResolvedUrl
  )

Source from the content-addressed store, hash-verified

383 // restates its type here. Force POST and the resolved URL apply only at the
384 // transport boundary.
385 const execute = (
386 index: number,
387 request: GraphQLRequest,
388 forcePost: boolean,
389 resolvedUrl: internalGraphQL.ResolvedUrl
390 ): Effect.Effect<ExecutionResult, GraphQL.Error<Op>, GraphQLMiddleware.Requires<GraphQL.Middleware<Op>>> =>
391 index === chain.length
392 ? protocol.execute(request).pipe(
393 forcePost ? Effect.provideService(internalGraphQL.ForcePost, true) : identity,
394 resolvedUrl === undefined ? identity : Effect.provideService(internalGraphQL.ResolvedUrl, resolvedUrl),
395 Effect.mapError(fail),
396 Effect.flatMap(decodeResponse)
397 )
398 : chain[index].execute({
399 operation,
400 request,
401 next: (request) =>
402 execute(index + 1, request, forcePost, resolvedUrl) as Effect.Effect<
403 ExecutionResult,
404 GraphQLClientError | Types.unhandled
405 >
406 }) as Effect.Effect<ExecutionResult, GraphQL.Error<Op>, GraphQLMiddleware.Requires<GraphQL.Middleware<Op>>>
407
408 // Hands a resolver batch's URL to the transport only, so calls made by
409 // middleware resolve their own.

Callers 2

aliasedFunction · 0.70
runFunction · 0.70

Calls 2

pipeMethod · 0.65
executeMethod · 0.45

Tested by

no test coverage detected