class GraphqlService
implements IGraphqlService

GraphQL service implementation.

Constructors

GraphqlService(
runtime: GraphqlRuntime,
options: { endpoint: string; documentCacheSize: number; validationRules?: unknown[]; maxDepth: number; maxNodes?: number; introspection: boolean; maskInternalErrors: boolean; formatError?: (error: unknown) => unknown; buildContext?: (input: GraphqlContextInput) => unknown | Promise<unknown>; rootValue?: unknown; logger?: GraphqlLogger; serviceRegistry: IServiceRegistry; }
)

Properties

readonly
cachedDocumentCount: number

Report the number of cached documents.

readonly
endpoint: string

The endpoint path where GraphQL is served.

Methods

clearCache(): void

Clear the document cache.

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

Execute a GraphQL request.

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 { GraphqlService } from "graphql-plugin/src/index.ts";