Commit graph

2303 commits

Author SHA1 Message Date
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
Jesse Rosenberger
e4d672c568
Merge branch 'master' into abernix/re-new-request-pipeline 2018-10-10 19:14:20 +03:00
Alexander CherryTea
0b05b5e92e Update data.md (#1794)
That example code crush with error `find is not defined`, because in imports forgot about lodash `find` and `filter`
2018-10-10 17:26:58 +03:00
Dan Dascalescu
23ed96a6db More nuanced handling of stack traces in errors (#1708) 2018-10-10 17:22:10 +03:00
Martijn Walraven
17ed84d720 Add queryHash to request context 2018-10-10 16:20:45 +02:00
renovate[bot]
1102887599 chore(deps): update dependency husky to v1 (#1728)
This PR contains the following updates:

| Package | Type | Update | Change | References |
|---|---|---|---|---|
| husky | devDependencies | major | `0.14.3` -> `1.1.1` | [source](https://renovatebot.com/gh/typicode/husky) |

---

### Release Notes

<details>
<summary>typicode/husky</summary>

### [`v1.1.1`](https://renovatebot.com/gh/typicode/husky/blob/master/CHANGELOG.md#&#8203;111)

[Compare Source](https://renovatebot.com/gh/typicode/husky/compare/v1.1.0...v1.1.1)

-   Check `HUSKY_SKIP_INSTALL` value first before checking if `.git` exists
-   Check Node version before running hooks

### [`v1.1.0`](https://renovatebot.com/gh/typicode/husky/blob/master/CHANGELOG.md#&#8203;110)

[Compare Source](https://renovatebot.com/gh/typicode/husky/compare/v1.0.1...v1.1.0)

-   Create `.git/hooks` if it doesn't exist

### [`v1.0.1`](https://renovatebot.com/gh/typicode/husky/blob/master/CHANGELOG.md#&#8203;101)

[Compare Source](https://renovatebot.com/gh/typicode/husky/compare/v1.0.0...v1.0.1)

-   Various `husky-upgrade` changes ([#&#8203;362](https://renovatebot.com/gh/typicode/husky/pull/362), [#&#8203;360](https://renovatebot.com/gh/typicode/husky/pull/360), [#&#8203;359](https://renovatebot.com/gh/typicode/husky/pull/359))

### [`v1.0.0`](https://renovatebot.com/gh/typicode/husky/blob/master/CHANGELOG.md#&#8203;100)

[Compare Source](https://renovatebot.com/gh/typicode/husky/compare/v0.14.3...v1.0.0)

After a year of pre-releases and a complete rewrite, this marks the first stable release of husky 🐶🎉.

##### Notable changes

Below you'll find consolidated changes since `0.14.3`. There's no change in code between `1.0.0-rc.15` and `1.0.0`.

-   Hooks

    -   Add `sendemail-validate` hook

-   Config

    -   Move hooks config from `scripts` field to `husky` field
    -   Prefer raw names for hooks (e.g. `pre-commit` rather than `precommit`)
    -   Support `.huskyrc` config

-   Package managers

    -   Support environments where [yarn](https://renovatebot.com/gh/yarnpkg/yarn/) is the only package manager installed
    -   Support [pnpm](https://renovatebot.com/gh/pnpm/pnpm) package manager

-   Environment variables

    -   Add `HUSKY_SKIP_INSTALL` environment variable for skipping git hooks installation
    -   Add `HUSKY_GIT_STDIN` environment variable for `pre-push`, `pre-receive`, `post-receive` and `post-rewrite` to access arguments passed by Git via stdin
    -   Rename `GIT_PARAMS` to `HUSKY_GIT_PARAMS`

-   Messages

    -   Add many more messages in case of errors
    -   Add [please-upgrade-node](https://renovatebot.com/gh/typicode/please-upgrade-node) message if using with unsupported Node version
    -   Make `--no-verify` message more accurate and only show it for hooks that can be skipped

-   Upgrade

    -   Add `husky-upgrade` command to automatically migrate hooks in `package.json`
    -   Add deprecation warning for hooks that are still defined in `scripts`

-   Other
    -   Drop `Node 4` support
    -   Drop integrated `nvm` support (see Node version management in docs)

##### Credits

Huge thanks to all the Contributors and [Patreon Supporters](https://thanks.typicode.com)! 🙏

</details>

---

### Renovate configuration

📅 **Schedule**: "after 6pm every weekday,before 8am every weekday" in timezone America/Los_Angeles.

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻️ **Rebasing**: Whenever PR is stale, or if you modify the PR title to begin with "`rebase!`".

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

This PR has been generated by [Renovate Bot](https://renovatebot.com/gh/marketplace/renovate). View repository job log [here](https://renovatebot.com/dashboard#apollographql/apollo-server).
2018-10-10 17:20:44 +03:00
Martijn Walraven
f4400ac8af Rename dispatcher methods to clarify they invoke hooks 2018-10-10 16:17:10 +02:00
KarinaDavtyan
17073ed00b docs: update apollo-cache-control link (#1762) 2018-10-10 17:10:58 +03: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
Martin d'Allens
e7296b79aa Docs: fix the example for "Using an Existing Schema" (#1761)
* Fix the example for "Using an Existing Schema"

The file caused the following error:
```
const gql = String.raw;
      ^
SyntaxError: Identifier 'gql' has already been declared
```

* Update migration-two-dot.md

* Update migration-two-dot.md
2018-10-10 16:57:18 +03:00
renovate[bot]
c9121b1948 chore(deps): update dependency lerna to v3.4.3 (#1789) 2018-10-10 16:27:19 +03:00
renovate[bot]
ff3c23f20b chore(deps): update dependency typescript to v3.1.2 (#1790) 2018-10-10 16:26:57 +03:00
Jovi De Croock
5be51b5a72 docs: add koa example since it is in the github title (#1780)
* docs: add koa example since it is in the github title

* fix: correct mistake

* Revert "fix: correct mistake"

This reverts commit 1de53f7e2b36c9ac7364a7f291f79bef4f77d777.

* fix: correct mistake

* Update README.md examples.

Follows-up on #1780 by fixing mismatching `port`s in the Koa example and switching other examples to be more DRY with regards to the `port` values.
2018-10-10 16:26:23 +03: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
renovate[bot]
99f7f94608 chore(deps): update dependency @types/lodash to v4.14.117 (#1787) 2018-10-10 15:13:44 +03:00
renovate[bot]
cf4d1f23e9 chore(deps): update dependency @types/node to v10.11.6 (#1788)
This PR contains the following updates:

| Package | Type | Update | Change | References |
|---|---|---|---|---|
| @types/node | devDependencies | patch | `10.11.5` -> `10.11.6` | [source](https://renovatebot.com/gh/DefinitelyTyped/DefinitelyTyped) |

---

### Renovate configuration

📅 **Schedule**: "after 6pm every weekday,before 8am every weekday" in timezone America/Los_Angeles.

🚦 **Automerge**: Enabled.

♻️ **Rebasing**: Whenever PR is stale, or if you modify the PR title to begin with "`rebase!`".

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

This PR has been generated by [Renovate Bot](https://renovatebot.com/gh/marketplace/renovate). View repository job log [here](https://renovatebot.com/dashboard#apollographql/apollo-server).
2018-10-10 15:13:23 +03:00
Renovate Bot
619ddd6e00 chore(deps): update dependency @types/jest to v23.3.5 2018-10-10 11:54:15 +00: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
f4234ca9c8 Move Jest configuration from package.json to jest.config.js 2018-10-09 11:44:16 +02:00
Martijn Walraven
02b645b347 Update graphql-subscriptions dependency to 1.0.0 2018-10-09 11:42:00 +02:00
Martijn Walraven
b7c9a6d8fe Add @types/ws and update ws dependency 2018-10-09 11:38:46 +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
renovate[bot]
5c115a17f1 chore(deps): update dependency @types/redis to v2.8.7 (#1785) 2018-10-09 11:21:30 +02:00
renovate[bot]
f29ec2ef56 chore(deps): update dependency @types/node to v10.11.5 (#1784) 2018-10-09 11:20:41 +02:00
renovate[bot]
87cdcc3ebf chore(deps): update dependency @types/jest to v23.3.4 (#1783) 2018-10-09 11:19:56 +02:00
Renovate Bot
bf603653a0 chore(deps): update dependency @types/graphql to v14.0.2 2018-10-09 09:02:21 +00: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
Renovate Bot
f920f5f610 chore(deps): update dependency ts-jest to v23.10.4 2018-10-08 13:58:53 +00: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
Jesse Rosenberger
65088d030b
Merge pull request #1772 from apollographql/typescript-project-references
Use TypeScript project references
2018-10-08 12:36:04 +03: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
10e12e8b55 Add compile:clean run script to clean compiler output 2018-10-07 18:23:56 +02:00
Martijn Walraven
5281f3f98f Introduce request context and refactor pipeline code 2018-10-07 18:23:27 +02:00
Martijn Walraven
f4d3a37f78 Fix failing tests by passing in structured engine apiKey
Since activating the EngineReportingAgent is now dependent on being able to extract an engineServiceId from the API key, tests need to specify one that follows the expected structure.
2018-10-06 08:39:39 +02:00
Martijn Walraven
231c7f1ece Add watch and test:watch run scripts 2018-10-06 08:35:46 +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
6654c0d1b7 Remove unused configuration options from tsconfig.test.json 2018-10-06 00:04:03 +02:00