@nifrajs/cli 1.3.1 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +42 -1
- package/dist/cli.js.map +1 -1
- package/dist/diff-tool.d.ts +35 -0
- package/dist/diff-tool.d.ts.map +1 -0
- package/dist/diff-tool.js +107 -0
- package/dist/diff-tool.js.map +1 -0
- package/dist/introspect.d.ts +5 -12
- package/dist/introspect.d.ts.map +1 -1
- package/dist/introspect.js +8 -23
- package/dist/introspect.js.map +1 -1
- package/dist/mcp-http.js +1 -1
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +3 -16
- package/dist/mcp.js.map +1 -1
- package/docs/llms-full.txt +55 -11
- package/docs/types.json +569 -22
- package/package.json +8 -7
- package/src/cli.ts +40 -1
- package/src/diff-tool.ts +130 -0
- package/src/introspect.ts +15 -37
- package/src/mcp-http.ts +1 -1
- package/src/mcp.ts +7 -28
package/docs/types.json
CHANGED
|
@@ -27,6 +27,12 @@
|
|
|
27
27
|
"signature": "export type ActionData<A> = A extends (...args: never[]) => infer R ? Awaited<R> extends {\n readonly __nifraRevalidate: readonly string[];\n readonly data: infer D;\n} ? Exclude<D, Response> : Exclude<Awaited<R>, Response> : never;",
|
|
28
28
|
"doc": "/**\n * The (awaited) data return of an `action`, for typing a page component's `actionData` prop.\n * A `Response` return (redirect/custom) is excluded — it never reaches the component. A\n * `revalidate(paths, data)` wrapper (from `@nifrajs/web`) is transparent: matched structurally (so this\n * stays decoupled from `@nifrajs/web`) and unwrapped to its inner `data` — what the component receives.\n */"
|
|
29
29
|
},
|
|
30
|
+
{
|
|
31
|
+
"name": "ActiveObservation",
|
|
32
|
+
"kind": "interface",
|
|
33
|
+
"package": "@nifrajs/otel",
|
|
34
|
+
"signature": "export interface ActiveObservation {\n readonly span: NifraSpan;\n readonly context: ObservationContext;\n /** Adds a sink to this in-flight span. Re-adding the same adapter is idempotent. */\n addAdapter(adapter: ObservationAdapter): void;\n /** Starts a child that inherits this span's trace identity and sampling decision. */\n startChild(input: Omit<StartObservation, \"parent\" | \"traceparent\">, additionalAdapters?: readonly ObservationAdapter[]): ActiveObservation;\n /** Records failure evidence without deciding the final status until the response is known. */\n recordError(error: unknown): void;\n /** Ends and exports once. Repeated calls return the same completed span without notifying again. */\n end(input?: EndObservation): NifraSpan;\n}"
|
|
35
|
+
},
|
|
30
36
|
{
|
|
31
37
|
"name": "AddRoute",
|
|
32
38
|
"kind": "type",
|
|
@@ -67,6 +73,33 @@
|
|
|
67
73
|
"package": "create-nifra",
|
|
68
74
|
"signature": "export interface AgentsMdOptions {\n readonly template: TemplateName;\n readonly framework: Framework;\n readonly name: string;\n /** Drizzle preset, when scaffolded with `--db` — adds a Database section. */\n readonly db?: DbChoice;\n /** Auth preset, when scaffolded with `--auth` — adds an Authentication section. */\n readonly auth?: AuthChoice;\n}"
|
|
69
75
|
},
|
|
76
|
+
{
|
|
77
|
+
"name": "AgentSpan",
|
|
78
|
+
"kind": "type",
|
|
79
|
+
"package": "@nifrajs/agent-telemetry",
|
|
80
|
+
"signature": "export type AgentSpan = NifraSpan;",
|
|
81
|
+
"doc": "/** A tool-call span. Kept as an alias for package-specific naming without duplicating OTel types. */"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"name": "AgentSpanExporter",
|
|
85
|
+
"kind": "type",
|
|
86
|
+
"package": "@nifrajs/agent-telemetry",
|
|
87
|
+
"signature": "export type AgentSpanExporter = SpanExporter;",
|
|
88
|
+
"doc": "/** Exporter seam shared with `@nifrajs/otel`. */"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"name": "agentTelemetry",
|
|
92
|
+
"kind": "function",
|
|
93
|
+
"package": "@nifrajs/agent-telemetry",
|
|
94
|
+
"signature": "export declare function agentTelemetry(options: AgentTelemetryOptions): {\n name: string;\n beforeHandle(context: HookContext): undefined;\n onError(error: unknown, context: HookContext): undefined;\n onResponse(response: Response, request: Request): Response;\n};",
|
|
95
|
+
"doc": "/**\n * Agent telemetry middleware. Register via `app.use(agentTelemetry({ exporter }))`.\n *\n * Creates child spans for requests targeting tool endpoints (`/_nifra/tool/*`)\n * or the MCP endpoint (`/mcp`). Non-matching requests pass through with zero overhead\n * (a single `startsWith` check — O(1), no regex).\n */"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"name": "AgentTelemetryOptions",
|
|
99
|
+
"kind": "interface",
|
|
100
|
+
"package": "@nifrajs/agent-telemetry",
|
|
101
|
+
"signature": "export interface AgentTelemetryOptions {\n /** Exporter that receives completed tool-call spans. */\n readonly exporter: AgentSpanExporter;\n /** Path prefix for nifra tool routes (default `\"/_nifra/tool/\"`). */\n readonly toolPathPrefix?: string | undefined;\n /** Path for the MCP endpoint (default `\"/mcp\"`). */\n readonly mcpPath?: string | undefined;\n}"
|
|
102
|
+
},
|
|
70
103
|
{
|
|
71
104
|
"name": "aggregateSizeReport",
|
|
72
105
|
"kind": "function",
|
|
@@ -124,14 +157,14 @@
|
|
|
124
157
|
"name": "apiRoutesIndexSection",
|
|
125
158
|
"kind": "function",
|
|
126
159
|
"package": "@nifrajs/cli",
|
|
127
|
-
"signature": "export declare function apiRoutesIndexSection(routes: readonly
|
|
160
|
+
"signature": "export declare function apiRoutesIndexSection(routes: readonly ReflectedRoute[]): string;",
|
|
128
161
|
"doc": "/** Compact API-routes INDEX for the no-arg `nifra_context` call — `METHOD path` per route, WITHOUT the\n * body/query/response shapes or the per-route `call` line. Bounds the first-call payload on a big backend:\n * an agent gets the full route list (so it knows what's mounted) plus a pointer to fetch any route's full\n * contract via the `path`/`kind` slice, instead of every schema up front. */"
|
|
129
162
|
},
|
|
130
163
|
{
|
|
131
164
|
"name": "apiRoutesSection",
|
|
132
165
|
"kind": "function",
|
|
133
166
|
"package": "@nifrajs/cli",
|
|
134
|
-
"signature": "export declare function apiRoutesSection(routes: readonly
|
|
167
|
+
"signature": "export declare function apiRoutesSection(routes: readonly ReflectedRoute[]): string;",
|
|
135
168
|
"doc": "/** Markdown section listing the backend's API routes with their request + response field shapes. */"
|
|
136
169
|
},
|
|
137
170
|
{
|
|
@@ -183,6 +216,13 @@
|
|
|
183
216
|
"signature": "export declare function assertAuthableDb(db: DbChoice): void;",
|
|
184
217
|
"doc": "/**\n * Guard `--auth` against a DB whose ORM has no clean better-auth adapter. Throws an actionable error\n * for Kysely (passing a raw dialect to better-auth is manual wiring we won't fake-scaffold). Called by\n * the CLI before scaffolding so the failure is early and explains the fix.\n */"
|
|
185
218
|
},
|
|
219
|
+
{
|
|
220
|
+
"name": "assertRenderAdapterConformance",
|
|
221
|
+
"kind": "function",
|
|
222
|
+
"package": "@nifrajs/web",
|
|
223
|
+
"signature": "export declare function assertRenderAdapterConformance(adapter: RenderAdapter, fixture: RenderAdapterConformanceFixture): Promise<void>;",
|
|
224
|
+
"doc": "/**\n * Execute the observable {@link RenderAdapter} interface against a framework-specific fixture.\n *\n * The promise resolves only when the adapter proves all shared invariants: page props reach a\n * page-only render, streams contain byte chunks, layout chains nest outermost-first, optional\n * buffered rendering is byte-for-byte hydration-equivalent to streaming for non-deferred content,\n * and hydration-head output is a stable string. It rejects with\n * {@link RenderAdapterConformanceError} naming the first failed check.\n *\n * Framework semantics outside the interface—Suspense scheduling, compiler plugins, DOM hydration,\n * error boundaries, and framework-specific primitives—remain the adapter package's local tests.\n */"
|
|
225
|
+
},
|
|
186
226
|
{
|
|
187
227
|
"name": "assertSafeKey",
|
|
188
228
|
"kind": "function",
|
|
@@ -190,6 +230,13 @@
|
|
|
190
230
|
"signature": "export declare function assertSafeKey(key: string): void;",
|
|
191
231
|
"doc": "/** Throw {@link StorageKeyError} unless `key` is a safe relative storage key. */"
|
|
192
232
|
},
|
|
233
|
+
{
|
|
234
|
+
"name": "assertStorageAdapterConformance",
|
|
235
|
+
"kind": "function",
|
|
236
|
+
"package": "@nifrajs/storage",
|
|
237
|
+
"signature": "export declare function assertStorageAdapterConformance(options: StorageAdapterConformanceOptions): Promise<void>;",
|
|
238
|
+
"doc": "/**\n * Execute the observable {@link StorageAdapter} contract without depending on a test runner.\n *\n * The adapter must be isolated because this writes deterministic conformance keys. The promise resolves\n * only after proving byte + metadata round-trips, overwrite, missing/delete semantics, prefix/limit listing,\n * and uniform unsafe-key rejection across every key-taking method. When the adapter also implements an\n * optional capability ({@link PagedStorageAdapter}, {@link PresignableStorageAdapter},\n * {@link MovableStorageAdapter}), that capability's contract is proven too — implementing a capability\n * partially or unsafely fails conformance rather than silently escaping it.\n */"
|
|
239
|
+
},
|
|
193
240
|
{
|
|
194
241
|
"name": "attachWebSocket",
|
|
195
242
|
"kind": "function",
|
|
@@ -291,7 +338,7 @@
|
|
|
291
338
|
"name": "backendRoutes",
|
|
292
339
|
"kind": "function",
|
|
293
340
|
"package": "@nifrajs/cli",
|
|
294
|
-
"signature": "export declare function backendRoutes(backend: unknown):
|
|
341
|
+
"signature": "export declare function backendRoutes(backend: unknown): ReflectedRoute[];",
|
|
295
342
|
"doc": "/** Read the backend's registered routes, if it's a `server()` with a `.routes()` method. */"
|
|
296
343
|
},
|
|
297
344
|
{
|
|
@@ -766,6 +813,13 @@
|
|
|
766
813
|
"signature": "export declare function combine(...items: readonly Composable[]): NifraPlugin;",
|
|
767
814
|
"doc": "/** Compose middleware/plugins into one reusable bundle. Individual named plugins still dedupe. */"
|
|
768
815
|
},
|
|
816
|
+
{
|
|
817
|
+
"name": "combineObservationAdapters",
|
|
818
|
+
"kind": "function",
|
|
819
|
+
"package": "@nifrajs/otel",
|
|
820
|
+
"signature": "export declare function combineObservationAdapters(adapters: readonly ObservationAdapter[]): ObservationAdapter;",
|
|
821
|
+
"doc": "/**\n * Fan out lifecycle notifications to several adapters. Each adapter is isolated: an exception in\n * one sink cannot prevent the remaining sinks from observing the span.\n */"
|
|
822
|
+
},
|
|
769
823
|
{
|
|
770
824
|
"name": "commonSecretPatterns",
|
|
771
825
|
"kind": "const",
|
|
@@ -848,6 +902,13 @@
|
|
|
848
902
|
"signature": "export declare function computed<T>(fn: () => T): () => T;",
|
|
849
903
|
"doc": "/** Derived value, cached into a signal — recomputes when its tracked inputs change. */"
|
|
850
904
|
},
|
|
905
|
+
{
|
|
906
|
+
"name": "consoleAgentExporter",
|
|
907
|
+
"kind": "function",
|
|
908
|
+
"package": "@nifrajs/agent-telemetry",
|
|
909
|
+
"signature": "export declare function consoleAgentExporter(log?: (line: string) => void): AgentSpanExporter;",
|
|
910
|
+
"doc": "/**\n * Pretty-prints agent tool call traces to the terminal.\n *\n * Output format:\n * ```\n * [agent] tool:get_weather 12ms ok (input: 45B, output: 128B)\n * ```\n */"
|
|
911
|
+
},
|
|
851
912
|
{
|
|
852
913
|
"name": "consoleSpanExporter",
|
|
853
914
|
"kind": "function",
|
|
@@ -1076,6 +1137,20 @@
|
|
|
1076
1137
|
"package": "@nifrajs/mcp",
|
|
1077
1138
|
"signature": "export interface CreateMcpServerOptions {\n readonly name: string;\n readonly version: string;\n readonly tools?: readonly McpTool[];\n /** MCP Apps widgets — their resources are registered and the UI capability is advertised. */\n readonly widgets?: readonly McpWidget[];\n /** Extra (non-widget) resources to expose. */\n readonly resources?: readonly McpResource[];\n readonly prompts?: readonly McpPrompt[];\n /** GET health-page text. */\n readonly health?: string;\n /** Max JSON-RPC body size in bytes (default 1 MB). */\n readonly maxBodyBytes?: number;\n}"
|
|
1078
1139
|
},
|
|
1140
|
+
{
|
|
1141
|
+
"name": "createMockServer",
|
|
1142
|
+
"kind": "function",
|
|
1143
|
+
"package": "@nifrajs/mock",
|
|
1144
|
+
"signature": "export declare function createMockServer(app: MockableApp, options?: MockServerOptions | undefined): MockServer;",
|
|
1145
|
+
"doc": "/**\n * Create a mock server from a Nifra app's route definitions. For each route\n * with a `schema.response`, generates a handler returning fake data that\n * matches the response schema structure. Routes without response schemas\n * return `{}`.\n */"
|
|
1146
|
+
},
|
|
1147
|
+
{
|
|
1148
|
+
"name": "createObservationLifecycle",
|
|
1149
|
+
"kind": "function",
|
|
1150
|
+
"package": "@nifrajs/otel",
|
|
1151
|
+
"signature": "export declare function createObservationLifecycle(options?: ObservationLifecycleOptions): ObservationLifecycle;",
|
|
1152
|
+
"doc": "/** Creates an independent lifecycle factory. Adapters are always called fail-open. */"
|
|
1153
|
+
},
|
|
1079
1154
|
{
|
|
1080
1155
|
"name": "createQuery",
|
|
1081
1156
|
"kind": "function",
|
|
@@ -1282,6 +1357,12 @@
|
|
|
1282
1357
|
"signature": "export declare const DEFAULT_DEV_PORT = 4321;",
|
|
1283
1358
|
"doc": "/**\n * The single default port for the dev server (`@nifrajs/web/dev`, `@nifrajs/web/vite`) **and**\n * `nifra start`. Deliberately uncommon: `3000`/`5173`/`8080` collide with whatever else is running\n * (Next, Vite, a stray Node API). `4321` rarely is — and being the *same* constant across `nifra dev`\n * and `nifra start` means a project's URL doesn't change between commands. Override per-run with\n * `--port <n>` or the `PORT` env var. */"
|
|
1284
1359
|
},
|
|
1360
|
+
{
|
|
1361
|
+
"name": "DEFAULT_SNAPSHOT_FILE",
|
|
1362
|
+
"kind": "const",
|
|
1363
|
+
"package": "@nifrajs/cli",
|
|
1364
|
+
"signature": "export declare const DEFAULT_SNAPSHOT_FILE = \"api-snapshot.json\";"
|
|
1365
|
+
},
|
|
1285
1366
|
{
|
|
1286
1367
|
"name": "defer",
|
|
1287
1368
|
"kind": "function",
|
|
@@ -1443,6 +1524,39 @@
|
|
|
1443
1524
|
"package": "@nifrajs/web",
|
|
1444
1525
|
"signature": "export interface DevServerOptions extends Omit<BuildClientOptions, \"minify\"> {\n /**\n * Build the nifra app for the freshly-built client entry. `importQuery` changes on every\n * rebuild — pass it to `discoverRoutes(routesDir, { importQuery })` so SSR re-imports edited\n * route modules instead of Bun's cached copies.\n */\n readonly createApp: (clientEntry: string, importQuery: string) => FetchApp | Promise<FetchApp>;\n /** Directories to watch (default: `[routesDir]`). */\n readonly watch?: readonly string[];\n /** Port to listen on (default {@link DEFAULT_DEV_PORT}). */\n readonly port?: number;\n}"
|
|
1445
1526
|
},
|
|
1527
|
+
{
|
|
1528
|
+
"name": "devtools",
|
|
1529
|
+
"kind": "function",
|
|
1530
|
+
"package": "@nifrajs/devtools",
|
|
1531
|
+
"signature": "export declare function devtools(options?: DevToolsOptions | undefined): import(\"@nifrajs/core\").NifraPlugin<import(\"@nifrajs/core\").AnyServer, import(\"@nifrajs/core\").AnyServer>;",
|
|
1532
|
+
"doc": "/**\n * DevTools plugin. Its observation adapter projects the single request span into a\n * `DevToolsEvent`; its middleware only owns the secured SSE transport.\n * When configuring `tracing()` yourself, register it before this plugin so DevTools attaches to\n * that request owner.\n */"
|
|
1533
|
+
},
|
|
1534
|
+
{
|
|
1535
|
+
"name": "DevToolsClientOptions",
|
|
1536
|
+
"kind": "interface",
|
|
1537
|
+
"package": "@nifrajs/devtools",
|
|
1538
|
+
"signature": "export interface DevToolsClientOptions {\n /** SSE path configured on the server plugin. */\n readonly path?: string | undefined;\n}"
|
|
1539
|
+
},
|
|
1540
|
+
{
|
|
1541
|
+
"name": "devtoolsClientScript",
|
|
1542
|
+
"kind": "function",
|
|
1543
|
+
"package": "@nifrajs/devtools",
|
|
1544
|
+
"signature": "export declare function devtoolsClientScript(options?: DevToolsClientOptions): string;",
|
|
1545
|
+
"doc": "/**\n * Returns a self-contained JavaScript string that creates a floating DevTools\n * overlay in the browser. Inject via `<script>` tag in dev mode.\n *\n * The overlay:\n * - Connects to `/_nifra/devtools` via EventSource\n * - Shows a scrolling log of request traces\n * - Color-coded method badges and status codes\n * - ISR hit/miss/stale indicators\n * - Collapsible with a ⚡ toggle button\n */"
|
|
1546
|
+
},
|
|
1547
|
+
{
|
|
1548
|
+
"name": "DevToolsEvent",
|
|
1549
|
+
"kind": "interface",
|
|
1550
|
+
"package": "@nifrajs/devtools",
|
|
1551
|
+
"signature": "export interface DevToolsEvent {\n readonly id: string;\n readonly traceId: string;\n readonly spanId: string;\n readonly parentSpanId?: string | undefined;\n readonly timestamp: number;\n readonly method: string;\n readonly path: string;\n readonly status: number;\n readonly durationMs: number;\n readonly isrStatus?: string | undefined;\n readonly bodyBytes: number;\n}",
|
|
1552
|
+
"doc": "/**\n * `@nifrajs/devtools` — interactive DevTools overlay for `nifra dev`.\n *\n * Server-side: a middleware plugin that captures request traces into a ring buffer\n * and streams them via SSE at `/_nifra/devtools`.\n *\n * Client-side: a floating browser overlay that connects to the SSE stream and\n * renders a scrolling log of request traces with ISR status badges.\n *\n * **Zero production overhead** — register conditionally:\n * ```ts\n * if (process.env.NODE_ENV !== \"production\") app.use(devtools())\n * ```\n * When not registered, routes stay `bare` and the SSE endpoint doesn't exist.\n */"
|
|
1553
|
+
},
|
|
1554
|
+
{
|
|
1555
|
+
"name": "DevToolsOptions",
|
|
1556
|
+
"kind": "interface",
|
|
1557
|
+
"package": "@nifrajs/devtools",
|
|
1558
|
+
"signature": "export interface DevToolsOptions {\n /** Maximum events to retain in the ring buffer (default 200). */\n readonly maxEvents?: number | undefined;\n /** Maximum simultaneous SSE connections (default 5). */\n readonly maxConnections?: number | undefined;\n /** SSE path (default `/_nifra/devtools`). */\n readonly path?: string | undefined;\n /** Explicit enable switch. Defaults to true only when `NODE_ENV === \"development\"`. */\n readonly enabled?: boolean | undefined;\n /** Permit non-loopback URL hosts. Default false. */\n readonly allowRemote?: boolean | undefined;\n /** Additional origins permitted to open the stream. Same-origin requests are always allowed. */\n readonly allowedOrigins?: readonly string[] | undefined;\n /** Optional request authorization for the stream. */\n readonly authorize?: ((request: Request) => boolean | Promise<boolean>) | undefined;\n /**\n * Interval for SSE keep-alive comment frames, in milliseconds (default 15000). Pings stop\n * idle proxies/dev tunnels from dropping the stream and evict dead connections so they no\n * longer count against `maxConnections`.\n */\n readonly pingIntervalMs?: number | undefined;\n}"
|
|
1559
|
+
},
|
|
1446
1560
|
{
|
|
1447
1561
|
"name": "diffManifestRoutes",
|
|
1448
1562
|
"kind": "function",
|
|
@@ -1450,6 +1564,19 @@
|
|
|
1450
1564
|
"signature": "export declare function diffManifestRoutes(manifestFiles: readonly string[], discoveredFiles: readonly string[]): ManifestDrift;",
|
|
1451
1565
|
"doc": "/**\n * Diff the route files a committed server-manifest imports against the files freshly discovered in\n * `routes/`. Returns the `missing` (in routes/, not in manifest — stale manifest) and `extra` (in\n * manifest, gone from routes/ — dangling import) sets. Empty arrays ⇒ in sync. Pure — the caller\n * supplies both file lists (the committed source is parsed via {@link parseManifestRouteFiles}; the\n * fresh list comes from `discoverRoutes`). Lists need not be pre-sorted; the result is sorted.\n */"
|
|
1452
1566
|
},
|
|
1567
|
+
{
|
|
1568
|
+
"name": "diffRouteSnapshots",
|
|
1569
|
+
"kind": "function",
|
|
1570
|
+
"package": "@nifrajs/core",
|
|
1571
|
+
"signature": "export declare function diffRouteSnapshots(before: readonly RouteSnapshot[], after: readonly RouteSnapshot[]): RoutesDiff;",
|
|
1572
|
+
"doc": "/**\n * Diff two route snapshots (`snapshotRoutes` output, possibly restored from JSON). Every change is\n * classified breaking/compatible/info; `hasBreaking` is the CI-gate bit.\n */"
|
|
1573
|
+
},
|
|
1574
|
+
{
|
|
1575
|
+
"name": "DiffSeverity",
|
|
1576
|
+
"kind": "type",
|
|
1577
|
+
"package": "@nifrajs/core",
|
|
1578
|
+
"signature": "export type DiffSeverity = \"breaking\" | \"compatible\" | \"info\";"
|
|
1579
|
+
},
|
|
1453
1580
|
{
|
|
1454
1581
|
"name": "directSinkSpecifier",
|
|
1455
1582
|
"kind": "function",
|
|
@@ -1584,6 +1711,12 @@
|
|
|
1584
1711
|
"signature": "export declare function encodeCursor(value: unknown): string;",
|
|
1585
1712
|
"doc": "/** Encode any JSON-serializable value (e.g. the last row's sort key) into an opaque cursor string. */"
|
|
1586
1713
|
},
|
|
1714
|
+
{
|
|
1715
|
+
"name": "EndObservation",
|
|
1716
|
+
"kind": "interface",
|
|
1717
|
+
"package": "@nifrajs/otel",
|
|
1718
|
+
"signature": "export interface EndObservation {\n readonly statusCode?: number;\n /** Explicit status wins over status-code and recorded-error classification. */\n readonly status?: Exclude<SpanStatus, \"unset\">;\n readonly attributes?: Readonly<Record<string, AttributeValue>>;\n}"
|
|
1719
|
+
},
|
|
1587
1720
|
{
|
|
1588
1721
|
"name": "EnqueueOptions",
|
|
1589
1722
|
"kind": "interface",
|
|
@@ -1878,7 +2011,7 @@
|
|
|
1878
2011
|
"name": "FileStorage",
|
|
1879
2012
|
"kind": "class",
|
|
1880
2013
|
"package": "@nifrajs/storage",
|
|
1881
|
-
"signature": "export declare class FileStorage implements StorageAdapter {\n private readonly root;\n constructor(root: string);\n /** Resolve `key` to an absolute path, asserting it stays inside `root` (defense-in-depth on top of `assertSafeKey`). */\n private pathFor;\n put(key: string, data: StorageData,
|
|
2014
|
+
"signature": "export declare class FileStorage implements StorageAdapter {\n private readonly root;\n private readonly metadataRoot;\n constructor(root: string);\n private metadataPathFor;\n /** Resolve `key` to an absolute path, asserting it stays inside `root` (defense-in-depth on top of `assertSafeKey`). */\n private pathFor;\n private symlinkError;\n /** Reject existing symbolic links below `base`; missing suffixes are safe for later creation. */\n private assertNoSymlinkPath;\n /** Create parents, re-check them, and refuse a final-component symlink at open time. */\n private writeContained;\n put(key: string, data: StorageData, options?: PutOptions): Promise<void>;\n get(key: string): Promise<StorageObject | null>;\n delete(key: string): Promise<void>;\n exists(key: string): Promise<boolean>;\n list(options?: ListOptions): Promise<string[]>;\n private walk;\n}"
|
|
1882
2015
|
},
|
|
1883
2016
|
{
|
|
1884
2017
|
"name": "FileType",
|
|
@@ -1960,6 +2093,13 @@
|
|
|
1960
2093
|
"signature": "export declare function formatBytes(bytes: number): string;",
|
|
1961
2094
|
"doc": "/** Human-readable byte count: `B`/`KB`/`MB` with one decimal above 1 KB (e.g. `12.3 KB`). Pure. */"
|
|
1962
2095
|
},
|
|
2096
|
+
{
|
|
2097
|
+
"name": "formatDiff",
|
|
2098
|
+
"kind": "function",
|
|
2099
|
+
"package": "@nifrajs/cli",
|
|
2100
|
+
"signature": "export declare function formatDiff(diff: RoutesDiff): string;",
|
|
2101
|
+
"doc": "/** Render a diff for terminals: breaking first, then info, then compatible. */"
|
|
2102
|
+
},
|
|
1963
2103
|
{
|
|
1964
2104
|
"name": "formatManifestDrift",
|
|
1965
2105
|
"kind": "function",
|
|
@@ -2059,6 +2199,13 @@
|
|
|
2059
2199
|
"package": "@nifrajs/web",
|
|
2060
2200
|
"signature": "export declare function generateLlmsTxt(full: boolean, pageRoutes: ReadonlyArray<{\n readonly pattern: string;\n readonly id: string;\n}>, backend: unknown): Promise<string>;"
|
|
2061
2201
|
},
|
|
2202
|
+
{
|
|
2203
|
+
"name": "generateMockValue",
|
|
2204
|
+
"kind": "function",
|
|
2205
|
+
"package": "@nifrajs/mock",
|
|
2206
|
+
"signature": "export declare function generateMockValue(schema: unknown, fieldName?: string | undefined, rng?: (() => number) | undefined): unknown;",
|
|
2207
|
+
"doc": "/**\n * Generate a mock value from a schema object. Inspects JSON Schema properties\n * (`type`, `properties`, `items`, `enum`, `format`) that TypeBox / NifraSchema\n * objects carry directly. Unsupported constraints fail closed with\n * {@link UnsupportedMockSchemaError} rather than returning a known-invalid response.\n *\n * @param schema A JSON-Schema-shaped object (TypeBox, NifraSchema, or raw JSON Schema)\n * @param fieldName Optional field name hint for generating contextual string values\n * @param rng Optional seeded random function for deterministic output\n */"
|
|
2208
|
+
},
|
|
2062
2209
|
{
|
|
2063
2210
|
"name": "generateServerEntry",
|
|
2064
2211
|
"kind": "function",
|
|
@@ -2849,6 +2996,13 @@
|
|
|
2849
2996
|
"package": "@nifrajs/mcp",
|
|
2850
2997
|
"signature": "export type JsonRpcResponse = {\n jsonrpc: \"2.0\";\n id: JsonRpcId;\n result: unknown;\n} | {\n jsonrpc: \"2.0\";\n id: JsonRpcId;\n error: {\n code: number;\n message: string;\n };\n};"
|
|
2851
2998
|
},
|
|
2999
|
+
{
|
|
3000
|
+
"name": "JsonSchema",
|
|
3001
|
+
"kind": "type",
|
|
3002
|
+
"package": "@nifrajs/core",
|
|
3003
|
+
"signature": "export type JsonSchema = boolean | Readonly<Record<string, unknown>>;",
|
|
3004
|
+
"doc": "/** JSON Schema permits either a schema object or the boolean schemas `true` and `false`. */"
|
|
3005
|
+
},
|
|
2852
3006
|
{
|
|
2853
3007
|
"name": "jwk",
|
|
2854
3008
|
"kind": "function",
|
|
@@ -3243,6 +3397,19 @@
|
|
|
3243
3397
|
"signature": "export interface McpContentBlock {\n readonly type: \"text\";\n readonly text: string;\n}",
|
|
3244
3398
|
"doc": "/** A single content block in a tool result. Today only text — the model-facing representation. */"
|
|
3245
3399
|
},
|
|
3400
|
+
{
|
|
3401
|
+
"name": "McpDbAuthorizeContext",
|
|
3402
|
+
"kind": "interface",
|
|
3403
|
+
"package": "@nifrajs/mcp-db",
|
|
3404
|
+
"signature": "export interface McpDbAuthorizeContext {\n readonly toolName: \"run_query\";\n readonly request: Request;\n}",
|
|
3405
|
+
"doc": "/** Context forwarded to `authorize` — the inbound HTTP Request carrying the `run_query` call. */"
|
|
3406
|
+
},
|
|
3407
|
+
{
|
|
3408
|
+
"name": "McpDbConfigError",
|
|
3409
|
+
"kind": "class",
|
|
3410
|
+
"package": "@nifrajs/mcp-db",
|
|
3411
|
+
"signature": "export declare class McpDbConfigError extends Error {\n constructor(message: string);\n}"
|
|
3412
|
+
},
|
|
3246
3413
|
{
|
|
3247
3414
|
"name": "McpHttpOptions",
|
|
3248
3415
|
"kind": "interface",
|
|
@@ -3440,7 +3607,7 @@
|
|
|
3440
3607
|
"name": "MemoryStorage",
|
|
3441
3608
|
"kind": "class",
|
|
3442
3609
|
"package": "@nifrajs/storage",
|
|
3443
|
-
"signature": "export declare class MemoryStorage implements StorageAdapter {\n private readonly objects;\n put(key: string, data: StorageData, options?: PutOptions): Promise<void>;\n get(key: string): Promise<StorageObject | null>;\n delete(key: string): Promise<void>;\n exists(key: string): Promise<boolean>;\n list(options?: ListOptions): Promise<string[]>;\n}"
|
|
3610
|
+
"signature": "export declare class MemoryStorage implements StorageAdapter {\n private readonly objects;\n constructor();\n put(key: string, data: StorageData, options?: PutOptions): Promise<void>;\n get(key: string): Promise<StorageObject | null>;\n delete(key: string): Promise<void>;\n exists(key: string): Promise<boolean>;\n list(options?: ListOptions): Promise<string[]>;\n}"
|
|
3444
3611
|
},
|
|
3445
3612
|
{
|
|
3446
3613
|
"name": "MemoryStore",
|
|
@@ -3520,9 +3687,35 @@
|
|
|
3520
3687
|
"name": "Middleware",
|
|
3521
3688
|
"kind": "interface",
|
|
3522
3689
|
"package": "@nifrajs/core",
|
|
3523
|
-
"signature": "export interface Middleware {\n readonly name?: string;\n readonly onRequest?: (req: Request) => MaybePromise<OnRequestResult>;\n readonly around?: <T>(context: Context, next: () => MaybePromise<T>) => MaybePromise<T>;\n readonly beforeHandle?: (context: Context) => MaybePromise<unknown>;\n readonly afterHandle?: (result: unknown, context: Context) => MaybePromise<unknown>;\n readonly onResponse?: (response: Response, req: Request) => MaybePromise<Response>;\n readonly onError?: (error: unknown, context: Context) => MaybePromise<unknown>;\n}",
|
|
3690
|
+
"signature": "export interface Middleware {\n readonly name?: string;\n readonly onRequest?: (req: Request) => MaybePromise<OnRequestResult>;\n readonly around?: <T>(context: Context, next: () => MaybePromise<T>) => MaybePromise<T>;\n readonly beforeHandle?: (context: Context) => MaybePromise<unknown>;\n readonly afterHandle?: (result: unknown, context: Context) => MaybePromise<unknown>;\n readonly onResponse?: (response: Response, req: Request) => MaybePromise<Response>;\n readonly onResponseFinalized?: (outcome: ResponseFinalization, req: Request) => MaybePromise<void>;\n readonly onError?: (error: unknown, context: Context) => MaybePromise<unknown>;\n}",
|
|
3524
3691
|
"doc": "/**\n * A bundle of lifecycle hooks applied together via {@link Server.use} — the unit\n * `@nifrajs/middleware` ships (cors, security headers, rate-limit). Every hook is\n * optional and wired to its lifecycle point. Middleware is context-agnostic (sees\n * the base `Context`); `use` does no context-type merging — the full type-merging\n * plugin system is deferred, and `.use` is reserved as its future entry point.\n */"
|
|
3525
3692
|
},
|
|
3693
|
+
{
|
|
3694
|
+
"name": "MockableApp",
|
|
3695
|
+
"kind": "interface",
|
|
3696
|
+
"package": "@nifrajs/mock",
|
|
3697
|
+
"signature": "export interface MockableApp {\n routes(): readonly MockableRoute[];\n}",
|
|
3698
|
+
"doc": "/** App shape — anything with a `routes()` method. */"
|
|
3699
|
+
},
|
|
3700
|
+
{
|
|
3701
|
+
"name": "MockableRoute",
|
|
3702
|
+
"kind": "interface",
|
|
3703
|
+
"package": "@nifrajs/mock",
|
|
3704
|
+
"signature": "export interface MockableRoute {\n readonly method: string;\n readonly path: string;\n readonly schema?: {\n readonly response?: unknown;\n } | undefined;\n}",
|
|
3705
|
+
"doc": "/** Minimal route shape returned by `app.routes()`. */"
|
|
3706
|
+
},
|
|
3707
|
+
{
|
|
3708
|
+
"name": "MockServer",
|
|
3709
|
+
"kind": "interface",
|
|
3710
|
+
"package": "@nifrajs/mock",
|
|
3711
|
+
"signature": "export interface MockServer {\n /** Handle a request against the mock routes. */\n fetch(request: Request): Promise<Response>;\n /** The generated mock routes for inspection. */\n readonly mockRoutes: ReadonlyArray<{\n method: string;\n path: string;\n }>;\n}"
|
|
3712
|
+
},
|
|
3713
|
+
{
|
|
3714
|
+
"name": "MockServerOptions",
|
|
3715
|
+
"kind": "interface",
|
|
3716
|
+
"package": "@nifrajs/mock",
|
|
3717
|
+
"signature": "export interface MockServerOptions {\n /** Seed for deterministic mock generation. */\n readonly seed?: number | undefined;\n /** Log mock requests to console. */\n readonly verbose?: boolean | undefined;\n}"
|
|
3718
|
+
},
|
|
3526
3719
|
{
|
|
3527
3720
|
"name": "ModuleReader",
|
|
3528
3721
|
"kind": "type",
|
|
@@ -3593,6 +3786,13 @@
|
|
|
3593
3786
|
"signature": "export interface MountRouterOptions {\n readonly router: ClientRouter;\n /** routeId → layout chain (outermost layout → page); built by `generateClientEntry`. */\n readonly routes: Record<string, readonly unknown[]>;\n /** Hydration container (opaque — the adapter casts it to its DOM element type). */\n readonly container: unknown;\n}",
|
|
3594
3787
|
"doc": "/** Options for a per-adapter `mountRouter` (the Router binding that hydrates + re-renders). */"
|
|
3595
3788
|
},
|
|
3789
|
+
{
|
|
3790
|
+
"name": "MovableStorageAdapter",
|
|
3791
|
+
"kind": "interface",
|
|
3792
|
+
"package": "@nifrajs/storage",
|
|
3793
|
+
"signature": "export interface MovableStorageAdapter extends StorageAdapter {\n copy(sourceKey: string, destinationKey: string): Promise<void>;\n move(sourceKey: string, destinationKey: string): Promise<void>;\n}",
|
|
3794
|
+
"doc": "/** Optional server-side copy/move capability. */"
|
|
3795
|
+
},
|
|
3596
3796
|
{
|
|
3597
3797
|
"name": "namedCombine",
|
|
3598
3798
|
"kind": "function",
|
|
@@ -3717,6 +3917,43 @@
|
|
|
3717
3917
|
"signature": "export declare function number(opts?: Base<number> & Optional): StandardSchemaV1<number | undefined>;",
|
|
3718
3918
|
"doc": "/** A finite number, coerced from its decimal string. */"
|
|
3719
3919
|
},
|
|
3920
|
+
{
|
|
3921
|
+
"name": "ObservationAdapter",
|
|
3922
|
+
"kind": "interface",
|
|
3923
|
+
"package": "@nifrajs/otel",
|
|
3924
|
+
"signature": "export interface ObservationAdapter {\n onStart?(span: NifraSpan): void;\n onEnd(span: NifraSpan): void;\n}",
|
|
3925
|
+
"doc": "/**\n * Where ended spans go. Implement this to bridge to the OpenTelemetry SDK (map each field onto a\n * real `Span` from a `Tracer`), ship to a collector, or just log. `onStart` is optional (most\n * backends only need the completed span).\n */"
|
|
3926
|
+
},
|
|
3927
|
+
{
|
|
3928
|
+
"name": "ObservationClock",
|
|
3929
|
+
"kind": "interface",
|
|
3930
|
+
"package": "@nifrajs/otel",
|
|
3931
|
+
"signature": "export interface ObservationClock {\n /** Epoch milliseconds for interoperable start/end timestamps. */\n wallTime(): number;\n /** Monotonic milliseconds for durations. */\n monotonicTime(): number;\n}"
|
|
3932
|
+
},
|
|
3933
|
+
{
|
|
3934
|
+
"name": "ObservationContext",
|
|
3935
|
+
"kind": "interface",
|
|
3936
|
+
"package": "@nifrajs/otel",
|
|
3937
|
+
"signature": "export interface ObservationContext {\n readonly traceId: string;\n readonly spanId: string;\n readonly parentSpanId?: string;\n readonly sampled: boolean;\n /** This span's outbound W3C trace context. */\n readonly traceparent: string;\n}"
|
|
3938
|
+
},
|
|
3939
|
+
{
|
|
3940
|
+
"name": "ObservationLifecycle",
|
|
3941
|
+
"kind": "interface",
|
|
3942
|
+
"package": "@nifrajs/otel",
|
|
3943
|
+
"signature": "export interface ObservationLifecycle {\n start(input: StartObservation, additionalAdapters?: readonly ObservationAdapter[]): ActiveObservation;\n}"
|
|
3944
|
+
},
|
|
3945
|
+
{
|
|
3946
|
+
"name": "ObservationLifecycleOptions",
|
|
3947
|
+
"kind": "interface",
|
|
3948
|
+
"package": "@nifrajs/otel",
|
|
3949
|
+
"signature": "export interface ObservationLifecycleOptions {\n readonly adapters?: readonly ObservationAdapter[];\n /** Injectable seams are primarily useful for deterministic tests and constrained runtimes. */\n readonly clock?: ObservationClock;\n readonly generateTraceId?: () => string;\n readonly generateSpanId?: () => string;\n}"
|
|
3950
|
+
},
|
|
3951
|
+
{
|
|
3952
|
+
"name": "ObservationParent",
|
|
3953
|
+
"kind": "interface",
|
|
3954
|
+
"package": "@nifrajs/otel",
|
|
3955
|
+
"signature": "export interface ObservationParent {\n readonly traceId: string;\n readonly spanId: string;\n readonly sampled: boolean;\n}"
|
|
3956
|
+
},
|
|
3720
3957
|
{
|
|
3721
3958
|
"name": "OnRequestResult",
|
|
3722
3959
|
"kind": "type",
|
|
@@ -3848,6 +4085,13 @@
|
|
|
3848
4085
|
"signature": "export interface Page<Item> {\n readonly items: Item[];\n readonly nextCursor: string | null;\n}",
|
|
3849
4086
|
"doc": "/** A cursor-pagination page — matches the shape of `t.paginated(item)`. */"
|
|
3850
4087
|
},
|
|
4088
|
+
{
|
|
4089
|
+
"name": "PagedStorageAdapter",
|
|
4090
|
+
"kind": "interface",
|
|
4091
|
+
"package": "@nifrajs/storage",
|
|
4092
|
+
"signature": "export interface PagedStorageAdapter extends StorageAdapter {\n listPage(options?: StorageListPageOptions): Promise<StorageListPage>;\n}",
|
|
4093
|
+
"doc": "/** Optional cursor-listing capability. Kept out of {@link StorageAdapter} for simple stores. */"
|
|
4094
|
+
},
|
|
3851
4095
|
{
|
|
3852
4096
|
"name": "PageRouteInput",
|
|
3853
4097
|
"kind": "interface",
|
|
@@ -3956,6 +4200,13 @@
|
|
|
3956
4200
|
"signature": "export declare function parseNdjsonData(stream: ReadableStream<Uint8Array>, signal?: AbortSignal): Promise<unknown>;",
|
|
3957
4201
|
"doc": "/**\n * Client side of {@link ndjsonStream} (used by the router's `defaultFetchData` on a soft nav): read\n * the NDJSON body into a data object whose deferred markers settle as resolution lines arrive.\n * Returns after **line 1** so the router can apply the critical data + render immediately; the\n * markers' promises settle/reject in the background. If the stream ends (or `signal` aborts) with\n * markers unsettled, they reject — so `<Await>` never hangs.\n */"
|
|
3958
4202
|
},
|
|
4203
|
+
{
|
|
4204
|
+
"name": "parseSnapshotFile",
|
|
4205
|
+
"kind": "function",
|
|
4206
|
+
"package": "@nifrajs/cli",
|
|
4207
|
+
"signature": "export declare function parseSnapshotFile(content: string, sourcePath: string): SnapshotFile;",
|
|
4208
|
+
"doc": "/** Parse + validate a snapshot file's content. Throws with an actionable message on any mismatch. */"
|
|
4209
|
+
},
|
|
3959
4210
|
{
|
|
3960
4211
|
"name": "parseStaticImports",
|
|
3961
4212
|
"kind": "function",
|
|
@@ -4159,6 +4410,13 @@
|
|
|
4159
4410
|
"signature": "export declare function prerenderRoutes(options: PrerenderOptions): Promise<PrerenderResult>;",
|
|
4160
4411
|
"doc": "/**\n * Render every opted-in static route to a static `index.html` under `outDir`. Run AFTER `buildClient`\n * (so the app references the hashed client entry). Returns a report of what was emitted vs skipped —\n * the caller can use `prerendered` to wire a hybrid deploy (e.g. exclude those paths from the SSR\n * worker so the CDN serves the static file). Never throws on a per-route miss: a non-OK response or a\n * non-opted/dynamic route is recorded in `skipped` and the build continues.\n */"
|
|
4161
4412
|
},
|
|
4413
|
+
{
|
|
4414
|
+
"name": "PresignableStorageAdapter",
|
|
4415
|
+
"kind": "interface",
|
|
4416
|
+
"package": "@nifrajs/storage",
|
|
4417
|
+
"signature": "export interface PresignableStorageAdapter extends StorageAdapter {\n presign(key: string, operation: StoragePresignOperation, options?: StoragePresignOptions): Promise<StoragePresignedUrl>;\n}",
|
|
4418
|
+
"doc": "/** Optional provider-side URL-signing capability. Asset sensitivity and TTL policy stay with callers. */"
|
|
4419
|
+
},
|
|
4162
4420
|
{
|
|
4163
4421
|
"name": "Prettify",
|
|
4164
4422
|
"kind": "type",
|
|
@@ -4204,6 +4462,19 @@
|
|
|
4204
4462
|
"signature": "export declare function projectTools(cwd: string, loadAppCached?: (outDirName?: string) => Promise<LoadedApp>): McpTool[];",
|
|
4205
4463
|
"doc": "/** Build the project-scoped tools for `cwd`. */"
|
|
4206
4464
|
},
|
|
4465
|
+
{
|
|
4466
|
+
"name": "prompt",
|
|
4467
|
+
"kind": "function",
|
|
4468
|
+
"package": "@nifrajs/prompt",
|
|
4469
|
+
"signature": "export declare function prompt(instruction: string): Prompt<undefined, string>;",
|
|
4470
|
+
"doc": "/**\n * Define a type-safe prompt. Chain `.input()` / `.output()` with Standard Schemas, then `.run()`\n * with a provider `complete` fn. Immutable — each chain step returns a new prompt.\n */"
|
|
4471
|
+
},
|
|
4472
|
+
{
|
|
4473
|
+
"name": "Prompt",
|
|
4474
|
+
"kind": "interface",
|
|
4475
|
+
"package": "@nifrajs/prompt",
|
|
4476
|
+
"signature": "export interface Prompt<Input, Output> {\n readonly instruction: string;\n /** Declare the variables the prompt needs. Validated on every run. */\n input<Schema extends StandardSchemaV1>(schema: Schema): Prompt<InferOutput<Schema>, Output>;\n /** Declare the shape the model must return. Sent as the provider's structured-output format. */\n output<Schema extends StandardSchemaV1>(schema: Schema): Prompt<Input, InferOutput<Schema>>;\n /** Build the provider request without executing it (for inspection, logging, tests). */\n request(input: Input, extraMessages?: readonly PromptMessage[]): Promise<PromptRequest>;\n /** Execute via the given provider `complete` fn and return the validated, typed output. */\n run(input: Input, options: RunOptions): Promise<Output>;\n}"
|
|
4477
|
+
},
|
|
4207
4478
|
{
|
|
4208
4479
|
"name": "PromptArgument",
|
|
4209
4480
|
"kind": "interface",
|
|
@@ -4211,6 +4482,13 @@
|
|
|
4211
4482
|
"signature": "export interface PromptArgument {\n readonly name: string;\n readonly description?: string;\n readonly required?: boolean;\n}",
|
|
4212
4483
|
"doc": "/** One declared argument of an MCP prompt, surfaced in `prompts/list`. */"
|
|
4213
4484
|
},
|
|
4485
|
+
{
|
|
4486
|
+
"name": "PromptInputError",
|
|
4487
|
+
"kind": "class",
|
|
4488
|
+
"package": "@nifrajs/prompt",
|
|
4489
|
+
"signature": "export declare class PromptInputError extends Error {\n readonly issues: ReadonlyArray<StandardIssue>;\n constructor(issues: ReadonlyArray<StandardIssue>);\n}",
|
|
4490
|
+
"doc": "/** A failed prompt input — the caller's variables did not satisfy the input schema. */"
|
|
4491
|
+
},
|
|
4214
4492
|
{
|
|
4215
4493
|
"name": "PromptMessage",
|
|
4216
4494
|
"kind": "interface",
|
|
@@ -4218,6 +4496,34 @@
|
|
|
4218
4496
|
"signature": "export interface PromptMessage {\n readonly role: \"user\" | \"assistant\";\n readonly content: {\n readonly type: \"text\";\n readonly text: string;\n };\n}",
|
|
4219
4497
|
"doc": "/** A message in an MCP prompt's rendered output (see {@link Server.prompt}). */"
|
|
4220
4498
|
},
|
|
4499
|
+
{
|
|
4500
|
+
"name": "PromptMessage",
|
|
4501
|
+
"kind": "interface",
|
|
4502
|
+
"package": "@nifrajs/prompt",
|
|
4503
|
+
"signature": "export interface PromptMessage {\n readonly role: \"system\" | \"user\" | \"assistant\";\n readonly content: string;\n}",
|
|
4504
|
+
"doc": "/** One chat message. The union every provider API accepts. */"
|
|
4505
|
+
},
|
|
4506
|
+
{
|
|
4507
|
+
"name": "PromptOutputError",
|
|
4508
|
+
"kind": "class",
|
|
4509
|
+
"package": "@nifrajs/prompt",
|
|
4510
|
+
"signature": "export declare class PromptOutputError extends Error {\n readonly issues: ReadonlyArray<StandardIssue>;\n /** The raw model reply that failed, for logging/debugging. */\n readonly raw: string;\n constructor(issues: ReadonlyArray<StandardIssue>, \n /** The raw model reply that failed, for logging/debugging. */\n raw: string);\n}",
|
|
4511
|
+
"doc": "/** The model's reply did not satisfy the output schema (after any heal attempts). */"
|
|
4512
|
+
},
|
|
4513
|
+
{
|
|
4514
|
+
"name": "PromptRequest",
|
|
4515
|
+
"kind": "interface",
|
|
4516
|
+
"package": "@nifrajs/prompt",
|
|
4517
|
+
"signature": "export interface PromptRequest {\n readonly messages: readonly PromptMessage[];\n /** Present when the prompt declares `.output()` — pass it as the provider's structured-output format. */\n readonly responseFormat?: PromptResponseFormat;\n}",
|
|
4518
|
+
"doc": "/** Everything a provider adapter needs to execute one prompt call. */"
|
|
4519
|
+
},
|
|
4520
|
+
{
|
|
4521
|
+
"name": "PromptResponseFormat",
|
|
4522
|
+
"kind": "interface",
|
|
4523
|
+
"package": "@nifrajs/prompt",
|
|
4524
|
+
"signature": "export interface PromptResponseFormat {\n readonly name: string;\n readonly strict: true;\n readonly schema: JsonSchema;\n}",
|
|
4525
|
+
"doc": "/** The structured-output format handed to the provider (OpenAI `json_schema` shape; trivially\n * adaptable to Anthropic tool-input or Gemini `responseSchema`). */"
|
|
4526
|
+
},
|
|
4221
4527
|
{
|
|
4222
4528
|
"name": "PROTOCOL_VERSION",
|
|
4223
4529
|
"kind": "const",
|
|
@@ -4478,6 +4784,39 @@
|
|
|
4478
4784
|
"signature": "export interface RedirectOptions {\n /** HTTP status (default 303 See Other; pass 307/308 to preserve the method). */\n readonly status?: number;\n /** Allow an off-origin / absolute destination. Off by default: only a same-origin path (a single\n * leading `/`) is permitted, so an action can't be turned into an open redirect by passing\n * attacker-controlled input straight through. Set `true` for a deliberate external redirect. */\n readonly external?: boolean;\n}",
|
|
4479
4785
|
"doc": "/** Options for {@link redirect}. */"
|
|
4480
4786
|
},
|
|
4787
|
+
{
|
|
4788
|
+
"name": "ReflectedRoute",
|
|
4789
|
+
"kind": "interface",
|
|
4790
|
+
"package": "@nifrajs/core",
|
|
4791
|
+
"signature": "export interface ReflectedRoute {\n readonly method: string;\n readonly path: string;\n readonly schema?: ReflectedRouteSchema;\n readonly tool?: {\n readonly name: string;\n readonly description: string;\n readonly annotations?: ToolAnnotations;\n };\n}"
|
|
4792
|
+
},
|
|
4793
|
+
{
|
|
4794
|
+
"name": "ReflectedRouteSchema",
|
|
4795
|
+
"kind": "interface",
|
|
4796
|
+
"package": "@nifrajs/core",
|
|
4797
|
+
"signature": "export interface ReflectedRouteSchema {\n readonly body?: SchemaReflection;\n readonly query?: SchemaReflection;\n readonly response?: SchemaReflection;\n readonly errors?: Readonly<Record<string, SchemaReflection>>;\n /** The SSE event-payload schema of a typed streaming route (`app.sse()`). */\n readonly sse?: SchemaReflection;\n}"
|
|
4798
|
+
},
|
|
4799
|
+
{
|
|
4800
|
+
"name": "ReflectedSchemaField",
|
|
4801
|
+
"kind": "interface",
|
|
4802
|
+
"package": "@nifrajs/core",
|
|
4803
|
+
"signature": "export interface ReflectedSchemaField {\n readonly name: string;\n readonly required: boolean;\n readonly schema: JsonSchema;\n}",
|
|
4804
|
+
"doc": "/** One top-level property of an introspectable object schema. */"
|
|
4805
|
+
},
|
|
4806
|
+
{
|
|
4807
|
+
"name": "reflectRoutes",
|
|
4808
|
+
"kind": "function",
|
|
4809
|
+
"package": "@nifrajs/core",
|
|
4810
|
+
"signature": "export declare function reflectRoutes(source: unknown): readonly ReflectedRoute[];",
|
|
4811
|
+
"doc": "/**\n * Safely enumerate and normalize route descriptors from an app or descriptor array. Invalid entries\n * are ignored; a missing/throwing `routes()` method yields an empty array.\n */"
|
|
4812
|
+
},
|
|
4813
|
+
{
|
|
4814
|
+
"name": "reflectSchema",
|
|
4815
|
+
"kind": "function",
|
|
4816
|
+
"package": "@nifrajs/core",
|
|
4817
|
+
"signature": "export declare function reflectSchema(value: unknown): SchemaReflection;",
|
|
4818
|
+
"doc": "/**\n * Reflect a Standard Schema, Nifra/TypeBox schema carrier, or raw JSON Schema. Never throws.\n * Validation-only schemas have `standard` but no `jsonSchema`; raw JSON Schema has the reverse.\n */"
|
|
4819
|
+
},
|
|
4481
4820
|
{
|
|
4482
4821
|
"name": "registerFormat",
|
|
4483
4822
|
"kind": "function",
|
|
@@ -4503,7 +4842,7 @@
|
|
|
4503
4842
|
"name": "RegistryFromImpl",
|
|
4504
4843
|
"kind": "type",
|
|
4505
4844
|
"package": "@nifrajs/core",
|
|
4506
|
-
"signature": "export type RegistryFromImpl<C extends ContractShape, H extends HandlersFor<C>> = {\n [P in C[keyof C][\"path\"]]: {\n [K in keyof C as C[K][\"path\"] extends P ? C[K][\"method\"] : never]: {\n readonly params: Params<C[K][\"path\"]>;\n readonly query: OpQuery<C[K]>;\n readonly body: OpBody<C[K]>;\n readonly output: C[K] extends {\n response: infer R extends StandardSchemaV1;\n } ? InferOutput<R> : H[K] extends AnyFn ? OutputOf<H[K]> : unknown;\n readonly errors: OpErrors<C[K]>;\n };\n };\n};",
|
|
4845
|
+
"signature": "export type RegistryFromImpl<C extends ContractShape, H extends HandlersFor<C>> = {\n [P in C[keyof C][\"path\"]]: {\n [K in keyof C as C[K][\"path\"] extends P ? C[K][\"method\"] : never]: {\n readonly params: Params<C[K][\"path\"]>;\n readonly query: OpQuery<C[K]>;\n readonly body: OpBody<C[K]>;\n readonly output: C[K] extends {\n response: infer R extends StandardSchemaV1;\n } ? InferOutput<R> : H[K] extends AnyFn ? OutputOf<H[K]> : unknown;\n readonly errors: OpErrors<C[K]>;\n readonly sse: never;\n };\n };\n};",
|
|
4507
4846
|
"doc": "/**\n * The registry produced by `implement`: input from the contract op; `output` is the declared `response`\n * contract when present (it wins — exactly as in the inline path), else the bound HANDLER's return — so\n * the implemented server stays route-for-route identical to the equivalent inline server (the\n * mode-conformance guarantee), and a contract-typed client and a `typeof app`-typed client agree.\n */"
|
|
4508
4847
|
},
|
|
4509
4848
|
{
|
|
@@ -4518,7 +4857,21 @@
|
|
|
4518
4857
|
"kind": "interface",
|
|
4519
4858
|
"package": "@nifrajs/web",
|
|
4520
4859
|
"signature": "export interface RenderAdapter {\n /**\n * Server: render a route's layout `chain` (outermost layout → page) to a **stream** of HTML\n * bytes, including the framework's hydration markers. The page (innermost) receives `props`\n * (the loader data); each layout wraps the child via its `children`. Returns (or resolves to)\n * a Web `ReadableStream<Uint8Array>`: a streaming renderer flushes the shell first and streams\n * Suspense boundaries as they resolve; a non-streaming renderer may return a one-chunk stream.\n * May be async — e.g. React resolves once the shell is renderable, so a shell-render throw can\n * still map to an error status before any byte is sent.\n */\n renderToStream(chain: readonly unknown[], props: RenderProps): ReadableStream<Uint8Array> | Promise<ReadableStream<Uint8Array>>;\n /**\n * Server (optional): render the chain to a complete HTML **string** in one pass, with the same\n * hydration markers `renderToStream` produces. When provided, `renderPage` uses it for any page\n * that does **not** `defer()` — buffering the document is faster than the streaming pipeline there,\n * because the framework's synchronous renderer (React `renderToString`, Solid `renderToString`,\n * Preact `render`, Vue `renderToString`, Svelte `render`) is markedly cheaper than its streaming\n * renderer — most visibly on Bun, where React Fizz / Solid `renderToStream` are the heaviest. Pages\n * that `defer()` keep the streaming path (progressive `<Await>` needs it). Markup MUST be\n * hydration-equivalent to `renderToStream`; a throw surfaces like the streaming shell-readiness\n * await (the `_error` boundary maps it to a status). Omit it to always stream.\n */\n renderToString?(chain: readonly unknown[], props: RenderProps): string | Promise<string>;\n /**\n * Server: per-document bootstrap markup injected into `<head>` that the client\n * `hydrate` requires (Solid: `generateHydrationScript()`). Empty string if none.\n */\n hydrationHead(): string;\n}",
|
|
4521
|
-
"doc": "
|
|
4860
|
+
"doc": "/**\n * The seam every render adapter implements. New adapters should prove these invariants with\n * {@link assertRenderAdapterConformance}; framework-specific behavior remains locally tested.\n */"
|
|
4861
|
+
},
|
|
4862
|
+
{
|
|
4863
|
+
"name": "RenderAdapterConformanceError",
|
|
4864
|
+
"kind": "class",
|
|
4865
|
+
"package": "@nifrajs/web",
|
|
4866
|
+
"signature": "export declare class RenderAdapterConformanceError extends Error {\n readonly check: string;\n constructor(check: string, message: string, cause?: unknown);\n}",
|
|
4867
|
+
"doc": "/** A failed invariant reported by {@link assertRenderAdapterConformance}. */"
|
|
4868
|
+
},
|
|
4869
|
+
{
|
|
4870
|
+
"name": "RenderAdapterConformanceFixture",
|
|
4871
|
+
"kind": "interface",
|
|
4872
|
+
"package": "@nifrajs/web",
|
|
4873
|
+
"signature": "export interface RenderAdapterConformanceFixture {\n /** A page that renders the `page`, `data`, and `pending` markers from the supplied props. */\n readonly page: unknown;\n /** The outer layout, which renders `markers.outer` before its child. */\n readonly outerLayout: unknown;\n /** The inner layout, which renders `markers.inner` before its child. */\n readonly innerLayout: unknown;\n /** Props passed to the page. Use values represented by the `data` and `pending` markers. */\n readonly props: RenderProps;\n /**\n * Set when the fixture renders **deferred/streaming-only** content (e.g. Suspense that resolves during\n * the stream). Streaming and buffered (`renderToString`) output then legitimately differ byte-for-byte,\n * so the hydration-equivalence check is relaxed to \"buffered output still contains every marker\" instead\n * of exact equality. Leave unset for plain synchronous content (the stricter, preferred check).\n */\n readonly deferred?: boolean;\n /** Unique text fragments observable in the rendered HTML. */\n readonly markers: {\n readonly page: string;\n readonly data: string;\n readonly pending: string;\n readonly outer: string;\n readonly inner: string;\n };\n}",
|
|
4874
|
+
"doc": "/** Framework-specific values that let the shared conformance module exercise a render adapter. */"
|
|
4522
4875
|
},
|
|
4523
4876
|
{
|
|
4524
4877
|
"name": "renderDevErrorOverlay",
|
|
@@ -4830,6 +5183,13 @@
|
|
|
4830
5183
|
"signature": "export interface ResponseDef {\n readonly description?: string;\n /** Response body schema (any Standard Schema; a `t` schema yields full JSON Schema in OpenAPI). */\n readonly schema?: StandardSchemaV1;\n /** Content type. Default `application/json`. */\n readonly contentType?: string;\n}",
|
|
4831
5184
|
"doc": "/** An additional (non-success) response a contract operation can document, e.g. a `404`. */"
|
|
4832
5185
|
},
|
|
5186
|
+
{
|
|
5187
|
+
"name": "ResponseFinalization",
|
|
5188
|
+
"kind": "interface",
|
|
5189
|
+
"package": "@nifrajs/core",
|
|
5190
|
+
"signature": "export interface ResponseFinalization {\n /** The final response, or the last response available when a transformation failed. */\n readonly response: Response;\n /** A response-hook failure. Terminal observers run fail-open before the error is rethrown. */\n readonly error?: unknown;\n}",
|
|
5191
|
+
"doc": "/** The terminal response-pipeline outcome observed after every transforming `onResponse` hook. */"
|
|
5192
|
+
},
|
|
4833
5193
|
{
|
|
4834
5194
|
"name": "Result",
|
|
4835
5195
|
"kind": "type",
|
|
@@ -4910,6 +5270,12 @@
|
|
|
4910
5270
|
"signature": "export type RouteBody<App, Path extends string, Method extends string> = Path extends keyof RegistryOf<App> ? Uppercase<Method> extends keyof RegistryOf<App>[Path] ? (RegistryOf<App>[Path][Uppercase<Method>] & RouteInfo)[\"body\"] : never : never;",
|
|
4911
5271
|
"doc": "/** The body object type of `App`'s `Method Path` route (`never` when the route declares no body). */"
|
|
4912
5272
|
},
|
|
5273
|
+
{
|
|
5274
|
+
"name": "RouteChange",
|
|
5275
|
+
"kind": "interface",
|
|
5276
|
+
"package": "@nifrajs/core",
|
|
5277
|
+
"signature": "export interface RouteChange {\n readonly severity: DiffSeverity;\n readonly method: string;\n readonly path: string;\n /** Which part of the contract changed; \"route\" for add/remove of the whole route. */\n readonly section: \"route\" | \"body\" | \"query\" | \"response\" | \"sse\" | \"errors\";\n /** The top-level field (or error status) the change is about, when field-granular. */\n readonly field?: string;\n readonly message: string;\n}"
|
|
5278
|
+
},
|
|
4913
5279
|
{
|
|
4914
5280
|
"name": "RouteConfigError",
|
|
4915
5281
|
"kind": "class",
|
|
@@ -4942,14 +5308,14 @@
|
|
|
4942
5308
|
"name": "RouteInfo",
|
|
4943
5309
|
"kind": "interface",
|
|
4944
5310
|
"package": "@nifrajs/core",
|
|
4945
|
-
"signature": "export interface RouteInfo {\n readonly params: object;\n readonly query: unknown;\n readonly body: unknown;\n readonly output: unknown;\n /** Union of the route's declared error-response body types (from `schema.errors`); `unknown` when the\n * route declares none. Surfaced by the typed client as the failure `errorData`. */\n readonly errors?: unknown;\n}",
|
|
5311
|
+
"signature": "export interface RouteInfo {\n readonly params: object;\n readonly query: unknown;\n readonly body: unknown;\n readonly output: unknown;\n /** Union of the route's declared error-response body types (from `schema.errors`); `unknown` when the\n * route declares none. Surfaced by the typed client as the failure `errorData`. */\n readonly errors?: unknown;\n /** The SSE event payload type (from `schema.sse`, declared via `app.sse()`); `never` for ordinary\n * routes. The typed client keys `.subscribe()` availability and its event type off this. */\n readonly sse?: unknown;\n}",
|
|
4946
5312
|
"doc": "/**\n * One route's input/output shape as the **client** will consume it. `query`/`body`\n * are `never` when the route declares no schema for them, so the client can detect\n * \"this route takes no body\" via `[body] extends [never]`. `output` is the\n * handler's raw return type (the client applies `Jsonify` when reading it).\n */"
|
|
4947
5313
|
},
|
|
4948
5314
|
{
|
|
4949
5315
|
"name": "RouteInfoFor",
|
|
4950
5316
|
"kind": "type",
|
|
4951
5317
|
"package": "@nifrajs/core",
|
|
4952
|
-
"signature": "export type RouteInfoFor<Path extends string, S extends RouteSchema, Output> = {\n readonly params: Params<Path>;\n readonly query: RegistryQuery<S>;\n readonly body: RegistryBody<S>;\n readonly output: RegistryOutput<S, Output>;\n readonly errors: RegistryErrors<S>;\n};",
|
|
5318
|
+
"signature": "export type RouteInfoFor<Path extends string, S extends RouteSchema, Output> = {\n readonly params: Params<Path>;\n readonly query: RegistryQuery<S>;\n readonly body: RegistryBody<S>;\n readonly output: RegistryOutput<S, Output>;\n readonly errors: RegistryErrors<S>;\n readonly sse: RegistrySse<S>;\n};",
|
|
4953
5319
|
"doc": "/** Build a {@link RouteInfo} from a route's path, schema, and handler output type. */"
|
|
4954
5320
|
},
|
|
4955
5321
|
{
|
|
@@ -5040,9 +5406,28 @@
|
|
|
5040
5406
|
"name": "RouteSchema",
|
|
5041
5407
|
"kind": "interface",
|
|
5042
5408
|
"package": "@nifrajs/core",
|
|
5043
|
-
"signature": "export interface RouteSchema {\n readonly body?: StandardSchemaV1;\n readonly query?: StandardSchemaV1;\n /** Optional **response contract**. When declared: the handler's return is type-checked against it\n * (the implementation can't drift from the contract), the typed client sees THIS as the response type\n * (the contract — not the handler's incidental return), and it's emitted into OpenAPI/JSON-Schema so\n * tooling and coding agents can read the exact shape. It is **not** validated at runtime (zero\n * hot-path cost) — purely a compile-time + introspection contract. */\n readonly response?: StandardSchemaV1;\n /**\n * Optional **error-response contract**: a map of HTTP status code → the Standard Schema of that error's\n * body. Declares a route's failure modes so they flow into OpenAPI (as non-2xx `responses`), the\n * `/llms.txt` context, and other introspection — the whole contract, not just the happy path, is legible\n * to tooling and coding agents. Like `response`, it is **not** validated at runtime (zero hot-path cost);\n * it's a compile-time + introspection contract. Example: `{ 404: NotFound, 409: Conflict }`. */\n readonly errors?: Readonly<Record<number, StandardSchemaV1>>;\n /**\n * Hook fired when the request fails `body`/`query` validation, before the handler runs. `kind` says\n * which input failed (`\"body\"` | `\"query\"`). Its return value selects one of three outcomes (may be async):\n * - a **`Response`** → returned as-is, short-circuiting the route (custom error envelope, redirect, …).\n * - **any other value** → treated as a repaired payload and **re-validated once** against the same\n * schema. If it now passes, the handler runs with it; if it still fails, the original `422` stands.\n * Re-validation means a bad return can't bypass the schema — the trust boundary holds.\n * - **`undefined`** → give up; the original validation `422` is returned unchanged.\n * A route hook **overrides** the app-wide default set via `server({ onValidationError })`; return\n * `undefined` to fall through to the plain `422` even when an app default exists. Typical uses: a custom\n * error envelope, coercing the input, or prompting an LLM to repair the payload (re-validated, so it can't\n * bypass the schema).\n */\n readonly onValidationError?: (issues: ReadonlyArray<StandardIssue>, ctx: Context, kind: \"body\" | \"query\") => Response | unknown | Promise<Response | unknown>;\n}",
|
|
5409
|
+
"signature": "export interface RouteSchema {\n readonly body?: StandardSchemaV1;\n readonly query?: StandardSchemaV1;\n /** Optional **response contract**. When declared: the handler's return is type-checked against it\n * (the implementation can't drift from the contract), the typed client sees THIS as the response type\n * (the contract — not the handler's incidental return), and it's emitted into OpenAPI/JSON-Schema so\n * tooling and coding agents can read the exact shape. It is **not** validated at runtime (zero\n * hot-path cost) — purely a compile-time + introspection contract. */\n readonly response?: StandardSchemaV1;\n /**\n * Optional **error-response contract**: a map of HTTP status code → the Standard Schema of that error's\n * body. Declares a route's failure modes so they flow into OpenAPI (as non-2xx `responses`), the\n * `/llms.txt` context, and other introspection — the whole contract, not just the happy path, is legible\n * to tooling and coding agents. Like `response`, it is **not** validated at runtime (zero hot-path cost);\n * it's a compile-time + introspection contract. Example: `{ 404: NotFound, 409: Conflict }`. */\n readonly errors?: Readonly<Record<number, StandardSchemaV1>>;\n /**\n * Optional **SSE event contract**: the Standard Schema of each event's `data` payload on a\n * streaming route (declared via `app.sse()`). Marks the route as a typed event stream — the\n * typed client grows a `.subscribe()` for it, and the schema flows into reflection. Like\n * `response`, it is **not** validated at runtime (zero hot-path cost); the server-side\n * `stream.send()` is compile-time-checked against it instead.\n */\n readonly sse?: StandardSchemaV1;\n /**\n * Hook fired when the request fails `body`/`query` validation, before the handler runs. `kind` says\n * which input failed (`\"body\"` | `\"query\"`). Its return value selects one of three outcomes (may be async):\n * - a **`Response`** → returned as-is, short-circuiting the route (custom error envelope, redirect, …).\n * - **any other value** → treated as a repaired payload and **re-validated once** against the same\n * schema. If it now passes, the handler runs with it; if it still fails, the original `422` stands.\n * Re-validation means a bad return can't bypass the schema — the trust boundary holds.\n * - **`undefined`** → give up; the original validation `422` is returned unchanged.\n * A route hook **overrides** the app-wide default set via `server({ onValidationError })`; return\n * `undefined` to fall through to the plain `422` even when an app default exists. Typical uses: a custom\n * error envelope, coercing the input, or prompting an LLM to repair the payload (re-validated, so it can't\n * bypass the schema).\n */\n readonly onValidationError?: (issues: ReadonlyArray<StandardIssue>, ctx: Context, kind: \"body\" | \"query\") => Response | unknown | Promise<Response | unknown>;\n}",
|
|
5044
5410
|
"doc": "/** Per-route input schemas. Each is any Standard Schema (zod/valibot/arktype/…). */"
|
|
5045
5411
|
},
|
|
5412
|
+
{
|
|
5413
|
+
"name": "RoutesDiff",
|
|
5414
|
+
"kind": "interface",
|
|
5415
|
+
"package": "@nifrajs/core",
|
|
5416
|
+
"signature": "export interface RoutesDiff {\n readonly changes: readonly RouteChange[];\n /** True when any change is `breaking` — the CI-gate signal. */\n readonly hasBreaking: boolean;\n}"
|
|
5417
|
+
},
|
|
5418
|
+
{
|
|
5419
|
+
"name": "RouteSnapshot",
|
|
5420
|
+
"kind": "interface",
|
|
5421
|
+
"package": "@nifrajs/core",
|
|
5422
|
+
"signature": "export interface RouteSnapshot {\n readonly method: string;\n readonly path: string;\n readonly schema?: RouteSnapshotSchema;\n}",
|
|
5423
|
+
"doc": "/** One route in a snapshot — plain JSON, safe to persist as a CI baseline. */"
|
|
5424
|
+
},
|
|
5425
|
+
{
|
|
5426
|
+
"name": "RouteSnapshotSchema",
|
|
5427
|
+
"kind": "interface",
|
|
5428
|
+
"package": "@nifrajs/core",
|
|
5429
|
+
"signature": "export interface RouteSnapshotSchema {\n readonly body?: SchemaSnapshot;\n readonly query?: SchemaSnapshot;\n readonly response?: SchemaSnapshot;\n readonly sse?: SchemaSnapshot;\n readonly errors?: Readonly<Record<string, SchemaSnapshot>>;\n}"
|
|
5430
|
+
},
|
|
5046
5431
|
{
|
|
5047
5432
|
"name": "routesToJson",
|
|
5048
5433
|
"kind": "function",
|
|
@@ -5061,7 +5446,7 @@
|
|
|
5061
5446
|
"name": "RouteTableInput",
|
|
5062
5447
|
"kind": "interface",
|
|
5063
5448
|
"package": "@nifrajs/cli",
|
|
5064
|
-
"signature": "export interface RouteTableInput {\n readonly pages: readonly PageRouteInput[];\n readonly api:
|
|
5449
|
+
"signature": "export interface RouteTableInput {\n readonly pages: readonly PageRouteInput[];\n readonly api: ReadonlyArray<Pick<ReflectedRoute, \"method\" | \"path\">>;\n /** The page router's `apiPrefix` (default `/api`); an API route at/under it is auto-mounted. `\"\"`\n * disables the auto-mount, so no API route is marked auto-mounted. */\n readonly apiPrefix?: string;\n}"
|
|
5065
5450
|
},
|
|
5066
5451
|
{
|
|
5067
5452
|
"name": "routeTableToJson",
|
|
@@ -5110,6 +5495,13 @@
|
|
|
5110
5495
|
"signature": "export declare function runCheck(cwd: string, opts?: {\n readonly json?: boolean;\n readonly lintsOnly?: boolean;\n}): Promise<boolean>;",
|
|
5111
5496
|
"doc": "/** Run the full check; print a report (`--json` for machine output) and return whether it passed. */"
|
|
5112
5497
|
},
|
|
5498
|
+
{
|
|
5499
|
+
"name": "runDiff",
|
|
5500
|
+
"kind": "function",
|
|
5501
|
+
"package": "@nifrajs/cli",
|
|
5502
|
+
"signature": "export declare function runDiff(cwd: string, baselinePath: string, options: {\n json?: boolean;\n}): Promise<boolean>;",
|
|
5503
|
+
"doc": "/** `nifra diff`: compare the current contract against a baseline. Returns false on breaking changes. */"
|
|
5504
|
+
},
|
|
5113
5505
|
{
|
|
5114
5506
|
"name": "runDoctor",
|
|
5115
5507
|
"kind": "function",
|
|
@@ -5138,6 +5530,12 @@
|
|
|
5138
5530
|
"signature": "export interface RunningServer {\n readonly port: number;\n readonly hostname: string;\n readonly pendingRequests: number;\n stop(closeActiveConnections?: boolean): void;\n}",
|
|
5139
5531
|
"doc": "/**\n * The handle `listen()` returns — the slice of Bun's server nifra holds and exposes.\n * Declared explicitly (rather than `ReturnType<typeof Bun.serve>`) so the public type\n * surface doesn't leak the ambient `Bun` global into consumers' `.d.ts` resolution.\n */"
|
|
5140
5532
|
},
|
|
5533
|
+
{
|
|
5534
|
+
"name": "RunOptions",
|
|
5535
|
+
"kind": "interface",
|
|
5536
|
+
"package": "@nifrajs/prompt",
|
|
5537
|
+
"signature": "export interface RunOptions {\n /** Execute the LLM call and return the raw text of the model's reply. */\n readonly complete: (request: PromptRequest) => string | Promise<string>;\n /**\n * Repair hook: called when the reply fails output validation, with the raw reply and the issues.\n * Return a corrected raw reply (e.g. by re-asking the model) — it is validated again. Runs at most\n * `healAttempts` times (default 1). Omit to fail fast.\n */\n readonly heal?: (context: {\n readonly raw: string;\n readonly issues: ReadonlyArray<StandardIssue>;\n readonly request: PromptRequest;\n }) => string | Promise<string>;\n /** Max heal retries after the first failed validation (default 1). */\n readonly healAttempts?: number;\n /** Extra messages appended after the instruction (few-shot examples, prior turns). */\n readonly messages?: readonly PromptMessage[];\n}"
|
|
5538
|
+
},
|
|
5141
5539
|
{
|
|
5142
5540
|
"name": "RunOptions",
|
|
5143
5541
|
"kind": "interface",
|
|
@@ -5157,6 +5555,12 @@
|
|
|
5157
5555
|
"package": "@nifrajs/cli",
|
|
5158
5556
|
"signature": "export interface RunPortOptions {\n readonly target?: string;\n readonly json?: boolean;\n /** Fail (exit non-zero) on a detected unsupported feature for the resolved target. Implied by --target. */\n readonly ci?: boolean;\n /** With --ci, also fail on caveats (not just unsupported). */\n readonly strict?: boolean;\n}"
|
|
5159
5557
|
},
|
|
5558
|
+
{
|
|
5559
|
+
"name": "RunQueryOptions",
|
|
5560
|
+
"kind": "interface",
|
|
5561
|
+
"package": "@nifrajs/mcp-db",
|
|
5562
|
+
"signature": "export interface RunQueryOptions {\n /**\n * REQUIRED. Authorize each `run_query` call at the transport boundary (inspect the inbound\n * Request's auth). Return false to reject with a JSON-RPC error. There is no unauthenticated\n * mode — schema tools are the anonymous surface. Note: `run_query` is therefore HTTP-only;\n * direct `handle()` dispatch rejects it (no Request to authorize — fails closed).\n */\n readonly authorize: (context: McpDbAuthorizeContext) => boolean | Promise<boolean>;\n /** Max rows returned per query (default 100). */\n readonly maxRows?: number;\n /** Max serialized result size in bytes (default 100 KB). */\n readonly maxResultBytes?: number;\n}"
|
|
5563
|
+
},
|
|
5160
5564
|
{
|
|
5161
5565
|
"name": "runRequest",
|
|
5162
5566
|
"kind": "function",
|
|
@@ -5171,6 +5575,13 @@
|
|
|
5171
5575
|
"signature": "export interface RunResult {\n readonly label?: string;\n readonly method: string;\n readonly path: string;\n /** `true` when the app returned a 2xx response. `false` for non-2xx, or when `app.fetch` threw. */\n readonly ok: boolean;\n /** HTTP status — present when the app returned a response (absent when it threw). */\n readonly status?: number;\n readonly statusText?: string;\n readonly headers?: Readonly<Record<string, string>>;\n /** Parsed JSON when the response is JSON; otherwise the (possibly truncated) text. */\n readonly body?: unknown;\n /** The response body as text, truncated to `maxBodyChars`. */\n readonly bodyText?: string;\n /** `true` when `bodyText` was cut to the cap. */\n readonly truncated?: boolean;\n /** Wall-clock time for this request, milliseconds. */\n readonly durationMs: number;\n /** Set when `app.fetch` threw (the app crashed) rather than returning a response. */\n readonly error?: {\n readonly name: string;\n readonly message: string;\n readonly stack?: string;\n };\n}",
|
|
5172
5576
|
"doc": "/** The captured outcome of one request. */"
|
|
5173
5577
|
},
|
|
5578
|
+
{
|
|
5579
|
+
"name": "runSnapshot",
|
|
5580
|
+
"kind": "function",
|
|
5581
|
+
"package": "@nifrajs/cli",
|
|
5582
|
+
"signature": "export declare function runSnapshot(cwd: string, options: {\n out?: string;\n}): Promise<void>;",
|
|
5583
|
+
"doc": "/** `nifra snapshot`: write the current contract as the CI baseline. */"
|
|
5584
|
+
},
|
|
5174
5585
|
{
|
|
5175
5586
|
"name": "runWebSocket",
|
|
5176
5587
|
"kind": "function",
|
|
@@ -5330,6 +5741,20 @@
|
|
|
5330
5741
|
"package": "@nifrajs/cron",
|
|
5331
5742
|
"signature": "export interface SchedulerOptions {\n /** Called when a job handler throws/rejects. Default: `console.error`. A throwing onError is swallowed. */\n readonly onError?: (error: unknown, jobName: string) => void;\n /** Injectable clock (tests). Default `() => new Date()`. */\n readonly now?: () => Date;\n}"
|
|
5332
5743
|
},
|
|
5744
|
+
{
|
|
5745
|
+
"name": "SchemaReflection",
|
|
5746
|
+
"kind": "interface",
|
|
5747
|
+
"package": "@nifrajs/core",
|
|
5748
|
+
"signature": "export interface SchemaReflection {\n /** The Standard Schema validator, when the value implements Standard Schema v1. */\n readonly standard: StandardSchemaV1 | undefined;\n /** Raw JSON Schema metadata, when the value exposes it or is itself a raw JSON Schema. */\n readonly jsonSchema: JsonSchema | undefined;\n /** Top-level object fields, or `undefined` when the JSON Schema is absent/non-object. */\n readonly fields: readonly ReflectedSchemaField[] | undefined;\n}",
|
|
5749
|
+
"doc": "/** Validation and introspection capabilities discovered for one schema-like value. */"
|
|
5750
|
+
},
|
|
5751
|
+
{
|
|
5752
|
+
"name": "SchemaSnapshot",
|
|
5753
|
+
"kind": "interface",
|
|
5754
|
+
"package": "@nifrajs/core",
|
|
5755
|
+
"signature": "export interface SchemaSnapshot {\n readonly jsonSchema?: JsonSchema;\n readonly fields?: readonly ReflectedSchemaField[];\n}",
|
|
5756
|
+
"doc": "/** One schema position in a snapshot: JSON Schema metadata only, no validator. */"
|
|
5757
|
+
},
|
|
5333
5758
|
{
|
|
5334
5759
|
"name": "ScoredExample",
|
|
5335
5760
|
"kind": "interface",
|
|
@@ -5469,6 +5894,19 @@
|
|
|
5469
5894
|
"signature": "export declare function serve(app: FetchHandler, options: ServeOptions): Promise<NodeServer>;",
|
|
5470
5895
|
"doc": "/**\n * Serve a Web-`fetch` app on a Node `http` server. Resolves once bound — Node binds\n * the port asynchronously, so awaiting gives you the real port (matters for `port: 0`).\n */"
|
|
5471
5896
|
},
|
|
5897
|
+
{
|
|
5898
|
+
"name": "serveDatabaseAsMcp",
|
|
5899
|
+
"kind": "function",
|
|
5900
|
+
"package": "@nifrajs/mcp-db",
|
|
5901
|
+
"signature": "export declare function serveDatabaseAsMcp(db: SqliteDatabaseLike, options: ServeDatabaseAsMcpOptions): McpServer;",
|
|
5902
|
+
"doc": "/**\n * Serve `db` as a mountable MCP server (`mcp.fetch` at `POST /mcp`). See module docs for the\n * security model. Throws {@link McpDbConfigError} on any unsafe configuration — always at\n * construction (boot), never at request time.\n */"
|
|
5903
|
+
},
|
|
5904
|
+
{
|
|
5905
|
+
"name": "ServeDatabaseAsMcpOptions",
|
|
5906
|
+
"kind": "interface",
|
|
5907
|
+
"package": "@nifrajs/mcp-db",
|
|
5908
|
+
"signature": "export interface ServeDatabaseAsMcpOptions {\n /**\n * REQUIRED allowlist of tables the MCP surface may see. `list_tables`/`describe_table` are\n * restricted to it and `run_query` plans are verified against it. Empty array → construction\n * throws; expose nothing by accident, ever.\n */\n readonly tables: readonly string[];\n /** Enable the `run_query` tool. Omitted → schema tools only. */\n readonly runQuery?: RunQueryOptions;\n /** MCP server identity (defaults: name `nifra-db`, version `1.0.0`). */\n readonly name?: string;\n readonly version?: string;\n /**\n * Set `PRAGMA query_only = ON` on the connection at construction (default true). Disable ONLY\n * when the same connection must also serve writes elsewhere in the app — with it disabled,\n * `run_query` still gates on SELECT/WITH + plan verification, but the engine-level guarantee is\n * yours to provide (e.g. open a second, read-only connection for the MCP mount — preferred).\n */\n readonly enforceQueryOnly?: boolean;\n}"
|
|
5909
|
+
},
|
|
5472
5910
|
{
|
|
5473
5911
|
"name": "ServeOptions",
|
|
5474
5912
|
"kind": "interface",
|
|
@@ -5486,7 +5924,7 @@
|
|
|
5486
5924
|
"name": "Server",
|
|
5487
5925
|
"kind": "class",
|
|
5488
5926
|
"package": "@nifrajs/core",
|
|
5489
|
-
"signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext> {\n private readonly router;\n /** WebSocket routes, matched separately at upgrade time (a GET + `Upgrade: websocket`). */\n private readonly wsRouter;\n private wsRouteCount;\n /** In-process pub/sub backing `ws.subscribe(topic)` + `app.publish(topic, data)` (single-instance).\n * Created by the first `app.ws()` via the `@nifrajs/core/ws` runtime — `undefined` until then, so a\n * no-WebSocket app never constructs (or bundles) it. */\n private topics;\n private readonly routeList;\n private readonly maxBodyBytes;\n private readonly wsMaxPayloadBytes;\n private readonly requestTimeoutMs;\n private readonly gracefulSignals;\n private readonly logger;\n /** App-wide validation-error fallback; a route's own `schema.onValidationError` takes precedence. */\n private readonly defaultOnValidationError?;\n private bunServer;\n private readonly derives;\n private readonly decorations;\n private readonly beforeHandleHooks;\n private readonly afterHandleHooks;\n private readonly onErrorHooks;\n private readonly aroundHooks;\n private readonly onRequestHooks;\n private readonly onResponseHooks;\n private readonly responseRequests;\n /** Names of plugins/middleware already applied via `use` — for idempotent dedupe. */\n private readonly appliedPlugins;\n /** App-declared MCP resources / prompts (via {@link resource} / {@link prompt}), read by `nifra mcp`. */\n private readonly mcpResourceList;\n private readonly mcpPromptList;\n constructor(options?: ServerOptions);\n /** Add a per-request, computed context extension for subsequent routes. */\n derive<D extends object>(fn: (context: Context & Ctx) => MaybePromise<D>): Server<R, Ctx & D>;\n /** Add a static context value for subsequent routes. */\n decorate<const K extends string, V>(key: K, value: V): Server<R, Ctx & Record<K, V>>;\n /**\n * Run before routing on the raw request. Return a `Response` to short-circuit, or a replacement\n * `Request` to continue routing with a rewritten method/URL/headers. Global.\n */\n onRequest(fn: (req: Request) => MaybePromise<OnRequestResult>): this;\n /** Run after validation, before the handler; a non-`undefined` return short-circuits. Order-scoped. */\n beforeHandle(fn: (context: Context & Ctx) => MaybePromise<unknown>): this;\n /**\n * Wrap the matched route lifecycle for subsequent routes. This is intentionally generic over the\n * route output, so wrappers like async context storage do not force Node's direct JSON path through\n * a Web `Response`. The first registered wrapper is outermost.\n */\n around(fn: <T>(context: Context & Ctx, next: () => MaybePromise<T>) => MaybePromise<T>): this;\n /** Transform the handler's result before it is serialized. Order-scoped. */\n afterHandle(fn: (result: unknown, context: Context & Ctx) => MaybePromise<unknown>): this;\n /** Handle a thrown error; a non-`undefined` return becomes the response (else the default 500). Order-scoped. */\n onError(fn: (error: unknown, context: Context & Ctx) => MaybePromise<unknown>): this;\n /** Transform every outgoing response — success, error, 404, 405, short-circuit. Global. */\n onResponse(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Apply a type-**identity** plugin ({@link IdentityPlugin}, from {@link defineIdentityPlugin}) — it\n * registers routes/hooks but doesn't change the types, so this returns `this` with the route registry\n * and context fully intact. This overload exists specifically so a *named* identity plugin (e.g.\n * `@nifrajs/better-auth`) threads the registry: its `& { pluginName }` intersection would otherwise\n * defeat the generic inference of the transforming overload below and collapse the result to `any`.\n */\n use(plugin: IdentityPlugin): this;\n /**\n * Apply a **plugin function** — `(app) => app`, typically built with {@link definePlugin}. It's\n * called with `this` and its result is returned, so an inline plugin's `derive`/`decorate` thread\n * the added context to handlers defined after `use` (the overload is generic over the concrete\n * `this`). A named plugin already applied is skipped (idempotent dedupe).\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): Out;\n /**\n * Apply a {@link Middleware} bundle — wire each hook it provides to its lifecycle point. Returns\n * `this` (no context-type merging); call it before the routes its `beforeHandle`/`afterHandle`\n * should cover (those are order-scoped; `onRequest`/`onResponse` are global). A named bundle already\n * applied is skipped (idempotent).\n */\n use(mw: Middleware): this;\n get<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, S, OutputOf<H>>>, Ctx>;\n get<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>>>, Ctx>;\n post<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, S, OutputOf<H>>>, Ctx>;\n post<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>>>, Ctx>;\n put<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, S, OutputOf<H>>>, Ctx>;\n put<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>>>, Ctx>;\n patch<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, S, OutputOf<H>>>, Ctx>;\n patch<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>>>, Ctx>;\n delete<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, S, OutputOf<H>>>, Ctx>;\n delete<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>>>, Ctx>;\n tool<Name extends string, S extends {\n description: string;\n input: StandardSchemaV1;\n output?: StandardSchemaV1;\n annotations?: ToolAnnotations;\n }, H extends (input: InferOutput<S[\"input\"]>, ctx: Context & Ctx) => MaybePromise<S[\"output\"] extends StandardSchemaV1 ? InferOutput<S[\"output\"]> : unknown>>(name: Name, config: S, handler: H): Server<AddRoute<R, \"POST\", `/_nifra/tool/${Name}`, RouteInfoFor<`/_nifra/tool/${Name}`, S[\"output\"] extends StandardSchemaV1 ? {\n body: S[\"input\"];\n response: S[\"output\"];\n } : {\n body: S[\"input\"];\n }, OutputOf<H>>>, Ctx>;\n /**\n * Declare an MCP **resource** — read-only data an agent can fetch through `nifra mcp` (app config, a\n * generated document, …). `read` runs in the app process, so capture whatever app state it needs in the\n * closure. `uri` is the MCP resource identifier (e.g. `\"myapp://config\"`). The sibling of {@link tool}\n * for the resource half of MCP.\n */\n resource(uri: string, config: {\n readonly name: string;\n readonly description?: string;\n readonly mimeType?: string;\n }, read: McpResourceDescriptor[\"read\"]): Server<R, Ctx>;\n /**\n * Declare an MCP **prompt** — a reusable prompt template an agent can fetch through `nifra mcp`.\n * `handler` receives the caller's arguments and returns the rendered messages.\n */\n prompt(name: string, config: {\n readonly description: string;\n readonly arguments?: readonly PromptArgument[];\n }, handler: McpPromptDescriptor[\"handler\"]): Server<R, Ctx>;\n /** The MCP resources declared via {@link resource} — enumerated by `nifra mcp`. */\n mcpResources(): readonly McpResourceDescriptor[];\n /** The MCP prompts declared via {@link prompt} — enumerated by `nifra mcp`. */\n mcpPrompts(): readonly McpPromptDescriptor[];\n /**\n * Register a **WebSocket** route. The connection upgrades on a `GET` to `path` carrying\n * `Upgrade: websocket`; the optional `handler.upgrade(c)` runs in the request context first and may\n * reject (return a `Response`) or seed per-connection `ws.data`. WebSockets are served by the\n * adapter (`listen()`, `@nifrajs/node`, `@nifrajs/deno`, `toFetchHandler`) — not by bare `app.fetch`, which\n * has no socket (a WS path through `app.fetch` is a normal HTTP response).\n *\n * app.ws(\"/chat\", { open: (ws) => ws.send(\"hi\"), message: (ws, data) => ws.send(data) })\n */\n ws<Data = unknown, Schema extends StandardSchemaV1 | undefined = undefined>(path: string, handler: WebSocketHandler<Data, EnvOf<Ctx>, Schema>): this;\n /**\n * Broadcast `data` to every WebSocket connection subscribed to `topic` (via `ws.subscribe(topic)`).\n * In-process and **single-instance** (see {@link TopicRegistry}) — a multi-instance deploy must bridge\n * an external fan-out (Redis, a Durable Object) to this. A no-op when nobody is subscribed.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void;\n private route;\n /**\n * Low-level route registration shared by the inline builder and `implement()`.\n * Captures the server's current `derive`/`decorate` chain into the route — this\n * is the \"compiled\", order-scoped per-route chain.\n */\n register(method: Method, path: string, schema: RouteSchema | undefined, handler: (context: never) => unknown): void;\n /**\n * Enumerate the registered routes (method, path, input schemas), in registration\n * order. Powers `toOpenAPI` and other introspection; the router trie itself no\n * longer holds the original patterns.\n */\n routes(): ReadonlyArray<RouteDescriptor>;\n /**\n * Resolve a `Request` to a `Response` — the whole lifecycle, testable without a port. The\n * optional `platform` carries edge inputs (`env`, `waitUntil`); edge adapters pass it, and\n * Bun/Node/Deno omit it (then `c.env` is `undefined` and `c.waitUntil` runs fire-and-forget).\n */\n fetch(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<Response>;\n private fetchSource;\n /**\n * Like {@link fetch}, but renders a plain-data result **without** building a Web `Response` — the\n * `@nifrajs/node` adapter serializes the returned primitives straight to the socket, skipping the undici\n * `Response` build + body drain (the bulk of the Node bridge cost, measured ≈4µs/req). A handler that\n * returns a `Response`, an error/short-circuit, or any registered `onResponse` hook falls back to the\n * full Web path (`{ kind: \"response\" }`), so behavior is identical — only the common JSON-data case is\n * faster. Same lifecycle as {@link fetch} (body cap, validation, hooks all run); only the final\n * render differs.\n */\n resolveNode(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<NodeServeOutcome>;\n resolveNodeSource(source: RequestSource, platform?: Platform<EnvOf<Ctx>>): MaybePromise<NodeServeOutcome>;\n /**\n * Resolve a WebSocket upgrade — the seam every serving adapter uses. Returns `pass` (not a WS\n * upgrade for a registered route → handle as normal HTTP), `reject` (a WS route matched but\n * `upgrade()` rejected, or the path was malformed → return `response`), or `upgrade` (perform the\n * runtime upgrade, then dispatch the native socket's events to `handler`, seeding `ws.data` with\n * `data`). Runs the route's `upgrade(c)` guard in a real request context. Synchronous unless\n * `upgrade()` is async; a throw rejects with a flat 500 (no detail leaked).\n */\n resolveWebSocketUpgrade(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<WebSocketUpgradeOutcome>;\n /** Bun `fetch` when WS routes exist: try a WS upgrade first, else run the normal HTTP lifecycle.\n * `undefined` ⇒ Bun owns the upgraded socket; a `Response` ⇒ a normal reply or a rejected upgrade.\n * (The socket dispatch itself lives in `ws-bun.ts`, loaded via `@nifrajs/core/ws`.) */\n private bunFetchWithWebSocket;\n /**\n * The shared lifecycle, generic over how the final value is rendered: `finalize` turns a handler's\n * result + `set` into the output `T` (`toResponse` → a Web `Response`; `toNodeOutcome` → node-direct\n * primitives), `wrapResponse` lifts an early/error `Response` into that same `T`, and `onTimeout`\n * produces the 503. The Web `fetch` and `resolveNode` are thin callers over this one routing +\n * context + lifecycle implementation — no duplication across the trust boundary.\n */\n private dispatch;\n /**\n * onRequest short-circuit path. Synchronous as long as every hook returns synchronously (the\n * common case — e.g. CORS returning `undefined` for a non-preflight request): an `async` version\n * here put EVERY request of any app with one onRequest hook onto the promise machinery, profiled\n * at ~13% of a realistic request. The first hook that returns a Promise hands the REMAINING\n * hooks to the async continuation; behavior is identical.\n */\n private runWithOnRequest;\n /** Async tail of {@link runWithOnRequest}: applies the first awaited hook's outcome, then runs\n * the remaining hooks (awaiting freely — we're already async here). */\n private continueOnRequest;\n private takeResponseRequest;\n /**\n * Route → build context → run. Synchronous through to the handler for a **bare** route\n * ({@link RouteEntry.bare}), so a sync handler produces its result with zero promise allocations;\n * routes with validation/hooks keep the full async {@link runLifecycle}, unchanged.\n */\n private routeAndRun;\n /** The narrowest bare route: a syntactic `() => ...` handler cannot observe the context argument, so\n * successful requests can skip allocating `RequestContext`. Errors still allocate one for logging. */\n private runContextlessBare;\n private contextlessBareError;\n /**\n * The synchronous fast path for a {@link RouteEntry.bare} route: apply static decorations, call the\n * handler, render the result — **no `await`** unless the handler itself returns a promise. It mirrors\n * the bare slice of {@link runLifecycle} (which a bare route would otherwise no-op through) and shares\n * {@link logRequestError}; a bare route has no `onError` hooks, so error handling is fully synchronous\n * (a thrown `Response` is control flow; anything else is a logged flat 500). This is where nifra skips\n * the per-request async-frame tax — the same win codegen routers get, but without `eval`.\n */\n private runBare;\n /** Bare-route error rendering — identical to {@link runLifecycle}'s catch minus the (absent) onError\n * loop: a thrown `Response` is returned as deliberate control flow; anything else is logged + 500. */\n /**\n * Build a route's fused Web lane (see {@link RouteEntry.fusedWeb}). Composition happens once at\n * registration; the returned closure is what every request to the route runs. Behavior is\n * byte-identical to the generic `runBare`/`runContextlessBare` + `toResponse` pair — same\n * decoration order, same error routing (thrown `Response` = control flow; anything else logs and\n * 500s), same respond semantics (the lifecycle parity suite pins it).\n */\n private buildFusedWeb;\n private bareError;\n private runWithAround;\n private runAround;\n private runBodyOnly;\n /** Validate + run the handler for the bodyOnly path — shared by the inline fast path and the\n * streaming fallback. A method (not per-request closures) so the hot path allocates nothing\n * beyond the one `.then` continuation. */\n private finishBodyOnly;\n private executeHandler;\n private handleValidationErrorRecovery;\n private applyBodyValidation;\n private runQueryOnly;\n /** Validate-result → set `ctx.query` → run handler. A method (not a per-request closure), the\n * query analogue of {@link applyBodyValidation}. */\n private applyQueryValidation;\n /**\n * Thread the response through each global `onResponse` hook. Stays SYNCHRONOUS until a hook\n * actually returns a Promise — an `async` version forced a promise + microtask on EVERY response\n * of any app with an onResponse hook (cors/securityHeaders/etag/timing all use onResponse), the\n * same ~13%/req tax the onRequest walk was de-async'd to avoid. The first async hook hands the\n * rest to {@link continueOnResponse}.\n */\n private applyOnResponse;\n /** Async tail of {@link applyOnResponse}: runs the remaining hooks once one has gone async. */\n private continueOnResponse;\n /**\n * Bound the response time. On timeout we abort `ctx.signal` (so cancellation-aware\n * handlers can bail) and return 503; the in-flight work keeps running but its\n * result is discarded — JS can't forcibly cancel a promise.\n */\n private withTimeout;\n /**\n * The post-match lifecycle: validate → derive → beforeHandle → handler → afterHandle, with onError.\n * Generic over the render: a success value goes through `finalize(result, set)` (a Web `Response`, or\n * node-direct primitives); an early/error `Response` (validation, thrown, 500) through `wrapResponse`.\n */\n private runLifecycle;\n private handleLifecycleError;\n /** Log an unhandled request error to the (redacting) logger — shared by {@link runLifecycle} and the\n * bare fast path ({@link bareError}) so both record the same fields. Never throws; never leaks. */\n private logRequestError;\n private readAndValidateBody;\n /**\n * Read the body as text, capped at `maxBodyBytes`. Rejects (`null`) on a\n * `Content-Length` over the cap *before* buffering, and aborts mid-stream once the\n * running byte count exceeds it — so a lying or absent length can't force us to\n * buffer an oversized payload.\n *\n * Fast path: when a non-chunked request carries a `Content-Length` within the cap,\n * a native `req.json()` is already bounded — under HTTP/1.1 + HTTP/2 framing the\n * runtime delivers at most `Content-Length` bytes — so we skip the manual stream\n * loop and a separate text decode. It trusts the wire\n * *framing*, not the header value: nifra only ever receives framed Requests from the\n * runtime's HTTP server, never a hand-built one with a mismatched length. Chunked or\n * length-less bodies fall through to the streaming byte-cap guard below.\n */\n private readBoundedJson;\n /**\n * Start a `Bun.serve` instance bound to `port` (use `0` for an ephemeral port).\n *\n * `reusePort` sets `SO_REUSEPORT` so **multiple processes can bind the same port** and the kernel\n * load-balances connections across them — the standard way to use every core (Bun is\n * single-threaded per process). Spawn one process per core, each calling\n * `app.listen(PORT, { reusePort: true })`; see `examples/cluster.ts`. Every process must opt in,\n * and all of them must be the same app. Linux balances ~evenly; macOS accepts the flag but may\n * favor one socket (fine for dev, measure on Linux for production numbers).\n */\n listen(port: number, options?: {\n readonly reusePort?: boolean;\n }): RunningServer;\n /**\n * Gracefully stop: wait for in-flight requests to finish (up to `drainMs`), then\n * issue a single terminal stop — graceful if everything drained, forced if\n * stragglers remain. Safe to call when not listening.\n *\n * The Bun semantics: poll `pendingRequests` (awaiting\n * `stop()`'s promise drops in-flight requests), and decide graceful-vs-forced in\n * ONE call (Bun can't escalate an already-graceful `stop()` to a forced close).\n * New connections may be accepted during the drain window; in a real deploy the\n * load balancer has already stopped routing here, and `drainMs` bounds it.\n */\n stop({ drainMs }?: {\n drainMs?: number;\n }): Promise<void>;\n private installSignalHandlers;\n}",
|
|
5927
|
+
"signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext> {\n private readonly router;\n /** WebSocket routes, matched separately at upgrade time (a GET + `Upgrade: websocket`). */\n private readonly wsRouter;\n private wsRouteCount;\n /** In-process pub/sub backing `ws.subscribe(topic)` + `app.publish(topic, data)` (single-instance).\n * Created by the first `app.ws()` via the `@nifrajs/core/ws` runtime — `undefined` until then, so a\n * no-WebSocket app never constructs (or bundles) it. */\n private topics;\n private readonly routeList;\n private readonly maxBodyBytes;\n private readonly wsMaxPayloadBytes;\n private readonly requestTimeoutMs;\n private readonly gracefulSignals;\n private readonly logger;\n /** App-wide validation-error fallback; a route's own `schema.onValidationError` takes precedence. */\n private readonly defaultOnValidationError?;\n private bunServer;\n private readonly derives;\n private readonly decorations;\n private readonly beforeHandleHooks;\n private readonly afterHandleHooks;\n private readonly onErrorHooks;\n private readonly aroundHooks;\n private readonly onRequestHooks;\n private readonly onResponseHooks;\n private readonly onResponseFinalizedHooks;\n private readonly responseRequests;\n /** Names of plugins/middleware already applied via `use` — for idempotent dedupe. */\n private readonly appliedPlugins;\n /** App-declared MCP resources / prompts (via {@link resource} / {@link prompt}), read by `nifra mcp`. */\n private readonly mcpResourceList;\n private readonly mcpPromptList;\n constructor(options?: ServerOptions);\n /** Add a per-request, computed context extension for subsequent routes. */\n derive<D extends object>(fn: (context: Context & Ctx) => MaybePromise<D>): Server<R, Ctx & D>;\n /** Add a static context value for subsequent routes. */\n decorate<const K extends string, V>(key: K, value: V): Server<R, Ctx & Record<K, V>>;\n /**\n * Run before routing on the raw request. Return a `Response` to short-circuit, or a replacement\n * `Request` to continue routing with a rewritten method/URL/headers. Global.\n */\n onRequest(fn: (req: Request) => MaybePromise<OnRequestResult>): this;\n /** Run after validation, before the handler; a non-`undefined` return short-circuits. Order-scoped. */\n beforeHandle(fn: (context: Context & Ctx) => MaybePromise<unknown>): this;\n /**\n * Wrap the matched route lifecycle for subsequent routes. This is intentionally generic over the\n * route output, so wrappers like async context storage do not force Node's direct JSON path through\n * a Web `Response`. The first registered wrapper is outermost.\n */\n around(fn: <T>(context: Context & Ctx, next: () => MaybePromise<T>) => MaybePromise<T>): this;\n /** Transform the handler's result before it is serialized. Order-scoped. */\n afterHandle(fn: (result: unknown, context: Context & Ctx) => MaybePromise<unknown>): this;\n /** Handle a thrown error; a non-`undefined` return becomes the response (else the default 500). Order-scoped. */\n onError(fn: (error: unknown, context: Context & Ctx) => MaybePromise<unknown>): this;\n /** Transform every outgoing response — success, error, 404, 405, short-circuit. Global. */\n onResponse(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /** Observe the terminal response after all transformations. Observers are ordered and fail-open. */\n onResponseFinalized(fn: (outcome: ResponseFinalization, req: Request) => MaybePromise<void>): this;\n /**\n * Apply a type-**identity** plugin ({@link IdentityPlugin}, from {@link defineIdentityPlugin}) — it\n * registers routes/hooks but doesn't change the types, so this returns `this` with the route registry\n * and context fully intact. This overload exists specifically so a *named* identity plugin (e.g.\n * `@nifrajs/better-auth`) threads the registry: its `& { pluginName }` intersection would otherwise\n * defeat the generic inference of the transforming overload below and collapse the result to `any`.\n */\n use(plugin: IdentityPlugin): this;\n /**\n * Apply a **plugin function** — `(app) => app`, typically built with {@link definePlugin}. It's\n * called with `this` and its result is returned, so an inline plugin's `derive`/`decorate` thread\n * the added context to handlers defined after `use` (the overload is generic over the concrete\n * `this`). A named plugin already applied is skipped (idempotent dedupe).\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): Out;\n /**\n * Apply a {@link Middleware} bundle — wire each hook it provides to its lifecycle point. Returns\n * `this` (no context-type merging); call it before the routes its `beforeHandle`/`afterHandle`\n * should cover (those are order-scoped; `onRequest`/`onResponse` are global). A named bundle already\n * applied is skipped (idempotent).\n */\n use(mw: Middleware): this;\n get<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, S, OutputOf<H>>>, Ctx>;\n get<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>>>, Ctx>;\n /**\n * Register a **typed SSE route** — a GET endpoint streaming `text/event-stream` whose event\n * payloads are contracted by `schema.sse`. The handler receives the validated context plus a\n * {@link TypedSSEStream}: `stream.send(event)` is compile-time-checked against the schema and\n * JSON-serialized into the SSE `data:` field. The typed client sees the marker and grows a\n * `.subscribe(onEvent)` for the route with the same payload type — end-to-end typed streaming.\n *\n * const app = server().sse(\"/feed\", { sse: t.object({ id: t.integer(), title: t.string() }) },\n * async (c, stream) => {\n * stream.send({ id: 1, title: \"hello\" }) // typed\n * await waitForDisconnect(stream.signal)\n * },\n * { keepAlive: 15_000 })\n *\n * // client: const off = api.feed.subscribe((post) => console.log(post.title))\n *\n * `init` passes through to the underlying {@link sse} helper (`keepAlive`, extra headers). The\n * connection closes when the handler resolves, `stream.close()` runs, or the client disconnects\n * (`stream.signal`). Query/body schemas validate exactly as on any other route.\n */\n sse<Path extends string, S extends RouteSchema & {\n sse: StandardSchemaV1;\n }>(path: Path, schema: S, run: (context: Context<Path, S> & Ctx, stream: TypedSSEStream<InferOutput<S[\"sse\"]>>) => void | Promise<void>, init?: SSEInit): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, S, Response>>, Ctx>;\n post<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, S, OutputOf<H>>>, Ctx>;\n post<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>>>, Ctx>;\n put<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, S, OutputOf<H>>>, Ctx>;\n put<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>>>, Ctx>;\n patch<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, S, OutputOf<H>>>, Ctx>;\n patch<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>>>, Ctx>;\n delete<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, S, OutputOf<H>>>, Ctx>;\n delete<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>>>, Ctx>;\n tool<Name extends string, S extends {\n description: string;\n input: StandardSchemaV1;\n output?: StandardSchemaV1;\n annotations?: ToolAnnotations;\n }, H extends (input: InferOutput<S[\"input\"]>, ctx: Context & Ctx) => MaybePromise<S[\"output\"] extends StandardSchemaV1 ? InferOutput<S[\"output\"]> : unknown>>(name: Name, config: S, handler: H): Server<AddRoute<R, \"POST\", `/_nifra/tool/${Name}`, RouteInfoFor<`/_nifra/tool/${Name}`, S[\"output\"] extends StandardSchemaV1 ? {\n body: S[\"input\"];\n response: S[\"output\"];\n } : {\n body: S[\"input\"];\n }, OutputOf<H>>>, Ctx>;\n /**\n * Declare an MCP **resource** — read-only data an agent can fetch through `nifra mcp` (app config, a\n * generated document, …). `read` runs in the app process, so capture whatever app state it needs in the\n * closure. `uri` is the MCP resource identifier (e.g. `\"myapp://config\"`). The sibling of {@link tool}\n * for the resource half of MCP.\n */\n resource(uri: string, config: {\n readonly name: string;\n readonly description?: string;\n readonly mimeType?: string;\n }, read: McpResourceDescriptor[\"read\"]): Server<R, Ctx>;\n /**\n * Declare an MCP **prompt** — a reusable prompt template an agent can fetch through `nifra mcp`.\n * `handler` receives the caller's arguments and returns the rendered messages.\n */\n prompt(name: string, config: {\n readonly description: string;\n readonly arguments?: readonly PromptArgument[];\n }, handler: McpPromptDescriptor[\"handler\"]): Server<R, Ctx>;\n /** The MCP resources declared via {@link resource} — enumerated by `nifra mcp`. */\n mcpResources(): readonly McpResourceDescriptor[];\n /** The MCP prompts declared via {@link prompt} — enumerated by `nifra mcp`. */\n mcpPrompts(): readonly McpPromptDescriptor[];\n /**\n * Register a **WebSocket** route. The connection upgrades on a `GET` to `path` carrying\n * `Upgrade: websocket`; the optional `handler.upgrade(c)` runs in the request context first and may\n * reject (return a `Response`) or seed per-connection `ws.data`. WebSockets are served by the\n * adapter (`listen()`, `@nifrajs/node`, `@nifrajs/deno`, `toFetchHandler`) — not by bare `app.fetch`, which\n * has no socket (a WS path through `app.fetch` is a normal HTTP response).\n *\n * app.ws(\"/chat\", { open: (ws) => ws.send(\"hi\"), message: (ws, data) => ws.send(data) })\n */\n ws<Data = unknown, Schema extends StandardSchemaV1 | undefined = undefined>(path: string, handler: WebSocketHandler<Data, EnvOf<Ctx>, Schema>): this;\n /**\n * Broadcast `data` to every WebSocket connection subscribed to `topic` (via `ws.subscribe(topic)`).\n * In-process and **single-instance** (see {@link TopicRegistry}) — a multi-instance deploy must bridge\n * an external fan-out (Redis, a Durable Object) to this. A no-op when nobody is subscribed.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void;\n private route;\n /**\n * Low-level route registration shared by the inline builder and `implement()`.\n * Captures the server's current `derive`/`decorate` chain into the route — this\n * is the \"compiled\", order-scoped per-route chain.\n */\n register(method: Method, path: string, schema: RouteSchema | undefined, handler: (context: never) => unknown): void;\n /**\n * Enumerate the registered routes (method, path, input schemas), in registration\n * order. Powers `toOpenAPI` and other introspection; the router trie itself no\n * longer holds the original patterns.\n */\n routes(): ReadonlyArray<RouteDescriptor>;\n /**\n * Resolve a `Request` to a `Response` — the whole lifecycle, testable without a port. The\n * optional `platform` carries edge inputs (`env`, `waitUntil`); edge adapters pass it, and\n * Bun/Node/Deno omit it (then `c.env` is `undefined` and `c.waitUntil` runs fire-and-forget).\n */\n fetch(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<Response>;\n private fetchSource;\n /**\n * Like {@link fetch}, but renders a plain-data result **without** building a Web `Response` — the\n * `@nifrajs/node` adapter serializes the returned primitives straight to the socket, skipping the undici\n * `Response` build + body drain (the bulk of the Node bridge cost, measured ≈4µs/req). A handler that\n * returns a `Response`, an error/short-circuit, or any registered `onResponse` hook falls back to the\n * full Web path (`{ kind: \"response\" }`), so behavior is identical — only the common JSON-data case is\n * faster. Same lifecycle as {@link fetch} (body cap, validation, hooks all run); only the final\n * render differs.\n */\n resolveNode(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<NodeServeOutcome>;\n resolveNodeSource(source: RequestSource, platform?: Platform<EnvOf<Ctx>>): MaybePromise<NodeServeOutcome>;\n /**\n * Resolve a WebSocket upgrade — the seam every serving adapter uses. Returns `pass` (not a WS\n * upgrade for a registered route → handle as normal HTTP), `reject` (a WS route matched but\n * `upgrade()` rejected, or the path was malformed → return `response`), or `upgrade` (perform the\n * runtime upgrade, then dispatch the native socket's events to `handler`, seeding `ws.data` with\n * `data`). Runs the route's `upgrade(c)` guard in a real request context. Synchronous unless\n * `upgrade()` is async; a throw rejects with a flat 500 (no detail leaked).\n */\n resolveWebSocketUpgrade(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<WebSocketUpgradeOutcome>;\n /** Bun `fetch` when WS routes exist: try a WS upgrade first, else run the normal HTTP lifecycle.\n * `undefined` ⇒ Bun owns the upgraded socket; a `Response` ⇒ a normal reply or a rejected upgrade.\n * (The socket dispatch itself lives in `ws-bun.ts`, loaded via `@nifrajs/core/ws`.) */\n private bunFetchWithWebSocket;\n /**\n * The shared lifecycle, generic over how the final value is rendered: `finalize` turns a handler's\n * result + `set` into the output `T` (`toResponse` → a Web `Response`; `toNodeOutcome` → node-direct\n * primitives), `wrapResponse` lifts an early/error `Response` into that same `T`, and `onTimeout`\n * produces the 503. The Web `fetch` and `resolveNode` are thin callers over this one routing +\n * context + lifecycle implementation — no duplication across the trust boundary.\n */\n private dispatch;\n /**\n * onRequest short-circuit path. Synchronous as long as every hook returns synchronously (the\n * common case — e.g. CORS returning `undefined` for a non-preflight request): an `async` version\n * here put EVERY request of any app with one onRequest hook onto the promise machinery, profiled\n * at ~13% of a realistic request. The first hook that returns a Promise hands the REMAINING\n * hooks to the async continuation; behavior is identical.\n */\n private runWithOnRequest;\n /** Async tail of {@link runWithOnRequest}: applies the first awaited hook's outcome, then runs\n * the remaining hooks (awaiting freely — we're already async here). */\n private continueOnRequest;\n private takeResponseRequest;\n /**\n * Route → build context → run. Synchronous through to the handler for a **bare** route\n * ({@link RouteEntry.bare}), so a sync handler produces its result with zero promise allocations;\n * routes with validation/hooks keep the full async {@link runLifecycle}, unchanged.\n */\n private routeAndRun;\n /** The narrowest bare route: a syntactic `() => ...` handler cannot observe the context argument, so\n * successful requests can skip allocating `RequestContext`. Errors still allocate one for logging. */\n private runContextlessBare;\n private contextlessBareError;\n /**\n * The synchronous fast path for a {@link RouteEntry.bare} route: apply static decorations, call the\n * handler, render the result — **no `await`** unless the handler itself returns a promise. It mirrors\n * the bare slice of {@link runLifecycle} (which a bare route would otherwise no-op through) and shares\n * {@link logRequestError}; a bare route has no `onError` hooks, so error handling is fully synchronous\n * (a thrown `Response` is control flow; anything else is a logged flat 500). This is where nifra skips\n * the per-request async-frame tax — the same win codegen routers get, but without `eval`.\n */\n private runBare;\n /** Bare-route error rendering — identical to {@link runLifecycle}'s catch minus the (absent) onError\n * loop: a thrown `Response` is returned as deliberate control flow; anything else is logged + 500. */\n /**\n * Build a route's fused Web lane (see {@link RouteEntry.fusedWeb}). Composition happens once at\n * registration; the returned closure is what every request to the route runs. Behavior is\n * byte-identical to the generic `runBare`/`runContextlessBare` + `toResponse` pair — same\n * decoration order, same error routing (thrown `Response` = control flow; anything else logs and\n * 500s), same respond semantics (the lifecycle parity suite pins it).\n */\n private buildFusedWeb;\n private bareError;\n private runWithAround;\n private runAround;\n private runBodyOnly;\n /** Validate + run the handler for the bodyOnly path — shared by the inline fast path and the\n * streaming fallback. A method (not per-request closures) so the hot path allocates nothing\n * beyond the one `.then` continuation. */\n private finishBodyOnly;\n private executeHandler;\n private handleValidationErrorRecovery;\n private applyBodyValidation;\n private runQueryOnly;\n /** Validate-result → set `ctx.query` → run handler. A method (not a per-request closure), the\n * query analogue of {@link applyBodyValidation}. */\n private applyQueryValidation;\n /**\n * Thread the response through each global `onResponse` hook. Stays SYNCHRONOUS until a hook\n * actually returns a Promise — an `async` version forced a promise + microtask on EVERY response\n * of any app with an onResponse hook (cors/securityHeaders/etag/timing all use onResponse), the\n * same ~13%/req tax the onRequest walk was de-async'd to avoid. The first async hook hands the\n * rest to {@link continueOnResponse}.\n */\n private applyOnResponse;\n private applyOnResponseAndFinalize;\n private completeResponseFinalization;\n private failResponseFinalization;\n /** Notify terminal observers in order while isolating both sync and async failures. */\n private notifyResponseFinalized;\n /** Async tail of {@link applyOnResponse}: runs the remaining hooks once one has gone async. */\n private continueOnResponse;\n /**\n * Bound the response time. On timeout we abort `ctx.signal` (so cancellation-aware\n * handlers can bail) and return 503; the in-flight work keeps running but its\n * result is discarded — JS can't forcibly cancel a promise.\n */\n private withTimeout;\n /**\n * The post-match lifecycle: validate → derive → beforeHandle → handler → afterHandle, with onError.\n * Generic over the render: a success value goes through `finalize(result, set)` (a Web `Response`, or\n * node-direct primitives); an early/error `Response` (validation, thrown, 500) through `wrapResponse`.\n */\n private runLifecycle;\n private handleLifecycleError;\n /** Log an unhandled request error to the (redacting) logger — shared by {@link runLifecycle} and the\n * bare fast path ({@link bareError}) so both record the same fields. Never throws; never leaks. */\n private logRequestError;\n private readAndValidateBody;\n /**\n * Read the body as text, capped at `maxBodyBytes`. Rejects (`null`) on a\n * `Content-Length` over the cap *before* buffering, and aborts mid-stream once the\n * running byte count exceeds it — so a lying or absent length can't force us to\n * buffer an oversized payload.\n *\n * Fast path: when a non-chunked request carries a `Content-Length` within the cap,\n * a native `req.json()` is already bounded — under HTTP/1.1 + HTTP/2 framing the\n * runtime delivers at most `Content-Length` bytes — so we skip the manual stream\n * loop and a separate text decode. It trusts the wire\n * *framing*, not the header value: nifra only ever receives framed Requests from the\n * runtime's HTTP server, never a hand-built one with a mismatched length. Chunked or\n * length-less bodies fall through to the streaming byte-cap guard below.\n */\n private readBoundedJson;\n /**\n * Start a `Bun.serve` instance bound to `port` (use `0` for an ephemeral port).\n *\n * `reusePort` sets `SO_REUSEPORT` so **multiple processes can bind the same port** and the kernel\n * load-balances connections across them — the standard way to use every core (Bun is\n * single-threaded per process). Spawn one process per core, each calling\n * `app.listen(PORT, { reusePort: true })`; see `examples/cluster.ts`. Every process must opt in,\n * and all of them must be the same app. Linux balances ~evenly; macOS accepts the flag but may\n * favor one socket (fine for dev, measure on Linux for production numbers).\n */\n listen(port: number, options?: {\n readonly reusePort?: boolean;\n }): RunningServer;\n /**\n * Gracefully stop: wait for in-flight requests to finish (up to `drainMs`), then\n * issue a single terminal stop — graceful if everything drained, forced if\n * stragglers remain. Safe to call when not listening.\n *\n * The Bun semantics: poll `pendingRequests` (awaiting\n * `stop()`'s promise drops in-flight requests), and decide graceful-vs-forced in\n * ONE call (Bun can't escalate an already-graceful `stop()` to a forced close).\n * New connections may be accepted during the drain window; in a real deploy the\n * load balancer has already stopped routing here, and `drainMs` bounds it.\n */\n stop({ drainMs }?: {\n drainMs?: number;\n }): Promise<void>;\n private installSignalHandlers;\n}",
|
|
5490
5928
|
"doc": "/**\n * The inline server. Routes are chainable and fully type-inferred. `derive`/\n * `decorate` extend the handler context (`Ctx`) for routes defined *after* them,\n * with full types; `Ctx` is server-only and never touches the client registry.\n *\n * app.decorate(\"db\", db).derive((c) => ({ user: auth(c) }))\n * .get(\"/me\", (c) => c.user) // c.user + c.db are typed\n */"
|
|
5491
5929
|
},
|
|
5492
5930
|
{
|
|
@@ -5773,6 +6211,20 @@
|
|
|
5773
6211
|
"signature": "export interface SizeReport {\n /** Per-chunk sizes, sorted biggest gzip first (the regression you want to see at the top). */\n readonly chunks: readonly ChunkSize[];\n /** Sum of every chunk's raw bytes. */\n readonly totalBytes: number;\n /** Sum of every chunk's gzip bytes. */\n readonly totalGzip: number;\n}",
|
|
5774
6212
|
"doc": "/** A whole build's size report — every chunk (largest first) + the totals. */"
|
|
5775
6213
|
},
|
|
6214
|
+
{
|
|
6215
|
+
"name": "SnapshotFile",
|
|
6216
|
+
"kind": "interface",
|
|
6217
|
+
"package": "@nifrajs/cli",
|
|
6218
|
+
"signature": "export interface SnapshotFile {\n readonly nifraSnapshot: 1;\n readonly routes: readonly RouteSnapshot[];\n}",
|
|
6219
|
+
"doc": "/** Snapshot file envelope — versioned so a future format change can migrate instead of misparse. */"
|
|
6220
|
+
},
|
|
6221
|
+
{
|
|
6222
|
+
"name": "snapshotRoutes",
|
|
6223
|
+
"kind": "function",
|
|
6224
|
+
"package": "@nifrajs/core",
|
|
6225
|
+
"signature": "export declare function snapshotRoutes(source: unknown): readonly RouteSnapshot[];",
|
|
6226
|
+
"doc": "/**\n * Snapshot an app's routes (anything `reflectRoutes` accepts) as plain JSON. Validators are\n * dropped; only introspectable JSON Schema metadata is kept, so the result round-trips through\n * `JSON.stringify` unchanged.\n */"
|
|
6227
|
+
},
|
|
5776
6228
|
{
|
|
5777
6229
|
"name": "solidAdapter",
|
|
5778
6230
|
"kind": "const",
|
|
@@ -5803,17 +6255,17 @@
|
|
|
5803
6255
|
},
|
|
5804
6256
|
{
|
|
5805
6257
|
"name": "SpanExporter",
|
|
5806
|
-
"kind": "
|
|
6258
|
+
"kind": "type",
|
|
5807
6259
|
"package": "@nifrajs/otel",
|
|
5808
|
-
"signature": "export
|
|
5809
|
-
"doc": "
|
|
6260
|
+
"signature": "export type SpanExporter = ObservationAdapter;",
|
|
6261
|
+
"doc": "/** Backwards-compatible name for an observation sink. */"
|
|
5810
6262
|
},
|
|
5811
6263
|
{
|
|
5812
6264
|
"name": "SpanStatus",
|
|
5813
6265
|
"kind": "type",
|
|
5814
6266
|
"package": "@nifrajs/otel",
|
|
5815
6267
|
"signature": "export type SpanStatus = \"unset\" | \"ok\" | \"error\";",
|
|
5816
|
-
"doc": "/**\n * The span model + exporter seam. Attribute names follow OpenTelemetry HTTP semantic conventions\n * (`http.request.method`, `url.path`, `http.response.status_code`, …) so a span maps cleanly onto an\n * OTel `Span` when bridged — but nothing here depends on the OTel SDK. You supply
|
|
6268
|
+
"doc": "/**\n * The span model + exporter seam. Attribute names follow OpenTelemetry HTTP semantic conventions\n * (`http.request.method`, `url.path`, `http.response.status_code`, …) so a span maps cleanly onto an\n * OTel `Span` when bridged — but nothing here depends on the OTel SDK. You supply an\n * {@link ObservationAdapter}\n * (a ~10-line adapter to `@opentelemetry/api`, or the bundled {@link consoleSpanExporter}).\n */"
|
|
5817
6269
|
},
|
|
5818
6270
|
{
|
|
5819
6271
|
"name": "splitSections",
|
|
@@ -5822,6 +6274,13 @@
|
|
|
5822
6274
|
"signature": "export declare function splitSections(markdown: string): DocSection[];",
|
|
5823
6275
|
"doc": "/** Split the generated doc into its `##` sections (the `# title` intro becomes \"Overview\"). */"
|
|
5824
6276
|
},
|
|
6277
|
+
{
|
|
6278
|
+
"name": "SqliteDatabaseLike",
|
|
6279
|
+
"kind": "interface",
|
|
6280
|
+
"package": "@nifrajs/mcp-db",
|
|
6281
|
+
"signature": "export interface SqliteDatabaseLike {\n /** Prepare a statement; `all` runs it and returns row objects. */\n prepare(sql: string): {\n all(...params: unknown[]): unknown[];\n };\n /** Execute a statement for its side effect (used only for `PRAGMA query_only`). */\n run(sql: string): unknown;\n}",
|
|
6282
|
+
"doc": "/** The structural slice of `bun:sqlite`'s `Database` this package needs. */"
|
|
6283
|
+
},
|
|
5825
6284
|
{
|
|
5826
6285
|
"name": "sse",
|
|
5827
6286
|
"kind": "function",
|
|
@@ -5944,6 +6403,12 @@
|
|
|
5944
6403
|
"signature": "export interface StandardWebSocket {\n send(data: string | ArrayBufferView | ArrayBuffer): void;\n close(code?: number, reason?: string): void;\n readonly readyState: number;\n binaryType?: string;\n addEventListener(type: string, listener: (event: never) => void): void;\n}",
|
|
5945
6404
|
"doc": "/**\n * A standard server-side `WebSocket` — the half returned by Deno's `Deno.upgradeWebSocket` and the\n * Workers `WebSocketPair`. {@link attachWebSocket} wires one to a nifra handler, so the Deno and Workers\n * bridges share all the dispatch/normalization/error-isolation logic (only the upgrade call differs).\n */"
|
|
5946
6405
|
},
|
|
6406
|
+
{
|
|
6407
|
+
"name": "StartObservation",
|
|
6408
|
+
"kind": "interface",
|
|
6409
|
+
"package": "@nifrajs/otel",
|
|
6410
|
+
"signature": "export interface StartObservation {\n readonly name: string;\n /** Explicit parent. `null` forces a root span; `undefined` falls back to `traceparent`. */\n readonly parent?: ObservationParent | null;\n /** Inbound W3C header used when `parent` is undefined. */\n readonly traceparent?: string | null;\n readonly attributes?: Readonly<Record<string, AttributeValue>>;\n}"
|
|
6411
|
+
},
|
|
5947
6412
|
{
|
|
5948
6413
|
"name": "StaticPath",
|
|
5949
6414
|
"kind": "interface",
|
|
@@ -5978,6 +6443,20 @@
|
|
|
5978
6443
|
"signature": "export interface StorageAdapter {\n /** Store `data` under `key`, overwriting any existing object. */\n put(key: string, data: StorageData, options?: PutOptions): Promise<void>;\n /** Read the object at `key`, or `null` if it doesn't exist. */\n get(key: string): Promise<StorageObject | null>;\n /** Remove `key`. No-op if it doesn't exist. */\n delete(key: string): Promise<void>;\n /** Whether an object exists at `key`. */\n exists(key: string): Promise<boolean>;\n /** List stored keys (optionally filtered by prefix + capped). */\n list(options?: ListOptions): Promise<string[]>;\n}",
|
|
5979
6444
|
"doc": "/**\n * A blob store keyed by string. Keys are POSIX-ish paths (`avatars/u1.png`); every adapter rejects unsafe\n * keys (absolute, `..` traversal, NUL, backslash) so a key valid in one adapter is valid in all. All\n * methods are async.\n */"
|
|
5980
6445
|
},
|
|
6446
|
+
{
|
|
6447
|
+
"name": "StorageAdapterConformanceError",
|
|
6448
|
+
"kind": "class",
|
|
6449
|
+
"package": "@nifrajs/storage",
|
|
6450
|
+
"signature": "export declare class StorageAdapterConformanceError extends Error {\n readonly check: string;\n constructor(check: string, message: string, cause?: unknown);\n}",
|
|
6451
|
+
"doc": "/** A failed invariant reported by {@link assertStorageAdapterConformance}. */"
|
|
6452
|
+
},
|
|
6453
|
+
{
|
|
6454
|
+
"name": "StorageAdapterConformanceOptions",
|
|
6455
|
+
"kind": "interface",
|
|
6456
|
+
"package": "@nifrajs/storage",
|
|
6457
|
+
"signature": "export interface StorageAdapterConformanceOptions {\n /** Return an empty, isolated adapter for this run. */\n readonly createAdapter: () => StorageAdapter | Promise<StorageAdapter>;\n}",
|
|
6458
|
+
"doc": "/** Construction and cleanup hooks for {@link assertStorageAdapterConformance}. */"
|
|
6459
|
+
},
|
|
5981
6460
|
{
|
|
5982
6461
|
"name": "StorageData",
|
|
5983
6462
|
"kind": "type",
|
|
@@ -5989,9 +6468,23 @@
|
|
|
5989
6468
|
"name": "StorageKeyError",
|
|
5990
6469
|
"kind": "class",
|
|
5991
6470
|
"package": "@nifrajs/storage",
|
|
5992
|
-
"signature": "export declare class StorageKeyError extends Error {\n
|
|
6471
|
+
"signature": "export declare class StorageKeyError extends Error {\n constructor(message: string);\n}",
|
|
5993
6472
|
"doc": "/**\n * Storage-key safety. A key is a POSIX-ish relative path (`avatars/u1.png`); we reject anything that\n * could escape a `FileStorage` root or otherwise misbehave — absolute paths, `..` traversal, NUL bytes,\n * and backslashes (Windows traversal). Enforced by EVERY adapter (not just `FileStorage`) so a key is\n * portable across them, and so the check can't be forgotten on the one adapter where it's a vulnerability.\n */"
|
|
5994
6473
|
},
|
|
6474
|
+
{
|
|
6475
|
+
"name": "StorageListPage",
|
|
6476
|
+
"kind": "interface",
|
|
6477
|
+
"package": "@nifrajs/storage",
|
|
6478
|
+
"signature": "export interface StorageListPage {\n readonly keys: readonly string[];\n /** Opaque cursor for the next page; absent when this is the final page. */\n readonly cursor?: string;\n}",
|
|
6479
|
+
"doc": "/** One page of keys from stores that expose cursor-based listing. */"
|
|
6480
|
+
},
|
|
6481
|
+
{
|
|
6482
|
+
"name": "StorageListPageOptions",
|
|
6483
|
+
"kind": "interface",
|
|
6484
|
+
"package": "@nifrajs/storage",
|
|
6485
|
+
"signature": "export interface StorageListPageOptions extends ListOptions {\n readonly cursor?: string;\n}",
|
|
6486
|
+
"doc": "/** Cursor-aware listing options. `cursor` is adapter-owned and must be treated as opaque. */"
|
|
6487
|
+
},
|
|
5995
6488
|
{
|
|
5996
6489
|
"name": "StorageObject",
|
|
5997
6490
|
"kind": "interface",
|
|
@@ -5999,6 +6492,27 @@
|
|
|
5999
6492
|
"signature": "export interface StorageObject {\n readonly body: Uint8Array;\n readonly size: number;\n readonly contentType?: string;\n readonly metadata?: Readonly<Record<string, string>>;\n}",
|
|
6000
6493
|
"doc": "/** An object read back from storage. `body` is buffered (not streamed) — fine for typical uploads. */"
|
|
6001
6494
|
},
|
|
6495
|
+
{
|
|
6496
|
+
"name": "StoragePresignedUrl",
|
|
6497
|
+
"kind": "interface",
|
|
6498
|
+
"package": "@nifrajs/storage",
|
|
6499
|
+
"signature": "export interface StoragePresignedUrl {\n readonly url: string;\n readonly expiresAt?: Date;\n}",
|
|
6500
|
+
"doc": "/** A provider-minted URL and its known expiry. */"
|
|
6501
|
+
},
|
|
6502
|
+
{
|
|
6503
|
+
"name": "StoragePresignOperation",
|
|
6504
|
+
"kind": "type",
|
|
6505
|
+
"package": "@nifrajs/storage",
|
|
6506
|
+
"signature": "export type StoragePresignOperation = \"get\" | \"put\";",
|
|
6507
|
+
"doc": "/** Operation represented by a presigned storage URL. */"
|
|
6508
|
+
},
|
|
6509
|
+
{
|
|
6510
|
+
"name": "StoragePresignOptions",
|
|
6511
|
+
"kind": "interface",
|
|
6512
|
+
"package": "@nifrajs/storage",
|
|
6513
|
+
"signature": "export interface StoragePresignOptions {\n readonly expiresInSeconds?: number;\n /** For PUT URLs, pin the declared MIME type. */\n readonly contentType?: string;\n /** For PUT URLs, pin the exact request-body size. */\n readonly contentLength?: number;\n}",
|
|
6514
|
+
"doc": "/** Mechanical constraints applied while minting a presigned URL. */"
|
|
6515
|
+
},
|
|
6002
6516
|
{
|
|
6003
6517
|
"name": "StoredEntry",
|
|
6004
6518
|
"kind": "interface",
|
|
@@ -6061,6 +6575,18 @@
|
|
|
6061
6575
|
"signature": "export interface SubmitOptions {\n /** Re-run the active route's loader after the action settles (default `true`). Set `false` to\n * keep the current `data` and rely on the action's `actionData` alone. */\n readonly revalidate?: boolean;\n}",
|
|
6062
6576
|
"doc": "/** Per-submit options. `revalidate: false` opts out of the post-action loader re-fetch. */"
|
|
6063
6577
|
},
|
|
6578
|
+
{
|
|
6579
|
+
"name": "SubscribeOptions",
|
|
6580
|
+
"kind": "interface",
|
|
6581
|
+
"package": "@nifrajs/client",
|
|
6582
|
+
"signature": "export interface SubscribeOptions<I extends RouteInfo> {\n query?: [I[\"query\"]] extends [never] ? QueryNotTyped : I[\"query\"];\n headers?: Record<string, string>;\n /** Abort to close the subscription (same effect as calling `close()`). */\n signal?: AbortSignal;\n /**\n * Reconnect after a dropped/errored stream (default true — EventSource semantics, so a proxy\n * closing an idle feed doesn't silently kill it). A FINITE stream should pass `false` so a clean\n * server-side end completes the subscription instead of replaying it. Delays follow exponential\n * backoff with jitter, honoring the server's `retry:` hint when sent.\n */\n reconnect?: boolean | {\n baseDelayMs?: number;\n maxDelayMs?: number;\n };\n /** Stream-level failures (network drop, non-2xx, bad JSON). Reconnection continues regardless. */\n onError?: (error: unknown) => void;\n /** The stream ended and no reconnect will follow (clean end with `reconnect: false`, or closed). */\n onClose?: () => void;\n}"
|
|
6583
|
+
},
|
|
6584
|
+
{
|
|
6585
|
+
"name": "Subscription",
|
|
6586
|
+
"kind": "interface",
|
|
6587
|
+
"package": "@nifrajs/client",
|
|
6588
|
+
"signature": "export interface Subscription {\n /** Stop the subscription: aborts the live stream and cancels any pending reconnect. */\n close(): void;\n}"
|
|
6589
|
+
},
|
|
6064
6590
|
{
|
|
6065
6591
|
"name": "svelteAdapter",
|
|
6066
6592
|
"kind": "const",
|
|
@@ -6270,9 +6796,9 @@
|
|
|
6270
6796
|
},
|
|
6271
6797
|
{
|
|
6272
6798
|
"name": "TraceContext",
|
|
6273
|
-
"kind": "
|
|
6799
|
+
"kind": "type",
|
|
6274
6800
|
"package": "@nifrajs/otel",
|
|
6275
|
-
"signature": "export
|
|
6801
|
+
"signature": "export type TraceContext = ObservationContext;",
|
|
6276
6802
|
"doc": "/** The trace context exposed on the handler `c.trace` (typed, threaded via `derive`). */"
|
|
6277
6803
|
},
|
|
6278
6804
|
{
|
|
@@ -6293,7 +6819,7 @@
|
|
|
6293
6819
|
"name": "TracingOptions",
|
|
6294
6820
|
"kind": "interface",
|
|
6295
6821
|
"package": "@nifrajs/otel",
|
|
6296
|
-
"signature": "export interface TracingOptions {\n /** Where spans are sent. Default: {@link consoleSpanExporter}. */\n readonly exporter?: SpanExporter;\n /** Sets the `service.name` attribute on every span. */\n readonly serviceName?: string;\n /**\n * Set the outbound `traceparent` on the RESPONSE too (handy for browser/client correlation).\n * Default false — most setups only propagate downstream, not back to the caller.\n */\n readonly responseHeader?: boolean;\n}"
|
|
6822
|
+
"signature": "export interface TracingOptions {\n /** Where spans are sent. Default: {@link consoleSpanExporter}. */\n readonly exporter?: SpanExporter;\n /** Additional observation adapters (DevTools, a private redacting backend, metrics, …). */\n readonly adapters?: readonly ObservationAdapter[];\n /** Sets the `service.name` attribute on every span. */\n readonly serviceName?: string;\n /**\n * Set the outbound `traceparent` on the RESPONSE too (handy for browser/client correlation).\n * Default false — most setups only propagate downstream, not back to the caller.\n */\n readonly responseHeader?: boolean;\n}"
|
|
6297
6823
|
},
|
|
6298
6824
|
{
|
|
6299
6825
|
"name": "TrailingSlashOptions",
|
|
@@ -6356,6 +6882,20 @@
|
|
|
6356
6882
|
"signature": "export declare function tsTypeOf(schema: unknown, depth?: number): string;",
|
|
6357
6883
|
"doc": "/**\n * Render a JSON Schema as a compact TypeScript-like type (`{ id: string, name?: string }`) — the\n * shape agents already think in, at a fraction of the raw JSON Schema's tokens (~70-80% smaller).\n * Anything the renderer doesn't model falls back to the raw JSON for that subtree, so the output\n * is always faithful, just not always minimal.\n */"
|
|
6358
6884
|
},
|
|
6885
|
+
{
|
|
6886
|
+
"name": "typedSSEStream",
|
|
6887
|
+
"kind": "function",
|
|
6888
|
+
"package": "@nifrajs/core",
|
|
6889
|
+
"signature": "export declare function typedSSEStream<Event>(stream: SSEStream): TypedSSEStream<Event>;",
|
|
6890
|
+
"doc": "/** Wrap a raw {@link SSEStream} in the typed, JSON-serializing surface `app.sse()` hands out. */"
|
|
6891
|
+
},
|
|
6892
|
+
{
|
|
6893
|
+
"name": "TypedSSEStream",
|
|
6894
|
+
"kind": "interface",
|
|
6895
|
+
"package": "@nifrajs/core",
|
|
6896
|
+
"signature": "export interface TypedSSEStream<Event> {\n /** Send one typed event. `init` sets the optional SSE frame fields (`event`, `id`, `retry`). */\n send(event: Event, init?: Pick<SSEMessage, \"event\" | \"id\" | \"retry\">): void;\n /** Send a `: comment` line (e.g. an explicit ping). */\n comment(text: string): void;\n /** End the stream now. */\n close(): void;\n /** Aborts when the client disconnects — use it to tear down subscriptions/loops. */\n readonly signal: AbortSignal;\n}",
|
|
6897
|
+
"doc": "/**\n * The stream handed to an `app.sse()` handler: `send` takes the route's TYPED event payload and\n * serializes it (JSON) into the SSE `data:` field — the compile-time half of the `sse` contract.\n */"
|
|
6898
|
+
},
|
|
6359
6899
|
{
|
|
6360
6900
|
"name": "TypeEntry",
|
|
6361
6901
|
"kind": "interface",
|
|
@@ -6391,6 +6931,13 @@
|
|
|
6391
6931
|
"signature": "export declare function unsignValue(signed: string, secret: string): Promise<string | null>;",
|
|
6392
6932
|
"doc": "/**\n * Verify a `value.signature` produced by {@link signValue} and return the value, or `null` if the\n * signature is missing, malformed, or doesn't match. Verification is **constant-time**\n * (`crypto.subtle.verify`), so a wrong signature can't be discovered byte-by-byte via timing.\n */"
|
|
6393
6933
|
},
|
|
6934
|
+
{
|
|
6935
|
+
"name": "UnsupportedMockSchemaError",
|
|
6936
|
+
"kind": "class",
|
|
6937
|
+
"package": "@nifrajs/mock",
|
|
6938
|
+
"signature": "export declare class UnsupportedMockSchemaError extends Error {\n readonly keyword: string;\n constructor(keyword: string, message: string);\n}",
|
|
6939
|
+
"doc": "/**\n * `@nifrajs/mock` — contract-based mock server.\n *\n * Reads a Nifra app's registered routes and their Standard Schema / JSON Schema\n * response definitions, then generates fake responses from supported JSON Schema keywords. Use it\n * for frontend-first development, agent testing, or CI smoke tests.\n */"
|
|
6940
|
+
},
|
|
6394
6941
|
{
|
|
6395
6942
|
"name": "UploadResult",
|
|
6396
6943
|
"kind": "type",
|
|
@@ -6726,7 +7273,7 @@
|
|
|
6726
7273
|
"name": "VERSION",
|
|
6727
7274
|
"kind": "const",
|
|
6728
7275
|
"package": "@nifrajs/core",
|
|
6729
|
-
"signature": "export declare const VERSION: \"1.
|
|
7276
|
+
"signature": "export declare const VERSION: \"1.5.0\";",
|
|
6730
7277
|
"doc": "/**\n * Current package version. A hardcoded literal on purpose — core runs on the edge (no fs), so it can't\n * read its own package.json at runtime. `scripts/version.ts` rewrites it on every release bump and\n * `check:publish` asserts it equals `@nifrajs/core`'s package version, so the literal can't go stale\n * (it shipped at \"0.0.0\" through 1.0.0 before those guards existed). Kept narrow (`as const`) so\n * consumers can pin it at the type level — see `test/version.test-d.ts`.\n */"
|
|
6731
7278
|
},
|
|
6732
7279
|
{
|