# types/source.types.ts

> 73 lines of code and 11 definitions.

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

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

## Definitions

- `SourceTree` (interface_declaration, line 5, exported)
- `SourceTools` (interface_declaration, line 11, exported)
- `SourceFile` (interface_declaration, line 20, exported)
- `NamedSource` (interface_declaration, line 26, exported)
- `SourceSources` (interface_declaration, line 33, exported)
- `DefinitionData` (interface_declaration, line 44, exported)
- `SourceData` (interface_declaration, line 51, exported)
- `SourceRouteTools` (interface_declaration, line 62, exported)
- `SourceRoute` (interface_declaration, line 71, exported)
- `FolderTools` (interface_declaration, line 76, exported)
- `FolderRelations` (interface_declaration, line 81, exported)

## Contained in

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

## Source

```typescript
import type { AnatomyFile, AnatomySnapshot } from "@banes-lab/web/types/anatomy.types.js";
import type { Identity, Link, Linker, Placed, PlacementOf, Relation } from "#types/catalog.types";
import type { SourceBody } from "@banes-lab/web/types/page.types.js";

export interface SourceTree {
    readonly label: string;
    readonly snapshot: AnatomySnapshot;
    readonly tab: string;
}

export interface SourceTools {
    readonly definitionAnchor: string;
    readonly fileId: (path: string) => string;
    readonly lineInfix: string;
    readonly languageOf: (name: string) => string;
    readonly localPath: (path: string) => string;
    readonly nodeHref: (path: string, line: number | null) => string;
}

export interface SourceFile {
    readonly file: AnatomyFile;
    readonly identity: Identity;
    readonly tree: SourceTree;
}

export interface NamedSource {
    readonly file: Pick<AnatomyFile, "path"> & {
        readonly definitions: readonly Pick<AnatomyFile["definitions"][number], "name">[];
    };
    readonly identity: Identity;
}

export interface SourceSources {
    readonly checks: (ref: string) => readonly Relation[];
    readonly folder: (ref: string) => FolderRelations | null;
    readonly grounds: (ref: string) => Promise<readonly Link[]>;
    readonly linkedBy: (ref: string) => readonly Link[];
    readonly linker: Linker;
    readonly placement: PlacementOf;
    readonly textOf: (name: string) => string | null;
    readonly tools: SourceTools;
}

export interface DefinitionData {
    readonly exported: boolean;
    readonly kind: string;
    readonly line: number;
    readonly name: string;
}

export interface SourceData extends Placed {
    readonly definitions: readonly DefinitionData[];
    readonly href: string | null;
    readonly language: string;
    readonly layer: string | null;
    readonly path: string;
    readonly relations: readonly Relation[];
    readonly summary: string | null;
    readonly text: string | null;
}

export interface SourceRouteTools {
    readonly languageOf: (name: string) => string;
    readonly license: (tab: string) => string | null;
    readonly localPath: (path: string) => string;
    readonly nodeRoute: (path: string, folder: boolean) => string;
    readonly sourceTitle: (path: string) => string;
    readonly tabPath: (tab: string) => string;
}

export interface SourceRoute extends SourceBody {
    readonly slice?: readonly [number, number];
    readonly text: string | null;
}

export interface FolderTools {
    readonly fileId: (path: string) => string;
    readonly folderHref: (path: string) => string;
}

export interface FolderRelations {
    readonly containedIn: Link | null;
    readonly contains: readonly Link[];
}
```
