diff options
| author | netop://ウィビ <paul@webb.page> | 2026-10-21 16:47:38 -0700 |
|---|---|---|
| committer | netop://ウィビ <paul@webb.page> | 2026-10-21 16:47:38 -0700 |
| commit | 389ad1349c4ff245a3466a2e361c1cd1dd11d2ba (patch) | |
| tree | 0ad0638f60ab0a77c7a095e96b472312ab39f83b /vendor | |
| parent | bbcbb02ef64d094f0f13de22ae135eeba1ff4c5d (diff) | |
| download | gq-389ad1349c4ff245a3466a2e361c1cd1dd11d2ba.tar.gz gq-389ad1349c4ff245a3466a2e361c1cd1dd11d2ba.zip | |
- inlined vendored dependencies from npm
- makes this module work in Ende
Diffstat (limited to 'vendor')
| -rw-r--r-- | vendor/deps.d.ts | 14536 | ||||
| -rw-r--r-- | vendor/deps.js | 190 | ||||
| -rw-r--r-- | vendor/deps.ts | 5 | ||||
| -rw-r--r-- | vendor/package.json | 16 | ||||
| -rw-r--r-- | vendor/tsconfig.json | 12 |
5 files changed, 14759 insertions, 0 deletions
diff --git a/vendor/deps.d.ts b/vendor/deps.d.ts new file mode 100644 index 0000000..ca493ce --- /dev/null +++ b/vendor/deps.d.ts @@ -0,0 +1,14536 @@ +// Generated by dts-bundle-generator v9.5.1 + +/** @category Version */ +/** A string containing the version of the GraphQL.js library */ +export declare const version: string; +/** An object containing the components of the GraphQL.js version string */ +export declare const versionInfo: Readonly<{ + major: number; + minor: number; + patch: number; + preReleaseTag: string | null; +}>; +/** @category Development Mode */ +/** + * Enables GraphQL.js development mode checks for this module instance. + * + * Production entry points leave development mode disabled by default. Call this + * before constructing schemas or executing requests when additional development + * diagnostics should run. + * @example + * ```ts + * import { enableDevMode, isDevModeEnabled } from 'graphql/devMode'; + * + * isDevModeEnabled(); // => false + * enableDevMode(); + * isDevModeEnabled(); // => true + * ``` + */ +export declare function enableDevMode(): void; +/** + * Returns whether GraphQL.js development mode has been enabled for this module + * instance. + * @returns True when development mode is enabled. + * @example + * ```ts + * import { enableDevMode, isDevModeEnabled } from 'graphql/devMode'; + * + * enableDevMode(); + * + * isDevModeEnabled(); // => true + * ``` + */ +export declare function isDevModeEnabled(): boolean; +type Maybe<T> = null | undefined | T; +interface ObjMap<T> { + [key: string]: T; +} +interface ReadOnlyObjMap<T> { + readonly [key: string]: T; +} +declare const NAME = "Name"; +type NAME = typeof NAME; +declare const DOCUMENT = "Document"; +type DOCUMENT = typeof DOCUMENT; +declare const OPERATION_DEFINITION = "OperationDefinition"; +type OPERATION_DEFINITION = typeof OPERATION_DEFINITION; +declare const VARIABLE_DEFINITION = "VariableDefinition"; +type VARIABLE_DEFINITION = typeof VARIABLE_DEFINITION; +declare const SELECTION_SET = "SelectionSet"; +type SELECTION_SET = typeof SELECTION_SET; +declare const FIELD = "Field"; +type FIELD = typeof FIELD; +declare const ARGUMENT = "Argument"; +type ARGUMENT = typeof ARGUMENT; +declare const FRAGMENT_ARGUMENT = "FragmentArgument"; +type FRAGMENT_ARGUMENT = typeof FRAGMENT_ARGUMENT; +declare const FRAGMENT_SPREAD = "FragmentSpread"; +type FRAGMENT_SPREAD = typeof FRAGMENT_SPREAD; +declare const INLINE_FRAGMENT = "InlineFragment"; +type INLINE_FRAGMENT = typeof INLINE_FRAGMENT; +declare const FRAGMENT_DEFINITION = "FragmentDefinition"; +type FRAGMENT_DEFINITION = typeof FRAGMENT_DEFINITION; +declare const VARIABLE = "Variable"; +type VARIABLE = typeof VARIABLE; +declare const INT = "IntValue"; +type INT = typeof INT; +declare const FLOAT = "FloatValue"; +type FLOAT = typeof FLOAT; +declare const STRING = "StringValue"; +type STRING = typeof STRING; +declare const BOOLEAN = "BooleanValue"; +type BOOLEAN = typeof BOOLEAN; +declare const NULL = "NullValue"; +type NULL = typeof NULL; +declare const ENUM = "EnumValue"; +type ENUM = typeof ENUM; +declare const LIST = "ListValue"; +type LIST = typeof LIST; +declare const OBJECT = "ObjectValue"; +type OBJECT = typeof OBJECT; +declare const OBJECT_FIELD = "ObjectField"; +type OBJECT_FIELD = typeof OBJECT_FIELD; +declare const DIRECTIVE = "Directive"; +type DIRECTIVE = typeof DIRECTIVE; +declare const NAMED_TYPE = "NamedType"; +type NAMED_TYPE = typeof NAMED_TYPE; +declare const LIST_TYPE = "ListType"; +type LIST_TYPE = typeof LIST_TYPE; +declare const NON_NULL_TYPE = "NonNullType"; +type NON_NULL_TYPE = typeof NON_NULL_TYPE; +declare const SCHEMA_DEFINITION = "SchemaDefinition"; +type SCHEMA_DEFINITION = typeof SCHEMA_DEFINITION; +declare const OPERATION_TYPE_DEFINITION = "OperationTypeDefinition"; +type OPERATION_TYPE_DEFINITION = typeof OPERATION_TYPE_DEFINITION; +declare const SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition"; +type SCALAR_TYPE_DEFINITION = typeof SCALAR_TYPE_DEFINITION; +declare const OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition"; +type OBJECT_TYPE_DEFINITION = typeof OBJECT_TYPE_DEFINITION; +declare const FIELD_DEFINITION = "FieldDefinition"; +type FIELD_DEFINITION = typeof FIELD_DEFINITION; +declare const INPUT_VALUE_DEFINITION = "InputValueDefinition"; +type INPUT_VALUE_DEFINITION = typeof INPUT_VALUE_DEFINITION; +declare const INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition"; +type INTERFACE_TYPE_DEFINITION = typeof INTERFACE_TYPE_DEFINITION; +declare const UNION_TYPE_DEFINITION = "UnionTypeDefinition"; +type UNION_TYPE_DEFINITION = typeof UNION_TYPE_DEFINITION; +declare const ENUM_TYPE_DEFINITION = "EnumTypeDefinition"; +declare const ENUM_VALUE_DEFINITION = "EnumValueDefinition"; +type ENUM_VALUE_DEFINITION = typeof ENUM_VALUE_DEFINITION; +declare const INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition"; +type INPUT_OBJECT_TYPE_DEFINITION = typeof INPUT_OBJECT_TYPE_DEFINITION; +declare const DIRECTIVE_DEFINITION = "DirectiveDefinition"; +type DIRECTIVE_DEFINITION = typeof DIRECTIVE_DEFINITION; +declare const SCHEMA_EXTENSION = "SchemaExtension"; +type SCHEMA_EXTENSION = typeof SCHEMA_EXTENSION; +declare const DIRECTIVE_EXTENSION = "DirectiveExtension"; +type DIRECTIVE_EXTENSION = typeof DIRECTIVE_EXTENSION; +declare const SCALAR_TYPE_EXTENSION = "ScalarTypeExtension"; +type SCALAR_TYPE_EXTENSION = typeof SCALAR_TYPE_EXTENSION; +declare const OBJECT_TYPE_EXTENSION = "ObjectTypeExtension"; +type OBJECT_TYPE_EXTENSION = typeof OBJECT_TYPE_EXTENSION; +declare const INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension"; +type INTERFACE_TYPE_EXTENSION = typeof INTERFACE_TYPE_EXTENSION; +declare const UNION_TYPE_EXTENSION = "UnionTypeExtension"; +type UNION_TYPE_EXTENSION = typeof UNION_TYPE_EXTENSION; +declare const ENUM_TYPE_EXTENSION = "EnumTypeExtension"; +type ENUM_TYPE_EXTENSION = typeof ENUM_TYPE_EXTENSION; +declare const INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension"; +type INPUT_OBJECT_TYPE_EXTENSION = typeof INPUT_OBJECT_TYPE_EXTENSION; +declare const TYPE_COORDINATE = "TypeCoordinate"; +type TYPE_COORDINATE = typeof TYPE_COORDINATE; +declare const MEMBER_COORDINATE = "MemberCoordinate"; +type MEMBER_COORDINATE = typeof MEMBER_COORDINATE; +declare const ARGUMENT_COORDINATE = "ArgumentCoordinate"; +type ARGUMENT_COORDINATE = typeof ARGUMENT_COORDINATE; +declare const DIRECTIVE_COORDINATE = "DirectiveCoordinate"; +type DIRECTIVE_COORDINATE = typeof DIRECTIVE_COORDINATE; +declare const DIRECTIVE_ARGUMENT_COORDINATE = "DirectiveArgumentCoordinate"; +type DIRECTIVE_ARGUMENT_COORDINATE = typeof DIRECTIVE_ARGUMENT_COORDINATE; +type KindTypeMap = typeof Kind; +interface Location { + line: number; + column: number; +} +/** + * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are + * optional, but they are useful for clients who store GraphQL documents in source files. + * For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might + * be useful for `name` to be `"Foo.graphql"` and location to be `{ line: 40, column: 1 }`. + * The `line` and `column` properties in `locationOffset` are 1-indexed. + */ +export declare class Source { + /** The GraphQL source text. */ + body: string; + /** Name used in diagnostics for this source, such as a file path or request name. */ + name: string; + /** One-indexed line and column where this source begins. */ + locationOffset: Location; + /** + * Creates a Source instance. + * @param body - The GraphQL source text. + * @param name - Name used in diagnostics for this source. + * @param locationOffset - One-indexed line and column where this source begins. + * @example + * ```ts + * import { Source } from 'graphql/language'; + * + * const source = new Source('type Query { greeting: String }', 'schema.graphql', { + * line: 10, + * column: 1, + * }); + * + * source.body; // => 'type Query { greeting: String }' + * source.name; // => 'schema.graphql' + * source.locationOffset; // => { line: 10, column: 1 } + * ``` + */ + constructor(body: string, name?: string, locationOffset?: Location); + /** + * Returns the value used by `Object.prototype.toString`. + * @returns The built-in string tag for this object. + */ + get [Symbol.toStringTag](): string; +} +/** @category Lexing */ +/** + * An exported enum describing the different kinds of tokens that the + * lexer emits. + */ +export declare const TokenKind: { + readonly SOF: "<SOF>"; + readonly EOF: "<EOF>"; + readonly BANG: "!"; + readonly DOLLAR: "$"; + readonly AMP: "&"; + readonly PAREN_L: "("; + readonly PAREN_R: ")"; + readonly DOT: "."; + readonly SPREAD: "..."; + readonly COLON: ":"; + readonly EQUALS: "="; + readonly AT: "@"; + readonly BRACKET_L: "["; + readonly BRACKET_R: "]"; + readonly BRACE_L: "{"; + readonly PIPE: "|"; + readonly BRACE_R: "}"; + readonly NAME: "Name"; + readonly INT: "Int"; + readonly FLOAT: "Float"; + readonly STRING: "String"; + readonly BLOCK_STRING: "BlockString"; + readonly COMMENT: "Comment"; +}; +/** + * An exported enum describing the different kinds of tokens that the + * lexer emits. + */ +export type TokenKind = (typeof TokenKind)[keyof typeof TokenKind]; +/** + * Contains a range of UTF-8 character offsets and token references that + * identify the region of the source from which the AST derived. + */ +declare class Location$1 { + /** The character offset at which this Node begins. */ + readonly start: number; + /** The character offset at which this Node ends. */ + readonly end: number; + /** The Token at which this Node begins. */ + readonly startToken: Token; + /** The Token at which this Node ends. */ + readonly endToken: Token; + /** The Source document the AST represents. */ + readonly source: Source; + /** + * Creates a Location instance. + * @param startToken - The start token. + * @param endToken - The end token. + * @param source - Source document used to derive error locations. + * @example + * ```ts + * import { Location, Source, Token, TokenKind } from 'graphql/language'; + * + * const source = new Source('{ hello }'); + * const startToken = new Token(TokenKind.BRACE_L, 0, 1, 1, 1); + * const endToken = new Token(TokenKind.BRACE_R, 8, 9, 1, 9); + * const location = new Location(startToken, endToken, source); + * + * location.start; // => 0 + * location.end; // => 9 + * location.source.body; // => '{ hello }' + * ``` + */ + constructor(startToken: Token, endToken: Token, source: Source); + /** + * Returns the value used by `Object.prototype.toString`. + * @returns The built-in string tag for this object. + */ + get [Symbol.toStringTag](): string; + /** + * Returns a JSON representation of this location. + * @returns The JSON-serializable representation. + * @example + * ```ts + * import { parse } from 'graphql/language'; + * + * const document = parse('{ hello }'); + * const location = document.loc?.toJSON(); + * + * location; // => { start: 0, end: 9 } + * ``` + */ + toJSON(): { + start: number; + end: number; + }; +} +/** + * Represents a range of characters represented by a lexical token + * within a Source. + */ +export declare class Token { + /** The kind of Token. */ + readonly kind: TokenKind; + /** The character offset at which this Node begins. */ + readonly start: number; + /** The character offset at which this Node ends. */ + readonly end: number; + /** The 1-indexed line number on which this Token appears. */ + readonly line: number; + /** The 1-indexed column number at which this Token begins. */ + readonly column: number; + /** + * For non-punctuation tokens, represents the interpreted value of the token. + * + * Note: is undefined for punctuation tokens, but typed as string for + * convenience in the parser. + */ + readonly value: string; + /** + * Tokens exist as nodes in a double-linked-list amongst all tokens + * including ignored tokens. <SOF> is always the first node and <EOF> + * the last. + */ + readonly prev: Token | null; + /** Next token in the token stream, including ignored tokens. */ + readonly next: Token | null; + /** + * Creates a Token instance. + * @param kind - Token kind produced by lexical analysis. + * @param start - Character offset where this token begins. + * @param end - Character offset where this token ends. + * @param line - One-indexed line number where this token begins. + * @param column - One-indexed column number where this token begins. + * @param value - Interpreted value for non-punctuation tokens. + * @example + * ```ts + * import { Token, TokenKind } from 'graphql/language'; + * + * const token = new Token(TokenKind.NAME, 2, 7, 1, 3, 'hello'); + * + * token.kind; // => TokenKind.NAME + * token.value; // => 'hello' + * token.toJSON(); // => { kind: 'Name', value: 'hello', line: 1, column: 3 } + * ``` + */ + constructor(kind: TokenKind, start: number, end: number, line: number, column: number, value?: string); + /** + * Returns the value used by `Object.prototype.toString`. + * @returns The built-in string tag for this object. + */ + get [Symbol.toStringTag](): string; + /** + * Returns a JSON representation of this token. + * @returns The JSON-serializable representation. + * @example + * ```ts + * import { Lexer, Source } from 'graphql/language'; + * + * const lexer = new Lexer(new Source('{ hello }')); + * const token = lexer.advance().toJSON(); + * + * token; // => { kind: '{', value: undefined, line: 1, column: 1 } + * ``` + */ + toJSON(): { + kind: TokenKind; + value?: string; + line: number; + column: number; + }; +} +/** The list of all possible AST node types. */ +export type ASTNode = NameNode | DocumentNode | OperationDefinitionNode | VariableDefinitionNode | VariableNode | SelectionSetNode | FieldNode | ArgumentNode | FragmentArgumentNode | FragmentSpreadNode | InlineFragmentNode | FragmentDefinitionNode | IntValueNode | FloatValueNode | StringValueNode | BooleanValueNode | NullValueNode | EnumValueNode | ListValueNode | ObjectValueNode | ObjectFieldNode | DirectiveNode | NamedTypeNode | ListTypeNode | NonNullTypeNode | SchemaDefinitionNode | OperationTypeDefinitionNode | ScalarTypeDefinitionNode | ObjectTypeDefinitionNode | FieldDefinitionNode | InputValueDefinitionNode | InterfaceTypeDefinitionNode | UnionTypeDefinitionNode | EnumTypeDefinitionNode | EnumValueDefinitionNode | InputObjectTypeDefinitionNode | DirectiveDefinitionNode | SchemaExtensionNode | ScalarTypeExtensionNode | ObjectTypeExtensionNode | InterfaceTypeExtensionNode | UnionTypeExtensionNode | EnumTypeExtensionNode | InputObjectTypeExtensionNode | DirectiveExtensionNode | TypeCoordinateNode | MemberCoordinateNode | ArgumentCoordinateNode | DirectiveCoordinateNode | DirectiveArgumentCoordinateNode; +/** Utility type listing all nodes indexed by their kind. */ +export type ASTKindToNode = { + [NodeT in ASTNode as NodeT["kind"]]: NodeT; +}; +/** An identifier in a GraphQL document. */ +export interface NameNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["NAME"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Parsed value represented by this node. */ + readonly value: string; +} +/** The root AST node for a parsed GraphQL document. */ +export interface DocumentNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["DOCUMENT"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Top-level executable and type-system definitions in this document. */ + readonly definitions: ReadonlyArray<DefinitionNode>; + /** The number of lexical tokens parsed for this document, if token counting was enabled. */ + readonly tokenCount?: number | undefined; +} +/** Any top-level definition that may appear in a GraphQL document. */ +export type DefinitionNode = ExecutableDefinitionNode | TypeSystemDefinitionNode | TypeSystemExtensionNode; +/** Any executable definition that may appear in an operation document. */ +export type ExecutableDefinitionNode = OperationDefinitionNode | FragmentDefinitionNode; +/** A query, mutation, or subscription operation definition. */ +export interface OperationDefinitionNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["OPERATION_DEFINITION"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** The optional GraphQL description associated with this definition. */ + readonly description?: StringValueNode | undefined; + /** The operation selected for execution. */ + readonly operation: OperationTypeNode; + /** Name node identifying this AST node. */ + readonly name?: NameNode | undefined; + /** Variable definitions declared by this operation or fragment. */ + readonly variableDefinitions?: ReadonlyArray<VariableDefinitionNode> | undefined; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<DirectiveNode> | undefined; + /** Selections made by this operation, field, or fragment. */ + readonly selectionSet: SelectionSetNode; +} +/** + * A narrowed OperationDefinitionNode for subscription operations. + * Subscription operations go through a distinct execution pipeline + * (source event stream + per-event execution), so narrowing the operation + * type allows functions in that pipeline to accept only valid input. + */ +export interface SubscriptionOperationDefinitionNode extends OperationDefinitionNode { + /** Subscription operation kind for this definition. */ + readonly operation: (typeof OperationTypeNode)["SUBSCRIPTION"]; +} +/** + * The operation types supported by GraphQL executable definitions. + * @category Kinds + */ +export declare const OperationTypeNode: { + readonly QUERY: "query"; + readonly MUTATION: "mutation"; + readonly SUBSCRIPTION: "subscription"; +}; +/** + * The operation types supported by GraphQL executable definitions. + * @category Kinds + */ +export type OperationTypeNode = (typeof OperationTypeNode)[keyof typeof OperationTypeNode]; +/** A variable declaration in an operation or experimental fragment definition. */ +export interface VariableDefinitionNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["VARIABLE_DEFINITION"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** The optional GraphQL description associated with this definition. */ + readonly description?: StringValueNode | undefined; + /** The variable being defined or referenced. */ + readonly variable: VariableNode; + /** The GraphQL type reference or runtime type for this element. */ + readonly type: TypeNode; + /** Default value used when no explicit value is supplied. */ + readonly defaultValue?: ConstValueNode | undefined; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<ConstDirectiveNode> | undefined; +} +/** A variable reference, such as `$id`. */ +export interface VariableNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["VARIABLE"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; +} +/** A set of fields and fragments selected from an object, interface, or union. */ +export interface SelectionSetNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + kind: KindTypeMap["SELECTION_SET"]; + /** The source location for this AST node, if location tracking was enabled. */ + loc?: Location$1 | undefined; + /** Fields and fragments contained in this selection set. */ + selections: ReadonlyArray<SelectionNode>; +} +/** Any selection that may appear inside a selection set. */ +export type SelectionNode = FieldNode | FragmentSpreadNode | InlineFragmentNode; +/** A field selected in an executable GraphQL document. */ +export interface FieldNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["FIELD"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** The response-key alias for this field, if one was supplied. */ + readonly alias?: NameNode | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Arguments supplied to this field, directive, or coordinate. */ + readonly arguments?: ReadonlyArray<ArgumentNode> | undefined; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<DirectiveNode> | undefined; + /** Selections made by this operation, field, or fragment. */ + readonly selectionSet?: SelectionSetNode | undefined; +} +/** An argument supplied to a field or directive. */ +export interface ArgumentNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["ARGUMENT"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Parsed value represented by this node. */ + readonly value: ValueNode; +} +/** An argument node whose value is guaranteed to be constant. */ +export interface ConstArgumentNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["ARGUMENT"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Parsed value represented by this node. */ + readonly value: ConstValueNode; +} +/** Variable definition declared by a fragment argument. */ +export interface FragmentArgumentNode { + /** AST node kind for a fragment argument. */ + readonly kind: KindTypeMap["FRAGMENT_ARGUMENT"]; + /** Source location for this fragment argument. */ + readonly loc?: Location$1 | undefined; + /** Variable name declared by this fragment argument. */ + readonly name: NameNode; + /** Default value literal for this fragment argument, if provided. */ + readonly value: ValueNode; +} +/** A named fragment spread, such as `...userFields`. */ +export interface FragmentSpreadNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["FRAGMENT_SPREAD"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Argument values supplied to the referenced fragment. */ + readonly arguments?: ReadonlyArray<FragmentArgumentNode> | undefined; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<DirectiveNode> | undefined; +} +/** An inline fragment spread with an optional type condition. */ +export interface InlineFragmentNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["INLINE_FRAGMENT"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** The type condition that limits where this fragment applies. */ + readonly typeCondition?: NamedTypeNode | undefined; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<DirectiveNode> | undefined; + /** Selections made by this operation, field, or fragment. */ + readonly selectionSet: SelectionSetNode; +} +/** A reusable fragment definition declared in an executable document. */ +export interface FragmentDefinitionNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["FRAGMENT_DEFINITION"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** The optional GraphQL description associated with this definition. */ + readonly description?: StringValueNode | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Experimental variable definitions declared by this fragment definition. */ + readonly variableDefinitions?: ReadonlyArray<VariableDefinitionNode> | undefined; + /** The type condition that limits where this fragment applies. */ + readonly typeCondition: NamedTypeNode; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<DirectiveNode> | undefined; + /** Selections made by this operation, field, or fragment. */ + readonly selectionSet: SelectionSetNode; +} +/** Any value literal that may appear in an executable GraphQL document. */ +export type ValueNode = VariableNode | IntValueNode | FloatValueNode | StringValueNode | BooleanValueNode | NullValueNode | EnumValueNode | ListValueNode | ObjectValueNode; +/** Any value literal that is guaranteed not to contain a variable reference. */ +export type ConstValueNode = IntValueNode | FloatValueNode | StringValueNode | BooleanValueNode | NullValueNode | EnumValueNode | ConstListValueNode | ConstObjectValueNode; +/** An integer value literal. */ +export interface IntValueNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["INT"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Parsed value represented by this node. */ + readonly value: string; +} +/** A floating-point value literal. */ +export interface FloatValueNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["FLOAT"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Parsed value represented by this node. */ + readonly value: string; +} +/** A string value literal. */ +export interface StringValueNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["STRING"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Parsed value represented by this node. */ + readonly value: string; + /** Whether this string was parsed from block string syntax. */ + readonly block?: boolean | undefined; +} +/** A boolean value literal. */ +export interface BooleanValueNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["BOOLEAN"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Parsed value represented by this node. */ + readonly value: boolean; +} +/** A null value literal. */ +export interface NullValueNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["NULL"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; +} +/** An enum value literal. */ +export interface EnumValueNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["ENUM"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Parsed value represented by this node. */ + readonly value: string; +} +/** A list value literal. */ +export interface ListValueNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["LIST"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Values contained in this enum, list, or input-object definition. */ + readonly values: ReadonlyArray<ValueNode>; +} +/** A list value literal whose elements are all constant values. */ +export interface ConstListValueNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["LIST"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Values contained in this enum, list, or input-object definition. */ + readonly values: ReadonlyArray<ConstValueNode>; +} +/** An input object value literal. */ +export interface ObjectValueNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["OBJECT"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Fields declared by this object, interface, input object, or literal. */ + readonly fields: ReadonlyArray<ObjectFieldNode>; +} +/** An input object value literal whose fields are all constant values. */ +export interface ConstObjectValueNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["OBJECT"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Fields declared by this object, interface, input object, or literal. */ + readonly fields: ReadonlyArray<ConstObjectFieldNode>; +} +/** A field inside an input object value literal. */ +export interface ObjectFieldNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["OBJECT_FIELD"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Parsed value represented by this node. */ + readonly value: ValueNode; +} +/** A field inside a constant input object value literal. */ +export interface ConstObjectFieldNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["OBJECT_FIELD"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Parsed value represented by this node. */ + readonly value: ConstValueNode; +} +/** A directive applied to an executable or type-system location. */ +export interface DirectiveNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["DIRECTIVE"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Arguments supplied to this field, directive, or coordinate. */ + readonly arguments?: ReadonlyArray<ArgumentNode> | undefined; +} +/** A directive whose arguments are all constant values. */ +export interface ConstDirectiveNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["DIRECTIVE"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Arguments supplied to this field, directive, or coordinate. */ + readonly arguments?: ReadonlyArray<ConstArgumentNode> | undefined; +} +/** Any GraphQL type reference AST node. */ +export type TypeNode = NamedTypeNode | ListTypeNode | NonNullTypeNode; +/** A named type reference. */ +export interface NamedTypeNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["NAMED_TYPE"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; +} +/** A list type reference. */ +export interface ListTypeNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["LIST_TYPE"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** The GraphQL type reference or runtime type for this element. */ + readonly type: TypeNode; +} +/** A non-null type reference. */ +export interface NonNullTypeNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["NON_NULL_TYPE"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** The GraphQL type reference or runtime type for this element. */ + readonly type: NamedTypeNode | ListTypeNode; +} +/** Any type-system definition that may appear in a schema document. */ +export type TypeSystemDefinitionNode = SchemaDefinitionNode | TypeDefinitionNode | DirectiveDefinitionNode; +/** A schema definition in a type-system document. */ +export interface SchemaDefinitionNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["SCHEMA_DEFINITION"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** The optional GraphQL description associated with this definition. */ + readonly description?: StringValueNode | undefined; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<ConstDirectiveNode> | undefined; + /** Root operation types declared by this schema definition or extension. */ + readonly operationTypes: ReadonlyArray<OperationTypeDefinitionNode>; +} +/** A root operation type declaration inside a schema definition or extension. */ +export interface OperationTypeDefinitionNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["OPERATION_TYPE_DEFINITION"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** The operation selected for execution. */ + readonly operation: OperationTypeNode; + /** The GraphQL type reference or runtime type for this element. */ + readonly type: NamedTypeNode; +} +/** Any named type definition that may appear in a schema document. */ +export type TypeDefinitionNode = ScalarTypeDefinitionNode | ObjectTypeDefinitionNode | InterfaceTypeDefinitionNode | UnionTypeDefinitionNode | EnumTypeDefinitionNode | InputObjectTypeDefinitionNode; +/** A scalar type definition in a type-system document. */ +export interface ScalarTypeDefinitionNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["SCALAR_TYPE_DEFINITION"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** The optional GraphQL description associated with this definition. */ + readonly description?: StringValueNode | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<ConstDirectiveNode> | undefined; +} +/** An object type definition in a type-system document. */ +export interface ObjectTypeDefinitionNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["OBJECT_TYPE_DEFINITION"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** The optional GraphQL description associated with this definition. */ + readonly description?: StringValueNode | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Interfaces implemented by this object or interface type. */ + readonly interfaces?: ReadonlyArray<NamedTypeNode> | undefined; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<ConstDirectiveNode> | undefined; + /** Fields declared by this object, interface, input object, or literal. */ + readonly fields?: ReadonlyArray<FieldDefinitionNode> | undefined; +} +/** A field definition declared by an object or interface type. */ +export interface FieldDefinitionNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["FIELD_DEFINITION"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** The optional GraphQL description associated with this definition. */ + readonly description?: StringValueNode | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Arguments supplied to this field, directive, or coordinate. */ + readonly arguments?: ReadonlyArray<InputValueDefinitionNode> | undefined; + /** The GraphQL type reference or runtime type for this element. */ + readonly type: TypeNode; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<ConstDirectiveNode> | undefined; +} +/** An argument or input-field definition. */ +export interface InputValueDefinitionNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["INPUT_VALUE_DEFINITION"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** The optional GraphQL description associated with this definition. */ + readonly description?: StringValueNode | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** The GraphQL type reference or runtime type for this element. */ + readonly type: TypeNode; + /** Default value used when no explicit value is supplied. */ + readonly defaultValue?: ConstValueNode | undefined; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<ConstDirectiveNode> | undefined; +} +/** An interface type definition in a type-system document. */ +export interface InterfaceTypeDefinitionNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["INTERFACE_TYPE_DEFINITION"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** The optional GraphQL description associated with this definition. */ + readonly description?: StringValueNode | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Interfaces implemented by this object or interface type. */ + readonly interfaces?: ReadonlyArray<NamedTypeNode> | undefined; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<ConstDirectiveNode> | undefined; + /** Fields declared by this object, interface, input object, or literal. */ + readonly fields?: ReadonlyArray<FieldDefinitionNode> | undefined; +} +/** A union type definition in a type-system document. */ +export interface UnionTypeDefinitionNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["UNION_TYPE_DEFINITION"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** The optional GraphQL description associated with this definition. */ + readonly description?: StringValueNode | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<ConstDirectiveNode> | undefined; + /** Object types that belong to this union type. */ + readonly types?: ReadonlyArray<NamedTypeNode> | undefined; +} +/** An enum type definition in a type-system document. */ +export interface EnumTypeDefinitionNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["ENUM_TYPE_DEFINITION"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** The optional GraphQL description associated with this definition. */ + readonly description?: StringValueNode | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<ConstDirectiveNode> | undefined; + /** Values contained in this enum, list, or input-object definition. */ + readonly values?: ReadonlyArray<EnumValueDefinitionNode> | undefined; +} +/** An enum value definition. */ +export interface EnumValueDefinitionNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["ENUM_VALUE_DEFINITION"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** The optional GraphQL description associated with this definition. */ + readonly description?: StringValueNode | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<ConstDirectiveNode> | undefined; +} +/** An input object type definition in a type-system document. */ +export interface InputObjectTypeDefinitionNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["INPUT_OBJECT_TYPE_DEFINITION"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** The optional GraphQL description associated with this definition. */ + readonly description?: StringValueNode | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<ConstDirectiveNode> | undefined; + /** Fields declared by this object, interface, input object, or literal. */ + readonly fields?: ReadonlyArray<InputValueDefinitionNode> | undefined; +} +/** A directive definition in a type-system document. */ +export interface DirectiveDefinitionNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["DIRECTIVE_DEFINITION"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** The optional GraphQL description associated with this definition. */ + readonly description?: StringValueNode | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Arguments supplied to this field, directive, or coordinate. */ + readonly arguments?: ReadonlyArray<InputValueDefinitionNode> | undefined; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<ConstDirectiveNode> | undefined; + /** Whether this directive may appear more than once at the same location. */ + readonly repeatable: boolean; + /** Locations where this directive may be applied. */ + readonly locations: ReadonlyArray<NameNode>; +} +/** Any type-system extension that may appear in a schema extension document. */ +export type TypeSystemExtensionNode = SchemaExtensionNode | TypeExtensionNode | DirectiveExtensionNode; +/** A schema extension in a type-system document. */ +export interface SchemaExtensionNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["SCHEMA_EXTENSION"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<ConstDirectiveNode> | undefined; + /** Root operation types declared by this schema definition or extension. */ + readonly operationTypes?: ReadonlyArray<OperationTypeDefinitionNode> | undefined; +} +/** Any named type extension that may appear in a schema extension document. */ +export type TypeExtensionNode = ScalarTypeExtensionNode | ObjectTypeExtensionNode | InterfaceTypeExtensionNode | UnionTypeExtensionNode | EnumTypeExtensionNode | InputObjectTypeExtensionNode; +/** A scalar type extension. */ +export interface ScalarTypeExtensionNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["SCALAR_TYPE_EXTENSION"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<ConstDirectiveNode> | undefined; +} +/** An object type extension. */ +export interface ObjectTypeExtensionNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["OBJECT_TYPE_EXTENSION"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Interfaces implemented by this object or interface type. */ + readonly interfaces?: ReadonlyArray<NamedTypeNode> | undefined; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<ConstDirectiveNode> | undefined; + /** Fields declared by this object, interface, input object, or literal. */ + readonly fields?: ReadonlyArray<FieldDefinitionNode> | undefined; +} +/** An interface type extension. */ +export interface InterfaceTypeExtensionNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["INTERFACE_TYPE_EXTENSION"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Interfaces implemented by this object or interface type. */ + readonly interfaces?: ReadonlyArray<NamedTypeNode> | undefined; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<ConstDirectiveNode> | undefined; + /** Fields declared by this object, interface, input object, or literal. */ + readonly fields?: ReadonlyArray<FieldDefinitionNode> | undefined; +} +/** A union type extension. */ +export interface UnionTypeExtensionNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["UNION_TYPE_EXTENSION"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<ConstDirectiveNode> | undefined; + /** Object types that belong to this union type. */ + readonly types?: ReadonlyArray<NamedTypeNode> | undefined; +} +/** An enum type extension. */ +export interface EnumTypeExtensionNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["ENUM_TYPE_EXTENSION"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<ConstDirectiveNode> | undefined; + /** Values contained in this enum, list, or input-object definition. */ + readonly values?: ReadonlyArray<EnumValueDefinitionNode> | undefined; +} +/** An input object type extension. */ +export interface InputObjectTypeExtensionNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["INPUT_OBJECT_TYPE_EXTENSION"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<ConstDirectiveNode> | undefined; + /** Fields declared by this object, interface, input object, or literal. */ + readonly fields?: ReadonlyArray<InputValueDefinitionNode> | undefined; +} +/** A directive extension. */ +export interface DirectiveExtensionNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["DIRECTIVE_EXTENSION"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1 | undefined; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** Directives available in this schema or applied to this AST node. */ + readonly directives?: ReadonlyArray<ConstDirectiveNode> | undefined; +} +/** Any AST node representing a GraphQL schema coordinate. */ +export type SchemaCoordinateNode = TypeCoordinateNode | MemberCoordinateNode | ArgumentCoordinateNode | DirectiveCoordinateNode | DirectiveArgumentCoordinateNode; +/** A schema coordinate that refers to a named type. */ +export interface TypeCoordinateNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["TYPE_COORDINATE"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1; + /** Name node identifying this AST node. */ + readonly name: NameNode; +} +/** A schema coordinate that refers to a member of a named type. */ +export interface MemberCoordinateNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["MEMBER_COORDINATE"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** The member name referenced by this schema coordinate. */ + readonly memberName: NameNode; +} +/** A schema coordinate that refers to a field or directive argument. */ +export interface ArgumentCoordinateNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["ARGUMENT_COORDINATE"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** The field name referenced by this schema coordinate. */ + readonly fieldName: NameNode; + /** The argument name referenced by this schema coordinate. */ + readonly argumentName: NameNode; +} +/** A schema coordinate that refers to a directive. */ +export interface DirectiveCoordinateNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["DIRECTIVE_COORDINATE"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1; + /** Name node identifying this AST node. */ + readonly name: NameNode; +} +/** A schema coordinate that refers to a directive argument. */ +export interface DirectiveArgumentCoordinateNode { + /** The discriminator identifying the concrete AST or introspection kind. */ + readonly kind: KindTypeMap["DIRECTIVE_ARGUMENT_COORDINATE"]; + /** The source location for this AST node, if location tracking was enabled. */ + readonly loc?: Location$1; + /** Name node identifying this AST node. */ + readonly name: NameNode; + /** The argument name referenced by this schema coordinate. */ + readonly argumentName: NameNode; +} +/** Represents a location in a Source. */ +export interface SourceLocation { + /** One-indexed line number in the source document. */ + readonly line: number; + /** One-indexed column number in the source document. */ + readonly column: number; +} +/** + * Takes a Source and a UTF-8 character offset, and returns the corresponding + * line and column as a SourceLocation. + * @param source - The source document that contains the position. + * @param position - The UTF-8 character offset in the source body. + * @returns The 1-indexed line and column for the given source position. + * @example + * ```ts + * import { Source, getLocation } from 'graphql/language'; + * + * const source = new Source('type Query { hello: String }'); + * const location = getLocation(source, 13); + * + * location; // => { line: 1, column: 14 } + * ``` + */ +export declare function getLocation(source: Source, position: number): SourceLocation; +/** + * Custom extensions + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLErrorExtensions { + [attributeName: string]: unknown; +} +/** + * Custom formatted extensions + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLFormattedErrorExtensions { + [attributeName: string]: unknown; +} +/** Options used to construct a GraphQLError. */ +export interface GraphQLErrorOptions { + /** AST node or nodes associated with this error. */ + nodes?: ReadonlyArray<ASTNode> | ASTNode | null | undefined; + /** Source document used to derive error locations. */ + source?: Maybe<Source>; + /** Character offsets in the source document associated with this error. */ + positions?: Maybe<ReadonlyArray<number>>; + /** Response path where this error occurred during execution. */ + path?: Maybe<ReadonlyArray<string | number>>; + /** + * Original error that caused this GraphQLError, if one exists. + * Deprecated in favor of `cause` to better align with JavaScript standards. + * @deprecated Prefer `cause` instead. + */ + originalError?: Maybe<Error & { + readonly extensions?: unknown; + }>; + /** Cause of this GraphQLError, if one exists. */ + cause?: unknown; + /** Extension fields to include in the formatted result. */ + extensions?: Maybe<GraphQLErrorExtensions>; +} +/** + * A GraphQLError describes an Error found during the parse, validate, or + * execute phases of performing a GraphQL operation. In addition to a message + * and stack trace, it also includes information about the locations in a + * GraphQL document and/or execution result that correspond to the Error. + */ +export declare class GraphQLError extends Error { + /** + * An array of `{ line, column }` locations within the source GraphQL document + * which correspond to this error. + * + * Errors during validation often contain multiple locations, for example to + * point out two things with the same name. Errors during execution include a + * single location, the field which produced the error. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + readonly locations: ReadonlyArray<SourceLocation> | undefined; + /** + * An array describing the JSON-path into the execution response which + * corresponds to this error. Only included for errors during execution. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + readonly path: ReadonlyArray<string | number> | undefined; + /** An array of GraphQL AST Nodes corresponding to this error. */ + readonly nodes: ReadonlyArray<ASTNode> | undefined; + /** + * The source GraphQL document for the first location of this error. + * + * Note that if this Error represents more than one node, the source may not + * represent nodes after the first node. + */ + readonly source: Source | undefined; + /** + * An array of character offsets within the source GraphQL document + * which correspond to this error. + */ + readonly positions: ReadonlyArray<number> | undefined; + /** + * Original error that caused this GraphQLError, if one exists. + * Deprecated in favor of `cause` to better align with JavaScript standards. + * @deprecated Use `cause` instead. + */ + readonly originalError: Error | undefined; + /** Extension fields to add to the formatted error. */ + readonly extensions: GraphQLErrorExtensions; + /** + * Creates a GraphQLError instance. + * @param message - Human-readable error message. + * @param options - Error metadata such as source locations, response path, cause, original error, and extensions. + * @example + * ```ts + * // Create an error from AST nodes and response metadata. + * import { parse } from 'graphql/language'; + * import { GraphQLError } from 'graphql/error'; + * + * const document = parse('{ greeting }'); + * const fieldNode = document.definitions[0].selectionSet.selections[0]; + * const error = new GraphQLError('Cannot query this field.', { + * nodes: fieldNode, + * path: ['greeting'], + * extensions: { code: 'FORBIDDEN' }, + * }); + * + * error.message; // => 'Cannot query this field.' + * error.locations; // => [{ line: 1, column: 3 }] + * error.path; // => ['greeting'] + * error.extensions; // => { code: 'FORBIDDEN' } + * ``` + * @example + * ```ts + * // This variant derives locations from source positions and preserves the cause. + * import { Source } from 'graphql/language'; + * import { GraphQLError } from 'graphql/error'; + * + * const source = new Source('{ greeting }'); + * const cause = new Error('Database unavailable.'); + * const error = new GraphQLError('Resolver failed.', { + * source, + * positions: [2], + * path: ['greeting'], + * cause, + * }); + * + * error.locations; // => [{ line: 1, column: 3 }] + * error.path; // => ['greeting'] + * error.cause; // => cause + * ``` + */ + constructor(message: string, options?: GraphQLErrorOptions); + /** + * Returns the value used by `Object.prototype.toString`. + * @returns The built-in string tag for this object. + */ + get [Symbol.toStringTag](): string; + /** + * Returns this error as a human-readable message with source locations. + * @returns The formatted error string. + * @example + * ```ts + * import { Source } from 'graphql/language'; + * import { GraphQLError } from 'graphql/error'; + * + * const error = new GraphQLError('Cannot query field "name".', { + * source: new Source('{ name }'), + * positions: [2], + * }); + * + * error.toString(); // => 'Cannot query field "name".\n\nGraphQL request:1:3\n1 | { name }\n | ^' + * ``` + */ + toString(): string; + /** + * Returns the JSON representation used when this object is serialized. + * @returns The JSON-serializable representation. + * @example + * ```ts + * import { GraphQLError } from 'graphql/error'; + * + * const error = new GraphQLError('Resolver failed.', { + * path: ['viewer', 'name'], + * extensions: { code: 'INTERNAL' }, + * }); + * + * error.toJSON(); // => { message: 'Resolver failed.', path: ['viewer', 'name'], extensions: { code: 'INTERNAL' } } + * ``` + */ + toJSON(): GraphQLFormattedError; +} +/** See: https://spec.graphql.org/draft/#sec-Errors */ +export interface GraphQLFormattedError { + /** + * A short, human-readable summary of the problem that **SHOULD NOT** change + * from occurrence to occurrence of the problem, except for purposes of + * localization. + */ + readonly message: string; + /** + * If an error can be associated to a particular point in the requested + * GraphQL document, it should contain a list of locations. + */ + readonly locations?: ReadonlyArray<SourceLocation>; + /** + * If an error can be associated to a particular field in the GraphQL result, + * it _must_ contain an entry with the key `path` that details the path of + * the response field which experienced the error. This allows clients to + * identify whether a null result is intentional or caused by a runtime error. + */ + readonly path?: ReadonlyArray<string | number>; + /** + * Reserved for implementors to extend the protocol however they see fit, + * and hence there are no additional restrictions on its contents. + */ + readonly extensions?: GraphQLFormattedErrorExtensions; +} +/** Represents a linked response path from a field back to the root response. */ +interface Path { + /** The previous segment in the linked response path, or undefined at the root. */ + readonly prev: Path | undefined; + /** The field name or list index for this response path segment. */ + readonly key: string | number; + /** The runtime object type name associated with this path segment, if known. */ + readonly typename: string | undefined; +} +/** + * Given a Path, return an Array of the path keys. + * @param path - The linked response path to flatten. + * @returns An array of response path keys from root to leaf. + * @example + * ```ts + * import { pathToArray } from 'graphql/jsutils/Path'; + * + * const path = { + * prev: { + * prev: { + * prev: undefined, + * key: 'viewer', + * typename: 'Query', + * }, + * key: 'friends', + * typename: 'User', + * }, + * key: 0, + * typename: undefined, + * }; + * + * pathToArray(path); // => ['viewer', 'friends', 0] + * pathToArray(undefined); // => [] + * ``` + */ +declare function pathToArray(path: Maybe<Readonly<Path>>): Array<string | number>; +type PromiseOrValue<T> = Promise<T> | T; +/** @category Kinds */ +/** The set of allowed directive location values. */ +export declare const DirectiveLocation: { + /** Directive location for query operations. */ + readonly QUERY: "QUERY"; + /** Directive location for mutation operations. */ + readonly MUTATION: "MUTATION"; + /** Directive location for subscription operations. */ + readonly SUBSCRIPTION: "SUBSCRIPTION"; + /** Directive location for field selections. */ + readonly FIELD: "FIELD"; + /** Directive location for fragment definitions. */ + readonly FRAGMENT_DEFINITION: "FRAGMENT_DEFINITION"; + /** Directive location for fragment spreads. */ + readonly FRAGMENT_SPREAD: "FRAGMENT_SPREAD"; + /** Directive location for inline fragments. */ + readonly INLINE_FRAGMENT: "INLINE_FRAGMENT"; + /** Directive location for variable definitions. */ + readonly VARIABLE_DEFINITION: "VARIABLE_DEFINITION"; + /** Directive location for fragment variable definitions. */ + readonly FRAGMENT_VARIABLE_DEFINITION: "FRAGMENT_VARIABLE_DEFINITION"; + /** Directive location for schema definitions and extensions. */ + readonly SCHEMA: "SCHEMA"; + /** Directive location for scalar type definitions and extensions. */ + readonly SCALAR: "SCALAR"; + /** Directive location for object type definitions and extensions. */ + readonly OBJECT: "OBJECT"; + /** Directive location for field definitions. */ + readonly FIELD_DEFINITION: "FIELD_DEFINITION"; + /** Directive location for argument definitions. */ + readonly ARGUMENT_DEFINITION: "ARGUMENT_DEFINITION"; + /** Directive location for interface type definitions and extensions. */ + readonly INTERFACE: "INTERFACE"; + /** Directive location for union type definitions and extensions. */ + readonly UNION: "UNION"; + /** Directive location for enum type definitions and extensions. */ + readonly ENUM: "ENUM"; + /** Directive location for enum value definitions. */ + readonly ENUM_VALUE: "ENUM_VALUE"; + /** Directive location for input object type definitions and extensions. */ + readonly INPUT_OBJECT: "INPUT_OBJECT"; + /** Directive location for input object field definitions. */ + readonly INPUT_FIELD_DEFINITION: "INPUT_FIELD_DEFINITION"; + /** Directive location for directive definitions and extensions. */ + readonly DIRECTIVE_DEFINITION: "DIRECTIVE_DEFINITION"; +}; +/** The set of allowed directive location values. */ +export type DirectiveLocation = (typeof DirectiveLocation)[keyof typeof DirectiveLocation]; +/** + * Test if the given value is a GraphQL directive. + * @param directive - Value to inspect. + * @returns True when the value is a GraphQLDirective. + * @example + * ```ts + * import { DirectiveLocation } from 'graphql/language'; + * import { GraphQLDirective, GraphQLString, isDirective } from 'graphql/type'; + * + * const upper = new GraphQLDirective({ + * name: 'upper', + * locations: [DirectiveLocation.FIELD_DEFINITION], + * }); + * + * isDirective(upper); // => true + * isDirective(GraphQLString); // => false + * ``` + */ +export declare function isDirective(directive: unknown): directive is GraphQLDirective; +/** + * Returns the value as a GraphQLDirective, or throws if it is not a directive. + * @param directive - Value to inspect. + * @returns The value typed as a GraphQLDirective. + * @example + * ```ts + * import { DirectiveLocation } from 'graphql/language'; + * import { assertDirective, GraphQLDirective, GraphQLString } from 'graphql/type'; + * + * const upper = new GraphQLDirective({ + * name: 'upper', + * locations: [DirectiveLocation.FIELD_DEFINITION], + * }); + * + * assertDirective(upper); // => upper + * assertDirective(GraphQLString); // throws an error + * ``` + */ +export declare function assertDirective(directive: unknown): GraphQLDirective; +/** + * Custom extensions + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLDirectiveExtensions { + [attributeName: string | symbol]: unknown; +} +/** + * Directives are used by the GraphQL runtime as a way of modifying execution + * behavior. Type system creators will usually not create these directly. + */ +export declare class GraphQLDirective implements GraphQLSchemaElement { + /** The GraphQL name for this schema element. */ + name: string; + /** Human-readable description for this schema element, if provided. */ + description: Maybe<string>; + /** Locations where this directive may be applied. */ + locations: ReadonlyArray<DirectiveLocation>; + /** Arguments accepted by this field or directive. */ + args: ReadonlyArray<GraphQLArgument>; + /** Whether this directive may appear more than once at the same location. */ + isRepeatable: boolean; + /** Reason this element is deprecated, if one was provided. */ + deprecationReason: Maybe<string>; + /** Custom extension fields reserved for users. */ + extensions: Readonly<GraphQLDirectiveExtensions>; + /** AST node from which this schema element was built, if available. */ + astNode: Maybe<DirectiveDefinitionNode>; + /** AST extension nodes applied to this schema element. */ + extensionASTNodes: ReadonlyArray<DirectiveExtensionNode>; + /** + * Creates a GraphQLDirective instance. + * @param config - Configuration describing this object. + * @example + * ```ts + * import { DirectiveLocation, parse } from 'graphql/language'; + * import { + * GraphQLBoolean, + * GraphQLDirective, + * GraphQLInt, + * GraphQLNonNull, + * } from 'graphql/type'; + * + * const document = parse(` + * directive @cacheControl(maxAge: Int) repeatable on FIELD_DEFINITION + * extend directive @cacheControl(maxAge: Int) on FIELD_DEFINITION + * `); + * const definition = document.definitions[0]; + * + * const cacheControl = new GraphQLDirective({ + * name: 'cacheControl', + * description: 'Controls HTTP cache hints for a field.', + * locations: [DirectiveLocation.FIELD_DEFINITION], + * args: { + * inheritMaxAge: { + * description: 'Inherit the parent cache hint.', + * type: new GraphQLNonNull(GraphQLBoolean), + * default: { value: false }, + * deprecationReason: 'Use maxAge instead.', + * extensions: { scope: 'cache' }, + * }, + * maxAge: { + * type: GraphQLInt, + * astNode: definition.arguments[0], + * }, + * }, + * isRepeatable: true, + * deprecationReason: 'Use @cache instead.', + * extensions: { scope: 'cache' }, + * astNode: definition, + * extensionASTNodes: [document.definitions[1]], + * }); + * + * cacheControl.name; // => 'cacheControl' + * cacheControl.description; // => 'Controls HTTP cache hints for a field.' + * cacheControl.args[0].name; // => 'inheritMaxAge' + * cacheControl.args[0].default.value; // => false + * cacheControl.isRepeatable; // => true + * cacheControl.extensions; // => { scope: 'cache' } + * ``` + */ + constructor(config: Readonly<GraphQLDirectiveConfig>); + /** + * Returns the value used by `Object.prototype.toString`. + * @returns The built-in string tag for this object. + */ + get [Symbol.toStringTag](): string; + /** + * Returns a normalized configuration object for this object. + * @returns A configuration object that can be used to recreate this object. + * @example + * ```ts + * import { DirectiveLocation } from 'graphql/language'; + * import { GraphQLDirective, GraphQLString } from 'graphql/type'; + * + * const tag = new GraphQLDirective({ + * name: 'tag', + * locations: [DirectiveLocation.FIELD_DEFINITION], + * args: { + * name: { type: GraphQLString }, + * }, + * }); + * + * const config = tag.toConfig(); + * const tagCopy = new GraphQLDirective(config); + * + * config.args.name.type; // => GraphQLString + * tagCopy.args[0].name; // => 'name' + * ``` + */ + toConfig(): GraphQLDirectiveNormalizedConfig; + /** + * Returns the schema coordinate identifying this directive. + * @returns The directive schema coordinate. + * @example + * ```ts + * import { DirectiveLocation } from 'graphql/language'; + * import { GraphQLDirective } from 'graphql/type'; + * + * const tag = new GraphQLDirective({ + * name: 'tag', + * locations: [DirectiveLocation.FIELD_DEFINITION], + * }); + * + * tag.toString(); // => '@tag' + * ``` + */ + toString(): string; + /** + * Returns the JSON representation used when this object is serialized. + * @returns The JSON-serializable representation. + * @example + * ```ts + * import { DirectiveLocation } from 'graphql/language'; + * import { GraphQLDirective } from 'graphql/type'; + * + * const tag = new GraphQLDirective({ + * name: 'tag', + * locations: [DirectiveLocation.FIELD_DEFINITION], + * }); + * + * tag.toJSON(); // => '@tag' + * JSON.stringify({ directive: tag }); // => '{"directive":"@tag"}' + * ``` + */ + toJSON(): string; +} +/** Configuration used to construct a GraphQLDirective. */ +export interface GraphQLDirectiveConfig { + /** The GraphQL name for this schema element. */ + name: string; + /** Human-readable description for this schema element, if provided. */ + description?: Maybe<string>; + /** Locations where this directive may be applied. */ + locations: ReadonlyArray<DirectiveLocation>; + /** Arguments accepted by this field or directive. */ + args?: Maybe<ObjMap<GraphQLArgumentConfig>>; + /** Whether this directive may appear more than once at the same location. */ + isRepeatable?: Maybe<boolean>; + /** Reason this element is deprecated, if one was provided. */ + deprecationReason?: Maybe<string>; + /** Custom extension fields reserved for users. */ + extensions?: Maybe<Readonly<GraphQLDirectiveExtensions>>; + /** AST node from which this schema element was built, if available. */ + astNode?: Maybe<DirectiveDefinitionNode>; + /** AST extension nodes applied to this schema element. */ + extensionASTNodes?: Maybe<ReadonlyArray<DirectiveExtensionNode>>; +} +interface GraphQLDirectiveNormalizedConfig extends GraphQLDirectiveConfig { + args: GraphQLFieldNormalizedConfigArgumentMap; + isRepeatable: boolean; + extensions: Readonly<GraphQLDirectiveExtensions>; + extensionASTNodes: ReadonlyArray<DirectiveExtensionNode>; +} +/** Used to conditionally include fields or fragments. */ +export declare const GraphQLIncludeDirective: GraphQLDirective; +/** Used to conditionally skip (exclude) fields or fragments. */ +export declare const GraphQLSkipDirective: GraphQLDirective; +/** + * Experimental directive used to conditionally defer fragments. + * + * This directive is exported for schemas that explicitly opt in to incremental + * delivery. It is not included in `specifiedDirectives`. + */ +export declare const GraphQLDeferDirective: GraphQLDirective; +/** + * Experimental directive used to conditionally stream list fields. + * + * This directive is exported for schemas that explicitly opt in to incremental + * delivery. It is not included in `specifiedDirectives`. + */ +export declare const GraphQLStreamDirective: GraphQLDirective; +/** Constant string used for default reason for a deprecation. */ +export declare const DEFAULT_DEPRECATION_REASON = "No longer supported"; +/** + * Used to declare element of a GraphQL schema as deprecated. + * + * The `reason` argument is non-null and defaults to + * `DEFAULT_DEPRECATION_REASON`. + */ +export declare const GraphQLDeprecatedDirective: GraphQLDirective; +/** Used to provide a URL for specifying the behavior of custom scalar definitions. */ +export declare const GraphQLSpecifiedByDirective: GraphQLDirective; +/** Used to indicate an Input Object is a OneOf Input Object. */ +export declare const GraphQLOneOfDirective: GraphQLDirective; +/** + * Full list of stable directives specified by GraphQL.js. + * + * Experimental `@defer` and `@stream` are exported separately and are not + * included in this list. + */ +export declare const specifiedDirectives: ReadonlyArray<GraphQLDirective>; +/** + * Returns true when the directive is one of the directives specified by GraphQL. + * @param directive - Directive to inspect. + * @returns True when the directive is specified by GraphQL. + * @example + * ```ts + * import { + * GraphQLDirective, + * GraphQLIncludeDirective, + * isSpecifiedDirective, + * } from 'graphql/type'; + * import { DirectiveLocation } from 'graphql/language'; + * + * const customDirective = new GraphQLDirective({ + * name: 'auth', + * locations: [DirectiveLocation.FIELD_DEFINITION], + * }); + * + * isSpecifiedDirective(GraphQLIncludeDirective); // => true + * isSpecifiedDirective(customDirective); // => false + * ``` + */ +export declare function isSpecifiedDirective(directive: GraphQLDirective): boolean; +/** + * Maximum possible Int value as per GraphQL Spec (32-bit signed integer). + * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe up-to 2^53 - 1 + */ +export declare const GRAPHQL_MAX_INT = 2147483647; +/** + * Minimum possible Int value as per GraphQL Spec (32-bit signed integer). + * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe starting at -(2^53 - 1) + */ +export declare const GRAPHQL_MIN_INT = -2147483648; +/** The built-in `Int` scalar type. */ +export declare const GraphQLInt: GraphQLScalarType<number>; +/** The built-in `Float` scalar type. */ +export declare const GraphQLFloat: GraphQLScalarType<number>; +/** The built-in `String` scalar type. */ +export declare const GraphQLString: GraphQLScalarType<string>; +/** The built-in `Boolean` scalar type. */ +export declare const GraphQLBoolean: GraphQLScalarType<boolean>; +/** The built-in `ID` scalar type. */ +export declare const GraphQLID: GraphQLScalarType<string>; +/** All built-in scalar types defined by the GraphQL specification. */ +export declare const specifiedScalarTypes: ReadonlyArray<GraphQLScalarType>; +/** + * Returns true when the scalar type is one of the scalars specified by GraphQL. + * @param type - The GraphQL type to inspect. + * @returns True when the scalar type is one of the scalars specified by GraphQL. + * @example + * ```ts + * import { + * GraphQLScalarType, + * GraphQLString, + * isSpecifiedScalarType, + * } from 'graphql/type'; + * + * const DateTime = new GraphQLScalarType({ + * name: 'DateTime', + * }); + * + * isSpecifiedScalarType(GraphQLString); // => true + * isSpecifiedScalarType(DateTime); // => false + * ``` + */ +export declare function isSpecifiedScalarType(type: GraphQLNamedType): boolean; +/** The introspection type describing a GraphQL schema. */ +export declare const __Schema: GraphQLObjectType; +/** The introspection type describing a GraphQL directive. */ +export declare const __Directive: GraphQLObjectType; +/** The introspection enum describing directive locations. */ +export declare const __DirectiveLocation: GraphQLEnumType; +/** The introspection type describing GraphQL types. */ +export declare const __Type: GraphQLObjectType; +/** The introspection type describing object and interface fields. */ +export declare const __Field: GraphQLObjectType; +/** The introspection type describing arguments and input fields. */ +export declare const __InputValue: GraphQLObjectType; +/** The introspection type describing enum values. */ +export declare const __EnumValue: GraphQLObjectType; +/** + * The introspection enum describing the different kinds of GraphQL types. + * @category Introspection + */ +export declare const TypeKind: { + readonly SCALAR: "SCALAR"; + readonly OBJECT: "OBJECT"; + readonly INTERFACE: "INTERFACE"; + readonly UNION: "UNION"; + readonly ENUM: "ENUM"; + readonly INPUT_OBJECT: "INPUT_OBJECT"; + readonly LIST: "LIST"; + readonly NON_NULL: "NON_NULL"; +}; +/** + * The introspection enum describing the different kinds of GraphQL types. + * @category Introspection + */ +export type TypeKind = (typeof TypeKind)[keyof typeof TypeKind]; +/** The introspection enum describing GraphQL type kinds. */ +export declare const __TypeKind: GraphQLEnumType; +/** + * Note that these are GraphQLField and not GraphQLFieldConfig, + * so the format for args is different. + */ +export declare const SchemaMetaFieldDef: GraphQLField<unknown, unknown>; +/** The `__type` meta field definition used by introspection. */ +export declare const TypeMetaFieldDef: GraphQLField<unknown, unknown>; +/** The `__typename` meta field definition used by execution and introspection. */ +export declare const TypeNameMetaFieldDef: GraphQLField<unknown, unknown>; +/** All introspection types defined by the GraphQL specification. */ +export declare const introspectionTypes: ReadonlyArray<GraphQLNamedType>; +/** + * Returns true when the type is one of the built-in introspection types. + * @param type - The GraphQL type to inspect. + * @returns True when the type is one of the built-in introspection types. + * @example + * ```ts + * import { GraphQLString, isIntrospectionType, __Type } from 'graphql/type'; + * + * isIntrospectionType(__Type); // => true + * isIntrospectionType(GraphQLString); // => false + * ``` + */ +export declare function isIntrospectionType(type: GraphQLNamedType): boolean; +/** + * Implements the "Type Validation" sub-sections of the specification's + * "Type System" section. + * + * Validation runs synchronously, returning an array of encountered errors, or + * an empty array if no errors were encountered and the Schema is valid. + * @param schema - GraphQL schema to use. + * @returns Schema validation errors, or an empty array when the schema is valid. + * @example + * ```ts + * import { validateSchema } from 'graphql/type'; + * import { buildSchema } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * name: String + * } + * `); + * const errors = validateSchema(schema); + * + * errors; // => [] + * ``` + */ +export declare function validateSchema(schema: GraphQLSchema): ReadonlyArray<GraphQLError>; +/** + * Utility function which asserts a schema is valid by throwing an error if + * it is invalid. + * @param schema - GraphQL schema to use. + * @example + * ```ts + * import { assertValidSchema } from 'graphql/type'; + * import { buildSchema } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * name: String + * } + * `); + * + * assertValidSchema(schema); // does not throw + * ``` + */ +export declare function assertValidSchema(schema: GraphQLSchema): void; +/** @category Names */ +/** + * Upholds the spec rules about naming. + * @param name - The GraphQL name to validate. + * @returns The validated GraphQL name. + * @example + * ```ts + * import { assertName } from 'graphql/type'; + * + * assertName('User'); // => 'User' + * assertName('123User'); // throws an error + * ``` + */ +export declare function assertName(name: string): string; +/** + * Upholds the spec rules about naming enum values. + * @param name - The GraphQL name to validate. + * @returns The validated GraphQL name. + * @example + * ```ts + * import { assertEnumValueName } from 'graphql/type'; + * + * assertEnumValueName('ACTIVE'); // => 'ACTIVE' + * assertEnumValueName('true'); // throws an error + * ``` + */ +export declare function assertEnumValueName(name: string): string; +interface GraphQLVariableSignature { + name: string; + type: GraphQLInputType; + defaultValue?: never; + default: { + literal: ConstValueNode; + } | undefined; +} +interface FragmentVariableValues { + readonly sources: ReadOnlyObjMap<FragmentVariableValueSource>; + readonly coerced: ReadOnlyObjMap<unknown>; +} +interface FragmentVariableValueSource { + readonly signature: GraphQLVariableSignature; + readonly value?: ValueNode; + readonly fragmentVariableValues?: FragmentVariableValues; +} +interface FragmentDetails { + definition: FragmentDefinitionNode; + variableSignatures?: ObjMap<GraphQLVariableSignature> | undefined; +} +/** + * Coerced variable values prepared for execution. + * + * The `coerced` map contains runtime values keyed by variable name. The + * `sources` map records whether each value came from request input, an operation + * default, or a fragment-variable default so utilities can preserve defaults + * when replacing variables in literals. + */ +export interface VariableValues { + /** Source metadata for each variable value keyed by variable name. */ + readonly sources: ReadOnlyObjMap<VariableValueSource>; + /** Coerced runtime variable values keyed by variable name. */ + readonly coerced: ReadOnlyObjMap<unknown>; +} +interface VariableValueSource { + readonly signature: GraphQLVariableSignature; + readonly value?: unknown; +} +type VariableValuesOrErrors = { + variableValues: VariableValues; + errors?: never; +} | { + errors: ReadonlyArray<GraphQLError>; + variableValues?: never; +}; +/** + * Prepares an object map of variableValues of the correct type based on the + * provided variable definitions and arbitrary input. If the input cannot be + * parsed to match the variable definitions, GraphQLError values are returned. + * + * Note: Returned maps use null prototypes to avoid collisions with + * Object prototype properties. + * @param schema - GraphQL schema to use. + * @param varDefNodes - The variable definition AST nodes to coerce. + * @param inputs - The runtime variable values keyed by variable name. + * @param options - Optional configuration for this operation. + * @param [options.maxErrors] - Maximum number of coercion errors to report. + * @param [options.hideSuggestions] - Whether suggestion text should be omitted + * from errors. + * @returns Coerced variable values with source metadata, or request errors. + * @example + * ```ts + * // Coerce provided variables and apply operation defaults. + * import assert from 'node:assert'; + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { getVariableValues } from 'graphql/execution'; + * + * const schema = buildSchema(` + * type Query { + * reviews(stars: Int!, limit: Int = 10): [String] + * } + * `); + * const document = parse(` + * query ($stars: Int!, $limit: Int = 10) { + * reviews(stars: $stars, limit: $limit) + * } + * `); + * const operation = document.definitions[0]; + * + * const result = getVariableValues(schema, operation.variableDefinitions, { + * stars: '5', + * }); + * + * assert('variableValues' in result); + * + * result.variableValues.coerced; // => { stars: 5, limit: 10 } + * ``` + * @example + * ```ts + * // This variant uses maxErrors to cap reported coercion errors. + * import assert from 'node:assert'; + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { getVariableValues } from 'graphql/execution'; + * + * const schema = buildSchema(` + * input ReviewInput { + * stars: Int! + * } + * + * type Query { + * review(input: ReviewInput!): String + * } + * `); + * const document = parse(` + * query ($first: ReviewInput!, $second: ReviewInput!) { + * first: review(input: $first) + * second: review(input: $second) + * } + * `); + * const operation = document.definitions[0]; + * + * const result = getVariableValues( + * schema, + * operation.variableDefinitions, + * { first: { stars: 'bad' }, second: { stars: 'also bad' } }, + * { maxErrors: 1 }, + * ); + * + * assert('errors' in result); + * + * result.errors.length; // => 2 + * result.errors[1].message; // matches /error limit reached/ + * ``` + */ +export declare function getVariableValues(schema: GraphQLSchema, varDefNodes: ReadonlyArray<VariableDefinitionNode>, inputs: { + readonly [variable: string]: unknown; +}, options?: { + maxErrors?: number; + hideSuggestions?: boolean; +}): VariableValuesOrErrors; +/** + * Prepares an object map of argument values given a list of argument + * definitions and list of argument AST nodes. + * + * Note: Returned value uses a null prototype to avoid collisions with + * JavaScript's own property names. + * @param def - Field or directive definition that declares the arguments. + * @param node - Field or directive AST node supplying argument literals. + * @param variableValues - Operation variable values returned by getVariableValues. + * @param fragmentVariableValues - Fragment variable values for the current fragment scope. + * @param hideSuggestions - Whether suggestion text should be omitted from errors. + * @returns A map of coerced argument values. + * @example + * ```ts + * // Read literal argument values and defaults. + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { getArgumentValues } from 'graphql/execution'; + * + * const schema = buildSchema(` + * type Query { + * reviews(stars: Int!, limit: Int = 10): [String] + * } + * `); + * const fieldDef = schema.getQueryType().getFields().reviews; + * const document = parse('{ reviews(stars: 5) }'); + * const fieldNode = document.definitions[0].selectionSet.selections[0]; + * + * getArgumentValues(fieldDef, fieldNode); // => { stars: 5, limit: 10 } + * ``` + * @example + * ```ts + * // This variant resolves argument values from operation variables. + * import assert from 'node:assert'; + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { getArgumentValues, getVariableValues } from 'graphql/execution'; + * + * const schema = buildSchema(` + * type Query { + * reviews(stars: Int!): [String] + * } + * `); + * const fieldDef = schema.getQueryType().getFields().reviews; + * const document = parse('query ($stars: Int!) { reviews(stars: $stars) }'); + * const operation = document.definitions[0]; + * const fieldNode = document.definitions[0].selectionSet.selections[0]; + * const variables = getVariableValues(schema, operation.variableDefinitions, { + * stars: '5', + * }); + * + * assert('variableValues' in variables); + * + * getArgumentValues(fieldDef, fieldNode, variables.variableValues); // => { stars: 5 } + * getArgumentValues(fieldDef, fieldNode); // throws an error + * ``` + */ +export declare function getArgumentValues(def: GraphQLField<unknown, unknown> | GraphQLDirective, node: FieldNode | DirectiveNode, variableValues?: Maybe<VariableValues>, fragmentVariableValues?: Maybe<FragmentVariableValues>, hideSuggestions?: Maybe<boolean>): ObjMap<unknown>; +/** + * Prepares an object map of argument values given a directive definition + * and a AST node which may contain directives. Optionally also accepts a map + * of variable values. + * + * If the directive does not exist on the node, returns undefined. + * + * Note: Returned value uses a null prototype to avoid collisions with + * JavaScript's own property names. + * @param directiveDef - Directive definition to read argument definitions from. + * @param node - AST node that may contain directives. + * @param node.directives - The directives on the AST node. + * @param variableValues - Operation variable values returned by getVariableValues. + * @param fragmentVariableValues - Fragment variable values for the current fragment scope. + * @param hideSuggestions - Whether suggestion text should be omitted from errors. + * @returns A map of coerced directive argument values, or undefined when absent. + * @example + * ```ts + * // Read literal directive arguments from a node. + * import { parse } from 'graphql/language'; + * import { GraphQLSkipDirective } from 'graphql/type'; + * import { getDirectiveValues } from 'graphql/execution'; + * + * const document = parse('{ name @skip(if: true) }'); + * const fieldNode = document.definitions[0].selectionSet.selections[0]; + * + * getDirectiveValues(GraphQLSkipDirective, fieldNode); // => { if: true } + * ``` + * @example + * ```ts + * // This variant resolves directive arguments from variables and handles absent directives. + * import assert from 'node:assert'; + * import { parse } from 'graphql/language'; + * import { GraphQLIncludeDirective } from 'graphql/type'; + * import { buildSchema } from 'graphql/utilities'; + * import { getDirectiveValues, getVariableValues } from 'graphql/execution'; + * + * const schema = buildSchema('type Query { name: String }'); + * const document = parse( + * 'query ($includeName: Boolean!) { name @include(if: $includeName) }', + * ); + * const operation = document.definitions[0]; + * const fieldNode = document.definitions[0].selectionSet.selections[0]; + * const variables = getVariableValues(schema, operation.variableDefinitions, { + * includeName: false, + * }); + * + * assert('variableValues' in variables); + * + * getDirectiveValues( + * GraphQLIncludeDirective, + * fieldNode, + * variables.variableValues, + * ); // => { if: false } + * getDirectiveValues(GraphQLIncludeDirective, { directives: [] }); // => undefined + * ``` + */ +export declare function getDirectiveValues(directiveDef: GraphQLDirective, node: { + readonly directives?: ReadonlyArray<DirectiveNode> | undefined; +}, variableValues?: Maybe<VariableValues>, fragmentVariableValues?: Maybe<FragmentVariableValues>, hideSuggestions?: Maybe<boolean>): undefined | ObjMap<unknown>; +/** These are all of the possible kinds of types. */ +export type GraphQLType = GraphQLNamedType | GraphQLWrappingType; +/** + * Returns true when the value is any GraphQL type. + * @param type - The GraphQL type to inspect. + * @returns True when the value is any GraphQL type. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { GraphQLList, GraphQLString, isType } from 'graphql/type'; + * + * const schema = buildSchema(` + * type Query { + * name: String + * } + * `); + * + * isType(GraphQLString); // => true + * isType(new GraphQLList(GraphQLString)); // => true + * isType(schema.getType('Query')); // => true + * isType('String'); // => false + * ``` + */ +export declare function isType(type: unknown): type is GraphQLType; +/** + * Returns the value as a GraphQL type, or throws if it is not one. + * @param type - The GraphQL type to inspect. + * @returns The value typed as a GraphQL type. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertType } from 'graphql/type'; + * + * const schema = buildSchema(` + * type Query { + * name: String + * } + * `); + * + * const queryType = assertType(schema.getType('Query')); + * + * queryType.toString(); // => 'Query' + * assertType('Query'); // throws an error + * ``` + */ +export declare function assertType(type: unknown): GraphQLType; +/** + * There are predicates for each kind of GraphQL type. + * @param type - The GraphQL type to inspect. + * @returns True when the value is a GraphQLScalarType. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { isScalarType } from 'graphql/type'; + * + * const schema = buildSchema(` + * scalar DateTime + * + * type Query { + * createdAt: DateTime + * } + * `); + * + * isScalarType(schema.getType('DateTime')); // => true + * isScalarType(schema.getType('Query')); // => false + * ``` + */ +export declare function isScalarType(type: unknown): type is GraphQLScalarType; +/** + * Returns the value as a GraphQLScalarType, or throws if it is not one. + * @param type - The GraphQL type to inspect. + * @returns The value typed as a GraphQLScalarType. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertScalarType } from 'graphql/type'; + * + * const schema = buildSchema(` + * scalar DateTime + * + * type Query { + * createdAt: DateTime + * } + * `); + * + * const dateTimeType = assertScalarType(schema.getType('DateTime')); + * + * dateTimeType.name; // => 'DateTime' + * assertScalarType(schema.getType('Query')); // throws an error + * ``` + */ +export declare function assertScalarType(type: unknown): GraphQLScalarType; +/** + * Returns true when the value is a GraphQLObjectType. + * @param type - The GraphQL type to inspect. + * @returns True when the value is a GraphQLObjectType. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { isObjectType } from 'graphql/type'; + * + * const schema = buildSchema(` + * input ReviewInput { + * stars: Int! + * } + * + * type User { + * name: String + * } + * + * type Query { + * user: User + * } + * `); + * + * isObjectType(schema.getType('User')); // => true + * isObjectType(schema.getType('ReviewInput')); // => false + * ``` + */ +export declare function isObjectType(type: unknown): type is GraphQLObjectType; +/** + * Returns the value as a GraphQLObjectType, or throws if it is not one. + * @param type - The GraphQL type to inspect. + * @returns The value typed as a GraphQLObjectType. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertObjectType } from 'graphql/type'; + * + * const schema = buildSchema(` + * input ReviewInput { + * stars: Int! + * } + * + * type User { + * name: String + * } + * + * type Query { + * user: User + * } + * `); + * + * const userType = assertObjectType(schema.getType('User')); + * + * Object.keys(userType.getFields()); // => ['name'] + * assertObjectType(schema.getType('ReviewInput')); // throws an error + * ``` + */ +export declare function assertObjectType(type: unknown): GraphQLObjectType; +/** + * Returns true when the value is a resolved GraphQL field definition. + * @param field - Value to inspect. + * @returns True when the value is a GraphQLField. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { isField } from 'graphql/type'; + * + * const schema = buildSchema('type Query { greeting: String }'); + * const field = schema.getQueryType().getFields().greeting; + * + * isField(field); // => true + * isField(schema.getQueryType()); // => false + * ``` + */ +export declare function isField(field: unknown): field is GraphQLField; +/** + * Returns the value as a GraphQLField, or throws if it is not one. + * @param field - Value to inspect. + * @returns The value typed as a GraphQLField. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertField } from 'graphql/type'; + * + * const schema = buildSchema('type Query { greeting: String }'); + * const field = assertField(schema.getQueryType().getFields().greeting); + * + * field.name; // => 'greeting' + * assertField(schema.getQueryType()); // throws an error + * ``` + */ +export declare function assertField(field: unknown): GraphQLField; +/** + * Returns true when the value is a resolved GraphQL argument definition. + * @param arg - Value to inspect. + * @returns True when the value is a GraphQLArgument. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { isArgument } from 'graphql/type'; + * + * const schema = buildSchema('type Query { greeting(name: String): String }'); + * const arg = schema.getQueryType().getFields().greeting.args[0]; + * + * isArgument(arg); // => true + * isArgument(schema.getQueryType()); // => false + * ``` + */ +export declare function isArgument(arg: unknown): arg is GraphQLArgument; +/** + * Returns the value as a GraphQLArgument, or throws if it is not one. + * @param arg - Value to inspect. + * @returns The value typed as a GraphQLArgument. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertArgument } from 'graphql/type'; + * + * const schema = buildSchema('type Query { greeting(name: String): String }'); + * const arg = assertArgument(schema.getQueryType().getFields().greeting.args[0]); + * + * arg.name; // => 'name' + * assertArgument(schema.getQueryType()); // throws an error + * ``` + */ +export declare function assertArgument(arg: unknown): GraphQLArgument; +/** + * Returns true when the value is a GraphQLInterfaceType. + * @param type - The GraphQL type to inspect. + * @returns True when the value is a GraphQLInterfaceType. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { isInterfaceType } from 'graphql/type'; + * + * const schema = buildSchema(` + * interface Node { + * id: ID! + * } + * + * type User implements Node { + * id: ID! + * } + * + * type Query { + * node: Node + * } + * `); + * + * isInterfaceType(schema.getType('Node')); // => true + * isInterfaceType(schema.getType('User')); // => false + * ``` + */ +export declare function isInterfaceType(type: unknown): type is GraphQLInterfaceType; +/** + * Returns the value as a GraphQLInterfaceType, or throws if it is not one. + * @param type - The GraphQL type to inspect. + * @returns The value typed as a GraphQLInterfaceType. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertInterfaceType } from 'graphql/type'; + * + * const schema = buildSchema(` + * interface Node { + * id: ID! + * } + * + * type User implements Node { + * id: ID! + * } + * + * type Query { + * node: Node + * } + * `); + * + * const nodeType = assertInterfaceType(schema.getType('Node')); + * + * nodeType.name; // => 'Node' + * assertInterfaceType(schema.getType('User')); // throws an error + * ``` + */ +export declare function assertInterfaceType(type: unknown): GraphQLInterfaceType; +/** + * Returns true when the value is a GraphQLUnionType. + * @param type - The GraphQL type to inspect. + * @returns True when the value is a GraphQLUnionType. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { isUnionType } from 'graphql/type'; + * + * const schema = buildSchema(` + * type Photo { + * url: String! + * } + * + * type Video { + * url: String! + * } + * + * union Media = Photo | Video + * + * type Query { + * media: [Media] + * } + * `); + * + * isUnionType(schema.getType('Media')); // => true + * isUnionType(schema.getType('Photo')); // => false + * ``` + */ +export declare function isUnionType(type: unknown): type is GraphQLUnionType; +/** + * Returns the value as a GraphQLUnionType, or throws if it is not one. + * @param type - The GraphQL type to inspect. + * @returns The value typed as a GraphQLUnionType. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertUnionType } from 'graphql/type'; + * + * const schema = buildSchema(` + * type Photo { + * url: String! + * } + * + * type Video { + * url: String! + * } + * + * union Media = Photo | Video + * + * type Query { + * media: [Media] + * } + * `); + * + * const mediaType = assertUnionType(schema.getType('Media')); + * + * mediaType.getTypes().map((type) => type.name); // => ['Photo', 'Video'] + * assertUnionType(schema.getType('Photo')); // throws an error + * ``` + */ +export declare function assertUnionType(type: unknown): GraphQLUnionType; +/** + * Returns true when the value is a GraphQLEnumType. + * @param type - The GraphQL type to inspect. + * @returns True when the value is a GraphQLEnumType. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { isEnumType } from 'graphql/type'; + * + * const schema = buildSchema(` + * enum Episode { + * NEW_HOPE + * EMPIRE + * } + * + * type Query { + * favoriteEpisode: Episode + * } + * `); + * + * isEnumType(schema.getType('Episode')); // => true + * isEnumType(schema.getType('Query')); // => false + * ``` + */ +export declare function isEnumType(type: unknown): type is GraphQLEnumType; +/** + * Returns the value as a GraphQLEnumType, or throws if it is not one. + * @param type - The GraphQL type to inspect. + * @returns The value typed as a GraphQLEnumType. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertEnumType } from 'graphql/type'; + * + * const schema = buildSchema(` + * enum Episode { + * NEW_HOPE + * EMPIRE + * } + * + * type Query { + * favoriteEpisode: Episode + * } + * `); + * + * const episodeType = assertEnumType(schema.getType('Episode')); + * + * episodeType.getValues().map((value) => value.name); // => ['NEW_HOPE', 'EMPIRE'] + * assertEnumType(schema.getType('Query')); // throws an error + * ``` + */ +export declare function assertEnumType(type: unknown): GraphQLEnumType; +/** + * Returns true when the value is a resolved GraphQL enum value definition. + * @param value - Value to inspect. + * @returns True when the value is a GraphQLEnumValue. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertEnumType, isEnumValue } from 'graphql/type'; + * + * const schema = buildSchema( + * 'enum Episode { NEW_HOPE } type Query { episode: Episode }', + * ); + * const enumValue = assertEnumType(schema.getType('Episode')).getValues()[0]; + * + * isEnumValue(enumValue); // => true + * isEnumValue(schema.getType('Episode')); // => false + * ``` + */ +export declare function isEnumValue(value: unknown): value is GraphQLEnumValue; +/** + * Returns the value as a GraphQLEnumValue, or throws if it is not one. + * @param value - Value to inspect. + * @returns The value typed as a GraphQLEnumValue. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertEnumType, assertEnumValue } from 'graphql/type'; + * + * const schema = buildSchema( + * 'enum Episode { NEW_HOPE } type Query { episode: Episode }', + * ); + * const enumValue = assertEnumValue( + * assertEnumType(schema.getType('Episode')).getValues()[0], + * ); + * + * enumValue.name; // => 'NEW_HOPE' + * assertEnumValue(schema.getType('Episode')); // throws an error + * ``` + */ +export declare function assertEnumValue(value: unknown): GraphQLEnumValue; +/** + * Returns true when the value is a GraphQLInputObjectType. + * @param type - The GraphQL type to inspect. + * @returns True when the value is a GraphQLInputObjectType. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { isInputObjectType } from 'graphql/type'; + * + * const schema = buildSchema(` + * input ReviewInput { + * stars: Int! + * } + * + * type Review { + * stars: Int! + * } + * + * type Query { + * review(input: ReviewInput): Review + * } + * `); + * + * isInputObjectType(schema.getType('ReviewInput')); // => true + * isInputObjectType(schema.getType('Review')); // => false + * ``` + */ +export declare function isInputObjectType(type: unknown): type is GraphQLInputObjectType; +/** + * Returns the value as a GraphQLInputObjectType, or throws if it is not one. + * @param type - The GraphQL type to inspect. + * @returns The value typed as a GraphQLInputObjectType. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertInputObjectType } from 'graphql/type'; + * + * const schema = buildSchema(` + * input ReviewInput { + * stars: Int! + * } + * + * type Review { + * stars: Int! + * } + * + * type Query { + * review(input: ReviewInput): Review + * } + * `); + * + * const inputType = assertInputObjectType(schema.getType('ReviewInput')); + * + * Object.keys(inputType.getFields()); // => ['stars'] + * assertInputObjectType(schema.getType('Review')); // throws an error + * ``` + */ +export declare function assertInputObjectType(type: unknown): GraphQLInputObjectType; +/** + * Returns true when the value is a resolved GraphQL input field definition. + * @param field - Value to inspect. + * @returns True when the value is a GraphQLInputField. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertInputObjectType, isInputField } from 'graphql/type'; + * + * const schema = buildSchema( + * 'input ReviewInput { stars: Int } type Query { ok: Boolean }', + * ); + * const inputField = assertInputObjectType( + * schema.getType('ReviewInput'), + * ).getFields().stars; + * + * isInputField(inputField); // => true + * isInputField(schema.getQueryType()); // => false + * ``` + */ +export declare function isInputField(field: unknown): field is GraphQLInputField; +/** + * Returns the value as a GraphQLInputField, or throws if it is not one. + * @param field - Value to inspect. + * @returns The value typed as a GraphQLInputField. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertInputField, assertInputObjectType } from 'graphql/type'; + * + * const schema = buildSchema( + * 'input ReviewInput { stars: Int } type Query { ok: Boolean }', + * ); + * const inputField = assertInputField( + * assertInputObjectType(schema.getType('ReviewInput')).getFields().stars, + * ); + * + * inputField.name; // => 'stars' + * assertInputField(schema.getQueryType()); // throws an error + * ``` + */ +export declare function assertInputField(field: unknown): GraphQLInputField; +/** + * Returns true when the value is a GraphQLList. + * @param type - The GraphQL type to inspect. + * @returns True when the value is a GraphQLList. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { GraphQLList, GraphQLString, isListType } from 'graphql/type'; + * + * const schema = buildSchema(` + * type Query { + * tags: [String!]! + * } + * `); + * + * const tagsField = schema.getQueryType()?.getFields().tags; + * + * isListType(new GraphQLList(GraphQLString)); // => true + * isListType(GraphQLString); // => false + * isListType(tagsField?.type); // => false + * ``` + */ +export declare function isListType(type: GraphQLInputType): type is GraphQLList<GraphQLInputType>; +/** + * Returns true when the output type is a GraphQLList. + * @param type - The GraphQL output type to inspect. + * @returns True when the output type is a list type. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { getNullableType, isListType } from 'graphql/type'; + * + * const schema = buildSchema(` + * type Query { + * tags: [String!]! + * } + * `); + * + * const tagsField = schema.getQueryType()?.getFields().tags; + * const nullableTagsType = getNullableType(tagsField?.type); + * + * isListType(nullableTagsType); // => true + * ``` + */ +export declare function isListType(type: GraphQLOutputType): type is GraphQLList<GraphQLOutputType>; +/** + * Returns true when the value is a GraphQLList. + * @param type - The value to inspect. + * @returns True when the value is a list type. + * @example + * ```ts + * import { isListType } from 'graphql/type'; + * + * isListType('[String]'); // => false + * isListType(null); // => false + * ``` + */ +export declare function isListType(type: unknown): type is GraphQLList<GraphQLType>; +/** + * Returns the value as a GraphQLList, or throws if it is not one. + * @param type - The GraphQL type to inspect. + * @returns The value typed as a GraphQLList. + * @example + * ```ts + * import { GraphQLList, GraphQLString, assertListType } from 'graphql/type'; + * + * const listType = assertListType(new GraphQLList(GraphQLString)); + * + * listType.ofType; // => GraphQLString + * assertListType(GraphQLString); // throws an error + * ``` + */ +export declare function assertListType(type: unknown): GraphQLList<GraphQLType>; +/** + * Returns true when the value is a GraphQLNonNull. + * @param type - The GraphQL type to inspect. + * @returns True when the value is a GraphQLNonNull. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { GraphQLNonNull, GraphQLString, isNonNullType } from 'graphql/type'; + * + * const schema = buildSchema(` + * type Query { + * name: String! + * nickname: String + * } + * `); + * + * const fields = schema.getQueryType()?.getFields(); + * + * isNonNullType(new GraphQLNonNull(GraphQLString)); // => true + * isNonNullType(fields?.name.type); // => true + * isNonNullType(fields?.nickname.type); // => false + * ``` + */ +export declare function isNonNullType(type: GraphQLInputType): type is GraphQLNonNull<GraphQLNullableInputType>; +/** + * Returns true when the output type is a GraphQLNonNull. + * @param type - The GraphQL output type to inspect. + * @returns True when the output type is a non-null type. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { isNonNullType } from 'graphql/type'; + * + * const schema = buildSchema(` + * type Query { + * name: String! + * nickname: String + * } + * `); + * + * const fields = schema.getQueryType()?.getFields(); + * + * isNonNullType(fields?.name.type); // => true + * isNonNullType(fields?.nickname.type); // => false + * ``` + */ +export declare function isNonNullType(type: GraphQLOutputType): type is GraphQLNonNull<GraphQLNullableOutputType>; +/** + * Returns true when the value is a GraphQLNonNull. + * @param type - The value to inspect. + * @returns True when the value is a non-null type. + * @example + * ```ts + * import { isNonNullType } from 'graphql/type'; + * + * isNonNullType('String!'); // => false + * isNonNullType(null); // => false + * ``` + */ +export declare function isNonNullType(type: unknown): type is GraphQLNonNull<GraphQLNullableType>; +/** + * Returns the value as a GraphQLNonNull, or throws if it is not one. + * @param type - The GraphQL type to inspect. + * @returns The value typed as a GraphQLNonNull. + * @example + * ```ts + * import { GraphQLNonNull, GraphQLString, assertNonNullType } from 'graphql/type'; + * + * const nonNullType = assertNonNullType(new GraphQLNonNull(GraphQLString)); + * + * nonNullType.ofType; // => GraphQLString + * assertNonNullType(GraphQLString); // throws an error + * ``` + */ +export declare function assertNonNullType(type: unknown): GraphQLNonNull<GraphQLNullableType>; +/** These types may be used as input types for arguments and directives. */ +export type GraphQLNullableInputType = GraphQLNamedInputType | GraphQLList<GraphQLInputType>; +/** These types may be used as input types for arguments and directives. */ +export type GraphQLInputType = GraphQLNullableInputType | GraphQLNonNull<GraphQLNullableInputType>; +/** + * Returns true when the value can be used as a GraphQL input type. + * @param type - The GraphQL type to inspect. + * @returns True when the value can be used as a GraphQL input type. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { isInputType } from 'graphql/type'; + * + * const schema = buildSchema(` + * input ReviewInput { + * stars: Int! + * } + * + * type Review { + * stars: Int! + * } + * + * type Query { + * review(input: ReviewInput): Review + * } + * `); + * + * isInputType(schema.getType('ReviewInput')); // => true + * isInputType(schema.getType('Review')); // => false + * ``` + */ +export declare function isInputType(type: unknown): type is GraphQLInputType; +/** + * Returns the value as a GraphQL input type, or throws if it is not one. + * @param type - The GraphQL type to inspect. + * @returns The value typed as a GraphQL input type. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertInputType } from 'graphql/type'; + * + * const schema = buildSchema(` + * input ReviewInput { + * stars: Int! + * } + * + * type Review { + * stars: Int! + * } + * + * type Query { + * review(input: ReviewInput): Review + * } + * `); + * + * const inputType = assertInputType(schema.getType('ReviewInput')); + * + * inputType.toString(); // => 'ReviewInput' + * assertInputType(schema.getType('Review')); // throws an error + * ``` + */ +export declare function assertInputType(type: unknown): GraphQLInputType; +/** These types may be used as output types as the result of fields. */ +export type GraphQLNullableOutputType = GraphQLNamedOutputType | GraphQLList<GraphQLOutputType>; +/** These types may be used as output types as the result of fields. */ +export type GraphQLOutputType = GraphQLNullableOutputType | GraphQLNonNull<GraphQLNullableOutputType>; +/** + * Returns true when the value can be used as a GraphQL output type. + * @param type - The GraphQL type to inspect. + * @returns True when the value can be used as a GraphQL output type. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { isOutputType } from 'graphql/type'; + * + * const schema = buildSchema(` + * input ReviewInput { + * stars: Int! + * } + * + * type Review { + * stars: Int! + * } + * + * type Query { + * review(input: ReviewInput): Review + * } + * `); + * + * isOutputType(schema.getType('Review')); // => true + * isOutputType(schema.getType('ReviewInput')); // => false + * ``` + */ +export declare function isOutputType(type: unknown): type is GraphQLOutputType; +/** + * Returns the value as a GraphQL output type, or throws if it is not one. + * @param type - The GraphQL type to inspect. + * @returns The value typed as a GraphQL output type. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertOutputType } from 'graphql/type'; + * + * const schema = buildSchema(` + * input ReviewInput { + * stars: Int! + * } + * + * type Review { + * stars: Int! + * } + * + * type Query { + * review(input: ReviewInput): Review + * } + * `); + * + * const outputType = assertOutputType(schema.getType('Review')); + * + * outputType.toString(); // => 'Review' + * assertOutputType(schema.getType('ReviewInput')); // throws an error + * ``` + */ +export declare function assertOutputType(type: unknown): GraphQLOutputType; +/** These types may describe types which may be leaf values. */ +export type GraphQLLeafType = GraphQLScalarType | GraphQLEnumType; +/** + * Returns true when the value is a GraphQL scalar or enum type. + * @param type - The GraphQL type to inspect. + * @returns True when the value is a GraphQL scalar or enum type. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { isLeafType } from 'graphql/type'; + * + * const schema = buildSchema(` + * enum Episode { + * NEW_HOPE + * } + * + * type Review { + * stars: Int! + * } + * + * type Query { + * episode: Episode + * review: Review + * } + * `); + * + * isLeafType(schema.getType('Episode')); // => true + * isLeafType(schema.getType('String')); // => true + * isLeafType(schema.getType('Review')); // => false + * ``` + */ +export declare function isLeafType(type: unknown): type is GraphQLLeafType; +/** + * Returns the value as a GraphQL leaf type, or throws if it is not one. + * @param type - The GraphQL type to inspect. + * @returns The value typed as a GraphQL leaf type. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertLeafType } from 'graphql/type'; + * + * const schema = buildSchema(` + * enum Episode { + * NEW_HOPE + * } + * + * type Review { + * stars: Int! + * } + * + * type Query { + * episode: Episode + * review: Review + * } + * `); + * + * const episodeType = assertLeafType(schema.getType('Episode')); + * + * episodeType.toString(); // => 'Episode' + * assertLeafType(schema.getType('Review')); // throws an error + * ``` + */ +export declare function assertLeafType(type: unknown): GraphQLLeafType; +/** These types may describe the parent context of a selection set. */ +export type GraphQLCompositeType = GraphQLObjectType | GraphQLInterfaceType | GraphQLUnionType; +/** + * Returns true when the value is a GraphQL object, interface, or union type. + * @param type - The GraphQL type to inspect. + * @returns True when the value is a GraphQL object, interface, or union type. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { isCompositeType } from 'graphql/type'; + * + * const schema = buildSchema(` + * interface Node { + * id: ID! + * } + * + * type User implements Node { + * id: ID! + * } + * + * union SearchResult = User + * + * type Query { + * node: Node + * search: [SearchResult] + * } + * `); + * + * isCompositeType(schema.getType('User')); // => true + * isCompositeType(schema.getType('Node')); // => true + * isCompositeType(schema.getType('SearchResult')); // => true + * isCompositeType(schema.getType('String')); // => false + * ``` + */ +export declare function isCompositeType(type: unknown): type is GraphQLCompositeType; +/** + * Returns the value as a GraphQL composite type, or throws if it is not one. + * @param type - The GraphQL type to inspect. + * @returns The value typed as a GraphQL composite type. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertCompositeType } from 'graphql/type'; + * + * const schema = buildSchema(` + * interface Node { + * id: ID! + * } + * + * type User implements Node { + * id: ID! + * } + * + * type Query { + * node: Node + * } + * `); + * + * const userType = assertCompositeType(schema.getType('User')); + * + * userType.toString(); // => 'User' + * assertCompositeType(schema.getType('String')); // throws an error + * ``` + */ +export declare function assertCompositeType(type: unknown): GraphQLCompositeType; +/** These types may describe the parent context of a selection set. */ +export type GraphQLAbstractType = GraphQLInterfaceType | GraphQLUnionType; +/** + * Returns true when the value is a GraphQL interface or union type. + * @param type - The GraphQL type to inspect. + * @returns True when the value is a GraphQL interface or union type. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { isAbstractType } from 'graphql/type'; + * + * const schema = buildSchema(` + * interface Node { + * id: ID! + * } + * + * type User implements Node { + * id: ID! + * } + * + * union SearchResult = User + * + * type Query { + * node: Node + * search: [SearchResult] + * } + * `); + * + * isAbstractType(schema.getType('Node')); // => true + * isAbstractType(schema.getType('SearchResult')); // => true + * isAbstractType(schema.getType('User')); // => false + * ``` + */ +export declare function isAbstractType(type: unknown): type is GraphQLAbstractType; +/** + * Returns the value as a GraphQL abstract type, or throws if it is not one. + * @param type - The GraphQL type to inspect. + * @returns The value typed as a GraphQL abstract type. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertAbstractType } from 'graphql/type'; + * + * const schema = buildSchema(` + * interface Node { + * id: ID! + * } + * + * type User implements Node { + * id: ID! + * } + * + * type Query { + * node: Node + * } + * `); + * + * const nodeType = assertAbstractType(schema.getType('Node')); + * + * nodeType.toString(); // => 'Node' + * assertAbstractType(schema.getType('User')); // throws an error + * ``` + */ +export declare function assertAbstractType(type: unknown): GraphQLAbstractType; +/** + * List Type Wrapper + * + * A list is a wrapping type which points to another type. + * Lists are often created within the context of defining the fields of + * an object type. + * @typeParam T - The GraphQL type wrapped by this list type. + * @example + * ```ts + * const PersonType = new GraphQLObjectType({ + * name: 'Person', + * fields: () => ({ + * parents: { type: new GraphQLList(PersonType) }, + * children: { type: new GraphQLList(PersonType) }, + * }), + * }); + * ``` + */ +export declare class GraphQLList<T extends GraphQLType> implements GraphQLSchemaElement { + /** The type wrapped by this list or non-null type. */ + readonly ofType: T; + private readonly __GraphQLListTypeBrand; + /** + * Creates a GraphQLList instance. + * @param ofType - The type to wrap. + * @example + * ```ts + * import { GraphQLList, GraphQLString } from 'graphql/type'; + * + * const stringList = new GraphQLList(GraphQLString); + * + * stringList.ofType; // => GraphQLString + * String(stringList); // => '[String]' + * ``` + */ + constructor(ofType: T); + /** + * Returns the value used by `Object.prototype.toString`. + * @returns The built-in string tag for this object. + */ + get [Symbol.toStringTag](): string; + /** + * Returns this wrapping type as a GraphQL type-reference string. + * @returns The GraphQL type-reference string. + * @example + * ```ts + * import { GraphQLList, GraphQLNonNull, GraphQLString } from 'graphql/type'; + * + * const stringList = new GraphQLList(GraphQLString); + * const requiredStringList = new GraphQLList(new GraphQLNonNull(GraphQLString)); + * + * stringList.toString(); // => '[String]' + * requiredStringList.toString(); // => '[String!]' + * ``` + */ + toString(): string; + /** + * Returns the JSON representation used when this object is serialized. + * @returns The JSON-serializable representation. + * @example + * ```ts + * import { GraphQLList, GraphQLString } from 'graphql/type'; + * + * const stringList = new GraphQLList(GraphQLString); + * + * stringList.toJSON(); // => '[String]' + * JSON.stringify({ type: stringList }); // => '{"type":"[String]"}' + * ``` + */ + toJSON(): string; +} +/** + * Non-Null Type Wrapper + * + * A non-null is a wrapping type which points to another type. + * Non-null types enforce that their values are never null and can ensure + * an error is raised if this ever occurs during a request. It is useful for + * fields which you can make a strong guarantee on non-nullability, for example + * usually the id field of a database row will never be null. + * @typeParam T - The nullable GraphQL type wrapped by this non-null type. + * @example + * ```ts + * const RowType = new GraphQLObjectType({ + * name: 'Row', + * fields: () => ({ + * id: { type: new GraphQLNonNull(GraphQLString) }, + * }), + * }); + * ``` + * + * Note: the enforcement of non-nullability occurs within the executor. + */ +export declare class GraphQLNonNull<T extends GraphQLNullableType> implements GraphQLSchemaElement { + /** The type wrapped by this list or non-null type. */ + readonly ofType: T; + private readonly __GraphQLNonNullTypeBrand; + /** + * Creates a GraphQLNonNull instance. + * @param ofType - The type to wrap. + * @example + * ```ts + * import { GraphQLNonNull, GraphQLString } from 'graphql/type'; + * + * const requiredString = new GraphQLNonNull(GraphQLString); + * + * requiredString.ofType; // => GraphQLString + * String(requiredString); // => 'String!' + * ``` + */ + constructor(ofType: T); + /** + * Returns the value used by `Object.prototype.toString`. + * @returns The built-in string tag for this object. + */ + get [Symbol.toStringTag](): string; + /** + * Returns this wrapping type as a GraphQL type-reference string. + * @returns The GraphQL type-reference string. + * @example + * ```ts + * import { GraphQLList, GraphQLNonNull, GraphQLString } from 'graphql/type'; + * + * const requiredString = new GraphQLNonNull(GraphQLString); + * const requiredStringList = new GraphQLNonNull(new GraphQLList(GraphQLString)); + * + * requiredString.toString(); // => 'String!' + * requiredStringList.toString(); // => '[String]!' + * ``` + */ + toString(): string; + /** + * Returns the JSON representation used when this object is serialized. + * @returns The JSON-serializable representation. + * @example + * ```ts + * import { GraphQLNonNull, GraphQLString } from 'graphql/type'; + * + * const requiredString = new GraphQLNonNull(GraphQLString); + * + * requiredString.toJSON(); // => 'String!' + * JSON.stringify({ type: requiredString }); // => '{"type":"String!"}' + * ``` + */ + toJSON(): string; +} +/** These types wrap and modify other types */ +export type GraphQLWrappingType = GraphQLList<GraphQLType> | GraphQLNonNull<GraphQLNullableType>; +/** + * Returns true when the value is a GraphQL list or non-null wrapper type. + * @param type - The GraphQL type to inspect. + * @returns True when the value is a GraphQL list or non-null wrapper type. + * @example + * ```ts + * import { + * GraphQLList, + * GraphQLNonNull, + * GraphQLString, + * isWrappingType, + * } from 'graphql/type'; + * + * isWrappingType(new GraphQLList(GraphQLString)); // => true + * isWrappingType(new GraphQLNonNull(GraphQLString)); // => true + * isWrappingType(GraphQLString); // => false + * ``` + */ +export declare function isWrappingType(type: unknown): type is GraphQLWrappingType; +/** + * Returns the value as a GraphQL wrapping type, or throws if it is not one. + * @param type - The GraphQL type to inspect. + * @returns The value typed as a GraphQL wrapping type. + * @example + * ```ts + * import { GraphQLList, GraphQLString, assertWrappingType } from 'graphql/type'; + * + * const wrappingType = assertWrappingType(new GraphQLList(GraphQLString)); + * + * wrappingType.toString(); // => '[String]' + * assertWrappingType(GraphQLString); // throws an error + * ``` + */ +export declare function assertWrappingType(type: unknown): GraphQLWrappingType; +/** These types can all accept null as a value. */ +export type GraphQLNullableType = GraphQLNamedType | GraphQLList<GraphQLType>; +/** + * Returns true when the value is a GraphQL type that can accept null. + * @param type - The GraphQL type to inspect. + * @returns True when the value is a GraphQL type that can accept null. + * @example + * ```ts + * import { GraphQLNonNull, GraphQLString, isNullableType } from 'graphql/type'; + * + * isNullableType(GraphQLString); // => true + * isNullableType(new GraphQLNonNull(GraphQLString)); // => false + * isNullableType(null); // => false + * ``` + */ +export declare function isNullableType(type: unknown): type is GraphQLNullableType; +/** + * Returns the value as a nullable GraphQL type, or throws if it is not one. + * @param type - The GraphQL type to inspect. + * @returns The value typed as a nullable GraphQL type. + * @example + * ```ts + * import { + * GraphQLNonNull, + * GraphQLString, + * assertNullableType, + * } from 'graphql/type'; + * + * const nullableType = assertNullableType(GraphQLString); + * + * nullableType; // => GraphQLString + * assertNullableType(new GraphQLNonNull(GraphQLString)); // throws an error + * ``` + */ +export declare function assertNullableType(type: unknown): GraphQLNullableType; +/** + * Returns the nullable type. + * @param type - The GraphQL type to inspect. + * @returns The nullable type after removing one non-null wrapper, if present. + * @example + * ```ts + * import { getNullableType } from 'graphql/type'; + * + * getNullableType(null); // => undefined + * getNullableType(undefined); // => undefined + * ``` + */ +export declare function getNullableType(type: undefined | null): void; +/** + * Returns the nullable type after removing one non-null wrapper. + * @param type - A nullable type or non-null wrapper. + * @returns The nullable type after removing one non-null wrapper, if present. + * @typeParam T - The nullable GraphQL type returned after removing one non-null wrapper. + * @example + * ```ts + * import { + * GraphQLList, + * GraphQLNonNull, + * GraphQLString, + * getNullableType, + * } from 'graphql/type'; + * + * const requiredString = new GraphQLNonNull(GraphQLString); + * const stringList = new GraphQLList(GraphQLString); + * + * getNullableType(requiredString); // => GraphQLString + * getNullableType(stringList); // => stringList + * ``` + */ +export declare function getNullableType<T extends GraphQLNullableType>(type: T | GraphQLNonNull<T>): T; +/** + * Returns the nullable type after removing one non-null wrapper. + * @param type - The GraphQL type to inspect. + * @returns The nullable type after removing one non-null wrapper, if present. + * @example + * ```ts + * import { + * GraphQLList, + * GraphQLNonNull, + * GraphQLString, + * getNullableType, + * } from 'graphql/type'; + * + * const requiredStringList = new GraphQLNonNull(new GraphQLList(GraphQLString)); + * + * getNullableType(requiredStringList).toString(); // => '[String]' + * getNullableType(GraphQLString); // => GraphQLString + * ``` + */ +export declare function getNullableType(type: Maybe<GraphQLType>): GraphQLNullableType | undefined; +/** These named types do not include modifiers like List or NonNull. */ +export type GraphQLNamedType = GraphQLNamedInputType | GraphQLNamedOutputType; +/** A named GraphQL type that can be used as an input type. */ +export type GraphQLNamedInputType = GraphQLScalarType | GraphQLEnumType | GraphQLInputObjectType; +/** A named GraphQL type that can be used as an output type. */ +export type GraphQLNamedOutputType = GraphQLScalarType | GraphQLObjectType | GraphQLInterfaceType | GraphQLUnionType | GraphQLEnumType; +/** + * Returns true when the value is a GraphQL named type. + * @param type - The GraphQL type to inspect. + * @returns True when the value is a GraphQL named type. + * @example + * ```ts + * import { GraphQLList, GraphQLString, isNamedType } from 'graphql/type'; + * + * isNamedType(GraphQLString); // => true + * isNamedType(new GraphQLList(GraphQLString)); // => false + * isNamedType(null); // => false + * ``` + */ +export declare function isNamedType(type: unknown): type is GraphQLNamedType; +/** + * Returns the value as a GraphQL named type, or throws if it is not one. + * @param type - The GraphQL type to inspect. + * @returns The value typed as a GraphQL named type. + * @example + * ```ts + * import { GraphQLList, GraphQLString, assertNamedType } from 'graphql/type'; + * + * const namedType = assertNamedType(GraphQLString); + * + * namedType.name; // => 'String' + * assertNamedType(new GraphQLList(GraphQLString)); // throws an error + * ``` + */ +export declare function assertNamedType(type: unknown): GraphQLNamedType; +/** + * Returns the named type. + * @param type - The GraphQL type to inspect. + * @returns The named type after unwrapping all list and non-null wrappers. + * @example + * ```ts + * import { getNamedType } from 'graphql/type'; + * + * getNamedType(null); // => undefined + * getNamedType(undefined); // => undefined + * ``` + */ +export declare function getNamedType(type: undefined | null): void; +/** + * Returns the named input type after unwrapping all list and non-null wrappers. + * @param type - The GraphQL input type to inspect. + * @returns The named input type after unwrapping all wrappers. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { getNamedType } from 'graphql/type'; + * + * const schema = buildSchema(` + * input ReviewInput { + * stars: Int! + * } + * + * type Query { + * review(input: [ReviewInput!]!): Boolean + * } + * `); + * + * const inputArg = schema.getQueryType()?.getFields().review.args[0]; + * + * getNamedType(inputArg?.type).toString(); // => 'ReviewInput' + * ``` + */ +export declare function getNamedType(type: GraphQLInputType): GraphQLNamedInputType; +/** + * Returns the named output type after unwrapping all list and non-null wrappers. + * @param type - The GraphQL output type to inspect. + * @returns The named output type after unwrapping all wrappers. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { getNamedType } from 'graphql/type'; + * + * const schema = buildSchema(` + * type User { + * name: String + * } + * + * type Query { + * users: [User!]! + * } + * `); + * + * const usersField = schema.getQueryType()?.getFields().users; + * + * getNamedType(usersField?.type).toString(); // => 'User' + * ``` + */ +export declare function getNamedType(type: GraphQLOutputType): GraphQLNamedOutputType; +/** + * Returns the named type after unwrapping all list and non-null wrappers. + * @param type - The GraphQL type to inspect. + * @returns The named type after unwrapping all wrappers. + * @example + * ```ts + * import { + * GraphQLList, + * GraphQLNonNull, + * GraphQLString, + * getNamedType, + * } from 'graphql/type'; + * + * const nestedType = new GraphQLNonNull( + * new GraphQLList(new GraphQLNonNull(GraphQLString)), + * ); + * + * getNamedType(nestedType); // => GraphQLString + * ``` + */ +export declare function getNamedType(type: GraphQLType): GraphQLNamedType; +/** + * Returns the named type after unwrapping all list and non-null wrappers. + * @param type - The GraphQL type to inspect. + * @returns The named type after unwrapping all wrappers, or undefined for nullish input. + * @example + * ```ts + * import { GraphQLList, GraphQLString, getNamedType } from 'graphql/type'; + * + * getNamedType(new GraphQLList(GraphQLString)); // => GraphQLString + * getNamedType(undefined); // => undefined + * ``` + */ +export declare function getNamedType(type: Maybe<GraphQLType>): GraphQLNamedType | undefined; +interface GraphQLSchemaElement { + toString: () => string; + toJSON: () => string; +} +/** + * Used while defining GraphQL types to allow for circular references in + * otherwise immutable type definitions. + * @typeParam T - The element type returned by the thunk or array. + */ +export type ThunkReadonlyArray<T> = (() => ReadonlyArray<T>) | ReadonlyArray<T>; +/** + * A thunk that resolves to an object map. + * @typeParam T - Value type stored in the object map. + */ +export type ThunkObjMap<T> = (() => ObjMap<T>) | ObjMap<T>; +/** + * Resolves a thunked readonly array. + * @param thunk - The thunk or value to resolve. + * @returns The resolved readonly array. + * @typeParam T - The element type resolved from the thunk or array. + * @example + * ```ts + * import { GraphQLString, resolveReadonlyArrayThunk } from 'graphql/type'; + * + * const lazyFields = resolveReadonlyArrayThunk(() => [GraphQLString]); + * const fields = resolveReadonlyArrayThunk([GraphQLString]); + * + * lazyFields; // => [GraphQLString] + * fields; // => [GraphQLString] + * ``` + */ +export declare function resolveReadonlyArrayThunk<T>(thunk: ThunkReadonlyArray<T>): ReadonlyArray<T>; +/** + * Resolves a thunked object map. + * @param thunk - The thunk or value to resolve. + * @returns The resolved object map. + * @typeParam T - The object-map value type resolved from the thunk or map. + * @example + * ```ts + * import { GraphQLString, resolveObjMapThunk } from 'graphql/type'; + * + * const lazyFields = resolveObjMapThunk(() => ({ name: GraphQLString })); + * const fields = resolveObjMapThunk({ name: GraphQLString }); + * + * lazyFields.name; // => GraphQLString + * fields.name; // => GraphQLString + * ``` + */ +export declare function resolveObjMapThunk<T>(thunk: ThunkObjMap<T>): ObjMap<T>; +/** + * Custom extensions + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLScalarTypeExtensions { + [attributeName: string | symbol]: unknown; +} +/** + * Scalar Type Definition + * + * Scalar types define the leaf values of a GraphQL response and the input + * values accepted by arguments and input object fields. A scalar type has a + * name and coercion functions that validate and convert runtime values and + * GraphQL literals. + * + * If a type's coerceOutputValue function returns `null` or does not return a + * value (i.e. it returns `undefined`) then an error will be raised and a + * `null` value will be returned in the response. Prefer validating inputs + * before execution so clients receive input diagnostics before result coercion + * fails. + * Custom scalar behavior is defined via the following functions: + * + * - coerceOutputValue(value): Implements "Result Coercion". Given an internal value, + * produces an external value valid for this type. Returns undefined or + * throws an error to indicate invalid values. + * + * - coerceInputValue(value): Implements "Input Coercion" for values. Given an + * external value (for example, variable values), produces an internal value + * valid for this type. Returns undefined or throws an error to indicate + * invalid values. + * + * - coerceInputLiteral(ast): Implements "Input Coercion" for constant literals. + * Given a GraphQL literal (AST) (for example, an argument value), produces + * an internal value valid for this type. Returns undefined or throws an + * error to indicate invalid values. + * + * - valueToLiteral(value): Converts an external value to a GraphQL + * literal (AST). Returns undefined or throws an error to indicate + * invalid values. + * + * Deprecated, to be removed in v18: + * + * - serialize(value): Implements "Result Coercion". Renamed to + * `coerceOutputValue()`. + * + * - parseValue(value): Implements "Input Coercion" for values. Renamed to + * `coerceInputValue()`. + * + * - parseLiteral(ast): Implements "Input Coercion" for literals including + * non-specified replacement of variables embedded within complex scalars. + * Replaced by the combination of the `replaceVariables()` utility and the + * `coerceInputLiteral()` method. + * @typeParam TInternal - Internal runtime representation for this scalar. + * @typeParam TExternal - External representation accepted from or returned to callers. + * @example + * ```ts + * import { GraphQLScalarType, Kind } from 'graphql'; + * + * const ensureOdd = (value) => { + * if (!Number.isFinite(value)) { + * throw new Error( + * `Scalar "Odd" cannot represent "${value}" since it is not a finite number.`, + * ); + * } + * + * if (value % 2 === 0) { + * throw new Error( + * `Scalar "Odd" cannot represent "${value}" since it is even.`, + * ); + * } + * + * return value; + * }; + * + * const OddType = new GraphQLScalarType({ + * name: 'Odd', + * coerceOutputValue: (value) => { + * return ensureOdd(value); + * }, + * coerceInputValue: (value) => { + * return ensureOdd(value); + * }, + * valueToLiteral: (value) => { + * return { kind: Kind.INT, value: String(ensureOdd(value)) }; + * }, + * }); + * ``` + */ +export declare class GraphQLScalarType<TInternal = unknown, TExternal = TInternal> implements GraphQLSchemaElement { + /** The GraphQL name for this schema element. */ + name: string; + /** Human-readable description for this schema element, if provided. */ + description: Maybe<string>; + /** URL identifying the behavior specified for this custom scalar. */ + specifiedByURL: Maybe<string>; + /** + * Deprecated legacy serializer used to convert internal values for response + * output. Use `coerceOutputValue()` instead. + * @deprecated use `coerceOutputValue()` instead, `serialize()` will be removed in v18 + */ + serialize: GraphQLScalarSerializer<TExternal>; + /** + * Deprecated legacy parser used to convert externally provided input values. + * Use `coerceInputValue()` instead. + * @deprecated use `coerceInputValue()` instead, `parseValue()` will be removed in v18 + */ + parseValue: GraphQLScalarValueParser<TInternal>; + /** + * Deprecated legacy parser used to convert externally provided input + * literals. Use `replaceVariables()` and `coerceInputLiteral()` instead. + * @deprecated use `replaceVariables()` and `coerceInputLiteral()` instead, `parseLiteral()` will be removed in v18 + */ + parseLiteral: GraphQLScalarLiteralParser<TInternal>; + /** Coercer used to convert internal scalar values for response output. */ + coerceOutputValue: GraphQLScalarOutputValueCoercer<TExternal>; + /** Coercer used to convert externally provided scalar input values. */ + coerceInputValue: GraphQLScalarInputValueCoercer<TInternal>; + /** Coercer used to convert GraphQL scalar input literals. */ + coerceInputLiteral: GraphQLScalarInputLiteralCoercer<TInternal> | undefined; + /** Converter used to produce GraphQL literals from runtime input values. */ + valueToLiteral: GraphQLScalarValueToLiteral | undefined; + /** Custom extension fields reserved for users. */ + extensions: Readonly<GraphQLScalarTypeExtensions>; + /** AST node from which this schema element was built, if available. */ + astNode: Maybe<ScalarTypeDefinitionNode>; + /** AST extension nodes applied to this schema element. */ + extensionASTNodes: ReadonlyArray<ScalarTypeExtensionNode>; + /** + * Creates a GraphQLScalarType instance. + * @param config - Configuration describing this object. + * @example + * ```ts + * import { Kind, parse } from 'graphql/language'; + * import { GraphQLScalarType } from 'graphql/type'; + * + * const document = parse(` + * "Odd integer values." + * scalar Odd @specifiedBy(url: "https://example.com/odd") + * + * extend scalar Odd @specifiedBy(url: "https://example.com/odd-v2") + * `); + * + * const Odd = new GraphQLScalarType({ + * name: 'Odd', + * description: 'Odd integer values.', + * specifiedByURL: 'https://example.com/odd', + * coerceOutputValue: (value) => { + * if (typeof value !== 'number' || value % 2 === 0) { + * throw new TypeError('Odd can only produce odd numbers.'); + * } + * return value; + * }, + * coerceInputValue: (value) => { + * if (typeof value !== 'number' || value % 2 === 0) { + * throw new TypeError('Odd can only accept odd numbers.'); + * } + * return value; + * }, + * coerceInputLiteral: (ast) => { + * if (ast.kind !== Kind.INT) { + * throw new TypeError('Odd can only accept integer literals.'); + * } + * const value = Number(ast.value); + * if (value % 2 === 0) { + * throw new TypeError('Odd can only accept odd integer literals.'); + * } + * return value; + * }, + * valueToLiteral: (value) => { + * return { kind: Kind.INT, value: String(ensureOdd(value)) }; + * }, + * extensions: { numeric: true }, + * astNode: document.definitions[0], + * extensionASTNodes: [document.definitions[1]], + * }); + * + * Odd.description; // => 'Odd integer values.' + * Odd.specifiedByURL; // => 'https://example.com/odd' + * Odd.coerceOutputValue(3); // => 3 + * Odd.coerceInputValue(5); // => 5 + * Odd.extensions; // => { numeric: true } + * ``` + */ + constructor(config: Readonly<GraphQLScalarTypeConfig<TInternal, TExternal>>); + /** + * Returns the value used by `Object.prototype.toString`. + * @returns The built-in string tag for this object. + */ + get [Symbol.toStringTag](): string; + /** + * Returns a normalized configuration object for this object. + * @returns A configuration object that can be used to recreate this object. + * @example + * ```ts + * import { GraphQLScalarType } from 'graphql/type'; + * + * const Url = new GraphQLScalarType({ + * name: 'Url', + * description: 'An absolute URL string.', + * specifiedByURL: 'https://url.spec.whatwg.org/', + * }); + * + * const config = Url.toConfig(); + * const UrlCopy = new GraphQLScalarType(config); + * + * config.name; // => 'Url' + * config.specifiedByURL; // => 'https://url.spec.whatwg.org/' + * UrlCopy.name; // => Url.name + * ``` + */ + toConfig(): GraphQLScalarTypeNormalizedConfig<TInternal, TExternal>; + /** + * Returns the schema coordinate identifying this scalar type. + * @returns The schema coordinate for this scalar type. + * @example + * ```ts + * import { GraphQLScalarType } from 'graphql/type'; + * + * const DateTime = new GraphQLScalarType({ name: 'DateTime' }); + * + * DateTime.toString(); // => 'DateTime' + * String(DateTime); // => 'DateTime' + * ``` + */ + toString(): string; + /** + * Returns the JSON representation used when this object is serialized. + * @returns The JSON-serializable representation. + * @example + * ```ts + * import { GraphQLScalarType } from 'graphql/type'; + * + * const DateTime = new GraphQLScalarType({ name: 'DateTime' }); + * + * DateTime.toJSON(); // => 'DateTime' + * JSON.stringify({ type: DateTime }); // => '{"type":"DateTime"}' + * ``` + */ + toJSON(): string; +} +/** + * Deprecated function type that serializes a runtime value as a scalar output + * value. Use `GraphQLScalarOutputValueCoercer` instead. + * @typeParam TExternal - External representation accepted from or returned to callers. + * @deprecated Use GraphQLScalarOutputValueCoercer instead. Will be removed in v18. + */ +export type GraphQLScalarSerializer<TExternal> = (outputValue: unknown) => TExternal; +/** + * Function used to coerce internal scalar values for response output. + * @typeParam TExternal - External representation accepted from or returned to callers. + */ +export type GraphQLScalarOutputValueCoercer<TExternal> = (outputValue: unknown) => TExternal; +/** + * Deprecated function type that parses a runtime input value as a scalar input + * value. Use `GraphQLScalarInputValueCoercer` instead. + * @typeParam TInternal - Internal runtime representation for this scalar. + * @deprecated Use GraphQLScalarInputValueCoercer instead. Will be removed in v18. + */ +export type GraphQLScalarValueParser<TInternal> = (inputValue: unknown) => TInternal; +/** + * Function used to coerce externally provided scalar input values. + * @typeParam TInternal - Internal runtime representation for this scalar. + */ +export type GraphQLScalarInputValueCoercer<TInternal> = (inputValue: unknown) => TInternal; +/** + * Deprecated function type that parses a GraphQL value literal as a scalar + * input value. Use `GraphQLScalarInputLiteralCoercer` instead. + * @typeParam TInternal - Internal runtime representation for this scalar. + * @deprecated Use GraphQLScalarInputLiteralCoercer instead. Will be removed in v18. + */ +export type GraphQLScalarLiteralParser<TInternal> = (valueNode: ValueNode, variables: Maybe<ObjMap<unknown>>) => Maybe<TInternal>; +/** + * Function used to coerce GraphQL scalar input literals. + * @typeParam TInternal - Internal runtime representation for this scalar. + */ +export type GraphQLScalarInputLiteralCoercer<TInternal> = (valueNode: ConstValueNode) => Maybe<TInternal>; +type GraphQLScalarValueToLiteral = (inputValue: unknown) => ConstValueNode | undefined; +/** + * Configuration used to construct a GraphQLScalarType. + * @typeParam TInternal - Internal runtime representation for this scalar. + * @typeParam TExternal - External representation accepted from or returned to callers. + */ +export interface GraphQLScalarTypeConfig<TInternal, TExternal> { + /** The GraphQL name for this schema element. */ + name: string; + /** Human-readable description for this schema element, if provided. */ + description?: Maybe<string>; + /** URL identifying the behavior specified for this custom scalar. */ + specifiedByURL?: Maybe<string>; + /** + * Deprecated legacy serializer used to convert internal values for response + * output. Use `coerceOutputValue()` instead. + * @deprecated use `coerceOutputValue()` instead, `serialize()` will be removed in v18 + */ + serialize?: GraphQLScalarSerializer<TExternal> | undefined; + /** + * Deprecated legacy parser used to convert externally provided input values. + * Use `coerceInputValue()` instead. + * @deprecated use `coerceInputValue()` instead, `parseValue()` will be removed in v18 + */ + parseValue?: GraphQLScalarValueParser<TInternal> | undefined; + /** + * Deprecated legacy parser used to convert externally provided input + * literals. Use `replaceVariables()` and `coerceInputLiteral()` instead. + * @deprecated use `replaceVariables()` and `coerceInputLiteral()` instead, `parseLiteral()` will be removed in v18 + */ + parseLiteral?: GraphQLScalarLiteralParser<TInternal> | undefined; + /** Coerces an internal value to include in a response. */ + coerceOutputValue?: GraphQLScalarOutputValueCoercer<TExternal> | undefined; + /** Coerces an externally provided value to use as an input. */ + coerceInputValue?: GraphQLScalarInputValueCoercer<TInternal> | undefined; + /** Coerces an externally provided const literal value to use as an input. */ + coerceInputLiteral?: GraphQLScalarInputLiteralCoercer<TInternal> | undefined; + /** Translates an externally provided value to a literal (AST). */ + valueToLiteral?: GraphQLScalarValueToLiteral | undefined; + /** Custom extension fields reserved for users. */ + extensions?: Maybe<Readonly<GraphQLScalarTypeExtensions>>; + /** AST node from which this schema element was built, if available. */ + astNode?: Maybe<ScalarTypeDefinitionNode>; + /** AST extension nodes applied to this schema element. */ + extensionASTNodes?: Maybe<ReadonlyArray<ScalarTypeExtensionNode>>; +} +interface GraphQLScalarTypeNormalizedConfig<TInternal, TExternal> extends GraphQLScalarTypeConfig<TInternal, TExternal> { + serialize: GraphQLScalarSerializer<TExternal>; + parseValue: GraphQLScalarValueParser<TInternal>; + parseLiteral: GraphQLScalarLiteralParser<TInternal>; + coerceOutputValue: GraphQLScalarOutputValueCoercer<TExternal>; + coerceInputValue: GraphQLScalarInputValueCoercer<TInternal>; + coerceInputLiteral: GraphQLScalarInputLiteralCoercer<TInternal> | undefined; + extensions: Readonly<GraphQLScalarTypeExtensions>; + extensionASTNodes: ReadonlyArray<ScalarTypeExtensionNode>; +} +/** + * Custom extensions + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + * We've provided these template arguments because this is an open type and + * you may find them useful. + * @typeParam _TSource - Reserved source type parameter for extension typing. + * @typeParam _TContext - Reserved context type parameter for extension typing. + */ +export interface GraphQLObjectTypeExtensions<_TSource = any, _TContext = any> { + [attributeName: string | symbol]: unknown; +} +/** + * Object Type Definition + * + * Almost all of the GraphQL types you define will be object types. Object types + * have a name, but most importantly describe their fields. + * @typeParam TSource - Source object type passed to resolvers. + * @typeParam TContext - Context object type passed to resolvers. + * @typeParam TAbstract - Runtime value type used for abstract type resolution. + * @example + * ```ts + * const AddressType = new GraphQLObjectType({ + * name: 'Address', + * fields: { + * street: { type: GraphQLString }, + * number: { type: GraphQLInt }, + * formatted: { + * type: GraphQLString, + * resolve: (obj) => { + * return obj.number + ' ' + obj.street; + * }, + * }, + * }, + * }); + * ``` + * @example + * When two types need to refer to each other, or a type needs to refer to + * itself in a field, you can use a function expression (aka a closure or a + * thunk) to supply the fields lazily. + * + * ```ts + * const PersonType = new GraphQLObjectType({ + * name: 'Person', + * fields: () => ({ + * name: { type: GraphQLString }, + * bestFriend: { type: PersonType }, + * }), + * }); + * ``` + */ +export declare class GraphQLObjectType<TSource = any, TContext = any, TAbstract = any> implements GraphQLSchemaElement { + /** The GraphQL name for this schema element. */ + name: string; + /** Human-readable description for this schema element, if provided. */ + description: Maybe<string>; + /** Predicate used to determine whether a runtime value belongs to this object type. */ + isTypeOf: Maybe<GraphQLIsTypeOfFn<TAbstract, TContext>>; + /** Custom extension fields reserved for users. */ + extensions: Readonly<GraphQLObjectTypeExtensions<TSource, TContext>>; + /** AST node from which this schema element was built, if available. */ + astNode: Maybe<ObjectTypeDefinitionNode>; + /** AST extension nodes applied to this schema element. */ + extensionASTNodes: ReadonlyArray<ObjectTypeExtensionNode>; + private _fields; + private _interfaces; + /** + * Creates a GraphQLObjectType instance. + * @param config - Configuration describing this object. + * @example + * ```ts + * // Configure an object type with interfaces, fields, arguments, and metadata. + * import { parse } from 'graphql/language'; + * import { + * GraphQLID, + * GraphQLInterfaceType, + * GraphQLNonNull, + * GraphQLObjectType, + * GraphQLString, + * } from 'graphql/type'; + * + * const document = parse(` + * type User implements Node { + * id: ID! + * name(format: String = "short"): String + * } + * + * extend type User { + * displayName: String + * } + * `); + * const definition = document.definitions[0]; + * const nameField = definition.fields[1]; + * const formatArg = nameField.arguments[0]; + * + * const Node = new GraphQLInterfaceType({ + * name: 'Node', + * fields: { + * id: { type: new GraphQLNonNull(GraphQLID) }, + * }, + * }); + * + * const User = new GraphQLObjectType({ + * name: 'User', + * description: 'A registered user.', + * interfaces: [Node], + * fields: { + * id: { type: new GraphQLNonNull(GraphQLID) }, + * name: { + * description: 'The formatted user name.', + * type: GraphQLString, + * args: { + * format: { + * description: 'Controls the name format.', + * type: GraphQLString, + * default: { value: 'short' }, + * deprecationReason: 'Use locale instead.', + * extensions: { public: true }, + * astNode: formatArg, + * }, + * }, + * resolve: (user, { format }) => { + * return format === 'long' ? user.fullName : user.name; + * }, + * deprecationReason: 'Use displayName.', + * extensions: { cacheSeconds: 60 }, + * astNode: nameField, + * }, + * }, + * isTypeOf: (value) => { + * return typeof value === 'object' && value != null && 'id' in value; + * }, + * extensions: { entity: 'User' }, + * astNode: definition, + * extensionASTNodes: [document.definitions[1]], + * }); + * + * User.name; // => 'User' + * User.getInterfaces(); // => [Node] + * Object.keys(User.getFields()); // => ['id', 'name'] + * User.getFields().name.args[0].default.value; // => 'short' + * User.extensions; // => { entity: 'User' } + * ``` + * @example + * ```ts + * // This variant configures a subscription field with subscribe and resolve functions. + * import { GraphQLObjectType, GraphQLString } from 'graphql/type'; + * + * const Subscription = new GraphQLObjectType({ + * name: 'Subscription', + * fields: { + * greeting: { + * type: GraphQLString, + * subscribe: async function* () { + * yield { greeting: 'Hello!' }; + * }, + * resolve: (event) => { + * return event.greeting; + * }, + * }, + * }, + * }); + * + * typeof Subscription.getFields().greeting.subscribe; // => 'function' + * ``` + */ + constructor(config: Readonly<GraphQLObjectTypeConfig<TSource, TContext, TAbstract>>); + /** + * Returns the value used by `Object.prototype.toString`. + * @returns The built-in string tag for this object. + */ + get [Symbol.toStringTag](): string; + /** + * Returns the fields defined by this type. + * @returns The fields keyed by field name. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertObjectType } from 'graphql/type'; + * + * const schema = buildSchema(` + * type User { + * id: ID! + * name: String + * } + * + * type Query { + * viewer: User + * } + * `); + * + * const User = assertObjectType(schema.getType('User')); + * const fields = User.getFields(); + * + * Object.keys(fields); // => ['id', 'name'] + * String(fields.id.type); // => 'ID!' + * ``` + */ + getFields(): GraphQLFieldMap<TSource, TContext>; + /** + * Returns the interfaces implemented by this type. + * @returns The implemented interfaces. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertObjectType } from 'graphql/type'; + * + * const schema = buildSchema(` + * interface Node { + * id: ID! + * } + * + * type User implements Node { + * id: ID! + * } + * + * type Query { + * viewer: User + * } + * `); + * + * const User = assertObjectType(schema.getType('User')); + * + * User.getInterfaces().map((type) => type.name); // => ['Node'] + * ``` + */ + getInterfaces(): ReadonlyArray<GraphQLInterfaceType>; + /** + * Returns a normalized configuration object for this object. + * @returns A configuration object that can be used to recreate this object. + * @example + * ```ts + * import { GraphQLObjectType, GraphQLString } from 'graphql/type'; + * + * const User = new GraphQLObjectType({ + * name: 'User', + * fields: { + * name: { type: GraphQLString }, + * }, + * }); + * + * const config = User.toConfig(); + * const UserCopy = new GraphQLObjectType(config); + * + * config.fields.name.type; // => GraphQLString + * UserCopy.getFields().name.type; // => GraphQLString + * ``` + */ + toConfig(): GraphQLObjectTypeNormalizedConfig<TSource, TContext, TAbstract>; + /** + * Returns the schema coordinate identifying this object type. + * @returns The schema coordinate for this object type. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertObjectType } from 'graphql/type'; + * + * const schema = buildSchema(` + * type User { + * name: String + * } + * + * type Query { + * viewer: User + * } + * `); + * + * const User = assertObjectType(schema.getType('User')); + * + * User.toString(); // => 'User' + * ``` + */ + toString(): string; + /** + * Returns the JSON representation used when this object is serialized. + * @returns The JSON-serializable representation. + * @example + * ```ts + * import { GraphQLObjectType, GraphQLString } from 'graphql/type'; + * + * const User = new GraphQLObjectType({ + * name: 'User', + * fields: { name: { type: GraphQLString } }, + * }); + * + * User.toJSON(); // => 'User' + * JSON.stringify({ type: User }); // => '{"type":"User"}' + * ``` + */ + toJSON(): string; +} +/** + * Configuration used to construct a GraphQLObjectType. + * @typeParam TSource - Source object type passed to resolvers. + * @typeParam TContext - Context object type passed to resolvers. + * @typeParam TAbstract - Runtime value type used for abstract type resolution. + */ +export interface GraphQLObjectTypeConfig<TSource, TContext, TAbstract = unknown> { + /** The GraphQL name for this schema element. */ + name: string; + /** Human-readable description for this schema element, if provided. */ + description?: Maybe<string>; + /** Interfaces implemented by this object or interface type. */ + interfaces?: ThunkReadonlyArray<GraphQLInterfaceType> | undefined; + /** Fields declared by this object, interface, input object, or literal. */ + fields: ThunkObjMap<GraphQLFieldConfig<TSource, TContext>>; + /** Predicate used to determine whether a runtime value belongs to this object type. */ + isTypeOf?: Maybe<GraphQLIsTypeOfFn<TAbstract, TContext>>; + /** Custom extension fields reserved for users. */ + extensions?: Maybe<Readonly<GraphQLObjectTypeExtensions<TSource, TContext>>>; + /** AST node from which this schema element was built, if available. */ + astNode?: Maybe<ObjectTypeDefinitionNode>; + /** AST extension nodes applied to this schema element. */ + extensionASTNodes?: Maybe<ReadonlyArray<ObjectTypeExtensionNode>>; +} +interface GraphQLObjectTypeNormalizedConfig<TSource, TContext, TAbstract = unknown> extends GraphQLObjectTypeConfig<TSource, TContext, TAbstract> { + interfaces: ReadonlyArray<GraphQLInterfaceType>; + fields: GraphQLFieldNormalizedConfigMap<TSource, TContext>; + extensions: Readonly<GraphQLObjectTypeExtensions<TSource, TContext>>; + extensionASTNodes: ReadonlyArray<ObjectTypeExtensionNode>; +} +/** + * Resolves the concrete object type for an abstract GraphQL type. + * @typeParam TSource - Source object type passed to resolvers. + * @typeParam TContext - Context object type passed to resolvers. + */ +export type GraphQLTypeResolver<TSource, TContext> = (value: TSource, context: TContext, info: GraphQLResolveInfo, abstractType: GraphQLAbstractType) => PromiseOrValue<string | undefined>; +/** + * Checks whether a runtime value belongs to a GraphQL object type. + * @typeParam TAbstract - Runtime value type used for abstract type resolution. + * @typeParam TContext - Context object type passed to resolvers. + */ +export type GraphQLIsTypeOfFn<TAbstract, TContext> = (value: TAbstract, context: TContext, info: GraphQLResolveInfo) => PromiseOrValue<boolean>; +/** + * Resolves the runtime value for a GraphQL field. + * @typeParam TSource - Source object type passed to resolvers. + * @typeParam TContext - Context object type passed to resolvers. + * @typeParam TArgs - Argument object type passed to resolvers. + * @typeParam TResult - Result value type. + */ +export type GraphQLFieldResolver<TSource, TContext, TArgs = any, TResult = unknown> = (source: TSource, args: TArgs, context: TContext, info: GraphQLResolveInfo) => TResult; +/** Utilities available from resolver info for tracking asynchronous work. */ +export interface GraphQLResolveInfoHelpers { + /** + * Promise.all wrapper that allows rejected branches to be tracked + * as execution async work. + * + * Intended use: return or await this promise from resolver work. + * Un-awaited async side effects are an anti-pattern: + * + * const { promiseAll } = info.getAsyncHelpers(); + * promiseAll([someAsyncWork(), someOtherAsyncWork()]).catch(() => undefined); + * + * In that anti-pattern, tracking starts only after rejection (on a + * later microtask), so this work is not guaranteed to delay + * `hooks.asyncWorkFinished`. + * + * Use `track(...)` for un-awaited async side effects: + * + * const { track } = info.getAsyncHelpers(); + * track([ + * someAsyncWork().catch(() => undefined), + * someOtherAsyncWork().catch(() => undefined) + * ]); + */ + readonly promiseAll: <T>(values: ReadonlyArray<PromiseLike<T> | T>) => Promise<Array<T>>; + /** Tracks asynchronous work that should delay execution completion hooks. */ + readonly track: (maybePromises: ReadonlyArray<unknown>) => void; +} +/** Information about the currently executing GraphQL field. */ +export interface GraphQLResolveInfo { + /** The field name referenced by this schema coordinate. */ + readonly fieldName: string; + /** AST field nodes that contributed to the current field execution. */ + readonly fieldNodes: ReadonlyArray<FieldNode>; + /** GraphQL output type declared for the current field. */ + readonly returnType: GraphQLOutputType; + /** Object type that owns the current field. */ + readonly parentType: GraphQLObjectType; + /** Response path where this error occurred during execution. */ + readonly path: Path; + /** The schema used for validation or execution. */ + readonly schema: GraphQLSchema; + /** Fragment definitions in the operation document keyed by fragment name. */ + readonly fragments: ObjMap<FragmentDefinitionNode>; + /** Initial root value passed to the operation. */ + readonly rootValue: unknown; + /** The operation selected for execution. */ + readonly operation: OperationDefinitionNode; + /** + * Coerced variable values and source metadata for this operation. Resolver + * code that needs runtime variable values should read `variableValues.coerced`. + */ + readonly variableValues: VariableValues; + /** Returns the AbortSignal supplied for this execution, if any. */ + readonly getAbortSignal: () => AbortSignal | undefined; + /** Returns helper functions for tracking asynchronous resolver work. */ + readonly getAsyncHelpers: () => GraphQLResolveInfoHelpers; +} +/** + * Custom extensions + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + * We've provided these template arguments because this is an open type and + * you may find them useful. + * @typeParam _TSource - Reserved source type parameter for extension typing. + * @typeParam _TContext - Reserved context type parameter for extension typing. + * @typeParam _TArgs - Reserved argument type parameter for extension typing. + */ +export interface GraphQLFieldExtensions<_TSource, _TContext, _TArgs = any> { + [attributeName: string | symbol]: unknown; +} +/** + * Configuration used to define a GraphQL field. + * @typeParam TSource - Source object type passed to resolvers. + * @typeParam TContext - Context object type passed to resolvers. + * @typeParam TArgs - Argument object type passed to resolvers. + */ +export interface GraphQLFieldConfig<TSource, TContext, TArgs = any> { + /** Human-readable description for this schema element, if provided. */ + description?: Maybe<string>; + /** The GraphQL type reference or runtime type for this element. */ + type: GraphQLOutputType; + /** Arguments accepted by this field or directive. */ + args?: GraphQLFieldConfigArgumentMap | undefined; + /** Resolver function used to produce this field value. */ + resolve?: GraphQLFieldResolver<TSource, TContext, TArgs> | undefined; + /** Resolver function used to create a subscription event stream for this field. */ + subscribe?: GraphQLFieldResolver<TSource, TContext, TArgs> | undefined; + /** Reason this element is deprecated, if one was provided. */ + deprecationReason?: Maybe<string>; + /** Custom extension fields reserved for users. */ + extensions?: Maybe<Readonly<GraphQLFieldExtensions<TSource, TContext, TArgs>>>; + /** AST node from which this schema element was built, if available. */ + astNode?: Maybe<FieldDefinitionNode>; +} +interface GraphQLFieldNormalizedConfig<TSource, TContext, TArgs = any> extends GraphQLFieldConfig<TSource, TContext, TArgs> { + args: GraphQLFieldNormalizedConfigArgumentMap; + extensions: Readonly<GraphQLFieldExtensions<TSource, TContext, TArgs>>; +} +/** A map of argument names to argument configuration objects. */ +export type GraphQLFieldConfigArgumentMap = ObjMap<GraphQLArgumentConfig>; +type GraphQLFieldNormalizedConfigArgumentMap = ObjMap<GraphQLArgumentNormalizedConfig>; +/** + * Custom extensions + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLArgumentExtensions { + [attributeName: string | symbol]: unknown; +} +/** Configuration used to define a GraphQL argument. */ +export interface GraphQLArgumentConfig { + /** Human-readable description for this schema element, if provided. */ + description?: Maybe<string>; + /** The GraphQL type reference or runtime type for this element. */ + type: GraphQLInputType; + /** + * Deprecated legacy default value for this argument. Use `default` instead. + * @deprecated use `default` instead, `defaultValue` will be removed in v18 + */ + defaultValue?: unknown; + /** Default value represented as either a runtime value or a GraphQL literal. */ + default?: GraphQLDefaultInput | undefined; + /** Reason this element is deprecated, if one was provided. */ + deprecationReason?: Maybe<string>; + /** Custom extension fields reserved for users. */ + extensions?: Maybe<Readonly<GraphQLArgumentExtensions>>; + /** AST node from which this schema element was built, if available. */ + astNode?: Maybe<InputValueDefinitionNode>; +} +interface GraphQLArgumentNormalizedConfig extends GraphQLArgumentConfig { + default: GraphQLDefaultInput | undefined; + extensions: Readonly<GraphQLArgumentExtensions>; +} +/** + * A map of field names to field configuration objects. + * @typeParam TSource - Source object type passed to resolvers. + * @typeParam TContext - Context object type passed to resolvers. + */ +export type GraphQLFieldConfigMap<TSource, TContext> = ObjMap<GraphQLFieldConfig<TSource, TContext>>; +type GraphQLFieldNormalizedConfigMap<TSource, TContext> = ObjMap<GraphQLFieldNormalizedConfig<TSource, TContext>>; +/** + * A resolved GraphQL field definition. + * @typeParam TSource - Source object type passed to resolvers. + * @typeParam TContext - Context object type passed to resolvers. + * @typeParam TArgs - Argument object type passed to resolvers. + */ +export declare class GraphQLField<TSource = any, TContext = any, TArgs = any> implements GraphQLSchemaElement { + /** Object or interface type that owns this field, if known. */ + parentType: GraphQLObjectType<TSource, TContext> | GraphQLInterfaceType<TSource, TContext> | undefined; + /** The GraphQL name for this schema element. */ + name: string; + /** Human-readable description for this schema element, if provided. */ + description: Maybe<string>; + /** The GraphQL type reference or runtime type for this element. */ + type: GraphQLOutputType; + /** Arguments accepted by this field or directive. */ + args: ReadonlyArray<GraphQLArgument>; + /** Resolver function used to produce this field value. */ + resolve?: GraphQLFieldResolver<TSource, TContext, TArgs> | undefined; + /** Resolver function used to create a subscription event stream for this field. */ + subscribe?: GraphQLFieldResolver<TSource, TContext, TArgs> | undefined; + /** Reason this element is deprecated, if one was provided. */ + deprecationReason: Maybe<string>; + /** Custom extension fields reserved for users. */ + extensions: Readonly<GraphQLFieldExtensions<TSource, TContext, TArgs>>; + /** AST node from which this schema element was built, if available. */ + astNode: Maybe<FieldDefinitionNode>; + /** + * Creates a resolved GraphQL field definition. + * @param parentType - Object or interface type that owns this field, if known. + * @param name - Field name. + * @param config - Field configuration. + * @example + * ```ts + * import { parse } from 'graphql/language'; + * import { GraphQLField, GraphQLObjectType, GraphQLString } from 'graphql/type'; + * + * const Query = new GraphQLObjectType({ name: 'Query', fields: {} }); + * const document = parse('type Query { greeting: String }'); + * const fieldNode = document.definitions[0].fields[0]; + * const field = new GraphQLField(Query, 'greeting', { + * description: 'Greeting text.', + * type: GraphQLString, + * args: { + * name: { type: GraphQLString, default: { value: 'world' } }, + * }, + * resolve: (_source, { name }) => `Hello, ${name}!`, + * subscribe: async function* () { + * yield { greeting: 'Hello!' }; + * }, + * deprecationReason: 'Use hello.', + * extensions: { cacheSeconds: 60 }, + * astNode: fieldNode, + * }); + * + * field.parentType; // => Query + * field.name; // => 'greeting' + * field.args[0].default.value; // => 'world' + * typeof field.subscribe; // => 'function' + * field.deprecationReason; // => 'Use hello.' + * field.astNode; // => fieldNode + * ``` + */ + constructor(parentType: GraphQLObjectType<TSource, TContext> | GraphQLInterfaceType<TSource, TContext> | undefined, name: string, config: GraphQLFieldConfig<TSource, TContext, TArgs>); + /** + * Returns the value used by `Object.prototype.toString`. + * @returns The built-in string tag for this object. + */ + get [Symbol.toStringTag](): string; + /** + * Returns a normalized configuration object for this field. + * @returns A configuration object that can be used to recreate this field. + * @example + * ```ts + * import { GraphQLField, GraphQLObjectType, GraphQLString } from 'graphql/type'; + * + * const Query = new GraphQLObjectType({ name: 'Query', fields: {} }); + * const field = new GraphQLField(Query, 'greeting', { + * type: GraphQLString, + * extensions: { cacheSeconds: 60 }, + * }); + * + * field.toConfig().type; // => GraphQLString + * field.toConfig().extensions; // => { cacheSeconds: 60 } + * ``` + */ + toConfig(): GraphQLFieldNormalizedConfig<TSource, TContext, TArgs>; + /** + * Returns this field as a schema coordinate string. + * @returns The field coordinate. + * @example + * ```ts + * import { GraphQLField, GraphQLObjectType, GraphQLString } from 'graphql/type'; + * + * const Query = new GraphQLObjectType({ name: 'Query', fields: {} }); + * const field = new GraphQLField(Query, 'greeting', { type: GraphQLString }); + * + * field.toString(); // => 'Query.greeting' + * ``` + */ + toString(): string; + /** + * Returns the JSON representation used when this object is serialized. + * @returns The field coordinate. + * @example + * ```ts + * import { GraphQLField, GraphQLObjectType, GraphQLString } from 'graphql/type'; + * + * const Query = new GraphQLObjectType({ name: 'Query', fields: {} }); + * const field = new GraphQLField(Query, 'greeting', { type: GraphQLString }); + * + * JSON.stringify(field); // => '"Query.greeting"' + * ``` + */ + toJSON(): string; +} +/** A resolved GraphQL argument definition. */ +export declare class GraphQLArgument implements GraphQLSchemaElement { + /** Field or directive that owns this argument. */ + parent: GraphQLField | GraphQLDirective; + /** The GraphQL name for this schema element. */ + name: string; + /** Human-readable description for this schema element, if provided. */ + description: Maybe<string>; + /** The GraphQL type reference or runtime type for this element. */ + type: GraphQLInputType; + /** + * Deprecated legacy default value used when no explicit value is supplied. + * Use `default` instead. + * @deprecated use `default` instead, `defaultValue` will be removed in v18 + */ + defaultValue: unknown; + /** Default value represented as either a runtime value or a GraphQL literal. */ + default: GraphQLDefaultInput | undefined; + /** Reason this element is deprecated, if one was provided. */ + deprecationReason: Maybe<string>; + /** Custom extension fields reserved for users. */ + extensions: Readonly<GraphQLArgumentExtensions>; + /** AST node from which this schema element was built, if available. */ + astNode: Maybe<InputValueDefinitionNode>; + /** + * Creates a resolved GraphQL argument definition. + * @param parent - Field or directive that owns this argument. + * @param name - Argument name. + * @param config - Argument configuration. + * @example + * ```ts + * import { + * GraphQLArgument, + * GraphQLField, + * GraphQLObjectType, + * GraphQLString, + * } from 'graphql/type'; + * + * const Query = new GraphQLObjectType({ name: 'Query', fields: {} }); + * const field = new GraphQLField(Query, 'greeting', { type: GraphQLString }); + * const arg = new GraphQLArgument(field, 'name', { + * type: GraphQLString, + * default: { value: 'world' }, + * }); + * + * arg.parent; // => field + * arg.name; // => 'name' + * arg.default.value; // => 'world' + * ``` + */ + constructor(parent: GraphQLField | GraphQLDirective, name: string, config: GraphQLArgumentConfig); + /** + * Returns the value used by `Object.prototype.toString`. + * @returns The built-in string tag for this object. + */ + get [Symbol.toStringTag](): string; + /** + * Returns a normalized configuration object for this argument. + * @returns A configuration object that can be used to recreate this argument. + * @example + * ```ts + * import { + * GraphQLArgument, + * GraphQLField, + * GraphQLObjectType, + * GraphQLString, + * } from 'graphql/type'; + * + * const Query = new GraphQLObjectType({ name: 'Query', fields: {} }); + * const field = new GraphQLField(Query, 'greeting', { type: GraphQLString }); + * const arg = new GraphQLArgument(field, 'name', { + * type: GraphQLString, + * default: { value: 'world' }, + * }); + * + * arg.toConfig().default.value; // => 'world' + * ``` + */ + toConfig(): GraphQLArgumentNormalizedConfig; + /** + * Returns this argument as a schema coordinate string. + * @returns The argument coordinate. + * @example + * ```ts + * import { + * GraphQLArgument, + * GraphQLField, + * GraphQLObjectType, + * GraphQLString, + * } from 'graphql/type'; + * + * const Query = new GraphQLObjectType({ name: 'Query', fields: {} }); + * const field = new GraphQLField(Query, 'greeting', { type: GraphQLString }); + * const arg = new GraphQLArgument(field, 'name', { type: GraphQLString }); + * + * arg.toString(); // => 'Query.greeting(name:)' + * ``` + */ + toString(): string; + /** + * Returns the JSON representation used when this object is serialized. + * @returns The argument coordinate. + * @example + * ```ts + * import { + * GraphQLArgument, + * GraphQLField, + * GraphQLObjectType, + * GraphQLString, + * } from 'graphql/type'; + * + * const Query = new GraphQLObjectType({ name: 'Query', fields: {} }); + * const field = new GraphQLField(Query, 'greeting', { type: GraphQLString }); + * const arg = new GraphQLArgument(field, 'name', { type: GraphQLString }); + * + * JSON.stringify(arg); // => '"Query.greeting(name:)"' + * ``` + */ + toJSON(): string; +} +/** + * Returns true when the argument is non-null and has no default value. + * @param arg - The argument definition to inspect. + * @returns True when the argument is non-null and has no default value. + * @example + * ```ts + * import { + * GraphQLArgument, + * GraphQLField, + * GraphQLInt, + * GraphQLNonNull, + * GraphQLObjectType, + * GraphQLString, + * isRequiredArgument, + * } from 'graphql/type'; + * + * const Query = new GraphQLObjectType({ name: 'Query', fields: {} }); + * const field = new GraphQLField(Query, 'reviews', { type: GraphQLString }); + * const requiredArgument = new GraphQLArgument(field, 'id', { + * type: new GraphQLNonNull(GraphQLInt), + * }); + * const optionalArgument = new GraphQLArgument(field, 'name', { + * type: GraphQLString, + * }); + * const argumentWithDefault = new GraphQLArgument(field, 'limit', { + * type: new GraphQLNonNull(GraphQLInt), + * default: { value: 10 }, + * }); + * + * isRequiredArgument(requiredArgument); // => true + * isRequiredArgument(optionalArgument); // => false + * isRequiredArgument(argumentWithDefault); // => false + * ``` + */ +export declare function isRequiredArgument(arg: GraphQLArgument | GraphQLVariableSignature): boolean; +/** + * A map of field names to resolved field definitions. + * @typeParam TSource - Source object type passed to resolvers. + * @typeParam TContext - Context object type passed to resolvers. + */ +export type GraphQLFieldMap<TSource, TContext> = ObjMap<GraphQLField<TSource, TContext>>; +/** Default input represented as either a runtime value or a GraphQL literal. */ +export type GraphQLDefaultInput = { + /** Runtime default value. */ + value: unknown; + /** GraphQL literal default value is not provided in this variant. */ + literal?: never; +} | { + /** GraphQL literal default value. */ + literal: ConstValueNode; + /** Runtime default value is not provided in this variant. */ + value?: never; +}; +/** + * Custom extensions + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLInterfaceTypeExtensions { + [attributeName: string | symbol]: unknown; +} +/** + * Interface Type Definition + * + * When a field can return one of a heterogeneous set of types, a Interface type + * is used to describe what types are possible, what fields are in common across + * all types, as well as a function to determine which type is actually used + * when the field is resolved. + * @typeParam TSource - Source object type passed to resolvers. + * @typeParam TContext - Context object type passed to resolvers. + * @example + * ```ts + * const EntityType = new GraphQLInterfaceType({ + * name: 'Entity', + * fields: { + * name: { type: GraphQLString }, + * }, + * }); + * ``` + */ +export declare class GraphQLInterfaceType<TSource = any, TContext = any> implements GraphQLSchemaElement { + /** The GraphQL name for this schema element. */ + name: string; + /** Human-readable description for this schema element, if provided. */ + description: Maybe<string>; + /** Function that resolves the concrete object type for this abstract type. */ + resolveType: Maybe<GraphQLTypeResolver<TSource, TContext>>; + /** Custom extension fields reserved for users. */ + extensions: Readonly<GraphQLInterfaceTypeExtensions>; + /** AST node from which this schema element was built, if available. */ + astNode: Maybe<InterfaceTypeDefinitionNode>; + /** AST extension nodes applied to this schema element. */ + extensionASTNodes: ReadonlyArray<InterfaceTypeExtensionNode>; + private _fields; + private _interfaces; + /** + * Creates a GraphQLInterfaceType instance. + * @param config - Configuration describing this object. + * @example + * ```ts + * import { parse } from 'graphql/language'; + * import { GraphQLID, GraphQLInterfaceType, GraphQLNonNull } from 'graphql/type'; + * + * const document = parse(` + * interface Node { + * id: ID! + * } + * + * interface Resource implements Node { + * id: ID! + * } + * + * extend interface Resource { + * url: String + * } + * `); + * + * const Node = new GraphQLInterfaceType({ + * name: 'Node', + * fields: { + * id: { type: new GraphQLNonNull(GraphQLID) }, + * }, + * }); + * + * const Resource = new GraphQLInterfaceType({ + * name: 'Resource', + * description: 'An addressable resource.', + * interfaces: [Node], + * fields: { + * id: { type: new GraphQLNonNull(GraphQLID) }, + * }, + * resolveType: (value) => { + * return typeof value === 'object' && value != null && 'url' in value + * ? 'WebPage' + * : null; + * }, + * extensions: { abstract: true }, + * astNode: document.definitions[1], + * extensionASTNodes: [document.definitions[2]], + * }); + * + * Resource.name; // => 'Resource' + * Resource.getInterfaces(); // => [Node] + * Object.keys(Resource.getFields()); // => ['id'] + * Resource.extensions; // => { abstract: true } + * ``` + */ + constructor(config: Readonly<GraphQLInterfaceTypeConfig<TSource, TContext>>); + /** + * Returns the value used by `Object.prototype.toString`. + * @returns The built-in string tag for this object. + */ + get [Symbol.toStringTag](): string; + /** + * Returns the fields defined by this type. + * @returns The fields keyed by field name. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertInterfaceType } from 'graphql/type'; + * + * const schema = buildSchema(` + * interface Node { + * id: ID! + * } + * + * type User implements Node { + * id: ID! + * } + * + * type Query { + * node: Node + * } + * `); + * + * const Node = assertInterfaceType(schema.getType('Node')); + * const fields = Node.getFields(); + * + * Object.keys(fields); // => ['id'] + * String(fields.id.type); // => 'ID!' + * ``` + */ + getFields(): GraphQLFieldMap<TSource, TContext>; + /** + * Returns the interfaces implemented by this type. + * @returns The implemented interfaces. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertInterfaceType } from 'graphql/type'; + * + * const schema = buildSchema(` + * interface Resource { + * url: String! + * } + * + * interface Image implements Resource { + * url: String! + * width: Int + * } + * + * type Photo implements Resource & Image { + * url: String! + * width: Int + * } + * + * type Query { + * image: Image + * } + * `); + * + * const Image = assertInterfaceType(schema.getType('Image')); + * + * Image.getInterfaces().map((type) => type.name); // => ['Resource'] + * ``` + */ + getInterfaces(): ReadonlyArray<GraphQLInterfaceType>; + /** + * Returns a normalized configuration object for this object. + * @returns A configuration object that can be used to recreate this object. + * @example + * ```ts + * import { GraphQLID, GraphQLInterfaceType, GraphQLNonNull } from 'graphql/type'; + * + * const Node = new GraphQLInterfaceType({ + * name: 'Node', + * fields: { + * id: { type: new GraphQLNonNull(GraphQLID) }, + * }, + * }); + * + * const config = Node.toConfig(); + * const NodeCopy = new GraphQLInterfaceType(config); + * + * String(config.fields.id.type); // => 'ID!' + * String(NodeCopy.getFields().id.type); // => 'ID!' + * ``` + */ + toConfig(): GraphQLInterfaceTypeNormalizedConfig<TSource, TContext>; + /** + * Returns the schema coordinate identifying this interface type. + * @returns The schema coordinate for this interface type. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertInterfaceType } from 'graphql/type'; + * + * const schema = buildSchema(` + * interface Node { + * id: ID! + * } + * + * type User implements Node { + * id: ID! + * } + * + * type Query { + * node: Node + * } + * `); + * + * const Node = assertInterfaceType(schema.getType('Node')); + * + * Node.toString(); // => 'Node' + * ``` + */ + toString(): string; + /** + * Returns the JSON representation used when this object is serialized. + * @returns The JSON-serializable representation. + * @example + * ```ts + * import { GraphQLInterfaceType, GraphQLString } from 'graphql/type'; + * + * const Named = new GraphQLInterfaceType({ + * name: 'Named', + * fields: { name: { type: GraphQLString } }, + * }); + * + * Named.toJSON(); // => 'Named' + * JSON.stringify({ type: Named }); // => '{"type":"Named"}' + * ``` + */ + toJSON(): string; +} +/** + * Configuration used to construct a GraphQLInterfaceType. + * @typeParam TSource - Source object type passed to resolvers. + * @typeParam TContext - Context object type passed to resolvers. + */ +export interface GraphQLInterfaceTypeConfig<TSource, TContext> { + /** The GraphQL name for this schema element. */ + name: string; + /** Human-readable description for this schema element, if provided. */ + description?: Maybe<string>; + /** Interfaces implemented by this object or interface type. */ + interfaces?: ThunkReadonlyArray<GraphQLInterfaceType> | undefined; + /** Fields declared by this object, interface, input object, or literal. */ + fields: ThunkObjMap<GraphQLFieldConfig<TSource, TContext>>; + /** + * Optionally provide a custom type resolver function. If one is not provided, + * the default implementation will call `isTypeOf` on each implementing + * Object type. + */ + resolveType?: Maybe<GraphQLTypeResolver<TSource, TContext>>; + /** Custom extension fields reserved for users. */ + extensions?: Maybe<Readonly<GraphQLInterfaceTypeExtensions>>; + /** AST node from which this schema element was built, if available. */ + astNode?: Maybe<InterfaceTypeDefinitionNode>; + /** AST extension nodes applied to this schema element. */ + extensionASTNodes?: Maybe<ReadonlyArray<InterfaceTypeExtensionNode>>; +} +interface GraphQLInterfaceTypeNormalizedConfig<TSource, TContext> extends GraphQLInterfaceTypeConfig<TSource, TContext> { + interfaces: ReadonlyArray<GraphQLInterfaceType>; + fields: GraphQLFieldNormalizedConfigMap<TSource, TContext>; + extensions: Readonly<GraphQLInterfaceTypeExtensions>; + extensionASTNodes: ReadonlyArray<InterfaceTypeExtensionNode>; +} +/** + * Custom extensions + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLUnionTypeExtensions { + [attributeName: string | symbol]: unknown; +} +/** + * Union Type Definition + * + * When a field can return one of a heterogeneous set of types, a Union type + * is used to describe what types are possible as well as providing a function + * to determine which type is actually used when the field is resolved. + * @typeParam TSource - Source object type passed to resolvers. + * @typeParam TContext - Context object type passed to resolvers. + * @example + * ```ts + * const PetType = new GraphQLUnionType({ + * name: 'Pet', + * types: [DogType, CatType], + * resolveType: (value) => { + * if (value instanceof Dog) { + * return DogType; + * } + * if (value instanceof Cat) { + * return CatType; + * } + * }, + * }); + * ``` + */ +export declare class GraphQLUnionType<TSource = any, TContext = any> implements GraphQLSchemaElement { + /** The GraphQL name for this schema element. */ + name: string; + /** Human-readable description for this schema element, if provided. */ + description: Maybe<string>; + /** Function that resolves the concrete object type for this abstract type. */ + resolveType: Maybe<GraphQLTypeResolver<TSource, TContext>>; + /** Custom extension fields reserved for users. */ + extensions: Readonly<GraphQLUnionTypeExtensions>; + /** AST node from which this schema element was built, if available. */ + astNode: Maybe<UnionTypeDefinitionNode>; + /** AST extension nodes applied to this schema element. */ + extensionASTNodes: ReadonlyArray<UnionTypeExtensionNode>; + private _types; + /** + * Creates a GraphQLUnionType instance. + * @param config - Configuration describing this object. + * @example + * ```ts + * import { parse } from 'graphql/language'; + * import { + * GraphQLObjectType, + * GraphQLString, + * GraphQLUnionType, + * } from 'graphql/type'; + * + * const document = parse(` + * union Media = Photo | Video + * + * extend union Media = Audio + * `); + * + * const Photo = new GraphQLObjectType({ + * name: 'Photo', + * fields: { url: { type: GraphQLString } }, + * }); + * const Video = new GraphQLObjectType({ + * name: 'Video', + * fields: { url: { type: GraphQLString } }, + * }); + * + * const Media = new GraphQLUnionType({ + * name: 'Media', + * description: 'Media that can appear in a search result.', + * types: [Photo, Video], + * resolveType: (value) => { + * return typeof value === 'object' && value != null && 'duration' in value + * ? 'Video' + * : 'Photo'; + * }, + * extensions: { searchable: true }, + * astNode: document.definitions[0], + * extensionASTNodes: [document.definitions[1]], + * }); + * + * Media.description; // => 'Media that can appear in a search result.' + * Media.getTypes().map((type) => type.name); // => ['Photo', 'Video'] + * Media.extensions; // => { searchable: true } + * ``` + */ + constructor(config: Readonly<GraphQLUnionTypeConfig<TSource, TContext>>); + /** + * Returns the value used by `Object.prototype.toString`. + * @returns The built-in string tag for this object. + */ + get [Symbol.toStringTag](): string; + /** + * Returns the object types included in this union. + * @returns The union member object types. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertUnionType } from 'graphql/type'; + * + * const schema = buildSchema(` + * type Photo { + * url: String! + * } + * + * type Video { + * url: String! + * } + * + * union Media = Photo | Video + * + * type Query { + * media: [Media] + * } + * `); + * + * const Media = assertUnionType(schema.getType('Media')); + * + * Media.getTypes().map((type) => type.name); // => ['Photo', 'Video'] + * ``` + */ + getTypes(): ReadonlyArray<GraphQLObjectType>; + /** + * Returns a normalized configuration object for this object. + * @returns A configuration object that can be used to recreate this object. + * @example + * ```ts + * import { + * GraphQLObjectType, + * GraphQLString, + * GraphQLUnionType, + * } from 'graphql/type'; + * + * const Photo = new GraphQLObjectType({ + * name: 'Photo', + * fields: { url: { type: GraphQLString } }, + * }); + * const Video = new GraphQLObjectType({ + * name: 'Video', + * fields: { url: { type: GraphQLString } }, + * }); + * const Media = new GraphQLUnionType({ + * name: 'Media', + * types: [Photo, Video], + * }); + * + * const config = Media.toConfig(); + * const MediaCopy = new GraphQLUnionType(config); + * + * MediaCopy.getTypes().map((type) => type.name); // => ['Photo', 'Video'] + * ``` + */ + toConfig(): GraphQLUnionTypeNormalizedConfig<TSource, TContext>; + /** + * Returns the schema coordinate identifying this union type. + * @returns The schema coordinate for this union type. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertUnionType } from 'graphql/type'; + * + * const schema = buildSchema(` + * type Photo { + * url: String! + * } + * + * union SearchResult = Photo + * + * type Query { + * search: [SearchResult] + * } + * `); + * + * const SearchResult = assertUnionType(schema.getType('SearchResult')); + * + * SearchResult.toString(); // => 'SearchResult' + * ``` + */ + toString(): string; + /** + * Returns the JSON representation used when this object is serialized. + * @returns The JSON-serializable representation. + * @example + * ```ts + * import { + * GraphQLObjectType, + * GraphQLString, + * GraphQLUnionType, + * } from 'graphql/type'; + * + * const Photo = new GraphQLObjectType({ + * name: 'Photo', + * fields: { url: { type: GraphQLString } }, + * }); + * const SearchResult = new GraphQLUnionType({ + * name: 'SearchResult', + * types: [Photo], + * }); + * + * SearchResult.toJSON(); // => 'SearchResult' + * JSON.stringify({ type: SearchResult }); // => '{"type":"SearchResult"}' + * ``` + */ + toJSON(): string; +} +/** + * Configuration used to construct a GraphQLUnionType. + * @typeParam TSource - Source object type passed to resolvers. + * @typeParam TContext - Context object type passed to resolvers. + */ +export interface GraphQLUnionTypeConfig<TSource, TContext> { + /** The GraphQL name for this schema element. */ + name: string; + /** Human-readable description for this schema element, if provided. */ + description?: Maybe<string>; + /** Object types that belong to this union type. */ + types: ThunkReadonlyArray<GraphQLObjectType>; + /** + * Optionally provide a custom type resolver function. If one is not provided, + * the default implementation will call `isTypeOf` on each implementing + * Object type. + */ + resolveType?: Maybe<GraphQLTypeResolver<TSource, TContext>>; + /** Custom extension fields reserved for users. */ + extensions?: Maybe<Readonly<GraphQLUnionTypeExtensions>>; + /** AST node from which this schema element was built, if available. */ + astNode?: Maybe<UnionTypeDefinitionNode>; + /** AST extension nodes applied to this schema element. */ + extensionASTNodes?: Maybe<ReadonlyArray<UnionTypeExtensionNode>>; +} +interface GraphQLUnionTypeNormalizedConfig<TSource, TContext> extends GraphQLUnionTypeConfig<TSource, TContext> { + types: ReadonlyArray<GraphQLObjectType>; + extensions: Readonly<GraphQLUnionTypeExtensions>; + extensionASTNodes: ReadonlyArray<UnionTypeExtensionNode>; +} +/** + * Custom extensions + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLEnumTypeExtensions { + [attributeName: string | symbol]: unknown; +} +/** + * Enum Type Definition + * + * Enum types define leaf values whose serialized form is one of a fixed set + * of GraphQL enum names. Internally, enum values can map to any runtime value, + * often integers. + * @example + * ```ts + * import { GraphQLEnumType } from 'graphql/type'; + * + * const RGBType = new GraphQLEnumType({ + * name: 'RGB', + * values: { + * RED: { value: 0 }, + * GREEN: { value: 1 }, + * BLUE: { value: 2 }, + * }, + * }); + * + * RGBType.getValue('GREEN')?.value; // => 1 + * ``` + * + * Note: If a value is not provided in a definition, the name of the enum value + * will be used as its internal value. + */ +export declare class GraphQLEnumType /* <T> *//* <T> */ implements GraphQLSchemaElement { + /** The GraphQL name for this schema element. */ + name: string; + /** Human-readable description for this schema element, if provided. */ + description: Maybe<string>; + /** Custom extension fields reserved for users. */ + extensions: Readonly<GraphQLEnumTypeExtensions>; + /** AST node from which this schema element was built, if available. */ + astNode: Maybe<EnumTypeDefinitionNode>; + /** AST extension nodes applied to this schema element. */ + extensionASTNodes: ReadonlyArray<EnumTypeExtensionNode>; + private _values; + private _valueLookup; + private _nameLookup; + /** + * Creates a GraphQLEnumType instance. + * @param config - Configuration describing this object. + * @example + * ```ts + * import { parse } from 'graphql/language'; + * import { GraphQLEnumType } from 'graphql/type'; + * + * const document = parse(` + * enum Episode { + * NEW_HOPE + * EMPIRE + * JEDI + * } + * + * extend enum Episode { + * FORCE_AWAKENS + * } + * `); + * const definition = document.definitions[0]; + * + * const Episode = new GraphQLEnumType({ + * name: 'Episode', + * description: 'A Star Wars film episode.', + * values: { + * NEW_HOPE: { + * value: 4, + * description: 'Released in 1977.', + * extensions: { trilogy: 'original' }, + * astNode: definition.values[0], + * }, + * EMPIRE: { value: 5, astNode: definition.values[1] }, + * JEDI: { + * value: 6, + * deprecationReason: 'Use RETURN_OF_THE_JEDI.', + * astNode: definition.values[2], + * }, + * }, + * extensions: { catalog: 'films' }, + * astNode: definition, + * extensionASTNodes: [document.definitions[1]], + * }); + * + * Episode.description; // => 'A Star Wars film episode.' + * Episode.coerceOutputValue(5); // => 'EMPIRE' + * Episode.coerceInputValue('JEDI'); // => 6 + * Episode.getValue('JEDI').deprecationReason; // => 'Use RETURN_OF_THE_JEDI.' + * Episode.extensions; // => { catalog: 'films' } + * ``` + */ + constructor(config: Readonly<GraphQLEnumTypeConfig>); + /** + * Returns the value used by `Object.prototype.toString`. + * @returns The built-in string tag for this object. + */ + get [Symbol.toStringTag](): string; + /** + * Returns the values defined by this enum type. + * @returns Enum value definitions in schema order. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertEnumType } from 'graphql/type'; + * + * const schema = buildSchema(` + * enum Episode { + * NEW_HOPE + * EMPIRE + * JEDI + * } + * + * type Query { + * episode: Episode + * } + * `); + * + * const Episode = assertEnumType(schema.getType('Episode')); + * + * Episode.getValues().map((value) => value.name); // => ['NEW_HOPE', 'EMPIRE', 'JEDI'] + * ``` + */ + getValues(): ReadonlyArray<GraphQLEnumValue>; + /** + * Returns the enum value definition for a value name. + * @param name - The GraphQL name to look up. + * @returns The matching enum value definition, if it exists. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertEnumType } from 'graphql/type'; + * + * const schema = buildSchema(` + * enum Episode { + * NEW_HOPE + * EMPIRE + * } + * + * type Query { + * episode: Episode + * } + * `); + * + * const Episode = assertEnumType(schema.getType('Episode')); + * + * Episode.getValue('EMPIRE')?.name; // => 'EMPIRE' + * Episode.getValue('JEDI'); // => undefined + * ``` + */ + getValue(name: string): Maybe<GraphQLEnumValue>; + /** + * Serializes a runtime enum value as a GraphQL enum name. + * @param outputValue - Runtime enum value to serialize. + * @returns The GraphQL enum name for the runtime value. + * + * This deprecated method delegates to `coerceOutputValue()`; call + * `coerceOutputValue()` directly instead. + * @example + * ```ts + * import { GraphQLEnumType } from 'graphql/type'; + * + * const RGB = new GraphQLEnumType({ + * name: 'RGB', + * values: { + * RED: { value: 0 }, + * GREEN: { value: 1 }, + * BLUE: { value: 2 }, + * }, + * }); + * + * RGB.serialize(1); // => 'GREEN' + * RGB.serialize(3); // throws an error + * ``` + * @deprecated use `coerceOutputValue()` instead, `serialize()` will be removed in v18 + */ + serialize(outputValue: unknown): Maybe<string>; + /** + * Coerces a runtime enum value to a GraphQL enum name. + * @param outputValue - Runtime enum value to coerce. + * @returns The GraphQL enum name for the runtime value. + * @example + * ```ts + * import { GraphQLEnumType } from 'graphql/type'; + * + * const RGB = new GraphQLEnumType({ + * name: 'RGB', + * values: { + * RED: { value: 0 }, + * GREEN: { value: 1 }, + * BLUE: { value: 2 }, + * }, + * }); + * + * RGB.coerceOutputValue(1); // => 'GREEN' + * RGB.coerceOutputValue(3); // throws an error + * ``` + */ + coerceOutputValue(outputValue: unknown): Maybe<string>; + /** + * Deprecated legacy enum parser for externally provided input values. Use + * `coerceInputValue()` instead. + * @param inputValue - External enum name to parse. + * @param hideSuggestions - Whether suggestion text should be omitted from errors. + * @returns The internal runtime value for the enum name. + * @example + * ```ts + * import { GraphQLEnumType } from 'graphql/type'; + * + * const RGB = new GraphQLEnumType({ + * name: 'RGB', + * values: { + * RED: { value: 0 }, + * GREEN: { value: 1 }, + * BLUE: { value: 2 }, + * }, + * }); + * + * RGB.parseValue('BLUE'); // => 2 + * RGB.parseValue('PURPLE', true); // throws an error + * ``` + * @deprecated use `coerceInputValue()` instead, `parseValue()` will be removed in v18 + */ + parseValue(inputValue: unknown, hideSuggestions?: Maybe<boolean>): Maybe<any>; + /** + * Coerces an external enum name to its internal runtime value. + * @param inputValue - External enum name to coerce. + * @param hideSuggestions - Whether suggestion text should be omitted from errors. + * @returns The internal runtime value for the enum name. + * @example + * ```ts + * import { GraphQLEnumType } from 'graphql/type'; + * + * const RGB = new GraphQLEnumType({ + * name: 'RGB', + * values: { + * RED: { value: 0 }, + * GREEN: { value: 1 }, + * BLUE: { value: 2 }, + * }, + * }); + * + * RGB.coerceInputValue('BLUE'); // => 2 + * RGB.coerceInputValue('PURPLE'); // throws an error + * RGB.coerceInputValue(2); // throws an error + * ``` + */ + coerceInputValue(inputValue: unknown, hideSuggestions?: Maybe<boolean>): Maybe<any>; + /** + * Deprecated legacy enum parser for externally provided input literals. Use + * `coerceInputLiteral()` instead. + * @param valueNode - Enum value AST node to parse. + * @param _variables - Deprecated variable values parameter that is no longer used. + * @param hideSuggestions - Whether suggestion text should be omitted from errors. + * @returns The internal runtime value for the enum literal. + * @example + * ```ts + * import { parseValue } from 'graphql/language'; + * import { GraphQLEnumType } from 'graphql/type'; + * + * const RGB = new GraphQLEnumType({ + * name: 'RGB', + * values: { + * RED: { value: 0 }, + * GREEN: { value: 1 }, + * BLUE: { value: 2 }, + * }, + * }); + * + * RGB.parseLiteral(parseValue('RED')); // => 0 + * RGB.parseLiteral(parseValue('"RED"')); // throws an error + * ``` + * @deprecated use `coerceInputLiteral()` instead, `parseLiteral()` will be removed in v18 + */ + parseLiteral(valueNode: ValueNode, _variables: Maybe<ObjMap<unknown>>, hideSuggestions?: Maybe<boolean>): Maybe<any>; + /** + * Coerces an enum value AST node to its internal runtime value. + * @param valueNode - Enum value AST node to coerce. + * @param hideSuggestions - Whether suggestion text should be omitted from errors. + * @returns The internal runtime value for the enum literal. + * @example + * ```ts + * import { parseConstValue } from 'graphql/language'; + * import { GraphQLEnumType } from 'graphql/type'; + * + * const RGB = new GraphQLEnumType({ + * name: 'RGB', + * values: { + * RED: { value: 0 }, + * GREEN: { value: 1 }, + * BLUE: { value: 2 }, + * }, + * }); + * + * RGB.coerceInputLiteral(parseConstValue('RED')); // => 0 + * RGB.coerceInputLiteral(parseConstValue('"RED"'), true); // throws an error + * ``` + */ + coerceInputLiteral(valueNode: ConstValueNode, hideSuggestions?: Maybe<boolean>): Maybe<any>; + /** + * Converts a runtime enum value to a GraphQL enum value AST node. + * @param value - Runtime enum value to convert. + * @returns Enum value AST node, or undefined if the value is invalid. + * @example + * ```ts + * import { print } from 'graphql/language'; + * import { GraphQLEnumType } from 'graphql/type'; + * + * const RGB = new GraphQLEnumType({ + * name: 'RGB', + * values: { + * RED: { value: 0 }, + * GREEN: { value: 1 }, + * BLUE: { value: 2 }, + * }, + * }); + * + * print(RGB.valueToLiteral(2)); // => 'BLUE' + * RGB.valueToLiteral(3); // => undefined + * ``` + */ + valueToLiteral(value: unknown): ConstValueNode | undefined; + /** + * Returns a normalized configuration object for this object. + * @returns A configuration object that can be used to recreate this object. + * @example + * ```ts + * import { GraphQLEnumType } from 'graphql/type'; + * + * const RGB = new GraphQLEnumType({ + * name: 'RGB', + * values: { + * RED: { value: 0 }, + * GREEN: { value: 1 }, + * BLUE: { value: 2 }, + * }, + * }); + * + * const config = RGB.toConfig(); + * const RGBCopy = new GraphQLEnumType(config); + * + * config.values.GREEN.value; // => 1 + * RGBCopy.coerceOutputValue(2); // => 'BLUE' + * ``` + */ + toConfig(): GraphQLEnumTypeNormalizedConfig; + /** + * Returns the schema coordinate identifying this enum type. + * @returns The schema coordinate for this enum type. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertEnumType } from 'graphql/type'; + * + * const schema = buildSchema(` + * enum Episode { + * NEW_HOPE + * } + * + * type Query { + * episode: Episode + * } + * `); + * + * const Episode = assertEnumType(schema.getType('Episode')); + * + * Episode.toString(); // => 'Episode' + * ``` + */ + toString(): string; + /** + * Returns the JSON representation used when this object is serialized. + * @returns The JSON-serializable representation. + * @example + * ```ts + * import { GraphQLEnumType } from 'graphql/type'; + * + * const Episode = new GraphQLEnumType({ + * name: 'Episode', + * values: { + * NEW_HOPE: {}, + * }, + * }); + * + * Episode.toJSON(); // => 'Episode' + * JSON.stringify({ type: Episode }); // => '{"type":"Episode"}' + * ``` + */ + toJSON(): string; +} +/** Configuration used to construct a GraphQLEnumType. */ +export interface GraphQLEnumTypeConfig { + /** The GraphQL name for this schema element. */ + name: string; + /** Human-readable description for this schema element, if provided. */ + description?: Maybe<string>; + /** Values contained in this enum, list, or input-object definition. */ + values: ThunkObjMap<GraphQLEnumValueConfig>; + /** Custom extension fields reserved for users. */ + extensions?: Maybe<Readonly<GraphQLEnumTypeExtensions>>; + /** AST node from which this schema element was built, if available. */ + astNode?: Maybe<EnumTypeDefinitionNode>; + /** AST extension nodes applied to this schema element. */ + extensionASTNodes?: Maybe<ReadonlyArray<EnumTypeExtensionNode>>; +} +interface GraphQLEnumTypeNormalizedConfig extends GraphQLEnumTypeConfig { + values: GraphQLEnumValueNormalizedConfigMap; + extensions: Readonly<GraphQLEnumTypeExtensions>; + extensionASTNodes: ReadonlyArray<EnumTypeExtensionNode>; +} +/** A map of enum value names to enum value configuration objects. */ +export type GraphQLEnumValueConfigMap = ObjMap<GraphQLEnumValueConfig>; +type GraphQLEnumValueNormalizedConfigMap = ObjMap<GraphQLEnumValueNormalizedConfig>; +/** + * Custom extensions + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLEnumValueExtensions { + [attributeName: string | symbol]: unknown; +} +/** Configuration used to define a GraphQL enum value. */ +export interface GraphQLEnumValueConfig { + /** Human-readable description for this schema element, if provided. */ + description?: Maybe<string>; + /** Parsed value represented by this node. */ + value?: any; + /** Reason this element is deprecated, if one was provided. */ + deprecationReason?: Maybe<string>; + /** Custom extension fields reserved for users. */ + extensions?: Maybe<Readonly<GraphQLEnumValueExtensions>>; + /** AST node from which this schema element was built, if available. */ + astNode?: Maybe<EnumValueDefinitionNode>; +} +interface GraphQLEnumValueNormalizedConfig extends GraphQLEnumValueConfig { + extensions: Readonly<GraphQLEnumValueExtensions>; +} +/** A resolved GraphQL enum value definition. */ +export declare class GraphQLEnumValue implements GraphQLSchemaElement { + /** Enum type that owns this enum value. */ + parentEnum: GraphQLEnumType; + /** The GraphQL name for this schema element. */ + name: string; + /** Human-readable description for this schema element, if provided. */ + description: Maybe<string>; + /** Parsed value represented by this node. */ + value: any; + /** Reason this element is deprecated, if one was provided. */ + deprecationReason: Maybe<string>; + /** Custom extension fields reserved for users. */ + extensions: Readonly<GraphQLEnumValueExtensions>; + /** AST node from which this schema element was built, if available. */ + astNode: Maybe<EnumValueDefinitionNode>; + /** + * Creates a resolved GraphQL enum value definition. + * @param parentEnum - Enum type that owns this enum value. + * @param name - Enum value name. + * @param config - Enum value configuration. + * @example + * ```ts + * import { GraphQLEnumType, GraphQLEnumValue } from 'graphql/type'; + * + * const Episode = new GraphQLEnumType({ + * name: 'Episode', + * values: { NEW_HOPE: { value: 4 } }, + * }); + * const enumValue = new GraphQLEnumValue(Episode, 'EMPIRE', { + * value: 5, + * description: 'Released in 1980.', + * }); + * + * enumValue.parentEnum; // => Episode + * enumValue.name; // => 'EMPIRE' + * enumValue.value; // => 5 + * ``` + */ + constructor(parentEnum: GraphQLEnumType, name: string, config: GraphQLEnumValueConfig); + /** + * Returns the value used by `Object.prototype.toString`. + * @returns The built-in string tag for this object. + */ + get [Symbol.toStringTag](): string; + /** + * Returns a normalized configuration object for this enum value. + * @returns A configuration object that can be used to recreate this enum value. + * @example + * ```ts + * import { GraphQLEnumType, GraphQLEnumValue } from 'graphql/type'; + * + * const Episode = new GraphQLEnumType({ + * name: 'Episode', + * values: { NEW_HOPE: { value: 4 } }, + * }); + * const enumValue = new GraphQLEnumValue(Episode, 'EMPIRE', { + * value: 5, + * extensions: { trilogy: 'original' }, + * }); + * + * enumValue.toConfig(); // => { description: undefined, value: 5, deprecationReason: undefined, extensions: { trilogy: 'original' }, astNode: undefined } + * ``` + */ + toConfig(): GraphQLEnumValueNormalizedConfig; + /** + * Returns this enum value as a schema coordinate string. + * @returns Enum value coordinate. + * @example + * ```ts + * import { GraphQLEnumType, GraphQLEnumValue } from 'graphql/type'; + * + * const Episode = new GraphQLEnumType({ + * name: 'Episode', + * values: { NEW_HOPE: { value: 4 } }, + * }); + * const enumValue = new GraphQLEnumValue(Episode, 'EMPIRE', { value: 5 }); + * + * enumValue.toString(); // => 'Episode.EMPIRE' + * ``` + */ + toString(): string; + /** + * Returns the JSON representation used when this object is serialized. + * @returns Enum value coordinate. + * @example + * ```ts + * import { GraphQLEnumType, GraphQLEnumValue } from 'graphql/type'; + * + * const Episode = new GraphQLEnumType({ + * name: 'Episode', + * values: { NEW_HOPE: { value: 4 } }, + * }); + * const enumValue = new GraphQLEnumValue(Episode, 'EMPIRE', { value: 5 }); + * + * JSON.stringify(enumValue); // => '"Episode.EMPIRE"' + * ``` + */ + toJSON(): string; +} +/** + * Custom extensions + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLInputObjectTypeExtensions { + [attributeName: string | symbol]: unknown; +} +/** + * Input Object Type Definition + * + * An input object defines a structured collection of fields which may be + * supplied to a field argument. + * + * Using `NonNull` will ensure that a value must be provided by the query + * @example + * ```ts + * const GeoPoint = new GraphQLInputObjectType({ + * name: 'GeoPoint', + * fields: { + * lat: { type: new GraphQLNonNull(GraphQLFloat) }, + * lon: { type: new GraphQLNonNull(GraphQLFloat) }, + * alt: { type: GraphQLFloat, default: { value: 0 } }, + * }, + * }); + * ``` + */ +export declare class GraphQLInputObjectType implements GraphQLSchemaElement { + /** The GraphQL name for this schema element. */ + name: string; + /** Human-readable description for this schema element, if provided. */ + description: Maybe<string>; + /** Custom extension fields reserved for users. */ + extensions: Readonly<GraphQLInputObjectTypeExtensions>; + /** AST node from which this schema element was built, if available. */ + astNode: Maybe<InputObjectTypeDefinitionNode>; + /** AST extension nodes applied to this schema element. */ + extensionASTNodes: ReadonlyArray<InputObjectTypeExtensionNode>; + /** Whether this input object uses the experimental OneOf input object semantics. */ + isOneOf: boolean; + private _fields; + /** + * Creates a GraphQLInputObjectType instance. + * @param config - Configuration describing this object. + * @example + * ```ts + * import { parse } from 'graphql/language'; + * import { + * GraphQLID, + * GraphQLInputObjectType, + * GraphQLInt, + * GraphQLNonNull, + * GraphQLString, + * } from 'graphql/type'; + * + * const document = parse(` + * input ReviewInput { + * stars: Int! + * commentary: String + * } + * + * extend input ReviewInput { + * body: String + * } + * `); + * const definition = document.definitions[0]; + * + * const ReviewInput = new GraphQLInputObjectType({ + * name: 'ReviewInput', + * description: 'Input collected when reviewing a product.', + * fields: { + * stars: { + * description: 'Star rating from one to five.', + * type: new GraphQLNonNull(GraphQLInt), + * extensions: { min: 1, max: 5 }, + * astNode: definition.fields[0], + * }, + * commentary: { + * type: GraphQLString, + * default: { value: '' }, + * deprecationReason: 'Use body.', + * astNode: definition.fields[1], + * }, + * }, + * extensions: { form: 'review' }, + * astNode: definition, + * extensionASTNodes: [document.definitions[1]], + * isOneOf: false, + * }); + * const SearchBy = new GraphQLInputObjectType({ + * name: 'SearchBy', + * fields: { + * id: { type: GraphQLID }, + * slug: { type: GraphQLString }, + * }, + * isOneOf: true, + * }); + * + * const fields = ReviewInput.getFields(); + * + * ReviewInput.description; // => 'Input collected when reviewing a product.' + * String(fields.stars.type); // => 'Int!' + * fields.stars.extensions; // => { min: 1, max: 5 } + * fields.commentary.default.value; // => '' + * fields.commentary.deprecationReason; // => 'Use body.' + * ReviewInput.isOneOf; // => false + * SearchBy.isOneOf; // => true + * ``` + */ + constructor(config: Readonly<GraphQLInputObjectTypeConfig>); + /** + * Returns the value used by `Object.prototype.toString`. + * @returns The built-in string tag for this object. + */ + get [Symbol.toStringTag](): string; + /** + * Returns the fields defined by this type. + * @returns The fields keyed by field name. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertInputObjectType } from 'graphql/type'; + * + * const schema = buildSchema(` + * input ReviewInput { + * stars: Int! + * commentary: String = "" + * } + * + * type Query { + * reviews(filter: ReviewInput): [String] + * } + * `); + * + * const ReviewInput = assertInputObjectType(schema.getType('ReviewInput')); + * const fields = ReviewInput.getFields(); + * + * Object.keys(fields); // => ['stars', 'commentary'] + * fields.commentary.default; // => { literal: { kind: 'StringValue', value: '' } } + * ``` + */ + getFields(): GraphQLInputFieldMap; + /** + * Returns a normalized configuration object for this object. + * @returns A configuration object that can be used to recreate this object. + * @example + * ```ts + * import { + * GraphQLInputObjectType, + * GraphQLInt, + * GraphQLNonNull, + * } from 'graphql/type'; + * + * const ReviewInput = new GraphQLInputObjectType({ + * name: 'ReviewInput', + * fields: { + * stars: { type: new GraphQLNonNull(GraphQLInt) }, + * }, + * }); + * + * const config = ReviewInput.toConfig(); + * const ReviewInputCopy = new GraphQLInputObjectType(config); + * + * String(config.fields.stars.type); // => 'Int!' + * String(ReviewInputCopy.getFields().stars.type); // => 'Int!' + * ``` + */ + toConfig(): GraphQLInputObjectTypeNormalizedConfig; + /** + * Returns the schema coordinate identifying this input object type. + * @returns The schema coordinate for this input object type. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertInputObjectType } from 'graphql/type'; + * + * const schema = buildSchema(` + * input ReviewInput { + * stars: Int! + * } + * + * type Query { + * reviews(filter: ReviewInput): [String] + * } + * `); + * + * const ReviewInput = assertInputObjectType(schema.getType('ReviewInput')); + * + * ReviewInput.toString(); // => 'ReviewInput' + * ``` + */ + toString(): string; + /** + * Returns the JSON representation used when this object is serialized. + * @returns The JSON-serializable representation. + * @example + * ```ts + * import { GraphQLInputObjectType, GraphQLString } from 'graphql/type'; + * + * const ReviewInput = new GraphQLInputObjectType({ + * name: 'ReviewInput', + * fields: { + * commentary: { type: GraphQLString }, + * }, + * }); + * + * ReviewInput.toJSON(); // => 'ReviewInput' + * JSON.stringify({ type: ReviewInput }); // => '{"type":"ReviewInput"}' + * ``` + */ + toJSON(): string; +} +/** Configuration used to construct a GraphQLInputObjectType. */ +export interface GraphQLInputObjectTypeConfig { + /** The GraphQL name for this schema element. */ + name: string; + /** Human-readable description for this schema element, if provided. */ + description?: Maybe<string>; + /** Fields declared by this object, interface, input object, or literal. */ + fields: ThunkObjMap<GraphQLInputFieldConfig>; + /** Custom extension fields reserved for users. */ + extensions?: Maybe<Readonly<GraphQLInputObjectTypeExtensions>>; + /** AST node from which this schema element was built, if available. */ + astNode?: Maybe<InputObjectTypeDefinitionNode>; + /** AST extension nodes applied to this schema element. */ + extensionASTNodes?: Maybe<ReadonlyArray<InputObjectTypeExtensionNode>>; + /** Whether this input object uses the experimental OneOf input object semantics. */ + isOneOf?: boolean; +} +interface GraphQLInputObjectTypeNormalizedConfig extends GraphQLInputObjectTypeConfig { + fields: GraphQLInputFieldNormalizedConfigMap; + extensions: Readonly<GraphQLInputObjectTypeExtensions>; + extensionASTNodes: ReadonlyArray<InputObjectTypeExtensionNode>; +} +/** + * Custom extensions + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLInputFieldExtensions { + [attributeName: string | symbol]: unknown; +} +/** Configuration used to define a GraphQL input field. */ +export interface GraphQLInputFieldConfig { + /** Human-readable description for this schema element, if provided. */ + description?: Maybe<string>; + /** The GraphQL type reference or runtime type for this element. */ + type: GraphQLInputType; + /** + * Deprecated legacy default value for this input field. Use `default` + * instead. + * @deprecated use `default` instead, `defaultValue` will be removed in v18 + */ + defaultValue?: unknown; + /** Default value represented as either a runtime value or a GraphQL literal. */ + default?: GraphQLDefaultInput | undefined; + /** Reason this element is deprecated, if one was provided. */ + deprecationReason?: Maybe<string>; + /** Custom extension fields reserved for users. */ + extensions?: Maybe<Readonly<GraphQLInputFieldExtensions>>; + /** AST node from which this schema element was built, if available. */ + astNode?: Maybe<InputValueDefinitionNode>; +} +/** A map of input field names to input field configuration objects. */ +export type GraphQLInputFieldConfigMap = ObjMap<GraphQLInputFieldConfig>; +interface GraphQLInputFieldNormalizedConfig extends GraphQLInputFieldConfig { + default: GraphQLDefaultInput | undefined; + extensions: Readonly<GraphQLInputFieldExtensions>; +} +type GraphQLInputFieldNormalizedConfigMap = ObjMap<GraphQLInputFieldNormalizedConfig>; +/** A resolved GraphQL input field definition. */ +export declare class GraphQLInputField implements GraphQLSchemaElement { + /** Input object type that owns this input field. */ + parentType: GraphQLInputObjectType; + /** The GraphQL name for this schema element. */ + name: string; + /** Human-readable description for this schema element, if provided. */ + description: Maybe<string>; + /** The GraphQL type reference or runtime type for this element. */ + type: GraphQLInputType; + /** + * Deprecated legacy default value used when no explicit value is supplied. + * Use `default` instead. + * @deprecated use `default` instead, `defaultValue` will be removed in v18 + */ + defaultValue: unknown; + /** Default value represented as either a runtime value or a GraphQL literal. */ + default: GraphQLDefaultInput | undefined; + /** Reason this element is deprecated, if one was provided. */ + deprecationReason: Maybe<string>; + /** Custom extension fields reserved for users. */ + extensions: Readonly<GraphQLInputFieldExtensions>; + /** AST node from which this schema element was built, if available. */ + astNode: Maybe<InputValueDefinitionNode>; + /** + * Creates a resolved GraphQL input field definition. + * @param parentType - Input object type that owns this field. + * @param name - Input field name. + * @param config - Input field configuration. + * @example + * ```ts + * import { + * GraphQLInputField, + * GraphQLInputObjectType, + * GraphQLString, + * } from 'graphql/type'; + * + * const ReviewInput = new GraphQLInputObjectType({ + * name: 'ReviewInput', + * fields: {}, + * }); + * const field = new GraphQLInputField(ReviewInput, 'commentary', { + * type: GraphQLString, + * default: { value: '' }, + * }); + * + * field.parentType; // => ReviewInput + * field.name; // => 'commentary' + * field.default.value; // => '' + * ``` + */ + constructor(parentType: GraphQLInputObjectType, name: string, config: GraphQLInputFieldConfig); + /** + * Returns the value used by `Object.prototype.toString`. + * @returns The built-in string tag for this object. + */ + get [Symbol.toStringTag](): string; + /** + * Returns a normalized configuration object for this input field. + * @returns A configuration object that can be used to recreate this input field. + * @example + * ```ts + * import { + * GraphQLInputField, + * GraphQLInputObjectType, + * GraphQLString, + * } from 'graphql/type'; + * + * const ReviewInput = new GraphQLInputObjectType({ + * name: 'ReviewInput', + * fields: {}, + * }); + * const field = new GraphQLInputField(ReviewInput, 'commentary', { + * type: GraphQLString, + * extensions: { form: 'review' }, + * }); + * + * field.toConfig().extensions; // => { form: 'review' } + * ``` + */ + toConfig(): GraphQLInputFieldNormalizedConfig; + /** + * Returns this input field as a schema coordinate string. + * @returns The input field coordinate. + * @example + * ```ts + * import { + * GraphQLInputField, + * GraphQLInputObjectType, + * GraphQLString, + * } from 'graphql/type'; + * + * const ReviewInput = new GraphQLInputObjectType({ + * name: 'ReviewInput', + * fields: {}, + * }); + * const field = new GraphQLInputField(ReviewInput, 'commentary', { + * type: GraphQLString, + * }); + * + * field.toString(); // => 'ReviewInput.commentary' + * ``` + */ + toString(): string; + /** + * Returns the JSON representation used when this object is serialized. + * @returns The input field coordinate. + * @example + * ```ts + * import { + * GraphQLInputField, + * GraphQLInputObjectType, + * GraphQLString, + * } from 'graphql/type'; + * + * const ReviewInput = new GraphQLInputObjectType({ + * name: 'ReviewInput', + * fields: {}, + * }); + * const field = new GraphQLInputField(ReviewInput, 'commentary', { + * type: GraphQLString, + * }); + * + * JSON.stringify(field); // => '"ReviewInput.commentary"' + * ``` + */ + toJSON(): string; +} +/** + * Returns true when the input field is non-null and has no default value. + * @param field - The input field definition to inspect. + * @returns True when the input field is non-null and has no default value. + * @example + * ```ts + * import { + * GraphQLInputField, + * GraphQLInputObjectType, + * GraphQLInt, + * GraphQLNonNull, + * GraphQLString, + * isRequiredInputField, + * } from 'graphql/type'; + * + * const ReviewInput = new GraphQLInputObjectType({ + * name: 'ReviewInput', + * fields: {}, + * }); + * const requiredField = new GraphQLInputField(ReviewInput, 'id', { + * type: new GraphQLNonNull(GraphQLInt), + * }); + * const optionalField = new GraphQLInputField(ReviewInput, 'name', { + * type: GraphQLString, + * }); + * const fieldWithDefault = new GraphQLInputField(ReviewInput, 'limit', { + * type: new GraphQLNonNull(GraphQLInt), + * default: { value: 10 }, + * }); + * + * isRequiredInputField(requiredField); // => true + * isRequiredInputField(optionalField); // => false + * isRequiredInputField(fieldWithDefault); // => false + * ``` + */ +export declare function isRequiredInputField(field: GraphQLInputField): boolean; +/** A map of input field names to resolved input field definitions. */ +export type GraphQLInputFieldMap = ObjMap<GraphQLInputField>; +/** + * Test if the given value is a GraphQL schema. + * @param schema - Value to inspect. + * @returns True when the value is a GraphQLSchema. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { GraphQLString, isSchema } from 'graphql/type'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * + * isSchema(schema); // => true + * isSchema(GraphQLString); // => false + * ``` + */ +export declare function isSchema(schema: unknown): schema is GraphQLSchema; +/** + * Returns the value as a GraphQLSchema, or throws if it is not a schema. + * @param schema - GraphQL schema to use. + * @returns The value typed as a GraphQLSchema. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertSchema, GraphQLString } from 'graphql/type'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * + * assertSchema(schema); // => schema + * assertSchema(GraphQLString); // throws an error + * ``` + */ +export declare function assertSchema(schema: unknown): GraphQLSchema; +/** + * Custom extensions + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLSchemaExtensions { + [attributeName: string | symbol]: unknown; +} +/** + * Schema Definition + * + * A Schema is created by supplying the root types of each type of operation, + * query and mutation (optional). A schema definition is then supplied to the + * validator and executor. + * @example + * ```ts + * const MyAppQueryRootType = new GraphQLObjectType({ + * name: 'Query', + * fields: { + * greeting: { type: GraphQLString }, + * }, + * }); + * + * const MyAppMutationRootType = new GraphQLObjectType({ + * name: 'Mutation', + * fields: { + * setGreeting: { type: GraphQLString }, + * }, + * }); + * + * const MyAppSchema = new GraphQLSchema({ + * query: MyAppQueryRootType, + * mutation: MyAppMutationRootType, + * }); + * ``` + * @example + * When the schema is constructed, by default only the types that are reachable + * by traversing the root types are included, other types must be explicitly + * referenced. + * + * ```ts + * const characterInterface = new GraphQLInterfaceType({ + * name: 'Character', + * fields: { + * name: { type: GraphQLString }, + * }, + * }); + * + * const humanType = new GraphQLObjectType({ + * name: 'Human', + * interfaces: [characterInterface], + * fields: { + * name: { type: GraphQLString }, + * }, + * }); + * + * const droidType = new GraphQLObjectType({ + * name: 'Droid', + * interfaces: [characterInterface], + * fields: { + * name: { type: GraphQLString }, + * }, + * }); + * + * const schema = new GraphQLSchema({ + * query: new GraphQLObjectType({ + * name: 'Query', + * fields: { + * hero: { type: characterInterface }, + * }, + * }), + * // Since this schema references only the `Character` interface it's + * // necessary to explicitly list the types that implement it if + * // you want them to be included in the final schema. + * types: [humanType, droidType], + * }); + * ``` + * @example + * If an array of `directives` are provided to GraphQLSchema, that will be the + * exact list of directives represented and allowed. If `directives` is not + * provided then a default set of the specified directives (e.g. `@include` and + * `@skip`) will be used. If you wish to provide *additional* directives to + * these specified directives, you must explicitly declare them. + * + * ```ts + * const MyAppSchema = new GraphQLSchema({ + * query: MyAppQueryRootType, + * directives: specifiedDirectives.concat([myCustomDirective]), + * }); + * ``` + */ +export declare class GraphQLSchema { + /** Human-readable description for this schema element, if provided. */ + description: Maybe<string>; + /** Custom extension fields reserved for users. */ + extensions: Readonly<GraphQLSchemaExtensions>; + /** AST node from which this schema element was built, if available. */ + astNode: Maybe<SchemaDefinitionNode>; + /** AST extension nodes applied to this schema element. */ + extensionASTNodes: ReadonlyArray<SchemaExtensionNode>; + /** Whether this schema instance skips validation checks. */ + assumeValid: boolean; + private _queryType; + private _mutationType; + private _subscriptionType; + private _directives; + private _typeMap; + private _subTypeMap; + private _implementationsMap; + /** + * Creates a GraphQLSchema instance. + * @param config - Configuration describing this object. + * @example + * ```ts + * // Create a schema with the required query root. + * import { GraphQLObjectType, GraphQLSchema, GraphQLString } from 'graphql/type'; + * + * const Query = new GraphQLObjectType({ + * name: 'Query', + * fields: { + * greeting: { + * type: GraphQLString, + * resolve: () => 'Hello', + * }, + * }, + * }); + * + * const schema = new GraphQLSchema({ + * description: 'The application schema.', + * query: Query, + * }); + * + * schema.getQueryType(); // => Query + * schema.description; // => 'The application schema.' + * ``` + * @example + * ```ts + * // This variant configures every schema option, including directives and extensions. + * import { DirectiveLocation, parse } from 'graphql/language'; + * import { + * GraphQLBoolean, + * GraphQLDirective, + * GraphQLObjectType, + * GraphQLSchema, + * GraphQLString, + * } from 'graphql/type'; + * + * const Query = new GraphQLObjectType({ + * name: 'Query', + * fields: { greeting: { type: GraphQLString } }, + * }); + * const Mutation = new GraphQLObjectType({ + * name: 'Mutation', + * fields: { setGreeting: { type: GraphQLString } }, + * }); + * const Subscription = new GraphQLObjectType({ + * name: 'Subscription', + * fields: { greetingChanged: { type: GraphQLString } }, + * }); + * const AuditEvent = new GraphQLObjectType({ + * name: 'AuditEvent', + * fields: { message: { type: GraphQLString } }, + * }); + * const authDirective = new GraphQLDirective({ + * name: 'auth', + * locations: [DirectiveLocation.FIELD_DEFINITION], + * args: { required: { type: GraphQLBoolean } }, + * }); + * const schemaDocument = parse(` + * schema { + * query: Query + * mutation: Mutation + * subscription: Subscription + * } + * + * extend schema @auth + * `); + * + * const schema = new GraphQLSchema({ + * description: 'Operations exposed by the application.', + * query: Query, + * mutation: Mutation, + * subscription: Subscription, + * types: [AuditEvent], + * directives: [authDirective], + * extensions: { owner: 'platform' }, + * astNode: schemaDocument.definitions[0], + * extensionASTNodes: [schemaDocument.definitions[1]], + * assumeValid: true, + * }); + * + * schema.getMutationType(); // => Mutation + * schema.getSubscriptionType(); // => Subscription + * schema.getType('AuditEvent'); // => AuditEvent + * schema.getDirective('auth'); // => authDirective + * schema.extensions; // => { owner: 'platform' } + * ``` + */ + constructor(config: Readonly<GraphQLSchemaConfig>); + /** + * Returns the value used by `Object.prototype.toString`. + * @returns The built-in string tag for this object. + */ + get [Symbol.toStringTag](): string; + /** + * Returns the root object type for query operations. + * @returns The query root type, if this schema defines one. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * + * schema.getQueryType()?.name; // => 'Query' + * ``` + */ + getQueryType(): Maybe<GraphQLObjectType>; + /** + * Returns the root object type for mutation operations. + * @returns The mutation root type, if this schema defines one. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * + * type Mutation { + * setGreeting(value: String!): String + * } + * `); + * + * schema.getMutationType()?.name; // => 'Mutation' + * ``` + */ + getMutationType(): Maybe<GraphQLObjectType>; + /** + * Returns the root object type for subscription operations. + * @returns The subscription root type, if this schema defines one. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * + * type Subscription { + * greetings: String + * } + * `); + * + * schema.getSubscriptionType()?.name; // => 'Subscription' + * ``` + */ + getSubscriptionType(): Maybe<GraphQLObjectType>; + /** + * Returns the root object type for the requested operation kind. + * @param operation - Operation kind to resolve. + * @returns The root object type for the operation kind, if this schema defines one. + * @example + * ```ts + * import { OperationTypeNode } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * + * type Mutation { + * setGreeting(value: String!): String + * } + * `); + * + * schema.getRootType(OperationTypeNode.QUERY)?.name; // => 'Query' + * schema.getRootType(OperationTypeNode.MUTATION)?.name; // => 'Mutation' + * schema.getRootType(OperationTypeNode.SUBSCRIPTION); // => undefined + * ``` + */ + getRootType(operation: OperationTypeNode): Maybe<GraphQLObjectType>; + /** + * Returns all named types known to this schema. + * @returns A map of schema types keyed by type name. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type User { + * name: String + * } + * + * type Query { + * viewer: User + * } + * `); + * + * const typeMap = schema.getTypeMap(); + * + * typeMap.User.name; // => 'User' + * typeMap.Query.name; // => 'Query' + * typeMap.String.name; // => 'String' + * ``` + */ + getTypeMap(): TypeMap; + /** + * Returns the named type with the provided name. + * @param name - The GraphQL name to look up. + * @returns The named schema type, if one exists. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type User { + * name: String + * } + * + * type Query { + * viewer: User + * } + * `); + * + * schema.getType('User')?.toString(); // => 'User' + * schema.getType('Missing'); // => undefined + * ``` + */ + getType(name: string): GraphQLNamedType | undefined; + /** + * Returns object types that may be returned for an abstract type. + * @param abstractType - Interface or union type to inspect. + * @returns Object types that may satisfy the abstract type. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertInterfaceType, assertUnionType } from 'graphql/type'; + * + * const schema = buildSchema(` + * interface Node { + * id: ID! + * } + * + * type User implements Node { + * id: ID! + * } + * + * type Organization implements Node { + * id: ID! + * } + * + * union SearchResult = User | Organization + * + * type Query { + * node: Node + * search: [SearchResult] + * } + * `); + * + * const Node = assertInterfaceType(schema.getType('Node')); + * const SearchResult = assertUnionType(schema.getType('SearchResult')); + * + * schema.getPossibleTypes(Node).map((type) => type.name); // => ['User', 'Organization'] + * schema.getPossibleTypes(SearchResult).map((type) => type.name); // => ['User', 'Organization'] + * ``` + */ + getPossibleTypes(abstractType: GraphQLAbstractType): ReadonlyArray<GraphQLObjectType>; + /** + * Returns objects and interfaces that implement an interface type. + * @param interfaceType - Interface type to inspect. + * @returns Object and interface implementations of the interface. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertInterfaceType } from 'graphql/type'; + * + * const schema = buildSchema(` + * interface Resource { + * url: String! + * } + * + * interface Image implements Resource { + * url: String! + * width: Int + * } + * + * type Photo implements Resource & Image { + * url: String! + * width: Int + * } + * + * type Query { + * resource: Resource + * } + * `); + * + * const Resource = assertInterfaceType(schema.getType('Resource')); + * const implementations = schema.getImplementations(Resource); + * + * implementations.interfaces.map((type) => type.name); // => ['Image'] + * implementations.objects.map((type) => type.name); // => ['Photo'] + * ``` + */ + getImplementations(interfaceType: GraphQLInterfaceType): { + objects: ReadonlyArray<GraphQLObjectType>; + interfaces: ReadonlyArray<GraphQLInterfaceType>; + }; + /** + * Returns whether one type is a possible runtime subtype of an abstract type. + * @param abstractType - Interface or union type to inspect. + * @param maybeSubType - Object or interface type to test as a possible subtype. + * @returns True when the subtype may satisfy the abstract type. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertInterfaceType, assertObjectType } from 'graphql/type'; + * + * const schema = buildSchema(` + * interface Node { + * id: ID! + * } + * + * type User implements Node { + * id: ID! + * } + * + * type Review { + * body: String + * } + * + * type Query { + * node: Node + * review: Review + * } + * `); + * + * const Node = assertInterfaceType(schema.getType('Node')); + * const User = assertObjectType(schema.getType('User')); + * const Review = assertObjectType(schema.getType('Review')); + * + * schema.isSubType(Node, User); // => true + * schema.isSubType(Node, Review); // => false + * ``` + */ + isSubType(abstractType: GraphQLAbstractType, maybeSubType: GraphQLObjectType | GraphQLInterfaceType): boolean; + /** + * Returns directives available in this schema. + * @returns Directives available in this schema. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * directive @upper on FIELD_DEFINITION + * + * type Query { + * greeting: String @upper + * } + * `); + * + * schema.getDirectives().map((directive) => directive.name); // => ['include', 'skip', 'deprecated', 'specifiedBy', 'oneOf', 'upper'] + * ``` + */ + getDirectives(): ReadonlyArray<GraphQLDirective>; + /** + * Returns the current directive definition. + * @param name - The GraphQL name to look up. + * @returns The current directive definition, if known. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * directive @upper on FIELD_DEFINITION + * + * type Query { + * greeting: String @upper + * } + * `); + * + * schema.getDirective('upper')?.name; // => 'upper' + * schema.getDirective('missing'); // => undefined + * ``` + */ + getDirective(name: string): Maybe<GraphQLDirective>; + /** + * This method looks up the field on the given type definition. + * It has special casing for the three introspection fields, `__schema`, + * `__type` and `__typename`. + * + * `__typename` is special because it can always be queried as a field, even + * in situations where no other fields are allowed, like on a Union. + * + * `__schema` and `__type` could get automatically added to the query type, + * but that would require mutating type definitions, which would cause issues. + * @param parentType - Composite type to look up the field on. + * @param fieldName - Field name to look up. + * @returns The field definition, including supported introspection fields. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * const queryType = schema.getQueryType(); + * + * schema.getField(queryType, 'greeting')?.name; // => 'greeting' + * schema.getField(queryType, '__typename')?.name; // => '__typename' + * schema.getField(queryType, 'missing'); // => undefined + * ``` + */ + getField(parentType: GraphQLCompositeType, fieldName: string): GraphQLField<unknown, unknown> | undefined; + /** + * Returns a normalized configuration object for this object. + * + * The returned config preserves the original `assumeValid` flag so the schema + * can be recreated with the same validation behavior. + * @returns A configuration object that can be used to recreate this object. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { GraphQLSchema } from 'graphql/type'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * + * const config = schema.toConfig(); + * const schemaCopy = new GraphQLSchema(config); + * + * config.query?.name; // => 'Query' + * schemaCopy.getQueryType()?.name; // => 'Query' + * ``` + */ + toConfig(): GraphQLSchemaNormalizedConfig; +} +type TypeMap = ObjMap<GraphQLNamedType>; +interface GraphQLSchemaValidationOptions { + /** + * When building a schema from a GraphQL service's introspection result, it + * might be safe to assume the schema is valid. Set to true to assume the + * produced schema is valid. + * + * Default: false + * + * @internal + */ + assumeValid?: boolean | undefined; +} +/** Configuration used to construct a GraphQLSchema. */ +export interface GraphQLSchemaConfig extends GraphQLSchemaValidationOptions { + /** Human-readable description for this schema element, if provided. */ + description?: Maybe<string>; + /** Root object type for query operations. */ + query?: Maybe<GraphQLObjectType>; + /** Root object type for mutation operations. */ + mutation?: Maybe<GraphQLObjectType>; + /** Root object type for subscription operations. */ + subscription?: Maybe<GraphQLObjectType>; + /** Object types that belong to this union type. */ + types?: Maybe<ReadonlyArray<GraphQLNamedType>>; + /** Directives available in this schema or applied to this AST node. */ + directives?: Maybe<ReadonlyArray<GraphQLDirective>>; + /** Custom extension fields reserved for users. */ + extensions?: Maybe<Readonly<GraphQLSchemaExtensions>>; + /** AST node from which this schema element was built, if available. */ + astNode?: Maybe<SchemaDefinitionNode>; + /** AST extension nodes applied to this schema element. */ + extensionASTNodes?: Maybe<ReadonlyArray<SchemaExtensionNode>>; +} +interface GraphQLSchemaNormalizedConfig extends GraphQLSchemaConfig { + description: Maybe<string>; + types: ReadonlyArray<GraphQLNamedType>; + directives: ReadonlyArray<GraphQLDirective>; + extensions: Readonly<GraphQLSchemaExtensions>; + extensionASTNodes: ReadonlyArray<SchemaExtensionNode>; + assumeValid: boolean; +} +/** + * Error thrown when GraphQL execution is aborted. + * @typeParam TResult - Result value type. + */ +export declare class AbortedGraphQLExecutionError<TResult> extends Error { + /** Partial execution result available when execution was aborted. */ + readonly abortedResult: PromiseOrValue<TResult>; + /** + * Creates an error for an aborted GraphQL execution. + * @param reason - Abort reason used as the error cause. + * @param result - Partial execution result available when execution stopped. + * @example + * ```ts + * import { AbortedGraphQLExecutionError } from 'graphql/execution'; + * + * const cause = new Error('Request cancelled.'); + * const partialResult = { data: { viewer: null } }; + * const error = new AbortedGraphQLExecutionError(cause, partialResult); + * + * error.message; // => 'Request cancelled.' + * error.cause; // => cause + * error.abortedResult; // => partialResult + * ``` + */ + constructor(reason: unknown, result: PromiseOrValue<TResult>); + /** + * Returns the value used by `Object.prototype.toString`. + * @returns The built-in string tag for this object. + */ + get [Symbol.toStringTag](): string; +} +/** Arguments accepted by execute and executeSync. */ +export interface ExecutionArgs { + /** The schema used for validation or execution. */ + schema: GraphQLSchema; + /** The parsed GraphQL document to execute. */ + document: DocumentNode; + /** Initial root value passed to the operation. */ + rootValue?: unknown; + /** Application context value passed to every resolver. */ + contextValue?: unknown; + /** Runtime variable values keyed by variable name. */ + variableValues?: Maybe<{ + readonly [variable: string]: unknown; + }>; + /** Name of the operation to execute when the document contains multiple operations. */ + operationName?: Maybe<string>; + /** Resolver used when a field does not define its own resolver. */ + fieldResolver?: Maybe<GraphQLFieldResolver<any, any>>; + /** Resolver used when an abstract type does not define its own resolver. */ + typeResolver?: Maybe<GraphQLTypeResolver<any, any>>; + /** Resolver used for the root subscription field. */ + subscribeFieldResolver?: Maybe<GraphQLFieldResolver<any, any>>; + /** Whether suggestion text should be omitted from request errors. */ + hideSuggestions?: Maybe<boolean>; + /** AbortSignal used to cancel execution. */ + abortSignal?: Maybe<AbortSignal>; + /** Whether incremental execution may begin eligible work early. */ + enableEarlyExecution?: Maybe<boolean>; + /** Execution hooks invoked during this operation. */ + hooks?: Maybe<ExecutionHooks>; + /** Additional execution options. */ + options?: { + /** + * Set the maximum number of errors allowed for coercing (defaults to 50). + * + * @internal + */ + maxCoercionErrors?: number; + }; +} +/** + * Data that must be available at all points during query execution. + * + * Namely, schema of the type system that is currently executing, + * and the fragments defined in the query document + */ +export interface ValidatedExecutionArgs { + /** Schema used for execution. */ + schema: GraphQLSchema; + /** Parsed GraphQL document being executed. */ + document: DocumentNode; + /** Fragment definitions keyed by fragment name. */ + fragmentDefinitions: ObjMap<FragmentDefinitionNode>; + /** Fragment details keyed by fragment name. */ + fragments: ObjMap<FragmentDetails>; + /** Root value passed to the operation. */ + rootValue: unknown; + /** Application context value passed to every resolver. */ + contextValue: unknown; + /** Operation definition selected for execution. */ + operation: OperationDefinitionNode; + /** Operation variable values with source metadata and coerced runtime values. */ + variableValues: VariableValues; + /** Raw variable values provided by the caller before coercion. */ + rawVariableValues: Maybe<{ + readonly [variable: string]: unknown; + }>; + /** Resolver used for fields without an explicit resolver. */ + fieldResolver: GraphQLFieldResolver<any, any>; + /** Resolver used for abstract types without an explicit type resolver. */ + typeResolver: GraphQLTypeResolver<any, any>; + /** Resolver used for subscription fields without an explicit subscribe resolver. */ + subscribeFieldResolver: GraphQLFieldResolver<any, any>; + /** Whether suggestion text should be omitted from execution errors. */ + hideSuggestions: boolean; + /** Whether execution should use error propagation. */ + errorPropagation: boolean; + /** External signal that may abort execution. */ + externalAbortSignal: AbortSignal | undefined; + /** Whether incremental execution may begin eligible work early. */ + enableEarlyExecution: boolean; + /** Execution hooks supplied by the caller. */ + hooks: ExecutionHooks | undefined; +} +/** Validated execution arguments for a subscription operation. */ +export interface ValidatedSubscriptionArgs extends ValidatedExecutionArgs { + /** Subscription operation definition selected for execution. */ + operation: SubscriptionOperationDefinitionNode; +} +/** Information passed to hooks after asynchronous execution work has finished. */ +export interface AsyncWorkFinishedInfo { + /** Validated execution arguments for the operation that finished async work. */ + validatedExecutionArgs: ValidatedExecutionArgs; +} +/** Optional hooks invoked during GraphQL execution. */ +export interface ExecutionHooks { + /** Called after all tracked asynchronous execution work has settled. */ + asyncWorkFinished?: (info: AsyncWorkFinishedInfo) => void; +} +/** + * Represents the response produced by executing a GraphQL operation. + * @typeParam TData - Shape of the execution data payload. + * @typeParam TExtensions - Shape of the extensions payload. + */ +export interface ExecutionResult<TData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> { + /** Errors raised while parsing, validating, or executing the operation. */ + errors?: ReadonlyArray<GraphQLError>; + /** Data returned by execution, or null when execution could not produce data. */ + data?: TData | null; + /** Additional non-standard metadata included in the execution result. */ + extensions?: TExtensions; +} +/** + * A JSON-serializable GraphQL execution result. + * @typeParam TData - Shape of the formatted data payload. + * @typeParam TExtensions - Shape of the formatted extensions payload. + */ +export interface FormattedExecutionResult<TData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> { + /** Errors raised while parsing, validating, or executing the operation. */ + errors?: ReadonlyArray<GraphQLFormattedError>; + /** Data returned by execution, or null when execution could not produce data. */ + data?: TData | null; + /** Additional non-standard metadata included in the formatted result. */ + extensions?: TExtensions; +} +/** + * Results for an operation that produced incremental payloads. + * @typeParam TInitialData - Shape of the initial result data payload. + * @typeParam TDeferredData - Shape of deferred fragment data payloads. + * @typeParam TStreamItem - Shape of streamed list items. + * @typeParam TExtensions - Shape of extensions payloads. + */ +export interface ExperimentalIncrementalExecutionResults<TInitialData = ObjMap<unknown>, TDeferredData = ObjMap<unknown>, TStreamItem = unknown, TExtensions = ObjMap<unknown>> { + /** Initial execution result delivered before subsequent incremental payloads. */ + initialResult: InitialIncrementalExecutionResult<TInitialData, TExtensions>; + /** Async stream of incremental payloads delivered after the initial result. */ + subsequentResults: AsyncGenerator<SubsequentIncrementalExecutionResult<TDeferredData, TStreamItem, TExtensions>, void, void>; +} +/** + * JSON-serializable form of incremental execution results. + * @typeParam TInitial - Shape of the formatted initial result data payload. + * @typeParam TDeferredData - Shape of formatted deferred fragment data payloads. + * @typeParam TStreamItem - Shape of formatted streamed list items. + * @typeParam TExtensions - Shape of formatted extensions payloads. + */ +export interface FormattedExperimentalIncrementalExecutionResults<TInitial = ObjMap<unknown>, TDeferredData = ObjMap<unknown>, TStreamItem = unknown, TExtensions = ObjMap<unknown>> { + /** Formatted initial execution result. */ + initialResult: FormattedInitialIncrementalExecutionResult<TInitial, TExtensions>; + /** Async stream of formatted incremental payloads. */ + subsequentResults: AsyncGenerator<FormattedSubsequentIncrementalExecutionResult<TDeferredData, TStreamItem, TExtensions>, void, void>; +} +/** + * Initial execution result for an operation that produced incremental payloads. + * @typeParam TData - Shape of the initial data payload. + * @typeParam TExtensions - Shape of the extensions payload. + */ +export interface InitialIncrementalExecutionResult<TData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> extends ExecutionResult<TData, TExtensions> { + /** Data produced by the initial execution payload. */ + data: TData; + /** Incremental payloads that are still pending after the initial result. */ + pending: ReadonlyArray<PendingResult>; + /** Indicates that subsequent incremental payloads will follow. */ + hasNext: true; + /** Additional non-standard metadata included in the initial result. */ + extensions?: TExtensions; +} +/** + * JSON-serializable form of an initial incremental execution result. + * @typeParam TInitialData - Shape of the formatted initial data payload. + * @typeParam TExtensions - Shape of the formatted extensions payload. + */ +export interface FormattedInitialIncrementalExecutionResult<TInitialData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> extends FormattedExecutionResult<TInitialData, TExtensions> { + /** Formatted data produced by the initial execution payload. */ + data: TInitialData; + /** Formatted list of incremental payloads still pending after the initial result. */ + pending: ReadonlyArray<PendingResult>; + /** Indicates whether subsequent incremental payloads will follow. */ + hasNext: boolean; + /** Additional non-standard metadata included in the formatted initial result. */ + extensions?: TExtensions; +} +/** + * Subsequent payload produced by incremental execution. + * @typeParam TDeferredData - Shape of deferred fragment data payloads. + * @typeParam TStreamItem - Shape of streamed list items. + * @typeParam TExtensions - Shape of the extensions payload. + */ +export interface SubsequentIncrementalExecutionResult<TDeferredData = ObjMap<unknown>, TStreamItem = unknown, TExtensions = ObjMap<unknown>> { + /** Incremental payloads that became pending with this response. */ + pending?: ReadonlyArray<PendingResult>; + /** Deferred or streamed payloads delivered by this response. */ + incremental?: ReadonlyArray<IncrementalResult<TDeferredData, TStreamItem, TExtensions>>; + /** Incremental payloads that completed with this response. */ + completed?: ReadonlyArray<CompletedResult>; + /** Indicates whether more incremental payloads will follow. */ + hasNext: boolean; + /** Additional non-standard metadata included in this payload. */ + extensions?: TExtensions; +} +/** + * JSON-serializable form of a subsequent incremental execution payload. + * @typeParam TDeferredData - Shape of formatted deferred fragment data payloads. + * @typeParam TStreamItem - Shape of formatted streamed list items. + * @typeParam TExtensions - Shape of formatted extensions payloads. + */ +export interface FormattedSubsequentIncrementalExecutionResult<TDeferredData = ObjMap<unknown>, TStreamItem = unknown, TExtensions = ObjMap<unknown>> { + /** Indicates whether more incremental payloads will follow. */ + hasNext: boolean; + /** Formatted incremental payloads that became pending with this response. */ + pending?: ReadonlyArray<PendingResult>; + /** Formatted deferred or streamed payloads delivered by this response. */ + incremental?: ReadonlyArray<FormattedIncrementalResult<TDeferredData, TStreamItem, TExtensions>>; + /** Formatted incremental payloads that completed with this response. */ + completed?: ReadonlyArray<FormattedCompletedResult>; + /** Additional non-standard metadata included in this formatted payload. */ + extensions?: TExtensions; +} +/** + * Incremental payload produced by a deferred fragment. + * @typeParam TDeferredData - Shape of deferred fragment data. + * @typeParam TExtensions - Shape of extensions payloads. + */ +export interface IncrementalDeferResult<TDeferredData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> { + /** Identifier matching this payload to a pending deferred fragment. */ + id: string; + /** Path from the deferred fragment location to this payload. */ + subPath?: ReadonlyArray<string | number>; + /** Errors raised while executing the deferred fragment. */ + errors?: ReadonlyArray<GraphQLError>; + /** Data produced by the deferred fragment. */ + data: TDeferredData; + /** Additional non-standard metadata included in this payload. */ + extensions?: TExtensions; +} +/** + * JSON-serializable form of a deferred fragment payload. + * @typeParam TDeferredData - Shape of formatted deferred fragment data. + * @typeParam TExtensions - Shape of formatted extensions payloads. + */ +export interface FormattedIncrementalDeferResult<TDeferredData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> { + /** Formatted errors raised while executing the deferred fragment. */ + errors?: ReadonlyArray<GraphQLFormattedError>; + /** Formatted data produced by the deferred fragment. */ + data: TDeferredData; + /** Identifier matching this payload to a pending deferred fragment. */ + id: string; + /** Path from the deferred fragment location to this payload. */ + subPath?: ReadonlyArray<string | number>; + /** Additional non-standard metadata included in this formatted payload. */ + extensions?: TExtensions; +} +/** + * Incremental payload produced by a streamed list field. + * @typeParam TStreamItem - Shape of streamed list items. + * @typeParam TExtensions - Shape of extensions payloads. + */ +export interface IncrementalStreamResult<TStreamItem = unknown, TExtensions = ObjMap<unknown>> { + /** Identifier matching this payload to a pending stream. */ + id: string; + /** Path from the streamed field location to these items. */ + subPath?: ReadonlyArray<string | number>; + /** Errors raised while producing streamed items. */ + errors?: ReadonlyArray<GraphQLError>; + /** Streamed list items delivered by this payload. */ + items: ReadonlyArray<TStreamItem>; + /** Additional non-standard metadata included in this payload. */ + extensions?: TExtensions; +} +/** + * JSON-serializable form of a streamed list payload. + * @typeParam TStreamItem - Shape of formatted streamed list items. + * @typeParam TExtensions - Shape of formatted extensions payloads. + */ +export interface FormattedIncrementalStreamResult<TStreamItem = Array<unknown>, TExtensions = ObjMap<unknown>> { + /** Formatted errors raised while producing streamed items. */ + errors?: ReadonlyArray<GraphQLFormattedError>; + /** Formatted streamed list items delivered by this payload. */ + items: ReadonlyArray<TStreamItem>; + /** Identifier matching this payload to a pending stream. */ + id: string; + /** Path from the streamed field location to these items. */ + subPath?: ReadonlyArray<string | number>; + /** Additional non-standard metadata included in this formatted payload. */ + extensions?: TExtensions; +} +/** + * Deferred fragment or streamed list payload produced by incremental execution. + * @typeParam TDeferredData - Shape of deferred fragment data. + * @typeParam TStreamItem - Shape of streamed list items. + * @typeParam TExtensions - Shape of extensions payloads. + */ +export type IncrementalResult<TDeferredData = ObjMap<unknown>, TStreamItem = unknown, TExtensions = ObjMap<unknown>> = IncrementalDeferResult<TDeferredData, TExtensions> | IncrementalStreamResult<TStreamItem, TExtensions>; +/** + * JSON-serializable deferred fragment or streamed list payload. + * @typeParam TDeferredData - Shape of formatted deferred fragment data. + * @typeParam TStreamItem - Shape of formatted streamed list items. + * @typeParam TExtensions - Shape of formatted extensions payloads. + */ +export type FormattedIncrementalResult<TDeferredData = ObjMap<unknown>, TStreamItem = unknown, TExtensions = ObjMap<unknown>> = FormattedIncrementalDeferResult<TDeferredData, TExtensions> | FormattedIncrementalStreamResult<TStreamItem, TExtensions>; +interface PendingResult { + id: string; + path: ReadonlyArray<string | number>; + label?: string; +} +interface CompletedResult { + id: string; + errors?: ReadonlyArray<GraphQLError>; +} +interface FormattedCompletedResult { + id: string; + errors?: ReadonlyArray<GraphQLFormattedError>; +} +interface MinimalChannel<TMessage = unknown> { + readonly hasSubscribers?: boolean; + publish: (message: TMessage) => void; + runStores: <T, ContextType extends object>(context: ContextType, fn: (this: ContextType, ...args: Array<unknown>) => T, thisArg?: unknown, ...args: Array<unknown>) => T; +} +interface MinimalTracingChannel<TContext = unknown> { + readonly hasSubscribers: boolean | undefined; + readonly start: MinimalChannel<TContext>; + readonly end: MinimalChannel<TContext>; + readonly asyncStart: MinimalChannel<TContext>; + readonly asyncEnd: MinimalChannel<TContext>; + readonly error: MinimalChannel<TContext>; + traceSync: <T>(fn: (...args: Array<unknown>) => T, context: TContext extends object ? TContext : object, thisArg?: unknown, ...args: Array<unknown>) => T; +} +/** Context published on the sync-only `graphql:parse` channel. */ +export interface GraphQLParseContext { + /** Source text or source object passed to the parser. */ + source: string | Source; + /** Error thrown while parsing, when parsing fails. */ + error?: unknown; + /** Parsed document, when parsing succeeds. */ + result?: DocumentNode; +} +/** Context published on the sync-only `graphql:validate` channel. */ +export interface GraphQLValidateContext { + /** Schema used for validation. */ + schema: GraphQLSchema; + /** Parsed document being validated. */ + document: DocumentNode; + /** Error thrown while validating, when validation fails abruptly. */ + error?: unknown; + /** Validation errors returned by validation. */ + result?: ReadonlyArray<GraphQLError>; +} +/** + * Context published on `graphql:execute`. + * + * Returned results may contain GraphQL errors collected during execution. + */ +export interface GraphQLExecuteContext { + /** Schema used for execution. */ + schema: GraphQLSchema; + /** Parsed document being executed. */ + document: DocumentNode; + /** Raw variable values provided by the caller before coercion. */ + rawVariableValues: Maybe<{ + readonly [variable: string]: unknown; + }>; + /** Selected operation name, if one is available. */ + operationName: string | undefined; + /** Selected operation type, if one is available. */ + operationType: OperationTypeNode | undefined; + /** Error thrown or rejected while executing, when execution fails abruptly. */ + error?: unknown; + /** Execution result returned by execution, including GraphQL errors. */ + result?: ExecutionResult | ExperimentalIncrementalExecutionResults; +} +/** + * Context published on `graphql:execute:rootSelectionSet`. + * + * Returned results may contain GraphQL errors collected during execution. + */ +export interface GraphQLExecuteRootSelectionSetContext { + /** Schema used for execution. */ + schema: GraphQLSchema; + /** Parsed document being executed. */ + document: DocumentNode; + /** Operation definition selected for execution. */ + operation: OperationDefinitionNode; + /** Raw variable values provided by the caller before coercion. */ + rawVariableValues: Maybe<{ + readonly [variable: string]: unknown; + }>; + /** Selected operation name, if one is available. */ + operationName: string | undefined; + /** Selected operation type. */ + operationType: OperationTypeNode; + /** Error thrown or rejected while executing the root selection set. */ + error?: unknown; + /** + * Execution result returned from the root selection set, including GraphQL + * errors. + */ + result?: ExecutionResult | ExperimentalIncrementalExecutionResults; +} +/** + * Context published on `graphql:execute:variableCoercion`. + * + * Coercion runs synchronously while execution arguments are validated, so only + * the `start`/`end` (and, on an abrupt throw, `error`) lifecycle fires. + * Ordinary variable coercion failures are returned on `result.errors`; when + * execution is invoked through APIs such as `execute()` or `subscribe()`, they + * surface as GraphQL result errors rather than as the tracing `error` + * lifecycle event. + */ +export interface GraphQLExecuteVariableCoercionContext { + /** Schema used for variable coercion. */ + schema: GraphQLSchema; + /** Parsed document being executed. */ + document: DocumentNode; + /** Operation definition whose variables are being coerced. */ + operation: OperationDefinitionNode; + /** Raw variable values provided by the caller before coercion. */ + rawVariableValues: Maybe<{ + readonly [variable: string]: unknown; + }>; + /** Selected operation name, if one is available. */ + operationName: string | undefined; + /** Selected operation type. */ + operationType: OperationTypeNode; + /** Error thrown while coercing variables, when coercion fails abruptly. */ + error?: unknown; + /** Coerced variable values or coercion errors returned by coercion. */ + result?: { + variableValues: VariableValues; + } | { + errors: ReadonlyArray<GraphQLError>; + }; +} +/** + * Context published on `graphql:subscribe`. + * + * Subscription source resolver errors and invalid source stream results are + * returned on `result` as ExecutionResult errors; they do not publish the + * `error` lifecycle event unless subscription setup fails abruptly before + * GraphQL can form a result. + */ +export interface GraphQLSubscribeContext { + /** Schema used for subscription execution. */ + schema: GraphQLSchema; + /** Parsed subscription document. */ + document: DocumentNode; + /** Raw variable values provided by the caller before coercion. */ + rawVariableValues: Maybe<{ + readonly [variable: string]: unknown; + }>; + /** Selected operation name, if one is available. */ + operationName: string | undefined; + /** Selected operation type, if one is available. */ + operationType: OperationTypeNode | undefined; + /** Error thrown or rejected while subscribing, when setup fails abruptly. */ + error?: unknown; + /** + * Subscription response stream, or an ExecutionResult containing GraphQL + * errors. + */ + result?: AsyncGenerator<ExecutionResult, void, void> | ExecutionResult; +} +/** + * Context published on `graphql:resolve`. + * + * Resolver throws and rejections publish the `error` lifecycle event here. + * The same failure may also be formatted into the enclosing execution or + * subscription result. + */ +export interface GraphQLResolveContext { + /** Field name being resolved. */ + fieldName: string; + /** Response alias for the field being resolved. */ + alias: string; + /** Parent type name for the field being resolved. */ + parentType: string; + /** Return type string for the field being resolved. */ + fieldType: string; + /** Argument values passed to the resolver. */ + args: ObjMap<unknown>; + /** Whether the field is using the default resolver. */ + isDefaultResolver: boolean; + /** Response path for the field being resolved. */ + fieldPath: string; + /** Error thrown or rejected by the resolver, when resolution fails. */ + error?: unknown; + /** Value returned by the resolver, when resolution succeeds. */ + result?: unknown; +} +/** Mapping from tracing channel name to the context type published on it. */ +export interface GraphQLChannelContextByName { + /** Context published on `graphql:parse`. */ + "graphql:parse": GraphQLParseContext; + /** Context published on `graphql:validate`. */ + "graphql:validate": GraphQLValidateContext; + /** Context published on `graphql:execute`. */ + "graphql:execute": GraphQLExecuteContext; + /** Context published on `graphql:execute:variableCoercion`. */ + "graphql:execute:variableCoercion": GraphQLExecuteVariableCoercionContext; + /** Context published on `graphql:execute:rootSelectionSet`. */ + "graphql:execute:rootSelectionSet": GraphQLExecuteRootSelectionSetContext; + /** Context published on `graphql:subscribe`. */ + "graphql:subscribe": GraphQLSubscribeContext; + /** Context published on `graphql:resolve`. */ + "graphql:resolve": GraphQLResolveContext; +} +/** + * The collection of tracing channels GraphQL.js emits on. Application + * performance monitoring (APM) tools subscribe to these by name on their own + * `node:diagnostics_channel` import; both paths land on the same channel + * instance because `tracingChannel(name)` is cached by name. + */ +export interface GraphQLChannels { + /** Tracing channel for `graphql:execute`. */ + execute: MinimalTracingChannel<GraphQLExecuteContext>; + /** Tracing channel for `graphql:execute:variableCoercion`. */ + executeVariableCoercion: MinimalTracingChannel<GraphQLExecuteVariableCoercionContext>; + /** Tracing channel for `graphql:execute:rootSelectionSet`. */ + executeRootSelectionSet: MinimalTracingChannel<GraphQLExecuteRootSelectionSetContext>; + /** Tracing channel for `graphql:parse`. */ + parse: MinimalTracingChannel<GraphQLParseContext>; + /** Tracing channel for `graphql:validate`. */ + validate: MinimalTracingChannel<GraphQLValidateContext>; + /** Tracing channel for `graphql:resolve`. */ + resolve: MinimalTracingChannel<GraphQLResolveContext>; + /** Tracing channel for `graphql:subscribe`. */ + subscribe: MinimalTracingChannel<GraphQLSubscribeContext>; +} +interface LexerInterface { + source: Source; + lastToken: Token; + token: Token; + line: number; + lineStart: number; + advance: () => Token; + lookahead: () => Token; +} +/** + * Given a Source object, creates a Lexer for that source. + * A Lexer is a stateful stream generator in that every time + * it is advanced, it returns the next token in the Source. Assuming the + * source lexes, the final Token emitted by the lexer will be of kind + * EOF, after which the lexer will repeatedly return the same EOF token + * whenever called. + */ +export declare class Lexer implements LexerInterface { + /** Source document used to derive error locations. */ + source: Source; + /** Most recent non-ignored token returned by the lexer. */ + lastToken: Token; + /** Current non-ignored token at the lexer cursor. */ + token: Token; + /** The (1-indexed) line containing the current token. */ + line: number; + /** Character offset where the current line starts. */ + lineStart: number; + /** + * Creates a Lexer instance. + * @param source - Source document used to derive error locations. + * @example + * ```ts + * import { Lexer, Source, TokenKind } from 'graphql/language'; + * + * const lexer = new Lexer(new Source('{ hello }')); + * + * lexer.token.kind; // => TokenKind.SOF + * lexer.advance().kind; // => TokenKind.BRACE_L + * lexer.advance().value; // => 'hello' + * lexer.advance().kind; // => TokenKind.BRACE_R + * ``` + */ + constructor(source: Source); + /** + * Returns the value used by `Object.prototype.toString`. + * @returns The built-in string tag for this object. + */ + get [Symbol.toStringTag](): string; + /** + * Advances the token stream to the next non-ignored token. + * @returns The next non-ignored token. + * @example + * ```ts + * import { Lexer, Source } from 'graphql/language'; + * + * const lexer = new Lexer(new Source('{ hello }')); + * const token = lexer.advance(); + * + * token.kind; // => '{' + * lexer.token; // => token + * ``` + */ + advance(): Token; + /** + * Looks ahead and returns the next non-ignored token, but does not change + * the state of Lexer. + * @returns The next non-ignored token without advancing the lexer. + * @example + * ```ts + * import { Lexer, Source } from 'graphql/language'; + * + * const lexer = new Lexer(new Source('{ hello }')); + * const token = lexer.lookahead(); + * + * token.kind; // => '{' + * lexer.token.kind; // => '<SOF>' + * ``` + */ + lookahead(): Token; +} +/** Configuration options to control parser behavior */ +export interface ParseOptions { + /** + * By default, the parser creates AST nodes that know the location + * in the source that they correspond to. This configuration flag + * disables that behavior for performance or testing. + */ + noLocation?: boolean | undefined; + /** + * Parser CPU and memory usage is linear to the number of tokens in a document + * however in extreme cases it becomes quadratic due to memory exhaustion. + * Parsing happens before validation so even invalid queries can burn lots of + * CPU time and memory. + * To prevent this you can set a maximum number of tokens allowed within a document. + */ + maxTokens?: number | undefined; + /** + * EXPERIMENTAL: + * + * If enabled, the parser will understand and parse fragment variable definitions + * and arguments on fragment spreads. Fragment variable definitions will be represented + * in the `variableDefinitions` field of the FragmentDefinitionNode. + * Fragment spread arguments will be represented in the `arguments` field of FragmentSpreadNode. + * @example + * ```graphql prettier-ignore + * { + * t { ...A(var: true) } + * } + * fragment A($var: Boolean = false) on T { + * ...B(x: $var) + * } + * ``` + */ + experimentalFragmentArguments?: boolean | undefined; + /** + * Internal parser hook for GraphQL.js entry points that need to parse a + * restricted grammar with an alternate lexer. + * @internal + */ + lexer?: LexerInterface | undefined; +} +/** + * Given a GraphQL source, parses it into a Document. + * Throws GraphQLError if a syntax error is encountered. + * @param source - A GraphQL source string or source object. + * @param options - Optional parser configuration. + * @returns The parsed GraphQL document AST. + * @example + * ```ts + * // Parse a GraphQL document with the default parser options. + * import { parse } from 'graphql/language'; + * + * const document = parse('{ hero { name } }'); + * + * document.kind; // => 'Document' + * ``` + * @example + * ```ts + * // This variant enables parser options and provides an explicit lexer. + * import { Lexer, Source, parse } from 'graphql/language'; + * + * const document = parse( + * ` + * { + * t { ...A(var: true) } + * } + * fragment A($var: Boolean = false) on T { + * name + * } + * `, + * { + * experimentalFragmentArguments: true, + * maxTokens: 80, + * noLocation: true, + * }, + * ); + * const directiveDocument = parse('directive @foo @bar on FIELD'); + * const source = new Source('{ hero }'); + * const lexerDocument = parse(source, { lexer: new Lexer(source) }); + * + * document.definitions[0].kind; // => 'OperationDefinition' + * document.definitions[1].kind; // => 'FragmentDefinition' + * document.loc; // => undefined + * directiveDocument.definitions[0].kind; // => 'DirectiveDefinition' + * lexerDocument.definitions[0].kind; // => 'OperationDefinition' + * ``` + */ +export declare function parse(source: string | Source, options?: ParseOptions): DocumentNode; +/** + * Given a string containing a GraphQL value (ex. `[42]`), parse the AST for + * that value. + * Throws GraphQLError if a syntax error is encountered. + * + * This is useful within tools that operate upon GraphQL Values directly and + * in isolation of complete GraphQL documents. + * + * Consider providing the results to the utility function: valueFromAST(). + * @param source - A GraphQL source string or source object containing a value. + * @param options - Optional parser configuration. + * @returns The parsed GraphQL value AST. + * @example + * ```ts + * import { parseValue } from 'graphql/language'; + * + * const value = parseValue('[42]'); + * + * value.kind; // => 'ListValue' + * ``` + */ +export declare function parseValue(source: string | Source, options?: ParseOptions): ValueNode; +/** + * Similar to parseValue(), but raises a parse error if it encounters a + * variable. The return type will be a constant value. + * @param source - A GraphQL source string or source object containing a constant value. + * @param options - Optional parser configuration. + * @returns The parsed GraphQL constant value AST. + * @example + * ```ts + * import { parseConstValue } from 'graphql/language'; + * + * const value = parseConstValue('{ enabled: true }'); + * + * value.kind; // => 'ObjectValue' + * parseConstValue('$variable'); // throws an error + * ``` + */ +export declare function parseConstValue(source: string | Source, options?: ParseOptions): ConstValueNode; +/** + * Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for + * that type. + * Throws GraphQLError if a syntax error is encountered. + * + * This is useful within tools that operate upon GraphQL Types directly and + * in isolation of complete GraphQL documents. + * + * Consider providing the results to the utility function: typeFromAST(). + * @param source - A GraphQL source string or source object containing a type reference. + * @param options - Optional parser configuration. + * @returns The parsed GraphQL type AST. + * @example + * ```ts + * import { parseType } from 'graphql/language'; + * + * const type = parseType('[String!]'); + * + * type.kind; // => 'ListType' + * ``` + */ +export declare function parseType(source: string | Source, options?: ParseOptions): TypeNode; +/** + * Given a string containing a GraphQL Schema Coordinate (ex. `Type.field`), + * parse the AST for that schema coordinate. + * Throws GraphQLError if a syntax error is encountered. + * + * Consider providing the results to the utility function: + * resolveASTSchemaCoordinate(). Or calling resolveSchemaCoordinate() directly + * with an unparsed source. + * @param source - A GraphQL source string or source object containing a schema coordinate. + * @returns The parsed GraphQL schema coordinate AST. + * @example + * ```ts + * import { parseSchemaCoordinate } from 'graphql/language'; + * + * const coordinate = parseSchemaCoordinate('Query.hero'); + * + * coordinate.kind; // => 'MemberCoordinate' + * ``` + */ +export declare function parseSchemaCoordinate(source: string | Source): SchemaCoordinateNode; +/** The set of allowed kind values for AST nodes. */ +export type Kind = (typeof Kind)[keyof typeof Kind]; +/** A visitor defines the callbacks called during AST traversal. */ +export type ASTVisitor = EnterLeaveVisitor<ASTNode> | KindVisitor; +type KindVisitor = { + readonly [NodeT in ASTNode as NodeT["kind"]]?: ASTVisitFn<NodeT> | EnterLeaveVisitor<NodeT>; +}; +interface EnterLeaveVisitor<TVisitedNode extends ASTNode> { + readonly enter?: ASTVisitFn<TVisitedNode> | undefined; + readonly leave?: ASTVisitFn<TVisitedNode> | undefined; +} +/** + * A visitor is composed of visit functions called for each node during traversal. + * @typeParam TVisitedNode - AST node type handled by this visitor function. + */ +export type ASTVisitFn<TVisitedNode extends ASTNode> = ( +/** Current node being visited. */ +node: TVisitedNode, +/** Index or key for this node within the parent node or array. */ +key: string | number | undefined, +/** Parent immediately above this node, which may be an array. */ +parent: ASTNode | ReadonlyArray<ASTNode> | undefined, +/** Key path from the root node to this node. */ +path: ReadonlyArray<string | number>, +/** + * All nodes and arrays visited before reaching this node's parent. + * These correspond to array indices in `path`. + * Note: ancestors includes arrays that contain the visited node's parent. + */ +ancestors: ReadonlyArray<ASTNode | ReadonlyArray<ASTNode>>) => any; +type ASTReducer<R> = { + readonly [NodeT in ASTNode as NodeT["kind"]]?: { + readonly enter?: ASTVisitFn<NodeT>; + readonly leave: ASTReducerFn<NodeT, R>; + }; +}; +type ASTReducerFn<TReducedNode extends ASTNode, R> = ( +/** + * Current node being visited. + * @internal + */ +node: { + [K in keyof TReducedNode]: ReducedField<TReducedNode[K], R>; +}, +/** + * Index or key for this node within the parent node or array. + * @internal + */ +key: string | number | undefined, +/** + * Parent immediately above this node, which may be an array. + * @internal + */ +parent: ASTNode | ReadonlyArray<ASTNode> | undefined, +/** + * Key path from the root node to this node. + * @internal + */ +path: ReadonlyArray<string | number>, +/** + * All nodes and arrays visited before reaching this node's parent. + * These correspond to array indices in `path`. + * Note: ancestors includes arrays that contain the visited node's parent. + * @internal + */ +ancestors: ReadonlyArray<ASTNode | ReadonlyArray<ASTNode>>) => R; +type ReducedField<T, R> = T extends ASTNode ? R : T extends ReadonlyArray<ASTNode> ? ReadonlyArray<R> : T; +/** A visitor key map describes the traversable child properties for each node kind. */ +export type ASTVisitorKeyMap = { + [NodeT in ASTNode as NodeT["kind"]]?: ReadonlyArray<keyof NodeT>; +}; +/** A value that can be returned from a visitor function to stop traversal. */ +export declare const BREAK: unknown; +/** + * visit() will walk through an AST using a depth-first traversal, calling + * the visitor's enter function at each node in the traversal, and calling the + * leave function after visiting that node and all of its child nodes. + * + * By returning different values from the enter and leave functions, the + * behavior of the visitor can be altered, including skipping over a sub-tree of + * the AST (by returning false), editing the AST by returning a value or null + * to remove the value, or to stop the whole traversal by returning BREAK. + * + * When using visit() to edit an AST, the original AST will not be modified, and + * a new version of the AST with the changes applied will be returned from the + * visit function. + * @param root - The AST node at which to start traversal. + * @param visitor - The visitor or reducer functions to call while traversing. + * @param visitorKeys - Optional map of child keys to visit for each AST node kind. + * @returns The original AST, an edited AST, or a reduced value depending on the visitor. + * @typeParam N - The root AST node type returned when visiting without reducing. + * @example + * ```ts + * // Return values control traversal: undefined makes no change, false skips + * // a subtree, BREAK stops traversal, null removes a node, and any other + * // value replaces the current node. + * import { Kind, parse, print, visit } from 'graphql/language'; + * + * const document = parse('{ hero { name } }'); + * const editedAST = visit(document, { + * Field: (node) => { + * if (node.name.value === 'hero') { + * return { + * ...node, + * name: { kind: Kind.NAME, value: 'human' }, + * }; + * } + * }, + * }); + * + * print(editedAST); // => '{\n human {\n name\n }\n}' + * ``` + * @example + * ```ts + * // A named visitor function runs when entering nodes of that kind. + * import { parse, visit } from 'graphql/language'; + * + * const document = parse('{ hero { name } }'); + * const fieldNames = []; + * + * visit(document, { + * Field: (node) => { + * fieldNames.push(node.name.value); + * }, + * }); + * + * fieldNames; // => ['hero', 'name'] + * ``` + * @example + * ```ts + * // A named visitor object can provide separate enter and leave handlers for + * // nodes of that kind. + * import { parse, visit } from 'graphql/language'; + * + * const document = parse('{ hero { name } }'); + * const events = []; + * + * visit(document, { + * Field: { + * enter: (node) => { + * events.push(`enter:${node.name.value}`); + * }, + * leave: (node) => { + * events.push(`leave:${node.name.value}`); + * }, + * }, + * }); + * + * events; // => ['enter:hero', 'enter:name', 'leave:name', 'leave:hero'] + * ``` + * @example + * ```ts + * // Generic enter and leave handlers run for every node. + * import { parse, visit } from 'graphql/language'; + * + * const document = parse('{ hero { name } }'); + * let enterCount = 0; + * let leaveCount = 0; + * + * visit(document, { + * enter: (node) => { + * enterCount += 1; + * }, + * leave: (node) => { + * leaveCount += 1; + * }, + * }); + * + * enterCount; // => leaveCount + * enterCount > 0; // => true + * ``` + */ +export declare function visit<N extends ASTNode>(root: N, visitor: ASTVisitor, visitorKeys?: ASTVisitorKeyMap): N; +/** + * Traverses an AST with reducer callbacks and returns the reduced value. + * @param root - The AST node where traversal starts. + * @param visitor - Reducer callbacks to invoke during traversal. + * @param visitorKeys - Optional mapping of child keys for each AST node kind. + * @returns The value produced by the reducer visitor. + * @typeParam R - The value produced by reducer visitor callbacks. + * @example + * ```ts + * // A reducer visitor returns values from leave handlers to build a reduced + * // result instead of returning an edited AST. + * import { parse, visit } from 'graphql/language'; + * + * const document = parse('{ hero { name } }'); + * const printed = visit(document, { + * Name: { + * leave: (node) => { + * return node.value; + * }, + * }, + * Field: { + * leave: (node) => { + * return node.selectionSet == null + * ? node.name + * : `${node.name} { ${node.selectionSet} }`; + * }, + * }, + * SelectionSet: { + * leave: (node) => { + * return node.selections.join(' '); + * }, + * }, + * OperationDefinition: { + * leave: (node) => { + * return node.selectionSet; + * }, + * }, + * Document: { + * leave: (node) => { + * return node.definitions.join('\n'); + * }, + * }, + * }); + * + * printed; // => 'hero { name }' + * ``` + */ +export declare function visit<R>(root: ASTNode, visitor: ASTReducer<R>, visitorKeys?: ASTVisitorKeyMap): R; +/** + * Creates a new visitor instance which delegates to many visitors to run in + * parallel. Each visitor will be visited for each node before moving on. + * + * If a prior visitor edits a node, no following visitors will see that node. + * @param visitors - The visitors to merge into one parallel visitor. + * @returns A visitor that delegates traversal to each provided visitor. + * @example + * ```ts + * import { parse, visit, visitInParallel } from 'graphql/language'; + * + * const document = parse('{ hero { name } }'); + * const events = []; + * + * visit( + * document, + * visitInParallel([ + * { + * Field: (node) => { + * events.push(`field:${node.name.value}`); + * }, + * }, + * { + * Name: (node) => { + * events.push(`name:${node.value}`); + * }, + * }, + * ]), + * ); + * + * events; // => ['field:hero', 'name:hero', 'field:name', 'name:name'] + * ``` + */ +export declare function visitInParallel(visitors: ReadonlyArray<ASTVisitor>): ASTVisitor; +/** + * Given a visitor instance and a node kind, return EnterLeaveVisitor for that kind. + * @param visitor - The visitor object to inspect. + * @param kind - The AST node kind to resolve handlers for. + * @returns The enter and leave handlers that apply for the given node kind. + * @example + * ```ts + * import { Kind, getEnterLeaveForKind } from 'graphql/language'; + * + * const handlers = getEnterLeaveForKind({ Field: () => {} }, Kind.FIELD); + * + * typeof handlers.enter; // => 'function' + * handlers.leave; // => undefined + * ``` + */ +export declare function getEnterLeaveForKind(visitor: ASTVisitor, kind: Kind): EnterLeaveVisitor<ASTNode>; +interface FragmentSignature { + readonly definition: FragmentDefinitionNode; + readonly variableDefinitions: Map<string, VariableDefinitionNode>; +} +/** + * TypeInfo is a utility class which, given a GraphQL schema, can keep track + * of the current field and type definitions at any point in a GraphQL document + * AST during a recursive descent by calling `enter(node)` and `leave(node)`. + */ +export declare class TypeInfo { + private _schema; + private _typeStack; + private _parentTypeStack; + private _inputTypeStack; + private _fieldDefStack; + private _defaultValueStack; + private _directive; + private _argument; + private _enumValue; + private _fragmentSignaturesByName; + private _fragmentSignature; + private _fragmentArgument; + /** + * Creates a TypeInfo instance. + * @param schema - Schema used for type lookups. + * @param initialType - Optional type to use at the start of traversal. + * @param fragmentSignatures - Fragment signatures available during traversal. + * @example + * ```ts + * // Track field types during a visitWithTypeInfo traversal. + * import { parse, visit } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { TypeInfo, visitWithTypeInfo } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * const typeInfo = new TypeInfo(schema); + * const seenTypes = []; + * + * visit( + * parse('{ greeting }'), + * visitWithTypeInfo(typeInfo, { + * Field: () => { + * seenTypes.push(String(typeInfo.getType())); + * }, + * }), + * ); + * + * seenTypes; // => ['String'] + * ``` + * @example + * ```ts + * // This variant starts from an initial type and supplies fragment signatures. + * import { Kind, parse } from 'graphql/language'; + * import { buildSchema, TypeInfo } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * greeting(name: String): String + * } + * `); + * const fragmentDocument = parse( + * 'fragment GreetingFields($name: String) on Query { greeting(name: $name) }', + * { experimentalFragmentArguments: true }, + * ); + * const fragmentDefinition = fragmentDocument.definitions[0]; + * const variableDefinition = fragmentDefinition.variableDefinitions[0]; + * const typeInfo = new TypeInfo(schema, schema.getQueryType(), (name) => + * name === 'GreetingFields' + * ? { + * definition: fragmentDefinition, + * variableDefinitions: new Map([['name', variableDefinition]]), + * } + * : undefined, + * ); + * + * typeInfo.enter({ + * kind: Kind.SELECTION_SET, + * selections: [], + * }); + * typeInfo.enter({ + * kind: Kind.FRAGMENT_SPREAD, + * name: { kind: Kind.NAME, value: 'GreetingFields' }, + * arguments: [], + * directives: [], + * }); + * + * String(typeInfo.getParentType()); // => 'Query' + * typeInfo.getFragmentSignature()?.definition.name.value; // => 'GreetingFields' + * ``` + */ + constructor(schema: GraphQLSchema, + /** + * Initial type may be provided in rare cases to facilitate traversals + * beginning somewhere other than documents. + */ + initialType?: Maybe<GraphQLType>, fragmentSignatures?: Maybe<(fragmentName: string) => Maybe<FragmentSignature>>); + /** + * Returns the value used by `Object.prototype.toString`. + * @returns The built-in string tag for this object. + */ + get [Symbol.toStringTag](): string; + /** + * Returns the current output type at this point in traversal. + * @returns The current output type, if known. + * @example + * ```ts + * import { parse, visit } from 'graphql/language'; + * import { buildSchema, TypeInfo, visitWithTypeInfo } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * viewer: User + * } + * + * type User { + * name: String + * } + * `); + * const typeInfo = new TypeInfo(schema); + * const fieldTypes = {}; + * + * visit( + * parse('{ viewer { name } }'), + * visitWithTypeInfo(typeInfo, { + * Field: (node) => { + * fieldTypes[node.name.value] = String(typeInfo.getType()); + * }, + * }), + * ); + * + * fieldTypes; // => { viewer: 'User', name: 'String' } + * ``` + */ + getType(): Maybe<GraphQLOutputType>; + /** + * Returns the current parent composite type. + * @returns The current parent composite type, if known. + * @example + * ```ts + * import { parse, visit } from 'graphql/language'; + * import { buildSchema, TypeInfo, visitWithTypeInfo } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * viewer: User + * } + * + * type User { + * name: String + * } + * `); + * const typeInfo = new TypeInfo(schema); + * const parentTypes = {}; + * + * visit( + * parse('{ viewer { name } }'), + * visitWithTypeInfo(typeInfo, { + * Field: (node) => { + * parentTypes[node.name.value] = String(typeInfo.getParentType()); + * }, + * }), + * ); + * + * parentTypes; // => { viewer: 'Query', name: 'User' } + * ``` + */ + getParentType(): Maybe<GraphQLCompositeType>; + /** + * Returns the current input type at this point in traversal. + * @returns The current input type, if known. + * @example + * ```ts + * import { parse, visit } from 'graphql/language'; + * import { buildSchema, TypeInfo, visitWithTypeInfo } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * reviews(stars: Int!, sort: Sort = NEWEST): [String] + * } + * + * enum Sort { + * NEWEST + * OLDEST + * } + * `); + * const typeInfo = new TypeInfo(schema); + * const inputTypes = {}; + * + * visit( + * parse('{ reviews(stars: 5, sort: OLDEST) }'), + * visitWithTypeInfo(typeInfo, { + * Argument: (node) => { + * inputTypes[node.name.value] = String(typeInfo.getInputType()); + * }, + * }), + * ); + * + * inputTypes; // => { stars: 'Int!', sort: 'Sort' } + * ``` + */ + getInputType(): Maybe<GraphQLInputType>; + /** + * Returns the parent input type for the current input position. + * @returns The parent input type, if known. + * @example + * ```ts + * import { parse, visit } from 'graphql/language'; + * import { buildSchema, TypeInfo, visitWithTypeInfo } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * input ReviewFilter { + * stars: Int! + * } + * + * type Query { + * reviews(filter: ReviewFilter): [String] + * } + * `); + * const typeInfo = new TypeInfo(schema); + * const parentInputTypes = {}; + * + * visit( + * parse('{ reviews(filter: { stars: 5 }) }'), + * visitWithTypeInfo(typeInfo, { + * ObjectField: (node) => { + * parentInputTypes[node.name.value] = String(typeInfo.getParentInputType()); + * }, + * }), + * ); + * + * parentInputTypes; // => { stars: 'ReviewFilter' } + * ``` + */ + getParentInputType(): Maybe<GraphQLInputType>; + /** + * Returns the current field definition. + * @returns The current field definition, if known. + * @example + * ```ts + * import { parse, visit } from 'graphql/language'; + * import { buildSchema, TypeInfo, visitWithTypeInfo } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * const typeInfo = new TypeInfo(schema); + * let fieldName; + * + * visit( + * parse('{ greeting }'), + * visitWithTypeInfo(typeInfo, { + * Field: () => { + * fieldName = typeInfo.getFieldDef()?.name; + * }, + * }), + * ); + * + * fieldName; // => 'greeting' + * ``` + */ + getFieldDef(): Maybe<GraphQLField<unknown, unknown>>; + /** + * Returns the default input representation for the current input position. + * @returns The current default input, if one is available. + * @example + * ```ts + * import { parse, visit } from 'graphql/language'; + * import { buildSchema, TypeInfo, visitWithTypeInfo } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * reviews(limit: Int = 10): [String] + * } + * `); + * const typeInfo = new TypeInfo(schema); + * let defaultLimit; + * + * visit( + * parse('{ reviews(limit: 5) }'), + * visitWithTypeInfo(typeInfo, { + * Argument: () => { + * defaultLimit = typeInfo.getDefaultValue(); + * }, + * }), + * ); + * + * defaultLimit; // => { literal: { kind: 'IntValue', value: '10' } } + * ``` + */ + getDefaultValue(): unknown; + /** + * Returns the current directive definition. + * @returns The current directive definition, if known. + * @example + * ```ts + * import { parse, visit } from 'graphql/language'; + * import { buildSchema, TypeInfo, visitWithTypeInfo } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * const typeInfo = new TypeInfo(schema); + * let directiveName; + * + * visit( + * parse('{ greeting @include(if: true) }'), + * visitWithTypeInfo(typeInfo, { + * Directive: () => { + * directiveName = typeInfo.getDirective()?.name; + * }, + * }), + * ); + * + * directiveName; // => 'include' + * ``` + */ + getDirective(): Maybe<GraphQLDirective>; + /** + * Returns the current argument definition. + * @returns The current argument definition, if known. + * @example + * ```ts + * import { parse, visit } from 'graphql/language'; + * import { buildSchema, TypeInfo, visitWithTypeInfo } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * reviews(limit: Int = 10): [String] + * } + * `); + * const typeInfo = new TypeInfo(schema); + * let argumentName; + * + * visit( + * parse('{ reviews(limit: 5) }'), + * visitWithTypeInfo(typeInfo, { + * Argument: () => { + * argumentName = typeInfo.getArgument()?.name; + * }, + * }), + * ); + * + * argumentName; // => 'limit' + * ``` + */ + getArgument(): Maybe<GraphQLArgument>; + /** + * Returns the current fragment signature. + * @returns The fragment signature for the current fragment definition. + * @example + * ```ts + * import { parse, visit } from 'graphql/language'; + * import { buildSchema, TypeInfo, visitWithTypeInfo } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * const document = parse( + * ` + * { + * ...GreetingFields + * } + * + * fragment GreetingFields on Query { + * greeting + * } + * `, + * { experimentalFragmentArguments: true }, + * ); + * const typeInfo = new TypeInfo(schema); + * let fragmentName; + * + * visit( + * document, + * visitWithTypeInfo(typeInfo, { + * FragmentSpread: () => { + * fragmentName = typeInfo.getFragmentSignature()?.definition.name.value; + * }, + * }), + * ); + * + * fragmentName; // => 'GreetingFields' + * ``` + */ + getFragmentSignature(): Maybe<FragmentSignature>; + /** + * Returns the function used to look up fragment signatures by name. + * @returns A function that maps fragment names to fragment signatures. + * @example + * ```ts + * import { parse, visit } from 'graphql/language'; + * import { buildSchema, TypeInfo, visitWithTypeInfo } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * const document = parse( + * ` + * { + * ...GreetingFields + * } + * + * fragment GreetingFields on Query { + * greeting + * } + * `, + * { experimentalFragmentArguments: true }, + * ); + * const typeInfo = new TypeInfo(schema); + * let fragmentName; + * + * visit( + * document, + * visitWithTypeInfo(typeInfo, { + * Document: () => { + * const getFragmentSignature = typeInfo.getFragmentSignatureByName(); + * fragmentName = + * getFragmentSignature('GreetingFields')?.definition.name.value; + * }, + * }), + * ); + * + * fragmentName; // => 'GreetingFields' + * ``` + */ + getFragmentSignatureByName(): (fragmentName: string) => Maybe<FragmentSignature>; + /** + * Returns the current fragment argument definition. + * @returns The variable definition for the current fragment argument. + * @example + * ```ts + * import { parse, visit } from 'graphql/language'; + * import { buildSchema, TypeInfo, visitWithTypeInfo } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * greeting(name: String): String + * } + * `); + * const document = parse( + * ` + * { + * ...GreetingFields(name: "Ada") + * } + * + * fragment GreetingFields($name: String) on Query { + * greeting(name: $name) + * } + * `, + * { experimentalFragmentArguments: true }, + * ); + * const typeInfo = new TypeInfo(schema); + * let argumentName; + * + * visit( + * document, + * visitWithTypeInfo(typeInfo, { + * FragmentArgument: () => { + * argumentName = typeInfo.getFragmentArgument()?.variable.name.value; + * }, + * }), + * ); + * + * argumentName; // => 'name' + * ``` + */ + getFragmentArgument(): Maybe<VariableDefinitionNode>; + /** + * Returns the current enum value definition. + * @returns The current enum value definition, if known. + * @example + * ```ts + * import { parse, visit } from 'graphql/language'; + * import { buildSchema, TypeInfo, visitWithTypeInfo } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * enum Sort { + * NEWEST + * OLDEST + * } + * + * type Query { + * reviews(sort: Sort = NEWEST): [String] + * } + * `); + * const typeInfo = new TypeInfo(schema); + * let enumValueName; + * + * visit( + * parse('{ reviews(sort: OLDEST) }'), + * visitWithTypeInfo(typeInfo, { + * EnumValue: () => { + * enumValueName = typeInfo.getEnumValue()?.name; + * }, + * }), + * ); + * + * enumValueName; // => 'OLDEST' + * ``` + */ + getEnumValue(): Maybe<GraphQLEnumValue>; + /** + * Updates this TypeInfo instance for an entered AST node. + * @param node - AST node being entered. + * @returns Nothing. + * @example + * ```ts + * import { Kind, parse } from 'graphql/language'; + * import { buildSchema, TypeInfo } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * const document = parse('{ greeting }'); + * const operation = document.definitions[0]; + * const selectionSet = operation.selectionSet; + * const field = selectionSet.selections[0]; + * const typeInfo = new TypeInfo(schema); + * + * typeInfo.enter(operation); + * typeInfo.enter(selectionSet); + * typeInfo.enter(field); + * + * field.kind; // => Kind.FIELD + * typeInfo.getParentType()?.name; // => 'Query' + * String(typeInfo.getType()); // => 'String' + * ``` + */ + enter(node: ASTNode): void; + /** + * Updates this TypeInfo instance for a left AST node. + * @param node - AST node being entered. + * @returns Nothing. + * @example + * ```ts + * import { parse } from 'graphql/language'; + * import { buildSchema, TypeInfo } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * const document = parse('{ greeting }'); + * const operation = document.definitions[0]; + * const selectionSet = operation.selectionSet; + * const field = selectionSet.selections[0]; + * const typeInfo = new TypeInfo(schema); + * + * typeInfo.enter(operation); + * typeInfo.enter(selectionSet); + * typeInfo.enter(field); + * String(typeInfo.getType()); // => 'String' + * + * typeInfo.leave(field); + * typeInfo.getType(); // => undefined + * ``` + */ + leave(node: ASTNode): void; +} +/** + * Creates a new visitor instance which maintains a provided TypeInfo instance + * along with visiting visitor. + * @param typeInfo - TypeInfo instance to update during traversal. + * @param visitor - Visitor callbacks to wrap with TypeInfo updates. + * @returns A visitor that keeps TypeInfo in sync while delegating callbacks. + * @example + * ```ts + * import { parse, visit } from 'graphql/language'; + * import { buildSchema, TypeInfo, visitWithTypeInfo } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * const typeInfo = new TypeInfo(schema); + * const fields = []; + * + * visit( + * parse('{ greeting }'), + * visitWithTypeInfo(typeInfo, { + * Field: (node) => { + * fields.push({ + * name: node.name.value, + * parentType: String(typeInfo.getParentType()), + * type: String(typeInfo.getType()), + * }); + * }, + * }), + * ); + * + * fields; // => [{ name: 'greeting', parentType: 'Query', type: 'String' }] + * ``` + */ +export declare function visitWithTypeInfo(typeInfo: TypeInfo, visitor: ASTVisitor): ASTVisitor; +type NodeWithSelectionSet = OperationDefinitionNode | FragmentDefinitionNode; +interface VariableUsage { + readonly node: VariableNode; + readonly type: Maybe<GraphQLInputType>; + readonly parentType: Maybe<GraphQLInputType>; + readonly defaultValue: unknown; + readonly fragmentVariableDefinition: Maybe<VariableDefinitionNode>; +} +declare class ASTValidationContext { + private _ast; + private _onError; + private _fragments; + private _fragmentSpreads; + private _recursivelyReferencedFragments; + constructor(ast: DocumentNode, onError: (error: GraphQLError) => void); + get [Symbol.toStringTag](): string; + reportError(error: GraphQLError): void; + getDocument(): DocumentNode; + getFragment(name: string): Maybe<FragmentDefinitionNode>; + getFragmentSpreads(node: SelectionSetNode): ReadonlyArray<FragmentSpreadNode>; + getRecursivelyReferencedFragments(operation: OperationDefinitionNode): ReadonlyArray<FragmentDefinitionNode>; +} +declare class SDLValidationContext extends ASTValidationContext { + private _schema; + constructor(ast: DocumentNode, schema: Maybe<GraphQLSchema>, onError: (error: GraphQLError) => void); + get hideSuggestions(): boolean; + get [Symbol.toStringTag](): string; + getSchema(): Maybe<GraphQLSchema>; +} +/** Validation context passed to query validation rules. */ +export declare class ValidationContext extends ASTValidationContext { + private _schema; + private _typeInfo; + private _variableUsages; + private _recursiveVariableUsages; + private _hideSuggestions; + /** + * Creates a ValidationContext instance. + * @param schema - Schema used to validate the document. + * @param ast - Document AST being validated. + * @param typeInfo - TypeInfo instance used to track traversal state. + * @param onError - Callback invoked for each validation error. + * @param hideSuggestions - Whether suggestion text should be omitted from errors. + * @example + * ```ts + * import { parse } from 'graphql/language'; + * import { GraphQLError } from 'graphql/error'; + * import { buildSchema, TypeInfo } from 'graphql/utilities'; + * import { ValidationContext } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * const document = parse('{ greeting }'); + * const errors = []; + * const context = new ValidationContext( + * schema, + * document, + * new TypeInfo(schema), + * (error) => errors.push(error), + * ); + * + * context.reportError(new GraphQLError('Example validation error.')); + * + * context.getSchema(); // => schema + * errors[0].message; // => 'Example validation error.' + * ``` + */ + constructor(schema: GraphQLSchema, ast: DocumentNode, typeInfo: TypeInfo, onError: (error: GraphQLError) => void, hideSuggestions?: Maybe<boolean>); + /** + * Returns the value used by `Object.prototype.toString`. + * @returns The built-in string tag for this object. + */ + get [Symbol.toStringTag](): string; + /** + * Returns whether validation error suggestions are hidden. + * @returns True when suggestion text should be omitted from errors. + */ + get hideSuggestions(): boolean; + /** + * Returns the schema being used by this validation context. + * @returns The schema being validated against. + * @example + * ```ts + * import { parse } from 'graphql/language'; + * import { buildSchema, TypeInfo } from 'graphql/utilities'; + * import { ValidationContext } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * const context = new ValidationContext( + * schema, + * parse('{ greeting }'), + * new TypeInfo(schema), + * () => {}, + * ); + * + * context.getSchema().getQueryType()?.name; // => 'Query' + * ``` + */ + getSchema(): GraphQLSchema; + /** + * Returns variable usages found directly within this node. + * @param node - The AST node to inspect or visit. + * @returns Variable usages found directly within this node. + * @example + * ```ts + * import { parse } from 'graphql/language'; + * import { buildSchema, TypeInfo } from 'graphql/utilities'; + * import { ValidationContext } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * greeting(name: String): String + * } + * `); + * const document = parse('query ($name: String) { greeting(name: $name) }'); + * const operation = document.definitions[0]; + * const context = new ValidationContext( + * schema, + * document, + * new TypeInfo(schema), + * () => {}, + * ); + * + * const usages = context.getVariableUsages(operation); + * + * usages[0].node.name.value; // => 'name' + * String(usages[0].type); // => 'String' + * ``` + */ + getVariableUsages(node: NodeWithSelectionSet): ReadonlyArray<VariableUsage>; + /** + * Returns variable usages for an operation, including variables used by referenced fragments. + * @param operation - Operation definition to inspect. + * @returns Variable usages reachable from the operation. + * @example + * ```ts + * import { parse } from 'graphql/language'; + * import { buildSchema, TypeInfo } from 'graphql/utilities'; + * import { ValidationContext } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * viewer: User + * } + * + * type User { + * name(prefix: String): String + * } + * `); + * const document = parse(` + * query ($prefix: String) { + * viewer { + * ...UserName + * } + * } + * + * fragment UserName on User { + * name(prefix: $prefix) + * } + * `); + * const operation = document.definitions[0]; + * const context = new ValidationContext( + * schema, + * document, + * new TypeInfo(schema), + * () => {}, + * ); + * + * const usages = context.getRecursiveVariableUsages(operation); + * + * usages.map((usage) => usage.node.name.value); // => ['prefix'] + * ``` + */ + getRecursiveVariableUsages(operation: OperationDefinitionNode): ReadonlyArray<VariableUsage>; + /** + * Returns the current output type at this point in traversal. + * @returns The current output type, if known. + * @example + * ```ts + * import { parse, visit } from 'graphql/language'; + * import { buildSchema, TypeInfo, visitWithTypeInfo } from 'graphql/utilities'; + * import { ValidationContext } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * const document = parse('{ greeting }'); + * const typeInfo = new TypeInfo(schema); + * const context = new ValidationContext(schema, document, typeInfo, () => {}); + * let typeName; + * + * visit( + * document, + * visitWithTypeInfo(typeInfo, { + * Field: () => { + * typeName = String(context.getType()); + * }, + * }), + * ); + * + * typeName; // => 'String' + * ``` + */ + getType(): Maybe<GraphQLOutputType>; + /** + * Returns the current parent composite type. + * @returns The current parent composite type, if known. + * @example + * ```ts + * import { parse, visit } from 'graphql/language'; + * import { buildSchema, TypeInfo, visitWithTypeInfo } from 'graphql/utilities'; + * import { ValidationContext } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * const document = parse('{ greeting }'); + * const typeInfo = new TypeInfo(schema); + * const context = new ValidationContext(schema, document, typeInfo, () => {}); + * let parentTypeName; + * + * visit( + * document, + * visitWithTypeInfo(typeInfo, { + * Field: () => { + * parentTypeName = context.getParentType()?.name; + * }, + * }), + * ); + * + * parentTypeName; // => 'Query' + * ``` + */ + getParentType(): Maybe<GraphQLCompositeType>; + /** + * Returns the current input type at this point in traversal. + * @returns The current input type, if known. + * @example + * ```ts + * import { parse, visit } from 'graphql/language'; + * import { buildSchema, TypeInfo, visitWithTypeInfo } from 'graphql/utilities'; + * import { ValidationContext } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * reviews(limit: Int): [String] + * } + * `); + * const document = parse('{ reviews(limit: 5) }'); + * const typeInfo = new TypeInfo(schema); + * const context = new ValidationContext(schema, document, typeInfo, () => {}); + * let inputTypeName; + * + * visit( + * document, + * visitWithTypeInfo(typeInfo, { + * Argument: () => { + * inputTypeName = String(context.getInputType()); + * }, + * }), + * ); + * + * inputTypeName; // => 'Int' + * ``` + */ + getInputType(): Maybe<GraphQLInputType>; + /** + * Returns the parent input type for the current input position. + * @returns The parent input type, if known. + * @example + * ```ts + * import { parse, visit } from 'graphql/language'; + * import { buildSchema, TypeInfo, visitWithTypeInfo } from 'graphql/utilities'; + * import { ValidationContext } from 'graphql/validation'; + * + * const schema = buildSchema(` + * input ReviewFilter { + * stars: Int + * } + * + * type Query { + * reviews(filter: ReviewFilter): [String] + * } + * `); + * const document = parse('{ reviews(filter: { stars: 5 }) }'); + * const typeInfo = new TypeInfo(schema); + * const context = new ValidationContext(schema, document, typeInfo, () => {}); + * let parentInputTypeName; + * + * visit( + * document, + * visitWithTypeInfo(typeInfo, { + * ObjectField: () => { + * parentInputTypeName = String(context.getParentInputType()); + * }, + * }), + * ); + * + * parentInputTypeName; // => 'ReviewFilter' + * ``` + */ + getParentInputType(): Maybe<GraphQLInputType>; + /** + * Returns the current field definition. + * @returns The current field definition, if known. + * @example + * ```ts + * import { parse, visit } from 'graphql/language'; + * import { buildSchema, TypeInfo, visitWithTypeInfo } from 'graphql/utilities'; + * import { ValidationContext } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * const document = parse('{ greeting }'); + * const typeInfo = new TypeInfo(schema); + * const context = new ValidationContext(schema, document, typeInfo, () => {}); + * let fieldName; + * + * visit( + * document, + * visitWithTypeInfo(typeInfo, { + * Field: () => { + * fieldName = context.getFieldDef()?.name; + * }, + * }), + * ); + * + * fieldName; // => 'greeting' + * ``` + */ + getFieldDef(): Maybe<GraphQLField<unknown, unknown>>; + /** + * Returns the current directive definition. + * @returns The current directive definition, if known. + * @example + * ```ts + * import { parse, visit } from 'graphql/language'; + * import { buildSchema, TypeInfo, visitWithTypeInfo } from 'graphql/utilities'; + * import { ValidationContext } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * const document = parse('{ greeting @include(if: true) }'); + * const typeInfo = new TypeInfo(schema); + * const context = new ValidationContext(schema, document, typeInfo, () => {}); + * let directiveName; + * + * visit( + * document, + * visitWithTypeInfo(typeInfo, { + * Directive: () => { + * directiveName = context.getDirective()?.name; + * }, + * }), + * ); + * + * directiveName; // => 'include' + * ``` + */ + getDirective(): Maybe<GraphQLDirective>; + /** + * Returns the current argument definition. + * @returns The current argument definition, if known. + * @example + * ```ts + * import { parse, visit } from 'graphql/language'; + * import { buildSchema, TypeInfo, visitWithTypeInfo } from 'graphql/utilities'; + * import { ValidationContext } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * reviews(limit: Int): [String] + * } + * `); + * const document = parse('{ reviews(limit: 5) }'); + * const typeInfo = new TypeInfo(schema); + * const context = new ValidationContext(schema, document, typeInfo, () => {}); + * let argumentName; + * + * visit( + * document, + * visitWithTypeInfo(typeInfo, { + * Argument: () => { + * argumentName = context.getArgument()?.name; + * }, + * }), + * ); + * + * argumentName; // => 'limit' + * ``` + */ + getArgument(): Maybe<GraphQLArgument>; + /** + * Returns the fragment signature at the current traversal position. + * @returns The current fragment signature, if one is active. + * @example + * ```ts + * import { parse, visit } from 'graphql/language'; + * import { buildSchema, TypeInfo, visitWithTypeInfo } from 'graphql/utilities'; + * import { ValidationContext } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * const document = parse( + * ` + * { + * ...GreetingFields + * } + * + * fragment GreetingFields on Query { + * greeting + * } + * `, + * { experimentalFragmentArguments: true }, + * ); + * const typeInfo = new TypeInfo(schema); + * const context = new ValidationContext(schema, document, typeInfo, () => {}); + * let fragmentName; + * + * visit( + * document, + * visitWithTypeInfo(typeInfo, { + * FragmentSpread: () => { + * fragmentName = context.getFragmentSignature()?.definition.name.value; + * }, + * }), + * ); + * + * fragmentName; // => 'GreetingFields' + * ``` + */ + getFragmentSignature(): Maybe<FragmentSignature>; + /** + * Returns the function used to look up fragment signatures by name. + * @returns A function that maps fragment names to fragment signatures. + * @example + * ```ts + * import { parse, visit } from 'graphql/language'; + * import { buildSchema, TypeInfo, visitWithTypeInfo } from 'graphql/utilities'; + * import { ValidationContext } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * const document = parse( + * ` + * { + * ...GreetingFields + * } + * + * fragment GreetingFields on Query { + * greeting + * } + * `, + * { experimentalFragmentArguments: true }, + * ); + * const typeInfo = new TypeInfo(schema); + * const context = new ValidationContext(schema, document, typeInfo, () => {}); + * let fragmentName; + * + * visit( + * document, + * visitWithTypeInfo(typeInfo, { + * Document: () => { + * const getFragmentSignature = context.getFragmentSignatureByName(); + * fragmentName = + * getFragmentSignature('GreetingFields')?.definition.name.value; + * }, + * }), + * ); + * + * fragmentName; // => 'GreetingFields' + * ``` + */ + getFragmentSignatureByName(): (fragmentName: string) => Maybe<FragmentSignature>; + /** + * Returns the current enum value definition. + * @returns The current enum value definition, if known. + * @example + * ```ts + * import { parse, visit } from 'graphql/language'; + * import { buildSchema, TypeInfo, visitWithTypeInfo } from 'graphql/utilities'; + * import { ValidationContext } from 'graphql/validation'; + * + * const schema = buildSchema(` + * enum Sort { + * NEWEST + * OLDEST + * } + * + * type Query { + * reviews(sort: Sort): [String] + * } + * `); + * const document = parse('{ reviews(sort: OLDEST) }'); + * const typeInfo = new TypeInfo(schema); + * const context = new ValidationContext(schema, document, typeInfo, () => {}); + * let enumValueName; + * + * visit( + * document, + * visitWithTypeInfo(typeInfo, { + * EnumValue: () => { + * enumValueName = context.getEnumValue()?.name; + * }, + * }), + * ); + * + * enumValueName; // => 'OLDEST' + * ``` + */ + getEnumValue(): Maybe<GraphQLEnumValue>; +} +/** A function that creates an AST visitor for validating a GraphQL document. */ +export type ValidationRule = (context: ValidationContext) => ASTVisitor; +/** + * Options used when validating a GraphQL document. + * @category Validation + */ +export interface ValidationOptions { + /** Maximum number of validation errors before validation stops. */ + maxErrors?: number; + /** Whether suggestion text should be omitted from validation errors. */ + hideSuggestions?: Maybe<boolean>; +} +/** + * Implements the "Validation" section of the spec. + * + * Validation runs synchronously, returning an array of encountered errors, or + * an empty array if no errors were encountered and the document is valid. + * + * A list of specific validation rules may be provided. If not provided, the + * default list of rules defined by the GraphQL specification will be used. + * + * Each validation rule is a function that returns a visitor + * (see the language/visitor API). Visitor methods are expected to return + * GraphQLErrors, or Arrays of GraphQLErrors when invalid. + * + * Validate will stop validation after a `maxErrors` limit has been reached. + * Attackers can send pathologically invalid queries to induce a DoS attack, + * so `maxErrors` defaults to 100 errors. + * @param schema - Schema to validate against. + * @param documentAST - Document AST to validate. + * @param rules - Validation rules to apply. + * @param options - Validation options, including error limits and suggestions. + * @returns Validation errors, or an empty array when the document is valid. + * @example + * ```ts + * // Validate with the default specified rules. + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { validate } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * fullName: String + * } + * `); + * + * validate(schema, parse('{ greeting }')); // => [] + * + * const errors = validate(schema, parse('{ missing }')); + * errors[0].message; // => 'Cannot query field "missing" on type "Query".' + * ``` + * @example + * ```ts + * // This variant uses a custom rule list and validation options. + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { FieldsOnCorrectTypeRule, validate } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * const document = parse('{ missingOne missingTwo }'); + * + * const errors = validate(schema, document, [FieldsOnCorrectTypeRule], { + * maxErrors: 1, + * }); + * + * errors.length; // => 2 + * errors[1].message; // => 'Too many validation errors, error limit reached. Validation aborted.' + * + * const hiddenSuggestionErrors = validate( + * schema, + * parse('{ name }'), + * [FieldsOnCorrectTypeRule], + * { hideSuggestions: true }, + * ); + * + * hiddenSuggestionErrors[0].message; // => 'Cannot query field "name" on type "Query".' + * ``` + */ +export declare function validate(schema: GraphQLSchema, documentAST: DocumentNode, rules?: ReadonlyArray<ValidationRule>, options?: ValidationOptions): ReadonlyArray<GraphQLError>; +/** Function used to execute a validated root selection set for a subscription event. */ +export type RootSelectionSetExecutor = (validatedExecutionArgs: ValidatedSubscriptionArgs) => PromiseOrValue<ExecutionResult>; +/** + * Implements the "Executing requests" section of the GraphQL specification. + * + * Returns either a synchronous ExecutionResult (if all encountered resolvers + * are synchronous), or a Promise of an ExecutionResult that will eventually be + * resolved and never rejected. + * + * If the schema is invalid, an error will be thrown immediately. GraphQL + * request errors, including missing operations and variable coercion errors, + * are returned in an errors-only ExecutionResult. + * + * Field errors are collected into the response instead of rejecting the + * returned promise. Only the field that produced the error and its descendants + * are omitted; sibling fields continue to execute. Errors from fields of + * non-null type may propagate to the nearest nullable parent, which can be the + * entire response data. + * + * This function does not support incremental delivery (`@defer` and `@stream`). + * Use `experimentalExecuteIncrementally` to execute operations with + * incremental delivery enabled. + * @param args - The arguments used to perform the operation. + * @returns A completed execution result, or a promise resolving to one when execution is asynchronous. + * @example + * ```ts + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { execute } from 'graphql/execution'; + * + * const schema = buildSchema(` + * type Query { + * greeting(name: String!): String + * } + * `); + * + * const result = await execute({ + * schema, + * document: parse('query ($name: String!) { greeting(name: $name) }'), + * rootValue: { + * greeting: ({ name }) => `Hello, ${name}!`, + * }, + * variableValues: { name: 'Ada' }, + * }); + * + * result; // => { data: { greeting: 'Hello, Ada!' } } + * ``` + */ +export declare function execute(args: ExecutionArgs): PromiseOrValue<ExecutionResult>; +/** + * Implements the "Executing requests" section of the GraphQL specification, + * including `@defer` and `@stream` as proposed in + * https://github.com/graphql/graphql-spec/pull/742 + * + * This function returns either a single ExecutionResult, or an + * ExperimentalIncrementalExecutionResults object containing an `initialResult` + * and a stream of `subsequentResults`. + * + * If the schema is invalid, an error will be thrown immediately. GraphQL + * request errors, including missing operations and variable coercion errors, + * are returned in an errors-only ExecutionResult. + * @param args - Execution arguments for the GraphQL operation. + * @returns A single execution result or incremental execution results. + * @example + * ```ts + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { experimentalExecuteIncrementally } from 'graphql/execution'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * + * const result = await experimentalExecuteIncrementally({ + * schema, + * document: parse('{ greeting }'), + * rootValue: { greeting: 'Hello' }, + * }); + * + * result; // => { data: { greeting: 'Hello' } } + * ``` + * @category Incremental Execution + */ +export declare function experimentalExecuteIncrementally(args: ExecutionArgs): PromiseOrValue<ExecutionResult | ExperimentalIncrementalExecutionResults>; +/** + * Implements the "Executing operations" section of the spec. + * + * Returns either a synchronous ExecutionResult, or a Promise for an + * ExecutionResult, described by the "Response" section of the GraphQL + * specification. + * + * If errors are encountered while executing a GraphQL field, only that field + * and its descendants will be omitted, and sibling fields will still be + * executed. These field errors are collected into the returned result instead + * of being thrown or rejecting the returned promise. + * + * Errors from sub-fields of a NonNull type may propagate to the top level, at + * which point we still collect the error and null the parent field, which in + * this case is the entire response. + * @param validatedExecutionArgs - Validated execution arguments. + * @returns Execution result for the operation root selection set. + * @example + * ```ts + * import assert from 'node:assert'; + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { + * executeRootSelectionSet, + * validateExecutionArgs, + * } from 'graphql/execution'; + * + * const schema = buildSchema('type Query { greeting: String }'); + * const validatedArgs = validateExecutionArgs({ + * schema, + * document: parse('{ greeting }'), + * rootValue: { greeting: 'Hello' }, + * }); + * + * assert('schema' in validatedArgs); + * + * const result = await executeRootSelectionSet(validatedArgs); + * result; // => { data: { greeting: 'Hello' } } + * ``` + */ +export declare function executeRootSelectionSet(validatedExecutionArgs: ValidatedExecutionArgs): PromiseOrValue<ExecutionResult>; +/** + * Executes the operation root selection set with incremental delivery enabled. + * @param validatedExecutionArgs - Validated execution arguments. + * @returns A single execution result or incremental execution results. + * @example + * ```ts + * import assert from 'node:assert'; + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { + * experimentalExecuteRootSelectionSet, + * validateExecutionArgs, + * } from 'graphql/execution'; + * + * const schema = buildSchema('type Query { greeting: String }'); + * const validatedArgs = validateExecutionArgs({ + * schema, + * document: parse('{ greeting }'), + * rootValue: { greeting: 'Hello' }, + * }); + * + * assert('schema' in validatedArgs); + * + * const result = await experimentalExecuteRootSelectionSet(validatedArgs); + * result; // => { data: { greeting: 'Hello' } } + * ``` + * @category Incremental Execution + */ +export declare function experimentalExecuteRootSelectionSet(validatedExecutionArgs: ValidatedExecutionArgs): PromiseOrValue<ExecutionResult | ExperimentalIncrementalExecutionResults>; +/** + * Also implements the "Executing requests" section of the GraphQL specification. + * However, it guarantees to complete synchronously (or throw an error) assuming + * that all field resolvers are also synchronous. + * @param args - The arguments used to perform the operation. + * @returns Completed execution output for a synchronous operation. + * @example + * ```ts + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { executeSync } from 'graphql/execution'; + * + * const schema = buildSchema('type Query { greeting: String }'); + * + * const result = executeSync({ + * schema, + * document: parse('{ greeting }'), + * rootValue: { greeting: 'Hello' }, + * }); + * + * result; // => { data: { greeting: 'Hello' } } + * ``` + */ +export declare function executeSync(args: ExecutionArgs): ExecutionResult; +/** + * Executes a subscription operation once for a single source event. + * + * Field errors are collected into the returned result instead of being thrown + * or rejecting the returned promise. + * @param validatedExecutionArgs - Validated subscription execution arguments. + * @returns Execution result for the subscription event. + * @example + * ```ts + * import assert from 'node:assert'; + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { + * executeSubscriptionEvent, + * validateSubscriptionArgs, + * } from 'graphql/execution'; + * + * const schema = buildSchema(` + * type Query { + * noop: String + * } + * + * type Subscription { + * greeting: String + * } + * `); + * const validatedArgs = validateSubscriptionArgs({ + * schema, + * document: parse('subscription { greeting }'), + * rootValue: { greeting: 'Hello' }, + * }); + * + * assert('schema' in validatedArgs); + * + * const result = await executeSubscriptionEvent(validatedArgs); + * result; // => { data: { greeting: 'Hello' } } + * ``` + */ +export declare function executeSubscriptionEvent(validatedExecutionArgs: ValidatedSubscriptionArgs): PromiseOrValue<ExecutionResult>; +/** + * Implements the "Subscribe" algorithm described in the GraphQL specification. + * + * Returns either an AsyncGenerator (if successful), an ExecutionResult (error), + * or a Promise for one of those results. The call will throw immediately if + * the schema is invalid or the selected operation is not a subscription. + * + * GraphQL request errors, including missing operations and variable coercion + * errors, return or resolve to a GraphQL Response (ExecutionResult) with + * descriptive errors and no data. + * + * If the source stream could not be created due to faulty subscription resolver + * logic, a non-async-iterable resolver result, or a system error, the + * function will return or resolve to a single ExecutionResult containing + * `errors` and no `data`. + * + * If the operation succeeded, the function returns or resolves to an + * AsyncGenerator, which yields a stream of ExecutionResults representing the + * response stream. + * + * This function does not support incremental delivery (`@defer` and `@stream`). + * If an operation which would defer or stream data is executed with this + * function, a field error will be raised at the location of the `@defer` or + * `@stream` directive. + * + * Accepts an object with named arguments. + * @param args - Execution arguments for the subscription operation. + * @returns A response stream for a valid subscription, or an execution result containing errors. + * @example + * ```ts + * // Use a same-named rootValue function to provide the source event stream. + * import assert from 'node:assert'; + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { subscribe } from 'graphql/execution'; + * + * async function* greetings() { + * yield { greeting: 'Hello' }; + * yield { greeting: 'Bonjour' }; + * } + * + * const schema = buildSchema(` + * type Query { + * noop: String + * } + * + * type Subscription { + * greeting: String + * } + * `); + * + * const result = await subscribe({ + * schema, + * document: parse('subscription { greeting }'), + * rootValue: { greeting: () => greetings() }, + * }); + * + * assert('next' in result); + * + * const firstPayload = await result.next(); + * firstPayload.value; // => { data: { greeting: 'Hello' } } + * ``` + * @example + * ```ts + * // This variant supplies events through a custom subscribeFieldResolver. + * import assert from 'node:assert'; + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { subscribe } from 'graphql/execution'; + * + * async function* defaultGreetings() { + * yield { greeting: 'Hello' }; + * } + * + * async function* frenchGreetings() { + * yield { greeting: 'Bonjour' }; + * } + * + * const schema = buildSchema(` + * type Query { + * noop: String + * } + * + * type Subscription { + * greeting(locale: String): String + * } + * `); + * + * const result = await subscribe({ + * schema, + * document: parse( + * 'subscription Greeting($locale: String) { greeting(locale: $locale) }', + * ), + * rootValue: { + * greeting: (args, contextValue) => { + * const locale = args.locale ?? contextValue.defaultLocale; + * return locale === 'fr' ? frenchGreetings() : defaultGreetings(); + * }, + * }, + * contextValue: { defaultLocale: 'fr' }, + * variableValues: { locale: 'fr' }, + * operationName: 'Greeting', + * subscribeFieldResolver: (rootValue, args, contextValue, info) => { + * args.locale; // => 'fr' + * return rootValue[info.fieldName](args, contextValue); + * }, + * }); + * + * assert('next' in result); + * + * const firstPayload = await result.next(); + * firstPayload.value; // => { data: { greeting: 'Bonjour' } } + * ``` + */ +export declare function subscribe(args: ExecutionArgs): PromiseOrValue<AsyncGenerator<ExecutionResult, void, void> | ExecutionResult>; +/** + * Implements the "CreateSourceEventStream" algorithm described in the + * GraphQL specification, resolving the subscription source event stream for a + * previously validated subscription request. + * + * Returns either an AsyncIterable (if successful), an ExecutionResult (error), + * or a Promise for one of those results. The call will throw immediately if + * it is not passed validated execution arguments. + * + * If the validated arguments do not result in a compliant subscription, a + * GraphQL Response (ExecutionResult) with descriptive errors and no data will + * be returned. + * + * If the source stream could not be created due to faulty subscription + * resolver logic or a system error, the function will return or + * resolve to a single ExecutionResult containing `errors` and no `data`. + * + * If the operation succeeded, the function returns or resolves to the + * AsyncIterable for the event stream returned by the resolver. + * + * A Source Event Stream represents a sequence of events, each of which triggers + * a GraphQL execution for that event. + * + * This may be useful when hosting the stateful subscription service in a + * different process or machine than the stateless GraphQL execution engine, + * or otherwise separating these two steps. For more on this, see the + * "Supporting Subscriptions at Scale" information in the GraphQL specification. + * @param validatedExecutionArgs - Validated subscription execution arguments. + * @returns A source event stream, or an execution result containing errors. + * @example + * ```ts + * import assert from 'node:assert'; + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { + * createSourceEventStream, + * validateSubscriptionArgs, + * } from 'graphql/execution'; + * + * async function* greetings() { + * yield { greeting: 'Hello' }; + * } + * + * const schema = buildSchema(` + * type Query { + * noop: String + * } + * + * type Subscription { + * greeting: String + * } + * `); + * const validatedArgs = validateSubscriptionArgs({ + * schema, + * document: parse('subscription { greeting }'), + * rootValue: { greeting: () => greetings() }, + * }); + * + * assert('schema' in validatedArgs); + * + * const stream = await createSourceEventStream(validatedArgs); + * Symbol.asyncIterator in stream; // => true + * ``` + */ +export declare function createSourceEventStream(validatedExecutionArgs: ValidatedSubscriptionArgs): PromiseOrValue<AsyncIterable<unknown> | ExecutionResult>; +/** + * Validates the arguments passed to execute, subscribe, and their lower-level + * helpers. + * + * Throws if the schema is invalid. GraphQL request errors, including variable + * coercion errors, are returned as a GraphQLError array. + * @param args - Execution arguments to validate. + * @returns Validated execution arguments, or validation errors. + * @example + * ```ts + * import assert from 'node:assert'; + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { validateExecutionArgs } from 'graphql/execution'; + * + * const schema = buildSchema(` + * interface Named { + * name: String! + * } + * + * type User implements Named { + * name: String! + * } + * + * type Query { + * viewer: Named + * } + * `); + * const abortController = new AbortController(); + * const validatedArgs = validateExecutionArgs({ + * schema, + * document: parse('query Viewer { viewer { __typename name } }'), + * rootValue: { viewer: { kind: 'user', name: 'Ada' } }, + * contextValue: { locale: 'en' }, + * operationName: 'Viewer', + * fieldResolver: (source, _args, contextValue, info) => { + * contextValue.locale; // => 'en' + * return source[info.fieldName]; + * }, + * typeResolver: (value) => { + * return value.kind === 'user' ? 'User' : undefined; + * }, + * hideSuggestions: true, + * abortSignal: abortController.signal, + * enableEarlyExecution: true, + * hooks: { + * asyncWorkFinished: () => {}, + * }, + * options: { maxCoercionErrors: 1 }, + * }); + * + * assert('operation' in validatedArgs); + * + * validatedArgs.operation.name?.value; // => 'Viewer' + * validatedArgs.hideSuggestions; // => true + * ``` + */ +export declare function validateExecutionArgs(args: ExecutionArgs): ReadonlyArray<GraphQLError> | ValidatedExecutionArgs; +/** + * Validates execution arguments for a subscription operation. + * + * Throws if the schema is invalid or the selected operation is not a + * subscription. GraphQL request errors, including variable coercion errors, are + * returned as a GraphQLError array. + * @param args - Execution arguments to validate. + * @returns Validated subscription execution arguments, or validation errors. + * @example + * ```ts + * import assert from 'node:assert'; + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { validateSubscriptionArgs } from 'graphql/execution'; + * + * const schema = buildSchema(` + * type Query { + * noop: String + * } + * + * type Subscription { + * greeting: String + * } + * `); + * const validatedArgs = validateSubscriptionArgs({ + * schema, + * document: parse('subscription { greeting }'), + * }); + * + * assert('operation' in validatedArgs); + * + * validatedArgs.operation.operation; // => 'subscription' + * ``` + */ +export declare function validateSubscriptionArgs(args: ExecutionArgs): ReadonlyArray<GraphQLError> | ValidatedSubscriptionArgs; +/** + * If a resolveType function is not given, then a default resolve behavior is + * used which attempts two strategies: + * + * First, See if the provided value has a `__typename` field defined, if so, use + * that value as name of the resolved type. + * + * Otherwise, test each possible type for the abstract type by calling + * isTypeOf for the object being coerced, returning the first type that matches. + */ +export declare const defaultTypeResolver: GraphQLTypeResolver<unknown, unknown>; +/** + * If a resolve function is not given, then a default resolve behavior is used + * which takes the property of the source object of the same name as the field + * and returns it as the result, or if it's a function, returns the result + * of calling that function while passing along args and context value. + */ +export declare const defaultFieldResolver: GraphQLFieldResolver<unknown, unknown>; +/** + * Implements the "MapSourceToResponseEvent" algorithm described in the + * GraphQL specification, mapping each event from a subscription source event + * stream to an ExecutionResult in the response stream. + * @param validatedExecutionArgs - Validated subscription execution arguments. + * @param sourceEventStream - Source event stream returned by the subscription resolver. + * @param rootSelectionSetExecutor - Function used to execute each source event. + * @returns A response stream of execution results. + * @example + * ```ts + * import assert from 'node:assert'; + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { + * mapSourceToResponseEvent, + * validateSubscriptionArgs, + * } from 'graphql/execution'; + * + * async function* events() { + * yield { greeting: 'Hello' }; + * } + * + * const schema = buildSchema(` + * type Query { + * noop: String + * } + * + * type Subscription { + * greeting: String + * } + * `); + * const validatedArgs = validateSubscriptionArgs({ + * schema, + * document: parse('subscription { greeting }'), + * }); + * + * assert('schema' in validatedArgs); + * + * const responseStream = mapSourceToResponseEvent(validatedArgs, events()); + * const firstPayload = await responseStream.next(); + * + * firstPayload.value; // => { data: { greeting: 'Hello' } } + * ``` + */ +export declare function mapSourceToResponseEvent(validatedExecutionArgs: ValidatedSubscriptionArgs, sourceEventStream: AsyncIterable<unknown>, rootSelectionSetExecutor?: RootSelectionSetExecutor): AsyncGenerator<ExecutionResult, void, void>; +/** Function used by a GraphQL harness to parse GraphQL source text. */ +export type GraphQLParseFn = (...args: Parameters<typeof parse>) => PromiseOrValue<ReturnType<typeof parse>>; +/** Function used by a GraphQL harness to validate a parsed document. */ +export type GraphQLValidateFn = (...args: Parameters<typeof validate>) => PromiseOrValue<ReturnType<typeof validate>>; +/** Function used by a GraphQL harness to execute a valid operation. */ +export type GraphQLExecuteFn = (...args: Parameters<typeof execute>) => ReturnType<typeof execute>; +/** Function used by a GraphQL harness to create a subscription response stream. */ +export type GraphQLSubscribeFn = (...args: Parameters<typeof subscribe>) => ReturnType<typeof subscribe>; +/** + * Overrides for the parse, validate, execute, and subscribe stages used by the + * high-level `graphql` and `graphqlSync` request pipeline. + */ +export interface GraphQLHarness { + /** Parses GraphQL source text into a document AST. */ + parse: GraphQLParseFn; + /** Validates a document AST against a schema. */ + validate: GraphQLValidateFn; + /** Executes a valid operation. */ + execute: GraphQLExecuteFn; + /** Creates a response stream for a subscription operation. */ + subscribe: GraphQLSubscribeFn; +} +/** + * Default harness backed by GraphQL.js parse, validate, execute, and subscribe + * implementations. + */ +export declare const defaultHarness: GraphQLHarness; +/** + * Describes the input object accepted by `graphql` and `graphqlSync`. + * + * These arguments describe the full parse, validate, and execute lifecycle for + * a GraphQL request. They include parser options, validation options, execution + * options, and an optional harness for replacing pipeline stages. + * + * `graphql` and `graphqlSync` do not support incremental delivery (`@defer` and + * `@stream`); use `experimentalExecuteIncrementally` after parsing and + * validating when incremental delivery is required. + */ +export interface GraphQLArgs extends ParseOptions, ValidationOptions, Omit<ExecutionArgs, "document"> { + /** + * Custom parse, validate, execute, and subscribe functions for this request + * pipeline. + */ + harness?: GraphQLHarness | undefined; + /** + * A GraphQL language-formatted string or source object representing the + * requested operation. + */ + source: string | Source; + /** Validation rules to use instead of the specified rules. */ + rules?: ReadonlyArray<ValidationRule> | undefined; +} +/** + * Parses, validates, and executes a GraphQL document against a schema. + * + * This is the primary entry point for fulfilling GraphQL operations. Use this + * when you want a single-call request lifecycle that returns a promise in all + * cases. + * + * More sophisticated GraphQL servers, such as those which persist queries, may + * wish to separate the validation and execution phases to a static-time tooling + * step and a server runtime step. + * @param args - Request execution arguments, including schema and source. + * @returns A promise that resolves to an execution result or validation errors. + * @example + * ```ts + * // Execute a complete asynchronous request with variables. + * import { graphql, buildSchema } from 'graphql'; + * + * const schema = buildSchema(` + * type Query { + * greeting(name: String!): String + * } + * `); + * + * const result = await graphql({ + * schema, + * source: 'query SayHello($name: String!) { greeting(name: $name) }', + * rootValue: { + * greeting: ({ name }) => `Hello, ${name}!`, + * }, + * variableValues: { name: 'Ada' }, + * operationName: 'SayHello', + * }); + * + * result; // => { data: { greeting: 'Hello, Ada!' } } + * ``` + * @example + * ```ts + * // This variant supplies context plus custom field and type resolvers. + * import { graphql, buildSchema } from 'graphql'; + * + * const schema = buildSchema(` + * interface Named { + * name: String! + * } + * + * type User implements Named { + * name: String! + * } + * + * type Query { + * viewer: Named + * } + * `); + * + * const result = await graphql({ + * schema, + * source: '{ viewer { __typename name } }', + * rootValue: { viewer: { kind: 'user', name: 'Ada' } }, + * contextValue: { locale: 'en' }, + * fieldResolver: (source, _args, context, info) => { + * context.locale; // => 'en' + * return source[info.fieldName]; + * }, + * typeResolver: (value) => { + * return value.kind === 'user' ? 'User' : undefined; + * }, + * }); + * + * result; // => { data: { viewer: { __typename: 'User', name: 'Ada' } } } + * ``` + * @example + * ```ts + * // This variant customizes the request pipeline with a harness. + * import { buildSchema, defaultHarness, graphql } from 'graphql'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * const stages = []; + * const abortController = new AbortController(); + * const harness = { + * parse: (...args) => { + * stages.push('parse'); + * return defaultHarness.parse(...args); + * }, + * validate: (...args) => { + * stages.push('validate'); + * return defaultHarness.validate(...args); + * }, + * execute: (...args) => { + * stages.push('execute'); + * return defaultHarness.execute(...args); + * }, + * subscribe: (...args) => { + * stages.push('subscribe'); + * return defaultHarness.subscribe(...args); + * }, + * }; + * + * const result = await graphql({ + * schema, + * source: '{ greeting }', + * rootValue: { greeting: 'Hello' }, + * rules: [], + * maxErrors: 25, + * hideSuggestions: true, + * noLocation: true, + * abortSignal: abortController.signal, + * harness, + * }); + * + * result; // => { data: { greeting: 'Hello' } } + * stages; // => ['parse', 'validate', 'execute'] + * ``` + * @category Request Pipeline + */ +export declare function graphql(args: GraphQLArgs): Promise<ExecutionResult>; +/** + * Parses, validates, and executes a GraphQL document synchronously. + * + * This function guarantees that execution completes synchronously, or throws an + * error, assuming that all field resolvers are also synchronous. It throws when + * any resolver returns a promise. + * @param args - Request execution arguments, including schema and source. + * @returns Completed execution output, or request errors if parsing or + * validation fails. + * @example + * ```ts + * // Execute a complete synchronous request with variables. + * import { graphqlSync, buildSchema } from 'graphql'; + * + * const schema = buildSchema(` + * type Query { + * greeting(name: String!): String + * } + * `); + * + * const result = graphqlSync({ + * schema, + * source: 'query SayHello($name: String!) { greeting(name: $name) }', + * rootValue: { + * greeting: ({ name }) => `Hello, ${name}!`, + * }, + * variableValues: { name: 'Ada' }, + * operationName: 'SayHello', + * }); + * + * result; // => { data: { greeting: 'Hello, Ada!' } } + * ``` + * @example + * ```ts + * // This variant uses a synchronous custom field resolver and context. + * import { graphqlSync, buildSchema } from 'graphql'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * + * const result = graphqlSync({ + * schema, + * source: '{ greeting }', + * fieldResolver: (_source, _args, contextValue) => { + * return contextValue.defaultGreeting; + * }, + * contextValue: { defaultGreeting: 'Hello' }, + * }); + * + * result; // => { data: { greeting: 'Hello' } } + * ``` + * @category Request Pipeline + */ +export declare function graphqlSync(args: GraphQLArgs): ExecutionResult; +/** + * Render a helpful description of the location in the GraphQL Source document. + * @param location - The AST location to print. + * @returns A formatted source excerpt with line and column information. + * @example + * ```ts + * import { parse, printLocation } from 'graphql/language'; + * + * const document = parse('type Query { hello: String }'); + * const location = document.definitions[0].loc; + * + * if (location) { + * const printed = printLocation(location); + * + * printed; // => 'GraphQL request:1:1\n1 | type Query { hello: String }\n | ^' + * } + * ``` + */ +export declare function printLocation(location: Location$1): string; +/** + * Render a helpful description of the location in the GraphQL Source document. + * @param source - The source document that contains the location. + * @param sourceLocation - The 1-indexed line and column to print. + * @returns A formatted source excerpt with line and column information. + * @example + * ```ts + * import { Source, printSourceLocation } from 'graphql/language'; + * + * const source = new Source('type Query { hello: String }'); + * const printed = printSourceLocation(source, { line: 1, column: 14 }); + * + * printed; // => 'GraphQL request:1:14\n1 | type Query { hello: String }\n | ^' + * ``` + */ +export declare function printSourceLocation(source: Source, sourceLocation: SourceLocation): string; +/** + * Converts an AST into a string, using one set of reasonable + * formatting rules. + * @param ast - The GraphQL AST node to print. + * @returns A stable string representation of the AST. + * @example + * ```ts + * import { parse, print } from 'graphql'; + * + * const ast = parse('{ hero { name } }'); + * const text = print(ast); + * + * text; // => '{\n hero {\n name\n }\n}' + * ``` + */ +export declare function print(ast: ASTNode): string; +/** + * Returns true when the AST node is a definition node. + * @param node - The AST node to test. + * @returns True when the AST node is a definition node. + * @example + * ```ts + * import { parse, isDefinitionNode } from 'graphql/language'; + * + * const document = parse('{ hello }'); + * + * isDefinitionNode(document.definitions[0]); // => true + * isDefinitionNode(document); // => false + * ``` + */ +export declare function isDefinitionNode(node: ASTNode): node is DefinitionNode; +/** + * Returns true when the AST node is an executable definition node. + * @param node - The AST node to test. + * @returns True when the AST node is an executable definition node. + * @example + * ```ts + * import { parse, isExecutableDefinitionNode } from 'graphql/language'; + * + * const query = parse('{ hello }'); + * const schema = parse('type Query { hello: String }'); + * + * isExecutableDefinitionNode(query.definitions[0]); // => true + * isExecutableDefinitionNode(schema.definitions[0]); // => false + * ``` + */ +export declare function isExecutableDefinitionNode(node: ASTNode): node is ExecutableDefinitionNode; +/** + * A type predicate for SubscriptionOperationDefinitionNode. + * Useful anywhere that must distinguish subscription operations from + * queries and mutations, such as the subscription execution pipeline + * which routes events through a different code path. + * @param node - Operation definition node to test. + * @returns True when the operation definition is a subscription. + * @example + * ```ts + * import { parse, isSubscriptionOperationDefinitionNode } from 'graphql/language'; + * + * const subscription = parse('subscription { greeting }').definitions[0]; + * const query = parse('{ greeting }').definitions[0]; + * + * isSubscriptionOperationDefinitionNode(subscription); // => true + * isSubscriptionOperationDefinitionNode(query); // => false + * ``` + */ +export declare function isSubscriptionOperationDefinitionNode(node: OperationDefinitionNode): node is SubscriptionOperationDefinitionNode; +/** + * Returns true when the AST node is a selection node. + * @param node - The AST node to test. + * @returns True when the AST node is a selection node. + * @example + * ```ts + * import { Kind, isSelectionNode } from 'graphql/language'; + * + * const field = { kind: Kind.FIELD, name: { kind: Kind.NAME, value: 'hello' } }; + * const document = { kind: Kind.DOCUMENT, definitions: [] }; + * + * isSelectionNode(field); // => true + * isSelectionNode(document); // => false + * ``` + */ +export declare function isSelectionNode(node: ASTNode): node is SelectionNode; +/** + * Returns true when the AST node is a value node. + * @param node - The AST node to test. + * @returns True when the AST node is a value node. + * @example + * ```ts + * import { parseType, parseValue, isValueNode } from 'graphql/language'; + * + * const value = parseValue('[42]'); + * const type = parseType('[String!]'); + * + * isValueNode(value); // => true + * isValueNode(type); // => false + * ``` + */ +export declare function isValueNode(node: ASTNode): node is ValueNode; +/** + * Returns true when the AST node is a constant value node. + * @param node - The AST node to test. + * @returns True when the AST node is a constant value node. + * @example + * ```ts + * import { + * parseConstValue, + * parseValue, + * isConstValueNode, + * } from 'graphql/language'; + * + * const value = parseConstValue('[42]'); + * const variable = parseValue('$id'); + * + * isConstValueNode(value); // => true + * isConstValueNode(variable); // => false + * ``` + */ +export declare function isConstValueNode(node: ASTNode): node is ConstValueNode; +/** + * Returns true when the AST node is a type node. + * @param node - The AST node to test. + * @returns True when the AST node is a type node. + * @example + * ```ts + * import { parseType, parseValue, isTypeNode } from 'graphql/language'; + * + * const type = parseType('[String!]'); + * const value = parseValue('[42]'); + * + * isTypeNode(type); // => true + * isTypeNode(value); // => false + * ``` + */ +export declare function isTypeNode(node: ASTNode): node is TypeNode; +/** + * Returns true when the AST node is a type system definition node. + * @param node - The AST node to test. + * @returns True when the AST node is a type system definition node. + * @example + * ```ts + * import { parse, isTypeSystemDefinitionNode } from 'graphql/language'; + * + * const schema = parse('type Query { hello: String }'); + * const query = parse('{ hello }'); + * + * isTypeSystemDefinitionNode(schema.definitions[0]); // => true + * isTypeSystemDefinitionNode(query.definitions[0]); // => false + * ``` + */ +export declare function isTypeSystemDefinitionNode(node: ASTNode): node is TypeSystemDefinitionNode; +/** + * Returns true when the AST node is a type definition node. + * @param node - The AST node to test. + * @returns True when the AST node is a type definition node. + * @example + * ```ts + * import { parse, isTypeDefinitionNode } from 'graphql/language'; + * + * const typeDefinition = parse('type Query { hello: String }'); + * const directiveDefinition = parse('directive @cache on FIELD'); + * + * isTypeDefinitionNode(typeDefinition.definitions[0]); // => true + * isTypeDefinitionNode(directiveDefinition.definitions[0]); // => false + * ``` + */ +export declare function isTypeDefinitionNode(node: ASTNode): node is TypeDefinitionNode; +/** + * Returns true when the AST node is a type system extension node. + * @param node - The AST node to test. + * @returns True when the AST node is a type system extension node. + * @example + * ```ts + * import { parse, isTypeSystemExtensionNode } from 'graphql/language'; + * + * const extension = parse('extend type Query { hello: String }'); + * const definition = parse('type Query { hello: String }'); + * + * isTypeSystemExtensionNode(extension.definitions[0]); // => true + * isTypeSystemExtensionNode(definition.definitions[0]); // => false + * ``` + */ +export declare function isTypeSystemExtensionNode(node: ASTNode): node is TypeSystemExtensionNode; +/** + * Returns true when the AST node is a type extension node. + * @param node - The AST node to test. + * @returns True when the AST node is a type extension node. + * @example + * ```ts + * import { parse, isTypeExtensionNode } from 'graphql/language'; + * + * const extension = parse('extend type Query { hello: String }'); + * const schemaExtension = parse('extend schema { query: Query }'); + * + * isTypeExtensionNode(extension.definitions[0]); // => true + * isTypeExtensionNode(schemaExtension.definitions[0]); // => false + * ``` + */ +export declare function isTypeExtensionNode(node: ASTNode): node is TypeExtensionNode; +/** + * Returns true when the AST node is a schema coordinate node. + * @param node - The AST node to test. + * @returns True when the AST node is a schema coordinate node. + * @example + * ```ts + * import { + * parse, + * parseSchemaCoordinate, + * isSchemaCoordinateNode, + * } from 'graphql/language'; + * + * const coordinate = parseSchemaCoordinate('Query.hero'); + * const document = parse('{ hero }'); + * + * isSchemaCoordinateNode(coordinate); // => true + * isSchemaCoordinateNode(document); // => false + * ``` + */ +export declare function isSchemaCoordinateNode(node: ASTNode): node is SchemaCoordinateNode; +/** + * Results for an operation that produced legacy incremental payloads. + * @typeParam TInitialData - Shape of the initial result data payload. + * @typeParam TDeferredData - Shape of deferred fragment data payloads. + * @typeParam TStreamItem - Shape of streamed list items. + * @typeParam TExtensions - Shape of extensions payloads. + */ +export interface LegacyExperimentalIncrementalExecutionResults<TInitialData = ObjMap<unknown>, TDeferredData = ObjMap<unknown>, TStreamItem = unknown, TExtensions = ObjMap<unknown>> { + /** Initial execution result delivered before subsequent legacy incremental payloads. */ + initialResult: LegacyInitialIncrementalExecutionResult<TInitialData, TExtensions>; + /** Async stream of legacy incremental payloads delivered after the initial result. */ + subsequentResults: AsyncGenerator<LegacySubsequentIncrementalExecutionResult<TDeferredData, TStreamItem, TExtensions>, void, void>; +} +/** + * Initial execution result for an operation that produced legacy incremental payloads. + * + * Unlike `InitialIncrementalExecutionResult`, the legacy initial result does + * not include a `pending` list. Subsequent payloads identify their location + * directly with `path` and optional `label` fields. + * @typeParam TInitialData - Shape of the initial data payload. + * @typeParam TExtensions - Shape of the extensions payload. + */ +export interface LegacyInitialIncrementalExecutionResult<TInitialData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> extends ExecutionResult<TInitialData, TExtensions> { + /** Data produced by the initial execution payload. */ + data: TInitialData; + /** Indicates that subsequent legacy incremental payloads will follow. */ + hasNext: true; + /** Additional non-standard metadata included in the initial result. */ + extensions?: TExtensions; +} +/** + * Subsequent payload produced by legacy incremental execution. + * + * Legacy subsequent payloads may contain deferred fragment data, streamed list + * items, or only `hasNext: false` to complete the response stream. + * @typeParam TDeferredData - Shape of deferred fragment data payloads. + * @typeParam TStreamItem - Shape of streamed list items. + * @typeParam TExtensions - Shape of the extensions payload. + */ +export interface LegacySubsequentIncrementalExecutionResult<TDeferredData = ObjMap<unknown>, TStreamItem = unknown, TExtensions = ObjMap<unknown>> { + /** Deferred or streamed payloads delivered by this response. */ + incremental?: ReadonlyArray<LegacyIncrementalResult<TDeferredData, TStreamItem, TExtensions>>; + /** Indicates whether more legacy incremental payloads will follow. */ + hasNext: boolean; + /** Additional non-standard metadata included in this payload. */ + extensions?: TExtensions; +} +/** + * Deferred fragment or streamed list payload produced by legacy incremental execution. + * @typeParam TDeferredData - Shape of deferred fragment data. + * @typeParam TStreamItem - Shape of streamed list items. + * @typeParam TExtensions - Shape of extensions payloads. + */ +export type LegacyIncrementalResult<TDeferredData = ObjMap<unknown>, TStreamItem = unknown, TExtensions = ObjMap<unknown>> = LegacyIncrementalDeferResult<TDeferredData, TExtensions> | LegacyIncrementalStreamResult<TStreamItem, TExtensions>; +/** + * Legacy incremental payload produced by a deferred fragment. + * + * The payload location is identified directly by `path` and optional `label` + * instead of by an `id` from a pending entry. + * @typeParam TDeferredData - Shape of deferred fragment data. + * @typeParam TExtensions - Shape of extensions payloads. + */ +export interface LegacyIncrementalDeferResult<TDeferredData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> extends ExecutionResult<TDeferredData, TExtensions> { + /** Response path to the deferred fragment payload. */ + path: ReadonlyArray<string | number>; + /** Label from the `@defer` directive. */ + label?: string; +} +/** + * Legacy incremental payload produced by a streamed list field. + * @typeParam TStreamItem - Shape of streamed list items. + * @typeParam TExtensions - Shape of extensions payloads. + */ +export interface LegacyIncrementalStreamResult<TStreamItem = unknown, TExtensions = ObjMap<unknown>> { + /** Errors raised while producing streamed items. */ + errors?: ReadonlyArray<GraphQLError>; + /** Streamed list items delivered by this payload. */ + items: ReadonlyArray<TStreamItem> | null; + /** Response path to the first streamed list item in this payload. */ + path: ReadonlyArray<string | number>; + /** Label from the `@stream` directive. */ + label?: string; + /** Additional non-standard metadata included in this payload. */ + extensions?: TExtensions; +} +/** + * JSON-serializable form of legacy incremental execution results. + * @typeParam TInitialData - Shape of the formatted initial result data payload. + * @typeParam TDeferredData - Shape of formatted deferred fragment data payloads. + * @typeParam TStreamItem - Shape of formatted streamed list items. + * @typeParam TExtensions - Shape of formatted extensions payloads. + */ +export interface FormattedLegacyExperimentalIncrementalExecutionResults<TInitialData = ObjMap<unknown>, TDeferredData = ObjMap<unknown>, TStreamItem = unknown, TExtensions = ObjMap<unknown>> { + /** Formatted initial execution result. */ + initialResult: FormattedLegacyInitialIncrementalExecutionResult<TInitialData, TExtensions>; + /** Async stream of formatted legacy incremental payloads. */ + subsequentResults: AsyncGenerator<FormattedLegacySubsequentIncrementalExecutionResult<TDeferredData, TStreamItem, TExtensions>, void, void>; +} +/** + * JSON-serializable form of a legacy initial incremental execution result. + * @typeParam TInitialData - Shape of the formatted initial data payload. + * @typeParam TExtensions - Shape of the formatted extensions payload. + */ +export interface FormattedLegacyInitialIncrementalExecutionResult<TInitialData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> extends FormattedExecutionResult<TInitialData, TExtensions> { + /** Formatted data produced by the initial execution payload. */ + data: TInitialData; + /** Indicates that subsequent legacy incremental payloads will follow. */ + hasNext: true; + /** Additional non-standard metadata included in the formatted initial result. */ + extensions?: TExtensions; +} +/** + * JSON-serializable form of a legacy subsequent incremental execution payload. + * @typeParam TDeferredData - Shape of formatted deferred fragment data payloads. + * @typeParam TStreamItem - Shape of formatted streamed list items. + * @typeParam TExtensions - Shape of formatted extensions payloads. + */ +export interface FormattedLegacySubsequentIncrementalExecutionResult<TDeferredData = ObjMap<unknown>, TStreamItem = unknown, TExtensions = ObjMap<unknown>> { + /** Formatted deferred or streamed payloads delivered by this response. */ + incremental?: ReadonlyArray<FormattedLegacyIncrementalResult<TDeferredData, TStreamItem, TExtensions>>; + /** Indicates whether more legacy incremental payloads will follow. */ + hasNext: boolean; + /** Additional non-standard metadata included in this formatted payload. */ + extensions?: TExtensions; +} +/** + * JSON-serializable deferred fragment or streamed list payload produced by + * legacy incremental execution. + * @typeParam TDeferredData - Shape of formatted deferred fragment data. + * @typeParam TStreamItem - Shape of formatted streamed list items. + * @typeParam TExtensions - Shape of formatted extensions payloads. + */ +export type FormattedLegacyIncrementalResult<TDeferredData = ObjMap<unknown>, TStreamItem = unknown, TExtensions = ObjMap<unknown>> = FormattedLegacyIncrementalDeferResult<TDeferredData, TExtensions> | FormattedLegacyIncrementalStreamResult<TStreamItem, TExtensions>; +/** + * JSON-serializable form of a legacy deferred fragment payload. + * @typeParam TDeferredData - Shape of formatted deferred fragment data. + * @typeParam TExtensions - Shape of formatted extensions payloads. + */ +export interface FormattedLegacyIncrementalDeferResult<TDeferredData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> extends FormattedExecutionResult<TDeferredData, TExtensions> { + /** Response path to the formatted deferred fragment payload. */ + path: ReadonlyArray<string | number>; + /** Label from the `@defer` directive. */ + label?: string; +} +/** + * JSON-serializable form of a legacy streamed list payload. + * @typeParam TStreamItem - Shape of formatted streamed list items. + * @typeParam TExtensions - Shape of formatted extensions payloads. + */ +export interface FormattedLegacyIncrementalStreamResult<TStreamItem = unknown, TExtensions = ObjMap<unknown>> { + /** Formatted errors raised while producing streamed items. */ + errors?: ReadonlyArray<GraphQLFormattedError>; + /** Formatted streamed list items delivered by this payload. */ + items: ReadonlyArray<TStreamItem> | null; + /** Response path to the first streamed list item in this formatted payload. */ + path: ReadonlyArray<string | number>; + /** Label from the `@stream` directive. */ + label?: string; + /** Additional non-standard metadata included in this formatted payload. */ + extensions?: TExtensions; +} +/** + * Executes a GraphQL operation with support for `@defer` and `@stream` using + * the legacy incremental delivery payload format. + * + * Prefer `experimentalExecuteIncrementally` for the current incremental + * delivery format. In the legacy format, each subsequent incremental payload + * identifies its location with `path` and optional `label` fields. The current + * format instead tracks pending work by `id` and reports completion through + * `completed` entries. + * @param args - Execution arguments for the GraphQL operation. + * @returns A single execution result or legacy incremental execution results. + * @example + * ```ts + * import assert from 'node:assert'; + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { legacyExecuteIncrementally } from 'graphql/execution'; + * + * const schema = buildSchema(` + * type Query { + * hero: Hero + * } + * + * type Hero { + * id: ID! + * name: String! + * } + * `); + * + * const result = await legacyExecuteIncrementally({ + * schema, + * document: parse('{ hero { id ... @defer(label: "HeroName") { name } } }'), + * rootValue: { hero: { id: '1', name: 'Luke' } }, + * }); + * + * assert('initialResult' in result); + * + * result.initialResult; // => { data: { hero: { id: '1' } }, hasNext: true } + * + * const deferred = await result.subsequentResults.next(); + * deferred.value; // => { incremental: [ { data: { name: 'Luke' }, path: ['hero'], label: 'HeroName' } ], hasNext: false } + * ``` + * @example + * Compare the legacy payload format with the current incremental delivery + * format returned by `experimentalExecuteIncrementally`. + * ```ts + * import assert from 'node:assert'; + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { + * experimentalExecuteIncrementally, + * legacyExecuteIncrementally, + * } from 'graphql/execution'; + * + * const schema = buildSchema(` + * type Query { + * hero: Hero + * } + * + * type Hero { + * id: ID! + * name: String! + * } + * `); + * const document = parse('{ hero { id ... @defer { name } } }'); + * const rootValue = { hero: { id: '1', name: 'Luke' } }; + * + * const experimental = await experimentalExecuteIncrementally({ + * schema, + * document, + * rootValue, + * }); + * const legacy = await legacyExecuteIncrementally({ + * schema, + * document, + * rootValue, + * }); + * + * assert('initialResult' in experimental); + * assert('initialResult' in legacy); + * + * experimental.initialResult; // => { data: { hero: { id: '1' } }, pending: [ { id: '0', path: ['hero'] } ], hasNext: true } + * legacy.initialResult; // => { data: { hero: { id: '1' } }, hasNext: true } + * + * const experimentalDeferred = await experimental.subsequentResults.next(); + * experimentalDeferred.value; // => { incremental: [{ data: { name: 'Luke' }, id: '0' }], completed: [{ id: '0' }], hasNext: false } + * + * const legacyDeferred = await legacy.subsequentResults.next(); + * legacyDeferred.value; // => { incremental: [ { data: { name: 'Luke' }, path: ['hero'] } ], hasNext: false } + * ``` + * @example + * Compare streamed list payloads in the legacy and current incremental + * delivery formats. + * ```ts + * import assert from 'node:assert'; + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { + * experimentalExecuteIncrementally, + * legacyExecuteIncrementally, + * } from 'graphql/execution'; + * + * const schema = buildSchema('type Query { colors: [String] }'); + * const document = parse('{ colors @stream(initialCount: 1) }'); + * const rootValue = { colors: ['red', 'green', 'blue'] }; + * + * const experimental = await experimentalExecuteIncrementally({ + * schema, + * document, + * rootValue, + * }); + * const legacy = await legacyExecuteIncrementally({ + * schema, + * document, + * rootValue, + * }); + * + * assert('initialResult' in experimental); + * assert('initialResult' in legacy); + * + * experimental.initialResult; // => { data: { colors: ['red'] }, pending: [ { id: '0', path: ['colors'] } ], hasNext: true } + * legacy.initialResult; // => { data: { colors: ['red'] }, hasNext: true } + * + * const experimentalStream = await experimental.subsequentResults.next(); + * experimentalStream.value; // => { incremental: [ { items: ['green', 'blue'], id: '0' } ], completed: [{ id: '0' }], hasNext: false } + * + * const legacyStream = await legacy.subsequentResults.next(); + * legacyStream.value; // => { incremental: [ { items: ['green', 'blue'], path: ['colors', 1] } ], hasNext: false } + * ``` + */ +export declare function legacyExecuteIncrementally(args: ExecutionArgs): PromiseOrValue<ExecutionResult | LegacyExperimentalIncrementalExecutionResults>; +/** + * Executes a validated operation root selection set with support for `@defer` + * and `@stream` using the legacy incremental delivery payload format. + * @param validatedExecutionArgs - Validated execution arguments. + * @returns A single execution result or legacy incremental execution results. + * @example + * ```ts + * import assert from 'node:assert'; + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { + * legacyExecuteRootSelectionSet, + * validateExecutionArgs, + * } from 'graphql/execution'; + * + * const schema = buildSchema('type Query { greeting: String }'); + * const validatedArgs = validateExecutionArgs({ + * schema, + * document: parse('{ greeting }'), + * rootValue: { greeting: 'Hello' }, + * }); + * + * assert('schema' in validatedArgs); + * + * const result = await legacyExecuteRootSelectionSet(validatedArgs); + * result; // => { data: { greeting: 'Hello' } } + * ``` + */ +export declare function legacyExecuteRootSelectionSet(validatedExecutionArgs: ValidatedExecutionArgs): PromiseOrValue<ExecutionResult | LegacyExperimentalIncrementalExecutionResults>; +/** + * Technically these aren't part of the spec but they are strongly encouraged + * validation rules. + */ +export declare const recommendedRules: ReadonlyArray<ValidationRule>; +/** + * This set includes all validation rules defined by the GraphQL spec. + * + * The order of the rules in this list has been adjusted to lead to the + * most clear output when encountering multiple validation errors. + */ +export declare const specifiedRules: ReadonlyArray<ValidationRule>; +/** + * Defer and stream directive labels are unique + * + * A GraphQL document is only valid if defer and stream directives' label argument is static and unique. + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { validate, DeferStreamDirectiveLabelRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * friends: [String] + * } + * `); + * const invalidDocument = parse(` + * { + * friends @stream(label: "friends") + * other: friends @stream(label: "friends") + * } + * `); + * const validDocument = parse(` + * { + * friends @stream(label: "friends") + * other: friends @stream(label: "otherFriends") + * } + * `); + * + * validate(schema, invalidDocument, [DeferStreamDirectiveLabelRule]).length; // => 1 + * validate(schema, validDocument, [DeferStreamDirectiveLabelRule]); // => [] + * ``` + */ +export declare function DeferStreamDirectiveLabelRule(context: ValidationContext): ASTVisitor; +/** + * Defer and stream directives are used on valid root field + * + * A GraphQL document is only valid if defer directives are not used on root mutation or subscription types. + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { + * validate, + * DeferStreamDirectiveOnRootFieldRule, + * } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * message: String + * } + * + * type Mutation { + * updateMessage: String + * } + * `); + * const invalidDocument = parse(` + * mutation { ... @defer { updateMessage } } + * `); + * const validDocument = parse(` + * { ... @defer { message } } + * `); + * + * validate(schema, invalidDocument, [DeferStreamDirectiveOnRootFieldRule]).length; // => 1 + * validate(schema, validDocument, [DeferStreamDirectiveOnRootFieldRule]); // => [] + * ``` + */ +export declare function DeferStreamDirectiveOnRootFieldRule(context: ValidationContext): ASTVisitor; +/** + * Defer And Stream Directives Are Used On Valid Operations + * + * A GraphQL document is only valid if defer and stream directives are not used on root mutation or subscription types. + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { + * validate, + * DeferStreamDirectiveOnValidOperationsRule, + * } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * message: Message + * } + * + * type Subscription { + * message: Message + * } + * + * type Message { + * body: String + * } + * `); + * const invalidDocument = parse(` + * subscription { + * message { + * ...MessageBody @defer + * } + * } + * + * fragment MessageBody on Message { + * body + * } + * `); + * const validDocument = parse(` + * subscription { + * message { + * ...MessageBody @defer(if: false) + * } + * } + * + * fragment MessageBody on Message { + * body + * } + * `); + * + * validate(schema, invalidDocument, [DeferStreamDirectiveOnValidOperationsRule]) + * .length; // => 1 + * validate(schema, validDocument, [DeferStreamDirectiveOnValidOperationsRule]); // => [] + * ``` + */ +export declare function DeferStreamDirectiveOnValidOperationsRule(context: ValidationContext): ASTVisitor; +/** + * Executable definitions + * + * A GraphQL document is only valid for execution if all definitions are either + * operation or fragment definitions. + * + * See https://spec.graphql.org/draft/#sec-Executable-Definitions + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { ExecutableDefinitionsRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * name: String + * } + * `); + * + * const invalidDocument = parse(` + * type Extra { field: String } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * ExecutableDefinitionsRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * { name } + * `); + * const validErrors = validate(schema, validDocument, [ + * ExecutableDefinitionsRule, + * ]); + * + * validErrors; // => [] + * ``` + */ +export declare function ExecutableDefinitionsRule(context: ASTValidationContext): ASTVisitor; +/** + * Fields on correct type + * + * A GraphQL document is only valid if all fields selected are defined by the + * parent type, or are an allowed meta field such as __typename. + * + * See https://spec.graphql.org/draft/#sec-Field-Selections + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { FieldsOnCorrectTypeRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * name: String + * } + * `); + * + * const invalidDocument = parse(` + * { missing } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * FieldsOnCorrectTypeRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * { name } + * `); + * const validErrors = validate(schema, validDocument, [FieldsOnCorrectTypeRule]); + * + * validErrors; // => [] + * ``` + */ +export declare function FieldsOnCorrectTypeRule(context: ValidationContext): ASTVisitor; +/** + * Fragments on composite type + * + * Fragments use a type condition to determine if they apply, since fragments + * can only be spread into a composite type (object, interface, or union), the + * type condition must also be a composite type. + * + * See https://spec.graphql.org/draft/#sec-Fragments-On-Composite-Types + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { FragmentsOnCompositeTypesRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * name: String + * } + * `); + * + * const invalidDocument = parse(` + * fragment Bad on String { length } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * FragmentsOnCompositeTypesRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * fragment Good on Query { name } + * `); + * const validErrors = validate(schema, validDocument, [ + * FragmentsOnCompositeTypesRule, + * ]); + * + * validErrors; // => [] + * ``` + */ +export declare function FragmentsOnCompositeTypesRule(context: ValidationContext): ASTVisitor; +/** + * Known argument names + * + * A GraphQL field is only valid if all supplied arguments are defined by + * that field. + * + * See https://spec.graphql.org/draft/#sec-Argument-Names + * See https://spec.graphql.org/draft/#sec-Directives-Are-In-Valid-Locations + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { KnownArgumentNamesRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * field(arg: String): String + * } + * `); + * + * const invalidDocument = parse(` + * { field(unknown: "1") } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * KnownArgumentNamesRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * { field(arg: "1") } + * `); + * const validErrors = validate(schema, validDocument, [KnownArgumentNamesRule]); + * + * validErrors; // => [] + * ``` + */ +export declare function KnownArgumentNamesRule(context: ValidationContext): ASTVisitor; +/** + * Known directives + * + * A GraphQL document is only valid if all `@directives` are known by the + * schema and legally positioned. + * + * See https://spec.graphql.org/draft/#sec-Directives-Are-Defined + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { KnownDirectivesRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * name: String + * } + * `); + * + * const invalidDocument = parse(` + * { name @unknown } + * `); + * const invalidErrors = validate(schema, invalidDocument, [KnownDirectivesRule]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * { name @include(if: true) } + * `); + * const validErrors = validate(schema, validDocument, [KnownDirectivesRule]); + * + * validErrors; // => [] + * ``` + */ +export declare function KnownDirectivesRule(context: ValidationContext | SDLValidationContext): ASTVisitor; +/** + * Known fragment names + * + * A GraphQL document is only valid if all `...Fragment` fragment spreads refer + * to fragments defined in the same document. + * + * See https://spec.graphql.org/draft/#sec-Fragment-spread-target-defined + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { KnownFragmentNamesRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * name: String + * } + * `); + * + * const invalidDocument = parse(` + * { ...Missing } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * KnownFragmentNamesRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * fragment NameFields on Query { name } query { ...NameFields } + * `); + * const validErrors = validate(schema, validDocument, [KnownFragmentNamesRule]); + * + * validErrors; // => [] + * ``` + */ +export declare function KnownFragmentNamesRule(context: ValidationContext): ASTVisitor; +/** + * Known Operation Types + * + * A GraphQL document is only valid if when it contains an operation, + * the root type for the operation exists within the schema. + * + * See https://spec.graphql.org/draft/#sec-Operation-Type-Existence + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { validate, KnownOperationTypesRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * const invalidDocument = parse('mutation { greeting }'); + * const validDocument = parse('{ greeting }'); + * + * validate(schema, invalidDocument, [KnownOperationTypesRule])[0].message; // => 'The mutation operation is not supported by the schema.' + * validate(schema, validDocument, [KnownOperationTypesRule]); // => [] + * ``` + */ +export declare function KnownOperationTypesRule(context: ValidationContext): ASTVisitor; +/** + * Known type names + * + * A GraphQL document is only valid if referenced types (specifically + * variable definitions and fragment conditions) are defined by the type schema. + * + * See https://spec.graphql.org/draft/#sec-Fragment-Spread-Type-Existence + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { KnownTypeNamesRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * name: String + * } + * `); + * + * const invalidDocument = parse(` + * fragment Bad on Missing { name } + * `); + * const invalidErrors = validate(schema, invalidDocument, [KnownTypeNamesRule]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * fragment Good on Query { name } + * `); + * const validErrors = validate(schema, validDocument, [KnownTypeNamesRule]); + * + * validErrors; // => [] + * ``` + */ +export declare function KnownTypeNamesRule(context: ValidationContext | SDLValidationContext): ASTVisitor; +/** + * Lone anonymous operation + * + * A GraphQL document is only valid if when it contains an anonymous operation + * (the query short-hand) that it contains only that one operation definition. + * + * See https://spec.graphql.org/draft/#sec-Lone-Anonymous-Operation + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { LoneAnonymousOperationRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * name: String + * } + * `); + * + * const invalidDocument = parse(` + * query { name } query Other { name } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * LoneAnonymousOperationRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * { name } + * `); + * const validErrors = validate(schema, validDocument, [ + * LoneAnonymousOperationRule, + * ]); + * + * validErrors; // => [] + * ``` + */ +export declare function LoneAnonymousOperationRule(context: ASTValidationContext): ASTVisitor; +/** + * No fragment cycles + * + * The graph of fragment spreads must not form any cycles including spreading itself. + * Otherwise an operation could infinitely spread or infinitely execute on cycles in the underlying data. + * + * See https://spec.graphql.org/draft/#sec-Fragment-spreads-must-not-form-cycles + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { NoFragmentCyclesRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * name: String + * } + * `); + * + * const invalidDocument = parse(` + * fragment A on Query { ...B } fragment B on Query { ...A } query { ...A } + * `); + * const invalidErrors = validate(schema, invalidDocument, [NoFragmentCyclesRule]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * fragment A on Query { name } query { ...A } + * `); + * const validErrors = validate(schema, validDocument, [NoFragmentCyclesRule]); + * + * validErrors; // => [] + * ``` + */ +export declare function NoFragmentCyclesRule(context: ASTValidationContext): ASTVisitor; +/** + * No undefined variables + * + * A GraphQL operation is only valid if all variables encountered, both directly + * and via fragment spreads, are defined by that operation. + * + * See https://spec.graphql.org/draft/#sec-All-Variable-Uses-Defined + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { NoUndefinedVariablesRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * field(arg: ID): String + * } + * `); + * + * const invalidDocument = parse(` + * query ($id: ID) { field(arg: $missing) } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * NoUndefinedVariablesRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * query ($id: ID) { field(arg: $id) } + * `); + * const validErrors = validate(schema, validDocument, [NoUndefinedVariablesRule]); + * + * validErrors; // => [] + * ``` + */ +export declare function NoUndefinedVariablesRule(context: ValidationContext): ASTVisitor; +/** + * No unused fragments + * + * A GraphQL document is only valid if all fragment definitions are spread + * within operations, or spread within other fragments spread within operations. + * + * See https://spec.graphql.org/draft/#sec-Fragments-Must-Be-Used + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { NoUnusedFragmentsRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * name: String + * } + * `); + * + * const invalidDocument = parse(` + * fragment Unused on Query { name } query { name } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * NoUnusedFragmentsRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * fragment Used on Query { name } query { ...Used } + * `); + * const validErrors = validate(schema, validDocument, [NoUnusedFragmentsRule]); + * + * validErrors; // => [] + * ``` + */ +export declare function NoUnusedFragmentsRule(context: ASTValidationContext): ASTVisitor; +/** + * No unused variables + * + * A GraphQL operation is only valid if all variables defined by an operation + * are used, either directly or within a spread fragment. + * + * See https://spec.graphql.org/draft/#sec-All-Variables-Used + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { NoUnusedVariablesRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * field(arg: ID): String + * name: String + * } + * `); + * + * const invalidDocument = parse(` + * query ($id: ID) { name } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * NoUnusedVariablesRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * query ($id: ID) { field(arg: $id) } + * `); + * const validErrors = validate(schema, validDocument, [NoUnusedVariablesRule]); + * + * validErrors; // => [] + * ``` + */ +export declare function NoUnusedVariablesRule(context: ValidationContext): ASTVisitor; +/** + * Overlapping fields can be merged + * + * A selection set is only valid if all fields (including spreading any + * fragments) either correspond to distinct response names or can be merged + * without ambiguity. + * + * See https://spec.graphql.org/draft/#sec-Field-Selection-Merging + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { OverlappingFieldsCanBeMergedRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * dog: Dog + * } + * + * type Dog { + * name: String + * barkVolume: Int + * } + * `); + * + * const invalidDocument = parse(` + * { dog { value: barkVolume value: name } } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * OverlappingFieldsCanBeMergedRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * { dog { barkVolume name } } + * `); + * const validErrors = validate(schema, validDocument, [ + * OverlappingFieldsCanBeMergedRule, + * ]); + * + * validErrors; // => [] + * ``` + */ +export declare function OverlappingFieldsCanBeMergedRule(context: ValidationContext): ASTVisitor; +/** + * Possible fragment spread + * + * A fragment spread is only valid if the type condition could ever possibly + * be true: if there is a non-empty intersection of the possible parent types, + * and possible types which pass the type condition. + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { PossibleFragmentSpreadsRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * dog: Dog + * } + * + * type Dog { + * barkVolume: Int + * } + * + * type Cat { + * meowVolume: Int + * } + * `); + * + * const invalidDocument = parse(` + * { dog { ... on Cat { meowVolume } } } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * PossibleFragmentSpreadsRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * { dog { ... on Dog { barkVolume } } } + * `); + * const validErrors = validate(schema, validDocument, [ + * PossibleFragmentSpreadsRule, + * ]); + * + * validErrors; // => [] + * ``` + */ +export declare function PossibleFragmentSpreadsRule(context: ValidationContext): ASTVisitor; +/** + * Provided required arguments + * + * A field or directive is only valid if all required (non-null without a + * default value) field arguments have been provided. + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { ProvidedRequiredArgumentsRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * field(required: String!): String + * } + * `); + * + * const invalidDocument = parse(` + * { field } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * ProvidedRequiredArgumentsRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * { field(required: "x") } + * `); + * const validErrors = validate(schema, validDocument, [ + * ProvidedRequiredArgumentsRule, + * ]); + * + * validErrors; // => [] + * ``` + */ +export declare function ProvidedRequiredArgumentsRule(context: ValidationContext): ASTVisitor; +/** + * Scalar leafs + * + * A GraphQL document is valid only if all leaf fields (fields without + * sub selections) are of scalar or enum types. + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { ScalarLeafsRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * name: String + * } + * `); + * + * const invalidDocument = parse(` + * { name { length } } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ScalarLeafsRule]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * { name } + * `); + * const validErrors = validate(schema, validDocument, [ScalarLeafsRule]); + * + * validErrors; // => [] + * ``` + */ +export declare function ScalarLeafsRule(context: ValidationContext): ASTVisitor; +/** + * Subscriptions must only include a non-introspection field. + * + * A GraphQL subscription is valid only if it contains a single root field and + * that root field is not an introspection field. + * + * See https://spec.graphql.org/draft/#sec-Single-root-field + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { SingleFieldSubscriptionsRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * name: String + * } + * + * type Subscription { + * a: String + * b: String + * } + * `); + * + * const invalidDocument = parse(` + * subscription { a b } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * SingleFieldSubscriptionsRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * subscription { a } + * `); + * const validErrors = validate(schema, validDocument, [ + * SingleFieldSubscriptionsRule, + * ]); + * + * validErrors; // => [] + * ``` + */ +export declare function SingleFieldSubscriptionsRule(context: ValidationContext): ASTVisitor; +/** + * Stream directives are used on list fields + * + * A GraphQL document is only valid if stream directives are used on list fields. + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { parse } from 'graphql/language'; + * import { buildSchema } from 'graphql/utilities'; + * import { validate, StreamDirectiveOnListFieldRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * name: String + * friends: [String] + * } + * `); + * const invalidDocument = parse('{ name @stream(initialCount: 0) }'); + * const validDocument = parse('{ friends @stream(initialCount: 0) }'); + * + * validate(schema, invalidDocument, [StreamDirectiveOnListFieldRule]).length; // => 1 + * validate(schema, validDocument, [StreamDirectiveOnListFieldRule]); // => [] + * ``` + */ +export declare function StreamDirectiveOnListFieldRule(context: ValidationContext): ASTVisitor; +/** + * Unique argument names + * + * A GraphQL field or directive is only valid if all supplied arguments are + * uniquely named. + * + * See https://spec.graphql.org/draft/#sec-Argument-Names + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { UniqueArgumentNamesRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * field(arg: String): String + * } + * `); + * + * const invalidDocument = parse(` + * { field(arg: "1", arg: "2") } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * UniqueArgumentNamesRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * { field(arg: "1") } + * `); + * const validErrors = validate(schema, validDocument, [UniqueArgumentNamesRule]); + * + * validErrors; // => [] + * ``` + */ +export declare function UniqueArgumentNamesRule(context: ASTValidationContext): ASTVisitor; +/** + * Unique directive names per location + * + * A GraphQL document is only valid if all non-repeatable directives at + * a given location are uniquely named. + * + * See https://spec.graphql.org/draft/#sec-Directives-Are-Unique-Per-Location + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { UniqueDirectivesPerLocationRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * name: String + * } + * `); + * + * const invalidDocument = parse(` + * { name @include(if: true) @include(if: false) } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * UniqueDirectivesPerLocationRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * { name @include(if: true) } + * `); + * const validErrors = validate(schema, validDocument, [ + * UniqueDirectivesPerLocationRule, + * ]); + * + * validErrors; // => [] + * ``` + */ +export declare function UniqueDirectivesPerLocationRule(context: ValidationContext | SDLValidationContext): ASTVisitor; +/** + * Unique fragment names + * + * A GraphQL document is only valid if all defined fragments have unique names. + * + * See https://spec.graphql.org/draft/#sec-Fragment-Name-Uniqueness + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { UniqueFragmentNamesRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * name: String + * } + * `); + * + * const invalidDocument = parse(` + * fragment A on Query { name } fragment A on Query { name } query { ...A } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * UniqueFragmentNamesRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * fragment A on Query { name } query { ...A } + * `); + * const validErrors = validate(schema, validDocument, [UniqueFragmentNamesRule]); + * + * validErrors; // => [] + * ``` + */ +export declare function UniqueFragmentNamesRule(context: ASTValidationContext): ASTVisitor; +/** + * Unique input field names + * + * A GraphQL input object value is only valid if all supplied fields are + * uniquely named. + * + * See https://spec.graphql.org/draft/#sec-Input-Object-Field-Uniqueness + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { UniqueInputFieldNamesRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * input Filter { + * name: String + * } + * + * type Query { + * search(filter: Filter): String + * } + * `); + * + * const invalidDocument = parse(` + * { search(filter: { name: "a", name: "b" }) } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * UniqueInputFieldNamesRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * { search(filter: { name: "a" }) } + * `); + * const validErrors = validate(schema, validDocument, [ + * UniqueInputFieldNamesRule, + * ]); + * + * validErrors; // => [] + * ``` + */ +export declare function UniqueInputFieldNamesRule(context: ASTValidationContext): ASTVisitor; +/** + * Unique operation names + * + * A GraphQL document is only valid if all defined operations have unique names. + * + * See https://spec.graphql.org/draft/#sec-Operation-Name-Uniqueness + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { UniqueOperationNamesRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * name: String + * } + * `); + * + * const invalidDocument = parse(` + * query Same { name } query Same { name } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * UniqueOperationNamesRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * query One { name } query Two { name } + * `); + * const validErrors = validate(schema, validDocument, [UniqueOperationNamesRule]); + * + * validErrors; // => [] + * ``` + */ +export declare function UniqueOperationNamesRule(context: ASTValidationContext): ASTVisitor; +/** + * Unique variable names + * + * A GraphQL operation is only valid if all its variables are uniquely named. + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { UniqueVariableNamesRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * field(arg: ID): String + * } + * `); + * + * const invalidDocument = parse(` + * query ($id: ID, $id: ID) { field(arg: $id) } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * UniqueVariableNamesRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * query ($id: ID) { field(arg: $id) } + * `); + * const validErrors = validate(schema, validDocument, [UniqueVariableNamesRule]); + * + * validErrors; // => [] + * ``` + */ +export declare function UniqueVariableNamesRule(context: ASTValidationContext): ASTVisitor; +/** + * Value literals of correct type + * + * A GraphQL document is only valid if all value literals are of the type + * expected at their position. + * + * See https://spec.graphql.org/draft/#sec-Values-of-Correct-Type + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { ValuesOfCorrectTypeRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * count(limit: Int): Int + * } + * `); + * + * const invalidDocument = parse(` + * { count(limit: "many") } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * ValuesOfCorrectTypeRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * { count(limit: 1) } + * `); + * const validErrors = validate(schema, validDocument, [ValuesOfCorrectTypeRule]); + * + * validErrors; // => [] + * ``` + */ +export declare function ValuesOfCorrectTypeRule(context: ValidationContext): ASTVisitor; +/** + * Variables are input types + * + * A GraphQL operation is only valid if all the variables it defines are of + * input types (scalar, enum, or input object). + * + * See https://spec.graphql.org/draft/#sec-Variables-Are-Input-Types + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { VariablesAreInputTypesRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * field(arg: ID): String + * } + * + * type User { + * name: String + * } + * `); + * + * const invalidDocument = parse(` + * query ($user: User) { field(arg: "1") } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * VariablesAreInputTypesRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * query ($id: ID) { field(arg: $id) } + * `); + * const validErrors = validate(schema, validDocument, [ + * VariablesAreInputTypesRule, + * ]); + * + * validErrors; // => [] + * ``` + */ +export declare function VariablesAreInputTypesRule(context: ValidationContext): ASTVisitor; +/** + * Variables in allowed position + * + * Variable usages must be compatible with the arguments they are passed to. + * + * See https://spec.graphql.org/draft/#sec-All-Variable-Usages-are-Allowed + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { VariablesInAllowedPositionRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * field(arg: ID!): String + * } + * `); + * + * const invalidDocument = parse(` + * query ($id: String) { field(arg: $id) } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * VariablesInAllowedPositionRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * query ($id: ID!) { field(arg: $id) } + * `); + * const validErrors = validate(schema, validDocument, [ + * VariablesInAllowedPositionRule, + * ]); + * + * validErrors; // => [] + * ``` + */ +export declare function VariablesInAllowedPositionRule(context: ValidationContext): ASTVisitor; +/** + * Implements the max introspection depth validation rule. + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { MaxIntrospectionDepthRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * name: String + * } + * `); + * + * const invalidDocument = parse(` + * { __schema { types { fields { type { fields { type { fields { name } } } } } } } } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * MaxIntrospectionDepthRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * { __schema { queryType { name } } } + * `); + * const validErrors = validate(schema, validDocument, [ + * MaxIntrospectionDepthRule, + * ]); + * + * validErrors; // => [] + * ``` + */ +export declare function MaxIntrospectionDepthRule(context: ASTValidationContext): ASTVisitor; +/** + * Lone Schema definition + * + * A GraphQL document is only valid if it contains only one schema definition. + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema } from 'graphql'; + * import { LoneSchemaDefinitionRule } from 'graphql/validation'; + * + * const invalidSDL = ` + * schema { query: Query } schema { query: Query } type Query { name: String } + * `; + * + * LoneSchemaDefinitionRule.name; // => 'LoneSchemaDefinitionRule' + * buildSchema(invalidSDL); // throws an error + * + * const validSDL = ` + * schema { query: Query } type Query { name: String } + * `; + * + * buildSchema(validSDL); // does not throw + * ``` + */ +export declare function LoneSchemaDefinitionRule(context: SDLValidationContext): ASTVisitor; +/** + * Unique operation types + * + * A GraphQL document is only valid if it has only one type per operation. + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema } from 'graphql'; + * import { UniqueOperationTypesRule } from 'graphql/validation'; + * + * const invalidSDL = ` + * schema { query: Query query: Other } type Query { name: String } type Other { name: String } + * `; + * + * UniqueOperationTypesRule.name; // => 'UniqueOperationTypesRule' + * buildSchema(invalidSDL); // throws an error + * + * const validSDL = ` + * schema { query: Query } type Query { name: String } + * `; + * + * buildSchema(validSDL); // does not throw + * ``` + */ +export declare function UniqueOperationTypesRule(context: SDLValidationContext): ASTVisitor; +/** + * Unique type names + * + * A GraphQL document is only valid if all defined types have unique names. + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema } from 'graphql'; + * import { UniqueTypeNamesRule } from 'graphql/validation'; + * + * const invalidSDL = ` + * type Query { name: String } type Query { other: String } + * `; + * + * UniqueTypeNamesRule.name; // => 'UniqueTypeNamesRule' + * buildSchema(invalidSDL); // throws an error + * + * const validSDL = ` + * type Query { name: String } type Other { name: String } + * `; + * + * buildSchema(validSDL); // does not throw + * ``` + */ +export declare function UniqueTypeNamesRule(context: SDLValidationContext): ASTVisitor; +/** + * Unique enum value names + * + * A GraphQL enum type is only valid if all its values are uniquely named. + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema } from 'graphql'; + * import { UniqueEnumValueNamesRule } from 'graphql/validation'; + * + * const invalidSDL = ` + * enum Status { ACTIVE ACTIVE } type Query { status: Status } + * `; + * + * UniqueEnumValueNamesRule.name; // => 'UniqueEnumValueNamesRule' + * buildSchema(invalidSDL); // throws an error + * + * const validSDL = ` + * enum Status { ACTIVE INACTIVE } type Query { status: Status } + * `; + * + * buildSchema(validSDL); // does not throw + * ``` + */ +export declare function UniqueEnumValueNamesRule(context: SDLValidationContext): ASTVisitor; +/** + * Unique field definition names + * + * A GraphQL complex type is only valid if all its fields are uniquely named. + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema } from 'graphql'; + * import { UniqueFieldDefinitionNamesRule } from 'graphql/validation'; + * + * const invalidSDL = ` + * type Query { name: String name: String } + * `; + * + * UniqueFieldDefinitionNamesRule.name; // => 'UniqueFieldDefinitionNamesRule' + * buildSchema(invalidSDL); // throws an error + * + * const validSDL = ` + * type Query { name: String other: String } + * `; + * + * buildSchema(validSDL); // does not throw + * ``` + */ +export declare function UniqueFieldDefinitionNamesRule(context: SDLValidationContext): ASTVisitor; +/** + * Unique argument definition names + * + * A GraphQL Object or Interface type is only valid if all its fields have uniquely named arguments. + * A GraphQL Directive is only valid if all its arguments are uniquely named. + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema } from 'graphql'; + * import { UniqueArgumentDefinitionNamesRule } from 'graphql/validation'; + * + * const invalidSDL = ` + * type Query { field(arg: String, arg: Int): String } + * `; + * + * UniqueArgumentDefinitionNamesRule.name; // => 'UniqueArgumentDefinitionNamesRule' + * buildSchema(invalidSDL); // throws an error + * + * const validSDL = ` + * type Query { field(arg: String): String } + * `; + * + * buildSchema(validSDL); // does not throw + * ``` + */ +export declare function UniqueArgumentDefinitionNamesRule(context: SDLValidationContext): ASTVisitor; +/** + * Unique directive names + * + * A GraphQL document is only valid if all defined directives have unique names. + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema } from 'graphql'; + * import { UniqueDirectiveNamesRule } from 'graphql/validation'; + * + * const invalidSDL = ` + * directive @tag on FIELD directive @tag on QUERY type Query { name: String } + * `; + * + * UniqueDirectiveNamesRule.name; // => 'UniqueDirectiveNamesRule' + * buildSchema(invalidSDL); // throws an error + * + * const validSDL = ` + * directive @tag on FIELD type Query { name: String } + * `; + * + * buildSchema(validSDL); // does not throw + * ``` + */ +export declare function UniqueDirectiveNamesRule(context: SDLValidationContext): ASTVisitor; +/** + * Possible type extension + * + * A type extension is only valid if the type is defined and has the same kind. + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema } from 'graphql'; + * import { PossibleTypeExtensionsRule } from 'graphql/validation'; + * + * const invalidSDL = ` + * extend type Missing { name: String } type Query { name: String } + * `; + * + * PossibleTypeExtensionsRule.name; // => 'PossibleTypeExtensionsRule' + * buildSchema(invalidSDL); // throws an error + * + * const validSDL = ` + * type Query { name: String } extend type Query { other: String } + * `; + * + * buildSchema(validSDL); // does not throw + * ``` + */ +export declare function PossibleTypeExtensionsRule(context: SDLValidationContext): ASTVisitor; +/** + * No deprecated + * + * A GraphQL document is only valid if all selected fields and all used enum values have not been + * deprecated. + * + * Note: This rule is optional and is not part of the Validation section of the GraphQL + * Specification. The main purpose of this rule is detection of deprecated usages and not + * necessarily to forbid their use when querying a service. + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { + * GraphQLObjectType, + * GraphQLSchema, + * GraphQLString, + * parse, + * validate, + * } from 'graphql'; + * import { NoDeprecatedCustomRule } from 'graphql/validation'; + * + * const schema = new GraphQLSchema({ + * query: new GraphQLObjectType({ + * name: 'Query', + * fields: { + * name: { type: GraphQLString }, + * oldName: { + * type: GraphQLString, + * deprecationReason: 'Use name instead.', + * }, + * }, + * }), + * }); + * + * const invalidDocument = parse(` + * { oldName } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * NoDeprecatedCustomRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * { name } + * `); + * const validErrors = validate(schema, validDocument, [NoDeprecatedCustomRule]); + * + * validErrors; // => [] + * ``` + */ +export declare function NoDeprecatedCustomRule(context: ValidationContext): ASTVisitor; +/** + * Prohibit introspection queries + * + * A GraphQL document is only valid if all fields selected are not fields that + * return an introspection type. + * + * Note: This rule is optional and is not part of the Validation section of the + * GraphQL Specification. This rule effectively disables introspection, which + * does not reflect best practices and should only be done if absolutely necessary. + * @param context - The validation context used while checking the document. + * @returns A visitor that reports validation errors for this rule. + * @example + * ```ts + * import { buildSchema, parse, validate } from 'graphql'; + * import { NoSchemaIntrospectionCustomRule } from 'graphql/validation'; + * + * const schema = buildSchema(` + * type Query { + * name: String + * } + * `); + * + * const invalidDocument = parse(` + * { __schema { queryType { name } } } + * `); + * const invalidErrors = validate(schema, invalidDocument, [ + * NoSchemaIntrospectionCustomRule, + * ]); + * + * invalidErrors.length; // => 1 + * + * const validDocument = parse(` + * { name } + * `); + * const validErrors = validate(schema, validDocument, [ + * NoSchemaIntrospectionCustomRule, + * ]); + * + * validErrors; // => [] + * ``` + */ +export declare function NoSchemaIntrospectionCustomRule(context: ValidationContext): ASTVisitor; +/** + * Produces a GraphQLError representing a syntax error, containing useful + * descriptive information about the syntax error's position in the source. + * @param source - The GraphQL source containing the syntax error. + * @param position - Character offset where the syntax error was encountered. + * @param description - Human-readable description of the syntax error. + * @returns A GraphQLError located at the syntax error position. + * @example + * ```ts + * import { Source } from 'graphql/language'; + * import { syntaxError } from 'graphql/error'; + * + * const error = syntaxError(new Source('query {'), 7, 'Expected Name'); + * + * error.message; // => 'Syntax Error: Expected Name' + * error.locations; // => [{ line: 1, column: 8 }] + * ``` + */ +export declare function syntaxError(source: Source, position: number, description: string): GraphQLError; +/** + * Given an arbitrary value, presumably thrown while attempting to execute a + * GraphQL operation, produce a new GraphQLError aware of the location in the + * document responsible for the original Error. + * @param rawOriginalError - The original error value to wrap. + * @param nodes - The AST nodes associated with the error. + * @param path - The response path associated with the error. + * @returns The GraphQL error. + * @example + * ```ts + * import { parse } from 'graphql/language'; + * import { locatedError } from 'graphql/error'; + * + * const document = parse('{ viewer { name } }'); + * const fieldNode = document.definitions[0].selectionSet.selections[0]; + * const error = locatedError(new Error('Resolver failed'), fieldNode, ['viewer']); + * + * error.message; // => 'Resolver failed' + * error.locations; // => [{ line: 1, column: 3 }] + * error.path; // => ['viewer'] + * ``` + */ +export declare function locatedError(rawOriginalError: unknown, nodes: ASTNode | ReadonlyArray<ASTNode> | undefined | null, path?: Maybe<ReadonlyArray<string | number>>): GraphQLError; +/** Options controlling which fields are included in the introspection query. */ +export interface IntrospectionOptions { + /** + * Whether to include descriptions in the introspection result. + * Default: true + */ + descriptions?: boolean; + /** + * Whether to include `specifiedByURL` in the introspection result. + * Default: false + */ + specifiedByUrl?: boolean; + /** + * Whether to include `isRepeatable` flag on directives. + * Default: false + */ + directiveIsRepeatable?: boolean; + /** + * Whether to include `description` field on schema. + * Default: false + */ + schemaDescription?: boolean; + /** + * Whether target GraphQL server support deprecation of input values. + * Default: false + */ + inputValueDeprecation?: boolean; + /** + * Whether target GraphQL server supports deprecation of directives. + * Default: false + */ + experimentalDirectiveDeprecation?: boolean; + /** + * Whether target GraphQL server supports `@oneOf` input objects. + * Default: false + */ + oneOf?: boolean; + /** + * How deep to recurse into nested types, larger values will result in more + * accurate results, but have a higher load on the server. + * Some servers might restrict the maximum query depth or complexity. + * If that's the case, try decreasing this value. + * + * Default: 9 + */ + typeDepth?: number; +} +/** + * Produce the GraphQL query recommended for a full schema introspection. + * Accepts optional IntrospectionOptions. + * @param options - Optional configuration for this operation. + * @returns The resolved introspection query. + * @example + * ```ts + * // Generate the default introspection query. + * import { getIntrospectionQuery } from 'graphql/utilities'; + * + * const query = getIntrospectionQuery(); + * + * query; // matches /__schema/ + * query; // matches /description/ + * query; // does not match /specifiedByURL/ + * ``` + * @example + * ```ts + * // This variant customizes optional introspection fields and nesting depth. + * import { getIntrospectionQuery } from 'graphql/utilities'; + * + * const query = getIntrospectionQuery({ + * descriptions: false, + * specifiedByUrl: true, + * directiveIsRepeatable: true, + * schemaDescription: true, + * inputValueDeprecation: true, + * experimentalDirectiveDeprecation: true, + * oneOf: true, + * typeDepth: 3, + * }); + * + * query; // does not match /description/ + * query; // matches /specifiedByURL/ + * query; // matches /isRepeatable/ + * query; // matches /includeDeprecated: true/ + * query; // matches /isOneOf/ + * (query.match(/ofType/g)?.length ?? 0) > 0; // => true + * ``` + */ +export declare function getIntrospectionQuery(options?: IntrospectionOptions): string; +/** The result shape returned by a full introspection query. */ +export interface IntrospectionQuery { + /** The schema. */ + readonly __schema: IntrospectionSchema; +} +/** The introspection representation of a GraphQL schema. */ +export interface IntrospectionSchema { + /** Human-readable description for this schema element, if provided. */ + readonly description?: Maybe<string>; + /** The root object type used for query operations. */ + readonly queryType: IntrospectionNamedTypeRef<IntrospectionObjectType>; + /** The root object type used for mutation operations, if supported. */ + readonly mutationType: Maybe<IntrospectionNamedTypeRef<IntrospectionObjectType>>; + /** The root object type used for subscription operations, if supported. */ + readonly subscriptionType: Maybe<IntrospectionNamedTypeRef<IntrospectionObjectType>>; + /** Object types that belong to this union type. */ + readonly types: ReadonlyArray<IntrospectionType>; + /** Directives available in this schema or applied to this AST node. */ + readonly directives: ReadonlyArray<IntrospectionDirective>; +} +/** Any introspection representation of a GraphQL type. */ +export type IntrospectionType = IntrospectionScalarType | IntrospectionObjectType | IntrospectionInterfaceType | IntrospectionUnionType | IntrospectionEnumType | IntrospectionInputObjectType; +/** An introspection type that can appear in output position. */ +export type IntrospectionOutputType = IntrospectionScalarType | IntrospectionObjectType | IntrospectionInterfaceType | IntrospectionUnionType | IntrospectionEnumType; +/** An introspection type that can appear in input position. */ +export type IntrospectionInputType = IntrospectionScalarType | IntrospectionEnumType | IntrospectionInputObjectType; +/** The introspection representation of a scalar type. */ +export interface IntrospectionScalarType { + /** The introspection kind discriminator for this type reference or type. */ + readonly kind: typeof TypeKind.SCALAR; + /** The GraphQL name for this schema element. */ + readonly name: string; + /** Human-readable description for this schema element, if provided. */ + readonly description?: Maybe<string>; + /** URL identifying the behavior specified for this custom scalar. */ + readonly specifiedByURL?: Maybe<string>; +} +/** The introspection representation of an object type. */ +export interface IntrospectionObjectType { + /** The introspection kind discriminator for this type reference or type. */ + readonly kind: typeof TypeKind.OBJECT; + /** The GraphQL name for this schema element. */ + readonly name: string; + /** Human-readable description for this schema element, if provided. */ + readonly description?: Maybe<string>; + /** Fields declared by this object, interface, input object, or literal. */ + readonly fields: ReadonlyArray<IntrospectionField>; + /** Interfaces implemented by this object or interface type. */ + readonly interfaces: ReadonlyArray<IntrospectionNamedTypeRef<IntrospectionInterfaceType>>; +} +/** The introspection representation of an interface type. */ +export interface IntrospectionInterfaceType { + /** The introspection kind discriminator for this type reference or type. */ + readonly kind: typeof TypeKind.INTERFACE; + /** The GraphQL name for this schema element. */ + readonly name: string; + /** Human-readable description for this schema element, if provided. */ + readonly description?: Maybe<string>; + /** Fields declared by this object, interface, input object, or literal. */ + readonly fields: ReadonlyArray<IntrospectionField>; + /** Interfaces implemented by this object or interface type. */ + readonly interfaces: ReadonlyArray<IntrospectionNamedTypeRef<IntrospectionInterfaceType>>; + /** Object types that may be returned for this abstract type. */ + readonly possibleTypes: ReadonlyArray<IntrospectionNamedTypeRef<IntrospectionObjectType>>; +} +/** The introspection representation of a union type. */ +export interface IntrospectionUnionType { + /** The introspection kind discriminator for this type reference or type. */ + readonly kind: typeof TypeKind.UNION; + /** The GraphQL name for this schema element. */ + readonly name: string; + /** Human-readable description for this schema element, if provided. */ + readonly description?: Maybe<string>; + /** Object types that may be returned for this abstract type. */ + readonly possibleTypes: ReadonlyArray<IntrospectionNamedTypeRef<IntrospectionObjectType>>; +} +/** The introspection representation of an enum type. */ +export interface IntrospectionEnumType { + /** The introspection kind discriminator for this type reference or type. */ + readonly kind: typeof TypeKind.ENUM; + /** The GraphQL name for this schema element. */ + readonly name: string; + /** Human-readable description for this schema element, if provided. */ + readonly description?: Maybe<string>; + /** Values declared by this enum type. */ + readonly enumValues: ReadonlyArray<IntrospectionEnumValue>; +} +/** The introspection representation of an input object type. */ +export interface IntrospectionInputObjectType { + /** The introspection kind discriminator for this type reference or type. */ + readonly kind: typeof TypeKind.INPUT_OBJECT; + /** The GraphQL name for this schema element. */ + readonly name: string; + /** Human-readable description for this schema element, if provided. */ + readonly description?: Maybe<string>; + /** Input fields declared by this input object type. */ + readonly inputFields: ReadonlyArray<IntrospectionInputValue>; + /** Whether this input object uses the experimental OneOf input object semantics. */ + readonly isOneOf: boolean; +} +/** + * The introspection representation of a list type reference. + * @typeParam T - The introspection type reference wrapped by this list type reference. + */ +export interface IntrospectionListTypeRef<T extends IntrospectionTypeRef = IntrospectionTypeRef> { + /** The introspection kind discriminator for this type reference or type. */ + readonly kind: typeof TypeKind.LIST; + /** The type wrapped by this list or non-null type. */ + readonly ofType: T; +} +/** + * The introspection representation of a non-null type reference. + * @typeParam T - The introspection type reference wrapped by this non-null type reference. + */ +export interface IntrospectionNonNullTypeRef<T extends IntrospectionTypeRef = IntrospectionTypeRef> { + /** The introspection kind discriminator for this type reference or type. */ + readonly kind: typeof TypeKind.NON_NULL; + /** The type wrapped by this list or non-null type. */ + readonly ofType: T; +} +/** Any introspection representation of a type reference. */ +export type IntrospectionTypeRef = IntrospectionNamedTypeRef | IntrospectionListTypeRef | IntrospectionNonNullTypeRef<IntrospectionNamedTypeRef | IntrospectionListTypeRef>; +/** An introspection type reference that can appear in output position. */ +export type IntrospectionOutputTypeRef = IntrospectionNamedTypeRef<IntrospectionOutputType> | IntrospectionListTypeRef<IntrospectionOutputTypeRef> | IntrospectionNonNullTypeRef<IntrospectionNamedTypeRef<IntrospectionOutputType> | IntrospectionListTypeRef<IntrospectionOutputTypeRef>>; +/** An introspection type reference that can appear in input position. */ +export type IntrospectionInputTypeRef = IntrospectionNamedTypeRef<IntrospectionInputType> | IntrospectionListTypeRef<IntrospectionInputTypeRef> | IntrospectionNonNullTypeRef<IntrospectionNamedTypeRef<IntrospectionInputType> | IntrospectionListTypeRef<IntrospectionInputTypeRef>>; +/** + * The introspection representation of a named type reference. + * @typeParam T - The introspection type represented by this named type reference. + */ +export interface IntrospectionNamedTypeRef<T extends IntrospectionType = IntrospectionType> { + /** The introspection kind discriminator for this type reference or type. */ + readonly kind: T["kind"]; + /** The GraphQL name for this schema element. */ + readonly name: string; +} +/** The introspection representation of a field. */ +export interface IntrospectionField { + /** The GraphQL name for this schema element. */ + readonly name: string; + /** Human-readable description for this schema element, if provided. */ + readonly description?: Maybe<string>; + /** Arguments accepted by this field or directive. */ + readonly args: ReadonlyArray<IntrospectionInputValue>; + /** The GraphQL type reference or runtime type for this element. */ + readonly type: IntrospectionOutputTypeRef; + /** Whether this field, argument, enum value, or input value is deprecated. */ + readonly isDeprecated: boolean; + /** Reason this element is deprecated, if one was provided. */ + readonly deprecationReason: Maybe<string>; +} +/** The introspection representation of an argument or input field. */ +export interface IntrospectionInputValue { + /** The GraphQL name for this schema element. */ + readonly name: string; + /** Human-readable description for this schema element, if provided. */ + readonly description?: Maybe<string>; + /** The GraphQL type reference or runtime type for this element. */ + readonly type: IntrospectionInputTypeRef; + /** Default value used when no explicit value is supplied. */ + readonly defaultValue: Maybe<string>; + /** Whether this field, argument, enum value, or input value is deprecated. */ + readonly isDeprecated?: boolean; + /** Reason this element is deprecated, if one was provided. */ + readonly deprecationReason?: Maybe<string>; +} +/** The introspection representation of an enum value. */ +export interface IntrospectionEnumValue { + /** The GraphQL name for this schema element. */ + readonly name: string; + /** Human-readable description for this schema element, if provided. */ + readonly description?: Maybe<string>; + /** Whether this field, argument, enum value, or input value is deprecated. */ + readonly isDeprecated: boolean; + /** Reason this element is deprecated, if one was provided. */ + readonly deprecationReason: Maybe<string>; +} +/** The introspection representation of a directive. */ +export interface IntrospectionDirective { + /** The GraphQL name for this schema element. */ + readonly name: string; + /** Human-readable description for this schema element, if provided. */ + readonly description?: Maybe<string>; + /** Whether this directive may appear more than once at the same location. */ + readonly isRepeatable?: boolean; + /** Whether this field, argument, enum value, or input value is deprecated. */ + readonly isDeprecated?: boolean; + /** Reason this element is deprecated, if one was provided. */ + readonly deprecationReason?: Maybe<string>; + /** Locations where this directive may be applied. */ + readonly locations: ReadonlyArray<DirectiveLocation>; + /** Arguments accepted by this field or directive. */ + readonly args: ReadonlyArray<IntrospectionInputValue>; +} +/** + * Returns an operation AST given a document AST and optionally an operation + * name. If a name is not provided, an operation is only returned if only one is + * provided in the document. + * @param documentAST - The parsed GraphQL document AST. + * @param operationName - The optional operation name to select. + * @returns The resolved operation ast. + * @example + * ```ts + * import { parse } from 'graphql/language'; + * import { getOperationAST } from 'graphql/utilities'; + * + * const document = parse('query GetName { name }'); + * const operation = getOperationAST(document, 'GetName'); + * + * operation.name.value; // => 'GetName' + * getOperationAST(document, 'Missing'); // => undefined + * ``` + */ +export declare function getOperationAST(documentAST: DocumentNode, operationName?: Maybe<string>): Maybe<OperationDefinitionNode>; +/** + * Build an IntrospectionQuery from a GraphQLSchema + * + * IntrospectionQuery is useful for utilities that care about type and field + * relationships, but do not need to traverse through those relationships. + * + * This is the inverse of buildClientSchema. The primary use case is outside + * of the server context, for instance when doing schema comparisons. + * @param schema - GraphQL schema to use. + * @param options - Optional configuration for this operation. + * @returns Introspection result data for the schema. + * @example + * ```ts + * // Include schema metadata using the default introspection options. + * import { buildSchema, introspectionFromSchema } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * scalar Url @specifiedBy(url: "https://url.spec.whatwg.org/") + * + * type Query { + * homepage: Url + * } + * `); + * + * const introspection = introspectionFromSchema(schema); + * const urlType = introspection.__schema.types.find( + * (type) => type.name === 'Url', + * ); + * + * urlType.specifiedByURL; // => 'https://url.spec.whatwg.org/' + * ``` + * @example + * ```ts + * // This variant disables optional introspection metadata. + * import { buildSchema, introspectionFromSchema } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * scalar Url @specifiedBy(url: "https://url.spec.whatwg.org/") + * + * type Query { + * homepage: Url + * } + * `); + * + * const introspection = introspectionFromSchema(schema, { + * descriptions: false, + * specifiedByUrl: false, + * directiveIsRepeatable: false, + * schemaDescription: false, + * inputValueDeprecation: false, + * experimentalDirectiveDeprecation: false, + * oneOf: false, + * }); + * const urlType = introspection.__schema.types.find( + * (type) => type.name === 'Url', + * ); + * const deprecatedDirective = introspection.__schema.directives.find( + * (directive) => directive.name === 'deprecated', + * ); + * + * urlType.specifiedByURL; // => undefined + * urlType.description; // => undefined + * introspection.__schema.description; // => undefined + * deprecatedDirective.isRepeatable; // => undefined + * ``` + */ +export declare function introspectionFromSchema(schema: GraphQLSchema, options?: IntrospectionOptions): IntrospectionQuery; +/** + * Build a GraphQLSchema for use by client tools. + * + * Given the result of a client running the introspection query, creates and + * returns a GraphQLSchema instance which can be then used with all graphql-js + * tools, but cannot be used to execute a query, as introspection does not + * represent the "resolver", "parse" or "serialize" functions or any other + * server-internal mechanisms. + * + * This function expects a complete introspection result. Don't forget to check + * the "errors" field of a server response before calling this function. + * @param introspection - Introspection result data to build from. + * @param options - Optional configuration for this operation. + * @returns The client schema represented by the introspection result. + * @example + * ```ts + * import { + * buildClientSchema, + * introspectionFromSchema, + * buildSchema, + * } from 'graphql/utilities'; + * + * const schema = buildSchema('type Query { hello: String }'); + * const clientSchema = buildClientSchema(introspectionFromSchema(schema), { + * assumeValid: true, + * }); + * + * clientSchema.getQueryType().name; // => 'Query' + * ``` + */ +export declare function buildClientSchema(introspection: IntrospectionQuery, options?: GraphQLSchemaValidationOptions): GraphQLSchema; +/** Options used when building a schema from SDL or a parsed SDL document. */ +export interface BuildSchemaOptions extends GraphQLSchemaValidationOptions { + /** + * Set to true to assume the SDL is valid. + * + * Default: false + */ + assumeValidSDL?: boolean | undefined; +} +/** + * Builds a GraphQLSchema from a parsed schema definition language document. + * + * If no schema definition is provided, then it will look for types named Query, + * Mutation and Subscription. + * + * The resulting schema has no resolver functions, so execution will use the + * default field resolver. + * @param documentAST - The parsed GraphQL document AST. + * @param options - Optional configuration for this operation. + * @returns The schema built from the provided SDL document. + * @example + * ```ts + * // Build a schema from a valid parsed SDL document. + * import { parse } from 'graphql/language'; + * import { buildASTSchema } from 'graphql/utilities'; + * + * const document = parse('type Query { hello: String }'); + * const schema = buildASTSchema(document); + * + * schema.getQueryType().name; // => 'Query' + * ``` + * @example + * ```ts + * // This variant uses validation options when the SDL references unknown types. + * import { parse } from 'graphql/language'; + * import { buildASTSchema } from 'graphql/utilities'; + * + * const document = parse('type Query { broken: MissingType }'); + * + * buildASTSchema(document); // throws an error + * buildASTSchema(document, { + * assumeValid: true, + * assumeValidSDL: true, + * }); // does not throw + * ``` + */ +export declare function buildASTSchema(documentAST: DocumentNode, options?: BuildSchemaOptions): GraphQLSchema; +/** + * Builds a GraphQLSchema directly from a schema definition language source. + * @param source - The GraphQL source text or source object. + * @param options - Optional configuration for this operation. + * @returns The schema built from the provided SDL document. + * @example + * ```ts + * // Build a schema from SDL source using the default options. + * import { buildSchema } from 'graphql/utilities'; + * + * const schema = buildSchema('type Query { hello: String }'); + * + * schema.getQueryType().name; // => 'Query' + * ``` + * @example + * ```ts + * // This variant enables parser options and omits source locations. + * import { buildSchema } from 'graphql/utilities'; + * + * const schema = buildSchema( + * 'directive @tag on FIELD_DEFINITION\n' + + * 'directive @compose @tag on FIELD_DEFINITION', + * { + * experimentalFragmentArguments: true, + * noLocation: true, + * }, + * ); + * + * const directive = schema.getDirective('compose'); + * + * directive.name; // => 'compose' + * directive.astNode.loc; // => undefined + * ``` + */ +export declare function buildSchema(source: string | Source, options?: BuildSchemaOptions & ParseOptions): GraphQLSchema; +interface Options extends GraphQLSchemaValidationOptions { + /** + * Set to true to assume the SDL is valid. + * + * Default: false + * + * @internal + */ + assumeValidSDL?: boolean | undefined; +} +/** + * Produces a new schema given an existing schema and a document which may + * contain GraphQL type extensions and definitions. The original schema will + * remain unaltered. + * + * Because a schema represents a graph of references, a schema cannot be + * extended without effectively making an entire copy. We do not know until it's + * too late if subgraphs remain unchanged. + * + * This algorithm copies the provided schema, applying extensions while + * producing the copy. The original schema remains unaltered. + * @param schema - GraphQL schema to use. + * @param documentAST - The parsed GraphQL document AST. + * @param options - Optional configuration for this operation. + * @returns A new schema with the extensions and definitions applied. + * @example + * ```ts + * // Extend a schema with new fields and types. + * import { parse } from 'graphql/language'; + * import { buildSchema, extendSchema } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * const extensionAST = parse(` + * extend type Query { + * farewell: String + * } + * + * type Review { + * body: String + * } + * `); + * + * const extendedSchema = extendSchema(schema, extensionAST); + * + * schema.getType('Review'); // => undefined + * extendedSchema.getType('Review')?.name; // => 'Review' + * Object.keys(extendedSchema.getQueryType().getFields()); // => ['greeting', 'farewell'] + * ``` + * @example + * ```ts + * // This variant bypasses validation for an otherwise invalid extension. + * import { parse } from 'graphql/language'; + * import { buildSchema, extendSchema } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * const invalidExtension = parse(` + * extend type Missing { + * field: String + * } + * `); + * + * extendSchema(schema, invalidExtension); // throws an error + * extendSchema(schema, invalidExtension, { + * assumeValid: true, + * assumeValidSDL: true, + * }); // does not throw + * ``` + */ +export declare function extendSchema(schema: GraphQLSchema, documentAST: DocumentNode, options?: Options): GraphQLSchema; +/** + * Sort GraphQLSchema. + * + * This function returns a sorted copy of the given GraphQLSchema. + * @param schema - GraphQL schema to use. + * @returns A copy of the schema with types, fields, arguments, and values sorted lexicographically. + * @example + * ```ts + * import { + * buildSchema, + * lexicographicSortSchema, + * printSchema, + * } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * zebra: String + * apple: String + * } + * + * enum Episode { + * JEDI + * NEW_HOPE + * EMPIRE + * } + * `); + * + * const sortedSchema = lexicographicSortSchema(schema); + * + * printSchema(sortedSchema); + * // => + * // enum Episode { + * // EMPIRE + * // JEDI + * // NEW_HOPE + * // } + * // + * // type Query { + * // apple: String + * // zebra: String + * // } + * ``` + */ +export declare function lexicographicSortSchema(schema: GraphQLSchema): GraphQLSchema; +/** + * Prints the schema. + * @param schema - GraphQL schema to use. + * @returns The printed string representation. + * @example + * ```ts + * import { buildSchema, printSchema } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * directive @upper on FIELD_DEFINITION + * + * type Query { + * greeting: String @upper + * } + * `); + * + * printSchema(schema); // => ['directive @upper on FIELD_DEFINITION', '', 'type Query {', ' greeting: String', '}'].join('\n') + * ``` + */ +export declare function printSchema(schema: GraphQLSchema): string; +/** + * Prints the introspection schema. + * @param schema - GraphQL schema to use. + * @returns The printed string representation. + * @example + * ```ts + * import { buildSchema, printIntrospectionSchema } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * + * const printed = printIntrospectionSchema(schema); + * + * printed; // matches /type __Schema/ + * printed; // matches /enum __TypeKind/ + * printed; // does not match /type Query/ + * ``` + */ +export declare function printIntrospectionSchema(schema: GraphQLSchema): string; +/** + * Prints the type. + * @param type - The GraphQL type to inspect. + * @returns The printed string representation. + * @example + * ```ts + * import { buildSchema, printType } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type User { + * id: ID! + * name: String + * } + * + * type Query { + * viewer: User + * } + * `); + * + * printType(schema.getType('User')); // => ['type User {', ' id: ID!', ' name: String', '}'].join('\n') + * ``` + */ +export declare function printType(type: GraphQLNamedType): string; +/** + * Prints a directive definition in GraphQL SDL. + * @param directive - Directive to print. + * @returns SDL string for the directive definition. + * @example + * ```ts + * import { + * DirectiveLocation, + * GraphQLDirective, + * GraphQLString, + * } from 'graphql/type'; + * import { printDirective } from 'graphql/utilities'; + * + * const authDirective = new GraphQLDirective({ + * name: 'auth', + * description: 'Requires authorization.', + * locations: [DirectiveLocation.FIELD_DEFINITION], + * args: { + * scope: { type: GraphQLString }, + * }, + * }); + * + * printDirective(authDirective); // => '"""Requires authorization."""\ndirective @auth(scope: String) on FIELD_DEFINITION' + * ``` + */ +export declare function printDirective(directive: GraphQLDirective): string; +/** + * Given a Schema and an AST node describing a type, return a GraphQLType + * definition which applies to that type. For example, if provided the parsed + * AST node for `[User]`, a GraphQLList instance will be returned, containing + * the type called "User" found in the schema. If a type called "User" is not + * found in the schema, then undefined will be returned. + * @param schema - GraphQL schema to use. + * @param typeNode - The GraphQL type AST node to resolve. + * @returns The GraphQL type referenced by the AST node, or undefined if it cannot be resolved. + * @example + * ```ts + * import { parseType } from 'graphql/language'; + * import { buildSchema, typeFromAST } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * name: String + * } + * `); + * + * typeFromAST(schema, parseType('String'))?.toString(); // => 'String' + * typeFromAST(schema, parseType('Missing')); // => undefined + * ``` + */ +export declare function typeFromAST(schema: GraphQLSchema, typeNode: NamedTypeNode): GraphQLNamedType | undefined; +/** + * Resolves a list type AST node against a schema. + * @param schema - GraphQL schema to use. + * @param typeNode - The list type AST node to resolve. + * @returns The GraphQL list type referenced by the AST node, or undefined if + * it cannot be resolved. + * @example + * ```ts + * import { parseType } from 'graphql/language'; + * import { buildSchema, typeFromAST } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * tags: [String] + * } + * `); + * + * typeFromAST(schema, parseType('[String]'))?.toString(); // => '[String]' + * typeFromAST(schema, parseType('[Missing]')); // => undefined + * ``` + */ +export declare function typeFromAST(schema: GraphQLSchema, typeNode: ListTypeNode): GraphQLList<any> | undefined; +/** + * Resolves a non-null type AST node against a schema. + * @param schema - GraphQL schema to use. + * @param typeNode - The non-null type AST node to resolve. + * @returns The GraphQL non-null type referenced by the AST node, or undefined + * if it cannot be resolved. + * @example + * ```ts + * import { parseType } from 'graphql/language'; + * import { buildSchema, typeFromAST } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * name: String! + * } + * `); + * + * typeFromAST(schema, parseType('String!'))?.toString(); // => 'String!' + * typeFromAST(schema, parseType('[String!]!'))?.toString(); // => '[String!]!' + * ``` + */ +export declare function typeFromAST(schema: GraphQLSchema, typeNode: NonNullTypeNode): GraphQLNonNull<any> | undefined; +/** + * Resolves a type AST node against a schema. + * @param schema - GraphQL schema to use. + * @param typeNode - The GraphQL type AST node to resolve. + * @returns The GraphQL type referenced by the AST node, or undefined if it + * cannot be resolved. + * @example + * ```ts + * import { parseType } from 'graphql/language'; + * import { buildSchema, typeFromAST } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type User { + * name: String + * } + * + * type Query { + * users: [User!]! + * } + * `); + * + * typeFromAST(schema, parseType('User'))?.toString(); // => 'User' + * typeFromAST(schema, parseType('[User!]!'))?.toString(); // => '[User!]!' + * typeFromAST(schema, parseType('Missing')); // => undefined + * ``` + */ +export declare function typeFromAST(schema: GraphQLSchema, typeNode: TypeNode): GraphQLType | undefined; +/** + * Produces a JavaScript value given a GraphQL Value AST. + * + * A GraphQL type must be provided, which will be used to interpret different + * GraphQL Value literals. + * + * Returns `undefined` when the value could not be validly coerced according to + * the provided type. + * + * This deprecated function will be removed in v18. Use `coerceInputLiteral()` + * instead. + * + * | GraphQL Value | JSON Value | + * | -------------------- | ------------- | + * | Input Object | Object | + * | List | Array | + * | Boolean | Boolean | + * | String | String | + * | Int / Float | Number | + * | Enum Value | Unknown | + * | NullValue | null | + * @param valueNode - GraphQL value AST node to convert. + * @param type - The GraphQL type to inspect. + * @param variables - Optional runtime variable values keyed by variable name. + * @returns The coerced JavaScript value, or undefined if the AST value cannot be coerced to the type. + * @example + * ```ts + * // Coerce literal values without variables. + * import { parseValue } from 'graphql/language'; + * import { + * GraphQLInputObjectType, + * GraphQLInt, + * GraphQLList, + * GraphQLNonNull, + * GraphQLString, + * } from 'graphql/type'; + * import { valueFromAST } from 'graphql/utilities'; + * + * const ReviewInput = new GraphQLInputObjectType({ + * name: 'ReviewInput', + * fields: { + * stars: { type: new GraphQLNonNull(GraphQLInt) }, + * tags: { type: new GraphQLList(GraphQLString) }, + * }, + * }); + * + * valueFromAST(parseValue('{ stars: 5, tags: ["featured"] }'), ReviewInput); // => { stars: 5, tags: ['featured'] } + * valueFromAST(parseValue('{ stars: "bad" }'), ReviewInput); // => undefined + * ``` + * @example + * ```ts + * // This variant resolves variable references from runtime values. + * import { parseValue } from 'graphql/language'; + * import { GraphQLInt } from 'graphql/type'; + * import { valueFromAST } from 'graphql/utilities'; + * + * valueFromAST(parseValue('$stars'), GraphQLInt, { stars: 5 }); // => 5 + * valueFromAST(parseValue('$stars'), GraphQLInt, {}); // => undefined + * ``` + * @deprecated use `coerceInputLiteral()` instead - will be removed in v18 + */ +export declare function valueFromAST(valueNode: Maybe<ValueNode>, type: GraphQLInputType, variables?: Maybe<ObjMap<unknown>>): unknown; +/** + * Produces a JavaScript value given a GraphQL Value AST. + * + * Because no GraphQL type is provided, the returned JavaScript value reflects + * the provided GraphQL value AST. + * + * | GraphQL Value | JavaScript Value | + * | -------------------- | ---------------- | + * | Input Object | Object | + * | List | Array | + * | Boolean | Boolean | + * | String / Enum | String | + * | Int / Float | Number | + * | Null | null | + * @param valueNode - GraphQL value AST node to convert. + * @param variables - Optional runtime variable values keyed by variable name. + * @returns JavaScript value represented by the GraphQL value AST. + * @example + * ```ts + * import { parseValue } from 'graphql/language'; + * import { valueFromASTUntyped } from 'graphql/utilities'; + * + * const value = valueFromASTUntyped(parseValue('[1, 2, 3]')); + * + * value; // => [1, 2, 3] + * valueFromASTUntyped(parseValue('$name'), { name: 'Ada' }); // => 'Ada' + * ``` + */ +export declare function valueFromASTUntyped(valueNode: ValueNode, variables?: Maybe<ObjMap<unknown>>): unknown; +/** + * Produces a GraphQL Value AST given a JavaScript object. + * Function will match JavaScript/JSON values to GraphQL AST schema format + * by using suggested GraphQLInputType. + * + * A GraphQL type must be provided, which will be used to interpret different + * JavaScript values. + * + * This deprecated function will be removed in v18. Use `valueToLiteral()` + * instead, and take care to operate on external values. + * + * | JSON Value | GraphQL Value | + * | ------------- | -------------------- | + * | Object | Input Object | + * | Array | List | + * | Boolean | Boolean | + * | String | String / Enum Value | + * | Number | Int / Float | + * | BigInt | Int | + * | Unknown | Enum Value | + * | null | NullValue | + * @param value - Runtime value to convert. + * @param type - The GraphQL type to inspect. + * @returns A GraphQL value AST for the provided JavaScript value, or null when no literal can represent it. + * @example + * ```ts + * import { print } from 'graphql/language'; + * import { + * GraphQLInputObjectType, + * GraphQLInt, + * GraphQLList, + * GraphQLNonNull, + * GraphQLString, + * } from 'graphql/type'; + * import { astFromValue } from 'graphql/utilities'; + * + * const ReviewInput = new GraphQLInputObjectType({ + * name: 'ReviewInput', + * fields: { + * stars: { type: new GraphQLNonNull(GraphQLInt) }, + * tags: { type: new GraphQLList(GraphQLString) }, + * }, + * }); + * + * const valueNode = astFromValue( + * { stars: 5, tags: ['featured', 'verified'] }, + * ReviewInput, + * ); + * + * print(valueNode); // => '{ stars: 5, tags: ["featured", "verified"] }' + * astFromValue(undefined, GraphQLString); // => null + * astFromValue(null, new GraphQLNonNull(GraphQLString)); // => null + * ``` + * @deprecated use `valueToLiteral()` instead with care to operate on external values - `astFromValue()` will be removed in v18 + */ +export declare function astFromValue(value: unknown, type: GraphQLInputType): Maybe<ConstValueNode>; +/** + * Replaces any Variables found within an AST Value literal with literals + * supplied from a map of variable values, or removed if no variable replacement + * exists, returning a constant value. + * + * Used primarily to ensure only complete constant values are used during input + * coercion of custom scalars which accept complex literals. + * @param valueNode - Value AST node in which variables should be replaced. + * @param variableValues - Operation variable values returned by getVariableValues. + * @param fragmentVariableValues - Fragment variable values for the current fragment scope. + * @returns A constant value AST with variables replaced. + * @example + * ```ts + * import assert from 'node:assert'; + * import { parse, parseValue, print } from 'graphql/language'; + * import { getVariableValues } from 'graphql/execution'; + * import { buildSchema, replaceVariables } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * review(stars: Int = 5): String + * } + * `); + * const document = parse('query ($stars: Int = 5) { review(stars: $stars) }'); + * const operation = document.definitions[0]; + * const result = getVariableValues(schema, operation.variableDefinitions, { + * stars: 4, + * }); + * + * assert('variableValues' in result); + * + * const literal = replaceVariables( + * parseValue('{ stars: $stars, comment: $missing }'), + * result.variableValues, + * ); + * + * print(literal); // => '{ stars: 4 }' + * ``` + */ +export declare function replaceVariables(valueNode: ValueNode, variableValues?: Maybe<VariableValues>, fragmentVariableValues?: Maybe<FragmentVariableValues>): ConstValueNode; +/** + * Produces a GraphQL Value AST given a JavaScript value and a GraphQL type. + * + * Scalar types are converted by calling the `valueToLiteral` method on that + * type, otherwise the default scalar `valueToLiteral` method is used, defined + * below. + * + * Provided value is a non-coerced "input" value. This function does not + * perform any coercion, however it does perform validation. Provided values + * which are invalid for the given type will result in an `undefined` return + * value. + * @param value - JavaScript value to convert. + * @param type - GraphQL input type to convert the value against. + * @returns A GraphQL value AST, or undefined if the value is invalid. + * @example + * ```ts + * import { print } from 'graphql/language'; + * import { + * GraphQLInputObjectType, + * GraphQLInt, + * GraphQLList, + * GraphQLNonNull, + * GraphQLString, + * } from 'graphql/type'; + * import { valueToLiteral } from 'graphql/utilities'; + * + * const ReviewInput = new GraphQLInputObjectType({ + * name: 'ReviewInput', + * fields: { + * stars: { type: new GraphQLNonNull(GraphQLInt) }, + * tags: { type: new GraphQLList(GraphQLString) }, + * }, + * }); + * + * const literal = valueToLiteral({ stars: 5, tags: ['featured'] }, ReviewInput); + * + * print(literal); // => '{ stars: 5, tags: ["featured"] }' + * valueToLiteral({ tags: ['missing stars'] }, ReviewInput); // => undefined + * ``` + */ +export declare function valueToLiteral(value: unknown, type: GraphQLInputType): ConstValueNode | undefined; +/** + * Coerces a JavaScript value given a GraphQL Input Type. + * + * Returns `undefined` when the value could not be validly coerced according to + * the provided type. Use `validateInputValue` when coercion diagnostics + * are needed. + * @param inputValue - JavaScript value to coerce. + * @param type - GraphQL input type to coerce the value against. + * @returns Coerced value, or undefined if coercion fails. + * @example + * ```ts + * // Coerce runtime input values, returning undefined when coercion fails. + * import { + * GraphQLInputObjectType, + * GraphQLInt, + * GraphQLList, + * GraphQLNonNull, + * GraphQLString, + * } from 'graphql/type'; + * import { coerceInputValue } from 'graphql/utilities'; + * + * const ReviewInput = new GraphQLInputObjectType({ + * name: 'ReviewInput', + * fields: { + * stars: { type: new GraphQLNonNull(GraphQLInt) }, + * tags: { type: new GraphQLList(GraphQLString) }, + * }, + * }); + * + * coerceInputValue({ stars: '5', tags: ['featured'] }, ReviewInput); // => { stars: 5, tags: ['featured'] } + * coerceInputValue({ stars: 'bad' }, ReviewInput); // => undefined + * ``` + */ +export declare function coerceInputValue(inputValue: unknown, type: GraphQLInputType): unknown; +/** + * Produces a coerced "internal" JavaScript value given a GraphQL Value AST. + * + * Returns `undefined` when the value could not be validly coerced according to + * the provided type. + * @param valueNode - GraphQL value AST node to coerce. + * @param type - GraphQL input type to coerce the literal against. + * @param variableValues - Operation variable values returned by getVariableValues. + * @param fragmentVariableValues - Fragment variable values for the current fragment scope. + * @returns Coerced value, or undefined if coercion fails. + * @example + * ```ts + * // Coerce literal input values without variables. + * import { parseValue } from 'graphql/language'; + * import { + * GraphQLInputObjectType, + * GraphQLInt, + * GraphQLNonNull, + * GraphQLString, + * } from 'graphql/type'; + * import { coerceInputLiteral } from 'graphql/utilities'; + * + * const ReviewInput = new GraphQLInputObjectType({ + * name: 'ReviewInput', + * fields: { + * stars: { type: new GraphQLNonNull(GraphQLInt) }, + * comment: { type: GraphQLString }, + * }, + * }); + * + * coerceInputLiteral( + * parseValue('{ stars: 5, comment: "Loved it" }'), + * ReviewInput, + * ); // => { stars: 5, comment: 'Loved it' } + * coerceInputLiteral(parseValue('{ comment: "Missing" }'), ReviewInput); // => undefined + * ``` + * @example + * ```ts + * // This variant resolves variable references using VariableValues from getVariableValues(). + * import assert from 'node:assert'; + * import { parse, parseValue } from 'graphql/language'; + * import { GraphQLInt } from 'graphql/type'; + * import { getVariableValues } from 'graphql/execution'; + * import { buildSchema, coerceInputLiteral } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * review(stars: Int): String + * } + * `); + * const document = parse('query ($stars: Int = 5) { review(stars: $stars) }'); + * const operation = document.definitions[0]; + * const result = getVariableValues(schema, operation.variableDefinitions, { + * stars: '4', + * }); + * + * assert('variableValues' in result); + * + * coerceInputLiteral(parseValue('$stars'), GraphQLInt, result.variableValues); // => 4 + * ``` + */ +export declare function coerceInputLiteral(valueNode: ValueNode, type: GraphQLInputType, variableValues?: Maybe<VariableValues>, fragmentVariableValues?: Maybe<FragmentVariableValues>): unknown; +/** + * Validate that the provided input value is allowed for this type, collecting + * all errors via a callback function. + * @param inputValue - JavaScript value to validate. + * @param type - GraphQL input type to validate the value against. + * @param onError - Callback invoked for each validation error and path. + * @param hideSuggestions - Whether suggestion text should be omitted from errors. + * @returns Nothing. + * @example + * ```ts + * // Collect validation errors with their input paths. + * import { + * GraphQLInputObjectType, + * GraphQLInt, + * GraphQLNonNull, + * } from 'graphql/type'; + * import { validateInputValue } from 'graphql/utilities'; + * + * const ReviewInput = new GraphQLInputObjectType({ + * name: 'ReviewInput', + * fields: { + * stars: { type: new GraphQLNonNull(GraphQLInt) }, + * }, + * }); + * const errors = []; + * + * validateInputValue({ stars: 'bad' }, ReviewInput, (error, path) => { + * errors.push({ message: error.message, path }); + * }); + * + * errors; // => [ { message: 'Expected value of type "Int", found: "bad".', path: ['stars'] } ] + * ``` + * @example + * ```ts + * // This variant hides suggestion text for unknown input fields. + * import { GraphQLInputObjectType, GraphQLString } from 'graphql/type'; + * import { validateInputValue } from 'graphql/utilities'; + * + * const ReviewInput = new GraphQLInputObjectType({ + * name: 'ReviewInput', + * fields: { + * comment: { type: GraphQLString }, + * }, + * }); + * const errors = []; + * + * validateInputValue( + * { rating: 'extra field' }, + * ReviewInput, + * (error) => { + * errors.push(error.message); + * }, + * true, + * ); + * + * errors; // => ['Expected value of type "ReviewInput" not to include unknown field "rating", found: { rating: "extra field" }.'] + * ``` + */ +export declare function validateInputValue(inputValue: unknown, type: GraphQLInputType, onError: (error: GraphQLError, path: ReadonlyArray<string | number>) => void, hideSuggestions?: Maybe<boolean>): void; +/** + * Validate that the provided input literal is allowed for this type, collecting + * all errors via a callback function. + * + * If variable values are not provided, the literal is validated statically + * (not assuming that those variables are missing runtime values). + * @param valueNode - GraphQL value AST node to validate. + * @param type - GraphQL input type to validate the literal against. + * @param onError - Callback invoked for each validation error and path. + * @param variables - Operation variable values returned by getVariableValues. + * @param fragmentVariableValues - Fragment variable values for the current fragment scope. + * @param hideSuggestions - Whether suggestion text should be omitted from errors. + * @returns Nothing. + * @example + * ```ts + * // Validate literal input values and collect literal paths. + * import { parseValue } from 'graphql/language'; + * import { + * GraphQLInputObjectType, + * GraphQLInt, + * GraphQLNonNull, + * } from 'graphql/type'; + * import { validateInputLiteral } from 'graphql/utilities'; + * + * const ReviewInput = new GraphQLInputObjectType({ + * name: 'ReviewInput', + * fields: { + * stars: { type: new GraphQLNonNull(GraphQLInt) }, + * }, + * }); + * const errors = []; + * + * validateInputLiteral( + * parseValue('{ stars: "bad" }'), + * ReviewInput, + * (error, path) => { + * errors.push({ message: error.message, path }); + * }, + * ); + * + * errors; // => [ { message: 'Expected value of type "Int", found: "bad".', path: ['stars'] } ] + * ``` + * @example + * ```ts + * // This variant resolves variable references using VariableValues from getVariableValues(). + * import assert from 'node:assert'; + * import { parse, parseValue } from 'graphql/language'; + * import { GraphQLInt } from 'graphql/type'; + * import { getVariableValues } from 'graphql/execution'; + * import { buildSchema, validateInputLiteral } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * review(stars: Int): String + * } + * `); + * const document = parse('query ($stars: Int = 5) { review(stars: $stars) }'); + * const operation = document.definitions[0]; + * const result = getVariableValues(schema, operation.variableDefinitions, { + * stars: '4', + * }); + * + * assert('variableValues' in result); + * + * const errors = []; + * validateInputLiteral( + * parseValue('$stars'), + * GraphQLInt, + * (error) => errors.push(error.message), + * result.variableValues, + * undefined, + * true, + * ); + * + * errors; // => [] + * ``` + */ +export declare function validateInputLiteral(valueNode: ValueNode, type: GraphQLInputType, onError: (error: GraphQLError, path: ReadonlyArray<string | number>) => void, variables?: Maybe<VariableValues>, fragmentVariableValues?: Maybe<FragmentVariableValues>, hideSuggestions?: Maybe<boolean>): void; +/** + * Provided a collection of ASTs, presumably each from different files, + * concatenate the ASTs together into batched AST, useful for validating many + * GraphQL source files which together represent one conceptual application. + * @param documents - Document ASTs to concatenate. + * @returns A document AST containing all definitions from the provided documents. + * @example + * ```ts + * import { parse } from 'graphql/language'; + * import { concatAST } from 'graphql/utilities'; + * + * const document = concatAST([ + * parse('type Query { a: String }'), + * parse('type User { id: ID }'), + * ]); + * + * document.definitions.length; // => 2 + * ``` + */ +export declare function concatAST(documents: ReadonlyArray<DocumentNode>): DocumentNode; +/** + * separateOperations accepts a single AST document which may contain many + * operations and fragments and returns a collection of AST documents each of + * which contains a single operation as well the fragment definitions it + * refers to. + * @param documentAST - The parsed GraphQL document AST. + * @returns A map of operation names to documents containing each operation and its referenced fragments. + * @example + * ```ts + * import { parse, print } from 'graphql/language'; + * import { separateOperations } from 'graphql/utilities'; + * + * const document = parse(` + * query GetUser { + * viewer { + * ...UserFields + * } + * } + * + * query GetStatus { + * status + * } + * + * fragment UserFields on User { + * id + * } + * `); + * + * const separated = separateOperations(document); + * + * Object.keys(separated); // => ['GetUser', 'GetStatus'] + * print(separated.GetUser); // matches /fragment UserFields/ + * print(separated.GetStatus); // does not match /fragment UserFields/ + * ``` + */ +export declare function separateOperations(documentAST: DocumentNode): ObjMap<DocumentNode>; +/** + * Strips characters that are not significant to the validity or execution + * of a GraphQL document: + * - UnicodeBOM + * - WhiteSpace + * - LineTerminator + * - Comment + * - Comma + * - BlockString indentation + * + * Note: It is required to have a delimiter character between neighboring + * non-punctuator tokens and this function always uses single space as delimiter. + * + * It is guaranteed that both input and output documents if parsed would result + * in the exact same AST except for nodes location. + * + * Warning: It is guaranteed that this function will always produce stable results. + * However, it's not guaranteed that it will stay the same between different + * releases due to bugfixes or changes in the GraphQL specification. + * @param source - The GraphQL source text or source object. + * @returns A semantically equivalent GraphQL source string without ignored characters. + * @example Query source + * ```graphql + * query SomeQuery($foo: String!, $bar: String) { + * someField(foo: $foo, bar: $bar) { + * a + * b { + * c + * d + * } + * } + * } + * ``` + * + * Becomes: + * + * ```graphql prettier-ignore + * query SomeQuery($foo:String!$bar:String){someField(foo:$foo bar:$bar){a b{c d}}} + * ``` + * @example SDL source + * ```graphql + * """ + * Type description + * """ + * type Foo { + * """ + * Field description + * """ + * bar: String + * } + * ``` + * + * Becomes: + * + * ```graphql prettier-ignore + * """Type description""" type Foo{"""Field description""" bar:String} + * ``` + * @example + * ```ts + * import { stripIgnoredCharacters } from 'graphql/utilities'; + * + * const source = stripIgnoredCharacters('query Example { name }'); + * + * source; // => 'query Example{name}' + * ``` + */ +export declare function stripIgnoredCharacters(source: string | Source): string; +/** + * Provided two types, return true if the types are equal (invariant). + * @param typeA - The first GraphQL type to compare. + * @param typeB - The second GraphQL type to compare. + * @returns True when both types are equal. + * @example + * ```ts + * import { GraphQLList, GraphQLNonNull, GraphQLString } from 'graphql/type'; + * import { isEqualType } from 'graphql/utilities'; + * + * isEqualType(GraphQLString, GraphQLString); // => true + * isEqualType(new GraphQLList(GraphQLString), new GraphQLList(GraphQLString)); // => true + * isEqualType(new GraphQLNonNull(GraphQLString), GraphQLString); // => false + * ``` + */ +export declare function isEqualType(typeA: GraphQLType, typeB: GraphQLType): boolean; +/** + * Provided a type and a super type, return true if the first type is either + * equal or a subset of the second super type (covariant). + * @param schema - GraphQL schema to use. + * @param maybeSubType - The possible subtype to compare. + * @param superType - The possible supertype to compare. + * @returns True when `maybeSubType` is equal to or a subtype of `superType`. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { + * GraphQLNonNull, + * assertInterfaceType, + * assertObjectType, + * } from 'graphql/type'; + * import { isTypeSubTypeOf } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * interface Node { + * id: ID! + * } + * + * type User implements Node { + * id: ID! + * } + * + * type Query { + * node: Node + * } + * `); + * const Node = assertInterfaceType(schema.getType('Node')); + * const User = assertObjectType(schema.getType('User')); + * + * isTypeSubTypeOf(schema, User, Node); // => true + * isTypeSubTypeOf(schema, new GraphQLNonNull(User), Node); // => true + * isTypeSubTypeOf(schema, Node, User); // => false + * ``` + */ +export declare function isTypeSubTypeOf(schema: GraphQLSchema, maybeSubType: GraphQLType, superType: GraphQLType): boolean; +/** + * Provided two composite types, determine if they "overlap". Two composite + * types overlap when the Sets of possible concrete types for each intersect. + * + * This is often used to determine if a fragment of a given type could possibly + * be visited in a context of another type. + * + * This function is commutative. + * @param schema - GraphQL schema to use. + * @param typeA - The first GraphQL type to compare. + * @param typeB - The second GraphQL type to compare. + * @returns True when the two composite types can apply to at least one common object type. + * @example + * ```ts + * import { buildSchema } from 'graphql/utilities'; + * import { assertObjectType, assertUnionType } from 'graphql/type'; + * import { doTypesOverlap } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Photo { + * url: String! + * } + * + * type Video { + * url: String! + * } + * + * union Media = Photo | Video + * union StillImage = Photo + * + * type Query { + * media: [Media] + * } + * `); + * const Media = assertUnionType(schema.getType('Media')); + * const StillImage = assertUnionType(schema.getType('StillImage')); + * const Video = assertObjectType(schema.getType('Video')); + * + * doTypesOverlap(schema, Media, StillImage); // => true + * doTypesOverlap(schema, StillImage, Video); // => false + * ``` + */ +export declare function doTypesOverlap(schema: GraphQLSchema, typeA: GraphQLCompositeType, typeB: GraphQLCompositeType): boolean; +/** Categories of schema changes that may break existing operations. */ +export declare const BreakingChangeType: { + readonly TYPE_REMOVED: "TYPE_REMOVED"; + readonly TYPE_CHANGED_KIND: "TYPE_CHANGED_KIND"; + readonly TYPE_REMOVED_FROM_UNION: "TYPE_REMOVED_FROM_UNION"; + readonly VALUE_REMOVED_FROM_ENUM: "VALUE_REMOVED_FROM_ENUM"; + readonly REQUIRED_INPUT_FIELD_ADDED: "REQUIRED_INPUT_FIELD_ADDED"; + readonly IMPLEMENTED_INTERFACE_REMOVED: "IMPLEMENTED_INTERFACE_REMOVED"; + readonly FIELD_REMOVED: "FIELD_REMOVED"; + readonly FIELD_CHANGED_KIND: "FIELD_CHANGED_KIND"; + readonly REQUIRED_ARG_ADDED: "REQUIRED_ARG_ADDED"; + readonly ARG_REMOVED: "ARG_REMOVED"; + readonly ARG_CHANGED_KIND: "ARG_CHANGED_KIND"; + readonly DIRECTIVE_REMOVED: "DIRECTIVE_REMOVED"; + readonly DIRECTIVE_ARG_REMOVED: "DIRECTIVE_ARG_REMOVED"; + readonly REQUIRED_DIRECTIVE_ARG_ADDED: "REQUIRED_DIRECTIVE_ARG_ADDED"; + readonly DIRECTIVE_REPEATABLE_REMOVED: "DIRECTIVE_REPEATABLE_REMOVED"; + readonly DIRECTIVE_LOCATION_REMOVED: "DIRECTIVE_LOCATION_REMOVED"; +}; +/** Categories of schema changes that may break existing operations. */ +export type BreakingChangeType = (typeof BreakingChangeType)[keyof typeof BreakingChangeType]; +/** Categories of schema changes that may be dangerous for existing operations. */ +export declare const DangerousChangeType: { + readonly VALUE_ADDED_TO_ENUM: "VALUE_ADDED_TO_ENUM"; + readonly TYPE_ADDED_TO_UNION: "TYPE_ADDED_TO_UNION"; + readonly OPTIONAL_INPUT_FIELD_ADDED: "OPTIONAL_INPUT_FIELD_ADDED"; + readonly OPTIONAL_ARG_ADDED: "OPTIONAL_ARG_ADDED"; + readonly IMPLEMENTED_INTERFACE_ADDED: "IMPLEMENTED_INTERFACE_ADDED"; + readonly ARG_DEFAULT_VALUE_CHANGE: "ARG_DEFAULT_VALUE_CHANGE"; + readonly INPUT_FIELD_DEFAULT_VALUE_CHANGE: "INPUT_FIELD_DEFAULT_VALUE_CHANGE"; +}; +/** Categories of schema changes that may be dangerous for existing operations. */ +export type DangerousChangeType = (typeof DangerousChangeType)[keyof typeof DangerousChangeType]; +/** Categories of schema changes that are considered safe for existing operations. */ +export declare const SafeChangeType: { + readonly DESCRIPTION_CHANGED: "DESCRIPTION_CHANGED"; + readonly TYPE_ADDED: "TYPE_ADDED"; + readonly OPTIONAL_INPUT_FIELD_ADDED: "OPTIONAL_INPUT_FIELD_ADDED"; + readonly OPTIONAL_ARG_ADDED: "OPTIONAL_ARG_ADDED"; + readonly DIRECTIVE_ADDED: "DIRECTIVE_ADDED"; + readonly FIELD_ADDED: "FIELD_ADDED"; + readonly DIRECTIVE_REPEATABLE_ADDED: "DIRECTIVE_REPEATABLE_ADDED"; + readonly DIRECTIVE_LOCATION_ADDED: "DIRECTIVE_LOCATION_ADDED"; + readonly OPTIONAL_DIRECTIVE_ARG_ADDED: "OPTIONAL_DIRECTIVE_ARG_ADDED"; + readonly FIELD_CHANGED_KIND_SAFE: "FIELD_CHANGED_KIND_SAFE"; + readonly ARG_CHANGED_KIND_SAFE: "ARG_CHANGED_KIND_SAFE"; + readonly ARG_DEFAULT_VALUE_ADDED: "ARG_DEFAULT_VALUE_ADDED"; + readonly INPUT_FIELD_DEFAULT_VALUE_ADDED: "INPUT_FIELD_DEFAULT_VALUE_ADDED"; +}; +/** Categories of schema changes that are considered safe for existing operations. */ +export type SafeChangeType = (typeof SafeChangeType)[keyof typeof SafeChangeType]; +/** Description of a schema change that may break existing operations. */ +export interface BreakingChange { + /** Specific kind of breaking schema change. */ + type: BreakingChangeType; + /** Human-readable description of the breaking schema change. */ + description: string; +} +/** Description of a schema change that may be dangerous for existing operations. */ +export interface DangerousChange { + /** Specific kind of dangerous schema change. */ + type: DangerousChangeType; + /** Human-readable description of the dangerous schema change. */ + description: string; +} +/** Description of a schema change that is considered safe for existing operations. */ +export interface SafeChange { + /** Specific kind of safe schema change. */ + type: SafeChangeType; + /** Human-readable description of the safe schema change. */ + description: string; +} +/** Any schema change detected between two schemas. */ +export type SchemaChange = SafeChange | DangerousChange | BreakingChange; +/** + * Given two schemas, returns an Array containing descriptions of all the types + * of breaking changes covered by the other functions down below. This + * deprecated wrapper will be removed in v18; use `findSchemaChanges()` instead + * and filter for breaking changes. + * @param oldSchema - Schema before the change. + * @param newSchema - Schema after the change. + * @returns Breaking changes between the two schemas. + * @example + * ```ts + * import { buildSchema, findBreakingChanges } from 'graphql/utilities'; + * + * const oldSchema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * const newSchema = buildSchema(` + * type Query { + * hello: String + * } + * `); + * + * const changes = findBreakingChanges(oldSchema, newSchema); + * + * changes.map((change) => change.type); // => ['FIELD_REMOVED'] + * ``` + * @deprecated Please use `findSchemaChanges` instead. Will be removed in v18. + */ +export declare function findBreakingChanges(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Array<BreakingChange>; +/** + * Given two schemas, returns an Array containing descriptions of all the types + * of potentially dangerous changes covered by the other functions down below. + * This deprecated wrapper will be removed in v18; use `findSchemaChanges()` + * instead and filter for dangerous changes. + * @param oldSchema - Schema before the change. + * @param newSchema - Schema after the change. + * @returns Dangerous changes between the two schemas. + * @example + * ```ts + * import { buildSchema, findDangerousChanges } from 'graphql/utilities'; + * + * const oldSchema = buildSchema(` + * enum Episode { + * NEW_HOPE + * } + * + * type Query { + * episode: Episode + * } + * `); + * const newSchema = buildSchema(` + * enum Episode { + * NEW_HOPE + * EMPIRE + * } + * + * type Query { + * episode: Episode + * } + * `); + * + * const changes = findDangerousChanges(oldSchema, newSchema); + * + * changes.map((change) => change.type); // => ['VALUE_ADDED_TO_ENUM'] + * ``` + * @deprecated Please use `findSchemaChanges` instead. Will be removed in v18. + */ +export declare function findDangerousChanges(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Array<DangerousChange>; +/** + * Finds all schema changes between two schemas. + * @param oldSchema - Schema before the change. + * @param newSchema - Schema after the change. + * @returns Safe, dangerous, and breaking changes between the two schemas. + * @example + * ```ts + * import { buildSchema, findSchemaChanges } from 'graphql/utilities'; + * + * const oldSchema = buildSchema(` + * type Query { + * greeting: String + * } + * `); + * const newSchema = buildSchema(` + * type Query { + * greeting(name: String): String + * farewell: String + * } + * `); + * + * const changes = findSchemaChanges(oldSchema, newSchema); + * + * changes.map((change) => change.type); // => ['OPTIONAL_ARG_ADDED', 'FIELD_ADDED'] + * ``` + */ +export declare function findSchemaChanges(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Array<SchemaChange>; +/** + * Wrapper type that contains DocumentNode and types that can be deduced from it. + * @typeParam TResponseData - Typed GraphQL response data shape. + * @typeParam TRequestVariables - Typed GraphQL request variables shape. + */ +export interface TypedQueryDocumentNode<TResponseData = { + [key: string]: any; +}, TRequestVariables = { + [key: string]: any; +}> extends DocumentNode { + /** Top-level executable and type-system definitions in this document. */ + readonly definitions: ReadonlyArray<ExecutableDefinitionNode>; + /** + * This type is used to ensure that the variables you pass in to the query are assignable to Variables + * and that the Result is assignable to whatever you pass your result to. The method is never actually + * implemented, but the type is valid because we list it as optional + */ + __ensureTypesOfVariablesAndResultMatching?: (variables: TRequestVariables) => TResponseData; +} +interface ResolvedNamedType { + readonly kind: "NamedType"; + readonly type: GraphQLNamedType; +} +interface ResolvedField { + readonly kind: "Field"; + readonly type: GraphQLObjectType | GraphQLInterfaceType; + readonly field: GraphQLField<unknown, unknown>; +} +interface ResolvedInputField { + readonly kind: "InputField"; + readonly type: GraphQLInputObjectType; + readonly inputField: GraphQLInputField; +} +interface ResolvedEnumValue { + readonly kind: "EnumValue"; + readonly type: GraphQLEnumType; + readonly enumValue: GraphQLEnumValue; +} +interface ResolvedFieldArgument { + readonly kind: "FieldArgument"; + readonly type: GraphQLObjectType | GraphQLInterfaceType; + readonly field: GraphQLField<unknown, unknown>; + readonly fieldArgument: GraphQLArgument; +} +interface ResolvedDirective { + readonly kind: "Directive"; + readonly directive: GraphQLDirective; +} +interface ResolvedDirectiveArgument { + readonly kind: "DirectiveArgument"; + readonly directive: GraphQLDirective; + readonly directiveArgument: GraphQLArgument; +} +/** A schema element resolved from a schema coordinate. */ +export type ResolvedSchemaElement = ResolvedNamedType | ResolvedField | ResolvedInputField | ResolvedEnumValue | ResolvedFieldArgument | ResolvedDirective | ResolvedDirectiveArgument; +/** + * A schema coordinate is resolved in the context of a GraphQL schema to + * uniquely identify a schema element. It returns undefined if the schema + * coordinate does not resolve to a schema element, meta-field, or introspection + * schema element. It will throw if the containing schema element (if + * applicable) does not exist. + * + * https://spec.graphql.org/draft/#sec-Schema-Coordinates.Semantics + * @param schema - GraphQL schema to use. + * @param schemaCoordinate - The schema coordinate to resolve. + * @returns The schema element identified by the coordinate, or undefined if none exists. + * @example + * ```ts + * import { buildSchema, resolveSchemaCoordinate } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * directive @tag(name: String!) on FIELD_DEFINITION + * + * input ReviewInput { + * stars: Int! + * } + * + * enum Episode { + * NEW_HOPE + * } + * + * type Query { + * reviews(input: ReviewInput): [String] @tag(name: "reviews") + * } + * `); + * + * resolveSchemaCoordinate(schema, 'Query').kind; // => 'NamedType' + * resolveSchemaCoordinate(schema, 'Query.reviews').kind; // => 'Field' + * resolveSchemaCoordinate(schema, 'Query.reviews(input:)').kind; // => 'FieldArgument' + * resolveSchemaCoordinate(schema, 'ReviewInput.stars').kind; // => 'InputField' + * resolveSchemaCoordinate(schema, 'Episode.NEW_HOPE').kind; // => 'EnumValue' + * resolveSchemaCoordinate(schema, '@tag').kind; // => 'Directive' + * resolveSchemaCoordinate(schema, '@tag(name:)').kind; // => 'DirectiveArgument' + * resolveSchemaCoordinate(schema, 'Query.missing'); // => undefined + * ``` + */ +export declare function resolveSchemaCoordinate(schema: GraphQLSchema, schemaCoordinate: string | Source): ResolvedSchemaElement | undefined; +/** + * Resolves schema coordinate from a parsed SchemaCoordinate node. + * @param schema - GraphQL schema to use. + * @param schemaCoordinate - The schema coordinate to resolve. + * @returns The schema element identified by the parsed coordinate, or undefined if none exists. + * @example + * ```ts + * import { parseSchemaCoordinate } from 'graphql/language'; + * import { buildSchema, resolveASTSchemaCoordinate } from 'graphql/utilities'; + * + * const schema = buildSchema(` + * type Query { + * greeting(name: String): String + * } + * `); + * const coordinate = parseSchemaCoordinate('Query.greeting(name:)'); + * const resolved = resolveASTSchemaCoordinate(schema, coordinate); + * + * resolved.kind; // => 'FieldArgument' + * resolved.field.name; // => 'greeting' + * resolved.fieldArgument.name; // => 'name' + * ``` + */ +export declare function resolveASTSchemaCoordinate(schema: GraphQLSchema, schemaCoordinate: SchemaCoordinateNode): ResolvedSchemaElement | undefined; +type ExtensionsObject = Record<string | symbol, any>; +type ObjectTypeExtensions = { + type: "object"; + fields: Record<string, { + extensions: ExtensionsObject; + arguments: Record<string, ExtensionsObject>; + }>; +}; +type InputTypeExtensions = { + type: "input"; + fields: Record<string, { + extensions: ExtensionsObject; + }>; +}; +type InterfaceTypeExtensions = { + type: "interface"; + fields: Record<string, { + extensions: ExtensionsObject; + arguments: Record<string, ExtensionsObject>; + }>; +}; +type UnionTypeExtensions = { + type: "union"; +}; +type ScalarTypeExtensions = { + type: "scalar"; +}; +type EnumTypeExtensions = { + type: "enum"; + values: Record<string, ExtensionsObject>; +}; +type PossibleTypeExtensions = InputTypeExtensions | InterfaceTypeExtensions | ObjectTypeExtensions | UnionTypeExtensions | ScalarTypeExtensions | EnumTypeExtensions; +type SchemaExtensions = { + schemaExtensions: ExtensionsObject; + types: Record<string, { + extensions: ExtensionsObject; + } & PossibleTypeExtensions>; +}; +interface GraphQLResolveInfo$1 extends GraphQLResolveInfo { + signal?: AbortSignal; + /** Returns the AbortSignal supplied for this execution, if any. */ + readonly getAbortSignal: () => AbortSignal | undefined; + /** Returns helper functions for tracking asynchronous resolver work. */ + readonly getAsyncHelpers: () => GraphQLResolveInfoHelpers$1; +} +interface GraphQLResolveInfoHelpers$1 { + /** + * Promise.all wrapper that allows rejected branches to be tracked + * as execution async work. + * + * Intended use: return or await this promise from resolver work. + * Un-awaited async side effects are an anti-pattern: + * + * const { promiseAll } = info.getAsyncHelpers(); + * promiseAll([someAsyncWork(), someOtherAsyncWork()]).catch(() => undefined); + * + * In that anti-pattern, tracking starts only after rejection (on a + * later microtask), so this work is not guaranteed to delay + * `hooks.asyncWorkFinished`. + * + * Use `track(...)` for un-awaited async side effects: + * + * const { track } = info.getAsyncHelpers(); + * track([ + * someAsyncWork().catch(() => undefined), + * someOtherAsyncWork().catch(() => undefined) + * ]); + */ + readonly promiseAll: <T>(values: ReadonlyArray<PromiseLike<T> | T>) => Promise<Array<T>>; + /** Tracks asynchronous work that should delay execution completion hooks. */ + readonly track: (maybePromises: ReadonlyArray<unknown>) => void; +} +interface GraphQLParseOptions { + noLocation?: boolean; + allowLegacySDLEmptyFields?: boolean; + allowLegacySDLImplementsInterfaces?: boolean; + experimentalFragmentVariables?: boolean; + /** + * Set to `true` in order to convert all GraphQL comments (marked with # sign) to descriptions (""") + * GraphQL has built-in support for transforming descriptions to comments (with `print`), but not while + * parsing. Turning the flag on will support the other way as well (`parse`) + */ + commentDescriptions?: boolean; +} +type ValidatorBehavior = "error" | "warn" | "ignore"; +interface IResolverValidationOptions { + /** + * Enable to require a resolver to be defined for any field that has + * arguments. Defaults to `ignore`. + */ + requireResolversForArgs?: ValidatorBehavior; + /** + * Enable to require a resolver to be defined for any field which has + * a return type that isn't a scalar. Defaults to `ignore`. + */ + requireResolversForNonScalar?: ValidatorBehavior; + /** + * Enable to require a resolver for be defined for all fields defined + * in the schema. Defaults to `ignore`. + */ + requireResolversForAllFields?: ValidatorBehavior; + /** + * Enable to require a `resolveType()` for Interface and Union types. + * Defaults to `ignore`. + */ + requireResolversForResolveType?: ValidatorBehavior; + /** + * Enable to require all defined resolvers to match fields that + * actually exist in the schema. Defaults to `error` to catch common errors. + */ + requireResolversToMatchSchema?: ValidatorBehavior; +} +type IScalarTypeResolver = GraphQLScalarType & { + __name?: string; + __description?: string; + __serialize?: GraphQLScalarSerializer<any>; + __parseValue?: GraphQLScalarValueParser<any>; + __parseLiteral?: GraphQLScalarLiteralParser<any>; + __extensions?: ExtensionsObject; + __astNode?: ScalarTypeDefinitionNode; + __extensionASTNodes?: Array<ScalarTypeExtensionNode>; +}; +type IEnumTypeResolver = Record<string, any> & { + __name?: string; + __description?: string; + __extensions?: ExtensionsObject; + __astNode?: EnumTypeDefinitionNode; + __extensionASTNodes?: Array<EnumTypeExtensionNode>; +}; +interface IFieldResolverOptions<TSource = any, TContext = any, TArgs = any> { + name?: string; + description?: string; + type?: GraphQLOutputType; + args?: Array<GraphQLArgument>; + resolve?: IFieldResolver<TSource, TContext, TArgs>; + subscribe?: IFieldResolver<TSource, TContext, TArgs>; + isDeprecated?: boolean; + deprecationReason?: string; + extensions?: ExtensionsObject; + astNode?: FieldDefinitionNode; +} +type IFieldResolver<TSource, TContext, TArgs = Record<string, any>, TReturn = any> = (source: TSource, args: TArgs, context: TContext, info: GraphQLResolveInfo$1) => TReturn; +type TypeSource = string | Source | DocumentNode | GraphQLSchema | DefinitionNode | Array<TypeSource> | (() => TypeSource); +type IObjectTypeResolver<TSource = any, TContext = any, TArgs = any> = { + [key: string]: IFieldResolver<TSource, TContext, TArgs> | IFieldResolverOptions<TSource, TContext>; +} & { + __name?: string; + __description?: string; + __isTypeOf?: GraphQLIsTypeOfFn<TSource, TContext>; + __extensions?: ExtensionsObject; + __astNode?: ObjectTypeDefinitionNode; + __extensionASTNodes?: ObjectTypeExtensionNode; +}; +type IInterfaceTypeResolver<TSource = any, TContext = any, TArgs = any> = { + [key: string]: IFieldResolver<TSource, TContext, TArgs> | IFieldResolverOptions<TSource, TContext>; +} & { + __name?: string; + __description?: string; + __resolveType?: GraphQLTypeResolver<any, any>; + __extensions?: ExtensionsObject; + __astNode?: InterfaceTypeDefinitionNode; + __extensionASTNodes?: Array<InterfaceTypeExtensionNode>; +}; +type IUnionTypeResolver = { + __name?: string; + __description?: string; + __resolveType?: GraphQLTypeResolver<any, any>; + __extensions?: ExtensionsObject; + __astNode?: UnionTypeDefinitionNode; + __extensionASTNodes?: Array<UnionTypeExtensionNode>; +}; +type IInputObjectTypeResolver = { + __name?: string; + __description?: string; + __extensions?: ExtensionsObject; + __astNode?: InputObjectTypeDefinitionNode; + __extensionASTNodes?: Array<InputObjectTypeExtensionNode>; +}; +type ISchemaLevelResolver<TSource, TContext, TArgs = Record<string, any>, TReturn = any> = IFieldResolver<TSource, TContext, TArgs, TReturn>; +type IResolvers<TSource = any, TContext = any, TArgs = Record<string, any>, TReturn = any> = Record<string, ISchemaLevelResolver<TSource, TContext, TArgs, TReturn> | IObjectTypeResolver<TSource, TContext> | IInterfaceTypeResolver<TSource, TContext> | IUnionTypeResolver | IScalarTypeResolver | IEnumTypeResolver | IInputObjectTypeResolver>; +export interface GraphQLError { + /** + * An optional schema coordinate (e.g. "MyType.myField") associated with this error. + */ + readonly coordinate?: string; +} +interface IExecutableSchemaDefinition<TContext = any> extends BuildSchemaOptions, GraphQLParseOptions { + /** + * The type definitions used to create the schema + */ + typeDefs: TypeSource; + /** + * Object describing the field resolvers for the provided type definitions + */ + resolvers?: IResolvers<any, TContext> | Array<IResolvers<any, TContext>>; + /** + * Additional options for validating the provided resolvers + */ + resolverValidationOptions?: IResolverValidationOptions; + /** + * GraphQL object types that implement interfaces will inherit any missing + * resolvers from their interface types defined in the `resolvers` object + */ + inheritResolversFromInterfaces?: boolean; + /** + * Do not create a schema again and use the one from `buildASTSchema` + */ + updateResolversInPlace?: boolean; + /** + * Schema extensions + */ + schemaExtensions?: SchemaExtensions | Array<SchemaExtensions>; + /** + * Default field resolver + */ + defaultFieldResolver?: GraphQLFieldResolver<any, TContext>; +} +/** + * Builds a schema from the provided type definitions and resolvers. + * + * The type definitions are written using Schema Definition Language (SDL). They + * can be provided as a string, a `DocumentNode`, a function, or an array of any + * of these. If a function is provided, it will be passed no arguments and + * should return an array of strings or `DocumentNode`s. + * + * Note: You can use GraphQL magic comment provide additional syntax + * highlighting in your editor (with the appropriate editor plugin). + * + * ```js + * const typeDefs = /* GraphQL *\/ ` + * type Query { + * posts: [Post] + * author(id: Int!): Author + * } + * `; + * ``` + * + * The `resolvers` object should be a map of type names to nested object, which + * themselves map the type's fields to their appropriate resolvers. + * See the [Resolvers](/docs/resolvers) section of the documentation for more details. + * + * ```js + * const resolvers = { + * Query: { + * posts: (obj, args, ctx, info) => getAllPosts(), + * author: (obj, args, ctx, info) => getAuthorById(args.id) + * } + * }; + * ``` + * + * Once you've defined both the `typeDefs` and `resolvers`, you can create your + * schema: + * + * ```js + * const schema = makeExecutableSchema({ + * typeDefs, + * resolvers, + * }) + * ``` + */ +export declare function makeExecutableSchema<TContext = any>({ typeDefs, resolvers, resolverValidationOptions, inheritResolversFromInterfaces, updateResolversInPlace, schemaExtensions, defaultFieldResolver, ...otherOptions }: IExecutableSchemaDefinition<TContext>): GraphQLSchema; +type ID = string; +declare enum MessageType { + ConnectionInit = "connection_init",// Client -> Server + ConnectionAck = "connection_ack",// Server -> Client + Ping = "ping",// bidirectional + Pong = "pong",/// bidirectional + Subscribe = "subscribe",// Client -> Server + Next = "next",// Server -> Client + Error = "error",// Server -> Client + Complete = "complete" +} +interface ConnectionInitMessage { + readonly type: MessageType.ConnectionInit; + readonly payload?: Record<string, unknown>; +} +interface PingMessage { + readonly type: MessageType.Ping; + readonly payload?: Record<string, unknown>; +} +interface PongMessage { + readonly type: MessageType.Pong; + readonly payload?: Record<string, unknown>; +} +interface SubscribePayload { + readonly operationName?: string | null | undefined; + readonly query: string; + readonly variables?: Record<string, unknown> | null | undefined; + readonly extensions?: Record<string, unknown> | null | undefined; +} +interface ExecutionResult$1<Data = Record<string, unknown>, Extensions = Record<string, unknown>> { + errors?: ReadonlyArray<GraphQLError> | undefined; + data?: Data | null | undefined; + hasNext?: boolean | undefined; + extensions?: Extensions | undefined; +} +type JSONMessageReviver = (this: any, key: string, value: any) => any; +type JSONMessageReplacer = (this: any, key: string, value: any) => any; +type OperationResult = Promise<AsyncGenerator<ExecutionResult$1> | AsyncIterable<ExecutionResult$1> | ExecutionResult$1> | AsyncGenerator<ExecutionResult$1> | AsyncIterable<ExecutionResult$1> | ExecutionResult$1; +type GraphQLExecutionContextValue = object | symbol | number | string | boolean | undefined | null; +/** @category Server */ +export interface ServerOptions<P extends ConnectionInitMessage["payload"] = ConnectionInitMessage["payload"], E = unknown> { + /** + * The GraphQL schema on which the operations + * will be executed and validated against. + * + * If a function is provided, it will be called on + * every subscription request allowing you to manipulate + * schema dynamically. + * + * If the schema is left undefined, you're trusted to + * provide one in the returned `ExecutionArgs` from the + * `onSubscribe` callback. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + schema?: undefined | GraphQLSchema | ((ctx: Context<P, E>, id: string, payload: SubscribePayload, args: Omit<ExecutionArgs, "schema">) => Promise<GraphQLSchema> | GraphQLSchema); + /** + * A value which is provided to every resolver and holds + * important contextual information like the currently + * logged in user, or access to a database. + * + * If you return from `onSubscribe`, and the returned value is + * missing the `contextValue` field, this context will be used + * instead. + * + * If you use the function signature, the final execution arguments + * will be passed in (also the returned value from `onSubscribe`). + * Since the context is injected on every subscribe, the `SubscribeMessage` + * with the regular `Context` will be passed in through the arguments too. + * + * Note that the context function is invoked on each operation only once. + * Meaning, for subscriptions, only at the point of initialising the subscription; + * not on every subscription event emission. Read more about the context lifecycle + * in subscriptions here: https://github.com/graphql/graphql-js/issues/894. + */ + context?: undefined | GraphQLExecutionContextValue | ((ctx: Context<P, E>, id: string, payload: SubscribePayload, args: ExecutionArgs) => Promise<GraphQLExecutionContextValue> | GraphQLExecutionContextValue); + /** + * The GraphQL root fields or resolvers to go + * alongside the schema. Learn more about them + * here: https://graphql.org/learn/execution/#root-fields-resolvers. + * + * If you return from `onSubscribe`, and the returned value is + * missing the `rootValue` field, the relevant operation root + * will be used instead. + */ + roots?: undefined | { + [operation in OperationTypeNode]?: Record<string, NonNullable<ExecutionArgs["rootValue"]>>; + }; + /** + * A custom GraphQL parse function allowing you to apply your own + * parsing logic. + * + * Will not be used when implementing a custom `onSubscribe`. + * + * Throwing an error from within this function will close the socket + * with the `Error` message in the close event reason. + */ + parse?: undefined | typeof parse; + /** + * A custom GraphQL validate function allowing you to apply your + * own validation rules. + * + * Returned, non-empty, array of `GraphQLError`s will be communicated + * to the client through the `ErrorMessage`. Use an empty array if the + * document is valid and no errors have been encountered. + * + * Will not be used when implementing a custom `onSubscribe`. + * + * Throwing an error from within this function will close the socket + * with the `Error` message in the close event reason. + */ + validate?: undefined | typeof validate; + /** + * Is the `execute` function from GraphQL which is + * used to execute the query and mutation operations. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + execute?: undefined | ((args: ExecutionArgs) => OperationResult); + /** + * Is the `subscribe` function from GraphQL which is + * used to execute the subscription operation. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + subscribe?: undefined | ((args: ExecutionArgs) => OperationResult); + /** + * The amount of time for which the server will wait + * for `ConnectionInit` message. + * + * Set the value to `Infinity`, `''`, `0`, `null` or `undefined` to skip waiting. + * + * If the wait timeout has passed and the client + * has not sent the `ConnectionInit` message, + * the server will terminate the socket by + * dispatching a close event `4408: Connection initialisation timeout` + * + * @default 3_000 // 3 seconds + */ + connectionInitWaitTimeout?: undefined | number; + /** + * Is the connection callback called when the + * client requests the connection initialisation + * through the message `ConnectionInit`. + * + * The message payload (`connectionParams` from the + * client) is present in the `Context.connectionParams`. + * + * - Returning `true` or nothing from the callback will + * allow the client to connect. + * + * - Returning `false` from the callback will + * terminate the socket by dispatching the + * close event `4403: Forbidden`. + * + * - Returning a `Record` from the callback will + * allow the client to connect and pass the returned + * value to the client through the optional `payload` + * field in the `ConnectionAck` message. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onConnect?: undefined | ((ctx: Context<P, E>) => Promise<Record<string, unknown> | boolean | void> | Record<string, unknown> | boolean | void); + /** + * Called when the client disconnects for whatever reason after + * he successfully went through the connection initialisation phase. + * Provides the close event too. Beware that this callback happens + * AFTER all subscriptions have been gracefully completed and BEFORE + * the `onClose` callback. + * + * If you are interested in tracking the subscriptions completions, + * consider using the `onComplete` callback. + * + * This callback will be called EXCLUSIVELY if the client connection + * is acknowledged. Meaning, `onConnect` will be called before the `onDisconnect`. + * + * For tracking socket closures at any point in time, regardless + * of the connection state - consider using the `onClose` callback. + */ + onDisconnect?: undefined | ((ctx: Context<P, E>, code?: number, reason?: string) => Promise<void> | void); + /** + * Called when the client sends a {@link MessageType.Ping} message, at any + * point after the connection is opened - before or after the connection + * initialisation phase. + * + * If the client sent the ping with a payload, it will be passed through the + * second argument. The first argument provides the {@link Context} of the + * connection. + * + * If this callback is implemented, the server will still automatically reply + * to the ping with a pong, right after the callback resolves. Use the + * low-level `onPing` listener on the websocket itself for full control over + * the response - implementing that listener disables the automatic pong. + */ + onPing?: undefined | ((ctx: Context<P, E>, payload: PingMessage["payload"]) => Promise<void> | void); + /** + * Called when the client sends a {@link MessageType.Pong} message, at any + * point after the connection is opened - before or after the connection + * initialisation phase. + * + * If the client sent the pong with a payload, it will be passed through the + * second argument. The first argument provides the {@link Context} of the + * connection. + */ + onPong?: undefined | ((ctx: Context<P, E>, payload: PongMessage["payload"]) => Promise<void> | void); + /** + * Called when the socket closes for whatever reason, at any + * point in time. Provides the close event too. Beware + * that this callback happens AFTER all subscriptions have + * been gracefully completed and AFTER the `onDisconnect` callback. + * + * If you are interested in tracking the subscriptions completions, + * consider using the `onComplete` callback. + * + * In comparison to `onDisconnect`, this callback will ALWAYS + * be called, regardless if the user successfully went through + * the connection initialisation or not. `onConnect` might not + * called before the `onClose`. + */ + onClose?: undefined | ((ctx: Context<P, E>, code?: number, reason?: string) => Promise<void> | void); + /** + * The subscribe callback executed right after + * acknowledging the request before any payload + * processing has been performed. + * + * If you return `ExecutionArgs` from the callback, + * it will be used instead of trying to build one + * internally. In this case, you are responsible + * for providing a ready set of arguments which will + * be directly plugged in the operation execution. + * + * Omitting the fields `contextValue` or `rootValue` + * from the returned value will have the provided server + * options fill in the gaps. + * + * To report GraphQL errors simply return an array + * of them from the callback, they will be reported + * to the client through the error message. + * + * Useful for preparing the execution arguments + * following a custom logic. A typical use case are + * persisted queries, you can identify the query from + * the subscribe message and create the GraphQL operation + * execution args which are then returned by the function. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onSubscribe?: undefined | ((ctx: Context<P, E>, id: string, payload: SubscribePayload) => Promise<ExecutionArgs | readonly GraphQLError[] | void> | ExecutionArgs | readonly GraphQLError[] | void); + /** + * Executed after the operation call resolves. For streaming + * operations, triggering this callback does not necessarily + * mean that there is already a result available - it means + * that the subscription process for the stream has resolved + * and that the client is now subscribed. + * + * The `OperationResult` argument is the result of operation + * execution. It can be an iterator or already a value. + * + * If you want the single result and the events from a streaming + * operation, use the `onNext` callback. + * + * Use this callback to listen for subscribe operation and + * execution result manipulation. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onOperation?: undefined | ((ctx: Context<P, E>, id: string, payload: SubscribePayload, args: ExecutionArgs, result: OperationResult) => Promise<OperationResult | void> | OperationResult | void); + /** + * Executed after an error occurred right before it + * has been dispatched to the client. + * + * Use this callback to format the outgoing GraphQL + * errors before they reach the client. + * + * Returned result will be injected in the error message payload. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onError?: undefined | ((ctx: Context<P, E>, id: string, payload: SubscribePayload, errors: readonly GraphQLError[]) => Promise<readonly GraphQLFormattedError[] | void> | readonly GraphQLFormattedError[] | void); + /** + * Executed after an operation has emitted a result right before + * that result has been sent to the client. Results from both + * single value and streaming operations will appear in this callback. + * + * Use this callback if you want to format the execution result + * before it reaches the client. + * + * Returned result will be injected in the next message payload. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onNext?: undefined | ((ctx: Context<P, E>, id: string, payload: SubscribePayload, args: ExecutionArgs, result: ExecutionResult$1) => Promise<FormattedExecutionResult | void> | FormattedExecutionResult | void); + /** + * The complete callback is executed after the + * operation has completed right before sending + * the complete message to the client. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + * + * Since the library makes sure to complete streaming + * operations even after an abrupt closure, this callback + * will still be called. + */ + onComplete?: undefined | ((ctx: Context<P, E>, id: string, payload: SubscribePayload) => Promise<void> | void); + /** + * An optional override for the JSON.parse function used to hydrate + * incoming messages to this server. Useful for parsing custom datatypes + * out of the incoming JSON. + */ + jsonMessageReviver?: undefined | JSONMessageReviver; + /** + * An optional override for the JSON.stringify function used to serialize + * outgoing messages to from server. Useful for serializing custom + * datatypes out to the client. + */ + jsonMessageReplacer?: undefined | JSONMessageReplacer; +} +interface Server<E = undefined> { + /** + * New socket has been established. The lib will validate + * the protocol and use the socket accordingly. Returned promise + * will resolve after the socket closes. + * + * The second argument will be passed in the `extra` field + * of the `Context`. You may pass the initial request or the + * original WebSocket, if you need it down the road. + * + * Returns a function that should be called when the same socket + * has been closed, for whatever reason. The close code and reason + * must be passed for reporting to the `onDisconnect` callback. Returned + * promise will resolve once the internal cleanup is complete. + */ + opened(socket: WebSocket$1, ctxExtra: E): (code?: number, reason?: string) => Promise<void>; +} +interface WebSocket$1 { + /** + * The subprotocol of the WebSocket. Will be used + * to validate against the supported ones. + */ + readonly protocol: string; + /** + * Sends a message through the socket. Will always + * provide a `string` message. + * + * Please take care that the send is ready. Meaning, + * only provide a truly OPEN socket through the `opened` + * method of the `Server`. + * + * The returned promise is used to control the flow of data + * (like handling backpressure). + */ + send(data: string): Promise<void> | void; + /** + * Closes the socket gracefully. Will always provide + * the appropriate code and close reason. `onDisconnect` + * callback will be called. + * + * The returned promise is used to control the graceful + * closure. + */ + close(code?: number, reason?: string): Promise<void> | void; + /** + * Called when message is received. The library requires the data + * to be a `string`. + * + * All operations requested from the client will block the promise until + * completed, this means that the callback will not resolve until all + * subscription events have been emitted (or until the client has completed + * the stream), or until the query/mutation resolves. + * + * Exceptions raised during any phase of operation processing will + * reject the callback's promise, catch them and communicate them + * to your clients however you wish. + */ + onMessage(cb: (data: string) => Promise<void>): void; + /** + * Implement a listener for the `PingMessage` sent from the client to the server. + * If the client sent the ping with a payload, it will be passed through the + * first argument. + * + * If this listener is implemented, the server will NOT automatically reply + * to any pings from the client. Implementing it makes it your responsibility + * to decide how and when to respond. + */ + onPing?(payload: PingMessage["payload"]): Promise<void> | void; + /** + * Implement a listener for the `PongMessage` sent from the client to the server. + * If the client sent the pong with a payload, it will be passed through the + * first argument. + */ + onPong?(payload: PongMessage["payload"]): Promise<void> | void; +} +interface Context<P extends ConnectionInitMessage["payload"] = ConnectionInitMessage["payload"], E = unknown> { + /** + * Indicates that the `ConnectionInit` message + * has been received by the server. If this is + * `true`, the client wont be kicked off after + * the wait timeout has passed. + */ + readonly connectionInitReceived: boolean; + /** + * Indicates that the connection was acknowledged + * by having dispatched the `ConnectionAck` message + * to the related client. + */ + readonly acknowledged: boolean; + /** The parameters passed during the connection initialisation. */ + readonly connectionParams?: Readonly<P>; + /** + * Holds the active subscriptions for this context. **All operations** + * that are taking place are aggregated here. The user is _subscribed_ + * to an operation when waiting for result(s). + * + * If the subscription behind an ID is an `AsyncIterator` - the operation + * is streaming; on the contrary, if the subscription is `null` - it is simply + * a reservation, meaning - the operation resolves to a single result or is still + * pending/being prepared. + */ + readonly subscriptions: Record<ID, AsyncGenerator<unknown> | AsyncIterable<unknown> | null>; + /** + * An extra field where you can store your own context values + * to pass between callbacks. + */ + extra: E; +} +/** + * Makes a Protocol compliant WebSocket GraphQL server. The server + * is actually an API which is to be used with your favourite WebSocket + * server library! + * + * Read more about the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Server + */ +export declare function makeServer<P extends ConnectionInitMessage["payload"] = ConnectionInitMessage["payload"], E = unknown>(options: ServerOptions<P, E>): Server<E>; + +declare namespace Kind { + export { ARGUMENT, ARGUMENT_COORDINATE, BOOLEAN, DIRECTIVE, DIRECTIVE_ARGUMENT_COORDINATE, DIRECTIVE_COORDINATE, DIRECTIVE_DEFINITION, DIRECTIVE_EXTENSION, DOCUMENT, ENUM, ENUM_TYPE_DEFINITION, ENUM_TYPE_EXTENSION, ENUM_VALUE_DEFINITION, FIELD, FIELD_DEFINITION, FLOAT, FRAGMENT_ARGUMENT, FRAGMENT_DEFINITION, FRAGMENT_SPREAD, INLINE_FRAGMENT, INPUT_OBJECT_TYPE_DEFINITION, INPUT_OBJECT_TYPE_EXTENSION, INPUT_VALUE_DEFINITION, INT, INTERFACE_TYPE_DEFINITION, INTERFACE_TYPE_EXTENSION, LIST, LIST_TYPE, MEMBER_COORDINATE, NAME, NAMED_TYPE, NON_NULL_TYPE, NULL, OBJECT, OBJECT_FIELD, OBJECT_TYPE_DEFINITION, OBJECT_TYPE_EXTENSION, OPERATION_DEFINITION, OPERATION_TYPE_DEFINITION, SCALAR_TYPE_DEFINITION, SCALAR_TYPE_EXTENSION, SCHEMA_DEFINITION, SCHEMA_EXTENSION, SELECTION_SET, STRING, TYPE_COORDINATE, UNION_TYPE_DEFINITION, UNION_TYPE_EXTENSION, VARIABLE, VARIABLE_DEFINITION }; +} + +export { + Location$1 as Location, + Path as ResponsePath, + pathToArray as responsePathAsArray, +}; + +export {}; diff --git a/vendor/deps.js b/vendor/deps.js new file mode 100644 index 0000000..22d7525 --- /dev/null +++ b/vendor/deps.js @@ -0,0 +1,190 @@ +// @ts-self-types="./deps.d.ts" +var Ef=Object.defineProperty;var Tf=(e)=>e;function yf(e,t){this[e]=Tf.bind(null,t)}var gf=(e,t)=>{for(var n in t)Ef(e,n,{get:t[n],enumerable:!0,configurable:!0,set:yf.bind(t,n)})};var C={};gf(C,{ARGUMENT:()=>ii,ARGUMENT_COORDINATE:()=>mo,BOOLEAN:()=>tt,DIRECTIVE:()=>oi,DIRECTIVE_ARGUMENT_COORDINATE:()=>Eo,DIRECTIVE_COORDINATE:()=>ho,DIRECTIVE_DEFINITION:()=>pt,DIRECTIVE_EXTENSION:()=>Tr,DOCUMENT:()=>jt,ENUM:()=>Ot,ENUM_TYPE_DEFINITION:()=>Yt,ENUM_TYPE_EXTENSION:()=>pn,ENUM_VALUE_DEFINITION:()=>lo,FIELD:()=>an,FIELD_DEFINITION:()=>co,FLOAT:()=>Bt,FRAGMENT_ARGUMENT:()=>uo,FRAGMENT_DEFINITION:()=>Qe,FRAGMENT_SPREAD:()=>Dt,INLINE_FRAGMENT:()=>_n,INPUT_OBJECT_TYPE_DEFINITION:()=>yt,INPUT_OBJECT_TYPE_EXTENSION:()=>Lt,INPUT_VALUE_DEFINITION:()=>ai,INT:()=>Oe,INTERFACE_TYPE_DEFINITION:()=>xt,INTERFACE_TYPE_EXTENSION:()=>Kt,LIST:()=>Ae,LIST_TYPE:()=>Dn,MEMBER_COORDINATE:()=>fo,NAME:()=>Ne,NAMED_TYPE:()=>Sn,NON_NULL_TYPE:()=>cn,NULL:()=>le,OBJECT:()=>Ve,OBJECT_FIELD:()=>un,OBJECT_TYPE_DEFINITION:()=>At,OBJECT_TYPE_EXTENSION:()=>qt,OPERATION_DEFINITION:()=>Tt,OPERATION_TYPE_DEFINITION:()=>si,SCALAR_TYPE_DEFINITION:()=>Qt,SCALAR_TYPE_EXTENSION:()=>ln,SCHEMA_DEFINITION:()=>Ye,SCHEMA_EXTENSION:()=>Rt,SELECTION_SET:()=>ao,STRING:()=>Ie,TYPE_COORDINATE:()=>po,UNION_TYPE_DEFINITION:()=>wt,UNION_TYPE_EXTENSION:()=>Jt,VARIABLE:()=>Ce,VARIABLE_DEFINITION:()=>ri});var Nf="17.0.2",ro=Object.freeze({major:17,minor:0,patch:2,preReleaseTag:null});function y(e){return io(e,[])}function io(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return If(e,t);default:return String(e)}}function If(e,t){if(e===null)return"null";if(t.includes(e))return"[Circular]";let n=[...t,e];if(vf(e)){let r=e.toJSON();if(r!==e)return typeof r==="string"?r:io(r,n)}else if(Array.isArray(e))return _f(e,n);return bf(e,n)}function vf(e){return typeof e.toJSON==="function"}function bf(e,t){let n=Object.entries(e);if(n.length===0)return"{}";if(t.length>2)return"["+Sf(e)+"]";return"{ "+n.map(([i,o])=>i+": "+io(o,t)).join(", ")+" }"}function _f(e,t){if(e.length===0)return"[]";if(t.length>2)return"[Array]";let n=Math.min(10,e.length),r=e.length-n,i=[];for(let o=0;o<n;++o)i.push(io(e[o],t));if(r===1)i.push("... 1 more item");else if(r>1)i.push(`... ${r} more items`);return"["+i.join(", ")+"]"}function Sf(e){let t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if(t==="Object"&&typeof e.constructor==="function"){let n=e.constructor.name;if(typeof n==="string"&&n!=="")return n}return t}function Df(e,t,n){if(e?.__kind===t)return!0;if(typeof e==="object"&&e!==null){let r=n.prototype[Symbol.toStringTag],i=Symbol.toStringTag in e?e[Symbol.toStringTag]:e.constructor?.name;if(r===i){let o=y(e);throw Error(`Cannot use ${r} "${o}" from another module or realm. + +Ensure that there is only one instance of "graphql" in the node_modules +directory. If different versions of "graphql" are the dependencies of other +relied on modules, use "resolutions" to ensure only one version is installed. + +https://yarnpkg.com/en/docs/selective-version-resolutions + +Duplicate "graphql" modules cannot be used at the same time since different +versions may have different capabilities and behavior. The data from one +version used in the function from another could produce confusing and +spurious results.`)}}return!1}function Of(e,t){return e?.__kind===t}var Le=Of;function Ru(){Le=Df}var Lu=!1;function Af(){Lu=!0,Ru()}function xf(){return Lu}function K(e){return e instanceof Promise}function Be(e){return typeof e?.then==="function"}function oo(e){return e instanceof Error?e:new ku(e)}class ku extends Error{constructor(e){super("Unexpected error value: "+y(e));this.name="NonErrorThrown",this.thrownValue=e}}function ye(e){return typeof e=="object"&&e!==null}function U(e,t){if(!e)throw Error(t??"Unexpected invariant triggered.")}var wf=/\r\n|[\n\r]/g;function Yn(e,t){let n=0,r=1;for(let i of e.body.matchAll(wf)){if(typeof i.index!=="number")U(!1);if(i.index>=t)break;n=i.index+i[0].length,r+=1}return{line:r,column:t+1-n}}function so(e){return Zr(e.source,Yn(e.source,e.start))}function Zr(e,t){let n=e.locationOffset.column-1,r="".padStart(n)+e.body,i=t.line-1,o=e.locationOffset.line-1,s=t.line+o,a=t.line===1?n:0,u=t.column+a,c=`${e.name}:${s}:${u} +`,l=r.split(/\r\n|[\n\r]/g),p=l[i];if(p.length>120){let f=Math.floor(u/80),d=u%80,E=[];for(let I=0;I<p.length;I+=80)E.push(p.slice(I,I+80));return c+Fu([[`${s} |`,E[0]],...E.slice(1,f+1).map((I)=>["|",I]),["|","^".padStart(d)],["|",E[f+1]]])}return c+Fu([[`${s-1} |`,l[i-1]],[`${s} |`,p],["|","^".padStart(u)],[`${s+1} |`,l[i+1]]])}function Fu(e){let t=e.filter(([r,i])=>i!==void 0),n=Math.max(...t.map(([r])=>r.length));return t.map(([r,i])=>r.padStart(n)+(i?" "+i:"")).join(` +`)}class m extends Error{constructor(e,t={}){let{nodes:n,source:r,positions:i,path:o,originalError:s,cause:a,extensions:u}=t,c="cause"in t,l=c?a:s,p=c||s!=null?{cause:l}:void 0;super(e,p);this.name="GraphQLError",this.path=o??void 0;let f=s??(a instanceof Error?a:void 0);this.originalError=f,this.nodes=Cu(Array.isArray(n)?n:n?[n]:void 0);let d=Cu(this.nodes?.map((I)=>I.loc).filter((I)=>I!=null));this.source=r??d?.[0]?.source,this.positions=i??d?.map((I)=>I.start),this.locations=i&&r?i.map((I)=>Yn(r,I)):d?.map((I)=>Yn(I.source,I.start));let E=ye(f?.extensions)?f.extensions:void 0;if(this.extensions=u??E??Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),s?.stack!=null)Object.defineProperty(this,"stack",{value:s.stack,writable:!0,configurable:!0});else if(Error.captureStackTrace!=null)Error.captureStackTrace(this,m);else Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes){for(let t of this.nodes)if(t.loc)e+=` + +`+so(t.loc)}else if(this.source&&this.locations)for(let t of this.locations)e+=` + +`+Zr(this.source,t);return e}toJSON(){let e={message:this.message};if(this.locations!=null)e.locations=this.locations;if(this.path!=null)e.path=this.path;if(this.extensions!=null&&Object.keys(this.extensions).length>0)e.extensions=this.extensions;return e}}function Cu(e){return e===void 0||e.length===0?void 0:e}function De(e){if(e instanceof m)return e;let t=oo(e);return new m(t.message,{originalError:t})}class Fe extends Map{get[Symbol.toStringTag](){return"AccumulatorMap"}add(e,t){let n=this.get(e);if(n===void 0)this.set(e,[t]);else n.push(t)}}function Vu(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function Mu(e){return Pu("or",e)}function Uu(e){return Pu("and",e)}function Pu(e,t){if(t.length===0)U(!1);switch(t.length){case 1:return t[0];case 2:return t[0]+" "+e+" "+t[1]}let n=t.slice(0,-1),r=t.at(-1);return n.join(", ")+", "+e+" "+r}function et(e){return typeof e==="object"&&typeof e?.[Symbol.iterator]==="function"}function sn(e,t){let n=Object.create(null);for(let r of e)n[t(r)]=r;return n}function Gt(e,t){let n=Object.create(null);for(let r of Object.keys(e))n[r]=t(e[r],r);return n}function qn(e){if(e.length===0)return"";return` at ${e.map((t)=>typeof t==="number"?`[${t}]`:`.${t}`).join("")}`}class ei{constructor(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class bn{constructor(e,t,n,r,i,o){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=i,this.value=o,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}var ti={Name:[],Document:["definitions"],OperationDefinition:["description","name","variableDefinitions","directives","selectionSet"],VariableDefinition:["description","variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentArgument:["name","value"],FragmentSpread:["name","arguments","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["description","name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","directives","locations"],SchemaExtension:["directives","operationTypes"],DirectiveExtension:["name","directives"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"],TypeCoordinate:["name"],MemberCoordinate:["name","memberName"],ArgumentCoordinate:["name","fieldName","argumentName"],DirectiveCoordinate:["name"],DirectiveArgumentCoordinate:["name","argumentName"]},Rf=new Set(Object.keys(ti));function ni(e){let t=e?.kind;return typeof t==="string"&&Rf.has(t)}var re={QUERY:"query",MUTATION:"mutation",SUBSCRIPTION:"subscription"};var Ne="Name",jt="Document",Tt="OperationDefinition",ri="VariableDefinition",ao="SelectionSet",an="Field",ii="Argument",uo="FragmentArgument",Dt="FragmentSpread",_n="InlineFragment",Qe="FragmentDefinition",Ce="Variable",Oe="IntValue",Bt="FloatValue",Ie="StringValue",tt="BooleanValue",le="NullValue",Ot="EnumValue",Ae="ListValue",Ve="ObjectValue",un="ObjectField",oi="Directive",Sn="NamedType",Dn="ListType",cn="NonNullType",Ye="SchemaDefinition",si="OperationTypeDefinition",Qt="ScalarTypeDefinition",At="ObjectTypeDefinition",co="FieldDefinition",ai="InputValueDefinition",xt="InterfaceTypeDefinition",wt="UnionTypeDefinition",Yt="EnumTypeDefinition",lo="EnumValueDefinition",yt="InputObjectTypeDefinition",pt="DirectiveDefinition",Rt="SchemaExtension",Tr="DirectiveExtension",ln="ScalarTypeExtension",qt="ObjectTypeExtension",Kt="InterfaceTypeExtension",Jt="UnionTypeExtension",pn="EnumTypeExtension",Lt="InputObjectTypeExtension",po="TypeCoordinate",fo="MemberCoordinate",mo="ArgumentCoordinate",ho="DirectiveCoordinate",Eo="DirectiveArgumentCoordinate";function nt(e,t){if(!e)throw Error(t)}var Lf=5;function qe(e,t){let[n,r]=t?[e,t]:[void 0,e];if(r.length===0)return"";let i=" Did you mean ";if(n!=null)i+=n+" ";let o=Mu(r.slice(0,Lf).map((s)=>`"${s}"`));return i+o+"?"}function ua(e){return e}function kt(e,t,n){let r=Object.create(null);for(let i of e)r[t(i)]=n(i);return r}function fn(e,t){let n=0,r=0;while(n<e.length&&r<t.length){let i=e.charCodeAt(n),o=t.charCodeAt(r);if(To(i)&&To(o)){let s=0;do++n,s=s*10+i-ca,i=e.charCodeAt(n);while(To(i)&&s>0);let a=0;do++r,a=a*10+o-ca,o=t.charCodeAt(r);while(To(o)&&a>0);if(s<a)return-1;if(s>a)return 1}else{if(i<o)return-1;if(i>o)return 1;++n,++r}}return e.length-t.length}var ca=48,kf=57;function To(e){return!isNaN(e)&&ca<=e&&e<=kf}function Je(e,t){let n=Object.create(null),r=new Gu(e),i=Math.floor(e.length*0.4)+1;for(let o of t){let s=r.measure(o,i);if(s!==void 0)n[o]=s}return Object.keys(n).sort((o,s)=>{let a=n[o]-n[s];return a!==0?a:fn(o,s)})}class Gu{constructor(e){this._input=e,this._inputLowerCase=e.toLowerCase(),this._inputArray=$u(this._inputLowerCase),this._rows=[Array(e.length+1).fill(0),Array(e.length+1).fill(0),Array(e.length+1).fill(0)]}measure(e,t){if(this._input===e)return 0;let n=e.toLowerCase();if(this._inputLowerCase===n)return 1;let r=$u(n),i=this._inputArray;if(r.length<i.length){let c=r;r=i,i=c}let o=r.length,s=i.length;if(o-s>t)return;let a=this._rows;for(let c=0;c<=s;c++)a[0][c]=c;for(let c=1;c<=o;c++){let l=a[(c-1)%3],p=a[c%3],f=p[0]=c;for(let d=1;d<=s;d++){let E=r[c-1]===i[d-1]?0:1,I=Math.min(l[d]+1,p[d-1]+1,l[d-1]+E);if(c>1&&d>1&&r[c-1]===i[d-2]&&r[c-2]===i[d-1]){let S=a[(c-2)%3][d-2];I=Math.min(I,S+1)}if(I<f)f=I;p[d]=I}if(f>t)return}let u=a[o%3][s];return u<=t?u:void 0}}function $u(e){let t=e.length,n=Array(t);for(let r=0;r<t;++r)n[r]=e.charCodeAt(r);return n}function We(e){if(e==null)return Object.create(null);if(Object.getPrototypeOf(e)===null)return e;let t=Object.create(null);for(let[n,r]of Object.entries(e))t[n]=r;for(let n of Object.getOwnPropertySymbols(e))t[n]=e[n];return t}function yo(e){return e===9||e===32}function Kn(e){return e>=48&&e<=57}function ju(e){return e>=97&&e<=122||e>=65&&e<=90}function Jn(e){return ju(e)||e===95}function go(e){return ju(e)||Kn(e)||e===95}function Bu(e){let t=Number.MAX_SAFE_INTEGER,n=null,r=-1;for(let i=0;i<e.length;++i){let o=e[i],s=Ff(o);if(s===o.length)continue;if(n??=i,r=i,i!==0&&s<t)t=s}return e.map((i,o)=>o===0?i:i.slice(t)).slice(n??0,r+1)}function Ff(e){let t=0;while(t<e.length&&yo(e.charCodeAt(t)))++t;return t}function Qu(e){if(e==="")return!0;let t=!0,n=!1,r=!0,i=!1;for(let o=0;o<e.length;++o)switch(e.codePointAt(o)){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 11:case 12:case 14:case 15:return!1;case 13:return!1;case 10:if(t&&!i)return!1;i=!0,t=!0,n=!1;break;case 9:case 32:n||=t;break;default:r&&=n,t=!1}if(t)return!1;if(r&&i)return!1;return!0}function No(e,t){let n=e.replaceAll('"""','\\"""'),r=n.split(/\r\n|[\n\r]/g),i=r.length===1,o=r.length>1&&r.slice(1).every((d)=>d.length===0||yo(d.charCodeAt(0))),s=n.endsWith('\\"""'),a=e.endsWith('"')&&!s,u=e.endsWith("\\"),c=a||u,l=!t?.minimize&&(!i||e.length>70||c||o||s),p="",f=i&&yo(e.charCodeAt(0));if(l&&!f||o)p+=` +`;if(p+=n,l||c)p+=` +`;return'"""'+p+'"""'}function Yu(e){return`"${e.replace(Cf,Vf)}"`}var Cf=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function Vf(e){return Mf[e.charCodeAt(0)]}var Mf=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","","\\\"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"];var Wn=Object.freeze({});function ft(e,t,n=ti){let r=new Map;for(let E of Object.values(C))r.set(E,Hn(t,E));let i=void 0,o=Array.isArray(e),s=[e],a=-1,u=[],c=e,l=void 0,p=void 0,f=[],d=[];do{a++;let E=a===s.length,I=E&&u.length!==0;if(E){if(l=d.length===0?void 0:f[f.length-1],c=p,p=d.pop(),I)if(o){c=c.slice();let G=0;for(let[Z,W]of u){let H=Z-G;if(W===null)c.splice(H,1),G++;else c[H]=W}}else{c={...c};for(let[G,Z]of u)c[G]=Z}a=i.index,s=i.keys,u=i.edits,o=i.inArray,i=i.prev}else if(p!=null){if(l=o?a:s[a],c=p[l],c===null||c===void 0)continue;f.push(l)}let S;if(!Array.isArray(c)){if(!ni(c))nt(!1,`Invalid AST Node: ${y(c)}.`);if(S=(E?r.get(c.kind)?.leave:r.get(c.kind)?.enter)?.call(t,c,l,p,f,d),S===Wn)break;if(S===!1){if(!E){f.pop();continue}}else if(S!==void 0){if(u.push([l,S]),!E)if(ni(S))c=S;else{f.pop();continue}}}if(S===void 0&&I)u.push([l,c]);if(E)f.pop();else{if(i={inArray:o,index:a,keys:s,edits:u,prev:i},o=Array.isArray(c),s=o?c:n[c.kind]??[],a=-1,u=[],p!=null)d.push(p);p=c}}while(i!==void 0);if(u.length!==0)return u.at(-1)[1];return e}function ui(e){let t=Array(e.length).fill(null),n=Object.create(null);for(let r of Object.values(C)){let i=!1,o=Array(e.length).fill(void 0),s=Array(e.length).fill(void 0);for(let u=0;u<e.length;++u){let{enter:c,leave:l}=Hn(e[u],r);i||=c!=null||l!=null,o[u]=c,s[u]=l}if(!i)continue;let a={enter(...u){let c=u[0];for(let l=0;l<e.length;l++)if(t[l]===null){let p=o[l]?.apply(e[l],u);if(p===!1)t[l]=c;else if(p===Wn)t[l]=Wn;else if(p!==void 0)return p}},leave(...u){let c=u[0];for(let l=0;l<e.length;l++)if(t[l]===null){let p=s[l]?.apply(e[l],u);if(p===Wn)t[l]=Wn;else if(p!==void 0&&p!==!1)return p}else if(t[l]===c)t[l]=null}};n[r]=a}return n}function Hn(e,t){let n=e[t];if(typeof n==="object")return n;else if(typeof n==="function")return{enter:n,leave:void 0};return{enter:e.enter,leave:e.leave}}function ee(e){return ft(e,Uf)}var pa=80,Uf={Name:{leave:(e)=>e.value},Variable:{leave:(e)=>"$"+e.name},Document:{leave:(e)=>x(e.definitions,` + +`)},OperationDefinition:{leave(e){let t=la(e.variableDefinitions)?J(`( +`,x(e.variableDefinitions,` +`),` +)`):J("(",x(e.variableDefinitions,", "),")"),n=J("",e.description,` +`)+x([e.operation,x([e.name,t]),x(e.directives," ")]," ");return(n==="query"?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:r,description:i})=>J("",i,` +`)+e+": "+t+J(" = ",n)+J(" ",x(r," "))},SelectionSet:{leave:({selections:e})=>gt(e)},Field:{leave({alias:e,name:t,arguments:n,directives:r,selectionSet:i}){let o=x([J("",e,": "),t],"");return x([qu(o,n),J(" ",x(r," ")),J(" ",i)])}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentArgument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,arguments:t,directives:n})=>{let r="..."+e;return qu(r,t)+J(" ",x(n," "))}},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>x(["...",J("on ",e),x(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:r,selectionSet:i,description:o})=>J("",o,` +`)+`fragment ${e}${J("(",x(n,", "),")")} on ${t} ${J("",x(r," ")," ")}`+i},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t===!0?No(e):Yu(e)},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>{let t="["+x(e,", ")+"]";if(t.length>pa)return`[ +`+ci(x(e,` +`))+` +]`;return t}},ObjectValue:{leave:({fields:e})=>{let t="{ "+x(e,", ")+" }";return t.length>pa?gt(e):t}},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+J("(",x(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:n})=>J("",e,` +`)+x(["schema",x(t," "),gt(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>J("",e,` +`)+x(["scalar",t,x(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>J("",e,` +`)+x(["type",t,J("implements ",x(n," & ")),x(r," "),gt(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:r,directives:i})=>J("",e,` +`)+t+(la(n)?J(`( +`,ci(x(n,` +`)),` +)`):J("(",x(n,", "),")"))+": "+r+J(" ",x(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:r,directives:i})=>J("",e,` +`)+x([t+": "+n,J("= ",r),x(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>J("",e,` +`)+x(["interface",t,J("implements ",x(n," & ")),x(r," "),gt(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:r})=>J("",e,` +`)+x(["union",t,x(n," "),J("= ",x(r," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:r})=>J("",e,` +`)+x(["enum",t,x(n," "),gt(r)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>J("",e,` +`)+x([t,x(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:r})=>J("",e,` +`)+x(["input",t,x(n," "),gt(r)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,directives:r,repeatable:i,locations:o})=>J("",e,` +`)+"directive @"+t+(la(n)?J(`( +`,ci(x(n,` +`)),` +)`):J("(",x(n,", "),")"))+J(" ",x(r," "))+(i?" repeatable":"")+" on "+x(o," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>x(["extend schema",x(e," "),gt(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>x(["extend scalar",e,x(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>x(["extend type",e,J("implements ",x(t," & ")),x(n," "),gt(r)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>x(["extend interface",e,J("implements ",x(t," & ")),x(n," "),gt(r)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>x(["extend union",e,x(t," "),J("= ",x(n," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>x(["extend enum",e,x(t," "),gt(n)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>x(["extend input",e,x(t," "),gt(n)]," ")},DirectiveExtension:{leave:({name:e,directives:t})=>x(["extend directive @"+e,x(t," ")]," ")},TypeCoordinate:{leave:({name:e})=>e},MemberCoordinate:{leave:({name:e,memberName:t})=>x([e,J(".",t)])},ArgumentCoordinate:{leave:({name:e,fieldName:t,argumentName:n})=>x([e,J(".",t),J("(",n,":)")])},DirectiveCoordinate:{leave:({name:e})=>x(["@",e])},DirectiveArgumentCoordinate:{leave:({name:e,argumentName:t})=>x(["@",e,J("(",t,":)")])}};function x(e,t=""){return e?.filter((n)=>n!==void 0&&n!=="").join(t)??""}function gt(e){return J(`{ +`,ci(x(e,` +`)),` +}`)}function J(e,t,n=""){return t!=null&&t!==""?e+t+n:""}function ci(e){return J(" ",e.replaceAll(` +`,` + `))}function la(e){return e?.some((t)=>t.includes(` +`))??!1}function qu(e,t){let n=e+J("(",x(t,", "),")");if(n.length>pa)n=e+J(`( +`,ci(x(t,` +`)),` +)`);return n}function Wt(e,t){switch(e.kind){case le:return null;case Oe:return parseInt(e.value,10);case Bt:return parseFloat(e.value);case Ie:case Ot:case tt:return e.value;case Ae:return e.values.map((n)=>Wt(n,t));case Ve:return kt(e.fields,(n)=>n.name.value,(n)=>Wt(n.value,t));case Ce:return t?.[e.name.value]}}function He(e){if(e.length===0)throw new m("Expected name to be a non-empty string.");for(let t=1;t<e.length;++t)if(!go(e.charCodeAt(t)))throw new m(`Names must only contain [_a-zA-Z0-9] but "${e}" does not.`);if(!Jn(e.charCodeAt(0)))throw new m(`Names must start with [_a-zA-Z] but "${e}" does not.`);return e}function Io(e){if(e==="true"||e==="false"||e==="null")throw new m(`Enum values cannot be named: ${e}`);return He(e)}function yr(e){return ae(e)||L(e)||P(e)||te(e)||z(e)||k(e)||j(e)||w(e)}function Ku(e){if(!yr(e))throw Error(`Expected ${y(e)} to be a GraphQL type.`);return e}var Ju=Symbol("Scalar");function ae(e){return Le(e,Ju,ke)}function Wu(e){if(!ae(e))throw Error(`Expected ${y(e)} to be a GraphQL Scalar type.`);return e}var fa=Symbol("Object");function L(e){return Le(e,fa,Ee)}function bo(e){if(!L(e))throw Error(`Expected ${y(e)} to be a GraphQL Object type.`);return e}var Hu=Symbol("Field");function da(e){return Le(e,Hu,zn)}function zu(e){if(!da(e))throw Error(`Expected ${y(e)} to be a GraphQL field.`);return e}var Xu=Symbol("Argument");function li(e){return Le(e,Xu,di)}function Zu(e){if(!li(e))throw Error(`Expected ${y(e)} to be a GraphQL argument.`);return e}var ec=Symbol("Interface");function P(e){return Le(e,ec,Me)}function _o(e){if(!P(e))throw Error(`Expected ${y(e)} to be a GraphQL Interface type.`);return e}var tc=Symbol("Union");function te(e){return Le(e,tc,it)}function nc(e){if(!te(e))throw Error(`Expected ${y(e)} to be a GraphQL Union type.`);return e}var rc=Symbol("Enum");function z(e){return Le(e,rc,we)}function ic(e){if(!z(e))throw Error(`Expected ${y(e)} to be a GraphQL Enum type.`);return e}var oc=Symbol("EnumValue");function ma(e){return Le(e,oc,Ea)}function sc(e){if(!ma(e))throw Error(`Expected ${y(e)} to be a GraphQL Enum value.`);return e}var ac=Symbol("InputObject");function k(e){return Le(e,ac,Ge)}function uc(e){if(!k(e))throw Error(`Expected ${y(e)} to be a GraphQL Input Object type.`);return e}var cc=Symbol("InputField");function ha(e){return Le(e,cc,Ta)}function lc(e){if(!ha(e))throw Error(`Expected ${y(e)} to be a GraphQL input field.`);return e}var pc=Symbol("List");function j(e){return Le(e,pc,oe)}function fc(e){if(!j(e))throw Error(`Expected ${y(e)} to be a GraphQL List type.`);return e}var dc=Symbol("NonNull");function w(e){return Le(e,dc,V)}function mc(e){if(!w(e))throw Error(`Expected ${y(e)} to be a GraphQL Non-Null type.`);return e}function xe(e){return ae(e)||z(e)||k(e)||On(e)&&xe(e.ofType)}function hc(e){if(!xe(e))throw Error(`Expected ${y(e)} to be a GraphQL input type.`);return e}function Nt(e){return ae(e)||L(e)||P(e)||te(e)||z(e)||On(e)&&Nt(e.ofType)}function Ec(e){if(!Nt(e))throw Error(`Expected ${y(e)} to be a GraphQL output type.`);return e}function ve(e){return ae(e)||z(e)}function It(e){if(!ve(e))throw Error(`Expected ${y(e)} to be a GraphQL leaf type.`);return e}function dt(e){return L(e)||P(e)||te(e)}function Tc(e){if(!dt(e))throw Error(`Expected ${y(e)} to be a GraphQL composite type.`);return e}function Ke(e){return P(e)||te(e)}function yc(e){if(!Ke(e))throw Error(`Expected ${y(e)} to be a GraphQL abstract type.`);return e}class oe{constructor(e){this.__kind=pc,this.ofType=e}get[Symbol.toStringTag](){return"GraphQLList"}toString(){return"["+String(this.ofType)+"]"}toJSON(){return this.toString()}}class V{constructor(e){this.__kind=dc,this.ofType=e}get[Symbol.toStringTag](){return"GraphQLNonNull"}toString(){return String(this.ofType)+"!"}toJSON(){return this.toString()}}function On(e){return j(e)||w(e)}function gc(e){if(!On(e))throw Error(`Expected ${y(e)} to be a GraphQL wrapping type.`);return e}function pi(e){return yr(e)&&!w(e)}function So(e){if(!pi(e))throw Error(`Expected ${y(e)} to be a GraphQL nullable type.`);return e}function gr(e){if(e)return w(e)?e.ofType:e}function rt(e){return ae(e)||L(e)||P(e)||te(e)||z(e)||k(e)}function Nc(e){if(!rt(e))throw Error(`Expected ${y(e)} to be a GraphQL named type.`);return e}function pe(e){if(e){let t=e;while(On(t))t=t.ofType;return t}}function Do(e){return typeof e==="function"?e():e}function fi(e){return typeof e==="function"?e():e}class ke{constructor(e){if(this.__kind=Ju,this.name=He(e.name),this.description=e.description,this.specifiedByURL=e.specifiedByURL,this.serialize=e.serialize??e.coerceOutputValue??ua,this.parseValue=e.parseValue??e.coerceInputValue??ua,this.parseLiteral=e.parseLiteral??((t,n)=>this.coerceInputValue(Wt(t,n))),this.coerceOutputValue=e.coerceOutputValue??this.serialize,this.coerceInputValue=e.coerceInputValue??this.parseValue,this.coerceInputLiteral=e.coerceInputLiteral,this.valueToLiteral=e.valueToLiteral,this.extensions=We(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=e.extensionASTNodes??[],e.parseLiteral){if(!(typeof e.parseValue==="function"&&typeof e.parseLiteral==="function"))nt(!1,`${this.name} must provide both "parseValue" and "parseLiteral" functions.`)}if(e.coerceInputLiteral){if(!(typeof e.coerceInputValue==="function"&&typeof e.coerceInputLiteral==="function"))nt(!1,`${this.name} must provide both "coerceInputValue" and "coerceInputLiteral" functions.`)}}get[Symbol.toStringTag](){return"GraphQLScalarType"}toConfig(){return{name:this.name,description:this.description,specifiedByURL:this.specifiedByURL,serialize:this.serialize,parseValue:this.parseValue,parseLiteral:this.parseLiteral,coerceOutputValue:this.coerceOutputValue,coerceInputValue:this.coerceInputValue,coerceInputLiteral:this.coerceInputLiteral,valueToLiteral:this.valueToLiteral,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class Ee{constructor(e){this.__kind=fa,this.__kind=fa,this.name=He(e.name),this.description=e.description,this.isTypeOf=e.isTypeOf,this.extensions=We(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=e.extensionASTNodes??[],this._fields=vc.bind(void 0,this,e.fields),this._interfaces=Ic.bind(void 0,e.interfaces)}get[Symbol.toStringTag](){return"GraphQLObjectType"}getFields(){if(typeof this._fields==="function")this._fields=this._fields();return this._fields}getInterfaces(){if(typeof this._interfaces==="function")this._interfaces=this._interfaces();return this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:Gt(this.getFields(),(e)=>e.toConfig()),isTypeOf:this.isTypeOf,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Ic(e){return Do(e??[])}function vc(e,t){let n=fi(t);return Gt(n,(r,i)=>new zn(e,i,r))}class zn{constructor(e,t,n){this.__kind=Hu,this.parentType=e,this.name=He(t),this.description=n.description,this.type=n.type;let r=n.args;this.args=r?Object.entries(r).map(([i,o])=>new di(this,i,o)):[],this.resolve=n.resolve,this.subscribe=n.subscribe,this.deprecationReason=n.deprecationReason,this.extensions=We(n.extensions),this.astNode=n.astNode}get[Symbol.toStringTag](){return"GraphQLField"}toConfig(){return{description:this.description,type:this.type,args:kt(this.args,(e)=>e.name,(e)=>e.toConfig()),resolve:this.resolve,subscribe:this.subscribe,deprecationReason:this.deprecationReason,extensions:this.extensions,astNode:this.astNode}}toString(){return`${this.parentType??"<meta>"}.${this.name}`}toJSON(){return this.toString()}}class di{constructor(e,t,n){this.__kind=Xu,this.parent=e,this.name=He(t),this.description=n.description,this.type=n.type,this.defaultValue=n.defaultValue,this.default=n.default,this._memoizedCoercedDefaultValue=void 0,this.deprecationReason=n.deprecationReason,this.extensions=We(n.extensions),this.astNode=n.astNode}get[Symbol.toStringTag](){return"GraphQLArgument"}toConfig(){return{description:this.description,type:this.type,defaultValue:this.defaultValue,default:this.default,deprecationReason:this.deprecationReason,extensions:this.extensions,astNode:this.astNode}}toString(){return`${this.parent}(${this.name}:)`}toJSON(){return this.toString()}}function ze(e){return w(e.type)&&e.default===void 0&&e.defaultValue===void 0}class Me{constructor(e){this.__kind=ec,this.name=He(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=We(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=e.extensionASTNodes??[],this._fields=vc.bind(void 0,this,e.fields),this._interfaces=Ic.bind(void 0,e.interfaces)}get[Symbol.toStringTag](){return"GraphQLInterfaceType"}getFields(){if(typeof this._fields==="function")this._fields=this._fields();return this._fields}getInterfaces(){if(typeof this._interfaces==="function")this._interfaces=this._interfaces();return this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:Gt(this.getFields(),(e)=>e.toConfig()),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class it{constructor(e){this.__kind=tc,this.name=He(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=We(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=e.extensionASTNodes??[],this._types=Pf.bind(void 0,e.types)}get[Symbol.toStringTag](){return"GraphQLUnionType"}getTypes(){if(typeof this._types==="function")this._types=this._types();return this._types}toConfig(){return{name:this.name,description:this.description,types:this.getTypes(),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Pf(e){return Do(e)}class we{constructor(e){this.__kind=rc,this.name=He(e.name),this.description=e.description,this.extensions=We(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=e.extensionASTNodes??[],this._values=$f.bind(void 0,this,e.values),this._valueLookup=null,this._nameLookup=null}get[Symbol.toStringTag](){return"GraphQLEnumType"}getValues(){if(typeof this._values==="function")this._values=this._values();return this._values}getValue(e){return this._nameLookup??=sn(this.getValues(),(t)=>t.name),this._nameLookup[e]}serialize(e){return this.coerceOutputValue(e)}coerceOutputValue(e){this._valueLookup??=new Map(this.getValues().map((n)=>[n.value,n]));let t=this._valueLookup.get(e);if(t===void 0)throw new m(`Enum "${this.name}" cannot represent value: ${y(e)}`);return t.name}parseValue(e,t){return this.coerceInputValue(e,t)}coerceInputValue(e,t){if(typeof e!=="string"){let r=y(e);throw new m(`Enum "${this.name}" cannot represent non-string value: ${r}.`+(t?"":vo(this,r)))}let n=this.getValue(e);if(n==null)throw new m(`Value "${e}" does not exist in "${this.name}" enum.`+(t?"":vo(this,e)));return n.value}parseLiteral(e,t,n){return this.coerceInputLiteral(e,n)}coerceInputLiteral(e,t){if(e.kind!==Ot){let r=ee(e);throw new m(`Enum "${this.name}" cannot represent non-enum value: ${r}.`+(t?"":vo(this,r)),{nodes:e})}let n=this.getValue(e.value);if(n==null){let r=ee(e);throw new m(`Value "${r}" does not exist in "${this.name}" enum.`+(t?"":vo(this,r)),{nodes:e})}return n.value}valueToLiteral(e){if(typeof e==="string"&&this.getValue(e))return{kind:Ot,value:e}}toConfig(){return{name:this.name,description:this.description,values:kt(this.getValues(),(e)=>e.name,(e)=>e.toConfig()),extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function $f(e,t){let n=fi(t);return Object.entries(n).map(([r,i])=>new Ea(e,r,i))}function vo(e,t){let n=e.getValues().map((i)=>i.name),r=Je(t,n);return qe("the enum value",r)}class Ea{constructor(e,t,n){this.__kind=oc,this.parentEnum=e,this.name=Io(t),this.description=n.description,this.value=n.value!==void 0?n.value:t,this.deprecationReason=n.deprecationReason,this.extensions=We(n.extensions),this.astNode=n.astNode}get[Symbol.toStringTag](){return"GraphQLEnumValue"}toConfig(){return{description:this.description,value:this.value,deprecationReason:this.deprecationReason,extensions:this.extensions,astNode:this.astNode}}toString(){return`${this.parentEnum.name}.${this.name}`}toJSON(){return this.toString()}}class Ge{constructor(e){this.__kind=ac,this.name=He(e.name),this.description=e.description,this.extensions=We(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=e.extensionASTNodes??[],this.isOneOf=e.isOneOf??!1,this._fields=Gf.bind(void 0,this,e.fields)}get[Symbol.toStringTag](){return"GraphQLInputObjectType"}getFields(){if(typeof this._fields==="function")this._fields=this._fields();return this._fields}toConfig(){return{name:this.name,description:this.description,fields:Gt(this.getFields(),(e)=>e.toConfig()),extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,isOneOf:this.isOneOf}}toString(){return this.name}toJSON(){return this.toString()}}function Gf(e,t){let n=fi(t);return Gt(n,(r,i)=>new Ta(e,i,r))}class Ta{constructor(e,t,n){if("resolve"in n)nt(!1,`${e}.${t} field has a resolve property, but Input Types cannot define resolvers.`);this.__kind=cc,this.parentType=e,this.name=He(t),this.description=n.description,this.type=n.type,this.defaultValue=n.defaultValue,this.default=n.default,this._memoizedCoercedDefaultValue=void 0,this.deprecationReason=n.deprecationReason,this.extensions=We(n.extensions),this.astNode=n.astNode}get[Symbol.toStringTag](){return"GraphQLInputField"}toConfig(){return{description:this.description,type:this.type,defaultValue:this.defaultValue,default:this.default,deprecationReason:this.deprecationReason,extensions:this.extensions,astNode:this.astNode}}toString(){return`${this.parentType}.${this.name}`}toJSON(){return this.toString()}}function Xe(e){return w(e.type)&&e.defaultValue===void 0&&e.default===void 0}function Nr(e,t){if(e===t)return!0;if(w(e)&&w(t))return Nr(e.ofType,t.ofType);if(j(e)&&j(t))return Nr(e.ofType,t.ofType);return!1}function Ht(e,t,n){if(t===n)return!0;if(w(n)){if(w(t))return Ht(e,t.ofType,n.ofType);return!1}if(w(t))return Ht(e,t.ofType,n);if(j(n)){if(j(t))return Ht(e,t.ofType,n.ofType);return!1}if(j(t))return!1;return Ke(n)&&(P(t)||L(t))&&e.isSubType(n,t)}function mi(e,t,n){if(t===n)return!0;if(Ke(t)){if(Ke(n))return e.getPossibleTypes(t).some((r)=>e.isSubType(n,r));return e.isSubType(t,n)}if(Ke(n))return e.isSubType(n,t);return!1}function Pe(e,t,n){return{prev:e,key:t,typename:n}}function fe(e){let t=[],n=e;while(n)t.push(n.key),n=n.prev;return t.reverse()}function zt(e,t){if(w(t)){if(e==null)return;return zt(e,t.ofType)}if(e==null)return{kind:le};if(j(t)){if(!et(e))return zt(e,t.ofType);let r=[];for(let i of e){let o=zt(i,t.ofType);if(!o)return;r.push(o)}return{kind:Ae,values:r}}if(k(t)){if(!ye(e))return;let r=[],i=t.getFields();if(Object.keys(e).some((s)=>e[s]!==void 0&&!Object.hasOwn(i,s)))return;for(let s of Object.values(t.getFields()))if(e[s.name]===void 0){if(Xe(s))return}else{let u=zt(e[s.name],s.type);if(!u)return;r.push({kind:un,name:{kind:Ne,value:s.name},value:u})}return{kind:Ve,fields:r}}let n=It(t);if(n.valueToLiteral)try{return n.valueToLiteral(e)}catch(r){return}return Xn(e)}function Xn(e){if(e==null)return{kind:le};switch(typeof e){case"boolean":return{kind:tt,value:e};case"string":return{kind:Ie,value:e,block:!1};case"bigint":return{kind:Oe,value:e.toString()};case"number":{if(!Number.isFinite(e))return{kind:le};let t=String(e);return/^-?(?:0|[1-9][0-9]*)$/.test(t)?{kind:Oe,value:t}:{kind:Bt,value:t}}case"object":{if(et(e))return{kind:Ae,values:Array.from(e,Xn)};let t=e,n=[];for(let r of Object.keys(t)){let i=t[r];if(i!==void 0)n.push({kind:un,name:{kind:Ne,value:r},value:Xn(i)})}return{kind:Ve,fields:n}}}throw TypeError(`Cannot convert value to AST: ${y(e)}.`)}function dn(e,t,n){switch(e.kind){case Ce:{let r=e.name.value,i=n?.sources[r];if(i){let s=i.value;if(s===void 0){let a=i.signature.default;if(a!==void 0)return a.literal;return{kind:le}}return dn(s,t,i.fragmentVariableValues)}let o=t?.sources[r];if(o==null)return{kind:le};if(o.value===void 0){let s=o.signature.default;if(s!==void 0)return s.literal}return zt(o.value,o.signature.type)}case Ve:{let r=[];for(let i of e.fields){if(i.value.kind===Ce){let s=n?.sources[i.value.name.value]??t?.sources[i.value.name.value];if(s?.value===void 0&&s?.signature.default===void 0)continue}let o=dn(i.value,t,n);r.push({...i,value:o})}return{...e,fields:r}}case Ae:{let r=[];for(let i of e.values){let o=dn(i,t,n);r.push(o)}return{...e,values:r}}default:return e}}function Zn(e,t,n,r){return hi(e,t,n,r,void 0)}function hi(e,t,n,r,i){if(w(t)){if(e===void 0){An(n,`Expected a value of non-null type "${t}" to be provided.`,i);return}if(e===null){An(n,`Expected value of non-null type "${t}" not to be null.`,i);return}return hi(e,t.ofType,n,r,i)}if(e==null)return;if(j(t))if(!et(e))hi(e,t.ofType,n,r,i);else{let o=0;for(let s of e)hi(s,t.ofType,n,r,Pe(i,o++,void 0))}else if(k(t)){if(!ye(e)||Array.isArray(e)){An(n,`Expected value of type "${t}" to be an object, found: ${y(e)}.`,i);return}let o=t.getFields();for(let a of Object.values(o)){let u=e[a.name];if(u===void 0){if(Xe(a))An(n,`Expected value of type "${t}" to include required field "${a.name}", found: ${y(e)}.`,i)}else hi(u,a.type,n,r,Pe(i,a.name,t.name))}let s=[];for(let a of Object.keys(e)){if(e[a]===void 0)continue;if(!Object.hasOwn(o,a)){let u=r?"":qe(Je(a,Object.keys(o)));An(n,`Expected value of type "${t}" not to include unknown field "${a}"${u?`.${u} Found`:", found"}: ${y(e)}.`,i);continue}s.push(a)}if(t.isOneOf){if(s.length!==1)An(n,Oo(t),i);let a=s[0];if(e[a]===null)An(n,Oo(t),Pe(i,a,t.name))}}else{It(t);let o,s;try{o=t.coerceInputValue(e,r)}catch(a){if(a instanceof m){n(a,fe(i));return}s=a}if(o===void 0)An(n,`Expected value of type "${t}"${s!=null?`, but encountered error "${_c(s)}"; found`:", found"}: ${y(e)}.`,i,De(s))}}function An(e,t,n,r){e(new m(t,{originalError:r}),fe(n))}function xn(e,t,n,r,i,o){return Ei({static:!r&&!i,onError:n,variables:r,fragmentVariableValues:i},e,t,o,void 0)}function Ei(e,t,n,r,i){if(t.kind===Ce){if(e.static)return;let s=bc(e,t)?.coerced[t.name.value];if(w(n)){if(s===void 0)Ft(e.onError,`Expected variable "$${t.name.value}" provided to type "${n}" to provide a runtime value.`,t,i);else if(s===null)Ft(e.onError,`Expected variable "$${t.name.value}" provided to non-null type "${n}" not to be null.`,t,i)}return}if(w(n)){if(t.kind===le){Ft(e.onError,`Expected value of non-null type "${n}" not to be null.`,t,i);return}return Ei(e,t,n.ofType,r,i)}if(t.kind===le)return;if(j(n))if(t.kind!==Ae)Ei(e,t,n.ofType,r,i);else{let o=0;for(let s of t.values)Ei(e,s,n.ofType,r,Pe(i,o++,void 0))}else if(k(n)){if(t.kind!==Ve){Ft(e.onError,`Expected value of type "${n}" to be an object, found: ${ee(t)}.`,t,i);return}let o=n.getFields(),s=sn(t.fields,(c)=>c.name.value);for(let c of Object.values(o)){let l=s[c.name];if(l===void 0){if(Xe(c))Ft(e.onError,`Expected value of type "${n}" to include required field "${c.name}", found: ${ee(t)}.`,t,i)}else{let p=l.value;if(p.kind===Ce&&!e.static){let f=bc(e,p),d=p.name.value,E=f?.coerced[d];if(n.isOneOf){if(E===void 0)Ft(e.onError,`Expected variable "$${d}" provided to field "${c.name}" for OneOf Input Object type "${n}" to provide a runtime value.`,t,i);else if(E===null)Ft(e.onError,`Expected variable "$${d}" provided to field "${c.name}" for OneOf Input Object type "${n}" not to be null.`,t,i)}else if(E===void 0&&!Xe(c))continue}Ei(e,p,c.type,r,Pe(i,c.name,n.name))}}let a=t.fields,u=[];for(let c of a){let l=c.name.value;if(!Object.hasOwn(o,l)){let p=r?"":qe(Je(l,Object.keys(o)));Ft(e.onError,`Expected value of type "${n}" not to include unknown field "${l}"${p?`.${p} Found`:", found"}: ${ee(t)}.`,c,i)}else u.push(c)}if(n.isOneOf){if(u.length!==1){Ft(e.onError,Oo(n),t,i);return}if(u[0].value.kind===le){let p=u[0].name.value;Ft(e.onError,Oo(n),t,Pe(i,p,void 0))}}}else{It(n);let o,s;try{o=n.coerceInputLiteral?n.coerceInputLiteral(dn(t,e.variables,e.fragmentVariableValues),r):n.parseLiteral(t,void 0,r)}catch(a){if(a instanceof m){e.onError(a,fe(i));return}s=a}if(o===void 0)Ft(e.onError,`Expected value of type "${n}"${s!=null?`, but encountered error "${_c(s)}"; found`:", found"}: ${ee(t)}.`,t,i,De(s))}}function bc(e,t){let n=t.name.value,{fragmentVariableValues:r,variables:i}=e;return r?.sources[n]?r:i}function Ft(e,t,n,r,i){e(new m(t,{nodes:n,originalError:i}),fe(r))}function _c(e){if(ye(e)){let t=e.message;if(typeof t==="string"&&t!=="")return t}return String(e)}function Oo(e){return`Within OneOf Input Object type "${e}", exactly one field must be specified, and the value for that field must be non-null.`}var F={QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",FRAGMENT_VARIABLE_DEFINITION:"FRAGMENT_VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION",DIRECTIVE_DEFINITION:"DIRECTIVE_DEFINITION"};var er=2147483647,tr=-2147483648,wn=new ke({name:"Int",description:"The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.",coerceOutputValue(e){let t=Ti(e);if(typeof t==="number")return Sc(t);if(typeof t==="boolean")return t?1:0;if(typeof t==="string")return jf(t);if(typeof t==="bigint")return Dc(t);throw new m(`Int cannot represent non-integer value: ${y(t)}`)},coerceInputValue(e){if(typeof e==="number")return Sc(e);if(typeof e==="bigint")return Dc(e);throw new m(`Int cannot represent non-integer value: ${y(e)}`)},coerceInputLiteral(e){if(e.kind!==Oe)throw new m(`Int cannot represent non-integer value: ${ee(e)}`,{nodes:e});let t=parseInt(e.value,10);if(t>er||t<tr)throw new m(`Int cannot represent non 32-bit signed integer value: ${e.value}`,{nodes:e});return t},valueToLiteral(e){if((typeof e==="number"&&Number.isInteger(e)||typeof e==="bigint")&&e<=er&&e>=tr)return{kind:Oe,value:String(e)}}}),Ir=new ke({name:"Float",description:"The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).",coerceOutputValue(e){let t=Ti(e);if(typeof t==="number")return Oc(t);if(typeof t==="boolean")return t?1:0;if(typeof t==="string")return Bf(t);if(typeof t==="bigint")return Ac(t);throw new m(`Float cannot represent non numeric value: ${y(t)}`)},coerceInputValue(e){if(typeof e==="number")return Oc(e);if(typeof e==="bigint")return Ac(e);throw new m(`Float cannot represent non numeric value: ${y(e)}`)},coerceInputLiteral(e){if(e.kind!==Bt&&e.kind!==Oe)throw new m(`Float cannot represent non numeric value: ${ee(e)}`,{nodes:e});return parseFloat(e.value)},valueToLiteral(e){let t=Xn(e);if(t.kind===Bt||t.kind===Oe)return t}}),ie=new ke({name:"String",description:"The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.",coerceOutputValue(e){let t=Ti(e);if(typeof t==="string")return t;if(typeof t==="boolean")return t?"true":"false";if(typeof t==="number")return Qf(t);if(typeof t==="bigint")return String(t);throw new m(`String cannot represent value: ${y(e)}`)},coerceInputValue(e){if(typeof e!=="string")throw new m(`String cannot represent a non string value: ${y(e)}`);return e},coerceInputLiteral(e){if(e.kind!==Ie)throw new m(`String cannot represent a non string value: ${ee(e)}`,{nodes:e});return e.value},valueToLiteral(e){let t=Xn(e);if(t.kind===Ie)return t}}),ge=new ke({name:"Boolean",description:"The `Boolean` scalar type represents `true` or `false`.",coerceOutputValue(e){let t=Ti(e);if(typeof t==="boolean")return t;if(typeof t==="number")return Yf(t);if(typeof t==="bigint")return t!==0n;throw new m(`Boolean cannot represent a non boolean value: ${y(t)}`)},coerceInputValue(e){if(typeof e!=="boolean")throw new m(`Boolean cannot represent a non boolean value: ${y(e)}`);return e},coerceInputLiteral(e){if(e.kind!==tt)throw new m(`Boolean cannot represent a non boolean value: ${ee(e)}`,{nodes:e});return e.value},valueToLiteral(e){let t=Xn(e);if(t.kind===tt)return t}}),Rn=new ke({name:"ID",description:'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.',coerceOutputValue(e){let t=Ti(e);if(typeof t==="string")return t;if(typeof t==="number")return ya(t);if(typeof t==="bigint")return String(t);throw new m(`ID cannot represent value: ${y(e)}`)},coerceInputValue(e){if(typeof e==="string")return e;if(typeof e==="number")return ya(e);if(typeof e==="bigint")return String(e);throw new m(`ID cannot represent value: ${y(e)}`)},coerceInputLiteral(e){if(e.kind!==Ie&&e.kind!==Oe)throw new m("ID cannot represent a non-string and non-integer value: "+ee(e),{nodes:e});return e.value},valueToLiteral(e){if(typeof e==="string")return/^-?(?:0|[1-9][0-9]*)$/.test(e)?{kind:Oe,value:e}:{kind:Ie,value:e,block:!1};if(typeof e==="number")return{kind:Oe,value:ya(e)};if(typeof e==="bigint")return{kind:Oe,value:String(e)}}}),Ct=Object.freeze([ie,wn,Ir,ge,Rn]);function Ze(e){return Ct.some(({name:t})=>e.name===t)}function Ti(e){if(ye(e)){if(typeof e.valueOf==="function"){let t=e.valueOf();if(!ye(t))return t}if(typeof e.toJSON==="function")return e.toJSON()}return e}function Sc(e){if(!Number.isInteger(e))throw new m(`Int cannot represent non-integer value: ${y(e)}`);if(e>er||e<tr)throw new m(`Int cannot represent non 32-bit signed integer value: ${y(e)}`);return e}function jf(e){if(e==="")throw new m(`Int cannot represent non-integer value: ${y(e)}`);let t=Number(e);if(!Number.isInteger(t))throw new m(`Int cannot represent non-integer value: ${y(e)}`);if(t>er||t<tr)throw new m(`Int cannot represent non 32-bit signed integer value: ${y(e)}`);return t}function Dc(e){if(e>er||e<tr)throw new m(`Int cannot represent non 32-bit signed integer value: ${String(e)}`);return Number(e)}function Oc(e){if(!Number.isFinite(e))throw new m(`Float cannot represent non numeric value: ${y(e)}`);return e}function Bf(e){if(e==="")throw new m(`Float cannot represent non numeric value: ${y(e)}`);let t=Number(e);if(!Number.isFinite(t))throw new m(`Float cannot represent non numeric value: ${y(e)}`);return t}function Ac(e){let t=Number(e);if(!Number.isFinite(t))throw new m(`Float cannot represent non numeric value: ${y(e)} (value is too large)`);if(BigInt(t)!==e)throw new m(`Float cannot represent non numeric value: ${y(e)} (value would lose precision)`);return t}function Qf(e){if(!Number.isFinite(e))throw new m(`String cannot represent value: ${y(e)}`);return String(e)}function Yf(e){if(!Number.isFinite(e))throw new m(`Boolean cannot represent a non boolean value: ${y(e)}`);return e!==0}function ya(e){if(!Number.isInteger(e))throw new m(`ID cannot represent value: ${y(e)}`);return String(e)}var xc=Symbol("Directive");function nr(e){return Le(e,xc,Re)}function wc(e){if(!nr(e))throw Error(`Expected ${y(e)} to be a GraphQL directive.`);return e}class Re{constructor(e){if(this.__kind=xc,this.name=He(e.name),this.description=e.description,this.locations=e.locations,this.isRepeatable=e.isRepeatable??!1,this.deprecationReason=e.deprecationReason,this.extensions=We(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=e.extensionASTNodes??[],!Array.isArray(e.locations))nt(!1,`@${this.name} locations must be an Array.`);let t=e.args??{};if(!(ye(t)&&!Array.isArray(t)))nt(!1,`@${this.name} args must be an object with argument names as keys.`);this.args=Object.entries(t).map(([n,r])=>new di(this,n,r))}get[Symbol.toStringTag](){return"GraphQLDirective"}toConfig(){return{name:this.name,description:this.description,locations:this.locations,args:kt(this.args,(e)=>e.name,(e)=>e.toConfig()),isRepeatable:this.isRepeatable,deprecationReason:this.deprecationReason,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return"@"+this.name}toJSON(){return this.toString()}}var Ln=new Re({name:"include",description:"Directs the executor to include this field or fragment only when the `if` argument is true.",locations:[F.FIELD,F.FRAGMENT_SPREAD,F.INLINE_FRAGMENT],args:{if:{type:new V(ge),description:"Included when true."}}}),kn=new Re({name:"skip",description:"Directs the executor to skip this field or fragment when the `if` argument is true.",locations:[F.FIELD,F.FRAGMENT_SPREAD,F.INLINE_FRAGMENT],args:{if:{type:new V(ge),description:"Skipped when true."}}}),Xt=new Re({name:"defer",description:"Directs the executor to defer this fragment when the `if` argument is true or undefined.",locations:[F.FRAGMENT_SPREAD,F.INLINE_FRAGMENT],args:{if:{type:new V(ge),description:"Deferred when true or undefined.",default:{value:!0}},label:{type:ie,description:"Unique name"}}}),vt=new Re({name:"stream",description:"Directs the executor to stream plural fields when the `if` argument is true or undefined.",locations:[F.FIELD],args:{initialCount:{default:{value:0},type:new V(wn),description:"Number of items to return immediately"},if:{type:new V(ge),description:"Stream when true or undefined.",default:{value:!0}},label:{type:ie,description:"Unique name"}}}),yi="No longer supported",mn=new Re({name:"deprecated",description:"Marks an element of a GraphQL schema as no longer supported.",locations:[F.FIELD_DEFINITION,F.ARGUMENT_DEFINITION,F.INPUT_FIELD_DEFINITION,F.ENUM_VALUE,F.DIRECTIVE_DEFINITION],args:{reason:{type:new V(ie),description:"Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).",default:{value:yi}}}}),gi=new Re({name:"specifiedBy",description:"Exposes a URL that specifies the behavior of this scalar.",locations:[F.SCALAR],args:{url:{type:new V(ie),description:"The URL that specifies the behavior of this scalar."}}}),Ni=new Re({name:"oneOf",description:"Indicates exactly one field must be supplied and this field must not be `null`.",locations:[F.INPUT_OBJECT],args:{}}),Rc=new Re({name:"experimental_disableErrorPropagation",description:"Disables error propagation.",locations:[F.QUERY,F.MUTATION,F.SUBSCRIPTION]}),je=Object.freeze([Ln,kn,mn,gi,Ni]);function Vt(e){return je.some(({name:t})=>t===e.name)}function Fn(e,t){if(w(t)){let n=Fn(e,t.ofType);if(n?.kind===le)return null;return n}if(e===null)return{kind:le};if(e===void 0)return null;if(j(t)){let n=t.ofType;if(et(e)){let r=[];for(let i of e){let o=Fn(i,n);if(o!=null)r.push(o)}return{kind:Ae,values:r}}return Fn(e,n)}if(k(t)){if(!ye(e))return null;let n=[];for(let r of Object.values(t.getFields())){let i=Fn(e[r.name],r.type);if(i)n.push({kind:un,name:{kind:Ne,value:r.name},value:i})}return{kind:Ve,fields:n}}if(ve(t)){let n=t.coerceOutputValue(e);if(n==null)return null;if(typeof n==="boolean")return{kind:tt,value:n};if(typeof n==="number"&&Number.isFinite(n)){let r=String(n);return Lc.test(r)?{kind:Oe,value:r}:{kind:Bt,value:r}}if(typeof n==="bigint")return{kind:Oe,value:String(n)};if(typeof n==="string"){if(z(t))return{kind:Ot,value:n};if(t===Rn&&Lc.test(n))return{kind:Oe,value:n};return{kind:Ie,value:n}}throw TypeError(`Cannot convert value to AST: ${y(n)}.`)}U(!1,"Unexpected input type: "+y(t))}var Lc=/^-?(?:0|[1-9][0-9]*)$/;function vr(e){let{type:t,default:n}=e;if(n){let i=n.literal??zt(n.value,t);if(i==null)U(!1,"Invalid default value");return i}let r=e.defaultValue;if(r!==void 0){let i=Fn(r,t);if(i==null)U(!1,"Invalid default value");return i}return}var br=new Ee({name:"__Schema",description:"A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.",fields:()=>({description:{type:ie,resolve:(e)=>e.description},types:{description:"A list of all types supported by this server.",type:new V(new oe(new V(mt))),resolve(e){return Object.values(e.getTypeMap())}},queryType:{description:"The type that query operations will be rooted at.",type:new V(mt),resolve:(e)=>e.getQueryType()},mutationType:{description:"If this server supports mutation, the type that mutation operations will be rooted at.",type:mt,resolve:(e)=>e.getMutationType()},subscriptionType:{description:"If this server support subscription, the type that subscription operations will be rooted at.",type:mt,resolve:(e)=>e.getSubscriptionType()},directives:{description:"A list of all directives supported by this server.",type:new V(new oe(new V(Ao))),args:{includeDeprecated:{type:new V(ge),default:{value:!1}}},resolve:(e,{includeDeprecated:t})=>t===!0?e.getDirectives():e.getDirectives().filter((n)=>n.deprecationReason==null)}})}),Ao=new Ee({name:"__Directive",description:`A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document. + +In some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.`,fields:()=>({name:{type:new V(ie),resolve:(e)=>e.name},description:{type:ie,resolve:(e)=>e.description},isRepeatable:{type:new V(ge),resolve:(e)=>e.isRepeatable},locations:{type:new V(new oe(new V(xo))),resolve:(e)=>e.locations},args:{type:new V(new oe(new V(_r))),args:{includeDeprecated:{type:new V(ge),default:{value:!1}}},resolve(e,{includeDeprecated:t}){return t===!0?e.args:e.args.filter((n)=>n.deprecationReason==null)}},isDeprecated:{type:new V(ge),resolve:(e)=>e.deprecationReason!=null},deprecationReason:{type:ie,resolve:(e)=>e.deprecationReason}})}),xo=new we({name:"__DirectiveLocation",description:"A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.",values:{QUERY:{value:F.QUERY,description:"Location adjacent to a query operation."},MUTATION:{value:F.MUTATION,description:"Location adjacent to a mutation operation."},SUBSCRIPTION:{value:F.SUBSCRIPTION,description:"Location adjacent to a subscription operation."},FIELD:{value:F.FIELD,description:"Location adjacent to a field."},FRAGMENT_DEFINITION:{value:F.FRAGMENT_DEFINITION,description:"Location adjacent to a fragment definition."},FRAGMENT_SPREAD:{value:F.FRAGMENT_SPREAD,description:"Location adjacent to a fragment spread."},INLINE_FRAGMENT:{value:F.INLINE_FRAGMENT,description:"Location adjacent to an inline fragment."},VARIABLE_DEFINITION:{value:F.VARIABLE_DEFINITION,description:"Location adjacent to an operation variable definition."},FRAGMENT_VARIABLE_DEFINITION:{value:F.FRAGMENT_VARIABLE_DEFINITION,description:"Location adjacent to a fragment variable definition."},SCHEMA:{value:F.SCHEMA,description:"Location adjacent to a schema definition."},SCALAR:{value:F.SCALAR,description:"Location adjacent to a scalar definition."},OBJECT:{value:F.OBJECT,description:"Location adjacent to an object type definition."},FIELD_DEFINITION:{value:F.FIELD_DEFINITION,description:"Location adjacent to a field definition."},ARGUMENT_DEFINITION:{value:F.ARGUMENT_DEFINITION,description:"Location adjacent to an argument definition."},INTERFACE:{value:F.INTERFACE,description:"Location adjacent to an interface definition."},UNION:{value:F.UNION,description:"Location adjacent to a union definition."},ENUM:{value:F.ENUM,description:"Location adjacent to an enum definition."},ENUM_VALUE:{value:F.ENUM_VALUE,description:"Location adjacent to an enum value definition."},INPUT_OBJECT:{value:F.INPUT_OBJECT,description:"Location adjacent to an input object type definition."},INPUT_FIELD_DEFINITION:{value:F.INPUT_FIELD_DEFINITION,description:"Location adjacent to an input object field definition."},DIRECTIVE_DEFINITION:{value:F.DIRECTIVE_DEFINITION,description:"Location adjacent to a directive definition."}}}),mt=new Ee({name:"__Type",description:"The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.",fields:()=>({kind:{type:new V(Lo),resolve(e){if(ae(e))return ue.SCALAR;if(L(e))return ue.OBJECT;if(P(e))return ue.INTERFACE;if(te(e))return ue.UNION;if(z(e))return ue.ENUM;if(k(e))return ue.INPUT_OBJECT;if(j(e))return ue.LIST;if(w(e))return ue.NON_NULL;U(!1,`Unexpected type: "${y(e)}".`)}},name:{type:ie,resolve:(e)=>("name"in e)?e.name:void 0},description:{type:ie,resolve:(e)=>("description"in e)?e.description:void 0},specifiedByURL:{type:ie,resolve:(e)=>("specifiedByURL"in e)?e.specifiedByURL:void 0},fields:{type:new oe(new V(wo)),args:{includeDeprecated:{type:new V(ge),default:{value:!1}}},resolve(e,{includeDeprecated:t}){if(L(e)||P(e)){let n=Object.values(e.getFields());return t===!0?n:n.filter((r)=>r.deprecationReason==null)}}},interfaces:{type:new oe(new V(mt)),resolve(e){if(L(e)||P(e))return e.getInterfaces()}},possibleTypes:{type:new oe(new V(mt)),resolve(e,t,n,{schema:r}){if(Ke(e))return r.getPossibleTypes(e)}},enumValues:{type:new oe(new V(Ro)),args:{includeDeprecated:{type:new V(ge),default:{value:!1}}},resolve(e,{includeDeprecated:t}){if(z(e)){let n=e.getValues();return t===!0?n:n.filter((r)=>r.deprecationReason==null)}}},inputFields:{type:new oe(new V(_r)),args:{includeDeprecated:{type:new V(ge),default:{value:!1}}},resolve(e,{includeDeprecated:t}){if(k(e)){let n=Object.values(e.getFields());return t===!0?n:n.filter((r)=>r.deprecationReason==null)}}},ofType:{type:mt,resolve:(e)=>("ofType"in e)?e.ofType:void 0},isOneOf:{type:ge,resolve:(e)=>{if(k(e))return e.isOneOf}}})}),wo=new Ee({name:"__Field",description:"Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.",fields:()=>({name:{type:new V(ie),resolve:(e)=>e.name},description:{type:ie,resolve:(e)=>e.description},args:{type:new V(new oe(new V(_r))),args:{includeDeprecated:{type:new V(ge),default:{value:!1}}},resolve(e,{includeDeprecated:t}){return t===!0?e.args:e.args.filter((n)=>n.deprecationReason==null)}},type:{type:new V(mt),resolve:(e)=>e.type},isDeprecated:{type:new V(ge),resolve:(e)=>e.deprecationReason!=null},deprecationReason:{type:ie,resolve:(e)=>e.deprecationReason}})}),_r=new Ee({name:"__InputValue",description:"Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.",fields:()=>({name:{type:new V(ie),resolve:(e)=>e.name},description:{type:ie,resolve:(e)=>e.description},type:{type:new V(mt),resolve:(e)=>e.type},defaultValue:{type:ie,description:"A GraphQL-formatted string representing the default value for this input value.",resolve(e){let t=vr(e);if(t)return ee(t);return null}},isDeprecated:{type:new V(ge),resolve:(e)=>e.deprecationReason!=null},deprecationReason:{type:ie,resolve:(e)=>e.deprecationReason}})}),Ro=new Ee({name:"__EnumValue",description:"One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.",fields:()=>({name:{type:new V(ie),resolve:(e)=>e.name},description:{type:ie,resolve:(e)=>e.description},isDeprecated:{type:new V(ge),resolve:(e)=>e.deprecationReason!=null},deprecationReason:{type:ie,resolve:(e)=>e.deprecationReason}})}),ue={SCALAR:"SCALAR",OBJECT:"OBJECT",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",INPUT_OBJECT:"INPUT_OBJECT",LIST:"LIST",NON_NULL:"NON_NULL"},Lo=new we({name:"__TypeKind",description:"An enum describing what kind of type a given `__Type` is.",values:{SCALAR:{value:ue.SCALAR,description:"Indicates this type is a scalar."},OBJECT:{value:ue.OBJECT,description:"Indicates this type is an object. `fields` and `interfaces` are valid fields."},INTERFACE:{value:ue.INTERFACE,description:"Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields."},UNION:{value:ue.UNION,description:"Indicates this type is a union. `possibleTypes` is a valid field."},ENUM:{value:ue.ENUM,description:"Indicates this type is an enum. `enumValues` is a valid field."},INPUT_OBJECT:{value:ue.INPUT_OBJECT,description:"Indicates this type is an input object. `inputFields` is a valid field."},LIST:{value:ue.LIST,description:"Indicates this type is a list. `ofType` is a valid field."},NON_NULL:{value:ue.NON_NULL,description:"Indicates this type is a non-null. `ofType` is a valid field."}}}),Ii=new zn(void 0,"__schema",{type:new V(br),description:"Access the current type schema of this server.",resolve:(e,t,n,{schema:r})=>r}),vi=new zn(void 0,"__type",{type:mt,description:"Request the type information of a single type.",args:{name:{type:new V(ie)}},resolve:(e,{name:t},n,{schema:r})=>r.getType(t)}),bi=new zn(void 0,"__typename",{type:new V(ie),description:"The name of the current Object type at runtime.",resolve:(e,t,n,{parentType:r})=>r.name}),Mt=Object.freeze([br,Ao,xo,mt,wo,_r,Ro,Lo]);function ht(e){return Mt.some(({name:t})=>e.name===t)}function rr(e){return Le(e,kc,ot)}function Sr(e){if(!rr(e))throw Error(`Expected ${y(e)} to be a GraphQL schema.`);return e}var kc=Symbol("Schema");class ot{constructor(e){this.__kind=kc,this.assumeValid=e.assumeValid??!1,this.__validationErrors=e.assumeValid===!0?[]:void 0,this.description=e.description,this.extensions=We(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=e.extensionASTNodes??[],this._queryType=e.query,this._mutationType=e.mutation,this._subscriptionType=e.subscription,this._directives=e.directives??je;let t=new Set(e.types);if(e.types!=null)for(let n of e.types)t.delete(n),Ut(n,t);if(this._queryType!=null)Ut(this._queryType,t);if(this._mutationType!=null)Ut(this._mutationType,t);if(this._subscriptionType!=null)Ut(this._subscriptionType,t);for(let n of this._directives)if(nr(n))for(let r of n.args)Ut(r.type,t);Ut(br,t),this._typeMap=Object.create(null),this._subTypeMap=new Map,this._implementationsMap=Object.create(null);for(let n of t){if(n==null)continue;let r=n.name;if(this._typeMap[r]!==void 0)throw Error(`Schema must contain uniquely named types but contains multiple types named "${r}".`);if(this._typeMap[r]=n,P(n)){for(let i of n.getInterfaces())if(P(i)){let o=this._implementationsMap[i.name];o??=this._implementationsMap[i.name]={objects:[],interfaces:[]},o.interfaces.push(n)}}else if(L(n)){for(let i of n.getInterfaces())if(P(i)){let o=this._implementationsMap[i.name];o??=this._implementationsMap[i.name]={objects:[],interfaces:[]},o.objects.push(n)}}}}get[Symbol.toStringTag](){return"GraphQLSchema"}getQueryType(){return this._queryType}getMutationType(){return this._mutationType}getSubscriptionType(){return this._subscriptionType}getRootType(e){switch(e){case re.QUERY:return this.getQueryType();case re.MUTATION:return this.getMutationType();case re.SUBSCRIPTION:return this.getSubscriptionType()}}getTypeMap(){return this._typeMap}getType(e){return this.getTypeMap()[e]}getPossibleTypes(e){return te(e)?e.getTypes():this.getImplementations(e).objects}getImplementations(e){return this._implementationsMap[e.name]??{objects:[],interfaces:[]}}isSubType(e,t){let n=this._subTypeMap.get(e);if(n===void 0){if(te(e))n=new Set(e.getTypes());else{let r=this.getImplementations(e);n=new Set([...r.objects,...r.interfaces])}this._subTypeMap.set(e,n)}return n.has(t)}getDirectives(){return this._directives}getDirective(e){return this.getDirectives().find((t)=>t.name===e)}getField(e,t){switch(t){case Ii.name:return this.getQueryType()===e?Ii:void 0;case vi.name:return this.getQueryType()===e?vi:void 0;case bi.name:return bi}if("getFields"in e)return e.getFields()[t];return}toConfig(){return{description:this.description,query:this.getQueryType(),mutation:this.getMutationType(),subscription:this.getSubscriptionType(),types:Object.values(this.getTypeMap()),directives:this.getDirectives(),extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,assumeValid:this.assumeValid}}}function Ut(e,t){let n=pe(e);if(!t.has(n)){if(t.add(n),te(n))for(let r of n.getTypes())Ut(r,t);else if(L(n)||P(n)){for(let r of n.getInterfaces())Ut(r,t);for(let r of Object.values(n.getFields())){Ut(r.type,t);for(let i of r.args)Ut(i.type,t)}}else if(k(n))for(let r of Object.values(n.getFields()))Ut(r.type,t)}return t}function Di(e){if(Sr(e),e.__validationErrors)return e.__validationErrors;let t=new Uc(e);qf(t),Kf(t),Jf(t);let n=t.getErrors();return e.__validationErrors=n,n}function Dr(e){let t=Di(e);if(t.length!==0)throw Error(t.map((n)=>n.message).join(` + +`))}class Uc{constructor(e){this._errors=[],this.schema=e}reportError(e,t){let n=Array.isArray(t)?t.filter(Boolean):t;this._errors.push(new m(e,{nodes:n}))}getErrors(){return this._errors}}function qf(e){let t=e.schema;if(t.getQueryType()==null)e.reportError("Query root type must be provided.",t.astNode);let n=new Fe;for(let r of Object.values(re)){let i=t.getRootType(r);if(i!=null)if(!L(i)){let o=Vu(r),s=y(i);e.reportError(r===re.QUERY?`${o} root type must be Object type, it cannot be ${s}.`:`${o} root type must be Object type if provided, it cannot be ${s}.`,Fc(t,r)??i.astNode)}else n.add(i,r)}for(let[r,i]of n)if(i.length>1){let o=Uu(i);e.reportError(`All root types must be different, "${r}" type is used as ${o} root types.`,i.map((s)=>Fc(t,s)))}}function Fc(e,t){return[e.astNode,...e.extensionASTNodes].flatMap((n)=>n?.operationTypes??[]).find((n)=>n.operation===t)?.type}function Kf(e){for(let t of e.schema.getDirectives()){if(!nr(t)){e.reportError(`Expected directive but got: ${y(t)}.`,t?.astNode);continue}if(ir(e,t),t.locations.length===0)e.reportError(`Directive ${t} must include 1 or more locations.`,t.astNode);for(let n of t.args){if(ir(e,n),!xe(n.type))e.reportError(`The type of ${n} must be Input Type but got: ${y(n.type)}.`,n.astNode);if(ze(n)&&n.deprecationReason!=null)e.reportError(`Required argument ${n} cannot be deprecated.`,[ko(n.astNode),n.astNode?.type]);ga(e,n)}}}function ga(e,t){let n=t.default;if(!n)return;let r=[];if(Na(n,t.type,(i,o)=>{r.push([i,o])}),r.length===0)return;if(!n.literal)try{let i=_i(n.value,t.type),o=[];if(Zn(i,t.type,(s,a)=>{o.push([s,a])}),o.length===0){e.reportError(`${t} has invalid default value: ${y(n.value)}. Did you mean: ${y(i)}?`,t.astNode?.defaultValue);return}}catch(i){}for(let[i,o]of r)e.reportError(`${t} has invalid default value${qn(o)}: ${i.message}`,i.nodes??t.astNode?.defaultValue)}function Na(e,t,n,r){if(e.literal){xn(e.literal,t,n,void 0,void 0,r);return}Zn(e.value,t,n,r)}function _i(e,t){if(w(t))return _i(e,t.ofType);if(e===null)return null;if(j(t)){if(et(e))return Array.from(e,(n)=>_i(n,t.ofType));return[_i(e,t.ofType)]}if(k(t)){if(!ye(e))U(!1);let n=t.getFields();return Gt(e,(r,i)=>{if(!(i in n))U(!1);return _i(r,n[i].type)})}return It(t),t.coerceOutputValue(e)}function ir(e,t){if(t.name.startsWith("__"))e.reportError(`Name "${t.name}" must not begin with "__", which is reserved by GraphQL introspection.`,t.astNode)}function Jf(e){let t=rd(e),n=e.schema.getTypeMap(),r=new Map;for(let o of Object.values(n)){if(!rt(o)){e.reportError(`Expected GraphQL named type but got: ${y(o)}.`,o.astNode);continue}if(!ht(o))ir(e,o);if(L(o))Cc(e,o),Vc(e,o);else if(P(o))Cc(e,o),Vc(e,o);else if(te(o))zf(e,o);else if(z(o))Xf(e,o);else if(k(o))Zf(e,o),i(o),t(o)}td(e,r);function i(o){r.set(o,{inputObj:o,targets:[],dependents:[],unresolvedTargetCount:0,hasFiniteValue:!1})}}function Cc(e,t){let n=Object.values(t.getFields());if(n.length===0)e.reportError(`Type ${t} must define one or more fields.`,[t.astNode,...t.extensionASTNodes]);for(let r of n){if(ir(e,r),!Nt(r.type))e.reportError(`The type of ${r} must be Output Type but got: ${y(r.type)}.`,r.astNode?.type);for(let i of r.args){if(ir(e,i),!xe(i.type))e.reportError(`The type of ${i} must be Input Type but got: ${y(i.type)}.`,i.astNode?.type);if(ze(i)&&i.deprecationReason!=null)e.reportError(`Required argument ${i} cannot be deprecated.`,[ko(i.astNode),i.astNode?.type]);ga(e,i)}}}function Vc(e,t){let n=new Set;for(let r of t.getInterfaces()){if(!P(r)){e.reportError(`Type ${t} must only implement Interface types, it cannot implement ${y(r)}.`,Si(t,r));continue}if(t===r){e.reportError(`Type ${t} cannot implement itself because it would create a circular reference.`,Si(t,r));continue}if(n.has(r.name)){e.reportError(`Type ${t} can only implement ${r} once.`,Si(t,r));continue}n.add(r.name),Hf(e,t,r),Wf(e,t,r)}}function Wf(e,t,n){let r=t.getFields();for(let i of Object.values(n.getFields())){let o=r[i.name];if(o==null){e.reportError(`Interface field ${i} expected but ${t} does not provide it.`,[i.astNode,t.astNode,...t.extensionASTNodes]);continue}if(!Ht(e.schema,o.type,i.type))e.reportError(`Interface field ${i} expects type ${i.type} but ${o} is type ${o.type}.`,[i.astNode?.type,o.astNode?.type]);for(let s of i.args){let a=o.args.find((u)=>u.name===s.name);if(!a){e.reportError(`Interface field argument ${s} expected but ${o} does not provide it.`,[s.astNode,o.astNode]);continue}if(!Nr(s.type,a.type))e.reportError(`Interface field argument ${s} expects type ${s.type} but ${a} is type ${a.type}.`,[s.astNode?.type,a.astNode?.type])}for(let s of o.args)if(ze(s)){if(!i.args.find((u)=>u.name===s.name))e.reportError(`Argument "${s}" must not be required type "${s.type}" if not provided by the Interface field "${i}".`,[s.astNode,i.astNode])}if(o.deprecationReason!=null&&i.deprecationReason==null)e.reportError(`Interface field ${n.name}.${i.name} is not deprecated, so implementation field ${t.name}.${o.name} must not be deprecated.`,[ko(o.astNode),o.astNode?.type])}}function Hf(e,t,n){let r=t.getInterfaces();for(let i of n.getInterfaces())if(!r.includes(i))e.reportError(i===t?`Type ${t} cannot implement ${n} because it would create a circular reference.`:`Type ${t} must implement ${i} because it is implemented by ${n}.`,[...Si(n,i),...Si(t,n)])}function zf(e,t){let n=t.getTypes();if(n.length===0)e.reportError(`Union type ${t} must define one or more member types.`,[t.astNode,...t.extensionASTNodes]);let r=new Set;for(let i of n){if(r.has(i.name)){e.reportError(`Union type ${t} can only include type ${i} once.`,Mc(t,i.name));continue}if(r.add(i.name),!L(i))e.reportError(`Union type ${t} can only include Object types, it cannot include ${y(i)}.`,Mc(t,String(i)))}}function Xf(e,t){let n=t.getValues();if(n.length===0)e.reportError(`Enum type ${t} must define one or more values.`,[t.astNode,...t.extensionASTNodes]);for(let r of n)ir(e,r)}function Zf(e,t){let n=Object.values(t.getFields());if(n.length===0)e.reportError(`Input Object type ${t} must define one or more fields.`,[t.astNode,...t.extensionASTNodes]);for(let r of n){if(ir(e,r),!xe(r.type))e.reportError(`The type of ${r} must be Input Type but got: ${y(r.type)}.`,r.astNode?.type);if(Xe(r)&&r.deprecationReason!=null)e.reportError(`Required input field ${r} cannot be deprecated.`,[ko(r.astNode),r.astNode?.type]);if(ga(e,r),t.isOneOf)ed(t,r,e)}}function ed(e,t,n){if(w(t.type))n.reportError(`OneOf input field ${e}.${t.name} must be nullable.`,t.astNode?.type);if(t.default!==void 0||t.defaultValue!==void 0)n.reportError(`OneOf input field ${e}.${t.name} cannot have a default value.`,t.astNode)}function td(e,t){let n=[];for(let c of t.values()){let l=c.inputObj,p=Object.values(l.getFields());for(let f of p){let d=nd(l,f.type);if(d===void 0)continue;c.targets.push({field:f,target:d});let E=t.get(d);if(E!==void 0)E.dependents.push(c)}if(l.isOneOf){if(p.length===0||c.targets.length<p.length)a(c)}else if(c.unresolvedTargetCount=c.targets.length,c.targets.length===0)a(c)}let r;while((r=n.pop())!==void 0)for(let c of r.dependents){if(c.hasFiniteValue)continue;if(c.inputObj.isOneOf){a(c);continue}if(--c.unresolvedTargetCount,c.unresolvedTargetCount===0)a(c)}let i=new Set,o=[],s=new Map;for(let c of t.values())if(!c.hasFiniteValue)u(c);function a(c){if(!c.hasFiniteValue)c.hasFiniteValue=!0,n.push(c)}function u(c){let l=c.inputObj;if(i.has(l))return;i.add(l),s.set(l,o.length);for(let{field:p,target:f}of c.targets){let d=t.get(f);if(d?.hasFiniteValue!==!1)continue;let E=s.get(f);if(o.push({fieldStr:`${l}.${p.name}`,astNode:p.astNode}),E===void 0)u(d);else{let I=o.slice(E),S=I.map((G)=>G.fieldStr).join(", ");e.reportError(`Input Object ${f} cannot be provided a finite value because it references itself through fields: ${S}.`,I.map((G)=>G.astNode))}o.pop()}s.delete(l)}}function nd(e,t){if(e.isOneOf){if(k(t))return t;return}if(w(t)&&k(t.ofType))return t.ofType}function rd(e){let t=Object.create(null),n=[],r=Object.create(null);return function(u){return i(u,Object.create(null))};function i(a,u){if(et(u)){for(let c of u)i(a,c);return}else if(!ye(u))return;for(let c of Object.values(a.getFields())){let l=pe(c.type);if(!k(l))continue;if(Object.hasOwn(u,c.name))i(l,u[c.name]);else s(c,l,`${a}.${c.name}`)}}function o(a,u){if(u.kind===Ae){for(let l of u.values)o(a,l);return}else if(u.kind!==Ve)return;let c=sn(u.fields,(l)=>l.name.value);for(let l of Object.values(a.getFields())){let p=pe(l.type);if(!k(p))continue;if(Object.hasOwn(c,l.name))o(p,c[l.name].value);else s(l,p,`${a}.${l.name}`)}}function s(a,u,c){let l=a.default;if(l===void 0)return;let p=r[c];if(p!==void 0){e.reportError(`Invalid circular reference. The default value of Input Object field ${c} references itself${p<n.length?` via the default values of: ${n.slice(p).map(([f])=>f).join(", ")}`:""}.`,n.slice(p-1).map(([,f])=>f));return}if(t[c]===void 0){if(t[c]=!0,r[c]=n.push([c,a.astNode?.defaultValue]),l.literal)o(u,l.literal);else i(u,l.value);n.pop(),r[c]=void 0}}}function Si(e,t){let{astNode:n,extensionASTNodes:r}=e;return(n!=null?[n,...r]:r).flatMap((o)=>o.interfaces??[]).filter((o)=>o.name.value===t.name)}function Mc(e,t){let{astNode:n,extensionASTNodes:r}=e;return(n!=null?[n,...r]:r).flatMap((o)=>o.types??[]).filter((o)=>o.name.value===t)}function ko(e){return e?.directives?.find((t)=>t.name.value===mn.name)}function de(e,t,n){return new m(`Syntax Error: ${n}`,{source:e,positions:[t]})}function id(){let e;try{let t=globalThis.process;if(typeof t?.getBuiltinModule==="function")e=t.getBuiltinModule("node:diagnostics_channel")}catch{}return e}var or=id(),Ia=or?.tracingChannel("graphql:parse"),va=or?.tracingChannel("graphql:validate"),Oi=or?.tracingChannel("graphql:execute"),Pc=or?.tracingChannel("graphql:execute:variableCoercion"),ba=or?.tracingChannel("graphql:execute:rootSelectionSet"),_a=or?.tracingChannel("graphql:subscribe"),sr=or?.tracingChannel("graphql:resolve"),od=["start","end","asyncStart","asyncEnd","error"];function st(e){if(e==null)return!1;let t=e.hasSubscribers;if(t!==void 0)return t;for(let n of od)if(e[n].hasSubscribers)return!0;return!1}function Cn(e,t,n){let r=t;return e.start.runStores(r,()=>{let i;try{i=n()}catch(o){throw r.error=o,e.error.publish(r),e.end.publish(r),o}if(!Be(i))return r.result=i,e.end.publish(r),i;return e.end.publish(r),i.then((o)=>(r.result=o,e.asyncStart.publish(r),e.asyncEnd.publish(r),o),(o)=>{throw r.error=o,e.error.publish(r),e.asyncStart.publish(r),e.asyncEnd.publish(r),o})})}var T={SOF:"<SOF>",EOF:"<EOF>",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",DOT:".",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"};class ar{constructor(e){let t=new bn(T.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==T.EOF)do if(e.next)e=e.next;else{let t=sd(this,e.end);e.next=t,t.prev=e,e=t}while(e.kind===T.COMMENT);return e}}function Co(e){return e===T.BANG||e===T.DOLLAR||e===T.AMP||e===T.PAREN_L||e===T.PAREN_R||e===T.DOT||e===T.SPREAD||e===T.COLON||e===T.EQUALS||e===T.AT||e===T.BRACKET_L||e===T.BRACKET_R||e===T.BRACE_L||e===T.PIPE||e===T.BRACE_R}function Or(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function Vo(e,t){return Gc(e.charCodeAt(t))&&jc(e.charCodeAt(t+1))}function Gc(e){return e>=55296&&e<=56319}function jc(e){return e>=56320&&e<=57343}function hn(e,t){let n=e.source.body.codePointAt(t);if(n===void 0)return T.EOF;else if(n>=32&&n<=126){let r=String.fromCodePoint(n);return r==='"'?`'"'`:`"${r}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function me(e,t,n,r,i){let o=e.line,s=1+n-e.lineStart;return new bn(t,n,r,o,s,i)}function sd(e,t){let n=e.source.body,r=n.length,i=t;while(i<r){let o=n.charCodeAt(i);switch(o){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:if(n.charCodeAt(i+1)===10)i+=2;else++i;++e.line,e.lineStart=i;continue;case 35:return ad(e,i);case 33:return me(e,T.BANG,i,i+1);case 36:return me(e,T.DOLLAR,i,i+1);case 38:return me(e,T.AMP,i,i+1);case 40:return me(e,T.PAREN_L,i,i+1);case 41:return me(e,T.PAREN_R,i,i+1);case 46:{let s=n.charCodeAt(i+1);if(s===46&&n.charCodeAt(i+2)===46)return me(e,T.SPREAD,i,i+3);if(s===46)throw de(e.source,i,'Unexpected "..", did you mean "..."?');else if(Kn(s)){let a=e.source.body.slice(i+1,Fo(e,i+1,s));throw de(e.source,i,`Invalid number, expected digit before ".", did you mean "0.${a}"?`)}break}case 58:return me(e,T.COLON,i,i+1);case 61:return me(e,T.EQUALS,i,i+1);case 64:return me(e,T.AT,i,i+1);case 91:return me(e,T.BRACKET_L,i,i+1);case 93:return me(e,T.BRACKET_R,i,i+1);case 123:return me(e,T.BRACE_L,i,i+1);case 124:return me(e,T.PIPE,i,i+1);case 125:return me(e,T.BRACE_R,i,i+1);case 34:if(n.charCodeAt(i+1)===34&&n.charCodeAt(i+2)===34)return dd(e,i);return cd(e,i)}if(Kn(o)||o===45)return ud(e,i,o);if(Jn(o))return Sa(e,i);throw de(e.source,i,o===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:Or(o)||Vo(n,i)?`Unexpected character: ${hn(e,i)}.`:`Invalid character: ${hn(e,i)}.`)}return me(e,T.EOF,r,r)}function ad(e,t){let n=e.source.body,r=n.length,i=t+1;while(i<r){let o=n.charCodeAt(i);if(o===10||o===13)break;if(Or(o))++i;else if(Vo(n,i))i+=2;else break}return me(e,T.COMMENT,t,i,n.slice(t+1,i))}function ud(e,t,n){let r=e.source.body,i=t,o=n,s=!1;if(o===45)o=r.charCodeAt(++i);if(o===48){if(o=r.charCodeAt(++i),Kn(o))throw de(e.source,i,`Invalid number, unexpected digit after 0: ${hn(e,i)}.`)}else i=Fo(e,i,o),o=r.charCodeAt(i);if(o===46)s=!0,o=r.charCodeAt(++i),i=Fo(e,i,o),o=r.charCodeAt(i);if(o===69||o===101){if(s=!0,o=r.charCodeAt(++i),o===43||o===45)o=r.charCodeAt(++i);i=Fo(e,i,o),o=r.charCodeAt(i)}if(o===46||Jn(o))throw de(e.source,i,`Invalid number, expected digit but got: ${hn(e,i)}.`);return me(e,s?T.FLOAT:T.INT,t,i,r.slice(t,i))}function Fo(e,t,n){if(!Kn(n))throw de(e.source,t,`Invalid number, expected digit but got: ${hn(e,t)}.`);let r=e.source.body,i=t+1;while(Kn(r.charCodeAt(i)))++i;return i}function cd(e,t){let n=e.source.body,r=n.length,i=t+1,o=i,s="";while(i<r){let a=n.charCodeAt(i);if(a===34)return s+=n.slice(o,i),me(e,T.STRING,t,i+1,s);if(a===92){s+=n.slice(o,i);let u=n.charCodeAt(i+1)===117?n.charCodeAt(i+2)===123?ld(e,i):pd(e,i):fd(e,i);s+=u.value,i+=u.size,o=i;continue}if(a===10||a===13)break;if(Or(a))++i;else if(Vo(n,i))i+=2;else throw de(e.source,i,`Invalid character within String: ${hn(e,i)}.`)}throw de(e.source,i,"Unterminated string.")}function ld(e,t){let n=e.source.body,r=0,i=3;while(i<12){let o=n.charCodeAt(t+i++);if(o===125){if(i<5||!Or(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|Ai(o),r<0)break}throw de(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function pd(e,t){let n=e.source.body,r=$c(n,t+2);if(Or(r))return{value:String.fromCodePoint(r),size:6};if(Gc(r)){if(n.charCodeAt(t+6)===92&&n.charCodeAt(t+7)===117){let i=$c(n,t+8);if(jc(i))return{value:String.fromCodePoint(r,i),size:12}}}throw de(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function $c(e,t){return Ai(e.charCodeAt(t))<<12|Ai(e.charCodeAt(t+1))<<8|Ai(e.charCodeAt(t+2))<<4|Ai(e.charCodeAt(t+3))}function Ai(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function fd(e,t){let n=e.source.body;switch(n.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:` +`,size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw de(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function dd(e,t){let n=e.source.body,r=n.length,i=e.lineStart,o=t+3,s=o,a="",u=[];while(o<r){let c=n.charCodeAt(o);if(c===34&&n.charCodeAt(o+1)===34&&n.charCodeAt(o+2)===34){a+=n.slice(s,o),u.push(a);let l=me(e,T.BLOCK_STRING,t,o+3,Bu(u).join(` +`));return e.line+=u.length-1,e.lineStart=i,l}if(c===92&&n.charCodeAt(o+1)===34&&n.charCodeAt(o+2)===34&&n.charCodeAt(o+3)===34){a+=n.slice(s,o),s=o+1,o+=4;continue}if(c===10||c===13){if(a+=n.slice(s,o),u.push(a),c===13&&n.charCodeAt(o+1)===10)o+=2;else++o;a="",s=o,i=o;continue}if(Or(c))++o;else if(Vo(n,o))o+=2;else throw de(e.source,o,`Invalid character within String: ${hn(e,o)}.`)}throw de(e.source,o,"Unterminated string.")}function Sa(e,t){let n=e.source.body,r=n.length,i=t+1;while(i<r){let o=n.charCodeAt(i);if(go(o))++i;else break}return me(e,T.NAME,t,i,n.slice(t,i))}class Da{constructor(e){this.line=1,this.lineStart=0;let t=new bn(T.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t}get[Symbol.toStringTag](){return"SchemaCoordinateLexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==T.EOF){let t=md(this,e.end);e.next=t,t.prev=e,e=t}return e}}function md(e,t){let n=e.source.body,r=n.length,i=t;if(i<r){let o=n.charCodeAt(i);switch(o){case 46:return me(e,T.DOT,i,i+1);case 40:return me(e,T.PAREN_L,i,i+1);case 41:return me(e,T.PAREN_R,i,i+1);case 58:return me(e,T.COLON,i,i+1);case 64:return me(e,T.AT,i,i+1)}if(Jn(o))return Sa(e,i);throw de(e.source,i,`Invalid character: ${hn(e,i)}.`)}return me(e,T.EOF,r,r)}var Bc=Symbol("Source");class Pt{constructor(e,t="GraphQL request",n={line:1,column:1}){if(this.__kind=Bc,this.body=e,this.name=t,this.locationOffset=n,!(this.locationOffset.line>0))nt(!1,"line in locationOffset is 1-indexed and must be positive.");if(!(this.locationOffset.column>0))nt(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function xi(e){return Le(e,Bc,Pt)}function bt(e,t){return st(Ia)?Ia.traceSync(()=>Qc(e,t),{source:e}):Qc(e,t)}function Qc(e,t){let n=new Ar(e,t),r=n.parseDocument();return Object.defineProperty(r,"tokenCount",{enumerable:!1,value:n.tokenCount}),r}function Yc(e,t){let n=new Ar(e,t);n.expectToken(T.SOF);let r=n.parseValueLiteral(!1);return n.expectToken(T.EOF),r}function Uo(e,t){let n=new Ar(e,t);n.expectToken(T.SOF);let r=n.parseConstValueLiteral();return n.expectToken(T.EOF),r}function qc(e,t){let n=new Ar(e,t);n.expectToken(T.SOF);let r=n.parseTypeReference();return n.expectToken(T.EOF),r}function Po(e){let t=xi(e)?e:new Pt(e),n=new Da(t),r=new Ar(e,{lexer:n});r.expectToken(T.SOF);let i=r.parseSchemaCoordinate();return r.expectToken(T.EOF),i}class Ar{constructor(e,t={}){let{lexer:n,...r}=t;if(n)this._lexer=n;else{let i=xi(e)?e:new Pt(e);this._lexer=new ar(i)}this._options=r,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){let e=this.expectToken(T.NAME);return this.node(e,{kind:Ne,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:jt,definitions:this.many(T.SOF,this.parseDefinition,T.EOF)})}parseDefinition(){if(this.peek(T.BRACE_L))return this.parseOperationDefinition();let e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(e&&t.kind===T.BRACE_L)throw de(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are not supported on shorthand queries.");if(t.kind===T.NAME){switch(t.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition()}if(e)throw de(this._lexer.source,this._lexer.token.start,"Unexpected description, only GraphQL definitions support descriptions.");switch(t.value){case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(t)}parseOperationDefinition(){let e=this._lexer.token;if(this.peek(T.BRACE_L))return this.node(e,{kind:Tt,operation:re.QUERY,description:void 0,name:void 0,variableDefinitions:void 0,directives:void 0,selectionSet:this.parseSelectionSet()});let t=this.parseDescription(),n=this.parseOperationType(),r;if(this.peek(T.NAME))r=this.parseName();return this.node(e,{kind:Tt,operation:n,description:t,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){let e=this.expectToken(T.NAME);switch(e.value){case"query":return re.QUERY;case"mutation":return re.MUTATION;case"subscription":return re.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(T.PAREN_L,this.parseVariableDefinition,T.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:ri,description:this.parseDescription(),variable:this.parseVariable(),type:(this.expectToken(T.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(T.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let e=this._lexer.token;return this.expectToken(T.DOLLAR),this.node(e,{kind:Ce,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:ao,selections:this.many(T.BRACE_L,this.parseSelection,T.BRACE_R)})}parseSelection(){return this.peek(T.SPREAD)?this.parseFragment():this.parseField()}parseField(){let e=this._lexer.token,t=this.parseName(),n,r;if(this.expectOptionalToken(T.COLON))n=t,r=this.parseName();else r=t;return this.node(e,{kind:an,alias:n,name:r,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(T.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){let t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(T.PAREN_L,t,T.PAREN_R)}parseFragmentArguments(){let e=this.parseFragmentArgument;return this.optionalMany(T.PAREN_L,e,T.PAREN_R)}parseArgument(e=!1){let t=this._lexer.token,n=this.parseName();return this.expectToken(T.COLON),this.node(t,{kind:ii,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragmentArgument(){let e=this._lexer.token,t=this.parseName();return this.expectToken(T.COLON),this.node(e,{kind:uo,name:t,value:this.parseValueLiteral(!1)})}parseFragment(){let e=this._lexer.token;this.expectToken(T.SPREAD);let t=this.expectOptionalKeyword("on");if(!t&&this.peek(T.NAME)){let n=this.parseFragmentName();if(this.peek(T.PAREN_L)&&this._options.experimentalFragmentArguments)return this.node(e,{kind:Dt,name:n,arguments:this.parseFragmentArguments(),directives:this.parseDirectives(!1)});return this.node(e,{kind:Dt,name:n,directives:this.parseDirectives(!1)})}return this.node(e,{kind:_n,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){let e=this._lexer.token,t=this.parseDescription();if(this.expectKeyword("fragment"),this._options.experimentalFragmentArguments===!0)return this.node(e,{kind:Qe,description:t,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()});return this.node(e,{kind:Qe,description:t,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()}parseValueLiteral(e){let t=this._lexer.token;switch(t.kind){case T.BRACKET_L:return this.parseList(e);case T.BRACE_L:return this.parseObject(e);case T.INT:return this.advanceLexer(),this.node(t,{kind:Oe,value:t.value});case T.FLOAT:return this.advanceLexer(),this.node(t,{kind:Bt,value:t.value});case T.STRING:case T.BLOCK_STRING:return this.parseStringLiteral();case T.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:tt,value:!0});case"false":return this.node(t,{kind:tt,value:!1});case"null":return this.node(t,{kind:le});default:return this.node(t,{kind:Ot,value:t.value})}case T.DOLLAR:if(e)if(this.expectToken(T.DOLLAR),this._lexer.token.kind===T.NAME){let n=this._lexer.token.value;throw de(this._lexer.source,t.start,`Unexpected variable "$${n}" in constant value.`)}else throw this.unexpected(t);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){let e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:Ie,value:e.value,block:e.kind===T.BLOCK_STRING})}parseList(e){let t=()=>this.parseValueLiteral(e);return this.node(this._lexer.token,{kind:Ae,values:this.any(T.BRACKET_L,t,T.BRACKET_R)})}parseObject(e){let t=()=>this.parseObjectField(e);return this.node(this._lexer.token,{kind:Ve,fields:this.any(T.BRACE_L,t,T.BRACE_R)})}parseObjectField(e){let t=this._lexer.token,n=this.parseName();return this.expectToken(T.COLON),this.node(t,{kind:un,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){let t=[];while(this.peek(T.AT))t.push(this.parseDirective(e));if(t.length)return t;return}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){let t=this._lexer.token;return this.expectToken(T.AT),this.node(t,{kind:oi,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){let e=this._lexer.token,t;if(this.expectOptionalToken(T.BRACKET_L)){let n=this.parseTypeReference();this.expectToken(T.BRACKET_R),t=this.node(e,{kind:Dn,type:n})}else t=this.parseNamedType();if(this.expectOptionalToken(T.BANG))return this.node(e,{kind:cn,type:t});return t}parseNamedType(){return this.node(this._lexer.token,{kind:Sn,name:this.parseName()})}peekDescription(){return this.peek(T.STRING)||this.peek(T.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");let n=this.parseConstDirectives(),r=this.many(T.BRACE_L,this.parseOperationTypeDefinition,T.BRACE_R);return this.node(e,{kind:Ye,description:t,directives:n,operationTypes:r})}parseOperationTypeDefinition(){let e=this._lexer.token,t=this.parseOperationType();this.expectToken(T.COLON);let n=this.parseNamedType();return this.node(e,{kind:si,operation:t,type:n})}parseScalarTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");let n=this.parseName(),r=this.parseConstDirectives();return this.node(e,{kind:Qt,description:t,name:n,directives:r})}parseObjectTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");let n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:At,description:t,name:n,interfaces:r,directives:i,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(T.AMP,this.parseNamedType):void 0}parseFieldsDefinition(){return this.optionalMany(T.BRACE_L,this.parseFieldDefinition,T.BRACE_R)}parseFieldDefinition(){let e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(T.COLON);let i=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(e,{kind:co,description:t,name:n,arguments:r,type:i,directives:o})}parseArgumentDefs(){return this.optionalMany(T.PAREN_L,this.parseInputValueDef,T.PAREN_R)}parseInputValueDef(){let e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(T.COLON);let r=this.parseTypeReference(),i;if(this.expectOptionalToken(T.EQUALS))i=this.parseConstValueLiteral();let o=this.parseConstDirectives();return this.node(e,{kind:ai,description:t,name:n,type:r,defaultValue:i,directives:o})}parseInterfaceTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");let n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:xt,description:t,name:n,interfaces:r,directives:i,fields:o})}parseUnionTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();return this.node(e,{kind:wt,description:t,name:n,directives:r,types:i})}parseUnionMemberTypes(){return this.expectOptionalToken(T.EQUALS)?this.delimitedMany(T.PIPE,this.parseNamedType):void 0}parseEnumTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();return this.node(e,{kind:Yt,description:t,name:n,directives:r,values:i})}parseEnumValuesDefinition(){return this.optionalMany(T.BRACE_L,this.parseEnumValueDefinition,T.BRACE_R)}parseEnumValueDefinition(){let e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),r=this.parseConstDirectives();return this.node(e,{kind:lo,description:t,name:n,directives:r})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw de(this._lexer.source,this._lexer.token.start,`${Mo(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();return this.node(e,{kind:yt,description:t,name:n,directives:r,fields:i})}parseInputFieldsDefinition(){return this.optionalMany(T.BRACE_L,this.parseInputValueDef,T.BRACE_R)}parseTypeSystemExtension(){let e=this._lexer.lookahead();if(e.kind===T.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension();case"directive":return this.parseDirectiveExtension()}throw this.unexpected(e)}parseSchemaExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");let t=this.parseConstDirectives(),n=this.optionalMany(T.BRACE_L,this.parseOperationTypeDefinition,T.BRACE_R);if(t===void 0&&n===void 0)throw this.unexpected();return this.node(e,{kind:Rt,directives:t,operationTypes:n})}parseScalarTypeExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");let t=this.parseName(),n=this.parseConstDirectives();if(n===void 0)throw this.unexpected();return this.node(e,{kind:ln,name:t,directives:n})}parseObjectTypeExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");let t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(n===void 0&&r===void 0&&i===void 0)throw this.unexpected();return this.node(e,{kind:qt,name:t,interfaces:n,directives:r,fields:i})}parseInterfaceTypeExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");let t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(n===void 0&&r===void 0&&i===void 0)throw this.unexpected();return this.node(e,{kind:Kt,name:t,interfaces:n,directives:r,fields:i})}parseUnionTypeExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");let t=this.parseName(),n=this.parseConstDirectives(),r=this.parseUnionMemberTypes();if(n===void 0&&r===void 0)throw this.unexpected();return this.node(e,{kind:Jt,name:t,directives:n,types:r})}parseEnumTypeExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");let t=this.parseName(),n=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();if(n===void 0&&r===void 0)throw this.unexpected();return this.node(e,{kind:pn,name:t,directives:n,values:r})}parseInputObjectTypeExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");let t=this.parseName(),n=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();if(n===void 0&&r===void 0)throw this.unexpected();return this.node(e,{kind:Lt,name:t,directives:n,fields:r})}parseDirectiveExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("directive"),this.expectToken(T.AT);let t=this.parseName(),n=this.parseConstDirectives();if(n===void 0)throw this.unexpected();return this.node(e,{kind:Tr,name:t,directives:n})}parseDirectiveDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(T.AT);let n=this.parseName(),r=this.parseArgumentDefs(),i=this.parseConstDirectives(),o=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");let s=this.parseDirectiveLocations();return this.node(e,{kind:pt,description:t,name:n,arguments:r,directives:i,repeatable:o,locations:s})}parseDirectiveLocations(){return this.delimitedMany(T.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let e=this._lexer.token,t=this.parseName();if(Object.hasOwn(F,t.value))return t;throw this.unexpected(e)}parseSchemaCoordinate(){let e=this._lexer.token,t=this.expectOptionalToken(T.AT),n=this.parseName(),r;if(!t&&this.expectOptionalToken(T.DOT))r=this.parseName();let i;if((t||r)&&this.expectOptionalToken(T.PAREN_L))i=this.parseName(),this.expectToken(T.COLON),this.expectToken(T.PAREN_R);if(t){if(i)return this.node(e,{kind:Eo,name:n,argumentName:i});return this.node(e,{kind:ho,name:n})}else if(r){if(i)return this.node(e,{kind:mo,name:n,fieldName:r,argumentName:i});return this.node(e,{kind:fo,name:n,memberName:r})}return this.node(e,{kind:po,name:n})}node(e,t){if(this._options.noLocation!==!0)t.loc=new ei(e,this._lexer.lastToken,this._lexer.source);return t}peek(e){return this._lexer.token.kind===e}expectToken(e){let t=this._lexer.token;if(t.kind===e)return this.advanceLexer(),t;throw de(this._lexer.source,t.start,`Expected ${Kc(e)}, found ${Mo(t)}.`)}expectOptionalToken(e){if(this._lexer.token.kind===e)return this.advanceLexer(),!0;return!1}expectKeyword(e){let t=this._lexer.token;if(t.kind===T.NAME&&t.value===e)this.advanceLexer();else throw de(this._lexer.source,t.start,`Expected "${e}", found ${Mo(t)}.`)}expectOptionalKeyword(e){let t=this._lexer.token;if(t.kind===T.NAME&&t.value===e)return this.advanceLexer(),!0;return!1}unexpected(e){let t=e??this._lexer.token;return de(this._lexer.source,t.start,`Unexpected ${Mo(t)}.`)}any(e,t,n){this.expectToken(e);let r=[];while(!this.expectOptionalToken(n))r.push(t.call(this));return r}optionalMany(e,t,n){if(this.expectOptionalToken(e)){let r=[];do r.push(t.call(this));while(!this.expectOptionalToken(n));return r}return}many(e,t,n){this.expectToken(e);let r=[];do r.push(t.call(this));while(!this.expectOptionalToken(n));return r}delimitedMany(e,t){this.expectOptionalToken(e);let n=[];do n.push(t.call(this));while(this.expectOptionalToken(e));return n}advanceLexer(){let{maxTokens:e}=this._options,t=this._lexer.advance();if(t.kind!==T.EOF){if(++this._tokenCounter,e!==void 0&&this._tokenCounter>e)throw de(this._lexer.source,t.start,`Document contains more than ${e} tokens. Parsing aborted.`)}}}function Mo(e){let t=e.value;return Kc(e.kind)+(t!=null?` "${t}"`:"")}function Kc(e){return Co(e)?`"${e}"`:e}function Te(e,t){switch(t.kind){case Dn:{let n=Te(e,t.type);return n&&new oe(n)}case cn:{let n=Te(e,t.type);return n&&new V(n)}case Sn:return e.getType(t.name.value)}}class ur{constructor(e,t,n){if(this._schema=e,this._typeStack=[],this._parentTypeStack=[],this._inputTypeStack=[],this._fieldDefStack=[],this._defaultValueStack=[],this._directive=null,this._argument=null,this._enumValue=null,this._fragmentSignaturesByName=n??(()=>null),this._fragmentSignature=null,this._fragmentArgument=null,t){if(xe(t))this._inputTypeStack.push(t);if(dt(t))this._parentTypeStack.push(t);if(Nt(t))this._typeStack.push(t)}}get[Symbol.toStringTag](){return"TypeInfo"}getType(){return this._typeStack.at(-1)}getParentType(){return this._parentTypeStack.at(-1)}getInputType(){return this._inputTypeStack.at(-1)}getParentInputType(){return this._inputTypeStack.at(-2)}getFieldDef(){return this._fieldDefStack.at(-1)}getDefaultValue(){return this._defaultValueStack.at(-1)}getDirective(){return this._directive}getArgument(){return this._argument}getFragmentSignature(){return this._fragmentSignature}getFragmentSignatureByName(){return this._fragmentSignaturesByName}getFragmentArgument(){return this._fragmentArgument}getEnumValue(){return this._enumValue}enter(e){let t=this._schema;switch(e.kind){case jt:{let n=hd(e);this._fragmentSignaturesByName=(r)=>n.get(r);break}case ao:{let n=pe(this.getType());this._parentTypeStack.push(dt(n)?n:void 0);break}case an:{let n=this.getParentType(),r,i;if(n){if(r=t.getField(n,e.name.value),r)i=r.type}this._fieldDefStack.push(r),this._typeStack.push(Nt(i)?i:void 0);break}case oi:this._directive=t.getDirective(e.name.value);break;case Tt:{let n=t.getRootType(e.operation);this._typeStack.push(L(n)?n:void 0);break}case Dt:{this._fragmentSignature=this.getFragmentSignatureByName()(e.name.value);break}case _n:case Qe:{let n=e.typeCondition,r=n?Te(t,n):pe(this.getType());this._typeStack.push(Nt(r)?r:void 0);break}case ri:{let n=Te(t,e.type);this._inputTypeStack.push(xe(n)?n:void 0);break}case ii:{let n,r,i=this.getDirective()??this.getFieldDef();if(i){if(n=i.args.find((o)=>o.name===e.name.value),n)r=n.type}this._argument=n,this._defaultValueStack.push(n?.default??n?.defaultValue??void 0),this._inputTypeStack.push(xe(r)?r:void 0);break}case uo:{let r=this.getFragmentSignature()?.variableDefinitions.get(e.name.value);this._fragmentArgument=r;let i;if(r)i=Te(this._schema,r.type);this._inputTypeStack.push(xe(i)?i:void 0);break}case Ae:{let n=gr(this.getInputType()),r=j(n)?n.ofType:void 0;this._defaultValueStack.push(void 0),this._inputTypeStack.push(xe(r)?r:void 0);break}case un:{let n=pe(this.getInputType()),r,i;if(k(n)){if(i=n.getFields()[e.name.value],i!=null)r=i.type}this._defaultValueStack.push(i?.default??i?.defaultValue??void 0),this._inputTypeStack.push(xe(r)?r:void 0);break}case Ot:{let n=pe(this.getInputType()),r;if(z(n))r=n.getValue(e.value);this._enumValue=r;break}default:}}leave(e){switch(e.kind){case jt:this._fragmentSignaturesByName=()=>null;break;case ao:this._parentTypeStack.pop();break;case an:this._fieldDefStack.pop(),this._typeStack.pop();break;case oi:this._directive=null;break;case Dt:this._fragmentSignature=null;break;case Tt:case _n:case Qe:this._typeStack.pop();break;case ri:this._inputTypeStack.pop();break;case ii:this._argument=null,this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case uo:{this._fragmentArgument=null,this._defaultValueStack.pop(),this._inputTypeStack.pop();break}case Ae:case un:this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case Ot:this._enumValue=null;break;default:}}}function hd(e){let t=new Map;for(let n of e.definitions)if(n.kind===Qe){let r=new Map;if(n.variableDefinitions)for(let o of n.variableDefinitions)r.set(o.variable.name.value,o);let i={definition:n,variableDefinitions:r};t.set(n.name.value,i)}return t}function xr(e,t){return{enter(...n){let r=n[0];e.enter(r);let i=Hn(t,r.kind).enter;if(i){let o=i.apply(t,n);if(o!==void 0){if(e.leave(r),ni(o))e.enter(o)}return o}},leave(...n){let r=n[0],i=Hn(t,r.kind).leave,o;if(i)o=i.apply(t,n);return e.leave(r),o}}}function $o(e){let t=new Map;return{Directive(n){if(n.name.value===Xt.name||n.name.value===vt.name){let i=n.arguments?.find((s)=>s.name.value==="label")?.value;if(!i||i.kind===le)return;if(i.kind!==Ie){e.reportError(new m(`Argument "@${n.name.value}(label:)" must be a static string.`,{nodes:n}));return}let o=t.get(i.value);if(o!=null)e.reportError(new m('Value for arguments "defer(label:)" and "stream(label:)" must be unique across all Defer/Stream directive usages.',{nodes:[o,n]}));else t.set(i.value,n)}}}}function Go(e){return{OperationDefinition(t){let n=e.getDocument(),r=new Map;for(let s of n.definitions)if(s.kind===Qe)r.set(s.name.value,s);if(t.operation!=="subscription"&&t.operation!=="mutation")return;let o=e.getSchema().getRootType(t.operation);if(o)Oa({context:e,operationType:t.operation,rootType:o,fragments:r,selectionSet:t.selectionSet,visitedFragments:new Set})}}}function Oa({context:e,operationType:t,rootType:n,fragments:r,selectionSet:i,visitedFragments:o}){for(let s of i.selections)if(s.kind==="Field"){let a=s.directives?.find((u)=>u.name.value===vt.name);if(a)e.reportError(new m(`Stream directive cannot be used on root ${t} type "${n}".`,{nodes:a}))}else if(s.kind==="FragmentSpread"){let a=s.name.value;if(o.has(a))continue;let u=r.get(a);if(u){let c=Jc(s);if(c!==void 0)e.reportError(new m(`Defer directive cannot be used on root ${t} type "${n}".`,{nodes:c}));Oa({context:e,operationType:t,rootType:n,fragments:r,selectionSet:u.selectionSet,visitedFragments:o})}o.add(a)}else if(s.kind==="InlineFragment"){let a=Jc(s);if(a!==void 0)e.reportError(new m(`Defer directive cannot be used on root ${t} type "${n}".`,{nodes:a}));Oa({context:e,operationType:t,rootType:n,fragments:r,selectionSet:s.selectionSet,visitedFragments:o})}}function Jc(e){return e.directives?.find((t)=>t.name.value===Xt.name)}function Wc(e){let t=e.arguments?.find((n)=>n.name.value==="if");if(!t)return!1;if(t.value.kind===tt){if(t.value.value)return!1}else if(t.value.kind!==Ce)return!1;return!0}function Ed(e){let t=e.arguments?.find((n)=>n.name.value==="if");if(!t)return!0;if(t.value.kind===tt){if(t.value.value)return!0;return!1}return!0}function Td(e){let t=e.arguments?.find((n)=>n.name.value==="if");if(!t)return!1;if(t?.value.kind===tt){if(t.value.value)return!1;return!0}return!0}function jo(e){return{OperationDefinition(t){if(t.operation!==re.SUBSCRIPTION)return;let n=e.getDocument(),r=new Map;for(let o of n.definitions)if(o.kind===Qe)r.set(o.name.value,o);let i=new Set;Aa({context:e,fragments:r,selectionSet:t.selectionSet,parentNodes:[],visitedFragments:i})}}}function Aa({context:e,fragments:t,selectionSet:n,parentNodes:r,visitedFragments:i}){for(let o of n.selections){let s=o.directives?.find((u)=>u.name.value===kn.name);if(s&&Ed(s))continue;let a=o.directives?.find((u)=>u.name.value===Ln.name);if(a&&Td(a))continue;for(let u of o.directives??[])if(u.name.value===Xt.name){if(!Wc(u))e.reportError(new m("Defer directive not supported on subscription operations. Disable `@defer` by setting the `if` argument to `false`.",{nodes:[u,...r]}))}else if(u.name.value===vt.name){if(!Wc(u))e.reportError(new m("Stream directive not supported on subscription operations. Disable `@stream` by setting the `if` argument to `false`.",{nodes:[u,...r]}))}if(o.kind==="FragmentSpread"){let u=o.name.value;if(i.has(u))continue;i.add(u);let c=t.get(u);if(c)Aa({context:e,fragments:t,parentNodes:[o,...r],selectionSet:c?.selectionSet,visitedFragments:i})}else if(o.selectionSet)Aa({context:e,fragments:t,selectionSet:o.selectionSet,parentNodes:r,visitedFragments:i})}}function Qo(e){return wi(e)||Ri(e)||Li(e)}function wi(e){return e.kind===Tt||e.kind===Qe}function Yo(e){return e.operation===re.SUBSCRIPTION}function Hc(e){return e.kind===an||e.kind===Dt||e.kind===_n}function xa(e){return e.kind===Ce||e.kind===Oe||e.kind===Bt||e.kind===Ie||e.kind===tt||e.kind===le||e.kind===Ot||e.kind===Ae||e.kind===Ve}function Bo(e){return xa(e)&&(e.kind===Ae?e.values.some(Bo):e.kind===Ve?e.fields.some((t)=>Bo(t.value)):e.kind!==Ce)}function zc(e){return e.kind===Sn||e.kind===Dn||e.kind===cn}function Ri(e){return e.kind===Ye||En(e)||e.kind===pt}function En(e){return e.kind===Qt||e.kind===At||e.kind===xt||e.kind===wt||e.kind===Yt||e.kind===yt}function Li(e){return e.kind===Rt||e.kind===Tr||ki(e)}function ki(e){return e.kind===ln||e.kind===qt||e.kind===Kt||e.kind===Jt||e.kind===pn||e.kind===Lt}function Xc(e){return e.kind===po||e.kind===fo||e.kind===mo||e.kind===ho||e.kind===Eo}function qo(e){return{Document(t){for(let n of t.definitions)if(!wi(n)){let r=n.kind===Ye||n.kind===Rt?"schema":'"'+n.name.value+'"';e.reportError(new m(`The ${r} definition is not executable.`,{nodes:n}))}return!1}}}function Ko(e){return{Field(t){let n=e.getParentType();if(n){if(!e.getFieldDef()){let i=e.getSchema(),o=t.name.value,s=qe("to use an inline fragment on",e.hideSuggestions?[]:yd(i,n,o));if(s==="")s=qe(e.hideSuggestions?[]:gd(n,o));e.reportError(new m(`Cannot query field "${o}" on type "${n}".`+s,{nodes:t}))}}}}}function yd(e,t,n){if(!Ke(t))return[];let r=new Set,i=Object.create(null);for(let o of e.getPossibleTypes(t)){if(o.getFields()[n]==null)continue;r.add(o),i[o.name]=1;for(let s of o.getInterfaces()){if(s.getFields()[n]==null)continue;r.add(s),i[s.name]=(i[s.name]??0)+1}}return[...r].sort((o,s)=>{let a=i[s.name]-i[o.name];if(a!==0)return a;if(P(o)&&e.isSubType(o,s))return-1;if(P(s)&&e.isSubType(s,o))return 1;return fn(o.name,s.name)}).map((o)=>o.name)}function gd(e,t){if(L(e)||P(e)){let n=Object.keys(e.getFields());return Je(t,n)}return[]}function Jo(e){return{InlineFragment(t){let n=t.typeCondition;if(n){let r=Te(e.getSchema(),n);if(r&&!dt(r)){let i=ee(n);e.reportError(new m(`Fragment cannot condition on non composite type "${i}".`,{nodes:n}))}}},FragmentDefinition(t){let n=Te(e.getSchema(),t.typeCondition);if(n&&!dt(n)){let r=ee(t.typeCondition);e.reportError(new m(`Fragment "${t.name.value}" cannot condition on non composite type "${r}".`,{nodes:t.typeCondition}))}}}}function Wo(e){return{...wa(e),FragmentArgument(t){let n=e.getFragmentSignature();if(n){if(!n.variableDefinitions.get(t.name.value)){let i=t.name.value,o=e.hideSuggestions?[]:Je(i,Array.from(n.variableDefinitions.values()).map((s)=>s.variable.name.value));e.reportError(new m(`Unknown argument "${i}" on fragment "${n.definition.name.value}".`+qe(o),{nodes:t}))}}},Argument(t){let n=e.getArgument(),r=e.getFieldDef();if(!n&&r){let i=t.name.value,o=e.hideSuggestions?[]:Je(i,r.args.map((s)=>s.name));e.reportError(new m(`Unknown argument "${i}" on field "${r}".`+qe(o),{nodes:t}))}}}}function wa(e){let t=new Map,n=e.getSchema(),r=n?n.getDirectives():je;for(let o of r)t.set(o.name,o.args.map((s)=>s.name));let i=e.getDocument().definitions;for(let o of i)if(o.kind===pt){let s=o.arguments??[];t.set(o.name.value,s.map((a)=>a.name.value))}return{Directive(o){let s=o.name.value,a=t.get(s);if(o.arguments!=null&&a!=null)for(let u of o.arguments){let c=u.name.value;if(!a.includes(c)){let l=Je(c,a);e.reportError(new m(`Unknown argument "${c}" on directive "@${s}".`+(e.hideSuggestions?"":qe(l)),{nodes:u}))}}return!1}}}function Fi(e){let t=new Map,n=e.getSchema(),r=n?n.getDirectives():je;for(let o of r)t.set(o.name,o.locations);let i=e.getDocument().definitions;for(let o of i)if(o.kind===pt)t.set(o.name.value,o.locations.map((s)=>s.value));return{Directive(o,s,a,u,c){let l=o.name.value,p=t.get(l);if(p==null){e.reportError(new m(`Unknown directive "@${l}".`,{nodes:o}));return}let f=Nd(c);if(f!=null&&!p.includes(f))e.reportError(new m(`Directive "@${l}" may not be used on ${f}.`,{nodes:o}))}}}function Nd(e){let t=e.at(-1);if(!(t!=null&&("kind"in t)))U(!1);switch(t.kind){case Tt:return Id(t.operation);case an:return F.FIELD;case Dt:return F.FRAGMENT_SPREAD;case _n:return F.INLINE_FRAGMENT;case Qe:return F.FRAGMENT_DEFINITION;case ri:{let n=e[e.length-3];if(!("kind"in n))U(!1);return n.kind===Tt?F.VARIABLE_DEFINITION:F.FRAGMENT_VARIABLE_DEFINITION}case Ye:case Rt:return F.SCHEMA;case Qt:case ln:return F.SCALAR;case At:case qt:return F.OBJECT;case co:return F.FIELD_DEFINITION;case xt:case Kt:return F.INTERFACE;case wt:case Jt:return F.UNION;case Yt:case pn:return F.ENUM;case lo:return F.ENUM_VALUE;case yt:case Lt:return F.INPUT_OBJECT;case ai:{let n=e.at(-3);if(!(n!=null&&("kind"in n)))U(!1);return n.kind===yt||n.kind===Lt?F.INPUT_FIELD_DEFINITION:F.ARGUMENT_DEFINITION}case pt:case Tr:return F.DIRECTIVE_DEFINITION;default:U(!1,"Unexpected kind: "+y(t.kind))}}function Id(e){switch(e){case re.QUERY:return F.QUERY;case re.MUTATION:return F.MUTATION;case re.SUBSCRIPTION:return F.SUBSCRIPTION}}function Ho(e){return{FragmentSpread(t){let n=t.name.value;if(!e.getFragment(n))e.reportError(new m(`Unknown fragment "${n}".`,{nodes:t.name}))}}}function zo(e){let t=e.getSchema();return{OperationDefinition(n){let r=n.operation;if(!t.getRootType(r))e.reportError(new m(`The ${r} operation is not supported by the schema.`,{nodes:n}))}}}function Ci(e){let{definitions:t}=e.getDocument(),n=e.getSchema()?.getTypeMap()??{},r=new Set([...Object.keys(n),...t.filter(En).map((i)=>i.name.value)]);return{NamedType(i,o,s,a,u){let c=i.name.value;if(!r.has(c)){let l=u[2]??s,p=l!=null&&vd(l);if(p&&Zc.has(c))return;let f=e.hideSuggestions?[]:Je(c,p?[...Zc,...r]:[...r]);e.reportError(new m(`Unknown type "${c}".`+qe(f),{nodes:i}))}}}}var Zc=new Set([...Ct,...Mt].map((e)=>e.name));function vd(e){return"kind"in e&&(Ri(e)||Li(e))}function Xo(e){let t=0;return{Document(n){t=n.definitions.filter((r)=>r.kind===Tt).length},OperationDefinition(n){if(!n.name&&t>1)e.reportError(new m("This anonymous operation must be the only defined operation.",{nodes:n}))}}}function Zo(e){let t=e.getSchema(),n=t?.astNode??t?.getQueryType()??t?.getMutationType()??t?.getSubscriptionType(),r=0;return{SchemaDefinition(i){if(n){e.reportError(new m("Cannot define a new schema within a schema extension.",{nodes:i}));return}if(r>0)e.reportError(new m("Must provide only one schema definition.",{nodes:i}));++r}}}var bd=3;function es(e){function t(n,r=Object.create(null),i=0){if(n.kind===Dt){let o=n.name.value;if(r[o]===!0)return!1;let s=e.getFragment(o);if(!s)return!1;try{return r[o]=!0,t(s,r,i)}finally{r[o]=void 0}}if(n.kind===an&&(n.name.value==="fields"||n.name.value==="interfaces"||n.name.value==="possibleTypes"||n.name.value==="inputFields")){if(i++,i>=bd)return!0}if("selectionSet"in n&&n.selectionSet){for(let o of n.selectionSet.selections)if(t(o,r,i))return!0}return!1}return{Field(n){if(n.name.value==="__schema"||n.name.value==="__type"){if(t(n))return e.reportError(new m("Maximum introspection depth exceeded",{nodes:[n]})),!1}}}}function ts(e){let t=new Set,n=[],r=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition(o){return i(o),!1}};function i(o){if(t.has(o.name.value))return;let s=o.name.value;t.add(s);let a=e.getFragmentSpreads(o.selectionSet);if(a.length===0)return;r[s]=n.length;for(let u of a){let c=u.name.value,l=r[c];if(n.push(u),l===void 0){let p=e.getFragment(c);if(p)i(p)}else{let p=n.slice(l),f=p.slice(0,-1).map((d)=>'"'+d.name.value+'"').join(", ");e.reportError(new m(`Cannot spread fragment "${c}" within itself`+(f!==""?` via ${f}.`:"."),{nodes:p}))}n.pop()}r[s]=void 0}}function ns(e){return{OperationDefinition(t){let n=new Set(t.variableDefinitions?.map((i)=>i.variable.name.value)),r=e.getRecursiveVariableUsages(t);for(let{node:i,fragmentVariableDefinition:o}of r){if(o)continue;let s=i.name.value;if(!n.has(s))e.reportError(new m(t.name?`Variable "$${s}" is not defined by operation "${t.name.value}".`:`Variable "$${s}" is not defined.`,{nodes:[i,t]}))}}}}function rs(e){let t=new Set,n=[];return{OperationDefinition(r){for(let i of e.getRecursivelyReferencedFragments(r))t.add(i.name.value);return!1},FragmentDefinition(r){return n.push(r),!1},Document:{leave(){for(let r of n){let i=r.name.value;if(!t.has(i))e.reportError(new m(`Fragment "${i}" is never used.`,{nodes:r}))}}}}}function is(e){return{FragmentDefinition(t){let n=e.getVariableUsages(t),r=new Set(n.map(({node:o})=>o.name.value)),i=t.variableDefinitions??[];for(let o of i){let s=o.variable.name.value;if(!r.has(s))e.reportError(new m(`Variable "$${s}" is never used in fragment "${t.name.value}".`,{nodes:o}))}},OperationDefinition(t){let n=e.getRecursiveVariableUsages(t),r=new Set;for(let{node:o,fragmentVariableDefinition:s}of n){let a=o.name.value;if(!s)r.add(a)}let i=t.variableDefinitions??[];for(let o of i){let s=o.variable.name.value;if(!r.has(s))e.reportError(new m(t.name?`Variable "$${s}" is never used in operation "${t.name.value}".`:`Variable "$${s}" is never used.`,{nodes:o}))}}}}function cr(e){switch(e.kind){case Ve:return{...e,fields:_d(e.fields)};case Ae:return{...e,values:e.values.map(cr)};case Oe:case Bt:case Ie:case tt:case le:case Ot:case Ce:return e}}function _d(e){return e.map((t)=>({...t,value:cr(t.value)})).sort((t,n)=>fn(t.name.value,n.name.value))}function nl(e){if(Array.isArray(e))return e.map(([t,n])=>`subfields "${t}" conflict because `+nl(n)).join(" and ");return e}function us(e){let t=new Ca,n=new ol,r=new Map;return{SelectionSet(i){let o=Sd(e,r,t,n,e.getParentType(),i);for(let[[s,a],u,c]of o){let l=nl(a);e.reportError(new m(`Fields "${s}" conflict because ${l}. Use different aliases on the fields to fetch both if this was intentional.`,{nodes:u.concat(c)}))}}}}function Sd(e,t,n,r,i,o){let s=[],[a,u]=as(e,t,i,o,void 0);if(Od(e,s,t,n,r,a),u.length!==0)for(let c=0;c<u.length;c++){os(e,s,t,n,r,!1,a,u[c]);for(let l=c+1;l<u.length;l++)ss(e,s,t,n,r,!1,u[c],u[l])}return s}function os(e,t,n,r,i,o,s,a){if(r.has(s,a.key,o))return;r.add(s,a.key,o);let u=e.getFragment(a.node.name.value);if(!u)return;let[c,l]=La(e,n,u,a.varMap);if(s===c)return;ka(e,t,n,r,i,o,s,void 0,c,a.varMap);for(let p of l)os(e,t,n,r,i,o,s,p)}function ss(e,t,n,r,i,o,s,a){if(s.key===a.key)return;if(s.node.name.value===a.node.name.value){if(!Fa(s.node.arguments,s.varMap,a.node.arguments,a.varMap)){e.reportError(new m(`Spreads "${s.node.name.value}" conflict because ${s.key} and ${a.key} have different fragment arguments.`,{nodes:[s.node,a.node]}));return}}if(i.has(s.key,a.key,o))return;i.add(s.key,a.key,o);let u=e.getFragment(s.node.name.value),c=e.getFragment(a.node.name.value);if(!u||!c)return;let[l,p]=La(e,n,u,s.varMap),[f,d]=La(e,n,c,a.varMap);ka(e,t,n,r,i,o,l,s.varMap,f,a.varMap);for(let E of d)ss(e,t,n,r,i,o,s,E);for(let E of p)ss(e,t,n,r,i,o,E,a)}function Dd(e,t,n,r,i,o,s,a,u,c,l){let p=[],[f,d]=as(e,t,o,s,a),[E,I]=as(e,t,u,c,l);ka(e,p,t,n,r,i,f,a,E,l);for(let S of I)os(e,p,t,n,r,i,f,S);for(let S of d)os(e,p,t,n,r,i,E,S);for(let S of d)for(let G of I)ss(e,p,t,n,r,i,S,G);return p}function Od(e,t,n,r,i,o){for(let[s,a]of o.entries())if(a.length>1)for(let u=0;u<a.length;u++)for(let c=u+1;c<a.length;c++){let l=rl(e,n,r,i,!1,s,a[u],void 0,a[c],void 0);if(l)t.push(l)}}function ka(e,t,n,r,i,o,s,a,u,c){for(let[l,p]of s.entries()){let f=u.get(l);if(f!=null)for(let d of p)for(let E of f){let I=rl(e,n,r,i,o,l,d,a,E,c);if(I)t.push(I)}}}function rl(e,t,n,r,i,o,s,a,u,c){let[l,p,f]=s,[d,E,I]=u,S=i||l!==d&&L(l)&&L(d);if(!S){let A=p.name.value,h=E.name.value;if(A!==h)return[[o,`"${A}" and "${h}" are different fields`],[p],[E]];if(!Fa(p.arguments,a,E.arguments,c))return[[o,"they have differing arguments"],[p],[E]]}let G=p.directives,Z=E.directives,W=Ad(G,a,Z,c);if(W!==void 0)return[[o,W],[p],[E]];let H=f?.type,Y=I?.type;if(H&&Y&&Ra(H,Y))return[[o,`they return conflicting types "${y(H)}" and "${y(Y)}"`],[p],[E]];let ne=p.selectionSet,b=E.selectionSet;if(ne&&b){let A=Dd(e,t,n,r,S,pe(H),ne,a,pe(Y),b,c);return wd(A,o,p,E)}}function Fa(e,t,n,r){if(e===void 0||e.length===0)return n===void 0||n.length===0;if(n===void 0||n.length===0)return!1;if(e.length!==n.length)return!1;let i=new Map(n.map(({name:o,value:s})=>[o.value,r===void 0?s:Vi(s,r)]));return e.every((o)=>{let s=o.value;if(t)s=Vi(s,t);let a=i.get(o.name.value);if(a===void 0)return!1;return el(s)===el(a)})}function Vi(e,t){switch(e.kind){case Ce:return t.get(e.name.value)??e;case Ae:return{...e,values:e.values.map((n)=>Vi(n,t))};case Ve:return{...e,fields:e.fields.map((n)=>({...n,value:Vi(n.value,t)}))};default:return e}}function el(e){return ee(cr(e))}function tl(e){return e?.find((t)=>t.name.value==="stream")}function Ad(e,t,n,r){let i=tl(e),o=tl(n);if(!i&&!o)return;else if(i&&o){if(Fa(i.arguments,t,o.arguments,r))return"they have overlapping stream directives. See https://github.com/graphql/defer-stream-wg/discussions/100";return"they have overlapping stream directives"}return"they have overlapping stream directives"}function Ra(e,t){if(j(e))return j(t)?Ra(e.ofType,t.ofType):!0;if(j(t))return!0;if(w(e))return w(t)?Ra(e.ofType,t.ofType):!0;if(w(t))return!0;if(ve(e)||ve(t))return e!==t;return!1}function as(e,t,n,r,i){let o=t.get(r);if(o)return o;let s=new Map,a=new Map;il(e,n,r,s,a,i);let u=[s,Array.from(a.values())];return t.set(r,u),u}function La(e,t,n,r){let i=t.get(n.selectionSet);if(i)return i;let o=Te(e.getSchema(),n.typeCondition);return as(e,t,o,n.selectionSet,r)}function il(e,t,n,r,i,o){for(let s of n.selections)switch(s.kind){case an:{let a=s.name.value,u;if(L(t)||P(t))u=t.getFields()[a];let c=s.alias?s.alias.value:a,l=r.get(c);if(l==null)l=[],r.set(c,l);l.push([t,s,u]);break}case Dt:{let a=xd(e,s,o);i.set(a.key,a);break}case _n:{let a=s.typeCondition,u=a?Te(e.getSchema(),a):t;il(e,u,s.selectionSet,r,i,o);break}}}function xd(e,t,n){let r="",i=new Map,o=e.getFragmentSignatureByName()(t.name.value),s=new Map;if(t.arguments)for(let a of t.arguments)s.set(a.name.value,a.value);if(o?.variableDefinitions){r+=t.name.value+"(";for(let[a,u]of o.variableDefinitions){let c=s.get(a);if(c)r+=a+": "+ee(cr(c));let l=s.get(a);if(l!==void 0)i.set(a,n!==void 0?Vi(l,n):l);else if(u.defaultValue)i.set(a,u.defaultValue)}r+=")"}return{key:r,node:t,varMap:i.size>0?i:void 0}}function wd(e,t,n,r){if(e.length>0)return[[t,e.map(([i])=>i)],[n,...e.map(([,i])=>i).flat()],[r,...e.map(([,,i])=>i).flat()]]}class Ca{constructor(){this._data=new Map}has(e,t,n){let r=this._data.get(e)?.get(t);if(r===void 0)return!1;return n?!0:n===r}add(e,t,n){let r=this._data.get(e);if(r===void 0)this._data.set(e,new Map([[t,n]]));else r.set(t,n)}}class ol{constructor(){this._orderedPairSet=new Ca}has(e,t,n){return e<t?this._orderedPairSet.has(e,t,n):this._orderedPairSet.has(t,e,n)}add(e,t,n){if(e<t)this._orderedPairSet.add(e,t,n);else this._orderedPairSet.add(t,e,n)}}function cs(e){return{InlineFragment(t){let n=e.getType(),r=e.getParentType();if(dt(n)&&dt(r)&&!mi(e.getSchema(),n,r)){let i=y(r),o=y(n);e.reportError(new m(`Fragment cannot be spread here as objects of type "${i}" can never be of type "${o}".`,{nodes:t}))}},FragmentSpread(t){let n=t.name.value,r=Rd(e,n),i=e.getParentType();if(r&&i&&!mi(e.getSchema(),r,i)){let o=y(i),s=y(r);e.reportError(new m(`Fragment "${n}" cannot be spread here as objects of type "${o}" can never be of type "${s}".`,{nodes:t}))}}}}function Rd(e,t){let n=e.getFragment(t);if(n){let r=Te(e.getSchema(),n.typeCondition);if(dt(r))return r}}function ls(e){let t=e.getSchema(),n=new Map;for(let i of e.getDocument().definitions)if(En(i))n.set(i.name.value,i);return{ScalarTypeExtension:r,ObjectTypeExtension:r,InterfaceTypeExtension:r,UnionTypeExtension:r,EnumTypeExtension:r,InputObjectTypeExtension:r};function r(i){let o=i.name.value,s=n.get(o),a=t?.getType(o),u;if(s!=null)u=Ld[s.kind];else if(a)u=kd(a);if(u!=null){if(u!==i.kind){let c=Fd(i.kind);e.reportError(new m(`Cannot extend non-${c} type "${o}".`,{nodes:s?[s,i]:i}))}}else{let c=[...n.keys(),...Object.keys(t?.getTypeMap()??{})];e.reportError(new m(`Cannot extend type "${o}" because it is not defined.`+qe(Je(o,c)),{nodes:i.name}))}}}var Ld={[Qt]:ln,[At]:qt,[xt]:Kt,[wt]:Jt,[Yt]:pn,[yt]:Lt};function kd(e){if(ae(e))return ln;if(L(e))return qt;if(P(e))return Kt;if(te(e))return Jt;if(z(e))return pn;if(k(e))return Lt;U(!1,"Unexpected type: "+y(e))}function Fd(e){switch(e){case ln:return"scalar";case qt:return"object";case Kt:return"interface";case Jt:return"union";case pn:return"enum";case Lt:return"input object";default:U(!1,"Unexpected kind: "+y(e))}}function ps(e){return{...Va(e),Field:{leave(t){let n=e.getFieldDef();if(!n)return!1;let r=new Set(t.arguments?.map((i)=>i.name.value));for(let i of n.args)if(!r.has(i.name)&&ze(i))e.reportError(new m(`Argument "${i}" of type "${i.type}" is required, but it was not provided.`,{nodes:t}))}},FragmentSpread:{leave(t){let n=e.getFragmentSignature();if(!n)return!1;let r=new Set(t.arguments?.map((i)=>i.name.value));for(let[i,o]of n.variableDefinitions)if(!r.has(i)&&sl(o)){let s=Te(e.getSchema(),o.type),a=y(s);e.reportError(new m(`Fragment "${t.name.value}" argument "${i}" of type "${a}" is required, but it was not provided.`,{nodes:t}))}}}}}function Va(e){let t=new Map,r=e.getSchema()?.getDirectives()??je;for(let o of r)t.set(o.name,new Map(o.args.filter(ze).map((s)=>[s.name,s])));let i=e.getDocument().definitions;for(let o of i)if(o.kind===pt){let s=o.arguments??[];t.set(o.name.value,new Map(s.filter(sl).map((a)=>[a.name.value,a])))}return{Directive:{leave(o){let s=o.name.value,a=t.get(s);if(a!=null){let u=o.arguments??[],c=new Set(u.map((l)=>l.name.value));for(let[l,p]of a.entries())if(!c.has(l)){let f=yr(p.type)?y(p.type):ee(p.type);e.reportError(new m(`Argument "@${s}(${l}:)" of type "${f}" is required, but it was not provided.`,{nodes:o}))}}}}}}function sl(e){return e.type.kind===cn&&e.defaultValue==null}function fs(e){return{Field(t){let n=e.getType(),r=t.selectionSet;if(n){if(ve(pe(n))){if(r){let i=t.name.value,o=y(n);e.reportError(new m(`Field "${i}" must not have a selection since type "${o}" has no subfields.`,{nodes:r}))}}else if(!r){let i=t.name.value,o=y(n);e.reportError(new m(`Field "${i}" of type "${o}" must have a selection of subfields. Did you mean "${i} { ... }"?`,{nodes:t}))}else if(r.selections.length===0){let i=t.name.value,o=y(n);e.reportError(new m(`Field "${i}" of type "${o}" must have at least one field selected.`,{nodes:t}))}}}}}function Tn(e,t){if(w(t)){if(e==null)return;return Tn(e,t.ofType)}if(e==null)return null;if(j(t)){if(!et(e)){let i=Tn(e,t.ofType);if(i===void 0)return;return[i]}let r=[];for(let i of e){let o=Tn(i,t.ofType);if(o===void 0)return;r.push(o)}return r}if(k(t)){if(!ye(e)||Array.isArray(e))return;let r=Object.create(null),i=t.getFields(),o=0;for(let s of Object.keys(e)){if(e[s]===void 0)continue;if(o++,!Object.hasOwn(i,s))return}for(let s of Object.values(i)){let a=e[s.name];if(a===void 0){if(Xe(s))return;let u=ds(s);if(u!==void 0)r[s.name]=u}else{let u=Tn(a,s.type);if(u===void 0)return;r[s.name]=u}}if(t.isOneOf){let s=Object.keys(r);if(o!==1||s.length!==1)return;let a=s[0];if(r[a]===null)return}return r}let n=It(t);try{return n.coerceInputValue(e)}catch(r){}}function yn(e,t,n,r){if(e.kind===Ce){let o=al(e,n,r);if(o==null&&w(t))return;return o}if(w(t)){if(e.kind===le)return;return yn(e,t.ofType,n,r)}if(e.kind===le)return null;if(j(t)){if(e.kind!==Ae){let s=yn(e,t.ofType,n,r);if(s===void 0)return;return[s]}let o=[];for(let s of e.values){let a=yn(s,t.ofType,n,r);if(a===void 0)if(s.kind===Ce&&al(s,n,r)==null&&!w(t.ofType))a=null;else return;o.push(a)}return o}if(k(t)){if(e.kind!==Ve)return;let o=Object.create(null),s=t.getFields();if(e.fields.some((c)=>!Object.hasOwn(s,c.name.value)))return;let u=new Map(e.fields.map((c)=>[c.name.value,c]));for(let c of Object.values(s)){let l=u.get(c.name);if(!l||l.value.kind===Ce&&Cd(l.value,n,r)){if(Xe(c))return;let p=ds(c);if(p!==void 0)o[c.name]=p}else{let p=yn(l.value,c.type,n,r);if(p===void 0)return;o[c.name]=p}}if(t.isOneOf){let c=Object.keys(o);if(u.size!==1||c.length!==1)return;for(let[l,p]of u)if(p.value.kind===le||o[l]===null)return}return o}let i=It(t);try{return i.coerceInputLiteral?i.coerceInputLiteral(dn(e,n,r)):i.parseLiteral(e,n?.coerced)}catch(o){}}function al(e,t,n){let r=e.name.value;if(n?.sources[r]!==void 0)return n.coerced[r];return t?.coerced[r]}function Cd(e,t,n){let r=e.name.value;return(n?.sources[r]!==void 0?n.coerced:t?.coerced)?.[r]===void 0}function ds(e){let t=e._memoizedCoercedDefaultValue;if(t!==void 0)return t;let n=e.default;if(n!==void 0){if(t=n.literal?yn(n.literal,e.type):Tn(n.value,e.type),t===void 0)U(!1,`Expected value of type "${e.type}" to be valid, found: ${y(n.literal??n.value)}.`);return e._memoizedCoercedDefaultValue=t,t}let r=e.defaultValue;if(r!==void 0)e._memoizedCoercedDefaultValue=r;return r}function ms(e,t){let n=t.variable.name.value,r=Te(e,t.type);if(!xe(r)){let o=ee(t.type);return new m(`Variable "$${n}" expected value of type "${o}" which cannot be used as an input type.`,{nodes:t.type})}let i=t.defaultValue;return{name:n,type:r,default:i&&{literal:i}}}function Mi(e,t,n,r){let i=[],o=r?.maxErrors;try{let s=Vd(e,t,n,(a)=>{if(o!=null&&i.length>=o)throw new m("Too many errors processing variables, error limit reached. Execution aborted.");i.push(a)},r?.hideSuggestions);if(i.length===0)return{variableValues:s}}catch(s){i.push(De(s))}return{errors:i}}function Vd(e,t,n,r,i){let o=Object.create(null),s=Object.create(null);for(let a of t){let u=ms(e,a);if(u instanceof m){r(u);continue}let{name:c,type:l}=u,p=Object.hasOwn(n,c)?n[c]:void 0;if(p===void 0){if(o[c]={signature:u},a.defaultValue){Ua(s,c,u,(d,E)=>{r(new m(`Variable "$${c}" has invalid default value${qn(E)}: ${d.message}`,{nodes:a}))},i);continue}else if(!w(l))continue}else o[c]={signature:u,value:p};let f=Tn(p,l);if(f!==void 0)s[c]=f;else Zn(p,l,(d,E)=>{r(new m(`Variable "$${c}" has invalid value${qn(E)}: ${d.message}`,{nodes:a,originalError:d}))},i)}return{sources:o,coerced:s}}function Ua(e,t,n,r,i){try{let o=ds(n);if(o!==void 0)e[t]=o}catch(o){let s=n.default;if(s===void 0)throw o;let a=!1;if(Na(s,n.type,(u,c)=>{a=!0,r(u,c)},i),!a)r(De(o),[])}}function ul(e,t,n,r,i){let o=e.arguments??[],s=new Map(o.map((c)=>[c.name.value,c])),a=Object.create(null),u=Object.create(null);for(let[c,l]of Object.entries(t)){let p=s.get(c);if(p!==void 0)a[c]=r==null?{signature:l,value:p.value}:{signature:l,value:p.value,fragmentVariableValues:r};else a[c]={signature:l};cl(u,e,c,l,p,n,r,i)}return{sources:a,coerced:u}}function _t(e,t,n,r,i){let o=Object.create(null),s=t.arguments??[],a=new Map(s.map((u)=>[u.name.value,u]));for(let u of e.args){let c=u.name;cl(o,t,c,u,a.get(u.name),n,r,i)}return o}function cl(e,t,n,r,i,o,s,a){let u=r.type,c=(f,d)=>{throw new m(`${Ma(r,t)} has invalid default value${qn(d)}: ${f.message}`,{nodes:t})};if(!i){if(ze(r))throw new m(`${Ma(r,t)} of required type "${u}" was not provided.`,{nodes:t});Ua(e,n,r,c,a);return}let l=i.value;if(l.kind===Ce){let f=l.name.value,d=s?.sources[f]?s:o;if((d==null||!Object.hasOwn(d.coerced,f))&&!ze(r)){Ua(e,n,r,c,a);return}}let p=yn(l,u,o,s);if(p===void 0)xn(l,u,(f,d)=>{throw f.message=`${Ma(r,t)} has invalid value${qn(d)}: ${f.message}`,f},o,s,a),U(!1,"Invalid argument");e[n]=p}function Ma(e,t){return li(e)?`Argument "${e}"`:`Variable "$${e.name}" defined by fragment "${t.name.value}"`}function Zt(e,t,n,r,i){let o=t.directives?.find((s)=>s.name.value===e.name);if(o)return _t(e,o,n,r,i)}function wr(e,t,n,r,i,o,s=!1){let a=new Fe,u=[],c={schema:e,fragments:t,variableValues:n,runtimeType:r,visitedFragmentNames:new Map,hideSuggestions:o,forbiddenDirectiveInstances:[],forbidSkipAndInclude:s};return Ui(c,i,a,u),{groupedFieldSet:a,newDeferUsages:u,forbiddenDirectiveInstances:c.forbiddenDirectiveInstances}}function fl(e,t,n,r,i,o){let s={schema:e,fragments:t,variableValues:n,runtimeType:r,visitedFragmentNames:new Map,hideSuggestions:o,forbiddenDirectiveInstances:[],forbidSkipAndInclude:!1},a=new Fe,u=[];for(let c of i){let l=c.node.selectionSet;if(l){let{deferUsage:p,fragmentVariableValues:f}=c;Ui(s,l,a,u,p,f)}}return{groupedFieldSet:a,newDeferUsages:u}}function Ui(e,t,n,r,i,o){let{schema:s,fragments:a,variableValues:u,runtimeType:c,visitedFragmentNames:l,hideSuggestions:p}=e;for(let f of t.selections)switch(f.kind){case an:{if(!Pa(e,f,u,o))continue;n.add(Md(f),{node:f,deferUsage:i,fragmentVariableValues:o});break}case _n:{if(!Pa(e,f,u,o)||!pl(s,f,c))continue;let d=ll(u,o,f,i);if(!d)Ui(e,f.selectionSet,n,r,i,o);else r.push(d),Ui(e,f.selectionSet,n,r,d,o);break}case Dt:{let d=f.name.value;if(!Pa(e,f,u,o))continue;let E=a[d];if(E==null||!pl(s,E.definition,c))continue;let I=ll(u,o,f,i),S=l.get(d),G;if(!I){if(S===!1)continue;l.set(d,!1),G=i}else{if(S!==void 0)continue;l.set(d,!0),r.push(I),G=I}let Z=E.variableSignatures,W;if(Z)W=ul(f,Z,u,o,p);Ui(e,E.definition.selectionSet,n,r,G,W);break}}}function ll(e,t,n,r){let i=Zt(Xt,n,e,t);if(!i)return;if(i.if===!1)return;return{label:typeof i.label==="string"?i.label:void 0,parentDeferUsage:r}}function Pa(e,t,n,r){let i=t.directives?.find((u)=>u.name.value===kn.name);if(i&&e.forbidSkipAndInclude)return e.forbiddenDirectiveInstances.push(i),!1;if((i?_t(kn,i,n,r,e.hideSuggestions):void 0)?.if===!0)return!1;let s=t.directives?.find((u)=>u.name.value===Ln.name);if(s&&e.forbidSkipAndInclude)return e.forbiddenDirectiveInstances.push(s),!1;if((s?_t(Ln,s,n,r,e.hideSuggestions):void 0)?.if===!1)return!1;return!0}function pl(e,t,n){let r=t.typeCondition;if(!r)return!0;let i=Te(e,r);if(i===n)return!0;if(Ke(i))return e.isSubType(i,n);return!1}function Md(e){return e.alias?e.alias.value:e.name.value}function $a(e){return e.map((t)=>t.node)}function hs(e){return{OperationDefinition(t){if(t.operation==="subscription"){let n=e.getSchema(),r=n.getSubscriptionType();if(r){let i=t.name?t.name.value:null,o=Object.create(null),s=e.getDocument(),a=Object.create(null);for(let l of s.definitions)if(l.kind===Qe)a[l.name.value]={definition:l};let{groupedFieldSet:u,forbiddenDirectiveInstances:c}=wr(n,a,o,r,t.selectionSet,e.hideSuggestions,!0);if(c.length>0){e.reportError(new m(i!=null?`Subscription "${i}" must not use \`@skip\` or \`@include\` directives in the top level selection.`:"Anonymous Subscription must not use `@skip` or `@include` directives in the top level selection.",{nodes:c}));return}if(u.size>1){let f=[...u.values()].slice(1).flatMap((d)=>$a(d));e.reportError(new m(i!=null?`Subscription "${i}" must select only one top level field.`:"Anonymous Subscription must select only one top level field.",{nodes:f}))}for(let l of u.values())if($a(l)[0].name.value.startsWith("__"))e.reportError(new m(i!=null?`Subscription "${i}" must not select an introspection top level field.`:"Anonymous Subscription must not select an introspection top level field.",{nodes:$a(l)}))}}}}}function Es(e){return{Directive(t){let n=e.getFieldDef(),r=e.getParentType();if(n&&r&&t.name.value===vt.name&&!(j(n.type)||On(n.type)&&j(n.type.ofType)))e.reportError(new m(`Directive "@stream" cannot be used on non-list field "${r}.${n.name}".`,{nodes:t}))}}}function Rr(e,t){let n=new Fe;for(let r of e)n.add(t(r),r);return n}function Ts(e){return{DirectiveDefinition(r){let i=r.arguments??[];return n(`@${r.name.value}`,i)},InterfaceTypeDefinition:t,InterfaceTypeExtension:t,ObjectTypeDefinition:t,ObjectTypeExtension:t};function t(r){let i=r.name.value,o=r.fields??[];for(let s of o){let a=s.name.value,u=s.arguments??[];n(`${i}.${a}`,u)}return!1}function n(r,i){let o=Rr(i,(s)=>s.name.value);for(let[s,a]of o)if(a.length>1)e.reportError(new m(`Argument "${r}(${s}:)" can only be defined once.`,{nodes:a.map((u)=>u.name)}));return!1}}function Pi(e){return{Field:t,Directive:t};function t(n){let r=n.arguments??[],i=Rr(r,(o)=>o.name.value);for(let[o,s]of i)if(s.length>1)e.reportError(new m(`There can be only one argument named "${o}".`,{nodes:s.map((a)=>a.name)}))}}function ys(e){let t=new Map,n=e.getSchema();return{DirectiveDefinition(r){let i=r.name.value;if(n?.getDirective(i)){e.reportError(new m(`Directive "@${i}" already exists in the schema. It cannot be redefined.`,{nodes:r.name}));return}let o=t.get(i);if(o)e.reportError(new m(`There can be only one directive named "@${i}".`,{nodes:[o,r.name]}));else t.set(i,r.name);return!1}}}function $i(e){let t=new Map,n=e.getSchema(),r=n?n.getDirectives():je;for(let u of r)t.set(u.name,!u.isRepeatable);let i=e.getDocument().definitions;for(let u of i)if(u.kind===pt)t.set(u.name.value,!u.repeatable);let o=new Map,s=new Map,a=new Map;return{enter(u){if(!("directives"in u)||!u.directives)return;let c;if(u.kind===Ye||u.kind===Rt)c=o;else if(En(u)||ki(u)){let l=u.name.value;if(c=s.get(l),c===void 0)c=new Map,s.set(l,c)}else if(u.kind===pt||u.kind===Tr){let l=u.name.value;if(c=a.get(l),c===void 0)c=new Map,a.set(l,c)}else c=new Map;for(let l of u.directives){let p=l.name.value;if(t.get(p)===!0){let f=c.get(p);if(f!=null)e.reportError(new m(`The directive "@${p}" can only be used once at this location.`,{nodes:[f,l]}));else c.set(p,l)}}}}}function gs(e){let t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),r=new Map;return{EnumTypeDefinition:i,EnumTypeExtension:i};function i(o){let s=o.name.value,a=r.get(s);if(a==null)a=new Map,r.set(s,a);let u=o.values??[];for(let c of u){let l=c.name.value,p=n[s];if(z(p)&&p.getValue(l)){e.reportError(new m(`Enum value "${s}.${l}" already exists in the schema. It cannot also be defined in this type extension.`,{nodes:c.name}));continue}let f=a.get(l);if(f!=null)e.reportError(new m(`Enum value "${s}.${l}" can only be defined once.`,{nodes:[f,c.name]}));else a.set(l,c.name)}return!1}}function Ns(e){let t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),r=new Map;return{InputObjectTypeDefinition:i,InputObjectTypeExtension:i,InterfaceTypeDefinition:i,InterfaceTypeExtension:i,ObjectTypeDefinition:i,ObjectTypeExtension:i};function i(o){let s=o.name.value,a=r.get(s);if(a==null)a=new Map,r.set(s,a);let u=o.fields??[];for(let c of u){let l=c.name.value;if(Ud(n[s],l)){e.reportError(new m(`Field "${s}.${l}" already exists in the schema. It cannot also be defined in this type extension.`,{nodes:c.name}));continue}let p=a.get(l);if(p!=null)e.reportError(new m(`Field "${s}.${l}" can only be defined once.`,{nodes:[p,c.name]}));else a.set(l,c.name)}return!1}}function Ud(e,t){if(L(e)||P(e)||k(e))return e.getFields()[t]!=null;return!1}function Is(e){let t=new Map;return{OperationDefinition:()=>!1,FragmentDefinition(n){let r=n.name.value,i=t.get(r);if(i!=null)e.reportError(new m(`There can be only one fragment named "${r}".`,{nodes:[i,n.name]}));else t.set(r,n.name);return!1}}}function Gi(e){let t=[],n=new Map;return{ObjectValue:{enter(){t.push(n),n=new Map},leave(){let r=t.pop();if(r==null)U(!1);n=r}},ObjectField(r){let i=r.name.value,o=n.get(i);if(o!=null)e.reportError(new m(`There can be only one input field named "${i}".`,{nodes:[o,r.name]}));else n.set(i,r.name)}}}function vs(e){let t=new Map;return{OperationDefinition(n){let r=n.name;if(r!=null){let i=t.get(r.value);if(i!=null)e.reportError(new m(`There can be only one operation named "${r.value}".`,{nodes:[i,r]}));else t.set(r.value,r)}return!1},FragmentDefinition:()=>!1}}function bs(e){let t=e.getSchema(),n=new Map,r=t?{query:t.getQueryType(),mutation:t.getMutationType(),subscription:t.getSubscriptionType()}:{};return{SchemaDefinition:i,SchemaExtension:i};function i(o){let s=o.operationTypes??[];for(let a of s){let u=a.operation,c=n.get(u);if(r[u])e.reportError(new m(`Type for ${u} already defined in the schema. It cannot be redefined.`,{nodes:a}));else if(c)e.reportError(new m(`There can be only one ${u} type in schema.`,{nodes:[c,a]}));else n.set(u,a)}return!1}}function _s(e){let t=new Map,n=e.getSchema();return{ScalarTypeDefinition:r,ObjectTypeDefinition:r,InterfaceTypeDefinition:r,UnionTypeDefinition:r,EnumTypeDefinition:r,InputObjectTypeDefinition:r};function r(i){let o=i.name.value;if(n?.getType(o)){e.reportError(new m(`Type "${o}" already exists in the schema. It cannot also be defined in this type definition.`,{nodes:i.name}));return}let s=t.get(o);if(s!=null)e.reportError(new m(`There can be only one type named "${o}".`,{nodes:[s,i.name]}));else t.set(o,i.name);return!1}}function Ss(e){return{OperationDefinition(t){let n=t.variableDefinitions??[],r=Rr(n,(i)=>i.variable.name.value);for(let[i,o]of r)if(o.length>1)e.reportError(new m(`There can be only one variable named "$${i}".`,{nodes:o.map((s)=>s.variable.name)}))}}}function Ds(e){return{NullValue:(t)=>Vn(e,t,e.getInputType()),ListValue:(t)=>Vn(e,t,e.getParentInputType()),ObjectValue:(t)=>Vn(e,t,e.getInputType()),EnumValue:(t)=>Vn(e,t,e.getInputType()),IntValue:(t)=>Vn(e,t,e.getInputType()),FloatValue:(t)=>Vn(e,t,e.getInputType()),StringValue:(t)=>Vn(e,t,e.getInputType()),BooleanValue:(t)=>Vn(e,t,e.getInputType())}}function Vn(e,t,n){if(n)xn(t,n,(r)=>{e.reportError(r)},void 0,void 0,e.hideSuggestions);return!1}function Os(e){return{VariableDefinition(t){let n=Te(e.getSchema(),t.type);if(n!==void 0&&!xe(n)){let r=t.variable.name.value,i=ee(t.type);e.reportError(new m(`Variable "$${r}" cannot be non-input type "${i}".`,{nodes:t.type}))}}}}function As(e){let t;return{OperationDefinition:{enter(){t=new Map},leave(n){let r=e.getRecursiveVariableUsages(n);for(let{node:i,type:o,parentType:s,defaultValue:a,fragmentVariableDefinition:u}of r){let c=i.name.value,l=u;if(l??=t.get(c),l&&o){let p=e.getSchema(),f=Te(p,l.type);if(f&&!Pd(p,f,l.defaultValue,o,a))e.reportError(new m(`Variable "$${c}" of type "${f}" used in position expecting type "${o}".`,{nodes:[l,i]}));if(k(s)&&s.isOneOf&&pi(f))e.reportError(new m(`Variable "$${c}" is of type "${f}" but must be non-nullable to be used for OneOf Input Object "${s}".`,{nodes:[l,i]}))}}}},VariableDefinition(n){t.set(n.variable.name.value,n)}}}function Pd(e,t,n,r,i){if(w(r)&&!w(t)){if(!(n!=null&&n.kind!==le)&&i===void 0)return!1;let a=r.ofType;return Ht(e,t,a)}return Ht(e,t,r)}var Ga=Object.freeze([es]),xs=Object.freeze([qo,zo,vs,Xo,hs,Ci,Jo,Os,fs,Ko,Is,Ho,rs,cs,ts,Ss,ns,is,Fi,$i,Go,jo,$o,Es,Wo,Pi,Ds,ps,As,us,Gi,...Ga]),dl=Object.freeze([Zo,bs,_s,gs,Ns,Ts,ys,Ci,Fi,$i,ls,wa,Pi,Gi,Va]);class ja{constructor(e,t){this._ast=e,this._fragments=void 0,this._fragmentSpreads=new Map,this._recursivelyReferencedFragments=new Map,this._onError=t}get[Symbol.toStringTag](){return"ASTValidationContext"}reportError(e){this._onError(e)}getDocument(){return this._ast}getFragment(e){let t;if(this._fragments)t=this._fragments;else{t=Object.create(null);for(let n of this.getDocument().definitions)if(n.kind===Qe)t[n.name.value]=n;this._fragments=t}return t[e]}getFragmentSpreads(e){let t=this._fragmentSpreads.get(e);if(!t){t=[];let n=[e],r;while(r=n.pop())for(let i of r.selections)if(i.kind===Dt)t.push(i);else if(i.selectionSet)n.push(i.selectionSet);this._fragmentSpreads.set(e,t)}return t}getRecursivelyReferencedFragments(e){let t=this._recursivelyReferencedFragments.get(e);if(!t){t=[];let n=new Set,r=[e.selectionSet],i;while(i=r.pop())for(let o of this.getFragmentSpreads(i)){let s=o.name.value;if(!n.has(s)){n.add(s);let a=this.getFragment(s);if(a)t.push(a),r.push(a.selectionSet)}}this._recursivelyReferencedFragments.set(e,t)}return t}}class Ba extends ja{constructor(e,t,n){super(e,n);this._schema=t}get hideSuggestions(){return!1}get[Symbol.toStringTag](){return"SDLValidationContext"}getSchema(){return this._schema}}class ji extends ja{constructor(e,t,n,r,i){super(t,r);this._schema=e,this._typeInfo=n,this._variableUsages=new Map,this._recursiveVariableUsages=new Map,this._hideSuggestions=i??!1}get[Symbol.toStringTag](){return"ValidationContext"}get hideSuggestions(){return this._hideSuggestions}getSchema(){return this._schema}getVariableUsages(e){let t=this._variableUsages.get(e);if(!t){let n=[],r=new ur(this._schema,void 0,this._typeInfo.getFragmentSignatureByName()),i=e.kind===Qe?e:void 0;ft(e,xr(r,{VariableDefinition:()=>!1,Variable(o){let s;if(i)s=r.getFragmentSignatureByName()(i.name.value)?.variableDefinitions.get(o.name.value),n.push({node:o,type:r.getInputType(),parentType:r.getParentInputType(),defaultValue:void 0,fragmentVariableDefinition:s});else n.push({node:o,type:r.getInputType(),parentType:r.getParentInputType(),defaultValue:r.getDefaultValue(),fragmentVariableDefinition:void 0})}})),t=n,this._variableUsages.set(e,t)}return t}getRecursiveVariableUsages(e){let t=this._recursiveVariableUsages.get(e);if(!t){t=this.getVariableUsages(e);for(let n of this.getRecursivelyReferencedFragments(e))t=t.concat(this.getVariableUsages(n));this._recursiveVariableUsages.set(e,t)}return t}getType(){return this._typeInfo.getType()}getParentType(){return this._typeInfo.getParentType()}getInputType(){return this._typeInfo.getInputType()}getParentInputType(){return this._typeInfo.getParentInputType()}getFieldDef(){return this._typeInfo.getFieldDef()}getDirective(){return this._typeInfo.getDirective()}getArgument(){return this._typeInfo.getArgument()}getFragmentSignature(){return this._typeInfo.getFragmentSignature()}getFragmentSignatureByName(){return this._typeInfo.getFragmentSignatureByName()}getEnumValue(){return this._typeInfo.getEnumValue()}}var $d=Gt(ti,(e)=>e.filter((t)=>t!=="description")),Qa=new m("Too many validation errors, error limit reached. Validation aborted.");function Lr(e,t,n=xs,r){return st(va)?va.traceSync(()=>ml(e,t,n,r),{schema:e,document:t}):ml(e,t,n,r)}function ml(e,t,n,r){let i=r?.maxErrors??100,o=r?.hideSuggestions??!1;Dr(e);let s=[],a=new ur(e),u=new ji(e,t,a,(l)=>{if(s.length>=i)throw Qa;s.push(l)},o),c=ui(n.map((l)=>l(u)));try{ft(t,xr(a,c),$d)}catch(l){if(l===Qa)s.push(Qa);else throw l}return s}function hl(e,t,n=dl){let r=[],i=new Ba(e,t,(s)=>{r.push(s)}),o=n.map((s)=>s(i));return ft(e,ui(o)),r}function El(e){let t=hl(e);if(t.length!==0)throw Error(t.map((n)=>n.message).join(` + +`))}function Tl(e,t){let n=hl(e,t);if(n.length!==0)throw Error(n.map((r)=>r.message).join(` + +`))}function kr(e){return typeof e?.[Symbol.asyncIterator]==="function"}function en(e,t,n){let r=oo(e);if(Gd(r))return r;return new m(r.message,{nodes:r.nodes??t,source:r.source,positions:r.positions,path:n,originalError:r})}function Gd(e){return Array.isArray(e.path)}function Fr(e,t){let n=null;for(let r of e.definitions)if(r.kind===Tt){if(t==null){if(n)return null;n=r}else if(r.name?.value===t)return r}return n}function ws(e,t,n,r,i,o,s){let{schema:a,fragmentDefinitions:u,rootValue:c,operation:l,variableValues:p}=e;return{fieldName:t.name,fieldNodes:n,returnType:t.type,parentType:r,path:i,schema:a,fragments:u,rootValue:c,operation:l,variableValues:p,getAbortSignal:o,getAsyncHelpers:s}}function lr(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}function Ya(e){let{promise:t,resolve:n,reject:r}=lr(),i=!1,o=(a)=>{if(i)return;i=!0,n(a)},s=(a)=>{if(i)return;i=!0,r(a)};return e.then(o,s),{promise:t,abort(a){s(a)}}}function qa(e,t){let n=Ya(e);if(t.aborted)return n.abort(t.reason),n.promise;let r=()=>{t.removeEventListener("abort",r),n.abort(t.reason)};return t.addEventListener("abort",r),n.promise.then(()=>{t.removeEventListener("abort",r)},()=>{t.removeEventListener("abort",r)}),n.promise}class Ka{constructor(){this.pendingAsyncWork=new Set}add(e){let t=this.pendingAsyncWork,n=e.then(()=>{t.delete(n)},()=>{t.delete(n)});t.add(n)}addValues(e){for(let t of e)if(Be(t))this.add(t)}wait(){if(this.pendingAsyncWork.size===0)return;return this.waitForPendingAsyncWork()}promiseAllTrackOnReject(e){let t=Promise.all(e);return t.then(void 0,()=>{this.addValues(e)}),t}async waitForPendingAsyncWork(){while(this.pendingAsyncWork.size>0)await Promise.allSettled(Array.from(this.pendingAsyncWork))}}function Rs(e){let t=new Ka,n,r=(o)=>t.promiseAllTrackOnReject(o);return{asyncWorkTracker:t,getAbortSignal:()=>e,getAsyncHelpers:()=>n??={promiseAll:r,track:(o)=>t.addValues(o)},promiseAll:r}}function Cr(e){let t;return function(r,i){t??=new WeakMap;let o=t.get(r);if(o===void 0)o=new WeakMap,t.set(r,o);let s=o.get(i);if(s===void 0)s=e(r,i),o.set(i,s);return s}}function yl(e){let t;return function(r,i,o){t??=new WeakMap;let s=t.get(r);if(s===void 0)s=new WeakMap,t.set(r,s);let a=s.get(i);if(a===void 0)a=new WeakMap,s.set(i,a);let u=a.get(o);if(u===void 0)u=e(r,i,o),a.set(o,u);return u}}function gl(e,t){let n=Object.keys(e),r=Object.values(e);return t(r).then((i)=>{let o=Object.create(null);for(let s=0;s<n.length;++s)o[n[s]]=i[s];return o})}function Nl(e,t,n){let r=n;for(let i of e)r=K(r)?r.then((o)=>t(o,i)):t(r,i);return r}class Bi extends Error{constructor(e,t){super(jd(e),{cause:e});this.name="AbortedGraphQLExecutionError",this.abortedResult=t}get[Symbol.toStringTag](){return"AbortedGraphQLExecutionError"}}function jd(e){if(e instanceof Error)return e.message;if(typeof e==="object"&&e!==null&&"message"in e&&typeof e.message==="string")return e.message;return String(e)}function Ls(e){let t=[];try{while(!0){let n=e.next();if(n.done)return t;if(Be(n.value))t.push(n.value)}}catch{return t}}function Il(e,t){let{operation:n,variableValues:r}=e,i=Zt(vt,t[0].node,r,t[0].fragmentVariableValues);if(!i)return;if(i.if===!1)return;if(typeof i.initialCount!=="number")U(!1,"initialCount must be a number");if(!(i.initialCount>=0))U(!1,"initialCount must be a positive integer");if(n.operation===re.SUBSCRIPTION)U(!1,"`@stream` directive not supported on subscription operations. Disable `@stream` by setting the `if` argument to `false`.");let o=t.map((s)=>({node:s.node,deferUsage:void 0,fragmentVariableValues:s.fragmentVariableValues}));return{initialCount:i.initialCount,label:typeof i.label==="string"?i.label:void 0,fieldDetailsList:o}}function vl(e,t){try{e?.(t)}catch{}}function bl(e,t,n){let r=t.asyncWorkTracker.wait();if(r===void 0){vl(n,{validatedExecutionArgs:e});return}r.then(()=>{vl(n,{validatedExecutionArgs:e})}).catch(()=>{return})}async function Qi(e){try{await e.return?.()}catch{}}var Bd=yl((e,t,n)=>{let{schema:r,fragments:i,variableValues:o,hideSuggestions:s}=e;return fl(r,i,o,t,n,s)}),ks=Cr((e,t)=>Il(e,t));class _l{constructor(){this._errorPositions=new Set,this._errors=[]}get errors(){return this._errors}add(e,t){if(this.hasNulledPosition(t))return;this._errorPositions.add(t),this._errors.push(e)}hasNulledPosition(e){let t=e;while(t!==void 0){if(this._errorPositions.has(t))return!0;t=t.prev}return this._errorPositions.has(void 0)}}var Qd=Error("This operation was aborted");class Yi{constructor(e,t){if(this.validatedExecutionArgs=e,this.aborted=!1,this.abortReason=Qd,this.collectedErrors=new _l,t===void 0)this.resolverAbortController=new AbortController,this.sharedExecutionContext=Rs(this.resolverAbortController.signal);else this.sharedExecutionContext=t;let{getAbortSignal:n,getAsyncHelpers:r,promiseAll:i}=this.sharedExecutionContext;this.getAbortSignal=n,this.getAsyncHelpers=r,this.promiseAll=i}executeRootSelectionSet(e){if(!st(ba))return this.executeRootSelectionSetImpl(e);return Cn(ba,this.buildExecuteContextFromValidatedArgs(this.validatedExecutionArgs),()=>this.executeRootSelectionSetImpl(e))}buildExecuteContextFromValidatedArgs(e){return{schema:e.schema,document:e.document,operation:e.operation,rawVariableValues:e.rawVariableValues,operationName:e.operation.name?.value,operationType:e.operation.operation}}executeRootSelectionSetImpl(e){let t=this.validatedExecutionArgs.externalAbortSignal,n;if(t){t.throwIfAborted();let o=()=>{this.abort(t.reason)};n=()=>t.removeEventListener("abort",o),t.addEventListener("abort",o)}let r=()=>{n?.()},i;try{let{schema:o,fragments:s,rootValue:a,operation:u,variableValues:c,hideSuggestions:l}=this.validatedExecutionArgs,{operation:p,selectionSet:f}=u,d=o.getRootType(p);if(d==null)throw new m(`Schema is not configured to execute ${p} operation.`,{nodes:u});let{groupedFieldSet:E,newDeferUsages:I}=wr(o,s,c,d,f,l);if(i=this.executeCollectedRootFields(d,a,E,e??p===re.MUTATION,I),K(i)){let S=i.then((W)=>(r(),this.buildResponse(W)),(W)=>(r(),this.collectedErrors.add(De(W),void 0),this.buildResponse(null)));this.sharedExecutionContext.asyncWorkTracker.add(S);let{promise:G,abort:Z}=Ya(S.then((W)=>this.finish(W)));if(this.abortResultPromise=()=>{Z(this.createAbortedExecutionError(S))},this.aborted)this.abortResultPromise();return G}r()}catch(o){return r(),this.collectedErrors.add(De(o),void 0),this.finish(this.buildResponse(null))}return this.finish(this.buildResponse(i))}abort(e){if(this.aborted)return;if(this.aborted=!0,e!==void 0)this.abortReason=e;this.abortResultPromise?.(),this.resolverAbortController?.abort(this.abortReason)}finish(e){if(this.aborted)throw this.createAbortedExecutionError(e);return this.aborted=!0,e}createAbortedExecutionError(e){return new Bi(this.abortReason,e)}getFinishSharedExecution(){let e=this.resolverAbortController,t=this.validatedExecutionArgs.hooks?.asyncWorkFinished;if(t===void 0)return()=>e?.abort();let n=this.validatedExecutionArgs,r=this.sharedExecutionContext;return()=>{e?.abort(),bl(n,r,t)}}buildResponse(e){this.getFinishSharedExecution()();let t=this.collectedErrors.errors;return t.length?{errors:t,data:e}:{data:e}}executeCollectedRootFields(e,t,n,r,i){return this.executeRootGroupedFieldSet(e,t,n,r,void 0)}executeRootGroupedFieldSet(e,t,n,r,i){return r?this.executeFieldsSerially(e,t,void 0,n,i):this.executeFields(e,t,void 0,n,i)}executeFieldsSerially(e,t,n,r,i){let o=st(sr)?sr:void 0;return Nl(r,(s,[a,u])=>{if(this.aborted)throw Error("Aborted!");let c=Pe(n,a,e.name),l=this.executeField(e,t,u,c,i,o);if(l===void 0)return s;if(K(l))return l.then((p)=>(s[a]=p,o=st(sr)?sr:void 0,s));return s[a]=l,s},Object.create(null))}executeFields(e,t,n,r,i){let o=Object.create(null),s=!1,a=st(sr)?sr:void 0;try{for(let[u,c]of r){let l=Pe(n,u,e.name),p=this.executeField(e,t,c,l,i,a);if(p!==void 0){if(o[u]=p,K(p))s=!0}}}catch(u){if(s)this.sharedExecutionContext.asyncWorkTracker.addValues(Object.values(o));throw u}if(!s)return o;return gl(o,this.promiseAll)}executeField(e,t,n,r,i,o){let s=this.validatedExecutionArgs,{schema:a,contextValue:u,variableValues:c,hideSuggestions:l}=s,p=n[0],f=p.node,d=f.name.value,E=a.getField(e,d);if(!E)return;let I=E.type,S=E.resolve??s.fieldResolver;if(o!==void 0){let Z=S;S=(W,H,Y,ne)=>Cn(o,this.buildResolveContext(H,ne,E.resolve===void 0),()=>Z(W,H,Y,ne))}let G=ws(s,E,Mn(n),e,r,this.getAbortSignal,this.getAsyncHelpers);try{let Z=_t(E,f,c,p.fragmentVariableValues,l),W=S(t,Z,u,G);if(Be(W))return this.completePromisedValue(I,n,G,r,W,i);let H=this.completeValue(I,n,G,r,W,i);if(K(H))return H.then(void 0,(Y)=>(this.handleFieldError(Y,I,n,r),null));return H}catch(Z){return this.handleFieldError(Z,I,n,r),null}}buildResolveContext(e,t,n){let r;return{fieldName:t.fieldName,alias:String(t.path.key),parentType:t.parentType.name,fieldType:String(t.returnType),args:e,isDefaultResolver:n,get fieldPath(){return r??=fe(t.path).join("."),r}}}handleFieldError(e,t,n,r){let i=en(e,Mn(n),fe(r));if(this.validatedExecutionArgs.errorPropagation&&w(t))throw i;this.collectedErrors.add(i,r)}completeValue(e,t,n,r,i,o){if(i instanceof Error)throw i;if(w(e)){let s=this.completeValue(e.ofType,t,n,r,i,o);if(s===null)throw Error(`Cannot return null for non-nullable field ${n.parentType}.${n.fieldName}.`);return s}if(i==null)return null;if(j(e))return this.completeListValue(e,t,n,r,i,o);if(ve(e))return this.completeLeafValue(e,i);if(Ke(e))return this.completeAbstractValue(e,t,n,r,i,o);if(L(e))return this.completeObjectValue(e,t,n,r,i,o);U(!1,"Cannot complete value of unexpected output type: "+y(e))}async completePromisedValue(e,t,n,r,i,o){try{let s=await i;if(this.aborted)throw Error("Aborted!");let a=this.completeValue(e,t,n,r,s,o);if(K(a))a=await a;return a}catch(s){return this.handleFieldError(s,e,t,r),null}}async completeAsyncIterableValue(e,t,n,r,i,o){let s=typeof r.key==="number"?void 0:ks(this.validatedExecutionArgs,t),a=!1,u=[],c=i[Symbol.asyncIterator](),l=0,p;try{while(!0){if(s?.initialCount===l&&this.handleStream(l,r,{handle:c,isAsync:!0},s,n,e))break;let f=Pe(r,l,void 0);try{p=await c.next()}catch(E){throw en(E,Mn(t),fe(r))}if(this.aborted||p.done)break;let d=p.value;if(this.completeMaybePromisedListItemValue(d,u,e,t,n,f,o))a=!0;l++}}catch(f){if(this.sharedExecutionContext.asyncWorkTracker.add(Qi(c)),a)this.sharedExecutionContext.asyncWorkTracker.addValues(u);throw f}if(this.aborted){if(!p?.done)this.sharedExecutionContext.asyncWorkTracker.add(Qi(c));throw Error("Aborted!")}return a?this.promiseAll(u):u}handleStream(e,t,n,r,i,o){return!1}completeListValue(e,t,n,r,i,o){let s=e.ofType;if(kr(i))return this.completeAsyncIterableValue(s,t,n,r,i,o);if(!et(i))throw new m(`Expected Iterable, but did not find one for field "${n.parentType}.${n.fieldName}".`);return this.completeIterableValue(s,t,n,r,i,o)}completeIterableValue(e,t,n,r,i,o){let s=typeof r.key==="number"?void 0:ks(this.validatedExecutionArgs,t),a=!1,u=[],c=0,l=i[Symbol.iterator]();try{while(!0){if(s?.initialCount===c&&this.handleStream(c,r,{handle:l},s,n,e))break;let p=l.next();if(p.done)break;let f=p.value,d=Pe(r,c,void 0);if(this.completeMaybePromisedListItemValue(f,u,e,t,n,d,o))a=!0;c++}}catch(p){let f=this.sharedExecutionContext.asyncWorkTracker;if(a)f.addValues(u);throw f.addValues(Ls(l)),p}return a?this.promiseAll(u):u}completeMaybePromisedListItemValue(e,t,n,r,i,o,s){if(Be(e))return t.push(this.completePromisedListItemValue(e,n,r,i,o,s)),!0;else if(this.completeListItemValue(e,t,n,r,i,o,s))return!0;return!1}completeListItemValue(e,t,n,r,i,o,s){try{let a=this.completeValue(n,r,i,o,e,s);if(K(a))return t.push(a.then(void 0,(u)=>(this.handleFieldError(u,n,r,o),null))),!0;t.push(a)}catch(a){this.handleFieldError(a,n,r,o),t.push(null)}return!1}async completePromisedListItemValue(e,t,n,r,i,o){try{let s=await e;if(this.aborted)throw Error("Aborted!");let a=this.completeValue(t,n,r,i,s,o);if(K(a))a=await a;return a}catch(s){return this.handleFieldError(s,t,n,i),null}}completeLeafValue(e,t){let n=e.coerceOutputValue(t);if(n==null)throw Error(`Expected \`${y(e)}.coerceOutputValue(${y(t)})\` to return non-nullable value, returned: ${y(n)}`);return n}completeAbstractValue(e,t,n,r,i,o){let s=this.validatedExecutionArgs,{schema:a,contextValue:u}=s,l=(e.resolveType??s.typeResolver)(i,u,n,e);if(Be(l))return l.then((p)=>{if(this.aborted)throw Error("Aborted!");return this.completeObjectValue(this.ensureValidRuntimeType(p,a,e,t,n,i),t,n,r,i,o)});return this.completeObjectValue(this.ensureValidRuntimeType(l,a,e,t,n,i),t,n,r,i,o)}ensureValidRuntimeType(e,t,n,r,i,o){if(e==null)throw new m(`Abstract type "${n}" must resolve to an Object type at runtime for field "${i.parentType}.${i.fieldName}". Either the "${n}" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.`,{nodes:Mn(r)});if(typeof e!=="string")throw new m(`Abstract type "${n}" must resolve to an Object type at runtime for field "${i.parentType}.${i.fieldName}" with value ${y(o)}, received "${y(e)}", which is not a valid Object type name.`);let s=t.getType(e);if(s==null)throw new m(`Abstract type "${n}" was resolved to a type "${e}" that does not exist inside the schema.`,{nodes:Mn(r)});if(!L(s))throw new m(`Abstract type "${n}" was resolved to a non-object type "${e}".`,{nodes:Mn(r)});if(!t.isSubType(n,s))throw new m(`Runtime Object type "${s}" is not a possible type for "${n}".`,{nodes:Mn(r)});return s}completeObjectValue(e,t,n,r,i,o){if(e.isTypeOf){let s=e.isTypeOf(i,this.validatedExecutionArgs.contextValue,n);if(Be(s))return s.then((a)=>{if(this.aborted)throw Error("Aborted!");if(!a)throw this.invalidReturnTypeError(e,i,t);return this.collectAndExecuteSubfields(e,t,r,i,o)});if(!s)throw this.invalidReturnTypeError(e,i,t)}return this.collectAndExecuteSubfields(e,t,r,i,o)}invalidReturnTypeError(e,t,n){return new m(`Expected value of type "${e}" but got: ${y(t)}.`,{nodes:Mn(n)})}collectAndExecuteSubfields(e,t,n,r,i){let{groupedFieldSet:o,newDeferUsages:s}=Bd(this.validatedExecutionArgs,e,t);return this.executeCollectedSubfields(e,r,n,o,s,i)}executeCollectedSubfields(e,t,n,r,i,o){return this.executeFields(e,t,n,r,void 0)}}function Mn(e){return e.map((t)=>t.node)}var Ja="Executing this GraphQL operation would unexpectedly produce multiple payloads (due to @defer or @stream directive)";class Fs extends Yi{executeCollectedRootFields(e,t,n,r,i){if(i.length>0){if(this.validatedExecutionArgs.operation.operation===re.SUBSCRIPTION)U(!1,"`@defer` directive not supported on subscription operations. Disable `@defer` by setting the `if` argument to `false`.");let o=Error(Ja);throw this.abort(o),o}return this.executeRootGroupedFieldSet(e,t,n,r,void 0)}executeCollectedSubfields(e,t,n,r,i){if(i.length>0){if(this.validatedExecutionArgs.operation.operation===re.SUBSCRIPTION)U(!1,"`@defer` directive not supported on subscription operations. Disable `@defer` by setting the `if` argument to `false`.");let o=Error(Ja);throw this.abort(o),o}return this.executeFields(e,t,n,r,void 0)}completeListValue(e,t,n,r,i,o){if(ks(this.validatedExecutionArgs,t)!==void 0){if(this.validatedExecutionArgs.operation.operation===re.SUBSCRIPTION)U(!1,"`@stream` directive not supported on subscription operations. Disable `@stream` by setting the `if` argument to `false`.");let a=Error(Ja);throw this.abort(a),a}return super.completeListValue(e,t,n,r,i,o)}}function Cs(e){let t;return function(r){t??=new WeakMap;let i=t.get(r);if(i===void 0)i=e(r),t.set(r,i);return i}}function Vr(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Vs(e,t){for(let n of e.keys())if(Vr(n,t))return e.get(n);return}function Wa(e,t=new Set){let n=new Map,r=new Map;for(let[i,o]of e){let s=Yd(o);if(Vr(s,t)){n.set(i,o);continue}let a=Vs(r,s);if(a===void 0)a=new Map,r.set(s,a);a.set(i,o)}return{groupedFieldSet:n,newGroupedFieldSets:r}}function Yd(e){let t=new Set;for(let n of e){let r=n.deferUsage;if(r===void 0)return t.clear(),t;t.add(r)}for(let n of t){let r=n.parentDeferUsage;while(r!==void 0){if(t.has(r)){t.delete(n);break}r=r.parentDeferUsage}}return t}class Ha{constructor(e,t){this._fn=e,this._onAbort=t}prime(){if(this._maybePromise)return this._maybePromise;try{let e=this._fn();if(K(e))this._maybePromise={status:"pending",promise:e},e.then((t)=>{this._maybePromise={status:"fulfilled",value:t}},(t)=>{this._maybePromise={status:"rejected",reason:t}});else this._maybePromise={status:"fulfilled",value:e}}catch(e){this._maybePromise={status:"rejected",reason:e}}return this._maybePromise}result(){let e=this.prime();switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;case"pending":return e.promise}}abort(e){let t=this._maybePromise;if(!t){this._maybePromise={status:"rejected",reason:e};return}if(t.status==="pending"){if(this._maybePromise={status:"rejected",reason:e},this._onAbort)return this._onAbort(e)}}}var za=Symbol.asyncDispose??Symbol.for("Symbol.asyncDispose");function Un(e,t,n=t){let r=!1,i=!1,o=(s)=>{if(r||i)return;return i=!0,qd(s)};return{[Symbol.asyncIterator](){return this},next(){let s=e.next();return s.then((a)=>{if(a.done)r=!0}).catch(()=>{return}),s},async return(){return await o(t),e.return()},async throw(s){return await o(()=>n(s)),e.throw(s)},async[za](){if(await o(t),typeof e[za]==="function")await e[za]()}}}function qd(e){try{let t=e();if(K(t))return t.catch(()=>{})}catch{}}function pr(e,t){let n=e[Symbol.asyncIterator](),r=n.return?.bind(n),i=n.throw?.bind(n),o=r?()=>Sl(r):()=>Promise.resolve(),s=i?(a)=>Sl(()=>i(a)):o;return Un(Kd(e,t),o,s)}async function Sl(e){try{await e()}catch{}}async function*Kd(e,t){for await(let n of e){let r=t(n);if(K(r)){yield await r;continue}yield r}}class qi{constructor(e,t=1){this._backlog=0,this._waiters=[],this._entries=[],this._isStopped=!1,this._stopRequested=!1,this._stopCleanupCallbacks=[],this._batchRequests=new Set,this._capacity=this._normalizeCapacity(t);let{promise:n,resolve:r}=lr();this._resolveStarted=r;try{let i=e({push:this._push.bind(this),stop:this._stop.bind(this),onStop:this._onStop.bind(this),started:n});if(K(i))i.catch(this._stop.bind(this))}catch(i){let o=this._stop(i);if(K(o))o.catch(()=>{return})}}subscribe(e=(t)=>Array.from(t)){let t=this._iteratorLoop(e);return Un(t,()=>this.cancel(),this.abort.bind(this))}cancel(){if(this._stopRequested)return this._stopCompletion;return this._terminate(void 0,()=>{this._isStopped=!0,this._batchRequests.forEach((e)=>e.resolve(void 0)),this._batchRequests.clear()})}abort(e){if(this._stopRequested)return this._stopCompletion;return this._terminate(e,()=>{if(this._isStopped=!0,this._batchRequests.size){this._batchRequests.forEach((t)=>t.reject(e)),this._batchRequests.clear();return}this._entries.push({kind:"item",settled:{status:"rejected",reason:e}})})}async forEachBatch(e){let t=this.subscribe(async(n)=>{let{promise:r,resolve:i}=lr(),o=function*(){yield*n,i()}();await Promise.all([e(o),r])});for await(let n of t);}setCapacity(e){this._capacity=this._normalizeCapacity(e),this._flush()}getCapacity(){return this._capacity}isStopped(){return this._isStopped}_normalizeCapacity(e){return Math.max(1,Math.floor(e))}_flush(){while(this._waiters.length>0&&this._backlog<this._capacity)this._waiters.shift()?.()}_reserve(){if(this._backlog+=1,this._backlog<this._capacity)return;let{promise:e,resolve:t}=lr();return this._waiters.push(t),e}_release(){if(this._backlog>0)this._backlog-=1;this._flush()}_onStop(e){if(this._stopRequested)throw Error("Cannot register onStop cleanup after stop has been requested.");this._stopCleanupCallbacks.push(e)}_runStopCleanup(e,t){this._stopRequested=!0;let n=this._stopCleanupCallbacks.flatMap((i)=>{try{let o=i(e);return K(o)?[o]:[]}catch{return[]}}),r=n.length>0?Promise.allSettled(n).then(()=>{return}):void 0;if(K(r))return this._stopCompletion=r.then(t,t).then(()=>{return}),this._stopCompletion;t()}async*_iteratorLoop(e){this._resolveStarted();let t;while(t=await this._waitForNextBatch()){let n=e(t);if(K(n))n=await n;if(n===void 0)continue;yield n}}_waitForNextBatch(){let{promise:e,resolve:t,reject:n}=lr();return this._batchRequests.add({resolve:t,reject:n}),this._deliverBatchIfReady(),e}_push(e){if(this._stopRequested)return;let t=this._reserve();if(K(e)){let n={kind:"item"};this._entries.push(n),e.then((r)=>{n.settled={status:"fulfilled",value:r},this._deliverBatchIfReady()},(r)=>{n.settled={status:"rejected",reason:r},this._deliverBatchIfReady()})}else this._entries.push({kind:"item",settled:{status:"fulfilled",value:e}}),this._deliverBatchIfReady();return t}_terminate(e,t){for(let n of this._entries)if(n.kind==="item")this._release();return this._entries.length=0,this._runStopCleanup(e,t)}_stop(e){if(this._stopRequested)return this._stopCompletion;let t=this._runStopCleanup(e,()=>{if(e===void 0){if(this._entries.length===0){this._isStopped=!0,this._deliverBatchIfReady();return}this._entries.push({kind:"stop"}),this._deliverBatchIfReady();return}this._entries.push({kind:"item",settled:{status:"rejected",reason:e}}),this._entries.push({kind:"stop"}),this._deliverBatchIfReady()});if(K(t))t.catch(()=>{return});return t}_deliverBatchIfReady(){if(!this._batchRequests.size)return;let e=this._entries[0],t=this._batchRequests;if(e!==void 0){if(e.kind==="stop")U(!1);let n=e.settled;if(n!==void 0){if(n.status==="fulfilled"){this._batchRequests=new Set,t.forEach((r)=>r.resolve(this._drainBatch()));return}this._entries.shift(),this._release(),this._isStopped=!0,this._batchRequests=new Set,t.forEach((r)=>r.reject(n.reason))}}else if(this._isStopped)this._batchRequests=new Set,t.forEach((n)=>n.resolve(void 0))}*_drainBatch(){while(!0){let e=this._entries[0];if(e===void 0)return;if(e.kind==="stop"){this._isStopped=!0,this._entries.shift();return}let t=e.settled;if(t===void 0||t.status==="rejected")return;this._entries.shift(),this._release(),yield t.value}}}function Ms(e){let t=new Set,n=new Set,r=new Map,i=new Map,o,s,{newGroups:a,newStreams:u}=I(e),c=H(a);for(let N of c)t.add(N);for(let N of u)n.add(N);let l=new qi(({push:N,stop:g,onStop:_,started:B})=>{o=N,s=g,B.then(()=>{for(let X of t)ne(X);for(let X of n)A(X)}),_((X)=>p(X))},1).subscribe((N)=>h(N));return{initialGroups:c,initialStreams:u,events:l};function p(N){let g=[];for(let _ of t)f(_,N,g);for(let _ of n)E(_,N,g);if(g.length>0)return Promise.allSettled(g).then(()=>{return})}function f(N,g,_){let B=r.get(N);if(B){for(let X of B.tasks)d(X,g,_);for(let X of B.childGroups)f(X,g,_)}}function d(N,g,_){let B=N.computation.abort(g);if(K(B))_.push(B);let X=i.get(N);if(X)for(let he of X.childStreams)E(he,g,_)}function E(N,g,_){let B=N.queue.abort(g);if(K(B))_.push(B)}function I(N,g){if(!N)return{newGroups:[],newStreams:[]};let{groups:_,tasks:B,streams:X}=N,he=_?S(_,g):[];if(B)for(let on of B)Z(on);let lt=X?W(X,g):[];return{newGroups:he,newStreams:lt}}function S(N,g){let _=new Set(N),B=new Set,X=[];for(let he of N)G(he,_,X,B,g);return X}function G(N,g,_,B,X){if(B.has(N))return;B.add(N);let he=N.parent;if(he!==void 0&&g.has(he))G(he,g,_,B,X);let lt={childGroups:[],tasks:new Set,pending:0};if(r.set(N,lt),X===void 0&&!he)_.push(N);else if(he)r.get(he)?.childGroups.push(N)}function Z(N){for(let g of N.groups){let _=r.get(g);if(_){if(_.tasks.add(N),_.pending++,t.has(g))b(N)}}}function W(N,g){if(!g)return N;let _=i.get(g);if(_)_.childStreams.push(...N);return[]}function H(N,g=[]){for(let _ of N){let B=r.get(_);if(B)if(B.pending===0)r.delete(_),H(B.childGroups,g);else g.push(_)}return g}function Y(N,g){for(let _ of N)t.add(_),ne(_);for(let _ of g)n.add(_),A(_)}function ne(N){let g=r.get(N);if(g)for(let _ of g.tasks)b(_)}function b(N){if(i.has(N))return;i.set(N,{value:void 0,childStreams:[]});try{let g=N.computation.result();if(K(g))g.then((_)=>{o({kind:"TASK_SUCCESS",task:N,result:_})},(_)=>{o({kind:"TASK_FAILURE",task:N,error:_})});else o({kind:"TASK_SUCCESS",task:N,result:g})}catch(g){o({kind:"TASK_FAILURE",task:N,error:g})}}async function A(N){try{await N.queue.forEachBatch(async(g)=>{let _=o({kind:"STREAM_ITEMS",stream:N,items:g});if(K(_))await _}),o({kind:"STREAM_SUCCESS",stream:N})}catch(g){o({kind:"STREAM_FAILURE",stream:N,error:g})}}function h(N){let g=[];for(let _ of N)switch(_.kind){case"TASK_SUCCESS":g.push(...D(_));break;case"TASK_FAILURE":g.push(...R(_));break;case"STREAM_ITEMS":g.push(...q(_));break;case"STREAM_SUCCESS":if(n.has(_.stream))n.delete(_.stream),g.push(_);break;case"STREAM_FAILURE":n.delete(_.stream),g.push(_);break}if(t.size===0&&n.size===0)s(),g.push({kind:"WORK_QUEUE_TERMINATION"});return g.length>0?g:void 0}function D(N){let{task:g,result:_}=N,{value:B,work:X}=_,he=i.get(g);if(he)he.value=B;I(X,g);let lt=[],on=[],Er=[];for(let Bn of g.groups){let Qn=r.get(Bn);if(Qn){if(Qn.pending--,t.has(Bn)&&Qn.pending===0){let{groupValuesEvent:Xr,groupSuccessEvent:df,newGroups:mf,newStreams:hf}=ce(Bn,Qn);if(Xr)lt.push(Xr);lt.push(df),on.push(...mf),Er.push(...hf)}}}return Y(on,Er),lt}function R(N){let{task:g,error:_}=N;i.delete(g);let B=[];for(let X of g.groups){let he=r.get(X);if(he)B.push(Ue(X,he,_))}return B}function q(N){let{stream:g,items:_}=N,B=[],X=[],he=[];for(let{value:on,work:Er}of _){let{newGroups:Bn,newStreams:Qn}=I(Er),Xr=H(Bn);Y(Xr,Qn),B.push(on),X.push(...Xr),he.push(...Qn)}let lt={kind:"STREAM_VALUES",stream:g,values:B,newGroups:X,newStreams:he};if(g.queue.isStopped())return n.delete(g),[lt,{kind:"STREAM_SUCCESS",stream:g}];return[lt]}function ce(N,g){r.delete(N);let _=[],B=[];for(let he of g.tasks){let lt=i.get(he);if(lt){let{value:on,childStreams:Er}=lt;if(on!==void 0)_.push(on);for(let Bn of Er)B.push(Bn);O(he)}}let X=H(g.childGroups);return t.delete(N),{groupValuesEvent:_.length?{kind:"GROUP_VALUES",group:N,values:_}:void 0,groupSuccessEvent:{kind:"GROUP_SUCCESS",group:N,newGroups:X,newStreams:B},newGroups:X,newStreams:B}}function Ue(N,g,_){return v(N,g),t.delete(N),{kind:"GROUP_FAILURE",group:N,error:_}}function v(N,g){r.delete(N);for(let _ of g.tasks)if(_.groups.every((B)=>!r.has(B)))O(_);for(let _ of g.childGroups){let B=r.get(_);if(B)v(_,B)}}function O(N){for(let g of N.groups)r.get(g)?.tasks.delete(N);i.delete(N)}}class Xa{constructor(){this._ids=new Map,this._nextId=0}buildResponse(e,t,n,r,i){let{initialGroups:o,initialStreams:s,events:a}=Ms(n);function u(){f.throw(r?.reason).catch(()=>{})}if(r)r.addEventListener("abort",u);let c=()=>{i(),r?.removeEventListener("abort",u)},l=this._toPendingResults(o,s),p=t.length?{errors:t,data:e,pending:l,hasNext:!0}:{data:e,pending:l,hasNext:!0},f=Un(pr(a,(d)=>this._handleBatch(d,c)),()=>c());return{initialResult:p,subsequentResults:f}}_ensureId(e){let t=this._ids.get(e);if(t!==void 0)return t;return t=String(this._nextId++),this._ids.set(e,t),t}_toPendingResults(e,t){let n=[];for(let r of[e,t])for(let i of r){let s={id:this._ensureId(i),path:fe(i.path)};if(i.label!==void 0)s.label=i.label;n.push(s)}return n}_handleBatch(e,t){let n={pending:[],incremental:[],completed:[],hasNext:!0};for(let u of e)this._handleWorkQueueEvent(u,n,t);let{incremental:r,completed:i,pending:o,hasNext:s}=n,a={hasNext:s};if(o.length>0)a.pending=o;if(r.length>0)a.incremental=r;if(i.length>0)a.completed=i;return a}_handleWorkQueueEvent(e,t,n){switch(e.kind){case"GROUP_VALUES":{let r=e.group,i=this._ensureId(r);for(let o of e.values){let{bestId:s,subPath:a}=this._getBestIdAndSubPath(i,r,o),u={id:s,data:o.data};if(o.errors!==void 0)u.errors=o.errors;if(a!==void 0)u.subPath=a;t.incremental.push(u)}break}case"GROUP_SUCCESS":{let r=e.group,i=this._ensureId(r);if(t.completed.push({id:i}),this._ids.delete(r),e.newGroups.length>0||e.newStreams.length>0)t.pending.push(...this._toPendingResults(e.newGroups,e.newStreams));break}case"GROUP_FAILURE":{let{group:r,error:i}=e,o=this._ensureId(r);t.completed.push({id:o,errors:[De(i)]}),this._ids.delete(r);break}case"STREAM_VALUES":{let r=e.stream,i=this._ensureId(r),{values:o,newGroups:s,newStreams:a}=e,u=[],c=[];for(let l of o)if(u.push(l.item),l.errors!==void 0)c.push(...l.errors);if(t.incremental.push(c.length>0?{id:i,items:u,errors:c}:{id:i,items:u}),s.length>0||a.length>0)t.pending.push(...this._toPendingResults(s,a));break}case"STREAM_SUCCESS":{let r=e.stream;t.completed.push({id:this._ensureId(r)}),this._ids.delete(r);break}case"STREAM_FAILURE":{let r=e.stream;t.completed.push({id:this._ensureId(r),errors:[De(e.error)]}),this._ids.delete(r);break}case"WORK_QUEUE_TERMINATION":{n?.(),t.hasNext=!1;break}}}_getBestIdAndSubPath(e,t,n){let r=fe(t.path).length,i=e;for(let s of n.deliveryGroups){if(s===t)continue;let a=this._ids.get(s);if(a===void 0)continue;let c=fe(s.path).length;if(c>r)r=c,i=a}let o=n.path.slice(r);return{bestId:i,subPath:o.length>0?o:void 0}}}var Dl=Cs((e)=>Wa(e)),Jd=Cr((e,t)=>Wa(e,t));class Mr extends Yi{constructor(e,t,n){super(e,t);this.deferUsageSet=n,this.groups=[],this.tasks=[],this.streams=[]}getCreateSubExecutor(){let e=this.validatedExecutionArgs,t=this.sharedExecutionContext;return(n)=>new Mr(e,t,n)}abort(e){super.abort(e);for(let t of this.tasks){let n=t.computation.abort(e);if(K(n))U(!1)}for(let t of this.streams){let n=t.queue.abort(e);if(K(n))U(!1)}}buildResponse(e){let t=this.getIncrementalWork(),{tasks:n,streams:r}=t;if(n?.length===0&&r?.length===0)return super.buildResponse(e);let i=this.collectedErrors.errors;if(e===null)U(!1);return new Xa().buildResponse(e,i,t,this.validatedExecutionArgs.externalAbortSignal,this.getFinishSharedExecution())}executeCollectedRootFields(e,t,n,r,i){if(i.length===0)return this.executeRootGroupedFieldSet(e,t,n,r,void 0);if(this.validatedExecutionArgs.operation.operation===re.SUBSCRIPTION)U(!1,"`@defer` directive not supported on subscription operations. Disable `@defer` by setting the `if` argument to `false`.");let{newDeliveryGroups:o,newDeliveryGroupMap:s}=this.getNewDeliveryGroupMap(i,void 0,void 0),{groupedFieldSet:a,newGroupedFieldSets:u}=this.buildRootExecutionPlan(n),c=this.executeRootGroupedFieldSet(e,t,a,r,s);if(this.groups.push(...o),u.size>0)this.collectExecutionGroups(e,t,void 0,u,s);return c}buildRootExecutionPlan(e){return Dl(e)}executeCollectedSubfields(e,t,n,r,i,o){if(i.length>0){if(this.validatedExecutionArgs.operation.operation===re.SUBSCRIPTION)U(!1,"`@defer` directive not supported on subscription operations. Disable `@defer` by setting the `if` argument to `false`.")}if(o===void 0&&i.length===0)return this.executeFields(e,t,n,r,o);let{newDeliveryGroups:s,newDeliveryGroupMap:a}=this.getNewDeliveryGroupMap(i,o,n),{groupedFieldSet:u,newGroupedFieldSets:c}=this.buildSubExecutionPlan(r),l=this.executeFields(e,t,n,u,a);if(this.groups.push(...s),c.size>0)this.collectExecutionGroups(e,t,n,c,a);return l}buildSubExecutionPlan(e){return this.deferUsageSet===void 0?Dl(e):Jd(e,this.deferUsageSet)}collectExecutionGroups(e,t,n,r,i){let o=this.getCreateSubExecutor();for(let[s,a]of r){let u=Hd(s,i),c=o(s),l={groups:u,path:n,computation:new Ha(()=>c.executeExecutionGroup(u,e,t,n,a,i),(f)=>c.abort(f))},p=this.deferUsageSet;if(this.validatedExecutionArgs.enableEarlyExecution)if(this.shouldDefer(p,s))Promise.resolve().then(()=>l.computation.prime());else l.computation.prime();this.tasks.push(l)}}executeExecutionGroup(e,t,n,r,i,o){let s;try{s=this.executeFields(t,n,r,i,o)}catch(a){throw this.abort(),a}if(K(s))return s.then((a)=>this.buildExecutionGroupResult(e,r,a),(a)=>{throw this.abort(),a});return this.buildExecutionGroupResult(e,r,s)}buildExecutionGroupResult(e,t,n){let r=n,i=this.collectedErrors.errors;return this.finish({value:i.length?{deliveryGroups:e,path:fe(t),errors:i,data:r}:{deliveryGroups:e,path:fe(t),data:r},work:this.getIncrementalWork()})}getIncrementalWork(){let{groups:e,tasks:t,streams:n,collectedErrors:r}=this;if(r.errors.length===0)return{groups:e,tasks:t,streams:n};let i=Error("Cancelled secondary to null within original result"),o=[];for(let a of t)if(r.hasNulledPosition(a.path)){let u=a.computation.abort(i);if(K(u))U(!1)}else o.push(a);let s=[];for(let a of n)if(r.hasNulledPosition(a.path)){let u=a.queue.abort(i);if(K(u))U(!1)}else s.push(a);return{groups:e,tasks:o,streams:s}}getNewDeliveryGroupMap(e,t,n){let r=[],i=new Map(t);for(let o of e){let s=o.parentDeferUsage,a=s===void 0?void 0:Ol(s,i),u={path:n,label:o.label,parent:a};r.push(u),i.set(o,u)}return{newDeliveryGroups:r,newDeliveryGroupMap:i}}shouldDefer(e,t){return e===void 0||!Array.from(t).every((n)=>e.has(n))}handleStream(e,t,n,r,i,o){let{handle:s,isAsync:a}=n,u=this.buildStreamItemQueue(e,t,s,r.fieldDetailsList,i,o,a),c={label:r.label,path:t,queue:u,initialCount:e};return this.streams.push(c),!0}buildStreamItemQueue(e,t,n,r,i,o,s){let a=this.getCreateSubExecutor(),{enableEarlyExecution:u}=this.validatedExecutionArgs,c=this.sharedExecutionContext;return new qi(async({push:p,stop:f,onStop:d,started:E})=>{let I=new Set,S=!1,G=!1;if(d((W)=>{if(G=!0,!S){for(let H of I)H(W);if(s)c.asyncWorkTracker.add(Qi(n));else c.asyncWorkTracker.addValues(Ls(n))}}),await(u?Promise.resolve():E),G)return;let Z=e;while(!0){let W;try{if(s){if(W=await n.next(),G)return}else W=n.next()}catch(A){throw en(A,Wd(r),fe(t))}if(W.done){S=!0;let A=f();if(K(A))A.catch(()=>{return});return}let H=Pe(t,Z,void 0),Y=a(),ne=Y.completeStreamItem(H,W.value,r,i,o);if(K(ne)){if(u){let A=(h)=>Y.abort(h);I.add(A),ne=ne.finally(()=>{I.delete(A)})}else if(ne=await ne,G)return}let b=p(ne);if(K(b)){if(await b,G)return}Z+=1}},100)}completeStreamItem(e,t,n,r,i){if(Be(t))return this.completePromisedValue(i,n,r,e,t,void 0).then((s)=>this.buildStreamItemResult(s),(s)=>(this.handleFieldError(s,i,n,e),this.buildStreamItemResult(null))).then(void 0,(s)=>{throw this.abort(),s});let o;try{try{o=this.completeValue(i,n,r,e,t,void 0)}catch(s){return this.handleFieldError(s,i,n,e),this.buildStreamItemResult(null)}}catch(s){throw this.abort(),s}if(K(o))return o.then((s)=>this.buildStreamItemResult(s),(s)=>(this.handleFieldError(s,i,n,e),this.buildStreamItemResult(null))).then(void 0,(s)=>{throw this.abort(),s});return this.buildStreamItemResult(o)}buildStreamItemResult(e){let t=e,n=this.collectedErrors.errors,r=this.getIncrementalWork();return this.finish(n.length>0?{value:{item:t,errors:n},work:r}:{value:{item:t},work:r})}}function Wd(e){return e.map((t)=>t.node)}function Hd(e,t){return Array.from(e).map((n)=>Ol(n,t))}function Ol(e,t){return t.get(e)}var zd="The provided schema unexpectedly contains experimental directives (@defer or @stream). These directives may only be utilized if experimental execution features are explicitly enabled.";function Ur(e){if(!st(Oi))return Al(e);return Cn(Oi,Za(e),()=>Al(e))}function Za(e){let t,n=()=>{if(t===void 0)t=Fr(e.document,e.operationName);return t};return{schema:e.schema,document:e.document,rawVariableValues:e.variableValues,get operationName(){return e.operationName??n()?.name?.value},get operationType(){return n()?.operation}}}function Al(e){if(e.schema.getDirective("defer")||e.schema.getDirective("stream"))throw Error(zd);let t=fr(e);if(!("schema"in t))return{errors:t};return tu(t)}function eu(e){if(!st(Oi))return xl(e);return Cn(Oi,Za(e),()=>xl(e))}function xl(e){let t=fr(e);if(!("schema"in t))return{errors:t};return nu(t)}function tu(e){return new Fs(e).executeRootSelectionSet()}function nu(e){return new Mr(e).executeRootSelectionSet()}function $s(e){let t=eu(e);if(K(t)||"initialResult"in t)throw Error("GraphQL execution failed to complete synchronously.");return t}function ru(e){return new Fs(e).executeRootSelectionSet(!1)}function Pr(e){if(!st(_a))return wl(e);return Cn(_a,Za(e),()=>wl(e))}function wl(e){let t=ou(e);if(!("schema"in t))return{errors:t};let n=iu(t);if(K(n))return n.then((r)=>kr(r)?Ps(t,r):r);return kr(n)?Ps(t,n):n}function iu(e){if(!("operation"in e))throw new m("Passing ExecutionArgs to createSourceEventStream() was removed in graphql-js@17.0.0; call validateSubscriptionArgs() first and pass the result instead, or use subscribe() for the full subscription pipeline.");try{let t=Zd(e);if(K(t))return t.then(void 0,(n)=>({errors:[De(n)]}));return t}catch(t){return{errors:[De(t)]}}}function fr(e){let{schema:t,document:n,rootValue:r,contextValue:i,variableValues:o,operationName:s,fieldResolver:a,typeResolver:u,subscribeFieldResolver:c,abortSignal:l,enableEarlyExecution:p,hooks:f,options:d}=e;Dr(t);let E,I=Object.create(null),S=Object.create(null),G=[];for(let h of n.definitions)switch(h.kind){case Tt:if(s==null){if(E!==void 0)return[new m("Must provide operation name if query contains multiple operations.")];E=h}else if(h.name?.value===s)E=h;break;case Qe:{I[h.name.value]=h;let D;if(h.variableDefinitions){let R=Object.create(null);for(let q of h.variableDefinitions){let ce=ms(t,q);if(ce instanceof m){G.push(ce);continue}R[ce.name]=ce}D=R}S[h.name.value]={definition:h,variableSignatures:D};break}default:}if(!E){if(s!=null)return[new m(`Unknown operation named "${s}".`)];return[new m("Must provide an operation.")]}if(G.length>0)return G;let Z=E.variableDefinitions??[],W=e.hideSuggestions??!1,H=o??{},Y={maxErrors:d?.maxCoercionErrors??50,hideSuggestions:W},ne=Pc,b=st(ne)?Cn(ne,{schema:t,document:n,operation:E,rawVariableValues:o,operationName:E.name?.value,operationType:E.operation},()=>Mi(t,Z,H,Y)):Mi(t,Z,H,Y);if(b.errors)return b.errors;let A=!E.directives?.find((h)=>h.name.value===Rc.name);return{schema:t,document:n,fragmentDefinitions:I,fragments:S,rootValue:r,contextValue:i,operation:E,variableValues:b.variableValues,fieldResolver:a??Us,typeResolver:u??su,subscribeFieldResolver:c??Us,hideSuggestions:W,errorPropagation:A,externalAbortSignal:l??void 0,enableEarlyExecution:p===!0,hooks:f??void 0,rawVariableValues:o}}function ou(e){let t=fr(e);if(!("schema"in t))return t;return Xd(t),t}function Xd(e){if(!Yo(e.operation))throw new m("Expected subscription operation.")}var su=function(e,t,n,r){if(ye(e)&&typeof e.__typename==="string")return e.__typename;let i=n.schema.getPossibleTypes(r),o=[];try{for(let s=0;s<i.length;s++){let a=i[s];if(a.isTypeOf){let u=a.isTypeOf(e,t,n);if(Be(u))o[s]=u;else if(u){if(o.length)n.getAsyncHelpers().track(o);return a.name}}}}catch(s){if(o.length)n.getAsyncHelpers().track(o);throw s}if(o.length)return n.getAsyncHelpers().promiseAll(o).then((s)=>{for(let a=0;a<s.length;a++)if(s[a])return i[a].name})},Us=function(e,t,n,r){if(ye(e)||typeof e==="function"){let i=e[r.fieldName];if(typeof i==="function")return e[r.fieldName](t,n,r);return i}};function Ps(e,t,n=ru){function r(o){let s={...e,rootValue:o};return n(s)}let i=e.externalAbortSignal;if(i){let o=pr(t,r);return{...o,next:()=>qa(o.next(),i)}}return pr(t,r)}function Zd(e){let{schema:t,fragments:n,rootValue:r,contextValue:i,operation:o,variableValues:s,hideSuggestions:a,externalAbortSignal:u}=e,c=t.getSubscriptionType();if(c==null)throw new m("Schema is not configured to execute subscription operation.",{nodes:o});let{groupedFieldSet:l}=wr(t,n,s,c,o.selectionSet,a),p=l.entries().next().value,[f,d]=p,E=d[0],I=E.node,S=I.name.value,G=t.getField(c,S),Z=d.map((ne)=>ne.node);if(!G)throw new m(`The subscription field "${S}" is not defined.`,{nodes:Z});let W=Rs(u),H=Pe(void 0,f,c.name),Y=ws(e,G,Z,c,H,W.getAbortSignal,W.getAsyncHelpers);try{let ne=_t(G,I,s,E.fragmentVariableValues,a),A=(G.subscribe??e.subscribeFieldResolver)(r,ne,i,Y);if(Be(A)){let h=Promise.resolve(A);return(u?qa(h,u):h).then(Rl).then(void 0,(R)=>{throw en(R,em(d),fe(H))})}return Rl(A)}catch(ne){throw en(ne,Z,fe(H))}}function Rl(e){if(e instanceof Error)throw e;if(!kr(e))throw new m(`Subscription field must return Async Iterable. Received: ${y(e)}.`);return e}function em(e){return e.map((t)=>t.node)}var au={parse:bt,validate:Lr,execute:Ur,subscribe:Pr};function tm(e){return new Promise((t)=>t(Fl(e)))}function nm(e){let t=Fl(e);if(K(t))throw Error("GraphQL execution failed to complete synchronously.");return t}function Fl(e){let t=e.harness??au,{schema:n,source:r}=e,i=Di(n);if(i.length>0)return{errors:i};let o;try{o=t.parse(r,e)}catch(s){return{errors:[De(s)]}}if(K(o))return o.then((s)=>Ll(t,e,n,s),(s)=>({errors:[De(s)]}));return Ll(t,e,n,o)}function Ll(e,t,n,r){let i=e.validate(n,r,t.rules,t);if(K(i))return i.then((o)=>kl(e,t,o,r));return kl(e,t,i,r)}function kl(e,t,n,r){if(n.length>0)return{errors:n};return e.execute({...t,document:r})}class uu{constructor(){this._indices=new Map}buildResponse(e,t,n,r,i){let{initialStreams:o,events:s}=Ms(n);for(let p of o)this._indices.set(p,p.initialCount);function a(){l.throw(r?.reason).catch(()=>{})}if(r)r.addEventListener("abort",a);let u=()=>{i(),r?.removeEventListener("abort",a)},c=t.length?{errors:t,data:e,hasNext:!0}:{data:e,hasNext:!0},l=Un(pr(s,(p)=>this._handleBatch(p,u)),()=>u());return{initialResult:c,subsequentResults:l}}_handleBatch(e,t){let n={incremental:[],hasNext:!0};for(let s of e)this._handleWorkQueueEvent(s,n,t);let{incremental:r,hasNext:i}=n,o={hasNext:i};if(r.length>0)o.incremental=r;return o}_handleWorkQueueEvent(e,t,n){switch(e.kind){case"GROUP_VALUES":{let r=e.group;for(let i of e.values)t.incremental.push(Gs({data:i.data,path:fe(r.path)},r.label,i.errors));break}case"GROUP_SUCCESS":break;case"GROUP_FAILURE":{let r=e.group;t.incremental.push(Gs({data:null,path:fe(r.path)},r.label,[De(e.error)]));break}case"STREAM_VALUES":{let r=e.stream,{values:i}=e,o=[],s=[];for(let u of i)if(o.push(u.item),u.errors!==void 0)s.push(...u.errors);let a=this._indices.get(r);if(a===void 0)a=r.initialCount,this._indices.set(r,a);this._indices.set(r,a+o.length),t.incremental.push(Gs({items:o,path:fe(Pe(r.path,a,void 0))},r.label,s.length>0?s:void 0));break}case"STREAM_SUCCESS":{this._indices.delete(e.stream);break}case"STREAM_FAILURE":{this._indices.delete(e.stream);let r=e.stream;t.incremental.push(Gs({items:null,path:fe(r.path)},r.label,[De(e.error)]));break}case"WORK_QUEUE_TERMINATION":{n?.(),t.hasNext=!1;break}}}}function Gs(e,t,n){let r=e;if(n!==void 0)r.errors=n;if(t!==void 0)r.label=t;return r}var Cl=Cs((e)=>Vl(e)),rm=Cr((e,t)=>Vl(e,t));class js extends Mr{getCreateSubExecutor(){let e=this.validatedExecutionArgs,t=this.sharedExecutionContext;return(n)=>new js(e,t,n)}buildResponse(e){let t=this.getIncrementalWork(),{tasks:n,streams:r}=t;if(n?.length===0&&r?.length===0)return super.buildResponse(e);let i=this.collectedErrors.errors;if(e===null)U(!1);return new uu().buildResponse(e,i,t,this.validatedExecutionArgs.externalAbortSignal,this.getFinishSharedExecution())}buildRootExecutionPlan(e){return Cl(e)}buildSubExecutionPlan(e){return this.deferUsageSet===void 0?Cl(e):rm(e,this.deferUsageSet)}}function Vl(e,t=new Set){let n=new Fe,r=new Map;for(let[i,o]of e)for(let s of o){let a=s.deferUsage,u=a===void 0?new Set:new Set([a]);if(Vr(t,u))n.add(i,s);else{let c=Vs(r,u);if(c===void 0)c=new Fe,r.set(u,c);c.add(i,s)}}return{groupedFieldSet:n,newGroupedFieldSets:r}}function Ml(e){let t=fr(e);if(!("schema"in t))return{errors:t};return cu(t)}function cu(e){return new js(e).executeRootSelectionSet()}function Ul(e){return{Field(t){let n=e.getFieldDef(),r=n?.deprecationReason;if(n&&r!=null)e.reportError(new m(`The field ${n} is deprecated. ${r}`,{nodes:t}))},Argument(t){let n=e.getArgument(),r=n?.deprecationReason;if(n&&r!=null)e.reportError(new m(`The argument "${n}" is deprecated. ${r}`,{nodes:t}))},ObjectField(t){let n=pe(e.getParentInputType());if(k(n)){let r=n.getFields()[t.name.value],i=r?.deprecationReason;if(i!=null)e.reportError(new m(`The input field ${r} is deprecated. ${i}`,{nodes:t}))}},EnumValue(t){let n=e.getEnumValue(),r=n?.deprecationReason;if(n&&r!=null)e.reportError(new m(`The enum value "${n}" is deprecated. ${r}`,{nodes:t}))}}}function Pl(e){return{Field(t){let n=pe(e.getType());if(n&&ht(n))e.reportError(new m(`GraphQL introspection has been disabled, but the requested query contained the field "${t.name.value}".`,{nodes:t}))}}}function Bs(e){let t={descriptions:!0,specifiedByUrl:!1,directiveIsRepeatable:!1,schemaDescription:!1,inputValueDeprecation:!1,experimentalDirectiveDeprecation:!1,oneOf:!1,typeDepth:9,...e},n=t.descriptions?"description":"",r=t.specifiedByUrl?"specifiedByURL":"",i=t.directiveIsRepeatable?"isRepeatable":"",o=t.schemaDescription?n:"";function s(l){return t.inputValueDeprecation?l:""}function a(l){return t.experimentalDirectiveDeprecation?l:""}let u=t.oneOf?"isOneOf":"";function c(l,p){if(l<=0)return"";if(l>100)throw Error("Please set typeDepth to a reasonable value between 0 and 100; the default is 9.");return` +${p}ofType { +${p} name +${p} kind${c(l-1,p+" ")} +${p}}`}return` + query IntrospectionQuery { + __schema { + ${o} + queryType { name kind } + mutationType { name kind } + subscriptionType { name kind } + types { + ...FullType + } + directives${a("(includeDeprecated: true)")} { + name + ${n} + ${i} + ${a("isDeprecated")} + ${a("deprecationReason")} + locations + args${s("(includeDeprecated: true)")} { + ...InputValue + } + } + } + } + + fragment FullType on __Type { + kind + name + ${n} + ${r} + ${u} + fields(includeDeprecated: true) { + name + ${n} + args${s("(includeDeprecated: true)")} { + ...InputValue + } + type { + ...TypeRef + } + isDeprecated + deprecationReason + } + inputFields${s("(includeDeprecated: true)")} { + ...InputValue + } + interfaces { + ...TypeRef + } + enumValues(includeDeprecated: true) { + name + ${n} + isDeprecated + deprecationReason + } + possibleTypes { + ...TypeRef + } + } + + fragment InputValue on __InputValue { + name + ${n} + type { ...TypeRef } + defaultValue + ${s("isDeprecated")} + ${s("deprecationReason")} + } + + fragment TypeRef on __Type { + kind + name${c(t.typeDepth," ")} + } + `}function $l(e,t){let n={specifiedByUrl:!0,directiveIsRepeatable:!0,schemaDescription:!0,inputValueDeprecation:!0,experimentalDirectiveDeprecation:!0,oneOf:!0,...t},r=bt(Bs(n)),i=$s({schema:e,document:r});if(!(i.errors==null&&i.data!=null))U(!1);return i.data}function Gl(e,t){if(!(ye(e)&&ye(e.__schema)))nt(!1,`Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: ${y(e)}.`);let n=e.__schema,r=new Map(n.types.map((h)=>[h.name,f(h)]));for(let h of[...Ct,...Mt])if(r.has(h.name))r.set(h.name,h);let i=n.queryType!=null?l(n.queryType):null,o=n.mutationType!=null?l(n.mutationType):null,s=n.subscriptionType!=null?l(n.subscriptionType):null,a=n.directives!=null?n.directives.map(A):[];return new ot({description:n.description,query:i,mutation:o,subscription:s,types:[...r.values()],directives:a,assumeValid:t?.assumeValid});function u(h){if(h.kind===ue.LIST){let D=h.ofType;if(D==null)throw Error("Decorated type deeper than introspection query.");return new oe(u(D))}if(h.kind===ue.NON_NULL){let D=h.ofType;if(D==null)throw Error("Decorated type deeper than introspection query.");let R=u(D);return new V(So(R))}return c(h)}function c(h){let D=h.name;if(!D)throw Error(`Unknown type reference: ${y(h)}.`);let R=r.get(D);if(R==null)throw Error(`Invalid or incomplete schema, unknown type: ${D}. Ensure that a full introspection query is used in order to build a client schema.`);return R}function l(h){return bo(c(h))}function p(h){return _o(c(h))}function f(h){switch(h.kind){case ue.SCALAR:return d(h);case ue.OBJECT:return I(h);case ue.INTERFACE:return S(h);case ue.UNION:return G(h);case ue.ENUM:return Z(h);case ue.INPUT_OBJECT:return W(h);default:throw Error(`Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema: ${y(h)}.`)}}function d(h){return new ke({name:h.name,description:h.description,specifiedByURL:h.specifiedByURL})}function E(h){if(h.interfaces===null&&h.kind===ue.INTERFACE)return[];if(h.interfaces==null){let D=y(h);throw Error(`Introspection result missing interfaces: ${D}.`)}return h.interfaces.map(p)}function I(h){return new Ee({name:h.name,description:h.description,interfaces:()=>E(h),fields:()=>H(h)})}function S(h){return new Me({name:h.name,description:h.description,interfaces:()=>E(h),fields:()=>H(h)})}function G(h){if(h.possibleTypes==null){let D=y(h);throw Error(`Introspection result missing possibleTypes: ${D}.`)}return new it({name:h.name,description:h.description,types:()=>h.possibleTypes.map(l)})}function Z(h){if(h.enumValues==null){let D=y(h);throw Error(`Introspection result missing enumValues: ${D}.`)}return new we({name:h.name,description:h.description,values:kt(h.enumValues,(D)=>D.name,(D)=>({description:D.description,deprecationReason:D.deprecationReason}))})}function W(h){if(h.inputFields==null){let D=y(h);throw Error(`Introspection result missing inputFields: ${D}.`)}return new Ge({name:h.name,description:h.description,fields:()=>ne(h.inputFields),isOneOf:h.isOneOf})}function H(h){if(h.fields==null)throw Error(`Introspection result missing fields: ${y(h)}.`);return kt(h.fields,(D)=>D.name,Y)}function Y(h){let D=u(h.type);if(!Nt(D)){let R=y(D);throw Error(`Introspection must provide output type for fields, but received: ${R}.`)}if(h.args==null){let R=y(h);throw Error(`Introspection result missing field args: ${R}.`)}return{description:h.description,deprecationReason:h.deprecationReason,type:D,args:ne(h.args)}}function ne(h){return kt(h,(D)=>D.name,b)}function b(h){let D=u(h.type);if(!xe(D)){let R=y(D);throw Error(`Introspection must provide input type for arguments, but received: ${R}.`)}return{description:h.description,type:D,default:h.defaultValue!=null?{literal:Uo(h.defaultValue)}:void 0,deprecationReason:h.deprecationReason}}function A(h){if(h.args==null){let D=y(h);throw Error(`Introspection result missing directive args: ${D}.`)}if(h.locations==null){let D=y(h);throw Error(`Introspection result missing directive locations: ${D}.`)}return new Re({name:h.name,description:h.description,isRepeatable:h.isRepeatable,deprecationReason:h.deprecationReason,locations:h.locations.slice(),args:ne(h.args)})}}var se={SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD:"FIELD",ARGUMENT:"ARGUMENT",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD:"INPUT_FIELD",DIRECTIVE:"DIRECTIVE"};function Qs(e,t){let n=t({getNamedType:u,setNamedType:c,getNamedTypes:l}),r=new Map;for(let b of e.types){let A=b.name,h=p(b);if(h)r.set(A,h)}let i=[];for(let b of e.directives){if(Vt(b)){i.push(b);continue}let A=ne(b.toConfig());if(A)i.push(new Re(A))}let o={...e,query:e.query&&u(e.query.name),mutation:e.mutation&&u(e.mutation.name),subscription:e.subscription&&u(e.subscription.name),types:Array.from(r.values()),directives:i},s=n[se.SCHEMA];return s==null?o:s(o);function a(b){if(j(b))return new oe(a(b.ofType));if(w(b))return new V(a(b.ofType));return u(b.name)}function u(b){let A=im.get(b)??r.get(b);if(A===void 0)U(!1,`Unknown type: "${b}".`);return A}function c(b){r.set(b.name,b)}function l(){return Array.from(r.values())}function p(b){if(ht(b)||Ze(b))return b;if(ae(b))return f(b);if(L(b))return d(b);if(P(b))return S(b);if(te(b))return G(b);if(z(b))return Z(b);if(k(b))return H(b);U(!1,"Unexpected type: "+y(b))}function f(b){let A=b.toConfig(),h=n[se.SCALAR];return A=h==null?A:h(A),new ke(A)}function d(b){let A=b.toConfig(),h={...A,interfaces:()=>A.interfaces.map((R)=>u(R.name)),fields:()=>E(A.fields,b.name)},D=n[se.OBJECT];return h=D==null?h:D(h),new Ee(h)}function E(b,A){let h=Object.create(null);for(let[D,R]of Object.entries(b)){let q={...R,type:a(R.type),args:I(R.args,D,A)},ce=n[se.FIELD];if(ce)q=ce(q,A);h[D]=q}return h}function I(b,A,h){let D=Object.create(null);for(let[R,q]of Object.entries(b)){let ce={...q,type:a(q.type)},Ue=n[se.ARGUMENT];if(Ue)ce=Ue(ce,A,h);D[R]=ce}return D}function S(b){let A=b.toConfig(),h={...A,interfaces:()=>A.interfaces.map((R)=>u(R.name)),fields:()=>E(A.fields,b.name)},D=n[se.INTERFACE];return h=D==null?h:D(h),new Me(h)}function G(b){let A=b.toConfig(),h={...A,types:()=>A.types.map((R)=>u(R.name))},D=n[se.UNION];return h=D==null?h:D(h),new it(h)}function Z(b){let A=b.toConfig(),h={...A,values:()=>{let R=Object.create(null);for(let[q,ce]of Object.entries(A.values)){let Ue=W(ce,q,b.name);R[q]=Ue}return R}},D=n[se.ENUM];return h=D==null?h:D(h),new we(h)}function W(b,A,h){let D={...b},R=n[se.ENUM_VALUE];return R==null?D:R(D,A,h)}function H(b){let A=b.toConfig(),h={...A,fields:()=>{let R=Object.create(null);for(let[q,ce]of Object.entries(A.fields)){let Ue=Y(ce,q,b.name);R[q]=Ue}return R}},D=n[se.INPUT_OBJECT];return h=D==null?h:D(h),new Ge(h)}function Y(b,A,h){let D={...b,type:a(b.type)},R=n[se.INPUT_FIELD];return R==null?D:R(D,A,h)}function ne(b){let A={...b,args:I(b.args,b.name,void 0)},h=n[se.DIRECTIVE];return h==null?A:h(A)}}var im=new Map([...Ct,...Mt].map((e)=>[e.name,e]));function jl(e,t,n){if(Sr(e),n?.assumeValid!==!0&&n?.assumeValidSDL!==!0)Tl(t,e);let r=e.toConfig(),i=pu(r,t,n);return r===i?e:new ot(i)}function pu(e,t,n){let r=[],i=new Fe,o=new Fe,s=new Fe,a=new Fe,u=new Fe,c=new Fe,l=new Fe,p=[],f,d=[],E=!1;for(let I of t.definitions){switch(I.kind){case Ye:f=I;break;case Rt:d.push(I);break;case pt:p.push(I);break;case Tr:l.add(I.name.value,I);break;case Qt:case At:case xt:case wt:case Yt:case yt:r.push(I);break;case ln:i.add(I.name.value,I);break;case qt:o.add(I.name.value,I);break;case Kt:s.add(I.name.value,I);break;case Jt:a.add(I.name.value,I);break;case pn:u.add(I.name.value,I);break;case Lt:c.add(I.name.value,I);break;default:continue}E=!0}if(!E)return e;return Qs(e,(I)=>{let{getNamedType:S,setNamedType:G,getNamedTypes:Z}=I;return{[se.SCHEMA]:(v)=>{for(let N of r){let g=om.get(N.name.value)??Ue(N);G(g)}let O={query:v.query&&S(v.query.name),mutation:v.mutation&&S(v.mutation.name),subscription:v.subscription&&S(v.subscription.name),...f&&W([f]),...W(d)};return{description:f?.description?.value??v.description,...O,types:Z(),directives:[...v.directives.map(b),...p.map(ne)],extensions:v.extensions,astNode:f??v.astNode,extensionASTNodes:v.extensionASTNodes.concat(d),assumeValid:n?.assumeValid??!1}},[se.INPUT_OBJECT]:(v)=>{let O=c.get(v.name)??[];return{...v,fields:()=>({...v.fields(),...D(O)}),extensionASTNodes:v.extensionASTNodes.concat(O)}},[se.ENUM]:(v)=>{let O=u.get(v.name)??[];return{...v,values:()=>({...v.values(),...R(O)}),extensionASTNodes:v.extensionASTNodes.concat(O)}},[se.SCALAR]:(v)=>{let O=i.get(v.name)??[],N=v.specifiedByURL;for(let g of O)N=lu(g)??N;return{...v,specifiedByURL:N,extensionASTNodes:v.extensionASTNodes.concat(O)}},[se.OBJECT]:(v)=>{let O=o.get(v.name)??[];return{...v,interfaces:()=>[...v.interfaces(),...q(O)],fields:()=>({...v.fields(),...A(O)}),extensionASTNodes:v.extensionASTNodes.concat(O)}},[se.INTERFACE]:(v)=>{let O=s.get(v.name)??[];return{...v,interfaces:()=>[...v.interfaces(),...q(O)],fields:()=>({...v.fields(),...A(O)}),extensionASTNodes:v.extensionASTNodes.concat(O)}},[se.UNION]:(v)=>{let O=a.get(v.name)??[];return{...v,types:()=>[...v.types(),...ce(O)],extensionASTNodes:v.extensionASTNodes.concat(O)}}};function W(v){let O={};for(let N of v){let g=N.operationTypes??[];for(let _ of g)O[_.operation]=H(_.type)}return O}function H(v){let O=v.name.value,N=S(O);if(N===void 0)U(!1,`Unknown type: "${O}".`);return N}function Y(v){if(v.kind===Dn)return new oe(Y(v.type));if(v.kind===cn)return new V(Y(v.type));return H(v)}function ne(v){let O=l.get(v.name.value)??[],N=dr(v)??O.map((g)=>dr(g)).find((g)=>g!=null);return new Re({name:v.name.value,description:v.description?.value,locations:v.locations.map(({value:g})=>g),isRepeatable:v.repeatable,args:h(v.arguments),deprecationReason:N,astNode:v,extensionASTNodes:O})}function b(v){let O=l.get(v.name)??[];if(O.length===0)return v;let N=v.deprecationReason??O.map((g)=>dr(g)).find((g)=>g!=null);return new Re({...v.toConfig(),deprecationReason:N,extensionASTNodes:v.extensionASTNodes.concat(O)})}function A(v){let O=Object.create(null);for(let N of v){let g=N.fields??[];for(let _ of g)O[_.name.value]={type:Y(_.type),description:_.description?.value,args:h(_.arguments),deprecationReason:dr(_),astNode:_}}return O}function h(v){let O=v??[],N=Object.create(null);for(let g of O){let _=Y(g.type);N[g.name.value]={type:_,description:g.description?.value,default:g.defaultValue&&{literal:g.defaultValue},deprecationReason:dr(g),astNode:g}}return N}function D(v){let O=Object.create(null);for(let N of v){let g=N.fields??[];for(let _ of g){let B=Y(_.type);O[_.name.value]={type:B,description:_.description?.value,default:_.defaultValue&&{literal:_.defaultValue},deprecationReason:dr(_),astNode:_}}}return O}function R(v){let O=Object.create(null);for(let N of v){let g=N.values??[];for(let _ of g)O[_.name.value]={description:_.description?.value,deprecationReason:dr(_),astNode:_}}return O}function q(v){return v.flatMap((O)=>O.interfaces?.map(H)??[])}function ce(v){return v.flatMap((O)=>O.types?.map(H)??[])}function Ue(v){let O=v.name.value;switch(v.kind){case At:{let N=o.get(O)??[],g=[v,...N];return new Ee({name:O,description:v.description?.value,interfaces:()=>q(g),fields:()=>A(g),astNode:v,extensionASTNodes:N})}case xt:{let N=s.get(O)??[],g=[v,...N];return new Me({name:O,description:v.description?.value,interfaces:()=>q(g),fields:()=>A(g),astNode:v,extensionASTNodes:N})}case Yt:{let N=u.get(O)??[],g=[v,...N];return new we({name:O,description:v.description?.value,values:()=>R(g),astNode:v,extensionASTNodes:N})}case wt:{let N=a.get(O)??[],g=[v,...N];return new it({name:O,description:v.description?.value,types:()=>ce(g),astNode:v,extensionASTNodes:N})}case Qt:{let N=i.get(O)??[],g=lu(v);for(let _ of N)g=lu(_)??g;return new ke({name:O,description:v.description?.value,specifiedByURL:g,astNode:v,extensionASTNodes:N})}case yt:{let N=c.get(O)??[],g=[v,...N];return new Ge({name:O,description:v.description?.value,fields:()=>D(g),astNode:v,extensionASTNodes:N,isOneOf:sm(v)})}}}})}var om=new Map([...Ct,...Mt].map((e)=>[e.name,e]));function dr(e){return Zt(mn,e)?.reason}function lu(e){return Zt(gi,e)?.url}function sm(e){return Boolean(Zt(Ni,e))}function Ki(e,t){if(t?.assumeValid!==!0&&t?.assumeValidSDL!==!0)El(e);let n={description:void 0,types:[],directives:[],extensions:Object.create(null),extensionASTNodes:[],assumeValid:!1},r=pu(n,e,t);if(r.astNode==null)for(let o of r.types)switch(o.name){case"Query":r.query=o;break;case"Mutation":r.mutation=o;break;case"Subscription":r.subscription=o;break}let i=[...r.directives,...je.filter((o)=>r.directives.every((s)=>s.name!==o.name))];return new ot({...r,directives:i})}function Ys(e,t){let n=bt(e,{noLocation:t?.noLocation,experimentalFragmentArguments:t?.experimentalFragmentArguments});return Ki(n,{assumeValidSDL:t?.assumeValidSDL,assumeValid:t?.assumeValid})}function Bl(e){return new ot(Qs(e.toConfig(),()=>({[se.OBJECT]:(t)=>({...t,interfaces:()=>Ji(t.interfaces()),fields:()=>$r(t.fields())}),[se.FIELD]:(t)=>({...t,args:$r(t.args)}),[se.INTERFACE]:(t)=>({...t,interfaces:()=>Ji(t.interfaces()),fields:()=>$r(t.fields())}),[se.UNION]:(t)=>({...t,types:()=>Ji(t.types())}),[se.ENUM]:(t)=>({...t,values:()=>$r(t.values())}),[se.INPUT_OBJECT]:(t)=>({...t,fields:()=>$r(t.fields())}),[se.DIRECTIVE]:(t)=>({...t,locations:Ql(t.locations,(n)=>n),args:$r(t.args)}),[se.SCHEMA]:(t)=>({...t,types:Ji(t.types),directives:Ji(t.directives)})})))}function $r(e){let t=Object.create(null);for(let n of Object.keys(e).sort(fn))t[n]=e[n];return t}function Ji(e){return Ql(e,(t)=>t.name)}function Ql(e,t){return e.slice().sort((n,r)=>{let i=t(n),o=t(r);return fn(i,o)})}function Yl(e){return Kl(e,(t)=>!Vt(t),am)}function ql(e){return Kl(e,Vt,ht)}function am(e){return!Ze(e)&&!ht(e)}function Kl(e,t,n){let r=e.getDirectives().filter(t),i=Object.values(e.getTypeMap()).filter(n);return[um(e),...r.map((o)=>hu(o)),...i.map((o)=>du(o))].filter(Boolean).join(` + +`)}function um(e){let t=e.getQueryType(),n=e.getMutationType(),r=e.getSubscriptionType();if(!t&&!n&&!r)return;if(e.description!=null||!cm(e))return St(e)+`schema { +`+(t?` query: ${t} +`:"")+(n?` mutation: ${n} +`:"")+(r?` subscription: ${r} +`:"")+"}"}function cm(e){return e.getQueryType()==e.getType("Query")&&e.getMutationType()==e.getType("Mutation")&&e.getSubscriptionType()==e.getType("Subscription")}function du(e){if(ae(e))return lm(e);if(L(e))return pm(e);if(P(e))return fm(e);if(te(e))return dm(e);if(z(e))return mm(e);if(k(e))return hm(e);U(!1,"Unexpected type: "+y(e))}function lm(e){return St(e)+`scalar ${e}`+Em(e)}function Jl(e){let t=e.getInterfaces();return t.length?" implements "+t.map((n)=>n.name).join(" & "):""}function pm(e){return St(e)+`type ${e}`+Jl(e)+Wl(e)}function fm(e){return St(e)+`interface ${e}`+Jl(e)+Wl(e)}function dm(e){let t=e.getTypes(),n=t.length?" = "+t.join(" | "):"";return St(e)+`union ${e.name}`+n}function mm(e){let t=e.getValues().map((n,r)=>St(n," ",!r)+" "+n.name+qs(n.deprecationReason));return St(e)+`enum ${e}`+mu(t)}function hm(e){let t=Object.values(e.getFields()).map((n,r)=>St(n," ",!r)+" "+fu(n));return St(e)+`input ${e}`+(e.isOneOf?" @oneOf":"")+mu(t)}function Wl(e){let t=Object.values(e.getFields()).map((n,r)=>St(n," ",!r)+" "+n.name+Hl(n.args," ")+": "+String(n.type)+qs(n.deprecationReason));return mu(t)}function mu(e){return e.length!==0?` { +`+e.join(` +`)+` +}`:""}function Hl(e,t=""){if(e.length===0)return"";if(e.every((n)=>n.description==null))return"("+e.map(fu).join(", ")+")";return`( +`+e.map((n,r)=>St(n," "+t,!r)+" "+t+fu(n)).join(` +`)+` +`+t+")"}function fu(e){let t=e.name+": "+String(e.type),n=vr(e);if(n)t+=` = ${ee(n)}`;return t+qs(e.deprecationReason)}function hu(e){return St(e)+`directive ${e}`+Hl(e.args)+qs(e.deprecationReason)+(e.isRepeatable?" repeatable":"")+" on "+e.locations.join(" | ")}function qs(e){if(e==null)return"";if(e!==yi)return` @deprecated(reason: ${ee({kind:Ie,value:e})})`;return" @deprecated"}function Em(e){if(e.specifiedByURL==null)return"";return` @specifiedBy(url: ${ee({kind:Ie,value:e.specifiedByURL})})`}function St(e,t="",n=!0){let{description:r}=e;if(r==null)return"";let i=ee({kind:Ie,value:r,block:Qu(r)});return(t&&!n?` +`+t:t)+i.replaceAll(` +`,` +`+t)+` +`}function Pn(e,t,n){if(!e)return;if(e.kind===Ce){let r=e.name.value;if(n==null||!Object.hasOwn(n,r))return;let i=n[r];if(i===void 0)return;if(i===null&&w(t))return;return i}if(w(t)){if(e.kind===le)return;return Pn(e,t.ofType,n)}if(e.kind===le)return null;if(j(t)){let r=t.ofType;if(e.kind===Ae){let o=[];for(let s of e.values)if(zl(s,n)){if(w(r))return;o.push(null)}else{let a=Pn(s,r,n);if(a===void 0)return;o.push(a)}return o}let i=Pn(e,r,n);if(i===void 0)return;return[i]}if(k(t)){if(e.kind!==Ve)return;let r=Object.create(null),i=t.getFields();if(e.fields.some((a)=>!Object.hasOwn(i,a.name.value)))return;let s=new Map(e.fields.map((a)=>[a.name.value,a]));for(let a of Object.values(i)){let u=s.get(a.name);if(u==null||zl(u.value,n)){if(a.defaultValue!==void 0)r[a.name]=a.defaultValue;else if(w(a.type))return;continue}let c=Pn(u.value,a.type,n);if(c===void 0)return;r[a.name]=c}if(t.isOneOf){let a=Object.keys(r);if(s.size!==1||a.length!==1)return;for(let[u,c]of s)if(c.value.kind===le||r[u]===null)return}return r}if(ve(t)){let r;try{r=t.parseLiteral(e,n)}catch(i){return}if(r===void 0)return;return r}U(!1,"Unexpected input type: "+y(t))}function zl(e,t){return e.kind===Ce&&(t?.[e.name.value]===void 0||!Object.hasOwn(t,e.name.value))}function Xl(e){let t=[];for(let n of e)t.push(...n.definitions);return{kind:jt,definitions:t}}function ep(e){let t=[],n=Object.create(null);for(let i of e.definitions)switch(i.kind){case Tt:t.push(i);break;case Qe:n[i.name.value]=Zl(i.selectionSet);break;default:}let r=Object.create(null);for(let i of t){let o=new Set;for(let a of Zl(i.selectionSet))tp(o,n,a);let s=i.name?i.name.value:"";r[s]={kind:jt,definitions:e.definitions.filter((a)=>a===i||a.kind===Qe&&o.has(a.name.value))}}return r}function tp(e,t,n){if(!e.has(n)){e.add(n);let r=t[n];if(r!==void 0)for(let i of r)tp(e,t,i)}}function Zl(e){let t=[];return ft(e,{FragmentSpread(n){t.push(n.name.value)}}),t}function np(e){let t=xi(e)?e:new Pt(e),n=t.body,r=new ar(t),i="",o=!1;while(r.advance().kind!==T.EOF){let s=r.token,a=s.kind,u=!Co(s.kind);if(o){if(u||s.kind===T.SPREAD)i+=" "}let c=n.slice(s.start,s.end);if(a===T.BLOCK_STRING)i+=No(s.value,{minimize:!0});else i+=c;o=u}return i}var Se={TYPE_REMOVED:"TYPE_REMOVED",TYPE_CHANGED_KIND:"TYPE_CHANGED_KIND",TYPE_REMOVED_FROM_UNION:"TYPE_REMOVED_FROM_UNION",VALUE_REMOVED_FROM_ENUM:"VALUE_REMOVED_FROM_ENUM",REQUIRED_INPUT_FIELD_ADDED:"REQUIRED_INPUT_FIELD_ADDED",IMPLEMENTED_INTERFACE_REMOVED:"IMPLEMENTED_INTERFACE_REMOVED",FIELD_REMOVED:"FIELD_REMOVED",FIELD_CHANGED_KIND:"FIELD_CHANGED_KIND",REQUIRED_ARG_ADDED:"REQUIRED_ARG_ADDED",ARG_REMOVED:"ARG_REMOVED",ARG_CHANGED_KIND:"ARG_CHANGED_KIND",DIRECTIVE_REMOVED:"DIRECTIVE_REMOVED",DIRECTIVE_ARG_REMOVED:"DIRECTIVE_ARG_REMOVED",REQUIRED_DIRECTIVE_ARG_ADDED:"REQUIRED_DIRECTIVE_ARG_ADDED",DIRECTIVE_REPEATABLE_REMOVED:"DIRECTIVE_REPEATABLE_REMOVED",DIRECTIVE_LOCATION_REMOVED:"DIRECTIVE_LOCATION_REMOVED"},at={VALUE_ADDED_TO_ENUM:"VALUE_ADDED_TO_ENUM",TYPE_ADDED_TO_UNION:"TYPE_ADDED_TO_UNION",OPTIONAL_INPUT_FIELD_ADDED:"OPTIONAL_INPUT_FIELD_ADDED",OPTIONAL_ARG_ADDED:"OPTIONAL_ARG_ADDED",IMPLEMENTED_INTERFACE_ADDED:"IMPLEMENTED_INTERFACE_ADDED",ARG_DEFAULT_VALUE_CHANGE:"ARG_DEFAULT_VALUE_CHANGE",INPUT_FIELD_DEFAULT_VALUE_CHANGE:"INPUT_FIELD_DEFAULT_VALUE_CHANGE"},_e={DESCRIPTION_CHANGED:"DESCRIPTION_CHANGED",TYPE_ADDED:"TYPE_ADDED",OPTIONAL_INPUT_FIELD_ADDED:"OPTIONAL_INPUT_FIELD_ADDED",OPTIONAL_ARG_ADDED:"OPTIONAL_ARG_ADDED",DIRECTIVE_ADDED:"DIRECTIVE_ADDED",FIELD_ADDED:"FIELD_ADDED",DIRECTIVE_REPEATABLE_ADDED:"DIRECTIVE_REPEATABLE_ADDED",DIRECTIVE_LOCATION_ADDED:"DIRECTIVE_LOCATION_ADDED",OPTIONAL_DIRECTIVE_ARG_ADDED:"OPTIONAL_DIRECTIVE_ARG_ADDED",FIELD_CHANGED_KIND_SAFE:"FIELD_CHANGED_KIND_SAFE",ARG_CHANGED_KIND_SAFE:"ARG_CHANGED_KIND_SAFE",ARG_DEFAULT_VALUE_ADDED:"ARG_DEFAULT_VALUE_ADDED",INPUT_FIELD_DEFAULT_VALUE_ADDED:"INPUT_FIELD_DEFAULT_VALUE_ADDED"};function sp(e,t){return Ks(e,t).filter((n)=>(n.type in Se))}function ap(e,t){return Ks(e,t).filter((n)=>(n.type in at))}function Ks(e,t){return[...ym(e,t),...Tm(e,t)]}function Tm(e,t){let n=[],r=gn(e.getDirectives(),t.getDirectives());for(let i of r.removed)n.push({type:Se.DIRECTIVE_REMOVED,description:`Directive ${i} was removed.`});for(let i of r.added)n.push({type:_e.DIRECTIVE_ADDED,description:`Directive @${i.name} was added.`});for(let[i,o]of r.persisted){let s=gn(i.args,o.args);for(let a of s.added)if(ze(a))n.push({type:Se.REQUIRED_DIRECTIVE_ARG_ADDED,description:`A required argument ${a} was added.`});else n.push({type:_e.OPTIONAL_DIRECTIVE_ARG_ADDED,description:`An optional argument @${i.name}(${a.name}:) was added.`});for(let a of s.removed)n.push({type:Se.DIRECTIVE_ARG_REMOVED,description:`Argument ${a} was removed.`});for(let[a,u]of s.persisted){let c=Gr(a.type,u.type),l=jr(a),p=jr(u);if(!c)n.push({type:Se.ARG_CHANGED_KIND,description:`Argument @${i.name}(${a.name}:) has changed type from ${String(a.type)} to ${String(u.type)}.`});else if(l!==void 0){if(p===void 0)n.push({type:at.ARG_DEFAULT_VALUE_CHANGE,description:`@${i.name}(${a.name}:) defaultValue was removed.`});else if(l!==p)n.push({type:at.ARG_DEFAULT_VALUE_CHANGE,description:`@${i.name}(${a.name}:) has changed defaultValue from ${l} to ${p}.`})}else if(p!==void 0&&l===void 0)n.push({type:_e.ARG_DEFAULT_VALUE_ADDED,description:`@${i.name}(${a.name}:) added a defaultValue ${p}.`});else if(a.type.toString()!==u.type.toString())n.push({type:_e.ARG_CHANGED_KIND_SAFE,description:`Argument @${i.name}(${a.name}:) has changed type from ${String(a.type)} to ${String(u.type)}.`});if(a.description!==u.description)n.push({type:_e.DESCRIPTION_CHANGED,description:`Description of @${i.name}(${i.name}) has changed to "${u.description}".`})}if(i.isRepeatable&&!o.isRepeatable)n.push({type:Se.DIRECTIVE_REPEATABLE_REMOVED,description:`Repeatable flag was removed from ${i}.`});else if(o.isRepeatable&&!i.isRepeatable)n.push({type:_e.DIRECTIVE_REPEATABLE_ADDED,description:`Repeatable flag was added to @${i.name}.`});if(i.description!==o.description)n.push({type:_e.DESCRIPTION_CHANGED,description:`Description of @${i.name} has changed to "${o.description}".`});for(let a of i.locations)if(!o.locations.includes(a))n.push({type:Se.DIRECTIVE_LOCATION_REMOVED,description:`${a} was removed from ${i}.`});for(let a of o.locations)if(!i.locations.includes(a))n.push({type:_e.DIRECTIVE_LOCATION_ADDED,description:`${a} was added to @${i.name}.`})}return n}function ym(e,t){let n=[],r=gn(Object.values(e.getTypeMap()),Object.values(t.getTypeMap()));for(let i of r.removed)n.push({type:Se.TYPE_REMOVED,description:Ze(i)?`Standard scalar ${i} was removed because it is not referenced anymore.`:`${i} was removed.`});for(let i of r.added)n.push({type:_e.TYPE_ADDED,description:`${i} was added.`});for(let[i,o]of r.persisted){if(i.description!==o.description)n.push({type:_e.DESCRIPTION_CHANGED,description:`Description of ${i.name} has changed to "${o.description}".`});if(z(i)&&z(o))n.push(...Im(i,o));else if(te(i)&&te(o))n.push(...Nm(i,o));else if(k(i)&&k(o))n.push(...gm(i,o));else if(L(i)&&L(o))n.push(...ip(i,o),...rp(i,o));else if(P(i)&&P(o))n.push(...ip(i,o),...rp(i,o));else if(i.constructor!==o.constructor)n.push({type:Se.TYPE_CHANGED_KIND,description:`${i} changed from ${op(i)} to ${op(o)}.`})}return n}function gm(e,t){let n=[],r=gn(Object.values(e.getFields()),Object.values(t.getFields()));for(let i of r.added)if(Xe(i))n.push({type:Se.REQUIRED_INPUT_FIELD_ADDED,description:`A required field ${i} was added.`});else n.push({type:at.OPTIONAL_INPUT_FIELD_ADDED,description:`An optional field ${i} was added.`});for(let i of r.removed)n.push({type:Se.FIELD_REMOVED,description:`Field ${i} was removed.`});for(let[i,o]of r.persisted){let s=Gr(i.type,o.type),a=jr(i),u=jr(o);if(!s)n.push({type:Se.FIELD_CHANGED_KIND,description:`Field ${o} changed type from ${i.type} to ${o.type}.`});else if(a!==void 0){if(u===void 0)n.push({type:at.INPUT_FIELD_DEFAULT_VALUE_CHANGE,description:`${i} defaultValue was removed.`});else if(a!==u)n.push({type:at.INPUT_FIELD_DEFAULT_VALUE_CHANGE,description:`${i} has changed defaultValue from ${a} to ${u}.`})}else if(u!==void 0&&a===void 0)n.push({type:_e.INPUT_FIELD_DEFAULT_VALUE_ADDED,description:`${i} added a defaultValue ${u}.`});else if(i.type.toString()!==o.type.toString())n.push({type:_e.FIELD_CHANGED_KIND_SAFE,description:`Field ${e}.${i.name} changed type from ${String(i.type)} to ${String(o.type)}.`});if(i.description!==o.description)n.push({type:_e.DESCRIPTION_CHANGED,description:`Description of input-field ${t}.${o.name} has changed to "${o.description}".`})}return n}function Nm(e,t){let n=[],r=gn(e.getTypes(),t.getTypes());for(let i of r.added)n.push({type:at.TYPE_ADDED_TO_UNION,description:`${i} was added to union type ${e}.`});for(let i of r.removed)n.push({type:Se.TYPE_REMOVED_FROM_UNION,description:`${i} was removed from union type ${e}.`});return n}function Im(e,t){let n=[],r=gn(e.getValues(),t.getValues());for(let i of r.added)n.push({type:at.VALUE_ADDED_TO_ENUM,description:`Enum value ${i} was added.`});for(let i of r.removed)n.push({type:Se.VALUE_REMOVED_FROM_ENUM,description:`Enum value ${i} was removed.`});for(let[i,o]of r.persisted)if(i.description!==o.description)n.push({type:_e.DESCRIPTION_CHANGED,description:`Description of enum value ${e}.${i.name} has changed to "${o.description}".`});return n}function rp(e,t){let n=[],r=gn(e.getInterfaces(),t.getInterfaces());for(let i of r.added)n.push({type:at.IMPLEMENTED_INTERFACE_ADDED,description:`${i} added to interfaces implemented by ${e}.`});for(let i of r.removed)n.push({type:Se.IMPLEMENTED_INTERFACE_REMOVED,description:`${e} no longer implements interface ${i}.`});return n}function ip(e,t){let n=[],r=gn(Object.values(e.getFields()),Object.values(t.getFields()));for(let i of r.removed)n.push({type:Se.FIELD_REMOVED,description:`Field ${i} was removed.`});for(let i of r.added)n.push({type:_e.FIELD_ADDED,description:`Field ${e}.${i.name} was added.`});for(let[i,o]of r.persisted){if(n.push(...vm(i,o)),!Wi(i.type,o.type))n.push({type:Se.FIELD_CHANGED_KIND,description:`Field ${o} changed type from ${i.type} to ${o.type}.`});else if(i.type.toString()!==o.type.toString())n.push({type:_e.FIELD_CHANGED_KIND_SAFE,description:`Field ${e}.${i.name} changed type from ${String(i.type)} to ${String(o.type)}.`});if(i.description!==o.description)n.push({type:_e.DESCRIPTION_CHANGED,description:`Description of field ${e}.${i.name} has changed to "${o.description}".`})}return n}function vm(e,t){let n=[],r=gn(e.args,t.args);for(let i of r.removed)n.push({type:Se.ARG_REMOVED,description:`Argument ${i} was removed.`});for(let[i,o]of r.persisted){let s=Gr(i.type,o.type),a=jr(i),u=jr(o);if(!s)n.push({type:Se.ARG_CHANGED_KIND,description:`Argument ${o} has changed type from ${i.type} to ${o.type}.`});else if(a!==void 0){if(u===void 0)n.push({type:at.ARG_DEFAULT_VALUE_CHANGE,description:`${i} defaultValue was removed.`});else if(a!==u)n.push({type:at.ARG_DEFAULT_VALUE_CHANGE,description:`${i} has changed defaultValue from ${a} to ${u}.`})}else if(u!==void 0&&a===void 0)n.push({type:_e.ARG_DEFAULT_VALUE_ADDED,description:`${i} added a defaultValue ${u}.`});else if(i.type.toString()!==o.type.toString())n.push({type:_e.ARG_CHANGED_KIND_SAFE,description:`Argument ${i} has changed type from ${String(i.type)} to ${String(o.type)}.`});if(i.description!==o.description)n.push({type:_e.DESCRIPTION_CHANGED,description:`Description of argument ${i} has changed to "${o.description}".`})}for(let i of r.added)if(ze(i))n.push({type:Se.REQUIRED_ARG_ADDED,description:`A required argument ${i} was added.`});else n.push({type:at.OPTIONAL_ARG_ADDED,description:`An optional argument ${i} was added.`});return n}function Wi(e,t){if(j(e))return j(t)&&Wi(e.ofType,t.ofType)||w(t)&&Wi(e,t.ofType);if(w(e))return w(t)&&Wi(e.ofType,t.ofType);return rt(t)&&e.name===t.name||w(t)&&Wi(e,t.ofType)}function Gr(e,t){if(j(e))return j(t)&&Gr(e.ofType,t.ofType);if(w(e))return w(t)&&Gr(e.ofType,t.ofType)||!w(t)&&Gr(e.ofType,t);return rt(t)&&e.name===t.name}function op(e){if(ae(e))return"a Scalar type";if(L(e))return"an Object type";if(P(e))return"an Interface type";if(te(e))return"a Union type";if(z(e))return"an Enum type";if(k(e))return"an Input type";U(!1,"Unexpected type: "+y(e))}function jr(e){let t=vr(e);if(t)return ee(cr(t))}function gn(e,t){let n=[],r=[],i=[],o=sn(e,({name:a})=>a),s=sn(t,({name:a})=>a);for(let a of e){let u=s[a.name];if(u===void 0)r.push(a);else i.push([a,u])}for(let a of t)if(o[a.name]===void 0)n.push(a);return{added:n,persisted:i,removed:r}}function up(e,t){return Eu(e,Po(t))}function bm(e,t){let n=t.name.value,r=e.getType(n);if(r==null)return;return{kind:"NamedType",type:r}}function _m(e,t){let n=t.name.value,r=e.getType(n);if(!r)throw Error(`Expected ${y(n)} to be defined as a type in the schema.`);if(!z(r)&&!k(r)&&!L(r)&&!P(r))throw Error(`Expected ${y(n)} to be an Enum, Input Object, Object or Interface type.`);if(z(r)){let s=t.memberName.value,a=r.getValue(s);if(a==null)return;return{kind:"EnumValue",type:r,enumValue:a}}if(k(r)){let s=t.memberName.value,a=r.getFields()[s];if(a==null)return;return{kind:"InputField",type:r,inputField:a}}let i=t.memberName.value,o=e.getField(r,i);if(o==null)return;return{kind:"Field",type:r,field:o}}function Sm(e,t){let n=t.name.value,r=e.getType(n);if(r==null)throw Error(`Expected ${y(n)} to be defined as a type in the schema.`);if(!L(r)&&!P(r))throw Error(`Expected ${y(n)} to be an object type or interface type.`);let i=t.fieldName.value,o=e.getField(r,i);if(o==null)throw Error(`Expected ${y(i)} to exist as a field of type ${y(n)} in the schema.`);let s=t.argumentName.value,a=o.args.find((u)=>u.name===s);if(a==null)return;return{kind:"FieldArgument",type:r,field:o,fieldArgument:a}}function Dm(e,t){let n=t.name.value,r=e.getDirective(n);if(!r)return;return{kind:"Directive",directive:r}}function Om(e,t){let n=t.name.value,r=e.getDirective(n);if(!r)throw Error(`Expected ${y(n)} to be defined as a directive in the schema.`);let{argumentName:{value:i}}=t,o=r.args.find((s)=>s.name===i);if(!o)return;return{kind:"DirectiveArgument",directive:r,directiveArgument:o}}function Eu(e,t){switch(t.kind){case po:return bm(e,t);case fo:return _m(e,t);case mo:return Sm(e,t);case ho:return Dm(e,t);case Eo:return Om(e,t)}}var Js=(e)=>Array.isArray(e)?e:e?[e]:[];function Am(e,t){if(String(e)<String(t))return-1;if(String(e)>String(t))return 1;return 0}function cp(e){let t;if("alias"in e)t=e.alias?.value;if(t==null&&"name"in e)t=e.name?.value;if(t==null)t=e.kind;return t}function $n(e,t,n){let r=cp(e),i=cp(t);if(typeof n==="function")return n(r,i);return Am(r,i)}function Br(e){return e!=null}function Qr(e){let t=new WeakMap;return function(r){let i=t.get(r);if(i===void 0){let o=e(r);return t.set(r,o),o}return i}}function lp(e,t,n=["directives"]){let r={};if(e.extensions){let s=e.extensions;for(let a of n)s=s?.[a];if(s!=null)for(let a in s){let u=s[a],c=a;if(Array.isArray(u))for(let l of u){let p=r[c];if(!p)p=[],r[c]=p;p.push(l)}else{let l=r[c];if(!l)l=[],r[c]=l;l.push(u)}}}let i=Qr((s)=>JSON.stringify(s)),o=[];if(e.astNode)o.push(e.astNode);if(e.extensionASTNodes)o.push(...e.extensionASTNodes);for(let s of o)if(s.directives?.length)for(let a of s.directives){let u=a.name.value,c=r[u];if(!c)c=[],r[u]=c;let l=t?.getDirective(u),p={};if(l)p=_t(l,a);if(a.arguments)for(let f of a.arguments){let d=f.name.value;if(p[d]==null){let E=l?.args.find((I)=>I.name===d);if(E)p[d]=Pn(f.value,E.type)}if(p[d]==null)p[d]=Wt(f.value)}if(o.length>0&&c.length>0){let f=i(p);if(c.some((d)=>i(d)===f))continue}c.push(p)}return r}function Tu(e,t=["directives"]){let n=lp(e,void 0,t);return Object.entries(n).map(([r,i])=>i?.map((o)=>({name:r,args:o}))).flat(1/0).filter(Boolean)}function xm(){let e=globalThis.process?.getBuiltinModule;if(typeof e!=="function")return;try{let t=e("util");if(typeof t?.inspect!=="function")return;return(n)=>t.inspect(n,{depth:3,colors:!1,compact:!0,breakLength:1/0}).replaceAll("[Object: null prototype] ","")}catch{return}}var pp=xm();function yu(e,t=3){if(t>0&&e!=null&&typeof e.toJSON==="function")try{let n=e.toJSON();if(n!==e)return typeof n==="string"?n:yu(n,t-1)}catch{}if(pp)return pp(e);if(typeof e==="string")return JSON.stringify(e);if(typeof e==="function")return e.name?`[function ${e.name}]`:"[function]";if(e===void 0)return"undefined";try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function tn(e){if(w(e)){let t=tn(e.ofType);if(t.kind===cn)throw Error(`Invalid type node ${yu(e)}. Inner type of non-null type cannot be a non-null type.`);return{kind:cn,type:t}}else if(j(e))return{kind:Dn,type:tn(e.ofType)};return{kind:Sn,name:{kind:Ne,value:e.name}}}function Nn(e){if(e===null)return{kind:le};if(e===void 0)return null;if(Array.isArray(e)){let t=[];for(let n of e){let r=Nn(n);if(r!=null)t.push(r)}return{kind:Ae,values:t}}if(typeof e==="object"){if(e?.toJSON)return Nn(e.toJSON());let t=[];for(let n in e){let r=e[n],i=Nn(r);if(i)t.push({kind:un,name:{kind:Ne,value:n},value:i})}return{kind:Ve,fields:t}}if(typeof e==="boolean")return{kind:tt,value:e};if(typeof e==="bigint")return{kind:Oe,value:String(e)};if(typeof e==="number"&&isFinite(e)){let t=String(e);return wm.test(t)?{kind:Oe,value:t}:{kind:Bt,value:t}}if(typeof e==="string")return{kind:Ie,value:e};throw TypeError(`Cannot convert value to AST: ${e}.`)}var wm=/^-?(?:0|[1-9][0-9]*)$/;function fp(e){return e!=null&&typeof e==="object"&&typeof e[Symbol.iterator]==="function"}function dp(e){return typeof e==="object"&&e!==null}function Hi(e){return e==="__proto__"||e==="constructor"||e==="prototype"}function In(e,t){if(w(t)){let n=In(e,t.ofType);if(n?.kind===le)return null;return n}if(e===null)return{kind:le};if(e===void 0)return null;if(j(t)){let n=t.ofType;if(fp(e)){let r=[];for(let i of e){let o=In(i,n);if(o!=null)r.push(o)}return{kind:Ae,values:r}}return In(e,n)}if(k(t)){if(!dp(e))return null;let n=[];for(let r of Object.values(t.getFields())){let i=In(e[r.name],r.type);if(i)n.push({kind:un,name:{kind:Ne,value:r.name},value:i})}return{kind:Ve,fields:n}}if(ve(t)){if(z(t)){let n=t.getValues();for(let r of n){if(r.value===e){e=r.name;break}if(r.name===e){e=r.name;break}}return{kind:Ot,value:e}}else e=t.serialize(e);if(e==null)return null;if(t.name==="ID"&&typeof e==="string"&&Rm.test(e))return{kind:Oe,value:e}}return Nn(e)}var Rm=/^-?(?:0|[1-9][0-9]*)$/;var gu=(e)=>{if("default"in e){if(!e.default)return;if("value"in e.default)return Nn(e.default.value)??void 0;let t=Wt(e.default.literal);return In(t,e.type)??void 0}return e.defaultValue!==void 0?In(e.defaultValue,e.type)??void 0:void 0};function mp(e){return e.trim().length>0}function Et(e){if(typeof e.description==="string"){if(!mp(e.description))return;return{kind:Ie,value:e.description,block:!0}}if(e.astNode?.description&&mp(e.astNode.description.value))return{...e.astNode.description,block:!0}}var NR=Qr(function(t){let n=Lm(t);return new Set([...n].map((r)=>r.name))}),Lm=Qr(function(t){let n=Nu(t);return new Set(n.values())}),Nu=Qr(function(t){let n=new Map,r=t.getQueryType();if(r)n.set("query",r);let i=t.getMutationType();if(i)n.set("mutation",i);let o=t.getSubscriptionType();if(o)n.set("subscription",o);return n});function hp(e,t={}){let n=t.pathToDirectivesInExtensions,r=e.getTypeMap(),i=km(e,n),o=i!=null?[i]:[],s=e.getDirectives();for(let a of s){if(Vt(a))continue;o.push(Fm(a,e,n))}for(let a in r){let u=r[a],c=Ze(u),l=ht(u);if(c||l)continue;if(L(u))o.push(Cm(u,e,n));else if(P(u))o.push(Vm(u,e,n));else if(te(u))o.push(Mm(u,e,n));else if(k(u))o.push(Um(u,e,n));else if(z(u))o.push(Pm(u,e,n));else if(ae(u))o.push($m(u,e,n));else throw Error(`Unknown type ${u}.`)}return{kind:jt,definitions:o}}function km(e,t){let n=new Map([["query",void 0],["mutation",void 0],["subscription",void 0]]),r=[];if(e.astNode!=null)r.push(e.astNode);if(e.extensionASTNodes!=null)for(let c of e.extensionASTNodes)r.push(c);for(let c of r)if(c.operationTypes)for(let l of c.operationTypes)n.set(l.operation,l);let i=Nu(e);for(let[c,l]of n){let p=i.get(c);if(p!=null){let f=tn(p);if(l!=null)l.type=f;else n.set(c,{kind:si,operation:c,type:f})}else n.set(c,void 0)}let o=[...n.values()].filter(Br),s=nn(e,e,t);if(!o.length&&!s.length)return null;let a={kind:o.length?Ye:Rt,operationTypes:o,directives:s},u=Et(e);if(u)a.description=u;return a}function Fm(e,t,n){return{kind:pt,description:Et(e),name:{kind:Ne,value:e.name},arguments:e.args?.map((r)=>Ep(r,t,n)),repeatable:e.isRepeatable,locations:e.locations?.map((r)=>({kind:Ne,value:r}))||[]}}function nn(e,t,n){let r=[],i=Tu(e,n),o;if(i!=null)o=yp(t,i);let s=null,a=null,u=null;if(o!=null)r=o.filter((c)=>je.every((l)=>l.name!==c.name.value)),s=o.find((c)=>c.name.value==="deprecated"),a=o.find((c)=>c.name.value==="specifiedBy"),u=o.find((c)=>c.name.value==="oneOf");if(e.deprecationReason!=null&&s==null)s=Bm(e.deprecationReason);if(e.specifiedByUrl!=null||e.specifiedByURL!=null&&a==null){let l={url:e.specifiedByUrl||e.specifiedByURL};a=zi("specifiedBy",l)}if(e.isOneOf&&u==null)u=zi("oneOf");if(s!=null)r.push(s);if(a!=null)r.push(a);if(u!=null)r.push(u);return r}function Ep(e,t,n){return{kind:ai,description:Et(e),name:{kind:Ne,value:e.name},type:tn(e.type),defaultValue:gu(e),directives:nn(e,t,n)}}function Cm(e,t,n){return{kind:At,description:Et(e),name:{kind:Ne,value:e.name},fields:Object.values(e.getFields()).map((r)=>Tp(r,t,n)),interfaces:Object.values(e.getInterfaces()).map((r)=>tn(r)),directives:nn(e,t,n)}}function Vm(e,t,n){let r={kind:xt,description:Et(e),name:{kind:Ne,value:e.name},fields:Object.values(e.getFields()).map((i)=>Tp(i,t,n)),directives:nn(e,t,n)};if("getInterfaces"in e)r.interfaces=Object.values(e.getInterfaces()).map((i)=>tn(i));return r}function Mm(e,t,n){return{kind:wt,description:Et(e),name:{kind:Ne,value:e.name},directives:nn(e,t,n),types:e.getTypes().map((r)=>tn(r))}}function Um(e,t,n){return{kind:yt,description:Et(e),name:{kind:Ne,value:e.name},fields:Object.values(e.getFields()).map((r)=>Gm(r,t,n)),directives:nn(e,t,n)}}function Pm(e,t,n){return{kind:Yt,description:Et(e),name:{kind:Ne,value:e.name},values:Object.values(e.getValues()).map((r)=>jm(r,t,n)),directives:nn(e,t,n)}}function $m(e,t,n){let r=Tu(e,n),i=yp(t,r),o=e.specifiedByUrl||e.specifiedByURL;if(o&&!i.some((s)=>s.name.value==="specifiedBy")){let s={url:o};i.push(zi("specifiedBy",s))}return{kind:Qt,description:Et(e),name:{kind:Ne,value:e.name},directives:i}}function Tp(e,t,n){return{kind:co,description:Et(e),name:{kind:Ne,value:e.name},arguments:e.args.map((r)=>Ep(r,t,n)),type:tn(e.type),directives:nn(e,t,n)}}function Gm(e,t,n){return{kind:ai,description:Et(e),name:{kind:Ne,value:e.name},type:tn(e.type),directives:nn(e,t,n),defaultValue:gu(e)}}function jm(e,t,n){return{kind:lo,description:Et(e),name:{kind:Ne,value:e.name},directives:nn(e,t,n)}}function Bm(e){return zi("deprecated",{reason:e},mn)}function zi(e,t,n){let r=[];for(let i in t){let o=t[i],s;if(n!=null){let a=n.args.find((u)=>u.name===i);if(a)s=In(o,a.type)}if(s==null)s=Nn(o);if(s!=null)r.push({kind:ii,name:{kind:Ne,value:i},value:s})}return{kind:oi,name:{kind:Ne,value:e},arguments:r}}function yp(e,t){let n=[];for(let{name:r,args:i}of t){let o=e?.getDirective(r);n.push(zi(r,i,o))}return n}var Qm=80,Yr={};function Hs(){Yr={}}function vp(e){let t=e.name?.value;if(t==null)return;switch(Ws(e,t),e.kind){case"EnumTypeDefinition":if(e.values)for(let n of e.values)Ws(n,t,n.name.value);break;case"ObjectTypeDefinition":case"InputObjectTypeDefinition":case"InterfaceTypeDefinition":if(e.fields){for(let n of e.fields)if(Ws(n,t,n.name.value),Wm(n)&&n.arguments)for(let r of n.arguments)Ws(r,t,n.name.value,r.name.value)}break}}function Ws(e,t,n,r){let i=Hm(e);if(typeof i!=="string"||i.length===0)return;let o=[t];if(n){if(o.push(n),r)o.push(r)}let s=o.join(".");if(!Yr[s])Yr[s]=[];Yr[s].push(i)}function Ym(e){return` +# `+e.replace(/\n/g,` +# `)}function M(e,t){return e?e.filter((n)=>n).join(t||""):""}function gp(e){return e?.some((t)=>t.includes(` +`))??!1}function qm(e){return(t,n,r,i,o)=>{let s=[],a=i.reduce((l,p)=>{if(["fields","arguments","values"].includes(p)&&l.name)s.push(l.name.value);return l[p]},o[0]),u=[...s,a?.name?.value].filter(Boolean).join("."),c=[];if(t.kind.includes("Definition")&&Yr[u])c.push(...Yr[u]);return M([...c.map(Ym),t.description,e(t,n,r,i,o)],` +`)}}function Xi(e){return e&&` ${e.replace(/\n/g,` + `)}`}function $t(e){return e&&e.length!==0?`{ +${Xi(M(e,` +`))} +}`:""}function be(e,t,n){return t?e+t+(n||""):""}function Km(e,t=!1){let n=e.replace(/\\/g,"\\\\").replace(/"""/g,'\\"""');return(e[0]===" "||e[0]==="\t")&&e.indexOf(` +`)===-1?`"""${n.replace(/"$/,`" +`)}"""`:`""" +${t?n:Xi(n)} +"""`}var Np={Name:{leave:(e)=>e.value},Variable:{leave:(e)=>"$"+e.name},Document:{leave:(e)=>M(e.definitions,` + +`)},OperationDefinition:{leave:(e)=>{let t=be("(",M(e.variableDefinitions,", "),")");return M([e.operation,M([e.name,t]),M(e.directives," ")]," ")+" "+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:r})=>e+": "+t+be(" = ",n)+be(" ",M(r," "))},SelectionSet:{leave:({selections:e})=>$t(e)},Field:{leave({alias:e,name:t,arguments:n,directives:r,selectionSet:i}){let o=be("",e,": ")+t,s=o+be("(",M(n,", "),")");if(s.length>Qm)s=o+be(`( +`,Xi(M(n,` +`)),` +)`);return M([s,M(r," "),i]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+be(" ",M(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>M(["...",be("on ",e),M(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:r,selectionSet:i})=>`fragment ${e}${be("(",M(n,", "),")")} on ${t} ${be("",M(r," ")," ")}`+i},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>{if(t)return Km(e);return JSON.stringify(e)}},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+M(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+M(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+be("(",M(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({directives:e,operationTypes:t})=>M(["schema",M(e," "),$t(t)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({name:e,directives:t})=>M(["scalar",e,M(t," ")]," ")},ObjectTypeDefinition:{leave:({name:e,interfaces:t,directives:n,fields:r})=>M(["type",e,be("implements ",M(t," & ")),M(n," "),$t(r)]," ")},FieldDefinition:{leave:({name:e,arguments:t,type:n,directives:r})=>e+(gp(t)?be(`( +`,Xi(M(t,` +`)),` +)`):be("(",M(t,", "),")"))+": "+n+be(" ",M(r," "))},InputValueDefinition:{leave:({name:e,type:t,defaultValue:n,directives:r})=>M([e+": "+t,be("= ",n),M(r," ")]," ")},InterfaceTypeDefinition:{leave:({name:e,interfaces:t,directives:n,fields:r})=>M(["interface",e,be("implements ",M(t," & ")),M(n," "),$t(r)]," ")},UnionTypeDefinition:{leave:({name:e,directives:t,types:n})=>M(["union",e,M(t," "),be("= ",M(n," | "))]," ")},EnumTypeDefinition:{leave:({name:e,directives:t,values:n})=>M(["enum",e,M(t," "),$t(n)]," ")},EnumValueDefinition:{leave:({name:e,directives:t})=>M([e,M(t," ")]," ")},InputObjectTypeDefinition:{leave:({name:e,directives:t,fields:n})=>M(["input",e,M(t," "),$t(n)]," ")},DirectiveDefinition:{leave:({name:e,arguments:t,repeatable:n,locations:r})=>"directive @"+e+(gp(t)?be(`( +`,Xi(M(t,` +`)),` +)`):be("(",M(t,", "),")"))+(n?" repeatable":"")+" on "+M(r," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>M(["extend schema",M(e," "),$t(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>M(["extend scalar",e,M(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>M(["extend type",e,be("implements ",M(t," & ")),M(n," "),$t(r)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>M(["extend interface",e,be("implements ",M(t," & ")),M(n," "),$t(r)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>M(["extend union",e,M(t," "),be("= ",M(n," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>M(["extend enum",e,M(t," "),$t(n)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>M(["extend input",e,M(t," "),$t(n)]," ")}},Jm=Object.keys(Np).reduce((e,t)=>({...e,[t]:{leave:qm(Np[t].leave)}}),{});function bp(e){return ft(e,Jm)}function Wm(e){return e.kind==="FieldDefinition"}function Hm(e){let t=zm(e);if(t!==void 0)return Xm(` +${t}`)}function zm(e){let t=e.loc;if(!t)return;let n=[],r=t.startToken.prev;while(r!=null&&r.kind===T.COMMENT&&r.next!=null&&r.prev!=null&&r.line+1===r.next.line&&r.line!==r.prev.line){let i=String(r.value);n.push(i),r=r.prev}return n.length>0?n.reverse().join(` +`):void 0}function Xm(e){let t=e.split(/\r\n|[\n\r]/g),n=Zm(t);if(n!==0)for(let r=1;r<t.length;r++)t[r]=t[r].slice(n);while(t.length>0&&Ip(t[0]))t.shift();while(t.length>0&&Ip(t[t.length-1]))t.pop();return t.join(` +`)}function Zm(e){let t=null;for(let n=1;n<e.length;n++){let r=e[n],i=_p(r);if(i===r.length)continue;if(t===null||i<t){if(t=i,t===0)break}}return t===null?0:t}function _p(e){let t=0;while(t<e.length&&(e[t]===" "||e[t]==="\t"))t++;return t}function Ip(e){return _p(e)===e.length}var Q;(function(e){e.TYPE="MapperKind.TYPE",e.SCALAR_TYPE="MapperKind.SCALAR_TYPE",e.ENUM_TYPE="MapperKind.ENUM_TYPE",e.COMPOSITE_TYPE="MapperKind.COMPOSITE_TYPE",e.OBJECT_TYPE="MapperKind.OBJECT_TYPE",e.INPUT_OBJECT_TYPE="MapperKind.INPUT_OBJECT_TYPE",e.ABSTRACT_TYPE="MapperKind.ABSTRACT_TYPE",e.UNION_TYPE="MapperKind.UNION_TYPE",e.INTERFACE_TYPE="MapperKind.INTERFACE_TYPE",e.ROOT_OBJECT="MapperKind.ROOT_OBJECT",e.QUERY="MapperKind.QUERY",e.MUTATION="MapperKind.MUTATION",e.SUBSCRIPTION="MapperKind.SUBSCRIPTION",e.DIRECTIVE="MapperKind.DIRECTIVE",e.FIELD="MapperKind.FIELD",e.COMPOSITE_FIELD="MapperKind.COMPOSITE_FIELD",e.OBJECT_FIELD="MapperKind.OBJECT_FIELD",e.ROOT_FIELD="MapperKind.ROOT_FIELD",e.QUERY_ROOT_FIELD="MapperKind.QUERY_ROOT_FIELD",e.MUTATION_ROOT_FIELD="MapperKind.MUTATION_ROOT_FIELD",e.SUBSCRIPTION_ROOT_FIELD="MapperKind.SUBSCRIPTION_ROOT_FIELD",e.INTERFACE_FIELD="MapperKind.INTERFACE_FIELD",e.INPUT_OBJECT_FIELD="MapperKind.INPUT_OBJECT_FIELD",e.ARGUMENT="MapperKind.ARGUMENT",e.ENUM_VALUE="MapperKind.ENUM_VALUE"})(Q||(Q={}));function mr(e,t){if(t){let n=e[t.name];if(L(n))return n}}function Sp(e){if("getFields"in e){let t=e.getFields();for(let n in t)return t[n].name==="_fake"}return!1}function Dp(e){switch(e.name){case wn.name:return wn;case Ir.name:return Ir;case ie.name:return ie;case ge.name:return ge;case Rn.name:return Rn;default:return e}}function Op(e,t){let n=Object.create(null);for(let f in e)n[f]=e[f];let r=Object.create(null);for(let f in n){let d=n[f];if(d==null||f.startsWith("__"))continue;let E=d.name;if(E.startsWith("__"))continue;if(r[E]!=null){console.warn(`Duplicate schema type name ${E} found; keeping the existing one found in the schema`);continue}r[E]=d}for(let f in r)r[f]=a(r[f]);let i=t.map((f)=>o(f));return{typeMap:r,directives:i};function o(f){if(Vt(f))return f;let d=f.toConfig();return d.args=s(d.args),new Re(d)}function s(f){let d={};for(let E in f){let I=f[E],S=p(I.type);if(S!=null)I.type=S,d[E]=I}return d}function a(f){if(L(f)){let d=f.toConfig(),E={...d,fields:()=>u(d.fields),interfaces:()=>l(d.interfaces)};return new Ee(E)}else if(P(f)){let d=f.toConfig(),E={...d,fields:()=>u(d.fields)};if("interfaces"in E)E.interfaces=()=>l(d.interfaces);return new Me(E)}else if(te(f)){let d=f.toConfig(),E={...d,types:()=>l(d.types)};return new it(E)}else if(k(f)){let d=f.toConfig(),E={...d,fields:()=>c(d.fields)};return new Ge(E)}else if(z(f)){let d=f.toConfig();return new we(d)}else if(ae(f)){if(Ze(f))return f;let d=f.toConfig();return new ke(d)}throw Error(`Unexpected schema type: ${f}`)}function u(f){let d={};for(let E in f){let I=f[E],S=p(I.type);if(S!=null&&I.args)I.type=S,I.args=s(I.args),d[E]=I}return d}function c(f){let d={};for(let E in f){let I=f[E],S=p(I.type);if(S!=null)I.type=S,d[E]=I}return d}function l(f){let d=[];for(let E of f){let I=p(E);if(I!=null)d.push(I)}return d}function p(f){if(j(f)){let d=p(f.ofType);return d!=null?new oe(d):null}else if(w(f)){let d=p(f.ofType);return d!=null?new V(d):null}else if(rt(f)){let d=n[f.name];if(d===void 0)d=Sp(f)?Dp(f):a(f),r[d.name]=n[f.name]=d;return d!=null?r[d.name]:null}return null}}function zs(e,t,n=null,r=null){if(t==null)return t;let i=gr(e);if(ve(i))return n!=null?n(i,t):t;else if(j(i))return Js(t).map((o)=>zs(i.ofType,o,n,r));else if(k(i)){let o=i.getFields(),s={};for(let a in t){let u=o[a];if(u!=null)s[a]=zs(u.type,t[a],n,r)}return r!=null?r(i,s):s}}function Xs(e,t){return zs(e,t,(n,r)=>{try{return n.serialize(r)}catch{return r}})}function Zs(e,t){return zs(e,t,(n,r)=>{try{return n.parseValue(r)}catch{return r}})}function Zi(e,t={}){let n=wp(xp(Iu(Ap(th(Iu(Ap(e.getTypeMap(),e,Xs),e,t,(a)=>ve(a)),e,t),e,Zs),e,t,(a)=>!ve(a)),e,t),e,t),r=e.getDirectives(),i=nh(r,e,t),{typeMap:o,directives:s}=Op(n,i);return new ot({...e.toConfig(),query:mr(o,mr(n,e.getQueryType())),mutation:mr(o,mr(n,e.getMutationType())),subscription:mr(o,mr(n,e.getSubscriptionType())),types:Object.values(o),directives:s})}var eh=["String","ID","Int","Float","Boolean"];function Iu(e,t,n,r=()=>!0){let i={};for(let o in e)if(!o.startsWith("__")&&!eh.includes(o)){let s=e[o];if(s==null||!r(s)){i[o]=s;continue}let a=ih(t,n,o);if(a==null){i[o]=s;continue}let u=a(s,t);if(u===void 0){i[o]=s;continue}i[o]=u}return i}function th(e,t,n){let r=ch(n);if(!r)return e;return Iu(e,t,{[Q.ENUM_TYPE]:(i)=>{let o=i.toConfig(),s=o.values,a={};for(let u in s){let c=s[u],l=r(c,i.name,t,u);if(l===void 0)a[u]=c;else if(Array.isArray(l)){let[p,f]=l;a[p]=f===void 0?c:f}else if(l!==null)a[u]=l}return ea(new we({...o,values:a}))}},(i)=>z(i))}function Ap(e,t,n){let r=wp(e,t,{[Q.ARGUMENT]:(i)=>{if(i.defaultValue===void 0)return i;let o=ta(e,i.type);if(o!=null)return{...i,defaultValue:n(o,i.defaultValue)}}});return xp(r,t,{[Q.INPUT_OBJECT_FIELD]:(i)=>{if(i.defaultValue===void 0)return i;let o=ta(r,i.type);if(o!=null)return{...i,defaultValue:n(o,i.defaultValue)}}})}function ta(e,t){if(j(t)){let n=ta(e,t.ofType);return n!=null?new oe(n):null}else if(w(t)){let n=ta(e,t.ofType);return n!=null?new V(n):null}else if(rt(t)){let n=e[t.name];return n!=null?n:null}return null}function xp(e,t,n){let r={};for(let i in e)if(!i.startsWith("__")){let o=e[i];if(!L(o)&&!P(o)&&!k(o)){r[i]=o;continue}let s=sh(t,n,i);if(s==null){r[i]=o;continue}let a=o.toConfig(),u=a.fields,c={};for(let l in u){let p=u[l],f=s(p,l,i,t);if(f===void 0)c[l]=p;else if(Array.isArray(f)){let[d,E]=f;if(E.astNode!=null)E.astNode={...E.astNode,name:{...E.astNode.name,value:d}};c[d]=E===void 0?p:E}else if(f!==null)c[l]=f}if(L(o))r[i]=ea(new Ee({...a,fields:c}));else if(P(o))r[i]=ea(new Me({...a,fields:c}));else r[i]=ea(new Ge({...a,fields:c}))}return r}function wp(e,t,n){let r={};for(let i in e)if(!i.startsWith("__")){let o=e[i];if(!L(o)&&!P(o)){r[i]=o;continue}let s=ah(n);if(s==null){r[i]=o;continue}let a=o.toConfig(),u=a.fields,c={};for(let l in u){let p=u[l],f=p.args;if(f==null){c[l]=p;continue}let d=Object.keys(f);if(!d.length){c[l]=p;continue}let E={};for(let I of d){let S=f[I],G=s(S,l,i,t);if(G===void 0)E[I]=S;else if(Array.isArray(G)){let[Z,W]=G;E[Z]=W}else if(G!==null)E[I]=G}c[l]={...p,args:E}}if(L(o))r[i]=new Ee({...a,fields:c});else if(P(o))r[i]=new Me({...a,fields:c});else r[i]=new Ge({...a,fields:c})}return r}function nh(e,t,n){let r=uh(n);if(r==null)return e.slice();let i=[];for(let o of e){let s=r(o,t);if(s===void 0)i.push(o);else if(s!==null)i.push(s)}return i}function rh(e,t){let n=e.getType(t),r=[Q.TYPE];if(L(n)){if(r.push(Q.COMPOSITE_TYPE,Q.OBJECT_TYPE),t===e.getQueryType()?.name)r.push(Q.ROOT_OBJECT,Q.QUERY);else if(t===e.getMutationType()?.name)r.push(Q.ROOT_OBJECT,Q.MUTATION);else if(t===e.getSubscriptionType()?.name)r.push(Q.ROOT_OBJECT,Q.SUBSCRIPTION)}else if(k(n))r.push(Q.INPUT_OBJECT_TYPE);else if(P(n))r.push(Q.COMPOSITE_TYPE,Q.ABSTRACT_TYPE,Q.INTERFACE_TYPE);else if(te(n))r.push(Q.COMPOSITE_TYPE,Q.ABSTRACT_TYPE,Q.UNION_TYPE);else if(z(n))r.push(Q.ENUM_TYPE);else if(ae(n))r.push(Q.SCALAR_TYPE);return r}function ih(e,t,n){let r=rh(e,n),i,o=[...r];while(!i&&o.length>0){let s=o.pop();i=t[s]}return i!=null?i:null}function oh(e,t){let n=e.getType(t),r=[Q.FIELD];if(L(n)){if(r.push(Q.COMPOSITE_FIELD,Q.OBJECT_FIELD),t===e.getQueryType()?.name)r.push(Q.ROOT_FIELD,Q.QUERY_ROOT_FIELD);else if(t===e.getMutationType()?.name)r.push(Q.ROOT_FIELD,Q.MUTATION_ROOT_FIELD);else if(t===e.getSubscriptionType()?.name)r.push(Q.ROOT_FIELD,Q.SUBSCRIPTION_ROOT_FIELD)}else if(P(n))r.push(Q.COMPOSITE_FIELD,Q.INTERFACE_FIELD);else if(k(n))r.push(Q.INPUT_OBJECT_FIELD);return r}function sh(e,t,n){let r=oh(e,n),i,o=[...r];while(!i&&o.length>0){let s=o.pop();i=t[s]}return i??null}function ah(e){let t=e[Q.ARGUMENT];return t!=null?t:null}function uh(e){let t=e[Q.DIRECTIVE];return t!=null?t:null}function ch(e){let t=e[Q.ENUM_VALUE];return t!=null?t:null}function ea(e){if(L(e)){let t=e.toConfig();if(t.astNode!=null){let n=[];for(let r in t.fields){let i=t.fields[r];if(i.astNode!=null)n.push(i.astNode)}t.astNode={...t.astNode,kind:At,fields:n}}if(t.extensionASTNodes!=null)t.extensionASTNodes=t.extensionASTNodes.map((n)=>({...n,kind:qt,fields:void 0}));return new Ee(t)}else if(P(e)){let t=e.toConfig();if(t.astNode!=null){let n=[];for(let r in t.fields){let i=t.fields[r];if(i.astNode!=null)n.push(i.astNode)}t.astNode={...t.astNode,kind:xt,fields:n}}if(t.extensionASTNodes!=null)t.extensionASTNodes=t.extensionASTNodes.map((n)=>({...n,kind:Kt,fields:void 0}));return new Me(t)}else if(k(e)){let t=e.toConfig();if(t.astNode!=null){let n=[];for(let r in t.fields){let i=t.fields[r];if(i.astNode!=null)n.push(i.astNode)}t.astNode={...t.astNode,kind:yt,fields:n}}if(t.extensionASTNodes!=null)t.extensionASTNodes=t.extensionASTNodes.map((n)=>({...n,kind:Lt,fields:void 0}));return new Ge(t)}else if(z(e)){let t=e.toConfig();if(t.astNode!=null){let n=[];for(let r in t.values){let i=t.values[r];if(i.astNode!=null)n.push(i.astNode)}t.astNode={...t.astNode,values:n}}if(t.extensionASTNodes!=null)t.extensionASTNodes=t.extensionASTNodes.map((n)=>({...n,values:void 0}));return new we(t)}else return e}function Rp(e){return lh(e.getTypeMap(),e.getDirectives()),e}function lh(e,t){let n=Object.create(null);for(let c in e){let l=e[c];if(l==null||c.startsWith("__"))continue;let p=l.name;if(p.startsWith("__"))continue;if(n[p]!=null){console.warn(`Duplicate schema type name ${p} found; keeping the existing one found in the schema`);continue}n[p]=l}for(let c in n){let l=n[c];e[c]=l}for(let c of t)c.args=c.args.filter((l)=>(l.type=u(l.type),l.type!==null));for(let c in e){let l=e[c];if(!c.startsWith("__")&&c in n){if(l!=null)r(l)}}for(let c in e)if(!c.startsWith("__")&&!(c in n))delete e[c];function r(c){if(L(c)){i(c),o(c);return}else if(P(c)){if(i(c),"getInterfaces"in c)o(c);return}else if(te(c)){a(c);return}else if(k(c)){s(c);return}else if(ve(c))return;throw Error(`Unexpected schema type: ${c}`)}function i(c){let l=c.getFields();for(let[p,f]of Object.entries(l))if(f.args.map((d)=>(d.type=u(d.type),d.type===null?null:d)).filter(Boolean),f.type=u(f.type),f.type===null)delete l[p]}function o(c){if("getInterfaces"in c){let l=c.getInterfaces();l.push(...l.splice(0).map((p)=>u(p)).filter(Boolean))}}function s(c){let l=c.getFields();for(let[p,f]of Object.entries(l))if(f.type=u(f.type),f.type===null)delete l[p]}function a(c){let l=c.getTypes();l.push(...l.splice(0).map((p)=>u(p)).filter(Boolean))}function u(c){if(j(c)){let l=u(c.ofType);return l!=null?new oe(l):null}else if(w(c)){let l=u(c.ofType);return l!=null?new V(l):null}else if(rt(c)){let l=e[c.name];if(l&&c!==l)return l}return c}}function na(e,t){let n=e.getTypeMap();for(let r in n){let i=n[r];if(!pe(i).name.startsWith("__")&&L(i)){let o=i.getFields();for(let s in o){let a=o[s];t(a,r,s)}}}}function vu(e,t){let n=e.getTypeMap();for(let r in n){let i=n[r];if(!pe(i).name.startsWith("__")){if(L(i)){let o=i.getFields();for(let s in o){let a=o[s];for(let u of a.args)u.defaultValue=t(u.type,u.defaultValue)}}else if(k(i)){let o=i.getFields();for(let s in o){let a=o[s];a.defaultValue=t(a.type,a.defaultValue)}}}}}function ph(e){return e!=null&&typeof e==="object"&&!Array.isArray(e)}function fh(e){return{enumerable:e?.enumerable??!1,nonEnumerable:e?.nonEnumerable??!1}}function dh(e,t=!1,n=!1,r=!1){if(ph(e))return{respectPrototype:e.respectPrototype??!1,respectArrays:e.respectArrays??!1,respectArrayLength:e.respectArrayLength??!1,respectSymbols:fh(e.respectSymbols)};return{respectPrototype:e??!1,respectArrays:t,respectArrayLength:n,respectSymbols:{enumerable:!1,nonEnumerable:r}}}function ra(e,t=!1,n=!1,r=!1,i=!1){let o=dh(t,n,r,i);return eo(e,o)}function eo(e,t){let{respectPrototype:n,respectArrayLength:r,respectSymbols:i}=t,{enumerable:o,nonEnumerable:s}=i;if(e.length===0)return;if(e.length===1)return e[0];let a,u=!0,c=e.every((f)=>{if(Array.isArray(f)){if(a===void 0)return a=f.length,!0;else if(a===f.length)return!0}else u=!1;return!1});if(r&&c)return Array(a).fill(null).map((f,d)=>eo(e.map((E)=>E[d]),t));if(u)return e.flat(1);let l,p;if(n){if(p=e.find((f)=>Lp(f)),p){if(l==null)l={};Object.setPrototypeOf(l,Object.create(Object.getPrototypeOf(p)))}}for(let f of e){if(f===void 0)continue;if(Lp(f)){if(l==null)l={};if(p){let d=Object.getPrototypeOf(l),E=Object.getPrototypeOf(f);if(E)for(let I of Object.getOwnPropertyNames(E)){let S=Object.getOwnPropertyDescriptor(E,I);if(Br(S))Object.defineProperty(d,I,S)}}for(let d in f){if(Hi(d))continue;if(Object.prototype.hasOwnProperty.call(l,d)&&f[d]!==void 0)l[d]=eo([l[d],f[d]],t);else l[d]=f[d]}if(l!=null&&(o||s))for(let d of Object.getOwnPropertySymbols(f)){if(!Object.getOwnPropertyDescriptor(f,d).enumerable){if(s)if(Object.prototype.hasOwnProperty.call(l,d)){let S=Object.getOwnPropertyDescriptor(l,d);if(S.configurable)Object.defineProperty(l,d,{value:f[d],writable:!0,enumerable:!1,configurable:!0});else if(S.writable||S.set)l[d]=f[d]}else Object.defineProperty(l,d,{value:f[d],writable:!0,enumerable:!1,configurable:!0});continue}if(!o)continue;let I=Object.prototype.hasOwnProperty.call(l,d);if(I&&f[d]!==void 0){let S=Object.getOwnPropertyDescriptor(l,d),G=eo([l[d],f[d]],t);if(S.writable||S.set)l[d]=G;else if(S.configurable)Object.defineProperty(l,d,{value:G,writable:!0,enumerable:!0,configurable:!0})}else if(!I)l[d]=f[d];else{let S=Object.getOwnPropertyDescriptor(l,d);if(S.writable||S.set)l[d]=f[d];else if(S.configurable)Object.defineProperty(l,d,{value:f[d],writable:!0,enumerable:!0,configurable:!0})}}}else if(Array.isArray(f))if(!Array.isArray(l))l=f;else l=eo([l,f],t);else l=f}return l}function Lp(e){return e&&typeof e==="object"&&!Array.isArray(e)}function kp(e){return e&&typeof e==="object"&&"kind"in e&&e.kind===jt}function bu(e,t){if(!e||Array.isArray(e)&&e.length===0)return{};if(!Array.isArray(e))return e;if(e.length===1)return e[0]||{};let n=[];for(let i of e){if(Array.isArray(i))i=bu(i);if(typeof i==="object"&&i)n.push(i)}let r=ra(n,{respectPrototype:!0,respectSymbols:{enumerable:!0,nonEnumerable:!0}});if(t?.exclusions)for(let i of t.exclusions){let[o,s]=i.split(".");if(Hi(o)||Hi(s))continue;if(!s||s==="*")delete r[o];else if(r[o])delete r[o][s]}return r}function Fp(e,t,n){let r=mh([...t,...e].filter(Br),n);if(n&&n.sort)r.sort($n);return r}function mh(e,t){return e.reduce((n,r)=>{let i=n.findIndex((o)=>o.name.value===r.name.value);if(i===-1)return n.concat([r]);else if(!t?.reverseArguments)n[i]=r;return n},[])}function Cp(e){let t=new Set,n=new Set;for(let r of e){let i=r.name.value;if(t.has(i))n.add(i);else t.add(i)}return n}function hh(e,t,n,r){let i=t?.[e.name.value];if(i)return!!i.repeatable;return!!(n?.has(e.name.value)||r?.has(e.name.value))}function Vp(e,t){return t.some(({value:n})=>n===e.value)}function Eh(e,t){let n=[];for(let r of[...t,...e]){let i=n.findIndex((o)=>o.name.value===r.name.value);if(i===-1)n.push(r);else{let o=n[i];if(o.value.kind==="ListValue"){let s=o.value.values,a=r.value.values;o.value={...o.value,values:Pp(s,a,(u,c)=>{let l=u.value;return!l||!c.some((p)=>p.value===l)})}}else o.value=r.value}}return n}var _u=(e,t)=>{if(e.kind===t.kind)switch(e.kind){case Ae:return e.values.length===t.values.length&&e.values.every((n)=>t.values.find((r)=>_u(n,r)));case Ce:case le:return!0;case Ve:return e.fields.length===t.fields.length&&e.fields.every((n)=>t.fields.find((r)=>n.name.value===r.name.value&&_u(n.value,r.value)));default:return e.value===t.value}return!1},Su=(e)=>e.name.value==="link",Mp=(e)=>{let t=Su(e)?e.arguments?.find((n)=>n.name.value==="url")?.value:void 0;return t?.kind==="StringValue"?t.value:void 0},Th=(e,t)=>e.name.value===t.name.value&&e.value.kind===t.value.kind&&_u(e.value,t.value),yh=(e,t)=>!!(e.name.value===t.name.value&&(e.arguments===t.arguments||e.arguments?.length===t.arguments?.length&&e.arguments?.every((r)=>t.arguments?.find((i)=>Th(r,i)))));function $e(e=[],t=[],n,r){let i=n&&n.reverseDirectives,o=i?e:t,s=i?t:e,a=new Set(e.map((p)=>p.name.value)),u=new Set(t.map((p)=>p.name.value)),c=new Set;for(let p of Cp(e))if(!u.has(p))c.add(p);for(let p of Cp(t))if(!a.has(p))c.add(p);let l=[];for(let p of[...o,...s])if(hh(p,r,n?.repeatableLinkImports,c)){if(!l.find((d)=>yh(p,d)))l.push(p)}else{let f=l.findIndex((d)=>d.name.value===p.name.value);if(f===-1)l.push(p);else{if(Su(p)&&Su(l[f])){let E=Mp(p),I=Mp(l[f]);if(E&&I&&E!==I){l.push(p);continue}}let d=Eh(p.arguments??[],l[f].arguments??[]);l[f]={...l[f],arguments:d.length===0?void 0:d}}}return l}function Up(e,t){if(t)return{...e,arguments:Pp(t.arguments||[],e.arguments||[],(n,r)=>!Vp(n.name,r.map((i)=>i.name))),locations:[...t.locations,...e.locations.filter((n)=>!Vp(n,t.locations))]};return e}function Pp(e,t,n){return e.concat(t.filter((r)=>n(r,e)))}function $p(e,t,n,r){if(n?.consistentEnumMerge){let s=[];if(e)s.push(...e);e=t,t=s}let i=new Map;if(e)for(let s of e)i.set(s.name.value,s);if(t)for(let s of t){let a=s.name.value;if(i.has(a)){let u=i.get(a);u.description=s.description||u.description,u.directives=$e(s.directives,u.directives,r)}else i.set(a,s)}let o=[...i.values()];if(n&&n.sort)o.sort($n);return o}function Gp(e,t,n,r){if(t)return{name:e.name,description:e.description||t.description,kind:n?.convertExtensions||e.kind==="EnumTypeDefinition"||t.kind==="EnumTypeDefinition"?"EnumTypeDefinition":"EnumTypeExtension",loc:e.loc,directives:$e(e.directives,t.directives,n,r),values:$p(e.values,t.values,n)};return n?.convertExtensions?{...e,kind:Yt}:e}function jp(e){return typeof e==="string"}function Bp(e){return e instanceof Pt}function Du(e){let t=e;while(t.kind===Dn||t.kind==="NonNullType")t=t.type;return t}function Ou(e){return e.kind!==Sn}function ia(e){return e.kind===Dn}function jn(e){return e.kind===cn}function to(e){if(ia(e))return`[${to(e.type)}]`;if(jn(e))return`${to(e.type)}!`;return e.name.value}var Gn;(function(e){e[e.A_SMALLER_THAN_B=-1]="A_SMALLER_THAN_B",e[e.A_EQUALS_B=0]="A_EQUALS_B",e[e.A_GREATER_THAN_B=1]="A_GREATER_THAN_B"})(Gn||(Gn={}));function Qp(e,t){if(e==null&&t==null)return Gn.A_EQUALS_B;if(e==null)return Gn.A_SMALLER_THAN_B;if(t==null)return Gn.A_GREATER_THAN_B;if(e<t)return Gn.A_SMALLER_THAN_B;if(e>t)return Gn.A_GREATER_THAN_B;return Gn.A_EQUALS_B}function gh(e,t){let n=e.findIndex((r)=>r.name.value===t.name.value);return[n>-1?e[n]:null,n]}function qr(e,t,n,r,i){let o=[];if(n!=null)o.push(...n);if(t!=null)for(let s of t){let[a,u]=gh(o,s);if(a&&!r?.ignoreFieldConflicts){let c=r?.onFieldTypeConflict&&r.onFieldTypeConflict(a,s,e,r?.throwOnConflict)||Nh(e,a,s,r?.throwOnConflict);c.arguments=Fp(s.arguments||[],a.arguments||[],r),c.directives=$e(s.directives,a.directives,r,i),c.description=s.description||a.description,o[u]=c}else o.push(s)}if(r&&r.sort)o.sort($n);if(r&&r.exclusions){let s=r.exclusions;return o.filter((a)=>!s.includes(`${e.name.value}.${a.name.value}`))}return o}function Nh(e,t,n,r=!1){let i=to(t.type),o=to(n.type);if(i!==o){let s=Du(t.type),a=Du(n.type);if(s.name.value!==a.name.value)throw Error(`Field "${n.name.value}" already defined with a different type. Declared as "${s.name.value}", but you tried to override with "${a.name.value}"`);if(!no(t.type,n.type,!r))throw Error(`Field '${e.name.value}.${t.name.value}' changed type from '${i}' to '${o}'`)}if(jn(n.type)&&!jn(t.type))t.type=n.type;return t}function no(e,t,n=!1){if(!Ou(e)&&!Ou(t))return e.toString()===t.toString();if(jn(t)){let r=jn(e)?e.type:e;return no(r,t.type)}if(jn(e))return no(t,e,n);if(ia(e))return ia(t)&&no(e.type,t.type)||jn(t)&&no(e,t.type);return!1}function Yp(e,t,n,r){if(t)try{return{name:e.name,description:e.description||t.description,kind:n?.convertExtensions||e.kind==="InputObjectTypeDefinition"||t.kind==="InputObjectTypeDefinition"?"InputObjectTypeDefinition":"InputObjectTypeExtension",loc:e.loc,fields:qr(e,e.fields,t.fields,n),directives:$e(e.directives,t.directives,n,r)}}catch(i){throw Error(`Unable to merge GraphQL input type "${e.name.value}": ${i.message}`)}return n?.convertExtensions?{...e,kind:yt}:e}function Ih(e,t){return!!e.find((n)=>n.name.value===t.name.value)}function Kr(e=[],t=[],n={}){let r=[...t,...e.filter((i)=>!Ih(t,i))];if(n&&n.sort)r.sort($n);return r}function qp(e,t,n,r){if(t)try{return{name:e.name,description:e.description||t.description,kind:n?.convertExtensions||e.kind==="InterfaceTypeDefinition"||t.kind==="InterfaceTypeDefinition"?"InterfaceTypeDefinition":"InterfaceTypeExtension",loc:e.loc,fields:qr(e,e.fields,t.fields,n,r),directives:$e(e.directives,t.directives,n,r),interfaces:e.interfaces?Kr(e.interfaces,t.interfaces,n):void 0}}catch(i){throw Error(`Unable to merge GraphQL interface "${e.name.value}": ${i.message}`)}return n?.convertExtensions?{...e,kind:xt}:e}function Kp(e,t,n,r){if(t)return{name:e.name,description:e.description||t.description,kind:n?.convertExtensions||e.kind==="ScalarTypeDefinition"||t.kind==="ScalarTypeDefinition"?"ScalarTypeDefinition":"ScalarTypeExtension",loc:e.loc,directives:$e(e.directives,t.directives,n,r)};return n?.convertExtensions?{...e,kind:Qt}:e}var oa={query:"Query",mutation:"Mutation",subscription:"Subscription"};function vh(e=[],t=[]){let n=[];for(let r in oa){let i=e.find((o)=>o.operation===r)||t.find((o)=>o.operation===r);if(i)n.push(i)}return n}function Jp(e,t,n,r){if(t)return{kind:e.kind===Ye||t.kind===Ye?Ye:Rt,description:e.description||t.description,directives:$e(e.directives,t.directives,n,r),operationTypes:vh(e.operationTypes,t.operationTypes)};return n?.convertExtensions?{...e,kind:Ye}:e}function Wp(e,t,n,r){if(t)try{return{name:e.name,description:e.description||t.description,kind:n?.convertExtensions||e.kind==="ObjectTypeDefinition"||t.kind==="ObjectTypeDefinition"?"ObjectTypeDefinition":"ObjectTypeExtension",loc:e.loc,fields:qr(e,e.fields,t.fields,n,r),directives:$e(e.directives,t.directives,n,r),interfaces:Kr(e.interfaces,t.interfaces,n)}}catch(i){throw Error(`Unable to merge GraphQL type "${e.name.value}": ${i.message}`)}return n?.convertExtensions?{...e,kind:At}:e}function Hp(e,t,n,r){if(t)return{name:e.name,description:e.description||t.description,directives:$e(e.directives,t.directives,n,r),kind:n?.convertExtensions||e.kind==="UnionTypeDefinition"||t.kind==="UnionTypeDefinition"?wt:Jt,loc:e.loc,types:Kr(e.types,t.types,n)};return n?.convertExtensions?{...e,kind:wt}:e}var hr="SCHEMA_DEF_SYMBOL";function bh(e){return"name"in e}function Au(e,t,n={}){let r=n;for(let i of e)if(bh(i)){let o=i.name?.value;if(t?.commentDescriptions)vp(i);if(o==null)continue;if(t?.exclusions?.includes(o+".*")||t?.exclusions?.includes(o))delete r[o];else switch(i.kind){case At:case qt:r[o]=Wp(i,r[o],t,n);break;case Yt:case pn:r[o]=Gp(i,r[o],t,n);break;case wt:case Jt:r[o]=Hp(i,r[o],t,n);break;case Qt:case ln:r[o]=Kp(i,r[o],t,n);break;case yt:case Lt:r[o]=Yp(i,r[o],t,n);break;case xt:case Kt:r[o]=qp(i,r[o],t,n);break;case pt:if(r[o]){if(o in{}){if(!_h(r[o]))r[o]=void 0}}r[o]=Up(i,r[o]);break}}else if(i.kind===Ye||i.kind===Rt)r[hr]=Jp(i,r[hr],t,n);return r}function _h(e){return e!=null&&typeof e==="object"&&"kind"in e&&typeof e.kind==="string"}function zp(e){return e.as??e.url.name}function Sh(e){let t=zp(e);return t&&`@${t}`}function sa(e,t){if(e.url.name&&t===`@${e.url.name}`)return Sh(e).substring(1);let n=e.imports.find((i)=>i.name===t),r=n?.as??n?.name??Dh(zp(e),t);return r.startsWith("@")?r.substring(1):r}function Dh(e,t){if(e?.length){if(t.startsWith("@"))return`@${e}__${t.substring(1)}`;return`${e}__${t}`}return t}function Xp(e){let t=[];for(let n of e.definitions)if(n.kind===Rt||n.kind===Ye){let i=n.directives?.filter((a)=>a.name.value==="link")?.map((a)=>Oh(a.arguments??[])).filter((a)=>a!==void 0)??[];t=t.concat(i);let s=n.directives?.filter(({name:a})=>a.value==="core")?.map((a)=>Ah(a.arguments??[])).filter((a)=>a!==void 0);if(s)t=t.concat(...s)}return t}function Oh(e){let t,n=[],r;for(let i of e)switch(i.name.value){case"url":{if(i.value.kind===Ie)t=Zp(i.value.value);break}case"import":{n=xh(i.value);break}case"as":{if(i.value.kind===Ie)r=i.value.value??void 0;break}default:}if(t!==void 0)return{url:t,as:r,imports:n}}function Ah(e){let t=e.find(({name:n,value:r})=>n.value==="feature"&&r.kind===Ie);if(t)return{url:Zp(t.value.value),imports:[]}}function xh(e){if(e.kind===Ae)return e.values.map((n)=>{let r;if(n.kind===Ie)r={name:n.value};else if(n.kind===Ve){let i="",o;for(let s of n.fields)if(s.name.value==="name"){if(s.value.kind===Ie)i=s.value.value}else if(s.name.value==="as"){if(s.value.kind===Ie)o=s.value.value}r={name:i,as:o}}return r}).filter((n)=>n!==void 0);return[]}var wh=/v(\d{1,3})\.(\d{1,4})/i;function Zp(e){let t=new URL(e),n=t.pathname.split("/").filter(Boolean),r=n[n.length-1];if(r){if(wh.test(r)){let i=n[n.length-2];return{identity:t.origin+(i?`/${n.slice(0,n.length-1).join("/")}`:""),name:i??null,version:r}}return{identity:`${t.origin}/${n.join("/")}`,name:r,version:null}}return{identity:t.origin,name:null,version:null}}function xu(e,t){Hs();let n={kind:jt,definitions:Rh(e,{useSchemaDefinition:!0,forceSchemaDefinition:!1,throwOnConflict:!1,commentDescriptions:!1,...t})},r;if(t?.commentDescriptions)r=bp(n);else r=n;return Hs(),r}function Jr(e,t,n=[],r=[],i=new Set,o=new Set){let s=(a)=>{o.add(a)};if(e&&!i.has(e))if(i.add(e),typeof e==="function")Jr(e(),t,n,r,i,o);else if(Array.isArray(e))for(let a of e)Jr(a,t,n,r,i,o);else if(rr(e)){let a=hp(e,t);Jr(a.definitions,t,n,r,i,o)}else if(jp(e)||Bp(e)){let a=bt(e,t);Jr(a.definitions,t,n,r,i,o)}else if(typeof e==="object"&&Qo(e)){let a=Xp({definitions:[e],kind:jt}),u="https://specs.apollo.dev/federation",c="https://specs.apollo.dev/link",l=a.find((f)=>f.url.identity==="https://specs.apollo.dev/federation");if(l)s(sa(l,"@composeDirective")),s(sa(l,"@key"));let p=a.find((f)=>f.url.identity==="https://specs.apollo.dev/link");if(p)s(sa(p,"@link"));if(e.kind===pt)n.push(e);else r.push(e)}else if(kp(e))Jr(e.definitions,t,n,r,i,o);else throw Error(`typeDefs must contain only strings, documents, schemas, or functions, got ${typeof e}`);return{allDirectives:n,allNodes:r,repeatableLinkImports:o}}function Rh(e,t){Hs();let{allDirectives:n,allNodes:r,repeatableLinkImports:i}=Jr(e,t),o=Au(n,t);t.repeatableLinkImports=i;let s=Au(r,t,o);if(t?.useSchemaDefinition){let u=s[hr]||{kind:Ye,operationTypes:[]},c=u,l=c.operationTypes??=[];for(let p in oa)if(!l.find((d)=>d.operation===p)){let d=oa[p],E=s[d];if(E!=null&&E.name!=null)l.push({kind:si,type:{kind:Sn,name:E.name},operation:p})}if(u?.operationTypes?.length!=null&&u.operationTypes.length>0)s[hr]=u}if(t?.forceSchemaDefinition&&!s[hr]?.operationTypes?.length)s[hr]={kind:Ye,operationTypes:[{kind:si,operation:"query",type:{kind:Sn,name:{kind:Ne,value:"Query"}}}]};let a=Object.values(s);if(t?.sort){let u=typeof t.sort==="function"?t.sort:Qp;a.sort((c,l)=>u(c.name?.value,l.name?.value))}return a}var Lh={respectArrays:!0,respectSymbols:{enumerable:!0,nonEnumerable:!0}};function Wr(e,t){if(!e||!t||t===e.extensions)return;if(!e.extensions){e.extensions=t;return}e.extensions=ra([e.extensions,t],Lh)}function ef(e,t){Wr(e,t.schemaExtensions);for(let[n,r]of Object.entries(t.types||{})){let i=e.getType(n);if(i){if(Wr(i,r.extensions),r.type==="object"||r.type==="interface")for(let[o,s]of Object.entries(r.fields)){let a=i.getFields()[o];if(a){Wr(a,s.extensions);for(let[u,c]of Object.entries(s.arguments))Wr(a.args.find((l)=>l.name===u),c)}}else if(r.type==="input")for(let[o,s]of Object.entries(r.fields)){let a=i.getFields()[o];Wr(a,s.extensions)}else if(r.type==="enum")for(let[o,s]of Object.entries(r.values)){let a=i.getValue(o);Wr(a,s)}}}return e}function tf(e,t){Zi(e,{[Q.ABSTRACT_TYPE]:(n)=>{if(!n.resolveType){let r=`Type "${n.name}" is missing a "__resolveType" resolver. Pass 'ignore' into "resolverValidationOptions.requireResolversForResolveType" to disable this error.`;if(t==="error")throw Error(r);if(t==="warn")console.warn(r)}return}})}function nf(e,t){let n={},r=e.getTypeMap();for(let i in r){let o=r[i];if("getInterfaces"in o){n[i]={};for(let a of o.getInterfaces())if(t[a.name]){for(let u in t[a.name])if(u==="__isTypeOf"||!u.startsWith("__"))n[i][u]=t[a.name][u]}let s=t[i];n[i]={...n[i],...s}}else{let s=t[i];if(s!=null)n[i]=s}}return n}function rf({schema:e,resolvers:t,defaultFieldResolver:n,resolverValidationOptions:r={},inheritResolversFromInterfaces:i=!1,updateResolversInPlace:o=!1}){let{requireResolversToMatchSchema:s="error",requireResolversForResolveType:a}=r,u=i?nf(e,t):t;for(let c in u){let l=u[c];if(typeof l!=="object")throw Error(`"${c}" defined in resolvers, but has invalid value "${l}". The resolver's value must be of type object.`);let f=e.getType(c);if(f==null){let d=`"${c}" defined in resolvers, but not in schema`;if(s&&s!=="error"){if(s==="warn")console.warn(d);continue}throw Error(d)}else if(Ze(f))for(let d in l)if(d.startsWith("__"))Hr(f,d.substring(2),l[d]);else Hr(f,d,l[d]);else if(z(f)){let d=f.getValues();for(let E in l)if(!E.startsWith("__")&&!d.some((I)=>I.name===E)&&s&&s!=="ignore"){let I=`${f.name}.${E} was defined in resolvers, but not present within ${f.name}`;if(s==="error")throw Error(I);else console.warn(I)}}else if(te(f)){for(let d in l)if(!d.startsWith("__")&&s&&s!=="ignore"){let E=`${f.name}.${d} was defined in resolvers, but ${f.name} is not an object or interface type`;if(s==="error")throw Error(E);else console.warn(E)}}else if(L(f)||P(f)){for(let d in l)if(!d.startsWith("__"))if(f.getFields()[d]==null){if(s&&s!=="ignore"){let S=`${c}.${d} defined in resolvers, but not in schema`;if(s==="error")throw Error(S);else console.error(S)}}else{let S=l[d];if(typeof S!=="function"&&typeof S!=="object")throw Error(`Resolver ${c}.${d} must be object or function`)}}}if(e=o?Fh(e,u,n):Ch(e,u,n),a&&a!=="ignore")tf(e,a);return e}var kh={serialize:"coerceOutputValue",parseValue:"coerceInputValue"};function Hr(e,t,n){e[t]=n;let r=kh[t];if(r)e[r]=n}function Fh(e,t,n){let r=e.getTypeMap();for(let i in t){let o=e.getType(i),s=t[i];if(ae(o))for(let a in s)if(a.startsWith("__"))Hr(o,a.substring(2),s[a]);else if(a==="astNode"&&o.astNode!=null)o.astNode={...o.astNode,description:s?.astNode?.description??o.astNode.description,directives:(o.astNode.directives??[]).concat(s?.astNode?.directives??[])};else if(a==="extensionASTNodes"&&o.extensionASTNodes!=null)o.extensionASTNodes=o.extensionASTNodes.concat(s?.extensionASTNodes??[]);else if(a==="extensions"&&o.extensions!=null&&s.extensions!=null)o.extensions=Object.assign(Object.create(null),o.extensions,s.extensions);else Hr(o,a,s[a]);else if(z(o)){let a=o.toConfig(),u=a.values;for(let c in s)if(c.startsWith("__"))a[c.substring(2)]=s[c];else if(c==="astNode"&&a.astNode!=null)a.astNode={...a.astNode,description:s?.astNode?.description??a.astNode.description,directives:(a.astNode.directives??[]).concat(s?.astNode?.directives??[])};else if(c==="extensionASTNodes"&&a.extensionASTNodes!=null)a.extensionASTNodes=a.extensionASTNodes.concat(s?.extensionASTNodes??[]);else if(c==="extensions"&&o.extensions!=null&&s.extensions!=null)o.extensions=Object.assign(Object.create(null),o.extensions,s.extensions);else if(u[c])u[c].value=s[c];r[i]=new we(a)}else if(te(o)){for(let a in s)if(a.startsWith("__"))o[a.substring(2)]=s[a]}else if(L(o)||P(o))for(let a in s){if(a.startsWith("__")){o[a.substring(2)]=s[a];continue}let c=o.getFields()[a];if(c!=null){let l=s[a];if(typeof l==="function")c.resolve=l.bind(s);else of(c,l)}}}if(vu(e,Xs),Rp(e),vu(e,Zs),n!=null)na(e,(i)=>{if(!i.resolve)i.resolve=n});return e}function Ch(e,t,n){if(e=Zi(e,{[Q.SCALAR_TYPE]:(r)=>{let i=r.toConfig(),o=t[r.name];if(!Ze(r)&&o!=null){let s=["parseValue","coerceInputValue"].some((u)=>(u in o)||(`__${u}`in o)),a=["parseLiteral","coerceInputLiteral"].some((u)=>(u in o)||(`__${u}`in o));for(let u in o)if(u.startsWith("__"))Hr(i,u.substring(2),o[u]);else if(u==="astNode"&&i.astNode!=null)i.astNode={...i.astNode,description:o?.astNode?.description??i.astNode.description,directives:(i.astNode.directives??[]).concat(o?.astNode?.directives??[])};else if(u==="extensionASTNodes"&&i.extensionASTNodes!=null)i.extensionASTNodes=i.extensionASTNodes.concat(o?.extensionASTNodes??[]);else if(u==="extensions"&&i.extensions!=null&&o.extensions!=null)i.extensions=Object.assign(Object.create(null),r.extensions,o.extensions);else Hr(i,u,o[u]);if(s&&!a)delete i.parseLiteral;return new ke(i)}},[Q.ENUM_TYPE]:(r)=>{let i=t[r.name],o=r.toConfig(),s=o.values;if(i!=null){for(let a in i)if(a.startsWith("__"))o[a.substring(2)]=i[a];else if(a==="astNode"&&o.astNode!=null)o.astNode={...o.astNode,description:i?.astNode?.description??o.astNode.description,directives:(o.astNode.directives??[]).concat(i?.astNode?.directives??[])};else if(a==="extensionASTNodes"&&o.extensionASTNodes!=null)o.extensionASTNodes=o.extensionASTNodes.concat(i?.extensionASTNodes??[]);else if(a==="extensions"&&o.extensions!=null&&i.extensions!=null)o.extensions=Object.assign(Object.create(null),r.extensions,i.extensions);else if(s[a])s[a].value=i[a];return new we(o)}},[Q.UNION_TYPE]:(r)=>{let i=t[r.name];if(i!=null){let o=r.toConfig();if(i.__resolveType)o.resolveType=i.__resolveType;return new it(o)}},[Q.OBJECT_TYPE]:(r)=>{let i=t[r.name];if(i!=null){let o=r.toConfig();if(i.__isTypeOf)o.isTypeOf=i.__isTypeOf;return new Ee(o)}},[Q.INTERFACE_TYPE]:(r)=>{let i=t[r.name];if(i!=null){let o=r.toConfig();if(i.__resolveType)o.resolveType=i.__resolveType;return new Me(o)}},[Q.COMPOSITE_FIELD]:(r,i,o)=>{let s=t[o];if(s!=null){let a=s[i];if(a!=null){let u={...r};if(typeof a==="function")u.resolve=a.bind(s);else of(u,a);return u}}}}),n!=null)e=Zi(e,{[Q.OBJECT_FIELD]:(r)=>({...r,resolve:r.resolve!=null?r.resolve:n})});return e}function of(e,t){for(let n in t)e[n]=t[n]}function sf(e,t={}){let{requireResolversForArgs:n,requireResolversForNonScalar:r,requireResolversForAllFields:i}=t;if(i&&(n||r))throw TypeError("requireResolversForAllFields takes precedence over the more specific assertions. Please configure either requireResolversForAllFields or requireResolversForArgs / requireResolversForNonScalar, but not a combination of them.");na(e,(o,s,a)=>{if(i)wu("requireResolversForAllFields",i,o,s,a);if(n&&o.args.length>0)wu("requireResolversForArgs",n,o,s,a);if(r!=="ignore"&&!ae(pe(o.type)))wu("requireResolversForNonScalar",r,o,s,a)})}function wu(e,t,n,r,i){if(!n.resolve){let o=`Resolver missing for "${r}.${i}". +To disable this validator, use: + resolverValidationOptions: { + ${e}: 'ignore' + }`;if(t==="error")throw Error(o);if(t==="warn")console.warn(o);return}if(typeof n.resolve!=="function")throw Error(`Resolver "${r}.${i}" must be a function`)}function Vh({typeDefs:e,resolvers:t={},resolverValidationOptions:n={},inheritResolversFromInterfaces:r=!1,updateResolversInPlace:i=!1,schemaExtensions:o,defaultFieldResolver:s,...a}){if(typeof n!=="object")throw Error("Expected `resolverValidationOptions` to be an object");if(!e)throw Error("Must provide typeDefs");let u;if(rr(e))u=e;else if(a?.commentDescriptions){let c=xu(e,{...a,commentDescriptions:!0});u=Ys(c,a)}else{let c=xu(e,a);u=Ki(c,a)}if(u=rf({schema:u,resolvers:bu(t),resolverValidationOptions:n,inheritResolversFromInterfaces:r,updateResolversInPlace:i,defaultFieldResolver:s}),Object.keys(n).length>0)sf(u,n);if(o)for(let c of Js(o))ef(u,c);return u}function ut(e){if(e===null)return"null";if(Array.isArray(e))return"array";return typeof e}function rn(e){return ut(e)==="object"}function af(e){return typeof Object(e)[Symbol.asyncIterator]==="function"}function aa(e){return rn(e)&&typeof Object(e)[Symbol.asyncIterator]==="function"&&typeof e.return==="function"}function Mh(e){return Array.isArray(e)&&e.length>0&&e.every((t)=>("message"in t))}var uf="graphql-transport-ws";var vn=((e)=>(e[e.InternalServerError=4500]="InternalServerError",e[e.InternalClientError=4005]="InternalClientError",e[e.BadRequest=4400]="BadRequest",e[e.BadResponse=4004]="BadResponse",e[e.Unauthorized=4401]="Unauthorized",e[e.Forbidden=4403]="Forbidden",e[e.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",e[e.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",e[e.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",e[e.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",e[e.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests",e))(vn||{}),ct=((e)=>(e.ConnectionInit="connection_init",e.ConnectionAck="connection_ack",e.Ping="ping",e.Pong="pong",e.Subscribe="subscribe",e.Next="next",e.Error="error",e.Complete="complete",e))(ct||{});function cf(e){if(!rn(e))throw Error(`Message is expected to be an object, but got ${ut(e)}`);if(!e.type)throw Error("Message is missing the 'type' property");if(typeof e.type!=="string")throw Error(`Message is expects the 'type' property to be a string, but got ${ut(e.type)}`);switch(e.type){case"connection_init":case"connection_ack":case"ping":case"pong":{if(e.payload!=null&&!rn(e.payload))throw Error(`"${e.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${e.payload}"`);break}case"subscribe":{if(typeof e.id!=="string")throw Error(`"${e.type}" message expects the 'id' property to be a string, but got ${ut(e.id)}`);if(!e.id)throw Error(`"${e.type}" message requires a non-empty 'id' property`);if(!rn(e.payload))throw Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${ut(e.payload)}`);if(typeof e.payload.query!=="string")throw Error(`"${e.type}" message payload expects the 'query' property to be a string, but got ${ut(e.payload.query)}`);if(e.payload.variables!=null&&!rn(e.payload.variables))throw Error(`"${e.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${ut(e.payload.variables)}`);if(e.payload.operationName!=null&&ut(e.payload.operationName)!=="string")throw Error(`"${e.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${ut(e.payload.operationName)}`);if(e.payload.extensions!=null&&!rn(e.payload.extensions))throw Error(`"${e.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${ut(e.payload.extensions)}`);break}case"next":{if(typeof e.id!=="string")throw Error(`"${e.type}" message expects the 'id' property to be a string, but got ${ut(e.id)}`);if(!e.id)throw Error(`"${e.type}" message requires a non-empty 'id' property`);if(!rn(e.payload))throw Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${ut(e.payload)}`);break}case"error":{if(typeof e.id!=="string")throw Error(`"${e.type}" message expects the 'id' property to be a string, but got ${ut(e.id)}`);if(!e.id)throw Error(`"${e.type}" message requires a non-empty 'id' property`);if(!Mh(e.payload))throw Error(`"${e.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(e.payload)}`);break}case"complete":{if(typeof e.id!=="string")throw Error(`"${e.type}" message expects the 'id' property to be a string, but got ${ut(e.id)}`);if(!e.id)throw Error(`"${e.type}" message requires a non-empty 'id' property`);break}default:throw Error(`Invalid message 'type' property "${e.type}"`)}return e}function lf(e,t){return cf(typeof e==="string"?JSON.parse(e,t):e)}function zr(e,t){return cf(e),JSON.stringify(e,t)}function pf(e){let{schema:t,context:n,roots:r,parse:i,validate:o,execute:s,subscribe:a,connectionInitWaitTimeout:u=3000,onConnect:c,onDisconnect:l,onPing:p,onPong:f,onClose:d,onSubscribe:E,onOperation:I,onNext:S,onError:G,onComplete:Z,jsonMessageReviver:W,jsonMessageReplacer:H}=e;return{opened(Y,ne){let b={connectionInitReceived:!1,acknowledged:!1,subscriptions:Object.create(null),extra:ne};if(Y.protocol!==uf)return Y.close(vn.SubprotocolNotAcceptable,"Subprotocol not acceptable"),async(h,D)=>{await d?.(b,h,D)};let A=u>0&&isFinite(u)?setTimeout(()=>{if(!b.connectionInitReceived)Y.close(vn.ConnectionInitialisationTimeout,"Connection initialisation timeout")},u):null;return Y.onMessage(async function(D){let R;try{R=lf(D,W)}catch(q){return Y.close(vn.BadRequest,"Invalid message received")}switch(R.type){case ct.ConnectionInit:{if(b.connectionInitReceived)return Y.close(vn.TooManyInitialisationRequests,"Too many initialisation requests");if(b.connectionInitReceived=!0,rn(R.payload))b.connectionParams=R.payload;let q=await c?.(b);if(q===!1)return Y.close(vn.Forbidden,"Forbidden");b.acknowledged=!0,await Y.send(zr(rn(q)?{type:ct.ConnectionAck,payload:q}:{type:ct.ConnectionAck},H));return}case ct.Ping:{if(await p?.(b,R.payload),Y.onPing)return await Y.onPing(R.payload);await Y.send(zr(R.payload?{type:ct.Pong,payload:R.payload}:{type:ct.Pong},H));return}case ct.Pong:return await f?.(b,R.payload),await Y.onPong?.(R.payload);case ct.Subscribe:{if(!b.acknowledged)return Y.close(vn.Unauthorized,"Unauthorized");let{id:q,payload:ce}=R;if(q in b.subscriptions)return Y.close(vn.SubscriberAlreadyExists,`Subscriber for ${q} already exists`);b.subscriptions[q]=null;let Ue={next:async(v,{id:O,payload:N},g)=>{let{errors:_,...B}=v,X=await S?.(b,O,N,g,v);await Y.send(zr({id:O,type:ct.Next,payload:X||{...B,..._?{errors:_.map((he)=>he.toJSON())}:{}}},H))},error:async(v,{id:O,payload:N})=>{let g=await G?.(b,O,N,v);await Y.send(zr({id:O,type:ct.Error,payload:g||v.map((_)=>_.toJSON())},H))},complete:async(v,{id:O,payload:N})=>{if(await Z?.(b,O,N),v)await Y.send(zr({id:O,type:ct.Complete},H))}};try{let v,O=await E?.(b,R.id,R.payload);if(O){if(ff(O))return q in b.subscriptions?await Ue.error(O,R):void 0;else if(Array.isArray(O))throw Error("Invalid return value from onSubscribe hook, expected an array of GraphQLError objects");v=O}else{if(!t)throw Error("The GraphQL schema is not provided");let B={operationName:ce.operationName,document:(i??bt)(ce.query),variableValues:ce.variables};v={...B,schema:typeof t==="function"?await t(b,q,ce,B):t};let X=(o??Lr)(v.schema,v.document);if(X.length>0)return q in b.subscriptions?await Ue.error(X,R):void 0}let N=Fr(v.document,v.operationName);if(!N)return q in b.subscriptions?await Ue.error([new m("Unable to identify operation")],R):void 0;if(!("rootValue"in v))v.rootValue=r?.[N.operation];if(!("contextValue"in v))v.contextValue=typeof n==="function"?await n(b,q,ce,v):n;let g;if(N.operation==="subscription")g=await(a??Pr)(v);else g=await(s??Ur)(v);let _=await I?.(b,q,ce,v,g);if(_)g=_;if(af(g))if(!(q in b.subscriptions)){if(aa(g))g.return(void 0)}else{b.subscriptions[q]=g;try{for await(let B of g)await Ue.next(B,R,v)}catch(B){let X=B instanceof Error?B:Error(String(B));await Ue.error([ro.major>=17?new m(X.message,{cause:X}):ro.major>=16?new m(X.message,{originalError:X}):new m(X.message,null,null,null,null,X)],R),delete b.subscriptions[q]}}else if(q in b.subscriptions)await Ue.next(g,R,v);await Ue.complete(q in b.subscriptions,R)}finally{delete b.subscriptions[q]}return}case ct.Complete:{let q=b.subscriptions[R.id];if(delete b.subscriptions[R.id],aa(q))await q.return(void 0);return}default:throw Error(`Unexpected message of type ${R.type} received`)}}),async(h,D)=>{if(A)clearTimeout(A);let R={...b.subscriptions};if(b.subscriptions=Object.create(null),await Promise.all(Object.values(R).filter(aa).map((q)=>q.return(void 0))),b.acknowledged)await l?.(b,h,D);await d?.(b,h,D)}}}}function ff(e){return Array.isArray(e)&&e.length>0&&e.every((t)=>t instanceof m)}export{Bi as AbortedGraphQLExecutionError,Wn as BREAK,Se as BreakingChangeType,yi as DEFAULT_DEPRECATION_REASON,at as DangerousChangeType,$o as DeferStreamDirectiveLabelRule,Go as DeferStreamDirectiveOnRootFieldRule,jo as DeferStreamDirectiveOnValidOperationsRule,F as DirectiveLocation,qo as ExecutableDefinitionsRule,Ko as FieldsOnCorrectTypeRule,Jo as FragmentsOnCompositeTypesRule,er as GRAPHQL_MAX_INT,tr as GRAPHQL_MIN_INT,ge as GraphQLBoolean,Xt as GraphQLDeferDirective,mn as GraphQLDeprecatedDirective,Re as GraphQLDirective,we as GraphQLEnumType,m as GraphQLError,Ir as GraphQLFloat,Rn as GraphQLID,Ln as GraphQLIncludeDirective,Ge as GraphQLInputObjectType,wn as GraphQLInt,Me as GraphQLInterfaceType,oe as GraphQLList,V as GraphQLNonNull,Ee as GraphQLObjectType,Ni as GraphQLOneOfDirective,ke as GraphQLScalarType,ot as GraphQLSchema,kn as GraphQLSkipDirective,gi as GraphQLSpecifiedByDirective,vt as GraphQLStreamDirective,ie as GraphQLString,it as GraphQLUnionType,C as Kind,Wo as KnownArgumentNamesRule,Fi as KnownDirectivesRule,Ho as KnownFragmentNamesRule,zo as KnownOperationTypesRule,Ci as KnownTypeNamesRule,ar as Lexer,ei as Location,Xo as LoneAnonymousOperationRule,Zo as LoneSchemaDefinitionRule,es as MaxIntrospectionDepthRule,Ul as NoDeprecatedCustomRule,ts as NoFragmentCyclesRule,Pl as NoSchemaIntrospectionCustomRule,ns as NoUndefinedVariablesRule,rs as NoUnusedFragmentsRule,is as NoUnusedVariablesRule,re as OperationTypeNode,us as OverlappingFieldsCanBeMergedRule,cs as PossibleFragmentSpreadsRule,ls as PossibleTypeExtensionsRule,ps as ProvidedRequiredArgumentsRule,_e as SafeChangeType,fs as ScalarLeafsRule,Ii as SchemaMetaFieldDef,hs as SingleFieldSubscriptionsRule,Pt as Source,Es as StreamDirectiveOnListFieldRule,bn as Token,T as TokenKind,ur as TypeInfo,ue as TypeKind,vi as TypeMetaFieldDef,bi as TypeNameMetaFieldDef,Ts as UniqueArgumentDefinitionNamesRule,Pi as UniqueArgumentNamesRule,ys as UniqueDirectiveNamesRule,$i as UniqueDirectivesPerLocationRule,gs as UniqueEnumValueNamesRule,Ns as UniqueFieldDefinitionNamesRule,Is as UniqueFragmentNamesRule,Gi as UniqueInputFieldNamesRule,vs as UniqueOperationNamesRule,bs as UniqueOperationTypesRule,_s as UniqueTypeNamesRule,Ss as UniqueVariableNamesRule,ji as ValidationContext,Ds as ValuesOfCorrectTypeRule,Os as VariablesAreInputTypesRule,As as VariablesInAllowedPositionRule,Ao as __Directive,xo as __DirectiveLocation,Ro as __EnumValue,wo as __Field,_r as __InputValue,br as __Schema,mt as __Type,Lo as __TypeKind,yc as assertAbstractType,Zu as assertArgument,Tc as assertCompositeType,wc as assertDirective,ic as assertEnumType,sc as assertEnumValue,Io as assertEnumValueName,zu as assertField,lc as assertInputField,uc as assertInputObjectType,hc as assertInputType,_o as assertInterfaceType,It as assertLeafType,fc as assertListType,He as assertName,Nc as assertNamedType,mc as assertNonNullType,So as assertNullableType,bo as assertObjectType,Ec as assertOutputType,Wu as assertScalarType,Sr as assertSchema,Ku as assertType,nc as assertUnionType,Dr as assertValidSchema,gc as assertWrappingType,Fn as astFromValue,Ki as buildASTSchema,Gl as buildClientSchema,Ys as buildSchema,yn as coerceInputLiteral,Tn as coerceInputValue,Xl as concatAST,iu as createSourceEventStream,Us as defaultFieldResolver,au as defaultHarness,su as defaultTypeResolver,mi as doTypesOverlap,Af as enableDevMode,Ur as execute,tu as executeRootSelectionSet,ru as executeSubscriptionEvent,$s as executeSync,eu as experimentalExecuteIncrementally,nu as experimentalExecuteRootSelectionSet,jl as extendSchema,sp as findBreakingChanges,ap as findDangerousChanges,Ks as findSchemaChanges,_t as getArgumentValues,Zt as getDirectiveValues,Hn as getEnterLeaveForKind,Bs as getIntrospectionQuery,Yn as getLocation,pe as getNamedType,gr as getNullableType,Fr as getOperationAST,Mi as getVariableValues,tm as graphql,nm as graphqlSync,$l as introspectionFromSchema,Mt as introspectionTypes,Ke as isAbstractType,li as isArgument,dt as isCompositeType,Bo as isConstValueNode,Qo as isDefinitionNode,xf as isDevModeEnabled,nr as isDirective,z as isEnumType,ma as isEnumValue,Nr as isEqualType,wi as isExecutableDefinitionNode,da as isField,ha as isInputField,k as isInputObjectType,xe as isInputType,P as isInterfaceType,ht as isIntrospectionType,ve as isLeafType,j as isListType,rt as isNamedType,w as isNonNullType,pi as isNullableType,L as isObjectType,Nt as isOutputType,ze as isRequiredArgument,Xe as isRequiredInputField,ae as isScalarType,rr as isSchema,Xc as isSchemaCoordinateNode,Hc as isSelectionNode,Vt as isSpecifiedDirective,Ze as isSpecifiedScalarType,Yo as isSubscriptionOperationDefinitionNode,yr as isType,En as isTypeDefinitionNode,ki as isTypeExtensionNode,zc as isTypeNode,Ht as isTypeSubTypeOf,Ri as isTypeSystemDefinitionNode,Li as isTypeSystemExtensionNode,te as isUnionType,xa as isValueNode,On as isWrappingType,Ml as legacyExecuteIncrementally,cu as legacyExecuteRootSelectionSet,Bl as lexicographicSortSchema,en as locatedError,Vh as makeExecutableSchema,pf as makeServer,Ps as mapSourceToResponseEvent,bt as parse,Uo as parseConstValue,Po as parseSchemaCoordinate,qc as parseType,Yc as parseValue,ee as print,hu as printDirective,ql as printIntrospectionSchema,so as printLocation,Yl as printSchema,Zr as printSourceLocation,du as printType,Ga as recommendedRules,dn as replaceVariables,Eu as resolveASTSchemaCoordinate,fi as resolveObjMapThunk,Do as resolveReadonlyArrayThunk,up as resolveSchemaCoordinate,fe as responsePathAsArray,ep as separateOperations,je as specifiedDirectives,xs as specifiedRules,Ct as specifiedScalarTypes,np as stripIgnoredCharacters,Pr as subscribe,de as syntaxError,Te as typeFromAST,Lr as validate,fr as validateExecutionArgs,xn as validateInputLiteral,Zn as validateInputValue,Di as validateSchema,ou as validateSubscriptionArgs,Pn as valueFromAST,Wt as valueFromASTUntyped,zt as valueToLiteral,Nf as version,ro as versionInfo,ft as visit,ui as visitInParallel,xr as visitWithTypeInfo}; diff --git a/vendor/deps.ts b/vendor/deps.ts new file mode 100644 index 0000000..d5388e3 --- /dev/null +++ b/vendor/deps.ts @@ -0,0 +1,5 @@ +// deps.ts — re-export exactly what gq imports (grep gq's source for "npm:") +export * from "graphql"; +export { makeExecutableSchema } from "@graphql-tools/schema"; +export { makeServer } from "graphql-ws"; +export type { ServerOptions } from "graphql-ws"; diff --git a/vendor/package.json b/vendor/package.json new file mode 100644 index 0000000..fa27fca --- /dev/null +++ b/vendor/package.json @@ -0,0 +1,16 @@ +{ + "dependencies": {}, + "devDependencies": { + "@graphql-tools/schema": "^11.0.4", + "dts-bundle-generator": "^9.5.1", + "graphql": "^17.0.2", + "graphql-ws": "^6.4.1", + "typescript": "^6" + }, + "overrides": { + "typescript": "^6.0.3" + }, + "scripts": { + "build": "bun build deps.ts --format=esm --target=browser --minify --define process.env.NODE_ENV=\"'production'\" --banner '// @ts-self-types=\"./deps.d.ts\"' --outfile=deps.js && dts-bundle-generator --export-referenced-types=false -o deps.d.ts --external-inlines graphql @graphql-tools/schema @graphql-tools/utils graphql-ws -- deps.ts" + } +} diff --git a/vendor/tsconfig.json b/vendor/tsconfig.json new file mode 100644 index 0000000..10148a6 --- /dev/null +++ b/vendor/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "declaration": true, + "lib": ["esnext", "webworker"], + "module": "esnext", + "moduleResolution": "bundler", + "skipLibCheck": true, + "strict": true, + "target": "esnext" + }, + "files": ["deps.ts"] +} |