interface GraphqlModuleLike

The structural shape of a graphql@16 module — the external boundary (M70i X6-3).

This is deliberately looser than the internal GraphqlRuntime: it references only the public GraphqlSchemaLike and unknown, so a genuine npm:graphql module is assignable to it without a castadaptGraphqlModule(graphql) type-checks, which is the X6-3 gate. The precise structural types live on GraphqlRuntime (internal); the loader bridges the two with a per-member cast, so nothing here is read at runtime.

Declared with method syntax, not indexed access into GraphqlRuntime: an indexed access like validate: GraphqlRuntime['validate'] produces a property of function type, which strictFunctionTypes checks contravariantly, so the real module's concrete GraphQLSchema/DocumentNode parameters would reject the facade's structural ones. Method syntax is checked bivariantly, which is what lets a genuine graphql module assign here.

Properties

readonly
GraphQLError: new (
message: string,
options?: undefined
) => unknown

The graphql GraphQLError constructor. options is undefined (not a modeled object) so the real typeof GraphQLError — whose constructor is new (message: string, options?: GraphQLErrorOptions) — stays assignable: contravariance requires the facade's options to be assignable to GraphQLErrorOptions | undefined, and undefined is.

The no-schema-introspection validation rule.

readonly
specifiedRules: readonly unknown[]

The specified (built-in) validation rules.

Methods

parse(source: unknown): unknown

Parse a query/mutation/subscription document.

validate(
document: unknown,
rules?: readonly unknown[]
): unknown

Validate a document against a schema; returns validation errors.

execute(args: { schema: GraphqlSchemaLike; document: unknown; rootValue?: unknown; contextValue?: unknown; variableValues?: unknown; operationName?: string | null | undefined; }): unknown

Execute a document; the result carries data and/or errors.

subscribe(args: { schema: GraphqlSchemaLike; document: unknown; rootValue?: unknown; contextValue?: unknown; variableValues?: unknown; operationName?: string | null | undefined; }): unknown

Subscribe to a document; the result is an async iterable or a single error result.

Build a schema from SDL source.

Validate a schema; returns schema errors.

getOperationAST(
document: unknown,
operationName?: string | null | undefined
): unknown

Extract the operation definition for operationName from a document.

Usage

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