@archatlas/core-model
v0.1.10
Published
Semantic architecture model, validation, and diff/patch APIs
Readme
Core Model
@archatlas/core-model is the headless semantic architecture model and validation engine.
Purpose
This package provides:
- TypeScript types for the architecture model (Element, Relationship, View, etc.)
- Validation rules (ID uniqueness, hierarchy constraints, reference integrity)
- Change proposal API (diff/patch)
- Actionable error formatting
Design Principles
- Framework-agnostic: No UI or rendering logic
- Pure TypeScript: No React, Next.js, or browser-specific APIs
- Single source of truth: All domain logic lives here
- Test-driven: 100% TDD, high coverage
Installation
pnpm add @archatlas/core-modelUsage
import { validateModel, type ArchitectureModel } from '@archatlas/core-model';
const model: ArchitectureModel = {
schemaVersion: '0.1.0',
metadata: {
/* ... */
},
elements: [
/* ... */
],
relationships: [
/* ... */
],
constraints: [],
views: [
/* ... */
],
};
const errors = validateModel(model);
if (errors.length > 0) {
console.error('Validation errors:', errors);
}API
Types
ArchitectureModel: Root model typeElement: Architecture element (landscape, system, container, component, code)Relationship: Connection between elementsView: Viewport into the model at a specific abstraction levelLayoutState: Deterministic layout metadataConstraint: Validation constraint
Functions
validateModel(model: ArchitectureModel): ValidationError[]: Validate entire modelapplyChangeProposal(model: ArchitectureModel, proposal: ChangeProposal): ArchitectureModel: Apply changes
Error Model
ValidationError: Structured error with code, path, and message- Error codes:
ID_DUPLICATE,REF_NOT_FOUND,HIERARCHY_INVALID, etc.
Development
# Run tests
pnpm test
# Run tests with coverage
pnpm test:coverage
# Build
pnpm buildLicense
See LICENSE in the monorepo root.
