Skip to content

Commit

Permalink
Update Hapi to 20.1.2
Browse files Browse the repository at this point in the history
This is the latest release, and the only release that supports Node 16, so it
will be the minimum version that we test again.

Also:
- Update `@types/hapi__hapi` to latest version. Note that you can import from
  `@hapi/hapi` successfully so adjust an import.
- Update `accept` and `boom` to their latest versions, which now have `@hapi/`
  prefix; this includes in apollo-server-micro for some reason.
- release-3.0 couldn't run tests after the last merge from main until this
  change was made; this revealed a failing test of a newly merged feature due to
  a change in a graphql-js error message. Fix that.

This incorporates suggestions from #3273, #3441, and #4254.
  • Loading branch information
glasser committed Apr 30, 2021
1 parent de22bed commit 48e5239
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 133 deletions.
4 changes: 2 additions & 2 deletions docs/source/api/apollo-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ The `context` object passed between Apollo Server resolvers automatically includ
| Express | <code>{<br/>&nbsp;&nbsp;req: [`express.Request`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/express-serve-static-core/index.d.ts),<br/>&nbsp;&nbsp;res: [`express.Response`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/express-serve-static-core/index.d.ts#L490-L861)<br/>}</code> |
| Fastify | <code>{<br/>&nbsp;&nbsp;request: [`FastifyRequest`](https://github.com/fastify/fastify/blob/1d4dcf2bcde46256c72e96c2cafc843a461c721e/types/request.d.ts#L15),<br/>&nbsp;&nbsp;reply: [`FastifyReply`](https://github.com/fastify/fastify/blob/1d4dcf2bcde46256c72e96c2cafc843a461c721e/types/reply.d.ts#L10)</br>}</code> |
| Google Cloud Functions | <code>{ req: [`Request`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/express-serve-static-core/index.d.ts), res: [`Response`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/express-serve-static-core/index.d.ts#L490-L861) }</code> |
| hapi | <code>{<br/>&nbsp;&nbsp;request: [`hapi.Request`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/hapi/index.d.ts#L396-L605),<br/>&nbsp;&nbsp;h: [`hapi.ResponseToolkit`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/hapi/index.d.ts#L979-L1100)<br/>}</code> |
| hapi | <code>{<br/>&nbsp;&nbsp;request: [`hapi.Request`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/05cbc5521f895344fb7dbf5c51902b6ff235aa69/types/hapi__hapi/index.d.ts#L406-L615),<br/>&nbsp;&nbsp;h: [`hapi.ResponseToolkit`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/05cbc5521f895344fb7dbf5c51902b6ff235aa69/types/hapi__hapi/index.d.ts#L999-L1113)<br/>}</code> |
| Koa | <code>{ ctx: [`Koa.Context`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/koa/index.d.ts#L724-L731) }</code> |
| Micro | <code>{ req: [`MicroRequest`](https://github.com/apollographql/apollo-server/blob/c356bcf3f2864b8d2fcca0add455071e0606ef46/packages/apollo-server-micro/src/types.ts#L3-L5), res: [`ServerResponse`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/node/v10/http.d.ts#L145-L158) }</code> |

Expand Down Expand Up @@ -806,7 +806,7 @@ The default value is `/graphql`.
</td>
<td>

Middleware-specific configuration options for CORS. See available options for your middleware: [express](https://github.com/expressjs/cors#cors) | [hapi](https://hapi.dev/api/?v=20.0.0#-routeoptionscors) | [koa](https://github.com/koajs/cors/)
Middleware-specific configuration options for CORS. See available options for your middleware: [express](https://github.com/expressjs/cors#cors) | [hapi](https://hapi.dev/api/?v=20.1.2#-routeoptionscors) | [koa](https://github.com/koajs/cors/)

Provide `false` to remove CORS middleware entirely, or `true` to use your middleware's default configuration.

Expand Down
180 changes: 66 additions & 114 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"apollo-tracing": "file:packages/apollo-tracing"
},
"devDependencies": {
"@hapi/hapi": "19.2.0",
"@hapi/hapi": "20.1.2",
"@josephg/resolvable": "1.0.0",
"@types/async-retry": "1.4.2",
"@types/aws-lambda": "8.10.66",
Expand All @@ -65,7 +65,7 @@
"@types/cors": "2.8.10",
"@types/express": "4.17.11",
"@types/fast-json-stable-stringify": "2.0.0",
"@types/hapi__hapi": "19.0.4",
"@types/hapi__hapi": "20.0.8",
"@types/ioredis": "4.26.0",
"@types/jest": "26.0.9",
"@types/koa-router": "7.4.2",
Expand Down
3 changes: 1 addition & 2 deletions packages/apollo-server-hapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ This is the Hapi integration of Apollo Server. Apollo Server is a community-main
npm install apollo-server-hapi graphql
```

This package is only tested with `@hapi/hapi` 20.1.2 and higher; that is the minimum version of Hapi that supports Node 16.
## Usage

The code below requires Hapi 18 or higher.

```js
const { ApolloServer, gql } = require('apollo-server-hapi');
const Hapi = require('@hapi/hapi');
Expand Down
8 changes: 4 additions & 4 deletions packages/apollo-server-hapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
},
"dependencies": {
"@apollographql/graphql-playground-html": "1.6.27",
"accept": "^3.1.3",
"@hapi/accept": "^5.0.2",
"@hapi/boom": "^9.1.2",
"apollo-server-core": "file:../apollo-server-core",
"apollo-server-types": "file:../apollo-server-types",
"boom": "^7.3.0"
"apollo-server-types": "file:../apollo-server-types"
},
"devDependencies": {
"apollo-server-integration-testsuite": "file:../apollo-server-integration-testsuite"
},
"peerDependencies": {
"@hapi/hapi": "^19.2.0",
"@hapi/hapi": "^20.1.2",
"graphql": "^15.3.0"
}
}
4 changes: 2 additions & 2 deletions packages/apollo-server-hapi/src/ApolloServer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import hapi from '@hapi/hapi';
import { parseAll } from 'accept';
import type hapi from '@hapi/hapi';
import { parseAll } from '@hapi/accept';
import {
renderPlaygroundPage,
RenderPageOptions as PlaygroundRenderPageOptions,
Expand Down
Loading

0 comments on commit 48e5239

Please sign in to comment.