# types/layer.types.ts

> 63 lines of code and 11 definitions.

Tree: GovLab Context
Language: typescript
Layer: infrastructure
Canonical: https://banes-lab.com/anatomy/context#file-context-types-layer-types-ts
Source text: https://banes-lab.com/source/context/types/layer.types.ts.txt

Listed in [types](https://banes-lab.com/api/source/context/types.md), after [types/grammar.types.ts](https://banes-lab.com/source/context/types/grammar.types.ts.md) and before [types/lexicon.types.ts](https://banes-lab.com/source/context/types/lexicon.types.ts.md).

## Definitions

- `Layer` (interface_declaration, line 7, exported)
- `LayerEdgeKind` (type_alias_declaration, line 12, exported)
- `ResolutionMechanism` (type_alias_declaration, line 14, exported)
- `LayerEdge` (interface_declaration, line 16, exported)
- `LayerMembership` (interface_declaration, line 22, exported)
- `TensionResolution` (interface_declaration, line 27, exported)
- `TensionGap` (interface_declaration, line 36, exported)
- `TensionPair` (interface_declaration, line 42, exported)
- `LayerJoin` (interface_declaration, line 49, exported)
- `RefMaps` (interface_declaration, line 59, exported)
- `JoinState` (interface_declaration, line 65, exported)

## Contained in

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

## Source

```typescript
import type {
    LAYER_EDGE_KIND_VOCABULARY,
    RESOLUTION_MECHANISM_VOCABULARY,
} from "#configuration/constants/layer.constants";
import type { UnreadKey } from "#types/record.types";

export interface Layer {
    id: string;
    label: string;
}

export type LayerEdgeKind = (typeof LAYER_EDGE_KIND_VOCABULARY)[number]["value"];

export type ResolutionMechanism = (typeof RESOLUTION_MECHANISM_VOCABULARY)[number]["value"];

export interface LayerEdge {
    from: string;
    to: string;
    kind: LayerEdgeKind;
}

export interface LayerMembership {
    key: string;
    layer: string;
}

export interface TensionResolution {
    a: string;
    b: string;
    mechanism: ResolutionMechanism;
    scopeA: string;
    scopeB: string;
    rule: string;
}

export interface TensionGap {
    from: string;
    target: string;
    reason: string;
}

export interface TensionPair {
    a: string;
    b: string;
    scopeA: string;
    scopeB: string;
}

export interface LayerJoin {
    layers: () => Layer[];
    topology: () => LayerEdge[];
    layerOf: (idOrName: string) => string | null;
    resolutions: () => TensionResolution[];
    deadSeeds: () => TensionResolution[];
    resolveTension: (a: string, b: string) => TensionResolution | null;
    unreadKeys: () => UnreadKey[];
}

export interface RefMaps {
    categoryByRef: Map<string, string>;
    archIdByRef: Map<string, string>;
    archTypeByRef: Map<string, string>;
}

export interface JoinState {
    edges: LayerEdge[];
    resolutionList: TensionResolution[];
    layerByKey: Map<string, string>;
    refs: RefMaps;
    resolutionByPair: Map<string, TensionResolution>;
    liveEdgePairs: Set<string>;
    termCategoryOf: (idOrName: string) => string | null;
    titleOf: (id: string) => string | null;
}
```
