@alxia/graphql 0.9.0 → 0.9.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.
package/README.md CHANGED
@@ -210,6 +210,7 @@ alone: a WebSocket `subscribe` message is bounded by Bun's `maxPayloadLength`
210
210
  graphql(app, {
211
211
  schema,
212
212
  maxTokens: 20_000, // false: no cap
213
+ maxNesting: 2_000, // 1 000 by default; false: no cap
213
214
  parseCache: { maxBytes: 32 * 1024 * 1024, max: 512, ttl: 30 * 60_000 }, // false: no cache
214
215
  bodyLimit: 5 * 1024 * 1024, // 1 MiB by default; a multipart upload needs more
215
216
  });
@@ -1 +1 @@
1
- {"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../src/endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAK1C,8EAA8E;AAC9E,wBAAgB,eAAe,CAC9B,GAAG,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,EACzB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,MAAM,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,GAAG,SAAS,GAClD,IAAI,CAkBN"}
1
+ {"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../src/endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAK1C,8EAA8E;AAC9E,wBAAgB,eAAe,CAC9B,GAAG,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,EACzB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,MAAM,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,GAAG,SAAS,GAClD,IAAI,CAoBN"}
package/dist/index.js CHANGED
@@ -9,7 +9,11 @@ function declareEndpoint(app, path, handler, bodyLimit, socket) {
9
9
  const route = app;
10
10
  route.get(path, handler);
11
11
  const inherited = app.routes.at(-1)?.bodyLimit;
12
- route.post(path, { bodyLimit: bodyLimit ?? inherited ?? DEFAULT_BODY_LIMIT }, handler);
12
+ const own = bodyLimit ?? (inherited === undefined ? DEFAULT_BODY_LIMIT : undefined);
13
+ if (own === undefined)
14
+ route.post(path, handler);
15
+ else
16
+ route.post(path, { bodyLimit: own }, handler);
13
17
  if (socket !== undefined) {
14
18
  route.ws(socket.path, socket.middleware, socket.handlers);
15
19
  }
@@ -748,5 +752,5 @@ export {
748
752
  renderSandbox
749
753
  };
750
754
 
751
- //# debugId=01B66A2C6AD2881F64756E2164756E21
755
+ //# debugId=F7B8A34A3653EE8C64756E2164756E21
752
756
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -3,7 +3,7 @@
3
3
  "sources": ["../src/graphql.ts", "../src/endpoint.ts", "../src/handler.ts", "../src/body-refusal.ts", "../src/sandbox.ts", "../src/operation.ts", "../src/parse-limits.ts", "../src/document-cache.ts", "../src/nesting.ts", "../src/ws-operations.ts", "../src/ws-server.ts", "../src/ws.ts"],
4
4
  "sourcesContent": [
5
5
  "import {\n\ttype Alxia,\n\ttype BaseContext,\n\ttype Empty,\n\tisDev,\n\ttype RoutePath,\n} from '@alxia/core';\nimport type {\n\tGraphQLSchemaWithContext,\n\tYogaInitialContext,\n\tYogaServerOptions,\n} from 'graphql-yoga';\nimport { declareEndpoint } from './endpoint';\nimport { graphqlHandler, type YogaContext, yogaServers } from './handler';\nimport { reportsOperations } from './operation';\nimport {\n\tlimitsParsing,\n\ttype ParseCacheOptions,\n\tparseCaches,\n\tresolveLimits,\n} from './parse-limits';\nimport type { SandboxOptions } from './sandbox';\nimport { type GraphQLWsOptions, graphqlSocket } from './ws';\n\n/** The parts of a route's context Yoga owns, or that mean nothing to a resolver. */\ntype RouteOnly =\n\t| 'params'\n\t| 'query'\n\t| 'headers'\n\t| 'cookies'\n\t| 'body'\n\t| 'reply'\n\t| 'redirect';\n\n/**\n * What alxia hands Yoga for each request: the context its middlewares built —\n * `user`, `db`, `log`… — with `request`, `url`, `ip` and `set`, through\n * which a resolver sets a cookie or a header on the response.\n */\nexport type ServerContext<Ctx> = Omit<BaseContext & Ctx, RouteOnly>;\n\n/**\n * What an operation over WebSocket adds to its context (`ws` on): the\n * `connectionParams` the client sent when it connected. `undefined` over\n * HTTP, and for a client that sent none.\n */\nexport interface GraphQLWsContext {\n\treadonly connectionParams?: Readonly<Record<string, unknown>>;\n}\n\n/**\n * What a resolver reads as its context: Yoga's own, the app's, what\n * the `context` option adds, and over WebSocket the `connectionParams`. Type a schema with it:\n *\n * ```ts\n * const base = alxia().use(bearer({ jwt }));\n * const schema = createSchema<GraphQLContext<typeof base>>({ ... });\n * ```\n */\nexport type GraphQLContext<App, UserContext = Empty> = App extends {\n\treadonly '~context': infer Ctx;\n}\n\t? YogaInitialContext & ServerContext<Ctx> & GraphQLWsContext & UserContext\n\t: // Not `never`: a schema typed with `never` would let every resolver\n\t\t// read anything until `graphql()` refused it.\n\t\t{\n\t\t\treadonly '~error': 'GraphQLContext needs the type of an app: GraphQLContext<typeof app>';\n\t\t};\n\nexport interface GraphQLOptions<\n\tServerCtx extends YogaContext,\n\tUserCtx extends YogaContext,\n\tPath extends RoutePath,\n\tSchemaCtx = unknown,\n> extends Omit<\n\t\tYogaServerOptions<ServerCtx, UserCtx>,\n\t\t'graphqlEndpoint' | 'cors' | 'schema' | 'graphiql'\n\t> {\n\t/**\n\t * What a browser gets at the endpoint: Yoga's GraphiQL, Apollo Sandbox,\n\t * or nothing. By default, GraphiQL in the serving app's dev alone\n\t * (`isDev`: `alxia({ dev })`, else `NODE_ENV=development`), nothing\n\t * otherwise; `graphiql` or `apollo-sandbox` serves one everywhere.\n\t */\n\treadonly ide?: 'graphiql' | 'apollo-sandbox' | false;\n\t/** GraphiQL's options, Yoga's own, when `ide` is `graphiql`. */\n\treadonly graphiql?: Exclude<\n\t\tYogaServerOptions<ServerCtx, UserCtx>['graphiql'],\n\t\tboolean\n\t>;\n\t/** Apollo Sandbox's options, when `ide` is `apollo-sandbox`. */\n\treadonly sandbox?: SandboxOptions;\n\t/**\n\t * The schema, from Yoga's `createSchema`, Pothos, or any tool that types\n\t * its context. Its context must be one the app builds: a resolver that\n\t * reads `user` behind no middleware that adds one is a compile error.\n\t */\n\treadonly schema: GraphQLSchemaWithContext<SchemaCtx>;\n\t/** Where the endpoint is, under the app's prefix. `/graphql` by default. */\n\treadonly path?: Path;\n\t/**\n\t * Yoga's own CORS. Off by default: `@alxia/cors` answers for the whole\n\t * app, this endpoint included.\n\t */\n\treadonly cors?: YogaServerOptions<ServerCtx, UserCtx>['cors'];\n\t/**\n\t * GraphQL over WebSocket too, the `graphql-transport-ws` protocol of\n\t * Apollo Client's and urql's default link, served by the optional peer\n\t * `graphql-ws` at the endpoint's path: `true`, or where and how often it\n\t * pings. Off by default: subscriptions are served over server-sent\n\t * events, which stay served beside it.\n\t */\n\treadonly ws?: boolean | GraphQLWsOptions;\n\t/**\n\t * The most tokens a document may hold, 15 000 by default (Apollo\n\t * Router's own), or `false` for no cap. A longer document is refused by\n\t * the parser before anything runs, as Yoga refuses any document it\n\t * cannot parse: `GRAPHQL_PARSE_FAILED`.\n\t */\n\treadonly maxTokens?: number | false;\n\t/**\n\t * The most levels of `{`, `(` and `[` a document may nest, 1 000 by\n\t * default, or `false` for no limit. A deeper document is refused before\n\t * the parser recurses into it, as `GRAPHQL_PARSE_FAILED`: graphql-js\n\t * overflows the stack a few thousand levels down, well under\n\t * `maxTokens`. A document that overflows it anyway is refused the same\n\t * way.\n\t */\n\treadonly maxNesting?: number | false;\n\t/**\n\t * The cache of parsed documents, one per endpoint, weighed by its tokens and bytes:\n\t * `maxBytes` (64 MiB by default), `max` documents (1 024) and `ttl`\n\t * milliseconds (one hour). `false` parses every request. Yoga's own\n\t * `parserAndValidationCache` replaces it, and cannot be given with it.\n\t */\n\treadonly parseCache?: false | ParseCacheOptions;\n\t/**\n\t * The most bytes a `POST` body may hold, over which core answers a 413.\n\t * Without it, the `bodyLimit()` the app declared before `graphql()`\n\t * applies as it is; without that, 1 MiB. An upload through a\n\t * `multipart` mutation needs a larger one.\n\t */\n\treadonly bodyLimit?: number;\n}\n\n/**\n * The check Yoga's types leave out: the context the app builds must hold\n * what the schema's resolvers read. A mistake comes back as a `schema`\n * whose type is the message.\n */\ntype ProvidesContext<Provided, Required> = Provided extends Required\n\t? unknown\n\t: {\n\t\t\treadonly schema: `the schema's resolvers read a context the app does not build: missing ${Exclude<\n\t\t\t\tkeyof Required,\n\t\t\t\tkeyof Provided\n\t\t\t> &\n\t\t\t\tstring}`;\n\t\t};\n\n/**\n * A GraphQL endpoint on `app`, served by [GraphQL Yoga](https://the-guild.dev/graphql/yoga-server):\n * `GET` and `POST` at `path`, behind every middleware given to `use` on `app`\n * before it. A guard before it guards it; what the middlewares added is in each\n * resolver's context, typed. Yoga's options pass through — `plugins`\n * (Envelop's and Yoga's), `graphiql`, `maskedErrors`, `batching`… —\n * and subscriptions are served over server-sent events, and over\n * WebSocket too with `ws: true`.\n *\n * ```ts\n * const app = alxia()\n * .use(bearer({ jwt }))\n * .plugin((app) => graphql(app, { schema, plugins: [useDepthLimit()] }));\n * ```\n */\nexport function graphql<\n\tCtx extends object,\n\tPrefix extends string,\n\tSchemaCtx,\n\tUserCtx extends YogaContext = Empty,\n\tconst Path extends RoutePath = '/graphql',\n>(\n\tapp: Alxia<Ctx, Prefix>,\n\toptions: GraphQLOptions<ServerContext<Ctx>, UserCtx, Path, SchemaCtx> &\n\t\tProvidesContext<\n\t\t\tYogaInitialContext & ServerContext<Ctx> & UserCtx,\n\t\t\tSchemaCtx\n\t\t>,\n): Alxia<Ctx, Prefix> {\n\tconst {\n\t\tpath = '/graphql' as Path,\n\t\tcors = false,\n\t\tide,\n\t\tgraphiql,\n\t\tsandbox,\n\t\tws = false,\n\t\tmaxTokens,\n\t\tmaxNesting,\n\t\tparseCache,\n\t\tbodyLimit,\n\t\t...yogaOptions\n\t} = options;\n\tconst limits = resolveLimits(maxTokens, maxNesting, parseCache, yogaOptions);\n\tconst page = graphiql ?? true;\n\tconst yogaAt = yogaServers<UserCtx>(\n\t\t{\n\t\t\t...(yogaOptions as YogaServerOptions<YogaContext, UserCtx>),\n\t\t\tplugins: [\n\t\t\t\tlimitsParsing(limits.tokens, limits.depth),\n\t\t\t\t...(yogaOptions.plugins ?? []),\n\t\t\t\treportsOperations(),\n\t\t\t],\n\t\t\tcors,\n\t\t\tgraphiql: (ide === undefined\n\t\t\t\t? (_request: Request, context: object) => isDev(context) && page\n\t\t\t\t: ide === 'graphiql'\n\t\t\t\t\t? page\n\t\t\t\t\t: false) as YogaServerOptions<YogaContext, UserCtx>['graphiql'],\n\t\t},\n\t\tyogaOptions.parserAndValidationCache === undefined\n\t\t\t? () => parseCaches(parseCache)\n\t\t\t: undefined,\n\t);\n\tconst handler = graphqlHandler(\n\t\tyogaAt,\n\t\tide === 'apollo-sandbox' ? (sandbox ?? {}) : false,\n\t);\n\n\tdeclareEndpoint(\n\t\tapp as never,\n\t\tpath,\n\t\thandler,\n\t\tbodyLimit,\n\t\tws === false\n\t\t\t? undefined\n\t\t\t: graphqlSocket(yogaAt, path, ws === true ? {} : ws),\n\t);\n\treturn app as never;\n}\n",
6
- "import type { Alxia } from '@alxia/core';\nimport type { graphqlSocket } from './ws';\n\n/** The body limit of a `POST` when neither the option nor the app gives one: 1 MiB. */\nconst DEFAULT_BODY_LIMIT = 1_048_576;\n\n/** `GET` and `POST` at `path` on `app`, and the WebSocket when `ws` is on. */\nexport function declareEndpoint(\n\tapp: Alxia<never, string>,\n\tpath: string,\n\thandler: unknown,\n\tbodyLimit: number | undefined,\n\tsocket: ReturnType<typeof graphqlSocket> | undefined,\n): void {\n\tconst route = app as unknown as {\n\t\tget(path: string, handler: unknown): unknown;\n\t\tpost(path: string, ...rest: unknown[]): unknown;\n\t\tws(path: string, ...rest: unknown[]): unknown;\n\t};\n\troute.get(path, handler);\n\t// The GET just declared has the POST's scope: the limit an earlier\n\t// `bodyLimit()` gives it is the one the POST keeps.\n\tconst inherited = app.routes.at(-1)?.bodyLimit;\n\troute.post(\n\t\tpath,\n\t\t{ bodyLimit: bodyLimit ?? inherited ?? DEFAULT_BODY_LIMIT },\n\t\thandler,\n\t);\n\tif (socket !== undefined) {\n\t\troute.ws(socket.path, socket.middleware, socket.handlers);\n\t}\n}\n",
6
+ "import type { Alxia } from '@alxia/core';\nimport type { graphqlSocket } from './ws';\n\n/** The body limit of a `POST` when neither the option nor the app gives one: 1 MiB. */\nconst DEFAULT_BODY_LIMIT = 1_048_576;\n\n/** `GET` and `POST` at `path` on `app`, and the WebSocket when `ws` is on. */\nexport function declareEndpoint(\n\tapp: Alxia<never, string>,\n\tpath: string,\n\thandler: unknown,\n\tbodyLimit: number | undefined,\n\tsocket: ReturnType<typeof graphqlSocket> | undefined,\n): void {\n\tconst route = app as unknown as {\n\t\tget(path: string, handler: unknown): unknown;\n\t\tpost(path: string, ...rest: unknown[]): unknown;\n\t\tws(path: string, ...rest: unknown[]): unknown;\n\t};\n\troute.get(path, handler);\n\t// The GET just declared has the POST's scope: a limit an earlier\n\t// `bodyLimit()` gives it is the one the POST keeps, and core refuses a\n\t// declared oversize body where that `bodyLimit()` stands, so the POST\n\t// passes no option of its own then (a route's own option would move the\n\t// refusal to the head of its steps).\n\tconst inherited = app.routes.at(-1)?.bodyLimit;\n\tconst own =\n\t\tbodyLimit ?? (inherited === undefined ? DEFAULT_BODY_LIMIT : undefined);\n\tif (own === undefined) route.post(path, handler);\n\telse route.post(path, { bodyLimit: own }, handler);\n\tif (socket !== undefined) {\n\t\troute.ws(socket.path, socket.middleware, socket.handlers);\n\t}\n}\n",
7
7
  "/**\n * The endpoint behind `graphql()`: one Yoga per path it is served at, and\n * the route handler that hands each request to it.\n */\nimport {\n\ttype BaseContext,\n\ttype StatusCode,\n\tshutdownSignal,\n\tvary,\n} from '@alxia/core';\nimport {\n\tcreateYoga,\n\ttype YogaServerInstance,\n\ttype YogaServerOptions,\n} from 'graphql-yoga';\nimport { watchBody, withoutOriginalError } from './body-refusal';\nimport { renderSandbox, SANDBOX_POLICY, type SandboxOptions } from './sandbox';\n\nexport type YogaContext = Record<string, any>;\n\n/** Where Yoga's GraphiQL page loads its files from: one pinned version on unpkg. */\nconst GRAPHIQL_FILES =\n\t/https:\\/\\/unpkg\\.com\\/@graphql-yoga\\/graphiql@[\\w.-]+\\//;\n\n/**\n * What GraphiQL's page may load: its scripts, styles and Monaco's\n * workers from the exact version of `@graphql-yoga/graphiql` the page\n * names, fetched and run as blobs; queries to this server alone; framed\n * by no one. A page that names none (a `renderGraphiQL` of the app's own)\n * gets this server alone. `@alxia/secure-headers` keeps a policy a\n * response already has.\n */\nexport function graphiqlPolicy(html: string): string {\n\tconst files = html.match(GRAPHIQL_FILES)?.[0] ?? '';\n\tconst from = files === '' ? '' : ` ${files}`;\n\treturn [\n\t\t\"default-src 'self'\",\n\t\t`script-src 'self' 'unsafe-inline'${from}`,\n\t\t`style-src 'self' 'unsafe-inline'${from}`,\n\t\t\"img-src 'self' data: https:\",\n\t\t`font-src 'self' data:${from}`,\n\t\t\"worker-src 'self' blob:\",\n\t\t`connect-src 'self'${from}`,\n\t\t\"frame-ancestors 'none'\",\n\t].join('; ');\n}\n\n/**\n * The Yoga serving `endpoint`, created on first use. One per path: a plugin\n * mounted under a prefix serves the same routes at a longer path, and\n * GraphiQL must ask that one.\n */\nexport function yogaServers<UserCtx extends YogaContext>(\n\toptions: Omit<YogaServerOptions<YogaContext, UserCtx>, 'graphqlEndpoint'>,\n\tcaches?: () => YogaServerOptions<\n\t\tYogaContext,\n\t\tUserCtx\n\t>['parserAndValidationCache'],\n): (endpoint: string) => YogaServerInstance<YogaContext, UserCtx> {\n\tconst servers = new Map<string, YogaServerInstance<YogaContext, UserCtx>>();\n\treturn (endpoint) => {\n\t\tlet yoga = servers.get(endpoint);\n\t\tif (yoga === undefined) {\n\t\t\tyoga = createYoga<YogaContext, UserCtx>({\n\t\t\t\t...options,\n\t\t\t\t...(caches === undefined ? {} : { parserAndValidationCache: caches() }),\n\t\t\t\tgraphqlEndpoint: endpoint,\n\t\t\t});\n\t\t\tservers.set(endpoint, yoga);\n\t\t}\n\t\treturn yoga;\n\t};\n}\n\n/**\n * What Yoga is handed as its server context: the route's context — the\n * middlewares' work — minus what a resolver has no use for.\n */\nexport function serverContext(\n\tctx: Record<string, unknown>,\n): Record<string, unknown> {\n\tconst {\n\t\tparams: _params,\n\t\tquery: _query,\n\t\theaders: _headers,\n\t\tcookies: _cookies,\n\t\tbody: _body,\n\t\treply: _reply,\n\t\tredirect: _redirect,\n\t\t...server\n\t} = ctx;\n\treturn server;\n}\n\n/** Yoga's headers a 413 does not take: they frame or type Yoga's own body. */\nconst REFUSAL_OWN_HEADERS = new Set([\n\t'content-type',\n\t'content-length',\n\t'content-encoding',\n\t'transfer-encoding',\n]);\n\n/**\n * The handler of the endpoint's `GET` and `POST`: Apollo Sandbox's page to\n * a browser when `sandbox` is not `false`, else the request to Yoga, with\n * the route's context — the middlewares' work, minus what a resolver has no use\n * for — as Yoga's server context.\n */\nexport function graphqlHandler<UserCtx extends YogaContext>(\n\tyogaAt: (endpoint: string) => YogaServerInstance<YogaContext, UserCtx>,\n\tsandbox: SandboxOptions | false,\n) {\n\t// A handler's context: its route is the one it was declared at. Named\n\t// `graphql`, the name the route table `listen` prints in dev shows.\n\treturn async function graphql(\n\t\tctx: Record<string, unknown> & BaseContext & { readonly route: string },\n\t) {\n\t\tconst { reply } = ctx;\n\t\tconst server = serverContext(ctx);\n\t\tif (\n\t\t\tsandbox !== false &&\n\t\t\tctx.request.method === 'GET' &&\n\t\t\tctx.request.headers.get('accept')?.includes('text/html') &&\n\t\t\t!ctx.url.searchParams.has('query')\n\t\t) {\n\t\t\t// A path: the page resolves it against its own address, so behind\n\t\t\t// a TLS proxy the Sandbox asks over https, as the browser did.\n\t\t\treturn reply(200, renderSandbox(ctx.route, sandbox), {\n\t\t\t\theaders: {\n\t\t\t\t\t'content-type': 'text/html;charset=utf-8',\n\t\t\t\t\t'content-security-policy': SANDBOX_POLICY,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t\tconst watched = watchBody(ctx.request);\n\t\tconst answered = await yogaAt(ctx.route).fetch(watched.request, server);\n\t\t// Yoga answered a body past `bodyLimit` with its own 400: core's 413\n\t\t// is the answer, in the app's format.\n\t\tconst refusal = watched.refusal();\n\t\tif (refusal !== undefined) {\n\t\t\tvoid answered.body?.cancel();\n\t\t\t// What Yoga's plugins set (`cache-control: no-store`…) stays on the\n\t\t\t// 413; its body and framing are core's.\n\t\t\tfor (const [name, value] of answered.headers) {\n\t\t\t\tif (REFUSAL_OWN_HEADERS.has(name)) continue;\n\t\t\t\tif (name === 'set-cookie') ctx.set.headers.append(name, value);\n\t\t\t\telse if (name === 'vary') {\n\t\t\t\t\t// Added to the app's own, as core's `send` does.\n\t\t\t\t\tfor (const part of value.split(',')) vary(ctx.set.headers, part);\n\t\t\t\t} else ctx.set.headers.set(name, value);\n\t\t\t}\n\t\t\tthrow refusal;\n\t\t}\n\t\tconst response = await withoutOriginalError(answered);\n\t\tconst headers = new Headers(response.headers);\n\t\tif (\n\t\t\theaders.get('content-type')?.startsWith('text/html') &&\n\t\t\t!headers.has('content-security-policy')\n\t\t) {\n\t\t\t// GraphiQL's page: its policy names the files it loads.\n\t\t\tconst html = await response.text();\n\t\t\theaders.set('content-security-policy', graphiqlPolicy(html));\n\t\t\treturn reply(response.status as StatusCode, html, { headers });\n\t\t}\n\t\tconst body = endedOnShutdown(response, shutdownSignal(ctx));\n\t\treturn reply(response.status as StatusCode, body ?? undefined, {\n\t\t\theaders,\n\t\t});\n\t};\n}\n\n/**\n * A subscription's or an incremental delivery's body, which streams until\n * its reader stops: ended when the app starts shutting down — Yoga's\n * stream cancelled, as when the client leaves, and the client reading its\n * end — so the drain does not wait for it. Any other body finishes within\n * the drain as it is.\n */\nfunction endedOnShutdown(\n\tresponse: Response,\n\tsignal: AbortSignal,\n): ReadableStream<Uint8Array> | null {\n\tconst body = response.body;\n\tconst type = response.headers.get('content-type') ?? '';\n\tif (body === null || !/text\\/event-stream|multipart\\/mixed/.test(type)) {\n\t\treturn body;\n\t}\n\tconst reader = body.getReader();\n\t// The signal lives as long as the process: the listener goes as soon as\n\t// the stream is over, however it ended, or each response would leave one.\n\tconst end = () => {\n\t\tsignal.removeEventListener('abort', end);\n\t\tvoid reader.cancel();\n\t\ttry {\n\t\t\tcontroller.close();\n\t\t} catch {\n\t\t\t// Closed already: the stream had ended.\n\t\t}\n\t};\n\tlet controller: ReadableStreamDefaultController<Uint8Array>;\n\treturn new ReadableStream<Uint8Array>({\n\t\tstart(started) {\n\t\t\tcontroller = started;\n\t\t\tif (signal.aborted) end();\n\t\t\telse signal.addEventListener('abort', end, { once: true });\n\t\t},\n\t\tasync pull(controller) {\n\t\t\tconst result = await reader.read().catch((error: unknown) => {\n\t\t\t\tsignal.removeEventListener('abort', end);\n\t\t\t\tthrow error;\n\t\t\t});\n\t\t\tif (result.done) {\n\t\t\t\tsignal.removeEventListener('abort', end);\n\t\t\t\ttry {\n\t\t\t\t\tcontroller.close();\n\t\t\t\t} catch {\n\t\t\t\t\t// Closed already: the shutdown ended it.\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcontroller.enqueue(result.value);\n\t\t},\n\t\tcancel: (reason) => {\n\t\t\tsignal.removeEventListener('abort', end);\n\t\t\treturn reader.cancel(reason);\n\t\t},\n\t});\n}\n",
8
8
  "/**\n * Yoga reads the request body itself, and turns any failure of the read\n * into its own 400. A body past core's `bodyLimit` fails the read with a\n * `ContentTooLargeError`; `watchBody` keeps that error and hands Yoga its\n * own 413 error in its place, so Yoga logs nothing, and the handler can\n * throw core's again once Yoga has answered: the app's own boundary\n * answers the 413 in its error format, leaking nothing of Yoga's.\n */\nimport type { ContentTooLargeError } from '@alxia/core';\nimport { GraphQLError } from 'graphql';\n\n/**\n * By its name and its limit, not `instanceof`: the copy of core that\n * limited the body may not be the one this package resolves.\n */\nfunction isTooLarge(error: unknown): error is ContentTooLargeError {\n\treturn (\n\t\terror instanceof Error &&\n\t\terror.name === 'ContentTooLargeError' &&\n\t\ttypeof (error as { limit?: unknown }).limit === 'number'\n\t);\n}\n\nexport interface WatchedRequest {\n\t/** The request to hand to Yoga: the same, its body watched. */\n\treadonly request: Request;\n\t/** The `ContentTooLargeError` the body's read failed with, if it did. */\n\trefusal(): ContentTooLargeError | undefined;\n}\n\n/** `request` with its body's failure recorded; a request with no body is as it is. */\nexport function watchBody(request: Request): WatchedRequest {\n\tconst source = request.body;\n\tif (source === null || request.bodyUsed || source.locked) {\n\t\treturn { request, refusal: () => undefined };\n\t}\n\tlet refused: ContentTooLargeError | undefined;\n\tconst reader = source.getReader();\n\tconst body = new ReadableStream<Uint8Array>({\n\t\tasync pull(controller) {\n\t\t\ttry {\n\t\t\t\tconst { value, done } = await reader.read();\n\t\t\t\tif (done) controller.close();\n\t\t\t\telse controller.enqueue(value);\n\t\t\t} catch (error) {\n\t\t\t\tif (!isTooLarge(error)) throw error;\n\t\t\t\trefused = error;\n\t\t\t\t// Yoga's own refusal, which it neither masks nor logs, for\n\t\t\t\t// every content type: the handler answers core's 413 instead.\n\t\t\t\tthrow new GraphQLError('Request body too large', {\n\t\t\t\t\textensions: {\n\t\t\t\t\t\tcode: 'REQUEST_ENTITY_TOO_LARGE',\n\t\t\t\t\t\thttp: { status: 413 },\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tcancel: (reason) => reader.cancel(reason),\n\t});\n\treturn {\n\t\trequest: new Request(request, { body, duplex: 'half' } as RequestInit),\n\t\trefusal: () => refused,\n\t};\n}\n\ninterface Failure {\n\terrors?: { extensions?: Record<string, unknown> }[];\n}\n\n/**\n * Yoga's 400 for a request it cannot read — a body that is not JSON, a\n * query string that is not valid — carries the parser's own error as\n * `extensions.originalError`. A client reads the message and the code, not\n * what a parser said: the response without it, any other as it is.\n */\nexport async function withoutOriginalError(\n\tresponse: Response,\n): Promise<Response> {\n\tconst type = response.headers.get('content-type') ?? '';\n\tif (\n\t\tresponse.status !== 400 ||\n\t\t!/^application\\/(?:[\\w.-]+\\+)?json/.test(type)\n\t) {\n\t\treturn response;\n\t}\n\tconst text = await response.text();\n\tlet failure: Failure;\n\ttry {\n\t\tfailure = JSON.parse(text) as Failure;\n\t} catch {\n\t\treturn new Response(text, response);\n\t}\n\tfor (const error of failure.errors ?? []) {\n\t\tdelete error.extensions?.['originalError'];\n\t}\n\tconst headers = new Headers(response.headers);\n\theaders.delete('content-length');\n\treturn new Response(JSON.stringify(failure), { status: 400, headers });\n}\n",
9
9
  "/**\n * [Apollo Sandbox](https://www.apollographql.com/docs/graphos/platform/sandbox),\n * embedded: the page a browser gets at the endpoint when the IDE is\n * `apollo-sandbox`. `@nxgt/shared-graphql`'s `renderSandbox`, kept twice: the\n * Sandbox asks the address the page was opened at, as there since\n * nxgt-core#171, but here the page resolves the path itself, so a TLS proxy\n * in front changes nothing.\n */\n\nexport interface SandboxOptions {\n\t/** The page's title. `Sandbox Explorer` by default. */\n\treadonly title?: string;\n\t/** The operation the Sandbox opens with. */\n\treadonly initialDocument?: string;\n\t/** Headers every operation sends, shown and editable in the Sandbox. */\n\treadonly initialHeaders?: Readonly<Record<string, string>>;\n\t/** Whether the Sandbox polls the schema as it changes. On by default. */\n\treadonly pollForSchemaUpdates?: boolean;\n\t/** Whether operations send the browser's cookies: a session cookie. On by default. */\n\treadonly includeCookies?: boolean;\n}\n\n/** What the page loads: the Sandbox's script, its frame, and operations to this server. */\nexport const SANDBOX_POLICY = [\n\t\"default-src 'self'\",\n\t\"script-src 'self' 'unsafe-inline' https://embeddable-sandbox.cdn.apollographql.com\",\n\t\"style-src 'self' 'unsafe-inline'\",\n\t'frame-src https://sandbox.embed.apollographql.com',\n\t\"img-src 'self' data: https:\",\n\t\"connect-src 'self'\",\n].join('; ');\n\n/**\n * The page, its endpoint `endpoint`: a URL, or a path the page resolves\n * against its own address. Every value is escaped into its JavaScript and\n * HTML.\n */\nexport function renderSandbox(\n\tendpoint: string,\n\toptions: SandboxOptions = {},\n): string {\n\tconst config = {\n\t\ttarget: '#sandbox',\n\t\tinitialEndpoint: endpoint,\n\t\tinitialState: {\n\t\t\tincludeCookies: options.includeCookies ?? true,\n\t\t\tpollForSchemaUpdates: options.pollForSchemaUpdates ?? true,\n\t\t\t...(options.initialDocument === undefined\n\t\t\t\t? {}\n\t\t\t\t: { document: options.initialDocument }),\n\t\t\t...(options.initialHeaders === undefined\n\t\t\t\t? {}\n\t\t\t\t: { headers: options.initialHeaders }),\n\t\t},\n\t\thideCookieToggle: false,\n\t\tendpointIsEditable: false,\n\t};\n\treturn `<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\" />\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n<title>${html(options.title ?? 'Sandbox Explorer')}</title>\n<style>html, body { margin: 0; height: 100%; } #sandbox { position: absolute; inset: 0; }</style>\n</head>\n<body>\n<div id=\"sandbox\"></div>\n<script src=\"https://embeddable-sandbox.cdn.apollographql.com/_latest/embeddable-sandbox.umd.production.min.js\"></script>\n<script>\n{\nconst config = ${script(config)};\nconfig.initialEndpoint = new URL(config.initialEndpoint, location.href).href;\nnew window.EmbeddedSandbox(config);\n}\n</script>\n</body>\n</html>`;\n}\n\nfunction html(text: string): string {\n\treturn text.replace(/[&<>\"']/g, (char) => `&#${char.charCodeAt(0)};`);\n}\n\n/** JSON that cannot close the `<script>` it is written in. */\nfunction script(value: unknown): string {\n\treturn JSON.stringify(value)\n\t\t.replace(/</g, '\\\\u003c')\n\t\t.replace(/>/g, '\\\\u003e')\n\t\t.replace(/\\u2028/g, '\\\\u2028')\n\t\t.replace(/\\u2029/g, '\\\\u2029');\n}\n",
@@ -15,7 +15,7 @@
15
15
  "/**\n * `graphql-ws`'s server options for a socket route: each operation parsed,\n * validated, executed and subscribed through the endpoint's Yoga, and\n * followed to its end for the observers around the upgrade.\n */\nimport type { BaseContext } from '@alxia/core';\nimport type { ServerOptions, SubscribePayload } from 'graphql-ws';\nimport type { YogaInitialContext, YogaServerInstance } from 'graphql-yoga';\nimport { serverContext, type YogaContext } from './handler';\nimport { following, type SocketOperations } from './ws-operations';\n\n/**\n * What `graphql-ws` keeps of each socket: the context its upgrade built,\n * the request each of its operations reads as Yoga's `request`, and its\n * operations, told to the upgrade's observers.\n */\nexport interface Extra {\n\treadonly ctx: Record<string, unknown> & BaseContext;\n\treadonly request: Request;\n\treadonly operations: SocketOperations;\n}\n\n/** The rest of each operation, run by the functions Yoga's envelop gave it. */\ninterface Enveloped {\n\treadonly execute: (args: never) => unknown;\n\treadonly subscribe: (args: never) => unknown;\n}\n\n/** Where the socket route is, and the endpoint whose Yoga it runs. */\nexport interface Paths {\n\treadonly endpoint: string;\n\treadonly socket: string;\n}\n\n/**\n * The Yoga of the endpoint a socket route serves: the HTTP one, so its\n * plugins are set up once. The socket's route is its full path, the\n * prefix of each app it is mounted into included, then its own `path`.\n */\nfunction endpointOf(route: string, paths: Paths): string {\n\t// A path of `/` adds nothing to a prefix: `/api` + `/` is `/api`.\n\tconst own = paths.socket === '/' ? '' : paths.socket;\n\tconst at = paths.endpoint === '/' ? '' : paths.endpoint;\n\treturn route.slice(0, route.length - own.length) + at || '/';\n}\n\n/**\n * `graphql-ws`'s options: each operation parsed, validated, executed and\n * subscribed through Yoga's envelop, with the context the upgrade built,\n * the operation's `params` and the client's `connectionParams`.\n */\nexport function serverOptions<UserCtx extends YogaContext>(\n\tyogaAt: (endpoint: string) => YogaServerInstance<YogaContext, UserCtx>,\n\tpaths: Paths,\n): ServerOptions<Record<string, unknown> | undefined, Extra> {\n\t// Each operation's envelop, found by its context: one object per\n\t// operation, which the root resolvers' `parent` is not.\n\tconst enveloped = new WeakMap<object, Enveloped>();\n\tconst of = (args: { contextValue?: unknown }) =>\n\t\tenveloped.get(args.contextValue as object) as Enveloped;\n\treturn {\n\t\texecute: (args) => of(args).execute(args as never) as never,\n\t\tsubscribe: (args) => of(args).subscribe(args as never) as never,\n\t\t...following<Extra>(),\n\t\tasync onSubscribe(context, id, params: SubscribePayload) {\n\t\t\tconst { ctx, request } = context.extra;\n\t\t\tconst initial = {\n\t\t\t\t...serverContext(ctx),\n\t\t\t\trequest,\n\t\t\t\tparams,\n\t\t\t\tconnectionParams: context.connectionParams,\n\t\t\t} as unknown as YogaInitialContext & YogaContext;\n\t\t\tconst { schema, execute, subscribe, contextFactory, parse, validate } =\n\t\t\t\tyogaAt(endpointOf(ctx.route as string, paths)).getEnveloped(initial);\n\t\t\tlet document: ReturnType<typeof parse>;\n\t\t\ttry {\n\t\t\t\tdocument = parse(params.query);\n\t\t\t} catch (error) {\n\t\t\t\treturn [error as never];\n\t\t\t}\n\t\t\tcontext.extra.operations.begin(id, document, params.operationName);\n\t\t\tconst errors = validate(schema, document);\n\t\t\tif (errors.length > 0) return errors;\n\t\t\tconst contextValue = await contextFactory();\n\t\t\tenveloped.set(contextValue, { execute, subscribe });\n\t\t\treturn {\n\t\t\t\tschema,\n\t\t\t\tdocument,\n\t\t\t\toperationName: params.operationName,\n\t\t\t\tvariableValues: params.variables,\n\t\t\t\tcontextValue,\n\t\t\t};\n\t\t},\n\t};\n}\n",
16
16
  "/**\n * GraphQL over WebSocket, the `graphql-transport-ws` protocol of\n * `graphql-ws`, on a socket route of the app: the upgrade runs the app's\n * middlewares, each operation runs through Yoga's envelop — its plugins,\n * its `context` — and is told to the observers around the upgrade\n * (`ws-operations.ts`, through `ws-server.ts`'s options), and the app's shutdown closes the sockets with 1001.\n */\nimport type { BaseContext, NextFunction, RoutePath, Socket } from '@alxia/core';\nimport type { Server } from 'graphql-ws';\nimport type { YogaServerInstance } from 'graphql-yoga';\nimport type { YogaContext } from './handler';\nimport { SocketOperations } from './ws-operations';\nimport { type Extra, type Paths, serverOptions } from './ws-server';\n\n/** `graphql(app, { ws })`: GraphQL over WebSocket beside the HTTP endpoint. */\nexport interface GraphQLWsOptions {\n\t/**\n\t * Where a client opens its socket, under the app's prefix. The\n\t * endpoint's own path by default: one URL, `http(s)://` for queries and\n\t * server-sent events, `ws(s)://` for the socket.\n\t */\n\treadonly path?: RoutePath;\n\t/**\n\t * Milliseconds between the WebSocket pings the server sends each open\n\t * socket, so a proxy does not close an idle subscription. `12_000` by\n\t * default, as `graphql-ws`'s own server for Node; `false` for none.\n\t */\n\treadonly keepAlive?: number | false;\n}\n\ntype Module = typeof import('graphql-ws');\n\n/** What the missing optional peer is answered with: the package to add. */\nexport const MISSING_PEER =\n\t'@alxia/graphql: graphql(app, { ws }) serves GraphQL over WebSocket with the optional peer graphql-ws, which is not installed: bun add graphql-ws';\n\n/** `graphql-ws`, imported once; a missing peer rejects with `MISSING_PEER`. */\nfunction loader(): () => Promise<Module> {\n\tlet loading: Promise<Module> | undefined;\n\treturn () => {\n\t\tloading ??= import('graphql-ws').catch((cause: unknown) => {\n\t\t\tthrow new Error(MISSING_PEER, { cause });\n\t\t});\n\t\treturn loading;\n\t};\n}\n\n/** The subprotocol the upgrade request offers that `graphql-ws` serves, or `''`. */\nfunction chosen(module: Module, request: Request): string {\n\tconst offered = request.headers.get('sec-websocket-protocol') ?? '';\n\treturn module.handleProtocols(offered) || '';\n}\n\n/**\n * The request an operation over the socket reads: the upgrade's URL and\n * headers, as a `POST`, which it is to Yoga — a `GET` may not run a\n * mutation, and the upgrade is one — its signal aborted when the socket\n * closes.\n */\nfunction operationRequest(upgrade: Request, signal: AbortSignal): Request {\n\treturn new Request(upgrade.url, {\n\t\tmethod: 'POST',\n\t\theaders: upgrade.headers,\n\t\tsignal,\n\t});\n}\n\n/** `keepAlive` checked where `graphql()` is declared: a positive number of milliseconds, or `false`. */\nfunction pingEvery(keepAlive: number | false | undefined): number | false {\n\tif (keepAlive === undefined) return 12_000;\n\tif (keepAlive === false) return false;\n\tif (Number.isFinite(keepAlive) && keepAlive > 0) return keepAlive;\n\tthrow new TypeError(\n\t\t`graphql(app, { ws: { keepAlive: ${keepAlive} } }): keepAlive is the milliseconds between pings, a positive number, or false for none`,\n\t);\n}\n\n/** What one socket holds: the message handler `graphql-ws` registered, its end, its pings. */\ninterface Client {\n\tonMessage?: (data: string) => Promise<void>;\n\tclosed?: (code?: number, reason?: string) => Promise<void>;\n\tpings?: ReturnType<typeof setInterval>;\n\treadonly gone: AbortController;\n\treadonly operations: SocketOperations;\n}\n\n/**\n * The socket route's middleware and handlers: the upgrade loads\n * `graphql-ws` and names the subprotocol it serves in the `101`; each\n * open socket is a `graphql-ws` client, ended when it closes.\n */\nexport function graphqlSocket<UserCtx extends YogaContext>(\n\tyogaAt: (endpoint: string) => YogaServerInstance<YogaContext, UserCtx>,\n\tendpoint: string,\n\toptions: GraphQLWsOptions,\n) {\n\tconst paths: Paths = { endpoint, socket: options.path ?? endpoint };\n\tconst keepAlive = pingEvery(options.keepAlive);\n\tconst load = loader();\n\tlet module: Module | undefined;\n\tlet server: Server<Extra> | undefined;\n\tconst clients = new WeakMap<object, Client>();\n\n\t// Named `graphqlWs`, the name the route table shows.\n\tasync function graphqlWs(ctx: BaseContext, next: NextFunction) {\n\t\tmodule ??= await load();\n\t\tserver ??= module.makeServer(serverOptions(yogaAt, paths));\n\t\tconst protocol = chosen(module, ctx.request);\n\t\tif (protocol !== '')\n\t\t\tctx.set.headers.set('sec-websocket-protocol', protocol);\n\t\treturn next();\n\t}\n\n\ttype GraphQLSocket = Socket<Record<string, unknown> & BaseContext, unknown>;\n\tconst handlers = {\n\t\topen(socket: GraphQLSocket) {\n\t\t\tconst raw = socket.raw;\n\t\t\tconst client: Client = {\n\t\t\t\tgone: new AbortController(),\n\t\t\t\toperations: new SocketOperations(socket.data),\n\t\t\t};\n\t\t\tclients.set(raw, client);\n\t\t\t// The upgrade loaded both: a socket opens behind its middleware alone.\n\t\t\tconst graphqlWsServer = server as NonNullable<typeof server>;\n\t\t\tclient.closed = graphqlWsServer.opened(\n\t\t\t\t{\n\t\t\t\t\t// Anything else is closed by graphql-ws: 4406, Subprotocol not acceptable.\n\t\t\t\t\tprotocol: chosen(module as Module, socket.data.request),\n\t\t\t\t\tsend: (data: string) => {\n\t\t\t\t\t\tif (raw.readyState === 1) raw.sendText(data);\n\t\t\t\t\t},\n\t\t\t\t\tclose: (code?: number, reason?: string) => raw.close(code, reason),\n\t\t\t\t\tonMessage: (handle: (data: string) => Promise<void>) => {\n\t\t\t\t\t\tclient.onMessage = handle;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tctx: socket.data,\n\t\t\t\t\trequest: operationRequest(socket.data.request, client.gone.signal),\n\t\t\t\t\toperations: client.operations,\n\t\t\t\t},\n\t\t\t);\n\t\t\tif (keepAlive !== false) {\n\t\t\t\tclient.pings = setInterval(() => raw.ping(), keepAlive);\n\t\t\t}\n\t\t},\n\t\tasync message(socket: GraphQLSocket, message: unknown) {\n\t\t\tconst data =\n\t\t\t\ttypeof message === 'string'\n\t\t\t\t\t? message\n\t\t\t\t\t: new TextDecoder().decode(message as Uint8Array);\n\t\t\tawait clients.get(socket.raw)?.onMessage?.(data);\n\t\t},\n\t\tasync close(socket: GraphQLSocket, code: number, reason: string) {\n\t\t\tconst client = clients.get(socket.raw);\n\t\t\tif (client === undefined) return;\n\t\t\tclearInterval(client.pings);\n\t\t\tclients.delete(socket.raw);\n\t\t\tclient.gone.abort();\n\t\t\tawait client.closed?.(code, reason);\n\t\t\tclient.operations.closed();\n\t\t},\n\t};\n\treturn { path: paths.socket, middleware: graphqlWs, handlers };\n}\n"
17
17
  ],
18
- "mappings": ";AAAA;AAAA;AAAA;;;ACIA,IAAM,qBAAqB;AAGpB,SAAS,eAAe,CAC9B,KACA,MACA,SACA,WACA,QACO;AAAA,EACP,MAAM,QAAQ;AA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756E2164756E21",
20
20
  "names": []
21
21
  }
package/docs/README.md CHANGED
@@ -12,7 +12,7 @@ a realistic example for each.
12
12
  | [The typed context](guide/context.md) | typing a schema with the app's context, reading `user` or a database handle in a resolver, setting a cookie, adding per-request loaders, or reading the `missing …` compile error |
13
13
  | [Yoga's plugins and options](guide/yoga.md) | adding Yoga or Envelop plugins, exposing or masking errors, batching, serving subscriptions, or calling the endpoint from another origin |
14
14
  | [GraphQL over WebSocket](guide/websockets.md) | serving Apollo Client's, urql's or `graphql-ws`'s WebSocket clients with `ws: true`, guarding the upgrade, reading `connectionParams`, the subprotocol, closing the sockets on shutdown, or testing a subscription over a socket |
15
- | [Harden it for production](guide/production.md) | putting a GraphQL API on the internet: rate limiting the endpoint, depth limits, introspection off outside development, masked errors and the errors a client may read, a body limit, CSRF for a cookie session, persisted operations |
15
+ | [Harden it for production](guide/production.md) | putting a GraphQL API on the internet: rate limiting the endpoint, depth limits, the token cap, the nesting cap, the parse cache and the body limit, introspection off outside development, masked errors and the errors a client may read, a body limit, CSRF for a cookie session, persisted operations |
16
16
  | [GraphiQL and Apollo Sandbox](guide/ide.md) | choosing the IDE a browser gets, configuring it, keeping it working under a strict `Content-Security-Policy`, or serving it outside dev with `ide: 'graphiql'` |
17
17
  | [Testing the endpoint](guide/testing.md) | testing a GraphQL app without a server: `graphqlClient`, an auth header, a custom path, `GET`, persisted operations, the CSRF header, a typed document, the HTTP status of a 400 or a 413 |
18
18
  | [Troubleshooting](troubleshooting.md) | something went wrong and you have the message |
@@ -142,7 +142,8 @@ each) sit outside the weight, bounded at roughly 70 KB per document.
142
142
 
143
143
  `maxTokens` does not count comments, yet a
144
144
  parsed document keeps all of them alive: a 750 KB body of `#` lines holds
145
- about 19.6 MB, so it weighs more than the cache keeps and is parsed again
145
+ about 19.6 MB (one `#` per line, `#\n`: each comment becomes a token the
146
+ document keeps), so it weighs more than the cache keeps and is parsed again
146
147
  each time instead of cached.
147
148
 
148
149
  - **`maxTokens`, 15 000 by default** (Apollo Router's own limit). The
@@ -205,17 +206,27 @@ as the bytes arrive:
205
206
  `ContentTooLargeError` again instead, so a client gets the 413 a plain
206
207
  route answers, in the app's error format (`application/problem+json` under
207
208
  `errors: 'problem'`), with a `Content-Length` or without one (a chunked
208
- body). It carries the headers Yoga's plugins set, such as a
209
- `Cache-Control: no-store` from an `onResponse` hook. A form-urlencoded or
209
+ body). A declared `Content-Length` over the limit is refused by core
210
+ where `bodyLimit()` stands, before Yoga runs: that 413 carries no header
211
+ Yoga's plugins set. A chunked body is refused at the read, by the
212
+ endpoint, and that 413 carries the headers Yoga's plugins set, such as a
213
+ `Cache-Control: no-store` from an `onResponse` hook. Headers merge by
214
+ name: `Vary` is merged with the app's own, `Set-Cookie` is appended, and any
215
+ other header Yoga sets overwrites the app's header of the same name (Yoga's
216
+ `Content-Type`, `Content-Length`, `Content-Encoding` and `Transfer-Encoding`
217
+ are never carried). A form-urlencoded or
210
218
  `application/graphql` body past the limit is refused the same way and logs
211
219
  nothing. Whatever else Yoga cannot parse is still its 400, and its
212
220
  parser's own error is never sent (`extensions.originalError` is removed).
213
- - **Order.** The body is read by the endpoint, after every middleware
214
- declared before it, `bodyLimit()` included: those still run for an
215
- oversized body. Declare the cheap observers first and the costly
216
- middlewares (a session lookup, a database call) as late as you can. A
217
- refusal answered before Yoga runs cannot carry Yoga's headers: set the ones
218
- every response needs in a middleware.
221
+ - **Order.** A declared `Content-Length` over the limit is refused where
222
+ `bodyLimit()` stands: the middlewares declared before it run, the ones
223
+ after it do not. When the endpoint's own `bodyLimit` option sets the limit,
224
+ the check stands at the head of the endpoint's steps, after every
225
+ middleware declared before it. A chunked body is read by the endpoint, after
226
+ every middleware, `bodyLimit()` included. Declare the cheap observers
227
+ first and the costly middlewares (a session lookup, a database call) as
228
+ late as you can. A refusal answered before Yoga runs cannot carry Yoga's
229
+ headers: set the ones every response needs in a middleware.
219
230
 
220
231
  ```ts
221
232
  graphql(app, {
@@ -285,7 +296,7 @@ export const persisted: Plugin = usePersistedOperations({
285
296
 
286
297
  ## Together
287
298
 
288
- `maxTokens` and `parseCache` need no line here: their defaults apply. The
299
+ `maxTokens`, `maxNesting` and `parseCache` need no line here: their defaults apply. The
289
300
  `bodyLimit()` below is the app's own and is kept; without it the `POST` takes
290
301
  1 MiB.
291
302
 
@@ -192,7 +192,10 @@ otherwise — and the subscription goes on or completes as over HTTP. A
192
192
  query that does not parse or validate is answered with an `error`
193
193
  message, the protocol's, and the socket stays open. `maxTokens` applies to
194
194
  each operation: a `subscribe` message holding a longer document gets that
195
- `error`, `Document contains more than 15000 tokens`.
195
+ `error`, `Document contains more than 15000 tokens`. `maxNesting` applies to
196
+ each `subscribe` operation the same way: a document nested deeper gets an
197
+ `error` message carrying `GRAPHQL_PARSE_FAILED`, the socket stays open and
198
+ nothing is logged.
196
199
 
197
200
  `bodyLimit` does not reach the socket: a `subscribe` message is bounded by
198
201
  Bun's `maxPayloadLength` (16 MiB by default), not by the 1 MiB a `POST` body
package/docs/roadmap.md CHANGED
@@ -11,11 +11,7 @@ Nothing in progress.
11
11
 
12
12
  ## Next
13
13
 
14
- - **A declared oversize body refused where `bodyLimit()` stands.** Today the
15
- body is read, and refused, by the endpoint, after every middleware declared
16
- before it. Core would answer a `Content-Length` past the limit at the
17
- `bodyLimit()` call, so the middlewares after it never run for such a
18
- request. It lives in `@alxia/core`.
14
+ Nothing scheduled yet.
19
15
 
20
16
  ## Later
21
17
 
@@ -29,6 +25,15 @@ Nothing in progress.
29
25
 
30
26
  ## Shipped
31
27
 
28
+ ### 0.9.2
29
+
30
+ - **A declared oversize body refused where `bodyLimit()` stands.** With
31
+ `@alxia/core` 0.16.0, a `Content-Length` past the limit is refused at the
32
+ app's `bodyLimit()`, before the middlewares after it, and the endpoint
33
+ leaves an inherited limit there. The endpoint's own `bodyLimit` option, or
34
+ the 1 MiB default, refuses at the head of the endpoint's steps. A chunked
35
+ body is still refused at the read, with Yoga's headers.
36
+
32
37
  ### 0.9.0
33
38
 
34
39
  - **Bounded parsing.** A document may hold 15 000 tokens (`maxTokens`, `false`
@@ -35,6 +35,9 @@ symptom.
35
35
  - [`405 {"errors":[{"message":"Can only perform a mutation operation from a POST request."}]}`](#405-errorsmessagecan-only-perform-a-mutation-operation-from-a-post-request)
36
36
  - [`406` with an empty body](#406-with-an-empty-body)
37
37
  - [`413 {"error":"content_too_large", …}`](#413-errorcontent_too_large--on-post-graphql)
38
+ - [`Syntax Error: Document contains more than 15000 tokens. Parsing aborted.`](#syntax-error-document-contains-more-than-15000-tokens-parsing-aborted)
39
+ - [`Syntax Error: Document is nested more than 1000 levels deep. Parsing aborted.`](#syntax-error-document-is-nested-more-than-1000-levels-deep-parsing-aborted)
40
+ - [`Syntax Error: Document is nested too deeply to parse.`](#syntax-error-document-is-nested-too-deeply-to-parse)
38
41
  - [`{"errors":[{"message":"Must provide query string."}]}`](#errorsmessagemust-provide-query-string)
39
42
  - [`4406 Subprotocol not acceptable`](#4406-subprotocol-not-acceptable)
40
43
 
@@ -341,8 +344,8 @@ graphql(app, { schema, maxTokens: 30_000 }); // or false
341
344
 
342
345
  **When:** a query is answered with `GRAPHQL_PARSE_FAILED` (400 under
343
346
  `application/graphql-response+json`, 200 under `application/json`) and this
344
- message. A document that overflowed the stack anyway is worded `Syntax Error:
345
- Document is nested too deeply to parse.`
347
+ message. A document that overflowed the stack anyway has
348
+ [its own entry](#syntax-error-document-is-nested-too-deeply-to-parse).
346
349
 
347
350
  **Why:** a document may nest 1 000 levels of `{`, `(` and `[` by default
348
351
  (`maxNesting`). graphql-js parses by recursion and overflows the stack a few
@@ -358,6 +361,24 @@ Bun's main thread, fewer in a Worker), or turn it off:
358
361
  graphql(app, { schema, maxNesting: 2_000 }); // or false
359
362
  ```
360
363
 
364
+ ### `Syntax Error: Document is nested too deeply to parse.`
365
+
366
+ **When:** a query is answered with `GRAPHQL_PARSE_FAILED` and this message.
367
+
368
+ **Why:** graphql-js parsed the document by recursion and the call stack
369
+ overflowed, either because `maxNesting` is `false` or raised past what the
370
+ runtime parses. The stack is smaller in a Worker or under load than on Bun's
371
+ main thread, so the depth that fails varies. The overflow is refused as any
372
+ unparsable document is, never a 500.
373
+
374
+ **Fix:** a real query nests a dozen levels; look for a hostile or generated
375
+ document. If it is legitimate, keep the limit (the default is 1 000) or set
376
+ one your runtime parses:
377
+
378
+ ```ts
379
+ graphql(app, { schema, maxNesting: 500 });
380
+ ```
381
+
361
382
  ### `TypeError: graphql(app, { maxNesting }): maxNesting is the most levels of { ( [ a document may nest, a positive whole number, or false for none; got …`
362
383
 
363
384
  **When:** declaring `graphql(app, { maxNesting })` with `0`, a negative number,
@@ -395,15 +416,15 @@ throw createGraphQLError('Admins only', {
395
416
  `Content-Length` or chunked. The limit is **1 MiB** unless the `bodyLimit`
396
417
  option or a `bodyLimit()` declared before `graphql(...)` gives another.
397
418
 
398
- **Why:** core counts the bytes as they arrive and fails the read past the
419
+ **Why:** a declared `Content-Length` over the limit is refused by core where
420
+ `bodyLimit()` stands, before Yoga runs: the middlewares declared before it
421
+ run, the ones after it do not, and the 413 carries no header Yoga's plugins
422
+ set. A chunked body is counted as it arrives and the read fails past the
399
423
  limit; the endpoint answers it as any route does, in the app's error format
400
- (`application/problem+json` under `errors: 'problem'`). The 413 carries the
401
- headers Yoga's plugins set (`Cache-Control: no-store`…), and nothing is
402
- logged, whatever the content type (JSON, form-urlencoded,
403
- `application/graphql`). The body is read by the endpoint, after the
404
- middlewares declared before it: they still run for an oversized body, even
405
- when `bodyLimit()` stands above them. Put the costly ones (a session lookup,
406
- a database call) late.
424
+ (`application/problem+json` under `errors: 'problem'`), with the headers
425
+ Yoga's plugins set (`Cache-Control: no-store`…). Nothing is logged, whatever
426
+ the content type (JSON, form-urlencoded, `application/graphql`). Put the
427
+ costly middlewares (a session lookup, a database call) after `bodyLimit()`.
407
428
 
408
429
  **Fix:** a client sends less, or the endpoint takes a larger limit, for an
409
430
  upload by `multipart` for example:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alxia/graphql",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
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",
@@ -47,9 +47,9 @@
47
47
  ]
48
48
  },
49
49
  "devDependencies": {
50
- "@alxia/core": "^0.15.1",
51
- "@alxia/logger": "^0.6.7",
52
- "@alxia/telemetry": "^0.7.5",
50
+ "@alxia/core": "^0.16.0",
51
+ "@alxia/logger": "^0.6.8",
52
+ "@alxia/telemetry": "^0.7.6",
53
53
  "@envelop/depth-limit": "^7.2.1",
54
54
  "@graphql-yoga/plugin-csrf-prevention": "^3.24.2",
55
55
  "@graphql-yoga/plugin-persisted-operations": "^3.24.2",
@@ -61,7 +61,7 @@
61
61
  "graphql-yoga": "^5.16.0"
62
62
  },
63
63
  "peerDependencies": {
64
- "@alxia/core": "^0.15.1",
64
+ "@alxia/core": "^0.16.0",
65
65
  "graphql": "^16.11.0 || ^17.0.0",
66
66
  "graphql-ws": "^6.1.0",
67
67
  "graphql-yoga": "^5.16.0",