emdash 0.11.1 → 0.13.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 (1016) hide show
  1. package/dist/{adapters-BktHA7EO.d.mts → adapters-9DybjTO6.d.mts} +1 -1
  2. package/dist/{adapters-BktHA7EO.d.mts.map → adapters-9DybjTO6.d.mts.map} +1 -1
  3. package/dist/allowed-origins-CDdG-4Gd.mjs +116 -0
  4. package/dist/allowed-origins-CDdG-4Gd.mjs.map +1 -0
  5. package/dist/api/route-utils.d.mts +68 -0
  6. package/dist/api/route-utils.d.mts.map +1 -0
  7. package/dist/api/route-utils.mjs +44 -0
  8. package/dist/api/route-utils.mjs.map +1 -0
  9. package/dist/api/schemas/index.d.mts +2 -0
  10. package/dist/api/schemas/index.mjs +4 -0
  11. package/dist/api-ayIQ7rIe.mjs +3941 -0
  12. package/dist/api-ayIQ7rIe.mjs.map +1 -0
  13. package/dist/api-tokens-D3C9v02m.mjs +3 -0
  14. package/dist/api-tokens-eYymBhIT.mjs +153 -0
  15. package/dist/api-tokens-eYymBhIT.mjs.map +1 -0
  16. package/dist/{apply-Ded_1vng.mjs → apply-v4DBgjPw.mjs} +19 -566
  17. package/dist/apply-v4DBgjPw.mjs.map +1 -0
  18. package/dist/astro/index.d.mts +10 -6
  19. package/dist/astro/index.d.mts.map +1 -1
  20. package/dist/astro/index.mjs +42 -83
  21. package/dist/astro/index.mjs.map +1 -1
  22. package/dist/astro/middleware/auth.d.mts +9 -5
  23. package/dist/astro/middleware/auth.d.mts.map +1 -1
  24. package/dist/astro/middleware/auth.mjs +25 -65
  25. package/dist/astro/middleware/auth.mjs.map +1 -1
  26. package/dist/astro/middleware/redirect.mjs +5 -5
  27. package/dist/astro/middleware/request-context.mjs +4 -4
  28. package/dist/astro/middleware/setup.mjs +1 -1
  29. package/dist/astro/middleware.d.mts.map +1 -1
  30. package/dist/astro/middleware.mjs +146 -71
  31. package/dist/astro/middleware.mjs.map +1 -1
  32. package/dist/astro/routes/PluginRegistry.d.mts +15 -0
  33. package/dist/astro/routes/PluginRegistry.d.mts.map +1 -0
  34. package/dist/astro/routes/PluginRegistry.mjs +25 -0
  35. package/dist/astro/routes/PluginRegistry.mjs.map +1 -0
  36. package/dist/astro/routes/api/admin/allowed-domains/_domain_.d.mts +15 -0
  37. package/dist/astro/routes/api/admin/allowed-domains/_domain_.d.mts.map +1 -0
  38. package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +67 -0
  39. package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs.map +1 -0
  40. package/dist/astro/routes/api/admin/allowed-domains/index.d.mts +15 -0
  41. package/dist/astro/routes/api/admin/allowed-domains/index.d.mts.map +1 -0
  42. package/dist/astro/routes/api/admin/allowed-domains/index.mjs +67 -0
  43. package/dist/astro/routes/api/admin/allowed-domains/index.mjs.map +1 -0
  44. package/dist/astro/routes/api/admin/api-tokens/_id_.d.mts +11 -0
  45. package/dist/astro/routes/api/admin/api-tokens/_id_.d.mts.map +1 -0
  46. package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +33 -0
  47. package/dist/astro/routes/api/admin/api-tokens/_id_.mjs.map +1 -0
  48. package/dist/astro/routes/api/admin/api-tokens/index.d.mts +17 -0
  49. package/dist/astro/routes/api/admin/api-tokens/index.d.mts.map +1 -0
  50. package/dist/astro/routes/api/admin/api-tokens/index.mjs +52 -0
  51. package/dist/astro/routes/api/admin/api-tokens/index.mjs.map +1 -0
  52. package/dist/astro/routes/api/admin/bylines/_id_/index.d.mts +10 -0
  53. package/dist/astro/routes/api/admin/bylines/_id_/index.d.mts.map +1 -0
  54. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +74 -0
  55. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs.map +1 -0
  56. package/dist/astro/routes/api/admin/bylines/index.d.mts +9 -0
  57. package/dist/astro/routes/api/admin/bylines/index.d.mts.map +1 -0
  58. package/dist/astro/routes/api/admin/bylines/index.mjs +61 -0
  59. package/dist/astro/routes/api/admin/bylines/index.mjs.map +1 -0
  60. package/dist/astro/routes/api/admin/comments/_id_/status.d.mts +8 -0
  61. package/dist/astro/routes/api/admin/comments/_id_/status.d.mts.map +1 -0
  62. package/dist/astro/routes/api/admin/comments/_id_/status.mjs +80 -0
  63. package/dist/astro/routes/api/admin/comments/_id_/status.mjs.map +1 -0
  64. package/dist/astro/routes/api/admin/comments/_id_.d.mts +15 -0
  65. package/dist/astro/routes/api/admin/comments/_id_.d.mts.map +1 -0
  66. package/dist/astro/routes/api/admin/comments/_id_.mjs +47 -0
  67. package/dist/astro/routes/api/admin/comments/_id_.mjs.map +1 -0
  68. package/dist/astro/routes/api/admin/comments/bulk.d.mts +8 -0
  69. package/dist/astro/routes/api/admin/comments/bulk.d.mts.map +1 -0
  70. package/dist/astro/routes/api/admin/comments/bulk.mjs +36 -0
  71. package/dist/astro/routes/api/admin/comments/bulk.mjs.map +1 -0
  72. package/dist/astro/routes/api/admin/comments/counts.d.mts +8 -0
  73. package/dist/astro/routes/api/admin/comments/counts.d.mts.map +1 -0
  74. package/dist/astro/routes/api/admin/comments/counts.mjs +25 -0
  75. package/dist/astro/routes/api/admin/comments/counts.mjs.map +1 -0
  76. package/dist/astro/routes/api/admin/comments/index.d.mts +11 -0
  77. package/dist/astro/routes/api/admin/comments/index.d.mts.map +1 -0
  78. package/dist/astro/routes/api/admin/comments/index.mjs +40 -0
  79. package/dist/astro/routes/api/admin/comments/index.mjs.map +1 -0
  80. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.d.mts +8 -0
  81. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.d.mts.map +1 -0
  82. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +48 -0
  83. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs.map +1 -0
  84. package/dist/astro/routes/api/admin/hooks/exclusive/index.d.mts +8 -0
  85. package/dist/astro/routes/api/admin/hooks/exclusive/index.d.mts.map +1 -0
  86. package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +36 -0
  87. package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs.map +1 -0
  88. package/dist/astro/routes/api/admin/oauth-clients/_id_.d.mts +19 -0
  89. package/dist/astro/routes/api/admin/oauth-clients/_id_.d.mts.map +1 -0
  90. package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +69 -0
  91. package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs.map +1 -0
  92. package/dist/astro/routes/api/admin/oauth-clients/index.d.mts +15 -0
  93. package/dist/astro/routes/api/admin/oauth-clients/index.d.mts.map +1 -0
  94. package/dist/astro/routes/api/admin/oauth-clients/index.mjs +50 -0
  95. package/dist/astro/routes/api/admin/oauth-clients/index.mjs.map +1 -0
  96. package/dist/astro/routes/api/admin/plugins/_id_/disable.d.mts +8 -0
  97. package/dist/astro/routes/api/admin/plugins/_id_/disable.d.mts.map +1 -0
  98. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +56 -0
  99. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs.map +1 -0
  100. package/dist/astro/routes/api/admin/plugins/_id_/enable.d.mts +8 -0
  101. package/dist/astro/routes/api/admin/plugins/_id_/enable.d.mts.map +1 -0
  102. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +59 -0
  103. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs.map +1 -0
  104. package/dist/astro/routes/api/admin/plugins/_id_/index.d.mts +8 -0
  105. package/dist/astro/routes/api/admin/plugins/_id_/index.d.mts.map +1 -0
  106. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +51 -0
  107. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs.map +1 -0
  108. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.d.mts +8 -0
  109. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.d.mts.map +1 -0
  110. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +58 -0
  111. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs.map +1 -0
  112. package/dist/astro/routes/api/admin/plugins/_id_/update.d.mts +8 -0
  113. package/dist/astro/routes/api/admin/plugins/_id_/update.d.mts.map +1 -0
  114. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +66 -0
  115. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs.map +1 -0
  116. package/dist/astro/routes/api/admin/plugins/index.d.mts +8 -0
  117. package/dist/astro/routes/api/admin/plugins/index.d.mts.map +1 -0
  118. package/dist/astro/routes/api/admin/plugins/index.mjs +49 -0
  119. package/dist/astro/routes/api/admin/plugins/index.mjs.map +1 -0
  120. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.d.mts +8 -0
  121. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.d.mts.map +1 -0
  122. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +39 -0
  123. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs.map +1 -0
  124. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.d.mts +8 -0
  125. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.d.mts.map +1 -0
  126. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +51 -0
  127. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs.map +1 -0
  128. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.d.mts +8 -0
  129. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.d.mts.map +1 -0
  130. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +69 -0
  131. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs.map +1 -0
  132. package/dist/astro/routes/api/admin/plugins/marketplace/index.d.mts +8 -0
  133. package/dist/astro/routes/api/admin/plugins/marketplace/index.d.mts.map +1 -0
  134. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +58 -0
  135. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs.map +1 -0
  136. package/dist/astro/routes/api/admin/plugins/registry/install.d.mts +8 -0
  137. package/dist/astro/routes/api/admin/plugins/registry/install.d.mts.map +1 -0
  138. package/dist/astro/routes/api/admin/plugins/registry/install.mjs +72 -0
  139. package/dist/astro/routes/api/admin/plugins/registry/install.mjs.map +1 -0
  140. package/dist/astro/routes/api/admin/plugins/updates.d.mts +8 -0
  141. package/dist/astro/routes/api/admin/plugins/updates.d.mts.map +1 -0
  142. package/dist/astro/routes/api/admin/plugins/updates.mjs +49 -0
  143. package/dist/astro/routes/api/admin/plugins/updates.mjs.map +1 -0
  144. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.d.mts +8 -0
  145. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.d.mts.map +1 -0
  146. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +51 -0
  147. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs.map +1 -0
  148. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.d.mts +8 -0
  149. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.d.mts.map +1 -0
  150. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +39 -0
  151. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs.map +1 -0
  152. package/dist/astro/routes/api/admin/themes/marketplace/index.d.mts +8 -0
  153. package/dist/astro/routes/api/admin/themes/marketplace/index.d.mts.map +1 -0
  154. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +67 -0
  155. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs.map +1 -0
  156. package/dist/astro/routes/api/admin/users/_id_/disable.d.mts +8 -0
  157. package/dist/astro/routes/api/admin/users/_id_/disable.d.mts.map +1 -0
  158. package/dist/astro/routes/api/admin/users/_id_/disable.mjs +43 -0
  159. package/dist/astro/routes/api/admin/users/_id_/disable.mjs.map +1 -0
  160. package/dist/astro/routes/api/admin/users/_id_/enable.d.mts +8 -0
  161. package/dist/astro/routes/api/admin/users/_id_/enable.d.mts.map +1 -0
  162. package/dist/astro/routes/api/admin/users/_id_/enable.mjs +32 -0
  163. package/dist/astro/routes/api/admin/users/_id_/enable.mjs.map +1 -0
  164. package/dist/astro/routes/api/admin/users/_id_/index.d.mts +9 -0
  165. package/dist/astro/routes/api/admin/users/_id_/index.d.mts.map +1 -0
  166. package/dist/astro/routes/api/admin/users/_id_/index.mjs +106 -0
  167. package/dist/astro/routes/api/admin/users/_id_/index.mjs.map +1 -0
  168. package/dist/astro/routes/api/admin/users/_id_/send-recovery.d.mts +8 -0
  169. package/dist/astro/routes/api/admin/users/_id_/send-recovery.d.mts.map +1 -0
  170. package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +46 -0
  171. package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs.map +1 -0
  172. package/dist/astro/routes/api/admin/users/index.d.mts +8 -0
  173. package/dist/astro/routes/api/admin/users/index.d.mts.map +1 -0
  174. package/dist/astro/routes/api/admin/users/index.mjs +56 -0
  175. package/dist/astro/routes/api/admin/users/index.mjs.map +1 -0
  176. package/dist/astro/routes/api/auth/dev-bypass.d.mts +9 -0
  177. package/dist/astro/routes/api/auth/dev-bypass.d.mts.map +1 -0
  178. package/dist/astro/routes/api/auth/dev-bypass.mjs +84 -0
  179. package/dist/astro/routes/api/auth/dev-bypass.mjs.map +1 -0
  180. package/dist/astro/routes/api/auth/invite/accept.d.mts +8 -0
  181. package/dist/astro/routes/api/auth/invite/accept.d.mts.map +1 -0
  182. package/dist/astro/routes/api/auth/invite/accept.mjs +34 -0
  183. package/dist/astro/routes/api/auth/invite/accept.mjs.map +1 -0
  184. package/dist/astro/routes/api/auth/invite/complete.d.mts +8 -0
  185. package/dist/astro/routes/api/auth/invite/complete.d.mts.map +1 -0
  186. package/dist/astro/routes/api/auth/invite/complete.mjs +56 -0
  187. package/dist/astro/routes/api/auth/invite/complete.mjs.map +1 -0
  188. package/dist/astro/routes/api/auth/invite/index.d.mts +8 -0
  189. package/dist/astro/routes/api/auth/invite/index.d.mts.map +1 -0
  190. package/dist/astro/routes/api/auth/invite/index.mjs +53 -0
  191. package/dist/astro/routes/api/auth/invite/index.mjs.map +1 -0
  192. package/dist/astro/routes/api/auth/invite/register-options.d.mts +8 -0
  193. package/dist/astro/routes/api/auth/invite/register-options.d.mts.map +1 -0
  194. package/dist/astro/routes/api/auth/invite/register-options.mjs +46 -0
  195. package/dist/astro/routes/api/auth/invite/register-options.mjs.map +1 -0
  196. package/dist/astro/routes/api/auth/logout.d.mts +8 -0
  197. package/dist/astro/routes/api/auth/logout.d.mts.map +1 -0
  198. package/dist/astro/routes/api/auth/logout.mjs +27 -0
  199. package/dist/astro/routes/api/auth/logout.mjs.map +1 -0
  200. package/dist/astro/routes/api/auth/magic-link/send.d.mts +8 -0
  201. package/dist/astro/routes/api/auth/magic-link/send.d.mts.map +1 -0
  202. package/dist/astro/routes/api/auth/magic-link/send.mjs +50 -0
  203. package/dist/astro/routes/api/auth/magic-link/send.mjs.map +1 -0
  204. package/dist/astro/routes/api/auth/magic-link/verify.d.mts +8 -0
  205. package/dist/astro/routes/api/auth/magic-link/verify.d.mts.map +1 -0
  206. package/dist/astro/routes/api/auth/magic-link/verify.mjs +35 -0
  207. package/dist/astro/routes/api/auth/magic-link/verify.mjs.map +1 -0
  208. package/dist/astro/routes/api/auth/me.d.mts +14 -0
  209. package/dist/astro/routes/api/auth/me.d.mts.map +1 -0
  210. package/dist/astro/routes/api/auth/me.mjs +43 -0
  211. package/dist/astro/routes/api/auth/me.mjs.map +1 -0
  212. package/dist/astro/routes/api/auth/mode.d.mts +8 -0
  213. package/dist/astro/routes/api/auth/mode.d.mts.map +1 -0
  214. package/dist/astro/routes/api/auth/mode.mjs +29 -0
  215. package/dist/astro/routes/api/auth/mode.mjs.map +1 -0
  216. package/dist/astro/routes/api/auth/oauth/_provider_/callback.d.mts +8 -0
  217. package/dist/astro/routes/api/auth/oauth/_provider_/callback.d.mts.map +1 -0
  218. package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +130 -0
  219. package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs.map +1 -0
  220. package/dist/astro/routes/api/auth/oauth/_provider_.d.mts +8 -0
  221. package/dist/astro/routes/api/auth/oauth/_provider_.d.mts.map +1 -0
  222. package/dist/astro/routes/api/auth/oauth/_provider_.mjs +60 -0
  223. package/dist/astro/routes/api/auth/oauth/_provider_.mjs.map +1 -0
  224. package/dist/astro/routes/api/auth/passkey/_id_.d.mts +15 -0
  225. package/dist/astro/routes/api/auth/passkey/_id_.d.mts.map +1 -0
  226. package/dist/astro/routes/api/auth/passkey/_id_.mjs +64 -0
  227. package/dist/astro/routes/api/auth/passkey/_id_.mjs.map +1 -0
  228. package/dist/astro/routes/api/auth/passkey/index.d.mts +8 -0
  229. package/dist/astro/routes/api/auth/passkey/index.d.mts.map +1 -0
  230. package/dist/astro/routes/api/auth/passkey/index.mjs +28 -0
  231. package/dist/astro/routes/api/auth/passkey/index.mjs.map +1 -0
  232. package/dist/astro/routes/api/auth/passkey/options.d.mts +8 -0
  233. package/dist/astro/routes/api/auth/passkey/options.d.mts.map +1 -0
  234. package/dist/astro/routes/api/auth/passkey/options.mjs +48 -0
  235. package/dist/astro/routes/api/auth/passkey/options.mjs.map +1 -0
  236. package/dist/astro/routes/api/auth/passkey/register/options.d.mts +8 -0
  237. package/dist/astro/routes/api/auth/passkey/register/options.d.mts.map +1 -0
  238. package/dist/astro/routes/api/auth/passkey/register/options.mjs +46 -0
  239. package/dist/astro/routes/api/auth/passkey/register/options.mjs.map +1 -0
  240. package/dist/astro/routes/api/auth/passkey/register/verify.d.mts +8 -0
  241. package/dist/astro/routes/api/auth/passkey/register/verify.d.mts.map +1 -0
  242. package/dist/astro/routes/api/auth/passkey/register/verify.mjs +61 -0
  243. package/dist/astro/routes/api/auth/passkey/register/verify.mjs.map +1 -0
  244. package/dist/astro/routes/api/auth/passkey/verify.d.mts +8 -0
  245. package/dist/astro/routes/api/auth/passkey/verify.d.mts.map +1 -0
  246. package/dist/astro/routes/api/auth/passkey/verify.mjs +49 -0
  247. package/dist/astro/routes/api/auth/passkey/verify.mjs.map +1 -0
  248. package/dist/astro/routes/api/auth/signup/complete.d.mts +8 -0
  249. package/dist/astro/routes/api/auth/signup/complete.d.mts.map +1 -0
  250. package/dist/astro/routes/api/auth/signup/complete.mjs +57 -0
  251. package/dist/astro/routes/api/auth/signup/complete.mjs.map +1 -0
  252. package/dist/astro/routes/api/auth/signup/request.d.mts +8 -0
  253. package/dist/astro/routes/api/auth/signup/request.d.mts.map +1 -0
  254. package/dist/astro/routes/api/auth/signup/request.mjs +46 -0
  255. package/dist/astro/routes/api/auth/signup/request.mjs.map +1 -0
  256. package/dist/astro/routes/api/auth/signup/verify.d.mts +8 -0
  257. package/dist/astro/routes/api/auth/signup/verify.d.mts.map +1 -0
  258. package/dist/astro/routes/api/auth/signup/verify.mjs +35 -0
  259. package/dist/astro/routes/api/auth/signup/verify.mjs.map +1 -0
  260. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.d.mts +15 -0
  261. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.d.mts.map +1 -0
  262. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +193 -0
  263. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs.map +1 -0
  264. package/dist/astro/routes/api/content/_collection_/_id_/compare.d.mts +8 -0
  265. package/dist/astro/routes/api/content/_collection_/_id_/compare.d.mts.map +1 -0
  266. package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +20 -0
  267. package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs.map +1 -0
  268. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.d.mts +8 -0
  269. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.d.mts.map +1 -0
  270. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +28 -0
  271. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs.map +1 -0
  272. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.d.mts +8 -0
  273. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.d.mts.map +1 -0
  274. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +30 -0
  275. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs.map +1 -0
  276. package/dist/astro/routes/api/content/_collection_/_id_/permanent.d.mts +8 -0
  277. package/dist/astro/routes/api/content/_collection_/_id_/permanent.d.mts.map +1 -0
  278. package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +23 -0
  279. package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs.map +1 -0
  280. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.d.mts +8 -0
  281. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.d.mts.map +1 -0
  282. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +78 -0
  283. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs.map +1 -0
  284. package/dist/astro/routes/api/content/_collection_/_id_/publish.d.mts +8 -0
  285. package/dist/astro/routes/api/content/_collection_/_id_/publish.d.mts.map +1 -0
  286. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +48 -0
  287. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs.map +1 -0
  288. package/dist/astro/routes/api/content/_collection_/_id_/restore.d.mts +8 -0
  289. package/dist/astro/routes/api/content/_collection_/_id_/restore.d.mts.map +1 -0
  290. package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +28 -0
  291. package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs.map +1 -0
  292. package/dist/astro/routes/api/content/_collection_/_id_/revisions.d.mts +8 -0
  293. package/dist/astro/routes/api/content/_collection_/_id_/revisions.d.mts.map +1 -0
  294. package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +22 -0
  295. package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs.map +1 -0
  296. package/dist/astro/routes/api/content/_collection_/_id_/schedule.d.mts +9 -0
  297. package/dist/astro/routes/api/content/_collection_/_id_/schedule.d.mts.map +1 -0
  298. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +58 -0
  299. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs.map +1 -0
  300. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.d.mts +15 -0
  301. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.d.mts.map +1 -0
  302. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +85 -0
  303. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs.map +1 -0
  304. package/dist/astro/routes/api/content/_collection_/_id_/translations.d.mts +8 -0
  305. package/dist/astro/routes/api/content/_collection_/_id_/translations.d.mts.map +1 -0
  306. package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +43 -0
  307. package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs.map +1 -0
  308. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.d.mts +8 -0
  309. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.d.mts.map +1 -0
  310. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +28 -0
  311. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs.map +1 -0
  312. package/dist/astro/routes/api/content/_collection_/_id_.d.mts +10 -0
  313. package/dist/astro/routes/api/content/_collection_/_id_.d.mts.map +1 -0
  314. package/dist/astro/routes/api/content/_collection_/_id_.mjs +88 -0
  315. package/dist/astro/routes/api/content/_collection_/_id_.mjs.map +1 -0
  316. package/dist/astro/routes/api/content/_collection_/index.d.mts +9 -0
  317. package/dist/astro/routes/api/content/_collection_/index.d.mts.map +1 -0
  318. package/dist/astro/routes/api/content/_collection_/index.mjs +61 -0
  319. package/dist/astro/routes/api/content/_collection_/index.mjs.map +1 -0
  320. package/dist/astro/routes/api/content/_collection_/trash.d.mts +8 -0
  321. package/dist/astro/routes/api/content/_collection_/trash.d.mts.map +1 -0
  322. package/dist/astro/routes/api/content/_collection_/trash.mjs +25 -0
  323. package/dist/astro/routes/api/content/_collection_/trash.mjs.map +1 -0
  324. package/dist/astro/routes/api/dashboard.d.mts +8 -0
  325. package/dist/astro/routes/api/dashboard.d.mts.map +1 -0
  326. package/dist/astro/routes/api/dashboard.mjs +26 -0
  327. package/dist/astro/routes/api/dashboard.mjs.map +1 -0
  328. package/dist/astro/routes/api/dev/emails.d.mts +9 -0
  329. package/dist/astro/routes/api/dev/emails.d.mts.map +1 -0
  330. package/dist/astro/routes/api/dev/emails.mjs +20 -0
  331. package/dist/astro/routes/api/dev/emails.mjs.map +1 -0
  332. package/dist/astro/routes/api/import/probe.d.mts +18 -0
  333. package/dist/astro/routes/api/import/probe.d.mts.map +1 -0
  334. package/dist/astro/routes/api/import/probe.mjs +35 -0
  335. package/dist/astro/routes/api/import/probe.mjs.map +1 -0
  336. package/dist/astro/routes/api/import/wordpress/analyze.d.mts +88 -0
  337. package/dist/astro/routes/api/import/wordpress/analyze.d.mts.map +1 -0
  338. package/dist/astro/routes/api/import/wordpress/analyze.mjs +313 -0
  339. package/dist/astro/routes/api/import/wordpress/analyze.mjs.map +1 -0
  340. package/dist/astro/routes/api/import/wordpress/execute.d.mts +93 -0
  341. package/dist/astro/routes/api/import/wordpress/execute.d.mts.map +1 -0
  342. package/dist/astro/routes/api/import/wordpress/execute.mjs +593 -0
  343. package/dist/astro/routes/api/import/wordpress/execute.mjs.map +1 -0
  344. package/dist/astro/routes/api/import/wordpress/media.d.mts +36 -0
  345. package/dist/astro/routes/api/import/wordpress/media.d.mts.map +1 -0
  346. package/dist/astro/routes/api/import/wordpress/media.mjs +225 -0
  347. package/dist/astro/routes/api/import/wordpress/media.mjs.map +1 -0
  348. package/dist/astro/routes/api/import/wordpress/prepare.d.mts +20 -0
  349. package/dist/astro/routes/api/import/wordpress/prepare.d.mts.map +1 -0
  350. package/dist/astro/routes/api/import/wordpress/prepare.mjs +120 -0
  351. package/dist/astro/routes/api/import/wordpress/prepare.mjs.map +1 -0
  352. package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.d.mts +49 -0
  353. package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.d.mts.map +1 -0
  354. package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.mjs +131 -0
  355. package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.mjs.map +1 -0
  356. package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +22 -0
  357. package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts.map +1 -0
  358. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +139 -0
  359. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs.map +1 -0
  360. package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +16 -0
  361. package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts.map +1 -0
  362. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +71 -0
  363. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs.map +1 -0
  364. package/dist/astro/routes/api/import/wordpress-plugin/callback.d.mts +8 -0
  365. package/dist/astro/routes/api/import/wordpress-plugin/callback.d.mts.map +1 -0
  366. package/dist/astro/routes/api/import/wordpress-plugin/callback.mjs +29 -0
  367. package/dist/astro/routes/api/import/wordpress-plugin/callback.mjs.map +1 -0
  368. package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +20 -0
  369. package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts.map +1 -0
  370. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +219 -0
  371. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs.map +1 -0
  372. package/dist/astro/routes/api/manifest.d.mts +8 -0
  373. package/dist/astro/routes/api/manifest.d.mts.map +1 -0
  374. package/dist/astro/routes/api/manifest.mjs +47 -0
  375. package/dist/astro/routes/api/manifest.mjs.map +1 -0
  376. package/dist/astro/routes/api/mcp.d.mts +16 -0
  377. package/dist/astro/routes/api/mcp.d.mts.map +1 -0
  378. package/dist/astro/routes/api/mcp.mjs +1414 -0
  379. package/dist/astro/routes/api/mcp.mjs.map +1 -0
  380. package/dist/astro/routes/api/media/_id_/confirm.d.mts +11 -0
  381. package/dist/astro/routes/api/media/_id_/confirm.d.mts.map +1 -0
  382. package/dist/astro/routes/api/media/_id_/confirm.mjs +61 -0
  383. package/dist/astro/routes/api/media/_id_/confirm.mjs.map +1 -0
  384. package/dist/astro/routes/api/media/_id_.d.mts +23 -0
  385. package/dist/astro/routes/api/media/_id_.d.mts.map +1 -0
  386. package/dist/astro/routes/api/media/_id_.mjs +83 -0
  387. package/dist/astro/routes/api/media/_id_.mjs.map +1 -0
  388. package/dist/astro/routes/api/media/file/_...key_.d.mts +8 -0
  389. package/dist/astro/routes/api/media/file/_...key_.d.mts.map +1 -0
  390. package/dist/astro/routes/api/media/file/_...key_.mjs +52 -0
  391. package/dist/astro/routes/api/media/file/_...key_.mjs.map +1 -0
  392. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.d.mts +15 -0
  393. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.d.mts.map +1 -0
  394. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +52 -0
  395. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs.map +1 -0
  396. package/dist/astro/routes/api/media/providers/_providerId_/index.d.mts +15 -0
  397. package/dist/astro/routes/api/media/providers/_providerId_/index.d.mts.map +1 -0
  398. package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +75 -0
  399. package/dist/astro/routes/api/media/providers/_providerId_/index.mjs.map +1 -0
  400. package/dist/astro/routes/api/media/providers/index.d.mts +11 -0
  401. package/dist/astro/routes/api/media/providers/index.d.mts.map +1 -0
  402. package/dist/astro/routes/api/media/providers/index.mjs +21 -0
  403. package/dist/astro/routes/api/media/providers/index.mjs.map +1 -0
  404. package/dist/astro/routes/api/media/upload-url.d.mts +11 -0
  405. package/dist/astro/routes/api/media/upload-url.d.mts.map +1 -0
  406. package/dist/astro/routes/api/media/upload-url.mjs +82 -0
  407. package/dist/astro/routes/api/media/upload-url.mjs.map +1 -0
  408. package/dist/astro/routes/api/media.d.mts +17 -0
  409. package/dist/astro/routes/api/media.d.mts.map +1 -0
  410. package/dist/astro/routes/api/media.mjs +138 -0
  411. package/dist/astro/routes/api/media.mjs.map +1 -0
  412. package/dist/astro/routes/api/menus/_name_/items/_id_.d.mts +9 -0
  413. package/dist/astro/routes/api/menus/_name_/items/_id_.d.mts.map +1 -0
  414. package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +48 -0
  415. package/dist/astro/routes/api/menus/_name_/items/_id_.mjs.map +1 -0
  416. package/dist/astro/routes/api/menus/_name_/items.d.mts +8 -0
  417. package/dist/astro/routes/api/menus/_name_/items.d.mts.map +1 -0
  418. package/dist/astro/routes/api/menus/_name_/items.mjs +31 -0
  419. package/dist/astro/routes/api/menus/_name_/items.mjs.map +1 -0
  420. package/dist/astro/routes/api/menus/_name_/reorder.d.mts +8 -0
  421. package/dist/astro/routes/api/menus/_name_/reorder.d.mts.map +1 -0
  422. package/dist/astro/routes/api/menus/_name_/reorder.mjs +31 -0
  423. package/dist/astro/routes/api/menus/_name_/reorder.mjs.map +1 -0
  424. package/dist/astro/routes/api/menus/_name_/translations.d.mts +9 -0
  425. package/dist/astro/routes/api/menus/_name_/translations.d.mts.map +1 -0
  426. package/dist/astro/routes/api/menus/_name_/translations.mjs +62 -0
  427. package/dist/astro/routes/api/menus/_name_/translations.mjs.map +1 -0
  428. package/dist/astro/routes/api/menus/_name_.d.mts +10 -0
  429. package/dist/astro/routes/api/menus/_name_.d.mts.map +1 -0
  430. package/dist/astro/routes/api/menus/_name_.mjs +60 -0
  431. package/dist/astro/routes/api/menus/_name_.mjs.map +1 -0
  432. package/dist/astro/routes/api/menus/index.d.mts +9 -0
  433. package/dist/astro/routes/api/menus/index.d.mts.map +1 -0
  434. package/dist/astro/routes/api/menus/index.mjs +40 -0
  435. package/dist/astro/routes/api/menus/index.mjs.map +1 -0
  436. package/dist/astro/routes/api/oauth/authorize.d.mts +9 -0
  437. package/dist/astro/routes/api/oauth/authorize.d.mts.map +1 -0
  438. package/dist/astro/routes/api/oauth/authorize.mjs +260 -0
  439. package/dist/astro/routes/api/oauth/authorize.mjs.map +1 -0
  440. package/dist/astro/routes/api/oauth/device/authorize.d.mts +8 -0
  441. package/dist/astro/routes/api/oauth/device/authorize.d.mts.map +1 -0
  442. package/dist/astro/routes/api/oauth/device/authorize.mjs +32 -0
  443. package/dist/astro/routes/api/oauth/device/authorize.mjs.map +1 -0
  444. package/dist/astro/routes/api/oauth/device/code.d.mts +8 -0
  445. package/dist/astro/routes/api/oauth/device/code.d.mts.map +1 -0
  446. package/dist/astro/routes/api/oauth/device/code.mjs +36 -0
  447. package/dist/astro/routes/api/oauth/device/code.mjs.map +1 -0
  448. package/dist/astro/routes/api/oauth/device/token.d.mts +8 -0
  449. package/dist/astro/routes/api/oauth/device/token.d.mts.map +1 -0
  450. package/dist/astro/routes/api/oauth/device/token.mjs +47 -0
  451. package/dist/astro/routes/api/oauth/device/token.mjs.map +1 -0
  452. package/dist/astro/routes/api/oauth/register.d.mts +9 -0
  453. package/dist/astro/routes/api/oauth/register.d.mts.map +1 -0
  454. package/dist/astro/routes/api/oauth/register.mjs +113 -0
  455. package/dist/astro/routes/api/oauth/register.mjs.map +1 -0
  456. package/dist/astro/routes/api/oauth/token/refresh.d.mts +8 -0
  457. package/dist/astro/routes/api/oauth/token/refresh.d.mts.map +1 -0
  458. package/dist/astro/routes/api/oauth/token/refresh.mjs +30 -0
  459. package/dist/astro/routes/api/oauth/token/refresh.mjs.map +1 -0
  460. package/dist/astro/routes/api/oauth/token/revoke.d.mts +8 -0
  461. package/dist/astro/routes/api/oauth/token/revoke.d.mts.map +1 -0
  462. package/dist/astro/routes/api/oauth/token/revoke.mjs +27 -0
  463. package/dist/astro/routes/api/oauth/token/revoke.mjs.map +1 -0
  464. package/dist/astro/routes/api/oauth/token.d.mts +9 -0
  465. package/dist/astro/routes/api/oauth/token.d.mts.map +1 -0
  466. package/dist/astro/routes/api/oauth/token.mjs +141 -0
  467. package/dist/astro/routes/api/oauth/token.mjs.map +1 -0
  468. package/dist/astro/routes/api/openapi.json.d.mts +8 -0
  469. package/dist/astro/routes/api/openapi.json.d.mts.map +1 -0
  470. package/dist/astro/routes/api/openapi.json.mjs +2642 -0
  471. package/dist/astro/routes/api/openapi.json.mjs.map +1 -0
  472. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.d.mts +12 -0
  473. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.d.mts.map +1 -0
  474. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +78 -0
  475. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs.map +1 -0
  476. package/dist/astro/routes/api/redirects/404s/index.d.mts +10 -0
  477. package/dist/astro/routes/api/redirects/404s/index.d.mts.map +1 -0
  478. package/dist/astro/routes/api/redirects/404s/index.mjs +62 -0
  479. package/dist/astro/routes/api/redirects/404s/index.mjs.map +1 -0
  480. package/dist/astro/routes/api/redirects/404s/summary.d.mts +8 -0
  481. package/dist/astro/routes/api/redirects/404s/summary.d.mts.map +1 -0
  482. package/dist/astro/routes/api/redirects/404s/summary.mjs +34 -0
  483. package/dist/astro/routes/api/redirects/404s/summary.mjs.map +1 -0
  484. package/dist/astro/routes/api/redirects/_id_.d.mts +10 -0
  485. package/dist/astro/routes/api/redirects/_id_.d.mts.map +1 -0
  486. package/dist/astro/routes/api/redirects/_id_.mjs +71 -0
  487. package/dist/astro/routes/api/redirects/_id_.mjs.map +1 -0
  488. package/dist/astro/routes/api/redirects/index.d.mts +9 -0
  489. package/dist/astro/routes/api/redirects/index.d.mts.map +1 -0
  490. package/dist/astro/routes/api/redirects/index.mjs +52 -0
  491. package/dist/astro/routes/api/redirects/index.mjs.map +1 -0
  492. package/dist/astro/routes/api/revisions/_revisionId_/index.d.mts +8 -0
  493. package/dist/astro/routes/api/revisions/_revisionId_/index.d.mts.map +1 -0
  494. package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +19 -0
  495. package/dist/astro/routes/api/revisions/_revisionId_/index.mjs.map +1 -0
  496. package/dist/astro/routes/api/revisions/_revisionId_/restore.d.mts +8 -0
  497. package/dist/astro/routes/api/revisions/_revisionId_/restore.d.mts.map +1 -0
  498. package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +26 -0
  499. package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs.map +1 -0
  500. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.d.mts +10 -0
  501. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.d.mts.map +1 -0
  502. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +75 -0
  503. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs.map +1 -0
  504. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.d.mts +9 -0
  505. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.d.mts.map +1 -0
  506. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +63 -0
  507. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs.map +1 -0
  508. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.d.mts +8 -0
  509. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.d.mts.map +1 -0
  510. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +54 -0
  511. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs.map +1 -0
  512. package/dist/astro/routes/api/schema/collections/_slug_/index.d.mts +10 -0
  513. package/dist/astro/routes/api/schema/collections/_slug_/index.d.mts.map +1 -0
  514. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +79 -0
  515. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs.map +1 -0
  516. package/dist/astro/routes/api/schema/collections/index.d.mts +9 -0
  517. package/dist/astro/routes/api/schema/collections/index.d.mts.map +1 -0
  518. package/dist/astro/routes/api/schema/collections/index.mjs +63 -0
  519. package/dist/astro/routes/api/schema/collections/index.mjs.map +1 -0
  520. package/dist/astro/routes/api/schema/index.d.mts +8 -0
  521. package/dist/astro/routes/api/schema/index.d.mts.map +1 -0
  522. package/dist/astro/routes/api/schema/index.mjs +82 -0
  523. package/dist/astro/routes/api/schema/index.mjs.map +1 -0
  524. package/dist/astro/routes/api/schema/orphans/_slug_.d.mts +8 -0
  525. package/dist/astro/routes/api/schema/orphans/_slug_.d.mts.map +1 -0
  526. package/dist/astro/routes/api/schema/orphans/_slug_.mjs +55 -0
  527. package/dist/astro/routes/api/schema/orphans/_slug_.mjs.map +1 -0
  528. package/dist/astro/routes/api/schema/orphans/index.d.mts +8 -0
  529. package/dist/astro/routes/api/schema/orphans/index.d.mts.map +1 -0
  530. package/dist/astro/routes/api/schema/orphans/index.mjs +50 -0
  531. package/dist/astro/routes/api/schema/orphans/index.mjs.map +1 -0
  532. package/dist/astro/routes/api/search/enable.d.mts +16 -0
  533. package/dist/astro/routes/api/search/enable.d.mts.map +1 -0
  534. package/dist/astro/routes/api/search/enable.mjs +55 -0
  535. package/dist/astro/routes/api/search/enable.mjs.map +1 -0
  536. package/dist/astro/routes/api/search/index.d.mts +17 -0
  537. package/dist/astro/routes/api/search/index.d.mts.map +1 -0
  538. package/dist/astro/routes/api/search/index.mjs +52 -0
  539. package/dist/astro/routes/api/search/index.mjs.map +1 -0
  540. package/dist/astro/routes/api/search/rebuild.d.mts +14 -0
  541. package/dist/astro/routes/api/search/rebuild.d.mts.map +1 -0
  542. package/dist/astro/routes/api/search/rebuild.mjs +48 -0
  543. package/dist/astro/routes/api/search/rebuild.mjs.map +1 -0
  544. package/dist/astro/routes/api/search/stats.d.mts +11 -0
  545. package/dist/astro/routes/api/search/stats.d.mts.map +1 -0
  546. package/dist/astro/routes/api/search/stats.mjs +29 -0
  547. package/dist/astro/routes/api/search/stats.mjs.map +1 -0
  548. package/dist/astro/routes/api/search/suggest.d.mts +16 -0
  549. package/dist/astro/routes/api/search/suggest.d.mts.map +1 -0
  550. package/dist/astro/routes/api/search/suggest.mjs +43 -0
  551. package/dist/astro/routes/api/search/suggest.mjs.map +1 -0
  552. package/dist/astro/routes/api/sections/_slug_.d.mts +10 -0
  553. package/dist/astro/routes/api/sections/_slug_.d.mts.map +1 -0
  554. package/dist/astro/routes/api/sections/_slug_.mjs +65 -0
  555. package/dist/astro/routes/api/sections/_slug_.mjs.map +1 -0
  556. package/dist/astro/routes/api/sections/index.d.mts +9 -0
  557. package/dist/astro/routes/api/sections/index.d.mts.map +1 -0
  558. package/dist/astro/routes/api/sections/index.mjs +48 -0
  559. package/dist/astro/routes/api/sections/index.mjs.map +1 -0
  560. package/dist/astro/routes/api/settings/email.d.mts +18 -0
  561. package/dist/astro/routes/api/settings/email.d.mts.map +1 -0
  562. package/dist/astro/routes/api/settings/email.mjs +105 -0
  563. package/dist/astro/routes/api/settings/email.mjs.map +1 -0
  564. package/dist/astro/routes/api/settings.d.mts +21 -0
  565. package/dist/astro/routes/api/settings.d.mts.map +1 -0
  566. package/dist/astro/routes/api/settings.mjs +58 -0
  567. package/dist/astro/routes/api/settings.mjs.map +1 -0
  568. package/dist/astro/routes/api/setup/admin-verify.d.mts +8 -0
  569. package/dist/astro/routes/api/setup/admin-verify.d.mts.map +1 -0
  570. package/dist/astro/routes/api/setup/admin-verify.mjs +68 -0
  571. package/dist/astro/routes/api/setup/admin-verify.mjs.map +1 -0
  572. package/dist/astro/routes/api/setup/admin.d.mts +8 -0
  573. package/dist/astro/routes/api/setup/admin.d.mts.map +1 -0
  574. package/dist/astro/routes/api/setup/admin.mjs +69 -0
  575. package/dist/astro/routes/api/setup/admin.mjs.map +1 -0
  576. package/dist/astro/routes/api/setup/dev-bypass.d.mts +9 -0
  577. package/dist/astro/routes/api/setup/dev-bypass.d.mts.map +1 -0
  578. package/dist/astro/routes/api/setup/dev-bypass.mjs +139 -0
  579. package/dist/astro/routes/api/setup/dev-bypass.mjs.map +1 -0
  580. package/dist/astro/routes/api/setup/dev-reset.d.mts +8 -0
  581. package/dist/astro/routes/api/setup/dev-reset.d.mts.map +1 -0
  582. package/dist/astro/routes/api/setup/dev-reset.mjs +25 -0
  583. package/dist/astro/routes/api/setup/dev-reset.mjs.map +1 -0
  584. package/dist/astro/routes/api/setup/index.d.mts +8 -0
  585. package/dist/astro/routes/api/setup/index.d.mts.map +1 -0
  586. package/dist/astro/routes/api/setup/index.mjs +93 -0
  587. package/dist/astro/routes/api/setup/index.mjs.map +1 -0
  588. package/dist/astro/routes/api/setup/status.d.mts +8 -0
  589. package/dist/astro/routes/api/setup/status.d.mts.map +1 -0
  590. package/dist/astro/routes/api/setup/status.mjs +60 -0
  591. package/dist/astro/routes/api/setup/status.mjs.map +1 -0
  592. package/dist/astro/routes/api/snapshot.d.mts +8 -0
  593. package/dist/astro/routes/api/snapshot.d.mts.map +1 -0
  594. package/dist/astro/routes/api/snapshot.mjs +270 -0
  595. package/dist/astro/routes/api/snapshot.mjs.map +1 -0
  596. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.d.mts +9 -0
  597. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.d.mts.map +1 -0
  598. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +72 -0
  599. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs.map +1 -0
  600. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.d.mts +19 -0
  601. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.d.mts.map +1 -0
  602. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +80 -0
  603. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs.map +1 -0
  604. package/dist/astro/routes/api/taxonomies/_name_/terms/index.d.mts +15 -0
  605. package/dist/astro/routes/api/taxonomies/_name_/terms/index.d.mts.map +1 -0
  606. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +59 -0
  607. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs.map +1 -0
  608. package/dist/astro/routes/api/taxonomies/index.d.mts +15 -0
  609. package/dist/astro/routes/api/taxonomies/index.d.mts.map +1 -0
  610. package/dist/astro/routes/api/taxonomies/index.mjs +55 -0
  611. package/dist/astro/routes/api/taxonomies/index.mjs.map +1 -0
  612. package/dist/astro/routes/api/themes/preview.d.mts +8 -0
  613. package/dist/astro/routes/api/themes/preview.d.mts.map +1 -0
  614. package/dist/astro/routes/api/themes/preview.mjs +49 -0
  615. package/dist/astro/routes/api/themes/preview.mjs.map +1 -0
  616. package/dist/astro/routes/api/typegen.d.mts +18 -0
  617. package/dist/astro/routes/api/typegen.d.mts.map +1 -0
  618. package/dist/astro/routes/api/typegen.mjs +78 -0
  619. package/dist/astro/routes/api/typegen.mjs.map +1 -0
  620. package/dist/astro/routes/api/well-known/auth.d.mts +8 -0
  621. package/dist/astro/routes/api/well-known/auth.d.mts.map +1 -0
  622. package/dist/astro/routes/api/well-known/auth.mjs +42 -0
  623. package/dist/astro/routes/api/well-known/auth.mjs.map +1 -0
  624. package/dist/astro/routes/api/well-known/oauth-authorization-server.d.mts +8 -0
  625. package/dist/astro/routes/api/well-known/oauth-authorization-server.d.mts.map +1 -0
  626. package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +32 -0
  627. package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs.map +1 -0
  628. package/dist/astro/routes/api/well-known/oauth-protected-resource.d.mts +8 -0
  629. package/dist/astro/routes/api/well-known/oauth-protected-resource.d.mts.map +1 -0
  630. package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +21 -0
  631. package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs.map +1 -0
  632. package/dist/astro/routes/api/widget-areas/_name_/reorder.d.mts +8 -0
  633. package/dist/astro/routes/api/widget-areas/_name_/reorder.d.mts.map +1 -0
  634. package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +36 -0
  635. package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs.map +1 -0
  636. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.d.mts +9 -0
  637. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.d.mts.map +1 -0
  638. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +62 -0
  639. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs.map +1 -0
  640. package/dist/astro/routes/api/widget-areas/_name_/widgets.d.mts +8 -0
  641. package/dist/astro/routes/api/widget-areas/_name_/widgets.d.mts.map +1 -0
  642. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +49 -0
  643. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs.map +1 -0
  644. package/dist/astro/routes/api/widget-areas/_name_.d.mts +9 -0
  645. package/dist/astro/routes/api/widget-areas/_name_.d.mts.map +1 -0
  646. package/dist/astro/routes/api/widget-areas/_name_.mjs +49 -0
  647. package/dist/astro/routes/api/widget-areas/_name_.mjs.map +1 -0
  648. package/dist/astro/routes/api/widget-areas/index.d.mts +9 -0
  649. package/dist/astro/routes/api/widget-areas/index.d.mts.map +1 -0
  650. package/dist/astro/routes/api/widget-areas/index.mjs +59 -0
  651. package/dist/astro/routes/api/widget-areas/index.mjs.map +1 -0
  652. package/dist/astro/routes/api/widget-components.d.mts +8 -0
  653. package/dist/astro/routes/api/widget-components.d.mts.map +1 -0
  654. package/dist/astro/routes/api/widget-components.mjs +18 -0
  655. package/dist/astro/routes/api/widget-components.mjs.map +1 -0
  656. package/dist/astro/routes/robots.txt.d.mts +8 -0
  657. package/dist/astro/routes/robots.txt.d.mts.map +1 -0
  658. package/dist/astro/routes/robots.txt.mjs +61 -0
  659. package/dist/astro/routes/robots.txt.mjs.map +1 -0
  660. package/dist/astro/routes/sitemap-_collection_.xml.d.mts +8 -0
  661. package/dist/astro/routes/sitemap-_collection_.xml.d.mts.map +1 -0
  662. package/dist/astro/routes/sitemap-_collection_.xml.mjs +71 -0
  663. package/dist/astro/routes/sitemap-_collection_.xml.mjs.map +1 -0
  664. package/dist/astro/routes/sitemap.xml.d.mts +8 -0
  665. package/dist/astro/routes/sitemap.xml.d.mts.map +1 -0
  666. package/dist/astro/routes/sitemap.xml.mjs +64 -0
  667. package/dist/astro/routes/sitemap.xml.mjs.map +1 -0
  668. package/dist/astro/types.d.mts +48 -9
  669. package/dist/astro/types.d.mts.map +1 -1
  670. package/dist/auth/providers/github.d.mts +13 -0
  671. package/dist/auth/providers/github.d.mts.map +1 -0
  672. package/dist/auth/providers/github.mjs +18 -0
  673. package/dist/auth/providers/github.mjs.map +1 -0
  674. package/dist/auth/providers/google.d.mts +13 -0
  675. package/dist/auth/providers/google.d.mts.map +1 -0
  676. package/dist/auth/providers/google.mjs +18 -0
  677. package/dist/auth/providers/google.mjs.map +1 -0
  678. package/dist/authorize-BlyCH-96.mjs +37 -0
  679. package/dist/authorize-BlyCH-96.mjs.map +1 -0
  680. package/dist/{base64-MBPo9ozB.mjs → base64-CqR-7kqF.mjs} +1 -1
  681. package/dist/{base64-MBPo9ozB.mjs.map → base64-CqR-7kqF.mjs.map} +1 -1
  682. package/dist/{byline-gFn1r0vA.mjs → byline-D09BaS4j.mjs} +4 -4
  683. package/dist/{byline-gFn1r0vA.mjs.map → byline-D09BaS4j.mjs.map} +1 -1
  684. package/dist/{bylines-DTFI8nDM.mjs → bylines-BTM2xtP8.mjs} +6 -6
  685. package/dist/{bylines-DTFI8nDM.mjs.map → bylines-BTM2xtP8.mjs.map} +1 -1
  686. package/dist/bylines-C6eYUWlZ.d.mts +1971 -0
  687. package/dist/bylines-C6eYUWlZ.d.mts.map +1 -0
  688. package/dist/{cache-BAJbeoZ8.mjs → cache-CXCpjWiL.mjs} +3 -3
  689. package/dist/{cache-BAJbeoZ8.mjs.map → cache-CXCpjWiL.mjs.map} +1 -1
  690. package/dist/challenge-store-CJ0OOHOr.mjs +49 -0
  691. package/dist/challenge-store-CJ0OOHOr.mjs.map +1 -0
  692. package/dist/{chunks-BK1oZS-l.mjs → chunks-DyGtu1Bv.mjs} +2 -2
  693. package/dist/{chunks-BK1oZS-l.mjs.map → chunks-DyGtu1Bv.mjs.map} +1 -1
  694. package/dist/cli/index.mjs +23 -18
  695. package/dist/cli/index.mjs.map +1 -1
  696. package/dist/client/cf-access.d.mts +1 -1
  697. package/dist/client/index.d.mts +1 -1
  698. package/dist/client/index.d.mts.map +1 -1
  699. package/dist/client/index.mjs +2 -2
  700. package/dist/client/index.mjs.map +1 -1
  701. package/dist/comment-Dd9MI82-.mjs +247 -0
  702. package/dist/comment-Dd9MI82-.mjs.map +1 -0
  703. package/dist/comments-koGI0FrK.mjs +204 -0
  704. package/dist/comments-koGI0FrK.mjs.map +1 -0
  705. package/dist/components-mZem7pbe.mjs +108 -0
  706. package/dist/components-mZem7pbe.mjs.map +1 -0
  707. package/dist/{content-CERxPUN0.mjs → content-D6YG26WG.mjs} +10 -34
  708. package/dist/content-D6YG26WG.mjs.map +1 -0
  709. package/dist/context-qF8d3IPR.mjs +879 -0
  710. package/dist/context-qF8d3IPR.mjs.map +1 -0
  711. package/dist/cron-H8eJ46dv.mjs +264 -0
  712. package/dist/cron-H8eJ46dv.mjs.map +1 -0
  713. package/dist/dashboard-BmWSIUwY.mjs +105 -0
  714. package/dist/dashboard-BmWSIUwY.mjs.map +1 -0
  715. package/dist/db/index.d.mts +3 -3
  716. package/dist/db/index.mjs +1 -1
  717. package/dist/db/libsql.d.mts +1 -1
  718. package/dist/db/postgres.d.mts +1 -1
  719. package/dist/db/sqlite.d.mts +1 -1
  720. package/dist/{db-errors-B7P2pSCn.mjs → db-errors-CGN9kJfo.mjs} +1 -1
  721. package/dist/{db-errors-B7P2pSCn.mjs.map → db-errors-CGN9kJfo.mjs.map} +1 -1
  722. package/dist/{default-pHuz9WF6.mjs → default-Dbs22Gg4.mjs} +1 -1
  723. package/dist/{default-pHuz9WF6.mjs.map → default-Dbs22Gg4.mjs.map} +1 -1
  724. package/dist/device-flow-BqJRxa0Q.mjs +467 -0
  725. package/dist/device-flow-BqJRxa0Q.mjs.map +1 -0
  726. package/dist/email-console-Dmp5Q-P2.mjs +50 -0
  727. package/dist/email-console-Dmp5Q-P2.mjs.map +1 -0
  728. package/dist/error-tSQWIl5U.mjs +437 -0
  729. package/dist/error-tSQWIl5U.mjs.map +1 -0
  730. package/dist/escape-B8bdIryO.mjs +9 -0
  731. package/dist/escape-B8bdIryO.mjs.map +1 -0
  732. package/dist/fts-manager-B633C-kQ.mjs +339 -0
  733. package/dist/fts-manager-B633C-kQ.mjs.map +1 -0
  734. package/dist/hash-DlUxGhQS.mjs +33 -0
  735. package/dist/hash-DlUxGhQS.mjs.map +1 -0
  736. package/dist/import-CNfLOgDE.mjs +1531 -0
  737. package/dist/import-CNfLOgDE.mjs.map +1 -0
  738. package/dist/index-D2gvztOP.d.mts +262 -0
  739. package/dist/index-D2gvztOP.d.mts.map +1 -0
  740. package/dist/{index-BogfvE-z.d.mts → index-UmOMt9T-.d.mts} +310 -911
  741. package/dist/index-UmOMt9T-.d.mts.map +1 -0
  742. package/dist/index.d.mts +17 -11
  743. package/dist/index.mjs +57 -28
  744. package/dist/{load-DR1VwFXR.mjs → load-QzYRpVN3.mjs} +2 -2
  745. package/dist/{load-DR1VwFXR.mjs.map → load-QzYRpVN3.mjs.map} +1 -1
  746. package/dist/{loader-ou_PXAjg.mjs → loader-Cs6-Bqe6.mjs} +4 -4
  747. package/dist/{loader-ou_PXAjg.mjs.map → loader-Cs6-Bqe6.mjs.map} +1 -1
  748. package/dist/{manifest-schema-CXAbd1vH.mjs → manifest-schema-HCtSh4Jq.mjs} +1 -1
  749. package/dist/{manifest-schema-CXAbd1vH.mjs.map → manifest-schema-HCtSh4Jq.mjs.map} +1 -1
  750. package/dist/media/index.d.mts +1 -1
  751. package/dist/media/index.mjs +2 -1
  752. package/dist/media/index.mjs.map +1 -1
  753. package/dist/media/local-runtime.d.mts +11 -7
  754. package/dist/media/local-runtime.d.mts.map +1 -1
  755. package/dist/media/local-runtime.mjs +9 -3
  756. package/dist/media/local-runtime.mjs.map +1 -1
  757. package/dist/{media-1fFhub9c.mjs → media-Dg7he9uK.mjs} +2 -2
  758. package/dist/{media-1fFhub9c.mjs.map → media-Dg7he9uK.mjs.map} +1 -1
  759. package/dist/media-allowlist-B8EX01DH.mjs +32 -0
  760. package/dist/media-allowlist-B8EX01DH.mjs.map +1 -0
  761. package/dist/menus-DOzIecHi.mjs +723 -0
  762. package/dist/menus-DOzIecHi.mjs.map +1 -0
  763. package/dist/menus-X4Z-eBA1.mjs +2788 -0
  764. package/dist/menus-X4Z-eBA1.mjs.map +1 -0
  765. package/dist/mime-KV5TqkMN.mjs +36 -0
  766. package/dist/mime-KV5TqkMN.mjs.map +1 -0
  767. package/dist/{mode-YhqNVef_.mjs → mode-DPRPvJYm.mjs} +1 -1
  768. package/dist/{mode-YhqNVef_.mjs.map → mode-DPRPvJYm.mjs.map} +1 -1
  769. package/dist/normalize-CN5kRSMC.mjs +151 -0
  770. package/dist/normalize-CN5kRSMC.mjs.map +1 -0
  771. package/dist/oauth-authorization-62GmpGIH.mjs +275 -0
  772. package/dist/oauth-authorization-62GmpGIH.mjs.map +1 -0
  773. package/dist/oauth-clients-D_B0_-Bz.mjs +266 -0
  774. package/dist/oauth-clients-D_B0_-Bz.mjs.map +1 -0
  775. package/dist/oauth-state-store-DpsZViTu.mjs +49 -0
  776. package/dist/oauth-state-store-DpsZViTu.mjs.map +1 -0
  777. package/dist/oauth-user-lookup-meyS2oB1.mjs +26 -0
  778. package/dist/oauth-user-lookup-meyS2oB1.mjs.map +1 -0
  779. package/dist/{options-nPxWnrya.mjs → options-BL4X94qY.mjs} +1 -1
  780. package/dist/{options-nPxWnrya.mjs.map → options-BL4X94qY.mjs.map} +1 -1
  781. package/dist/options-Cq64Wx0O.d.mts +207 -0
  782. package/dist/options-Cq64Wx0O.d.mts.map +1 -0
  783. package/dist/page/index.d.mts +15 -4
  784. package/dist/page/index.d.mts.map +1 -1
  785. package/dist/page/index.mjs +16 -5
  786. package/dist/page/index.mjs.map +1 -1
  787. package/dist/parse-BFTPon-J.mjs +89 -0
  788. package/dist/parse-BFTPon-J.mjs.map +1 -0
  789. package/dist/passkey-config-Cg86_ISa.mjs +46 -0
  790. package/dist/passkey-config-Cg86_ISa.mjs.map +1 -0
  791. package/dist/{patterns-DsUZ4uxI.mjs → patterns-CqG5Ya3i.mjs} +54 -2
  792. package/dist/{patterns-DsUZ4uxI.mjs.map → patterns-CqG5Ya3i.mjs.map} +1 -1
  793. package/dist/{placeholder-CDPtkelt.d.mts → placeholder-D3cFCU9y.d.mts} +2 -1
  794. package/dist/{placeholder-CDPtkelt.d.mts.map → placeholder-D3cFCU9y.d.mts.map} +1 -1
  795. package/dist/placeholder-LqmHqvBw.mjs +143 -0
  796. package/dist/placeholder-LqmHqvBw.mjs.map +1 -0
  797. package/dist/plugin-types.d.mts +122 -0
  798. package/dist/plugin-types.d.mts.map +1 -0
  799. package/dist/plugin-types.mjs +1 -0
  800. package/dist/plugins/adapt-sandbox-entry.d.mts +20 -12
  801. package/dist/plugins/adapt-sandbox-entry.d.mts.map +1 -1
  802. package/dist/plugins/adapt-sandbox-entry.mjs +46 -23
  803. package/dist/plugins/adapt-sandbox-entry.mjs.map +1 -1
  804. package/dist/preview-C1LOEbWZ.mjs +107 -0
  805. package/dist/preview-C1LOEbWZ.mjs.map +1 -0
  806. package/dist/{public-url-B1AxbbbQ.mjs → public-url-CseXl9Fv.mjs} +39 -2
  807. package/dist/{public-url-B1AxbbbQ.mjs.map → public-url-CseXl9Fv.mjs.map} +1 -1
  808. package/dist/{query-8c_meo_K.mjs → query-axZmO6Tn.mjs} +23 -12
  809. package/dist/query-axZmO6Tn.mjs.map +1 -0
  810. package/dist/rate-limit-t5CVjCO6.mjs +120 -0
  811. package/dist/rate-limit-t5CVjCO6.mjs.map +1 -0
  812. package/dist/redirect-DGRsLO2I.mjs +17 -0
  813. package/dist/redirect-DGRsLO2I.mjs.map +1 -0
  814. package/dist/{redirect-C5H7VGIX.mjs → redirect-DkaDxq8e.mjs} +3 -3
  815. package/dist/{redirect-C5H7VGIX.mjs.map → redirect-DkaDxq8e.mjs.map} +1 -1
  816. package/dist/redirects-D1fdd68T.mjs +573 -0
  817. package/dist/redirects-D1fdd68T.mjs.map +1 -0
  818. package/dist/redirects-Dmj6KRU3.mjs +1141 -0
  819. package/dist/redirects-Dmj6KRU3.mjs.map +1 -0
  820. package/dist/{registry-Do34mz_P.mjs → registry-BnCeHYsf.mjs} +8 -300
  821. package/dist/registry-BnCeHYsf.mjs.map +1 -0
  822. package/dist/{request-cache-D4I69LeL.mjs → request-cache-dzCt8TZB.mjs} +1 -1
  823. package/dist/{request-cache-D4I69LeL.mjs.map → request-cache-dzCt8TZB.mjs.map} +1 -1
  824. package/dist/request-meta-CLCwSQOS.mjs +140 -0
  825. package/dist/request-meta-CLCwSQOS.mjs.map +1 -0
  826. package/dist/{runner-Iu3IZSDM.d.mts → runner-DcfZewkO.d.mts} +2 -2
  827. package/dist/{runner-Iu3IZSDM.d.mts.map → runner-DcfZewkO.d.mts.map} +1 -1
  828. package/dist/{runner-DIcU2UCC.mjs → runner-DdnQIwz_.mjs} +436 -187
  829. package/dist/runner-DdnQIwz_.mjs.map +1 -0
  830. package/dist/runtime.d.mts +10 -6
  831. package/dist/runtime.d.mts.map +1 -1
  832. package/dist/runtime.mjs +3 -3
  833. package/dist/schema-BmqagCwG.mjs +41 -0
  834. package/dist/schema-BmqagCwG.mjs.map +1 -0
  835. package/dist/search-CPrvO5u8.mjs +376 -0
  836. package/dist/search-CPrvO5u8.mjs.map +1 -0
  837. package/dist/{secrets-CZ8rxLX3.mjs → secrets-6pgZyq0K.mjs} +3 -3
  838. package/dist/{secrets-CZ8rxLX3.mjs.map → secrets-6pgZyq0K.mjs.map} +1 -1
  839. package/dist/sections-Cm-zb-gZ.mjs +346 -0
  840. package/dist/sections-Cm-zb-gZ.mjs.map +1 -0
  841. package/dist/seed/index.d.mts +2 -2
  842. package/dist/seed/index.mjs +19 -15
  843. package/dist/seo/index.d.mts +1 -1
  844. package/dist/seo-BoR4wCUh.mjs +86 -0
  845. package/dist/seo-BoR4wCUh.mjs.map +1 -0
  846. package/dist/seo-DRq9-EPP.mjs +130 -0
  847. package/dist/seo-DRq9-EPP.mjs.map +1 -0
  848. package/dist/service-vByySp-2.mjs +195 -0
  849. package/dist/service-vByySp-2.mjs.map +1 -0
  850. package/dist/settings-CBBj7HUd.mjs +51 -0
  851. package/dist/settings-CBBj7HUd.mjs.map +1 -0
  852. package/dist/settings-xQKsWnzQ.mjs +235 -0
  853. package/dist/settings-xQKsWnzQ.mjs.map +1 -0
  854. package/dist/setup-BGAJ2uXs.mjs +137 -0
  855. package/dist/setup-BGAJ2uXs.mjs.map +1 -0
  856. package/dist/setup-complete-C6ZCLhKo.mjs +26 -0
  857. package/dist/setup-complete-C6ZCLhKo.mjs.map +1 -0
  858. package/dist/setup-nonce-CY1gQiAU.mjs +25 -0
  859. package/dist/setup-nonce-CY1gQiAU.mjs.map +1 -0
  860. package/dist/site-url-D-M4Fd8O.mjs +13 -0
  861. package/dist/site-url-D-M4Fd8O.mjs.map +1 -0
  862. package/dist/slugify-Cjh1ssOZ.mjs +30 -0
  863. package/dist/slugify-Cjh1ssOZ.mjs.map +1 -0
  864. package/dist/ssrf-CTul4uQi.mjs +1 -0
  865. package/dist/ssrf-DzFN_qV-.mjs +332 -0
  866. package/dist/ssrf-DzFN_qV-.mjs.map +1 -0
  867. package/dist/storage/local.d.mts +1 -1
  868. package/dist/storage/local.mjs +1 -1
  869. package/dist/storage/s3.d.mts +1 -1
  870. package/dist/storage/s3.mjs +1 -1
  871. package/dist/{taxonomies-Bw76xAxo.mjs → taxonomies-Cn9UpaR2.mjs} +7 -7
  872. package/dist/{taxonomies-Bw76xAxo.mjs.map → taxonomies-Cn9UpaR2.mjs.map} +1 -1
  873. package/dist/taxonomies-Dc0mzlms.mjs +508 -0
  874. package/dist/taxonomies-Dc0mzlms.mjs.map +1 -0
  875. package/dist/{taxonomy-D6NvlKo8.mjs → taxonomy-wPfusMK9.mjs} +3 -3
  876. package/dist/{taxonomy-D6NvlKo8.mjs.map → taxonomy-wPfusMK9.mjs.map} +1 -1
  877. package/dist/{tokens-CyRDPVW2.mjs → tokens-DILYNZMi.mjs} +2 -2
  878. package/dist/{tokens-CyRDPVW2.mjs.map → tokens-DILYNZMi.mjs.map} +1 -1
  879. package/dist/{transaction-D44LBXvU.mjs → transaction-NQj4VJ7Z.mjs} +1 -1
  880. package/dist/{transaction-D44LBXvU.mjs.map → transaction-NQj4VJ7Z.mjs.map} +1 -1
  881. package/dist/{transport-DX_5rpsq.d.mts → transport-GeXlLscf.d.mts} +1 -1
  882. package/dist/{transport-DX_5rpsq.d.mts.map → transport-GeXlLscf.d.mts.map} +1 -1
  883. package/dist/{transport-xpzIjCIB.mjs → transport-fw-mKJzT.mjs} +1 -1
  884. package/dist/{transport-xpzIjCIB.mjs.map → transport-fw-mKJzT.mjs.map} +1 -1
  885. package/dist/trusted-proxy-CJhQIk65.mjs +51 -0
  886. package/dist/trusted-proxy-CJhQIk65.mjs.map +1 -0
  887. package/dist/{types-IjUrQMVe.d.mts → types-B05e2naf.d.mts} +151 -60
  888. package/dist/types-B05e2naf.d.mts.map +1 -0
  889. package/dist/{types-BTe41zL6.d.mts → types-BWhaSS7U.d.mts} +2 -71
  890. package/dist/types-BWhaSS7U.d.mts.map +1 -0
  891. package/dist/{types-BQx6ZXpR.d.mts → types-C1KKK4VP.d.mts} +3 -1
  892. package/dist/{types-BQx6ZXpR.d.mts.map → types-C1KKK4VP.d.mts.map} +1 -1
  893. package/dist/types-Cb2UCDJg.d.mts +345 -0
  894. package/dist/types-Cb2UCDJg.d.mts.map +1 -0
  895. package/dist/{types-BIgulNsW.mjs → types-CwXMEPRr.mjs} +10 -3
  896. package/dist/types-CwXMEPRr.mjs.map +1 -0
  897. package/dist/{types-B_CXXnzh.d.mts → types-CzvJd1ND.d.mts} +7 -1
  898. package/dist/{types-B_CXXnzh.d.mts.map → types-CzvJd1ND.d.mts.map} +1 -1
  899. package/dist/types-DFowNO60.d.mts +198 -0
  900. package/dist/types-DFowNO60.d.mts.map +1 -0
  901. package/dist/{types-56BKbld_.mjs → types-DSZl1Dsv.mjs} +1 -1
  902. package/dist/{types-56BKbld_.mjs.map → types-DSZl1Dsv.mjs.map} +1 -1
  903. package/dist/types-DW1l0gCv.d.mts +75 -0
  904. package/dist/types-DW1l0gCv.d.mts.map +1 -0
  905. package/dist/types-Db67HHlU.mjs +3 -0
  906. package/dist/{types-C-aFbqmA.d.mts → types-DmxPPXGf.d.mts} +1 -1
  907. package/dist/{types-C-aFbqmA.d.mts.map → types-DmxPPXGf.d.mts.map} +1 -1
  908. package/dist/{types-K-EkEQCI.mjs → types-Dz9CGX_d.mjs} +1 -1
  909. package/dist/{types-K-EkEQCI.mjs.map → types-Dz9CGX_d.mjs.map} +1 -1
  910. package/dist/user-Dr1bOCqS.mjs +155 -0
  911. package/dist/user-Dr1bOCqS.mjs.map +1 -0
  912. package/dist/utils-_F-rWBTN.mjs +286 -0
  913. package/dist/utils-_F-rWBTN.mjs.map +1 -0
  914. package/dist/{validate-CcVQQpmH.d.mts → validate-BpQGsmd7.d.mts} +5 -4
  915. package/dist/validate-BpQGsmd7.d.mts.map +1 -0
  916. package/dist/{validate-UK4Ja1uo.mjs → validate-DlFxcVVK.mjs} +3 -3
  917. package/dist/{validate-UK4Ja1uo.mjs.map → validate-DlFxcVVK.mjs.map} +1 -1
  918. package/dist/{validation-Vc5DQkJa.mjs → validation-BiFJqUp5.mjs} +6 -5
  919. package/dist/{validation-Vc5DQkJa.mjs.map → validation-BiFJqUp5.mjs.map} +1 -1
  920. package/dist/version-Dw7Z5PVU.mjs +7 -0
  921. package/dist/{version-JjSqv90m.mjs.map → version-Dw7Z5PVU.mjs.map} +1 -1
  922. package/dist/widgets-B9j_yzlk.mjs +106 -0
  923. package/dist/widgets-B9j_yzlk.mjs.map +1 -0
  924. package/dist/zod-generator-DSyz01KE.mjs +234 -0
  925. package/dist/zod-generator-DSyz01KE.mjs.map +1 -0
  926. package/locals.d.ts +1 -1
  927. package/package.json +37 -14
  928. package/src/api/handlers/content.ts +1 -0
  929. package/src/api/handlers/index.ts +7 -0
  930. package/src/api/handlers/marketplace.ts +27 -6
  931. package/src/api/handlers/menus.ts +157 -580
  932. package/src/api/handlers/plugins.ts +77 -31
  933. package/src/api/handlers/registry.ts +1086 -0
  934. package/src/api/openapi/document.ts +10 -4
  935. package/src/api/schemas/content.ts +1 -0
  936. package/src/api/schemas/menus.ts +27 -23
  937. package/src/api/schemas/settings.ts +41 -9
  938. package/src/api/types.ts +6 -0
  939. package/src/astro/integration/index.ts +1 -0
  940. package/src/astro/integration/route-naming.ts +19 -0
  941. package/src/astro/integration/routes.ts +25 -3
  942. package/src/astro/integration/runtime.ts +35 -8
  943. package/src/astro/middleware/auth.ts +8 -2
  944. package/src/astro/middleware/csp.ts +25 -3
  945. package/src/astro/middleware.ts +3 -0
  946. package/src/astro/routes/api/admin/plugins/[id]/enable.ts +10 -0
  947. package/src/astro/routes/api/admin/plugins/registry/install.ts +107 -0
  948. package/src/astro/routes/api/auth/invite/register-options.ts +8 -1
  949. package/src/astro/routes/api/import/wordpress/execute.ts +185 -6
  950. package/src/astro/routes/api/media/[id].ts +2 -1
  951. package/src/astro/routes/api/menus/[name]/items/[id].ts +69 -0
  952. package/src/astro/routes/api/menus/[name]/items.ts +4 -65
  953. package/src/astro/types.ts +38 -0
  954. package/src/cli/wxr/parser.ts +263 -0
  955. package/src/client/index.ts +2 -1
  956. package/src/components/EmDashHead.astro +26 -5
  957. package/src/database/migrations/036_i18n_menus_and_taxonomies.ts +166 -49
  958. package/src/database/migrations/038_registry_plugin_state.ts +130 -0
  959. package/src/database/migrations/039_fix_fts5_triggers.ts +264 -0
  960. package/src/database/migrations/runner.ts +4 -0
  961. package/src/database/repositories/content.ts +5 -1
  962. package/src/database/repositories/index.ts +14 -0
  963. package/src/database/repositories/menu.ts +644 -0
  964. package/src/database/repositories/types.ts +6 -0
  965. package/src/database/types.ts +5 -1
  966. package/src/emdash-runtime.ts +143 -36
  967. package/src/import/sources/wordpress-plugin.ts +9 -2
  968. package/src/import/sources/wxr.ts +16 -2
  969. package/src/import/ssrf.ts +20 -500
  970. package/src/import/wxr-taxonomies.ts +730 -0
  971. package/src/index.ts +3 -10
  972. package/src/media/local-runtime.ts +7 -0
  973. package/src/media/normalize.ts +37 -4
  974. package/src/page/absolute-url.ts +146 -0
  975. package/src/page/jsonld.ts +10 -2
  976. package/src/page/seo-contributions.ts +17 -6
  977. package/src/plugin-types.ts +240 -0
  978. package/src/plugins/adapt-sandbox-entry.ts +115 -39
  979. package/src/plugins/context.ts +11 -1
  980. package/src/plugins/define-plugin.ts +34 -56
  981. package/src/plugins/index.ts +1 -9
  982. package/src/plugins/marketplace.ts +63 -4
  983. package/src/plugins/sandbox/index.ts +1 -1
  984. package/src/plugins/sandbox/noop.ts +2 -2
  985. package/src/plugins/sandbox/types.ts +7 -4
  986. package/src/plugins/state.ts +84 -38
  987. package/src/plugins/types.ts +2 -79
  988. package/src/query.ts +12 -0
  989. package/src/registry/config.ts +311 -0
  990. package/src/registry/plugin-id.ts +116 -0
  991. package/src/registry/types.ts +206 -0
  992. package/src/search/fts-manager.ts +77 -15
  993. package/src/security/ssrf.ts +501 -0
  994. package/src/settings/index.ts +20 -1
  995. package/src/settings/types.ts +12 -8
  996. package/dist/apply-Ded_1vng.mjs.map +0 -1
  997. package/dist/content-CERxPUN0.mjs.map +0 -1
  998. package/dist/error-DqnRMM5z.mjs +0 -27
  999. package/dist/error-DqnRMM5z.mjs.map +0 -1
  1000. package/dist/index-BogfvE-z.d.mts.map +0 -1
  1001. package/dist/placeholder-Ci0RLeCk.mjs +0 -268
  1002. package/dist/placeholder-Ci0RLeCk.mjs.map +0 -1
  1003. package/dist/query-8c_meo_K.mjs.map +0 -1
  1004. package/dist/registry-Do34mz_P.mjs.map +0 -1
  1005. package/dist/runner-DIcU2UCC.mjs.map +0 -1
  1006. package/dist/search-DuWhx4NG.mjs +0 -9897
  1007. package/dist/search-DuWhx4NG.mjs.map +0 -1
  1008. package/dist/types-BIgulNsW.mjs.map +0 -1
  1009. package/dist/types-BTe41zL6.d.mts.map +0 -1
  1010. package/dist/types-DiI8NOG_.mjs +0 -16
  1011. package/dist/types-DiI8NOG_.mjs.map +0 -1
  1012. package/dist/types-IjUrQMVe.d.mts.map +0 -1
  1013. package/dist/validate-CcVQQpmH.d.mts.map +0 -1
  1014. package/dist/version-JjSqv90m.mjs +0 -7
  1015. package/dist/zod-generator-CHnJUP2l.mjs +0 -137
  1016. package/dist/zod-generator-CHnJUP2l.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry-BnCeHYsf.mjs","names":[],"sources":["../src/schema/registry.ts"],"sourcesContent":["import type { Kysely } from \"kysely\";\nimport type { Selectable } from \"kysely\";\nimport { sql } from \"kysely\";\nimport { ulid } from \"ulidx\";\n\nimport { currentTimestamp, listTablesLike, tableExists } from \"../database/dialect-helpers.js\";\nimport { withTransaction } from \"../database/transaction.js\";\nimport type { CollectionTable, Database, FieldTable } from \"../database/types.js\";\nimport { validateIdentifier } from \"../database/validate.js\";\nimport { FTSManager } from \"../search/fts-manager.js\";\nimport { chunks, SQL_BATCH_SIZE } from \"../utils/chunks.js\";\nimport {\n\ttype Collection,\n\ttype CollectionSource,\n\ttype CollectionSupport,\n\ttype ColumnType,\n\ttype Field,\n\ttype CreateCollectionInput,\n\ttype UpdateCollectionInput,\n\ttype CreateFieldInput,\n\ttype UpdateFieldInput,\n\ttype CollectionWithFields,\n\ttype FieldType,\n\tFIELD_TYPE_TO_COLUMN,\n\tRESERVED_FIELD_SLUGS,\n\tRESERVED_COLLECTION_SLUGS,\n} from \"./types.js\";\n\n// Regex patterns for schema registry\nconst SLUG_VALIDATION_PATTERN = /^[a-z][a-z0-9_]*$/;\nconst EC_PREFIX_PATTERN = /^ec_/;\nconst SINGLE_QUOTE_PATTERN = /'/g;\nconst UNDERSCORE_PATTERN = /_/g;\nconst WORD_BOUNDARY_PATTERN = /\\b\\w/g;\n\n/** Valid column types for runtime validation */\nconst COLUMN_TYPES: ReadonlySet<string> = new Set([\"TEXT\", \"REAL\", \"INTEGER\", \"JSON\"]);\n\n/** Valid collection source prefixes/values */\nconst VALID_SOURCES: ReadonlySet<string> = new Set([\"manual\", \"discovered\", \"seed\"]);\n\nfunction isCollectionSource(value: string): value is CollectionSource {\n\treturn VALID_SOURCES.has(value) || value.startsWith(\"template:\") || value.startsWith(\"import:\");\n}\n\nfunction isFieldType(value: string): value is FieldType {\n\treturn value in FIELD_TYPE_TO_COLUMN;\n}\n\nfunction isColumnType(value: string): value is ColumnType {\n\treturn COLUMN_TYPES.has(value);\n}\n\nconst VALID_COLLECTION_SUPPORTS: ReadonlySet<string> = new Set<CollectionSupport>([\n\t\"drafts\",\n\t\"revisions\",\n\t\"preview\",\n\t\"scheduling\",\n\t\"search\",\n\t\"seo\",\n]);\n\nfunction isCollectionSupport(value: unknown): value is CollectionSupport {\n\treturn typeof value === \"string\" && VALID_COLLECTION_SUPPORTS.has(value);\n}\n\n/**\n * Parse a collection's `supports` column (stored as a JSON array of\n * CollectionSupport keys). Unknown/invalid entries are filtered out so the\n * runtime value matches the declared `CollectionSupport[]` type.\n *\n * Throws on malformed JSON so corruption surfaces loudly; returns an empty\n * array only for explicitly null/empty values or non-array JSON.\n */\nfunction parseSupports(raw: string | null | undefined): CollectionSupport[] {\n\tif (!raw) return [];\n\tconst parsed: unknown = JSON.parse(raw);\n\tif (!Array.isArray(parsed)) return [];\n\treturn parsed.filter(isCollectionSupport);\n}\n\n/**\n * Error thrown when a schema operation fails\n */\nexport class SchemaError extends Error {\n\tconstructor(\n\t\tmessage: string,\n\t\tpublic code: string,\n\t\tpublic details?: Record<string, unknown>,\n\t) {\n\t\tsuper(message);\n\t\tthis.name = \"SchemaError\";\n\t}\n}\n\n/**\n * Schema Registry\n *\n * Manages collection and field definitions stored in D1.\n * Handles runtime DDL operations (CREATE TABLE, ALTER TABLE).\n */\nexport class SchemaRegistry {\n\tconstructor(private db: Kysely<Database>) {}\n\n\t// ============================================\n\t// Collection Operations\n\t// ============================================\n\n\t/**\n\t * List all collections\n\t */\n\tasync listCollections(): Promise<Collection[]> {\n\t\tconst rows = await this.db\n\t\t\t.selectFrom(\"_emdash_collections\")\n\t\t\t.selectAll()\n\t\t\t.orderBy(\"slug\", \"asc\")\n\t\t\t.execute();\n\n\t\treturn rows.map(this.mapCollectionRow);\n\t}\n\n\t/**\n\t * Get a collection by slug\n\t */\n\tasync getCollection(slug: string): Promise<Collection | null> {\n\t\tconst row = await this.db\n\t\t\t.selectFrom(\"_emdash_collections\")\n\t\t\t.where(\"slug\", \"=\", slug)\n\t\t\t.selectAll()\n\t\t\t.executeTakeFirst();\n\n\t\treturn row ? this.mapCollectionRow(row) : null;\n\t}\n\n\t/**\n\t * Get a collection with all its fields\n\t */\n\tasync getCollectionWithFields(slug: string): Promise<CollectionWithFields | null> {\n\t\tconst collection = await this.getCollection(slug);\n\t\tif (!collection) return null;\n\n\t\tconst fields = await this.listFields(collection.id);\n\n\t\treturn { ...collection, fields };\n\t}\n\n\t/**\n\t * List every collection together with its fields in O(1) query shapes\n\t * — one for collections, then one batched query for the fields of every\n\t * returned collection — instead of the N+1 pattern of `listCollections`\n\t * + per-collection `listFields`. The fields query is chunked at\n\t * `SQL_BATCH_SIZE` to stay under D1's bound-parameter limit, so on\n\t * sites with more than `SQL_BATCH_SIZE` collections the field fetch\n\t * becomes `ceil(collectionCount / SQL_BATCH_SIZE)` queries — still\n\t * a constant factor, not N+1. Typical sites have well under\n\t * `SQL_BATCH_SIZE` collections, so this is two queries in practice.\n\t *\n\t * Used by the manifest build, which previously paid N+1 round-trips on\n\t * every admin request. Each round-trip costs ~80–150ms against the D1\n\t * primary on a busy link, so a 10-collection site spent ~1 s rebuilding\n\t * a manifest that is now built fresh per admin request (no cache).\n\t */\n\tasync listCollectionsWithFields(): Promise<CollectionWithFields[]> {\n\t\tconst collectionRows = await this.db\n\t\t\t.selectFrom(\"_emdash_collections\")\n\t\t\t.selectAll()\n\t\t\t.orderBy(\"slug\", \"asc\")\n\t\t\t.execute();\n\n\t\tif (collectionRows.length === 0) return [];\n\n\t\tconst fieldsByCollection = new Map<string, Field[]>();\n\t\t// Chunk to stay under D1's bound-parameter limit. Typical sites have\n\t\t// well under SQL_BATCH_SIZE collections, so this is a single query\n\t\t// in practice; on larger sites it becomes a small constant number\n\t\t// of queries, never N+1.\n\t\tfor (const idChunk of chunks(\n\t\t\tcollectionRows.map((c) => c.id),\n\t\t\tSQL_BATCH_SIZE,\n\t\t)) {\n\t\t\tconst fieldRows = await this.db\n\t\t\t\t.selectFrom(\"_emdash_fields\")\n\t\t\t\t.where(\"collection_id\", \"in\", idChunk)\n\t\t\t\t.selectAll()\n\t\t\t\t.orderBy(\"collection_id\", \"asc\")\n\t\t\t\t.orderBy(\"sort_order\", \"asc\")\n\t\t\t\t.orderBy(\"created_at\", \"asc\")\n\t\t\t\t.execute();\n\t\t\tfor (const row of fieldRows) {\n\t\t\t\tconst list = fieldsByCollection.get(row.collection_id) ?? [];\n\t\t\t\tlist.push(this.mapFieldRow(row));\n\t\t\t\tfieldsByCollection.set(row.collection_id, list);\n\t\t\t}\n\t\t}\n\n\t\treturn collectionRows.map((c) => ({\n\t\t\t...this.mapCollectionRow(c),\n\t\t\tfields: fieldsByCollection.get(c.id) ?? [],\n\t\t}));\n\t}\n\n\t/**\n\t * Create a new collection\n\t */\n\tasync createCollection(input: CreateCollectionInput): Promise<Collection> {\n\t\t// Validate slug\n\t\tthis.validateSlug(input.slug, \"collection\");\n\t\tif (RESERVED_COLLECTION_SLUGS.includes(input.slug)) {\n\t\t\tthrow new SchemaError(`Collection slug \"${input.slug}\" is reserved`, \"RESERVED_SLUG\");\n\t\t}\n\n\t\t// Check if collection already exists\n\t\tconst existing = await this.getCollection(input.slug);\n\t\tif (existing) {\n\t\t\tthrow new SchemaError(`Collection \"${input.slug}\" already exists`, \"COLLECTION_EXISTS\");\n\t\t}\n\n\t\tconst id = ulid();\n\n\t\t// Default `supports` to drafts + revisions when the caller didn't\n\t\t// specify it. Explicit empty array (`[]`) is preserved as an opt-out\n\t\t// — only `undefined` triggers the default. This is the canonical\n\t\t// default for new collections; the MCP and admin UI layers used to\n\t\t// duplicate this default but now defer to the registry.\n\t\tconst supports = input.supports ?? [\"drafts\", \"revisions\"];\n\n\t\t// Insert collection record and create content table in a transaction\n\t\t// so a failure in table creation doesn't leave an orphaned row.\n\t\t// Uses withTransaction for D1 compatibility (no transaction support).\n\t\t// Derive hasSeo from supports array if not explicitly set\n\t\tconst hasSeo = input.hasSeo ?? supports.includes(\"seo\") ?? false;\n\n\t\tawait withTransaction(this.db, async (trx) => {\n\t\t\tawait trx\n\t\t\t\t.insertInto(\"_emdash_collections\")\n\t\t\t\t.values({\n\t\t\t\t\tid,\n\t\t\t\t\tslug: input.slug,\n\t\t\t\t\tlabel: input.label,\n\t\t\t\t\tlabel_singular: input.labelSingular ?? null,\n\t\t\t\t\tdescription: input.description ?? null,\n\t\t\t\t\ticon: input.icon ?? null,\n\t\t\t\t\tsupports: JSON.stringify(supports),\n\t\t\t\t\tsource: input.source ?? \"manual\",\n\t\t\t\t\thas_seo: hasSeo ? 1 : 0,\n\t\t\t\t\tcomments_enabled: input.commentsEnabled ? 1 : 0,\n\t\t\t\t\turl_pattern: input.urlPattern ?? null,\n\t\t\t\t})\n\t\t\t\t.execute();\n\n\t\t\t// Create the content table for this collection\n\t\t\tawait this.createContentTable(input.slug, trx);\n\t\t});\n\n\t\tconst collection = await this.getCollection(input.slug);\n\t\tif (!collection) {\n\t\t\tthrow new SchemaError(\"Failed to create collection\", \"CREATE_FAILED\");\n\t\t}\n\n\t\treturn collection;\n\t}\n\n\t/**\n\t * Update a collection\n\t */\n\tasync updateCollection(slug: string, input: UpdateCollectionInput): Promise<Collection> {\n\t\tconst existing = await this.getCollection(slug);\n\t\tif (!existing) {\n\t\t\tthrow new SchemaError(`Collection \"${slug}\" not found`, \"COLLECTION_NOT_FOUND\");\n\t\t}\n\n\t\tconst now = new Date().toISOString();\n\n\t\t// Derive hasSeo from supports array if supports is being updated and hasSeo not explicitly set\n\t\tconst supportsArray = input.supports ?? existing.supports;\n\t\tconst hasSeo =\n\t\t\tinput.hasSeo !== undefined\n\t\t\t\t? input.hasSeo\n\t\t\t\t: input.supports !== undefined\n\t\t\t\t\t? supportsArray.includes(\"seo\")\n\t\t\t\t\t: existing.hasSeo;\n\n\t\treturn withTransaction(this.db, async (trx) => {\n\t\t\tawait trx\n\t\t\t\t.updateTable(\"_emdash_collections\")\n\t\t\t\t.set({\n\t\t\t\t\tlabel: input.label ?? existing.label,\n\t\t\t\t\tlabel_singular: input.labelSingular ?? existing.labelSingular ?? null,\n\t\t\t\t\tdescription: input.description ?? existing.description ?? null,\n\t\t\t\t\ticon: input.icon ?? existing.icon ?? null,\n\t\t\t\t\tsupports: input.supports\n\t\t\t\t\t\t? JSON.stringify(input.supports)\n\t\t\t\t\t\t: JSON.stringify(existing.supports),\n\t\t\t\t\turl_pattern:\n\t\t\t\t\t\tinput.urlPattern !== undefined\n\t\t\t\t\t\t\t? (input.urlPattern ?? null)\n\t\t\t\t\t\t\t: (existing.urlPattern ?? null),\n\t\t\t\t\thas_seo: hasSeo ? 1 : 0,\n\t\t\t\t\tcomments_enabled:\n\t\t\t\t\t\tinput.commentsEnabled !== undefined\n\t\t\t\t\t\t\t? input.commentsEnabled\n\t\t\t\t\t\t\t\t? 1\n\t\t\t\t\t\t\t\t: 0\n\t\t\t\t\t\t\t: existing.commentsEnabled\n\t\t\t\t\t\t\t\t? 1\n\t\t\t\t\t\t\t\t: 0,\n\t\t\t\t\tcomments_moderation: input.commentsModeration ?? existing.commentsModeration,\n\t\t\t\t\tcomments_closed_after_days:\n\t\t\t\t\t\tinput.commentsClosedAfterDays !== undefined\n\t\t\t\t\t\t\t? input.commentsClosedAfterDays\n\t\t\t\t\t\t\t: existing.commentsClosedAfterDays,\n\t\t\t\t\tcomments_auto_approve_users:\n\t\t\t\t\t\tinput.commentsAutoApproveUsers !== undefined\n\t\t\t\t\t\t\t? input.commentsAutoApproveUsers\n\t\t\t\t\t\t\t\t? 1\n\t\t\t\t\t\t\t\t: 0\n\t\t\t\t\t\t\t: existing.commentsAutoApproveUsers\n\t\t\t\t\t\t\t\t? 1\n\t\t\t\t\t\t\t\t: 0,\n\t\t\t\t\tupdated_at: now,\n\t\t\t\t})\n\t\t\t\t.where(\"slug\", \"=\", slug)\n\t\t\t\t.execute();\n\n\t\t\tconst row = await trx\n\t\t\t\t.selectFrom(\"_emdash_collections\")\n\t\t\t\t.where(\"slug\", \"=\", slug)\n\t\t\t\t.selectAll()\n\t\t\t\t.executeTakeFirst();\n\n\t\t\tif (!row) {\n\t\t\t\tthrow new SchemaError(\"Failed to update collection\", \"UPDATE_FAILED\");\n\t\t\t}\n\n\t\t\t// Sync FTS state when the supports array changes (e.g. search toggled on/off)\n\t\t\tif (input.supports !== undefined) {\n\t\t\t\tconst hadSearch = existing.supports.includes(\"search\");\n\t\t\t\tconst hasSearch = parseSupports(row.supports).includes(\"search\");\n\t\t\t\tif (hadSearch !== hasSearch) {\n\t\t\t\t\tawait this.syncSearchState(slug, trx);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn this.mapCollectionRow(row);\n\t\t});\n\t}\n\n\t/**\n\t * Delete a collection\n\t */\n\tasync deleteCollection(slug: string, options?: { force?: boolean }): Promise<void> {\n\t\tconst existing = await this.getCollection(slug);\n\t\tif (!existing) {\n\t\t\tthrow new SchemaError(`Collection \"${slug}\" not found`, \"COLLECTION_NOT_FOUND\");\n\t\t}\n\n\t\t// Check if collection has content\n\t\tif (!options?.force) {\n\t\t\tconst hasContent = await this.collectionHasContent(slug);\n\t\t\tif (hasContent) {\n\t\t\t\tthrow new SchemaError(\n\t\t\t\t\t`Collection \"${slug}\" has content. Use force: true to delete.`,\n\t\t\t\t\t\"COLLECTION_HAS_CONTENT\",\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tawait withTransaction(this.db, async (trx) => {\n\t\t\t// Drop FTS table and triggers before dropping the content table\n\t\t\tconst ftsManager = new FTSManager(trx);\n\t\t\tawait ftsManager.dropFtsTable(slug);\n\n\t\t\t// Drop the content table\n\t\t\tconst tableName = this.getTableName(slug);\n\t\t\tawait sql`DROP TABLE IF EXISTS ${sql.ref(tableName)}`.execute(trx);\n\n\t\t\t// Delete the collection record (fields will cascade)\n\t\t\tawait trx.deleteFrom(\"_emdash_collections\").where(\"id\", \"=\", existing.id).execute();\n\t\t});\n\t}\n\n\t// ============================================\n\t// Field Operations\n\t// ============================================\n\n\t/**\n\t * List fields for a collection\n\t */\n\tasync listFields(collectionId: string): Promise<Field[]> {\n\t\tconst rows = await this.db\n\t\t\t.selectFrom(\"_emdash_fields\")\n\t\t\t.where(\"collection_id\", \"=\", collectionId)\n\t\t\t.selectAll()\n\t\t\t.orderBy(\"sort_order\", \"asc\")\n\t\t\t.orderBy(\"created_at\", \"asc\")\n\t\t\t.execute();\n\n\t\treturn rows.map(this.mapFieldRow);\n\t}\n\n\t/**\n\t * Get a field by slug within a collection\n\t */\n\tasync getField(collectionSlug: string, fieldSlug: string): Promise<Field | null> {\n\t\tconst collection = await this.getCollection(collectionSlug);\n\t\tif (!collection) return null;\n\n\t\tconst row = await this.db\n\t\t\t.selectFrom(\"_emdash_fields\")\n\t\t\t.where(\"collection_id\", \"=\", collection.id)\n\t\t\t.where(\"slug\", \"=\", fieldSlug)\n\t\t\t.selectAll()\n\t\t\t.executeTakeFirst();\n\n\t\treturn row ? this.mapFieldRow(row) : null;\n\t}\n\n\t/**\n\t * Create a new field\n\t */\n\tasync createField(collectionSlug: string, input: CreateFieldInput): Promise<Field> {\n\t\tconst collection = await this.getCollection(collectionSlug);\n\t\tif (!collection) {\n\t\t\tthrow new SchemaError(`Collection \"${collectionSlug}\" not found`, \"COLLECTION_NOT_FOUND\");\n\t\t}\n\n\t\t// Validate slug\n\t\tthis.validateSlug(input.slug, \"field\");\n\t\tif (RESERVED_FIELD_SLUGS.includes(input.slug)) {\n\t\t\tthrow new SchemaError(`Field slug \"${input.slug}\" is reserved`, \"RESERVED_SLUG\");\n\t\t}\n\n\t\t// Check if field already exists\n\t\tconst existing = await this.getField(collectionSlug, input.slug);\n\t\tif (existing) {\n\t\t\tthrow new SchemaError(\n\t\t\t\t`Field \"${input.slug}\" already exists in collection \"${collectionSlug}\"`,\n\t\t\t\t\"FIELD_EXISTS\",\n\t\t\t);\n\t\t}\n\n\t\tconst id = ulid();\n\t\tconst columnType = FIELD_TYPE_TO_COLUMN[input.type];\n\n\t\t// Get max sort order\n\t\tconst maxSort = await this.db\n\t\t\t.selectFrom(\"_emdash_fields\")\n\t\t\t.where(\"collection_id\", \"=\", collection.id)\n\t\t\t.select((eb) => eb.fn.max<number>(\"sort_order\").as(\"max\"))\n\t\t\t.executeTakeFirst();\n\n\t\tconst sortOrder = input.sortOrder ?? (maxSort?.max ?? -1) + 1;\n\n\t\treturn withTransaction(this.db, async (trx) => {\n\t\t\t// Insert field record\n\t\t\tawait trx\n\t\t\t\t.insertInto(\"_emdash_fields\")\n\t\t\t\t.values({\n\t\t\t\t\tid,\n\t\t\t\t\tcollection_id: collection.id,\n\t\t\t\t\tslug: input.slug,\n\t\t\t\t\tlabel: input.label,\n\t\t\t\t\ttype: input.type,\n\t\t\t\t\tcolumn_type: columnType,\n\t\t\t\t\trequired: input.required ? 1 : 0,\n\t\t\t\t\tunique: input.unique ? 1 : 0,\n\t\t\t\t\tdefault_value:\n\t\t\t\t\t\tinput.defaultValue !== undefined ? JSON.stringify(input.defaultValue) : null,\n\t\t\t\t\tvalidation: input.validation ? JSON.stringify(input.validation) : null,\n\t\t\t\t\twidget: input.widget ?? null,\n\t\t\t\t\toptions: input.options ? JSON.stringify(input.options) : null,\n\t\t\t\t\tsort_order: sortOrder,\n\t\t\t\t\tsearchable: input.searchable ? 1 : 0,\n\t\t\t\t\ttranslatable: input.translatable === false ? 0 : 1,\n\t\t\t\t})\n\t\t\t\t.execute();\n\n\t\t\t// Add column to content table — pass trx to stay on the same connection\n\t\t\tawait this.addColumn(\n\t\t\t\tcollectionSlug,\n\t\t\t\tinput.slug,\n\t\t\t\tinput.type,\n\t\t\t\t{\n\t\t\t\t\trequired: input.required,\n\t\t\t\t\tdefaultValue: input.defaultValue,\n\t\t\t\t},\n\t\t\t\ttrx,\n\t\t\t);\n\n\t\t\t// Read the created field via trx (not this.db) to avoid connection mutex deadlock\n\t\t\tconst fieldRow = await trx\n\t\t\t\t.selectFrom(\"_emdash_fields\")\n\t\t\t\t.where(\"collection_id\", \"=\", collection.id)\n\t\t\t\t.where(\"slug\", \"=\", input.slug)\n\t\t\t\t.selectAll()\n\t\t\t\t.executeTakeFirst();\n\n\t\t\tif (!fieldRow) {\n\t\t\t\tthrow new SchemaError(\"Failed to create field\", \"CREATE_FAILED\");\n\t\t\t}\n\n\t\t\tconst field = this.mapFieldRow(fieldRow);\n\n\t\t\t// Sync search state if this field is searchable; support checks are handled by syncSearchState()\n\t\t\tif (input.searchable) {\n\t\t\t\tawait this.syncSearchState(collectionSlug, trx);\n\t\t\t}\n\n\t\t\treturn field;\n\t\t});\n\t}\n\n\t/**\n\t * Update a field\n\t */\n\tasync updateField(\n\t\tcollectionSlug: string,\n\t\tfieldSlug: string,\n\t\tinput: UpdateFieldInput,\n\t): Promise<Field> {\n\t\tconst field = await this.getField(collectionSlug, fieldSlug);\n\t\tif (!field) {\n\t\t\tthrow new SchemaError(\n\t\t\t\t`Field \"${fieldSlug}\" not found in collection \"${collectionSlug}\"`,\n\t\t\t\t\"FIELD_NOT_FOUND\",\n\t\t\t);\n\t\t}\n\n\t\t// `input.validation === undefined` means \"no change\" (keep existing);\n\t\t// an explicit `null` clears the column.\n\t\tconst nextValidation = input.validation === undefined ? field.validation : input.validation;\n\n\t\treturn withTransaction(this.db, async (trx) => {\n\t\t\tawait trx\n\t\t\t\t.updateTable(\"_emdash_fields\")\n\t\t\t\t.set({\n\t\t\t\t\tlabel: input.label ?? field.label,\n\t\t\t\t\trequired:\n\t\t\t\t\t\tinput.required !== undefined ? (input.required ? 1 : 0) : field.required ? 1 : 0,\n\t\t\t\t\tunique: input.unique !== undefined ? (input.unique ? 1 : 0) : field.unique ? 1 : 0,\n\t\t\t\t\tsearchable:\n\t\t\t\t\t\tinput.searchable !== undefined ? (input.searchable ? 1 : 0) : field.searchable ? 1 : 0,\n\t\t\t\t\ttranslatable:\n\t\t\t\t\t\tinput.translatable !== undefined\n\t\t\t\t\t\t\t? input.translatable\n\t\t\t\t\t\t\t\t? 1\n\t\t\t\t\t\t\t\t: 0\n\t\t\t\t\t\t\t: field.translatable\n\t\t\t\t\t\t\t\t? 1\n\t\t\t\t\t\t\t\t: 0,\n\t\t\t\t\tdefault_value:\n\t\t\t\t\t\tinput.defaultValue !== undefined\n\t\t\t\t\t\t\t? JSON.stringify(input.defaultValue)\n\t\t\t\t\t\t\t: field.defaultValue !== undefined\n\t\t\t\t\t\t\t\t? JSON.stringify(field.defaultValue)\n\t\t\t\t\t\t\t\t: null,\n\t\t\t\t\tvalidation: nextValidation ? JSON.stringify(nextValidation) : null,\n\t\t\t\t\twidget: input.widget ?? field.widget ?? null,\n\t\t\t\t\toptions: input.options\n\t\t\t\t\t\t? JSON.stringify(input.options)\n\t\t\t\t\t\t: field.options\n\t\t\t\t\t\t\t? JSON.stringify(field.options)\n\t\t\t\t\t\t\t: null,\n\t\t\t\t\tsort_order: input.sortOrder ?? field.sortOrder,\n\t\t\t\t})\n\t\t\t\t.where(\"id\", \"=\", field.id)\n\t\t\t\t.execute();\n\n\t\t\t// Read the updated field via trx (not this.db) to avoid connection mutex deadlock\n\t\t\tconst updatedRow = await trx\n\t\t\t\t.selectFrom(\"_emdash_fields\")\n\t\t\t\t.where(\"collection_id\", \"=\", field.collectionId)\n\t\t\t\t.where(\"slug\", \"=\", fieldSlug)\n\t\t\t\t.selectAll()\n\t\t\t\t.executeTakeFirst();\n\n\t\t\tif (!updatedRow) {\n\t\t\t\tthrow new SchemaError(\"Failed to update field\", \"UPDATE_FAILED\");\n\t\t\t}\n\n\t\t\tconst updated = this.mapFieldRow(updatedRow);\n\n\t\t\t// If searchable changed, sync FTS state for this collection\n\t\t\tconst searchableChanged =\n\t\t\t\tinput.searchable !== undefined && input.searchable !== field.searchable;\n\t\t\tif (searchableChanged) {\n\t\t\t\tawait this.syncSearchState(collectionSlug, trx);\n\t\t\t}\n\n\t\t\treturn updated;\n\t\t});\n\t}\n\n\t/**\n\t * Synchronize an existing FTS index with the collection's current state.\n\t *\n\t * Only rebuilds or disables — never first-time enables. First-time FTS\n\t * enablement is handled by the seed's explicit enableSearch call (which\n\t * is try-caught) or the admin UI toggle.\n\t *\n\t * - FTS active + still has search support and searchable fields → rebuild\n\t * - FTS active + lost search support or no searchable fields → disable\n\t * - FTS not active → no-op\n\t *\n\t * Pass `db` when calling from within a transaction so FTS operations\n\t * participate in the same transaction and are rolled back on failure.\n\t */\n\tprivate async syncSearchState(collectionSlug: string, db?: Kysely<Database>): Promise<void> {\n\t\tconst conn = db ?? this.db;\n\t\tconst ftsManager = new FTSManager(conn);\n\n\t\t// Query via conn (not this.db) to avoid connection mutex deadlock when called inside a transaction\n\t\tconst row = await conn\n\t\t\t.selectFrom(\"_emdash_collections\")\n\t\t\t.where(\"slug\", \"=\", collectionSlug)\n\t\t\t.select(\"supports\")\n\t\t\t.executeTakeFirst();\n\t\tif (!row) return;\n\n\t\tconst wantsSearch = parseSupports(row.supports).includes(\"search\");\n\t\tconst searchableFields = await ftsManager.getSearchableFields(collectionSlug);\n\t\tconst config = await ftsManager.getSearchConfig(collectionSlug);\n\t\tconst ftsActive = config?.enabled === true;\n\n\t\tif (wantsSearch && searchableFields.length > 0 && ftsActive) {\n\t\t\tawait ftsManager.rebuildIndex(collectionSlug, searchableFields, config?.weights);\n\t\t} else if (ftsActive && (!wantsSearch || searchableFields.length === 0)) {\n\t\t\tawait ftsManager.disableSearch(collectionSlug);\n\t\t}\n\t}\n\n\t/**\n\t * Delete a field\n\t */\n\tasync deleteField(collectionSlug: string, fieldSlug: string): Promise<void> {\n\t\tconst field = await this.getField(collectionSlug, fieldSlug);\n\t\tif (!field) {\n\t\t\tthrow new SchemaError(\n\t\t\t\t`Field \"${fieldSlug}\" not found in collection \"${collectionSlug}\"`,\n\t\t\t\t\"FIELD_NOT_FOUND\",\n\t\t\t);\n\t\t}\n\n\t\tawait withTransaction(this.db, async (trx) => {\n\t\t\t// Delete the field record first so syncSearchState sees the updated field list.\n\t\t\t// This ordering matters for searchable fields: SQLite prevents dropping a column\n\t\t\t// that is still referenced by a trigger. syncSearchState drops and recreates the\n\t\t\t// FTS triggers based on the remaining searchable fields, clearing the dependency\n\t\t\t// before we attempt the ALTER TABLE DROP COLUMN below.\n\t\t\tawait trx.deleteFrom(\"_emdash_fields\").where(\"id\", \"=\", field.id).execute();\n\n\t\t\t// If the deleted field was searchable, sync FTS state (removes old triggers)\n\t\t\tif (field.searchable) {\n\t\t\t\tawait this.syncSearchState(collectionSlug, trx);\n\t\t\t}\n\n\t\t\t// Drop column from content table — safe now because FTS triggers are gone\n\t\t\tawait this.dropColumn(collectionSlug, fieldSlug, trx);\n\t\t});\n\t}\n\n\t/**\n\t * Reorder fields\n\t */\n\tasync reorderFields(collectionSlug: string, fieldSlugs: string[]): Promise<void> {\n\t\tconst collection = await this.getCollection(collectionSlug);\n\t\tif (!collection) {\n\t\t\tthrow new SchemaError(`Collection \"${collectionSlug}\" not found`, \"COLLECTION_NOT_FOUND\");\n\t\t}\n\n\t\t// Update sort_order for each field\n\t\tfor (let i = 0; i < fieldSlugs.length; i++) {\n\t\t\tawait this.db\n\t\t\t\t.updateTable(\"_emdash_fields\")\n\t\t\t\t.set({ sort_order: i })\n\t\t\t\t.where(\"collection_id\", \"=\", collection.id)\n\t\t\t\t.where(\"slug\", \"=\", fieldSlugs[i])\n\t\t\t\t.execute();\n\t\t}\n\t}\n\n\t// ============================================\n\t// DDL Operations\n\t// ============================================\n\n\t/**\n\t * Create a content table for a collection\n\t */\n\tprivate async createContentTable(slug: string, db?: Kysely<Database>): Promise<void> {\n\t\tconst conn = db ?? this.db;\n\t\tconst tableName = this.getTableName(slug);\n\n\t\tawait conn.schema\n\t\t\t.createTable(tableName)\n\t\t\t.addColumn(\"id\", \"text\", (col) => col.primaryKey())\n\t\t\t.addColumn(\"slug\", \"text\")\n\t\t\t.addColumn(\"status\", \"text\", (col) => col.defaultTo(\"draft\"))\n\t\t\t.addColumn(\"author_id\", \"text\")\n\t\t\t.addColumn(\"primary_byline_id\", \"text\")\n\t\t\t.addColumn(\"created_at\", \"text\", (col) => col.defaultTo(currentTimestamp(conn)))\n\t\t\t.addColumn(\"updated_at\", \"text\", (col) => col.defaultTo(currentTimestamp(conn)))\n\t\t\t.addColumn(\"published_at\", \"text\")\n\t\t\t.addColumn(\"scheduled_at\", \"text\")\n\t\t\t.addColumn(\"deleted_at\", \"text\")\n\t\t\t.addColumn(\"version\", \"integer\", (col) => col.defaultTo(1))\n\t\t\t.addColumn(\"live_revision_id\", \"text\", (col) => col.references(\"revisions.id\"))\n\t\t\t.addColumn(\"draft_revision_id\", \"text\", (col) => col.references(\"revisions.id\"))\n\t\t\t.addColumn(\"locale\", \"text\", (col) => col.notNull().defaultTo(\"en\"))\n\t\t\t.addColumn(\"translation_group\", \"text\")\n\t\t\t.addUniqueConstraint(`${tableName}_slug_locale_unique`, [\"slug\", \"locale\"])\n\t\t\t.execute();\n\n\t\t// Create standard indexes\n\t\tawait sql`\n\t\t\tCREATE INDEX ${sql.ref(`idx_${tableName}_slug`)}\n\t\t\tON ${sql.ref(tableName)} (slug)\n\t\t`.execute(conn);\n\n\t\tawait sql`\n\t\t\tCREATE INDEX ${sql.ref(`idx_${tableName}_scheduled`)}\n\t\t\tON ${sql.ref(tableName)} (scheduled_at)\n\t\t\tWHERE scheduled_at IS NOT NULL\n\t\t`.execute(conn);\n\n\t\tawait sql`\n\t\t\tCREATE INDEX ${sql.ref(`idx_${tableName}_live_revision`)}\n\t\t\tON ${sql.ref(tableName)} (live_revision_id)\n\t\t`.execute(conn);\n\n\t\tawait sql`\n\t\t\tCREATE INDEX ${sql.ref(`idx_${tableName}_draft_revision`)}\n\t\t\tON ${sql.ref(tableName)} (draft_revision_id)\n\t\t`.execute(conn);\n\n\t\tawait sql`\n\t\t\tCREATE INDEX ${sql.ref(`idx_${tableName}_author`)}\n\t\t\tON ${sql.ref(tableName)} (author_id)\n\t\t`.execute(conn);\n\n\t\tawait sql`\n\t\t\tCREATE INDEX ${sql.ref(`idx_${tableName}_primary_byline`)}\n\t\t\tON ${sql.ref(tableName)} (primary_byline_id)\n\t\t`.execute(conn);\n\n\t\tawait sql`\n\t\t\tCREATE INDEX ${sql.ref(`idx_${tableName}_locale`)}\n\t\t\tON ${sql.ref(tableName)} (locale)\n\t\t`.execute(conn);\n\n\t\tawait sql`\n\t\t\tCREATE INDEX ${sql.ref(`idx_${tableName}_translation_group`)}\n\t\t\tON ${sql.ref(tableName)} (translation_group)\n\t\t`.execute(conn);\n\n\t\t// Composite indexes for optimized query performance (see migration 033)\n\t\tawait sql`\n\t\t\tCREATE INDEX ${sql.ref(`idx_${tableName}_deleted_updated_id`)}\n\t\t\tON ${sql.ref(tableName)} (deleted_at, updated_at DESC, id DESC)\n\t\t`.execute(conn);\n\n\t\tawait sql`\n\t\t\tCREATE INDEX ${sql.ref(`idx_${tableName}_deleted_status`)}\n\t\t\tON ${sql.ref(tableName)} (deleted_at, status)\n\t\t`.execute(conn);\n\n\t\tawait sql`\n\t\t\tCREATE INDEX ${sql.ref(`idx_${tableName}_deleted_created_id`)}\n\t\t\tON ${sql.ref(tableName)} (deleted_at, created_at DESC, id DESC)\n\t\t`.execute(conn);\n\n\t\tawait sql`\n\t\t\tCREATE INDEX ${sql.ref(`idx_${tableName}_deleted_published_id`)}\n\t\t\tON ${sql.ref(tableName)} (deleted_at, published_at DESC, id DESC)\n\t\t`.execute(conn);\n\t}\n\n\t/**\n\t * Add a column to a content table\n\t */\n\tprivate async addColumn(\n\t\tcollectionSlug: string,\n\t\tfieldSlug: string,\n\t\tfieldType: FieldType,\n\t\toptions?: { required?: boolean; defaultValue?: unknown },\n\t\tdb?: Kysely<Database>,\n\t): Promise<void> {\n\t\tconst conn = db ?? this.db;\n\t\tconst tableName = this.getTableName(collectionSlug);\n\t\tconst columnType = FIELD_TYPE_TO_COLUMN[fieldType];\n\t\tconst columnName = this.getColumnName(fieldSlug);\n\n\t\t// Build ALTER TABLE statement\n\t\t// Note: SQLite requires DEFAULT for NOT NULL columns in ALTER TABLE\n\t\tif (options?.required && options?.defaultValue !== undefined) {\n\t\t\tconst defaultVal = this.formatDefaultValue(options.defaultValue, fieldType);\n\t\t\tawait sql`\n\t\t\t\tALTER TABLE ${sql.ref(tableName)}\n\t\t\t\tADD COLUMN ${sql.ref(columnName)} ${sql.raw(columnType)} NOT NULL DEFAULT ${sql.raw(defaultVal)}\n\t\t\t`.execute(conn);\n\t\t} else if (options?.required) {\n\t\t\t// For required fields without default, use empty string/0 as default\n\t\t\tconst defaultVal = this.getEmptyDefault(fieldType);\n\t\t\tawait sql`\n\t\t\t\tALTER TABLE ${sql.ref(tableName)}\n\t\t\t\tADD COLUMN ${sql.ref(columnName)} ${sql.raw(columnType)} NOT NULL DEFAULT ${sql.raw(defaultVal)}\n\t\t\t`.execute(conn);\n\t\t} else {\n\t\t\tawait sql`\n\t\t\t\tALTER TABLE ${sql.ref(tableName)}\n\t\t\t\tADD COLUMN ${sql.ref(columnName)} ${sql.raw(columnType)}\n\t\t\t`.execute(conn);\n\t\t}\n\t}\n\n\t/**\n\t * Drop a column from a content table\n\t */\n\tprivate async dropColumn(\n\t\tcollectionSlug: string,\n\t\tfieldSlug: string,\n\t\tdb?: Kysely<Database>,\n\t): Promise<void> {\n\t\tconst tableName = this.getTableName(collectionSlug);\n\t\tconst columnName = this.getColumnName(fieldSlug);\n\n\t\tawait sql`\n\t\t\tALTER TABLE ${sql.ref(tableName)}\n\t\t\tDROP COLUMN ${sql.ref(columnName)}\n\t\t`.execute(db ?? this.db);\n\t}\n\n\t// ============================================\n\t// Helpers\n\t// ============================================\n\n\t/**\n\t * Check if a collection has any content\n\t */\n\tprivate async collectionHasContent(slug: string): Promise<boolean> {\n\t\tconst tableName = this.getTableName(slug);\n\t\ttry {\n\t\t\tconst result = await sql<{ count: number }>`\n\t\t\t\tSELECT COUNT(*) as count FROM ${sql.ref(tableName)}\n\t\t\t\tWHERE deleted_at IS NULL\n\t\t\t`.execute(this.db);\n\t\t\treturn (result.rows[0]?.count ?? 0) > 0;\n\t\t} catch {\n\t\t\t// Table might not exist\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * Get table name for a collection\n\t */\n\tprivate getTableName(slug: string): string {\n\t\tvalidateIdentifier(slug, \"collection slug\");\n\t\treturn `ec_${slug}`;\n\t}\n\n\t/**\n\t * Get column name for a field\n\t */\n\tprivate getColumnName(slug: string): string {\n\t\tvalidateIdentifier(slug, \"field slug\");\n\t\treturn slug;\n\t}\n\n\t/**\n\t * Validate a slug\n\t */\n\tprivate validateSlug(slug: string, type: \"collection\" | \"field\"): void {\n\t\tif (!slug || typeof slug !== \"string\") {\n\t\t\tthrow new SchemaError(`${type} slug is required`, \"INVALID_SLUG\");\n\t\t}\n\n\t\tif (!SLUG_VALIDATION_PATTERN.test(slug)) {\n\t\t\tthrow new SchemaError(\n\t\t\t\t`${type} slug must start with a letter and contain only lowercase letters, numbers, and underscores`,\n\t\t\t\t\"INVALID_SLUG\",\n\t\t\t);\n\t\t}\n\n\t\tif (slug.length > 63) {\n\t\t\tthrow new SchemaError(`${type} slug must be 63 characters or less`, \"INVALID_SLUG\");\n\t\t}\n\t}\n\n\t/**\n\t * Format a default value for SQL.\n\t *\n\t * SQLite `ALTER TABLE ADD COLUMN ... DEFAULT` requires a literal constant\n\t * expression — parameterized values cannot be used here. We manually escape\n\t * single quotes and coerce types to ensure the output is safe.\n\t *\n\t * INTEGER/REAL values are coerced through `Number()` which can only produce\n\t * digits, `.`, `-`, `e`, `Infinity`, or `NaN` — all safe in SQL.\n\t * TEXT/JSON values have single quotes escaped via SQL standard doubling (`''`).\n\t */\n\tprivate formatDefaultValue(value: unknown, fieldType: FieldType): string {\n\t\tif (value === null || value === undefined) {\n\t\t\treturn \"NULL\";\n\t\t}\n\n\t\tconst columnType = FIELD_TYPE_TO_COLUMN[fieldType];\n\n\t\tif (columnType === \"JSON\") {\n\t\t\t// JSON.stringify produces valid JSON; escape single quotes for SQL literal\n\t\t\tconst json = JSON.stringify(value);\n\t\t\treturn `'${json.replace(SINGLE_QUOTE_PATTERN, \"''\")}'`;\n\t\t}\n\n\t\tif (columnType === \"INTEGER\") {\n\t\t\tif (typeof value === \"boolean\") {\n\t\t\t\treturn value ? \"1\" : \"0\";\n\t\t\t}\n\t\t\tconst num = Number(value);\n\t\t\tif (!Number.isFinite(num)) {\n\t\t\t\treturn \"0\";\n\t\t\t}\n\t\t\treturn String(Math.trunc(num));\n\t\t}\n\n\t\tif (columnType === \"REAL\") {\n\t\t\tconst num = Number(value);\n\t\t\tif (!Number.isFinite(num)) {\n\t\t\t\treturn \"0\";\n\t\t\t}\n\t\t\treturn String(num);\n\t\t}\n\n\t\t// TEXT — escape single quotes via SQL standard doubling\n\t\tlet text: string;\n\t\tif (typeof value === \"string\") {\n\t\t\ttext = value;\n\t\t} else if (typeof value === \"number\" || typeof value === \"boolean\") {\n\t\t\ttext = String(value);\n\t\t} else if (typeof value === \"object\" && value !== null) {\n\t\t\ttext = JSON.stringify(value);\n\t\t} else {\n\t\t\ttext = \"\";\n\t\t}\n\t\treturn `'${text.replace(SINGLE_QUOTE_PATTERN, \"''\")}'`;\n\t}\n\n\t/**\n\t * Get empty default for a field type\n\t */\n\tprivate getEmptyDefault(fieldType: FieldType): string {\n\t\tconst columnType = FIELD_TYPE_TO_COLUMN[fieldType];\n\n\t\tswitch (columnType) {\n\t\t\tcase \"INTEGER\":\n\t\t\t\treturn \"0\";\n\t\t\tcase \"REAL\":\n\t\t\t\treturn \"0.0\";\n\t\t\tcase \"JSON\":\n\t\t\t\treturn \"'null'\";\n\t\t\tdefault:\n\t\t\t\treturn \"''\";\n\t\t}\n\t}\n\n\t/**\n\t * Map a collection row to a Collection object\n\t */\n\tprivate mapCollectionRow = (row: Selectable<CollectionTable>): Collection => {\n\t\tconst moderation = row.comments_moderation;\n\t\treturn {\n\t\t\tid: row.id,\n\t\t\tslug: row.slug,\n\t\t\tlabel: row.label,\n\t\t\tlabelSingular: row.label_singular ?? undefined,\n\t\t\tdescription: row.description ?? undefined,\n\t\t\ticon: row.icon ?? undefined,\n\t\t\tsupports: parseSupports(row.supports),\n\t\t\tsource: row.source && isCollectionSource(row.source) ? row.source : undefined,\n\t\t\thasSeo: row.has_seo === 1,\n\t\t\turlPattern: row.url_pattern ?? undefined,\n\t\t\tcommentsEnabled: row.comments_enabled === 1,\n\t\t\tcommentsModeration:\n\t\t\t\tmoderation === \"all\" || moderation === \"first_time\" || moderation === \"none\"\n\t\t\t\t\t? moderation\n\t\t\t\t\t: \"first_time\",\n\t\t\tcommentsClosedAfterDays: row.comments_closed_after_days ?? 90,\n\t\t\tcommentsAutoApproveUsers: row.comments_auto_approve_users === 1,\n\t\t\tcreatedAt: row.created_at,\n\t\t\tupdatedAt: row.updated_at,\n\t\t};\n\t};\n\n\t/**\n\t * Map a field row to a Field object\n\t */\n\tprivate mapFieldRow = (row: Selectable<FieldTable>): Field => {\n\t\treturn {\n\t\t\tid: row.id,\n\t\t\tcollectionId: row.collection_id,\n\t\t\tslug: row.slug,\n\t\t\tlabel: row.label,\n\t\t\ttype: isFieldType(row.type) ? row.type : \"string\",\n\t\t\tcolumnType: isColumnType(row.column_type) ? row.column_type : \"TEXT\",\n\t\t\trequired: row.required === 1,\n\t\t\tunique: row.unique === 1,\n\t\t\tdefaultValue: row.default_value ? JSON.parse(row.default_value) : undefined,\n\t\t\tvalidation: row.validation ? JSON.parse(row.validation) : undefined,\n\t\t\twidget: row.widget ?? undefined,\n\t\t\toptions: row.options ? JSON.parse(row.options) : undefined,\n\t\t\tsortOrder: row.sort_order,\n\t\t\tsearchable: row.searchable === 1,\n\t\t\ttranslatable: row.translatable !== 0,\n\t\t\tcreatedAt: row.created_at,\n\t\t};\n\t};\n\n\t// ============================================\n\t// Discovery\n\t// ============================================\n\n\t/**\n\t * Discover orphaned content tables\n\t *\n\t * Finds ec_* tables that exist in the database but don't have a\n\t * corresponding entry in _emdash_collections.\n\t */\n\tasync discoverOrphanedTables(): Promise<\n\t\tArray<{ slug: string; tableName: string; rowCount: number }>\n\t> {\n\t\t// Get all ec_* tables\n\t\t// Content tables are ec_* (e.g., ec_posts, ec_pages)\n\t\t// Internal tables are _emdash_* (e.g., _emdash_collections, _emdash_fts_posts)\n\t\tconst allTables = await listTablesLike(this.db, \"ec_%\");\n\n\t\t// Get registered collections\n\t\tconst registered = await this.listCollections();\n\t\tconst registeredSlugs = new Set(registered.map((c) => c.slug));\n\n\t\t// Find orphans\n\t\tconst orphans: Array<{\n\t\t\tslug: string;\n\t\t\ttableName: string;\n\t\t\trowCount: number;\n\t\t}> = [];\n\n\t\tfor (const tableName of allTables) {\n\t\t\tconst slug = tableName.replace(EC_PREFIX_PATTERN, \"\");\n\n\t\t\tif (!registeredSlugs.has(slug)) {\n\t\t\t\t// Count rows in the orphaned table\n\t\t\t\ttry {\n\t\t\t\t\tconst countResult = await sql<{ count: number }>`\n\t\t\t\t\t\tSELECT COUNT(*) as count FROM ${sql.ref(tableName)}\n\t\t\t\t\t\tWHERE deleted_at IS NULL\n\t\t\t\t\t`.execute(this.db);\n\n\t\t\t\t\torphans.push({\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\ttableName,\n\t\t\t\t\t\trowCount: countResult.rows[0]?.count ?? 0,\n\t\t\t\t\t});\n\t\t\t\t} catch {\n\t\t\t\t\t// Table might have unexpected schema, still report it\n\t\t\t\t\torphans.push({\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\ttableName,\n\t\t\t\t\t\trowCount: 0,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn orphans;\n\t}\n\n\t/**\n\t * Register an orphaned table as a collection\n\t *\n\t * Creates a _emdash_collections entry for an existing ec_* table.\n\t */\n\tasync registerOrphanedTable(\n\t\tslug: string,\n\t\toptions?: {\n\t\t\tlabel?: string;\n\t\t\tlabelSingular?: string;\n\t\t\tdescription?: string;\n\t\t},\n\t): Promise<Collection> {\n\t\t// Verify table exists\n\t\tconst tableName = this.getTableName(slug);\n\t\tconst exists = await tableExists(this.db, tableName);\n\n\t\tif (!exists) {\n\t\t\tthrow new SchemaError(`Table \"${tableName}\" does not exist`, \"TABLE_NOT_FOUND\");\n\t\t}\n\n\t\t// Check if already registered\n\t\tconst existing = await this.getCollection(slug);\n\t\tif (existing) {\n\t\t\tthrow new SchemaError(`Collection \"${slug}\" is already registered`, \"COLLECTION_EXISTS\");\n\t\t}\n\n\t\t// Create collection entry\n\t\tconst id = ulid();\n\t\tconst label = options?.label || this.slugToLabel(slug);\n\n\t\tawait this.db\n\t\t\t.insertInto(\"_emdash_collections\")\n\t\t\t.values({\n\t\t\t\tid,\n\t\t\t\tslug,\n\t\t\t\tlabel,\n\t\t\t\tlabel_singular: options?.labelSingular ?? null,\n\t\t\t\tdescription: options?.description ?? null,\n\t\t\t\ticon: null,\n\t\t\t\tsupports: JSON.stringify([]),\n\t\t\t\tsource: \"discovered\",\n\t\t\t\thas_seo: 0,\n\t\t\t\turl_pattern: null,\n\t\t\t})\n\t\t\t.execute();\n\n\t\tconst collection = await this.getCollection(slug);\n\t\tif (!collection) {\n\t\t\tthrow new SchemaError(\"Failed to register orphaned table\", \"REGISTER_FAILED\");\n\t\t}\n\n\t\treturn collection;\n\t}\n\n\t/**\n\t * Convert slug to human-readable label\n\t */\n\tprivate slugToLabel(slug: string): string {\n\t\treturn slug\n\t\t\t.replace(UNDERSCORE_PATTERN, \" \")\n\t\t\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I,CAAC,WACJ,OAAM,IAAI,YAAY,qCAAqC,kBAAkB;AAG9E,SAAO;;;;;CAMR,AAAQ,YAAY,MAAsB;AACzC,SAAO,KACL,QAAQ,oBAAoB,IAAI,CAChC,QAAQ,wBAAwB,MAAM,EAAE,aAAa,CAAC"}
@@ -80,4 +80,4 @@ function setRequestCacheEntry(key, value) {
80
80
 
81
81
  //#endregion
82
82
  export { requestCached as n, setRequestCacheEntry as r, peekRequestCache as t };
83
- //# sourceMappingURL=request-cache-D4I69LeL.mjs.map
83
+ //# sourceMappingURL=request-cache-dzCt8TZB.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"request-cache-D4I69LeL.mjs","names":[],"sources":["../src/request-cache.ts"],"sourcesContent":["/**\n * Per-request query cache\n *\n * Deduplicates identical database queries within a single page render.\n * Uses the ALS request context as a WeakMap key so the cache is\n * automatically GC'd when the request completes.\n *\n * When no request context is available (e.g. local dev without D1\n * replicas), queries bypass the cache — local SQLite is fast enough\n * that deduplication doesn't matter.\n *\n * The WeakMap is stored on globalThis with a Symbol key to guarantee\n * a singleton even when bundlers duplicate this module across chunks\n * (same pattern as request-context.ts).\n */\n\nimport type { EmDashRequestContext } from \"./request-context.js\";\nimport { getRequestContext } from \"./request-context.js\";\n\ntype CacheStore = WeakMap<EmDashRequestContext, Map<string, Promise<unknown>>>;\n\nconst STORE_KEY = Symbol.for(\"emdash:request-cache\");\nconst g = globalThis as Record<symbol, unknown>;\nconst store: CacheStore =\n\t// eslint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- globalThis singleton pattern (see request-context.ts)\n\t(g[STORE_KEY] as CacheStore | undefined) ??\n\t(() => {\n\t\tconst wm: CacheStore = new WeakMap();\n\t\tg[STORE_KEY] = wm;\n\t\treturn wm;\n\t})();\n\n/**\n * Return a cached result for `key` if one exists in the current\n * request scope, otherwise call `fn`, cache its promise, and return it.\n *\n * Caches the *promise*, not the resolved value, so concurrent calls\n * with the same key share a single in-flight query.\n */\nexport function requestCached<T>(key: string, fn: () => Promise<T>): Promise<T> {\n\tconst ctx = getRequestContext();\n\tif (!ctx) return fn();\n\n\tlet cache = store.get(ctx);\n\tif (!cache) {\n\t\tcache = new Map();\n\t\tstore.set(ctx, cache);\n\t}\n\n\tconst existing = cache.get(key);\n\tif (existing) {\n\t\tif (ctx.metrics) ctx.metrics.cacheHits += 1;\n\t\t// eslint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- heterogeneous cache; key namespacing guarantees the stored promise resolves to T\n\t\treturn existing as Promise<T>;\n\t}\n\tif (ctx.metrics) ctx.metrics.cacheMisses += 1;\n\n\tconst promise = Promise.resolve()\n\t\t.then(fn)\n\t\t.catch((error) => {\n\t\t\tcache.delete(key);\n\t\t\tthrow error;\n\t\t});\n\tcache.set(key, promise);\n\treturn promise;\n}\n\n/**\n * Look up an entry in the request-scoped cache without inserting one.\n *\n * Returns the in-flight or resolved promise if the key exists in the\n * current request, otherwise `undefined`. Callers can use this to\n * opportunistically satisfy a narrower query (e.g. `getSiteSetting(\"seo\")`)\n * from a broader one (`getSiteSettings()`) that's already been loaded\n * by a parent template — avoiding a redundant round-trip.\n *\n * No-ops outside a request context.\n */\nexport function peekRequestCache<T>(key: string): Promise<T> | undefined {\n\tconst ctx = getRequestContext();\n\tif (!ctx) return undefined;\n\tconst cache = store.get(ctx);\n\t// eslint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- heterogeneous cache; caller is responsible for using a T-compatible key\n\treturn cache?.get(key) as Promise<T> | undefined;\n}\n\n/**\n * Pre-populate the request-scoped cache with a resolved value.\n *\n * Internal helper shared between hydration paths (taxonomy terms,\n * bylines, etc.) that already have the data in hand and want downstream\n * callers using `requestCached(key, ...)` to skip the database entirely.\n * Not exported from the package entrypoint — keep it internal until we\n * have a documented plugin/extension surface for hydration.\n *\n * No-ops outside a request context (local dev without ALS).\n *\n * Does not overwrite an existing entry — if a query for this key is already\n * in flight, its promise wins.\n */\nexport function setRequestCacheEntry<T>(key: string, value: T): void {\n\tconst ctx = getRequestContext();\n\tif (!ctx) return;\n\n\tlet cache = store.get(ctx);\n\tif (!cache) {\n\t\tcache = new Map();\n\t\tstore.set(ctx, cache);\n\t}\n\n\tif (cache.has(key)) return;\n\tcache.set(key, Promise.resolve(value));\n}\n"],"mappings":";;;AAqBA,MAAM,YAAY,OAAO,IAAI,uBAAuB;AACpD,MAAM,IAAI;AACV,MAAM,QAEJ,EAAE,qBACI;CACN,MAAM,qBAAiB,IAAI,SAAS;AACpC,GAAE,aAAa;AACf,QAAO;IACJ;;;;;;;;AASL,SAAgB,cAAiB,KAAa,IAAkC;CAC/E,MAAM,MAAM,mBAAmB;AAC/B,KAAI,CAAC,IAAK,QAAO,IAAI;CAErB,IAAI,QAAQ,MAAM,IAAI,IAAI;AAC1B,KAAI,CAAC,OAAO;AACX,0BAAQ,IAAI,KAAK;AACjB,QAAM,IAAI,KAAK,MAAM;;CAGtB,MAAM,WAAW,MAAM,IAAI,IAAI;AAC/B,KAAI,UAAU;AACb,MAAI,IAAI,QAAS,KAAI,QAAQ,aAAa;AAE1C,SAAO;;AAER,KAAI,IAAI,QAAS,KAAI,QAAQ,eAAe;CAE5C,MAAM,UAAU,QAAQ,SAAS,CAC/B,KAAK,GAAG,CACR,OAAO,UAAU;AACjB,QAAM,OAAO,IAAI;AACjB,QAAM;GACL;AACH,OAAM,IAAI,KAAK,QAAQ;AACvB,QAAO;;;;;;;;;;;;;AAcR,SAAgB,iBAAoB,KAAqC;CACxE,MAAM,MAAM,mBAAmB;AAC/B,KAAI,CAAC,IAAK,QAAO;AAGjB,QAFc,MAAM,IAAI,IAAI,EAEd,IAAI,IAAI;;;;;;;;;;;;;;;;AAiBvB,SAAgB,qBAAwB,KAAa,OAAgB;CACpE,MAAM,MAAM,mBAAmB;AAC/B,KAAI,CAAC,IAAK;CAEV,IAAI,QAAQ,MAAM,IAAI,IAAI;AAC1B,KAAI,CAAC,OAAO;AACX,0BAAQ,IAAI,KAAK;AACjB,QAAM,IAAI,KAAK,MAAM;;AAGtB,KAAI,MAAM,IAAI,IAAI,CAAE;AACpB,OAAM,IAAI,KAAK,QAAQ,QAAQ,MAAM,CAAC"}
1
+ {"version":3,"file":"request-cache-dzCt8TZB.mjs","names":[],"sources":["../src/request-cache.ts"],"sourcesContent":["/**\n * Per-request query cache\n *\n * Deduplicates identical database queries within a single page render.\n * Uses the ALS request context as a WeakMap key so the cache is\n * automatically GC'd when the request completes.\n *\n * When no request context is available (e.g. local dev without D1\n * replicas), queries bypass the cache — local SQLite is fast enough\n * that deduplication doesn't matter.\n *\n * The WeakMap is stored on globalThis with a Symbol key to guarantee\n * a singleton even when bundlers duplicate this module across chunks\n * (same pattern as request-context.ts).\n */\n\nimport type { EmDashRequestContext } from \"./request-context.js\";\nimport { getRequestContext } from \"./request-context.js\";\n\ntype CacheStore = WeakMap<EmDashRequestContext, Map<string, Promise<unknown>>>;\n\nconst STORE_KEY = Symbol.for(\"emdash:request-cache\");\nconst g = globalThis as Record<symbol, unknown>;\nconst store: CacheStore =\n\t// eslint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- globalThis singleton pattern (see request-context.ts)\n\t(g[STORE_KEY] as CacheStore | undefined) ??\n\t(() => {\n\t\tconst wm: CacheStore = new WeakMap();\n\t\tg[STORE_KEY] = wm;\n\t\treturn wm;\n\t})();\n\n/**\n * Return a cached result for `key` if one exists in the current\n * request scope, otherwise call `fn`, cache its promise, and return it.\n *\n * Caches the *promise*, not the resolved value, so concurrent calls\n * with the same key share a single in-flight query.\n */\nexport function requestCached<T>(key: string, fn: () => Promise<T>): Promise<T> {\n\tconst ctx = getRequestContext();\n\tif (!ctx) return fn();\n\n\tlet cache = store.get(ctx);\n\tif (!cache) {\n\t\tcache = new Map();\n\t\tstore.set(ctx, cache);\n\t}\n\n\tconst existing = cache.get(key);\n\tif (existing) {\n\t\tif (ctx.metrics) ctx.metrics.cacheHits += 1;\n\t\t// eslint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- heterogeneous cache; key namespacing guarantees the stored promise resolves to T\n\t\treturn existing as Promise<T>;\n\t}\n\tif (ctx.metrics) ctx.metrics.cacheMisses += 1;\n\n\tconst promise = Promise.resolve()\n\t\t.then(fn)\n\t\t.catch((error) => {\n\t\t\tcache.delete(key);\n\t\t\tthrow error;\n\t\t});\n\tcache.set(key, promise);\n\treturn promise;\n}\n\n/**\n * Look up an entry in the request-scoped cache without inserting one.\n *\n * Returns the in-flight or resolved promise if the key exists in the\n * current request, otherwise `undefined`. Callers can use this to\n * opportunistically satisfy a narrower query (e.g. `getSiteSetting(\"seo\")`)\n * from a broader one (`getSiteSettings()`) that's already been loaded\n * by a parent template — avoiding a redundant round-trip.\n *\n * No-ops outside a request context.\n */\nexport function peekRequestCache<T>(key: string): Promise<T> | undefined {\n\tconst ctx = getRequestContext();\n\tif (!ctx) return undefined;\n\tconst cache = store.get(ctx);\n\t// eslint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- heterogeneous cache; caller is responsible for using a T-compatible key\n\treturn cache?.get(key) as Promise<T> | undefined;\n}\n\n/**\n * Pre-populate the request-scoped cache with a resolved value.\n *\n * Internal helper shared between hydration paths (taxonomy terms,\n * bylines, etc.) that already have the data in hand and want downstream\n * callers using `requestCached(key, ...)` to skip the database entirely.\n * Not exported from the package entrypoint — keep it internal until we\n * have a documented plugin/extension surface for hydration.\n *\n * No-ops outside a request context (local dev without ALS).\n *\n * Does not overwrite an existing entry — if a query for this key is already\n * in flight, its promise wins.\n */\nexport function setRequestCacheEntry<T>(key: string, value: T): void {\n\tconst ctx = getRequestContext();\n\tif (!ctx) return;\n\n\tlet cache = store.get(ctx);\n\tif (!cache) {\n\t\tcache = new Map();\n\t\tstore.set(ctx, cache);\n\t}\n\n\tif (cache.has(key)) return;\n\tcache.set(key, Promise.resolve(value));\n}\n"],"mappings":";;;AAqBA,MAAM,YAAY,OAAO,IAAI,uBAAuB;AACpD,MAAM,IAAI;AACV,MAAM,QAEJ,EAAE,qBACI;CACN,MAAM,qBAAiB,IAAI,SAAS;AACpC,GAAE,aAAa;AACf,QAAO;IACJ;;;;;;;;AASL,SAAgB,cAAiB,KAAa,IAAkC;CAC/E,MAAM,MAAM,mBAAmB;AAC/B,KAAI,CAAC,IAAK,QAAO,IAAI;CAErB,IAAI,QAAQ,MAAM,IAAI,IAAI;AAC1B,KAAI,CAAC,OAAO;AACX,0BAAQ,IAAI,KAAK;AACjB,QAAM,IAAI,KAAK,MAAM;;CAGtB,MAAM,WAAW,MAAM,IAAI,IAAI;AAC/B,KAAI,UAAU;AACb,MAAI,IAAI,QAAS,KAAI,QAAQ,aAAa;AAE1C,SAAO;;AAER,KAAI,IAAI,QAAS,KAAI,QAAQ,eAAe;CAE5C,MAAM,UAAU,QAAQ,SAAS,CAC/B,KAAK,GAAG,CACR,OAAO,UAAU;AACjB,QAAM,OAAO,IAAI;AACjB,QAAM;GACL;AACH,OAAM,IAAI,KAAK,QAAQ;AACvB,QAAO;;;;;;;;;;;;;AAcR,SAAgB,iBAAoB,KAAqC;CACxE,MAAM,MAAM,mBAAmB;AAC/B,KAAI,CAAC,IAAK,QAAO;AAGjB,QAFc,MAAM,IAAI,IAAI,EAEd,IAAI,IAAI;;;;;;;;;;;;;;;;AAiBvB,SAAgB,qBAAwB,KAAa,OAAgB;CACpE,MAAM,MAAM,mBAAmB;AAC/B,KAAI,CAAC,IAAK;CAEV,IAAI,QAAQ,MAAM,IAAI,IAAI;AAC1B,KAAI,CAAC,OAAO;AACX,0BAAQ,IAAI,KAAK;AACjB,QAAM,IAAI,KAAK,MAAM;;AAGtB,KAAI,MAAM,IAAI,IAAI,CAAE;AACpB,OAAM,IAAI,KAAK,QAAQ,QAAQ,MAAM,CAAC"}
@@ -0,0 +1,140 @@
1
+ import { n as normalizeTrustedHeaders, t as getTrustedProxyHeaders } from "./trusted-proxy-CJhQIk65.mjs";
2
+
3
+ //#region src/plugins/request-meta.ts
4
+ /**
5
+ * Loose validation for IPv4 and IPv6 addresses.
6
+ * Accepts digits, hex chars, dots, and colons — rejects anything else
7
+ * (e.g. HTML tags, scripts, or other non-IP garbage in spoofed headers).
8
+ */
9
+ const IP_PATTERN = /^[\da-fA-F.:]+$/;
10
+ /**
11
+ * Extract the first IP from an X-Forwarded-For header value.
12
+ * The header may contain a comma-separated list of IPs; the first
13
+ * entry is the original client IP.
14
+ *
15
+ * Returns null if the extracted value doesn't look like an IP address.
16
+ */
17
+ function parseFirstForwardedIp(header) {
18
+ const trimmed = header.split(",")[0]?.trim();
19
+ if (!trimmed) return null;
20
+ return IP_PATTERN.test(trimmed) ? trimmed : null;
21
+ }
22
+ /**
23
+ * Read an IP from an operator-declared trusted header. XFF-style headers
24
+ * (any name ending in `forwarded-for`) are parsed as comma-separated lists
25
+ * and the first entry is used; everything else is treated as a single
26
+ * trimmed value.
27
+ */
28
+ function readIpFromHeader(headers, name) {
29
+ const value = headers.get(name);
30
+ if (!value) return null;
31
+ if (name.endsWith("forwarded-for")) return parseFirstForwardedIp(value);
32
+ const trimmed = value.trim();
33
+ if (!trimmed) return null;
34
+ return IP_PATTERN.test(trimmed) ? trimmed : null;
35
+ }
36
+ /**
37
+ * Get the Cloudflare `cf` object from the request, if present.
38
+ * Returns undefined when not running on Cloudflare Workers.
39
+ */
40
+ function getCfObject(request) {
41
+ return request.cf;
42
+ }
43
+ /**
44
+ * Extract geographic information from the Cloudflare `cf` object
45
+ * attached to the request. Returns null when not running on CF Workers.
46
+ */
47
+ function extractGeo(cf) {
48
+ if (!cf) return null;
49
+ const country = cf.country ?? null;
50
+ const region = cf.region ?? null;
51
+ const city = cf.city ?? null;
52
+ if (country === null && region === null && city === null) return null;
53
+ return {
54
+ country,
55
+ region,
56
+ city
57
+ };
58
+ }
59
+ /**
60
+ * Extract normalized request metadata from a Request object.
61
+ *
62
+ * IP resolution order:
63
+ * 1. `CF-Connecting-IP` — trusted only when a `cf` object is present on the
64
+ * request. CF edge overwrites any client-supplied value, so this is the
65
+ * cryptographically trustworthy path on Workers. Operator-declared
66
+ * trusted headers cannot override it.
67
+ * 2. `X-Forwarded-For` first entry — trusted only with a `cf` object.
68
+ * 3. Operator-declared trusted proxy headers (from `config.trustedProxyHeaders`
69
+ * or the `EMDASH_TRUSTED_PROXY_HEADERS` env var), tried in order. Used as
70
+ * the primary source off-CF and as a fill-in on CF.
71
+ * 4. `null`
72
+ *
73
+ * The second argument accepts either the EmDash config or a pre-resolved
74
+ * list of trusted headers, so callers that already have the list don't have
75
+ * to round-trip through the config every request.
76
+ */
77
+ function extractRequestMeta(request, configOrTrustedHeaders) {
78
+ const headers = request.headers;
79
+ const cf = getCfObject(request);
80
+ const trusted = resolveTrustedHeaders(configOrTrustedHeaders);
81
+ let ip = null;
82
+ if (cf) {
83
+ const cfIp = headers.get("cf-connecting-ip")?.trim();
84
+ if (cfIp && IP_PATTERN.test(cfIp)) ip = cfIp;
85
+ if (!ip) {
86
+ const xff = headers.get("x-forwarded-for");
87
+ ip = xff ? parseFirstForwardedIp(xff) : null;
88
+ }
89
+ }
90
+ if (!ip) for (const name of trusted) {
91
+ const value = readIpFromHeader(headers, name);
92
+ if (value) {
93
+ ip = value;
94
+ break;
95
+ }
96
+ }
97
+ const userAgent = headers.get("user-agent")?.trim() || null;
98
+ const referer = headers.get("referer")?.trim() || null;
99
+ const geo = extractGeo(cf);
100
+ return {
101
+ ip,
102
+ userAgent,
103
+ referer,
104
+ geo
105
+ };
106
+ }
107
+ function resolveTrustedHeaders(value) {
108
+ if (Array.isArray(value)) return normalizeTrustedHeaders(value);
109
+ return getTrustedProxyHeaders(value);
110
+ }
111
+ /**
112
+ * Headers that must never cross the RPC boundary to sandboxed plugins.
113
+ * Session tokens, auth credentials, and infrastructure headers are stripped
114
+ * to prevent malicious plugins from exfiltrating sensitive data.
115
+ */
116
+ const SANDBOX_STRIPPED_HEADERS = new Set([
117
+ "cookie",
118
+ "set-cookie",
119
+ "authorization",
120
+ "proxy-authorization",
121
+ "cf-access-jwt-assertion",
122
+ "cf-access-client-id",
123
+ "cf-access-client-secret",
124
+ "x-emdash-request"
125
+ ]);
126
+ /**
127
+ * Copy request headers into a plain object, stripping sensitive headers
128
+ * that must not be exposed to sandboxed plugin code.
129
+ */
130
+ function sanitizeHeadersForSandbox(headers) {
131
+ const safe = {};
132
+ headers.forEach((value, key) => {
133
+ if (!SANDBOX_STRIPPED_HEADERS.has(key)) safe[key] = value;
134
+ });
135
+ return safe;
136
+ }
137
+
138
+ //#endregion
139
+ export { sanitizeHeadersForSandbox as n, extractRequestMeta as t };
140
+ //# sourceMappingURL=request-meta-CLCwSQOS.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-meta-CLCwSQOS.mjs","names":[],"sources":["../src/plugins/request-meta.ts"],"sourcesContent":["/**\n * Request Metadata Extraction\n *\n * Extracts normalized metadata (IP, user agent, referer, geo) from\n * incoming requests. Used by plugin route handlers to access request\n * context without touching raw headers.\n *\n */\n\nimport type { EmDashConfig } from \"../astro/integration/runtime.js\";\nimport { getTrustedProxyHeaders, normalizeTrustedHeaders } from \"../auth/trusted-proxy.js\";\nimport type { GeoInfo, RequestMeta } from \"./types.js\";\n\n/**\n * Cloudflare Workers `cf` object shape (subset we use).\n * Present on requests when running on Cloudflare Workers.\n */\ninterface CfProperties {\n\tcountry?: string;\n\tregion?: string;\n\tcity?: string;\n}\n\n/**\n * Loose validation for IPv4 and IPv6 addresses.\n * Accepts digits, hex chars, dots, and colons — rejects anything else\n * (e.g. HTML tags, scripts, or other non-IP garbage in spoofed headers).\n */\nconst IP_PATTERN = /^[\\da-fA-F.:]+$/;\n\n/**\n * Extract the first IP from an X-Forwarded-For header value.\n * The header may contain a comma-separated list of IPs; the first\n * entry is the original client IP.\n *\n * Returns null if the extracted value doesn't look like an IP address.\n */\nfunction parseFirstForwardedIp(header: string): string | null {\n\tconst first = header.split(\",\")[0];\n\tconst trimmed = first?.trim();\n\tif (!trimmed) return null;\n\treturn IP_PATTERN.test(trimmed) ? trimmed : null;\n}\n\n/**\n * Read an IP from an operator-declared trusted header. XFF-style headers\n * (any name ending in `forwarded-for`) are parsed as comma-separated lists\n * and the first entry is used; everything else is treated as a single\n * trimmed value.\n */\nfunction readIpFromHeader(headers: Headers, name: string): string | null {\n\tconst value = headers.get(name);\n\tif (!value) return null;\n\tif (name.endsWith(\"forwarded-for\")) {\n\t\treturn parseFirstForwardedIp(value);\n\t}\n\tconst trimmed = value.trim();\n\tif (!trimmed) return null;\n\treturn IP_PATTERN.test(trimmed) ? trimmed : null;\n}\n\n/**\n * Get the Cloudflare `cf` object from the request, if present.\n * Returns undefined when not running on Cloudflare Workers.\n */\nfunction getCfObject(request: Request): CfProperties | undefined {\n\treturn (request as unknown as { cf?: CfProperties }).cf;\n}\n\n/**\n * Extract geographic information from the Cloudflare `cf` object\n * attached to the request. Returns null when not running on CF Workers.\n */\nfunction extractGeo(cf: CfProperties | undefined): GeoInfo | null {\n\tif (!cf) return null;\n\n\tconst country = cf.country ?? null;\n\tconst region = cf.region ?? null;\n\tconst city = cf.city ?? null;\n\n\t// Only return geo if at least one field is populated\n\tif (country === null && region === null && city === null) return null;\n\n\treturn { country, region, city };\n}\n\n/**\n * Extract normalized request metadata from a Request object.\n *\n * IP resolution order:\n * 1. `CF-Connecting-IP` — trusted only when a `cf` object is present on the\n * request. CF edge overwrites any client-supplied value, so this is the\n * cryptographically trustworthy path on Workers. Operator-declared\n * trusted headers cannot override it.\n * 2. `X-Forwarded-For` first entry — trusted only with a `cf` object.\n * 3. Operator-declared trusted proxy headers (from `config.trustedProxyHeaders`\n * or the `EMDASH_TRUSTED_PROXY_HEADERS` env var), tried in order. Used as\n * the primary source off-CF and as a fill-in on CF.\n * 4. `null`\n *\n * The second argument accepts either the EmDash config or a pre-resolved\n * list of trusted headers, so callers that already have the list don't have\n * to round-trip through the config every request.\n */\nexport function extractRequestMeta(\n\trequest: Request,\n\tconfigOrTrustedHeaders?: EmDashConfig | null | { trustedProxyHeaders?: string[] } | string[],\n): RequestMeta {\n\tconst headers = request.headers;\n\tconst cf = getCfObject(request);\n\tconst trusted = resolveTrustedHeaders(configOrTrustedHeaders);\n\n\tlet ip: string | null = null;\n\n\t// On Cloudflare, prefer the cryptographically trustworthy headers first.\n\tif (cf) {\n\t\tconst cfIp = headers.get(\"cf-connecting-ip\")?.trim();\n\t\tif (cfIp && IP_PATTERN.test(cfIp)) {\n\t\t\tip = cfIp;\n\t\t}\n\t\tif (!ip) {\n\t\t\tconst xff = headers.get(\"x-forwarded-for\");\n\t\t\tip = xff ? parseFirstForwardedIp(xff) : null;\n\t\t}\n\t}\n\n\t// Fall through to operator-declared trusted headers. On CF this fills\n\t// in when the CF headers are absent; off-CF it's the primary source.\n\tif (!ip) {\n\t\tfor (const name of trusted) {\n\t\t\tconst value = readIpFromHeader(headers, name);\n\t\t\tif (value) {\n\t\t\t\tip = value;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst userAgent = headers.get(\"user-agent\")?.trim() || null;\n\tconst referer = headers.get(\"referer\")?.trim() || null;\n\tconst geo = extractGeo(cf);\n\n\treturn { ip, userAgent, referer, geo };\n}\n\nfunction resolveTrustedHeaders(\n\tvalue: EmDashConfig | null | { trustedProxyHeaders?: string[] } | string[] | undefined,\n): string[] {\n\tif (Array.isArray(value)) {\n\t\t// Apply the same RFC 7230 validation the config/env path does so a\n\t\t// caller passing a pre-resolved list with bad entries can't crash\n\t\t// `Headers.get()` downstream.\n\t\treturn normalizeTrustedHeaders(value);\n\t}\n\treturn getTrustedProxyHeaders(value);\n}\n\n// =============================================================================\n// Header Sanitization for Sandbox\n// =============================================================================\n\n/**\n * Headers that must never cross the RPC boundary to sandboxed plugins.\n * Session tokens, auth credentials, and infrastructure headers are stripped\n * to prevent malicious plugins from exfiltrating sensitive data.\n */\nconst SANDBOX_STRIPPED_HEADERS = new Set([\n\t\"cookie\",\n\t\"set-cookie\",\n\t\"authorization\",\n\t\"proxy-authorization\",\n\t\"cf-access-jwt-assertion\",\n\t\"cf-access-client-id\",\n\t\"cf-access-client-secret\",\n\t\"x-emdash-request\",\n]);\n\n/**\n * Copy request headers into a plain object, stripping sensitive headers\n * that must not be exposed to sandboxed plugin code.\n */\nexport function sanitizeHeadersForSandbox(headers: Headers): Record<string, string> {\n\tconst safe: Record<string, string> = {};\n\theaders.forEach((value, key) => {\n\t\tif (!SANDBOX_STRIPPED_HEADERS.has(key)) {\n\t\t\tsafe[key] = value;\n\t\t}\n\t});\n\treturn safe;\n}\n"],"mappings":";;;;;;;;AA4BA,MAAM,aAAa;;;;;;;;AASnB,SAAS,sBAAsB,QAA+B;CAE7D,MAAM,UADQ,OAAO,MAAM,IAAI,CAAC,IACT,MAAM;AAC7B,KAAI,CAAC,QAAS,QAAO;AACrB,QAAO,WAAW,KAAK,QAAQ,GAAG,UAAU;;;;;;;;AAS7C,SAAS,iBAAiB,SAAkB,MAA6B;CACxE,MAAM,QAAQ,QAAQ,IAAI,KAAK;AAC/B,KAAI,CAAC,MAAO,QAAO;AACnB,KAAI,KAAK,SAAS,gBAAgB,CACjC,QAAO,sBAAsB,MAAM;CAEpC,MAAM,UAAU,MAAM,MAAM;AAC5B,KAAI,CAAC,QAAS,QAAO;AACrB,QAAO,WAAW,KAAK,QAAQ,GAAG,UAAU;;;;;;AAO7C,SAAS,YAAY,SAA4C;AAChE,QAAQ,QAA6C;;;;;;AAOtD,SAAS,WAAW,IAA8C;AACjE,KAAI,CAAC,GAAI,QAAO;CAEhB,MAAM,UAAU,GAAG,WAAW;CAC9B,MAAM,SAAS,GAAG,UAAU;CAC5B,MAAM,OAAO,GAAG,QAAQ;AAGxB,KAAI,YAAY,QAAQ,WAAW,QAAQ,SAAS,KAAM,QAAO;AAEjE,QAAO;EAAE;EAAS;EAAQ;EAAM;;;;;;;;;;;;;;;;;;;;AAqBjC,SAAgB,mBACf,SACA,wBACc;CACd,MAAM,UAAU,QAAQ;CACxB,MAAM,KAAK,YAAY,QAAQ;CAC/B,MAAM,UAAU,sBAAsB,uBAAuB;CAE7D,IAAI,KAAoB;AAGxB,KAAI,IAAI;EACP,MAAM,OAAO,QAAQ,IAAI,mBAAmB,EAAE,MAAM;AACpD,MAAI,QAAQ,WAAW,KAAK,KAAK,CAChC,MAAK;AAEN,MAAI,CAAC,IAAI;GACR,MAAM,MAAM,QAAQ,IAAI,kBAAkB;AAC1C,QAAK,MAAM,sBAAsB,IAAI,GAAG;;;AAM1C,KAAI,CAAC,GACJ,MAAK,MAAM,QAAQ,SAAS;EAC3B,MAAM,QAAQ,iBAAiB,SAAS,KAAK;AAC7C,MAAI,OAAO;AACV,QAAK;AACL;;;CAKH,MAAM,YAAY,QAAQ,IAAI,aAAa,EAAE,MAAM,IAAI;CACvD,MAAM,UAAU,QAAQ,IAAI,UAAU,EAAE,MAAM,IAAI;CAClD,MAAM,MAAM,WAAW,GAAG;AAE1B,QAAO;EAAE;EAAI;EAAW;EAAS;EAAK;;AAGvC,SAAS,sBACR,OACW;AACX,KAAI,MAAM,QAAQ,MAAM,CAIvB,QAAO,wBAAwB,MAAM;AAEtC,QAAO,uBAAuB,MAAM;;;;;;;AAYrC,MAAM,2BAA2B,IAAI,IAAI;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,CAAC;;;;;AAMF,SAAgB,0BAA0B,SAA0C;CACnF,MAAM,OAA+B,EAAE;AACvC,SAAQ,SAAS,OAAO,QAAQ;AAC/B,MAAI,CAAC,yBAAyB,IAAI,IAAI,CACrC,MAAK,OAAO;GAEZ;AACF,QAAO"}
@@ -1,4 +1,4 @@
1
- import { t as Database } from "./types-BQx6ZXpR.mjs";
1
+ import { t as Database } from "./types-C1KKK4VP.mjs";
2
2
  import { Kysely } from "kysely";
3
3
 
4
4
  //#region src/database/migrations/runner.d.ts
@@ -41,4 +41,4 @@ declare function rollbackMigration(db: Kysely<Database>): Promise<{
41
41
  }>;
42
42
  //#endregion
43
43
  export { runMigrations as i, getMigrationStatus as n, rollbackMigration as r, MigrationStatus as t };
44
- //# sourceMappingURL=runner-Iu3IZSDM.d.mts.map
44
+ //# sourceMappingURL=runner-DcfZewkO.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runner-Iu3IZSDM.d.mts","names":[],"sources":["../src/database/migrations/runner.ts"],"mappings":";;;;UA6FiB,eAAA;EAChB,OAAA;EACA,OAAA;AAAA;;AAUD;;iBAAsB,kBAAA,CAAmB,EAAA,EAAI,MAAA,CAAO,QAAA,IAAY,OAAA,CAAQ,eAAA;;;;;;;;;;;;;;AAoKxE;;;;;;;iBAAsB,aAAA,CAAc,EAAA,EAAI,MAAA,CAAO,QAAA,IAAY,OAAA;EAAU,OAAA;AAAA;;;;iBAiD/C,iBAAA,CACrB,EAAA,EAAI,MAAA,CAAO,QAAA,IACT,OAAA;EAAU,UAAA;AAAA"}
1
+ {"version":3,"file":"runner-DcfZewkO.d.mts","names":[],"sources":["../src/database/migrations/runner.ts"],"mappings":";;;;UAiGiB,eAAA;EAChB,OAAA;EACA,OAAA;AAAA;;AAUD;;iBAAsB,kBAAA,CAAmB,EAAA,EAAI,MAAA,CAAO,QAAA,IAAY,OAAA,CAAQ,eAAA;;;;;;;;;;;;;;AAoKxE;;;;;;;iBAAsB,aAAA,CAAc,EAAA,EAAI,MAAA,CAAO,QAAA,IAAY,OAAA;EAAU,OAAA;AAAA;;;;iBAiD/C,iBAAA,CACrB,EAAA,EAAI,MAAA,CAAO,QAAA,IACT,OAAA;EAAU,UAAA;AAAA"}