@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,393 @@
1
+ import { z } from "zod";
2
+ import { PluginRoleOfferSchema } from "./plugin-actions.schema.js";
3
+ import { SampleContentOutcomeSchema } from "./sample-content-outcome.schema.js";
4
+ // The ADMIN management view of the registry (S135): unlike the public
5
+ // GET /api/plugins (enabled-only, boot-loader metadata), this surface
6
+ // lists every installed plugin, disabled included. licenseStatus reflects
7
+ // the PluginLicense row's last verdict ("valid" | "revoked" |
8
+ // "domain_mismatch" | "unknown" | "grace_expired"), or null when the plugin has no license
9
+ // row at all (free plugins, or a paid plugin never validated yet,
10
+ // S138/S139). The three fields below (S139 Task 5) ride along so the
11
+ // admin's license cell can render an honest state without a second
12
+ // request per row: licenseReason mirrors PluginLicense.lastReason (the
13
+ // server's explanation for a non-valid verdict), licenseLastValidatedAt
14
+ // mirrors lastValidatedAt (the last SUCCESSFUL verdict), and
15
+ // licenseLastAttemptError mirrors lastAttemptError (why the most recent
16
+ // ATTEMPT — successful or not — failed to reach a verdict; null when it
17
+ // didn't). Together the last two let the cell compute "unreachable since"
18
+ // itself. boundDomain mirrors PluginLicense.boundDomain (the domain this
19
+ // site bound the license to at S138 install; never mutated by later
20
+ // revalidation — see revalidate-license.ts) so a domain_mismatch warning
21
+ // can name the actual bound domain instead of the raw upstream reason
22
+ // token (S139 fix wave, spec section 6). Never add `key` here — see the
23
+ // route's comment on the same prisma select.
24
+ // licenseLocked / buyHref (S209 Task 7, hardened by the S209 criticals
25
+ // fix): whether THIS production domain has locked the plugin's admin UI —
26
+ // distinct from licenseStatus === "domain_mismatch" on its own, which also
27
+ // covers the plain warn-only case (localhost, or any domain the license
28
+ // server hasn't been asked to lock on production for). True for either of
29
+ // two reasons: a stored domain_mismatch verdict, or — closing the gap a
30
+ // paid plugin side-loaded through the ZIP door left open, since that door
31
+ // never writes a PluginLicense row at all — a plugin pluginRequiresLicense()
32
+ // (apps/server/src/licensing/entitlement.ts) reports as a paid marketplace
33
+ // listing with no valid licence on record. Computed at read time from the
34
+ // stored license row (plus, for the no-row case, a cached marketplace
35
+ // lookup) and the CURRENT request's own domain
36
+ // (apps/server/src/licensing/production-domain.ts's isProductionDomain),
37
+ // never persisted — a licensed plugin re-checked from a different admin
38
+ // domain must never keep yesterday's lock. `revoked` never sets this: that
39
+ // status already deactivates the plugin outright (see revalidate-license.ts),
40
+ // which is a different, harder consequence than a lock. buyHref is the
41
+ // marketplace listing URL for this plugin id, present only alongside a
42
+ // true licenseLocked (there is nothing to buy a fix for otherwise) and
43
+ // null when no marketplace is configured for this instance.
44
+ /** S274b (spec D4): an offer on the installed-plugins list says whether a
45
+ * role with its id already exists, so the view can hide "Create role"
46
+ * without reading the roles list (which needs roles.read). */
47
+ export const ManagedPluginRoleOfferSchema = PluginRoleOfferSchema.extend({ created: z.boolean() });
48
+ /** S284b: the marketplace's classification of an installed package that is
49
+ * not the one it delivered for the licence (the verdict's `tamper`). */
50
+ export const PluginTamperKindSchema = z.enum(["foreign-package", "sideloaded", "modified-on-disk"]);
51
+ export const ManagedPluginSchema = z.object({
52
+ pluginId: z.string(),
53
+ name: z.string(),
54
+ type: z.string(),
55
+ version: z.string(),
56
+ trustTier: z.enum(["verified", "unverified"]),
57
+ storageType: z.enum(["simple", "structured"]),
58
+ enabled: z.boolean(),
59
+ licenseStatus: z
60
+ .string()
61
+ .nullable()
62
+ .describe('The licence row\'s last verdict: "valid", "revoked", "domain_mismatch", "unknown", or "grace_expired" (no valid verdict within the grace period, so the plugin is switched off until one arrives). Null when the plugin has no licence row.'),
63
+ licenseReason: z.string().nullable(),
64
+ // S284b fix wave: the signed `detail` of the latest verdict, today the
65
+ // marketplace operator's reason for a `domain_blocked` answer, which the
66
+ // admin shows after its sentence. Null when the verdict carried none.
67
+ licenseReasonDetail: z.string().nullable(),
68
+ licenseLastValidatedAt: z.string().nullable(),
69
+ // S284b: the newest issuedAt of any valid verdict this site has stored
70
+ // (ISO), the clock the grace period runs on. Null before the first one.
71
+ licenseLastValidIssuedAt: z.string().nullable(),
72
+ licenseLastAttemptError: z.string().nullable(),
73
+ boundDomain: z.string().nullable(),
74
+ // S284b: what THIS row's `enabled` was when a grace lock closed (the
75
+ // registry row's own value since the fix wave, so a bundle member keeps
76
+ // its own), so the first valid verdict can restore it. Null when no grace
77
+ // lock is outstanding on the row.
78
+ lockedFromEnabled: z.boolean().nullable(),
79
+ // S284b: the marketplace's tamper finding from the latest valid verdict.
80
+ // It only explains; nothing on the host acts on it. Null when clean.
81
+ tamperKind: PluginTamperKindSchema.nullable(),
82
+ // True for a production domain_mismatch, a paid plugin with no licence on
83
+ // record (both above) and, since S284b, a grace_expired lock.
84
+ licenseLocked: z.boolean(),
85
+ buyHref: z.string().nullable(),
86
+ // S273: the roles this plugin's attached manifest offers, so an uploaded
87
+ // or sideloaded plugin, which has no install screen, can have an offer
88
+ // accepted from the installed-plugins view. Empty when the manifest is
89
+ // not attached (package missing at boot) or offers nothing.
90
+ roleOffers: z.array(ManagedPluginRoleOfferSchema),
91
+ // S274c: distinct roles holding any of this plugin's actions, for the
92
+ // uninstall dialog.
93
+ grantedRoleCount: z.number().int().nonnegative(),
94
+ });
95
+ export const ManagedPluginListQuerySchema = z.object({
96
+ cursor: z.string().uuid().optional(),
97
+ limit: z.coerce.number().int().min(1).max(100).default(50),
98
+ });
99
+ export const ManagedPluginListResponseSchema = z.object({
100
+ items: z.array(ManagedPluginSchema),
101
+ nextCursor: z.string().uuid().nullable(),
102
+ // S284b: the grace period this server applies (KARDALUM_LICENSE_GRACE_DAYS,
103
+ // 1 to 14), so the admin's grace_expired sentence names the real days.
104
+ licenseGraceDays: z.number().int(),
105
+ });
106
+ export const PluginIdParamsSchema = z.object({
107
+ pluginId: z.string().min(1),
108
+ });
109
+ // Fastify substitutes `null` for a genuinely absent body before handing it
110
+ // to the validator (lib/validation.js's validateParam: `isUndefined ? null
111
+ // : request[paramName]`) — a DELETE sent with no payload at all lands here
112
+ // as `null`, not `undefined`. `.nullish()` (not `.optional()`) is required
113
+ // so an absent body validates; `request.body?.confirmStructuredDataCleanup`
114
+ // in the route handler already tolerates both null and undefined.
115
+ export const UninstallPluginBodySchema = z
116
+ .object({
117
+ confirmStructuredDataCleanup: z.boolean().optional(),
118
+ })
119
+ .nullish();
120
+ // 409 payload when a structured plugin's uninstall needs confirmation —
121
+ // the snapshot has ALREADY been taken (S87's safe-to-retry design).
122
+ export const UninstallConfirmationRequiredSchema = z.object({
123
+ requiresConfirmation: z.literal(true),
124
+ snapshotGroupId: z.string(),
125
+ message: z.string(),
126
+ });
127
+ // S152: the BUNDLE uninstall's aggregated 409 — one snapshot group per
128
+ // structured plugin in the removal set (owned members, and the bundle
129
+ // itself if structured). A separate schema rather than widening
130
+ // UninstallConfirmationRequiredSchema: the single-plugin contract
131
+ // (snapshotGroupId, required) stays byte-identical for existing clients.
132
+ // Every snapshot is ALREADY taken when this is sent (S87's safe-to-retry
133
+ // property, kept cross-plugin).
134
+ export const BundleUninstallConfirmationRequiredSchema = z.object({
135
+ requiresConfirmation: z.literal(true),
136
+ memberSnapshots: z.array(z.object({
137
+ pluginId: z.string(),
138
+ snapshotGroupId: z.string(),
139
+ })),
140
+ message: z.string(),
141
+ });
142
+ // F1 QA fix wave: the content-guard 409 — a single-plugin uninstall()
143
+ // blocked because one or more of its tracked document types still have
144
+ // content or templates referencing them. Distinct from the two
145
+ // confirmation schemas above (those are "confirm to proceed," this is a
146
+ // terminal refusal the caller must resolve by hand, never retried with a
147
+ // flag) and from the bare ApiErrorSchema (that still covers every OTHER
148
+ // refusal this route can throw, e.g. a bundle member blocked by an outside
149
+ // dependent) — a separate shape so `blockedBy` only ever appears when the
150
+ // server actually has a list of named blockers to put in it.
151
+ // contentCount is optional: the guard only knows a count for the
152
+ // "has-content" reason, not "has-templates" (document-type-service.ts's
153
+ // DocumentTypeInUseError never carries one for that reason either).
154
+ export const UninstallBlockedByDocumentTypesSchema = z.object({
155
+ message: z.string(),
156
+ blockedBy: z.array(z.object({
157
+ documentType: z.string(),
158
+ contentCount: z.number().int().nonnegative().optional(),
159
+ })),
160
+ });
161
+ // Task 6: the 200 success body for a single-plugin DELETE — the CONFIRMED
162
+ // pass's freshly-minted snapshotGroupId (the gate site already took it;
163
+ // this just stops discarding it), null for a simple-storage plugin (never
164
+ // snapshotted) or for the earlier PluginRegistry.uninstall() callers that
165
+ // route around the HTTP layer entirely.
166
+ export const UninstallSucceededSchema = z.object({
167
+ snapshotGroupId: z.string().nullable(),
168
+ });
169
+ // Task 6: the 200 success body for a BUNDLE DELETE — one entry per
170
+ // structured plugin in the cascade (owned members, and the bundle itself
171
+ // if structured) that got a fresh snapshot on this confirmed pass. Simple-
172
+ // storage members never appear here, same as the 409 aggregate above.
173
+ export const BundleUninstallSucceededSchema = z.object({
174
+ memberSnapshots: z.array(z.object({
175
+ pluginId: z.string(),
176
+ snapshotGroupId: z.string(),
177
+ })),
178
+ });
179
+ // S180: whether this instance has a marketplace to browse at all —
180
+ // `getMarketplaceBaseUrl()` returning undefined (KARDALUM_MARKETPLACE_URL
181
+ // explicitly set to "off", or blank) means `configured: false`. Distinct
182
+ // from the marketplace being unreachable (a `configured: true` instance
183
+ // whose upstream is down still gets the existing load-error treatment,
184
+ // never this). The admin gates the Marketplace browse/detail screens on
185
+ // this once, at the section level, so both render the same honest empty
186
+ // state when there's genuinely nothing to browse.
187
+ export const MarketplaceStatusResponseSchema = z.object({
188
+ configured: z.boolean(),
189
+ });
190
+ // The manual re-check route's response (S139): mirrors revalidateLicense's
191
+ // RevalidationOutcome, flattened for the wire. `checked: false` covers
192
+ // every fail-open case that still has a license row to report on
193
+ // (unreachable license server, no KARDALUM_SITE_DOMAIN, no marketplace
194
+ // configured) — `status` and `lastValidatedAt` stay null in that shape
195
+ // since nothing was verified. A plugin with no license row at all gets a
196
+ // 404 instead of this body (ApiErrorSchema) — there's nothing to recheck.
197
+ export const LicenseRecheckResponseSchema = z.object({
198
+ pluginId: z.string(),
199
+ checked: z.boolean(),
200
+ status: z.string().nullable(),
201
+ reason: z.string().nullable(),
202
+ lastValidatedAt: z.string().nullable(),
203
+ });
204
+ // S284b (design 3.2): the host's latest licence verdict for a plugin, valid
205
+ // or not, handed to the plugin's own code unchanged so the plugin can verify
206
+ // the marketplace's signature itself. The envelope is the signed shape from
207
+ // @kardalum/plugin-package's LicenseVerdictEnvelope; a verdict is public
208
+ // and signed, never a secret (the licence key never appears in it, only its
209
+ // hash).
210
+ export const LicenseVerdictEnvelopeSchema = z.object({
211
+ v: z.literal(1),
212
+ alg: z.literal("ed25519"),
213
+ typ: z.literal("license-verdict"),
214
+ keyId: z.string(),
215
+ keyHash: z.string(),
216
+ pluginId: z.string(),
217
+ domain: z.string(),
218
+ nonce: z.string(),
219
+ status: z.enum(["valid", "invalid", "revoked"]),
220
+ // Absent and null mean the same thing to the signature (both canonicalize
221
+ // to null), so either is carried as stored.
222
+ reason: z.string().nullish(),
223
+ issuedAt: z.string(),
224
+ tamper: PluginTamperKindSchema.optional(),
225
+ // The signed human sentence explaining `reason` (a domain block's reason).
226
+ detail: z.string().max(500).optional(),
227
+ });
228
+ // The tagged entitlement (S284b fix wave), the same value plugin server code
229
+ // receives on `context.entitlement`: `exempt` on a non-production install
230
+ // (no licence rule applies, nothing is checked), `none` when the host holds
231
+ // no verdict for the plugin (the plugin's check refuses with `missing`), and
232
+ // `verdict` with the stored verdict to verify.
233
+ export const EntitlementSchema = z.discriminatedUnion("kind", [
234
+ z.object({ kind: z.literal("exempt"), reason: z.literal("non-production") }),
235
+ z.object({
236
+ kind: z.literal("verdict"),
237
+ envelope: LicenseVerdictEnvelopeSchema,
238
+ /** base64 Ed25519 signature over the envelope's canonical form. */
239
+ signature: z.string(),
240
+ }),
241
+ z.object({ kind: z.literal("none") }),
242
+ ]);
243
+ // GET /api/plugin-management/entitlement/:pluginId (any authenticated admin
244
+ // session; no permission beyond it, since a plugin view is gated by the
245
+ // plugin's own action): what `useEntitlement()` reads in a plugin's admin
246
+ // view. `valid` is the host's own check of the signature and the 14-day age
247
+ // (true for `exempt`, false for `none`), the answer a browser without
248
+ // WebCrypto Ed25519 falls back to. It means authentic and fresh, whatever
249
+ // the verdict's status: a revoked or invalid verdict is `valid: true` too,
250
+ // so `valid` is never an entitlement on its own.
251
+ export const EntitlementResponseSchema = z.object({
252
+ entitlement: EntitlementSchema,
253
+ valid: z.boolean(),
254
+ });
255
+ // The 403 a plugin API route answers when its handler throws the SDK's
256
+ // EntitlementError (`requireEntitlement` refused the verdict). `reason` is
257
+ // the SDK's EntitlementErrorCode.
258
+ export const EntitlementRefusalSchema = z.object({
259
+ code: z.literal("entitlement"),
260
+ reason: z.enum(["missing", "invalid-signature", "wrong-plugin", "not-valid", "expired"]),
261
+ message: z.string(),
262
+ });
263
+ // S154 Task 4: a plugin's structured-data snapshot GROUPS, derived from
264
+ // PluginStructuredSnapshot (GROUP BY snapshotGroupId) rather than tracked
265
+ // by their own table — see apps/server/src/plugins/snapshot-groups.ts for
266
+ // the derivation. takenAt is the group's earliest row's createdAt (every
267
+ // row in a group is written in one snapshotPluginTables() call, so in
268
+ // practice they're all within the same transaction-ish burst — min is a
269
+ // defensive, not load-bearing, choice). trigger rides along from Task 3's
270
+ // column ("uninstall", "restore", or null for pre-Task-3 rows). status
271
+ // compares the group's own tableNames against totalTableCount — the
272
+ // UNION of distinct tableNames across ALL of the plugin's snapshot rows,
273
+ // the only denominator that survives an uninstall (which deletes the
274
+ // PluginStructuredTable tracking rows, never the snapshots themselves).
275
+ export const SnapshotGroupSchema = z.object({
276
+ snapshotGroupId: z.string(),
277
+ takenAt: z.string(),
278
+ trigger: z.string().nullable(),
279
+ tableNames: z.array(z.string()),
280
+ totalTableCount: z.number().int(),
281
+ status: z.enum(["complete", "partial"]),
282
+ });
283
+ export const SnapshotGroupListQuerySchema = z.object({
284
+ cursor: z.string().uuid().optional(),
285
+ limit: z.coerce.number().int().min(1).max(100).default(50),
286
+ });
287
+ export const SnapshotGroupListResponseSchema = z.object({
288
+ pluginId: z.string(),
289
+ items: z.array(SnapshotGroupSchema), // newest first
290
+ nextCursor: z.string().nullable(),
291
+ });
292
+ // S154 Task 5: the UNION restore plan — the newest available snapshot copy
293
+ // of each DISTINCT table this plugin has ever snapshotted, chosen
294
+ // independently per table across every group (not "pick one group and use
295
+ // only its tables"). This is what makes restore recover from the S87
296
+ // retry wedge: no single group need be complete for a full restore to be
297
+ // possible, as long as every table appears in SOME group.
298
+ export const RestorePlanEntrySchema = z.object({
299
+ tableName: z.string(),
300
+ snapshotGroupId: z.string(),
301
+ groupTakenAt: z.string(),
302
+ });
303
+ // 409 payload for an unconfirmed restore — nothing has been touched yet,
304
+ // the plan is offered for the admin to review before confirming. planHash
305
+ // (S161, S154 rider) is a stable digest of this exact plan: the confirm
306
+ // request must echo it back, and the handler refuses to proceed if a fresh
307
+ // re-plan hashes differently (a snapshot landed between the operator
308
+ // seeing this plan and confirming it) — closing the requestRestorePlan ->
309
+ // confirmRestore TOCTOU. A mismatch response reuses this same schema, with
310
+ // a fresh plan/planHash and a message explaining the plan changed.
311
+ export const RestoreConfirmationRequiredSchema = z.object({
312
+ requiresConfirmation: z.literal(true),
313
+ plan: z.array(RestorePlanEntrySchema),
314
+ planHash: z.string(),
315
+ message: z.string(),
316
+ });
317
+ export const RestoreSucceededSchema = z.object({
318
+ // The pre-restore safety snapshot's group id — null only when the
319
+ // plugin had no live tracked tables to protect (restoring onto empty).
320
+ preRestoreSnapshotGroupId: z.string().nullable(),
321
+ restoredTables: z.array(z.string()),
322
+ });
323
+ // Same DELETE-body-null convention as UninstallPluginBodySchema above: an
324
+ // absent POST body lands as `null` (not `undefined`) once Fastify's
325
+ // validator substitutes for a genuinely missing payload, so `.nullish()`
326
+ // (not `.optional()`) is required for an absent body to validate at all.
327
+ // planHash (S161, S154 rider) is optional at the schema level only
328
+ // because the SAME body shape covers the unconfirmed call (`{}`, no plan
329
+ // to hash yet) — the route handler enforces it as effectively required
330
+ // whenever confirmRestore is true: a confirm with a missing or stale
331
+ // planHash is refused exactly the same way (409, fresh plan reissued).
332
+ export const RestoreBodySchema = z
333
+ .object({
334
+ confirmRestore: z.boolean().optional(),
335
+ planHash: z.string().optional(),
336
+ })
337
+ .nullish();
338
+ // The second install door (Task 4): POST /api/plugins/upload lands an
339
+ // admin-uploaded .zip through the same installPackageArchive spine the
340
+ // marketplace uses, but with no marketplace signature to check — trust is
341
+ // always the literal "unregistered" here, never the registry's own
342
+ // "verified" | "unverified" tier (ManagedPluginSchema.trustTier above).
343
+ // That tier answers "did a signature check pass"; `trust: "unregistered"`
344
+ // answers a different question this route always answers the same way:
345
+ // "this package carries no marketplace listing at all."
346
+ //
347
+ // `outcome` never mirrors RegisterLocalPluginResult's full union. A fresh
348
+ // upload reports "installed". Since S274c a newer version of an installed
349
+ // plugin updates it in place and reports "updated" (a verified plugin asks
350
+ // first, through the 409 TrustDowngradeConfirmationSchema). The same or an
351
+ // older version is refused with 409 before installPackageArchive runs, so
352
+ // "activated"/"already-active" (registerLocalPlugin's tolerant re-attach
353
+ // onto an existing row) are never the outcome of a successful upload, and
354
+ // an unsigned side-load can never silently replace a plugin at the same
355
+ // version.
356
+ export const PluginUploadResponseSchema = z.object({
357
+ pluginId: z.string(),
358
+ // S284 (D5): the plugin's display name from its manifest, the value its
359
+ // registry row stores as `name`, so the admin's toast names the plugin
360
+ // the way the plugins list does rather than by its id.
361
+ name: z.string(),
362
+ version: z.string(),
363
+ // S274c: a newer version of an installed plugin now updates it in place,
364
+ // so the outcome is "installed" or "updated" and `fromVersion` names the
365
+ // version an update replaced (null for a fresh install).
366
+ outcome: z.enum(["installed", "updated"]),
367
+ fromVersion: z.string().nullable(),
368
+ trust: z.literal("unregistered"),
369
+ // S277e: what the install did with the package's sample content. Absent
370
+ // for an update and for a package that ships none.
371
+ sampleContent: SampleContentOutcomeSchema.optional(),
372
+ });
373
+ /** S274c: the upload's confirmation travels as a query flag because the
374
+ * route reads only the multipart file part. */
375
+ export const PluginUploadQuerySchema = z.object({
376
+ confirmTrustDowngrade: z.enum(["true", "false"]).optional(),
377
+ });
378
+ /** The 400 an upload answers when the package fails the listing contract
379
+ * (README, cover and docs pages): every violation, one entry each, and
380
+ * `message` as the same list on one line for a caller that shows one. */
381
+ export const PackageRefusedSchema = z.object({
382
+ message: z.string(),
383
+ reasons: z.array(z.string()),
384
+ });
385
+ /** S274c: the 409 an upload over a verified plugin answers before it stores
386
+ * anything, until the retry carries confirmTrustDowngrade=true. */
387
+ export const TrustDowngradeConfirmationSchema = z.object({
388
+ requiresConfirmation: z.literal(true),
389
+ reason: z.literal("trust-downgrade"),
390
+ /** The installed plugin's display name, so the client can name it in its own language. */
391
+ pluginName: z.string(),
392
+ message: z.string(),
393
+ });
@@ -0,0 +1,22 @@
1
+ /** The contribution kinds that sit behind a named action. The SDK classifies
2
+ * these on its CONTRIBUTION_RULES table; its test pins that table to this
3
+ * list, so the two cannot drift apart silently. */
4
+ export declare const ACTION_GATED_CONTRIBUTION_KEYS: readonly ["adminSections", "railEntries", "dashboardWidgets", "settingsPages", "contentTreeActions", "editorToolbar", "apiRoutes"];
5
+ export interface ActionDeclarationIssue {
6
+ path: (string | number)[];
7
+ message: string;
8
+ }
9
+ export interface ActionDeclarationInput {
10
+ id: string;
11
+ actions?: ReadonlyArray<{
12
+ id: string;
13
+ label: string;
14
+ }>;
15
+ roles?: ReadonlyArray<{
16
+ id: string;
17
+ label: string;
18
+ actions: ReadonlyArray<string>;
19
+ }>;
20
+ contributions?: unknown;
21
+ }
22
+ export declare function checkActionDeclarations(manifest: ActionDeclarationInput): ActionDeclarationIssue[];
@@ -0,0 +1,87 @@
1
+ import { isPluginActionFor } from "./action.schema.js";
2
+ // S274b (spec D3): the one rule for what a plugin declares about actions,
3
+ // as plain data, so the SDK's manifest schema and the marketplace's
4
+ // submission gate run the same function. The rule is S273 section 3: every
5
+ // declared id in the plugin's namespace; the declared set equals the set the
6
+ // gated contributions reference (every gated kind, every entry, any route
7
+ // access); no two ids equal case-insensitively; each offer's actions a
8
+ // subset of the declared ids; no two offers sharing an id.
9
+ /** The contribution kinds that sit behind a named action. The SDK classifies
10
+ * these on its CONTRIBUTION_RULES table; its test pins that table to this
11
+ * list, so the two cannot drift apart silently. */
12
+ export const ACTION_GATED_CONTRIBUTION_KEYS = ["adminSections", "railEntries", "dashboardWidgets", "settingsPages", "contentTreeActions", "editorToolbar", "apiRoutes"];
13
+ function referencedActions(contributions) {
14
+ const referenced = new Set();
15
+ if (!contributions || typeof contributions !== "object")
16
+ return referenced;
17
+ const record = contributions;
18
+ for (const key of ACTION_GATED_CONTRIBUTION_KEYS) {
19
+ const entries = record[key];
20
+ if (!Array.isArray(entries))
21
+ continue;
22
+ for (const entry of entries) {
23
+ const action = entry?.action;
24
+ if (typeof action === "string")
25
+ referenced.add(action);
26
+ // S280: a section's own rail entries each name an action too. They
27
+ // are not a contribution key of their own, so they are read here,
28
+ // beside the section that carries them.
29
+ const rail = entry?.rail;
30
+ if (!Array.isArray(rail))
31
+ continue;
32
+ for (const railEntry of rail) {
33
+ const railAction = railEntry?.action;
34
+ if (typeof railAction === "string")
35
+ referenced.add(railAction);
36
+ }
37
+ }
38
+ }
39
+ return referenced;
40
+ }
41
+ export function checkActionDeclarations(manifest) {
42
+ const issues = [];
43
+ const referenced = referencedActions(manifest.contributions);
44
+ const declared = manifest.actions ?? [];
45
+ const declaredIds = new Set(declared.map((entry) => entry.id));
46
+ const seenExact = new Set();
47
+ const seenLower = new Map();
48
+ declared.forEach((entry, index) => {
49
+ const path = ["actions", index, "id"];
50
+ if (!isPluginActionFor(entry.id, manifest.id)) {
51
+ issues.push({ path, message: `declared action "${entry.id}" must be prefixed with this plugin's id "${manifest.id}."` });
52
+ }
53
+ if (!referenced.has(entry.id)) {
54
+ issues.push({ path, message: `declared action "${entry.id}" is not named by any contribution; a permission with no surface would be granted for nothing` });
55
+ }
56
+ if (seenExact.has(entry.id)) {
57
+ issues.push({ path, message: `declared action "${entry.id}" is declared more than once` });
58
+ }
59
+ else {
60
+ const earlier = seenLower.get(entry.id.toLowerCase());
61
+ if (earlier !== undefined) {
62
+ issues.push({ path, message: `declared actions "${earlier}" and "${entry.id}" differ only in case; MySQL's default collation would collide them in the primary key` });
63
+ }
64
+ seenExact.add(entry.id);
65
+ if (!seenLower.has(entry.id.toLowerCase()))
66
+ seenLower.set(entry.id.toLowerCase(), entry.id);
67
+ }
68
+ });
69
+ for (const action of referenced) {
70
+ if (!declaredIds.has(action)) {
71
+ issues.push({ path: ["actions"], message: `action "${action}" is named by a contribution but not declared in "actions"; declare it with a label so the install screen can show it` });
72
+ }
73
+ }
74
+ const offerIds = new Set();
75
+ (manifest.roles ?? []).forEach((offer, index) => {
76
+ if (offerIds.has(offer.id)) {
77
+ issues.push({ path: ["roles", index, "id"], message: `role offer "${offer.id}" is declared more than once` });
78
+ }
79
+ offerIds.add(offer.id);
80
+ offer.actions.forEach((action, actionIndex) => {
81
+ if (!declaredIds.has(action)) {
82
+ issues.push({ path: ["roles", index, "actions", actionIndex], message: `role offer "${offer.id}" grants "${action}", which this plugin does not declare` });
83
+ }
84
+ });
85
+ });
86
+ return issues;
87
+ }
@@ -0,0 +1,31 @@
1
+ import { z } from "zod";
2
+ export declare const PluginSchema: z.ZodObject<{
3
+ pluginId: z.ZodString;
4
+ name: z.ZodString;
5
+ type: z.ZodString;
6
+ version: z.ZodString;
7
+ trustTier: z.ZodString;
8
+ storageType: z.ZodString;
9
+ enabled: z.ZodBoolean;
10
+ remoteUrl: z.ZodNullable<z.ZodString>;
11
+ }, z.core.$strip>;
12
+ export type Plugin = z.infer<typeof PluginSchema>;
13
+ export declare const PluginListQuerySchema: z.ZodObject<{
14
+ cursor: z.ZodOptional<z.ZodString>;
15
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
16
+ }, z.core.$strip>;
17
+ export type PluginListQuery = z.infer<typeof PluginListQuerySchema>;
18
+ export declare const PluginListResponseSchema: z.ZodObject<{
19
+ items: z.ZodArray<z.ZodObject<{
20
+ pluginId: z.ZodString;
21
+ name: z.ZodString;
22
+ type: z.ZodString;
23
+ version: z.ZodString;
24
+ trustTier: z.ZodString;
25
+ storageType: z.ZodString;
26
+ enabled: z.ZodBoolean;
27
+ remoteUrl: z.ZodNullable<z.ZodString>;
28
+ }, z.core.$strip>>;
29
+ nextCursor: z.ZodNullable<z.ZodString>;
30
+ }, z.core.$strip>;
31
+ export type PluginListResponse = z.infer<typeof PluginListResponseSchema>;
@@ -0,0 +1,25 @@
1
+ import { z } from "zod";
2
+ // Read-side shape of a plugin_registry row — the ONLY consumer today is
3
+ // the admin's boot-time remote loader (kardalum dev, Session 79), but this
4
+ // is real, permanent infrastructure: any dynamically-installed plugin
5
+ // needs a way for the admin to discover it at boot, sandbox or not.
6
+ export const PluginSchema = z.object({
7
+ pluginId: z.string(),
8
+ name: z.string(),
9
+ type: z.string(),
10
+ version: z.string(),
11
+ trustTier: z.string(),
12
+ storageType: z.string(),
13
+ enabled: z.boolean(),
14
+ remoteUrl: z.string().nullable(),
15
+ });
16
+ // Cursor-paginated per the non-negotiable list-endpoint rule, mirroring
17
+ // DataTypeListResponseSchema's exact shape (data-type-api.schema.ts).
18
+ export const PluginListQuerySchema = z.object({
19
+ cursor: z.string().uuid().optional(),
20
+ limit: z.coerce.number().int().min(1).max(100).default(50),
21
+ });
22
+ export const PluginListResponseSchema = z.object({
23
+ items: z.array(PluginSchema),
24
+ nextCursor: z.string().uuid().nullable(),
25
+ });
@@ -0,0 +1,15 @@
1
+ import { z } from "zod";
2
+ export declare const PluginStorageParamsSchema: z.ZodObject<{
3
+ pluginId: z.ZodString;
4
+ contentId: z.ZodString;
5
+ fieldId: z.ZodString;
6
+ }, z.core.$strip>;
7
+ export type PluginStorageParams = z.infer<typeof PluginStorageParamsSchema>;
8
+ export declare const SetPluginFieldValueRequestSchema: z.ZodObject<{
9
+ value: z.ZodUnknown;
10
+ }, z.core.$strict>;
11
+ export type SetPluginFieldValueRequest = z.infer<typeof SetPluginFieldValueRequestSchema>;
12
+ export declare const PluginFieldValueResponseSchema: z.ZodObject<{
13
+ value: z.ZodUnknown;
14
+ }, z.core.$strip>;
15
+ export type PluginFieldValueResponse = z.infer<typeof PluginFieldValueResponseSchema>;
@@ -0,0 +1,24 @@
1
+ import { z } from "zod";
2
+ // SimpleStorageAPI's HTTP surface (Session 68) — the SimpleStorageAPI
3
+ // interface is get(contentId, fieldId) / set(contentId, fieldId, value),
4
+ // with pluginId made explicit here as a required 3rd param: this is the
5
+ // lower-level adapter/HTTP surface, not the plugin-facing SDK ergonomics
6
+ // (usePluginValue(), Session 70, resolves pluginId from React context and
7
+ // never asks a plugin author to pass it by hand).
8
+ // Matches FieldDefinition.id's shape (document-type.schema.ts) — same
9
+ // stable key, just scoped to one plugin's stored value for that field.
10
+ const FieldIdSchema = z.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/);
11
+ // Deliberately NOT plugin-sdk's stricter reverse-DNS pluginIdSchema:
12
+ // plugin-sdk depends on api-schemas, not the reverse, so it can't be
13
+ // imported here without a cycle.
14
+ const PluginIdSchema = z.string().min(1);
15
+ export const PluginStorageParamsSchema = z.object({
16
+ pluginId: PluginIdSchema,
17
+ contentId: z.string().uuid(),
18
+ fieldId: FieldIdSchema,
19
+ });
20
+ // `value` is z.unknown(), not a record — SimpleStorageAPI's value is
21
+ // untyped by design; a plugin can store a string, number, array, or
22
+ // object, not only key-value maps.
23
+ export const SetPluginFieldValueRequestSchema = z.object({ value: z.unknown() }).strict();
24
+ export const PluginFieldValueResponseSchema = z.object({ value: z.unknown() });