@alxia/graphql 0.16.5 → 0.18.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.
Files changed (74) hide show
  1. package/README.md +60 -62
  2. package/dist/endpoint.d.ts +14 -2
  3. package/dist/endpoint.d.ts.map +1 -1
  4. package/dist/executor.d.ts +20 -37
  5. package/dist/executor.d.ts.map +1 -1
  6. package/dist/explorer.d.ts +24 -0
  7. package/dist/explorer.d.ts.map +1 -0
  8. package/dist/graphql.d.ts +32 -95
  9. package/dist/graphql.d.ts.map +1 -1
  10. package/dist/handler.d.ts +7 -34
  11. package/dist/handler.d.ts.map +1 -1
  12. package/dist/index.d.ts +3 -4
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +301 -1011
  15. package/dist/index.js.map +14 -23
  16. package/dist/once-per-request.d.ts +5 -0
  17. package/dist/once-per-request.d.ts.map +1 -1
  18. package/dist/operation.d.ts +2 -7
  19. package/dist/operation.d.ts.map +1 -1
  20. package/dist/options.d.ts +38 -0
  21. package/dist/options.d.ts.map +1 -0
  22. package/dist/removed.d.ts +14 -0
  23. package/dist/removed.d.ts.map +1 -0
  24. package/dist/sandbox.d.ts +3 -17
  25. package/dist/sandbox.d.ts.map +1 -1
  26. package/dist/testing/client.d.ts +9 -7
  27. package/dist/testing/client.d.ts.map +1 -1
  28. package/dist/testing/index.js +5 -1
  29. package/dist/testing/index.js.map +3 -3
  30. package/dist/ws.d.ts +18 -30
  31. package/dist/ws.d.ts.map +1 -1
  32. package/docs/README.md +3 -2
  33. package/docs/guide/context.md +40 -32
  34. package/docs/guide/endpoint.md +42 -27
  35. package/docs/guide/executor.md +23 -8
  36. package/docs/guide/ide.md +27 -64
  37. package/docs/guide/{yoga.md → plugins.md} +87 -72
  38. package/docs/guide/production.md +115 -196
  39. package/docs/guide/testing.md +24 -24
  40. package/docs/guide/websockets.md +21 -14
  41. package/docs/migrating-to-graxia.md +283 -0
  42. package/docs/roadmap.md +7 -11
  43. package/docs/troubleshooting.md +231 -248
  44. package/package.json +15 -22
  45. package/dist/body-refusal.d.ts +0 -25
  46. package/dist/body-refusal.d.ts.map +0 -1
  47. package/dist/document-cache.d.ts +0 -39
  48. package/dist/document-cache.d.ts.map +0 -1
  49. package/dist/field-rate-limit/count.d.ts +0 -28
  50. package/dist/field-rate-limit/count.d.ts.map +0 -1
  51. package/dist/field-rate-limit/from-store.d.ts +0 -21
  52. package/dist/field-rate-limit/from-store.d.ts.map +0 -1
  53. package/dist/field-rate-limit/index.d.ts +0 -5
  54. package/dist/field-rate-limit/index.d.ts.map +0 -1
  55. package/dist/field-rate-limit/ipv6-network.d.ts +0 -8
  56. package/dist/field-rate-limit/ipv6-network.d.ts.map +0 -1
  57. package/dist/field-rate-limit/plugin.d.ts +0 -28
  58. package/dist/field-rate-limit/plugin.d.ts.map +0 -1
  59. package/dist/field-rate-limit/types.d.ts +0 -60
  60. package/dist/field-rate-limit/types.d.ts.map +0 -1
  61. package/dist/nesting.d.ts +0 -18
  62. package/dist/nesting.d.ts.map +0 -1
  63. package/dist/parse-limits.d.ts +0 -50
  64. package/dist/parse-limits.d.ts.map +0 -1
  65. package/dist/same-origin/index.d.ts +0 -2
  66. package/dist/same-origin/index.d.ts.map +0 -1
  67. package/dist/same-origin/same-origin.d.ts +0 -30
  68. package/dist/same-origin/same-origin.d.ts.map +0 -1
  69. package/dist/ws-operations.d.ts +0 -31
  70. package/dist/ws-operations.d.ts.map +0 -1
  71. package/dist/ws-server.d.ts +0 -32
  72. package/dist/ws-server.d.ts.map +0 -1
  73. package/dist/yoga.d.ts +0 -12
  74. package/dist/yoga.d.ts.map +0 -1
package/dist/handler.d.ts CHANGED
@@ -1,38 +1,11 @@
1
- /**
2
- * The endpoint behind `graphql()`: one Yoga per path it is served at, and
3
- * the route handler that hands each request to it.
4
- */
1
+ /** The route handler of the endpoint behind `graphql()`: each request goes to graxia. */
5
2
  import { type BaseContext, type StatusCode } from '@alxia/core';
6
- import { type YogaServerInstance, type YogaServerOptions } from 'graphql-yoga';
7
- import { type SandboxOptions } from './sandbox';
8
- export type YogaContext = Record<string, any>;
9
- /**
10
- * What GraphiQL's page may load: its scripts, styles and Monaco's
11
- * workers from the exact version of `@graphql-yoga/graphiql` the page
12
- * names, fetched and run as blobs; queries to this server alone; framed
13
- * by no one. A page that names none (a `renderGraphiQL` of the app's own)
14
- * gets this server alone. `@alxia/secure-headers` keeps a policy a
15
- * response already has.
16
- */
17
- export declare function graphiqlPolicy(html: string): string;
18
- /**
19
- * The Yoga serving `endpoint`, created on first use. One per path: a plugin
20
- * mounted under a prefix serves the same routes at a longer path, and
21
- * GraphiQL must ask that one.
22
- */
23
- export declare function yogaServers<UserCtx extends YogaContext>(options: Omit<YogaServerOptions<YogaContext, UserCtx>, 'graphqlEndpoint'>, caches?: () => YogaServerOptions<YogaContext, UserCtx>['parserAndValidationCache']): (endpoint: string) => YogaServerInstance<YogaContext, UserCtx>;
24
- /**
25
- * What Yoga is handed as its server context: the route's context — the
26
- * middlewares' work — minus what a resolver has no use for.
27
- */
3
+ import type { Graxia } from '@graxia/core';
4
+ import type { DevOfRequest } from './explorer';
5
+ export type GraphQLServerContext = Record<string, any>;
6
+ /** What graxia is handed as its server context: the route's, minus what a resolver has no use for. */
28
7
  export declare function serverContext(ctx: Record<string, unknown>): Record<string, unknown>;
29
- /**
30
- * The handler of the endpoint's `GET` and `POST`: Apollo Sandbox's page to
31
- * a browser when `sandbox` is not `false`, else the request to Yoga, with
32
- * the route's context — the middlewares' work, minus what a resolver has no use
33
- * for — as Yoga's server context.
34
- */
35
- export declare function graphqlHandler<UserCtx extends YogaContext>(yogaAt: (endpoint: string) => YogaServerInstance<YogaContext, UserCtx>, sandbox: SandboxOptions | false): (ctx: Record<string, unknown> & BaseContext & {
8
+ export declare function graphqlHandler(graxia: Graxia<any>, devs: DevOfRequest): (ctx: Record<string, unknown> & BaseContext & {
36
9
  readonly route: string;
37
- }) => Promise<import("@alxia/core").Reply<StatusCode, string> | import("@alxia/core").Reply<StatusCode, ReadableStream<Uint8Array<ArrayBufferLike>>>>;
10
+ }) => Promise<import("@alxia/core").Reply<StatusCode, ReadableStream<Uint8Array<ArrayBufferLike>>>>;
38
11
  //# sourceMappingURL=handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACN,KAAK,WAAW,EAChB,KAAK,UAAU,EAGf,MAAM,aAAa,CAAC;AACrB,OAAO,EAEN,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAiC,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAE/E,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAM9C;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAanD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,SAAS,WAAW,EACtD,OAAO,EAAE,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE,iBAAiB,CAAC,EACzE,MAAM,CAAC,EAAE,MAAM,iBAAiB,CAC/B,WAAW,EACX,OAAO,CACP,CAAC,0BAA0B,CAAC,GAC3B,CAAC,QAAQ,EAAE,MAAM,KAAK,kBAAkB,CAAC,WAAW,EAAE,OAAO,CAAC,CAchE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC5B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC1B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAYzB;AAUD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,SAAS,WAAW,EACzD,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,kBAAkB,CAAC,WAAW,EAAE,OAAO,CAAC,EACtE,OAAO,EAAE,cAAc,GAAG,KAAK,IAK9B,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,WAAW,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,qJAsDxE"}
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EACN,KAAK,WAAW,EAEhB,KAAK,UAAU,EAEf,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAEvD,sGAAsG;AACtG,wBAAgB,aAAa,CAC5B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC1B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAYzB;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,YAAY,IAEpE,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,WAAW,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,mGAaxE"}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,8 @@
1
+ export { type CostlessStore, type FieldDecision, type FieldLimit, type FieldRateLimitOptions, type FieldRule, fieldRateLimit, type GraxiaErrorCode, limitFromStore, } from '@graxia/core';
1
2
  export { type BoundedStreamOptions, boundedStream } from './bounded-stream';
2
3
  export { type ExecutorCall, type ExecutorError, type ExecutorRequest, type ExecutorResult, type GraphQLExecutor, type GraphQLExecutorOptions, graphqlExecutor, } from './executor';
3
- export { type CostlessStore, type FieldDecision, type FieldLimit, type FieldRateLimitOptions, type FieldRule, fieldRateLimit, limitFromStore, } from './field-rate-limit';
4
- export { type GraphQLContext, type GraphQLOptions, type GraphQLWsContext, graphql, type ServerContext, } from './graphql';
4
+ export { type GraphQLContext, type GraphQLContextInit, type GraphQLOptions, type GraphQLWsContext, graphql, type ServerContext, } from './graphql';
5
5
  export { clearRequestCache, freshPerMutation, oncePerRequest, } from './once-per-request';
6
- export { type SameOriginOptions, sameOrigin } from './same-origin';
7
- export { renderSandbox, SANDBOX_POLICY, type SandboxOptions } from './sandbox';
6
+ export type { SandboxOptions } from './sandbox';
8
7
  export type { GraphQLWsOptions } from './ws';
9
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,eAAe,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,cAAc,EACd,cAAc,GACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,OAAO,EACP,KAAK,aAAa,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,GACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,iBAAiB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAC/E,YAAY,EAAE,gBAAgB,EAAE,MAAM,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,cAAc,EACd,KAAK,eAAe,EACpB,cAAc,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,oBAAoB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,eAAe,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,OAAO,EACP,KAAK,aAAa,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,GACd,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,YAAY,EAAE,gBAAgB,EAAE,MAAM,MAAM,CAAC"}