{"_id":"@arc-lang/arc-versioning","name":"@arc-lang/arc-versioning","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@arc-lang/arc-versioning","version":"0.1.0","description":"Automatic model versioning and history for Arc — every mutation snapshotted, one-click revert","main":"src/index.js","types":"src/types/index.d.ts","scripts":{"test":"node --test tests/*.test.js","test:coverage":"node --test --experimental-test-coverage tests/*.test.js"},"keywords":["arc","versioning","history","audit-log","revert","cms","django-reversion","django-simple-history"],"repository":{"type":"git","url":"git+https://github.com/arc-language/arc-versioning.git"},"homepage":"https://arc-language.dev/docs/versioning","bugs":{"url":"https://github.com/arc-language/arc-versioning/issues"},"license":"MIT","engines":{"node":">=18.0.0"},"peerDependencies":{"@arc-lang/arc":">=0.2.0"},"peerDependenciesMeta":{"@arc-lang/arc":{"optional":true}},"publishConfig":{"access":"public"},"gitHead":"7b84f4f79688e8f151da8ba545fa7291d41b1cec","_id":"@arc-lang/arc-versioning@0.1.0","_nodeVersion":"24.15.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-W+sVN7PS95hCblHGKdvnBhIq8Phown7dKsrjusmaFKOh1RIYGeS4wkp53wgEpe+HENEdLjqkdBWC0e3Ty8yRtg==","shasum":"4dd7ddd7f5fde51e45393fcc2540423f9e814f7a","tarball":"https://registry.npmjs.org/@arc-lang/arc-versioning/-/arc-versioning-0.1.0.tgz","fileCount":7,"unpackedSize":18921,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDL0BzjJf9rNlivc78X0BHSBjnHFe11qkP0yGcaSn7FUAIge6xfEOEl2PwWplpgYfvkdVpV/3t8B5MFb+CGuKjaCnw="}]},"_npmUser":{"name":"kobecuppens","email":"kobecuppens@hotmail.com"},"directories":{},"maintainers":[{"name":"kobecuppens","email":"kobecuppens@hotmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/arc-versioning_0.1.0_1780407184299_0.6168017525861391"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-02T13:33:04.190Z","0.1.0":"2026-06-02T13:33:04.445Z","modified":"2026-06-02T13:33:04.714Z"},"maintainers":[{"name":"kobecuppens","email":"kobecuppens@hotmail.com"}],"description":"Automatic model versioning and history for Arc — every mutation snapshotted, one-click revert","homepage":"https://arc-language.dev/docs/versioning","keywords":["arc","versioning","history","audit-log","revert","cms","django-reversion","django-simple-history"],"repository":{"type":"git","url":"git+https://github.com/arc-language/arc-versioning.git"},"bugs":{"url":"https://github.com/arc-language/arc-versioning/issues"},"license":"MIT","readme":"# arc-versioning\n\nAutomatic model versioning and history for Arc — every mutation snapshotted, one-click revert.\n\nInspired by [django-reversion](https://github.com/etianen/django-reversion) and [django-simple-history](https://github.com/treyhunner/django-simple-history).\n\n## Installation\n\n```bash\nnpm install arc-versioning\n```\n\nAdd to `arc.config.json`:\n\n```json\n{ \"packages\": [\"arc-versioning\"] }\n```\n\nThat's it. Every model is automatically versioned on the next `arc serve` or `arc build`.\n\n## Configuration (optional)\n\n```json\n{\n  \"packages\": [\"arc-versioning\"],\n  \"versioning\": {\n    \"maxVersionsPerRecord\": 100,\n    \"excludeModels\": []\n  }\n}\n```\n\n| Option | Default | Description |\n|---|---|---|\n| `maxVersionsPerRecord` | `100` | Max versions stored per record. Older ones trimmed asynchronously. |\n| `excludeModels` | `[]` | Table names to exclude from versioning. |\n\n## What gets versioned\n\n- All user-defined models automatically\n- arc-cms models (users, pages, groups, media, pageblocks)\n- `_arc_versions` itself is always excluded (recursion prevention)\n\n## Version history API\n\nWhen installed, two API routes are added at `/admin/api`:\n\n```\nGET  /admin/api/versions/:model/:id              — paginated history (20/page, ?page=N)\nGET  /admin/api/versions/:model/:id/:versionId   — single version with field diff\nPOST /admin/api/versions/:model/:id/revert/:versionId  — revert to snapshot\n```\n\nBoth routes require `admin` or `editor` role.\n\n## History UI\n\nA history viewer is available at `/admin/history/:model/:id` within arc-cms. It shows:\n\n- Timeline of changes, newest first\n- Color-coded action badges (create / update / delete / revert)\n- User attribution and timestamps\n- Expandable field diffs (what changed)\n- One-click revert with confirmation modal\n\n## Performance\n\n- O(log N) insert via indexed table\n- Async trim — never blocks mutations\n- Version write failures log a warning, never crash your app\n- Storage bounded to `maxVersionsPerRecord × models × avg_row_size`\n\n## TypeScript\n\n```ts\nimport type { ArcVersion, VersioningConfig } from 'arc-versioning'\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-10749da9825cf5d46fbd21c24e21bb41"}