@cardinali-studio/adminkit 2.2.5 → 2.2.6
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/dist/app/lib/home.js +5 -1
- package/dist/app/site.d.ts +4 -1
- package/package.json +1 -1
package/dist/app/lib/home.js
CHANGED
|
@@ -60,7 +60,11 @@ export function useHome(active) {
|
|
|
60
60
|
const mapped = site().homeDocument;
|
|
61
61
|
if (contentPersistenceMode() === "d1" && mapped && revision) {
|
|
62
62
|
const revisionId = crypto.randomUUID();
|
|
63
|
-
|
|
63
|
+
/* The Worker validates and may normalize a document before checking its signed
|
|
64
|
+
* representation. Sign the site-owned canonical payload here too, otherwise an
|
|
65
|
+
* obsolete/unknown client field becomes a misleading "documento non valido". */
|
|
66
|
+
const payload = mapped.toPayload ? mapped.toPayload(data) : data;
|
|
67
|
+
await api.saveContent({ revisionId, documentId: mapped.documentId, baseRevisionId: revision.base, expectedDraftRevisionId: revision.expected, kind: mapped.kind, locale: mapped.locale, schemaVersion: mapped.schemaVersion, payload: payload, tombstone: false });
|
|
64
68
|
setRevision({ base: revisionId, expected: revisionId });
|
|
65
69
|
setNotice("Bozza D1 salvata");
|
|
66
70
|
setDirty(false);
|
package/dist/app/site.d.ts
CHANGED
|
@@ -61,12 +61,15 @@ export interface SiteAdminConfig {
|
|
|
61
61
|
modules?: Record<string, boolean>;
|
|
62
62
|
/** Git remains the compatibility default. D1 is an explicit, later site cutover. */
|
|
63
63
|
contentPersistence?: "github" | "d1";
|
|
64
|
-
/** Lossless D1 identity for the singleton home; required before its editor may leave Git.
|
|
64
|
+
/** Lossless D1 identity for the singleton home; required before its editor may leave Git.
|
|
65
|
+
* A site can canonicalize its editor value before the client signs it: this keeps the
|
|
66
|
+
* checksum aligned with the same schema normalization performed by the Worker. */
|
|
65
67
|
homeDocument?: {
|
|
66
68
|
documentId: string;
|
|
67
69
|
kind: string;
|
|
68
70
|
locale: string;
|
|
69
71
|
schemaVersion: number;
|
|
72
|
+
toPayload?: (home: Record<string, unknown>) => unknown;
|
|
70
73
|
};
|
|
71
74
|
/** Identity plus the deliberately site-owned conversion between the generic
|
|
72
75
|
* settings form and an immutable D1 document payload. A site may persist the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cardinali-studio/adminkit",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Motore riusabile di un pannello di amministrazione per siti Hugo su Cloudflare Pages: codec del front matter guidato dallo schema, form React, libreria media su R2. NIENTE di specifico di un sito qui dentro.",
|
|
6
6
|
"license": "UNLICENSED",
|