@kardalum/plugin-sdk 0.20.0 → 0.21.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 (323) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/dist/admin-section-registry.d.ts +33 -1
  3. package/dist/admin-section-registry.js +67 -0
  4. package/dist/capabilities.js +46 -1
  5. package/dist/consent-entry.d.ts +11 -0
  6. package/dist/consent-entry.js +18 -0
  7. package/dist/content-library.d.ts +17 -0
  8. package/dist/content-list-extensions.d.ts +50 -0
  9. package/dist/content-list-extensions.js +11 -0
  10. package/dist/content-picker/page-picker-sheet.d.ts +2 -0
  11. package/dist/content-picker/page-picker-sheet.js +1 -1
  12. package/dist/content-picker/page-picker.d.ts +18 -0
  13. package/dist/content-picker/page-picker.js +20 -0
  14. package/dist/datatype-validation.js +10 -2
  15. package/dist/datatypes-entry.d.ts +1 -0
  16. package/dist/datatypes-entry.js +2 -0
  17. package/dist/entitlement-types.d.ts +18 -1
  18. package/dist/host-entry.d.ts +7 -1
  19. package/dist/host-entry.js +14 -1
  20. package/dist/index.d.ts +35 -7
  21. package/dist/index.js +46 -5
  22. package/dist/mail.d.ts +6 -2
  23. package/dist/manifest-entry.d.ts +22 -4
  24. package/dist/manifest-entry.js +25 -1
  25. package/dist/manifest-schema.d.ts +570 -31
  26. package/dist/manifest-schema.js +240 -12
  27. package/dist/manifest.d.ts +757 -32
  28. package/dist/manifest.js +8 -4
  29. package/dist/plugin-context.d.ts +47 -0
  30. package/dist/plugin-context.js +27 -0
  31. package/dist/plugin-permissions.d.ts +18 -0
  32. package/dist/plugin-permissions.js +25 -0
  33. package/dist/plugin-screen-context.d.ts +152 -11
  34. package/dist/plugin-screen-context.js +30 -0
  35. package/dist/providers.d.ts +47 -2
  36. package/dist/render-page.d.ts +15 -0
  37. package/dist/render-page.js +20 -0
  38. package/dist/richtext/block-panel.d.ts +12 -1
  39. package/dist/richtext/block-panel.js +27 -21
  40. package/dist/richtext/button-view.d.ts +11 -0
  41. package/dist/richtext/button-view.js +45 -0
  42. package/dist/richtext/content-guard.d.ts +4 -0
  43. package/dist/richtext/content-guard.js +27 -0
  44. package/dist/richtext/editor-handle.d.ts +34 -0
  45. package/dist/richtext/editor-handle.js +225 -0
  46. package/dist/richtext/extensions.d.ts +6 -0
  47. package/dist/richtext/extensions.js +16 -0
  48. package/dist/richtext/insert-menu.d.ts +6 -1
  49. package/dist/richtext/insert-menu.js +38 -18
  50. package/dist/richtext/item-attributes.d.ts +6 -0
  51. package/dist/richtext/item-attributes.js +19 -0
  52. package/dist/richtext/item-panel.d.ts +25 -0
  53. package/dist/richtext/item-panel.js +118 -0
  54. package/dist/richtext/item-view.d.ts +58 -0
  55. package/dist/richtext/item-view.js +172 -0
  56. package/dist/richtext/mark-form.d.ts +10 -0
  57. package/dist/richtext/mark-form.js +38 -0
  58. package/dist/richtext/paste-choice.d.ts +9 -0
  59. package/dist/richtext/paste-choice.js +13 -0
  60. package/dist/richtext/plugin-items.d.ts +72 -0
  61. package/dist/richtext/plugin-items.js +562 -0
  62. package/dist/richtext/plugin-mark-tooltips.d.ts +5 -0
  63. package/dist/richtext/plugin-mark-tooltips.js +44 -0
  64. package/dist/richtext/plugin-toolbar.d.ts +57 -0
  65. package/dist/richtext/plugin-toolbar.js +186 -0
  66. package/dist/richtext/rich-item-icons.d.ts +5 -0
  67. package/dist/richtext/rich-item-icons.js +42 -0
  68. package/dist/richtext/rich-items.d.ts +42 -0
  69. package/dist/richtext/rich-items.js +68 -0
  70. package/dist/richtext/rich-text-view-host.d.ts +24 -0
  71. package/dist/richtext/rich-text-view-host.js +11 -0
  72. package/dist/richtext/toolbar-button.d.ts +16 -0
  73. package/dist/richtext/toolbar-button.js +9 -0
  74. package/dist/richtext/url-paste.d.ts +20 -0
  75. package/dist/richtext/url-paste.js +82 -0
  76. package/dist/richtext-html-entry.d.ts +5 -0
  77. package/dist/richtext-html-entry.js +11 -0
  78. package/dist/sdk-strings.d.ts +59 -0
  79. package/dist/sdk-strings.js +64 -0
  80. package/dist/service-contract.d.ts +17 -0
  81. package/dist/service-contract.js +39 -0
  82. package/dist/services.d.ts +114 -0
  83. package/dist/services.js +1 -0
  84. package/dist/structured-storage-types.d.ts +124 -4
  85. package/dist/tailwind.js +10 -5
  86. package/dist/template-reads.d.ts +16 -0
  87. package/dist/template-reads.js +21 -0
  88. package/dist/testing-entry.d.ts +38 -0
  89. package/dist/testing-entry.js +173 -0
  90. package/dist/text-entry.d.ts +1 -1
  91. package/dist/text-entry.js +3 -2
  92. package/dist/tokens/system-dark.css +1 -0
  93. package/dist/tokens/tailwind-theme.css +2 -0
  94. package/dist/tokens/tokens.css +4 -0
  95. package/dist/tokens/tokens.json +5 -1
  96. package/dist/uploads.d.ts +43 -0
  97. package/dist/uploads.js +1 -0
  98. package/dist/user-library.d.ts +51 -0
  99. package/dist/user-library.js +15 -0
  100. package/dist/view-helpers.d.ts +18 -0
  101. package/dist/view-helpers.js +64 -0
  102. package/dist/views/content-list-view.js +207 -8
  103. package/dist/views/content-picker-view.js +1 -1
  104. package/dist/views/rich-text-view.d.ts +2 -0
  105. package/dist/views/rich-text-view.js +182 -24
  106. package/dist/views/unreadable-rich-text.d.ts +17 -0
  107. package/dist/views/unreadable-rich-text.js +40 -0
  108. package/dist/visitors.d.ts +81 -0
  109. package/dist/visitors.js +1 -0
  110. package/node_modules/@kardalum/api-schemas/dist/ai-app-hosts.d.ts +21 -0
  111. package/node_modules/@kardalum/api-schemas/dist/ai-app-hosts.js +39 -0
  112. package/node_modules/@kardalum/api-schemas/dist/ai-app-redirects.d.ts +2 -0
  113. package/node_modules/@kardalum/api-schemas/dist/ai-app-redirects.js +31 -0
  114. package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.d.ts +127 -8
  115. package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.js +82 -7
  116. package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +5 -1
  117. package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +2 -2
  118. package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.d.ts +7 -0
  119. package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.js +11 -0
  120. package/node_modules/@kardalum/api-schemas/dist/capability-detail.d.ts +1 -1
  121. package/node_modules/@kardalum/api-schemas/dist/capability-detail.js +18 -0
  122. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +80 -0
  123. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +41 -2
  124. package/node_modules/@kardalum/api-schemas/dist/content-reads.schema.d.ts +213 -0
  125. package/node_modules/@kardalum/api-schemas/dist/content-reads.schema.js +234 -0
  126. package/node_modules/@kardalum/api-schemas/dist/contribution-issues.d.ts +11 -0
  127. package/node_modules/@kardalum/api-schemas/dist/contribution-issues.js +14 -0
  128. package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +50 -13
  129. package/node_modules/@kardalum/api-schemas/dist/core-actions.js +19 -10
  130. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +77 -0
  131. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +37 -0
  132. package/node_modules/@kardalum/api-schemas/dist/experimental-points.d.ts +19 -0
  133. package/node_modules/@kardalum/api-schemas/dist/experimental-points.js +250 -0
  134. package/node_modules/@kardalum/api-schemas/dist/form-protection-callers.d.ts +29 -0
  135. package/node_modules/@kardalum/api-schemas/dist/form-protection-callers.js +31 -0
  136. package/node_modules/@kardalum/api-schemas/dist/html-scan.d.ts +22 -0
  137. package/node_modules/@kardalum/api-schemas/dist/html-scan.js +122 -0
  138. package/node_modules/@kardalum/api-schemas/dist/html-start-tags.d.ts +48 -0
  139. package/node_modules/@kardalum/api-schemas/dist/html-start-tags.js +381 -0
  140. package/node_modules/@kardalum/api-schemas/dist/index.d.ts +52 -14
  141. package/node_modules/@kardalum/api-schemas/dist/index.js +53 -9
  142. package/node_modules/@kardalum/api-schemas/dist/json-depth.d.ts +3 -0
  143. package/node_modules/@kardalum/api-schemas/dist/json-depth.js +20 -0
  144. package/node_modules/@kardalum/api-schemas/dist/mail-rules.d.ts +4 -2
  145. package/node_modules/@kardalum/api-schemas/dist/mail-rules.js +6 -1
  146. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +178 -2
  147. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +10 -0
  148. package/node_modules/@kardalum/api-schemas/dist/mcp-plugins.schema.d.ts +3 -3
  149. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +16 -0
  150. package/node_modules/@kardalum/api-schemas/dist/media.schema.d.ts +4 -0
  151. package/node_modules/@kardalum/api-schemas/dist/media.schema.js +4 -0
  152. package/node_modules/@kardalum/api-schemas/dist/nested-validation.d.ts +7 -0
  153. package/node_modules/@kardalum/api-schemas/dist/nested-validation.js +51 -2
  154. package/node_modules/@kardalum/api-schemas/dist/page-audience.schema.d.ts +87 -0
  155. package/node_modules/@kardalum/api-schemas/dist/page-audience.schema.js +44 -0
  156. package/node_modules/@kardalum/api-schemas/dist/plugin-admin-slots.d.ts +11 -0
  157. package/node_modules/@kardalum/api-schemas/dist/plugin-admin-slots.js +61 -0
  158. package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.d.ts +4 -2
  159. package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.js +12 -2
  160. package/node_modules/@kardalum/api-schemas/dist/plugin-content-slots.d.ts +136 -0
  161. package/node_modules/@kardalum/api-schemas/dist/plugin-content-slots.js +254 -0
  162. package/node_modules/@kardalum/api-schemas/dist/plugin-contract-checks.d.ts +22 -0
  163. package/node_modules/@kardalum/api-schemas/dist/plugin-contract-checks.js +66 -0
  164. package/node_modules/@kardalum/api-schemas/dist/plugin-contract-document.d.ts +130 -0
  165. package/node_modules/@kardalum/api-schemas/dist/plugin-contract-document.js +173 -0
  166. package/node_modules/@kardalum/api-schemas/dist/plugin-contract-fetch.d.ts +16 -0
  167. package/node_modules/@kardalum/api-schemas/dist/plugin-contract-fetch.js +112 -0
  168. package/node_modules/@kardalum/api-schemas/dist/plugin-contract-schema.d.ts +70 -0
  169. package/node_modules/@kardalum/api-schemas/dist/plugin-contract-schema.js +380 -0
  170. package/node_modules/@kardalum/api-schemas/dist/plugin-contract-types.d.ts +3 -0
  171. package/node_modules/@kardalum/api-schemas/dist/plugin-contract-types.js +68 -0
  172. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +18 -0
  173. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +18 -0
  174. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +5 -2
  175. package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.d.ts +10 -2
  176. package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.js +48 -1
  177. package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.d.ts +5 -2
  178. package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.js +6 -4
  179. package/node_modules/@kardalum/api-schemas/dist/plugin-events.d.ts +24 -0
  180. package/node_modules/@kardalum/api-schemas/dist/plugin-events.js +53 -0
  181. package/node_modules/@kardalum/api-schemas/dist/plugin-guards.d.ts +112 -0
  182. package/node_modules/@kardalum/api-schemas/dist/plugin-guards.js +118 -0
  183. package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.d.ts +12 -0
  184. package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.js +3 -0
  185. package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +2 -0
  186. package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +3 -0
  187. package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +67 -0
  188. package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +15 -0
  189. package/node_modules/@kardalum/api-schemas/dist/plugin-kept-parts.d.ts +138 -0
  190. package/node_modules/@kardalum/api-schemas/dist/plugin-kept-parts.js +110 -0
  191. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +80 -15
  192. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +67 -23
  193. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +10 -3
  194. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +33 -8
  195. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +2 -1
  196. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +7 -1
  197. package/node_modules/@kardalum/api-schemas/dist/plugin-outbound.d.ts +1 -1
  198. package/node_modules/@kardalum/api-schemas/dist/plugin-providers.d.ts +43 -7
  199. package/node_modules/@kardalum/api-schemas/dist/plugin-providers.js +36 -5
  200. package/node_modules/@kardalum/api-schemas/dist/plugin-rich-text.d.ts +638 -0
  201. package/node_modules/@kardalum/api-schemas/dist/plugin-rich-text.js +533 -0
  202. package/node_modules/@kardalum/api-schemas/dist/plugin-service-call.d.ts +36 -0
  203. package/node_modules/@kardalum/api-schemas/dist/plugin-service-call.js +32 -0
  204. package/node_modules/@kardalum/api-schemas/dist/plugin-service-connections.d.ts +193 -0
  205. package/node_modules/@kardalum/api-schemas/dist/plugin-service-connections.js +123 -0
  206. package/node_modules/@kardalum/api-schemas/dist/plugin-service-declarations.d.ts +209 -0
  207. package/node_modules/@kardalum/api-schemas/dist/plugin-service-declarations.js +372 -0
  208. package/node_modules/@kardalum/api-schemas/dist/plugin-services.d.ts +90 -0
  209. package/node_modules/@kardalum/api-schemas/dist/plugin-services.js +204 -0
  210. package/node_modules/@kardalum/api-schemas/dist/plugin-settings.d.ts +10 -0
  211. package/node_modules/@kardalum/api-schemas/dist/plugin-settings.js +10 -1
  212. package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.d.ts +171 -4
  213. package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.js +406 -42
  214. package/node_modules/@kardalum/api-schemas/dist/plugin-site-requests.d.ts +69 -0
  215. package/node_modules/@kardalum/api-schemas/dist/plugin-site-requests.js +149 -0
  216. package/node_modules/@kardalum/api-schemas/dist/plugin-styles.d.ts +5 -0
  217. package/node_modules/@kardalum/api-schemas/dist/plugin-styles.js +13 -0
  218. package/node_modules/@kardalum/api-schemas/dist/plugin-uploads.d.ts +96 -0
  219. package/node_modules/@kardalum/api-schemas/dist/plugin-uploads.js +185 -0
  220. package/node_modules/@kardalum/api-schemas/dist/plugin-user-accounts.d.ts +213 -0
  221. package/node_modules/@kardalum/api-schemas/dist/plugin-user-accounts.js +131 -0
  222. package/node_modules/@kardalum/api-schemas/dist/plugin-view-kit.d.ts +54 -0
  223. package/node_modules/@kardalum/api-schemas/dist/plugin-view-kit.js +154 -0
  224. package/node_modules/@kardalum/api-schemas/dist/plugin-visitor-points.d.ts +37 -0
  225. package/node_modules/@kardalum/api-schemas/dist/plugin-visitor-points.js +124 -0
  226. package/node_modules/@kardalum/api-schemas/dist/render-cache.d.ts +126 -0
  227. package/node_modules/@kardalum/api-schemas/dist/render-cache.js +263 -0
  228. package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +303 -0
  229. package/node_modules/@kardalum/api-schemas/dist/render-editing.js +61 -0
  230. package/node_modules/@kardalum/api-schemas/dist/rich-text-paste-hosts.d.ts +14 -0
  231. package/node_modules/@kardalum/api-schemas/dist/rich-text-paste-hosts.js +108 -0
  232. package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.d.ts +66 -1
  233. package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.js +465 -7
  234. package/node_modules/@kardalum/api-schemas/dist/rich-text-text.js +15 -118
  235. package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +110 -0
  236. package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.js +36 -0
  237. package/node_modules/@kardalum/api-schemas/dist/security-overview.schema.d.ts +64 -0
  238. package/node_modules/@kardalum/api-schemas/dist/security-overview.schema.js +38 -0
  239. package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.d.ts +9 -2
  240. package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.js +7 -2
  241. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +26 -0
  242. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +19 -0
  243. package/node_modules/@kardalum/api-schemas/dist/sign-in-steps.d.ts +724 -0
  244. package/node_modules/@kardalum/api-schemas/dist/sign-in-steps.js +408 -0
  245. package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.d.ts +5 -3
  246. package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.js +3 -1
  247. package/node_modules/@kardalum/api-schemas/dist/site-consent.d.ts +77 -0
  248. package/node_modules/@kardalum/api-schemas/dist/site-consent.js +122 -0
  249. package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.d.ts +4 -0
  250. package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.js +28 -0
  251. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +33 -0
  252. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +26 -1
  253. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +14 -0
  254. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +2 -0
  255. package/node_modules/@kardalum/api-schemas/dist/visitor-accounts.d.ts +482 -0
  256. package/node_modules/@kardalum/api-schemas/dist/visitor-accounts.js +380 -0
  257. package/node_modules/@kardalum/api-schemas/dist/visitor-groups.d.ts +109 -0
  258. package/node_modules/@kardalum/api-schemas/dist/visitor-groups.js +62 -0
  259. package/node_modules/@kardalum/api-schemas/package.json +1 -0
  260. package/node_modules/@kardalum/design-tokens/dist/build-css.js +9 -1
  261. package/node_modules/@kardalum/design-tokens/dist/system-dark.css +1 -0
  262. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +2 -0
  263. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +1 -0
  264. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +2 -0
  265. package/node_modules/@kardalum/design-tokens/dist/tokens.css +4 -0
  266. package/node_modules/@kardalum/design-tokens/dist/tokens.js +6 -0
  267. package/node_modules/@kardalum/design-tokens/dist/tokens.json +5 -1
  268. package/node_modules/@kardalum/design-tokens/dist/types.d.ts +4 -0
  269. package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +17 -0
  270. package/node_modules/@kardalum/plugin-package/dist/build-reference.js +9 -0
  271. package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +1 -1
  272. package/node_modules/@kardalum/plugin-package/dist/capabilities.js +276 -19
  273. package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +1 -1
  274. package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +23 -0
  275. package/node_modules/@kardalum/plugin-package/dist/contract-fingerprint.d.ts +17 -0
  276. package/node_modules/@kardalum/plugin-package/dist/contract-fingerprint.js +39 -0
  277. package/node_modules/@kardalum/plugin-package/dist/delivery/admin-styles.d.ts +23 -0
  278. package/node_modules/@kardalum/plugin-package/dist/delivery/admin-styles.js +351 -0
  279. package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.d.ts +2 -0
  280. package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.js +1 -1
  281. package/node_modules/@kardalum/plugin-package/dist/delivery/content-access.js +21 -8
  282. package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +1 -1
  283. package/node_modules/@kardalum/plugin-package/dist/delivery/editor-extensions.js +23 -10
  284. package/node_modules/@kardalum/plugin-package/dist/delivery/icons.js +3 -2
  285. package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +2 -0
  286. package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +2 -0
  287. package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +30 -2
  288. package/node_modules/@kardalum/plugin-package/dist/delivery/licence-check.js +6 -2
  289. package/node_modules/@kardalum/plugin-package/dist/delivery/limits.d.ts +6 -0
  290. package/node_modules/@kardalum/plugin-package/dist/delivery/limits.js +6 -0
  291. package/node_modules/@kardalum/plugin-package/dist/delivery/providers.d.ts +2 -0
  292. package/node_modules/@kardalum/plugin-package/dist/delivery/providers.js +24 -6
  293. package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +15 -0
  294. package/node_modules/@kardalum/plugin-package/dist/delivery/rich-text.d.ts +2 -0
  295. package/node_modules/@kardalum/plugin-package/dist/delivery/rich-text.js +173 -0
  296. package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.js +1 -1
  297. package/node_modules/@kardalum/plugin-package/dist/delivery/server-powers.js +14 -4
  298. package/node_modules/@kardalum/plugin-package/dist/delivery/services-events.d.ts +3 -0
  299. package/node_modules/@kardalum/plugin-package/dist/delivery/services-events.js +35 -0
  300. package/node_modules/@kardalum/plugin-package/dist/delivery/sign-in-steps.d.ts +3 -0
  301. package/node_modules/@kardalum/plugin-package/dist/delivery/sign-in-steps.js +71 -0
  302. package/node_modules/@kardalum/plugin-package/dist/delivery/site-extensions.js +44 -11
  303. package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +7 -0
  304. package/node_modules/@kardalum/plugin-package/dist/delivery/user-accounts.d.ts +3 -0
  305. package/node_modules/@kardalum/plugin-package/dist/delivery/user-accounts.js +36 -0
  306. package/node_modules/@kardalum/plugin-package/dist/delivery/visitor-points.d.ts +3 -0
  307. package/node_modules/@kardalum/plugin-package/dist/delivery/visitor-points.js +33 -0
  308. package/node_modules/@kardalum/plugin-package/dist/index.d.ts +4 -0
  309. package/node_modules/@kardalum/plugin-package/dist/index.js +5 -0
  310. package/node_modules/@kardalum/plugin-package/dist/public-suffix.d.ts +7 -0
  311. package/node_modules/@kardalum/plugin-package/dist/public-suffix.js +23 -0
  312. package/node_modules/@kardalum/plugin-package/dist/rich-text-summary.d.ts +1 -0
  313. package/node_modules/@kardalum/plugin-package/dist/rich-text-summary.js +27 -0
  314. package/node_modules/@kardalum/plugin-package/dist/stylesheet-load-hook.d.ts +2 -0
  315. package/node_modules/@kardalum/plugin-package/dist/stylesheet-load-hook.js +28 -0
  316. package/node_modules/@kardalum/plugin-package/package.json +4 -0
  317. package/node_modules/@kardalum/ui/dist/components/select.d.ts +6 -0
  318. package/node_modules/@kardalum/ui/dist/components/select.js +7 -0
  319. package/node_modules/@kardalum/ui/dist/components/textarea.d.ts +6 -0
  320. package/node_modules/@kardalum/ui/dist/components/textarea.js +7 -0
  321. package/node_modules/@kardalum/ui/dist/index.d.ts +2 -0
  322. package/node_modules/@kardalum/ui/dist/index.js +2 -0
  323. package/package.json +15 -3
@@ -1,6 +1,8 @@
1
1
  import { z } from "zod";
2
2
  import { THUMBNAIL_EDITOR_ID } from "./media-rendition.schema.js";
3
- import { NodeAccessFlagsSchema } from "./node-access.schema.js";
3
+ import { ApiErrorSchema } from "./api-error.schema.js";
4
+ import { NodeAccessFlagsSchema, NodeAccessRefusalSchema } from "./node-access.schema.js";
5
+ import { ListFilterErrorSchema } from "./plugin-content-slots.js";
4
6
  import { UuidStringSchema } from "./uuid.schema.js";
5
7
  // S232: past this many children, the tree stops rendering them as
6
8
  // expandable rows and shows a hint to mark the type as a collection
@@ -89,7 +91,8 @@ export const CONTENT_LIST_DEFAULT_SETTINGS = {
89
91
  // other content list (api-design.md), plus a name filter and a
90
92
  // comma-separated set of field ids so the response only carries the data
91
93
  // the configured columns actually need.
92
- export const ContentListQuerySchema = z.object({
94
+ export const ContentListQuerySchema = z
95
+ .object({
93
96
  cursor: z.string().uuid().optional(),
94
97
  limit: z.coerce.number().int().min(1).max(50).default(25),
95
98
  name: z.string().max(200).optional(),
@@ -97,6 +100,15 @@ export const ContentListQuerySchema = z.object({
97
100
  // Parsed by the route, not here, the same split as ContentByPathQuery
98
101
  // taking a raw path string.
99
102
  fields: z.string().max(2000).optional(),
103
+ // M35 C2 (W5, experimental): one plugin filter, `<pluginId>/<filterId>`, and one of its option values.
104
+ filter: z.string().min(3).max(300).optional(),
105
+ filterValue: z.string().min(1).max(40).optional(),
106
+ // M35 C2: the content language a plugin filter matches in, as the table's plugin columns are read in
107
+ // it; one of the site's languages, the default otherwise. Read only with `filter`.
108
+ culture: z.string().min(2).max(35).optional(),
109
+ })
110
+ .refine((query) => (query.filter === undefined) === (query.filterValue === undefined), {
111
+ message: "filter and filterValue are given together",
100
112
  });
101
113
  // One row of the list. `fields` carries only the requested field ids
102
114
  // (ContentListQuery.fields), not the whole document, keeping the response
@@ -111,6 +123,10 @@ export const ContentListRowSchema = z.object({
111
123
  status: z.enum(["draft", "published", "changes"]),
112
124
  updatedAt: z.string().datetime(),
113
125
  publishedAt: z.string().datetime().nullable(),
126
+ // M35 C2: what a tree action or a bulk action is told about the row, as the tree tells it.
127
+ path: z.string().min(1),
128
+ documentTypeId: z.string().uuid(),
129
+ childCount: z.number().int().nonnegative(),
114
130
  fields: z.record(z.string(), z.unknown()),
115
131
  // What the signed-in person may do on this node (S276). A row whose read is
116
132
  // false has empty `fields`; its name, url and status stay.
@@ -120,7 +136,16 @@ export const ContentListResponseSchema = z.object({
120
136
  items: z.array(ContentListRowSchema),
121
137
  // null = no more pages.
122
138
  nextCursor: z.string().uuid().nullable(),
139
+ // M35 C2: a filtered call stopped at CONTENT_LIST_FILTER_SCAN_MAX rows or CONTENT_LIST_FILTER_TIME_MS
140
+ // before `limit` matched; `nextCursor` reads on.
141
+ scanCapped: z.boolean().optional(),
123
142
  });
143
+ /** M35 C2: the list route's 403. `ContentForbiddenSchema` with the filter's coded refusal between
144
+ * the node refusal and the plain error: a union serialises a body as its first matching member, and
145
+ * the plain `ApiErrorSchema` would strip `code`. */
146
+ export const ContentListForbiddenSchema = z.union([NodeAccessRefusalSchema, ListFilterErrorSchema, ApiErrorSchema]);
147
+ /** M35 C2: the list route's 404: an unknown filter (coded) or a missing parent (plain), coded first. */
148
+ export const ContentListNotFoundSchema = z.union([ListFilterErrorSchema, ApiErrorSchema]);
124
149
  // The Content List data type's own seed row (Task 2 migration 0021). NOT
125
150
  // added to BUILT_IN_DATA_TYPE_CONFIGS: that array is inserted at migration
126
151
  // 0006 time, so a new entry there would only reach fresh installs.
@@ -150,6 +175,10 @@ export const CONTENT_LIST_MARKER_MAX = 1024;
150
175
  /** A field sort runs only when its scope holds at most this many published pages (D7). */
151
176
  export const CONTENT_LIST_FIELD_SORT_MAX = 5000;
152
177
  export const CONTENT_LIST_FIELD_ID_MAX = 64;
178
+ // M35 C1 (W13, W15): a field test's value is 1 to PUBLISHED_QUERY_VALUE_MAX characters, and an `in` names at most
179
+ // PUBLISHED_QUERY_IN_MAX values; the template list and context.listPublished share them.
180
+ export const PUBLISHED_QUERY_VALUE_MAX = 200;
181
+ export const PUBLISHED_QUERY_IN_MAX = 20;
153
182
  // M32 F4e (E4): template site search. The text and the cursor come from a visitor's query string
154
183
  // (`?q=`, `?search_after=`), read once each within these caps; the rest bound a render's searches.
155
184
  export const TEMPLATE_SEARCH_TEXT_MAX = 200;
@@ -159,6 +188,8 @@ export const TEMPLATE_SEARCH_LIMIT_DEFAULT = 10;
159
188
  export const TEMPLATE_SEARCHES_MAX = 2;
160
189
  /** The longest document type name `{% list %}` and `{% search %}` read as `type:`. */
161
190
  export const TEMPLATE_TYPE_NAME_MAX = 200;
191
+ const ListFilterText = z.string().min(1).max(PUBLISHED_QUERY_VALUE_MAX);
192
+ const ListFilterScalar = z.union([ListFilterText, z.number().finite()]);
162
193
  export const ContentListArgsSchema = z
163
194
  .object({
164
195
  type: z.string().trim().min(1).max(TEMPLATE_TYPE_NAME_MAX).optional(),
@@ -166,6 +197,14 @@ export const ContentListArgsSchema = z
166
197
  sort: z.string().max(CONTENT_LIST_SORT_MAX).optional(),
167
198
  limit: z.number().int().min(1).max(CONTENT_LIST_LIMIT_MAX).optional(),
168
199
  paged: z.boolean().optional(),
200
+ // M35 C1 (W15, W13): every page below a page, and one test of a field (where: plus one of the tests).
201
+ under: z.unknown().optional(),
202
+ where: z.string().max(CONTENT_LIST_FIELD_ID_MAX).optional(),
203
+ eq: z.union([ListFilterText, z.number().finite(), z.boolean()]).optional(),
204
+ in: z.array(ListFilterScalar).min(1).max(PUBLISHED_QUERY_IN_MAX).optional(),
205
+ has: z.unknown().optional(),
206
+ gte: ListFilterScalar.optional(),
207
+ lt: ListFilterScalar.optional(),
169
208
  })
170
209
  .strict();
171
210
  /** A field id's form (letters, digits, underscore, a letter first), at most 64 characters. */
@@ -0,0 +1,213 @@
1
+ import { z } from "zod";
2
+ import { type ContentListDirection, type ContentListSortKey } from "./content-list.schema.js";
3
+ import type { PageAddress } from "./page-address.js";
4
+ /** A call answers at most this many pages (PUBLISHED_QUERY_LIMIT_DEFAULT when none is asked). */
5
+ export declare const PUBLISHED_QUERY_LIMIT_MAX = 100;
6
+ export declare const PUBLISHED_QUERY_LIMIT_DEFAULT = 20;
7
+ /** A plugin's call examines at most this many rows of its order; past it the call answers `scanCapped: true`. */
8
+ export declare const PUBLISHED_QUERY_SCAN_MAX = 1000;
9
+ /** A template's filtered list examines at most this many rows a read; so does one call of the admin's
10
+ * Content List with a plugin filter on (M35 C2, `GET /content/:id/list` with `filter`). */
11
+ export declare const CONTENT_LIST_FILTER_SCAN_MAX = 500;
12
+ /** A call tests at most this many fields, all of which must hold. */
13
+ export declare const PUBLISHED_QUERY_WHERE_MAX = 4;
14
+ /** The longest cursor listPublished mints: a 768-character path of 4-byte characters, base64url. */
15
+ export declare const PUBLISHED_QUERY_CURSOR_MAX = 4400;
16
+ export declare const PUBLISHED_SEARCH_TEXT_MAX = 200;
17
+ /** The longest stored path (content_nodes.path is VARCHAR(768) on MySQL), in code points, as MySQL counts. */
18
+ export declare const STORED_PATH_MAX = 768;
19
+ /** Whether `value` holds at most `max` code points. A code point is one or two UTF-16 units, so most inputs
20
+ * are decided by their length alone, and the count stops after `max + 1`. */
21
+ export declare function fitsCodePoints(value: string, max: number): boolean;
22
+ /** A stored path's shape: "/" first, 2 to STORED_PATH_MAX code points. */
23
+ export declare function isStoredPathShape(value: unknown): value is string;
24
+ export declare const CONTENT_WALK_LIMIT_MAX = 100;
25
+ export declare const CONTENT_WALK_LIMIT_DEFAULT = 50;
26
+ /** The longest walk cursor: a uuid and a 768-character path of 4-byte characters, base64url. */
27
+ export declare const CONTENT_WALK_CURSOR_MAX = 4200;
28
+ /** The tree's order. It starts with "_", which no field id does, so it never shadows a field. */
29
+ export declare const TREE_SORT_WORD = "_tree";
30
+ export type PublishedQuerySortKey = ContentListSortKey | {
31
+ kind: "tree";
32
+ };
33
+ export interface PublishedQuerySortChoice {
34
+ key: PublishedQuerySortKey;
35
+ direction: ContentListDirection;
36
+ /** "<word> <direction>": what a cursor names, so a cursor for another sort is refused. */
37
+ canonical: string;
38
+ }
39
+ /** "_tree" (ascending unless "desc" follows), or any sort the template list reads (parseContentListSort). */
40
+ export declare function parsePublishedQuerySort(raw: string | undefined): PublishedQuerySortChoice | null;
41
+ /** How a query reads a field: by its stored scalar (text, number, boolean) or as a list of strings (`has`). */
42
+ export type QueryFieldKind = "text" | "number" | "boolean" | "list";
43
+ /** The kind of a field of this editor a query may test or sort, or null: every other editor serves a serializer's output. */
44
+ export declare function queryFieldKind(editorId: string | null): QueryFieldKind | null;
45
+ export declare const PublishedFilterSchema: z.ZodUnion<readonly [z.ZodObject<{
46
+ field: z.ZodString;
47
+ eq: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
48
+ }, z.core.$strict>, z.ZodObject<{
49
+ field: z.ZodString;
50
+ in: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
51
+ }, z.core.$strict>, z.ZodObject<{
52
+ field: z.ZodString;
53
+ gte: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
54
+ lt: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
55
+ }, z.core.$strict>, z.ZodObject<{
56
+ field: z.ZodString;
57
+ has: z.ZodString;
58
+ }, z.core.$strict>]>;
59
+ export type PublishedFilter = z.infer<typeof PublishedFilterSchema>;
60
+ export declare const ListPublishedOptionsSchema: z.ZodObject<{
61
+ type: z.ZodOptional<z.ZodString>;
62
+ typeId: z.ZodOptional<z.ZodString>;
63
+ parent: z.ZodOptional<z.ZodString>;
64
+ under: z.ZodOptional<z.ZodString>;
65
+ sort: z.ZodOptional<z.ZodString>;
66
+ where: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
67
+ field: z.ZodString;
68
+ eq: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
69
+ }, z.core.$strict>, z.ZodObject<{
70
+ field: z.ZodString;
71
+ in: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
72
+ }, z.core.$strict>, z.ZodObject<{
73
+ field: z.ZodString;
74
+ gte: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
75
+ lt: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
76
+ }, z.core.$strict>, z.ZodObject<{
77
+ field: z.ZodString;
78
+ has: z.ZodString;
79
+ }, z.core.$strict>]>>>;
80
+ culture: z.ZodOptional<z.ZodString>;
81
+ limit: z.ZodOptional<z.ZodNumber>;
82
+ after: z.ZodOptional<z.ZodString>;
83
+ }, z.core.$strict>;
84
+ /** M35 U2b (W8): `visitor` is the plugin's `context.visitor`, structural here; the core reads only objects it made
85
+ * itself (any other is an anonymous reader) and takes it off before the schema reads the rest. */
86
+ export type ListPublishedOptions = z.input<typeof ListPublishedOptionsSchema> & {
87
+ visitor?: {
88
+ readonly id: string;
89
+ };
90
+ };
91
+ export declare const SearchPublishedOptionsSchema: z.ZodObject<{
92
+ q: z.ZodString;
93
+ type: z.ZodOptional<z.ZodString>;
94
+ typeId: z.ZodOptional<z.ZodString>;
95
+ under: z.ZodOptional<z.ZodString>;
96
+ culture: z.ZodOptional<z.ZodString>;
97
+ limit: z.ZodOptional<z.ZodNumber>;
98
+ after: z.ZodOptional<z.ZodString>;
99
+ }, z.core.$strict>;
100
+ /** M35 U2b (W8): `visitor` is the plugin's `context.visitor`, structural here; the core reads only objects it made
101
+ * itself (any other is an anonymous reader) and takes it off before the schema reads the rest. */
102
+ export type SearchPublishedOptions = z.input<typeof SearchPublishedOptionsSchema> & {
103
+ visitor?: {
104
+ readonly id: string;
105
+ };
106
+ };
107
+ /** One page listPublished or searchPublished answers: live and published. listPublished answers only pages
108
+ * served in the asked language; searchPublished covers every published language, and its `culture` picks
109
+ * only each item's `url`. */
110
+ export interface PublishedListItem {
111
+ id: string;
112
+ parentId: string | null;
113
+ path: string;
114
+ documentTypeId: string;
115
+ /** The document type's name; null when the type is gone. */
116
+ documentType: string | null;
117
+ /** When the page was published in its first language, ISO. */
118
+ publishedAt: string;
119
+ /** The page's address in the asked language, else in the default language; null when it has neither. */
120
+ url: string | null;
121
+ /** Each published language with its own address, in the site's language order. */
122
+ cultures: PageAddress[];
123
+ }
124
+ export interface PublishedListPage {
125
+ items: PublishedListItem[];
126
+ /** Hand it back as `after`; null when the list ran out. */
127
+ nextCursor: string | null;
128
+ /** True when the call examined PUBLISHED_QUERY_SCAN_MAX rows before `limit` matched: read on with nextCursor. */
129
+ scanCapped: boolean;
130
+ }
131
+ export interface PublishedSearchPage {
132
+ items: PublishedListItem[];
133
+ nextCursor: string | null;
134
+ }
135
+ export interface PublishedQueryCursor {
136
+ /** The canonical sort it was minted for ("published desc", "_tree asc", "rank asc"). */
137
+ sort: string;
138
+ value: string | number | null;
139
+ id: string;
140
+ }
141
+ export declare function encodePublishedQueryCursor(cursor: PublishedQueryCursor): string;
142
+ /** The cursor's parts, or null for anything that is not one this code minted the shape of. */
143
+ export declare function decodePublishedQueryCursor(raw: unknown): PublishedQueryCursor | null;
144
+ export interface ContentWalkPosition {
145
+ path: string;
146
+ id: string;
147
+ }
148
+ /** The last row's own id (36 characters) followed by its path, base64url. */
149
+ export declare function encodeContentWalkCursor(at: ContentWalkPosition): string;
150
+ export declare function decodeContentWalkCursor(raw: unknown): ContentWalkPosition | null;
151
+ export declare const ContentWalkQuerySchema: z.ZodObject<{
152
+ under: z.ZodOptional<z.ZodString>;
153
+ cursor: z.ZodOptional<z.ZodString>;
154
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
155
+ }, z.core.$strip>;
156
+ export type ContentWalkQuery = z.infer<typeof ContentWalkQuerySchema>;
157
+ export declare const ContentWalkResponseSchema: z.ZodObject<{
158
+ items: z.ZodArray<z.ZodObject<{
159
+ id: z.ZodString;
160
+ parentId: z.ZodNullable<z.ZodString>;
161
+ path: z.ZodString;
162
+ depth: z.ZodNumber;
163
+ sortOrder: z.ZodNumber;
164
+ documentTypeId: z.ZodString;
165
+ publishedAt: z.ZodNullable<z.ZodString>;
166
+ name: z.ZodOptional<z.ZodString>;
167
+ culturesBehind: z.ZodNumber;
168
+ defaultCulture: z.ZodNullable<z.ZodObject<{
169
+ culture: z.ZodString;
170
+ currentVersion: z.ZodNumber;
171
+ publishedAt: z.ZodNullable<z.ZodString>;
172
+ }, z.core.$strip>>;
173
+ childCount: z.ZodNumber;
174
+ access: z.ZodObject<{
175
+ read: z.ZodBoolean;
176
+ create: z.ZodBoolean;
177
+ update: z.ZodBoolean;
178
+ publish: z.ZodBoolean;
179
+ delete: z.ZodBoolean;
180
+ denied: z.ZodRecord<z.ZodEnum<{
181
+ "content.read": "content.read";
182
+ "content.create": "content.create";
183
+ "content.update": "content.update";
184
+ "content.publish": "content.publish";
185
+ "content.delete": "content.delete";
186
+ }> & z.core.$partial, z.ZodObject<{
187
+ reason: z.ZodEnum<{
188
+ "role-lacks-action": "role-lacks-action";
189
+ "not-granted": "not-granted";
190
+ }>;
191
+ decidedAt: z.ZodNullable<z.ZodObject<{
192
+ nodeId: z.ZodString;
193
+ path: z.ZodNullable<z.ZodString>;
194
+ name: z.ZodNullable<z.ZodString>;
195
+ mode: z.ZodEnum<{
196
+ restricted: "restricted";
197
+ open: "open";
198
+ }>;
199
+ grants: z.ZodArray<z.ZodObject<{
200
+ subjectKind: z.ZodEnum<{
201
+ role: "role";
202
+ user: "user";
203
+ }>;
204
+ subjectId: z.ZodString;
205
+ label: z.ZodNullable<z.ZodString>;
206
+ }, z.core.$strip>>;
207
+ }, z.core.$strip>>;
208
+ }, z.core.$strip>>;
209
+ }, z.core.$strip>;
210
+ }, z.core.$strip>>;
211
+ nextCursor: z.ZodNullable<z.ZodString>;
212
+ }, z.core.$strip>;
213
+ export type ContentWalkResponse = z.infer<typeof ContentWalkResponseSchema>;
@@ -0,0 +1,234 @@
1
+ import { z } from "zod";
2
+ import { ContentNodeWithNameSchema } from "./content-api.schema.js";
3
+ import { CONTENT_LIST_FIELD_ID_MAX, CONTENT_LIST_SORT_MAX, PUBLISHED_QUERY_IN_MAX, PUBLISHED_QUERY_VALUE_MAX, isContentListFieldId, parseContentListSort, } from "./content-list.schema.js";
4
+ import { PLUGIN_CONTENT_ACCESS_NAME_MAX } from "./plugin-content-access.js";
5
+ import { PROVIDER_SEARCH_CURSOR_MAX, isProviderSearchCursor } from "./plugin-providers.js";
6
+ import { CULTURE_TAG_MAX } from "./public-api.schema.js";
7
+ import { CONTENT_PICKER_EDITOR_ID, OPTIONS_EDITOR_ID } from "./structured-fields.schema.js";
8
+ // M35 C1 (W12, W13, W15): the wide content reads. context.listPublished and the template list read published
9
+ // pages sorted and filtered through DatabaseAdapter.queryPublishedNodes; context.searchPublished is the delivery
10
+ // search; context.content.walk walks the tree, drafts included, through GET /api/manage/v1/content/walk. Every
11
+ // value a plugin, a template or a visitor hands in is read here with length caps and linear scans, never a pattern.
12
+ /** A call answers at most this many pages (PUBLISHED_QUERY_LIMIT_DEFAULT when none is asked). */
13
+ export const PUBLISHED_QUERY_LIMIT_MAX = 100;
14
+ export const PUBLISHED_QUERY_LIMIT_DEFAULT = 20;
15
+ /** A plugin's call examines at most this many rows of its order; past it the call answers `scanCapped: true`. */
16
+ export const PUBLISHED_QUERY_SCAN_MAX = 1_000;
17
+ /** A template's filtered list examines at most this many rows a read; so does one call of the admin's
18
+ * Content List with a plugin filter on (M35 C2, `GET /content/:id/list` with `filter`). */
19
+ export const CONTENT_LIST_FILTER_SCAN_MAX = 500;
20
+ /** A call tests at most this many fields, all of which must hold. */
21
+ export const PUBLISHED_QUERY_WHERE_MAX = 4;
22
+ /** The longest cursor listPublished mints: a 768-character path of 4-byte characters, base64url. */
23
+ export const PUBLISHED_QUERY_CURSOR_MAX = 4_400;
24
+ export const PUBLISHED_SEARCH_TEXT_MAX = 200;
25
+ /** The longest stored path (content_nodes.path is VARCHAR(768) on MySQL), in code points, as MySQL counts. */
26
+ export const STORED_PATH_MAX = 768;
27
+ /** Whether `value` holds at most `max` code points. A code point is one or two UTF-16 units, so most inputs
28
+ * are decided by their length alone, and the count stops after `max + 1`. */
29
+ export function fitsCodePoints(value, max) {
30
+ if (value.length <= max)
31
+ return true;
32
+ if (value.length > max * 2)
33
+ return false;
34
+ let count = 0;
35
+ for (const _ of value) {
36
+ count += 1;
37
+ if (count > max)
38
+ return false;
39
+ }
40
+ return true;
41
+ }
42
+ /** A stored path's shape: "/" first, 2 to STORED_PATH_MAX code points. */
43
+ export function isStoredPathShape(value) {
44
+ return typeof value === "string" && value.length >= 2 && value[0] === "/" && fitsCodePoints(value, STORED_PATH_MAX);
45
+ }
46
+ export const CONTENT_WALK_LIMIT_MAX = 100;
47
+ export const CONTENT_WALK_LIMIT_DEFAULT = 50;
48
+ /** The longest walk cursor: a uuid and a 768-character path of 4-byte characters, base64url. */
49
+ export const CONTENT_WALK_CURSOR_MAX = 4_200;
50
+ /** The tree's order. It starts with "_", which no field id does, so it never shadows a field. */
51
+ export const TREE_SORT_WORD = "_tree";
52
+ /** "_tree" (ascending unless "desc" follows), or any sort the template list reads (parseContentListSort). */
53
+ export function parsePublishedQuerySort(raw) {
54
+ const text = (raw ?? "").trim();
55
+ if (text.length > CONTENT_LIST_SORT_MAX)
56
+ return null;
57
+ const space = text.indexOf(" ");
58
+ const word = space === -1 ? text : text.slice(0, space);
59
+ if (word !== TREE_SORT_WORD)
60
+ return parseContentListSort(raw);
61
+ const rest = space === -1 ? "" : text.slice(space + 1).trim();
62
+ if (rest !== "" && rest !== "asc" && rest !== "desc")
63
+ return null;
64
+ const direction = rest === "" ? "asc" : rest;
65
+ return { key: { kind: "tree" }, direction, canonical: `${TREE_SORT_WORD} ${direction}` };
66
+ }
67
+ const QUERY_FIELD_KINDS = new Map([
68
+ ["com.kardalum.text", "text"],
69
+ ["com.kardalum.date", "text"],
70
+ ["com.kardalum.number", "number"],
71
+ ["com.kardalum.boolean", "boolean"],
72
+ [CONTENT_PICKER_EDITOR_ID, "list"],
73
+ [OPTIONS_EDITOR_ID, "list"],
74
+ ]);
75
+ /** The kind of a field of this editor a query may test or sort, or null: every other editor serves a serializer's output. */
76
+ export function queryFieldKind(editorId) {
77
+ return editorId === null ? null : (QUERY_FIELD_KINDS.get(editorId) ?? null);
78
+ }
79
+ const FieldIdSchema = z
80
+ .string()
81
+ .max(CONTENT_LIST_FIELD_ID_MAX)
82
+ .refine(isContentListFieldId, { message: `is a field id: a letter, then letters, digits and _, at most ${CONTENT_LIST_FIELD_ID_MAX} characters` });
83
+ const FilterText = z.string().min(1).max(PUBLISHED_QUERY_VALUE_MAX);
84
+ const FilterScalar = z.union([FilterText, z.number().finite()]);
85
+ export const PublishedFilterSchema = z.union([
86
+ z.object({ field: FieldIdSchema, eq: z.union([FilterText, z.number().finite(), z.boolean()]) }).strict(),
87
+ z.object({ field: FieldIdSchema, in: z.array(FilterScalar).min(1).max(PUBLISHED_QUERY_IN_MAX) }).strict(),
88
+ z
89
+ .object({ field: FieldIdSchema, gte: FilterScalar.optional(), lt: FilterScalar.optional() })
90
+ .strict()
91
+ .refine((filter) => filter.gte !== undefined || filter.lt !== undefined, { message: "a range names gte, lt or both" }),
92
+ z.object({ field: FieldIdSchema, has: FilterText }).strict(),
93
+ ]);
94
+ const PageIdSchema = z.string().uuid();
95
+ const TypeNameSchema = z.string().min(1).max(PLUGIN_CONTENT_ACCESS_NAME_MAX);
96
+ const CultureAskedSchema = z.string().min(1).max(CULTURE_TAG_MAX);
97
+ export const ListPublishedOptionsSchema = z
98
+ .object({
99
+ /** A document type's name: the plugin's own type of that name first, else the one site type of that name. */
100
+ type: TypeNameSchema.optional(),
101
+ typeId: PageIdSchema.optional(),
102
+ /** A page's id: its children. */
103
+ parent: PageIdSchema.optional(),
104
+ /** A page's id: every page below it. */
105
+ under: PageIdSchema.optional(),
106
+ sort: z.string().max(CONTENT_LIST_SORT_MAX).optional(),
107
+ where: z.array(PublishedFilterSchema).max(PUBLISHED_QUERY_WHERE_MAX).optional(),
108
+ culture: CultureAskedSchema.optional(),
109
+ limit: z.number().int().min(1).max(PUBLISHED_QUERY_LIMIT_MAX).optional(),
110
+ after: z.string().min(1).max(PUBLISHED_QUERY_CURSOR_MAX).optional(),
111
+ })
112
+ .strict()
113
+ .refine((options) => options.type === undefined || options.typeId === undefined, { message: "names type or typeId, not both" })
114
+ .refine((options) => options.type !== undefined || options.typeId !== undefined || options.parent !== undefined || options.under !== undefined, {
115
+ message: "names a type, a parent or a page to list under",
116
+ })
117
+ .refine((options) => (options.where ?? []).length === 0 || options.type !== undefined || options.typeId !== undefined, { message: "a filter needs a type" });
118
+ const SearchCursorSchema = z
119
+ .string()
120
+ .max(PROVIDER_SEARCH_CURSOR_MAX)
121
+ .refine((value) => isProviderSearchCursor(value) || PageIdSchema.safeParse(value).success, { message: "is the nextCursor of the search before" });
122
+ export const SearchPublishedOptionsSchema = z
123
+ .object({
124
+ q: z.string().min(2).max(PUBLISHED_SEARCH_TEXT_MAX),
125
+ type: TypeNameSchema.optional(),
126
+ typeId: PageIdSchema.optional(),
127
+ under: PageIdSchema.optional(),
128
+ culture: CultureAskedSchema.optional(),
129
+ limit: z.number().int().min(1).max(PUBLISHED_QUERY_LIMIT_MAX).optional(),
130
+ after: SearchCursorSchema.optional(),
131
+ })
132
+ .strict()
133
+ .refine((options) => options.type === undefined || options.typeId === undefined, { message: "names type or typeId, not both" });
134
+ /** base64url of the UTF-8 bytes, without padding. */
135
+ function toBase64Url(text) {
136
+ const bytes = new TextEncoder().encode(text);
137
+ let binary = "";
138
+ for (const byte of bytes)
139
+ binary += String.fromCharCode(byte);
140
+ const b64 = btoa(binary);
141
+ let out = "";
142
+ for (let i = 0; i < b64.length; i++) {
143
+ const ch = b64[i];
144
+ if (ch === "=")
145
+ break;
146
+ out += ch === "+" ? "-" : ch === "/" ? "_" : ch;
147
+ }
148
+ return out;
149
+ }
150
+ /** The text a base64url string of at most `max` characters holds, or null. One linear scan before any decode. */
151
+ function fromBase64Url(raw, max) {
152
+ if (typeof raw !== "string" || raw.length === 0 || raw.length > max)
153
+ return null;
154
+ let b64 = "";
155
+ for (let i = 0; i < raw.length; i++) {
156
+ const c = raw.charCodeAt(i);
157
+ const ok = (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c === 45 || c === 95;
158
+ if (!ok)
159
+ return null;
160
+ const ch = raw[i];
161
+ b64 += ch === "-" ? "+" : ch === "_" ? "/" : ch;
162
+ }
163
+ while (b64.length % 4 !== 0)
164
+ b64 += "=";
165
+ try {
166
+ const binary = atob(b64);
167
+ const bytes = new Uint8Array(binary.length);
168
+ for (let i = 0; i < binary.length; i++)
169
+ bytes[i] = binary.charCodeAt(i);
170
+ return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
171
+ }
172
+ catch {
173
+ return null;
174
+ }
175
+ }
176
+ const QueryCursorTupleSchema = z.tuple([
177
+ z.string().min(1).max(CONTENT_LIST_SORT_MAX),
178
+ // STORED_PATH_MAX code points: an astral character is two UTF-16 units.
179
+ z.union([z.string().max(STORED_PATH_MAX * 2).refine((value) => fitsCodePoints(value, STORED_PATH_MAX)), z.number().finite(), z.null()]),
180
+ PageIdSchema,
181
+ ]);
182
+ export function encodePublishedQueryCursor(cursor) {
183
+ return toBase64Url(JSON.stringify([cursor.sort, cursor.value, cursor.id]));
184
+ }
185
+ /** The cursor's parts, or null for anything that is not one this code minted the shape of. */
186
+ export function decodePublishedQueryCursor(raw) {
187
+ const text = fromBase64Url(raw, PUBLISHED_QUERY_CURSOR_MAX);
188
+ if (text === null)
189
+ return null;
190
+ let parsed;
191
+ try {
192
+ parsed = JSON.parse(text);
193
+ }
194
+ catch {
195
+ return null;
196
+ }
197
+ const result = QueryCursorTupleSchema.safeParse(parsed);
198
+ if (!result.success)
199
+ return null;
200
+ const [sort, value, id] = result.data;
201
+ return { sort, value, id: id.toLowerCase() };
202
+ }
203
+ /** The last row's own id (36 characters) followed by its path, base64url. */
204
+ export function encodeContentWalkCursor(at) {
205
+ return toBase64Url(`${at.id}${at.path}`);
206
+ }
207
+ export function decodeContentWalkCursor(raw) {
208
+ const text = fromBase64Url(raw, CONTENT_WALK_CURSOR_MAX);
209
+ if (text === null || text.length < 38)
210
+ return null;
211
+ const id = text.slice(0, 36);
212
+ const path = text.slice(36);
213
+ if (!PageIdSchema.safeParse(id).success)
214
+ return null;
215
+ if (!isStoredPathShape(path))
216
+ return null;
217
+ return { id: id.toLowerCase(), path };
218
+ }
219
+ // GET /api/manage/v1/content/walk (M35 C1, W12): the live pages under `under`, or every live page, in the tree's
220
+ // order (the stored path, bytewise, then id), drafts included, a page at a time.
221
+ export const ContentWalkQuerySchema = z.object({
222
+ under: PageIdSchema.optional(),
223
+ cursor: z
224
+ .string()
225
+ .max(CONTENT_WALK_CURSOR_MAX)
226
+ .refine((value) => decodeContentWalkCursor(value) !== null, { message: "cursor must be a nextCursor this walk answered" })
227
+ .optional(),
228
+ limit: z.coerce.number().int().min(1).max(CONTENT_WALK_LIMIT_MAX).default(CONTENT_WALK_LIMIT_DEFAULT),
229
+ });
230
+ export const ContentWalkResponseSchema = z.object({
231
+ items: z.array(ContentNodeWithNameSchema),
232
+ // null = the walk is done.
233
+ nextCursor: z.string().max(CONTENT_WALK_CURSOR_MAX).nullable(),
234
+ });
@@ -0,0 +1,11 @@
1
+ import type { z } from "zod";
2
+ export type ContributionIssue = {
3
+ path: (string | number)[];
4
+ message: string;
5
+ };
6
+ /** A Zod error's issues under `contributions.<key>`. */
7
+ export declare function contributionIssuesAt(key: string, error: z.ZodError): ContributionIssue[];
8
+ /** The value a manifest declares under `contributions.<key>`, or undefined. */
9
+ export declare function contributionOf(manifest: {
10
+ contributions?: unknown;
11
+ } | undefined, key: string): unknown;
@@ -0,0 +1,14 @@
1
+ /** A Zod error's issues under `contributions.<key>`. */
2
+ export function contributionIssuesAt(key, error) {
3
+ return error.issues.map((issue) => ({
4
+ path: ["contributions", key, ...issue.path.map((p) => (typeof p === "symbol" ? String(p) : p))],
5
+ message: issue.message,
6
+ }));
7
+ }
8
+ /** The value a manifest declares under `contributions.<key>`, or undefined. */
9
+ export function contributionOf(manifest, key) {
10
+ const contributions = manifest?.contributions;
11
+ if (contributions === null || typeof contributions !== "object")
12
+ return undefined;
13
+ return contributions[key];
14
+ }