@kardalum/plugin-sdk 0.19.0 → 0.20.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 (366) hide show
  1. package/CHANGELOG.md +211 -0
  2. package/README.md +19 -0
  3. package/dist/admin-section-registry.d.ts +16 -1
  4. package/dist/admin-section-registry.js +23 -0
  5. package/dist/built-in-editor-ids.d.ts +1 -1
  6. package/dist/built-in-editor-ids.js +2 -20
  7. package/dist/built-in-settings-schemas.d.ts +10 -0
  8. package/dist/built-in-settings-schemas.js +86 -0
  9. package/dist/built-in-value-schemas.js +35 -0
  10. package/dist/built-ins.js +38 -7
  11. package/dist/capabilities.d.ts +11 -1
  12. package/dist/capabilities.js +55 -3
  13. package/dist/cli.d.ts +66 -0
  14. package/dist/cli.js +22 -0
  15. package/dist/content-library.d.ts +85 -0
  16. package/dist/content-library.js +15 -0
  17. package/dist/content-picker/page-picker-sheet.d.ts +13 -0
  18. package/dist/content-picker/page-picker-sheet.js +105 -0
  19. package/dist/content-picker/page-tree.d.ts +25 -0
  20. package/dist/content-picker/page-tree.js +132 -0
  21. package/dist/data-type-plugin.d.ts +7 -1
  22. package/dist/datatype-validation.d.ts +4 -9
  23. package/dist/datatype-validation.js +139 -1
  24. package/dist/entitlement-entry.d.ts +1 -1
  25. package/dist/entitlement-entry.js +1 -1
  26. package/dist/entitlement-gate.d.ts +14 -0
  27. package/dist/entitlement-gate.js +64 -7
  28. package/dist/entitlement-plan.d.ts +6 -0
  29. package/dist/entitlement-plan.js +10 -0
  30. package/dist/entitlement-types.d.ts +36 -12
  31. package/dist/entitlement.d.ts +31 -4
  32. package/dist/entitlement.js +58 -17
  33. package/dist/hook-entry.d.ts +5 -0
  34. package/dist/hook-entry.js +30 -0
  35. package/dist/host-entry.d.ts +1 -1
  36. package/dist/host-entry.js +1 -1
  37. package/dist/index.d.ts +36 -4
  38. package/dist/index.js +50 -3
  39. package/dist/mail.d.ts +30 -0
  40. package/dist/mail.js +1 -0
  41. package/dist/manifest-entry.d.ts +29 -4
  42. package/dist/manifest-entry.js +39 -2
  43. package/dist/manifest-schema.d.ts +443 -29
  44. package/dist/manifest-schema.js +285 -23
  45. package/dist/manifest.d.ts +450 -51
  46. package/dist/manifest.js +1 -1
  47. package/dist/media/media-picker.js +31 -18
  48. package/dist/media/upload-error.d.ts +5 -1
  49. package/dist/media/upload-error.js +14 -2
  50. package/dist/media-library.d.ts +32 -0
  51. package/dist/media-library.js +15 -0
  52. package/dist/nested-field-host.d.ts +76 -0
  53. package/dist/nested-field-host.js +90 -0
  54. package/dist/notify.d.ts +12 -4
  55. package/dist/notify.js +1 -1
  56. package/dist/outbound.d.ts +47 -0
  57. package/dist/outbound.js +1 -0
  58. package/dist/plugin-context.d.ts +5 -0
  59. package/dist/plugin-screen-context.d.ts +112 -0
  60. package/dist/plugin-screen-context.js +26 -0
  61. package/dist/providers.d.ts +268 -0
  62. package/dist/providers.js +74 -0
  63. package/dist/read-all-pages.d.ts +5 -0
  64. package/dist/read-all-pages.js +3 -2
  65. package/dist/richtext/block-panel.js +11 -6
  66. package/dist/richtext/insert-menu.js +9 -6
  67. package/dist/richtext/style-listbox.js +6 -4
  68. package/dist/sdk-strings.d.ts +285 -0
  69. package/dist/sdk-strings.js +347 -0
  70. package/dist/sealing.d.ts +14 -0
  71. package/dist/sealing.js +1 -0
  72. package/dist/simple-storage-value-provider.js +24 -24
  73. package/dist/structured-storage-types.d.ts +309 -9
  74. package/dist/text-entry.d.ts +1 -0
  75. package/dist/text-entry.js +6 -0
  76. package/dist/tokens/tailwind-theme.css +5 -0
  77. package/dist/tokens/tokens.css +15 -3
  78. package/dist/tokens/tokens.json +8 -3
  79. package/dist/views/asset-view.js +4 -1
  80. package/dist/views/content-list-preview.js +3 -1
  81. package/dist/views/content-list-settings-view.js +11 -7
  82. package/dist/views/content-list-view.d.ts +5 -3
  83. package/dist/views/content-list-view.js +38 -34
  84. package/dist/views/content-picker-view.d.ts +3 -0
  85. package/dist/views/content-picker-view.js +143 -0
  86. package/dist/views/crop-view.d.ts +4 -6
  87. package/dist/views/crop-view.js +22 -13
  88. package/dist/views/date-range-view.js +4 -1
  89. package/dist/views/file-upload-view.d.ts +5 -7
  90. package/dist/views/file-upload-view.js +16 -7
  91. package/dist/views/group-view.d.ts +8 -0
  92. package/dist/views/group-view.js +123 -0
  93. package/dist/views/html-view.js +7 -6
  94. package/dist/views/image-view.js +37 -19
  95. package/dist/views/link-view.d.ts +3 -0
  96. package/dist/views/link-view.js +150 -0
  97. package/dist/views/options-list-view.d.ts +3 -0
  98. package/dist/views/options-list-view.js +104 -0
  99. package/dist/views/repeatable-list-view.d.ts +3 -0
  100. package/dist/views/repeatable-list-view.js +113 -0
  101. package/dist/views/rich-text-view.js +28 -13
  102. package/dist/views/suggest-key.d.ts +17 -0
  103. package/dist/views/suggest-key.js +55 -0
  104. package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.d.ts +215 -0
  105. package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.js +179 -0
  106. package/node_modules/@kardalum/api-schemas/dist/ai-context.schema.d.ts +12 -0
  107. package/node_modules/@kardalum/api-schemas/dist/ai-context.schema.js +10 -0
  108. package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +10 -0
  109. package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +5 -0
  110. package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +7 -1
  111. package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +4 -2
  112. package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.d.ts +1 -0
  113. package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.js +27 -0
  114. package/node_modules/@kardalum/api-schemas/dist/capability-detail.d.ts +65 -0
  115. package/node_modules/@kardalum/api-schemas/dist/capability-detail.js +126 -0
  116. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +115 -3
  117. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +58 -11
  118. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +57 -2
  119. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +137 -0
  120. package/node_modules/@kardalum/api-schemas/dist/content-path.d.ts +1 -1
  121. package/node_modules/@kardalum/api-schemas/dist/content-path.js +1 -1
  122. package/node_modules/@kardalum/api-schemas/dist/content-search.schema.d.ts +50 -0
  123. package/node_modules/@kardalum/api-schemas/dist/content-search.schema.js +42 -0
  124. package/node_modules/@kardalum/api-schemas/dist/content-summary.schema.d.ts +37 -0
  125. package/node_modules/@kardalum/api-schemas/dist/content-summary.schema.js +19 -0
  126. package/node_modules/@kardalum/api-schemas/dist/content-unpublish.schema.d.ts +23 -0
  127. package/node_modules/@kardalum/api-schemas/dist/content-unpublish.schema.js +13 -0
  128. package/node_modules/@kardalum/api-schemas/dist/content.schema.d.ts +3 -0
  129. package/node_modules/@kardalum/api-schemas/dist/content.schema.js +10 -0
  130. package/node_modules/@kardalum/api-schemas/dist/contract-cancel.schema.d.ts +41 -0
  131. package/node_modules/@kardalum/api-schemas/dist/contract-cancel.schema.js +86 -0
  132. package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +10 -5
  133. package/node_modules/@kardalum/api-schemas/dist/core-actions.js +7 -4
  134. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +25 -0
  135. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +8 -0
  136. package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +1 -1
  137. package/node_modules/@kardalum/api-schemas/dist/data-type-issue.d.ts +35 -0
  138. package/node_modules/@kardalum/api-schemas/dist/data-type-issue.js +60 -0
  139. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +180 -15
  140. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +41 -5
  141. package/node_modules/@kardalum/api-schemas/dist/document-type.schema.d.ts +24 -6
  142. package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +90 -5
  143. package/node_modules/@kardalum/api-schemas/dist/form-protection.d.ts +23 -0
  144. package/node_modules/@kardalum/api-schemas/dist/form-protection.js +12 -0
  145. package/node_modules/@kardalum/api-schemas/dist/graphql-limits.d.ts +12 -0
  146. package/node_modules/@kardalum/api-schemas/dist/graphql-limits.js +14 -0
  147. package/node_modules/@kardalum/api-schemas/dist/held-embed-words.d.ts +23 -0
  148. package/node_modules/@kardalum/api-schemas/dist/held-embed-words.js +70 -0
  149. package/node_modules/@kardalum/api-schemas/dist/index.d.ts +117 -41
  150. package/node_modules/@kardalum/api-schemas/dist/index.js +89 -26
  151. package/node_modules/@kardalum/api-schemas/dist/install-sign-in-switched-off.schema.d.ts +9 -0
  152. package/node_modules/@kardalum/api-schemas/dist/install-sign-in-switched-off.schema.js +9 -0
  153. package/node_modules/@kardalum/api-schemas/dist/legal-anchors.d.ts +8 -0
  154. package/node_modules/@kardalum/api-schemas/dist/legal-anchors.js +9 -0
  155. package/node_modules/@kardalum/api-schemas/dist/licensing.schema.d.ts +63 -0
  156. package/node_modules/@kardalum/api-schemas/dist/licensing.schema.js +54 -0
  157. package/node_modules/@kardalum/api-schemas/dist/mail-rules.d.ts +224 -0
  158. package/node_modules/@kardalum/api-schemas/dist/mail-rules.js +404 -0
  159. package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.d.ts +8 -0
  160. package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.js +4 -0
  161. package/node_modules/@kardalum/api-schemas/dist/marketplace-leaks.schema.d.ts +145 -0
  162. package/node_modules/@kardalum/api-schemas/dist/marketplace-leaks.schema.js +154 -0
  163. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +312 -8
  164. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +43 -3
  165. package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.d.ts +15 -0
  166. package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.js +14 -0
  167. package/node_modules/@kardalum/api-schemas/dist/marketplace-payouts.schema.d.ts +131 -0
  168. package/node_modules/@kardalum/api-schemas/dist/marketplace-payouts.schema.js +272 -0
  169. package/node_modules/@kardalum/api-schemas/dist/marketplace-profile.schema.d.ts +84 -0
  170. package/node_modules/@kardalum/api-schemas/dist/marketplace-profile.schema.js +138 -0
  171. package/node_modules/@kardalum/api-schemas/dist/marketplace-revocation.schema.d.ts +20 -0
  172. package/node_modules/@kardalum/api-schemas/dist/marketplace-revocation.schema.js +49 -0
  173. package/node_modules/@kardalum/api-schemas/dist/marketplace-sites.schema.d.ts +211 -0
  174. package/node_modules/@kardalum/api-schemas/dist/marketplace-sites.schema.js +424 -0
  175. package/node_modules/@kardalum/api-schemas/dist/mcp-plugins.schema.d.ts +78 -0
  176. package/node_modules/@kardalum/api-schemas/dist/mcp-plugins.schema.js +27 -0
  177. package/node_modules/@kardalum/api-schemas/dist/mcp-tool-inputs.schema.d.ts +70 -0
  178. package/node_modules/@kardalum/api-schemas/dist/mcp-tool-inputs.schema.js +43 -0
  179. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +22 -0
  180. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +13 -1
  181. package/node_modules/@kardalum/api-schemas/dist/media-move.schema.d.ts +75 -0
  182. package/node_modules/@kardalum/api-schemas/dist/media-move.schema.js +53 -0
  183. package/node_modules/@kardalum/api-schemas/dist/media-reference-api.schema.d.ts +2 -2
  184. package/node_modules/@kardalum/api-schemas/dist/media-reference.d.ts +2 -0
  185. package/node_modules/@kardalum/api-schemas/dist/media-reference.js +55 -0
  186. package/node_modules/@kardalum/api-schemas/dist/media.schema.d.ts +1 -0
  187. package/node_modules/@kardalum/api-schemas/dist/media.schema.js +4 -0
  188. package/node_modules/@kardalum/api-schemas/dist/nested-fields.schema.d.ts +204 -0
  189. package/node_modules/@kardalum/api-schemas/dist/nested-fields.schema.js +370 -0
  190. package/node_modules/@kardalum/api-schemas/dist/nested-validation.d.ts +53 -0
  191. package/node_modules/@kardalum/api-schemas/dist/nested-validation.js +284 -0
  192. package/node_modules/@kardalum/api-schemas/dist/news.schema.d.ts +5 -5
  193. package/node_modules/@kardalum/api-schemas/dist/node-access.schema.d.ts +1 -2
  194. package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +1 -2
  195. package/node_modules/@kardalum/api-schemas/dist/notification-kinds.d.ts +145 -0
  196. package/node_modules/@kardalum/api-schemas/dist/notification-kinds.js +177 -0
  197. package/node_modules/@kardalum/api-schemas/dist/notification.schema.d.ts +258 -7
  198. package/node_modules/@kardalum/api-schemas/dist/notification.schema.js +96 -5
  199. package/node_modules/@kardalum/api-schemas/dist/page-address.d.ts +10 -0
  200. package/node_modules/@kardalum/api-schemas/dist/page-address.js +7 -0
  201. package/node_modules/@kardalum/api-schemas/dist/password-reset.schema.d.ts +34 -0
  202. package/node_modules/@kardalum/api-schemas/dist/password-reset.schema.js +60 -0
  203. package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.d.ts +28 -3
  204. package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.js +55 -8
  205. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +12 -0
  206. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +13 -0
  207. package/node_modules/@kardalum/api-schemas/dist/plugin-caller.d.ts +23 -0
  208. package/node_modules/@kardalum/api-schemas/dist/plugin-caller.js +16 -0
  209. package/node_modules/@kardalum/api-schemas/dist/plugin-cli-commands.d.ts +76 -0
  210. package/node_modules/@kardalum/api-schemas/dist/plugin-cli-commands.js +316 -0
  211. package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.d.ts +42 -0
  212. package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.js +74 -0
  213. package/node_modules/@kardalum/api-schemas/dist/plugin-data-type-configs.d.ts +31 -0
  214. package/node_modules/@kardalum/api-schemas/dist/plugin-data-type-configs.js +131 -0
  215. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +26 -2
  216. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +26 -2
  217. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +13 -5
  218. package/node_modules/@kardalum/api-schemas/dist/plugin-document-types.d.ts +228 -0
  219. package/node_modules/@kardalum/api-schemas/dist/plugin-document-types.js +41 -0
  220. package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.d.ts +26 -0
  221. package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.js +55 -0
  222. package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.d.ts +40 -0
  223. package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.js +124 -0
  224. package/node_modules/@kardalum/api-schemas/dist/plugin-field-info.d.ts +41 -0
  225. package/node_modules/@kardalum/api-schemas/dist/plugin-field-info.js +51 -0
  226. package/node_modules/@kardalum/api-schemas/dist/plugin-graphql-fields.d.ts +32 -0
  227. package/node_modules/@kardalum/api-schemas/dist/plugin-graphql-fields.js +102 -0
  228. package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.d.ts +107 -0
  229. package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.js +213 -0
  230. package/node_modules/@kardalum/api-schemas/dist/plugin-https-origin.d.ts +5 -0
  231. package/node_modules/@kardalum/api-schemas/dist/plugin-https-origin.js +21 -0
  232. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +4 -0
  233. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +3 -0
  234. package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +44 -0
  235. package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +38 -1
  236. package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +237 -2
  237. package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +205 -6
  238. package/node_modules/@kardalum/api-schemas/dist/plugin-labels.d.ts +26 -0
  239. package/node_modules/@kardalum/api-schemas/dist/plugin-labels.js +29 -1
  240. package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +32 -8
  241. package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +120 -14
  242. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +335 -6
  243. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +242 -2
  244. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +16 -1
  245. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +34 -1
  246. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-ai.d.ts +40 -0
  247. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-ai.js +139 -0
  248. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +22 -1
  249. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +31 -1
  250. package/node_modules/@kardalum/api-schemas/dist/plugin-media-access.d.ts +25 -0
  251. package/node_modules/@kardalum/api-schemas/dist/plugin-media-access.js +43 -0
  252. package/node_modules/@kardalum/api-schemas/dist/plugin-outbound.d.ts +107 -0
  253. package/node_modules/@kardalum/api-schemas/dist/plugin-outbound.js +150 -0
  254. package/node_modules/@kardalum/api-schemas/dist/plugin-package-build.schema.d.ts +5 -0
  255. package/node_modules/@kardalum/api-schemas/dist/plugin-package-build.schema.js +7 -0
  256. package/node_modules/@kardalum/api-schemas/dist/plugin-providers.d.ts +310 -0
  257. package/node_modules/@kardalum/api-schemas/dist/plugin-providers.js +430 -0
  258. package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.d.ts +4 -0
  259. package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.js +2 -0
  260. package/node_modules/@kardalum/api-schemas/dist/plugin-sealed-values.d.ts +45 -0
  261. package/node_modules/@kardalum/api-schemas/dist/plugin-sealed-values.js +99 -0
  262. package/node_modules/@kardalum/api-schemas/dist/plugin-secrets.d.ts +68 -0
  263. package/node_modules/@kardalum/api-schemas/dist/plugin-secrets.js +114 -0
  264. package/node_modules/@kardalum/api-schemas/dist/plugin-settings.d.ts +342 -0
  265. package/node_modules/@kardalum/api-schemas/dist/plugin-settings.js +400 -0
  266. package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.d.ts +180 -0
  267. package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.js +612 -0
  268. package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.d.ts +7 -0
  269. package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.js +47 -4
  270. package/node_modules/@kardalum/api-schemas/dist/plugin-tasks.d.ts +45 -0
  271. package/node_modules/@kardalum/api-schemas/dist/plugin-tasks.js +197 -0
  272. package/node_modules/@kardalum/api-schemas/dist/plural-rules.d.ts +9 -0
  273. package/node_modules/@kardalum/api-schemas/dist/plural-rules.js +41 -0
  274. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +41 -0
  275. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +100 -12
  276. package/node_modules/@kardalum/api-schemas/dist/refund-request.schema.d.ts +189 -0
  277. package/node_modules/@kardalum/api-schemas/dist/refund-request.schema.js +164 -0
  278. package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +4 -4
  279. package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.js +7 -3
  280. package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.d.ts +6 -0
  281. package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.js +82 -0
  282. package/node_modules/@kardalum/api-schemas/dist/rich-text-text.d.ts +66 -0
  283. package/node_modules/@kardalum/api-schemas/dist/rich-text-text.js +497 -0
  284. package/node_modules/@kardalum/api-schemas/dist/sale-conditions.schema.d.ts +82 -0
  285. package/node_modules/@kardalum/api-schemas/dist/sale-conditions.schema.js +99 -0
  286. package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +13 -0
  287. package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +28 -0
  288. package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +91 -1
  289. package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.d.ts +90 -8
  290. package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.js +59 -1
  291. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +110 -0
  292. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +34 -2
  293. package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.d.ts +384 -0
  294. package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.js +616 -0
  295. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +3 -3
  296. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +1 -1
  297. package/node_modules/@kardalum/api-schemas/dist/structured-duplicate-key.d.ts +13 -0
  298. package/node_modules/@kardalum/api-schemas/dist/structured-duplicate-key.js +26 -0
  299. package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.d.ts +66 -0
  300. package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.js +160 -0
  301. package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +1 -0
  302. package/node_modules/@kardalum/api-schemas/dist/template.schema.js +3 -0
  303. package/node_modules/@kardalum/api-schemas/dist/transaction-rolled-back.d.ts +13 -0
  304. package/node_modules/@kardalum/api-schemas/dist/transaction-rolled-back.js +29 -0
  305. package/node_modules/@kardalum/api-schemas/dist/trash-purge.schema.d.ts +13 -0
  306. package/node_modules/@kardalum/api-schemas/dist/trash-purge.schema.js +6 -0
  307. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +58 -1
  308. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +34 -3
  309. package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.d.ts +5 -1
  310. package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.js +4 -3
  311. package/node_modules/@kardalum/api-schemas/package.json +1 -0
  312. package/node_modules/@kardalum/design-tokens/dist/build-css.js +6 -0
  313. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +5 -0
  314. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +1 -1
  315. package/node_modules/@kardalum/design-tokens/dist/tokens.css +15 -3
  316. package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +1 -1
  317. package/node_modules/@kardalum/design-tokens/dist/tokens.js +12 -3
  318. package/node_modules/@kardalum/design-tokens/dist/tokens.json +8 -3
  319. package/node_modules/@kardalum/design-tokens/dist/types.d.ts +1 -1
  320. package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +21 -2
  321. package/node_modules/@kardalum/plugin-package/dist/build-reference.js +8 -2
  322. package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +17 -10
  323. package/node_modules/@kardalum/plugin-package/dist/capabilities.js +355 -22
  324. package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +1 -1
  325. package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +2 -0
  326. package/node_modules/@kardalum/plugin-package/dist/cms-range.d.ts +17 -0
  327. package/node_modules/@kardalum/plugin-package/dist/cms-range.js +353 -0
  328. package/node_modules/@kardalum/plugin-package/dist/delivery/ai-declarations.d.ts +2 -0
  329. package/node_modules/@kardalum/plugin-package/dist/delivery/ai-declarations.js +26 -0
  330. package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.d.ts +1 -1
  331. package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.js +3 -2
  332. package/node_modules/@kardalum/plugin-package/dist/delivery/content-access.d.ts +2 -0
  333. package/node_modules/@kardalum/plugin-package/dist/delivery/content-access.js +34 -0
  334. package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +2 -2
  335. package/node_modules/@kardalum/plugin-package/dist/delivery/editor-extensions.d.ts +2 -0
  336. package/node_modules/@kardalum/plugin-package/dist/delivery/editor-extensions.js +27 -0
  337. package/node_modules/@kardalum/plugin-package/dist/delivery/graphql-fields.d.ts +2 -0
  338. package/node_modules/@kardalum/plugin-package/dist/delivery/graphql-fields.js +22 -0
  339. package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +1 -0
  340. package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +1 -0
  341. package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +47 -5
  342. package/node_modules/@kardalum/plugin-package/dist/delivery/licence-check.d.ts +27 -0
  343. package/node_modules/@kardalum/plugin-package/dist/delivery/licence-check.js +95 -0
  344. package/node_modules/@kardalum/plugin-package/dist/delivery/locales.js +9 -4
  345. package/node_modules/@kardalum/plugin-package/dist/delivery/plugin-settings.d.ts +3 -0
  346. package/node_modules/@kardalum/plugin-package/dist/delivery/plugin-settings.js +68 -0
  347. package/node_modules/@kardalum/plugin-package/dist/delivery/providers.d.ts +3 -0
  348. package/node_modules/@kardalum/plugin-package/dist/delivery/providers.js +298 -0
  349. package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +25 -4
  350. package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.js +91 -2
  351. package/node_modules/@kardalum/plugin-package/dist/delivery/server-powers.d.ts +6 -0
  352. package/node_modules/@kardalum/plugin-package/dist/delivery/server-powers.js +140 -0
  353. package/node_modules/@kardalum/plugin-package/dist/delivery/site-extensions.d.ts +2 -0
  354. package/node_modules/@kardalum/plugin-package/dist/delivery/site-extensions.js +36 -0
  355. package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +1 -0
  356. package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +21 -1
  357. package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +10 -0
  358. package/node_modules/@kardalum/plugin-package/dist/index.d.ts +4 -2
  359. package/node_modules/@kardalum/plugin-package/dist/index.js +2 -1
  360. package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +75 -0
  361. package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +123 -0
  362. package/node_modules/@kardalum/ui/dist/components/switch.js +1 -1
  363. package/node_modules/@kardalum/ui/dist/components/tooltip.js +1 -2
  364. package/node_modules/@kardalum/ui/dist/components/truncated-text.d.ts +6 -1
  365. package/node_modules/@kardalum/ui/dist/components/truncated-text.js +5 -4
  366. package/package.json +12 -2
@@ -0,0 +1,132 @@
1
+ import { useCallback, useEffect, useRef, useState } from "react";
2
+ import { MANAGE_API, useContentHost, usePluginApi } from "../plugin-context.js";
3
+ // M32 C: what the content picker reads of the content tree. A level is one cursor-paginated listing
4
+ // (50 at a time), never every child of a node; summaries answer for the pages a field already holds.
5
+ export const LEVEL_PAGE_SIZE = 50;
6
+ export function summaryMark(summary) {
7
+ if (!summary)
8
+ return null;
9
+ if (summary.state === "missing")
10
+ return "missing";
11
+ if (summary.state === "trashed")
12
+ return "trashed";
13
+ if (!summary.readable)
14
+ return "noAccess";
15
+ if (!summary.published)
16
+ return "draft";
17
+ return null;
18
+ }
19
+ /** One level of the tree: the roots (parentId null) or the children of a node. */
20
+ export async function fetchLevel(fetchApi, parentId, cursor) {
21
+ const params = new URLSearchParams({ limit: String(LEVEL_PAGE_SIZE) });
22
+ if (cursor)
23
+ params.set("cursor", cursor);
24
+ const base = parentId === null ? `${MANAGE_API}/content/roots` : `${MANAGE_API}/content/${parentId}/children`;
25
+ const response = await fetchApi(`${base}?${params.toString()}`);
26
+ if (!response.ok)
27
+ throw new Error(`Failed to read pages (${response.status})`);
28
+ const body = (await response.json());
29
+ if (!Array.isArray(body.items))
30
+ throw new Error("Failed to read pages (unexpected answer)");
31
+ return body;
32
+ }
33
+ async function fetchSummaries(fetchApi, ids, culture) {
34
+ // M32 I2 (A7): names are read in the culture being edited, when the host says which.
35
+ const locale = culture ? `&locale=${encodeURIComponent(culture)}` : "";
36
+ const response = await fetchApi(`${MANAGE_API}/content/summaries?ids=${ids.join(",")}${locale}`);
37
+ if (!response.ok)
38
+ throw new Error(`Failed to read pages (${response.status})`);
39
+ const body = (await response.json());
40
+ if (!Array.isArray(body.items))
41
+ throw new Error("Failed to read pages (unexpected answer)");
42
+ return body.items;
43
+ }
44
+ /** The start node's summary, or null when it is not there. */
45
+ export async function fetchNode(fetchApi, id, culture) {
46
+ const items = await fetchSummaries(fetchApi, [id], culture);
47
+ return items.find((item) => item.id === id) ?? null;
48
+ }
49
+ export function useLevel(parentId) {
50
+ const fetchApi = usePluginApi();
51
+ const [items, setItems] = useState([]);
52
+ const [nextCursor, setNextCursor] = useState(null);
53
+ const [status, setStatus] = useState("loading");
54
+ const [more, setMore] = useState(false);
55
+ const alive = useRef(true);
56
+ useEffect(() => {
57
+ alive.current = true;
58
+ setItems([]);
59
+ setNextCursor(null);
60
+ setStatus("loading");
61
+ fetchLevel(fetchApi, parentId)
62
+ .then((page) => {
63
+ if (!alive.current)
64
+ return;
65
+ setItems(page.items);
66
+ setNextCursor(page.nextCursor);
67
+ setStatus("ready");
68
+ })
69
+ .catch(() => {
70
+ if (alive.current)
71
+ setStatus("failed");
72
+ });
73
+ return () => {
74
+ alive.current = false;
75
+ };
76
+ }, [fetchApi, parentId]);
77
+ const loadMore = useCallback(() => {
78
+ if (nextCursor === null || more)
79
+ return;
80
+ setMore(true);
81
+ fetchLevel(fetchApi, parentId, nextCursor)
82
+ .then((page) => {
83
+ if (!alive.current)
84
+ return;
85
+ setItems((current) => [...current, ...page.items.filter((item) => !current.some((c) => c.id === item.id))]);
86
+ setNextCursor(page.nextCursor);
87
+ })
88
+ .catch(() => {
89
+ if (alive.current)
90
+ setStatus("failed");
91
+ })
92
+ .finally(() => {
93
+ if (alive.current)
94
+ setMore(false);
95
+ });
96
+ }, [fetchApi, parentId, nextCursor, more]);
97
+ return { items, nextCursor, status, more, loadMore };
98
+ }
99
+ const NO_SUMMARIES = new Map();
100
+ /** One read per distinct id set; idle for an empty list. */
101
+ export function usePageSummaries(ids) {
102
+ const fetchApi = usePluginApi();
103
+ const culture = useContentHost()?.culture;
104
+ const key = ids.join(",");
105
+ const [state, setState] = useState({
106
+ key: "",
107
+ status: "idle",
108
+ byId: NO_SUMMARIES,
109
+ });
110
+ useEffect(() => {
111
+ if (key === "")
112
+ return;
113
+ let cancelled = false;
114
+ fetchSummaries(fetchApi, key.split(","), culture)
115
+ .then((items) => {
116
+ if (!cancelled)
117
+ setState({ key, status: "ready", byId: new Map(items.map((item) => [item.id, item])) });
118
+ })
119
+ .catch(() => {
120
+ if (!cancelled)
121
+ setState({ key, status: "failed", byId: NO_SUMMARIES });
122
+ });
123
+ return () => {
124
+ cancelled = true;
125
+ };
126
+ }, [fetchApi, key, culture]);
127
+ if (key === "")
128
+ return { status: "idle", byId: NO_SUMMARIES };
129
+ if (state.key !== key)
130
+ return { status: "loading", byId: NO_SUMMARIES };
131
+ return { status: state.status, byId: state.byId };
132
+ }
@@ -1,5 +1,6 @@
1
1
  import type { ComponentType } from "react";
2
2
  import type { JSONSchema7 } from "json-schema";
3
+ import type { PluginLabel } from "@kardalum/api-schemas";
3
4
  import type { DataTypeValidateHook } from "./datatype-validation.js";
4
5
  export interface DataTypePluginViews {
5
6
  input: ComponentType;
@@ -9,7 +10,9 @@ export interface DataTypePluginViews {
9
10
  }
10
11
  export interface DataTypePlugin {
11
12
  id: string;
12
- name: string;
13
+ /** M33 K45: a display label, a plain string or a language map (`{ en, de?, ... }`); a reader
14
+ * resolves it with resolveLabel from @kardalum/api-schemas. `id` is the identifier. */
15
+ name: PluginLabel;
13
16
  icon: string;
14
17
  version: string;
15
18
  type: "datatype";
@@ -25,4 +28,7 @@ export interface DataTypePlugin {
25
28
  /** Optional emptiness predicate for composite values, consulted by the
26
29
  * `required` rule so a webmaster never needs to know the value shape. */
27
30
  isEmpty?: (value: unknown) => boolean;
31
+ /** M32 F4d (D14): may sit inside a Group or a Repeatable list; requires `validate`. A
32
+ * deactivated plugin's nested value is kept as stored and not checked. */
33
+ nestable?: boolean;
28
34
  }
@@ -1,11 +1,5 @@
1
- export type DataTypeIssue = {
2
- key: string;
3
- params?: Record<string, unknown>;
4
- path?: string;
5
- } | {
6
- message: string;
7
- path?: string;
8
- };
1
+ import { type DataTypeIssue, type DataTypeValidatorIssue } from "@kardalum/api-schemas";
2
+ export type { DataTypeIssue, DataTypeValidatorIssue };
9
3
  export interface DataTypeValidateContext {
10
4
  settings: Record<string, unknown>;
11
5
  }
@@ -19,7 +13,8 @@ export interface DataTypeValidatorEntry {
19
13
  * different settings than the input view was configured with.
20
14
  */
21
15
  defaultSettings?: Record<string, unknown>;
22
- validate?: DataTypeValidateHook;
16
+ /** M33 K46: the issues as the core passes them on, a plugin's carrying its `plugin`. */
17
+ validate?: (value: unknown, ctx: DataTypeValidateContext) => DataTypeValidatorIssue[] | undefined;
23
18
  isEmpty?: (value: unknown) => boolean;
24
19
  }
25
20
  export type DataTypeValidatorLookup = (datatypeId: string) => DataTypeValidatorEntry | undefined;
@@ -1,10 +1,12 @@
1
- import { AssetPathSchema, assetPathAccepted } from "@kardalum/api-schemas";
1
+ import { AssetPathSchema, CONTENT_PICKER_MAX_ITEMS, LINK_LABEL_MAX, LIST_ITEMS_MAX, RICHTEXT_EDITOR_ID, UuidStringSchema, assetPathAccepted, isOutsideLinkAddress, isPlainRecord, readContentPickerSettings, readLinkSettings, readOptionsListSettings, richTextShapeProblem, } from "@kardalum/api-schemas";
2
2
  const ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
3
3
  // A member reads as its string, as null (absent), or as MALFORMED when it
4
4
  // is present but not a string at all. Keeping the two failure modes apart
5
5
  // per side is what lets `validate` blame the side actually at fault: a
6
6
  // whole-value collapse would report `{ start: "2026-01-01", end: 123 }`
7
7
  // against `start`, pointing the form at the input the editor got right.
8
+ // M32 C fix wave: the keys a Link value may carry, as its published value schema lists them.
9
+ const LINK_VALUE_KEYS = new Set(["page", "url", "label", "newTab"]);
8
10
  const MALFORMED = Symbol("malformed-date-range-member");
9
11
  function readDateRange(value) {
10
12
  if (typeof value !== "object" || value === null)
@@ -121,4 +123,140 @@ export const BUILT_IN_DATATYPE_VALIDATORS = {
121
123
  return [];
122
124
  },
123
125
  },
126
+ // M32 C (D2, D5, D6). One id or a list of ids, read under either setting; the tree checks
127
+ // (live, type, start node) need the database and run in the content service (D7).
128
+ "com.kardalum.contentpicker": {
129
+ defaultSettings: { startNode: null, documentTypes: [], multiple: false, max: null },
130
+ isEmpty: (value) => value === null || value === undefined || value === "" || (Array.isArray(value) && value.length === 0),
131
+ validate(value, { settings }) {
132
+ if (!Array.isArray(value) && typeof value !== "string")
133
+ return [{ key: "dataTypes.contentPicker.errors.invalid" }];
134
+ const read = readContentPickerSettings(settings);
135
+ const list = Array.isArray(value) ? value : [value];
136
+ const seen = new Set();
137
+ for (let i = 0; i < list.length; i++) {
138
+ const entry = list[i];
139
+ const at = Array.isArray(value) ? { path: String(i + 1) } : {};
140
+ if (typeof entry !== "string" || !UuidStringSchema.safeParse(entry).success)
141
+ return [{ key: "dataTypes.contentPicker.errors.invalid", ...at }];
142
+ const id = entry.toLowerCase();
143
+ if (seen.has(id))
144
+ return [{ key: "dataTypes.contentPicker.errors.duplicate", ...at }];
145
+ seen.add(id);
146
+ }
147
+ if (!read.multiple && list.length > 1)
148
+ return [{ key: "dataTypes.contentPicker.errors.onlyOne" }];
149
+ const max = Math.min(read.max ?? CONTENT_PICKER_MAX_ITEMS, CONTENT_PICKER_MAX_ITEMS);
150
+ if (read.multiple && list.length > max)
151
+ return [{ key: "dataTypes.contentPicker.errors.tooMany", params: { max } }];
152
+ return [];
153
+ },
154
+ },
155
+ // M32 C (D3, D6, decision 7.6): a value no longer among the options is refused on the next save;
156
+ // the editor shows it with Remove.
157
+ "com.kardalum.options": {
158
+ defaultSettings: { options: [], multiple: false },
159
+ isEmpty: (value) => value === null || value === undefined || value === "" || (Array.isArray(value) && value.length === 0),
160
+ validate(value, { settings }) {
161
+ if (!Array.isArray(value) && typeof value !== "string")
162
+ return [{ key: "dataTypes.optionsList.errors.invalid" }];
163
+ const read = readOptionsListSettings(settings);
164
+ const list = Array.isArray(value) ? value : [value];
165
+ const allowed = new Set(read.options.map((option) => option.value));
166
+ const seen = new Set();
167
+ for (let i = 0; i < list.length; i++) {
168
+ const entry = list[i];
169
+ const at = Array.isArray(value) ? { path: String(i + 1) } : {};
170
+ if (typeof entry !== "string")
171
+ return [{ key: "dataTypes.optionsList.errors.invalid", ...at }];
172
+ if (seen.has(entry))
173
+ return [{ key: "dataTypes.optionsList.errors.duplicate", ...at }];
174
+ seen.add(entry);
175
+ if (!allowed.has(entry))
176
+ return [{ key: "dataTypes.optionsList.errors.notAnOption", params: { value: entry }, ...at }];
177
+ }
178
+ if (!read.multiple && list.length > 1)
179
+ return [{ key: "dataTypes.optionsList.errors.onlyOne" }];
180
+ return [];
181
+ },
182
+ },
183
+ // M32 C (D4, D6): `{ page | url, label, newTab }`, exactly one of page and url.
184
+ "com.kardalum.link": {
185
+ defaultSettings: { allow: "both" },
186
+ isEmpty(value) {
187
+ if (typeof value !== "object" || value === null)
188
+ return true;
189
+ const bag = value;
190
+ const empty = (member) => member === undefined || member === null || member === "";
191
+ return empty(bag.page) && empty(bag.url);
192
+ },
193
+ validate(value, { settings }) {
194
+ const bag = typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
195
+ if (bag === null)
196
+ return [{ key: "dataTypes.link.errors.invalid" }];
197
+ // The value's shape is checked before the settings are read.
198
+ const { allow } = readLinkSettings(settings);
199
+ // The published value schema admits only these keys, and only one of page and url.
200
+ if (Object.keys(bag).some((key) => !LINK_VALUE_KEYS.has(key)) || ("page" in bag && "url" in bag)) {
201
+ return [{ key: "dataTypes.link.errors.invalid" }];
202
+ }
203
+ if ((bag.label !== undefined && typeof bag.label !== "string") || (bag.newTab !== undefined && typeof bag.newTab !== "boolean")) {
204
+ return [{ key: "dataTypes.link.errors.invalid" }];
205
+ }
206
+ const hasPage = bag.page !== undefined && bag.page !== null && bag.page !== "";
207
+ const hasUrl = bag.url !== undefined && bag.url !== null && bag.url !== "";
208
+ if (hasPage === hasUrl)
209
+ return [{ key: "dataTypes.link.errors.invalid" }];
210
+ if (hasPage && (typeof bag.page !== "string" || !UuidStringSchema.safeParse(bag.page).success))
211
+ return [{ key: "dataTypes.link.errors.invalid" }];
212
+ // The address is stored as it is shown: trimmed (the editor trims it before it stores).
213
+ if (hasUrl && (typeof bag.url !== "string" || bag.url !== bag.url.trim() || !isOutsideLinkAddress(bag.url)))
214
+ return [{ key: "dataTypes.link.errors.badAddress" }];
215
+ if (hasPage && allow === "external")
216
+ return [{ key: "dataTypes.link.errors.externalOnly" }];
217
+ if (hasUrl && allow === "internal")
218
+ return [{ key: "dataTypes.link.errors.internalOnly" }];
219
+ if (typeof bag.label === "string" && bag.label.length > LINK_LABEL_MAX)
220
+ return [{ key: "dataTypes.link.errors.labelTooLong" }];
221
+ return [];
222
+ },
223
+ },
224
+ // M32 I2 (A5): a rich text value is stored only in a shape the editor can open and the renderer
225
+ // knows (the node and mark lists of api-schemas). Every problem answers one key. Null and an
226
+ // empty value are left to the default emptiness rule, so this sees only a value that is there.
227
+ [RICHTEXT_EDITOR_ID]: {
228
+ validate(value) {
229
+ return richTextShapeProblem(value) === null ? [] : [{ key: "dataTypes.richText.errors.shape" }];
230
+ },
231
+ },
232
+ // M32 D (D1, D8): a Group's value is an object keyed by its sub-fields' aliases. Empty is structural,
233
+ // so a Group whose parts are all blank counts as unfilled. The content service replaces both hooks
234
+ // with the walk over the data type tree; these answer where no tree is known.
235
+ "com.kardalum.group": {
236
+ defaultSettings: { fields: [] },
237
+ isEmpty(value) {
238
+ if (!isPlainRecord(value))
239
+ return true;
240
+ return Object.values(value).every((member) => member === undefined ||
241
+ member === null ||
242
+ member === "" ||
243
+ (Array.isArray(member) && member.length === 0) ||
244
+ (isPlainRecord(member) && Object.keys(member).length === 0));
245
+ },
246
+ validate(value) {
247
+ return isPlainRecord(value) ? [] : [{ key: "dataTypes.group.errors.invalid" }];
248
+ },
249
+ },
250
+ // M32 D (D1, D8): a Repeatable list's value is an array of at most LIST_ITEMS_MAX items.
251
+ "com.kardalum.list": {
252
+ defaultSettings: { itemDataTypeId: null, min: null, max: null },
253
+ isEmpty: (value) => !Array.isArray(value) || value.length === 0,
254
+ validate(value) {
255
+ if (!Array.isArray(value))
256
+ return [{ key: "dataTypes.repeatableList.errors.invalid" }];
257
+ if (value.length > LIST_ITEMS_MAX)
258
+ return [{ key: "dataTypes.repeatableList.errors.tooMany", params: { max: LIST_ITEMS_MAX } }];
259
+ return [];
260
+ },
261
+ },
124
262
  };
@@ -1,4 +1,4 @@
1
- export { EntitlementError, ENTITLEMENT_FLOOR_TABLE, entitlementPlan, isEntitlementError, requireEntitlement, structuredStorageFloor, type EntitlementFloor, type EntitlementPlanOptions, type RequireEntitlementOptions, } from "./entitlement.js";
1
+ export { ENTITLEMENT_CHECK_MARKER, EntitlementError, ENTITLEMENT_FLOOR_TABLE, entitlementPlan, isClosingVerdict, isEntitlementError, requireEntitlement, structuredStorageFloor, type EntitlementFloor, type EntitlementPlanOptions, type RequireEntitlementOptions, } from "./entitlement.js";
2
2
  export { highestListingPlan, UNKNOWN_TERM, type EntitlementPlan } from "./entitlement-plan.js";
3
3
  export { LICENSE_VERDICT_PUBLIC_KEYS } from "./license-verdict-keys.js";
4
4
  export { isLocalHost } from "./local-host.js";
@@ -30,7 +30,7 @@
30
30
  // (403 plugin_read_only), and tells a route or hook so:
31
31
  //
32
32
  // if (context.readOnly) { skip writes }
33
- export { EntitlementError, ENTITLEMENT_FLOOR_TABLE, entitlementPlan, isEntitlementError, requireEntitlement, structuredStorageFloor, } from "./entitlement.js";
33
+ export { ENTITLEMENT_CHECK_MARKER, EntitlementError, ENTITLEMENT_FLOOR_TABLE, entitlementPlan, isClosingVerdict, isEntitlementError, requireEntitlement, structuredStorageFloor, } from "./entitlement.js";
34
34
  export { highestListingPlan, UNKNOWN_TERM } from "./entitlement-plan.js";
35
35
  export { LICENSE_VERDICT_PUBLIC_KEYS } from "./license-verdict-keys.js";
36
36
  export { isLocalHost } from "./local-host.js";
@@ -25,6 +25,11 @@ export declare function canonicalLicenseVerdictBytes(envelope: LicenseVerdictEnv
25
25
  * (the version 1 fields, then `planId` and `term`, null when absent). A
26
26
  * copy for the same reason as above; entitlement-gate.test.tsx pins it. */
27
27
  export declare function canonicalLicenseVerdictTermBytes(envelope: LicenseVerdictEnvelope): Uint8Array<ArrayBuffer>;
28
+ /** S367d: the bytes `noticeSignature` covers, built the way
29
+ * @kardalum/plugin-package's `canonicalizeLicenseVerdictNotice` builds them
30
+ * (the version 1 fields, then `notice`, null when absent). A copy for the
31
+ * same reason as above; entitlement-gate.test.tsx pins it. */
32
+ export declare function canonicalLicenseVerdictNoticeBytes(envelope: LicenseVerdictEnvelope): Uint8Array<ArrayBuffer>;
28
33
  /** true or false when this browser could check the signature itself; null
29
34
  * when it cannot import an Ed25519 key, and the host's answer stands in. */
30
35
  export declare function verifyEntitlementInBrowser(entitlement: {
@@ -39,6 +44,15 @@ export declare function verifyTermInBrowser(entitlement: {
39
44
  envelope: LicenseVerdictEnvelope;
40
45
  termSignature?: string;
41
46
  }, trustedKeys: TrustedKey[]): Promise<boolean | null>;
47
+ /** S367d (D14): the browser half of the SDK's `isClosingVerdict`. True when
48
+ * the envelope carries a service-closing notice whose `noticeSignature`
49
+ * verifies; false when it carries none, another kind, no signature or a
50
+ * wrong one; null when this browser cannot check it (the host's answer then
51
+ * stands in). */
52
+ export declare function verifyClosingInBrowser(entitlement: {
53
+ envelope: LicenseVerdictEnvelope;
54
+ noticeSignature?: string;
55
+ }, trustedKeys: TrustedKey[]): Promise<boolean | null>;
42
56
  /** `entitled` for `exempt` (a non-production install) on a page served from
43
57
  * a local host, and `locked` with `missing` for `exempt` anywhere else and
44
58
  * for `none` (no verdict held); a `verdict` is verified as above. A host answer the view cannot read at all (no session, an unknown
@@ -21,7 +21,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
21
21
  // and term when this browser verified their `termSignature`, otherwise plan
22
22
  // unknown, term active.
23
23
  import { useEffect, useState } from "react";
24
- import { highestListingPlan, planFromEnvelope, UNKNOWN_TERM } from "./entitlement-plan.js";
24
+ import { highestListingPlan, lapsedWhenRefunded, planFromEnvelope, UNKNOWN_TERM } from "./entitlement-plan.js";
25
25
  import { LICENSE_VERDICT_PUBLIC_KEYS } from "./license-verdict-keys.js";
26
26
  import { isLocalHost } from "./local-host.js";
27
27
  import { usePluginApi } from "./plugin-context.js";
@@ -79,6 +79,29 @@ export function canonicalLicenseVerdictTermBytes(envelope) {
79
79
  : { state: term.state, endsAt: term.endsAt, renewalAmountCents: term.renewalAmountCents, cancelAtPeriodEnd: term.cancelAtPeriodEnd },
80
80
  }));
81
81
  }
82
+ /** S367d: the bytes `noticeSignature` covers, built the way
83
+ * @kardalum/plugin-package's `canonicalizeLicenseVerdictNotice` builds them
84
+ * (the version 1 fields, then `notice`, null when absent). A copy for the
85
+ * same reason as above; entitlement-gate.test.tsx pins it. */
86
+ export function canonicalLicenseVerdictNoticeBytes(envelope) {
87
+ const notice = envelope.notice;
88
+ return new TextEncoder().encode(JSON.stringify({
89
+ v: envelope.v,
90
+ alg: envelope.alg,
91
+ typ: envelope.typ,
92
+ keyId: envelope.keyId,
93
+ keyHash: envelope.keyHash,
94
+ pluginId: envelope.pluginId,
95
+ domain: envelope.domain,
96
+ nonce: envelope.nonce,
97
+ status: envelope.status,
98
+ reason: envelope.reason ?? null,
99
+ issuedAt: envelope.issuedAt,
100
+ ...(envelope.tamper !== undefined ? { tamper: envelope.tamper } : {}),
101
+ ...(envelope.detail !== undefined ? { detail: envelope.detail } : {}),
102
+ notice: notice === undefined ? null : { kind: notice.kind, domain: notice.domain, at: notice.at },
103
+ }));
104
+ }
82
105
  function base64ToBytes(value) {
83
106
  const binary = atob(value);
84
107
  const bytes = new Uint8Array(binary.length);
@@ -185,8 +208,31 @@ export async function verifyTermInBrowser(entitlement, trustedKeys) {
185
208
  return false;
186
209
  return verifyBytesInBrowser(entitlement.envelope.keyId, entitlement.termSignature, canonicalLicenseVerdictTermBytes(entitlement.envelope), trustedKeys);
187
210
  }
188
- /** The checks after the signature, in the server's order. */
189
- function decide(entitlement, pluginId, now) {
211
+ // The SDK's SERVICE_CLOSING_NOTICE_KIND from @kardalum/api-schemas, which
212
+ // this browser entry does not import at runtime.
213
+ const CLOSING_KIND = "service-closing";
214
+ /** S367d (D14): the browser half of the SDK's `isClosingVerdict`. True when
215
+ * the envelope carries a service-closing notice whose `noticeSignature`
216
+ * verifies; false when it carries none, another kind, no signature or a
217
+ * wrong one; null when this browser cannot check it (the host's answer then
218
+ * stands in). */
219
+ export async function verifyClosingInBrowser(entitlement, trustedKeys) {
220
+ const notice = entitlement.envelope.notice;
221
+ if (typeof notice !== "object" || notice === null)
222
+ return false;
223
+ const n = notice;
224
+ if (n.kind !== CLOSING_KIND || typeof n.domain !== "string" || typeof n.at !== "string")
225
+ return false;
226
+ // S367d fix wave (I1): as isClosingVerdict, a local domain is never closing.
227
+ if (typeof entitlement.envelope.domain !== "string" || isLocalHost(entitlement.envelope.domain))
228
+ return false;
229
+ if (typeof entitlement.noticeSignature !== "string" || entitlement.noticeSignature.length === 0)
230
+ return false;
231
+ return verifyBytesInBrowser(entitlement.envelope.keyId, entitlement.noticeSignature, canonicalLicenseVerdictNoticeBytes(entitlement.envelope), trustedKeys);
232
+ }
233
+ /** The checks after the signature, in the server's order. A closing verdict
234
+ * (S367d) skips the 14-day age, as `requireEntitlement` does. */
235
+ function decide(entitlement, pluginId, now, closing) {
190
236
  const { envelope } = entitlement;
191
237
  if (envelope.pluginId !== pluginId)
192
238
  return { status: "locked", reason: "wrong-plugin", readOnly: false };
@@ -196,7 +242,7 @@ function decide(entitlement, pluginId, now) {
196
242
  const nowMs = now.getTime();
197
243
  if (!Number.isFinite(issuedMs))
198
244
  return { status: "locked", reason: "invalid-signature", readOnly: false };
199
- if (nowMs - issuedMs > BROWSER_ENTITLEMENT_MAX_AGE_MS)
245
+ if (!closing && nowMs - issuedMs > BROWSER_ENTITLEMENT_MAX_AGE_MS)
200
246
  return { status: "locked", reason: "expired", readOnly: false };
201
247
  if (issuedMs > nowMs + BROWSER_MAX_VERDICT_AGE_MS)
202
248
  return { status: "locked", reason: "expired", readOnly: false };
@@ -241,12 +287,23 @@ export function useEntitlement(pluginId) {
241
287
  const authentic = own ?? body.valid === true;
242
288
  if (!authentic)
243
289
  return { status: "locked", reason: "invalid-signature", readOnly: hostReadOnly };
244
- const decided = decide(entitlement, pluginId, new Date());
290
+ // S367d: where this browser cannot verify, the host's `valid` already
291
+ // answered the age (none for a closing verdict it verified), so a valid
292
+ // host answer on a verdict carrying a closing notice stands in.
293
+ const closingOwn = own === null ? null : await verifyClosingInBrowser(entitlement, LICENSE_VERDICT_PUBLIC_KEYS);
294
+ const closing = closingOwn ?? (body.valid === true && entitlement.envelope.notice?.kind === CLOSING_KIND);
295
+ const decided = decide(entitlement, pluginId, new Date(), closing);
245
296
  if (decided.status !== "entitled")
246
297
  return { ...decided, readOnly: hostReadOnly };
247
298
  const termOk = await verifyTermInBrowser(entitlement, LICENSE_VERDICT_PUBLIC_KEYS);
248
- const plan = planFromEnvelope(entitlement.envelope, termOk === true);
249
- return { ...decided, plan, readOnly: hostReadOnly || plan.term.state === "lapsed" };
299
+ // Part I6f: a refunded valid answer reads as lapsed, as entitlementPlan does.
300
+ const signedPlan = lapsedWhenRefunded(entitlement.envelope, planFromEnvelope(entitlement.envelope, termOk === true));
301
+ // S367d fix wave (task 10 M5): after closing nobody renews, so a closing
302
+ // verdict's signed term is read against the clock, as entitlementPlan does.
303
+ const endsAt = signedPlan.term.endsAt ? Date.parse(signedPlan.term.endsAt) : Number.NaN;
304
+ const plan = closing && Number.isFinite(endsAt) && Date.now() > endsAt ? { ...signedPlan, term: { ...signedPlan.term, state: "lapsed" } } : signedPlan;
305
+ const refundedValid = entitlement.envelope.status === "valid" && entitlement.envelope.reason === "refunded";
306
+ return { ...decided, plan, readOnly: hostReadOnly || plan.term.state === "lapsed" || refundedValid };
250
307
  })()
251
308
  .catch(() => ({ status: "locked", reason: "missing", readOnly: false }))
252
309
  .then((next) => {
@@ -19,3 +19,9 @@ export declare function highestListingPlan(plans: readonly ListingPlanSummary[]
19
19
  * `termVerified` says whether its `termSignature` did too; without it the
20
20
  * fields are not trusted and the plan reads as unknown. */
21
21
  export declare function planFromEnvelope(envelope: LicenseVerdictEnvelope, termVerified: boolean): EntitlementPlan;
22
+ /** Part I6f: a `valid` answer whose signed `reason` is `refunded` (the
23
+ * licence ended by a refund, and the author's effect keeps the plugin's
24
+ * reads) reads as lapsed, with or without a verified term. `reason` is
25
+ * covered by the base signature, so the caller's verification of that
26
+ * signature is all this needs. Any other envelope keeps its plan. */
27
+ export declare function lapsedWhenRefunded(envelope: LicenseVerdictEnvelope, plan: EntitlementPlan): EntitlementPlan;
@@ -24,3 +24,13 @@ export function planFromEnvelope(envelope, termVerified) {
24
24
  return { planId: null, term: { ...UNKNOWN_TERM } };
25
25
  return { planId: envelope.planId ?? null, term: envelope.term ? { ...envelope.term } : { ...UNKNOWN_TERM } };
26
26
  }
27
+ /** Part I6f: a `valid` answer whose signed `reason` is `refunded` (the
28
+ * licence ended by a refund, and the author's effect keeps the plugin's
29
+ * reads) reads as lapsed, with or without a verified term. `reason` is
30
+ * covered by the base signature, so the caller's verification of that
31
+ * signature is all this needs. Any other envelope keeps its plan. */
32
+ export function lapsedWhenRefunded(envelope, plan) {
33
+ if (envelope.status !== "valid" || envelope.reason !== "refunded")
34
+ return plan;
35
+ return { planId: plan.planId, term: { ...plan.term, state: "lapsed" } };
36
+ }
@@ -1,6 +1,11 @@
1
1
  import type { LicenseVerdictEnvelope, LicenseVerdictTerm } from "@kardalum/plugin-package";
2
- import type { ScopedStructuredStorage } from "./structured-storage-types.js";
3
- import type { PluginVendorService } from "./vendor-service.js";
2
+ import type { PluginSettingsReader } from "./providers.js";
3
+ import type { PluginAddressLookup, PluginServerContextBase } from "./structured-storage-types.js";
4
+ import type { PluginMail } from "./mail.js";
5
+ import type { PluginOutbound } from "./outbound.js";
6
+ import type { PluginSealing } from "./sealing.js";
7
+ import type { PluginContentLibrary } from "./content-library.js";
8
+ import type { PluginMediaLibrary } from "./media-library.js";
4
9
  export type { LicenseVerdictEnvelope, LicenseVerdictTerm };
5
10
  /** A live plan of the plugin's marketplace listing, as the listing API
6
11
  * names it (S316). `shape` is "free", "one_time", "monthly" or "yearly". */
@@ -14,12 +19,15 @@ export interface ListingPlanSummary {
14
19
  * marketplace signed it, whatever its status: a revoked or invalid one makes
15
20
  * `requireEntitlement` answer `not-valid`. `termSignature` (S317) covers the
16
21
  * envelope's `planId` and `term`; a host built before S317 hands none, and
17
- * the plan then reads as unknown. */
22
+ * the plan then reads as unknown. S367d: `noticeSignature` covers the
23
+ * verdict's notice; a verified service-closing notice keeps the verdict
24
+ * valid without the 14-day age. */
18
25
  export type EntitlementVerdict = {
19
26
  kind: "verdict";
20
27
  envelope: LicenseVerdictEnvelope;
21
28
  signature: string;
22
29
  termSignature?: string;
30
+ noticeSignature?: string;
23
31
  };
24
32
  /** What the host hands a plugin (S284b fix wave: a tagged value, so "no
25
33
  * check needed here" and "no verdict" can never be read as each other).
@@ -45,12 +53,28 @@ export type Entitlement = {
45
53
  };
46
54
  /** Why an entitlement was refused, in the order the checks run. */
47
55
  export type EntitlementErrorCode = "missing" | "invalid-signature" | "wrong-plugin" | "not-valid" | "expired";
48
- /** The context a scheduled task's `run` receives once a host runner exists
49
- * (design C1). `structuredStorage` is there for a plugin that declares
50
- * structured storage, so a task can keep the same floor
51
- * (`structuredStorageFloor`) its routes and hooks keep. */
52
- export type PluginTaskContext = {
53
- entitlement: Entitlement;
54
- structuredStorage?: ScopedStructuredStorage;
55
- vendorService?: PluginVendorService;
56
- };
56
+ /** The context a scheduled task's `run` receives (M32 F4d, D11): every server context's members (M33 K1), plus the
57
+ * task's own identity and an abort signal. `settings` is always there (a plugin that declares none
58
+ * reads an empty `all()`); `content` and `media` are there for a plugin that declares
59
+ * `contentAccess` and `mediaAccess`. `task.lastRunAt` is the last start the host recorded, an ISO
60
+ * time, or null for a first run. `signal` aborts when the run times out. */
61
+ export interface PluginTaskContext extends Omit<PluginServerContextBase, "settings">, PluginAddressLookup {
62
+ settings: PluginSettingsReader;
63
+ content?: PluginContentLibrary;
64
+ media?: PluginMediaLibrary;
65
+ /** M33 K11: one email to one person, of a kind the manifest declares under `mailKinds` and the
66
+ * site owner switched on. Present only for a plugin that declares `mailKinds`. */
67
+ mail?: PluginMail;
68
+ /** M33 K16: calls web addresses through the server's checked connection (`check`, `request`). Present only
69
+ * for a plugin that declares `outboundRequests`; a call after the plugin is switched off answers `inactive`. */
70
+ outbound?: PluginOutbound;
71
+ /** M33 K17: seals values the plugin makes under a key of its own for each declared kind (`seal`, `open`).
72
+ * Present only for a plugin that declares `sealedValues`; a call after the plugin is switched off answers `inactive`. */
73
+ sealing?: PluginSealing;
74
+ task: {
75
+ id: string;
76
+ slot: string;
77
+ lastRunAt: string | null;
78
+ };
79
+ signal: AbortSignal;
80
+ }