Skip to content

Commit 89b6848

Browse files
Version Packages (#131)
1 parent c504479 commit 89b6848

File tree

3 files changed

+36
-35
lines changed

3 files changed

+36
-35
lines changed

.changeset/strong-gifts-explain.md

Lines changed: 0 additions & 34 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,40 @@
11
# CHANGELOG
22

3+
## 1.1.0
4+
5+
### Minor Changes
6+
7+
- [#130](https://github.com/apollo-server-integrations/apollo-server-integration-koa/pull/130) [`c504479`](https://github.com/apollo-server-integrations/apollo-server-integration-koa/commit/c5044795f3553009f4e20dc3c0757e3303e70a5a) Thanks [@ryota-ka](https://github.com/ryota-ka)! - Parameterize the returned Middleware type so that this library can be used along with a context-parameterized Koa app.
8+
9+
In order to utilize this feature, provide your Koa app's `State` and `Context` types as type arguments to the `koaMiddleware` function.
10+
11+
If you use a `context` function (for Apollo Server), the `State` and `Context` types are positions 1 and 2 like so:
12+
13+
```ts
14+
type KoaState = { state: object };
15+
type KoaContext = { context: object };
16+
17+
koaMiddleware<GraphQLContext, KoaState, KoaContext>(
18+
new ApolloServer<GraphQLContext>(),
19+
//...
20+
{
21+
context: async ({ ctx }) => ({ graphqlContext: {} }),
22+
},
23+
);
24+
```
25+
26+
If you don't use a `context` function, the `State` and `Context` types are positions 0 and 1 like so:
27+
28+
```ts
29+
type KoaState = { state: object };
30+
type KoaContext = { context: object };
31+
32+
koaMiddleware<KoaState, KoaContext>(
33+
new ApolloServer<GraphQLContext>(),
34+
//...
35+
);
36+
```
37+
338
## 1.0.0
439

540
### Major Changes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@as-integrations/koa",
33
"description": "Apollo server integration for koa framework",
4-
"version": "1.0.0",
4+
"version": "1.1.0",
55
"author": "Matt Gordon <[email protected]>",
66
"license": "MIT",
77
"repository": {

0 commit comments

Comments
 (0)