EFFECTSconstno test imports itconst EFFECTS: readonly ["read", "mutate", "destructive"]What an operation does, from the least to the most: a closed list.
What an operation does to the world, in the three classes a consent can be given for: it reads, it changes, or it destroys. guarded holds a store to one of them, so that a program given a store with a class of consent cannot do more with it than the consent says, whatever the program does.
import { effectOf } from "./effect.ts";
import { parsePath } from "@intellectual-frontiers/anyfs/governance";
const p = parsePath("a");
p.kind === "ok" && effectOf({ op: "read", path: p.value }); // "read"EFFECTSconstno test imports itconst EFFECTS: readonly ["read", "mutate", "destructive"]What an operation does, from the least to the most: a closed list.
Effecttypeno test imports ittype Effect = (typeof EFFECTS)[number];One class of effect.
effectOffunctionfunction effectOf(op: Op): "destructive" | "mutate" | "read"What an operation does: a read reads, a write, an append and a rename change, a delete destroys, and a batch destroys where one of its changes does.
guardedfunctionfunction guarded<C extends Capability>(store: Store<C>, allowed: "destructive" | "mutate" | "read"): Store<Carried<C>>A store that refuses, as consent, every operation above the effect it is given. It has the capabilities of its argument.