@kardalum/plugin-sdk 0.0.0-stage → 0.15.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 (312) hide show
  1. package/CHANGELOG.md +108 -0
  2. package/LICENSE +202 -0
  3. package/README.md +70 -2
  4. package/dist/admin-section-registry.d.ts +34 -0
  5. package/dist/admin-section-registry.js +49 -0
  6. package/dist/built-in-serializers.d.ts +3 -0
  7. package/dist/built-in-serializers.js +18 -0
  8. package/dist/built-in-settings-schemas.d.ts +14 -0
  9. package/dist/built-in-settings-schemas.js +225 -0
  10. package/dist/built-in-value-schemas.d.ts +4 -0
  11. package/dist/built-in-value-schemas.js +47 -0
  12. package/dist/built-ins.d.ts +1 -0
  13. package/dist/built-ins.js +257 -0
  14. package/dist/capabilities.d.ts +99 -0
  15. package/dist/capabilities.js +363 -0
  16. package/dist/data-type-plugin.d.ts +28 -0
  17. package/dist/data-type-plugin.js +1 -0
  18. package/dist/datatype-validation.d.ts +26 -0
  19. package/dist/datatype-validation.js +110 -0
  20. package/dist/datatypes-entry.d.ts +4 -0
  21. package/dist/datatypes-entry.js +18 -0
  22. package/dist/define-plugin.d.ts +25 -0
  23. package/dist/define-plugin.js +51 -0
  24. package/dist/entitlement-entry.d.ts +5 -0
  25. package/dist/entitlement-entry.js +24 -0
  26. package/dist/entitlement-gate.d.ts +36 -0
  27. package/dist/entitlement-gate.js +201 -0
  28. package/dist/entitlement-types.d.ts +39 -0
  29. package/dist/entitlement-types.js +1 -0
  30. package/dist/entitlement.d.ts +57 -0
  31. package/dist/entitlement.js +170 -0
  32. package/dist/host-entry.d.ts +1 -0
  33. package/dist/host-entry.js +11 -0
  34. package/dist/icon-name.d.ts +1 -0
  35. package/dist/icon-name.js +1 -0
  36. package/dist/icons.d.ts +2 -0
  37. package/dist/icons.js +10 -0
  38. package/dist/index.d.ts +28 -0
  39. package/dist/index.js +93 -0
  40. package/dist/license-verdict-keys.d.ts +18 -0
  41. package/dist/license-verdict-keys.js +22 -0
  42. package/dist/local-host.d.ts +3 -0
  43. package/dist/local-host.js +38 -0
  44. package/dist/manifest-entry.d.ts +8 -0
  45. package/dist/manifest-entry.js +13 -0
  46. package/dist/manifest-schema.d.ts +408 -0
  47. package/dist/manifest-schema.js +774 -0
  48. package/dist/manifest.d.ts +546 -0
  49. package/dist/manifest.js +86 -0
  50. package/dist/media/media-picker.d.ts +39 -0
  51. package/dist/media/media-picker.js +438 -0
  52. package/dist/media/upload-error.d.ts +12 -0
  53. package/dist/media/upload-error.js +30 -0
  54. package/dist/plugin-context.d.ts +75 -0
  55. package/dist/plugin-context.js +70 -0
  56. package/dist/plugin-screen-context.d.ts +40 -0
  57. package/dist/plugin-screen-context.js +16 -0
  58. package/dist/register-built-ins.d.ts +1 -0
  59. package/dist/register-built-ins.js +41 -0
  60. package/dist/registry.d.ts +4 -0
  61. package/dist/registry.js +17 -0
  62. package/dist/rendition-eligibility.d.ts +24 -0
  63. package/dist/rendition-eligibility.js +40 -0
  64. package/dist/richtext/block-panel.d.ts +27 -0
  65. package/dist/richtext/block-panel.js +232 -0
  66. package/dist/richtext/extensions.d.ts +19 -0
  67. package/dist/richtext/extensions.js +56 -0
  68. package/dist/richtext/insert-menu.d.ts +24 -0
  69. package/dist/richtext/insert-menu.js +142 -0
  70. package/dist/richtext/kardalum-block.d.ts +33 -0
  71. package/dist/richtext/kardalum-block.js +282 -0
  72. package/dist/richtext/style-listbox.d.ts +10 -0
  73. package/dist/richtext/style-listbox.js +69 -0
  74. package/dist/richtext/text-style-class.d.ts +18 -0
  75. package/dist/richtext/text-style-class.js +36 -0
  76. package/dist/simple-storage-value-provider.d.ts +9 -0
  77. package/dist/simple-storage-value-provider.js +96 -0
  78. package/dist/structured-storage-types.d.ts +61 -0
  79. package/dist/structured-storage-types.js +11 -0
  80. package/dist/tailwind.d.ts +1 -0
  81. package/dist/tailwind.js +5 -0
  82. package/dist/tokens/system-dark.css +75 -0
  83. package/dist/tokens/tokens.css +239 -0
  84. package/dist/tokens/tokens.json +212 -0
  85. package/dist/tokens.d.ts +1 -0
  86. package/dist/tokens.js +11 -0
  87. package/dist/ui-entry.d.ts +5 -0
  88. package/dist/ui-entry.js +42 -0
  89. package/dist/views/content-list-preview.d.ts +1 -0
  90. package/dist/views/content-list-preview.js +14 -0
  91. package/dist/views/content-list-settings-view.d.ts +1 -0
  92. package/dist/views/content-list-settings-view.js +97 -0
  93. package/dist/views/content-list-view.d.ts +19 -0
  94. package/dist/views/content-list-view.js +248 -0
  95. package/dist/views/crop-view.d.ts +55 -0
  96. package/dist/views/crop-view.js +161 -0
  97. package/dist/views/date-range-view.d.ts +6 -0
  98. package/dist/views/date-range-view.js +55 -0
  99. package/dist/views/file-upload-view.d.ts +43 -0
  100. package/dist/views/file-upload-view.js +104 -0
  101. package/dist/views/html-code-editor.d.ts +10 -0
  102. package/dist/views/html-code-editor.js +101 -0
  103. package/dist/views/html-view.d.ts +3 -0
  104. package/dist/views/html-view.js +53 -0
  105. package/dist/views/image-view.d.ts +3 -0
  106. package/dist/views/image-view.js +387 -0
  107. package/dist/views/rich-text-view.d.ts +2 -0
  108. package/dist/views/rich-text-view.js +429 -0
  109. package/node_modules/@kardalum/api-schemas/LICENSE +202 -0
  110. package/node_modules/@kardalum/api-schemas/README.md +56 -0
  111. package/node_modules/@kardalum/api-schemas/dist/action.schema.d.ts +30 -0
  112. package/node_modules/@kardalum/api-schemas/dist/action.schema.js +88 -0
  113. package/node_modules/@kardalum/api-schemas/dist/api-error.schema.d.ts +5 -0
  114. package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +6 -0
  115. package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +75 -0
  116. package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +36 -0
  117. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.d.ts +89 -0
  118. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +60 -0
  119. package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +24 -0
  120. package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +47 -0
  121. package/node_modules/@kardalum/api-schemas/dist/auth.schema.d.ts +38 -0
  122. package/node_modules/@kardalum/api-schemas/dist/auth.schema.js +38 -0
  123. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +537 -0
  124. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +353 -0
  125. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +158 -0
  126. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +139 -0
  127. package/node_modules/@kardalum/api-schemas/dist/content-path.d.ts +125 -0
  128. package/node_modules/@kardalum/api-schemas/dist/content-path.js +256 -0
  129. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.d.ts +20 -0
  130. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +23 -0
  131. package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.d.ts +151 -0
  132. package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +82 -0
  133. package/node_modules/@kardalum/api-schemas/dist/content-version.schema.d.ts +18 -0
  134. package/node_modules/@kardalum/api-schemas/dist/content-version.schema.js +22 -0
  135. package/node_modules/@kardalum/api-schemas/dist/content.schema.d.ts +17 -0
  136. package/node_modules/@kardalum/api-schemas/dist/content.schema.js +20 -0
  137. package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +302 -0
  138. package/node_modules/@kardalum/api-schemas/dist/core-actions.js +97 -0
  139. package/node_modules/@kardalum/api-schemas/dist/culture-direction.d.ts +1 -0
  140. package/node_modules/@kardalum/api-schemas/dist/culture-direction.js +9 -0
  141. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +36 -0
  142. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +32 -0
  143. package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.d.ts +9 -0
  144. package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +32 -0
  145. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +296 -0
  146. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +138 -0
  147. package/node_modules/@kardalum/api-schemas/dist/document-type.schema.d.ts +121 -0
  148. package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +147 -0
  149. package/node_modules/@kardalum/api-schemas/dist/health.schema.d.ts +6 -0
  150. package/node_modules/@kardalum/api-schemas/dist/health.schema.js +5 -0
  151. package/node_modules/@kardalum/api-schemas/dist/html-entities.d.ts +4 -0
  152. package/node_modules/@kardalum/api-schemas/dist/html-entities.js +250 -0
  153. package/node_modules/@kardalum/api-schemas/dist/index.d.ts +102 -0
  154. package/node_modules/@kardalum/api-schemas/dist/index.js +58 -0
  155. package/node_modules/@kardalum/api-schemas/dist/licensing.schema.d.ts +15 -0
  156. package/node_modules/@kardalum/api-schemas/dist/licensing.schema.js +14 -0
  157. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +381 -0
  158. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +197 -0
  159. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +167 -0
  160. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +214 -0
  161. package/node_modules/@kardalum/api-schemas/dist/media-reference-api.schema.d.ts +77 -0
  162. package/node_modules/@kardalum/api-schemas/dist/media-reference-api.schema.js +53 -0
  163. package/node_modules/@kardalum/api-schemas/dist/media-reference-use.d.ts +75 -0
  164. package/node_modules/@kardalum/api-schemas/dist/media-reference-use.js +117 -0
  165. package/node_modules/@kardalum/api-schemas/dist/media-reference.d.ts +27 -0
  166. package/node_modules/@kardalum/api-schemas/dist/media-reference.js +279 -0
  167. package/node_modules/@kardalum/api-schemas/dist/media-rendition.schema.d.ts +74 -0
  168. package/node_modules/@kardalum/api-schemas/dist/media-rendition.schema.js +157 -0
  169. package/node_modules/@kardalum/api-schemas/dist/media.schema.d.ts +80 -0
  170. package/node_modules/@kardalum/api-schemas/dist/media.schema.js +156 -0
  171. package/node_modules/@kardalum/api-schemas/dist/nav.schema.d.ts +23 -0
  172. package/node_modules/@kardalum/api-schemas/dist/nav.schema.js +55 -0
  173. package/node_modules/@kardalum/api-schemas/dist/node-access.schema.d.ts +846 -0
  174. package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +356 -0
  175. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +20 -0
  176. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +27 -0
  177. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +169 -0
  178. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +80 -0
  179. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-text.d.ts +65 -0
  180. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-text.js +889 -0
  181. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +89 -0
  182. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +134 -0
  183. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +31 -0
  184. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +38 -0
  185. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +369 -0
  186. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +393 -0
  187. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +22 -0
  188. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +87 -0
  189. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.d.ts +31 -0
  190. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +25 -0
  191. package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.d.ts +15 -0
  192. package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.js +24 -0
  193. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +306 -0
  194. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +328 -0
  195. package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +79 -0
  196. package/node_modules/@kardalum/api-schemas/dist/render-editing.js +50 -0
  197. package/node_modules/@kardalum/api-schemas/dist/render-settings-api.schema.d.ts +9 -0
  198. package/node_modules/@kardalum/api-schemas/dist/render-settings-api.schema.js +13 -0
  199. package/node_modules/@kardalum/api-schemas/dist/reserved-slugs.d.ts +2 -0
  200. package/node_modules/@kardalum/api-schemas/dist/reserved-slugs.js +16 -0
  201. package/node_modules/@kardalum/api-schemas/dist/role.schema.d.ts +90 -0
  202. package/node_modules/@kardalum/api-schemas/dist/role.schema.js +69 -0
  203. package/node_modules/@kardalum/api-schemas/dist/sample-content-outcome.schema.d.ts +17 -0
  204. package/node_modules/@kardalum/api-schemas/dist/sample-content-outcome.schema.js +27 -0
  205. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +108 -0
  206. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +93 -0
  207. package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +243 -0
  208. package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +296 -0
  209. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +43 -0
  210. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.js +25 -0
  211. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +30 -0
  212. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.js +19 -0
  213. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +112 -0
  214. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +74 -0
  215. package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +41 -0
  216. package/node_modules/@kardalum/api-schemas/dist/template.schema.js +39 -0
  217. package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.d.ts +21 -0
  218. package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.js +14 -0
  219. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +89 -0
  220. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +68 -0
  221. package/node_modules/@kardalum/api-schemas/package.json +35 -0
  222. package/node_modules/@kardalum/design-tokens/LICENSE +202 -0
  223. package/node_modules/@kardalum/design-tokens/README.md +29 -0
  224. package/node_modules/@kardalum/design-tokens/dist/build-css.d.ts +32 -0
  225. package/node_modules/@kardalum/design-tokens/dist/build-css.js +88 -0
  226. package/node_modules/@kardalum/design-tokens/dist/generate.d.ts +1 -0
  227. package/node_modules/@kardalum/design-tokens/dist/generate.js +18 -0
  228. package/node_modules/@kardalum/design-tokens/dist/index.d.ts +6 -0
  229. package/node_modules/@kardalum/design-tokens/dist/index.js +4 -0
  230. package/node_modules/@kardalum/design-tokens/dist/system-dark.css +75 -0
  231. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +33 -0
  232. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +54 -0
  233. package/node_modules/@kardalum/design-tokens/dist/theme-css.d.ts +12 -0
  234. package/node_modules/@kardalum/design-tokens/dist/theme-css.js +42 -0
  235. package/node_modules/@kardalum/design-tokens/dist/theme-types.d.ts +43 -0
  236. package/node_modules/@kardalum/design-tokens/dist/theme-types.js +1 -0
  237. package/node_modules/@kardalum/design-tokens/dist/themes/dark.d.ts +13 -0
  238. package/node_modules/@kardalum/design-tokens/dist/themes/dark.js +120 -0
  239. package/node_modules/@kardalum/design-tokens/dist/themes/index.d.ts +5 -0
  240. package/node_modules/@kardalum/design-tokens/dist/themes/index.js +4 -0
  241. package/node_modules/@kardalum/design-tokens/dist/themes/light.d.ts +9 -0
  242. package/node_modules/@kardalum/design-tokens/dist/themes/light.js +13 -0
  243. package/node_modules/@kardalum/design-tokens/dist/tokens.css +239 -0
  244. package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +25 -0
  245. package/node_modules/@kardalum/design-tokens/dist/tokens.js +276 -0
  246. package/node_modules/@kardalum/design-tokens/dist/tokens.json +212 -0
  247. package/node_modules/@kardalum/design-tokens/dist/types.d.ts +91 -0
  248. package/node_modules/@kardalum/design-tokens/dist/types.js +5 -0
  249. package/node_modules/@kardalum/design-tokens/package.json +42 -0
  250. package/node_modules/@kardalum/plugin-package/LICENSE +202 -0
  251. package/node_modules/@kardalum/plugin-package/README.md +71 -0
  252. package/node_modules/@kardalum/plugin-package/dist/docs-contract.d.ts +50 -0
  253. package/node_modules/@kardalum/plugin-package/dist/docs-contract.js +659 -0
  254. package/node_modules/@kardalum/plugin-package/dist/envelope.d.ts +19 -0
  255. package/node_modules/@kardalum/plugin-package/dist/envelope.js +104 -0
  256. package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +37 -0
  257. package/node_modules/@kardalum/plugin-package/dist/extract.js +199 -0
  258. package/node_modules/@kardalum/plugin-package/dist/hash.d.ts +17 -0
  259. package/node_modules/@kardalum/plugin-package/dist/hash.js +69 -0
  260. package/node_modules/@kardalum/plugin-package/dist/index.d.ts +11 -0
  261. package/node_modules/@kardalum/plugin-package/dist/index.js +7 -0
  262. package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +185 -0
  263. package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +236 -0
  264. package/node_modules/@kardalum/plugin-package/dist/package-contract.d.ts +50 -0
  265. package/node_modules/@kardalum/plugin-package/dist/package-contract.js +115 -0
  266. package/node_modules/@kardalum/plugin-package/dist/sample-content.d.ts +1 -0
  267. package/node_modules/@kardalum/plugin-package/dist/sample-content.js +17 -0
  268. package/node_modules/@kardalum/plugin-package/dist/types.d.ts +45 -0
  269. package/node_modules/@kardalum/plugin-package/dist/types.js +1 -0
  270. package/node_modules/@kardalum/plugin-package/package.json +49 -0
  271. package/node_modules/@kardalum/ui/LICENSE +202 -0
  272. package/node_modules/@kardalum/ui/README.md +35 -0
  273. package/node_modules/@kardalum/ui/dist/components/alert-dialog.d.ts +14 -0
  274. package/node_modules/@kardalum/ui/dist/components/alert-dialog.js +38 -0
  275. package/node_modules/@kardalum/ui/dist/components/badge.d.ts +9 -0
  276. package/node_modules/@kardalum/ui/dist/components/badge.js +30 -0
  277. package/node_modules/@kardalum/ui/dist/components/button.d.ts +11 -0
  278. package/node_modules/@kardalum/ui/dist/components/button.js +37 -0
  279. package/node_modules/@kardalum/ui/dist/components/checkbox.d.ts +5 -0
  280. package/node_modules/@kardalum/ui/dist/components/checkbox.js +7 -0
  281. package/node_modules/@kardalum/ui/dist/components/dialog.d.ts +17 -0
  282. package/node_modules/@kardalum/ui/dist/components/dialog.js +48 -0
  283. package/node_modules/@kardalum/ui/dist/components/dropdown-menu.d.ts +18 -0
  284. package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +53 -0
  285. package/node_modules/@kardalum/ui/dist/components/empty-state.d.ts +30 -0
  286. package/node_modules/@kardalum/ui/dist/components/empty-state.js +9 -0
  287. package/node_modules/@kardalum/ui/dist/components/input.d.ts +4 -0
  288. package/node_modules/@kardalum/ui/dist/components/input.js +6 -0
  289. package/node_modules/@kardalum/ui/dist/components/panel.d.ts +5 -0
  290. package/node_modules/@kardalum/ui/dist/components/panel.js +6 -0
  291. package/node_modules/@kardalum/ui/dist/components/property-field.d.ts +19 -0
  292. package/node_modules/@kardalum/ui/dist/components/property-field.js +86 -0
  293. package/node_modules/@kardalum/ui/dist/components/sheet.d.ts +17 -0
  294. package/node_modules/@kardalum/ui/dist/components/sheet.js +55 -0
  295. package/node_modules/@kardalum/ui/dist/components/skeleton.d.ts +3 -0
  296. package/node_modules/@kardalum/ui/dist/components/skeleton.js +9 -0
  297. package/node_modules/@kardalum/ui/dist/components/switch.d.ts +5 -0
  298. package/node_modules/@kardalum/ui/dist/components/switch.js +7 -0
  299. package/node_modules/@kardalum/ui/dist/components/tab-strip.d.ts +34 -0
  300. package/node_modules/@kardalum/ui/dist/components/tab-strip.js +72 -0
  301. package/node_modules/@kardalum/ui/dist/components/toast.d.ts +18 -0
  302. package/node_modules/@kardalum/ui/dist/components/toast.js +42 -0
  303. package/node_modules/@kardalum/ui/dist/components/toaster.d.ts +12 -0
  304. package/node_modules/@kardalum/ui/dist/components/toaster.js +11 -0
  305. package/node_modules/@kardalum/ui/dist/components/use-toast.d.ts +17 -0
  306. package/node_modules/@kardalum/ui/dist/components/use-toast.js +62 -0
  307. package/node_modules/@kardalum/ui/dist/index.d.ts +18 -0
  308. package/node_modules/@kardalum/ui/dist/index.js +18 -0
  309. package/node_modules/@kardalum/ui/dist/lib/cn.d.ts +2 -0
  310. package/node_modules/@kardalum/ui/dist/lib/cn.js +5 -0
  311. package/node_modules/@kardalum/ui/package.json +63 -0
  312. package/package.json +146 -4
@@ -0,0 +1,56 @@
1
+ # @kardalum/api-schemas
2
+
3
+ The [Kardalum CMS](https://kardalum.com) request/response shapes, as Zod
4
+ schemas. This is the single source of truth every other package and the
5
+ server itself derive types, runtime validation, and API documentation
6
+ from: nothing in Kardalum hand-writes a duplicate of a shape defined here.
7
+
8
+ This is an internal package. It is private, never published on its own
9
+ and never installed on its own: it ships inside `@kardalum/server`, `@kardalum/plugin-sdk`, `@kardalum/client` and the `kardalum` CLI, which bundle it.
10
+
11
+ ## Who this is for
12
+
13
+ Most people building a Kardalum site never import this package directly:
14
+ `@kardalum/client` already re-exports the types you need for reading
15
+ and writing content. Reach for `api-schemas` yourself if you're working
16
+ below that layer: writing a plugin that needs a `ContentNode` or
17
+ `DocumentTypeDefinition` type, validating a payload against the exact
18
+ schema the server enforces, or building tooling against the public API
19
+ that wants compile-time shapes instead of `any`.
20
+
21
+ ## What's in it
22
+
23
+ Zod schemas (and their inferred types) for the content tree, document
24
+ types, content versions, templates, media, snapshots, and every request/
25
+ response body the admin API and the public `/api/v1` REST API use, plus
26
+ small shared helpers like `joinContentPath` and `isReservedRootSlug`.
27
+
28
+ ```ts
29
+ import { ContentNodeSchema, type ContentNode } from "@kardalum/api-schemas";
30
+
31
+ // Validate a payload the same way the server does.
32
+ const node: ContentNode = ContentNodeSchema.parse(someJson);
33
+ ```
34
+
35
+ ```ts
36
+ import type { PublicContentItem } from "@kardalum/api-schemas";
37
+
38
+ // Type a fetch() call against the public API without hand-rolling the shape.
39
+ const res = await fetch("https://your-site.com/api/v1/content/abc123");
40
+ const body: PublicContentItem = await res.json();
41
+ ```
42
+
43
+ ## Relationship to the rest of Kardalum
44
+
45
+ `@kardalum/server` validates every route against these schemas via
46
+ `fastify-type-provider-zod`; `@kardalum/content-service` and
47
+ `@kardalum/db-adapter` use the same types for the content model they
48
+ implement; the admin UI and `@kardalum/plugin-sdk` import them for
49
+ TypeScript types. If you're only consuming a running site, prefer
50
+ `@kardalum/client`: it's built on top of this package and gives you
51
+ request-making methods, not just types.
52
+
53
+ ## Source & support
54
+
55
+ Source: [kardalum-starter](https://github.com/kardalum/kardalum-starter).
56
+ Docs: https://docs.kardalum.com. Apache-2.0.
@@ -0,0 +1,30 @@
1
+ import { z } from "zod";
2
+ export declare const ACTION_SEGMENT_MIN = 2;
3
+ export declare const ACTION_SEGMENT_MAX = 6;
4
+ /** MySQL stores an action id as VARCHAR(191); a longer id would fail to
5
+ * insert on that dialect only, so the cap is enforced where every
6
+ * dialect sees it (S272 handoff). */
7
+ export declare const ACTION_MAX_LENGTH = 191;
8
+ export declare const ActionStringSchema: z.ZodString;
9
+ export type ActionString = z.infer<typeof ActionStringSchema>;
10
+ /**
11
+ * Whether `action` belongs to the plugin with `pluginId`.
12
+ *
13
+ * A plugin's actions are stored under its FULL reverse-domain id, so
14
+ * commerce's refund action is "com.kardalum.commerce.orders.refund" rather
15
+ * than the charter's display form "commerce.orders.refund". The short form
16
+ * collides: com.kardalum.commerce and com.acme.commerce would both claim
17
+ * "commerce.*", and resolving that needs either a registry negotiation at
18
+ * install or a first-come-wins rule that makes a plugin's permissions
19
+ * depend on install order. Nothing ever shows an operator a raw action
20
+ * string, so the cost is confined to storage and code.
21
+ *
22
+ * The segment boundary is load-bearing: without it "com.kardalum.commerce2"
23
+ * would match the prefix of "com.kardalum.commerce" and inherit its
24
+ * permissions.
25
+ *
26
+ * Assumes `action` has already passed ActionStringSchema: this answers
27
+ * only the ownership question, not the shape question, so a caller that
28
+ * skips validation can get true for a malformed string.
29
+ */
30
+ export declare function isPluginActionFor(action: string, pluginId: string): boolean;
@@ -0,0 +1,88 @@
1
+ import { z } from "zod";
2
+ // A permission action: a named string a role grants and a gate requires.
3
+ // S270 (theme G1). The shape is enforced; the vocabulary is not.
4
+ //
5
+ // FLAT BY DECISION, not by omission. The dot groups actions in the role
6
+ // editor's UI and means NOTHING to the permission check, which is set
7
+ // membership on exact strings. A role storing "content.*" was rejected in
8
+ // design: a plugin adding content.destroy later would silently widen every
9
+ // role holding the wildcard, and the install screen could then not tell an
10
+ // operator what they are consenting to. The ergonomics come back at
11
+ // authoring time instead, where "select all in this group" expands to
12
+ // explicit strings before the role is saved.
13
+ export const ACTION_SEGMENT_MIN = 2;
14
+ // 6, not 5: a plugin's actions are prefixed with its full manifest id, and
15
+ // a manifest id may be up to 4 segments (manifestIdSchema), so an action
16
+ // needs room for the id plus an object plus a verb. The two numbers are a
17
+ // pair: manifestIdSchema caps ids at ACTION_SEGMENT_MAX - 2, so raising or
18
+ // lowering one without the other reintroduces ids that can declare no
19
+ // action at all.
20
+ export const ACTION_SEGMENT_MAX = 6;
21
+ /** MySQL stores an action id as VARCHAR(191); a longer id would fail to
22
+ * insert on that dialect only, so the cap is enforced where every
23
+ * dialect sees it (S272 handoff). */
24
+ export const ACTION_MAX_LENGTH = 191;
25
+ // A segment starts lowercase and continues in ASCII letters, digits or
26
+ // hyphens, so camelCase areas like documentTypes pass while DocumentTypes
27
+ // does not.
28
+ //
29
+ // HYPHENS ARE ALLOWED because plugin ids allow them and a plugin's actions
30
+ // are prefixed with its full id: com.kardalum.google-maps and
31
+ // com.kardalum.reading-time could otherwise declare no action at all. The
32
+ // earlier rule banned them to get one spelling per permission, which it
33
+ // never achieved: camelCase means content.unPublish and content.unpublish
34
+ // are both valid, so case already permitted two spellings of one idea.
35
+ // Core's own actions avoid hyphens by convention rather than by validation.
36
+ // Underscores stay out: nothing in a plugin id can produce one.
37
+ const SEGMENT = /^[a-z][a-zA-Z0-9-]*$/;
38
+ export const ActionStringSchema = z
39
+ .string()
40
+ .superRefine((value, ctx) => {
41
+ if (value.length > ACTION_MAX_LENGTH) {
42
+ ctx.addIssue({
43
+ code: "custom",
44
+ message: `an action is at most ${ACTION_MAX_LENGTH} characters (MySQL stores it as VARCHAR(${ACTION_MAX_LENGTH}))`,
45
+ });
46
+ return;
47
+ }
48
+ const segments = value.split(".");
49
+ if (segments.length < ACTION_SEGMENT_MIN || segments.length > ACTION_SEGMENT_MAX) {
50
+ ctx.addIssue({
51
+ code: "custom",
52
+ message: `An action has ${ACTION_SEGMENT_MIN} to ${ACTION_SEGMENT_MAX} dot-separated segments; "${value}" has ${segments.length}. A single segment is a namespace, not an action: the last segment is the verb.`,
53
+ });
54
+ return;
55
+ }
56
+ for (const segment of segments) {
57
+ if (!SEGMENT.test(segment)) {
58
+ ctx.addIssue({
59
+ code: "custom",
60
+ message: `Action segment "${segment}" in "${value}" must start with a lowercase letter and contain only letters, digits and hyphens.`,
61
+ });
62
+ return;
63
+ }
64
+ }
65
+ });
66
+ /**
67
+ * Whether `action` belongs to the plugin with `pluginId`.
68
+ *
69
+ * A plugin's actions are stored under its FULL reverse-domain id, so
70
+ * commerce's refund action is "com.kardalum.commerce.orders.refund" rather
71
+ * than the charter's display form "commerce.orders.refund". The short form
72
+ * collides: com.kardalum.commerce and com.acme.commerce would both claim
73
+ * "commerce.*", and resolving that needs either a registry negotiation at
74
+ * install or a first-come-wins rule that makes a plugin's permissions
75
+ * depend on install order. Nothing ever shows an operator a raw action
76
+ * string, so the cost is confined to storage and code.
77
+ *
78
+ * The segment boundary is load-bearing: without it "com.kardalum.commerce2"
79
+ * would match the prefix of "com.kardalum.commerce" and inherit its
80
+ * permissions.
81
+ *
82
+ * Assumes `action` has already passed ActionStringSchema: this answers
83
+ * only the ownership question, not the shape question, so a caller that
84
+ * skips validation can get true for a malformed string.
85
+ */
86
+ export function isPluginActionFor(action, pluginId) {
87
+ return action.startsWith(`${pluginId}.`) && action.length > pluginId.length + 1;
88
+ }
@@ -0,0 +1,5 @@
1
+ import { z } from "zod";
2
+ export declare const ApiErrorSchema: z.ZodObject<{
3
+ message: z.ZodString;
4
+ }, z.core.$strip>;
5
+ export type ApiError = z.infer<typeof ApiErrorSchema>;
@@ -0,0 +1,6 @@
1
+ import { z } from "zod";
2
+ // The one error body shape every route uses — auth, content, media. Route
3
+ // handlers vary the status code, never the shape.
4
+ export const ApiErrorSchema = z.object({
5
+ message: z.string(),
6
+ });
@@ -0,0 +1,75 @@
1
+ import { z } from "zod";
2
+ export declare const ApiKeyScopeSchema: z.ZodEnum<{
3
+ read: "read";
4
+ write: "write";
5
+ }>;
6
+ export type ApiKeyScope = z.infer<typeof ApiKeyScopeSchema>;
7
+ export declare const ApiKeySummarySchema: z.ZodObject<{
8
+ id: z.ZodString;
9
+ name: z.ZodString;
10
+ scope: z.ZodEnum<{
11
+ read: "read";
12
+ write: "write";
13
+ }>;
14
+ createdAt: z.ZodString;
15
+ lastUsedAt: z.ZodNullable<z.ZodString>;
16
+ revokedAt: z.ZodNullable<z.ZodString>;
17
+ }, z.core.$strip>;
18
+ export type ApiKeySummary = z.infer<typeof ApiKeySummarySchema>;
19
+ export declare const ApiKeyListQuerySchema: z.ZodObject<{
20
+ cursor: z.ZodOptional<z.ZodString>;
21
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
22
+ }, z.core.$strip>;
23
+ export type ApiKeyListQuery = z.infer<typeof ApiKeyListQuerySchema>;
24
+ export declare const ApiKeyListResponseSchema: z.ZodObject<{
25
+ items: z.ZodArray<z.ZodObject<{
26
+ id: z.ZodString;
27
+ name: z.ZodString;
28
+ scope: z.ZodEnum<{
29
+ read: "read";
30
+ write: "write";
31
+ }>;
32
+ createdAt: z.ZodString;
33
+ lastUsedAt: z.ZodNullable<z.ZodString>;
34
+ revokedAt: z.ZodNullable<z.ZodString>;
35
+ }, z.core.$strip>>;
36
+ nextCursor: z.ZodNullable<z.ZodString>;
37
+ }, z.core.$strip>;
38
+ export type ApiKeyListResponse = z.infer<typeof ApiKeyListResponseSchema>;
39
+ export declare const CreateApiKeyRequestSchema: z.ZodObject<{
40
+ name: z.ZodString;
41
+ scope: z.ZodDefault<z.ZodEnum<{
42
+ read: "read";
43
+ write: "write";
44
+ }>>;
45
+ }, z.core.$strip>;
46
+ export type CreateApiKeyRequest = z.infer<typeof CreateApiKeyRequestSchema>;
47
+ export declare const CreateApiKeyResponseSchema: z.ZodObject<{
48
+ apiKey: z.ZodObject<{
49
+ id: z.ZodString;
50
+ name: z.ZodString;
51
+ scope: z.ZodEnum<{
52
+ read: "read";
53
+ write: "write";
54
+ }>;
55
+ createdAt: z.ZodString;
56
+ lastUsedAt: z.ZodNullable<z.ZodString>;
57
+ revokedAt: z.ZodNullable<z.ZodString>;
58
+ }, z.core.$strip>;
59
+ secret: z.ZodString;
60
+ }, z.core.$strip>;
61
+ export type CreateApiKeyResponse = z.infer<typeof CreateApiKeyResponseSchema>;
62
+ export declare const RevokeApiKeyResponseSchema: z.ZodObject<{
63
+ apiKey: z.ZodObject<{
64
+ id: z.ZodString;
65
+ name: z.ZodString;
66
+ scope: z.ZodEnum<{
67
+ read: "read";
68
+ write: "write";
69
+ }>;
70
+ createdAt: z.ZodString;
71
+ lastUsedAt: z.ZodNullable<z.ZodString>;
72
+ revokedAt: z.ZodNullable<z.ZodString>;
73
+ }, z.core.$strip>;
74
+ }, z.core.$strip>;
75
+ export type RevokeApiKeyResponse = z.infer<typeof RevokeApiKeyResponseSchema>;
@@ -0,0 +1,36 @@
1
+ import { z } from "zod";
2
+ // What a key is allowed to do on the public /api/v1 surface. "write"
3
+ // implies read; "read" is the default so a key can never write by
4
+ // accident (S182 — before it, any key could write).
5
+ export const ApiKeyScopeSchema = z.enum(["read", "write"]);
6
+ // What key management reads — never the keyHash, never the plaintext.
7
+ export const ApiKeySummarySchema = z.object({
8
+ id: z.string().uuid(),
9
+ name: z.string(),
10
+ scope: ApiKeyScopeSchema,
11
+ createdAt: z.string().datetime(),
12
+ lastUsedAt: z.string().datetime().nullable(),
13
+ revokedAt: z.string().datetime().nullable(),
14
+ });
15
+ export const ApiKeyListQuerySchema = z.object({
16
+ cursor: z.string().uuid().optional(),
17
+ limit: z.coerce.number().int().min(1).max(100).default(50),
18
+ });
19
+ export const ApiKeyListResponseSchema = z.object({
20
+ items: z.array(ApiKeySummarySchema),
21
+ // null = no more pages.
22
+ nextCursor: z.string().uuid().nullable(),
23
+ });
24
+ export const CreateApiKeyRequestSchema = z.object({
25
+ name: z.string().min(1).max(100),
26
+ // Omitted = read. Write keys can create, save and publish content.
27
+ scope: ApiKeyScopeSchema.default("read"),
28
+ });
29
+ // The only response, anywhere, that ever carries the plaintext secret.
30
+ export const CreateApiKeyResponseSchema = z.object({
31
+ apiKey: ApiKeySummarySchema,
32
+ secret: z.string(),
33
+ });
34
+ export const RevokeApiKeyResponseSchema = z.object({
35
+ apiKey: ApiKeySummarySchema,
36
+ });
@@ -0,0 +1,89 @@
1
+ import { z } from "zod";
2
+ export declare const ASSET_TREE_MAX_DEPTH = 8;
3
+ export declare const ASSET_TREE_MAX_ENTRIES = 2000;
4
+ export declare const AssetTreeEntrySchema: z.ZodObject<{
5
+ path: z.ZodString;
6
+ kind: z.ZodEnum<{
7
+ file: "file";
8
+ folder: "folder";
9
+ }>;
10
+ size: z.ZodNullable<z.ZodNumber>;
11
+ mtimeMs: z.ZodNullable<z.ZodNumber>;
12
+ binary: z.ZodBoolean;
13
+ registered: z.ZodBoolean;
14
+ pluginId: z.ZodNullable<z.ZodString>;
15
+ }, z.core.$strip>;
16
+ export type AssetTreeEntry = z.infer<typeof AssetTreeEntrySchema>;
17
+ export declare const AssetTreeResponseSchema: z.ZodObject<{
18
+ entries: z.ZodArray<z.ZodObject<{
19
+ path: z.ZodString;
20
+ kind: z.ZodEnum<{
21
+ file: "file";
22
+ folder: "folder";
23
+ }>;
24
+ size: z.ZodNullable<z.ZodNumber>;
25
+ mtimeMs: z.ZodNullable<z.ZodNumber>;
26
+ binary: z.ZodBoolean;
27
+ registered: z.ZodBoolean;
28
+ pluginId: z.ZodNullable<z.ZodString>;
29
+ }, z.core.$strip>>;
30
+ truncated: z.ZodBoolean;
31
+ }, z.core.$strip>;
32
+ export type AssetTreeResponse = z.infer<typeof AssetTreeResponseSchema>;
33
+ export declare const AssetContentResponseSchema: z.ZodObject<{
34
+ path: z.ZodString;
35
+ content: z.ZodString;
36
+ size: z.ZodNumber;
37
+ registered: z.ZodBoolean;
38
+ pluginId: z.ZodNullable<z.ZodString>;
39
+ version: z.ZodNullable<z.ZodNumber>;
40
+ }, z.core.$strip>;
41
+ export type AssetContentResponse = z.infer<typeof AssetContentResponseSchema>;
42
+ export declare const WriteAssetContentRequestSchema: z.ZodObject<{
43
+ path: z.ZodString;
44
+ content: z.ZodString;
45
+ }, z.core.$strict>;
46
+ export type WriteAssetContentRequest = z.infer<typeof WriteAssetContentRequestSchema>;
47
+ export declare const CreateAssetFolderRequestSchema: z.ZodObject<{
48
+ path: z.ZodString;
49
+ }, z.core.$strict>;
50
+ export type CreateAssetFolderRequest = z.infer<typeof CreateAssetFolderRequestSchema>;
51
+ export declare const RenameAssetRequestSchema: z.ZodObject<{
52
+ path: z.ZodString;
53
+ newPath: z.ZodString;
54
+ }, z.core.$strict>;
55
+ export type RenameAssetRequest = z.infer<typeof RenameAssetRequestSchema>;
56
+ export declare const DeleteAssetQuerySchema: z.ZodObject<{
57
+ path: z.ZodString;
58
+ confirm: z.ZodOptional<z.ZodEnum<{
59
+ true: "true";
60
+ }>>;
61
+ }, z.core.$strip>;
62
+ export type DeleteAssetQuery = z.infer<typeof DeleteAssetQuerySchema>;
63
+ export declare const AssetDeleteBlockedResponseSchema: z.ZodObject<{
64
+ requiresConfirmation: z.ZodLiteral<true>;
65
+ path: z.ZodString;
66
+ kind: z.ZodEnum<{
67
+ file: "file";
68
+ folder: "folder";
69
+ }>;
70
+ entryCount: z.ZodNumber;
71
+ registered: z.ZodBoolean;
72
+ message: z.ZodString;
73
+ }, z.core.$strip>;
74
+ export type AssetDeleteBlockedResponse = z.infer<typeof AssetDeleteBlockedResponseSchema>;
75
+ export declare const ZipExtractReportSchema: z.ZodObject<{
76
+ extracted: z.ZodNumber;
77
+ skipped: z.ZodArray<z.ZodObject<{
78
+ path: z.ZodString;
79
+ reason: z.ZodString;
80
+ }, z.core.$strip>>;
81
+ targetFolder: z.ZodNullable<z.ZodString>;
82
+ }, z.core.$strip>;
83
+ export type ZipExtractReport = z.infer<typeof ZipExtractReportSchema>;
84
+ export declare const AssetSyncReportSchema: z.ZodObject<{
85
+ checked: z.ZodNumber;
86
+ updated: z.ZodArray<z.ZodString>;
87
+ healed: z.ZodArray<z.ZodString>;
88
+ }, z.core.$strip>;
89
+ export type AssetSyncReport = z.infer<typeof AssetSyncReportSchema>;
@@ -0,0 +1,60 @@
1
+ import { z } from "zod";
2
+ import { AssetPathSchema, MAX_ASSET_CONTENT_BYTES } from "./asset.schema.js";
3
+ // S192 asset tree browser: caps mirror the content-tree pagination
4
+ // philosophy (never load an unbounded subtree) even though the tree
5
+ // walk itself isn't cursor-paginated — depth/entry caps bound the work.
6
+ export const ASSET_TREE_MAX_DEPTH = 8;
7
+ export const ASSET_TREE_MAX_ENTRIES = 2000;
8
+ export const AssetTreeEntrySchema = z.object({
9
+ path: AssetPathSchema,
10
+ kind: z.enum(["file", "folder"]),
11
+ size: z.number().int().min(0).nullable(),
12
+ mtimeMs: z.number().nullable(),
13
+ binary: z.boolean(),
14
+ registered: z.boolean(),
15
+ pluginId: z.string().min(1).nullable(),
16
+ });
17
+ export const AssetTreeResponseSchema = z.object({
18
+ entries: z.array(AssetTreeEntrySchema),
19
+ truncated: z.boolean(),
20
+ });
21
+ export const AssetContentResponseSchema = z.object({
22
+ path: AssetPathSchema,
23
+ content: z.string(),
24
+ size: z.number().int(),
25
+ registered: z.boolean(),
26
+ pluginId: z.string().min(1).nullable(),
27
+ version: z.number().int().min(1).nullable(),
28
+ });
29
+ export const WriteAssetContentRequestSchema = z
30
+ .object({ path: AssetPathSchema, content: z.string().max(MAX_ASSET_CONTENT_BYTES) })
31
+ .strict();
32
+ export const CreateAssetFolderRequestSchema = z.object({ path: AssetPathSchema }).strict();
33
+ export const RenameAssetRequestSchema = z
34
+ .object({ path: AssetPathSchema, newPath: AssetPathSchema })
35
+ .strict();
36
+ // DELETE /api/assets is a two-step confirm gate like content trash and
37
+ // plugin uninstall: confirm is a literal "true" query string (not a
38
+ // boolean) because query params are always strings on the wire.
39
+ export const DeleteAssetQuerySchema = z.object({
40
+ path: AssetPathSchema,
41
+ confirm: z.enum(["true"]).optional(),
42
+ });
43
+ export const AssetDeleteBlockedResponseSchema = z.object({
44
+ requiresConfirmation: z.literal(true),
45
+ path: AssetPathSchema,
46
+ kind: z.enum(["file", "folder"]),
47
+ entryCount: z.number().int().min(0),
48
+ registered: z.boolean(),
49
+ message: z.string(),
50
+ });
51
+ export const ZipExtractReportSchema = z.object({
52
+ extracted: z.number().int().min(0),
53
+ skipped: z.array(z.object({ path: z.string(), reason: z.string() })),
54
+ targetFolder: AssetPathSchema.nullable(),
55
+ });
56
+ export const AssetSyncReportSchema = z.object({
57
+ checked: z.number().int(),
58
+ updated: z.array(z.string()),
59
+ healed: z.array(z.string()),
60
+ });
@@ -0,0 +1,24 @@
1
+ import { z } from "zod";
2
+ export declare const AssetPathSchema: z.ZodString;
3
+ export declare const AssetDefinitionSchema: z.ZodObject<{
4
+ id: z.ZodString;
5
+ path: z.ZodString;
6
+ pluginId: z.ZodNullable<z.ZodString>;
7
+ currentVersion: z.ZodNumber;
8
+ }, z.core.$strict>;
9
+ export type AssetDefinition = z.infer<typeof AssetDefinitionSchema>;
10
+ export declare const MAX_ASSET_CONTENT_BYTES = 5242880;
11
+ export declare const AssetVersionSchema: z.ZodObject<{
12
+ id: z.ZodString;
13
+ assetId: z.ZodString;
14
+ version: z.ZodNumber;
15
+ content: z.ZodString;
16
+ hash: z.ZodString;
17
+ source: z.ZodEnum<{
18
+ "plugin-install": "plugin-install";
19
+ admin: "admin";
20
+ "file-sync": "file-sync";
21
+ }>;
22
+ createdAt: z.ZodString;
23
+ }, z.core.$strict>;
24
+ export type AssetVersion = z.infer<typeof AssetVersionSchema>;
@@ -0,0 +1,47 @@
1
+ import { z } from "zod";
2
+ import { isReservedRootSlug } from "./reserved-slugs.js";
3
+ import { TemplateVersionSourceSchema } from "./template.schema.js";
4
+ // A registered asset: a text file under public/ whose edits are mirrored
5
+ // into immutable asset_versions rows (S192 spec §5). Unregistered files
6
+ // under public/ are just files — they never get rows here.
7
+ //
8
+ // Path rules: relative, forward slashes, no dot-segments, no leading dot
9
+ // on any segment (no hidden files), and never rooted at any
10
+ // RESERVED_ROOT_SLUGS segment (kardalum, api, docs, plugin-assets, media):
11
+ // the asset tree (walkPublicDir) hides every one of those roots, not just
12
+ // kardalum/, so writing under e.g. media/ or api/ would create an invisible
13
+ // orphan the admin UI can never see or manage again.
14
+ const SEGMENT = /^[a-z0-9][a-z0-9._-]*$/i;
15
+ export const AssetPathSchema = z
16
+ .string()
17
+ .min(1)
18
+ .max(400)
19
+ .refine((p) => !p.includes("\\"), "forward slashes only")
20
+ .refine((p) => p.split("/").every((seg) => SEGMENT.test(seg) && seg !== ".." && seg !== "."), {
21
+ message: "invalid path segment",
22
+ })
23
+ .refine((p) => !isReservedRootSlug(p.split("/")[0] ?? ""), {
24
+ message: "this path root is reserved for the server (see RESERVED_ROOT_SLUGS)",
25
+ });
26
+ export const AssetDefinitionSchema = z
27
+ .object({
28
+ id: z.string().uuid(),
29
+ path: AssetPathSchema,
30
+ pluginId: z.string().min(1).nullable(),
31
+ currentVersion: z.number().int().min(1),
32
+ })
33
+ .strict();
34
+ // 5MB cap: big enough for a vendored bundle someone opens once to patch,
35
+ // while keeping a single version row bounded.
36
+ export const MAX_ASSET_CONTENT_BYTES = 5_242_880;
37
+ export const AssetVersionSchema = z
38
+ .object({
39
+ id: z.string().uuid(),
40
+ assetId: z.string().uuid(),
41
+ version: z.number().int().min(1),
42
+ content: z.string(),
43
+ hash: z.string().length(64),
44
+ source: TemplateVersionSourceSchema,
45
+ createdAt: z.string().min(1),
46
+ })
47
+ .strict();
@@ -0,0 +1,38 @@
1
+ import { z } from "zod";
2
+ export declare const LoginRequestSchema: z.ZodObject<{
3
+ email: z.ZodString;
4
+ password: z.ZodString;
5
+ }, z.core.$strip>;
6
+ export type LoginRequest = z.infer<typeof LoginRequestSchema>;
7
+ export declare const LoginResponseSchema: z.ZodObject<{
8
+ accessToken: z.ZodString;
9
+ user: z.ZodObject<{
10
+ id: z.ZodString;
11
+ email: z.ZodString;
12
+ name: z.ZodNullable<z.ZodString>;
13
+ role: z.ZodString;
14
+ roleLabel: z.ZodString;
15
+ actions: z.ZodArray<z.ZodString>;
16
+ }, z.core.$strip>;
17
+ }, z.core.$strip>;
18
+ export type LoginResponse = z.infer<typeof LoginResponseSchema>;
19
+ export declare const RefreshResponseSchema: z.ZodObject<{
20
+ accessToken: z.ZodString;
21
+ user: z.ZodObject<{
22
+ id: z.ZodString;
23
+ email: z.ZodString;
24
+ name: z.ZodNullable<z.ZodString>;
25
+ role: z.ZodString;
26
+ roleLabel: z.ZodString;
27
+ actions: z.ZodArray<z.ZodString>;
28
+ }, z.core.$strip>;
29
+ }, z.core.$strip>;
30
+ export type RefreshResponse = z.infer<typeof RefreshResponseSchema>;
31
+ export declare const LogoutResponseSchema: z.ZodObject<{
32
+ success: z.ZodLiteral<true>;
33
+ }, z.core.$strip>;
34
+ export type LogoutResponse = z.infer<typeof LogoutResponseSchema>;
35
+ export declare const AuthErrorSchema: z.ZodObject<{
36
+ message: z.ZodString;
37
+ }, z.core.$strip>;
38
+ export type AuthError = z.infer<typeof AuthErrorSchema>;
@@ -0,0 +1,38 @@
1
+ import { z } from "zod";
2
+ import { ApiErrorSchema } from "./api-error.schema.js";
3
+ import { RoleIdSchema } from "./role.schema.js";
4
+ export const LoginRequestSchema = z.object({
5
+ email: z.string().email(),
6
+ password: z.string().min(1),
7
+ });
8
+ const AuthUserSchema = z.object({
9
+ id: z.string().uuid(),
10
+ email: z.string().email(),
11
+ name: z.string().nullable(),
12
+ role: RoleIdSchema,
13
+ /** The role's display label at login or refresh, for the user menu
14
+ * badge. A snapshot like `actions`. */
15
+ roleLabel: z.string(),
16
+ /** Every action this user's roles grant, resolved at login or refresh
17
+ * (S271). A snapshot: it is no fresher than the access token it rides
18
+ * with, and the server re-resolves on every request, so a stale list
19
+ * at worst shows a control the server then refuses. */
20
+ actions: z.array(z.string()),
21
+ });
22
+ // The refresh token itself never appears in a request/response body — it
23
+ // travels only as an httpOnly cookie (see routes/auth.ts), so the JS client
24
+ // can never read it, and a page reload doesn't lose it.
25
+ export const LoginResponseSchema = z.object({
26
+ accessToken: z.string(),
27
+ user: AuthUserSchema,
28
+ });
29
+ export const RefreshResponseSchema = z.object({
30
+ accessToken: z.string(),
31
+ user: AuthUserSchema,
32
+ });
33
+ export const LogoutResponseSchema = z.object({
34
+ success: z.literal(true),
35
+ });
36
+ // Kept as a named export for existing imports; the shape itself lives once
37
+ // in api-error.schema.ts.
38
+ export const AuthErrorSchema = ApiErrorSchema;