emdash 0.27.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 (534) hide show
  1. package/dist/{adapters-u037EnTR.d.mts → adapters-hUy8vOB-.d.mts} +1 -1
  2. package/dist/{adapters-u037EnTR.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-80kycR9o.mjs → api-BFURZn1i.mjs} +33 -23
  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-DSypk6Iu.mjs → apply-Bu-8nYHL.mjs} +111 -74
  15. package/dist/apply-Bu-8nYHL.mjs.map +1 -0
  16. package/dist/astro/index.d.mts +12 -12
  17. package/dist/astro/index.mjs +3 -3
  18. package/dist/astro/index.mjs.map +1 -1
  19. package/dist/astro/middleware/auth.d.mts +10 -10
  20. package/dist/astro/middleware/auth.d.mts.map +1 -1
  21. package/dist/astro/middleware/auth.mjs +50 -11
  22. package/dist/astro/middleware/auth.mjs.map +1 -1
  23. package/dist/astro/middleware/redirect.mjs +5 -5
  24. package/dist/astro/middleware/request-context.mjs +2 -2
  25. package/dist/astro/middleware/setup.mjs +1 -1
  26. package/dist/astro/middleware.d.mts +2 -2
  27. package/dist/astro/middleware.mjs +124 -71
  28. package/dist/astro/middleware.mjs.map +1 -1
  29. package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +6 -6
  30. package/dist/astro/routes/api/admin/allowed-domains/index.mjs +6 -6
  31. package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +4 -4
  32. package/dist/astro/routes/api/admin/api-tokens/index.mjs +5 -5
  33. package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +4 -4
  34. package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +8 -8
  35. package/dist/astro/routes/api/admin/byline-fields/index.mjs +8 -8
  36. package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +8 -8
  37. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +14 -14
  38. package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +14 -14
  39. package/dist/astro/routes/api/admin/bylines/index.mjs +14 -14
  40. package/dist/astro/routes/api/admin/comments/_id_/status.mjs +12 -12
  41. package/dist/astro/routes/api/admin/comments/_id_.mjs +6 -6
  42. package/dist/astro/routes/api/admin/comments/bulk.mjs +10 -10
  43. package/dist/astro/routes/api/admin/comments/counts.mjs +6 -6
  44. package/dist/astro/routes/api/admin/comments/index.mjs +10 -10
  45. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +4 -4
  46. package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +3 -3
  47. package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +4 -4
  48. package/dist/astro/routes/api/admin/oauth-clients/index.mjs +4 -4
  49. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +37 -36
  50. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs.map +1 -1
  51. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +37 -36
  52. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs.map +1 -1
  53. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +36 -35
  54. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs.map +1 -1
  55. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +36 -35
  56. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs.map +1 -1
  57. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +36 -35
  58. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs.map +1 -1
  59. package/dist/astro/routes/api/admin/plugins/index.mjs +36 -35
  60. package/dist/astro/routes/api/admin/plugins/index.mjs.map +1 -1
  61. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +3 -3
  62. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +36 -35
  63. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs.map +1 -1
  64. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +36 -35
  65. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs.map +1 -1
  66. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +36 -35
  67. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs.map +1 -1
  68. package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs +36 -35
  69. package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs.map +1 -1
  70. package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs +37 -36
  71. package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs.map +1 -1
  72. package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs +36 -35
  73. package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs.map +1 -1
  74. package/dist/astro/routes/api/admin/plugins/registry/install.mjs +37 -36
  75. package/dist/astro/routes/api/admin/plugins/registry/install.mjs.map +1 -1
  76. package/dist/astro/routes/api/admin/plugins/updates.mjs +36 -35
  77. package/dist/astro/routes/api/admin/plugins/updates.mjs.map +1 -1
  78. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +36 -35
  79. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs.map +1 -1
  80. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +3 -3
  81. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +36 -35
  82. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs.map +1 -1
  83. package/dist/astro/routes/api/admin/users/_id_/disable.mjs +2 -2
  84. package/dist/astro/routes/api/admin/users/_id_/enable.mjs +2 -2
  85. package/dist/astro/routes/api/admin/users/_id_/index.mjs +6 -6
  86. package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +3 -3
  87. package/dist/astro/routes/api/admin/users/index.mjs +6 -6
  88. package/dist/astro/routes/api/auth/dev-bypass.mjs +5 -5
  89. package/dist/astro/routes/api/auth/invite/accept.mjs +2 -2
  90. package/dist/astro/routes/api/auth/invite/complete.mjs +10 -10
  91. package/dist/astro/routes/api/auth/invite/index.mjs +7 -7
  92. package/dist/astro/routes/api/auth/invite/register-options.mjs +9 -9
  93. package/dist/astro/routes/api/auth/logout.mjs +3 -3
  94. package/dist/astro/routes/api/auth/magic-link/send.mjs +9 -9
  95. package/dist/astro/routes/api/auth/magic-link/verify.mjs +3 -3
  96. package/dist/astro/routes/api/auth/me.mjs +7 -7
  97. package/dist/astro/routes/api/auth/mode.mjs +1 -1
  98. package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +3 -3
  99. package/dist/astro/routes/api/auth/oauth/_provider_.mjs +2 -2
  100. package/dist/astro/routes/api/auth/passkey/_id_.mjs +6 -6
  101. package/dist/astro/routes/api/auth/passkey/index.mjs +2 -2
  102. package/dist/astro/routes/api/auth/passkey/options.mjs +11 -11
  103. package/dist/astro/routes/api/auth/passkey/register/options.mjs +9 -9
  104. package/dist/astro/routes/api/auth/passkey/register/verify.mjs +10 -10
  105. package/dist/astro/routes/api/auth/passkey/verify.mjs +10 -10
  106. package/dist/astro/routes/api/auth/signup/complete.mjs +10 -10
  107. package/dist/astro/routes/api/auth/signup/request.mjs +9 -9
  108. package/dist/astro/routes/api/auth/signup/verify.mjs +2 -2
  109. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +13 -13
  110. package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +12 -12
  111. package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +3 -3
  112. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +3 -3
  113. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +3 -3
  114. package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +3 -3
  115. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +10 -10
  116. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +7 -7
  117. package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +3 -3
  118. package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +3 -3
  119. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +7 -7
  120. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +13 -13
  121. package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +3 -3
  122. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +3 -3
  123. package/dist/astro/routes/api/content/_collection_/_id_.mjs +7 -7
  124. package/dist/astro/routes/api/content/_collection_/authors.mjs +3 -3
  125. package/dist/astro/routes/api/content/_collection_/index.mjs +7 -7
  126. package/dist/astro/routes/api/content/_collection_/trash.mjs +7 -7
  127. package/dist/astro/routes/api/dashboard.mjs +8 -8
  128. package/dist/astro/routes/api/dev/emails.mjs +3 -3
  129. package/dist/astro/routes/api/import/probe.d.mts +3 -3
  130. package/dist/astro/routes/api/import/probe.mjs +19 -11
  131. package/dist/astro/routes/api/import/probe.mjs.map +1 -1
  132. package/dist/astro/routes/api/import/wordpress/analyze.mjs +3 -3
  133. package/dist/astro/routes/api/import/wordpress/execute.d.mts +11 -41
  134. package/dist/astro/routes/api/import/wordpress/execute.d.mts.map +1 -1
  135. package/dist/astro/routes/api/import/wordpress/execute.mjs +12 -407
  136. package/dist/astro/routes/api/import/wordpress/execute.mjs.map +1 -1
  137. package/dist/astro/routes/api/import/wordpress/media.d.mts +10 -10
  138. package/dist/astro/routes/api/import/wordpress/media.mjs +9 -9
  139. package/dist/astro/routes/api/import/wordpress/prepare.mjs +9 -9
  140. package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +19 -1
  141. package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts.map +1 -1
  142. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +97 -79
  143. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs.map +1 -1
  144. package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
  145. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +19 -11
  146. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs.map +1 -1
  147. package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +40 -2
  148. package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts.map +1 -1
  149. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +519 -39
  150. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs.map +1 -1
  151. package/dist/astro/routes/api/manifest.mjs +4 -4
  152. package/dist/astro/routes/api/mcp.mjs +39 -39
  153. package/dist/astro/routes/api/media/_id_/confirm.mjs +7 -7
  154. package/dist/astro/routes/api/media/_id_.mjs +7 -7
  155. package/dist/astro/routes/api/media/file/_...key_.mjs +2 -2
  156. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +3 -3
  157. package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +3 -3
  158. package/dist/astro/routes/api/media/providers/index.mjs +3 -3
  159. package/dist/astro/routes/api/media/upload-url.mjs +8 -8
  160. package/dist/astro/routes/api/media.mjs +9 -9
  161. package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +9 -9
  162. package/dist/astro/routes/api/menus/_name_/items.mjs +9 -9
  163. package/dist/astro/routes/api/menus/_name_/reorder.mjs +9 -9
  164. package/dist/astro/routes/api/menus/_name_/translations.mjs +9 -9
  165. package/dist/astro/routes/api/menus/_name_.mjs +9 -9
  166. package/dist/astro/routes/api/menus/index.mjs +9 -9
  167. package/dist/astro/routes/api/oauth/authorize.mjs +6 -6
  168. package/dist/astro/routes/api/oauth/device/authorize.mjs +6 -6
  169. package/dist/astro/routes/api/oauth/device/code.mjs +9 -9
  170. package/dist/astro/routes/api/oauth/device/token.mjs +8 -8
  171. package/dist/astro/routes/api/oauth/register.mjs +3 -3
  172. package/dist/astro/routes/api/oauth/token/refresh.mjs +6 -6
  173. package/dist/astro/routes/api/oauth/token/revoke.mjs +6 -6
  174. package/dist/astro/routes/api/oauth/token.mjs +6 -6
  175. package/dist/astro/routes/api/openapi.json.mjs +4 -4
  176. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +4 -4
  177. package/dist/astro/routes/api/redirects/404s/index.mjs +9 -9
  178. package/dist/astro/routes/api/redirects/404s/summary.mjs +9 -9
  179. package/dist/astro/routes/api/redirects/_id_.mjs +10 -10
  180. package/dist/astro/routes/api/redirects/index.mjs +10 -10
  181. package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +3 -3
  182. package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +3 -3
  183. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +36 -35
  184. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs.map +1 -1
  185. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +36 -35
  186. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs.map +1 -1
  187. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +36 -35
  188. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs.map +1 -1
  189. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +36 -35
  190. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs.map +1 -1
  191. package/dist/astro/routes/api/schema/collections/index.mjs +36 -35
  192. package/dist/astro/routes/api/schema/collections/index.mjs.map +1 -1
  193. package/dist/astro/routes/api/schema/index.mjs +7 -6
  194. package/dist/astro/routes/api/schema/index.mjs.map +1 -1
  195. package/dist/astro/routes/api/schema/orphans/_slug_.mjs +36 -35
  196. package/dist/astro/routes/api/schema/orphans/_slug_.mjs.map +1 -1
  197. package/dist/astro/routes/api/schema/orphans/index.mjs +36 -35
  198. package/dist/astro/routes/api/schema/orphans/index.mjs.map +1 -1
  199. package/dist/astro/routes/api/search/enable.mjs +10 -10
  200. package/dist/astro/routes/api/search/index.mjs +9 -9
  201. package/dist/astro/routes/api/search/rebuild.mjs +10 -10
  202. package/dist/astro/routes/api/search/stats.mjs +6 -6
  203. package/dist/astro/routes/api/search/suggest.mjs +9 -9
  204. package/dist/astro/routes/api/sections/_slug_.mjs +9 -9
  205. package/dist/astro/routes/api/sections/index.mjs +9 -9
  206. package/dist/astro/routes/api/settings/email.mjs +4 -4
  207. package/dist/astro/routes/api/settings.mjs +12 -12
  208. package/dist/astro/routes/api/setup/admin-verify.mjs +11 -11
  209. package/dist/astro/routes/api/setup/admin.mjs +10 -10
  210. package/dist/astro/routes/api/setup/dev-bypass.mjs +25 -24
  211. package/dist/astro/routes/api/setup/dev-bypass.mjs.map +1 -1
  212. package/dist/astro/routes/api/setup/dev-reset.mjs +2 -2
  213. package/dist/astro/routes/api/setup/index.mjs +26 -25
  214. package/dist/astro/routes/api/setup/index.mjs.map +1 -1
  215. package/dist/astro/routes/api/setup/status.mjs +4 -4
  216. package/dist/astro/routes/api/snapshot.mjs +6 -6
  217. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +13 -13
  218. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +13 -13
  219. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +13 -13
  220. package/dist/astro/routes/api/taxonomies/index.mjs +13 -13
  221. package/dist/astro/routes/api/themes/preview.mjs +5 -5
  222. package/dist/astro/routes/api/typegen.mjs +5 -5
  223. package/dist/astro/routes/api/well-known/auth.mjs +1 -1
  224. package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +2 -2
  225. package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +2 -2
  226. package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +7 -7
  227. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +9 -9
  228. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +9 -9
  229. package/dist/astro/routes/api/widget-areas/_name_.mjs +5 -5
  230. package/dist/astro/routes/api/widget-areas/index.mjs +9 -9
  231. package/dist/astro/routes/api/widget-components.mjs +3 -3
  232. package/dist/astro/routes/robots.txt.mjs +6 -6
  233. package/dist/astro/routes/sitemap-_collection_.xml.mjs +9 -9
  234. package/dist/astro/routes/sitemap.xml.mjs +7 -7
  235. package/dist/astro/types.d.mts +13 -13
  236. package/dist/auth/providers/github.d.mts +1 -1
  237. package/dist/auth/providers/google.d.mts +1 -1
  238. package/dist/{authorize-C3a_zGsM.mjs → authorize-Dz88F_Fw.mjs} +2 -2
  239. package/dist/{authorize-C3a_zGsM.mjs.map → authorize-Dz88F_Fw.mjs.map} +1 -1
  240. package/dist/{byline-DEKSVPTy.mjs → byline-Bm8ZgUP9.mjs} +6 -6
  241. package/dist/{byline-DEKSVPTy.mjs.map → byline-Bm8ZgUP9.mjs.map} +1 -1
  242. package/dist/{byline-fields-eyJMblSr.mjs → byline-fields-2Lp5Hbgf.mjs} +18 -3
  243. package/dist/byline-fields-2Lp5Hbgf.mjs.map +1 -0
  244. package/dist/{byline-fields-DaMKzkhO.mjs → byline-fields-CIx_GuN4.mjs} +1 -1
  245. package/dist/{byline-fields-DaMKzkhO.mjs.map → byline-fields-CIx_GuN4.mjs.map} +1 -1
  246. package/dist/{byline-fields-CtQ6blXd.d.mts → byline-fields-Cgrt9-aL.d.mts} +49 -34
  247. package/dist/{byline-fields-CtQ6blXd.d.mts.map → byline-fields-Cgrt9-aL.d.mts.map} +1 -1
  248. package/dist/{bylines-Ds4-otXl.mjs → bylines-6tm9mgQb.mjs} +4 -4
  249. package/dist/{bylines-Ds4-otXl.mjs.map → bylines-6tm9mgQb.mjs.map} +1 -1
  250. package/dist/{bylines-CiqgTHWF.mjs → bylines-Woq87129.mjs} +6 -6
  251. package/dist/{bylines-CiqgTHWF.mjs.map → bylines-Woq87129.mjs.map} +1 -1
  252. package/dist/{cache-Ciu3e3AF.mjs → cache-CEBAZjir.mjs} +2 -2
  253. package/dist/{cache-Ciu3e3AF.mjs.map → cache-CEBAZjir.mjs.map} +1 -1
  254. package/dist/{challenge-store-LhiqMccz.mjs → challenge-store-anhwVER0.mjs} +1 -1
  255. package/dist/{challenge-store-LhiqMccz.mjs.map → challenge-store-anhwVER0.mjs.map} +1 -1
  256. package/dist/{chunks-CZFiauig.mjs → chunks-B2isWQhr.mjs} +2 -2
  257. package/dist/{chunks-CZFiauig.mjs.map → chunks-B2isWQhr.mjs.map} +1 -1
  258. package/dist/cli/index.mjs +22 -21
  259. package/dist/cli/index.mjs.map +1 -1
  260. package/dist/client/cf-access.d.mts +1 -1
  261. package/dist/client/index.d.mts +1 -1
  262. package/dist/client/index.mjs +2 -2
  263. package/dist/{comment-CH1IrFFs.mjs → comment-CzeatwBV.mjs} +3 -3
  264. package/dist/{comment-CH1IrFFs.mjs.map → comment-CzeatwBV.mjs.map} +1 -1
  265. package/dist/{comment-reaction-kruNY-kP.mjs → comment-reaction-Cj9QJY7I.mjs} +2 -2
  266. package/dist/{comment-reaction-kruNY-kP.mjs.map → comment-reaction-Cj9QJY7I.mjs.map} +1 -1
  267. package/dist/{comments-BUJyXbgq.mjs → comments-BLE-jv5k.mjs} +3 -3
  268. package/dist/{comments-BUJyXbgq.mjs.map → comments-BLE-jv5k.mjs.map} +1 -1
  269. package/dist/{components-CYt4uVK9.mjs → components-B_sATNUc.mjs} +1 -1
  270. package/dist/{components-CYt4uVK9.mjs.map → components-B_sATNUc.mjs.map} +1 -1
  271. package/dist/{content-RmfHoWqK.mjs → content-DhgEth4k.mjs} +4 -4
  272. package/dist/{content-RmfHoWqK.mjs.map → content-DhgEth4k.mjs.map} +1 -1
  273. package/dist/content-refresh-CA4uKwzH.mjs +1531 -0
  274. package/dist/content-refresh-CA4uKwzH.mjs.map +1 -0
  275. package/dist/{context-CzUU_WzL.mjs → context-CUsR9dXL.mjs} +76 -54
  276. package/dist/context-CUsR9dXL.mjs.map +1 -0
  277. package/dist/{cron-C5LVoNmP.mjs → cron-v4FTEFR_.mjs} +1 -1
  278. package/dist/{cron-C5LVoNmP.mjs.map → cron-v4FTEFR_.mjs.map} +1 -1
  279. package/dist/{dashboard-CVyGhift.mjs → dashboard-EvEKF5en.mjs} +4 -4
  280. package/dist/{dashboard-CVyGhift.mjs.map → dashboard-EvEKF5en.mjs.map} +1 -1
  281. package/dist/db/index.d.mts +3 -3
  282. package/dist/db/index.mjs +1 -1
  283. package/dist/db/libsql.d.mts +1 -1
  284. package/dist/db/postgres.d.mts +1 -1
  285. package/dist/db/sqlite.d.mts +1 -1
  286. package/dist/{default-CeRG-Ot4.mjs → default-CM_D83Mg.mjs} +1 -1
  287. package/dist/{default-CeRG-Ot4.mjs.map → default-CM_D83Mg.mjs.map} +1 -1
  288. package/dist/{device-flow-DENDCQ9F.mjs → device-flow-CfGP18Uw.mjs} +4 -4
  289. package/dist/{device-flow-DENDCQ9F.mjs.map → device-flow-CfGP18Uw.mjs.map} +1 -1
  290. package/dist/{email-console-DJP32ucW.mjs → email-console-CIf4Lfvv.mjs} +1 -1
  291. package/dist/{email-console-DJP32ucW.mjs.map → email-console-CIf4Lfvv.mjs.map} +1 -1
  292. package/dist/{error-BHkLZk-w.mjs → error-CkAseSqZ.mjs} +2 -2
  293. package/dist/{error-BHkLZk-w.mjs.map → error-CkAseSqZ.mjs.map} +1 -1
  294. package/dist/{escape-Bjio4ZsM.mjs → escape-DqD0aCKu.mjs} +1 -1
  295. package/dist/{escape-Bjio4ZsM.mjs.map → escape-DqD0aCKu.mjs.map} +1 -1
  296. package/dist/{field-defs-cache-BA-8ZPiT.mjs → field-defs-cache-WUI88LX5.mjs} +2 -2
  297. package/dist/{field-defs-cache-BA-8ZPiT.mjs.map → field-defs-cache-WUI88LX5.mjs.map} +1 -1
  298. package/dist/{fts-manager-Db9jGavf.mjs → fts-manager-BbFaF_V8.mjs} +2 -2
  299. package/dist/{fts-manager-Db9jGavf.mjs.map → fts-manager-BbFaF_V8.mjs.map} +1 -1
  300. package/dist/{import-Bb1T9WJS.mjs → import-fYLf14Co.mjs} +514 -25
  301. package/dist/import-fYLf14Co.mjs.map +1 -0
  302. package/dist/{index-CDZZjrLT.d.mts → index-B9sIxwe4.d.mts} +21 -22
  303. package/dist/{index-CDZZjrLT.d.mts.map → index-B9sIxwe4.d.mts.map} +1 -1
  304. package/dist/{index-DGIjmUXQ.d.mts → index-Bm-Gy8Mh.d.mts} +25 -4
  305. package/dist/index-Bm-Gy8Mh.d.mts.map +1 -0
  306. package/dist/index.d.mts +18 -18
  307. package/dist/index.mjs +54 -53
  308. package/dist/{load-DpHICVPh.mjs → load-Djn3HWQS.mjs} +2 -2
  309. package/dist/{load-DpHICVPh.mjs.map → load-Djn3HWQS.mjs.map} +1 -1
  310. package/dist/{loader-4K37qA-y.mjs → loader-CB6YHeul.mjs} +6 -5
  311. package/dist/loader-CB6YHeul.mjs.map +1 -0
  312. package/dist/{manifest-schema-kPGX7VS-.mjs → manifest-schema-BHlgZM1W.mjs} +1 -1
  313. package/dist/{manifest-schema-kPGX7VS-.mjs.map → manifest-schema-BHlgZM1W.mjs.map} +1 -1
  314. package/dist/media/index.d.mts +1 -1
  315. package/dist/media/local-runtime.d.mts +12 -12
  316. package/dist/media/local-runtime.mjs +5 -5
  317. package/dist/{media-C0nRRfs1.mjs → media-BrXIaMFN.mjs} +2 -2
  318. package/dist/{media-C0nRRfs1.mjs.map → media-BrXIaMFN.mjs.map} +1 -1
  319. package/dist/{media-allowlist-Du8t1u6a.mjs → media-allowlist-CRHEeJ_i.mjs} +1 -1
  320. package/dist/{media-allowlist-Du8t1u6a.mjs.map → media-allowlist-CRHEeJ_i.mjs.map} +1 -1
  321. package/dist/{media-url-O4rm9-SQ.mjs → media-url-CKi5XSw4.mjs} +1 -1
  322. package/dist/{media-url-O4rm9-SQ.mjs.map → media-url-CKi5XSw4.mjs.map} +1 -1
  323. package/dist/{menus-SL2K0xq2.mjs → menus-Cfivc2Ad.mjs} +3 -3
  324. package/dist/{menus-SL2K0xq2.mjs.map → menus-Cfivc2Ad.mjs.map} +1 -1
  325. package/dist/{menus-DzRyC1ID.mjs → menus-CsZ2ZEK2.mjs} +16 -12
  326. package/dist/{menus-DzRyC1ID.mjs.map → menus-CsZ2ZEK2.mjs.map} +1 -1
  327. package/dist/{mode-BB0F8xTC.mjs → mode-BM9QgEmt.mjs} +1 -1
  328. package/dist/{mode-BB0F8xTC.mjs.map → mode-BM9QgEmt.mjs.map} +1 -1
  329. package/dist/{oauth-authorization-CsvzIp_F.mjs → oauth-authorization-CXWkIGT4.mjs} +4 -4
  330. package/dist/{oauth-authorization-CsvzIp_F.mjs.map → oauth-authorization-CXWkIGT4.mjs.map} +1 -1
  331. package/dist/{oauth-clients-C9SYwEbZ.mjs → oauth-clients-BmTI5rsl.mjs} +1 -1
  332. package/dist/{oauth-clients-C9SYwEbZ.mjs.map → oauth-clients-BmTI5rsl.mjs.map} +1 -1
  333. package/dist/{oauth-state-store---zrApfB.mjs → oauth-state-store-YLFLcH5F.mjs} +1 -1
  334. package/dist/{oauth-state-store---zrApfB.mjs.map → oauth-state-store-YLFLcH5F.mjs.map} +1 -1
  335. package/dist/{oauth-user-lookup-SHsWRlG9.mjs → oauth-user-lookup-Bsc_GsX-.mjs} +1 -1
  336. package/dist/{oauth-user-lookup-SHsWRlG9.mjs.map → oauth-user-lookup-Bsc_GsX-.mjs.map} +1 -1
  337. package/dist/object-cache/memory.d.mts +1 -1
  338. package/dist/{object-cache-CHbHv83-.mjs → object-cache-Bok5j2ae.mjs} +43 -3
  339. package/dist/object-cache-Bok5j2ae.mjs.map +1 -0
  340. package/dist/{options-41nCWqi9.d.mts → options-iMpRRxIe.d.mts} +3 -3
  341. package/dist/{options-41nCWqi9.d.mts.map → options-iMpRRxIe.d.mts.map} +1 -1
  342. package/dist/page/index.d.mts +2 -2
  343. package/dist/{parse-CqyZj3Hp.mjs → parse-GmjecGct.mjs} +2 -2
  344. package/dist/{parse-CqyZj3Hp.mjs.map → parse-GmjecGct.mjs.map} +1 -1
  345. package/dist/{passkey-config-C0YfSBko.mjs → passkey-config-De0ahnRg.mjs} +1 -1
  346. package/dist/{passkey-config-C0YfSBko.mjs.map → passkey-config-De0ahnRg.mjs.map} +1 -1
  347. package/dist/{placeholder-Cuce9U-m.d.mts → placeholder-BSKwzRe4.d.mts} +1 -1
  348. package/dist/{placeholder-Cuce9U-m.d.mts.map → placeholder-BSKwzRe4.d.mts.map} +1 -1
  349. package/dist/plugin-types.d.mts +1 -1
  350. package/dist/plugin-utils.d.mts +10 -10
  351. package/dist/plugins/adapt-sandbox-entry.d.mts +10 -10
  352. package/dist/plugins/adapt-sandbox-entry.mjs +2 -2
  353. package/dist/{portable-text-BICg8bTk.mjs → portable-text-cCa0cGV6.mjs} +1 -1
  354. package/dist/{portable-text-BICg8bTk.mjs.map → portable-text-cCa0cGV6.mjs.map} +1 -1
  355. package/dist/{preview-DKGCt2_p.mjs → preview-SSXNVPAC.mjs} +2 -2
  356. package/dist/{preview-DKGCt2_p.mjs.map → preview-SSXNVPAC.mjs.map} +1 -1
  357. package/dist/{public-url-CTVqgMmg.mjs → public-url-Danv47cS.mjs} +1 -1
  358. package/dist/{public-url-CTVqgMmg.mjs.map → public-url-Danv47cS.mjs.map} +1 -1
  359. package/dist/{query-B0M-9LYR.mjs → query-ByGq6ver.mjs} +14 -14
  360. package/dist/{query-B0M-9LYR.mjs.map → query-ByGq6ver.mjs.map} +1 -1
  361. package/dist/{rate-limit-BwoUdIpC.mjs → rate-limit-C_Lf63Dd.mjs} +2 -2
  362. package/dist/{rate-limit-BwoUdIpC.mjs.map → rate-limit-C_Lf63Dd.mjs.map} +1 -1
  363. package/dist/{redirect-CS-PHtNh.mjs → redirect-CoW3G-0U.mjs} +1 -1
  364. package/dist/{redirect-CS-PHtNh.mjs.map → redirect-CoW3G-0U.mjs.map} +1 -1
  365. package/dist/{redirect-lMOzG04S.mjs → redirect-IyfNirgS.mjs} +2 -2
  366. package/dist/{redirect-lMOzG04S.mjs.map → redirect-IyfNirgS.mjs.map} +1 -1
  367. package/dist/{redirects-9218MmYl.mjs → redirects-Bs1g42Ri.mjs} +4 -4
  368. package/dist/{redirects-9218MmYl.mjs.map → redirects-Bs1g42Ri.mjs.map} +1 -1
  369. package/dist/{redirects-Dcbuisoj.mjs → redirects-DXEXBAII.mjs} +2 -2
  370. package/dist/{redirects-Dcbuisoj.mjs.map → redirects-DXEXBAII.mjs.map} +1 -1
  371. package/dist/{registry-DP-iEtdR.mjs → registry-B65mUtPa.mjs} +122 -79
  372. package/dist/registry-B65mUtPa.mjs.map +1 -0
  373. package/dist/{request-meta-CmS1tDFf.mjs → request-meta-DbvXaAvU.mjs} +2 -2
  374. package/dist/{request-meta-CmS1tDFf.mjs.map → request-meta-DbvXaAvU.mjs.map} +1 -1
  375. package/dist/{resolve-C7I0qiR0.mjs → resolve-DR3wqMTy.mjs} +1 -1
  376. package/dist/{resolve-C7I0qiR0.mjs.map → resolve-DR3wqMTy.mjs.map} +1 -1
  377. package/dist/{runner-BbR3DfrL.d.mts → runner-DvFWoz8-.d.mts} +2 -2
  378. package/dist/{runner-BbR3DfrL.d.mts.map → runner-DvFWoz8-.d.mts.map} +1 -1
  379. package/dist/{runner-CFngB4WZ.mjs → runner-K8XK101B.mjs} +309 -190
  380. package/dist/runner-K8XK101B.mjs.map +1 -0
  381. package/dist/runtime.d.mts +11 -11
  382. package/dist/runtime.mjs +2 -2
  383. package/dist/{scheduled-publish-BMljtY5G.d.mts → scheduled-publish-Drffrf2a.d.mts} +1 -1
  384. package/dist/scheduled-publish-Drffrf2a.d.mts.map +1 -0
  385. package/dist/{schema-BfJ7bIXH.mjs → schema-Blhoxp3P.mjs} +5 -5
  386. package/dist/{schema-BfJ7bIXH.mjs.map → schema-Blhoxp3P.mjs.map} +1 -1
  387. package/dist/{search-C7t3PH1J.mjs → search-DZN2HZ-V.mjs} +4 -4
  388. package/dist/{search-C7t3PH1J.mjs.map → search-DZN2HZ-V.mjs.map} +1 -1
  389. package/dist/{secrets-BSf9pRRY.mjs → secrets-kp760LlD.mjs} +2 -2
  390. package/dist/{secrets-BSf9pRRY.mjs.map → secrets-kp760LlD.mjs.map} +1 -1
  391. package/dist/{sections-Dm0CVX23.mjs → sections-CpF5SaGr.mjs} +3 -3
  392. package/dist/{sections-Dm0CVX23.mjs.map → sections-CpF5SaGr.mjs.map} +1 -1
  393. package/dist/seed/index.d.mts +2 -2
  394. package/dist/seed/index.mjs +19 -18
  395. package/dist/seo/index.d.mts +1 -1
  396. package/dist/seo/index.mjs +1 -1
  397. package/dist/{seo-BkhuuaaE.mjs → seo-89-53DDs.mjs} +1 -1
  398. package/dist/{seo-BkhuuaaE.mjs.map → seo-89-53DDs.mjs.map} +1 -1
  399. package/dist/{seo-Dd3tbY_k.mjs → seo-DXu2UQnC.mjs} +3 -3
  400. package/dist/{seo-Dd3tbY_k.mjs.map → seo-DXu2UQnC.mjs.map} +1 -1
  401. package/dist/{service-CTrqp_Jy.mjs → service-DQmiBMzt.mjs} +3 -3
  402. package/dist/{service-CTrqp_Jy.mjs.map → service-DQmiBMzt.mjs.map} +1 -1
  403. package/dist/{session-user-B8aLtKAH.mjs → session-user-Cascbax7.mjs} +1 -1
  404. package/dist/{session-user-B8aLtKAH.mjs.map → session-user-Cascbax7.mjs.map} +1 -1
  405. package/dist/{settings-CZ7ZP9cW.mjs → settings-rZyHEcNT.mjs} +3 -3
  406. package/dist/{settings-CZ7ZP9cW.mjs.map → settings-rZyHEcNT.mjs.map} +1 -1
  407. package/dist/{settings-BX8cWBus.mjs → settings-zhmdKyJQ.mjs} +5 -5
  408. package/dist/{settings-BX8cWBus.mjs.map → settings-zhmdKyJQ.mjs.map} +1 -1
  409. package/dist/{setup-complete-gEiySUc-.mjs → setup-complete-Cb3LRyzy.mjs} +1 -1
  410. package/dist/{setup-complete-gEiySUc-.mjs.map → setup-complete-Cb3LRyzy.mjs.map} +1 -1
  411. package/dist/{setup-nonce-DzS50zme.mjs → setup-nonce-Z8x0tHf8.mjs} +1 -1
  412. package/dist/{setup-nonce-DzS50zme.mjs.map → setup-nonce-Z8x0tHf8.mjs.map} +1 -1
  413. package/dist/{single-flight-cache-Cdfkic3t.mjs → single-flight-cache-BG3B_GhN.mjs} +1 -1
  414. package/dist/{single-flight-cache-Cdfkic3t.mjs.map → single-flight-cache-BG3B_GhN.mjs.map} +1 -1
  415. package/dist/{site-url-BLebyON8.mjs → site-url-BBfDTgZB.mjs} +1 -1
  416. package/dist/{site-url-BLebyON8.mjs.map → site-url-BBfDTgZB.mjs.map} +1 -1
  417. package/dist/{ssrf-BRKb343l.mjs → ssrf-1g7usGBg.mjs} +1 -1
  418. package/dist/{ssrf-BRKb343l.mjs.map → ssrf-1g7usGBg.mjs.map} +1 -1
  419. package/dist/{status-vUK0SA17.mjs → status-CqJQX1QN.mjs} +1 -1
  420. package/dist/{status-vUK0SA17.mjs.map → status-CqJQX1QN.mjs.map} +1 -1
  421. package/dist/storage/local.d.mts +1 -1
  422. package/dist/storage/local.mjs +1 -1
  423. package/dist/storage/s3.d.mts +1 -1
  424. package/dist/storage/s3.mjs +1 -1
  425. package/dist/{taxonomies-DChKcVxf.mjs → taxonomies-BGBd16Eu.mjs} +4 -4
  426. package/dist/{taxonomies-DChKcVxf.mjs.map → taxonomies-BGBd16Eu.mjs.map} +1 -1
  427. package/dist/{taxonomies-ckPjz-6d.mjs → taxonomies-Cnb4F-Pb.mjs} +7 -7
  428. package/dist/{taxonomies-ckPjz-6d.mjs.map → taxonomies-Cnb4F-Pb.mjs.map} +1 -1
  429. package/dist/{taxonomy-Cru-he6s.mjs → taxonomy-BxGxZZdu.mjs} +4 -4
  430. package/dist/{taxonomy-Cru-he6s.mjs.map → taxonomy-BxGxZZdu.mjs.map} +1 -1
  431. package/dist/{tokens-LeuXF9gG.mjs → tokens-BGT0TUUo.mjs} +1 -1
  432. package/dist/{tokens-LeuXF9gG.mjs.map → tokens-BGT0TUUo.mjs.map} +1 -1
  433. package/dist/{transport-Blrl2k_o.d.mts → transport-BMDWHSgZ.d.mts} +1 -1
  434. package/dist/{transport-Blrl2k_o.d.mts.map → transport-BMDWHSgZ.d.mts.map} +1 -1
  435. package/dist/{transport-_2nBz7e9.mjs → transport-DPefPMcz.mjs} +1 -1
  436. package/dist/{transport-_2nBz7e9.mjs.map → transport-DPefPMcz.mjs.map} +1 -1
  437. package/dist/{trusted-proxy-DZY5WCn2.mjs → trusted-proxy-VTPRiX2s.mjs} +1 -1
  438. package/dist/{trusted-proxy-DZY5WCn2.mjs.map → trusted-proxy-VTPRiX2s.mjs.map} +1 -1
  439. package/dist/{types-ETmO_jQr.d.mts → types-BcLUUbbR.d.mts} +2 -2
  440. package/dist/{types-ETmO_jQr.d.mts.map → types-BcLUUbbR.d.mts.map} +1 -1
  441. package/dist/{types-BYnDBVwe.d.mts → types-CGbYowGQ.d.mts} +2 -2
  442. package/dist/{types-BYnDBVwe.d.mts.map → types-CGbYowGQ.d.mts.map} +1 -1
  443. package/dist/{types-CvuKO5Pn.d.mts → types-CgvhU-hF.d.mts} +1 -1
  444. package/dist/{types-CvuKO5Pn.d.mts.map → types-CgvhU-hF.d.mts.map} +1 -1
  445. package/dist/{types-Y09-wtyU.d.mts → types-ClUkdbWb.d.mts} +1 -1
  446. package/dist/{types-Y09-wtyU.d.mts.map → types-ClUkdbWb.d.mts.map} +1 -1
  447. package/dist/{types-DU4TSFS5.mjs → types-CuW0zWDA.mjs} +2 -2
  448. package/dist/{types-DU4TSFS5.mjs.map → types-CuW0zWDA.mjs.map} +1 -1
  449. package/dist/{types-BkZ8DUEI.d.mts → types-DmHk7vAt.d.mts} +1 -1
  450. package/dist/{types-BkZ8DUEI.d.mts.map → types-DmHk7vAt.d.mts.map} +1 -1
  451. package/dist/{types-CQAugunJ.mjs → types-Jo3UYd6b.mjs} +1 -1
  452. package/dist/{types-CQAugunJ.mjs.map → types-Jo3UYd6b.mjs.map} +1 -1
  453. package/dist/{types-xIfVRNLp.d.mts → types-_HFLRzTn.d.mts} +22 -1
  454. package/dist/types-_HFLRzTn.d.mts.map +1 -0
  455. package/dist/{types-ByChcBgE.d.mts → types-ea9sAPck.d.mts} +1 -1
  456. package/dist/{types-ByChcBgE.d.mts.map → types-ea9sAPck.d.mts.map} +1 -1
  457. package/dist/{types-CNlaBFzx.d.mts → types-g_aFIdW0.d.mts} +1 -1
  458. package/dist/{types-CNlaBFzx.d.mts.map → types-g_aFIdW0.d.mts.map} +1 -1
  459. package/dist/{types-Dbqff978.d.mts → types-vgEWF18A.d.mts} +19 -1
  460. package/dist/{types-Dbqff978.d.mts.map → types-vgEWF18A.d.mts.map} +1 -1
  461. package/dist/{user-DgGbKL9s.mjs → user-BjAOvU3Z.mjs} +3 -3
  462. package/dist/{user-DgGbKL9s.mjs.map → user-BjAOvU3Z.mjs.map} +1 -1
  463. package/dist/{utils-B7A57fm9.mjs → utils-BJXElxdw.mjs} +156 -7
  464. package/dist/utils-BJXElxdw.mjs.map +1 -0
  465. package/dist/{validate-CRkcYZAR.mjs → validate-CWSnKVIJ.mjs} +2 -2
  466. package/dist/{validate-CRkcYZAR.mjs.map → validate-CWSnKVIJ.mjs.map} +1 -1
  467. package/dist/{validate-9ECmtEpJ.d.mts → validate-Z1b86_3B.d.mts} +5 -5
  468. package/dist/{validate-9ECmtEpJ.d.mts.map → validate-Z1b86_3B.d.mts.map} +1 -1
  469. package/dist/{validation-sR26SOwD.mjs → validation-c8WjhH8z.mjs} +8 -5
  470. package/dist/{validation-sR26SOwD.mjs.map → validation-c8WjhH8z.mjs.map} +1 -1
  471. package/dist/version-CaccU7DM.mjs +7 -0
  472. package/dist/{version-CrqhKGWn.mjs.map → version-CaccU7DM.mjs.map} +1 -1
  473. package/dist/{widgets-DRgtn7Cl.mjs → widgets-hWcIicX8.mjs} +3 -3
  474. package/dist/{widgets-DRgtn7Cl.mjs.map → widgets-hWcIicX8.mjs.map} +1 -1
  475. package/dist/wxr-taxonomies-0_uxSrmf.d.mts +34 -0
  476. package/dist/wxr-taxonomies-0_uxSrmf.d.mts.map +1 -0
  477. package/dist/wxr-taxonomies-BC3OYpvx.mjs +425 -0
  478. package/dist/wxr-taxonomies-BC3OYpvx.mjs.map +1 -0
  479. package/dist/{zod-generator-C5JaV--i.mjs → zod-generator-CacrR-i8.mjs} +2 -2
  480. package/dist/{zod-generator-C5JaV--i.mjs.map → zod-generator-CacrR-i8.mjs.map} +1 -1
  481. package/package.json +7 -7
  482. package/src/api/handlers/content.ts +10 -7
  483. package/src/api/schemas/import.ts +19 -0
  484. package/src/astro/integration/runtime.ts +3 -6
  485. package/src/astro/middleware/auth.ts +9 -3
  486. package/src/astro/middleware/csp.ts +54 -3
  487. package/src/astro/routes/admin.astro +9 -0
  488. package/src/astro/routes/api/import/wordpress/rewrite-urls.ts +122 -98
  489. package/src/astro/routes/api/import/wordpress-plugin/execute.ts +794 -44
  490. package/src/components/EmDashImage.astro +59 -23
  491. package/src/components/Image.astro +36 -35
  492. package/src/database/migrations/049_taxonomies_name_locale_index.ts +42 -0
  493. package/src/database/migrations/050_media_usage_index_status.ts +142 -0
  494. package/src/database/migrations/runner.ts +4 -0
  495. package/src/database/repositories/media-usage.ts +932 -58
  496. package/src/database/types.ts +22 -0
  497. package/src/emdash-runtime.ts +123 -3
  498. package/src/import/comments.ts +159 -0
  499. package/src/import/index.ts +8 -1
  500. package/src/import/settings.ts +65 -189
  501. package/src/import/sources/wordpress-plugin.ts +338 -42
  502. package/src/import/sources/wxr.ts +4 -1
  503. package/src/import/types.ts +12 -0
  504. package/src/import/utils.ts +207 -0
  505. package/src/import/wxr-taxonomies.ts +39 -0
  506. package/src/loader.ts +13 -2
  507. package/src/media/usage/content-fields.ts +119 -0
  508. package/src/media/usage/content-refresh.ts +524 -0
  509. package/src/media/usage/content-repair.ts +491 -0
  510. package/src/media/usage/content-snapshots.ts +435 -0
  511. package/src/media/usage/extractor.ts +4 -4
  512. package/src/media/usage/source-key.ts +22 -0
  513. package/src/menus/index.ts +17 -1
  514. package/src/object-cache/index.ts +82 -7
  515. package/src/plugins/context.ts +100 -71
  516. package/src/schema/registry.ts +240 -154
  517. package/src/seed/apply.ts +156 -99
  518. package/dist/api-80kycR9o.mjs.map +0 -1
  519. package/dist/apply-DSypk6Iu.mjs.map +0 -1
  520. package/dist/byline-fields-eyJMblSr.mjs.map +0 -1
  521. package/dist/context-CzUU_WzL.mjs.map +0 -1
  522. package/dist/import-Bb1T9WJS.mjs.map +0 -1
  523. package/dist/index-DGIjmUXQ.d.mts.map +0 -1
  524. package/dist/loader-4K37qA-y.mjs.map +0 -1
  525. package/dist/object-cache-CHbHv83-.mjs.map +0 -1
  526. package/dist/registry-DP-iEtdR.mjs.map +0 -1
  527. package/dist/runner-CFngB4WZ.mjs.map +0 -1
  528. package/dist/scheduled-publish-BMljtY5G.d.mts.map +0 -1
  529. package/dist/types-xIfVRNLp.d.mts.map +0 -1
  530. package/dist/utils-B7A57fm9.mjs.map +0 -1
  531. package/dist/version-CrqhKGWn.mjs +0 -7
  532. /package/dist/{api-tokens-B4BQybOp.mjs → api-tokens-DsvvCtdh.mjs} +0 -0
  533. /package/dist/{ssrf-CcX9zvMK.mjs → ssrf-CmuGgCq3.mjs} +0 -0
  534. /package/dist/{types-BvbeGEtr.mjs → types-DROWRxYV.mjs} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"widgets-DRgtn7Cl.mjs","names":["getComponentRegistry"],"sources":["../src/widgets/index.ts"],"sourcesContent":["import { getDb } from \"../loader.js\";\nimport { requestCached } from \"../request-cache.js\";\nimport { getWidgetComponents as getComponentRegistry } from \"./components.js\";\nimport type { Widget, WidgetArea, WidgetRow, WidgetComponentDef } from \"./types.js\";\n\nexport type {\n\tWidget,\n\tWidgetArea,\n\tWidgetType,\n\tWidgetComponentDef,\n\tPropDef,\n\tCreateWidgetAreaInput,\n\tCreateWidgetInput,\n\tUpdateWidgetInput,\n\tReorderWidgetsInput,\n} from \"./types.js\";\n\n/**\n * Get a widget area by name, with all its widgets.\n *\n * Single query with a left join rather than area-then-widgets so the\n * common case costs one round-trip. An area with no widgets yields one\n * row with null widget columns, which we skip when mapping.\n */\nexport async function getWidgetArea(name: string): Promise<WidgetArea | null> {\n\treturn requestCached(`widget-area:${name}`, async () => {\n\t\tconst db = await getDb();\n\t\tconst rows = await db\n\t\t\t.selectFrom(\"_emdash_widget_areas as a\")\n\t\t\t.leftJoin(\"_emdash_widgets as w\", \"w.area_id\", \"a.id\")\n\t\t\t.select([\n\t\t\t\t\"a.id as a_id\",\n\t\t\t\t\"a.name as a_name\",\n\t\t\t\t\"a.label as a_label\",\n\t\t\t\t\"a.description as a_description\",\n\t\t\t\t\"w.id as w_id\",\n\t\t\t\t\"w.type as w_type\",\n\t\t\t\t\"w.title as w_title\",\n\t\t\t\t\"w.content as w_content\",\n\t\t\t\t\"w.menu_name as w_menu_name\",\n\t\t\t\t\"w.component_id as w_component_id\",\n\t\t\t\t\"w.component_props as w_component_props\",\n\t\t\t\t\"w.area_id as w_area_id\",\n\t\t\t\t\"w.sort_order as w_sort_order\",\n\t\t\t\t\"w.created_at as w_created_at\",\n\t\t\t])\n\t\t\t.where(\"a.name\", \"=\", name)\n\t\t\t.orderBy(\"w.sort_order\", \"asc\")\n\t\t\t.execute();\n\n\t\tconst first = rows[0];\n\t\tif (!first) return null;\n\t\tconst widgets: Widget[] = [];\n\t\tfor (const row of rows) {\n\t\t\tif (row.w_id === null) continue; // area has no widgets (left-join null row)\n\t\t\t// Left-join makes every w_* column nullable in the type; at runtime\n\t\t\t// they're all non-null once w_id is (we match on widgets.area_id, so\n\t\t\t// a widget row always has the not-null columns filled). Cast is the\n\t\t\t// price of that structural fact.\n\t\t\t// eslint-disable-next-line typescript/no-unsafe-type-assertion -- left-join row is non-null when w_id is set; see above\n\t\t\tconst widgetRow = {\n\t\t\t\tid: row.w_id,\n\t\t\t\ttype: row.w_type,\n\t\t\t\ttitle: row.w_title,\n\t\t\t\tcontent: row.w_content,\n\t\t\t\tmenu_name: row.w_menu_name,\n\t\t\t\tcomponent_id: row.w_component_id,\n\t\t\t\tcomponent_props: row.w_component_props,\n\t\t\t\tarea_id: row.w_area_id,\n\t\t\t\tsort_order: row.w_sort_order,\n\t\t\t\tcreated_at: row.w_created_at,\n\t\t\t} as WidgetRow;\n\t\t\twidgets.push(rowToWidget(widgetRow));\n\t\t}\n\n\t\treturn {\n\t\t\tid: first.a_id,\n\t\t\tname: first.a_name,\n\t\t\tlabel: first.a_label,\n\t\t\tdescription: first.a_description ?? undefined,\n\t\t\twidgets,\n\t\t};\n\t});\n}\n\n/**\n * Get all widget areas with their widgets\n */\nexport async function getWidgetAreas(): Promise<WidgetArea[]> {\n\tconst db = await getDb();\n\t// Get all areas\n\tconst areaRows = await db.selectFrom(\"_emdash_widget_areas\").selectAll().execute();\n\n\t// Get all widgets\n\tconst widgetRows = await db\n\t\t.selectFrom(\"_emdash_widgets\")\n\t\t.selectAll()\n\t\t.$castTo<WidgetRow>()\n\t\t.orderBy(\"sort_order\", \"asc\")\n\t\t.execute();\n\n\t// Group widgets by area\n\tconst widgetsByArea = new Map<string, Widget[]>();\n\tfor (const row of widgetRows) {\n\t\tif (!widgetsByArea.has(row.area_id)) {\n\t\t\twidgetsByArea.set(row.area_id, []);\n\t\t}\n\t\twidgetsByArea.get(row.area_id)!.push(rowToWidget(row));\n\t}\n\n\t// Combine\n\treturn areaRows.map((areaRow) => ({\n\t\tid: areaRow.id,\n\t\tname: areaRow.name,\n\t\tlabel: areaRow.label,\n\t\tdescription: areaRow.description ?? undefined,\n\t\twidgets: widgetsByArea.get(areaRow.id) || [],\n\t}));\n}\n\n/**\n * Get available widget components (for admin UI)\n */\nexport function getWidgetComponents(): WidgetComponentDef[] {\n\treturn getComponentRegistry();\n}\n\n/**\n * Convert a widget row to the API type\n */\nexport function rowToWidget(row: WidgetRow): Widget {\n\tconst widget: Widget = {\n\t\tid: row.id,\n\t\ttype: row.type,\n\t\ttitle: row.title ?? undefined,\n\t};\n\n\t// Type-specific fields\n\tif (row.type === \"content\" && row.content) {\n\t\ttry {\n\t\t\twidget.content = JSON.parse(row.content);\n\t\t} catch {\n\t\t\t// Invalid JSON, ignore\n\t\t}\n\t}\n\n\tif (row.type === \"menu\" && row.menu_name) {\n\t\twidget.menuName = row.menu_name;\n\t}\n\n\tif (row.type === \"component\" && row.component_id) {\n\t\twidget.componentId = row.component_id;\n\t\tif (row.component_props) {\n\t\t\ttry {\n\t\t\t\twidget.componentProps = JSON.parse(row.component_props);\n\t\t\t} catch {\n\t\t\t\t// Invalid JSON, ignore\n\t\t\t}\n\t\t}\n\t}\n\n\treturn widget;\n}\n"],"mappings":";;;;;;;;;;;;AAwBA,eAAsB,cAAc,MAA0C;AAC7E,QAAO,cAAc,eAAe,QAAQ,YAAY;EAEvD,MAAM,OAAO,OADF,MAAM,OAAO,EAEtB,WAAW,4BAA4B,CACvC,SAAS,wBAAwB,aAAa,OAAO,CACrD,OAAO;GACP;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,CAAC,CACD,MAAM,UAAU,KAAK,KAAK,CAC1B,QAAQ,gBAAgB,MAAM,CAC9B,SAAS;EAEX,MAAM,QAAQ,KAAK;AACnB,MAAI,CAAC,MAAO,QAAO;EACnB,MAAM,UAAoB,EAAE;AAC5B,OAAK,MAAM,OAAO,MAAM;AACvB,OAAI,IAAI,SAAS,KAAM;GAMvB,MAAM,YAAY;IACjB,IAAI,IAAI;IACR,MAAM,IAAI;IACV,OAAO,IAAI;IACX,SAAS,IAAI;IACb,WAAW,IAAI;IACf,cAAc,IAAI;IAClB,iBAAiB,IAAI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IAAI,gBACP,KAAI;AACH,UAAO,iBAAiB,KAAK,MAAM,IAAI,gBAAgB;UAChD;;AAMV,QAAO"}
1
+ {"version":3,"file":"widgets-hWcIicX8.mjs","names":["getComponentRegistry"],"sources":["../src/widgets/index.ts"],"sourcesContent":["import { getDb } from \"../loader.js\";\nimport { requestCached } from \"../request-cache.js\";\nimport { getWidgetComponents as getComponentRegistry } from \"./components.js\";\nimport type { Widget, WidgetArea, WidgetRow, WidgetComponentDef } from \"./types.js\";\n\nexport type {\n\tWidget,\n\tWidgetArea,\n\tWidgetType,\n\tWidgetComponentDef,\n\tPropDef,\n\tCreateWidgetAreaInput,\n\tCreateWidgetInput,\n\tUpdateWidgetInput,\n\tReorderWidgetsInput,\n} from \"./types.js\";\n\n/**\n * Get a widget area by name, with all its widgets.\n *\n * Single query with a left join rather than area-then-widgets so the\n * common case costs one round-trip. An area with no widgets yields one\n * row with null widget columns, which we skip when mapping.\n */\nexport async function getWidgetArea(name: string): Promise<WidgetArea | null> {\n\treturn requestCached(`widget-area:${name}`, async () => {\n\t\tconst db = await getDb();\n\t\tconst rows = await db\n\t\t\t.selectFrom(\"_emdash_widget_areas as a\")\n\t\t\t.leftJoin(\"_emdash_widgets as w\", \"w.area_id\", \"a.id\")\n\t\t\t.select([\n\t\t\t\t\"a.id as a_id\",\n\t\t\t\t\"a.name as a_name\",\n\t\t\t\t\"a.label as a_label\",\n\t\t\t\t\"a.description as a_description\",\n\t\t\t\t\"w.id as w_id\",\n\t\t\t\t\"w.type as w_type\",\n\t\t\t\t\"w.title as w_title\",\n\t\t\t\t\"w.content as w_content\",\n\t\t\t\t\"w.menu_name as w_menu_name\",\n\t\t\t\t\"w.component_id as w_component_id\",\n\t\t\t\t\"w.component_props as w_component_props\",\n\t\t\t\t\"w.area_id as w_area_id\",\n\t\t\t\t\"w.sort_order as w_sort_order\",\n\t\t\t\t\"w.created_at as w_created_at\",\n\t\t\t])\n\t\t\t.where(\"a.name\", \"=\", name)\n\t\t\t.orderBy(\"w.sort_order\", \"asc\")\n\t\t\t.execute();\n\n\t\tconst first = rows[0];\n\t\tif (!first) return null;\n\t\tconst widgets: Widget[] = [];\n\t\tfor (const row of rows) {\n\t\t\tif (row.w_id === null) continue; // area has no widgets (left-join null row)\n\t\t\t// Left-join makes every w_* column nullable in the type; at runtime\n\t\t\t// they're all non-null once w_id is (we match on widgets.area_id, so\n\t\t\t// a widget row always has the not-null columns filled). Cast is the\n\t\t\t// price of that structural fact.\n\t\t\t// eslint-disable-next-line typescript/no-unsafe-type-assertion -- left-join row is non-null when w_id is set; see above\n\t\t\tconst widgetRow = {\n\t\t\t\tid: row.w_id,\n\t\t\t\ttype: row.w_type,\n\t\t\t\ttitle: row.w_title,\n\t\t\t\tcontent: row.w_content,\n\t\t\t\tmenu_name: row.w_menu_name,\n\t\t\t\tcomponent_id: row.w_component_id,\n\t\t\t\tcomponent_props: row.w_component_props,\n\t\t\t\tarea_id: row.w_area_id,\n\t\t\t\tsort_order: row.w_sort_order,\n\t\t\t\tcreated_at: row.w_created_at,\n\t\t\t} as WidgetRow;\n\t\t\twidgets.push(rowToWidget(widgetRow));\n\t\t}\n\n\t\treturn {\n\t\t\tid: first.a_id,\n\t\t\tname: first.a_name,\n\t\t\tlabel: first.a_label,\n\t\t\tdescription: first.a_description ?? undefined,\n\t\t\twidgets,\n\t\t};\n\t});\n}\n\n/**\n * Get all widget areas with their widgets\n */\nexport async function getWidgetAreas(): Promise<WidgetArea[]> {\n\tconst db = await getDb();\n\t// Get all areas\n\tconst areaRows = await db.selectFrom(\"_emdash_widget_areas\").selectAll().execute();\n\n\t// Get all widgets\n\tconst widgetRows = await db\n\t\t.selectFrom(\"_emdash_widgets\")\n\t\t.selectAll()\n\t\t.$castTo<WidgetRow>()\n\t\t.orderBy(\"sort_order\", \"asc\")\n\t\t.execute();\n\n\t// Group widgets by area\n\tconst widgetsByArea = new Map<string, Widget[]>();\n\tfor (const row of widgetRows) {\n\t\tif (!widgetsByArea.has(row.area_id)) {\n\t\t\twidgetsByArea.set(row.area_id, []);\n\t\t}\n\t\twidgetsByArea.get(row.area_id)!.push(rowToWidget(row));\n\t}\n\n\t// Combine\n\treturn areaRows.map((areaRow) => ({\n\t\tid: areaRow.id,\n\t\tname: areaRow.name,\n\t\tlabel: areaRow.label,\n\t\tdescription: areaRow.description ?? undefined,\n\t\twidgets: widgetsByArea.get(areaRow.id) || [],\n\t}));\n}\n\n/**\n * Get available widget components (for admin UI)\n */\nexport function getWidgetComponents(): WidgetComponentDef[] {\n\treturn getComponentRegistry();\n}\n\n/**\n * Convert a widget row to the API type\n */\nexport function rowToWidget(row: WidgetRow): Widget {\n\tconst widget: Widget = {\n\t\tid: row.id,\n\t\ttype: row.type,\n\t\ttitle: row.title ?? undefined,\n\t};\n\n\t// Type-specific fields\n\tif (row.type === \"content\" && row.content) {\n\t\ttry {\n\t\t\twidget.content = JSON.parse(row.content);\n\t\t} catch {\n\t\t\t// Invalid JSON, ignore\n\t\t}\n\t}\n\n\tif (row.type === \"menu\" && row.menu_name) {\n\t\twidget.menuName = row.menu_name;\n\t}\n\n\tif (row.type === \"component\" && row.component_id) {\n\t\twidget.componentId = row.component_id;\n\t\tif (row.component_props) {\n\t\t\ttry {\n\t\t\t\twidget.componentProps = JSON.parse(row.component_props);\n\t\t\t} catch {\n\t\t\t\t// Invalid JSON, ignore\n\t\t\t}\n\t\t}\n\t}\n\n\treturn widget;\n}\n"],"mappings":";;;;;;;;;;;;AAwBA,eAAsB,cAAc,MAA0C;AAC7E,QAAO,cAAc,eAAe,QAAQ,YAAY;EAEvD,MAAM,OAAO,OADF,MAAM,OAAO,EAEtB,WAAW,4BAA4B,CACvC,SAAS,wBAAwB,aAAa,OAAO,CACrD,OAAO;GACP;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,CAAC,CACD,MAAM,UAAU,KAAK,KAAK,CAC1B,QAAQ,gBAAgB,MAAM,CAC9B,SAAS;EAEX,MAAM,QAA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;EACV,OAAO,IAAI,SAAS;EACpB;AAGD,KAAI,IAAI,SAAS,aAAa,IAAI,QACjC,KAAI;AACH,SAAO,UAAU,KAAK,MAAM,IAAI,QAAQ;SACjC;AAKT,KAAI,IAAI,SAAS,UAAU,IAAI,UAC9B,QAAO,WAAW,IAAI;AAGvB,KAAI,IAAI,SAAS,eAAe,IAAI,cAAc;AACjD,SAAO,cAAc,IAAI;AACzB,MAAI,IAAI,gBACP,KAAI;AACH,UAAO,iBAAiB,KAAK,MAAM,IAAI,gBAAgB;UAChD;;AAMV,QAAO"}
@@ -0,0 +1,34 @@
1
+ import { Kysely } from "kysely";
2
+
3
+ //#region src/import/wxr-taxonomies.d.ts
4
+ /**
5
+ * Result of pre-importing taxonomy terms from a WXR file.
6
+ */
7
+ interface TaxonomyImportPlan {
8
+ /** terms created during this run (per taxonomy name) */
9
+ termsCreated: Record<string, number>;
10
+ /** terms that already existed and were reused (per taxonomy name) */
11
+ termsReused: Record<string, number>;
12
+ /** custom taxonomies (`wp:term`) skipped because no matching EmDash def exists */
13
+ missingTaxonomies: string[];
14
+ /**
15
+ * Lookup table: `taxonomy name` -> `term slug` -> term id.
16
+ * Used by `attachPostTaxonomies` to translate WXR assignments into pivot rows.
17
+ */
18
+ termIdByNameAndSlug: Map<string, Map<string, string>>;
19
+ /**
20
+ * Lookup table: `taxonomy name` -> set of collection slugs the def allows.
21
+ * Empty (or missing) means "any collection" — we only enforce the filter
22
+ * when the def explicitly lists collections.
23
+ */
24
+ collectionsByTaxonomy: Map<string, Set<string>>;
25
+ /**
26
+ * Lookup table: `term id` -> the term's `translation_group` (or `null`
27
+ * if the term doesn't exist any more). Populated lazily by helpers that
28
+ * need to check pivot existence without repeating per-term DB reads.
29
+ */
30
+ translationGroupByTermId: Map<string, string | null>;
31
+ }
32
+ //#endregion
33
+ export { TaxonomyImportPlan as t };
34
+ //# sourceMappingURL=wxr-taxonomies-0_uxSrmf.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wxr-taxonomies-0_uxSrmf.d.mts","names":[],"sources":["../src/import/wxr-taxonomies.ts"],"mappings":";;;;;;UA8DiB,kBAAA;;EAEhB,YAAA,EAAc,MAAA;;EAEd,WAAA,EAAa,MAAA;;EAEb,iBAAA;;;;;EAKA,mBAAA,EAAqB,GAAA,SAAY,GAAA;;;;;;EAMjC,qBAAA,EAAuB,GAAA,SAAY,GAAA;;;;;;EAMnC,wBAAA,EAA0B,GAAA;AAAA"}
@@ -0,0 +1,425 @@
1
+ import { t as TaxonomyRepository } from "./taxonomy-BxGxZZdu.mjs";
2
+ import { i as resolveLocaleChain } from "./resolve-DR3wqMTy.mjs";
3
+ import { u as invalidateTermCache } from "./taxonomies-Cnb4F-Pb.mjs";
4
+
5
+ //#region src/import/wxr-taxonomies.ts
6
+ /**
7
+ * Thrown by `mirrorTermsToLocales` when a pre-existing locale row at the
8
+ * same `(taxonomy, slug)` belongs to a different `translation_group` than
9
+ * the canonical term. Callers in the route layer surface
10
+ * `publicMessage` to the operator (no internal data) while logging
11
+ * `cause` server-side.
12
+ *
13
+ * Marker class so the route layer can distinguish "operator-actionable
14
+ * taxonomy conflict" from any other DB / repository error that might
15
+ * escape the helper.
16
+ */
17
+ var WxrTaxonomyConflictError = class extends Error {
18
+ publicMessage;
19
+ constructor(publicMessage, options) {
20
+ super(publicMessage, options);
21
+ this.name = "WxrTaxonomyConflictError";
22
+ this.publicMessage = publicMessage;
23
+ }
24
+ };
25
+ function isWxrTaxonomyConflictError(error) {
26
+ return error instanceof WxrTaxonomyConflictError;
27
+ }
28
+ function makeState() {
29
+ return { plan: {
30
+ termsCreated: {},
31
+ termsReused: {},
32
+ missingTaxonomies: [],
33
+ termIdByNameAndSlug: /* @__PURE__ */ new Map(),
34
+ collectionsByTaxonomy: /* @__PURE__ */ new Map(),
35
+ translationGroupByTermId: /* @__PURE__ */ new Map()
36
+ } };
37
+ }
38
+ /**
39
+ * Record-keeping helpers — keep mutations centralised so the result object
40
+ * stays consistent.
41
+ */
42
+ function bump(record, key) {
43
+ record[key] = (record[key] ?? 0) + 1;
44
+ }
45
+ function rememberTerm(state, taxonomyName, slug, termId) {
46
+ let bySlug = state.plan.termIdByNameAndSlug.get(taxonomyName);
47
+ if (!bySlug) {
48
+ bySlug = /* @__PURE__ */ new Map();
49
+ state.plan.termIdByNameAndSlug.set(taxonomyName, bySlug);
50
+ }
51
+ bySlug.set(slug, termId);
52
+ }
53
+ /**
54
+ * Look up an EmDash taxonomy def by name. Definitions are per-locale but
55
+ * a def is conceptually site-wide -- the per-locale row carries only the
56
+ * label translations.
57
+ *
58
+ * Match the runtime helper `getTaxonomyDef` (in `src/taxonomies/index.ts`):
59
+ * walk `resolveLocaleChain(locale)` so the importer picks the same def the
60
+ * runtime would later resolve to. When the chain is empty (i18n disabled)
61
+ * or every locale in the chain misses, fall through to the lowest-locale
62
+ * row so single-locale installs still see seeded defs that were inserted
63
+ * at some non-empty locale value.
64
+ *
65
+ * Without this fallback, a user importing into a non-default locale would
66
+ * see every category dropped as `missingTaxonomies` even though the seeded
67
+ * defs exist (just at the site's default locale).
68
+ */
69
+ function parseDefCollections(raw) {
70
+ if (!raw) return [];
71
+ try {
72
+ const parsed = JSON.parse(raw);
73
+ if (Array.isArray(parsed)) return parsed.filter((c) => typeof c === "string");
74
+ } catch {}
75
+ return [];
76
+ }
77
+ async function findTaxonomyDef(db, name, locale) {
78
+ const chain = resolveLocaleChain(locale);
79
+ if (chain.length === 0) {
80
+ const row = await db.selectFrom("_emdash_taxonomy_defs").selectAll().where("name", "=", name).orderBy("locale", "asc").executeTakeFirst();
81
+ return row ? {
82
+ id: row.id,
83
+ collections: parseDefCollections(row.collections)
84
+ } : null;
85
+ }
86
+ for (const tryLocale of chain) {
87
+ const row = await db.selectFrom("_emdash_taxonomy_defs").selectAll().where("name", "=", name).where("locale", "=", tryLocale).executeTakeFirst();
88
+ if (row) return {
89
+ id: row.id,
90
+ collections: parseDefCollections(row.collections)
91
+ };
92
+ }
93
+ return null;
94
+ }
95
+ /**
96
+ * Rebuild the taxonomy lookup maps from the database without creating
97
+ * anything. The chunked WP import runs term creation once (first content
98
+ * chunk); every later chunk only needs the maps to attach per-post
99
+ * assignments, and two SELECTs are far cheaper than re-walking every term
100
+ * through the ensure path.
101
+ *
102
+ * ponytail: first row wins per (name, slug), ordered by locale asc — the
103
+ * same row `findBySlug` without a locale resolves to. Per-locale term
104
+ * variants beyond that are the mirror pass's job, not the importer's.
105
+ */
106
+ async function loadTaxonomyPlanFromDb(db) {
107
+ const state = makeState();
108
+ const defs = await db.selectFrom("_emdash_taxonomy_defs").select(["name", "collections"]).orderBy("locale", "asc").execute();
109
+ for (const def of defs) if (!state.plan.collectionsByTaxonomy.has(def.name)) state.plan.collectionsByTaxonomy.set(def.name, new Set(parseDefCollections(def.collections)));
110
+ const terms = await db.selectFrom("taxonomies").select([
111
+ "name",
112
+ "slug",
113
+ "id"
114
+ ]).orderBy("locale", "asc").execute();
115
+ for (const term of terms) if (!state.plan.termIdByNameAndSlug.get(term.name)?.has(term.slug)) rememberTerm(state, term.name, term.slug, term.id);
116
+ return state.plan;
117
+ }
118
+ /**
119
+ * Find or create a term in the given taxonomy. Returns the term id. Callers
120
+ * must verify the taxonomy def exists before calling — this helper assumes
121
+ * the def is present.
122
+ *
123
+ * Note: we don't resolve WordPress parent slugs into EmDash parent ids in
124
+ * this pass. WXR exports list categories in arbitrary order, so a category's
125
+ * parent may not exist yet when we first see it. Hierarchy is preserved at
126
+ * the data level (the parent slug is on `WxrCategory.parent`) but flattens
127
+ * in EmDash for now; restoring the tree is a follow-up improvement.
128
+ */
129
+ async function ensureTerm(repo, state, taxonomyName, slug, label, description, locale) {
130
+ const cached = state.plan.termIdByNameAndSlug.get(taxonomyName)?.get(slug);
131
+ if (cached) return cached;
132
+ const existing = await repo.findBySlug(taxonomyName, slug, locale);
133
+ if (existing) {
134
+ bump(state.plan.termsReused, taxonomyName);
135
+ rememberTerm(state, taxonomyName, slug, existing.id);
136
+ return existing.id;
137
+ }
138
+ const translationOf = (await repo.findBySlug(taxonomyName, slug))?.id;
139
+ const created = await repo.create({
140
+ name: taxonomyName,
141
+ slug,
142
+ label,
143
+ data: description ? { description } : void 0,
144
+ locale,
145
+ translationOf
146
+ });
147
+ bump(state.plan.termsCreated, taxonomyName);
148
+ rememberTerm(state, taxonomyName, slug, created.id);
149
+ return created.id;
150
+ }
151
+ /**
152
+ * Retrieve the human label captured by the parser for a per-item
153
+ * `<category>` text body, falling back to the slug when the parser didn't
154
+ * see a label (e.g. self-closing tags or whitespace-only bodies).
155
+ */
156
+ function labelFor(post, taxonomy, slug) {
157
+ const key = `${taxonomy}\u0000${slug}`;
158
+ return post.taxonomyLabels?.get(key) ?? slug;
159
+ }
160
+ /**
161
+ * Pre-import every term referenced by the WXR file.
162
+ *
163
+ * Pass 1: `wp:category` blocks. Each becomes a term in EmDash's seeded
164
+ * `category` taxonomy.
165
+ * Pass 2: `wp:tag` blocks. Each becomes a term in `tag`.
166
+ * Pass 3: `wp:term` blocks (custom taxonomies). Skipped when no matching
167
+ * EmDash def exists.
168
+ * Pass 4: per-item `<category domain="…" nicename="…">` assignments. WXR
169
+ * exports sometimes reference taxonomies/terms that weren't declared
170
+ * at the top level (older exports especially), so we backfill terms
171
+ * from per-item assignments. Categories and tags use the seeded defs
172
+ * and pick up the assignment text as the label; custom domains fall
173
+ * back to the same "def must exist" rule.
174
+ */
175
+ async function preImportWxrTaxonomies(db, posts, categories, tags, terms, locale) {
176
+ const state = makeState();
177
+ const repo = new TaxonomyRepository(db);
178
+ const defCache = /* @__PURE__ */ new Map();
179
+ const lookupDef = async (name) => {
180
+ if (defCache.has(name)) return defCache.get(name) ?? null;
181
+ const def = await findTaxonomyDef(db, name, locale);
182
+ defCache.set(name, def);
183
+ if (def) state.plan.collectionsByTaxonomy.set(name, new Set(def.collections));
184
+ return def;
185
+ };
186
+ const categoryDef = await lookupDef("category");
187
+ if (categoryDef) for (const cat of categories) {
188
+ const slug = cat.nicename;
189
+ const label = cat.name;
190
+ if (!slug || !label) continue;
191
+ await ensureTerm(repo, state, "category", slug, label, cat.description, locale);
192
+ }
193
+ else if (categories.length > 0) state.plan.missingTaxonomies.push("category");
194
+ const tagDef = await lookupDef("tag");
195
+ if (tagDef) for (const tag of tags) {
196
+ const slug = tag.slug;
197
+ const label = tag.name;
198
+ if (!slug || !label) continue;
199
+ await ensureTerm(repo, state, "tag", slug, label, tag.description, locale);
200
+ }
201
+ else if (tags.length > 0) state.plan.missingTaxonomies.push("tag");
202
+ for (const term of terms) {
203
+ if (term.taxonomy === "nav_menu" || term.taxonomy === "language") continue;
204
+ const taxonomyName = term.taxonomy === "post_tag" ? "tag" : term.taxonomy;
205
+ if (!await lookupDef(taxonomyName)) {
206
+ if (!state.plan.missingTaxonomies.includes(taxonomyName)) state.plan.missingTaxonomies.push(taxonomyName);
207
+ continue;
208
+ }
209
+ await ensureTerm(repo, state, taxonomyName, term.slug, term.name, term.description, locale);
210
+ }
211
+ let recordedMissingCategoryFromPosts = false;
212
+ let recordedMissingTagFromPosts = false;
213
+ for (const post of posts) {
214
+ for (const slug of post.categories) {
215
+ if (!categoryDef) {
216
+ if (!recordedMissingCategoryFromPosts && !state.plan.missingTaxonomies.includes("category")) {
217
+ state.plan.missingTaxonomies.push("category");
218
+ recordedMissingCategoryFromPosts = true;
219
+ }
220
+ break;
221
+ }
222
+ if (state.plan.termIdByNameAndSlug.get("category")?.has(slug)) continue;
223
+ await ensureTerm(repo, state, "category", slug, labelFor(post, "category", slug), void 0, locale);
224
+ }
225
+ for (const slug of post.tags) {
226
+ if (!tagDef) {
227
+ if (!recordedMissingTagFromPosts && !state.plan.missingTaxonomies.includes("tag")) {
228
+ state.plan.missingTaxonomies.push("tag");
229
+ recordedMissingTagFromPosts = true;
230
+ }
231
+ break;
232
+ }
233
+ if (state.plan.termIdByNameAndSlug.get("tag")?.has(slug)) continue;
234
+ await ensureTerm(repo, state, "tag", slug, labelFor(post, "tag", slug), void 0, locale);
235
+ }
236
+ if (post.customTaxonomies) for (const [rawName, slugs] of post.customTaxonomies) {
237
+ if (rawName === "nav_menu" || rawName === "language") continue;
238
+ const taxonomyName = rawName === "post_tag" ? "tag" : rawName;
239
+ if (!await lookupDef(taxonomyName)) {
240
+ if (!state.plan.missingTaxonomies.includes(taxonomyName)) state.plan.missingTaxonomies.push(taxonomyName);
241
+ continue;
242
+ }
243
+ for (const slug of slugs) {
244
+ if (state.plan.termIdByNameAndSlug.get(taxonomyName)?.has(slug)) continue;
245
+ await ensureTerm(repo, state, taxonomyName, slug, labelFor(post, taxonomyName, slug), void 0, locale);
246
+ }
247
+ }
248
+ }
249
+ invalidateTermCache();
250
+ return state.plan;
251
+ }
252
+ /**
253
+ * Walk a parsed WXR post's per-item taxonomy assignments and return only
254
+ * the ones that resolve to a real EmDash term AND aren't filtered out by
255
+ * the taxonomy def's `collections` allowlist. Grouped by EmDash taxonomy
256
+ * name (so `post_tag` is already folded into `tag`). Deduplicated.
257
+ *
258
+ * This is the single source of truth for "what will the importer try to
259
+ * write for this post". Both the anchor (additive `attachToEntry`) and
260
+ * translation (per-taxonomy `setTermsForEntry`) paths drive from this map
261
+ * so they agree on which taxonomies need touching. In particular, the
262
+ * translation path uses the keys here -- not `postAssignedTaxonomies` --
263
+ * to decide which inherited pivot rows to clear, so a translation whose
264
+ * only assignment is filtered out by `collections` doesn't lose its
265
+ * inherited terms (see #1087 review feedback).
266
+ *
267
+ * Skipped taxonomies: `nav_menu` (handled by the menu importer) and
268
+ * `language` (Polylang's locale signal, already promoted to `post.locale`
269
+ * by the parser).
270
+ */
271
+ function resolvePostTermAssignments(collection, post, plan) {
272
+ const result = /* @__PURE__ */ new Map();
273
+ const seen = /* @__PURE__ */ new Set();
274
+ const tryResolve = (taxonomyName, slug) => {
275
+ const termId = plan.termIdByNameAndSlug.get(taxonomyName)?.get(slug);
276
+ if (!termId) return;
277
+ const collectionFilter = plan.collectionsByTaxonomy.get(taxonomyName);
278
+ if (collectionFilter && collectionFilter.size > 0 && !collectionFilter.has(collection)) return;
279
+ const dedupeKey = `${taxonomyName}\u0000${termId}`;
280
+ if (seen.has(dedupeKey)) return;
281
+ seen.add(dedupeKey);
282
+ const existing = result.get(taxonomyName);
283
+ if (existing) existing.push(termId);
284
+ else result.set(taxonomyName, [termId]);
285
+ };
286
+ for (const slug of post.categories) tryResolve("category", slug);
287
+ for (const slug of post.tags) tryResolve("tag", slug);
288
+ if (post.customTaxonomies) for (const [rawName, slugs] of post.customTaxonomies) {
289
+ if (rawName === "nav_menu" || rawName === "language") continue;
290
+ const taxonomyName = rawName === "post_tag" ? "tag" : rawName;
291
+ for (const slug of slugs) tryResolve(taxonomyName, slug);
292
+ }
293
+ return result;
294
+ }
295
+ /**
296
+ * Attach the taxonomy assignments parsed for a single WXR post to a freshly-
297
+ * created EmDash content row. Additive (`attachToEntry` + `ON CONFLICT DO
298
+ * NOTHING`). Used for anchors -- translations need replace-semantics per
299
+ * taxonomy and should use `setPostTermAssignmentsReplacing` instead.
300
+ *
301
+ * Returns the number of pivot rows actually inserted (excludes rows that
302
+ * already existed via the `ON CONFLICT DO NOTHING` path), so the caller can
303
+ * roll them up into the import summary without over-counting on re-imports.
304
+ */
305
+ async function attachPostTaxonomies(db, collection, entryId, post, plan) {
306
+ const repo = new TaxonomyRepository(db);
307
+ const resolved = resolvePostTermAssignments(collection, post, plan);
308
+ let attached = 0;
309
+ for (const [, termIds] of resolved) for (const termId of termIds) if (await attachToEntryCountingInserts(db, repo, plan, collection, entryId, termId)) attached++;
310
+ return attached;
311
+ }
312
+ /**
313
+ * Replace assignments per-taxonomy from a parsed WXR post. Used for
314
+ * translations: WPML's "Translate Independently" mode lets translators
315
+ * override term assignments per-taxonomy, not per-post. A translation that
316
+ * overrides `category` shouldn't lose its inherited `tag` or `genre`. We
317
+ * only call `setTermsForEntry(name, ids)` for taxonomies where the
318
+ * translation actually resolved at least one term -- taxonomies with no
319
+ * resolvable+permitted terms are left alone so inherited rows from
320
+ * `copyEntryTerms` stay intact.
321
+ *
322
+ * Returns the number of pivot rows after replacement (sum of `termIds`
323
+ * lists across taxonomies actually touched). Note this counts logical
324
+ * assignments, not the delta from the prior state; the import summary
325
+ * treats this as an additive count for compatibility with `attachPost-
326
+ * Taxonomies`.
327
+ */
328
+ async function setPostTermAssignmentsReplacing(db, collection, entryId, post, plan) {
329
+ const repo = new TaxonomyRepository(db);
330
+ const resolved = resolvePostTermAssignments(collection, post, plan);
331
+ let attached = 0;
332
+ for (const [taxonomyName, termIds] of resolved) {
333
+ await repo.setTermsForEntry(collection, entryId, taxonomyName, termIds);
334
+ attached += termIds.length;
335
+ }
336
+ return attached;
337
+ }
338
+ /**
339
+ * Resolve a term id to its `translation_group` (the value
340
+ * `content_taxonomies` stores). Caches the result on the plan so
341
+ * repeated attaches of the same term don't repeat the lookup.
342
+ */
343
+ async function termTranslationGroup(repo, plan, termId) {
344
+ const cached = plan.translationGroupByTermId.get(termId);
345
+ if (cached !== void 0) return cached;
346
+ const group = (await repo.findById(termId))?.translationGroup ?? null;
347
+ plan.translationGroupByTermId.set(termId, group);
348
+ return group;
349
+ }
350
+ /**
351
+ * Wrapper around `TaxonomyRepository.attachToEntry` that returns whether
352
+ * an actual row was inserted (vs. silently skipped by the `ON CONFLICT DO
353
+ * NOTHING` branch). Lets the importer's `assignments` counter reflect real
354
+ * writes rather than re-import no-ops.
355
+ *
356
+ * Best-effort: we check pivot existence first, then call `attachToEntry`.
357
+ * A concurrent insert between the check and the attach would make us
358
+ * report `false` while a row was in fact inserted -- the count is for
359
+ * summary display only, never correctness.
360
+ */
361
+ async function attachToEntryCountingInserts(db, repo, plan, collection, entryId, termId) {
362
+ const group = await termTranslationGroup(repo, plan, termId);
363
+ if (!group) return false;
364
+ if (await db.selectFrom("content_taxonomies").select("collection").where("collection", "=", collection).where("entry_id", "=", entryId).where("taxonomy_id", "=", group).executeTakeFirst()) return false;
365
+ await repo.attachToEntry(collection, entryId, termId);
366
+ return true;
367
+ }
368
+ /**
369
+ * Mirror every term in the plan into each additional locale used by the
370
+ * incoming posts. New rows share the canonical term's `translation_group`
371
+ * so per-locale lookups (`getTermsForEntry(..., locale)`) resolve correctly
372
+ * for translations whose locale differs from the import-wide one.
373
+ *
374
+ * Without this pass, multilingual WXR imports (#1080) write all term rows
375
+ * at the upload-wide locale; the `content_taxonomies` pivot is correct (it
376
+ * stores `translation_group`, not `term id`), but
377
+ * `getTermsForEntry(collection, arabicPostId, "category", "ar")` filters on
378
+ * `taxonomies.locale = "ar"` and returns zero rows. Users see "no tags" on
379
+ * every non-canonical translation.
380
+ *
381
+ * Idempotent: skips a locale when a row already exists at `(name, slug,
382
+ * locale)`. Safe to call after `preImportWxrTaxonomies` on subsequent
383
+ * imports.
384
+ */
385
+ async function mirrorTermsToLocales(db, plan, postLocales, canonicalLocale) {
386
+ const localeSet = /* @__PURE__ */ new Set();
387
+ for (const locale of postLocales) {
388
+ if (!locale || locale === canonicalLocale) continue;
389
+ localeSet.add(locale);
390
+ }
391
+ if (localeSet.size === 0) return;
392
+ const repo = new TaxonomyRepository(db);
393
+ for (const [taxonomyName, bySlug] of plan.termIdByNameAndSlug) for (const [slug, canonicalTermId] of bySlug) {
394
+ const cachedGroup = await termTranslationGroup(repo, plan, canonicalTermId);
395
+ if (!cachedGroup) continue;
396
+ const canonicalGroup = cachedGroup;
397
+ for (const locale of localeSet) {
398
+ const existing = await repo.findBySlug(taxonomyName, slug, locale);
399
+ if (existing) {
400
+ if (existing.translationGroup !== canonicalGroup) throw new WxrTaxonomyConflictError(`Cannot import: term "${taxonomyName}/${slug}" already exists at locale "${locale}" in a different translation group than the canonical row at this import's locale. Reconcile the rows in the admin (re-link via translationOf, or delete one) and retry.`);
401
+ continue;
402
+ }
403
+ try {
404
+ await repo.create({
405
+ name: taxonomyName,
406
+ slug,
407
+ label: slug,
408
+ locale,
409
+ translationOf: canonicalTermId
410
+ });
411
+ } catch (error) {
412
+ const message = error instanceof Error ? error.message.toLowerCase() : "";
413
+ if (!(message.includes("unique constraint failed") || message.includes("duplicate key"))) throw error;
414
+ const winner = await repo.findBySlug(taxonomyName, slug, locale);
415
+ if (!winner) throw new WxrTaxonomyConflictError(`Cannot import: term "${taxonomyName}/${slug}" raced UNIQUE at locale "${locale}" but no row is visible afterwards. The concurrent transaction may have rolled back; retry the import.`, { cause: error });
416
+ if (winner.translationGroup !== canonicalGroup) throw new WxrTaxonomyConflictError(`Cannot import: term "${taxonomyName}/${slug}" raced UNIQUE at locale "${locale}" with a different translation group. Reconcile the rows in the admin and retry.`, { cause: error });
417
+ console.warn(`[WXR import] concurrent writer beat us to term "${taxonomyName}/${slug}" at locale "${locale}"; using existing row (same group).`);
418
+ }
419
+ }
420
+ }
421
+ }
422
+
423
+ //#endregion
424
+ export { preImportWxrTaxonomies as a, mirrorTermsToLocales as i, isWxrTaxonomyConflictError as n, setPostTermAssignmentsReplacing as o, loadTaxonomyPlanFromDb as r, attachPostTaxonomies as t };
425
+ //# sourceMappingURL=wxr-taxonomies-BC3OYpvx.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wxr-taxonomies-BC3OYpvx.mjs","names":[],"sources":["../src/import/wxr-taxonomies.ts"],"sourcesContent":["/**\n * WXR taxonomy import helpers.\n *\n * Bridges parsed WordPress taxonomy data (`WxrCategory`, `WxrTag`, `WxrTerm`,\n * and per-item `WxrPost.categories` / `WxrPost.tags` / `WxrPost.customTaxonomies`)\n * onto EmDash's term + content_taxonomies tables.\n *\n * Why this isn't inline in `execute.ts`: pre-creating all terms before any\n * post is created lets us (a) build a lookup once for every (taxonomy, slug)\n * the import needs, and (b) keep the per-post attachment loop cheap. It also\n * makes the logic testable without spinning up an Astro request.\n *\n * Behaviour:\n * - `wp:category` -> EmDash `category` taxonomy (seeded by migration 006).\n * - `wp:tag` -> EmDash `tag` taxonomy.\n * - `wp:term` -> matching EmDash taxonomy by `name` (case-sensitive).\n * If no matching def exists in the target locale, the\n * term is skipped — we don't auto-create defs because\n * the user controls their schema through the admin.\n * - Terms are created idempotently by `(taxonomy, slug, locale)`. Existing\n * terms are reused.\n * - Assignments respect the def's `collections` array. If the post's target\n * collection isn't listed on the taxonomy def, the assignment is skipped\n * (matches admin UI behaviour: you can't tag a \"products\" post with a\n * \"category\" if `category.collections` only includes \"posts\").\n */\n\nimport type { Kysely } from \"kysely\";\n\nimport type { WxrCategory, WxrPost, WxrTag, WxrTerm } from \"../cli/wxr/parser.js\";\nimport { TaxonomyRepository } from \"../database/repositories/taxonomy.js\";\nimport type { Database } from \"../database/types.js\";\nimport { resolveLocaleChain } from \"../i18n/resolve.js\";\nimport { invalidateTermCache } from \"../taxonomies/index.js\";\n\n/**\n * Thrown by `mirrorTermsToLocales` when a pre-existing locale row at the\n * same `(taxonomy, slug)` belongs to a different `translation_group` than\n * the canonical term. Callers in the route layer surface\n * `publicMessage` to the operator (no internal data) while logging\n * `cause` server-side.\n *\n * Marker class so the route layer can distinguish \"operator-actionable\n * taxonomy conflict\" from any other DB / repository error that might\n * escape the helper.\n */\nexport class WxrTaxonomyConflictError extends Error {\n\treadonly publicMessage: string;\n\tconstructor(publicMessage: string, options?: { cause?: unknown }) {\n\t\tsuper(publicMessage, options);\n\t\tthis.name = \"WxrTaxonomyConflictError\";\n\t\tthis.publicMessage = publicMessage;\n\t}\n}\n\nexport function isWxrTaxonomyConflictError(error: unknown): error is WxrTaxonomyConflictError {\n\treturn error instanceof WxrTaxonomyConflictError;\n}\n\n/**\n * Result of pre-importing taxonomy terms from a WXR file.\n */\nexport interface TaxonomyImportPlan {\n\t/** terms created during this run (per taxonomy name) */\n\ttermsCreated: Record<string, number>;\n\t/** terms that already existed and were reused (per taxonomy name) */\n\ttermsReused: Record<string, number>;\n\t/** custom taxonomies (`wp:term`) skipped because no matching EmDash def exists */\n\tmissingTaxonomies: string[];\n\t/**\n\t * Lookup table: `taxonomy name` -> `term slug` -> term id.\n\t * Used by `attachPostTaxonomies` to translate WXR assignments into pivot rows.\n\t */\n\ttermIdByNameAndSlug: Map<string, Map<string, string>>;\n\t/**\n\t * Lookup table: `taxonomy name` -> set of collection slugs the def allows.\n\t * Empty (or missing) means \"any collection\" — we only enforce the filter\n\t * when the def explicitly lists collections.\n\t */\n\tcollectionsByTaxonomy: Map<string, Set<string>>;\n\t/**\n\t * Lookup table: `term id` -> the term's `translation_group` (or `null`\n\t * if the term doesn't exist any more). Populated lazily by helpers that\n\t * need to check pivot existence without repeating per-term DB reads.\n\t */\n\ttranslationGroupByTermId: Map<string, string | null>;\n}\n\n/**\n * Track running counts plus the lookup maps.\n */\ninterface TaxonomyImportState {\n\tplan: TaxonomyImportPlan;\n}\n\nfunction makeState(): TaxonomyImportState {\n\treturn {\n\t\tplan: {\n\t\t\ttermsCreated: {},\n\t\t\ttermsReused: {},\n\t\t\tmissingTaxonomies: [],\n\t\t\ttermIdByNameAndSlug: new Map(),\n\t\t\tcollectionsByTaxonomy: new Map(),\n\t\t\ttranslationGroupByTermId: new Map(),\n\t\t},\n\t};\n}\n\n/**\n * Record-keeping helpers — keep mutations centralised so the result object\n * stays consistent.\n */\nfunction bump(record: Record<string, number>, key: string): void {\n\trecord[key] = (record[key] ?? 0) + 1;\n}\n\nfunction rememberTerm(\n\tstate: TaxonomyImportState,\n\ttaxonomyName: string,\n\tslug: string,\n\ttermId: string,\n): void {\n\tlet bySlug = state.plan.termIdByNameAndSlug.get(taxonomyName);\n\tif (!bySlug) {\n\t\tbySlug = new Map();\n\t\tstate.plan.termIdByNameAndSlug.set(taxonomyName, bySlug);\n\t}\n\tbySlug.set(slug, termId);\n}\n\n/**\n * Look up an EmDash taxonomy def by name. Definitions are per-locale but\n * a def is conceptually site-wide -- the per-locale row carries only the\n * label translations.\n *\n * Match the runtime helper `getTaxonomyDef` (in `src/taxonomies/index.ts`):\n * walk `resolveLocaleChain(locale)` so the importer picks the same def the\n * runtime would later resolve to. When the chain is empty (i18n disabled)\n * or every locale in the chain misses, fall through to the lowest-locale\n * row so single-locale installs still see seeded defs that were inserted\n * at some non-empty locale value.\n *\n * Without this fallback, a user importing into a non-default locale would\n * see every category dropped as `missingTaxonomies` even though the seeded\n * defs exist (just at the site's default locale).\n */\nfunction parseDefCollections(raw: string | null): string[] {\n\tif (!raw) return [];\n\ttry {\n\t\tconst parsed: unknown = JSON.parse(raw);\n\t\tif (Array.isArray(parsed)) {\n\t\t\treturn parsed.filter((c): c is string => typeof c === \"string\");\n\t\t}\n\t} catch {\n\t\t// malformed JSON in the def -- treat as \"no collection filter\"\n\t}\n\treturn [];\n}\n\nasync function findTaxonomyDef(\n\tdb: Kysely<Database>,\n\tname: string,\n\tlocale: string | undefined,\n): Promise<{ id: string; collections: string[] } | null> {\n\tconst chain = resolveLocaleChain(locale);\n\n\tif (chain.length === 0) {\n\t\t// i18n disabled and no explicit locale. The runtime treats this\n\t\t// as \"no locale filter\" and picks the lowest-locale row. We do the\n\t\t// same so the importer agrees with how the runtime later reads\n\t\t// the def.\n\t\tconst row = await db\n\t\t\t.selectFrom(\"_emdash_taxonomy_defs\")\n\t\t\t.selectAll()\n\t\t\t.where(\"name\", \"=\", name)\n\t\t\t.orderBy(\"locale\", \"asc\")\n\t\t\t.executeTakeFirst();\n\t\treturn row ? { id: row.id, collections: parseDefCollections(row.collections) } : null;\n\t}\n\n\t// Non-empty chain: walk it in order, return null if every entry misses.\n\t// This matches `getTaxonomyDef` exactly. We deliberately do NOT fall\n\t// through to any-locale lookup: doing so would let the importer pick a\n\t// def at a locale the runtime would never resolve to, producing\n\t// content the user can't see in the admin or on the rendered site.\n\tfor (const tryLocale of chain) {\n\t\tconst row = await db\n\t\t\t.selectFrom(\"_emdash_taxonomy_defs\")\n\t\t\t.selectAll()\n\t\t\t.where(\"name\", \"=\", name)\n\t\t\t.where(\"locale\", \"=\", tryLocale)\n\t\t\t.executeTakeFirst();\n\t\tif (row) {\n\t\t\treturn { id: row.id, collections: parseDefCollections(row.collections) };\n\t\t}\n\t}\n\n\treturn null;\n}\n\n/**\n * Rebuild the taxonomy lookup maps from the database without creating\n * anything. The chunked WP import runs term creation once (first content\n * chunk); every later chunk only needs the maps to attach per-post\n * assignments, and two SELECTs are far cheaper than re-walking every term\n * through the ensure path.\n *\n * ponytail: first row wins per (name, slug), ordered by locale asc — the\n * same row `findBySlug` without a locale resolves to. Per-locale term\n * variants beyond that are the mirror pass's job, not the importer's.\n */\nexport async function loadTaxonomyPlanFromDb(db: Kysely<Database>): Promise<TaxonomyImportPlan> {\n\tconst state = makeState();\n\n\tconst defs = await db\n\t\t.selectFrom(\"_emdash_taxonomy_defs\")\n\t\t.select([\"name\", \"collections\"])\n\t\t.orderBy(\"locale\", \"asc\")\n\t\t.execute();\n\tfor (const def of defs) {\n\t\tif (!state.plan.collectionsByTaxonomy.has(def.name)) {\n\t\t\tstate.plan.collectionsByTaxonomy.set(def.name, new Set(parseDefCollections(def.collections)));\n\t\t}\n\t}\n\n\tconst terms = await db\n\t\t.selectFrom(\"taxonomies\")\n\t\t.select([\"name\", \"slug\", \"id\"])\n\t\t.orderBy(\"locale\", \"asc\")\n\t\t.execute();\n\tfor (const term of terms) {\n\t\tif (!state.plan.termIdByNameAndSlug.get(term.name)?.has(term.slug)) {\n\t\t\trememberTerm(state, term.name, term.slug, term.id);\n\t\t}\n\t}\n\n\treturn state.plan;\n}\n\n/**\n * Find or create a term in the given taxonomy. Returns the term id. Callers\n * must verify the taxonomy def exists before calling — this helper assumes\n * the def is present.\n *\n * Note: we don't resolve WordPress parent slugs into EmDash parent ids in\n * this pass. WXR exports list categories in arbitrary order, so a category's\n * parent may not exist yet when we first see it. Hierarchy is preserved at\n * the data level (the parent slug is on `WxrCategory.parent`) but flattens\n * in EmDash for now; restoring the tree is a follow-up improvement.\n */\nasync function ensureTerm(\n\trepo: TaxonomyRepository,\n\tstate: TaxonomyImportState,\n\ttaxonomyName: string,\n\tslug: string,\n\tlabel: string,\n\tdescription: string | undefined,\n\tlocale: string | undefined,\n): Promise<string> {\n\t// Already resolved in this run (e.g. seen in `wp:category` AND in a per-\n\t// item `<category>` element).\n\tconst cached = state.plan.termIdByNameAndSlug.get(taxonomyName)?.get(slug);\n\tif (cached) return cached;\n\n\tconst existing = await repo.findBySlug(taxonomyName, slug, locale);\n\tif (existing) {\n\t\tbump(state.plan.termsReused, taxonomyName);\n\t\trememberTerm(state, taxonomyName, slug, existing.id);\n\t\treturn existing.id;\n\t}\n\n\t// No row at the requested locale. Before creating, check whether a\n\t// `(name, slug)` row exists in some OTHER locale -- e.g. the admin\n\t// pre-created an Arabic translation, and now an `en` import wants the\n\t// canonical row. We need to mint the new row inside the existing row's\n\t// `translation_group` so per-locale lookups across the family work.\n\t// Without this, the mirror pass would later refuse to reconcile (it\n\t// sees pre-existing rows in a different group as a no-op) and pivots\n\t// would point at a group that has no row in the requested locale.\n\tconst anyLocale = await repo.findBySlug(taxonomyName, slug);\n\tconst translationOf = anyLocale?.id;\n\n\tconst created = await repo.create({\n\t\tname: taxonomyName,\n\t\tslug,\n\t\tlabel,\n\t\tdata: description ? { description } : undefined,\n\t\tlocale,\n\t\ttranslationOf,\n\t});\n\tbump(state.plan.termsCreated, taxonomyName);\n\trememberTerm(state, taxonomyName, slug, created.id);\n\treturn created.id;\n}\n\n/**\n * Retrieve the human label captured by the parser for a per-item\n * `<category>` text body, falling back to the slug when the parser didn't\n * see a label (e.g. self-closing tags or whitespace-only bodies).\n */\nfunction labelFor(post: WxrPost, taxonomy: string, slug: string): string {\n\tconst key = `${taxonomy}\\u0000${slug}`;\n\treturn post.taxonomyLabels?.get(key) ?? slug;\n}\n\n/**\n * Pre-import every term referenced by the WXR file.\n *\n * Pass 1: `wp:category` blocks. Each becomes a term in EmDash's seeded\n * `category` taxonomy.\n * Pass 2: `wp:tag` blocks. Each becomes a term in `tag`.\n * Pass 3: `wp:term` blocks (custom taxonomies). Skipped when no matching\n * EmDash def exists.\n * Pass 4: per-item `<category domain=\"…\" nicename=\"…\">` assignments. WXR\n * exports sometimes reference taxonomies/terms that weren't declared\n * at the top level (older exports especially), so we backfill terms\n * from per-item assignments. Categories and tags use the seeded defs\n * and pick up the assignment text as the label; custom domains fall\n * back to the same \"def must exist\" rule.\n */\nexport async function preImportWxrTaxonomies(\n\tdb: Kysely<Database>,\n\tposts: WxrPost[],\n\tcategories: WxrCategory[],\n\ttags: WxrTag[],\n\tterms: WxrTerm[],\n\tlocale: string | undefined,\n): Promise<TaxonomyImportPlan> {\n\tconst state = makeState();\n\tconst repo = new TaxonomyRepository(db);\n\n\t// Cache def lookups for the duration of the import. Keyed by name; value\n\t// is `null` when we've already determined the def is missing in this\n\t// locale (so we only report the \"missing\" warning once per taxonomy).\n\tconst defCache = new Map<string, { id: string; collections: string[] } | null>();\n\tconst lookupDef = async (name: string): Promise<{ id: string; collections: string[] } | null> => {\n\t\tif (defCache.has(name)) return defCache.get(name) ?? null;\n\t\tconst def = await findTaxonomyDef(db, name, locale);\n\t\tdefCache.set(name, def);\n\t\tif (def) {\n\t\t\tstate.plan.collectionsByTaxonomy.set(name, new Set(def.collections));\n\t\t}\n\t\treturn def;\n\t};\n\n\t// Pass 1: top-level <wp:category> blocks -> EmDash `category` taxonomy.\n\tconst categoryDef = await lookupDef(\"category\");\n\tif (categoryDef) {\n\t\tfor (const cat of categories) {\n\t\t\tconst slug = cat.nicename;\n\t\t\tconst label = cat.name;\n\t\t\tif (!slug || !label) continue;\n\t\t\tawait ensureTerm(repo, state, \"category\", slug, label, cat.description, locale);\n\t\t}\n\t} else if (categories.length > 0) {\n\t\t// Seeded `category` def was deleted by the user — record so the\n\t\t// import response can surface why none of the categories landed.\n\t\tstate.plan.missingTaxonomies.push(\"category\");\n\t}\n\n\t// Pass 2: top-level <wp:tag> blocks -> EmDash `tag` taxonomy.\n\tconst tagDef = await lookupDef(\"tag\");\n\tif (tagDef) {\n\t\tfor (const tag of tags) {\n\t\t\tconst slug = tag.slug;\n\t\t\tconst label = tag.name;\n\t\t\tif (!slug || !label) continue;\n\t\t\tawait ensureTerm(repo, state, \"tag\", slug, label, tag.description, locale);\n\t\t}\n\t} else if (tags.length > 0) {\n\t\tstate.plan.missingTaxonomies.push(\"tag\");\n\t}\n\n\t// Pass 3: <wp:term> blocks for custom taxonomies (genre, etc.). Skipped:\n\t// - `nav_menu`: menus are handled by `importMenusFromWxr`.\n\t// - `language`: Polylang's locale signal; promoted to `WxrPost.locale`\n\t// by the parser and not a content taxonomy in EmDash.\n\tfor (const term of terms) {\n\t\tif (term.taxonomy === \"nav_menu\" || term.taxonomy === \"language\") continue;\n\t\t// Normalize WordPress' `post_tag` synonym -> EmDash `tag`. WordPress\n\t\t// emits `<wp:tag>` for some exports and `<wp:term wp:term_taxonomy=\"post_tag\">`\n\t\t// for others; both must land in the same EmDash taxonomy.\n\t\tconst taxonomyName = term.taxonomy === \"post_tag\" ? \"tag\" : term.taxonomy;\n\t\tconst def = await lookupDef(taxonomyName);\n\t\tif (!def) {\n\t\t\tif (!state.plan.missingTaxonomies.includes(taxonomyName)) {\n\t\t\t\tstate.plan.missingTaxonomies.push(taxonomyName);\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tawait ensureTerm(repo, state, taxonomyName, term.slug, term.name, term.description, locale);\n\t}\n\n\t// Pass 4: per-item assignments. Backfills terms missing from the top-\n\t// level blocks (rare, but observed in hand-edited or partial exports).\n\t// Labels come from the per-item `<category>` text body when the parser\n\t// captured one; otherwise we fall back to the slug. This is the path\n\t// for older exports that skip top-level `<wp:category>` definitions.\n\tlet recordedMissingCategoryFromPosts = false;\n\tlet recordedMissingTagFromPosts = false;\n\tfor (const post of posts) {\n\t\tfor (const slug of post.categories) {\n\t\t\tif (!categoryDef) {\n\t\t\t\tif (\n\t\t\t\t\t!recordedMissingCategoryFromPosts &&\n\t\t\t\t\t!state.plan.missingTaxonomies.includes(\"category\")\n\t\t\t\t) {\n\t\t\t\t\tstate.plan.missingTaxonomies.push(\"category\");\n\t\t\t\t\trecordedMissingCategoryFromPosts = true;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (state.plan.termIdByNameAndSlug.get(\"category\")?.has(slug)) continue;\n\t\t\tawait ensureTerm(\n\t\t\t\trepo,\n\t\t\t\tstate,\n\t\t\t\t\"category\",\n\t\t\t\tslug,\n\t\t\t\tlabelFor(post, \"category\", slug),\n\t\t\t\tundefined,\n\t\t\t\tlocale,\n\t\t\t);\n\t\t}\n\t\tfor (const slug of post.tags) {\n\t\t\tif (!tagDef) {\n\t\t\t\tif (!recordedMissingTagFromPosts && !state.plan.missingTaxonomies.includes(\"tag\")) {\n\t\t\t\t\tstate.plan.missingTaxonomies.push(\"tag\");\n\t\t\t\t\trecordedMissingTagFromPosts = true;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (state.plan.termIdByNameAndSlug.get(\"tag\")?.has(slug)) continue;\n\t\t\tawait ensureTerm(repo, state, \"tag\", slug, labelFor(post, \"tag\", slug), undefined, locale);\n\t\t}\n\t\tif (post.customTaxonomies) {\n\t\t\tfor (const [rawName, slugs] of post.customTaxonomies) {\n\t\t\t\t// `nav_menu` is handled by the menu importer; `language` is\n\t\t\t\t// Polylang's per-post locale signal, already promoted by the\n\t\t\t\t// parser.\n\t\t\t\tif (rawName === \"nav_menu\" || rawName === \"language\") continue;\n\t\t\t\tconst taxonomyName = rawName === \"post_tag\" ? \"tag\" : rawName;\n\t\t\t\tconst def = await lookupDef(taxonomyName);\n\t\t\t\tif (!def) {\n\t\t\t\t\tif (!state.plan.missingTaxonomies.includes(taxonomyName)) {\n\t\t\t\t\t\tstate.plan.missingTaxonomies.push(taxonomyName);\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tfor (const slug of slugs) {\n\t\t\t\t\tif (state.plan.termIdByNameAndSlug.get(taxonomyName)?.has(slug)) continue;\n\t\t\t\t\tawait ensureTerm(\n\t\t\t\t\t\trepo,\n\t\t\t\t\t\tstate,\n\t\t\t\t\t\ttaxonomyName,\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\tlabelFor(post, taxonomyName, slug),\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tlocale,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// `content_taxonomies` writes happen later in `attachPostTaxonomies`, but\n\t// term inserts above already invalidate the in-memory \"has any terms\" probe.\n\t// We flush once at the end of the pre-import to keep the runtime cache hot.\n\tinvalidateTermCache();\n\n\treturn state.plan;\n}\n\n/**\n * Walk a parsed WXR post's per-item taxonomy assignments and return only\n * the ones that resolve to a real EmDash term AND aren't filtered out by\n * the taxonomy def's `collections` allowlist. Grouped by EmDash taxonomy\n * name (so `post_tag` is already folded into `tag`). Deduplicated.\n *\n * This is the single source of truth for \"what will the importer try to\n * write for this post\". Both the anchor (additive `attachToEntry`) and\n * translation (per-taxonomy `setTermsForEntry`) paths drive from this map\n * so they agree on which taxonomies need touching. In particular, the\n * translation path uses the keys here -- not `postAssignedTaxonomies` --\n * to decide which inherited pivot rows to clear, so a translation whose\n * only assignment is filtered out by `collections` doesn't lose its\n * inherited terms (see #1087 review feedback).\n *\n * Skipped taxonomies: `nav_menu` (handled by the menu importer) and\n * `language` (Polylang's locale signal, already promoted to `post.locale`\n * by the parser).\n */\nexport function resolvePostTermAssignments(\n\tcollection: string,\n\tpost: WxrPost,\n\tplan: TaxonomyImportPlan,\n): Map<string, string[]> {\n\tconst result = new Map<string, string[]>();\n\tconst seen = new Set<string>();\n\n\tconst tryResolve = (taxonomyName: string, slug: string): void => {\n\t\tconst termId = plan.termIdByNameAndSlug.get(taxonomyName)?.get(slug);\n\t\tif (!termId) return;\n\t\tconst collectionFilter = plan.collectionsByTaxonomy.get(taxonomyName);\n\t\t// Empty set means \"no filter\" (def has no collections array). A\n\t\t// non-empty set is enforced: skip assignments to collections the\n\t\t// def doesn't list. Matches admin UI: a `category` term linked\n\t\t// only to `posts` shouldn't end up on a `products` row just\n\t\t// because the WXR happened to mention it.\n\t\tif (collectionFilter && collectionFilter.size > 0 && !collectionFilter.has(collection)) {\n\t\t\treturn;\n\t\t}\n\t\tconst dedupeKey = `${taxonomyName}\\u0000${termId}`;\n\t\tif (seen.has(dedupeKey)) return;\n\t\tseen.add(dedupeKey);\n\t\tconst existing = result.get(taxonomyName);\n\t\tif (existing) existing.push(termId);\n\t\telse result.set(taxonomyName, [termId]);\n\t};\n\n\tfor (const slug of post.categories) tryResolve(\"category\", slug);\n\tfor (const slug of post.tags) tryResolve(\"tag\", slug);\n\tif (post.customTaxonomies) {\n\t\tfor (const [rawName, slugs] of post.customTaxonomies) {\n\t\t\tif (rawName === \"nav_menu\" || rawName === \"language\") continue;\n\t\t\tconst taxonomyName = rawName === \"post_tag\" ? \"tag\" : rawName;\n\t\t\tfor (const slug of slugs) tryResolve(taxonomyName, slug);\n\t\t}\n\t}\n\n\treturn result;\n}\n\n/**\n * Attach the taxonomy assignments parsed for a single WXR post to a freshly-\n * created EmDash content row. Additive (`attachToEntry` + `ON CONFLICT DO\n * NOTHING`). Used for anchors -- translations need replace-semantics per\n * taxonomy and should use `setPostTermAssignmentsReplacing` instead.\n *\n * Returns the number of pivot rows actually inserted (excludes rows that\n * already existed via the `ON CONFLICT DO NOTHING` path), so the caller can\n * roll them up into the import summary without over-counting on re-imports.\n */\nexport async function attachPostTaxonomies(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\tentryId: string,\n\tpost: WxrPost,\n\tplan: TaxonomyImportPlan,\n): Promise<number> {\n\tconst repo = new TaxonomyRepository(db);\n\tconst resolved = resolvePostTermAssignments(collection, post, plan);\n\n\tlet attached = 0;\n\tfor (const [, termIds] of resolved) {\n\t\tfor (const termId of termIds) {\n\t\t\tconst wrote = await attachToEntryCountingInserts(db, repo, plan, collection, entryId, termId);\n\t\t\tif (wrote) attached++;\n\t\t}\n\t}\n\treturn attached;\n}\n\n/**\n * Replace assignments per-taxonomy from a parsed WXR post. Used for\n * translations: WPML's \"Translate Independently\" mode lets translators\n * override term assignments per-taxonomy, not per-post. A translation that\n * overrides `category` shouldn't lose its inherited `tag` or `genre`. We\n * only call `setTermsForEntry(name, ids)` for taxonomies where the\n * translation actually resolved at least one term -- taxonomies with no\n * resolvable+permitted terms are left alone so inherited rows from\n * `copyEntryTerms` stay intact.\n *\n * Returns the number of pivot rows after replacement (sum of `termIds`\n * lists across taxonomies actually touched). Note this counts logical\n * assignments, not the delta from the prior state; the import summary\n * treats this as an additive count for compatibility with `attachPost-\n * Taxonomies`.\n */\nexport async function setPostTermAssignmentsReplacing(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\tentryId: string,\n\tpost: WxrPost,\n\tplan: TaxonomyImportPlan,\n): Promise<number> {\n\tconst repo = new TaxonomyRepository(db);\n\tconst resolved = resolvePostTermAssignments(collection, post, plan);\n\n\tlet attached = 0;\n\tfor (const [taxonomyName, termIds] of resolved) {\n\t\tawait repo.setTermsForEntry(collection, entryId, taxonomyName, termIds);\n\t\tattached += termIds.length;\n\t}\n\treturn attached;\n}\n\n/**\n * Resolve a term id to its `translation_group` (the value\n * `content_taxonomies` stores). Caches the result on the plan so\n * repeated attaches of the same term don't repeat the lookup.\n */\nasync function termTranslationGroup(\n\trepo: TaxonomyRepository,\n\tplan: TaxonomyImportPlan,\n\ttermId: string,\n): Promise<string | null> {\n\tconst cached = plan.translationGroupByTermId.get(termId);\n\tif (cached !== undefined) return cached;\n\tconst term = await repo.findById(termId);\n\tconst group = term?.translationGroup ?? null;\n\tplan.translationGroupByTermId.set(termId, group);\n\treturn group;\n}\n\n/**\n * Wrapper around `TaxonomyRepository.attachToEntry` that returns whether\n * an actual row was inserted (vs. silently skipped by the `ON CONFLICT DO\n * NOTHING` branch). Lets the importer's `assignments` counter reflect real\n * writes rather than re-import no-ops.\n *\n * Best-effort: we check pivot existence first, then call `attachToEntry`.\n * A concurrent insert between the check and the attach would make us\n * report `false` while a row was in fact inserted -- the count is for\n * summary display only, never correctness.\n */\nasync function attachToEntryCountingInserts(\n\tdb: Kysely<Database>,\n\trepo: TaxonomyRepository,\n\tplan: TaxonomyImportPlan,\n\tcollection: string,\n\tentryId: string,\n\ttermId: string,\n): Promise<boolean> {\n\tconst group = await termTranslationGroup(repo, plan, termId);\n\tif (!group) return false;\n\n\tconst existing = await db\n\t\t.selectFrom(\"content_taxonomies\")\n\t\t.select(\"collection\")\n\t\t.where(\"collection\", \"=\", collection)\n\t\t.where(\"entry_id\", \"=\", entryId)\n\t\t.where(\"taxonomy_id\", \"=\", group)\n\t\t.executeTakeFirst();\n\tif (existing) return false;\n\n\tawait repo.attachToEntry(collection, entryId, termId);\n\treturn true;\n}\n\n/**\n * Mirror every term in the plan into each additional locale used by the\n * incoming posts. New rows share the canonical term's `translation_group`\n * so per-locale lookups (`getTermsForEntry(..., locale)`) resolve correctly\n * for translations whose locale differs from the import-wide one.\n *\n * Without this pass, multilingual WXR imports (#1080) write all term rows\n * at the upload-wide locale; the `content_taxonomies` pivot is correct (it\n * stores `translation_group`, not `term id`), but\n * `getTermsForEntry(collection, arabicPostId, \"category\", \"ar\")` filters on\n * `taxonomies.locale = \"ar\"` and returns zero rows. Users see \"no tags\" on\n * every non-canonical translation.\n *\n * Idempotent: skips a locale when a row already exists at `(name, slug,\n * locale)`. Safe to call after `preImportWxrTaxonomies` on subsequent\n * imports.\n */\nexport async function mirrorTermsToLocales(\n\tdb: Kysely<Database>,\n\tplan: TaxonomyImportPlan,\n\tpostLocales: Iterable<string>,\n\tcanonicalLocale: string | undefined,\n): Promise<void> {\n\tconst localeSet = new Set<string>();\n\tfor (const locale of postLocales) {\n\t\tif (!locale || locale === canonicalLocale) continue;\n\t\tlocaleSet.add(locale);\n\t}\n\tif (localeSet.size === 0) return;\n\n\tconst repo = new TaxonomyRepository(db);\n\n\tfor (const [taxonomyName, bySlug] of plan.termIdByNameAndSlug) {\n\t\tfor (const [slug, canonicalTermId] of bySlug) {\n\t\t\t// Resolve the canonical's translation_group once; we'll compare\n\t\t\t// against any pre-existing rows we find at the target locales.\n\t\t\t// Cache on the plan so subsequent attaches (which also need\n\t\t\t// this resolution) don't repeat the lookup.\n\t\t\tconst cachedGroup = await termTranslationGroup(repo, plan, canonicalTermId);\n\t\t\tif (!cachedGroup) {\n\t\t\t\t// The canonical term id is in the plan but the row is no\n\t\t\t\t// longer in the DB. Shouldn't happen during a single\n\t\t\t\t// import run; skip rather than crash so the rest of the\n\t\t\t\t// import can complete.\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst canonicalGroup = cachedGroup;\n\n\t\t\tfor (const locale of localeSet) {\n\t\t\t\tconst existing = await repo.findBySlug(taxonomyName, slug, locale);\n\t\t\t\tif (existing) {\n\t\t\t\t\t// `ensureTerm` resolves cross-locale grouping when it\n\t\t\t\t\t// creates the canonical row, so a pre-existing sibling\n\t\t\t\t\t// row at this locale should already share the\n\t\t\t\t\t// canonical's `translation_group`. If it doesn't, the\n\t\t\t\t\t// import would write pivots pointing at a group that\n\t\t\t\t\t// has no row in this locale -- a silent data-integrity\n\t\t\t\t\t// bug. Fail closed: throw so the operator reconciles\n\t\t\t\t\t// the existing rows in the admin before retrying. This\n\t\t\t\t\t// happens when the canonical row was created in an\n\t\t\t\t\t// earlier import and a sibling-locale row was added\n\t\t\t\t\t// manually afterwards (or vice versa) without linking\n\t\t\t\t\t// them via translationOf.\n\t\t\t\t\tif (existing.translationGroup !== canonicalGroup) {\n\t\t\t\t\t\tthrow new WxrTaxonomyConflictError(\n\t\t\t\t\t\t\t`Cannot import: term \"${taxonomyName}/${slug}\" already exists at locale \"${locale}\" in a different translation group than the canonical row at this import's locale. Reconcile the rows in the admin (re-link via translationOf, or delete one) and retry.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tawait repo.create({\n\t\t\t\t\t\tname: taxonomyName,\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\tlabel: slug, // we don't have a per-locale label from the WXR\n\t\t\t\t\t\tlocale,\n\t\t\t\t\t\ttranslationOf: canonicalTermId,\n\t\t\t\t\t});\n\t\t\t\t} catch (error) {\n\t\t\t\t\t// `findBySlug` + `create` is not atomic. A concurrent\n\t\t\t\t\t// import racing us into the same `(name, slug, locale)`\n\t\t\t\t\t// will trip the UNIQUE constraint. Re-read the row that\n\t\t\t\t\t// won the race and verify its `translation_group`\n\t\t\t\t\t// matches the canonical's; if not, the pivot will\n\t\t\t\t\t// resolve to a group that has no row in this locale\n\t\t\t\t\t// (silent data-integrity bug) so we surface that loudly\n\t\t\t\t\t// rather than continue.\n\t\t\t\t\t//\n\t\t\t\t\t// Other errors (validation, connectivity) re-throw so\n\t\t\t\t\t// the import fails closed rather than silently shipping\n\t\t\t\t\t// translations that resolve to empty taxonomy queries.\n\t\t\t\t\tconst message = error instanceof Error ? error.message.toLowerCase() : \"\";\n\t\t\t\t\tconst isUniqueRace =\n\t\t\t\t\t\tmessage.includes(\"unique constraint failed\") || message.includes(\"duplicate key\");\n\t\t\t\t\tif (!isUniqueRace) throw error;\n\n\t\t\t\t\tconst winner = await repo.findBySlug(taxonomyName, slug, locale);\n\t\t\t\t\tif (!winner) {\n\t\t\t\t\t\t// UNIQUE conflict but no row visible? Shouldn't\n\t\t\t\t\t\t// happen unless the racing transaction rolled back;\n\t\t\t\t\t\t// fail loudly so the operator can investigate.\n\t\t\t\t\t\tthrow new WxrTaxonomyConflictError(\n\t\t\t\t\t\t\t`Cannot import: term \"${taxonomyName}/${slug}\" raced UNIQUE at locale \"${locale}\" but no row is visible afterwards. The concurrent transaction may have rolled back; retry the import.`,\n\t\t\t\t\t\t\t{ cause: error },\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif (winner.translationGroup !== canonicalGroup) {\n\t\t\t\t\t\tthrow new WxrTaxonomyConflictError(\n\t\t\t\t\t\t\t`Cannot import: term \"${taxonomyName}/${slug}\" raced UNIQUE at locale \"${locale}\" with a different translation group. Reconcile the rows in the admin and retry.`,\n\t\t\t\t\t\t\t{ cause: error },\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`[WXR import] concurrent writer beat us to term \"${taxonomyName}/${slug}\" at locale \"${locale}\"; using existing row (same group).`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA8CA,IAAa,2BAAb,cAA8C,MAAM;CACnD,AAAS;CACT,YAAY,eAAuB,SAA+B;AACjE,QAAM,eAAe,QAAQ;AAC7B,OAAK,OAAO;AACZ,OAAK,gBAAgB;;;AAIvB,SAAgB,2BAA2B,OAAmD;AAC7F,QAAO,iBAAiB;;AAuCzB,SAAS,YAAiC;AACzC,QAAO,EACN,MAAM;EACL,cAAc,EAAE;EAChB,aAAa,EAAE;EACf,mBAAmB,EAAE;EACrB,qCAAqB,IAAI,KAAK;EAC9B,uCAAuB,IAAI,KAAK;EAChC,0CAA0B,IAAI,KAAK;EACnC,EACD;;;;;;AAOF,SAAS,KAAK,QAAgC,KAAmB;AAChE,QAAO,QAAQ,OAAO,QAAQ,KAAK;;AAGpC,SAAS,aACR,OACA,cACA,MACA,QACO;CACP,IAAI,SAAS,MAAM,KAAK,oBAAoB,IAAI,aAAa;AAC7D,KAAI,CAAC,QAAQ;AACZ,2BAAS,IAAI,KAAK;AAClB,QAAM,KAAK,oBAAoB,IAAI,cAAc,OAAO;;AAEzD,QAAO,IAAI,MAAM,OAAO;;;;;;;;;;;;;;;;;;AAmBzB,SAAS,oBAAoB,KAA8B;AAC1D,KAAI,CAAC,IAAK,QAAO,EAAE;AACnB,KAAI;EACH,MAAM,SAAkB,KAAK,MAAM,IAAI;AACvC,MAAI,MAAM,QAAQ,OAAO,CACxB,QAAO,OAAO,QAAQ,MAAmB,OAAO,MAAM,SAAS;SAEzD;AAGR,QAAO,EAAE;;AAGV,eAAe,gBACd,IACA,MACA,QACwD;CACxD,MAAM,QAAQ,mBAAmB,OAAO;AAExC,KAAI,MAAM,WAAW,GAAG;EAKvB,MAAM,MAAM,MAAM,GAChB,WAAW,wBAAwB,CACnC,WAA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AAI,QAAQ,SAAS,gBAAgB,EAC/D,OAAM;IAEzB,MAAM,SAAS,MAAM,KAAK,WAAW,cAAc,MAAM,OAAO;AAChE,QAAI,CAAC,OAIJ,OAAM,IAAI,yBACT,wBAAwB,aAAa,GAAG,KAAK,4BAA4B,OAAO,yGAChF,EAAE,OAAO,OAAO,CAChB;AAEF,QAAI,OAAO,qBAAqB,eAC/B,OAAM,IAAI,yBACT,wBAAwB,aAAa,GAAG,KAAK,4BAA4B,OAAO,mFAChF,EAAE,OAAO,OAAO,CAChB;AAEF,YAAQ,KACP,mDAAmD,aAAa,GAAG,KAAK,eAAe,OAAO,qCAC9F"}
@@ -1,4 +1,4 @@
1
- import { a as __exportAll } from "./runner-CFngB4WZ.mjs";
1
+ import { a as __exportAll } from "./runner-K8XK101B.mjs";
2
2
  import { n as hashString } from "./hash-DrvzIXcz.mjs";
3
3
  import { z } from "zod";
4
4
 
@@ -271,4 +271,4 @@ function uniqueInterfaceNames(collections) {
271
271
 
272
272
  //#endregion
273
273
  export { zod_generator_exports as i, generateZodSchema as n, uniqueInterfaceNames as r, generateTypeScript as t };
274
- //# sourceMappingURL=zod-generator-C5JaV--i.mjs.map
274
+ //# sourceMappingURL=zod-generator-CacrR-i8.mjs.map