Classes
@system-inc/base-foundation · 515c140 · 12 symbols
AlarmScheduledEvent
A scheduled event for an alarm, allowing it to be passed to the worker for processing using the handleScheduled call.
implements ScheduledEvent
Members
alarmInfo?:anyAT_TARGET:2bubbles:booleanBUBBLING_PHASE:3cancelable:booleancancelBubble:booleanCAPTURING_PHASE:1composed:booleancron:stringcurrentTarget:EventTarget | nulldefaultPrevented:booleaneventPhase:numberisTrusted:booleanNONE:0returnValue:booleanscheduledTime:numbersrcElement:EventTarget | nulltarget:EventTarget | nulltimeStamp:numbertype:stringcomposedPath():EventTarget[]initEvent(_type:string,_bubbles?:boolean,_cancelable?:boolean):voidnoRetry():voidpreventDefault():voidstopImmediatePropagation():voidstopPropagation():voidwaitUntil(_promise:Promise<unknown>):void
CfContainerProvider
A provider for creating containers.
Members
getContainer(input?:CfDurableObjectInput):CfContainerHandle<RpcInterface, ContainerEnv>getRandomContainer(instances:number):CfContainerHandle<RpcInterface, ContainerEnv>static create(namespace:string,baseConfiguration:BaseConfiguration):CfContainerProvider<RpcInterface, ContainerEnv>
CfContainerWorker
This class is a shim for the worker fetch entry point. In production it does nothing, other than provide a required fetch method for the worker. In Base project Durable Objects are deployed as separate workers to avoid meta cross contamination, so this class faciliates that.
In development this forwards all the requests to the durable object for local development. This is useful if you want to talk to a durable object directly during, e.g. fetch directly rather than through a seperate script bindings.
Members
fetch(request:Request,environmentVariables:EnvironmentVariables,_executionContext:ExecutionContext):Promise<Response>
CfDurableObject
The Cloudflare Durable Object wraps the DurableObject class and provides a BaseWorker instance to handle requests.
extends unknown
Members
settings:BaseSettingsenvironmentVariables:EnvironmentVariablesstate:DurableObjectStatealarm(alarmInfo?:any):Promise<void>fetch(request:Request):Promise<Response>webSocketClose(webSocket:WebSocket):Promise<void>webSocketError(webSocket:WebSocket,error:unknown):Promise<void>webSocketMessage(webSocket:WebSocket,message:string | ArrayBuffer):Promise<void>
A provider for creating durable objects.
Members
getDurableObject(input?:CfDurableObjectInput):CfDurableObjectHandle<RpcInterface, StubRpcInterface>Gets a durable object handle for the specified input.
If no input is provided, a new durable object will be created with a unique id.
static create(namespace:string,baseConfiguration:BaseConfiguration):CfDurableObjectProvider<RpcInterface, StubRpcInterface>Creates a new CloudflareDurableObjectProvider for the specified namespace.
This class is a shim for the worker fetch entry point. In production it does nothing, other than provide a required fetch method for the worker. In Base project Durable Objects are deployed as separate workers to avoid meta cross contamination, so this class faciliates that.
In development this forwards all the requests to the durable object for local development. This is useful if you want to talk to a durable object directly during, e.g. fetch directly rather than through a seperate script bindings.
Members
fetch(request:Request,environmentVariables:EnvironmentVariables,_executionContext:ExecutionContext):Promise<Response>
ContainerBinding
Binding for a Cloudflare Container namespace. The name matches the
binding declared in wrangler.toml. Used with
@InjectContainerProvider(...).
extends TypedBinding
Members
name:stringtoString():string
DurableObjectBinding
Binding for a Cloudflare Durable Object namespace. The name matches
the binding declared in wrangler.toml. Used with
@InjectDurableObjectProvider(...).
The RpcInterface parameter is the RPC type exposed by the durable
object class; the lint rule and decorator return type thread it
through as CfDurableObjectProvider<RpcInterface, StubRpcInterface>.
extends TypedBinding
Members
name:stringtoString():string
Binding for a Cloudflare KV namespace. The name matches the binding
declared in wrangler.toml. Used with
@InjectKeyValueStorage(...).
extends TypedBinding
Members
name:stringtoString():string
Members
createKeyValueStorage(storageToken:InjectionToken):KeyValueStorage
ObjectStoreBinding
Binding for a Cloudflare R2 bucket. The name matches the binding
declared in wrangler.toml. Used with @InjectObjectStore(...).
extends TypedBinding
Members
name:stringtoString():string
ObjectStoreFactory
Factory to create ObjectStore instances bound to specific buckets.
Prefer to use the @InjectObjectStore() decorator when possible.
Members
createObjectStore(bucketToken:InjectionToken):ObjectStoreResolves an ObjectStore bound to the bucket identified by
bucketToken(typically an ObjectStoreBinding instance, but any DI token that resolves to a bucket name works).hasBucket(bucketToken:InjectionToken):booleanChecks whether the bucket identified by
bucketTokenis both declared inobjectStore.bucketsand bound in the current worker environment.