viewablefunctionfunction viewable(store: StoreBase): Store<"list" | "read" | "stat"> | undefinedThe store as something that can be read: read, list and stat.
The capabilities a verb needs of a store, asked at run time (commons anyfs-cli 0003-anyfs-cli-logical FR-004): an opener gives a store whose capabilities are known only when it is open, so each verb asks for the capabilities it uses and ends with a sentence that names what is missing where the store has none of them. The casts are here and only here, each after the check of the set of capabilities that the type promises.
import { viewable } from "./stores.ts";
// const store = viewable(opened); store === undefined ? "cannot be listed" : "ok";viewablefunctionfunction viewable(store: StoreBase): Store<"list" | "read" | "stat"> | undefinedThe store as something that can be read: read, list and stat.
sourceOffunctionfunction sourceOf(store: StoreBase): Store<"list" | "read" | "stat"> | undefinedThe store as the source of a transfer.
movableOffunctionfunction movableOf(store: StoreBase): Store<"delete" | "list" | "read" | "stat"> | undefinedThe store as the source of a move: it can also delete.
destOffunctionfunction destOf(store: StoreBase): Store<"delete" | "list" | "read" | "stat" | "write"> | undefinedThe store as the destination of a transfer: it can be read, written, listed, and have objects deleted.
capabilityNamesfunctionfunction capabilityNames(store: StoreBase): readonly ("append" | "batch" | "cas" | "delete" | "history" | "list" | "lock" | "merge" | "rangeRead" | "read" | "rename" | "search" | "stat" | "watch" | "write")[]The names of the capabilities of a store that a person would want to see, in a fixed order.
missingfunctionfunction missing(store: StoreBase, needed: readonly ("append" | "batch" | "cas" | "delete" | "history" | "list" | "lock" | "merge" | "rangeRead" | "read" | "rename" | "search" | "stat" | "watch" | "write")[]): readonly ("append" | "batch" | "cas" | "delete" | "history" | "list" | "lock" | "merge" | "rangeRead" | "read" | "rename" | "search" | "stat" | "watch" | "write")[]The capabilities of needed that a store lacks.