/** * Resolving a scope's Durable Object to something an operator can OPEN. * * A scope's data lives in one Durable Object, named after the scope id inside a namespace * (a class × a script). The console has always been able to say the name; the dashboard, * however, addresses a namespace by an id Cloudflare assigns — not by the class or the * script — so without that id the best a link could do was the account-wide namespace * list, which on a real fleet is one entry per pushed script. * * This is the seam that closes the gap: given the script a scope serves from, hand back * the namespaces defined in it. Injected by the host like every other Cloudflare read * (D-34: this package holds no SDK and no credential), and entirely optional — absent, the * console falls back to the namespace list exactly as before. */ /** One Durable Object namespace as Cloudflare describes it. */ export interface DoNamespaceRecord { /** The dashboard's address for this namespace — the whole point of the read. */ id: string; /** The exported class the namespace is defined by (e.g. `ScopeDO`). */ className: string; /** The script defining it — a dispatch-namespace script name for a pushed vertical. */ script: string | null; name: string | null; useSqlite: boolean; } export interface DoNamespaceReader { /** Every Durable Object namespace on the account. Filtering by script happens above: * Cloudflare's list endpoint takes no filter, and a reader that pretended otherwise * would hide the pagination cost from the one place that can cache it. */ list(): Promise; } export interface CfDoNamespaceOptions { accountId: string; apiToken: string; /** Injected for tests. */ fetchImpl?: typeof fetch; /** * How long a listing stays fresh. The mapping changes only when a script is pushed or * deleted, and the read is one-or-more paginated API calls that would otherwise run on * every scope-detail open — so the default trades a few minutes of staleness (worst * case: a just-pushed script's namespace is not linkable yet) for not hammering the API. */ ttlMs?: number; /** Hard cap on pages walked, so an account with a very large fleet degrades to a slow * read rather than an unbounded one. */ maxPages?: number; } /** * A {@link DoNamespaceReader} over Cloudflare's account-wide list endpoint, with a small * TTL cache. Pure web-standard `fetch`, like every other Cloudflare seam in this package. */ export declare function createCfDoNamespaceReader(opts: CfDoNamespaceOptions): DoNamespaceReader; /** * The namespaces defined in one script, most-likely-scope-class first. * * A vertical's script defines several classes (the scope DO, an identity DO, sweepers), so * ORDER is the useful part: the console links the first entry, and a scope's data is in the * scope class. Matching is on the class name because that is the only stable signal — the * namespace's `name` is Cloudflare's, and the binding name lives in the script's settings, * not here. Every namespace of the script is still returned, so a vertical that named its * class something else is one click away rather than unreachable. */ export declare function namespacesForScript(rows: DoNamespaceRecord[], script: string): DoNamespaceRecord[]; //# sourceMappingURL=do-namespaces.d.ts.map