close
Skip to main content

Built and signed on GitHub Actions

Works with
This package works with Cloudflare Workers
This package works with Cloudflare Workers
JSR Score94%
License
MIT
Downloads12/wk
Published3 days ago (2.2.1)

Classes

c
WorkersKvStore(namespace: WorkersKvNamespaceLike<string>)

Implementation of the KvStore interface for Cloudflare Workers KV binding. This class provides a wrapper around Cloudflare's KV namespace to store and retrieve JSON-serializable values using structured keys.

  • delete(key: KvKey): Promise<void>
    No documentation available
  • get<T = unknown>(key: KvKey): Promise<T | undefined>
    No documentation available
  • list(prefix?: KvKey): AsyncIterable<KvStoreListEntry>

    {@inheritDoc KvStore.list}

  • set(
    key: KvKey,
    value: unknown,
    options?: KvStoreSetOptions
    ): Promise<void>
    No documentation available
c
WorkersMessageQueue(
queue: Queue,
options?: WorkersMessageQueueOptions
)

Implementation of the MessageQueue interface for Cloudflare Workers Queues binding. This class provides a wrapper around Cloudflare's Queues to send messages to a queue.

  • enqueue(
    message: any,
    options?: MessageQueueEnqueueOptions
    ): Promise<void>
    No documentation available
  • enqueueMany(
    messages: readonly any[],
    options?: MessageQueueEnqueueOptions
    ): Promise<void>
    No documentation available
  • listen(
    _handler: (message: any) => Promise<void> | void,
    _options?: MessageQueueListenOptions
    ): Promise<void>
    No documentation available
  • nativeRetrial: boolean

    Cloudflare Queues provide automatic retry with exponential backoff and Dead Letter Queues.

  • processMessage(rawMessage: any): Promise<ProcessMessageResult>

    Processes a message from the queue, handling ordering key locks. Call this method before Federation.processQueuedTask to ensure ordering key semantics are respected.

Interfaces

I

Result from WorkersMessageQueue.processMessage.

  • message: any

    The unwrapped message payload to process. Only present when shouldProcess is true.

  • release: () => Promise<void>

    A cleanup function that must be called after processing the message. This releases the ordering key lock. Only present when shouldProcess is true and the message had an ordering key.

  • shouldProcess: boolean

    Whether the message should be processed. If false, the message has not been processed (for example, because an ordering key lock is still held) and the caller is responsible for re-enqueuing or retrying it when appropriate.

I

Minimal Cloudflare Workers KV binding shape used by this package. Compatible with both @cloudflare/workers-types and wrangler types generated declarations.

  • delete(key: Key): Promise<void>
    No documentation available
  • get(key: Key): Promise<string | null>
    No documentation available
  • getWithMetadata<Metadata = unknown>(key: Key): Promise<WorkersKvNamespaceGetWithMetadataResult<string, Metadata>>
    No documentation available
  • list<Metadata = unknown>(options?: WorkersKvNamespaceListOptions): Promise<WorkersKvNamespaceListResult<Metadata, Key>>
    No documentation available
  • put(
    key: Key,
    value: string,
    options?: WorkersKvNamespacePutOptions
    ): Promise<void>
    No documentation available
  • The prefix for ordering key lock keys. Defaults to "__fedify_ordering_".

  • orderingKv: WorkersKvNamespaceLike<string>

    The KV namespace to use for ordering key locks. If not provided, ordering keys will not be supported.

  • The TTL (time-to-live) for ordering key locks in seconds. Defaults to 60 seconds. Must be at least 60 seconds due to Cloudflare KV minimum TTL requirement.

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.