records.EVENT_FILE_SCHEMAconstno test imports itconst EVENT_FILE_SCHEMA: "planning/event@1"The schema of an event file.
The files of a store and of a published edition (0037-planning FR-038), in JSON5, which the library encodes and decodes at its boundary with the codec of formats. The store has one file for each event, <item>/<event>.json5, so that two stores merge by the union of their files; the edition has one file for each item that holds its events in the order of fold. Each file has an order of keys that does not change, the order of RFC 8785 section 3.2.3 (by property name, recursively), so that a diff of two stores is a diff of events. Decoding is total: a text that is not an event or an item of the schema is an error value, and an event that breaks a rule of the actors (an agent with no principal, a person that names an agent) is refused when it is read.
import { decodeEvent, encodeEvent, eventPath } from "./store.ts";
// decodeEvent(encodeEvent(event)) is the event, and eventPath(event) is "<item>/<event>.json5"records.EVENT_FILE_SCHEMAconstno test imports itconst EVENT_FILE_SCHEMA: "planning/event@1"The schema of an event file.
records.ITEM_FILE_SCHEMAconstno test imports itconst ITEM_FILE_SCHEMA: "planning/item@1"The schema of an item file of the published edition.
records.CodecProblemtypeno test imports ittype CodecProblem = { readonly kind: "codec"; readonly message: string };Why a text is not an event or an item of the schema.
records.jsonOffunctionno test imports itfunction jsonOf(value: unknown): JsonA value as JSON with its properties in the order of their names, recursively, and a property that is undefined left out.
records.eventPathfunctionno test imports itfunction eventPath(e: Pick<ItemEvent, "id" | "item">): stringThe place of an event's file in a store: the item's folder and the event's name.
records.itemPathfunctionno test imports itfunction itemPath(item: ItemId): stringThe place of an item's file in a published edition.
records.eventToJsonfunctionno test imports itfunction eventToJson(e: ItemEvent): JsonAn event as a JSON value: its head, its type and the data of the type, keys in order.
records.encodeEventfunctionno test imports itfunction encodeEvent(e: ItemEvent): stringThe text of an event's file.
records.encodeItemfunctionno test imports itfunction encodeItem(events: readonly ItemEvent[]): Result<string, CodecProblem>The text of an item's file in a published edition: its events in the order of fold, which is the order of their id.
records.eventDataOfJsonfunctionno test imports itfunction eventDataOfJson(type: string, d: JsonObject): Result<EventData, CodecProblem>The data of an event of a type from its JSON object, or why it is not one.
records.eventOfJsonfunctionno test imports itfunction eventOfJson(j: Json | undefined): Result<ItemEvent, CodecProblem>One event from a JSON value, or why it is not one of the schema.
records.decodeEventfunctionno test imports itfunction decodeEvent(source: string): Result<ItemEvent, CodecProblem>An event from the text of its file, or why it is not one of the schema.
records.decodeItemfunctionno test imports itfunction decodeItem(source: string): Result<readonly ItemEvent[], CodecProblem>The events of an item from the text of its file in a published edition, or why it is not an item of the schema.
EVENT_FILE_SCHEMAconstno test imports itconst EVENT_FILE_SCHEMA: "planning/event@1"The schema of an event file.
ITEM_FILE_SCHEMAconstno test imports itconst ITEM_FILE_SCHEMA: "planning/item@1"The schema of an item file of the published edition.
CodecProblemtypeno test imports ittype CodecProblem = { readonly kind: "codec"; readonly message: string };Why a text is not an event or an item of the schema.
jsonOffunctionno test imports itfunction jsonOf(value: unknown): JsonA value as JSON with its properties in the order of their names, recursively, and a property that is undefined left out.
eventPathfunctionno test imports itfunction eventPath(e: Pick<ItemEvent, "id" | "item">): stringThe place of an event's file in a store: the item's folder and the event's name.
itemPathfunctionno test imports itfunction itemPath(item: ItemId): stringThe place of an item's file in a published edition.
eventToJsonfunctionno test imports itfunction eventToJson(e: ItemEvent): JsonAn event as a JSON value: its head, its type and the data of the type, keys in order.
encodeEventfunctionno test imports itfunction encodeEvent(e: ItemEvent): stringThe text of an event's file.
encodeItemfunctionno test imports itfunction encodeItem(events: readonly ItemEvent[]): Result<string, CodecProblem>The text of an item's file in a published edition: its events in the order of fold, which is the order of their id.
eventDataOfJsonfunctionno test imports itfunction eventDataOfJson(type: string, d: JsonObject): Result<EventData, CodecProblem>The data of an event of a type from its JSON object, or why it is not one.
eventOfJsonfunctionno test imports itfunction eventOfJson(j: Json | undefined): Result<ItemEvent, CodecProblem>One event from a JSON value, or why it is not one of the schema.
decodeEventfunctionno test imports itfunction decodeEvent(source: string): Result<ItemEvent, CodecProblem>An event from the text of its file, or why it is not one of the schema.
decodeItemfunctionno test imports itfunction decodeItem(source: string): Result<readonly ItemEvent[], CodecProblem>The events of an item from the text of its file in a published edition, or why it is not an item of the schema.