{"id":49528,"library":"tobl-data-schema","title":"TOBL Data Schema","description":"Shared data schema for TOBL projects, version 3.12.24. This package provides TypeScript types and runtime validation for data structures used across TOBL applications. It is published on npm and follows semantic versioning. The schema is designed to ensure consistency between backend (tobl-functions-ts) and frontend (tobl-web) projects. It includes Zod schemas for runtime validation and TypeScript types for static checking. The package is actively maintained with regular releases tied to schema changes.","status":"active","version":"3.12.24","language":"javascript","source_language":"en","source_url":"https://github.com/tobl-ai/data-schema","tags":["javascript","typescript"],"install":[{"cmd":"npm install tobl-data-schema","lang":"bash","label":"npm"},{"cmd":"yarn add tobl-data-schema","lang":"bash","label":"yarn"},{"cmd":"pnpm add tobl-data-schema","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime validation of data structures using Zod schemas","package":"zod","optional":false}],"imports":[{"note":"Named export, not default. This package uses named exports exclusively.","wrong":"import UserSchema from 'tobl-data-schema'","symbol":"UserSchema","correct":"import { UserSchema } from 'tobl-data-schema'"},{"note":"Use type-only import for TypeScript types to avoid runtime overhead.","wrong":"import { User } from 'tobl-data-schema'","symbol":"User","correct":"import type { User } from 'tobl-data-schema'"},{"note":"ESM-only package; require() will fail. Use import syntax.","wrong":"const { validateUser } = require('tobl-data-schema')","symbol":"validateUser","correct":"import { validateUser } from 'tobl-data-schema'"}],"quickstart":{"code":"import { UserSchema, User } from 'tobl-data-schema';\nimport { z } from 'zod';\n\nconst userData = { name: 'Alice', email: 'alice@example.com', age: 30 };\nconst result = UserSchema.safeParse(userData);\nif (result.success) {\n  const user: User = result.data;\n  console.log('Valid user:', user);\n} else {\n  console.error('Validation errors:', result.error.issues);\n}","lang":"typescript","description":"Shows how to import the schema and type, parse user data, and handle validation errors using Zod's safeParse."},"warnings":[{"fix":"Change import { default as DataSchema } from 'tobl-data-schema' to import { UserSchema } from 'tobl-data-schema' or equivalent named export.","message":"Version 3.0.0 changed all schema exports to named exports. Default export removed.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Use import type { User } from 'tobl-data-schema' instead of import { User } from 'tobl-data-schema'.","message":"TypeScript types are only available via type-only import. Importing as value will produce a runtime error.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Replace `UserValidator` with `validateUser` in import and usage.","message":"Deprecated export: `UserValidator` has been renamed to `validateUser` in v2.5.0.","severity":"deprecated","affected_versions":">=2.5.0 <3.0.0"},{"fix":"Switch to ESM imports in your project, or use dynamic import() if you must use CommonJS.","message":"The package is ESM-only. require() calls will fail with ERR_REQUIRE_ESM.","severity":"gotcha","affected_versions":">=3.0.0"}],"env_vars":null,"search_vec":"'3.12.24':11 'across':24 'activ':71 'applic':26 'backend':44 'chang':79 'check':67 'consist':42 'data':2,5,21 'design':39 'ensur':41 'follow':33 'frontend':50 'function':47 'includ':56 'javascript':80 'maintain':72 'npm':31 'packag':13,69 'project':9,54 'provid':14 'publish':29 'regular':74 'releas':75 'runtim':18,60 'schema':3,6,37,58,78 'semant':34 'share':4 'static':66 'structur':22 'tie':76 'tobl':1,8,25,46,52 'tobl-functions-t':45 'tobl-web':51 'ts':48 'type':16,64 'typescript':15,63,81 'use':23 'valid':19,61 'version':10,35 'web':53 'zod':57","created_at":"2026-06-07T17:02:13.504796+00:00","updated_at":"2026-06-07T17:02:13.504796+00:00","problems":[{"fix":"Run `yarn add tobl-data-schema` or `npm install tobl-data-schema` to install the package.","cause":"Package not installed or not in node_modules.","error":"ERR_MODULE_NOT_FOUND: Cannot find package 'tobl-data-schema' imported from ..."},{"fix":"Change `const { UserSchema } = require('tobl-data-schema')` to `import { UserSchema } from 'tobl-data-schema'`.","cause":"Using CommonJS require() which is not supported in ESM-only package.","error":"TypeError: Cannot destructure property 'UserSchema' of ... as it is undefined."},{"fix":"Use `import type { User } from 'tobl-data-schema'` instead.","cause":"Using `import { User } from 'tobl-data-schema'` as a value instead of a type-only import causes TypeScript to resolve the entire schema type.","error":"TS2590: Expression produces a union type that is too complex to represent."}],"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://github.com/tobl-ai/data-schema","github":"https://github.com/tobl-ai/data-schema","docs":null,"changelog":null,"pypi":null,"npm":"tobl-data-schema","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"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}}