{"_id":"@adamlockhart/document-engine","_rev":"2-0616fa8f9de87d447f9f50dc97fc858a","name":"@adamlockhart/document-engine","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@adamlockhart/document-engine","version":"1.0.0","license":"MIT","_id":"@adamlockhart/document-engine@1.0.0","maintainers":[{"name":"adamlockhart","email":"adamlockhart12@gmail.com"}],"dist":{"shasum":"1d9506b285556b23d1ae344aca616d61e8dae5bd","tarball":"https://registry.npmjs.org/@adamlockhart/document-engine/-/document-engine-1.0.0.tgz","fileCount":3,"integrity":"sha512-LbUBpj42TtgYCqGgD4H0nJeiGSeJAkeePHNIDpHaBvRdVnxCSg3xQQ8Cn9jtXXS0Xczh7MAxlC68ldP+fBF0Bw==","signatures":[{"sig":"MEQCIGrE7oYAaZO+uVHOsHa2vmjUVu4uWFZ+bRr8+5DUYeKMAiAePjkOTuwlQaWs67uriLx24/T+pRUPfYuZ30GbnxPeYg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4374},"main":"./dist/document-engine.umd.cjs","type":"module","module":"./dist/document-engine.js","exports":{".":{"import":"./dist/document-engine.js","require":"./dist/document-engine.umd.cjs"}},"gitHead":"8338bceb70262aa460ff2eadc254425abdf91d47","scripts":{"dev":"vite build --watch","build":"vite build"},"_npmUser":{"name":"adamlockhart","email":"adamlockhart12@gmail.com"},"_npmVersion":"10.9.4","description":"localStorage document persistence with optional JSON Schema validation","directories":{},"_nodeVersion":"22.21.1","dependencies":{"ajv":"^8.17.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.3.5"},"_npmOperationalInternal":{"tmp":"tmp/document-engine_1.0.0_1784827746466_0.5118044197400702","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@adamlockhart/document-engine","version":"1.0.1","description":"localStorage document persistence with optional JSON Schema validation","type":"module","main":"./dist/document-engine.umd.cjs","module":"./dist/document-engine.js","exports":{".":{"import":"./dist/document-engine.js","require":"./dist/document-engine.umd.cjs"}},"scripts":{"build":"vite build","dev":"vite build --watch"},"dependencies":{"ajv":"^8.17.1"},"devDependencies":{"vite":"^6.3.5"},"license":"MIT","publishConfig":{"access":"public"},"_id":"@adamlockhart/document-engine@1.0.1","gitHead":"1fb800cca13493231f84ce50dc9b89a895a67b90","_nodeVersion":"22.21.1","_npmVersion":"10.9.4","dist":{"integrity":"sha512-krCWjEktgDN+B37z9Jm1Ow368v9I7xrnajchje/UnQ/LK2IwqDrJKesdtgSN2sXzLYpurmR8+pXBAqQPYB5Lgg==","shasum":"0e3e139a7e14ab66594efa5f492bc8da1daef7dc","tarball":"https://registry.npmjs.org/@adamlockhart/document-engine/-/document-engine-1.0.1.tgz","fileCount":4,"unpackedSize":5689,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDS4lJom0x1OkhWtDeHiYrkI9adH6tOvOJII5AFCVVRTwIgbaorAsZcpR9qzeebZ+Q/cqA4aPvIKgjJp2q25x9QY+w="}]},"_npmUser":{"name":"adamlockhart","email":"adamlockhart12@gmail.com"},"directories":{},"maintainers":[{"name":"adamlockhart","email":"adamlockhart12@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/document-engine_1.0.1_1784832995046_0.6541320874265957"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-23T17:29:06.248Z","modified":"2026-07-23T18:56:35.292Z","1.0.0":"2026-07-23T17:29:06.600Z","1.0.1":"2026-07-23T18:56:35.181Z"},"license":"MIT","description":"localStorage document persistence with optional JSON Schema validation","maintainers":[{"name":"adamlockhart","email":"adamlockhart12@gmail.com"}],"readme":"# @adamlockhart/document-engine\n\nlocalStorage document persistence with optional JSON Schema validation.\n\n## Install\n\n```sh\nnpm install @adamlockhart/document-engine\n```\n\n## Usage\n\n```js\nimport { DocumentEngine } from '@adamlockhart/document-engine';\n\nconst docs = new DocumentEngine('my-app');\n\ndocs.save('untitled', { version: '1.0', data: [] });\nconst doc = docs.load('untitled');\nconst names = docs.list();\ndocs.remove('untitled');\n```\n\n### With schema validation\n\n```js\nimport { DocumentEngine } from '@adamlockhart/document-engine';\nimport schema from './my-schema.json';\n\nconst docs = new DocumentEngine('my-app', { schema });\n\n// Throws if the document doesn't match the schema:\ndocs.save('untitled', invalidDoc);\ndocs.load('untitled'); // also validates on load\n```\n\n## API\n\n### `new DocumentEngine(namespace, options?)`\n\n| Param | Type | Description |\n|-------|------|-------------|\n| `namespace` | `string` | Prefix for localStorage keys |\n| `options.schema` | `object` | Optional JSON Schema; validates on save and load |\n\n### Methods\n\n- `save(name, doc)` — save a document (validates if schema provided)\n- `load(name)` — load a document, returns `null` if not found (validates if schema provided)\n- `list()` — list all saved document names\n- `remove(name)` — delete a document\n\n## License\n\nMIT\n","readmeFilename":"README.md"}