@kardalum/plugin-sdk 0.16.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 (274) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/README.md +4 -3
  3. package/dist/admin-section-registry.d.ts +14 -5
  4. package/dist/admin-section-registry.js +14 -4
  5. package/dist/assets/asset-picker.d.ts +11 -0
  6. package/dist/assets/asset-picker.js +109 -0
  7. package/dist/assets/asset-tree.d.ts +30 -0
  8. package/dist/assets/asset-tree.js +150 -0
  9. package/dist/built-in-editor-ids.d.ts +1 -0
  10. package/dist/built-in-editor-ids.js +20 -0
  11. package/dist/built-in-settings-schemas.d.ts +2 -0
  12. package/dist/built-in-settings-schemas.js +27 -0
  13. package/dist/built-in-value-schemas.js +3 -0
  14. package/dist/built-ins.js +10 -1
  15. package/dist/capabilities.js +5 -3
  16. package/dist/datatype-validation.js +18 -4
  17. package/dist/datatypes-entry.d.ts +1 -0
  18. package/dist/datatypes-entry.js +1 -0
  19. package/dist/entitlement-entry.d.ts +3 -2
  20. package/dist/entitlement-entry.js +13 -1
  21. package/dist/entitlement-gate.d.ts +18 -0
  22. package/dist/entitlement-gate.js +95 -21
  23. package/dist/entitlement-plan.d.ts +21 -0
  24. package/dist/entitlement-plan.js +26 -0
  25. package/dist/entitlement-types.d.ts +21 -4
  26. package/dist/entitlement.d.ts +29 -1
  27. package/dist/entitlement.js +39 -0
  28. package/dist/grid-arrow-step.d.ts +7 -0
  29. package/dist/grid-arrow-step.js +20 -0
  30. package/dist/host-entry.d.ts +1 -1
  31. package/dist/host-entry.js +1 -1
  32. package/dist/index.d.ts +8 -3
  33. package/dist/index.js +13 -18
  34. package/dist/license-verdict-keys.d.ts +4 -3
  35. package/dist/license-verdict-keys.js +4 -7
  36. package/dist/manifest-entry.d.ts +6 -2
  37. package/dist/manifest-entry.js +5 -1
  38. package/dist/manifest-schema.d.ts +56 -63
  39. package/dist/manifest-schema.js +103 -249
  40. package/dist/manifest.d.ts +61 -73
  41. package/dist/manifest.js +13 -36
  42. package/dist/media/media-picker.js +32 -32
  43. package/dist/notify.d.ts +17 -0
  44. package/dist/notify.js +17 -0
  45. package/dist/plugin-screen-context.d.ts +11 -1
  46. package/dist/richtext/block-panel.js +19 -20
  47. package/dist/richtext/extensions.js +10 -1
  48. package/dist/richtext/insert-menu.js +1 -1
  49. package/dist/richtext/kardalum-block.js +17 -17
  50. package/dist/richtext/style-listbox.js +4 -4
  51. package/dist/richtext-html-entry.d.ts +35 -0
  52. package/dist/richtext-html-entry.js +73 -0
  53. package/dist/structured-storage-types.d.ts +11 -0
  54. package/dist/tailwind.js +10 -3
  55. package/dist/tokens/tailwind-theme.css +176 -0
  56. package/dist/tokens/tokens.css +2 -0
  57. package/dist/tokens/tokens.json +4 -2
  58. package/dist/type-equality.d.ts +2 -0
  59. package/dist/type-equality.js +1 -0
  60. package/dist/vendor-check.d.ts +39 -0
  61. package/dist/vendor-check.js +79 -0
  62. package/dist/vendor-entry.d.ts +3 -0
  63. package/dist/vendor-entry.js +9 -0
  64. package/dist/vendor-service.d.ts +20 -0
  65. package/dist/vendor-service.js +20 -0
  66. package/dist/views/asset-view.d.ts +6 -0
  67. package/dist/views/asset-view.js +55 -0
  68. package/dist/views/content-list-settings-view.js +1 -1
  69. package/dist/views/content-list-view.js +1 -1
  70. package/dist/views/html-code-editor.js +0 -1
  71. package/dist/views/html-view.js +1 -1
  72. package/dist/views/image-view.js +1 -1
  73. package/dist/views/rich-text-view.js +30 -30
  74. package/node_modules/@kardalum/api-schemas/README.md +1 -1
  75. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.d.ts +90 -0
  76. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +43 -10
  77. package/node_modules/@kardalum/api-schemas/dist/asset-field.schema.d.ts +21 -0
  78. package/node_modules/@kardalum/api-schemas/dist/asset-field.schema.js +42 -0
  79. package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +23 -1
  80. package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +60 -18
  81. package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +204 -0
  82. package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +134 -0
  83. package/node_modules/@kardalum/api-schemas/dist/checkout-shown.schema.d.ts +36 -0
  84. package/node_modules/@kardalum/api-schemas/dist/checkout-shown.schema.js +46 -0
  85. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +12 -0
  86. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +22 -6
  87. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +2 -2
  88. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.d.ts +4 -0
  89. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +3 -0
  90. package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +2 -1
  91. package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +52 -10
  92. package/node_modules/@kardalum/api-schemas/dist/core-actions.js +33 -14
  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 +25 -5
  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 +3 -0
  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.js +42 -2
  100. package/node_modules/@kardalum/api-schemas/dist/home.schema.d.ts +130 -0
  101. package/node_modules/@kardalum/api-schemas/dist/home.schema.js +87 -0
  102. package/node_modules/@kardalum/api-schemas/dist/index.d.ts +73 -31
  103. package/node_modules/@kardalum/api-schemas/dist/index.js +47 -17
  104. package/node_modules/@kardalum/api-schemas/dist/install-warnings.schema.d.ts +4 -0
  105. package/node_modules/@kardalum/api-schemas/dist/install-warnings.schema.js +8 -0
  106. package/node_modules/@kardalum/api-schemas/dist/issue-list.d.ts +6 -0
  107. package/node_modules/@kardalum/api-schemas/dist/issue-list.js +6 -0
  108. package/node_modules/@kardalum/api-schemas/dist/kardalum-latest.schema.d.ts +7 -0
  109. package/node_modules/@kardalum/api-schemas/dist/kardalum-latest.schema.js +9 -0
  110. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +216 -63
  111. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +117 -5
  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 +6 -0
  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/news.schema.d.ts +93 -0
  119. package/node_modules/@kardalum/api-schemas/dist/news.schema.js +86 -0
  120. package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +13 -0
  121. package/node_modules/@kardalum/api-schemas/dist/notification.schema.d.ts +410 -0
  122. package/node_modules/@kardalum/api-schemas/dist/notification.schema.js +193 -0
  123. package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.d.ts +86 -0
  124. package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.js +92 -0
  125. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +6 -2
  126. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +8 -6
  127. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +8 -18
  128. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +7 -0
  129. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +3 -19
  130. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +13 -15
  131. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +17 -7
  132. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +18 -8
  133. package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +1 -1
  134. package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +97 -85
  135. package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +35 -68
  136. package/node_modules/@kardalum/api-schemas/dist/plugin-labels.d.ts +60 -0
  137. package/node_modules/@kardalum/api-schemas/dist/plugin-labels.js +116 -0
  138. package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +9 -2
  139. package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +22 -7
  140. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +240 -6
  141. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +164 -32
  142. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +4 -3
  143. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +1 -1
  144. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +14 -0
  145. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +37 -1
  146. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-fields.d.ts +64 -0
  147. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-fields.js +134 -0
  148. package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.d.ts +19 -0
  149. package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.js +33 -0
  150. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.d.ts +2 -0
  151. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +4 -0
  152. package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.d.ts +83 -0
  153. package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.js +152 -0
  154. package/node_modules/@kardalum/api-schemas/dist/plugin-vocabulary.d.ts +13 -0
  155. package/node_modules/@kardalum/api-schemas/dist/plugin-vocabulary.js +15 -0
  156. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +5 -0
  157. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +35 -23
  158. package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.d.ts +83 -0
  159. package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.js +73 -0
  160. package/node_modules/@kardalum/api-schemas/dist/role.schema.d.ts +11 -0
  161. package/node_modules/@kardalum/api-schemas/dist/role.schema.js +7 -0
  162. package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +11 -2
  163. package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +21 -3
  164. package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +126 -0
  165. package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.js +70 -0
  166. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +6 -6
  167. package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +58 -25
  168. package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +194 -48
  169. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +18 -6
  170. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.js +14 -0
  171. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +2 -2
  172. package/node_modules/@kardalum/api-schemas/dist/strict-url.d.ts +12 -0
  173. package/node_modules/@kardalum/api-schemas/dist/strict-url.js +31 -0
  174. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +115 -1
  175. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +65 -10
  176. package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +37 -2
  177. package/node_modules/@kardalum/api-schemas/dist/template.schema.js +34 -8
  178. package/node_modules/@kardalum/api-schemas/dist/trash-cursor.schema.d.ts +4 -0
  179. package/node_modules/@kardalum/api-schemas/dist/trash-cursor.schema.js +29 -0
  180. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +16 -0
  181. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +8 -0
  182. package/node_modules/@kardalum/api-schemas/dist/uuid.schema.d.ts +2 -0
  183. package/node_modules/@kardalum/api-schemas/dist/uuid.schema.js +4 -0
  184. package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.d.ts +88 -0
  185. package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.js +100 -0
  186. package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.d.ts +32 -0
  187. package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.js +27 -0
  188. package/node_modules/@kardalum/api-schemas/package.json +2 -2
  189. package/node_modules/@kardalum/design-tokens/README.md +1 -1
  190. package/node_modules/@kardalum/design-tokens/dist/build-theme-css.d.ts +16 -0
  191. package/node_modules/@kardalum/design-tokens/dist/build-theme-css.js +76 -0
  192. package/node_modules/@kardalum/design-tokens/dist/generate.js +4 -1
  193. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +176 -0
  194. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +2 -1
  195. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +2 -0
  196. package/node_modules/@kardalum/design-tokens/dist/tokens.css +2 -0
  197. package/node_modules/@kardalum/design-tokens/dist/tokens.js +4 -0
  198. package/node_modules/@kardalum/design-tokens/dist/tokens.json +4 -2
  199. package/node_modules/@kardalum/design-tokens/dist/types.d.ts +2 -0
  200. package/node_modules/@kardalum/design-tokens/package.json +6 -3
  201. package/node_modules/@kardalum/plugin-package/README.md +5 -2
  202. package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +6 -21
  203. package/node_modules/@kardalum/plugin-package/dist/build-reference.js +13 -8
  204. package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +4 -4
  205. package/node_modules/@kardalum/plugin-package/dist/capabilities.js +59 -16
  206. package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +4 -0
  207. package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +25 -0
  208. package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.d.ts +25 -0
  209. package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.js +203 -0
  210. package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.d.ts +3 -0
  211. package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.js +73 -0
  212. package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.d.ts +8 -0
  213. package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +77 -0
  214. package/node_modules/@kardalum/plugin-package/dist/delivery/icon-names.generated.d.ts +1 -0
  215. package/node_modules/@kardalum/plugin-package/dist/delivery/icon-names.generated.js +2052 -0
  216. package/node_modules/@kardalum/plugin-package/dist/delivery/icons.d.ts +2 -0
  217. package/node_modules/@kardalum/plugin-package/dist/delivery/icons.js +51 -0
  218. package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +8 -0
  219. package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +7 -0
  220. package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.d.ts +17 -0
  221. package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +119 -0
  222. package/node_modules/@kardalum/plugin-package/dist/delivery/limits.d.ts +14 -0
  223. package/node_modules/@kardalum/plugin-package/dist/delivery/limits.js +21 -0
  224. package/node_modules/@kardalum/plugin-package/dist/delivery/locales.d.ts +5 -0
  225. package/node_modules/@kardalum/plugin-package/dist/delivery/locales.js +148 -0
  226. package/node_modules/@kardalum/plugin-package/dist/delivery/package-files.d.ts +5 -0
  227. package/node_modules/@kardalum/plugin-package/dist/delivery/package-files.js +76 -0
  228. package/node_modules/@kardalum/plugin-package/dist/delivery/registry.d.ts +22 -0
  229. package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +137 -0
  230. package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.d.ts +3 -0
  231. package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.js +90 -0
  232. package/node_modules/@kardalum/plugin-package/dist/delivery/support.d.ts +24 -0
  233. package/node_modules/@kardalum/plugin-package/dist/delivery/support.js +55 -0
  234. package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +7 -0
  235. package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +215 -0
  236. package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +53 -0
  237. package/node_modules/@kardalum/plugin-package/dist/delivery/types.js +1 -0
  238. package/node_modules/@kardalum/plugin-package/dist/docs-contract.d.ts +3 -2
  239. package/node_modules/@kardalum/plugin-package/dist/docs-contract.js +4 -2
  240. package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +92 -3
  241. package/node_modules/@kardalum/plugin-package/dist/extract.js +251 -41
  242. package/node_modules/@kardalum/plugin-package/dist/index.d.ts +13 -4
  243. package/node_modules/@kardalum/plugin-package/dist/index.js +10 -3
  244. package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +56 -19
  245. package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +119 -25
  246. package/node_modules/@kardalum/plugin-package/dist/manifest-entry.d.ts +5 -0
  247. package/node_modules/@kardalum/plugin-package/dist/manifest-entry.js +20 -0
  248. package/node_modules/@kardalum/plugin-package/dist/reference-entry.d.ts +1 -0
  249. package/node_modules/@kardalum/plugin-package/dist/reference-entry.js +1 -0
  250. package/node_modules/@kardalum/plugin-package/dist/sample-content.d.ts +21 -3
  251. package/node_modules/@kardalum/plugin-package/dist/sample-content.js +37 -9
  252. package/node_modules/@kardalum/plugin-package/dist/shipped-files.d.ts +39 -0
  253. package/node_modules/@kardalum/plugin-package/dist/shipped-files.js +133 -0
  254. package/node_modules/@kardalum/plugin-package/dist/shipped-locales.d.ts +7 -0
  255. package/node_modules/@kardalum/plugin-package/dist/shipped-locales.js +27 -0
  256. package/node_modules/@kardalum/plugin-package/dist/vendor-token.d.ts +24 -0
  257. package/node_modules/@kardalum/plugin-package/dist/vendor-token.js +118 -0
  258. package/node_modules/@kardalum/plugin-package/package.json +4 -2
  259. package/node_modules/@kardalum/ui/README.md +1 -1
  260. package/node_modules/@kardalum/ui/dist/components/button.js +1 -1
  261. package/node_modules/@kardalum/ui/dist/components/checkbox.js +1 -1
  262. package/node_modules/@kardalum/ui/dist/components/dialog.js +5 -2
  263. package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +3 -3
  264. package/node_modules/@kardalum/ui/dist/components/input.js +1 -1
  265. package/node_modules/@kardalum/ui/dist/components/popover-panel.d.ts +4 -0
  266. package/node_modules/@kardalum/ui/dist/components/popover-panel.js +13 -0
  267. package/node_modules/@kardalum/ui/dist/components/sheet.js +5 -4
  268. package/node_modules/@kardalum/ui/dist/components/switch.js +1 -1
  269. package/node_modules/@kardalum/ui/dist/components/tab-strip.js +1 -1
  270. package/node_modules/@kardalum/ui/dist/components/toast.js +1 -1
  271. package/node_modules/@kardalum/ui/dist/index.d.ts +1 -0
  272. package/node_modules/@kardalum/ui/dist/index.js +1 -0
  273. package/node_modules/@kardalum/ui/package.json +1 -1
  274. package/package.json +19 -6
@@ -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({
@@ -56,11 +57,20 @@ export const PublicContentByPathQuerySchema = PublicContentItemQuerySchema.exten
56
57
  // types: a path, on a host. `path` is read as the renderer reads a
57
58
  // request's path, so a language prefix in it selects the language unless
58
59
  // `locale` says otherwise. `host` selects the site and nothing else: it is
59
- // compared with the domains stored on sites and never written into an
60
- // answer. Without it the address is read on the default address.
60
+ // read through `parseSiteDomain` (S314i), so it is a host name or an IPv4
61
+ // address with an optional port, a port selects a site whose domain was
62
+ // stored with that port, and a scheme in front is ignored. It is compared
63
+ // with the domains stored on sites and never written into an answer.
64
+ // Without it the address is read on the default address. Its cap leaves
65
+ // room for a scheme and a port beside the longest host name, as the
66
+ // manage lookup's does.
61
67
  export const PublicContentByAddressQuerySchema = z.object({
62
68
  path: z.string().min(1).max(2048),
63
- host: z.string().max(253).optional(),
69
+ host: z
70
+ .string()
71
+ .max(300)
72
+ .optional()
73
+ .describe("The host the address is on: a host name or an IPv4 address with an optional port, as a browser sends it in its Host header. A port selects a site whose domain was stored with that port; a scheme in front is ignored. Without it the address is read on the default address."),
64
74
  locale: z.string().optional(),
65
75
  });
66
76
  // The page a visitor gets at that address. `redirected` is true when the
@@ -72,7 +82,7 @@ export const PublicContentListQuerySchema = z.object({
72
82
  limit: z.coerce.number().int().min(1).max(100).default(50),
73
83
  });
74
84
  // The tree-walk row: everything a consumer needs to render navigation and
75
- // 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
76
86
  // publishedAt is non-nullable by construction (published-only surface).
77
87
  export const PublicContentNodeSummarySchema = z.object({
78
88
  id: z.string().uuid(),
@@ -111,7 +121,7 @@ export const PublicSitesResponseSchema = z.object({
111
121
  items: z.array(PublicSiteSchema),
112
122
  nextCursor: z.string().nullable(),
113
123
  });
114
- // GET /api/v1/content — combinable filters over the published surface.
124
+ // GET /api/v1/content: combinable filters over the published surface.
115
125
  // `under` is a published node's id; the server resolves it to a subtree
116
126
  // path filter (strict descendants). q is a case-insensitive substring
117
127
  // (ASCII-pinned), min 2 chars so a single char can't trigger full scans.
@@ -165,7 +175,7 @@ export const PublicMediaListResponseSchema = z.object({
165
175
  // Public document type introspection. Deliberately narrower than the
166
176
  // backoffice DocumentTypeDefinitionSchema: tabs (admin-UI organization),
167
177
  // treeRules (an admin content-placement rule), and defaultTemplateId (an
168
- // editor pointer — the separate templates resource covers discovery) are
178
+ // editor pointer; the separate templates resource covers discovery) are
169
179
  // all excluded. Just enough to interpret a fetched ContentVersion.data:
170
180
  // each field's data key (id), display name, datatypeId, and its
171
181
  // client-facing validation rules.
@@ -216,7 +226,7 @@ export const PublicDocumentTypeListResponseSchema = z.object({
216
226
  items: z.array(PublicDocumentTypeSchema),
217
227
  nextCursor: z.string().uuid().nullable(),
218
228
  });
219
- // Templates are inert data (headless-first decision) — the public shape
229
+ // Templates are inert data (headless-first decision): the public shape
220
230
  // is the same three fields the backoffice already exposes, defined fresh
221
231
  // as its own contract rather than re-exporting TemplateDefinitionSchema.
222
232
  export const PublicTemplateSchema = z.object({
@@ -234,10 +244,12 @@ export const PublicTemplateListResponseSchema = z.object({
234
244
  nextCursor: z.string().uuid().nullable(),
235
245
  });
236
246
  // Public content write shapes (Month 9, Session 107). The write surface is
237
- // 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
238
248
  // any publish state, so `publishedAt` here is nullable (a fresh draft),
239
249
  // unlike the read PublicContentItemSchema's non-null publishedAt.
240
250
  export const PublicContentWriteResponseSchema = z.object({
251
+ // S318: fields kept because their plugin is read-only.
252
+ readOnlyFields: z.array(ReadOnlyFieldSchema).optional(),
241
253
  id: z.string().uuid(),
242
254
  documentTypeId: z.string().uuid(),
243
255
  parentId: z.string().uuid().nullable(),
@@ -256,18 +268,18 @@ export const PublicCreateContentRequestSchema = z.object({
256
268
  slug: z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),
257
269
  data: z.record(z.string(), z.unknown()).default({}),
258
270
  });
259
- // 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,
260
272
  // not the body shape, decides the merge semantics. See the route
261
273
  // descriptions.
262
274
  export const PublicUpdateContentRequestSchema = z.object({
263
275
  data: z.record(z.string(), z.unknown()),
264
276
  });
265
- // 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
266
278
  // node's whole descendant subtree in one call, the API equivalent of the
267
- // 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
268
280
  // z.coerce.boolean(), which is plain JS truthiness (Boolean("false") ===
269
281
  // true, so "?cascade=false" would silently perform the cascade it looks
270
- // 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
271
283
  // true and "false"/"0"/"no"/"off"/"n"/"disabled" to false, and rejects
272
284
  // anything else (including a bare "?cascade" with no value, which arrives
273
285
  // as "") with a clean 400 instead of guessing. Omitting the param
@@ -276,7 +288,7 @@ export const PublicContentDeleteQuerySchema = z.object({
276
288
  cascade: z.stringbool().optional().default(false),
277
289
  });
278
290
  // DELETE /api/v1/content/:id response. Deletion is soft (trash, not
279
- // destroy — content immutability applies to the whole subtree, not just
291
+ // destroy: content immutability applies to the whole subtree, not just
280
292
  // this node), so there is nothing to hand back but a confirmation; same
281
293
  // shape as PublicMediaDeleteResponseSchema below, kept as its own type
282
294
  // since the two write surfaces evolve independently.
@@ -284,8 +296,8 @@ export const PublicContentDeleteResponseSchema = z.object({ ok: z.literal(true)
284
296
  // 409 when the node has descendants and the caller didn't pass
285
297
  // ?cascade=true. Carries the same information the admin trash route's
286
298
  // unconfirmed 409 does (ContentTrashConfirmationSchema: blast radius +
287
- // remedy) reshaped for a single API round trip instead of a UI dialog —
288
- // 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
289
301
  // confirmation click to follow up with, so there's no separate
290
302
  // requiresConfirmation/nodeName pair to carry.
291
303
  export const PublicContentDeleteConfirmationSchema = z.object({
@@ -293,7 +305,7 @@ export const PublicContentDeleteConfirmationSchema = z.object({
293
305
  message: z.string(),
294
306
  });
295
307
  // Public media write shapes (Month 9 media write routes). The upload is a
296
- // multipart request — the binary streams separately at the route; this
308
+ // multipart request: the binary streams separately at the route; this
297
309
  // schema covers only the accompanying form fields. No folderId: folders
298
310
  // are an admin-only surface (S186e), never exposed on the public write
299
311
  // API. `.strict()` so a caller that sends folderId here gets a clear 400
@@ -313,7 +325,7 @@ export const PublicMediaUploadBodySchema = PublicMediaUploadFieldsSchema.extend(
313
325
  .file()
314
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."),
315
327
  });
316
- // PATCH /api/v1/media/:id body. v1 patches visibility only — metadata
328
+ // PATCH /api/v1/media/:id body. v1 patches visibility only: metadata
317
329
  // (filename, custom fields) is a later task, so visibility is required
318
330
  // rather than optional: this is the only field there is, and an empty
319
331
  // body has nothing to do. folderId is deliberately absent for the same
@@ -325,7 +337,7 @@ export const PublicMediaUpdateRequestSchema = z
325
337
  })
326
338
  .strict();
327
339
  // Upload (POST) and update (PATCH) both hand back the same public media
328
- // 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.
329
341
  export const PublicMediaWriteResponseSchema = PublicMediaFileSchema;
330
342
  // S234e: the route behind this now trashes rather than destroys (the
331
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();
@@ -94,3 +94,14 @@ export declare const RoleParamsSchema: z.ZodObject<{
94
94
  id: z.ZodString;
95
95
  }, z.core.$strip>;
96
96
  export type RoleParams = z.infer<typeof RoleParamsSchema>;
97
+ export declare const RoleEscalationRefusalSchema: z.ZodObject<{
98
+ message: z.ZodString;
99
+ action: z.ZodString;
100
+ }, z.core.$strip>;
101
+ export type RoleEscalationRefusal = z.infer<typeof RoleEscalationRefusalSchema>;
102
+ export declare const RoleForbiddenSchema: z.ZodUnion<readonly [z.ZodObject<{
103
+ message: z.ZodString;
104
+ action: z.ZodString;
105
+ }, z.core.$strip>, z.ZodObject<{
106
+ message: z.ZodString;
107
+ }, z.core.$strip>]>;
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { ActionStringSchema } from "./action.schema.js";
3
+ import { ApiErrorSchema } from "./api-error.schema.js";
3
4
  // S272, theme G2: roles are rows. This file is the one definition the
4
5
  // server, the admin UI and the setup wizard share for what a role id looks
5
6
  // like and which two roles are seeded, so none of them can drift.
@@ -73,3 +74,9 @@ export const RoleResponseSchema = z.object({ role: RoleSchema });
73
74
  export const DeleteRoleResponseSchema = z.object({ deleted: z.literal(true) });
74
75
  // S301: the params of PATCH and DELETE /roles/:id, moved here from the route file.
75
76
  export const RoleParamsSchema = z.object({ id: RoleIdSchema });
77
+ // S309: a role never holds an action its maker does not hold. The 403 names the action twice, in the
78
+ // sentence and as a field the admin can mark a row by. The refusal is listed first so a body with
79
+ // `action` is the one serialised (a plain error object would strip it), the order ApiKeyCreateForbiddenSchema uses for
80
+ // the key subset rule this mirrors. POST /users and PATCH /users/:id/role answer it too, for a role holding an action the caller lacks.
81
+ export const RoleEscalationRefusalSchema = z.object({ message: z.string(), action: ActionStringSchema });
82
+ export const RoleForbiddenSchema = z.union([RoleEscalationRefusalSchema, ApiErrorSchema]);
@@ -1,12 +1,21 @@
1
1
  import { z } from "zod";
2
2
  /** media[].file: "media/" plus a flat, traversal-free file name. Without it,
3
3
  * a file of "../../.env" would resolve outside the package and be uploaded
4
- * as a public media record. One character class, no nesting. */
4
+ * as a public media record. One character class, no nesting, and a
5
+ * fixed-length lookahead that refuses the names "." and ".." (S311 fix wave),
6
+ * which the class admits and which name media/ itself and the package root. */
5
7
  export declare const SAMPLE_CONTENT_MEDIA_FILE_PATTERN: RegExp;
8
+ /** The most nodes, and media entries, a sample-content.json may declare (S311).
9
+ * parseSampleContentFile refuses a count past either before the schema reads a
10
+ * single entry, so a small file of empty nodes cannot cost one issue per field
11
+ * per node; the schema holds the same limits for any other caller. Generous for
12
+ * a sample: the first-party samples hold a handful of each. */
13
+ export declare const SAMPLE_CONTENT_MAX_NODES = 1000;
14
+ export declare const SAMPLE_CONTENT_MAX_MEDIA = 200;
6
15
  export declare const SampleContentFileSchema: z.ZodObject<{
7
16
  description: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
8
17
  en: z.ZodString;
9
- }, z.core.$catchall<z.ZodString>>>>;
18
+ }, z.core.$catchall<z.ZodString>>, unknown>>;
10
19
  nodes: z.ZodArray<z.ZodObject<{
11
20
  documentType: z.ZodString;
12
21
  slug: z.ZodString;
@@ -10,11 +10,22 @@ import { InstallDescriptionSchema } from "./plugin-install.js";
10
10
  // interface shows with the "add the sample content" question.
11
11
  /** media[].file: "media/" plus a flat, traversal-free file name. Without it,
12
12
  * a file of "../../.env" would resolve outside the package and be uploaded
13
- * as a public media record. One character class, no nesting. */
14
- export const SAMPLE_CONTENT_MEDIA_FILE_PATTERN = /^media\/[A-Za-z0-9._-]+$/;
13
+ * as a public media record. One character class, no nesting, and a
14
+ * fixed-length lookahead that refuses the names "." and ".." (S311 fix wave),
15
+ * which the class admits and which name media/ itself and the package root. */
16
+ export const SAMPLE_CONTENT_MEDIA_FILE_PATTERN = /^media\/(?!\.\.?$)[A-Za-z0-9._-]+$/;
15
17
  /** media[].key: exactly what the seeder's {{media:key}} tokens can match. */
16
18
  const SAMPLE_CONTENT_MEDIA_KEY_PATTERN = /^[A-Za-z0-9_-]+$/;
19
+ /** The most nodes, and media entries, a sample-content.json may declare (S311).
20
+ * parseSampleContentFile refuses a count past either before the schema reads a
21
+ * single entry, so a small file of empty nodes cannot cost one issue per field
22
+ * per node; the schema holds the same limits for any other caller. Generous for
23
+ * a sample: the first-party samples hold a handful of each. */
24
+ export const SAMPLE_CONTENT_MAX_NODES = 1000;
25
+ export const SAMPLE_CONTENT_MAX_MEDIA = 200;
17
26
  const NON_EMPTY = "must be a non-empty string";
27
+ const NODES_RULE = `must hold at most ${SAMPLE_CONTENT_MAX_NODES} nodes`;
28
+ const MEDIA_RULE = `must hold at most ${SAMPLE_CONTENT_MAX_MEDIA} entries`;
18
29
  const ROOT_RULE = "sample-content.json must be a JSON object";
19
30
  const MEDIA_KEY_RULE = 'must be letters, digits, "_" or "-"';
20
31
  const MEDIA_FILE_RULE = 'must be "media/" followed by a file name of letters, digits, ".", "_" or "-"';
@@ -39,7 +50,7 @@ const SampleContentNodeSchema = z
39
50
  export const SampleContentFileSchema = z
40
51
  .object({
41
52
  description: InstallDescriptionSchema.optional(),
42
- nodes: z.array(SampleContentNodeSchema, { error: "must be an array" }),
53
+ nodes: z.array(SampleContentNodeSchema, { error: "must be an array" }).max(SAMPLE_CONTENT_MAX_NODES, { message: NODES_RULE }),
43
54
  // S199: files inside the package that the install uploads into the
44
55
  // media library, referenced from node data as {{media:key}} (the id)
45
56
  // or {{media:key:url}} (the url). Not strict, as the seeder's never
@@ -50,6 +61,7 @@ export const SampleContentFileSchema = z
50
61
  file: z.string({ error: MEDIA_FILE_RULE }).regex(SAMPLE_CONTENT_MEDIA_FILE_PATTERN, { message: MEDIA_FILE_RULE }),
51
62
  mimeType: z.string({ error: NON_EMPTY }).min(1, { message: NON_EMPTY }),
52
63
  }, { error: mustBeAnObject }), { error: "must be an array" })
64
+ .max(SAMPLE_CONTENT_MAX_MEDIA, { message: MEDIA_RULE })
53
65
  .optional(),
54
66
  })
55
67
  .strict();
@@ -72,6 +84,12 @@ function pathText(path) {
72
84
  export function parseSampleContentFile(raw) {
73
85
  if (typeof raw !== "object" || raw === null || Array.isArray(raw))
74
86
  return { ok: false, errors: [ROOT_RULE] };
87
+ // The counts first, in the schema's own words: past a limit, nothing else is read.
88
+ const { nodes, media } = raw;
89
+ if (Array.isArray(nodes) && nodes.length > SAMPLE_CONTENT_MAX_NODES)
90
+ return { ok: false, errors: [`nodes: ${NODES_RULE}`] };
91
+ if (Array.isArray(media) && media.length > SAMPLE_CONTENT_MAX_MEDIA)
92
+ return { ok: false, errors: [`media: ${MEDIA_RULE}`] };
75
93
  const result = SampleContentFileSchema.safeParse(raw);
76
94
  if (result.success)
77
95
  return { ok: true, file: result.data };
@@ -0,0 +1,126 @@
1
+ import { z } from "zod";
2
+ export declare const SANDBOX_ATTACH_OUTCOMES: readonly ["installed", "activated", "already-active", "updated", "ready"];
3
+ export declare const SandboxAttachRequestSchema: z.ZodObject<{
4
+ pluginDir: z.ZodString;
5
+ bundleDir: z.ZodString;
6
+ remoteUrl: z.ZodPipe<z.ZodString, z.ZodURL>;
7
+ answersPath: z.ZodOptional<z.ZodString>;
8
+ }, z.core.$strict>;
9
+ export declare const SandboxAttachResponseSchema: z.ZodObject<{
10
+ pluginId: z.ZodString;
11
+ version: z.ZodString;
12
+ outcome: z.ZodEnum<{
13
+ updated: "updated";
14
+ installed: "installed";
15
+ activated: "activated";
16
+ "already-active": "already-active";
17
+ ready: "ready";
18
+ }>;
19
+ packagePath: z.ZodString;
20
+ }, z.core.$strip>;
21
+ export type SandboxAttachRequest = z.infer<typeof SandboxAttachRequestSchema>;
22
+ export type SandboxAttachResponse = z.infer<typeof SandboxAttachResponseSchema>;
23
+ export declare const SandboxLocalPluginSchema: z.ZodObject<{
24
+ pluginId: z.ZodString;
25
+ name: z.ZodString;
26
+ version: z.ZodString;
27
+ attachId: z.ZodNumber;
28
+ installed: z.ZodBoolean;
29
+ installInterface: z.ZodObject<{
30
+ consent: z.ZodArray<z.ZodObject<{
31
+ id: z.ZodString;
32
+ details: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
33
+ en: z.ZodString;
34
+ }, z.core.$catchall<z.ZodString>>, unknown>]>>;
35
+ }, z.core.$strict>>;
36
+ sampleContent: z.ZodNullable<z.ZodObject<{
37
+ default: z.ZodLiteral<true>;
38
+ description: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
39
+ en: z.ZodString;
40
+ }, z.core.$catchall<z.ZodString>>, unknown>>;
41
+ }, z.core.$strict>>;
42
+ roles: z.ZodArray<z.ZodObject<{
43
+ id: z.ZodString;
44
+ label: z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
45
+ en: z.ZodString;
46
+ }, z.core.$catchall<z.ZodString>>, unknown>]>;
47
+ actions: z.ZodArray<z.ZodString>;
48
+ default: z.ZodLiteral<false>;
49
+ }, z.core.$strict>>;
50
+ steps: z.ZodArray<z.ZodObject<{
51
+ id: z.ZodString;
52
+ label: z.ZodPreprocess<z.ZodObject<{
53
+ en: z.ZodString;
54
+ }, z.core.$catchall<z.ZodString>>, unknown>;
55
+ description: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
56
+ en: z.ZodString;
57
+ }, z.core.$catchall<z.ZodString>>, unknown>>;
58
+ options: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
59
+ kind: z.ZodLiteral<"boolean">;
60
+ default: z.ZodBoolean;
61
+ id: z.ZodString;
62
+ label: z.ZodPreprocess<z.ZodObject<{
63
+ en: z.ZodString;
64
+ }, z.core.$catchall<z.ZodString>>, unknown>;
65
+ description: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
66
+ en: z.ZodString;
67
+ }, z.core.$catchall<z.ZodString>>, unknown>>;
68
+ }, z.core.$strict>, z.ZodObject<{
69
+ kind: z.ZodLiteral<"select">;
70
+ choices: z.ZodArray<z.ZodObject<{
71
+ id: z.ZodString;
72
+ label: z.ZodPreprocess<z.ZodObject<{
73
+ en: z.ZodString;
74
+ }, z.core.$catchall<z.ZodString>>, unknown>;
75
+ description: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
76
+ en: z.ZodString;
77
+ }, z.core.$catchall<z.ZodString>>, unknown>>;
78
+ }, z.core.$strict>>;
79
+ default: z.ZodOptional<z.ZodString>;
80
+ required: z.ZodOptional<z.ZodBoolean>;
81
+ id: z.ZodString;
82
+ label: z.ZodPreprocess<z.ZodObject<{
83
+ en: z.ZodString;
84
+ }, z.core.$catchall<z.ZodString>>, unknown>;
85
+ description: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
86
+ en: z.ZodString;
87
+ }, z.core.$catchall<z.ZodString>>, unknown>>;
88
+ }, z.core.$strict>, z.ZodObject<{
89
+ kind: z.ZodLiteral<"multiSelect">;
90
+ choices: z.ZodArray<z.ZodObject<{
91
+ id: z.ZodString;
92
+ label: z.ZodPreprocess<z.ZodObject<{
93
+ en: z.ZodString;
94
+ }, z.core.$catchall<z.ZodString>>, unknown>;
95
+ description: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
96
+ en: z.ZodString;
97
+ }, z.core.$catchall<z.ZodString>>, unknown>>;
98
+ }, z.core.$strict>>;
99
+ default: z.ZodArray<z.ZodString>;
100
+ id: z.ZodString;
101
+ label: z.ZodPreprocess<z.ZodObject<{
102
+ en: z.ZodString;
103
+ }, z.core.$catchall<z.ZodString>>, unknown>;
104
+ description: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
105
+ en: z.ZodString;
106
+ }, z.core.$catchall<z.ZodString>>, unknown>>;
107
+ }, z.core.$strict>], "kind">>;
108
+ }, z.core.$strict>>;
109
+ }, z.core.$strict>;
110
+ actions: z.ZodArray<z.ZodObject<{
111
+ id: z.ZodString;
112
+ label: z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
113
+ en: z.ZodString;
114
+ }, z.core.$catchall<z.ZodString>>, unknown>]>;
115
+ }, z.core.$strip>>;
116
+ }, z.core.$strict>;
117
+ export declare const SandboxLocalPluginInstallRequestSchema: z.ZodObject<{
118
+ attachId: z.ZodNumber;
119
+ answers: z.ZodObject<{
120
+ sampleContent: z.ZodOptional<z.ZodBoolean>;
121
+ roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
122
+ options: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodArray<z.ZodString>]>>, unknown>>;
123
+ }, z.core.$strict>;
124
+ }, z.core.$strict>;
125
+ export type SandboxLocalPlugin = z.infer<typeof SandboxLocalPluginSchema>;
126
+ export type SandboxLocalPluginInstallRequest = z.infer<typeof SandboxLocalPluginInstallRequestSchema>;
@@ -0,0 +1,70 @@
1
+ import { z } from "zod";
2
+ import { PluginActionDeclarationSchema } from "./plugin-actions.schema.js";
3
+ import { InstallAnswersSchema, InstallInterfaceSchema } from "./plugin-install.js";
4
+ import { hasNoControlCharacter, strictUrl } from "./strict-url.js";
5
+ // S313: the body and the answer of POST /api/manage/v1/sandbox/local-plugin,
6
+ // the route a server started by `kardalum dev` registers
7
+ // (KARDALUM_SANDBOX_ATTACH, never under NODE_ENV=production). Every path names
8
+ // a directory on the server's own disk: the sandbox and the server it starts
9
+ // share one machine.
10
+ // A control character has no place in a path or a URL the server opens.
11
+ const LocalPath = z.string().min(1).max(4096).refine(hasNoControlCharacter, "A path must not contain control characters");
12
+ // The row stores remoteUrl and the admin loads it as a federation remote, so
13
+ // it is an http or https URL and nothing else. The URL parser drops a tab or a
14
+ // line break silently, and zod's own URL check strips one as well (zod 4.6),
15
+ // so the strict URL helper refuses every control character on the raw string,
16
+ // ahead of the URL check (S314e, spec C6): a URL with a trailing newline or tab
17
+ // was accepted before and is refused now.
18
+ // Fastify prefixes the field ("body/remoteUrl"), so the message does not name it.
19
+ const REMOTE_URL_MESSAGE = "must be an http or https URL";
20
+ const RemoteUrl = strictUrl({ protocol: /^https?$/, error: REMOTE_URL_MESSAGE, max: 2048 });
21
+ // S313b (W1): "ready" is the attach that installed nothing: no registry row for
22
+ // the plugin and no answers file, so the sandbox admin's install screen asks.
23
+ export const SANDBOX_ATTACH_OUTCOMES = ["installed", "activated", "already-active", "updated", "ready"];
24
+ export const SandboxAttachRequestSchema = z
25
+ .object({
26
+ pluginDir: LocalPath.describe("The plugin project's root, as an absolute path. Its install facts, templates, public files and sample content are read from here."),
27
+ bundleDir: LocalPath.describe("An absolute path to a directory holding server/plugin.js and the docs files beside it, as `kardalum plugin bundle-server` writes them. Use a new directory for every bundle: a module already imported from a path is answered from memory."),
28
+ remoteUrl: RemoteUrl.describe("The http or https URL the plugin's federation remote (remoteEntry.js) is served from."),
29
+ answersPath: LocalPath.optional().describe("An absolute path to the project's install-answers.json, read on a fresh install and, at a version bump, for the options the install record does not cover."),
30
+ })
31
+ .strict();
32
+ export const SandboxAttachResponseSchema = z.object({
33
+ pluginId: z.string(),
34
+ version: z.string(),
35
+ outcome: z.enum(SANDBOX_ATTACH_OUTCOMES),
36
+ /** The bundle directory the registry row now names. */
37
+ packagePath: z.string(),
38
+ });
39
+ // S313b (W2): what GET /api/manage/v1/sandbox/local-plugin answers: the bundle
40
+ // the last attach since the server started handed over, the install interface
41
+ // installInterfaceFor computes for it (the one a marketplace listing carries),
42
+ // the actions it declares (so the install screen names the rights an offered
43
+ // role grants by their labels), and whether a registry row exists for it.
44
+ // S313b fix wave C (C1): attachId numbers the attach the description comes
45
+ // from (one more for each attach, and above every number an earlier server
46
+ // process handed out, fix wave E, E1: a restart must not give an install
47
+ // screen opened before it the number of the next process's first attach); the
48
+ // install screen sends it back, and the install route refuses a screen built
49
+ // from an older attach.
50
+ const AttachId = z.number().int().positive();
51
+ export const SandboxLocalPluginSchema = z
52
+ .object({
53
+ pluginId: z.string(),
54
+ name: z.string(),
55
+ version: z.string(),
56
+ attachId: AttachId.describe("Numbers the attach this description comes from: send it back with the install screen's answers."),
57
+ installed: z.boolean(),
58
+ installInterface: InstallInterfaceSchema,
59
+ actions: z.array(PluginActionDeclarationSchema),
60
+ })
61
+ .strict();
62
+ // S313b (W2): the body of POST /api/manage/v1/sandbox/local-plugin/install: the
63
+ // install screen's answers, the same object every install route takes, and
64
+ // (fix wave C, C1) the attach id of the description the screen was built from.
65
+ export const SandboxLocalPluginInstallRequestSchema = z
66
+ .object({
67
+ attachId: AttachId.describe("The attachId of the GET answer the install screen was built from."),
68
+ answers: InstallAnswersSchema,
69
+ })
70
+ .strict();