IF Commons GitHub

logical/outbox

Written to: 1 requirement: 0 proved, 0 partly, 0 failing, 1 with no test recorded. 0003-planning-reconcile FR-009

The outbox (0037-planning FR-014, FR-033): a patch is applied only to a source that declares the capability it needs; for any other it is an outbox entry that names the capability, or the reason the place cannot say it, and is offered again when a source that can apply it is given. Pure.

import { route } from "./outbox.ts";
// route(patch, { name: "markdown", capabilities }, now).kind // "apply" or "outbox"

Source: commons/planning/src/logical/outbox.ts

0 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.Routedtypeno test imports it
type Routed = { readonly kind: "apply"; readonly patch: Patch } | { readonly kind: "outbox"; readonly entry: OutboxEntry };

What a patch comes to for a source.

logical.routefunctionno test imports it
function route(patch: Patch, source: { readonly name: string; readonly capabilities: ReadonlySet<"append-event" | "assign" | "close" | "create" | "delete" | "edit" | "read">; }, at: Instant): Routed

Whether a patch is applied to a source with these capabilities or waits in the outbox, naming the capability the source lacks.

logical.redeliverfunctionno test imports it
function redeliver(entries: readonly OutboxEntry[], source: { readonly name: string; readonly capabilities: ReadonlySet<"append-event" | "assign" | "close" | "create" | "delete" | "edit" | "read">; }, place: string): { readonly patches: readonly Patch[]; readonly waiting: readonly OutboxEntry[]; }

The entries a source can now apply, as patches for that source and place, and the entries that still wait.

Routedtypeno test imports it
type Routed = { readonly kind: "apply"; readonly patch: Patch } | { readonly kind: "outbox"; readonly entry: OutboxEntry };

What a patch comes to for a source.

routefunctionno test imports it
function route(patch: Patch, source: { readonly name: string; readonly capabilities: ReadonlySet<"append-event" | "assign" | "close" | "create" | "delete" | "edit" | "read">; }, at: Instant): Routed

Whether a patch is applied to a source with these capabilities or waits in the outbox, naming the capability the source lacks.

redeliverfunctionno test imports it
function redeliver(entries: readonly OutboxEntry[], source: { readonly name: string; readonly capabilities: ReadonlySet<"append-event" | "assign" | "close" | "create" | "delete" | "edit" | "read">; }, place: string): { readonly patches: readonly Patch[]; readonly waiting: readonly OutboxEntry[]; }

The entries a source can now apply, as patches for that source and place, and the entries that still wait.

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