Skip to content
API reference

cloudflare

Import
import * as api from "@fungi.computer/carrier/cloudflare";
Kind Export Description
type alias CloudflareCarrierStorage Native SQLite and alarms; the Cloudflare adapter owns their atomic composition.
type alias CloudflareCarrierOptions Native storage/wake composition with exactly one provider capability.
type alias CloudflareCarrier Ordinary submission operations and the native Durable Object alarm door.
function createCloudflareCarrier() Construct one owner per Durable Object. Forward its native alarm to alarm. Acceptance commits the Email, recipient Messages, Watchdog job and wake together.
function cloudflareEmailTransport() The native binding as a Carrier transport. Exported so a host that holds the binding elsewhere (the Hub’s Cloudflare edge) classifies sends identically.

CloudflareCarrierStoragetype alias

Section titled “CloudflareCarrierStorage”
Signature
type CloudflareCarrierStorage = WatchdogSqliteOwner &
Pick<
DurableObjectStorage,
"transaction" | "getAlarm" | "setAlarm" | "deleteAlarm"
>;

Native SQLite and alarms; the Cloudflare adapter owns their atomic composition.


CloudflareCarrierOptionstype alias

Section titled “CloudflareCarrierOptions”
Signature
type CloudflareCarrierOptions = Readonly<{
storage: CloudflareCarrierStorage;
canSend?: (emailId) => Promise<boolean>;
}> &
| Readonly<{
email: SendEmail;
transport?: never;
}>
| Readonly<{
transport: Options["transport"];
email?: never;
}>;

Native storage/wake composition with exactly one provider capability.


CloudflareCarriertype alias

Section titled “CloudflareCarrier”
Signature
type CloudflareCarrier = Pick<Carrier, "send" | "get"> &
Readonly<{
alarm: () => Promise<void>;
}>;

Ordinary submission operations and the native Durable Object alarm door.

createCloudflareCarrier()function

Section titled “createCloudflareCarrier()”
Signature
function createCloudflareCarrier(options): Promise<CloudflareCarrier>;

Construct one owner per Durable Object. Forward its native alarm to alarm. Acceptance commits the Email, recipient Messages, Watchdog job and wake together.

Parameter Type
options CloudflareCarrierOptions

Promise<CloudflareCarrier>


cloudflareEmailTransport()function

Section titled “cloudflareEmailTransport()”
Signature
function cloudflareEmailTransport(binding): (email) => Promise<SendEvidence>;

The native binding as a Carrier transport. Exported so a host that holds the binding elsewhere (the Hub’s Cloudflare edge) classifies sends identically.

Parameter Type
binding SendEmail

(email) => Promise<SendEvidence>