@schamane/small-graphql-mongoose-middleware
Version:

25 lines (24 loc) • 1.31 kB
TypeScript
import type { Application } from 'express';
import type { GraphQLSchema } from 'graphql';
import { ApolloServer, IExecutableSchemaDefinition, PlaygroundConfig, PubSub } from 'apollo-server-express';
import { Server } from 'http';
import type { DataSource } from 'apollo-datasource';
import { ApolloServerDataSources } from './grapqhl-extras';
import { User } from './auth/userModel';
export declare type GrapqhContext = {
id: string;
groups: string[];
dataSources: Record<string, DataSource>;
};
export declare const makeSchema: (schemasDefs: IExecutableSchemaDefinition[]) => GraphQLSchema;
export declare type graphQLAuthCreateContext = (user: unknown, authInfo: unknown) => User | Promise<User>;
export interface GraphQlOptions {
path: string;
introspection: boolean;
playground?: PlaygroundConfig;
tracing: boolean;
}
export declare const GraphQlServer: (app: Application, dataSources: ApolloServerDataSources, graphQlOptions: GraphQlOptions, schema: GraphQLSchema, authStrategy: string | string[], createContextFn?: graphQLAuthCreateContext) => ApolloServer;
export declare const installGraphQlSubscriptions: (graphQlServer: ApolloServer, server: Server) => void;
export declare const isAllowedUser: (user: User) => boolean;
export declare const ApplicationPubSub: PubSub;