Commit graph

820 commits

Author SHA1 Message Date
Clarence Ngoh
5f307928a2 Add BadUserInputError as extension of ApolloError (#1143)
* Add BadUserInputError and TransientError as extensions of ApolloError

* remove TransientError

* update test so that properties end up under `error.extensions.exception`

* update documentation to talk about BadUserInputError

* check for properties after formatApolloErrors has been called

* fixed highlighted lines for docs

* export BadUserInputError from `apollo-server`

* fixed highlighted lines for docs

* export BadUserInputError from `apollo-server`

* update changelog
2018-06-08 10:39:23 -07:00
Evans Hauser
4c6352aad7
v2.0.0-beta.5 2018-06-07 14:50:13 -07:00
Evans Hauser
a04bea3fe2
cloudflare: set as private while permissions are worked out 2018-06-07 14:38:32 -07:00
Evans Hauser
f9cd6ce7c1
docs: fix comments about gql-tag 2018-06-07 14:21:40 -07:00
David Glasser
b2fb680812 update engine reporting dependencies 2018-06-06 18:32:08 -07:00
Evans Hauser
8601919ad9
server,express,hapi: bump graphql-playground and express type versions 2018-06-06 12:03:21 -07:00
Evans Hauser
9e87f405ed
core: add changelog for gql-tag change 2018-06-06 11:36:49 -07:00
Evans Hauser
adfe69cb6a
core: display only first 200 characters of schema on gql error 2018-06-06 11:36:49 -07:00
Evans Hauser
b07b9e8e8b
core,express: export gql tag directly to align with client 2018-06-06 11:02:01 -07:00
Renovate Bot
8e3e370c53 chore(deps): update dependency @types/express to v4.16.0 2018-06-05 07:30:52 +00:00
Evans Hauser
5079246bc4
apollo-server,core,hapi,express: bump package to newest beta.4 2018-06-04 10:16:54 -07:00
Evans Hauser
1e70a446b2
Enable Apollo Server 2 to have async context + test (#1129)
* core: add test for context as async function

* core,express: add support and test of context as async function
2018-06-04 09:46:55 -07:00
Renovate Bot
7d9a978683 chore(deps): update dependency @types/restify to v5.0.9 2018-06-02 11:17:30 +00:00
Renovate Bot
e57bf2a742 chore(deps): update dependency @types/koa to v2.0.46 2018-06-02 07:30:10 +00:00
David Glasser
5c65742a39
Factor out runQuery's use of logFunction into an extension (#1128)
This requires a slightly newer graphql-extensions beta which has more arguments
to requestDidStart.

Also make it ok to not pass logFunction to formatApolloErrors, and make sure
custom fieldResolvers continue to work with extensions (by upgrading the
dependency and fixing a logic bug).

The custom fieldResolvers fix means that we now unconditionally put the
extension stack on the GraphQL context, which means that the context can no
longer be (say) a string.  I changed a test that expected string contexts to
work. You couldn't use a string for a context when using extensions before, so
this isn't that big of a change.
2018-06-01 21:16:25 -07:00
David Glasser
836616bd04 Turn on noUnusedLocals and noUnusedParameters (#1126) 2018-06-01 15:16:16 -07:00
Evans Hauser
db3316cbac
Merge branch 'version-2' into refactor-2.0 2018-06-01 13:36:34 -07:00
Evans Hauser
4405405321 hapi,express: fix graphql playground subscriptitionPath argument for typing 2018-06-01 12:34:49 -07:00
Evans Hauser
ec7394d1b3 apollo-server,core,hapi,express: bump package to newest beta 2018-06-01 12:34:49 -07:00
David Glasser
5e1b49bbc5 basic apollo-engine-reporting integration 2018-06-01 12:34:49 -07:00
Renovate Bot
ef8b119ede chore(deps): update dependency @types/aws-lambda to v8.10.6 2018-06-01 07:56:13 +00:00
Renovate Bot
8d73bd027b chore(deps): update dependency typescript to v2.8.4 2018-05-31 16:23:37 +00:00
Renovate Bot
45c5874312 chore(deps): update dependency hapi to v17.5.1 2018-05-31 14:46:20 +00:00
David Glasser
66189657b3 Rename ApolloServer.request to graphQLServerOptionsForRequest 2018-05-31 00:14:59 -07:00
David Glasser
7444904518 Update for graphql-extensions@0.1.0 API
- Actually call validationDidStart and parsingDidStart.

- Use new graphql-extensions API which:
  - replaces fooDidEnd with a handler returned by fooDidStart
  - adds options to various methods
  - has a new willSendResponse method
  - requires you to construct the extension objects yourself (but make
    the external API for specifying extensions to ApolloServer be
    factories, because extensions are per request)

- Make a better effort at consistently calling end handlers even on error
2018-05-31 00:14:59 -07:00
Sebastian
2acf5654c3 Added an option to support additional extensions
(Originally #934, tweaked by @glasser.)
2018-05-31 00:14:59 -07:00
Evans Hauser
63d0f72115
core: error resurfacing for merged schemas that hide errors in a CombineErrors 2018-05-30 22:40:27 -07:00
Evans Hauser
c5ba902277
express: add fallback for file uploads middleware if not enabled 2018-05-30 22:38:37 -07:00
Evans Hauser
7cad97e419
core: add tests error handling in resolvers with production env 2018-05-30 16:42:26 -07:00
Evans Hauser
7d17f1f379
core: made name non-eunumerable in ApolloError and removed extra code in tests 2018-05-30 16:41:42 -07:00
Evans Hauser
9e07cb3405
core: add test around throwing Authentication error inside of context creation 2018-05-30 16:05:25 -07:00
Evans Hauser
4609ee94a5
core: evaluate context per request and differ error until caught in runQuery 2018-05-30 16:02:48 -07:00
Evans Hauser
5bb652a32d
hapi: add new server instantiation to the readme 2018-05-30 15:23:57 -07:00
Evans Hauser
da316908d2
runQuery accepts Request object that variants create (#1108)
* core: runQuery accepts Request object that integrations create

* core: add changelog for Requst in runQuery

* adonis: correct request object passed to runQuery

* core: change convertHttpMessageToRequest to convertNodeHttpToRequest
2018-05-29 21:37:38 -07:00
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
8c92c1a7d8
integration-testsuite: add error on AST passed to server as query 2018-05-24 16:38:37 -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
5b98a075b8
apollo-server-express: move import of apollo-server in tests to a require 2018-05-24 14:27:06 -07:00
Evans Hauser
9342658ac8
apollo-server-express: remove circular devDependeny on apollo-server for tests 2018-05-24 14:14:36 -07:00
Evans Hauser
f1fa8ade8a
apollo-server-express: tests constructor, registerServer options, and basic queries 2018-05-23 23:09:17 -07:00
Evans Hauser
3acb7c706a
apollo-server: tests constructor and basic queries 2018-05-23 23:08:47 -07:00
Renovate Bot
8ddfa741a3 chore(deps): update dependency @types/aws-lambda to v8.10.5 2018-05-24 06:02:02 +00:00
Evans Hauser
6b94408924
apollo-server: remove registerServer config from listen (#1090) 2018-05-23 21:55:02 -07:00
Evans Hauser
06a4bcbab1
apollo-server: add cors options to listen function 2018-05-22 22:05:46 -07:00
Evans Hauser
1f784636d9
apollo-server: move health check into variant's registerServer call 2018-05-22 21:58:37 -07:00