@kardalum/plugin-sdk 0.0.0-stage → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (312) hide show
  1. package/CHANGELOG.md +108 -0
  2. package/LICENSE +202 -0
  3. package/README.md +70 -2
  4. package/dist/admin-section-registry.d.ts +34 -0
  5. package/dist/admin-section-registry.js +49 -0
  6. package/dist/built-in-serializers.d.ts +3 -0
  7. package/dist/built-in-serializers.js +18 -0
  8. package/dist/built-in-settings-schemas.d.ts +14 -0
  9. package/dist/built-in-settings-schemas.js +225 -0
  10. package/dist/built-in-value-schemas.d.ts +4 -0
  11. package/dist/built-in-value-schemas.js +47 -0
  12. package/dist/built-ins.d.ts +1 -0
  13. package/dist/built-ins.js +257 -0
  14. package/dist/capabilities.d.ts +99 -0
  15. package/dist/capabilities.js +363 -0
  16. package/dist/data-type-plugin.d.ts +28 -0
  17. package/dist/data-type-plugin.js +1 -0
  18. package/dist/datatype-validation.d.ts +26 -0
  19. package/dist/datatype-validation.js +110 -0
  20. package/dist/datatypes-entry.d.ts +4 -0
  21. package/dist/datatypes-entry.js +18 -0
  22. package/dist/define-plugin.d.ts +25 -0
  23. package/dist/define-plugin.js +51 -0
  24. package/dist/entitlement-entry.d.ts +5 -0
  25. package/dist/entitlement-entry.js +24 -0
  26. package/dist/entitlement-gate.d.ts +36 -0
  27. package/dist/entitlement-gate.js +201 -0
  28. package/dist/entitlement-types.d.ts +39 -0
  29. package/dist/entitlement-types.js +1 -0
  30. package/dist/entitlement.d.ts +57 -0
  31. package/dist/entitlement.js +170 -0
  32. package/dist/host-entry.d.ts +1 -0
  33. package/dist/host-entry.js +11 -0
  34. package/dist/icon-name.d.ts +1 -0
  35. package/dist/icon-name.js +1 -0
  36. package/dist/icons.d.ts +2 -0
  37. package/dist/icons.js +10 -0
  38. package/dist/index.d.ts +28 -0
  39. package/dist/index.js +93 -0
  40. package/dist/license-verdict-keys.d.ts +18 -0
  41. package/dist/license-verdict-keys.js +22 -0
  42. package/dist/local-host.d.ts +3 -0
  43. package/dist/local-host.js +38 -0
  44. package/dist/manifest-entry.d.ts +8 -0
  45. package/dist/manifest-entry.js +13 -0
  46. package/dist/manifest-schema.d.ts +408 -0
  47. package/dist/manifest-schema.js +774 -0
  48. package/dist/manifest.d.ts +546 -0
  49. package/dist/manifest.js +86 -0
  50. package/dist/media/media-picker.d.ts +39 -0
  51. package/dist/media/media-picker.js +438 -0
  52. package/dist/media/upload-error.d.ts +12 -0
  53. package/dist/media/upload-error.js +30 -0
  54. package/dist/plugin-context.d.ts +75 -0
  55. package/dist/plugin-context.js +70 -0
  56. package/dist/plugin-screen-context.d.ts +40 -0
  57. package/dist/plugin-screen-context.js +16 -0
  58. package/dist/register-built-ins.d.ts +1 -0
  59. package/dist/register-built-ins.js +41 -0
  60. package/dist/registry.d.ts +4 -0
  61. package/dist/registry.js +17 -0
  62. package/dist/rendition-eligibility.d.ts +24 -0
  63. package/dist/rendition-eligibility.js +40 -0
  64. package/dist/richtext/block-panel.d.ts +27 -0
  65. package/dist/richtext/block-panel.js +232 -0
  66. package/dist/richtext/extensions.d.ts +19 -0
  67. package/dist/richtext/extensions.js +56 -0
  68. package/dist/richtext/insert-menu.d.ts +24 -0
  69. package/dist/richtext/insert-menu.js +142 -0
  70. package/dist/richtext/kardalum-block.d.ts +33 -0
  71. package/dist/richtext/kardalum-block.js +282 -0
  72. package/dist/richtext/style-listbox.d.ts +10 -0
  73. package/dist/richtext/style-listbox.js +69 -0
  74. package/dist/richtext/text-style-class.d.ts +18 -0
  75. package/dist/richtext/text-style-class.js +36 -0
  76. package/dist/simple-storage-value-provider.d.ts +9 -0
  77. package/dist/simple-storage-value-provider.js +96 -0
  78. package/dist/structured-storage-types.d.ts +61 -0
  79. package/dist/structured-storage-types.js +11 -0
  80. package/dist/tailwind.d.ts +1 -0
  81. package/dist/tailwind.js +5 -0
  82. package/dist/tokens/system-dark.css +75 -0
  83. package/dist/tokens/tokens.css +239 -0
  84. package/dist/tokens/tokens.json +212 -0
  85. package/dist/tokens.d.ts +1 -0
  86. package/dist/tokens.js +11 -0
  87. package/dist/ui-entry.d.ts +5 -0
  88. package/dist/ui-entry.js +42 -0
  89. package/dist/views/content-list-preview.d.ts +1 -0
  90. package/dist/views/content-list-preview.js +14 -0
  91. package/dist/views/content-list-settings-view.d.ts +1 -0
  92. package/dist/views/content-list-settings-view.js +97 -0
  93. package/dist/views/content-list-view.d.ts +19 -0
  94. package/dist/views/content-list-view.js +248 -0
  95. package/dist/views/crop-view.d.ts +55 -0
  96. package/dist/views/crop-view.js +161 -0
  97. package/dist/views/date-range-view.d.ts +6 -0
  98. package/dist/views/date-range-view.js +55 -0
  99. package/dist/views/file-upload-view.d.ts +43 -0
  100. package/dist/views/file-upload-view.js +104 -0
  101. package/dist/views/html-code-editor.d.ts +10 -0
  102. package/dist/views/html-code-editor.js +101 -0
  103. package/dist/views/html-view.d.ts +3 -0
  104. package/dist/views/html-view.js +53 -0
  105. package/dist/views/image-view.d.ts +3 -0
  106. package/dist/views/image-view.js +387 -0
  107. package/dist/views/rich-text-view.d.ts +2 -0
  108. package/dist/views/rich-text-view.js +429 -0
  109. package/node_modules/@kardalum/api-schemas/LICENSE +202 -0
  110. package/node_modules/@kardalum/api-schemas/README.md +56 -0
  111. package/node_modules/@kardalum/api-schemas/dist/action.schema.d.ts +30 -0
  112. package/node_modules/@kardalum/api-schemas/dist/action.schema.js +88 -0
  113. package/node_modules/@kardalum/api-schemas/dist/api-error.schema.d.ts +5 -0
  114. package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +6 -0
  115. package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +75 -0
  116. package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +36 -0
  117. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.d.ts +89 -0
  118. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +60 -0
  119. package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +24 -0
  120. package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +47 -0
  121. package/node_modules/@kardalum/api-schemas/dist/auth.schema.d.ts +38 -0
  122. package/node_modules/@kardalum/api-schemas/dist/auth.schema.js +38 -0
  123. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +537 -0
  124. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +353 -0
  125. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +158 -0
  126. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +139 -0
  127. package/node_modules/@kardalum/api-schemas/dist/content-path.d.ts +125 -0
  128. package/node_modules/@kardalum/api-schemas/dist/content-path.js +256 -0
  129. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.d.ts +20 -0
  130. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +23 -0
  131. package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.d.ts +151 -0
  132. package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +82 -0
  133. package/node_modules/@kardalum/api-schemas/dist/content-version.schema.d.ts +18 -0
  134. package/node_modules/@kardalum/api-schemas/dist/content-version.schema.js +22 -0
  135. package/node_modules/@kardalum/api-schemas/dist/content.schema.d.ts +17 -0
  136. package/node_modules/@kardalum/api-schemas/dist/content.schema.js +20 -0
  137. package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +302 -0
  138. package/node_modules/@kardalum/api-schemas/dist/core-actions.js +97 -0
  139. package/node_modules/@kardalum/api-schemas/dist/culture-direction.d.ts +1 -0
  140. package/node_modules/@kardalum/api-schemas/dist/culture-direction.js +9 -0
  141. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +36 -0
  142. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +32 -0
  143. package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.d.ts +9 -0
  144. package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +32 -0
  145. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +296 -0
  146. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +138 -0
  147. package/node_modules/@kardalum/api-schemas/dist/document-type.schema.d.ts +121 -0
  148. package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +147 -0
  149. package/node_modules/@kardalum/api-schemas/dist/health.schema.d.ts +6 -0
  150. package/node_modules/@kardalum/api-schemas/dist/health.schema.js +5 -0
  151. package/node_modules/@kardalum/api-schemas/dist/html-entities.d.ts +4 -0
  152. package/node_modules/@kardalum/api-schemas/dist/html-entities.js +250 -0
  153. package/node_modules/@kardalum/api-schemas/dist/index.d.ts +102 -0
  154. package/node_modules/@kardalum/api-schemas/dist/index.js +58 -0
  155. package/node_modules/@kardalum/api-schemas/dist/licensing.schema.d.ts +15 -0
  156. package/node_modules/@kardalum/api-schemas/dist/licensing.schema.js +14 -0
  157. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +381 -0
  158. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +197 -0
  159. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +167 -0
  160. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +214 -0
  161. package/node_modules/@kardalum/api-schemas/dist/media-reference-api.schema.d.ts +77 -0
  162. package/node_modules/@kardalum/api-schemas/dist/media-reference-api.schema.js +53 -0
  163. package/node_modules/@kardalum/api-schemas/dist/media-reference-use.d.ts +75 -0
  164. package/node_modules/@kardalum/api-schemas/dist/media-reference-use.js +117 -0
  165. package/node_modules/@kardalum/api-schemas/dist/media-reference.d.ts +27 -0
  166. package/node_modules/@kardalum/api-schemas/dist/media-reference.js +279 -0
  167. package/node_modules/@kardalum/api-schemas/dist/media-rendition.schema.d.ts +74 -0
  168. package/node_modules/@kardalum/api-schemas/dist/media-rendition.schema.js +157 -0
  169. package/node_modules/@kardalum/api-schemas/dist/media.schema.d.ts +80 -0
  170. package/node_modules/@kardalum/api-schemas/dist/media.schema.js +156 -0
  171. package/node_modules/@kardalum/api-schemas/dist/nav.schema.d.ts +23 -0
  172. package/node_modules/@kardalum/api-schemas/dist/nav.schema.js +55 -0
  173. package/node_modules/@kardalum/api-schemas/dist/node-access.schema.d.ts +846 -0
  174. package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +356 -0
  175. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +20 -0
  176. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +27 -0
  177. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +169 -0
  178. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +80 -0
  179. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-text.d.ts +65 -0
  180. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-text.js +889 -0
  181. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +89 -0
  182. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +134 -0
  183. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +31 -0
  184. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +38 -0
  185. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +369 -0
  186. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +393 -0
  187. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +22 -0
  188. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +87 -0
  189. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.d.ts +31 -0
  190. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +25 -0
  191. package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.d.ts +15 -0
  192. package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.js +24 -0
  193. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +306 -0
  194. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +328 -0
  195. package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +79 -0
  196. package/node_modules/@kardalum/api-schemas/dist/render-editing.js +50 -0
  197. package/node_modules/@kardalum/api-schemas/dist/render-settings-api.schema.d.ts +9 -0
  198. package/node_modules/@kardalum/api-schemas/dist/render-settings-api.schema.js +13 -0
  199. package/node_modules/@kardalum/api-schemas/dist/reserved-slugs.d.ts +2 -0
  200. package/node_modules/@kardalum/api-schemas/dist/reserved-slugs.js +16 -0
  201. package/node_modules/@kardalum/api-schemas/dist/role.schema.d.ts +90 -0
  202. package/node_modules/@kardalum/api-schemas/dist/role.schema.js +69 -0
  203. package/node_modules/@kardalum/api-schemas/dist/sample-content-outcome.schema.d.ts +17 -0
  204. package/node_modules/@kardalum/api-schemas/dist/sample-content-outcome.schema.js +27 -0
  205. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +108 -0
  206. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +93 -0
  207. package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +243 -0
  208. package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +296 -0
  209. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +43 -0
  210. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.js +25 -0
  211. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +30 -0
  212. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.js +19 -0
  213. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +112 -0
  214. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +74 -0
  215. package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +41 -0
  216. package/node_modules/@kardalum/api-schemas/dist/template.schema.js +39 -0
  217. package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.d.ts +21 -0
  218. package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.js +14 -0
  219. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +89 -0
  220. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +68 -0
  221. package/node_modules/@kardalum/api-schemas/package.json +35 -0
  222. package/node_modules/@kardalum/design-tokens/LICENSE +202 -0
  223. package/node_modules/@kardalum/design-tokens/README.md +29 -0
  224. package/node_modules/@kardalum/design-tokens/dist/build-css.d.ts +32 -0
  225. package/node_modules/@kardalum/design-tokens/dist/build-css.js +88 -0
  226. package/node_modules/@kardalum/design-tokens/dist/generate.d.ts +1 -0
  227. package/node_modules/@kardalum/design-tokens/dist/generate.js +18 -0
  228. package/node_modules/@kardalum/design-tokens/dist/index.d.ts +6 -0
  229. package/node_modules/@kardalum/design-tokens/dist/index.js +4 -0
  230. package/node_modules/@kardalum/design-tokens/dist/system-dark.css +75 -0
  231. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +33 -0
  232. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +54 -0
  233. package/node_modules/@kardalum/design-tokens/dist/theme-css.d.ts +12 -0
  234. package/node_modules/@kardalum/design-tokens/dist/theme-css.js +42 -0
  235. package/node_modules/@kardalum/design-tokens/dist/theme-types.d.ts +43 -0
  236. package/node_modules/@kardalum/design-tokens/dist/theme-types.js +1 -0
  237. package/node_modules/@kardalum/design-tokens/dist/themes/dark.d.ts +13 -0
  238. package/node_modules/@kardalum/design-tokens/dist/themes/dark.js +120 -0
  239. package/node_modules/@kardalum/design-tokens/dist/themes/index.d.ts +5 -0
  240. package/node_modules/@kardalum/design-tokens/dist/themes/index.js +4 -0
  241. package/node_modules/@kardalum/design-tokens/dist/themes/light.d.ts +9 -0
  242. package/node_modules/@kardalum/design-tokens/dist/themes/light.js +13 -0
  243. package/node_modules/@kardalum/design-tokens/dist/tokens.css +239 -0
  244. package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +25 -0
  245. package/node_modules/@kardalum/design-tokens/dist/tokens.js +276 -0
  246. package/node_modules/@kardalum/design-tokens/dist/tokens.json +212 -0
  247. package/node_modules/@kardalum/design-tokens/dist/types.d.ts +91 -0
  248. package/node_modules/@kardalum/design-tokens/dist/types.js +5 -0
  249. package/node_modules/@kardalum/design-tokens/package.json +42 -0
  250. package/node_modules/@kardalum/plugin-package/LICENSE +202 -0
  251. package/node_modules/@kardalum/plugin-package/README.md +71 -0
  252. package/node_modules/@kardalum/plugin-package/dist/docs-contract.d.ts +50 -0
  253. package/node_modules/@kardalum/plugin-package/dist/docs-contract.js +659 -0
  254. package/node_modules/@kardalum/plugin-package/dist/envelope.d.ts +19 -0
  255. package/node_modules/@kardalum/plugin-package/dist/envelope.js +104 -0
  256. package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +37 -0
  257. package/node_modules/@kardalum/plugin-package/dist/extract.js +199 -0
  258. package/node_modules/@kardalum/plugin-package/dist/hash.d.ts +17 -0
  259. package/node_modules/@kardalum/plugin-package/dist/hash.js +69 -0
  260. package/node_modules/@kardalum/plugin-package/dist/index.d.ts +11 -0
  261. package/node_modules/@kardalum/plugin-package/dist/index.js +7 -0
  262. package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +185 -0
  263. package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +236 -0
  264. package/node_modules/@kardalum/plugin-package/dist/package-contract.d.ts +50 -0
  265. package/node_modules/@kardalum/plugin-package/dist/package-contract.js +115 -0
  266. package/node_modules/@kardalum/plugin-package/dist/sample-content.d.ts +1 -0
  267. package/node_modules/@kardalum/plugin-package/dist/sample-content.js +17 -0
  268. package/node_modules/@kardalum/plugin-package/dist/types.d.ts +45 -0
  269. package/node_modules/@kardalum/plugin-package/dist/types.js +1 -0
  270. package/node_modules/@kardalum/plugin-package/package.json +49 -0
  271. package/node_modules/@kardalum/ui/LICENSE +202 -0
  272. package/node_modules/@kardalum/ui/README.md +35 -0
  273. package/node_modules/@kardalum/ui/dist/components/alert-dialog.d.ts +14 -0
  274. package/node_modules/@kardalum/ui/dist/components/alert-dialog.js +38 -0
  275. package/node_modules/@kardalum/ui/dist/components/badge.d.ts +9 -0
  276. package/node_modules/@kardalum/ui/dist/components/badge.js +30 -0
  277. package/node_modules/@kardalum/ui/dist/components/button.d.ts +11 -0
  278. package/node_modules/@kardalum/ui/dist/components/button.js +37 -0
  279. package/node_modules/@kardalum/ui/dist/components/checkbox.d.ts +5 -0
  280. package/node_modules/@kardalum/ui/dist/components/checkbox.js +7 -0
  281. package/node_modules/@kardalum/ui/dist/components/dialog.d.ts +17 -0
  282. package/node_modules/@kardalum/ui/dist/components/dialog.js +48 -0
  283. package/node_modules/@kardalum/ui/dist/components/dropdown-menu.d.ts +18 -0
  284. package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +53 -0
  285. package/node_modules/@kardalum/ui/dist/components/empty-state.d.ts +30 -0
  286. package/node_modules/@kardalum/ui/dist/components/empty-state.js +9 -0
  287. package/node_modules/@kardalum/ui/dist/components/input.d.ts +4 -0
  288. package/node_modules/@kardalum/ui/dist/components/input.js +6 -0
  289. package/node_modules/@kardalum/ui/dist/components/panel.d.ts +5 -0
  290. package/node_modules/@kardalum/ui/dist/components/panel.js +6 -0
  291. package/node_modules/@kardalum/ui/dist/components/property-field.d.ts +19 -0
  292. package/node_modules/@kardalum/ui/dist/components/property-field.js +86 -0
  293. package/node_modules/@kardalum/ui/dist/components/sheet.d.ts +17 -0
  294. package/node_modules/@kardalum/ui/dist/components/sheet.js +55 -0
  295. package/node_modules/@kardalum/ui/dist/components/skeleton.d.ts +3 -0
  296. package/node_modules/@kardalum/ui/dist/components/skeleton.js +9 -0
  297. package/node_modules/@kardalum/ui/dist/components/switch.d.ts +5 -0
  298. package/node_modules/@kardalum/ui/dist/components/switch.js +7 -0
  299. package/node_modules/@kardalum/ui/dist/components/tab-strip.d.ts +34 -0
  300. package/node_modules/@kardalum/ui/dist/components/tab-strip.js +72 -0
  301. package/node_modules/@kardalum/ui/dist/components/toast.d.ts +18 -0
  302. package/node_modules/@kardalum/ui/dist/components/toast.js +42 -0
  303. package/node_modules/@kardalum/ui/dist/components/toaster.d.ts +12 -0
  304. package/node_modules/@kardalum/ui/dist/components/toaster.js +11 -0
  305. package/node_modules/@kardalum/ui/dist/components/use-toast.d.ts +17 -0
  306. package/node_modules/@kardalum/ui/dist/components/use-toast.js +62 -0
  307. package/node_modules/@kardalum/ui/dist/index.d.ts +18 -0
  308. package/node_modules/@kardalum/ui/dist/index.js +18 -0
  309. package/node_modules/@kardalum/ui/dist/lib/cn.d.ts +2 -0
  310. package/node_modules/@kardalum/ui/dist/lib/cn.js +5 -0
  311. package/node_modules/@kardalum/ui/package.json +63 -0
  312. package/package.json +146 -4
@@ -0,0 +1,197 @@
1
+ import { z } from "zod";
2
+ import { PluginActionDeclarationSchema, PluginRoleOfferSchema } from "./plugin-actions.schema.js";
3
+ import { MANIFEST_ID_SEGMENT_MAX, PLUGIN_ID_REGEX } from "./plugin-id-rules.js";
4
+ import { SampleContentOutcomeSchema } from "./sample-content-outcome.schema.js";
5
+ // S268 Task 5: one derived capability, the wire form of the SDK's
6
+ // `Capability` (packages/plugin-sdk/src/capabilities.ts, which the
7
+ // marketplace computes at ingest). Deliberately NOT imported from there:
8
+ // api-schemas must never depend on the plugin SDK, because the manifest
9
+ // contract carries React and this package is imported by everything.
10
+ //
11
+ // `id` stays an open string rather than an enum of the ids the SDK mints
12
+ // today. A CMS and the marketplace it talks to are independently
13
+ // deployed and independently versioned, so a marketplace that has
14
+ // learned a new capability would otherwise fail response validation at
15
+ // an older admin and blank the whole screen, instead of rendering one
16
+ // row the admin has no label for. The install screen prints an unlabelled
17
+ // id raw for the same reason: drift should be visible, not fatal.
18
+ export const MarketplaceCapabilitySchema = z.object({
19
+ id: z.string(),
20
+ mediation: z.enum(["mediated", "promised"]),
21
+ payload: z.object({ count: z.number().int(), details: z.array(z.string()) }),
22
+ });
23
+ export const MarketplaceListingVersionSchema = z.object({
24
+ version: z.string(),
25
+ supportedDialects: z.array(z.string()),
26
+ // What this version can do, derived by the marketplace at ingest from
27
+ // the manifest's contributions, assertions and storage declaration,
28
+ // never self-declared beside them (S267 section 3). This one list is
29
+ // what the install screen renders as consent items; the same list is
30
+ // what review reads to decide whether a submission needs a person.
31
+ // It replaced the `{ assertions, structuredStorage }` pair, and the
32
+ // three `needsX` booleans before that.
33
+ capabilities: z.array(MarketplaceCapabilitySchema),
34
+ // S273: what installing this version adds to the permission surface, and
35
+ // the roles it offers; both snapshotted at ingest from manifest.json.
36
+ // Optional because a marketplace that predates this session answers
37
+ // without them.
38
+ actions: z.array(PluginActionDeclarationSchema).optional(),
39
+ roleOffers: z.array(PluginRoleOfferSchema).optional(),
40
+ license: z.string(),
41
+ cmsVersion: z.string(),
42
+ verified: z.boolean(),
43
+ createdAt: z.string(),
44
+ // F4: some listings legitimately have no downloadable artifact yet
45
+ // (e.g. "available at launch" placeholders) — the marketplace's public
46
+ // portal disables its own Download button for exactly this case. The
47
+ // admin-facing listing API had no way to say so, so the admin marketplace
48
+ // browser rendered an enabled Install button and only found out from the
49
+ // raw 404 the server threw back. Derived server-side from
50
+ // `artifactPath != null` (mirrors MarketplaceStarterSchema.hasArchive
51
+ // just below), never guessed client-side.
52
+ hasArtifact: z.boolean(),
53
+ });
54
+ export const MarketplaceListingSchema = z.object({
55
+ pluginId: z.string(),
56
+ name: z.string(),
57
+ type: z.string(),
58
+ description: z.string(),
59
+ author: z.string(),
60
+ priceCents: z.number().int(),
61
+ coverImagePath: z.string().nullable(),
62
+ latestVersion: MarketplaceListingVersionSchema.nullable(),
63
+ // Computed SERVER-SIDE against this CMS's active dialect — the admin
64
+ // client never guesses compatibility from raw dialect lists.
65
+ compatible: z.boolean(),
66
+ // S274c: the version installed on THIS CMS, or null when the listing is not
67
+ // installed. Looked up server-side from the registry, never guessed client-side.
68
+ installedVersion: z.string().nullable(),
69
+ // S274c: true only when the listing's latest version is strictly newer than
70
+ // the installed one (semver, decided server-side). A newer or unreadable
71
+ // installed version is never offered as an "update".
72
+ updateAvailable: z.boolean(),
73
+ });
74
+ // S148: a starter frontend the marketplace hosts as a versioned archive
75
+ // (Global Constraints — a bundledTemplate WITHOUT an archive stays legal,
76
+ // hence hasArchive rather than always assuming a download exists) and the
77
+ // document types a template/section listing provisions on install. Both
78
+ // are projected server-side by the marketplace (starter-projection.ts) and
79
+ // only ever appear on the DETAIL surface, never on browse — see
80
+ // MarketplaceListingDetailVersionSchema below.
81
+ export const MarketplaceStarterSchema = z.object({
82
+ name: z.string(),
83
+ description: z.string().nullable(),
84
+ repository: z.string().nullable(),
85
+ hasArchive: z.boolean(),
86
+ });
87
+ export const MarketplaceDocumentTypeSummarySchema = z.object({
88
+ name: z.string(),
89
+ fields: z.array(z.string()),
90
+ });
91
+ // S153: a bundle's enriched member projection — snapshotted at ingest by
92
+ // the marketplace (bundle-members.ts), detail-only like the S148 starter
93
+ // fields (same extend-don't-widen browse protection below).
94
+ export const MarketplaceBundleMemberSchema = z.object({
95
+ pluginId: z.string(),
96
+ name: z.string(),
97
+ description: z.string().nullable(),
98
+ type: z.string(),
99
+ priceCents: z.number().int(),
100
+ });
101
+ // Extends the base version shape rather than widening it: browse
102
+ // (MarketplaceListingSchema.latestVersion, MarketplaceListResponseSchema)
103
+ // keeps using MarketplaceListingVersionSchema untouched, so starter/
104
+ // documentTypesSummary can never leak onto the browse screen even though
105
+ // the upstream marketplace's JSON carries them on every version row.
106
+ export const MarketplaceListingDetailVersionSchema = MarketplaceListingVersionSchema.extend({
107
+ starter: MarketplaceStarterSchema.nullable().optional(),
108
+ documentTypesSummary: z.array(MarketplaceDocumentTypeSummarySchema).nullable().optional(),
109
+ bundledMembers: z.array(MarketplaceBundleMemberSchema).nullable().optional(),
110
+ // S210: the package's own README, rendered by @kardalum/markdown in the
111
+ // admin's detail view. Detail-only for the same reason as starter above —
112
+ // extending rather than widening is what keeps it off the browse screen,
113
+ // where the browse handler's response validation strips it back off.
114
+ readme: z.string().nullable().optional(),
115
+ });
116
+ export const MarketplaceListingDetailSchema = MarketplaceListingSchema.extend({
117
+ latestVersion: MarketplaceListingDetailVersionSchema.nullable(),
118
+ versions: z.array(MarketplaceListingDetailVersionSchema),
119
+ activeDialect: z.string(),
120
+ marketplaceBaseUrl: z.string(),
121
+ });
122
+ // S288g Task 0: the marketplace's OWN listing API (GET /api/v1/listings and
123
+ // GET /api/v1/listings/:pluginId, upstream of a CMS's proxy) carries the
124
+ // origin a browser reaches the marketplace at, from its MARKETPLACE_BASE_URL
125
+ // with no trailing slash. A CMS may dial the marketplace somewhere a browser
126
+ // cannot (the demo's server calls a loopback on purpose), so the proxy hands
127
+ // the admin this value as `marketplaceBaseUrl` for covers, buy links and
128
+ // downloads, and keeps its configured URL for its own requests. http and
129
+ // https only, because the admin puts it straight into src and href.
130
+ export const MarketplacePublicBaseSchema = z.object({
131
+ publicBaseUrl: z.url({ protocol: /^https?$/ }),
132
+ });
133
+ export const MarketplaceListQuerySchema = z.object({
134
+ q: z.string().optional(),
135
+ type: z.string().optional(),
136
+ db: z.string().optional(),
137
+ cursor: z.string().uuid().optional(),
138
+ limit: z.coerce.number().int().min(1).max(50).default(24),
139
+ });
140
+ export const MarketplaceListResponseSchema = z.object({
141
+ items: z.array(MarketplaceListingSchema),
142
+ nextCursor: z.string().nullable(),
143
+ activeDialect: z.string(),
144
+ marketplaceBaseUrl: z.string(),
145
+ });
146
+ export const MarketplacePluginIdParamsSchema = z.object({ pluginId: z.string().min(1) });
147
+ // Path-safety gate: pluginId reaches removePluginPackages, which builds a
148
+ // path from it and does a recursive, forced rmSync. Without this, a bare
149
+ // `z.string().min(1)` would let a traversal-shaped id (`"../../etc"`) all the
150
+ // way to that filesystem call. Since S283 it is the manifest validator's own
151
+ // rule (PLUGIN_ID_REGEX and the segment cap), not a looser copy: a case
152
+ // variant such as "COM.KARDALUM.SEO" names another plugin's folder on a
153
+ // case-insensitive filesystem.
154
+ export const MarketplaceInstallBodySchema = z.object({
155
+ pluginId: z
156
+ .string()
157
+ .min(1)
158
+ .regex(PLUGIN_ID_REGEX, "pluginId must be a reverse-domain identifier (e.g. com.example.plugin): lowercase segments, each starting with a letter")
159
+ .refine((id) => id.split(".").length <= MANIFEST_ID_SEGMENT_MAX, `pluginId has at most ${MANIFEST_ID_SEGMENT_MAX} segments`),
160
+ version: z.string().min(1),
161
+ licenseKey: z.string().min(1).optional(),
162
+ });
163
+ // S152: a bundle install reports what its fan-out did per member —
164
+ // "installed" (this operation installed it, ownership recorded) or
165
+ // "already-installed" (pre-existing, skipped, never claimed). Optional
166
+ // and absent for every non-bundle install, so single-plugin clients are
167
+ // untouched.
168
+ export const MarketplaceInstallMemberSchema = z.object({
169
+ pluginId: z.string(),
170
+ version: z.string(),
171
+ outcome: z.enum(["installed", "already-installed"]),
172
+ });
173
+ // trustTier is a literal, not the broader TrustTier union — this door
174
+ // (S138) only ever answers 201 for a "verified" result; a non-"verified"
175
+ // verdict is a 422 failure response (ApiErrorSchema), never this shape.
176
+ export const MarketplaceInstallResponseSchema = z.object({
177
+ pluginId: z.string(),
178
+ version: z.string(),
179
+ trustTier: z.literal("verified"),
180
+ licensed: z.boolean(),
181
+ // S274c: "updated" when a newer version replaced an installed one in place.
182
+ outcome: z.enum(["installed", "updated"]),
183
+ fromVersion: z.string().nullable(),
184
+ members: z.array(MarketplaceInstallMemberSchema).optional(),
185
+ // S277e: what the install did with the plugin's own sample content.
186
+ // Absent for an update and for a plugin that ships none.
187
+ sampleContent: SampleContentOutcomeSchema.optional(),
188
+ });
189
+ /** The 409 a marketplace install or update answers. `reason` is present
190
+ * only for "license-not-recorded" (S284, D4): the plugin IS installed (or
191
+ * updated), and only its licence row is another request's, so a client
192
+ * refreshes its installed state rather than offering Install again. Every
193
+ * other 409 carries `message` alone. */
194
+ export const MarketplaceInstallConflictSchema = z.object({
195
+ message: z.string(),
196
+ reason: z.literal("license-not-recorded").optional(),
197
+ });
@@ -0,0 +1,167 @@
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
+ export declare const MediaFolderListResponseSchema: z.ZodObject<{
13
+ folders: z.ZodArray<z.ZodObject<{
14
+ id: z.ZodString;
15
+ name: z.ZodString;
16
+ parentId: z.ZodNullable<z.ZodString>;
17
+ createdAt: z.ZodString;
18
+ }, z.core.$strip>>;
19
+ }, z.core.$strip>;
20
+ export type MediaFolderListResponse = z.infer<typeof MediaFolderListResponseSchema>;
21
+ export declare const MediaFileResponseSchema: z.ZodObject<{
22
+ id: z.ZodString;
23
+ filename: z.ZodString;
24
+ mimeType: z.ZodString;
25
+ size: z.ZodNumber;
26
+ url: z.ZodString;
27
+ visibility: z.ZodEnum<{
28
+ public: "public";
29
+ private: "private";
30
+ }>;
31
+ folderId: z.ZodNullable<z.ZodString>;
32
+ uploadedBy: z.ZodString;
33
+ uploadedAt: z.ZodString;
34
+ documentTypeId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
35
+ data: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<Record<string, unknown>, Record<string, unknown> | null | undefined>>;
36
+ currentVersion: z.ZodDefault<z.ZodNumber>;
37
+ hasRendition: z.ZodOptional<z.ZodBoolean>;
38
+ deletedAt: z.ZodDefault<z.ZodNullable<z.ZodString>>;
39
+ downloadUrl: z.ZodString;
40
+ }, z.core.$strip>;
41
+ export type MediaFileResponse = z.infer<typeof MediaFileResponseSchema>;
42
+ export declare const MediaLinkResponseSchema: z.ZodObject<{
43
+ url: z.ZodString;
44
+ expiresAt: z.ZodString;
45
+ }, z.core.$strip>;
46
+ export type MediaLinkResponse = z.infer<typeof MediaLinkResponseSchema>;
47
+ export declare const MediaDeleteResponseSchema: z.ZodObject<{
48
+ success: z.ZodLiteral<true>;
49
+ }, z.core.$strip>;
50
+ export type MediaDeleteResponse = z.infer<typeof MediaDeleteResponseSchema>;
51
+ export declare const UpdateMediaRequestSchema: z.ZodObject<{
52
+ visibility: z.ZodOptional<z.ZodEnum<{
53
+ public: "public";
54
+ private: "private";
55
+ }>>;
56
+ folderId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
57
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
58
+ }, z.core.$strip>;
59
+ export type UpdateMediaRequest = z.infer<typeof UpdateMediaRequestSchema>;
60
+ export declare const MediaListQuerySchema: z.ZodObject<{
61
+ cursor: z.ZodOptional<z.ZodString>;
62
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
63
+ search: z.ZodOptional<z.ZodString>;
64
+ folderId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"root">]>>;
65
+ rendition: z.ZodOptional<z.ZodString>;
66
+ }, z.core.$strip>;
67
+ export type MediaListQuery = z.infer<typeof MediaListQuerySchema>;
68
+ export declare const MediaListResponseSchema: z.ZodObject<{
69
+ items: z.ZodArray<z.ZodObject<{
70
+ id: z.ZodString;
71
+ filename: z.ZodString;
72
+ mimeType: z.ZodString;
73
+ size: z.ZodNumber;
74
+ url: z.ZodString;
75
+ visibility: z.ZodEnum<{
76
+ public: "public";
77
+ private: "private";
78
+ }>;
79
+ folderId: z.ZodNullable<z.ZodString>;
80
+ uploadedBy: z.ZodString;
81
+ uploadedAt: z.ZodString;
82
+ documentTypeId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
83
+ data: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<Record<string, unknown>, Record<string, unknown> | null | undefined>>;
84
+ currentVersion: z.ZodDefault<z.ZodNumber>;
85
+ hasRendition: z.ZodOptional<z.ZodBoolean>;
86
+ deletedAt: z.ZodDefault<z.ZodNullable<z.ZodString>>;
87
+ downloadUrl: z.ZodString;
88
+ }, z.core.$strip>>;
89
+ nextCursor: z.ZodNullable<z.ZodString>;
90
+ }, z.core.$strip>;
91
+ export type MediaListResponse = z.infer<typeof MediaListResponseSchema>;
92
+ export declare const MediaVersionListResponseSchema: z.ZodObject<{
93
+ items: z.ZodArray<z.ZodObject<{
94
+ id: z.ZodString;
95
+ mediaFileId: z.ZodString;
96
+ version: z.ZodNumber;
97
+ filename: z.ZodString;
98
+ mimeType: z.ZodString;
99
+ size: z.ZodNumber;
100
+ width: z.ZodNullable<z.ZodNumber>;
101
+ height: z.ZodNullable<z.ZodNumber>;
102
+ createdAt: z.ZodString;
103
+ createdBy: z.ZodString;
104
+ createdByName: z.ZodNullable<z.ZodString>;
105
+ }, z.core.$strip>>;
106
+ currentVersion: z.ZodNumber;
107
+ }, z.core.$strip>;
108
+ export type MediaVersionListResponse = z.infer<typeof MediaVersionListResponseSchema>;
109
+ export declare const MediaRenditionListResponseSchema: z.ZodObject<{
110
+ items: z.ZodArray<z.ZodObject<{
111
+ id: z.ZodString;
112
+ mediaVersionId: z.ZodString;
113
+ name: z.ZodString;
114
+ filename: z.ZodString;
115
+ mimeType: z.ZodString;
116
+ size: z.ZodNumber;
117
+ width: z.ZodNumber;
118
+ height: z.ZodNumber;
119
+ rect: z.ZodObject<{
120
+ x: z.ZodNumber;
121
+ y: z.ZodNumber;
122
+ w: z.ZodNumber;
123
+ h: z.ZodNumber;
124
+ }, z.core.$strip>;
125
+ createdAt: z.ZodString;
126
+ }, z.core.$strip>>;
127
+ currentVersion: z.ZodNumber;
128
+ }, z.core.$strip>;
129
+ export type MediaRenditionListResponse = z.infer<typeof MediaRenditionListResponseSchema>;
130
+ export declare const MediaTrashListQuerySchema: z.ZodObject<{
131
+ cursor: z.ZodOptional<z.ZodString>;
132
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
133
+ }, z.core.$strip>;
134
+ export type MediaTrashListQuery = z.infer<typeof MediaTrashListQuerySchema>;
135
+ export declare const MediaTrashListResponseSchema: z.ZodObject<{
136
+ items: z.ZodArray<z.ZodObject<{
137
+ id: z.ZodString;
138
+ filename: z.ZodString;
139
+ mimeType: z.ZodString;
140
+ size: z.ZodNumber;
141
+ url: z.ZodString;
142
+ visibility: z.ZodEnum<{
143
+ public: "public";
144
+ private: "private";
145
+ }>;
146
+ folderId: z.ZodNullable<z.ZodString>;
147
+ uploadedBy: z.ZodString;
148
+ uploadedAt: z.ZodString;
149
+ documentTypeId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
150
+ data: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<Record<string, unknown>, Record<string, unknown> | null | undefined>>;
151
+ currentVersion: z.ZodDefault<z.ZodNumber>;
152
+ hasRendition: z.ZodOptional<z.ZodBoolean>;
153
+ deletedAt: z.ZodDefault<z.ZodNullable<z.ZodString>>;
154
+ }, z.core.$strip>>;
155
+ nextCursor: z.ZodNullable<z.ZodString>;
156
+ }, z.core.$strip>;
157
+ export type MediaTrashListResponse = z.infer<typeof MediaTrashListResponseSchema>;
158
+ export declare const MediaReadQuerySchema: z.ZodObject<{
159
+ includeTrashed: z.ZodPipe<z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"true">, z.ZodLiteral<"false">, z.ZodBoolean]>>, z.ZodTransform<boolean, boolean | "true" | "false">>;
160
+ }, z.core.$strip>;
161
+ export type MediaReadQuery = z.infer<typeof MediaReadQuerySchema>;
162
+ export declare const MediaEmptyTrashResponseSchema: z.ZodObject<{
163
+ destroyed: z.ZodNumber;
164
+ failed: z.ZodNumber;
165
+ truncated: z.ZodBoolean;
166
+ }, z.core.$strip>;
167
+ export type MediaEmptyTrashResponse = z.infer<typeof MediaEmptyTrashResponseSchema>;
@@ -0,0 +1,214 @@
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/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/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
+ // GET /api/media/folders response (S186e §2/Task 2 obligation 7): the
34
+ // WHOLE tree in one response, not cursor-paginated the way /api/media is.
35
+ // Fix wave (MEDIUM-1) correction: this is NOT actually bounded by the
36
+ // service's depth cap (5) and per-parent sibling sanity limit (500) the
37
+ // way an earlier version of this comment claimed — those two caps bound
38
+ // one branch's nesting and one parent's children respectively, not the
39
+ // whole tree's total folder count, which is their product summed across
40
+ // every branch (on the order of 3×10^13 in the worst case at those same
41
+ // limits) — nowhere near a real bound in practice. Left unpaginated as a
42
+ // deliberate scope decision for this task, not because it's provably
43
+ // small; a future task can revisit pagination here if a real library
44
+ // ever grows large enough for it to matter. Decision, documented here
45
+ // rather than left implicit: a FLAT array of MediaFolderSchema, not a
46
+ // server-assembled nested structure — the client groups by `parentId`
47
+ // itself (cheap at ordinary scale, and it's exactly the shape
48
+ // MediaFolderSchema already has). A folder whose parentId dangles (binding
49
+ // obligation 4 from the S186e Task 1 review) is normalized to
50
+ // `parentId: null` in this response by the service, so it renders as a
51
+ // root folder instead of silently vanishing from the client's grouping.
52
+ export const MediaFolderListResponseSchema = z.object({
53
+ folders: z.array(MediaFolderSchema),
54
+ });
55
+ // downloadUrl is the stable app path (S186c §3), computed fresh each
56
+ // response rather than trusted from storage: for a PUBLIC item it's
57
+ // identical to the persisted `url` field (permanent, no query string);
58
+ // for a PRIVATE item it's that same path plus a freshly minted,
59
+ // short-lived `?token=` (S186c §3's signed media link) — a new one every
60
+ // response, so this value is for immediate use (rendering an `<img src>`
61
+ // now), not for persisting.
62
+ export const MediaFileResponseSchema = MediaFileSchema.extend({
63
+ downloadUrl: z.string().min(1),
64
+ });
65
+ // POST /api/media/:id/link response (S186c §3) — the admin's "Copy
66
+ // temporary link" mint: a signed `?token=` URL good until `expiresAt`.
67
+ // Same stable path as `downloadUrl`, just minted on demand rather than
68
+ // alongside every list/get response.
69
+ export const MediaLinkResponseSchema = z.object({
70
+ url: z.string().min(1),
71
+ expiresAt: z.string().datetime(),
72
+ });
73
+ export const MediaDeleteResponseSchema = z.object({
74
+ success: z.literal(true),
75
+ });
76
+ // PATCH /api/media/:id body (S186c §2, folderId added S186e §2; renamed
77
+ // from UpdateMediaVisibilityRequestSchema in the fix wave — it carries
78
+ // both visibility and folderId now, not just visibility, and the old
79
+ // name stopped describing it). Both fields optional and independent, same
80
+ // "absent = don't touch" idiom as UpdateMediaFolderRequestSchema above:
81
+ // visibility absent = don't flip it; folderId absent = don't move the
82
+ // file; folderId null = move to the library root; folderId a uuid = move
83
+ // under that folder (the service validates the folder exists first —
84
+ // binding obligation 2 from the S186e Task 1 review — rather than letting
85
+ // a bad id 500 out of the FK). `.refine` restores a 400 on a body with
86
+ // NEITHER field present: back when this schema only carried visibility
87
+ // (required, S186c), an empty body already 400'd for free; making both
88
+ // fields optional independently (S186e) silently dropped that — an empty
89
+ // `{}` PATCH validated fine and did nothing. This puts it back explicitly
90
+ // rather than leaving a request that changes nothing looking like a
91
+ // successful update.
92
+ //
93
+ // S234a Task 5 adds a third, `data`: the media document type's field
94
+ // values, validated against that type by the service. Same "absent =
95
+ // don't touch" idiom as the other two, but note what PRESENT means for
96
+ // this one: it REPLACES the item's bag rather than merging into it, the
97
+ // same way a content save replaces a version's data. The form that sends
98
+ // it renders every field the type declares, so a key it leaves out is a
99
+ // key the person cleared. `.record(z.string(), z.unknown())` is the same
100
+ // shape content's own save body uses: what a value is allowed to be is
101
+ // the field's data type's business, judged by the service, not something
102
+ // this schema can second-guess.
103
+ //
104
+ // One documented exception to "a key left out is a key cleared": the
105
+ // `private` field alias inside `data` (MEDIA_PRIVATE_ALIAS). Every other
106
+ // key in the bag lives in the bag, so omitting it clears it. Privacy does
107
+ // not live in the bag at all, it lives in the `visibility` column, which
108
+ // stays the one source of truth; the alias only exists so a form can
109
+ // render and edit it. A `data` that never mentions the alias has said
110
+ // nothing about that column, so the column keeps whatever it already had
111
+ // rather than being cleared to a default. Unticking the privacy toggle is
112
+ // sending the alias as `false`, exactly like any other field a form
113
+ // clears. See MediaService.updateItem's own doc comment for the full
114
+ // reasoning; this note exists because Tasks 6 and 7 read this schema
115
+ // rather than the service.
116
+ export const UpdateMediaRequestSchema = z
117
+ .object({
118
+ visibility: MediaVisibilitySchema.optional(),
119
+ folderId: z.string().uuid().nullable().optional(),
120
+ data: z.record(z.string(), z.unknown()).optional(),
121
+ })
122
+ .refine((body) => body.visibility !== undefined || body.folderId !== undefined || body.data !== undefined, { message: "At least one of visibility, folderId or data must be present" });
123
+ // GET /api/media — newest-first pages; cursor = id of the previous
124
+ // page's last item. `search` filters by filename substring,
125
+ // case-insensitive. `folderId` (S186e §2) is a folder filter: ABSENT
126
+ // keeps the pre-S186e all-files behavior (compatibility-pinned by a
127
+ // dedicated test — existing callers must see no change), "root" matches
128
+ // files with no folder AND files whose folderId dangles (binding
129
+ // obligation 3 from the S186e Task 1 review — a damaged folderId must
130
+ // resurface at root, never vanish), a uuid matches exactly that folder.
131
+ export const MediaListQuerySchema = z.object({
132
+ cursor: z.string().uuid().optional(),
133
+ limit: z.coerce.number().int().min(1).max(100).default(24),
134
+ search: z.string().min(1).optional(),
135
+ folderId: z.union([z.string().uuid(), z.literal("root")]).optional(),
136
+ // S234d. A rendition NAME, as `renditionName` produces it ("3x4",
137
+ // "thumb"), which is the same value an image field's `rendition`
138
+ // setting holds (ImageSettingsSchema). Not a filter: the page still
139
+ // lists every item it would have listed without it. It asks a question,
140
+ // and each item answers through `hasRendition`, so the picker can show
141
+ // the whole library and mark which pictures the field can actually use
142
+ // rather than hiding the rest and leaving an editor wondering where
143
+ // their upload went. Absent asks nothing, which is what every caller
144
+ // before this did.
145
+ rendition: z.string().min(1).optional(),
146
+ });
147
+ export const MediaListResponseSchema = z.object({
148
+ items: z.array(MediaFileResponseSchema),
149
+ // null = no more pages.
150
+ nextCursor: z.string().uuid().nullable(),
151
+ });
152
+ // GET /api/media/:id/versions. Newest first, with the pointer beside them
153
+ // so a client never has to infer which row is live from the list order.
154
+ export const MediaVersionListResponseSchema = z.object({
155
+ items: z.array(MediaVersionSchema),
156
+ currentVersion: z.number().int().positive(),
157
+ });
158
+ // GET /api/media/:id/renditions. The renditions of the CURRENT version
159
+ // only, with the pointer beside them so a client never infers which
160
+ // version these belong to.
161
+ export const MediaRenditionListResponseSchema = z.object({
162
+ items: z.array(MediaRenditionSchema),
163
+ currentVersion: z.number().int().positive(),
164
+ });
165
+ // GET /api/media/trash (S234e). Newest-trashed first; cursor = id of the
166
+ // previous page's last item, the same cursor idiom the library list uses.
167
+ export const MediaTrashListQuerySchema = z.object({
168
+ cursor: z.string().uuid().optional(),
169
+ limit: z.coerce.number().int().min(1).max(100).default(24),
170
+ });
171
+ // Items are MediaFileSchema, NOT MediaFileResponseSchema, and the missing
172
+ // member is `downloadUrl`. That is deliberate rather than an omission: a
173
+ // trashed item does not serve, so a download URL would be a link that
174
+ // cannot work, and for a private item it would additionally mint a token
175
+ // per row for bytes nobody can fetch. The bin shows a filename and a
176
+ // date, not a preview.
177
+ export const MediaTrashListResponseSchema = z.object({
178
+ items: z.array(MediaFileSchema),
179
+ // null = no more pages.
180
+ nextCursor: z.string().uuid().nullable(),
181
+ });
182
+ // GET /api/media/:id query (S234e). The ONE way to read a trashed item
183
+ // through the API, and it has to be asked for: every other read, and this
184
+ // one without the flag, answers 404 for a trashed item so that a trashed
185
+ // file is not reachable by accident.
186
+ export const MediaReadQuerySchema = z.object({
187
+ // NOT z.coerce.boolean(). That is Boolean(value), and Boolean("false")
188
+ // is true, so `?includeTrashed=false` would turn the flag ON. A
189
+ // querystring only ever arrives as a string, and this is the one flag
190
+ // that keeps a trashed item unreachable unless a caller deliberately
191
+ // asks, so it reads only the two spellings it means: "true"/"false" or
192
+ // a real boolean. There is no catch-all in the union, so anything else
193
+ // (`?includeTrashed=garbage`) is a Zod error and a 400, deliberately: a
194
+ // malformed value for the one flag that keeps a trashed item unreachable
195
+ // should be refused, not guessed at.
196
+ includeTrashed: z
197
+ .union([z.literal("true"), z.literal("false"), z.boolean()])
198
+ .default(false)
199
+ .transform((value) => value === true || value === "true"),
200
+ });
201
+ // POST /api/media/trash/empty (S234e). Both numbers, always, because a
202
+ // purge deletes the row before the objects and can therefore half
203
+ // succeed. An endpoint that answered only `{ success: true }` would be
204
+ // claiming something it cannot know.
205
+ export const MediaEmptyTrashResponseSchema = z.object({
206
+ destroyed: z.number().int().nonnegative(),
207
+ failed: z.number().int().nonnegative(),
208
+ // True only when this pass stopped early at MediaService's
209
+ // EMPTY_TRASH_FAILURE_CAP rather than running out of trashed items to
210
+ // look at: the bin still holds items this pass never reached. A caller
211
+ // reading destroyed/failed alone has no way to tell "the bin is now
212
+ // accounted for" from "there is more in there and this pass gave up".
213
+ truncated: z.boolean(),
214
+ });
@@ -0,0 +1,77 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * S234g. What destroying a media item would break, split by whether it
4
+ * breaks now, only after a rollback, or only if a trashed page comes back.
5
+ *
6
+ * Counted by distinct PAGE, never by row: a picture used across seven
7
+ * versions of one page is one page.
8
+ */
9
+ export declare const MediaReferenceCountsSchema: z.ZodObject<{
10
+ live: z.ZodNumber;
11
+ history: z.ZodNumber;
12
+ trashed: z.ZodNumber;
13
+ }, z.core.$strip>;
14
+ export type MediaReferenceCounts = z.infer<typeof MediaReferenceCountsSchema>;
15
+ /**
16
+ * One page, field and culture that references the item, with the highest
17
+ * version mentioning it there.
18
+ *
19
+ * `path` rather than a name: the path is on the content node and needs no
20
+ * second read, and since S227 it is derived from the name, so it is
21
+ * recognisable. `culture` is "" for a field shared by every language.
22
+ */
23
+ export declare const MediaReferenceUseSchema: z.ZodObject<{
24
+ contentId: z.ZodString;
25
+ path: z.ZodString;
26
+ culture: z.ZodString;
27
+ fieldId: z.ZodString;
28
+ version: z.ZodNumber;
29
+ state: z.ZodEnum<{
30
+ live: "live";
31
+ history: "history";
32
+ trashed: "trashed";
33
+ }>;
34
+ }, z.core.$strip>;
35
+ export type MediaReferenceUse = z.infer<typeof MediaReferenceUseSchema>;
36
+ export declare const MediaReferenceListQuerySchema: z.ZodObject<{
37
+ cursor: z.ZodOptional<z.ZodString>;
38
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
39
+ }, z.core.$strip>;
40
+ export type MediaReferenceListQuery = z.infer<typeof MediaReferenceListQuerySchema>;
41
+ export declare const MediaReferenceListResponseSchema: z.ZodObject<{
42
+ counts: z.ZodObject<{
43
+ live: z.ZodNumber;
44
+ history: z.ZodNumber;
45
+ trashed: z.ZodNumber;
46
+ }, z.core.$strip>;
47
+ items: z.ZodArray<z.ZodObject<{
48
+ contentId: z.ZodString;
49
+ path: z.ZodString;
50
+ culture: z.ZodString;
51
+ fieldId: z.ZodString;
52
+ version: z.ZodNumber;
53
+ state: z.ZodEnum<{
54
+ live: "live";
55
+ history: "history";
56
+ trashed: "trashed";
57
+ }>;
58
+ }, z.core.$strip>>;
59
+ nextCursor: z.ZodNullable<z.ZodString>;
60
+ }, z.core.$strip>;
61
+ export type MediaReferenceListResponse = z.infer<typeof MediaReferenceListResponseSchema>;
62
+ /**
63
+ * The aggregate behind the Empty trash dialog: how many files are in the
64
+ * bin, and how many pages every one of them together would affect.
65
+ *
66
+ * One call rather than one per file, which is why the adapter's count
67
+ * takes an array.
68
+ */
69
+ export declare const MediaTrashReferenceSummarySchema: z.ZodObject<{
70
+ files: z.ZodNumber;
71
+ counts: z.ZodObject<{
72
+ live: z.ZodNumber;
73
+ history: z.ZodNumber;
74
+ trashed: z.ZodNumber;
75
+ }, z.core.$strip>;
76
+ }, z.core.$strip>;
77
+ export type MediaTrashReferenceSummary = z.infer<typeof MediaTrashReferenceSummarySchema>;