Draft
cost-engine — Pricing Engine Library
Clientnovameraactive
Pure-TypeScript cost/pricing library (
@propel-ai/novamera.cost-engine) — the single source of truth for pricing logic and types, shared between the fe-sim frontend and the svc-sim backend so they cannot drift. No framework or I/O dependencies.
flowchart LR
ENGINE["@propel-ai/novamera.cost-engine"] --> FE[fe-sim
cost model UI]
ENGINE --> SIM[svc-sim
backend pricing]
ENGINE --> RI[resolveLineItems]
RI --> JQ[joinQuantity]
JQ --> PU[priceUnit]
PU --> AGG[aggregate
totals + breakdowns]
style ENGINE fill:#EDEDFF,stroke:#3B54F7
style RI fill:#F3EDFF,stroke:#8A54E8
style JQ fill:#F3EDFF,stroke:#8A54E8
style PU fill:#F3EDFF,stroke:#8A54E8
style AGG fill:#F3EDFF,stroke:#8A54E8
Pipeline stages:
resolveLineItems— which items are in scope; who pays; effective cost/margin/surplus/unitjoinQuantity— unit → physical quantity from aQuantityBasispriceUnit— surplus → FX convert → margin gross-up → client + internal unit pricesaggregate— totals + phase/category/cost-centre/behaviour breakdowns + economics
- Validation: types derived from Zod schemas (
z.infer) — runtime validation and TS types always agree. - Seed data: catalog, bundles, and Site-Development knobs bundled at build time; no runtime fetch.
- Install:
@propel-ai:registry=https://npm.pkg.github.com→npm install @propel-ai/novamera.cost-engine.