@nifrajs/core 1.12.0 → 2.0.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/README.md +10 -1
- package/dist/assurance.d.ts +11 -2
- package/dist/assurance.d.ts.map +1 -1
- package/dist/assurance.js +20 -0
- package/dist/assurance.js.map +1 -1
- package/dist/effect-ledger.d.ts +9 -0
- package/dist/effect-ledger.d.ts.map +1 -0
- package/dist/effect-ledger.js +8 -0
- package/dist/effect-ledger.js.map +1 -0
- package/dist/idempotency-plugin.d.ts +8 -0
- package/dist/idempotency-plugin.d.ts.map +1 -0
- package/dist/idempotency-plugin.js +8 -0
- package/dist/idempotency-plugin.js.map +1 -0
- package/dist/index.d.ts +6 -34
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -30
- package/dist/index.js.map +1 -1
- package/dist/mcp.d.ts +7 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +56 -0
- package/dist/mcp.js.map +1 -0
- package/dist/node-direct.d.ts +5 -0
- package/dist/node-direct.d.ts.map +1 -0
- package/dist/node-direct.js +27 -0
- package/dist/node-direct.js.map +1 -0
- package/dist/reflection.d.ts +5 -0
- package/dist/reflection.d.ts.map +1 -1
- package/dist/reflection.js +2 -0
- package/dist/reflection.js.map +1 -1
- package/dist/router/pattern.d.ts +42 -0
- package/dist/router/pattern.d.ts.map +1 -0
- package/dist/router/pattern.js +127 -0
- package/dist/router/pattern.js.map +1 -0
- package/dist/router/router.d.ts +2 -1
- package/dist/router/router.d.ts.map +1 -1
- package/dist/router/router.js +11 -48
- package/dist/router/router.js.map +1 -1
- package/dist/server/client-ip.d.ts +35 -0
- package/dist/server/client-ip.d.ts.map +1 -0
- package/dist/server/client-ip.js +42 -0
- package/dist/server/client-ip.js.map +1 -0
- package/dist/server/context.d.ts +47 -2
- package/dist/server/context.d.ts.map +1 -1
- package/dist/server/contract.d.ts +37 -10
- package/dist/server/contract.d.ts.map +1 -1
- package/dist/server/contract.js +33 -8
- package/dist/server/contract.js.map +1 -1
- package/dist/server/http.d.ts +14 -0
- package/dist/server/http.d.ts.map +1 -0
- package/dist/server/http.js +45 -0
- package/dist/server/http.js.map +1 -0
- package/dist/server/idempotency-lane.d.ts +44 -0
- package/dist/server/idempotency-lane.d.ts.map +1 -0
- package/dist/server/idempotency-lane.js +181 -0
- package/dist/server/idempotency-lane.js.map +1 -0
- package/dist/server/install.d.ts +21 -0
- package/dist/server/install.d.ts.map +1 -0
- package/dist/server/install.js +21 -0
- package/dist/server/install.js.map +1 -0
- package/dist/server/ledger-lane.d.ts +53 -0
- package/dist/server/ledger-lane.d.ts.map +1 -0
- package/dist/server/ledger-lane.js +82 -0
- package/dist/server/ledger-lane.js.map +1 -0
- package/dist/server/mcp-hook.d.ts +28 -0
- package/dist/server/mcp-hook.d.ts.map +1 -0
- package/dist/server/mcp-hook.js +2 -0
- package/dist/server/mcp-hook.js.map +1 -0
- package/dist/server/node-outcome-hook.d.ts +9 -0
- package/dist/server/node-outcome-hook.d.ts.map +1 -0
- package/dist/server/node-outcome-hook.js +2 -0
- package/dist/server/node-outcome-hook.js.map +1 -0
- package/dist/server/node-outcome.d.ts +37 -0
- package/dist/server/node-outcome.d.ts.map +1 -0
- package/dist/server/node-outcome.js +75 -0
- package/dist/server/node-outcome.js.map +1 -0
- package/dist/server/plugin.d.ts +78 -0
- package/dist/server/plugin.d.ts.map +1 -0
- package/dist/server/plugin.js +57 -0
- package/dist/server/plugin.js.map +1 -0
- package/dist/server/query.d.ts +18 -0
- package/dist/server/query.d.ts.map +1 -0
- package/dist/server/query.js +102 -0
- package/dist/server/query.js.map +1 -0
- package/dist/server/registry.d.ts +31 -6
- package/dist/server/registry.d.ts.map +1 -1
- package/dist/server/request-context.d.ts +51 -0
- package/dist/server/request-context.d.ts.map +1 -0
- package/dist/server/request-context.js +184 -0
- package/dist/server/request-context.js.map +1 -0
- package/dist/server/respond.d.ts +17 -0
- package/dist/server/respond.d.ts.map +1 -0
- package/dist/server/respond.js +81 -0
- package/dist/server/respond.js.map +1 -0
- package/dist/server/runtime-core.d.ts +36 -0
- package/dist/server/runtime-core.d.ts.map +1 -0
- package/dist/server/runtime-core.js +51 -0
- package/dist/server/runtime-core.js.map +1 -0
- package/dist/server/server-types.d.ts +203 -0
- package/dist/server/server-types.d.ts.map +1 -0
- package/dist/server/server-types.js +2 -0
- package/dist/server/server-types.js.map +1 -0
- package/dist/server/server.d.ts +135 -358
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/server.js +476 -1065
- package/dist/server/server.js.map +1 -1
- package/dist/server/sse-hook.d.ts +10 -0
- package/dist/server/sse-hook.d.ts.map +1 -0
- package/dist/server/sse-hook.js +2 -0
- package/dist/server/sse-hook.js.map +1 -0
- package/dist/server/sse.d.ts +7 -23
- package/dist/server/sse.d.ts.map +1 -1
- package/dist/server/sse.js +18 -0
- package/dist/server/sse.js.map +1 -1
- package/dist/server/websocket.d.ts +17 -1
- package/dist/server/websocket.d.ts.map +1 -1
- package/dist/server/websocket.js.map +1 -1
- package/dist/server/ws-hook.d.ts +8 -11
- package/dist/server/ws-hook.d.ts.map +1 -1
- package/dist/server/ws-hook.js +7 -14
- package/dist/server/ws-hook.js.map +1 -1
- package/dist/server.d.ts +21 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +16 -0
- package/dist/server.js.map +1 -0
- package/dist/ws.d.ts +16 -7
- package/dist/ws.d.ts.map +1 -1
- package/dist/ws.js +25 -10
- package/dist/ws.js.map +1 -1
- package/package.json +82 -6
- package/src/assurance.ts +36 -1
- package/src/effect-ledger.ts +9 -0
- package/src/idempotency-plugin.ts +7 -0
- package/src/index.ts +6 -132
- package/src/mcp.ts +65 -0
- package/src/node-direct.ts +37 -0
- package/src/reflection.ts +7 -0
- package/src/router/pattern.ts +176 -0
- package/src/router/router.ts +11 -69
- package/src/server/client-ip.ts +60 -0
- package/src/server/context.ts +50 -2
- package/src/server/contract.ts +68 -25
- package/src/server/http.ts +58 -0
- package/src/server/idempotency-lane.ts +287 -0
- package/src/server/install.ts +28 -0
- package/src/server/ledger-lane.ts +125 -0
- package/src/server/mcp-hook.ts +41 -0
- package/src/server/node-outcome-hook.ts +9 -0
- package/src/server/node-outcome.ts +112 -0
- package/src/server/plugin.ts +92 -0
- package/src/server/query.ts +119 -0
- package/src/server/registry.ts +36 -6
- package/src/server/request-context.ts +271 -0
- package/src/server/respond.ts +93 -0
- package/src/server/runtime-core.ts +74 -0
- package/src/server/server-types.ts +204 -0
- package/src/server/server.ts +863 -1657
- package/src/server/sse-hook.ts +14 -0
- package/src/server/sse.ts +26 -0
- package/src/server/websocket.ts +20 -0
- package/src/server/ws-hook.ts +8 -19
- package/src/server.ts +92 -0
- package/src/ws.ts +33 -10
- package/dist/invariants.d.ts +0 -70
- package/dist/invariants.d.ts.map +0 -1
- package/dist/invariants.js +0 -487
- package/dist/invariants.js.map +0 -1
- package/src/invariants.ts +0 -604
package/dist/server/ws-hook.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* `@nifrajs/core/ws`
|
|
4
|
-
*
|
|
5
|
-
* apps that never call `app.ws()`
|
|
2
|
+
* WebSocket runtime contract. `server.ts` type-imports only this; the `.use(websocket())` plugin
|
|
3
|
+
* (from `@nifrajs/core/ws`) installs the implementation on a server instance via the `INSTALL_WS`
|
|
4
|
+
* symbol seam. That keeps the WS dispatcher, pub/sub registry, Bun socket plumbing, and
|
|
5
|
+
* message-schema validation out of the base server bundle for apps that never call `app.ws()`
|
|
6
|
+
* (~1.5 KB gzipped on the minimal-app benchmark).
|
|
6
7
|
*
|
|
7
|
-
* Only type
|
|
8
|
+
* Only type declarations below - this module must stay weightless, it is always in the base bundle.
|
|
8
9
|
*/
|
|
9
10
|
import type { NifraWebSocket, StandardWebSocket, TopicRegistry, WebSocketHandler } from "./websocket.js";
|
|
10
11
|
/** The Bun serve `websocket` callback trio, closed over one app's `TopicRegistry`. The `ws`
|
|
@@ -17,20 +18,16 @@ export interface BunWsHandlers {
|
|
|
17
18
|
}
|
|
18
19
|
/** What `@nifrajs/core/ws` registers: everything `server.ts` and `toFetchHandler` need at runtime. */
|
|
19
20
|
export interface WsRuntime {
|
|
20
|
-
/** `wrapWebSocketMessageValidation`
|
|
21
|
+
/** `wrapWebSocketMessageValidation` - applied once at `app.ws()` registration. */
|
|
21
22
|
wrapHandler(handler: WebSocketHandler): WebSocketHandler;
|
|
22
23
|
/** One in-process pub/sub registry per app (backs `ws.subscribe` + `app.publish`). */
|
|
23
24
|
createTopics(): TopicRegistry;
|
|
24
25
|
/** The Bun `websocket` config for `listen()` when the app has WS routes. */
|
|
25
26
|
bunHandlers(topics: TopicRegistry): BunWsHandlers;
|
|
26
|
-
/** `attachWebSocket`
|
|
27
|
+
/** `attachWebSocket` - wires a standard server socket (Workers `WebSocketPair`) to a handler. */
|
|
27
28
|
attach(socket: StandardWebSocket, handler: WebSocketHandler, data: unknown, options: {
|
|
28
29
|
openNow: boolean;
|
|
29
30
|
pubsub: TopicRegistry;
|
|
30
31
|
}): NifraWebSocket;
|
|
31
32
|
}
|
|
32
|
-
/** Called by `@nifrajs/core/ws` on import. Last registration wins (idempotent in practice — there is
|
|
33
|
-
* one implementation; double-import is a no-op re-set of the same functions). */
|
|
34
|
-
export declare function setWsRuntime(impl: WsRuntime): void;
|
|
35
|
-
export declare function getWsRuntime(): WsRuntime | undefined;
|
|
36
33
|
//# sourceMappingURL=ws-hook.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws-hook.d.ts","sourceRoot":"","sources":["../../src/server/ws-hook.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ws-hook.d.ts","sourceRoot":"","sources":["../../src/server/ws-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EACjB,MAAM,gBAAgB,CAAA;AAEvB;;iDAEiD;AACjD,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAAA;IACvB,OAAO,CAAC,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,IAAI,CAAA;IACtE,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CACvD;AAED,sGAAsG;AACtG,MAAM,WAAW,SAAS;IACxB,kFAAkF;IAClF,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,gBAAgB,CAAA;IACxD,sFAAsF;IACtF,YAAY,IAAI,aAAa,CAAA;IAC7B,4EAA4E;IAC5E,WAAW,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,CAAA;IACjD,iGAAiG;IACjG,MAAM,CACJ,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,aAAa,CAAA;KAAE,GACnD,cAAc,CAAA;CAClB"}
|
package/dist/server/ws-hook.js
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* `@nifrajs/core/ws`
|
|
4
|
-
*
|
|
5
|
-
* apps that never call `app.ws()`
|
|
2
|
+
* WebSocket runtime contract. `server.ts` type-imports only this; the `.use(websocket())` plugin
|
|
3
|
+
* (from `@nifrajs/core/ws`) installs the implementation on a server instance via the `INSTALL_WS`
|
|
4
|
+
* symbol seam. That keeps the WS dispatcher, pub/sub registry, Bun socket plumbing, and
|
|
5
|
+
* message-schema validation out of the base server bundle for apps that never call `app.ws()`
|
|
6
|
+
* (~1.5 KB gzipped on the minimal-app benchmark).
|
|
6
7
|
*
|
|
7
|
-
* Only type
|
|
8
|
+
* Only type declarations below - this module must stay weightless, it is always in the base bundle.
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
|
-
/** Called by `@nifrajs/core/ws` on import. Last registration wins (idempotent in practice — there is
|
|
11
|
-
* one implementation; double-import is a no-op re-set of the same functions). */
|
|
12
|
-
export function setWsRuntime(impl) {
|
|
13
|
-
runtime = impl;
|
|
14
|
-
}
|
|
15
|
-
export function getWsRuntime() {
|
|
16
|
-
return runtime;
|
|
17
|
-
}
|
|
10
|
+
export {};
|
|
18
11
|
//# sourceMappingURL=ws-hook.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws-hook.js","sourceRoot":"","sources":["../../src/server/ws-hook.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ws-hook.js","sourceRoot":"","sources":["../../src/server/ws-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lean server entry for the common Nifra runtime.
|
|
3
|
+
*
|
|
4
|
+
* Use `@nifrajs/core/server` or the equivalent lean package root when building an HTTP app.
|
|
5
|
+
* Optional systems such as
|
|
6
|
+
* causality, invariants, manifests, reflection, and capability tooling live at
|
|
7
|
+
* their dedicated subpaths. Keeping this entry curated is intentional: do not
|
|
8
|
+
* export an opt-in module here unless the Server implementation already loads it.
|
|
9
|
+
*/
|
|
10
|
+
export { FrameworkError, RouteConfigError, type RouteConfigErrorCode } from "./errors.js";
|
|
11
|
+
export { FRAMEWORK_NAME, type FrameworkName } from "./internal/brand.js";
|
|
12
|
+
export { METHODS, type Method, Router, type RouterMatch } from "./router/router.js";
|
|
13
|
+
export type { InferInput, InferOutput, StandardIssue, StandardResult, StandardSchemaV1, StandardTypes, ValidationOutcome, } from "./schema/standard.js";
|
|
14
|
+
export type { Context, Params, Platform, Prettify, ResponseControls, RouteSchema, } from "./server/context.js";
|
|
15
|
+
export { type CookieOptions, parseCookies, serializeCookie, signValue, unsignValue, } from "./server/cookies.js";
|
|
16
|
+
export { commonSecretPatterns, jsonLogger, type LogFields, type Logger, type RedactOptions, redactLogFields, silentLogger, } from "./server/logger.js";
|
|
17
|
+
export type { Registry, RouteInfo } from "./server/registry.js";
|
|
18
|
+
export { type AdmissionController, type AdmissionDecision, type AnyServer, type DurableObjectNamespaceLike, defineIdentityPlugin, definePlugin, defineRouterPlugin, type ExecutionContext, type Handler, type IdentityPlugin, type McpPromptDescriptor, type McpResourceDescriptor, type Middleware, type NifraPlugin, type NodeServeOutcome, type OnRequestResult, type PromptArgument, type PromptMessage, type ResponseFinalization, type RouteDescriptor, type RunningServer, type ScheduledController, type ScheduledHandler, Server, type ServerOptions, server, type ToolAnnotations, toFetchHandler, } from "./server/server.js";
|
|
19
|
+
export type { SSEContext, SSEInit, SSEMessage, SSEStream, TypedSSEStream, } from "./server/sse.js";
|
|
20
|
+
export type { NifraWebSocket, StandardWebSocket, WebSocketContext, WebSocketData, WebSocketHandler, WebSocketUpgradeOutcome, } from "./server/websocket.js";
|
|
21
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAA;AACzF,OAAO,EAAE,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACxE,OAAO,EAAE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACnF,YAAY,EACV,UAAU,EACV,WAAW,EACX,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,iBAAiB,GAClB,MAAM,sBAAsB,CAAA;AAC7B,YAAY,EACV,OAAO,EACP,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,WAAW,GACZ,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,KAAK,aAAa,EAClB,YAAY,EACZ,eAAe,EACf,SAAS,EACT,WAAW,GACZ,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,oBAAoB,EACpB,UAAU,EACV,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,eAAe,EACf,YAAY,GACb,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,0BAA0B,EAC/B,oBAAoB,EACpB,YAAY,EACZ,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,MAAM,EACN,KAAK,aAAa,EAClB,MAAM,EACN,KAAK,eAAe,EACpB,cAAc,GACf,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EACV,UAAU,EACV,OAAO,EACP,UAAU,EACV,SAAS,EACT,cAAc,GACf,MAAM,iBAAiB,CAAA;AACxB,YAAY,EACV,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,uBAAuB,CAAA"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lean server entry for the common Nifra runtime.
|
|
3
|
+
*
|
|
4
|
+
* Use `@nifrajs/core/server` or the equivalent lean package root when building an HTTP app.
|
|
5
|
+
* Optional systems such as
|
|
6
|
+
* causality, invariants, manifests, reflection, and capability tooling live at
|
|
7
|
+
* their dedicated subpaths. Keeping this entry curated is intentional: do not
|
|
8
|
+
* export an opt-in module here unless the Server implementation already loads it.
|
|
9
|
+
*/
|
|
10
|
+
export { FrameworkError, RouteConfigError } from "./errors.js";
|
|
11
|
+
export { FRAMEWORK_NAME } from "./internal/brand.js";
|
|
12
|
+
export { METHODS, Router } from "./router/router.js";
|
|
13
|
+
export { parseCookies, serializeCookie, signValue, unsignValue, } from "./server/cookies.js";
|
|
14
|
+
export { commonSecretPatterns, jsonLogger, redactLogFields, silentLogger, } from "./server/logger.js";
|
|
15
|
+
export { defineIdentityPlugin, definePlugin, defineRouterPlugin, Server, server, toFetchHandler, } from "./server/server.js";
|
|
16
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAA6B,MAAM,aAAa,CAAA;AACzF,OAAO,EAAE,cAAc,EAAsB,MAAM,qBAAqB,CAAA;AACxE,OAAO,EAAE,OAAO,EAAe,MAAM,EAAoB,MAAM,oBAAoB,CAAA;AAkBnF,OAAO,EAEL,YAAY,EACZ,eAAe,EACf,SAAS,EACT,WAAW,GACZ,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,oBAAoB,EACpB,UAAU,EAIV,eAAe,EACf,YAAY,GACb,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAKL,oBAAoB,EACpB,YAAY,EACZ,kBAAkB,EAiBlB,MAAM,EAEN,MAAM,EAEN,cAAc,GACf,MAAM,oBAAoB,CAAA"}
|
package/dist/ws.d.ts
CHANGED
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* WebSocket runtime
|
|
2
|
+
* The opt-in WebSocket runtime plugin.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* `.use(websocket())` enables `app.ws()`:
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* import { websocket } from "@nifrajs/core/ws"
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* const app = server().use(websocket()).ws("/chat", { message: (ws, data) => ws.send(data) })
|
|
9
|
+
*
|
|
10
|
+
* Without it, `app.ws()` throws at registration (fail-closed), so an app that never uses WebSockets
|
|
11
|
+
* never evaluates or bundles the WS dispatcher, pub/sub registry, and Bun socket plumbing (~1.5 KB
|
|
12
|
+
* gzipped on the minimal-app size benchmark). The runtime installs on that server instance only -
|
|
13
|
+
* the same `.use()` install seam as `mcp()` / `streaming()` / `idempotency()`, not a process-global
|
|
14
|
+
* or a side-effect import.
|
|
12
15
|
*
|
|
13
16
|
* Serving adapters that wire standard sockets themselves (`@nifrajs/workers`) import
|
|
14
17
|
* `attachWebSocket` / `TopicRegistry` from here too.
|
|
15
18
|
*/
|
|
19
|
+
import type { IdentityPlugin } from "./server/plugin.js";
|
|
16
20
|
import { attachWebSocket, TopicRegistry, wrapWebSocketMessageValidation } from "./server/websocket.js";
|
|
21
|
+
/**
|
|
22
|
+
* Enable WebSocket routes on a server: `.use(websocket())` turns on `app.ws()`. Applying it twice is
|
|
23
|
+
* a no-op (named plugin dedupe).
|
|
24
|
+
*/
|
|
25
|
+
export declare function websocket(): IdentityPlugin;
|
|
17
26
|
export type { NifraWebSocket, StandardWebSocket, WebSocketContext, WebSocketData, WebSocketHandler, WebSocketUpgradeOutcome, } from "./server/websocket.js";
|
|
18
27
|
export { attachWebSocket, TopicRegistry, wrapWebSocketMessageValidation };
|
|
19
28
|
//# sourceMappingURL=ws.d.ts.map
|
package/dist/ws.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../src/ws.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../src/ws.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAExD,OAAO,EACL,eAAe,EACf,aAAa,EACb,8BAA8B,EAC/B,MAAM,uBAAuB,CAAA;AAgB9B;;;GAGG;AACH,wBAAgB,SAAS,IAAI,cAAc,CAM1C;AAED,YAAY,EACV,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,8BAA8B,EAAE,CAAA"}
|
package/dist/ws.js
CHANGED
|
@@ -1,26 +1,41 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* WebSocket runtime
|
|
2
|
+
* The opt-in WebSocket runtime plugin.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* `.use(websocket())` enables `app.ws()`:
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* import { websocket } from "@nifrajs/core/ws"
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* const app = server().use(websocket()).ws("/chat", { message: (ws, data) => ws.send(data) })
|
|
9
|
+
*
|
|
10
|
+
* Without it, `app.ws()` throws at registration (fail-closed), so an app that never uses WebSockets
|
|
11
|
+
* never evaluates or bundles the WS dispatcher, pub/sub registry, and Bun socket plumbing (~1.5 KB
|
|
12
|
+
* gzipped on the minimal-app size benchmark). The runtime installs on that server instance only -
|
|
13
|
+
* the same `.use()` install seam as `mcp()` / `streaming()` / `idempotency()`, not a process-global
|
|
14
|
+
* or a side-effect import.
|
|
12
15
|
*
|
|
13
16
|
* Serving adapters that wire standard sockets themselves (`@nifrajs/workers`) import
|
|
14
17
|
* `attachWebSocket` / `TopicRegistry` from here too.
|
|
15
18
|
*/
|
|
19
|
+
import { INSTALL_WS } from "./server/install.js";
|
|
16
20
|
import { attachWebSocket, TopicRegistry, wrapWebSocketMessageValidation, } from "./server/websocket.js";
|
|
17
21
|
import { createBunWsHandlers } from "./server/ws-bun.js";
|
|
18
|
-
|
|
19
|
-
setWsRuntime({
|
|
22
|
+
const WS_RUNTIME = {
|
|
20
23
|
wrapHandler: wrapWebSocketMessageValidation,
|
|
21
24
|
createTopics: () => new TopicRegistry(),
|
|
22
25
|
bunHandlers: createBunWsHandlers,
|
|
23
26
|
attach: attachWebSocket,
|
|
24
|
-
}
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Enable WebSocket routes on a server: `.use(websocket())` turns on `app.ws()`. Applying it twice is
|
|
30
|
+
* a no-op (named plugin dedupe).
|
|
31
|
+
*/
|
|
32
|
+
export function websocket() {
|
|
33
|
+
const apply = (app) => {
|
|
34
|
+
;
|
|
35
|
+
app[INSTALL_WS](WS_RUNTIME);
|
|
36
|
+
return app;
|
|
37
|
+
};
|
|
38
|
+
return Object.assign(apply, { pluginName: "nifra:websocket" });
|
|
39
|
+
}
|
|
25
40
|
export { attachWebSocket, TopicRegistry, wrapWebSocketMessageValidation };
|
|
26
41
|
//# sourceMappingURL=ws.js.map
|
package/dist/ws.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws.js","sourceRoot":"","sources":["../src/ws.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ws.js","sourceRoot":"","sources":["../src/ws.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAGhD,OAAO,EACL,eAAe,EACf,aAAa,EACb,8BAA8B,GAC/B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAGxD,MAAM,UAAU,GAAc;IAC5B,WAAW,EAAE,8BAA8B;IAC3C,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,aAAa,EAAE;IACvC,WAAW,EAAE,mBAAmB;IAChC,MAAM,EAAE,eAAe;CACxB,CAAA;AAOD;;;GAGG;AACH,MAAM,UAAU,SAAS;IACvB,MAAM,KAAK,GAAG,CAAsB,GAAM,EAAK,EAAE;QAC/C,CAAC;QAAC,GAAgC,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,CAAA;QAC1D,OAAO,GAAG,CAAA;IACZ,CAAC,CAAA;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,UAAU,EAAE,iBAAiB,EAAE,CAAmB,CAAA;AAClF,CAAC;AAUD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,8BAA8B,EAAE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nifrajs/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Bun-native, contract-first HTTP framework — the router, server, and route descriptor.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|
|
@@ -27,6 +27,11 @@
|
|
|
27
27
|
"types": "./dist/index.d.ts",
|
|
28
28
|
"default": "./dist/index.js"
|
|
29
29
|
},
|
|
30
|
+
"./server": {
|
|
31
|
+
"bun": "./src/server.ts",
|
|
32
|
+
"types": "./dist/server.d.ts",
|
|
33
|
+
"default": "./dist/server.js"
|
|
34
|
+
},
|
|
30
35
|
"./ws": {
|
|
31
36
|
"bun": "./src/ws.ts",
|
|
32
37
|
"types": "./dist/ws.d.ts",
|
|
@@ -62,16 +67,21 @@
|
|
|
62
67
|
"types": "./dist/idempotency.d.ts",
|
|
63
68
|
"default": "./dist/idempotency.js"
|
|
64
69
|
},
|
|
65
|
-
"./
|
|
66
|
-
"bun": "./src/
|
|
67
|
-
"types": "./dist/
|
|
68
|
-
"default": "./dist/
|
|
70
|
+
"./idempotency-plugin": {
|
|
71
|
+
"bun": "./src/idempotency-plugin.ts",
|
|
72
|
+
"types": "./dist/idempotency-plugin.d.ts",
|
|
73
|
+
"default": "./dist/idempotency-plugin.js"
|
|
69
74
|
},
|
|
70
75
|
"./ledger": {
|
|
71
76
|
"bun": "./src/ledger.ts",
|
|
72
77
|
"types": "./dist/ledger.d.ts",
|
|
73
78
|
"default": "./dist/ledger.js"
|
|
74
79
|
},
|
|
80
|
+
"./effect-ledger": {
|
|
81
|
+
"bun": "./src/effect-ledger.ts",
|
|
82
|
+
"types": "./dist/effect-ledger.d.ts",
|
|
83
|
+
"default": "./dist/effect-ledger.js"
|
|
84
|
+
},
|
|
75
85
|
"./manifest": {
|
|
76
86
|
"bun": "./src/manifest.ts",
|
|
77
87
|
"types": "./dist/manifest.d.ts",
|
|
@@ -82,10 +92,70 @@
|
|
|
82
92
|
"types": "./dist/mount.d.ts",
|
|
83
93
|
"default": "./dist/mount.js"
|
|
84
94
|
},
|
|
95
|
+
"./mcp": {
|
|
96
|
+
"bun": "./src/mcp.ts",
|
|
97
|
+
"types": "./dist/mcp.d.ts",
|
|
98
|
+
"default": "./dist/mcp.js"
|
|
99
|
+
},
|
|
100
|
+
"./node-direct": {
|
|
101
|
+
"bun": "./src/node-direct.ts",
|
|
102
|
+
"types": "./dist/node-direct.d.ts",
|
|
103
|
+
"default": "./dist/node-direct.js"
|
|
104
|
+
},
|
|
105
|
+
"./pattern": {
|
|
106
|
+
"bun": "./src/router/pattern.ts",
|
|
107
|
+
"types": "./dist/router/pattern.d.ts",
|
|
108
|
+
"default": "./dist/router/pattern.js"
|
|
109
|
+
},
|
|
85
110
|
"./causality": {
|
|
86
111
|
"bun": "./src/causality.ts",
|
|
87
112
|
"types": "./dist/causality.d.ts",
|
|
88
113
|
"default": "./dist/causality.js"
|
|
114
|
+
},
|
|
115
|
+
"./classification": {
|
|
116
|
+
"bun": "./src/classification.ts",
|
|
117
|
+
"types": "./dist/classification.d.ts",
|
|
118
|
+
"default": "./dist/classification.js"
|
|
119
|
+
},
|
|
120
|
+
"./contract": {
|
|
121
|
+
"bun": "./src/server/contract.ts",
|
|
122
|
+
"types": "./dist/server/contract.d.ts",
|
|
123
|
+
"default": "./dist/server/contract.js"
|
|
124
|
+
},
|
|
125
|
+
"./cookies": {
|
|
126
|
+
"bun": "./src/server/cookies.ts",
|
|
127
|
+
"types": "./dist/server/cookies.d.ts",
|
|
128
|
+
"default": "./dist/server/cookies.js"
|
|
129
|
+
},
|
|
130
|
+
"./logger": {
|
|
131
|
+
"bun": "./src/server/logger.ts",
|
|
132
|
+
"types": "./dist/server/logger.d.ts",
|
|
133
|
+
"default": "./dist/server/logger.js"
|
|
134
|
+
},
|
|
135
|
+
"./router": {
|
|
136
|
+
"bun": "./src/router/router.ts",
|
|
137
|
+
"types": "./dist/router/router.d.ts",
|
|
138
|
+
"default": "./dist/router/router.js"
|
|
139
|
+
},
|
|
140
|
+
"./schema": {
|
|
141
|
+
"bun": "./src/schema/standard.ts",
|
|
142
|
+
"types": "./dist/schema/standard.d.ts",
|
|
143
|
+
"default": "./dist/schema/standard.js"
|
|
144
|
+
},
|
|
145
|
+
"./seo": {
|
|
146
|
+
"bun": "./src/seo.ts",
|
|
147
|
+
"types": "./dist/seo.d.ts",
|
|
148
|
+
"default": "./dist/seo.js"
|
|
149
|
+
},
|
|
150
|
+
"./sse": {
|
|
151
|
+
"bun": "./src/server/sse.ts",
|
|
152
|
+
"types": "./dist/server/sse.d.ts",
|
|
153
|
+
"default": "./dist/server/sse.js"
|
|
154
|
+
},
|
|
155
|
+
"./webhook": {
|
|
156
|
+
"bun": "./src/server/webhook.ts",
|
|
157
|
+
"types": "./dist/server/webhook.d.ts",
|
|
158
|
+
"default": "./dist/server/webhook.js"
|
|
89
159
|
}
|
|
90
160
|
},
|
|
91
161
|
"files": [
|
|
@@ -94,7 +164,13 @@
|
|
|
94
164
|
],
|
|
95
165
|
"sideEffects": [
|
|
96
166
|
"./src/ws.ts",
|
|
97
|
-
"./dist/ws.js"
|
|
167
|
+
"./dist/ws.js",
|
|
168
|
+
"./src/server/sse.ts",
|
|
169
|
+
"./dist/server/sse.js",
|
|
170
|
+
"./src/node-direct.ts",
|
|
171
|
+
"./dist/node-direct.js",
|
|
172
|
+
"./src/mcp-runtime.ts",
|
|
173
|
+
"./dist/mcp-runtime.js"
|
|
98
174
|
],
|
|
99
175
|
"scripts": {
|
|
100
176
|
"build": "tsc -p tsconfig.build.json && bun run ../../scripts/fix-dts.ts dist"
|
package/src/assurance.ts
CHANGED
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
validMethod,
|
|
21
21
|
withRouteAssurance,
|
|
22
22
|
} from "./internal/route-assurance.ts"
|
|
23
|
-
import type { InvariantExecutor } from "./invariants.ts"
|
|
24
23
|
import type { NifraManifestSigner } from "./manifest.ts"
|
|
25
24
|
import { type ReflectedRoute, reflectRoutes } from "./reflection.ts"
|
|
26
25
|
import type { Method } from "./router/router.ts"
|
|
@@ -28,6 +27,9 @@ import type { Method } from "./router/router.ts"
|
|
|
28
27
|
export type { AssuranceDeclaration, AssuranceEvidence, AssuranceScope }
|
|
29
28
|
export { withRouteAssurance }
|
|
30
29
|
|
|
30
|
+
/** Isolated request executor used by adversarial contract verification. */
|
|
31
|
+
export type InvariantExecutor = (request: Request) => Response | Promise<Response>
|
|
32
|
+
|
|
31
33
|
/** Canonical evidence ids emitted by Nifra's official middleware modules. */
|
|
32
34
|
export const NIFRA_ASSURANCE = NIFRA_ASSURANCE_IDS
|
|
33
35
|
|
|
@@ -57,6 +59,14 @@ export interface AssurancePolicy {
|
|
|
57
59
|
readonly unmatched?: "error" | "ignore"
|
|
58
60
|
/** Default false: reject an empty reflected source so a wrong import cannot pass CI silently. */
|
|
59
61
|
readonly allowEmpty?: boolean
|
|
62
|
+
/**
|
|
63
|
+
* Default false. When true, a route matched by a **pure-classification** rule (no `require`, no `forbid`)
|
|
64
|
+
* that carries NO enforcement evidence is reported (`classified-no-evidence`). This surfaces the gap the
|
|
65
|
+
* feedback flagged: a classification-only policy silently degrades "proof" to a "label". Opt-in, because
|
|
66
|
+
* a genuinely public route legitimately carries no evidence; enable it once your guards emit evidence
|
|
67
|
+
* (inline `schema.assurance` or a `withRouteAssurance` middleware) to keep classification honest.
|
|
68
|
+
*/
|
|
69
|
+
readonly flagClassifiedWithoutEvidence?: boolean
|
|
60
70
|
}
|
|
61
71
|
|
|
62
72
|
export type AssuranceFindingCode =
|
|
@@ -64,6 +74,7 @@ export type AssuranceFindingCode =
|
|
|
64
74
|
| "unclassified-route"
|
|
65
75
|
| "missing-evidence"
|
|
66
76
|
| "forbidden-evidence"
|
|
77
|
+
| "classified-no-evidence"
|
|
67
78
|
|
|
68
79
|
export interface AssuranceFinding {
|
|
69
80
|
readonly code: AssuranceFindingCode
|
|
@@ -140,6 +151,12 @@ export function defineAssurancePolicy(policy: AssurancePolicy): AssurancePolicy
|
|
|
140
151
|
if (policy.allowEmpty !== undefined && typeof policy.allowEmpty !== "boolean") {
|
|
141
152
|
throw new Error(`route assurance: allowEmpty must be boolean`)
|
|
142
153
|
}
|
|
154
|
+
if (
|
|
155
|
+
policy.flagClassifiedWithoutEvidence !== undefined &&
|
|
156
|
+
typeof policy.flagClassifiedWithoutEvidence !== "boolean"
|
|
157
|
+
) {
|
|
158
|
+
throw new Error(`route assurance: flagClassifiedWithoutEvidence must be boolean`)
|
|
159
|
+
}
|
|
143
160
|
const names = new Set<string>()
|
|
144
161
|
const rules = policy.rules.map((rule): AssuranceRule => {
|
|
145
162
|
if (typeof rule.name !== "string" || !nonEmpty(rule.name)) {
|
|
@@ -187,6 +204,7 @@ export function defineAssurancePolicy(policy: AssurancePolicy): AssurancePolicy
|
|
|
187
204
|
rules: Object.freeze(rules),
|
|
188
205
|
unmatched: policy.unmatched ?? "error",
|
|
189
206
|
allowEmpty: policy.allowEmpty ?? false,
|
|
207
|
+
flagClassifiedWithoutEvidence: policy.flagClassifiedWithoutEvidence ?? false,
|
|
190
208
|
})
|
|
191
209
|
}
|
|
192
210
|
|
|
@@ -292,6 +310,23 @@ export function evaluateRouteAssurance(
|
|
|
292
310
|
message: `${route.method} ${route.path} (${rule.name}) carries forbidden ${id}`,
|
|
293
311
|
})
|
|
294
312
|
}
|
|
313
|
+
// Opt-in visibility: a pure-classification rule (no require + no forbid) matching a route with zero
|
|
314
|
+
// evidence is a "label without proof". Surface it so the gap isn't silently green. A rule that expects
|
|
315
|
+
// or forbids evidence already speaks for itself via the loops above, so it's excluded here.
|
|
316
|
+
if (
|
|
317
|
+
policy.flagClassifiedWithoutEvidence === true &&
|
|
318
|
+
evidence.length === 0 &&
|
|
319
|
+
(rule.require ?? []).length === 0 &&
|
|
320
|
+
(rule.forbid ?? []).length === 0
|
|
321
|
+
) {
|
|
322
|
+
findings.push({
|
|
323
|
+
code: "classified-no-evidence",
|
|
324
|
+
method: route.method,
|
|
325
|
+
path: route.path,
|
|
326
|
+
rule: rule.name,
|
|
327
|
+
message: `${route.method} ${route.path} (${rule.name}) is classified but carries no enforcement evidence`,
|
|
328
|
+
})
|
|
329
|
+
}
|
|
295
330
|
routes.push({
|
|
296
331
|
method: route.method,
|
|
297
332
|
path: route.path,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opt-in server integration for the per-request effect ledger.
|
|
3
|
+
*
|
|
4
|
+
* Kept separate from `@nifrajs/core/server` so a bare HTTP app does not evaluate or bundle ledger
|
|
5
|
+
* machinery. Import ledger primitives from `@nifrajs/core/ledger`.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export type { EffectLedgerOptions } from "./ledger.ts"
|
|
9
|
+
export { effectLedger } from "./server/ledger-lane.ts"
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opt-in server integration for request idempotency.
|
|
3
|
+
*
|
|
4
|
+
* Kept separate from `@nifrajs/core/server` so a bare HTTP app does not evaluate or bundle the
|
|
5
|
+
* dedupe lane. Import primitives and stores from `@nifrajs/core/idempotency`.
|
|
6
|
+
*/
|
|
7
|
+
export { type IdempotencyPluginOptions, idempotency } from "./server/idempotency-lane.ts"
|
package/src/index.ts
CHANGED
|
@@ -1,143 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* `@nifrajs/core` — Nifra's lean HTTP server API.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* the
|
|
4
|
+
* Nifra 2.0 keeps the package root intentionally lean. Optional systems live at documented
|
|
5
|
+
* subpaths so importing the root cannot activate unrelated runtimes.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Current package version. A hardcoded literal on purpose — core runs on the edge (no fs), so it can't
|
|
10
10
|
* read its own package.json at runtime. `scripts/version.ts` rewrites it on every release bump and
|
|
11
|
-
* `check:publish` asserts it equals `@nifrajs/core`'s package version
|
|
12
|
-
* (it shipped at "0.0.0" through 1.0.0 before those guards existed). Kept narrow (`as const`) so
|
|
13
|
-
* consumers can pin it at the type level — see `test/version.test-d.ts`.
|
|
11
|
+
* `check:publish` asserts it equals `@nifrajs/core`'s package version.
|
|
14
12
|
*/
|
|
15
|
-
export const VERSION = "
|
|
13
|
+
export const VERSION = "2.0.0" as const
|
|
16
14
|
|
|
17
15
|
export type Version = typeof VERSION
|
|
18
16
|
|
|
19
|
-
export * from "./
|
|
20
|
-
export * from "./capabilities.ts"
|
|
21
|
-
export * from "./causality.ts"
|
|
22
|
-
export * from "./classification.ts"
|
|
23
|
-
export * from "./diff.ts"
|
|
24
|
-
export { FrameworkError, RouteConfigError, type RouteConfigErrorCode } from "./errors.ts"
|
|
25
|
-
export * from "./idempotency.ts"
|
|
26
|
-
export { FRAMEWORK_NAME, type FrameworkName } from "./internal/brand.ts"
|
|
27
|
-
export * from "./invariants.ts"
|
|
28
|
-
export * from "./ledger.ts"
|
|
29
|
-
export * from "./manifest.ts"
|
|
30
|
-
export * from "./mount.ts"
|
|
31
|
-
export * from "./reflection.ts"
|
|
32
|
-
export { METHODS, type Method, Router, type RouterMatch } from "./router/router.ts"
|
|
33
|
-
export type {
|
|
34
|
-
InferInput,
|
|
35
|
-
InferOutput,
|
|
36
|
-
StandardIssue,
|
|
37
|
-
StandardResult,
|
|
38
|
-
StandardSchemaV1,
|
|
39
|
-
StandardTypes,
|
|
40
|
-
ValidationOutcome,
|
|
41
|
-
} from "./schema/standard.ts"
|
|
42
|
-
export { validateStandard } from "./schema/standard.ts"
|
|
43
|
-
export {
|
|
44
|
-
type RobotsOptions,
|
|
45
|
-
type RobotsRule,
|
|
46
|
-
robots,
|
|
47
|
-
type SitemapChangeFreq,
|
|
48
|
-
type SitemapEntry,
|
|
49
|
-
type SitemapOptions,
|
|
50
|
-
sitemap,
|
|
51
|
-
} from "./seo.ts"
|
|
52
|
-
export type {
|
|
53
|
-
Context,
|
|
54
|
-
Params,
|
|
55
|
-
Platform,
|
|
56
|
-
Prettify,
|
|
57
|
-
ResponseControls,
|
|
58
|
-
RouteSchema,
|
|
59
|
-
} from "./server/context.ts"
|
|
60
|
-
export {
|
|
61
|
-
type ContextForOp,
|
|
62
|
-
type ContractShape,
|
|
63
|
-
defineContract,
|
|
64
|
-
type HandlersFor,
|
|
65
|
-
implement,
|
|
66
|
-
type OperationDef,
|
|
67
|
-
type RegistryFor,
|
|
68
|
-
type RegistryFromImpl,
|
|
69
|
-
type ResponseDef,
|
|
70
|
-
} from "./server/contract.ts"
|
|
71
|
-
export {
|
|
72
|
-
type CookieOptions,
|
|
73
|
-
parseCookies,
|
|
74
|
-
serializeCookie,
|
|
75
|
-
signValue,
|
|
76
|
-
unsignValue,
|
|
77
|
-
} from "./server/cookies.ts"
|
|
78
|
-
export {
|
|
79
|
-
commonSecretPatterns,
|
|
80
|
-
jsonLogger,
|
|
81
|
-
type LogFields,
|
|
82
|
-
type Logger,
|
|
83
|
-
type RedactOptions,
|
|
84
|
-
redactLogFields,
|
|
85
|
-
silentLogger,
|
|
86
|
-
} from "./server/logger.ts"
|
|
87
|
-
export type { Registry, RouteInfo } from "./server/registry.ts"
|
|
88
|
-
export {
|
|
89
|
-
type AdmissionController,
|
|
90
|
-
type AdmissionDecision,
|
|
91
|
-
type AnyServer,
|
|
92
|
-
type DurableObjectNamespaceLike,
|
|
93
|
-
defineIdentityPlugin,
|
|
94
|
-
definePlugin,
|
|
95
|
-
defineRouterPlugin,
|
|
96
|
-
type ExecutionContext,
|
|
97
|
-
type Handler,
|
|
98
|
-
type IdentityPlugin,
|
|
99
|
-
type McpPromptDescriptor,
|
|
100
|
-
type McpResourceDescriptor,
|
|
101
|
-
type Middleware,
|
|
102
|
-
type NifraPlugin,
|
|
103
|
-
type NodeServeOutcome,
|
|
104
|
-
type OnRequestResult,
|
|
105
|
-
type PromptArgument,
|
|
106
|
-
type PromptMessage,
|
|
107
|
-
type ResponseFinalization,
|
|
108
|
-
type RouteDescriptor,
|
|
109
|
-
type RunningServer,
|
|
110
|
-
type ScheduledController,
|
|
111
|
-
type ScheduledHandler,
|
|
112
|
-
Server,
|
|
113
|
-
type ServerOptions,
|
|
114
|
-
server,
|
|
115
|
-
type ToolAnnotations,
|
|
116
|
-
toFetchHandler,
|
|
117
|
-
} from "./server/server.ts"
|
|
118
|
-
export {
|
|
119
|
-
type SSEContext,
|
|
120
|
-
type SSEInit,
|
|
121
|
-
type SSEMessage,
|
|
122
|
-
type SSEStream,
|
|
123
|
-
sse,
|
|
124
|
-
type TypedSSEStream,
|
|
125
|
-
typedSSEStream,
|
|
126
|
-
} from "./server/sse.ts"
|
|
127
|
-
export {
|
|
128
|
-
type SignatureEncoding,
|
|
129
|
-
type VerifyWebhookOptions,
|
|
130
|
-
verifyWebhook,
|
|
131
|
-
type WebhookFailureReason,
|
|
132
|
-
type WebhookProvider,
|
|
133
|
-
type WebhookResult,
|
|
134
|
-
} from "./server/webhook.ts"
|
|
135
|
-
export type {
|
|
136
|
-
NifraWebSocket,
|
|
137
|
-
StandardWebSocket,
|
|
138
|
-
WebSocketContext,
|
|
139
|
-
WebSocketData,
|
|
140
|
-
WebSocketHandler,
|
|
141
|
-
WebSocketUpgradeOutcome,
|
|
142
|
-
} from "./server/websocket.ts"
|
|
143
|
-
export { attachWebSocket, TopicRegistry } from "./server/websocket.ts"
|
|
17
|
+
export * from "./server.ts"
|