http/route_spec.ts view source
RouteContext import type {RouteContext} from '@fuzdev/fuz_app/http/route_spec.js'; Per-request deps provided by the framework to route handlers.
Audit writes and other rollback-resilient fire-and-forget calls run
through AppDeps.audit.emit(ctx, input) (see auth/audit_emitter.ts),
which captures the pool inside its closure — handlers can never
accidentally write audits against the request transaction.
Routes whose body manages its own transaction (signup, bootstrap)
declare transaction: false on the spec, which makes route.db the
pool — they reach for it directly.
db
Transaction-scoped when RouteSpec.transaction is true (the default
for non-GET); pool-level otherwise.
type Db
pending_effects
Eager fire-and-forget queue — push the in-flight Promise<void> for
pool writes already running (audit emits, api-token usage
tracking). The flush middleware drains via
flush_pending_effects after the handler returns.
type Promise<void>[]
post_commit_effects
Deferred post-commit thunks — do not push directly; reach for
emit_after_commit(ctx, fn) from http/pending_effects.ts. The flush
middleware invokes each thunk after the handler (and any wrapping
db.transaction) returns, closing the microtask-ordering window
that an eager Promise.resolve().then(fn) leaves open inside the
transaction.
type (() => void | Promise<void>)[]