emdash 0.26.0 → 0.28.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 (564) hide show
  1. package/dist/{adapters-DAAjOID4.d.mts → adapters-hUy8vOB-.d.mts} +1 -1
  2. package/dist/{adapters-DAAjOID4.d.mts.map → adapters-hUy8vOB-.d.mts.map} +1 -1
  3. package/dist/{allowed-origins-D5FxMUo8.mjs → allowed-origins-CRsJ6BPM.mjs} +2 -2
  4. package/dist/{allowed-origins-D5FxMUo8.mjs.map → allowed-origins-CRsJ6BPM.mjs.map} +1 -1
  5. package/dist/api/route-utils.d.mts +3 -3
  6. package/dist/api/route-utils.mjs +17 -16
  7. package/dist/api/route-utils.mjs.map +1 -1
  8. package/dist/api/schemas/index.d.mts +1 -1
  9. package/dist/api/schemas/index.mjs +3 -3
  10. package/dist/{api-BMfveMoB.mjs → api-BFURZn1i.mjs} +104 -38
  11. package/dist/api-BFURZn1i.mjs.map +1 -0
  12. package/dist/{api-tokens-D6ppjIVi.mjs → api-tokens-DvqeZmVq.mjs} +2 -2
  13. package/dist/{api-tokens-D6ppjIVi.mjs.map → api-tokens-DvqeZmVq.mjs.map} +1 -1
  14. package/dist/{apply--IVNSdXn.mjs → apply-Bu-8nYHL.mjs} +113 -76
  15. package/dist/apply-Bu-8nYHL.mjs.map +1 -0
  16. package/dist/astro/index.d.mts +12 -11
  17. package/dist/astro/index.d.mts.map +1 -1
  18. package/dist/astro/index.mjs +13 -5
  19. package/dist/astro/index.mjs.map +1 -1
  20. package/dist/astro/middleware/auth.d.mts +10 -9
  21. package/dist/astro/middleware/auth.d.mts.map +1 -1
  22. package/dist/astro/middleware/auth.mjs +52 -12
  23. package/dist/astro/middleware/auth.mjs.map +1 -1
  24. package/dist/astro/middleware/redirect.mjs +5 -5
  25. package/dist/astro/middleware/request-context.mjs +2 -2
  26. package/dist/astro/middleware/setup.mjs +1 -1
  27. package/dist/astro/middleware.d.mts +2 -9
  28. package/dist/astro/middleware.d.mts.map +1 -1
  29. package/dist/astro/middleware.mjs +125 -71
  30. package/dist/astro/middleware.mjs.map +1 -1
  31. package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +6 -6
  32. package/dist/astro/routes/api/admin/allowed-domains/index.mjs +6 -6
  33. package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +4 -4
  34. package/dist/astro/routes/api/admin/api-tokens/index.mjs +5 -5
  35. package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +4 -4
  36. package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +8 -8
  37. package/dist/astro/routes/api/admin/byline-fields/index.mjs +8 -8
  38. package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +8 -8
  39. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +14 -14
  40. package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +14 -14
  41. package/dist/astro/routes/api/admin/bylines/index.mjs +14 -14
  42. package/dist/astro/routes/api/admin/comments/_id_/status.mjs +12 -12
  43. package/dist/astro/routes/api/admin/comments/_id_.mjs +6 -6
  44. package/dist/astro/routes/api/admin/comments/bulk.mjs +10 -10
  45. package/dist/astro/routes/api/admin/comments/counts.mjs +6 -6
  46. package/dist/astro/routes/api/admin/comments/index.mjs +10 -10
  47. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +4 -4
  48. package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +3 -3
  49. package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +4 -4
  50. package/dist/astro/routes/api/admin/oauth-clients/index.mjs +4 -4
  51. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +38 -37
  52. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs.map +1 -1
  53. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +38 -37
  54. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs.map +1 -1
  55. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +37 -36
  56. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs.map +1 -1
  57. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +36 -35
  58. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs.map +1 -1
  59. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +36 -35
  60. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs.map +1 -1
  61. package/dist/astro/routes/api/admin/plugins/index.mjs +37 -36
  62. package/dist/astro/routes/api/admin/plugins/index.mjs.map +1 -1
  63. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +3 -3
  64. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +36 -35
  65. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs.map +1 -1
  66. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +36 -35
  67. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs.map +1 -1
  68. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +36 -35
  69. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs.map +1 -1
  70. package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs +36 -35
  71. package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs.map +1 -1
  72. package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs +37 -36
  73. package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs.map +1 -1
  74. package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs +36 -35
  75. package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs.map +1 -1
  76. package/dist/astro/routes/api/admin/plugins/registry/install.mjs +37 -36
  77. package/dist/astro/routes/api/admin/plugins/registry/install.mjs.map +1 -1
  78. package/dist/astro/routes/api/admin/plugins/updates.mjs +36 -35
  79. package/dist/astro/routes/api/admin/plugins/updates.mjs.map +1 -1
  80. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +36 -35
  81. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs.map +1 -1
  82. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +3 -3
  83. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +36 -35
  84. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs.map +1 -1
  85. package/dist/astro/routes/api/admin/users/_id_/disable.mjs +2 -2
  86. package/dist/astro/routes/api/admin/users/_id_/enable.mjs +2 -2
  87. package/dist/astro/routes/api/admin/users/_id_/index.mjs +6 -6
  88. package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +3 -3
  89. package/dist/astro/routes/api/admin/users/index.mjs +6 -6
  90. package/dist/astro/routes/api/auth/dev-bypass.mjs +5 -5
  91. package/dist/astro/routes/api/auth/invite/accept.mjs +2 -2
  92. package/dist/astro/routes/api/auth/invite/complete.mjs +10 -10
  93. package/dist/astro/routes/api/auth/invite/index.mjs +7 -7
  94. package/dist/astro/routes/api/auth/invite/register-options.mjs +9 -9
  95. package/dist/astro/routes/api/auth/logout.mjs +3 -3
  96. package/dist/astro/routes/api/auth/magic-link/send.mjs +9 -9
  97. package/dist/astro/routes/api/auth/magic-link/verify.mjs +3 -3
  98. package/dist/astro/routes/api/auth/me.mjs +7 -7
  99. package/dist/astro/routes/api/auth/mode.mjs +1 -1
  100. package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +3 -3
  101. package/dist/astro/routes/api/auth/oauth/_provider_.mjs +2 -2
  102. package/dist/astro/routes/api/auth/passkey/_id_.mjs +6 -6
  103. package/dist/astro/routes/api/auth/passkey/index.mjs +2 -2
  104. package/dist/astro/routes/api/auth/passkey/options.mjs +11 -11
  105. package/dist/astro/routes/api/auth/passkey/register/options.mjs +9 -9
  106. package/dist/astro/routes/api/auth/passkey/register/verify.mjs +10 -10
  107. package/dist/astro/routes/api/auth/passkey/verify.mjs +10 -10
  108. package/dist/astro/routes/api/auth/signup/complete.mjs +10 -10
  109. package/dist/astro/routes/api/auth/signup/request.mjs +9 -9
  110. package/dist/astro/routes/api/auth/signup/verify.mjs +2 -2
  111. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +13 -13
  112. package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +12 -12
  113. package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +3 -3
  114. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +3 -3
  115. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +3 -3
  116. package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +3 -3
  117. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +10 -10
  118. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +7 -7
  119. package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +3 -3
  120. package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +3 -3
  121. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +7 -7
  122. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +13 -13
  123. package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +3 -3
  124. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +3 -3
  125. package/dist/astro/routes/api/content/_collection_/_id_.mjs +7 -7
  126. package/dist/astro/routes/api/content/_collection_/authors.mjs +3 -3
  127. package/dist/astro/routes/api/content/_collection_/index.mjs +7 -7
  128. package/dist/astro/routes/api/content/_collection_/trash.mjs +7 -7
  129. package/dist/astro/routes/api/dashboard.mjs +8 -8
  130. package/dist/astro/routes/api/dev/emails.mjs +3 -3
  131. package/dist/astro/routes/api/import/probe.d.mts +3 -3
  132. package/dist/astro/routes/api/import/probe.mjs +19 -11
  133. package/dist/astro/routes/api/import/probe.mjs.map +1 -1
  134. package/dist/astro/routes/api/import/wordpress/analyze.mjs +3 -3
  135. package/dist/astro/routes/api/import/wordpress/execute.d.mts +11 -40
  136. package/dist/astro/routes/api/import/wordpress/execute.d.mts.map +1 -1
  137. package/dist/astro/routes/api/import/wordpress/execute.mjs +12 -407
  138. package/dist/astro/routes/api/import/wordpress/execute.mjs.map +1 -1
  139. package/dist/astro/routes/api/import/wordpress/media.d.mts +10 -9
  140. package/dist/astro/routes/api/import/wordpress/media.d.mts.map +1 -1
  141. package/dist/astro/routes/api/import/wordpress/media.mjs +9 -9
  142. package/dist/astro/routes/api/import/wordpress/prepare.mjs +9 -9
  143. package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +19 -1
  144. package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts.map +1 -1
  145. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +97 -79
  146. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs.map +1 -1
  147. package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
  148. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +19 -11
  149. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs.map +1 -1
  150. package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +40 -2
  151. package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts.map +1 -1
  152. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +519 -39
  153. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs.map +1 -1
  154. package/dist/astro/routes/api/manifest.d.mts.map +1 -1
  155. package/dist/astro/routes/api/manifest.mjs +14 -5
  156. package/dist/astro/routes/api/manifest.mjs.map +1 -1
  157. package/dist/astro/routes/api/mcp.mjs +39 -39
  158. package/dist/astro/routes/api/media/_id_/confirm.mjs +7 -7
  159. package/dist/astro/routes/api/media/_id_.mjs +7 -7
  160. package/dist/astro/routes/api/media/file/_...key_.mjs +2 -2
  161. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +3 -3
  162. package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +3 -3
  163. package/dist/astro/routes/api/media/providers/index.mjs +3 -3
  164. package/dist/astro/routes/api/media/upload-url.mjs +8 -8
  165. package/dist/astro/routes/api/media.mjs +9 -9
  166. package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +9 -9
  167. package/dist/astro/routes/api/menus/_name_/items.mjs +9 -9
  168. package/dist/astro/routes/api/menus/_name_/reorder.mjs +9 -9
  169. package/dist/astro/routes/api/menus/_name_/translations.mjs +9 -9
  170. package/dist/astro/routes/api/menus/_name_.mjs +9 -9
  171. package/dist/astro/routes/api/menus/index.mjs +9 -9
  172. package/dist/astro/routes/api/oauth/authorize.mjs +6 -6
  173. package/dist/astro/routes/api/oauth/device/authorize.mjs +6 -6
  174. package/dist/astro/routes/api/oauth/device/code.mjs +9 -9
  175. package/dist/astro/routes/api/oauth/device/token.mjs +8 -8
  176. package/dist/astro/routes/api/oauth/register.mjs +3 -3
  177. package/dist/astro/routes/api/oauth/token/refresh.mjs +6 -6
  178. package/dist/astro/routes/api/oauth/token/revoke.mjs +6 -6
  179. package/dist/astro/routes/api/oauth/token.mjs +6 -6
  180. package/dist/astro/routes/api/openapi.json.mjs +4 -4
  181. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +4 -4
  182. package/dist/astro/routes/api/redirects/404s/index.mjs +9 -9
  183. package/dist/astro/routes/api/redirects/404s/summary.mjs +9 -9
  184. package/dist/astro/routes/api/redirects/_id_.mjs +10 -10
  185. package/dist/astro/routes/api/redirects/index.mjs +10 -10
  186. package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +3 -3
  187. package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +3 -3
  188. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +36 -35
  189. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs.map +1 -1
  190. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +36 -35
  191. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs.map +1 -1
  192. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +36 -35
  193. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs.map +1 -1
  194. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +36 -35
  195. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs.map +1 -1
  196. package/dist/astro/routes/api/schema/collections/index.mjs +36 -35
  197. package/dist/astro/routes/api/schema/collections/index.mjs.map +1 -1
  198. package/dist/astro/routes/api/schema/index.mjs +7 -6
  199. package/dist/astro/routes/api/schema/index.mjs.map +1 -1
  200. package/dist/astro/routes/api/schema/orphans/_slug_.mjs +36 -35
  201. package/dist/astro/routes/api/schema/orphans/_slug_.mjs.map +1 -1
  202. package/dist/astro/routes/api/schema/orphans/index.mjs +36 -35
  203. package/dist/astro/routes/api/schema/orphans/index.mjs.map +1 -1
  204. package/dist/astro/routes/api/search/enable.mjs +10 -10
  205. package/dist/astro/routes/api/search/index.mjs +9 -9
  206. package/dist/astro/routes/api/search/rebuild.mjs +10 -10
  207. package/dist/astro/routes/api/search/stats.mjs +6 -6
  208. package/dist/astro/routes/api/search/suggest.mjs +9 -9
  209. package/dist/astro/routes/api/sections/_slug_.mjs +9 -9
  210. package/dist/astro/routes/api/sections/index.mjs +9 -9
  211. package/dist/astro/routes/api/settings/email.mjs +4 -4
  212. package/dist/astro/routes/api/settings.mjs +12 -12
  213. package/dist/astro/routes/api/setup/admin-verify.mjs +11 -11
  214. package/dist/astro/routes/api/setup/admin.mjs +10 -10
  215. package/dist/astro/routes/api/setup/dev-bypass.d.mts.map +1 -1
  216. package/dist/astro/routes/api/setup/dev-bypass.mjs +28 -25
  217. package/dist/astro/routes/api/setup/dev-bypass.mjs.map +1 -1
  218. package/dist/astro/routes/api/setup/dev-reset.mjs +2 -2
  219. package/dist/astro/routes/api/setup/index.mjs +26 -25
  220. package/dist/astro/routes/api/setup/index.mjs.map +1 -1
  221. package/dist/astro/routes/api/setup/status.mjs +4 -4
  222. package/dist/astro/routes/api/snapshot.mjs +6 -6
  223. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +13 -13
  224. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +13 -13
  225. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +13 -13
  226. package/dist/astro/routes/api/taxonomies/index.mjs +13 -13
  227. package/dist/astro/routes/api/themes/preview.mjs +5 -5
  228. package/dist/astro/routes/api/typegen.mjs +5 -5
  229. package/dist/astro/routes/api/well-known/auth.mjs +1 -1
  230. package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +2 -2
  231. package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +2 -2
  232. package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +7 -7
  233. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +9 -9
  234. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +9 -9
  235. package/dist/astro/routes/api/widget-areas/_name_.mjs +5 -5
  236. package/dist/astro/routes/api/widget-areas/index.mjs +9 -9
  237. package/dist/astro/routes/api/widget-components.mjs +3 -3
  238. package/dist/astro/routes/robots.txt.mjs +6 -6
  239. package/dist/astro/routes/sitemap-_collection_.xml.mjs +9 -9
  240. package/dist/astro/routes/sitemap.xml.mjs +7 -7
  241. package/dist/astro/types.d.mts +14 -12
  242. package/dist/astro/types.d.mts.map +1 -1
  243. package/dist/auth/providers/github.d.mts +1 -1
  244. package/dist/auth/providers/google.d.mts +1 -1
  245. package/dist/{authorize-BZnOGJFo.mjs → authorize-Dz88F_Fw.mjs} +2 -2
  246. package/dist/{authorize-BZnOGJFo.mjs.map → authorize-Dz88F_Fw.mjs.map} +1 -1
  247. package/dist/{byline-LL8lyqdb.mjs → byline-Bm8ZgUP9.mjs} +6 -6
  248. package/dist/{byline-LL8lyqdb.mjs.map → byline-Bm8ZgUP9.mjs.map} +1 -1
  249. package/dist/{byline-fields-eyJMblSr.mjs → byline-fields-2Lp5Hbgf.mjs} +18 -3
  250. package/dist/byline-fields-2Lp5Hbgf.mjs.map +1 -0
  251. package/dist/{byline-fields-DaMKzkhO.mjs → byline-fields-CIx_GuN4.mjs} +1 -1
  252. package/dist/{byline-fields-DaMKzkhO.mjs.map → byline-fields-CIx_GuN4.mjs.map} +1 -1
  253. package/dist/{byline-fields-KD3JFRuH.d.mts → byline-fields-Cgrt9-aL.d.mts} +18 -3
  254. package/dist/{byline-fields-KD3JFRuH.d.mts.map → byline-fields-Cgrt9-aL.d.mts.map} +1 -1
  255. package/dist/{bylines-BmJ7Vg7J.mjs → bylines-6tm9mgQb.mjs} +4 -4
  256. package/dist/{bylines-BmJ7Vg7J.mjs.map → bylines-6tm9mgQb.mjs.map} +1 -1
  257. package/dist/{bylines-DE47vP8d.mjs → bylines-Woq87129.mjs} +6 -6
  258. package/dist/{bylines-DE47vP8d.mjs.map → bylines-Woq87129.mjs.map} +1 -1
  259. package/dist/{cache-D9jF5bYw.mjs → cache-CEBAZjir.mjs} +2 -2
  260. package/dist/{cache-D9jF5bYw.mjs.map → cache-CEBAZjir.mjs.map} +1 -1
  261. package/dist/{challenge-store-LhiqMccz.mjs → challenge-store-anhwVER0.mjs} +1 -1
  262. package/dist/{challenge-store-LhiqMccz.mjs.map → challenge-store-anhwVER0.mjs.map} +1 -1
  263. package/dist/{chunks-OCG163rN.mjs → chunks-B2isWQhr.mjs} +2 -2
  264. package/dist/{chunks-OCG163rN.mjs.map → chunks-B2isWQhr.mjs.map} +1 -1
  265. package/dist/cli/index.mjs +23 -22
  266. package/dist/cli/index.mjs.map +1 -1
  267. package/dist/client/cf-access.d.mts +1 -1
  268. package/dist/client/index.d.mts +1 -1
  269. package/dist/client/index.mjs +2 -2
  270. package/dist/{comment-D9BLDpZI.mjs → comment-CzeatwBV.mjs} +3 -3
  271. package/dist/{comment-D9BLDpZI.mjs.map → comment-CzeatwBV.mjs.map} +1 -1
  272. package/dist/{comment-reaction-Drl9SkNu.mjs → comment-reaction-Cj9QJY7I.mjs} +2 -2
  273. package/dist/{comment-reaction-Drl9SkNu.mjs.map → comment-reaction-Cj9QJY7I.mjs.map} +1 -1
  274. package/dist/{comments-BjJ9SKGU.mjs → comments-BLE-jv5k.mjs} +3 -3
  275. package/dist/{comments-BjJ9SKGU.mjs.map → comments-BLE-jv5k.mjs.map} +1 -1
  276. package/dist/{components-CYt4uVK9.mjs → components-B_sATNUc.mjs} +1 -1
  277. package/dist/{components-CYt4uVK9.mjs.map → components-B_sATNUc.mjs.map} +1 -1
  278. package/dist/{content-ncUWWjna.mjs → content-DhgEth4k.mjs} +4 -4
  279. package/dist/{content-ncUWWjna.mjs.map → content-DhgEth4k.mjs.map} +1 -1
  280. package/dist/content-refresh-CA4uKwzH.mjs +1531 -0
  281. package/dist/content-refresh-CA4uKwzH.mjs.map +1 -0
  282. package/dist/{context-C_g-iJVA.mjs → context-CUsR9dXL.mjs} +76 -54
  283. package/dist/context-CUsR9dXL.mjs.map +1 -0
  284. package/dist/{cron-C5LVoNmP.mjs → cron-v4FTEFR_.mjs} +1 -1
  285. package/dist/{cron-C5LVoNmP.mjs.map → cron-v4FTEFR_.mjs.map} +1 -1
  286. package/dist/{dashboard-CotyqQrW.mjs → dashboard-EvEKF5en.mjs} +4 -4
  287. package/dist/{dashboard-CotyqQrW.mjs.map → dashboard-EvEKF5en.mjs.map} +1 -1
  288. package/dist/db/index.d.mts +3 -3
  289. package/dist/db/index.mjs +1 -1
  290. package/dist/db/libsql.d.mts +1 -1
  291. package/dist/db/postgres.d.mts +1 -1
  292. package/dist/db/sqlite.d.mts +1 -1
  293. package/dist/{default-CeRG-Ot4.mjs → default-CM_D83Mg.mjs} +1 -1
  294. package/dist/{default-CeRG-Ot4.mjs.map → default-CM_D83Mg.mjs.map} +1 -1
  295. package/dist/{device-flow-DENDCQ9F.mjs → device-flow-CfGP18Uw.mjs} +4 -4
  296. package/dist/{device-flow-DENDCQ9F.mjs.map → device-flow-CfGP18Uw.mjs.map} +1 -1
  297. package/dist/{email-console-DJP32ucW.mjs → email-console-CIf4Lfvv.mjs} +1 -1
  298. package/dist/{email-console-DJP32ucW.mjs.map → email-console-CIf4Lfvv.mjs.map} +1 -1
  299. package/dist/{error-rVGiqWDt.mjs → error-CkAseSqZ.mjs} +2 -2
  300. package/dist/{error-rVGiqWDt.mjs.map → error-CkAseSqZ.mjs.map} +1 -1
  301. package/dist/{escape-Bjio4ZsM.mjs → escape-DqD0aCKu.mjs} +1 -1
  302. package/dist/{escape-Bjio4ZsM.mjs.map → escape-DqD0aCKu.mjs.map} +1 -1
  303. package/dist/{field-defs-cache-ljXzJCfc.mjs → field-defs-cache-WUI88LX5.mjs} +2 -2
  304. package/dist/{field-defs-cache-ljXzJCfc.mjs.map → field-defs-cache-WUI88LX5.mjs.map} +1 -1
  305. package/dist/{fts-manager-BbCCbEKA.mjs → fts-manager-BbFaF_V8.mjs} +2 -2
  306. package/dist/{fts-manager-BbCCbEKA.mjs.map → fts-manager-BbFaF_V8.mjs.map} +1 -1
  307. package/dist/{import-Bb1T9WJS.mjs → import-fYLf14Co.mjs} +514 -25
  308. package/dist/import-fYLf14Co.mjs.map +1 -0
  309. package/dist/{index-BRNabKrx.d.mts → index-B9sIxwe4.d.mts} +2420 -2379
  310. package/dist/index-B9sIxwe4.d.mts.map +1 -0
  311. package/dist/{index-Dt0OKJB4.d.mts → index-Bm-Gy8Mh.d.mts} +25 -4
  312. package/dist/index-Bm-Gy8Mh.d.mts.map +1 -0
  313. package/dist/index.d.mts +18 -17
  314. package/dist/index.mjs +54 -53
  315. package/dist/{load-DMjXghbZ.mjs → load-Djn3HWQS.mjs} +2 -2
  316. package/dist/{load-DMjXghbZ.mjs.map → load-Djn3HWQS.mjs.map} +1 -1
  317. package/dist/{loader-BA_zhkS_.mjs → loader-CB6YHeul.mjs} +6 -5
  318. package/dist/loader-CB6YHeul.mjs.map +1 -0
  319. package/dist/{manifest-schema-kPGX7VS-.mjs → manifest-schema-BHlgZM1W.mjs} +1 -1
  320. package/dist/{manifest-schema-kPGX7VS-.mjs.map → manifest-schema-BHlgZM1W.mjs.map} +1 -1
  321. package/dist/media/index.d.mts +1 -1
  322. package/dist/media/local-runtime.d.mts +12 -11
  323. package/dist/media/local-runtime.d.mts.map +1 -1
  324. package/dist/media/local-runtime.mjs +5 -5
  325. package/dist/{media-C5t_eCnk.mjs → media-BrXIaMFN.mjs} +2 -2
  326. package/dist/{media-C5t_eCnk.mjs.map → media-BrXIaMFN.mjs.map} +1 -1
  327. package/dist/{media-allowlist-Du8t1u6a.mjs → media-allowlist-CRHEeJ_i.mjs} +1 -1
  328. package/dist/{media-allowlist-Du8t1u6a.mjs.map → media-allowlist-CRHEeJ_i.mjs.map} +1 -1
  329. package/dist/{media-url-O4rm9-SQ.mjs → media-url-CKi5XSw4.mjs} +1 -1
  330. package/dist/{media-url-O4rm9-SQ.mjs.map → media-url-CKi5XSw4.mjs.map} +1 -1
  331. package/dist/{menus-CBb6UrMU.mjs → menus-Cfivc2Ad.mjs} +3 -3
  332. package/dist/{menus-CBb6UrMU.mjs.map → menus-Cfivc2Ad.mjs.map} +1 -1
  333. package/dist/{menus-CYH09a41.mjs → menus-CsZ2ZEK2.mjs} +16 -12
  334. package/dist/{menus-CYH09a41.mjs.map → menus-CsZ2ZEK2.mjs.map} +1 -1
  335. package/dist/{mode-BB0F8xTC.mjs → mode-BM9QgEmt.mjs} +1 -1
  336. package/dist/{mode-BB0F8xTC.mjs.map → mode-BM9QgEmt.mjs.map} +1 -1
  337. package/dist/{oauth-authorization-CsvzIp_F.mjs → oauth-authorization-CXWkIGT4.mjs} +4 -4
  338. package/dist/{oauth-authorization-CsvzIp_F.mjs.map → oauth-authorization-CXWkIGT4.mjs.map} +1 -1
  339. package/dist/{oauth-clients-C9SYwEbZ.mjs → oauth-clients-BmTI5rsl.mjs} +1 -1
  340. package/dist/{oauth-clients-C9SYwEbZ.mjs.map → oauth-clients-BmTI5rsl.mjs.map} +1 -1
  341. package/dist/{oauth-state-store---zrApfB.mjs → oauth-state-store-YLFLcH5F.mjs} +1 -1
  342. package/dist/{oauth-state-store---zrApfB.mjs.map → oauth-state-store-YLFLcH5F.mjs.map} +1 -1
  343. package/dist/{oauth-user-lookup-SHsWRlG9.mjs → oauth-user-lookup-Bsc_GsX-.mjs} +1 -1
  344. package/dist/{oauth-user-lookup-SHsWRlG9.mjs.map → oauth-user-lookup-Bsc_GsX-.mjs.map} +1 -1
  345. package/dist/object-cache/memory.d.mts +1 -1
  346. package/dist/{object-cache-CHbHv83-.mjs → object-cache-Bok5j2ae.mjs} +43 -3
  347. package/dist/object-cache-Bok5j2ae.mjs.map +1 -0
  348. package/dist/{options-41nCWqi9.d.mts → options-iMpRRxIe.d.mts} +3 -3
  349. package/dist/{options-41nCWqi9.d.mts.map → options-iMpRRxIe.d.mts.map} +1 -1
  350. package/dist/page/index.d.mts +2 -2
  351. package/dist/{parse-BwAdS7FZ.mjs → parse-GmjecGct.mjs} +2 -2
  352. package/dist/{parse-BwAdS7FZ.mjs.map → parse-GmjecGct.mjs.map} +1 -1
  353. package/dist/{passkey-config-C0YfSBko.mjs → passkey-config-De0ahnRg.mjs} +1 -1
  354. package/dist/{passkey-config-C0YfSBko.mjs.map → passkey-config-De0ahnRg.mjs.map} +1 -1
  355. package/dist/{placeholder-Cuce9U-m.d.mts → placeholder-BSKwzRe4.d.mts} +1 -1
  356. package/dist/{placeholder-Cuce9U-m.d.mts.map → placeholder-BSKwzRe4.d.mts.map} +1 -1
  357. package/dist/plugin-types.d.mts +1 -1
  358. package/dist/plugin-utils.d.mts +10 -9
  359. package/dist/plugin-utils.d.mts.map +1 -1
  360. package/dist/plugins/adapt-sandbox-entry.d.mts +10 -9
  361. package/dist/plugins/adapt-sandbox-entry.d.mts.map +1 -1
  362. package/dist/plugins/adapt-sandbox-entry.mjs +2 -2
  363. package/dist/{portable-text-BICg8bTk.mjs → portable-text-cCa0cGV6.mjs} +1 -1
  364. package/dist/{portable-text-BICg8bTk.mjs.map → portable-text-cCa0cGV6.mjs.map} +1 -1
  365. package/dist/{preview-DKGCt2_p.mjs → preview-SSXNVPAC.mjs} +2 -2
  366. package/dist/{preview-DKGCt2_p.mjs.map → preview-SSXNVPAC.mjs.map} +1 -1
  367. package/dist/{public-url-CTVqgMmg.mjs → public-url-Danv47cS.mjs} +1 -1
  368. package/dist/{public-url-CTVqgMmg.mjs.map → public-url-Danv47cS.mjs.map} +1 -1
  369. package/dist/{query-BpQb-blG.mjs → query-ByGq6ver.mjs} +14 -14
  370. package/dist/{query-BpQb-blG.mjs.map → query-ByGq6ver.mjs.map} +1 -1
  371. package/dist/{rate-limit-Dap6HMNM.mjs → rate-limit-C_Lf63Dd.mjs} +2 -2
  372. package/dist/{rate-limit-Dap6HMNM.mjs.map → rate-limit-C_Lf63Dd.mjs.map} +1 -1
  373. package/dist/{redirect-CS-PHtNh.mjs → redirect-CoW3G-0U.mjs} +1 -1
  374. package/dist/{redirect-CS-PHtNh.mjs.map → redirect-CoW3G-0U.mjs.map} +1 -1
  375. package/dist/{redirect-_M0trWoo.mjs → redirect-IyfNirgS.mjs} +2 -2
  376. package/dist/{redirect-_M0trWoo.mjs.map → redirect-IyfNirgS.mjs.map} +1 -1
  377. package/dist/{redirects-w0V9vj_j.mjs → redirects-Bs1g42Ri.mjs} +4 -4
  378. package/dist/{redirects-w0V9vj_j.mjs.map → redirects-Bs1g42Ri.mjs.map} +1 -1
  379. package/dist/{redirects-Dcbuisoj.mjs → redirects-DXEXBAII.mjs} +2 -2
  380. package/dist/{redirects-Dcbuisoj.mjs.map → redirects-DXEXBAII.mjs.map} +1 -1
  381. package/dist/{registry-g8yYt4cC.mjs → registry-B65mUtPa.mjs} +122 -79
  382. package/dist/registry-B65mUtPa.mjs.map +1 -0
  383. package/dist/{request-meta-CmS1tDFf.mjs → request-meta-DbvXaAvU.mjs} +2 -2
  384. package/dist/{request-meta-CmS1tDFf.mjs.map → request-meta-DbvXaAvU.mjs.map} +1 -1
  385. package/dist/{resolve-C7I0qiR0.mjs → resolve-DR3wqMTy.mjs} +1 -1
  386. package/dist/{resolve-C7I0qiR0.mjs.map → resolve-DR3wqMTy.mjs.map} +1 -1
  387. package/dist/{runner-BbR3DfrL.d.mts → runner-DvFWoz8-.d.mts} +2 -2
  388. package/dist/{runner-BbR3DfrL.d.mts.map → runner-DvFWoz8-.d.mts.map} +1 -1
  389. package/dist/{runner-DPdt_Wpa.mjs → runner-K8XK101B.mjs} +351 -199
  390. package/dist/runner-K8XK101B.mjs.map +1 -0
  391. package/dist/runtime.d.mts +11 -10
  392. package/dist/runtime.d.mts.map +1 -1
  393. package/dist/runtime.mjs +2 -2
  394. package/dist/scheduled-publish-Drffrf2a.d.mts +11 -0
  395. package/dist/scheduled-publish-Drffrf2a.d.mts.map +1 -0
  396. package/dist/{schema-DoLd3j2e.mjs → schema-Blhoxp3P.mjs} +5 -5
  397. package/dist/{schema-DoLd3j2e.mjs.map → schema-Blhoxp3P.mjs.map} +1 -1
  398. package/dist/{search-BR0ZeZmh.mjs → search-DZN2HZ-V.mjs} +6 -4
  399. package/dist/search-DZN2HZ-V.mjs.map +1 -0
  400. package/dist/{secrets-BSf9pRRY.mjs → secrets-kp760LlD.mjs} +2 -2
  401. package/dist/{secrets-BSf9pRRY.mjs.map → secrets-kp760LlD.mjs.map} +1 -1
  402. package/dist/{sections-5J2YJPqJ.mjs → sections-CpF5SaGr.mjs} +3 -3
  403. package/dist/{sections-5J2YJPqJ.mjs.map → sections-CpF5SaGr.mjs.map} +1 -1
  404. package/dist/seed/index.d.mts +2 -2
  405. package/dist/seed/index.mjs +19 -18
  406. package/dist/seo/index.d.mts +1 -1
  407. package/dist/seo/index.mjs +1 -1
  408. package/dist/{seo-BkhuuaaE.mjs → seo-89-53DDs.mjs} +1 -1
  409. package/dist/{seo-BkhuuaaE.mjs.map → seo-89-53DDs.mjs.map} +1 -1
  410. package/dist/{seo-DKeXHkzE.mjs → seo-DXu2UQnC.mjs} +3 -3
  411. package/dist/{seo-DKeXHkzE.mjs.map → seo-DXu2UQnC.mjs.map} +1 -1
  412. package/dist/{service-BbO2s8gT.mjs → service-DQmiBMzt.mjs} +3 -3
  413. package/dist/{service-BbO2s8gT.mjs.map → service-DQmiBMzt.mjs.map} +1 -1
  414. package/dist/{session-user-B8aLtKAH.mjs → session-user-Cascbax7.mjs} +1 -1
  415. package/dist/{session-user-B8aLtKAH.mjs.map → session-user-Cascbax7.mjs.map} +1 -1
  416. package/dist/{settings-BMNr9Dmi.mjs → settings-rZyHEcNT.mjs} +3 -3
  417. package/dist/{settings-BMNr9Dmi.mjs.map → settings-rZyHEcNT.mjs.map} +1 -1
  418. package/dist/{settings-DJeki-97.mjs → settings-zhmdKyJQ.mjs} +5 -5
  419. package/dist/{settings-DJeki-97.mjs.map → settings-zhmdKyJQ.mjs.map} +1 -1
  420. package/dist/{setup-complete-gEiySUc-.mjs → setup-complete-Cb3LRyzy.mjs} +1 -1
  421. package/dist/{setup-complete-gEiySUc-.mjs.map → setup-complete-Cb3LRyzy.mjs.map} +1 -1
  422. package/dist/{setup-nonce-DzS50zme.mjs → setup-nonce-Z8x0tHf8.mjs} +1 -1
  423. package/dist/{setup-nonce-DzS50zme.mjs.map → setup-nonce-Z8x0tHf8.mjs.map} +1 -1
  424. package/dist/{single-flight-cache-Cdfkic3t.mjs → single-flight-cache-BG3B_GhN.mjs} +1 -1
  425. package/dist/{single-flight-cache-Cdfkic3t.mjs.map → single-flight-cache-BG3B_GhN.mjs.map} +1 -1
  426. package/dist/{site-url-BLebyON8.mjs → site-url-BBfDTgZB.mjs} +1 -1
  427. package/dist/{site-url-BLebyON8.mjs.map → site-url-BBfDTgZB.mjs.map} +1 -1
  428. package/dist/{ssrf-BRKb343l.mjs → ssrf-1g7usGBg.mjs} +1 -1
  429. package/dist/{ssrf-BRKb343l.mjs.map → ssrf-1g7usGBg.mjs.map} +1 -1
  430. package/dist/{status-vUK0SA17.mjs → status-CqJQX1QN.mjs} +1 -1
  431. package/dist/{status-vUK0SA17.mjs.map → status-CqJQX1QN.mjs.map} +1 -1
  432. package/dist/storage/local.d.mts +1 -1
  433. package/dist/storage/local.mjs +1 -1
  434. package/dist/storage/s3.d.mts +1 -1
  435. package/dist/storage/s3.mjs +1 -1
  436. package/dist/{taxonomies-CM_fUqLU.mjs → taxonomies-BGBd16Eu.mjs} +4 -4
  437. package/dist/{taxonomies-CM_fUqLU.mjs.map → taxonomies-BGBd16Eu.mjs.map} +1 -1
  438. package/dist/{taxonomies-D13i2ctt.mjs → taxonomies-Cnb4F-Pb.mjs} +7 -7
  439. package/dist/{taxonomies-D13i2ctt.mjs.map → taxonomies-Cnb4F-Pb.mjs.map} +1 -1
  440. package/dist/{taxonomy-BU0LjdVb.mjs → taxonomy-BxGxZZdu.mjs} +4 -4
  441. package/dist/{taxonomy-BU0LjdVb.mjs.map → taxonomy-BxGxZZdu.mjs.map} +1 -1
  442. package/dist/{tokens-LeuXF9gG.mjs → tokens-BGT0TUUo.mjs} +1 -1
  443. package/dist/{tokens-LeuXF9gG.mjs.map → tokens-BGT0TUUo.mjs.map} +1 -1
  444. package/dist/{transport-BZ-03aFT.d.mts → transport-BMDWHSgZ.d.mts} +1 -1
  445. package/dist/{transport-BZ-03aFT.d.mts.map → transport-BMDWHSgZ.d.mts.map} +1 -1
  446. package/dist/{transport-_2nBz7e9.mjs → transport-DPefPMcz.mjs} +1 -1
  447. package/dist/{transport-_2nBz7e9.mjs.map → transport-DPefPMcz.mjs.map} +1 -1
  448. package/dist/{trusted-proxy-DZY5WCn2.mjs → trusted-proxy-VTPRiX2s.mjs} +1 -1
  449. package/dist/{trusted-proxy-DZY5WCn2.mjs.map → trusted-proxy-VTPRiX2s.mjs.map} +1 -1
  450. package/dist/{types-ETmO_jQr.d.mts → types-BcLUUbbR.d.mts} +2 -2
  451. package/dist/{types-ETmO_jQr.d.mts.map → types-BcLUUbbR.d.mts.map} +1 -1
  452. package/dist/{types-BYnDBVwe.d.mts → types-CGbYowGQ.d.mts} +2 -2
  453. package/dist/{types-BYnDBVwe.d.mts.map → types-CGbYowGQ.d.mts.map} +1 -1
  454. package/dist/{types-BWqGVhFn.d.mts → types-CgvhU-hF.d.mts} +1 -1
  455. package/dist/{types-BWqGVhFn.d.mts.map → types-CgvhU-hF.d.mts.map} +1 -1
  456. package/dist/{types-fS7-VTdR.d.mts → types-ClUkdbWb.d.mts} +1 -1
  457. package/dist/{types-fS7-VTdR.d.mts.map → types-ClUkdbWb.d.mts.map} +1 -1
  458. package/dist/{types-CZgK3EMW.mjs → types-CuW0zWDA.mjs} +2 -2
  459. package/dist/{types-CZgK3EMW.mjs.map → types-CuW0zWDA.mjs.map} +1 -1
  460. package/dist/{types-BG8_XTLj.d.mts → types-DmHk7vAt.d.mts} +1 -1
  461. package/dist/{types-BG8_XTLj.d.mts.map → types-DmHk7vAt.d.mts.map} +1 -1
  462. package/dist/{types-CQAugunJ.mjs → types-Jo3UYd6b.mjs} +1 -1
  463. package/dist/{types-CQAugunJ.mjs.map → types-Jo3UYd6b.mjs.map} +1 -1
  464. package/dist/{types-xIfVRNLp.d.mts → types-_HFLRzTn.d.mts} +22 -1
  465. package/dist/types-_HFLRzTn.d.mts.map +1 -0
  466. package/dist/{types-DrYMm9s5.d.mts → types-ea9sAPck.d.mts} +1 -1
  467. package/dist/{types-DrYMm9s5.d.mts.map → types-ea9sAPck.d.mts.map} +1 -1
  468. package/dist/{types-CNlaBFzx.d.mts → types-g_aFIdW0.d.mts} +1 -1
  469. package/dist/{types-CNlaBFzx.d.mts.map → types-g_aFIdW0.d.mts.map} +1 -1
  470. package/dist/{types-CUsXGRVj.d.mts → types-vgEWF18A.d.mts} +19 -1
  471. package/dist/{types-CUsXGRVj.d.mts.map → types-vgEWF18A.d.mts.map} +1 -1
  472. package/dist/{user-DkG2jKCp.mjs → user-BjAOvU3Z.mjs} +3 -3
  473. package/dist/{user-DkG2jKCp.mjs.map → user-BjAOvU3Z.mjs.map} +1 -1
  474. package/dist/{utils-B7A57fm9.mjs → utils-BJXElxdw.mjs} +156 -7
  475. package/dist/utils-BJXElxdw.mjs.map +1 -0
  476. package/dist/{validate-CuJ1Ps9j.mjs → validate-CWSnKVIJ.mjs} +2 -2
  477. package/dist/{validate-CuJ1Ps9j.mjs.map → validate-CWSnKVIJ.mjs.map} +1 -1
  478. package/dist/{validate-CG0V0wNR.d.mts → validate-Z1b86_3B.d.mts} +11 -6
  479. package/dist/{validate-CG0V0wNR.d.mts.map → validate-Z1b86_3B.d.mts.map} +1 -1
  480. package/dist/{validation-CwUfTdGF.mjs → validation-c8WjhH8z.mjs} +8 -5
  481. package/dist/{validation-CwUfTdGF.mjs.map → validation-c8WjhH8z.mjs.map} +1 -1
  482. package/dist/version-CaccU7DM.mjs +7 -0
  483. package/dist/{version-BoNBItP_.mjs.map → version-CaccU7DM.mjs.map} +1 -1
  484. package/dist/{widgets-BfOZ-ajY.mjs → widgets-hWcIicX8.mjs} +3 -3
  485. package/dist/{widgets-BfOZ-ajY.mjs.map → widgets-hWcIicX8.mjs.map} +1 -1
  486. package/dist/wxr-taxonomies-0_uxSrmf.d.mts +34 -0
  487. package/dist/wxr-taxonomies-0_uxSrmf.d.mts.map +1 -0
  488. package/dist/wxr-taxonomies-BC3OYpvx.mjs +425 -0
  489. package/dist/wxr-taxonomies-BC3OYpvx.mjs.map +1 -0
  490. package/dist/{zod-generator-gFsRuNNy.mjs → zod-generator-CacrR-i8.mjs} +2 -2
  491. package/dist/{zod-generator-gFsRuNNy.mjs.map → zod-generator-CacrR-i8.mjs.map} +1 -1
  492. package/package.json +6 -6
  493. package/src/api/handlers/content.ts +69 -23
  494. package/src/api/handlers/plugins.ts +77 -10
  495. package/src/api/schemas/import.ts +19 -0
  496. package/src/astro/integration/runtime.ts +3 -6
  497. package/src/astro/integration/vite-config.ts +19 -1
  498. package/src/astro/middleware/auth.ts +10 -3
  499. package/src/astro/middleware/csp.ts +54 -3
  500. package/src/astro/middleware.ts +1 -0
  501. package/src/astro/routes/admin.astro +9 -0
  502. package/src/astro/routes/api/admin/plugins/[id]/disable.ts +6 -1
  503. package/src/astro/routes/api/admin/plugins/[id]/enable.ts +6 -1
  504. package/src/astro/routes/api/admin/plugins/[id]/index.ts +1 -0
  505. package/src/astro/routes/api/admin/plugins/index.ts +1 -0
  506. package/src/astro/routes/api/import/wordpress/rewrite-urls.ts +122 -98
  507. package/src/astro/routes/api/import/wordpress-plugin/execute.ts +794 -44
  508. package/src/astro/routes/api/manifest.ts +20 -1
  509. package/src/astro/routes/api/setup/dev-bypass.ts +7 -2
  510. package/src/astro/types.ts +4 -0
  511. package/src/cli/commands/seed.ts +1 -1
  512. package/src/components/EmDashImage.astro +59 -23
  513. package/src/components/Image.astro +36 -35
  514. package/src/components/LiveSearch.astro +40 -4
  515. package/src/components/live-search-routing.ts +30 -0
  516. package/src/database/migrations/036_i18n_menus_and_taxonomies.ts +23 -18
  517. package/src/database/migrations/048_restore_content_taxonomies_term_index.ts +32 -0
  518. package/src/database/migrations/049_taxonomies_name_locale_index.ts +42 -0
  519. package/src/database/migrations/050_media_usage_index_status.ts +142 -0
  520. package/src/database/migrations/runner.ts +6 -0
  521. package/src/database/repositories/media-usage.ts +932 -58
  522. package/src/database/types.ts +22 -0
  523. package/src/emdash-runtime.ts +123 -3
  524. package/src/import/comments.ts +159 -0
  525. package/src/import/index.ts +8 -1
  526. package/src/import/settings.ts +65 -189
  527. package/src/import/sources/wordpress-plugin.ts +338 -42
  528. package/src/import/sources/wxr.ts +4 -1
  529. package/src/import/types.ts +12 -0
  530. package/src/import/utils.ts +207 -0
  531. package/src/import/wxr-taxonomies.ts +39 -0
  532. package/src/loader.ts +13 -2
  533. package/src/media/usage/content-fields.ts +119 -0
  534. package/src/media/usage/content-refresh.ts +524 -0
  535. package/src/media/usage/content-repair.ts +491 -0
  536. package/src/media/usage/content-snapshots.ts +435 -0
  537. package/src/media/usage/extractor.ts +4 -4
  538. package/src/media/usage/source-key.ts +22 -0
  539. package/src/menus/index.ts +17 -1
  540. package/src/object-cache/index.ts +82 -7
  541. package/src/plugins/context.ts +100 -71
  542. package/src/schema/registry.ts +240 -154
  543. package/src/search/query.ts +3 -0
  544. package/src/search/types.ts +2 -0
  545. package/src/seed/apply.ts +158 -101
  546. package/src/seed/types.ts +6 -1
  547. package/dist/api-BMfveMoB.mjs.map +0 -1
  548. package/dist/apply--IVNSdXn.mjs.map +0 -1
  549. package/dist/byline-fields-eyJMblSr.mjs.map +0 -1
  550. package/dist/context-C_g-iJVA.mjs.map +0 -1
  551. package/dist/import-Bb1T9WJS.mjs.map +0 -1
  552. package/dist/index-BRNabKrx.d.mts.map +0 -1
  553. package/dist/index-Dt0OKJB4.d.mts.map +0 -1
  554. package/dist/loader-BA_zhkS_.mjs.map +0 -1
  555. package/dist/object-cache-CHbHv83-.mjs.map +0 -1
  556. package/dist/registry-g8yYt4cC.mjs.map +0 -1
  557. package/dist/runner-DPdt_Wpa.mjs.map +0 -1
  558. package/dist/search-BR0ZeZmh.mjs.map +0 -1
  559. package/dist/types-xIfVRNLp.d.mts.map +0 -1
  560. package/dist/utils-B7A57fm9.mjs.map +0 -1
  561. package/dist/version-BoNBItP_.mjs +0 -7
  562. /package/dist/{api-tokens-B4BQybOp.mjs → api-tokens-DsvvCtdh.mjs} +0 -0
  563. /package/dist/{ssrf-CcX9zvMK.mjs → ssrf-CmuGgCq3.mjs} +0 -0
  564. /package/dist/{types-BvbeGEtr.mjs → types-DROWRxYV.mjs} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"byline-fields-2Lp5Hbgf.mjs","names":["authenticatorTransport","registrationCredential"],"sources":["../src/api/schemas/auth.ts","../src/api/schemas/import.ts","../src/api/schemas/setup.ts","../src/api/schemas/byline-fields.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { roleLevel } from \"./common.js\";\n\n// ---------------------------------------------------------------------------\n// WebAuthn credential schemas (matching @emdash-cms/auth/passkey types)\n// ---------------------------------------------------------------------------\n\nconst authenticatorTransport = z.enum([\"usb\", \"nfc\", \"ble\", \"internal\", \"hybrid\"]);\n\n/** RegistrationResponse — sent by the browser after navigator.credentials.create() */\nconst registrationCredential = z.object({\n\tid: z.string(),\n\trawId: z.string(),\n\ttype: z.literal(\"public-key\"),\n\tresponse: z.object({\n\t\tclientDataJSON: z.string(),\n\t\tattestationObject: z.string(),\n\t\ttransports: z.array(authenticatorTransport).optional(),\n\t}),\n\tauthenticatorAttachment: z.enum([\"platform\", \"cross-platform\"]).optional(),\n});\n\n/** AuthenticationResponse — sent by the browser after navigator.credentials.get() */\nconst authenticationCredential = z.object({\n\tid: z.string(),\n\trawId: z.string(),\n\ttype: z.literal(\"public-key\"),\n\tresponse: z.object({\n\t\tclientDataJSON: z.string(),\n\t\tauthenticatorData: z.string(),\n\t\tsignature: z.string(),\n\t\tuserHandle: z.string().optional(),\n\t}),\n\tauthenticatorAttachment: z.enum([\"platform\", \"cross-platform\"]).optional(),\n});\n\n// ---------------------------------------------------------------------------\n// Auth: Input schemas\n// ---------------------------------------------------------------------------\n\nexport const signupRequestBody = z\n\t.object({\n\t\temail: z.string().email(),\n\t})\n\t.meta({ id: \"SignupRequestBody\" });\n\nexport const signupCompleteBody = z\n\t.object({\n\t\ttoken: z.string().min(1),\n\t\tcredential: registrationCredential,\n\t\tname: z.string().optional(),\n\t})\n\t.meta({ id: \"SignupCompleteBody\" });\n\nexport const inviteCreateBody = z\n\t.object({\n\t\temail: z.string().email(),\n\t\trole: roleLevel.optional(),\n\t})\n\t.meta({ id: \"InviteCreateBody\" });\n\nexport const inviteRegisterOptionsBody = z\n\t.object({\n\t\ttoken: z.string().min(1),\n\t\tname: z.string().optional(),\n\t})\n\t.meta({ id: \"InviteRegisterOptionsBody\" });\n\nexport const inviteCompleteBody = z\n\t.object({\n\t\ttoken: z.string().min(1),\n\t\tcredential: registrationCredential,\n\t\tname: z.string().optional(),\n\t})\n\t.meta({ id: \"InviteCompleteBody\" });\n\nexport const magicLinkSendBody = z\n\t.object({\n\t\temail: z.string().email(),\n\t})\n\t.meta({ id: \"MagicLinkSendBody\" });\n\nexport const passkeyOptionsBody = z\n\t.object({\n\t\temail: z.string().email().optional(),\n\t})\n\t.meta({ id: \"PasskeyOptionsBody\" });\n\nexport const passkeyVerifyBody = z\n\t.object({\n\t\tcredential: authenticationCredential,\n\t})\n\t.meta({ id: \"PasskeyVerifyBody\" });\n\nexport const passkeyRegisterOptionsBody = z\n\t.object({\n\t\tname: z.string().optional(),\n\t})\n\t.meta({ id: \"PasskeyRegisterOptionsBody\" });\n\nexport const passkeyRegisterVerifyBody = z\n\t.object({\n\t\tcredential: registrationCredential,\n\t\tname: z.string().optional(),\n\t})\n\t.meta({ id: \"PasskeyRegisterVerifyBody\" });\n\nexport const passkeyRenameBody = z\n\t.object({\n\t\tname: z.string().min(1),\n\t})\n\t.meta({ id: \"PasskeyRenameBody\" });\n\nexport const authMeActionBody = z\n\t.object({\n\t\taction: z.string().min(1),\n\t})\n\t.meta({ id: \"AuthMeActionBody\" });\n","import { z } from \"zod\";\n\nimport { httpUrl } from \"./common.js\";\n\n// ---------------------------------------------------------------------------\n// Import\n// ---------------------------------------------------------------------------\n\nexport const importProbeBody = z.object({\n\turl: httpUrl,\n});\n\nexport const wpPluginAnalyzeBody = z.object({\n\turl: httpUrl,\n\ttoken: z.string().min(1),\n});\n\nexport const wpPluginExecuteBody = z.object({\n\turl: httpUrl,\n\ttoken: z.string().min(1),\n\tconfig: z.record(z.string(), z.unknown()),\n\t// --- Chunked mode (issue #475). Absent phase = single-shot legacy run. ---\n\t// The admin drives the import in a loop of bounded requests; cross-chunk\n\t// state travels with the client so the server stays stateless.\n\tphase: z.enum([\"content\", \"comments\", \"finalize\"]).optional(),\n\t/** Position within the phase: post-type index + WP page (content), page (comments) */\n\tcursor: z\n\t\t.object({\n\t\t\tpostTypeIndex: z.number().int().min(0).default(0),\n\t\t\tpage: z.number().int().min(1).default(1),\n\t\t})\n\t\t.optional(),\n\t/** WP post ID -> created EmDash item, accumulated across content chunks */\n\tidMap: z\n\t\t.record(z.string(), z.object({ id: z.string().min(1), collection: z.string().min(1) }))\n\t\t.optional(),\n\t/** Source translation group -> EmDash item ID, accumulated across content chunks */\n\ttranslationGroups: z.record(z.string(), z.string().min(1)).optional(),\n\t/** WP comment ID -> EmDash root comment ID, accumulated across comment chunks */\n\tcommentRoots: z.record(z.string(), z.string().min(1)).optional(),\n});\n\nexport const wpPrepareBody = z.object({\n\tpostTypes: z.array(\n\t\tz.object({\n\t\t\tname: z.string().min(1),\n\t\t\tcollection: z.string().min(1),\n\t\t\tfields: z\n\t\t\t\t.array(\n\t\t\t\t\tz.object({\n\t\t\t\t\t\tslug: z.string().min(1),\n\t\t\t\t\t\tlabel: z.string().min(1),\n\t\t\t\t\t\ttype: z.string().min(1),\n\t\t\t\t\t\trequired: z.boolean(),\n\t\t\t\t\t\tsearchable: z.boolean().optional(),\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t\t.optional(),\n\t\t}),\n\t),\n});\n\nexport const wpMediaImportBody = z.object({\n\tattachments: z.array(z.record(z.string(), z.unknown())),\n\tstream: z.boolean().optional(),\n});\n\nexport const wpRewriteUrlsBody = z.object({\n\turlMap: z.record(z.string(), z.string()),\n\tcollections: z.array(z.string()).optional(),\n});\n","import { z } from \"zod\";\n\n// ---------------------------------------------------------------------------\n// Setup\n// ---------------------------------------------------------------------------\n\n/** Registration credential — duplicated reference for setup flow.\n * The canonical definition lives in auth.ts but setup needs it independently\n * because setup runs before auth is configured. */\nconst authenticatorTransport = z.enum([\"usb\", \"nfc\", \"ble\", \"internal\", \"hybrid\"]);\n\nconst registrationCredential = z.object({\n\tid: z.string(),\n\trawId: z.string(),\n\ttype: z.literal(\"public-key\"),\n\tresponse: z.object({\n\t\tclientDataJSON: z.string(),\n\t\tattestationObject: z.string(),\n\t\ttransports: z.array(authenticatorTransport).optional(),\n\t}),\n\tauthenticatorAttachment: z.enum([\"platform\", \"cross-platform\"]).optional(),\n});\n\nexport const setupBody = z.object({\n\ttitle: z.string().min(1),\n\ttagline: z.string().optional(),\n\tincludeContent: z.boolean(),\n});\n\nexport const setupAdminBody = z.object({\n\temail: z.string().email(),\n\tname: z.string().optional(),\n});\n\nexport const setupAdminVerifyBody = z.object({\n\tcredential: registrationCredential,\n});\n\nexport const atprotoLoginBody = z.object({\n\thandle: z.string().trim().min(1),\n});\n\nexport const setupAtprotoAdminBody = z.object({\n\thandle: z.string().trim().min(1),\n});\n","/**\n * Zod schemas for the byline-fields admin API (Discussion #1174, Phase 4).\n *\n * Reserved-slug + identifier validation runs at the zod layer so the\n * route returns a clean 400 (`VALIDATION_ERROR` from `parseBody`) rather\n * than bubbling a registry-level `BylineSchemaError` (\"RESERVED_SLUG\" /\n * \"INVALID_SLUG\"). The registry repeats the same checks for non-HTTP\n * callers (seeds, scripts) — see `BylineSchemaRegistry.validateSlug`.\n *\n * Field types are constrained to the v1 subset declared in\n * `BYLINE_FIELD_TYPES`. Adding a type to the union there will require a\n * corresponding update to this enum.\n */\n\nimport { z } from \"zod\";\n\nimport { BYLINE_FIELD_TYPES, RESERVED_BYLINE_FIELD_SLUGS } from \"../../schema/types.js\";\n\n/**\n * Slug pattern for byline field definitions — matches the identifier rule\n * used by `validateIdentifier` (and `slugPattern` in `common.ts`).\n * Lowercase letters, digits, and underscores; must start with a letter.\n */\nconst bylineFieldSlugPattern = /^[a-z][a-z0-9_]*$/;\n\n/** Hard cap on a slug — mirrors `BylineSchemaRegistry.MAX_SLUG_LENGTH`. */\nconst MAX_SLUG_LENGTH = 63;\n/** Hard cap on a label — mirrors `BylineSchemaRegistry.MAX_LABEL_LENGTH`. */\nconst MAX_LABEL_LENGTH = 200;\n/** Hard cap on a select field's `options` list. */\nconst MAX_SELECT_OPTIONS = 200;\n\nconst RESERVED_SET: ReadonlySet<string> = new Set(RESERVED_BYLINE_FIELD_SLUGS);\n\n// Enumerate the v1 byline field types explicitly so zod gets the exact\n// literal union for `z.infer<>`. Mirrors `BYLINE_FIELD_TYPES`; CI's\n// type-checker catches drift via the satisfies/import below.\nconst bylineFieldTypeValues = z.enum([\"string\", \"text\", \"url\", \"boolean\", \"select\"]);\n// Compile-time guard: a drift here trips the satisfies check.\ntype _BylineFieldTypeDriftCheck =\n\t(typeof BYLINE_FIELD_TYPES)[number] extends z.infer<typeof bylineFieldTypeValues>\n\t\t? z.infer<typeof bylineFieldTypeValues> extends (typeof BYLINE_FIELD_TYPES)[number]\n\t\t\t? true\n\t\t\t: never\n\t\t: never;\nconst _bylineFieldTypeDriftCheck: _BylineFieldTypeDriftCheck = true;\nvoid _bylineFieldTypeDriftCheck;\n\n/**\n * Validation payload for a byline custom field. v1 only exposes\n * `options` (used by `select`-type fields). Empty/duplicate options are\n * rejected at the registry layer; the zod layer only enforces shape and\n * caps. Future field types may add keys here.\n */\nconst bylineFieldValidationSchema = z\n\t.object({\n\t\toptions: z\n\t\t\t.array(z.string().min(1))\n\t\t\t.min(1, \"select options must contain at least one entry\")\n\t\t\t.max(MAX_SELECT_OPTIONS, `select options cannot exceed ${MAX_SELECT_OPTIONS} entries`)\n\t\t\t.optional(),\n\t})\n\t.strict()\n\t.nullable();\n\n/**\n * Slug validation chain shared by create + reorder bodies. Centralised so\n * the reserved-slug message and pattern are identical everywhere.\n */\nconst bylineFieldSlug = z\n\t.string()\n\t.min(1, \"Byline field slug is required\")\n\t.max(MAX_SLUG_LENGTH, `Byline field slug must be ${MAX_SLUG_LENGTH} characters or less`)\n\t.regex(\n\t\tbylineFieldSlugPattern,\n\t\t\"Byline field slug must contain only lowercase letters, digits, and underscores, and start with a letter\",\n\t)\n\t.refine((slug) => !RESERVED_SET.has(slug), {\n\t\t// Surface the offending slug in the validation issue path-message\n\t\t// for easier debugging from the admin UI's error toast.\n\t\tmessage: \"Byline field slug is reserved\",\n\t});\n\nconst bylineFieldLabel = z\n\t.string()\n\t.min(1, \"Byline field label is required\")\n\t.max(MAX_LABEL_LENGTH, `Byline field label must be ${MAX_LABEL_LENGTH} characters or less`);\n\n// ---------------------------------------------------------------------------\n// Request bodies\n// ---------------------------------------------------------------------------\n\nexport const bylineFieldCreateBody = z\n\t.object({\n\t\tslug: bylineFieldSlug,\n\t\tlabel: bylineFieldLabel,\n\t\ttype: bylineFieldTypeValues,\n\t\trequired: z.boolean().optional(),\n\t\t/**\n\t\t * Whether values are stored per-locale (translatable, default) or\n\t\t * shared across the translation group. See `BylineFieldDefinition`.\n\t\t */\n\t\ttranslatable: z.boolean().optional(),\n\t\tvalidation: bylineFieldValidationSchema.optional(),\n\t\tsortOrder: z.number().int().min(0).optional(),\n\t})\n\t.strict()\n\t.meta({ id: \"BylineFieldCreateBody\" });\n\n/**\n * Update body. `slug` and `type` are intentionally absent — both are\n * immutable post-create (changing them would invalidate stored values).\n * `translatable` flips are gated at the registry layer when value rows\n * exist (`TRANSLATABLE_LOCKED`).\n */\nexport const bylineFieldUpdateBody = z\n\t.object({\n\t\tlabel: bylineFieldLabel.optional(),\n\t\trequired: z.boolean().optional(),\n\t\ttranslatable: z.boolean().optional(),\n\t\tvalidation: bylineFieldValidationSchema.optional(),\n\t\tsortOrder: z.number().int().min(0).optional(),\n\t})\n\t.strict()\n\t.meta({ id: \"BylineFieldUpdateBody\" });\n\nexport const bylineFieldReorderBody = z\n\t.object({\n\t\t/**\n\t\t * Exact set of currently registered slugs in the desired order.\n\t\t * The registry rejects any drift (`REORDER_MISMATCH`); the zod\n\t\t * layer enforces slug shape only. An empty array is permitted —\n\t\t * `reorderFields([])` is a valid no-op when zero fields are\n\t\t * registered (registry contract). Rejecting empty here would\n\t\t * produce a spurious 400 for an admin UI that submits a reorder\n\t\t * after deleting the last field.\n\t\t */\n\t\tslugs: z.array(bylineFieldSlug),\n\t})\n\t.strict()\n\t.meta({ id: \"BylineFieldReorderBody\" });\n\n// ---------------------------------------------------------------------------\n// Response shapes\n// ---------------------------------------------------------------------------\n\nexport const bylineFieldDefinitionSchema = z\n\t.object({\n\t\tid: z.string(),\n\t\tslug: z.string(),\n\t\tlabel: z.string(),\n\t\ttype: bylineFieldTypeValues,\n\t\trequired: z.boolean(),\n\t\ttranslatable: z.boolean(),\n\t\tvalidation: z\n\t\t\t.object({\n\t\t\t\toptions: z.array(z.string()).optional(),\n\t\t\t})\n\t\t\t.nullable(),\n\t\tsortOrder: z.number().int(),\n\t\tcreatedAt: z.string(),\n\t\tupdatedAt: z.string(),\n\t})\n\t.meta({ id: \"BylineFieldDefinition\" });\n\nexport const bylineFieldListResponseSchema = z\n\t.object({\n\t\titems: z.array(bylineFieldDefinitionSchema),\n\t})\n\t.meta({ id: \"BylineFieldListResponse\" });\n\n/**\n * Response shape for `GET /api/admin/byline-fields/[slug]/usage`.\n *\n * `translatableValueCount` counts rows in `_emdash_byline_field_values`.\n * `groupValueCount` counts rows in `_emdash_byline_field_group_values`.\n * `totalAffectedRows` is the sum — what the destructive-delete confirm\n * dialog surfaces. Both individual counts are exposed for diagnostic\n * value (e.g. inconsistency with the field's current `translatable`\n * flag would show non-zero on the \"wrong\" side).\n */\nexport const bylineFieldUsageResponseSchema = z\n\t.object({\n\t\ttranslatableValueCount: z.number().int().nonnegative(),\n\t\tgroupValueCount: z.number().int().nonnegative(),\n\t\ttotalAffectedRows: z.number().int().nonnegative(),\n\t})\n\t.meta({ id: \"BylineFieldUsageResponse\" });\n"],"mappings":";;;;;AAQA,MAAMA,2BAAyB,EAAE,KAAK;CAAC;CAAO;CAAO;CAAO;CAAY;CAAS,CAAC;;AAGlF,MAAMC,2BAAyB,EAAE,OAAO;CACvC,IAAI,EAAE,QAAQ;CACd,OAAO,EAAE,QAAQ;CACjB,MAAM,EAAE,QAAQ,aAAa;CAC7B,UAAU,EAAE,OAAO;EAClB,gBAAgB,EAAE,QAAQ;EAC1B,mBAAmB,EAAE,QAAQ;EAC7B,YAAY,EAAE,MAAMD,yBAAuB,CAAC,UAAU;EACtD,CAAC;CACF,yBAAyB,EAAE,KAAK,CAAC,YAAY,iBAAiB,CAAC,CAAC,UAAU;CAC1E,CAAC;;AAGF,MAAM,2BAA2B,EAAE,OAAO;CACzC,IAAI,EAAE,QAAQ;CACd,OAAO,EAAE,QAAQ;CACjB,MAAM,EAAE,QAAQ,aAAa;CAC7B,UAAU,EAAE,OAAO;EAClB,gBAAgB,EAAE,QA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AAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU,EACvC,CAAC,CACD,UAAU;CACZ,WAAW,EAAE,QAAQ,CAAC,KAAK;CAC3B,WAAW,EAAE,QAAQ;CACrB,WAAW,EAAE,QAAQ;CACrB,CAAC,CACD,KAAK,EAAE,IAAI,yBAAyB,CAAC;AAEvC,MAAa,gCAAgC,EAC3C,OAAO,EACP,OAAO,EAAE,MAAM,4BAA4B,EAC3C,CAAC,CACD,KAAK,EAAE,IAAI,2BAA2B,CAAC;;;;;;;;;;;AAYzC,MAAa,iCAAiC,EAC5C,OAAO;CACP,wBAAwB,EAAE,QAAQ,CAAC,KAAK,CAAC,aAAa;CACtD,iBAAiB,EAAE,QAAQ,CAAC,KAAK,CAAC,aAAa;CAC/C,mBAAmB,EAAE,QAAQ,CAAC,KAAK,CAAC,aAAa;CACjD,CAAC,CACD,KAAK,EAAE,IAAI,4BAA4B,CAAC"}
@@ -120,4 +120,4 @@ async function handleBylineFieldReorder(db, slugs) {
120
120
 
121
121
  //#endregion
122
122
  export { handleBylineFieldReorder as a, handleBylineFieldList as i, handleBylineFieldDelete as n, handleBylineFieldUpdate as o, handleBylineFieldGet as r, handleBylineFieldUsage as s, handleBylineFieldCreate as t };
123
- //# sourceMappingURL=byline-fields-DaMKzkhO.mjs.map
123
+ //# sourceMappingURL=byline-fields-CIx_GuN4.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"byline-fields-DaMKzkhO.mjs","names":[],"sources":["../src/api/handlers/byline-fields.ts"],"sourcesContent":["/**\n * Handler layer for the byline-fields admin API (Phase 4 of Discussion\n * #1174).\n *\n * Each handler:\n * - Takes the `Kysely<Database>` from the route, returns `ApiResult<T>`.\n * - Wraps the registry call in try/catch.\n * - Translates `BylineSchemaError` → shared `ErrorCode` via\n * `mapBylineSchemaError`. HTTP status comes from `mapErrorStatus` at\n * the route's `unwrapResult` site — handlers don't know about\n * statuses.\n * - Catches everything else, logs server-side, returns a 500-class\n * code without leaking `error.message`.\n *\n * Reserved-slug + identifier validation runs at the zod layer (see\n * `schemas/byline-fields.ts`); the registry repeats it for defence in\n * depth (non-HTTP callers). This module assumes inputs have already\n * passed through whichever zod schema the route used.\n */\n\nimport type { Kysely } from \"kysely\";\n\nimport type { Database } from \"../../database/types.js\";\nimport {\n\tBylineSchemaError,\n\tBylineSchemaRegistry,\n\tmapBylineSchemaError,\n} from \"../../schema/byline-registry.js\";\nimport type {\n\tBylineFieldDefinition,\n\tCreateBylineFieldInput,\n\tUpdateBylineFieldInput,\n} from \"../../schema/types.js\";\nimport type { ApiResult } from \"../types.js\";\n\n/**\n * Build a structured failure envelope from a `BylineSchemaError`.\n * Centralised so every handler emits the same shape.\n */\nfunction bylineSchemaErrorResult<T>(error: BylineSchemaError): ApiResult<T> {\n\tconst mapped = mapBylineSchemaError(error);\n\treturn {\n\t\tsuccess: false,\n\t\terror: { code: mapped.code, message: mapped.message, details: mapped.details },\n\t};\n}\n\n/**\n * Build a 500-class failure envelope. Logs the underlying error\n * server-side; the message returned to the client is the static\n * fallback to avoid leaking internals.\n */\nfunction internalErrorResult<T>(\n\terror: unknown,\n\tcode: string,\n\tfallbackMessage: string,\n): ApiResult<T> {\n\tconsole.error(`[${code}]`, error);\n\treturn {\n\t\tsuccess: false,\n\t\terror: { code, message: fallbackMessage },\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// List\n// ---------------------------------------------------------------------------\n\nexport async function handleBylineFieldList(\n\tdb: Kysely<Database>,\n): Promise<ApiResult<{ items: BylineFieldDefinition[] }>> {\n\ttry {\n\t\tconst items = await new BylineSchemaRegistry(db).listFields();\n\t\treturn { success: true, data: { items } };\n\t} catch (error) {\n\t\treturn internalErrorResult(error, \"SCHEMA_FIELD_LIST_ERROR\", \"Failed to list byline fields\");\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Create\n// ---------------------------------------------------------------------------\n\nexport async function handleBylineFieldCreate(\n\tdb: Kysely<Database>,\n\tinput: CreateBylineFieldInput,\n): Promise<ApiResult<BylineFieldDefinition>> {\n\ttry {\n\t\tconst field = await new BylineSchemaRegistry(db).createField(input);\n\t\treturn { success: true, data: field };\n\t} catch (error) {\n\t\tif (error instanceof BylineSchemaError) {\n\t\t\treturn bylineSchemaErrorResult(error);\n\t\t}\n\t\treturn internalErrorResult(error, \"SCHEMA_FIELD_CREATE_ERROR\", \"Failed to create byline field\");\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Get one\n// ---------------------------------------------------------------------------\n\nexport async function handleBylineFieldGet(\n\tdb: Kysely<Database>,\n\tslug: string,\n): Promise<ApiResult<BylineFieldDefinition>> {\n\ttry {\n\t\tconst field = await new BylineSchemaRegistry(db).getField(slug);\n\t\tif (!field) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"NOT_FOUND\", message: \"Byline field not found\" },\n\t\t\t};\n\t\t}\n\t\treturn { success: true, data: field };\n\t} catch (error) {\n\t\treturn internalErrorResult(error, \"SCHEMA_FIELD_GET_ERROR\", \"Failed to get byline field\");\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Update\n// ---------------------------------------------------------------------------\n\nexport async function handleBylineFieldUpdate(\n\tdb: Kysely<Database>,\n\tslug: string,\n\tinput: UpdateBylineFieldInput,\n): Promise<ApiResult<BylineFieldDefinition>> {\n\ttry {\n\t\tconst field = await new BylineSchemaRegistry(db).updateField(slug, input);\n\t\treturn { success: true, data: field };\n\t} catch (error) {\n\t\tif (error instanceof BylineSchemaError) {\n\t\t\treturn bylineSchemaErrorResult(error);\n\t\t}\n\t\treturn internalErrorResult(error, \"SCHEMA_FIELD_UPDATE_ERROR\", \"Failed to update byline field\");\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Delete\n// ---------------------------------------------------------------------------\n\nexport async function handleBylineFieldDelete(\n\tdb: Kysely<Database>,\n\tslug: string,\n): Promise<ApiResult<{ deleted: true }>> {\n\ttry {\n\t\tawait new BylineSchemaRegistry(db).deleteField(slug);\n\t\treturn { success: true, data: { deleted: true } };\n\t} catch (error) {\n\t\tif (error instanceof BylineSchemaError) {\n\t\t\treturn bylineSchemaErrorResult(error);\n\t\t}\n\t\treturn internalErrorResult(error, \"SCHEMA_FIELD_DELETE_ERROR\", \"Failed to delete byline field\");\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Usage\n// ---------------------------------------------------------------------------\n\nexport async function handleBylineFieldUsage(\n\tdb: Kysely<Database>,\n\tslug: string,\n): Promise<\n\tApiResult<{\n\t\ttranslatableValueCount: number;\n\t\tgroupValueCount: number;\n\t\ttotalAffectedRows: number;\n\t}>\n> {\n\ttry {\n\t\tconst usage = await new BylineSchemaRegistry(db).getFieldUsage(slug);\n\t\treturn { success: true, data: usage };\n\t} catch (error) {\n\t\tif (error instanceof BylineSchemaError) {\n\t\t\treturn bylineSchemaErrorResult(error);\n\t\t}\n\t\treturn internalErrorResult(\n\t\t\terror,\n\t\t\t\"SCHEMA_FIELD_GET_ERROR\",\n\t\t\t\"Failed to read byline field usage\",\n\t\t);\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Reorder\n// ---------------------------------------------------------------------------\n\nexport async function handleBylineFieldReorder(\n\tdb: Kysely<Database>,\n\tslugs: string[],\n): Promise<ApiResult<{ items: BylineFieldDefinition[] }>> {\n\ttry {\n\t\tconst registry = new BylineSchemaRegistry(db);\n\t\tawait registry.reorderFields(slugs);\n\t\tconst items = await registry.listFields();\n\t\treturn { success: true, data: { items } };\n\t} catch (error) {\n\t\tif (error instanceof BylineSchemaError) {\n\t\t\treturn bylineSchemaErrorResult(error);\n\t\t}\n\t\treturn internalErrorResult(\n\t\t\terror,\n\t\t\t\"SCHEMA_FIELD_REORDER_ERROR\",\n\t\t\t\"Failed to reorder byline fields\",\n\t\t);\n\t}\n}\n"],"mappings":";;;;;;;AAuCA,SAAS,wBAA2B,OAAwC;CAC3E,MAAM,SAAS,qBAAqB,MAAM;AAC1C,QAAO;EACN,SAAS;EACT,OAAO;GAAE,MAAM,OAAO;GAAM,SAAS,O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I,qBAAqB,GAAG,CAAC,YAAY,KAAK;AACpD,SAAO;GAAE,SAAS;GAAM,MAAM,EAAE,SAAS,MAAM;GAAE;UACzC,OAAO;AACf,MAAI,iBAAiB,kBACpB,QAAO,wBAAwB,MAAM;AAEtC,SAAO,oBAAoB,OAAO,6BAA6B,gCAAgC;;;AAQjG,eAAsB,uBACrB,IACA,MAOC;AACD,KAAI;AAEH,SAAO;GAAE,SAAS;GAAM,MADV,MAAM,IAAI,qBAAqB,GAAG,CAAC,cAAc,KAAK;GAC/B;UAC7B,OAAO;AACf,MAAI,iBAAiB,kBACpB,QAAO,wBAAwB,MAAM;AAEtC,SAAO,oBACN,OACA,0BACA,oCACA;;;AAQH,eAAsB,yBACrB,IACA,OACyD;AACzD,KAAI;EACH,MAAM,WAAW,IAAI,qBAAqB,GAAG;AAC7C,QAAM,SAAS,cAAc,MAAM;AAEnC,SAAO;GAAE,SAAS;GAAM,MAAM,EAAE,OADlB,MAAM,SAAS,YAAY,EACF;GAAE;UACjC,OAAO;AACf,MAAI,iBAAiB,kBACpB,QAAO,wBAAwB,MAAM;AAEtC,SAAO,oBACN,OACA,8BACA,kCACA"}
1
+ {"version":3,"file":"byline-fields-CIx_GuN4.mjs","names":[],"sources":["../src/api/handlers/byline-fields.ts"],"sourcesContent":["/**\n * Handler layer for the byline-fields admin API (Phase 4 of Discussion\n * #1174).\n *\n * Each handler:\n * - Takes the `Kysely<Database>` from the route, returns `ApiResult<T>`.\n * - Wraps the registry call in try/catch.\n * - Translates `BylineSchemaError` → shared `ErrorCode` via\n * `mapBylineSchemaError`. HTTP status comes from `mapErrorStatus` at\n * the route's `unwrapResult` site — handlers don't know about\n * statuses.\n * - Catches everything else, logs server-side, returns a 500-class\n * code without leaking `error.message`.\n *\n * Reserved-slug + identifier validation runs at the zod layer (see\n * `schemas/byline-fields.ts`); the registry repeats it for defence in\n * depth (non-HTTP callers). This module assumes inputs have already\n * passed through whichever zod schema the route used.\n */\n\nimport type { Kysely } from \"kysely\";\n\nimport type { Database } from \"../../database/types.js\";\nimport {\n\tBylineSchemaError,\n\tBylineSchemaRegistry,\n\tmapBylineSchemaError,\n} from \"../../schema/byline-registry.js\";\nimport type {\n\tBylineFieldDefinition,\n\tCreateBylineFieldInput,\n\tUpdateBylineFieldInput,\n} from \"../../schema/types.js\";\nimport type { ApiResult } from \"../types.js\";\n\n/**\n * Build a structured failure envelope from a `BylineSchemaError`.\n * Centralised so every handler emits the same shape.\n */\nfunction bylineSchemaErrorResult<T>(error: BylineSchemaError): ApiResult<T> {\n\tconst mapped = mapBylineSchemaError(error);\n\treturn {\n\t\tsuccess: false,\n\t\terror: { code: mapped.code, message: mapped.message, details: mapped.details },\n\t};\n}\n\n/**\n * Build a 500-class failure envelope. Logs the underlying error\n * server-side; the message returned to the client is the static\n * fallback to avoid leaking internals.\n */\nfunction internalErrorResult<T>(\n\terror: unknown,\n\tcode: string,\n\tfallbackMessage: string,\n): ApiResult<T> {\n\tconsole.error(`[${code}]`, error);\n\treturn {\n\t\tsuccess: false,\n\t\terror: { code, message: fallbackMessage },\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// List\n// ---------------------------------------------------------------------------\n\nexport async function handleBylineFieldList(\n\tdb: Kysely<Database>,\n): Promise<ApiResult<{ items: BylineFieldDefinition[] }>> {\n\ttry {\n\t\tconst items = await new BylineSchemaRegistry(db).listFields();\n\t\treturn { success: true, data: { items } };\n\t} catch (error) {\n\t\treturn internalErrorResult(error, \"SCHEMA_FIELD_LIST_ERROR\", \"Failed to list byline fields\");\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Create\n// ---------------------------------------------------------------------------\n\nexport async function handleBylineFieldCreate(\n\tdb: Kysely<Database>,\n\tinput: CreateBylineFieldInput,\n): Promise<ApiResult<BylineFieldDefinition>> {\n\ttry {\n\t\tconst field = await new BylineSchemaRegistry(db).createField(input);\n\t\treturn { success: true, data: field };\n\t} catch (error) {\n\t\tif (error instanceof BylineSchemaError) {\n\t\t\treturn bylineSchemaErrorResult(error);\n\t\t}\n\t\treturn internalErrorResult(error, \"SCHEMA_FIELD_CREATE_ERROR\", \"Failed to create byline field\");\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Get one\n// ---------------------------------------------------------------------------\n\nexport async function handleBylineFieldGet(\n\tdb: Kysely<Database>,\n\tslug: string,\n): Promise<ApiResult<BylineFieldDefinition>> {\n\ttry {\n\t\tconst field = await new BylineSchemaRegistry(db).getField(slug);\n\t\tif (!field) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"NOT_FOUND\", message: \"Byline field not found\" },\n\t\t\t};\n\t\t}\n\t\treturn { success: true, data: field };\n\t} catch (error) {\n\t\treturn internalErrorResult(error, \"SCHEMA_FIELD_GET_ERROR\", \"Failed to get byline field\");\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Update\n// ---------------------------------------------------------------------------\n\nexport async function handleBylineFieldUpdate(\n\tdb: Kysely<Database>,\n\tslug: string,\n\tinput: UpdateBylineFieldInput,\n): Promise<ApiResult<BylineFieldDefinition>> {\n\ttry {\n\t\tconst field = await new BylineSchemaRegistry(db).updateField(slug, input);\n\t\treturn { success: true, data: field };\n\t} catch (error) {\n\t\tif (error instanceof BylineSchemaError) {\n\t\t\treturn bylineSchemaErrorResult(error);\n\t\t}\n\t\treturn internalErrorResult(error, \"SCHEMA_FIELD_UPDATE_ERROR\", \"Failed to update byline field\");\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Delete\n// ---------------------------------------------------------------------------\n\nexport async function handleBylineFieldDelete(\n\tdb: Kysely<Database>,\n\tslug: string,\n): Promise<ApiResult<{ deleted: true }>> {\n\ttry {\n\t\tawait new BylineSchemaRegistry(db).deleteField(slug);\n\t\treturn { success: true, data: { deleted: true } };\n\t} catch (error) {\n\t\tif (error instanceof BylineSchemaError) {\n\t\t\treturn bylineSchemaErrorResult(error);\n\t\t}\n\t\treturn internalErrorResult(error, \"SCHEMA_FIELD_DELETE_ERROR\", \"Failed to delete byline field\");\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Usage\n// ---------------------------------------------------------------------------\n\nexport async function handleBylineFieldUsage(\n\tdb: Kysely<Database>,\n\tslug: string,\n): Promise<\n\tApiResult<{\n\t\ttranslatableValueCount: number;\n\t\tgroupValueCount: number;\n\t\ttotalAffectedRows: number;\n\t}>\n> {\n\ttry {\n\t\tconst usage = await new BylineSchemaRegistry(db).getFieldUsage(slug);\n\t\treturn { success: true, data: usage };\n\t} catch (error) {\n\t\tif (error instanceof BylineSchemaError) {\n\t\t\treturn bylineSchemaErrorResult(error);\n\t\t}\n\t\treturn internalErrorResult(\n\t\t\terror,\n\t\t\t\"SCHEMA_FIELD_GET_ERROR\",\n\t\t\t\"Failed to read byline field usage\",\n\t\t);\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Reorder\n// ---------------------------------------------------------------------------\n\nexport async function handleBylineFieldReorder(\n\tdb: Kysely<Database>,\n\tslugs: string[],\n): Promise<ApiResult<{ items: BylineFieldDefinition[] }>> {\n\ttry {\n\t\tconst registry = new BylineSchemaRegistry(db);\n\t\tawait registry.reorderFields(slugs);\n\t\tconst items = await registry.listFields();\n\t\treturn { success: true, data: { items } };\n\t} catch (error) {\n\t\tif (error instanceof BylineSchemaError) {\n\t\t\treturn bylineSchemaErrorResult(error);\n\t\t}\n\t\treturn internalErrorResult(\n\t\t\terror,\n\t\t\t\"SCHEMA_FIELD_REORDER_ERROR\",\n\t\t\t\"Failed to reorder byline fields\",\n\t\t);\n\t}\n}\n"],"mappings":";;;;;;;AAuCA,SAAS,wBAA2B,OAAwC;CAC3E,MAAM,SAAS,qBAAqB,MAAM;AAC1C,QAAO;EACN,SAAS;EACT,OAAO;GAAE,MAAM,OAAO;GAAM,SAAS,OAAO;GAAS,SAAS,OAAO;GAAS;EAC9E;;;;;;;AAQF,SAAS,oBACR,OACA,MACA,iBACe;AACf,SAAQ,MAAM,IAAI,KAAK,IAAI,MAAM;AACjC,QAAO;EACN,SAAS;EACT,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,MAAM;AAEtC,SAAO,oBAAoB,OAAO,6BAA6B,gCAAgC;;;AAQjG,eAAsB,uBACrB,IACA,MAOC;AACD,KAAI;AAEH,SAAO;GAAE,SAAS;GAAM,MADV,MAAM,IAAI,qBAAqB,GAAG,CAAC,cAAc,KAAK;GAC/B;UAC7B,OAAO;AACf,MAAI,iBAAiB,kBACpB,QAAO,wBAAwB,MAAM;AAEtC,SAAO,oBACN,OACA,0BACA,oCACA;;;AAQH,eAAsB,yBACrB,IACA,OACyD;AACzD,KAAI;EACH,MAAM,WAAW,IAAI,qBAAqB,GAAG;AAC7C,QAAM,SAAS,cAAc,MAAM;AAEnC,SAAO;GAAE,SAAS;GAAM,MAAM,EAAE,OADlB,MAAM,SAAS,YAAY,EACF;GAAE;UACjC,OAAO;AACf,MAAI,iBAAiB,kBACpB,QAAO,wBAAwB,MAAM;AAEtC,SAAO,oBACN,OACA,8BACA,kCACA"}
@@ -1212,8 +1212,8 @@ declare const authMeActionBody: z.ZodObject<{
1212
1212
  * from `referenceCollection` + `referenceId` (a translation_group id).
1213
1213
  */
1214
1214
  declare const menuItemTypeEnum: z.ZodEnum<{
1215
- custom: "custom";
1216
1215
  collection: "collection";
1216
+ custom: "custom";
1217
1217
  page: "page";
1218
1218
  post: "post";
1219
1219
  taxonomy: "taxonomy";
@@ -1229,8 +1229,8 @@ declare const updateMenuBody: z.ZodObject<{
1229
1229
  }, z.core.$strict>;
1230
1230
  declare const createMenuItemBody: z.ZodObject<{
1231
1231
  type: z.ZodEnum<{
1232
- custom: "custom";
1233
1232
  collection: "collection";
1233
+ custom: "custom";
1234
1234
  page: "page";
1235
1235
  post: "post";
1236
1236
  taxonomy: "taxonomy";
@@ -1643,6 +1643,21 @@ declare const wpPluginExecuteBody: z.ZodObject<{
1643
1643
  url: z.ZodString;
1644
1644
  token: z.ZodString;
1645
1645
  config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1646
+ phase: z.ZodOptional<z.ZodEnum<{
1647
+ content: "content";
1648
+ comments: "comments";
1649
+ finalize: "finalize";
1650
+ }>>;
1651
+ cursor: z.ZodOptional<z.ZodObject<{
1652
+ postTypeIndex: z.ZodDefault<z.ZodNumber>;
1653
+ page: z.ZodDefault<z.ZodNumber>;
1654
+ }, z.core.$strip>>;
1655
+ idMap: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1656
+ id: z.ZodString;
1657
+ collection: z.ZodString;
1658
+ }, z.core.$strip>>>;
1659
+ translationGroups: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1660
+ commentRoots: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1646
1661
  }, z.core.$strip>;
1647
1662
  declare const wpPrepareBody: z.ZodObject<{
1648
1663
  postTypes: z.ZodArray<z.ZodObject<{
@@ -2212,4 +2227,4 @@ declare const bylineFieldUsageResponseSchema: z.ZodObject<{
2212
2227
  }, z.core.$strip>;
2213
2228
  //#endregion
2214
2229
  export { wpRewriteUrlsBody as $, trashedContentItemSchema as $n, commentSchema as $t, reorderWidgetsBody as A, mediaProviderListQuery as An, menuSchema as At, userSchema as B, contentListQuery as Bn, magicLinkSendBody as Bt, notFoundSummarySchema as C, formatFileSize as Cn, termWithCountSchema as Ct, updateRedirectBody as D, mediaItemSchema as Dn, menuItemSchema as Dt, redirectsListQuery as E, mediaExistingResponseSchema as En, createMenuItemBody as Et, widgetSchema as F, contentAuthorSchema as Fn, updateMenuItemBody as Ft, setupAdminVerifyBody as G, contentScheduleBody as Gn, passkeyVerifyBody as Gt, usersListQuery as H, contentPreviewUrlBody as Hn, passkeyRegisterOptionsBody as Ht, allowedDomainCreateBody as I, contentAuthorsResponseSchema as In, authMeActionBody as It, importProbeBody as J, contentTermsBody as Jn, adminCommentListResponseSchema as Jt, setupAtprotoAdminBody as K, contentSeoInput as Kn, signupCompleteBody as Kt, allowedDomainUpdateBody as L, contentCompareResponseSchema as Ln, inviteCompleteBody as Lt, widgetAreaSchema as M, mediaUpdateBody as Mn, menuWithItemsSchema as Mt, widgetAreaWithWidgetsAndCountSchema as N, mediaUploadUrlBody as Nn, reorderMenuItemsBody as Nt, createWidgetAreaBody as O, mediaListQuery as On, menuItemTypeEnum as Ot, widgetAreaWithWidgetsSchema as P, mediaUploadUrlResponseSchema as Pn, updateMenuBody as Pt, wpPrepareBody as Q, contentUpdateBody as Qn, commentListQuery as Qt, userDetailSchema as R, contentCreateBody as Rn, inviteCreateBody as Rt, notFoundSummaryResponseSchema as S, DEFAULT_MAX_UPLOAD_SIZE as Sn, termTranslationsSchema as St, redirectSchema as T, mediaConfirmResponseSchema as Tn, createMenuBody as Tt, atprotoLoginBody as U, contentPublishBody as Un, passkeyRegisterVerifyBody as Ut, userUpdateBody as V, contentListResponseSchema as Vn, passkeyOptionsBody as Vt, setupAdminBody as W, contentResponseSchema as Wn, passkeyRenameBody as Wt, wpPluginAnalyzeBody as X, contentTranslationsResponseSchema as Xn, commentBulkResponseSchema as Xt, wpMediaImportBody as Y, contentTranslationSchema as Yn, commentBulkBody as Yt, wpPluginExecuteBody as Z, contentTrashQuery as Zn, commentCountsResponseSchema as Zt, notFoundEntrySchema as _, orphanedTableListResponseSchema as _n, taxonomyListResponseSchema as _t, bylineFieldUpdateBody as a, collectionGetQuery as an, deleteResponseSchema as ar, searchSuggestQuery as at, notFoundPruneBody as b, updateCollectionBody as bn, termResponseSchema as bt, bylineCreditSchema as c, collectionSchema as cn, localeFilterQuery as cr, createSectionBody as ct, bylineTranslationCreateBody as d, createFieldBody as dn, slugPattern as dr, sectionsListQuery as dt, commentStatusBody as en, trashedContentListResponseSchema as er, searchEnableBody as et, bylineTranslationsResponseSchema as f, fieldListResponseSchema as fn, successEnvelope as fr, updateSectionBody as ft, createRedirectBody as g, orphanRegisterBody as gn, taxonomyDefTranslationsSchema as gt, contentBylineInputSchema as h, fieldSchema as hn, taxonomyDefSchema as ht, bylineFieldReorderBody as i, publicCommentSchema as in, cursorPaginationQuery as ir, searchResultSchema as it, updateWidgetBody as j, mediaResponseSchema as jn, menuTranslationsSchema as jt, createWidgetBody as k, mediaListResponseSchema as kn, menuListItemSchema as kt, bylineListResponseSchema as l, collectionWithFieldsResponseSchema as ln, offsetPaginationQuery as lr, sectionListResponseSchema as lt, bylinesListQuery as m, fieldResponseSchema as mn, createTermBody as mt, bylineFieldDefinitionSchema as n, createReactionBody as nn, apiErrorSchema as nr, searchRebuildBody as nt, bylineFieldUsageResponseSchema as o, collectionListResponseSchema as on, httpUrl as or, settingsUpdateBody as ot, bylineUpdateBody as p, fieldReorderBody as pn, createTaxonomyDefBody as pt, setupBody as q, contentSeoSchema as qn, signupRequestBody as qt, bylineFieldListResponseSchema as r, publicCommentListResponseSchema as rn, countResponseSchema as rr, searchResponseSchema as rt, bylineCreateBody as s, collectionResponseSchema as sn, localeCode as sr, siteSettingsSchema as st, bylineFieldCreateBody as t, createCommentBody as tn, VALID_ROLE_LEVELS as tr, searchQuery as tt, bylineSummarySchema as u, createCollectionBody as un, roleLevel as ur, sectionSchema as ut, notFoundListQuery as v, orphanedTableSchema as vn, termGetResponseSchema as vt, redirectListResponseSchema as w, mediaConfirmBody as wn, updateTermBody as wt, notFoundSummaryQuery as x, updateFieldBody as xn, termSchema as xt, notFoundListResponseSchema as y, schemaExportQuery as yn, termListResponseSchema as yt, userListResponseSchema as z, contentItemSchema as zn, inviteRegisterOptionsBody as zt };
2215
- //# sourceMappingURL=byline-fields-KD3JFRuH.d.mts.map
2230
+ //# sourceMappingURL=byline-fields-Cgrt9-aL.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"byline-fields-KD3JFRuH.d.mts","names":[],"sources":["../src/api/schemas/common.ts","../src/api/schemas/content.ts","../src/api/schemas/media.ts","../src/api/schemas/schema.ts","../src/api/schemas/comments.ts","../src/api/schemas/auth.ts","../src/api/schemas/menus.ts","../src/api/schemas/taxonomies.ts","../src/api/schemas/sections.ts","../src/api/schemas/settings.ts","../src/api/schemas/search.ts","../src/api/schemas/import.ts","../src/api/schemas/setup.ts","../src/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A,SAAA;;;;;;;;;cAWrB,sBAAA,EAAsB,CAAA,CAAA,SAAA;;;cAoBtB,2BAAA,EAA2B,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;cAmB3B,6BAAA,EAA6B,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;AjBnH1C;;;;;AAMA;ciB6Ha,8BAAA,EAA8B,CAAA,CAAA,SAAA"}
1
+ {"version":3,"file":"byline-fields-Cgrt9-aL.d.mts","names":[],"sources":["../src/api/schemas/common.ts","../src/api/schemas/content.ts","../src/api/schemas/media.ts","../src/api/schemas/schema.ts","../src/api/schemas/comments.ts","../src/api/schemas/auth.ts","../src/api/schemas/menus.ts","../src/api/schemas/taxonomies.ts","../src/api/schemas/sections.ts","../src/api/schemas/settings.ts","../src/api/schemas/search.ts","../src/api/schemas/import.ts","../src/api/schemas/setup.ts","../src/api/schemas/users.ts","../src/api/schemas/widgets.ts","../src/api/schemas/redirects.ts","../src/api/schemas/bylines.ts","../src/api/schemas/byline-fields.ts"],"mappings":";;;;cAOa,iBAAA,EAAiB,GAAA;AAA9B;AAAA,cAGa,SAAA,EAAS,CAAA,CAAA,gBAAA,YAAA,CAAA,CAAA,OAAA,kCAAA,CAAA,CAAA,IAAA,CAAA,iBAAA;;cAYT,qBAAA,EAAqB,CAAA,CAAA,SAAA;;;;;cAUrB,qBAAA,EAAqB,CAAA,CAAA,SAAA;;;;;cAYrB,WAAA,EAAW,MAAA;;cAMX,OAAA,EAAO,CAAA,CAAA,SAAA;;cAMP,UAAA,EAAU,CAAA,CAAA,OAAA,CAAA,CAAA,CAAA,SAAA,EAAA,CAAA,CAAA,YAAA;;cAMV,iBAAA,EAAiB,CAAA,CAAA,SAAA;;;AAxC9B;AAAA,cAmDa,cAAA,EAAc,CAAA,CAAA,SAAA;;;;;;;iBAUX,eAAA,WAA0B,CAAA,CAAE,OAAA,CAAA,CAAS,UAAA,EAAY,CAAA,GAAC,CAAA,CAAA,SAAA;;;;cAKr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;;;;;;;;;;;;;;;;;;cAgDnB,kBAAA,EAAkB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;cAWlB,wBAAA,EAAwB,CAAA,CAAA,SAAA;;;;cAOxB,gBAAA,EAAgB,CAAA,CAAA,SAAA;;;;;;;;cAchB,gBAAA,EAAgB,CAAA,CAAA,SAAA;;;;;;;;;;;;cAuChB,2BAAA,EAA2B,CAAA,CAAA,SAAA;;;;;;;;cAe3B,gCAAA,EAAgC,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;cAMhC,gBAAA,EAAgB,CAAA,CAAA,SAAA;;;;;;;;;;cA4BhB,wBAAA,EAAwB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;cCnFxB,qBAAA,EAAqB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;cAuBrB,qBAAA,EAAqB,CAAA,CAAA,SAAA;;;;;;;;;cAWrB,sBAAA,EAAsB,CAAA,CAAA,SAAA;;;cAoBtB,2BAAA,EAA2B,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;cAmB3B,6BAAA,EAA6B,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;AjBnH1C;;;;;AAMA;ciB6Ha,8BAAA,EAA8B,CAAA,CAAA,SAAA"}
@@ -1,7 +1,7 @@
1
- import { a as __exportAll } from "./runner-DPdt_Wpa.mjs";
1
+ import { a as __exportAll } from "./runner-K8XK101B.mjs";
2
2
  import { n as getI18nConfig } from "./config-CVssduLe.mjs";
3
- import { t as EmDashValidationError } from "./types-CZgK3EMW.mjs";
4
- import { t as BylineRepository } from "./byline-LL8lyqdb.mjs";
3
+ import { t as EmDashValidationError } from "./types-CuW0zWDA.mjs";
4
+ import { t as BylineRepository } from "./byline-Bm8ZgUP9.mjs";
5
5
 
6
6
  //#region src/api/handlers/bylines.ts
7
7
  var bylines_exports = /* @__PURE__ */ __exportAll({
@@ -207,4 +207,4 @@ async function handleBylineUpdate(db, id, input) {
207
207
 
208
208
  //#endregion
209
209
  export { handleBylineUpdate as i, handleBylineCreate as n, handleBylineTranslations as r, bylines_exports as t };
210
- //# sourceMappingURL=bylines-BmJ7Vg7J.mjs.map
210
+ //# sourceMappingURL=bylines-6tm9mgQb.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"bylines-BmJ7Vg7J.mjs","names":[],"sources":["../src/api/handlers/bylines.ts"],"sourcesContent":["import type { Kysely } from \"kysely\";\n\nimport {\n\tBylineRepository,\n\ttype CreateBylineInput,\n\ttype UpdateBylineInput,\n} from \"../../database/repositories/byline.js\";\nimport { EmDashValidationError, type BylineSummary } from \"../../database/repositories/types.js\";\nimport type { Database } from \"../../database/types.js\";\nimport { getI18nConfig } from \"../../i18n/config.js\";\nimport type { ApiResult } from \"../types.js\";\n\n// `undefined → null` so a missing field in the create payload matches the\n// repo's stored `null` (BylineRepository normalises with `?? null` on write).\nconst norm = (v: string | null | undefined): string | null => v ?? null;\n\n/**\n * Whether the existing byline row's fixed columns match a fresh-create\n * payload after null/undefined normalisation. Used by the D1 create-retry\n * recovery branch.\n */\nfunction bylineFixedFieldsMatch(\n\texisting: BylineSummary,\n\tinput: CreateBylineInput,\n\teffectiveLocale: string,\n): boolean {\n\treturn (\n\t\texisting.displayName === input.displayName &&\n\t\tnorm(existing.bio) === norm(input.bio) &&\n\t\tnorm(existing.avatarMediaId) === norm(input.avatarMediaId) &&\n\t\tnorm(existing.websiteUrl) === norm(input.websiteUrl) &&\n\t\tnorm(existing.userId) === norm(input.userId) &&\n\t\texisting.isGuest === (input.isGuest ?? false) &&\n\t\texisting.locale === effectiveLocale\n\t);\n}\n\n/**\n * Whether every key in `existing` appears in `input` with the same value.\n * Allows `input` to contain additional keys (the partial-write recovery\n * case); rejects on a divergent value or a key the input omits.\n */\nfunction existingCustomFieldsAreSubsetOf(\n\texisting: Record<string, unknown>,\n\tinput: Record<string, unknown> | undefined,\n): boolean {\n\tif (!input) return Object.keys(existing).length === 0;\n\tfor (const [slug, value] of Object.entries(existing)) {\n\t\tif (!Object.hasOwn(input, slug)) return false;\n\t\tif (input[slug] !== value) return false;\n\t}\n\treturn true;\n}\n\n/**\n * Reject locales the site doesn't configure. Returns `null` when the locale\n * is fine (omitted, or matches `locales` in the i18n config, or i18n isn't\n * configured at all).\n */\nfunction rejectUnknownLocale(locale: string | undefined): ApiResult<never> | null {\n\tif (!locale) return null;\n\tconst config = getI18nConfig();\n\tif (!config) return null;\n\tif (config.locales.includes(locale)) return null;\n\treturn {\n\t\tsuccess: false,\n\t\terror: {\n\t\t\tcode: \"VALIDATION_ERROR\",\n\t\t\tmessage: `Locale \"${locale}\" is not configured for this site`,\n\t\t},\n\t};\n}\n\n/**\n * Business-logic helpers for the bylines admin API.\n *\n * Mirrors the shape of `packages/core/src/api/handlers/menus.ts`. Route files\n * stay thin: they parse input, call these handlers, and forward the result via\n * `unwrapResult`. The repository (`BylineRepository`) is strict per locale; the\n * handlers add validation and translation-flow guards on top.\n */\n\nexport interface BylineTranslationsResponse {\n\titems: BylineSummary[];\n}\n\n/**\n * List every translation of a byline (by row id). Returns NOT_FOUND when no\n * row with the given id exists.\n */\nexport async function handleBylineTranslations(\n\tdb: Kysely<Database>,\n\tid: string,\n): Promise<ApiResult<BylineTranslationsResponse>> {\n\ttry {\n\t\tconst repo = new BylineRepository(db);\n\t\tconst anchor = await repo.findById(id);\n\t\tif (!anchor) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"NOT_FOUND\", message: \"Byline not found\" },\n\t\t\t};\n\t\t}\n\t\tconst items = await repo.listTranslations(id);\n\t\treturn { success: true, data: { items } };\n\t} catch {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"BYLINE_TRANSLATIONS_ERROR\",\n\t\t\t\tmessage: \"Failed to list byline translations\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Create a new byline. When `translationOf` is supplied, the new row joins the\n * source byline's translation_group (a sibling in the same logical identity).\n *\n * Translating from a source row only makes sense when the caller names the\n * target locale, otherwise we'd silently clone into the configured default,\n * which is almost never what's intended (and will collide if the source is\n * already the default-locale row). Mirrors `handleMenuCreate`.\n */\nexport async function handleBylineCreate(\n\tdb: Kysely<Database>,\n\tinput: CreateBylineInput,\n): Promise<ApiResult<BylineSummary>> {\n\ttry {\n\t\tif (input.translationOf && !input.locale) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"VALIDATION_ERROR\",\n\t\t\t\t\tmessage: \"`locale` is required when `translationOf` is provided\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst localeErr = rejectUnknownLocale(input.locale);\n\t\tif (localeErr) return localeErr;\n\n\t\tconst repo = new BylineRepository(db);\n\n\t\t// Existence check up front so the repo's \"Source not found\" throw\n\t\t// becomes a clean NOT_FOUND on the API.\n\t\tlet sourceGroup: string | undefined;\n\t\tif (input.translationOf) {\n\t\t\tconst source = await repo.findById(input.translationOf);\n\t\t\tif (!source) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\t\tmessage: \"Source byline for translation not found\",\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t\tsourceGroup = source.translationGroup ?? source.id;\n\t\t}\n\n\t\tconst effectiveLocale = input.locale ?? getI18nConfig()?.defaultLocale ?? \"en\";\n\n\t\t// Translation-group guard: the row-per-locale model (PR #916)\n\t\t// allows exactly one row per (translation_group, locale). Reject\n\t\t// here so callers get a clean 409 instead of a UNIQUE constraint\n\t\t// failure from the partial index. The DB constraint is the safety\n\t\t// net; this is the friendly error.\n\t\tif (sourceGroup) {\n\t\t\tconst siblings = await repo.findByTranslationGroup(sourceGroup);\n\t\t\tif (siblings.some((b) => b.locale === effectiveLocale)) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode: \"CONFLICT\",\n\t\t\t\t\t\tmessage: `Translation already exists in locale \"${effectiveLocale}\" for this byline`,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\t// Duplicate guard: same (slug, locale) — matches the DB unique key\n\t\t// from migration 040.\n\t\tconst existing = await repo.findBySlug(input.slug, { locale: effectiveLocale });\n\t\tif (existing) {\n\t\t\t// D1 has no transactions, so a crash between the byline insert\n\t\t\t// and the per-field writes leaves a partial row that's\n\t\t\t// otherwise unrecoverable. Treat a same-identity retry that\n\t\t\t// provides customFields as completing the abandoned create.\n\t\t\t// Recovery requires fixed-column + translation-group +\n\t\t\t// subset-customFields match; anything else collapses to a\n\t\t\t// standard duplicate-slug conflict.\n\t\t\tconst expectedTranslationGroup = sourceGroup ?? existing.id;\n\t\t\tconst inputHasFields = !!input.customFields && Object.keys(input.customFields).length > 0;\n\t\t\tif (\n\t\t\t\tinputHasFields &&\n\t\t\t\tbylineFixedFieldsMatch(existing, input, effectiveLocale) &&\n\t\t\t\texisting.translationGroup === expectedTranslationGroup &&\n\t\t\t\texistingCustomFieldsAreSubsetOf(existing.customFields ?? {}, input.customFields)\n\t\t\t) {\n\t\t\t\tconst recovered = await repo.update(existing.id, {\n\t\t\t\t\tcustomFields: input.customFields,\n\t\t\t\t});\n\t\t\t\tif (recovered) return { success: true, data: recovered };\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"CONFLICT\",\n\t\t\t\t\tmessage: `Byline \"${input.slug}\" already exists${\n\t\t\t\t\t\tinput.locale ? ` in locale \"${input.locale}\"` : \"\"\n\t\t\t\t\t}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst byline = await repo.create(input);\n\t\treturn { success: true, data: byline };\n\t} catch (error) {\n\t\t// Mirror handleBylineUpdate: surface customFields validation\n\t\t// errors as 400 rather than swallowing them as a generic 500.\n\t\tif (error instanceof EmDashValidationError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"VALIDATION_ERROR\", message: error.message },\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"[BYLINE_CREATE_ERROR]\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: { code: \"BYLINE_CREATE_ERROR\", message: \"Failed to create byline\" },\n\t\t};\n\t}\n}\n\n/**\n * Update an existing byline. Forwards every field on `UpdateBylineInput`\n * to `BylineRepository.update`, including the Phase 3 `customFields`\n * map; per-field type validation lives in the repo, which throws\n * `EmDashValidationError` on unknown slugs, type mismatches, or\n * `select`-choice misses. This handler translates that into a clean\n * `VALIDATION_ERROR` (400 via `mapErrorStatus`).\n *\n * Returns `NOT_FOUND` when the byline id doesn't resolve. Generic\n * failures surface as `BYLINE_UPDATE_ERROR` (500) without leaking the\n * underlying message.\n */\nexport async function handleBylineUpdate(\n\tdb: Kysely<Database>,\n\tid: string,\n\tinput: UpdateBylineInput,\n): Promise<ApiResult<BylineSummary>> {\n\ttry {\n\t\tconst repo = new BylineRepository(db);\n\t\tconst byline = await repo.update(id, input);\n\t\tif (!byline) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"NOT_FOUND\", message: \"Byline not found\" },\n\t\t\t};\n\t\t}\n\t\treturn { success: true, data: byline };\n\t} catch (error) {\n\t\t// Unknown-key + type-mismatch + select-choice writes throw\n\t\t// EmDashValidationError (Phase 3, see BylineRepository.update).\n\t\t// Map to a clean 400 — the error message names the offending\n\t\t// slug/type, which is safe to surface to the admin client.\n\t\tif (error instanceof EmDashValidationError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"VALIDATION_ERROR\", message: error.message },\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"[BYLINE_UPDATE_ERROR]\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: { code: \"B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;IACT,OAAO;KACN,MAAM;KACN,SAAS,WAAW,MAAM,KAAK,kBAC9B,MAAM,SAAS,eAAe,MAAM,OAAO,KAAK;KAEjD;IACD;;AAIF,SAAO;GAAE,SAAS;GAAM,MADT,MAAM,KAAK,OAAO,MAAM;GACD;UAC9B,OAAO;AAGf,MAAI,iBAAiB,sBACpB,QAAO;GACN,SAAS;GACT,OAAO;IAAE,MAAM;IAAoB,SAAS,MAAM;IAAS;GAC3D;AAEF,UAAQ,MAAM,yBAAyB,MAAM;AAC7C,SAAO;GACN,SAAS;GACT,OAAO;IAAE,MAAM;IAAuB,SAAS;IAA2B;GAC1E;;;;;;;;;;;;;;;AAgBH,eAAsB,mBACrB,IACA,IACA,OACoC;AACpC,KAAI;EAEH,MAAM,SAAS,MADF,IAAI,iBAAiB,GAAG,CACX,OAAO,IAAI,MAAM;AAC3C,MAAI,CAAC,OACJ,QAAO;GACN,SAAS;GACT,OAAO;IAAE,MAAM;IAAa,SAAS;IAAoB;GACzD;AAEF,SAAO;GAAE,SAAS;GAAM,MAAM;GAAQ;UAC9B,OAAO;AAKf,MAAI,iBAAiB,sBACpB,QAAO;GACN,SAAS;GACT,OAAO;IAAE,MAAM;IAAoB,SAAS,MAAM;IAAS;GAC3D;AAEF,UAAQ,MAAM,yBAAyB,MAAM;AAC7C,SAAO;GACN,SAAS;GACT,OAAO;IAAE,MAAM;IAAuB,SAAS;IAA2B;GAC1E"}
1
+ {"version":3,"file":"bylines-6tm9mgQb.mjs","names":[],"sources":["../src/api/handlers/bylines.ts"],"sourcesContent":["import type { Kysely } from \"kysely\";\n\nimport {\n\tBylineRepository,\n\ttype CreateBylineInput,\n\ttype UpdateBylineInput,\n} from \"../../database/repositories/byline.js\";\nimport { EmDashValidationError, type BylineSummary } from \"../../database/repositories/types.js\";\nimport type { Database } from \"../../database/types.js\";\nimport { getI18nConfig } from \"../../i18n/config.js\";\nimport type { ApiResult } from \"../types.js\";\n\n// `undefined → null` so a missing field in the create payload matches the\n// repo's stored `null` (BylineRepository normalises with `?? null` on write).\nconst norm = (v: string | null | undefined): string | null => v ?? null;\n\n/**\n * Whether the existing byline row's fixed columns match a fresh-create\n * payload after null/undefined normalisation. Used by the D1 create-retry\n * recovery branch.\n */\nfunction bylineFixedFieldsMatch(\n\texisting: BylineSummary,\n\tinput: CreateBylineInput,\n\teffectiveLocale: string,\n): boolean {\n\treturn (\n\t\texisting.displayName === input.displayName &&\n\t\tnorm(existing.bio) === norm(input.bio) &&\n\t\tnorm(existing.avatarMediaId) === norm(input.avatarMediaId) &&\n\t\tnorm(existing.websiteUrl) === norm(input.websiteUrl) &&\n\t\tnorm(existing.userId) === norm(input.userId) &&\n\t\texisting.isGuest === (input.isGuest ?? false) &&\n\t\texisting.locale === effectiveLocale\n\t);\n}\n\n/**\n * Whether every key in `existing` appears in `input` with the same value.\n * Allows `input` to contain additional keys (the partial-write recovery\n * case); rejects on a divergent value or a key the input omits.\n */\nfunction existingCustomFieldsAreSubsetOf(\n\texisting: Record<string, unknown>,\n\tinput: Record<string, unknown> | undefined,\n): boolean {\n\tif (!input) return Object.keys(existing).length === 0;\n\tfor (const [slug, value] of Object.entries(existing)) {\n\t\tif (!Object.hasOwn(input, slug)) return false;\n\t\tif (input[slug] !== value) return false;\n\t}\n\treturn true;\n}\n\n/**\n * Reject locales the site doesn't configure. Returns `null` when the locale\n * is fine (omitted, or matches `locales` in the i18n config, or i18n isn't\n * configured at all).\n */\nfunction rejectUnknownLocale(locale: string | undefined): ApiResult<never> | null {\n\tif (!locale) return null;\n\tconst config = getI18nConfig();\n\tif (!config) return null;\n\tif (config.locales.includes(locale)) return null;\n\treturn {\n\t\tsuccess: false,\n\t\terror: {\n\t\t\tcode: \"VALIDATION_ERROR\",\n\t\t\tmessage: `Locale \"${locale}\" is not configured for this site`,\n\t\t},\n\t};\n}\n\n/**\n * Business-logic helpers for the bylines admin API.\n *\n * Mirrors the shape of `packages/core/src/api/handlers/menus.ts`. Route files\n * stay thin: they parse input, call these handlers, and forward the result via\n * `unwrapResult`. The repository (`BylineRepository`) is strict per locale; the\n * handlers add validation and translation-flow guards on top.\n */\n\nexport interface BylineTranslationsResponse {\n\titems: BylineSummary[];\n}\n\n/**\n * List every translation of a byline (by row id). Returns NOT_FOUND when no\n * row with the given id exists.\n */\nexport async function handleBylineTranslations(\n\tdb: Kysely<Database>,\n\tid: string,\n): Promise<ApiResult<BylineTranslationsResponse>> {\n\ttry {\n\t\tconst repo = new BylineRepository(db);\n\t\tconst anchor = await repo.findById(id);\n\t\tif (!anchor) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"NOT_FOUND\", message: \"Byline not found\" },\n\t\t\t};\n\t\t}\n\t\tconst items = await repo.listTranslations(id);\n\t\treturn { success: true, data: { items } };\n\t} catch {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"BYLINE_TRANSLATIONS_ERROR\",\n\t\t\t\tmessage: \"Failed to list byline translations\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Create a new byline. When `translationOf` is supplied, the new row joins the\n * source byline's translation_group (a sibling in the same logical identity).\n *\n * Translating from a source row only makes sense when the caller names the\n * target locale, otherwise we'd silently clone into the configured default,\n * which is almost never what's intended (and will collide if the source is\n * already the default-locale row). Mirrors `handleMenuCreate`.\n */\nexport async function handleBylineCreate(\n\tdb: Kysely<Database>,\n\tinput: CreateBylineInput,\n): Promise<ApiResult<BylineSummary>> {\n\ttry {\n\t\tif (input.translationOf && !input.locale) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"VALIDATION_ERROR\",\n\t\t\t\t\tmessage: \"`locale` is required when `translationOf` is provided\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst localeErr = rejectUnknownLocale(input.locale);\n\t\tif (localeErr) return localeErr;\n\n\t\tconst repo = new BylineRepository(db);\n\n\t\t// Existence check up front so the repo's \"Source not found\" throw\n\t\t// becomes a clean NOT_FOUND on the API.\n\t\tlet sourceGroup: string | undefined;\n\t\tif (input.translationOf) {\n\t\t\tconst source = await repo.findById(input.translationOf);\n\t\t\tif (!source) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\t\tmessage: \"Source byline for translation not found\",\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t\tsourceGroup = source.translationGroup ?? source.id;\n\t\t}\n\n\t\tconst effectiveLocale = input.locale ?? getI18nConfig()?.defaultLocale ?? \"en\";\n\n\t\t// Translation-group guard: the row-per-locale model (PR #916)\n\t\t// allows exactly one row per (translation_group, locale). Reject\n\t\t// here so callers get a clean 409 instead of a UNIQUE constraint\n\t\t// failure from the partial index. The DB constraint is the safety\n\t\t// net; this is the friendly error.\n\t\tif (sourceGroup) {\n\t\t\tconst siblings = await repo.findByTranslationGroup(sourceGroup);\n\t\t\tif (siblings.some((b) => b.locale === effectiveLocale)) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode: \"CONFLICT\",\n\t\t\t\t\t\tmessage: `Translation already exists in locale \"${effectiveLocale}\" for this byline`,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\t// Duplicate guard: same (slug, locale) — matches the DB unique key\n\t\t// from migration 040.\n\t\tconst existing = await repo.findBySlug(input.slug, { locale: effectiveLocale });\n\t\tif (existing) {\n\t\t\t// D1 has no transactions, so a crash between the byline insert\n\t\t\t// and the per-field writes leaves a partial row that's\n\t\t\t// otherwise unrecoverable. Treat a same-identity retry that\n\t\t\t// provides customFields as completing the abandoned create.\n\t\t\t// Recovery requires fixed-column + translation-group +\n\t\t\t// subset-customFields match; anything else collapses to a\n\t\t\t// standard duplicate-slug conflict.\n\t\t\tconst expectedTranslationGroup = sourceGroup ?? existing.id;\n\t\t\tconst inputHasFields = !!input.customFields && Object.keys(input.customFields).length > 0;\n\t\t\tif (\n\t\t\t\tinputHasFields &&\n\t\t\t\tbylineFixedFieldsMatch(existing, input, effectiveLocale) &&\n\t\t\t\texisting.translationGroup === expectedTranslationGroup &&\n\t\t\t\texistingCustomFieldsAreSubsetOf(existing.customFields ?? {}, input.customFields)\n\t\t\t) {\n\t\t\t\tconst recovered = await repo.update(existing.id, {\n\t\t\t\t\tcustomFields: input.customFields,\n\t\t\t\t});\n\t\t\t\tif (recovered) return { success: true, data: recovered };\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"CONFLICT\",\n\t\t\t\t\tmessage: `Byline \"${input.slug}\" already exists${\n\t\t\t\t\t\tinput.locale ? ` in locale \"${input.locale}\"` : \"\"\n\t\t\t\t\t}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst byline = await repo.create(input);\n\t\treturn { success: true, data: byline };\n\t} catch (error) {\n\t\t// Mirror handleBylineUpdate: surface customFields validation\n\t\t// errors as 400 rather than swallowing them as a generic 500.\n\t\tif (error instanceof EmDashValidationError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"VALIDATION_ERROR\", message: error.message },\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"[BYLINE_CREATE_ERROR]\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: { code: \"BYLINE_CREATE_ERROR\", message: \"Failed to create byline\" },\n\t\t};\n\t}\n}\n\n/**\n * Update an existing byline. Forwards every field on `UpdateBylineInput`\n * to `BylineRepository.update`, including the Phase 3 `customFields`\n * map; per-field type validation lives in the repo, which throws\n * `EmDashValidationError` on unknown slugs, type mismatches, or\n * `select`-choice misses. This handler translates that into a clean\n * `VALIDATION_ERROR` (400 via `mapErrorStatus`).\n *\n * Returns `NOT_FOUND` when the byline id doesn't resolve. Generic\n * failures surface as `BYLINE_UPDATE_ERROR` (500) without leaking the\n * underlying message.\n */\nexport async function handleBylineUpdate(\n\tdb: Kysely<Database>,\n\tid: string,\n\tinput: UpdateBylineInput,\n): Promise<ApiResult<BylineSummary>> {\n\ttry {\n\t\tconst repo = new BylineRepository(db);\n\t\tconst byline = await repo.update(id, input);\n\t\tif (!byline) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"NOT_FOUND\", message: \"Byline not found\" },\n\t\t\t};\n\t\t}\n\t\treturn { success: true, data: byline };\n\t} catch (error) {\n\t\t// Unknown-key + type-mismatch + select-choice writes throw\n\t\t// EmDashValidationError (Phase 3, see BylineRepository.update).\n\t\t// Map to a clean 400 — the error message names the offending\n\t\t// slug/type, which is safe to surface to the admin client.\n\t\tif (error instanceof EmDashValidationError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"VALIDATION_ERROR\", message: error.message },\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"[BYLINE_UPDATE_ERROR]\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: { code: \"BYLINE_UPDATE_ERROR\", message: \"Failed to update byline\" },\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;AAcA,MAAM,QAAQ,MAAgD,KAAK;;;;;;AAOnE,SAAS,uBACR,UACA,OACA,iBACU;AACV,QACC,SAAS,gBAAgB,MAAM,eAC/B,KAAK,SAAS,IAAI,KAAK,KAAK,MAAM,IAAI,IACtC,KAAK,SAAS,cAAc,KAAK,KAAK,MAAM,cAAc,IAC1D,KAAK,SAAS,WAAW,KAAK,KAAK,MAAM,WAAW,IACpD,KAAK,SAAS,OAAO,KAAK,KAAK,MAAM,OAAO,IAC5C,SAAS,aAAa,MAAM,WAAW,UACvC,SAAS,WAAW;;;;;;;AAStB,SAAS,gCACR,UACA,OACU;AACV,KAAI,CAAC,MAAO,QAAO,OAAO,KAAK,SAAS,CAAC,WAAW;AACpD,MAAK,MAAM,CAAC,MAAM,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,QAAO;GACN,SAAS;GACT,OAAO;IAAE,MAAM;IAAa,SAAS;IAAoB;GACzD;AAEF,SAAO;GAAE,SAAS;GAAM,MAAM;GAAQ;UAC9B,OAAO;AAKf,MAAI,iBAAiB,sBACpB,QAAO;GACN,SAAS;GACT,OAAO;IAAE,MAAM;IAAoB,SAAS,MAAM;IAAS;GAC3D;AAEF,UAAQ,MAAM,yBAAyB,MAAM;AAC7C,SAAO;GACN,SAAS;GACT,OAAO;IAAE,MAAM;IAAuB,SAAS;IAA2B;GAC1E"}
@@ -1,10 +1,10 @@
1
- import { a as __exportAll } from "./runner-DPdt_Wpa.mjs";
1
+ import { a as __exportAll } from "./runner-K8XK101B.mjs";
2
2
  import { t as validateIdentifier } from "./validate-VPnKoIzW.mjs";
3
3
  import { r as requestCached } from "./request-cache-KCNHp_RJ.mjs";
4
- import { t as BylineRepository } from "./byline-LL8lyqdb.mjs";
4
+ import { t as BylineRepository } from "./byline-Bm8ZgUP9.mjs";
5
5
  import { n as isMissingTableError } from "./db-errors-CK46D-ly.mjs";
6
- import { a as getDb } from "./loader-BA_zhkS_.mjs";
7
- import { i as resolveLocaleChain } from "./resolve-C7I0qiR0.mjs";
6
+ import { a as getDb } from "./loader-CB6YHeul.mjs";
7
+ import { i as resolveLocaleChain } from "./resolve-DR3wqMTy.mjs";
8
8
  import { sql } from "kysely";
9
9
 
10
10
  //#region src/bylines/index.ts
@@ -217,7 +217,7 @@ async function getBylinesForEntries(collection, entries) {
217
217
  * @param options - Optional locale, ordering, status, and limit
218
218
  */
219
219
  async function getEntriesByByline(collection, byline, options = {}) {
220
- const { getEmDashCollection } = await import("./query-BpQb-blG.mjs").then((n) => n.o);
220
+ const { getEmDashCollection } = await import("./query-ByGq6ver.mjs").then((n) => n.o);
221
221
  const queryOptions = { where: { byline } };
222
222
  if (options.locale !== void 0) queryOptions.locale = options.locale;
223
223
  if (options.orderBy !== void 0) queryOptions.orderBy = options.orderBy;
@@ -229,4 +229,4 @@ async function getEntriesByByline(collection, byline, options = {}) {
229
229
 
230
230
  //#endregion
231
231
  export { invalidateBylineCache as a, getEntriesByByline as i, getByline as n, getBylineBySlug as r, bylines_exports as t };
232
- //# sourceMappingURL=bylines-DE47vP8d.mjs.map
232
+ //# sourceMappingURL=bylines-Woq87129.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"bylines-DE47vP8d.mjs","names":[],"sources":["../src/bylines/index.ts"],"sourcesContent":["/**\n * Runtime API for bylines\n *\n * Provides functions to query byline profiles and byline credits\n * associated with content entries. Follows the same pattern as\n * the taxonomies runtime API.\n *\n * i18n model (migration 040): byline rows are per-locale and share a\n * `translation_group`. Credits on `_emdash_content_bylines.byline_id` store\n * the translation_group, so a single credit spans every locale of a byline.\n *\n * Hydration is strict per locale: a credit at locale X renders iff a byline\n * row exists at locale X within the credited translation_group. There is no\n * read-time fallback. Mirrors `getEntryTerms` and the convention in PR #916.\n * Locale is passed in by callers — `query.ts` resolves it from the entry's\n * own `data.locale` for the runtime path.\n */\n\nimport { sql } from \"kysely\";\n\nimport { BylineRepository } from \"../database/repositories/byline.js\";\nimport type { BylineSummary, ContentBylineCredit } from \"../database/repositories/types.js\";\nimport { validateIdentifier } from \"../database/validate.js\";\nimport { resolveLocaleChain } from \"../i18n/resolve.js\";\nimport { getDb } from \"../loader.js\";\nimport { requestCached } from \"../request-cache.js\";\nimport { isMissingTableError } from \"../utils/db-errors.js\";\n\n/**\n * No-op — kept for API compatibility.\n *\n * Used to invalidate a worker-lifetime \"has any byline?\" probe. That\n * probe added a query on every cold isolate to save one query on sites\n * with zero bylines (i.e. the wrong tradeoff), so we dropped it. The\n * batch byline join below returns an empty map for empty sites at the\n * same cost as the probe, without the pre-check.\n */\nexport function invalidateBylineCache(): void {\n\t// Intentionally empty.\n}\n\n/**\n * Get a byline by ID.\n *\n * @example\n * ```ts\n * import { getByline } from \"emdash\";\n *\n * const byline = await getByline(\"01HXYZ...\");\n * if (byline) {\n * console.log(byline.displayName);\n * }\n * ```\n */\nexport async function getByline(id: string): Promise<BylineSummary | null> {\n\tconst db = await getDb();\n\tconst repo = new BylineRepository(db);\n\treturn repo.findById(id);\n}\n\n/**\n * Get a byline by slug.\n *\n * Standalone identity lookup (e.g. rendering an author profile page). Walks\n * the configured locale fallback chain — same pattern as `getMenu` and\n * `getTerm`, see PR #916. Returns the first match found, walking\n * `[requestedLocale, ...fallbacks, defaultLocale]` in order.\n *\n * Note: this is intentionally different from credit hydration on a content\n * entry (`getEntryBylines`), which is strict per locale with no fallback.\n * The distinction: identity lookups answer \"give me this byline\", and\n * falling back to another locale's display name is acceptable. Credit\n * hydration answers \"what should render on this entry\", where falling back\n * silently surfaces a stale-locale name and contradicts editorial intent.\n *\n * @example\n * ```ts\n * import { getBylineBySlug } from \"emdash\";\n *\n * const byline = await getBylineBySlug(\"jane-doe\", { locale: \"de-de\" });\n * if (byline) {\n * console.log(byline.displayName);\n * }\n * ```\n */\nexport async function getBylineBySlug(\n\tslug: string,\n\toptions?: { locale?: string },\n): Promise<BylineSummary | null> {\n\tconst chain = resolveLocaleChain(options?.locale);\n\tconst cacheKey = `byline-by-slug:${slug}:${chain.length > 0 ? chain.join(\",\") : \"*\"}`;\n\treturn requestCached(cacheKey, async () => {\n\t\tconst db = await getDb();\n\t\tconst repo = new BylineRepository(db);\n\n\t\tif (chain.length === 0) {\n\t\t\t// No i18n or no resolved locale — fall back to the repo's\n\t\t\t// \"lowest-locale-code\" deterministic match.\n\t\t\treturn repo.findBySlug(slug);\n\t\t}\n\n\t\tfor (const locale of chain) {\n\t\t\tconst row = await repo.findBySlug(slug, { locale });\n\t\t\tif (row) return row;\n\t\t}\n\t\treturn null;\n\t});\n}\n\n/**\n * Get byline credits for a single content entry.\n *\n * Strict per locale (post-migration 040): a credit renders iff a byline row\n * exists at the requested locale within the credited translation_group.\n * Callers wanting fallback behaviour apply it themselves. When `locale` is\n * omitted, returns every locale variant of every credit on the entry —\n * useful for admin tooling, not for end-user rendering.\n *\n * Internal: not re-exported from the `emdash` package entry point. Every\n * entry returned by `getEmDashCollection` / `getEmDashEntry` already has\n * `data.bylines` populated by `hydrateEntryBylines` (which uses the batch\n * helper `getBylinesForEntries` directly). Site code should read those\n * fields rather than calling this function.\n */\nexport async function getEntryBylines(\n\tcollection: string,\n\tentryId: string,\n\toptions?: { locale?: string },\n): Promise<ContentBylineCredit[]> {\n\tvalidateIdentifier(collection, \"collection\");\n\tconst db = await getDb();\n\tconst repo = new BylineRepository(db);\n\n\tconst localeOpt = options?.locale !== undefined ? { locale: options.locale } : undefined;\n\tconst explicit = await repo.getContentBylines(collection, entryId, localeOpt);\n\tif (explicit.length > 0) {\n\t\treturn explicit.map((c) => ({ ...c, source: \"explicit\" as const }));\n\t}\n\n\t// `primary_byline_id` is the explicit-credit sentinel: non-null\n\t// suppresses author fallback even when the credit doesn't resolve\n\t// at this locale.\n\tconst ctx = await getEntryContext(db, collection, entryId);\n\tif (ctx.primaryBylineId) return [];\n\n\tif (ctx.authorId) {\n\t\tconst fallback = await repo.findByUserId(ctx.authorId, localeOpt);\n\t\tif (fallback) {\n\t\t\treturn [{ byline: fallback, sortOrder: 0, roleLabel: null, source: \"inferred\" }];\n\t\t}\n\t}\n\n\treturn [];\n}\n\n/**\n * Entry reference for batch byline lookups. Passing `authorId`,\n * `primaryBylineId`, and `locale` in directly avoids a per-entry\n * `SELECT` against the content table during hydration.\n *\n * `primaryBylineId` is the explicit-credit sentinel — non-null suppresses\n * author fallback. `locale` drives the strict per-locale join.\n */\nexport interface BylineEntry {\n\tid: string;\n\tauthorId: string | null;\n\tprimaryBylineId?: string | null;\n\tlocale?: string | null;\n}\n\n/**\n * Batch-fetch byline credits for multiple content entries.\n *\n * Per-entry strict-locale hydration: entries are bucketed by `entry.locale`\n * and each bucket gets a single batched call to the strict-locale repo\n * method. Items with no `locale` field (legacy / single-locale installs)\n * share an unscoped bucket.\n *\n * Internal: consumed by `hydrateEntryBylines` in `query.ts` so that every\n * entry returned from `getEmDashCollection` / `getEmDashEntry` already has\n * `data.bylines` populated. Site code should rely on that eager hydration\n * rather than calling this directly -- this function is not re-exported\n * from the `emdash` package entry point.\n *\n * @param collection - The collection slug (e.g., \"posts\")\n * @param entries - Entry id + authorId + locale (each entry resolves at its own locale)\n * @returns Map from entry ID to array of byline credits\n */\nexport async function getBylinesForEntries(\n\tcollection: string,\n\tentries: BylineEntry[],\n): Promise<Map<string, ContentBylineCredit[]>> {\n\tvalidateIdentifier(collection, \"collection\");\n\tconst result = new Map<string, ContentBylineCredit[]>();\n\n\tfor (const { id } of entries) {\n\t\tresult.set(id, []);\n\t}\n\n\tif (entries.length === 0) {\n\t\treturn result;\n\t}\n\n\tconst db = await getDb();\n\tconst repo = new BylineRepository(db);\n\n\t// Bucket entries by locale so each bucket fires a single strict-locale\n\t// `getContentBylinesMany` call. Items with no locale field share a\n\t// bucket keyed by null (no `WHERE locale = ?` applied — legacy\n\t// pre-i18n shape).\n\tconst buckets = new Map<string | null, BylineEntry[]>();\n\tfor (const entry of entries) {\n\t\tconst key = entry.locale ?? null;\n\t\tconst bucket = buckets.get(key);\n\t\tif (bucket) bucket.push(entry);\n\t\telse buckets.set(key, [entry]);\n\t}\n\n\t// Sites with no bylines get an empty map back at the same cost as the\n\t// previous \"has any bylines\" probe, without the extra round-trip.\n\t// Pre-migration databases (bylines table missing) fall through to the\n\t// `isMissingTableError` catch below and return empty.\n\t//\n\t// Each bucket's `getContentBylinesMany` call uses `skipHydration: true`\n\t// so the per-bucket fetches return bylines with `customFields = {}`.\n\t// We then hydrate the union of returned bylines in a SINGLE batched\n\t// pass via `hydrateBylineCustomFields`. This keeps mixed-locale list\n\t// hydration at one batched group-shared query (and one batched\n\t// translatable query) per request, even when locale buckets reference\n\t// disjoint translation_groups — the strict reading of the Phase 3\n\t// query-count envelope.\n\tconst explicitByEntry = new Map<string, ContentBylineCredit[]>();\n\tconst entriesNeedingAuthorCheck: BylineEntry[] = [];\n\tconst hydrationTargets: BylineSummary[] = [];\n\tfor (const [locale, bucket] of buckets) {\n\t\tconst localeOpt = locale ? { locale, skipHydration: true } : { skipHydration: true };\n\t\tconst bucketIds = bucket.map((e) => e.id);\n\t\tlet bylinesMap;\n\t\ttry {\n\t\t\tbylinesMap = await repo.getContentBylinesMany(collection, bucketIds, localeOpt);\n\t\t} catch (error) {\n\t\t\tif (isMissingTableError(error)) return result;\n\t\t\tthrow error;\n\t\t}\n\t\tfor (const [id, list] of bylinesMap) {\n\t\t\texplicitByEntry.set(id, list);\n\t\t\tfor (const credit of list) hydrationTargets.push(credit.byline);\n\t\t}\n\n\t\tfor (const entry of bucket) {\n\t\t\tconst hasResolved = bylinesMap.has(entry.id) && bylinesMap.get(entry.id)!.length > 0;\n\t\t\tif (hasResolved) continue;\n\t\t\tif (entry.authorId) entriesNeedingAuthorCheck.push(entry);\n\t\t}\n\t}\n\n\t// Only entries without an explicit credit (primaryBylineId null) are\n\t// eligible for author fallback.\n\tconst fallbackByEntry = new Map<string, BylineSummary>();\n\tif (entriesNeedingAuthorCheck.length > 0) {\n\t\tconst authorBuckets = new Map<string | null, BylineEntry[]>();\n\t\tfor (const entry of entriesNeedingAuthorCheck) {\n\t\t\tif (entry.primaryBylineId) continue;\n\t\t\tconst key = entry.locale ?? null;\n\t\t\tconst bucket = authorBuckets.get(key);\n\t\t\tif (bucket) bucket.push(entry);\n\t\t\telse authorBuckets.set(key, [entry]);\n\t\t}\n\n\t\tfor (const [locale, bucket] of authorBuckets) {\n\t\t\tconst localeOpt: { locale?: string; skipHydration: true } = locale\n\t\t\t\t? { locale, skipHydration: true }\n\t\t\t\t: { skipHydration: true };\n\t\t\tconst authorIds = bucket.map((e) => e.authorId).filter((id): id is string => id !== null);\n\t\t\tconst uniqueAuthorIds = [...new Set(authorIds)];\n\t\t\tif (uniqueAuthorIds.length === 0) continue;\n\t\t\t// `skipHydration: true` returns bylines with `customFields = {}`\n\t\t\t// so the fallback path participates in the single batched\n\t\t\t// `hydrateBylineCustomFields` call below — keeping the query\n\t\t\t// envelope at \"+1 group-shared query per hydration pass\" even\n\t\t\t// when author bylines across locale buckets reference disjoint\n\t\t\t// translation_groups.\n\t\t\tconst authorBylineMap = await repo.findByUserIds(uniqueAuthorIds, localeOpt);\n\t\t\tfor (const entry of bucket) {\n\t\t\t\tif (!entry.authorId) continue;\n\t\t\t\tconst f = authorBylineMap.get(entry.authorId);\n\t\t\t\tif (f) {\n\t\t\t\t\tfallbackByEntry.set(entry.id, f);\n\t\t\t\t\thydrationTargets.push(f);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Single batched hydration over every byline returned from both the\n\t// per-bucket explicit-credit fetches AND the per-bucket author-\n\t// fallback fetches. One translatable query + one group-shared query\n\t// for the whole pass, regardless of bucket count or whether\n\t// translation_groups overlap across locales.\n\tif (hydrationTargets.length > 0) {\n\t\tawait repo.hydrateBylineCustomFields(hydrationTargets);\n\t}\n\n\tfor (const { id } of entries) {\n\t\tconst explicit = explicitByEntry.get(id);\n\t\tif (explicit && explicit.length > 0) {\n\t\t\tresult.set(\n\t\t\t\tid,\n\t\t\t\texplicit.map((c) => ({ ...c, source: \"explicit\" as const })),\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst fallback = fallbackByEntry.get(id);\n\t\tif (fallback) {\n\t\t\tresult.set(id, [{ byline: fallback, sortOrder: 0, roleLabel: null, source: \"inferred\" }]);\n\t\t}\n\t}\n\n\treturn result;\n}\n\n/**\n * Get content entries credited to a byline, in any credit position.\n *\n * Unlike filtering on the content table's `primary_byline_id` column (which\n * only finds entries where the byline is the first/primary credit), this\n * matches every explicit credit recorded in `_emdash_content_bylines`, so\n * co-authored entries where the byline is a secondary credit are included.\n *\n * `byline` is matched against the byline's `translation_group` (the value\n * stored on credits since migration 040), so a single credit spans every\n * locale variant of the byline. Pass `byline.translationGroup ?? byline.id`\n * from `getByline` / `getBylineBySlug`. An array matches any of the given\n * bylines (OR).\n *\n * The result respects the active locale, status, ordering, and eager\n * hydration of `getEmDashCollection`.\n *\n * @example\n * ```ts\n * import { getBylineBySlug, getEntriesByByline } from \"emdash\";\n *\n * const byline = await getBylineBySlug(\"jane-doe\");\n * if (byline) {\n * const posts = await getEntriesByByline(\"posts\", byline.translationGroup ?? byline.id, {\n * orderBy: { published_at: \"desc\" },\n * });\n * }\n * ```\n *\n * @param collection - The collection slug (e.g. \"posts\")\n * @param byline - A byline translation group, or an array of them (OR)\n * @param options - Optional locale, ordering, status, and limit\n */\nexport async function getEntriesByByline(\n\tcollection: string,\n\tbyline: string | string[],\n\toptions: {\n\t\tlocale?: string;\n\t\torderBy?: Record<string, \"asc\" | \"desc\">;\n\t\tstatus?: \"draft\" | \"published\" | \"archived\";\n\t\tlimit?: number;\n\t} = {},\n): Promise<Array<{ id: string; data: Record<string, unknown> }>> {\n\tconst { getEmDashCollection } = await import(\"../query.js\");\n\n\tconst queryOptions: Record<string, unknown> = {\n\t\twhere: { byline },\n\t};\n\tif (options.locale !== undefined) queryOptions.locale = options.locale;\n\tif (options.orderBy !== undefined) queryOptions.orderBy = options.orderBy;\n\tif (options.status !== undefined) queryOptions.status = options.status;\n\tif (options.limit !== undefined) queryOptions.limit = options.limit;\n\n\tconst { entries } = await getEmDashCollection(collection, queryOptions);\n\treturn entries;\n}\n\n/** Reads `author_id` + `primary_byline_id` for one entry in a single query. */\nasync function getEntryContext(\n\tdb: Awaited<ReturnType<typeof getDb>>,\n\tcollection: string,\n\tentryId: string,\n): Promise<{ authorId: string | null; primaryBylineId: string | null }> {\n\tvalidateIdentifier(collection, \"collection\");\n\tconst tableName = `ec_${collection}`;\n\n\tconst result = await sql<{\n\t\tauthor_id: string | null;\n\t\tprimary_byline_id: string | null;\n\t}>`\n\t\tSELECT author_id, primary_byline_id FROM ${sql.ref(tableName)}\n\t\tWHERE id = ${entryId}\n\t\tLIMIT 1\n\t`.execute(db);\n\n\tconst row = result.rows[0];\n\treturn {\n\t\tauthorId: row?.author_id ?? null,\n\t\tprimaryBylineId: row?.primary_byline_id ?? null,\n\t};\n}\n"],"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QAAQ;AAC3B,QAAI,CAAC,MAAM,SAAU;IACrB,MAAM,IAAI,gBAAgB,IAAI,MAAM,SAAS;AAC7C,QAAI,GAAG;AACN,qBAAgB,IAAI,MAAM,IAAI,EAAE;AAChC,sBAAiB,KAAK,EAAE;;;;;AAW5B,KAAI,iBAAiB,SAAS,EAC7B,OAAM,KAAK,0BAA0B,iBAAiB;AAGvD,MAAK,MAAM,EAAE,QAAQ,SAAS;EAC7B,MAAM,WAAW,gBAAgB,IAAI,GAAG;AACxC,MAAI,YAAY,SAAS,SAAS,GAAG;AACpC,UAAO,IACN,IACA,SAAS,KAAK,OAAO;IAAE,GAAG;IAAG,QAAQ;IAAqB,EAAE,CAC5D;AACD;;EAGD,MAAM,WAAW,gBAAgB,IAAI,GAAG;AACxC,MAAI,SACH,QAAO,IAAI,IAAI,CAAC;GAAE,QAAQ;GAAU,WAAW;GAAG,WAAW;GAAM,QAAQ;GAAY,CAAC,CAAC;;AAI3F,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCR,eAAsB,mBACrB,YACA,QACA,UAKI,EAAE,EAC0D;CAChE,MAAM,EAAE,wBAAwB,MAAM,OAAO;CAE7C,MAAM,eAAwC,EAC7C,OAAO,EAAE,QAAQ,EACjB;AACD,KAAI,QAAQ,WAAW,OAAW,cAAa,SAAS,QAAQ;AAChE,KAAI,QAAQ,YAAY,OAAW,cAAa,UAAU,QAAQ;AAClE,KAAI,QAAQ,WAAW,OAAW,cAAa,SAAS,QAAQ;AAChE,KAAI,QAAQ,UAAU,OAAW,cAAa,QAAQ,QAAQ;CAE9D,MAAM,EAAE,YAAY,MAAM,oBAAoB,YAAY,aAAa;AACvE,QAAO"}
1
+ {"version":3,"file":"bylines-Woq87129.mjs","names":[],"sources":["../src/bylines/index.ts"],"sourcesContent":["/**\n * Runtime API for bylines\n *\n * Provides functions to query byline profiles and byline credits\n * associated with content entries. Follows the same pattern as\n * the taxonomies runtime API.\n *\n * i18n model (migration 040): byline rows are per-locale and share a\n * `translation_group`. Credits on `_emdash_content_bylines.byline_id` store\n * the translation_group, so a single credit spans every locale of a byline.\n *\n * Hydration is strict per locale: a credit at locale X renders iff a byline\n * row exists at locale X within the credited translation_group. There is no\n * read-time fallback. Mirrors `getEntryTerms` and the convention in PR #916.\n * Locale is passed in by callers — `query.ts` resolves it from the entry's\n * own `data.locale` for the runtime path.\n */\n\nimport { sql } from \"kysely\";\n\nimport { BylineRepository } from \"../database/repositories/byline.js\";\nimport type { BylineSummary, ContentBylineCredit } from \"../database/repositories/types.js\";\nimport { validateIdentifier } from \"../database/validate.js\";\nimport { resolveLocaleChain } from \"../i18n/resolve.js\";\nimport { getDb } from \"../loader.js\";\nimport { requestCached } from \"../request-cache.js\";\nimport { isMissingTableError } from \"../utils/db-errors.js\";\n\n/**\n * No-op — kept for API compatibility.\n *\n * Used to invalidate a worker-lifetime \"has any byline?\" probe. That\n * probe added a query on every cold isolate to save one query on sites\n * with zero bylines (i.e. the wrong tradeoff), so we dropped it. The\n * batch byline join below returns an empty map for empty sites at the\n * same cost as the probe, without the pre-check.\n */\nexport function invalidateBylineCache(): void {\n\t// Intentionally empty.\n}\n\n/**\n * Get a byline by ID.\n *\n * @example\n * ```ts\n * import { getByline } from \"emdash\";\n *\n * const byline = await getByline(\"01HXYZ...\");\n * if (byline) {\n * console.log(byline.displayName);\n * }\n * ```\n */\nexport async function getByline(id: string): Promise<BylineSummary | null> {\n\tconst db = await getDb();\n\tconst repo = new BylineRepository(db);\n\treturn repo.findById(id);\n}\n\n/**\n * Get a byline by slug.\n *\n * Standalone identity lookup (e.g. rendering an author profile page). Walks\n * the configured locale fallback chain — same pattern as `getMenu` and\n * `getTerm`, see PR #916. Returns the first match found, walking\n * `[requestedLocale, ...fallbacks, defaultLocale]` in order.\n *\n * Note: this is intentionally different from credit hydration on a content\n * entry (`getEntryBylines`), which is strict per locale with no fallback.\n * The distinction: identity lookups answer \"give me this byline\", and\n * falling back to another locale's display name is acceptable. Credit\n * hydration answers \"what should render on this entry\", where falling back\n * silently surfaces a stale-locale name and contradicts editorial intent.\n *\n * @example\n * ```ts\n * import { getBylineBySlug } from \"emdash\";\n *\n * const byline = await getBylineBySlug(\"jane-doe\", { locale: \"de-de\" });\n * if (byline) {\n * console.log(byline.displayName);\n * }\n * ```\n */\nexport async function getBylineBySlug(\n\tslug: string,\n\toptions?: { locale?: string },\n): Promise<BylineSummary | null> {\n\tconst chain = resolveLocaleChain(options?.locale);\n\tconst cacheKey = `byline-by-slug:${slug}:${chain.length > 0 ? chain.join(\",\") : \"*\"}`;\n\treturn requestCached(cacheKey, async () => {\n\t\tconst db = await getDb();\n\t\tconst repo = new BylineRepository(db);\n\n\t\tif (chain.length === 0) {\n\t\t\t// No i18n or no resolved locale — fall back to the repo's\n\t\t\t// \"lowest-locale-code\" deterministic match.\n\t\t\treturn repo.findBySlug(slug);\n\t\t}\n\n\t\tfor (const locale of chain) {\n\t\t\tconst row = await repo.findBySlug(slug, { locale });\n\t\t\tif (row) return row;\n\t\t}\n\t\treturn null;\n\t});\n}\n\n/**\n * Get byline credits for a single content entry.\n *\n * Strict per locale (post-migration 040): a credit renders iff a byline row\n * exists at the requested locale within the credited translation_group.\n * Callers wanting fallback behaviour apply it themselves. When `locale` is\n * omitted, returns every locale variant of every credit on the entry —\n * useful for admin tooling, not for end-user rendering.\n *\n * Internal: not re-exported from the `emdash` package entry point. Every\n * entry returned by `getEmDashCollection` / `getEmDashEntry` already has\n * `data.bylines` populated by `hydrateEntryBylines` (which uses the batch\n * helper `getBylinesForEntries` directly). Site code should read those\n * fields rather than calling this function.\n */\nexport async function getEntryBylines(\n\tcollection: string,\n\tentryId: string,\n\toptions?: { locale?: string },\n): Promise<ContentBylineCredit[]> {\n\tvalidateIdentifier(collection, \"collection\");\n\tconst db = await getDb();\n\tconst repo = new BylineRepository(db);\n\n\tconst localeOpt = options?.locale !== undefined ? { locale: options.locale } : undefined;\n\tconst explicit = await repo.getContentBylines(collection, entryId, localeOpt);\n\tif (explicit.length > 0) {\n\t\treturn explicit.map((c) => ({ ...c, source: \"explicit\" as const }));\n\t}\n\n\t// `primary_byline_id` is the explicit-credit sentinel: non-null\n\t// suppresses author fallback even when the credit doesn't resolve\n\t// at this locale.\n\tconst ctx = await getEntryContext(db, collection, entryId);\n\tif (ctx.primaryBylineId) return [];\n\n\tif (ctx.authorId) {\n\t\tconst fallback = await repo.findByUserId(ctx.authorId, localeOpt);\n\t\tif (fallback) {\n\t\t\treturn [{ byline: fallback, sortOrder: 0, roleLabel: null, source: \"inferred\" }];\n\t\t}\n\t}\n\n\treturn [];\n}\n\n/**\n * Entry reference for batch byline lookups. Passing `authorId`,\n * `primaryBylineId`, and `locale` in directly avoids a per-entry\n * `SELECT` against the content table during hydration.\n *\n * `primaryBylineId` is the explicit-credit sentinel — non-null suppresses\n * author fallback. `locale` drives the strict per-locale join.\n */\nexport interface BylineEntry {\n\tid: string;\n\tauthorId: string | null;\n\tprimaryBylineId?: string | null;\n\tlocale?: string | null;\n}\n\n/**\n * Batch-fetch byline credits for multiple content entries.\n *\n * Per-entry strict-locale hydration: entries are bucketed by `entry.locale`\n * and each bucket gets a single batched call to the strict-locale repo\n * method. Items with no `locale` field (legacy / single-locale installs)\n * share an unscoped bucket.\n *\n * Internal: consumed by `hydrateEntryBylines` in `query.ts` so that every\n * entry returned from `getEmDashCollection` / `getEmDashEntry` already has\n * `data.bylines` populated. Site code should rely on that eager hydration\n * rather than calling this directly -- this function is not re-exported\n * from the `emdash` package entry point.\n *\n * @param collection - The collection slug (e.g., \"posts\")\n * @param entries - Entry id + authorId + locale (each entry resolves at its own locale)\n * @returns Map from entry ID to array of byline credits\n */\nexport async function getBylinesForEntries(\n\tcollection: string,\n\tentries: BylineEntry[],\n): Promise<Map<string, ContentBylineCredit[]>> {\n\tvalidateIdentifier(collection, \"collection\");\n\tconst result = new Map<string, ContentBylineCredit[]>();\n\n\tfor (const { id } of entries) {\n\t\tresult.set(id, []);\n\t}\n\n\tif (entries.length === 0) {\n\t\treturn result;\n\t}\n\n\tconst db = await getDb();\n\tconst repo = new BylineRepository(db);\n\n\t// Bucket entries by locale so each bucket fires a single strict-locale\n\t// `getContentBylinesMany` call. Items with no locale field share a\n\t// bucket keyed by null (no `WHERE locale = ?` applied — legacy\n\t// pre-i18n shape).\n\tconst buckets = new Map<string | null, BylineEntry[]>();\n\tfor (const entry of entries) {\n\t\tconst key = entry.locale ?? null;\n\t\tconst bucket = buckets.get(key);\n\t\tif (bucket) bucket.push(entry);\n\t\telse buckets.set(key, [entry]);\n\t}\n\n\t// Sites with no bylines get an empty map back at the same cost as the\n\t// previous \"has any bylines\" probe, without the extra round-trip.\n\t// Pre-migration databases (bylines table missing) fall through to the\n\t// `isMissingTableError` catch below and return empty.\n\t//\n\t// Each bucket's `getContentBylinesMany` call uses `skipHydration: true`\n\t// so the per-bucket fetches return bylines with `customFields = {}`.\n\t// We then hydrate the union of returned bylines in a SINGLE batched\n\t// pass via `hydrateBylineCustomFields`. This keeps mixed-locale list\n\t// hydration at one batched group-shared query (and one batched\n\t// translatable query) per request, even when locale buckets reference\n\t// disjoint translation_groups — the strict reading of the Phase 3\n\t// query-count envelope.\n\tconst explicitByEntry = new Map<string, ContentBylineCredit[]>();\n\tconst entriesNeedingAuthorCheck: BylineEntry[] = [];\n\tconst hydrationTargets: BylineSummary[] = [];\n\tfor (const [locale, bucket] of buckets) {\n\t\tconst localeOpt = locale ? { locale, skipHydration: true } : { skipHydration: true };\n\t\tconst bucketIds = bucket.map((e) => e.id);\n\t\tlet bylinesMap;\n\t\ttry {\n\t\t\tbylinesMap = await repo.getContentBylinesMany(collection, bucketIds, localeOpt);\n\t\t} catch (error) {\n\t\t\tif (isMissingTableError(error)) return result;\n\t\t\tthrow error;\n\t\t}\n\t\tfor (const [id, list] of bylinesMap) {\n\t\t\texplicitByEntry.set(id, list);\n\t\t\tfor (const credit of list) hydrationTargets.push(credit.byline);\n\t\t}\n\n\t\tfor (const entry of bucket) {\n\t\t\tconst hasResolved = bylinesMap.has(entry.id) && bylinesMap.get(entry.id)!.length > 0;\n\t\t\tif (hasResolved) continue;\n\t\t\tif (entry.authorId) entriesNeedingAuthorCheck.push(entry);\n\t\t}\n\t}\n\n\t// Only entries without an explicit credit (primaryBylineId null) are\n\t// eligible for author fallback.\n\tconst fallbackByEntry = new Map<string, BylineSummary>();\n\tif (entriesNeedingAuthorCheck.length > 0) {\n\t\tconst authorBuckets = new Map<string | null, BylineEntry[]>();\n\t\tfor (const entry of entriesNeedingAuthorCheck) {\n\t\t\tif (entry.primaryBylineId) continue;\n\t\t\tconst key = entry.locale ?? null;\n\t\t\tconst bucket = authorBuckets.get(key);\n\t\t\tif (bucket) bucket.push(entry);\n\t\t\telse authorBuckets.set(key, [entry]);\n\t\t}\n\n\t\tfor (const [locale, bucket] of authorBuckets) {\n\t\t\tconst localeOpt: { locale?: string; skipHydration: true } = locale\n\t\t\t\t? { locale, skipHydration: true }\n\t\t\t\t: { skipHydration: true };\n\t\t\tconst authorIds = bucket.map((e) => e.authorId).filter((id): id is string => id !== null);\n\t\t\tconst uniqueAuthorIds = [...new Set(authorIds)];\n\t\t\tif (uniqueAuthorIds.length === 0) continue;\n\t\t\t// `skipHydration: true` returns bylines with `customFields = {}`\n\t\t\t// so the fallback path participates in the single batched\n\t\t\t// `hydrateBylineCustomFields` call below — keeping the query\n\t\t\t// envelope at \"+1 group-shared query per hydration pass\" even\n\t\t\t// when author bylines across locale buckets reference disjoint\n\t\t\t// translation_groups.\n\t\t\tconst authorBylineMap = await repo.findByUserIds(uniqueAuthorIds, localeOpt);\n\t\t\tfor (const entry of bucket) {\n\t\t\t\tif (!entry.authorId) continue;\n\t\t\t\tconst f = authorBylineMap.get(entry.authorId);\n\t\t\t\tif (f) {\n\t\t\t\t\tfallbackByEntry.set(entry.id, f);\n\t\t\t\t\thydrationTargets.push(f);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Single batched hydration over every byline returned from both the\n\t// per-bucket explicit-credit fetches AND the per-bucket author-\n\t// fallback fetches. One translatable query + one group-shared query\n\t// for the whole pass, regardless of bucket count or whether\n\t// translation_groups overlap across locales.\n\tif (hydrationTargets.length > 0) {\n\t\tawait repo.hydrateBylineCustomFields(hydrationTargets);\n\t}\n\n\tfor (const { id } of entries) {\n\t\tconst explicit = explicitByEntry.get(id);\n\t\tif (explicit && explicit.length > 0) {\n\t\t\tresult.set(\n\t\t\t\tid,\n\t\t\t\texplicit.map((c) => ({ ...c, source: \"explicit\" as const })),\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst fallback = fallbackByEntry.get(id);\n\t\tif (fallback) {\n\t\t\tresult.set(id, [{ byline: fallback, sortOrder: 0, roleLabel: null, source: \"inferred\" }]);\n\t\t}\n\t}\n\n\treturn result;\n}\n\n/**\n * Get content entries credited to a byline, in any credit position.\n *\n * Unlike filtering on the content table's `primary_byline_id` column (which\n * only finds entries where the byline is the first/primary credit), this\n * matches every explicit credit recorded in `_emdash_content_bylines`, so\n * co-authored entries where the byline is a secondary credit are included.\n *\n * `byline` is matched against the byline's `translation_group` (the value\n * stored on credits since migration 040), so a single credit spans every\n * locale variant of the byline. Pass `byline.translationGroup ?? byline.id`\n * from `getByline` / `getBylineBySlug`. An array matches any of the given\n * bylines (OR).\n *\n * The result respects the active locale, status, ordering, and eager\n * hydration of `getEmDashCollection`.\n *\n * @example\n * ```ts\n * import { getBylineBySlug, getEntriesByByline } from \"emdash\";\n *\n * const byline = await getBylineBySlug(\"jane-doe\");\n * if (byline) {\n * const posts = await getEntriesByByline(\"posts\", byline.translationGroup ?? byline.id, {\n * orderBy: { published_at: \"desc\" },\n * });\n * }\n * ```\n *\n * @param collection - The collection slug (e.g. \"posts\")\n * @param byline - A byline translation group, or an array of them (OR)\n * @param options - Optional locale, ordering, status, and limit\n */\nexport async function getEntriesByByline(\n\tcollection: string,\n\tbyline: string | string[],\n\toptions: {\n\t\tlocale?: string;\n\t\torderBy?: Record<string, \"asc\" | \"desc\">;\n\t\tstatus?: \"draft\" | \"published\" | \"archived\";\n\t\tlimit?: number;\n\t} = {},\n): Promise<Array<{ id: string; data: Record<string, unknown> }>> {\n\tconst { getEmDashCollection } = await import(\"../query.js\");\n\n\tconst queryOptions: Record<string, unknown> = {\n\t\twhere: { byline },\n\t};\n\tif (options.locale !== undefined) queryOptions.locale = options.locale;\n\tif (options.orderBy !== undefined) queryOptions.orderBy = options.orderBy;\n\tif (options.status !== undefined) queryOptions.status = options.status;\n\tif (options.limit !== undefined) queryOptions.limit = options.limit;\n\n\tconst { entries } = await getEmDashCollection(collection, queryOptions);\n\treturn entries;\n}\n\n/** Reads `author_id` + `primary_byline_id` for one entry in a single query. */\nasync function getEntryContext(\n\tdb: Awaited<ReturnType<typeof getDb>>,\n\tcollection: string,\n\tentryId: string,\n): Promise<{ authorId: string | null; primaryBylineId: string | null }> {\n\tvalidateIdentifier(collection, \"collection\");\n\tconst tableName = `ec_${collection}`;\n\n\tconst result = await sql<{\n\t\tauthor_id: string | null;\n\t\tprimary_byline_id: string | null;\n\t}>`\n\t\tSELECT author_id, primary_byline_id FROM ${sql.ref(tableName)}\n\t\tWHERE id = ${entryId}\n\t\tLIMIT 1\n\t`.execute(db);\n\n\tconst row = result.rows[0];\n\treturn {\n\t\tauthorId: row?.author_id ?? null,\n\t\tprimaryBylineId: row?.primary_byline_id ?? null,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,SAAgB,wBAA8B;;;;;;;;;;;;;;AAiB9C,eAAsB,UAAU,IAA2C;AAG1E,QADa,IAAI,iBADN,MAAM,OAAO,CACa,CACzB,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BzB,eAAsB,gBACrB,MACA,SACgC;CAChC,MAAM,QAAQ,mBAAmB,SAAS,OAAO;AAEjD,QAAO,cADU,kBAAkB,KAAK,GAAG,MAAM,SAAS,IAAI,MAAM,KAAK,IAAI,GAAG,OACjD,YAAY;EAE1C,MAAM,OAA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KAAK,OAAO;IAAE,GAAG;IAAG,QAAQ;IAAqB,EAAE,CAC5D;AACD;;EAGD,MAAM,WAAW,gBAAgB,IAAI,GAAG;AACxC,MAAI,SACH,QAAO,IAAI,IAAI,CAAC;GAAE,QAAQ;GAAU,WAAW;GAAG,WAAW;GAAM,QAAQ;GAAY,CAAC,CAAC;;AAI3F,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCR,eAAsB,mBACrB,YACA,QACA,UAKI,EAAE,EAC0D;CAChE,MAAM,EAAE,wBAAwB,MAAM,OAAO;CAE7C,MAAM,eAAwC,EAC7C,OAAO,EAAE,QAAQ,EACjB;AACD,KAAI,QAAQ,WAAW,OAAW,cAAa,SAAS,QAAQ;AAChE,KAAI,QAAQ,YAAY,OAAW,cAAa,UAAU,QAAQ;AAClE,KAAI,QAAQ,WAAW,OAAW,cAAa,SAAS,QAAQ;AAChE,KAAI,QAAQ,UAAU,OAAW,cAAa,QAAQ,QAAQ;CAE9D,MAAM,EAAE,YAAY,MAAM,oBAAoB,YAAY,aAAa;AACvE,QAAO"}
@@ -1,4 +1,4 @@
1
- import { a as __exportAll } from "./runner-DPdt_Wpa.mjs";
1
+ import { a as __exportAll } from "./runner-K8XK101B.mjs";
2
2
  import { i as matchPattern, n as interpolateDestination, t as compilePattern } from "./patterns-BKmjvM7K.mjs";
3
3
 
4
4
  //#region src/redirects/cache.ts
@@ -62,4 +62,4 @@ function matchCachedPatterns(rules, pathname) {
62
62
 
63
63
  //#endregion
64
64
  export { setCachedRedirects as a, matchCachedPatterns as i, getCachedRedirects as n, invalidateRedirectCache as r, cache_exports as t };
65
- //# sourceMappingURL=cache-D9jF5bYw.mjs.map
65
+ //# sourceMappingURL=cache-CEBAZjir.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cache-D9jF5bYw.mjs","names":[],"sources":["../src/redirects/cache.ts"],"sourcesContent":["/**\n * Redirect rule cache.\n *\n * Module-level cache for enabled redirect rules. The middleware populates this\n * on first request; route handlers invalidate it on writes.\n *\n * Both exact-match and pattern rules are loaded from one query and cached\n * together: exact rules indexed by source path in a Map, pattern rules\n * pre-compiled into an array. A single warm request issues zero database\n * queries; a cold isolate issues one.\n *\n * This module deliberately has NO Astro imports so it can be safely imported\n * from handlers, seed, CLI, and tests without dragging in `astro:middleware`.\n */\n\nimport type { Redirect } from \"../database/repositories/redirect.js\";\nimport type { CompiledPattern } from \"./patterns.js\";\nimport { compilePattern, interpolateDestination, matchPattern } from \"./patterns.js\";\n\nexport interface CachedRedirectRule {\n\tredirect: Redirect;\n\tcompiled: CompiledPattern;\n}\n\nexport interface CachedRedirects {\n\t/** Exact-match rules indexed by source path (`source` -> `Redirect`). */\n\texact: Map<string, Redirect>;\n\t/** Pattern rules with their compiled regexes, preserving insertion order. */\n\tpatterns: CachedRedirectRule[];\n}\n\n/**\n * Cached enabled redirects.\n * null = not yet populated, object = cached.\n */\nlet cachedRedirects: CachedRedirects | null = null;\n\n/**\n * Invalidate the cached redirects (both exact and pattern).\n * Call when redirects are created, updated, or deleted.\n */\nexport function invalidateRedirectCache(): void {\n\tcachedRedirects = null;\n}\n\n/**\n * Get the cached redirects, or null if the cache is cold.\n */\nexport function getCachedRedirects(): CachedRedirects | null {\n\treturn cachedRedirects;\n}\n\n/**\n * Populate the cache from a list of enabled redirects (both exact and\n * pattern). The caller is responsible for passing only enabled rows — the\n * cache stores them as-is.\n */\nexport function setCachedRedirects(redirects: Redirect[]): CachedRedirects {\n\tconst exact = new Map<string, Redirect>();\n\tconst patterns: CachedRedirectRule[] = [];\n\tfor (const r of redirects) {\n\t\tif (r.isPattern) {\n\t\t\tpatterns.push({ redirect: r, compiled: compilePattern(r.source) });\n\t\t} else {\n\t\t\texact.set(r.source, r);\n\t\t}\n\t}\n\tcachedRedirects = { exact, patterns };\n\treturn cachedRedirects;\n}\n\n/**\n * Match a path against the cached pattern rules.\n * Returns the resolved destination and matching redirect, or null.\n */\nexport function matchCachedPatterns(\n\trules: CachedRedirectRule[],\n\tpathname: string,\n): { redirect: Redirect; destination: string } | null {\n\tfor (const { redirect, compiled } of rules) {\n\t\tconst params = matchPattern(compiled, pathname);\n\t\tif (params) {\n\t\t\tconst dest = interpolateDestination(redirect.destination, params);\n\t\t\treturn { redirect, destination: dest };\n\t\t}\n\t}\n\treturn null;\n}\n"],"mappings":";;;;;;;;;;;;;;AAmCA,IAAI,kBAA0C;;;;;AAM9C,SAAgB,0BAAgC;AAC/C,mBAAkB;;;;;AAMnB,SAAgB,qBAA6C;AAC5D,QAAO;;;;;;;AAQR,SAAgB,mBAAmB,WAAwC;CAC1E,MAAM,wBAAQ,IAAI,KAAuB;CACzC,MAAM,WAAiC,EAAE;AACzC,MAAK,MAAM,KAAK,UACf,KAAI,EAAE,UACL,UAAS,KAAK;EAAE,UAAU;EAAG,UAAU,eAAe,EAAE,OAAO;EAAE,CAAC;KAElE,OAAM,IAAI,EAAE,QAAQ,EAAE;AAGxB,mBAAkB;EAAE;EAAO;EAAU;AACrC,QAAO;;;;;;AAOR,SAAgB,oBACf,OACA,UACqD;AACrD,MAAK,MAAM,EAAE,UAAU,cAAc,OAAO;EAC3C,MAAM,SAAS,aAAa,UAAU,SAAS;AAC/C,MAAI,OAEH,QAAO;GAAE;GAAU,aADN,uBAAuB,SAAS,aAAa,OAAO;GAC3B;;AAGxC,QAAO"}
1
+ {"version":3,"file":"cache-CEBAZjir.mjs","names":[],"sources":["../src/redirects/cache.ts"],"sourcesContent":["/**\n * Redirect rule cache.\n *\n * Module-level cache for enabled redirect rules. The middleware populates this\n * on first request; route handlers invalidate it on writes.\n *\n * Both exact-match and pattern rules are loaded from one query and cached\n * together: exact rules indexed by source path in a Map, pattern rules\n * pre-compiled into an array. A single warm request issues zero database\n * queries; a cold isolate issues one.\n *\n * This module deliberately has NO Astro imports so it can be safely imported\n * from handlers, seed, CLI, and tests without dragging in `astro:middleware`.\n */\n\nimport type { Redirect } from \"../database/repositories/redirect.js\";\nimport type { CompiledPattern } from \"./patterns.js\";\nimport { compilePattern, interpolateDestination, matchPattern } from \"./patterns.js\";\n\nexport interface CachedRedirectRule {\n\tredirect: Redirect;\n\tcompiled: CompiledPattern;\n}\n\nexport interface CachedRedirects {\n\t/** Exact-match rules indexed by source path (`source` -> `Redirect`). */\n\texact: Map<string, Redirect>;\n\t/** Pattern rules with their compiled regexes, preserving insertion order. */\n\tpatterns: CachedRedirectRule[];\n}\n\n/**\n * Cached enabled redirects.\n * null = not yet populated, object = cached.\n */\nlet cachedRedirects: CachedRedirects | null = null;\n\n/**\n * Invalidate the cached redirects (both exact and pattern).\n * Call when redirects are created, updated, or deleted.\n */\nexport function invalidateRedirectCache(): void {\n\tcachedRedirects = null;\n}\n\n/**\n * Get the cached redirects, or null if the cache is cold.\n */\nexport function getCachedRedirects(): CachedRedirects | null {\n\treturn cachedRedirects;\n}\n\n/**\n * Populate the cache from a list of enabled redirects (both exact and\n * pattern). The caller is responsible for passing only enabled rows — the\n * cache stores them as-is.\n */\nexport function setCachedRedirects(redirects: Redirect[]): CachedRedirects {\n\tconst exact = new Map<string, Redirect>();\n\tconst patterns: CachedRedirectRule[] = [];\n\tfor (const r of redirects) {\n\t\tif (r.isPattern) {\n\t\t\tpatterns.push({ redirect: r, compiled: compilePattern(r.source) });\n\t\t} else {\n\t\t\texact.set(r.source, r);\n\t\t}\n\t}\n\tcachedRedirects = { exact, patterns };\n\treturn cachedRedirects;\n}\n\n/**\n * Match a path against the cached pattern rules.\n * Returns the resolved destination and matching redirect, or null.\n */\nexport function matchCachedPatterns(\n\trules: CachedRedirectRule[],\n\tpathname: string,\n): { redirect: Redirect; destination: string } | null {\n\tfor (const { redirect, compiled } of rules) {\n\t\tconst params = matchPattern(compiled, pathname);\n\t\tif (params) {\n\t\t\tconst dest = interpolateDestination(redirect.destination, params);\n\t\t\treturn { redirect, destination: dest };\n\t\t}\n\t}\n\treturn null;\n}\n"],"mappings":";;;;;;;;;;;;;;AAmCA,IAAI,kBAA0C;;;;;AAM9C,SAAgB,0BAAgC;AAC/C,mBAAkB;;;;;AAMnB,SAAgB,qBAA6C;AAC5D,QAAO;;;;;;;AAQR,SAAgB,mBAAmB,WAAwC;CAC1E,MAAM,wBAAQ,IAAI,KAAuB;CACzC,MAAM,WAAiC,EAAE;AACzC,MAAK,MAAM,KAAK,UACf,KAAI,EAAE,UACL,UAAS,KAAK;EAAE,UAAU;EAAG,UAAU,eAAe,EAAE,OAAO;EAAE,CAAC;KAElE,OAAM,IAAI,EAAE,QAAQ,EAAE;AAGxB,mBAAkB;EAAE;EAAO;EAAU;AACrC,QAAO;;;;;;AAOR,SAAgB,oBACf,OACA,UACqD;AACrD,MAAK,MAAM,EAAE,UAAU,cAAc,OAAO;EAC3C,MAAM,SAAS,aAAa,UAAU,SAAS;AAC/C,MAAI,OAEH,QAAO;GAAE;GAAU,aADN,uBAAuB,SAAS,aAAa,OAAO;GAC3B;;AAGxC,QAAO"}
@@ -46,4 +46,4 @@ async function cleanupExpiredChallenges(db) {
46
46
 
47
47
  //#endregion
48
48
  export { createChallengeStore as n, cleanupExpiredChallenges as t };
49
- //# sourceMappingURL=challenge-store-LhiqMccz.mjs.map
49
+ //# sourceMappingURL=challenge-store-anhwVER0.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"challenge-store-LhiqMccz.mjs","names":[],"sources":["../src/auth/challenge-store.ts"],"sourcesContent":["/**\n * Challenge store for WebAuthn\n *\n * Stores WebAuthn challenges in a dedicated table with automatic expiration.\n */\n\nimport type { ChallengeStore, ChallengeData } from \"@emdash-cms/auth/passkey\";\nimport type { Kysely } from \"kysely\";\n\nimport type { Database } from \"../database/types.js\";\n\nexport function createChallengeStore(db: Kysely<Database>): ChallengeStore {\n\treturn {\n\t\tasync set(challenge: string, data: ChallengeData): Promise<void> {\n\t\t\tconst expiresAt = new Date(data.expiresAt).toISOString();\n\n\t\t\tawait db\n\t\t\t\t.insertInto(\"auth_challenges\")\n\t\t\t\t.values({\n\t\t\t\t\tchallenge,\n\t\t\t\t\ttype: data.type,\n\t\t\t\t\tuser_id: data.userId ?? null,\n\t\t\t\t\tdata: null, // Could store additional context if needed\n\t\t\t\t\texpires_at: expiresAt,\n\t\t\t\t})\n\t\t\t\t.onConflict((oc) =>\n\t\t\t\t\toc.column(\"challenge\").doUpdateSet({\n\t\t\t\t\t\ttype: data.type,\n\t\t\t\t\t\tuser_id: data.userId ?? null,\n\t\t\t\t\t\texpires_at: expiresAt,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t\t.execute();\n\t\t},\n\n\t\tasync get(challenge: string): Promise<ChallengeData | null> {\n\t\t\tconst row = await db\n\t\t\t\t.selectFrom(\"auth_challenges\")\n\t\t\t\t.selectAll()\n\t\t\t\t.where(\"challenge\", \"=\", challenge)\n\t\t\t\t.executeTakeFirst();\n\n\t\t\tif (!row) return null;\n\n\t\t\tconst expiresAt = new Date(row.expires_at).getTime();\n\n\t\t\t// Check expiration\n\t\t\tif (expiresAt < Date.now()) {\n\t\t\t\t// Expired, delete and return null\n\t\t\t\tawait this.delete(challenge);\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttype: row.type === \"registration\" ? \"registration\" : \"authentication\",\n\t\t\t\tuserId: row.user_id ?? undefined,\n\t\t\t\texpiresAt,\n\t\t\t};\n\t\t},\n\n\t\tasync delete(challenge: string): Promise<void> {\n\t\t\tawait db.deleteFrom(\"auth_challenges\").where(\"challenge\", \"=\", challenge).execute();\n\t\t},\n\t};\n}\n\n/**\n * Clean up expired challenges.\n * Should be called periodically (e.g., on startup, or via cron).\n */\nexport async function cleanupExpiredChallenges(db: Kysely<Database>): Promise<number> {\n\tconst now = new Date().toISOString();\n\n\tconst result = await db\n\t\t.deleteFrom(\"auth_challenges\")\n\t\t.where(\"expires_at\", \"<\", now)\n\t\t.executeTakeFirst();\n\n\treturn Number(result.numDeletedRows ?? 0);\n}\n"],"mappings":";AAWA,SAAgB,qBAAqB,IAAsC;AAC1E,QAAO;EACN,MAAM,IAAI,WAAmB,MAAoC;GAChE,MAAM,YAAY,IAAI,KAAK,KAAK,UAAU,CAAC,aAAa;AAExD,SAAM,GACJ,WAAW,kBAAkB,CAC7B,OAAO;IACP;IACA,MAAM,KAAK;IACX,SAAS,KAAK,UAAU;IACxB,MAAM;IACN,YAAY;IACZ,CAAC,CACD,YAAY,OACZ,GAAG,OAAO,YAAY,CAAC,YAAY;IAClC,MAAM,KAAK;IACX,SAAS,KAAK,UAAU;IACxB,YAAY;IACZ,CAAC,CACF,CACA,SAAS;;EAGZ,MAAM,IAAI,WAAkD;GAC3D,MAAM,MAAM,MAAM,GAChB,WAAW,kBAAkB,CAC7B,WAAW,CACX,MAAM,aAAa,KAAK,UAAU,CAClC,kBAAkB;AAEpB,OAAI,CAAC,IAAK,QAAO;GAEjB,MAAM,YAAY,IAAI,KAAK,IAAI,WAAW,CAAC,SAAS;AAGpD,OAAI,YAAY,KAAK,KAAK,EAAE;AAE3B,UAAM,KAAK,OAAO,UAAU;AAC5B,WAAO;;AAGR,UAAO;IACN,MAAM,IAAI,SAAS,iBAAiB,iBAAiB;IACrD,QAAQ,IAAI,WAAW;IACvB;IACA;;EAGF,MAAM,OAAO,WAAkC;AAC9C,SAAM,GAAG,WAAW,kBAAkB,CAAC,MAAM,aAAa,KAAK,UAAU,CAAC,SAAS;;EAEpF;;;;;;AAOF,eAAsB,yBAAyB,IAAuC;CACrF,MAAM,uBAAM,IAAI,MAAM,EAAC,aAAa;CAEpC,MAAM,SAAS,MAAM,GACnB,WAAW,kBAAkB,CAC7B,MAAM,cAAc,KAAK,IAAI,CAC7B,kBAAkB;AAEpB,QAAO,OAAO,OAAO,kBAAkB,EAAE"}
1
+ {"version":3,"file":"challenge-store-anhwVER0.mjs","names":[],"sources":["../src/auth/challenge-store.ts"],"sourcesContent":["/**\n * Challenge store for WebAuthn\n *\n * Stores WebAuthn challenges in a dedicated table with automatic expiration.\n */\n\nimport type { ChallengeStore, ChallengeData } from \"@emdash-cms/auth/passkey\";\nimport type { Kysely } from \"kysely\";\n\nimport type { Database } from \"../database/types.js\";\n\nexport function createChallengeStore(db: Kysely<Database>): ChallengeStore {\n\treturn {\n\t\tasync set(challenge: string, data: ChallengeData): Promise<void> {\n\t\t\tconst expiresAt = new Date(data.expiresAt).toISOString();\n\n\t\t\tawait db\n\t\t\t\t.insertInto(\"auth_challenges\")\n\t\t\t\t.values({\n\t\t\t\t\tchallenge,\n\t\t\t\t\ttype: data.type,\n\t\t\t\t\tuser_id: data.userId ?? null,\n\t\t\t\t\tdata: null, // Could store additional context if needed\n\t\t\t\t\texpires_at: expiresAt,\n\t\t\t\t})\n\t\t\t\t.onConflict((oc) =>\n\t\t\t\t\toc.column(\"challenge\").doUpdateSet({\n\t\t\t\t\t\ttype: data.type,\n\t\t\t\t\t\tuser_id: data.userId ?? null,\n\t\t\t\t\t\texpires_at: expiresAt,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t\t.execute();\n\t\t},\n\n\t\tasync get(challenge: string): Promise<ChallengeData | null> {\n\t\t\tconst row = await db\n\t\t\t\t.selectFrom(\"auth_challenges\")\n\t\t\t\t.selectAll()\n\t\t\t\t.where(\"challenge\", \"=\", challenge)\n\t\t\t\t.executeTakeFirst();\n\n\t\t\tif (!row) return null;\n\n\t\t\tconst expiresAt = new Date(row.expires_at).getTime();\n\n\t\t\t// Check expiration\n\t\t\tif (expiresAt < Date.now()) {\n\t\t\t\t// Expired, delete and return null\n\t\t\t\tawait this.delete(challenge);\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttype: row.type === \"registration\" ? \"registration\" : \"authentication\",\n\t\t\t\tuserId: row.user_id ?? undefined,\n\t\t\t\texpiresAt,\n\t\t\t};\n\t\t},\n\n\t\tasync delete(challenge: string): Promise<void> {\n\t\t\tawait db.deleteFrom(\"auth_challenges\").where(\"challenge\", \"=\", challenge).execute();\n\t\t},\n\t};\n}\n\n/**\n * Clean up expired challenges.\n * Should be called periodically (e.g., on startup, or via cron).\n */\nexport async function cleanupExpiredChallenges(db: Kysely<Database>): Promise<number> {\n\tconst now = new Date().toISOString();\n\n\tconst result = await db\n\t\t.deleteFrom(\"auth_challenges\")\n\t\t.where(\"expires_at\", \"<\", now)\n\t\t.executeTakeFirst();\n\n\treturn Number(result.numDeletedRows ?? 0);\n}\n"],"mappings":";AAWA,SAAgB,qBAAqB,IAAsC;AAC1E,QAAO;EACN,MAAM,IAAI,WAAmB,MAAoC;GAChE,MAAM,YAAY,IAAI,KAAK,KAAK,UAAU,CAAC,aAAa;AAExD,SAAM,GACJ,WAAW,kBAAkB,CAC7B,OAAO;IACP;IACA,MAAM,KAAK;IACX,SAAS,KAAK,UAAU;IACxB,MAAM;IACN,YAAY;IACZ,CAAC,CACD,YAAY,OACZ,GAAG,OAAO,YAAY,CAAC,YAAY;IAClC,MAAM,KAAK;IACX,SAAS,KAAK,UAAU;IACxB,YAAY;IACZ,CAAC,CACF,CACA,SAAS;;EAGZ,MAAM,IAAI,WAAkD;GAC3D,MAAM,MAAM,MAAM,GAChB,WAAW,kBAAkB,CAC7B,WAAW,CACX,MAAM,aAAa,KAAK,UAAU,CAClC,kBAAkB;AAEpB,OAAI,CAAC,IAAK,QAAO;GAEjB,MAAM,YAAY,IAAI,KAAK,IAAI,WAAW,CAAC,SAAS;AAGpD,OAAI,YAAY,KAAK,KAAK,EAAE;AAE3B,UAAM,KAAK,OAAO,UAAU;AAC5B,WAAO;;AAGR,UAAO;IACN,MAAM,IAAI,SAAS,iBAAiB,iBAAiB;IACrD,QAAQ,IAAI,WAAW;IACvB;IACA;;EAGF,MAAM,OAAO,WAAkC;AAC9C,SAAM,GAAG,WAAW,kBAAkB,CAAC,MAAM,aAAa,KAAK,UAAU,CAAC,SAAS;;EAEpF;;;;;;AAOF,eAAsB,yBAAyB,IAAuC;CACrF,MAAM,uBAAM,IAAI,MAAM,EAAC,aAAa;CAEpC,MAAM,SAAS,MAAM,GACnB,WAAW,kBAAkB,CAC7B,MAAM,cAAc,KAAK,IAAI,CAC7B,kBAAkB;AAEpB,QAAO,OAAO,OAAO,kBAAkB,EAAE"}
@@ -1,4 +1,4 @@
1
- import { a as __exportAll } from "./runner-DPdt_Wpa.mjs";
1
+ import { a as __exportAll } from "./runner-K8XK101B.mjs";
2
2
 
3
3
  //#region src/utils/chunks.ts
4
4
  var chunks_exports = /* @__PURE__ */ __exportAll({
@@ -22,4 +22,4 @@ const SQL_BATCH_SIZE = 50;
22
22
 
23
23
  //#endregion
24
24
  export { chunks as n, chunks_exports as r, SQL_BATCH_SIZE as t };
25
- //# sourceMappingURL=chunks-OCG163rN.mjs.map
25
+ //# sourceMappingURL=chunks-B2isWQhr.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"chunks-OCG163rN.mjs","names":[],"sources":["../src/utils/chunks.ts"],"sourcesContent":["/**\n * Split an array into chunks of at most `size` elements.\n *\n * Used to keep SQL `IN (?, ?, …)` clauses within Cloudflare D1's\n * bound-parameter limit (~100 per statement).\n */\nexport function chunks<T>(arr: T[], size: number): T[][] {\n\tif (arr.length === 0) return [];\n\tconst result: T[][] = [];\n\tfor (let i = 0; i < arr.length; i += size) {\n\t\tresult.push(arr.slice(i, i + size));\n\t}\n\treturn result;\n}\n\n/** Conservative default chunk size for SQL IN clauses (well within D1's limit). */\nexport const SQL_BATCH_SIZE = 50;\n"],"mappings":";;;;;;;;;;;;;AAMA,SAAgB,OAAU,KAAU,MAAqB;AACxD,KAAI,IAAI,WAAW,EAAG,QAAO,EAAE;CAC/B,MAAM,SAAgB,EAAE;AACxB,MAAK,IAAI,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK,KACpC,QAAO,KAAK,IAAI,MAAM,GAAG,IAAI,KAAK,CAAC;AAEpC,QAAO;;;AAIR,MAAa,iBAAiB"}
1
+ {"version":3,"file":"chunks-B2isWQhr.mjs","names":[],"sources":["../src/utils/chunks.ts"],"sourcesContent":["/**\n * Split an array into chunks of at most `size` elements.\n *\n * Used to keep SQL `IN (?, ?, …)` clauses within Cloudflare D1's\n * bound-parameter limit (~100 per statement).\n */\nexport function chunks<T>(arr: T[], size: number): T[][] {\n\tif (arr.length === 0) return [];\n\tconst result: T[][] = [];\n\tfor (let i = 0; i < arr.length; i += size) {\n\t\tresult.push(arr.slice(i, i + size));\n\t}\n\treturn result;\n}\n\n/** Conservative default chunk size for SQL IN clauses (well within D1's limit). */\nexport const SQL_BATCH_SIZE = 50;\n"],"mappings":";;;;;;;;;;;;;AAMA,SAAgB,OAAU,KAAU,MAAqB;AACxD,KAAI,IAAI,WAAW,EAAG,QAAO,EAAE;CAC/B,MAAM,SAAgB,EAAE;AACxB,MAAK,IAAI,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK,KACpC,QAAO,KAAK,IAAI,MAAM,GAAG,IAAI,KAAK,CAAC;AAEpC,QAAO;;;AAIR,MAAa,iBAAiB"}
@@ -1,38 +1,39 @@
1
1
  #!/usr/bin/env node
2
- import { a as __exportAll, i as runMigrations, n as getMigrationStatus } from "../runner-DPdt_Wpa.mjs";
2
+ import { a as __exportAll, i as runMigrations, n as getMigrationStatus } from "../runner-K8XK101B.mjs";
3
3
  import { t as EmDashDatabaseError } from "../errors-9P_FDrJ_.mjs";
4
4
  import { t as validateIdentifier } from "../validate-VPnKoIzW.mjs";
5
5
  import { c as listTablesLike } from "../dialect-helpers-DRI5pyY3.mjs";
6
6
  import { n as getI18nConfig, r as isI18nEnabled } from "../config-CVssduLe.mjs";
7
7
  import "../after-B1IIdH3Y.mjs";
8
- import "../object-cache-CHbHv83-.mjs";
8
+ import "../object-cache-Bok5j2ae.mjs";
9
9
  import { n as slugify } from "../slugify-Cce3dTdg.mjs";
10
- import { t as ContentRepository } from "../content-ncUWWjna.mjs";
10
+ import { t as ContentRepository } from "../content-DhgEth4k.mjs";
11
11
  import { i as encodeBase64url } from "../base64-CmWvODNW.mjs";
12
- import "../types-CZgK3EMW.mjs";
13
- import { t as MediaRepository } from "../media-C5t_eCnk.mjs";
14
- import { t as TaxonomyRepository } from "../taxonomy-BU0LjdVb.mjs";
12
+ import "../types-CuW0zWDA.mjs";
13
+ import { t as MediaRepository } from "../media-BrXIaMFN.mjs";
14
+ import { t as TaxonomyRepository } from "../taxonomy-BxGxZZdu.mjs";
15
15
  import { t as OptionsRepository } from "../options-DTTML-Tx.mjs";
16
- import "../redirect-_M0trWoo.mjs";
16
+ import "../redirect-IyfNirgS.mjs";
17
17
  import "../request-cache-KCNHp_RJ.mjs";
18
18
  import "../byline-registry-BOjqDOim.mjs";
19
- import "../field-defs-cache-ljXzJCfc.mjs";
20
- import { t as BylineRepository } from "../byline-LL8lyqdb.mjs";
19
+ import "../field-defs-cache-WUI88LX5.mjs";
20
+ import { t as BylineRepository } from "../byline-Bm8ZgUP9.mjs";
21
21
  import { n as isMissingTableError } from "../db-errors-CK46D-ly.mjs";
22
- import "../fts-manager-BbCCbEKA.mjs";
23
- import { n as SchemaRegistry } from "../registry-g8yYt4cC.mjs";
22
+ import "../content-refresh-CA4uKwzH.mjs";
23
+ import "../fts-manager-BbFaF_V8.mjs";
24
+ import { n as SchemaRegistry } from "../registry-B65mUtPa.mjs";
24
25
  import { kyselyLogOption } from "../database/instrumentation.mjs";
25
- import "../loader-BA_zhkS_.mjs";
26
- import "../settings-DJeki-97.mjs";
27
- import { i as pluginManifestSchema } from "../manifest-schema-kPGX7VS-.mjs";
28
- import { i as isDeprecatedCapability, n as capabilitiesToDeclaredAccess, t as CAPABILITY_RENAMES } from "../types-BvbeGEtr.mjs";
29
- import "../ssrf-BRKb343l.mjs";
30
- import "../ssrf-CcX9zvMK.mjs";
31
- import { t as validateSeed } from "../validate-CuJ1Ps9j.mjs";
32
- import { t as applySeed } from "../apply--IVNSdXn.mjs";
33
- import { n as fingerprintKey, r as generateEncryptionKey, t as EmDashSecretsError } from "../secrets-BSf9pRRY.mjs";
26
+ import "../loader-CB6YHeul.mjs";
27
+ import "../settings-zhmdKyJQ.mjs";
28
+ import { i as pluginManifestSchema } from "../manifest-schema-BHlgZM1W.mjs";
29
+ import { i as isDeprecatedCapability, n as capabilitiesToDeclaredAccess, t as CAPABILITY_RENAMES } from "../types-DROWRxYV.mjs";
30
+ import "../ssrf-1g7usGBg.mjs";
31
+ import "../ssrf-CmuGgCq3.mjs";
32
+ import { t as validateSeed } from "../validate-CWSnKVIJ.mjs";
33
+ import { t as applySeed } from "../apply-Bu-8nYHL.mjs";
34
+ import { n as fingerprintKey, r as generateEncryptionKey, t as EmDashSecretsError } from "../secrets-kp760LlD.mjs";
34
35
  import { LocalStorage } from "../storage/local.mjs";
35
- import { t as convertDataForRead } from "../portable-text-BICg8bTk.mjs";
36
+ import { t as convertDataForRead } from "../portable-text-cCa0cGV6.mjs";
36
37
  import { createHeaderAwareFetch, customHeadersInterceptor, getCachedAccessToken, isAccessRedirect, resolveCustomHeaders, runCloudflaredLogin } from "../client/cf-access.mjs";
37
38
  import { EmDashClient } from "../client/index.mjs";
38
39
  import { Kysely, SqliteDialect, sql } from "kysely";
@@ -4255,7 +4256,7 @@ const seedCommand = defineCommand({
4255
4256
  },
4256
4257
  "no-content": {
4257
4258
  type: "boolean",
4258
- description: "Skip sample content",
4259
+ description: "Skip sample data (content entries, bylines, taxonomy terms)",
4259
4260
  default: false
4260
4261
  },
4261
4262
  "on-conflict": {