interface IGraphqlService
Since 0.1.0

The GraphQL service contract.

Implementations register themselves under CAPABILITIES.GRAPHQL and are responsible for parsing, validating, and executing GraphQL requests. The HTTP transport layer calls this service and handles media-type negotiation.

Properties

readonly
endpoint: string

The endpoint path where GraphQL is served.

readonly
cachedDocumentCount: number

Report the number of cached documents.

Methods

execute(
requestContext?: IRequestContext,
method?: "GET" | "POST"
): Promise<GraphqlExecutionOutcome>

Execute a GraphQL request.

Since 0.3.0
subscribe(): Promise<GraphqlSubscriptionOutcome>

Subscribe to a GraphQL operation (query, mutation, or subscription).

Accepts every operation kind and returns the matching discriminated outcome. The transports narrow on the kind field to emit conformant frames.

Usage

import { type IGraphqlService } from "graphql-plugin/src/index.ts";