Skip to content

Getting Started

Fatunmbi Daniel edited this page Jul 19, 2026 · 1 revision

Getting Started

Install

npm install @ontomorph/holon-types
# pnpm add @ontomorph/holon-types
# yarn add @ontomorph/holon-types
# bun add @ontomorph/holon-types

No 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.

The three things you get

1. Error codes and classes

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.

2. ServiceResult helpers

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);
}

3. Enums and types

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.

Clone this wiki locally