Move docs/ package mirror into document-navigator plugin

Relocate the ~6k-file docs tree from the repo root into
plugins/document-navigator/docs/ so the plugin is self-contained and
portable. docs/superpowers/ (specs and plans) stays at the repo root.

Moved via cp+rm rather than git mv because directory rename() fails with
EPERM on this WSL /mnt DrvFs mount; git rename-detection pairs the
identical-content files at commit time.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-30 01:10:00 +01:00
parent fe3fedf42e
commit 9bf56a806b
6022 changed files with 12437 additions and 0 deletions

View File

@@ -0,0 +1,83 @@
# `options` — `ApolloGraphqlOptions`
<!-- begin:auto-docs -->
_(no submodules)_
<!-- end:auto-docs -->
## Purpose
`options` owns the Zod-validated configuration surface accepted by
`createApolloGraphqlEngine`. The schema mirrors the Yoga sibling's options
1:1 so an operator can swap engines without touching the host wiring —
defaults agree, paths agree, depth and complexity limits agree, and the
persisted-query path / Studio reporting fields are the Apollo-specific
additions layered on top.
Inputs cross the Zod boundary once at engine construction time; downstream
code consumes the fully resolved `ApolloGraphqlOptions` shape and never
re-validates. Configuration failures throw `GRAPHQL_APOLLO.PARSE_FAILED`
so caller-visible input errors share a single error code with the
request-document parse path.
## Features
- Endpoint paths default to `/graphql`, `/graphql/sdl`, `/graphql/ws`,
`/graphql/ui` — identical to Yoga.
- `introspection: false` by default; flipping the flag wires Apollo's
schema introspection on AND lets the engine skip the
`INTROSPECTION_DENIED` guard.
- `maxQueryDepth` and `maxQueryComplexity` mirror the Yoga defaults
(`10`, `1000`).
- `requestTimeoutMs` defaults to `30_000`; the engine wraps every
`executeOperation` call in a timeout race.
- Persisted-query manifest path is optional; the engine wires the
manifest loader only when `persistedQueriesPath` is set.
- `studioReporting` opt-in — the engine returns `null` from
`createStudioReporting()` when omitted.
## Usage: Basic
```ts
import { parseApolloGraphqlOptions } from "@suaveplan/api-graphql-apollo/options";
const opts = parseApolloGraphqlOptions({});
// opts.endpoint === "/graphql"
```
## Usage: Advanced
Wire persisted queries plus Apollo Studio reporting plus a custom error
formatter:
```ts
import { parseApolloGraphqlOptions } from "@suaveplan/api-graphql-apollo/options";
const opts = parseApolloGraphqlOptions({
persistedQueriesPath: "./pq.json",
studioReporting: {
apiKey: process.env.APOLLO_KEY ?? "",
graphRef: "supergraph@current",
},
formatError: (err) => ({ msg: String(err), redacted: true }),
requestTimeoutMs: 5_000,
});
```
## API Reference
- `apolloGraphqlOptionsSchema` — the underlying Zod schema (exported for
introspection / OpenAPI registration).
- `parseApolloGraphqlOptions(input?) → ApolloGraphqlOptions` — throws
`GraphqlApolloError("GRAPHQL_APOLLO.PARSE_FAILED")` on validation
failure.
- `ApolloGraphqlOptions` — fully-resolved options type (every field
required, every default applied).
- `ApolloGraphqlOptionsInput` — input type (every field optional).
## Implementation Notes
The schema uses `z.string().startsWith("/")` for every endpoint path —
operator typos like `endpoint: "graphql"` (no leading slash) surface
synchronously at boot. The `formatError` field is `z.custom<(err) => …>`
because Zod has no first-class function type; the custom guard rejects
non-functions with the same `GRAPHQL_APOLLO.PARSE_FAILED` code.