diff --git a/CHANGELOG.md b/CHANGELOG.md index d82ba35e11c..6b4eac9efc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### vNEXT +- Fix [#1419](https://github.com/apollographql/apollo-server/issues/1419), [#1703](https://github.com/apollographql/apollo-server/issues/1703) file upload using lambda. [PR #1739](https://github.com/apollographql/apollo-server/pull/1739) - 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) diff --git a/packages/apollo-server-lambda/package-lock.json b/packages/apollo-server-lambda/package-lock.json new file mode 100644 index 00000000000..632e68b912c --- /dev/null +++ b/packages/apollo-server-lambda/package-lock.json @@ -0,0 +1,1927 @@ +{ + "name": "apollo-server-lambda", + "version": "2.1.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@apollographql/apollo-upload-server": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/@apollographql/apollo-upload-server/-/apollo-upload-server-5.0.3.tgz", + "integrity": "sha512-tGAp3ULNyoA8b5o9LsU2Lq6SwgVPUOKAqKywu2liEtTvrFSGPrObwanhYwArq3GPeOqp2bi+JknSJCIU3oQN1Q==", + "requires": { + "@babel/runtime-corejs2": "^7.0.0-rc.1", + "busboy": "^0.2.14", + "object-path": "^0.11.4" + } + }, + "@apollographql/graphql-playground-html": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@apollographql/graphql-playground-html/-/graphql-playground-html-1.6.0.tgz", + "integrity": "sha512-QAZIFrfVRkjvMkUHIQKZXZ3La0V5t12w5PWrhihYEabHwzIZV/txQd/kSYHgYPXC4s5OURxsXZop9f0BzI2QIQ==" + }, + "@babel/runtime-corejs2": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/@babel/runtime-corejs2/-/runtime-corejs2-7.1.2.tgz", + "integrity": "sha512-drxaPByExlcRDKW4ZLubUO4ZkI8/8ax9k9wve1aEthdLKFzjB7XRkOQ0xoTIWGxqdDnWDElkjYq77bt7yrcYJQ==", + "requires": { + "core-js": "^2.5.7", + "regenerator-runtime": "^0.12.0" + } + }, + "apollo-link": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/apollo-link/-/apollo-link-1.2.3.tgz", + "integrity": "sha512-iL9yS2OfxYhigme5bpTbmRyC+Htt6tyo2fRMHT3K1XRL/C5IQDDz37OjpPy4ndx7WInSvfSZaaOTKFja9VWqSw==", + "requires": { + "apollo-utilities": "^1.0.0", + "zen-observable-ts": "^0.8.10" + } + }, + "apollo-server-core": { + "version": "file:../apollo-server-core", + "requires": { + "@apollographql/apollo-upload-server": "^5.0.3", + "@types/ws": "^5.1.2", + "apollo-cache-control": "file:../apollo-cache-control", + "apollo-datasource": "file:../apollo-datasource", + "apollo-engine-reporting": "file:../apollo-engine-reporting", + "apollo-server-caching": "file:../apollo-server-caching", + "apollo-server-env": "file:../apollo-server-env", + "apollo-server-errors": "file:../apollo-server-errors", + "apollo-tracing": "file:../apollo-tracing", + "graphql-extensions": "file:../graphql-extensions", + "graphql-subscriptions": "^0.5.8", + "graphql-tag": "^2.9.2", + "graphql-tools": "^3.0.4", + "hash.js": "^1.1.3", + "lodash": "^4.17.10", + "subscriptions-transport-ws": "^0.9.11", + "ws": "^5.2.0" + }, + "dependencies": { + "@apollographql/apollo-upload-server": { + "version": "5.0.3", + "bundled": true, + "requires": { + "@babel/runtime-corejs2": "^7.0.0-rc.1", + "busboy": "^0.2.14", + "object-path": "^0.11.4" + } + }, + "@babel/runtime-corejs2": { + "version": "7.1.2", + "bundled": true, + "requires": { + "core-js": "^2.5.7", + "regenerator-runtime": "^0.12.0" + } + }, + "@types/events": { + "version": "1.2.0", + "bundled": true + }, + "@types/node": { + "version": "10.11.3", + "bundled": true + }, + "@types/ws": { + "version": "5.1.2", + "bundled": true, + "requires": { + "@types/events": "*", + "@types/node": "*" + } + }, + "apollo-cache-control": { + "version": "file:../apollo-cache-control", + "bundled": true, + "requires": { + "apollo-server-env": "file:../apollo-server-env", + "graphql-extensions": "file:../graphql-extensions" + }, + "dependencies": { + "apollo-server-env": { + "version": "file:../apollo-server-env", + "bundled": true, + "requires": { + "node-fetch": "^2.1.2", + "util.promisify": "^1.0.0" + }, + "dependencies": { + "define-properties": { + "version": "1.1.3", + "bundled": true, + "requires": { + "object-keys": "^1.0.12" + } + }, + "es-abstract": { + "version": "1.12.0", + "bundled": true, + "requires": { + "es-to-primitive": "^1.1.1", + "function-bind": "^1.1.1", + "has": "^1.0.1", + "is-callable": "^1.1.3", + "is-regex": "^1.0.4" + } + }, + "es-to-primitive": { + "version": "1.2.0", + "bundled": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "function-bind": { + "version": "1.1.1", + "bundled": true + }, + "has": { + "version": "1.0.3", + "bundled": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-symbols": { + "version": "1.0.0", + "bundled": true + }, + "is-callable": { + "version": "1.1.4", + "bundled": true + }, + "is-date-object": { + "version": "1.0.1", + "bundled": true + }, + "is-regex": { + "version": "1.0.4", + "bundled": true, + "requires": { + "has": "^1.0.1" + } + }, + "is-symbol": { + "version": "1.0.2", + "bundled": true, + "requires": { + "has-symbols": "^1.0.0" + } + }, + "node-fetch": { + "version": "2.2.0", + "bundled": true + }, + "object-keys": { + "version": "1.0.12", + "bundled": true + }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "bundled": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.1" + } + }, + "util.promisify": { + "version": "1.0.0", + "bundled": true, + "requires": { + "define-properties": "^1.1.2", + "object.getownpropertydescriptors": "^2.0.3" + } + } + } + }, + "graphql-extensions": { + "version": "file:../graphql-extensions", + "bundled": true, + "requires": { + "apollo-server-env": "file:../apollo-server-env" + }, + "dependencies": { + "apollo-server-env": { + "version": "file:../apollo-server-env", + "bundled": true, + "requires": { + "node-fetch": "^2.1.2", + "util.promisify": "^1.0.0" + }, + "dependencies": { + "define-properties": { + "version": "1.1.3", + "bundled": true, + "requires": { + "object-keys": "^1.0.12" + } + }, + "es-abstract": { + "version": "1.12.0", + "bundled": true, + "requires": { + "es-to-primitive": "^1.1.1", + "function-bind": "^1.1.1", + "has": "^1.0.1", + "is-callable": "^1.1.3", + "is-regex": "^1.0.4" + } + }, + "es-to-primitive": { + "version": "1.2.0", + "bundled": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "function-bind": { + "version": "1.1.1", + "bundled": true + }, + "has": { + "version": "1.0.3", + "bundled": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-symbols": { + "version": "1.0.0", + "bundled": true + }, + "is-callable": { + "version": "1.1.4", + "bundled": true + }, + "is-date-object": { + "version": "1.0.1", + "bundled": true + }, + "is-regex": { + "version": "1.0.4", + "bundled": true, + "requires": { + "has": "^1.0.1" + } + }, + "is-symbol": { + "version": "1.0.2", + "bundled": true, + "requires": { + "has-symbols": "^1.0.0" + } + }, + "node-fetch": { + "version": "2.2.0", + "bundled": true + }, + "object-keys": { + "version": "1.0.12", + "bundled": true + }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "bundled": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.1" + } + }, + "util.promisify": { + "version": "1.0.0", + "bundled": true, + "requires": { + "define-properties": "^1.1.2", + "object.getownpropertydescriptors": "^2.0.3" + } + } + } + } + } + } + } + }, + "apollo-datasource": { + "version": "file:../apollo-datasource", + "bundled": true, + "requires": { + "apollo-server-caching": "file:../apollo-server-caching", + "apollo-server-env": "file:../apollo-server-env" + }, + "dependencies": { + "apollo-server-caching": { + "version": "file:../apollo-server-caching", + "bundled": true, + "requires": { + "lru-cache": "^4.1.3" + }, + "dependencies": { + "lru-cache": { + "version": "4.1.3", + "bundled": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "pseudomap": { + "version": "1.0.2", + "bundled": true + }, + "yallist": { + "version": "2.1.2", + "bundled": true + } + } + }, + "apollo-server-env": { + "version": "file:../apollo-server-env", + "bundled": true, + "requires": { + "node-fetch": "^2.1.2", + "util.promisify": "^1.0.0" + }, + "dependencies": { + "define-properties": { + "version": "1.1.3", + "bundled": true, + "requires": { + "object-keys": "^1.0.12" + } + }, + "es-abstract": { + "version": "1.12.0", + "bundled": true, + "requires": { + "es-to-primitive": "^1.1.1", + "function-bind": "^1.1.1", + "has": "^1.0.1", + "is-callable": "^1.1.3", + "is-regex": "^1.0.4" + } + }, + "es-to-primitive": { + "version": "1.2.0", + "bundled": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "function-bind": { + "version": "1.1.1", + "bundled": true + }, + "has": { + "version": "1.0.3", + "bundled": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-symbols": { + "version": "1.0.0", + "bundled": true + }, + "is-callable": { + "version": "1.1.4", + "bundled": true + }, + "is-date-object": { + "version": "1.0.1", + "bundled": true + }, + "is-regex": { + "version": "1.0.4", + "bundled": true, + "requires": { + "has": "^1.0.1" + } + }, + "is-symbol": { + "version": "1.0.2", + "bundled": true, + "requires": { + "has-symbols": "^1.0.0" + } + }, + "node-fetch": { + "version": "2.2.0", + "bundled": true + }, + "object-keys": { + "version": "1.0.12", + "bundled": true + }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "bundled": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.1" + } + }, + "util.promisify": { + "version": "1.0.0", + "bundled": true, + "requires": { + "define-properties": "^1.1.2", + "object.getownpropertydescriptors": "^2.0.3" + } + } + } + } + } + }, + "apollo-engine-reporting": { + "version": "file:../apollo-engine-reporting", + "bundled": true, + "requires": { + "apollo-engine-reporting-protobuf": "file:../apollo-engine-reporting-protobuf", + "apollo-server-env": "file:../apollo-server-env", + "async-retry": "^1.2.1", + "graphql-extensions": "file:../graphql-extensions", + "lodash": "^4.17.10" + }, + "dependencies": { + "apollo-engine-reporting-protobuf": { + "version": "file:../apollo-engine-reporting-protobuf", + "bundled": true, + "requires": { + "protobufjs": "^6.8.6" + }, + "dependencies": { + "@protobufjs/aspromise": { + "version": "1.1.2", + "bundled": true + }, + "@protobufjs/base64": { + "version": "1.1.2", + "bundled": true + }, + "@protobufjs/codegen": { + "version": "2.0.4", + "bundled": true + }, + "@protobufjs/eventemitter": { + "version": "1.1.0", + "bundled": true + }, + "@protobufjs/fetch": { + "version": "1.1.0", + "bundled": true, + "requires": { + "@protobufjs/aspromise": "^1.1.1", + "@protobufjs/inquire": "^1.1.0" + } + }, + "@protobufjs/float": { + "version": "1.0.2", + "bundled": true + }, + "@protobufjs/inquire": { + "version": "1.1.0", + "bundled": true + }, + "@protobufjs/path": { + "version": "1.1.2", + "bundled": true + }, + "@protobufjs/pool": { + "version": "1.1.0", + "bundled": true + }, + "@protobufjs/utf8": { + "version": "1.1.0", + "bundled": true + }, + "@types/long": { + "version": "4.0.0", + "bundled": true + }, + "@types/node": { + "version": "10.11.3", + "bundled": true + }, + "long": { + "version": "4.0.0", + "bundled": true + }, + "protobufjs": { + "version": "6.8.8", + "bundled": true, + "requires": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/long": "^4.0.0", + "@types/node": "^10.1.0", + "long": "^4.0.0" + } + } + } + }, + "apollo-server-env": { + "version": "file:../apollo-server-env", + "bundled": true, + "requires": { + "node-fetch": "^2.1.2", + "util.promisify": "^1.0.0" + }, + "dependencies": { + "define-properties": { + "version": "1.1.3", + "bundled": true, + "requires": { + "object-keys": "^1.0.12" + } + }, + "es-abstract": { + "version": "1.12.0", + "bundled": true, + "requires": { + "es-to-primitive": "^1.1.1", + "function-bind": "^1.1.1", + "has": "^1.0.1", + "is-callable": "^1.1.3", + "is-regex": "^1.0.4" + } + }, + "es-to-primitive": { + "version": "1.2.0", + "bundled": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "function-bind": { + "version": "1.1.1", + "bundled": true + }, + "has": { + "version": "1.0.3", + "bundled": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-symbols": { + "version": "1.0.0", + "bundled": true + }, + "is-callable": { + "version": "1.1.4", + "bundled": true + }, + "is-date-object": { + "version": "1.0.1", + "bundled": true + }, + "is-regex": { + "version": "1.0.4", + "bundled": true, + "requires": { + "has": "^1.0.1" + } + }, + "is-symbol": { + "version": "1.0.2", + "bundled": true, + "requires": { + "has-symbols": "^1.0.0" + } + }, + "node-fetch": { + "version": "2.2.0", + "bundled": true + }, + "object-keys": { + "version": "1.0.12", + "bundled": true + }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "bundled": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.1" + } + }, + "util.promisify": { + "version": "1.0.0", + "bundled": true, + "requires": { + "define-properties": "^1.1.2", + "object.getownpropertydescriptors": "^2.0.3" + } + } + } + }, + "async-retry": { + "version": "1.2.3", + "bundled": true, + "requires": { + "retry": "0.12.0" + } + }, + "graphql-extensions": { + "version": "file:../graphql-extensions", + "bundled": true, + "requires": { + "apollo-server-env": "file:../apollo-server-env" + }, + "dependencies": { + "apollo-server-env": { + "version": "file:../apollo-server-env", + "bundled": true, + "requires": { + "node-fetch": "^2.1.2", + "util.promisify": "^1.0.0" + }, + "dependencies": { + "define-properties": { + "version": "1.1.3", + "bundled": true, + "requires": { + "object-keys": "^1.0.12" + } + }, + "es-abstract": { + "version": "1.12.0", + "bundled": true, + "requires": { + "es-to-primitive": "^1.1.1", + "function-bind": "^1.1.1", + "has": "^1.0.1", + "is-callable": "^1.1.3", + "is-regex": "^1.0.4" + } + }, + "es-to-primitive": { + "version": "1.2.0", + "bundled": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "function-bind": { + "version": "1.1.1", + "bundled": true + }, + "has": { + "version": "1.0.3", + "bundled": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-symbols": { + "version": "1.0.0", + "bundled": true + }, + "is-callable": { + "version": "1.1.4", + "bundled": true + }, + "is-date-object": { + "version": "1.0.1", + "bundled": true + }, + "is-regex": { + "version": "1.0.4", + "bundled": true, + "requires": { + "has": "^1.0.1" + } + }, + "is-symbol": { + "version": "1.0.2", + "bundled": true, + "requires": { + "has-symbols": "^1.0.0" + } + }, + "node-fetch": { + "version": "2.2.0", + "bundled": true + }, + "object-keys": { + "version": "1.0.12", + "bundled": true + }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "bundled": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.1" + } + }, + "util.promisify": { + "version": "1.0.0", + "bundled": true, + "requires": { + "define-properties": "^1.1.2", + "object.getownpropertydescriptors": "^2.0.3" + } + } + } + } + } + }, + "lodash": { + "version": "4.17.11", + "bundled": true + }, + "retry": { + "version": "0.12.0", + "bundled": true + } + } + }, + "apollo-link": { + "version": "1.2.3", + "bundled": true, + "requires": { + "apollo-utilities": "^1.0.0", + "zen-observable-ts": "^0.8.10" + } + }, + "apollo-server-caching": { + "version": "file:../apollo-server-caching", + "bundled": true, + "requires": { + "lru-cache": "^4.1.3" + }, + "dependencies": { + "lru-cache": { + "version": "4.1.3", + "bundled": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "pseudomap": { + "version": "1.0.2", + "bundled": true + }, + "yallist": { + "version": "2.1.2", + "bundled": true + } + } + }, + "apollo-server-env": { + "version": "file:../apollo-server-env", + "bundled": true, + "requires": { + "node-fetch": "^2.1.2", + "util.promisify": "^1.0.0" + }, + "dependencies": { + "define-properties": { + "version": "1.1.3", + "bundled": true, + "requires": { + "object-keys": "^1.0.12" + } + }, + "es-abstract": { + "version": "1.12.0", + "bundled": true, + "requires": { + "es-to-primitive": "^1.1.1", + "function-bind": "^1.1.1", + "has": "^1.0.1", + "is-callable": "^1.1.3", + "is-regex": "^1.0.4" + } + }, + "es-to-primitive": { + "version": "1.2.0", + "bundled": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "function-bind": { + "version": "1.1.1", + "bundled": true + }, + "has": { + "version": "1.0.3", + "bundled": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-symbols": { + "version": "1.0.0", + "bundled": true + }, + "is-callable": { + "version": "1.1.4", + "bundled": true + }, + "is-date-object": { + "version": "1.0.1", + "bundled": true + }, + "is-regex": { + "version": "1.0.4", + "bundled": true, + "requires": { + "has": "^1.0.1" + } + }, + "is-symbol": { + "version": "1.0.2", + "bundled": true, + "requires": { + "has-symbols": "^1.0.0" + } + }, + "node-fetch": { + "version": "2.2.0", + "bundled": true + }, + "object-keys": { + "version": "1.0.12", + "bundled": true + }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "bundled": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.1" + } + }, + "util.promisify": { + "version": "1.0.0", + "bundled": true, + "requires": { + "define-properties": "^1.1.2", + "object.getownpropertydescriptors": "^2.0.3" + } + } + } + }, + "apollo-server-errors": { + "version": "file:../apollo-server-errors", + "bundled": true + }, + "apollo-tracing": { + "version": "file:../apollo-tracing", + "bundled": true, + "requires": { + "apollo-server-env": "file:../apollo-server-env", + "graphql-extensions": "file:../graphql-extensions" + }, + "dependencies": { + "apollo-server-env": { + "version": "file:../apollo-server-env", + "bundled": true, + "requires": { + "node-fetch": "^2.1.2", + "util.promisify": "^1.0.0" + }, + "dependencies": { + "define-properties": { + "version": "1.1.3", + "bundled": true, + "requires": { + "object-keys": "^1.0.12" + } + }, + "es-abstract": { + "version": "1.12.0", + "bundled": true, + "requires": { + "es-to-primitive": "^1.1.1", + "function-bind": "^1.1.1", + "has": "^1.0.1", + "is-callable": "^1.1.3", + "is-regex": "^1.0.4" + } + }, + "es-to-primitive": { + "version": "1.2.0", + "bundled": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "function-bind": { + "version": "1.1.1", + "bundled": true + }, + "has": { + "version": "1.0.3", + "bundled": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-symbols": { + "version": "1.0.0", + "bundled": true + }, + "is-callable": { + "version": "1.1.4", + "bundled": true + }, + "is-date-object": { + "version": "1.0.1", + "bundled": true + }, + "is-regex": { + "version": "1.0.4", + "bundled": true, + "requires": { + "has": "^1.0.1" + } + }, + "is-symbol": { + "version": "1.0.2", + "bundled": true, + "requires": { + "has-symbols": "^1.0.0" + } + }, + "node-fetch": { + "version": "2.2.0", + "bundled": true + }, + "object-keys": { + "version": "1.0.12", + "bundled": true + }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "bundled": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.1" + } + }, + "util.promisify": { + "version": "1.0.0", + "bundled": true, + "requires": { + "define-properties": "^1.1.2", + "object.getownpropertydescriptors": "^2.0.3" + } + } + } + }, + "graphql-extensions": { + "version": "file:../graphql-extensions", + "bundled": true, + "requires": { + "apollo-server-env": "file:../apollo-server-env" + }, + "dependencies": { + "apollo-server-env": { + "version": "file:../apollo-server-env", + "bundled": true, + "requires": { + "node-fetch": "^2.1.2", + "util.promisify": "^1.0.0" + }, + "dependencies": { + "define-properties": { + "version": "1.1.3", + "bundled": true, + "requires": { + "object-keys": "^1.0.12" + } + }, + "es-abstract": { + "version": "1.12.0", + "bundled": true, + "requires": { + "es-to-primitive": "^1.1.1", + "function-bind": "^1.1.1", + "has": "^1.0.1", + "is-callable": "^1.1.3", + "is-regex": "^1.0.4" + } + }, + "es-to-primitive": { + "version": "1.2.0", + "bundled": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "function-bind": { + "version": "1.1.1", + "bundled": true + }, + "has": { + "version": "1.0.3", + "bundled": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-symbols": { + "version": "1.0.0", + "bundled": true + }, + "is-callable": { + "version": "1.1.4", + "bundled": true + }, + "is-date-object": { + "version": "1.0.1", + "bundled": true + }, + "is-regex": { + "version": "1.0.4", + "bundled": true, + "requires": { + "has": "^1.0.1" + } + }, + "is-symbol": { + "version": "1.0.2", + "bundled": true, + "requires": { + "has-symbols": "^1.0.0" + } + }, + "node-fetch": { + "version": "2.2.0", + "bundled": true + }, + "object-keys": { + "version": "1.0.12", + "bundled": true + }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "bundled": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.1" + } + }, + "util.promisify": { + "version": "1.0.0", + "bundled": true, + "requires": { + "define-properties": "^1.1.2", + "object.getownpropertydescriptors": "^2.0.3" + } + } + } + } + } + } + } + }, + "apollo-utilities": { + "version": "1.0.21", + "bundled": true, + "requires": { + "fast-json-stable-stringify": "^2.0.0", + "fclone": "^1.0.11" + } + }, + "async-limiter": { + "version": "1.0.0", + "bundled": true + }, + "backo2": { + "version": "1.0.2", + "bundled": true + }, + "busboy": { + "version": "0.2.14", + "bundled": true, + "requires": { + "dicer": "0.2.5", + "readable-stream": "1.1.x" + } + }, + "core-js": { + "version": "2.5.7", + "bundled": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true + }, + "deprecated-decorator": { + "version": "0.1.6", + "bundled": true + }, + "dicer": { + "version": "0.2.5", + "bundled": true, + "requires": { + "readable-stream": "1.1.x", + "streamsearch": "0.1.2" + } + }, + "eventemitter3": { + "version": "3.1.0", + "bundled": true + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "bundled": true + }, + "fclone": { + "version": "1.0.11", + "bundled": true + }, + "graphql-extensions": { + "version": "file:../graphql-extensions", + "bundled": true, + "requires": { + "apollo-server-env": "file:../apollo-server-env" + }, + "dependencies": { + "apollo-server-env": { + "version": "file:../apollo-server-env", + "bundled": true, + "requires": { + "node-fetch": "^2.1.2", + "util.promisify": "^1.0.0" + }, + "dependencies": { + "define-properties": { + "version": "1.1.3", + "bundled": true, + "requires": { + "object-keys": "^1.0.12" + } + }, + "es-abstract": { + "version": "1.12.0", + "bundled": true, + "requires": { + "es-to-primitive": "^1.1.1", + "function-bind": "^1.1.1", + "has": "^1.0.1", + "is-callable": "^1.1.3", + "is-regex": "^1.0.4" + } + }, + "es-to-primitive": { + "version": "1.2.0", + "bundled": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "function-bind": { + "version": "1.1.1", + "bundled": true + }, + "has": { + "version": "1.0.3", + "bundled": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-symbols": { + "version": "1.0.0", + "bundled": true + }, + "is-callable": { + "version": "1.1.4", + "bundled": true + }, + "is-date-object": { + "version": "1.0.1", + "bundled": true + }, + "is-regex": { + "version": "1.0.4", + "bundled": true, + "requires": { + "has": "^1.0.1" + } + }, + "is-symbol": { + "version": "1.0.2", + "bundled": true, + "requires": { + "has-symbols": "^1.0.0" + } + }, + "node-fetch": { + "version": "2.2.0", + "bundled": true + }, + "object-keys": { + "version": "1.0.12", + "bundled": true + }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "bundled": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.1" + } + }, + "util.promisify": { + "version": "1.0.0", + "bundled": true, + "requires": { + "define-properties": "^1.1.2", + "object.getownpropertydescriptors": "^2.0.3" + } + } + } + } + } + }, + "graphql-subscriptions": { + "version": "0.5.8", + "bundled": true, + "requires": { + "iterall": "^1.2.1" + } + }, + "graphql-tag": { + "version": "2.9.2", + "bundled": true + }, + "graphql-tools": { + "version": "3.1.1", + "bundled": true, + "requires": { + "apollo-link": "^1.2.2", + "apollo-utilities": "^1.0.1", + "deprecated-decorator": "^0.1.6", + "iterall": "^1.1.3", + "uuid": "^3.1.0" + } + }, + "hash.js": { + "version": "1.1.5", + "bundled": true, + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true + }, + "isarray": { + "version": "0.0.1", + "bundled": true + }, + "iterall": { + "version": "1.2.2", + "bundled": true + }, + "lodash": { + "version": "4.17.11", + "bundled": true + }, + "minimalistic-assert": { + "version": "1.0.1", + "bundled": true + }, + "object-path": { + "version": "0.11.4", + "bundled": true + }, + "readable-stream": { + "version": "1.1.14", + "bundled": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "regenerator-runtime": { + "version": "0.12.1", + "bundled": true + }, + "streamsearch": { + "version": "0.1.2", + "bundled": true + }, + "string_decoder": { + "version": "0.10.31", + "bundled": true + }, + "subscriptions-transport-ws": { + "version": "0.9.15", + "bundled": true, + "requires": { + "backo2": "^1.0.2", + "eventemitter3": "^3.1.0", + "iterall": "^1.2.1", + "symbol-observable": "^1.0.4", + "ws": "^5.2.0" + } + }, + "symbol-observable": { + "version": "1.2.0", + "bundled": true + }, + "uuid": { + "version": "3.3.2", + "bundled": true + }, + "ws": { + "version": "5.2.2", + "bundled": true, + "requires": { + "async-limiter": "~1.0.0" + } + }, + "zen-observable": { + "version": "0.8.9", + "bundled": true + }, + "zen-observable-ts": { + "version": "0.8.10", + "bundled": true, + "requires": { + "zen-observable": "^0.8.0" + } + } + } + }, + "apollo-server-env": { + "version": "file:../apollo-server-env", + "requires": { + "node-fetch": "^2.1.2", + "util.promisify": "^1.0.0" + }, + "dependencies": { + "define-properties": { + "version": "1.1.3", + "bundled": true, + "requires": { + "object-keys": "^1.0.12" + } + }, + "es-abstract": { + "version": "1.12.0", + "bundled": true, + "requires": { + "es-to-primitive": "^1.1.1", + "function-bind": "^1.1.1", + "has": "^1.0.1", + "is-callable": "^1.1.3", + "is-regex": "^1.0.4" + } + }, + "es-to-primitive": { + "version": "1.2.0", + "bundled": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "function-bind": { + "version": "1.1.1", + "bundled": true + }, + "has": { + "version": "1.0.3", + "bundled": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-symbols": { + "version": "1.0.0", + "bundled": true + }, + "is-callable": { + "version": "1.1.4", + "bundled": true + }, + "is-date-object": { + "version": "1.0.1", + "bundled": true + }, + "is-regex": { + "version": "1.0.4", + "bundled": true, + "requires": { + "has": "^1.0.1" + } + }, + "is-symbol": { + "version": "1.0.2", + "bundled": true, + "requires": { + "has-symbols": "^1.0.0" + } + }, + "node-fetch": { + "version": "2.2.0", + "bundled": true + }, + "object-keys": { + "version": "1.0.12", + "bundled": true + }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "bundled": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.1" + } + }, + "util.promisify": { + "version": "1.0.0", + "bundled": true, + "requires": { + "define-properties": "^1.1.2", + "object.getownpropertydescriptors": "^2.0.3" + } + } + } + }, + "apollo-server-integration-testsuite": { + "version": "file:../apollo-server-integration-testsuite", + "dev": true, + "requires": { + "apollo-server-core": "file:../apollo-server-core" + }, + "dependencies": { + "apollo-server-core": { + "version": "file:../apollo-server-core", + "bundled": true, + "dev": true, + "requires": { + "@apollographql/apollo-upload-server": "^5.0.3", + "@types/ws": "^5.1.2", + "apollo-cache-control": "file:../apollo-cache-control", + "apollo-datasource": "file:../apollo-datasource", + "apollo-engine-reporting": "file:../apollo-engine-reporting", + "apollo-server-caching": "file:../apollo-server-caching", + "apollo-server-env": "file:../apollo-server-env", + "apollo-server-errors": "file:../apollo-server-errors", + "apollo-tracing": "file:../apollo-tracing", + "graphql-extensions": "file:../graphql-extensions", + "graphql-subscriptions": "^0.5.8", + "graphql-tag": "^2.9.2", + "graphql-tools": "^3.0.4", + "hash.js": "^1.1.3", + "lodash": "^4.17.10", + "subscriptions-transport-ws": "^0.9.11", + "ws": "^5.2.0" + }, + "dependencies": { + "@apollographql/apollo-upload-server": { + "version": "5.0.3", + "bundled": true, + "requires": { + "@babel/runtime-corejs2": "^7.0.0-rc.1", + "busboy": "^0.2.14", + "object-path": "^0.11.4" + } + }, + "@babel/runtime-corejs2": { + "version": "7.1.2", + "bundled": true, + "requires": { + "core-js": "^2.5.7", + "regenerator-runtime": "^0.12.0" + } + }, + "@types/events": { + "version": "1.2.0", + "bundled": true + }, + "@types/node": { + "version": "10.11.3", + "bundled": true + }, + "@types/ws": { + "version": "5.1.2", + "bundled": true, + "requires": { + "@types/events": "*", + "@types/node": "*" + } + }, + "apollo-cache-control": { + "version": "file:../apollo-cache-control", + "bundled": true, + "requires": { + "apollo-server-env": "file:../apollo-server-env", + "graphql-extensions": "file:../graphql-extensions" + }, + "dependencies": {} + }, + "apollo-datasource": { + "version": "file:../apollo-datasource", + "bundled": true, + "requires": { + "apollo-server-caching": "file:../apollo-server-caching", + "apollo-server-env": "file:../apollo-server-env" + }, + "dependencies": {} + }, + "apollo-engine-reporting": { + "version": "file:../apollo-engine-reporting", + "bundled": true, + "requires": { + "apollo-engine-reporting-protobuf": "file:../apollo-engine-reporting-protobuf", + "apollo-server-env": "file:../apollo-server-env", + "async-retry": "^1.2.1", + "graphql-extensions": "file:../graphql-extensions", + "lodash": "^4.17.10" + }, + "dependencies": {} + }, + "apollo-link": { + "version": "1.2.3", + "bundled": true, + "requires": { + "apollo-utilities": "^1.0.0", + "zen-observable-ts": "^0.8.10" + } + }, + "apollo-server-caching": { + "version": "file:../apollo-server-caching", + "bundled": true, + "requires": { + "lru-cache": "^4.1.3" + }, + "dependencies": {} + }, + "apollo-server-env": { + "version": "file:../apollo-server-env", + "bundled": true, + "requires": { + "node-fetch": "^2.1.2", + "util.promisify": "^1.0.0" + }, + "dependencies": {} + }, + "apollo-server-errors": { + "version": "file:../apollo-server-errors", + "bundled": true + }, + "apollo-tracing": { + "version": "file:../apollo-tracing", + "bundled": true, + "requires": { + "apollo-server-env": "file:../apollo-server-env", + "graphql-extensions": "file:../graphql-extensions" + }, + "dependencies": {} + }, + "apollo-utilities": { + "version": "1.0.21", + "bundled": true, + "requires": { + "fast-json-stable-stringify": "^2.0.0", + "fclone": "^1.0.11" + } + }, + "async-limiter": { + "version": "1.0.0", + "bundled": true + }, + "backo2": { + "version": "1.0.2", + "bundled": true + }, + "busboy": { + "version": "0.2.14", + "bundled": true, + "requires": { + "dicer": "0.2.5", + "readable-stream": "1.1.x" + } + }, + "core-js": { + "version": "2.5.7", + "bundled": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true + }, + "deprecated-decorator": { + "version": "0.1.6", + "bundled": true + }, + "dicer": { + "version": "0.2.5", + "bundled": true, + "requires": { + "readable-stream": "1.1.x", + "streamsearch": "0.1.2" + } + }, + "eventemitter3": { + "version": "3.1.0", + "bundled": true + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "bundled": true + }, + "fclone": { + "version": "1.0.11", + "bundled": true + }, + "graphql-extensions": { + "version": "file:../graphql-extensions", + "bundled": true, + "requires": { + "apollo-server-env": "file:../apollo-server-env" + }, + "dependencies": {} + }, + "graphql-subscriptions": { + "version": "0.5.8", + "bundled": true, + "requires": { + "iterall": "^1.2.1" + } + }, + "graphql-tag": { + "version": "2.9.2", + "bundled": true + }, + "graphql-tools": { + "version": "3.1.1", + "bundled": true, + "requires": { + "apollo-link": "^1.2.2", + "apollo-utilities": "^1.0.1", + "deprecated-decorator": "^0.1.6", + "iterall": "^1.1.3", + "uuid": "^3.1.0" + } + }, + "hash.js": { + "version": "1.1.5", + "bundled": true, + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true + }, + "isarray": { + "version": "0.0.1", + "bundled": true + }, + "iterall": { + "version": "1.2.2", + "bundled": true + }, + "lodash": { + "version": "4.17.11", + "bundled": true + }, + "minimalistic-assert": { + "version": "1.0.1", + "bundled": true + }, + "object-path": { + "version": "0.11.4", + "bundled": true + }, + "readable-stream": { + "version": "1.1.14", + "bundled": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "regenerator-runtime": { + "version": "0.12.1", + "bundled": true + }, + "streamsearch": { + "version": "0.1.2", + "bundled": true + }, + "string_decoder": { + "version": "0.10.31", + "bundled": true + }, + "subscriptions-transport-ws": { + "version": "0.9.15", + "bundled": true, + "requires": { + "backo2": "^1.0.2", + "eventemitter3": "^3.1.0", + "iterall": "^1.2.1", + "symbol-observable": "^1.0.4", + "ws": "^5.2.0" + } + }, + "symbol-observable": { + "version": "1.2.0", + "bundled": true + }, + "uuid": { + "version": "3.3.2", + "bundled": true + }, + "ws": { + "version": "5.2.2", + "bundled": true, + "requires": { + "async-limiter": "~1.0.0" + } + }, + "zen-observable": { + "version": "0.8.9", + "bundled": true + }, + "zen-observable-ts": { + "version": "0.8.10", + "bundled": true, + "requires": { + "zen-observable": "^0.8.0" + } + } + } + } + } + }, + "apollo-utilities": { + "version": "1.0.21", + "resolved": "https://registry.npmjs.org/apollo-utilities/-/apollo-utilities-1.0.21.tgz", + "integrity": "sha512-ZcxELlEl+sDCYBgEMdNXJAsZtRVm8wk4HIA58bMsqYfd1DSAJQEtZ93F0GZgYNAGy3QyaoBeZtbb0/01++G8JQ==", + "requires": { + "fast-json-stable-stringify": "^2.0.0", + "fclone": "^1.0.11" + } + }, + "busboy": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-0.2.14.tgz", + "integrity": "sha1-bCpiLvz0fFe7vh4qnDetNseSVFM=", + "requires": { + "dicer": "0.2.5", + "readable-stream": "1.1.x" + } + }, + "core-js": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "deprecated-decorator": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/deprecated-decorator/-/deprecated-decorator-0.1.6.tgz", + "integrity": "sha1-AJZjF7ehL+kvPMgx91g68ym4bDc=" + }, + "dicer": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/dicer/-/dicer-0.2.5.tgz", + "integrity": "sha1-WZbAhrszIYyBLAkL3cCc0S+stw8=", + "requires": { + "readable-stream": "1.1.x", + "streamsearch": "0.1.2" + } + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "fclone": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/fclone/-/fclone-1.0.11.tgz", + "integrity": "sha1-EOhdo4v+p/xZk0HClu4ddyZu5kA=" + }, + "graphql-tools": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/graphql-tools/-/graphql-tools-3.1.1.tgz", + "integrity": "sha512-yHvPkweUB0+Q/GWH5wIG60bpt8CTwBklCSzQdEHmRUgAdEQKxw+9B7zB3dG7wB3Ym7M7lfrS4Ej+jtDZfA2UXg==", + "requires": { + "apollo-link": "^1.2.2", + "apollo-utilities": "^1.0.1", + "deprecated-decorator": "^0.1.6", + "iterall": "^1.1.3", + "uuid": "^3.1.0" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "iterall": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/iterall/-/iterall-1.2.2.tgz", + "integrity": "sha512-yynBb1g+RFUPY64fTrFv7nsjRrENBQJaX2UL+2Szc9REFrSNm1rpSXHGzhmAy7a9uv3vlvgBlXnf9RqmPH1/DA==" + }, + "object-path": { + "version": "0.11.4", + "resolved": "https://registry.npmjs.org/object-path/-/object-path-0.11.4.tgz", + "integrity": "sha1-NwrnUvvzfePqcKhhwju6iRVpGUk=" + }, + "readable-stream": { + "version": "1.1.14", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "regenerator-runtime": { + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz", + "integrity": "sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg==" + }, + "streamsearch": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz", + "integrity": "sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo=" + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, + "zen-observable": { + "version": "0.8.9", + "resolved": "https://registry.npmjs.org/zen-observable/-/zen-observable-0.8.9.tgz", + "integrity": "sha512-Y9kPzjGvIZ5jchSlqlCpBW3I82zBBL4z+ulXDRVA1NwsKzjt5kwAi+gOYIy0htNkfuehGZZtP5mRXHRV6TjDWw==" + }, + "zen-observable-ts": { + "version": "0.8.10", + "resolved": "https://registry.npmjs.org/zen-observable-ts/-/zen-observable-ts-0.8.10.tgz", + "integrity": "sha512-5vqMtRggU/2GhePC9OU4sYEWOdvmayp2k3gjPf4F0mXwB3CSbbNznfDUvDJx9O2ZTa1EIXdJhPchQveFKwNXPQ==", + "requires": { + "zen-observable": "^0.8.0" + } + } + } +} diff --git a/packages/apollo-server-lambda/package.json b/packages/apollo-server-lambda/package.json index 51775fc8ae5..b0679d4eb44 100644 --- a/packages/apollo-server-lambda/package.json +++ b/packages/apollo-server-lambda/package.json @@ -25,6 +25,7 @@ "node": ">=6" }, "dependencies": { + "@apollographql/apollo-upload-server": "^5.0.3", "@apollographql/graphql-playground-html": "^1.6.0", "apollo-server-core": "file:../apollo-server-core", "apollo-server-env": "file:../apollo-server-env", diff --git a/packages/apollo-server-lambda/src/ApolloServer.ts b/packages/apollo-server-lambda/src/ApolloServer.ts index 396a4d1ad35..87f565c7f69 100644 --- a/packages/apollo-server-lambda/src/ApolloServer.ts +++ b/packages/apollo-server-lambda/src/ApolloServer.ts @@ -1,6 +1,6 @@ import lambda from 'aws-lambda'; import { ApolloServerBase } from 'apollo-server-core'; -import { GraphQLOptions, Config } from 'apollo-server-core'; +import { GraphQLOptions, Config, FileUploadOptions } from 'apollo-server-core'; import { renderPlaygroundPage, RenderPageOptions as PlaygroundRenderPageOptions, @@ -17,6 +17,7 @@ export interface CreateHandlerOptions { credentials?: boolean; maxAge?: number; }; + uploadsConfig?: FileUploadOptions; } export class ApolloServer extends ApolloServerBase { @@ -43,7 +44,9 @@ export class ApolloServer extends ApolloServerBase { return super.graphQLServerOptions({ event, context }); } - public createHandler({ cors }: CreateHandlerOptions = { cors: undefined }) { + public createHandler( + { cors, uploadsConfig }: CreateHandlerOptions = { cors: undefined }, + ) { const corsHeaders: lambda.APIGatewayProxyResult['headers'] = {}; if (cors) { @@ -156,7 +159,7 @@ export class ApolloServer extends ApolloServerBase { ); }; - graphqlLambda(this.createGraphQLServerOptions.bind(this))( + graphqlLambda(this.createGraphQLServerOptions.bind(this), uploadsConfig)( event, context, callbackFilter, diff --git a/packages/apollo-server-lambda/src/__tests__/lambdaApollo.test.ts b/packages/apollo-server-lambda/src/__tests__/lambdaApollo.test.ts index 300071015ab..452bbc8a748 100644 --- a/packages/apollo-server-lambda/src/__tests__/lambdaApollo.test.ts +++ b/packages/apollo-server-lambda/src/__tests__/lambdaApollo.test.ts @@ -6,6 +6,9 @@ import testSuite, { import { Config } from 'apollo-server-core'; import url from 'url'; import { IncomingMessage, ServerResponse } from 'http'; +import request = require('supertest'); + +import gql from 'graphql-tag'; const createLambda = (options: CreateAppOptions = {}) => { const server = new ApolloServer( @@ -16,7 +19,7 @@ const createLambda = (options: CreateAppOptions = {}) => { return (req: IncomingMessage, res: ServerResponse) => { // return 404 if path is /bogus-route to pass the test, lambda doesn't have paths - if (req.url.includes('/bogus-route')) { + if (req.url && req.url.includes('/bogus-route')) { res.statusCode = 404; return res.end(); } @@ -24,7 +27,7 @@ const createLambda = (options: CreateAppOptions = {}) => { let body = ''; req.on('data', chunk => (body += chunk)); req.on('end', () => { - const urlObject = url.parse(req.url, true); + const urlObject = url.parse(req.url || '', true); const event = { httpMethod: req.method, body: body, @@ -35,7 +38,7 @@ const createLambda = (options: CreateAppOptions = {}) => { }, headers: req.headers, }; - const callback = (error, result) => { + const callback = (error: any, result: any) => { if (error) throw error; res.statusCode = result.statusCode; for (let key in result.headers) { @@ -54,3 +57,80 @@ const createLambda = (options: CreateAppOptions = {}) => { describe('integration:Lambda', () => { testSuite(createLambda); }); + +const typeDefs = gql` + scalar Upload + + type File { + filename: String! + mimetype: String! + encoding: String! + } + + type Query { + uploads: [File] + helloWorld: String + } + + type Mutation { + singleUpload(file: Upload!): File! + } +`; + +const resolvers = { + Query: { + uploads: () => {}, + helloWorld: () => 'hi', + }, + Mutation: { + singleUpload: async (_, args) => { + expect((await args.file).stream).toBeDefined(); + return args.file; + }, + }, +}; + +describe('file uploads', () => { + it('enabled uploads', async () => { + const app = await createLambda({ + graphqlOptions: { + typeDefs, + resolvers, + }, + }); + + const expected = { + filename: 'package.json', + encoding: '7bit', + mimetype: 'application/json', + }; + + const req = request(app) + .post('/graphql') + .type('form') + .field( + 'operations', + JSON.stringify({ + query: ` + mutation($file: Upload!) { + singleUpload(file: $file) { + filename + encoding + mimetype + } + } + `, + variables: { + file: null, + }, + }), + ) + .field('map', JSON.stringify({ 1: ['variables.file'] })) + .attach('1', 'package.json'); + + return req.then((res: any) => { + expect(res.status).toEqual(200); + expect(res.body.data.singleUpload).toEqual(expected); + }); + }); +}); diff --git a/packages/apollo-server-lambda/src/lambdaApollo.ts b/packages/apollo-server-lambda/src/lambdaApollo.ts index f8de8880b34..4730be08f0d 100644 --- a/packages/apollo-server-lambda/src/lambdaApollo.ts +++ b/packages/apollo-server-lambda/src/lambdaApollo.ts @@ -4,23 +4,49 @@ import { ServerOptionsFunction, HttpQueryError, runHttpQuery, + FileUploadOptions, } from 'apollo-server-core'; import { Headers } from 'apollo-server-env'; +import { processRequest as processFileUploads } from '@apollographql/apollo-upload-server'; +import stream from 'stream'; export type LambdaGraphQLOptionsFunction = ServerOptionsFunction< [lambda.APIGatewayProxyEvent, lambda.Context] >; +const fileUploadProcess = async ( + event: any, + uploadsConfig?: FileUploadOptions, +) => { + const contentType = + event.headers['content-type'] || event.headers['Content-Type']; + + if (contentType && contentType.startsWith('multipart/form-data')) { + const request = new stream.Readable() as any; + request.push( + Buffer.from(event.body, event.isBase64Encoded ? 'base64' : 'ascii'), + ); + request.push(null); + request.headers = event.headers; + request.headers['content-type'] = contentType; + + return await processFileUploads(request, uploadsConfig || {}); + } + + return event.body; +} + export function graphqlLambda( options: GraphQLOptions | LambdaGraphQLOptionsFunction, + uploadsConfig?: FileUploadOptions, ): lambda.APIGatewayProxyHandler { if (!options) { throw new Error('Apollo Server requires options.'); } - if (arguments.length > 1) { + if (arguments.length > 2) { throw new Error( - `Apollo Server expects exactly one argument, got ${arguments.length}`, + `Apollo Server expects one or two argument, got ${arguments.length}`, ); } @@ -37,35 +63,48 @@ export function graphqlLambda( statusCode: 500, }); } - runHttpQuery([event, context], { - method: event.httpMethod, - options: options, - query: - event.httpMethod === 'POST' && event.body - ? JSON.parse(event.body) - : event.queryStringParameters, - request: { - url: event.path, - method: event.httpMethod, - headers: new Headers(event.headers), - }, - }).then( - ({ graphqlResponse, responseInit }) => { - callback(null, { - body: graphqlResponse, - statusCode: 200, - headers: responseInit.headers, - }); - }, - (error: HttpQueryError) => { - if ('HttpQueryError' !== error.name) return callback(error); - callback(null, { - body: error.message, - statusCode: error.statusCode, - headers: error.headers, + + fileUploadProcess(event, uploadsConfig) + .then((body: any) => { + event.body = body; + + let query: any = event.queryStringParameters; + if (event.httpMethod === 'POST' && event.body) { + if (typeof event.body === 'string') { + query = JSON.parse(event.body); + } else { + query = event.body; + } + } + + return runHttpQuery([event, context], { + method: event.httpMethod, + options: options, + query, + request: { + url: event.path, + method: event.httpMethod, + headers: new Headers(event.headers), + }, }); - }, - ); + }) + .then( + ({ graphqlResponse, responseInit }) => { + callback(null, { + body: graphqlResponse, + statusCode: 200, + headers: responseInit.headers, + }); + }, + (error: HttpQueryError) => { + if ('HttpQueryError' !== error.name) return callback(error); + callback(null, { + body: error.message, + statusCode: error.statusCode, + headers: error.headers, + }); + }, + ); }; return graphqlHandler; diff --git a/packages/apollo-server-lambda/src/types.d.ts b/packages/apollo-server-lambda/src/types.d.ts new file mode 100644 index 00000000000..4d3fbdfa624 --- /dev/null +++ b/packages/apollo-server-lambda/src/types.d.ts @@ -0,0 +1 @@ +declare module '@apollographql/apollo-upload-server';