Skip to content

@xtandard/audit/bun

Bun adapter: auditPanel() returns the web-standard panel handler to hand to Bun.serve({ fetch }), with the core and the stream runner attached; withAuditContext() wraps a fetch handler so every request runs in an audit context scope (actor, tenant, IP, user agent, request id).

import { … } from "@xtandard/audit/bun";
Name Summary
auditContext auditContext(options) → a wrapper for a Bun.serve fetch handler; the curried form of withAuditContext, matching the other adapters’ name.
auditPanel Create a Bun-ready panel handler (fetch + core + streams + openapi).
withAuditContext Wrap a Bun.serve fetch handler so each request runs inside an audit context scope (ADR 0013): actor / tenant / context resolve from the request, and IP / user agent / request id are captured (the socket IP via server.requestIP is the fallback when no trusted proxy header is set).
Name Summary
AuditContextOptions Options for every framework’s auditContext() middleware. The callbacks receive the framework’s own request context (Hono’s c, Express’s req, Elysia’s ctx, Bun’s Request) so they can read whatever the host’s auth already resolved (a session, a decoded JWT, req.user, …).
BunServerLike The subset of Bun’s Server the context wrapper uses (for the socket IP).
Name Summary
BunFetch A Bun.serve fetch handler.
MaybePromise
Name Documented on
AuditPanelOptions @xtandard/audit
CreateFetchHandlerResult @xtandard/audit