@alxia/graphql 0.18.2 → 0.18.4

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 CHANGED
@@ -13,7 +13,7 @@ bun add -d typescript
13
13
  bun add @graxia/envelop @envelop/depth-limit # install yourself to use Envelop plugins
14
14
  ```
15
15
 
16
- `@graxia/core` (`^0.10.0 || ^0.11.0`), `@graxia/graphiql` (`^0.2.4`) and `graphql` (17.1 or later) are peers:
16
+ `@graxia/core` (`^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0`), `@graxia/graphiql` (`^0.2.4`) and `graphql` (17.1 or later) are peers:
17
17
  the package declares no dependency. `@graxia/graphiql` serves the IDE and is
18
18
  required. CSRF protection is graxia's default (on): a `GET` needs one of the
19
19
  `x-graphql-csrf`, `graphql-require-preflight`, `apollo-require-preflight` or
@@ -1,3 +1,3 @@
1
1
  /** A graxia plugin reporting each operation graxia executes or subscribes to. */
2
- export declare function reportsOperations(): import("@graxia/core").GraxiaPlugin<import("@graxia/core").Empty, import("@graxia/core").Empty>;
2
+ export declare function reportsOperations(): import("@graxia/core").GraxiaPlugin<import("@graxia/core").Empty, import("@graxia/core").Empty, "alxia-report-operations">;
3
3
  //# sourceMappingURL=operation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../src/operation.ts"],"names":[],"mappings":"AAsIA,iFAAiF;AACjF,wBAAgB,iBAAiB,oGAwEhC"}
1
+ {"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../src/operation.ts"],"names":[],"mappings":"AAsIA,iFAAiF;AACjF,wBAAgB,iBAAiB,+HAwEhC"}
@@ -26,7 +26,7 @@ bun add graphql@^17.1.0
26
26
 
27
27
  | Before | After |
28
28
  | --- | --- |
29
- | `graphql-yoga` | `@graxia/core` `^0.10.0 \|\| ^0.11.0` (0.10 sets the HTTP status from errors again) |
29
+ | `graphql-yoga` | `@graxia/core` `^0.10.0 \|\| ^0.11.0 \|\| ^0.12.0 \|\| ^0.13.0` (0.10 sets the HTTP status from errors again) |
30
30
  | `graphql-ws` (for `ws`) | nothing: graxia speaks `graphql-transport-ws` |
31
31
  | bundled GraphiQL of Yoga | `@graxia/graphiql` `^0.2.4` (required) |
32
32
  | Envelop plugins | not a peer: install `@graxia/envelop` yourself to use Envelop plugins |
@@ -69,6 +69,14 @@ schema (a directive the SDL already declares is kept). A `schema.graphql`
69
69
  printed from the Yoga schema, or a snapshot of it, no longer matches: print it
70
70
  again from the new schema and commit the result.
71
71
 
72
+ A schema that graphql's own `graphql()` or `execute()` also runs (a second
73
+ endpoint, a script, a spec that skips graxia) needs `incremental: false`.
74
+ On a schema that declares `@defer` and `@stream`, graphql's `graphql()` and
75
+ `execute()` throw "The provided schema unexpectedly contains experimental
76
+ directives (@defer or @stream)…", so every spec that runs that schema fails
77
+ at once. With `incremental: false` that schema serves no `@defer` or
78
+ `@stream`. See graxia's [schema guide](https://github.com/softistx/graxia/blob/develop/packages/core/docs/guide/schema.md).
79
+
72
80
  ```ts
73
81
  // file: src/schema-maps.ts
74
82
  import { createSchema } from '@graxia/core';
@@ -132,9 +140,15 @@ export const plugins = [fromEnvelop([useDepthLimit({ maxDepth: 8 })])];
132
140
  ```
133
141
 
134
142
  **Janus.** `useJanus()` was a Yoga plugin. Use `@softistx/janus-graphql`
135
- `^0.36.2` (or later) and its `/graxia` entry, `janusGraxia(options)`, in `plugins`.
143
+ `^0.37.0` (or later) and its `/graxia` entry, `janusGraxia(options)`, in `plugins`.
136
144
  `fromEnvelop` refuses the old plugin at boot, since it relies on Yoga's
137
- `onResponse` hook; wrapping it is not a way around.
145
+ `onResponse` hook; wrapping it is not a way around. If the app renames error
146
+ codes with `mapCode`, pass the same `mapCode` to `janusGraxia` and
147
+ `janusGraxiaMaskError`: from 0.37.0 `janusGraxia` maps the codes of every
148
+ result (janus denials, already-coded errors, each subscription event and
149
+ `@defer` payload), and `janusGraxiaMaskError` those of the errors graxia masks.
150
+ See janus-graphql's
151
+ [graxia guide](https://github.com/softistx/nxgt-janus/blob/develop/packages/janus-graphql/docs/guide/graxia.md).
138
152
 
139
153
  ```diff
140
154
  -import { useJanus } from '@softistx/janus-graphql';
@@ -323,7 +337,8 @@ prefix, `GraphQLContext<typeof app>`, `oncePerRequest`, `freshPerMutation`,
323
337
  3. Import `createSchema` from `@graxia/core` and curry it: `createSchema<Ctx>()({ … })`;
324
338
  pass several resolver maps as an array, not a cast; print `schema.graphql`
325
339
  again (graxia adds `@cost`, `@listSize` and, unless `incremental: false`,
326
- `@defer`, `@stream`).
340
+ `@defer`, `@stream`); build with `incremental: false` a schema that
341
+ graphql's plain `graphql()` or `execute()` also runs.
327
342
  4. Annotate the `context` option's argument with `ServerContext`, and read the
328
343
  app's values from `serverContext`.
329
344
  5. Rewrite each Yoga plugin (`definePlugin`) or wrap it (`fromEnvelop`), the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alxia/graphql",
3
- "version": "0.18.2",
3
+ "version": "0.18.4",
4
4
  "description": "GraphQL for alxia served by @graxia/core: 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",
@@ -52,9 +52,9 @@
52
52
  "@alxia/telemetry": "^0.9.4",
53
53
  "@envelop/core": "^6.0.1",
54
54
  "@envelop/depth-limit": "^7.2.1",
55
- "@graxia/core": "^0.11.0",
56
- "@graxia/envelop": "^0.1.5",
57
- "@graxia/graphiql": "^0.2.5",
55
+ "@graxia/core": "^0.13.0",
56
+ "@graxia/envelop": "^0.1.7",
57
+ "@graxia/graphiql": "^0.2.7",
58
58
  "@softistx/telemetry": "^0.5.0",
59
59
  "@types/bun": "^1.4.4",
60
60
  "dataloader": "^2.2.3",
@@ -64,7 +64,7 @@
64
64
  "@alxia/core": "^0.27.0",
65
65
  "graphql": "^17.1.0",
66
66
  "typescript": "^6.0.3 || ^7.0.0",
67
- "@graxia/core": "^0.10.0 || ^0.11.0",
67
+ "@graxia/core": "^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0",
68
68
  "@graxia/graphiql": "^0.2.4"
69
69
  }
70
70
  }