durable-utils
Version:
Utilities for Cloudflare Durable Objects and Workers, including SQL migrations, sharding and retry utilities, and more.
16 lines (15 loc) • 1.01 kB
TypeScript
import { DurableObjectNamespace, DurableObjectNamespaceGetDurableObjectOptions, DurableObjectStub, Rpc } from "@cloudflare/workers-types";
/**
* Tiny utility to get a Durable Object stub by name using `idFromName`.
* @param doNamespace The Durable Object namespace to create a stub from.
* @param name The name of the Durable Object to access.
* @param options Same options as `DurableObjectNamespace.get`. See https://developers.cloudflare.com/durable-objects/api/namespace/#get.
* @returns A Durable Object stub.
*/
export declare function stubByName<T extends Rpc.DurableObjectBranded | undefined>(doNamespace: DurableObjectNamespace<T>, name: string, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;
/**
* Returns true if the given error is retryable according to the Durable Object error handling.
* See https://developers.cloudflare.com/durable-objects/best-practices/error-handling/.
* @param err
*/
export declare function isErrorRetryable(err: unknown): boolean;