emdash 0.16.1 → 0.17.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 (562) hide show
  1. package/dist/{adapters-C4yd_UJR.d.mts → adapters-C5AWLJSD.d.mts} +1 -1
  2. package/dist/{adapters-C4yd_UJR.d.mts.map → adapters-C5AWLJSD.d.mts.map} +1 -1
  3. package/dist/{allowed-origins-D0fFk9a6.mjs → allowed-origins-CyYLEJkp.mjs} +2 -2
  4. package/dist/{allowed-origins-D0fFk9a6.mjs.map → allowed-origins-CyYLEJkp.mjs.map} +1 -1
  5. package/dist/api/route-utils.d.mts +3 -3
  6. package/dist/api/route-utils.mjs +16 -16
  7. package/dist/api/schemas/index.d.mts +2 -2
  8. package/dist/api/schemas/index.mjs +3 -3
  9. package/dist/{api-BNKqxyFX.mjs → api-Dmz40c2V.mjs} +44 -22
  10. package/dist/api-Dmz40c2V.mjs.map +1 -0
  11. package/dist/{api-tokens-ucpcNXDt.mjs → api-tokens-VrXNiNvV.mjs} +2 -2
  12. package/dist/{api-tokens-ucpcNXDt.mjs.map → api-tokens-VrXNiNvV.mjs.map} +1 -1
  13. package/dist/{apply-BOPaD-s9.mjs → apply-CgamLmed.mjs} +93 -31
  14. package/dist/apply-CgamLmed.mjs.map +1 -0
  15. package/dist/astro/index.d.mts +10 -10
  16. package/dist/astro/index.mjs +19 -3
  17. package/dist/astro/index.mjs.map +1 -1
  18. package/dist/astro/middleware/auth.d.mts +9 -9
  19. package/dist/astro/middleware/auth.mjs +6 -6
  20. package/dist/astro/middleware/redirect.d.mts.map +1 -1
  21. package/dist/astro/middleware/redirect.mjs +9 -5
  22. package/dist/astro/middleware/redirect.mjs.map +1 -1
  23. package/dist/astro/middleware/request-context.mjs +2 -2
  24. package/dist/astro/middleware/setup.mjs +1 -1
  25. package/dist/astro/middleware.mjs +66 -65
  26. package/dist/astro/middleware.mjs.map +1 -1
  27. package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +5 -5
  28. package/dist/astro/routes/api/admin/allowed-domains/index.mjs +5 -5
  29. package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +4 -4
  30. package/dist/astro/routes/api/admin/api-tokens/index.mjs +5 -5
  31. package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.d.mts +8 -0
  32. package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.d.mts.map +1 -0
  33. package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +23 -0
  34. package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs.map +1 -0
  35. package/dist/astro/routes/api/admin/byline-fields/_slug_.d.mts +10 -0
  36. package/dist/astro/routes/api/admin/byline-fields/_slug_.d.mts.map +1 -0
  37. package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +55 -0
  38. package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs.map +1 -0
  39. package/dist/astro/routes/api/admin/byline-fields/index.d.mts +9 -0
  40. package/dist/astro/routes/api/admin/byline-fields/index.d.mts.map +1 -0
  41. package/dist/astro/routes/api/admin/byline-fields/index.mjs +43 -0
  42. package/dist/astro/routes/api/admin/byline-fields/index.mjs.map +1 -0
  43. package/dist/astro/routes/api/admin/byline-fields/reorder.d.mts +8 -0
  44. package/dist/astro/routes/api/admin/byline-fields/reorder.d.mts.map +1 -0
  45. package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +27 -0
  46. package/dist/astro/routes/api/admin/byline-fields/reorder.mjs.map +1 -0
  47. package/dist/astro/routes/api/admin/bylines/_id_/index.d.mts.map +1 -1
  48. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +27 -28
  49. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs.map +1 -1
  50. package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +13 -12
  51. package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs.map +1 -1
  52. package/dist/astro/routes/api/admin/bylines/index.mjs +15 -13
  53. package/dist/astro/routes/api/admin/bylines/index.mjs.map +1 -1
  54. package/dist/astro/routes/api/admin/comments/_id_/status.mjs +10 -10
  55. package/dist/astro/routes/api/admin/comments/_id_.mjs +5 -5
  56. package/dist/astro/routes/api/admin/comments/bulk.mjs +8 -8
  57. package/dist/astro/routes/api/admin/comments/counts.mjs +5 -5
  58. package/dist/astro/routes/api/admin/comments/index.mjs +8 -8
  59. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +4 -4
  60. package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +3 -3
  61. package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +4 -4
  62. package/dist/astro/routes/api/admin/oauth-clients/index.mjs +4 -4
  63. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +35 -34
  64. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs.map +1 -1
  65. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +35 -34
  66. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs.map +1 -1
  67. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +34 -33
  68. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs.map +1 -1
  69. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +34 -33
  70. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs.map +1 -1
  71. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +34 -33
  72. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs.map +1 -1
  73. package/dist/astro/routes/api/admin/plugins/index.mjs +34 -33
  74. package/dist/astro/routes/api/admin/plugins/index.mjs.map +1 -1
  75. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +3 -3
  76. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +34 -33
  77. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs.map +1 -1
  78. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +34 -33
  79. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs.map +1 -1
  80. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +34 -33
  81. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs.map +1 -1
  82. package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs +34 -33
  83. package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs.map +1 -1
  84. package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs +35 -34
  85. package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs.map +1 -1
  86. package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs +34 -33
  87. package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs.map +1 -1
  88. package/dist/astro/routes/api/admin/plugins/registry/install.mjs +35 -34
  89. package/dist/astro/routes/api/admin/plugins/registry/install.mjs.map +1 -1
  90. package/dist/astro/routes/api/admin/plugins/updates.mjs +34 -33
  91. package/dist/astro/routes/api/admin/plugins/updates.mjs.map +1 -1
  92. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +34 -33
  93. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs.map +1 -1
  94. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +3 -3
  95. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +34 -33
  96. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs.map +1 -1
  97. package/dist/astro/routes/api/admin/users/_id_/disable.mjs +2 -2
  98. package/dist/astro/routes/api/admin/users/_id_/enable.mjs +2 -2
  99. package/dist/astro/routes/api/admin/users/_id_/index.mjs +5 -5
  100. package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +3 -3
  101. package/dist/astro/routes/api/admin/users/index.mjs +5 -5
  102. package/dist/astro/routes/api/auth/dev-bypass.mjs +5 -5
  103. package/dist/astro/routes/api/auth/invite/accept.mjs +2 -2
  104. package/dist/astro/routes/api/auth/invite/complete.mjs +9 -9
  105. package/dist/astro/routes/api/auth/invite/index.mjs +6 -6
  106. package/dist/astro/routes/api/auth/invite/register-options.mjs +8 -8
  107. package/dist/astro/routes/api/auth/logout.mjs +3 -3
  108. package/dist/astro/routes/api/auth/magic-link/send.mjs +8 -8
  109. package/dist/astro/routes/api/auth/magic-link/verify.mjs +3 -3
  110. package/dist/astro/routes/api/auth/me.d.mts.map +1 -1
  111. package/dist/astro/routes/api/auth/me.mjs +18 -11
  112. package/dist/astro/routes/api/auth/me.mjs.map +1 -1
  113. package/dist/astro/routes/api/auth/mode.mjs +1 -1
  114. package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +3 -3
  115. package/dist/astro/routes/api/auth/oauth/_provider_.mjs +2 -2
  116. package/dist/astro/routes/api/auth/passkey/_id_.mjs +5 -5
  117. package/dist/astro/routes/api/auth/passkey/index.mjs +2 -2
  118. package/dist/astro/routes/api/auth/passkey/options.mjs +10 -10
  119. package/dist/astro/routes/api/auth/passkey/register/options.mjs +8 -8
  120. package/dist/astro/routes/api/auth/passkey/register/verify.mjs +9 -9
  121. package/dist/astro/routes/api/auth/passkey/verify.mjs +9 -9
  122. package/dist/astro/routes/api/auth/signup/complete.mjs +9 -9
  123. package/dist/astro/routes/api/auth/signup/request.mjs +8 -8
  124. package/dist/astro/routes/api/auth/signup/verify.mjs +2 -2
  125. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +11 -11
  126. package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +3 -3
  127. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +3 -3
  128. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +3 -3
  129. package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +3 -3
  130. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +9 -9
  131. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +6 -6
  132. package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +3 -3
  133. package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +3 -3
  134. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +6 -6
  135. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.d.mts.map +1 -1
  136. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +18 -13
  137. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs.map +1 -1
  138. package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +3 -3
  139. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +3 -3
  140. package/dist/astro/routes/api/content/_collection_/_id_.d.mts.map +1 -1
  141. package/dist/astro/routes/api/content/_collection_/_id_.mjs +9 -7
  142. package/dist/astro/routes/api/content/_collection_/_id_.mjs.map +1 -1
  143. package/dist/astro/routes/api/content/_collection_/index.mjs +6 -6
  144. package/dist/astro/routes/api/content/_collection_/trash.mjs +6 -6
  145. package/dist/astro/routes/api/dashboard.mjs +7 -7
  146. package/dist/astro/routes/api/dev/emails.mjs +3 -3
  147. package/dist/astro/routes/api/import/probe.d.mts +3 -3
  148. package/dist/astro/routes/api/import/probe.mjs +10 -10
  149. package/dist/astro/routes/api/import/wordpress/analyze.mjs +4 -4
  150. package/dist/astro/routes/api/import/wordpress/execute.d.mts +9 -9
  151. package/dist/astro/routes/api/import/wordpress/execute.mjs +11 -10
  152. package/dist/astro/routes/api/import/wordpress/execute.mjs.map +1 -1
  153. package/dist/astro/routes/api/import/wordpress/media.mjs +8 -8
  154. package/dist/astro/routes/api/import/wordpress/prepare.mjs +9 -9
  155. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +8 -8
  156. package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
  157. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +10 -10
  158. package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +1 -1
  159. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +13 -11
  160. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs.map +1 -1
  161. package/dist/astro/routes/api/manifest.mjs +4 -4
  162. package/dist/astro/routes/api/mcp.mjs +34 -30
  163. package/dist/astro/routes/api/mcp.mjs.map +1 -1
  164. package/dist/astro/routes/api/media/_id_/confirm.mjs +6 -6
  165. package/dist/astro/routes/api/media/_id_.mjs +6 -6
  166. package/dist/astro/routes/api/media/file/_...key_.mjs +2 -2
  167. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +3 -3
  168. package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +3 -3
  169. package/dist/astro/routes/api/media/providers/index.mjs +3 -3
  170. package/dist/astro/routes/api/media/upload-url.mjs +8 -8
  171. package/dist/astro/routes/api/media.d.mts.map +1 -1
  172. package/dist/astro/routes/api/media.mjs +13 -12
  173. package/dist/astro/routes/api/media.mjs.map +1 -1
  174. package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +7 -7
  175. package/dist/astro/routes/api/menus/_name_/items.mjs +7 -7
  176. package/dist/astro/routes/api/menus/_name_/reorder.mjs +7 -7
  177. package/dist/astro/routes/api/menus/_name_/translations.mjs +7 -7
  178. package/dist/astro/routes/api/menus/_name_.mjs +7 -7
  179. package/dist/astro/routes/api/menus/index.mjs +7 -7
  180. package/dist/astro/routes/api/oauth/authorize.mjs +6 -6
  181. package/dist/astro/routes/api/oauth/device/authorize.mjs +6 -6
  182. package/dist/astro/routes/api/oauth/device/code.mjs +9 -9
  183. package/dist/astro/routes/api/oauth/device/token.mjs +8 -8
  184. package/dist/astro/routes/api/oauth/register.mjs +3 -3
  185. package/dist/astro/routes/api/oauth/token/refresh.mjs +6 -6
  186. package/dist/astro/routes/api/oauth/token/revoke.mjs +6 -6
  187. package/dist/astro/routes/api/oauth/token.mjs +6 -6
  188. package/dist/astro/routes/api/openapi.json.mjs +10 -7
  189. package/dist/astro/routes/api/openapi.json.mjs.map +1 -1
  190. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +4 -4
  191. package/dist/astro/routes/api/redirects/404s/index.mjs +8 -8
  192. package/dist/astro/routes/api/redirects/404s/summary.mjs +8 -8
  193. package/dist/astro/routes/api/redirects/_id_.mjs +9 -9
  194. package/dist/astro/routes/api/redirects/index.mjs +9 -9
  195. package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +3 -3
  196. package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +3 -3
  197. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +34 -33
  198. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs.map +1 -1
  199. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +34 -33
  200. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs.map +1 -1
  201. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +34 -33
  202. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs.map +1 -1
  203. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +34 -33
  204. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs.map +1 -1
  205. package/dist/astro/routes/api/schema/collections/index.mjs +34 -33
  206. package/dist/astro/routes/api/schema/collections/index.mjs.map +1 -1
  207. package/dist/astro/routes/api/schema/index.mjs +6 -6
  208. package/dist/astro/routes/api/schema/orphans/_slug_.mjs +34 -33
  209. package/dist/astro/routes/api/schema/orphans/_slug_.mjs.map +1 -1
  210. package/dist/astro/routes/api/schema/orphans/index.mjs +34 -33
  211. package/dist/astro/routes/api/schema/orphans/index.mjs.map +1 -1
  212. package/dist/astro/routes/api/search/enable.mjs +9 -9
  213. package/dist/astro/routes/api/search/index.mjs +8 -8
  214. package/dist/astro/routes/api/search/rebuild.mjs +9 -9
  215. package/dist/astro/routes/api/search/stats.mjs +6 -6
  216. package/dist/astro/routes/api/search/suggest.mjs +8 -8
  217. package/dist/astro/routes/api/sections/_slug_.mjs +8 -8
  218. package/dist/astro/routes/api/sections/index.mjs +8 -8
  219. package/dist/astro/routes/api/settings/email.mjs +4 -4
  220. package/dist/astro/routes/api/settings.mjs +11 -11
  221. package/dist/astro/routes/api/setup/admin-verify.mjs +10 -10
  222. package/dist/astro/routes/api/setup/admin.mjs +9 -9
  223. package/dist/astro/routes/api/setup/dev-bypass.mjs +24 -23
  224. package/dist/astro/routes/api/setup/dev-bypass.mjs.map +1 -1
  225. package/dist/astro/routes/api/setup/dev-reset.mjs +2 -2
  226. package/dist/astro/routes/api/setup/index.mjs +24 -23
  227. package/dist/astro/routes/api/setup/index.mjs.map +1 -1
  228. package/dist/astro/routes/api/setup/status.mjs +4 -4
  229. package/dist/astro/routes/api/snapshot.mjs +5 -5
  230. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +12 -12
  231. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +12 -12
  232. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +12 -12
  233. package/dist/astro/routes/api/taxonomies/index.mjs +12 -12
  234. package/dist/astro/routes/api/themes/preview.mjs +5 -5
  235. package/dist/astro/routes/api/typegen.mjs +5 -5
  236. package/dist/astro/routes/api/well-known/auth.mjs +1 -1
  237. package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +2 -2
  238. package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +2 -2
  239. package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +6 -6
  240. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +8 -8
  241. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +8 -8
  242. package/dist/astro/routes/api/widget-areas/_name_.mjs +5 -5
  243. package/dist/astro/routes/api/widget-areas/index.mjs +8 -8
  244. package/dist/astro/routes/api/widget-components.mjs +3 -3
  245. package/dist/astro/routes/robots.txt.mjs +6 -6
  246. package/dist/astro/routes/sitemap-_collection_.xml.mjs +8 -8
  247. package/dist/astro/routes/sitemap.xml.mjs +7 -7
  248. package/dist/astro/types.d.mts +13 -12
  249. package/dist/astro/types.d.mts.map +1 -1
  250. package/dist/auth/providers/github.d.mts +1 -1
  251. package/dist/auth/providers/google.d.mts +1 -1
  252. package/dist/{authorize-Bn4S4DUT.mjs → authorize-_wWM_44T.mjs} +2 -2
  253. package/dist/{authorize-Bn4S4DUT.mjs.map → authorize-_wWM_44T.mjs.map} +1 -1
  254. package/dist/byline-BrIVWLm-.mjs +925 -0
  255. package/dist/byline-BrIVWLm-.mjs.map +1 -0
  256. package/dist/{bylines-DWLnr6-k.d.mts → byline-fields-BNy7Ng1U.d.mts} +151 -23
  257. package/dist/byline-fields-BNy7Ng1U.d.mts.map +1 -0
  258. package/dist/byline-fields-DC3Wkk-U.mjs +123 -0
  259. package/dist/byline-fields-DC3Wkk-U.mjs.map +1 -0
  260. package/dist/byline-fields-Dr-xcb6S.mjs +238 -0
  261. package/dist/byline-fields-Dr-xcb6S.mjs.map +1 -0
  262. package/dist/byline-registry-CxK5g559.mjs +406 -0
  263. package/dist/byline-registry-CxK5g559.mjs.map +1 -0
  264. package/dist/{bylines-n6nykUyI.mjs → bylines-C_POWmGT.mjs} +25 -11
  265. package/dist/{bylines-n6nykUyI.mjs.map → bylines-C_POWmGT.mjs.map} +1 -1
  266. package/dist/bylines-sqExMElV.mjs +204 -0
  267. package/dist/bylines-sqExMElV.mjs.map +1 -0
  268. package/dist/{cache-BcI1yUjR.mjs → cache-wsDkA8ru.mjs} +2 -2
  269. package/dist/{cache-BcI1yUjR.mjs.map → cache-wsDkA8ru.mjs.map} +1 -1
  270. package/dist/{challenge-store-Dng1SxKT.mjs → challenge-store-DGwuCc4R.mjs} +1 -1
  271. package/dist/{challenge-store-Dng1SxKT.mjs.map → challenge-store-DGwuCc4R.mjs.map} +1 -1
  272. package/dist/{chunks-cYG4SnIP.mjs → chunks-BAYkM-CF.mjs} +2 -2
  273. package/dist/{chunks-cYG4SnIP.mjs.map → chunks-BAYkM-CF.mjs.map} +1 -1
  274. package/dist/cli/index.mjs +29 -23
  275. package/dist/cli/index.mjs.map +1 -1
  276. package/dist/client/cf-access.d.mts +1 -1
  277. package/dist/client/index.d.mts +2 -1
  278. package/dist/client/index.d.mts.map +1 -1
  279. package/dist/client/index.mjs +4 -2
  280. package/dist/client/index.mjs.map +1 -1
  281. package/dist/{comment-C76G-9tz.mjs → comment-Cd29aktf.mjs} +2 -2
  282. package/dist/{comment-C76G-9tz.mjs.map → comment-Cd29aktf.mjs.map} +1 -1
  283. package/dist/{comments-CCxFFGY1.mjs → comments-B7ufhkxN.mjs} +3 -3
  284. package/dist/{comments-CCxFFGY1.mjs.map → comments-B7ufhkxN.mjs.map} +1 -1
  285. package/dist/{components-Dx3DM0gg.mjs → components-CTfpu3PZ.mjs} +1 -1
  286. package/dist/{components-Dx3DM0gg.mjs.map → components-CTfpu3PZ.mjs.map} +1 -1
  287. package/dist/{content-8voQNTXX.mjs → content-BbqKo3Kc.mjs} +22 -3
  288. package/dist/content-BbqKo3Kc.mjs.map +1 -0
  289. package/dist/{context-B7qiYrz2.mjs → context-BsF1rhoI.mjs} +9 -9
  290. package/dist/{context-B7qiYrz2.mjs.map → context-BsF1rhoI.mjs.map} +1 -1
  291. package/dist/{cron-Bd3b3iuj.mjs → cron-DZovZUnC.mjs} +1 -1
  292. package/dist/{cron-Bd3b3iuj.mjs.map → cron-DZovZUnC.mjs.map} +1 -1
  293. package/dist/{dashboard-BeaFSPpx.mjs → dashboard-BwIX9r-X.mjs} +4 -4
  294. package/dist/{dashboard-BeaFSPpx.mjs.map → dashboard-BwIX9r-X.mjs.map} +1 -1
  295. package/dist/db/index.d.mts +3 -3
  296. package/dist/db/index.mjs +1 -1
  297. package/dist/db/libsql.d.mts +1 -1
  298. package/dist/db/postgres.d.mts +1 -1
  299. package/dist/db/sqlite.d.mts +1 -1
  300. package/dist/{db-errors-BiYqoX-n.mjs → db-errors-CtzxKBxe.mjs} +1 -1
  301. package/dist/{db-errors-BiYqoX-n.mjs.map → db-errors-CtzxKBxe.mjs.map} +1 -1
  302. package/dist/{default-BvTAYCzx.mjs → default-xLFNSsZ9.mjs} +1 -1
  303. package/dist/{default-BvTAYCzx.mjs.map → default-xLFNSsZ9.mjs.map} +1 -1
  304. package/dist/{device-flow-B9oG8PwP.mjs → device-flow-ptLrVINd.mjs} +4 -4
  305. package/dist/{device-flow-B9oG8PwP.mjs.map → device-flow-ptLrVINd.mjs.map} +1 -1
  306. package/dist/{email-console-CubRll9q.mjs → email-console-DHT2Fbpj.mjs} +1 -1
  307. package/dist/{email-console-CubRll9q.mjs.map → email-console-DHT2Fbpj.mjs.map} +1 -1
  308. package/dist/{error-ChfADBuu.mjs → error-npZWBSb7.mjs} +7 -3
  309. package/dist/error-npZWBSb7.mjs.map +1 -0
  310. package/dist/{escape-Cg6kMELH.mjs → escape-bIyGoW5W.mjs} +1 -1
  311. package/dist/{escape-Cg6kMELH.mjs.map → escape-bIyGoW5W.mjs.map} +1 -1
  312. package/dist/{fts-manager-C_b-4x8u.mjs → fts-manager-DmUAk-kQ.mjs} +2 -2
  313. package/dist/{fts-manager-C_b-4x8u.mjs.map → fts-manager-DmUAk-kQ.mjs.map} +1 -1
  314. package/dist/{hash-DlUxGhQS.mjs → hash-9w3pd3-m.mjs} +1 -1
  315. package/dist/{hash-DlUxGhQS.mjs.map → hash-9w3pd3-m.mjs.map} +1 -1
  316. package/dist/{import-DG80rC_I.mjs → import-Dh8bWmyq.mjs} +3 -3
  317. package/dist/{import-DG80rC_I.mjs.map → import-Dh8bWmyq.mjs.map} +1 -1
  318. package/dist/{index-D_p_jIP1.d.mts → index-CjKdMZ3U.d.mts} +38 -16
  319. package/dist/index-CjKdMZ3U.d.mts.map +1 -0
  320. package/dist/{index-CC42STEm.d.mts → index-D60_SzHG.d.mts} +3 -3
  321. package/dist/{index-CC42STEm.d.mts.map → index-D60_SzHG.d.mts.map} +1 -1
  322. package/dist/index.d.mts +17 -17
  323. package/dist/index.mjs +55 -54
  324. package/dist/{load-CLFRjk9r.mjs → load-DsoLq7ex.mjs} +2 -2
  325. package/dist/{load-CLFRjk9r.mjs.map → load-DsoLq7ex.mjs.map} +1 -1
  326. package/dist/{loader-D-vIJjfY.mjs → loader-CJ6lWO0d.mjs} +75 -19
  327. package/dist/loader-CJ6lWO0d.mjs.map +1 -0
  328. package/dist/{manifest-schema-Czqf0TLu.mjs → manifest-schema-Cj-YrzrF.mjs} +1 -1
  329. package/dist/{manifest-schema-Czqf0TLu.mjs.map → manifest-schema-Cj-YrzrF.mjs.map} +1 -1
  330. package/dist/media/index.d.mts +1 -1
  331. package/dist/media/index.mjs +2 -2
  332. package/dist/media/local-runtime.d.mts +11 -11
  333. package/dist/media/local-runtime.mjs +5 -5
  334. package/dist/{media-allowlist-BNloC69x.mjs → media-allowlist-CMcoYIjQ.mjs} +2 -2
  335. package/dist/{media-allowlist-BNloC69x.mjs.map → media-allowlist-CMcoYIjQ.mjs.map} +1 -1
  336. package/dist/{media-CKQd8AYU.mjs → media-jk_HzzOl.mjs} +7 -2
  337. package/dist/media-jk_HzzOl.mjs.map +1 -0
  338. package/dist/{menus-arUNspyU.mjs → menus-B-5-3aon.mjs} +2 -2
  339. package/dist/{menus-arUNspyU.mjs.map → menus-B-5-3aon.mjs.map} +1 -1
  340. package/dist/{menus-C-nWT5Tu.mjs → menus-CyMO6GBx.mjs} +27 -11
  341. package/dist/menus-CyMO6GBx.mjs.map +1 -0
  342. package/dist/{mime-KV5TqkMN.mjs → mime-CCEzze7W.mjs} +1 -1
  343. package/dist/{mime-KV5TqkMN.mjs.map → mime-CCEzze7W.mjs.map} +1 -1
  344. package/dist/{mode-CaaiebZI.mjs → mode-BjlXswIw.mjs} +1 -1
  345. package/dist/{mode-CaaiebZI.mjs.map → mode-BjlXswIw.mjs.map} +1 -1
  346. package/dist/{normalize-CN5kRSMC.mjs → normalize-DVV8nbrL.mjs} +1 -1
  347. package/dist/{normalize-CN5kRSMC.mjs.map → normalize-DVV8nbrL.mjs.map} +1 -1
  348. package/dist/{oauth-authorization-CTMeVfvj.mjs → oauth-authorization-DvBAL75d.mjs} +4 -4
  349. package/dist/{oauth-authorization-CTMeVfvj.mjs.map → oauth-authorization-DvBAL75d.mjs.map} +1 -1
  350. package/dist/{oauth-clients-eJCbkVSG.mjs → oauth-clients-8mPDStMv.mjs} +1 -1
  351. package/dist/{oauth-clients-eJCbkVSG.mjs.map → oauth-clients-8mPDStMv.mjs.map} +1 -1
  352. package/dist/{oauth-state-store-vOSdOeGe.mjs → oauth-state-store-BJ7YtrfD.mjs} +1 -1
  353. package/dist/{oauth-state-store-vOSdOeGe.mjs.map → oauth-state-store-BJ7YtrfD.mjs.map} +1 -1
  354. package/dist/{oauth-user-lookup-3JwsVw6N.mjs → oauth-user-lookup-BdDSDvjF.mjs} +1 -1
  355. package/dist/{oauth-user-lookup-3JwsVw6N.mjs.map → oauth-user-lookup-BdDSDvjF.mjs.map} +1 -1
  356. package/dist/{options-DhV-gwJb.d.mts → options-tb7DJROi.d.mts} +3 -3
  357. package/dist/{options-DhV-gwJb.d.mts.map → options-tb7DJROi.d.mts.map} +1 -1
  358. package/dist/page/index.d.mts +2 -2
  359. package/dist/{parse-DHbXfvxO.mjs → parse-4zO5Y2DL.mjs} +2 -2
  360. package/dist/{parse-DHbXfvxO.mjs.map → parse-4zO5Y2DL.mjs.map} +1 -1
  361. package/dist/{passkey-config-BloQOT3y.mjs → passkey-config-BDVM86Tj.mjs} +1 -1
  362. package/dist/{passkey-config-BloQOT3y.mjs.map → passkey-config-BDVM86Tj.mjs.map} +1 -1
  363. package/dist/{placeholder-KCkkCtgQ.d.mts → placeholder-B9lUUEmj.d.mts} +1 -1
  364. package/dist/{placeholder-KCkkCtgQ.d.mts.map → placeholder-B9lUUEmj.d.mts.map} +1 -1
  365. package/dist/{placeholder-LqmHqvBw.mjs → placeholder-BZxr8W1j.mjs} +1 -1
  366. package/dist/{placeholder-LqmHqvBw.mjs.map → placeholder-BZxr8W1j.mjs.map} +1 -1
  367. package/dist/plugin-types.d.mts +1 -1
  368. package/dist/plugin-utils.d.mts +9 -9
  369. package/dist/plugins/adapt-sandbox-entry.d.mts +9 -9
  370. package/dist/plugins/adapt-sandbox-entry.mjs +2 -2
  371. package/dist/{preview-D4z0WONU.mjs → preview-BfuRkVKW.mjs} +2 -2
  372. package/dist/{preview-D4z0WONU.mjs.map → preview-BfuRkVKW.mjs.map} +1 -1
  373. package/dist/{public-url-CUWWFME2.mjs → public-url-egRHCy1m.mjs} +1 -1
  374. package/dist/{public-url-CUWWFME2.mjs.map → public-url-egRHCy1m.mjs.map} +1 -1
  375. package/dist/{query-7m6-l0f_.mjs → query-CuvjwhrE.mjs} +12 -12
  376. package/dist/{query-7m6-l0f_.mjs.map → query-CuvjwhrE.mjs.map} +1 -1
  377. package/dist/{rate-limit-D8RAXN8b.mjs → rate-limit-D6VQqBk_.mjs} +2 -2
  378. package/dist/{rate-limit-D8RAXN8b.mjs.map → rate-limit-D6VQqBk_.mjs.map} +1 -1
  379. package/dist/{redirect-CjfDGrTd.mjs → redirect-BZUJltlj.mjs} +2 -2
  380. package/dist/{redirect-CjfDGrTd.mjs.map → redirect-BZUJltlj.mjs.map} +1 -1
  381. package/dist/{redirect-BINiRYq4.mjs → redirect-Cw3JTlmj.mjs} +1 -1
  382. package/dist/{redirect-BINiRYq4.mjs.map → redirect-Cw3JTlmj.mjs.map} +1 -1
  383. package/dist/{redirects-COMLwsV5.mjs → redirects-C0L9JUk4.mjs} +19 -6
  384. package/dist/redirects-C0L9JUk4.mjs.map +1 -0
  385. package/dist/{redirects-CowoEHdE.mjs → redirects-DnYuqsEf.mjs} +3 -3
  386. package/dist/{redirects-CowoEHdE.mjs.map → redirects-DnYuqsEf.mjs.map} +1 -1
  387. package/dist/{registry-Cyp-dx6J.mjs → registry-Dn6gsx3L.mjs} +13 -5
  388. package/dist/{registry-Cyp-dx6J.mjs.map → registry-Dn6gsx3L.mjs.map} +1 -1
  389. package/dist/{request-cache-dzCt8TZB.mjs → request-cache-BYMs-BGX.mjs} +23 -2
  390. package/dist/{request-cache-dzCt8TZB.mjs.map → request-cache-BYMs-BGX.mjs.map} +1 -1
  391. package/dist/{request-meta-C_Cjii-T.mjs → request-meta-7ByVLxB-.mjs} +2 -2
  392. package/dist/{request-meta-C_Cjii-T.mjs.map → request-meta-7ByVLxB-.mjs.map} +1 -1
  393. package/dist/{resolve-D6sM-SgF.mjs → resolve-BqYMVG0D.mjs} +1 -1
  394. package/dist/{resolve-D6sM-SgF.mjs.map → resolve-BqYMVG0D.mjs.map} +1 -1
  395. package/dist/{runner-DSQBurMS.d.mts → runner-DM1yR5qd.d.mts} +2 -2
  396. package/dist/{runner-DSQBurMS.d.mts.map → runner-DM1yR5qd.d.mts.map} +1 -1
  397. package/dist/{runner-Drnvs96u.mjs → runner-eAgyIkeg.mjs} +284 -158
  398. package/dist/runner-eAgyIkeg.mjs.map +1 -0
  399. package/dist/runtime.d.mts +10 -10
  400. package/dist/runtime.mjs +2 -2
  401. package/dist/{schema-CI9mYPX3.mjs → schema--mYZX4D7.mjs} +5 -5
  402. package/dist/{schema-CI9mYPX3.mjs.map → schema--mYZX4D7.mjs.map} +1 -1
  403. package/dist/{search-DKz_mGBP.mjs → search-C6U_NvZI.mjs} +4 -4
  404. package/dist/{search-DKz_mGBP.mjs.map → search-C6U_NvZI.mjs.map} +1 -1
  405. package/dist/{secrets-rPdhEBkD.mjs → secrets-YYbTgB1w.mjs} +1 -1
  406. package/dist/{secrets-rPdhEBkD.mjs.map → secrets-YYbTgB1w.mjs.map} +1 -1
  407. package/dist/{sections-DBbCDIAT.mjs → sections-Ba-rJLKb.mjs} +3 -3
  408. package/dist/{sections-DBbCDIAT.mjs.map → sections-Ba-rJLKb.mjs.map} +1 -1
  409. package/dist/seed/index.d.mts +2 -2
  410. package/dist/seed/index.mjs +18 -17
  411. package/dist/seo/index.d.mts +1 -1
  412. package/dist/{seo-BGCyDlkb.mjs → seo-BTzb5ksq.mjs} +2 -2
  413. package/dist/{seo-BGCyDlkb.mjs.map → seo-BTzb5ksq.mjs.map} +1 -1
  414. package/dist/{seo-Dq707mNQ.mjs → seo-DfjLvu8i.mjs} +1 -1
  415. package/dist/{seo-Dq707mNQ.mjs.map → seo-DfjLvu8i.mjs.map} +1 -1
  416. package/dist/{service-B0H7U1Y9.mjs → service-Cn-kIfZn.mjs} +3 -3
  417. package/dist/{service-B0H7U1Y9.mjs.map → service-Cn-kIfZn.mjs.map} +1 -1
  418. package/dist/{settings-DfwNyQkf.mjs → settings-C65OSm41.mjs} +3 -3
  419. package/dist/{settings-DfwNyQkf.mjs.map → settings-C65OSm41.mjs.map} +1 -1
  420. package/dist/{settings-BSXRtTzk.mjs → settings-ChlQbwU0.mjs} +4 -4
  421. package/dist/{settings-BSXRtTzk.mjs.map → settings-ChlQbwU0.mjs.map} +1 -1
  422. package/dist/{setup-complete-MzzN9u0b.mjs → setup-complete-VoEZfasi.mjs} +1 -1
  423. package/dist/{setup-complete-MzzN9u0b.mjs.map → setup-complete-VoEZfasi.mjs.map} +1 -1
  424. package/dist/{setup-nonce-DXuriHsg.mjs → setup-nonce-Bm0uKqmf.mjs} +1 -1
  425. package/dist/{setup-nonce-DXuriHsg.mjs.map → setup-nonce-Bm0uKqmf.mjs.map} +1 -1
  426. package/dist/{site-url-xkhw1tcz.mjs → site-url-Cm8-sJy7.mjs} +1 -1
  427. package/dist/{site-url-xkhw1tcz.mjs.map → site-url-Cm8-sJy7.mjs.map} +1 -1
  428. package/dist/{ssrf-MZ-zrG6-.mjs → ssrf-BsVGIE0Z.mjs} +1 -1
  429. package/dist/{ssrf-MZ-zrG6-.mjs.map → ssrf-BsVGIE0Z.mjs.map} +1 -1
  430. package/dist/storage/local.d.mts +1 -1
  431. package/dist/storage/local.mjs +1 -1
  432. package/dist/storage/s3.d.mts +1 -1
  433. package/dist/storage/s3.mjs +1 -1
  434. package/dist/{taxonomies-CcvrMLbR.mjs → taxonomies-CgpzAU6F.mjs} +8 -8
  435. package/dist/{taxonomies-CcvrMLbR.mjs.map → taxonomies-CgpzAU6F.mjs.map} +1 -1
  436. package/dist/{taxonomies-4vx0nmMr.mjs → taxonomies-D72gTOg_.mjs} +4 -4
  437. package/dist/{taxonomies-4vx0nmMr.mjs.map → taxonomies-D72gTOg_.mjs.map} +1 -1
  438. package/dist/{taxonomy-zqGQUqgu.mjs → taxonomy-BBK-UAEo.mjs} +3 -3
  439. package/dist/{taxonomy-zqGQUqgu.mjs.map → taxonomy-BBK-UAEo.mjs.map} +1 -1
  440. package/dist/{tokens-N8otWMmj.mjs → tokens-Bx2afeT-.mjs} +1 -1
  441. package/dist/{tokens-N8otWMmj.mjs.map → tokens-Bx2afeT-.mjs.map} +1 -1
  442. package/dist/{transport-B6CHddbu.mjs → transport--Ck3RBin.mjs} +1 -1
  443. package/dist/{transport-B6CHddbu.mjs.map → transport--Ck3RBin.mjs.map} +1 -1
  444. package/dist/{transport-C2MGqtL6.d.mts → transport-OnMNbsIA.d.mts} +1 -1
  445. package/dist/{transport-C2MGqtL6.d.mts.map → transport-OnMNbsIA.d.mts.map} +1 -1
  446. package/dist/{trusted-proxy-97pajC2f.mjs → trusted-proxy-B4AfnoAp.mjs} +1 -1
  447. package/dist/{trusted-proxy-97pajC2f.mjs.map → trusted-proxy-B4AfnoAp.mjs.map} +1 -1
  448. package/dist/types-D8bhH891.mjs +125 -0
  449. package/dist/{types-DSZl1Dsv.mjs.map → types-D8bhH891.mjs.map} +1 -1
  450. package/dist/{types-DGHWRQgr.d.mts → types-DMwSpvcw.d.mts} +2 -2
  451. package/dist/{types-DGHWRQgr.d.mts.map → types-DMwSpvcw.d.mts.map} +1 -1
  452. package/dist/{types-bYmRn_Uy.d.mts → types-DWnN7weG.d.mts} +1 -1
  453. package/dist/{types-bYmRn_Uy.d.mts.map → types-DWnN7weG.d.mts.map} +1 -1
  454. package/dist/{types-Dgo6y-Ut.d.mts → types-DX6v9KzJ.d.mts} +1 -1
  455. package/dist/{types-Dgo6y-Ut.d.mts.map → types-DX6v9KzJ.d.mts.map} +1 -1
  456. package/dist/{types-DaqNzqVt.d.mts → types-DawhLFwy.d.mts} +35 -1
  457. package/dist/{types-DaqNzqVt.d.mts.map → types-DawhLFwy.d.mts.map} +1 -1
  458. package/dist/{types-CpUuGcd5.d.mts → types-DbCWhHet.d.mts} +8 -2
  459. package/dist/{types-CpUuGcd5.d.mts.map → types-DbCWhHet.d.mts.map} +1 -1
  460. package/dist/{types-Cd9UCu3t.mjs → types-DpFmlNyB.mjs} +1 -1
  461. package/dist/{types-Cd9UCu3t.mjs.map → types-DpFmlNyB.mjs.map} +1 -1
  462. package/dist/{types-D599-ruj.d.mts → types-Qa7-HJJC.d.mts} +1 -1
  463. package/dist/{types-D599-ruj.d.mts.map → types-Qa7-HJJC.d.mts.map} +1 -1
  464. package/dist/{types-B0bmgwMG.mjs → types-SF1DwGf2.mjs} +2 -2
  465. package/dist/types-SF1DwGf2.mjs.map +1 -0
  466. package/dist/{types-DaYDYW6g.d.mts → types-i8_uzhMD.d.mts} +40 -2
  467. package/dist/types-i8_uzhMD.d.mts.map +1 -0
  468. package/dist/{types-CkDSF81F.d.mts → types-kwqCOUxj.d.mts} +1 -1
  469. package/dist/{types-CkDSF81F.d.mts.map → types-kwqCOUxj.d.mts.map} +1 -1
  470. package/dist/{user-hUSOaIJy.mjs → user-X4rtyO4Y.mjs} +2 -2
  471. package/dist/{user-hUSOaIJy.mjs.map → user-X4rtyO4Y.mjs.map} +1 -1
  472. package/dist/{utils-C3wTAP-P.mjs → utils-C4Ih4DML.mjs} +1 -1
  473. package/dist/{utils-C3wTAP-P.mjs.map → utils-C4Ih4DML.mjs.map} +1 -1
  474. package/dist/{validate-IGltez8n.mjs → validate-DactmcJG.mjs} +23 -3
  475. package/dist/validate-DactmcJG.mjs.map +1 -0
  476. package/dist/{validate-DQtHw9NT.d.mts → validate-Dy6nkNls.d.mts} +25 -5
  477. package/dist/{validate-DQtHw9NT.d.mts.map → validate-Dy6nkNls.d.mts.map} +1 -1
  478. package/dist/{validation-Bmymau7y.mjs → validation-BYA4i85b.mjs} +6 -6
  479. package/dist/{validation-Bmymau7y.mjs.map → validation-BYA4i85b.mjs.map} +1 -1
  480. package/dist/version-FGcv0ooe.mjs +7 -0
  481. package/dist/{version-ITD3PlQd.mjs.map → version-FGcv0ooe.mjs.map} +1 -1
  482. package/dist/{widgets-yHQa4c6c.mjs → widgets-DG-1jxnz.mjs} +3 -3
  483. package/dist/{widgets-yHQa4c6c.mjs.map → widgets-DG-1jxnz.mjs.map} +1 -1
  484. package/dist/{zod-generator-B80aap1J.mjs → zod-generator-BNAObjSt.mjs} +3 -3
  485. package/dist/{zod-generator-B80aap1J.mjs.map → zod-generator-BNAObjSt.mjs.map} +1 -1
  486. package/package.json +7 -7
  487. package/src/api/errors.ts +7 -0
  488. package/src/api/handlers/byline-fields.ts +212 -0
  489. package/src/api/handlers/bylines.ts +126 -5
  490. package/src/api/handlers/content.ts +43 -2
  491. package/src/api/handlers/media.ts +2 -0
  492. package/src/api/openapi/document.ts +3 -0
  493. package/src/api/schemas/byline-fields.ts +188 -0
  494. package/src/api/schemas/bylines.ts +42 -0
  495. package/src/api/schemas/content.ts +2 -0
  496. package/src/api/schemas/index.ts +1 -0
  497. package/src/api/schemas/media.ts +2 -0
  498. package/src/astro/integration/routes.ts +27 -0
  499. package/src/astro/middleware/redirect.ts +5 -1
  500. package/src/astro/routes/api/admin/byline-fields/[slug]/usage.ts +36 -0
  501. package/src/astro/routes/api/admin/byline-fields/[slug].ts +92 -0
  502. package/src/astro/routes/api/admin/byline-fields/index.ts +66 -0
  503. package/src/astro/routes/api/admin/byline-fields/reorder.ts +39 -0
  504. package/src/astro/routes/api/admin/bylines/[id]/index.ts +23 -21
  505. package/src/astro/routes/api/admin/bylines/index.ts +1 -0
  506. package/src/astro/routes/api/auth/me.ts +21 -10
  507. package/src/astro/routes/api/content/[collection]/[id]/terms/[taxonomy].ts +15 -3
  508. package/src/astro/routes/api/content/[collection]/[id].ts +3 -1
  509. package/src/astro/routes/api/media.ts +1 -0
  510. package/src/astro/types.ts +1 -0
  511. package/src/bylines/field-defs-cache.ts +138 -0
  512. package/src/bylines/index.ts +37 -4
  513. package/src/cli/commands/content.ts +4 -2
  514. package/src/client/index.ts +4 -1
  515. package/src/components/InlinePortableTextEditor.tsx +69 -0
  516. package/src/content/converters/portable-text-to-prosemirror.ts +7 -0
  517. package/src/content/converters/prosemirror-to-portable-text.ts +16 -0
  518. package/src/content/converters/types.ts +10 -0
  519. package/src/database/migrations/041_content_locale_list_index.ts +47 -0
  520. package/src/database/migrations/042_byline_fields.ts +157 -0
  521. package/src/database/migrations/runner.ts +4 -0
  522. package/src/database/repositories/byline.ts +758 -50
  523. package/src/database/repositories/content.ts +43 -3
  524. package/src/database/repositories/media.ts +14 -0
  525. package/src/database/repositories/types.ts +38 -0
  526. package/src/database/types.ts +44 -0
  527. package/src/emdash-runtime.ts +4 -1
  528. package/src/index.ts +1 -0
  529. package/src/loader.ts +98 -10
  530. package/src/mcp/server.ts +10 -1
  531. package/src/request-cache.ts +23 -0
  532. package/src/schema/byline-registry.ts +671 -0
  533. package/src/schema/registry.ts +14 -0
  534. package/src/schema/types.ts +133 -0
  535. package/src/seed/apply.ts +101 -14
  536. package/src/seed/types.ts +21 -0
  537. package/src/seed/validate.ts +39 -0
  538. package/dist/api-BNKqxyFX.mjs.map +0 -1
  539. package/dist/apply-BOPaD-s9.mjs.map +0 -1
  540. package/dist/byline-BDylH_m4.mjs +0 -404
  541. package/dist/byline-BDylH_m4.mjs.map +0 -1
  542. package/dist/bylines-B7TFEvFf.mjs +0 -118
  543. package/dist/bylines-B7TFEvFf.mjs.map +0 -1
  544. package/dist/bylines-DWLnr6-k.d.mts.map +0 -1
  545. package/dist/content-8voQNTXX.mjs.map +0 -1
  546. package/dist/error-ChfADBuu.mjs.map +0 -1
  547. package/dist/index-D_p_jIP1.d.mts.map +0 -1
  548. package/dist/loader-D-vIJjfY.mjs.map +0 -1
  549. package/dist/media-CKQd8AYU.mjs.map +0 -1
  550. package/dist/menus-C-nWT5Tu.mjs.map +0 -1
  551. package/dist/redirects-COMLwsV5.mjs.map +0 -1
  552. package/dist/runner-Drnvs96u.mjs.map +0 -1
  553. package/dist/setup-Cf_TyOv5.mjs +0 -137
  554. package/dist/setup-Cf_TyOv5.mjs.map +0 -1
  555. package/dist/types-B0bmgwMG.mjs.map +0 -1
  556. package/dist/types-DSZl1Dsv.mjs +0 -83
  557. package/dist/types-DaYDYW6g.d.mts.map +0 -1
  558. package/dist/validate-IGltez8n.mjs.map +0 -1
  559. package/dist/version-ITD3PlQd.mjs +0 -7
  560. /package/dist/{api-tokens-iPIHAY8N.mjs → api-tokens-B6VgoE6M.mjs} +0 -0
  561. /package/dist/{ssrf-BIcd-aXW.mjs → ssrf-BvgVcfNQ.mjs} +0 -0
  562. /package/dist/{types-1NNkmTIn.mjs → types-Cj2S6FuC.mjs} +0 -0
@@ -1,14 +1,14 @@
1
1
  import "../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../types-B0bmgwMG.mjs";
2
+ import "../../../../../types-SF1DwGf2.mjs";
3
3
  import { t as OptionsRepository } from "../../../../../options-BL4X94qY.mjs";
4
- import { n as apiSuccess, t as apiError } from "../../../../../error-ChfADBuu.mjs";
5
- import { n as parseBody, t as isParseError } from "../../../../../parse-DHbXfvxO.mjs";
6
- import "../../../../../redirects-COMLwsV5.mjs";
7
- import { C as signupRequestBody } from "../../../../../setup-Cf_TyOv5.mjs";
4
+ import { n as apiSuccess, t as apiError } from "../../../../../error-npZWBSb7.mjs";
5
+ import { n as parseBody, t as isParseError } from "../../../../../parse-4zO5Y2DL.mjs";
6
+ import "../../../../../redirects-C0L9JUk4.mjs";
7
+ import { k as signupRequestBody } from "../../../../../byline-fields-Dr-xcb6S.mjs";
8
8
  import "../../../../../api/schemas/index.mjs";
9
- import { t as getTrustedProxyHeaders } from "../../../../../trusted-proxy-97pajC2f.mjs";
10
- import { t as getSiteBaseUrl } from "../../../../../site-url-xkhw1tcz.mjs";
11
- import { n as getClientIp, t as checkRateLimit } from "../../../../../rate-limit-D8RAXN8b.mjs";
9
+ import { t as getTrustedProxyHeaders } from "../../../../../trusted-proxy-B4AfnoAp.mjs";
10
+ import { t as getSiteBaseUrl } from "../../../../../site-url-Cm8-sJy7.mjs";
11
+ import { n as getClientIp, t as checkRateLimit } from "../../../../../rate-limit-D6VQqBk_.mjs";
12
12
  import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
13
13
  import { requestSignup } from "@emdash-cms/auth";
14
14
 
@@ -1,6 +1,6 @@
1
1
  import "../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../types-B0bmgwMG.mjs";
3
- import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-ChfADBuu.mjs";
2
+ import "../../../../../types-SF1DwGf2.mjs";
3
+ import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-npZWBSb7.mjs";
4
4
  import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
5
5
  import { SignupError, roleFromLevel, validateSignupToken } from "@emdash-cms/auth";
6
6
 
@@ -1,18 +1,18 @@
1
1
  import { t as validateIdentifier } from "../../../../../../validate-VPnKoIzW.mjs";
2
2
  import "../../../../../../base64-CqR-7kqF.mjs";
3
- import "../../../../../../types-B0bmgwMG.mjs";
4
- import { t as CommentRepository } from "../../../../../../comment-C76G-9tz.mjs";
3
+ import "../../../../../../types-SF1DwGf2.mjs";
4
+ import { t as CommentRepository } from "../../../../../../comment-Cd29aktf.mjs";
5
5
  import "../../../../../../options-BL4X94qY.mjs";
6
- import { a as unwrapResult, i as requireDb, n as apiSuccess, r as handleError, t as apiError } from "../../../../../../error-ChfADBuu.mjs";
7
- import { n as parseBody, t as isParseError } from "../../../../../../parse-DHbXfvxO.mjs";
8
- import { yt as createCommentBody } from "../../../../../../redirects-COMLwsV5.mjs";
9
- import "../../../../../../setup-Cf_TyOv5.mjs";
6
+ import { a as unwrapResult, i as requireDb, n as apiSuccess, r as handleError, t as apiError } from "../../../../../../error-npZWBSb7.mjs";
7
+ import { n as parseBody, t as isParseError } from "../../../../../../parse-4zO5Y2DL.mjs";
8
+ import { yt as createCommentBody } from "../../../../../../redirects-C0L9JUk4.mjs";
9
+ import "../../../../../../byline-fields-Dr-xcb6S.mjs";
10
10
  import "../../../../../../api/schemas/index.mjs";
11
- import { t as extractRequestMeta } from "../../../../../../request-meta-C_Cjii-T.mjs";
12
- import { i as resolveSecretsCached } from "../../../../../../secrets-rPdhEBkD.mjs";
13
- import { c as hashIp, s as handleCommentList, t as checkRateLimit } from "../../../../../../comments-CCxFFGY1.mjs";
14
- import { t as getSiteBaseUrl } from "../../../../../../site-url-xkhw1tcz.mjs";
15
- import { i as sendCommentNotification, t as createComment } from "../../../../../../service-B0H7U1Y9.mjs";
11
+ import { t as extractRequestMeta } from "../../../../../../request-meta-7ByVLxB-.mjs";
12
+ import { i as resolveSecretsCached } from "../../../../../../secrets-YYbTgB1w.mjs";
13
+ import { c as hashIp, s as handleCommentList, t as checkRateLimit } from "../../../../../../comments-B7ufhkxN.mjs";
14
+ import { t as getSiteBaseUrl } from "../../../../../../site-url-Cm8-sJy7.mjs";
15
+ import { i as sendCommentNotification, t as createComment } from "../../../../../../service-Cn-kIfZn.mjs";
16
16
 
17
17
  //#region src/astro/routes/api/comments/[collection]/[contentId]/index.ts
18
18
  const prerender = false;
@@ -1,7 +1,7 @@
1
1
  import "../../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../../types-B0bmgwMG.mjs";
3
- import { a as unwrapResult, t as apiError } from "../../../../../../error-ChfADBuu.mjs";
4
- import { n as requirePerm } from "../../../../../../authorize-Bn4S4DUT.mjs";
2
+ import "../../../../../../types-SF1DwGf2.mjs";
3
+ import { a as unwrapResult, t as apiError } from "../../../../../../error-npZWBSb7.mjs";
4
+ import { n as requirePerm } from "../../../../../../authorize-_wWM_44T.mjs";
5
5
 
6
6
  //#region src/astro/routes/api/content/[collection]/[id]/compare.ts
7
7
  const prerender = false;
@@ -1,7 +1,7 @@
1
1
  import "../../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../../types-B0bmgwMG.mjs";
3
- import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-ChfADBuu.mjs";
4
- import { t as requireOwnerPerm } from "../../../../../../authorize-Bn4S4DUT.mjs";
2
+ import "../../../../../../types-SF1DwGf2.mjs";
3
+ import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-npZWBSb7.mjs";
4
+ import { t as requireOwnerPerm } from "../../../../../../authorize-_wWM_44T.mjs";
5
5
 
6
6
  //#region src/astro/routes/api/content/[collection]/[id]/discard-draft.ts
7
7
  const prerender = false;
@@ -1,7 +1,7 @@
1
1
  import "../../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../../types-B0bmgwMG.mjs";
3
- import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-ChfADBuu.mjs";
4
- import { n as requirePerm, t as requireOwnerPerm } from "../../../../../../authorize-Bn4S4DUT.mjs";
2
+ import "../../../../../../types-SF1DwGf2.mjs";
3
+ import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-npZWBSb7.mjs";
4
+ import { n as requirePerm, t as requireOwnerPerm } from "../../../../../../authorize-_wWM_44T.mjs";
5
5
 
6
6
  //#region src/astro/routes/api/content/[collection]/[id]/duplicate.ts
7
7
  const prerender = false;
@@ -1,7 +1,7 @@
1
1
  import "../../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../../types-B0bmgwMG.mjs";
3
- import { a as unwrapResult, t as apiError } from "../../../../../../error-ChfADBuu.mjs";
4
- import { n as requirePerm } from "../../../../../../authorize-Bn4S4DUT.mjs";
2
+ import "../../../../../../types-SF1DwGf2.mjs";
3
+ import { a as unwrapResult, t as apiError } from "../../../../../../error-npZWBSb7.mjs";
4
+ import { n as requirePerm } from "../../../../../../authorize-_wWM_44T.mjs";
5
5
 
6
6
  //#region src/astro/routes/api/content/[collection]/[id]/permanent.ts
7
7
  const prerender = false;
@@ -1,16 +1,16 @@
1
1
  import { n as getI18nConfig } from "../../../../../../config-CVssduLe.mjs";
2
2
  import "../../../../../../base64-CqR-7kqF.mjs";
3
- import "../../../../../../types-B0bmgwMG.mjs";
3
+ import "../../../../../../types-SF1DwGf2.mjs";
4
4
  import "../../../../../../options-BL4X94qY.mjs";
5
- import { a as unwrapResult, n as apiSuccess, r as handleError, t as apiError } from "../../../../../../error-ChfADBuu.mjs";
6
- import { r as parseOptionalBody, t as isParseError } from "../../../../../../parse-DHbXfvxO.mjs";
7
- import { rn as contentPreviewUrlBody } from "../../../../../../redirects-COMLwsV5.mjs";
8
- import "../../../../../../setup-Cf_TyOv5.mjs";
5
+ import { a as unwrapResult, n as apiSuccess, r as handleError, t as apiError } from "../../../../../../error-npZWBSb7.mjs";
6
+ import { r as parseOptionalBody, t as isParseError } from "../../../../../../parse-4zO5Y2DL.mjs";
7
+ import { rn as contentPreviewUrlBody } from "../../../../../../redirects-C0L9JUk4.mjs";
8
+ import "../../../../../../byline-fields-Dr-xcb6S.mjs";
9
9
  import "../../../../../../api/schemas/index.mjs";
10
- import "../../../../../../tokens-N8otWMmj.mjs";
11
- import { i as getPreviewUrl } from "../../../../../../preview-D4z0WONU.mjs";
12
- import { i as resolveSecretsCached } from "../../../../../../secrets-rPdhEBkD.mjs";
13
- import { n as requirePerm } from "../../../../../../authorize-Bn4S4DUT.mjs";
10
+ import "../../../../../../tokens-Bx2afeT-.mjs";
11
+ import { i as getPreviewUrl } from "../../../../../../preview-BfuRkVKW.mjs";
12
+ import { i as resolveSecretsCached } from "../../../../../../secrets-YYbTgB1w.mjs";
13
+ import { n as requirePerm } from "../../../../../../authorize-_wWM_44T.mjs";
14
14
 
15
15
  //#region src/astro/routes/api/content/[collection]/[id]/preview-url.ts
16
16
  const prerender = false;
@@ -1,11 +1,11 @@
1
1
  import "../../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../../types-B0bmgwMG.mjs";
3
- import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-ChfADBuu.mjs";
4
- import { r as parseOptionalBody, t as isParseError } from "../../../../../../parse-DHbXfvxO.mjs";
5
- import { in as contentPublishBody } from "../../../../../../redirects-COMLwsV5.mjs";
6
- import "../../../../../../setup-Cf_TyOv5.mjs";
2
+ import "../../../../../../types-SF1DwGf2.mjs";
3
+ import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-npZWBSb7.mjs";
4
+ import { r as parseOptionalBody, t as isParseError } from "../../../../../../parse-4zO5Y2DL.mjs";
5
+ import { in as contentPublishBody } from "../../../../../../redirects-C0L9JUk4.mjs";
6
+ import "../../../../../../byline-fields-Dr-xcb6S.mjs";
7
7
  import "../../../../../../api/schemas/index.mjs";
8
- import { t as requireOwnerPerm } from "../../../../../../authorize-Bn4S4DUT.mjs";
8
+ import { t as requireOwnerPerm } from "../../../../../../authorize-_wWM_44T.mjs";
9
9
  import { hasPermission } from "@emdash-cms/auth";
10
10
 
11
11
  //#region src/astro/routes/api/content/[collection]/[id]/publish.ts
@@ -1,7 +1,7 @@
1
1
  import "../../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../../types-B0bmgwMG.mjs";
3
- import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-ChfADBuu.mjs";
4
- import { t as requireOwnerPerm } from "../../../../../../authorize-Bn4S4DUT.mjs";
2
+ import "../../../../../../types-SF1DwGf2.mjs";
3
+ import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-npZWBSb7.mjs";
4
+ import { t as requireOwnerPerm } from "../../../../../../authorize-_wWM_44T.mjs";
5
5
 
6
6
  //#region src/astro/routes/api/content/[collection]/[id]/restore.ts
7
7
  const prerender = false;
@@ -1,7 +1,7 @@
1
1
  import "../../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../../types-B0bmgwMG.mjs";
3
- import { a as unwrapResult, t as apiError } from "../../../../../../error-ChfADBuu.mjs";
4
- import { n as requirePerm } from "../../../../../../authorize-Bn4S4DUT.mjs";
2
+ import "../../../../../../types-SF1DwGf2.mjs";
3
+ import { a as unwrapResult, t as apiError } from "../../../../../../error-npZWBSb7.mjs";
4
+ import { n as requirePerm } from "../../../../../../authorize-_wWM_44T.mjs";
5
5
 
6
6
  //#region src/astro/routes/api/content/[collection]/[id]/revisions.ts
7
7
  const prerender = false;
@@ -1,11 +1,11 @@
1
1
  import "../../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../../types-B0bmgwMG.mjs";
3
- import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-ChfADBuu.mjs";
4
- import { n as parseBody, t as isParseError } from "../../../../../../parse-DHbXfvxO.mjs";
5
- import { on as contentScheduleBody } from "../../../../../../redirects-COMLwsV5.mjs";
6
- import "../../../../../../setup-Cf_TyOv5.mjs";
2
+ import "../../../../../../types-SF1DwGf2.mjs";
3
+ import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-npZWBSb7.mjs";
4
+ import { n as parseBody, t as isParseError } from "../../../../../../parse-4zO5Y2DL.mjs";
5
+ import { on as contentScheduleBody } from "../../../../../../redirects-C0L9JUk4.mjs";
6
+ import "../../../../../../byline-fields-Dr-xcb6S.mjs";
7
7
  import "../../../../../../api/schemas/index.mjs";
8
- import { t as requireOwnerPerm } from "../../../../../../authorize-Bn4S4DUT.mjs";
8
+ import { t as requireOwnerPerm } from "../../../../../../authorize-_wWM_44T.mjs";
9
9
 
10
10
  //#region src/astro/routes/api/content/[collection]/[id]/schedule.ts
11
11
  const prerender = false;
@@ -1 +1 @@
1
- {"version":3,"file":"_taxonomy_.d.mts","names":[],"sources":["../../../../../../../../src/astro/routes/api/content/[collection]/[id]/terms/[taxonomy].ts"],"mappings":";;;cAgBa,SAAA;AAKb;;;AAAA,cAAa,GAAA,EAAK,QAAA;;AAmClB;;cAAa,IAAA,EAAM,QAAA"}
1
+ {"version":3,"file":"_taxonomy_.d.mts","names":[],"sources":["../../../../../../../../src/astro/routes/api/content/[collection]/[id]/terms/[taxonomy].ts"],"mappings":";;;cAiBa,SAAA;AAKb;;;AAAA,cAAa,GAAA,EAAK,QAAA;;AA2ClB;;cAAa,IAAA,EAAM,QAAA"}
@@ -1,17 +1,18 @@
1
1
  import "../../../../../../../dialect-helpers-BKCvISIQ.mjs";
2
+ import { t as ContentRepository } from "../../../../../../../content-BbqKo3Kc.mjs";
2
3
  import "../../../../../../../base64-CqR-7kqF.mjs";
3
- import "../../../../../../../types-B0bmgwMG.mjs";
4
- import { t as TaxonomyRepository } from "../../../../../../../taxonomy-zqGQUqgu.mjs";
5
- import "../../../../../../../request-cache-dzCt8TZB.mjs";
6
- import "../../../../../../../loader-D-vIJjfY.mjs";
7
- import "../../../../../../../resolve-D6sM-SgF.mjs";
8
- import { l as invalidateTermCache } from "../../../../../../../taxonomies-CcvrMLbR.mjs";
9
- import { i as requireDb, n as apiSuccess, r as handleError, t as apiError } from "../../../../../../../error-ChfADBuu.mjs";
10
- import { n as parseBody, t as isParseError } from "../../../../../../../parse-DHbXfvxO.mjs";
11
- import { ln as contentTermsBody } from "../../../../../../../redirects-COMLwsV5.mjs";
12
- import "../../../../../../../setup-Cf_TyOv5.mjs";
4
+ import "../../../../../../../types-SF1DwGf2.mjs";
5
+ import { t as TaxonomyRepository } from "../../../../../../../taxonomy-BBK-UAEo.mjs";
6
+ import "../../../../../../../request-cache-BYMs-BGX.mjs";
7
+ import "../../../../../../../loader-CJ6lWO0d.mjs";
8
+ import "../../../../../../../resolve-BqYMVG0D.mjs";
9
+ import { l as invalidateTermCache } from "../../../../../../../taxonomies-CgpzAU6F.mjs";
10
+ import { i as requireDb, n as apiSuccess, r as handleError, t as apiError } from "../../../../../../../error-npZWBSb7.mjs";
11
+ import { n as parseBody, t as isParseError } from "../../../../../../../parse-4zO5Y2DL.mjs";
12
+ import { ln as contentTermsBody } from "../../../../../../../redirects-C0L9JUk4.mjs";
13
+ import "../../../../../../../byline-fields-Dr-xcb6S.mjs";
13
14
  import "../../../../../../../api/schemas/index.mjs";
14
- import { n as requirePerm, t as requireOwnerPerm } from "../../../../../../../authorize-Bn4S4DUT.mjs";
15
+ import { n as requirePerm, t as requireOwnerPerm } from "../../../../../../../authorize-_wWM_44T.mjs";
15
16
 
16
17
  //#region src/astro/routes/api/content/[collection]/[id]/terms/[taxonomy].ts
17
18
  const prerender = false;
@@ -27,7 +28,10 @@ const GET = async ({ params, locals }) => {
27
28
  const dbErr = requireDb(emdash?.db);
28
29
  if (dbErr) return dbErr;
29
30
  try {
30
- return apiSuccess({ terms: (await new TaxonomyRepository(emdash.db).getTermsForEntry(collection, id, taxonomy)).map((t) => ({
31
+ const entry = await new ContentRepository(emdash.db).findByIdOrSlug(collection, id);
32
+ if (!entry) return apiError("NOT_FOUND", "Content not found", 404);
33
+ const locale = entry.locale ?? void 0;
34
+ return apiSuccess({ terms: (await new TaxonomyRepository(emdash.db).getTermsForEntry(collection, entry.id, taxonomy, locale)).map((t) => ({
31
35
  id: t.id,
32
36
  name: t.name,
33
37
  slug: t.slug,
@@ -57,6 +61,7 @@ const POST = async ({ params, request, locals }) => {
57
61
  const editDenied = requireOwnerPerm(user, typeof existingItem?.authorId === "string" ? existingItem.authorId : "", "content:edit_own", "content:edit_any");
58
62
  if (editDenied) return editDenied;
59
63
  const canonicalId = typeof existingItem?.id === "string" ? existingItem.id : id;
64
+ const entryLocale = typeof existingItem?.locale === "string" ? existingItem.locale : void 0;
60
65
  try {
61
66
  const body = await parseBody(request, contentTermsBody);
62
67
  if (isParseError(body)) return body;
@@ -69,7 +74,7 @@ const POST = async ({ params, request, locals }) => {
69
74
  }
70
75
  await repo.setTermsForEntry(collection, canonicalId, taxonomy, termIds);
71
76
  /* @__PURE__ */ invalidateTermCache();
72
- return apiSuccess({ terms: (await repo.getTermsForEntry(collection, canonicalId, taxonomy)).map((t) => ({
77
+ return apiSuccess({ terms: (await repo.getTermsForEntry(collection, canonicalId, taxonomy, entryLocale)).map((t) => ({
73
78
  id: t.id,
74
79
  name: t.name,
75
80
  slug: t.slug,
@@ -1 +1 @@
1
- {"version":3,"file":"_taxonomy_.mjs","names":[],"sources":["../../../../../../../../src/astro/routes/api/content/[collection]/[id]/terms/[taxonomy].ts"],"sourcesContent":["/**\n * Content-taxonomy association endpoint\n *\n * GET /_emdash/api/content/:collection/:id/terms/:taxonomy - Get terms for an entry\n * POST /_emdash/api/content/:collection/:id/terms/:taxonomy - Set terms for an entry\n */\n\nimport type { APIRoute } from \"astro\";\n\nimport { requirePerm, requireOwnerPerm } from \"#api/authorize.js\";\nimport { apiError, apiSuccess, handleError, requireDb } from \"#api/error.js\";\nimport { parseBody, isParseError } from \"#api/parse.js\";\nimport { contentTermsBody } from \"#api/schemas.js\";\nimport { TaxonomyRepository } from \"#db/repositories/taxonomy.js\";\nimport { invalidateTermCache } from \"#taxonomies/index.js\";\n\nexport const prerender = false;\n\n/**\n * Get terms assigned to an entry\n */\nexport const GET: APIRoute = async ({ params, locals }) => {\n\tconst { emdash, user } = locals;\n\tconst { collection, id, taxonomy } = params;\n\n\tconst denied = requirePerm(user, \"content:read\");\n\tif (denied) return denied;\n\n\tif (!collection || !id || !taxonomy) {\n\t\treturn apiError(\"VALIDATION_ERROR\", \"Collection, id, and taxonomy required\", 400);\n\t}\n\n\tconst dbErr = requireDb(emdash?.db);\n\tif (dbErr) return dbErr;\n\n\ttry {\n\t\tconst repo = new TaxonomyRepository(emdash.db);\n\t\tconst terms = await repo.getTermsForEntry(collection, id, taxonomy);\n\n\t\treturn apiSuccess({\n\t\t\tterms: terms.map((t) => ({\n\t\t\t\tid: t.id,\n\t\t\t\tname: t.name,\n\t\t\t\tslug: t.slug,\n\t\t\t\tlabel: t.label,\n\t\t\t\tparentId: t.parentId,\n\t\t\t})),\n\t\t});\n\t} catch (error) {\n\t\treturn handleError(error, \"Failed to get entry terms\", \"TERMS_GET_ERROR\");\n\t}\n};\n\n/**\n * Set terms for an entry (replaces existing)\n */\nexport const POST: APIRoute = async ({ params, request, locals }) => {\n\tconst { emdash, user } = locals;\n\tconst { collection, id, taxonomy } = params;\n\n\tif (!collection || !id || !taxonomy) {\n\t\treturn apiError(\"VALIDATION_ERROR\", \"Collection, id, and taxonomy required\", 400);\n\t}\n\n\tconst denied = requirePerm(user, \"content:edit_own\");\n\tif (denied) return denied;\n\n\tconst dbErr = requireDb(emdash?.db);\n\tif (dbErr) return dbErr;\n\n\tif (!emdash.handleContentGet) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash is not initialized\", 500);\n\t}\n\n\t// Verify the content exists before modifying its terms\n\tconst existing = await emdash.handleContentGet(collection, id);\n\tif (!existing.success) {\n\t\treturn apiError(\n\t\t\texisting.error?.code ?? \"NOT_FOUND\",\n\t\t\texisting.error?.message ?? \"Content not found\",\n\t\t\texisting.error?.code === \"NOT_FOUND\" ? 404 : 500,\n\t\t);\n\t}\n\n\t// Check ownership for edit permission\n\tconst existingData =\n\t\texisting.data && typeof existing.data === \"object\"\n\t\t\t? // eslint-disable-next-line typescript/no-unsafe-type-assertion -- handler returns unknown data; narrowed by typeof check above\n\t\t\t\t(existing.data as Record<string, unknown>)\n\t\t\t: undefined;\n\t// Handler returns { item, _rev } — extract the item for ownership check\n\tconst existingItem =\n\t\texistingData?.item && typeof existingData.item === \"object\"\n\t\t\t? // eslint-disable-next-line typescript/no-unsafe-type-assertion -- narrowed by typeof check above\n\t\t\t\t(existingData.item as Record<string, unknown>)\n\t\t\t: existingData;\n\tconst authorId = typeof existingItem?.authorId === \"string\" ? existingItem.authorId : \"\";\n\tconst editDenied = requireOwnerPerm(user, authorId, \"content:edit_own\", \"content:edit_any\");\n\tif (editDenied) return editDenied;\n\n\t// Resolve the canonical content ID from the handler result.\n\t// The URL `id` param may be a slug; we must use the real ID for term storage.\n\tconst canonicalId = typeof existingItem?.id === \"string\" ? existingItem.id : id;\n\n\ttry {\n\t\tconst body = await parseBody(request, contentTermsBody);\n\t\tif (isParseError(body)) return body;\n\t\tconst { termIds } = body;\n\n\t\tconst repo = new TaxonomyRepository(emdash.db);\n\n\t\t// Verify all term IDs exist and belong to the correct taxonomy\n\t\tfor (const termId of termIds) {\n\t\t\tconst term = await repo.findById(termId);\n\t\t\tif (!term) {\n\t\t\t\treturn apiError(\"NOT_FOUND\", `Term ID '${termId}' not found`, 404);\n\t\t\t}\n\t\t\tif (term.name !== taxonomy) {\n\t\t\t\treturn apiError(\n\t\t\t\t\t\"VALIDATION_ERROR\",\n\t\t\t\t\t`Term ID '${termId}' does not belong to taxonomy '${taxonomy}'`,\n\t\t\t\t\t400,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Set the terms (replaces existing) using the canonical ID\n\t\tawait repo.setTermsForEntry(collection, canonicalId, taxonomy, termIds);\n\n\t\t// Term assignments changed — invalidate the hasAnyTermAssignments cache\n\t\t// so hydration on subsequent reads issues a fresh query.\n\t\tinvalidateTermCache();\n\n\t\t// Get the updated terms using the canonical ID\n\t\tconst terms = await repo.getTermsForEntry(collection, canonicalId, taxonomy);\n\n\t\treturn apiSuccess({\n\t\t\tterms: terms.map((t) => ({\n\t\t\t\tid: t.id,\n\t\t\t\tname: t.name,\n\t\t\t\tslug: t.slug,\n\t\t\t\tlabel: t.label,\n\t\t\t\tparentId: t.parentId,\n\t\t\t})),\n\t\t});\n\t} catch (error) {\n\t\treturn handleError(error, \"Failed to set entry terms\", \"TERMS_SET_ERROR\");\n\t}\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,MAAa,YAAY;;;;AAKzB,MAAa,MAAgB,OAAO,EAAE,QAAQ,aAAa;CAC1D,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,EAAE,YAAY,IAAI,aAAa;CAErC,MAAM,SAAS,YAAY,MAAM,eAAe;AAChD,KAAI,OAAQ,QAAO;AAEnB,KAAI,CAAC,cAAc,CAAC,MAAM,CAAC,SAC1B,QAAO,SAAS,oBAAoB,yCAAyC,IAAI;CAGlF,MAAM,QAAQ,UAAU,QAAQ,GAAG;AACnC,KAAI,MAAO,QAAO;AAElB,KAAI;AAIH,SAAO,WAAW,EACjB,QAHa,MADD,IAAI,mBAAmB,OAAO,GAAG,CACrB,iBAAiB,YAAY,IAAI,SAAS,EAGrD,KAAK,OAAO;GACxB,IAAI,EAAE;GACN,MAAM,EAAE;GACR,MAAM,EAAE;GACR,OAAO,EAAE;GACT,UAAU,EAAE;GACZ,EAAE,EACH,CAAC;UACM,OAAO;AACf,SAAO,YAAY,OAAO,6BAA6B,kBAAkB;;;;;;AAO3E,MAAa,OAAiB,OAAO,EAAE,QAAQ,SAAS,aAAa;CACpE,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,EAAE,YAAY,IAAI,aAAa;AAErC,KAAI,CAAC,cAAc,CAAC,MAAM,CAAC,SAC1B,QAAO,SAAS,oBAAoB,yCAAyC,IAAI;CAGlF,MAAM,SAAS,YAAY,MAAM,mBAAmB;AACpD,KAAI,OAAQ,QAAO;CAEnB,MAAM,QAAQ,UAAU,QAAQ,GAAG;AACnC,KAAI,MAAO,QAAO;AAElB,KAAI,CAAC,OAAO,iBACX,QAAO,SAAS,kBAAkB,6BAA6B,IAAI;CAIpE,MAAM,WAAW,MAAM,OAAO,iBAAiB,YAAY,GAAG;AAC9D,KAAI,CAAC,SAAS,QACb,QAAO,SACN,SAAS,OAAO,QAAQ,aACxB,SAAS,OAAO,WAAW,qBAC3B,SAAS,OAAO,SAAS,cAAc,MAAM,IAC7C;CAIF,MAAM,eACL,SAAS,QAAQ,OAAO,SAAS,SAAS,WAEvC,SAAS,OACT;CAEJ,MAAM,eACL,cAAc,QAAQ,OAAO,aAAa,SAAS,WAEhD,aAAa,OACb;CAEJ,MAAM,aAAa,iBAAiB,MADnB,OAAO,cAAc,aAAa,WAAW,aAAa,WAAW,IAClC,oBAAoB,mBAAmB;AAC3F,KAAI,WAAY,QAAO;CAIvB,MAAM,cAAc,OAAO,cAAc,OAAO,WAAW,aAAa,KAAK;AAE7E,KAAI;EACH,MAAM,OAAO,MAAM,UAAU,SAAS,iBAAiB;AACvD,MAAI,aAAa,KAAK,CAAE,QAAO;EAC/B,MAAM,EAAE,YAAY;EAEpB,MAAM,OAAO,IAAI,mBAAmB,OAAO,GAAG;AAG9C,OAAK,MAAM,UAAU,SAAS;GAC7B,MAAM,OAAO,MAAM,KAAK,SAAS,OAAO;AACxC,OAAI,CAAC,KACJ,QAAO,SAAS,aAAa,YAAY,OAAO,cAAc,IAAI;AAEnE,OAAI,KAAK,SAAS,SACjB,QAAO,SACN,oBACA,YAAY,OAAO,iCAAiC,SAAS,IAC7D,IACA;;AAKH,QAAM,KAAK,iBAAiB,YAAY,aAAa,UAAU,QAAQ;AAIvE,uCAAqB;AAKrB,SAAO,WAAW,EACjB,QAHa,MAAM,KAAK,iBAAiB,YAAY,aAAa,SAAS,EAG9D,KAAK,OAAO;GACxB,IAAI,EAAE;GACN,MAAM,EAAE;GACR,MAAM,EAAE;GACR,OAAO,EAAE;GACT,UAAU,EAAE;GACZ,EAAE,EACH,CAAC;UACM,OAAO;AACf,SAAO,YAAY,OAAO,6BAA6B,kBAAkB"}
1
+ {"version":3,"file":"_taxonomy_.mjs","names":[],"sources":["../../../../../../../../src/astro/routes/api/content/[collection]/[id]/terms/[taxonomy].ts"],"sourcesContent":["/**\n * Content-taxonomy association endpoint\n *\n * GET /_emdash/api/content/:collection/:id/terms/:taxonomy - Get terms for an entry\n * POST /_emdash/api/content/:collection/:id/terms/:taxonomy - Set terms for an entry\n */\n\nimport type { APIRoute } from \"astro\";\n\nimport { requirePerm, requireOwnerPerm } from \"#api/authorize.js\";\nimport { apiError, apiSuccess, handleError, requireDb } from \"#api/error.js\";\nimport { parseBody, isParseError } from \"#api/parse.js\";\nimport { contentTermsBody } from \"#api/schemas.js\";\nimport { ContentRepository } from \"#db/repositories/content.js\";\nimport { TaxonomyRepository } from \"#db/repositories/taxonomy.js\";\nimport { invalidateTermCache } from \"#taxonomies/index.js\";\n\nexport const prerender = false;\n\n/**\n * Get terms assigned to an entry\n */\nexport const GET: APIRoute = async ({ params, locals }) => {\n\tconst { emdash, user } = locals;\n\tconst { collection, id, taxonomy } = params;\n\n\tconst denied = requirePerm(user, \"content:read\");\n\tif (denied) return denied;\n\n\tif (!collection || !id || !taxonomy) {\n\t\treturn apiError(\"VALIDATION_ERROR\", \"Collection, id, and taxonomy required\", 400);\n\t}\n\n\tconst dbErr = requireDb(emdash?.db);\n\tif (dbErr) return dbErr;\n\n\ttry {\n\t\t// Terms are stored against the per-locale entry row but their\n\t\t// translation_group spans every locale. Resolve the entry's own locale\n\t\t// server-side (deterministic, not client-spoofable) so only the matching\n\t\t// term variant is returned — see issue #1218.\n\t\tconst entry = await new ContentRepository(emdash.db).findByIdOrSlug(collection, id);\n\t\tif (!entry) return apiError(\"NOT_FOUND\", \"Content not found\", 404);\n\t\tconst locale = entry.locale ?? undefined;\n\n\t\tconst repo = new TaxonomyRepository(emdash.db);\n\t\tconst terms = await repo.getTermsForEntry(collection, entry.id, taxonomy, locale);\n\n\t\treturn apiSuccess({\n\t\t\tterms: terms.map((t) => ({\n\t\t\t\tid: t.id,\n\t\t\t\tname: t.name,\n\t\t\t\tslug: t.slug,\n\t\t\t\tlabel: t.label,\n\t\t\t\tparentId: t.parentId,\n\t\t\t})),\n\t\t});\n\t} catch (error) {\n\t\treturn handleError(error, \"Failed to get entry terms\", \"TERMS_GET_ERROR\");\n\t}\n};\n\n/**\n * Set terms for an entry (replaces existing)\n */\nexport const POST: APIRoute = async ({ params, request, locals }) => {\n\tconst { emdash, user } = locals;\n\tconst { collection, id, taxonomy } = params;\n\n\tif (!collection || !id || !taxonomy) {\n\t\treturn apiError(\"VALIDATION_ERROR\", \"Collection, id, and taxonomy required\", 400);\n\t}\n\n\tconst denied = requirePerm(user, \"content:edit_own\");\n\tif (denied) return denied;\n\n\tconst dbErr = requireDb(emdash?.db);\n\tif (dbErr) return dbErr;\n\n\tif (!emdash.handleContentGet) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash is not initialized\", 500);\n\t}\n\n\t// Verify the content exists before modifying its terms\n\tconst existing = await emdash.handleContentGet(collection, id);\n\tif (!existing.success) {\n\t\treturn apiError(\n\t\t\texisting.error?.code ?? \"NOT_FOUND\",\n\t\t\texisting.error?.message ?? \"Content not found\",\n\t\t\texisting.error?.code === \"NOT_FOUND\" ? 404 : 500,\n\t\t);\n\t}\n\n\t// Check ownership for edit permission\n\tconst existingData =\n\t\texisting.data && typeof existing.data === \"object\"\n\t\t\t? // eslint-disable-next-line typescript/no-unsafe-type-assertion -- handler returns unknown data; narrowed by typeof check above\n\t\t\t\t(existing.data as Record<string, unknown>)\n\t\t\t: undefined;\n\t// Handler returns { item, _rev } — extract the item for ownership check\n\tconst existingItem =\n\t\texistingData?.item && typeof existingData.item === \"object\"\n\t\t\t? // eslint-disable-next-line typescript/no-unsafe-type-assertion -- narrowed by typeof check above\n\t\t\t\t(existingData.item as Record<string, unknown>)\n\t\t\t: existingData;\n\tconst authorId = typeof existingItem?.authorId === \"string\" ? existingItem.authorId : \"\";\n\tconst editDenied = requireOwnerPerm(user, authorId, \"content:edit_own\", \"content:edit_any\");\n\tif (editDenied) return editDenied;\n\n\t// Resolve the canonical content ID from the handler result.\n\t// The URL `id` param may be a slug; we must use the real ID for term storage.\n\tconst canonicalId = typeof existingItem?.id === \"string\" ? existingItem.id : id;\n\t// The entry is per-locale; scope the term read to its locale so only the\n\t// matching translation variant is returned in the response — see #1218.\n\tconst entryLocale = typeof existingItem?.locale === \"string\" ? existingItem.locale : undefined;\n\n\ttry {\n\t\tconst body = await parseBody(request, contentTermsBody);\n\t\tif (isParseError(body)) return body;\n\t\tconst { termIds } = body;\n\n\t\tconst repo = new TaxonomyRepository(emdash.db);\n\n\t\t// Verify all term IDs exist and belong to the correct taxonomy\n\t\tfor (const termId of termIds) {\n\t\t\tconst term = await repo.findById(termId);\n\t\t\tif (!term) {\n\t\t\t\treturn apiError(\"NOT_FOUND\", `Term ID '${termId}' not found`, 404);\n\t\t\t}\n\t\t\tif (term.name !== taxonomy) {\n\t\t\t\treturn apiError(\n\t\t\t\t\t\"VALIDATION_ERROR\",\n\t\t\t\t\t`Term ID '${termId}' does not belong to taxonomy '${taxonomy}'`,\n\t\t\t\t\t400,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Set the terms (replaces existing) using the canonical ID\n\t\tawait repo.setTermsForEntry(collection, canonicalId, taxonomy, termIds);\n\n\t\t// Term assignments changed — invalidate the hasAnyTermAssignments cache\n\t\t// so hydration on subsequent reads issues a fresh query.\n\t\tinvalidateTermCache();\n\n\t\t// Get the updated terms using the canonical ID, scoped to the entry locale\n\t\tconst terms = await repo.getTermsForEntry(collection, canonicalId, taxonomy, entryLocale);\n\n\t\treturn apiSuccess({\n\t\t\tterms: terms.map((t) => ({\n\t\t\t\tid: t.id,\n\t\t\t\tname: t.name,\n\t\t\t\tslug: t.slug,\n\t\t\t\tlabel: t.label,\n\t\t\t\tparentId: t.parentId,\n\t\t\t})),\n\t\t});\n\t} catch (error) {\n\t\treturn handleError(error, \"Failed to set entry terms\", \"TERMS_SET_ERROR\");\n\t}\n};\n"],"mappings":"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"}
@@ -1,7 +1,7 @@
1
1
  import "../../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../../types-B0bmgwMG.mjs";
3
- import { a as unwrapResult, t as apiError } from "../../../../../../error-ChfADBuu.mjs";
4
- import { n as requirePerm } from "../../../../../../authorize-Bn4S4DUT.mjs";
2
+ import "../../../../../../types-SF1DwGf2.mjs";
3
+ import { a as unwrapResult, t as apiError } from "../../../../../../error-npZWBSb7.mjs";
4
+ import { n as requirePerm } from "../../../../../../authorize-_wWM_44T.mjs";
5
5
  import { hasPermission } from "@emdash-cms/auth";
6
6
 
7
7
  //#region src/astro/routes/api/content/[collection]/[id]/translations.ts
@@ -1,7 +1,7 @@
1
1
  import "../../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../../types-B0bmgwMG.mjs";
3
- import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-ChfADBuu.mjs";
4
- import { t as requireOwnerPerm } from "../../../../../../authorize-Bn4S4DUT.mjs";
2
+ import "../../../../../../types-SF1DwGf2.mjs";
3
+ import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-npZWBSb7.mjs";
4
+ import { t as requireOwnerPerm } from "../../../../../../authorize-_wWM_44T.mjs";
5
5
 
6
6
  //#region src/astro/routes/api/content/[collection]/[id]/unpublish.ts
7
7
  const prerender = false;
@@ -1 +1 @@
1
- {"version":3,"file":"_id_.d.mts","names":[],"sources":["../../../../../../src/astro/routes/api/content/[collection]/[id].ts"],"mappings":";;;cAgBa,SAAA;AAAA,cAEA,GAAA,EAAK,QAAA;AAAA,cAgDL,GAAA,EAAK,QAAA;AAAA,cAkEL,MAAA,EAAQ,QAAA"}
1
+ {"version":3,"file":"_id_.d.mts","names":[],"sources":["../../../../../../src/astro/routes/api/content/[collection]/[id].ts"],"mappings":";;;cAgBa,SAAA;AAAA,cAEA,GAAA,EAAK,QAAA;AAAA,cAgDL,GAAA,EAAK,QAAA;AAAA,cAoEL,MAAA,EAAQ,QAAA"}
@@ -1,11 +1,11 @@
1
1
  import "../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../types-B0bmgwMG.mjs";
3
- import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../error-ChfADBuu.mjs";
4
- import { n as parseBody, t as isParseError } from "../../../../../parse-DHbXfvxO.mjs";
5
- import { pn as contentUpdateBody } from "../../../../../redirects-COMLwsV5.mjs";
6
- import "../../../../../setup-Cf_TyOv5.mjs";
2
+ import "../../../../../types-SF1DwGf2.mjs";
3
+ import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../error-npZWBSb7.mjs";
4
+ import { n as parseBody, t as isParseError } from "../../../../../parse-4zO5Y2DL.mjs";
5
+ import { pn as contentUpdateBody } from "../../../../../redirects-C0L9JUk4.mjs";
6
+ import "../../../../../byline-fields-Dr-xcb6S.mjs";
7
7
  import "../../../../../api/schemas/index.mjs";
8
- import { n as requirePerm, t as requireOwnerPerm } from "../../../../../authorize-Bn4S4DUT.mjs";
8
+ import { n as requirePerm, t as requireOwnerPerm } from "../../../../../authorize-_wWM_44T.mjs";
9
9
  import { hasPermission } from "@emdash-cms/auth";
10
10
 
11
11
  //#region src/astro/routes/api/content/[collection]/[id].ts
@@ -42,10 +42,11 @@ const PUT = async ({ params, request, locals, cache }) => {
42
42
  const { emdash, user } = locals;
43
43
  const collection = params.collection;
44
44
  const id = params.id;
45
+ const locale = new URL(request.url).searchParams.get("locale") || void 0;
45
46
  const body = await parseBody(request, contentUpdateBody);
46
47
  if (isParseError(body)) return body;
47
48
  if (!emdash?.handleContentUpdate || !emdash?.handleContentGet) return apiError("NOT_CONFIGURED", "EmDash is not initialized", 500);
48
- const existing = await emdash.handleContentGet(collection, id);
49
+ const existing = await emdash.handleContentGet(collection, id, locale);
49
50
  if (!existing.success) return apiError(existing.error?.code ?? "UNKNOWN_ERROR", existing.error?.message ?? "Unknown error", mapErrorStatus(existing.error?.code));
50
51
  const existingData = existing.data && typeof existing.data === "object" ? existing.data : void 0;
51
52
  const existingItem = existingData?.item && typeof existingData.item === "object" ? existingData.item : existingData;
@@ -59,6 +60,7 @@ const PUT = async ({ params, request, locals, cache }) => {
59
60
  };
60
61
  const result = await emdash.handleContentUpdate(collection, resolvedId, {
61
62
  ...updateBody,
63
+ locale,
62
64
  _rev: body._rev
63
65
  });
64
66
  if (!result.success) return unwrapResult(result);
@@ -1 +1 @@
1
- {"version":3,"file":"_id_.mjs","names":[],"sources":["../../../../../../src/astro/routes/api/content/[collection]/[id].ts"],"sourcesContent":["/**\n * Single content item endpoints - injected by EmDash integration\n *\n * GET /_emdash/api/content/{collection}/{id} - Get content\n * PUT /_emdash/api/content/{collection}/{id} - Update content\n * DELETE /_emdash/api/content/{collection}/{id} - Delete content\n */\n\nimport { hasPermission } from \"@emdash-cms/auth\";\nimport type { APIRoute } from \"astro\";\n\nimport { requirePerm, requireOwnerPerm } from \"#api/authorize.js\";\nimport { apiError, mapErrorStatus, unwrapResult } from \"#api/error.js\";\nimport { parseBody, isParseError } from \"#api/parse.js\";\nimport { contentUpdateBody } from \"#api/schemas.js\";\n\nexport const prerender = false;\n\nexport const GET: APIRoute = async ({ params, url, locals }) => {\n\tconst { emdash, user } = locals;\n\tconst denied = requirePerm(user, \"content:read\");\n\tif (denied) return denied;\n\tconst collection = params.collection!;\n\tconst id = params.id!;\n\tconst locale = url.searchParams.get(\"locale\") || undefined;\n\n\tif (!emdash?.handleContentGet) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash is not initialized\", 500);\n\t}\n\n\tconst result = await emdash.handleContentGet(collection, id, locale);\n\n\t// Hide non-published items from users without content:read_drafts. Return\n\t// 404 (not 403) so subscribers can't enumerate draft IDs by status code.\n\tif (result.success && !hasPermission(user, \"content:read_drafts\")) {\n\t\tconst data =\n\t\t\tresult.data && typeof result.data === \"object\"\n\t\t\t\t? // eslint-disable-next-line typescript/no-unsafe-type-assertion -- handler returns unknown data; narrowed by typeof check\n\t\t\t\t\t(result.data as Record<string, unknown>)\n\t\t\t\t: undefined;\n\t\tconst item =\n\t\t\tdata?.item && typeof data.item === \"object\"\n\t\t\t\t? // eslint-disable-next-line typescript/no-unsafe-type-assertion -- narrowed by typeof check\n\t\t\t\t\t(data.item as Record<string, unknown>)\n\t\t\t\t: undefined;\n\t\tconst status = typeof item?.status === \"string\" ? item.status : null;\n\t\tif (status !== \"published\") {\n\t\t\treturn apiError(\"NOT_FOUND\", `Content item not found: ${id}`, 404);\n\t\t}\n\n\t\t// Strip draft hydration data from response for users without read_drafts.\n\t\t// handleContentGet overlays draft revision data onto item.data and exposes\n\t\t// the published values in item.liveData. Without this, subscribers see\n\t\t// unpublished edits in the data field.\n\t\tif (item) {\n\t\t\tif (item.liveData && typeof item.liveData === \"object\") {\n\t\t\t\titem.data = item.liveData;\n\t\t\t}\n\t\t\tdelete item.liveData;\n\t\t\tdelete item.draftRevisionId;\n\t\t}\n\t}\n\n\treturn unwrapResult(result);\n};\n\nexport const PUT: APIRoute = async ({ params, request, locals, cache }) => {\n\tconst { emdash, user } = locals;\n\tconst collection = params.collection!;\n\tconst id = params.id!;\n\tconst body = await parseBody(request, contentUpdateBody);\n\tif (isParseError(body)) return body;\n\n\tif (!emdash?.handleContentUpdate || !emdash?.handleContentGet) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash is not initialized\", 500);\n\t}\n\n\t// Fetch item to check ownership\n\tconst existing = await emdash.handleContentGet(collection, id);\n\tif (!existing.success) {\n\t\treturn apiError(\n\t\t\texisting.error?.code ?? \"UNKNOWN_ERROR\",\n\t\t\texisting.error?.message ?? \"Unknown error\",\n\t\t\tmapErrorStatus(existing.error?.code),\n\t\t);\n\t}\n\n\tconst existingData =\n\t\texisting.data && typeof existing.data === \"object\"\n\t\t\t? // eslint-disable-next-line typescript/no-unsafe-type-assertion -- handler returns unknown data; narrowed by typeof check above\n\t\t\t\t(existing.data as Record<string, unknown>)\n\t\t\t: undefined;\n\t// Handler returns { item, _rev } — extract the item for ownership and ID resolution\n\tconst existingItem =\n\t\texistingData?.item && typeof existingData.item === \"object\"\n\t\t\t? // eslint-disable-next-line typescript/no-unsafe-type-assertion -- narrowed by typeof check above\n\t\t\t\t(existingData.item as Record<string, unknown>)\n\t\t\t: existingData;\n\tconst authorId = typeof existingItem?.authorId === \"string\" ? existingItem.authorId : \"\";\n\tconst editDenied = requireOwnerPerm(user, authorId, \"content:edit_own\", \"content:edit_any\");\n\tif (editDenied) return editDenied;\n\n\t// Only EDITOR+ can write publishedAt directly — incl. clearing to null.\n\tif (body.publishedAt !== undefined && !hasPermission(user, \"content:publish_any\")) {\n\t\treturn apiError(\n\t\t\t\"FORBIDDEN\",\n\t\t\t\"Writing publishedAt requires content:publish_any permission\",\n\t\t\t403,\n\t\t);\n\t}\n\n\t// Use the resolved ID (handles slug → ID resolution)\n\tconst resolvedId = typeof existingItem?.id === \"string\" ? existingItem.id : id;\n\n\t// Only allow authorId changes if user has content:edit_any permission (editor+)\n\tconst canChangeAuthor =\n\t\tbody.authorId !== undefined && user && hasPermission(user, \"content:edit_any\");\n\tconst updateBody = canChangeAuthor ? body : { ...body, authorId: undefined };\n\n\t// Pass _rev through for optimistic concurrency validation\n\tconst result = await emdash.handleContentUpdate(collection, resolvedId, {\n\t\t...updateBody,\n\t\t_rev: body._rev,\n\t});\n\n\tif (!result.success) return unwrapResult(result);\n\n\tif (cache?.enabled) await cache.invalidate({ tags: [collection, resolvedId] });\n\n\treturn unwrapResult(result);\n};\n\nexport const DELETE: APIRoute = async ({ params, locals, cache }) => {\n\tconst { emdash, user } = locals;\n\tconst collection = params.collection!;\n\tconst id = params.id!;\n\n\tif (!emdash?.handleContentDelete || !emdash?.handleContentGet) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash is not initialized\", 500);\n\t}\n\n\t// Fetch item to check ownership\n\tconst existing = await emdash.handleContentGet(collection, id);\n\tif (!existing.success) {\n\t\treturn apiError(\n\t\t\texisting.error?.code ?? \"UNKNOWN_ERROR\",\n\t\t\texisting.error?.message ?? \"Unknown error\",\n\t\t\tmapErrorStatus(existing.error?.code),\n\t\t);\n\t}\n\n\tconst deleteData =\n\t\texisting.data && typeof existing.data === \"object\"\n\t\t\t? // eslint-disable-next-line typescript/no-unsafe-type-assertion -- handler returns unknown data; narrowed by typeof check above\n\t\t\t\t(existing.data as Record<string, unknown>)\n\t\t\t: undefined;\n\t// Handler returns { item, _rev } — extract the item for ownership and ID resolution\n\tconst deleteItem =\n\t\tdeleteData?.item && typeof deleteData.item === \"object\"\n\t\t\t? // eslint-disable-next-line typescript/no-unsafe-type-assertion -- narrowed by typeof check above\n\t\t\t\t(deleteData.item as Record<string, unknown>)\n\t\t\t: deleteData;\n\tconst authorId = typeof deleteItem?.authorId === \"string\" ? deleteItem.authorId : \"\";\n\tconst deleteDenied = requireOwnerPerm(user, authorId, \"content:delete_own\", \"content:delete_any\");\n\tif (deleteDenied) return deleteDenied;\n\n\t// Use the resolved ID (handles slug → ID resolution)\n\tconst resolvedId = typeof deleteItem?.id === \"string\" ? deleteItem.id : id;\n\n\tconst result = await emdash.handleContentDelete(collection, resolvedId);\n\n\tif (!result.success) return unwrapResult(result);\n\n\tif (cache?.enabled) await cache.invalidate({ tags: [collection, resolvedId] });\n\n\treturn unwrapResult(result);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA,MAAa,YAAY;AAEzB,MAAa,MAAgB,OAAO,EAAE,QAAQ,KAAK,aAAa;CAC/D,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,SAAS,YAAY,MAAM,eAAe;AAChD,KAAI,OAAQ,QAAO;CACnB,MAAM,aAAa,OAAO;CAC1B,MAAM,KAAK,OAAO;CAClB,MAAM,SAAS,IAAI,aAAa,IAAI,SAAS,IAAI;AAEjD,KAAI,CAAC,QAAQ,iBACZ,QAAO,SAAS,kBAAkB,6BAA6B,IAAI;CAGpE,MAAM,SAAS,MAAM,OAAO,iBAAiB,YAAY,IAAI,OAAO;AAIpE,KAAI,OAAO,WAAW,CAAC,cAAc,MAAM,sBAAsB,EAAE;EAClE,MAAM,OACL,OAAO,QAAQ,OAAO,OAAO,SAAS,WAEnC,OAAO,OACP;EACJ,MAAM,OACL,MAAM,QAAQ,OAAO,KAAK,SAAS,WAEhC,KAAK,OACL;AAEJ,OADe,OAAO,MAAM,WAAW,WAAW,KAAK,SAAS,UACjD,YACd,QAAO,SAAS,aAAa,2BAA2B,MAAM,IAAI;AAOnE,MAAI,MAAM;AACT,OAAI,KAAK,YAAY,OAAO,KAAK,aAAa,SAC7C,MAAK,OAAO,KAAK;AAElB,UAAO,KAAK;AACZ,UAAO,KAAK;;;AAId,QAAO,aAAa,OAAO;;AAG5B,MAAa,MAAgB,OAAO,EAAE,QAAQ,SAAS,QAAQ,YAAY;CAC1E,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,aAAa,OAAO;CAC1B,MAAM,KAAK,OAAO;CAClB,MAAM,OAAO,MAAM,UAAU,SAAS,kBAAkB;AACxD,KAAI,aAAa,KAAK,CAAE,QAAO;AAE/B,KAAI,CAAC,QAAQ,uBAAuB,CAAC,QAAQ,iBAC5C,QAAO,SAAS,kBAAkB,6BAA6B,IAAI;CAIpE,MAAM,WAAW,MAAM,OAAO,iBAAiB,YAAY,GAAG;AAC9D,KAAI,CAAC,SAAS,QACb,QAAO,SACN,SAAS,OAAO,QAAQ,iBACxB,SAAS,OAAO,WAAW,iBAC3B,eAAe,SAAS,OAAO,KAAK,CACpC;CAGF,MAAM,eACL,SAAS,QAAQ,OAAO,SAAS,SAAS,WAEvC,SAAS,OACT;CAEJ,MAAM,eACL,cAAc,QAAQ,OAAO,aAAa,SAAS,WAEhD,aAAa,OACb;CAEJ,MAAM,aAAa,iBAAiB,MADnB,OAAO,cAAc,aAAa,WAAW,aAAa,WAAW,IAClC,oBAAoB,mBAAmB;AAC3F,KAAI,WAAY,QAAO;AAGvB,KAAI,KAAK,gBAAgB,UAAa,CAAC,cAAc,MAAM,sBAAsB,CAChF,QAAO,SACN,aACA,+DACA,IACA;CAIF,MAAM,aAAa,OAAO,cAAc,OAAO,WAAW,aAAa,KAAK;CAK5E,MAAM,aADL,KAAK,aAAa,UAAa,QAAQ,cAAc,MAAM,mBAAmB,GAC1C,OAAO;EAAE,GAAG;EAAM,UAAU;EAAW;CAG5E,MAAM,SAAS,MAAM,OAAO,oBAAoB,YAAY,YAAY;EACvE,GAAG;EACH,MAAM,KAAK;EACX,CAAC;AAEF,KAAI,CAAC,OAAO,QAAS,QAAO,aAAa,OAAO;AAEhD,KAAI,OAAO,QAAS,OAAM,MAAM,WAAW,EAAE,MAAM,CAAC,YAAY,WAAW,EAAE,CAAC;AAE9E,QAAO,aAAa,OAAO;;AAG5B,MAAa,SAAmB,OAAO,EAAE,QAAQ,QAAQ,YAAY;CACpE,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,aAAa,OAAO;CAC1B,MAAM,KAAK,OAAO;AAElB,KAAI,CAAC,QAAQ,uBAAuB,CAAC,QAAQ,iBAC5C,QAAO,SAAS,kBAAkB,6BAA6B,IAAI;CAIpE,MAAM,WAAW,MAAM,OAAO,iBAAiB,YAAY,GAAG;AAC9D,KAAI,CAAC,SAAS,QACb,QAAO,SACN,SAAS,OAAO,QAAQ,iBACxB,SAAS,OAAO,WAAW,iBAC3B,eAAe,SAAS,OAAO,KAAK,CACpC;CAGF,MAAM,aACL,SAAS,QAAQ,OAAO,SAAS,SAAS,WAEvC,SAAS,OACT;CAEJ,MAAM,aACL,YAAY,QAAQ,OAAO,WAAW,SAAS,WAE5C,WAAW,OACX;CAEJ,MAAM,eAAe,iBAAiB,MADrB,OAAO,YAAY,aAAa,WAAW,WAAW,WAAW,IAC5B,sBAAsB,qBAAqB;AACjG,KAAI,aAAc,QAAO;CAGzB,MAAM,aAAa,OAAO,YAAY,OAAO,WAAW,WAAW,KAAK;CAExE,MAAM,SAAS,MAAM,OAAO,oBAAoB,YAAY,WAAW;AAEvE,KAAI,CAAC,OAAO,QAAS,QAAO,aAAa,OAAO;AAEhD,KAAI,OAAO,QAAS,OAAM,MAAM,WAAW,EAAE,MAAM,CAAC,YAAY,WAAW,EAAE,CAAC;AAE9E,QAAO,aAAa,OAAO"}
1
+ {"version":3,"file":"_id_.mjs","names":[],"sources":["../../../../../../src/astro/routes/api/content/[collection]/[id].ts"],"sourcesContent":["/**\n * Single content item endpoints - injected by EmDash integration\n *\n * GET /_emdash/api/content/{collection}/{id} - Get content\n * PUT /_emdash/api/content/{collection}/{id} - Update content\n * DELETE /_emdash/api/content/{collection}/{id} - Delete content\n */\n\nimport { hasPermission } from \"@emdash-cms/auth\";\nimport type { APIRoute } from \"astro\";\n\nimport { requirePerm, requireOwnerPerm } from \"#api/authorize.js\";\nimport { apiError, mapErrorStatus, unwrapResult } from \"#api/error.js\";\nimport { parseBody, isParseError } from \"#api/parse.js\";\nimport { contentUpdateBody } from \"#api/schemas.js\";\n\nexport const prerender = false;\n\nexport const GET: APIRoute = async ({ params, url, locals }) => {\n\tconst { emdash, user } = locals;\n\tconst denied = requirePerm(user, \"content:read\");\n\tif (denied) return denied;\n\tconst collection = params.collection!;\n\tconst id = params.id!;\n\tconst locale = url.searchParams.get(\"locale\") || undefined;\n\n\tif (!emdash?.handleContentGet) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash is not initialized\", 500);\n\t}\n\n\tconst result = await emdash.handleContentGet(collection, id, locale);\n\n\t// Hide non-published items from users without content:read_drafts. Return\n\t// 404 (not 403) so subscribers can't enumerate draft IDs by status code.\n\tif (result.success && !hasPermission(user, \"content:read_drafts\")) {\n\t\tconst data =\n\t\t\tresult.data && typeof result.data === \"object\"\n\t\t\t\t? // eslint-disable-next-line typescript/no-unsafe-type-assertion -- handler returns unknown data; narrowed by typeof check\n\t\t\t\t\t(result.data as Record<string, unknown>)\n\t\t\t\t: undefined;\n\t\tconst item =\n\t\t\tdata?.item && typeof data.item === \"object\"\n\t\t\t\t? // eslint-disable-next-line typescript/no-unsafe-type-assertion -- narrowed by typeof check\n\t\t\t\t\t(data.item as Record<string, unknown>)\n\t\t\t\t: undefined;\n\t\tconst status = typeof item?.status === \"string\" ? item.status : null;\n\t\tif (status !== \"published\") {\n\t\t\treturn apiError(\"NOT_FOUND\", `Content item not found: ${id}`, 404);\n\t\t}\n\n\t\t// Strip draft hydration data from response for users without read_drafts.\n\t\t// handleContentGet overlays draft revision data onto item.data and exposes\n\t\t// the published values in item.liveData. Without this, subscribers see\n\t\t// unpublished edits in the data field.\n\t\tif (item) {\n\t\t\tif (item.liveData && typeof item.liveData === \"object\") {\n\t\t\t\titem.data = item.liveData;\n\t\t\t}\n\t\t\tdelete item.liveData;\n\t\t\tdelete item.draftRevisionId;\n\t\t}\n\t}\n\n\treturn unwrapResult(result);\n};\n\nexport const PUT: APIRoute = async ({ params, request, locals, cache }) => {\n\tconst { emdash, user } = locals;\n\tconst collection = params.collection!;\n\tconst id = params.id!;\n\tconst locale = new URL(request.url).searchParams.get(\"locale\") || undefined;\n\tconst body = await parseBody(request, contentUpdateBody);\n\tif (isParseError(body)) return body;\n\n\tif (!emdash?.handleContentUpdate || !emdash?.handleContentGet) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash is not initialized\", 500);\n\t}\n\n\t// Fetch item to check ownership\n\tconst existing = await emdash.handleContentGet(collection, id, locale);\n\tif (!existing.success) {\n\t\treturn apiError(\n\t\t\texisting.error?.code ?? \"UNKNOWN_ERROR\",\n\t\t\texisting.error?.message ?? \"Unknown error\",\n\t\t\tmapErrorStatus(existing.error?.code),\n\t\t);\n\t}\n\n\tconst existingData =\n\t\texisting.data && typeof existing.data === \"object\"\n\t\t\t? // eslint-disable-next-line typescript/no-unsafe-type-assertion -- handler returns unknown data; narrowed by typeof check above\n\t\t\t\t(existing.data as Record<string, unknown>)\n\t\t\t: undefined;\n\t// Handler returns { item, _rev } — extract the item for ownership and ID resolution\n\tconst existingItem =\n\t\texistingData?.item && typeof existingData.item === \"object\"\n\t\t\t? // eslint-disable-next-line typescript/no-unsafe-type-assertion -- narrowed by typeof check above\n\t\t\t\t(existingData.item as Record<string, unknown>)\n\t\t\t: existingData;\n\tconst authorId = typeof existingItem?.authorId === \"string\" ? existingItem.authorId : \"\";\n\tconst editDenied = requireOwnerPerm(user, authorId, \"content:edit_own\", \"content:edit_any\");\n\tif (editDenied) return editDenied;\n\n\t// Only EDITOR+ can write publishedAt directly — incl. clearing to null.\n\tif (body.publishedAt !== undefined && !hasPermission(user, \"content:publish_any\")) {\n\t\treturn apiError(\n\t\t\t\"FORBIDDEN\",\n\t\t\t\"Writing publishedAt requires content:publish_any permission\",\n\t\t\t403,\n\t\t);\n\t}\n\n\t// Use the resolved ID (handles slug → ID resolution)\n\tconst resolvedId = typeof existingItem?.id === \"string\" ? existingItem.id : id;\n\n\t// Only allow authorId changes if user has content:edit_any permission (editor+)\n\tconst canChangeAuthor =\n\t\tbody.authorId !== undefined && user && hasPermission(user, \"content:edit_any\");\n\tconst updateBody = canChangeAuthor ? body : { ...body, authorId: undefined };\n\n\t// Pass _rev through for optimistic concurrency validation\n\tconst result = await emdash.handleContentUpdate(collection, resolvedId, {\n\t\t...updateBody,\n\t\tlocale,\n\t\t_rev: body._rev,\n\t});\n\n\tif (!result.success) return unwrapResult(result);\n\n\tif (cache?.enabled) await cache.invalidate({ tags: [collection, resolvedId] });\n\n\treturn unwrapResult(result);\n};\n\nexport const DELETE: APIRoute = async ({ params, locals, cache }) => {\n\tconst { emdash, user } = locals;\n\tconst collection = params.collection!;\n\tconst id = params.id!;\n\n\tif (!emdash?.handleContentDelete || !emdash?.handleContentGet) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash is not initialized\", 500);\n\t}\n\n\t// Fetch item to check ownership\n\tconst existing = await emdash.handleContentGet(collection, id);\n\tif (!existing.success) {\n\t\treturn apiError(\n\t\t\texisting.error?.code ?? \"UNKNOWN_ERROR\",\n\t\t\texisting.error?.message ?? \"Unknown error\",\n\t\t\tmapErrorStatus(existing.error?.code),\n\t\t);\n\t}\n\n\tconst deleteData =\n\t\texisting.data && typeof existing.data === \"object\"\n\t\t\t? // eslint-disable-next-line typescript/no-unsafe-type-assertion -- handler returns unknown data; narrowed by typeof check above\n\t\t\t\t(existing.data as Record<string, unknown>)\n\t\t\t: undefined;\n\t// Handler returns { item, _rev } — extract the item for ownership and ID resolution\n\tconst deleteItem =\n\t\tdeleteData?.item && typeof deleteData.item === \"object\"\n\t\t\t? // eslint-disable-next-line typescript/no-unsafe-type-assertion -- narrowed by typeof check above\n\t\t\t\t(deleteData.item as Record<string, unknown>)\n\t\t\t: deleteData;\n\tconst authorId = typeof deleteItem?.authorId === \"string\" ? deleteItem.authorId : \"\";\n\tconst deleteDenied = requireOwnerPerm(user, authorId, \"content:delete_own\", \"content:delete_any\");\n\tif (deleteDenied) return deleteDenied;\n\n\t// Use the resolved ID (handles slug → ID resolution)\n\tconst resolvedId = typeof deleteItem?.id === \"string\" ? deleteItem.id : id;\n\n\tconst result = await emdash.handleContentDelete(collection, resolvedId);\n\n\tif (!result.success) return unwrapResult(result);\n\n\tif (cache?.enabled) await cache.invalidate({ tags: [collection, resolvedId] });\n\n\treturn unwrapResult(result);\n};\n"],"mappings":"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"}
@@ -1,11 +1,11 @@
1
1
  import "../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../types-B0bmgwMG.mjs";
3
- import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../error-ChfADBuu.mjs";
4
- import { i as parseQuery, n as parseBody, t as isParseError } from "../../../../../parse-DHbXfvxO.mjs";
5
- import { $t as contentCreateBody, tn as contentListQuery } from "../../../../../redirects-COMLwsV5.mjs";
6
- import "../../../../../setup-Cf_TyOv5.mjs";
2
+ import "../../../../../types-SF1DwGf2.mjs";
3
+ import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../error-npZWBSb7.mjs";
4
+ import { i as parseQuery, n as parseBody, t as isParseError } from "../../../../../parse-4zO5Y2DL.mjs";
5
+ import { $t as contentCreateBody, tn as contentListQuery } from "../../../../../redirects-C0L9JUk4.mjs";
6
+ import "../../../../../byline-fields-Dr-xcb6S.mjs";
7
7
  import "../../../../../api/schemas/index.mjs";
8
- import { n as requirePerm, t as requireOwnerPerm } from "../../../../../authorize-Bn4S4DUT.mjs";
8
+ import { n as requirePerm, t as requireOwnerPerm } from "../../../../../authorize-_wWM_44T.mjs";
9
9
  import { hasPermission } from "@emdash-cms/auth";
10
10
 
11
11
  //#region src/astro/routes/api/content/[collection]/index.ts
@@ -1,11 +1,11 @@
1
1
  import "../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../types-B0bmgwMG.mjs";
3
- import { a as unwrapResult, t as apiError } from "../../../../../error-ChfADBuu.mjs";
4
- import { i as parseQuery, t as isParseError } from "../../../../../parse-DHbXfvxO.mjs";
5
- import { fn as contentTrashQuery } from "../../../../../redirects-COMLwsV5.mjs";
6
- import "../../../../../setup-Cf_TyOv5.mjs";
2
+ import "../../../../../types-SF1DwGf2.mjs";
3
+ import { a as unwrapResult, t as apiError } from "../../../../../error-npZWBSb7.mjs";
4
+ import { i as parseQuery, t as isParseError } from "../../../../../parse-4zO5Y2DL.mjs";
5
+ import { fn as contentTrashQuery } from "../../../../../redirects-C0L9JUk4.mjs";
6
+ import "../../../../../byline-fields-Dr-xcb6S.mjs";
7
7
  import "../../../../../api/schemas/index.mjs";
8
- import { n as requirePerm } from "../../../../../authorize-Bn4S4DUT.mjs";
8
+ import { n as requirePerm } from "../../../../../authorize-_wWM_44T.mjs";
9
9
 
10
10
  //#region src/astro/routes/api/content/[collection]/trash.ts
11
11
  const prerender = false;
@@ -1,11 +1,11 @@
1
- import "../../../content-8voQNTXX.mjs";
1
+ import "../../../content-BbqKo3Kc.mjs";
2
2
  import "../../../base64-CqR-7kqF.mjs";
3
- import "../../../types-B0bmgwMG.mjs";
4
- import "../../../media-CKQd8AYU.mjs";
5
- import "../../../user-hUSOaIJy.mjs";
6
- import { t as handleDashboardStats } from "../../../dashboard-BeaFSPpx.mjs";
7
- import { a as unwrapResult, r as handleError, t as apiError } from "../../../error-ChfADBuu.mjs";
8
- import { n as requirePerm } from "../../../authorize-Bn4S4DUT.mjs";
3
+ import "../../../types-SF1DwGf2.mjs";
4
+ import "../../../media-jk_HzzOl.mjs";
5
+ import "../../../user-X4rtyO4Y.mjs";
6
+ import { t as handleDashboardStats } from "../../../dashboard-BwIX9r-X.mjs";
7
+ import { a as unwrapResult, r as handleError, t as apiError } from "../../../error-npZWBSb7.mjs";
8
+ import { n as requirePerm } from "../../../authorize-_wWM_44T.mjs";
9
9
 
10
10
  //#region src/astro/routes/api/dashboard.ts
11
11
  const prerender = false;
@@ -1,7 +1,7 @@
1
1
  import "../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../types-B0bmgwMG.mjs";
3
- import { n as apiSuccess, t as apiError } from "../../../../error-ChfADBuu.mjs";
4
- import { i as getDevEmails, n as clearDevEmails } from "../../../../email-console-CubRll9q.mjs";
2
+ import "../../../../types-SF1DwGf2.mjs";
3
+ import { n as apiSuccess, t as apiError } from "../../../../error-npZWBSb7.mjs";
4
+ import { i as getDevEmails, n as clearDevEmails } from "../../../../email-console-DHT2Fbpj.mjs";
5
5
 
6
6
  //#region src/astro/routes/api/dev/emails.ts
7
7
  const prerender = false;
@@ -1,6 +1,6 @@
1
- import "../../../../types-DaqNzqVt.mjs";
2
- import "../../../../index-CC42STEm.mjs";
3
- import { g as ProbeResult } from "../../../../types-bYmRn_Uy.mjs";
1
+ import "../../../../types-DawhLFwy.mjs";
2
+ import "../../../../index-D60_SzHG.mjs";
3
+ import { g as ProbeResult } from "../../../../types-DWnN7weG.mjs";
4
4
  import { APIRoute } from "astro";
5
5
 
6
6
  //#region src/astro/routes/api/import/probe.d.ts
@@ -1,15 +1,15 @@
1
1
  import "../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../types-B0bmgwMG.mjs";
3
- import { t as SsrfError } from "../../../../ssrf-MZ-zrG6-.mjs";
4
- import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-ChfADBuu.mjs";
5
- import { n as parseBody, t as isParseError } from "../../../../parse-DHbXfvxO.mjs";
6
- import "../../../../redirects-COMLwsV5.mjs";
7
- import { o as importProbeBody } from "../../../../setup-Cf_TyOv5.mjs";
2
+ import "../../../../types-SF1DwGf2.mjs";
3
+ import { t as SsrfError } from "../../../../ssrf-BsVGIE0Z.mjs";
4
+ import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-npZWBSb7.mjs";
5
+ import { n as parseBody, t as isParseError } from "../../../../parse-4zO5Y2DL.mjs";
6
+ import "../../../../redirects-C0L9JUk4.mjs";
7
+ import { f as importProbeBody } from "../../../../byline-fields-Dr-xcb6S.mjs";
8
8
  import "../../../../api/schemas/index.mjs";
9
- import { l as probeUrl } from "../../../../import-DG80rC_I.mjs";
10
- import "../../../../ssrf-BIcd-aXW.mjs";
11
- import "../../../../utils-C3wTAP-P.mjs";
12
- import { n as requirePerm } from "../../../../authorize-Bn4S4DUT.mjs";
9
+ import { l as probeUrl } from "../../../../import-Dh8bWmyq.mjs";
10
+ import "../../../../ssrf-BvgVcfNQ.mjs";
11
+ import "../../../../utils-C4Ih4DML.mjs";
12
+ import { n as requirePerm } from "../../../../authorize-_wWM_44T.mjs";
13
13
 
14
14
  //#region src/astro/routes/api/import/probe.ts
15
15
  const prerender = false;
@@ -1,8 +1,8 @@
1
1
  import "../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../types-B0bmgwMG.mjs";
3
- import { r as RESERVED_COLLECTION_SLUGS } from "../../../../../types-DSZl1Dsv.mjs";
4
- import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-ChfADBuu.mjs";
5
- import { n as requirePerm } from "../../../../../authorize-Bn4S4DUT.mjs";
2
+ import "../../../../../types-SF1DwGf2.mjs";
3
+ import { a as RESERVED_COLLECTION_SLUGS } from "../../../../../types-D8bhH891.mjs";
4
+ import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-npZWBSb7.mjs";
5
+ import { n as requirePerm } from "../../../../../authorize-_wWM_44T.mjs";
6
6
  import mime from "mime/lite";
7
7
  import { SchemaRegistry, parseWxrString } from "emdash";
8
8