@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,269 @@
1
+ import { z } from "zod";
2
+ import { PluginActionDeclarationSchema, PluginRoleOfferSchema } from "./plugin-actions.schema.js";
3
+ import { MANIFEST_ID_SEGMENT_MAX, PLUGIN_ID_REGEX, isPluginManifestId } from "./plugin-id-rules.js";
4
+ import { SampleContentOutcomeSchema } from "./sample-content-outcome.schema.js";
5
+ import { InstallAnswersSchema, InstallInterfaceWireSchema } from "./plugin-install.js";
6
+ import { InstallRoleOutcomeSchema } from "./plugin-install-record.schema.js";
7
+ // S268 Task 5: one derived capability, the wire form of the SDK's
8
+ // `Capability` (packages/plugin-sdk/src/capabilities.ts, which the
9
+ // marketplace computes at ingest). Deliberately NOT imported from there:
10
+ // api-schemas must never depend on the plugin SDK, because the manifest
11
+ // contract carries React and this package is imported by everything.
12
+ //
13
+ // `id` stays an open string rather than an enum of the ids the SDK mints
14
+ // today. A CMS and the marketplace it talks to are independently
15
+ // deployed and independently versioned, so a marketplace that has
16
+ // learned a new capability would otherwise fail response validation at
17
+ // an older admin and blank the whole screen, instead of rendering one
18
+ // row the admin has no label for. The install screen prints an unlabelled
19
+ // id raw for the same reason: drift should be visible, not fatal.
20
+ export const MarketplaceCapabilitySchema = z.object({
21
+ id: z.string(),
22
+ mediation: z.enum(["mediated", "promised"]),
23
+ payload: z.object({ count: z.number().int(), details: z.array(z.string()) }),
24
+ });
25
+ export const MarketplaceListingVersionSchema = z.object({
26
+ version: z.string(),
27
+ supportedDialects: z.array(z.string()),
28
+ // What this version can do, derived by the marketplace at ingest from
29
+ // the manifest's contributions, assertions and storage declaration,
30
+ // never self-declared beside them (S267 section 3). This one list is
31
+ // what the install screen renders as consent items; the same list is
32
+ // what review reads to decide whether a submission needs a person.
33
+ // It replaced the `{ assertions, structuredStorage }` pair, and the
34
+ // three `needsX` booleans before that.
35
+ capabilities: z.array(MarketplaceCapabilitySchema),
36
+ // S273: what installing this version adds to the permission surface, and
37
+ // the roles it offers; both snapshotted at ingest from manifest.json.
38
+ // Optional because a marketplace that predates this session answers
39
+ // without them.
40
+ actions: z.array(PluginActionDeclarationSchema).optional(),
41
+ roleOffers: z.array(PluginRoleOfferSchema).optional(),
42
+ license: z.string(),
43
+ cmsVersion: z.string(),
44
+ verified: z.boolean(),
45
+ createdAt: z.string(),
46
+ // F4: some listings legitimately have no downloadable artifact yet
47
+ // (e.g. "available at launch" placeholders) — the marketplace's public
48
+ // portal disables its own Download button for exactly this case. The
49
+ // admin-facing listing API had no way to say so, so the admin marketplace
50
+ // browser rendered an enabled Install button and only found out from the
51
+ // raw 404 the server threw back. Derived server-side from
52
+ // `artifactPath != null` (mirrors MarketplaceStarterSchema.hasArchive
53
+ // just below), never guessed client-side.
54
+ hasArtifact: z.boolean(),
55
+ });
56
+ export const MarketplaceListingSchema = z.object({
57
+ pluginId: z.string(),
58
+ name: z.string(),
59
+ type: z.string(),
60
+ description: z.string(),
61
+ author: z.string(),
62
+ priceCents: z.number().int(),
63
+ coverImagePath: z.string().nullable(),
64
+ latestVersion: MarketplaceListingVersionSchema.nullable(),
65
+ // Computed SERVER-SIDE against this CMS's active dialect — the admin
66
+ // client never guesses compatibility from raw dialect lists.
67
+ compatible: z.boolean(),
68
+ // S304-94: whether this CMS satisfies the latest version's cmsVersion range,
69
+ // decided server-side with the running version. A newer version that fails
70
+ // it is not offered as an update; a fresh install is not gated by it.
71
+ cmsCompatible: z.boolean(),
72
+ // S274c: the version installed on THIS CMS, or null when the listing is not
73
+ // installed. Looked up server-side from the registry, never guessed client-side.
74
+ installedVersion: z.string().nullable(),
75
+ // S274c, S294 (2026-10-14-s294-update-available-design.md 3.2): true only
76
+ // when this site can take the listing as an update, decided server-side by
77
+ // the rule the installed list's badge uses too: the plugin is installed and
78
+ // is not a bundle, and the listing's latest published version is strictly
79
+ // newer by semver, has a package to download and supports this site's
80
+ // database. A newer or unreadable installed version is never an "update".
81
+ updateAvailable: z.boolean(),
82
+ });
83
+ // S148: a starter frontend the marketplace hosts as a versioned archive
84
+ // (Global Constraints — a bundledTemplate WITHOUT an archive stays legal,
85
+ // hence hasArchive rather than always assuming a download exists) and the
86
+ // document types a template/section listing provisions on install. Both
87
+ // are projected server-side by the marketplace (starter-projection.ts) and
88
+ // only ever appear on the DETAIL surface, never on browse — see
89
+ // MarketplaceListingDetailVersionSchema below.
90
+ export const MarketplaceStarterSchema = z.object({
91
+ name: z.string(),
92
+ description: z.string().nullable(),
93
+ repository: z.string().nullable(),
94
+ hasArchive: z.boolean(),
95
+ });
96
+ export const MarketplaceDocumentTypeSummarySchema = z.object({
97
+ name: z.string(),
98
+ fields: z.array(z.string()),
99
+ });
100
+ // S153: a bundle's enriched member projection — snapshotted at ingest by
101
+ // the marketplace (bundle-members.ts), detail-only like the S148 starter
102
+ // fields (same extend-don't-widen browse protection below).
103
+ export const MarketplaceBundleMemberSchema = z.object({
104
+ pluginId: z.string(),
105
+ name: z.string(),
106
+ description: z.string().nullable(),
107
+ type: z.string(),
108
+ priceCents: z.number().int(),
109
+ });
110
+ // Extends the base version shape rather than widening it: browse
111
+ // (MarketplaceListingSchema.latestVersion, MarketplaceListResponseSchema)
112
+ // keeps using MarketplaceListingVersionSchema untouched, so starter/
113
+ // documentTypesSummary can never leak onto the browse screen even though
114
+ // the upstream marketplace's JSON carries them on every version row.
115
+ export const MarketplaceListingDetailVersionSchema = MarketplaceListingVersionSchema.extend({
116
+ starter: MarketplaceStarterSchema.nullable().optional(),
117
+ documentTypesSummary: z.array(MarketplaceDocumentTypeSummarySchema).nullable().optional(),
118
+ bundledMembers: z.array(MarketplaceBundleMemberSchema).nullable().optional(),
119
+ // S210: the package's own README, rendered by @kardalum/markdown in the
120
+ // admin's detail view. Detail-only for the same reason as starter above —
121
+ // extending rather than widening is what keeps it off the browse screen,
122
+ // where the browse handler's response validation strips it back off.
123
+ readme: z.string().nullable().optional(),
124
+ // S292: what the install asks, derived by the marketplace at ingest.
125
+ // Detail-only, like readme, so it never reaches the browse screen; null for
126
+ // a version ingested before S292. Read through InstallInterfaceWireSchema,
127
+ // which drops a key a newer marketplace adds instead of refusing it, so an
128
+ // older CMS still answers with the listing.
129
+ installInterface: InstallInterfaceWireSchema.nullable().optional(),
130
+ });
131
+ export const MarketplaceListingDetailSchema = MarketplaceListingSchema.extend({
132
+ latestVersion: MarketplaceListingDetailVersionSchema.nullable(),
133
+ versions: z.array(MarketplaceListingDetailVersionSchema),
134
+ activeDialect: z.string(),
135
+ marketplaceBaseUrl: z.string(),
136
+ });
137
+ // S288g Task 0: the marketplace's OWN listing API (GET /api/v1/listings and
138
+ // GET /api/v1/listings/:pluginId, upstream of a CMS's proxy) carries the
139
+ // origin a browser reaches the marketplace at, from its MARKETPLACE_BASE_URL
140
+ // with no trailing slash. A CMS may dial the marketplace somewhere a browser
141
+ // cannot (the demo's server calls a loopback on purpose), so the proxy hands
142
+ // the admin this value as `marketplaceBaseUrl` for covers, buy links and
143
+ // downloads, and keeps its configured URL for its own requests. http and
144
+ // https only, because the admin puts it straight into src and href.
145
+ export const MarketplacePublicBaseSchema = z.object({
146
+ publicBaseUrl: z.url({ protocol: /^https?$/ }),
147
+ });
148
+ export const MarketplaceListQuerySchema = z.object({
149
+ q: z.string().optional(),
150
+ type: z.string().optional(),
151
+ db: z.string().optional(),
152
+ cursor: z.string().uuid().optional(),
153
+ limit: z.coerce.number().int().min(1).max(50).default(24),
154
+ });
155
+ export const MarketplaceListResponseSchema = z.object({
156
+ items: z.array(MarketplaceListingSchema),
157
+ nextCursor: z.string().nullable(),
158
+ activeDialect: z.string(),
159
+ marketplaceBaseUrl: z.string(),
160
+ });
161
+ /** S294 (2026-10-14-s294-update-available-design.md 3.1): the most plugin ids
162
+ * one GET /api/v1/listings/versions request names. */
163
+ export const MARKETPLACE_VERSIONS_MAX_IDS = 50;
164
+ /** The longest `ids` value that route reads before splitting it. A manifest id
165
+ * has no length cap of its own, so a long enough id could make fifty overrun
166
+ * this; the CMS's client therefore sends no id longer than 199 characters,
167
+ * so that fifty of them and their 49 commas (9,999 characters) always fit. */
168
+ export const MARKETPLACE_VERSIONS_IDS_MAX_LENGTH = 10_000;
169
+ /** What a CMS decides an update with: a listing's latest published version,
170
+ * reduced to four facts. */
171
+ export const MarketplaceLatestVersionSchema = MarketplaceListingVersionSchema.pick({
172
+ version: true,
173
+ cmsVersion: true,
174
+ supportedDialects: true,
175
+ hasArtifact: true,
176
+ });
177
+ /** One item per published listing among the ids asked, in the order asked; an
178
+ * id with no published version is absent. Not strict: a key a newer
179
+ * marketplace adds is dropped, never fatal. */
180
+ export const MarketplaceVersionsResponseSchema = z.object({
181
+ items: z
182
+ .array(z.object({ pluginId: z.string(), latestVersion: MarketplaceLatestVersionSchema }))
183
+ .max(MARKETPLACE_VERSIONS_MAX_IDS),
184
+ });
185
+ /** The route's `ids` value, by the table in 3.1: capped before it is split,
186
+ * each entry checked with isPluginManifestId, a repeat answered once, in the
187
+ * place it first appears. The value is untrusted, so the order bounds the
188
+ * cost: the length cap comes before the split and the entry cap before any
189
+ * entry is checked, so the one pattern that runs (isPluginManifestId's, which
190
+ * the install door already applies to untrusted ids) sees at most
191
+ * MARKETPLACE_VERSIONS_MAX_IDS entries and MARKETPLACE_VERSIONS_IDS_MAX_LENGTH
192
+ * characters in all. Both caps count what was sent, before repeats collapse.
193
+ * Nothing is trimmed: a space or an empty entry is a bad id. */
194
+ export function parseMarketplaceVersionsIds(raw) {
195
+ if (raw === null || raw === "") {
196
+ return { ok: false, error: `ids is required: 1 to ${MARKETPLACE_VERSIONS_MAX_IDS} comma-separated plugin ids` };
197
+ }
198
+ if (raw.length > MARKETPLACE_VERSIONS_IDS_MAX_LENGTH) {
199
+ return { ok: false, error: `ids is longer than ${MARKETPLACE_VERSIONS_IDS_MAX_LENGTH} characters` };
200
+ }
201
+ const entries = raw.split(",");
202
+ if (entries.length > MARKETPLACE_VERSIONS_MAX_IDS) {
203
+ return { ok: false, error: `ids names more than ${MARKETPLACE_VERSIONS_MAX_IDS} plugin ids` };
204
+ }
205
+ if (!entries.every((entry) => isPluginManifestId(entry))) {
206
+ return { ok: false, error: "every entry in ids must be a plugin id such as com.example.plugin" };
207
+ }
208
+ return { ok: true, ids: [...new Set(entries)] };
209
+ }
210
+ export const MarketplacePluginIdParamsSchema = z.object({ pluginId: z.string().min(1) });
211
+ // Path-safety gate: pluginId reaches removePluginPackages, which builds a
212
+ // path from it and does a recursive, forced rmSync. Without this, a bare
213
+ // `z.string().min(1)` would let a traversal-shaped id (`"../../etc"`) all the
214
+ // way to that filesystem call. Since S283 it is the manifest validator's own
215
+ // rule (PLUGIN_ID_REGEX and the segment cap), not a looser copy: a case
216
+ // variant such as "COM.KARDALUM.SEO" names another plugin's folder on a
217
+ // case-insensitive filesystem.
218
+ // S293: strict, so a misspelt `answers` is refused rather than dropped and the
219
+ // defaults installed.
220
+ export const MarketplaceInstallBodySchema = z
221
+ .object({
222
+ pluginId: z
223
+ .string()
224
+ .min(1)
225
+ .regex(PLUGIN_ID_REGEX, "pluginId must be a reverse-domain identifier (e.g. com.example.plugin): lowercase segments, each starting with a letter")
226
+ .refine((id) => id.split(".").length <= MANIFEST_ID_SEGMENT_MAX, `pluginId has at most ${MANIFEST_ID_SEGMENT_MAX} segments`),
227
+ version: z.string().min(1),
228
+ licenseKey: z.string().min(1).optional(),
229
+ answers: InstallAnswersSchema.optional(),
230
+ })
231
+ .strict();
232
+ // S152: a bundle install reports what its fan-out did per member —
233
+ // "installed" (this operation installed it, ownership recorded) or
234
+ // "already-installed" (pre-existing, skipped, never claimed). Optional
235
+ // and absent for every non-bundle install, so single-plugin clients are
236
+ // untouched.
237
+ export const MarketplaceInstallMemberSchema = z.object({
238
+ pluginId: z.string(),
239
+ version: z.string(),
240
+ outcome: z.enum(["installed", "already-installed"]),
241
+ });
242
+ // trustTier is a literal, not the broader TrustTier union — this door
243
+ // (S138) only ever answers 201 for a "verified" result; a non-"verified"
244
+ // verdict is a 422 failure response (ApiErrorSchema), never this shape.
245
+ export const MarketplaceInstallResponseSchema = z.object({
246
+ pluginId: z.string(),
247
+ version: z.string(),
248
+ trustTier: z.literal("verified"),
249
+ licensed: z.boolean(),
250
+ // S274c: "updated" when a newer version replaced an installed one in place.
251
+ outcome: z.enum(["installed", "updated"]),
252
+ fromVersion: z.string().nullable(),
253
+ members: z.array(MarketplaceInstallMemberSchema).optional(),
254
+ // S277e: what the install did with the plugin's own sample content.
255
+ // Absent for an update and for a plugin that ships none.
256
+ sampleContent: SampleContentOutcomeSchema.optional(),
257
+ // S293: what the install did with each offered role its answers named;
258
+ // absent when they named none.
259
+ roles: z.array(InstallRoleOutcomeSchema).optional(),
260
+ });
261
+ /** The 409 a marketplace install or update answers. `reason` is present
262
+ * only for "license-not-recorded" (S284, D4): the plugin IS installed (or
263
+ * updated), and only its licence row is another request's, so a client
264
+ * refreshes its installed state rather than offering Install again. Every
265
+ * other 409 carries `message` alone. */
266
+ export const MarketplaceInstallConflictSchema = z.object({
267
+ message: z.string(),
268
+ reason: z.literal("license-not-recorded").optional(),
269
+ });
@@ -0,0 +1,177 @@
1
+ import { z } from "zod";
2
+ export declare const CreateMediaFolderRequestSchema: z.ZodObject<{
3
+ name: z.ZodString;
4
+ parentId: z.ZodOptional<z.ZodString>;
5
+ }, z.core.$strip>;
6
+ export type CreateMediaFolderRequest = z.infer<typeof CreateMediaFolderRequestSchema>;
7
+ export declare const UpdateMediaFolderRequestSchema: z.ZodObject<{
8
+ name: z.ZodOptional<z.ZodString>;
9
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
10
+ }, z.core.$strip>;
11
+ export type UpdateMediaFolderRequest = z.infer<typeof UpdateMediaFolderRequestSchema>;
12
+ /** The most items one page of a media folder, version or rendition list holds, and the default (S300b). */
13
+ export declare const MEDIA_NESTED_LIST_PAGE_MAX = 200;
14
+ export declare const MediaNestedListQuerySchema: z.ZodObject<{
15
+ cursor: z.ZodOptional<z.ZodString>;
16
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
17
+ }, z.core.$strip>;
18
+ export type MediaNestedListQuery = z.infer<typeof MediaNestedListQuerySchema>;
19
+ export declare const MediaFolderListResponseSchema: z.ZodObject<{
20
+ folders: z.ZodArray<z.ZodObject<{
21
+ id: z.ZodString;
22
+ name: z.ZodString;
23
+ parentId: z.ZodNullable<z.ZodString>;
24
+ createdAt: z.ZodString;
25
+ }, z.core.$strip>>;
26
+ nextCursor: z.ZodNullable<z.ZodString>;
27
+ }, z.core.$strip>;
28
+ export type MediaFolderListResponse = z.infer<typeof MediaFolderListResponseSchema>;
29
+ export declare const MediaFileResponseSchema: z.ZodObject<{
30
+ id: z.ZodString;
31
+ filename: z.ZodString;
32
+ mimeType: z.ZodString;
33
+ size: z.ZodNumber;
34
+ url: z.ZodString;
35
+ visibility: z.ZodEnum<{
36
+ public: "public";
37
+ private: "private";
38
+ }>;
39
+ folderId: z.ZodNullable<z.ZodString>;
40
+ uploadedBy: z.ZodString;
41
+ uploadedAt: z.ZodString;
42
+ documentTypeId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
43
+ data: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<Record<string, unknown>, Record<string, unknown> | null | undefined>>;
44
+ currentVersion: z.ZodDefault<z.ZodNumber>;
45
+ hasRendition: z.ZodOptional<z.ZodBoolean>;
46
+ deletedAt: z.ZodDefault<z.ZodNullable<z.ZodString>>;
47
+ downloadUrl: z.ZodString;
48
+ }, z.core.$strip>;
49
+ export type MediaFileResponse = z.infer<typeof MediaFileResponseSchema>;
50
+ export declare const MediaLinkResponseSchema: z.ZodObject<{
51
+ url: z.ZodString;
52
+ expiresAt: z.ZodString;
53
+ }, z.core.$strip>;
54
+ export type MediaLinkResponse = z.infer<typeof MediaLinkResponseSchema>;
55
+ export declare const MediaDeleteResponseSchema: z.ZodObject<{
56
+ success: z.ZodLiteral<true>;
57
+ }, z.core.$strip>;
58
+ export type MediaDeleteResponse = z.infer<typeof MediaDeleteResponseSchema>;
59
+ export declare const UpdateMediaRequestSchema: z.ZodObject<{
60
+ visibility: z.ZodOptional<z.ZodEnum<{
61
+ public: "public";
62
+ private: "private";
63
+ }>>;
64
+ folderId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
65
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
66
+ }, z.core.$strip>;
67
+ export type UpdateMediaRequest = z.infer<typeof UpdateMediaRequestSchema>;
68
+ export declare const MediaListQuerySchema: z.ZodObject<{
69
+ cursor: z.ZodOptional<z.ZodString>;
70
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
71
+ search: z.ZodOptional<z.ZodString>;
72
+ folderId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"root">]>>;
73
+ rendition: z.ZodOptional<z.ZodString>;
74
+ }, z.core.$strip>;
75
+ export type MediaListQuery = z.infer<typeof MediaListQuerySchema>;
76
+ export declare const MediaListResponseSchema: z.ZodObject<{
77
+ items: z.ZodArray<z.ZodObject<{
78
+ id: z.ZodString;
79
+ filename: z.ZodString;
80
+ mimeType: z.ZodString;
81
+ size: z.ZodNumber;
82
+ url: z.ZodString;
83
+ visibility: z.ZodEnum<{
84
+ public: "public";
85
+ private: "private";
86
+ }>;
87
+ folderId: z.ZodNullable<z.ZodString>;
88
+ uploadedBy: z.ZodString;
89
+ uploadedAt: z.ZodString;
90
+ documentTypeId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
91
+ data: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<Record<string, unknown>, Record<string, unknown> | null | undefined>>;
92
+ currentVersion: z.ZodDefault<z.ZodNumber>;
93
+ hasRendition: z.ZodOptional<z.ZodBoolean>;
94
+ deletedAt: z.ZodDefault<z.ZodNullable<z.ZodString>>;
95
+ downloadUrl: z.ZodString;
96
+ }, z.core.$strip>>;
97
+ nextCursor: z.ZodNullable<z.ZodString>;
98
+ }, z.core.$strip>;
99
+ export type MediaListResponse = z.infer<typeof MediaListResponseSchema>;
100
+ export declare const MediaVersionListResponseSchema: z.ZodObject<{
101
+ items: z.ZodArray<z.ZodObject<{
102
+ id: z.ZodString;
103
+ mediaFileId: z.ZodString;
104
+ version: z.ZodNumber;
105
+ filename: z.ZodString;
106
+ mimeType: z.ZodString;
107
+ size: z.ZodNumber;
108
+ width: z.ZodNullable<z.ZodNumber>;
109
+ height: z.ZodNullable<z.ZodNumber>;
110
+ createdAt: z.ZodString;
111
+ createdBy: z.ZodString;
112
+ createdByName: z.ZodNullable<z.ZodString>;
113
+ }, z.core.$strip>>;
114
+ currentVersion: z.ZodNumber;
115
+ nextCursor: z.ZodNullable<z.ZodString>;
116
+ }, z.core.$strip>;
117
+ export type MediaVersionListResponse = z.infer<typeof MediaVersionListResponseSchema>;
118
+ export declare const MediaRenditionListResponseSchema: z.ZodObject<{
119
+ items: z.ZodArray<z.ZodObject<{
120
+ id: z.ZodString;
121
+ mediaVersionId: z.ZodString;
122
+ name: z.ZodString;
123
+ filename: z.ZodString;
124
+ mimeType: z.ZodString;
125
+ size: z.ZodNumber;
126
+ width: z.ZodNumber;
127
+ height: z.ZodNumber;
128
+ rect: z.ZodObject<{
129
+ x: z.ZodNumber;
130
+ y: z.ZodNumber;
131
+ w: z.ZodNumber;
132
+ h: z.ZodNumber;
133
+ }, z.core.$strip>;
134
+ createdAt: z.ZodString;
135
+ }, z.core.$strip>>;
136
+ currentVersion: z.ZodNumber;
137
+ nextCursor: z.ZodNullable<z.ZodString>;
138
+ }, z.core.$strip>;
139
+ export type MediaRenditionListResponse = z.infer<typeof MediaRenditionListResponseSchema>;
140
+ export declare const MediaTrashListQuerySchema: z.ZodObject<{
141
+ cursor: z.ZodOptional<z.ZodString>;
142
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
143
+ }, z.core.$strip>;
144
+ export type MediaTrashListQuery = z.infer<typeof MediaTrashListQuerySchema>;
145
+ export declare const MediaTrashListResponseSchema: z.ZodObject<{
146
+ items: z.ZodArray<z.ZodObject<{
147
+ id: z.ZodString;
148
+ filename: z.ZodString;
149
+ mimeType: z.ZodString;
150
+ size: z.ZodNumber;
151
+ url: z.ZodString;
152
+ visibility: z.ZodEnum<{
153
+ public: "public";
154
+ private: "private";
155
+ }>;
156
+ folderId: z.ZodNullable<z.ZodString>;
157
+ uploadedBy: z.ZodString;
158
+ uploadedAt: z.ZodString;
159
+ documentTypeId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
160
+ data: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<Record<string, unknown>, Record<string, unknown> | null | undefined>>;
161
+ currentVersion: z.ZodDefault<z.ZodNumber>;
162
+ hasRendition: z.ZodOptional<z.ZodBoolean>;
163
+ deletedAt: z.ZodDefault<z.ZodNullable<z.ZodString>>;
164
+ }, z.core.$strip>>;
165
+ nextCursor: z.ZodNullable<z.ZodString>;
166
+ }, z.core.$strip>;
167
+ export type MediaTrashListResponse = z.infer<typeof MediaTrashListResponseSchema>;
168
+ export declare const MediaReadQuerySchema: z.ZodObject<{
169
+ includeTrashed: z.ZodPipe<z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"true">, z.ZodLiteral<"false">, z.ZodBoolean]>>, z.ZodTransform<boolean, boolean | "true" | "false">>;
170
+ }, z.core.$strip>;
171
+ export type MediaReadQuery = z.infer<typeof MediaReadQuerySchema>;
172
+ export declare const MediaEmptyTrashResponseSchema: z.ZodObject<{
173
+ destroyed: z.ZodNumber;
174
+ failed: z.ZodNumber;
175
+ truncated: z.ZodBoolean;
176
+ }, z.core.$strip>;
177
+ export type MediaEmptyTrashResponse = z.infer<typeof MediaEmptyTrashResponseSchema>;
@@ -0,0 +1,222 @@
1
+ import { z } from "zod";
2
+ import { MediaFileSchema, MediaFolderSchema, MediaVersionSchema, MediaVisibilitySchema } from "./media.schema.js";
3
+ import { MediaRenditionSchema } from "./media-rendition.schema.js";
4
+ // POST /api/manage/v1/media/folders body (S186e §2): name required, parentId
5
+ // optional (omitted/undefined = create at the library root). Duplicate
6
+ // name under the same parent -> 409, enforced by a real database
7
+ // constraint as of the fix wave (HIGH-1 — see media-service.ts's
8
+ // MediaFolderNameConflictError doc comment and schema.prisma's
9
+ // MediaFolder comment), surfaced through the service, not validated
10
+ // here.
11
+ export const CreateMediaFolderRequestSchema = z.object({
12
+ name: z.string().min(1),
13
+ parentId: z.string().uuid().optional(),
14
+ });
15
+ // PATCH /api/manage/v1/media/folders/:id body (S186e §2): rename and/or move, both
16
+ // optional and independent. name absent = don't rename. parentId absent =
17
+ // don't move; null = move to the library root; a uuid = move under that
18
+ // folder. The cycle-guard (a folder cannot move under its own descendant)
19
+ // and the depth cap are enforced in the service, not here. `.refine`
20
+ // restores a 400 on a body with NEITHER field present (F5, final-review
21
+ // follow-up wave) — same reasoning and wording as UpdateMediaRequestSchema
22
+ // below's own `.refine`: an empty `{}` PATCH validates fine on its own and
23
+ // does nothing, which looks like a successful no-op update rather than
24
+ // the mistake it almost certainly is.
25
+ export const UpdateMediaFolderRequestSchema = z
26
+ .object({
27
+ name: z.string().min(1).optional(),
28
+ parentId: z.string().uuid().nullable().optional(),
29
+ })
30
+ .refine((body) => body.name !== undefined || body.parentId !== undefined, {
31
+ message: "At least one of name or parentId must be present",
32
+ });
33
+ /** The most items one page of a media folder, version or rendition list holds, and the default (S300b). */
34
+ export const MEDIA_NESTED_LIST_PAGE_MAX = 200;
35
+ // The query of the three lists that used to be unpaginated: GET /api/manage/v1/media/folders,
36
+ // /api/manage/v1/media/:id/versions and /api/manage/v1/media/:id/renditions. The cursor is the `id`
37
+ // of the previous page's last item, the idiom of GET /api/manage/v1/media.
38
+ export const MediaNestedListQuerySchema = z.object({
39
+ cursor: z.string().uuid().optional(),
40
+ limit: z.coerce.number().int().min(1).max(MEDIA_NESTED_LIST_PAGE_MAX).default(MEDIA_NESTED_LIST_PAGE_MAX),
41
+ });
42
+ // GET /api/manage/v1/media/folders (S186e §2, paged by S300b): the tree as a FLAT array of
43
+ // MediaFolderSchema, `limit` folders at a time (default and maximum
44
+ // MEDIA_NESTED_LIST_PAGE_MAX), ordered by name and then id, with the cursor of
45
+ // the next page. Flat rather than nested: the client groups by `parentId`
46
+ // itself, and a server-assembled tree could not be paged. A folder whose
47
+ // parentId dangles (binding obligation 4 of the S186e Task 1 review) is reported
48
+ // with `parentId: null`, so it renders as a root folder instead of vanishing
49
+ // from the client's grouping; a folder whose parent sits on another page keeps
50
+ // its parentId. The tree's total size is not bounded by the depth cap or the
51
+ // per-parent sibling limit (they bound one branch and one parent), which is why
52
+ // this list is paged.
53
+ export const MediaFolderListResponseSchema = z.object({
54
+ folders: z.array(MediaFolderSchema),
55
+ // null = no more pages.
56
+ nextCursor: z.string().uuid().nullable(),
57
+ });
58
+ // downloadUrl is the stable app path (S186c §3), computed fresh each
59
+ // response rather than trusted from storage: for a PUBLIC item it's
60
+ // identical to the persisted `url` field (permanent, no query string);
61
+ // for a PRIVATE item it's that same path plus a freshly minted,
62
+ // short-lived `?token=` (S186c §3's signed media link) — a new one every
63
+ // response, so this value is for immediate use (rendering an `<img src>`
64
+ // now), not for persisting.
65
+ export const MediaFileResponseSchema = MediaFileSchema.extend({
66
+ downloadUrl: z.string().min(1),
67
+ });
68
+ // POST /api/manage/v1/media/:id/link response (S186c §3): the admin's "Copy
69
+ // temporary link" mint: a signed `?token=` URL good until `expiresAt`.
70
+ // Same stable path as `downloadUrl`, just minted on demand rather than
71
+ // alongside every list/get response.
72
+ export const MediaLinkResponseSchema = z.object({
73
+ url: z.string().min(1),
74
+ expiresAt: z.string().datetime(),
75
+ });
76
+ export const MediaDeleteResponseSchema = z.object({
77
+ success: z.literal(true),
78
+ });
79
+ // PATCH /api/manage/v1/media/:id body (S186c §2, folderId added S186e §2; renamed
80
+ // from UpdateMediaVisibilityRequestSchema in the fix wave — it carries
81
+ // both visibility and folderId now, not just visibility, and the old
82
+ // name stopped describing it). Both fields optional and independent, same
83
+ // "absent = don't touch" idiom as UpdateMediaFolderRequestSchema above:
84
+ // visibility absent = don't flip it; folderId absent = don't move the
85
+ // file; folderId null = move to the library root; folderId a uuid = move
86
+ // under that folder (the service validates the folder exists first —
87
+ // binding obligation 2 from the S186e Task 1 review — rather than letting
88
+ // a bad id 500 out of the FK). `.refine` restores a 400 on a body with
89
+ // NEITHER field present: back when this schema only carried visibility
90
+ // (required, S186c), an empty body already 400'd for free; making both
91
+ // fields optional independently (S186e) silently dropped that — an empty
92
+ // `{}` PATCH validated fine and did nothing. This puts it back explicitly
93
+ // rather than leaving a request that changes nothing looking like a
94
+ // successful update.
95
+ //
96
+ // S234a Task 5 adds a third, `data`: the media document type's field
97
+ // values, validated against that type by the service. Same "absent =
98
+ // don't touch" idiom as the other two, but note what PRESENT means for
99
+ // this one: it REPLACES the item's bag rather than merging into it, the
100
+ // same way a content save replaces a version's data. The form that sends
101
+ // it renders every field the type declares, so a key it leaves out is a
102
+ // key the person cleared. `.record(z.string(), z.unknown())` is the same
103
+ // shape content's own save body uses: what a value is allowed to be is
104
+ // the field's data type's business, judged by the service, not something
105
+ // this schema can second-guess.
106
+ //
107
+ // One documented exception to "a key left out is a key cleared": the
108
+ // `private` field alias inside `data` (MEDIA_PRIVATE_ALIAS). Every other
109
+ // key in the bag lives in the bag, so omitting it clears it. Privacy does
110
+ // not live in the bag at all, it lives in the `visibility` column, which
111
+ // stays the one source of truth; the alias only exists so a form can
112
+ // render and edit it. A `data` that never mentions the alias has said
113
+ // nothing about that column, so the column keeps whatever it already had
114
+ // rather than being cleared to a default. Unticking the privacy toggle is
115
+ // sending the alias as `false`, exactly like any other field a form
116
+ // clears. See MediaService.updateItem's own doc comment for the full
117
+ // reasoning; this note exists because Tasks 6 and 7 read this schema
118
+ // rather than the service.
119
+ export const UpdateMediaRequestSchema = z
120
+ .object({
121
+ visibility: MediaVisibilitySchema.optional(),
122
+ folderId: z.string().uuid().nullable().optional(),
123
+ data: z.record(z.string(), z.unknown()).optional(),
124
+ })
125
+ .refine((body) => body.visibility !== undefined || body.folderId !== undefined || body.data !== undefined, { message: "At least one of visibility, folderId or data must be present" });
126
+ // GET /api/manage/v1/media: newest-first pages; cursor = id of the previous
127
+ // page's last item. `search` filters by filename substring,
128
+ // case-insensitive. `folderId` (S186e §2) is a folder filter: ABSENT
129
+ // keeps the pre-S186e all-files behavior (compatibility-pinned by a
130
+ // dedicated test — existing callers must see no change), "root" matches
131
+ // files with no folder AND files whose folderId dangles (binding
132
+ // obligation 3 from the S186e Task 1 review — a damaged folderId must
133
+ // resurface at root, never vanish), a uuid matches exactly that folder.
134
+ export const MediaListQuerySchema = z.object({
135
+ cursor: z.string().uuid().optional(),
136
+ limit: z.coerce.number().int().min(1).max(100).default(24),
137
+ search: z.string().min(1).optional(),
138
+ folderId: z.union([z.string().uuid(), z.literal("root")]).optional(),
139
+ // S234d. A rendition NAME, as `renditionName` produces it ("3x4",
140
+ // "thumb"), which is the same value an image field's `rendition`
141
+ // setting holds (ImageSettingsSchema). Not a filter: the page still
142
+ // lists every item it would have listed without it. It asks a question,
143
+ // and each item answers through `hasRendition`, so the picker can show
144
+ // the whole library and mark which pictures the field can actually use
145
+ // rather than hiding the rest and leaving an editor wondering where
146
+ // their upload went. Absent asks nothing, which is what every caller
147
+ // before this did.
148
+ rendition: z.string().min(1).optional(),
149
+ });
150
+ export const MediaListResponseSchema = z.object({
151
+ items: z.array(MediaFileResponseSchema),
152
+ // null = no more pages.
153
+ nextCursor: z.string().uuid().nullable(),
154
+ });
155
+ // GET /api/manage/v1/media/:id/versions. Newest first, with the pointer beside them
156
+ // so a client never has to infer which row is live from the list order.
157
+ // Paged like the folder list (S300b).
158
+ export const MediaVersionListResponseSchema = z.object({
159
+ items: z.array(MediaVersionSchema),
160
+ currentVersion: z.number().int().positive(),
161
+ // null = no more pages.
162
+ nextCursor: z.string().uuid().nullable(),
163
+ });
164
+ // GET /api/manage/v1/media/:id/renditions. The renditions of the CURRENT version
165
+ // only, with the pointer beside them so a client never infers which
166
+ // version these belong to. Paged like the folder list (S300b).
167
+ export const MediaRenditionListResponseSchema = z.object({
168
+ items: z.array(MediaRenditionSchema),
169
+ currentVersion: z.number().int().positive(),
170
+ // null = no more pages.
171
+ nextCursor: z.string().uuid().nullable(),
172
+ });
173
+ // GET /api/manage/v1/media/trash (S234e). Newest-trashed first; cursor = id of the
174
+ // previous page's last item, the same cursor idiom the library list uses.
175
+ export const MediaTrashListQuerySchema = z.object({
176
+ cursor: z.string().uuid().optional(),
177
+ limit: z.coerce.number().int().min(1).max(100).default(24),
178
+ });
179
+ // Items are MediaFileSchema, NOT MediaFileResponseSchema, and the missing
180
+ // member is `downloadUrl`. That is deliberate rather than an omission: a
181
+ // trashed item does not serve, so a download URL would be a link that
182
+ // cannot work, and for a private item it would additionally mint a token
183
+ // per row for bytes nobody can fetch. The bin shows a filename and a
184
+ // date, not a preview.
185
+ export const MediaTrashListResponseSchema = z.object({
186
+ items: z.array(MediaFileSchema),
187
+ // null = no more pages.
188
+ nextCursor: z.string().uuid().nullable(),
189
+ });
190
+ // GET /api/manage/v1/media/:id query (S234e). The ONE way to read a trashed item
191
+ // through the API, and it has to be asked for: every other read, and this
192
+ // one without the flag, answers 404 for a trashed item so that a trashed
193
+ // file is not reachable by accident.
194
+ export const MediaReadQuerySchema = z.object({
195
+ // NOT z.coerce.boolean(). That is Boolean(value), and Boolean("false")
196
+ // is true, so `?includeTrashed=false` would turn the flag ON. A
197
+ // querystring only ever arrives as a string, and this is the one flag
198
+ // that keeps a trashed item unreachable unless a caller deliberately
199
+ // asks, so it reads only the two spellings it means: "true"/"false" or
200
+ // a real boolean. There is no catch-all in the union, so anything else
201
+ // (`?includeTrashed=garbage`) is a Zod error and a 400, deliberately: a
202
+ // malformed value for the one flag that keeps a trashed item unreachable
203
+ // should be refused, not guessed at.
204
+ includeTrashed: z
205
+ .union([z.literal("true"), z.literal("false"), z.boolean()])
206
+ .default(false)
207
+ .transform((value) => value === true || value === "true"),
208
+ });
209
+ // POST /api/manage/v1/media/trash/empty (S234e). Both numbers, always, because a
210
+ // purge deletes the row before the objects and can therefore half
211
+ // succeed. An endpoint that answered only `{ success: true }` would be
212
+ // claiming something it cannot know.
213
+ export const MediaEmptyTrashResponseSchema = z.object({
214
+ destroyed: z.number().int().nonnegative(),
215
+ failed: z.number().int().nonnegative(),
216
+ // True only when this pass stopped early at MediaService's
217
+ // EMPTY_TRASH_FAILURE_CAP rather than running out of trashed items to
218
+ // look at: the bin still holds items this pass never reached. A caller
219
+ // reading destroyed/failed alone has no way to tell "the bin is now
220
+ // accounted for" from "there is more in there and this pass gave up".
221
+ truncated: z.boolean(),
222
+ });