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:

  1. resolveLineItems — which items are in scope; who pays; effective cost/margin/surplus/unit
  2. joinQuantity — unit → physical quantity from a QuantityBasis
  3. priceUnit — surplus → FX convert → margin gross-up → client + internal unit prices
  4. aggregate — 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.comnpm install @propel-ai/novamera.cost-engine.