post-d1
Type Aliases
Section titled “Type Aliases”SqlPostOptions
Section titled “SqlPostOptions”SqlPostOptions<
R> > =Readonly<{routes:R;failureDetail?: (cause) =>string;retry?:Readonly<{maxAttempts:number;baseDelayMs:number;maxDelayMs:number; }>;now: () =>number;scheduleWake: (at) =>Promise<void>>; }>
SQL native Carrier runtime configuration; route decisions remain in Post.
Type Parameters
Section titled “Type Parameters”R extends Record<string,
PostRegistryRoute>
SqlPostRuntime
Section titled “SqlPostRuntime”SqlPostRuntime =
Readonly<{execute: (job,signal?) =>Promise<Readonly<{kind:"completed"; }>>;enqueueDue: (limit?,afterKey?) =>Promise<string|undefined>>;read: (key) =>Promise<PostRow|undefined>>; }>
Async inspection and Watchdog executor shared by D1 and PostgreSQL.
D1PostSource
Section titled “D1PostSource”D1PostSource =
Readonly<{text:string;values: readonly (string|number|null)[]; }>
Trusted SELECT yielding post_key, envelope_json, queue_name, next_attempt_at and job_id.
D1Post
Section titled “D1Post”D1Post =
SqlPostRuntime&Readonly<{send: (envelope) => readonlyD1PreparedStatement[];sendFromSelect: (source) => readonlyD1PreparedStatement[]; }>
Post admission statements; callers commit them with the originating D1 fact.
D1PostErasureStatement
Section titled “D1PostErasureStatement”D1PostErasureStatement =
Readonly<{text:string;values: readonly (string|number|null)[]; }>
Native erasure statement; its values remain bound by the caller’s D1 driver.
Variables
Section titled “Variables”postD1Schema
Section titled “postD1Schema”
constpostD1Schema: readonlystring[]
Carrier-owned D1 schema, applied by the deployment migration owner.
Functions
Section titled “Functions”createD1Post()
Section titled “createD1Post()”createD1Post<
R>>(options):D1Post
Bind the Post registry to native D1 batch admission and the shared delivery engine.
Type Parameters
Section titled “Type Parameters”R extends Record<string, Readonly<{ addressKind: string;
address: Codec<unknown, unknown>; event: Codec<unknown,
unknown>; encodeEnvelope: (envelope) => object; parseDelivery:
(envelope) => object; prepareEnvelope?: (envelope, signal) =>
Promise<{ key: string; kind: string; address: unknown; event:
unknown; }>; recordDelivered?: (envelope) => void; nameOf:
(envelope) => string; namespace: Readonly<{ getByName: (name) =>
Readonly<{ deliver: (envelope) =>
Promise<PostDeliveryResult>; }>; }>;
recordCursor?: (envelope, cursor) => void; recordRefused?:
(envelope) => void; }>>
Parameters
Section titled “Parameters”options
Section titled “options”Readonly<{ routes: R; failureDetail?: (cause) => string; retry?:
Readonly<{ maxAttempts: number; baseDelayMs: number; maxDelayMs:
number; }>; now: () => number; scheduleWake: (at) =>
Promise<void>; }> & Readonly<{ database: D1Database; watchdog:
D1Watchdog; }>
Returns
Section titled “Returns”prepareD1PostAdmission()
Section titled “prepareD1PostAdmission()”prepareD1PostAdmission(
database,source): readonlyD1PreparedStatement[]
Prepare conditional envelopes and their jobs inside the producer’s D1 batch.
Parameters
Section titled “Parameters”database
Section titled “database”D1Database
source
Section titled “source”Returns
Section titled “Returns”readonly D1PreparedStatement[]
purgeD1Post()
Section titled “purgeD1Post()”purgeD1Post(
source): readonlyReadonly<{text:string;values: readonly (string|number|null)[]; }>[]
Remove selected recipient queues, including every envelope and attempt, atomically. The trusted SELECT yields queue_name from producer/envelope facts, not job state.
Parameters
Section titled “Parameters”source
Section titled “source”Returns
Section titled “Returns”readonly Readonly<{ text: string; values: readonly (string |
number | null)[]; }>[]