# types/catalog.types.ts

> 169 lines of code and 31 definitions.

Tree: Bane's Lab Build Scripts
Language: typescript
Layer: infrastructure
Canonical: https://banes-lab.com/anatomy/build-scripts#file-build-scripts-types-catalog-types-ts
Source text: https://banes-lab.com/source/build-scripts/types/catalog.types.ts.txt

Listed in [types](https://banes-lab.com/api/source/build-scripts/types.md), after [types/browser.types.ts](https://banes-lab.com/source/build-scripts/types/browser.types.ts.md) and before [types/certificate.types.ts](https://banes-lab.com/source/build-scripts/types/certificate.types.ts.md).

## Definitions

- `Address` (interface_declaration, line 5, exported)
- `Identity` (interface_declaration, line 10, exported)
- `Link` (interface_declaration, line 19, exported)
- `Entry` (interface_declaration, line 27, exported)
- `ManifestRow` (interface_declaration, line 39, exported)
- `CatalogFiles` (interface_declaration, line 47, exported)
- `LeafText` (interface_declaration, line 52, exported)
- `Leaf` (interface_declaration, line 57, exported)
- `Written` (interface_declaration, line 64, exported)
- `Relation` (interface_declaration, line 69, exported)
- `Unresolved` (interface_declaration, line 74, exported)
- `Population` (interface_declaration, line 80, exported)
- `Linker` (interface_declaration, line 86, exported)
- `Canonical` (type_alias_declaration, line 95, exported)
- `Placement` (interface_declaration, line 97, exported)
- `Placed` (interface_declaration, line 102, exported)
- `PlacementOf` (type_alias_declaration, line 107, exported)
- `DataRenderer` (type_alias_declaration, line 109, exported)
- `CatalogStore` (interface_declaration, line 111, exported)
- `Catalog` (interface_declaration, line 117, exported)
- `GrammarKind` (type_alias_declaration, line 124, exported)
- `GrammarRow` (interface_declaration, line 126, exported)
- `GrammarData` (interface_declaration, line 131, exported)
- `SiteParts` (interface_declaration, line 141, exported)
- `SiteStamp` (interface_declaration, line 149, exported)
- `SiteBuild` (interface_declaration, line 155, exported)
- `SiteData` (interface_declaration, line 159, exported)
- `ContactData` (interface_declaration, line 167, exported)
- `NumberRow` (interface_declaration, line 179, exported)
- `RouteRow` (interface_declaration, line 186, exported)
- `Navigation` (interface_declaration, line 193, exported)

## Contained in

- [types](https://banes-lab.com/anatomy/build-scripts/folder-build-scripts-types.md)

## Source

```typescript
import type { GRAMMAR_LEVELS } from "#configuration/strings/catalog.strings";
import type { Journal } from "#types/journal.types";
import type { RecordSubject } from "@banes-lab/web/types/page.types.js";

export interface Address {
    readonly json: string;
    readonly markdown: string | null;
}

export interface Identity {
    readonly address: Address;
    readonly href: string | null;
    readonly kind: string;
    readonly ref: string;
    readonly summary: string | null;
    readonly title: string;
}

export interface Link {
    readonly href: string | null;
    readonly json: string | null;
    readonly label: string;
    readonly markdown: string | null;
    readonly ref: string | null;
}

export interface Entry {
    readonly bytes: number;
    readonly fingerprint: string;
    readonly href: string | null;
    readonly json: string;
    readonly kind: string;
    readonly markdown: string | null;
    readonly ref: string;
    readonly summary: string | null;
    readonly title: string;
}

export interface ManifestRow {
    readonly bytes: number;
    readonly fingerprint: string;
    readonly json: string;
    readonly markdown: string | null;
    readonly ref: string;
}

export interface CatalogFiles {
    readonly json: readonly string[];
    readonly text: readonly string[];
}

export interface LeafText {
    readonly address: string;
    readonly body: string;
}

export interface Leaf {
    readonly data: object;
    readonly identity: Identity;
    readonly markdown: string | null;
    readonly text?: LeafText;
}

export interface Written {
    readonly entry: Entry;
    readonly leaf: Leaf;
}

export interface Relation {
    readonly links: readonly Link[];
    readonly relation: string;
}

export interface Unresolved {
    readonly from: string | null;
    readonly label: string;
    readonly target: string;
}

export interface Population {
    readonly name: string;
    readonly parts: Readonly<Record<string, number>>;
    readonly whole: number;
}

export interface Linker {
    readonly byHref: (href: string) => Identity | null;
    readonly byRef: (ref: string) => Identity | null;
    readonly link: (label: string, ref: string | null) => Link;
    readonly relink: (markdown: string, base: string) => string;
    readonly site: string;
    readonly unresolved: () => readonly Unresolved[];
}

export type Canonical = (href: string) => string;

export interface Placement {
    readonly siblings: { readonly next: Link | null; readonly previous: Link | null };
    readonly up: Link;
}

export interface Placed {
    readonly siblings: Placement["siblings"] | null;
    readonly up: Link | null;
}

export type PlacementOf = (ref: string) => Placement | null;

export type DataRenderer = (identity: Identity, data: object, site: string) => string;

export interface CatalogStore {
    readonly add: (leaves: readonly Leaf[]) => readonly Entry[];
    readonly entries: ReadonlyMap<string, Entry>;
    readonly files: ReadonlyMap<string, string>;
}

export interface Catalog {
    readonly files: ReadonlyMap<string, string>;
    readonly journal: Journal;
    readonly records: readonly RecordSubject[];
    readonly unresolved: readonly Unresolved[];
}

export type GrammarKind = keyof typeof GRAMMAR_LEVELS;

export interface GrammarRow {
    readonly address: Address;
    readonly kind: GrammarKind;
}

export interface GrammarData {
    readonly example?: string | null;
    readonly json: string;
    readonly kind?: string;
    readonly level: string;
    readonly markdown: string | null;
    readonly schema?: string | null;
    readonly template?: boolean;
}

export interface SiteParts {
    readonly collections: readonly Entry[];
    readonly documents: readonly Entry[];
    readonly pages: readonly Entry[];
    readonly queries: readonly Entry[];
    readonly trees: readonly Entry[];
}

export interface SiteStamp {
    readonly build: string;
    readonly updated: string | null;
    readonly version: number;
}

export interface SiteBuild extends SiteStamp {
    readonly published: readonly string[];
}

export interface SiteData extends SiteParts, SiteStamp {
    readonly canonical: string;
    readonly consent: string;
    readonly grammar: readonly GrammarData[];
    readonly summary: string;
    readonly title: string;
}

export interface ContactData {
    readonly address: string;
    readonly company: string;
    readonly country: string;
    readonly email: string;
    readonly founded: string;
    readonly links: Readonly<Record<string, string>>;
    readonly number: string;
    readonly owner: string;
    readonly reply: string;
}

export interface NumberRow {
    readonly kind: string;
    readonly link: Link;
    readonly number: string;
    readonly part: number | null;
}

export interface RouteRow {
    readonly block: string;
    readonly link: Link;
    readonly position: number;
    readonly requires: readonly (number | null)[];
}

export interface Navigation {
    readonly next: Link | null;
    readonly position: number;
    readonly previous: Link | null;
    readonly requires: readonly Link[];
    readonly stop: string;
    readonly total: number;
}
```
