CORE_CAPABILITIESconstconst CORE_CAPABILITIES: readonly ["read", "write", "list", "stat", "delete"]The capabilities every store has.
What a store can do, as a closed union: five core capabilities every store has and nine optional ones a store says it has, each with one sentence. The capabilities of a store are in its type, so that code which needs one cannot be given a store without it. A store also declares how consistent it is and two traits that code cannot discover any other way.
import { isCapability } from "./capability.ts";
isCapability("cas"); // true
isCapability("chmod"); // falseCORE_CAPABILITIESconstconst CORE_CAPABILITIES: readonly ["read", "write", "list", "stat", "delete"]The capabilities every store has.
const OPTIONAL_CAPABILITIES: readonly ["cas", "batch", "rename", "watch", "lock", "history", "rangeRead", "append", "search", "merge"]The capabilities a store may have.
CAPABILITIESconstconst CAPABILITIES: readonly ["read", "write", "list", "stat", "delete", "cas", "batch", "rename", "watch", "lock", "history", "rangeRead", "append", "search", "merge"]Every capability, the core ones first.
CoreCapabilitytypetype CoreCapability = (typeof CORE_CAPABILITIES)[number];One of the core capabilities.
Capabilitytypeno test imports ittype Capability = (typeof CAPABILITIES)[number];One capability of a store: a closed union.
CAPABILITY_SUMMARYconstconst CAPABILITY_SUMMARY: Readonly<Record<"append" | "batch" | "cas" | "delete" | "history" | "list" | "lock" | "merge" | "rangeRead" | "read" | "rename" | "search" | "stat" | "watch" | "write", string>>What each capability adds, in a sentence: a registry with one entry for each capability, which the compiler holds.
isCapabilityfunctionfunction isCapability(text: string): text is "append" | "batch" | "cas" | "delete" | "history" | "list" | "lock" | "merge" | "rangeRead" | "read" | "rename" | "search" | "stat" | "watch" | "write"Whether a text is the name of a capability.
CONSISTENCIESconstconst CONSISTENCIES: readonly ["strong", "read-your-writes", "eventual-listing", "eventual-merge"]How consistent a store is: strong (every read sees the last write and a list sees every object), read-your-writes (a writer sees its own writes) eventual-listing (a list may lag behind the objects) or eventual-merge (a replica holds what it has made and taken, and every two replicas that have taken each other's changes hold the same).
Consistencytypeno test imports ittype Consistency = (typeof CONSISTENCIES)[number];One way a store is consistent.
Traitstypeno test imports ittype Traits = { readonly caseSensitive: boolean; readonly maxObject?: number };What a caller cannot discover any other way: whether the store tells paths apart by case, and the largest object it holds where it has a limit (in bytes).