{"_id":"@criistianlevrero/cmsir-schema-core","name":"@criistianlevrero/cmsir-schema-core","dist-tags":{"latest":"0.2.0"},"versions":{"0.2.0":{"name":"@criistianlevrero/cmsir-schema-core","version":"0.2.0","description":"Typed schema definition primitives for cmsIR — declare collections, fields and relations in TypeScript.","keywords":["cmsir","schema","typescript","headless-cms","content-modeling"],"license":"MIT","author":{"name":"Cristian Levriero","email":"cristianlevrero@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/criistianlevrero/cmsIR.git","directory":"packages/schema-core"},"type":"module","main":"dist/index.js","types":"dist/index.d.ts","publishConfig":{"access":"public"},"scripts":{"build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.json --noEmit","prepublishOnly":"npm run build","test:unit":"npm run build && node --test test/**/*.test.mjs"},"gitHead":"fb43e49ff76a663d883d8ab648c8be449d50e60a","_id":"@criistianlevrero/cmsir-schema-core@0.2.0","bugs":{"url":"https://github.com/criistianlevrero/cmsIR/issues"},"homepage":"https://github.com/criistianlevrero/cmsIR#readme","_nodeVersion":"24.15.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-cqu/JsoadI45eP144mL/9UEVf47v+F2sbdfolRjMAwELNSi6HwPnLXHUS4/I6bAhf1FpnzvRsWCgABpj+aSC3w==","shasum":"5ecff88a856e710575e6bc9c6180c15c466029ac","tarball":"https://registry.npmjs.org/@criistianlevrero/cmsir-schema-core/-/cmsir-schema-core-0.2.0.tgz","fileCount":63,"unpackedSize":72023,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDm7c2UOeayLuMlXEKV6a10U1Dkq16aarrcpjkBOuxpRwIgQ4CzmzlXDtprKlTWBNv9KBru/xXOpLVKe7B3in7dZUU="}]},"_npmUser":{"name":"cristianlevrero","email":"cristianlevrero@gmail.com"},"directories":{},"maintainers":[{"name":"cristianlevrero","email":"cristianlevrero@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/cmsir-schema-core_0.2.0_1788230861567_0.14151997917587478"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-01T02:47:41.388Z","0.2.0":"2026-09-01T02:47:41.693Z","modified":"2026-09-01T02:47:41.932Z"},"maintainers":[{"name":"cristianlevrero","email":"cristianlevrero@gmail.com"}],"description":"Typed schema definition primitives for cmsIR — declare collections, fields and relations in TypeScript.","homepage":"https://github.com/criistianlevrero/cmsIR#readme","keywords":["cmsir","schema","typescript","headless-cms","content-modeling"],"repository":{"type":"git","url":"git+https://github.com/criistianlevrero/cmsIR.git","directory":"packages/schema-core"},"author":{"name":"Cristian Levriero","email":"cristianlevrero@gmail.com"},"bugs":{"url":"https://github.com/criistianlevrero/cmsIR/issues"},"license":"MIT","readme":"# @criistianlevrero/cmsir-schema-core\n\nTyped schema definition primitives for **cmsIR**. Declare your content model in\nTypeScript — collections, fields and relations — and compile it to the cmsIR\n**intermediate representation** (IR), a normalized, deterministically sorted\nJSON description of the model.\n\nThe IR is the contract every downstream tool consumes: schema compilers,\ncode generators and data-layer adapters all read it and never re-parse your\nTypeScript.\n\n## Install\n\n```bash\nnpm install @criistianlevrero/cmsir-schema-core\n```\n\n## Usage\n\n```ts\nimport { defineCollection, string, text, boolean, manyToOne } from \"@criistianlevrero/cmsir-schema-core\";\n\nexport default defineCollection(\"page\", {\n  slug: string({ required: true, unique: true }),\n  title: string({ required: true }),\n  body: text(),\n  published: boolean({ default: false }),\n  author: manyToOne(\"author\"),\n});\n```\n\nSchemas are discovered from disk and compiled to IR by `compile`, driven by a\n`schema.config.ts`:\n\n```ts\nimport { compile } from \"@criistianlevrero/cmsir-schema-core\";\n\nconst { snapshotPath, irHash, diagnostics } = await compile({\n  outputIRPath: \"dist/directus.ir.json\",\n});\n```\n\nCompilation throws if any diagnostic has `severity: \"error\"` — or on warnings\ntoo, when `failOnWarning` is set.\n\n## What's in the box\n\n| Area | Exports |\n|------|---------|\n| DSL | `defineCollection`, field factories (`string`, `text`, `integer`, `float`, `boolean`, `date`, `datetime`, `json`, `html`, `file`), relation factories (`manyToOne`, `oneToMany`, `manyToMany`, `manyToAny`) |\n| Discovery | `discoverSchemas`, `loadSchemaModule` |\n| IR | normalization, validation, deterministic sorting, IR types |\n| Config | `schema.config.ts` loader and types |\n\n## Related\n\n- [`@criistianlevrero/cmsir-schema-directus`](https://www.npmjs.com/package/@criistianlevrero/cmsir-schema-directus) — compiles the IR to a Directus snapshot\n- [`@criistianlevrero/next-datalayer-core`](https://www.npmjs.com/package/@criistianlevrero/next-datalayer-core) — generates a typed Next.js data layer from the IR\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-5ea4dfc5b6e02bc05fde1545619d1790"}