src/offaccount.ts
26 lines and 1 functions in DrDustinEdwards/capsid, at commit daa875b on 2026-10-24. This file on GitHub.
Functions
| Function | Lines | Complexity | Covered | CRAP | Mutation |
|---|---|---|---|---|---|
| isOffaccountSite | 28 to 30 | 1 | 100% | OkCRAP 1 | No data: mutation testing has not run on this repo yet |
Imports
It imports no other module of this repo. Imported by src/signed-requests.ts.
Source
// The sites whose d1-dump runs the private capsid-backups repo copies off the Cloudflare
// account (capsid/rulings/backups-offaccount-2026-10-10.md). /backup/credential mints a
// read credential only for a bucket named here, so the bucket comes from this pinned
// table and never from the request or from an editable row such as ops_sites.
//
// Each site dumps into its own bucket under d1-dump's prefix, BACKUP_DUMP_PREFIX in
// src/signed-requests.ts. txasm dumps into its books bucket rather than a backups one.
// dustinedwards joined 2026-10-15, after its nightly dump (dustinedwards-info #439, on the
// watchdog Worker) completed and passed its first drill (job_e40ec706c10a).
export const OFFACCOUNT_SOURCES = {
capsid: { bucket: "capsid-media" },
germomics: { bucket: "germomics-backups" },
txasm: { bucket: "txasm-books" },
foxing: { bucket: "foxing-backups" },
foxhound: { bucket: "foxhound-backups" },
dustinedwards: { bucket: "dustinedwards-backups" },
} as const satisfies Record<string, { bucket: string }>;
export type OffaccountSite = keyof typeof OFFACCOUNT_SOURCES;
// A request with no site is capsid's, so mirror.yml and restore-rehearsal.yml, which
// send none, keep working through the cutover.
export const OFFACCOUNT_DEFAULT_SITE: OffaccountSite = "capsid";
export const OFFACCOUNT_SITES = Object.keys(OFFACCOUNT_SOURCES) as OffaccountSite[];
// Own keys only, so "constructor" or "__proto__" is an unknown site like any other.
export function isOffaccountSite(site: string): site is OffaccountSite {
return Object.hasOwn(OFFACCOUNT_SOURCES, site);
}