@alxia/graphql 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/docs/guide/endpoint.md +1 -1
- package/docs/roadmap.md +4 -0
- package/docs/troubleshooting.md +22 -0
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -14,7 +14,9 @@ bun add -d typescript
|
|
|
14
14
|
`graphql-yoga` and `graphql` are peers: the package declares no dependency.
|
|
15
15
|
`graphql-ws` is an optional one, for [`ws`](#websocket) alone.
|
|
16
16
|
`graphql` 16 and 17 both work; with 17, `graphql-yoga` must be 5.22 or
|
|
17
|
-
later, the first to accept it.
|
|
17
|
+
later, the first to accept it. `graphql-yoga` 5 (from 5.16) and 6 both work;
|
|
18
|
+
the specs run on 6. Yoga 6 takes a `@graphql-hive/logger` `Logger` as a custom
|
|
19
|
+
`logging` value, and its `@graphql-yoga/plugin-*` 4.x need Yoga 6.
|
|
18
20
|
|
|
19
21
|
## Usage
|
|
20
22
|
|
package/docs/guide/endpoint.md
CHANGED
|
@@ -60,7 +60,7 @@ routes on `base` and returns it.
|
|
|
60
60
|
| `parseCache` | `false \| { maxBytes?, max?, ttl? }` | 64 MiB, 1 024 documents, 3 600 000 ms | The cache of parsed documents, one per endpoint, bounded by estimated bytes. `false` parses every request. Cannot be given with Yoga's `parserAndValidationCache`, which replaces it. |
|
|
61
61
|
| `bodyLimit` | `number` | the app's earlier `bodyLimit()`, else `1_048_576` (1 MiB) | The most bytes a `POST` body may hold; past it core answers a 413, in the app's error format. A whole number of bytes, else core's `TypeError` where `graphql()` is declared. A `multipart` upload needs a larger one: see [Cap what a request costs](production.md#cap-what-a-request-costs). |
|
|
62
62
|
| `cors` | Yoga's `cors` | `false` | Yoga's own CORS. Off: use `@alxia/cors` for the whole app instead ([Yoga's plugins and options](yoga.md#cors)). |
|
|
63
|
-
| every other Yoga option | | Yoga's | `plugins`, `context`, `maskedErrors`, `batching`, `logging`… passed to `createYoga` as they are: see [Yoga's plugins and options](yoga.md). |
|
|
63
|
+
| every other Yoga option | | Yoga's | `plugins`, `context`, `maskedErrors`, `batching`, `logging`… passed to `createYoga` as they are: see [Yoga's plugins and options](yoga.md). On Yoga 6 a custom `logging` must be a `@graphql-hive/logger` `Logger`: see [`log.child is not a function`](../troubleshooting.md#logchild-is-not-a-function). |
|
|
64
64
|
|
|
65
65
|
`graphqlEndpoint` is not an option: `path` sets it.
|
|
66
66
|
|
package/docs/roadmap.md
CHANGED
|
@@ -25,6 +25,10 @@ Nothing scheduled yet.
|
|
|
25
25
|
|
|
26
26
|
## Shipped
|
|
27
27
|
|
|
28
|
+
### Unreleased
|
|
29
|
+
|
|
30
|
+
- **`graphql-yoga` 6 accepted as a peer.** The range is `^5.16.0 || ^6.0.0`; CI runs the specs on both majors. A custom `logging` on Yoga 6 must be a `@graphql-hive/logger` `Logger` ([troubleshooting](troubleshooting.md#logchild-is-not-a-function)).
|
|
31
|
+
|
|
28
32
|
### 0.9.2
|
|
29
33
|
|
|
30
34
|
- **A declared oversize body refused where `bodyLimit()` stands.** With
|
package/docs/troubleshooting.md
CHANGED
|
@@ -28,6 +28,7 @@ symptom.
|
|
|
28
28
|
|
|
29
29
|
**Responses**
|
|
30
30
|
|
|
31
|
+
- [`log.child is not a function`](#logchild-is-not-a-function)
|
|
31
32
|
- [`200 {"errors":[{"message":"Unexpected error.", … "code":"INTERNAL_SERVER_ERROR"}}]}`](#200-errorsmessageunexpected-error--codeinternal_server_error)
|
|
32
33
|
- [`403 Required CSRF header(s) not present` from the test client](#403-required-csrf-headers-not-present-from-the-test-client)
|
|
33
34
|
- [`PersistedQueryNotFound` or `PersistedQueryOnly`](#persistedquerynotfound-or-persistedqueryonly)
|
|
@@ -389,6 +390,27 @@ a fraction, `NaN` or a string.
|
|
|
389
390
|
|
|
390
391
|
**Fix:** a positive whole number, or `false` for no limit.
|
|
391
392
|
|
|
393
|
+
### `log.child is not a function`
|
|
394
|
+
|
|
395
|
+
**When:** every request answers 500 with `TypeError: serverContext.log.child is
|
|
396
|
+
not a function`, on `graphql-yoga` 6, with a custom `logging` such as
|
|
397
|
+
`{ debug() {}, info() {}, warn() {}, error() {} }`.
|
|
398
|
+
|
|
399
|
+
**Why:** Yoga 6 scopes a logger to each request with `log.child(...)`, so a
|
|
400
|
+
custom `logging` must be a `@graphql-hive/logger` `Logger`. Yoga 5 took any
|
|
401
|
+
object with `debug`, `info`, `warn` and `error`. `logging: false`, a level
|
|
402
|
+
and `true` work on both.
|
|
403
|
+
|
|
404
|
+
**Fix:** give a `Logger` (it also works on Yoga 5):
|
|
405
|
+
|
|
406
|
+
```ts
|
|
407
|
+
import { Logger } from '@graphql-hive/logger';
|
|
408
|
+
|
|
409
|
+
graphql(app, { schema, logging: new Logger({ level: 'warn' }) });
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
Or turn Yoga's logger off: `graphql(app, { schema, logging: false })`.
|
|
413
|
+
|
|
392
414
|
### `200 {"errors":[{"message":"Unexpected error.", … "code":"INTERNAL_SERVER_ERROR"}}]}`
|
|
393
415
|
|
|
394
416
|
**When:** a resolver throws an `Error`, or rejects.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alxia/graphql",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "GraphQL for alxia with GraphQL Yoga: its plugins, subscriptions over SSE or WebSocket (graphql-ws) and GraphiQL, behind the app's hooks, its resolvers reading the app's typed context",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -51,20 +51,21 @@
|
|
|
51
51
|
"@alxia/logger": "^0.6.9",
|
|
52
52
|
"@alxia/telemetry": "^0.7.7",
|
|
53
53
|
"@envelop/depth-limit": "^7.2.1",
|
|
54
|
-
"@graphql-
|
|
55
|
-
"@graphql-yoga/plugin-
|
|
54
|
+
"@graphql-hive/logger": "^1.1.1",
|
|
55
|
+
"@graphql-yoga/plugin-csrf-prevention": "^4.0.1",
|
|
56
|
+
"@graphql-yoga/plugin-persisted-operations": "^4.0.1",
|
|
56
57
|
"@nxgt/telemetry": "^0.2.2",
|
|
57
58
|
"@types/bun": "^1.4.4",
|
|
58
59
|
"dataloader": "^2.2.3",
|
|
59
60
|
"graphql": "^16.11.0",
|
|
60
61
|
"graphql-ws": "^6.3.0",
|
|
61
|
-
"graphql-yoga": "^
|
|
62
|
+
"graphql-yoga": "^6.0.1"
|
|
62
63
|
},
|
|
63
64
|
"peerDependencies": {
|
|
64
65
|
"@alxia/core": "^0.17.1",
|
|
65
66
|
"graphql": "^16.11.0 || ^17.0.0",
|
|
66
67
|
"graphql-ws": "^6.1.0",
|
|
67
|
-
"graphql-yoga": "^5.16.0",
|
|
68
|
+
"graphql-yoga": "^5.16.0 || ^6.0.0",
|
|
68
69
|
"typescript": "^6.0.3 || ^7.0.0"
|
|
69
70
|
},
|
|
70
71
|
"peerDependenciesMeta": {
|