@softistx/alxia-graphql 0.20.2 → 0.21.1
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 -2
- package/docs/guide/context.md +22 -0
- package/docs/guide/ide.md +6 -2
- package/docs/guide/plugins.md +1 -1
- package/docs/migrating-to-graxia.md +4 -3
- package/docs/troubleshooting.md +6 -4
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ bun add -d typescript
|
|
|
15
15
|
bun add @softistx/graxia-envelop @envelop/depth-limit # install yourself to use Envelop plugins
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
`@softistx/graxia` (`^0.
|
|
18
|
+
`@softistx/graxia` (`^0.18.0 || ^0.19.0 || ^0.20.0`), `@softistx/graxia-graphiql` (`^0.4.0 || ^0.5.0`) and `graphql` (17.1 or later) are peers:
|
|
19
19
|
the package declares no dependency. `@softistx/graxia-graphiql` serves the IDE and is
|
|
20
20
|
required. CSRF protection is graxia's default (on): a `GET` needs one of the
|
|
21
21
|
`x-graphql-csrf`, `graphql-require-preflight`, `apollo-require-preflight` or
|
|
@@ -25,7 +25,8 @@ required. CSRF protection is graxia's default (on): a `GET` needs one of the
|
|
|
25
25
|
|
|
26
26
|
| `@softistx/graxia` | `@softistx/graxia-graphiql` |
|
|
27
27
|
| --- | --- |
|
|
28
|
-
| 0.
|
|
28
|
+
| 0.18, 0.19 | 0.4 |
|
|
29
|
+
| 0.20 | 0.5 |
|
|
29
30
|
|
|
30
31
|
Before the move to the `@softistx` scope, the packages were `@graxia/core` and `@graxia/graphiql`:
|
|
31
32
|
core 0.10 to 0.14 paired with graphiql 0.2.4 to 0.2.8 (one graphiql patch per core minor).
|
package/docs/guide/context.md
CHANGED
|
@@ -87,6 +87,28 @@ const locale = (_: unknown, __: unknown, { request }: GraphQLContext<typeof base
|
|
|
87
87
|
request.headers.get('accept-language') ?? 'en';
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
+
## Extending an operation's idle time
|
|
91
|
+
|
|
92
|
+
`/graphql` sits behind a `bodyLimit`, so `request` in a resolver's context is a
|
|
93
|
+
copy, and Bun's `server.timeout(request, seconds)` does nothing on a copy.
|
|
94
|
+
`timeout(seconds)` is the route's [`ctx.timeout`](../../../core/docs/guide/serving.md#the-server-ctxserver),
|
|
95
|
+
bound to the request Bun handed to the server: an operation that waits long on
|
|
96
|
+
a model server asks for the time it needs, without raising the server's
|
|
97
|
+
`idleTimeout` for every connection.
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
const transcribe = async (
|
|
101
|
+
_: unknown,
|
|
102
|
+
args: { audio: string },
|
|
103
|
+
{ timeout }: GraphQLContext<typeof base>,
|
|
104
|
+
) => {
|
|
105
|
+
timeout(150); // seconds of idle time for this request; 0 for none
|
|
106
|
+
return await speechToText(args.audio);
|
|
107
|
+
};
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
It does nothing when no server took the request (`app.request` in a spec).
|
|
111
|
+
|
|
90
112
|
## Setting a header or a cookie
|
|
91
113
|
|
|
92
114
|
`set` is the route's: what a resolver sets on it is on the response, beside
|
package/docs/guide/ide.md
CHANGED
|
@@ -77,12 +77,16 @@ Its other options are listed in the `@softistx/graxia-graphiql` documentation.
|
|
|
77
77
|
The page serves GraphiQL's script and stylesheet itself, from the endpoint
|
|
78
78
|
(`?graphiql-asset=<file>`): nothing loads from a third-party host. The
|
|
79
79
|
response carries a strict `Content-Security-Policy` that lets those files
|
|
80
|
-
alone load,
|
|
80
|
+
alone load, lets no one frame the page and lets same-origin workers run
|
|
81
|
+
(`worker-src 'self'`, which GraphiQL 6's editors need). The policy of
|
|
82
|
+
`@softistx/graxia-graphiql` 0.5:
|
|
81
83
|
|
|
82
84
|
```text
|
|
83
|
-
default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; connect-src 'self'; worker-src '
|
|
85
|
+
default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; connect-src 'self'; worker-src 'self'; frame-ancestors 'none'; base-uri 'none'; form-action 'none'
|
|
84
86
|
```
|
|
85
87
|
|
|
88
|
+
`@softistx/graxia-graphiql` 0.4 sent `worker-src 'none'` instead and ran no worker.
|
|
89
|
+
|
|
86
90
|
## Apollo Sandbox
|
|
87
91
|
|
|
88
92
|
`ide: 'apollo-sandbox'` serves a page embedding Apollo Sandbox, pointed at
|
package/docs/guide/plugins.md
CHANGED
|
@@ -283,7 +283,7 @@ app.listen({ port: 3000, idleTimeout: 30 }); // seconds, longer than the 12 s pi
|
|
|
283
283
|
```
|
|
284
284
|
|
|
285
285
|
Calling `server.timeout(request, 0)` from a resolver does not lift it for the
|
|
286
|
-
stream. Behind a proxy or load balancer, its own read timeout must be longer
|
|
286
|
+
stream (`context.timeout(0)` is not verified for streams either: keep `idleTimeout`). Behind a proxy or load balancer, its own read timeout must be longer
|
|
287
287
|
than 12 seconds too. See
|
|
288
288
|
[the troubleshooting entry](../troubleshooting.md#an-idle-subscription-over-sse-is-reset-after-about-10-seconds).
|
|
289
289
|
|
|
@@ -26,16 +26,17 @@ bun add graphql@^17.1.0
|
|
|
26
26
|
|
|
27
27
|
| Before | After |
|
|
28
28
|
| --- | --- |
|
|
29
|
-
| `graphql-yoga` | `@softistx/graxia` `^0.
|
|
29
|
+
| `graphql-yoga` | `@softistx/graxia` `^0.18.0 \|\| ^0.19.0 \|\| ^0.20.0` (0.10 sets the HTTP status from errors again) |
|
|
30
30
|
| `graphql-ws` (for `ws`) | nothing: graxia speaks `graphql-transport-ws` |
|
|
31
|
-
| bundled GraphiQL of Yoga | `@softistx/graxia-graphiql` `^0.4.0` (required) |
|
|
31
|
+
| bundled GraphiQL of Yoga | `@softistx/graxia-graphiql` `^0.4.0 \|\| ^0.5.0` (required) |
|
|
32
32
|
| Envelop plugins | not a peer: install `@softistx/graxia-envelop` yourself to use Envelop plugins |
|
|
33
33
|
|
|
34
34
|
`@softistx/graxia-graphiql` peers on exactly one core minor, so install the one that matches:
|
|
35
35
|
|
|
36
36
|
| `@softistx/graxia` | `@softistx/graxia-graphiql` |
|
|
37
37
|
| --- | --- |
|
|
38
|
-
| 0.
|
|
38
|
+
| 0.18, 0.19 | 0.4 |
|
|
39
|
+
| 0.20 | 0.5 |
|
|
39
40
|
|
|
40
41
|
Before the move to the `@softistx` scope, the packages were `@graxia/core` and `@graxia/graphiql`:
|
|
41
42
|
core 0.10 to 0.14 paired with graphiql 0.2.4 to 0.2.8 (one graphiql patch per core minor).
|
package/docs/troubleshooting.md
CHANGED
|
@@ -883,21 +883,23 @@ subscribe: () => boundedStream(source, { idleMs: 90_000, totalMs: 600_000, check
|
|
|
883
883
|
other than the one installed, or the install holds two copies of core.
|
|
884
884
|
|
|
885
885
|
**Why:** each `@softistx/graxia-graphiql` release peers on exactly one core minor
|
|
886
|
-
(0.4.0 on core 0.
|
|
886
|
+
(0.4 on core 0.18 or 0.19, 0.5 on core 0.20; under the former `@graxia/*` names, 0.2.4 on core 0.10 up
|
|
887
887
|
to 0.2.8 on 0.14).
|
|
888
888
|
|
|
889
889
|
**Fix:** install the graphiql that matches your core, for example
|
|
890
|
-
`bun add @softistx/graxia-graphiql@^0.
|
|
890
|
+
`bun add @softistx/graxia-graphiql@^0.5.0` with `@softistx/graxia` 0.20 (or `^0.4.0` with 0.18 or 0.19).
|
|
891
891
|
|
|
892
892
|
### The IDE page is blank
|
|
893
893
|
|
|
894
894
|
**When:** GraphiQL or Apollo Sandbox loads an empty page, and the browser
|
|
895
895
|
console reports scripts refused by the `Content-Security-Policy`.
|
|
896
896
|
|
|
897
|
-
**Why:** the endpoint sends the IDE with a policy that lets it load its
|
|
898
|
-
|
|
897
|
+
**Why:** the endpoint sends the IDE with a policy that lets it load its own
|
|
898
|
+
files (GraphiQL serves them itself). A middleware of the app that sets its
|
|
899
899
|
own `Content-Security-Policy` on every response replaces it.
|
|
900
900
|
`@softistx/alxia-secure-headers` does not: it keeps a policy a response already has.
|
|
901
|
+
With `@softistx/graxia-graphiql` 0.5, a policy of your own that replaces it must
|
|
902
|
+
allow `worker-src 'self'`, or the editors lose completion and validation.
|
|
901
903
|
|
|
902
904
|
**Fix:** set the app's policy only where none is set
|
|
903
905
|
([With `@softistx/alxia-secure-headers`](guide/ide.md#with-softistxalxia-secure-headers)):
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softistx/alxia-graphql",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.1",
|
|
4
4
|
"description": "GraphQL for alxia served by @softistx/graxia: its plugins, subscriptions over SSE or WebSocket and GraphiQL, behind the app's hooks, its resolvers reading the app's typed context",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -47,24 +47,24 @@
|
|
|
47
47
|
]
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@softistx/alxia": "^0.
|
|
51
|
-
"@softistx/alxia-logger": "^0.7.
|
|
52
|
-
"@softistx/alxia-telemetry": "^0.10.
|
|
50
|
+
"@softistx/alxia": "^0.29.0",
|
|
51
|
+
"@softistx/alxia-logger": "^0.7.1",
|
|
52
|
+
"@softistx/alxia-telemetry": "^0.10.1",
|
|
53
53
|
"@envelop/core": "^6.0.1",
|
|
54
54
|
"@envelop/depth-limit": "^7.2.1",
|
|
55
|
-
"@softistx/graxia": "^0.
|
|
56
|
-
"@softistx/graxia-envelop": "^0.2.
|
|
57
|
-
"@softistx/graxia-graphiql": "^0.
|
|
55
|
+
"@softistx/graxia": "^0.20.1",
|
|
56
|
+
"@softistx/graxia-envelop": "^0.2.5",
|
|
57
|
+
"@softistx/graxia-graphiql": "^0.5.1",
|
|
58
58
|
"@softistx/telemetry": "^0.5.0",
|
|
59
59
|
"@types/bun": "^1.4.5",
|
|
60
60
|
"dataloader": "^2.2.3",
|
|
61
61
|
"graphql": "^17.1.0"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@softistx/alxia": "^0.
|
|
64
|
+
"@softistx/alxia": "^0.29.0",
|
|
65
65
|
"graphql": "^17.1.0",
|
|
66
66
|
"typescript": "^6.0.3 || ^7.0.0",
|
|
67
|
-
"@softistx/graxia": "^0.
|
|
68
|
-
"@softistx/graxia-graphiql": "^0.4.0"
|
|
67
|
+
"@softistx/graxia": "^0.18.0 || ^0.19.0 || ^0.20.0",
|
|
68
|
+
"@softistx/graxia-graphiql": "^0.4.0 || ^0.5.0"
|
|
69
69
|
}
|
|
70
70
|
}
|