@younndai/domains
v2.0.2
Published
Fetch, validate, introspect, and classify YounndAI Domain schemas — industry-specific vocabularies for YON™, the stream-first data format, with JSON Schema export.
Maintainers
Readme
What is this?
YounndAI Domains define industry-specific vocabularies — structured schemas that specify what data a domain contains, what fields each record requires, and how values should be validated. Think of it as "JSON Schema for industry concepts."
This package gives you:
- 34 official domains bundled — health, fintech, logistics, HR, legal, and more
- Zero-config validation — validate any JS object against domain rules
- JSON Schema export — convert domains to JSON Schema draft-07 for any ecosystem
- Universal — works in Node.js, Deno, Bun, browsers, and edge runtimes
Install
npm install @younndai/domainsQuick Start
import {
resolveDomain,
validateRecord,
getBundledDomain,
} from "@younndai/domains";
// ── Resolve a domain (bundled → local → remote) ──
const health = await resolveDomain("yai.health");
console.log(health?.records); // { VITALS: {...}, DX: {...}, RX: {...}, ... }
// ── Validate data against a domain record ──
const result = await validateRecord("yai.fintech", "TXN", {
id: "txn-001",
amount: 1500.5,
currency: "USD",
});
if (!result.valid) {
result.errors.forEach((e) => console.error(`${e.field}: ${e.message}`));
}
// ── Access bundled domains (zero network) ──
const fintech = getBundledDomain("yai.fintech");
console.log(fintech?.records.TXN.fields);JSON Schema Export
Convert any domain record to industry-standard JSON Schema draft-07:
import {
recordToJSONSchema,
exportJSONSchemas,
} from "@younndai/domains/json-schema";
import { getBundledDomain } from "@younndai/domains";
// Single record → JSON Schema
const fintech = getBundledDomain("yai.fintech")!;
const schema = recordToJSONSchema(fintech.records.TXN, "TXN", "yai.fintech");
// → { $schema: 'http://json-schema.org/draft-07/schema#', ... }
// Entire domain → all record schemas
const schemas = await exportJSONSchemas("yai.health");Schema Introspection
Explore domain structure programmatically:
import {
getRecordTags,
describeRecord,
findDomainsByTag,
} from "@younndai/domains";
// List all tags in a domain
const tags = await getRecordTags("yai.health");
// → ['VITALS', 'DX', 'RX', 'LAB', ...]
// Describe a record
const summary = await describeRecord("yai.health", "VITALS");
// → { tag: 'VITALS', requiredFields: ['bp'], optionalFields: ['hr', ...], ... }
// Reverse lookup: find all domains that define a tag
const results = findDomainsByTag("POSITION");
// → { tag: 'POSITION', matches: [
// { domainId: 'yai.hr', record: {...} },
// { domainId: 'yai.fintech', record: {...} },
// ] }Taxonomy & Classification
Classify domains by tier, conformance, trust, and freshness:
import {
resolveSetType,
resolveConformanceLevel,
resolveTrustLevel,
getFreshnessLabel,
} from "@younndai/domains/taxonomy";
resolveSetType("yai.health", "official");
// → 'official'
resolveConformanceLevel(0.95);
// → { key: 'gold', label: 'Gold', colorKey: 'conformance-gold', ... }
resolveTrustLevel(true, 0.95, "official");
// → 'trusted'
getFreshnessLabel("2026-02-01");
// → { label: 'Updated 27d ago', colorKey: 'freshness-recent' }Configuration
import { configureClient, setRegistryUrl } from "@younndai/domains";
// Change registry URL (default: https://domains.younndai.com)
setRegistryUrl("https://domains-staging.younndai.com");
// Full configuration
configureClient({
registryUrl: "https://domains.younndai.com",
timeout: 5000,
onWarn: (msg) => logger.warn(msg),
});Subpath Exports
| Export | Description |
| ------------------------------- | ----------------------- |
| @younndai/domains | Main entry — everything |
| @younndai/domains/taxonomy | Classification engine |
| @younndai/domains/json-schema | JSON Schema conversion |
Spec vs SDK: This package implements the normative YON Domain Schema Format and extends it with SDK-specific features: taxonomy classification, JSON Schema export, offline bundles, sync introspection, and reverse tag lookup. These extensions do not modify the normative schema format.
API Surface
Core
resolveDomain(id)— Unified T1→T3→T2 resolutiongetBundledDomain(id)/listBundledDomains()/isBundledDomain(id)loadDomainFromJSON(json)— Convert raw JSON toDomainSchema
Registry Client (10 methods)
getDomain(id)/getDomains(ids[])/fetchDomainList(opts?)searchDomains(query)/getDomainVersions(id)/getRegistryStats()listNamespaces(opts?)/getNamespace(path)getNotices(opts?)/getAnnouncements(opts?)checkRegistryHealth()configureClient(opts)/setRegistryUrl(url)/getRegistryUrl()setCacheAdapter(adapter)/clearDomainCache()/getDomainCacheStats()/resetCacheStats()
Local Registry
registerDomain(schema)/unregisterDomain(id)listDomains(filter?)/getDomainTags(domains[])getLocalDomain(id)/isOfficialDomain(id)
Validation
validateRecord(domainId, tag, data)— asyncvalidateRecordSync(tag, data, domain)— syncvalidateRecords(entries[])— batchvalidateFields(data, constraints)— low-level
Introspection
getRecordTags(id)/getRecordSchema(id, tag)getRequiredFields(id, tag)/getOptionalFields(id, tag)getFieldConstraints(id, tag, field?)/describeRecord(id, tag)- All have
*Syncvariants
Lookup
findDomainsByTag(tag)/buildTagIndex()
Offline
downloadRegistryBundle(opts?)/serializeBundle(bundle)/deserializeBundle(json)applyBundle(bundle, registerFn)/getBundleManifest(bundle)
Documentation
- API examples — see the Quick Start, JSON Schema, Introspection, Taxonomy, and Configuration sections above;
TESTING.mdcovers the test suite. - Domain registry — domains.younndai.com (API:
https://domains.younndai.com/api/domains). - Changelog —
CHANGELOG.md.
The YON Project
YON is an open block format and toolchain.
- Specification —
@younndai/yon-spec— the normative YON v2.0 standard. - Toolchain —
YounndAI/yon— parser, generator, runner, converter, examples, benchmarks, domains, ai-relay. - Editor support —
yon-vscode(VS Code Marketplace) ·@younndai/yon-textmate(TextMate grammar).
Testing
Run the Vitest suite with npm test. See TESTING.md for coverage details.
About YounndAI
YounndAI™ — You and AI, unified. (pronounced "yoon-dye")
A philosophy of intelligence: building with intention, so humans and machines think together without losing what makes either whole.
License & Attribution
Apache-2.0. © 2026 MARLINK TRADING SRL (YounndAI). See LICENSE and NOTICE.
"YON" and "YounndAI" are trademarks of MARLINK TRADING SRL — see TRADEMARK.md.
Created by Alexandru Mareș.
Website: yon.younndai.com
| | | | ------------- | ------------------------------------------------------- | | Spec | YON v2.0 | | Author | Alexandru Mareș | | Company | MARLINK TRADING SRL · YounndAI™ | | License | Apache 2.0 — © 2026 MARLINK TRADING SRL | | Trademark | YounndAI™ Trademark Guidelines |
