emdash 0.34.0 → 0.35.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 (508) hide show
  1. package/dist/{adapters-34EN2eXO.d.mts → adapters-Bb1vG41D.d.mts} +8 -1
  2. package/dist/adapters-Bb1vG41D.d.mts.map +1 -0
  3. package/dist/api/route-utils.d.mts +3 -3
  4. package/dist/api/route-utils.mjs +9 -9
  5. package/dist/api/schemas/index.d.mts +1 -1
  6. package/dist/api/schemas/index.mjs +1 -1
  7. package/dist/{api-DdAsirBe.mjs → api-BeBglVxU.mjs} +10 -10
  8. package/dist/{api-DdAsirBe.mjs.map → api-BeBglVxU.mjs.map} +1 -1
  9. package/dist/{api-tokens-CFXu8F_2.mjs → api-tokens-KO24G1Fd.mjs} +2 -2
  10. package/dist/{api-tokens-CFXu8F_2.mjs.map → api-tokens-KO24G1Fd.mjs.map} +1 -1
  11. package/dist/{apply-D5zfeD09.mjs → apply-kUDt80-G.mjs} +16 -16
  12. package/dist/{apply-D5zfeD09.mjs.map → apply-kUDt80-G.mjs.map} +1 -1
  13. package/dist/astro/index.d.mts +12 -12
  14. package/dist/astro/index.d.mts.map +1 -1
  15. package/dist/astro/index.mjs +71 -15
  16. package/dist/astro/index.mjs.map +1 -1
  17. package/dist/astro/middleware/auth.d.mts +10 -10
  18. package/dist/astro/middleware/auth.mjs +4 -4
  19. package/dist/astro/middleware/redirect.mjs +2 -2
  20. package/dist/astro/middleware/request-context.mjs +1 -1
  21. package/dist/astro/middleware/setup.mjs +1 -1
  22. package/dist/astro/middleware.d.mts +10 -10
  23. package/dist/astro/middleware.d.mts.map +1 -1
  24. package/dist/astro/middleware.mjs +143 -74
  25. package/dist/astro/middleware.mjs.map +1 -1
  26. package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +1 -1
  27. package/dist/astro/routes/api/admin/allowed-domains/index.mjs +1 -1
  28. package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +2 -2
  29. package/dist/astro/routes/api/admin/api-tokens/index.mjs +2 -2
  30. package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +2 -2
  31. package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +3 -3
  32. package/dist/astro/routes/api/admin/byline-fields/index.mjs +3 -3
  33. package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +3 -3
  34. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +7 -7
  35. package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +7 -7
  36. package/dist/astro/routes/api/admin/bylines/index.mjs +7 -7
  37. package/dist/astro/routes/api/admin/comments/_id_/status.mjs +5 -5
  38. package/dist/astro/routes/api/admin/comments/_id_.mjs +2 -2
  39. package/dist/astro/routes/api/admin/comments/bulk.mjs +3 -3
  40. package/dist/astro/routes/api/admin/comments/counts.mjs +2 -2
  41. package/dist/astro/routes/api/admin/comments/index.mjs +3 -3
  42. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +1 -1
  43. package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +1 -1
  44. package/dist/astro/routes/api/admin/media-usage/collection-deletions/index.mjs +7 -7
  45. package/dist/astro/routes/api/admin/media-usage/collection-deletions/retry.mjs +7 -7
  46. package/dist/astro/routes/api/admin/media-usage/repair.mjs +4 -4
  47. package/dist/astro/routes/api/admin/media-usage/work/index.mjs +7 -7
  48. package/dist/astro/routes/api/admin/media-usage/work/retry.mjs +7 -7
  49. package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +1 -1
  50. package/dist/astro/routes/api/admin/oauth-clients/index.mjs +1 -1
  51. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +28 -28
  52. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +28 -28
  53. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +28 -28
  54. package/dist/astro/routes/api/admin/plugins/_id_/mcp.mjs +1 -1
  55. package/dist/astro/routes/api/admin/plugins/_id_/settings.mjs +28 -28
  56. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +28 -28
  57. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +28 -28
  58. package/dist/astro/routes/api/admin/plugins/index.mjs +28 -28
  59. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +1 -1
  60. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +28 -28
  61. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +28 -28
  62. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +28 -28
  63. package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs +28 -28
  64. package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs +29 -29
  65. package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs +28 -28
  66. package/dist/astro/routes/api/admin/plugins/registry/install.mjs +29 -29
  67. package/dist/astro/routes/api/admin/plugins/updates.mjs +28 -28
  68. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +28 -28
  69. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +1 -1
  70. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +28 -28
  71. package/dist/astro/routes/api/admin/users/_id_/index.mjs +1 -1
  72. package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +1 -1
  73. package/dist/astro/routes/api/admin/users/index.mjs +1 -1
  74. package/dist/astro/routes/api/auth/dev-bypass.d.mts.map +1 -1
  75. package/dist/astro/routes/api/auth/dev-bypass.mjs +2 -6
  76. package/dist/astro/routes/api/auth/dev-bypass.mjs.map +1 -1
  77. package/dist/astro/routes/api/auth/invite/complete.mjs +3 -3
  78. package/dist/astro/routes/api/auth/invite/index.mjs +2 -2
  79. package/dist/astro/routes/api/auth/invite/register-options.mjs +3 -3
  80. package/dist/astro/routes/api/auth/logout.mjs +1 -1
  81. package/dist/astro/routes/api/auth/magic-link/send.mjs +3 -3
  82. package/dist/astro/routes/api/auth/magic-link/verify.mjs +1 -1
  83. package/dist/astro/routes/api/auth/me.mjs +2 -2
  84. package/dist/astro/routes/api/auth/mode.mjs +1 -1
  85. package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +2 -2
  86. package/dist/astro/routes/api/auth/oauth/_provider_.mjs +1 -1
  87. package/dist/astro/routes/api/auth/passkey/_id_.mjs +1 -1
  88. package/dist/astro/routes/api/auth/passkey/options.mjs +4 -4
  89. package/dist/astro/routes/api/auth/passkey/register/options.mjs +3 -3
  90. package/dist/astro/routes/api/auth/passkey/register/verify.mjs +3 -3
  91. package/dist/astro/routes/api/auth/passkey/verify.mjs +3 -3
  92. package/dist/astro/routes/api/auth/signup/complete.mjs +3 -3
  93. package/dist/astro/routes/api/auth/signup/request.mjs +3 -3
  94. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +5 -5
  95. package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +4 -4
  96. package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +1 -1
  97. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +1 -1
  98. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +1 -1
  99. package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +1 -1
  100. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +3 -3
  101. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +2 -2
  102. package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.mjs +9 -9
  103. package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.mjs +9 -9
  104. package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +1 -1
  105. package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +1 -1
  106. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +2 -2
  107. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +6 -6
  108. package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +1 -1
  109. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +1 -1
  110. package/dist/astro/routes/api/content/_collection_/_id_.mjs +2 -2
  111. package/dist/astro/routes/api/content/_collection_/authors.mjs +1 -1
  112. package/dist/astro/routes/api/content/_collection_/index.mjs +2 -2
  113. package/dist/astro/routes/api/content/_collection_/trash.mjs +2 -2
  114. package/dist/astro/routes/api/dashboard.mjs +4 -4
  115. package/dist/astro/routes/api/import/probe.d.mts +3 -3
  116. package/dist/astro/routes/api/import/probe.mjs +5 -5
  117. package/dist/astro/routes/api/import/wordpress/analyze.mjs +1 -1
  118. package/dist/astro/routes/api/import/wordpress/execute.d.mts +11 -11
  119. package/dist/astro/routes/api/import/wordpress/execute.mjs +7 -7
  120. package/dist/astro/routes/api/import/wordpress/media.d.mts +10 -10
  121. package/dist/astro/routes/api/import/wordpress/media.mjs +2 -2
  122. package/dist/astro/routes/api/import/wordpress/prepare.mjs +4 -4
  123. package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +11 -11
  124. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +4 -4
  125. package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
  126. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +5 -5
  127. package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +11 -11
  128. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +11 -11
  129. package/dist/astro/routes/api/manifest.mjs +2 -2
  130. package/dist/astro/routes/api/mcp.mjs +38 -38
  131. package/dist/astro/routes/api/media/_id_/confirm.mjs +2 -2
  132. package/dist/astro/routes/api/media/_id_/upload.mjs +2 -2
  133. package/dist/astro/routes/api/media/_id_/usage.mjs +6 -6
  134. package/dist/astro/routes/api/media/_id_.mjs +5 -5
  135. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +1 -1
  136. package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +1 -1
  137. package/dist/astro/routes/api/media/providers/index.mjs +1 -1
  138. package/dist/astro/routes/api/media/upload-url.mjs +3 -3
  139. package/dist/astro/routes/api/media.mjs +5 -5
  140. package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +3 -3
  141. package/dist/astro/routes/api/menus/_name_/items.mjs +3 -3
  142. package/dist/astro/routes/api/menus/_name_/reorder.mjs +3 -3
  143. package/dist/astro/routes/api/menus/_name_/translations.mjs +3 -3
  144. package/dist/astro/routes/api/menus/_name_.mjs +3 -3
  145. package/dist/astro/routes/api/menus/index.mjs +3 -3
  146. package/dist/astro/routes/api/oauth/authorize.mjs +5 -5
  147. package/dist/astro/routes/api/oauth/device/authorize.mjs +3 -3
  148. package/dist/astro/routes/api/oauth/device/code.mjs +4 -4
  149. package/dist/astro/routes/api/oauth/device/token.mjs +4 -4
  150. package/dist/astro/routes/api/oauth/register.mjs +1 -1
  151. package/dist/astro/routes/api/oauth/token/refresh.mjs +3 -3
  152. package/dist/astro/routes/api/oauth/token/revoke.mjs +3 -3
  153. package/dist/astro/routes/api/oauth/token.mjs +4 -4
  154. package/dist/astro/routes/api/openapi.json.mjs +1 -1
  155. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +3 -3
  156. package/dist/astro/routes/api/redirects/404s/index.mjs +3 -3
  157. package/dist/astro/routes/api/redirects/404s/summary.mjs +3 -3
  158. package/dist/astro/routes/api/redirects/_id_.mjs +4 -4
  159. package/dist/astro/routes/api/redirects/index.mjs +4 -4
  160. package/dist/astro/routes/api/relations/_id_/index.mjs +9 -9
  161. package/dist/astro/routes/api/relations/_id_/translations.mjs +8 -8
  162. package/dist/astro/routes/api/relations/index.mjs +9 -9
  163. package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +1 -1
  164. package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +1 -1
  165. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +28 -28
  166. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +28 -28
  167. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +28 -28
  168. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +28 -28
  169. package/dist/astro/routes/api/schema/collections/index.mjs +28 -28
  170. package/dist/astro/routes/api/schema/collections/reorder.mjs +28 -28
  171. package/dist/astro/routes/api/schema/index.mjs +6 -6
  172. package/dist/astro/routes/api/schema/orphans/_slug_.mjs +28 -28
  173. package/dist/astro/routes/api/schema/orphans/index.mjs +28 -28
  174. package/dist/astro/routes/api/search/enable.mjs +5 -5
  175. package/dist/astro/routes/api/search/index.mjs +4 -4
  176. package/dist/astro/routes/api/search/rebuild.mjs +5 -5
  177. package/dist/astro/routes/api/search/stats.mjs +4 -4
  178. package/dist/astro/routes/api/search/suggest.mjs +4 -4
  179. package/dist/astro/routes/api/sections/_slug_.mjs +4 -4
  180. package/dist/astro/routes/api/sections/index.mjs +4 -4
  181. package/dist/astro/routes/api/settings/backups/archives/_name_.mjs +3 -3
  182. package/dist/astro/routes/api/settings/backups/archives/index.mjs +3 -3
  183. package/dist/astro/routes/api/settings/backups/export.mjs +3 -3
  184. package/dist/astro/routes/api/settings/backups/index.mjs +3 -3
  185. package/dist/astro/routes/api/settings/email.mjs +1 -1
  186. package/dist/astro/routes/api/settings.mjs +5 -5
  187. package/dist/astro/routes/api/setup/admin-verify.mjs +4 -4
  188. package/dist/astro/routes/api/setup/admin.mjs +4 -4
  189. package/dist/astro/routes/api/setup/dev-bypass.d.mts.map +1 -1
  190. package/dist/astro/routes/api/setup/dev-bypass.mjs +18 -21
  191. package/dist/astro/routes/api/setup/dev-bypass.mjs.map +1 -1
  192. package/dist/astro/routes/api/setup/index.d.mts.map +1 -1
  193. package/dist/astro/routes/api/setup/index.mjs +15 -21
  194. package/dist/astro/routes/api/setup/index.mjs.map +1 -1
  195. package/dist/astro/routes/api/setup/status.mjs +2 -2
  196. package/dist/astro/routes/api/snapshot.mjs +4 -4
  197. package/dist/astro/routes/api/taxonomies/_name_/reorder.mjs +6 -6
  198. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +6 -6
  199. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +6 -6
  200. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +6 -6
  201. package/dist/astro/routes/api/taxonomies/_name_/translations.mjs +6 -6
  202. package/dist/astro/routes/api/taxonomies/_name_.mjs +6 -6
  203. package/dist/astro/routes/api/taxonomies/index.mjs +6 -6
  204. package/dist/astro/routes/api/themes/preview.mjs +2 -2
  205. package/dist/astro/routes/api/typegen.mjs +3 -3
  206. package/dist/astro/routes/api/well-known/auth.mjs +1 -1
  207. package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +1 -1
  208. package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +1 -1
  209. package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +2 -2
  210. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +4 -4
  211. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +4 -4
  212. package/dist/astro/routes/api/widget-areas/_name_.mjs +3 -3
  213. package/dist/astro/routes/api/widget-areas/index.mjs +4 -4
  214. package/dist/astro/routes/robots.txt.mjs +2 -2
  215. package/dist/astro/routes/sitemap-_collection_.xml.mjs +2 -2
  216. package/dist/astro/routes/sitemap.xml.mjs +2 -2
  217. package/dist/astro/types.d.mts +14 -14
  218. package/dist/auth/providers/github.d.mts +1 -1
  219. package/dist/auth/providers/google.d.mts +1 -1
  220. package/dist/{authorize-1iFJzPaZ.mjs → authorize-DUElxgOQ.mjs} +1 -1
  221. package/dist/{authorize-1iFJzPaZ.mjs.map → authorize-DUElxgOQ.mjs.map} +1 -1
  222. package/dist/{backup-LHjIAVNP.mjs → backup-DWYpJlLj.mjs} +3 -3
  223. package/dist/{backup-LHjIAVNP.mjs.map → backup-DWYpJlLj.mjs.map} +1 -1
  224. package/dist/{bundle-CBEXrBnb.mjs → bundle-vn56sLos.mjs} +5 -5
  225. package/dist/{bundle-CBEXrBnb.mjs.map → bundle-vn56sLos.mjs.map} +1 -1
  226. package/dist/{byline-fields-C5S8wygO.mjs → byline-fields-txaLGoME.mjs} +1 -1
  227. package/dist/{byline-fields-C5S8wygO.mjs.map → byline-fields-txaLGoME.mjs.map} +1 -1
  228. package/dist/{byline-pEcoDps8.mjs → byline-yjvWq4ip.mjs} +4 -4
  229. package/dist/{byline-pEcoDps8.mjs.map → byline-yjvWq4ip.mjs.map} +1 -1
  230. package/dist/{bylines-DJfSfXCL.mjs → bylines-Bu7pchQ4.mjs} +3 -3
  231. package/dist/{bylines-DJfSfXCL.mjs.map → bylines-Bu7pchQ4.mjs.map} +1 -1
  232. package/dist/{bylines-BWemdX2k.mjs → bylines-DjXS5p0P.mjs} +5 -5
  233. package/dist/{bylines-BWemdX2k.mjs.map → bylines-DjXS5p0P.mjs.map} +1 -1
  234. package/dist/{cache-CBJaDy_E.mjs → cache-C46-3Irl.mjs} +2 -2
  235. package/dist/{cache-CBJaDy_E.mjs.map → cache-C46-3Irl.mjs.map} +1 -1
  236. package/dist/{challenge-store-CZyFVaad.mjs → challenge-store-SIL5DsF2.mjs} +1 -1
  237. package/dist/{challenge-store-CZyFVaad.mjs.map → challenge-store-SIL5DsF2.mjs.map} +1 -1
  238. package/dist/{chunks-DfPax1I0.mjs → chunks-fiZ8G9RJ.mjs} +2 -2
  239. package/dist/{chunks-DfPax1I0.mjs.map → chunks-fiZ8G9RJ.mjs.map} +1 -1
  240. package/dist/cli/index.mjs +551 -51
  241. package/dist/cli/index.mjs.map +1 -1
  242. package/dist/client/cf-access.d.mts +1 -1
  243. package/dist/client/index.d.mts +2 -2
  244. package/dist/client/index.mjs +2 -2
  245. package/dist/{collection-deletion-C8BugSGz.mjs → collection-deletion-DQPvMD8R.mjs} +2 -2
  246. package/dist/{collection-deletion-C8BugSGz.mjs.map → collection-deletion-DQPvMD8R.mjs.map} +1 -1
  247. package/dist/{comment-reaction-D6qfHKBc.mjs → comment-reaction-D-2J84UE.mjs} +2 -2
  248. package/dist/{comment-reaction-D6qfHKBc.mjs.map → comment-reaction-D-2J84UE.mjs.map} +1 -1
  249. package/dist/{comments-CTOuhTSX.mjs → comments-CTfZtLmM.mjs} +1 -1
  250. package/dist/{comments-CTOuhTSX.mjs.map → comments-CTfZtLmM.mjs.map} +1 -1
  251. package/dist/config-COQzTe5Q.d.mts +34 -0
  252. package/dist/config-COQzTe5Q.d.mts.map +1 -0
  253. package/dist/{content-BNfwh7xX.mjs → content-ZHCc1ngN.mjs} +3 -3
  254. package/dist/{content-BNfwh7xX.mjs.map → content-ZHCc1ngN.mjs.map} +1 -1
  255. package/dist/{content-list-query-DhQ84eVV.d.mts → content-list-query-wJ2WN8Vp.d.mts} +1 -1
  256. package/dist/{content-list-query-DhQ84eVV.d.mts.map → content-list-query-wJ2WN8Vp.d.mts.map} +1 -1
  257. package/dist/{content-refresh-DNERP4-f.mjs → content-refresh-B_8SJzuU.mjs} +2 -2
  258. package/dist/{content-refresh-DNERP4-f.mjs.map → content-refresh-B_8SJzuU.mjs.map} +1 -1
  259. package/dist/{context-DRgOvSnW.mjs → context-ZldbZcle.mjs} +7 -7
  260. package/dist/{context-DRgOvSnW.mjs.map → context-ZldbZcle.mjs.map} +1 -1
  261. package/dist/{dashboard-CB8J89rJ.mjs → dashboard-DvHbk_cv.mjs} +3 -3
  262. package/dist/{dashboard-CB8J89rJ.mjs.map → dashboard-DvHbk_cv.mjs.map} +1 -1
  263. package/dist/db/index.d.mts +4 -4
  264. package/dist/db/index.mjs +30 -7
  265. package/dist/db/index.mjs.map +1 -1
  266. package/dist/db/libsql-migrations.d.mts +11 -0
  267. package/dist/db/libsql-migrations.d.mts.map +1 -0
  268. package/dist/db/libsql-migrations.mjs +57 -0
  269. package/dist/db/libsql-migrations.mjs.map +1 -0
  270. package/dist/db/libsql.d.mts +1 -1
  271. package/dist/db/postgres-migrations.d.mts +10 -0
  272. package/dist/db/postgres-migrations.d.mts.map +1 -0
  273. package/dist/db/postgres-migrations.mjs +47 -0
  274. package/dist/db/postgres-migrations.mjs.map +1 -0
  275. package/dist/db/postgres.d.mts +1 -1
  276. package/dist/db/sqlite-migrations.d.mts +10 -0
  277. package/dist/db/sqlite-migrations.d.mts.map +1 -0
  278. package/dist/db/sqlite-migrations.mjs +28 -0
  279. package/dist/db/sqlite-migrations.mjs.map +1 -0
  280. package/dist/db/sqlite.d.mts +1 -1
  281. package/dist/{deferred-tasks-BMsa9F64.d.mts → deferred-tasks-SDWxrgzJ.d.mts} +1 -1
  282. package/dist/{deferred-tasks-BMsa9F64.d.mts.map → deferred-tasks-SDWxrgzJ.d.mts.map} +1 -1
  283. package/dist/{device-flow-CaioYGK3.mjs → device-flow-C0GdD_z8.mjs} +4 -4
  284. package/dist/{device-flow-CaioYGK3.mjs.map → device-flow-C0GdD_z8.mjs.map} +1 -1
  285. package/dist/direct-executor-CDXeJCSs.mjs +85 -0
  286. package/dist/direct-executor-CDXeJCSs.mjs.map +1 -0
  287. package/dist/{escape-C_aLKP3H.mjs → escape-DUY2r2Zs.mjs} +1 -1
  288. package/dist/{escape-C_aLKP3H.mjs.map → escape-DUY2r2Zs.mjs.map} +1 -1
  289. package/dist/{field-defs-cache-hg6QkjV9.mjs → field-defs-cache-BzwBlJrR.mjs} +2 -2
  290. package/dist/{field-defs-cache-hg6QkjV9.mjs.map → field-defs-cache-BzwBlJrR.mjs.map} +1 -1
  291. package/dist/{fts-manager-CZ-5dVwJ.mjs → fts-manager-DyZEohZC.mjs} +2 -2
  292. package/dist/{fts-manager-CZ-5dVwJ.mjs.map → fts-manager-DyZEohZC.mjs.map} +1 -1
  293. package/dist/{hreflang-DNswoYsi.mjs → hreflang-BBe83kKa.mjs} +5 -5
  294. package/dist/{hreflang-DNswoYsi.mjs.map → hreflang-BBe83kKa.mjs.map} +1 -1
  295. package/dist/{hreflang-D3Uehfv2.d.mts → hreflang-DwT2E0Sa.d.mts} +2 -2
  296. package/dist/{hreflang-D3Uehfv2.d.mts.map → hreflang-DwT2E0Sa.d.mts.map} +1 -1
  297. package/dist/identity-Ys6Dlc9C.mjs +35 -0
  298. package/dist/identity-Ys6Dlc9C.mjs.map +1 -0
  299. package/dist/{import-B41u8Rot.mjs → import-DPkLmeXO.mjs} +2 -2
  300. package/dist/{import-B41u8Rot.mjs.map → import-DPkLmeXO.mjs.map} +1 -1
  301. package/dist/{index-C3Y-rsyN.d.mts → index-BVBZj4-7.d.mts} +28 -49
  302. package/dist/index-BVBZj4-7.d.mts.map +1 -0
  303. package/dist/{index-Cof4-Fab.d.mts → index-C9KuQyO-.d.mts} +3 -3
  304. package/dist/{index-Cof4-Fab.d.mts.map → index-C9KuQyO-.d.mts.map} +1 -1
  305. package/dist/index.d.mts +21 -20
  306. package/dist/index.mjs +42 -42
  307. package/dist/{load-DmvJrtxS.mjs → load-YJ2xl3ra.mjs} +2 -2
  308. package/dist/{load-DmvJrtxS.mjs.map → load-YJ2xl3ra.mjs.map} +1 -1
  309. package/dist/{loader-DLBqRiGP.mjs → loader-CdG_Ci3H.mjs} +2 -2
  310. package/dist/{loader-DLBqRiGP.mjs.map → loader-CdG_Ci3H.mjs.map} +1 -1
  311. package/dist/manifest-builder-B252yQUf.mjs +189 -0
  312. package/dist/manifest-builder-B252yQUf.mjs.map +1 -0
  313. package/dist/media/index.d.mts +1 -1
  314. package/dist/media/local-runtime.d.mts +12 -12
  315. package/dist/media/local-runtime.mjs +2 -2
  316. package/dist/{media-allowlist-BD6HhgXA.mjs → media-allowlist-D6x-Us02.mjs} +1 -1
  317. package/dist/{media-allowlist-BD6HhgXA.mjs.map → media-allowlist-D6x-Us02.mjs.map} +1 -1
  318. package/dist/{media-upload-9yas9zGH.mjs → media-upload-CHBVn6m-.mjs} +2 -2
  319. package/dist/{media-upload-9yas9zGH.mjs.map → media-upload-CHBVn6m-.mjs.map} +1 -1
  320. package/dist/{media-usage-De3qvwjc.mjs → media-usage-BZCydfvu.mjs} +4 -4
  321. package/dist/{media-usage-De3qvwjc.mjs.map → media-usage-BZCydfvu.mjs.map} +1 -1
  322. package/dist/{media-usage-work-B9Bksh_b.mjs → media-usage-work-CLo_6tct.mjs} +2 -2
  323. package/dist/{media-usage-work-B9Bksh_b.mjs.map → media-usage-work-CLo_6tct.mjs.map} +1 -1
  324. package/dist/{menus-CC-yn1F9.mjs → menus-DSo5QeW0.mjs} +6 -6
  325. package/dist/{menus-CC-yn1F9.mjs.map → menus-DSo5QeW0.mjs.map} +1 -1
  326. package/dist/{menus-fxvEDYE6.mjs → menus-TCNSd2vp.mjs} +2 -2
  327. package/dist/{menus-fxvEDYE6.mjs.map → menus-TCNSd2vp.mjs.map} +1 -1
  328. package/dist/migrations/index.d.mts +22 -0
  329. package/dist/migrations/index.d.mts.map +1 -0
  330. package/dist/migrations/index.mjs +7 -0
  331. package/dist/{mode-Bpe-tNNy.mjs → mode-BDoH_WcF.mjs} +1 -1
  332. package/dist/{mode-Bpe-tNNy.mjs.map → mode-BDoH_WcF.mjs.map} +1 -1
  333. package/dist/{oauth-authorization-BXO1MKej.mjs → oauth-authorization-iOikmrJd.mjs} +4 -4
  334. package/dist/{oauth-authorization-BXO1MKej.mjs.map → oauth-authorization-iOikmrJd.mjs.map} +1 -1
  335. package/dist/{oauth-clients-C_DNqtRu.mjs → oauth-clients-CvI0nHMJ.mjs} +1 -1
  336. package/dist/{oauth-clients-C_DNqtRu.mjs.map → oauth-clients-CvI0nHMJ.mjs.map} +1 -1
  337. package/dist/{oauth-state-store-DwAxMtk4.mjs → oauth-state-store-Ba8KZlwW.mjs} +1 -1
  338. package/dist/{oauth-state-store-DwAxMtk4.mjs.map → oauth-state-store-Ba8KZlwW.mjs.map} +1 -1
  339. package/dist/{oauth-user-lookup-BxfZizdk.mjs → oauth-user-lookup-C5SQwGYC.mjs} +1 -1
  340. package/dist/{oauth-user-lookup-BxfZizdk.mjs.map → oauth-user-lookup-C5SQwGYC.mjs.map} +1 -1
  341. package/dist/object-cache/memory.d.mts +1 -1
  342. package/dist/{options-DRe1pIBL.d.mts → options--hhz-jZ1.d.mts} +3 -3
  343. package/dist/{options-DRe1pIBL.d.mts.map → options--hhz-jZ1.d.mts.map} +1 -1
  344. package/dist/page/index.d.mts +2 -2
  345. package/dist/{passkey-config-_2GOwwK8.mjs → passkey-config-DFAmUyuE.mjs} +1 -1
  346. package/dist/{passkey-config-_2GOwwK8.mjs.map → passkey-config-DFAmUyuE.mjs.map} +1 -1
  347. package/dist/{placeholder-CzW7Lshs.d.mts → placeholder-Dp0K3RkD.d.mts} +1 -1
  348. package/dist/{placeholder-CzW7Lshs.d.mts.map → placeholder-Dp0K3RkD.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/policy-TluUIxuu.mjs +45 -0
  353. package/dist/policy-TluUIxuu.mjs.map +1 -0
  354. package/dist/{portable-text-DhKbDAGr.mjs → portable-text-imBW5cHK.mjs} +1 -1
  355. package/dist/{portable-text-DhKbDAGr.mjs.map → portable-text-imBW5cHK.mjs.map} +1 -1
  356. package/dist/protocol-DjsJHTlK.d.mts +52 -0
  357. package/dist/protocol-DjsJHTlK.d.mts.map +1 -0
  358. package/dist/{query-vgZNwIhh.mjs → query-BWs7O5Il.mjs} +3 -3
  359. package/dist/{query-vgZNwIhh.mjs.map → query-BWs7O5Il.mjs.map} +1 -1
  360. package/dist/{query-BgjfiLUQ.mjs → query-zTVAR1Sl.mjs} +12 -12
  361. package/dist/{query-BgjfiLUQ.mjs.map → query-zTVAR1Sl.mjs.map} +1 -1
  362. package/dist/{rate-limit-L5anykgo.mjs → rate-limit-Bx4g9m3p.mjs} +1 -1
  363. package/dist/{rate-limit-L5anykgo.mjs.map → rate-limit-Bx4g9m3p.mjs.map} +1 -1
  364. package/dist/{redirect-KBNE3UEs.mjs → redirect-BgAOGHDq.mjs} +1 -1
  365. package/dist/{redirect-KBNE3UEs.mjs.map → redirect-BgAOGHDq.mjs.map} +1 -1
  366. package/dist/{redirects-cV9g7V-0.mjs → redirects-DTDHWH31.mjs} +2 -2
  367. package/dist/{redirects-cV9g7V-0.mjs.map → redirects-DTDHWH31.mjs.map} +1 -1
  368. package/dist/{redirects-CufRQt0Q.mjs → redirects-DyChwDkG.mjs} +1 -1
  369. package/dist/{redirects-CufRQt0Q.mjs.map → redirects-DyChwDkG.mjs.map} +1 -1
  370. package/dist/{registry-C581V4TP.mjs → registry-Cqa2I749.mjs} +6 -6
  371. package/dist/{registry-C581V4TP.mjs.map → registry-Cqa2I749.mjs.map} +1 -1
  372. package/dist/{relation-DtmAQH7s.mjs → relation-BnHB0T4J.mjs} +2 -2
  373. package/dist/{relation-DtmAQH7s.mjs.map → relation-BnHB0T4J.mjs.map} +1 -1
  374. package/dist/{relations-DItI3MN9.d.mts → relations-BHo5A8Zf.d.mts} +35 -35
  375. package/dist/{relations-DItI3MN9.d.mts.map → relations-BHo5A8Zf.d.mts.map} +1 -1
  376. package/dist/{relations-DICSyfsh.mjs → relations-D5sM5fW0.mjs} +4 -4
  377. package/dist/{relations-DICSyfsh.mjs.map → relations-D5sM5fW0.mjs.map} +1 -1
  378. package/dist/request-context.d.mts +1 -1
  379. package/dist/{runner-CgQbELYC.d.mts → runner-BYHZn3Jy.d.mts} +16 -3
  380. package/dist/runner-BYHZn3Jy.d.mts.map +1 -0
  381. package/dist/{runner-BiDvq5dv.mjs → runner-C1T11CfC.mjs} +34 -4
  382. package/dist/{runner-BiDvq5dv.mjs.map → runner-C1T11CfC.mjs.map} +1 -1
  383. package/dist/runtime.d.mts +11 -11
  384. package/dist/runtime.mjs +1 -1
  385. package/dist/{schema-CeQSNwB3.mjs → schema-2AOsSn2v.mjs} +4 -4
  386. package/dist/{schema-CeQSNwB3.mjs.map → schema-2AOsSn2v.mjs.map} +1 -1
  387. package/dist/{schema-BFyTg38T.mjs → schema-DZ5YVVZj.mjs} +3 -3
  388. package/dist/{schema-BFyTg38T.mjs.map → schema-DZ5YVVZj.mjs.map} +1 -1
  389. package/dist/{scopes-BVeuhGBE.mjs → scopes-8ClPF2bC.mjs} +2 -2
  390. package/dist/{scopes-BVeuhGBE.mjs.map → scopes-8ClPF2bC.mjs.map} +1 -1
  391. package/dist/{search-BpuPKZb0.mjs → search-u1QYdOCG.mjs} +4 -4
  392. package/dist/{search-BpuPKZb0.mjs.map → search-u1QYdOCG.mjs.map} +1 -1
  393. package/dist/{secrets-dtYs2hDo.mjs → secrets-BEgsAQEU.mjs} +1 -1
  394. package/dist/{secrets-dtYs2hDo.mjs.map → secrets-BEgsAQEU.mjs.map} +1 -1
  395. package/dist/{sections-COctk6hf.mjs → sections-DmHviGyM.mjs} +2 -2
  396. package/dist/{sections-COctk6hf.mjs.map → sections-DmHviGyM.mjs.map} +1 -1
  397. package/dist/seed/index.d.mts +2 -2
  398. package/dist/seed/index.mjs +13 -13
  399. package/dist/seo/index.d.mts +3 -3
  400. package/dist/seo/index.mjs +9 -9
  401. package/dist/{seo-CvDxfvFb.mjs → seo-Dq4G-RrO.mjs} +2 -2
  402. package/dist/{seo-CvDxfvFb.mjs.map → seo-Dq4G-RrO.mjs.map} +1 -1
  403. package/dist/{service-xMiMSTsR.mjs → service-BpArayPr.mjs} +2 -2
  404. package/dist/{service-xMiMSTsR.mjs.map → service-BpArayPr.mjs.map} +1 -1
  405. package/dist/{session-user-BzVemLkw.mjs → session-user-BEorKVT-.mjs} +1 -1
  406. package/dist/{session-user-BzVemLkw.mjs.map → session-user-BEorKVT-.mjs.map} +1 -1
  407. package/dist/{settings-BE9aqn_9.mjs → settings-DE9xtzqd.mjs} +3 -3
  408. package/dist/{settings-BE9aqn_9.mjs.map → settings-DE9xtzqd.mjs.map} +1 -1
  409. package/dist/{settings-B372MV0p.mjs → settings-xRdoUZr0.mjs} +2 -2
  410. package/dist/{settings-B372MV0p.mjs.map → settings-xRdoUZr0.mjs.map} +1 -1
  411. package/dist/{setup-complete-DF7TAfD5.mjs → setup-complete-BnT8pq_C.mjs} +1 -1
  412. package/dist/{setup-complete-DF7TAfD5.mjs.map → setup-complete-BnT8pq_C.mjs.map} +1 -1
  413. package/dist/{setup-nonce-Do-U_cg9.mjs → setup-nonce-CBitf_oQ.mjs} +1 -1
  414. package/dist/{setup-nonce-Do-U_cg9.mjs.map → setup-nonce-CBitf_oQ.mjs.map} +1 -1
  415. package/dist/{site-url-Bowsi9T-.mjs → site-url-DjpIXMXJ.mjs} +1 -1
  416. package/dist/{site-url-Bowsi9T-.mjs.map → site-url-DjpIXMXJ.mjs.map} +1 -1
  417. package/dist/{snapshot-B5h6aPMh.mjs → snapshot-BBlGkb2q.mjs} +1 -1
  418. package/dist/{snapshot-B5h6aPMh.mjs.map → snapshot-BBlGkb2q.mjs.map} +1 -1
  419. package/dist/storage/local.d.mts +1 -1
  420. package/dist/storage/local.mjs +2 -2
  421. package/dist/storage/s3.d.mts +1 -1
  422. package/dist/target-DixqqV5i.mjs +27 -0
  423. package/dist/target-DixqqV5i.mjs.map +1 -0
  424. package/dist/{taxonomies-B0o9ExNV.mjs → taxonomies-BlrncHi9.mjs} +5 -5
  425. package/dist/{taxonomies-B0o9ExNV.mjs.map → taxonomies-BlrncHi9.mjs.map} +1 -1
  426. package/dist/{taxonomies-Dk3MAklL.mjs → taxonomies-OHUIiIpI.mjs} +4 -4
  427. package/dist/{taxonomies-Dk3MAklL.mjs.map → taxonomies-OHUIiIpI.mjs.map} +1 -1
  428. package/dist/{taxonomy-CPeM8d2o.mjs → taxonomy-BqCZ1TdU.mjs} +3 -3
  429. package/dist/{taxonomy-CPeM8d2o.mjs.map → taxonomy-BqCZ1TdU.mjs.map} +1 -1
  430. package/dist/{transport--CfOflrp.mjs → transport-DBJwa-Si.mjs} +1 -1
  431. package/dist/{transport--CfOflrp.mjs.map → transport-DBJwa-Si.mjs.map} +1 -1
  432. package/dist/{transport-B_rfeU-a.d.mts → transport-RQE36APG.d.mts} +1 -1
  433. package/dist/{transport-B_rfeU-a.d.mts.map → transport-RQE36APG.d.mts.map} +1 -1
  434. package/dist/{types-CFUfyt1s.d.mts → types-BcqdcT-r.d.mts} +1 -1
  435. package/dist/{types-CFUfyt1s.d.mts.map → types-BcqdcT-r.d.mts.map} +1 -1
  436. package/dist/{types-CPx2lIGo.d.mts → types-BntycPTF.d.mts} +1 -1
  437. package/dist/{types-CPx2lIGo.d.mts.map → types-BntycPTF.d.mts.map} +1 -1
  438. package/dist/{types-C3_AbkDP.d.mts → types-C2pMvO62.d.mts} +1 -1
  439. package/dist/{types-C3_AbkDP.d.mts.map → types-C2pMvO62.d.mts.map} +1 -1
  440. package/dist/{types-DefV3OiO.d.mts → types-CXnOzDe1.d.mts} +1 -1
  441. package/dist/{types-DefV3OiO.d.mts.map → types-CXnOzDe1.d.mts.map} +1 -1
  442. package/dist/{types-D4_1Ga4L.d.mts → types-DN64_zzZ.d.mts} +3 -3
  443. package/dist/{types-D4_1Ga4L.d.mts.map → types-DN64_zzZ.d.mts.map} +1 -1
  444. package/dist/{types-CAGdePf3.d.mts → types-DQIDRKF2.d.mts} +1 -1
  445. package/dist/{types-CAGdePf3.d.mts.map → types-DQIDRKF2.d.mts.map} +1 -1
  446. package/dist/{types-BPuloofb.d.mts → types-DWRhk9xZ.d.mts} +1 -1
  447. package/dist/{types-BPuloofb.d.mts.map → types-DWRhk9xZ.d.mts.map} +1 -1
  448. package/dist/{types-X0MThr7x.d.mts → types-Dfk8KI5R.d.mts} +1 -1
  449. package/dist/{types-X0MThr7x.d.mts.map → types-Dfk8KI5R.d.mts.map} +1 -1
  450. package/dist/{types-Cs-TFLNf.d.mts → types-DrJrVCT1.d.mts} +3 -3
  451. package/dist/{types-Cs-TFLNf.d.mts.map → types-DrJrVCT1.d.mts.map} +1 -1
  452. package/dist/{upload-attempts-hlne3iA1.mjs → upload-attempts-D4FS8LT6.mjs} +1 -1
  453. package/dist/{upload-attempts-hlne3iA1.mjs.map → upload-attempts-D4FS8LT6.mjs.map} +1 -1
  454. package/dist/{user-sHgJ62SP.mjs → user-DJZfUJVE.mjs} +2 -2
  455. package/dist/{user-sHgJ62SP.mjs.map → user-DJZfUJVE.mjs.map} +1 -1
  456. package/dist/{validate-BkqIG_Uj.mjs → validate-BMLBvxOC.mjs} +2 -2
  457. package/dist/{validate-BkqIG_Uj.mjs.map → validate-BMLBvxOC.mjs.map} +1 -1
  458. package/dist/{validate-DeGtBN84.d.mts → validate-CTqt5nuE.d.mts} +5 -5
  459. package/dist/{validate-DeGtBN84.d.mts.map → validate-CTqt5nuE.d.mts.map} +1 -1
  460. package/dist/{validation-CiJb_X5o.mjs → validation-npvENUCB.mjs} +7 -7
  461. package/dist/{validation-CiJb_X5o.mjs.map → validation-npvENUCB.mjs.map} +1 -1
  462. package/dist/version-DB_fqCSI.mjs +7 -0
  463. package/dist/{version-x0NjTScG.mjs.map → version-DB_fqCSI.mjs.map} +1 -1
  464. package/dist/{widgets-Cwzvww0W.mjs → widgets-BD3ho7Rq.mjs} +2 -2
  465. package/dist/{widgets-Cwzvww0W.mjs.map → widgets-BD3ho7Rq.mjs.map} +1 -1
  466. package/dist/{wxr-taxonomies-QZjWxjyk.mjs → wxr-taxonomies-B1R3vBoD.mjs} +3 -3
  467. package/dist/{wxr-taxonomies-QZjWxjyk.mjs.map → wxr-taxonomies-B1R3vBoD.mjs.map} +1 -1
  468. package/dist/{wxr-taxonomies-CmC0ZsDr.d.mts → wxr-taxonomies-Ca68766D.d.mts} +1 -1
  469. package/dist/{wxr-taxonomies-CmC0ZsDr.d.mts.map → wxr-taxonomies-Ca68766D.d.mts.map} +1 -1
  470. package/dist/{zod-generator-D11MhxG4.mjs → zod-generator-LC-on_Vb.mjs} +2 -2
  471. package/dist/{zod-generator-D11MhxG4.mjs.map → zod-generator-LC-on_Vb.mjs.map} +1 -1
  472. package/package.json +21 -5
  473. package/src/astro/integration/index.ts +46 -14
  474. package/src/astro/integration/runtime.ts +3 -0
  475. package/src/astro/middleware/scoped-db.ts +21 -0
  476. package/src/astro/middleware.ts +67 -10
  477. package/src/astro/routes/api/auth/dev-bypass.ts +0 -4
  478. package/src/astro/routes/api/setup/dev-bypass.ts +2 -7
  479. package/src/astro/routes/api/setup/index.ts +5 -13
  480. package/src/cli/commands/migrate.ts +593 -0
  481. package/src/cli/index.ts +2 -23
  482. package/src/database/index.ts +8 -2
  483. package/src/database/migrations/policy.ts +70 -0
  484. package/src/database/migrations/runner.ts +49 -3
  485. package/src/db/adapters.ts +50 -2
  486. package/src/db/index.ts +3 -1
  487. package/src/db/libsql-migrations.ts +72 -0
  488. package/src/db/postgres-migrations.ts +59 -0
  489. package/src/db/sqlite-migrations.ts +37 -0
  490. package/src/emdash-runtime.ts +44 -15
  491. package/src/i18n/normalize.ts +31 -0
  492. package/src/index.ts +7 -1
  493. package/src/migrations/config-loader.ts +205 -0
  494. package/src/migrations/direct-executor.ts +141 -0
  495. package/src/migrations/identity.ts +46 -0
  496. package/src/migrations/index.ts +19 -0
  497. package/src/migrations/integration-metadata.ts +67 -0
  498. package/src/migrations/manifest-builder.ts +55 -0
  499. package/src/migrations/manifest-writer.ts +63 -0
  500. package/src/migrations/manifest.ts +197 -0
  501. package/src/migrations/protocol.ts +59 -0
  502. package/src/migrations/target.ts +35 -0
  503. package/src/virtual-modules.d.ts +8 -0
  504. package/dist/adapters-34EN2eXO.d.mts.map +0 -1
  505. package/dist/index-C3Y-rsyN.d.mts.map +0 -1
  506. package/dist/runner-CgQbELYC.d.mts.map +0 -1
  507. package/dist/version-x0NjTScG.mjs +0 -7
  508. /package/dist/{api-tokens-CyTsLszZ.mjs → api-tokens-rIXC6LdE.mjs} +0 -0
@@ -1,57 +1,62 @@
1
1
  #!/usr/bin/env node
2
- import { a as runMigrations, o as __exportAll, r as getMigrationStatus } from "../runner-BiDvq5dv.mjs";
2
+ import { a as getMigrationStatus, c as __exportAll, s as runMigrations } from "../runner-C1T11CfC.mjs";
3
3
  import { t as EmDashDatabaseError } from "../errors-9P_FDrJ_.mjs";
4
4
  import { t as validateIdentifier } from "../validate-BpwoDOgt.mjs";
5
5
  import { u as listTablesLike } from "../dialect-helpers-BSbfaO3F.mjs";
6
6
  import { i as isI18nEnabled, r as getI18nConfig } from "../config-C3EBstHi.mjs";
7
7
  import "../after-CBU2vkoO.mjs";
8
8
  import "../object-cache-71tPfV4A.mjs";
9
- import { t as ContentRepository } from "../content-BNfwh7xX.mjs";
9
+ import { t as ContentRepository } from "../content-ZHCc1ngN.mjs";
10
10
  import { n as isMissingTableError } from "../db-errors-Cl-sKYTm.mjs";
11
11
  import { n as slugify } from "../slugify-B994zkXC.mjs";
12
12
  import { a as encodeBase64url } from "../base64-CvLhUKQv.mjs";
13
13
  import "../types-CQPWhPxE.mjs";
14
14
  import { t as MediaRepository } from "../media-CzhAn2--.mjs";
15
- import { t as TaxonomyRepository } from "../taxonomy-CPeM8d2o.mjs";
15
+ import { t as TaxonomyRepository } from "../taxonomy-BqCZ1TdU.mjs";
16
16
  import { t as OptionsRepository } from "../options-CBXIHUoT.mjs";
17
17
  import "../redirect-COsS6SWJ.mjs";
18
18
  import "../request-cache-BSUptuJR.mjs";
19
19
  import "../byline-registry-DDun8sxh.mjs";
20
- import "../field-defs-cache-hg6QkjV9.mjs";
21
- import { t as BylineRepository } from "../byline-pEcoDps8.mjs";
20
+ import "../field-defs-cache-BzwBlJrR.mjs";
21
+ import { t as BylineRepository } from "../byline-yjvWq4ip.mjs";
22
22
  import "../dist-D_6CKR8z.mjs";
23
- import "../fts-manager-CZ-5dVwJ.mjs";
23
+ import "../fts-manager-DyZEohZC.mjs";
24
24
  import { kyselyLogOption } from "../database/instrumentation.mjs";
25
- import "../loader-DLBqRiGP.mjs";
26
- import "../content-refresh-DNERP4-f.mjs";
27
- import "../collection-deletion-C8BugSGz.mjs";
28
- import { n as SchemaRegistry } from "../registry-C581V4TP.mjs";
29
- import "../settings-B372MV0p.mjs";
25
+ import "../loader-CdG_Ci3H.mjs";
26
+ import "../content-refresh-B_8SJzuU.mjs";
27
+ import "../collection-deletion-DQPvMD8R.mjs";
28
+ import { n as SchemaRegistry } from "../registry-Cqa2I749.mjs";
29
+ import "../settings-xRdoUZr0.mjs";
30
30
  import { i as pluginManifestSchema } from "../manifest-schema-BXbUAHod.mjs";
31
31
  import { i as isDeprecatedCapability, t as CAPABILITY_RENAMES } from "../types-CP1CflWf.mjs";
32
32
  import "../ssrf-Cpvg_n3A.mjs";
33
33
  import "../ssrf-DpXgKsna.mjs";
34
- import { t as validateSeed } from "../validate-BkqIG_Uj.mjs";
35
- import { t as applySeed } from "../apply-D5zfeD09.mjs";
36
- import { n as fingerprintKey, r as generateEncryptionKey, t as EmDashSecretsError } from "../secrets-dtYs2hDo.mjs";
34
+ import { t as validateSeed } from "../validate-BMLBvxOC.mjs";
35
+ import { t as applySeed } from "../apply-kUDt80-G.mjs";
36
+ import { a as MigrationManifestValidationError, c as normalizeAstroI18n, i as getMigrationIntegrationMetadata, n as MIGRATION_CONFIG_SYMBOL, s as validateMigrationManifest, t as buildMigrationManifest } from "../manifest-builder-B252yQUf.mjs";
37
+ import "../identity-Ys6Dlc9C.mjs";
38
+ import { n as fingerprintKey, r as generateEncryptionKey, t as EmDashSecretsError } from "../secrets-BEgsAQEU.mjs";
37
39
  import { LocalStorage } from "../storage/local.mjs";
38
- import { t as convertDataForRead } from "../portable-text-DhKbDAGr.mjs";
40
+ import { t as convertDataForRead } from "../portable-text-imBW5cHK.mjs";
39
41
  import { createHeaderAwareFetch, customHeadersInterceptor, getCachedAccessToken, isAccessRedirect, resolveCustomHeaders, runCloudflaredLogin } from "../client/cf-access.mjs";
40
42
  import { EmDashClient } from "../client/index.mjs";
41
- import { r as fileExists$4, t as bundleCommand } from "../bundle-CBEXrBnb.mjs";
43
+ import { r as fileExists$4, t as bundleCommand } from "../bundle-vn56sLos.mjs";
44
+ import { createRequire } from "node:module";
42
45
  import { Kysely, SqliteDialect, sql } from "kysely";
43
46
  import { createGzipDecoder, unpackTar } from "modern-tar";
47
+ import { pathToFileURL } from "node:url";
48
+ import { access, mkdir, readFile, stat, writeFile } from "node:fs/promises";
49
+ import { basename, dirname, isAbsolute, join, parse, resolve } from "node:path";
44
50
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
45
- import { basename, dirname, join, resolve } from "node:path";
46
51
  import BetterSqlite3 from "better-sqlite3";
47
- import { access, mkdir, readFile, stat, writeFile } from "node:fs/promises";
48
52
  import { defineCommand, runCommand, runMain } from "citty";
49
53
  import consola, { consola as consola$1 } from "consola";
50
54
  import pc from "picocolors";
51
55
  import { spawn } from "node:child_process";
52
56
  import { homedir } from "node:os";
53
- import { parse, printParseErrorCode } from "jsonc-parser";
54
- import { parse as parse$1 } from "smol-toml";
57
+ import { parse as parse$1, printParseErrorCode } from "jsonc-parser";
58
+ import { parse as parse$2 } from "smol-toml";
59
+ import { createInterface } from "node:readline/promises";
55
60
 
56
61
  //#region src/cli/commands/auth.ts
57
62
  /**
@@ -130,7 +135,7 @@ function resolveCredentialKey(baseUrl) {
130
135
  try {
131
136
  const url = new URL(baseUrl);
132
137
  if (url.hostname === "localhost" || url.hostname === "127.0.0.1" || url.hostname === "[::1]") {
133
- const projectPath = findProjectRoot(process.cwd());
138
+ const projectPath = findProjectRoot$1(process.cwd());
134
139
  if (projectPath) return `path:${projectPath}`;
135
140
  return url.origin;
136
141
  }
@@ -142,7 +147,7 @@ function resolveCredentialKey(baseUrl) {
142
147
  /**
143
148
  * Walk up from cwd to find the project root (directory containing astro.config.*).
144
149
  */
145
- function findProjectRoot(from) {
150
+ function findProjectRoot$1(from) {
146
151
  let dir = resolve(from);
147
152
  const root = resolve("/");
148
153
  while (dir !== root) {
@@ -1080,7 +1085,7 @@ async function fileExists$2(path) {
1080
1085
  return false;
1081
1086
  }
1082
1087
  }
1083
- function isRecord(value) {
1088
+ function isRecord$2(value) {
1084
1089
  return typeof value === "object" && value !== null && !Array.isArray(value);
1085
1090
  }
1086
1091
  function sourcePosition(source, offset) {
@@ -1107,7 +1112,7 @@ async function checkSchedulerWiringAtPath(cwd, configPath) {
1107
1112
  const configSource = await readFile(configPath, "utf8");
1108
1113
  let parsed;
1109
1114
  if (configPath.endsWith(".toml")) try {
1110
- parsed = parse$1(configSource);
1115
+ parsed = parse$2(configSource);
1111
1116
  } catch (error) {
1112
1117
  return [{
1113
1118
  name: "scheduler config",
@@ -1117,7 +1122,7 @@ async function checkSchedulerWiringAtPath(cwd, configPath) {
1117
1122
  }
1118
1123
  else {
1119
1124
  const parseErrors = [];
1120
- parsed = parse(configSource, parseErrors, {
1125
+ parsed = parse$1(configSource, parseErrors, {
1121
1126
  allowTrailingComma: true,
1122
1127
  disallowComments: false
1123
1128
  });
@@ -1131,12 +1136,12 @@ async function checkSchedulerWiringAtPath(cwd, configPath) {
1131
1136
  }];
1132
1137
  }
1133
1138
  }
1134
- if (!isRecord(parsed)) return [{
1139
+ if (!isRecord$2(parsed)) return [{
1135
1140
  name: "scheduler config",
1136
1141
  status: "fail",
1137
1142
  message: `could not parse ${configPath}: expected an object — fix the Wrangler configuration syntax`
1138
1143
  }];
1139
- const triggers = isRecord(parsed.triggers) ? parsed.triggers : null;
1144
+ const triggers = isRecord$2(parsed.triggers) ? parsed.triggers : null;
1140
1145
  const hasCronTrigger = Array.isArray(triggers?.crons) && triggers.crons.some((cron) => typeof cron === "string" && cron.trim().length > 0);
1141
1146
  const main = typeof parsed.main === "string" && parsed.main.trim() ? parsed.main : null;
1142
1147
  if (!main) return [{
@@ -1149,7 +1154,7 @@ async function checkSchedulerWiringAtPath(cwd, configPath) {
1149
1154
  try {
1150
1155
  hasScheduledHandler = workerExportsScheduledMaintenance(await readFile(workerPath, "utf8"));
1151
1156
  } catch (error) {
1152
- if ((isRecord(error) && typeof error.code === "string" ? error.code : null) !== "ENOENT") return [{
1157
+ if ((isRecord$2(error) && typeof error.code === "string" ? error.code : null) !== "ENOENT") return [{
1153
1158
  name: "scheduler handler",
1154
1159
  status: "fail",
1155
1160
  message: `could not read Worker entry ${workerPath}: ${error instanceof Error ? error.message : "unknown I/O error"} — check the file path and permissions`
@@ -2599,6 +2604,522 @@ const menuCommand = defineCommand({
2599
2604
  }
2600
2605
  });
2601
2606
 
2607
+ //#endregion
2608
+ //#region src/migrations/config-loader.ts
2609
+ const ASTRO_CONFIG_FILENAMES = [
2610
+ "astro.config.mjs",
2611
+ "astro.config.js",
2612
+ "astro.config.ts",
2613
+ "astro.config.mts"
2614
+ ];
2615
+ var MigrationConfigLoaderError = class extends Error {
2616
+ constructor(message, options) {
2617
+ super(message, options);
2618
+ this.name = "MigrationConfigLoaderError";
2619
+ }
2620
+ };
2621
+ async function isAccessible(path) {
2622
+ try {
2623
+ await access(path);
2624
+ return true;
2625
+ } catch {
2626
+ return false;
2627
+ }
2628
+ }
2629
+ async function findAstroConfigFile(projectRoot, configFile) {
2630
+ const root = resolve(projectRoot);
2631
+ if (configFile) {
2632
+ const explicitPath = isAbsolute(configFile) ? configFile : resolve(root, configFile);
2633
+ if (await isAccessible(explicitPath)) return explicitPath;
2634
+ throw new MigrationConfigLoaderError(`Astro config file not found: ${explicitPath}`);
2635
+ }
2636
+ for (const filename of ASTRO_CONFIG_FILENAMES) {
2637
+ const candidate = resolve(root, filename);
2638
+ if (await isAccessible(candidate)) return candidate;
2639
+ }
2640
+ throw new MigrationConfigLoaderError(`No Astro config file found in ${root}`);
2641
+ }
2642
+ function projectRequire(projectRoot) {
2643
+ return createRequire(resolve(projectRoot, "package.json"));
2644
+ }
2645
+ async function importModule(path) {
2646
+ return import(pathToFileURL(path).href);
2647
+ }
2648
+ function isRecord$1(value) {
2649
+ return typeof value === "object" && value !== null;
2650
+ }
2651
+ function moduleExport$1(module, name) {
2652
+ if (!isRecord$1(module)) return void 0;
2653
+ const direct = module[name];
2654
+ if (direct !== void 0) return direct;
2655
+ const defaultExport = module.default;
2656
+ return isRecord$1(defaultExport) ? defaultExport[name] : void 0;
2657
+ }
2658
+ function isCoreMigrationIdentity(value) {
2659
+ return isRecord$1(value) && typeof value.emdashVersion === "string" && Array.isArray(value.names) && value.names.every((name) => typeof name === "string") && typeof value.fingerprint === "string";
2660
+ }
2661
+ async function loadProjectConfig(projectRoot, configFile) {
2662
+ let viteEntrypoint;
2663
+ try {
2664
+ viteEntrypoint = createRequire(projectRequire(projectRoot).resolve("astro")).resolve("vite");
2665
+ } catch (error) {
2666
+ throw new MigrationConfigLoaderError("Could not resolve Vite through the project's Astro installation", { cause: error });
2667
+ }
2668
+ const loadConfigFromFile = moduleExport$1(await importModule(viteEntrypoint), "loadConfigFromFile");
2669
+ if (typeof loadConfigFromFile !== "function") throw new MigrationConfigLoaderError("The Vite installation used by project-local Astro does not export loadConfigFromFile");
2670
+ const loaded = await Reflect.apply(loadConfigFromFile, void 0, [
2671
+ {
2672
+ command: "build",
2673
+ mode: "production"
2674
+ },
2675
+ configFile,
2676
+ projectRoot,
2677
+ "silent"
2678
+ ]);
2679
+ if (!isRecord$1(loaded) || !Object.hasOwn(loaded, "config")) throw new MigrationConfigLoaderError(`Vite could not load Astro config: ${configFile}`);
2680
+ return loaded.config;
2681
+ }
2682
+ async function loadProjectIdentity(projectRoot) {
2683
+ let identityEntrypoint;
2684
+ try {
2685
+ identityEntrypoint = projectRequire(projectRoot).resolve("emdash/migrations");
2686
+ } catch (error) {
2687
+ throw new MigrationConfigLoaderError("Could not resolve emdash/migrations from the project", { cause: error });
2688
+ }
2689
+ const getIdentity = moduleExport$1(await importModule(identityEntrypoint), "getCoreMigrationIdentity");
2690
+ if (typeof getIdentity !== "function") throw new MigrationConfigLoaderError("The project-local emdash/migrations module does not export getCoreMigrationIdentity");
2691
+ const identity = await Reflect.apply(getIdentity, void 0, []);
2692
+ if (!isCoreMigrationIdentity(identity)) throw new MigrationConfigLoaderError("The project-local emdash/migrations module returned an invalid migration identity");
2693
+ return identity;
2694
+ }
2695
+ const defaultDependencies$1 = {
2696
+ findConfigFile: findAstroConfigFile,
2697
+ loadConfig: loadProjectConfig,
2698
+ loadIdentity: loadProjectIdentity
2699
+ };
2700
+ function asAstroConfig(value) {
2701
+ if (typeof value !== "object" || value === null) throw new MigrationConfigLoaderError("Astro config must export an object");
2702
+ return value;
2703
+ }
2704
+ async function buildMigrationManifestFromConfig(options, dependencies = defaultDependencies$1) {
2705
+ const projectRoot = resolve(options.projectRoot);
2706
+ const configFile = await dependencies.findConfigFile(projectRoot, options.configFile);
2707
+ const config = asAstroConfig(await dependencies.loadConfig(projectRoot, configFile));
2708
+ const matchingIntegrations = (Array.isArray(config.integrations) ? config.integrations : []).filter((integration) => getMigrationIntegrationMetadata(integration) !== void 0);
2709
+ if (matchingIntegrations.length !== 1) throw new MigrationConfigLoaderError(`Expected exactly one EmDash integration with migration metadata (${String(MIGRATION_CONFIG_SYMBOL)}), found ${matchingIntegrations.length}`);
2710
+ const metadata = getMigrationIntegrationMetadata(matchingIntegrations[0]);
2711
+ if (!metadata?.database) throw new MigrationConfigLoaderError("The EmDash integration does not provide database migration metadata");
2712
+ return buildMigrationManifest({
2713
+ identity: await dependencies.loadIdentity(projectRoot),
2714
+ i18n: normalizeAstroI18n(config.i18n),
2715
+ database: metadata.database
2716
+ });
2717
+ }
2718
+
2719
+ //#endregion
2720
+ //#region src/cli/commands/migrate.ts
2721
+ const FINGERPRINT_PATTERN = /^[0-9a-f]{64}$/;
2722
+ const SAFE_TARGET_KIND_PATTERN = /^[a-z][a-z0-9_-]*$/;
2723
+ const SAFE_MIGRATION_NAME_PATTERN = /^[A-Za-z0-9_.-]+$/;
2724
+ const CREDENTIAL_URL_PATTERN = /:\/\/[^/\s]+@/;
2725
+ const CREDENTIAL_QUERY_PATTERN = /[?&](?:auth|credential|key|password|secret|signature|token)=/i;
2726
+ const MIGRATE_EXIT_CODES = Object.freeze({
2727
+ success: 0,
2728
+ error: 1,
2729
+ pending: 2,
2730
+ unknownApplied: 3,
2731
+ confirmation: 4,
2732
+ interrupted: 130
2733
+ });
2734
+ var MigrateCommandError = class extends Error {
2735
+ constructor(message) {
2736
+ super(message);
2737
+ this.name = "MigrateCommandError";
2738
+ }
2739
+ };
2740
+ function isRecord(value) {
2741
+ return typeof value === "object" && value !== null && !Array.isArray(value);
2742
+ }
2743
+ function moduleExport(module, name) {
2744
+ if (!isRecord(module)) return void 0;
2745
+ const direct = Reflect.get(module, name);
2746
+ if (direct !== void 0) return direct;
2747
+ const defaultExport = Reflect.get(module, "default");
2748
+ return isRecord(defaultExport) ? Reflect.get(defaultExport, name) : void 0;
2749
+ }
2750
+ async function importProjectModule(projectRoot, specifier) {
2751
+ let resolvedEntrypoint;
2752
+ try {
2753
+ resolvedEntrypoint = createRequire(resolve(projectRoot, "package.json")).resolve(specifier);
2754
+ } catch {
2755
+ throw new MigrateCommandError(`Could not resolve ${specifier} from the project.`);
2756
+ }
2757
+ return import(pathToFileURL(resolvedEntrypoint).href);
2758
+ }
2759
+ function validateIdentity(value) {
2760
+ if (!isRecord(value) || typeof value.emdashVersion !== "string" || !Array.isArray(value.names) || !value.names.every((name) => typeof name === "string") || typeof value.fingerprint !== "string" || !FINGERPRINT_PATTERN.test(value.fingerprint)) throw new MigrateCommandError("The project-local emdash/migrations module returned an invalid migration identity.");
2761
+ return {
2762
+ emdashVersion: value.emdashVersion,
2763
+ names: [...value.names],
2764
+ fingerprint: value.fingerprint
2765
+ };
2766
+ }
2767
+ async function loadProjectMigrationIdentity(projectRoot) {
2768
+ const getIdentity = moduleExport(await importProjectModule(projectRoot, "emdash/migrations"), "getCoreMigrationIdentity");
2769
+ if (typeof getIdentity !== "function") throw new MigrateCommandError("The project-local emdash/migrations module does not export getCoreMigrationIdentity.");
2770
+ return validateIdentity(await Reflect.apply(getIdentity, void 0, []));
2771
+ }
2772
+ async function loadProjectMigrationExecutor(projectRoot, entrypoint) {
2773
+ const factory = moduleExport(await importProjectModule(projectRoot, entrypoint), "createMigrationExecutor");
2774
+ if (typeof factory !== "function") throw new MigrateCommandError(`The project-local ${entrypoint} module does not export createMigrationExecutor.`);
2775
+ return (manifestConfig, context) => Reflect.apply(factory, void 0, [manifestConfig, context]);
2776
+ }
2777
+ async function findProjectRoot(start) {
2778
+ let current = resolve(start);
2779
+ const filesystemRoot = parse(current).root;
2780
+ for (;;) {
2781
+ try {
2782
+ await readFile(resolve(current, "package.json"), "utf8");
2783
+ return current;
2784
+ } catch (error) {
2785
+ if (isRecord(error) && error.code !== "ENOENT" && error.code !== "ENOTDIR") throw new MigrateCommandError("Could not read the project package.json.");
2786
+ }
2787
+ if (current === filesystemRoot) break;
2788
+ current = dirname(current);
2789
+ }
2790
+ throw new MigrateCommandError("Could not find a project root containing package.json.");
2791
+ }
2792
+ async function readMigrationManifestFile(path, isDefault) {
2793
+ let source;
2794
+ try {
2795
+ source = await readFile(path, "utf8");
2796
+ } catch (error) {
2797
+ if (isDefault && isRecord(error) && (error.code === "ENOENT" || error.code === "ENOTDIR")) throw new MigrateCommandError(`No migration manifest found at ${path}. Build the project or use --from-config.`);
2798
+ throw new MigrateCommandError(`Could not read migration manifest: ${path}`);
2799
+ }
2800
+ try {
2801
+ return JSON.parse(source);
2802
+ } catch {
2803
+ throw new MigrateCommandError(`Migration manifest is not valid JSON: ${path}`);
2804
+ }
2805
+ }
2806
+ async function confirmWithReadline(message) {
2807
+ const prompt = createInterface({
2808
+ input: process.stdin,
2809
+ output: process.stderr
2810
+ });
2811
+ try {
2812
+ const answer = await prompt.question(`${message} [y/N] `);
2813
+ return answer.trim().toLowerCase() === "y" || answer.trim().toLowerCase() === "yes";
2814
+ } finally {
2815
+ prompt.close();
2816
+ }
2817
+ }
2818
+ function onProcessSignal(signal, handler) {
2819
+ const listener = () => {
2820
+ handler().finally(() => process.exit(MIGRATE_EXIT_CODES.interrupted));
2821
+ };
2822
+ process.once(signal, listener);
2823
+ return () => process.removeListener(signal, listener);
2824
+ }
2825
+ const defaultDependencies = {
2826
+ cwd: process.cwd(),
2827
+ env: process.env,
2828
+ interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY),
2829
+ findProjectRoot,
2830
+ readManifest: readMigrationManifestFile,
2831
+ buildManifestFromConfig: (projectRoot, configFile) => buildMigrationManifestFromConfig({
2832
+ projectRoot,
2833
+ configFile
2834
+ }),
2835
+ loadProjectIdentity: loadProjectMigrationIdentity,
2836
+ loadProjectExecutor: loadProjectMigrationExecutor,
2837
+ confirm: confirmWithReadline,
2838
+ writeStdout: (value) => process.stdout.write(`${value}\n`),
2839
+ writeStderr: (value) => process.stderr.write(`${value}\n`),
2840
+ onSignal: onProcessSignal,
2841
+ cleanupTimeoutMs: 2e3
2842
+ };
2843
+ function validateOptions(options) {
2844
+ if (options.manifest && options.fromConfig) throw new MigrateCommandError("--manifest and --from-config cannot be used together.");
2845
+ if (options.config && !options.fromConfig) throw new MigrateCommandError("--config requires --from-config.");
2846
+ if (options.check && options.status) throw new MigrateCommandError("--check and --status cannot be used together.");
2847
+ if (options.expectedTargetFingerprint && !FINGERPRINT_PATTERN.test(options.expectedTargetFingerprint)) throw new MigrateCommandError("--expected-target-fingerprint must be a SHA-256 fingerprint.");
2848
+ }
2849
+ function hasControlCharacter(value) {
2850
+ for (let index = 0; index < value.length; index++) {
2851
+ const code = value.charCodeAt(index);
2852
+ if (code <= 31 || code === 127) return true;
2853
+ }
2854
+ return false;
2855
+ }
2856
+ function targetField(value, name) {
2857
+ if (value === void 0) return void 0;
2858
+ if (typeof value !== "string" || value.length === 0 || hasControlCharacter(value) || CREDENTIAL_URL_PATTERN.test(value) || CREDENTIAL_QUERY_PATTERN.test(value)) throw new MigrateCommandError(`The executor returned an unsafe migration target ${name}.`);
2859
+ return value;
2860
+ }
2861
+ function immutableTarget(value) {
2862
+ if (!isRecord(value)) throw new MigrateCommandError("The executor returned an invalid migration target.");
2863
+ const kind = targetField(value.kind, "kind");
2864
+ const label = targetField(value.label, "label");
2865
+ const fingerprint = targetField(value.fingerprint, "fingerprint");
2866
+ if (!kind || !SAFE_TARGET_KIND_PATTERN.test(kind) || !label || !fingerprint || !FINGERPRINT_PATTERN.test(fingerprint)) throw new MigrateCommandError("The executor returned an invalid migration target.");
2867
+ const target = {
2868
+ kind,
2869
+ label,
2870
+ fingerprint
2871
+ };
2872
+ const accountId = targetField(value.accountId, "accountId");
2873
+ const environment = targetField(value.environment, "environment");
2874
+ const resourceId = targetField(value.resourceId, "resourceId");
2875
+ if (accountId) target.accountId = accountId;
2876
+ if (environment) target.environment = environment;
2877
+ if (resourceId) target.resourceId = resourceId;
2878
+ return Object.freeze(target);
2879
+ }
2880
+ function safeMigrationNames(value, field) {
2881
+ if (!Array.isArray(value) || !value.every((name) => typeof name === "string" && SAFE_MIGRATION_NAME_PATTERN.test(name))) throw new MigrateCommandError(`The migration executor returned an invalid ${field} report.`);
2882
+ return [...value];
2883
+ }
2884
+ function safeReport(value, target) {
2885
+ if (!isRecord(value)) throw new MigrateCommandError("The migration executor returned an invalid report.");
2886
+ const reportTarget = immutableTarget(value.target);
2887
+ if (reportTarget.kind !== target.kind || reportTarget.label !== target.label || reportTarget.fingerprint !== target.fingerprint || reportTarget.accountId !== target.accountId || reportTarget.environment !== target.environment || reportTarget.resourceId !== target.resourceId) throw new MigrateCommandError("The migration executor report target does not match the confirmed target.");
2888
+ return {
2889
+ target: { ...reportTarget },
2890
+ knownApplied: safeMigrationNames(value.knownApplied, "knownApplied"),
2891
+ pending: safeMigrationNames(value.pending, "pending"),
2892
+ unknownApplied: safeMigrationNames(value.unknownApplied, "unknownApplied"),
2893
+ executed: safeMigrationNames(value.executed, "executed")
2894
+ };
2895
+ }
2896
+ function printTarget(target, write) {
2897
+ write(`Migration target: ${target.kind} ${target.label}`);
2898
+ if (target.accountId) write(`Account: ${target.accountId}`);
2899
+ if (target.environment) write(`Environment: ${target.environment}`);
2900
+ if (target.resourceId) write(`Resource: ${target.resourceId}`);
2901
+ write(`Target fingerprint: ${target.fingerprint}`);
2902
+ }
2903
+ function printNameSet(label, names, write) {
2904
+ write(`${label}: ${names.length === 0 ? "none" : names.join(", ")}`);
2905
+ }
2906
+ function printHumanReport(report, write) {
2907
+ printNameSet("Known applied", report.knownApplied, write);
2908
+ printNameSet("Pending", report.pending, write);
2909
+ printNameSet("Unknown applied", report.unknownApplied, write);
2910
+ printNameSet("Executed", report.executed, write);
2911
+ }
2912
+ function reportExitCode(options, report) {
2913
+ if (!options.check) return MIGRATE_EXIT_CODES.success;
2914
+ if (report.unknownApplied.length > 0) return MIGRATE_EXIT_CODES.unknownApplied;
2915
+ if (report.pending.length > 0) return MIGRATE_EXIT_CODES.pending;
2916
+ return MIGRATE_EXIT_CODES.success;
2917
+ }
2918
+ function createOverrides(options) {
2919
+ return {
2920
+ database: options.database,
2921
+ databaseUrlEnv: options.databaseUrlEnv,
2922
+ d1: options.d1,
2923
+ accountId: options.accountId,
2924
+ wranglerConfig: options.wranglerConfig,
2925
+ wranglerEnv: options.wranglerEnv
2926
+ };
2927
+ }
2928
+ function bounded(operation, timeoutMs) {
2929
+ let timer;
2930
+ const timeout = new Promise((resolveTimeout) => {
2931
+ timer = setTimeout(resolveTimeout, timeoutMs, "timeout");
2932
+ });
2933
+ const completion = operation.then(() => "complete", () => "failed");
2934
+ return Promise.race([completion, timeout]).finally(() => clearTimeout(timer));
2935
+ }
2936
+ async function loadManifest(options, projectRoot, dependencies) {
2937
+ if (options.fromConfig) {
2938
+ dependencies.writeStderr(`Using trusted evaluated Astro configuration${options.config ? `: ${options.config}` : "."}`);
2939
+ return dependencies.buildManifestFromConfig(projectRoot, options.config);
2940
+ }
2941
+ const isDefault = !options.manifest;
2942
+ const path = options.manifest ? isAbsolute(options.manifest) ? options.manifest : resolve(projectRoot, options.manifest) : resolve(projectRoot, ".emdash/migrations.json");
2943
+ return dependencies.readManifest(path, isDefault);
2944
+ }
2945
+ function redactExecutorMessage(message, env) {
2946
+ let redacted = message.replace(/[A-Za-z][A-Za-z0-9+.-]*:\/\/\S+/g, "[REDACTED_URL]").replace(/\b(auth|credential|key|password|secret|signature|token)\s*[=:]\s*\S+/gi, "$1=[REDACTED]");
2947
+ for (const value of Object.values(env)) if (value && value.length >= 4) redacted = redacted.replaceAll(value, "[REDACTED]");
2948
+ return redacted.replaceAll(/[\r\n\t]/g, " ").slice(0, 1e3);
2949
+ }
2950
+ function safeCommandMessage(error, env) {
2951
+ if (error instanceof MigrateCommandError || error instanceof MigrationManifestValidationError) return error.message;
2952
+ if (error instanceof Error && error.message) return redactExecutorMessage(error.message, env);
2953
+ return "Migration command failed. Check the project configuration, target, and credentials.";
2954
+ }
2955
+ async function runMigrateCommand(options, dependencies = defaultDependencies) {
2956
+ let executor;
2957
+ let disposePromise;
2958
+ let interrupted = false;
2959
+ let primaryFailure = false;
2960
+ let exitCode = MIGRATE_EXIT_CODES.error;
2961
+ const interruptedResult = Symbol("interrupted");
2962
+ let resolveInterruption;
2963
+ const interruption = new Promise((resolveInterrupted) => {
2964
+ resolveInterruption = () => resolveInterrupted(interruptedResult);
2965
+ });
2966
+ const dispose = () => {
2967
+ disposePromise ??= executor?.dispose?.() ?? Promise.resolve();
2968
+ return disposePromise;
2969
+ };
2970
+ const removeSignalHandlers = [];
2971
+ const execute = async () => {
2972
+ try {
2973
+ validateOptions(options);
2974
+ const projectRoot = await dependencies.findProjectRoot(dependencies.cwd);
2975
+ const manifest = await validateMigrationManifest(await loadManifest(options, projectRoot, dependencies), await dependencies.loadProjectIdentity(projectRoot));
2976
+ executor = await (await dependencies.loadProjectExecutor(projectRoot, manifest.database.executorEntrypoint))(manifest.database.executorConfig, {
2977
+ projectRoot,
2978
+ env: dependencies.env,
2979
+ overrides: createOverrides(options)
2980
+ });
2981
+ const target = immutableTarget(executor.target);
2982
+ printTarget(target, dependencies.writeStderr);
2983
+ const onSignal = async () => {
2984
+ interrupted = true;
2985
+ await bounded(dispose(), dependencies.cleanupTimeoutMs);
2986
+ resolveInterruption?.();
2987
+ };
2988
+ removeSignalHandlers.push(dependencies.onSignal("SIGINT", onSignal), dependencies.onSignal("SIGTERM", onSignal));
2989
+ const applying = !options.check && !options.status;
2990
+ if (applying && target.kind === "d1") dependencies.writeStderr("Warning: D1 migration jobs must be serialized externally by Cloudflare account and database UUID; this command does not coordinate concurrent applies.");
2991
+ if (applying) {
2992
+ if (options.expectedTargetFingerprint) {
2993
+ if (options.expectedTargetFingerprint !== target.fingerprint) {
2994
+ dependencies.writeStderr("Expected target fingerprint does not match the target.");
2995
+ exitCode = MIGRATE_EXIT_CODES.confirmation;
2996
+ return exitCode;
2997
+ }
2998
+ } else if (!dependencies.interactive || options.json) {
2999
+ dependencies.writeStderr("Noninteractive apply requires --expected-target-fingerprint with the displayed fingerprint.");
3000
+ exitCode = MIGRATE_EXIT_CODES.confirmation;
3001
+ return exitCode;
3002
+ } else if (!await dependencies.confirm(`Apply EmDash migrations to ${target.label}?`)) {
3003
+ dependencies.writeStderr("Migration cancelled.");
3004
+ exitCode = MIGRATE_EXIT_CODES.confirmation;
3005
+ return exitCode;
3006
+ }
3007
+ }
3008
+ const rawReport = await Promise.race([executor.execute({
3009
+ action: applying ? "apply" : "check",
3010
+ i18n: manifest.i18n,
3011
+ artifact: {
3012
+ emdashVersion: manifest.emdashVersion,
3013
+ migrationSetFingerprint: manifest.migrationSet.fingerprint
3014
+ }
3015
+ }), interruption]);
3016
+ if (rawReport === interruptedResult || interrupted) {
3017
+ exitCode = MIGRATE_EXIT_CODES.interrupted;
3018
+ return exitCode;
3019
+ }
3020
+ const report = safeReport(rawReport, target);
3021
+ if (options.json) dependencies.writeStdout(JSON.stringify(report));
3022
+ else printHumanReport(report, dependencies.writeStdout);
3023
+ exitCode = reportExitCode(options, report);
3024
+ return exitCode;
3025
+ } catch (error) {
3026
+ primaryFailure = true;
3027
+ dependencies.writeStderr(safeCommandMessage(error, dependencies.env));
3028
+ exitCode = interrupted ? MIGRATE_EXIT_CODES.interrupted : MIGRATE_EXIT_CODES.error;
3029
+ return exitCode;
3030
+ }
3031
+ };
3032
+ try {
3033
+ exitCode = await execute();
3034
+ } finally {
3035
+ for (const remove of removeSignalHandlers) remove();
3036
+ if (executor) {
3037
+ if (await bounded(dispose(), dependencies.cleanupTimeoutMs) !== "complete" && !primaryFailure && !interrupted) {
3038
+ dependencies.writeStderr("Migration executor cleanup failed.");
3039
+ exitCode = MIGRATE_EXIT_CODES.error;
3040
+ }
3041
+ }
3042
+ }
3043
+ return exitCode;
3044
+ }
3045
+ const migrateCommand = defineCommand({
3046
+ meta: {
3047
+ name: "migrate",
3048
+ description: "Check or apply deployment-managed EmDash migrations"
3049
+ },
3050
+ args: {
3051
+ manifest: {
3052
+ type: "string",
3053
+ description: "Migration manifest path"
3054
+ },
3055
+ "from-config": {
3056
+ type: "boolean",
3057
+ description: "Build the manifest from Astro config"
3058
+ },
3059
+ config: {
3060
+ type: "string",
3061
+ description: "Astro config path (requires --from-config)"
3062
+ },
3063
+ check: {
3064
+ type: "boolean",
3065
+ description: "Check for pending or unknown migrations"
3066
+ },
3067
+ status: {
3068
+ type: "boolean",
3069
+ description: "Report all migration status sets"
3070
+ },
3071
+ json: {
3072
+ type: "boolean",
3073
+ description: "Print the stable JSON report"
3074
+ },
3075
+ "expected-target-fingerprint": {
3076
+ type: "string",
3077
+ description: "Required target fingerprint for noninteractive apply"
3078
+ },
3079
+ database: {
3080
+ type: "string",
3081
+ description: "Override the SQLite database path"
3082
+ },
3083
+ "database-url-env": {
3084
+ type: "string",
3085
+ description: "Override the database URL environment-variable name"
3086
+ },
3087
+ d1: {
3088
+ type: "string",
3089
+ description: "Override the D1 database UUID or name"
3090
+ },
3091
+ "account-id": {
3092
+ type: "string",
3093
+ description: "Override the Cloudflare account ID"
3094
+ },
3095
+ "wrangler-config": {
3096
+ type: "string",
3097
+ description: "Override the Wrangler config path"
3098
+ },
3099
+ "wrangler-env": {
3100
+ type: "string",
3101
+ description: "Override the Wrangler environment"
3102
+ }
3103
+ },
3104
+ async run({ args }) {
3105
+ process.exitCode = await runMigrateCommand({
3106
+ manifest: args.manifest,
3107
+ fromConfig: args["from-config"],
3108
+ config: args.config,
3109
+ check: args.check,
3110
+ status: args.status,
3111
+ json: args.json,
3112
+ expectedTargetFingerprint: args["expected-target-fingerprint"],
3113
+ database: args.database,
3114
+ databaseUrlEnv: args["database-url-env"],
3115
+ d1: args.d1,
3116
+ accountId: args["account-id"],
3117
+ wranglerConfig: args["wrangler-config"],
3118
+ wranglerEnv: args["wrangler-env"]
3119
+ });
3120
+ }
3121
+ });
3122
+
2602
3123
  //#endregion
2603
3124
  //#region src/cli/commands/plugin-init.ts
2604
3125
  /**
@@ -3141,7 +3662,7 @@ const publishCommand = defineCommand({
3141
3662
  const pluginDir = resolve(args.dir);
3142
3663
  try {
3143
3664
  const { runCommand } = await import("citty");
3144
- const { bundleCommand } = await import("../bundle-CBEXrBnb.mjs").then((n) => n.n);
3665
+ const { bundleCommand } = await import("../bundle-vn56sLos.mjs").then((n) => n.n);
3145
3666
  await runCommand(bundleCommand, { rawArgs: ["--dir", pluginDir] });
3146
3667
  } catch {
3147
3668
  consola.error("Build failed");
@@ -4125,28 +4646,6 @@ const typesCommand = defineCommand({
4125
4646
 
4126
4647
  //#endregion
4127
4648
  //#region src/cli/index.ts
4128
- /**
4129
- * EmDash CLI
4130
- *
4131
- * Built with citty + clack (same stack as Nuxt CLI)
4132
- *
4133
- * Commands:
4134
- * - init: Bootstrap database from template config, or interactive setup
4135
- * - types: Generate TypeScript types from schema
4136
- * - dev: [DEPRECATED, hidden] Run dev server with a local SQLite database
4137
- * - seed: Apply a seed file to the database
4138
- * - export-seed: Export database schema and content as a seed file
4139
- * - secrets: Generate and inspect EmDash secrets (encryption keys, etc.)
4140
- * - auth: [DEPRECATED] Generate auth secret (use `secrets` instead)
4141
- * - login/logout/whoami: Session management
4142
- * - content: Create, read, update, delete content
4143
- * - schema: Manage collections and fields
4144
- * - media: Upload and manage media
4145
- * - search: Full-text search
4146
- * - taxonomy: Manage taxonomies and terms
4147
- * - menu: Manage navigation menus
4148
- * - plugin: Plugin management (init, bundle, validate, publish, login, logout)
4149
- */
4150
4649
  runMain(defineCommand({
4151
4650
  meta: {
4152
4651
  name: "emdash",
@@ -4159,6 +4658,7 @@ runMain(defineCommand({
4159
4658
  dev: devCommand,
4160
4659
  doctor: doctorCommand,
4161
4660
  seed: seedCommand,
4661
+ migrate: migrateCommand,
4162
4662
  "export-seed": exportSeedCommand,
4163
4663
  secrets: secretsCommand,
4164
4664
  auth: authCommand,