Files

1.0 KiB

@blade-and-brawn/domain

Shared models, enums, and utility functions with no dependencies on any other workspace package — used by packages/calculator, packages/commerce, apps/api, and apps/portal to avoid duplicating core types.

Exports

Models (src/models.ts)

  • Attribute — Strength / Power / Endurance / Agility
  • Activity — BackSquat / Deadlift / BenchPress / Run / BroadJump / ConeDrill
  • Gender — Male / Female
  • Metrics / Player / ActivityPerformance — typebox schemas + types for a player's age/weight/gender and their performance on a given activity

Utils (src/utils.ts)

  • Unit conversions: lbToKg, kgToLb, minToMs, secToMs, msToMin, ftToCm, inToCm, cmToIn, msToTime
  • range(length), clamp(x, lo, hi)
  • parseRetryAfterMs(header, defaultMs) — parses a Retry-After header (seconds or HTTP date) for backoff, used by the Printful/Webflow clients
  • RateLimitError — thrown by packages/commerce clients on HTTP 429