@kardalum/plugin-sdk 0.0.0-stage → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (332) hide show
  1. package/CHANGELOG.md +118 -0
  2. package/LICENSE +202 -0
  3. package/README.md +80 -2
  4. package/dist/admin-section-registry.d.ts +34 -0
  5. package/dist/admin-section-registry.js +49 -0
  6. package/dist/built-in-serializers.d.ts +3 -0
  7. package/dist/built-in-serializers.js +18 -0
  8. package/dist/built-in-settings-schemas.d.ts +14 -0
  9. package/dist/built-in-settings-schemas.js +225 -0
  10. package/dist/built-in-value-schemas.d.ts +4 -0
  11. package/dist/built-in-value-schemas.js +47 -0
  12. package/dist/built-ins.d.ts +1 -0
  13. package/dist/built-ins.js +257 -0
  14. package/dist/capabilities.d.ts +29 -0
  15. package/dist/capabilities.js +67 -0
  16. package/dist/data-type-plugin.d.ts +28 -0
  17. package/dist/data-type-plugin.js +1 -0
  18. package/dist/datatype-validation.d.ts +26 -0
  19. package/dist/datatype-validation.js +110 -0
  20. package/dist/datatypes-entry.d.ts +4 -0
  21. package/dist/datatypes-entry.js +18 -0
  22. package/dist/define-plugin.d.ts +25 -0
  23. package/dist/define-plugin.js +51 -0
  24. package/dist/entitlement-entry.d.ts +5 -0
  25. package/dist/entitlement-entry.js +24 -0
  26. package/dist/entitlement-gate.d.ts +36 -0
  27. package/dist/entitlement-gate.js +201 -0
  28. package/dist/entitlement-types.d.ts +39 -0
  29. package/dist/entitlement-types.js +1 -0
  30. package/dist/entitlement.d.ts +57 -0
  31. package/dist/entitlement.js +170 -0
  32. package/dist/host-entry.d.ts +1 -0
  33. package/dist/host-entry.js +11 -0
  34. package/dist/icon-name.d.ts +1 -0
  35. package/dist/icon-name.js +1 -0
  36. package/dist/icons.d.ts +2 -0
  37. package/dist/icons.js +10 -0
  38. package/dist/index.d.ts +28 -0
  39. package/dist/index.js +94 -0
  40. package/dist/license-verdict-keys.d.ts +18 -0
  41. package/dist/license-verdict-keys.js +26 -0
  42. package/dist/local-host.d.ts +3 -0
  43. package/dist/local-host.js +38 -0
  44. package/dist/manifest-entry.d.ts +8 -0
  45. package/dist/manifest-entry.js +13 -0
  46. package/dist/manifest-schema.d.ts +476 -0
  47. package/dist/manifest-schema.js +823 -0
  48. package/dist/manifest.d.ts +611 -0
  49. package/dist/manifest.js +86 -0
  50. package/dist/media/media-picker.d.ts +39 -0
  51. package/dist/media/media-picker.js +447 -0
  52. package/dist/media/upload-error.d.ts +12 -0
  53. package/dist/media/upload-error.js +30 -0
  54. package/dist/plugin-context.d.ts +82 -0
  55. package/dist/plugin-context.js +77 -0
  56. package/dist/plugin-screen-context.d.ts +71 -0
  57. package/dist/plugin-screen-context.js +41 -0
  58. package/dist/read-all-pages.d.ts +23 -0
  59. package/dist/read-all-pages.js +30 -0
  60. package/dist/register-built-ins.d.ts +1 -0
  61. package/dist/register-built-ins.js +41 -0
  62. package/dist/registry.d.ts +4 -0
  63. package/dist/registry.js +17 -0
  64. package/dist/rendition-eligibility.d.ts +24 -0
  65. package/dist/rendition-eligibility.js +40 -0
  66. package/dist/richtext/block-panel.d.ts +27 -0
  67. package/dist/richtext/block-panel.js +232 -0
  68. package/dist/richtext/extensions.d.ts +19 -0
  69. package/dist/richtext/extensions.js +56 -0
  70. package/dist/richtext/insert-menu.d.ts +24 -0
  71. package/dist/richtext/insert-menu.js +142 -0
  72. package/dist/richtext/kardalum-block.d.ts +33 -0
  73. package/dist/richtext/kardalum-block.js +282 -0
  74. package/dist/richtext/style-listbox.d.ts +10 -0
  75. package/dist/richtext/style-listbox.js +69 -0
  76. package/dist/richtext/text-style-class.d.ts +18 -0
  77. package/dist/richtext/text-style-class.js +36 -0
  78. package/dist/simple-storage-value-provider.d.ts +9 -0
  79. package/dist/simple-storage-value-provider.js +96 -0
  80. package/dist/structured-storage-types.d.ts +61 -0
  81. package/dist/structured-storage-types.js +11 -0
  82. package/dist/tailwind.d.ts +1 -0
  83. package/dist/tailwind.js +5 -0
  84. package/dist/tokens/system-dark.css +75 -0
  85. package/dist/tokens/tokens.css +239 -0
  86. package/dist/tokens/tokens.json +212 -0
  87. package/dist/tokens.d.ts +1 -0
  88. package/dist/tokens.js +11 -0
  89. package/dist/ui-entry.d.ts +5 -0
  90. package/dist/ui-entry.js +42 -0
  91. package/dist/views/content-list-preview.d.ts +1 -0
  92. package/dist/views/content-list-preview.js +14 -0
  93. package/dist/views/content-list-settings-view.d.ts +1 -0
  94. package/dist/views/content-list-settings-view.js +97 -0
  95. package/dist/views/content-list-view.d.ts +19 -0
  96. package/dist/views/content-list-view.js +248 -0
  97. package/dist/views/crop-view.d.ts +55 -0
  98. package/dist/views/crop-view.js +161 -0
  99. package/dist/views/date-range-view.d.ts +6 -0
  100. package/dist/views/date-range-view.js +55 -0
  101. package/dist/views/file-upload-view.d.ts +43 -0
  102. package/dist/views/file-upload-view.js +104 -0
  103. package/dist/views/html-code-editor.d.ts +10 -0
  104. package/dist/views/html-code-editor.js +101 -0
  105. package/dist/views/html-view.d.ts +3 -0
  106. package/dist/views/html-view.js +53 -0
  107. package/dist/views/image-view.d.ts +3 -0
  108. package/dist/views/image-view.js +372 -0
  109. package/dist/views/rich-text-view.d.ts +2 -0
  110. package/dist/views/rich-text-view.js +429 -0
  111. package/node_modules/@kardalum/api-schemas/LICENSE +202 -0
  112. package/node_modules/@kardalum/api-schemas/README.md +56 -0
  113. package/node_modules/@kardalum/api-schemas/dist/action.schema.d.ts +30 -0
  114. package/node_modules/@kardalum/api-schemas/dist/action.schema.js +88 -0
  115. package/node_modules/@kardalum/api-schemas/dist/api-error.schema.d.ts +17 -0
  116. package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +25 -0
  117. package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +93 -0
  118. package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +88 -0
  119. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.d.ts +89 -0
  120. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +60 -0
  121. package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +24 -0
  122. package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +47 -0
  123. package/node_modules/@kardalum/api-schemas/dist/auth.schema.d.ts +38 -0
  124. package/node_modules/@kardalum/api-schemas/dist/auth.schema.js +38 -0
  125. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +542 -0
  126. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +357 -0
  127. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +158 -0
  128. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +139 -0
  129. package/node_modules/@kardalum/api-schemas/dist/content-path.d.ts +125 -0
  130. package/node_modules/@kardalum/api-schemas/dist/content-path.js +260 -0
  131. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.d.ts +20 -0
  132. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +23 -0
  133. package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.d.ts +152 -0
  134. package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +82 -0
  135. package/node_modules/@kardalum/api-schemas/dist/content-version.schema.d.ts +18 -0
  136. package/node_modules/@kardalum/api-schemas/dist/content-version.schema.js +22 -0
  137. package/node_modules/@kardalum/api-schemas/dist/content.schema.d.ts +17 -0
  138. package/node_modules/@kardalum/api-schemas/dist/content.schema.js +20 -0
  139. package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +352 -0
  140. package/node_modules/@kardalum/api-schemas/dist/core-actions.js +133 -0
  141. package/node_modules/@kardalum/api-schemas/dist/culture-direction.d.ts +1 -0
  142. package/node_modules/@kardalum/api-schemas/dist/culture-direction.js +9 -0
  143. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +37 -0
  144. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +32 -0
  145. package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.d.ts +9 -0
  146. package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +32 -0
  147. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +298 -0
  148. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +138 -0
  149. package/node_modules/@kardalum/api-schemas/dist/document-type.schema.d.ts +121 -0
  150. package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +147 -0
  151. package/node_modules/@kardalum/api-schemas/dist/health.schema.d.ts +6 -0
  152. package/node_modules/@kardalum/api-schemas/dist/health.schema.js +5 -0
  153. package/node_modules/@kardalum/api-schemas/dist/html-entities.d.ts +4 -0
  154. package/node_modules/@kardalum/api-schemas/dist/html-entities.js +250 -0
  155. package/node_modules/@kardalum/api-schemas/dist/index.d.ts +113 -0
  156. package/node_modules/@kardalum/api-schemas/dist/index.js +64 -0
  157. package/node_modules/@kardalum/api-schemas/dist/licensing.schema.d.ts +15 -0
  158. package/node_modules/@kardalum/api-schemas/dist/licensing.schema.js +14 -0
  159. package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.d.ts +73 -0
  160. package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.js +104 -0
  161. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +682 -0
  162. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +269 -0
  163. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +177 -0
  164. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +222 -0
  165. package/node_modules/@kardalum/api-schemas/dist/media-reference-api.schema.d.ts +77 -0
  166. package/node_modules/@kardalum/api-schemas/dist/media-reference-api.schema.js +53 -0
  167. package/node_modules/@kardalum/api-schemas/dist/media-reference-use.d.ts +75 -0
  168. package/node_modules/@kardalum/api-schemas/dist/media-reference-use.js +117 -0
  169. package/node_modules/@kardalum/api-schemas/dist/media-reference.d.ts +27 -0
  170. package/node_modules/@kardalum/api-schemas/dist/media-reference.js +279 -0
  171. package/node_modules/@kardalum/api-schemas/dist/media-rendition.schema.d.ts +74 -0
  172. package/node_modules/@kardalum/api-schemas/dist/media-rendition.schema.js +157 -0
  173. package/node_modules/@kardalum/api-schemas/dist/media.schema.d.ts +80 -0
  174. package/node_modules/@kardalum/api-schemas/dist/media.schema.js +156 -0
  175. package/node_modules/@kardalum/api-schemas/dist/nav.schema.d.ts +23 -0
  176. package/node_modules/@kardalum/api-schemas/dist/nav.schema.js +55 -0
  177. package/node_modules/@kardalum/api-schemas/dist/node-access.schema.d.ts +846 -0
  178. package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +356 -0
  179. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +20 -0
  180. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +27 -0
  181. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +249 -0
  182. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +84 -0
  183. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-text.d.ts +65 -0
  184. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-text.js +889 -0
  185. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +172 -0
  186. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +196 -0
  187. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +31 -0
  188. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +38 -0
  189. package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +69 -0
  190. package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +59 -0
  191. package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +585 -0
  192. package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +536 -0
  193. package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +75 -0
  194. package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +213 -0
  195. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +391 -0
  196. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +413 -0
  197. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +29 -0
  198. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +100 -0
  199. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +44 -0
  200. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +162 -0
  201. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.d.ts +31 -0
  202. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +25 -0
  203. package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.d.ts +15 -0
  204. package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.js +24 -0
  205. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +314 -0
  206. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +338 -0
  207. package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +79 -0
  208. package/node_modules/@kardalum/api-schemas/dist/render-editing.js +50 -0
  209. package/node_modules/@kardalum/api-schemas/dist/render-settings-api.schema.d.ts +9 -0
  210. package/node_modules/@kardalum/api-schemas/dist/render-settings-api.schema.js +13 -0
  211. package/node_modules/@kardalum/api-schemas/dist/reserved-slugs.d.ts +2 -0
  212. package/node_modules/@kardalum/api-schemas/dist/reserved-slugs.js +16 -0
  213. package/node_modules/@kardalum/api-schemas/dist/role.schema.d.ts +96 -0
  214. package/node_modules/@kardalum/api-schemas/dist/role.schema.js +75 -0
  215. package/node_modules/@kardalum/api-schemas/dist/sample-content-outcome.schema.d.ts +17 -0
  216. package/node_modules/@kardalum/api-schemas/dist/sample-content-outcome.schema.js +27 -0
  217. package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +35 -0
  218. package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +79 -0
  219. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +138 -0
  220. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +105 -0
  221. package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +243 -0
  222. package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +296 -0
  223. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +47 -0
  224. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.js +27 -0
  225. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +30 -0
  226. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.js +19 -0
  227. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +112 -0
  228. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +74 -0
  229. package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +41 -0
  230. package/node_modules/@kardalum/api-schemas/dist/template.schema.js +39 -0
  231. package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.d.ts +21 -0
  232. package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.js +14 -0
  233. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +97 -0
  234. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +73 -0
  235. package/node_modules/@kardalum/api-schemas/package.json +35 -0
  236. package/node_modules/@kardalum/design-tokens/LICENSE +202 -0
  237. package/node_modules/@kardalum/design-tokens/README.md +29 -0
  238. package/node_modules/@kardalum/design-tokens/dist/build-css.d.ts +32 -0
  239. package/node_modules/@kardalum/design-tokens/dist/build-css.js +88 -0
  240. package/node_modules/@kardalum/design-tokens/dist/generate.d.ts +1 -0
  241. package/node_modules/@kardalum/design-tokens/dist/generate.js +18 -0
  242. package/node_modules/@kardalum/design-tokens/dist/index.d.ts +6 -0
  243. package/node_modules/@kardalum/design-tokens/dist/index.js +4 -0
  244. package/node_modules/@kardalum/design-tokens/dist/system-dark.css +75 -0
  245. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +33 -0
  246. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +54 -0
  247. package/node_modules/@kardalum/design-tokens/dist/theme-css.d.ts +12 -0
  248. package/node_modules/@kardalum/design-tokens/dist/theme-css.js +42 -0
  249. package/node_modules/@kardalum/design-tokens/dist/theme-types.d.ts +43 -0
  250. package/node_modules/@kardalum/design-tokens/dist/theme-types.js +1 -0
  251. package/node_modules/@kardalum/design-tokens/dist/themes/dark.d.ts +13 -0
  252. package/node_modules/@kardalum/design-tokens/dist/themes/dark.js +120 -0
  253. package/node_modules/@kardalum/design-tokens/dist/themes/index.d.ts +5 -0
  254. package/node_modules/@kardalum/design-tokens/dist/themes/index.js +4 -0
  255. package/node_modules/@kardalum/design-tokens/dist/themes/light.d.ts +9 -0
  256. package/node_modules/@kardalum/design-tokens/dist/themes/light.js +13 -0
  257. package/node_modules/@kardalum/design-tokens/dist/tokens.css +239 -0
  258. package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +25 -0
  259. package/node_modules/@kardalum/design-tokens/dist/tokens.js +276 -0
  260. package/node_modules/@kardalum/design-tokens/dist/tokens.json +212 -0
  261. package/node_modules/@kardalum/design-tokens/dist/types.d.ts +91 -0
  262. package/node_modules/@kardalum/design-tokens/dist/types.js +5 -0
  263. package/node_modules/@kardalum/design-tokens/package.json +42 -0
  264. package/node_modules/@kardalum/plugin-package/LICENSE +202 -0
  265. package/node_modules/@kardalum/plugin-package/README.md +71 -0
  266. package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +111 -0
  267. package/node_modules/@kardalum/plugin-package/dist/build-reference.js +61 -0
  268. package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +103 -0
  269. package/node_modules/@kardalum/plugin-package/dist/capabilities.js +351 -0
  270. package/node_modules/@kardalum/plugin-package/dist/docs-contract.d.ts +50 -0
  271. package/node_modules/@kardalum/plugin-package/dist/docs-contract.js +659 -0
  272. package/node_modules/@kardalum/plugin-package/dist/envelope.d.ts +19 -0
  273. package/node_modules/@kardalum/plugin-package/dist/envelope.js +104 -0
  274. package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +37 -0
  275. package/node_modules/@kardalum/plugin-package/dist/extract.js +199 -0
  276. package/node_modules/@kardalum/plugin-package/dist/hash.d.ts +17 -0
  277. package/node_modules/@kardalum/plugin-package/dist/hash.js +69 -0
  278. package/node_modules/@kardalum/plugin-package/dist/index.d.ts +13 -0
  279. package/node_modules/@kardalum/plugin-package/dist/index.js +8 -0
  280. package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +185 -0
  281. package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +236 -0
  282. package/node_modules/@kardalum/plugin-package/dist/package-contract.d.ts +50 -0
  283. package/node_modules/@kardalum/plugin-package/dist/package-contract.js +115 -0
  284. package/node_modules/@kardalum/plugin-package/dist/reference-entry.d.ts +2 -0
  285. package/node_modules/@kardalum/plugin-package/dist/reference-entry.js +6 -0
  286. package/node_modules/@kardalum/plugin-package/dist/sample-content.d.ts +20 -0
  287. package/node_modules/@kardalum/plugin-package/dist/sample-content.js +57 -0
  288. package/node_modules/@kardalum/plugin-package/dist/types.d.ts +43 -0
  289. package/node_modules/@kardalum/plugin-package/dist/types.js +15 -0
  290. package/node_modules/@kardalum/plugin-package/package.json +54 -0
  291. package/node_modules/@kardalum/ui/LICENSE +202 -0
  292. package/node_modules/@kardalum/ui/README.md +35 -0
  293. package/node_modules/@kardalum/ui/dist/components/alert-dialog.d.ts +14 -0
  294. package/node_modules/@kardalum/ui/dist/components/alert-dialog.js +38 -0
  295. package/node_modules/@kardalum/ui/dist/components/badge.d.ts +9 -0
  296. package/node_modules/@kardalum/ui/dist/components/badge.js +30 -0
  297. package/node_modules/@kardalum/ui/dist/components/button.d.ts +11 -0
  298. package/node_modules/@kardalum/ui/dist/components/button.js +37 -0
  299. package/node_modules/@kardalum/ui/dist/components/checkbox.d.ts +5 -0
  300. package/node_modules/@kardalum/ui/dist/components/checkbox.js +7 -0
  301. package/node_modules/@kardalum/ui/dist/components/dialog.d.ts +17 -0
  302. package/node_modules/@kardalum/ui/dist/components/dialog.js +48 -0
  303. package/node_modules/@kardalum/ui/dist/components/dropdown-menu.d.ts +18 -0
  304. package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +53 -0
  305. package/node_modules/@kardalum/ui/dist/components/empty-state.d.ts +30 -0
  306. package/node_modules/@kardalum/ui/dist/components/empty-state.js +9 -0
  307. package/node_modules/@kardalum/ui/dist/components/input.d.ts +4 -0
  308. package/node_modules/@kardalum/ui/dist/components/input.js +6 -0
  309. package/node_modules/@kardalum/ui/dist/components/panel.d.ts +5 -0
  310. package/node_modules/@kardalum/ui/dist/components/panel.js +6 -0
  311. package/node_modules/@kardalum/ui/dist/components/property-field.d.ts +19 -0
  312. package/node_modules/@kardalum/ui/dist/components/property-field.js +89 -0
  313. package/node_modules/@kardalum/ui/dist/components/sheet.d.ts +17 -0
  314. package/node_modules/@kardalum/ui/dist/components/sheet.js +55 -0
  315. package/node_modules/@kardalum/ui/dist/components/skeleton.d.ts +3 -0
  316. package/node_modules/@kardalum/ui/dist/components/skeleton.js +9 -0
  317. package/node_modules/@kardalum/ui/dist/components/switch.d.ts +5 -0
  318. package/node_modules/@kardalum/ui/dist/components/switch.js +7 -0
  319. package/node_modules/@kardalum/ui/dist/components/tab-strip.d.ts +34 -0
  320. package/node_modules/@kardalum/ui/dist/components/tab-strip.js +72 -0
  321. package/node_modules/@kardalum/ui/dist/components/toast.d.ts +18 -0
  322. package/node_modules/@kardalum/ui/dist/components/toast.js +42 -0
  323. package/node_modules/@kardalum/ui/dist/components/toaster.d.ts +12 -0
  324. package/node_modules/@kardalum/ui/dist/components/toaster.js +11 -0
  325. package/node_modules/@kardalum/ui/dist/components/use-toast.d.ts +17 -0
  326. package/node_modules/@kardalum/ui/dist/components/use-toast.js +62 -0
  327. package/node_modules/@kardalum/ui/dist/index.d.ts +18 -0
  328. package/node_modules/@kardalum/ui/dist/index.js +18 -0
  329. package/node_modules/@kardalum/ui/dist/lib/cn.d.ts +2 -0
  330. package/node_modules/@kardalum/ui/dist/lib/cn.js +5 -0
  331. package/node_modules/@kardalum/ui/package.json +63 -0
  332. package/package.json +146 -4
@@ -0,0 +1,236 @@
1
+ import { createHash, createPrivateKey, createPublicKey, randomBytes, sign, verify } from "node:crypto";
2
+ import { deriveKeyId } from "./envelope.js";
3
+ /** The longest `detail` a verdict may carry. */
4
+ export const LICENSE_VERDICT_DETAIL_MAX = 500;
5
+ const TAMPER_KINDS = ["foreign-package", "sideloaded", "modified-on-disk"];
6
+ /** A cheap SECONDARY bound only — the nonce (see `createLicenseChallenge`'s
7
+ * doc comment) is what actually stops replay, and it does so completely:
8
+ * a captured verdict cannot answer a challenge it never saw, regardless of
9
+ * how wide this window is. This check exists purely to reject an obviously
10
+ * stale or forged `issuedAt`, and it is symmetric (a future-dated
11
+ * `issuedAt` is rejected too) but, on its own, a check against `now` can
12
+ * always be defeated by controlling `now`.
13
+ *
14
+ * Widened from 5 minutes to 24 hours (S209 criticals fix): a five-minute
15
+ * window bought no real security — the nonce already closes the gap this
16
+ * was guarding — but it did fail a paying customer's install outright the
17
+ * moment their clock drifted more than five minutes from real time (a
18
+ * sleeping Docker VM, an un-NTP'd VPS), turning `verifyLicenseVerdict` into
19
+ * `unverifiable: stale` and the whole install into a failure with no
20
+ * security payoff. 24 hours easily survives that kind of drift while still
21
+ * rejecting a genuinely stale or forged envelope. */
22
+ export const MAX_VERDICT_AGE_MS = 24 * 60 * 60_000;
23
+ /** How old a verdict may be before a plugin's own entitlement check stops
24
+ * accepting it: the 14-day grace period (S284b). Measured from the
25
+ * verifier's `now`; the plugin's floor is what keeps a rewound clock from
26
+ * stretching it. */
27
+ export const ENTITLEMENT_MAX_AGE_MS = 14 * 24 * 60 * 60_000;
28
+ export function hashLicenseKey(key) {
29
+ return createHash("sha256").update(key, "utf8").digest("hex");
30
+ }
31
+ /** Consumption tracking for issued challenges. Module-private: the only
32
+ * way to add an entry is to call `verifyLicenseVerdict`, and the only way
33
+ * to obtain a `LicenseChallenge` to add is to call
34
+ * `createLicenseChallenge`. Nothing outside this file can mark a
35
+ * challenge used, unused, or forge a fresh-looking one. */
36
+ const consumedChallenges = new WeakSet();
37
+ /** Starts a licence validation round trip. Returns a challenge carrying
38
+ * both the subject being validated and a freshly generated nonce — the
39
+ * caller sends the whole thing (or at least its `nonce`) to the
40
+ * marketplace, which echoes the nonce into the signed envelope it
41
+ * produces. The caller then passes this same challenge to
42
+ * `verifyLicenseVerdict`, so the subject and the nonce it gets checked
43
+ * against can never come from two different places and drift apart.
44
+ *
45
+ * Each challenge verifies at most once — see `LicenseChallenge`'s doc
46
+ * comment. Call this again for every new validation attempt; do not cache
47
+ * or reuse a challenge (or its nonce) across requests. */
48
+ export function createLicenseChallenge(subject) {
49
+ return Object.freeze({
50
+ keyHash: subject.keyHash,
51
+ pluginId: subject.pluginId,
52
+ domain: subject.domain,
53
+ nonce: randomBytes(16).toString("hex"),
54
+ });
55
+ }
56
+ /** Explicit field order, exactly like canonicalizeEnvelope — never
57
+ * JSON.stringify of the object itself, whose key order is not guaranteed
58
+ * across producers. `tamper` and then `detail` are appended last and only
59
+ * when present, so an envelope without them produces exactly the bytes it
60
+ * did before the fields existed (pinned by a test): old signatures keep
61
+ * verifying. */
62
+ export function canonicalizeLicenseVerdict(envelope) {
63
+ return Buffer.from(JSON.stringify({
64
+ v: envelope.v,
65
+ alg: envelope.alg,
66
+ typ: envelope.typ,
67
+ keyId: envelope.keyId,
68
+ keyHash: envelope.keyHash,
69
+ pluginId: envelope.pluginId,
70
+ domain: envelope.domain,
71
+ nonce: envelope.nonce,
72
+ status: envelope.status,
73
+ reason: envelope.reason ?? null,
74
+ issuedAt: envelope.issuedAt,
75
+ ...(envelope.tamper !== undefined ? { tamper: envelope.tamper } : {}),
76
+ ...(envelope.detail !== undefined ? { detail: envelope.detail } : {}),
77
+ }), "utf8");
78
+ }
79
+ export function signLicenseVerdict(envelope, privateKeyBase64) {
80
+ const key = createPrivateKey({ key: Buffer.from(privateKeyBase64, "base64"), format: "der", type: "pkcs8" });
81
+ return sign(null, canonicalizeLicenseVerdict(envelope), key).toString("base64");
82
+ }
83
+ function isEnvelope(value) {
84
+ if (typeof value !== "object" || value === null)
85
+ return false;
86
+ const e = value;
87
+ return (e.v === 1 &&
88
+ e.alg === "ed25519" &&
89
+ e.typ === "license-verdict" &&
90
+ typeof e.keyId === "string" &&
91
+ typeof e.keyHash === "string" &&
92
+ typeof e.pluginId === "string" &&
93
+ typeof e.domain === "string" &&
94
+ typeof e.nonce === "string" &&
95
+ (e.status === "valid" || e.status === "invalid" || e.status === "revoked") &&
96
+ // A licence server that naturally serialises `reason: row.reason ??
97
+ // null` must not be misread as malformed — null and "absent" mean the
98
+ // same thing here, and are normalized to undefined below once the
99
+ // signature has been checked.
100
+ (e.reason === undefined || e.reason === null || typeof e.reason === "string") &&
101
+ typeof e.issuedAt === "string" &&
102
+ (e.tamper === undefined || (typeof e.tamper === "string" && TAMPER_KINDS.includes(e.tamper))) &&
103
+ (e.detail === undefined || (typeof e.detail === "string" && e.detail.length <= LICENSE_VERDICT_DETAIL_MAX)));
104
+ }
105
+ function isSigned(value) {
106
+ if (typeof value !== "object" || value === null)
107
+ return false;
108
+ const s = value;
109
+ return typeof s.signature === "string" && s.signature.length > 0 && isEnvelope(s.envelope);
110
+ }
111
+ /** The key lookup and signature check, shared by `verifyLicenseVerdict` and
112
+ * `verifyLicenseVerdictSignature` so there is one definition of "authentic". */
113
+ function checkSignature(envelope, signature, trustedKeys) {
114
+ // Re-derive rather than trust the label, exactly as trusted-keys.ts does:
115
+ // an unauthenticated keyId would otherwise let a signature made by one
116
+ // key be attributed to another.
117
+ const match = trustedKeys.find((k) => {
118
+ try {
119
+ return deriveKeyId(k.publicKey) === envelope.keyId;
120
+ }
121
+ catch {
122
+ return false;
123
+ }
124
+ });
125
+ if (!match)
126
+ return "untrusted-key";
127
+ try {
128
+ const ok = verify(null, canonicalizeLicenseVerdict(envelope), createPublicKey({ key: Buffer.from(match.publicKey, "base64"), format: "der", type: "spki" }), Buffer.from(signature, "base64"));
129
+ return ok ? "ok" : "bad-signature";
130
+ }
131
+ catch {
132
+ return "bad-signature";
133
+ }
134
+ }
135
+ /** Rebuild from only the signed fields rather than returning the caller's
136
+ * object verbatim, so an extra unsigned property the server happened to
137
+ * attach cannot ride along on a result labelled verified. This also
138
+ * normalizes a `reason: null` producer to `undefined`, matching the type,
139
+ * and leaves `tamper` and `detail` out entirely when the envelope had
140
+ * none. */
141
+ function signedFieldsOnly(envelope) {
142
+ return {
143
+ v: envelope.v,
144
+ alg: envelope.alg,
145
+ typ: envelope.typ,
146
+ keyId: envelope.keyId,
147
+ keyHash: envelope.keyHash,
148
+ pluginId: envelope.pluginId,
149
+ domain: envelope.domain,
150
+ nonce: envelope.nonce,
151
+ status: envelope.status,
152
+ reason: envelope.reason ?? undefined,
153
+ issuedAt: envelope.issuedAt,
154
+ ...(envelope.tamper !== undefined ? { tamper: envelope.tamper } : {}),
155
+ ...(envelope.detail !== undefined ? { detail: envelope.detail } : {}),
156
+ };
157
+ }
158
+ /** Verifies a verdict the way a plugin can: the signature against a trusted
159
+ * key, the shape, the `typ`, and `issuedAt` neither older than `maxAgeMs`
160
+ * (default `ENTITLEMENT_MAX_AGE_MS`) before `now` nor later than
161
+ * `MAX_VERDICT_AGE_MS` after it. It does NOT check the nonce, the domain or
162
+ * the key hash: the nonce guards the host's request to the marketplace, and
163
+ * a plugin re-verifying the host's stored verdict never saw that challenge.
164
+ * An authentic `invalid` or `revoked` verdict is `ok: true`; what `status`
165
+ * means is the caller's decision. An unparseable `issuedAt` is `malformed`. */
166
+ export function verifyLicenseVerdictSignature(signed, trustedKeys, opts = {}) {
167
+ if (!isSigned(signed))
168
+ return { ok: false, reason: "malformed" };
169
+ const { envelope, signature } = signed;
170
+ const authentic = checkSignature(envelope, signature, trustedKeys);
171
+ if (authentic === "untrusted-key")
172
+ return { ok: false, reason: "unknown-key" };
173
+ if (authentic === "bad-signature")
174
+ return { ok: false, reason: "bad-signature" };
175
+ const issued = Date.parse(envelope.issuedAt);
176
+ if (!Number.isFinite(issued))
177
+ return { ok: false, reason: "malformed" };
178
+ const nowMs = (opts.now ?? new Date()).getTime();
179
+ const maxAgeMs = opts.maxAgeMs ?? ENTITLEMENT_MAX_AGE_MS;
180
+ if (issued > nowMs + MAX_VERDICT_AGE_MS)
181
+ return { ok: false, reason: "future" };
182
+ if (nowMs - issued > maxAgeMs)
183
+ return { ok: false, reason: "expired" };
184
+ return { ok: true, envelope: signedFieldsOnly(envelope) };
185
+ }
186
+ export function verifyLicenseVerdict(signedVerdict, challenge, trustedKeys, now = new Date()) {
187
+ // A challenge answers at most one question. Consuming it here (before
188
+ // any other check, and regardless of what this call ultimately returns)
189
+ // means a caller cannot probe the same challenge with a sequence of
190
+ // different candidate verdicts, and a caller that legitimately needs to
191
+ // retry is forced to ask a new question (a new challenge) rather than
192
+ // reuse this one.
193
+ if (consumedChallenges.has(challenge)) {
194
+ return { verdict: "unverifiable", reason: "challenge-reused" };
195
+ }
196
+ consumedChallenges.add(challenge);
197
+ if (!isSigned(signedVerdict))
198
+ return { verdict: "unverifiable", reason: "malformed" };
199
+ const { envelope, signature } = signedVerdict;
200
+ const authentic = checkSignature(envelope, signature, trustedKeys);
201
+ if (authentic === "untrusted-key")
202
+ return { verdict: "unverifiable", reason: "untrusted-key" };
203
+ if (authentic === "bad-signature")
204
+ return { verdict: "unverifiable", reason: "bad-signature" };
205
+ // Subject binding. Without this a single genuine "valid" verdict, once
206
+ // captured, would unlock every plugin on every domain — and without the
207
+ // nonce comparison specifically, it would unlock every future request
208
+ // too, regardless of issuedAt. A verdict answering a different challenge
209
+ // is exactly as wrong as one for a different plugin.
210
+ if (envelope.keyHash !== challenge.keyHash ||
211
+ envelope.pluginId !== challenge.pluginId ||
212
+ envelope.domain !== challenge.domain ||
213
+ envelope.nonce !== challenge.nonce) {
214
+ return { verdict: "unverifiable", reason: "subject-mismatch" };
215
+ }
216
+ // Symmetric on purpose: a future-dated issuedAt is just as much a lie as
217
+ // a stale one, and one-sided staleness checks pass it forever.
218
+ const issued = Date.parse(envelope.issuedAt);
219
+ if (!Number.isFinite(issued) || Math.abs(now.getTime() - issued) > MAX_VERDICT_AGE_MS) {
220
+ return { verdict: "unverifiable", reason: "stale" };
221
+ }
222
+ const verifiedEnvelope = signedFieldsOnly(envelope);
223
+ // Authentication is done; now, and only now, does the envelope's own
224
+ // `status` decide the verdict. `"valid"` is the sole branch a caller can
225
+ // use to unlock something — `"invalid"` and `"revoked"` are just as
226
+ // authentic but must never reach an `unlock()` call.
227
+ if (verifiedEnvelope.status === "valid") {
228
+ return { verdict: "licensed", envelope: verifiedEnvelope };
229
+ }
230
+ return {
231
+ verdict: "unlicensed",
232
+ status: verifiedEnvelope.status,
233
+ reason: verifiedEnvelope.reason,
234
+ envelope: verifiedEnvelope,
235
+ };
236
+ }
@@ -0,0 +1,50 @@
1
+ export declare const COVER_PATH = "marketplace/cover.png";
2
+ export declare const COVER_WIDTH = 1200;
3
+ export declare const COVER_HEIGHT = 630;
4
+ /** Width/height from a PNG's IHDR, or null when the bytes are not a PNG.
5
+ * Reading the header directly avoids an image dependency for what is two
6
+ * big-endian integers at fixed offsets. */
7
+ export declare function pngSize(bytes: Buffer): {
8
+ width: number;
9
+ height: number;
10
+ } | null;
11
+ export type PackageContractCheck = {
12
+ ok: true;
13
+ } | {
14
+ ok: false;
15
+ reason: string;
16
+ reasons: string[];
17
+ };
18
+ /** The door-level gate's answer: the README, cover and docs verdict, with
19
+ * the docs contract's warnings beside it. A warning never refuses. */
20
+ export type PackageContractResult = PackageContractCheck & {
21
+ warnings: string[];
22
+ };
23
+ /**
24
+ * <dir>/README.md must exist and contain something other than whitespace —
25
+ * a file that exists but says nothing is worse than none: it would render
26
+ * as a blank listing description in the marketplace.
27
+ */
28
+ export declare function checkReadmeContract(dir: string): PackageContractCheck;
29
+ /**
30
+ * <dir>/marketplace/cover.png must exist, be a real PNG, and be exactly
31
+ * COVER_WIDTH x COVER_HEIGHT — the marketplace grid renders every listing's
32
+ * cover at a fixed aspect, so anything else would be cropped or distorted.
33
+ * The failure reason names both the required size and the size found,
34
+ * since "wrong size" without the numbers makes a developer guess.
35
+ */
36
+ export declare function checkCoverContract(dir: string): PackageContractCheck;
37
+ /**
38
+ * The combined door-level gate. It reports every violation, because an author
39
+ * fixing a package should see the whole list in one run: the README's, the
40
+ * cover's, and, when the package has a manifest.json, the docs contract's
41
+ * (a package with no manifest.json is reported by each caller itself).
42
+ * `reason` is the first of `reasons`, for callers that show one line.
43
+ * It runs on a package nobody has vetted, so a wrong shape (a directory where
44
+ * a file belongs, a file where `docs` belongs) is a violation, never an
45
+ * exception, and the list is capped at MAX_VIOLATIONS lines, the last one
46
+ * counting the rest.
47
+ * Callers that need each rule's independent pass/fail (kardalum plugin's
48
+ * `validate` report) call checkReadmeContract and checkCoverContract directly.
49
+ */
50
+ export declare function checkPackageContract(dir: string): PackageContractResult;
@@ -0,0 +1,115 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { capViolations, checkDocsContract, isFile, readDocsContractInput } from "./docs-contract.js";
4
+ // S206 Task 4: the marketplace-listing contract — a non-empty README.md
5
+ // plus a fixed-size cover image: used to live only in kardalum plugin's CLI
6
+ // (packages/cli/src/plugin/checks/package-contract.ts), a dev-machine
7
+ // package apps/server can't import from. Moved here because
8
+ // @kardalum/plugin-package is the one package apps/server, apps/marketplace,
9
+ // AND kardalum plugin all already depend on: one implementation, no second
10
+ // place to keep in sync. kardalum plugin's checks/package-contract.ts now
11
+ // delegates to checkReadmeContract/checkCoverContract below rather than
12
+ // keeping its own copy — see that file for why its two exports keep their
13
+ // original names, CheckResult shape, and exact failure messages (its own
14
+ // tests, and `kardalum plugin validate`'s output, depend on them).
15
+ //
16
+ // checkPackageContract is the door-level gate: the server's upload route
17
+ // (apps/server/src/routes/plugin-upload.ts) just needs "does this package
18
+ // qualify, and if not, why" — it has no use for which of the two rules
19
+ // failed independently the way kardalum plugin's per-check report does.
20
+ export const COVER_PATH = "marketplace/cover.png";
21
+ export const COVER_WIDTH = 1200;
22
+ export const COVER_HEIGHT = 630;
23
+ const PNG_SIGNATURE = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
24
+ /** Width/height from a PNG's IHDR, or null when the bytes are not a PNG.
25
+ * Reading the header directly avoids an image dependency for what is two
26
+ * big-endian integers at fixed offsets. */
27
+ export function pngSize(bytes) {
28
+ if (bytes.length < 24 || !bytes.subarray(0, 8).equals(PNG_SIGNATURE))
29
+ return null;
30
+ return { width: bytes.readUInt32BE(16), height: bytes.readUInt32BE(20) };
31
+ }
32
+ function fail(reasons) {
33
+ return { ok: false, reason: reasons[0], reasons };
34
+ }
35
+ /**
36
+ * <dir>/README.md must exist and contain something other than whitespace —
37
+ * a file that exists but says nothing is worse than none: it would render
38
+ * as a blank listing description in the marketplace.
39
+ */
40
+ export function checkReadmeContract(dir) {
41
+ const filePath = join(dir, "README.md");
42
+ if (!existsSync(filePath)) {
43
+ return fail(["README.md is missing: required for the marketplace listing"]);
44
+ }
45
+ // A directory of that name is not a README, and reading it would throw.
46
+ if (!isFile(filePath)) {
47
+ return fail(["README.md is not a file"]);
48
+ }
49
+ const content = readFileSync(filePath, "utf8");
50
+ if (content.trim().length === 0) {
51
+ return fail(["README.md is empty: it would render as a blank listing description"]);
52
+ }
53
+ return { ok: true };
54
+ }
55
+ /**
56
+ * <dir>/marketplace/cover.png must exist, be a real PNG, and be exactly
57
+ * COVER_WIDTH x COVER_HEIGHT — the marketplace grid renders every listing's
58
+ * cover at a fixed aspect, so anything else would be cropped or distorted.
59
+ * The failure reason names both the required size and the size found,
60
+ * since "wrong size" without the numbers makes a developer guess.
61
+ */
62
+ export function checkCoverContract(dir) {
63
+ const filePath = join(dir, COVER_PATH);
64
+ if (!existsSync(filePath)) {
65
+ return fail([`${COVER_PATH} is missing: required for the marketplace listing`]);
66
+ }
67
+ if (!isFile(filePath)) {
68
+ return fail([`${COVER_PATH} is not a file`]);
69
+ }
70
+ const bytes = readFileSync(filePath);
71
+ const size = pngSize(bytes);
72
+ if (size === null) {
73
+ return fail([`${COVER_PATH} is not a valid PNG file`]);
74
+ }
75
+ if (size.width !== COVER_WIDTH || size.height !== COVER_HEIGHT) {
76
+ return fail([
77
+ `${COVER_PATH} is ${size.width}x${size.height}, ` +
78
+ `but the marketplace requires exactly ${COVER_WIDTH}x${COVER_HEIGHT}`,
79
+ ]);
80
+ }
81
+ return { ok: true };
82
+ }
83
+ /**
84
+ * The combined door-level gate. It reports every violation, because an author
85
+ * fixing a package should see the whole list in one run: the README's, the
86
+ * cover's, and, when the package has a manifest.json, the docs contract's
87
+ * (a package with no manifest.json is reported by each caller itself).
88
+ * `reason` is the first of `reasons`, for callers that show one line.
89
+ * It runs on a package nobody has vetted, so a wrong shape (a directory where
90
+ * a file belongs, a file where `docs` belongs) is a violation, never an
91
+ * exception, and the list is capped at MAX_VIOLATIONS lines, the last one
92
+ * counting the rest.
93
+ * Callers that need each rule's independent pass/fail (kardalum plugin's
94
+ * `validate` report) call checkReadmeContract and checkCoverContract directly.
95
+ */
96
+ export function checkPackageContract(dir) {
97
+ const reasons = [];
98
+ const warnings = [];
99
+ for (const check of [checkReadmeContract(dir), checkCoverContract(dir)]) {
100
+ if (!check.ok)
101
+ reasons.push(...check.reasons);
102
+ }
103
+ if (existsSync(join(dir, "manifest.json"))) {
104
+ const docs = readDocsContractInput(dir);
105
+ if (!docs.ok)
106
+ reasons.push(...docs.reasons);
107
+ else {
108
+ const found = checkDocsContract(dir, docs.input);
109
+ reasons.push(...found.reasons);
110
+ warnings.push(...found.warnings);
111
+ }
112
+ }
113
+ const cappedWarnings = capViolations(warnings);
114
+ return reasons.length === 0 ? { ok: true, warnings: cappedWarnings } : { ...fail(capViolations(reasons)), warnings: cappedWarnings };
115
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./capabilities.js";
2
+ export * from "./build-reference.js";
@@ -0,0 +1,6 @@
1
+ // @kardalum/plugin-package/reference: the capability derivation and the
2
+ // reference builder, with no node: import and no third-party import, so the
3
+ // SDK's browser entries can re-export them (S289, spec 3.1).
4
+ // reference-entry.test.ts holds that line.
5
+ export * from "./capabilities.js";
6
+ export * from "./build-reference.js";
@@ -0,0 +1,20 @@
1
+ import { type SampleContentFile, type ShippedInstallFacts } from "@kardalum/api-schemas";
2
+ /** The largest sample-content.json read to decide whether the sample ships,
3
+ * so the door's parse stays inside its validation budget. */
4
+ export declare const SAMPLE_CONTENT_MAX_BYTES: number;
5
+ /** S293: the package's sample-content.json as an install reads it. */
6
+ export type ShippedSampleContent = {
7
+ status: "absent";
8
+ } | {
9
+ status: "unreadable";
10
+ reason: string;
11
+ } | {
12
+ status: "ships";
13
+ file: SampleContentFile;
14
+ };
15
+ /** Absent, unreadable (not a regular file, over SAMPLE_CONTENT_MAX_BYTES, not
16
+ * JSON, or refused by the schema) or the parsed file. Never throws. The
17
+ * server's seeder reads through it, so the cap applies at install too. */
18
+ export declare function readShippedSampleContent(dir: string): ShippedSampleContent;
19
+ /** Never throws: anything unreadable ships nothing. */
20
+ export declare function readShippedInstallFacts(dir: string): ShippedInstallFacts;
@@ -0,0 +1,57 @@
1
+ import { lstatSync, readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { parseSampleContentFile } from "@kardalum/api-schemas";
4
+ // S292 (2026-10-13-s292-what-the-wizard-may-ask-design.md, D8): what a
5
+ // package directory ships that its install's built-in questions are derived
6
+ // from. One definition for `kardalum plugin validate`'s `install options`
7
+ // check, the marketplace door's stored install interface, and (S293) the
8
+ // server's install doors: a sample-content.json at the package root that is
9
+ // a regular file within SAMPLE_CONTENT_MAX_BYTES and parses under
10
+ // SampleContentFileSchema (@kardalum/api-schemas, which also holds the
11
+ // media file pattern this module used to). A file the schema refuses does
12
+ // not ship: the CLI's `sample content valid` check reports it, and the
13
+ // seeder answers "invalid" at install.
14
+ //
15
+ // S293 (2026-10-13-s293-the-wizard-installed-design.md 3.6, D11): the read
16
+ // itself is readShippedSampleContent, which the server's seeder goes through
17
+ // too, so the seeder parses only what the cap admits and a present but
18
+ // unreadable file is told apart from an absent one.
19
+ /** The largest sample-content.json read to decide whether the sample ships,
20
+ * so the door's parse stays inside its validation budget. */
21
+ export const SAMPLE_CONTENT_MAX_BYTES = 8 * 1024 * 1024;
22
+ /** Absent, unreadable (not a regular file, over SAMPLE_CONTENT_MAX_BYTES, not
23
+ * JSON, or refused by the schema) or the parsed file. Never throws. The
24
+ * server's seeder reads through it, so the cap applies at install too. */
25
+ export function readShippedSampleContent(dir) {
26
+ const path = join(dir, "sample-content.json");
27
+ let size;
28
+ try {
29
+ const stats = lstatSync(path);
30
+ if (!stats.isFile())
31
+ return { status: "unreadable", reason: "sample-content.json is not a regular file" };
32
+ size = stats.size;
33
+ }
34
+ catch (error) {
35
+ return error.code === "ENOENT"
36
+ ? { status: "absent" }
37
+ : { status: "unreadable", reason: "sample-content.json cannot be read" };
38
+ }
39
+ if (size > SAMPLE_CONTENT_MAX_BYTES)
40
+ return { status: "unreadable", reason: `sample-content.json is larger than ${SAMPLE_CONTENT_MAX_BYTES} bytes` };
41
+ let raw;
42
+ try {
43
+ raw = JSON.parse(readFileSync(path, "utf8"));
44
+ }
45
+ catch {
46
+ return { status: "unreadable", reason: "sample-content.json is not valid JSON" };
47
+ }
48
+ const parsed = parseSampleContentFile(raw);
49
+ return parsed.ok ? { status: "ships", file: parsed.file } : { status: "unreadable", reason: `sample-content.json: ${parsed.errors.join("; ")}` };
50
+ }
51
+ /** Never throws: anything unreadable ships nothing. */
52
+ export function readShippedInstallFacts(dir) {
53
+ const sample = readShippedSampleContent(dir);
54
+ if (sample.status !== "ships")
55
+ return { sampleContent: false };
56
+ return sample.file.description ? { sampleContent: true, sampleContentDescription: sample.file.description } : { sampleContent: true };
57
+ }
@@ -0,0 +1,43 @@
1
+ /** The signed payload. Field order here is normative — canonicalizeEnvelope
2
+ * serializes in exactly this order, and signer and verifier must agree byte
3
+ * for byte. */
4
+ export interface SignatureEnvelope {
5
+ v: 1;
6
+ alg: "ed25519";
7
+ /** First 16 hex chars of sha256(raw 32-byte public key). Derived, never
8
+ * assigned, so the marketplace's DB row and the CMS's trusted set cannot
9
+ * drift. */
10
+ keyId: string;
11
+ pluginId: string;
12
+ version: string;
13
+ /** sha256 hex of the .zip artifact this envelope describes. */
14
+ sha256: string;
15
+ }
16
+ /** The contents of the detached `<name>.zip.sig` sidecar, and of
17
+ * PluginVersion.signature. */
18
+ export interface PackageSignatureSidecar {
19
+ envelope: SignatureEnvelope;
20
+ /** base64 Ed25519 signature over canonicalizeEnvelope(envelope). */
21
+ signature: string;
22
+ }
23
+ /** A public key the CMS is configured to trust. publicKey is base64 SPKI
24
+ * DER. */
25
+ export interface TrustedKey {
26
+ keyId: string;
27
+ publicKey: string;
28
+ }
29
+ /** Every reason a verification can fail for, at runtime (S289: the manual's
30
+ * enum test checks the reasons it quotes against this list). */
31
+ export declare const VERIFY_FAILURE_REASONS: readonly ["malformed-sidecar", "no-trusted-keys", "unknown-key", "bad-signature", "hash-mismatch", "identity-mismatch", "artifact-unreadable"];
32
+ export type VerifyFailureReason = (typeof VERIFY_FAILURE_REASONS)[number];
33
+ export type VerifyResult = {
34
+ status: "verified";
35
+ keyId: string;
36
+ envelope: SignatureEnvelope;
37
+ } | {
38
+ status: "unsigned";
39
+ } | {
40
+ status: "failed";
41
+ reason: VerifyFailureReason;
42
+ message: string;
43
+ };
@@ -0,0 +1,15 @@
1
+ /** Every reason a verification can fail for, at runtime (S289: the manual's
2
+ * enum test checks the reasons it quotes against this list). */
3
+ export const VERIFY_FAILURE_REASONS = [
4
+ "malformed-sidecar",
5
+ "no-trusted-keys",
6
+ "unknown-key",
7
+ "bad-signature",
8
+ "hash-mismatch",
9
+ "identity-mismatch",
10
+ /** The artifact itself could not be read (missing, unreadable, permission
11
+ * denied, or a mid-read failure): nothing could be verified about it,
12
+ * since hashing never completed. Distinct from hash-mismatch, which
13
+ * requires a hash to have actually been computed and compared. */
14
+ "artifact-unreadable",
15
+ ];
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@kardalum/plugin-package",
3
+ "version": "0.14.0",
4
+ "private": true,
5
+ "engines": {
6
+ "node": ">=22.12"
7
+ },
8
+ "description": "Plugin package + signing toolchain for Kardalum CMS",
9
+ "license": "Apache-2.0",
10
+ "type": "module",
11
+ "main": "dist/index.js",
12
+ "types": "dist/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js",
17
+ "default": "./dist/index.js"
18
+ },
19
+ "./reference": {
20
+ "types": "./dist/reference-entry.d.ts",
21
+ "import": "./dist/reference-entry.js",
22
+ "default": "./dist/reference-entry.js"
23
+ }
24
+ },
25
+ "files": [
26
+ "dist",
27
+ "!dist/**/*.test.*"
28
+ ],
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/kardalum/kardalum-starter.git"
32
+ },
33
+ "bugs": {
34
+ "url": "https://github.com/kardalum/kardalum-starter/issues"
35
+ },
36
+ "homepage": "https://kardalum.com",
37
+ "peerDependencies": {
38
+ "yauzl": "3.4.0"
39
+ },
40
+ "devDependencies": {
41
+ "@types/node": "22.20.1",
42
+ "@types/yauzl": "^3.4.0",
43
+ "@types/yazl": "^3.3.1",
44
+ "typescript": "6.0.3",
45
+ "vitest": "3.2.6",
46
+ "yauzl": "3.4.0",
47
+ "yazl": "^3.3.1",
48
+ "@kardalum/api-schemas": "0.14.0"
49
+ },
50
+ "scripts": {
51
+ "build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p .",
52
+ "test": "vitest run"
53
+ }
54
+ }