@theguild/federation-composition
Version: 
Open Source Composition library for Apollo Federation
61 lines • 2.37 kB
text/typescript
import { DirectiveDefinitionNode, TypeDefinitionNode } from 'graphql';
import { Link } from '../specifications/link.cjs';
import { SubgraphState } from '../subgraph/state.cjs';
import { DirectiveState } from './composition/directive.cjs';
import { EnumTypeState } from './composition/enum-type.cjs';
import { InputObjectTypeState } from './composition/input-object-type.cjs';
import { InterfaceTypeState } from './composition/interface-type.cjs';
import { ObjectTypeState } from './composition/object-type.cjs';
import { ScalarTypeState } from './composition/scalar-type.cjs';
import { UnionTypeState } from './composition/union-type.cjs';
export type SupergraphState = {
    subgraphs: Map<string, SubgraphState>;
    scalarTypes: Map<string, ScalarTypeState>;
    objectTypes: Map<string, ObjectTypeState>;
    interfaceTypes: Map<string, InterfaceTypeState>;
    unionTypes: Map<string, UnionTypeState>;
    enumTypes: Map<string, EnumTypeState>;
    inputObjectTypes: Map<string, InputObjectTypeState>;
    directives: Map<string, DirectiveState>;
    links: Array<Link & {
        graph: string;
    }>;
    specs: {
        tag: boolean;
        cost: {
            used: boolean;
            names: {
                cost: string | null;
                listSize: string | null;
            };
        };
        inaccessible: boolean;
        authenticated: boolean;
        requiresScopes: boolean;
        policy: boolean;
    };
};
export type SupergraphStateBuilder = ReturnType<typeof createSupergraphStateBuilder>;
export declare function createSupergraphStateBuilder(): {
    addSubgraph(subgraph: SubgraphState): void;
    getGraph(id: string): SubgraphState | undefined;
    visitSubgraphState(subgraphState: SubgraphState): void;
    getSupergraphState(): SupergraphState;
    getSubgraphState(graphId: string): SubgraphState | undefined;
    links(): readonly {
        name: string | null;
        version: string | null;
        identity: string;
        imports: ({
            readonly kind: "type" | "directive";
            readonly name: string;
            readonly alias?: undefined;
        } | {
            readonly kind: "type" | "directive";
            readonly name: string;
            readonly alias: string;
        })[];
    }[];
    build(): (DirectiveDefinitionNode | TypeDefinitionNode)[];
};
//# sourceMappingURL=state.d.ts.map