@softistx/alxia-graphql 0.21.0 → 0.21.2

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.
@@ -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
@@ -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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softistx/alxia-graphql",
3
- "version": "0.21.0",
3
+ "version": "0.21.2",
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",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "publishConfig": {
35
35
  "registry": "https://registry.npmjs.org",
36
- "access": "restricted"
36
+ "access": "public"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "bun run ../../build.ts",
@@ -47,13 +47,13 @@
47
47
  ]
48
48
  },
49
49
  "devDependencies": {
50
- "@softistx/alxia": "^0.28.0",
51
- "@softistx/alxia-logger": "^0.7.0",
52
- "@softistx/alxia-telemetry": "^0.10.0",
50
+ "@softistx/alxia": "^0.29.1",
51
+ "@softistx/alxia-logger": "^0.7.2",
52
+ "@softistx/alxia-telemetry": "^0.10.2",
53
53
  "@envelop/core": "^6.0.1",
54
54
  "@envelop/depth-limit": "^7.2.1",
55
55
  "@softistx/graxia": "^0.20.1",
56
- "@softistx/graxia-envelop": "^0.2.2",
56
+ "@softistx/graxia-envelop": "^0.2.5",
57
57
  "@softistx/graxia-graphiql": "^0.5.1",
58
58
  "@softistx/telemetry": "^0.5.0",
59
59
  "@types/bun": "^1.4.5",
@@ -61,7 +61,7 @@
61
61
  "graphql": "^17.1.0"
62
62
  },
63
63
  "peerDependencies": {
64
- "@softistx/alxia": "^0.28.0",
64
+ "@softistx/alxia": "^0.29.1",
65
65
  "graphql": "^17.1.0",
66
66
  "typescript": "^6.0.3 || ^7.0.0",
67
67
  "@softistx/graxia": "^0.18.0 || ^0.19.0 || ^0.20.0",