Exported from logbun.
Primitives
type DurabilityMode = 'volatile' | 'durable';
type QueueFullBehavior = 'dlq' | 'drop';
type TenancyMode = 'single_database' | 'database_per_tenant';Log shapes
interface LogbunLogInput<TAction extends string = string> {
tenantId?: string;
actorId: string;
action: TAction;
entityId?: string;
oldValues?: Record<string, unknown>;
newValues?: Record<string, unknown>;
metadata?: Record<string, unknown>;
}
interface LogbunLog<TAction extends string = string> extends LogbunLogInput<TAction> {
id: string; // UUIDv7 (RFC 9562 via Web Crypto)
createdAt: string; // ISO 8601 UTC (generated by the library)
ipAddress?: string; // Injected by framework plugins
userAgent?: string;
prevHash?: string;
contentHash?: string;
}id is time-sortable. Query order is newest-first by id.
Query
interface LogbunQueryFilters<TAction extends string = string> {
action?: TAction;
actorId?: string;
entityId?: string;
startDate?: string; // ISO 8601
endDate?: string;
}
interface LogbunQueryResult<TAction extends string = string> {
logs: LogbunLog<TAction>[];
nextCursor: string | null; // last row id, or null if no more pages
}Request context
Structural and runtime-neutral. Plugins populate it; you can pass it to fire / fireAsync yourself.
interface LogbunRequestContext {
ipAddress?: string;
userAgent?: string;
waitUntil?: (task: Promise<unknown>) => void;
resolveTenantId?: () => string | undefined;
}Hono passes an execution context’s waitUntil without exporting Cloudflare types from the root package.
Reliability
See Reliability for ReliabilityAdapter, DLQEntry, ClaimedDlqBatch, JournalRecoveryResult, ReliabilityStats, and DlqState.
Destination
See Custom adapter for IAdapter.
ENTERPRISE_DEFAULTS
const ENTERPRISE_DEFAULTS = {
mode: 'durable' as const,
requireTenantId: true,
} as const;