@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,139 @@
1
+ import { MCP_HELP_MAX_CHARS, MCP_TOOL_INPUT_SCHEMAS } from "./mcp-tool-inputs.schema.js";
2
+ import { isPluginHelpLabel } from "./plugin-document-types.js";
3
+ // M31.5 D (D1, D5, D6, D9): what a plugin may say to an MCP host, as plain rules, so the SDK's
4
+ // manifest schema (and through it install, update and `kardalum plugin validate`) and the
5
+ // marketplace door, which reads manifest.json without the SDK's Zod, read one rule. Every
6
+ // check is a length or a character scan: no pattern meets an author's text, and a message names
7
+ // only values that passed their own check.
8
+ /** D1: a tool's own name, 1 to 40 characters. */
9
+ export const PLUGIN_TOOL_NAME_MAX = 40;
10
+ /** D1: a tool's description, 1 to 500 characters, shown to the host cleaned like a help note. */
11
+ export const PLUGIN_TOOL_DESCRIPTION_MAX = 500;
12
+ /** D1: the plugin's part of a tool's full name. */
13
+ export const PLUGIN_TOOL_SHORT_NAME_MAX = 20;
14
+ /** The longest full name: the short name, "_" and the tool's own name. */
15
+ export const PLUGIN_TOOL_FULL_NAME_MAX = PLUGIN_TOOL_SHORT_NAME_MAX + 1 + PLUGIN_TOOL_NAME_MAX;
16
+ /** D5: one plugin's context for the AI. */
17
+ export const PLUGIN_AI_CONTEXT_MAX_CHARS = 2_000;
18
+ /** D5: every active plugin's context together, in the instructions. */
19
+ export const PLUGIN_AI_CONTEXTS_MAX_CHARS = 10_000;
20
+ function isLowerOrDigit(code) {
21
+ return (code >= 97 && code <= 122) || (code >= 48 && code <= 57);
22
+ }
23
+ /** Lower-case letters, digits and "_" after a first lower-case letter. */
24
+ function isToolAlphabet(text) {
25
+ const first = text.charCodeAt(0);
26
+ if (!(first >= 97 && first <= 122))
27
+ return false;
28
+ for (let i = 1; i < text.length; i++) {
29
+ const code = text.charCodeAt(i);
30
+ if (!isLowerOrDigit(code) && code !== 95)
31
+ return false;
32
+ }
33
+ return true;
34
+ }
35
+ /** D1: 1 to 40 lower-case letters, digits and "_", starting with a letter. */
36
+ export function isPluginToolName(name) {
37
+ return name.length > 0 && name.length <= PLUGIN_TOOL_NAME_MAX && isToolAlphabet(name);
38
+ }
39
+ /**
40
+ * D1: the plugin id's last segment in the tool alphabet: lower case, "-" written "_", anything else
41
+ * dropped, cut at 20, and any trailing "_" trimmed. The id's last segment starts with a letter
42
+ * (`PLUGIN_ID_REGEX`), so the short name does too, and the full name always has the call shape.
43
+ */
44
+ export function pluginToolShortName(pluginId) {
45
+ const segment = pluginId.slice(pluginId.lastIndexOf(".") + 1).slice(0, 128).toLowerCase();
46
+ let out = "";
47
+ for (let i = 0; i < segment.length && out.length < PLUGIN_TOOL_SHORT_NAME_MAX; i++) {
48
+ const code = segment.charCodeAt(i);
49
+ if (isLowerOrDigit(code))
50
+ out += segment[i];
51
+ else if (code === 45 || code === 95)
52
+ out += "_";
53
+ }
54
+ let end = out.length;
55
+ while (end > 0 && out.charCodeAt(end - 1) === 95)
56
+ end--;
57
+ out = out.slice(0, end);
58
+ return out === "" ? "plugin" : out;
59
+ }
60
+ /** D1: the name the host sees. */
61
+ export function pluginToolFullName(pluginId, name) {
62
+ return `${pluginToolShortName(pluginId)}_${name}`;
63
+ }
64
+ /** D4: a name of the full shape, what the audit records for a plugin tool's call. */
65
+ export function isPluginToolCallName(name) {
66
+ return name.length >= 3 && name.length <= PLUGIN_TOOL_FULL_NAME_MAX && name.includes("_") && isToolAlphabet(name);
67
+ }
68
+ const isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
69
+ const HELP_MESSAGE = `help must be text of at most ${MCP_HELP_MAX_CHARS} characters`;
70
+ /**
71
+ * D9: the tools a manifest marks (`mcpTool` on an `apiKey` route, a name of the D1 shape used
72
+ * once in the plugin and never a core tool's full name, a description of 1 to 500 characters),
73
+ * its `aiContext` (1 to 2,000 characters) and its help notes (at most 500 characters). The SDK
74
+ * passes `documentTypesChecked`, because its document type schema already caps the notes.
75
+ */
76
+ export function checkPluginAiDeclarations(manifest, options = {}) {
77
+ const issues = [];
78
+ const contributions = isRecord(manifest.contributions) ? manifest.contributions : {};
79
+ const pluginId = typeof manifest.id === "string" ? manifest.id : "";
80
+ const routes = Array.isArray(contributions.apiRoutes) ? contributions.apiRoutes : [];
81
+ const seen = new Map();
82
+ routes.forEach((route, index) => {
83
+ if (!isRecord(route) || route.mcpTool === undefined)
84
+ return;
85
+ const at = ["contributions", "apiRoutes", index, "mcpTool"];
86
+ if (route.access !== "apiKey") {
87
+ issues.push({ path: at, message: `apiRoutes.${index} marks mcpTool, but only an "apiKey" route can be a tool: an MCP host always calls with a key` });
88
+ }
89
+ const tool = route.mcpTool;
90
+ if (!isRecord(tool)) {
91
+ issues.push({ path: at, message: "mcpTool must be an object with a name and a description" });
92
+ return;
93
+ }
94
+ const { name, description } = tool;
95
+ if (typeof name !== "string" || !isPluginToolName(name)) {
96
+ issues.push({ path: [...at, "name"], message: `mcpTool.name must be 1 to ${PLUGIN_TOOL_NAME_MAX} lower-case letters, digits and "_", starting with a letter` });
97
+ }
98
+ else {
99
+ const earlier = seen.get(name);
100
+ if (earlier !== undefined) {
101
+ issues.push({ path: [...at, "name"], message: `the tool name "${name}" is also apiRoutes.${earlier}'s: each tool of a plugin needs its own name` });
102
+ }
103
+ else {
104
+ seen.set(name, index);
105
+ }
106
+ const full = pluginToolFullName(pluginId, name);
107
+ if (Object.hasOwn(MCP_TOOL_INPUT_SCHEMAS, full)) {
108
+ issues.push({ path: [...at, "name"], message: `the tool's full name "${full}" is the name of one of the site's own tools: choose another name` });
109
+ }
110
+ }
111
+ if (typeof description !== "string" || description.trim().length === 0 || description.length > PLUGIN_TOOL_DESCRIPTION_MAX) {
112
+ issues.push({ path: [...at, "description"], message: `mcpTool.description must be 1 to ${PLUGIN_TOOL_DESCRIPTION_MAX} characters` });
113
+ }
114
+ });
115
+ const context = contributions.aiContext;
116
+ if (context !== undefined && (typeof context !== "string" || context.trim().length === 0 || context.length > PLUGIN_AI_CONTEXT_MAX_CHARS)) {
117
+ issues.push({ path: ["contributions", "aiContext"], message: `aiContext must be text of 1 to ${PLUGIN_AI_CONTEXT_MAX_CHARS} characters` });
118
+ }
119
+ if (!options.documentTypesChecked) {
120
+ const types = Array.isArray(contributions.documentTypes) ? contributions.documentTypes : [];
121
+ types.forEach((type, index) => {
122
+ if (!isRecord(type))
123
+ return;
124
+ if (type.help !== undefined && (typeof type.help !== "string" || type.help.length > MCP_HELP_MAX_CHARS)) {
125
+ issues.push({ path: ["contributions", "documentTypes", index, "help"], message: HELP_MESSAGE });
126
+ }
127
+ const fields = Array.isArray(type.fields) ? type.fields : [];
128
+ fields.forEach((field, fieldIndex) => {
129
+ if (!isRecord(field) || field.help === undefined)
130
+ return;
131
+ // M33 K12: a field's note may be a language map, each text held to the same cap.
132
+ if (!isPluginHelpLabel(field.help)) {
133
+ issues.push({ path: ["contributions", "documentTypes", index, "fields", fieldIndex, "help"], message: HELP_MESSAGE });
134
+ }
135
+ });
136
+ });
137
+ }
138
+ return issues;
139
+ }
@@ -2,6 +2,19 @@
2
2
  * enforces (and the manual's enum test reads, through the SDK's re-export)
3
3
  * and the only methods this rule compares. */
4
4
  export declare const API_ROUTE_METHODS: readonly ["GET", "POST", "PUT", "PATCH", "DELETE"];
5
+ /** The largest request body a plugin route accepts, in bytes (64 KiB): the dispatcher's
6
+ * bodyLimit on POST, PUT, PATCH and DELETE, checked against content-length and while the body
7
+ * is read, before any parse. It is also the cap on what `rawBody` hands a route. */
8
+ export declare const PLUGIN_ROUTE_BODY_LIMIT_BYTES = 65536;
9
+ /** The largest error body a plugin route's handler may answer, in bytes (64 KiB), measured as
10
+ * the JSON text the host sends. A handler's own answer with a status outside 200 to 299 is the
11
+ * plugin's, sent as the plugin wrote it (no host schema runs on it), serialised to JSON under this
12
+ * cap; one over it, or one that cannot be serialised, answers the host's own 500. The same size as
13
+ * the request body cap: an error answer describes a request of at most that size. */
14
+ export declare const PLUGIN_ROUTE_ERROR_BODY_LIMIT_BYTES = 65536;
15
+ /** M33 K4: the methods on which an apiRoute may declare `rawBody: true`: the ones a provider
16
+ * sends a signed body with. */
17
+ export declare const API_ROUTE_RAW_BODY_METHODS: readonly ["POST", "PUT", "PATCH"];
5
18
  /** S297: a route's `schema.response` declares success statuses only, "200" to "299", at most this many. */
6
19
  export declare const API_ROUTE_RESPONSE_STATUSES_MAX = 4;
7
20
  /** True for a success status code written canonically as a string: "200" to "299". Linear, no pattern. */
@@ -47,11 +60,19 @@ export declare function checkApiRouteActions(manifest: {
47
60
  /** The `:name` parameters of a route path, in order. The one segment parser the
48
61
  * SDK's `schema.params` rule and the path rule share. */
49
62
  export declare function apiRoutePathParams(path: string): string[];
63
+ /** M33 K4: why a route's `rawBody` cannot stand, or null when it can (absent, or `true` on a
64
+ * POST, PUT or PATCH route): the exact request bytes, only where a body is sent to be signed.
65
+ * A method outside API_ROUTE_METHODS is the method rule's to report, not this one's. */
66
+ export declare function apiRouteRawBodyProblem(route: {
67
+ method?: unknown;
68
+ rawBody?: unknown;
69
+ }): string | null;
50
70
  /** S311 (S295): the method and tier of every apiRoute, as the SDK's enums
51
71
  * enforce them, for the gate that never sees Zod. checkApiRouteDeclarations
52
72
  * skips an entry whose method is not in the list because "the schema reports
53
73
  * it"; the door has no such schema, so `"get"` published. An absent `access` is
54
- * the documented default and stays valid; an unknown string is an error. */
74
+ * the documented default and stays valid; an unknown string is an error.
75
+ * M33 K4: `rawBody`, when given, is `true` on a POST, PUT or PATCH route. */
55
76
  export declare function checkApiRouteTiers(manifest: {
56
77
  contributions?: unknown;
57
78
  }): ApiRouteDeclarationIssue[];
@@ -11,6 +11,19 @@ import { API_ROUTE_ACCESS_TIERS } from "./plugin-vocabulary.js";
11
11
  * enforces (and the manual's enum test reads, through the SDK's re-export)
12
12
  * and the only methods this rule compares. */
13
13
  export const API_ROUTE_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE"];
14
+ /** The largest request body a plugin route accepts, in bytes (64 KiB): the dispatcher's
15
+ * bodyLimit on POST, PUT, PATCH and DELETE, checked against content-length and while the body
16
+ * is read, before any parse. It is also the cap on what `rawBody` hands a route. */
17
+ export const PLUGIN_ROUTE_BODY_LIMIT_BYTES = 65536;
18
+ /** The largest error body a plugin route's handler may answer, in bytes (64 KiB), measured as
19
+ * the JSON text the host sends. A handler's own answer with a status outside 200 to 299 is the
20
+ * plugin's, sent as the plugin wrote it (no host schema runs on it), serialised to JSON under this
21
+ * cap; one over it, or one that cannot be serialised, answers the host's own 500. The same size as
22
+ * the request body cap: an error answer describes a request of at most that size. */
23
+ export const PLUGIN_ROUTE_ERROR_BODY_LIMIT_BYTES = 65536;
24
+ /** M33 K4: the methods on which an apiRoute may declare `rawBody: true`: the ones a provider
25
+ * sends a signed body with. */
26
+ export const API_ROUTE_RAW_BODY_METHODS = ["POST", "PUT", "PATCH"];
14
27
  /** S297: a route's `schema.response` declares success statuses only, "200" to "299", at most this many. */
15
28
  export const API_ROUTE_RESPONSE_STATUSES_MAX = 4;
16
29
  /** True for a success status code written canonically as a string: "200" to "299". Linear, no pattern. */
@@ -169,11 +182,25 @@ export function apiRoutePathParams(path) {
169
182
  .filter((segment) => segment.startsWith(":"))
170
183
  .map((segment) => segment.slice(1));
171
184
  }
185
+ /** M33 K4: why a route's `rawBody` cannot stand, or null when it can (absent, or `true` on a
186
+ * POST, PUT or PATCH route): the exact request bytes, only where a body is sent to be signed.
187
+ * A method outside API_ROUTE_METHODS is the method rule's to report, not this one's. */
188
+ export function apiRouteRawBodyProblem(route) {
189
+ if (route.rawBody === undefined)
190
+ return null;
191
+ if (route.rawBody !== true)
192
+ return "rawBody must be true when it is given";
193
+ if (isApiRouteMethod(route.method) && !API_ROUTE_RAW_BODY_METHODS.includes(route.method)) {
194
+ return `rawBody is only for a ${API_ROUTE_RAW_BODY_METHODS.slice(0, -1).join(", ")} or ${API_ROUTE_RAW_BODY_METHODS.at(-1)} route, and this route is ${route.method}`;
195
+ }
196
+ return null;
197
+ }
172
198
  /** S311 (S295): the method and tier of every apiRoute, as the SDK's enums
173
199
  * enforce them, for the gate that never sees Zod. checkApiRouteDeclarations
174
200
  * skips an entry whose method is not in the list because "the schema reports
175
201
  * it"; the door has no such schema, so `"get"` published. An absent `access` is
176
- * the documented default and stays valid; an unknown string is an error. */
202
+ * the documented default and stays valid; an unknown string is an error.
203
+ * M33 K4: `rawBody`, when given, is `true` on a POST, PUT or PATCH route. */
177
204
  export function checkApiRouteTiers(manifest) {
178
205
  const contributions = manifest.contributions;
179
206
  const routes = contributions !== null && typeof contributions === "object" ? contributions.apiRoutes : undefined;
@@ -193,6 +220,9 @@ export function checkApiRouteTiers(manifest) {
193
220
  if (route.access !== undefined && !API_ROUTE_ACCESS_TIERS.includes(route.access)) {
194
221
  issues.push({ path: [...base, "access"], message: `access must be one of ${API_ROUTE_ACCESS_TIERS.join(", ")}, got ${JSON.stringify(route.access)}` });
195
222
  }
223
+ const rawBody = apiRouteRawBodyProblem(route);
224
+ if (rawBody !== null)
225
+ issues.push({ path: [...base, "rawBody"], message: rawBody });
196
226
  });
197
227
  return issues;
198
228
  }
@@ -0,0 +1,25 @@
1
+ import { z } from "zod";
2
+ export declare const PLUGIN_MEDIA_ACCESS_ACTIONS: readonly ["media.read", "media.create"];
3
+ export type PluginMediaAccessAction = (typeof PLUGIN_MEDIA_ACCESS_ACTIONS)[number];
4
+ export declare function isPluginMediaAccessAction(value: unknown): value is PluginMediaAccessAction;
5
+ export declare const PluginMediaAccessSchema: z.ZodObject<{
6
+ actions: z.ZodArray<z.ZodEnum<{
7
+ "media.read": "media.read";
8
+ "media.create": "media.create";
9
+ }>>;
10
+ }, z.core.$strict>;
11
+ export type PluginMediaAccess = z.infer<typeof PluginMediaAccessSchema>;
12
+ /** The rule over a manifest (live or manifest.json), as `path: message` issues. */
13
+ export declare function checkMediaAccessDeclarations(manifest: {
14
+ contributions?: unknown;
15
+ }): Array<{
16
+ path: (string | number)[];
17
+ message: string;
18
+ }>;
19
+ /** The actions a declaration holds. It is parsed first: a malformed declaration holds nothing,
20
+ * so a partly valid one never grants its valid half. */
21
+ export declare function mediaAccessActionsOf(mediaAccess: unknown): Set<PluginMediaAccessAction>;
22
+ /** M32 F4c (D10): the longest file name and media type `context.media.upload` sends. The bytes are
23
+ * capped by MEDIA_MAX_SIZE_CEILING_BYTES, and the route's own size setting applies under it. */
24
+ export declare const PLUGIN_MEDIA_FILENAME_MAX = 255;
25
+ export declare const PLUGIN_MEDIA_MIME_TYPE_MAX = 255;
@@ -0,0 +1,43 @@
1
+ import { z } from "zod";
2
+ // M32 F4c (D10): what a plugin may do with the media library through its media library,
3
+ // declared once in `contributions.mediaAccess`, in core action names. An object, not a bare
4
+ // list, so a later optional member (a folder, say) is additive. The SDK's manifest schema uses
5
+ // the schema; the `content access` delivery check runs checkMediaAccessDeclarations on
6
+ // manifest.json beside the content rule; the server reads mediaAccessActionsOf for the
7
+ // plugin's subject.
8
+ export const PLUGIN_MEDIA_ACCESS_ACTIONS = ["media.read", "media.create"];
9
+ export function isPluginMediaAccessAction(value) {
10
+ return typeof value === "string" && PLUGIN_MEDIA_ACCESS_ACTIONS.includes(value);
11
+ }
12
+ export const PluginMediaAccessSchema = z
13
+ .object({
14
+ actions: z
15
+ .array(z.enum(PLUGIN_MEDIA_ACCESS_ACTIONS))
16
+ .min(1, { error: "declares at least one action (leave mediaAccess out when the plugin uses no media)" })
17
+ .max(PLUGIN_MEDIA_ACCESS_ACTIONS.length)
18
+ .refine((values) => new Set(values).size === values.length, { message: "names each action once" }),
19
+ })
20
+ .strict();
21
+ /** The rule over a manifest (live or manifest.json), as `path: message` issues. */
22
+ export function checkMediaAccessDeclarations(manifest) {
23
+ const contributions = manifest.contributions;
24
+ if (contributions === null || typeof contributions !== "object")
25
+ return [];
26
+ const value = contributions.mediaAccess;
27
+ if (value === undefined)
28
+ return [];
29
+ const parsed = PluginMediaAccessSchema.safeParse(value);
30
+ if (parsed.success)
31
+ return [];
32
+ return parsed.error.issues.map((issue) => ({ path: ["contributions", "mediaAccess", ...issue.path.map((p) => (typeof p === "symbol" ? String(p) : p))], message: issue.message }));
33
+ }
34
+ /** The actions a declaration holds. It is parsed first: a malformed declaration holds nothing,
35
+ * so a partly valid one never grants its valid half. */
36
+ export function mediaAccessActionsOf(mediaAccess) {
37
+ const parsed = PluginMediaAccessSchema.safeParse(mediaAccess);
38
+ return new Set(parsed.success ? parsed.data.actions : []);
39
+ }
40
+ /** M32 F4c (D10): the longest file name and media type `context.media.upload` sends. The bytes are
41
+ * capped by MEDIA_MAX_SIZE_CEILING_BYTES, and the route's own size setting applies under it. */
42
+ export const PLUGIN_MEDIA_FILENAME_MAX = 255;
43
+ export const PLUGIN_MEDIA_MIME_TYPE_MAX = 255;
@@ -0,0 +1,107 @@
1
+ import { z } from "zod";
2
+ /** The longest address a plugin may hand `check` or `request`, in characters. */
3
+ export declare const OUTBOUND_URL_MAX = 2000;
4
+ /** A call's time limit when it names none: the whole exchange, body included. */
5
+ export declare const OUTBOUND_TIMEOUT_DEFAULT_MS = 10000;
6
+ /** The longest `timeoutMs` a call may ask for. */
7
+ export declare const OUTBOUND_TIMEOUT_MAX_MS = 30000;
8
+ /** The response body read when a call names no `maxResponseBytes`; past it the body is cut (`truncated: true`). */
9
+ export declare const OUTBOUND_RESPONSE_DEFAULT_BYTES = 65536;
10
+ /** The largest `maxResponseBytes` a call may ask for. */
11
+ export declare const OUTBOUND_RESPONSE_MAX_BYTES = 1048576;
12
+ /** The largest request body a call may send; a larger one is refused as `tooLarge`. */
13
+ export declare const OUTBOUND_REQUEST_BODY_MAX_BYTES = 1048576;
14
+ /** Redirects a call follows when it names no `redirects`. */
15
+ export declare const OUTBOUND_REDIRECTS_DEFAULT = 0;
16
+ /** The most redirects a call may follow. */
17
+ export declare const OUTBOUND_REDIRECTS_MAX = 3;
18
+ /** The most headers a call may set. */
19
+ export declare const OUTBOUND_HEADERS_MAX = 30;
20
+ /** The longest header value, in characters (no CR, LF or NUL in it). */
21
+ export declare const OUTBOUND_HEADER_VALUE_MAX = 8192;
22
+ /** Calls of one plugin running at once; a call past it waits up to OUTBOUND_WAIT_MAX_MS, then `busy`. */
23
+ export declare const OUTBOUND_PLUGIN_IN_FLIGHT_MAX = 8;
24
+ /** Calls of every plugin running at once on one server; past it as above. */
25
+ export declare const OUTBOUND_SERVER_IN_FLIGHT_MAX = 64;
26
+ /** How long a call waits for a free place before it is refused as `busy`. */
27
+ export declare const OUTBOUND_WAIT_MAX_MS = 30000;
28
+ /** Calls of one plugin waiting for a place at once; one more is refused as `busy` at once, so one
29
+ * plugin's backlog cannot grow without end. */
30
+ export declare const OUTBOUND_PLUGIN_WAITING_MAX: number;
31
+ /** `check` calls of one plugin running at once; one more answers `busy` at once, so one plugin
32
+ * looping on `check` cannot take the server's name lookups from the others. */
33
+ export declare const OUTBOUND_CHECK_IN_FLIGHT_MAX = 4;
34
+ /** The most CIDR ranges `KARDALUM_OUTBOUND_ALLOW` may hold. */
35
+ export declare const OUTBOUND_ALLOW_ENTRIES_MAX = 20;
36
+ /** The longest `outboundRequests.reason`, in characters, in each language. */
37
+ export declare const OUTBOUND_REASON_MAX = 300;
38
+ /** The resolver's own time limit for one name. */
39
+ export declare const OUTBOUND_DNS_TIMEOUT_MS = 2000;
40
+ /** The resolver's tries for one name. */
41
+ export declare const OUTBOUND_DNS_TRIES = 2;
42
+ /** Name lookups running at once on one server; the rest wait inside the call's own time limit. */
43
+ export declare const OUTBOUND_DNS_CONCURRENT_MAX = 16;
44
+ /** Name lookups waiting for a turn on one server; one more is refused as `busy` at once. */
45
+ export declare const OUTBOUND_DNS_WAITING_MAX = 256;
46
+ /** The methods a plugin may declare and call. */
47
+ export declare const OUTBOUND_METHODS: readonly ["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE"];
48
+ export type OutboundMethod = (typeof OUTBOUND_METHODS)[number];
49
+ /** Why `check` refused an address (and the first six kinds `request` throws). */
50
+ export declare const OUTBOUND_ADDRESS_REFUSALS: readonly ["invalid", "scheme", "credentials", "port", "private", "unresolved"];
51
+ export type OutboundAddressRefusal = (typeof OUTBOUND_ADDRESS_REFUSALS)[number];
52
+ /** What `check` answers when it refuses: an address refusal, `busy` (too many of the plugin's checks
53
+ * at once, or the server's lookups are full) or `inactive` (the plugin is no longer active). */
54
+ export declare const OUTBOUND_CHECK_REFUSALS: readonly ["invalid", "scheme", "credentials", "port", "private", "unresolved", "busy", "inactive"];
55
+ export type OutboundCheckRefusal = (typeof OUTBOUND_CHECK_REFUSALS)[number];
56
+ /** Every kind an `OutboundError` carries. */
57
+ export declare const OUTBOUND_ERROR_KINDS: readonly ["invalid", "scheme", "credentials", "port", "private", "unresolved", "redirect", "timeout", "network", "tls", "busy", "inactive", "method", "header", "tooLarge"];
58
+ export type OutboundErrorKind = (typeof OUTBOUND_ERROR_KINDS)[number];
59
+ /** Refused IPv4 ranges, unless `KARDALUM_OUTBOUND_ALLOW` holds the address. */
60
+ export declare const OUTBOUND_REFUSED_IPV4_RANGES: readonly ["0.0.0.0/8", "10.0.0.0/8", "100.64.0.0/10", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.2.0/24", "192.88.99.0/24", "192.168.0.0/16", "198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "224.0.0.0/4", "240.0.0.0/4"];
61
+ /** An IPv6 address must lie in this range (global unicast) ... */
62
+ export declare const OUTBOUND_IPV6_GLOBAL_RANGE = "2000::/3";
63
+ /** ... and outside these. */
64
+ export declare const OUTBOUND_REFUSED_IPV6_RANGES: readonly ["2001::/23", "2001:db8::/32", "2002::/16"];
65
+ /** IPv6 ranges whose address is checked as the IPv4 address in its last 32 bits: IPv4-mapped,
66
+ * IPv4-compatible and NAT64. Read before the two lists above. */
67
+ export declare const OUTBOUND_IPV4_CARRYING_IPV6_RANGES: readonly ["::ffff:0:0/96", "::/96", "64:ff9b::/96"];
68
+ /** A name refused before resolution: this one, and every name ending in "." plus it. */
69
+ export declare const OUTBOUND_LOCALHOST_NAME = "localhost";
70
+ /** Header names a call may not set (`header`), lower case. */
71
+ export declare const OUTBOUND_REFUSED_HEADERS: readonly ["host", "connection", "content-length", "transfer-encoding", "te", "upgrade", "keep-alive", "expect", "trailer"];
72
+ /** Every header name starting with this is refused as well. */
73
+ export declare const OUTBOUND_REFUSED_HEADER_PREFIX = "proxy-";
74
+ /** The only headers a plugin set that a redirect to another origin keeps. */
75
+ export declare const OUTBOUND_CROSS_ORIGIN_KEPT_HEADERS: readonly ["content-type", "user-agent", "accept"];
76
+ /** Redirect statuses a GET or HEAD follows. */
77
+ export declare const OUTBOUND_REDIRECT_STATUSES_GET_HEAD: readonly [301, 302, 303, 307, 308];
78
+ /** Redirect statuses any other method follows, method and body kept. */
79
+ export declare const OUTBOUND_REDIRECT_STATUSES_ANY_METHOD: readonly [307, 308];
80
+ /** `contributions.outboundRequests`: why the plugin calls addresses (shown at install, 1 to 300
81
+ * characters in each language, English required) and the methods it calls with (1 to 6, each once). */
82
+ export declare const PluginOutboundRequestsSchema: z.ZodObject<{
83
+ reason: z.ZodPreprocess<z.ZodObject<{
84
+ en: z.ZodString;
85
+ }, z.core.$catchall<z.ZodString>>, unknown>;
86
+ methods: z.ZodArray<z.ZodEnum<{
87
+ GET: "GET";
88
+ POST: "POST";
89
+ PUT: "PUT";
90
+ PATCH: "PATCH";
91
+ DELETE: "DELETE";
92
+ HEAD: "HEAD";
93
+ }>>;
94
+ }, z.core.$strict>;
95
+ export type PluginOutboundRequests = z.infer<typeof PluginOutboundRequestsSchema>;
96
+ /**
97
+ * What `context.outbound.request` throws. Its message names the kind and nothing else: never the
98
+ * address, a header or the body (the provider fetch rule), and it carries no `cause`, because a
99
+ * driver's error names the address.
100
+ */
101
+ export declare class OutboundError extends Error {
102
+ readonly kind: OutboundErrorKind;
103
+ constructor(kind: OutboundErrorKind);
104
+ }
105
+ /** True for an OutboundError from ANY copy of the SDK (a plugin bundles its own, so `instanceof`
106
+ * would miss the host's class): read by name and kind. */
107
+ export declare function isOutboundError(value: unknown): value is OutboundError;
@@ -0,0 +1,150 @@
1
+ import { z } from "zod";
2
+ import { labelMapSchema } from "./plugin-labels.js";
3
+ // M33 K16 (Webhooks 2.11 C1): checked outbound requests. A plugin that declares
4
+ // `contributions.outboundRequests` gets `context.outbound` on its hook, route, site route and
5
+ // scheduled task contexts, and every call it makes there goes through the host's one address
6
+ // checker (`apps/server/src/plugins/outbound/`). The limits, the refused ranges and the header and
7
+ // redirect rules live here as data, so the server, the docs and the tests read one list.
8
+ // Nothing here parses an address: the server parses with the WHATWG `URL` parser and checks
9
+ // ranges with `node:net` `BlockList`.
10
+ /** The longest address a plugin may hand `check` or `request`, in characters. */
11
+ export const OUTBOUND_URL_MAX = 2000;
12
+ /** A call's time limit when it names none: the whole exchange, body included. */
13
+ export const OUTBOUND_TIMEOUT_DEFAULT_MS = 10_000;
14
+ /** The longest `timeoutMs` a call may ask for. */
15
+ export const OUTBOUND_TIMEOUT_MAX_MS = 30_000;
16
+ /** The response body read when a call names no `maxResponseBytes`; past it the body is cut (`truncated: true`). */
17
+ export const OUTBOUND_RESPONSE_DEFAULT_BYTES = 65_536;
18
+ /** The largest `maxResponseBytes` a call may ask for. */
19
+ export const OUTBOUND_RESPONSE_MAX_BYTES = 1_048_576;
20
+ /** The largest request body a call may send; a larger one is refused as `tooLarge`. */
21
+ export const OUTBOUND_REQUEST_BODY_MAX_BYTES = 1_048_576;
22
+ /** Redirects a call follows when it names no `redirects`. */
23
+ export const OUTBOUND_REDIRECTS_DEFAULT = 0;
24
+ /** The most redirects a call may follow. */
25
+ export const OUTBOUND_REDIRECTS_MAX = 3;
26
+ /** The most headers a call may set. */
27
+ export const OUTBOUND_HEADERS_MAX = 30;
28
+ /** The longest header value, in characters (no CR, LF or NUL in it). */
29
+ export const OUTBOUND_HEADER_VALUE_MAX = 8192;
30
+ /** Calls of one plugin running at once; a call past it waits up to OUTBOUND_WAIT_MAX_MS, then `busy`. */
31
+ export const OUTBOUND_PLUGIN_IN_FLIGHT_MAX = 8;
32
+ /** Calls of every plugin running at once on one server; past it as above. */
33
+ export const OUTBOUND_SERVER_IN_FLIGHT_MAX = 64;
34
+ /** How long a call waits for a free place before it is refused as `busy`. */
35
+ export const OUTBOUND_WAIT_MAX_MS = 30_000;
36
+ /** Calls of one plugin waiting for a place at once; one more is refused as `busy` at once, so one
37
+ * plugin's backlog cannot grow without end. */
38
+ export const OUTBOUND_PLUGIN_WAITING_MAX = 4 * OUTBOUND_PLUGIN_IN_FLIGHT_MAX;
39
+ /** `check` calls of one plugin running at once; one more answers `busy` at once, so one plugin
40
+ * looping on `check` cannot take the server's name lookups from the others. */
41
+ export const OUTBOUND_CHECK_IN_FLIGHT_MAX = 4;
42
+ /** The most CIDR ranges `KARDALUM_OUTBOUND_ALLOW` may hold. */
43
+ export const OUTBOUND_ALLOW_ENTRIES_MAX = 20;
44
+ /** The longest `outboundRequests.reason`, in characters, in each language. */
45
+ export const OUTBOUND_REASON_MAX = 300;
46
+ /** The resolver's own time limit for one name. */
47
+ export const OUTBOUND_DNS_TIMEOUT_MS = 2000;
48
+ /** The resolver's tries for one name. */
49
+ export const OUTBOUND_DNS_TRIES = 2;
50
+ /** Name lookups running at once on one server; the rest wait inside the call's own time limit. */
51
+ export const OUTBOUND_DNS_CONCURRENT_MAX = 16;
52
+ /** Name lookups waiting for a turn on one server; one more is refused as `busy` at once. */
53
+ export const OUTBOUND_DNS_WAITING_MAX = 256;
54
+ /** The methods a plugin may declare and call. */
55
+ export const OUTBOUND_METHODS = ["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE"];
56
+ /** Why `check` refused an address (and the first six kinds `request` throws). */
57
+ export const OUTBOUND_ADDRESS_REFUSALS = ["invalid", "scheme", "credentials", "port", "private", "unresolved"];
58
+ /** What `check` answers when it refuses: an address refusal, `busy` (too many of the plugin's checks
59
+ * at once, or the server's lookups are full) or `inactive` (the plugin is no longer active). */
60
+ export const OUTBOUND_CHECK_REFUSALS = [...OUTBOUND_ADDRESS_REFUSALS, "busy", "inactive"];
61
+ /** Every kind an `OutboundError` carries. */
62
+ export const OUTBOUND_ERROR_KINDS = [
63
+ ...OUTBOUND_ADDRESS_REFUSALS,
64
+ "redirect",
65
+ "timeout",
66
+ "network",
67
+ "tls",
68
+ "busy",
69
+ "inactive",
70
+ "method",
71
+ "header",
72
+ "tooLarge",
73
+ ];
74
+ /** Refused IPv4 ranges, unless `KARDALUM_OUTBOUND_ALLOW` holds the address. */
75
+ export const OUTBOUND_REFUSED_IPV4_RANGES = [
76
+ "0.0.0.0/8",
77
+ "10.0.0.0/8",
78
+ "100.64.0.0/10",
79
+ "127.0.0.0/8",
80
+ "169.254.0.0/16",
81
+ "172.16.0.0/12",
82
+ "192.0.0.0/24",
83
+ "192.0.2.0/24",
84
+ "192.88.99.0/24",
85
+ "192.168.0.0/16",
86
+ "198.18.0.0/15",
87
+ "198.51.100.0/24",
88
+ "203.0.113.0/24",
89
+ "224.0.0.0/4",
90
+ "240.0.0.0/4",
91
+ ];
92
+ /** An IPv6 address must lie in this range (global unicast) ... */
93
+ export const OUTBOUND_IPV6_GLOBAL_RANGE = "2000::/3";
94
+ /** ... and outside these. */
95
+ export const OUTBOUND_REFUSED_IPV6_RANGES = ["2001::/23", "2001:db8::/32", "2002::/16"];
96
+ /** IPv6 ranges whose address is checked as the IPv4 address in its last 32 bits: IPv4-mapped,
97
+ * IPv4-compatible and NAT64. Read before the two lists above. */
98
+ export const OUTBOUND_IPV4_CARRYING_IPV6_RANGES = ["::ffff:0:0/96", "::/96", "64:ff9b::/96"];
99
+ /** A name refused before resolution: this one, and every name ending in "." plus it. */
100
+ export const OUTBOUND_LOCALHOST_NAME = "localhost";
101
+ /** Header names a call may not set (`header`), lower case. */
102
+ export const OUTBOUND_REFUSED_HEADERS = ["host", "connection", "content-length", "transfer-encoding", "te", "upgrade", "keep-alive", "expect", "trailer"];
103
+ /** Every header name starting with this is refused as well. */
104
+ export const OUTBOUND_REFUSED_HEADER_PREFIX = "proxy-";
105
+ /** The only headers a plugin set that a redirect to another origin keeps. */
106
+ export const OUTBOUND_CROSS_ORIGIN_KEPT_HEADERS = ["content-type", "user-agent", "accept"];
107
+ /** Redirect statuses a GET or HEAD follows. */
108
+ export const OUTBOUND_REDIRECT_STATUSES_GET_HEAD = [301, 302, 303, 307, 308];
109
+ /** Redirect statuses any other method follows, method and body kept. */
110
+ export const OUTBOUND_REDIRECT_STATUSES_ANY_METHOD = [307, 308];
111
+ /** `contributions.outboundRequests`: why the plugin calls addresses (shown at install, 1 to 300
112
+ * characters in each language, English required) and the methods it calls with (1 to 6, each once). */
113
+ export const PluginOutboundRequestsSchema = z
114
+ .object({
115
+ reason: labelMapSchema({ max: OUTBOUND_REASON_MAX }),
116
+ methods: z
117
+ .array(z.enum(OUTBOUND_METHODS))
118
+ .min(1, { message: "must name at least one method" })
119
+ .max(OUTBOUND_METHODS.length, { message: `names at most ${OUTBOUND_METHODS.length} methods` })
120
+ .superRefine((methods, ctx) => {
121
+ const seen = new Set();
122
+ methods.forEach((method, index) => {
123
+ if (seen.has(method))
124
+ ctx.addIssue({ code: "custom", message: `method "${method}" is named twice`, path: [index] });
125
+ seen.add(method);
126
+ });
127
+ }),
128
+ })
129
+ .strict();
130
+ /**
131
+ * What `context.outbound.request` throws. Its message names the kind and nothing else: never the
132
+ * address, a header or the body (the provider fetch rule), and it carries no `cause`, because a
133
+ * driver's error names the address.
134
+ */
135
+ export class OutboundError extends Error {
136
+ kind;
137
+ constructor(kind) {
138
+ super(`outbound request refused: ${kind}`);
139
+ this.name = "OutboundError";
140
+ this.kind = kind;
141
+ }
142
+ }
143
+ /** True for an OutboundError from ANY copy of the SDK (a plugin bundles its own, so `instanceof`
144
+ * would miss the host's class): read by name and kind. */
145
+ export function isOutboundError(value) {
146
+ if (!(value instanceof Error) || value.name !== "OutboundError")
147
+ return false;
148
+ const kind = value.kind;
149
+ return typeof kind === "string" && OUTBOUND_ERROR_KINDS.includes(kind);
150
+ }
@@ -0,0 +1,5 @@
1
+ import { z } from "zod";
2
+ export declare const PluginPackageBuildSchema: z.ZodObject<{
3
+ scrambled: z.ZodOptional<z.ZodBoolean>;
4
+ }, z.core.$strict>;
5
+ export type PluginPackageBuild = z.infer<typeof PluginPackageBuildSchema>;
@@ -0,0 +1,7 @@
1
+ import { z } from "zod";
2
+ // S367h (D3): how `kardalum plugin build` made a package, written into its
3
+ // manifest.json as `build`. `scrambled` is true when --scramble renamed the
4
+ // local identifiers and stripped the whitespace of server/plugin.js; absent
5
+ // otherwise. A record of the build, read by nobody to decide anything and
6
+ // shown nowhere on the listing.
7
+ export const PluginPackageBuildSchema = z.object({ scrambled: z.boolean().optional() }).strict();