# types/anatomy.types.ts

> 82 lines of code and 14 definitions.

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

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

## Definitions

- `WalkAssets` (interface_declaration, line 15, exported)
- `AnatomyInputs` (interface_declaration, line 21, exported)
- `AnatomyLookups` (interface_declaration, line 33, exported)
- `ReferenceReader` (type_alias_declaration, line 44, exported)
- `ReferenceChannel` (type_alias_declaration, line 46, exported)
- `CatalogRule` (interface_declaration, line 48, exported)
- `ReferenceSite` (interface_declaration, line 53, exported)
- `ExactReference` (interface_declaration, line 58, exported)
- `RecordReader` (interface_declaration, line 64, exported)
- `SpecifierResolver` (type_alias_declaration, line 69, exported)
- `TreeOptions` (interface_declaration, line 71, exported)
- `DerivedTree` (interface_declaration, line 78, exported)
- `AnatomyFiles` (interface_declaration, line 84, exported)
- `AnatomyScope` (interface_declaration, line 90, exported)

## Contained in

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

## Source

```typescript
import type {
    AnatomyFile,
    AnatomyFolder,
    AnatomySnapshot,
    DefinitionView,
    DocumentView,
    FindingView,
} from "@banes-lab/web/types/anatomy.types.js";
import type { FileEntry, ModuleReport, RepoContext, WalkCell } from "@govlab/patterns";
import type { AnatomyRecords } from "@banes-lab/web/types/record.types.js";
import type { DiskFolder } from "#types/structure.types";
import type { SourceReferences } from "@banes-lab/web/types/code.types.js";
import type { docsHostFor } from "@govlab/docs";

export interface WalkAssets {
    readonly cells: Map<string, readonly WalkCell[]>;
    readonly sources: Map<string, string>;
    readonly walks: Map<string, string>;
}

export interface AnatomyInputs {
    readonly cells: ReadonlyMap<string, readonly WalkCell[]>;
    readonly charts: AnatomySnapshot["charts"];
    readonly documents: ReadonlyMap<string, DocumentView>;
    readonly entries: readonly FileEntry[];
    readonly generatedSources?: boolean;
    readonly imports: AnatomySnapshot["imports"];
    readonly report: ModuleReport;
    readonly tree: DiskFolder;
    readonly vectors: ReadonlyMap<string, string>;
}

export interface AnatomyLookups {
    readonly assets: WalkAssets;
    readonly documents: ReadonlyMap<string, DocumentView>;
    readonly definitions: ReadonlyMap<string, readonly DefinitionView[]>;
    readonly edgesByFile: ReadonlyMap<string, number>;
    readonly entries: ReadonlyMap<string, FileEntry>;
    readonly findingsByFile: ReadonlyMap<string, readonly FindingView[]>;
    readonly flagged: ReadonlyMap<string, string>;
    readonly inputs: AnatomyInputs;
}

export type ReferenceReader = (path: string, text: string, document: boolean) => SourceReferences;

export type ReferenceChannel = keyof Pick<SourceReferences, "spans" | "strings" | "words">;

export interface CatalogRule {
    readonly canonical?: readonly string[] | undefined;
    readonly ruleId: string;
}

export interface ReferenceSite {
    readonly references: SourceReferences;
    readonly source: string;
}

export interface ExactReference {
    readonly channel: ReferenceChannel;
    readonly path: string;
    readonly text: string;
}

export interface RecordReader {
    readonly file: (file: AnatomyFile) => AnatomyRecords;
    readonly folder: (folder: AnatomyFolder) => AnatomyRecords;
}

export type SpecifierResolver = (specifier: string, fromPath: string) => string | null;

export interface TreeOptions {
    readonly qualifyPath: (tab: string, path: string) => string;
    readonly record: ((roots: readonly AnatomyFolder[]) => RecordReader) | null;
    readonly refer: ((roots: readonly AnatomyFolder[]) => ReferenceReader) | null;
    readonly specifiers: ((files: ReadonlySet<string>) => SpecifierResolver) | null;
}

export interface DerivedTree {
    readonly exportName: string;
    readonly snapshot: AnatomySnapshot;
    readonly tab: string;
}

export interface AnatomyFiles {
    readonly anatomy: string;
    readonly sources: string;
    readonly walks: string;
}

export interface AnatomyScope {
    readonly assets: WalkAssets;
    readonly context: RepoContext;
    readonly host: Awaited<ReturnType<typeof docsHostFor>>;
    readonly options: TreeOptions;
    readonly pruned: (folder: string) => boolean;
}
```
