IF Commons GitHub

logical/records/erga

Written to: 1 requirement: 0 proved, 0 partly, 0 failing, 1 with no test recorded. 0002-planning-core FR-011

The records of the monorepo's issues, read and written as they are (0037-planning FR-025, inventory entries 1 and 2): an issue file, erga/issue@1, a JSON5 text of an issue's events with a leading comment; an event object of the store, erga/issue-event@1; and the summary of a work's issues, erga/issues-index@1. Decoding is total and gives an error value for text that is not one of them. An event keeps its data as written, and encoding writes the bytes the monorepo's own writer writes (two spaces of indent, the events in the order of their time and then their id), so that a file decoded and encoded again is the same text. The records are public data of a schema and made-up files are the tests' fixtures; no private content is here.

import { decodeIssueFile, encodeIssueFile } from "./erga.ts";
// const f = decodeIssueFile(text); f.kind === "ok" && encodeIssueFile(f.value) === text

Source: commons/planning/src/logical/records/erga.ts

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

records.ISSUE_SCHEMAconstno test imports it
const ISSUE_SCHEMA: "erga/issue@1"

The schema of an issue file.

records.EVENT_SCHEMAconstno test imports it
const EVENT_SCHEMA: "erga/issue-event@1"

The schema of an event object of the store.

records.INDEX_SCHEMAconstno test imports it
const INDEX_SCHEMA: "erga/issues-index@1"

The schema of the summary of a work's issues.

records.ERGA_EVENT_TYPESconstno test imports it
const ERGA_EVENT_TYPES: readonly ["opened", "commented", "edited", "labeled", "assigned", "severity", "blocker", "closed", "reopened", "decided"]

The ten types of event of an issue file.

records.ErgaEventTypetypeno test imports it
type ErgaEventType = (typeof ERGA_EVENT_TYPES)[number];

One type of event of an issue file.

records.ErgaActortypeno test imports it
type ErgaActor = { readonly type: "person" | "agent" | "tool"; readonly id: string; readonly name?: string };

Who made an event: type person, agent or tool, an id and a name where it has one.

records.ErgaEventtypeno test imports it
type ErgaEvent = { readonly id: string; readonly at: string; readonly actor: ErgaActor; readonly type: ErgaEventType; readonly data?: Json };

One event: its id, its time (YYYY-MM-DDTHH:MM:SSZ), its actor, its type and its data as written.

records.ErgaIssueFiletypeno test imports it
type ErgaIssueFile = { readonly header: string; readonly id: string; readonly work: string; readonly events: readonly ErgaEvent[] };

An issue file: the comment that heads it as written, its id, its work and its events.

records.ErgaStoreEventtypeno test imports it
type ErgaStoreEvent = { readonly issue: string; readonly work: string; readonly event: ErgaEvent };

An event object of the store: the issue and the work it is of, and the event.

records.ErgaIndexEntrytypeno test imports it
type ErgaIndexEntry = { readonly id: string; readonly title: string; readonly state: "open" | "closed"; readonly… (450 characters)
type ErgaIndexEntry = {
  readonly id: string;
  readonly title: string;
  readonly state: "open" | "closed";
  readonly state_reason: string;
  readonly severity: string;
  readonly motivation: string;
  readonly blocker: boolean;
  readonly labels: readonly string[];
  readonly assignees: readonly string[];
  readonly author: string;
  readonly created: string;
  readonly updated: string;
  readonly comments: number;
  readonly source: Json;
};

One issue in the summary of a work's issues.

records.ErgaIndextypeno test imports it
type ErgaIndex = { readonly work: string; readonly updated: string; readonly open: number; readonly blockers: number; readonly issues: readonly ErgaIndexEntry[] };

The summary of a work's issues.

records.ErgaProblemtypeno test imports it
type ErgaProblem = { readonly kind: "erga"; readonly message: string };

Why a text is not one of the records.

records.decodeErgaEventfunctionno test imports it
function decodeErgaEvent(value: Json | undefined): Result<ErgaEvent, ErgaProblem>

One event from a JSON value, or why it is not one.

records.decodeIssueFilefunctionno test imports it
function decodeIssueFile(text: string): Result<ErgaIssueFile, ErgaProblem>

An issue file from its text, or why it is not one.

records.decodeStoreEventfunctionno test imports it
function decodeStoreEvent(text: string): Result<ErgaStoreEvent, ErgaProblem>

An event object of the store from its text, or why it is not one.

records.decodeIndexfunctionno test imports it
function decodeIndex(text: string): Result<ErgaIndex, ErgaProblem>

The summary of a work's issues from its text, or why it is not one.

records.ergaEventJsonfunctionno test imports it
function ergaEventJson(e: ErgaEvent): JsonObject

An event as a file writes it: id, at, actor, type, and data where it has any.

records.orderedErgaEventsfunctionno test imports it
function orderedErgaEvents(events: readonly ErgaEvent[]): readonly ErgaEvent[]

The events in the order they are written: by time, then by id.

records.encodeIssueFilefunctionno test imports it
function encodeIssueFile(f: ErgaIssueFile): string

The text of an issue file: its header, then the issue as JSON with two spaces of indent, the events in the order they are written.

records.encodeStoreEventfunctionno test imports it
function encodeStoreEvent(s: ErgaStoreEvent): string

The text of an event object of the store.

records.encodeIndexfunctionno test imports it
function encodeIndex(i: ErgaIndex): string

The text of the summary of a work's issues.

ISSUE_SCHEMAconstno test imports it
const ISSUE_SCHEMA: "erga/issue@1"

The schema of an issue file.

EVENT_SCHEMAconstno test imports it
const EVENT_SCHEMA: "erga/issue-event@1"

The schema of an event object of the store.

INDEX_SCHEMAconstno test imports it
const INDEX_SCHEMA: "erga/issues-index@1"

The schema of the summary of a work's issues.

ERGA_EVENT_TYPESconstno test imports it
const ERGA_EVENT_TYPES: readonly ["opened", "commented", "edited", "labeled", "assigned", "severity", "blocker", "closed", "reopened", "decided"]

The ten types of event of an issue file.

ErgaEventTypetypeno test imports it
type ErgaEventType = (typeof ERGA_EVENT_TYPES)[number];

One type of event of an issue file.

ErgaActortypeno test imports it
type ErgaActor = { readonly type: "person" | "agent" | "tool"; readonly id: string; readonly name?: string };

Who made an event: type person, agent or tool, an id and a name where it has one.

ErgaEventtypeno test imports it
type ErgaEvent = { readonly id: string; readonly at: string; readonly actor: ErgaActor; readonly type: ErgaEventType; readonly data?: Json };

One event: its id, its time (YYYY-MM-DDTHH:MM:SSZ), its actor, its type and its data as written.

ErgaIssueFiletypeno test imports it
type ErgaIssueFile = { readonly header: string; readonly id: string; readonly work: string; readonly events: readonly ErgaEvent[] };

An issue file: the comment that heads it as written, its id, its work and its events.

ErgaStoreEventtypeno test imports it
type ErgaStoreEvent = { readonly issue: string; readonly work: string; readonly event: ErgaEvent };

An event object of the store: the issue and the work it is of, and the event.

ErgaIndexEntrytypeno test imports it
type ErgaIndexEntry = { readonly id: string; readonly title: string; readonly state: "open" | "closed"; readonly… (450 characters)
type ErgaIndexEntry = {
  readonly id: string;
  readonly title: string;
  readonly state: "open" | "closed";
  readonly state_reason: string;
  readonly severity: string;
  readonly motivation: string;
  readonly blocker: boolean;
  readonly labels: readonly string[];
  readonly assignees: readonly string[];
  readonly author: string;
  readonly created: string;
  readonly updated: string;
  readonly comments: number;
  readonly source: Json;
};

One issue in the summary of a work's issues.

ErgaIndextypeno test imports it
type ErgaIndex = { readonly work: string; readonly updated: string; readonly open: number; readonly blockers: number; readonly issues: readonly ErgaIndexEntry[] };

The summary of a work's issues.

ErgaProblemtypeno test imports it
type ErgaProblem = { readonly kind: "erga"; readonly message: string };

Why a text is not one of the records.

decodeErgaEventfunctionno test imports it
function decodeErgaEvent(value: Json | undefined): Result<ErgaEvent, ErgaProblem>

One event from a JSON value, or why it is not one.

decodeIssueFilefunctionno test imports it
function decodeIssueFile(text: string): Result<ErgaIssueFile, ErgaProblem>

An issue file from its text, or why it is not one.

decodeStoreEventfunctionno test imports it
function decodeStoreEvent(text: string): Result<ErgaStoreEvent, ErgaProblem>

An event object of the store from its text, or why it is not one.

decodeIndexfunctionno test imports it
function decodeIndex(text: string): Result<ErgaIndex, ErgaProblem>

The summary of a work's issues from its text, or why it is not one.

ergaEventJsonfunctionno test imports it
function ergaEventJson(e: ErgaEvent): JsonObject

An event as a file writes it: id, at, actor, type, and data where it has any.

orderedErgaEventsfunctionno test imports it
function orderedErgaEvents(events: readonly ErgaEvent[]): readonly ErgaEvent[]

The events in the order they are written: by time, then by id.

encodeIssueFilefunctionno test imports it
function encodeIssueFile(f: ErgaIssueFile): string

The text of an issue file: its header, then the issue as JSON with two spaces of indent, the events in the order they are written.

encodeStoreEventfunctionno test imports it
function encodeStoreEvent(s: ErgaStoreEvent): string

The text of an event object of the store.

encodeIndexfunctionno test imports it
function encodeIndex(i: ErgaIndex): string

The text of the summary of a work's issues.

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