emdash 0.14.0 → 0.16.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 (650) hide show
  1. package/dist/{adapters-9DybjTO6.d.mts → adapters-C4yd_UJR.d.mts} +1 -1
  2. package/dist/{adapters-9DybjTO6.d.mts.map → adapters-C4yd_UJR.d.mts.map} +1 -1
  3. package/dist/{allowed-origins-CDdG-4Gd.mjs → allowed-origins-D0fFk9a6.mjs} +2 -2
  4. package/dist/{allowed-origins-CDdG-4Gd.mjs.map → allowed-origins-D0fFk9a6.mjs.map} +1 -1
  5. package/dist/api/route-utils.d.mts +3 -3
  6. package/dist/api/route-utils.mjs +15 -15
  7. package/dist/api/schemas/index.d.mts +2 -2
  8. package/dist/api/schemas/index.mjs +3 -3
  9. package/dist/{api-BMLZuwM4.mjs → api-BNKqxyFX.mjs} +560 -56
  10. package/dist/api-BNKqxyFX.mjs.map +1 -0
  11. package/dist/{api-tokens-eYymBhIT.mjs → api-tokens-ucpcNXDt.mjs} +2 -2
  12. package/dist/{api-tokens-eYymBhIT.mjs.map → api-tokens-ucpcNXDt.mjs.map} +1 -1
  13. package/dist/{apply-v4DBgjPw.mjs → apply-BOPaD-s9.mjs} +17 -17
  14. package/dist/{apply-v4DBgjPw.mjs.map → apply-BOPaD-s9.mjs.map} +1 -1
  15. package/dist/astro/index.d.mts +10 -10
  16. package/dist/astro/index.d.mts.map +1 -1
  17. package/dist/astro/index.mjs +53 -5
  18. package/dist/astro/index.mjs.map +1 -1
  19. package/dist/astro/middleware/auth.d.mts +9 -9
  20. package/dist/astro/middleware/auth.mjs +6 -6
  21. package/dist/astro/middleware/auth.mjs.map +1 -1
  22. package/dist/astro/middleware/redirect.mjs +4 -4
  23. package/dist/astro/middleware/request-context.mjs +3 -3
  24. package/dist/astro/middleware/request-context.mjs.map +1 -1
  25. package/dist/astro/middleware/setup.mjs +1 -1
  26. package/dist/astro/middleware.d.mts.map +1 -1
  27. package/dist/astro/middleware.mjs +377 -75
  28. package/dist/astro/middleware.mjs.map +1 -1
  29. package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +5 -5
  30. package/dist/astro/routes/api/admin/allowed-domains/index.mjs +5 -5
  31. package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +4 -4
  32. package/dist/astro/routes/api/admin/api-tokens/index.mjs +5 -5
  33. package/dist/astro/routes/api/admin/bylines/_id_/index.d.mts.map +1 -1
  34. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +14 -17
  35. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs.map +1 -1
  36. package/dist/astro/routes/api/admin/bylines/_id_/translations.d.mts +9 -0
  37. package/dist/astro/routes/api/admin/bylines/_id_/translations.d.mts.map +1 -0
  38. package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +70 -0
  39. package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs.map +1 -0
  40. package/dist/astro/routes/api/admin/bylines/index.d.mts.map +1 -1
  41. package/dist/astro/routes/api/admin/bylines/index.mjs +25 -16
  42. package/dist/astro/routes/api/admin/bylines/index.mjs.map +1 -1
  43. package/dist/astro/routes/api/admin/comments/_id_/status.mjs +10 -10
  44. package/dist/astro/routes/api/admin/comments/_id_.mjs +5 -5
  45. package/dist/astro/routes/api/admin/comments/bulk.mjs +8 -8
  46. package/dist/astro/routes/api/admin/comments/counts.mjs +5 -5
  47. package/dist/astro/routes/api/admin/comments/index.mjs +8 -8
  48. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +4 -4
  49. package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +3 -3
  50. package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +4 -4
  51. package/dist/astro/routes/api/admin/oauth-clients/index.mjs +4 -4
  52. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +33 -32
  53. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs.map +1 -1
  54. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +33 -32
  55. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs.map +1 -1
  56. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +32 -31
  57. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs.map +1 -1
  58. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +32 -31
  59. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs.map +1 -1
  60. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +34 -32
  61. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs.map +1 -1
  62. package/dist/astro/routes/api/admin/plugins/index.mjs +32 -31
  63. package/dist/astro/routes/api/admin/plugins/index.mjs.map +1 -1
  64. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +3 -3
  65. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +32 -31
  66. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs.map +1 -1
  67. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +34 -32
  68. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs.map +1 -1
  69. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +32 -31
  70. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs.map +1 -1
  71. package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.d.mts +8 -0
  72. package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.d.mts.map +1 -0
  73. package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs +59 -0
  74. package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs.map +1 -0
  75. package/dist/astro/routes/api/admin/plugins/registry/_id_/update.d.mts +8 -0
  76. package/dist/astro/routes/api/admin/plugins/registry/_id_/update.d.mts.map +1 -0
  77. package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs +85 -0
  78. package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs.map +1 -0
  79. package/dist/astro/routes/api/admin/plugins/registry/artifact.d.mts +8 -0
  80. package/dist/astro/routes/api/admin/plugins/registry/artifact.d.mts.map +1 -0
  81. package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs +301 -0
  82. package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs.map +1 -0
  83. package/dist/astro/routes/api/admin/plugins/registry/install.d.mts.map +1 -1
  84. package/dist/astro/routes/api/admin/plugins/registry/install.mjs +51 -32
  85. package/dist/astro/routes/api/admin/plugins/registry/install.mjs.map +1 -1
  86. package/dist/astro/routes/api/admin/plugins/updates.d.mts.map +1 -1
  87. package/dist/astro/routes/api/admin/plugins/updates.mjs +45 -32
  88. package/dist/astro/routes/api/admin/plugins/updates.mjs.map +1 -1
  89. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +32 -31
  90. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs.map +1 -1
  91. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +3 -3
  92. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +32 -31
  93. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs.map +1 -1
  94. package/dist/astro/routes/api/admin/users/_id_/disable.mjs +2 -2
  95. package/dist/astro/routes/api/admin/users/_id_/enable.mjs +2 -2
  96. package/dist/astro/routes/api/admin/users/_id_/index.mjs +5 -5
  97. package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +3 -3
  98. package/dist/astro/routes/api/admin/users/index.mjs +5 -5
  99. package/dist/astro/routes/api/auth/dev-bypass.mjs +5 -5
  100. package/dist/astro/routes/api/auth/invite/accept.mjs +2 -2
  101. package/dist/astro/routes/api/auth/invite/complete.mjs +9 -9
  102. package/dist/astro/routes/api/auth/invite/index.mjs +6 -6
  103. package/dist/astro/routes/api/auth/invite/register-options.mjs +8 -8
  104. package/dist/astro/routes/api/auth/logout.mjs +3 -3
  105. package/dist/astro/routes/api/auth/magic-link/send.mjs +8 -8
  106. package/dist/astro/routes/api/auth/magic-link/verify.mjs +3 -3
  107. package/dist/astro/routes/api/auth/me.mjs +5 -5
  108. package/dist/astro/routes/api/auth/mode.mjs +1 -1
  109. package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +3 -3
  110. package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs.map +1 -1
  111. package/dist/astro/routes/api/auth/oauth/_provider_.mjs +2 -2
  112. package/dist/astro/routes/api/auth/oauth/_provider_.mjs.map +1 -1
  113. package/dist/astro/routes/api/auth/passkey/_id_.mjs +5 -5
  114. package/dist/astro/routes/api/auth/passkey/index.mjs +2 -2
  115. package/dist/astro/routes/api/auth/passkey/options.mjs +10 -10
  116. package/dist/astro/routes/api/auth/passkey/register/options.mjs +8 -8
  117. package/dist/astro/routes/api/auth/passkey/register/verify.mjs +9 -9
  118. package/dist/astro/routes/api/auth/passkey/verify.mjs +9 -9
  119. package/dist/astro/routes/api/auth/signup/complete.mjs +9 -9
  120. package/dist/astro/routes/api/auth/signup/request.mjs +8 -8
  121. package/dist/astro/routes/api/auth/signup/verify.mjs +2 -2
  122. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +11 -11
  123. package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +3 -3
  124. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +3 -3
  125. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs.map +1 -1
  126. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +3 -3
  127. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs.map +1 -1
  128. package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +3 -3
  129. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +9 -9
  130. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +6 -6
  131. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs.map +1 -1
  132. package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +3 -3
  133. package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs.map +1 -1
  134. package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +3 -3
  135. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +6 -6
  136. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs.map +1 -1
  137. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +10 -9
  138. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs.map +1 -1
  139. package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +3 -3
  140. package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs.map +1 -1
  141. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +3 -3
  142. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs.map +1 -1
  143. package/dist/astro/routes/api/content/_collection_/_id_.mjs +6 -6
  144. package/dist/astro/routes/api/content/_collection_/_id_.mjs.map +1 -1
  145. package/dist/astro/routes/api/content/_collection_/index.mjs +6 -6
  146. package/dist/astro/routes/api/content/_collection_/trash.mjs +6 -6
  147. package/dist/astro/routes/api/dashboard.mjs +7 -7
  148. package/dist/astro/routes/api/dev/emails.mjs +3 -3
  149. package/dist/astro/routes/api/import/probe.d.mts +3 -3
  150. package/dist/astro/routes/api/import/probe.mjs +10 -10
  151. package/dist/astro/routes/api/import/wordpress/analyze.mjs +3 -3
  152. package/dist/astro/routes/api/import/wordpress/execute.d.mts +9 -9
  153. package/dist/astro/routes/api/import/wordpress/execute.mjs +9 -8
  154. package/dist/astro/routes/api/import/wordpress/execute.mjs.map +1 -1
  155. package/dist/astro/routes/api/import/wordpress/media.mjs +8 -8
  156. package/dist/astro/routes/api/import/wordpress/prepare.mjs +8 -8
  157. package/dist/astro/routes/api/import/wordpress/prepare.mjs.map +1 -1
  158. package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.d.mts +11 -1
  159. package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.d.mts.map +1 -1
  160. package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.mjs +17 -1
  161. package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.mjs.map +1 -1
  162. package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts.map +1 -1
  163. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +9 -9
  164. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs.map +1 -1
  165. package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
  166. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +10 -10
  167. package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +1 -1
  168. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +11 -11
  169. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs.map +1 -1
  170. package/dist/astro/routes/api/manifest.mjs +4 -4
  171. package/dist/astro/routes/api/mcp.mjs +29 -29
  172. package/dist/astro/routes/api/mcp.mjs.map +1 -1
  173. package/dist/astro/routes/api/media/_id_/confirm.mjs +6 -6
  174. package/dist/astro/routes/api/media/_id_.mjs +6 -6
  175. package/dist/astro/routes/api/media/file/_...key_.mjs +2 -2
  176. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +3 -3
  177. package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +3 -3
  178. package/dist/astro/routes/api/media/providers/index.mjs +3 -3
  179. package/dist/astro/routes/api/media/upload-url.mjs +7 -7
  180. package/dist/astro/routes/api/media/upload-url.mjs.map +1 -1
  181. package/dist/astro/routes/api/media.mjs +8 -8
  182. package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +7 -7
  183. package/dist/astro/routes/api/menus/_name_/items.mjs +7 -7
  184. package/dist/astro/routes/api/menus/_name_/reorder.mjs +7 -7
  185. package/dist/astro/routes/api/menus/_name_/translations.mjs +7 -7
  186. package/dist/astro/routes/api/menus/_name_.mjs +7 -7
  187. package/dist/astro/routes/api/menus/index.mjs +7 -7
  188. package/dist/astro/routes/api/oauth/authorize.mjs +6 -6
  189. package/dist/astro/routes/api/oauth/device/authorize.mjs +6 -6
  190. package/dist/astro/routes/api/oauth/device/code.mjs +9 -9
  191. package/dist/astro/routes/api/oauth/device/token.mjs +8 -8
  192. package/dist/astro/routes/api/oauth/register.mjs +3 -3
  193. package/dist/astro/routes/api/oauth/token/refresh.mjs +6 -6
  194. package/dist/astro/routes/api/oauth/token/revoke.mjs +6 -6
  195. package/dist/astro/routes/api/oauth/token.mjs +6 -6
  196. package/dist/astro/routes/api/openapi.json.mjs +3 -3
  197. package/dist/astro/routes/api/openapi.json.mjs.map +1 -1
  198. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +4 -4
  199. package/dist/astro/routes/api/redirects/404s/index.mjs +8 -8
  200. package/dist/astro/routes/api/redirects/404s/index.mjs.map +1 -1
  201. package/dist/astro/routes/api/redirects/404s/summary.mjs +8 -8
  202. package/dist/astro/routes/api/redirects/404s/summary.mjs.map +1 -1
  203. package/dist/astro/routes/api/redirects/_id_.mjs +9 -9
  204. package/dist/astro/routes/api/redirects/_id_.mjs.map +1 -1
  205. package/dist/astro/routes/api/redirects/index.mjs +9 -9
  206. package/dist/astro/routes/api/redirects/index.mjs.map +1 -1
  207. package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +3 -3
  208. package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +3 -3
  209. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +32 -31
  210. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs.map +1 -1
  211. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +32 -31
  212. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs.map +1 -1
  213. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +32 -31
  214. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs.map +1 -1
  215. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +32 -31
  216. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs.map +1 -1
  217. package/dist/astro/routes/api/schema/collections/index.mjs +32 -31
  218. package/dist/astro/routes/api/schema/collections/index.mjs.map +1 -1
  219. package/dist/astro/routes/api/schema/index.mjs +6 -6
  220. package/dist/astro/routes/api/schema/index.mjs.map +1 -1
  221. package/dist/astro/routes/api/schema/orphans/_slug_.mjs +32 -31
  222. package/dist/astro/routes/api/schema/orphans/_slug_.mjs.map +1 -1
  223. package/dist/astro/routes/api/schema/orphans/index.mjs +32 -31
  224. package/dist/astro/routes/api/schema/orphans/index.mjs.map +1 -1
  225. package/dist/astro/routes/api/search/enable.mjs +9 -9
  226. package/dist/astro/routes/api/search/index.mjs +8 -8
  227. package/dist/astro/routes/api/search/rebuild.mjs +9 -9
  228. package/dist/astro/routes/api/search/stats.mjs +6 -6
  229. package/dist/astro/routes/api/search/suggest.mjs +8 -8
  230. package/dist/astro/routes/api/sections/_slug_.mjs +8 -8
  231. package/dist/astro/routes/api/sections/_slug_.mjs.map +1 -1
  232. package/dist/astro/routes/api/sections/index.mjs +8 -8
  233. package/dist/astro/routes/api/sections/index.mjs.map +1 -1
  234. package/dist/astro/routes/api/settings/email.mjs +4 -4
  235. package/dist/astro/routes/api/settings.mjs +10 -10
  236. package/dist/astro/routes/api/setup/admin-verify.mjs +10 -10
  237. package/dist/astro/routes/api/setup/admin.mjs +9 -9
  238. package/dist/astro/routes/api/setup/dev-bypass.mjs +22 -22
  239. package/dist/astro/routes/api/setup/dev-reset.mjs +2 -2
  240. package/dist/astro/routes/api/setup/index.mjs +22 -22
  241. package/dist/astro/routes/api/setup/status.mjs +4 -4
  242. package/dist/astro/routes/api/snapshot.mjs +6 -6
  243. package/dist/astro/routes/api/snapshot.mjs.map +1 -1
  244. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +11 -10
  245. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs.map +1 -1
  246. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +11 -10
  247. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs.map +1 -1
  248. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +11 -10
  249. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs.map +1 -1
  250. package/dist/astro/routes/api/taxonomies/index.mjs +11 -10
  251. package/dist/astro/routes/api/taxonomies/index.mjs.map +1 -1
  252. package/dist/astro/routes/api/themes/preview.mjs +5 -5
  253. package/dist/astro/routes/api/typegen.mjs +5 -5
  254. package/dist/astro/routes/api/well-known/auth.mjs +1 -1
  255. package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +2 -2
  256. package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +2 -2
  257. package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +6 -6
  258. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +8 -8
  259. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +8 -8
  260. package/dist/astro/routes/api/widget-areas/_name_.mjs +5 -5
  261. package/dist/astro/routes/api/widget-areas/index.mjs +8 -8
  262. package/dist/astro/routes/api/widget-components.mjs +3 -3
  263. package/dist/astro/routes/robots.txt.mjs +5 -5
  264. package/dist/astro/routes/sitemap-_collection_.xml.d.mts.map +1 -1
  265. package/dist/astro/routes/sitemap-_collection_.xml.mjs +58 -13
  266. package/dist/astro/routes/sitemap-_collection_.xml.mjs.map +1 -1
  267. package/dist/astro/routes/sitemap.xml.mjs +6 -6
  268. package/dist/astro/types.d.mts +20 -12
  269. package/dist/astro/types.d.mts.map +1 -1
  270. package/dist/auth/providers/github.d.mts +1 -1
  271. package/dist/auth/providers/google.d.mts +1 -1
  272. package/dist/{authorize-BlyCH-96.mjs → authorize-Bn4S4DUT.mjs} +2 -2
  273. package/dist/{authorize-BlyCH-96.mjs.map → authorize-Bn4S4DUT.mjs.map} +1 -1
  274. package/dist/byline-BDylH_m4.mjs +404 -0
  275. package/dist/byline-BDylH_m4.mjs.map +1 -0
  276. package/dist/{bylines-BdUP8NuI.d.mts → bylines-B2_XmnSU.d.mts} +73 -28
  277. package/dist/bylines-B2_XmnSU.d.mts.map +1 -0
  278. package/dist/bylines-B7TFEvFf.mjs +118 -0
  279. package/dist/bylines-B7TFEvFf.mjs.map +1 -0
  280. package/dist/bylines-n6nykUyI.mjs +174 -0
  281. package/dist/bylines-n6nykUyI.mjs.map +1 -0
  282. package/dist/{cache-CXCpjWiL.mjs → cache-BcI1yUjR.mjs} +2 -2
  283. package/dist/{cache-CXCpjWiL.mjs.map → cache-BcI1yUjR.mjs.map} +1 -1
  284. package/dist/{challenge-store-CJ0OOHOr.mjs → challenge-store-Dng1SxKT.mjs} +1 -1
  285. package/dist/{challenge-store-CJ0OOHOr.mjs.map → challenge-store-Dng1SxKT.mjs.map} +1 -1
  286. package/dist/{chunks-DyGtu1Bv.mjs → chunks-cYG4SnIP.mjs} +2 -2
  287. package/dist/{chunks-DyGtu1Bv.mjs.map → chunks-cYG4SnIP.mjs.map} +1 -1
  288. package/dist/cli/index.mjs +68 -30
  289. package/dist/cli/index.mjs.map +1 -1
  290. package/dist/client/cf-access.d.mts +1 -1
  291. package/dist/client/index.d.mts +1 -1
  292. package/dist/client/index.mjs +1 -1
  293. package/dist/client/index.mjs.map +1 -1
  294. package/dist/{comment-Dd9MI82-.mjs → comment-C76G-9tz.mjs} +2 -2
  295. package/dist/{comment-Dd9MI82-.mjs.map → comment-C76G-9tz.mjs.map} +1 -1
  296. package/dist/{comments-koGI0FrK.mjs → comments-CCxFFGY1.mjs} +3 -3
  297. package/dist/{comments-koGI0FrK.mjs.map → comments-CCxFFGY1.mjs.map} +1 -1
  298. package/dist/{components-mZem7pbe.mjs → components-Dx3DM0gg.mjs} +1 -1
  299. package/dist/{components-mZem7pbe.mjs.map → components-Dx3DM0gg.mjs.map} +1 -1
  300. package/dist/config-CVssduLe.mjs.map +1 -1
  301. package/dist/{content-D6YG26WG.mjs → content-8voQNTXX.mjs} +3 -3
  302. package/dist/{content-D6YG26WG.mjs.map → content-8voQNTXX.mjs.map} +1 -1
  303. package/dist/{context-qF8d3IPR.mjs → context-B7qiYrz2.mjs} +10 -10
  304. package/dist/context-B7qiYrz2.mjs.map +1 -0
  305. package/dist/{cron-H8eJ46dv.mjs → cron-Bd3b3iuj.mjs} +1 -1
  306. package/dist/{cron-H8eJ46dv.mjs.map → cron-Bd3b3iuj.mjs.map} +1 -1
  307. package/dist/{dashboard-BmWSIUwY.mjs → dashboard-BeaFSPpx.mjs} +4 -4
  308. package/dist/{dashboard-BmWSIUwY.mjs.map → dashboard-BeaFSPpx.mjs.map} +1 -1
  309. package/dist/db/index.d.mts +3 -3
  310. package/dist/db/index.mjs +1 -1
  311. package/dist/db/libsql.d.mts +1 -1
  312. package/dist/db/postgres.d.mts +1 -1
  313. package/dist/db/sqlite.d.mts +1 -1
  314. package/dist/db/sqlite.mjs +1 -1
  315. package/dist/{db-errors-CGN9kJfo.mjs → db-errors-BiYqoX-n.mjs} +14 -2
  316. package/dist/db-errors-BiYqoX-n.mjs.map +1 -0
  317. package/dist/{default-Dbs22Gg4.mjs → default-BvTAYCzx.mjs} +1 -1
  318. package/dist/{default-Dbs22Gg4.mjs.map → default-BvTAYCzx.mjs.map} +1 -1
  319. package/dist/{device-flow-BqJRxa0Q.mjs → device-flow-B9oG8PwP.mjs} +4 -4
  320. package/dist/{device-flow-BqJRxa0Q.mjs.map → device-flow-B9oG8PwP.mjs.map} +1 -1
  321. package/dist/{email-console-Dmp5Q-P2.mjs → email-console-CubRll9q.mjs} +1 -1
  322. package/dist/email-console-CubRll9q.mjs.map +1 -0
  323. package/dist/{error-tSQWIl5U.mjs → error-ChfADBuu.mjs} +19 -9
  324. package/dist/error-ChfADBuu.mjs.map +1 -0
  325. package/dist/errors-9P_FDrJ_.mjs +17 -0
  326. package/dist/errors-9P_FDrJ_.mjs.map +1 -0
  327. package/dist/{escape-B8bdIryO.mjs → escape-Cg6kMELH.mjs} +1 -1
  328. package/dist/{escape-B8bdIryO.mjs.map → escape-Cg6kMELH.mjs.map} +1 -1
  329. package/dist/{fts-manager-B633C-kQ.mjs → fts-manager-C_b-4x8u.mjs} +2 -2
  330. package/dist/{fts-manager-B633C-kQ.mjs.map → fts-manager-C_b-4x8u.mjs.map} +1 -1
  331. package/dist/{import-CNfLOgDE.mjs → import-DG80rC_I.mjs} +3 -3
  332. package/dist/{import-CNfLOgDE.mjs.map → import-DG80rC_I.mjs.map} +1 -1
  333. package/dist/{index-BV8iJ-6s.d.mts → index-BPZFAcgE.d.mts} +384 -123
  334. package/dist/index-BPZFAcgE.d.mts.map +1 -0
  335. package/dist/{index-D2gvztOP.d.mts → index-CC42STEm.d.mts} +3 -3
  336. package/dist/{index-D2gvztOP.d.mts.map → index-CC42STEm.d.mts.map} +1 -1
  337. package/dist/index.d.mts +17 -17
  338. package/dist/index.mjs +53 -52
  339. package/dist/{load-QzYRpVN3.mjs → load-CLFRjk9r.mjs} +2 -2
  340. package/dist/{load-QzYRpVN3.mjs.map → load-CLFRjk9r.mjs.map} +1 -1
  341. package/dist/{loader-Cs6-Bqe6.mjs → loader-D-vIJjfY.mjs} +86 -46
  342. package/dist/loader-D-vIJjfY.mjs.map +1 -0
  343. package/dist/{manifest-schema-HCtSh4Jq.mjs → manifest-schema-Czqf0TLu.mjs} +1 -1
  344. package/dist/{manifest-schema-HCtSh4Jq.mjs.map → manifest-schema-Czqf0TLu.mjs.map} +1 -1
  345. package/dist/media/index.d.mts +1 -1
  346. package/dist/media/local-runtime.d.mts +11 -11
  347. package/dist/media/local-runtime.mjs +4 -4
  348. package/dist/{media-Dg7he9uK.mjs → media-CKQd8AYU.mjs} +2 -2
  349. package/dist/media-CKQd8AYU.mjs.map +1 -0
  350. package/dist/{media-allowlist-B8EX01DH.mjs → media-allowlist-BNloC69x.mjs} +1 -1
  351. package/dist/{media-allowlist-B8EX01DH.mjs.map → media-allowlist-BNloC69x.mjs.map} +1 -1
  352. package/dist/{menus-X4Z-eBA1.mjs → menus-C-nWT5Tu.mjs} +42 -17
  353. package/dist/menus-C-nWT5Tu.mjs.map +1 -0
  354. package/dist/{menus-DOzIecHi.mjs → menus-arUNspyU.mjs} +2 -2
  355. package/dist/menus-arUNspyU.mjs.map +1 -0
  356. package/dist/mime-KV5TqkMN.mjs.map +1 -1
  357. package/dist/{mode-DPRPvJYm.mjs → mode-CaaiebZI.mjs} +1 -1
  358. package/dist/{mode-DPRPvJYm.mjs.map → mode-CaaiebZI.mjs.map} +1 -1
  359. package/dist/{oauth-authorization-62GmpGIH.mjs → oauth-authorization-CTMeVfvj.mjs} +4 -4
  360. package/dist/{oauth-authorization-62GmpGIH.mjs.map → oauth-authorization-CTMeVfvj.mjs.map} +1 -1
  361. package/dist/{oauth-clients-D_B0_-Bz.mjs → oauth-clients-eJCbkVSG.mjs} +1 -1
  362. package/dist/oauth-clients-eJCbkVSG.mjs.map +1 -0
  363. package/dist/{oauth-state-store-DpsZViTu.mjs → oauth-state-store-vOSdOeGe.mjs} +1 -1
  364. package/dist/{oauth-state-store-DpsZViTu.mjs.map → oauth-state-store-vOSdOeGe.mjs.map} +1 -1
  365. package/dist/{oauth-user-lookup-meyS2oB1.mjs → oauth-user-lookup-3JwsVw6N.mjs} +1 -1
  366. package/dist/{oauth-user-lookup-meyS2oB1.mjs.map → oauth-user-lookup-3JwsVw6N.mjs.map} +1 -1
  367. package/dist/options-BL4X94qY.mjs.map +1 -1
  368. package/dist/{options-Cq64Wx0O.d.mts → options-DhV-gwJb.d.mts} +4 -4
  369. package/dist/options-DhV-gwJb.d.mts.map +1 -0
  370. package/dist/page/index.d.mts +2 -2
  371. package/dist/{parse-BFTPon-J.mjs → parse-DHbXfvxO.mjs} +2 -2
  372. package/dist/{parse-BFTPon-J.mjs.map → parse-DHbXfvxO.mjs.map} +1 -1
  373. package/dist/{passkey-config-Cg86_ISa.mjs → passkey-config-BloQOT3y.mjs} +1 -1
  374. package/dist/{passkey-config-Cg86_ISa.mjs.map → passkey-config-BloQOT3y.mjs.map} +1 -1
  375. package/dist/{placeholder-D3cFCU9y.d.mts → placeholder-KCkkCtgQ.d.mts} +1 -1
  376. package/dist/{placeholder-D3cFCU9y.d.mts.map → placeholder-KCkkCtgQ.d.mts.map} +1 -1
  377. package/dist/plugin-types.d.mts +1 -1
  378. package/dist/plugin-utils.d.mts +25 -10
  379. package/dist/plugin-utils.d.mts.map +1 -1
  380. package/dist/plugin-utils.mjs +11 -10
  381. package/dist/plugin-utils.mjs.map +1 -1
  382. package/dist/plugins/adapt-sandbox-entry.d.mts +9 -9
  383. package/dist/plugins/adapt-sandbox-entry.d.mts.map +1 -1
  384. package/dist/plugins/adapt-sandbox-entry.mjs +26 -15
  385. package/dist/plugins/adapt-sandbox-entry.mjs.map +1 -1
  386. package/dist/{preview-C1LOEbWZ.mjs → preview-D4z0WONU.mjs} +2 -2
  387. package/dist/{preview-C1LOEbWZ.mjs.map → preview-D4z0WONU.mjs.map} +1 -1
  388. package/dist/{public-url-CseXl9Fv.mjs → public-url-CUWWFME2.mjs} +1 -1
  389. package/dist/{public-url-CseXl9Fv.mjs.map → public-url-CUWWFME2.mjs.map} +1 -1
  390. package/dist/{query-axZmO6Tn.mjs → query-7m6-l0f_.mjs} +27 -17
  391. package/dist/query-7m6-l0f_.mjs.map +1 -0
  392. package/dist/{rate-limit-t5CVjCO6.mjs → rate-limit-D8RAXN8b.mjs} +2 -2
  393. package/dist/{rate-limit-t5CVjCO6.mjs.map → rate-limit-D8RAXN8b.mjs.map} +1 -1
  394. package/dist/{redirect-DGRsLO2I.mjs → redirect-BINiRYq4.mjs} +1 -1
  395. package/dist/{redirect-DGRsLO2I.mjs.map → redirect-BINiRYq4.mjs.map} +1 -1
  396. package/dist/{redirect-DkaDxq8e.mjs → redirect-CjfDGrTd.mjs} +2 -2
  397. package/dist/{redirect-DkaDxq8e.mjs.map → redirect-CjfDGrTd.mjs.map} +1 -1
  398. package/dist/{redirects-Dmj6KRU3.mjs → redirects-COMLwsV5.mjs} +19 -5
  399. package/dist/redirects-COMLwsV5.mjs.map +1 -0
  400. package/dist/{redirects-D1fdd68T.mjs → redirects-CowoEHdE.mjs} +3 -3
  401. package/dist/{redirects-D1fdd68T.mjs.map → redirects-CowoEHdE.mjs.map} +1 -1
  402. package/dist/{registry-BnCeHYsf.mjs → registry-Cyp-dx6J.mjs} +4 -4
  403. package/dist/{registry-BnCeHYsf.mjs.map → registry-Cyp-dx6J.mjs.map} +1 -1
  404. package/dist/request-cache-dzCt8TZB.mjs.map +1 -1
  405. package/dist/request-context.mjs.map +1 -1
  406. package/dist/{request-meta-CLCwSQOS.mjs → request-meta-C_Cjii-T.mjs} +2 -2
  407. package/dist/{request-meta-CLCwSQOS.mjs.map → request-meta-C_Cjii-T.mjs.map} +1 -1
  408. package/dist/resolve-D6sM-SgF.mjs +143 -0
  409. package/dist/resolve-D6sM-SgF.mjs.map +1 -0
  410. package/dist/{runner-DcfZewkO.d.mts → runner-DSQBurMS.d.mts} +8 -5
  411. package/dist/runner-DSQBurMS.d.mts.map +1 -0
  412. package/dist/{runner-DdnQIwz_.mjs → runner-Drnvs96u.mjs} +491 -188
  413. package/dist/runner-Drnvs96u.mjs.map +1 -0
  414. package/dist/runtime.d.mts +10 -10
  415. package/dist/runtime.mjs +2 -2
  416. package/dist/{schema-BmqagCwG.mjs → schema-CI9mYPX3.mjs} +4 -4
  417. package/dist/{schema-BmqagCwG.mjs.map → schema-CI9mYPX3.mjs.map} +1 -1
  418. package/dist/{search-CPrvO5u8.mjs → search-DKz_mGBP.mjs} +4 -4
  419. package/dist/{search-CPrvO5u8.mjs.map → search-DKz_mGBP.mjs.map} +1 -1
  420. package/dist/{secrets-6pgZyq0K.mjs → secrets-rPdhEBkD.mjs} +1 -1
  421. package/dist/{secrets-6pgZyq0K.mjs.map → secrets-rPdhEBkD.mjs.map} +1 -1
  422. package/dist/{sections-Cm-zb-gZ.mjs → sections-DBbCDIAT.mjs} +3 -3
  423. package/dist/{sections-Cm-zb-gZ.mjs.map → sections-DBbCDIAT.mjs.map} +1 -1
  424. package/dist/seed/index.d.mts +2 -2
  425. package/dist/seed/index.mjs +16 -16
  426. package/dist/seo/index.d.mts +1 -1
  427. package/dist/{seo-DRq9-EPP.mjs → seo-BGCyDlkb.mjs} +2 -2
  428. package/dist/{seo-DRq9-EPP.mjs.map → seo-BGCyDlkb.mjs.map} +1 -1
  429. package/dist/{seo-BoR4wCUh.mjs → seo-Dq707mNQ.mjs} +5 -3
  430. package/dist/seo-Dq707mNQ.mjs.map +1 -0
  431. package/dist/{service-vByySp-2.mjs → service-B0H7U1Y9.mjs} +3 -3
  432. package/dist/{service-vByySp-2.mjs.map → service-B0H7U1Y9.mjs.map} +1 -1
  433. package/dist/{settings-xQKsWnzQ.mjs → settings-BSXRtTzk.mjs} +3 -3
  434. package/dist/settings-BSXRtTzk.mjs.map +1 -0
  435. package/dist/{settings-CBBj7HUd.mjs → settings-DfwNyQkf.mjs} +3 -3
  436. package/dist/{settings-CBBj7HUd.mjs.map → settings-DfwNyQkf.mjs.map} +1 -1
  437. package/dist/{setup-BGAJ2uXs.mjs → setup-Cf_TyOv5.mjs} +2 -2
  438. package/dist/{setup-BGAJ2uXs.mjs.map → setup-Cf_TyOv5.mjs.map} +1 -1
  439. package/dist/{setup-complete-C6ZCLhKo.mjs → setup-complete-MzzN9u0b.mjs} +1 -1
  440. package/dist/{setup-complete-C6ZCLhKo.mjs.map → setup-complete-MzzN9u0b.mjs.map} +1 -1
  441. package/dist/{setup-nonce-CY1gQiAU.mjs → setup-nonce-DXuriHsg.mjs} +1 -1
  442. package/dist/{setup-nonce-CY1gQiAU.mjs.map → setup-nonce-DXuriHsg.mjs.map} +1 -1
  443. package/dist/{site-url-D-M4Fd8O.mjs → site-url-xkhw1tcz.mjs} +1 -1
  444. package/dist/{site-url-D-M4Fd8O.mjs.map → site-url-xkhw1tcz.mjs.map} +1 -1
  445. package/dist/{ssrf-DzFN_qV-.mjs → ssrf-MZ-zrG6-.mjs} +1 -1
  446. package/dist/{ssrf-DzFN_qV-.mjs.map → ssrf-MZ-zrG6-.mjs.map} +1 -1
  447. package/dist/storage/local.d.mts +1 -1
  448. package/dist/storage/local.mjs +1 -1
  449. package/dist/storage/local.mjs.map +1 -1
  450. package/dist/storage/s3.d.mts +1 -1
  451. package/dist/storage/s3.mjs +1 -1
  452. package/dist/storage/s3.mjs.map +1 -1
  453. package/dist/{taxonomies-Dc0mzlms.mjs → taxonomies-4vx0nmMr.mjs} +4 -4
  454. package/dist/{taxonomies-Dc0mzlms.mjs.map → taxonomies-4vx0nmMr.mjs.map} +1 -1
  455. package/dist/{taxonomies-Cn9UpaR2.mjs → taxonomies-CcvrMLbR.mjs} +8 -43
  456. package/dist/taxonomies-CcvrMLbR.mjs.map +1 -0
  457. package/dist/{taxonomy-wPfusMK9.mjs → taxonomy-zqGQUqgu.mjs} +3 -3
  458. package/dist/{taxonomy-wPfusMK9.mjs.map → taxonomy-zqGQUqgu.mjs.map} +1 -1
  459. package/dist/{tokens-DILYNZMi.mjs → tokens-N8otWMmj.mjs} +1 -1
  460. package/dist/{tokens-DILYNZMi.mjs.map → tokens-N8otWMmj.mjs.map} +1 -1
  461. package/dist/{transport-fw-mKJzT.mjs → transport-B6CHddbu.mjs} +1 -1
  462. package/dist/{transport-fw-mKJzT.mjs.map → transport-B6CHddbu.mjs.map} +1 -1
  463. package/dist/{transport-GeXlLscf.d.mts → transport-C2MGqtL6.d.mts} +1 -1
  464. package/dist/{transport-GeXlLscf.d.mts.map → transport-C2MGqtL6.d.mts.map} +1 -1
  465. package/dist/{trusted-proxy-CJhQIk65.mjs → trusted-proxy-97pajC2f.mjs} +1 -1
  466. package/dist/{trusted-proxy-CJhQIk65.mjs.map → trusted-proxy-97pajC2f.mjs.map} +1 -1
  467. package/dist/{types-CwXMEPRr.mjs → types-B0bmgwMG.mjs} +2 -2
  468. package/dist/types-B0bmgwMG.mjs.map +1 -0
  469. package/dist/{types-Dz9CGX_d.mjs → types-Cd9UCu3t.mjs} +1 -1
  470. package/dist/{types-Dz9CGX_d.mjs.map → types-Cd9UCu3t.mjs.map} +1 -1
  471. package/dist/{types-DmxPPXGf.d.mts → types-CkDSF81F.d.mts} +1 -1
  472. package/dist/{types-DmxPPXGf.d.mts.map → types-CkDSF81F.d.mts.map} +1 -1
  473. package/dist/{types-BWhaSS7U.d.mts → types-CpUuGcd5.d.mts} +1 -1
  474. package/dist/{types-BWhaSS7U.d.mts.map → types-CpUuGcd5.d.mts.map} +1 -1
  475. package/dist/{types-DFowNO60.d.mts → types-D599-ruj.d.mts} +1 -1
  476. package/dist/{types-DFowNO60.d.mts.map → types-D599-ruj.d.mts.map} +1 -1
  477. package/dist/{types-B05e2naf.d.mts → types-DGHWRQgr.d.mts} +3 -3
  478. package/dist/{types-B05e2naf.d.mts.map → types-DGHWRQgr.d.mts.map} +1 -1
  479. package/dist/{types-CzvJd1ND.d.mts → types-DaYDYW6g.d.mts} +14 -1
  480. package/dist/types-DaYDYW6g.d.mts.map +1 -0
  481. package/dist/{types-C1KKK4VP.d.mts → types-DaqNzqVt.d.mts} +16 -1
  482. package/dist/{types-C1KKK4VP.d.mts.map → types-DaqNzqVt.d.mts.map} +1 -1
  483. package/dist/{types-DW1l0gCv.d.mts → types-Dgo6y-Ut.d.mts} +1 -1
  484. package/dist/{types-DW1l0gCv.d.mts.map → types-Dgo6y-Ut.d.mts.map} +1 -1
  485. package/dist/{types-Cb2UCDJg.d.mts → types-bYmRn_Uy.d.mts} +1 -1
  486. package/dist/{types-Cb2UCDJg.d.mts.map → types-bYmRn_Uy.d.mts.map} +1 -1
  487. package/dist/{user-Dr1bOCqS.mjs → user-hUSOaIJy.mjs} +2 -2
  488. package/dist/{user-Dr1bOCqS.mjs.map → user-hUSOaIJy.mjs.map} +1 -1
  489. package/dist/{utils-_F-rWBTN.mjs → utils-C3wTAP-P.mjs} +1 -1
  490. package/dist/{utils-_F-rWBTN.mjs.map → utils-C3wTAP-P.mjs.map} +1 -1
  491. package/dist/{validate-BpQGsmd7.d.mts → validate-DQtHw9NT.d.mts} +5 -5
  492. package/dist/{validate-BpQGsmd7.d.mts.map → validate-DQtHw9NT.d.mts.map} +1 -1
  493. package/dist/{validate-DlFxcVVK.mjs → validate-IGltez8n.mjs} +2 -2
  494. package/dist/{validate-DlFxcVVK.mjs.map → validate-IGltez8n.mjs.map} +1 -1
  495. package/dist/{validation-BiFJqUp5.mjs → validation-Bmymau7y.mjs} +6 -6
  496. package/dist/{validation-BiFJqUp5.mjs.map → validation-Bmymau7y.mjs.map} +1 -1
  497. package/dist/version-BTc87L3L.mjs +7 -0
  498. package/dist/{version-DNmQakZO.mjs.map → version-BTc87L3L.mjs.map} +1 -1
  499. package/dist/{widgets-B9j_yzlk.mjs → widgets-yHQa4c6c.mjs} +3 -3
  500. package/dist/widgets-yHQa4c6c.mjs.map +1 -0
  501. package/dist/{zod-generator-DSyz01KE.mjs → zod-generator-B80aap1J.mjs} +2 -2
  502. package/dist/{zod-generator-DSyz01KE.mjs.map → zod-generator-B80aap1J.mjs.map} +1 -1
  503. package/package.json +12 -10
  504. package/src/api/error.ts +18 -3
  505. package/src/api/errors.ts +8 -0
  506. package/src/api/handlers/bylines.ts +161 -0
  507. package/src/api/handlers/content.ts +125 -43
  508. package/src/api/handlers/index.ts +8 -0
  509. package/src/api/handlers/marketplace.ts +27 -5
  510. package/src/api/handlers/oauth-clients.ts +1 -1
  511. package/src/api/handlers/registry.ts +622 -5
  512. package/src/api/handlers/seo.ts +16 -1
  513. package/src/api/handlers/snapshot.ts +1 -1
  514. package/src/api/openapi/document.ts +1 -1
  515. package/src/api/schemas/bylines.ts +46 -0
  516. package/src/astro/integration/index.ts +27 -1
  517. package/src/astro/integration/routes.ts +10 -0
  518. package/src/astro/integration/runtime.ts +20 -1
  519. package/src/astro/integration/virtual-modules.ts +19 -2
  520. package/src/astro/integration/vite-config.ts +2 -2
  521. package/src/astro/middleware/auth.ts +7 -7
  522. package/src/astro/middleware/request-context.ts +1 -1
  523. package/src/astro/middleware.ts +35 -20
  524. package/src/astro/public-plugin-api-routes.ts +41 -0
  525. package/src/astro/routes/api/admin/bylines/[id]/index.ts +3 -12
  526. package/src/astro/routes/api/admin/bylines/[id]/translations.ts +99 -0
  527. package/src/astro/routes/api/admin/bylines/index.ts +22 -11
  528. package/src/astro/routes/api/admin/plugins/[id]/update.ts +1 -0
  529. package/src/astro/routes/api/admin/plugins/marketplace/[id]/install.ts +6 -1
  530. package/src/astro/routes/api/admin/plugins/registry/[id]/uninstall.ts +51 -0
  531. package/src/astro/routes/api/admin/plugins/registry/[id]/update.ts +83 -0
  532. package/src/astro/routes/api/admin/plugins/registry/artifact.ts +388 -0
  533. package/src/astro/routes/api/admin/plugins/registry/install.ts +7 -1
  534. package/src/astro/routes/api/admin/plugins/updates.ts +43 -6
  535. package/src/astro/routes/api/admin/themes/marketplace/index.ts +1 -1
  536. package/src/astro/routes/api/auth/oauth/[provider]/callback.ts +2 -2
  537. package/src/astro/routes/api/auth/oauth/[provider].ts +2 -2
  538. package/src/astro/routes/api/content/[collection]/[id]/discard-draft.ts +2 -2
  539. package/src/astro/routes/api/content/[collection]/[id]/duplicate.ts +2 -2
  540. package/src/astro/routes/api/content/[collection]/[id]/publish.ts +2 -2
  541. package/src/astro/routes/api/content/[collection]/[id]/restore.ts +2 -2
  542. package/src/astro/routes/api/content/[collection]/[id]/schedule.ts +2 -2
  543. package/src/astro/routes/api/content/[collection]/[id]/terms/[taxonomy].ts +6 -6
  544. package/src/astro/routes/api/content/[collection]/[id]/translations.ts +1 -1
  545. package/src/astro/routes/api/content/[collection]/[id]/unpublish.ts +2 -2
  546. package/src/astro/routes/api/content/[collection]/[id].ts +6 -6
  547. package/src/astro/routes/api/import/wordpress/execute.ts +1 -1
  548. package/src/astro/routes/api/import/wordpress/prepare.ts +2 -2
  549. package/src/astro/routes/api/import/wordpress/rewrite-url-helpers.ts +22 -0
  550. package/src/astro/routes/api/import/wordpress/rewrite-urls.ts +8 -5
  551. package/src/astro/routes/api/import/wordpress-plugin/execute.ts +2 -2
  552. package/src/astro/routes/api/media/upload-url.ts +1 -1
  553. package/src/astro/routes/api/redirects/404s/index.ts +3 -3
  554. package/src/astro/routes/api/redirects/404s/summary.ts +1 -1
  555. package/src/astro/routes/api/redirects/[id].ts +3 -3
  556. package/src/astro/routes/api/redirects/index.ts +2 -2
  557. package/src/astro/routes/api/schema/collections/[slug]/fields/[fieldSlug].ts +4 -4
  558. package/src/astro/routes/api/schema/collections/[slug]/fields/index.ts +2 -6
  559. package/src/astro/routes/api/schema/collections/[slug]/fields/reorder.ts +1 -1
  560. package/src/astro/routes/api/schema/collections/[slug]/index.ts +6 -6
  561. package/src/astro/routes/api/schema/collections/index.ts +4 -4
  562. package/src/astro/routes/api/schema/index.ts +1 -1
  563. package/src/astro/routes/api/schema/orphans/[slug].ts +1 -1
  564. package/src/astro/routes/api/schema/orphans/index.ts +1 -1
  565. package/src/astro/routes/api/sections/[slug].ts +3 -3
  566. package/src/astro/routes/api/sections/index.ts +2 -2
  567. package/src/astro/routes/sitemap-[collection].xml.ts +114 -14
  568. package/src/astro/types.ts +18 -0
  569. package/src/auth/rate-limit.ts +1 -1
  570. package/src/auth/trusted-proxy.ts +1 -1
  571. package/src/bylines/index.ts +154 -55
  572. package/src/cli/commands/init.ts +4 -8
  573. package/src/client/index.ts +1 -1
  574. package/src/components/InlinePortableTextEditor.tsx +5 -1
  575. package/src/components/inline-code-block.tsx +343 -0
  576. package/src/config/secrets.ts +3 -3
  577. package/src/content/converters/portable-text-to-prosemirror.ts +35 -11
  578. package/src/database/connection.ts +3 -10
  579. package/src/database/errors.ts +14 -0
  580. package/src/database/index.ts +3 -1
  581. package/src/database/migrations/006_taxonomy_defs.ts +1 -1
  582. package/src/database/migrations/014_draft_revisions.ts +6 -6
  583. package/src/database/migrations/040_byline_i18n.ts +497 -0
  584. package/src/database/migrations/runner.ts +33 -22
  585. package/src/database/repositories/audit.ts +2 -2
  586. package/src/database/repositories/byline.ts +320 -50
  587. package/src/database/repositories/media.ts +2 -2
  588. package/src/database/repositories/menu.ts +1 -1
  589. package/src/database/repositories/options.ts +3 -3
  590. package/src/database/repositories/plugin-storage.ts +3 -3
  591. package/src/database/repositories/types.ts +13 -0
  592. package/src/database/types.ts +15 -0
  593. package/src/emdash-runtime.ts +493 -20
  594. package/src/i18n/config.ts +1 -1
  595. package/src/i18n/resolve.ts +152 -0
  596. package/src/index.ts +9 -0
  597. package/src/loader.ts +134 -60
  598. package/src/mcp/server.ts +3 -3
  599. package/src/media/mime.ts +1 -1
  600. package/src/page/absolute-url.ts +1 -1
  601. package/src/plugin-utils.ts +23 -0
  602. package/src/plugins/adapt-sandbox-entry.ts +45 -40
  603. package/src/plugins/email-console.ts +1 -1
  604. package/src/plugins/index.ts +1 -0
  605. package/src/plugins/marketplace.ts +1 -1
  606. package/src/plugins/sandbox/index.ts +1 -0
  607. package/src/plugins/sandbox/noop.ts +11 -3
  608. package/src/plugins/sandbox/types.ts +28 -0
  609. package/src/query.ts +41 -7
  610. package/src/registry/config.ts +1 -1
  611. package/src/request-cache.ts +3 -3
  612. package/src/request-context.ts +1 -1
  613. package/src/settings/index.ts +4 -4
  614. package/src/storage/local.ts +1 -1
  615. package/src/storage/s3.ts +3 -3
  616. package/src/utils/db-errors.ts +24 -0
  617. package/src/widgets/index.ts +1 -1
  618. package/dist/api-BMLZuwM4.mjs.map +0 -1
  619. package/dist/byline-D09BaS4j.mjs +0 -220
  620. package/dist/byline-D09BaS4j.mjs.map +0 -1
  621. package/dist/bylines-BTM2xtP8.mjs +0 -113
  622. package/dist/bylines-BTM2xtP8.mjs.map +0 -1
  623. package/dist/bylines-BdUP8NuI.d.mts.map +0 -1
  624. package/dist/connection-2igzM-AT.mjs +0 -57
  625. package/dist/connection-2igzM-AT.mjs.map +0 -1
  626. package/dist/context-qF8d3IPR.mjs.map +0 -1
  627. package/dist/db-errors-CGN9kJfo.mjs.map +0 -1
  628. package/dist/email-console-Dmp5Q-P2.mjs.map +0 -1
  629. package/dist/error-tSQWIl5U.mjs.map +0 -1
  630. package/dist/index-BV8iJ-6s.d.mts.map +0 -1
  631. package/dist/loader-Cs6-Bqe6.mjs.map +0 -1
  632. package/dist/media-Dg7he9uK.mjs.map +0 -1
  633. package/dist/menus-DOzIecHi.mjs.map +0 -1
  634. package/dist/menus-X4Z-eBA1.mjs.map +0 -1
  635. package/dist/oauth-clients-D_B0_-Bz.mjs.map +0 -1
  636. package/dist/options-Cq64Wx0O.d.mts.map +0 -1
  637. package/dist/query-axZmO6Tn.mjs.map +0 -1
  638. package/dist/redirects-Dmj6KRU3.mjs.map +0 -1
  639. package/dist/runner-DcfZewkO.d.mts.map +0 -1
  640. package/dist/runner-DdnQIwz_.mjs.map +0 -1
  641. package/dist/seo-BoR4wCUh.mjs.map +0 -1
  642. package/dist/settings-xQKsWnzQ.mjs.map +0 -1
  643. package/dist/taxonomies-Cn9UpaR2.mjs.map +0 -1
  644. package/dist/types-CwXMEPRr.mjs.map +0 -1
  645. package/dist/types-CzvJd1ND.d.mts.map +0 -1
  646. package/dist/version-DNmQakZO.mjs +0 -7
  647. package/dist/widgets-B9j_yzlk.mjs.map +0 -1
  648. /package/dist/{api-tokens-D3C9v02m.mjs → api-tokens-iPIHAY8N.mjs} +0 -0
  649. /package/dist/{ssrf-CTul4uQi.mjs → ssrf-BIcd-aXW.mjs} +0 -0
  650. /package/dist/{types-Db67HHlU.mjs → types-1NNkmTIn.mjs} +0 -0
@@ -1,16 +1,16 @@
1
1
  import "../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../types-CwXMEPRr.mjs";
2
+ import "../../../../../types-B0bmgwMG.mjs";
3
3
  import { t as OptionsRepository } from "../../../../../options-BL4X94qY.mjs";
4
- import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-tSQWIl5U.mjs";
5
- import { r as parseOptionalBody, t as isParseError } from "../../../../../parse-BFTPon-J.mjs";
6
- import "../../../../../redirects-Dmj6KRU3.mjs";
7
- import { _ as passkeyOptionsBody } from "../../../../../setup-BGAJ2uXs.mjs";
4
+ import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-ChfADBuu.mjs";
5
+ import { r as parseOptionalBody, t as isParseError } from "../../../../../parse-DHbXfvxO.mjs";
6
+ import "../../../../../redirects-COMLwsV5.mjs";
7
+ import { _ as passkeyOptionsBody } from "../../../../../setup-Cf_TyOv5.mjs";
8
8
  import "../../../../../api/schemas/index.mjs";
9
- import { t as getTrustedProxyHeaders } from "../../../../../trusted-proxy-CJhQIk65.mjs";
10
- import { n as getPublicOrigin } from "../../../../../public-url-CseXl9Fv.mjs";
11
- import { n as createChallengeStore, t as cleanupExpiredChallenges } from "../../../../../challenge-store-CJ0OOHOr.mjs";
12
- import { t as getPasskeyConfig } from "../../../../../passkey-config-Cg86_ISa.mjs";
13
- import { n as getClientIp, r as rateLimitResponse, t as checkRateLimit } from "../../../../../rate-limit-t5CVjCO6.mjs";
9
+ import { t as getTrustedProxyHeaders } from "../../../../../trusted-proxy-97pajC2f.mjs";
10
+ import { n as getPublicOrigin } from "../../../../../public-url-CUWWFME2.mjs";
11
+ import { n as createChallengeStore, t as cleanupExpiredChallenges } from "../../../../../challenge-store-Dng1SxKT.mjs";
12
+ import { t as getPasskeyConfig } from "../../../../../passkey-config-BloQOT3y.mjs";
13
+ import { n as getClientIp, r as rateLimitResponse, t as checkRateLimit } from "../../../../../rate-limit-D8RAXN8b.mjs";
14
14
  import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
15
15
  import { generateAuthenticationOptions } from "@emdash-cms/auth/passkey";
16
16
 
@@ -1,14 +1,14 @@
1
1
  import "../../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../../types-CwXMEPRr.mjs";
2
+ import "../../../../../../types-B0bmgwMG.mjs";
3
3
  import { t as OptionsRepository } from "../../../../../../options-BL4X94qY.mjs";
4
- import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../../error-tSQWIl5U.mjs";
5
- import { r as parseOptionalBody, t as isParseError } from "../../../../../../parse-BFTPon-J.mjs";
6
- import "../../../../../../redirects-Dmj6KRU3.mjs";
7
- import { v as passkeyRegisterOptionsBody } from "../../../../../../setup-BGAJ2uXs.mjs";
4
+ import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../../error-ChfADBuu.mjs";
5
+ import { r as parseOptionalBody, t as isParseError } from "../../../../../../parse-DHbXfvxO.mjs";
6
+ import "../../../../../../redirects-COMLwsV5.mjs";
7
+ import { v as passkeyRegisterOptionsBody } from "../../../../../../setup-Cf_TyOv5.mjs";
8
8
  import "../../../../../../api/schemas/index.mjs";
9
- import { n as getPublicOrigin } from "../../../../../../public-url-CseXl9Fv.mjs";
10
- import { n as createChallengeStore } from "../../../../../../challenge-store-CJ0OOHOr.mjs";
11
- import { t as getPasskeyConfig } from "../../../../../../passkey-config-Cg86_ISa.mjs";
9
+ import { n as getPublicOrigin } from "../../../../../../public-url-CUWWFME2.mjs";
10
+ import { n as createChallengeStore } from "../../../../../../challenge-store-Dng1SxKT.mjs";
11
+ import { t as getPasskeyConfig } from "../../../../../../passkey-config-BloQOT3y.mjs";
12
12
  import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
13
13
  import { generateRegistrationOptions } from "@emdash-cms/auth/passkey";
14
14
 
@@ -1,15 +1,15 @@
1
1
  import "../../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../../types-CwXMEPRr.mjs";
2
+ import "../../../../../../types-B0bmgwMG.mjs";
3
3
  import { t as OptionsRepository } from "../../../../../../options-BL4X94qY.mjs";
4
- import { n as apiSuccess, t as apiError } from "../../../../../../error-tSQWIl5U.mjs";
5
- import { n as parseBody, t as isParseError } from "../../../../../../parse-BFTPon-J.mjs";
6
- import "../../../../../../redirects-Dmj6KRU3.mjs";
7
- import { y as passkeyRegisterVerifyBody } from "../../../../../../setup-BGAJ2uXs.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 { y as passkeyRegisterVerifyBody } from "../../../../../../setup-Cf_TyOv5.mjs";
8
8
  import "../../../../../../api/schemas/index.mjs";
9
- import { n as getPublicOrigin } from "../../../../../../public-url-CseXl9Fv.mjs";
10
- import { n as validateAllowedOrigins, t as getConfiguredAllowedOrigins } from "../../../../../../allowed-origins-CDdG-4Gd.mjs";
11
- import { n as createChallengeStore } from "../../../../../../challenge-store-CJ0OOHOr.mjs";
12
- import { t as getPasskeyConfig } from "../../../../../../passkey-config-Cg86_ISa.mjs";
9
+ import { n as getPublicOrigin } from "../../../../../../public-url-CUWWFME2.mjs";
10
+ import { n as validateAllowedOrigins, t as getConfiguredAllowedOrigins } from "../../../../../../allowed-origins-D0fFk9a6.mjs";
11
+ import { n as createChallengeStore } from "../../../../../../challenge-store-Dng1SxKT.mjs";
12
+ import { t as getPasskeyConfig } from "../../../../../../passkey-config-BloQOT3y.mjs";
13
13
  import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
14
14
  import { registerPasskey, verifyRegistrationResponse } from "@emdash-cms/auth/passkey";
15
15
 
@@ -1,15 +1,15 @@
1
1
  import "../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../types-CwXMEPRr.mjs";
2
+ import "../../../../../types-B0bmgwMG.mjs";
3
3
  import { t as OptionsRepository } from "../../../../../options-BL4X94qY.mjs";
4
- import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-tSQWIl5U.mjs";
5
- import { n as parseBody, t as isParseError } from "../../../../../parse-BFTPon-J.mjs";
6
- import "../../../../../redirects-Dmj6KRU3.mjs";
7
- import { x as passkeyVerifyBody } from "../../../../../setup-BGAJ2uXs.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 { x as passkeyVerifyBody } from "../../../../../setup-Cf_TyOv5.mjs";
8
8
  import "../../../../../api/schemas/index.mjs";
9
- import { n as getPublicOrigin } from "../../../../../public-url-CseXl9Fv.mjs";
10
- import { n as validateAllowedOrigins, t as getConfiguredAllowedOrigins } from "../../../../../allowed-origins-CDdG-4Gd.mjs";
11
- import { n as createChallengeStore } from "../../../../../challenge-store-CJ0OOHOr.mjs";
12
- import { t as getPasskeyConfig } from "../../../../../passkey-config-Cg86_ISa.mjs";
9
+ import { n as getPublicOrigin } from "../../../../../public-url-CUWWFME2.mjs";
10
+ import { n as validateAllowedOrigins, t as getConfiguredAllowedOrigins } from "../../../../../allowed-origins-D0fFk9a6.mjs";
11
+ import { n as createChallengeStore } from "../../../../../challenge-store-Dng1SxKT.mjs";
12
+ import { t as getPasskeyConfig } from "../../../../../passkey-config-BloQOT3y.mjs";
13
13
  import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
14
14
  import { PasskeyAuthenticationError, authenticateWithPasskey } from "@emdash-cms/auth/passkey";
15
15
 
@@ -1,15 +1,15 @@
1
1
  import "../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../types-CwXMEPRr.mjs";
2
+ import "../../../../../types-B0bmgwMG.mjs";
3
3
  import { t as OptionsRepository } from "../../../../../options-BL4X94qY.mjs";
4
- import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-tSQWIl5U.mjs";
5
- import { n as parseBody, t as isParseError } from "../../../../../parse-BFTPon-J.mjs";
6
- import "../../../../../redirects-Dmj6KRU3.mjs";
7
- import { S as signupCompleteBody } from "../../../../../setup-BGAJ2uXs.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 { S as signupCompleteBody } from "../../../../../setup-Cf_TyOv5.mjs";
8
8
  import "../../../../../api/schemas/index.mjs";
9
- import { n as getPublicOrigin } from "../../../../../public-url-CseXl9Fv.mjs";
10
- import { n as validateAllowedOrigins, t as getConfiguredAllowedOrigins } from "../../../../../allowed-origins-CDdG-4Gd.mjs";
11
- import { n as createChallengeStore } from "../../../../../challenge-store-CJ0OOHOr.mjs";
12
- import { t as getPasskeyConfig } from "../../../../../passkey-config-Cg86_ISa.mjs";
9
+ import { n as getPublicOrigin } from "../../../../../public-url-CUWWFME2.mjs";
10
+ import { n as validateAllowedOrigins, t as getConfiguredAllowedOrigins } from "../../../../../allowed-origins-D0fFk9a6.mjs";
11
+ import { n as createChallengeStore } from "../../../../../challenge-store-Dng1SxKT.mjs";
12
+ import { t as getPasskeyConfig } from "../../../../../passkey-config-BloQOT3y.mjs";
13
13
  import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
14
14
  import { SignupError, completeSignup } from "@emdash-cms/auth";
15
15
  import { registerPasskey, verifyRegistrationResponse } from "@emdash-cms/auth/passkey";
@@ -1,14 +1,14 @@
1
1
  import "../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../types-CwXMEPRr.mjs";
2
+ import "../../../../../types-B0bmgwMG.mjs";
3
3
  import { t as OptionsRepository } from "../../../../../options-BL4X94qY.mjs";
4
- import { n as apiSuccess, t as apiError } from "../../../../../error-tSQWIl5U.mjs";
5
- import { n as parseBody, t as isParseError } from "../../../../../parse-BFTPon-J.mjs";
6
- import "../../../../../redirects-Dmj6KRU3.mjs";
7
- import { C as signupRequestBody } from "../../../../../setup-BGAJ2uXs.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";
8
8
  import "../../../../../api/schemas/index.mjs";
9
- import { t as getTrustedProxyHeaders } from "../../../../../trusted-proxy-CJhQIk65.mjs";
10
- import { t as getSiteBaseUrl } from "../../../../../site-url-D-M4Fd8O.mjs";
11
- import { n as getClientIp, t as checkRateLimit } from "../../../../../rate-limit-t5CVjCO6.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";
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-CwXMEPRr.mjs";
3
- import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-tSQWIl5U.mjs";
2
+ import "../../../../../types-B0bmgwMG.mjs";
3
+ import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-ChfADBuu.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-CwXMEPRr.mjs";
4
- import { t as CommentRepository } from "../../../../../../comment-Dd9MI82-.mjs";
3
+ import "../../../../../../types-B0bmgwMG.mjs";
4
+ import { t as CommentRepository } from "../../../../../../comment-C76G-9tz.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-tSQWIl5U.mjs";
7
- import { n as parseBody, t as isParseError } from "../../../../../../parse-BFTPon-J.mjs";
8
- import { yt as createCommentBody } from "../../../../../../redirects-Dmj6KRU3.mjs";
9
- import "../../../../../../setup-BGAJ2uXs.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";
10
10
  import "../../../../../../api/schemas/index.mjs";
11
- import { t as extractRequestMeta } from "../../../../../../request-meta-CLCwSQOS.mjs";
12
- import { i as resolveSecretsCached } from "../../../../../../secrets-6pgZyq0K.mjs";
13
- import { c as hashIp, s as handleCommentList, t as checkRateLimit } from "../../../../../../comments-koGI0FrK.mjs";
14
- import { t as getSiteBaseUrl } from "../../../../../../site-url-D-M4Fd8O.mjs";
15
- import { i as sendCommentNotification, t as createComment } from "../../../../../../service-vByySp-2.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";
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-CwXMEPRr.mjs";
3
- import { a as unwrapResult, t as apiError } from "../../../../../../error-tSQWIl5U.mjs";
4
- import { n as requirePerm } from "../../../../../../authorize-BlyCH-96.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";
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-CwXMEPRr.mjs";
3
- import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-tSQWIl5U.mjs";
4
- import { t as requireOwnerPerm } from "../../../../../../authorize-BlyCH-96.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";
5
5
 
6
6
  //#region src/astro/routes/api/content/[collection]/[id]/discard-draft.ts
7
7
  const prerender = false;
@@ -1 +1 @@
1
- {"version":3,"file":"discard-draft.mjs","names":[],"sources":["../../../../../../../src/astro/routes/api/content/[collection]/[id]/discard-draft.ts"],"sourcesContent":["/**\n * Discard draft changes - reverts to live version\n *\n * POST /_emdash/api/content/{collection}/{id}/discard-draft\n */\n\nimport type { APIRoute } from \"astro\";\n\nimport { requireOwnerPerm } from \"#api/authorize.js\";\nimport { apiError, mapErrorStatus, unwrapResult } from \"#api/error.js\";\n\nexport const prerender = false;\n\nexport const POST: APIRoute = async ({ params, locals, cache }) => {\n\tconst { emdash, user } = locals;\n\tconst collection = params.collection!;\n\tconst id = params.id!;\n\n\tif (!emdash?.handleContentDiscardDraft || !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\tconst existingData =\n\t\texisting.data && typeof existing.data === \"object\"\n\t\t\t? // eslint-disable-next-line typescript-eslint(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-eslint(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 denied = requireOwnerPerm(user, authorId, \"content:edit_own\", \"content:edit_any\");\n\tif (denied) return denied;\n\n\tconst resolvedId = typeof existingItem?.id === \"string\" ? existingItem.id : id;\n\n\tconst result = await emdash.handleContentDiscardDraft(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":";;;;;;AAWA,MAAa,YAAY;AAEzB,MAAa,OAAiB,OAAO,EAAE,QAAQ,QAAQ,YAAY;CAClE,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,aAAa,OAAO;CAC1B,MAAM,KAAK,OAAO;AAElB,KAAI,CAAC,QAAQ,6BAA6B,CAAC,QAAQ,iBAClD,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;CAEF,MAAM,eACL,SAAS,QAAQ,OAAO,SAAS,SAAS,WAEvC,SAAS,OACT;CAEJ,MAAM,eACL,cAAc,QAAQ,OAAO,aAAa,SAAS,WAEhD,aAAa,OACb;CAEJ,MAAM,SAAS,iBAAiB,MADf,OAAO,cAAc,aAAa,WAAW,aAAa,WAAW,IACtC,oBAAoB,mBAAmB;AACvF,KAAI,OAAQ,QAAO;CAEnB,MAAM,aAAa,OAAO,cAAc,OAAO,WAAW,aAAa,KAAK;CAE5E,MAAM,SAAS,MAAM,OAAO,0BAA0B,YAAY,WAAW;AAE7E,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":"discard-draft.mjs","names":[],"sources":["../../../../../../../src/astro/routes/api/content/[collection]/[id]/discard-draft.ts"],"sourcesContent":["/**\n * Discard draft changes - reverts to live version\n *\n * POST /_emdash/api/content/{collection}/{id}/discard-draft\n */\n\nimport type { APIRoute } from \"astro\";\n\nimport { requireOwnerPerm } from \"#api/authorize.js\";\nimport { apiError, mapErrorStatus, unwrapResult } from \"#api/error.js\";\n\nexport const prerender = false;\n\nexport const POST: APIRoute = async ({ params, locals, cache }) => {\n\tconst { emdash, user } = locals;\n\tconst collection = params.collection!;\n\tconst id = params.id!;\n\n\tif (!emdash?.handleContentDiscardDraft || !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\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 denied = requireOwnerPerm(user, authorId, \"content:edit_own\", \"content:edit_any\");\n\tif (denied) return denied;\n\n\tconst resolvedId = typeof existingItem?.id === \"string\" ? existingItem.id : id;\n\n\tconst result = await emdash.handleContentDiscardDraft(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":";;;;;;AAWA,MAAa,YAAY;AAEzB,MAAa,OAAiB,OAAO,EAAE,QAAQ,QAAQ,YAAY;CAClE,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,aAAa,OAAO;CAC1B,MAAM,KAAK,OAAO;AAElB,KAAI,CAAC,QAAQ,6BAA6B,CAAC,QAAQ,iBAClD,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;CAEF,MAAM,eACL,SAAS,QAAQ,OAAO,SAAS,SAAS,WAEvC,SAAS,OACT;CAEJ,MAAM,eACL,cAAc,QAAQ,OAAO,aAAa,SAAS,WAEhD,aAAa,OACb;CAEJ,MAAM,SAAS,iBAAiB,MADf,OAAO,cAAc,aAAa,WAAW,aAAa,WAAW,IACtC,oBAAoB,mBAAmB;AACvF,KAAI,OAAQ,QAAO;CAEnB,MAAM,aAAa,OAAO,cAAc,OAAO,WAAW,aAAa,KAAK;CAE5E,MAAM,SAAS,MAAM,OAAO,0BAA0B,YAAY,WAAW;AAE7E,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,7 +1,7 @@
1
1
  import "../../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../../types-CwXMEPRr.mjs";
3
- import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-tSQWIl5U.mjs";
4
- import { n as requirePerm, t as requireOwnerPerm } from "../../../../../../authorize-BlyCH-96.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";
5
5
 
6
6
  //#region src/astro/routes/api/content/[collection]/[id]/duplicate.ts
7
7
  const prerender = false;
@@ -1 +1 @@
1
- {"version":3,"file":"duplicate.mjs","names":[],"sources":["../../../../../../../src/astro/routes/api/content/[collection]/[id]/duplicate.ts"],"sourcesContent":["/**\n * Duplicate content endpoint - injected by EmDash integration\n *\n * POST /_emdash/api/content/{collection}/{id}/duplicate - Create a copy\n */\n\nimport type { APIRoute } from \"astro\";\n\nimport { requirePerm, requireOwnerPerm } from \"#api/authorize.js\";\nimport { apiError, mapErrorStatus, unwrapResult } from \"#api/error.js\";\n\nexport const prerender = false;\n\nexport const POST: APIRoute = async ({ params, locals, cache }) => {\n\tconst { emdash, user } = locals;\n\tconst collection = params.collection!;\n\tconst id = params.id!;\n\n\tconst denied = requirePerm(user, \"content:create\");\n\tif (denied) return denied;\n\n\tif (!emdash?.handleContentDuplicate || !emdash?.handleContentGet) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash is not initialized\", 500);\n\t}\n\n\t// Fetch item to check ownership — duplicating requires read access to the source\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-eslint(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-eslint(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\t// Duplicating requires read access to the source — check ownership-based edit permissions\n\t// since content:read is flat (no own/any split). This ensures authors can only duplicate their own.\n\tconst readDenied = requireOwnerPerm(user, authorId, \"content:edit_own\", \"content:edit_any\");\n\tif (readDenied) return readDenied;\n\n\tconst resolvedId = typeof existingItem?.id === \"string\" ? existingItem.id : id;\n\tconst result = await emdash.handleContentDuplicate(collection, resolvedId, user?.id);\n\n\tif (!result.success) return unwrapResult(result);\n\n\tif (cache?.enabled) await cache.invalidate({ tags: [collection] });\n\n\treturn unwrapResult(result, 201);\n};\n"],"mappings":";;;;;;AAWA,MAAa,YAAY;AAEzB,MAAa,OAAiB,OAAO,EAAE,QAAQ,QAAQ,YAAY;CAClE,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,aAAa,OAAO;CAC1B,MAAM,KAAK,OAAO;CAElB,MAAM,SAAS,YAAY,MAAM,iBAAiB;AAClD,KAAI,OAAQ,QAAO;AAEnB,KAAI,CAAC,QAAQ,0BAA0B,CAAC,QAAQ,iBAC/C,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;CAIJ,MAAM,aAAa,iBAAiB,MAHnB,OAAO,cAAc,aAAa,WAAW,aAAa,WAAW,IAGlC,oBAAoB,mBAAmB;AAC3F,KAAI,WAAY,QAAO;CAEvB,MAAM,aAAa,OAAO,cAAc,OAAO,WAAW,aAAa,KAAK;CAC5E,MAAM,SAAS,MAAM,OAAO,uBAAuB,YAAY,YAAY,MAAM,GAAG;AAEpF,KAAI,CAAC,OAAO,QAAS,QAAO,aAAa,OAAO;AAEhD,KAAI,OAAO,QAAS,OAAM,MAAM,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC;AAElE,QAAO,aAAa,QAAQ,IAAI"}
1
+ {"version":3,"file":"duplicate.mjs","names":[],"sources":["../../../../../../../src/astro/routes/api/content/[collection]/[id]/duplicate.ts"],"sourcesContent":["/**\n * Duplicate content endpoint - injected by EmDash integration\n *\n * POST /_emdash/api/content/{collection}/{id}/duplicate - Create a copy\n */\n\nimport type { APIRoute } from \"astro\";\n\nimport { requirePerm, requireOwnerPerm } from \"#api/authorize.js\";\nimport { apiError, mapErrorStatus, unwrapResult } from \"#api/error.js\";\n\nexport const prerender = false;\n\nexport const POST: APIRoute = async ({ params, locals, cache }) => {\n\tconst { emdash, user } = locals;\n\tconst collection = params.collection!;\n\tconst id = params.id!;\n\n\tconst denied = requirePerm(user, \"content:create\");\n\tif (denied) return denied;\n\n\tif (!emdash?.handleContentDuplicate || !emdash?.handleContentGet) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash is not initialized\", 500);\n\t}\n\n\t// Fetch item to check ownership — duplicating requires read access to the source\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 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\t// Duplicating requires read access to the source — check ownership-based edit permissions\n\t// since content:read is flat (no own/any split). This ensures authors can only duplicate their own.\n\tconst readDenied = requireOwnerPerm(user, authorId, \"content:edit_own\", \"content:edit_any\");\n\tif (readDenied) return readDenied;\n\n\tconst resolvedId = typeof existingItem?.id === \"string\" ? existingItem.id : id;\n\tconst result = await emdash.handleContentDuplicate(collection, resolvedId, user?.id);\n\n\tif (!result.success) return unwrapResult(result);\n\n\tif (cache?.enabled) await cache.invalidate({ tags: [collection] });\n\n\treturn unwrapResult(result, 201);\n};\n"],"mappings":";;;;;;AAWA,MAAa,YAAY;AAEzB,MAAa,OAAiB,OAAO,EAAE,QAAQ,QAAQ,YAAY;CAClE,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,aAAa,OAAO;CAC1B,MAAM,KAAK,OAAO;CAElB,MAAM,SAAS,YAAY,MAAM,iBAAiB;AAClD,KAAI,OAAQ,QAAO;AAEnB,KAAI,CAAC,QAAQ,0BAA0B,CAAC,QAAQ,iBAC/C,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;CAIJ,MAAM,aAAa,iBAAiB,MAHnB,OAAO,cAAc,aAAa,WAAW,aAAa,WAAW,IAGlC,oBAAoB,mBAAmB;AAC3F,KAAI,WAAY,QAAO;CAEvB,MAAM,aAAa,OAAO,cAAc,OAAO,WAAW,aAAa,KAAK;CAC5E,MAAM,SAAS,MAAM,OAAO,uBAAuB,YAAY,YAAY,MAAM,GAAG;AAEpF,KAAI,CAAC,OAAO,QAAS,QAAO,aAAa,OAAO;AAEhD,KAAI,OAAO,QAAS,OAAM,MAAM,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC;AAElE,QAAO,aAAa,QAAQ,IAAI"}
@@ -1,7 +1,7 @@
1
1
  import "../../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../../types-CwXMEPRr.mjs";
3
- import { a as unwrapResult, t as apiError } from "../../../../../../error-tSQWIl5U.mjs";
4
- import { n as requirePerm } from "../../../../../../authorize-BlyCH-96.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";
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-CwXMEPRr.mjs";
3
+ import "../../../../../../types-B0bmgwMG.mjs";
4
4
  import "../../../../../../options-BL4X94qY.mjs";
5
- import { a as unwrapResult, n as apiSuccess, r as handleError, t as apiError } from "../../../../../../error-tSQWIl5U.mjs";
6
- import { r as parseOptionalBody, t as isParseError } from "../../../../../../parse-BFTPon-J.mjs";
7
- import { rn as contentPreviewUrlBody } from "../../../../../../redirects-Dmj6KRU3.mjs";
8
- import "../../../../../../setup-BGAJ2uXs.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";
9
9
  import "../../../../../../api/schemas/index.mjs";
10
- import "../../../../../../tokens-DILYNZMi.mjs";
11
- import { i as getPreviewUrl } from "../../../../../../preview-C1LOEbWZ.mjs";
12
- import { i as resolveSecretsCached } from "../../../../../../secrets-6pgZyq0K.mjs";
13
- import { n as requirePerm } from "../../../../../../authorize-BlyCH-96.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";
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-CwXMEPRr.mjs";
3
- import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-tSQWIl5U.mjs";
4
- import { r as parseOptionalBody, t as isParseError } from "../../../../../../parse-BFTPon-J.mjs";
5
- import { in as contentPublishBody } from "../../../../../../redirects-Dmj6KRU3.mjs";
6
- import "../../../../../../setup-BGAJ2uXs.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";
7
7
  import "../../../../../../api/schemas/index.mjs";
8
- import { t as requireOwnerPerm } from "../../../../../../authorize-BlyCH-96.mjs";
8
+ import { t as requireOwnerPerm } from "../../../../../../authorize-Bn4S4DUT.mjs";
9
9
  import { hasPermission } from "@emdash-cms/auth";
10
10
 
11
11
  //#region src/astro/routes/api/content/[collection]/[id]/publish.ts
@@ -1 +1 @@
1
- {"version":3,"file":"publish.mjs","names":[],"sources":["../../../../../../../src/astro/routes/api/content/[collection]/[id]/publish.ts"],"sourcesContent":["/**\n * Publish content - promotes draft to live\n *\n * POST /_emdash/api/content/{collection}/{id}/publish\n *\n * Optional JSON body: { publishedAt?: string }\n * publishedAt — ISO 8601 datetime to backdate the publish (e.g. when\n * migrating content). Writing publishedAt requires content:publish_any.\n * Without it, the existing published_at is preserved on re-publish and\n * falls back to the current time on first publish.\n */\n\nimport { hasPermission } from \"@emdash-cms/auth\";\nimport type { APIRoute } from \"astro\";\n\nimport { requireOwnerPerm } from \"#api/authorize.js\";\nimport { apiError, mapErrorStatus, unwrapResult } from \"#api/error.js\";\nimport { isParseError, parseOptionalBody } from \"#api/parse.js\";\nimport { contentPublishBody } from \"#api/schemas.js\";\n\nexport const prerender = false;\n\nexport const POST: APIRoute = async ({ params, request, locals, cache }) => {\n\tconst { emdash, user } = locals;\n\tconst collection = params.collection!;\n\tconst id = params.id!;\n\n\tif (!emdash?.handleContentPublish || !emdash?.handleContentGet) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash is not initialized\", 500);\n\t}\n\n\t// Body is optional — empty body means use the legacy behavior (preserve\n\t// or default published_at). Pass `publishedAt` to backdate.\n\tconst body = await parseOptionalBody(request, contentPublishBody, {});\n\tif (isParseError(body)) return body;\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-eslint(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\tconst existingItem =\n\t\texistingData?.item && typeof existingData.item === \"object\"\n\t\t\t? // eslint-disable-next-line typescript-eslint(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 denied = requireOwnerPerm(user, authorId, \"content:publish_own\", \"content:publish_any\");\n\tif (denied) return denied;\n\n\t// Schema narrows `publishedAt` to `string | undefined`; null is rejected\n\t// at the schema layer (publish has no semantic meaning for \"clear\").\n\tconst publishedAt = body?.publishedAt;\n\n\t// Backdating overwrites historical record — gate behind publish_any\n\t// regardless of ownership.\n\tif (publishedAt !== undefined && !hasPermission(user, \"content:publish_any\")) {\n\t\treturn apiError(\n\t\t\t\"FORBIDDEN\",\n\t\t\t\"Setting publishedAt requires content:publish_any permission\",\n\t\t\t403,\n\t\t);\n\t}\n\n\tconst resolvedId = typeof existingItem?.id === \"string\" ? existingItem.id : id;\n\n\tconst result = await emdash.handleContentPublish(collection, resolvedId, {\n\t\tpublishedAt,\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAa,YAAY;AAEzB,MAAa,OAAiB,OAAO,EAAE,QAAQ,SAAS,QAAQ,YAAY;CAC3E,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,aAAa,OAAO;CAC1B,MAAM,KAAK,OAAO;AAElB,KAAI,CAAC,QAAQ,wBAAwB,CAAC,QAAQ,iBAC7C,QAAO,SAAS,kBAAkB,6BAA6B,IAAI;CAKpE,MAAM,OAAO,MAAM,kBAAkB,SAAS,oBAAoB,EAAE,CAAC;AACrE,KAAI,aAAa,KAAK,CAAE,QAAO;CAG/B,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;CACJ,MAAM,eACL,cAAc,QAAQ,OAAO,aAAa,SAAS,WAEhD,aAAa,OACb;CAEJ,MAAM,SAAS,iBAAiB,MADf,OAAO,cAAc,aAAa,WAAW,aAAa,WAAW,IACtC,uBAAuB,sBAAsB;AAC7F,KAAI,OAAQ,QAAO;CAInB,MAAM,cAAc,MAAM;AAI1B,KAAI,gBAAgB,UAAa,CAAC,cAAc,MAAM,sBAAsB,CAC3E,QAAO,SACN,aACA,+DACA,IACA;CAGF,MAAM,aAAa,OAAO,cAAc,OAAO,WAAW,aAAa,KAAK;CAE5E,MAAM,SAAS,MAAM,OAAO,qBAAqB,YAAY,YAAY,EACxE,aACA,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"}
1
+ {"version":3,"file":"publish.mjs","names":[],"sources":["../../../../../../../src/astro/routes/api/content/[collection]/[id]/publish.ts"],"sourcesContent":["/**\n * Publish content - promotes draft to live\n *\n * POST /_emdash/api/content/{collection}/{id}/publish\n *\n * Optional JSON body: { publishedAt?: string }\n * publishedAt — ISO 8601 datetime to backdate the publish (e.g. when\n * migrating content). Writing publishedAt requires content:publish_any.\n * Without it, the existing published_at is preserved on re-publish and\n * falls back to the current time on first publish.\n */\n\nimport { hasPermission } from \"@emdash-cms/auth\";\nimport type { APIRoute } from \"astro\";\n\nimport { requireOwnerPerm } from \"#api/authorize.js\";\nimport { apiError, mapErrorStatus, unwrapResult } from \"#api/error.js\";\nimport { isParseError, parseOptionalBody } from \"#api/parse.js\";\nimport { contentPublishBody } from \"#api/schemas.js\";\n\nexport const prerender = false;\n\nexport const POST: APIRoute = async ({ params, request, locals, cache }) => {\n\tconst { emdash, user } = locals;\n\tconst collection = params.collection!;\n\tconst id = params.id!;\n\n\tif (!emdash?.handleContentPublish || !emdash?.handleContentGet) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash is not initialized\", 500);\n\t}\n\n\t// Body is optional — empty body means use the legacy behavior (preserve\n\t// or default published_at). Pass `publishedAt` to backdate.\n\tconst body = await parseOptionalBody(request, contentPublishBody, {});\n\tif (isParseError(body)) return body;\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\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 denied = requireOwnerPerm(user, authorId, \"content:publish_own\", \"content:publish_any\");\n\tif (denied) return denied;\n\n\t// Schema narrows `publishedAt` to `string | undefined`; null is rejected\n\t// at the schema layer (publish has no semantic meaning for \"clear\").\n\tconst publishedAt = body?.publishedAt;\n\n\t// Backdating overwrites historical record — gate behind publish_any\n\t// regardless of ownership.\n\tif (publishedAt !== undefined && !hasPermission(user, \"content:publish_any\")) {\n\t\treturn apiError(\n\t\t\t\"FORBIDDEN\",\n\t\t\t\"Setting publishedAt requires content:publish_any permission\",\n\t\t\t403,\n\t\t);\n\t}\n\n\tconst resolvedId = typeof existingItem?.id === \"string\" ? existingItem.id : id;\n\n\tconst result = await emdash.handleContentPublish(collection, resolvedId, {\n\t\tpublishedAt,\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAa,YAAY;AAEzB,MAAa,OAAiB,OAAO,EAAE,QAAQ,SAAS,QAAQ,YAAY;CAC3E,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,aAAa,OAAO;CAC1B,MAAM,KAAK,OAAO;AAElB,KAAI,CAAC,QAAQ,wBAAwB,CAAC,QAAQ,iBAC7C,QAAO,SAAS,kBAAkB,6BAA6B,IAAI;CAKpE,MAAM,OAAO,MAAM,kBAAkB,SAAS,oBAAoB,EAAE,CAAC;AACrE,KAAI,aAAa,KAAK,CAAE,QAAO;CAG/B,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;CACJ,MAAM,eACL,cAAc,QAAQ,OAAO,aAAa,SAAS,WAEhD,aAAa,OACb;CAEJ,MAAM,SAAS,iBAAiB,MADf,OAAO,cAAc,aAAa,WAAW,aAAa,WAAW,IACtC,uBAAuB,sBAAsB;AAC7F,KAAI,OAAQ,QAAO;CAInB,MAAM,cAAc,MAAM;AAI1B,KAAI,gBAAgB,UAAa,CAAC,cAAc,MAAM,sBAAsB,CAC3E,QAAO,SACN,aACA,+DACA,IACA;CAGF,MAAM,aAAa,OAAO,cAAc,OAAO,WAAW,aAAa,KAAK;CAE5E,MAAM,SAAS,MAAM,OAAO,qBAAqB,YAAY,YAAY,EACxE,aACA,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"}
@@ -1,7 +1,7 @@
1
1
  import "../../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../../types-CwXMEPRr.mjs";
3
- import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-tSQWIl5U.mjs";
4
- import { t as requireOwnerPerm } from "../../../../../../authorize-BlyCH-96.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";
5
5
 
6
6
  //#region src/astro/routes/api/content/[collection]/[id]/restore.ts
7
7
  const prerender = false;
@@ -1 +1 @@
1
- {"version":3,"file":"restore.mjs","names":[],"sources":["../../../../../../../src/astro/routes/api/content/[collection]/[id]/restore.ts"],"sourcesContent":["/**\n * Restore content from trash endpoint - injected by EmDash integration\n *\n * POST /_emdash/api/content/{collection}/{id}/restore - Restore from trash\n */\n\nimport type { APIRoute } from \"astro\";\n\nimport { requireOwnerPerm } from \"#api/authorize.js\";\nimport { apiError, mapErrorStatus, unwrapResult } from \"#api/error.js\";\n\nexport const prerender = false;\n\nexport const POST: APIRoute = async ({ params, locals, cache }) => {\n\tconst { emdash, user } = locals;\n\tconst collection = params.collection!;\n\tconst id = params.id!;\n\n\tif (!emdash?.handleContentRestore || !emdash?.handleContentGetIncludingTrashed) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash is not initialized\", 500);\n\t}\n\n\t// Fetch item including trashed items to check ownership\n\tconst existing = await emdash.handleContentGetIncludingTrashed(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\tconst existingData =\n\t\texisting.data && typeof existing.data === \"object\"\n\t\t\t? // eslint-disable-next-line typescript-eslint(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-eslint(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 denied = requireOwnerPerm(user, authorId, \"content:edit_own\", \"content:edit_any\");\n\tif (denied) return denied;\n\n\tconst resolvedId = typeof existingItem?.id === \"string\" ? existingItem.id : id;\n\n\tconst result = await emdash.handleContentRestore(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":";;;;;;AAWA,MAAa,YAAY;AAEzB,MAAa,OAAiB,OAAO,EAAE,QAAQ,QAAQ,YAAY;CAClE,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,aAAa,OAAO;CAC1B,MAAM,KAAK,OAAO;AAElB,KAAI,CAAC,QAAQ,wBAAwB,CAAC,QAAQ,iCAC7C,QAAO,SAAS,kBAAkB,6BAA6B,IAAI;CAIpE,MAAM,WAAW,MAAM,OAAO,iCAAiC,YAAY,GAAG;AAC9E,KAAI,CAAC,SAAS,QACb,QAAO,SACN,SAAS,OAAO,QAAQ,iBACxB,SAAS,OAAO,WAAW,iBAC3B,eAAe,SAAS,OAAO,KAAK,CACpC;CAEF,MAAM,eACL,SAAS,QAAQ,OAAO,SAAS,SAAS,WAEvC,SAAS,OACT;CAEJ,MAAM,eACL,cAAc,QAAQ,OAAO,aAAa,SAAS,WAEhD,aAAa,OACb;CAEJ,MAAM,SAAS,iBAAiB,MADf,OAAO,cAAc,aAAa,WAAW,aAAa,WAAW,IACtC,oBAAoB,mBAAmB;AACvF,KAAI,OAAQ,QAAO;CAEnB,MAAM,aAAa,OAAO,cAAc,OAAO,WAAW,aAAa,KAAK;CAE5E,MAAM,SAAS,MAAM,OAAO,qBAAqB,YAAY,WAAW;AAExE,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":"restore.mjs","names":[],"sources":["../../../../../../../src/astro/routes/api/content/[collection]/[id]/restore.ts"],"sourcesContent":["/**\n * Restore content from trash endpoint - injected by EmDash integration\n *\n * POST /_emdash/api/content/{collection}/{id}/restore - Restore from trash\n */\n\nimport type { APIRoute } from \"astro\";\n\nimport { requireOwnerPerm } from \"#api/authorize.js\";\nimport { apiError, mapErrorStatus, unwrapResult } from \"#api/error.js\";\n\nexport const prerender = false;\n\nexport const POST: APIRoute = async ({ params, locals, cache }) => {\n\tconst { emdash, user } = locals;\n\tconst collection = params.collection!;\n\tconst id = params.id!;\n\n\tif (!emdash?.handleContentRestore || !emdash?.handleContentGetIncludingTrashed) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash is not initialized\", 500);\n\t}\n\n\t// Fetch item including trashed items to check ownership\n\tconst existing = await emdash.handleContentGetIncludingTrashed(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\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 denied = requireOwnerPerm(user, authorId, \"content:edit_own\", \"content:edit_any\");\n\tif (denied) return denied;\n\n\tconst resolvedId = typeof existingItem?.id === \"string\" ? existingItem.id : id;\n\n\tconst result = await emdash.handleContentRestore(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":";;;;;;AAWA,MAAa,YAAY;AAEzB,MAAa,OAAiB,OAAO,EAAE,QAAQ,QAAQ,YAAY;CAClE,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,aAAa,OAAO;CAC1B,MAAM,KAAK,OAAO;AAElB,KAAI,CAAC,QAAQ,wBAAwB,CAAC,QAAQ,iCAC7C,QAAO,SAAS,kBAAkB,6BAA6B,IAAI;CAIpE,MAAM,WAAW,MAAM,OAAO,iCAAiC,YAAY,GAAG;AAC9E,KAAI,CAAC,SAAS,QACb,QAAO,SACN,SAAS,OAAO,QAAQ,iBACxB,SAAS,OAAO,WAAW,iBAC3B,eAAe,SAAS,OAAO,KAAK,CACpC;CAEF,MAAM,eACL,SAAS,QAAQ,OAAO,SAAS,SAAS,WAEvC,SAAS,OACT;CAEJ,MAAM,eACL,cAAc,QAAQ,OAAO,aAAa,SAAS,WAEhD,aAAa,OACb;CAEJ,MAAM,SAAS,iBAAiB,MADf,OAAO,cAAc,aAAa,WAAW,aAAa,WAAW,IACtC,oBAAoB,mBAAmB;AACvF,KAAI,OAAQ,QAAO;CAEnB,MAAM,aAAa,OAAO,cAAc,OAAO,WAAW,aAAa,KAAK;CAE5E,MAAM,SAAS,MAAM,OAAO,qBAAqB,YAAY,WAAW;AAExE,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,7 +1,7 @@
1
1
  import "../../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../../types-CwXMEPRr.mjs";
3
- import { a as unwrapResult, t as apiError } from "../../../../../../error-tSQWIl5U.mjs";
4
- import { n as requirePerm } from "../../../../../../authorize-BlyCH-96.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";
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-CwXMEPRr.mjs";
3
- import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-tSQWIl5U.mjs";
4
- import { n as parseBody, t as isParseError } from "../../../../../../parse-BFTPon-J.mjs";
5
- import { on as contentScheduleBody } from "../../../../../../redirects-Dmj6KRU3.mjs";
6
- import "../../../../../../setup-BGAJ2uXs.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";
7
7
  import "../../../../../../api/schemas/index.mjs";
8
- import { t as requireOwnerPerm } from "../../../../../../authorize-BlyCH-96.mjs";
8
+ import { t as requireOwnerPerm } from "../../../../../../authorize-Bn4S4DUT.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":"schedule.mjs","names":[],"sources":["../../../../../../../src/astro/routes/api/content/[collection]/[id]/schedule.ts"],"sourcesContent":["/**\n * Schedule content for future publishing - injected by EmDash integration\n *\n * POST /_emdash/api/content/{collection}/{id}/schedule - Schedule for publishing\n * DELETE /_emdash/api/content/{collection}/{id}/schedule - Unschedule (clear scheduled time)\n */\n\nimport type { APIRoute } from \"astro\";\n\nimport { requireOwnerPerm } from \"#api/authorize.js\";\nimport { apiError, mapErrorStatus, unwrapResult } from \"#api/error.js\";\nimport { parseBody, isParseError } from \"#api/parse.js\";\nimport { contentScheduleBody } from \"#api/schemas.js\";\n\nexport const prerender = false;\n\n/**\n * Extract author ID from a content item response (shared by POST and DELETE).\n */\nfunction extractOwnership(data: unknown): { authorId: string; resolvedId: string | undefined } {\n\tconst obj =\n\t\tdata && typeof data === \"object\"\n\t\t\t? // eslint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- handler returns unknown; narrowed by typeof\n\t\t\t\t(data as Record<string, unknown>)\n\t\t\t: undefined;\n\tconst item =\n\t\tobj?.item && typeof obj.item === \"object\"\n\t\t\t? // eslint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- narrowed by typeof\n\t\t\t\t(obj.item as Record<string, unknown>)\n\t\t\t: obj;\n\treturn {\n\t\tauthorId: typeof item?.authorId === \"string\" ? item.authorId : \"\",\n\t\tresolvedId: typeof item?.id === \"string\" ? item.id : undefined,\n\t};\n}\n\nexport const POST: 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, contentScheduleBody);\n\tif (isParseError(body)) return body;\n\n\tif (!emdash?.handleContentSchedule || !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 { authorId, resolvedId } = extractOwnership(existing.data);\n\tconst denied = requireOwnerPerm(user, authorId, \"content:publish_own\", \"content:publish_any\");\n\tif (denied) return denied;\n\n\tconst result = await emdash.handleContentSchedule(collection, resolvedId ?? id, body.scheduledAt);\n\n\tif (!result.success) return unwrapResult(result);\n\n\tif (cache?.enabled) await cache.invalidate({ tags: [collection, resolvedId ?? id] });\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?.handleContentUnschedule || !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 { authorId, resolvedId } = extractOwnership(existing.data);\n\tconst denied = requireOwnerPerm(user, authorId, \"content:publish_own\", \"content:publish_any\");\n\tif (denied) return denied;\n\n\tconst result = await emdash.handleContentUnschedule(collection, resolvedId ?? id);\n\n\tif (!result.success) return unwrapResult(result);\n\n\tif (cache?.enabled) await cache.invalidate({ tags: [collection, resolvedId ?? id] });\n\n\treturn unwrapResult(result);\n};\n"],"mappings":";;;;;;;;;;AAcA,MAAa,YAAY;;;;AAKzB,SAAS,iBAAiB,MAAqE;CAC9F,MAAM,MACL,QAAQ,OAAO,SAAS,WAErB,OACA;CACJ,MAAM,OACL,KAAK,QAAQ,OAAO,IAAI,SAAS,WAE9B,IAAI,OACJ;AACJ,QAAO;EACN,UAAU,OAAO,MAAM,aAAa,WAAW,KAAK,WAAW;EAC/D,YAAY,OAAO,MAAM,OAAO,WAAW,KAAK,KAAK;EACrD;;AAGF,MAAa,OAAiB,OAAO,EAAE,QAAQ,SAAS,QAAQ,YAAY;CAC3E,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,aAAa,OAAO;CAC1B,MAAM,KAAK,OAAO;CAClB,MAAM,OAAO,MAAM,UAAU,SAAS,oBAAoB;AAC1D,KAAI,aAAa,KAAK,CAAE,QAAO;AAE/B,KAAI,CAAC,QAAQ,yBAAyB,CAAC,QAAQ,iBAC9C,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,EAAE,UAAU,eAAe,iBAAiB,SAAS,KAAK;CAChE,MAAM,SAAS,iBAAiB,MAAM,UAAU,uBAAuB,sBAAsB;AAC7F,KAAI,OAAQ,QAAO;CAEnB,MAAM,SAAS,MAAM,OAAO,sBAAsB,YAAY,cAAc,IAAI,KAAK,YAAY;AAEjG,KAAI,CAAC,OAAO,QAAS,QAAO,aAAa,OAAO;AAEhD,KAAI,OAAO,QAAS,OAAM,MAAM,WAAW,EAAE,MAAM,CAAC,YAAY,cAAc,GAAG,EAAE,CAAC;AAEpF,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,2BAA2B,CAAC,QAAQ,iBAChD,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,EAAE,UAAU,eAAe,iBAAiB,SAAS,KAAK;CAChE,MAAM,SAAS,iBAAiB,MAAM,UAAU,uBAAuB,sBAAsB;AAC7F,KAAI,OAAQ,QAAO;CAEnB,MAAM,SAAS,MAAM,OAAO,wBAAwB,YAAY,cAAc,GAAG;AAEjF,KAAI,CAAC,OAAO,QAAS,QAAO,aAAa,OAAO;AAEhD,KAAI,OAAO,QAAS,OAAM,MAAM,WAAW,EAAE,MAAM,CAAC,YAAY,cAAc,GAAG,EAAE,CAAC;AAEpF,QAAO,aAAa,OAAO"}
1
+ {"version":3,"file":"schedule.mjs","names":[],"sources":["../../../../../../../src/astro/routes/api/content/[collection]/[id]/schedule.ts"],"sourcesContent":["/**\n * Schedule content for future publishing - injected by EmDash integration\n *\n * POST /_emdash/api/content/{collection}/{id}/schedule - Schedule for publishing\n * DELETE /_emdash/api/content/{collection}/{id}/schedule - Unschedule (clear scheduled time)\n */\n\nimport type { APIRoute } from \"astro\";\n\nimport { requireOwnerPerm } from \"#api/authorize.js\";\nimport { apiError, mapErrorStatus, unwrapResult } from \"#api/error.js\";\nimport { parseBody, isParseError } from \"#api/parse.js\";\nimport { contentScheduleBody } from \"#api/schemas.js\";\n\nexport const prerender = false;\n\n/**\n * Extract author ID from a content item response (shared by POST and DELETE).\n */\nfunction extractOwnership(data: unknown): { authorId: string; resolvedId: string | undefined } {\n\tconst obj =\n\t\tdata && typeof data === \"object\"\n\t\t\t? // eslint-disable-next-line typescript/no-unsafe-type-assertion -- handler returns unknown; narrowed by typeof\n\t\t\t\t(data as Record<string, unknown>)\n\t\t\t: undefined;\n\tconst item =\n\t\tobj?.item && typeof obj.item === \"object\"\n\t\t\t? // eslint-disable-next-line typescript/no-unsafe-type-assertion -- narrowed by typeof\n\t\t\t\t(obj.item as Record<string, unknown>)\n\t\t\t: obj;\n\treturn {\n\t\tauthorId: typeof item?.authorId === \"string\" ? item.authorId : \"\",\n\t\tresolvedId: typeof item?.id === \"string\" ? item.id : undefined,\n\t};\n}\n\nexport const POST: 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, contentScheduleBody);\n\tif (isParseError(body)) return body;\n\n\tif (!emdash?.handleContentSchedule || !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 { authorId, resolvedId } = extractOwnership(existing.data);\n\tconst denied = requireOwnerPerm(user, authorId, \"content:publish_own\", \"content:publish_any\");\n\tif (denied) return denied;\n\n\tconst result = await emdash.handleContentSchedule(collection, resolvedId ?? id, body.scheduledAt);\n\n\tif (!result.success) return unwrapResult(result);\n\n\tif (cache?.enabled) await cache.invalidate({ tags: [collection, resolvedId ?? id] });\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?.handleContentUnschedule || !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 { authorId, resolvedId } = extractOwnership(existing.data);\n\tconst denied = requireOwnerPerm(user, authorId, \"content:publish_own\", \"content:publish_any\");\n\tif (denied) return denied;\n\n\tconst result = await emdash.handleContentUnschedule(collection, resolvedId ?? id);\n\n\tif (!result.success) return unwrapResult(result);\n\n\tif (cache?.enabled) await cache.invalidate({ tags: [collection, resolvedId ?? id] });\n\n\treturn unwrapResult(result);\n};\n"],"mappings":";;;;;;;;;;AAcA,MAAa,YAAY;;;;AAKzB,SAAS,iBAAiB,MAAqE;CAC9F,MAAM,MACL,QAAQ,OAAO,SAAS,WAErB,OACA;CACJ,MAAM,OACL,KAAK,QAAQ,OAAO,IAAI,SAAS,WAE9B,IAAI,OACJ;AACJ,QAAO;EACN,UAAU,OAAO,MAAM,aAAa,WAAW,KAAK,WAAW;EAC/D,YAAY,OAAO,MAAM,OAAO,WAAW,KAAK,KAAK;EACrD;;AAGF,MAAa,OAAiB,OAAO,EAAE,QAAQ,SAAS,QAAQ,YAAY;CAC3E,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,aAAa,OAAO;CAC1B,MAAM,KAAK,OAAO;CAClB,MAAM,OAAO,MAAM,UAAU,SAAS,oBAAoB;AAC1D,KAAI,aAAa,KAAK,CAAE,QAAO;AAE/B,KAAI,CAAC,QAAQ,yBAAyB,CAAC,QAAQ,iBAC9C,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,EAAE,UAAU,eAAe,iBAAiB,SAAS,KAAK;CAChE,MAAM,SAAS,iBAAiB,MAAM,UAAU,uBAAuB,sBAAsB;AAC7F,KAAI,OAAQ,QAAO;CAEnB,MAAM,SAAS,MAAM,OAAO,sBAAsB,YAAY,cAAc,IAAI,KAAK,YAAY;AAEjG,KAAI,CAAC,OAAO,QAAS,QAAO,aAAa,OAAO;AAEhD,KAAI,OAAO,QAAS,OAAM,MAAM,WAAW,EAAE,MAAM,CAAC,YAAY,cAAc,GAAG,EAAE,CAAC;AAEpF,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,2BAA2B,CAAC,QAAQ,iBAChD,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,EAAE,UAAU,eAAe,iBAAiB,SAAS,KAAK;CAChE,MAAM,SAAS,iBAAiB,MAAM,UAAU,uBAAuB,sBAAsB;AAC7F,KAAI,OAAQ,QAAO;CAEnB,MAAM,SAAS,MAAM,OAAO,wBAAwB,YAAY,cAAc,GAAG;AAEjF,KAAI,CAAC,OAAO,QAAS,QAAO,aAAa,OAAO;AAEhD,KAAI,OAAO,QAAS,OAAM,MAAM,WAAW,EAAE,MAAM,CAAC,YAAY,cAAc,GAAG,EAAE,CAAC;AAEpF,QAAO,aAAa,OAAO"}
@@ -1,16 +1,17 @@
1
1
  import "../../../../../../../dialect-helpers-BKCvISIQ.mjs";
2
2
  import "../../../../../../../base64-CqR-7kqF.mjs";
3
- import "../../../../../../../types-CwXMEPRr.mjs";
4
- import { t as TaxonomyRepository } from "../../../../../../../taxonomy-wPfusMK9.mjs";
3
+ import "../../../../../../../types-B0bmgwMG.mjs";
4
+ import { t as TaxonomyRepository } from "../../../../../../../taxonomy-zqGQUqgu.mjs";
5
5
  import "../../../../../../../request-cache-dzCt8TZB.mjs";
6
- import "../../../../../../../loader-Cs6-Bqe6.mjs";
7
- import { l as invalidateTermCache } from "../../../../../../../taxonomies-Cn9UpaR2.mjs";
8
- import { i as requireDb, n as apiSuccess, r as handleError, t as apiError } from "../../../../../../../error-tSQWIl5U.mjs";
9
- import { n as parseBody, t as isParseError } from "../../../../../../../parse-BFTPon-J.mjs";
10
- import { ln as contentTermsBody } from "../../../../../../../redirects-Dmj6KRU3.mjs";
11
- import "../../../../../../../setup-BGAJ2uXs.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";
12
13
  import "../../../../../../../api/schemas/index.mjs";
13
- import { n as requirePerm, t as requireOwnerPerm } from "../../../../../../../authorize-BlyCH-96.mjs";
14
+ import { n as requirePerm, t as requireOwnerPerm } from "../../../../../../../authorize-Bn4S4DUT.mjs";
14
15
 
15
16
  //#region src/astro/routes/api/content/[collection]/[id]/terms/[taxonomy].ts
16
17
  const prerender = false;
@@ -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-eslint(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-eslint(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,OAAQ,GAAG,CACtB,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,OAAQ,iBACZ,QAAO,SAAS,kBAAkB,6BAA6B,IAAI;CAIpE,MAAM,WAAW,MAAM,OAAQ,iBAAiB,YAAY,GAAG;AAC/D,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,OAAQ,GAAG;AAG/C,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 { 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,7 +1,7 @@
1
1
  import "../../../../../../base64-CqR-7kqF.mjs";
2
- import "../../../../../../types-CwXMEPRr.mjs";
3
- import { a as unwrapResult, t as apiError } from "../../../../../../error-tSQWIl5U.mjs";
4
- import { n as requirePerm } from "../../../../../../authorize-BlyCH-96.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";
5
5
  import { hasPermission } from "@emdash-cms/auth";
6
6
 
7
7
  //#region src/astro/routes/api/content/[collection]/[id]/translations.ts
@@ -1 +1 @@
1
- {"version":3,"file":"translations.mjs","names":[],"sources":["../../../../../../../src/astro/routes/api/content/[collection]/[id]/translations.ts"],"sourcesContent":["/**\n * Content translations endpoint\n *\n * GET /_emdash/api/content/{collection}/{id}/translations\n *\n * Returns all locale variants linked to the same translation group.\n */\n\nimport { hasPermission } from \"@emdash-cms/auth\";\nimport type { APIRoute } from \"astro\";\n\nimport { requirePerm } from \"#api/authorize.js\";\nimport { apiError, unwrapResult } from \"#api/error.js\";\n\nexport const prerender = false;\n\nfunction isPublished(t: unknown): boolean {\n\treturn (\n\t\ttypeof t === \"object\" &&\n\t\tt !== null &&\n\t\t\"status\" in t &&\n\t\t(t as Record<string, unknown>).status === \"published\"\n\t);\n}\n\nexport const GET: APIRoute = async ({ params, 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\n\tif (!emdash?.handleContentTranslations) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash is not initialized\", 500);\n\t}\n\n\tconst result = await emdash.handleContentTranslations(collection, id);\n\n\t// Filter out non-published translations for users without read_drafts so a\n\t// subscriber can't enumerate locales that aren't yet live.\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-eslint(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 translations = Array.isArray(data?.translations) ? data.translations : [];\n\t\tconst filtered = translations.filter(isPublished);\n\t\treturn unwrapResult({\n\t\t\tsuccess: true,\n\t\t\tdata: { ...data, translations: filtered },\n\t\t});\n\t}\n\n\treturn unwrapResult(result);\n};\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAa,YAAY;AAEzB,SAAS,YAAY,GAAqB;AACzC,QACC,OAAO,MAAM,YACb,MAAM,QACN,YAAY,KACX,EAA8B,WAAW;;AAI5C,MAAa,MAAgB,OAAO,EAAE,QAAQ,aAAa;CAC1D,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,SAAS,YAAY,MAAM,eAAe;AAChD,KAAI,OAAQ,QAAO;CACnB,MAAM,aAAa,OAAO;CAC1B,MAAM,KAAK,OAAO;AAElB,KAAI,CAAC,QAAQ,0BACZ,QAAO,SAAS,kBAAkB,6BAA6B,IAAI;CAGpE,MAAM,SAAS,MAAM,OAAO,0BAA0B,YAAY,GAAG;AAIrE,KAAI,OAAO,WAAW,CAAC,cAAc,MAAM,sBAAsB,EAAE;EAClE,MAAM,OACL,OAAO,QAAQ,OAAO,OAAO,SAAS,WAEnC,OAAO,OACP;EAEJ,MAAM,YADe,MAAM,QAAQ,MAAM,aAAa,GAAG,KAAK,eAAe,EAAE,EACjD,OAAO,YAAY;AACjD,SAAO,aAAa;GACnB,SAAS;GACT,MAAM;IAAE,GAAG;IAAM,cAAc;IAAU;GACzC,CAAC;;AAGH,QAAO,aAAa,OAAO"}
1
+ {"version":3,"file":"translations.mjs","names":[],"sources":["../../../../../../../src/astro/routes/api/content/[collection]/[id]/translations.ts"],"sourcesContent":["/**\n * Content translations endpoint\n *\n * GET /_emdash/api/content/{collection}/{id}/translations\n *\n * Returns all locale variants linked to the same translation group.\n */\n\nimport { hasPermission } from \"@emdash-cms/auth\";\nimport type { APIRoute } from \"astro\";\n\nimport { requirePerm } from \"#api/authorize.js\";\nimport { apiError, unwrapResult } from \"#api/error.js\";\n\nexport const prerender = false;\n\nfunction isPublished(t: unknown): boolean {\n\treturn (\n\t\ttypeof t === \"object\" &&\n\t\tt !== null &&\n\t\t\"status\" in t &&\n\t\t(t as Record<string, unknown>).status === \"published\"\n\t);\n}\n\nexport const GET: APIRoute = async ({ params, 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\n\tif (!emdash?.handleContentTranslations) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash is not initialized\", 500);\n\t}\n\n\tconst result = await emdash.handleContentTranslations(collection, id);\n\n\t// Filter out non-published translations for users without read_drafts so a\n\t// subscriber can't enumerate locales that aren't yet live.\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 translations = Array.isArray(data?.translations) ? data.translations : [];\n\t\tconst filtered = translations.filter(isPublished);\n\t\treturn unwrapResult({\n\t\t\tsuccess: true,\n\t\t\tdata: { ...data, translations: filtered },\n\t\t});\n\t}\n\n\treturn unwrapResult(result);\n};\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAa,YAAY;AAEzB,SAAS,YAAY,GAAqB;AACzC,QACC,OAAO,MAAM,YACb,MAAM,QACN,YAAY,KACX,EAA8B,WAAW;;AAI5C,MAAa,MAAgB,OAAO,EAAE,QAAQ,aAAa;CAC1D,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,SAAS,YAAY,MAAM,eAAe;AAChD,KAAI,OAAQ,QAAO;CACnB,MAAM,aAAa,OAAO;CAC1B,MAAM,KAAK,OAAO;AAElB,KAAI,CAAC,QAAQ,0BACZ,QAAO,SAAS,kBAAkB,6BAA6B,IAAI;CAGpE,MAAM,SAAS,MAAM,OAAO,0BAA0B,YAAY,GAAG;AAIrE,KAAI,OAAO,WAAW,CAAC,cAAc,MAAM,sBAAsB,EAAE;EAClE,MAAM,OACL,OAAO,QAAQ,OAAO,OAAO,SAAS,WAEnC,OAAO,OACP;EAEJ,MAAM,YADe,MAAM,QAAQ,MAAM,aAAa,GAAG,KAAK,eAAe,EAAE,EACjD,OAAO,YAAY;AACjD,SAAO,aAAa;GACnB,SAAS;GACT,MAAM;IAAE,GAAG;IAAM,cAAc;IAAU;GACzC,CAAC;;AAGH,QAAO,aAAa,OAAO"}