mirror of
https://github.com/vale981/apollo-server
synced 2025-03-05 09:41:40 -05:00
clean up and move pieces around
This commit is contained in:
parent
5eb23d82c0
commit
68dec79529
53 changed files with 229 additions and 828 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "apollo-server-core",
|
||||
"version": "1.4.0-alpha.0",
|
||||
"version": "2.0.0",
|
||||
"description": "Core engine for Apollo GraphQL server",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
|
@ -27,20 +27,27 @@
|
|||
"devDependencies": {
|
||||
"@types/fibers": "0.0.30",
|
||||
"@types/graphql": "0.12.7",
|
||||
"@types/node": "^9.6.1",
|
||||
"@types/ws": "^4.0.2",
|
||||
"apollo-engine": "^1.0.6",
|
||||
"fibers": "1.0.15",
|
||||
"meteor-promise": "0.8.6",
|
||||
"typescript": "2.8.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"graphql": "^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0"
|
||||
"graphql": "^0.12.0 || ^0.13.0 || ^14.0.0"
|
||||
},
|
||||
"typings": "dist/index.d.ts",
|
||||
"typescript": {
|
||||
"definition": "dist/index.d.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"apollo-cache-control": "^0.1.0",
|
||||
"apollo-cache-control": "^0.1.1",
|
||||
"apollo-tracing": "^0.1.0",
|
||||
"graphql-extensions": "^0.0.x"
|
||||
"graphql-extensions": "^0.0.x",
|
||||
"graphql-subscriptions": "^0.5.8",
|
||||
"graphql-tools": "^2.23.1",
|
||||
"subscriptions-transport-ws": "^0.9.7",
|
||||
"ws": "^5.1.1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,37 +10,27 @@ import {
|
|||
ValidationContext,
|
||||
FieldDefinitionNode,
|
||||
} from 'graphql';
|
||||
import {
|
||||
internalFormatError,
|
||||
GraphQLOptions,
|
||||
LogFunction,
|
||||
} from 'apollo-server-core';
|
||||
import { ApolloEngine as Engine } from 'apollo-engine';
|
||||
import { CacheControlExtensionOptions } from 'apollo-cache-control';
|
||||
|
||||
import { ApolloEngine } from 'apollo-engine';
|
||||
import {
|
||||
SubscriptionServer,
|
||||
ExecutionParams,
|
||||
} from 'subscriptions-transport-ws';
|
||||
|
||||
import { CorsOptions } from 'cors';
|
||||
import { internalFormatError } from './errors';
|
||||
import { GraphQLServerOptions as GraphQLOptions } from './graphqlOptions';
|
||||
import { LogFunction } from './runQuery';
|
||||
|
||||
import {
|
||||
Config,
|
||||
ListenOptions,
|
||||
MiddlewareOptions,
|
||||
MiddlewareRegistrationOptions,
|
||||
RegistrationOptions,
|
||||
ServerInfo,
|
||||
Context,
|
||||
ContextFunction,
|
||||
} from './types';
|
||||
|
||||
// export { LogFunction, ValidationContext, GraphQLResolveInfo };
|
||||
|
||||
// taken from engine
|
||||
export function joinHostPort(host: string, port: number) {
|
||||
if (host.includes(':')) host = `[${host}]`;
|
||||
return `${host}:${port}`;
|
||||
}
|
||||
|
||||
const env = process.env.NODE_ENV;
|
||||
const isDev = env !== 'production' && env !== 'test';
|
||||
|
||||
|
@ -50,39 +40,30 @@ const NoIntrospection = (context: ValidationContext) => ({
|
|||
context.reportError(
|
||||
new GraphQLError(
|
||||
'GraphQL introspection is not allowed by Apollo Server, but the query containted __schema or __type. To enable introspection, pass introspection: true to ApolloServer in production',
|
||||
[node],
|
||||
),
|
||||
[node]
|
||||
)
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
export class ApolloServerBase<
|
||||
Server = HttpServer,
|
||||
Request = any,
|
||||
Cors = CorsOptions
|
||||
> {
|
||||
app?: Server;
|
||||
schema: GraphQLSchema;
|
||||
private context?: Context | ContextFunction;
|
||||
private engine?: Engine;
|
||||
private appCreated: boolean = false;
|
||||
private middlewareRegistered: boolean = false;
|
||||
private http?: HttpServer;
|
||||
private subscriptions?: any;
|
||||
private graphqlPath: string; //set in applyMiddleware
|
||||
private cors?: Cors;
|
||||
private engineEnabled: boolean = false;
|
||||
private requestOptions: Partial<GraphQLOptions<any>>;
|
||||
private disableTools: boolean = !isDev;
|
||||
export class ApolloServerBase<Request = RequestInit> {
|
||||
public subscriptions: Config<Request>['subscriptions'];
|
||||
public disableTools: boolean = !isDev;
|
||||
|
||||
constructor(config: Config<Server, Request, Cors>) {
|
||||
private schema: GraphQLSchema;
|
||||
private context?: Context | ContextFunction;
|
||||
private requestOptions: Partial<GraphQLOptions<any>>;
|
||||
private graphqlPath: string = '/graphql';
|
||||
private engine: ApolloEngine;
|
||||
private engineEnabled: boolean = false;
|
||||
|
||||
private http?: HttpServer;
|
||||
protected getHttp: () => HttpServer;
|
||||
|
||||
constructor(config: Config<Request>) {
|
||||
const {
|
||||
app,
|
||||
context,
|
||||
cors,
|
||||
engine,
|
||||
engineInRequestPath,
|
||||
resolvers,
|
||||
schema,
|
||||
schemaDirectives,
|
||||
|
@ -108,8 +89,7 @@ export class ApolloServerBase<
|
|||
|
||||
this.requestOptions = requestOptions;
|
||||
this.context = context;
|
||||
// XXX should we move this to the `start` call? This would make hot
|
||||
// reloading eaiser but may not be worth it?
|
||||
|
||||
this.schema = schema
|
||||
? schema
|
||||
: makeExecutableSchema({
|
||||
|
@ -121,111 +101,24 @@ export class ApolloServerBase<
|
|||
});
|
||||
|
||||
this.subscriptions = subscriptions;
|
||||
this.cors = cors;
|
||||
|
||||
if (app) {
|
||||
this.app = app;
|
||||
} else {
|
||||
this.app = this.createApp();
|
||||
this.appCreated = true;
|
||||
}
|
||||
|
||||
// only access this onces as its slower on node
|
||||
const { ENGINE_API_KEY, ENGINE_CONFIG } = process.env;
|
||||
if (engine === false && (ENGINE_API_KEY || ENGINE_CONFIG)) {
|
||||
console.warn(
|
||||
'engine is set to false when creating ApolloServer but either ENGINE_CONFIG or ENGINE_API_KEY was found in the environment',
|
||||
);
|
||||
}
|
||||
let ApolloEngine;
|
||||
if (engine) {
|
||||
// detect engine if it is set to true or has a config, and possibly load it
|
||||
try {
|
||||
ApolloEngine = require('apollo-engine').ApolloEngine;
|
||||
} catch (e) {
|
||||
console.warn(`ApolloServer was unable to load Apollo Engine yet engine was configured in the options when creating this ApolloServer? To fix this, run the following command:
|
||||
|
||||
npm install apollo-engine --save
|
||||
`);
|
||||
}
|
||||
|
||||
this.engine = new ApolloEngine(
|
||||
typeof engine === 'boolean' ? undefined : engine,
|
||||
);
|
||||
}
|
||||
|
||||
// XXX should this allow for header overrides from graphql-playground?
|
||||
if (this.engine || engineInRequestPath) this.engineEnabled = true;
|
||||
}
|
||||
|
||||
public applyMiddleware(opts: MiddlewareOptions = {}) {
|
||||
if (this.appCreated) {
|
||||
throw new Error(`It looks like server.applyMiddleware was called when "app" was not passed into ApolloServer. To use middleware, you need to create an ApolloServer from a variant package and pass in your app:
|
||||
|
||||
const { ApolloServer } = require('apollo-server/express');
|
||||
const express = require('express');
|
||||
|
||||
const app = express();
|
||||
const server = new ApolloServer({ app, resolvers, typeDefs });
|
||||
// then when you want to add the middleware
|
||||
server.applyMiddleware();
|
||||
// then start the server
|
||||
server.listen().then(({ url }) => {
|
||||
console.log(\`🚀 Server ready at \${url}\`);
|
||||
});
|
||||
|
||||
`);
|
||||
}
|
||||
|
||||
const registerOptions: MiddlewareRegistrationOptions<
|
||||
Server,
|
||||
Request,
|
||||
Cors
|
||||
> = {
|
||||
path: opts.path || '/graphql',
|
||||
cors: this.cors,
|
||||
subscriptions: true,
|
||||
...opts,
|
||||
gui: opts.gui && !this.disableTools,
|
||||
app: this.app,
|
||||
request: this.request.bind(this),
|
||||
};
|
||||
|
||||
this.graphqlPath = registerOptions.path;
|
||||
// this function can either mutate the app (normal)
|
||||
// or some frameworks may need to return a new one
|
||||
const possiblyNewServer = this.registerMiddleware(registerOptions);
|
||||
this.middlewareRegistered = true;
|
||||
if (possiblyNewServer) this.app = possiblyNewServer;
|
||||
public use({ getHttp, path }: RegistrationOptions) {
|
||||
// we need to delay when we actually get the http server
|
||||
// until we move into the listen function
|
||||
this.getHttp = getHttp;
|
||||
this.graphqlPath = path;
|
||||
}
|
||||
|
||||
public listen(opts: ListenOptions = {}): Promise<ServerInfo> {
|
||||
if (!this.appCreated && !this.middlewareRegistered) {
|
||||
throw new Error(
|
||||
`It looks like you are trying to run ApolloServer without applying the middleware. This error is thrown when using a variant of ApolloServer (i.e. require('apollo-server/variant')) and passing in a custom app. To fix this, before you call server.listen, you need to call server.applyMiddleware():
|
||||
|
||||
const app = express();
|
||||
const server = new ApolloServer({ app, resolvers, typeDefs });
|
||||
|
||||
// XXX this part is missing currently!
|
||||
server.applyMiddleware();
|
||||
|
||||
server.listen().then(({ url }) => {
|
||||
console.log(\`🚀 Server ready at \${url}\`);
|
||||
});
|
||||
|
||||
`,
|
||||
);
|
||||
}
|
||||
|
||||
this.http = this.getHttp();
|
||||
const options = {
|
||||
port: process.env.PORT || 4000,
|
||||
...opts,
|
||||
};
|
||||
|
||||
this.http = this.getHttpServer(this.app);
|
||||
if (this.subscriptions !== false) {
|
||||
const config =
|
||||
const config: any =
|
||||
this.subscriptions === true || typeof this.subscriptions === 'undefined'
|
||||
? {
|
||||
path: this.graphqlPath,
|
||||
|
@ -234,6 +127,8 @@ export class ApolloServerBase<
|
|||
this.createSubscriptionServer(this.http, config);
|
||||
}
|
||||
|
||||
if (opts.engine || opts.engineInRequestPath) this.createEngine(opts);
|
||||
|
||||
return new Promise((success, fail) => {
|
||||
if (this.engine) {
|
||||
this.engine.listen(
|
||||
|
@ -245,10 +140,10 @@ export class ApolloServerBase<
|
|||
() => {
|
||||
this.engine.engineListeningAddress.url = require('url').resolve(
|
||||
this.engine.engineListeningAddress.url,
|
||||
this.graphqlPath,
|
||||
this.graphqlPath
|
||||
);
|
||||
success(this.engine.engineListeningAddress);
|
||||
},
|
||||
}
|
||||
);
|
||||
this.engine.on('error', fail);
|
||||
return;
|
||||
|
@ -284,7 +179,7 @@ export class ApolloServerBase<
|
|||
});
|
||||
|
||||
success(la);
|
||||
},
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@ -330,18 +225,40 @@ export class ApolloServerBase<
|
|||
{
|
||||
server,
|
||||
path: this.graphqlPath,
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
async request(request: Request) {
|
||||
if (!this) {
|
||||
throw new Error(`It looks like you tried to call this.request but didn't bind it to the parent class. To fix this,
|
||||
when calling this.request, either call it using an error function, or bind it like so:
|
||||
|
||||
this.request.bind(this);
|
||||
`);
|
||||
private createEngine({ engineInRequestPath, engine }: ListenOptions) {
|
||||
// only access this onces as its slower on node
|
||||
const { ENGINE_API_KEY, ENGINE_CONFIG } = process.env;
|
||||
if (engine === false && (ENGINE_API_KEY || ENGINE_CONFIG)) {
|
||||
console.warn(
|
||||
'engine is set to false when creating ApolloServer but either ENGINE_CONFIG or ENGINE_API_KEY was found in the environment'
|
||||
);
|
||||
}
|
||||
let ApolloEngine;
|
||||
if (engine) {
|
||||
// detect engine if it is set to true or has a config, and possibly load it
|
||||
try {
|
||||
ApolloEngine = require('apollo-engine').ApolloEngine;
|
||||
} catch (e) {
|
||||
console.warn(`ApolloServer was unable to load Apollo Engine yet engine was configured in the options when creating this ApolloServer? To fix this, run the following command:
|
||||
|
||||
npm install apollo-engine --save
|
||||
`);
|
||||
}
|
||||
|
||||
this.engine = new ApolloEngine(
|
||||
typeof engine === 'boolean' ? undefined : engine
|
||||
);
|
||||
}
|
||||
|
||||
// XXX should this allow for header overrides from graphql-playground?
|
||||
if (this.engine || engineInRequestPath) this.engineEnabled = true;
|
||||
}
|
||||
|
||||
async request(request: Request) {
|
||||
let context: Context = this.context ? this.context : { request };
|
||||
|
||||
context =
|
||||
|
@ -360,38 +277,4 @@ when calling this.request, either call it using an error function, or bind it li
|
|||
...this.requestOptions,
|
||||
};
|
||||
}
|
||||
|
||||
createApp(): Server {
|
||||
//TODO add some comparison between variant and non-variant styles
|
||||
throw new Error(`It looks tried to create on an ApolloServer that is missing a server! This means that either you need to pass an external server when creating an ApolloServer, or use an ApolloServer variant that supports a default server:
|
||||
|
||||
const { ApolloServer } = require('apollo-server');
|
||||
// or for advanced use cases:
|
||||
const { ApolloServer } = require('apollo-server/express');
|
||||
|
||||
To see all supported servers and differences, check the docs at https://apollographql.com/docs/server
|
||||
|
||||
`);
|
||||
}
|
||||
|
||||
registerMiddleware(
|
||||
config: MiddlewareRegistrationOptions<Server, Request, Cors>,
|
||||
): Server | void {
|
||||
throw new Error(`It looks like you called server.applyMiddleware on an ApolloServer that is missing a server! Make sure you pass in an app when creating a server:
|
||||
|
||||
const { ApolloServer } = require('apollo-server/express');
|
||||
const express = require('express');
|
||||
|
||||
const app = express();
|
||||
const server = new ApolloServer({ app, typeDefs, resolvers });
|
||||
`);
|
||||
}
|
||||
|
||||
getHttpServer(app: Server): HttpServer {
|
||||
throw new Error(
|
||||
`It looks like you are trying to use ApolloServer but we couldn't find an http server from your framework. To fix this, please open an issue for you variant at the https://github.com/apollographql/apollo-server repo`,
|
||||
);
|
||||
}
|
||||
|
||||
closeApp(app: Server): Promise<void> | void {}
|
||||
}
|
|
@ -5,7 +5,6 @@ import {
|
|||
} from 'graphql';
|
||||
import { LogFunction } from './runQuery';
|
||||
import { GraphQLExtension } from 'graphql-extensions';
|
||||
import { CacheControlExtensionOptions } from 'apollo-cache-control';
|
||||
|
||||
/*
|
||||
* GraphQLServerOptions
|
||||
|
@ -34,7 +33,8 @@ export interface GraphQLServerOptions<TContext = any> {
|
|||
fieldResolver?: GraphQLFieldResolver<any, TContext>;
|
||||
debug?: boolean;
|
||||
tracing?: boolean;
|
||||
cacheControl?: boolean | CacheControlExtensionOptions;
|
||||
// cacheControl?: boolean | CacheControlExtensionOptions;
|
||||
cacheControl?: boolean | any;
|
||||
}
|
||||
|
||||
export default GraphQLServerOptions;
|
||||
|
|
|
@ -19,3 +19,7 @@ export {
|
|||
ForbiddenError,
|
||||
internalFormatError,
|
||||
} from './errors';
|
||||
|
||||
// ApolloServer Base class
|
||||
export { ApolloServerBase } from './ApolloServer';
|
||||
export * from './types';
|
||||
|
|
|
@ -18,10 +18,7 @@ import {
|
|||
GraphQLExtensionStack,
|
||||
} from 'graphql-extensions';
|
||||
import { TracingExtension } from 'apollo-tracing';
|
||||
import {
|
||||
CacheControlExtension,
|
||||
CacheControlExtensionOptions,
|
||||
} from 'apollo-cache-control';
|
||||
import { CacheControlExtension } from 'apollo-cache-control';
|
||||
|
||||
import {
|
||||
fromGraphQLError,
|
||||
|
@ -77,7 +74,8 @@ export interface QueryOptions {
|
|||
formatResponse?: Function;
|
||||
debug?: boolean;
|
||||
tracing?: boolean;
|
||||
cacheControl?: boolean | CacheControlExtensionOptions;
|
||||
// cacheControl?: boolean | CacheControlExtensionOptions;
|
||||
cacheControl?: boolean | any;
|
||||
}
|
||||
|
||||
export function runQuery(options: QueryOptions): Promise<GraphQLResponse> {
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import { GraphQLSchema } from 'graphql';
|
||||
import { CorsOptions } from 'cors';
|
||||
import { SchemaDirectiveVisitor, IResolvers } from 'graphql-tools';
|
||||
import { ConnectionContext } from 'subscriptions-transport-ws';
|
||||
import { GraphQLOptions } from 'apollo-server-core';
|
||||
export { CacheControlExtensionOptions } from 'apollo-cache-control';
|
||||
import { Server as HttpServer } from 'http';
|
||||
|
||||
import { GraphQLServerOptions as GraphQLOptions } from './graphqlOptions';
|
||||
|
||||
export type Context<T = any> = T;
|
||||
export type ContextFunction<T = any> = (
|
||||
context: Context<T>,
|
||||
context: Context<T>
|
||||
) => Promise<Context<T>>;
|
||||
|
||||
export interface SubscriptionServerOptions {
|
||||
|
@ -17,9 +17,9 @@ export interface SubscriptionServerOptions {
|
|||
keepAlive?: number;
|
||||
}
|
||||
|
||||
export interface Config<Server, ContextShape = any, Cors = CorsOptions>
|
||||
export interface Config<Server>
|
||||
extends Pick<
|
||||
GraphQLOptions<Context<ContextShape>>,
|
||||
GraphQLOptions<Context<any>>,
|
||||
| 'formatError'
|
||||
| 'debug'
|
||||
| 'rootValue'
|
||||
|
@ -32,16 +32,12 @@ export interface Config<Server, ContextShape = any, Cors = CorsOptions>
|
|||
| 'cacheControl'
|
||||
| 'tracing'
|
||||
> {
|
||||
app?: Server;
|
||||
typeDefs?: string | [string];
|
||||
resolvers?: IResolvers;
|
||||
schema?: GraphQLSchema;
|
||||
schemaDirectives: Record<string, typeof SchemaDirectiveVisitor>;
|
||||
context?: Context<ContextShape> | ContextFunction<ContextShape>;
|
||||
cors?: Cors;
|
||||
context?: Context<any> | ContextFunction<any>;
|
||||
subscriptions?: SubscriptionServerOptions | string | false;
|
||||
engineInRequestPath?: boolean;
|
||||
engine?: boolean | Object;
|
||||
enableIntrospection?: boolean;
|
||||
}
|
||||
|
||||
|
@ -62,6 +58,9 @@ export interface ListenOptions {
|
|||
path?: string;
|
||||
backlog?: number;
|
||||
exclusive?: boolean;
|
||||
// XXX clean this up
|
||||
engineInRequestPath?: boolean;
|
||||
engine?: boolean | Object;
|
||||
// engine launcher options
|
||||
engineLauncherOptions?: EngineLauncherOptions;
|
||||
// WebSocket options
|
||||
|
@ -69,7 +68,7 @@ export interface ListenOptions {
|
|||
onConnect?: (
|
||||
connectionParams: Object,
|
||||
websocket: WebSocket,
|
||||
context: ConnectionContext,
|
||||
context: ConnectionContext
|
||||
) => any;
|
||||
onDisconnect?: (websocket: WebSocket, context: ConnectionContext) => any;
|
||||
}
|
||||
|
@ -80,17 +79,10 @@ export interface MiddlewareOptions {
|
|||
subscriptions?: boolean;
|
||||
}
|
||||
|
||||
export interface MiddlewareRegistrationOptions<
|
||||
Server,
|
||||
Request,
|
||||
Cors = CorsOptions
|
||||
> {
|
||||
path?: string;
|
||||
gui?: boolean;
|
||||
subscriptions?: boolean;
|
||||
cors?: Cors;
|
||||
app: Server;
|
||||
request: (request: Request) => any;
|
||||
export interface RegistrationOptions {
|
||||
path: string;
|
||||
// subscriptions?: boolean;
|
||||
getHttp: () => HttpServer;
|
||||
}
|
||||
|
||||
export interface ServerInfo {
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "apollo-server-express",
|
||||
"version": "1.3.6",
|
||||
"version": "2.0.0",
|
||||
"description": "Production-ready Node.js GraphQL server for Express and Connect",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
|
@ -19,19 +19,25 @@
|
|||
"Connect",
|
||||
"Javascript"
|
||||
],
|
||||
"author": "Jonas Helfer <jonas@helfer.email>",
|
||||
"author": "opensource@apollographql.com",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/apollographql/apollo-server/issues"
|
||||
},
|
||||
"homepage": "https://github.com/apollographql/apollo-server#readme",
|
||||
"dependencies": {
|
||||
"apollo-server-core": "^1.3.6",
|
||||
"apollo-server-module-graphiql": "^1.3.4"
|
||||
"@types/accepts": "^1.3.5",
|
||||
"accepts": "^1.3.5",
|
||||
"apollo-server-core": "2.0.0",
|
||||
"apollo-server-module-graphiql": "^1.3.4",
|
||||
"body-parser": "^1.18.2",
|
||||
"cors": "^2.8.4",
|
||||
"graphql-playground-middleware-express": "^1.6.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/body-parser": "1.17.0",
|
||||
"@types/connect": "3.4.32",
|
||||
"@types/cors": "^2.8.4",
|
||||
"@types/express": "4.11.1",
|
||||
"@types/graphql": "0.12.7",
|
||||
"@types/multer": "1.3.6",
|
||||
|
|
48
packages/apollo-server-express/src/ApolloServer.ts
Normal file
48
packages/apollo-server-express/src/ApolloServer.ts
Normal file
|
@ -0,0 +1,48 @@
|
|||
import * as express from 'express';
|
||||
import * as corsMiddleware from 'cors';
|
||||
import { json } from 'body-parser';
|
||||
import { createServer, Server as HttpServer } from 'http';
|
||||
import gui from 'graphql-playground-middleware-express';
|
||||
import { ApolloServerBase } from 'apollo-server-core';
|
||||
import * as accepts from 'accepts';
|
||||
|
||||
import { graphqlExpress } from './expressApollo';
|
||||
|
||||
export interface ServerRegistration {
|
||||
app: express.Application;
|
||||
server: ApolloServerBase<express.Request>;
|
||||
path?: string;
|
||||
subscriptions?: boolean;
|
||||
cors?: corsMiddleware.CorsOptions;
|
||||
}
|
||||
|
||||
export const registerServer = async ({
|
||||
app,
|
||||
server,
|
||||
path,
|
||||
cors,
|
||||
}: ServerRegistration) => {
|
||||
// XXX multiple paths?
|
||||
server.use({ path, getHttp: () => createServer(app) });
|
||||
|
||||
app.use(path, corsMiddleware(cors), json(), (req, res, next) => {
|
||||
// make sure we check to see if graphql gui should be on
|
||||
if (!server.disableTools && req.method === 'GET') {
|
||||
//perform more expensive content-type check only if necessary
|
||||
const accept = accepts(req);
|
||||
const types = accept.types() as string[];
|
||||
const prefersHTML =
|
||||
types.find(
|
||||
(x: string) => x === 'text/html' || x === 'application/json',
|
||||
) === 'text/html';
|
||||
|
||||
if (prefersHTML) {
|
||||
return gui({
|
||||
endpoint: path,
|
||||
subscriptionsEndpoint: server.subscriptions && path,
|
||||
})(req, res, next);
|
||||
}
|
||||
}
|
||||
return graphqlExpress(server.request.bind(server))(req, res, next);
|
||||
});
|
||||
};
|
|
@ -20,3 +20,6 @@ export {
|
|||
|
||||
// Connect Middleware
|
||||
export { graphqlConnect, graphiqlConnect } from './connectApollo';
|
||||
|
||||
// ApolloServer integration
|
||||
export { registerServer } from './ApolloServer';
|
||||
|
|
|
@ -1,17 +1,12 @@
|
|||
{
|
||||
"name": "apollo-server",
|
||||
"private": true,
|
||||
"version": "2.0.0-beta.0",
|
||||
"version": "2.0.0",
|
||||
"description": "Production ready GraphQL Server",
|
||||
"author": "opensource@apollographql.com",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"compile": "rimraf dist && tsc",
|
||||
"deploy": "cd npm && npm publish --tag=beta",
|
||||
"postcompile": "rimraf npm && mkdir npm && cp -r dist/* npm/. && ./scripts/prepare-package.sh",
|
||||
"predeploy": "npm run compile",
|
||||
"prepublish": "npm run compile #for lerna bootstrap only",
|
||||
"publish": "echo '\n\nPlease use npm run deploy to publish apollo-server\n\n' && exit 1",
|
||||
"compile": "tsc",
|
||||
"prepublish": "npm run compile",
|
||||
"watch": "tsc -w"
|
||||
},
|
||||
"repository": {
|
||||
|
@ -30,21 +25,8 @@
|
|||
},
|
||||
"homepage": "https://github.com/apollographql/apollo-server#readme",
|
||||
"devDependencies": {
|
||||
"@koa/cors": "^2.2.1",
|
||||
"@types/accepts": "^1.3.5",
|
||||
"@types/cors": "^2.8.3",
|
||||
"@types/express": "^4.11.1",
|
||||
"@types/graphql": "^0.12.7",
|
||||
"@types/koa": "^2.0.45",
|
||||
"@types/koa-bodyparser": "^4.2.0",
|
||||
"@types/koa-router": "^7.0.27",
|
||||
"@types/koa__cors": "^2.2.2",
|
||||
"@types/node": "^9.6.1",
|
||||
"@types/react": "^16.3.8",
|
||||
"@types/ws": "^4.0.2",
|
||||
"apollo-cache-control": "^0.1.1",
|
||||
"apollo-engine": "^1.0.6",
|
||||
"rimraf": "^2.6.2",
|
||||
"@types/graphql": "^0.13.0",
|
||||
"typescript": "2.8.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
@ -52,20 +34,10 @@
|
|||
},
|
||||
"typings": "dist/index.d.ts",
|
||||
"dependencies": {
|
||||
"accepts": "^1.3.5",
|
||||
"apollo-server-core": "^1.4.0-alpha.0",
|
||||
"apollo-server-express": "^1.3.4",
|
||||
"apollo-server-koa": "^1.3.4",
|
||||
"body-parser": "^1.18.2",
|
||||
"cors": "^2.8.4",
|
||||
"apollo-server-core": "2.0.0",
|
||||
"apollo-server-express": "2.0.0",
|
||||
"express": "^4.16.3",
|
||||
"graphql-playground-middleware-express": "^1.6.1",
|
||||
"graphql-playground-middleware-koa": "^1.5.1",
|
||||
"graphql-subscriptions": "^0.5.8",
|
||||
"graphql-tools": "^2.23.1",
|
||||
"koa-bodyparser": "^4.2.0",
|
||||
"koa-router": "^7.4.0",
|
||||
"subscriptions-transport-ws": "^0.9.7",
|
||||
"ws": "^5.1.1"
|
||||
"graphql-tools": "^3.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
export * from 'graphql-tools';
|
||||
export * from 'graphql-subscriptions';
|
||||
export * from './types';
|
||||
// this makes it easy to get inline formatting and highlighting without
|
||||
// actually doing any work
|
||||
export const gql = String.raw;
|
||||
|
||||
export * from './errors';
|
||||
export {
|
||||
ApolloError,
|
||||
toApolloError,
|
||||
SyntaxError,
|
||||
ValidationError,
|
||||
AuthenticationError,
|
||||
ForbiddenError,
|
||||
} from 'apollo-server-core';
|
|
@ -1,36 +0,0 @@
|
|||
import * as express from 'express';
|
||||
import * as cors from 'cors';
|
||||
import { json } from 'body-parser';
|
||||
import { createServer, Server as HttpServer } from 'http';
|
||||
import { graphqlExpress } from 'apollo-server-express';
|
||||
import gui from 'graphql-playground-middleware-express';
|
||||
import * as accepts from 'accepts';
|
||||
|
||||
import { ApolloServerBase } from './utils/ApolloServer';
|
||||
import { MiddlewareRegistrationOptions } from './utils/types';
|
||||
import { launchGui } from './utils/launchGui';
|
||||
|
||||
export * from './utils/exports';
|
||||
|
||||
export class ApolloServer extends ApolloServerBase<
|
||||
express.Application,
|
||||
express.Request
|
||||
> {
|
||||
registerMiddleware(
|
||||
config: MiddlewareRegistrationOptions<express.Application, express.Request>,
|
||||
) {
|
||||
const { app, request } = config;
|
||||
config.path = config.path || '/graphql';
|
||||
|
||||
app.use(config.path, cors(config.cors), json(), (req, res, next) => {
|
||||
if (launchGui(config, req, gui, req, res, next)) {
|
||||
return;
|
||||
}
|
||||
return graphqlExpress(request)(req, res, next);
|
||||
});
|
||||
}
|
||||
|
||||
getHttpServer(app: express.Application): HttpServer {
|
||||
return createServer(app);
|
||||
}
|
||||
}
|
|
@ -1,66 +1,63 @@
|
|||
import * as express from 'express';
|
||||
import { registerServer } from 'apollo-server-express';
|
||||
|
||||
import { Config } from './utils/types';
|
||||
import {
|
||||
ApolloServerBase,
|
||||
ListenOptions,
|
||||
Config,
|
||||
ServerInfo,
|
||||
} from 'apollo-server-core';
|
||||
|
||||
export * from './utils/exports';
|
||||
export * from './utils/errors';
|
||||
export * from './exports';
|
||||
|
||||
import { ApolloServer as ExpressServer } from './express';
|
||||
export class ApolloServer extends ApolloServerBase<express.Request> {
|
||||
private disableHealthCheck: boolean = false;
|
||||
private onHealthCheck: (req: express.Request) => Promise<any>;
|
||||
|
||||
export class ApolloServer<Context> extends ExpressServer {
|
||||
constructor(
|
||||
opts: Config<express.Application, express.Request, Context> & {
|
||||
onHealthCheck: (req: express.Request) => Promise<any>;
|
||||
disableHealthCheck: boolean;
|
||||
},
|
||||
) {
|
||||
if (opts.app) {
|
||||
throw new Error(`It looks like "app" was passed into ApolloServer. To use a server with middleware, you need to create an ApolloServer from a variant package and pass in your app. This example uses express:
|
||||
|
||||
const { ApolloServer } = require('apollo-server/express');
|
||||
const express = require('express');
|
||||
|
||||
const app = express();
|
||||
// add your middleware
|
||||
|
||||
const server = new ApolloServer({ app, resolvers, typeDefs });
|
||||
// then when you want to add the apollo server middleware
|
||||
server.applyMiddleware();
|
||||
// then start the server
|
||||
server.listen().then(({ url }) => {
|
||||
console.log(\`🚀 Server ready at \${url}\`);
|
||||
});
|
||||
|
||||
`);
|
||||
}
|
||||
|
||||
opts.app = express();
|
||||
constructor({
|
||||
disableHealthCheck,
|
||||
onHealthCheck,
|
||||
...opts
|
||||
}: Config<express.Request> & {
|
||||
onHealthCheck: (req: express.Request) => Promise<any>;
|
||||
disableHealthCheck: boolean;
|
||||
}) {
|
||||
super(opts);
|
||||
if (disableHealthCheck) this.disableHealthCheck = true;
|
||||
this.onHealthCheck = onHealthCheck;
|
||||
}
|
||||
|
||||
if (!opts.disableHealthCheck) {
|
||||
//uses same path as engine
|
||||
opts.app.use('/.well-known/apollo/server-health', (req, res, next) => {
|
||||
//Response follows https://tools.ietf.org/html/draft-inadarei-api-health-check-01
|
||||
res.type('application/health+json');
|
||||
// here we overwrite the underlying listen to configure
|
||||
// the fallback / default server implementation
|
||||
async listen(opts: ListenOptions = {}): Promise<ServerInfo> {
|
||||
// we haven't configured a server yet so lets build the default one
|
||||
// using express
|
||||
if (!this.getHttp) {
|
||||
const app = express();
|
||||
|
||||
if (opts.onHealthCheck) {
|
||||
opts
|
||||
.onHealthCheck(req)
|
||||
.then(() => {
|
||||
res.json({ status: 'pass' });
|
||||
})
|
||||
.catch(() => {
|
||||
res.status(503).json({ status: 'fail' });
|
||||
});
|
||||
} else {
|
||||
res.json({ status: 'pass' });
|
||||
}
|
||||
});
|
||||
if (!this.disableHealthCheck) {
|
||||
//uses same path as engine
|
||||
app.use('/.well-known/apollo/server-health', (req, res, next) => {
|
||||
//Response follows https://tools.ietf.org/html/draft-inadarei-api-health-check-01
|
||||
res.type('application/health+json');
|
||||
|
||||
if (this.onHealthCheck) {
|
||||
this.onHealthCheck(req)
|
||||
.then(() => {
|
||||
res.json({ status: 'pass' });
|
||||
})
|
||||
.catch(() => {
|
||||
res.status(503).json({ status: 'fail' });
|
||||
});
|
||||
} else {
|
||||
res.json({ status: 'pass' });
|
||||
}
|
||||
});
|
||||
|
||||
await registerServer({ app, path: '/', server: this });
|
||||
}
|
||||
}
|
||||
|
||||
// when using ApolloServer without a server app passed in, we can assume it
|
||||
// will be only serving GraphQL, which can be provided at the root path to
|
||||
// support page refreshes well
|
||||
super.applyMiddleware({ path: '/' });
|
||||
return super.listen(opts);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
import * as koa from 'koa';
|
||||
import * as cors from '@koa/cors';
|
||||
import * as koaRouter from 'koa-router';
|
||||
import * as koaBody from 'koa-bodyparser';
|
||||
import * as accepts from 'accepts';
|
||||
|
||||
import { createServer, Server as HttpServer } from 'http';
|
||||
import { graphqlKoa } from 'apollo-server-koa';
|
||||
import gui from 'graphql-playground-middleware-koa';
|
||||
|
||||
import { ApolloServerBase } from './utils/ApolloServer';
|
||||
import { MiddlewareRegistrationOptions } from './utils/types';
|
||||
import { launchGui } from './utils/launchGui';
|
||||
|
||||
export * from './utils/exports';
|
||||
|
||||
export class ApolloServer extends ApolloServerBase<
|
||||
koa,
|
||||
koa.Context,
|
||||
cors.Options
|
||||
> {
|
||||
registerMiddleware(
|
||||
config: MiddlewareRegistrationOptions<koa, koa.Context, cors.Options>,
|
||||
) {
|
||||
const { app, request } = config;
|
||||
config.path = config.path || '/graphql';
|
||||
const router = new koaRouter();
|
||||
|
||||
router.use(config.path, cors(config.cors));
|
||||
router.use(config.path, koaBody());
|
||||
router.all(config.path, async (ctx, next) => {
|
||||
if (launchGui(config, ctx.req, gui, ctx, next)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return graphqlKoa(request)(ctx, next);
|
||||
});
|
||||
|
||||
app.use(router.routes());
|
||||
app.use(router.allowedMethods());
|
||||
}
|
||||
|
||||
getHttpServer(app: koa): HttpServer {
|
||||
return createServer(app.callback());
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
export {
|
||||
ApolloError,
|
||||
toApolloError,
|
||||
SyntaxError,
|
||||
ValidationError,
|
||||
AuthenticationError,
|
||||
ForbiddenError,
|
||||
} from 'apollo-server-core';
|
|
@ -1,31 +0,0 @@
|
|||
import * as accepts from 'accepts';
|
||||
import { IncomingMessage } from 'http';
|
||||
import { GraphQLOptions } from 'apollo-server-core';
|
||||
import { MiddlewareRegistrationOptions } from './types';
|
||||
|
||||
export function launchGui<C = any, GUI = any>(
|
||||
config: MiddlewareRegistrationOptions<any, any, any>,
|
||||
req: IncomingMessage,
|
||||
gui: (options: GraphQLOptions | any) => any | GUI,
|
||||
...args: any[]
|
||||
): boolean {
|
||||
// make sure we check to see if graphql gui should be on
|
||||
if (config.gui !== false && req.method === 'GET') {
|
||||
//perform more expensive content-type check only if necessary
|
||||
const accept = accepts(req);
|
||||
const types = accept.types() as string[];
|
||||
const prefersHTML =
|
||||
types.find(
|
||||
(x: string) => x === 'text/html' || x === 'application/json',
|
||||
) === 'text/html';
|
||||
|
||||
if (prefersHTML) {
|
||||
gui({
|
||||
endpoint: config.path,
|
||||
subscriptionsEndpoint: config.subscriptions && config.path,
|
||||
})(...args);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
The `graphql-server-core` package is now called [`apollo-server-core`](https://www.npmjs.com/package/apollo-server-core). We are continuing to release matching versions of the package under the old name, but we recommend you switch to using the new name. The API is identical.
|
|
@ -1,33 +0,0 @@
|
|||
{
|
||||
"name": "graphql-server-core",
|
||||
"version": "1.3.6",
|
||||
"description": "Core engine for Apollo GraphQL server",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"compile": "tsc",
|
||||
"prepublish": "npm run compile"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/apollographql/apollo-server/tree/master/packages/graphql-server-core"
|
||||
},
|
||||
"keywords": [
|
||||
"GraphQL",
|
||||
"Apollo",
|
||||
"Server",
|
||||
"Javascript"
|
||||
],
|
||||
"author": "Jonas Helfer <jonas@helfer.email>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/apollographql/apollo-server/issues"
|
||||
},
|
||||
"homepage": "https://github.com/apollographql/apollo-server#readme",
|
||||
"dependencies": {
|
||||
"apollo-server-core": "^1.3.6"
|
||||
},
|
||||
"typings": "dist/index.d.ts",
|
||||
"typescript": {
|
||||
"definition": "dist/index.d.ts"
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
export * from 'apollo-server-core';
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist"
|
||||
},
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
The `graphql-server-express` package is now called [`apollo-server-express`](https://www.npmjs.com/package/apollo-server-express). We are continuing to release matching versions of the package under the old name, but we recommend you switch to using the new name. The API is identical.
|
|
@ -1,35 +0,0 @@
|
|||
{
|
||||
"name": "graphql-server-express",
|
||||
"version": "1.3.6",
|
||||
"description": "Production-ready Node.js GraphQL server for Express and Connect",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"compile": "tsc",
|
||||
"prepublish": "npm run compile"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/apollographql/apollo-server/tree/master/packages/graphql-server-express"
|
||||
},
|
||||
"keywords": [
|
||||
"GraphQL",
|
||||
"Apollo",
|
||||
"Server",
|
||||
"Express",
|
||||
"Connect",
|
||||
"Javascript"
|
||||
],
|
||||
"author": "Jonas Helfer <jonas@helfer.email>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/apollographql/apollo-server/issues"
|
||||
},
|
||||
"homepage": "https://github.com/apollographql/apollo-server#readme",
|
||||
"dependencies": {
|
||||
"apollo-server-express": "^1.3.6"
|
||||
},
|
||||
"typings": "dist/index.d.ts",
|
||||
"typescript": {
|
||||
"definition": "dist/index.d.ts"
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
export * from 'apollo-server-express';
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist"
|
||||
},
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
The `graphql-server-hapi` package is now called [`apollo-server-hapi`](https://www.npmjs.com/package/apollo-server-hapi). We are continuing to release matching versions of the package under the old name, but we recommend you switch to using the new name. The API is identical.
|
|
@ -1,34 +0,0 @@
|
|||
{
|
||||
"name": "graphql-server-hapi",
|
||||
"version": "1.3.6",
|
||||
"description": "Production-ready Node.js GraphQL server for Hapi",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"compile": "tsc",
|
||||
"prepublish": "npm run compile"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/apollographql/apollo-server/tree/master/packages/graphql-server-hapi"
|
||||
},
|
||||
"keywords": [
|
||||
"GraphQL",
|
||||
"Apollo",
|
||||
"Hapi",
|
||||
"Server",
|
||||
"Javascript"
|
||||
],
|
||||
"author": "Jonas Helfer <jonas@helfer.email>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/apollographql/apollo-server/issues"
|
||||
},
|
||||
"homepage": "https://github.com/apollographql/apollo-server#readme",
|
||||
"dependencies": {
|
||||
"apollo-server-hapi": "^1.3.6"
|
||||
},
|
||||
"typings": "dist/index.d.ts",
|
||||
"typescript": {
|
||||
"definition": "dist/index.d.ts"
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
export * from 'apollo-server-hapi';
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist"
|
||||
},
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
The `graphql-server-koa` package is now called [`apollo-server-koa`](https://www.npmjs.com/package/apollo-server-koa). We are continuing to release matching versions of the package under the old name, but we recommend you switch to using the new name. The API is identical.
|
|
@ -1,34 +0,0 @@
|
|||
{
|
||||
"name": "graphql-server-koa",
|
||||
"version": "1.3.6",
|
||||
"description": "Production-ready Node.js GraphQL server for Koa",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"compile": "tsc",
|
||||
"prepublish": "npm run compile"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/apollographql/apollo-server/tree/master/packages/graphql-server-koa"
|
||||
},
|
||||
"keywords": [
|
||||
"GraphQL",
|
||||
"Apollo",
|
||||
"Koa",
|
||||
"Server",
|
||||
"Javascript"
|
||||
],
|
||||
"author": "Jonas Helfer <jonas@helfer.email>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/apollographql/apollo-server/issues"
|
||||
},
|
||||
"homepage": "https://github.com/apollographql/apollo-server#readme",
|
||||
"dependencies": {
|
||||
"apollo-server-koa": "^1.3.6"
|
||||
},
|
||||
"typings": "dist/index.d.ts",
|
||||
"typescript": {
|
||||
"definition": "dist/index.d.ts"
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
export * from 'apollo-server-koa';
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist"
|
||||
},
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
The `graphql-server-lambda` package is now called [`apollo-server-lambda`](https://www.npmjs.com/package/apollo-server-lambda). We are continuing to release matching versions of the package under the old name, but we recommend you switch to using the new name. The API is identical.
|
|
@ -1,34 +0,0 @@
|
|||
{
|
||||
"name": "graphql-server-lambda",
|
||||
"version": "1.3.6",
|
||||
"description": "Production-ready Node.js GraphQL server for AWS Lambda",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"compile": "tsc",
|
||||
"prepublish": "npm run compile"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/apollographql/apollo-server/tree/master/packages/graphql-server-lambda"
|
||||
},
|
||||
"keywords": [
|
||||
"GraphQL",
|
||||
"Apollo",
|
||||
"Server",
|
||||
"Lambda",
|
||||
"Javascript"
|
||||
],
|
||||
"author": "Jonas Helfer <jonas@helfer.email>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/apollographql/apollo-server/issues"
|
||||
},
|
||||
"homepage": "https://github.com/apollographql/apollo-server#readme",
|
||||
"dependencies": {
|
||||
"apollo-server-lambda": "^1.3.6"
|
||||
},
|
||||
"typings": "dist/index.d.ts",
|
||||
"typescript": {
|
||||
"definition": "dist/index.d.ts"
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
export * from 'apollo-server-lambda';
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist"
|
||||
},
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
The `graphql-server-micro` package is now called [`apollo-server-micro`](https://www.npmjs.com/package/apollo-server-micro). We are continuing to release matching versions of the package under the old name, but we recommend you switch to using the new name. The API is identical.
|
|
@ -1,34 +0,0 @@
|
|||
{
|
||||
"name": "graphql-server-micro",
|
||||
"version": "1.3.6",
|
||||
"description": "Production-ready Node.js GraphQL server for Micro",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"compile": "tsc",
|
||||
"prepublish": "npm run compile"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/apollographql/apollo-server/tree/master/packages/graphql-server-micro"
|
||||
},
|
||||
"keywords": [
|
||||
"GraphQL",
|
||||
"Apollo",
|
||||
"Micro",
|
||||
"Server",
|
||||
"Javascript"
|
||||
],
|
||||
"author": "Nick Nance <nance.nick@gmail.email>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/apollographql/apollo-server/issues"
|
||||
},
|
||||
"homepage": "https://github.com/apollographql/apollo-server#readme",
|
||||
"dependencies": {
|
||||
"apollo-server-micro": "^1.3.6"
|
||||
},
|
||||
"typings": "dist/index.d.ts",
|
||||
"typescript": {
|
||||
"definition": "dist/index.d.ts"
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
export * from 'apollo-server-micro';
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist"
|
||||
},
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
The `graphql-server-module-graphiql` package is now called [`apollo-server-module-graphiql`](https://www.npmjs.com/package/apollo-server-module-graphiql). We are continuing to release matching versions of the package under the old name, but we recommend you switch to using the new name. The API is identical.
|
|
@ -1,33 +0,0 @@
|
|||
{
|
||||
"name": "graphql-server-module-graphiql",
|
||||
"version": "1.3.4",
|
||||
"description": "GraphiQL renderer for Apollo GraphQL Server",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"compile": "tsc",
|
||||
"prepublish": "npm run compile"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/apollographql/apollo-server/tree/master/packages/graphql-server-module-graphiql"
|
||||
},
|
||||
"keywords": [
|
||||
"GraphQL",
|
||||
"GraphiQL",
|
||||
"Apollo",
|
||||
"Javascript"
|
||||
],
|
||||
"author": "Jonas Helfer <jonas@helfer.email>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/apollographql/apollo-server/issues"
|
||||
},
|
||||
"homepage": "https://github.com/apollographql/apollo-server#readme",
|
||||
"dependencies": {
|
||||
"apollo-server-module-graphiql": "^1.3.4"
|
||||
},
|
||||
"typings": "dist/index.d.ts",
|
||||
"typescript": {
|
||||
"definition": "dist/index.d.ts"
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
export * from 'apollo-server-module-graphiql';
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist"
|
||||
},
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
The `graphql-server-module-operation-store` package is now called [`apollo-server-module-operation-store`](https://www.npmjs.com/package/apollo-server-module-operation-store). We are continuing to release matching versions of the package under the old name, but we recommend you switch to using the new name. The API is identical.
|
|
@ -1,33 +0,0 @@
|
|||
{
|
||||
"name": "graphql-server-module-operation-store",
|
||||
"version": "1.3.5",
|
||||
"description": "Persisted operation store module for Apollo GraphQL Servers",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"compile": "tsc",
|
||||
"prepublish": "npm run compile"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/apollographql/apollo-server/tree/master/packages/graphql-server-module-operation-store"
|
||||
},
|
||||
"keywords": [
|
||||
"GraphQL",
|
||||
"Apollo",
|
||||
"Operation Store",
|
||||
"Javascript"
|
||||
],
|
||||
"author": "Jonas Helfer <jonas@helfer.email>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/apollographql/apollo-server/issues"
|
||||
},
|
||||
"homepage": "https://github.com/apollographql/apollo-server#readme",
|
||||
"dependencies": {
|
||||
"apollo-server-module-operation-store": "^1.3.5"
|
||||
},
|
||||
"typings": "dist/index.d.ts",
|
||||
"typescript": {
|
||||
"definition": "dist/index.d.ts"
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
export * from 'apollo-server-module-operation-store';
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist"
|
||||
},
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
The `graphql-server-restify` package is now called [`apollo-server-restify`](https://www.npmjs.com/package/apollo-server-restify). We are continuing to release matching versions of the package under the old name, but we recommend you switch to using the new name. The API is identical.
|
|
@ -1,34 +0,0 @@
|
|||
{
|
||||
"name": "graphql-server-restify",
|
||||
"version": "1.3.6",
|
||||
"description": "Production-ready Node.js GraphQL server for Restify",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"compile": "tsc",
|
||||
"prepublish": "npm run compile"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/apollographql/apollo-server/tree/master/packages/graphql-server-restify"
|
||||
},
|
||||
"keywords": [
|
||||
"GraphQL",
|
||||
"Apollo",
|
||||
"Server",
|
||||
"Restify",
|
||||
"Javascript"
|
||||
],
|
||||
"author": "Jonas Helfer <jonas@helfer.email>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/apollographql/apollo-server/issues"
|
||||
},
|
||||
"homepage": "https://github.com/apollographql/apollo-server#readme",
|
||||
"dependencies": {
|
||||
"apollo-server-restify": "^1.3.6"
|
||||
},
|
||||
"typings": "dist/index.d.ts",
|
||||
"typescript": {
|
||||
"definition": "dist/index.d.ts"
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
export * from 'apollo-server-restify';
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist"
|
||||
},
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -9,7 +9,7 @@
|
|||
"allowSyntheticDefaultImports": false,
|
||||
"pretty": true,
|
||||
"removeComments": true,
|
||||
"lib": ["es6", "esnext.asynciterable"],
|
||||
"lib": ["dom", "es6", "esnext.asynciterable"],
|
||||
"types": ["@types/node"]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue