-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
Fatunmbi Daniel edited this page Jul 19, 2026
·
1 revision
npm install @ontomorph/holon-types
# pnpm add @ontomorph/holon-types
# yarn add @ontomorph/holon-types
# bun add @ontomorph/holon-typesNo runtime dependencies. Pure types, plus a handful of small helpers and enums.
If you also need the HTTP methods, install @ontomorph/holon-client instead. It re-exports the types it needs. See Home for when to use each.
One shared enum of failure reasons, and one error class that carries it.
// throw and inspect HOLON errors
import { ErrorCode, HolonError, ValidationError } from "@ontomorph/holon-types";
throw new ValidationError("age must be a positive integer");
// HolonError carries a machine-readable code and optional response detail:
if (err instanceof HolonError && err.code === ErrorCode.CONCEPT_NOT_FOUND) { … }More in Guides and API-Reference.
A discriminated-union result type used across the HOLON services, with ok() and err() constructors.
// return success or failure without throwing
import { ok, err, ErrorCode, type ServiceResult } from "@ontomorph/holon-types";
function lookup(id: number): ServiceResult<Concept> {
const row = find(id);
return row ? ok(row) : err("no such concept", ErrorCode.CONCEPT_NOT_FOUND);
}The vocabulary identifiers, domains, and entity shapes the API speaks.
// the supported source vocabularies
import { VocabularyId, DomainId, StandardConcept, MappingEquivalence } from "@ontomorph/holon-types";
VocabularyId.SNOMED_CT; // "SNOMED-CT"
VocabularyId.RXNORM; // "RxNorm"
VocabularyId.LOINC; // "LOINC"See Concepts for what each term means, and API-Reference for the full list.