@molecule/api-resource-version-history 1.0.9 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/package.json +5 -2
- package/src/__setup__/versions.sql +2 -3
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-
|
|
6
|
+
Generated: 2026-12-05T17:18:46.447Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/api-resource-version-history
|
|
@@ -68,7 +68,7 @@ await createVersion({
|
|
|
68
68
|
## Installation
|
|
69
69
|
|
|
70
70
|
```bash
|
|
71
|
-
npm install @molecule/api-resource-version-history @molecule/api-database @molecule/api-i18n @molecule/api-
|
|
71
|
+
npm install @molecule/api-resource-version-history @molecule/api-database @molecule/api-i18n @molecule/api-logger zod
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
## API
|
|
@@ -761,18 +761,18 @@ Peer dependencies:
|
|
|
761
761
|
|
|
762
762
|
- `@molecule/api-database` ^1.0.1
|
|
763
763
|
- `@molecule/api-i18n` ^1.0.1
|
|
764
|
-
- `@molecule/api-locales-resource-version-history` ^1.0.1
|
|
764
|
+
- `@molecule/api-locales-resource-version-history` ^1.0.1 _(optional)_
|
|
765
765
|
- `@molecule/api-logger` ^1.0.1
|
|
766
|
-
- `@molecule/api-resource` ^1.0.1
|
|
766
|
+
- `@molecule/api-resource` ^1.0.1 _(optional)_
|
|
767
767
|
- `zod` ^4.0.0
|
|
768
768
|
|
|
769
769
|
### Runtime Dependencies
|
|
770
770
|
|
|
771
771
|
- `@molecule/api-database`
|
|
772
772
|
- `@molecule/api-i18n`
|
|
773
|
-
- `@molecule/api-locales-resource-version-history`
|
|
773
|
+
- `@molecule/api-locales-resource-version-history` _(optional)_
|
|
774
774
|
- `@molecule/api-logger`
|
|
775
|
-
- `@molecule/api-resource`
|
|
775
|
+
- `@molecule/api-resource` _(optional)_
|
|
776
776
|
- `zod`
|
|
777
777
|
|
|
778
778
|
- **List endpoints return a PAGINATED envelope** `{ data, total, limit, offset }`, not a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/api-resource-version-history",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "Append-only versions table with diff and restore — generic versioning helper for any resource.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
],
|
|
32
32
|
"license": "Apache-2.0",
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@molecule/api-locales-resource-version-history": "1.0.
|
|
34
|
+
"@molecule/api-locales-resource-version-history": "1.0.3",
|
|
35
35
|
"@types/node": "26.6.5",
|
|
36
36
|
"typescript": "6.0.3",
|
|
37
37
|
"vitest": "4.1.12",
|
|
@@ -46,6 +46,9 @@
|
|
|
46
46
|
"zod": "^4.0.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependenciesMeta": {
|
|
49
|
+
"@molecule/api-locales-resource-version-history": {
|
|
50
|
+
"optional": true
|
|
51
|
+
},
|
|
49
52
|
"@molecule/api-resource": {
|
|
50
53
|
"optional": true
|
|
51
54
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
CREATE TABLE IF NOT EXISTS "versions" (
|
|
2
|
-
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
2
|
+
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
3
3
|
"resourceType" VARCHAR(255) NOT NULL,
|
|
4
4
|
"resourceId" VARCHAR(255) NOT NULL,
|
|
5
|
-
"version" INTEGER NOT NULL,
|
|
5
|
+
"version" INTEGER NOT NULL CHECK ("version" >= 1),
|
|
6
6
|
"userId" UUID,
|
|
7
7
|
"snapshot" JSONB NOT NULL,
|
|
8
8
|
"changes" JSONB,
|
|
@@ -11,6 +11,5 @@ CREATE TABLE IF NOT EXISTS "versions" (
|
|
|
11
11
|
CONSTRAINT "uq_versions_resource_version" UNIQUE ("resourceType", "resourceId", "version")
|
|
12
12
|
);
|
|
13
13
|
|
|
14
|
-
CREATE INDEX IF NOT EXISTS "idx_versions_resource" ON "versions" ("resourceType", "resourceId");
|
|
15
14
|
CREATE INDEX IF NOT EXISTS "idx_versions_created" ON "versions" ("createdAt");
|
|
16
15
|
CREATE INDEX IF NOT EXISTS "idx_versions_user" ON "versions" ("userId");
|