# a-chepugov/alwz architecture

> Architecture diagram of the GitHub repository a-chepugov/alwz, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/a-chepugov/alwz
- Repository: https://github.com/a-chepugov/alwz

## Overview

alwz is an extendable TypeScript typecasting library. A caller uses the public exports to cast values directly or select a named converter; configurable presets implement the conversions, while utilities build structured transformations. Predicate helpers and guard builders support validation, and the library also exposes converter aggregation and informative errors. The graph reflects documented capabilities and sampled imports/calls; unsampled implementation details are omitted rather than inferred.

Main entry points: [`src/index.ts`](https://github.com/a-chepugov/alwz/blob/master/src/index.ts) (Public exports), [`src/presets.ts`](https://github.com/a-chepugov/alwz/blob/master/src/presets.ts) (Conversion presets), [`src/models/Converter.ts`](https://github.com/a-chepugov/alwz/blob/master/src/models/Converter.ts) (Converter engine), [`src/models/ErrorValue.ts`](https://github.com/a-chepugov/alwz/blob/master/src/models/ErrorValue.ts) (Informative errors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Public API"]
  node_exports["Public exports<br/>[index.ts]"]
  node_cast["Cast functions<br/>[cast.ts]"]
  node_selector["Named selector<br/>[cast.ts]"]
end

subgraph group_conversion["Conversion Engine"]
  node_presets["Conversion presets<br/>[presets.ts]"]
  node_converter["Converter engine<br/>[Converter.ts]"]
  node_aggregator["Converter registry<br/>[Aggregator.ts]"]
  node_registry["Registry base<br/>[Registry.ts]"]
  node_numeric["Numeric bounds<br/>[numbers.ts]"]
end

subgraph group_validation["Validation and Structures"]
  node_utils["Structure utilities<br/>[utils.ts]"]
  node_predicates["Type predicates<br/>[is.ts]"]
  node_guards["Guard builders<br/>[Is.ts]"]
  node_type_names["Type definitions<br/>[types.ts]"]
end

subgraph group_support["Shared Support"]
  node_errors["Informative errors<br/>[ErrorValue.ts]"]
end

node_consumer(("Library caller"))

node_consumer -->|"imports"| node_exports
node_exports -->|"exports"| node_cast
node_exports -->|"exports"| node_presets
node_exports -->|"creates"| node_aggregator
node_exports -->|"exports"| node_utils
node_exports -->|"exports"| node_predicates
node_exports -->|"exports"| node_guards
node_exports -->|"exports"| node_converter
node_exports -->|"exports"| node_errors
node_cast -->|"uses converters"| node_presets
node_selector -->|"selects converter"| node_presets
node_presets -->|"configures"| node_converter
node_presets -->|"uses bounds"| node_numeric
node_presets -->|"checks inputs"| node_predicates
node_aggregator -->|"registers"| node_converter
node_aggregator -->|"extends"| node_registry
node_utils -->|"validates conversions"| node_converter
node_utils -->|"uses default conversion"| node_presets
node_utils -->|"throws"| node_errors
node_predicates -->|"checks bounds"| node_numeric
node_guards -->|"validates type names"| node_type_names
node_guards -->|"throws"| node_errors
node_converter -->|"throws"| node_errors
node_aggregator -->|"throws"| node_errors

click node_exports "https://github.com/a-chepugov/alwz/blob/master/src/index.ts"
click node_cast "https://github.com/a-chepugov/alwz/blob/master/src/cast.ts"
click node_selector "https://github.com/a-chepugov/alwz/blob/master/src/cast.ts"
click node_presets "https://github.com/a-chepugov/alwz/blob/master/src/presets.ts"
click node_converter "https://github.com/a-chepugov/alwz/blob/master/src/models/Converter.ts"
click node_aggregator "https://github.com/a-chepugov/alwz/blob/master/src/models/Aggregator.ts"
click node_registry "https://github.com/a-chepugov/alwz/blob/master/src/models/Registry.ts"
click node_numeric "https://github.com/a-chepugov/alwz/blob/master/src/constants/numbers.ts"
click node_utils "https://github.com/a-chepugov/alwz/blob/master/src/utils.ts"
click node_predicates "https://github.com/a-chepugov/alwz/blob/master/src/is.ts"
click node_guards "https://github.com/a-chepugov/alwz/blob/master/src/models/Is.ts"
click node_type_names "https://github.com/a-chepugov/alwz/blob/master/src/constants/types.ts"
click node_errors "https://github.com/a-chepugov/alwz/blob/master/src/models/ErrorValue.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_exports,node_cast,node_selector toneBlue
class node_presets,node_converter,node_aggregator,node_registry,node_numeric toneAmber
class node_utils,node_predicates,node_guards,node_type_names toneMint
class node_errors toneRose
class node_consumer toneIndigo
```

## Components

### Public API

- [Public exports](https://github.com/a-chepugov/alwz/blob/master/src/index.ts): `src/index.ts`
- [Cast functions](https://github.com/a-chepugov/alwz/blob/master/src/cast.ts): `src/cast.ts`
- [Named selector](https://github.com/a-chepugov/alwz/blob/master/src/cast.ts): `src/cast.ts`

### Conversion Engine

- [Conversion presets](https://github.com/a-chepugov/alwz/blob/master/src/presets.ts): `src/presets.ts`
- [Converter engine](https://github.com/a-chepugov/alwz/blob/master/src/models/Converter.ts): `src/models/Converter.ts`
- [Converter registry](https://github.com/a-chepugov/alwz/blob/master/src/models/Aggregator.ts): `src/models/Aggregator.ts`
- [Registry base](https://github.com/a-chepugov/alwz/blob/master/src/models/Registry.ts): `src/models/Registry.ts`
- [Numeric bounds](https://github.com/a-chepugov/alwz/blob/master/src/constants/numbers.ts): `src/constants/numbers.ts`

### Validation and Structures

- [Structure utilities](https://github.com/a-chepugov/alwz/blob/master/src/utils.ts): `src/utils.ts`
- [Type predicates](https://github.com/a-chepugov/alwz/blob/master/src/is.ts): `src/is.ts`
- [Guard builders](https://github.com/a-chepugov/alwz/blob/master/src/models/Is.ts): `src/models/Is.ts`
- [Type definitions](https://github.com/a-chepugov/alwz/blob/master/src/constants/types.ts): `src/constants/types.ts`

### Shared Support

- [Informative errors](https://github.com/a-chepugov/alwz/blob/master/src/models/ErrorValue.ts): `src/models/ErrorValue.ts`

### Other components

- **Library caller**

## Connections

- Library caller → Public exports: imports (evidence: `README.md`)
- Public exports → Cast functions: exports (evidence: `src/index.ts`)
- Public exports → Conversion presets: exports (evidence: `src/index.ts`)
- Public exports → Converter registry: creates (evidence: `src/index.ts`)
- Public exports → Structure utilities: exports (evidence: `src/index.ts`)
- Public exports → Type predicates: exports (evidence: `src/index.ts`)
- Public exports → Guard builders: exports (evidence: `src/index.ts`)
- Public exports → Converter engine: exports (evidence: `src/index.ts`)
- Public exports → Informative errors: exports (evidence: `src/index.ts`)
- Cast functions → Conversion presets: uses converters (evidence: `src/cast.ts`)
- Named selector → Conversion presets: selects converter (evidence: `src/cast.ts`)
- Conversion presets → Converter engine: configures (evidence: `src/presets.ts`)
- Conversion presets → Numeric bounds: uses bounds (evidence: `src/presets.ts`)
- Conversion presets → Type predicates: checks inputs (evidence: `src/presets.ts`)
- Converter registry → Converter engine: registers (evidence: `src/models/Aggregator.ts`)
- Converter registry → Registry base: extends (evidence: `src/models/Aggregator.ts`)
- Structure utilities → Converter engine: validates conversions (evidence: `src/utils.ts`)
- Structure utilities → Conversion presets: uses default conversion (evidence: `src/utils.ts`)
- Structure utilities → Informative errors: throws (evidence: `src/utils.ts`)
- Type predicates → Numeric bounds: checks bounds (evidence: `src/is.ts`)
- Guard builders → Type definitions: validates type names (evidence: `src/models/Is.ts`)
- Guard builders → Informative errors: throws (evidence: `src/models/Is.ts`)
- Converter engine → Informative errors: throws (evidence: `src/models/Converter.ts`)
- Converter registry → Informative errors: throws (evidence: `src/models/Aggregator.ts`)
