@hedia/types
v3.12.6
Published
Enums, interfaces, and other common types for use in Hedia's software.
Downloads
1,281
Keywords
Readme
@hedia/types
Shared TypeScript enums, interfaces, and constants used across Hedia's software. Published to npm as @hedia/types.
This package contains types only. It has no runtime dependencies and ships as CommonJS with TypeScript declarations.
Installation
npm install @hedia/typesPin the exact version in consuming projects, as this repo does with its own dependencies.
Usage
import { BloodGlucoseUnit, DiabetesType, IUserSettings } from "@hedia/types";
const settings: IUserSettings = {
// ...
};
if (unit === BloodGlucoseUnit.MMOL_L) {
// ...
}Everything is exported from the package root via src/index.ts.
What's included
| Module | Contents |
| ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| activity | Activity entries, intensity and reduction interval enums, activity settings |
| boluscalculator | Bolus calculator constants, error enums, recommendation params and result |
| logbook | Logbook entries, mood enum, client/backend sync objects |
| userdetails | User details |
| usersettings | User settings, notifications, BGL targets, insulin, diabetes type, and related enums |
| enums | Cross-cutting enums: glucose and ketone units, insulin units, languages, HTTP status codes and methods |
Types prefixed with Legacy describe older data shapes still present in stored data and should not be used for new code.
Development
Requires Node >=22.14.0 (see engines in package.json).
npm ci
npm run validatevalidate runs everything CI runs:
| Script | What it does |
| ----------------------------------- | --------------------------------------------------------------- |
| npm run tsc | Type-check without emitting |
| npm run eslint / eslint:fix | Lint with @hedia/eslint-config |
| npm run prettier / prettier:fix | Check or fix formatting with @hedia/prettier-config |
| npm run pkg-json-lint | Lint package.json (exact versions, alphabetical dependencies) |
| npm audit --audit-level=critical | Fail on critical vulnerabilities |
Conventions
- Prefer
interfaceovertypefor object shapes (enforced by ESLint). - Enum members must be literal values (enforced by ESLint).
- Dependencies are pinned to exact versions, no
^or~, and kept in alphabetical order (enforced by npm-package-json-lint). - Source lives in
src/. The build output inlib/is generated and git-ignored.
Build
The build runs automatically on npm pack / npm publish via the prepack hook. To build manually:
npx bob buildreact-native-builder-bob emits lib/commonjs (JavaScript) and lib/typescript (declarations). Both lib/ and src/ are included in the published package so source maps resolve.
Releasing
Publishing is fully automated by .github/workflows/ci.yaml. Do not bump the version manually.
Pull requests
- Branch from
masterand open a PR. The title must reference a Jira ticket, e.g.HDAM-1234 Add ketone thresholds. An optional[x.y.z] -or[Anytime] -prefix is allowed. Draft PRs skip this check. - Add a
majororminorlabel to control the version bump. With no label the bump ispatch. - On every push CI runs
validate, then:- commits the bumped version to the PR branch as
chore: bump version to x.y.z [skip ci] - publishes
x.y.z-alpha.<run>to npm under thealphadist-tag - comments the install command on the PR
- commits the bumped version to the PR branch as
Pull the branch after CI runs so you pick up the version bump commit before pushing again.
Testing an alpha
npm install @hedia/[email protected] # exact version from the PR comment
npm install @hedia/types@alpha # latest alphaRelease
Merging to master publishes the version in package.json as latest, creates a vX.Y.Z git tag, and creates a GitHub release. If that version is already on npm the publish is skipped.
License
UNLICENSED. This package is published publicly for distribution convenience only. All rights reserved by Hedia.
