Getting Started
Install and start using @younndai/domains in minutes.
Installation
npm install @younndai/domains
1. Access Bundled Domains
The package ships with all 31 official yon.* domains. No network required:
import { getBundledDomain, listBundledDomains } from "@younndai/domains";
const domains = listBundledDomains();
// → ['yon.health', 'yon.fintech', 'yon.logistics', ...] (31 total)
const health = getBundledDomain("yon.health");
console.log(health?.records.VITALS.fields);
2. Validate Data
import { validateRecord } from "@younndai/domains";
const result = await validateRecord("yon.fintech", "TXN", {
id: "txn-001",
amount: 1500.5,
currency: "USD",
});
if (result.valid) {
console.log("✓ Valid transaction record");
} else {
result.errors.forEach((e) => console.error(`✗ ${e.field}: ${e.message}`));
}
3. Resolve Any Domain
The resolver checks Bundled (T1) → Local (T3) → Remote (T2):
import { resolveDomain } from "@younndai/domains";
const health = await resolveDomain("yon.health"); // bundled (instant)
const custom = await resolveDomain("com.abcde-shipping"); // remote (cached)
const offline = await resolveDomain("yon.health", { offline: true });
4. Export to JSON Schema
import { exportJSONSchemas } from "@younndai/domains/json-schema";
const schemas = await exportJSONSchemas("yon.health");
// Each key is a record tag, value is JSON Schema draft-07
