@kardalum/plugin-sdk 0.0.0-stage → 0.16.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 (332) hide show
  1. package/CHANGELOG.md +118 -0
  2. package/LICENSE +202 -0
  3. package/README.md +80 -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 +29 -0
  15. package/dist/capabilities.js +67 -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 +94 -0
  40. package/dist/license-verdict-keys.d.ts +18 -0
  41. package/dist/license-verdict-keys.js +26 -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 +476 -0
  47. package/dist/manifest-schema.js +823 -0
  48. package/dist/manifest.d.ts +611 -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 +447 -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 +82 -0
  55. package/dist/plugin-context.js +77 -0
  56. package/dist/plugin-screen-context.d.ts +71 -0
  57. package/dist/plugin-screen-context.js +41 -0
  58. package/dist/read-all-pages.d.ts +23 -0
  59. package/dist/read-all-pages.js +30 -0
  60. package/dist/register-built-ins.d.ts +1 -0
  61. package/dist/register-built-ins.js +41 -0
  62. package/dist/registry.d.ts +4 -0
  63. package/dist/registry.js +17 -0
  64. package/dist/rendition-eligibility.d.ts +24 -0
  65. package/dist/rendition-eligibility.js +40 -0
  66. package/dist/richtext/block-panel.d.ts +27 -0
  67. package/dist/richtext/block-panel.js +232 -0
  68. package/dist/richtext/extensions.d.ts +19 -0
  69. package/dist/richtext/extensions.js +56 -0
  70. package/dist/richtext/insert-menu.d.ts +24 -0
  71. package/dist/richtext/insert-menu.js +142 -0
  72. package/dist/richtext/kardalum-block.d.ts +33 -0
  73. package/dist/richtext/kardalum-block.js +282 -0
  74. package/dist/richtext/style-listbox.d.ts +10 -0
  75. package/dist/richtext/style-listbox.js +69 -0
  76. package/dist/richtext/text-style-class.d.ts +18 -0
  77. package/dist/richtext/text-style-class.js +36 -0
  78. package/dist/simple-storage-value-provider.d.ts +9 -0
  79. package/dist/simple-storage-value-provider.js +96 -0
  80. package/dist/structured-storage-types.d.ts +61 -0
  81. package/dist/structured-storage-types.js +11 -0
  82. package/dist/tailwind.d.ts +1 -0
  83. package/dist/tailwind.js +5 -0
  84. package/dist/tokens/system-dark.css +75 -0
  85. package/dist/tokens/tokens.css +239 -0
  86. package/dist/tokens/tokens.json +212 -0
  87. package/dist/tokens.d.ts +1 -0
  88. package/dist/tokens.js +11 -0
  89. package/dist/ui-entry.d.ts +5 -0
  90. package/dist/ui-entry.js +42 -0
  91. package/dist/views/content-list-preview.d.ts +1 -0
  92. package/dist/views/content-list-preview.js +14 -0
  93. package/dist/views/content-list-settings-view.d.ts +1 -0
  94. package/dist/views/content-list-settings-view.js +97 -0
  95. package/dist/views/content-list-view.d.ts +19 -0
  96. package/dist/views/content-list-view.js +248 -0
  97. package/dist/views/crop-view.d.ts +55 -0
  98. package/dist/views/crop-view.js +161 -0
  99. package/dist/views/date-range-view.d.ts +6 -0
  100. package/dist/views/date-range-view.js +55 -0
  101. package/dist/views/file-upload-view.d.ts +43 -0
  102. package/dist/views/file-upload-view.js +104 -0
  103. package/dist/views/html-code-editor.d.ts +10 -0
  104. package/dist/views/html-code-editor.js +101 -0
  105. package/dist/views/html-view.d.ts +3 -0
  106. package/dist/views/html-view.js +53 -0
  107. package/dist/views/image-view.d.ts +3 -0
  108. package/dist/views/image-view.js +372 -0
  109. package/dist/views/rich-text-view.d.ts +2 -0
  110. package/dist/views/rich-text-view.js +429 -0
  111. package/node_modules/@kardalum/api-schemas/LICENSE +202 -0
  112. package/node_modules/@kardalum/api-schemas/README.md +56 -0
  113. package/node_modules/@kardalum/api-schemas/dist/action.schema.d.ts +30 -0
  114. package/node_modules/@kardalum/api-schemas/dist/action.schema.js +88 -0
  115. package/node_modules/@kardalum/api-schemas/dist/api-error.schema.d.ts +17 -0
  116. package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +25 -0
  117. package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +93 -0
  118. package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +88 -0
  119. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.d.ts +89 -0
  120. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +60 -0
  121. package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +24 -0
  122. package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +47 -0
  123. package/node_modules/@kardalum/api-schemas/dist/auth.schema.d.ts +38 -0
  124. package/node_modules/@kardalum/api-schemas/dist/auth.schema.js +38 -0
  125. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +542 -0
  126. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +357 -0
  127. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +158 -0
  128. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +139 -0
  129. package/node_modules/@kardalum/api-schemas/dist/content-path.d.ts +125 -0
  130. package/node_modules/@kardalum/api-schemas/dist/content-path.js +260 -0
  131. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.d.ts +20 -0
  132. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +23 -0
  133. package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.d.ts +152 -0
  134. package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +82 -0
  135. package/node_modules/@kardalum/api-schemas/dist/content-version.schema.d.ts +18 -0
  136. package/node_modules/@kardalum/api-schemas/dist/content-version.schema.js +22 -0
  137. package/node_modules/@kardalum/api-schemas/dist/content.schema.d.ts +17 -0
  138. package/node_modules/@kardalum/api-schemas/dist/content.schema.js +20 -0
  139. package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +352 -0
  140. package/node_modules/@kardalum/api-schemas/dist/core-actions.js +133 -0
  141. package/node_modules/@kardalum/api-schemas/dist/culture-direction.d.ts +1 -0
  142. package/node_modules/@kardalum/api-schemas/dist/culture-direction.js +9 -0
  143. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +37 -0
  144. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +32 -0
  145. package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.d.ts +9 -0
  146. package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +32 -0
  147. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +298 -0
  148. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +138 -0
  149. package/node_modules/@kardalum/api-schemas/dist/document-type.schema.d.ts +121 -0
  150. package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +147 -0
  151. package/node_modules/@kardalum/api-schemas/dist/health.schema.d.ts +6 -0
  152. package/node_modules/@kardalum/api-schemas/dist/health.schema.js +5 -0
  153. package/node_modules/@kardalum/api-schemas/dist/html-entities.d.ts +4 -0
  154. package/node_modules/@kardalum/api-schemas/dist/html-entities.js +250 -0
  155. package/node_modules/@kardalum/api-schemas/dist/index.d.ts +113 -0
  156. package/node_modules/@kardalum/api-schemas/dist/index.js +64 -0
  157. package/node_modules/@kardalum/api-schemas/dist/licensing.schema.d.ts +15 -0
  158. package/node_modules/@kardalum/api-schemas/dist/licensing.schema.js +14 -0
  159. package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.d.ts +73 -0
  160. package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.js +104 -0
  161. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +682 -0
  162. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +269 -0
  163. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +177 -0
  164. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +222 -0
  165. package/node_modules/@kardalum/api-schemas/dist/media-reference-api.schema.d.ts +77 -0
  166. package/node_modules/@kardalum/api-schemas/dist/media-reference-api.schema.js +53 -0
  167. package/node_modules/@kardalum/api-schemas/dist/media-reference-use.d.ts +75 -0
  168. package/node_modules/@kardalum/api-schemas/dist/media-reference-use.js +117 -0
  169. package/node_modules/@kardalum/api-schemas/dist/media-reference.d.ts +27 -0
  170. package/node_modules/@kardalum/api-schemas/dist/media-reference.js +279 -0
  171. package/node_modules/@kardalum/api-schemas/dist/media-rendition.schema.d.ts +74 -0
  172. package/node_modules/@kardalum/api-schemas/dist/media-rendition.schema.js +157 -0
  173. package/node_modules/@kardalum/api-schemas/dist/media.schema.d.ts +80 -0
  174. package/node_modules/@kardalum/api-schemas/dist/media.schema.js +156 -0
  175. package/node_modules/@kardalum/api-schemas/dist/nav.schema.d.ts +23 -0
  176. package/node_modules/@kardalum/api-schemas/dist/nav.schema.js +55 -0
  177. package/node_modules/@kardalum/api-schemas/dist/node-access.schema.d.ts +846 -0
  178. package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +356 -0
  179. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +20 -0
  180. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +27 -0
  181. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +249 -0
  182. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +84 -0
  183. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-text.d.ts +65 -0
  184. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-text.js +889 -0
  185. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +172 -0
  186. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +196 -0
  187. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +31 -0
  188. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +38 -0
  189. package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +69 -0
  190. package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +59 -0
  191. package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +585 -0
  192. package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +536 -0
  193. package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +75 -0
  194. package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +213 -0
  195. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +391 -0
  196. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +413 -0
  197. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +29 -0
  198. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +100 -0
  199. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +44 -0
  200. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +162 -0
  201. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.d.ts +31 -0
  202. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +25 -0
  203. package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.d.ts +15 -0
  204. package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.js +24 -0
  205. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +314 -0
  206. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +338 -0
  207. package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +79 -0
  208. package/node_modules/@kardalum/api-schemas/dist/render-editing.js +50 -0
  209. package/node_modules/@kardalum/api-schemas/dist/render-settings-api.schema.d.ts +9 -0
  210. package/node_modules/@kardalum/api-schemas/dist/render-settings-api.schema.js +13 -0
  211. package/node_modules/@kardalum/api-schemas/dist/reserved-slugs.d.ts +2 -0
  212. package/node_modules/@kardalum/api-schemas/dist/reserved-slugs.js +16 -0
  213. package/node_modules/@kardalum/api-schemas/dist/role.schema.d.ts +96 -0
  214. package/node_modules/@kardalum/api-schemas/dist/role.schema.js +75 -0
  215. package/node_modules/@kardalum/api-schemas/dist/sample-content-outcome.schema.d.ts +17 -0
  216. package/node_modules/@kardalum/api-schemas/dist/sample-content-outcome.schema.js +27 -0
  217. package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +35 -0
  218. package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +79 -0
  219. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +138 -0
  220. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +105 -0
  221. package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +243 -0
  222. package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +296 -0
  223. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +47 -0
  224. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.js +27 -0
  225. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +30 -0
  226. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.js +19 -0
  227. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +112 -0
  228. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +74 -0
  229. package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +41 -0
  230. package/node_modules/@kardalum/api-schemas/dist/template.schema.js +39 -0
  231. package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.d.ts +21 -0
  232. package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.js +14 -0
  233. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +97 -0
  234. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +73 -0
  235. package/node_modules/@kardalum/api-schemas/package.json +35 -0
  236. package/node_modules/@kardalum/design-tokens/LICENSE +202 -0
  237. package/node_modules/@kardalum/design-tokens/README.md +29 -0
  238. package/node_modules/@kardalum/design-tokens/dist/build-css.d.ts +32 -0
  239. package/node_modules/@kardalum/design-tokens/dist/build-css.js +88 -0
  240. package/node_modules/@kardalum/design-tokens/dist/generate.d.ts +1 -0
  241. package/node_modules/@kardalum/design-tokens/dist/generate.js +18 -0
  242. package/node_modules/@kardalum/design-tokens/dist/index.d.ts +6 -0
  243. package/node_modules/@kardalum/design-tokens/dist/index.js +4 -0
  244. package/node_modules/@kardalum/design-tokens/dist/system-dark.css +75 -0
  245. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +33 -0
  246. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +54 -0
  247. package/node_modules/@kardalum/design-tokens/dist/theme-css.d.ts +12 -0
  248. package/node_modules/@kardalum/design-tokens/dist/theme-css.js +42 -0
  249. package/node_modules/@kardalum/design-tokens/dist/theme-types.d.ts +43 -0
  250. package/node_modules/@kardalum/design-tokens/dist/theme-types.js +1 -0
  251. package/node_modules/@kardalum/design-tokens/dist/themes/dark.d.ts +13 -0
  252. package/node_modules/@kardalum/design-tokens/dist/themes/dark.js +120 -0
  253. package/node_modules/@kardalum/design-tokens/dist/themes/index.d.ts +5 -0
  254. package/node_modules/@kardalum/design-tokens/dist/themes/index.js +4 -0
  255. package/node_modules/@kardalum/design-tokens/dist/themes/light.d.ts +9 -0
  256. package/node_modules/@kardalum/design-tokens/dist/themes/light.js +13 -0
  257. package/node_modules/@kardalum/design-tokens/dist/tokens.css +239 -0
  258. package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +25 -0
  259. package/node_modules/@kardalum/design-tokens/dist/tokens.js +276 -0
  260. package/node_modules/@kardalum/design-tokens/dist/tokens.json +212 -0
  261. package/node_modules/@kardalum/design-tokens/dist/types.d.ts +91 -0
  262. package/node_modules/@kardalum/design-tokens/dist/types.js +5 -0
  263. package/node_modules/@kardalum/design-tokens/package.json +42 -0
  264. package/node_modules/@kardalum/plugin-package/LICENSE +202 -0
  265. package/node_modules/@kardalum/plugin-package/README.md +71 -0
  266. package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +111 -0
  267. package/node_modules/@kardalum/plugin-package/dist/build-reference.js +61 -0
  268. package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +103 -0
  269. package/node_modules/@kardalum/plugin-package/dist/capabilities.js +351 -0
  270. package/node_modules/@kardalum/plugin-package/dist/docs-contract.d.ts +50 -0
  271. package/node_modules/@kardalum/plugin-package/dist/docs-contract.js +659 -0
  272. package/node_modules/@kardalum/plugin-package/dist/envelope.d.ts +19 -0
  273. package/node_modules/@kardalum/plugin-package/dist/envelope.js +104 -0
  274. package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +37 -0
  275. package/node_modules/@kardalum/plugin-package/dist/extract.js +199 -0
  276. package/node_modules/@kardalum/plugin-package/dist/hash.d.ts +17 -0
  277. package/node_modules/@kardalum/plugin-package/dist/hash.js +69 -0
  278. package/node_modules/@kardalum/plugin-package/dist/index.d.ts +13 -0
  279. package/node_modules/@kardalum/plugin-package/dist/index.js +8 -0
  280. package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +185 -0
  281. package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +236 -0
  282. package/node_modules/@kardalum/plugin-package/dist/package-contract.d.ts +50 -0
  283. package/node_modules/@kardalum/plugin-package/dist/package-contract.js +115 -0
  284. package/node_modules/@kardalum/plugin-package/dist/reference-entry.d.ts +2 -0
  285. package/node_modules/@kardalum/plugin-package/dist/reference-entry.js +6 -0
  286. package/node_modules/@kardalum/plugin-package/dist/sample-content.d.ts +20 -0
  287. package/node_modules/@kardalum/plugin-package/dist/sample-content.js +57 -0
  288. package/node_modules/@kardalum/plugin-package/dist/types.d.ts +43 -0
  289. package/node_modules/@kardalum/plugin-package/dist/types.js +15 -0
  290. package/node_modules/@kardalum/plugin-package/package.json +54 -0
  291. package/node_modules/@kardalum/ui/LICENSE +202 -0
  292. package/node_modules/@kardalum/ui/README.md +35 -0
  293. package/node_modules/@kardalum/ui/dist/components/alert-dialog.d.ts +14 -0
  294. package/node_modules/@kardalum/ui/dist/components/alert-dialog.js +38 -0
  295. package/node_modules/@kardalum/ui/dist/components/badge.d.ts +9 -0
  296. package/node_modules/@kardalum/ui/dist/components/badge.js +30 -0
  297. package/node_modules/@kardalum/ui/dist/components/button.d.ts +11 -0
  298. package/node_modules/@kardalum/ui/dist/components/button.js +37 -0
  299. package/node_modules/@kardalum/ui/dist/components/checkbox.d.ts +5 -0
  300. package/node_modules/@kardalum/ui/dist/components/checkbox.js +7 -0
  301. package/node_modules/@kardalum/ui/dist/components/dialog.d.ts +17 -0
  302. package/node_modules/@kardalum/ui/dist/components/dialog.js +48 -0
  303. package/node_modules/@kardalum/ui/dist/components/dropdown-menu.d.ts +18 -0
  304. package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +53 -0
  305. package/node_modules/@kardalum/ui/dist/components/empty-state.d.ts +30 -0
  306. package/node_modules/@kardalum/ui/dist/components/empty-state.js +9 -0
  307. package/node_modules/@kardalum/ui/dist/components/input.d.ts +4 -0
  308. package/node_modules/@kardalum/ui/dist/components/input.js +6 -0
  309. package/node_modules/@kardalum/ui/dist/components/panel.d.ts +5 -0
  310. package/node_modules/@kardalum/ui/dist/components/panel.js +6 -0
  311. package/node_modules/@kardalum/ui/dist/components/property-field.d.ts +19 -0
  312. package/node_modules/@kardalum/ui/dist/components/property-field.js +89 -0
  313. package/node_modules/@kardalum/ui/dist/components/sheet.d.ts +17 -0
  314. package/node_modules/@kardalum/ui/dist/components/sheet.js +55 -0
  315. package/node_modules/@kardalum/ui/dist/components/skeleton.d.ts +3 -0
  316. package/node_modules/@kardalum/ui/dist/components/skeleton.js +9 -0
  317. package/node_modules/@kardalum/ui/dist/components/switch.d.ts +5 -0
  318. package/node_modules/@kardalum/ui/dist/components/switch.js +7 -0
  319. package/node_modules/@kardalum/ui/dist/components/tab-strip.d.ts +34 -0
  320. package/node_modules/@kardalum/ui/dist/components/tab-strip.js +72 -0
  321. package/node_modules/@kardalum/ui/dist/components/toast.d.ts +18 -0
  322. package/node_modules/@kardalum/ui/dist/components/toast.js +42 -0
  323. package/node_modules/@kardalum/ui/dist/components/toaster.d.ts +12 -0
  324. package/node_modules/@kardalum/ui/dist/components/toaster.js +11 -0
  325. package/node_modules/@kardalum/ui/dist/components/use-toast.d.ts +17 -0
  326. package/node_modules/@kardalum/ui/dist/components/use-toast.js +62 -0
  327. package/node_modules/@kardalum/ui/dist/index.d.ts +18 -0
  328. package/node_modules/@kardalum/ui/dist/index.js +18 -0
  329. package/node_modules/@kardalum/ui/dist/lib/cn.d.ts +2 -0
  330. package/node_modules/@kardalum/ui/dist/lib/cn.js +5 -0
  331. package/node_modules/@kardalum/ui/package.json +63 -0
  332. package/package.json +146 -4
@@ -0,0 +1,75 @@
1
+ import { z } from "zod";
2
+ import { ActionStringSchema } from "./action.schema.js";
3
+ // S272, theme G2: roles are rows. This file is the one definition the
4
+ // server, the admin UI and the setup wizard share for what a role id looks
5
+ // like and which two roles are seeded, so none of them can drift.
6
+ /** An operator-chosen slug, chosen at create and never changed. Lowercase
7
+ * so it reads the same in a URL, a token and a SQL client. */
8
+ export const ROLE_ID_PATTERN = /^[a-z][a-z0-9-]{0,63}$/;
9
+ /** The two roles every install has. `admin` is the fixed superuser: it
10
+ * holds every registered action, has no role_actions rows, and cannot be
11
+ * deleted or have actions removed. `editor` is an ordinary editable row
12
+ * seeded with today's non-admin-gated actions; it cannot be deleted. */
13
+ export const SEEDED_ROLE_IDS = { admin: "admin", editor: "editor" };
14
+ export const RoleIdSchema = z
15
+ .string()
16
+ .regex(ROLE_ID_PATTERN, "role id must be a lowercase slug: a letter, then letters, digits or hyphens, at most 64 characters");
17
+ /** One registered action, as the role editor lists it. `source` is "core"
18
+ * or, from S273 on, the id of the plugin that declared it. */
19
+ export const ActionSummarySchema = z.object({
20
+ id: ActionStringSchema,
21
+ label: z.string(),
22
+ source: z.string(),
23
+ /** "Core" for core's own actions, otherwise the plugin's display name,
24
+ * which the Roles screen heads the group with. */
25
+ sourceLabel: z.string(),
26
+ /** False while the owning plugin is deactivated (or gone): the rows and
27
+ * grants stay, and the editor marks the group inactive. Core is always
28
+ * active. */
29
+ active: z.boolean(),
30
+ /** S303: what a holder of an API key should know the action can do, for a
31
+ * core action that has a note; null for the rest and for a plugin's. Shown in
32
+ * the key form only. */
33
+ keyNote: z.string().nullable(),
34
+ });
35
+ export const ActionListResponseSchema = z.object({
36
+ items: z.array(ActionSummarySchema),
37
+ });
38
+ export const RoleSchema = z.object({
39
+ id: RoleIdSchema,
40
+ label: z.string(),
41
+ /** For the superuser this is every registered action, computed; for any
42
+ * other role, exactly its role_actions rows. Sorted. */
43
+ actions: z.array(z.string()),
44
+ superuser: z.boolean(),
45
+ userCount: z.number().int().nonnegative(),
46
+ createdAt: z.string().datetime(),
47
+ updatedAt: z.string().datetime(),
48
+ });
49
+ export const RoleListQuerySchema = z.object({
50
+ cursor: RoleIdSchema.optional(),
51
+ limit: z.coerce.number().int().min(1).max(100).default(50),
52
+ });
53
+ export const RoleListResponseSchema = z.object({
54
+ items: z.array(RoleSchema),
55
+ // null = no more pages.
56
+ nextCursor: RoleIdSchema.nullable(),
57
+ });
58
+ const RoleLabelSchema = z.string().trim().min(1).max(120);
59
+ export const CreateRoleRequestSchema = z.object({
60
+ id: RoleIdSchema,
61
+ label: RoleLabelSchema,
62
+ actions: z.array(ActionStringSchema),
63
+ });
64
+ export const UpdateRoleRequestSchema = z
65
+ .object({
66
+ label: RoleLabelSchema.optional(),
67
+ actions: z.array(ActionStringSchema).optional(),
68
+ })
69
+ .refine((body) => body.label !== undefined || body.actions !== undefined, {
70
+ message: "nothing to update: send label, actions, or both",
71
+ });
72
+ export const RoleResponseSchema = z.object({ role: RoleSchema });
73
+ export const DeleteRoleResponseSchema = z.object({ deleted: z.literal(true) });
74
+ // S301: the params of PATCH and DELETE /roles/:id, moved here from the route file.
75
+ export const RoleParamsSchema = z.object({ id: RoleIdSchema });
@@ -0,0 +1,17 @@
1
+ import { z } from "zod";
2
+ export declare const SampleContentOutcomeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3
+ status: z.ZodLiteral<"none">;
4
+ }, z.core.$strip>, z.ZodObject<{
5
+ status: z.ZodLiteral<"invalid">;
6
+ }, z.core.$strip>, z.ZodObject<{
7
+ status: z.ZodLiteral<"already-present">;
8
+ path: z.ZodString;
9
+ }, z.core.$strip>, z.ZodObject<{
10
+ status: z.ZodLiteral<"skipped">;
11
+ name: z.ZodString;
12
+ message: z.ZodString;
13
+ }, z.core.$strip>, z.ZodObject<{
14
+ status: z.ZodLiteral<"added">;
15
+ count: z.ZodNumber;
16
+ }, z.core.$strip>], "status">;
17
+ export type SampleContentOutcome = z.infer<typeof SampleContentOutcomeSchema>;
@@ -0,0 +1,27 @@
1
+ import { z } from "zod";
2
+ // S277e: what an install did with a plugin's sample content (the
3
+ // `sample-content.json` a template ships). Sample content is added whole
4
+ // or not at all, and the install stands whatever this says.
5
+ //
6
+ // - `none`: the plugin has no sample content.
7
+ // - `invalid`: the sample file could not be read (it is malformed, or it
8
+ // names a document type or a parent that is not there).
9
+ // - `already-present`: a page already exists at `path`, where one of the
10
+ // sample's top-level pages would go, so nothing was added. That page is
11
+ // the sample's own from an earlier install, or one the installer made.
12
+ // - `skipped`: a sample page was refused (its name is taken as the first
13
+ // part of an address, or reserved, or its document type may not be placed
14
+ // there, or the write failed), so no sample content was added. `name` is
15
+ // that page's slug in the sample and `message` is the reason.
16
+ // - `added`: every sample page was created and published; `count` of them.
17
+ //
18
+ // An install answer carries it as an optional `sampleContent`: absent when
19
+ // the install added nothing new that could have sample content (an update,
20
+ // or a plugin without any).
21
+ export const SampleContentOutcomeSchema = z.discriminatedUnion("status", [
22
+ z.object({ status: z.literal("none") }),
23
+ z.object({ status: z.literal("invalid") }),
24
+ z.object({ status: z.literal("already-present"), path: z.string() }),
25
+ z.object({ status: z.literal("skipped"), name: z.string(), message: z.string() }),
26
+ z.object({ status: z.literal("added"), count: z.number().int() }),
27
+ ]);
@@ -0,0 +1,35 @@
1
+ import { z } from "zod";
2
+ /** media[].file: "media/" plus a flat, traversal-free file name. Without it,
3
+ * a file of "../../.env" would resolve outside the package and be uploaded
4
+ * as a public media record. One character class, no nesting. */
5
+ export declare const SAMPLE_CONTENT_MEDIA_FILE_PATTERN: RegExp;
6
+ export declare const SampleContentFileSchema: z.ZodObject<{
7
+ description: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
8
+ en: z.ZodString;
9
+ }, z.core.$catchall<z.ZodString>>>>;
10
+ nodes: z.ZodArray<z.ZodObject<{
11
+ documentType: z.ZodString;
12
+ slug: z.ZodString;
13
+ parent: z.ZodNullable<z.ZodString>;
14
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
15
+ }, z.core.$strict>>;
16
+ media: z.ZodOptional<z.ZodArray<z.ZodObject<{
17
+ key: z.ZodString;
18
+ file: z.ZodString;
19
+ mimeType: z.ZodString;
20
+ }, z.core.$strip>>>;
21
+ }, z.core.$strict>;
22
+ export type SampleContentFile = z.infer<typeof SampleContentFileSchema>;
23
+ export type ParsedSampleContentFile = {
24
+ ok: true;
25
+ file: SampleContentFile;
26
+ } | {
27
+ ok: false;
28
+ errors: string[];
29
+ };
30
+ /** Parsed JSON through SampleContentFileSchema, each refusal written as
31
+ * "path: message" (or the message alone at the root). A root that is not
32
+ * an object is answered here rather than by an `error` on the schema: that
33
+ * would also answer .strict()'s unknown root key, and a misspelt key would
34
+ * read "must be a JSON object" instead of being named. */
35
+ export declare function parseSampleContentFile(raw: unknown): ParsedSampleContentFile;
@@ -0,0 +1,79 @@
1
+ import { z } from "zod";
2
+ import { InstallDescriptionSchema } from "./plugin-install.js";
3
+ // S292 (2026-10-13-s292-what-the-wizard-may-ask-design.md, design 3.5):
4
+ // sample-content.json, the sample pages a plugin package may ship at its root
5
+ // beside manifest.json. Its schema used to live in the server's seeder, with
6
+ // a hand-rolled copy in the CLI and a third, best-effort reader in the build's
7
+ // media copy; it is package data read on both sides of an install, which is
8
+ // what a schema here is for. The shape is the seeder's exactly, plus
9
+ // `description`: the plugin's own words for its sample, which the install
10
+ // interface shows with the "add the sample content" question.
11
+ /** media[].file: "media/" plus a flat, traversal-free file name. Without it,
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._-]+$/;
15
+ /** media[].key: exactly what the seeder's {{media:key}} tokens can match. */
16
+ const SAMPLE_CONTENT_MEDIA_KEY_PATTERN = /^[A-Za-z0-9_-]+$/;
17
+ const NON_EMPTY = "must be a non-empty string";
18
+ const ROOT_RULE = "sample-content.json must be a JSON object";
19
+ const MEDIA_KEY_RULE = 'must be letters, digits, "_" or "-"';
20
+ const MEDIA_FILE_RULE = 'must be "media/" followed by a file name of letters, digits, ".", "_" or "-"';
21
+ /** A node or a media entry that is not an object reads "must be an object".
22
+ * The function answers only that: an unknown key on a node keeps zod's own
23
+ * words, which name the key. */
24
+ function mustBeAnObject(issue) {
25
+ return issue.code === "invalid_type" ? "must be an object" : undefined;
26
+ }
27
+ const SampleContentNodeSchema = z
28
+ .object({
29
+ documentType: z.string({ error: NON_EMPTY }).min(1, { message: NON_EMPTY }),
30
+ // Never empty, for any node (S277c). No node is stored at "/": a
31
+ // template's home page is an ordinary top-level node with a slug of its
32
+ // own, and an empty slug on a deeper node would collapse it onto its
33
+ // parent's path.
34
+ slug: z.string({ error: NON_EMPTY }).min(1, { message: NON_EMPTY }),
35
+ parent: z.string({ error: "must be a string or null" }).nullable(),
36
+ data: z.record(z.string(), z.unknown(), { error: "must be an object" }),
37
+ }, { error: mustBeAnObject })
38
+ .strict();
39
+ export const SampleContentFileSchema = z
40
+ .object({
41
+ description: InstallDescriptionSchema.optional(),
42
+ nodes: z.array(SampleContentNodeSchema, { error: "must be an array" }),
43
+ // S199: files inside the package that the install uploads into the
44
+ // media library, referenced from node data as {{media:key}} (the id)
45
+ // or {{media:key:url}} (the url). Not strict, as the seeder's never
46
+ // was: an unknown key on an entry is dropped.
47
+ media: z
48
+ .array(z.object({
49
+ key: z.string({ error: MEDIA_KEY_RULE }).regex(SAMPLE_CONTENT_MEDIA_KEY_PATTERN, { message: MEDIA_KEY_RULE }),
50
+ file: z.string({ error: MEDIA_FILE_RULE }).regex(SAMPLE_CONTENT_MEDIA_FILE_PATTERN, { message: MEDIA_FILE_RULE }),
51
+ mimeType: z.string({ error: NON_EMPTY }).min(1, { message: NON_EMPTY }),
52
+ }, { error: mustBeAnObject }), { error: "must be an array" })
53
+ .optional(),
54
+ })
55
+ .strict();
56
+ /** A Zod path the way an author reads it: nodes[0].slug. */
57
+ function pathText(path) {
58
+ let text = "";
59
+ for (const step of path) {
60
+ if (typeof step === "number")
61
+ text += `[${step}]`;
62
+ else
63
+ text += text === "" ? String(step) : `.${String(step)}`;
64
+ }
65
+ return text;
66
+ }
67
+ /** Parsed JSON through SampleContentFileSchema, each refusal written as
68
+ * "path: message" (or the message alone at the root). A root that is not
69
+ * an object is answered here rather than by an `error` on the schema: that
70
+ * would also answer .strict()'s unknown root key, and a misspelt key would
71
+ * read "must be a JSON object" instead of being named. */
72
+ export function parseSampleContentFile(raw) {
73
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw))
74
+ return { ok: false, errors: [ROOT_RULE] };
75
+ const result = SampleContentFileSchema.safeParse(raw);
76
+ if (result.success)
77
+ return { ok: true, file: result.data };
78
+ return { ok: false, errors: result.error.issues.map((issue) => (issue.path.length > 0 ? `${pathText(issue.path)}: ${issue.message}` : issue.message)) };
79
+ }
@@ -0,0 +1,138 @@
1
+ import { z } from "zod";
2
+ export declare const BundledTemplateSchema: z.ZodObject<{
3
+ pluginId: z.ZodString;
4
+ version: z.ZodString;
5
+ name: z.ZodString;
6
+ description: z.ZodOptional<z.ZodString>;
7
+ sampleContent: z.ZodBoolean;
8
+ sampleContentDescription: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
9
+ en: z.ZodString;
10
+ }, z.core.$catchall<z.ZodString>>>>;
11
+ }, z.core.$strip>;
12
+ export type BundledTemplate = z.infer<typeof BundledTemplateSchema>;
13
+ export declare const SetupStatusResponseSchema: z.ZodObject<{
14
+ setupRequired: z.ZodBoolean;
15
+ bundledTemplates: z.ZodArray<z.ZodObject<{
16
+ pluginId: z.ZodString;
17
+ version: z.ZodString;
18
+ name: z.ZodString;
19
+ description: z.ZodOptional<z.ZodString>;
20
+ sampleContent: z.ZodBoolean;
21
+ sampleContentDescription: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
22
+ en: z.ZodString;
23
+ }, z.core.$catchall<z.ZodString>>>>;
24
+ }, z.core.$strip>>;
25
+ databaseConfigured: z.ZodBoolean;
26
+ }, z.core.$strip>;
27
+ export type SetupStatusResponse = z.infer<typeof SetupStatusResponseSchema>;
28
+ export declare const SetupStarterSelectionSchema: z.ZodObject<{
29
+ pluginId: z.ZodString;
30
+ answers: z.ZodOptional<z.ZodObject<{
31
+ sampleContent: z.ZodOptional<z.ZodBoolean>;
32
+ roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
33
+ options: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodArray<z.ZodString>]>>>>;
34
+ }, z.core.$strict>>;
35
+ }, z.core.$strict>;
36
+ export type SetupStarterSelection = z.infer<typeof SetupStarterSelectionSchema>;
37
+ export declare const SetupCompleteRequestSchema: z.ZodObject<{
38
+ admin: z.ZodObject<{
39
+ email: z.ZodString;
40
+ name: z.ZodString;
41
+ password: z.ZodString;
42
+ }, z.core.$strip>;
43
+ database: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
44
+ dialect: z.ZodLiteral<"sqlite">;
45
+ filePath: z.ZodString;
46
+ }, z.core.$strip>, z.ZodObject<{
47
+ host: z.ZodString;
48
+ port: z.ZodCoercedNumber<unknown>;
49
+ database: z.ZodString;
50
+ username: z.ZodString;
51
+ password: z.ZodString;
52
+ dialect: z.ZodLiteral<"postgresql">;
53
+ }, z.core.$strip>, z.ZodObject<{
54
+ host: z.ZodString;
55
+ port: z.ZodCoercedNumber<unknown>;
56
+ database: z.ZodString;
57
+ username: z.ZodString;
58
+ password: z.ZodString;
59
+ dialect: z.ZodLiteral<"mysql">;
60
+ }, z.core.$strip>], "dialect">>;
61
+ starter: z.ZodOptional<z.ZodObject<{
62
+ pluginId: z.ZodString;
63
+ answers: z.ZodOptional<z.ZodObject<{
64
+ sampleContent: z.ZodOptional<z.ZodBoolean>;
65
+ roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
66
+ options: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodArray<z.ZodString>]>>>>;
67
+ }, z.core.$strict>>;
68
+ }, z.core.$strict>>;
69
+ }, z.core.$strip>;
70
+ export type SetupCompleteRequest = z.infer<typeof SetupCompleteRequestSchema>;
71
+ export declare const SetupStarterResultSchema: z.ZodObject<{
72
+ pluginId: z.ZodString;
73
+ outcome: z.ZodEnum<{
74
+ failed: "failed";
75
+ installed: "installed";
76
+ }>;
77
+ reason: z.ZodOptional<z.ZodString>;
78
+ sampleContent: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
79
+ status: z.ZodLiteral<"none">;
80
+ }, z.core.$strip>, z.ZodObject<{
81
+ status: z.ZodLiteral<"invalid">;
82
+ }, z.core.$strip>, z.ZodObject<{
83
+ status: z.ZodLiteral<"already-present">;
84
+ path: z.ZodString;
85
+ }, z.core.$strip>, z.ZodObject<{
86
+ status: z.ZodLiteral<"skipped">;
87
+ name: z.ZodString;
88
+ message: z.ZodString;
89
+ }, z.core.$strip>, z.ZodObject<{
90
+ status: z.ZodLiteral<"added">;
91
+ count: z.ZodNumber;
92
+ }, z.core.$strip>], "status">>;
93
+ roles: z.ZodOptional<z.ZodArray<z.ZodObject<{
94
+ id: z.ZodString;
95
+ outcome: z.ZodEnum<{
96
+ created: "created";
97
+ "already-exists": "already-exists";
98
+ failed: "failed";
99
+ }>;
100
+ }, z.core.$strip>>>;
101
+ }, z.core.$strip>;
102
+ export type SetupStarterResult = z.infer<typeof SetupStarterResultSchema>;
103
+ export declare const SetupCompleteResponseSchema: z.ZodObject<{
104
+ success: z.ZodLiteral<true>;
105
+ starter: z.ZodOptional<z.ZodObject<{
106
+ pluginId: z.ZodString;
107
+ outcome: z.ZodEnum<{
108
+ failed: "failed";
109
+ installed: "installed";
110
+ }>;
111
+ reason: z.ZodOptional<z.ZodString>;
112
+ sampleContent: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
113
+ status: z.ZodLiteral<"none">;
114
+ }, z.core.$strip>, z.ZodObject<{
115
+ status: z.ZodLiteral<"invalid">;
116
+ }, z.core.$strip>, z.ZodObject<{
117
+ status: z.ZodLiteral<"already-present">;
118
+ path: z.ZodString;
119
+ }, z.core.$strip>, z.ZodObject<{
120
+ status: z.ZodLiteral<"skipped">;
121
+ name: z.ZodString;
122
+ message: z.ZodString;
123
+ }, z.core.$strip>, z.ZodObject<{
124
+ status: z.ZodLiteral<"added">;
125
+ count: z.ZodNumber;
126
+ }, z.core.$strip>], "status">>;
127
+ roles: z.ZodOptional<z.ZodArray<z.ZodObject<{
128
+ id: z.ZodString;
129
+ outcome: z.ZodEnum<{
130
+ created: "created";
131
+ "already-exists": "already-exists";
132
+ failed: "failed";
133
+ }>;
134
+ }, z.core.$strip>>>;
135
+ }, z.core.$strip>>;
136
+ configWarning: z.ZodOptional<z.ZodString>;
137
+ }, z.core.$strip>;
138
+ export type SetupCompleteResponse = z.infer<typeof SetupCompleteResponseSchema>;
@@ -0,0 +1,105 @@
1
+ import { z } from "zod";
2
+ import { InstallAnswersSchema, InstallDescriptionSchema } from "./plugin-install.js";
3
+ import { InstallRoleOutcomeSchema } from "./plugin-install-record.schema.js";
4
+ import { SampleContentOutcomeSchema } from "./sample-content-outcome.schema.js";
5
+ // One bundled first-party starter template (currently only the blog
6
+ // template — apps/server/src/setup/bundled-templates.ts) offered from the
7
+ // setup wizard's optional "starter template" step. `pluginId` matches the
8
+ // template plugin's manifest id (e.g. "com.kardalum.blog"): the same id the
9
+ // marketplace install flow uses elsewhere, so a template picked here and a
10
+ // template found later in the marketplace are addressed identically.
11
+ // `sampleContent` reports whether the packed artifact carries a
12
+ // sample-content.json seed tree, not the content itself.
13
+ export const BundledTemplateSchema = z.object({
14
+ pluginId: z.string().min(1),
15
+ version: z.string().min(1),
16
+ name: z.string().min(1),
17
+ description: z.string().min(1).optional(),
18
+ sampleContent: z.boolean(),
19
+ // S293: the template's sample-content.json `description`, for the wizard's
20
+ // checkbox.
21
+ sampleContentDescription: InstallDescriptionSchema.optional(),
22
+ });
23
+ export const SetupStatusResponseSchema = z.object({
24
+ setupRequired: z.boolean(),
25
+ // Always present — [] outside setup mode (a fully-configured instance has
26
+ // nothing left to offer here) and whenever nothing bundled is resolvable,
27
+ // never omitted or null.
28
+ bundledTemplates: z.array(BundledTemplateSchema),
29
+ // True when DATABASE_URL was already set at boot, so the wizard is
30
+ // running in its admin-only mode and must not render a database step.
31
+ // See the BootMode type and resolveBootMode function in
32
+ // apps/server/src/boot/resolve-boot-mode.ts for the three states.
33
+ databaseConfigured: z.boolean(),
34
+ });
35
+ const SqliteSelectionSchema = z.object({
36
+ dialect: z.literal("sqlite"),
37
+ filePath: z.string().min(1),
38
+ });
39
+ const ServerDialectSelectionSchema = z.object({
40
+ dialect: z.enum(["postgresql", "mysql"]),
41
+ host: z.string().min(1),
42
+ port: z.coerce.number().int().positive(),
43
+ database: z.string().min(1),
44
+ username: z.string().min(1),
45
+ password: z.string(),
46
+ });
47
+ // The wizard's optional starter step (Session 151): which bundled template
48
+ // to install during setup completion. Absent entirely = skip, never null.
49
+ // S293: the starter's install answers (the wizard sends `sampleContent`), the
50
+ // same object every install door takes; strict, so a caller still sending
51
+ // `includeSampleContent` is refused rather than seeded by default.
52
+ export const SetupStarterSelectionSchema = z
53
+ .object({
54
+ pluginId: z.string().min(1),
55
+ answers: InstallAnswersSchema.optional(),
56
+ })
57
+ .strict();
58
+ export const SetupCompleteRequestSchema = z.object({
59
+ admin: z.object({
60
+ email: z.string().email(),
61
+ name: z.string().min(1),
62
+ password: z.string().min(8),
63
+ }),
64
+ // Optional because the wizard has two shapes. On a fresh instance it
65
+ // collects a database selection; when DATABASE_URL was already injected
66
+ // the database is configured and read-only, and the request carries the
67
+ // admin only. The ROUTE enforces the pairing in both directions —
68
+ // routes/setup.ts — because "optional" alone would let a caller silently
69
+ // send a selection that is ignored.
70
+ database: z
71
+ .discriminatedUnion("dialect", [
72
+ SqliteSelectionSchema,
73
+ ServerDialectSelectionSchema.extend({ dialect: z.literal("postgresql") }),
74
+ ServerDialectSelectionSchema.extend({ dialect: z.literal("mysql") }),
75
+ ])
76
+ .optional(),
77
+ starter: SetupStarterSelectionSchema.optional(),
78
+ });
79
+ // What happened to the requested starter. "failed" never fails setup
80
+ // itself — the admin account and database config always stand — so this
81
+ // rides alongside success: true rather than replacing it. `reason` is only
82
+ // present on failure.
83
+ export const SetupStarterResultSchema = z.object({
84
+ pluginId: z.string().min(1),
85
+ outcome: z.enum(["installed", "failed"]),
86
+ reason: z.string().min(1).optional(),
87
+ // S277e: what the install did with the starter's sample content, when
88
+ // sample content was asked for and the starter ships some. The starter
89
+ // counts as installed whatever this says.
90
+ sampleContent: SampleContentOutcomeSchema.optional(),
91
+ // S293: what the install did with each offered role its answers named;
92
+ // absent when they named none.
93
+ roles: z.array(InstallRoleOutcomeSchema).optional(),
94
+ });
95
+ export const SetupCompleteResponseSchema = z.object({
96
+ success: z.literal(true),
97
+ // ABSENT (not null) when no starter was requested — the skip-path
98
+ // response stays byte-identical to the pre-starter shape.
99
+ starter: SetupStarterResultSchema.optional(),
100
+ // ABSENT unless setup completed but could not write its configuration
101
+ // to disk. Setup itself still succeeded — the admin account and the
102
+ // provisioned database stand — so this rides alongside success: true
103
+ // rather than replacing it, exactly as `starter` does.
104
+ configWarning: z.string().min(1).optional(),
105
+ });