inversify-graphql
Version:
Builds dependency-inverted GraphQL schemas with InversifyJS
33 lines (32 loc) • 1.5 kB
TypeScript
import * as inv from 'inversify';
import * as gql from 'graphql';
import { InversifyObjectConfig, InversifyInterfaceConfig } from './interfaces';
import { ITypeCache } from './interfaces-private';
export interface IInversifyExtensibleNode {
buildType(): inv.interfaces.Newable<InversifyObjectTypeBuilder<any, any>>;
}
export declare const ExtensibleSchemaSymbol: unique symbol;
export interface IExtSchema {
getNoCreate(extendedType: string, ctor: any, which: 'all' | 'noDirect' | 'none'): IInversifyExtensibleNode[];
}
export declare abstract class InversifyObjectTypeBuilderBase<TSource, TContext, TConfig extends (InversifyObjectConfig<TSource, TContext> | InversifyInterfaceConfig<TSource, TContext>) & Object> {
protected building?: boolean;
protected extensions: 'all' | 'noDirect' | 'none';
protected builders: ITypeCache;
private extensible;
abstract config(): TConfig;
protected doBuildConfig(): TConfig & {
interfaces: gql.Thunk<gql.GraphQLObjectType<any, any, {
[key: string]: any;
}>[]>;
fields: gql.Thunk<gql.GraphQLFieldConfigMap<TSource, TContext, {
[key: string]: any;
}>>;
};
}
export declare abstract class InversifyObjectTypeBuilder<TSource, TContext = any> extends InversifyObjectTypeBuilderBase<TSource, TContext, InversifyObjectConfig<TSource, TContext>> {
protected built: gql.GraphQLObjectType;
build(): gql.GraphQLObjectType<any, any, {
[key: string]: any;
}>;
}