Commit graph

908 commits

Author SHA1 Message Date
Martijn Walraven
c1b0af18be
Add delete method to mock cache in integration tests 2018-10-25 14:40:57 +03:00
Jesse Rosenberger
4bad240ae4
Add delete implementations to the various cache store implementations. (#1878)
Includes:

* InMemory
* Redis
* Memcached
2018-10-25 14:32:14 +03:00
renovate[bot]
d35acecc38 chore(deps): update dependency koa to v2.6.1 (#1873) 2018-10-25 13:37:39 +03:00
Martijn Walraven
e5b0b57ef0 Avoid ReferenceError when accessing app in browser-like environments
Fixes #1804.
2018-10-16 16:40:49 +02:00
Martijn Walraven
6dd71d3824 Replace GraphQLRequestPipeline with function 2018-10-16 13:59:30 +02:00
Martijn Walraven
71b1ae4242 Export GraphQL request and reponse types from apollo-server-plugin-base 2018-10-15 12:42:09 +02:00
Martijn Walraven
2385558bea Fix types in apollo-cache-control test helper 2018-10-12 14:13:21 +02:00
Jesse Rosenberger
9a69ad3f3a
Merge branch 'master' into testing-improvements 2018-10-12 14:58:04 +03:00
Martijn Walraven
4fac07b8f1 Consistently leave out explicit tsconfig.json when referring to TypeScript project 2018-10-12 13:34:07 +02:00
Martijn Walraven
ad3562a335 Replace {} with Object.create(null) in jest.config.js 2018-10-12 13:00:13 +02:00
Martijn Walraven
2a2e3ffe4f Improve global fetch type 2018-10-12 11:23:53 +02:00
Martijn Walraven
823d68d318 Work around typing issue with promisified Redis client 2018-10-12 11:13:45 +02:00
Martijn Walraven
fd34771841 Fix typing issues in handler arguments and introduce generic type
These issues became apparent because `typescript@next` correctly types `Function#bind` instead of returning `any`.
2018-10-12 10:46:07 +02:00
Martijn Walraven
d6b222da91 Depend on output of requestPipelineAPI project instead of source 2018-10-12 09:46:49 +02:00
Martijn Walraven
68b2c691f8 Move test tsconfig.json files under __tests__ to support editors
The TypeScript language server looks for `tsconfig.json` and doesn't take project references into account when resolving the config for a file.

See https://github.com/Microsoft/TypeScript/issues/27372.
2018-10-11 23:10:45 +02:00
Martijn Walraven
304074f336 Expose global fetch and URL types to avoid relying on dom lib 2018-10-11 23:10:45 +02:00
Martijn Walraven
3cf067349b Fix some dependencies in tsconfig.test.json files 2018-10-11 23:10:45 +02:00
Martijn Walraven
0491af858d Avoid use of object spread in Jest config files to support Node 6 2018-10-11 23:10:09 +02:00
Martijn Walraven
68f4e83fb2 Fix import in apollo-cache-control 2018-10-11 20:17:37 +02:00
Martijn Walraven
9e843dbf4b Fix apollo-cache-control tests by augmenting schemas with cache control support 2018-10-11 15:05:06 +02:00
Martijn Walraven
787846c64b Fix apollo-server-env mock 2018-10-11 14:43:29 +02:00
Martijn Walraven
cef701e6c1 Remove test dependencies from non-test tsconfig.json files 2018-10-11 12:58:03 +02:00
renovate[bot]
73cbd03be0 chore(deps): update dependency @types/ws to v6 (#1609) 2018-10-11 12:05:19 +03:00
Martijn Walraven
6796ff310b Add paths config for shared __mocks__ to avoid relative imports 2018-10-11 08:20:49 +02:00
Martijn Walraven
f5d5981ffc Add TypeScript and Jest projects for tests in individual packages 2018-10-11 04:33:23 +02:00
Martijn Walraven
1ccef23906 Remove some empty tests 2018-10-11 04:11:49 +02:00
Martijn Walraven
ad758567b1 Rename apollo-cache-control tests so they will be picked up
It turns out we weren't running these tests before because they didn't end in `.test.ts`.
2018-10-11 04:10:51 +02:00
Jesse Rosenberger
dec2b94a0e
Publish
- apollo-cache-control@0.3.0-alpha.0
 - apollo-datasource-rest@0.2.0-alpha.0
 - apollo-datasource@0.2.0-alpha.0
 - apollo-engine-reporting-protobuf@0.1.0-alpha.0
 - apollo-engine-reporting@0.1.0-alpha.0
 - apollo-server-cache-memcached@0.2.0-alpha.0
 - apollo-server-cache-redis@0.2.0-alpha.0
 - apollo-server-caching@0.2.0-alpha.0
 - apollo-server-cloud-functions@2.2.0-alpha.0
 - apollo-server-cloudflare@2.2.0-alpha.0
 - apollo-server-core@2.2.0-alpha.0
 - apollo-server-env@2.1.0-alpha.0
 - apollo-server-errors@2.1.0-alpha.0
 - apollo-server-express@2.2.0-alpha.0
 - apollo-server-hapi@2.2.0-alpha.0
 - apollo-server-integration-testsuite@2.2.0-alpha.0
 - apollo-server-koa@2.2.0-alpha.0
 - apollo-server-lambda@2.2.0-alpha.0
 - apollo-server-micro@2.2.0-alpha.0
 - apollo-server-plugin-base@0.1.0-alpha.0
 - apollo-server@2.2.0-alpha.0
 - apollo-tracing@0.3.0-alpha.0
 - graphql-extensions@0.3.0-alpha.0
2018-10-10 22:30:54 +03:00
Jesse Rosenberger
9089cc5c94
Follow-up un-reverted work to maintain support in the new request pipeline.
Prior to embarking on the request pipeline work, and to facilitate
development on the new request pipeline, @martijnwalraven and myself
intentionally reverted some commits that had been recently introduced but
conflicted with the request pipeline branch that was already in-flight.

Rather than dealing with an incredibly difficult merge conflict, it was
easier to revert them an re-apply them later.

Original commits, reversions, and reintroductions:

* 6d6c9ff, 03a894d, b90ccc2
* 96af44e, 68c82e6, 81c4642
* 408198e, 2b470e1, 84bc834
* 4175f1b, 38e7b6a, 261994c

As is demonstrated by this short follow-up commit, this was all that was
necessary to make it work in the new model - once that model was finished.

While we're certain that the new request pipeline and its plugin model will
actually better support some of the behavior that required these initial
commits in the name of not introducing breaking changes, we feel it's
necessary to maintain their support.

I will point out, if you are at all affected by the above commits, we may
consider deprecating portions of those APIs in the not too distant future,
but we hope that the new model will help support those needs even better.
2018-10-10 20:20:27 +03:00
C.J. Winslow
84bc8346cc
Pass the context request and response extension methods (#1547)
* Pass the context along to all the extension methods

Addresses #1343

With this change you should now be able to implement an extension like so:

```javascript
class MyErrorTrackingExtension extends GraphQLExtension {
    willSendResponse(o) {
        const { context, graphqlResponse } = o

        context.trackErrors(graphqlResponse.errors)

        return o
    }
}
```

Edit by @evans :
fixes #1343
fixes #614 as the request object can be taken from context or from requestDidStart
fixes #631 ""

* Remove context from extra extension functions

The context shouldn't be necessary for format, parse, validation, and
execute. Format generally outputs the state of the extension. Parse and
validate don't depend on the context. Execution includes the context
argument as contextValue

* Move change entry under vNext
2018-10-10 19:25:37 +03:00
Martijn Walraven
17ed84d720 Add queryHash to request context 2018-10-10 16:20:45 +02:00
Martijn Walraven
f4400ac8af Rename dispatcher methods to clarify they invoke hooks 2018-10-10 16:17:10 +02:00
Martijn Walraven
b4863f65e9 Compute query hash for non-APQ queries to use as a cache key 2018-10-10 16:05:04 +02:00
Martijn Walraven
3fab039c1c Add didResolveOperation hook to request pipeline API 2018-10-10 15:19:11 +02:00
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
960810c3f2 Remove jest types from tsconfig.base and add it to test configs 2018-10-09 12:02:11 +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
428430c1dd Enable strict typing for apollo-server-express and fix issues 2018-10-08 21:50:44 +02:00
Martijn Walraven
00e9838c66 Move shared type definitions to top-level types directory 2018-10-08 21:15:55 +02:00
Martijn Walraven
f3e46ca861 Make ApolloServerPlugin#serverWillStart async 2018-10-08 14:32:16 +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