IF Commons GitHub

logical/effect

Written to: 2 requirements: 2 proved, 0 partly, 0 failing, 0 with no test recorded. 0003-anyfs-logical FR-001, 0003-anyfs-logical FR-006

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"

Source: commons/anyfs/src/logical/effect.ts

2 of 4 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

EFFECTSconstno test imports it
const EFFECTS: readonly ["read", "mutate", "destructive"]

What an operation does, from the least to the most: a closed list.

Effecttypeno test imports it
type Effect = (typeof EFFECTS)[number];

One class of effect.

effectOffunction
function 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.

Imported by 12 tests of the run (12 passed, 0 failed): the library's results

guardedfunction
function 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.

Imported by 6 tests of the run (6 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.