emdash 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (403) hide show
  1. package/dist/{adapters-C5AWLJSD.d.mts → adapters-BzIHV3sw.d.mts} +1 -1
  2. package/dist/{adapters-C5AWLJSD.d.mts.map → adapters-BzIHV3sw.d.mts.map} +1 -1
  3. package/dist/{allowed-origins-CyYLEJkp.mjs → allowed-origins-B1u7Qnvg.mjs} +2 -2
  4. package/dist/{allowed-origins-CyYLEJkp.mjs.map → allowed-origins-B1u7Qnvg.mjs.map} +1 -1
  5. package/dist/api/route-utils.d.mts +3 -3
  6. package/dist/api/route-utils.mjs +5 -5
  7. package/dist/api/schemas/index.d.mts +1 -1
  8. package/dist/api/schemas/index.mjs +2 -2
  9. package/dist/{api-BZ6bhjYs.mjs → api-DStv36ik.mjs} +36 -5
  10. package/dist/api-DStv36ik.mjs.map +1 -0
  11. package/dist/{api-tokens-VrXNiNvV.mjs → api-tokens-DPfhPu5V.mjs} +2 -2
  12. package/dist/{api-tokens-VrXNiNvV.mjs.map → api-tokens-DPfhPu5V.mjs.map} +1 -1
  13. package/dist/{apply-hQkKKBCf.mjs → apply-Dr7snAMT.mjs} +7 -7
  14. package/dist/{apply-hQkKKBCf.mjs.map → apply-Dr7snAMT.mjs.map} +1 -1
  15. package/dist/astro/index.d.mts +10 -10
  16. package/dist/astro/index.mjs +3 -3
  17. package/dist/astro/middleware/auth.d.mts +9 -9
  18. package/dist/astro/middleware/auth.mjs +4 -4
  19. package/dist/astro/middleware/redirect.mjs +1 -1
  20. package/dist/astro/middleware/request-context.mjs +1 -1
  21. package/dist/astro/middleware/setup.mjs +1 -1
  22. package/dist/astro/middleware.d.mts +1 -1
  23. package/dist/astro/middleware.d.mts.map +1 -1
  24. package/dist/astro/middleware.mjs +63 -112
  25. package/dist/astro/middleware.mjs.map +1 -1
  26. package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +2 -2
  27. package/dist/astro/routes/api/admin/allowed-domains/index.mjs +2 -2
  28. package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +2 -2
  29. package/dist/astro/routes/api/admin/api-tokens/index.mjs +2 -2
  30. package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +2 -2
  31. package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +4 -4
  32. package/dist/astro/routes/api/admin/byline-fields/index.mjs +4 -4
  33. package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +4 -4
  34. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +6 -6
  35. package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +6 -6
  36. package/dist/astro/routes/api/admin/bylines/index.mjs +6 -6
  37. package/dist/astro/routes/api/admin/comments/_id_/status.mjs +6 -6
  38. package/dist/astro/routes/api/admin/comments/_id_.mjs +2 -2
  39. package/dist/astro/routes/api/admin/comments/bulk.mjs +4 -4
  40. package/dist/astro/routes/api/admin/comments/counts.mjs +2 -2
  41. package/dist/astro/routes/api/admin/comments/index.mjs +4 -4
  42. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +1 -1
  43. package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +1 -1
  44. package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +1 -1
  45. package/dist/astro/routes/api/admin/oauth-clients/index.mjs +1 -1
  46. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +14 -14
  47. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +14 -14
  48. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +14 -14
  49. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +14 -14
  50. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +14 -14
  51. package/dist/astro/routes/api/admin/plugins/index.mjs +14 -14
  52. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +1 -1
  53. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +14 -14
  54. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +14 -14
  55. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +14 -14
  56. package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs +14 -14
  57. package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs +15 -15
  58. package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs +14 -14
  59. package/dist/astro/routes/api/admin/plugins/registry/install.mjs +15 -15
  60. package/dist/astro/routes/api/admin/plugins/updates.mjs +14 -14
  61. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +14 -14
  62. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +1 -1
  63. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +14 -14
  64. package/dist/astro/routes/api/admin/users/_id_/index.mjs +2 -2
  65. package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +1 -1
  66. package/dist/astro/routes/api/admin/users/index.mjs +2 -2
  67. package/dist/astro/routes/api/auth/dev-bypass.mjs +2 -2
  68. package/dist/astro/routes/api/auth/invite/complete.mjs +6 -6
  69. package/dist/astro/routes/api/auth/invite/index.mjs +3 -3
  70. package/dist/astro/routes/api/auth/invite/register-options.mjs +5 -5
  71. package/dist/astro/routes/api/auth/logout.mjs +1 -1
  72. package/dist/astro/routes/api/auth/magic-link/send.mjs +4 -4
  73. package/dist/astro/routes/api/auth/magic-link/verify.mjs +1 -1
  74. package/dist/astro/routes/api/auth/me.mjs +2 -2
  75. package/dist/astro/routes/api/auth/mode.mjs +1 -1
  76. package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +3 -3
  77. package/dist/astro/routes/api/auth/oauth/_provider_.mjs +2 -2
  78. package/dist/astro/routes/api/auth/passkey/_id_.mjs +2 -2
  79. package/dist/astro/routes/api/auth/passkey/options.mjs +6 -6
  80. package/dist/astro/routes/api/auth/passkey/register/options.mjs +5 -5
  81. package/dist/astro/routes/api/auth/passkey/register/verify.mjs +6 -6
  82. package/dist/astro/routes/api/auth/passkey/verify.mjs +6 -6
  83. package/dist/astro/routes/api/auth/signup/complete.mjs +6 -6
  84. package/dist/astro/routes/api/auth/signup/request.mjs +4 -4
  85. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +6 -6
  86. package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +1 -1
  87. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +1 -1
  88. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +1 -1
  89. package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +1 -1
  90. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +4 -4
  91. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +3 -3
  92. package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +1 -1
  93. package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +1 -1
  94. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +3 -3
  95. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +5 -5
  96. package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +1 -1
  97. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +1 -1
  98. package/dist/astro/routes/api/content/_collection_/_id_.mjs +3 -3
  99. package/dist/astro/routes/api/content/_collection_/authors.mjs +1 -1
  100. package/dist/astro/routes/api/content/_collection_/index.mjs +3 -3
  101. package/dist/astro/routes/api/content/_collection_/trash.mjs +3 -3
  102. package/dist/astro/routes/api/dashboard.mjs +1 -1
  103. package/dist/astro/routes/api/import/probe.d.mts +3 -3
  104. package/dist/astro/routes/api/import/probe.mjs +3 -3
  105. package/dist/astro/routes/api/import/wordpress/analyze.mjs +1 -1
  106. package/dist/astro/routes/api/import/wordpress/execute.d.mts +9 -9
  107. package/dist/astro/routes/api/import/wordpress/execute.mjs +3 -3
  108. package/dist/astro/routes/api/import/wordpress/media.mjs +3 -3
  109. package/dist/astro/routes/api/import/wordpress/prepare.mjs +3 -3
  110. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +3 -3
  111. package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
  112. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +3 -3
  113. package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +1 -1
  114. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +3 -3
  115. package/dist/astro/routes/api/manifest.mjs +2 -2
  116. package/dist/astro/routes/api/mcp.mjs +18 -18
  117. package/dist/astro/routes/api/media/_id_/confirm.mjs +3 -3
  118. package/dist/astro/routes/api/media/_id_.mjs +3 -3
  119. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +1 -1
  120. package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +1 -1
  121. package/dist/astro/routes/api/media/providers/index.mjs +1 -1
  122. package/dist/astro/routes/api/media/upload-url.mjs +4 -4
  123. package/dist/astro/routes/api/media.mjs +4 -4
  124. package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +3 -3
  125. package/dist/astro/routes/api/menus/_name_/items.mjs +3 -3
  126. package/dist/astro/routes/api/menus/_name_/reorder.mjs +3 -3
  127. package/dist/astro/routes/api/menus/_name_/translations.mjs +3 -3
  128. package/dist/astro/routes/api/menus/_name_.mjs +3 -3
  129. package/dist/astro/routes/api/menus/index.mjs +3 -3
  130. package/dist/astro/routes/api/oauth/authorize.mjs +6 -6
  131. package/dist/astro/routes/api/oauth/device/authorize.mjs +3 -3
  132. package/dist/astro/routes/api/oauth/device/code.mjs +5 -5
  133. package/dist/astro/routes/api/oauth/device/token.mjs +4 -4
  134. package/dist/astro/routes/api/oauth/register.mjs +1 -1
  135. package/dist/astro/routes/api/oauth/token/refresh.mjs +3 -3
  136. package/dist/astro/routes/api/oauth/token/revoke.mjs +3 -3
  137. package/dist/astro/routes/api/oauth/token.mjs +4 -4
  138. package/dist/astro/routes/api/openapi.json.mjs +1 -1
  139. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +2 -2
  140. package/dist/astro/routes/api/redirects/404s/index.mjs +4 -4
  141. package/dist/astro/routes/api/redirects/404s/summary.mjs +4 -4
  142. package/dist/astro/routes/api/redirects/_id_.mjs +4 -4
  143. package/dist/astro/routes/api/redirects/index.mjs +4 -4
  144. package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +1 -1
  145. package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +1 -1
  146. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +14 -14
  147. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +14 -14
  148. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +14 -14
  149. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +14 -14
  150. package/dist/astro/routes/api/schema/collections/index.mjs +14 -14
  151. package/dist/astro/routes/api/schema/index.mjs +5 -10
  152. package/dist/astro/routes/api/schema/index.mjs.map +1 -1
  153. package/dist/astro/routes/api/schema/orphans/_slug_.mjs +14 -14
  154. package/dist/astro/routes/api/schema/orphans/index.mjs +14 -14
  155. package/dist/astro/routes/api/search/enable.mjs +5 -5
  156. package/dist/astro/routes/api/search/index.mjs +4 -4
  157. package/dist/astro/routes/api/search/rebuild.mjs +5 -5
  158. package/dist/astro/routes/api/search/stats.mjs +3 -3
  159. package/dist/astro/routes/api/search/suggest.mjs +4 -4
  160. package/dist/astro/routes/api/sections/_slug_.mjs +5 -5
  161. package/dist/astro/routes/api/sections/index.mjs +5 -5
  162. package/dist/astro/routes/api/settings/email.mjs +1 -1
  163. package/dist/astro/routes/api/settings.mjs +6 -6
  164. package/dist/astro/routes/api/setup/admin-verify.mjs +7 -7
  165. package/dist/astro/routes/api/setup/admin.mjs +6 -6
  166. package/dist/astro/routes/api/setup/dev-bypass.mjs +10 -10
  167. package/dist/astro/routes/api/setup/index.mjs +9 -9
  168. package/dist/astro/routes/api/setup/status.mjs +2 -2
  169. package/dist/astro/routes/api/snapshot.mjs +3 -3
  170. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +6 -6
  171. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +6 -6
  172. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +6 -6
  173. package/dist/astro/routes/api/taxonomies/index.mjs +6 -6
  174. package/dist/astro/routes/api/themes/preview.mjs +3 -3
  175. package/dist/astro/routes/api/well-known/auth.mjs +1 -1
  176. package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +2 -2
  177. package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +2 -2
  178. package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +3 -3
  179. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +6 -5
  180. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs.map +1 -1
  181. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +6 -5
  182. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs.map +1 -1
  183. package/dist/astro/routes/api/widget-areas/_name_.mjs +4 -3
  184. package/dist/astro/routes/api/widget-areas/_name_.mjs.map +1 -1
  185. package/dist/astro/routes/api/widget-areas/index.mjs +6 -5
  186. package/dist/astro/routes/api/widget-areas/index.mjs.map +1 -1
  187. package/dist/astro/routes/api/widget-components.mjs +1 -1
  188. package/dist/astro/routes/robots.txt.mjs +3 -3
  189. package/dist/astro/routes/sitemap-_collection_.xml.d.mts.map +1 -1
  190. package/dist/astro/routes/sitemap-_collection_.xml.mjs +12 -5
  191. package/dist/astro/routes/sitemap-_collection_.xml.mjs.map +1 -1
  192. package/dist/astro/routes/sitemap.xml.mjs +4 -4
  193. package/dist/astro/types.d.mts +12 -12
  194. package/dist/auth/providers/github.d.mts +1 -1
  195. package/dist/auth/providers/google.d.mts +1 -1
  196. package/dist/{authorize-C_8t2KGa.mjs → authorize-DsMSVSaY.mjs} +1 -1
  197. package/dist/{authorize-C_8t2KGa.mjs.map → authorize-DsMSVSaY.mjs.map} +1 -1
  198. package/dist/{byline-fields-C_OsR-KF.mjs → byline-fields--WxSNS79.mjs} +1 -1
  199. package/dist/{byline-fields-C_OsR-KF.mjs.map → byline-fields--WxSNS79.mjs.map} +1 -1
  200. package/dist/{byline-fields-51kg6Vuv.mjs → byline-fields-8TMtkBnH.mjs} +2 -2
  201. package/dist/{byline-fields-51kg6Vuv.mjs.map → byline-fields-8TMtkBnH.mjs.map} +1 -1
  202. package/dist/{byline-fields-DYXKDuNX.d.mts → byline-fields-DbibsvTl.d.mts} +5 -1
  203. package/dist/byline-fields-DbibsvTl.d.mts.map +1 -0
  204. package/dist/{bylines-Cx5n-WqP.mjs → bylines-BdxWCnPL.mjs} +1 -1
  205. package/dist/{bylines-Cx5n-WqP.mjs.map → bylines-BdxWCnPL.mjs.map} +1 -1
  206. package/dist/{bylines-wurS258E.mjs → bylines-s8c2DXbH.mjs} +3 -3
  207. package/dist/{bylines-wurS258E.mjs.map → bylines-s8c2DXbH.mjs.map} +1 -1
  208. package/dist/{challenge-store-DGwuCc4R.mjs → challenge-store-DXX3rfdI.mjs} +1 -1
  209. package/dist/{challenge-store-DGwuCc4R.mjs.map → challenge-store-DXX3rfdI.mjs.map} +1 -1
  210. package/dist/cli/index.mjs +11 -10
  211. package/dist/cli/index.mjs.map +1 -1
  212. package/dist/client/cf-access.d.mts +1 -1
  213. package/dist/client/index.d.mts +1 -1
  214. package/dist/client/index.mjs +1 -1
  215. package/dist/{comments-CJ0RZsYR.mjs → comments-Vkivawyl.mjs} +1 -1
  216. package/dist/{comments-CJ0RZsYR.mjs.map → comments-Vkivawyl.mjs.map} +1 -1
  217. package/dist/{components-CTfpu3PZ.mjs → components-CK0cuUoH.mjs} +1 -1
  218. package/dist/{components-CTfpu3PZ.mjs.map → components-CK0cuUoH.mjs.map} +1 -1
  219. package/dist/{context-GG52SPgh.mjs → context-Y7BRkWes.mjs} +2 -2
  220. package/dist/{context-GG52SPgh.mjs.map → context-Y7BRkWes.mjs.map} +1 -1
  221. package/dist/database/instrumentation.d.mts +10 -1
  222. package/dist/database/instrumentation.d.mts.map +1 -1
  223. package/dist/database/instrumentation.mjs +13 -1
  224. package/dist/database/instrumentation.mjs.map +1 -1
  225. package/dist/db/index.d.mts +3 -3
  226. package/dist/db/libsql.d.mts +1 -1
  227. package/dist/db/postgres.d.mts +1 -1
  228. package/dist/db/sqlite.d.mts +1 -1
  229. package/dist/{default-xLFNSsZ9.mjs → default-IlBaTFxM.mjs} +1 -1
  230. package/dist/{default-xLFNSsZ9.mjs.map → default-IlBaTFxM.mjs.map} +1 -1
  231. package/dist/{device-flow-s6_q3T7A.mjs → device-flow-R23SIbQ2.mjs} +4 -4
  232. package/dist/{device-flow-s6_q3T7A.mjs.map → device-flow-R23SIbQ2.mjs.map} +1 -1
  233. package/dist/{escape-bIyGoW5W.mjs → escape-Ds07EEyu.mjs} +1 -1
  234. package/dist/{escape-bIyGoW5W.mjs.map → escape-Ds07EEyu.mjs.map} +1 -1
  235. package/dist/{index-FfiTQJq2.d.mts → index-B1keaX5Y.d.mts} +43 -12
  236. package/dist/{index-FfiTQJq2.d.mts.map → index-B1keaX5Y.d.mts.map} +1 -1
  237. package/dist/{index-BpYeJO1E.d.mts → index-DR56od45.d.mts} +3 -3
  238. package/dist/{index-BpYeJO1E.d.mts.map → index-DR56od45.d.mts.map} +1 -1
  239. package/dist/index.d.mts +16 -16
  240. package/dist/index.mjs +22 -22
  241. package/dist/{load-B84ohfBk.mjs → load-BBetCvLC.mjs} +1 -1
  242. package/dist/{load-B84ohfBk.mjs.map → load-BBetCvLC.mjs.map} +1 -1
  243. package/dist/{loader-CpZKpFz0.mjs → loader-ZN1ll-d-.mjs} +11 -14
  244. package/dist/loader-ZN1ll-d-.mjs.map +1 -0
  245. package/dist/{manifest-schema-Cj-YrzrF.mjs → manifest-schema-BtwbL_vj.mjs} +55 -2
  246. package/dist/manifest-schema-BtwbL_vj.mjs.map +1 -0
  247. package/dist/media/index.d.mts +1 -1
  248. package/dist/media/local-runtime.d.mts +11 -11
  249. package/dist/media/local-runtime.mjs +2 -2
  250. package/dist/{media-allowlist-CMcoYIjQ.mjs → media-allowlist-Dknq-OFY.mjs} +1 -1
  251. package/dist/{media-allowlist-CMcoYIjQ.mjs.map → media-allowlist-Dknq-OFY.mjs.map} +1 -1
  252. package/dist/media-url-VClf8glU.mjs +26 -0
  253. package/dist/media-url-VClf8glU.mjs.map +1 -0
  254. package/dist/{menus-Dp9xporj.mjs → menus-DrQLusqj.mjs} +6 -33
  255. package/dist/menus-DrQLusqj.mjs.map +1 -0
  256. package/dist/{mode-BjlXswIw.mjs → mode-CO2vQHfq.mjs} +1 -1
  257. package/dist/{mode-BjlXswIw.mjs.map → mode-CO2vQHfq.mjs.map} +1 -1
  258. package/dist/{oauth-authorization-1aPAYjiC.mjs → oauth-authorization-Bw4NdF_S.mjs} +4 -4
  259. package/dist/{oauth-authorization-1aPAYjiC.mjs.map → oauth-authorization-Bw4NdF_S.mjs.map} +1 -1
  260. package/dist/{oauth-clients-8mPDStMv.mjs → oauth-clients-BGGFp57s.mjs} +1 -1
  261. package/dist/{oauth-clients-8mPDStMv.mjs.map → oauth-clients-BGGFp57s.mjs.map} +1 -1
  262. package/dist/{oauth-state-store-BJ7YtrfD.mjs → oauth-state-store-97x0xtN2.mjs} +1 -1
  263. package/dist/{oauth-state-store-BJ7YtrfD.mjs.map → oauth-state-store-97x0xtN2.mjs.map} +1 -1
  264. package/dist/{oauth-user-lookup-BdDSDvjF.mjs → oauth-user-lookup-B_vnZHKO.mjs} +1 -1
  265. package/dist/{oauth-user-lookup-BdDSDvjF.mjs.map → oauth-user-lookup-B_vnZHKO.mjs.map} +1 -1
  266. package/dist/{options-D4MnavW_.d.mts → options-DyYIYpPd.d.mts} +3 -3
  267. package/dist/{options-D4MnavW_.d.mts.map → options-DyYIYpPd.d.mts.map} +1 -1
  268. package/dist/page/index.d.mts +2 -2
  269. package/dist/{passkey-config-BDVM86Tj.mjs → passkey-config-C3QgnQnU.mjs} +1 -1
  270. package/dist/{passkey-config-BDVM86Tj.mjs.map → passkey-config-C3QgnQnU.mjs.map} +1 -1
  271. package/dist/{placeholder-B9lUUEmj.d.mts → placeholder-CVBv5z8k.d.mts} +1 -1
  272. package/dist/{placeholder-B9lUUEmj.d.mts.map → placeholder-CVBv5z8k.d.mts.map} +1 -1
  273. package/dist/plugin-types.d.mts +1 -1
  274. package/dist/plugin-utils.d.mts +9 -9
  275. package/dist/plugins/adapt-sandbox-entry.d.mts +9 -9
  276. package/dist/plugins/adapt-sandbox-entry.mjs +2 -2
  277. package/dist/{public-url-egRHCy1m.mjs → public-url-BFVC2OTJ.mjs} +1 -1
  278. package/dist/{public-url-egRHCy1m.mjs.map → public-url-BFVC2OTJ.mjs.map} +1 -1
  279. package/dist/{query-BFQ029Ts.mjs → query-CbUcI4Xk.mjs} +18 -8
  280. package/dist/query-CbUcI4Xk.mjs.map +1 -0
  281. package/dist/{rate-limit-ClFFUga6.mjs → rate-limit-C7hjdkS5.mjs} +1 -1
  282. package/dist/{rate-limit-ClFFUga6.mjs.map → rate-limit-C7hjdkS5.mjs.map} +1 -1
  283. package/dist/{redirect-Cw3JTlmj.mjs → redirect-B_q19j4v.mjs} +1 -1
  284. package/dist/{redirect-Cw3JTlmj.mjs.map → redirect-B_q19j4v.mjs.map} +1 -1
  285. package/dist/{redirects-DEygMrRO.mjs → redirects-CCbCqCCd.mjs} +4 -2
  286. package/dist/redirects-CCbCqCCd.mjs.map +1 -0
  287. package/dist/{redirects-OIu6vQ2i.mjs → redirects-DxVoR7PI.mjs} +1 -1
  288. package/dist/{redirects-OIu6vQ2i.mjs.map → redirects-DxVoR7PI.mjs.map} +1 -1
  289. package/dist/request-context.d.mts +7 -0
  290. package/dist/request-context.d.mts.map +1 -1
  291. package/dist/request-context.mjs +2 -1
  292. package/dist/request-context.mjs.map +1 -1
  293. package/dist/{runner-BcRuXq_h.d.mts → runner-DTdhuI9i.d.mts} +2 -2
  294. package/dist/{runner-BcRuXq_h.d.mts.map → runner-DTdhuI9i.d.mts.map} +1 -1
  295. package/dist/runtime.d.mts +10 -10
  296. package/dist/runtime.mjs +1 -1
  297. package/dist/{schema-CS7Eg5gh.mjs → schema-C1E70ug_.mjs} +2 -2
  298. package/dist/{schema-CS7Eg5gh.mjs.map → schema-C1E70ug_.mjs.map} +1 -1
  299. package/dist/{search-o-aQzHI1.mjs → search-B3SGZw91.mjs} +2 -2
  300. package/dist/{search-o-aQzHI1.mjs.map → search-B3SGZw91.mjs.map} +1 -1
  301. package/dist/{secrets-C_ZtRos3.mjs → secrets-ChPTmy9x.mjs} +1 -1
  302. package/dist/{secrets-C_ZtRos3.mjs.map → secrets-ChPTmy9x.mjs.map} +1 -1
  303. package/dist/{sections-DhsZ0ns9.mjs → sections-D_lVzwRZ.mjs} +2 -2
  304. package/dist/{sections-DhsZ0ns9.mjs.map → sections-D_lVzwRZ.mjs.map} +1 -1
  305. package/dist/seed/index.d.mts +2 -2
  306. package/dist/seed/index.mjs +6 -6
  307. package/dist/seo/index.d.mts +1 -1
  308. package/dist/seo/index.d.mts.map +1 -1
  309. package/dist/seo/index.mjs +3 -12
  310. package/dist/seo/index.mjs.map +1 -1
  311. package/dist/{seo-DfjLvu8i.mjs → seo-D_LPkOtu.mjs} +4 -3
  312. package/dist/seo-D_LPkOtu.mjs.map +1 -0
  313. package/dist/{service-DAxg8RPR.mjs → service-ChDcsTBs.mjs} +2 -2
  314. package/dist/{service-DAxg8RPR.mjs.map → service-ChDcsTBs.mjs.map} +1 -1
  315. package/dist/{settings-DIsbHTRE.mjs → settings-Cv47v9u8.mjs} +2 -2
  316. package/dist/{settings-DIsbHTRE.mjs.map → settings-Cv47v9u8.mjs.map} +1 -1
  317. package/dist/settings-DfxiWY_s.mjs +411 -0
  318. package/dist/settings-DfxiWY_s.mjs.map +1 -0
  319. package/dist/{setup-complete-Yuv78yua.mjs → setup-complete-yvPE4OsP.mjs} +1 -1
  320. package/dist/{setup-complete-Yuv78yua.mjs.map → setup-complete-yvPE4OsP.mjs.map} +1 -1
  321. package/dist/{setup-nonce-Bm0uKqmf.mjs → setup-nonce-C9aFzb94.mjs} +1 -1
  322. package/dist/{setup-nonce-Bm0uKqmf.mjs.map → setup-nonce-C9aFzb94.mjs.map} +1 -1
  323. package/dist/{site-url-mEVmwIFi.mjs → site-url-CnHlmAs9.mjs} +1 -1
  324. package/dist/{site-url-mEVmwIFi.mjs.map → site-url-CnHlmAs9.mjs.map} +1 -1
  325. package/dist/storage/local.d.mts +1 -1
  326. package/dist/storage/s3.d.mts +1 -1
  327. package/dist/{taxonomies-UusDXv3C.mjs → taxonomies-BILwiyGk.mjs} +2 -2
  328. package/dist/{taxonomies-UusDXv3C.mjs.map → taxonomies-BILwiyGk.mjs.map} +1 -1
  329. package/dist/{taxonomies-BEW7S5AI.mjs → taxonomies-BdAmbOwx.mjs} +46 -9
  330. package/dist/taxonomies-BdAmbOwx.mjs.map +1 -0
  331. package/dist/{transport-BwQeeY2p.d.mts → transport-B7PPP2CC.d.mts} +1 -1
  332. package/dist/{transport-BwQeeY2p.d.mts.map → transport-B7PPP2CC.d.mts.map} +1 -1
  333. package/dist/{transport--Ck3RBin.mjs → transport-CmpLD7W3.mjs} +1 -1
  334. package/dist/{transport--Ck3RBin.mjs.map → transport-CmpLD7W3.mjs.map} +1 -1
  335. package/dist/{types-DWnN7weG.d.mts → types-BFgrqwSk.d.mts} +1 -1
  336. package/dist/{types-DWnN7weG.d.mts.map → types-BFgrqwSk.d.mts.map} +1 -1
  337. package/dist/{types-Qa7-HJJC.d.mts → types-BH8-30hc.d.mts} +1 -1
  338. package/dist/{types-Qa7-HJJC.d.mts.map → types-BH8-30hc.d.mts.map} +1 -1
  339. package/dist/{types-OT_Es5mp.d.mts → types-BPzXTV9x.d.mts} +1 -1
  340. package/dist/{types-OT_Es5mp.d.mts.map → types-BPzXTV9x.d.mts.map} +1 -1
  341. package/dist/{types-DbCWhHet.d.mts → types-BUUVn1zr.d.mts} +2 -2
  342. package/dist/types-BUUVn1zr.d.mts.map +1 -0
  343. package/dist/{types-DMwSpvcw.d.mts → types-CPAPl93j.d.mts} +9 -3
  344. package/dist/{types-DMwSpvcw.d.mts.map → types-CPAPl93j.d.mts.map} +1 -1
  345. package/dist/types-CZI4E3qG.mjs +3 -0
  346. package/dist/{types-kwqCOUxj.d.mts → types-D4kUqbHh.d.mts} +1 -1
  347. package/dist/{types-kwqCOUxj.d.mts.map → types-D4kUqbHh.d.mts.map} +1 -1
  348. package/dist/{types-WVmpZBJV.d.mts → types-DTniiNto.d.mts} +2 -2
  349. package/dist/{types-WVmpZBJV.d.mts.map → types-DTniiNto.d.mts.map} +1 -1
  350. package/dist/types-DZk_y-MU.mjs.map +1 -1
  351. package/dist/{types-DX6v9KzJ.d.mts → types-S15DXXNi.d.mts} +1 -1
  352. package/dist/{types-DX6v9KzJ.d.mts.map → types-S15DXXNi.d.mts.map} +1 -1
  353. package/dist/{validate-ZP9Dvg0P.mjs → validate-Bz4vqcX1.mjs} +1 -1
  354. package/dist/{validate-ZP9Dvg0P.mjs.map → validate-Bz4vqcX1.mjs.map} +1 -1
  355. package/dist/{validate-BPAHUSge.d.mts → validate-CNwkPWzz.d.mts} +5 -5
  356. package/dist/{validate-BPAHUSge.d.mts.map → validate-CNwkPWzz.d.mts.map} +1 -1
  357. package/dist/{validation-CE5i4q0c.mjs → validation-DgGTJm3u.mjs} +1 -1
  358. package/dist/{validation-CE5i4q0c.mjs.map → validation-DgGTJm3u.mjs.map} +1 -1
  359. package/dist/version-D-5txk2m.mjs +7 -0
  360. package/dist/{version-Dw0JXu45.mjs.map → version-D-5txk2m.mjs.map} +1 -1
  361. package/dist/{widgets-ClEnYQCH.mjs → widgets-DZfmAbE4.mjs} +47 -44
  362. package/dist/widgets-DZfmAbE4.mjs.map +1 -0
  363. package/package.json +10 -10
  364. package/src/api/handlers/marketplace.ts +2 -5
  365. package/src/api/handlers/registry.ts +70 -0
  366. package/src/api/handlers/seo.ts +9 -1
  367. package/src/api/schemas/schema.ts +13 -1
  368. package/src/astro/middleware.ts +20 -6
  369. package/src/astro/routes/api/schema/index.ts +7 -15
  370. package/src/astro/routes/sitemap-[collection].xml.ts +13 -2
  371. package/src/cli/commands/bundle-utils.ts +2 -0
  372. package/src/cli/commands/secrets.ts +2 -2
  373. package/src/database/instrumentation.ts +13 -0
  374. package/src/emdash-runtime.ts +31 -25
  375. package/src/loader.ts +24 -15
  376. package/src/plugins/manifest-schema.ts +75 -0
  377. package/src/plugins/marketplace.ts +2 -5
  378. package/src/plugins/types.ts +12 -0
  379. package/src/query.ts +13 -2
  380. package/src/request-context.ts +8 -0
  381. package/src/schema/types.ts +11 -1
  382. package/src/seo/index.ts +2 -28
  383. package/src/seo/media-url.ts +32 -0
  384. package/src/settings/index.ts +32 -40
  385. package/src/taxonomies/index.ts +78 -12
  386. package/src/utils/isolate-cache.ts +189 -0
  387. package/src/widgets/index.ts +57 -54
  388. package/dist/api-BZ6bhjYs.mjs.map +0 -1
  389. package/dist/byline-fields-DYXKDuNX.d.mts.map +0 -1
  390. package/dist/loader-CpZKpFz0.mjs.map +0 -1
  391. package/dist/manifest-schema-Cj-YrzrF.mjs.map +0 -1
  392. package/dist/menus-Dp9xporj.mjs.map +0 -1
  393. package/dist/query-BFQ029Ts.mjs.map +0 -1
  394. package/dist/redirects-DEygMrRO.mjs.map +0 -1
  395. package/dist/seo-DfjLvu8i.mjs.map +0 -1
  396. package/dist/settings-B1p-gPUK.mjs +0 -235
  397. package/dist/settings-B1p-gPUK.mjs.map +0 -1
  398. package/dist/taxonomies-BEW7S5AI.mjs.map +0 -1
  399. package/dist/types-Cj2S6FuC.mjs +0 -3
  400. package/dist/types-DbCWhHet.d.mts.map +0 -1
  401. package/dist/version-Dw0JXu45.mjs +0 -7
  402. package/dist/widgets-ClEnYQCH.mjs.map +0 -1
  403. /package/dist/{api-tokens-B6VgoE6M.mjs → api-tokens-Oq39ba-Z.mjs} +0 -0
package/dist/index.d.mts CHANGED
@@ -1,22 +1,22 @@
1
- import { _ as UpdateFieldInput, a as ColumnType, d as FieldType, f as FieldValidation, g as UpdateCollectionInput, h as RESERVED_FIELD_SLUGS, i as CollectionWithFields, l as FIELD_TYPE_TO_COLUMN, m as RESERVED_COLLECTION_SLUGS, n as CollectionSource, o as CreateCollectionInput, p as FieldWidgetOptions, r as CollectionSupport, s as CreateFieldInput, t as Collection, u as Field } from "./types-DbCWhHet.mjs";
2
- import { a as ContentSeo, c as EmDashValidationError, d as InvalidCursorError, f as UpdateContentInput, i as ContentItem, l as FindManyOptions, n as ContentBylineCredit, o as ContentSeoInput, s as CreateContentInput, t as BylineSummary, u as FindManyResult } from "./types-WVmpZBJV.mjs";
3
- import { d as ContentListResponse, f as ContentResponse, h as ManifestResponse, l as ApiContext, m as ListResponse, p as FieldDescriptor, t as OptionsRepository } from "./options-D4MnavW_.mjs";
4
- import { n as MediaTable, r as UserTable, t as Database } from "./types-OT_Es5mp.mjs";
5
- import { $ as PageMetadataHandler, At as normalizeCapability, B as LogAccess, F as HookName, I as HttpAccess, J as PageFragmentContribution, K as MediaUploadEvent, L as KVAccess, N as FieldWidgetConfig, Ot as isDeprecatedCapability, P as HookConfig, Q as PageMetadataEvent, St as StorageCollection, T as DeprecatedPluginCapability, V as MediaAccess, X as PageFragmentHandler, Y as PageFragmentEvent, Z as PageMetadataContribution, a as CommentAfterCreateHandler, at as PluginAdminPage, b as ContentHookEvent, bt as ResolvedPluginHooks, c as CommentBeforeCreateEvent, ct as PluginDefinition, d as CommentModerateHandler, dt as PluginRoute, f as ContentAccess, ft as PluginStorageConfig, ht as PublicPageContext, i as CommentAfterCreateEvent, it as PluginAdminExports, kt as normalizeCapabilities, l as CommentBeforeCreateHandler, lt as PluginHooks, mt as PortableTextBlockField, n as CAPABILITY_RENAMES, o as CommentAfterModerateEvent, ot as PluginCapability, pt as PortableTextBlockConfig, q as ModerationDecision, r as CollectionCommentSettings, rt as PluginAdminConfig, s as CommentAfterModerateHandler, st as PluginContext, t as BreadcrumbItem, tt as PagePlacement, u as CommentModerateEvent, ut as PluginManifest, vt as ResolvedHook, w as CurrentPluginCapability, wt as StoredComment, x as ContentPublishStateChangeEvent, xt as RouteContext, y as ContentDeleteEvent, yt as ResolvedPlugin } from "./types-DMwSpvcw.mjs";
6
- import "./byline-fields-DYXKDuNX.mjs";
7
- import { _ as MediaValue, n as generatePlaceholder, r as normalizeMediaValue, t as PlaceholderData } from "./placeholder-B9lUUEmj.mjs";
8
- import { $ as ReorderMenuItemsInput, $n as getSections, $r as MediaItem, $t as CacheHint, A as getEntriesByTerm, An as hashString, Ar as handleContentGetIncludingTrashed, At as createPluginManager, B as TaxonomyTerm, Bn as PortableTextUnknownBlock, Br as handleContentUpdate, C as ReorderWidgetsInput, Cn as WhereRange, Cr as handleContentCountScheduled, Ct as NoopSandboxRunner, D as WidgetComponentDef, Dn as isSafeHref, Dr as handleContentDiscardDraft, Dt as CronScheduler, E as WidgetArea, Er as handleContentDelete, Et as NodeCronScheduler, F as getTerm, Fn as PortableTextImageBlock, Fr as handleContentRestore, Ft as HookPipeline, G as getEntriesByByline, Gn as SandboxEmailSendCallback, Gr as FieldDefinition, H as UpdateTermInput, Hn as ProseMirrorMark, Hr as reference, I as getTermsForEntries, In as PortableTextLinkMark, Ir as handleContentSchedule, It as HookResult, J as CreateMenuInput, Jn as SandboxRunnerFactory, Jr as ImageValue, Jt as getFallbackChain, K as getMenu, Kn as SandboxOptions, Kr as FieldUIHints, Kt as definePlugin, L as invalidateTermCache, Ln as PortableTextMarkDef, Lr as handleContentTranslations, Lt as createHookPipeline, M as getTaxonomyDef, Mn as prosemirrorToPortableText, Mr as handleContentListTrashed, Mt as createHttpAccess, N as getTaxonomyDefs, Nn as PortableTextCodeBlock, Nr as handleContentPermanentDelete, Nt as createUnrestrictedHttpAccess, O as WidgetType, On as sanitizeHref, Or as handleContentDuplicate, Ot as SystemCleanupFn, P as getTaxonomyTerms, Pn as PortableTextHtmlBlock, Pr as handleContentPublish, Q as MenuItemType, Qn as getSection, Qr as CreateMediaInput, Qt as after, R as CreateTermInput, Rn as PortableTextSpan, Rr as handleContentUnpublish, Rt as ValidatedPluginManifest, S as PropDef, Sn as EntryFilter, Sr as handleContentCompare, St as verifyPreviewToken, T as Widget, Tr as handleContentCreate, Tt as createNoopSandboxRunner, U as getByline, Un as ProseMirrorNode, Ur as file, V as TaxonomyTermRow, Vn as ProseMirrorDocument, Vr as portableText, Vt as PluginDescriptor, W as getBylineBySlug, Wn as SandboxEmailMessage, Wr as image, X as Menu, Xn as SandboxedPluginInstance, Xr as PluginStorageRepository, Xt as isI18nEnabled, Y as CreateMenuItemInput, Yn as SandboxUnavailableError, Yr as PortableTextBlock, Yt as getI18nConfig, Z as MenuItem, Zn as SerializedRequest, Zr as UserRepository, Zt as WaitUntilFn, _ as getWidgetArea, _n as FieldAnnotation, _r as handleRevisionGet, _t as PreviewTokenPayload, a as search, an as EntryResult, ar as getCollectionInfo, at as getComments, b as CreateWidgetAreaInput, bn as CollectionFilter$1, br as generateManifest, bt as generatePreviewToken, c as FTSManager, cn as TranslationSummary, cr as MediaListResponse, ct as getSiteSetting, d as SearchOptions, dn as getEmDashCollection, dr as handleMediaDelete, dt as getPreviewToken, ei as MediaRepository, en as CollectionFilter, er as CreateSectionInput, et as UpdateMenuInput, f as SearchResponse, fn as getEmDashEntry, fr as handleMediaGet, ft as isPreviewRequest, g as Suggestion, gn as EditProxy, gr as RevisionResponse, gt as GeneratePreviewTokenOptions, h as SuggestOptions, hn as CMSAnnotation, hr as RevisionListResponse, ht as getPreviewUrl, i as getSuggestions, in as EmDashCollections, ir as UpdateSectionInput, it as getCommentCount, j as getEntryTerms, jn as portableTextToProsemirror, jr as handleContentList, jt as PluginRouteError, k as getAllTermsForEntries, kn as computeContentHash, kr as handleContentGet, kt as PluginManager, l as CollectionSearchOptions, ln as TranslationsResult, lr as MediaResponse, lt as getSiteSettings, m as SearchStats, mn as resolveEmDashPath, mr as handleMediaUpdate, mt as buildPreviewUrl, n as extractSearchableFields, ni as DatabaseConfig, nn as ContentEntry, nr as Section, nt as GetCommentsOptions, o as searchCollection, on as InferCollectionData, or as SchemaError, ot as getPluginSetting, p as SearchResult, pn as getTranslations, pr as handleMediaList, pt as GetPreviewUrlOptions, q as getMenus, qn as SandboxRunner, qr as FileValue, qt as I18nConfig, r as getSearchStats, ri as EmDashDatabaseError, rn as EditFieldMeta, rr as SectionSource, rt as GetCommentsResult, s as searchWithDb, sn as ResolvePathResult, sr as SchemaRegistry, st as getPluginSettings, t as extractPlainText, ti as ContentRepository, tn as CollectionResult, tr as GetSectionsOptions, tt as UpdateMenuItemInput, u as SearchConfig, un as getEditMeta, ur as handleMediaCreate, ut as setSiteSettings, v as getWidgetAreas, vn as createEditable, vr as handleRevisionList, vt as VerifyPreviewTokenOptions, w as UpdateWidgetInput, wn as WhereValue, wr as handleContentCountTrashed, wt as SandboxNotAvailableError, x as CreateWidgetInput, xn as EntryData, xr as handleContentAuthors, xt as parseContentId, y as getWidgetComponents, yn as createNoop, yr as handleRevisionRestore, yt as VerifyPreviewTokenResult, z as TaxonomyDef, zn as PortableTextTextBlock, zr as handleContentUnschedule, zt as pluginManifestSchema } from "./index-FfiTQJq2.mjs";
9
- import { n as getMigrationStatus, t as MigrationStatus } from "./runner-BcRuXq_h.mjs";
10
- import { S as decodeSlug, _ as WxrSite, a as getAllSources, b as parseWxr, c as getUrlSources, d as importReusableBlocksAsSections, f as WxrAttachment, g as WxrPost, h as WxrData, i as clearSources, l as probeUrl, m as WxrCategory, n as parseWxrDate, o as getFileSources, p as WxrAuthor, r as wxrSource, s as getSource, t as wordpressRestSource, u as registerSource, v as WxrTag, x as parseWxrString, y as WxrTerm } from "./index-BpYeJO1E.mjs";
11
- import { i as SiteSettings, n as SeoSettings, r as SiteSettingKey, t as MediaReference } from "./types-DX6v9KzJ.mjs";
12
- import { a as ListOptions, c as S3StorageConfig, d as Storage, f as StorageDescriptor, i as FileInfo, l as SignedUploadOptions, n as DownloadResult, o as ListResult, p as UploadResult, r as EmDashStorageError, s as LocalStorageConfig, t as CreateStorageFn, u as SignedUploadUrl } from "./types-kwqCOUxj.mjs";
1
+ import { _ as UpdateFieldInput, a as ColumnType, d as FieldType, f as FieldValidation, g as UpdateCollectionInput, h as RESERVED_FIELD_SLUGS, i as CollectionWithFields, l as FIELD_TYPE_TO_COLUMN, m as RESERVED_COLLECTION_SLUGS, n as CollectionSource, o as CreateCollectionInput, p as FieldWidgetOptions, r as CollectionSupport, s as CreateFieldInput, t as Collection, u as Field } from "./types-BUUVn1zr.mjs";
2
+ import { a as ContentSeo, c as EmDashValidationError, d as InvalidCursorError, f as UpdateContentInput, i as ContentItem, l as FindManyOptions, n as ContentBylineCredit, o as ContentSeoInput, s as CreateContentInput, t as BylineSummary, u as FindManyResult } from "./types-DTniiNto.mjs";
3
+ import { d as ContentListResponse, f as ContentResponse, h as ManifestResponse, l as ApiContext, m as ListResponse, p as FieldDescriptor, t as OptionsRepository } from "./options-DyYIYpPd.mjs";
4
+ import { n as MediaTable, r as UserTable, t as Database } from "./types-BPzXTV9x.mjs";
5
+ import { $ as PageMetadataHandler, At as normalizeCapability, B as LogAccess, F as HookName, I as HttpAccess, J as PageFragmentContribution, K as MediaUploadEvent, L as KVAccess, N as FieldWidgetConfig, Ot as isDeprecatedCapability, P as HookConfig, Q as PageMetadataEvent, St as StorageCollection, T as DeprecatedPluginCapability, V as MediaAccess, X as PageFragmentHandler, Y as PageFragmentEvent, Z as PageMetadataContribution, a as CommentAfterCreateHandler, at as PluginAdminPage, b as ContentHookEvent, bt as ResolvedPluginHooks, c as CommentBeforeCreateEvent, ct as PluginDefinition, d as CommentModerateHandler, dt as PluginRoute, f as ContentAccess, ft as PluginStorageConfig, ht as PublicPageContext, i as CommentAfterCreateEvent, it as PluginAdminExports, kt as normalizeCapabilities, l as CommentBeforeCreateHandler, lt as PluginHooks, mt as PortableTextBlockField, n as CAPABILITY_RENAMES, o as CommentAfterModerateEvent, ot as PluginCapability, pt as PortableTextBlockConfig, q as ModerationDecision, r as CollectionCommentSettings, rt as PluginAdminConfig, s as CommentAfterModerateHandler, st as PluginContext, t as BreadcrumbItem, tt as PagePlacement, u as CommentModerateEvent, ut as PluginManifest, vt as ResolvedHook, w as CurrentPluginCapability, wt as StoredComment, x as ContentPublishStateChangeEvent, xt as RouteContext, y as ContentDeleteEvent, yt as ResolvedPlugin } from "./types-CPAPl93j.mjs";
6
+ import "./byline-fields-DbibsvTl.mjs";
7
+ import { _ as MediaValue, n as generatePlaceholder, r as normalizeMediaValue, t as PlaceholderData } from "./placeholder-CVBv5z8k.mjs";
8
+ import { $ as ReorderMenuItemsInput, $n as getSections, $r as MediaItem, $t as CacheHint, A as getEntriesByTerm, An as hashString, Ar as handleContentGetIncludingTrashed, At as createPluginManager, B as TaxonomyTerm, Bn as PortableTextUnknownBlock, Br as handleContentUpdate, C as ReorderWidgetsInput, Cn as WhereRange, Cr as handleContentCountScheduled, Ct as NoopSandboxRunner, D as WidgetComponentDef, Dn as isSafeHref, Dr as handleContentDiscardDraft, Dt as CronScheduler, E as WidgetArea, Er as handleContentDelete, Et as NodeCronScheduler, F as getTerm, Fn as PortableTextImageBlock, Fr as handleContentRestore, Ft as HookPipeline, G as getEntriesByByline, Gn as SandboxEmailSendCallback, Gr as FieldDefinition, H as UpdateTermInput, Hn as ProseMirrorMark, Hr as reference, I as getTermsForEntries, In as PortableTextLinkMark, Ir as handleContentSchedule, It as HookResult, J as CreateMenuInput, Jn as SandboxRunnerFactory, Jr as ImageValue, Jt as getFallbackChain, K as getMenu, Kn as SandboxOptions, Kr as FieldUIHints, Kt as definePlugin, L as invalidateTermCache, Ln as PortableTextMarkDef, Lr as handleContentTranslations, Lt as createHookPipeline, M as getTaxonomyDef, Mn as prosemirrorToPortableText, Mr as handleContentListTrashed, Mt as createHttpAccess, N as getTaxonomyDefs, Nn as PortableTextCodeBlock, Nr as handleContentPermanentDelete, Nt as createUnrestrictedHttpAccess, O as WidgetType, On as sanitizeHref, Or as handleContentDuplicate, Ot as SystemCleanupFn, P as getTaxonomyTerms, Pn as PortableTextHtmlBlock, Pr as handleContentPublish, Q as MenuItemType, Qn as getSection, Qr as CreateMediaInput, Qt as after, R as CreateTermInput, Rn as PortableTextSpan, Rr as handleContentUnpublish, Rt as ValidatedPluginManifest, S as PropDef, Sn as EntryFilter, Sr as handleContentCompare, St as verifyPreviewToken, T as Widget, Tr as handleContentCreate, Tt as createNoopSandboxRunner, U as getByline, Un as ProseMirrorNode, Ur as file, V as TaxonomyTermRow, Vn as ProseMirrorDocument, Vr as portableText, Vt as PluginDescriptor, W as getBylineBySlug, Wn as SandboxEmailMessage, Wr as image, X as Menu, Xn as SandboxedPluginInstance, Xr as PluginStorageRepository, Xt as isI18nEnabled, Y as CreateMenuItemInput, Yn as SandboxUnavailableError, Yr as PortableTextBlock, Yt as getI18nConfig, Z as MenuItem, Zn as SerializedRequest, Zr as UserRepository, Zt as WaitUntilFn, _ as getWidgetArea, _n as FieldAnnotation, _r as handleRevisionGet, _t as PreviewTokenPayload, a as search, an as EntryResult, ar as getCollectionInfo, at as getComments, b as CreateWidgetAreaInput, bn as CollectionFilter$1, br as generateManifest, bt as generatePreviewToken, c as FTSManager, cn as TranslationSummary, cr as MediaListResponse, ct as getSiteSetting, d as SearchOptions, dn as getEmDashCollection, dr as handleMediaDelete, dt as getPreviewToken, ei as MediaRepository, en as CollectionFilter, er as CreateSectionInput, et as UpdateMenuInput, f as SearchResponse, fn as getEmDashEntry, fr as handleMediaGet, ft as isPreviewRequest, g as Suggestion, gn as EditProxy, gr as RevisionResponse, gt as GeneratePreviewTokenOptions, h as SuggestOptions, hn as CMSAnnotation, hr as RevisionListResponse, ht as getPreviewUrl, i as getSuggestions, in as EmDashCollections, ir as UpdateSectionInput, it as getCommentCount, j as getEntryTerms, jn as portableTextToProsemirror, jr as handleContentList, jt as PluginRouteError, k as getAllTermsForEntries, kn as computeContentHash, kr as handleContentGet, kt as PluginManager, l as CollectionSearchOptions, ln as TranslationsResult, lr as MediaResponse, lt as getSiteSettings, m as SearchStats, mn as resolveEmDashPath, mr as handleMediaUpdate, mt as buildPreviewUrl, n as extractSearchableFields, ni as DatabaseConfig, nn as ContentEntry, nr as Section, nt as GetCommentsOptions, o as searchCollection, on as InferCollectionData, or as SchemaError, ot as getPluginSetting, p as SearchResult, pn as getTranslations, pr as handleMediaList, pt as GetPreviewUrlOptions, q as getMenus, qn as SandboxRunner, qr as FileValue, qt as I18nConfig, r as getSearchStats, ri as EmDashDatabaseError, rn as EditFieldMeta, rr as SectionSource, rt as GetCommentsResult, s as searchWithDb, sn as ResolvePathResult, sr as SchemaRegistry, st as getPluginSettings, t as extractPlainText, ti as ContentRepository, tn as CollectionResult, tr as GetSectionsOptions, tt as UpdateMenuItemInput, u as SearchConfig, un as getEditMeta, ur as handleMediaCreate, ut as setSiteSettings, v as getWidgetAreas, vn as createEditable, vr as handleRevisionList, vt as VerifyPreviewTokenOptions, w as UpdateWidgetInput, wn as WhereValue, wr as handleContentCountTrashed, wt as SandboxNotAvailableError, x as CreateWidgetInput, xn as EntryData, xr as handleContentAuthors, xt as parseContentId, y as getWidgetComponents, yn as createNoop, yr as handleRevisionRestore, yt as VerifyPreviewTokenResult, z as TaxonomyDef, zn as PortableTextTextBlock, zr as handleContentUnschedule, zt as pluginManifestSchema } from "./index-B1keaX5Y.mjs";
9
+ import { n as getMigrationStatus, t as MigrationStatus } from "./runner-DTdhuI9i.mjs";
10
+ import { S as decodeSlug, _ as WxrSite, a as getAllSources, b as parseWxr, c as getUrlSources, d as importReusableBlocksAsSections, f as WxrAttachment, g as WxrPost, h as WxrData, i as clearSources, l as probeUrl, m as WxrCategory, n as parseWxrDate, o as getFileSources, p as WxrAuthor, r as wxrSource, s as getSource, t as wordpressRestSource, u as registerSource, v as WxrTag, x as parseWxrString, y as WxrTerm } from "./index-DR56od45.mjs";
11
+ import { i as SiteSettings, n as SeoSettings, r as SiteSettingKey, t as MediaReference } from "./types-S15DXXNi.mjs";
12
+ import { a as ListOptions, c as S3StorageConfig, d as Storage, f as StorageDescriptor, i as FileInfo, l as SignedUploadOptions, n as DownloadResult, o as ListResult, p as UploadResult, r as EmDashStorageError, s as LocalStorageConfig, t as CreateStorageFn, u as SignedUploadUrl } from "./types-D4kUqbHh.mjs";
13
13
  import { EmDashRequestContext, getRequestContext, runWithContext } from "./request-context.mjs";
14
- import { a as AuthResult, i as AuthProviderModule, n as AuthProviderAdminExports, o as AuthRouteDescriptor, r as AuthProviderDescriptor, s as ExternalAuthConfig, t as AuthDescriptor } from "./types-Qa7-HJJC.mjs";
15
- import { a as SqliteConfig, i as PostgresConfig, n as DatabaseDialectType, r as LibsqlConfig, t as DatabaseDescriptor } from "./adapters-C5AWLJSD.mjs";
14
+ import { a as AuthResult, i as AuthProviderModule, n as AuthProviderAdminExports, o as AuthRouteDescriptor, r as AuthProviderDescriptor, s as ExternalAuthConfig, t as AuthDescriptor } from "./types-BH8-30hc.mjs";
15
+ import { a as SqliteConfig, i as PostgresConfig, n as DatabaseDialectType, r as LibsqlConfig, t as DatabaseDescriptor } from "./adapters-BzIHV3sw.mjs";
16
16
  import { adaptSandboxEntry } from "./plugins/adapt-sandbox-entry.mjs";
17
- import { S as UrlInput, _ as SourceAuth, a as FileInput, b as SourceProbeResult, c as ImportContext, d as ImportSource, f as NormalizedItem, g as ProbeResult, h as PostTypeMapping, i as FieldCompatibility, l as ImportFieldDef, m as PostTypeAnalysis, n as CollectionSchemaStatus, o as ImportAnalysis, p as OAuthInput, r as FetchOptions, s as ImportConfig, t as AttachmentInfo, u as ImportResult, v as SourceCapabilities, x as SuggestedAction, y as SourceInput } from "./types-DWnN7weG.mjs";
17
+ import { S as UrlInput, _ as SourceAuth, a as FileInput, b as SourceProbeResult, c as ImportContext, d as ImportSource, f as NormalizedItem, g as ProbeResult, h as PostTypeMapping, i as FieldCompatibility, l as ImportFieldDef, m as PostTypeAnalysis, n as CollectionSchemaStatus, o as ImportAnalysis, p as OAuthInput, r as FetchOptions, s as ImportConfig, t as AttachmentInfo, u as ImportResult, v as SourceCapabilities, x as SuggestedAction, y as SourceInput } from "./types-BFgrqwSk.mjs";
18
18
  import { SeoMeta, SeoMetaOptions, getContentSeo, getSeoMeta } from "./seo/index.mjs";
19
- import { _ as SeedTaxonomyTerm, a as applySeed, b as ValidationResult, c as SeedCollection, d as SeedFile, f as SeedMenu, g as SeedTaxonomy, l as SeedContentEntry, o as SeedApplyOptions, p as SeedMenuItem, s as SeedApplyResult, t as validateSeed, u as SeedField, v as SeedWidget, y as SeedWidgetArea } from "./validate-BPAHUSge.mjs";
19
+ import { _ as SeedTaxonomyTerm, a as applySeed, b as ValidationResult, c as SeedCollection, d as SeedFile, f as SeedMenu, g as SeedTaxonomy, l as SeedContentEntry, o as SeedApplyOptions, p as SeedMenuItem, s as SeedApplyResult, t as validateSeed, u as SeedField, v as SeedWidget, y as SeedWidgetArea } from "./validate-CNwkPWzz.mjs";
20
20
  import "./seed/index.mjs";
21
21
  import { ulid } from "ulidx";
22
22
  export { type ApiContext, type AttachmentInfo, type AuthDescriptor, type AuthProviderAdminExports, type AuthProviderDescriptor, type AuthProviderModule, type AuthResult, type AuthRouteDescriptor, type BreadcrumbItem, type BylineSummary, CAPABILITY_RENAMES, type CMSAnnotation, type CacheHint, type Collection, type CollectionCommentSettings, type CollectionFilter, type CollectionResult, type CollectionSchemaStatus, type CollectionSearchOptions, type CollectionSource, type CollectionSupport, type CollectionWithFields, type ColumnType, type CommentAfterCreateEvent, type CommentAfterCreateHandler, type CommentAfterModerateEvent, type CommentAfterModerateHandler, type CommentBeforeCreateEvent, type CommentBeforeCreateHandler, type CommentModerateEvent, type CommentModerateHandler, type ContentAccess, type ContentBylineCredit, type ContentDeleteEvent, type ContentEntry, type ContentHookEvent, type ContentItem, type ContentListResponse, type ContentPublishStateChangeEvent, ContentRepository, type ContentResponse, type ContentSeo, type ContentSeoInput, type CreateCollectionInput, type CreateContentInput, type CreateFieldInput, type CreateMediaInput, type CreateMenuInput, type CreateMenuItemInput, type CreateSectionInput, type CreateStorageFn, type CreateTermInput, type CreateWidgetAreaInput, type CreateWidgetInput, type CronScheduler, type CurrentPluginCapability, type Database, type DatabaseConfig, type DatabaseDescriptor, type DatabaseDialectType, type DeprecatedPluginCapability, type DownloadResult, type EditFieldMeta, type EditProxy, type EmDashCollections, EmDashDatabaseError, type EmDashRequestContext, EmDashStorageError, EmDashValidationError, type EntryData, type EntryFilter, type EntryResult, type ExternalAuthConfig, FIELD_TYPE_TO_COLUMN, FTSManager, type FetchOptions, type Field, type FieldAnnotation, type FieldCompatibility, type FieldDefinition, type FieldDescriptor, type FieldType, type FieldUIHints, type FieldValidation, type FieldWidgetConfig, type FieldWidgetOptions, type FileInfo, type FileInput, type FileValue, type FindManyOptions, type FindManyResult, type GeneratePreviewTokenOptions, type GetCommentsOptions, type GetCommentsResult, type GetPreviewUrlOptions, type GetSectionsOptions, type HookConfig, type HookName, HookPipeline, type HookResult, type HttpAccess, type I18nConfig, type ImageValue, type ImportAnalysis, type ImportConfig, type ImportContext, type ImportFieldDef, type ImportResult, type ImportSource, type InferCollectionData, InvalidCursorError, type KVAccess, type LibsqlConfig, type ListOptions, type ListResponse, type ListResult, type CollectionFilter$1 as LoaderCollectionFilter, type LocalStorageConfig, type LogAccess, type ManifestResponse, type MediaAccess, type MediaItem, type MediaListResponse, type MediaReference, MediaRepository, type MediaResponse, type MediaTable, type MediaUploadEvent, type MediaValue, type Menu, type MenuItem, type MenuItemType, type MigrationStatus, type ModerationDecision, NodeCronScheduler, NoopSandboxRunner, type NormalizedItem, type OAuthInput, OptionsRepository, type PageFragmentContribution, type PageFragmentEvent, type PageFragmentHandler, type PageMetadataContribution, type PageMetadataEvent, type PageMetadataHandler, type PagePlacement, type PlaceholderData, type PluginAdminConfig, type PluginAdminExports, type PluginAdminPage, type PluginCapability, type PluginContext, type PluginDefinition, type PluginDescriptor, type PluginHooks, PluginManager, type PluginManifest, type PluginRoute, PluginRouteError, type PluginStorageConfig, PluginStorageRepository, type PortableTextBlock, type PortableTextBlockConfig, type PortableTextBlockField, type PortableTextCodeBlock, type PortableTextHtmlBlock, type PortableTextImageBlock, type PortableTextLinkMark, type PortableTextMarkDef, type PortableTextSpan, type PortableTextTextBlock, type PortableTextUnknownBlock, type PostTypeAnalysis, type PostTypeMapping, type PostgresConfig, type PreviewTokenPayload, type ProbeResult, type PropDef, type ProseMirrorDocument, type ProseMirrorMark, type ProseMirrorNode, type PublicPageContext, RESERVED_COLLECTION_SLUGS, RESERVED_FIELD_SLUGS, type ReorderMenuItemsInput, type ReorderWidgetsInput, type ResolvePathResult, type ResolvedHook, type ResolvedPlugin, type ResolvedPluginHooks, type RevisionListResponse, type RevisionResponse, type RouteContext, type S3StorageConfig, type SandboxEmailMessage, type SandboxEmailSendCallback, SandboxNotAvailableError, type SandboxOptions, type SandboxRunner, type SandboxRunnerFactory, SandboxUnavailableError, type SandboxedPluginInstance, SchemaError, SchemaRegistry, type SearchConfig, type SearchOptions, type SearchResponse, type SearchResult, type SearchStats, type Section, type SectionSource, type SeedApplyOptions, type SeedApplyResult, type SeedCollection, type SeedContentEntry, type SeedField, type SeedFile, type SeedMenu, type SeedMenuItem, type SeedTaxonomy, type SeedTaxonomyTerm, type SeedWidget, type SeedWidgetArea, type SeoMeta, type SeoMetaOptions, type SeoSettings, type SerializedRequest, type SignedUploadOptions, type SignedUploadUrl, type SiteSettingKey, type SiteSettings, type SourceAuth, type SourceCapabilities, type SourceInput, type SourceProbeResult, type SqliteConfig, type Storage, type StorageCollection, type StorageDescriptor, type StoredComment, type SuggestOptions, type SuggestedAction, type Suggestion, type SystemCleanupFn, type TaxonomyDef, type TaxonomyTerm, type TaxonomyTermRow, type TranslationSummary, type TranslationsResult, type UpdateCollectionInput, type UpdateContentInput, type UpdateFieldInput, type UpdateMenuInput, type UpdateMenuItemInput, type UpdateSectionInput, type UpdateTermInput, type UpdateWidgetInput, type UploadResult, type UrlInput, UserRepository, type UserTable, type ValidatedPluginManifest, type ValidationResult, type VerifyPreviewTokenOptions, type VerifyPreviewTokenResult, type WaitUntilFn, type WhereRange, type WhereValue, type Widget, type WidgetArea, type WidgetComponentDef, type WidgetType, type WxrAttachment, type WxrAuthor, type WxrCategory, type WxrData, type WxrPost, type WxrSite, type WxrTag, type WxrTerm, adaptSandboxEntry, after, applySeed, buildPreviewUrl, clearSources, computeContentHash, createEditable, createHookPipeline, createHttpAccess, createNoop, createNoopSandboxRunner, createPluginManager, createUnrestrictedHttpAccess, decodeSlug, definePlugin, extractPlainText, extractSearchableFields, file, generateManifest, generatePlaceholder, generatePreviewToken, getAllSources, getAllTermsForEntries, getByline, getBylineBySlug, getCollectionInfo, getCommentCount, getComments, getContentSeo, getEditMeta, getEmDashCollection, getEmDashEntry, getEntriesByByline, getEntriesByTerm, getEntryTerms, getFallbackChain, getFileSources, getI18nConfig, getMenu, getMenus, getMigrationStatus, getPluginSetting, getPluginSettings, getPreviewToken, getPreviewUrl, getRequestContext, getSearchStats, getSection, getSections, getSeoMeta, getSiteSetting, getSiteSettings, getSource, getSuggestions, getTaxonomyDef, getTaxonomyDefs, getTaxonomyTerms, getTerm, getTermsForEntries, getTranslations, getUrlSources, getWidgetArea, getWidgetAreas, getWidgetComponents, handleContentAuthors, handleContentCompare, handleContentCountScheduled, handleContentCountTrashed, handleContentCreate, handleContentDelete, handleContentDiscardDraft, handleContentDuplicate, handleContentGet, handleContentGetIncludingTrashed, handleContentList, handleContentListTrashed, handleContentPermanentDelete, handleContentPublish, handleContentRestore, handleContentSchedule, handleContentTranslations, handleContentUnpublish, handleContentUnschedule, handleContentUpdate, handleMediaCreate, handleMediaDelete, handleMediaGet, handleMediaList, handleMediaUpdate, handleRevisionGet, handleRevisionList, handleRevisionRestore, hashString, image, importReusableBlocksAsSections, invalidateTermCache, isDeprecatedCapability, isI18nEnabled, isPreviewRequest, isSafeHref, normalizeCapabilities, normalizeCapability, normalizeMediaValue, parseContentId, parseWxr, parseWxrDate, parseWxrString, pluginManifestSchema, portableText, portableTextToProsemirror, probeUrl, prosemirrorToPortableText, reference, registerSource, resolveEmDashPath, runWithContext, sanitizeHref, search, searchCollection, searchWithDb, setSiteSettings, ulid, validateSeed, verifyPreviewToken, wordpressRestSource, wxrSource };
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ import { n as getMigrationStatus } from "./runner--4wMWwKM.mjs";
2
2
  import { t as EmDashDatabaseError } from "./errors-9P_FDrJ_.mjs";
3
3
  import "./dialect-helpers-DRI5pyY3.mjs";
4
4
  import { n as getI18nConfig, r as isI18nEnabled, t as getFallbackChain } from "./config-CVssduLe.mjs";
5
- import { C as reference, S as portableText, T as image, a as SandboxUnavailableError, b as portableTextToProsemirror, c as createNoopSandboxRunner, d as createPluginManager, f as PluginRouteError, g as createHookPipeline, h as HookPipeline, i as getComments, l as NodeCronScheduler, n as getMenus, o as NoopSandboxRunner, r as getCommentCount, s as SandboxNotAvailableError, t as getMenu, u as PluginManager, v as definePlugin, w as file, x as prosemirrorToPortableText, y as after } from "./menus-Dp9xporj.mjs";
5
+ import { C as file, S as reference, a as SandboxUnavailableError, b as prosemirrorToPortableText, c as createNoopSandboxRunner, d as createPluginManager, f as PluginRouteError, g as createHookPipeline, h as HookPipeline, i as getComments, l as NodeCronScheduler, n as getMenus, o as NoopSandboxRunner, r as getCommentCount, s as SandboxNotAvailableError, t as getMenu, u as PluginManager, v as definePlugin, w as image, x as portableText, y as portableTextToProsemirror } from "./menus-DrQLusqj.mjs";
6
6
  import { t as decodeSlug } from "./slugify-Cjh1ssOZ.mjs";
7
7
  import { t as ContentRepository } from "./content-BIlVx-RX.mjs";
8
8
  import "./base64-CqR-7kqF.mjs";
@@ -12,7 +12,7 @@ import { t as UserRepository } from "./user-C0um7wrg.mjs";
12
12
  import "./taxonomy-CdllE4oq.mjs";
13
13
  import "./comment-sqQxNpN3.mjs";
14
14
  import { t as OptionsRepository } from "./options-BPCVnesz.mjs";
15
- import { a as PluginStorageRepository, i as createUnrestrictedHttpAccess, n as createHttpAccess } from "./context-GG52SPgh.mjs";
15
+ import { a as PluginStorageRepository, i as createUnrestrictedHttpAccess, n as createHttpAccess } from "./context-Y7BRkWes.mjs";
16
16
  import "./menus-DX4_E01q.mjs";
17
17
  import "./redirect-CRWIt8Zj.mjs";
18
18
  import { getRequestContext, runWithContext } from "./request-context.mjs";
@@ -23,30 +23,30 @@ import "./byline-DUx48sJp.mjs";
23
23
  import { n as normalizeMediaValue } from "./normalize-CK5o04zr.mjs";
24
24
  import { t as generatePlaceholder } from "./placeholder-BZxr8W1j.mjs";
25
25
  import "./seo-B5e6y9Wk.mjs";
26
- import { $ as handleContentGet, B as handleMediaUpdate, G as handleContentAuthors, H as handleRevisionList, I as handleMediaCreate, J as handleContentCountTrashed, K as handleContentCompare, L as handleMediaDelete, Q as handleContentDuplicate, R as handleMediaGet, U as handleRevisionRestore, V as handleRevisionGet, W as generateManifest, X as handleContentDelete, Y as handleContentCreate, Z as handleContentDiscardDraft, at as handleContentRestore, ct as handleContentUnpublish, et as handleContentGetIncludingTrashed, it as handleContentPublish, lt as handleContentUnschedule, nt as handleContentListTrashed, ot as handleContentSchedule, q as handleContentCountScheduled, rt as handleContentPermanentDelete, st as handleContentTranslations, tt as handleContentList, ut as handleContentUpdate, z as handleMediaList } from "./api-BZ6bhjYs.mjs";
26
+ import { $ as handleContentGet, B as handleMediaUpdate, G as handleContentAuthors, H as handleRevisionList, I as handleMediaCreate, J as handleContentCountTrashed, K as handleContentCompare, L as handleMediaDelete, Q as handleContentDuplicate, R as handleMediaGet, U as handleRevisionRestore, V as handleRevisionGet, W as generateManifest, X as handleContentDelete, Y as handleContentCreate, Z as handleContentDiscardDraft, at as handleContentRestore, ct as handleContentUnpublish, et as handleContentGetIncludingTrashed, it as handleContentPublish, lt as handleContentUnschedule, nt as handleContentListTrashed, ot as handleContentSchedule, q as handleContentCountScheduled, rt as handleContentPermanentDelete, st as handleContentTranslations, tt as handleContentList, ut as handleContentUpdate, z as handleMediaList } from "./api-DStv36ik.mjs";
27
27
  import "./dashboard-2JgAMWxK.mjs";
28
28
  import { n as hashString, t as computeContentHash } from "./hash-9w3pd3-m.mjs";
29
29
  import { t as FTSManager } from "./fts-manager-1RgHmopc.mjs";
30
30
  import { n as SchemaRegistry, t as SchemaError } from "./registry-brYh-rAT.mjs";
31
- import "./loader-CpZKpFz0.mjs";
32
- import { n as getCollectionInfo } from "./schema-CS7Eg5gh.mjs";
31
+ import "./loader-ZN1ll-d-.mjs";
32
+ import { n as getCollectionInfo } from "./schema-C1E70ug_.mjs";
33
33
  import "./zod-generator-Djo_VHCt.mjs";
34
- import "./seo-DfjLvu8i.mjs";
35
- import { o as getSection, s as getSections } from "./sections-DhsZ0ns9.mjs";
36
- import { i as getSiteSettings, n as getPluginSettings, r as getSiteSetting, s as setSiteSettings, t as getPluginSetting } from "./settings-B1p-gPUK.mjs";
37
- import "./settings-DIsbHTRE.mjs";
34
+ import "./seo-D_LPkOtu.mjs";
35
+ import { o as getSection, s as getSections } from "./sections-D_lVzwRZ.mjs";
36
+ import { f as after, i as getSiteSettings, n as getPluginSettings, r as getSiteSetting, s as setSiteSettings, t as getPluginSetting } from "./settings-DfxiWY_s.mjs";
37
+ import "./settings-Cv47v9u8.mjs";
38
38
  import "./resolve-BqYMVG0D.mjs";
39
- import { a as getTaxonomyDefs, c as getTermsForEntries, i as getTaxonomyDef, l as invalidateTermCache, n as getEntriesByTerm, o as getTaxonomyTerms, r as getEntryTerms, s as getTerm, t as getAllTermsForEntries } from "./taxonomies-BEW7S5AI.mjs";
40
- import "./taxonomies-UusDXv3C.mjs";
41
- import { i as pluginManifestSchema } from "./manifest-schema-Cj-YrzrF.mjs";
42
- import { i as normalizeCapability, n as isDeprecatedCapability, r as normalizeCapabilities, t as CAPABILITY_RENAMES } from "./types-Cj2S6FuC.mjs";
39
+ import { a as getTaxonomyDefs, c as getTermsForEntries, i as getTaxonomyDef, l as invalidateTermCache, n as getEntriesByTerm, o as getTaxonomyTerms, r as getEntryTerms, s as getTerm, t as getAllTermsForEntries } from "./taxonomies-BdAmbOwx.mjs";
40
+ import "./taxonomies-BILwiyGk.mjs";
41
+ import { i as pluginManifestSchema } from "./manifest-schema-BtwbL_vj.mjs";
42
+ import { a as normalizeCapabilities, i as isDeprecatedCapability, o as normalizeCapability, t as CAPABILITY_RENAMES } from "./types-CZI4E3qG.mjs";
43
43
  import { t as EmDashStorageError } from "./types-DpFmlNyB.mjs";
44
44
  import "./ssrf-BsVGIE0Z.mjs";
45
45
  import "./error-RwM4dD35.mjs";
46
46
  import "./parse-CrGndy1A.mjs";
47
- import { dt as sanitizeHref, ut as isSafeHref } from "./redirects-DEygMrRO.mjs";
48
- import "./byline-fields-51kg6Vuv.mjs";
49
- import { c as createEditable, i as getTranslations, l as createNoop, n as getEmDashCollection, r as getEmDashEntry, s as resolveEmDashPath, t as getEditMeta } from "./query-BFQ029Ts.mjs";
47
+ import { dt as sanitizeHref, ut as isSafeHref } from "./redirects-CCbCqCCd.mjs";
48
+ import "./byline-fields-8TMtkBnH.mjs";
49
+ import { c as createEditable, i as getTranslations, l as createNoop, n as getEmDashCollection, r as getEmDashEntry, s as resolveEmDashPath, t as getEditMeta } from "./query-CbUcI4Xk.mjs";
50
50
  import { a as getAllSources, c as getUrlSources, d as importReusableBlocksAsSections, f as parseWxr, i as clearSources, l as probeUrl, n as parseWxrDate, o as getFileSources, p as parseWxrString, r as wxrSource, s as getSource, t as wordpressRestSource, u as registerSource } from "./import-Dh8bWmyq.mjs";
51
51
  import { adaptSandboxEntry } from "./plugins/adapt-sandbox-entry.mjs";
52
52
  import "./ssrf-BvgVcfNQ.mjs";
@@ -56,13 +56,13 @@ import "./utils-C4Ih4DML.mjs";
56
56
  import { n as parseContentId, r as verifyPreviewToken, t as generatePreviewToken } from "./tokens-Bx2afeT-.mjs";
57
57
  import { i as getPreviewUrl, n as isPreviewRequest, r as buildPreviewUrl, t as getPreviewToken } from "./preview-BfuRkVKW.mjs";
58
58
  import { getContentSeo, getSeoMeta } from "./seo/index.mjs";
59
- import { i as getEntriesByByline, n as getByline, r as getBylineBySlug } from "./bylines-wurS258E.mjs";
60
- import { n as getWidgetAreas, r as getWidgetComponents, t as getWidgetArea } from "./widgets-ClEnYQCH.mjs";
61
- import { t as validateSeed } from "./validate-ZP9Dvg0P.mjs";
62
- import { t as applySeed } from "./apply-hQkKKBCf.mjs";
63
- import "./load-B84ohfBk.mjs";
59
+ import { i as getEntriesByByline, n as getByline, r as getBylineBySlug } from "./bylines-s8c2DXbH.mjs";
60
+ import { n as getWidgetAreas, r as getWidgetComponents, t as getWidgetArea } from "./widgets-DZfmAbE4.mjs";
61
+ import { t as validateSeed } from "./validate-Bz4vqcX1.mjs";
62
+ import { t as applySeed } from "./apply-Dr7snAMT.mjs";
63
+ import "./load-BBetCvLC.mjs";
64
64
  import "./seed/index.mjs";
65
- import { a as getSuggestions, c as searchWithDb, i as getSearchStats, n as extractPlainText, o as search, r as extractSearchableFields, s as searchCollection } from "./search-o-aQzHI1.mjs";
65
+ import { a as getSuggestions, c as searchWithDb, i as getSearchStats, n as extractPlainText, o as search, r as extractSearchableFields, s as searchCollection } from "./search-B3SGZw91.mjs";
66
66
  import { ulid } from "ulidx";
67
67
 
68
68
  export { CAPABILITY_RENAMES, ContentRepository, EmDashDatabaseError, EmDashStorageError, EmDashValidationError, FIELD_TYPE_TO_COLUMN, FTSManager, HookPipeline, InvalidCursorError, MediaRepository, NodeCronScheduler, NoopSandboxRunner, OptionsRepository, PluginManager, PluginRouteError, PluginStorageRepository, RESERVED_COLLECTION_SLUGS, RESERVED_FIELD_SLUGS, SandboxNotAvailableError, SandboxUnavailableError, SchemaError, SchemaRegistry, UserRepository, adaptSandboxEntry, after, applySeed, buildPreviewUrl, clearSources, computeContentHash, createEditable, createHookPipeline, createHttpAccess, createNoop, createNoopSandboxRunner, createPluginManager, createUnrestrictedHttpAccess, decodeSlug, definePlugin, extractPlainText, extractSearchableFields, file, generateManifest, generatePlaceholder, generatePreviewToken, getAllSources, getAllTermsForEntries, getByline, getBylineBySlug, getCollectionInfo, getCommentCount, getComments, getContentSeo, getEditMeta, getEmDashCollection, getEmDashEntry, getEntriesByByline, getEntriesByTerm, getEntryTerms, getFallbackChain, getFileSources, getI18nConfig, getMenu, getMenus, getMigrationStatus, getPluginSetting, getPluginSettings, getPreviewToken, getPreviewUrl, getRequestContext, getSearchStats, getSection, getSections, getSeoMeta, getSiteSetting, getSiteSettings, getSource, getSuggestions, getTaxonomyDef, getTaxonomyDefs, getTaxonomyTerms, getTerm, getTermsForEntries, getTranslations, getUrlSources, getWidgetArea, getWidgetAreas, getWidgetComponents, handleContentAuthors, handleContentCompare, handleContentCountScheduled, handleContentCountTrashed, handleContentCreate, handleContentDelete, handleContentDiscardDraft, handleContentDuplicate, handleContentGet, handleContentGetIncludingTrashed, handleContentList, handleContentListTrashed, handleContentPermanentDelete, handleContentPublish, handleContentRestore, handleContentSchedule, handleContentTranslations, handleContentUnpublish, handleContentUnschedule, handleContentUpdate, handleMediaCreate, handleMediaDelete, handleMediaGet, handleMediaList, handleMediaUpdate, handleRevisionGet, handleRevisionList, handleRevisionRestore, hashString, image, importReusableBlocksAsSections, invalidateTermCache, isDeprecatedCapability, isI18nEnabled, isPreviewRequest, isSafeHref, normalizeCapabilities, normalizeCapability, normalizeMediaValue, parseContentId, parseWxr, parseWxrDate, parseWxrString, pluginManifestSchema, portableText, portableTextToProsemirror, probeUrl, prosemirrorToPortableText, reference, registerSource, resolveEmDashPath, runWithContext, sanitizeHref, search, searchCollection, searchWithDb, setSiteSettings, ulid, validateSeed, verifyPreviewToken, wordpressRestSource, wxrSource };
@@ -25,4 +25,4 @@ async function loadUserSeed() {
25
25
 
26
26
  //#endregion
27
27
  export { loadUserSeed as n, load_exports as r, loadSeed as t };
28
- //# sourceMappingURL=load-B84ohfBk.mjs.map
28
+ //# sourceMappingURL=load-BBetCvLC.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"load-B84ohfBk.mjs","names":[],"sources":["../src/seed/load.ts"],"sourcesContent":["/**\n * Seed file loading\n *\n * Imports seed data from the virtual module, which embeds the user's seed file\n * (or the default seed) at Vite build time. This avoids runtime filesystem access,\n * which doesn't work in workerd/miniflare where process.cwd() returns \"/\".\n */\n\nimport type { SeedFile } from \"./types.js\";\n\ninterface SeedModule {\n\tseed: SeedFile;\n\tuserSeed: SeedFile | null;\n}\n\nasync function getSeedModule(): Promise<SeedModule> {\n\t// @ts-ignore - virtual module, only available within Vite runtime\n\treturn import(\"virtual:emdash/seed\") as Promise<SeedModule>;\n}\n\n/**\n * Load the seed file (user seed or default).\n */\nexport async function loadSeed(): Promise<SeedFile> {\n\tconst { seed } = await getSeedModule();\n\treturn seed;\n}\n\n/**\n * Load the user's seed file, or null if none exists.\n */\nexport async function loadUserSeed(): Promise<SeedFile | null> {\n\tconst { userSeed } = await getSeedModule();\n\treturn userSeed ?? null;\n}\n"],"mappings":";;;;;;;AAeA,eAAe,gBAAqC;AAEnD,QAAO,OAAO;;;;;AAMf,eAAsB,WAA8B;CACnD,MAAM,EAAE,SAAS,MAAM,eAAe;AACtC,QAAO;;;;;AAMR,eAAsB,eAAyC;CAC9D,MAAM,EAAE,aAAa,MAAM,eAAe;AAC1C,QAAO,YAAY"}
1
+ {"version":3,"file":"load-BBetCvLC.mjs","names":[],"sources":["../src/seed/load.ts"],"sourcesContent":["/**\n * Seed file loading\n *\n * Imports seed data from the virtual module, which embeds the user's seed file\n * (or the default seed) at Vite build time. This avoids runtime filesystem access,\n * which doesn't work in workerd/miniflare where process.cwd() returns \"/\".\n */\n\nimport type { SeedFile } from \"./types.js\";\n\ninterface SeedModule {\n\tseed: SeedFile;\n\tuserSeed: SeedFile | null;\n}\n\nasync function getSeedModule(): Promise<SeedModule> {\n\t// @ts-ignore - virtual module, only available within Vite runtime\n\treturn import(\"virtual:emdash/seed\") as Promise<SeedModule>;\n}\n\n/**\n * Load the seed file (user seed or default).\n */\nexport async function loadSeed(): Promise<SeedFile> {\n\tconst { seed } = await getSeedModule();\n\treturn seed;\n}\n\n/**\n * Load the user's seed file, or null if none exists.\n */\nexport async function loadUserSeed(): Promise<SeedFile | null> {\n\tconst { userSeed } = await getSeedModule();\n\treturn userSeed ?? null;\n}\n"],"mappings":";;;;;;;AAeA,eAAe,gBAAqC;AAEnD,QAAO,OAAO;;;;;AAMf,eAAsB,WAA8B;CACnD,MAAM,EAAE,SAAS,MAAM,eAAe;AACtC,QAAO;;;;;AAMR,eAAsB,eAAyC;CAC9D,MAAM,EAAE,aAAa,MAAM,eAAe;AAC1C,QAAO,YAAY"}
@@ -392,7 +392,7 @@ function emdashLoader() {
392
392
  const fetchLimit = limit ? limit + 1 : void 0;
393
393
  const cursorCondition = cursor ? buildCursorCondition(cursor, orderBy) : null;
394
394
  let result;
395
- let taxonomyFilter = null;
395
+ const taxonomyFilters = [];
396
396
  let bylineFilter = null;
397
397
  const fieldFilters = {};
398
398
  if (where && Object.keys(where).length > 0) {
@@ -410,18 +410,15 @@ function emdashLoader() {
410
410
  console.warn(`[emdash] where filter: range operators are not supported on taxonomy "${key}", ignored`);
411
411
  continue;
412
412
  }
413
- if (taxonomyFilter) {
414
- console.warn(`[emdash] where filter: only one taxonomy is supported per query, "${key}" ignored`);
415
- continue;
416
- }
417
- taxonomyFilter = {
413
+ const slugs = Array.isArray(value) ? value : [value];
414
+ taxonomyFilters.push({
418
415
  name: key,
419
- slugs: Array.isArray(value) ? value : [value]
420
- };
416
+ slugs
417
+ });
421
418
  } else fieldFilters[key] = value;
422
419
  }
423
420
  }
424
- if (bylineFilter && bylineFilter.groups.length === 0 || taxonomyFilter && taxonomyFilter.slugs.length === 0) return {
421
+ if (bylineFilter && bylineFilter.groups.length === 0 || taxonomyFilters.some((f) => f.slugs.length === 0)) return {
425
422
  entries: [],
426
423
  cacheHint: { tags: [type] }
427
424
  };
@@ -432,14 +429,14 @@ function emdashLoader() {
432
429
  const cursorCond = cursorCondition ? sql`AND ${cursorCondition}` : sql``;
433
430
  const fieldConds = buildFieldConditions(fieldFilters);
434
431
  const fieldCondsSQL = fieldConds.length > 0 ? sql`${sql.join(fieldConds, sql` AND `)}` : null;
435
- const taxonomyCond = taxonomyFilter ? sql`AND EXISTS (
432
+ const taxonomyCond = taxonomyFilters.length > 0 ? sql`${sql.join(taxonomyFilters.map((f) => sql`AND EXISTS (
436
433
  SELECT 1 FROM content_taxonomies ct
437
434
  INNER JOIN taxonomies t ON t.id = ct.taxonomy_id
438
435
  WHERE ct.collection = ${type}
439
436
  AND ct.entry_id = ${sql.ref(tableName)}.id
440
- AND t.name = ${taxonomyFilter.name}
441
- AND t.slug IN (${sql.join(taxonomyFilter.slugs.map((s) => sql`${s}`))})
442
- )` : sql``;
437
+ AND t.name = ${f.name}
438
+ AND t.slug IN (${sql.join(f.slugs.map((s) => sql`${s}`))})
439
+ )`), sql` `)}` : sql``;
443
440
  const bylineCond = bylineFilter ? sql`AND EXISTS (
444
441
  SELECT 1 FROM _emdash_content_bylines cb
445
442
  WHERE cb.collection_slug = ${type}
@@ -597,4 +594,4 @@ function emdashLoader() {
597
594
 
598
595
  //#endregion
599
596
  export { loader_exports as i, emdashLoader as n, getDb as r, CURSOR_RAW_VALUES as t };
600
- //# sourceMappingURL=loader-CpZKpFz0.mjs.map
597
+ //# sourceMappingURL=loader-ZN1ll-d-.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader-ZN1ll-d-.mjs","names":[],"sources":["../src/loader.ts"],"sourcesContent":["/**\n * Astro Live Collections loader for EmDash\n *\n * This loader implements the Astro LiveLoader interface to fetch content\n * at runtime from the database, enabling live editing without rebuilds.\n *\n * Architecture:\n * - Single `_emdash` Astro collection handles all content types\n * - Dialect comes from virtual module (configured in astro.config.mjs)\n * - Each content type maps to its own database table: ec_posts, ec_products, etc.\n * - `getEmDashCollection()` / `getEmDashEntry()` wrap Astro's live collection API\n */\n\nimport type { LiveLoader } from \"astro/loaders\";\nimport { Kysely, sql, type Dialect } from \"kysely\";\n\nimport { currentTimestampValue, isPostgres } from \"./database/dialect-helpers.js\";\nimport { kyselyLogOption } from \"./database/instrumentation.js\";\nimport { decodeCursor, encodeCursor } from \"./database/repositories/types.js\";\nimport { validateIdentifier } from \"./database/validate.js\";\nimport type { Database } from \"./index.js\";\nimport { getRequestContext } from \"./request-context.js\";\nimport { isMissingColumnError, isMissingTableError } from \"./utils/db-errors.js\";\n\nconst FIELD_NAME_PATTERN = /^[a-zA-Z_][a-zA-Z0-9_]*$/;\n\n/**\n * SEO columns joined in from `_emdash_seo` on the single-entry path, mapped to\n * aliased result keys. SEO lives in a side table, so a LEFT JOIN folds it into\n * the entry load at zero extra query cost; the result is surfaced as a nested\n * `data.seo` object (see extractSeo) rather than flat fields.\n *\n * The `_emdash_` prefix on the aliases guarantees they can never collide with\n * a content field. Field slugs must match `/^[a-z][a-z0-9_]*$/`, so a user can\n * legitimately define a `seo_title` field; selecting the joined column under\n * its bare name would shadow that field in the result set and drop the user's\n * value. The prefix (illegal as a leading slug char) sidesteps this entirely.\n */\nconst SEO_COLUMN_ALIASES: Record<string, string> = {\n\tseo_title: \"_emdash_seo_title\",\n\tseo_description: \"_emdash_seo_description\",\n\tseo_image: \"_emdash_seo_image\",\n\tseo_canonical: \"_emdash_seo_canonical\",\n\tseo_no_index: \"_emdash_seo_no_index\",\n};\n\n/** Aliased SEO result keys — excluded from generic field mapping. */\nconst SEO_ALIAS_COLUMNS = Object.values(SEO_COLUMN_ALIASES);\n\n/**\n * System columns excluded from entry.data\n * Note: slug is intentionally NOT excluded - it's useful as data.slug in templates\n */\nconst SYSTEM_COLUMNS = new Set([\n\t\"id\",\n\t// \"slug\" - kept in data for template access\n\t\"status\",\n\t\"author_id\",\n\t\"primary_byline_id\",\n\t\"created_at\",\n\t\"updated_at\",\n\t\"published_at\",\n\t\"scheduled_at\",\n\t\"deleted_at\",\n\t\"version\",\n\t\"live_revision_id\",\n\t\"draft_revision_id\",\n\t\"locale\",\n\t\"translation_group\",\n\t// Aliased SEO columns joined from _emdash_seo on the single-entry path.\n\t// Surfaced as a nested data.seo object (see extractSeo), never as flat\n\t// fields. The aliases are _emdash_-prefixed so they can't shadow a user\n\t// field named e.g. `seo_title`.\n\t...SEO_ALIAS_COLUMNS,\n]);\n\n/** Resolved SEO shape attached to `entry.data.seo`. Mirrors `ContentSeo`. */\ninterface EntrySeo {\n\ttitle: string | null;\n\tdescription: string | null;\n\timage: string | null;\n\tcanonical: string | null;\n\tnoIndex: boolean;\n}\n\n/**\n * Build a `data.seo` object from the joined `_emdash_seo` columns on a row.\n *\n * Returns `null` when no SEO row exists (LEFT JOIN miss → `seo_no_index` is\n * NULL, since the column is `NOT NULL DEFAULT 0` whenever a row is present).\n * Returning null keeps the `seo` key off entries that have none, so\n * `getSeoMeta()` falls back to its defaults exactly as before.\n */\nfunction extractSeo(row: Record<string, unknown>): EntrySeo | null {\n\tconst noIndex = row[SEO_COLUMN_ALIASES.seo_no_index];\n\tif (noIndex === null || noIndex === undefined) return null;\n\tconst title = row[SEO_COLUMN_ALIASES.seo_title];\n\tconst description = row[SEO_COLUMN_ALIASES.seo_description];\n\tconst image = row[SEO_COLUMN_ALIASES.seo_image];\n\tconst canonical = row[SEO_COLUMN_ALIASES.seo_canonical];\n\treturn {\n\t\ttitle: typeof title === \"string\" ? title : null,\n\t\tdescription: typeof description === \"string\" ? description : null,\n\t\timage: typeof image === \"string\" ? image : null,\n\t\tcanonical: typeof canonical === \"string\" ? canonical : null,\n\t\tnoIndex: noIndex === 1,\n\t};\n}\n\n/**\n * Get the table name for a collection type\n */\nfunction getTableName(type: string): string {\n\tvalidateIdentifier(type, \"collection type\");\n\treturn `ec_${type}`;\n}\n\n/**\n * Cache for taxonomy names (only used for the primary database).\n * Skipped when a per-request DB override is active (e.g. preview mode)\n * because the override DB may have different taxonomies.\n */\nlet taxonomyNames: Set<string> | null = null;\n\n/**\n * Get all taxonomy names (cached for the primary DB, bypassed only when\n * the per-request DB is an isolated instance — playground / DO preview).\n * Plain D1 Sessions routing shares schema with the singleton, so the\n * module-scoped cache stays valid.\n */\nasync function getTaxonomyNames(db: Kysely<Database>): Promise<Set<string>> {\n\tconst hasIsolatedDb = getRequestContext()?.dbIsIsolated === true;\n\n\tif (!hasIsolatedDb && taxonomyNames) {\n\t\treturn taxonomyNames;\n\t}\n\n\ttry {\n\t\tconst defs = await db.selectFrom(\"_emdash_taxonomy_defs\").select(\"name\").execute();\n\t\tconst names = new Set(defs.map((d) => d.name));\n\t\tif (!hasIsolatedDb) {\n\t\t\ttaxonomyNames = names;\n\t\t}\n\t\treturn names;\n\t} catch {\n\t\t// Table doesn't exist yet, return empty set\n\t\tconst empty = new Set<string>();\n\t\tif (!hasIsolatedDb) {\n\t\t\ttaxonomyNames = empty;\n\t\t}\n\t\treturn empty;\n\t}\n}\n\n/**\n * System columns to include in data (mapped to camelCase where needed)\n */\nconst INCLUDE_IN_DATA: Record<string, string> = {\n\tid: \"id\",\n\tstatus: \"status\",\n\tauthor_id: \"authorId\",\n\tprimary_byline_id: \"primaryBylineId\",\n\tcreated_at: \"createdAt\",\n\tupdated_at: \"updatedAt\",\n\tpublished_at: \"publishedAt\",\n\tscheduled_at: \"scheduledAt\",\n\tdraft_revision_id: \"draftRevisionId\",\n\tlive_revision_id: \"liveRevisionId\",\n\tlocale: \"locale\",\n\ttranslation_group: \"translationGroup\",\n};\n\n/** System date columns that should be converted to Date objects */\nconst DATE_COLUMNS = new Set([\"created_at\", \"updated_at\", \"published_at\", \"scheduled_at\"]);\n\n/**\n * Hidden, symbol-keyed property on each mapped data record carrying the raw\n * DB string for every date column. Lets cursor encoders downstream reproduce\n * the loader's exact `nextCursor` format without round-tripping through\n * `new Date()`, which loses precision for stored values that aren't already\n * ISO-with-milliseconds (e.g. `2026-01-01T00:00:00Z` becomes\n * `2026-01-01T00:00:00.000Z`).\n */\nexport const CURSOR_RAW_VALUES: unique symbol = Symbol(\"emdash:cursorRawValues\");\n\nconst LOCAL_MEDIA_FILE_PREFIX = \"/_emdash/api/media/file/\";\nconst URL_SCHEME_PATTERN = /^[a-zA-Z][a-zA-Z\\d+\\-.]*:/;\n\n/** Safely extract a string value from a record, returning fallback if not a string */\nfunction rowStr(row: Record<string, unknown>, key: string, fallback = \"\"): string {\n\tconst val = row[key];\n\treturn typeof val === \"string\" ? val : fallback;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isBareMediaKey(src: string): boolean {\n\treturn !src.startsWith(\"/\") && !URL_SCHEME_PATTERN.test(src);\n}\n\nfunction normalizeLocalMediaValue(value: unknown): unknown {\n\tif (Array.isArray(value)) {\n\t\treturn value.map(normalizeLocalMediaValue);\n\t}\n\n\tif (!isRecord(value)) {\n\t\treturn value;\n\t}\n\n\tconst normalized: Record<string, unknown> = {};\n\tfor (const [key, child] of Object.entries(value)) {\n\t\tnormalized[key] = normalizeLocalMediaValue(child);\n\t}\n\n\tif (\n\t\tnormalized.provider === \"local\" &&\n\t\ttypeof normalized.src === \"string\" &&\n\t\tnormalized.src.length > 0\n\t) {\n\t\tconst src = normalized.src;\n\t\tif (src.startsWith(LOCAL_MEDIA_FILE_PREFIX)) {\n\t\t\tconst id = src.slice(LOCAL_MEDIA_FILE_PREFIX.length);\n\t\t\tif (!normalized.id && id) {\n\t\t\t\tnormalized.id = id;\n\t\t\t}\n\t\t} else if (isBareMediaKey(src)) {\n\t\t\tif (!normalized.id) {\n\t\t\t\tnormalized.id = src;\n\t\t\t}\n\t\t\tnormalized.src = `${LOCAL_MEDIA_FILE_PREFIX}${src}`;\n\t\t}\n\t}\n\n\treturn normalized;\n}\n\n/**\n * Map a database row to entry data\n * Extracts content fields (non-system columns) and parses JSON where needed.\n * System columns needed for templates (id, status, dates) are included with camelCase names.\n */\nfunction mapRowToData(row: Record<string, unknown>): Record<string, unknown> {\n\tconst data: Record<string, unknown> = {};\n\tconst rawDateValues: Record<string, string> = {};\n\n\tfor (const [key, value] of Object.entries(row)) {\n\t\t// Include certain system columns (mapped to camelCase where needed)\n\t\tif (key in INCLUDE_IN_DATA) {\n\t\t\t// Convert date columns from ISO strings to Date objects\n\t\t\tif (DATE_COLUMNS.has(key)) {\n\t\t\t\tif (typeof value === \"string\") {\n\t\t\t\t\trawDateValues[key] = value;\n\t\t\t\t\tdata[INCLUDE_IN_DATA[key]] = new Date(value);\n\t\t\t\t} else {\n\t\t\t\t\tdata[INCLUDE_IN_DATA[key]] = null;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdata[INCLUDE_IN_DATA[key]] = value;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (SYSTEM_COLUMNS.has(key)) continue;\n\n\t\t// Try to parse JSON strings (for portableText, json fields, etc.)\n\t\tif (typeof value === \"string\") {\n\t\t\ttry {\n\t\t\t\t// Only parse if it looks like JSON (starts with { or [)\n\t\t\t\tif (value.startsWith(\"{\") || value.startsWith(\"[\")) {\n\t\t\t\t\tdata[key] = normalizeLocalMediaValue(JSON.parse(value));\n\t\t\t\t} else {\n\t\t\t\t\tdata[key] = value;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\tdata[key] = value;\n\t\t\t}\n\t\t} else {\n\t\t\tdata[key] = value;\n\t\t}\n\t}\n\n\tObject.defineProperty(data, CURSOR_RAW_VALUES, {\n\t\tvalue: rawDateValues,\n\t\tenumerable: false,\n\t\tconfigurable: false,\n\t\twritable: false,\n\t});\n\n\treturn data;\n}\n\n/**\n * Map revision data (already-parsed JSON object) to entry data.\n * Strips _-prefixed metadata keys (e.g. _slug) used internally by revisions.\n */\nfunction mapRevisionData(data: Record<string, unknown>): Record<string, unknown> {\n\tconst result: Record<string, unknown> = {};\n\tfor (const [key, value] of Object.entries(data)) {\n\t\tif (key.startsWith(\"_\")) continue; // revision metadata\n\t\tresult[key] = normalizeLocalMediaValue(value);\n\t}\n\treturn result;\n}\n\n// Virtual module imports are lazy-loaded to avoid errors when importing\n// emdash outside of Astro/Vite context (e.g., in astro.config.mjs)\nlet virtualConfig:\n\t| {\n\t\t\tdatabase?: { config: unknown };\n\t\t\ti18n?: { defaultLocale: string; locales: string[]; prefixDefaultLocale?: boolean } | null;\n\t }\n\t| undefined;\nlet virtualCreateDialect: ((config: unknown) => Dialect) | undefined;\n\nasync function loadVirtualModules() {\n\tif (virtualConfig === undefined) {\n\t\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t\t// @ts-ignore - virtual module\n\t\tconst configModule = await import(\"virtual:emdash/config\");\n\t\tvirtualConfig = configModule.default;\n\t}\n\tif (virtualCreateDialect === undefined) {\n\t\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t\t// @ts-ignore - virtual module\n\t\tconst dialectModule = await import(\"virtual:emdash/dialect\");\n\t\tvirtualCreateDialect = dialectModule.createDialect;\n\t\t// dialectType is no longer needed here — dialect detection is\n\t\t// done via the db adapter instance in dialect-helpers.ts\n\t}\n}\n\n/**\n * Entry data type - generic object\n */\nexport type EntryData = Record<string, unknown>;\n\n/**\n * Sort direction\n */\nexport type SortDirection = \"asc\" | \"desc\";\n\n/**\n * Order by specification - field name to direction\n * @example { created_at: \"desc\" } - Sort by created_at descending\n * @example { title: \"asc\" } - Sort by title ascending\n */\nexport type OrderBySpec = Record<string, SortDirection>;\n\n/**\n * Build WHERE clause for status filtering.\n * When filtering for 'published' status, also include scheduled content\n * whose scheduled_at time has passed (treating it as effectively published).\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- accepts any Kysely instance\nfunction buildStatusCondition(\n\tdb: Kysely<any>,\n\tstatus: string,\n\ttablePrefix?: string,\n): ReturnType<typeof sql> {\n\tconst statusField = tablePrefix ? `${tablePrefix}.status` : \"status\";\n\tconst scheduledAtField = tablePrefix ? `${tablePrefix}.scheduled_at` : \"scheduled_at\";\n\n\tif (status === \"published\") {\n\t\t// Include both published content AND scheduled content past its publish time.\n\t\t// scheduled_at is stored as text (ISO 8601). On Postgres, we must cast it\n\t\t// to timestamptz for the comparison with CURRENT_TIMESTAMP to work.\n\t\tconst scheduledAtExpr = isPostgres(db)\n\t\t\t? sql`${sql.ref(scheduledAtField)}::timestamptz`\n\t\t\t: sql.ref(scheduledAtField);\n\t\tconst nowExpr = isPostgres(db)\n\t\t\t? currentTimestampValue(db)\n\t\t\t: sql`strftime('%Y-%m-%dT%H:%M:%fZ', 'now')`;\n\t\treturn sql`(${sql.ref(statusField)} = 'published' OR (${sql.ref(statusField)} = 'scheduled' AND ${scheduledAtExpr} <= ${nowExpr}))`;\n\t}\n\n\treturn sql`${sql.ref(statusField)} = ${status}`;\n}\n\n/**\n * Resolved primary sort field and direction (used for cursor pagination).\n */\ninterface PrimarySort {\n\tfield: string;\n\tdirection: SortDirection;\n}\n\n/**\n * Get the primary sort field from an orderBy spec (first valid field, or default).\n */\nfunction getPrimarySort(orderBy: OrderBySpec | undefined, tablePrefix?: string): PrimarySort {\n\tif (orderBy) {\n\t\tfor (const [field, direction] of Object.entries(orderBy)) {\n\t\t\tif (FIELD_NAME_PATTERN.test(field)) {\n\t\t\t\tconst fullField = tablePrefix ? `${tablePrefix}.${field}` : field;\n\t\t\t\treturn { field: fullField, direction };\n\t\t\t}\n\t\t}\n\t}\n\tconst defaultField = tablePrefix ? `${tablePrefix}.created_at` : \"created_at\";\n\treturn { field: defaultField, direction: \"desc\" };\n}\n\n/**\n * Build ORDER BY clause from orderBy spec\n * Validates field names to prevent SQL injection (alphanumeric + underscore only)\n * Supports multiple sort fields in object key order\n */\nfunction buildOrderByClause(\n\torderBy: OrderBySpec | undefined,\n\ttablePrefix?: string,\n): ReturnType<typeof sql> {\n\t// Default to created_at DESC\n\tif (!orderBy || Object.keys(orderBy).length === 0) {\n\t\tconst field = tablePrefix ? `${tablePrefix}.created_at` : \"created_at\";\n\t\treturn sql`ORDER BY ${sql.ref(field)} DESC, ${sql.ref(tablePrefix ? `${tablePrefix}.id` : \"id\")} DESC`;\n\t}\n\n\tconst sortParts: ReturnType<typeof sql>[] = [];\n\n\tfor (const [field, direction] of Object.entries(orderBy)) {\n\t\t// Validate field name (alphanumeric + underscore only)\n\t\tif (!FIELD_NAME_PATTERN.test(field)) {\n\t\t\tcontinue; // Skip invalid field names\n\t\t}\n\n\t\tconst fullField = tablePrefix ? `${tablePrefix}.${field}` : field;\n\t\tconst dir = direction === \"asc\" ? sql`ASC` : sql`DESC`;\n\t\tsortParts.push(sql`${sql.ref(fullField)} ${dir}`);\n\t}\n\n\t// If no valid sort fields, fall back to default\n\tif (sortParts.length === 0) {\n\t\tconst defaultField = tablePrefix ? `${tablePrefix}.created_at` : \"created_at\";\n\t\treturn sql`ORDER BY ${sql.ref(defaultField)} DESC, ${sql.ref(tablePrefix ? `${tablePrefix}.id` : \"id\")} DESC`;\n\t}\n\n\t// Add id as tiebreaker to ensure stable cursor ordering\n\tconst primary = getPrimarySort(orderBy, tablePrefix);\n\tconst idField = tablePrefix ? `${tablePrefix}.id` : \"id\";\n\tconst idDir = primary.direction === \"asc\" ? sql`ASC` : sql`DESC`;\n\tsortParts.push(sql`${sql.ref(idField)} ${idDir}`);\n\n\treturn sql`ORDER BY ${sql.join(sortParts, sql`, `)}`;\n}\n\n/**\n * Build a cursor WHERE condition for keyset pagination.\n * Uses the primary sort field + id as tiebreaker for stable ordering.\n *\n * Throws `InvalidCursorError` if the cursor is malformed; callers should\n * let this propagate so users see a real error rather than silently\n * falling back to the first page.\n */\nfunction buildCursorCondition(\n\tcursor: string,\n\torderBy: OrderBySpec | undefined,\n\ttablePrefix?: string,\n): ReturnType<typeof sql> {\n\tconst { orderValue, id: cursorId } = decodeCursor(cursor);\n\tconst primary = getPrimarySort(orderBy, tablePrefix);\n\tconst idField = tablePrefix ? `${tablePrefix}.id` : \"id\";\n\n\tif (primary.direction === \"desc\") {\n\t\treturn sql`(${sql.ref(primary.field)} < ${orderValue} OR (${sql.ref(primary.field)} = ${orderValue} AND ${sql.ref(idField)} < ${cursorId}))`;\n\t}\n\treturn sql`(${sql.ref(primary.field)} > ${orderValue} OR (${sql.ref(primary.field)} = ${orderValue} AND ${sql.ref(idField)} > ${cursorId}))`;\n}\n\n/** Type guard: is the where value a range object (not a string or array)? */\nfunction isWhereRange(value: WhereValue): value is WhereRange {\n\treturn value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\n/**\n * Build AND conditions for non-taxonomy field filters.\n * Returns an array of sql fragments; empty if no field filters apply.\n * Field names are validated against FIELD_NAME_PATTERN to prevent injection.\n */\nfunction buildFieldConditions(\n\tfields: Record<string, WhereValue>,\n\ttablePrefix?: string,\n): ReturnType<typeof sql>[] {\n\tconst conditions: ReturnType<typeof sql>[] = [];\n\n\tfor (const [key, value] of Object.entries(fields)) {\n\t\tif (!FIELD_NAME_PATTERN.test(key)) {\n\t\t\tconsole.warn(`[emdash] where filter: invalid field name \"${key}\" ignored`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (value == null) continue;\n\t\tconst ref = tablePrefix ? sql.ref(`${tablePrefix}.${key}`) : sql.ref(key);\n\n\t\tif (isWhereRange(value)) {\n\t\t\tif (value.gt !== undefined) conditions.push(sql`${ref} > ${value.gt}`);\n\t\t\tif (value.gte !== undefined) conditions.push(sql`${ref} >= ${value.gte}`);\n\t\t\tif (value.lt !== undefined) conditions.push(sql`${ref} < ${value.lt}`);\n\t\t\tif (value.lte !== undefined) conditions.push(sql`${ref} <= ${value.lte}`);\n\t\t} else if (Array.isArray(value)) {\n\t\t\tif (value.length > 0) {\n\t\t\t\tconditions.push(sql`${ref} IN (${sql.join(value.map((v) => sql`${v}`))})`);\n\t\t\t}\n\t\t} else {\n\t\t\tconditions.push(sql`${ref} = ${value}`);\n\t\t}\n\t}\n\n\treturn conditions;\n}\n\n/**\n * Range filter for comparison operators on field values.\n * Values are compared as strings in the database. This works correctly for\n * ISO 8601 dates (e.g. \"2024-01-01T00:00:00Z\") because lexicographic ordering\n * matches chronological ordering. Ensure date values use a consistent format.\n */\nexport interface WhereRange {\n\tgt?: string;\n\tgte?: string;\n\tlt?: string;\n\tlte?: string;\n}\n\n/**\n * A where clause value: exact match, multi-value match, or range comparison.\n */\nexport type WhereValue = string | string[] | WhereRange;\n\n/**\n * Filter for loadCollection - type is required\n */\nexport interface CollectionFilter {\n\ttype: string;\n\tstatus?: \"draft\" | \"published\" | \"archived\";\n\tlimit?: number;\n\t/**\n\t * Opaque cursor for keyset pagination.\n\t * Pass the `nextCursor` value from a previous result to fetch the next page.\n\t */\n\tcursor?: string;\n\t/**\n\t * Filter by field values, taxonomy terms, byline credits, or ranges.\n\t *\n\t * Taxonomy names are detected automatically and filtered via JOIN.\n\t * The reserved `byline` key filters by byline credit (any credit, not\n\t * just the primary one) via the `_emdash_content_bylines` junction\n\t * table; its value is one or more byline translation groups.\n\t * Other keys are treated as column filters on the content table.\n\t *\n\t * @example { category: 'news' } - taxonomy term\n\t * @example { byline: '01HXYZ...' } - entries credited to a byline (any position)\n\t * @example { series: 'main' } - exact match on a content field\n\t * @example { published_at: { gte: '2024-01-01', lt: '2025-01-01' } } - date range\n\t */\n\twhere?: Record<string, WhereValue>;\n\t/**\n\t * Order results by field(s)\n\t * @default { created_at: \"desc\" }\n\t */\n\torderBy?: OrderBySpec;\n\t/**\n\t * Filter by locale (e.g. 'en', 'fr').\n\t * When set, only returns content in this locale.\n\t */\n\tlocale?: string;\n}\n\n/**\n * Filter for loadEntry - type and id are required\n */\nexport interface EntryFilter {\n\ttype: string;\n\tid: string;\n\t/**\n\t * When set, fetch content data from this revision instead of the content table.\n\t * Used by preview mode to serve draft revision data.\n\t */\n\trevisionId?: string;\n\t/**\n\t * Locale to scope slug lookup. Only affects slug resolution;\n\t * IDs are globally unique and always resolve regardless of locale.\n\t */\n\tlocale?: string;\n}\n\n// Cached database instance (shared across calls)\nlet dbInstance: Kysely<Database> | null = null;\n\n/**\n * Get the database instance. Used by query wrapper functions and middleware.\n *\n * Checks the ALS request context first — if a per-request DB override is set\n * (e.g. by DO preview middleware), it takes precedence over the module-level\n * cached instance. This allows preview mode to route queries to an isolated\n * Durable Object database without modifying any calling code.\n *\n * Initializes the default database on first call using config from virtual module.\n */\nexport async function getDb(): Promise<Kysely<Database>> {\n\t// Per-request DB override via ALS (normal mode)\n\tconst ctx = getRequestContext();\n\tif (ctx?.db) {\n\t\treturn ctx.db as Kysely<Database>; // eslint-disable-line typescript/no-unsafe-type-assertion -- db is typed as unknown in RequestContext to avoid circular deps\n\t}\n\n\tif (!dbInstance) {\n\t\tawait loadVirtualModules();\n\t\tif (!virtualConfig?.database || typeof virtualCreateDialect !== \"function\") {\n\t\t\tthrow new Error(\n\t\t\t\t\"EmDash database not configured. Add database config to emdash() in astro.config.mjs\",\n\t\t\t);\n\t\t}\n\t\tconst dialect = virtualCreateDialect(virtualConfig.database.config);\n\t\tdbInstance = new Kysely<Database>({ dialect, log: kyselyLogOption() });\n\t}\n\treturn dbInstance;\n}\n\n/**\n * Create an EmDash Live Collections loader\n *\n * This loader handles ALL content types in a single Astro collection.\n * Use `getEmDashCollection()` and `getEmDashEntry()` to query\n * specific content types.\n *\n * Database is configured in astro.config.mjs via the emdash() integration.\n *\n * @example\n * ```ts\n * // src/live.config.ts\n * import { defineLiveCollection } from \"astro:content\";\n * import { emdashLoader } from \"emdash\";\n *\n * export const collections = {\n * emdash: defineLiveCollection({\n * loader: emdashLoader(),\n * }),\n * };\n * ```\n */\nexport function emdashLoader(): LiveLoader<EntryData, EntryFilter, CollectionFilter> {\n\treturn {\n\t\tname: \"emdash\",\n\n\t\t/**\n\t\t * Load all entries for a content type\n\t\t */\n\t\tasync loadCollection({ filter }) {\n\t\t\ttry {\n\t\t\t\t// Get DB instance (initializes on first use)\n\t\t\t\tconst db = await getDb();\n\n\t\t\t\t// Type filter is required\n\t\t\t\tconst type = filter?.type;\n\t\t\t\tif (!type) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\terror: new Error(\n\t\t\t\t\t\t\t\"type filter is required. Use getEmDashCollection() instead of getLiveCollection() directly.\",\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\t// Query the per-collection table (ec_posts, ec_products, etc.)\n\t\t\t\tconst tableName = getTableName(type);\n\n\t\t\t\t// Build query with dynamic table name\n\t\t\t\tconst status = filter?.status || \"published\";\n\t\t\t\tconst limit = filter?.limit;\n\t\t\t\tconst cursor = filter?.cursor;\n\t\t\t\tconst where = filter?.where;\n\t\t\t\tconst orderBy = filter?.orderBy;\n\t\t\t\tconst locale = filter?.locale;\n\n\t\t\t\t// Cursor pagination: over-fetch by 1 to detect next page\n\t\t\t\tconst fetchLimit = limit ? limit + 1 : undefined;\n\n\t\t\t\t// Build cursor condition if cursor is provided\n\t\t\t\tconst cursorCondition = cursor ? buildCursorCondition(cursor, orderBy) : null;\n\n\t\t\t\t// Separate taxonomy / byline filters from field filters\n\t\t\t\tlet result: { rows: Record<string, unknown>[] };\n\t\t\t\t// Taxonomy filters AND together: each entry constrains the base\n\t\t\t\t// row to match at least one of its slugs *within that taxonomy*.\n\t\t\t\t// Term slugs are unique only within a taxonomy, so every filter\n\t\t\t\t// keeps its own `name` and emits its own `EXISTS` clause rather\n\t\t\t\t// than pooling slugs into one `IN`.\n\t\t\t\tconst taxonomyFilters: { name: string; slugs: string[] }[] = [];\n\t\t\t\t// A byline filter matches entries credited to any of the given\n\t\t\t\t// byline translation groups via the `_emdash_content_bylines`\n\t\t\t\t// junction table. `null` means no byline filter; an empty\n\t\t\t\t// `groups` array means the filter was requested but matches\n\t\t\t\t// nothing (short-circuited to an empty result below).\n\t\t\t\tlet bylineFilter: { groups: string[] } | null = null;\n\t\t\t\tconst fieldFilters: Record<string, WhereValue> = {};\n\n\t\t\t\tif (where && Object.keys(where).length > 0) {\n\t\t\t\t\tconst taxNames = await getTaxonomyNames(db);\n\n\t\t\t\t\tfor (const [key, value] of Object.entries(where)) {\n\t\t\t\t\t\tif (value == null) continue;\n\t\t\t\t\t\tif (key === \"byline\") {\n\t\t\t\t\t\t\tif (isWhereRange(value)) {\n\t\t\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t\t\t`[emdash] where filter: range operators are not supported on \"byline\", ignored`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst groups = Array.isArray(value) ? value : [value];\n\t\t\t\t\t\t\tbylineFilter = { groups };\n\t\t\t\t\t\t} else if (taxNames.has(key)) {\n\t\t\t\t\t\t\tif (isWhereRange(value)) {\n\t\t\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t\t\t`[emdash] where filter: range operators are not supported on taxonomy \"${key}\", ignored`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst slugs = Array.isArray(value) ? value : [value];\n\t\t\t\t\t\t\ttaxonomyFilters.push({ name: key, slugs });\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfieldFilters[key] = value;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// A byline or taxonomy filter with no values matches nothing —\n\t\t\t\t// short-circuit before building SQL (an empty `IN ()` is invalid\n\t\t\t\t// SQL on both dialects).\n\t\t\t\tif (\n\t\t\t\t\t(bylineFilter && bylineFilter.groups.length === 0) ||\n\t\t\t\t\ttaxonomyFilters.some((f) => f.slugs.length === 0)\n\t\t\t\t) {\n\t\t\t\t\treturn { entries: [], cacheHint: { tags: [type] } };\n\t\t\t\t}\n\n\t\t\t\t{\n\t\t\t\t\t// Taxonomy and byline filters are applied as correlated\n\t\t\t\t\t// `EXISTS` semi-joins rather than `INNER JOIN ... DISTINCT`.\n\t\t\t\t\t// A join fan-out would force `SELECT DISTINCT table.*`, and\n\t\t\t\t\t// Postgres cannot apply DISTINCT to a row containing a `json`\n\t\t\t\t\t// column (no equality operator), so the join approach throws\n\t\t\t\t\t// there. EXISTS matches \"credited/tagged at least once\"\n\t\t\t\t\t// without duplicating rows, needs no DISTINCT, and works on\n\t\t\t\t\t// both SQLite and Postgres. The base query stays a single-\n\t\t\t\t\t// table `SELECT *`, so all field/status/locale/cursor/order\n\t\t\t\t\t// conditions reference unprefixed columns as before.\n\t\t\t\t\tconst orderByClause = buildOrderByClause(orderBy);\n\t\t\t\t\tconst statusCondition = buildStatusCondition(db, status);\n\t\t\t\t\tconst localeFilter = locale ? sql`AND locale = ${locale}` : sql``;\n\t\t\t\t\tconst cursorCond = cursorCondition ? sql`AND ${cursorCondition}` : sql``;\n\t\t\t\t\tconst fieldConds = buildFieldConditions(fieldFilters);\n\t\t\t\t\tconst fieldCondsSQL =\n\t\t\t\t\t\tfieldConds.length > 0 ? sql`${sql.join(fieldConds, sql` AND `)}` : null;\n\n\t\t\t\t\t// One `EXISTS` per taxonomy, AND'd together: an entry must be\n\t\t\t\t\t// tagged with a matching term in *every* requested taxonomy.\n\t\t\t\t\t// Each clause pins its own `t.name`, so slugs never pool\n\t\t\t\t\t// across taxonomies (they're only unique within one).\n\t\t\t\t\tconst taxonomyCond =\n\t\t\t\t\t\ttaxonomyFilters.length > 0\n\t\t\t\t\t\t\t? sql`${sql.join(\n\t\t\t\t\t\t\t\t\ttaxonomyFilters.map(\n\t\t\t\t\t\t\t\t\t\t(f) => sql`AND EXISTS (\n\t\t\t\t\t\t\tSELECT 1 FROM content_taxonomies ct\n\t\t\t\t\t\t\tINNER JOIN taxonomies t ON t.id = ct.taxonomy_id\n\t\t\t\t\t\t\tWHERE ct.collection = ${type}\n\t\t\t\t\t\t\t\tAND ct.entry_id = ${sql.ref(tableName)}.id\n\t\t\t\t\t\t\t\tAND t.name = ${f.name}\n\t\t\t\t\t\t\t\tAND t.slug IN (${sql.join(f.slugs.map((s) => sql`${s}`))})\n\t\t\t\t\t\t)`,\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tsql` `,\n\t\t\t\t\t\t\t\t)}`\n\t\t\t\t\t\t\t: sql``;\n\n\t\t\t\t\t// `_emdash_content_bylines.byline_id` stores the byline's\n\t\t\t\t\t// translation_group (migration 040), so a credit spans every\n\t\t\t\t\t// locale variant of the byline and we match the group directly.\n\t\t\t\t\tconst bylineCond = bylineFilter\n\t\t\t\t\t\t? sql`AND EXISTS (\n\t\t\t\t\t\t\tSELECT 1 FROM _emdash_content_bylines cb\n\t\t\t\t\t\t\tWHERE cb.collection_slug = ${type}\n\t\t\t\t\t\t\t\tAND cb.content_id = ${sql.ref(tableName)}.id\n\t\t\t\t\t\t\t\tAND cb.byline_id IN (${sql.join(bylineFilter.groups.map((g) => sql`${g}`))})\n\t\t\t\t\t\t)`\n\t\t\t\t\t\t: sql``;\n\n\t\t\t\t\tresult = await sql<Record<string, unknown>>`\n\t\t\t\t\t\tSELECT * FROM ${sql.ref(tableName)}\n\t\t\t\t\t\tWHERE deleted_at IS NULL\n\t\t\t\t\t\tAND ${statusCondition}\n\t\t\t\t\t\t${localeFilter}\n\t\t\t\t\t\t${cursorCond}\n\t\t\t\t\t\t${taxonomyCond}\n\t\t\t\t\t\t${bylineCond}\n\t\t\t\t\t\t${fieldCondsSQL ? sql`AND ${fieldCondsSQL}` : sql``}\n\t\t\t\t\t\t${orderByClause}\n\t\t\t\t\t\t${fetchLimit ? sql`LIMIT ${fetchLimit}` : sql``}\n\t\t\t\t\t`.execute(db);\n\t\t\t\t}\n\n\t\t\t\t// Detect whether there are more results (over-fetched by 1)\n\t\t\t\tconst hasMore = limit ? result.rows.length > limit : false;\n\t\t\t\tconst rows = hasMore ? result.rows.slice(0, limit) : result.rows;\n\n\t\t\t\t// Map rows to entries\n\t\t\t\tconst i18nConfig = virtualConfig?.i18n;\n\t\t\t\tconst i18nEnabled = i18nConfig && i18nConfig.locales.length > 1;\n\t\t\t\tconst entries = rows.map((row) => {\n\t\t\t\t\tconst slug = rowStr(row, \"slug\") || rowStr(row, \"id\");\n\t\t\t\t\tconst rowLocale = rowStr(row, \"locale\");\n\t\t\t\t\tconst shouldPrefix =\n\t\t\t\t\t\ti18nEnabled &&\n\t\t\t\t\t\trowLocale !== \"\" &&\n\t\t\t\t\t\t(rowLocale !== i18nConfig.defaultLocale || i18nConfig.prefixDefaultLocale);\n\t\t\t\t\tconst id = shouldPrefix ? `${rowLocale}/${slug}` : slug;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tslug: rowStr(row, \"slug\"),\n\t\t\t\t\t\tstatus: rowStr(row, \"status\", \"draft\"),\n\t\t\t\t\t\tdata: mapRowToData(row),\n\t\t\t\t\t\tcacheHint: {\n\t\t\t\t\t\t\ttags: [rowStr(row, \"id\")],\n\t\t\t\t\t\t\tlastModified: row.updated_at ? new Date(rowStr(row, \"updated_at\")) : undefined,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t});\n\n\t\t\t\t// Encode nextCursor from the last row if there are more results\n\t\t\t\tlet nextCursor: string | undefined;\n\t\t\t\tif (hasMore && rows.length > 0) {\n\t\t\t\t\tconst lastRow = rows.at(-1)!;\n\t\t\t\t\tconst primary = getPrimarySort(orderBy);\n\t\t\t\t\t// Strip table prefix from field name for row lookup\n\t\t\t\t\tconst fieldName = primary.field.includes(\".\")\n\t\t\t\t\t\t? primary.field.split(\".\").pop()!\n\t\t\t\t\t\t: primary.field;\n\t\t\t\t\tconst lastOrderValue = lastRow[fieldName];\n\t\t\t\t\tconst orderStr =\n\t\t\t\t\t\ttypeof lastOrderValue === \"string\" || typeof lastOrderValue === \"number\"\n\t\t\t\t\t\t\t? String(lastOrderValue)\n\t\t\t\t\t\t\t: \"\";\n\t\t\t\t\tnextCursor = encodeCursor(orderStr, String(lastRow.id));\n\t\t\t\t}\n\n\t\t\t\t// Collection-level cache hint uses the most recent updated_at\n\t\t\t\tlet collectionLastModified: Date | undefined;\n\t\t\t\tfor (const row of rows) {\n\t\t\t\t\tif (row.updated_at) {\n\t\t\t\t\t\tconst d = new Date(rowStr(row, \"updated_at\"));\n\t\t\t\t\t\tif (!collectionLastModified || d > collectionLastModified) {\n\t\t\t\t\t\t\tcollectionLastModified = d;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tentries,\n\t\t\t\t\tnextCursor,\n\t\t\t\t\tcacheHint: {\n\t\t\t\t\t\ttags: [type],\n\t\t\t\t\t\tlastModified: collectionLastModified,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t} catch (error) {\n\t\t\t\t// Handle missing table/column gracefully - return empty collection.\n\t\t\t\t// Missing table happens before migrations have run.\n\t\t\t\t// Missing column happens when a where filter references a non-existent field.\n\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\tif (isMissingTableError(error) || isMissingColumnError(error)) {\n\t\t\t\t\tif (isMissingColumnError(error)) {\n\t\t\t\t\t\tconsole.warn(`[emdash] where filter: ${message}`);\n\t\t\t\t\t}\n\t\t\t\t\treturn { entries: [] };\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\terror: new Error(`Failed to load collection: ${message}`),\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Load a single entry by type and ID/slug\n\t\t *\n\t\t * When filter.revisionId is set (preview mode), the entry's data\n\t\t * comes from the revisions table instead of the content table columns.\n\t\t */\n\t\tasync loadEntry({ filter }) {\n\t\t\ttry {\n\t\t\t\t// Get DB instance\n\t\t\t\tconst db = await getDb();\n\n\t\t\t\t// Both type and id are required\n\t\t\t\tconst type = filter?.type;\n\t\t\t\tconst id = filter?.id;\n\n\t\t\t\tif (!type || !id) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\terror: new Error(\n\t\t\t\t\t\t\t\"type and id filters are required. Use getEmDashEntry() instead of getLiveEntry() directly.\",\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\t// Query the per-collection table\n\t\t\t\tconst tableName = getTableName(type);\n\t\t\t\tconst locale = filter?.locale;\n\n\t\t\t\t// Use raw SQL for dynamic table name, match by slug or id\n\t\t\t\t// When locale is specified, prefer locale-scoped slug match,\n\t\t\t\t// but IDs are globally unique so always check id without locale scope.\n\t\t\t\t//\n\t\t\t\t// LEFT JOIN _emdash_seo folds per-entry SEO (canonical, noindex,\n\t\t\t\t// etc.) into this single query at zero extra round-trip cost. The\n\t\t\t\t// joined columns are surfaced as a nested data.seo object via\n\t\t\t\t// extractSeo() and excluded from the generic field mapping. SEO is\n\t\t\t\t// 1:1 with content (PK on collection+content_id), so the join never\n\t\t\t\t// multiplies rows.\n\t\t\t\tconst seoSelect = sql.join(\n\t\t\t\t\tObject.entries(SEO_COLUMN_ALIASES).map(\n\t\t\t\t\t\t([col, alias]) => sql`${sql.ref(`s.${col}`)} AS ${sql.ref(alias)}`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tconst result = locale\n\t\t\t\t\t? await sql<Record<string, unknown>>`\n\t\t\t\t\t\t\tSELECT c.*, ${seoSelect}\n\t\t\t\t\t\t\tFROM ${sql.ref(tableName)} AS c\n\t\t\t\t\t\t\tLEFT JOIN ${sql.ref(\"_emdash_seo\")} AS s\n\t\t\t\t\t\t\t\tON s.collection = ${type} AND s.content_id = c.id\n\t\t\t\t\t\t\tWHERE c.deleted_at IS NULL\n\t\t\t\t\t\t\tAND ((c.slug = ${id} AND c.locale = ${locale}) OR c.id = ${id})\n\t\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t\t`.execute(db)\n\t\t\t\t\t: await sql<Record<string, unknown>>`\n\t\t\t\t\t\t\tSELECT c.*, ${seoSelect}\n\t\t\t\t\t\t\tFROM ${sql.ref(tableName)} AS c\n\t\t\t\t\t\t\tLEFT JOIN ${sql.ref(\"_emdash_seo\")} AS s\n\t\t\t\t\t\t\t\tON s.collection = ${type} AND s.content_id = c.id\n\t\t\t\t\t\t\tWHERE c.deleted_at IS NULL\n\t\t\t\t\t\t\tAND (c.slug = ${id} OR c.id = ${id})\n\t\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t\t`.execute(db);\n\n\t\t\t\tconst row = result.rows[0];\n\t\t\t\tif (!row) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tconst i18nConfig = virtualConfig?.i18n;\n\t\t\t\tconst i18nEnabled = i18nConfig && i18nConfig.locales.length > 1;\n\t\t\t\tconst entrySlug = rowStr(row, \"slug\") || rowStr(row, \"id\");\n\t\t\t\tconst entryLocale = rowStr(row, \"locale\");\n\t\t\t\tconst shouldPrefixEntry =\n\t\t\t\t\ti18nEnabled &&\n\t\t\t\t\tentryLocale !== \"\" &&\n\t\t\t\t\t(entryLocale !== i18nConfig.defaultLocale || i18nConfig.prefixDefaultLocale);\n\t\t\t\tconst entryId = shouldPrefixEntry ? `${entryLocale}/${entrySlug}` : entrySlug;\n\n\t\t\t\t// Preview mode: override content fields with revision data,\n\t\t\t\t// keeping system metadata from the content table row.\n\t\t\t\tconst revisionId = filter?.revisionId;\n\t\t\t\tif (revisionId) {\n\t\t\t\t\tconst revRow = await sql<{ data: string }>`\n\t\t\t\t\t\tSELECT data FROM revisions\n\t\t\t\t\t\tWHERE id = ${revisionId}\n\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t`.execute(db);\n\n\t\t\t\t\tconst revData = revRow.rows[0];\n\t\t\t\t\tif (revData) {\n\t\t\t\t\t\tconst parsed: Record<string, unknown> = JSON.parse(revData.data);\n\t\t\t\t\t\t// System metadata from content table + content fields from revision\n\t\t\t\t\t\tconst systemData: Record<string, unknown> = {};\n\t\t\t\t\t\tfor (const [key, mappedKey] of Object.entries(INCLUDE_IN_DATA)) {\n\t\t\t\t\t\t\tif (key in row) {\n\t\t\t\t\t\t\t\tif (DATE_COLUMNS.has(key)) {\n\t\t\t\t\t\t\t\t\tsystemData[mappedKey] = typeof row[key] === \"string\" ? new Date(row[key]) : null;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tsystemData[mappedKey] = row[key];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Use slug from revision metadata if present, else from content table\n\t\t\t\t\t\tconst slug = typeof parsed._slug === \"string\" ? parsed._slug : rowStr(row, \"slug\");\n\t\t\t\t\t\tconst revSlug = slug || rowStr(row, \"id\");\n\t\t\t\t\t\tconst revLocale = rowStr(row, \"locale\");\n\t\t\t\t\t\tconst shouldPrefixRev =\n\t\t\t\t\t\t\ti18nEnabled &&\n\t\t\t\t\t\t\trevLocale !== \"\" &&\n\t\t\t\t\t\t\t(revLocale !== i18nConfig.defaultLocale || i18nConfig.prefixDefaultLocale);\n\t\t\t\t\t\tconst revId = shouldPrefixRev ? `${revLocale}/${revSlug}` : revSlug;\n\t\t\t\t\t\t// SEO is not revisioned — it comes from the content row's\n\t\t\t\t\t\t// joined _emdash_seo columns, not the revision snapshot.\n\t\t\t\t\t\tconst revEntryData: Record<string, unknown> = {\n\t\t\t\t\t\t\t...systemData,\n\t\t\t\t\t\t\tslug,\n\t\t\t\t\t\t\t...mapRevisionData(parsed),\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst revSeo = extractSeo(row);\n\t\t\t\t\t\tif (revSeo) revEntryData.seo = revSeo;\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tid: revId,\n\t\t\t\t\t\t\tslug,\n\t\t\t\t\t\t\tstatus: rowStr(row, \"status\", \"draft\"),\n\t\t\t\t\t\t\tdata: revEntryData,\n\t\t\t\t\t\t\tcacheHint: {\n\t\t\t\t\t\t\t\ttags: [rowStr(row, \"id\")],\n\t\t\t\t\t\t\t\tlastModified: row.updated_at ? new Date(rowStr(row, \"updated_at\")) : undefined,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst entryData = mapRowToData(row);\n\t\t\t\tconst entrySeo = extractSeo(row);\n\t\t\t\tif (entrySeo) entryData.seo = entrySeo;\n\t\t\t\treturn {\n\t\t\t\t\tid: entryId,\n\t\t\t\t\tslug: rowStr(row, \"slug\"),\n\t\t\t\t\tstatus: rowStr(row, \"status\", \"draft\"),\n\t\t\t\t\tdata: entryData,\n\t\t\t\t\tcacheHint: {\n\t\t\t\t\t\ttags: [rowStr(row, \"id\")],\n\t\t\t\t\t\tlastModified: row.updated_at ? new Date(rowStr(row, \"updated_at\")) : undefined,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t} catch (error) {\n\t\t\t\t// Handle missing table gracefully - return undefined (not found).\n\t\t\t\t// This happens before migrations have run.\n\t\t\t\tif (isMissingTableError(error)) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\treturn {\n\t\t\t\t\terror: new Error(`Failed to load entry: ${message}`),\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,MAAM,qBAAqB;;;;;;;;;;;;;AAc3B,MAAM,qBAA6C;CAClD,WAAW;CACX,iBAAiB;CACjB,WAAW;CACX,eAAe;CACf,cAAc;CACd;;AAGD,MAAM,oBAAoB,OAAO,OAAO,mBAAmB;;;;;AAM3D,MAAM,iBAAiB,IAAI,IAAI;CAC9B;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAKA,GAAG;CACH,CAAC;;;;;;;;;AAmBF,SAAS,WAAW,KAA+C;CAClE,MAAM,UAAU,IAAI,mBAAmB;AACvC,KAAI,YAAY,QAAQ,YAAY,OAAW,QAAO;CACtD,MAAM,QAAQ,IAAI,mBAAmB;CACrC,MAAM,cAAc,IAAI,mBAAmB;CAC3C,MAAM,QAAQ,IAAI,mBAAmB;CACrC,MAAM,YAAY,IAAI,mBAAmB;AACzC,QAAO;EACN,OAAO,OAAO,UAAU,WAAW,QAAQ;EAC3C,aAAa,OAAO,gBAAgB,WAAW,cAAc;EAC7D,OAAO,OAAO,UAAU,WAAW,QAAQ;EAC3C,WAAW,OAAO,cAAc,WAAW,YAAY;EACvD,SAAS,YAAY;EACrB;;;;;AAMF,SAAS,aAAa,MAAsB;AAC3C,oB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IAIH,MAAM,YAAY,aAAa,IAAI;IACnC,MAAM,WAAW,WAAW,IAAI;AAChC,QAAI,SAAU,WAAU,MAAM;AAC9B,WAAO;KACN,IAAI;KACJ,MAAM,OAAO,KAAK,OAAO;KACzB,QAAQ,OAAO,KAAK,UAAU,QAAQ;KACtC,MAAM;KACN,WAAW;MACV,MAAM,CAAC,OAAO,KAAK,KAAK,CAAC;MACzB,cAAc,IAAI,aAAa,IAAI,KAAK,OAAO,KAAK,aAAa,CAAC,GAAG;MACrE;KACD;YACO,OAAO;AAGf,QAAI,oBAAoB,MAAM,CAC7B;IAGD,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;AACtE,WAAO,EACN,uBAAO,IAAI,MAAM,yBAAyB,UAAU,EACpD;;;EAGH"}
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { capabilitiesToDeclaredAccess, declaredAccessToCapabilities } from "@emdash-cms/plugin-types";
2
3
 
3
4
  //#region src/plugins/manifest-schema.ts
4
5
  /**
@@ -202,13 +203,48 @@ const pluginAdminConfigSchema = z.object({
202
203
  })).optional()
203
204
  });
204
205
  /**
206
+ * An operation's constraint object. Open vocabulary: keys the runtime
207
+ * recognises are enforced, others are advisory. The bundler emits `{}` for a
208
+ * granted operation; presence (not value) signals the grant.
209
+ */
210
+ const accessConstraints = z.record(z.string(), z.unknown());
211
+ /**
212
+ * Structured trust contract embedded in the bundle manifest. Mirrors
213
+ * `DeclaredAccess` in `@emdash-cms/plugin-types`. Categories are host
214
+ * subsystems; operations are modes of participation.
215
+ */
216
+ const declaredAccessSchema = z.object({
217
+ content: z.object({
218
+ read: accessConstraints.optional(),
219
+ write: accessConstraints.optional()
220
+ }).optional(),
221
+ media: z.object({
222
+ read: accessConstraints.optional(),
223
+ write: accessConstraints.optional()
224
+ }).optional(),
225
+ network: z.object({ request: z.object({ allowedHosts: z.array(z.string()).min(1).optional() }).optional() }).optional(),
226
+ email: z.object({
227
+ send: accessConstraints.optional(),
228
+ events: accessConstraints.optional(),
229
+ transport: accessConstraints.optional()
230
+ }).optional(),
231
+ page: z.object({ fragments: accessConstraints.optional() }).optional(),
232
+ users: z.object({ read: accessConstraints.optional() }).optional()
233
+ });
234
+ /**
205
235
  * Zod schema matching the PluginManifest interface from types.ts.
206
236
  *
207
237
  * Every JSON.parse of a manifest.json should validate through this.
238
+ *
239
+ * `declaredAccess` is the trust contract; `capabilities`/`allowedHosts` are the
240
+ * runtime's enforcement currency. Apply `reconcileManifestAccess` after parsing
241
+ * to make them consistent (declaredAccess authoritative when present). Kept a
242
+ * plain object (no `.transform`) because callers `.pick()`/`.extend()` it.
208
243
  */
209
244
  const pluginManifestSchema = z.object({
210
245
  id: z.string().min(1),
211
246
  version: z.string().min(1),
247
+ declaredAccess: declaredAccessSchema.optional(),
212
248
  capabilities: z.array(z.enum(PLUGIN_CAPABILITIES)),
213
249
  allowedHosts: z.array(z.string()),
214
250
  storage: z.record(z.string(), storageCollectionSchema),
@@ -217,6 +253,23 @@ const pluginManifestSchema = z.object({
217
253
  admin: pluginAdminConfigSchema
218
254
  });
219
255
  /**
256
+ * Reconcile a parsed manifest's trust contract with its enforcement currency.
257
+ * `declaredAccess` is authoritative: when present, `capabilities`/`allowedHosts`
258
+ * are re-derived from it so what the runtime enforces always matches what was
259
+ * recorded and consented to. A pre-migration bundle without `declaredAccess`
260
+ * has it derived from the legacy capability list instead. The result always
261
+ * carries both, mutually consistent. Apply this at every bundle-parse site.
262
+ */
263
+ function reconcileManifestAccess(manifest) {
264
+ return manifest.declaredAccess ? {
265
+ ...manifest,
266
+ ...declaredAccessToCapabilities(manifest.declaredAccess)
267
+ } : {
268
+ ...manifest,
269
+ declaredAccess: capabilitiesToDeclaredAccess(manifest.capabilities, manifest.allowedHosts)
270
+ };
271
+ }
272
+ /**
220
273
  * Normalize a manifest route entry — plain strings become `{ name }` objects.
221
274
  */
222
275
  function normalizeManifestRoute(entry) {
@@ -225,5 +278,5 @@ function normalizeManifestRoute(entry) {
225
278
  }
226
279
 
227
280
  //#endregion
228
- export { pluginManifestSchema as i, PLUGIN_CAPABILITIES as n, normalizeManifestRoute as r, HOOK_NAMES as t };
229
- //# sourceMappingURL=manifest-schema-Cj-YrzrF.mjs.map
281
+ export { reconcileManifestAccess as a, pluginManifestSchema as i, PLUGIN_CAPABILITIES as n, normalizeManifestRoute as r, HOOK_NAMES as t };
282
+ //# sourceMappingURL=manifest-schema-BtwbL_vj.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest-schema-BtwbL_vj.mjs","names":[],"sources":["../src/plugins/manifest-schema.ts"],"sourcesContent":["/**\n * Zod schema for PluginManifest validation\n *\n * Used to validate manifest.json from plugin bundles at every parse site:\n * - Client-side download (marketplace.ts extractBundle)\n * - R2 load (api/handlers/marketplace.ts loadBundleFromR2)\n * - CLI publish preview (cli/commands/publish.ts readManifestFromTarball)\n * - Marketplace ingest extends this with publishing-specific fields\n */\n\nimport {\n\tcapabilitiesToDeclaredAccess,\n\tdeclaredAccessToCapabilities,\n} from \"@emdash-cms/plugin-types\";\nimport { z } from \"zod\";\n\nimport type { PluginManifest } from \"./types.js\";\n\n// ── Enum values (must stay in sync with types.ts) ───────────────\n\n/**\n * Current capability names — the ones authors should use going forward.\n * See `PluginCapability` in `types.ts` for documentation of each.\n */\nexport const CURRENT_PLUGIN_CAPABILITIES = [\n\t\"network:request\",\n\t\"network:request:unrestricted\",\n\t\"content:read\",\n\t\"content:write\",\n\t\"media:read\",\n\t\"media:write\",\n\t\"users:read\",\n\t\"email:send\",\n\t\"hooks.email-transport:register\",\n\t\"hooks.email-events:register\",\n\t\"hooks.page-fragments:register\",\n] as const;\n\n/**\n * Legacy capability names accepted during the deprecation window.\n * Normalized to current names via `normalizeCapability()` in types.ts\n * before reaching the runtime. Plugin authors are warned at bundle/validate\n * and hard-failed at publish.\n */\nexport const DEPRECATED_PLUGIN_CAPABILITIES = [\n\t\"network:fetch\",\n\t\"network:fetch:any\",\n\t\"read:content\",\n\t\"write:content\",\n\t\"read:media\",\n\t\"write:media\",\n\t\"read:users\",\n\t\"email:provide\",\n\t\"email:intercept\",\n\t\"page:inject\",\n] as const;\n\n/**\n * Full set of accepted capability strings — current + deprecated.\n *\n * The manifest schema accepts both during the transition. The runtime only\n * ever sees current names because `normalizeCapability()` rewrites legacy\n * names at every external boundary (definePlugin, adaptSandboxEntry).\n */\nexport const PLUGIN_CAPABILITIES = [\n\t...CURRENT_PLUGIN_CAPABILITIES,\n\t...DEPRECATED_PLUGIN_CAPABILITIES,\n] as const;\n\n/** Must stay in sync with FieldType in schema/types.ts */\nconst FIELD_TYPES = [\n\t\"string\",\n\t\"text\",\n\t\"number\",\n\t\"integer\",\n\t\"boolean\",\n\t\"datetime\",\n\t\"select\",\n\t\"multiSelect\",\n\t\"portableText\",\n\t\"image\",\n\t\"file\",\n\t\"reference\",\n\t\"json\",\n\t\"slug\",\n\t\"repeater\",\n] as const;\n\nexport const HOOK_NAMES = [\n\t\"plugin:install\",\n\t\"plugin:activate\",\n\t\"plugin:deactivate\",\n\t\"plugin:uninstall\",\n\t\"content:beforeSave\",\n\t\"content:afterSave\",\n\t\"content:beforeDelete\",\n\t\"content:afterDelete\",\n\t\"content:afterPublish\",\n\t\"content:afterUnpublish\",\n\t\"media:beforeUpload\",\n\t\"media:afterUpload\",\n\t\"cron\",\n\t\"email:beforeSend\",\n\t\"email:deliver\",\n\t\"email:afterSend\",\n\t\"comment:beforeCreate\",\n\t\"comment:moderate\",\n\t\"comment:afterCreate\",\n\t\"comment:afterModerate\",\n\t\"page:metadata\",\n\t\"page:fragments\",\n] as const;\n\n/**\n * Structured hook entry for manifest — name plus optional metadata.\n * During a transition period, both plain strings and objects are accepted.\n */\nconst manifestHookEntrySchema = z.object({\n\tname: z.enum(HOOK_NAMES),\n\texclusive: z.boolean().optional(),\n\tpriority: z.number().int().optional(),\n\ttimeout: z.number().int().positive().optional(),\n});\n\n/**\n * Structured route entry for manifest — name plus optional metadata.\n * Both plain strings and objects are accepted; strings are normalized\n * to `{ name }` objects via `normalizeManifestRoute()`.\n */\n/** Route names must be safe path segments — alphanumeric, hyphens, underscores, forward slashes */\nconst routeNamePattern = /^[a-zA-Z0-9][a-zA-Z0-9_\\-/]*$/;\n\nconst manifestRouteEntrySchema = z.object({\n\tname: z.string().min(1).regex(routeNamePattern, \"Route name must be a safe path segment\"),\n\tpublic: z.boolean().optional(),\n});\n\n// ── Sub-schemas ─────────────────────────────────────────────────\n\n/** Index field names must be valid identifiers to prevent SQL injection via JSON path expressions */\nconst indexFieldName = z.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/);\n\nconst storageCollectionSchema = z.object({\n\tindexes: z.array(z.union([indexFieldName, z.array(indexFieldName)])),\n\tuniqueIndexes: z.array(z.union([indexFieldName, z.array(indexFieldName)])).optional(),\n});\n\nconst baseSettingFields = {\n\tlabel: z.string(),\n\tdescription: z.string().optional(),\n};\n\nconst settingFieldSchema = z.discriminatedUnion(\"type\", [\n\tz.object({\n\t\t...baseSettingFields,\n\t\ttype: z.literal(\"string\"),\n\t\tdefault: z.string().optional(),\n\t\tmultiline: z.boolean().optional(),\n\t}),\n\tz.object({\n\t\t...baseSettingFields,\n\t\ttype: z.literal(\"number\"),\n\t\tdefault: z.number().optional(),\n\t\tmin: z.number().optional(),\n\t\tmax: z.number().optional(),\n\t}),\n\tz.object({ ...baseSettingFields, type: z.literal(\"boolean\"), default: z.boolean().optional() }),\n\tz.object({\n\t\t...baseSettingFields,\n\t\ttype: z.literal(\"select\"),\n\t\toptions: z.array(z.object({ value: z.string(), label: z.string() })),\n\t\tdefault: z.string().optional(),\n\t}),\n\tz.object({ ...baseSettingFields, type: z.literal(\"secret\") }),\n\tz.object({\n\t\t...baseSettingFields,\n\t\ttype: z.literal(\"url\"),\n\t\tdefault: z.string().optional(),\n\t\tplaceholder: z.string().optional(),\n\t}),\n\tz.object({\n\t\t...baseSettingFields,\n\t\ttype: z.literal(\"email\"),\n\t\tdefault: z.string().optional(),\n\t\tplaceholder: z.string().optional(),\n\t}),\n]);\n\nconst adminPageSchema = z.object({\n\tpath: z.string(),\n\tlabel: z.string(),\n\ticon: z.string().optional(),\n});\n\nconst dashboardWidgetSchema = z.object({\n\tid: z.string(),\n\tsize: z.enum([\"full\", \"half\", \"third\"]).optional(),\n\ttitle: z.string().optional(),\n});\n\nconst pluginAdminConfigSchema = z.object({\n\tentry: z.string().optional(),\n\tsettingsSchema: z.record(z.string(), settingFieldSchema).optional(),\n\tpages: z.array(adminPageSchema).optional(),\n\twidgets: z.array(dashboardWidgetSchema).optional(),\n\tfieldWidgets: z\n\t\t.array(\n\t\t\tz.object({\n\t\t\t\tname: z.string().min(1),\n\t\t\t\tlabel: z.string().min(1),\n\t\t\t\tfieldTypes: z.array(z.enum(FIELD_TYPES)),\n\t\t\t\telements: z\n\t\t\t\t\t.array(\n\t\t\t\t\t\tz\n\t\t\t\t\t\t\t.object({\n\t\t\t\t\t\t\t\ttype: z.string(),\n\t\t\t\t\t\t\t\taction_id: z.string(),\n\t\t\t\t\t\t\t\tlabel: z.string().optional(),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.passthrough(),\n\t\t\t\t\t)\n\t\t\t\t\t.optional(),\n\t\t\t}),\n\t\t)\n\t\t.optional(),\n});\n\n// ── declaredAccess ──────────────────────────────────────────────\n\n/**\n * An operation's constraint object. Open vocabulary: keys the runtime\n * recognises are enforced, others are advisory. The bundler emits `{}` for a\n * granted operation; presence (not value) signals the grant.\n */\nconst accessConstraints = z.record(z.string(), z.unknown());\n\n/**\n * Structured trust contract embedded in the bundle manifest. Mirrors\n * `DeclaredAccess` in `@emdash-cms/plugin-types`. Categories are host\n * subsystems; operations are modes of participation.\n */\nconst declaredAccessSchema = z.object({\n\tcontent: z\n\t\t.object({ read: accessConstraints.optional(), write: accessConstraints.optional() })\n\t\t.optional(),\n\tmedia: z\n\t\t.object({ read: accessConstraints.optional(), write: accessConstraints.optional() })\n\t\t.optional(),\n\tnetwork: z\n\t\t.object({\n\t\t\t// allowedHosts: absent = unrestricted; present = host-restricted. Reject\n\t\t\t// an empty array (which the decoder would otherwise have to treat as\n\t\t\t// deny-all) to match the record lexicon's `minLength: 1` and keep the\n\t\t\t// \"absent vs empty\" distinction from ever reaching enforcement ambiguous.\n\t\t\trequest: z.object({ allowedHosts: z.array(z.string()).min(1).optional() }).optional(),\n\t\t})\n\t\t.optional(),\n\temail: z\n\t\t.object({\n\t\t\tsend: accessConstraints.optional(),\n\t\t\tevents: accessConstraints.optional(),\n\t\t\ttransport: accessConstraints.optional(),\n\t\t})\n\t\t.optional(),\n\tpage: z.object({ fragments: accessConstraints.optional() }).optional(),\n\tusers: z.object({ read: accessConstraints.optional() }).optional(),\n});\n\n// ── Main schema ─────────────────────────────────────────────────\n\n/**\n * Zod schema matching the PluginManifest interface from types.ts.\n *\n * Every JSON.parse of a manifest.json should validate through this.\n *\n * `declaredAccess` is the trust contract; `capabilities`/`allowedHosts` are the\n * runtime's enforcement currency. Apply `reconcileManifestAccess` after parsing\n * to make them consistent (declaredAccess authoritative when present). Kept a\n * plain object (no `.transform`) because callers `.pick()`/`.extend()` it.\n */\nexport const pluginManifestSchema = z.object({\n\tid: z.string().min(1),\n\tversion: z.string().min(1),\n\tdeclaredAccess: declaredAccessSchema.optional(),\n\tcapabilities: z.array(z.enum(PLUGIN_CAPABILITIES)),\n\tallowedHosts: z.array(z.string()),\n\tstorage: z.record(z.string(), storageCollectionSchema),\n\t/**\n\t * Hook declarations — accepts both plain name strings (legacy) and\n\t * structured objects with exclusive/priority/timeout metadata.\n\t * Plain strings are normalized to `{ name }` objects after parsing.\n\t */\n\thooks: z.array(z.union([z.enum(HOOK_NAMES), manifestHookEntrySchema])),\n\t/**\n\t * Route declarations — accepts both plain name strings and\n\t * structured objects with public metadata.\n\t * Plain strings are normalized to `{ name }` objects after parsing.\n\t */\n\troutes: z.array(\n\t\tz.union([\n\t\t\tz.string().min(1).regex(routeNamePattern, \"Route name must be a safe path segment\"),\n\t\t\tmanifestRouteEntrySchema,\n\t\t]),\n\t),\n\tadmin: pluginAdminConfigSchema,\n});\n\nexport type ValidatedPluginManifest = z.infer<typeof pluginManifestSchema>;\n\n/**\n * Reconcile a parsed manifest's trust contract with its enforcement currency.\n * `declaredAccess` is authoritative: when present, `capabilities`/`allowedHosts`\n * are re-derived from it so what the runtime enforces always matches what was\n * recorded and consented to. A pre-migration bundle without `declaredAccess`\n * has it derived from the legacy capability list instead. The result always\n * carries both, mutually consistent. Apply this at every bundle-parse site.\n */\nexport function reconcileManifestAccess(manifest: ValidatedPluginManifest): PluginManifest {\n\tconst reconciled: ValidatedPluginManifest = manifest.declaredAccess\n\t\t? { ...manifest, ...declaredAccessToCapabilities(manifest.declaredAccess) }\n\t\t: {\n\t\t\t\t...manifest,\n\t\t\t\tdeclaredAccess: capabilitiesToDeclaredAccess(manifest.capabilities, manifest.allowedHosts),\n\t\t\t};\n\t// Block Kit admin elements are typed as `unknown` by the Zod schema (their\n\t// Element shape is validated at render time), so the validated manifest\n\t// needs a structural cast up to the runtime PluginManifest.\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- admin elements are unknown[] in Zod; Element type checked at render time\n\treturn reconciled as unknown as PluginManifest;\n}\n\n/**\n * Normalize a manifest hook entry — plain strings become `{ name }` objects.\n */\nexport function normalizeManifestHook(\n\tentry: string | { name: string; exclusive?: boolean; priority?: number; timeout?: number },\n): { name: string; exclusive?: boolean; priority?: number; timeout?: number } {\n\tif (typeof entry === \"string\") {\n\t\treturn { name: entry };\n\t}\n\treturn entry;\n}\n\n/**\n * Normalize a manifest route entry — plain strings become `{ name }` objects.\n */\nexport function normalizeManifestRoute(entry: string | { name: string; public?: boolean }): {\n\tname: string;\n\tpublic?: boolean;\n} {\n\tif (typeof entry === \"string\") {\n\t\treturn { name: entry };\n\t}\n\treturn entry;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAwBA,MAAa,8BAA8B;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;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Q,kBAAkB,UAAU;EACpC,WAAW,kBAAkB,UAAU;EACvC,CAAC,CACD,UAAU;CACZ,MAAM,EAAE,OAAO,EAAE,WAAW,kBAAkB,UAAU,EAAE,CAAC,CAAC,UAAU;CACtE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,UAAU,EAAE,CAAC,CAAC,UAAU;CAClE,CAAC;;;;;;;;;;;AAcF,MAAa,uBAAuB,EAAE,OAAO;CAC5C,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE;CACrB,SAAS,EAAE,QAAQ,CAAC,IAAI,EAAE;CAC1B,gBAAgB,qBAAqB,UAAU;CAC/C,cAAc,EAAE,MAAM,EAAE,KAAK,oBAAoB,CAAC;CAClD,cAAc,EAAE,MAAM,EAAE,QAAQ,CAAC;CACjC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,wBAAwB;CAMtD,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,WAAW,EAAE,wBAAwB,CAAC,CAAC;CAMtE,QAAQ,EAAE,MACT,EAAE,MAAM,CACP,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,kBAAkB,yCAAyC,EACnF,yBACA,CAAC,CACF;CACD,OAAO;CACP,CAAC;;;;;;;;;AAYF,SAAgB,wBAAwB,UAAmD;AAW1F,QAV4C,SAAS,iBAClD;EAAE,GAAG;EAAU,GAAG,6BAA6B,SAAS,eAAe;EAAE,GACzE;EACA,GAAG;EACH,gBAAgB,6BAA6B,SAAS,cAAc,SAAS,aAAa;EAC1F;;;;;AAuBJ,SAAgB,uBAAuB,OAGrC;AACD,KAAI,OAAO,UAAU,SACpB,QAAO,EAAE,MAAM,OAAO;AAEvB,QAAO"}
@@ -1,4 +1,4 @@
1
- import { _ as MediaValue, a as ComponentEmbed, b as mediaItemToValue, c as EmbedResult, d as MediaListResult, f as MediaProvider, g as MediaUploadInput, h as MediaProviderItem, i as AudioEmbed, l as ImageEmbed, m as MediaProviderDescriptor, n as generatePlaceholder, o as CreateMediaProviderFn, p as MediaProviderCapabilities, r as normalizeMediaValue, s as EmbedOptions, t as PlaceholderData, u as MediaListOptions, v as ThumbnailOptions, y as VideoEmbed } from "../placeholder-B9lUUEmj.mjs";
1
+ import { _ as MediaValue, a as ComponentEmbed, b as mediaItemToValue, c as EmbedResult, d as MediaListResult, f as MediaProvider, g as MediaUploadInput, h as MediaProviderItem, i as AudioEmbed, l as ImageEmbed, m as MediaProviderDescriptor, n as generatePlaceholder, o as CreateMediaProviderFn, p as MediaProviderCapabilities, r as normalizeMediaValue, s as EmbedOptions, t as PlaceholderData, u as MediaListOptions, v as ThumbnailOptions, y as VideoEmbed } from "../placeholder-CVBv5z8k.mjs";
2
2
 
3
3
  //#region src/media/local.d.ts
4
4
  interface LocalMediaConfig {
@@ -1,14 +1,14 @@
1
- import "../options-D4MnavW_.mjs";
2
- import { t as Database } from "../types-OT_Es5mp.mjs";
3
- import "../types-DMwSpvcw.mjs";
4
- import "../byline-fields-DYXKDuNX.mjs";
5
- import { h as MediaProviderItem, o as CreateMediaProviderFn } from "../placeholder-B9lUUEmj.mjs";
6
- import "../index-FfiTQJq2.mjs";
7
- import "../runner-BcRuXq_h.mjs";
8
- import "../index-BpYeJO1E.mjs";
9
- import { d as Storage } from "../types-kwqCOUxj.mjs";
10
- import "../types-DWnN7weG.mjs";
11
- import "../validate-BPAHUSge.mjs";
1
+ import "../options-DyYIYpPd.mjs";
2
+ import { t as Database } from "../types-BPzXTV9x.mjs";
3
+ import "../types-CPAPl93j.mjs";
4
+ import "../byline-fields-DbibsvTl.mjs";
5
+ import { h as MediaProviderItem, o as CreateMediaProviderFn } from "../placeholder-CVBv5z8k.mjs";
6
+ import "../index-B1keaX5Y.mjs";
7
+ import "../runner-DTdhuI9i.mjs";
8
+ import "../index-DR56od45.mjs";
9
+ import { d as Storage } from "../types-D4kUqbHh.mjs";
10
+ import "../types-BFgrqwSk.mjs";
11
+ import "../validate-CNwkPWzz.mjs";
12
12
  import "../index.mjs";
13
13
  import { Kysely } from "kysely";
14
14
 
@@ -4,8 +4,8 @@ import "../types-BXSUSAjt.mjs";
4
4
  import { t as MediaRepository } from "../media-JOf3pNkw.mjs";
5
5
  import "../options-BPCVnesz.mjs";
6
6
  import "../request-cache-D32LpnmI.mjs";
7
- import "../loader-CpZKpFz0.mjs";
8
- import { o as invalidateSiteSettingsCache } from "../settings-B1p-gPUK.mjs";
7
+ import "../loader-ZN1ll-d-.mjs";
8
+ import { o as invalidateSiteSettingsCache } from "../settings-DfxiWY_s.mjs";
9
9
 
10
10
  //#region src/media/local-runtime.ts
11
11
  /**
@@ -29,4 +29,4 @@ async function resolveFieldAllowlist(db, fieldId) {
29
29
 
30
30
  //#endregion
31
31
  export { resolveFieldAllowlist as n, GLOBAL_UPLOAD_ALLOWLIST as t };
32
- //# sourceMappingURL=media-allowlist-CMcoYIjQ.mjs.map
32
+ //# sourceMappingURL=media-allowlist-Dknq-OFY.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"media-allowlist-CMcoYIjQ.mjs","names":[],"sources":["../src/api/handlers/media-allowlist.ts"],"sourcesContent":["import type { Kysely } from \"kysely\";\n\nimport type { Database } from \"../../database/types.js\";\nimport { parseAllowedMimeTypes } from \"../../media/mime.js\";\n\n/**\n * MIME types allowed for upload by default (when no field-specific list\n * overrides this). Entries ending with \"/\" are prefix-matched (e.g.\n * \"image/\" matches \"image/jpeg\", \"image/png\", etc.).\n */\nexport const GLOBAL_UPLOAD_ALLOWLIST: readonly string[] = [\n\t\"image/\",\n\t\"video/\",\n\t\"audio/\",\n\t\"application/pdf\",\n];\n\n/**\n * Resolve the MIME allowlist for a specific field.\n *\n * Returns the field's `allowedMimeTypes` list when the field exists, is of\n * type \"file\" or \"image\", and has a non-empty list configured. Returns null\n * in all other cases — callers should fall back to GLOBAL_UPLOAD_ALLOWLIST.\n *\n * Authentication is the caller's responsibility (the upload routes already\n * gate on `media:upload`).\n */\nexport async function resolveFieldAllowlist(\n\tdb: Kysely<Database>,\n\tfieldId: string,\n): Promise<string[] | null> {\n\tconst row = await db\n\t\t.selectFrom(\"_emdash_fields\")\n\t\t.select([\"type\", \"validation\"])\n\t\t.where(\"id\", \"=\", fieldId)\n\t\t.where(\"type\", \"in\", [\"file\", \"image\"])\n\t\t.executeTakeFirst();\n\n\treturn row ? parseAllowedMimeTypes(row.validation) : null;\n}\n"],"mappings":";;;;;;;;AAUA,MAAa,0BAA6C;CACzD;CACA;CACA;CACA;CACA;;;;;;;;;;;AAYD,eAAsB,sBACrB,IACA,SAC2B;CAC3B,MAAM,MAAM,MAAM,GAChB,WAAW,iBAAiB,CAC5B,OAAO,CAAC,QAAQ,aAAa,CAAC,CAC9B,MAAM,MAAM,KAAK,QAAQ,CACzB,MAAM,QAAQ,MAAM,CAAC,QAAQ,QAAQ,CAAC,CACtC,kBAAkB;AAEpB,QAAO,MAAM,sBAAsB,IAAI,WAAW,GAAG"}
1
+ {"version":3,"file":"media-allowlist-Dknq-OFY.mjs","names":[],"sources":["../src/api/handlers/media-allowlist.ts"],"sourcesContent":["import type { Kysely } from \"kysely\";\n\nimport type { Database } from \"../../database/types.js\";\nimport { parseAllowedMimeTypes } from \"../../media/mime.js\";\n\n/**\n * MIME types allowed for upload by default (when no field-specific list\n * overrides this). Entries ending with \"/\" are prefix-matched (e.g.\n * \"image/\" matches \"image/jpeg\", \"image/png\", etc.).\n */\nexport const GLOBAL_UPLOAD_ALLOWLIST: readonly string[] = [\n\t\"image/\",\n\t\"video/\",\n\t\"audio/\",\n\t\"application/pdf\",\n];\n\n/**\n * Resolve the MIME allowlist for a specific field.\n *\n * Returns the field's `allowedMimeTypes` list when the field exists, is of\n * type \"file\" or \"image\", and has a non-empty list configured. Returns null\n * in all other cases — callers should fall back to GLOBAL_UPLOAD_ALLOWLIST.\n *\n * Authentication is the caller's responsibility (the upload routes already\n * gate on `media:upload`).\n */\nexport async function resolveFieldAllowlist(\n\tdb: Kysely<Database>,\n\tfieldId: string,\n): Promise<string[] | null> {\n\tconst row = await db\n\t\t.selectFrom(\"_emdash_fields\")\n\t\t.select([\"type\", \"validation\"])\n\t\t.where(\"id\", \"=\", fieldId)\n\t\t.where(\"type\", \"in\", [\"file\", \"image\"])\n\t\t.executeTakeFirst();\n\n\treturn row ? parseAllowedMimeTypes(row.validation) : null;\n}\n"],"mappings":";;;;;;;;AAUA,MAAa,0BAA6C;CACzD;CACA;CACA;CACA;CACA;;;;;;;;;;;AAYD,eAAsB,sBACrB,IACA,SAC2B;CAC3B,MAAM,MAAM,MAAM,GAChB,WAAW,iBAAiB,CAC5B,OAAO,CAAC,QAAQ,aAAa,CAAC,CAC9B,MAAM,MAAM,KAAK,QAAQ,CACzB,MAAM,QAAQ,MAAM,CAAC,QAAQ,QAAQ,CAAC,CACtC,kBAAkB;AAEpB,QAAO,MAAM,sBAAsB,IAAI,WAAW,GAAG"}