IF Commons GitHub

logical/redaction

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0003-headless-output FR-011

The redaction policy of an outcome (commons headless 0003-headless-output FR-011): before anything is drawn, logged or returned, every text of the outcome (messages, fixes, raw errors, outcome lines, steps, hints, the report's text, and every string of its data, however deep) passes through the program's redactor, so that no surface has to remember to. The mask is the governance's; the policy is where it is applied.

import { redactOutcome } from "./redaction.ts";
import { outcomeOf } from "./outcome.ts";
import { redactor } from "@intellectual-frontiers/headless/governance";
redactOutcome(outcomeOf({ url: "postgres://a:hunter22@h/x" }), redactor([])).data; // { url: "postgres://a:***@h/x" }

Source: commons/headless/src/logical/redaction.ts

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

logical.redactValuefunctionno test imports it
function redactValue(value: unknown, redact: Redactor): unknown

A value with every string in it redacted, whatever it is made of (arrays and plain objects are walked; other values are kept as they are).

logical.redactOutcomefunctionno test imports it
function redactOutcome<D>(o: Outcome<D>, redact: Redactor): Outcome<D>

The outcome with every text redacted. Redacting twice is redacting once.

logical.redactEventfunctionno test imports it
function redactEvent(event: ProgressEvent, redact: Redactor): ProgressEvent

A progress event with every text redacted: what a command tells while it runs is held to the policy as much as what it returns.

redactValuefunction
function redactValue(value: unknown, redact: Redactor): unknown

A value with every string in it redacted, whatever it is made of (arrays and plain objects are walked; other values are kept as they are).

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

redactOutcomefunction
function redactOutcome<D>(o: Outcome<D>, redact: Redactor): Outcome<D>

The outcome with every text redacted. Redacting twice is redacting once.

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

redactEventfunction
function redactEvent(event: ProgressEvent, redact: Redactor): ProgressEvent

A progress event with every text redacted: what a command tells while it runs is held to the policy as much as what it returns.

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

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