records.ISSUE_SCHEMAconstno test imports itconst ISSUE_SCHEMA: "erga/issue@1"The schema of an issue file.
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) === textrecords.ISSUE_SCHEMAconstno test imports itconst ISSUE_SCHEMA: "erga/issue@1"The schema of an issue file.
records.EVENT_SCHEMAconstno test imports itconst EVENT_SCHEMA: "erga/issue-event@1"The schema of an event object of the store.
records.INDEX_SCHEMAconstno test imports itconst INDEX_SCHEMA: "erga/issues-index@1"The schema of the summary of a work's issues.
records.ERGA_EVENT_TYPESconstno test imports itconst 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 ittype ErgaEventType = (typeof ERGA_EVENT_TYPES)[number];One type of event of an issue file.
records.ErgaActortypeno test imports ittype 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 ittype 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 ittype 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 ittype 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 ittype 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 ittype 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 ittype ErgaProblem = { readonly kind: "erga"; readonly message: string };Why a text is not one of the records.
records.decodeErgaEventfunctionno test imports itfunction decodeErgaEvent(value: Json | undefined): Result<ErgaEvent, ErgaProblem>One event from a JSON value, or why it is not one.
records.decodeIssueFilefunctionno test imports itfunction decodeIssueFile(text: string): Result<ErgaIssueFile, ErgaProblem>An issue file from its text, or why it is not one.
records.decodeStoreEventfunctionno test imports itfunction 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 itfunction 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 itfunction ergaEventJson(e: ErgaEvent): JsonObjectAn event as a file writes it: id, at, actor, type, and data where it has any.
records.orderedErgaEventsfunctionno test imports itfunction orderedErgaEvents(events: readonly ErgaEvent[]): readonly ErgaEvent[]The events in the order they are written: by time, then by id.
records.encodeIssueFilefunctionno test imports itfunction encodeIssueFile(f: ErgaIssueFile): stringThe 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 itfunction encodeStoreEvent(s: ErgaStoreEvent): stringThe text of an event object of the store.
records.encodeIndexfunctionno test imports itfunction encodeIndex(i: ErgaIndex): stringThe text of the summary of a work's issues.
ISSUE_SCHEMAconstno test imports itconst ISSUE_SCHEMA: "erga/issue@1"The schema of an issue file.
EVENT_SCHEMAconstno test imports itconst EVENT_SCHEMA: "erga/issue-event@1"The schema of an event object of the store.
INDEX_SCHEMAconstno test imports itconst INDEX_SCHEMA: "erga/issues-index@1"The schema of the summary of a work's issues.
ERGA_EVENT_TYPESconstno test imports itconst 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 ittype ErgaEventType = (typeof ERGA_EVENT_TYPES)[number];One type of event of an issue file.
ErgaActortypeno test imports ittype 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 ittype 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 ittype 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 ittype 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 ittype 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 ittype 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 ittype ErgaProblem = { readonly kind: "erga"; readonly message: string };Why a text is not one of the records.
decodeErgaEventfunctionno test imports itfunction decodeErgaEvent(value: Json | undefined): Result<ErgaEvent, ErgaProblem>One event from a JSON value, or why it is not one.
decodeIssueFilefunctionno test imports itfunction decodeIssueFile(text: string): Result<ErgaIssueFile, ErgaProblem>An issue file from its text, or why it is not one.
decodeStoreEventfunctionno test imports itfunction decodeStoreEvent(text: string): Result<ErgaStoreEvent, ErgaProblem>An event object of the store from its text, or why it is not one.
decodeIndexfunctionno test imports itfunction 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 itfunction ergaEventJson(e: ErgaEvent): JsonObjectAn event as a file writes it: id, at, actor, type, and data where it has any.
orderedErgaEventsfunctionno test imports itfunction orderedErgaEvents(events: readonly ErgaEvent[]): readonly ErgaEvent[]The events in the order they are written: by time, then by id.
encodeIssueFilefunctionno test imports itfunction encodeIssueFile(f: ErgaIssueFile): stringThe 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 itfunction encodeStoreEvent(s: ErgaStoreEvent): stringThe text of an event object of the store.
encodeIndexfunctionno test imports itfunction encodeIndex(i: ErgaIndex): stringThe text of the summary of a work's issues.