IF Commons GitHub

governance/ids

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

The ids of Planning: an item id and an event id are each a UUID version 7 as 36 lower case characters (RFC 9562 section 5.7), branded and made only by a smart constructor that returns a Result (0037-planning FR-007). The syntax is the one of the version id of AnyFS, which makes them with its hybrid clock (the logical layer mints them); an id of another scheme is an external id, a source's name and a value, kept as the source named it and never written into the wording of an id (FR-044).

import { parseItemId } from "./ids.ts";
parseItemId("018f3a6e-7c00-7000-8123-456789abcdef"); // { kind: "ok", value: "018f3a6e-7c00-7000-8123-456789abcdef" }

Source: commons/planning/src/governance/ids.ts

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

governance.ItemIdtypeno test imports it
type ItemId = Brand<string, "plan item id">;

The id of an item: a UUID version 7. Made only by parseItemId, or by the clock.

governance.EventIdtypeno test imports it
type EventId = Brand<string, "plan event id">;

The id of an event: a UUID version 7. Made only by parseEventId, or by the clock.

governance.IdProblemtypeno test imports it
type IdProblem =
  | { readonly kind: "not-uuid-v7"; readonly what: "item id" | "event id"; readonly text: string }
  | { readonly kind: "bad-external-id"; readonly message: string };

An id that is not one.

governance.parseItemIdfunctionno test imports it
function parseItemId(text: string): Result<ItemId, IdProblem>

An item id from text, or why it is not one.

governance.parseEventIdfunctionno test imports it
function parseEventId(text: string): Result<EventId, IdProblem>

An event id from text, or why it is not one.

governance.idTimefunctionno test imports it
function idTime(id: EventId | ItemId): IdTime

The time an id holds: the milliseconds and the counter that orders ids of one millisecond.

governance.ExternalIdtypeno test imports it
type ExternalId = { readonly source: string; readonly value: string };

The id an item or an event has in the place it was read from, named by that place: the source's name and the value, as the source wrote it.

governance.externalIdfunctionno test imports it
function externalId(source: string, value: string): Result<ExternalId, IdProblem>

An external id, or why the two texts are not one: each is non-empty, with no control character, and the source's name is at most 64 characters and the value at most 256.

ItemIdtypeno test imports it
type ItemId = Brand<string, "plan item id">;

The id of an item: a UUID version 7. Made only by parseItemId, or by the clock.

EventIdtypeno test imports it
type EventId = Brand<string, "plan event id">;

The id of an event: a UUID version 7. Made only by parseEventId, or by the clock.

IdProblemtypeno test imports it
type IdProblem =
  | { readonly kind: "not-uuid-v7"; readonly what: "item id" | "event id"; readonly text: string }
  | { readonly kind: "bad-external-id"; readonly message: string };

An id that is not one.

parseItemIdfunctionno test imports it
function parseItemId(text: string): Result<ItemId, IdProblem>

An item id from text, or why it is not one.

parseEventIdfunctionno test imports it
function parseEventId(text: string): Result<EventId, IdProblem>

An event id from text, or why it is not one.

idTimefunctionno test imports it
function idTime(id: EventId | ItemId): IdTime

The time an id holds: the milliseconds and the counter that orders ids of one millisecond.

ExternalIdtypeno test imports it
type ExternalId = { readonly source: string; readonly value: string };

The id an item or an event has in the place it was read from, named by that place: the source's name and the value, as the source wrote it.

externalIdfunctionno test imports it
function externalId(source: string, value: string): Result<ExternalId, IdProblem>

An external id, or why the two texts are not one: each is non-empty, with no control character, and the source's name is at most 64 characters and the value at most 256.

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