{"_id":"@criistianlevrero/next-datalayer-core","name":"@criistianlevrero/next-datalayer-core","dist-tags":{"latest":"0.2.0"},"versions":{"0.2.0":{"name":"@criistianlevrero/next-datalayer-core","version":"0.2.0","description":"Turns a cmsIR intermediate representation into typed Next.js data-layer code: entities, relations, block registry and repository contracts.","keywords":["cmsir","nextjs","codegen","typescript","data-layer","headless-cms"],"license":"MIT","author":{"name":"Cristian Levriero","email":"cristianlevrero@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/criistianlevrero/cmsIR-to-next-datalayer.git","directory":"packages/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"},"devDependencies":{"typescript":"^5.5.0"},"gitHead":"6b9c39a9d1f88ce8b5df85b99bdc2a80b86845af","_id":"@criistianlevrero/next-datalayer-core@0.2.0","bugs":{"url":"https://github.com/criistianlevrero/cmsIR-to-next-datalayer/issues"},"homepage":"https://github.com/criistianlevrero/cmsIR-to-next-datalayer#readme","_nodeVersion":"24.15.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-YBHGNhT5/2rN1ZUBQB4seeB7QxsGgOLJZ3TD34bCtH2ASSTEK7miksBacCmeWnrBUp3wkBtJ1szSGnUQNi9CHw==","shasum":"a997bf1223902bf110d0bbaa45bad0f0b57add59","tarball":"https://registry.npmjs.org/@criistianlevrero/next-datalayer-core/-/next-datalayer-core-0.2.0.tgz","fileCount":43,"unpackedSize":66567,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCMEO1HPk6zrym8HLth9h1mQ7fxLRTQh2LVooAcC6TFJAIhAJDtZ7RCHk5KYjLgL17CwMz2fx4moCjDXqkSes2KcnOa"}]},"_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/next-datalayer-core_0.2.0_1788230884547_0.08130668151544529"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-01T02:48:04.417Z","0.2.0":"2026-09-01T02:48:04.674Z","modified":"2026-09-01T02:48:04.937Z"},"maintainers":[{"name":"cristianlevrero","email":"cristianlevrero@gmail.com"}],"description":"Turns a cmsIR intermediate representation into typed Next.js data-layer code: entities, relations, block registry and repository contracts.","homepage":"https://github.com/criistianlevrero/cmsIR-to-next-datalayer#readme","keywords":["cmsir","nextjs","codegen","typescript","data-layer","headless-cms"],"repository":{"type":"git","url":"git+https://github.com/criistianlevrero/cmsIR-to-next-datalayer.git","directory":"packages/core"},"author":{"name":"Cristian Levriero","email":"cristianlevrero@gmail.com"},"bugs":{"url":"https://github.com/criistianlevrero/cmsIR-to-next-datalayer/issues"},"license":"MIT","readme":"# @criistianlevrero/next-datalayer-core\n\nTurns a **cmsIR** intermediate representation into a typed Next.js data layer.\nReads `directus.ir.json` and writes TypeScript you never edit by hand.\n\n## Install\n\n```bash\nnpm install @criistianlevrero/next-datalayer-core\n```\n\n## Usage\n\n```ts\nimport { CodegenService } from \"@criistianlevrero/next-datalayer-core\";\n\nconst result = CodegenService.generate({\n  irPath: \"dist/directus.ir.json\",\n  outDir: \"src/lib/generated\",\n});\n\nconsole.log(result.repositoriesPath, result.warnings);\n```\n\n## What it generates\n\n| File | Contents |\n|------|----------|\n| `entities.types.ts` | One `interface` per collection |\n| `relations.types.ts` | `*Expanded` interfaces and m2a discriminated unions |\n| `collections.metadata.ts` | Runtime descriptors — field types, relation metadata |\n| `block-registry.ts` | Registry for m2a / polymorphic block rendering |\n| `repositories.ts` | `createRepositories(adapter)`, a typed repository factory |\n\nRegenerate after every schema change; the files carry a \"do not edit\" header.\n\n## Also exported\n\n- `IRProcessor` — load and query an IR document at runtime (adapters take the\n  resulting `irContext`)\n- `CodegenService`, `BlockRegistryGenerator`, `RepositoriesGenerator`\n- The `CanonicalEntity`, `IRContext`, `RepositoryContract` and\n  `WritableRepository` types that define the adapter contract\n\n## Adapters\n\nThe generated repositories are adapter-agnostic. Pair with\n[`adapter-directus`](https://www.npmjs.com/package/@criistianlevrero/next-datalayer-adapter-directus)\nor [`adapter-local`](https://www.npmjs.com/package/@criistianlevrero/next-datalayer-adapter-local).\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-b861b49366a56873016db75d31108fbf"}