Classes

@system-inc/base-foundation · 515c140 · 12 symbols

A scheduled event for an alarm, allowing it to be passed to the worker for processing using the handleScheduled call.

implements ScheduledEvent

Members

  • alarmInfo?: any

  • AT_TARGET: 2

  • bubbles: boolean

  • BUBBLING_PHASE: 3

  • cancelable: boolean

  • cancelBubble: boolean

  • CAPTURING_PHASE: 1

  • composed: boolean

  • cron: string

  • currentTarget: EventTarget | null

  • defaultPrevented: boolean

  • eventPhase: number

  • isTrusted: boolean

  • NONE: 0

  • returnValue: boolean

  • scheduledTime: number

  • srcElement: EventTarget | null

  • target: EventTarget | null

  • timeStamp: number

  • type: string

  • composedPath(): EventTarget[]

  • initEvent(_type: string, _bubbles?: boolean, _cancelable?: boolean): void

  • noRetry(): void

  • preventDefault(): void

  • stopImmediatePropagation(): void

  • stopPropagation(): void

  • waitUntil(_promise: Promise<unknown>): void

View source ↗

A provider for creating containers.

Members

View source ↗

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>

View source ↗

The Cloudflare Durable Object wraps the DurableObject class and provides a BaseWorker instance to handle requests.

extends unknown

Members

  • settings: BaseSettings

  • environmentVariables: EnvironmentVariables

  • state: DurableObjectState

  • alarm(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>

View source ↗

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.

View source ↗

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>

View source ↗

Binding for a Cloudflare Container namespace. The name matches the binding declared in wrangler.toml. Used with @InjectContainerProvider(...).

extends TypedBinding

Members

  • name: string

  • toString(): string

View source ↗

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: string

  • toString(): string

View source ↗

Binding for a Cloudflare KV namespace. The name matches the binding declared in wrangler.toml. Used with @InjectKeyValueStorage(...).

extends TypedBinding

Members

  • name: string

  • toString(): string

View source ↗

Members

View source ↗

Binding for a Cloudflare R2 bucket. The name matches the binding declared in wrangler.toml. Used with @InjectObjectStore(...).

extends TypedBinding

Members

  • name: string

  • toString(): string

View source ↗

Factory to create ObjectStore instances bound to specific buckets.

Prefer to use the @InjectObjectStore() decorator when possible.

Members

  • createObjectStore(bucketToken: InjectionToken): ObjectStore

    Resolves 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): boolean

    Checks whether the bucket identified by bucketToken is both declared in objectStore.buckets and bound in the current worker environment.

View source ↗