Commit graph

130 commits

Author SHA1 Message Date
Evans Hauser
5412885cc0
apollo-server 2: uploads as schema enhancement fulfilled in registerServer (#1071)
* apollo-server-core: add file upload hooks and configuration

* apollo-server-core: make requestOptions and fileUploadsConfig public fields in ApolloServerBase

* apollo-server-express: initial fileuploads middleware

* apollo-server-hapi: initial file uploads middleware

* core: remove fileuploads from constructor and add merge capabilities

* express: add fileuploads to registerServer and single test

* hapi: add fileuploads schema merge to registerServer

* express: add check for EPIPE and ignore it due to upload server issue

* core: add scalar Upload to server construction
2018-05-29 15:58:52 -07:00
Evans Hauser
447bb1863d
Merge pull request #1097 from apollographql/server-2.0/consistent-query-parse
Always only parse query in runQuery and don't accept AST over the wire
2018-05-24 16:57:01 -07:00
Evans Hauser
1c46a32ab0
apollo-server-core: add changelog entry for removing AST over the wire 2018-05-24 16:50:02 -07:00
Evans Hauser
f118ed4b9c
apollo-server-core: add note about mutation on GET request ad-hoc error 2018-05-24 16:41:56 -07:00
Evans Hauser
220d2ed102
apollo-server-core: move query presence check to after formatParams 2018-05-24 16:18:57 -07:00
David Glasser
8b6b0161d1
Be consistent about where GraphQL queries are parsed
runQuery currently takes a `query` argument that is either a string or a
DocumentNode. This means that it's possible to accidentally support syntax we
don't mean to. For example, if you happen to send a JSON-serialized DocumentNode
over the wire, we'll happily execute that, and you'll believe you're using
GraphQL even though you really aren't --- until you try to use some other
GraphQL tool that expects to see the GraphQL query language rather than
graphql-js ASTs.

Additionally, GET requests parse their queries in runHttpQuery rather than
runQuery, leading to inconsistent error handling semantics on parse failures.

Simplify the runQuery API (which is technically exported though intended to be
mostly internal) to take in either a parsedQuery or a queryString argument. The
main use case for knowing about these parameters is if you're using formatParams
with OperationStore; its docs and tests have been updated to reflect this.

Stop parsing queries in runHttpQuery; instead, ensure we throw the right error
for mutations-over-GET by passing the error to throw into runQuery.

Stop accidentally supporting graphql-js ASTs on the wire --- but throw an
informative error when you do so.

This backwards-incompatible change is intended for apollo-server-core 2.0.
2018-05-24 15:47:09 -07:00
Evans Hauser
43d545f8ab
apollo-server-core: add request object to runHttpQuery for access to headers (#1096) 2018-05-24 15:43:17 -07:00
Evans Hauser
712a562858
package.json: beta.2 for apollo-server, beta.1 for core/express, beta.0 for hapi 2018-05-22 11:16:59 -07:00
Evans Hauser
57328e2214
apollo-server-core: move http options under own key in listenOptions 2018-05-21 23:20:56 -07:00
Evans Hauser
40d8879fa3
apollo-server-core: runHttpQuery accepts options function with arguments 2018-05-21 20:34:51 -07:00
Evans Hauser
d935e517e6
apollo-server-core: update graphql-tools 2018-05-21 20:21:58 -07:00
Evans Hauser
2e9d4689b5
apollo-server-core: add comment about ApolloError construction 2018-05-21 16:08:32 -07:00
Evans Hauser
23f5b76f10
apollo-server-core: ApolloError extends Error and implements GraphQLError 2018-05-21 15:41:36 -07:00
Evans Hauser
aea7c4e669
apollo-server-core: fix test after update typings to node 10 2018-05-21 15:37:58 -07:00
Evans Hauser
4f009777ba
apollo-server-core: fix typings on operation ast check for null ast 2018-05-21 15:33:10 -07:00
Evans Hauser
84e763358e
package.json: remove node and graphql types from root and unnecessary variants 2018-05-21 15:31:57 -07:00
Evans Hauser
138a0b55f2
build: readd @types/node and type configuration for tsconfig 2018-05-20 21:05:11 -07:00
Evans Hauser
5749c0afec
apollo-server-core: test for starting up engine 2018-05-20 20:15:01 -07:00
Evans Hauser
6ab3a62f37
apollo-server-core: add changelog for error prototyping fixes 2018-05-20 05:43:46 -07:00
Evans Hauser
c5687aea66
apollo-server-core: await server stop and restore node env in test 2018-05-20 03:54:10 -07:00
Evans Hauser
aad7c39001
build: update dependencies and remove extra node typings 2018-05-20 03:52:54 -07:00
Evans Hauser
373522114f
apollo-server-core: add tests for ApolloServerBase basic functionality 2018-05-20 02:32:09 -07:00
Evans Hauser
a3daf7d551
apollo-server-core: keep referrence to subscriptions server and clean it up on stop 2018-05-20 02:18:32 -07:00
Evans Hauser
858216c97a
apollo-server-core: move environment checking into the constructor to enable testing 2018-05-20 02:12:43 -07:00
Evans Hauser
1ffac8b767
apollo-server-core: add instanceof error tests thanks to @JustinDSN 2018-05-20 02:10:07 -07:00
Evans Hauser
3c71f34cee
apollo-server-core: set error prototypes explicitly 2018-05-20 02:07:46 -07:00
Evans Hauser
8fd2c12b8f
apollo-server-core: add test for errors 2018-05-16 16:03:09 -07:00
Evans Hauser
226770819d
apollo-server-core: check for options as optional 2018-05-16 15:57:51 -07:00
Evans Hauser
8e1f3545c4
apollo-server-core: type errors returned as ApolloErrors and add ability to reference arbitrary fields 2018-05-16 14:46:33 -07:00
Evans Hauser
973b096ea3
apollo-server-core: enableIntrospection -> introspection 2018-05-11 17:33:52 -07:00
Evans Hauser
0e4848d5e1
apollo-server: subscriptions options condensed to on option and ensure subscriptions path is set 2018-05-11 17:30:52 -07:00
Evans Hauser
5d279001ca
apollo-server-core: feedback from #979 to improve readability and spelling 2018-05-11 17:00:45 -07:00
Evans Hauser
9fa4a8a62b
docs: add parameter movement from constructor to listen to changelog 2018-05-11 15:54:24 -07:00
Evans Hauser
db47867ccb
apollo-server-core: move subscriptions out of constructor into listen function 2018-05-11 15:54:24 -07:00
Evans Hauser
56955dc97a
apollo-server-core: remove extra Object assign, found by @justinanastos 🎉 2018-05-11 15:54:23 -07:00
Evans Hauser
012f37aed5
engine -> engineProxy in listen, fix engineLauncherOptions, and unrequired parameters optional (#1051)
engine -> engineProxy in listen, fix engineLauncherOptions, and make unrequired parameters optional
2018-05-11 15:54:22 -07:00
Evans Hauser
b9858df437
apollo-server-core: clarify context creation can be async in changelog 2018-05-11 15:54:22 -07:00
Evans Hauser
9099948e5c
apollo-server-core: run http options allows query to be an array 2018-05-11 15:54:22 -07:00
Evans Hauser
acae63cd4b
apollo-server-core: remove Promise wrapping in async function return values 2018-05-11 15:54:21 -07:00
Evans Hauser
8fe51be3ef
apollo-server-core: add warning to options creation failure if debugDefault enabled 2018-05-11 15:54:21 -07:00
Evans Hauser
ccb6eea934
apollo-server-core: enrichError not exported and moved formatter check to out of map 2018-05-11 15:54:21 -07:00
Evans Hauser
2781cc8831
apollo-server-core: remove unsued async from BaseServer's request function 2018-05-11 15:54:21 -07:00
Evans Hauser
e58db229df
changelogs: added to root and apollo-server-core 2018-05-11 15:54:20 -07:00
Evans Hauser
1f3103b5c7
apollo-server-core: use getOwnPropertyNames to stay es5 2018-05-11 15:53:19 -07:00
Evans Hauser
c4e3766475
apollo-server-core: add check for null property in ApolloError 2018-05-11 15:53:18 -07:00
Evans Hauser
0fe53a68da
apollo-server-core: capture context creation failure in GraphQL error 2018-05-11 15:53:18 -07:00
Evans Hauser
5aeb36f3d7
apollo-server-core: allow creation of context to be asynchronous 2018-05-11 15:53:17 -07:00
Evans Hauser
75e661e9b2
apollo-server-core: stronger typing on context in GraphQLServerOptions as a function 2018-05-11 15:53:17 -07:00
Evans Hauser
e0332bb164
apollo-server-core: added formatApolloError arguments to subscription callback 2018-05-11 15:53:17 -07:00
Evans Hauser
a7772a01fb
apollo-server-core: wrap error thrown by context construction in apollo error to add code 2018-05-11 15:53:17 -07:00