@kardalum/plugin-sdk 0.17.0 → 0.18.0

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.
Files changed (174) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/README.md +4 -3
  3. package/dist/assets/asset-picker.d.ts +11 -0
  4. package/dist/assets/asset-picker.js +109 -0
  5. package/dist/assets/asset-tree.d.ts +30 -0
  6. package/dist/assets/asset-tree.js +150 -0
  7. package/dist/built-in-editor-ids.d.ts +1 -0
  8. package/dist/built-in-editor-ids.js +20 -0
  9. package/dist/built-in-settings-schemas.d.ts +2 -0
  10. package/dist/built-in-settings-schemas.js +27 -0
  11. package/dist/built-in-value-schemas.js +3 -0
  12. package/dist/built-ins.js +10 -1
  13. package/dist/capabilities.js +5 -0
  14. package/dist/datatype-validation.js +18 -4
  15. package/dist/datatypes-entry.d.ts +1 -0
  16. package/dist/datatypes-entry.js +1 -0
  17. package/dist/entitlement-entry.d.ts +3 -2
  18. package/dist/entitlement-entry.js +13 -1
  19. package/dist/entitlement-gate.d.ts +18 -0
  20. package/dist/entitlement-gate.js +95 -21
  21. package/dist/entitlement-plan.d.ts +21 -0
  22. package/dist/entitlement-plan.js +26 -0
  23. package/dist/entitlement-types.d.ts +21 -4
  24. package/dist/entitlement.d.ts +29 -1
  25. package/dist/entitlement.js +39 -0
  26. package/dist/grid-arrow-step.d.ts +7 -0
  27. package/dist/grid-arrow-step.js +20 -0
  28. package/dist/index.d.ts +6 -1
  29. package/dist/index.js +7 -12
  30. package/dist/manifest-entry.d.ts +4 -0
  31. package/dist/manifest-entry.js +4 -0
  32. package/dist/manifest-schema.d.ts +5 -1
  33. package/dist/manifest-schema.js +7 -1
  34. package/dist/manifest.d.ts +21 -1
  35. package/dist/media/media-picker.js +32 -32
  36. package/dist/notify.d.ts +17 -0
  37. package/dist/notify.js +17 -0
  38. package/dist/richtext/block-panel.js +17 -18
  39. package/dist/richtext/extensions.js +10 -1
  40. package/dist/richtext/insert-menu.js +1 -1
  41. package/dist/richtext/kardalum-block.js +17 -17
  42. package/dist/richtext/style-listbox.js +1 -1
  43. package/dist/richtext-html-entry.d.ts +35 -0
  44. package/dist/richtext-html-entry.js +73 -0
  45. package/dist/structured-storage-types.d.ts +11 -0
  46. package/dist/tailwind.js +10 -3
  47. package/dist/tokens/tailwind-theme.css +176 -0
  48. package/dist/tokens/tokens.css +1 -0
  49. package/dist/tokens/tokens.json +2 -1
  50. package/dist/vendor-check.d.ts +39 -0
  51. package/dist/vendor-check.js +79 -0
  52. package/dist/vendor-entry.d.ts +3 -0
  53. package/dist/vendor-entry.js +9 -0
  54. package/dist/vendor-service.d.ts +20 -0
  55. package/dist/vendor-service.js +20 -0
  56. package/dist/views/asset-view.d.ts +6 -0
  57. package/dist/views/asset-view.js +55 -0
  58. package/dist/views/content-list-settings-view.js +1 -1
  59. package/dist/views/content-list-view.js +1 -1
  60. package/dist/views/html-code-editor.js +0 -1
  61. package/dist/views/image-view.js +1 -1
  62. package/dist/views/rich-text-view.js +30 -30
  63. package/node_modules/@kardalum/api-schemas/README.md +1 -1
  64. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +16 -14
  65. package/node_modules/@kardalum/api-schemas/dist/asset-field.schema.d.ts +21 -0
  66. package/node_modules/@kardalum/api-schemas/dist/asset-field.schema.js +42 -0
  67. package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +1 -0
  68. package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +10 -3
  69. package/node_modules/@kardalum/api-schemas/dist/checkout-shown.schema.d.ts +36 -0
  70. package/node_modules/@kardalum/api-schemas/dist/checkout-shown.schema.js +46 -0
  71. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +12 -0
  72. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +16 -1
  73. package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +12 -6
  74. package/node_modules/@kardalum/api-schemas/dist/core-actions.js +11 -6
  75. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +50 -0
  76. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +25 -5
  77. package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.d.ts +1 -0
  78. package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +3 -0
  79. package/node_modules/@kardalum/api-schemas/dist/data-type-cursor.d.ts +11 -0
  80. package/node_modules/@kardalum/api-schemas/dist/data-type-cursor.js +28 -0
  81. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +42 -2
  82. package/node_modules/@kardalum/api-schemas/dist/home.schema.d.ts +130 -0
  83. package/node_modules/@kardalum/api-schemas/dist/home.schema.js +87 -0
  84. package/node_modules/@kardalum/api-schemas/dist/index.d.ts +41 -15
  85. package/node_modules/@kardalum/api-schemas/dist/index.js +30 -10
  86. package/node_modules/@kardalum/api-schemas/dist/kardalum-latest.schema.d.ts +7 -0
  87. package/node_modules/@kardalum/api-schemas/dist/kardalum-latest.schema.js +9 -0
  88. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +115 -1
  89. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +102 -1
  90. package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.d.ts +17 -0
  91. package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.js +16 -0
  92. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +26 -0
  93. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +6 -0
  94. package/node_modules/@kardalum/api-schemas/dist/media-reference-use.d.ts +10 -0
  95. package/node_modules/@kardalum/api-schemas/dist/media-reference-use.js +4 -4
  96. package/node_modules/@kardalum/api-schemas/dist/news.schema.d.ts +93 -0
  97. package/node_modules/@kardalum/api-schemas/dist/news.schema.js +86 -0
  98. package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +13 -0
  99. package/node_modules/@kardalum/api-schemas/dist/notification.schema.d.ts +410 -0
  100. package/node_modules/@kardalum/api-schemas/dist/notification.schema.js +193 -0
  101. package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.d.ts +86 -0
  102. package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.js +92 -0
  103. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +7 -2
  104. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +7 -0
  105. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +227 -0
  106. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +157 -31
  107. package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.d.ts +19 -0
  108. package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.js +33 -0
  109. package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.d.ts +10 -1
  110. package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.js +24 -4
  111. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +5 -0
  112. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +23 -20
  113. package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.d.ts +83 -0
  114. package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.js +73 -0
  115. package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +14 -0
  116. package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +7 -0
  117. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +3 -3
  118. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +1 -1
  119. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +10 -0
  120. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +26 -11
  121. package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +7 -0
  122. package/node_modules/@kardalum/api-schemas/dist/template.schema.js +22 -10
  123. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +12 -0
  124. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +5 -0
  125. package/node_modules/@kardalum/api-schemas/dist/uuid.schema.d.ts +2 -0
  126. package/node_modules/@kardalum/api-schemas/dist/uuid.schema.js +4 -0
  127. package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.d.ts +88 -0
  128. package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.js +100 -0
  129. package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.d.ts +13 -0
  130. package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.js +5 -0
  131. package/node_modules/@kardalum/design-tokens/README.md +1 -1
  132. package/node_modules/@kardalum/design-tokens/dist/build-theme-css.d.ts +16 -0
  133. package/node_modules/@kardalum/design-tokens/dist/build-theme-css.js +76 -0
  134. package/node_modules/@kardalum/design-tokens/dist/generate.js +4 -1
  135. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +176 -0
  136. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +1 -1
  137. package/node_modules/@kardalum/design-tokens/dist/tokens.css +1 -0
  138. package/node_modules/@kardalum/design-tokens/dist/tokens.js +1 -0
  139. package/node_modules/@kardalum/design-tokens/dist/tokens.json +2 -1
  140. package/node_modules/@kardalum/design-tokens/dist/types.d.ts +1 -0
  141. package/node_modules/@kardalum/design-tokens/package.json +6 -3
  142. package/node_modules/@kardalum/plugin-package/README.md +1 -1
  143. package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +4 -4
  144. package/node_modules/@kardalum/plugin-package/dist/capabilities.js +54 -6
  145. package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.js +1 -1
  146. package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.d.ts +3 -0
  147. package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +18 -1
  148. package/node_modules/@kardalum/plugin-package/dist/delivery/limits.d.ts +1 -1
  149. package/node_modules/@kardalum/plugin-package/dist/delivery/limits.js +1 -1
  150. package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +8 -4
  151. package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +1 -0
  152. package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +58 -1
  153. package/node_modules/@kardalum/plugin-package/dist/extract.js +1 -1
  154. package/node_modules/@kardalum/plugin-package/dist/index.d.ts +4 -2
  155. package/node_modules/@kardalum/plugin-package/dist/index.js +3 -1
  156. package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +56 -19
  157. package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +119 -25
  158. package/node_modules/@kardalum/plugin-package/dist/vendor-token.d.ts +24 -0
  159. package/node_modules/@kardalum/plugin-package/dist/vendor-token.js +118 -0
  160. package/node_modules/@kardalum/ui/README.md +1 -1
  161. package/node_modules/@kardalum/ui/dist/components/button.js +1 -1
  162. package/node_modules/@kardalum/ui/dist/components/checkbox.js +1 -1
  163. package/node_modules/@kardalum/ui/dist/components/dialog.js +5 -2
  164. package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +2 -2
  165. package/node_modules/@kardalum/ui/dist/components/input.js +1 -1
  166. package/node_modules/@kardalum/ui/dist/components/popover-panel.d.ts +4 -0
  167. package/node_modules/@kardalum/ui/dist/components/popover-panel.js +13 -0
  168. package/node_modules/@kardalum/ui/dist/components/sheet.js +5 -4
  169. package/node_modules/@kardalum/ui/dist/components/switch.js +1 -1
  170. package/node_modules/@kardalum/ui/dist/components/tab-strip.js +1 -1
  171. package/node_modules/@kardalum/ui/dist/components/toast.js +1 -1
  172. package/node_modules/@kardalum/ui/dist/index.d.ts +1 -0
  173. package/node_modules/@kardalum/ui/dist/index.js +1 -0
  174. package/package.json +17 -4
@@ -1,16 +1,17 @@
1
1
  import { z } from "zod";
2
+ import { ReadOnlyFieldSchema } from "./plugin-read-only.schema.js";
2
3
  import { CultureSchema } from "./content-api.schema.js";
3
4
  import { MediaVisibilitySchema } from "./media.schema.js";
4
- // Session 112: serializer-contribution output. Keyed by pluginId —
5
+ // Session 112: serializer-contribution output. Keyed by pluginId:
5
6
  // structurally separate from core fields and `data`, so a contribution
6
7
  // can never remove or overwrite either. Present only when at least one
7
8
  // active plugin's extendContentResponse produced a value.
8
9
  export const PublicContentExtensionsSchema = z.record(z.string(), z.record(z.string(), z.unknown()));
9
10
  // The public Content API's own wire contract (Month 9). Deliberately NOT
10
- // a re-export of the backoffice ContentNode/ContentVersion shapes — the
11
+ // a re-export of the backoffice ContentNode/ContentVersion shapes: the
11
12
  // public surface exposes only what an external consumer needs, and can
12
13
  // stay stable while internal shapes evolve. Session 103 widens this file.
13
- // Session 116: `publishedAt` is nullable ONLY here — a verified preview
14
+ // Session 116: `publishedAt` is nullable ONLY here: a verified preview
14
15
  // token can serve a genuinely-draft node's latest version, which has no
15
16
  // publishedAt. Every other public schema (summaries/lists) stays on the
16
17
  // published-only surface and keeps its non-null publishedAt unchanged.
@@ -33,7 +34,7 @@ export const PublicContentItemSchema = z.object({
33
34
  // `locale` mirrors the backoffice contract exactly (content-api.schema).
34
35
  // `previewToken` (Session 116) is a stateless signed token minted by
35
36
  // POST /api/manage/v1/content/:id/preview-token; verified once per request against
36
- // the FINAL resolved (post-locale) node id — see published-item.ts.
37
+ // the FINAL resolved (post-locale) node id (see published-item.ts).
37
38
  export const PublicContentItemQuerySchema = z.object({
38
39
  // S230: validated as a language tag, identically to the backoffice
39
40
  // route. It used to be any string of two or more characters, so a
@@ -42,7 +43,7 @@ export const PublicContentItemQuerySchema = z.object({
42
43
  format: z.string().regex(/^[a-z0-9.-]+:[a-z0-9-]+$/).optional(),
43
44
  previewToken: z.string().optional(),
44
45
  });
45
- // A custom-format read (?format=<pluginId>:<name>) — the plugin's whole
46
+ // A custom-format read (?format=<pluginId>:<name>). The plugin's whole
46
47
  // projection rides in `content`; the caller asked for the plugin's shape,
47
48
  // so the server imposes nothing beyond JSON-serializability.
48
49
  export const PublicContentFormatResponseSchema = z.object({
@@ -81,7 +82,7 @@ export const PublicContentListQuerySchema = z.object({
81
82
  limit: z.coerce.number().int().min(1).max(100).default(50),
82
83
  });
83
84
  // The tree-walk row: everything a consumer needs to render navigation and
84
- // fetch the full item — no version data (fetch by id for that), and
85
+ // fetch the full item: no version data (fetch by id for that), and
85
86
  // publishedAt is non-nullable by construction (published-only surface).
86
87
  export const PublicContentNodeSummarySchema = z.object({
87
88
  id: z.string().uuid(),
@@ -120,7 +121,7 @@ export const PublicSitesResponseSchema = z.object({
120
121
  items: z.array(PublicSiteSchema),
121
122
  nextCursor: z.string().nullable(),
122
123
  });
123
- // GET /api/v1/content — combinable filters over the published surface.
124
+ // GET /api/v1/content: combinable filters over the published surface.
124
125
  // `under` is a published node's id; the server resolves it to a subtree
125
126
  // path filter (strict descendants). q is a case-insensitive substring
126
127
  // (ASCII-pinned), min 2 chars so a single char can't trigger full scans.
@@ -174,7 +175,7 @@ export const PublicMediaListResponseSchema = z.object({
174
175
  // Public document type introspection. Deliberately narrower than the
175
176
  // backoffice DocumentTypeDefinitionSchema: tabs (admin-UI organization),
176
177
  // treeRules (an admin content-placement rule), and defaultTemplateId (an
177
- // editor pointer — the separate templates resource covers discovery) are
178
+ // editor pointer; the separate templates resource covers discovery) are
178
179
  // all excluded. Just enough to interpret a fetched ContentVersion.data:
179
180
  // each field's data key (id), display name, datatypeId, and its
180
181
  // client-facing validation rules.
@@ -225,7 +226,7 @@ export const PublicDocumentTypeListResponseSchema = z.object({
225
226
  items: z.array(PublicDocumentTypeSchema),
226
227
  nextCursor: z.string().uuid().nullable(),
227
228
  });
228
- // Templates are inert data (headless-first decision) — the public shape
229
+ // Templates are inert data (headless-first decision): the public shape
229
230
  // is the same three fields the backoffice already exposes, defined fresh
230
231
  // as its own contract rather than re-exporting TemplateDefinitionSchema.
231
232
  export const PublicTemplateSchema = z.object({
@@ -243,10 +244,12 @@ export const PublicTemplateListResponseSchema = z.object({
243
244
  nextCursor: z.string().uuid().nullable(),
244
245
  });
245
246
  // Public content write shapes (Month 9, Session 107). The write surface is
246
- // key-gated and NOT published-only — a writer operates on a node by id in
247
+ // key-gated and NOT published-only: a writer operates on a node by id in
247
248
  // any publish state, so `publishedAt` here is nullable (a fresh draft),
248
249
  // unlike the read PublicContentItemSchema's non-null publishedAt.
249
250
  export const PublicContentWriteResponseSchema = z.object({
251
+ // S318: fields kept because their plugin is read-only.
252
+ readOnlyFields: z.array(ReadOnlyFieldSchema).optional(),
250
253
  id: z.string().uuid(),
251
254
  documentTypeId: z.string().uuid(),
252
255
  parentId: z.string().uuid().nullable(),
@@ -265,18 +268,18 @@ export const PublicCreateContentRequestSchema = z.object({
265
268
  slug: z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),
266
269
  data: z.record(z.string(), z.unknown()).default({}),
267
270
  });
268
- // Body for both PUT (full-replace) and PATCH (partial merge) — the verb,
271
+ // Body for both PUT (full-replace) and PATCH (partial merge): the verb,
269
272
  // not the body shape, decides the merge semantics. See the route
270
273
  // descriptions.
271
274
  export const PublicUpdateContentRequestSchema = z.object({
272
275
  data: z.record(z.string(), z.unknown()),
273
276
  });
274
- // DELETE /api/v1/content/:id?cascade=true — cascade opts into trashing a
277
+ // DELETE /api/v1/content/:id?cascade=true: cascade opts into trashing a
275
278
  // node's whole descendant subtree in one call, the API equivalent of the
276
- // admin trash route's confirm:true retry (S154). z.stringbool() — NOT
279
+ // admin trash route's confirm:true retry (S154). z.stringbool() is used, NOT
277
280
  // z.coerce.boolean(), which is plain JS truthiness (Boolean("false") ===
278
281
  // true, so "?cascade=false" would silently perform the cascade it looks
279
- // like it's declining) — parses "true"/"1"/"yes"/"on"/"y"/"enabled" to
282
+ // like it's declining). It parses "true"/"1"/"yes"/"on"/"y"/"enabled" to
280
283
  // true and "false"/"0"/"no"/"off"/"n"/"disabled" to false, and rejects
281
284
  // anything else (including a bare "?cascade" with no value, which arrives
282
285
  // as "") with a clean 400 instead of guessing. Omitting the param
@@ -285,7 +288,7 @@ export const PublicContentDeleteQuerySchema = z.object({
285
288
  cascade: z.stringbool().optional().default(false),
286
289
  });
287
290
  // DELETE /api/v1/content/:id response. Deletion is soft (trash, not
288
- // destroy — content immutability applies to the whole subtree, not just
291
+ // destroy: content immutability applies to the whole subtree, not just
289
292
  // this node), so there is nothing to hand back but a confirmation; same
290
293
  // shape as PublicMediaDeleteResponseSchema below, kept as its own type
291
294
  // since the two write surfaces evolve independently.
@@ -293,8 +296,8 @@ export const PublicContentDeleteResponseSchema = z.object({ ok: z.literal(true)
293
296
  // 409 when the node has descendants and the caller didn't pass
294
297
  // ?cascade=true. Carries the same information the admin trash route's
295
298
  // unconfirmed 409 does (ContentTrashConfirmationSchema: blast radius +
296
- // remedy) reshaped for a single API round trip instead of a UI dialog —
297
- // the remedy is spelled out in the message itself since there's no
299
+ // remedy) reshaped for a single API round trip instead of a UI dialog.
300
+ // The remedy is spelled out in the message itself since there's no
298
301
  // confirmation click to follow up with, so there's no separate
299
302
  // requiresConfirmation/nodeName pair to carry.
300
303
  export const PublicContentDeleteConfirmationSchema = z.object({
@@ -302,7 +305,7 @@ export const PublicContentDeleteConfirmationSchema = z.object({
302
305
  message: z.string(),
303
306
  });
304
307
  // Public media write shapes (Month 9 media write routes). The upload is a
305
- // multipart request — the binary streams separately at the route; this
308
+ // multipart request: the binary streams separately at the route; this
306
309
  // schema covers only the accompanying form fields. No folderId: folders
307
310
  // are an admin-only surface (S186e), never exposed on the public write
308
311
  // API. `.strict()` so a caller that sends folderId here gets a clear 400
@@ -322,7 +325,7 @@ export const PublicMediaUploadBodySchema = PublicMediaUploadFieldsSchema.extend(
322
325
  .file()
323
326
  .describe("The file to store. It must come after the visibility field in the multipart body: a field sent after the file may not be read."),
324
327
  });
325
- // PATCH /api/v1/media/:id body. v1 patches visibility only — metadata
328
+ // PATCH /api/v1/media/:id body. v1 patches visibility only: metadata
326
329
  // (filename, custom fields) is a later task, so visibility is required
327
330
  // rather than optional: this is the only field there is, and an empty
328
331
  // body has nothing to do. folderId is deliberately absent for the same
@@ -334,7 +337,7 @@ export const PublicMediaUpdateRequestSchema = z
334
337
  })
335
338
  .strict();
336
339
  // Upload (POST) and update (PATCH) both hand back the same public media
337
- // item shape already used for reads/lists — an alias, not a fresh shape.
340
+ // item shape already used for reads/lists: an alias, not a fresh shape.
338
341
  export const PublicMediaWriteResponseSchema = PublicMediaFileSchema;
339
342
  // S234e: the route behind this now trashes rather than destroys (the
340
343
  // admin DELETE route made the same change in the same session; see
@@ -0,0 +1,83 @@
1
+ import { z } from "zod";
2
+ /** "YYYY-MM" with a month from 01 to 12. A linear scan with the length
3
+ * checked first, never a regex (the value comes from a query string). */
4
+ export declare function isRevenueMonthKey(value: string): boolean;
5
+ export declare const RevenueMonthKeySchema: z.ZodString;
6
+ /** A plugin id is at most 214 characters (the npm name cap the marketplace uses). */
7
+ export declare const REVENUE_PLUGIN_PARAM_MAX = 214;
8
+ export declare const RevenuePluginParamSchema: z.ZodString;
9
+ export declare const RevenueMonthSchema: z.ZodObject<{
10
+ month: z.ZodString;
11
+ oneTimeCents: z.ZodNumber;
12
+ recurringCents: z.ZodNumber;
13
+ newSubscribers: z.ZodNumber;
14
+ renewals: z.ZodNumber;
15
+ lostSubscribers: z.ZodNumber;
16
+ planChanges: z.ZodNumber;
17
+ netCents: z.ZodNumber;
18
+ }, z.core.$strict>;
19
+ export type RevenueMonth = z.infer<typeof RevenueMonthSchema>;
20
+ export declare const RevenuePlanMonthSchema: z.ZodObject<{
21
+ planId: z.ZodString;
22
+ pluginId: z.ZodString;
23
+ key: z.ZodString;
24
+ name: z.ZodString;
25
+ shape: z.ZodEnum<{
26
+ monthly: "monthly";
27
+ yearly: "yearly";
28
+ }>;
29
+ retired: z.ZodBoolean;
30
+ subscribers: z.ZodNumber;
31
+ newSubscribers: z.ZodNumber;
32
+ renewals: z.ZodNumber;
33
+ lostSubscribers: z.ZodNumber;
34
+ recurringCents: z.ZodNumber;
35
+ netCents: z.ZodNumber;
36
+ }, z.core.$strict>;
37
+ export type RevenuePlanMonth = z.infer<typeof RevenuePlanMonthSchema>;
38
+ export declare const RevenueNowSchema: z.ZodObject<{
39
+ activeSubscribers: z.ZodNumber;
40
+ monthlyRecurringCents: z.ZodNumber;
41
+ monthlyRecurringNetCents: z.ZodNumber;
42
+ cancelling: z.ZodNumber;
43
+ inGrace: z.ZodNumber;
44
+ }, z.core.$strict>;
45
+ export type RevenueNow = z.infer<typeof RevenueNowSchema>;
46
+ export declare const RevenueViewSchema: z.ZodObject<{
47
+ months: z.ZodArray<z.ZodObject<{
48
+ month: z.ZodString;
49
+ oneTimeCents: z.ZodNumber;
50
+ recurringCents: z.ZodNumber;
51
+ newSubscribers: z.ZodNumber;
52
+ renewals: z.ZodNumber;
53
+ lostSubscribers: z.ZodNumber;
54
+ planChanges: z.ZodNumber;
55
+ netCents: z.ZodNumber;
56
+ }, z.core.$strict>>;
57
+ byPlanMonth: z.ZodString;
58
+ byPlan: z.ZodArray<z.ZodObject<{
59
+ planId: z.ZodString;
60
+ pluginId: z.ZodString;
61
+ key: z.ZodString;
62
+ name: z.ZodString;
63
+ shape: z.ZodEnum<{
64
+ monthly: "monthly";
65
+ yearly: "yearly";
66
+ }>;
67
+ retired: z.ZodBoolean;
68
+ subscribers: z.ZodNumber;
69
+ newSubscribers: z.ZodNumber;
70
+ renewals: z.ZodNumber;
71
+ lostSubscribers: z.ZodNumber;
72
+ recurringCents: z.ZodNumber;
73
+ netCents: z.ZodNumber;
74
+ }, z.core.$strict>>;
75
+ now: z.ZodObject<{
76
+ activeSubscribers: z.ZodNumber;
77
+ monthlyRecurringCents: z.ZodNumber;
78
+ monthlyRecurringNetCents: z.ZodNumber;
79
+ cancelling: z.ZodNumber;
80
+ inGrace: z.ZodNumber;
81
+ }, z.core.$strict>;
82
+ }, z.core.$strict>;
83
+ export type RevenueView = z.infer<typeof RevenueViewSchema>;
@@ -0,0 +1,73 @@
1
+ import { z } from "zod";
2
+ // S321b (spec 3a, D1 to D4): what the marketplace portal's Revenue page
3
+ // reads. Months are UTC calendar months as "YYYY-MM" (D3); money is whole
4
+ // USD cents after refunds (D4). No field names a buyer.
5
+ /** "YYYY-MM" with a month from 01 to 12. A linear scan with the length
6
+ * checked first, never a regex (the value comes from a query string). */
7
+ export function isRevenueMonthKey(value) {
8
+ if (value.length !== 7)
9
+ return false;
10
+ for (let i = 0; i < 7; i++) {
11
+ const c = value.charCodeAt(i);
12
+ if (i === 4) {
13
+ if (c !== 45)
14
+ return false;
15
+ }
16
+ else if (c < 48 || c > 57) {
17
+ return false;
18
+ }
19
+ }
20
+ const month = (value.charCodeAt(5) - 48) * 10 + (value.charCodeAt(6) - 48);
21
+ return month >= 1 && month <= 12;
22
+ }
23
+ export const RevenueMonthKeySchema = z.string().refine(isRevenueMonthKey, { message: "Expected a month as YYYY-MM" });
24
+ /** A plugin id is at most 214 characters (the npm name cap the marketplace uses). */
25
+ export const REVENUE_PLUGIN_PARAM_MAX = 214;
26
+ export const RevenuePluginParamSchema = z.string().trim().min(1).max(REVENUE_PLUGIN_PARAM_MAX);
27
+ const Cents = z.number().int().nonnegative();
28
+ const Count = z.number().int().nonnegative();
29
+ export const RevenueMonthSchema = z
30
+ .object({
31
+ month: RevenueMonthKeySchema,
32
+ oneTimeCents: Cents,
33
+ recurringCents: Cents,
34
+ newSubscribers: Count,
35
+ renewals: Count,
36
+ lostSubscribers: Count,
37
+ planChanges: Count,
38
+ netCents: Cents,
39
+ })
40
+ .strict();
41
+ export const RevenuePlanMonthSchema = z
42
+ .object({
43
+ planId: z.string().min(1).max(64),
44
+ pluginId: z.string().min(1).max(REVENUE_PLUGIN_PARAM_MAX),
45
+ key: z.string().min(1),
46
+ name: z.string().min(1),
47
+ shape: z.enum(["monthly", "yearly"]),
48
+ retired: z.boolean(),
49
+ subscribers: Count,
50
+ newSubscribers: Count,
51
+ renewals: Count,
52
+ lostSubscribers: Count,
53
+ recurringCents: Cents,
54
+ netCents: Cents,
55
+ })
56
+ .strict();
57
+ export const RevenueNowSchema = z
58
+ .object({
59
+ activeSubscribers: Count,
60
+ monthlyRecurringCents: Cents,
61
+ monthlyRecurringNetCents: Cents,
62
+ cancelling: Count,
63
+ inGrace: Count,
64
+ })
65
+ .strict();
66
+ export const RevenueViewSchema = z
67
+ .object({
68
+ months: z.array(RevenueMonthSchema).length(12),
69
+ byPlanMonth: RevenueMonthKeySchema,
70
+ byPlan: z.array(RevenuePlanMonthSchema),
71
+ now: RevenueNowSchema,
72
+ })
73
+ .strict();
@@ -112,6 +112,16 @@ export declare const SiteSummarySchema: z.ZodObject<{
112
112
  isDefault: z.ZodBoolean;
113
113
  }, z.core.$strip>;
114
114
  export type SiteSummary = z.infer<typeof SiteSummarySchema>;
115
+ /**
116
+ * S314n (D6, P2): whether this server renders pages (KARDALUM_RENDER) and
117
+ * serves the headless delivery API (KARDALUM_HEADLESS). Both are deploy-time
118
+ * switches, read on every answer.
119
+ */
120
+ export declare const SiteRenderingSchema: z.ZodObject<{
121
+ pages: z.ZodBoolean;
122
+ headless: z.ZodBoolean;
123
+ }, z.core.$strip>;
124
+ export type SiteRendering = z.infer<typeof SiteRenderingSchema>;
115
125
  /**
116
126
  * What GET /api/manage/v1/settings/sites and the two writes answer: the stored pin,
117
127
  * and beside it the default site that pin (or, with nothing pinned, tree
@@ -151,6 +161,10 @@ export declare const SitesSettingsResponseSchema: z.ZodObject<{
151
161
  }, z.core.$strip>>;
152
162
  requestHost: z.ZodString;
153
163
  defaultAddressHost: z.ZodNullable<z.ZodString>;
164
+ rendering: z.ZodOptional<z.ZodObject<{
165
+ pages: z.ZodBoolean;
166
+ headless: z.ZodBoolean;
167
+ }, z.core.$strip>>;
154
168
  }, z.core.$strip>;
155
169
  export type SitesSettingsResponse = z.infer<typeof SitesSettingsResponseSchema>;
156
170
  /**
@@ -297,6 +297,12 @@ export const SiteSummarySchema = z.object({
297
297
  hostnames: z.array(z.string()),
298
298
  isDefault: z.boolean(),
299
299
  });
300
+ /**
301
+ * S314n (D6, P2): whether this server renders pages (KARDALUM_RENDER) and
302
+ * serves the headless delivery API (KARDALUM_HEADLESS). Both are deploy-time
303
+ * switches, read on every answer.
304
+ */
305
+ export const SiteRenderingSchema = z.object({ pages: z.boolean(), headless: z.boolean() });
300
306
  /**
301
307
  * What GET /api/manage/v1/settings/sites and the two writes answer: the stored pin,
302
308
  * and beside it the default site that pin (or, with nothing pinned, tree
@@ -327,6 +333,7 @@ export const SitesSettingsResponseSchema = z.object({
327
333
  sites: z.array(SiteSummarySchema),
328
334
  requestHost: z.string(),
329
335
  defaultAddressHost: z.string().nullable(),
336
+ rendering: SiteRenderingSchema.optional(),
330
337
  });
331
338
  /**
332
339
  * The query of GET /api/manage/v1/sites. The cursor is the id of the previous page's
@@ -8,9 +8,9 @@ export declare const SnapshotResponseSchema: z.ZodObject<{
8
8
  snapshot: z.ZodObject<{
9
9
  id: z.ZodString;
10
10
  createdAt: z.ZodString;
11
+ description: z.ZodNullable<z.ZodString>;
11
12
  createdBy: z.ZodString;
12
13
  label: z.ZodString;
13
- description: z.ZodNullable<z.ZodString>;
14
14
  }, z.core.$strip>;
15
15
  }, z.core.$strip>;
16
16
  export type SnapshotResponse = z.infer<typeof SnapshotResponseSchema>;
@@ -23,9 +23,9 @@ export declare const SnapshotListResponseSchema: z.ZodObject<{
23
23
  items: z.ZodArray<z.ZodObject<{
24
24
  id: z.ZodString;
25
25
  createdAt: z.ZodString;
26
+ description: z.ZodNullable<z.ZodString>;
26
27
  createdBy: z.ZodString;
27
28
  label: z.ZodString;
28
- description: z.ZodNullable<z.ZodString>;
29
29
  }, z.core.$strip>>;
30
30
  nextCursor: z.ZodNullable<z.ZodString>;
31
31
  }, z.core.$strip>;
@@ -34,9 +34,9 @@ export declare const RestoreSnapshotResponseSchema: z.ZodObject<{
34
34
  snapshot: z.ZodObject<{
35
35
  id: z.ZodString;
36
36
  createdAt: z.ZodString;
37
+ description: z.ZodNullable<z.ZodString>;
37
38
  createdBy: z.ZodString;
38
39
  label: z.ZodString;
39
- description: z.ZodNullable<z.ZodString>;
40
40
  }, z.core.$strip>;
41
41
  restoredItems: z.ZodNumber;
42
42
  }, z.core.$strip>;
@@ -23,8 +23,8 @@ export type Snapshot = z.infer<typeof SnapshotSchema>;
23
23
  export declare const SnapshotMetaSchema: z.ZodObject<{
24
24
  id: z.ZodString;
25
25
  createdAt: z.ZodString;
26
+ description: z.ZodNullable<z.ZodString>;
26
27
  createdBy: z.ZodString;
27
28
  label: z.ZodString;
28
- description: z.ZodNullable<z.ZodString>;
29
29
  }, z.core.$strip>;
30
30
  export type SnapshotMeta = z.infer<typeof SnapshotMetaSchema>;
@@ -77,6 +77,11 @@ export declare const TemplateListQuerySchema: z.ZodObject<{
77
77
  cursor: z.ZodOptional<z.ZodString>;
78
78
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
79
79
  documentTypeId: z.ZodOptional<z.ZodString>;
80
+ kind: z.ZodOptional<z.ZodEnum<{
81
+ page: "page";
82
+ layout: "layout";
83
+ partial: "partial";
84
+ }>>;
80
85
  }, z.core.$strip>;
81
86
  export type TemplateListQuery = z.infer<typeof TemplateListQuerySchema>;
82
87
  export declare const TemplateListItemSchema: z.ZodObject<{
@@ -136,6 +141,11 @@ export declare const TemplateSyncReportSchema: z.ZodObject<{
136
141
  file: z.ZodString;
137
142
  reason: z.ZodString;
138
143
  }, z.core.$strip>>;
144
+ ignored: z.ZodOptional<z.ZodArray<z.ZodObject<{
145
+ entry: z.ZodString;
146
+ reason: z.ZodString;
147
+ }, z.core.$strip>>>;
148
+ ignoredMore: z.ZodOptional<z.ZodNumber>;
139
149
  }, z.core.$strip>;
140
150
  export type TemplateSyncReport = z.infer<typeof TemplateSyncReportSchema>;
141
151
  export declare const TemplateVersionParamsSchema: z.ZodObject<{
@@ -1,19 +1,24 @@
1
1
  import { z } from "zod";
2
2
  import { TrashCursorSchema } from "./trash-cursor.schema.js";
3
3
  import { TemplateAliasSchema, TemplateDefinitionSchema, TemplateKindSchema, TemplateVersionMetaSchema, TemplateVersionSchema, TrashedTemplateSchema, } from "./template.schema.js";
4
- // One template source file is capped at 1MB — kin of the render budget:
5
- // a template is code a human edits, not a data blob.
4
+ // S314c3 (D8): the default of a site's template limit, in UTF-8 bytes. The server holds every
5
+ // write to KARDALUM_MAX_TEMPLATE_BYTES (this number unless raised); the plugin build holds a
6
+ // package to this number (D10). The request schemas carry no maximum of their own, so the
7
+ // configured limit is enforced in one place.
6
8
  export const MAX_TEMPLATE_CONTENT_BYTES = 1_048_576;
7
9
  // alias is optional: when omitted the server derives it from `name`
8
- // (slugify + uniqueness suffix) so the pre-existing admin-UI call shape
9
- // {name, documentTypeId} keeps working unchanged.
10
+ // (slugify + uniqueness suffix among templates of the same kind) so the
11
+ // pre-existing admin-UI call shape {name, documentTypeId} keeps working
12
+ // unchanged. S314o2 (D3): the file is written into the kind's folder, and an
13
+ // alias that starts with pages/, layouts/ or partials/ is answered 400: the
14
+ // kind decides the folder.
10
15
  export const CreateTemplateRequestSchema = z
11
16
  .object({
12
17
  name: z.string().min(1),
13
18
  alias: TemplateAliasSchema.optional(),
14
19
  kind: TemplateKindSchema.default("page"),
15
20
  documentTypeId: z.string().uuid().nullable().optional(),
16
- content: z.string().max(MAX_TEMPLATE_CONTENT_BYTES).default(""),
21
+ content: z.string().default(""),
17
22
  })
18
23
  .strict();
19
24
  // baseVersion is optional-conflict-detection only (S195): it never enters
@@ -22,7 +27,7 @@ export const CreateTemplateRequestSchema = z
22
27
  export const UpdateTemplateRequestSchema = z
23
28
  .object({
24
29
  name: z.string().min(1).optional(),
25
- content: z.string().max(MAX_TEMPLATE_CONTENT_BYTES).optional(),
30
+ content: z.string().optional(),
26
31
  baseVersion: z.number().int().min(1).optional(),
27
32
  })
28
33
  .strict()
@@ -52,11 +57,13 @@ export const TemplateResponseSchema = z.object({
52
57
  export const CreateTemplateResponseSchema = TemplateResponseSchema;
53
58
  // Per api-design.md, list endpoints are always cursor-paginated. The
54
59
  // optional documentTypeId filter is what the builder's template picker
55
- // uses to list "templates for this document type."
60
+ // uses to list "templates for this document type"; the optional kind
61
+ // (S314o2 D6) lists one of the three folders.
56
62
  export const TemplateListQuerySchema = z.object({
57
63
  cursor: z.string().uuid().optional(),
58
64
  limit: z.coerce.number().int().min(1).max(100).default(50),
59
65
  documentTypeId: z.string().uuid().optional(),
66
+ kind: TemplateKindSchema.optional(),
60
67
  });
61
68
  // S314g (P6): a list row names the plugin that ships the template (from the
62
69
  // plugin tracking table, read by the route), or null for the operator's own.
@@ -73,16 +80,24 @@ export const SetDefaultTemplateRequestSchema = z.object({
73
80
  });
74
81
  // POST /api/manage/v1/templates/sync: the "Sync files" action's report.
75
82
  // S314j (D3, D4, D7): `adopted` lists the .liquid files no template owned that
76
- // became templates (the file as found, the alias it took, the kind its top
77
- // folder gave it); `skipped` lists every file the walk did not adopt, with
78
- // why (an alias taken, a name that cannot be an alias, over 1 MiB, too deep,
79
- // an .html file, the folder's entry cap).
83
+ // became templates (the file as found, the alias it took, the kind its folder
84
+ // gave it); `skipped` lists every file in the three kind folders the walk did
85
+ // not adopt, with why (an alias taken, a name that cannot be an alias, over
86
+ // 1 MiB, too deep, an .html file, the folder's entry cap). S314o2 (D1, P2):
87
+ // `ignored` names every top-level entry outside pages/, layouts/ and
88
+ // partials/ once (a file by its name, a folder with a trailing "/"), with a
89
+ // reason that follows the name in a sentence; the server always answers it.
80
90
  export const TemplateSyncReportSchema = z.object({
81
91
  checked: z.number().int().min(0),
82
92
  updated: z.array(z.object({ id: z.string().uuid(), alias: z.string(), version: z.number().int() })),
83
93
  healed: z.array(z.string()),
84
94
  adopted: z.array(z.object({ id: z.string().uuid(), file: z.string(), alias: z.string(), kind: TemplateKindSchema })),
85
95
  skipped: z.array(z.object({ file: z.string(), reason: z.string() })),
96
+ ignored: z.array(z.object({ entry: z.string(), reason: z.string() })).optional(),
97
+ // S314c5: how many entries outside the three folders the walk did not name one by one. When it
98
+ // is above 0, the last `ignored` entry is the one that says so (for a reader that lists them);
99
+ // the count of real entries is `ignored.length - 1 + ignoredMore`.
100
+ ignoredMore: z.number().int().min(0).optional(),
86
101
  });
87
102
  // S314g (D5, P3): a template's history. The list is metadata, newest first, a
88
103
  // page at a time; its query is content's VersionListQuerySchema (cursor = the
@@ -7,6 +7,13 @@ export declare const TemplateKindSchema: z.ZodEnum<{
7
7
  export type TemplateKind = z.infer<typeof TemplateKindSchema>;
8
8
  export declare const TEMPLATE_ALIAS_MAX_SEGMENTS = 8;
9
9
  export declare const TemplateAliasSchema: z.ZodString;
10
+ export declare const TEMPLATE_KIND_FOLDERS: {
11
+ readonly page: "pages";
12
+ readonly layout: "layouts";
13
+ readonly partial: "partials";
14
+ };
15
+ /** S314o2 (D2): a template's file under the templates folder, "/"-separated. */
16
+ export declare function templateFilePath(kind: TemplateKind, alias: string): string;
10
17
  export declare const TemplateDefinitionSchema: z.ZodObject<{
11
18
  id: z.ZodString;
12
19
  name: z.ZodString;
@@ -1,18 +1,22 @@
1
1
  import { z } from "zod";
2
2
  import { TEMPLATE_KINDS } from "./plugin-vocabulary.js";
3
3
  // A template's persisted identity. Content does NOT live here: the source
4
- // of a template is its file (`templates/<alias>.liquid`) mirrored into
5
- // immutable template_versions rows — see the S192 spec §5. currentVersion
6
- // is a pointer, exactly like content_nodes.current_version.
4
+ // of a template is its file (`templates/<kind folder>/<alias>.liquid`, see
5
+ // templateFilePath below) mirrored into immutable template_versions rows
6
+ // (the S192 spec, section 5). currentVersion is a pointer, exactly like
7
+ // content_nodes.current_version.
7
8
  export const TemplateKindSchema = z.enum(TEMPLATE_KINDS);
8
9
  // The alias is the cross-reference key ({% layout 'x' %} / {% render 'x' %})
9
- // AND the file's path under templates/ (<alias>.liquid). S314j (D6, P3): it
10
- // may name folders, "pages/about": segments of lowercase kebab joined by "/",
11
- // at most TEMPLATE_ALIAS_MAX_SEGMENTS of them, 120 characters in all. No
12
- // dots, no empty segment, no leading or trailing "/", so an alias can never
13
- // traverse paths or collide case-insensitively on Windows filesystems; the
14
- // template service still asserts the joined path stays inside its folder.
15
- // Plugin manifests keep flat aliases (PluginTemplateAliasSchema).
10
+ // AND the file's path inside its kind's folder (S314o2 D2): the layout `cafe`
11
+ // is templates/layouts/cafe.liquid, the page `legal/imprint` is
12
+ // templates/pages/legal/imprint.liquid. Aliases are unique per kind, so a
13
+ // page and a partial may both be `menu-item`. S314j (D6, P3): an alias may
14
+ // name folders: segments of lowercase kebab joined by "/", at most
15
+ // TEMPLATE_ALIAS_MAX_SEGMENTS of them, 120 characters in all. No dots, no
16
+ // empty segment, no leading or trailing "/", so an alias can never traverse
17
+ // paths or collide case-insensitively on Windows filesystems; the template
18
+ // service still asserts the joined path stays inside its folder. Plugin
19
+ // manifests keep flat aliases (PluginTemplateAliasSchema).
16
20
  export const TEMPLATE_ALIAS_MAX_SEGMENTS = 8;
17
21
  const ALIAS_SEGMENT = "[a-z0-9]+(?:-[a-z0-9]+)*";
18
22
  const TEMPLATE_ALIAS_REGEX = new RegExp(`^${ALIAS_SEGMENT}(?:/${ALIAS_SEGMENT}){0,${TEMPLATE_ALIAS_MAX_SEGMENTS - 1}}$`);
@@ -21,6 +25,14 @@ export const TemplateAliasSchema = z
21
25
  .min(1)
22
26
  .max(120)
23
27
  .regex(TEMPLATE_ALIAS_REGEX, "lowercase kebab-case segments joined by /, at most 8");
28
+ // S314o2 (D1): the three folders under templates/ the system reads and writes
29
+ // a template file in, one per kind, by these exact lower-case names. Every
30
+ // other entry under templates/ is ignored by the sync.
31
+ export const TEMPLATE_KIND_FOLDERS = { page: "pages", layout: "layouts", partial: "partials" };
32
+ /** S314o2 (D2): a template's file under the templates folder, "/"-separated. */
33
+ export function templateFilePath(kind, alias) {
34
+ return `${TEMPLATE_KIND_FOLDERS[kind]}/${alias}.liquid`;
35
+ }
24
36
  export const TemplateDefinitionSchema = z
25
37
  .object({
26
38
  id: z.string().uuid(),
@@ -84,6 +84,12 @@ export declare const UserPreferencesSchema: z.ZodObject<{
84
84
  dark: "dark";
85
85
  }>>;
86
86
  themeId: z.ZodNullable<z.ZodString>;
87
+ homeLayout: z.ZodOptional<z.ZodNullable<z.ZodObject<{
88
+ widgets: z.ZodArray<z.ZodObject<{
89
+ id: z.ZodString;
90
+ shown: z.ZodBoolean;
91
+ }, z.core.$strict>>;
92
+ }, z.core.$strict>>>;
87
93
  }, z.core.$strip>;
88
94
  export type UserPreferences = z.infer<typeof UserPreferencesSchema>;
89
95
  export declare const UpdateUserPreferencesSchema: z.ZodObject<{
@@ -97,5 +103,11 @@ export declare const UpdateUserPreferencesSchema: z.ZodObject<{
97
103
  dark: "dark";
98
104
  }>>>;
99
105
  themeId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
106
+ homeLayout: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodObject<{
107
+ widgets: z.ZodArray<z.ZodObject<{
108
+ id: z.ZodString;
109
+ shown: z.ZodBoolean;
110
+ }, z.core.$strict>>;
111
+ }, z.core.$strict>>>>;
100
112
  }, z.core.$strip>;
101
113
  export type UpdateUserPreferences = z.infer<typeof UpdateUserPreferencesSchema>;
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { HomeLayoutSchema } from "./home.schema.js";
2
3
  import { RoleIdSchema } from "./role.schema.js";
3
4
  // S272: `role` is the id of a row in `roles`, validated as a slug here and
4
5
  // for existence on the server. Before S272 it was a two-value enum.
@@ -69,6 +70,10 @@ export const UserPreferencesSchema = z.object({
69
70
  // A built-in id or an installed theme plugin's reverse-domain id. Not
70
71
  // enumerated: the set is open, since a theme plugin can add one.
71
72
  themeId: z.string().min(1).max(200).nullable(),
73
+ // S314n (D8): the person's Home layout, null when none is saved. Optional,
74
+ // so an answer or a cached copy without it still parses. In a PATCH, null
75
+ // resets to the default.
76
+ homeLayout: HomeLayoutSchema.nullable().optional(),
72
77
  });
73
78
  // Every field optional: a PATCH that sets only the language must not
74
79
  // clear the theme. An explicit null is different from an absent key and
@@ -0,0 +1,2 @@
1
+ import { z } from "zod";
2
+ export declare const UuidStringSchema: z.ZodString;
@@ -0,0 +1,4 @@
1
+ import { z } from "zod";
2
+ // S314p: an id a person or a template writes by hand (a page id given to `url_for`, a media id in
3
+ // rich text HTML), told apart from any other string before it reaches a database lookup.
4
+ export const UuidStringSchema = z.string().uuid();