@orkestrel/scaffold 0.0.114 → 0.0.116

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 (108) hide show
  1. package/dist/bin/main.js +137 -15
  2. package/dist/bin/main.js.map +1 -1
  3. package/dist/host/agents/orchestration.md +5 -3
  4. package/dist/host/agents/platforms/windows.md +1 -0
  5. package/dist/host/agents/skills/orkestrel-align/references/integration.md +1 -1
  6. package/dist/host/agents/skills/orkestrel-debrief/SKILL.md +4 -4
  7. package/dist/host/agents/skills/orkestrel-dispatch/SKILL.md +4 -1
  8. package/dist/host/agents/skills/orkestrel-falsify/SKILL.md +8 -2
  9. package/dist/host/agents/skills/orkestrel-harden/references/equivalence.md +1 -0
  10. package/dist/host/agents/skills/orkestrel-harden/references/hardening.md +1 -1
  11. package/dist/host/agents/skills/orkestrel-parallel/SKILL.md +1 -1
  12. package/dist/host/agents/skills/orkestrel-parallel/references/codex.md +1 -0
  13. package/dist/host/agents/skills/orkestrel-publish/references/wave.md +9 -3
  14. package/dist/host/claude/agents/analyst.md +1 -1
  15. package/dist/host/claude/agents/astra.md +2 -2
  16. package/dist/host/claude/agents/builder.md +4 -4
  17. package/dist/host/claude/agents/opus.md +3 -3
  18. package/dist/host/claude/agents/orkestrel.md +5 -7
  19. package/dist/host/claude/agents/planner.md +8 -2
  20. package/dist/host/claude/rules/campaign.md +2 -1
  21. package/dist/host/claude/rules/documentation.md +1 -0
  22. package/dist/host/claude/rules/names.md +3 -1
  23. package/dist/host/claude/rules/tests.md +7 -4
  24. package/dist/host/claude/rules/writing.md +1 -0
  25. package/dist/host/claude/skills/enterprise-bootstrap/SKILL.md +1 -2
  26. package/dist/host/claude/skills/orkestrel-align/SKILL.md +1 -1
  27. package/dist/host/claude/skills/orkestrel-build/SKILL.md +1 -2
  28. package/dist/host/claude/skills/orkestrel-debrief/SKILL.md +1 -2
  29. package/dist/host/claude/skills/orkestrel-dispatch/SKILL.md +1 -1
  30. package/dist/host/claude/skills/orkestrel-falsify/SKILL.md +1 -1
  31. package/dist/host/claude/skills/orkestrel-harden/SKILL.md +1 -1
  32. package/dist/host/claude/skills/orkestrel-journey/SKILL.md +1 -1
  33. package/dist/host/claude/skills/orkestrel-parallel/SKILL.md +1 -1
  34. package/dist/host/claude/skills/orkestrel-polish/SKILL.md +1 -2
  35. package/dist/host/claude/skills/orkestrel-publish/SKILL.md +1 -2
  36. package/dist/host/claude/skills/orkestrel-scout/SKILL.md +1 -1
  37. package/dist/host/codex/agents/analyst.toml +8 -5
  38. package/dist/host/codex/agents/astra.toml +4 -5
  39. package/dist/host/codex/agents/builder.toml +5 -5
  40. package/dist/host/codex/agents/opus.toml +3 -4
  41. package/dist/host/codex/agents/orkestrel.toml +2 -1
  42. package/dist/host/codex/agents/planner.toml +8 -5
  43. package/dist/host/codex/agents/reviewer.toml +5 -4
  44. package/dist/host/guides/abort.md +17 -17
  45. package/dist/host/guides/agent.md +445 -445
  46. package/dist/host/guides/brief.md +143 -143
  47. package/dist/host/guides/browser.md +731 -731
  48. package/dist/host/guides/budget.md +39 -39
  49. package/dist/host/guides/capture.md +298 -298
  50. package/dist/host/guides/console.md +109 -109
  51. package/dist/host/guides/contract.md +335 -335
  52. package/dist/host/guides/csv.md +30 -30
  53. package/dist/host/guides/database.md +163 -163
  54. package/dist/host/guides/emitter.md +17 -17
  55. package/dist/host/guides/form.md +99 -99
  56. package/dist/host/guides/guide.md +361 -183
  57. package/dist/host/guides/html.md +49 -49
  58. package/dist/host/guides/indexeddb.md +40 -40
  59. package/dist/host/guides/interpret.md +139 -139
  60. package/dist/host/guides/lsp.md +114 -114
  61. package/dist/host/guides/markdown.md +68 -68
  62. package/dist/host/guides/mcp.md +3745 -3745
  63. package/dist/host/guides/middleware.md +170 -170
  64. package/dist/host/guides/msg.md +95 -95
  65. package/dist/host/guides/ndjson.md +8 -8
  66. package/dist/host/guides/ollama.md +56 -56
  67. package/dist/host/guides/pool.md +21 -21
  68. package/dist/host/guides/probe.md +82 -82
  69. package/dist/host/guides/process.md +99 -99
  70. package/dist/host/guides/program.md +98 -96
  71. package/dist/host/guides/qualifier.md +70 -70
  72. package/dist/host/guides/queue.md +37 -37
  73. package/dist/host/guides/rater.md +38 -38
  74. package/dist/host/guides/reason.md +308 -308
  75. package/dist/host/guides/relation.md +50 -50
  76. package/dist/host/guides/router.md +58 -58
  77. package/dist/host/guides/scaffold.md +554 -419
  78. package/dist/host/guides/sea.md +128 -128
  79. package/dist/host/guides/server.md +100 -100
  80. package/dist/host/guides/sqlite.md +28 -28
  81. package/dist/host/guides/sse.md +20 -20
  82. package/dist/host/guides/study.md +444 -444
  83. package/dist/host/guides/table.md +82 -82
  84. package/dist/host/guides/template.md +41 -41
  85. package/dist/host/guides/terminal.md +121 -121
  86. package/dist/host/guides/test.md +273 -273
  87. package/dist/host/guides/timeout.md +18 -18
  88. package/dist/host/guides/tool.md +27 -27
  89. package/dist/host/guides/toolbox.md +166 -166
  90. package/dist/host/guides/websocket.md +54 -54
  91. package/dist/host/guides/worker.md +24 -24
  92. package/dist/host/guides/workflow.md +187 -187
  93. package/dist/host/guides/workspace.md +55 -55
  94. package/dist/host/manifest.json +93 -93
  95. package/dist/host/tests/setupPolicy.ts +5 -3
  96. package/dist/src/core/index.cjs +89 -3
  97. package/dist/src/core/index.cjs.map +1 -1
  98. package/dist/src/core/index.d.cts +229 -144
  99. package/dist/src/core/index.d.ts +229 -144
  100. package/dist/src/core/index.js +87 -4
  101. package/dist/src/core/index.js.map +1 -1
  102. package/dist/src/server/index.cjs +292 -66
  103. package/dist/src/server/index.cjs.map +1 -1
  104. package/dist/src/server/index.d.cts +188 -6
  105. package/dist/src/server/index.d.ts +188 -6
  106. package/dist/src/server/index.js +287 -69
  107. package/dist/src/server/index.js.map +1 -1
  108. package/package.json +4 -3
@@ -45,49 +45,49 @@ const handle = compose<State>([boundary, security], async (_request, context) =>
45
45
 
46
46
  ### Middlewares — core
47
47
 
48
- | API | Kind | Summary |
49
- | ------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
50
- | `createBoundary` | function | Creates the outermost error-rendering battery — catches a downstream throw and renders it as a `Response`. |
51
- | `createTelemetry` | function | Creates the access-log/timing seam — records one `TelemetryEntry` per request after the response settles. |
52
- | `createCompression` | function | Creates the response-body compression battery — negotiates and compresses a buffered response body over the runtime's feature-detected `CompressionStream` codings. |
53
- | `createSecurity` | function | Creates the security-headers + request-identifier battery — sets each documented header default, and mints or echoes a request identifier. |
54
- | `createCors` | function | Creates the Cross-Origin Resource Sharing battery — answers a preflight itself, and reflects an allow-listed origin or serves the configured wildcard. |
55
- | `createDeadline` | function | Creates the application-level per-request deadline battery. |
56
- | `createForwarded` | function | Creates the trusted-proxy client-IP resolver battery — walks `X-Forwarded-For` past the hops its options declare trusted. |
57
- | `createETag` | function | Creates the dynamic response `ETag` + conditional GET battery (RFC 7232). |
58
- | `createBearer` | function | Creates the bearer-token authentication battery — reads the token from its header and verifies it with `verifyToken`. |
59
- | `createLimiter` | function | Creates the fixed-window rate-limiting battery — checks a key's budget before consuming it, so one window admits exactly `max` requests. |
60
- | `createBody` | function | Creates the body-driving battery — eagerly awaits the cached `context.body()` so its throws (or a malformed-JSON `undefined`) surface before the handler runs, and stashes the resolved value onto `BodyState.body`. |
61
- | `createSession` | function | Creates the generic session battery — resolves, mints, and persists a session across the request, with a mid-handler `regenerate`/`destroy` control handle. |
62
- | `createCSRF` | function | Creates the session-bound double-submit CSRF protection battery. |
63
- | `only` | function | Scopes a battery to a set of exact pathnames and nowhere else — outside that set it steps aside through `next()`. |
64
- | `except` | function | Scopes a battery to every pathname outside a set of exact ones — on that set it steps aside through `next()`. |
48
+ | Name | Kind | Signature | Summary |
49
+ | ------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
50
+ | `createBoundary` | function | `<TState>(options?: BoundaryOptions) => MiddlewareHandler<TState>` | Creates the outermost error-rendering battery — catches a downstream throw and renders it as a `Response`. |
51
+ | `createTelemetry` | function | `<TState>(options: TelemetryOptions) => MiddlewareHandler<TState>` | Creates the access-log/timing seam — records one `TelemetryEntry` per request after the response settles. |
52
+ | `createCompression` | function | `<TState>(options?: CompressionOptions) => MiddlewareHandler<TState>` | Creates the response-body compression battery — negotiates and compresses a buffered response body over the runtime's feature-detected `CompressionStream` codings. |
53
+ | `createSecurity` | function | `<TState extends IdentifierState>(options?: SecurityOptions) => MiddlewareHandler<TState>` | Creates the security-headers + request-identifier battery — sets each documented header default, and mints or echoes a request identifier. |
54
+ | `createCors` | function | `<TState>(options?: CorsOptions) => MiddlewareHandler<TState>` | Creates the Cross-Origin Resource Sharing battery — answers a preflight itself, and reflects an allow-listed origin or serves the configured wildcard. |
55
+ | `createDeadline` | function | `<TState>(options: DeadlineOptions) => MiddlewareHandler<TState>` | Creates the application-level per-request deadline battery. |
56
+ | `createForwarded` | function | `<TState extends ClientState & ConnectionState>(options: ForwardedOptions) => MiddlewareHandler<TState>` | Creates the trusted-proxy client-IP resolver battery — walks `X-Forwarded-For` past the hops its options declare trusted. |
57
+ | `createETag` | function | `<TState>(options?: ETagOptions) => MiddlewareHandler<TState>` | Creates the dynamic response `ETag` + conditional GET battery (RFC 7232). |
58
+ | `createBearer` | function | `<TState extends BearerState>(options: BearerOptions) => MiddlewareHandler<TState>` | Creates the bearer-token authentication battery — reads the token from its header and verifies it with `verifyToken`. |
59
+ | `createLimiter` | function | `<TState extends BearerState & ClientState & ConnectionState>(options: LimiterOptions<TState>) => MiddlewareHandler<TState>` | Creates the fixed-window rate-limiting battery — checks a key's budget before consuming it, so one window admits exactly `max` requests. |
60
+ | `createBody` | function | `<TState extends BodyState = BodyState>() => MiddlewareHandler<TState>` | Creates the body-driving battery — eagerly awaits the cached `context.body()` so its throws (or a malformed-JSON `undefined`) surface before the handler runs, and stashes the resolved value onto `BodyState.body`. |
61
+ | `createSession` | function | `<S extends SessionInterface = SessionInterface, TState extends SessionState & ConnectionState = SessionState & ConnectionState>(options: SessionOptions<S, TState>) => MiddlewareHandler<TState>` | Creates the generic session battery — resolves, mints, and persists a session across the request, with a mid-handler `regenerate`/`destroy` control handle. |
62
+ | `createCSRF` | function | `<TState extends CSRFState & SessionState & ConnectionState>(options: CSRFOptions) => MiddlewareHandler<TState>` | Creates the session-bound double-submit CSRF protection battery. |
63
+ | `only` | function | `<TState>(paths: string \| readonly string[], handler: MiddlewareHandler<TState>) => MiddlewareHandler<TState>` | Scopes a battery to a set of exact pathnames and nowhere else — outside that set it steps aside through `next()`. |
64
+ | `except` | function | `<TState>(paths: string \| readonly string[], handler: MiddlewareHandler<TState>) => MiddlewareHandler<TState>` | Scopes a battery to every pathname outside a set of exact ones — on that set it steps aside through `next()`. |
65
65
 
66
66
  ### Middlewares — node
67
67
 
68
- | API | Kind | Summary |
69
- | ------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
70
- | `createAssets` | function | Serves validated in-memory assets with identity/Brotli negotiation. |
71
- | `createStatic` | function | Serves static files from `options.root` over `node:fs` — the node-bound static-file battery, answering conditional, ranged, and SPA-fallback requests. |
72
- | `createMultipart` | function | Parses a streamed `multipart/form-data` request body and stashes its `MultipartBody` on `context.state.multipart` — the node-bound streaming multipart battery. |
73
- | `createCompression` | function | Compresses response bodies through `node:zlib`, guaranteed on any Node runtime rather than dependent on the WHATWG `CompressionStream` global. This battery is the node-bound sibling of the core face's feature-detected `createCompression`, and it ships from a separate package entry point (`@orkestrel/middleware/server`) so the shared name is unambiguous per consumer import path. |
68
+ | Name | Kind | Signature | Summary |
69
+ | ------------------- | -------- | ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
70
+ | `createAssets` | function | `<TState>(options: AssetOptions) => MiddlewareHandler<TState>` | Serves validated in-memory assets with identity/Brotli negotiation. |
71
+ | `createStatic` | function | `<TState>(options: StaticOptions) => MiddlewareHandler<TState>` | Serves static files from `options.root` over `node:fs` — the node-bound static-file battery, answering conditional, ranged, and SPA-fallback requests. |
72
+ | `createMultipart` | function | `<TState extends MultipartState>(options?: MultipartOptions) => MiddlewareHandler<TState>` | Parses a streamed `multipart/form-data` request body and stashes its `MultipartBody` on `context.state.multipart` — the node-bound streaming multipart battery. |
73
+ | `createCompression` | function | `<TState>(options?: NodeCompressionOptions) => MiddlewareHandler<TState>` | Compresses response bodies through `node:zlib`, guaranteed on any Node runtime rather than dependent on the WHATWG `CompressionStream` global. This battery is the node-bound sibling of the core face's feature-detected `createCompression`, and it ships from a separate package entry point (`@orkestrel/middleware/server`) so the shared name is unambiguous per consumer import path. |
74
74
 
75
75
  ### Types
76
76
 
77
77
  A `Shape` cell holds an interface's data members as bare names in braces, `?` marking an optional member and `plus` introducing its call-signature members, and a type alias's own type literal with a union's arms escaped as `\|`. An extended interface's name comes before `plus`, with the members it adds after.
78
78
 
79
- | Type | Kind | Shape | Summary |
79
+ | Name | Kind | Signature | Summary |
80
80
  | --------------------------- | --------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
81
81
  | `BoundaryOptions` | interface | `{ expose?, report? }` | Configures `createBoundary` — the outermost error-rendering battery. |
82
82
  | `TelemetryEntry` | interface | `{ method, pathname, status, duration }` | Represents one access-log-style entry `createTelemetry` records after a response settles — the access-log/timing seam's payload shape. |
83
83
  | `TelemetryOptions` | interface | `{ record }` | Configures `createTelemetry` — the request timing/access-log seam. |
84
84
  | `CompressionOptions` | interface | `{ threshold?, encodings?, filter? }` | Configures `createCompression` — response-body compression. |
85
85
  | `CompressResponseOptions` | interface | `{ threshold, filter?, encodings, compress }` | Describes the already-resolved settings `compressResponse` runs its shared negotiate → skip → threshold → compress skeleton against — the shape each face's `createCompression` builds from its own option bag. |
86
- | `SecurityIdentifierOptions` | type | `{ trust? } \| false` | Describes `createSecurity`'s `identifier` sub-option — request-id minting/echo policy, or `false` to disable the feature entirely. |
86
+ | `SecurityIdentifierOptions` | type | `{ readonly trust?: boolean; } \| false` | Describes `createSecurity`'s `identifier` sub-option — request-id minting/echo policy, or `false` to disable the feature entirely. |
87
87
  | `SecurityOptions` | interface | `{ frame?, csp?, referrer?, permissions?, coop?, corp?, cluster?, coep?, hsts?, identifier? }` | Configures `createSecurity` — the security-headers + request-id battery. |
88
88
  | `CorsOptions` | interface | `{ origin?, methods?, headers? }` | Configures `createCors` — Cross-Origin Resource Sharing. |
89
89
  | `DeadlineOptions` | interface | `{ ms, status? }` | Configures `createDeadline` — the application-level per-request deadline. |
90
- | `ForwardedOptions` | type | `{ proxies } \| { trusted }` | Configures `createForwarded` — the trusted-proxy client-IP resolver. |
90
+ | `ForwardedOptions` | type | `{ readonly proxies: number; } \| { readonly trusted: readonly string[]; }` | Configures `createForwarded` — the trusted-proxy client-IP resolver. |
91
91
  | `ETagOptions` | interface | `{ weak? }` | Configures `createETag` — dynamic response ETag + conditional GET. |
92
92
  | `BearerOptions` | interface | `{ secret, header?, scheme? }` | Configures `createBearer` — bearer-token authentication. |
93
93
  | `LimiterOptions` | interface | `{ store?, max, window, capacity?, key?, message?, clock?, policy?, evict? }` | Configures `createLimiter` — fixed-window rate limiting. |
@@ -96,20 +96,20 @@ A `Shape` cell holds an interface's data members as bare names in braces, `?` ma
96
96
  | `Client` | interface | `{ ip? }` | Describes the resolved client connection facts `createForwarded` stashes. |
97
97
  | `ClientState` | interface | `{ client? }` | Describes the client-facts state slice `createForwarded` stashes. |
98
98
  | `ConnectionState` | interface | `{ connection? }` | Describes the connection-facts state slice `createLimiter`'s default key derivation falls back to when neither `BearerState` nor `ClientState` is present — the raw socket peer surfaced on `context.state` by the server's `state` option. |
99
- | `SessionInterface` | interface | `{ id, state } plus set, delete, clear` | Represents a server-managed session's public surface — an id, its live state, and the mutators that write it. |
100
- | `SessionControlInterface` | interface | `{ destroyed, successor } plus regenerate, destroy` | Describes the mid-handler control handle `createSession` stashes alongside the session itself — the OWASP anti-fixation / logout primitives. |
99
+ | `SessionInterface` | interface | `{ id, state, set(), delete(), clear() }` | Represents a server-managed session's public surface — an id, its live state, and the mutators that write it. |
100
+ | `SessionControlInterface` | interface | `{ destroyed, successor, regenerate(), destroy() }` | Describes the mid-handler control handle `createSession` stashes alongside the session itself — the OWASP anti-fixation / logout primitives. |
101
101
  | `SessionState` | interface | `{ session?, control? }` | Describes the session state slice `createSession` stashes. |
102
102
  | `BodyState` | interface | `{ body? }` | Describes the body state slice `createBody` stashes. |
103
- | `SessionStoreInterface` | interface | `{} plus get, set, delete` | Describes the pluggable session persistence seam `createSession`'s `store` option implements — a point-access store keyed by session id. |
104
- | `SessionTransportInterface` | interface | `{} plus read, write, clear` | Describes the transport seam `createSession`'s `transport` option implements — how a session id travels to and from the client (a signed cookie, a header, …). |
103
+ | `SessionStoreInterface` | interface | `{ get(), set(), delete() }` | Describes the pluggable session persistence seam `createSession`'s `store` option implements — a point-access store keyed by session id. |
104
+ | `SessionTransportInterface` | interface | `{ read(), write(), clear() }` | Describes the transport seam `createSession`'s `transport` option implements — how a session id travels to and from the client (a signed cookie, a header, …). |
105
105
  | `SessionOptions` | interface | `{ transport, store?, ttl?, lifetime?, capacity?, evict?, create?, mint?, required?, clock? }` | Configures `createSession` — the generic session battery. |
106
106
  | `CookieTransportOptions` | interface | `{ name?, secret, cookie? }` | Configures `createCookieTransport` — the signed-cookie `SessionTransportInterface`. |
107
107
  | `HeaderTransportOptions` | interface | `{ header? }` | Configures `createHeaderTransport` — the bare-header `SessionTransportInterface`. |
108
- | `MemorySessionStoreOptions` | interface | `SessionLimits plus { capacity?, evict? }` | Configures `createMemorySessionStore` — the default in-process `SessionStoreInterface`. |
108
+ | `MemorySessionStoreOptions` | interface | `{ capacity?, evict? }` | Configures `createMemorySessionStore` — the default in-process `SessionStoreInterface`. |
109
109
  | `SessionLimits` | interface | `{ ttl?, lifetime? }` | Describes the idle and absolute-lifetime thresholds a session store enforces — `sessionExpired`'s limits argument and both shipped stores' construction options. |
110
110
  | `SessionCursors` | interface | `{ seen, created }` | Describes the per-session instants a store stamps and `sessionExpired` measures against. |
111
- | `SessionRow` | interface | `SessionCursors plus { id, session }` | Represents one persisted session row — an opaque snapshot column plus the store-owned idle/absolute-lifetime cursors, the shape a `DatabaseSessionStore`'s backing table holds. |
112
- | `SessionEntry` | interface | `SessionCursors plus { session }` | Represents one in-process session entry — the payload `MemorySessionStore` holds against an id, alongside the same cursors a persisted row carries. |
111
+ | `SessionRow` | interface | `{ id, session }` | Represents one persisted session row — an opaque snapshot column plus the store-owned idle/absolute-lifetime cursors, the shape a `DatabaseSessionStore`'s backing table holds. |
112
+ | `SessionEntry` | interface | `{ session }` | Represents one in-process session entry — the payload `MemorySessionStore` holds against an id, alongside the same cursors a persisted row carries. |
113
113
  | `SessionSnapshot` | interface | `{ id, state }` | Represents a session's serializable projection — the value `snapshotSession` produces and a durable store's `set` writes. |
114
114
  | `SessionRestoreFunction` | type | `(value: unknown) => SessionInterface \| undefined` | Rebuilds a session entity from an untrusted stored snapshot, or resolves `undefined` when the value is malformed. |
115
115
  | `CSRFState` | interface | `{ csrf? }` | Describes the CSRF state slice `createCSRF` stashes — the raw token a safe-method response exposes for a subsequent mutating request to submit back. |
@@ -118,7 +118,7 @@ A `Shape` cell holds an interface's data members as bare names in braces, `?` ma
118
118
  | `MultipartBody` | interface | `{ files, fields }` | Describes the parsed multipart request body `createMultipart` stashes — files keyed by their field name, plus every plain text field. |
119
119
  | `MultipartState` | interface | `{ multipart? }` | Describes the multipart state slice `createMultipart` stashes. |
120
120
  | `Asset` | interface | `{ body, encoding? }` | Describes one in-memory asset representation returned by an `AssetSourceInterface`. |
121
- | `AssetSourceInterface` | interface | `{} plus read` | Reads in-memory assets by decoded, browser-build-relative path. |
121
+ | `AssetSourceInterface` | interface | `{ read() }` | Reads in-memory assets by decoded, browser-build-relative path. |
122
122
  | `AssetOptions` | interface | `{ source, store? }` | Configures `createAssets` — in-memory identity/Brotli asset serving. |
123
123
  | `StaticOptions` | interface | `{ root, prefix?, index?, dotfiles?, cache?, etag?, fallback? }` | Configures `createStatic` — node `fs`-backed static file serving. |
124
124
  | `MultipartLimitsInput` | interface | `{ file?, field?, total? }` | Describes the caller's partial `MultipartLimits` — `createMultipart`'s `limits` option, with every member optional. |
@@ -127,13 +127,13 @@ A `Shape` cell holds an interface's data members as bare names in braces, `?` ma
127
127
  | `NodeCompressionOptions` | interface | `{ threshold?, filter? }` | Configures the node face's `createCompression` — `node:zlib`-backed response compression. |
128
128
  | `MultipartErrorCode` | type | `'limit' \| 'malformed' \| 'rejected'` | Names the reason `createMultipart` rejected a request — the machine-readable code `MultipartError` carries and maps onto its HTTP status: `'limit'` → 413, `'malformed'` → 400, `'rejected'` → 415. |
129
129
  | `UploadStatus` | type | `'staged' \| 'moved'` | Names the lifecycle stage of one staged upload's temp file. |
130
- | `UploadedFile` | interface | `Omit<MultipartFile, 'status'> plus { status }` | Describes one uploaded file's post-parse record — the node-bound, richer sibling of the pure core's `MultipartFile` (identical fields, `status` narrowed to `UploadStatus`). Structurally assignable into `MultipartFile` so a `createMultipart`-built `MultipartBody` satisfies the shared core shape. |
130
+ | `UploadedFile` | interface | `{ status }` | Describes one uploaded file's post-parse record — the node-bound, richer sibling of the pure core's `MultipartFile` (identical fields, `status` narrowed to `UploadStatus`). Structurally assignable into `MultipartFile` so a `createMultipart`-built `MultipartBody` satisfies the shared core shape. |
131
131
  | `PartHeaders` | interface | `{ name, filename, mime }` | Describes one multipart part's parsed header block — `parsePartHeaders`'s return shape. |
132
132
  | `ByteRange` | interface | `{ start, end }` | Describes one inclusive byte range over a file — `streamFile`'s optional `range` argument and the shape `createStatic` builds for a satisfiable `Range` request. |
133
133
 
134
134
  ### Store and response types
135
135
 
136
- | Type | Kind | Shape | Summary |
136
+ | Name | Kind | Signature | Summary |
137
137
  | --------------------------- | --------- | --------------------------------- | ------------------------------------------------------------------------------ |
138
138
  | `StaticFile` | interface | `{ path, handle, info }` | Describes an opened static file and the facts read from its handle. |
139
139
  | `StaticResolution` | interface | `{ path, contained }` | Describes a canonical static path and whether it lies inside the serving root. |
@@ -141,110 +141,110 @@ A `Shape` cell holds an interface's data members as bare names in braces, `?` ma
141
141
  | `LimiterLimits` | interface | `{ max, window }` | Describes the budget and duration used when a limiter window starts. |
142
142
  | `LimiterResult` | interface | `{ admitted, expiry }` | Reports an atomic admission decision and its window expiry instant. |
143
143
  | `LimiterEntry` | interface | `{ budget, expiry }` | Holds the budget and expiry instant of an in-memory limiter entry. |
144
- | `LimiterStoreInterface` | interface | `{} plus consume` | Provides atomic per-key fixed-window admission. |
144
+ | `LimiterStoreInterface` | interface | `{ consume() }` | Provides atomic per-key fixed-window admission. |
145
145
  | `MemoryLimiterStoreOptions` | interface | `{ capacity?, evict? }` | Configures the in-memory limiter's capacity and eviction observation. |
146
146
  | `AssetRecord` | interface | `{ key, identity, brotli, etag }` | Holds copied asset representations and their shared identity validator. |
147
- | `AssetStoreInterface` | interface | `{} plus get, set, delete` | Provides asynchronous point access to cached asset representations. |
147
+ | `AssetStoreInterface` | interface | `{ get(), set(), delete() }` | Provides asynchronous point access to cached asset representations. |
148
148
 
149
149
  ### Request control and stores
150
150
 
151
- | API | Kind | Summary |
152
- | -------------------------- | -------- | ----------------------------------------------------------------------------------- |
153
- | `SessionControl` | class | Records one request's session regeneration or destruction intent. |
154
- | `MemoryLimiterStore` | class | Stores fixed-window budgets with atomic admission and bounded LRU retention. |
155
- | `MemoryAssetStore` | class | Stores asset representations by key for the lifetime of the store. |
156
- | `createMemoryLimiterStore` | function | Creates a bounded in-memory atomic limiter store. |
157
- | `createMemoryAssetStore` | function | Creates an in-memory asset representation store. |
158
- | `extractBearerToken` | function | Extracts a token after a case-insensitive scheme and one space. |
159
- | `extractFieldToken` | function | Extracts a string field from a parsed body record. |
160
- | `resolveStaticFile` | function | Resolves a contained static path, including a directory's index. |
161
- | `openStaticFile` | function | Opens a static file and reads its handle's metadata. |
162
- | `planStaticResponse` | function | Plans conditional, HEAD, and byte-range responses from opened-file metadata. |
163
- | `resolveAssetKey` | function | Resolves a decoded relative asset key while refusing hidden or traversing segments. |
164
- | `readAssetRecord` | function | Copies an asset, derives its identity bytes, and computes their validator. |
165
- | `buildAssetResponse` | function | Builds a conditional asset response with identity or Brotli negotiation. |
151
+ | Name | Kind | Signature | Summary |
152
+ | -------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------- |
153
+ | `SessionControl` | class | `new (session: SessionInterface, create?: (id: string) => SessionInterface) => SessionControlInterface` | Records one request's session regeneration or destruction intent. |
154
+ | `MemoryLimiterStore` | class | `new (options?: MemoryLimiterStoreOptions) => LimiterStoreInterface` | Stores fixed-window budgets with atomic admission and bounded LRU retention. |
155
+ | `MemoryAssetStore` | class | `new () => AssetStoreInterface` | Stores asset representations by key for the lifetime of the store. |
156
+ | `createMemoryLimiterStore` | function | `(options?: MemoryLimiterStoreOptions) => LimiterStoreInterface` | Creates a bounded in-memory atomic limiter store. |
157
+ | `createMemoryAssetStore` | function | `() => AssetStoreInterface` | Creates an in-memory asset representation store. |
158
+ | `extractBearerToken` | function | `(raw: string, scheme: string) => string \| undefined` | Extracts a token after a case-insensitive scheme and one space. |
159
+ | `extractFieldToken` | function | `(body: unknown, field: string) => string \| undefined` | Extracts a string field from a parsed body record. |
160
+ | `resolveStaticFile` | function | `(target: string, rootReal: string, index: string) => Promise<StaticResolution \| undefined>` | Resolves a contained static path, including a directory's index. |
161
+ | `openStaticFile` | function | `(path: string) => Promise<StaticFile \| undefined>` | Opens a static file and reads its handle's metadata. |
162
+ | `planStaticResponse` | function | `(request: Request, method: string, info: Stats, path: string, options: Pick<StaticOptions, 'cache' \| 'etag'>) => StaticPlan` | Plans conditional, HEAD, and byte-range responses from opened-file metadata. |
163
+ | `resolveAssetKey` | function | `(pathname: string) => string \| undefined` | Resolves a decoded relative asset key while refusing hidden or traversing segments. |
164
+ | `readAssetRecord` | function | `(source: AssetSourceInterface, key: string) => Promise<AssetRecord \| undefined>` | Copies an asset, derives its identity bytes, and computes their validator. |
165
+ | `buildAssetResponse` | function | `(request: Request, method: string, record: AssetRecord) => Response` | Builds a conditional asset response with identity or Brotli negotiation. |
166
166
 
167
167
  ### Constants
168
168
 
169
169
  A `Shape` cell holds the constant's declared type.
170
170
 
171
- | API | Kind | Shape | Summary |
172
- | --------------------------------- | ----- | ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
173
- | `DEFAULT_COMPRESSION_THRESHOLD` | const | `number` | Holds `1024`, the default minimum buffered body size in bytes `createCompression` will compress. |
174
- | `DEFAULT_COMPRESSION_ENCODINGS` | const | `readonly Encoding[]` | Lists `['gzip', 'deflate']`, the default content-codings `createCompression` offers in preference order — intersected at construction with what the runtime's `CompressionStream` actually supports. |
175
- | `DEFAULT_FRAME_OPTIONS` | const | `string` | Holds `'DENY'`, the default `X-Frame-Options` value `createSecurity` sets. |
176
- | `DEFAULT_CSP` | const | `string` | Holds `"default-src 'self'; base-uri 'self'; object-src 'none'; frame-ancestors 'self'; form-action 'self'"`, the default `Content-Security-Policy` value `createSecurity` sets — a custom `csp` option replaces this wholesale, never merges. |
177
- | `DEFAULT_REFERRER_POLICY` | const | `string` | Holds `'strict-origin-when-cross-origin'`, the default `Referrer-Policy` value `createSecurity` sets. |
178
- | `DEFAULT_PERMISSIONS_POLICY` | const | `string` | Holds `'camera=(), microphone=(), geolocation=()'`, the default `Permissions-Policy` value `createSecurity` sets. |
179
- | `DEFAULT_COOP` | const | `string` | Holds `'same-origin'`, the default `Cross-Origin-Opener-Policy` value `createSecurity` sets. |
180
- | `DEFAULT_CORP` | const | `string` | Holds `'same-origin'`, the default `Cross-Origin-Resource-Policy` value `createSecurity` sets. |
181
- | `DEFAULT_CLUSTER` | const | `string` | Holds `'?1'`, the default `Origin-Agent-Cluster` value `createSecurity` sets. |
182
- | `DEFAULT_COEP` | const | `string` | Holds `'require-corp'`, the value `createSecurity` sets for `Cross-Origin-Embedder-Policy` when `coep: true`. |
183
- | `DEFAULT_HSTS` | const | `string` | Holds `'max-age=31536000; includeSubDomains'`, the value `createSecurity` sets for `Strict-Transport-Security` when `hsts: true`. |
184
- | `DEFAULT_IDENTIFIER_HEADER` | const | `string` | Names `'x-request-id'`, the default header `createSecurity` mints or echoes a request identifier into. |
185
- | `DEFAULT_CORS_METHODS` | const | `readonly string[]` | Lists the default methods `createCors` advertises on a preflight response. |
186
- | `DEFAULT_CORS_HEADERS` | const | `readonly string[]` | Lists the default headers `createCors` advertises on a preflight response. |
187
- | `DEFAULT_DEADLINE_STATUS` | const | `number` | Holds `503`, the default response status `createDeadline` returns when its deadline fires first. |
188
- | `DEFAULT_BEARER_HEADER` | const | `string` | Names `'authorization'`, the default header `createBearer` reads the token from. |
189
- | `DEFAULT_BEARER_SCHEME` | const | `string` | Names `'Bearer'`, the default scheme prefix `createBearer` strips before verification. |
190
- | `DEFAULT_LIMITER_CAPACITY` | const | `number` | Holds `10_000`, the default maximum number of distinct rate-limit keys `createLimiter` tracks before LRU eviction. |
191
- | `DEFAULT_LIMITER_MESSAGE` | const | `string` | Holds `'rate limit exceeded'`, the default 429 body message `createLimiter` sends when a key is over budget. |
192
- | `DEFAULT_SESSION_CAPACITY` | const | `number` | Holds `10_000`, the default maximum number of distinct session ids `createMemorySessionStore` tracks before LRU (by last write) eviction. |
193
- | `DEFAULT_SESSION_COOKIE` | const | `string` | Names `'session'`, the default cookie `createCookieTransport` writes the signed session id under. |
194
- | `DEFAULT_SESSION_HEADER` | const | `string` | Names `'session-id'`, the default header `createHeaderTransport` carries the session id in. |
195
- | `DEFAULT_CSRF_COOKIE` | const | `string` | Names `'csrf'`, the default signed cookie `createCSRF` writes the CSRF token under. |
196
- | `DEFAULT_CSRF_HEADER` | const | `string` | Names `'x-csrf-token'`, the default header `createCSRF` reads a mutating request's submitted token from. |
197
- | `DEFAULT_CSRF_FIELD` | const | `string` | Names `'_csrf'`, the default body field `createCSRF` falls back to reading a mutating request's submitted token from. |
198
- | `DEFAULT_CSRF_SAFE_METHODS` | const | `readonly string[]` | Lists `['GET', 'HEAD', 'OPTIONS']`, the default methods `createCSRF` treats as safe (mint instead of verify). |
199
- | `MULTIPART_STATUS` | const | `Readonly<Record<MultipartErrorCode, number>>` | Holds the HTTP status `createMultipart` renders for each `MultipartErrorCode`: `'limit'` is 413, `'malformed'` is 400, and `'rejected'` is 415. |
200
- | `MULTIPART_ERROR_BRAND` | const | `unique symbol` | Holds the `Symbol.for` brand `MultipartError` carries so `isMultipartError` recognizes an instance across duplicate copies of this package — a registry symbol rather than a module-local `Symbol()`, which would mint an unequal symbol per copy. |
201
- | `NODE_COMPRESSION_ENCODINGS` | const | `readonly Encoding[]` | Lists `['gzip', 'deflate']`, the content-codings the node face's `createCompression` offers — what `node:zlib` guarantees on every Node runtime, so this face never feature-detects. |
202
- | `DEFAULT_STATIC_INDEX` | const | `string` | Names `'index.html'`, `createStatic`'s default directory-index filename. |
203
- | `DEFAULT_STATIC_FALLBACK_EXCLUDE` | const | `string` | Names `'/api'`, `createStatic`'s `fallback: true` default excluded path prefix. |
204
- | `DEFAULT_STATIC_DOTFILES` | const | `NonNullable<StaticOptions['dotfiles']>` | Names `'ignore'`, `createStatic`'s default policy for a path carrying a dotfile segment. |
205
- | `DEFAULT_CONTENT_TYPE` | const | `string` | Names `'application/octet-stream'`, the MIME type served when a file extension has no known mapping. |
206
- | `DEFAULT_MULTIPART_FILE_SIZE` | const | `number` | Holds `10_485_760`, `createMultipart`'s default per-file byte-size cap. |
207
- | `DEFAULT_MULTIPART_FILE_COUNT` | const | `number` | Holds `10`, `createMultipart`'s default maximum file-part count. |
208
- | `DEFAULT_MULTIPART_FIELD_SIZE` | const | `number` | Holds `65_536`, `createMultipart`'s default per-field byte-size cap. |
209
- | `DEFAULT_MULTIPART_FIELD_COUNT` | const | `number` | Holds `100`, `createMultipart`'s default maximum field-part count. |
210
- | `DEFAULT_MULTIPART_TOTAL` | const | `number` | Holds `52_428_800`, `createMultipart`'s default combined request-body byte-size cap. |
211
- | `MULTIPART_MAX_HEADER_BLOCK` | const | `number` | Holds `16_384`, the maximum bytes a single multipart part's header block may occupy before it is malformed. |
212
- | `MULTIPART_MAX_PREAMBLE` | const | `number` | Holds `65_536`, the maximum bytes scanned before the first multipart boundary is found before it is malformed. |
213
- | `RESERVED_DEVICE_NAMES` | const | `ReadonlySet<string>` | Lists the Windows reserved device-name stems (CVE-2025-27210) — matched case-insensitively against the segment's stem (before its first `.`). |
214
- | `EXTENSION_TYPES` | const | `Readonly<Record<string, string>>` | Holds the file-extension (lowercase, with leading `.`) → MIME type lookup table for static serving. |
171
+ | Name | Kind | Signature | Summary |
172
+ | --------------------------------- | ----- | ------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
173
+ | `DEFAULT_COMPRESSION_THRESHOLD` | const | `1024` | Holds `1024`, the default minimum buffered body size in bytes `createCompression` will compress. |
174
+ | `DEFAULT_COMPRESSION_ENCODINGS` | const | `readonly Encoding[]` | Lists `['gzip', 'deflate']`, the default content-codings `createCompression` offers in preference order — intersected at construction with what the runtime's `CompressionStream` actually supports. |
175
+ | `DEFAULT_FRAME_OPTIONS` | const | `"DENY"` | Holds `'DENY'`, the default `X-Frame-Options` value `createSecurity` sets. |
176
+ | `DEFAULT_CSP` | const | `"default-src 'self'; base-uri 'self'; object-src 'none'; frame-ancestors 'self'; form-action 'self'"` | Holds `"default-src 'self'; base-uri 'self'; object-src 'none'; frame-ancestors 'self'; form-action 'self'"`, the default `Content-Security-Policy` value `createSecurity` sets — a custom `csp` option replaces this wholesale, never merges. |
177
+ | `DEFAULT_REFERRER_POLICY` | const | `"strict-origin-when-cross-origin"` | Holds `'strict-origin-when-cross-origin'`, the default `Referrer-Policy` value `createSecurity` sets. |
178
+ | `DEFAULT_PERMISSIONS_POLICY` | const | `"camera=(), microphone=(), geolocation=()"` | Holds `'camera=(), microphone=(), geolocation=()'`, the default `Permissions-Policy` value `createSecurity` sets. |
179
+ | `DEFAULT_COOP` | const | `"same-origin"` | Holds `'same-origin'`, the default `Cross-Origin-Opener-Policy` value `createSecurity` sets. |
180
+ | `DEFAULT_CORP` | const | `"same-origin"` | Holds `'same-origin'`, the default `Cross-Origin-Resource-Policy` value `createSecurity` sets. |
181
+ | `DEFAULT_CLUSTER` | const | `"?1"` | Holds `'?1'`, the default `Origin-Agent-Cluster` value `createSecurity` sets. |
182
+ | `DEFAULT_COEP` | const | `"require-corp"` | Holds `'require-corp'`, the value `createSecurity` sets for `Cross-Origin-Embedder-Policy` when `coep: true`. |
183
+ | `DEFAULT_HSTS` | const | `"max-age=31536000; includeSubDomains"` | Holds `'max-age=31536000; includeSubDomains'`, the value `createSecurity` sets for `Strict-Transport-Security` when `hsts: true`. |
184
+ | `DEFAULT_IDENTIFIER_HEADER` | const | `"x-request-id"` | Names `'x-request-id'`, the default header `createSecurity` mints or echoes a request identifier into. |
185
+ | `DEFAULT_CORS_METHODS` | const | `readonly string[]` | Lists the default methods `createCors` advertises on a preflight response. |
186
+ | `DEFAULT_CORS_HEADERS` | const | `readonly string[]` | Lists the default headers `createCors` advertises on a preflight response. |
187
+ | `DEFAULT_DEADLINE_STATUS` | const | `503` | Holds `503`, the default response status `createDeadline` returns when its deadline fires first. |
188
+ | `DEFAULT_BEARER_HEADER` | const | `"authorization"` | Names `'authorization'`, the default header `createBearer` reads the token from. |
189
+ | `DEFAULT_BEARER_SCHEME` | const | `"Bearer"` | Names `'Bearer'`, the default scheme prefix `createBearer` strips before verification. |
190
+ | `DEFAULT_LIMITER_CAPACITY` | const | `10000` | Holds `10_000`, the default maximum number of distinct rate-limit keys `createLimiter` tracks before LRU eviction. |
191
+ | `DEFAULT_LIMITER_MESSAGE` | const | `"rate limit exceeded"` | Holds `'rate limit exceeded'`, the default 429 body message `createLimiter` sends when a key is over budget. |
192
+ | `DEFAULT_SESSION_CAPACITY` | const | `10000` | Holds `10_000`, the default maximum number of distinct session ids `createMemorySessionStore` tracks before LRU (by last write) eviction. |
193
+ | `DEFAULT_SESSION_COOKIE` | const | `"session"` | Names `'session'`, the default cookie `createCookieTransport` writes the signed session id under. |
194
+ | `DEFAULT_SESSION_HEADER` | const | `"session-id"` | Names `'session-id'`, the default header `createHeaderTransport` carries the session id in. |
195
+ | `DEFAULT_CSRF_COOKIE` | const | `"csrf"` | Names `'csrf'`, the default signed cookie `createCSRF` writes the CSRF token under. |
196
+ | `DEFAULT_CSRF_HEADER` | const | `"x-csrf-token"` | Names `'x-csrf-token'`, the default header `createCSRF` reads a mutating request's submitted token from. |
197
+ | `DEFAULT_CSRF_FIELD` | const | `"_csrf"` | Names `'_csrf'`, the default body field `createCSRF` falls back to reading a mutating request's submitted token from. |
198
+ | `DEFAULT_CSRF_SAFE_METHODS` | const | `readonly string[]` | Lists `['GET', 'HEAD', 'OPTIONS']`, the default methods `createCSRF` treats as safe (mint instead of verify). |
199
+ | `MULTIPART_STATUS` | const | `Readonly<Record<MultipartErrorCode, number>>` | Holds the HTTP status `createMultipart` renders for each `MultipartErrorCode`: `'limit'` is 413, `'malformed'` is 400, and `'rejected'` is 415. |
200
+ | `MULTIPART_ERROR_BRAND` | const | `unique symbol` | Holds the `Symbol.for` brand `MultipartError` carries so `isMultipartError` recognizes an instance across duplicate copies of this package — a registry symbol rather than a module-local `Symbol()`, which would mint an unequal symbol per copy. |
201
+ | `NODE_COMPRESSION_ENCODINGS` | const | `readonly Encoding[]` | Lists `['gzip', 'deflate']`, the content-codings the node face's `createCompression` offers — what `node:zlib` guarantees on every Node runtime, so this face never feature-detects. |
202
+ | `DEFAULT_STATIC_INDEX` | const | `"index.html"` | Names `'index.html'`, `createStatic`'s default directory-index filename. |
203
+ | `DEFAULT_STATIC_FALLBACK_EXCLUDE` | const | `"/api"` | Names `'/api'`, `createStatic`'s `fallback: true` default excluded path prefix. |
204
+ | `DEFAULT_STATIC_DOTFILES` | const | `NonNullable<StaticOptions['dotfiles']>` | Names `'ignore'`, `createStatic`'s default policy for a path carrying a dotfile segment. |
205
+ | `DEFAULT_CONTENT_TYPE` | const | `"application/octet-stream"` | Names `'application/octet-stream'`, the MIME type served when a file extension has no known mapping. |
206
+ | `DEFAULT_MULTIPART_FILE_SIZE` | const | `10485760` | Holds `10_485_760`, `createMultipart`'s default per-file byte-size cap. |
207
+ | `DEFAULT_MULTIPART_FILE_COUNT` | const | `10` | Holds `10`, `createMultipart`'s default maximum file-part count. |
208
+ | `DEFAULT_MULTIPART_FIELD_SIZE` | const | `65536` | Holds `65_536`, `createMultipart`'s default per-field byte-size cap. |
209
+ | `DEFAULT_MULTIPART_FIELD_COUNT` | const | `100` | Holds `100`, `createMultipart`'s default maximum field-part count. |
210
+ | `DEFAULT_MULTIPART_TOTAL` | const | `52428800` | Holds `52_428_800`, `createMultipart`'s default combined request-body byte-size cap. |
211
+ | `MULTIPART_MAX_HEADER_BLOCK` | const | `16384` | Holds `16_384`, the maximum bytes a single multipart part's header block may occupy before it is malformed. |
212
+ | `MULTIPART_MAX_PREAMBLE` | const | `65536` | Holds `65_536`, the maximum bytes scanned before the first multipart boundary is found before it is malformed. |
213
+ | `RESERVED_DEVICE_NAMES` | const | `ReadonlySet<string>` | Lists the Windows reserved device-name stems (CVE-2025-27210) — matched case-insensitively against the segment's stem (before its first `.`). |
214
+ | `EXTENSION_TYPES` | const | `Readonly<Record<string, string>>` | Holds the file-extension (lowercase, with leading `.`) → MIME type lookup table for static serving. |
215
215
 
216
216
  ### Shapers
217
217
 
218
218
  A `Shape` cell holds the constant's declared type.
219
219
 
220
- | API | Kind | Shape | Summary |
221
- | ---------------- | ----- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
222
- | `sessionColumns` | const | `{ id, session, seen, created }` | Holds the `@orkestrel/database` column shape for a `SessionRow` table. Pass it as-is to `createDatabase({ tables: { sessions: sessionColumns } })` so an app declaring a durable session table never hand-writes the shape. |
220
+ | Name | Kind | Signature | Summary |
221
+ | ---------------- | ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
222
+ | `sessionColumns` | const | `{ id: import("@orkestrel/contract").StringShape; session: import("@orkestrel/contract").JSONShape; seen: import("@orkestrel/contract").NumberShape; created: import("@orkestrel/contract").NumberShape; }` | Holds the `@orkestrel/database` column shape for a `SessionRow` table. Pass it as-is to `createDatabase({ tables: { sessions: sessionColumns } })` so an app declaring a durable session table never hand-writes the shape. |
223
223
 
224
224
  ### Helpers — core
225
225
 
226
- | API | Kind | Summary |
227
- | ----------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
228
- | `resolveKey` | function | Derives `createLimiter`'s default rate-limit bucket key from a request's resolved identity facts. |
229
- | `resolveOptInHeader` | function | Resolves an opt-in, value-bearing security header — `string \| boolean` (off by default, `true` uses the secure default), the shape `createSecurity`'s `coep`/`hsts` options use, distinct from the plain value-or-`false` shape `resolveSecurityHeader` (the peer substrate) handles. |
230
- | `buildRetryAfter` | function | Builds the `Retry-After` header value — whole seconds until a window reset, floored at a minimum of `1`. |
231
- | `buildRateLimitField` | function | Builds the draft `RateLimit` structured header field — emitted only when `createLimiter`'s `policy` option is `true`. |
232
- | `buildRateLimitPolicyField` | function | Builds the draft `RateLimit-Policy` structured header field — emitted only when `createLimiter`'s `policy` option is `true`. |
233
- | `matchesTrustedEntry` | function | Checks whether a candidate address is a bare (non-CIDR) trusted-hop match — an exact string match, or a simple prefix-CIDR match for IPv4 (`/8`–`/32`). An IPv6 entry matches by exact string only — there is no IPv6 CIDR support. |
234
- | `resolveForwardedFor` | function | Walks `X-Forwarded-For` right-to-left and resolves the first untrusted hop address — `createForwarded`'s core algorithm. |
235
- | `detectEncodings` | function | Feature-detects which of `candidates` the runtime's `CompressionStream` actually supports — `createCompression`'s construction-time intersection. |
236
- | `compressBytes` | function | Compresses bytes with the host-independent `CompressionStream` primitive. |
237
- | `matchesUnbufferableResponse` | function | Checks whether a response must skip the compression and ETag buffering pipeline — the shared cheap-skip predicate both batteries apply before ever touching `response.arrayBuffer()`, true for a `HEAD` request, a `204`/`304` or otherwise bodyless response, an `event-stream` response, and a response already carrying the header the caller is about to set. |
238
- | `isCompressionNegotiated` | function | Checks whether a negotiated `Accept-Encoding` outcome is worth acting on — `createCompression`'s negotiation-eligibility half of the skip list. |
239
- | `rebuildResponse` | function | Rebuilds a `Response` around a replacement body while preserving its status/statusText — the buffered-response reconstruction shared by the compression and ETag batteries after they have consumed `response.arrayBuffer()`. |
240
- | `compressResponse` | function | Runs the shared negotiate → skip → threshold → compress → header-set skeleton both faces' `createCompression` batteries compose — response-body compression over a caller-supplied set of feature-detected codings. |
241
- | `transferSessionState` | function | Copies every entry of one session's `state` into another — the regenerate state-carry `createSession`'s `control.regenerate()` applies. |
242
- | `sessionExpired` | function | Checks whether a session has aged past its idle timeout or absolute lifetime as of `now` — the pure expiry predicate `MemorySessionStore` delegates to. |
243
- | `snapshotSession` | function | Snapshots a session's `state` into a plain, serializable record — the projection a durable store's `set` writes to disk. |
244
- | `validateSessionLimits` | function | Validates a store's idle and absolute-lifetime thresholds, throwing when either is present and malformed — the shared construction gate `MemorySessionStore` and `DatabaseSessionStore` both apply, so one malformed `ttl` is refused identically by whichever store receives it. |
245
- | `isPreflight` | function | Determines whether a request is a CORS preflight — an `OPTIONS` request carrying an `Access-Control-Request-Method` header. |
246
- | `buildClient` | function | Builds the `Client` slice `createForwarded` stashes, from the resolved client IP — a leaf shaping helper. |
247
- | `equalsConstantTime` | function | Compares two strings in constant time — `createCSRF`'s double-submit token comparison, avoiding a timing oracle on the submitted-vs-cookie match. |
226
+ | Name | Kind | Signature | Summary |
227
+ | ----------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
228
+ | `resolveKey` | function | `(state: BearerState & ClientState & ConnectionState) => string` | Derives `createLimiter`'s default rate-limit bucket key from a request's resolved identity facts. |
229
+ | `resolveOptInHeader` | function | `(value: string \| boolean \| undefined, fallback: string) => string \| undefined` | Resolves an opt-in, value-bearing security header — `string \| boolean` (off by default, `true` uses the secure default), the shape `createSecurity`'s `coep`/`hsts` options use, distinct from the plain value-or-`false` shape `resolveSecurityHeader` (the peer substrate) handles. |
230
+ | `buildRetryAfter` | function | `(expiry: number, now: number) => string` | Builds the `Retry-After` header value — whole seconds until a window reset, floored at a minimum of `1`. |
231
+ | `buildRateLimitField` | function | `(remaining: number, expiry: number, now: number) => string` | Builds the draft `RateLimit` structured header field — emitted only when `createLimiter`'s `policy` option is `true`. |
232
+ | `buildRateLimitPolicyField` | function | `(max: number, window: number) => string` | Builds the draft `RateLimit-Policy` structured header field — emitted only when `createLimiter`'s `policy` option is `true`. |
233
+ | `matchesTrustedEntry` | function | `(address: string, entry: string) => boolean` | Checks whether a candidate address is a bare (non-CIDR) trusted-hop match — an exact string match, or a simple prefix-CIDR match for IPv4 (`/8`–`/32`). An IPv6 entry matches by exact string only — there is no IPv6 CIDR support. |
234
+ | `resolveForwardedFor` | function | `(header: string \| undefined, trust: ForwardedOptions) => string \| undefined` | Walks `X-Forwarded-For` right-to-left and resolves the first untrusted hop address — `createForwarded`'s core algorithm. |
235
+ | `detectEncodings` | function | `(candidates: readonly Encoding[]) => readonly Encoding[]` | Feature-detects which of `candidates` the runtime's `CompressionStream` actually supports — `createCompression`'s construction-time intersection. |
236
+ | `compressBytes` | function | `(bytes: Uint8Array<ArrayBuffer>, encoding: Exclude<Encoding, 'identity'>) => Promise<Uint8Array<ArrayBuffer>>` | Compresses bytes with the host-independent `CompressionStream` primitive. |
237
+ | `matchesUnbufferableResponse` | function | `(method: string, response: Response, skipHeader: string) => boolean` | Checks whether a response must skip the compression and ETag buffering pipeline — the shared cheap-skip predicate both batteries apply before ever touching `response.arrayBuffer()`, true for a `HEAD` request, a `204`/`304` or otherwise bodyless response, an `event-stream` response, and a response already carrying the header the caller is about to set. |
238
+ | `isCompressionNegotiated` | function | `(encoding: Encoding \| undefined) => encoding is Exclude<Encoding, 'identity'>` | Checks whether a negotiated `Accept-Encoding` outcome is worth acting on — `createCompression`'s negotiation-eligibility half of the skip list. |
239
+ | `rebuildResponse` | function | `(body: ConstructorParameters<typeof Response>[0], response: Response, headers?: ConstructorParameters<typeof Headers>[0]) => Response` | Rebuilds a `Response` around a replacement body while preserving its status/statusText — the buffered-response reconstruction shared by the compression and ETag batteries after they have consumed `response.arrayBuffer()`. |
240
+ | `compressResponse` | function | `(request: Request, context: MiddlewareContext<unknown>, response: Response, options: CompressResponseOptions) => Promise<Response>` | Runs the shared negotiate → skip → threshold → compress → header-set skeleton both faces' `createCompression` batteries compose — response-body compression over a caller-supplied set of feature-detected codings. |
241
+ | `transferSessionState` | function | `(from: SessionInterface, to: SessionInterface) => void` | Copies every entry of one session's `state` into another — the regenerate state-carry `createSession`'s `control.regenerate()` applies. |
242
+ | `sessionExpired` | function | `(cursors: SessionCursors, now: number, limits: SessionLimits) => boolean` | Checks whether a session has aged past its idle timeout or absolute lifetime as of `now` — the pure expiry predicate `MemorySessionStore` delegates to. |
243
+ | `snapshotSession` | function | `(session: SessionInterface) => SessionSnapshot` | Snapshots a session's `state` into a plain, serializable record — the projection a durable store's `set` writes to disk. |
244
+ | `validateSessionLimits` | function | `(limits: SessionLimits \| undefined) => void` | Validates a store's idle and absolute-lifetime thresholds, throwing when either is present and malformed — the shared construction gate `MemorySessionStore` and `DatabaseSessionStore` both apply, so one malformed `ttl` is refused identically by whichever store receives it. |
245
+ | `isPreflight` | function | `(method: string, headers: Headers) => boolean` | Determines whether a request is a CORS preflight — an `OPTIONS` request carrying an `Access-Control-Request-Method` header. |
246
+ | `buildClient` | function | `(ip: string \| undefined) => Client` | Builds the `Client` slice `createForwarded` stashes, from the resolved client IP — a leaf shaping helper. |
247
+ | `equalsConstantTime` | function | `(a: string, b: string) => boolean` | Compares two strings in constant time — `createCSRF`'s double-submit token comparison, avoiding a timing oracle on the submitted-vs-cookie match. |
248
248
 
249
249
  ### Validators — core
250
250
 
@@ -252,52 +252,52 @@ Each guard in the following table is total: it accepts any input, returns `false
252
252
 
253
253
  In a guard table a `Shape` cell holds the type the guard narrows to.
254
254
 
255
- | API | Kind | Shape | Summary |
256
- | ------------------ | -------- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
257
- | `isSession` | function | `SessionInterface` | Determines whether a value implements `SessionInterface` — a total structural guard: an `id` string, a `state` `Map`, and the `set`, `delete`, and `clear` mutators. Prototype-agnostic — accepts a plain object, a null-prototype object, and a class instance (a real `Session`), because a restored or stored session is routinely a class instance rather than a literal. |
258
- | `isSessionControl` | function | `SessionControlInterface` | Determines whether a value implements `SessionControlInterface` — a total structural guard: callable `regenerate` and `destroy`. |
259
- | `isMultipartFile` | function | `MultipartFile` | Determines whether a value is one staged `MultipartFile` record — a total structural guard checking every required field's shape. |
260
- | `isMultipartBody` | function | `MultipartBody` | Determines whether a value implements `MultipartBody` — a total structural guard: `files` keyed by field name to arrays of `MultipartFile`, and a `fields` string record. |
255
+ | Name | Kind | Signature | Summary |
256
+ | ------------------ | -------- | ------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
257
+ | `isSession` | function | `(value: unknown) => value is SessionInterface` | Determines whether a value implements `SessionInterface` — a total structural guard: an `id` string, a `state` `Map`, and the `set`, `delete`, and `clear` mutators. Prototype-agnostic — accepts a plain object, a null-prototype object, and a class instance (a real `Session`), because a restored or stored session is routinely a class instance rather than a literal. |
258
+ | `isSessionControl` | function | `(value: unknown) => value is SessionControlInterface` | Determines whether a value implements `SessionControlInterface` — a total structural guard: callable `regenerate` and `destroy`. |
259
+ | `isMultipartFile` | function | `(value: unknown) => value is MultipartFile` | Determines whether a value is one staged `MultipartFile` record — a total structural guard checking every required field's shape. |
260
+ | `isMultipartBody` | function | `(value: unknown) => value is MultipartBody` | Determines whether a value implements `MultipartBody` — a total structural guard: `files` keyed by field name to arrays of `MultipartFile`, and a `fields` string record. |
261
261
 
262
262
  ### Helpers — node
263
263
 
264
- | API | Kind | Summary |
265
- | --------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
266
- | `resolveStaticPath` | function | Resolves a request pathname to an on-disk path under `root`, or `undefined` when it cannot — the traversal guard, whose algorithm and order are exact: strip `prefix` on a segment boundary → `decodeURIComponent` (a malformed escape refuses, never throws) → reject a NUL byte → strip the leading path separator first (so a leading `..` survives `normalize` as a genuine climbing segment) → `normalize` → refuse any Windows reserved-device-name segment (`isReservedDeviceName`) → `resolve` and require the result under `root`. |
267
- | `isUnderPath` | function | Checks whether `pathname` is `prefix` itself or lies under it on a segment boundary — the shared under-path test `resolveStaticPath`'s prefix strip and `createStatic`'s SPA-fallback `exclude` both apply, so `exclude: '/api'` matches `/api` and `/api/x` but never `/apifoo`. |
268
- | `resolveStaticFallbackPath` | function | Resolves the fixed SPA shell path when a static-file miss is eligible for fallback. |
269
- | `isContainedPath` | function | Checks whether `child` is `parent` itself or lies inside it on-disk — the filesystem containment predicate `createStatic` applies to `fs.realpath` output (never to a URL pathname — that is `isUnderPath`'s job). |
270
- | `resolveContainedRealPath` | function | Canonicalizes `candidate` and returns it only when it lies inside `rootReal` — the shared realpath-then-contain step `createStatic` applies to a directory index and to its SPA shell. |
271
- | `isReservedDeviceName` | function | Checks whether a path segment is a Windows reserved device name (CVE-2025-27210). |
272
- | `isDotfilePath` | function | Checks whether a relative path (already resolved under a static root) has any segment starting with `.` — a dotfile or dot-directory. |
273
- | `lookupContentType` | function | Looks up the MIME type for a static file path by its extension. |
274
- | `computeFileETag` | function | Computes a static file's weak ETag from its size and modification time. |
275
- | `detectMIME` | function | Sniffs a MIME type from a file's leading bytes against a small magic-byte table (jpeg, png, gif87a/89a, webp, pdf, zip). |
276
- | `matchesBytes` | function | Checks whether `bytes` contains `signature` at the requested offset. |
277
- | `compressNodeBytes` | function | Compresses response bytes with Node's guaranteed zlib gzip/deflate codecs. |
278
- | `extractMultipartBoundary` | function | Extracts the `boundary` parameter from a `Content-Type` header, or `undefined` when the request is not `multipart/form-data`. |
279
- | `parsePartHeaders` | function | Parses one multipart part's raw header block into its `name` (from `Content-Disposition`), optional `filename`, and optional `Content-Type`. |
280
- | `resolveMultipartLimits` | function | Resolves `createMultipart`'s effective `MultipartLimits`, applying every documented default to an omitted leaf. |
281
- | `createUploadedFile` | function | Builds a frozen `UploadedFile` record. |
282
- | `streamFile` | function | Adapts a `node:fs` read stream over a file path (or an already-open `FileHandle`) into a DOM-compatible `ReadableStream<Uint8Array>` — the single shared node↔web stream bridge every static-file and uploaded-file response body routes through. |
283
- | `streamUploadedFile` | function | Opens a staged/moved uploaded file as a web `ReadableStream`. |
284
- | `readUploadedFile` | function | Reads a staged/moved uploaded file's full contents into memory. |
285
- | `moveUploadedFile` | function | Moves a staged uploaded file to its final `destination`. |
286
- | `unlinkStagedFiles` | function | Attempts to unlink every still-`'staged'` file in a parsed `MultipartBody` — the fail-closed cleanup `createMultipart` runs when its downstream handler throws, mirroring `parseMultipartRequest`'s own cleanup pattern (a missing file is already gone; failures are swallowed). |
264
+ | Name | Kind | Signature | Summary |
265
+ | --------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
266
+ | `resolveStaticPath` | function | `(root: string, prefix: string \| undefined, pathname: string) => string \| undefined` | Resolves a request pathname to an on-disk path under `root`, or `undefined` when it cannot — the traversal guard, whose algorithm and order are exact: strip `prefix` on a segment boundary → `decodeURIComponent` (a malformed escape refuses, never throws) → reject a NUL byte → strip the leading path separator first (so a leading `..` survives `normalize` as a genuine climbing segment) → `normalize` → refuse any Windows reserved-device-name segment (`isReservedDeviceName`) → `resolve` and require the result under `root`. |
267
+ | `isUnderPath` | function | `(pathname: string, prefix: string) => boolean` | Checks whether `pathname` is `prefix` itself or lies under it on a segment boundary — the shared under-path test `resolveStaticPath`'s prefix strip and `createStatic`'s SPA-fallback `exclude` both apply, so `exclude: '/api'` matches `/api` and `/api/x` but never `/apifoo`. |
268
+ | `resolveStaticFallbackPath` | function | `(root: string, index: string, exclude: string, method: string, pathname: string, accept: string) => string \| undefined` | Resolves the fixed SPA shell path when a static-file miss is eligible for fallback. |
269
+ | `isContainedPath` | function | `(child: string, parent: string) => boolean` | Checks whether `child` is `parent` itself or lies inside it on-disk — the filesystem containment predicate `createStatic` applies to `fs.realpath` output (never to a URL pathname — that is `isUnderPath`'s job). |
270
+ | `resolveContainedRealPath` | function | `(candidate: string, rootReal: string) => Promise<string \| undefined>` | Canonicalizes `candidate` and returns it only when it lies inside `rootReal` — the shared realpath-then-contain step `createStatic` applies to a directory index and to its SPA shell. |
271
+ | `isReservedDeviceName` | function | `(segment: string) => boolean` | Checks whether a path segment is a Windows reserved device name (CVE-2025-27210). |
272
+ | `isDotfilePath` | function | `(relativePath: string) => boolean` | Checks whether a relative path (already resolved under a static root) has any segment starting with `.` — a dotfile or dot-directory. |
273
+ | `lookupContentType` | function | `(pathname: string) => string` | Looks up the MIME type for a static file path by its extension. |
274
+ | `computeFileETag` | function | `(size: number, mtimeMs: number) => string` | Computes a static file's weak ETag from its size and modification time. |
275
+ | `detectMIME` | function | `(head: Uint8Array) => string \| undefined` | Sniffs a MIME type from a file's leading bytes against a small magic-byte table (jpeg, png, gif87a/89a, webp, pdf, zip). |
276
+ | `matchesBytes` | function | `(bytes: Uint8Array, signature: readonly number[], offset?: number) => boolean` | Checks whether `bytes` contains `signature` at the requested offset. |
277
+ | `compressNodeBytes` | function | `(bytes: Uint8Array<ArrayBuffer>, encoding: Exclude<Encoding, 'identity'>) => Promise<Uint8Array<ArrayBuffer>>` | Compresses response bytes with Node's guaranteed zlib gzip/deflate codecs. |
278
+ | `extractMultipartBoundary` | function | `(contentType: string \| null) => string \| undefined` | Extracts the `boundary` parameter from a `Content-Type` header, or `undefined` when the request is not `multipart/form-data`. |
279
+ | `parsePartHeaders` | function | `(block: string) => PartHeaders` | Parses one multipart part's raw header block into its `name` (from `Content-Disposition`), optional `filename`, and optional `Content-Type`. |
280
+ | `resolveMultipartLimits` | function | `(limits: MultipartLimitsInput \| undefined) => MultipartLimits` | Resolves `createMultipart`'s effective `MultipartLimits`, applying every documented default to an omitted leaf. |
281
+ | `createUploadedFile` | function | `(input: UploadedFile) => UploadedFile` | Builds a frozen `UploadedFile` record. |
282
+ | `streamFile` | function | `(source: string \| FileHandle, range?: ByteRange) => ReadableStream<Uint8Array>` | Adapts a `node:fs` read stream over a file path (or an already-open `FileHandle`) into a DOM-compatible `ReadableStream<Uint8Array>` — the single shared node↔web stream bridge every static-file and uploaded-file response body routes through. |
283
+ | `streamUploadedFile` | function | `(file: UploadedFile) => ReadableStream<Uint8Array>` | Opens a staged/moved uploaded file as a web `ReadableStream`. |
284
+ | `readUploadedFile` | function | `(file: UploadedFile) => Promise<Uint8Array>` | Reads a staged/moved uploaded file's full contents into memory. |
285
+ | `moveUploadedFile` | function | `(file: UploadedFile, destination: string) => Promise<UploadedFile>` | Moves a staged uploaded file to its final `destination`. |
286
+ | `unlinkStagedFiles` | function | `(body: MultipartBody) => Promise<void>` | Attempts to unlink every still-`'staged'` file in a parsed `MultipartBody` — the fail-closed cleanup `createMultipart` runs when its downstream handler throws, mirroring `parseMultipartRequest`'s own cleanup pattern (a missing file is already gone; failures are swallowed). |
287
287
 
288
288
  ### Parsers — node
289
289
 
290
- | API | Kind | Summary |
291
- | ----------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------- |
292
- | `parseMultipartRequest` | function | Stream-parses a `multipart/form-data` request into its files and fields — the mid-stream state machine `createMultipart` drives. |
290
+ | Name | Kind | Signature | Summary |
291
+ | ----------------------- | -------- | --------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
292
+ | `parseMultipartRequest` | function | `(request: Request, options?: MultipartOptions) => Promise<MultipartBody \| undefined>` | Stream-parses a `multipart/form-data` request into its files and fields — the mid-stream state machine `createMultipart` drives. |
293
293
 
294
294
  ### Classes
295
295
 
296
- | API | Kind | Summary |
297
- | ---------------------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
298
- | `Session` | class | Represents a server-managed session's default entity — the `create` option's default value for `createSession`. It ships without a bare `create*` factory of its own, because the name `createSession` belongs to the battery; `createRestoredSession` rebuilds one from a stored snapshot. |
299
- | `MemorySessionStore` | class | Implements the default in-process `SessionStoreInterface` — a `Map`-backed store enforcing both an idle timeout and an absolute lifetime, with lazy (read-time) eviction, a bounded capacity, and no background timers. |
300
- | `DatabaseSessionStore` | class | Implements a durable `SessionStoreInterface` over an `@orkestrel/database` table — the same idle-timeout + absolute-lifetime contract as `MemorySessionStore`, backed by a caller-supplied `TableInterface` instead of an in-process `Map`. |
296
+ | Name | Kind | Signature | Summary |
297
+ | ---------------------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
298
+ | `Session` | class | `new (id: string) => SessionInterface` | Represents a server-managed session's default entity — the `create` option's default value for `createSession`. It ships without a bare `create*` factory of its own, because the name `createSession` belongs to the battery; `createRestoredSession` rebuilds one from a stored snapshot. |
299
+ | `MemorySessionStore` | class | `new <S extends SessionInterface>(options?: MemorySessionStoreOptions) => SessionStoreInterface<S>` | Implements the default in-process `SessionStoreInterface` — a `Map`-backed store enforcing both an idle timeout and an absolute lifetime, with lazy (read-time) eviction, a bounded capacity, and no background timers. |
300
+ | `DatabaseSessionStore` | class | `new <S extends SessionInterface = Session>(table: TableInterface<SessionRow>, guard: Guard<S>, restore: SessionRestoreFunction, options?: SessionLimits) => SessionStoreInterface<S>` | Implements a durable `SessionStoreInterface` over an `@orkestrel/database` table — the same idle-timeout + absolute-lifetime contract as `MemorySessionStore`, backed by a caller-supplied `TableInterface` instead of an in-process `Map`. |
301
301
 
302
302
  Multipart parsing has no entity row because it exposes no entity. The server source declares a
303
303
  multipart lifecycle engine that `parseMultipartRequest` composes internally, and the barrel does not
@@ -307,20 +307,20 @@ omission is asserted rather than assumed, and adding it to the barrel would turn
307
307
 
308
308
  ### Factories
309
309
 
310
- | API | Kind | Summary |
311
- | ---------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
312
- | `createCookieTransport` | function | Creates a signed-cookie `SessionTransportInterface` — the session id travels as a `signToken`-signed cookie value. |
313
- | `createHeaderTransport` | function | Creates a bare-header `SessionTransportInterface` — the session id travels verbatim in a request/response header. |
314
- | `createMemorySessionStore` | function | Creates the default in-process `SessionStoreInterface` — a `Map`-backed store enforcing an idle timeout and an absolute lifetime. |
315
- | `createDatabaseSessionStore` | function | Creates a `DatabaseSessionStore` as a `SessionStoreInterface` — the durable counterpart to `createMemorySessionStore`, over a caller-opened `@orkestrel/database` table (declare it with `sessionColumns`). |
316
- | `createRestoredSession` | function | Rebuilds a `Session` from an untrusted snapshot value — the inverse of `snapshotSession` and a durable store's `get` deserialization step. |
310
+ | Name | Kind | Signature | Summary |
311
+ | ---------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
312
+ | `createCookieTransport` | function | `(options: CookieTransportOptions) => SessionTransportInterface` | Creates a signed-cookie `SessionTransportInterface` — the session id travels as a `signToken`-signed cookie value. |
313
+ | `createHeaderTransport` | function | `(options?: HeaderTransportOptions) => SessionTransportInterface` | Creates a bare-header `SessionTransportInterface` — the session id travels verbatim in a request/response header. |
314
+ | `createMemorySessionStore` | function | `<S extends SessionInterface>(options?: MemorySessionStoreOptions) => SessionStoreInterface<S>` | Creates the default in-process `SessionStoreInterface` — a `Map`-backed store enforcing an idle timeout and an absolute lifetime. |
315
+ | `createDatabaseSessionStore` | function | `<S extends SessionInterface = Session>(table: TableInterface<SessionRow>, guard: Guard<S>, options?: SessionLimits) => SessionStoreInterface<S>` | Creates a `DatabaseSessionStore` as a `SessionStoreInterface` — the durable counterpart to `createMemorySessionStore`, over a caller-opened `@orkestrel/database` table (declare it with `sessionColumns`). |
316
+ | `createRestoredSession` | function | `(value: unknown) => Session \| undefined` | Rebuilds a `Session` from an untrusted snapshot value — the inverse of `snapshotSession` and a durable store's `get` deserialization step. |
317
317
 
318
318
  ### Errors
319
319
 
320
- | API | Kind | Summary |
321
- | ------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
322
- | `MultipartError` | class | Represents an error `createMultipart` throws when a streamed multipart request fails a mid-stream limit, is structurally malformed, or has a file whose sniffed bytes are rejected by the configured `allowed` MIME list. |
323
- | `isMultipartError` | function | Narrows an unknown caught value to a `MultipartError`. |
320
+ | Name | Kind | Signature | Summary |
321
+ | ------------------ | -------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
322
+ | `MultipartError` | class | `new (code: MultipartErrorCode, message: string, context?: Readonly<Record<string, unknown>>) => MultipartError` | Represents an error `createMultipart` throws when a streamed multipart request fails a mid-stream limit, is structurally malformed, or has a file whose sniffed bytes are rejected by the configured `allowed` MIME list. |
323
+ | `isMultipartError` | function | `(value: unknown) => value is MultipartError` | Narrows an unknown caught value to a `MultipartError`. |
324
324
 
325
325
  ## Methods
326
326