{"id":47415,"library":"dobajs","title":"Doba","description":"Doba is a TypeScript schema registry for type-safe data transformations and migrations between different schema variants (e.g., database, frontend, AI contexts). Built on Standard Schema, it supports any Zod, Valibot, or ArkType schemas. Version 0.1.0 is early-stage but functional: O(1) lookup for schemas, graph-based migration path finding, and errors as values. It distinguishes itself from manual transform functions by providing automatic path finding, hops scaling at ~140ns each, and hook support for logging/validation. Release cadence is unknown (pre-1.0).","status":"active","version":"0.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/karol-broda/doba","tags":["javascript","arktype","codec","migration","schema","standard-schema","typescript","valibot","versioning"],"install":[{"cmd":"npm install dobajs","lang":"bash","label":"npm"},{"cmd":"yarn add dobajs","lang":"bash","label":"yarn"},{"cmd":"pnpm add dobajs","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only package; requires Node 20+ or bundler with ESM support.","wrong":"const { createRegistry } = require('doba')","symbol":"createRegistry","correct":"import { createRegistry } from 'doba'"},{"note":"Registry is exported as a type only. Do not use at runtime.","wrong":"import { Registry } from 'doba'","symbol":"Registry","correct":"import type { Registry } from 'doba'"},{"note":"Type representing an inferrable Standard Schema; useful for parameter annotations.","wrong":null,"symbol":"Schema","correct":"import type { Schema } from 'doba'"},{"note":"Result type from transform(): { ok: boolean, value?: T, error?: StandardSchemaV1Error }","wrong":null,"symbol":"TransformResult","correct":"import type { TransformResult } from 'doba'"}],"quickstart":{"code":"import { createRegistry } from 'doba'\nimport { z } from 'zod'\n\nconst dbSchema = z.object({ id: z.string(), name: z.string(), secret: z.string() })\nconst pubSchema = z.object({ id: z.string(), name: z.string() })\n\nconst registry = createRegistry({\n  schemas: { db: dbSchema, pub: pubSchema },\n  migrations: {\n    'db->pub': (user) => ({ id: user.id, name: user.name }),\n  },\n})\n\nconst input = { id: '1', name: 'Alice', secret: 'shh' }\nconst result = await registry.transform(input, 'db', 'pub')\nif (result.ok) {\n  console.log(result.value) // { id: '1', name: 'Alice' }\n}","lang":"typescript","description":"Creates a registry with two schemas and a migration, transforms data from 'db' to 'pub' (stripping secret), and logs the result."},"warnings":[{"fix":"Add all required migration edges, or ensure a path exists via intermediate schemas.","message":"Migrations must be explicitly registered between every pair you intend to use. Automatic path finding only works if intermediate schemas exist.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use dynamic import() or switch to an ESM-compatible project.","message":"The package ships only ESM. CommonJS require() will fail.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Pin to exact version and test after each upgrade.","message":"Version 0.1.0 is pre-release and API may break. Not recommended for production use.","severity":"deprecated","affected_versions":">=0.1.0"},{"fix":"Always await or use .then() on transform calls.","message":"The transform() function is async even if migrations are synchronous. This allows future hook support.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'-1.0':87 '0.1.0':38 '1':46 '140ns':75 'ai':23 'arktyp':35,89 'automat':69 'base':52 'built':25 'cadenc':83 'codec':90 'context':24 'data':12 'databas':21 'differ':17 'distinguish':61 'doba':1,2 'e.g':20 'earli':41 'early-stag':40 'error':57 'find':55,71 'frontend':22 'function':44,66 'graph':51 'graph-bas':50 'hook':78 'hop':72 'javascript':88 'logging/validation':81 'lookup':47 'manual':64 'migrat':15,53,91 'o':45 'path':54,70 'pre':86 'provid':68 'registri':7 'releas':82 'safe':11 'scale':73 'schema':6,18,28,36,49,92,95 'stage':42 'standard':27,94 'standard-schema':93 'support':30,79 'transform':13,65 'type':10 'type-saf':9 'typescript':5,96 'unknown':85 'valibot':33,97 'valu':59 'variant':19 'version':37,98 'zod':32","created_at":"2026-06-07T16:51:24.415128+00:00","updated_at":"2026-06-07T16:51:24.415128+00:00","problems":[{"fix":"Run 'npm install doba' and ensure 'moduleResolution' is 'bundler' or 'node16' in tsconfig.","cause":"Package not installed, or TypeScript cannot resolve ESM exports.","error":"Cannot find module 'doba' or its corresponding type declarations."},{"fix":"Upgrade Node to 20+ or use a bundler (esbuild, webpack) with ESM output.","cause":"Node.js version <20 or CommonJS context does not support ESM syntax.","error":"SyntaxError: Unexpected token 'export'"},{"fix":"Use 'import { createRegistry } from 'doba'' and call createRegistry(), then use the returned registry instance.","cause":"Incorrect import (e.g., imported Registry type instead of createRegistry function).","error":"TypeError: registry.transform is not a function"},{"fix":"Register a migration like 'schemaA->schemaB' or ensure intermediate schemas are connected.","cause":"No direct migration edge or path via intermediate schemas exists.","error":"Error: No migration path from 'schemaA' to 'schemaB'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://doba.karolbroda.com","github":"https://github.com/karol-broda/doba","docs":null,"changelog":null,"pypi":null,"npm":"dobajs","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}