apollo-server-core
Advanced tools
Comparing version 1.3.4 to 1.3.5
import { GraphQLSchema, ValidationContext, GraphQLFieldResolver } from 'graphql'; | ||
import { LogFunction } from './runQuery'; | ||
import { CacheControlExtensionOptions } from 'apollo-cache-control'; | ||
export interface GraphQLServerOptions { | ||
export interface GraphQLServerOptions<TContext = any> { | ||
schema: GraphQLSchema; | ||
formatError?: Function; | ||
rootValue?: any; | ||
context?: any; | ||
context?: TContext; | ||
logFunction?: LogFunction; | ||
@@ -13,3 +13,3 @@ formatParams?: Function; | ||
formatResponse?: Function; | ||
fieldResolver?: GraphQLFieldResolver<any, any>; | ||
fieldResolver?: GraphQLFieldResolver<any, TContext>; | ||
debug?: boolean; | ||
@@ -16,0 +16,0 @@ tracing?: boolean; |
import { default as GraphQLOptions } from './graphqlOptions'; | ||
export interface HttpQueryRequest { | ||
method: string; | ||
query: string; | ||
query: Record<string, any>; | ||
options: GraphQLOptions | Function; | ||
@@ -6,0 +6,0 @@ } |
@@ -119,2 +119,5 @@ "use strict"; | ||
} | ||
else if (!query) { | ||
throw new HttpQueryError(400, 'Must provide query string.'); | ||
} | ||
if (!isQueryOperation(query, requestParams.operationName)) { | ||
@@ -121,0 +124,0 @@ throw new HttpQueryError(405, "GET supports only query operation", false, { |
{ | ||
"name": "apollo-server-core", | ||
"version": "1.3.4", | ||
"version": "1.3.5", | ||
"description": "Core engine for Apollo GraphQL server", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -25,7 +25,7 @@ import { | ||
*/ | ||
export interface GraphQLServerOptions { | ||
export interface GraphQLServerOptions<TContext = any> { | ||
schema: GraphQLSchema; | ||
formatError?: Function; | ||
rootValue?: any; | ||
context?: any; | ||
context?: TContext; | ||
logFunction?: LogFunction; | ||
@@ -35,3 +35,3 @@ formatParams?: Function; | ||
formatResponse?: Function; | ||
fieldResolver?: GraphQLFieldResolver<any, any>; | ||
fieldResolver?: GraphQLFieldResolver<any, TContext>; | ||
debug?: boolean; | ||
@@ -38,0 +38,0 @@ tracing?: boolean; |
@@ -16,3 +16,3 @@ import { | ||
method: string; | ||
query: string; | ||
query: Record<string, any>; | ||
options: GraphQLOptions | Function; | ||
@@ -109,2 +109,4 @@ } | ||
query = parse(query); | ||
} else if (!query) { | ||
throw new HttpQueryError(400, 'Must provide query string.'); | ||
} | ||
@@ -111,0 +113,0 @@ |
@@ -95,3 +95,3 @@ /* tslint:disable:no-unused-expression */ | ||
return runQuery({ schema, query: query }).then(res => { | ||
return expect(res.data).to.deep.equal(expected); | ||
expect(res.data).to.deep.equal(expected); | ||
}); | ||
@@ -104,3 +104,3 @@ }); | ||
return runQuery({ schema, query: query }).then(res => { | ||
return expect(res.data).to.deep.equal(expected); | ||
expect(res.data).to.deep.equal(expected); | ||
}); | ||
@@ -119,3 +119,3 @@ }); | ||
expect(res.errors.length).to.equal(1); | ||
return expect(res.errors[0].message).to.match(expected); | ||
expect(res.errors[0].message).to.match(expected); | ||
}); | ||
@@ -135,3 +135,3 @@ }); | ||
expect(logStub.callCount).to.equal(1); | ||
return expect(logStub.getCall(0).args[0]).to.match(expected); | ||
expect(logStub.getCall(0).args[0]).to.match(expected); | ||
}); | ||
@@ -149,3 +149,3 @@ }); | ||
logStub.restore(); | ||
return expect(logStub.callCount).to.equal(0); | ||
expect(logStub.callCount).to.equal(0); | ||
}); | ||
@@ -165,3 +165,3 @@ }); | ||
expect(res.errors.length).to.equal(1); | ||
return expect(res.errors[0].message).to.deep.equal(expected); | ||
expect(res.errors[0].message).to.deep.equal(expected); | ||
}); | ||
@@ -175,3 +175,3 @@ }); | ||
res => { | ||
return expect(res.data).to.deep.equal(expected); | ||
expect(res.data).to.deep.equal(expected); | ||
}, | ||
@@ -185,3 +185,3 @@ ); | ||
return runQuery({ schema, query: query, context: 'it still' }).then(res => { | ||
return expect(res.data).to.deep.equal(expected); | ||
expect(res.data).to.deep.equal(expected); | ||
}); | ||
@@ -203,3 +203,3 @@ }); | ||
expect(res.data).to.deep.equal(expected); | ||
return expect(res['extensions']).to.equal('it still'); | ||
expect(res['extensions']).to.equal('it still'); | ||
}); | ||
@@ -216,3 +216,3 @@ }); | ||
}).then(res => { | ||
return expect(res.data).to.deep.equal(expected); | ||
expect(res.data).to.deep.equal(expected); | ||
}); | ||
@@ -229,3 +229,3 @@ }); | ||
}).then(res => { | ||
return expect(res.errors[0].message).to.deep.equal(expected); | ||
expect(res.errors[0].message).to.deep.equal(expected); | ||
}); | ||
@@ -257,3 +257,3 @@ }); | ||
return runQuery({ schema, query: query, operationName: 'Q1' }).then(res => { | ||
return expect(res.data).to.deep.equal(expected); | ||
expect(res.data).to.deep.equal(expected); | ||
}); | ||
@@ -260,0 +260,0 @@ }); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58623
20
1336