Skip to content
API reference

d1

Import
import * as api from "@fungi.computer/watchdog/d1";
Kind Export Description
type alias D1AdmissionSource Trusted parameter-bound SELECT yielding queued job fields; never lifecycle fields.
type alias D1Admission D1 runtime with admission statements that join the producer’s native batch.
type alias D1Watchdog D1 lifecycle and native transaction admission.
type alias D1PurgeStatement Parameterized native purge; caller commits it with its own erasure facts.
type alias AsyncWatchdogOptions Host execution and wake scheduling for a shared-database Watchdog.
type alias AsyncWatchdogRuntime Shared-database runtime; native admission replaces the SQLite projection.
constant watchdogD1Schema Package-owned schema statements, to run through the deployment migration owner.
function createD1Watchdog() Open the shared Effect engine on a migrated D1 database; no implicit schema writes.
function prepareD1Admission() Prepare native admission without constructing an executor or performing I/O.
function purgeD1Queues() Purge every attempt in selected queues, fencing any executor still holding a claim. The trusted SELECT yields queue_name. It never supplies lifecycle mutations.

D1AdmissionSourcetype alias

Section titled “D1AdmissionSource”
Signature
type D1AdmissionSource = Readonly<{
text: string;
values: readonly (string | number | null)[];
}>;

Trusted parameter-bound SELECT yielding queued job fields; never lifecycle fields.


D1Admissiontype alias

Section titled “D1Admission”
Signature
type D1Admission = Readonly<{
enqueue: (job) => D1PreparedStatement;
enqueueFromSelect: (source) => D1PreparedStatement;
}>;

D1 runtime with admission statements that join the producer’s native batch.


D1Watchdogtype alias

Section titled “D1Watchdog”
Signature
type D1Watchdog = AsyncWatchdogRuntime & D1Admission;

D1 lifecycle and native transaction admission.


D1PurgeStatementtype alias

Section titled “D1PurgeStatement”
Signature
type D1PurgeStatement = Readonly<{
text: string;
values: readonly (string | number | null)[];
}>;

Parameterized native purge; caller commits it with its own erasure facts.


AsyncWatchdogOptionstype alias

Section titled “AsyncWatchdogOptions”
Signature
type AsyncWatchdogOptions = Readonly<{
execute: WatchdogExecutor;
wake: Readonly<{
recompute: () => Promise<void>;
}>;
now?: () => number;
}>;

Host execution and wake scheduling for a shared-database Watchdog.


AsyncWatchdogRuntimetype alias

Section titled “AsyncWatchdogRuntime”
Signature
type AsyncWatchdogRuntime = Omit<WatchdogRuntime, "transactional">;

Shared-database runtime; native admission replaces the SQLite projection.

watchdogD1Schemaconstant

Section titled “watchdogD1Schema”
Signature
const watchdogD1Schema: readonly string[];

Package-owned schema statements, to run through the deployment migration owner.

createD1Watchdog()function

Section titled “createD1Watchdog()”
Signature
function createD1Watchdog(options): D1Watchdog;

Open the shared Effect engine on a migrated D1 database; no implicit schema writes.

Parameter Type
options Readonly<{ execute: WatchdogExecutor; wake: Readonly<{ recompute: () => Promise<void>; }>; now?: () => number; }> & Readonly<{ database: D1Database; }>

D1Watchdog


prepareD1Admission()function

Section titled “prepareD1Admission()”
Signature
function prepareD1Admission(database): D1Admission;

Prepare native admission without constructing an executor or performing I/O.

Parameter Type
database D1Database

D1Admission


purgeD1Queues()function

Section titled “purgeD1Queues()”
Signature
function purgeD1Queues(source): readonly Readonly<{
text: string;
values: readonly (string | number | null)[];
}>[];

Purge every attempt in selected queues, fencing any executor still holding a claim. The trusted SELECT yields queue_name. It never supplies lifecycle mutations.

Parameter Type
source D1PurgeStatement

readonly Readonly<{ text: string; values: readonly (string | number | null)[]; }>[]