@kardalum/plugin-sdk 0.17.0 → 0.19.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 (247) hide show
  1. package/CHANGELOG.md +109 -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-serializers.js +1 -1
  10. package/dist/built-in-settings-schemas.d.ts +2 -0
  11. package/dist/built-in-settings-schemas.js +31 -4
  12. package/dist/built-in-value-schemas.js +3 -0
  13. package/dist/built-ins.js +20 -11
  14. package/dist/capabilities.js +5 -0
  15. package/dist/data-type-plugin.d.ts +2 -2
  16. package/dist/datatype-validation.d.ts +2 -2
  17. package/dist/datatype-validation.js +20 -6
  18. package/dist/datatypes-entry.d.ts +1 -0
  19. package/dist/datatypes-entry.js +1 -0
  20. package/dist/define-plugin.d.ts +4 -4
  21. package/dist/define-plugin.js +5 -5
  22. package/dist/entitlement-entry.d.ts +3 -2
  23. package/dist/entitlement-entry.js +13 -1
  24. package/dist/entitlement-gate.d.ts +18 -0
  25. package/dist/entitlement-gate.js +95 -21
  26. package/dist/entitlement-plan.d.ts +21 -0
  27. package/dist/entitlement-plan.js +26 -0
  28. package/dist/entitlement-types.d.ts +21 -4
  29. package/dist/entitlement.d.ts +29 -1
  30. package/dist/entitlement.js +39 -0
  31. package/dist/grid-arrow-step.d.ts +7 -0
  32. package/dist/grid-arrow-step.js +20 -0
  33. package/dist/index.d.ts +8 -1
  34. package/dist/index.js +11 -12
  35. package/dist/manifest-entry.d.ts +4 -0
  36. package/dist/manifest-entry.js +4 -0
  37. package/dist/manifest-schema.d.ts +5 -1
  38. package/dist/manifest-schema.js +14 -2
  39. package/dist/manifest.d.ts +21 -1
  40. package/dist/media/media-picker.js +34 -34
  41. package/dist/notify.d.ts +17 -0
  42. package/dist/notify.js +17 -0
  43. package/dist/plugin-context.js +3 -3
  44. package/dist/register-built-ins.js +6 -6
  45. package/dist/registry.js +1 -1
  46. package/dist/richtext/block-panel.js +19 -20
  47. package/dist/richtext/extensions.js +17 -8
  48. package/dist/richtext/insert-menu.js +4 -4
  49. package/dist/richtext/kardalum-block.js +17 -17
  50. package/dist/richtext/style-listbox.js +2 -2
  51. package/dist/richtext/text-style-class.js +1 -1
  52. package/dist/richtext-html-entry.d.ts +35 -0
  53. package/dist/richtext-html-entry.js +73 -0
  54. package/dist/simple-storage-value-provider.js +3 -3
  55. package/dist/structured-storage-types.d.ts +12 -1
  56. package/dist/structured-storage-types.js +2 -2
  57. package/dist/tailwind.js +10 -3
  58. package/dist/tokens/tailwind-theme.css +176 -0
  59. package/dist/tokens/tokens.css +1 -0
  60. package/dist/tokens/tokens.json +2 -1
  61. package/dist/ui-entry.js +3 -3
  62. package/dist/vendor-check.d.ts +39 -0
  63. package/dist/vendor-check.js +79 -0
  64. package/dist/vendor-entry.d.ts +3 -0
  65. package/dist/vendor-entry.js +9 -0
  66. package/dist/vendor-service.d.ts +20 -0
  67. package/dist/vendor-service.js +20 -0
  68. package/dist/views/asset-view.d.ts +6 -0
  69. package/dist/views/asset-view.js +55 -0
  70. package/dist/views/content-list-settings-view.js +1 -1
  71. package/dist/views/content-list-view.js +1 -1
  72. package/dist/views/date-range-view.js +5 -5
  73. package/dist/views/html-code-editor.js +2 -3
  74. package/dist/views/html-view.js +7 -7
  75. package/dist/views/image-view.js +5 -5
  76. package/dist/views/rich-text-view.js +33 -32
  77. package/node_modules/@kardalum/api-schemas/README.md +1 -1
  78. package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +1 -1
  79. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +17 -15
  80. package/node_modules/@kardalum/api-schemas/dist/asset-field.schema.d.ts +21 -0
  81. package/node_modules/@kardalum/api-schemas/dist/asset-field.schema.js +42 -0
  82. package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +1 -0
  83. package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +10 -3
  84. package/node_modules/@kardalum/api-schemas/dist/auth.schema.js +1 -1
  85. package/node_modules/@kardalum/api-schemas/dist/checkout-shown.schema.d.ts +36 -0
  86. package/node_modules/@kardalum/api-schemas/dist/checkout-shown.schema.js +46 -0
  87. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +13 -0
  88. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +30 -9
  89. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +3 -3
  90. package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +1 -1
  91. package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +12 -6
  92. package/node_modules/@kardalum/api-schemas/dist/core-actions.js +11 -6
  93. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +50 -0
  94. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +26 -6
  95. package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.d.ts +1 -0
  96. package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +6 -3
  97. package/node_modules/@kardalum/api-schemas/dist/data-type-cursor.d.ts +11 -0
  98. package/node_modules/@kardalum/api-schemas/dist/data-type-cursor.js +28 -0
  99. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +90 -0
  100. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +56 -6
  101. package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +8 -8
  102. package/node_modules/@kardalum/api-schemas/dist/home.schema.d.ts +130 -0
  103. package/node_modules/@kardalum/api-schemas/dist/home.schema.js +87 -0
  104. package/node_modules/@kardalum/api-schemas/dist/index.d.ts +48 -19
  105. package/node_modules/@kardalum/api-schemas/dist/index.js +34 -12
  106. package/node_modules/@kardalum/api-schemas/dist/kardalum-latest.schema.d.ts +7 -0
  107. package/node_modules/@kardalum/api-schemas/dist/kardalum-latest.schema.js +9 -0
  108. package/node_modules/@kardalum/api-schemas/dist/listing-categories.schema.d.ts +46 -0
  109. package/node_modules/@kardalum/api-schemas/dist/listing-categories.schema.js +52 -0
  110. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +162 -1
  111. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +144 -9
  112. package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.d.ts +17 -0
  113. package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.js +16 -0
  114. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +26 -0
  115. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +15 -9
  116. package/node_modules/@kardalum/api-schemas/dist/media-reference-use.d.ts +10 -0
  117. package/node_modules/@kardalum/api-schemas/dist/media-reference-use.js +4 -4
  118. package/node_modules/@kardalum/api-schemas/dist/media.schema.js +5 -5
  119. package/node_modules/@kardalum/api-schemas/dist/news.schema.d.ts +93 -0
  120. package/node_modules/@kardalum/api-schemas/dist/news.schema.js +86 -0
  121. package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +13 -0
  122. package/node_modules/@kardalum/api-schemas/dist/notification.schema.d.ts +410 -0
  123. package/node_modules/@kardalum/api-schemas/dist/notification.schema.js +193 -0
  124. package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.d.ts +86 -0
  125. package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.js +92 -0
  126. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +7 -2
  127. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +7 -0
  128. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-text.js +1 -0
  129. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +251 -0
  130. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +196 -31
  131. package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.d.ts +19 -0
  132. package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.js +33 -0
  133. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +1 -1
  134. package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.js +3 -3
  135. package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.d.ts +10 -1
  136. package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.js +24 -4
  137. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +5 -0
  138. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +23 -20
  139. package/node_modules/@kardalum/api-schemas/dist/render-editing.js +4 -4
  140. package/node_modules/@kardalum/api-schemas/dist/render-settings-api.schema.js +1 -1
  141. package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.d.ts +83 -0
  142. package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.js +73 -0
  143. package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.d.ts +207 -0
  144. package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.js +147 -0
  145. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +11 -0
  146. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +17 -8
  147. package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +14 -0
  148. package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +7 -0
  149. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +3 -3
  150. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +1 -1
  151. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.js +1 -1
  152. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +10 -0
  153. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +27 -12
  154. package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +7 -0
  155. package/node_modules/@kardalum/api-schemas/dist/template.schema.js +22 -10
  156. package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.d.ts +1 -1
  157. package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.js +1 -1
  158. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +12 -0
  159. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +6 -1
  160. package/node_modules/@kardalum/api-schemas/dist/uuid.schema.d.ts +2 -0
  161. package/node_modules/@kardalum/api-schemas/dist/uuid.schema.js +4 -0
  162. package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.d.ts +88 -0
  163. package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.js +100 -0
  164. package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.d.ts +13 -0
  165. package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.js +5 -0
  166. package/node_modules/@kardalum/design-tokens/README.md +1 -1
  167. package/node_modules/@kardalum/design-tokens/dist/build-css.d.ts +1 -1
  168. package/node_modules/@kardalum/design-tokens/dist/build-css.js +2 -2
  169. package/node_modules/@kardalum/design-tokens/dist/build-theme-css.d.ts +16 -0
  170. package/node_modules/@kardalum/design-tokens/dist/build-theme-css.js +76 -0
  171. package/node_modules/@kardalum/design-tokens/dist/generate.js +4 -1
  172. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +176 -0
  173. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +1 -1
  174. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +3 -3
  175. package/node_modules/@kardalum/design-tokens/dist/theme-css.d.ts +2 -2
  176. package/node_modules/@kardalum/design-tokens/dist/theme-css.js +2 -2
  177. package/node_modules/@kardalum/design-tokens/dist/theme-types.d.ts +2 -2
  178. package/node_modules/@kardalum/design-tokens/dist/themes/dark.d.ts +3 -3
  179. package/node_modules/@kardalum/design-tokens/dist/themes/dark.js +3 -3
  180. package/node_modules/@kardalum/design-tokens/dist/themes/light.d.ts +1 -1
  181. package/node_modules/@kardalum/design-tokens/dist/themes/light.js +1 -1
  182. package/node_modules/@kardalum/design-tokens/dist/tokens.css +1 -0
  183. package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +3 -3
  184. package/node_modules/@kardalum/design-tokens/dist/tokens.js +6 -5
  185. package/node_modules/@kardalum/design-tokens/dist/tokens.json +2 -1
  186. package/node_modules/@kardalum/design-tokens/dist/types.d.ts +2 -1
  187. package/node_modules/@kardalum/design-tokens/dist/types.js +1 -1
  188. package/node_modules/@kardalum/design-tokens/package.json +6 -3
  189. package/node_modules/@kardalum/plugin-package/README.md +1 -1
  190. package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +4 -4
  191. package/node_modules/@kardalum/plugin-package/dist/capabilities.js +54 -6
  192. package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.js +1 -1
  193. package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.d.ts +3 -0
  194. package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +18 -1
  195. package/node_modules/@kardalum/plugin-package/dist/delivery/limits.d.ts +1 -1
  196. package/node_modules/@kardalum/plugin-package/dist/delivery/limits.js +1 -1
  197. package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +9 -4
  198. package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +1 -0
  199. package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +58 -1
  200. package/node_modules/@kardalum/plugin-package/dist/envelope.d.ts +2 -2
  201. package/node_modules/@kardalum/plugin-package/dist/envelope.js +2 -2
  202. package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +3 -3
  203. package/node_modules/@kardalum/plugin-package/dist/extract.js +10 -10
  204. package/node_modules/@kardalum/plugin-package/dist/hash.d.ts +1 -1
  205. package/node_modules/@kardalum/plugin-package/dist/hash.js +1 -1
  206. package/node_modules/@kardalum/plugin-package/dist/index.d.ts +4 -2
  207. package/node_modules/@kardalum/plugin-package/dist/index.js +3 -1
  208. package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +56 -19
  209. package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +119 -25
  210. package/node_modules/@kardalum/plugin-package/dist/package-contract.d.ts +2 -2
  211. package/node_modules/@kardalum/plugin-package/dist/package-contract.js +5 -5
  212. package/node_modules/@kardalum/plugin-package/dist/types.d.ts +1 -1
  213. package/node_modules/@kardalum/plugin-package/dist/vendor-token.d.ts +24 -0
  214. package/node_modules/@kardalum/plugin-package/dist/vendor-token.js +118 -0
  215. package/node_modules/@kardalum/ui/README.md +1 -1
  216. package/node_modules/@kardalum/ui/dist/components/alert-dialog.d.ts +1 -1
  217. package/node_modules/@kardalum/ui/dist/components/alert-dialog.js +8 -3
  218. package/node_modules/@kardalum/ui/dist/components/badge.js +1 -1
  219. package/node_modules/@kardalum/ui/dist/components/button.js +2 -2
  220. package/node_modules/@kardalum/ui/dist/components/checkbox.js +1 -1
  221. package/node_modules/@kardalum/ui/dist/components/dialog.d.ts +1 -1
  222. package/node_modules/@kardalum/ui/dist/components/dialog.js +52 -4
  223. package/node_modules/@kardalum/ui/dist/components/dropdown-menu.d.ts +5 -1
  224. package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +20 -7
  225. package/node_modules/@kardalum/ui/dist/components/empty-state.d.ts +4 -4
  226. package/node_modules/@kardalum/ui/dist/components/input.js +6 -1
  227. package/node_modules/@kardalum/ui/dist/components/popover-panel.d.ts +4 -0
  228. package/node_modules/@kardalum/ui/dist/components/popover-panel.js +13 -0
  229. package/node_modules/@kardalum/ui/dist/components/property-field.js +3 -3
  230. package/node_modules/@kardalum/ui/dist/components/sheet.d.ts +1 -1
  231. package/node_modules/@kardalum/ui/dist/components/sheet.js +15 -9
  232. package/node_modules/@kardalum/ui/dist/components/skeleton.js +1 -1
  233. package/node_modules/@kardalum/ui/dist/components/switch.js +1 -1
  234. package/node_modules/@kardalum/ui/dist/components/tab-strip.d.ts +3 -3
  235. package/node_modules/@kardalum/ui/dist/components/tab-strip.js +1 -1
  236. package/node_modules/@kardalum/ui/dist/components/toast.js +4 -3
  237. package/node_modules/@kardalum/ui/dist/components/tooltip.d.ts +27 -0
  238. package/node_modules/@kardalum/ui/dist/components/tooltip.js +82 -0
  239. package/node_modules/@kardalum/ui/dist/components/truncated-text.d.ts +11 -0
  240. package/node_modules/@kardalum/ui/dist/components/truncated-text.js +94 -0
  241. package/node_modules/@kardalum/ui/dist/components/use-toast.js +2 -2
  242. package/node_modules/@kardalum/ui/dist/index.d.ts +4 -1
  243. package/node_modules/@kardalum/ui/dist/index.js +4 -1
  244. package/node_modules/@kardalum/ui/dist/lib/menu-host.d.ts +5 -0
  245. package/node_modules/@kardalum/ui/dist/lib/menu-host.js +17 -0
  246. package/node_modules/@kardalum/ui/package.json +8 -6
  247. package/package.json +21 -7
@@ -0,0 +1,147 @@
1
+ import { z } from "zod";
2
+ import { strictUrl } from "./strict-url.js";
3
+ // S358 (S236 spec): the operational settings an administrator may change without a
4
+ // restart. The list is closed on purpose (S236 spec section 8: never a general env
5
+ // editor); a key outside it is refused by the strict request schema.
6
+ /** The most a stored media ceiling may be (S358 P6). Uploads are held in memory. */
7
+ export const MEDIA_MAX_SIZE_CEILING_BYTES = 1_073_741_824;
8
+ // S358b spec D2: the most a stored text asset or template limit may be. A text asset is held in
9
+ // memory and in one database row on every dialect; a template is parsed on every render.
10
+ export const MAX_ASSET_BYTES_CEILING = 33_554_432;
11
+ export const MAX_TEMPLATE_BYTES_CEILING = 8_388_608;
12
+ /** The longest licence grace period, in days: a paid plugin's own check refuses a verdict older
13
+ * than this, so a longer period could never hold (S284b). */
14
+ export const LICENSE_GRACE_DAYS_MAX = 14;
15
+ // S359 (S359 spec D1, D8): the rate limits an administrator may change without a restart.
16
+ // Login, setup and the session lane are not here on purpose (D2, D4).
17
+ export const RATE_LIMIT_SETTING_KEYS = [
18
+ "rateLimitKeyMax",
19
+ "rateLimitIpMax",
20
+ "rateLimitWindowSeconds",
21
+ "rateLimitDocsMax",
22
+ "rateLimitDocsWindowSeconds",
23
+ "rateLimitMediaMax",
24
+ "rateLimitMediaWindowSeconds",
25
+ "rateLimitRenderMax",
26
+ "rateLimitRenderWindowSeconds",
27
+ "rateLimitAdminMax",
28
+ "rateLimitAdminWindowSeconds",
29
+ ];
30
+ export function isRateLimitSettingKey(key) {
31
+ return RATE_LIMIT_SETTING_KEYS.includes(key);
32
+ }
33
+ export const RATE_LIMIT_MAX_CEILING = 1_000_000;
34
+ export const RATE_LIMIT_WINDOW_CEILING_SECONDS = 3600;
35
+ /** S359 spec D8: the administrator's own path runs through these two lanes. */
36
+ export const RATE_LIMIT_FLOORS_PER_MINUTE = { ip: 30, admin: 120 };
37
+ /** The smallest maximum that keeps `floorPerMinute` over a window of `windowSeconds`. It floors
38
+ * the burst as well as the rate (S359 fix wave): a window under a minute still allows the
39
+ * per-minute floor in one window, because a cold admin load is many requests in under a second. */
40
+ export function rateLimitFloorMax(floorPerMinute, windowSeconds) {
41
+ return Math.max(floorPerMinute, Math.ceil((floorPerMinute * windowSeconds) / 60));
42
+ }
43
+ const RateLimitMaxSchema = z.number().int().min(1).max(RATE_LIMIT_MAX_CEILING);
44
+ const RateLimitWindowSchema = z.number().int().min(1).max(RATE_LIMIT_WINDOW_CEILING_SECONDS);
45
+ export const LIVE_SERVER_SETTING_KEYS = [
46
+ "previewTokenTtl",
47
+ "previewBaseUrl",
48
+ "publicUrl",
49
+ "mediaMaxSize",
50
+ "licenseCheckIntervalHours",
51
+ "licenseStaleWarnDays",
52
+ "maxAssetBytes",
53
+ "maxTemplateBytes",
54
+ "licenseGraceDays",
55
+ ...RATE_LIMIT_SETTING_KEYS,
56
+ ];
57
+ export const LiveServerSettingKeySchema = z.enum(LIVE_SERVER_SETTING_KEYS);
58
+ export const ServerSettingSourceSchema = z.enum(["stored", "environment", "default"]);
59
+ const NO_SPACE = /\s/;
60
+ const BASE_URL_MESSAGE = "Enter an http or https address with no user name, password, spaces, query or fragment.";
61
+ /** No credentials, no whitespace, and no query or fragment (a bare `?` or `#` included),
62
+ * which the public host reader refuses too. strictUrl has already refused control
63
+ * characters and anything but http or https; the URL global is declared in whatwg-url.d.ts. */
64
+ function isPlainBaseUrl(value) {
65
+ if (NO_SPACE.test(value) || value.includes("?") || value.includes("#"))
66
+ return false;
67
+ try {
68
+ const url = new URL(value);
69
+ return url.username === "" && url.password === "";
70
+ }
71
+ catch {
72
+ return false;
73
+ }
74
+ }
75
+ const BaseUrlSchema = strictUrl({ protocol: /^https?$/, max: 2048, error: BASE_URL_MESSAGE }).refine(isPlainBaseUrl, {
76
+ message: BASE_URL_MESSAGE,
77
+ });
78
+ export const LiveServerSettingValueSchemas = {
79
+ previewTokenTtl: z.number().int().min(60).max(2_592_000),
80
+ previewBaseUrl: BaseUrlSchema,
81
+ publicUrl: BaseUrlSchema,
82
+ mediaMaxSize: z.number().int().min(1).max(MEDIA_MAX_SIZE_CEILING_BYTES),
83
+ licenseCheckIntervalHours: z.number().int().min(1).max(504),
84
+ licenseStaleWarnDays: z.number().int().min(1).max(365),
85
+ maxAssetBytes: z.number().int().min(1).max(MAX_ASSET_BYTES_CEILING),
86
+ maxTemplateBytes: z.number().int().min(1).max(MAX_TEMPLATE_BYTES_CEILING),
87
+ licenseGraceDays: z.number().int().min(1).max(LICENSE_GRACE_DAYS_MAX),
88
+ rateLimitKeyMax: RateLimitMaxSchema,
89
+ rateLimitIpMax: RateLimitMaxSchema,
90
+ rateLimitWindowSeconds: RateLimitWindowSchema,
91
+ rateLimitDocsMax: RateLimitMaxSchema,
92
+ rateLimitDocsWindowSeconds: RateLimitWindowSchema,
93
+ rateLimitMediaMax: RateLimitMaxSchema,
94
+ rateLimitMediaWindowSeconds: RateLimitWindowSchema,
95
+ rateLimitRenderMax: RateLimitMaxSchema,
96
+ rateLimitRenderWindowSeconds: RateLimitWindowSchema,
97
+ rateLimitAdminMax: RateLimitMaxSchema,
98
+ rateLimitAdminWindowSeconds: RateLimitWindowSchema,
99
+ };
100
+ /** A key left out is unchanged; null clears the stored value (back to the environment). */
101
+ export const UpdateServerSettingsRequestSchema = z
102
+ .object({
103
+ previewTokenTtl: LiveServerSettingValueSchemas.previewTokenTtl.nullable().optional(),
104
+ previewBaseUrl: LiveServerSettingValueSchemas.previewBaseUrl.nullable().optional(),
105
+ publicUrl: LiveServerSettingValueSchemas.publicUrl.nullable().optional(),
106
+ mediaMaxSize: LiveServerSettingValueSchemas.mediaMaxSize.nullable().optional(),
107
+ licenseCheckIntervalHours: LiveServerSettingValueSchemas.licenseCheckIntervalHours.nullable().optional(),
108
+ licenseStaleWarnDays: LiveServerSettingValueSchemas.licenseStaleWarnDays.nullable().optional(),
109
+ maxAssetBytes: LiveServerSettingValueSchemas.maxAssetBytes.nullable().optional(),
110
+ maxTemplateBytes: LiveServerSettingValueSchemas.maxTemplateBytes.nullable().optional(),
111
+ licenseGraceDays: LiveServerSettingValueSchemas.licenseGraceDays.nullable().optional(),
112
+ rateLimitKeyMax: LiveServerSettingValueSchemas.rateLimitKeyMax.nullable().optional(),
113
+ rateLimitIpMax: LiveServerSettingValueSchemas.rateLimitIpMax.nullable().optional(),
114
+ rateLimitWindowSeconds: LiveServerSettingValueSchemas.rateLimitWindowSeconds.nullable().optional(),
115
+ rateLimitDocsMax: LiveServerSettingValueSchemas.rateLimitDocsMax.nullable().optional(),
116
+ rateLimitDocsWindowSeconds: LiveServerSettingValueSchemas.rateLimitDocsWindowSeconds.nullable().optional(),
117
+ rateLimitMediaMax: LiveServerSettingValueSchemas.rateLimitMediaMax.nullable().optional(),
118
+ rateLimitMediaWindowSeconds: LiveServerSettingValueSchemas.rateLimitMediaWindowSeconds.nullable().optional(),
119
+ rateLimitRenderMax: LiveServerSettingValueSchemas.rateLimitRenderMax.nullable().optional(),
120
+ rateLimitRenderWindowSeconds: LiveServerSettingValueSchemas.rateLimitRenderWindowSeconds.nullable().optional(),
121
+ rateLimitAdminMax: LiveServerSettingValueSchemas.rateLimitAdminMax.nullable().optional(),
122
+ rateLimitAdminWindowSeconds: LiveServerSettingValueSchemas.rateLimitAdminWindowSeconds.nullable().optional(),
123
+ })
124
+ .strict()
125
+ .refine((change) => Object.keys(change).length > 0, { message: "Name at least one setting to change." });
126
+ const SettingValueSchema = z.union([z.number(), z.string(), z.null()]);
127
+ export const LiveServerSettingRowSchema = z.object({
128
+ key: LiveServerSettingKeySchema,
129
+ envName: z.string(),
130
+ value: SettingValueSchema,
131
+ source: ServerSettingSourceSchema,
132
+ /** The variable as the environment holds it, or null when it is unset. */
133
+ environment: z.string().nullable(),
134
+ defaultValue: SettingValueSchema,
135
+ /** For a stored value, the line that would set the same value in `.env` (S358 P1). */
136
+ envLine: z.string().nullable(),
137
+ });
138
+ export const RestartOnlySettingRowSchema = z.object({
139
+ envName: z.string(),
140
+ environment: z.string().nullable(),
141
+ /** "registration": read when the server starts (S236b). "boundary": kept out of the admin on purpose. */
142
+ reason: z.enum(["registration", "boundary"]),
143
+ });
144
+ export const ServerSettingsResponseSchema = z.object({
145
+ live: z.array(LiveServerSettingRowSchema),
146
+ restartOnly: z.array(RestartOnlySettingRowSchema),
147
+ });
@@ -10,6 +10,12 @@ export declare const BundledTemplateSchema: z.ZodObject<{
10
10
  }, z.core.$catchall<z.ZodString>>, unknown>>;
11
11
  }, z.core.$strip>;
12
12
  export type BundledTemplate = z.infer<typeof BundledTemplateSchema>;
13
+ export declare const SetupHandoffFailedStageSchema: z.ZodEnum<{
14
+ build: "build";
15
+ close: "close";
16
+ listen: "listen";
17
+ }>;
18
+ export type SetupHandoffFailedStage = z.infer<typeof SetupHandoffFailedStageSchema>;
13
19
  export declare const SetupStatusResponseSchema: z.ZodObject<{
14
20
  setupRequired: z.ZodBoolean;
15
21
  bundledTemplates: z.ZodArray<z.ZodObject<{
@@ -23,6 +29,11 @@ export declare const SetupStatusResponseSchema: z.ZodObject<{
23
29
  }, z.core.$catchall<z.ZodString>>, unknown>>;
24
30
  }, z.core.$strip>>;
25
31
  databaseConfigured: z.ZodBoolean;
32
+ handoffFailed: z.ZodOptional<z.ZodEnum<{
33
+ build: "build";
34
+ close: "close";
35
+ listen: "listen";
36
+ }>>;
26
37
  }, z.core.$strip>;
27
38
  export type SetupStatusResponse = z.infer<typeof SetupStatusResponseSchema>;
28
39
  export declare const SetupStarterSelectionSchema: z.ZodObject<{
@@ -3,7 +3,7 @@ import { InstallAnswersSchema, InstallDescriptionSchema } from "./plugin-install
3
3
  import { InstallRoleOutcomeSchema } from "./plugin-install-record.schema.js";
4
4
  import { SampleContentOutcomeSchema } from "./sample-content-outcome.schema.js";
5
5
  // One bundled first-party starter template (currently only the blog
6
- // template — apps/server/src/setup/bundled-templates.ts) offered from the
6
+ // template, apps/server/src/setup/bundled-templates.ts) offered from the
7
7
  // setup wizard's optional "starter template" step. `pluginId` matches the
8
8
  // template plugin's manifest id (e.g. "com.kardalum.blog"): the same id the
9
9
  // marketplace install flow uses elsewhere, so a template picked here and a
@@ -20,9 +20,15 @@ export const BundledTemplateSchema = z.object({
20
20
  // checkbox.
21
21
  sampleContentDescription: InstallDescriptionSchema.optional(),
22
22
  });
23
+ // S357c (D5): where a failed no-restart handover stopped (the server's
24
+ // boot/hand-off-to-full-app.ts). A kind only: the error's own text stays in
25
+ // the server log and never reaches a response. "build": the full app could
26
+ // not be built and the wizard is still served; "close": the setup app did
27
+ // not close cleanly; "listen": the full app could not take the port.
28
+ export const SetupHandoffFailedStageSchema = z.enum(["build", "close", "listen"]);
23
29
  export const SetupStatusResponseSchema = z.object({
24
30
  setupRequired: z.boolean(),
25
- // Always present — [] outside setup mode (a fully-configured instance has
31
+ // Always present: [] outside setup mode (a fully-configured instance has
26
32
  // nothing left to offer here) and whenever nothing bundled is resolvable,
27
33
  // never omitted or null.
28
34
  bundledTemplates: z.array(BundledTemplateSchema),
@@ -31,6 +37,9 @@ export const SetupStatusResponseSchema = z.object({
31
37
  // See the BootMode type and resolveBootMode function in
32
38
  // apps/server/src/boot/resolve-boot-mode.ts for the three states.
33
39
  databaseConfigured: z.boolean(),
40
+ // S357c (D5): present only after setup completed and the handover to the
41
+ // full app failed, so the wizard can say why it asks for a restart.
42
+ handoffFailed: SetupHandoffFailedStageSchema.optional(),
34
43
  });
35
44
  const SqliteSelectionSchema = z.object({
36
45
  dialect: z.literal("sqlite"),
@@ -64,8 +73,8 @@ export const SetupCompleteRequestSchema = z.object({
64
73
  // Optional because the wizard has two shapes. On a fresh instance it
65
74
  // collects a database selection; when DATABASE_URL was already injected
66
75
  // the database is configured and read-only, and the request carries the
67
- // admin only. The ROUTE enforces the pairing in both directions —
68
- // routes/setup.ts — because "optional" alone would let a caller silently
76
+ // admin only. The ROUTE enforces the pairing in both directions (
77
+ // routes/setup.ts) because "optional" alone would let a caller silently
69
78
  // send a selection that is ignored.
70
79
  database: z
71
80
  .discriminatedUnion("dialect", [
@@ -77,7 +86,7 @@ export const SetupCompleteRequestSchema = z.object({
77
86
  starter: SetupStarterSelectionSchema.optional(),
78
87
  });
79
88
  // What happened to the requested starter. "failed" never fails setup
80
- // itself — the admin account and database config always stand — so this
89
+ // itself (the admin account and database config always stand), so this
81
90
  // rides alongside success: true rather than replacing it. `reason` is only
82
91
  // present on failure.
83
92
  export const SetupStarterResultSchema = z.object({
@@ -94,12 +103,12 @@ export const SetupStarterResultSchema = z.object({
94
103
  });
95
104
  export const SetupCompleteResponseSchema = z.object({
96
105
  success: z.literal(true),
97
- // ABSENT (not null) when no starter was requested — the skip-path
106
+ // ABSENT (not null) when no starter was requested: the skip-path
98
107
  // response stays byte-identical to the pre-starter shape.
99
108
  starter: SetupStarterResultSchema.optional(),
100
109
  // ABSENT unless setup completed but could not write its configuration
101
- // to disk. Setup itself still succeeded — the admin account and the
102
- // provisioned database stand — so this rides alongside success: true
110
+ // to disk. Setup itself still succeeded (the admin account and the
111
+ // provisioned database stand), so this rides alongside success: true
103
112
  // rather than replacing it, exactly as `starter` does.
104
113
  configWarning: z.string().min(1).optional(),
105
114
  });
@@ -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>;
@@ -14,6 +14,6 @@ export const SnapshotSchema = z.object({
14
14
  createdBy: z.string().uuid(),
15
15
  items: z.array(SnapshotItemSchema),
16
16
  });
17
- // Timeline listings — items excluded on purpose: a snapshot's items array
17
+ // Timeline listings leave items out on purpose: a snapshot's items array
18
18
  // scales with tree size and the timeline only needs the row facts.
19
19
  export const SnapshotMetaSchema = SnapshotSchema.omit({ items: true });
@@ -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,28 +1,33 @@
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
20
- // the name/content refine below — a request with only a baseVersion still
25
+ // the name/content refine below: a request with only a baseVersion still
21
26
  // fails that check, same as before this field existed.
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(),
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- /** GET /api/themes — installed, enabled theme plugins' token overrides.
2
+ /** GET /api/themes: installed, enabled theme plugins' token overrides.
3
3
  * tokens is the manifest's contributions.themeTokens passed through
4
4
  * verbatim; its inner shape is validated at install time by the SDK's
5
5
  * themeTokensSchema, so here it is an opaque record (color/radius). */
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- /** GET /api/themes — installed, enabled theme plugins' token overrides.
2
+ /** GET /api/themes: installed, enabled theme plugins' token overrides.
3
3
  * tokens is the manifest's contributions.themeTokens passed through
4
4
  * verbatim; its inner shape is validated at install time by the SDK's
5
5
  * themeTokensSchema, so here it is an opaque record (color/radius). */
@@ -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,8 +1,9 @@
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.
5
- // What user management reads — never the passwordHash.
6
+ // What user management reads, never the passwordHash.
6
7
  export const UserSummarySchema = z.object({
7
8
  id: z.string().uuid(),
8
9
  email: z.string().email(),
@@ -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();