Merge branch 'master' into as-integrate-fastify-plugin

This commit is contained in:
Aditya Pratap Singh 2018-11-14 07:45:56 +01:00 committed by GitHub
commit efb835b1cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 150 additions and 53 deletions

View file

@ -2,13 +2,28 @@
### vNEXT
- Fix mocks configuration to allow disabling of mocks by using `mocks: false`, even if `mockEntireSchema` is `true` [PR #1835](https://github.com/apollographql/apollo-server/pull/1835)
- Update `graphql-playground-html` to 1.7.8
### v2.2.2
- Fixed TypeScript 2.2 compatibility via updated `apollo-tooling` dependency. [Issue #1951](https://github.com/apollographql/apollo-server/issues/1951) [`26d6c739`](https://github.com/apollographql/apollo-server/commit/26d6c739505b3112694e641c272c748ce38ba86b)
- Throw a more specific error when asynchronous introspection query behavior is detected. [PR #1955](https://github.com/apollographql/apollo-server/pull/1955)
### v2.2.1
- Added support for an array of `modules` on the `ApolloServer` constructor options. Each element of the `modules` can point to a module which exports `typeDefs` and `resolvers`. These modules can be used in lieu of, or in combination with, directly specifying `schema` or `typeDefs`/`resolvers` on the constructor options. This provides greater modularity and improved organization for logic which might be limited to a specific service. [`8f6481e6`](https://github.com/apollographql/apollo-server/commit/8f6481e60f8418738f9ebbe9d5ab5e7e2ce4d319).
- Added `resolveObject` support to query execution. [`bb67584`](https://github.com/apollographql/apollo-server/commit/bb67584a224843a5b2509c2ebdd94e616fe6227c).
- Fix broken `apollo-server-cloud-functions` in 2.2.0 caused by missing TypeScript project references which resulted in the package not being published to npm in compiled form. [PR #1948](https://github.com/apollographql/apollo-server/pull/1948)
### v2.2.0
- New request pipeline, including support for plugins which can implement lifecycle hooks at various stages of a request. [PR #1795](https://github.com/apollographql/apollo-server/pull/1795).
- Introduce new `apollo-server-testing` utilities. [PR #1909](https://github.com/apollographql/apollo-server/pull/1909)
- Fix mocks configuration to allow disabling of mocks by using `mocks: false`, even if `mockEntireSchema` is `true`. [PR #1835](https://github.com/apollographql/apollo-server/pull/1835)
- Update `graphql-playground-html` to 1.7.8. [PR #1855](https://github.com/apollographql/apollo-server/pull/1855)
- Make Azure Functions support naming consistent with original [npm package](https://www.npmjs.com/package/apollo-server-azure-functions). [PR #1948](https://github.com/apollographql/apollo-server/pull/1948)
- Allow an optional function to resolve the `rootValue`, passing the `DocumentNode` AST to determine the value. [PR #1555](https://github.com/apollographql/apollo-server/pull/1555)
- Follow-up on the work in [PR #1516](https://github.com/apollographql/apollo-server/pull/1516) to also fix missing insertion cursor/caret when a custom GraphQL configuration is specified which doesn't specify its own `cursorShape` property. [PR #1607](https://github.com/apollographql/apollo-server/pull/1607)
- Azure functions support [Issue #1752](https://github.com/apollographql/apollo-server/issue/1752) [PR #1753](https://github.com/apollographql/apollo-server/pull/1753)
- Make Azure Functions support naming consistent with original [npm package](https://www.npmjs.com/package/apollo-server-azure-functions)
- Allow JSON parsing in `RESTDataSource` of Content Type `application/hal+json`. [PR ##185](https://github.com/apollographql/apollo-server/pull/1853)
- Allow JSON parsing in `RESTDataSource` of Content Type `application/hal+json`. [PR #185](https://github.com/apollographql/apollo-server/pull/1853)
- Add support for a `requestAgent` configuration parameter within the `engine` configuration. This can be utilized when a proxy is necessary to transmit tracing and metrics data to Apollo Engine. It accepts either an [`http.Agent`](https://nodejs.org/docs/latest-v8.x/api/http.html#http_class_http_agent) or [`https.Agent`](https://nodejs.org/docs/latest-v8.x/api/https.html#https_class_https_agent) and behaves the same as the `agent` parameter to Node.js' [`http.request`](https://nodejs.org/docs/latest-v8.x/api/http.html#http_http_request_options_callback). [PR #1879](https://github.com/apollographql/apollo-server/pull/1879)
### v2.1.0

83
package-lock.json generated
View file

@ -4,11 +4,11 @@
"lockfileVersion": 1,
"dependencies": {
"@apollographql/apollo-tools": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/@apollographql/apollo-tools/-/apollo-tools-0.2.3.tgz",
"integrity": "sha512-TO83pNR/i9JLLufjTH3THxLvQV5xC4P08g+iI3l1YU3ofPOvq2IkcxKCKXXJMgYe2DkixxT/5oN97wM7UuEbnQ==",
"version": "0.2.6",
"resolved": "https://registry.npmjs.org/@apollographql/apollo-tools/-/apollo-tools-0.2.6.tgz",
"integrity": "sha512-IKn35EzAHFQw4x8THux+fkVLkFNs8HDzIgKqcU5ZMfkDt3MOa1nfMbGVoVh2YdvpIjPtyUR3kvAAVQwmRPRjAQ==",
"requires": {
"apollo-env": "0.2.1"
"apollo-env": "0.2.3"
}
},
"@apollographql/apollo-upload-server": {
@ -1478,9 +1478,9 @@
}
},
"@types/node": {
"version": "10.12.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.5.tgz",
"integrity": "sha512-GzdHjq3t3eGLMv92Al90Iq+EoLL+86mPfQhuglbBFO7HiLdC/rkt+zrzJJumAiBF6nsrBWhou22rPW663AAyFw=="
"version": "10.12.6",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.6.tgz",
"integrity": "sha512-+ZWB5Ec1iki99xQFzBlivlKxSZQ+fuUKBott8StBOnLN4dWbRHlgdg1XknpW6g0tweniN5DcOqA64CJyOUPSAw=="
},
"@types/node-fetch": {
"version": "2.1.2",
@ -2071,9 +2071,9 @@
}
},
"apollo-env": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/apollo-env/-/apollo-env-0.2.1.tgz",
"integrity": "sha512-kZy6rCnSSoeEq/JEdLUYC8lqD9xppGrRfXrtLmmXgyzo2CXKu8FRfwVPJhxLdFLGAWcN7FVzfbUTtoQHcXPH7g==",
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/apollo-env/-/apollo-env-0.2.3.tgz",
"integrity": "sha512-7hRWPG8tWQNXCNrZsOMqxtkHGqhTzFgsw7RpFDyC1xgcZvVFCJvthWgWO07EhcaHhRqvrPxmicLnoTw2e/iCsA==",
"requires": {
"core-js": "^3.0.0-beta.3",
"node-fetch": "^2.2.0"
@ -2184,7 +2184,7 @@
"apollo-server-core": {
"version": "file:packages/apollo-server-core",
"requires": {
"@apollographql/apollo-tools": "^0.2.2",
"@apollographql/apollo-tools": "^0.2.6",
"@apollographql/apollo-upload-server": "^5.0.3",
"@apollographql/graphql-playground-html": "^1.6.4",
"@types/ws": "^6.0.0",
@ -6342,7 +6342,7 @@
"graphql-extensions": {
"version": "file:packages/graphql-extensions",
"requires": {
"@apollographql/apollo-tools": "^0.2.2"
"@apollographql/apollo-tools": "^0.2.6"
}
},
"graphql-subscriptions": {
@ -6963,13 +6963,13 @@
}
},
"husky": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/husky/-/husky-1.1.3.tgz",
"integrity": "sha512-6uc48B/A2Mqi65yeg37d/TPcTb0bZ1GTkMYOM0nXLOPuPaTRhXCeee80/noOrbavWd12x72Tusja7GJ5rzvV6g==",
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/husky/-/husky-1.1.4.tgz",
"integrity": "sha512-cZjGpS7qsaBSo3fOMUuR7erQloX3l5XzL1v/RkIqU6zrQImDdU70z5Re9fGDp7+kbYlM2EtS4aYMlahBeiCUGw==",
"dev": true,
"requires": {
"cosmiconfig": "^5.0.6",
"execa": "^0.9.0",
"execa": "^1.0.0",
"find-up": "^3.0.0",
"get-stdin": "^6.0.0",
"is-ci": "^1.2.1",
@ -6978,6 +6978,45 @@
"read-pkg": "^4.0.1",
"run-node": "^1.0.0",
"slash": "^2.0.0"
},
"dependencies": {
"cross-spawn": {
"version": "6.0.5",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
"integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
"dev": true,
"requires": {
"nice-try": "^1.0.4",
"path-key": "^2.0.1",
"semver": "^5.5.0",
"shebang-command": "^1.2.0",
"which": "^1.2.9"
}
},
"execa": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
"integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
"dev": true,
"requires": {
"cross-spawn": "^6.0.0",
"get-stream": "^4.0.0",
"is-stream": "^1.1.0",
"npm-run-path": "^2.0.0",
"p-finally": "^1.0.0",
"signal-exit": "^3.0.0",
"strip-eof": "^1.0.0"
}
},
"get-stream": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
"integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
"dev": true,
"requires": {
"pump": "^3.0.0"
}
}
}
},
"iconv-lite": {
@ -9893,9 +9932,9 @@
"dev": true
},
"node-fetch": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.2.1.tgz",
"integrity": "sha512-ObXBpNCD3A/vYQiQtEWl7DuqjAXjfptYFuGHLdPl5U19/6kJuZV+8uMHLrkj3wJrJoyfg4nhgyFixZdaZoAiEQ=="
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.3.0.tgz",
"integrity": "sha512-MOd8pV3fxENbryESLgVIeaGKrdl+uaYhCSSVkjeOb/31/njTpcis5aWfdqgNlHIrKOLRbMnfPINPOML2CIFeXA=="
},
"node-fetch-npm": {
"version": "2.0.2",
@ -12802,9 +12841,9 @@
"dev": true
},
"typescript": {
"version": "3.2.0-dev.20181110",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.2.0-dev.20181110.tgz",
"integrity": "sha512-s5t9wN6HVrp0Y3ueHL6ES9B3x/dO0XR8wztNuQeDSSR6Kueto/L3yziU8YLaOMCcFo53l+txZNtkUFO5FE/UNg==",
"version": "3.2.0-dev.20181113",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.2.0-dev.20181113.tgz",
"integrity": "sha512-OoyIVhVzYUT33UCQfr1iBfhpk6iF7qSCgtRU/klz5tpWfIjvsOH+2jILNQNzaSoz5l3ulXCQNeAxDy10zRhz6w==",
"dev": true
},
"uglify-js": {

View file

@ -34,7 +34,7 @@
"node": ">=6"
},
"dependencies": {
"@apollographql/apollo-tools": "^0.2.3",
"@apollographql/apollo-tools": "^0.2.6",
"apollo-cache-control": "file:packages/apollo-cache-control",
"apollo-datasource": "file:packages/apollo-datasource",
"apollo-datasource-rest": "file:packages/apollo-datasource-rest",
@ -79,7 +79,7 @@
"@types/memcached": "2.2.5",
"@types/micro": "7.3.3",
"@types/multer": "1.3.7",
"@types/node": "10.12.5",
"@types/node": "10.12.6",
"@types/node-fetch": "2.1.2",
"@types/redis": "2.8.7",
"@types/request": "2.48.1",
@ -103,7 +103,7 @@
"graphql-tag": "2.10.0",
"graphql-tools": "4.0.3",
"hapi": "17.7.0",
"husky": "1.1.3",
"husky": "1.1.4",
"jest": "23.6.0",
"jest-junit": "5.2.0",
"jest-matcher-utils": "23.6.0",
@ -116,7 +116,7 @@
"meteor-promise": "0.8.6",
"mock-req": "0.2.0",
"multer": "1.4.1",
"node-fetch": "2.2.1",
"node-fetch": "2.3.0",
"prettier": "1.15.2",
"prettier-check": "2.0.0",
"qs-middleware": "1.0.3",

View file

@ -1,6 +1,6 @@
{
"name": "apollo-cache-control",
"version": "0.3.1",
"version": "0.3.2",
"description": "A GraphQL extension for cache control",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",

View file

@ -1,6 +1,6 @@
{
"name": "apollo-engine-reporting",
"version": "0.1.1",
"version": "0.1.2",
"description": "Send reports about your GraphQL services to Apollo Engine",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",

View file

@ -19,6 +19,10 @@ import { EngineReportingOptions, GenerateClientInfo } from './agent';
import { defaultSignature } from './signature';
import { GraphQLRequestContext } from 'apollo-server-core/dist/requestPipelineAPI';
const clientNameHeaderKey = 'apollographql-client-name';
const clientReferenceIdHeaderKey = 'apollographql-client-reference-id';
const clientVersionHeaderKey = 'apollographql-client-version';
// EngineReportingExtension is the per-request GraphQLExtension which creates a
// trace (in protobuf Trace format) for a single request. When the request is
// done, it passes the Trace back to its associated EngineReportingAgent via the
@ -55,10 +59,32 @@ export class EngineReportingExtension<TContext = any>
this.nodes.set(responsePathAsString(undefined), root);
this.generateClientInfo =
options.generateClientInfo ||
// Default to using the clientInfo field of the request's extensions, when
// the ClientInfo fields are undefined, we send the empty string
(({ request }) =>
(request.extensions && request.extensions.clientInfo) || {});
// Default to using the `apollo-client-x` header fields if present.
// If none are present, fallback on the `clientInfo` query extension
// for backwards compatibility.
// The default value if neither header values nor query extension is
// set is the empty String for all fields (as per protobuf defaults)
(({ request }) => {
if (
request.http &&
request.http.headers &&
(request.http.headers.get(clientNameHeaderKey) ||
request.http.headers.get(clientVersionHeaderKey) ||
request.http.headers.get(clientReferenceIdHeaderKey))
) {
return {
clientName: request.http.headers.get(clientNameHeaderKey),
clientVersion: request.http.headers.get(clientVersionHeaderKey),
clientReferenceId: request.http.headers.get(
clientReferenceIdHeaderKey,
),
};
} else if (request.extensions && request.extensions.clientInfo) {
return request.extensions.clientInfo;
} else {
return {};
}
});
}
public requestDidStart(o: {

View file

@ -1,6 +1,6 @@
{
"name": "apollo-server-azure-functions",
"version": "2.2.1",
"version": "2.2.2",
"description": "Production-ready Node.js GraphQL server for Azure Functions",
"keywords": [
"GraphQL",

View file

@ -1,6 +1,6 @@
{
"name": "apollo-server-cloud-functions",
"version": "2.2.1",
"version": "2.2.2",
"description": "Production-ready Node.js GraphQL server for Google Cloud Functions",
"keywords": [
"GraphQL",

View file

@ -1,6 +1,6 @@
{
"name": "apollo-server-cloudflare",
"version": "2.2.1",
"version": "2.2.2",
"description": "Production-ready Node.js GraphQL server for Cloudflare workers",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View file

@ -1,6 +1,6 @@
{
"name": "apollo-server-core",
"version": "2.2.1",
"version": "2.2.2",
"description": "Core engine for Apollo GraphQL server",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@ -24,7 +24,7 @@
"node": ">=6"
},
"dependencies": {
"@apollographql/apollo-tools": "^0.2.2",
"@apollographql/apollo-tools": "^0.2.6",
"@apollographql/apollo-upload-server": "^5.0.3",
"@apollographql/graphql-playground-html": "^1.6.4",
"@types/ws": "^6.0.0",

View file

@ -10,6 +10,23 @@ export function generateSchemaHash(schema: GraphQLSchema): string {
const documentAST = parse(introspectionQuery);
const result = execute(schema, documentAST) as ExecutionResult;
// If the execution of an introspection query results in a then-able, it
// indicates that one or more of its resolvers is behaving in an asynchronous
// manner. This is not the expected behavior of a introspection query
// which does not have any asynchronous resolvers.
if (
result &&
typeof (result as PromiseLike<typeof result>).then === 'function'
) {
throw new Error(
[
'The introspection query is resolving asynchronously; execution of an introspection query is not expected to return a `Promise`.',
'',
'Wrapped type resolvers should maintain the existing execution dynamics of the resolvers they wrap (i.e. async vs sync) or introspection types should be excluded from wrapping by checking them with `graphql/type`s, `isIntrospectionType` predicate function prior to wrapping.',
].join('\n'),
);
}
if (!result || !result.data || !result.data.__schema) {
throw new Error('Unable to generate server introspection document.');
}

View file

@ -1,6 +1,6 @@
{
"name": "apollo-server-express",
"version": "2.2.1",
"version": "2.2.2",
"description": "Production-ready Node.js GraphQL server for Express and Connect",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View file

@ -1,6 +1,6 @@
{
"name": "apollo-server-hapi",
"version": "2.2.1",
"version": "2.2.2",
"description": "Production-ready Node.js GraphQL server for Hapi",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View file

@ -1,7 +1,7 @@
{
"name": "apollo-server-integration-testsuite",
"private": true,
"version": "2.2.1",
"version": "2.2.2",
"description": "Apollo Server Integrations testsuite",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View file

@ -1,6 +1,6 @@
{
"name": "apollo-server-koa",
"version": "2.2.1",
"version": "2.2.2",
"description": "Production-ready Node.js GraphQL server for Koa",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View file

@ -1,6 +1,6 @@
{
"name": "apollo-server-lambda",
"version": "2.2.1",
"version": "2.2.2",
"description": "Production-ready Node.js GraphQL server for AWS Lambda",
"keywords": [
"GraphQL",

View file

@ -1,6 +1,6 @@
{
"name": "apollo-server-micro",
"version": "2.2.1",
"version": "2.2.2",
"description": "Production-ready Node.js GraphQL server for Micro",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View file

@ -1,6 +1,6 @@
{
"name": "apollo-server-plugin-base",
"version": "0.1.1",
"version": "0.1.2",
"description": "Apollo Server plugin base classes",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View file

@ -1,6 +1,6 @@
{
"name": "apollo-server-testing",
"version": "2.2.1",
"version": "2.2.2",
"description": "Test utils for apollo-server",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View file

@ -1,6 +1,6 @@
{
"name": "apollo-server",
"version": "2.2.1",
"version": "2.2.2",
"description": "Production ready GraphQL Server",
"author": "opensource@apollographql.com",
"main": "dist/index.js",

View file

@ -1,6 +1,6 @@
{
"name": "apollo-tracing",
"version": "0.3.1",
"version": "0.3.2",
"description": "Collect and expose trace data for GraphQL requests",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",

View file

@ -1,6 +1,6 @@
{
"name": "graphql-extensions",
"version": "0.3.1",
"version": "0.3.2",
"description": "Add extensions to GraphQL servers",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@ -14,7 +14,7 @@
"node": ">=6.0"
},
"dependencies": {
"@apollographql/apollo-tools": "^0.2.2"
"@apollographql/apollo-tools": "^0.2.6"
},
"devDependencies": {
"apollo-server-core": "file:../apollo-server-core",