Commit graph

317 commits

Author SHA1 Message Date
Martijn Walraven
f942af77b2 Clean up APQ code a little bit 2018-10-10 14:13:52 +02:00
Martijn Walraven
cea6404e92 Improve type safety of request pipeline API 2018-10-10 08:20:27 +02:00
Martijn Walraven
0f6594ae8e Don't skip APQs if no query is passed in 2018-10-09 21:37:29 +02:00
Martijn Walraven
59bc1c9318 Fix some request pipeline types 2018-10-09 21:35:51 +02:00
Martijn Walraven
e40f4a2b9b Add additional lifecycle hooks and allow returning didEnd handlers 2018-10-09 17:29:21 +02:00
Martijn Walraven
5b1760d78a Update graphql-subscriptions dependency to 1.0.0 in all packages 2018-10-09 12:18:25 +02:00
Martijn Walraven
b5715410fb Merge remote-tracking branch 'origin/master' into abernix/re-new-request-pipeline 2018-10-09 11:30:16 +02:00
renovate[bot]
ebe8b39d3b chore(deps): update dependency graphql-tools to v4 (#1771) 2018-10-09 11:27:59 +02:00
Martijn Walraven
00e9838c66 Move shared type definitions to top-level types directory 2018-10-08 21:15:55 +02:00
Martijn Walraven
a12673a432 WIP of passing through plugins to pipeline and calling lifecycle methods 2018-10-08 14:25:32 +02:00
Martijn Walraven
f11914ac71 Type plugin definitions and invoke serverWillStart with service context 2018-10-08 13:50:47 +02:00
Martijn Walraven
c28e3e2087 Add note about http property in GraphQLRequest needing to be optional 2018-10-08 11:16:47 +02:00
Martijn Walraven
ba61960430 Clean up passing throughhttp property in GraphQLResponse 2018-10-08 11:03:01 +02:00
Martijn Walraven
5281f3f98f Introduce request context and refactor pipeline code 2018-10-07 18:23:27 +02:00
Martijn Walraven
e928adfdfc Simplify plugin API and fix circular dependency issues
We compile `requestPipelineAPI.ts` as a separate TypeScript project to avoid circular dependency issues from the `apollo-server-plugin-base` package depending on the types in `apollo-server-core`.
2018-10-06 06:59:32 +02:00
Martijn Walraven
482a32008d Fix new type error in TypeScript 3.1 with explicit cast 2018-10-06 04:56:19 +02:00
Martijn Walraven
282ea7e022 Merge remote-tracking branch 'origin/typescript-project-references' into abernix/re-new-request-pipeline 2018-10-06 03:49:36 +02:00
Martijn Walraven
11a13cd3dd Remove apollo-server-env as a project reference
We can't use `apollo-server-env` as a project reference because that requires `composite: true`, and that implies `declaration: true`, which doesn't work for `apollo-server-env` because we need to write our own declaration files for re-exported imports.

This commit also removes `apollo-engine-reporting-protobuf` as a reference, which errored out because it doesn't actually contain any TypeScript code.
2018-10-05 23:05:49 +02:00
Martijn Walraven
8932091e67 Add root level tsconfig.json as entry point 2018-10-05 21:48:49 +02:00
Martijn Walraven
1aee215e68 Switch to tsc --build and remove run scripts from packages 2018-10-05 17:48:34 +02:00
Martijn Walraven
fcaa6ad79d Enable TypeScript project references 2018-10-05 17:47:29 +02:00
Martijn Walraven
5d03ae1650 Update to TypeScript 3.1 2018-10-05 17:18:13 +02:00
Martijn Walraven
f051c7cb80 Add comment about cloning the context 2018-10-05 16:30:21 +02:00
Jesse Rosenberger
d7d7b0babd
Merge branch 'abernix/plugin-base' into abernix/re-new-request-pipeline 2018-10-05 16:27:34 +03:00
Martijn Walraven
87463582ed Fix cacheControl property in Config and GraphQLServerOptions
While cacheControl can take a boolean when passing it in  to ApolloServer as part of a Config, these will be converted to default options before passing them on as options.
2018-10-05 14:33:32 +02:00
Jesse Rosenberger
68f50cd09c Import specifically createHash, rather than * as crypto from crypto.
This silences the deprecation messages which have been showing up in recent
local development on the new request pipeline work.  e.g.:

> ```
> [DEP0010] DeprecationWarning: crypto.createCredentials is deprecated.
>   Use tls.createSecureContext instead.
> [DEP0011] DeprecationWarning:
>   crypto.Credentials is deprecated. Use tls.SecureContext instead.
> ```
2018-10-05 13:12:10 +02:00
Martijn Walraven
d80209e4aa Fix typing of context property in GraphQLServerOptions
The actual resolving of the context happens in ApolloServer#graphQLServerOptions, but errors thrown while doing that are currently converted to a throwing function.
2018-10-05 09:48:58 +02:00
Martijn Walraven
891d62983a Refactor runHttpQuery and extract cache policy computation into CacheControlExtension 2018-10-05 09:08:12 +02:00
Jesse Rosenberger
2479473664
Introduce basic plugin and limited API to apollo-server-core. 2018-10-04 23:25:42 +03:00
Jesse Rosenberger
1ec383db36
Introduce a method to simplify the Engine service identifier. 2018-10-04 23:25:42 +03:00
Jesse Rosenberger
98d4fc3674
Don't ever allow requestOptions to be undefined. 2018-10-04 23:25:42 +03:00
Jesse Rosenberger
f1bc734377
Import specifically createHash, rather than * as crypto from crypto.
This silences the deprecation messages which have been showing up in recent
local development on the new request pipeline work.  e.g.:

> ```
> [DEP0010] DeprecationWarning: crypto.createCredentials is deprecated.
>   Use tls.createSecureContext instead.
> [DEP0011] DeprecationWarning:
>   crypto.Credentials is deprecated. Use tls.SecureContext instead.
> ```
2018-10-04 23:25:07 +03:00
Martijn Walraven
7493077f18 Fix context and rootValue types in GraphQLServerOptions
The ability to pass in functions or promises shouldn't affect the type variable.
2018-10-02 14:00:34 +02:00
Martijn Walraven
ba0066edf8 Extract processHTTPRequest from runHttpQuery 2018-10-02 13:59:33 +02:00
Martijn Walraven
e2a22b23b5 Remove leftover debug output 2018-09-28 15:45:22 +02:00
Evans Hauser
81c46421a9
Provide ability to specify client info in traces (#1631)
* Provide ability to specify client info in traces

Adds the createClientInfo to apollo-engine-reporting, which enables the
differentiation of clients based on the request, operation, and
variables. This could be extended to include the response. However for
the first release. It doesn't quite make sense.

* Use extensions and context in createClientInfo

* Remove support for clientAddress

The frontend will not support it in the near future

* create -> generate and make default generator

createClientInfo -> generateClientInfo

* Clarify default values
2018-09-27 17:26:12 +03:00
Tim Griesser
261994ca7c
Allow an optional function to resolve the rootValue (#1555)
* Allow an optional function to resolve the rootValue

Passes the parsed DocumentNode AST to determine the root value,
useful when providing a different rootValue for query vs mutation

* Add API docs for rootValue
2018-09-27 16:57:46 +03:00
Martijn Walraven
7fbf35cc1c
Remove hash.js dependency and re-enable noUnusedLocals 2018-09-27 16:46:45 +03:00
Martijn Walraven
49248329ca
Move persisted query processing to GraphQLRequestProcessor 2018-09-27 16:46:45 +03:00
Martijn Walraven
faf1494a7f
Remove runQuery.ts and fix tests to use GraphQLRequestProcessor 2018-09-27 16:46:45 +03:00
Martijn Walraven
a09d514e59
Refactor runQuery into GraphQLRequestProcessor 2018-09-27 16:46:45 +03:00
Jesse Rosenberger
38e7b6a5b6
Revert "Allow an optional function to resolve the rootValue (#1555)"
This reverts commit 4175f1b9cd.
2018-09-27 16:46:39 +03:00
Jesse Rosenberger
2b470e1c11
Revert "Pass the context request and response extension methods (#1547)"
This reverts commit 408198e5ac.
2018-09-27 16:36:28 +03:00
Jesse Rosenberger
68c82e63c6
Revert "Provide ability to specify client info in traces (#1631)"
This reverts commit 96af44e41a.
2018-09-27 16:35:00 +03:00
Jesse Rosenberger
8e594d47f5
Revert #1698 renovate/graphql tools 4.x (#1716)
I'm reverting apollographql/apollo-server#1698 not because it's been problematic in any way, but because I'd like to give it a bit more thought and don't want this to accidentally get cut into a release prior to that consideration.

More specifically: The `graphql-tools` update on its own shouldn't really cause any problems, but the [4.x version of `graphql-tools`](https://github.com/apollographql/graphql-tools/releases/tag/4.0.0) is intended to support and enable the latest `graphql@14` which contains [breaking changes](https://github.com/graphql/graphql-js/releases/tag/v14.0.0).

I believe most of those breaking changes would be show-stoppers and the failures would surface immediately (meaning that servers would completely fail to start, rather than being a surprise in other, more delayed scenarios), but it's still worth pausing and carefully considering versioning to avoid any surprises.

That said, the 14.x version of `graphql` has been an acceptable range in the `peerDependencies` of `apollo-server-*` since before its final release came out, and I don't believe we've caught wind of anything that a major version bump would have prevented or made more clear.  In the end, `graphql` is a peer dependency and any problems should only surface if consumers also update their `graphql` dependency — a clear major version bump, which deserves review by the upgrader — so perhaps we can avoid bumping the major version after all?

Input welcomed, but again, merging this now to give this a bit more thought first.

cc @hwillson
2018-09-24 20:47:18 +03:00
Hugh Willson
dd86fa8a29 Re-enable Typescript esModuleInterop (#1699)
`esModuleInterop` was enabled in
e4164c8892
to help with importing from packages that use default exports.
Those changes were reverted in
https://github.com/apollographql/apollo-server/pull/1210
to work around a few reported issues. Those issues are no longer
relevant, so this commit re-enables `esModuleInterop`, and
updates all default imports to use the more common (standard)
import syntax.
2018-09-21 16:43:33 +03:00
Tim Griesser
4175f1b9cd Allow an optional function to resolve the rootValue (#1555)
* Allow an optional function to resolve the rootValue

Passes the parsed DocumentNode AST to determine the root value,
useful when providing a different rootValue for query vs mutation

* Add API docs for rootValue
2018-09-20 11:47:40 -07:00
renovate[bot]
f2a4673006 chore(deps): update dependency graphql-tools to v4 (#1698) 2018-09-20 17:13:03 +03:00
Jesse Rosenberger
749538daee
Specify explicit cursorShape default for Playground options. (#1607)
* Specify explicit `cursorShape` to avoid missing cursor in GraphQL Playground.

This solves a problem with the text cursor caret not being visible in the
operation input box within GraphQL Playground by explicitly setting a
GraphQL Playground configuration option called `cursorShape` to `line`.

All credit for the actual solution goes to @lpellegr for their discovery in
https://github.com/prisma/graphql-playground/issues/790#issuecomment-409221277

* Update CHANGELOG.md
2018-09-20 17:12:11 +03:00
Evans Hauser
86dd95e223
Publish
- apollo-cache-control@0.2.5
 - apollo-engine-reporting@0.0.6
 - apollo-server-cloud-functions@2.1.0
 - apollo-server-cloudflare@2.1.0
 - apollo-server-core@2.1.0
 - apollo-server-express@2.1.0
 - apollo-server-hapi@2.1.0
 - apollo-server-integration-testsuite@2.1.0
 - apollo-server-koa@2.1.0
 - apollo-server-lambda@2.1.0
 - apollo-server-micro@2.1.0
 - apollo-server@2.1.0
 - apollo-tracing@0.2.5
 - graphql-extensions@0.2.1
2018-09-18 15:26:48 -07:00