@qkix/strapi-plugin-rewind 0.1.2 → 0.1.3
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 +29 -5
- package/dist/admin/src/diffRegistry.d.ts +6 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -156,18 +156,42 @@ package that owns the format can show that, so the mapping is a registry:
|
|
|
156
156
|
```ts
|
|
157
157
|
import { registerDiffRenderer } from '@qkix/strapi-plugin-rewind/strapi-admin';
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
import { MyBlocksDiff } from './MyBlocksDiff'; // yours — see below
|
|
160
|
+
|
|
161
|
+
registerDiffRenderer('plugin::better-blocks.better-blocks', MyBlocksDiff);
|
|
160
162
|
```
|
|
161
163
|
|
|
162
164
|
Keyed by a custom field's uid, or by an attribute `type`. A uid wins over a
|
|
163
165
|
type, since every custom field stores itself as `json`.
|
|
164
166
|
|
|
167
|
+
> **Bring your own renderer.** Rewind ships the registry, not the renderers. No
|
|
168
|
+
> `@qkix` package currently exports a block-aware diff component — including
|
|
169
|
+
> Better Blocks — so the component above is one you write. A renderer receives
|
|
170
|
+
> the two values and returns the `FieldChange` shape exported alongside
|
|
171
|
+
> `registerDiffRenderer`; without one registered, a field falls back to the
|
|
172
|
+
> generic text diff. A ready-made renderer for Better Blocks documents is
|
|
173
|
+
> wanted, and not yet written.
|
|
174
|
+
|
|
165
175
|
## Configuration
|
|
166
176
|
|
|
167
|
-
| Option
|
|
168
|
-
|
|
|
169
|
-
| `contentTypes`
|
|
170
|
-
| `trackApiWrites`
|
|
177
|
+
| Option | Default | Meaning |
|
|
178
|
+
| -------------------------- | ------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
179
|
+
| `contentTypes` | `[]` | Which content types to version. Empty means none. |
|
|
180
|
+
| `trackApiWrites` | `false` | Also version writes from outside the Content Manager (REST, GraphQL, programmatic). `userId` is null for those. |
|
|
181
|
+
| `retention.enabled` | `true` | Thin old versions on a schedule. `false` keeps everything forever and leaves the table to you. |
|
|
182
|
+
| `retention.keepAllDays` | `7` | Keep every version this many days back. |
|
|
183
|
+
| `retention.dailyUntilDays` | `30` | Then keep one a day, up to this age. |
|
|
184
|
+
| `retention.maxAgeDays` | `365` | Then keep one a week, and drop anything older. |
|
|
185
|
+
| `retention.keepAnchors` | `true` | Never thin publish, unpublish, discard or restore versions, whatever their age. |
|
|
186
|
+
| `cron` | `'0 3 * * *'` | When the thinning runs, in the server's timezone. |
|
|
187
|
+
|
|
188
|
+
The three windows must widen in order — `keepAllDays <= dailyUntilDays <=
|
|
189
|
+
maxAgeDays` — and the plugin refuses to boot rather than delete on a guess if
|
|
190
|
+
they do not. Pinned versions are never thinned either, independently of
|
|
191
|
+
`keepAnchors`.
|
|
192
|
+
|
|
193
|
+
So out of the box a year of history costs roughly: every save for a week, one a
|
|
194
|
+
day for a month, one a week after that, plus every publish and every pin.
|
|
171
195
|
|
|
172
196
|
## Limits
|
|
173
197
|
|
|
@@ -37,9 +37,14 @@ export type DiffRenderer = React.ComponentType<{
|
|
|
37
37
|
* the type-to-component mapping is a registry rather than a switch:
|
|
38
38
|
*
|
|
39
39
|
* import { registerDiffRenderer } from '@qkix/strapi-plugin-rewind/strapi-admin';
|
|
40
|
-
* registerDiffRenderer('plugin::better-blocks.better-blocks',
|
|
40
|
+
* registerDiffRenderer('plugin::better-blocks.better-blocks', MyBlocksDiff);
|
|
41
41
|
*
|
|
42
42
|
* Keyed by the attribute's `type`, or by a custom field's uid.
|
|
43
|
+
*
|
|
44
|
+
* `MyBlocksDiff` above is the caller's own component. No @qkix package exports
|
|
45
|
+
* one today — this is the hook for writing it, not a wiring instruction for
|
|
46
|
+
* something that already exists. Without a renderer registered, the field falls
|
|
47
|
+
* back to the generic text diff.
|
|
43
48
|
*/
|
|
44
49
|
export declare const registerDiffRenderer: (type: string, renderer: DiffRenderer) => void;
|
|
45
50
|
export declare const getDiffRenderer: (type: string) => DiffRenderer | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qkix/strapi-plugin-rewind",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Document version history for Strapi v5 — snapshots on every save, with restore",
|
|
5
5
|
"strapi": {
|
|
6
6
|
"kind": "plugin",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"styled-components": "^6.1.17",
|
|
56
56
|
"typescript": "^5.8.3",
|
|
57
57
|
"vitest": "^3.2.4",
|
|
58
|
-
"@qkix/strapi-test-harness": "0.0.0",
|
|
59
58
|
"@qkix/eslint-config": "0.0.0",
|
|
59
|
+
"@qkix/strapi-test-harness": "0.0.0",
|
|
60
60
|
"@qkix/tsconfig": "0.0.0"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|