@apollo/core-schema
Version:
Apollo Core Schema processing library
62 lines • 2.55 kB
TypeScript
import { ASTNode, DefinitionNode, SchemaExtensionNode } from 'graphql';
import { Linker, type Link } from './linker';
import { De, Defs, Locatable, Located, Redirect } from './de';
import GRef from './gref';
import LinkUrl from './link-url';
export declare const ErrExtraImport: (gref: GRef, node: ASTNode) => import("./error").GraphQLErrorExt<"ExtraImport"> & {
message: string;
gref: GRef;
node: ASTNode;
};
export interface IScope extends Iterable<Link> {
readonly url?: LinkUrl;
readonly self?: Link;
readonly parent?: IScope;
readonly linker: Linker;
readonly flat: IScope;
own(name: string): Link | undefined;
has(name: string): boolean;
lookup(name: string): Link | undefined;
visible(): Iterable<[string, Link]>;
entries(): Iterable<[string, Link]>;
header(): [De<SchemaExtensionNode>] | [];
locate(node: Locatable): GRef;
name(node: GRef): [string | null, string] | undefined;
denormalize<T extends ASTNode>(node: T): De<T>;
renormalizeDefs(defs: Defs, redirects?: Iterable<Redirect>): Iterable<DefinitionNode>;
child(fn: (scope: IScopeMut) => void): Readonly<IScope>;
}
export interface IScopeMut extends IScope {
add(link: Link): void;
}
export declare class Scope implements IScope {
readonly parent?: Scope | undefined;
static readonly EMPTY: IScope;
static create(fn?: (scope: IScopeMut) => void, parent?: Scope): IScope;
get self(): Link | undefined;
get url(): LinkUrl | undefined;
locate(node: Locatable): GRef;
header(): [De<SchemaExtensionNode>] | [];
name(gref: GRef): [string | null, string] | undefined;
denormalize<T extends ASTNode>(node: T): De<T>;
renormalize<T extends ASTNode>(node: De<T>, redirects?: Readonly<Map<GRef, Redirect>>): T;
renormalizeDefs(defs: Defs): Iterable<DefinitionNode>;
[Symbol.iterator](): Generator<Link, void, unknown>;
get flat(): IScope;
own(name: string): Link | undefined;
has(name: string): boolean;
hasOwn(name: string): boolean;
lookup(name: string): Link | undefined;
visible(): Iterable<[string, Link]>;
entries(): Iterable<[string, Link]>;
child(fn?: (scope: IScopeMut) => void): IScope;
clone(fn?: (scope: IScopeMut) => void): IScope;
get linker(): Linker;
private add;
private readonly names;
private readonly reverse;
private constructor();
}
export default Scope;
export declare const including: (refs: Iterable<Located | Redirect>) => (scope: IScopeMut) => void;
//# sourceMappingURL=scope.d.ts.map