emdash 1.2.0 → 1.3.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 (1436) hide show
  1. package/dist/action-token-SK8zyN7w.mjs +26 -0
  2. package/dist/action-token-SK8zyN7w.mjs.map +1 -0
  3. package/dist/activation-Dim4YMM7.mjs +387 -0
  4. package/dist/activation-Dim4YMM7.mjs.map +1 -0
  5. package/dist/adapters-F_xorvWv.d.mts +173 -0
  6. package/dist/adapters-F_xorvWv.d.mts.map +1 -0
  7. package/dist/allowed-origins-CEug-p0t.mjs +116 -0
  8. package/dist/allowed-origins-CEug-p0t.mjs.map +1 -0
  9. package/dist/api/route-utils.d.mts +4 -4
  10. package/dist/api/route-utils.mjs +47 -45
  11. package/dist/api/route-utils.mjs.map +1 -1
  12. package/dist/api/schemas/index.d.mts +1 -1
  13. package/dist/api/schemas/index.mjs +9 -9
  14. package/dist/api-D-7BNHoz.mjs +5025 -0
  15. package/dist/api-D-7BNHoz.mjs.map +1 -0
  16. package/dist/api-tokens-Bx38ZCQp.mjs +173 -0
  17. package/dist/api-tokens-Bx38ZCQp.mjs.map +1 -0
  18. package/dist/apply-T7ATgzCh.mjs +1702 -0
  19. package/dist/apply-T7ATgzCh.mjs.map +1 -0
  20. package/dist/approvals-D-m6wvGl.mjs +460 -0
  21. package/dist/approvals-D-m6wvGl.mjs.map +1 -0
  22. package/dist/artifact-fetch-DIh7iyOV.mjs +659 -0
  23. package/dist/artifact-fetch-DIh7iyOV.mjs.map +1 -0
  24. package/dist/artifacts-htGyfCSt.mjs +307 -0
  25. package/dist/artifacts-htGyfCSt.mjs.map +1 -0
  26. package/dist/astro/index.d.mts +14 -14
  27. package/dist/astro/index.d.mts.map +1 -1
  28. package/dist/astro/index.mjs +109 -18
  29. package/dist/astro/index.mjs.map +1 -1
  30. package/dist/astro/middleware/auth.d.mts +12 -12
  31. package/dist/astro/middleware/auth.d.mts.map +1 -1
  32. package/dist/astro/middleware/auth.mjs +12 -11
  33. package/dist/astro/middleware/auth.mjs.map +1 -1
  34. package/dist/astro/middleware/media-usage-write-fence.mjs +5 -5
  35. package/dist/astro/middleware/redirect.d.mts.map +1 -1
  36. package/dist/astro/middleware/redirect.mjs +60 -40
  37. package/dist/astro/middleware/redirect.mjs.map +1 -1
  38. package/dist/astro/middleware/request-context.mjs +49 -15
  39. package/dist/astro/middleware/request-context.mjs.map +1 -1
  40. package/dist/astro/middleware/setup.mjs +1 -1
  41. package/dist/astro/middleware.d.mts +12 -12
  42. package/dist/astro/middleware.d.mts.map +1 -1
  43. package/dist/astro/middleware.mjs +116 -408
  44. package/dist/astro/middleware.mjs.map +1 -1
  45. package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +14 -14
  46. package/dist/astro/routes/api/admin/allowed-domains/index.mjs +14 -14
  47. package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +6 -6
  48. package/dist/astro/routes/api/admin/api-tokens/index.mjs +7 -7
  49. package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +6 -6
  50. package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +16 -16
  51. package/dist/astro/routes/api/admin/byline-fields/index.mjs +16 -16
  52. package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +16 -16
  53. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +22 -21
  54. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs.map +1 -1
  55. package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +22 -21
  56. package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs.map +1 -1
  57. package/dist/astro/routes/api/admin/bylines/index.mjs +22 -21
  58. package/dist/astro/routes/api/admin/bylines/index.mjs.map +1 -1
  59. package/dist/astro/routes/api/admin/comments/_id_/status.mjs +18 -18
  60. package/dist/astro/routes/api/admin/comments/_id_.mjs +7 -7
  61. package/dist/astro/routes/api/admin/comments/bulk.mjs +17 -17
  62. package/dist/astro/routes/api/admin/comments/counts.mjs +7 -7
  63. package/dist/astro/routes/api/admin/comments/index.mjs +17 -17
  64. package/dist/astro/routes/api/admin/core-update.mjs +7 -7
  65. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +6 -6
  66. package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +5 -5
  67. package/dist/astro/routes/api/admin/media-usage/activation.mjs +20 -20
  68. package/dist/astro/routes/api/admin/media-usage/collection-deletions/index.mjs +21 -21
  69. package/dist/astro/routes/api/admin/media-usage/collection-deletions/retry.mjs +21 -21
  70. package/dist/astro/routes/api/admin/media-usage/progress.mjs +23 -22
  71. package/dist/astro/routes/api/admin/media-usage/progress.mjs.map +1 -1
  72. package/dist/astro/routes/api/admin/media-usage/repair.mjs +29 -28
  73. package/dist/astro/routes/api/admin/media-usage/repair.mjs.map +1 -1
  74. package/dist/astro/routes/api/admin/media-usage/work/index.mjs +21 -21
  75. package/dist/astro/routes/api/admin/media-usage/work/retry.mjs +21 -21
  76. package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +6 -6
  77. package/dist/astro/routes/api/admin/oauth-clients/index.mjs +6 -6
  78. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +8 -8
  79. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +8 -8
  80. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +71 -69
  81. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs.map +1 -1
  82. package/dist/astro/routes/api/admin/plugins/_id_/mcp.mjs +7 -7
  83. package/dist/astro/routes/api/admin/plugins/_id_/settings.mjs +70 -68
  84. package/dist/astro/routes/api/admin/plugins/_id_/settings.mjs.map +1 -1
  85. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +70 -69
  86. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs.map +1 -1
  87. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +79 -78
  88. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs.map +1 -1
  89. package/dist/astro/routes/api/admin/plugins/index.mjs +71 -69
  90. package/dist/astro/routes/api/admin/plugins/index.mjs.map +1 -1
  91. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +7 -7
  92. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +70 -68
  93. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs.map +1 -1
  94. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +78 -77
  95. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs.map +1 -1
  96. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +70 -68
  97. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs.map +1 -1
  98. package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs +70 -69
  99. package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs.map +1 -1
  100. package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs +80 -79
  101. package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs.map +1 -1
  102. package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs +10 -10
  103. package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs.map +1 -1
  104. package/dist/astro/routes/api/admin/plugins/registry/install.mjs +72 -71
  105. package/dist/astro/routes/api/admin/plugins/registry/install.mjs.map +1 -1
  106. package/dist/astro/routes/api/admin/plugins/registry/publisher-handle.mjs +7 -7
  107. package/dist/astro/routes/api/admin/plugins/registry/verify.mjs +71 -69
  108. package/dist/astro/routes/api/admin/plugins/registry/verify.mjs.map +1 -1
  109. package/dist/astro/routes/api/admin/plugins/updates.mjs +70 -68
  110. package/dist/astro/routes/api/admin/plugins/updates.mjs.map +1 -1
  111. package/dist/astro/routes/api/admin/scheduled-policy-rejections/_collection_/_id_.mjs +5 -5
  112. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +70 -68
  113. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs.map +1 -1
  114. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +7 -7
  115. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +70 -68
  116. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs.map +1 -1
  117. package/dist/astro/routes/api/admin/transfer/_...path_.mjs +4 -4
  118. package/dist/astro/routes/api/admin/transfer/approvals/_id_/approve.mjs +38 -37
  119. package/dist/astro/routes/api/admin/transfer/approvals/_id_/approve.mjs.map +1 -1
  120. package/dist/astro/routes/api/admin/transfer/approvals/_id_/deny.mjs +38 -37
  121. package/dist/astro/routes/api/admin/transfer/approvals/_id_/deny.mjs.map +1 -1
  122. package/dist/astro/routes/api/admin/transfer/approvals/index.mjs +40 -39
  123. package/dist/astro/routes/api/admin/transfer/approvals/index.mjs.map +1 -1
  124. package/dist/astro/routes/api/admin/transfer/capabilities.mjs +40 -39
  125. package/dist/astro/routes/api/admin/transfer/capabilities.mjs.map +1 -1
  126. package/dist/astro/routes/api/admin/transfer/exports/_id_/advance.mjs +40 -39
  127. package/dist/astro/routes/api/admin/transfer/exports/_id_/advance.mjs.map +1 -1
  128. package/dist/astro/routes/api/admin/transfer/exports/_id_/archive.mjs +41 -40
  129. package/dist/astro/routes/api/admin/transfer/exports/_id_/archive.mjs.map +1 -1
  130. package/dist/astro/routes/api/admin/transfer/exports/_id_/files/_...path_.mjs +41 -40
  131. package/dist/astro/routes/api/admin/transfer/exports/_id_/files/_...path_.mjs.map +1 -1
  132. package/dist/astro/routes/api/admin/transfer/exports/_id_/index.mjs +40 -39
  133. package/dist/astro/routes/api/admin/transfer/exports/_id_/index.mjs.map +1 -1
  134. package/dist/astro/routes/api/admin/transfer/exports/_id_/manifest.mjs +41 -40
  135. package/dist/astro/routes/api/admin/transfer/exports/_id_/manifest.mjs.map +1 -1
  136. package/dist/astro/routes/api/admin/transfer/exports/index.mjs +42 -41
  137. package/dist/astro/routes/api/admin/transfer/exports/index.mjs.map +1 -1
  138. package/dist/astro/routes/api/admin/transfer/imports/_id_/abandon.mjs +40 -39
  139. package/dist/astro/routes/api/admin/transfer/imports/_id_/abandon.mjs.map +1 -1
  140. package/dist/astro/routes/api/admin/transfer/imports/_id_/advance.mjs +40 -39
  141. package/dist/astro/routes/api/admin/transfer/imports/_id_/advance.mjs.map +1 -1
  142. package/dist/astro/routes/api/admin/transfer/imports/_id_/analyze.mjs +42 -41
  143. package/dist/astro/routes/api/admin/transfer/imports/_id_/analyze.mjs.map +1 -1
  144. package/dist/astro/routes/api/admin/transfer/imports/_id_/cancel.mjs +40 -39
  145. package/dist/astro/routes/api/admin/transfer/imports/_id_/cancel.mjs.map +1 -1
  146. package/dist/astro/routes/api/admin/transfer/imports/_id_/execute.mjs +42 -41
  147. package/dist/astro/routes/api/admin/transfer/imports/_id_/execute.mjs.map +1 -1
  148. package/dist/astro/routes/api/admin/transfer/imports/_id_/files/_...path_.mjs +40 -39
  149. package/dist/astro/routes/api/admin/transfer/imports/_id_/files/_...path_.mjs.map +1 -1
  150. package/dist/astro/routes/api/admin/transfer/imports/_id_/index.mjs +40 -39
  151. package/dist/astro/routes/api/admin/transfer/imports/_id_/index.mjs.map +1 -1
  152. package/dist/astro/routes/api/admin/transfer/imports/_id_/missing.mjs +42 -41
  153. package/dist/astro/routes/api/admin/transfer/imports/_id_/missing.mjs.map +1 -1
  154. package/dist/astro/routes/api/admin/transfer/imports/_id_/plan.mjs +40 -39
  155. package/dist/astro/routes/api/admin/transfer/imports/_id_/plan.mjs.map +1 -1
  156. package/dist/astro/routes/api/admin/transfer/imports/_id_/receipt.mjs +40 -39
  157. package/dist/astro/routes/api/admin/transfer/imports/_id_/receipt.mjs.map +1 -1
  158. package/dist/astro/routes/api/admin/transfer/imports/index.mjs +42 -41
  159. package/dist/astro/routes/api/admin/transfer/imports/index.mjs.map +1 -1
  160. package/dist/astro/routes/api/admin/users/_id_/disable.mjs +4 -4
  161. package/dist/astro/routes/api/admin/users/_id_/enable.mjs +4 -4
  162. package/dist/astro/routes/api/admin/users/_id_/index.mjs +14 -14
  163. package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +6 -6
  164. package/dist/astro/routes/api/admin/users/index.mjs +14 -14
  165. package/dist/astro/routes/api/auth/dev-bypass.mjs +6 -6
  166. package/dist/astro/routes/api/auth/handover.mjs +6 -6
  167. package/dist/astro/routes/api/auth/invite/accept.mjs +4 -4
  168. package/dist/astro/routes/api/auth/invite/complete.mjs +19 -19
  169. package/dist/astro/routes/api/auth/invite/index.mjs +16 -16
  170. package/dist/astro/routes/api/auth/invite/register-options.mjs +17 -17
  171. package/dist/astro/routes/api/auth/logout.mjs +5 -5
  172. package/dist/astro/routes/api/auth/magic-link/send.mjs +18 -18
  173. package/dist/astro/routes/api/auth/magic-link/verify.mjs +15 -15
  174. package/dist/astro/routes/api/auth/me.mjs +15 -15
  175. package/dist/astro/routes/api/auth/mode.mjs +5 -5
  176. package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +8 -8
  177. package/dist/astro/routes/api/auth/oauth/_provider_.mjs +2 -2
  178. package/dist/astro/routes/api/auth/passkey/_id_.mjs +14 -14
  179. package/dist/astro/routes/api/auth/passkey/index.mjs +4 -4
  180. package/dist/astro/routes/api/auth/passkey/options.mjs +19 -19
  181. package/dist/astro/routes/api/auth/passkey/register/options.mjs +17 -17
  182. package/dist/astro/routes/api/auth/passkey/register/verify.mjs +18 -18
  183. package/dist/astro/routes/api/auth/passkey/verify.mjs +19 -19
  184. package/dist/astro/routes/api/auth/signup/complete.mjs +19 -19
  185. package/dist/astro/routes/api/auth/signup/request.mjs +17 -17
  186. package/dist/astro/routes/api/auth/signup/verify.mjs +4 -4
  187. package/dist/astro/routes/api/calendar.mjs +15 -15
  188. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +12 -12
  189. package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +18 -18
  190. package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +5 -5
  191. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.d.mts.map +1 -1
  192. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +18 -17
  193. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs.map +1 -1
  194. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +7 -10
  195. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs.map +1 -1
  196. package/dist/astro/routes/api/content/_collection_/_id_/lock.mjs +20 -17
  197. package/dist/astro/routes/api/content/_collection_/_id_/lock.mjs.map +1 -1
  198. package/dist/astro/routes/api/content/_collection_/_id_/permanent.d.mts.map +1 -1
  199. package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +7 -6
  200. package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs.map +1 -1
  201. package/dist/astro/routes/api/content/_collection_/_id_/plugin-extensions/_pluginId_/_kind_/_extensionId_.mjs +11 -11
  202. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +30 -29
  203. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs.map +1 -1
  204. package/dist/astro/routes/api/content/_collection_/_id_/publish.d.mts.map +1 -1
  205. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +18 -17
  206. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs.map +1 -1
  207. package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.mjs +34 -33
  208. package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.mjs.map +1 -1
  209. package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.mjs +34 -33
  210. package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.mjs.map +1 -1
  211. package/dist/astro/routes/api/content/_collection_/_id_/restore.d.mts.map +1 -1
  212. package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +7 -6
  213. package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs.map +1 -1
  214. package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +5 -5
  215. package/dist/astro/routes/api/content/_collection_/_id_/schedule.d.mts.map +1 -1
  216. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +19 -18
  217. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs.map +1 -1
  218. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.d.mts.map +1 -1
  219. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +30 -25
  220. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs.map +1 -1
  221. package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +5 -5
  222. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.d.mts.map +1 -1
  223. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +18 -17
  224. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs.map +1 -1
  225. package/dist/astro/routes/api/content/_collection_/_id_.d.mts.map +1 -1
  226. package/dist/astro/routes/api/content/_collection_/_id_.mjs +27 -20
  227. package/dist/astro/routes/api/content/_collection_/_id_.mjs.map +1 -1
  228. package/dist/astro/routes/api/content/_collection_/authors.mjs +5 -5
  229. package/dist/astro/routes/api/content/_collection_/index.mjs +18 -21
  230. package/dist/astro/routes/api/content/_collection_/index.mjs.map +1 -1
  231. package/dist/astro/routes/api/content/_collection_/trash.mjs +15 -15
  232. package/dist/astro/routes/api/dashboard.d.mts.map +1 -1
  233. package/dist/astro/routes/api/dashboard.mjs +17 -11
  234. package/dist/astro/routes/api/dashboard.mjs.map +1 -1
  235. package/dist/astro/routes/api/dev/emails.mjs +5 -5
  236. package/dist/astro/routes/api/dev/scheduled-tasks.d.mts +12 -0
  237. package/dist/astro/routes/api/dev/scheduled-tasks.d.mts.map +1 -0
  238. package/dist/astro/routes/api/dev/scheduled-tasks.mjs +140 -0
  239. package/dist/astro/routes/api/dev/scheduled-tasks.mjs.map +1 -0
  240. package/dist/astro/routes/api/health.mjs +6 -6
  241. package/dist/astro/routes/api/import/probe.d.mts +3 -3
  242. package/dist/astro/routes/api/import/probe.mjs +24 -22
  243. package/dist/astro/routes/api/import/probe.mjs.map +1 -1
  244. package/dist/astro/routes/api/import/wordpress/analyze.d.mts.map +1 -1
  245. package/dist/astro/routes/api/import/wordpress/analyze.mjs +7 -20
  246. package/dist/astro/routes/api/import/wordpress/analyze.mjs.map +1 -1
  247. package/dist/astro/routes/api/import/wordpress/execute.d.mts +15 -14
  248. package/dist/astro/routes/api/import/wordpress/execute.d.mts.map +1 -1
  249. package/dist/astro/routes/api/import/wordpress/execute.mjs +28 -29
  250. package/dist/astro/routes/api/import/wordpress/execute.mjs.map +1 -1
  251. package/dist/astro/routes/api/import/wordpress/media.d.mts +12 -12
  252. package/dist/astro/routes/api/import/wordpress/media.mjs +17 -17
  253. package/dist/astro/routes/api/import/wordpress/prepare.mjs +19 -17
  254. package/dist/astro/routes/api/import/wordpress/prepare.mjs.map +1 -1
  255. package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +13 -13
  256. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +27 -26
  257. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs.map +1 -1
  258. package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
  259. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +25 -22
  260. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs.map +1 -1
  261. package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +13 -13
  262. package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts.map +1 -1
  263. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +55 -34
  264. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs.map +1 -1
  265. package/dist/astro/routes/api/manifest.mjs +6 -6
  266. package/dist/astro/routes/api/mcp.mjs +135 -101
  267. package/dist/astro/routes/api/mcp.mjs.map +1 -1
  268. package/dist/astro/routes/api/media/_id_/confirm.mjs +17 -17
  269. package/dist/astro/routes/api/media/_id_/replace.mjs +15 -15
  270. package/dist/astro/routes/api/media/_id_/upload.mjs +8 -8
  271. package/dist/astro/routes/api/media/_id_/usage.mjs +31 -30
  272. package/dist/astro/routes/api/media/_id_/usage.mjs.map +1 -1
  273. package/dist/astro/routes/api/media/_id_.mjs +29 -28
  274. package/dist/astro/routes/api/media/_id_.mjs.map +1 -1
  275. package/dist/astro/routes/api/media/asset/_id_/_filename_.mjs +6 -6
  276. package/dist/astro/routes/api/media/file/_...key_.mjs +10 -10
  277. package/dist/astro/routes/api/media/folders/_id_.mjs +16 -16
  278. package/dist/astro/routes/api/media/folders/index.mjs +16 -16
  279. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +5 -5
  280. package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +5 -5
  281. package/dist/astro/routes/api/media/providers/index.mjs +5 -5
  282. package/dist/astro/routes/api/media/upload-url.mjs +17 -17
  283. package/dist/astro/routes/api/media.mjs +30 -29
  284. package/dist/astro/routes/api/media.mjs.map +1 -1
  285. package/dist/astro/routes/api/menus/_name_/items/_id_.d.mts.map +1 -1
  286. package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +19 -18
  287. package/dist/astro/routes/api/menus/_name_/items/_id_.mjs.map +1 -1
  288. package/dist/astro/routes/api/menus/_name_/items.d.mts.map +1 -1
  289. package/dist/astro/routes/api/menus/_name_/items.mjs +18 -17
  290. package/dist/astro/routes/api/menus/_name_/items.mjs.map +1 -1
  291. package/dist/astro/routes/api/menus/_name_/reorder.d.mts.map +1 -1
  292. package/dist/astro/routes/api/menus/_name_/reorder.mjs +18 -17
  293. package/dist/astro/routes/api/menus/_name_/reorder.mjs.map +1 -1
  294. package/dist/astro/routes/api/menus/_name_/translations.d.mts.map +1 -1
  295. package/dist/astro/routes/api/menus/_name_/translations.mjs +18 -17
  296. package/dist/astro/routes/api/menus/_name_/translations.mjs.map +1 -1
  297. package/dist/astro/routes/api/menus/_name_.d.mts.map +1 -1
  298. package/dist/astro/routes/api/menus/_name_.mjs +19 -18
  299. package/dist/astro/routes/api/menus/_name_.mjs.map +1 -1
  300. package/dist/astro/routes/api/menus/index.d.mts.map +1 -1
  301. package/dist/astro/routes/api/menus/index.mjs +18 -17
  302. package/dist/astro/routes/api/menus/index.mjs.map +1 -1
  303. package/dist/astro/routes/api/oauth/authorize.mjs +6 -6
  304. package/dist/astro/routes/api/oauth/device/authorize.mjs +8 -8
  305. package/dist/astro/routes/api/oauth/device/code.mjs +11 -11
  306. package/dist/astro/routes/api/oauth/device/token.mjs +10 -10
  307. package/dist/astro/routes/api/oauth/register.mjs +7 -7
  308. package/dist/astro/routes/api/oauth/token/refresh.mjs +8 -8
  309. package/dist/astro/routes/api/oauth/token/revoke.mjs +8 -8
  310. package/dist/astro/routes/api/oauth/token.mjs +8 -8
  311. package/dist/astro/routes/api/openapi.json.mjs +20 -20
  312. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +11 -11
  313. package/dist/astro/routes/api/redirects/404s/index.mjs +19 -19
  314. package/dist/astro/routes/api/redirects/404s/summary.mjs +19 -19
  315. package/dist/astro/routes/api/redirects/_id_.d.mts.map +1 -1
  316. package/dist/astro/routes/api/redirects/_id_.mjs +32 -23
  317. package/dist/astro/routes/api/redirects/_id_.mjs.map +1 -1
  318. package/dist/astro/routes/api/redirects/index.d.mts.map +1 -1
  319. package/dist/astro/routes/api/redirects/index.mjs +24 -21
  320. package/dist/astro/routes/api/redirects/index.mjs.map +1 -1
  321. package/dist/astro/routes/api/relations/_id_/index.mjs +34 -33
  322. package/dist/astro/routes/api/relations/_id_/index.mjs.map +1 -1
  323. package/dist/astro/routes/api/relations/index.mjs +34 -33
  324. package/dist/astro/routes/api/relations/index.mjs.map +1 -1
  325. package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +5 -5
  326. package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +16 -16
  327. package/dist/astro/routes/api/schema/block-types/_slug_/index.mjs +70 -68
  328. package/dist/astro/routes/api/schema/block-types/_slug_/index.mjs.map +1 -1
  329. package/dist/astro/routes/api/schema/block-types/_slug_/versions/_version_/activate.mjs +70 -68
  330. package/dist/astro/routes/api/schema/block-types/_slug_/versions/_version_/activate.mjs.map +1 -1
  331. package/dist/astro/routes/api/schema/block-types/index.mjs +70 -68
  332. package/dist/astro/routes/api/schema/block-types/index.mjs.map +1 -1
  333. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +70 -68
  334. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs.map +1 -1
  335. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +70 -68
  336. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs.map +1 -1
  337. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +70 -68
  338. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs.map +1 -1
  339. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +70 -68
  340. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs.map +1 -1
  341. package/dist/astro/routes/api/schema/collections/index.mjs +70 -68
  342. package/dist/astro/routes/api/schema/collections/index.mjs.map +1 -1
  343. package/dist/astro/routes/api/schema/collections/reorder.mjs +70 -68
  344. package/dist/astro/routes/api/schema/collections/reorder.mjs.map +1 -1
  345. package/dist/astro/routes/api/schema/index.mjs +16 -15
  346. package/dist/astro/routes/api/schema/index.mjs.map +1 -1
  347. package/dist/astro/routes/api/schema/orphans/_slug_.mjs +70 -68
  348. package/dist/astro/routes/api/schema/orphans/_slug_.mjs.map +1 -1
  349. package/dist/astro/routes/api/schema/orphans/index.mjs +70 -68
  350. package/dist/astro/routes/api/schema/orphans/index.mjs.map +1 -1
  351. package/dist/astro/routes/api/search/enable.mjs +19 -18
  352. package/dist/astro/routes/api/search/enable.mjs.map +1 -1
  353. package/dist/astro/routes/api/search/index.mjs +18 -17
  354. package/dist/astro/routes/api/search/index.mjs.map +1 -1
  355. package/dist/astro/routes/api/search/rebuild.mjs +19 -18
  356. package/dist/astro/routes/api/search/rebuild.mjs.map +1 -1
  357. package/dist/astro/routes/api/search/stats.mjs +9 -8
  358. package/dist/astro/routes/api/search/stats.mjs.map +1 -1
  359. package/dist/astro/routes/api/search/suggest.mjs +18 -17
  360. package/dist/astro/routes/api/search/suggest.mjs.map +1 -1
  361. package/dist/astro/routes/api/sections/_slug_.mjs +18 -17
  362. package/dist/astro/routes/api/sections/_slug_.mjs.map +1 -1
  363. package/dist/astro/routes/api/sections/index.mjs +18 -17
  364. package/dist/astro/routes/api/sections/index.mjs.map +1 -1
  365. package/dist/astro/routes/api/settings/backups/archives/_name_.mjs +7 -7
  366. package/dist/astro/routes/api/settings/backups/archives/index.mjs +7 -7
  367. package/dist/astro/routes/api/settings/backups/export.mjs +7 -7
  368. package/dist/astro/routes/api/settings/backups/index.mjs +8 -8
  369. package/dist/astro/routes/api/settings/domain-notify.mjs +9 -9
  370. package/dist/astro/routes/api/settings/domain.d.mts.map +1 -1
  371. package/dist/astro/routes/api/settings/domain.mjs +17 -14
  372. package/dist/astro/routes/api/settings/domain.mjs.map +1 -1
  373. package/dist/astro/routes/api/settings/email.mjs +6 -6
  374. package/dist/astro/routes/api/settings.d.mts.map +1 -1
  375. package/dist/astro/routes/api/settings.mjs +23 -20
  376. package/dist/astro/routes/api/settings.mjs.map +1 -1
  377. package/dist/astro/routes/api/setup/admin-verify.d.mts.map +1 -1
  378. package/dist/astro/routes/api/setup/admin-verify.mjs +25 -21
  379. package/dist/astro/routes/api/setup/admin-verify.mjs.map +1 -1
  380. package/dist/astro/routes/api/setup/admin.mjs +18 -18
  381. package/dist/astro/routes/api/setup/dev-bypass.mjs +42 -40
  382. package/dist/astro/routes/api/setup/dev-bypass.mjs.map +1 -1
  383. package/dist/astro/routes/api/setup/dev-reset.mjs +4 -4
  384. package/dist/astro/routes/api/setup/index.mjs +48 -46
  385. package/dist/astro/routes/api/setup/index.mjs.map +1 -1
  386. package/dist/astro/routes/api/setup/status.mjs +6 -6
  387. package/dist/astro/routes/api/site/domain-proof.mjs +11 -9
  388. package/dist/astro/routes/api/site/domain-proof.mjs.map +1 -1
  389. package/dist/astro/routes/api/snapshot.mjs +8 -8
  390. package/dist/astro/routes/api/taxonomies/_name_/reorder.d.mts.map +1 -1
  391. package/dist/astro/routes/api/taxonomies/_name_/reorder.mjs +23 -21
  392. package/dist/astro/routes/api/taxonomies/_name_/reorder.mjs.map +1 -1
  393. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.d.mts.map +1 -1
  394. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +23 -21
  395. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs.map +1 -1
  396. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.d.mts.map +1 -1
  397. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +24 -22
  398. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs.map +1 -1
  399. package/dist/astro/routes/api/taxonomies/_name_/terms/index.d.mts.map +1 -1
  400. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +23 -21
  401. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs.map +1 -1
  402. package/dist/astro/routes/api/taxonomies/_name_/translations.mjs +21 -20
  403. package/dist/astro/routes/api/taxonomies/_name_/translations.mjs.map +1 -1
  404. package/dist/astro/routes/api/taxonomies/_name_.d.mts.map +1 -1
  405. package/dist/astro/routes/api/taxonomies/_name_.mjs +24 -22
  406. package/dist/astro/routes/api/taxonomies/_name_.mjs.map +1 -1
  407. package/dist/astro/routes/api/taxonomies/bulk-tag.mjs +34 -33
  408. package/dist/astro/routes/api/taxonomies/bulk-tag.mjs.map +1 -1
  409. package/dist/astro/routes/api/taxonomies/index.d.mts.map +1 -1
  410. package/dist/astro/routes/api/taxonomies/index.mjs +23 -21
  411. package/dist/astro/routes/api/taxonomies/index.mjs.map +1 -1
  412. package/dist/astro/routes/api/themes/preview.mjs +6 -6
  413. package/dist/astro/routes/api/typegen.mjs +6 -6
  414. package/dist/astro/routes/api/visual-editing/action-token.mjs +6 -6
  415. package/dist/astro/routes/api/visual-editing/content/_collection_/_id_/publish.mjs +18 -18
  416. package/dist/astro/routes/api/visual-editing/toolbar-labels.mjs +4 -4
  417. package/dist/astro/routes/api/well-known/auth.mjs +1 -1
  418. package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +2 -2
  419. package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +2 -2
  420. package/dist/astro/routes/api/widget-areas/_name_/reorder.d.mts.map +1 -1
  421. package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +17 -16
  422. package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs.map +1 -1
  423. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.d.mts.map +1 -1
  424. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +21 -19
  425. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs.map +1 -1
  426. package/dist/astro/routes/api/widget-areas/_name_/widgets.d.mts.map +1 -1
  427. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +20 -18
  428. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs.map +1 -1
  429. package/dist/astro/routes/api/widget-areas/_name_.d.mts.map +1 -1
  430. package/dist/astro/routes/api/widget-areas/_name_.mjs +10 -8
  431. package/dist/astro/routes/api/widget-areas/_name_.mjs.map +1 -1
  432. package/dist/astro/routes/api/widget-areas/index.d.mts.map +1 -1
  433. package/dist/astro/routes/api/widget-areas/index.mjs +20 -18
  434. package/dist/astro/routes/api/widget-areas/index.mjs.map +1 -1
  435. package/dist/astro/routes/api/widget-components.mjs +5 -5
  436. package/dist/astro/routes/robots.txt.d.mts.map +1 -1
  437. package/dist/astro/routes/robots.txt.mjs +38 -5
  438. package/dist/astro/routes/robots.txt.mjs.map +1 -1
  439. package/dist/astro/routes/sitemap-_collection_.xml.mjs +13 -8
  440. package/dist/astro/routes/sitemap-_collection_.xml.mjs.map +1 -1
  441. package/dist/astro/routes/sitemap.xml.mjs +11 -6
  442. package/dist/astro/routes/sitemap.xml.mjs.map +1 -1
  443. package/dist/astro/types.d.mts +19 -17
  444. package/dist/astro/types.d.mts.map +1 -1
  445. package/dist/audit-_gieLVGU.mjs +127 -0
  446. package/dist/audit-_gieLVGU.mjs.map +1 -0
  447. package/dist/auth/providers/github.d.mts +1 -1
  448. package/dist/auth/providers/google.d.mts +1 -1
  449. package/dist/auth/providers/microsoft.d.mts +1 -1
  450. package/dist/authoritative-records-CQlB3JzE.mjs +5183 -0
  451. package/dist/authoritative-records-CQlB3JzE.mjs.map +1 -0
  452. package/dist/authorize-DPFBGbE6.mjs +74 -0
  453. package/dist/authorize-DPFBGbE6.mjs.map +1 -0
  454. package/dist/backup-3FgVxiDJ.mjs +246 -0
  455. package/dist/backup-3FgVxiDJ.mjs.map +1 -0
  456. package/dist/block-types-CYcG56JB.mjs +132 -0
  457. package/dist/block-types-CYcG56JB.mjs.map +1 -0
  458. package/dist/block-values-gCX4HBSl.mjs +215 -0
  459. package/dist/block-values-gCX4HBSl.mjs.map +1 -0
  460. package/dist/byline-BR1qhyiw.mjs +909 -0
  461. package/dist/byline-BR1qhyiw.mjs.map +1 -0
  462. package/dist/byline-fields-4ClDC88c.mjs +123 -0
  463. package/dist/byline-fields-4ClDC88c.mjs.map +1 -0
  464. package/dist/byline-fields-BLXZnX7N.mjs +280 -0
  465. package/dist/byline-fields-BLXZnX7N.mjs.map +1 -0
  466. package/dist/bylines-CVOvRUL7.mjs +234 -0
  467. package/dist/bylines-CVOvRUL7.mjs.map +1 -0
  468. package/dist/bylines-DxOs9B7z.mjs +150 -0
  469. package/dist/bylines-DxOs9B7z.mjs.map +1 -0
  470. package/dist/cache-CEU9wo_h.mjs +151 -0
  471. package/dist/cache-CEU9wo_h.mjs.map +1 -0
  472. package/dist/canonical-BudtH-Fx.mjs +174 -0
  473. package/dist/canonical-BudtH-Fx.mjs.map +1 -0
  474. package/dist/capture-triggers-CT6dK9zd.mjs +362 -0
  475. package/dist/capture-triggers-CT6dK9zd.mjs.map +1 -0
  476. package/dist/challenge-store-C17BYx2-.mjs +51 -0
  477. package/dist/challenge-store-C17BYx2-.mjs.map +1 -0
  478. package/dist/checksum-CEqvfxGX.mjs +162 -0
  479. package/dist/checksum-CEqvfxGX.mjs.map +1 -0
  480. package/dist/chunks-xC4UD5-S.mjs +25 -0
  481. package/dist/chunks-xC4UD5-S.mjs.map +1 -0
  482. package/dist/cli/index.mjs +127 -113
  483. package/dist/cli/index.mjs.map +1 -1
  484. package/dist/client/cf-access.d.mts +1 -1
  485. package/dist/client/index.d.mts +47 -47
  486. package/dist/client/index.d.mts.map +1 -1
  487. package/dist/client/index.mjs +12 -10
  488. package/dist/client/index.mjs.map +1 -1
  489. package/dist/collection-slugs-cache-e09QeJQt.mjs +85 -0
  490. package/dist/collection-slugs-cache-e09QeJQt.mjs.map +1 -0
  491. package/dist/comment-UvIWDKcW.mjs +325 -0
  492. package/dist/comment-UvIWDKcW.mjs.map +1 -0
  493. package/dist/comment-reaction-dGp6_FRo.mjs +85 -0
  494. package/dist/comment-reaction-dGp6_FRo.mjs.map +1 -0
  495. package/dist/comments-pej-_BUO.mjs +195 -0
  496. package/dist/comments-pej-_BUO.mjs.map +1 -0
  497. package/dist/comments-yiRFx3w5.mjs +99 -0
  498. package/dist/comments-yiRFx3w5.mjs.map +1 -0
  499. package/dist/components-Brp__9xo.mjs +112 -0
  500. package/dist/components-Brp__9xo.mjs.map +1 -0
  501. package/dist/config-Bsm_u_oE.d.mts +6799 -0
  502. package/dist/config-Bsm_u_oE.d.mts.map +1 -0
  503. package/dist/config-CFMojMFK.d.mts +39 -0
  504. package/dist/config-CFMojMFK.d.mts.map +1 -0
  505. package/dist/config-DBU6iUQB.mjs +228 -0
  506. package/dist/config-DBU6iUQB.mjs.map +1 -0
  507. package/dist/connection-BtEN_lP9.mjs +36 -0
  508. package/dist/connection-BtEN_lP9.mjs.map +1 -0
  509. package/dist/content-DQSRZTVw.mjs +2075 -0
  510. package/dist/content-DQSRZTVw.mjs.map +1 -0
  511. package/dist/content-list-query-CYKcY6Vi.d.mts +26 -0
  512. package/dist/content-list-query-CYKcY6Vi.d.mts.map +1 -0
  513. package/dist/content-repair-DNh5--x5.mjs +442 -0
  514. package/dist/content-repair-DNh5--x5.mjs.map +1 -0
  515. package/dist/context-BYptmCN0.mjs +2090 -0
  516. package/dist/context-BYptmCN0.mjs.map +1 -0
  517. package/dist/credits-B9iORdWB.mjs +110 -0
  518. package/dist/credits-B9iORdWB.mjs.map +1 -0
  519. package/dist/cron-D7obTIfk.mjs +306 -0
  520. package/dist/cron-D7obTIfk.mjs.map +1 -0
  521. package/dist/dashboard-D0jcgBD7.mjs +167 -0
  522. package/dist/dashboard-D0jcgBD7.mjs.map +1 -0
  523. package/dist/database/migration-lock.d.mts +17 -4
  524. package/dist/database/migration-lock.d.mts.map +1 -1
  525. package/dist/database/migration-lock.mjs +32 -5
  526. package/dist/database/migration-lock.mjs.map +1 -1
  527. package/dist/db/index.d.mts +3 -3
  528. package/dist/db/index.mjs +1 -1
  529. package/dist/db/libsql-migrations.d.mts +1 -1
  530. package/dist/db/libsql-migrations.mjs +4 -4
  531. package/dist/db/libsql.d.mts +1 -1
  532. package/dist/db/postgres-migrations.d.mts +1 -1
  533. package/dist/db/postgres-migrations.mjs +4 -4
  534. package/dist/db/postgres.d.mts +1 -1
  535. package/dist/db/sqlite-migrations.d.mts +1 -1
  536. package/dist/db/sqlite-migrations.mjs +4 -4
  537. package/dist/db/sqlite.d.mts +1 -1
  538. package/dist/db/sqlite.mjs +1 -1
  539. package/dist/default-C0W-PhAp.mjs +81 -0
  540. package/dist/default-C0W-PhAp.mjs.map +1 -0
  541. package/dist/deferred-tasks-ZvUECSzI.d.mts +9 -0
  542. package/dist/deferred-tasks-ZvUECSzI.d.mts.map +1 -0
  543. package/dist/dev-typegen-EBni_pOQ.mjs +29 -0
  544. package/dist/dev-typegen-EBni_pOQ.mjs.map +1 -0
  545. package/dist/device-flow-BkFKBoAn.mjs +521 -0
  546. package/dist/device-flow-BkFKBoAn.mjs.map +1 -0
  547. package/dist/digest-DJ1tHCgy.mjs +194 -0
  548. package/dist/digest-DJ1tHCgy.mjs.map +1 -0
  549. package/dist/direct-executor-Cbxzg4qe.mjs +117 -0
  550. package/dist/direct-executor-Cbxzg4qe.mjs.map +1 -0
  551. package/dist/email-console-FFVJWb9N.mjs +50 -0
  552. package/dist/email-console-FFVJWb9N.mjs.map +1 -0
  553. package/dist/email-locale-BJ8DjTzZ.mjs +25 -0
  554. package/dist/email-locale-BJ8DjTzZ.mjs.map +1 -0
  555. package/dist/emdash-runtime-DVi7vtXC.mjs +4379 -0
  556. package/dist/emdash-runtime-DVi7vtXC.mjs.map +1 -0
  557. package/dist/entry-lock-C7VX0NGK.d.mts +4568 -0
  558. package/dist/entry-lock-C7VX0NGK.d.mts.map +1 -0
  559. package/dist/entry-lock-DLxCffFW.mjs +163 -0
  560. package/dist/entry-lock-DLxCffFW.mjs.map +1 -0
  561. package/dist/entry-lock-Df6-XhIu.mjs +1211 -0
  562. package/dist/entry-lock-Df6-XhIu.mjs.map +1 -0
  563. package/dist/env-types-C3FCVBWe.mjs +38 -0
  564. package/dist/env-types-C3FCVBWe.mjs.map +1 -0
  565. package/dist/error-CVWeIOku.mjs +90 -0
  566. package/dist/error-CVWeIOku.mjs.map +1 -0
  567. package/dist/errors-B4f4It-2.mjs +120 -0
  568. package/dist/errors-B4f4It-2.mjs.map +1 -0
  569. package/dist/errors-BOYNdIo3.mjs +479 -0
  570. package/dist/errors-BOYNdIo3.mjs.map +1 -0
  571. package/dist/escape-lsNq38PP.mjs +9 -0
  572. package/dist/escape-lsNq38PP.mjs.map +1 -0
  573. package/dist/fence-C3MUitUN.mjs +162 -0
  574. package/dist/fence-C3MUitUN.mjs.map +1 -0
  575. package/dist/field-defs-cache-Dez5iWJJ.mjs +77 -0
  576. package/dist/field-defs-cache-Dez5iWJJ.mjs.map +1 -0
  577. package/dist/field-map-Bft9LKak.mjs +83 -0
  578. package/dist/field-map-Bft9LKak.mjs.map +1 -0
  579. package/dist/fts-manager-Beg3e4bI.mjs +443 -0
  580. package/dist/fts-manager-Beg3e4bI.mjs.map +1 -0
  581. package/dist/gc-ByyAYiYE.mjs +75 -0
  582. package/dist/gc-ByyAYiYE.mjs.map +1 -0
  583. package/dist/hash-BJaeek87.mjs +37 -0
  584. package/dist/hash-BJaeek87.mjs.map +1 -0
  585. package/dist/hook-result-BrdLyOdI.d.mts +31 -0
  586. package/dist/hook-result-BrdLyOdI.d.mts.map +1 -0
  587. package/dist/hreflang-C8Jb-hrf.mjs +105 -0
  588. package/dist/hreflang-C8Jb-hrf.mjs.map +1 -0
  589. package/dist/hreflang-CY_F5OjF.d.mts +50 -0
  590. package/dist/hreflang-CY_F5OjF.d.mts.map +1 -0
  591. package/dist/http-route-dispatch-CyeW6iPv.mjs +342 -0
  592. package/dist/http-route-dispatch-CyeW6iPv.mjs.map +1 -0
  593. package/dist/identity-Cael5uTT.mjs +35 -0
  594. package/dist/identity-Cael5uTT.mjs.map +1 -0
  595. package/dist/import-BUXjdZUn.mjs +2126 -0
  596. package/dist/import-BUXjdZUn.mjs.map +1 -0
  597. package/dist/index-BB9sVisO.d.mts +623 -0
  598. package/dist/index-BB9sVisO.d.mts.map +1 -0
  599. package/dist/index.d.mts +23 -23
  600. package/dist/index.mjs +96 -94
  601. package/dist/install-finalization-3JX5qQEA.mjs +58 -0
  602. package/dist/install-finalization-3JX5qQEA.mjs.map +1 -0
  603. package/dist/json-recordset-BUjxhr77.mjs +12 -0
  604. package/dist/json-recordset-BUjxhr77.mjs.map +1 -0
  605. package/dist/json-schema-v_D_pPNG.mjs +15 -0
  606. package/dist/json-schema-v_D_pPNG.mjs.map +1 -0
  607. package/dist/keys-CifIkT0N.mjs +61 -0
  608. package/dist/keys-CifIkT0N.mjs.map +1 -0
  609. package/dist/kinds-B_Qcl5pz.mjs +974 -0
  610. package/dist/kinds-B_Qcl5pz.mjs.map +1 -0
  611. package/dist/lifecycle-7vUJeFRe.mjs +25 -0
  612. package/dist/lifecycle-7vUJeFRe.mjs.map +1 -0
  613. package/dist/load-CdAG9wz-.mjs +28 -0
  614. package/dist/load-CdAG9wz-.mjs.map +1 -0
  615. package/dist/loader-CswroUbe.mjs +1380 -0
  616. package/dist/loader-CswroUbe.mjs.map +1 -0
  617. package/dist/loops-uA4iTOzd.mjs +205 -0
  618. package/dist/loops-uA4iTOzd.mjs.map +1 -0
  619. package/dist/manifest-builder-B8zjuH3f.mjs +189 -0
  620. package/dist/manifest-builder-B8zjuH3f.mjs.map +1 -0
  621. package/dist/manifest-schema-DNb4XmTS.mjs +497 -0
  622. package/dist/manifest-schema-DNb4XmTS.mjs.map +1 -0
  623. package/dist/marketplace-CqbgeIa7.mjs +257 -0
  624. package/dist/marketplace-CqbgeIa7.mjs.map +1 -0
  625. package/dist/media/index.d.mts +1 -1
  626. package/dist/media/local-runtime.d.mts +14 -14
  627. package/dist/media/local-runtime.mjs +10 -5
  628. package/dist/media/local-runtime.mjs.map +1 -1
  629. package/dist/media--dJRU6i2.mjs +294 -0
  630. package/dist/media--dJRU6i2.mjs.map +1 -0
  631. package/dist/media-1WC65OCB.mjs +416 -0
  632. package/dist/media-1WC65OCB.mjs.map +1 -0
  633. package/dist/media-Bws9f18T.mjs +373 -0
  634. package/dist/media-Bws9f18T.mjs.map +1 -0
  635. package/dist/media-allowlist-BJB7MFx6.mjs +45 -0
  636. package/dist/media-allowlist-BJB7MFx6.mjs.map +1 -0
  637. package/dist/media-folders-Dn3C16B8.mjs +210 -0
  638. package/dist/media-folders-Dn3C16B8.mjs.map +1 -0
  639. package/dist/media-url-BQgKvpQ5.mjs +43 -0
  640. package/dist/media-url-BQgKvpQ5.mjs.map +1 -0
  641. package/dist/media-usage-CF0WVcLO.mjs +282 -0
  642. package/dist/media-usage-CF0WVcLO.mjs.map +1 -0
  643. package/dist/media-usage-activation-C9HwVw5w.mjs +78 -0
  644. package/dist/media-usage-activation-C9HwVw5w.mjs.map +1 -0
  645. package/dist/media-usage-work-CkLa5-nc.mjs +1036 -0
  646. package/dist/media-usage-work-CkLa5-nc.mjs.map +1 -0
  647. package/dist/media-usage-work-m3AWTmmC.mjs +151 -0
  648. package/dist/media-usage-work-m3AWTmmC.mjs.map +1 -0
  649. package/dist/menus-BCVSSp1z.mjs +753 -0
  650. package/dist/menus-BCVSSp1z.mjs.map +1 -0
  651. package/dist/menus-BSzwObhV.mjs +92 -0
  652. package/dist/menus-BSzwObhV.mjs.map +1 -0
  653. package/dist/menus-Cl4kwdt7.mjs +3721 -0
  654. package/dist/menus-Cl4kwdt7.mjs.map +1 -0
  655. package/dist/migrations/index.d.mts +1 -1
  656. package/dist/migrations/index.d.mts.map +1 -1
  657. package/dist/migrations/index.mjs +3 -3
  658. package/dist/mode-C-D3qICy.mjs +23 -0
  659. package/dist/mode-C-D3qICy.mjs.map +1 -0
  660. package/dist/node-sqlite-compat-CrKzRr0J.mjs +63 -0
  661. package/dist/node-sqlite-compat-CrKzRr0J.mjs.map +1 -0
  662. package/dist/oauth-authorization-TpEJrYB7.mjs +274 -0
  663. package/dist/oauth-authorization-TpEJrYB7.mjs.map +1 -0
  664. package/dist/oauth-clients-BT0Pg-MO.mjs +266 -0
  665. package/dist/oauth-clients-BT0Pg-MO.mjs.map +1 -0
  666. package/dist/oauth-state-store-CHMn_mwc.mjs +50 -0
  667. package/dist/oauth-state-store-CHMn_mwc.mjs.map +1 -0
  668. package/dist/oauth-user-lookup-BDgF6IVG.mjs +26 -0
  669. package/dist/oauth-user-lookup-BDgF6IVG.mjs.map +1 -0
  670. package/dist/object-cache/memory.d.mts +1 -1
  671. package/dist/options-DJWaq3Ie.d.mts +81 -0
  672. package/dist/options-DJWaq3Ie.d.mts.map +1 -0
  673. package/dist/ownership-MiyA7qKO.mjs +12 -0
  674. package/dist/ownership-MiyA7qKO.mjs.map +1 -0
  675. package/dist/page/index.d.mts +2 -2
  676. package/dist/page/index.mjs +9 -4
  677. package/dist/page/index.mjs.map +1 -1
  678. package/dist/parse-CWHOFc6z.d.mts +176 -0
  679. package/dist/parse-CWHOFc6z.d.mts.map +1 -0
  680. package/dist/parse-DgQ2NABT.mjs +81 -0
  681. package/dist/parse-DgQ2NABT.mjs.map +1 -0
  682. package/dist/passkey-config-D0kdzEao.mjs +46 -0
  683. package/dist/passkey-config-D0kdzEao.mjs.map +1 -0
  684. package/dist/paths-biDzFTY2.mjs +77 -0
  685. package/dist/paths-biDzFTY2.mjs.map +1 -0
  686. package/dist/placeholder-D41vk11_.d.mts +306 -0
  687. package/dist/placeholder-D41vk11_.d.mts.map +1 -0
  688. package/dist/plan-CCoqxNoU.mjs +135 -0
  689. package/dist/plan-CCoqxNoU.mjs.map +1 -0
  690. package/dist/plugin-test-runtime.d.mts +14 -14
  691. package/dist/plugin-test-runtime.mjs +109 -107
  692. package/dist/plugin-tool-name-DDUgN_0p.mjs +27 -0
  693. package/dist/plugin-tool-name-DDUgN_0p.mjs.map +1 -0
  694. package/dist/plugin-types.d.mts +2 -2
  695. package/dist/plugin-utils.d.mts +12 -12
  696. package/dist/plugins/adapt-sandbox-entry.d.mts +12 -12
  697. package/dist/plugins/adapt-sandbox-entry.d.mts.map +1 -1
  698. package/dist/plugins/adapt-sandbox-entry.mjs +9 -8
  699. package/dist/plugins/adapt-sandbox-entry.mjs.map +1 -1
  700. package/dist/plugins/host.d.mts +5 -5
  701. package/dist/plugins/host.mjs +45 -41
  702. package/dist/plugins-COJ2L49n.mjs +261 -0
  703. package/dist/plugins-COJ2L49n.mjs.map +1 -0
  704. package/dist/policy-DLQ--Hnm.mjs +45 -0
  705. package/dist/policy-DLQ--Hnm.mjs.map +1 -0
  706. package/dist/portable-text-BH4zgkSm.mjs +311 -0
  707. package/dist/portable-text-BH4zgkSm.mjs.map +1 -0
  708. package/dist/preview-DLexxwp3.mjs +107 -0
  709. package/dist/preview-DLexxwp3.mjs.map +1 -0
  710. package/dist/protocol-79kUO7jP.d.mts +65 -0
  711. package/dist/protocol-79kUO7jP.d.mts.map +1 -0
  712. package/dist/public-plugin-api-routes-BuAMJ8nN.mjs +316 -0
  713. package/dist/public-plugin-api-routes-BuAMJ8nN.mjs.map +1 -0
  714. package/dist/public-submission-Di3TsgzX.mjs +251 -0
  715. package/dist/public-submission-Di3TsgzX.mjs.map +1 -0
  716. package/dist/public-url-Bt98vysr.mjs +101 -0
  717. package/dist/public-url-Bt98vysr.mjs.map +1 -0
  718. package/dist/query-CpnRlBh8.mjs +1156 -0
  719. package/dist/query-CpnRlBh8.mjs.map +1 -0
  720. package/dist/query-haKvLAWl.mjs +41 -0
  721. package/dist/query-haKvLAWl.mjs.map +1 -0
  722. package/dist/range-CYfeXgGK.mjs +51 -0
  723. package/dist/range-CYfeXgGK.mjs.map +1 -0
  724. package/dist/rate-limit-Xp4d0NBY.mjs +127 -0
  725. package/dist/rate-limit-Xp4d0NBY.mjs.map +1 -0
  726. package/dist/receipt-BUsQCOeM.mjs +43 -0
  727. package/dist/receipt-BUsQCOeM.mjs.map +1 -0
  728. package/dist/redirect-CQAV7mCo.mjs +19 -0
  729. package/dist/redirect-CQAV7mCo.mjs.map +1 -0
  730. package/dist/redirect-DiS_3mA4.mjs +423 -0
  731. package/dist/redirect-DiS_3mA4.mjs.map +1 -0
  732. package/dist/redirect-paths-CNYq7w80.mjs +36 -0
  733. package/dist/redirect-paths-CNYq7w80.mjs.map +1 -0
  734. package/dist/redirects-BEVSRMa2.mjs +148 -0
  735. package/dist/redirects-BEVSRMa2.mjs.map +1 -0
  736. package/dist/redirects-BHpy-VsZ.mjs +446 -0
  737. package/dist/redirects-BHpy-VsZ.mjs.map +1 -0
  738. package/dist/registry/testing.mjs +3 -3
  739. package/dist/registry-TUVaid9Z.mjs +8369 -0
  740. package/dist/registry-TUVaid9Z.mjs.map +1 -0
  741. package/dist/relations-CA_QuMTU.mjs +776 -0
  742. package/dist/relations-CA_QuMTU.mjs.map +1 -0
  743. package/dist/request-context.d.mts +1 -1
  744. package/dist/request-meta-bwZ_NsvU.mjs +141 -0
  745. package/dist/request-meta-bwZ_NsvU.mjs.map +1 -0
  746. package/dist/resolve-DwNM-CXl.mjs +101 -0
  747. package/dist/resolve-DwNM-CXl.mjs.map +1 -0
  748. package/dist/revision-BVp8S0e_.mjs +374 -0
  749. package/dist/revision-BVp8S0e_.mjs.map +1 -0
  750. package/dist/route-cache-QSOyDEw0.mjs +20 -0
  751. package/dist/route-cache-QSOyDEw0.mjs.map +1 -0
  752. package/dist/route-wire-Ca_HWCZ5.mjs +197 -0
  753. package/dist/route-wire-Ca_HWCZ5.mjs.map +1 -0
  754. package/dist/routes-BerZFrvV.mjs +272 -0
  755. package/dist/routes-BerZFrvV.mjs.map +1 -0
  756. package/dist/runner-BObHz5FC.d.mts +68 -0
  757. package/dist/runner-BObHz5FC.d.mts.map +1 -0
  758. package/dist/runner-C5NeAkBQ.mjs +6595 -0
  759. package/dist/runner-C5NeAkBQ.mjs.map +1 -0
  760. package/dist/runtime.d.mts +13 -13
  761. package/dist/runtime.mjs +3 -2
  762. package/dist/runtime.mjs.map +1 -1
  763. package/dist/schema/project-env-types.mjs +39 -35
  764. package/dist/schema/project-env-types.mjs.map +1 -1
  765. package/dist/schema-C4OBuv6Z.mjs +13 -0
  766. package/dist/schema-C4OBuv6Z.mjs.map +1 -0
  767. package/dist/schema-DJRfvM_o.mjs +815 -0
  768. package/dist/schema-DJRfvM_o.mjs.map +1 -0
  769. package/dist/scopes-BU03K7Uo.mjs +34 -0
  770. package/dist/scopes-BU03K7Uo.mjs.map +1 -0
  771. package/dist/search-DfVzks89.mjs +450 -0
  772. package/dist/search-DfVzks89.mjs.map +1 -0
  773. package/dist/sections-BMy4JVUz.mjs +346 -0
  774. package/dist/sections-BMy4JVUz.mjs.map +1 -0
  775. package/dist/seed/index.d.mts +2 -2
  776. package/dist/seed/index.mjs +37 -33
  777. package/dist/seo/index.d.mts +3 -3
  778. package/dist/seo/index.mjs +24 -20
  779. package/dist/seo/index.mjs.map +1 -1
  780. package/dist/seo-ClB-dw9w.mjs +188 -0
  781. package/dist/seo-ClB-dw9w.mjs.map +1 -0
  782. package/dist/seo-VZYOEy8f.mjs +133 -0
  783. package/dist/seo-VZYOEy8f.mjs.map +1 -0
  784. package/dist/service-Bo_usgSk.mjs +150 -0
  785. package/dist/service-Bo_usgSk.mjs.map +1 -0
  786. package/dist/session-user-DlpPdf8L.mjs +61 -0
  787. package/dist/session-user-DlpPdf8L.mjs.map +1 -0
  788. package/dist/settings-CWb84sDm.mjs +452 -0
  789. package/dist/settings-CWb84sDm.mjs.map +1 -0
  790. package/dist/settings-DS914jjE.mjs +66 -0
  791. package/dist/settings-DS914jjE.mjs.map +1 -0
  792. package/dist/settings-Dd1uivmQ.mjs +73 -0
  793. package/dist/settings-Dd1uivmQ.mjs.map +1 -0
  794. package/dist/setup-complete-BuNxAUiN.mjs +65 -0
  795. package/dist/setup-complete-BuNxAUiN.mjs.map +1 -0
  796. package/dist/setup-nonce-BnEAX0iy.mjs +25 -0
  797. package/dist/setup-nonce-BnEAX0iy.mjs.map +1 -0
  798. package/dist/site-domain-Bq5j5bVg.mjs +131 -0
  799. package/dist/site-domain-Bq5j5bVg.mjs.map +1 -0
  800. package/dist/site-settings-DRHfX7bq.mjs +50 -0
  801. package/dist/site-settings-DRHfX7bq.mjs.map +1 -0
  802. package/dist/site-url-MB685I5X.mjs +45 -0
  803. package/dist/site-url-MB685I5X.mjs.map +1 -0
  804. package/dist/sitemap-name-BTg2NJJv.mjs +26 -0
  805. package/dist/sitemap-name-BTg2NJJv.mjs.map +1 -0
  806. package/dist/slug-aVnUV4SL.mjs +16 -0
  807. package/dist/slug-aVnUV4SL.mjs.map +1 -0
  808. package/dist/snapshot-DYsG4uOq.mjs +414 -0
  809. package/dist/snapshot-DYsG4uOq.mjs.map +1 -0
  810. package/dist/ssrf-BcYjyM4M.mjs +406 -0
  811. package/dist/ssrf-BcYjyM4M.mjs.map +1 -0
  812. package/dist/stage-D8DWgPcO.mjs +662 -0
  813. package/dist/stage-D8DWgPcO.mjs.map +1 -0
  814. package/dist/staged-CD_imitH.mjs +686 -0
  815. package/dist/staged-CD_imitH.mjs.map +1 -0
  816. package/dist/state-CFbGZziM.mjs +178 -0
  817. package/dist/state-CFbGZziM.mjs.map +1 -0
  818. package/dist/status-BFNdxzKc.mjs +30 -0
  819. package/dist/status-BFNdxzKc.mjs.map +1 -0
  820. package/dist/storage/local.d.mts +1 -1
  821. package/dist/storage/local.mjs +3 -3
  822. package/dist/storage/s3.d.mts +1 -1
  823. package/dist/storage/s3.mjs +1 -1
  824. package/dist/storage-query-DRyu3bSU.d.mts +1615 -0
  825. package/dist/storage-query-DRyu3bSU.d.mts.map +1 -0
  826. package/dist/tar-DFjExb9X.mjs +449 -0
  827. package/dist/tar-DFjExb9X.mjs.map +1 -0
  828. package/dist/target-CWZs2-o6.mjs +27 -0
  829. package/dist/target-CWZs2-o6.mjs.map +1 -0
  830. package/dist/taxonomies-ChnU7Mc8.mjs +697 -0
  831. package/dist/taxonomies-ChnU7Mc8.mjs.map +1 -0
  832. package/dist/taxonomies-Dd9JJv_a.mjs +939 -0
  833. package/dist/taxonomies-Dd9JJv_a.mjs.map +1 -0
  834. package/dist/taxonomy-C_C_LBAU.mjs +550 -0
  835. package/dist/taxonomy-C_C_LBAU.mjs.map +1 -0
  836. package/dist/tokens-BnhSnGwJ.mjs +171 -0
  837. package/dist/tokens-BnhSnGwJ.mjs.map +1 -0
  838. package/dist/transfer-ClH6w6BV.mjs +8873 -0
  839. package/dist/transfer-ClH6w6BV.mjs.map +1 -0
  840. package/dist/transfer-WmWiR3xf.mjs +166 -0
  841. package/dist/transfer-WmWiR3xf.mjs.map +1 -0
  842. package/dist/transfer-download--ofRj9Cw.mjs +33 -0
  843. package/dist/transfer-download--ofRj9Cw.mjs.map +1 -0
  844. package/dist/transformations-Bx4lYY0Y.mjs +196 -0
  845. package/dist/transformations-Bx4lYY0Y.mjs.map +1 -0
  846. package/dist/transport-BjbqNiPI.mjs +136 -0
  847. package/dist/transport-BjbqNiPI.mjs.map +1 -0
  848. package/dist/transport-DxiXnbXk.d.mts +42 -0
  849. package/dist/transport-DxiXnbXk.d.mts.map +1 -0
  850. package/dist/trusted-proxy-BU3Nx9g1.mjs +51 -0
  851. package/dist/trusted-proxy-BU3Nx9g1.mjs.map +1 -0
  852. package/dist/turnstile-CJwvsOqw.mjs +58 -0
  853. package/dist/turnstile-CJwvsOqw.mjs.map +1 -0
  854. package/dist/types-BA3ey2QH.d.mts +87 -0
  855. package/dist/types-BA3ey2QH.d.mts.map +1 -0
  856. package/dist/types-Bwpzb5o6.d.mts +227 -0
  857. package/dist/types-Bwpzb5o6.d.mts.map +1 -0
  858. package/dist/types-CNB-dj6F.d.mts +289 -0
  859. package/dist/types-CNB-dj6F.d.mts.map +1 -0
  860. package/dist/types-CgfFGfO5.mjs +16 -0
  861. package/dist/types-CgfFGfO5.mjs.map +1 -0
  862. package/dist/types-D2NEXtgB.mjs +127 -0
  863. package/dist/types-D2NEXtgB.mjs.map +1 -0
  864. package/dist/types-DCFavOii.d.mts +916 -0
  865. package/dist/types-DCFavOii.d.mts.map +1 -0
  866. package/dist/types-DHO7Pd25.d.mts +366 -0
  867. package/dist/types-DHO7Pd25.d.mts.map +1 -0
  868. package/dist/types-DvqVxZXa.d.mts +125 -0
  869. package/dist/types-DvqVxZXa.d.mts.map +1 -0
  870. package/dist/types-QoPHm-2w.d.mts +1741 -0
  871. package/dist/types-QoPHm-2w.d.mts.map +1 -0
  872. package/dist/types-RLgeIpnF.d.mts +374 -0
  873. package/dist/types-RLgeIpnF.d.mts.map +1 -0
  874. package/dist/types-qHVygneX.mjs +77 -0
  875. package/dist/types-qHVygneX.mjs.map +1 -0
  876. package/dist/types-sUHaH7lC.mjs +37 -0
  877. package/dist/types-sUHaH7lC.mjs.map +1 -0
  878. package/dist/types-slSqujQL.d.mts +204 -0
  879. package/dist/types-slSqujQL.d.mts.map +1 -0
  880. package/dist/update-check-BxNg9T6N.mjs +161 -0
  881. package/dist/update-check-BxNg9T6N.mjs.map +1 -0
  882. package/dist/upload-attempts-DPFC4COv.mjs +32 -0
  883. package/dist/upload-attempts-DPFC4COv.mjs.map +1 -0
  884. package/dist/url-pattern-QATUE_rv.mjs +41 -0
  885. package/dist/url-pattern-QATUE_rv.mjs.map +1 -0
  886. package/dist/user-BlCTKVAm.mjs +171 -0
  887. package/dist/user-BlCTKVAm.mjs.map +1 -0
  888. package/dist/utils-TPt7w2cS.mjs +442 -0
  889. package/dist/utils-TPt7w2cS.mjs.map +1 -0
  890. package/dist/validate-DxYhJQA-.mjs +524 -0
  891. package/dist/validate-DxYhJQA-.mjs.map +1 -0
  892. package/dist/validate-emKxGC5F.d.mts +468 -0
  893. package/dist/validate-emKxGC5F.d.mts.map +1 -0
  894. package/dist/validation-Ckq4vsVg.mjs +220 -0
  895. package/dist/validation-Ckq4vsVg.mjs.map +1 -0
  896. package/dist/version-BZj18Q7G.mjs +9 -0
  897. package/dist/version-BZj18Q7G.mjs.map +1 -0
  898. package/dist/version-DHmGpcch.mjs +7 -0
  899. package/dist/version-DHmGpcch.mjs.map +1 -0
  900. package/dist/video-DytCnw3L.mjs +54 -0
  901. package/dist/video-DytCnw3L.mjs.map +1 -0
  902. package/dist/virtual-modules-DO954n7P.mjs +515 -0
  903. package/dist/virtual-modules-DO954n7P.mjs.map +1 -0
  904. package/dist/widgets-DA5XmvVC.mjs +121 -0
  905. package/dist/widgets-DA5XmvVC.mjs.map +1 -0
  906. package/dist/wxr-taxonomies-CrMonejI.d.mts +34 -0
  907. package/dist/wxr-taxonomies-CrMonejI.d.mts.map +1 -0
  908. package/dist/wxr-taxonomies-RgRG0d5e.mjs +453 -0
  909. package/dist/wxr-taxonomies-RgRG0d5e.mjs.map +1 -0
  910. package/dist/zod-generator-D0JKy94C.mjs +424 -0
  911. package/dist/zod-generator-D0JKy94C.mjs.map +1 -0
  912. package/package.json +7 -6
  913. package/src/api/authorize.ts +42 -0
  914. package/src/api/handlers/dashboard.ts +33 -10
  915. package/src/api/handlers/manifest.ts +1 -0
  916. package/src/api/handlers/plugins.ts +1 -0
  917. package/src/api/handlers/revision.ts +6 -2
  918. package/src/api/handlers/site-domain.ts +26 -10
  919. package/src/api/schemas/settings.ts +2 -0
  920. package/src/api/types.ts +2 -0
  921. package/src/astro/integration/dev-scheduler-bridge.ts +91 -0
  922. package/src/astro/integration/index.ts +48 -1
  923. package/src/astro/integration/routes.ts +8 -0
  924. package/src/astro/integration/runtime.ts +2 -1
  925. package/src/astro/integration/virtual-modules.ts +9 -16
  926. package/src/astro/integration/vite-config.ts +4 -15
  927. package/src/astro/middleware/auth.ts +3 -1
  928. package/src/astro/middleware/redirect.ts +71 -42
  929. package/src/astro/middleware.ts +18 -3
  930. package/src/astro/prefetch.ts +7 -5
  931. package/src/astro/public-plugin-api-routes.ts +10 -2
  932. package/src/astro/routes/api/admin/plugins/registry/artifact.ts +1 -1
  933. package/src/astro/routes/api/content/[collection]/[id]/discard-draft.ts +2 -1
  934. package/src/astro/routes/api/content/[collection]/[id]/duplicate.ts +1 -5
  935. package/src/astro/routes/api/content/[collection]/[id]/lock.ts +2 -2
  936. package/src/astro/routes/api/content/[collection]/[id]/permanent.ts +2 -1
  937. package/src/astro/routes/api/content/[collection]/[id]/publish.ts +2 -1
  938. package/src/astro/routes/api/content/[collection]/[id]/restore.ts +2 -1
  939. package/src/astro/routes/api/content/[collection]/[id]/schedule.ts +3 -2
  940. package/src/astro/routes/api/content/[collection]/[id]/terms/[taxonomy].ts +5 -4
  941. package/src/astro/routes/api/content/[collection]/[id]/unpublish.ts +2 -1
  942. package/src/astro/routes/api/content/[collection]/[id].ts +18 -6
  943. package/src/astro/routes/api/content/[collection]/index.ts +1 -5
  944. package/src/astro/routes/api/dashboard.ts +4 -1
  945. package/src/astro/routes/api/dev/scheduled-tasks.ts +20 -0
  946. package/src/astro/routes/api/import/wordpress/analyze.ts +1 -16
  947. package/src/astro/routes/api/import/wordpress/execute.ts +8 -3
  948. package/src/astro/routes/api/import/wordpress-plugin/analyze.ts +4 -1
  949. package/src/astro/routes/api/import/wordpress-plugin/execute.ts +34 -5
  950. package/src/astro/routes/api/menus/[name]/items/[id].ts +3 -2
  951. package/src/astro/routes/api/menus/[name]/items.ts +2 -1
  952. package/src/astro/routes/api/menus/[name]/reorder.ts +2 -1
  953. package/src/astro/routes/api/menus/[name]/translations.ts +2 -1
  954. package/src/astro/routes/api/menus/[name].ts +3 -2
  955. package/src/astro/routes/api/menus/index.ts +2 -1
  956. package/src/astro/routes/api/redirects/[id].ts +15 -2
  957. package/src/astro/routes/api/redirects/index.ts +5 -1
  958. package/src/astro/routes/api/settings/domain.ts +2 -1
  959. package/src/astro/routes/api/settings.ts +2 -1
  960. package/src/astro/routes/api/setup/admin-verify.ts +7 -1
  961. package/src/astro/routes/api/taxonomies/[name]/reorder.ts +2 -1
  962. package/src/astro/routes/api/taxonomies/[name]/terms/[slug]/translations.ts +2 -1
  963. package/src/astro/routes/api/taxonomies/[name]/terms/[slug].ts +3 -2
  964. package/src/astro/routes/api/taxonomies/[name]/terms/index.ts +2 -1
  965. package/src/astro/routes/api/taxonomies/[name].ts +3 -2
  966. package/src/astro/routes/api/taxonomies/index.ts +2 -1
  967. package/src/astro/routes/api/widget-areas/[name]/reorder.ts +2 -1
  968. package/src/astro/routes/api/widget-areas/[name]/widgets/[id].ts +3 -2
  969. package/src/astro/routes/api/widget-areas/[name]/widgets.ts +2 -1
  970. package/src/astro/routes/api/widget-areas/[name].ts +2 -1
  971. package/src/astro/routes/api/widget-areas/index.ts +2 -1
  972. package/src/astro/routes/robots.txt.ts +33 -2
  973. package/src/astro/types.ts +10 -1
  974. package/src/auth/types.ts +4 -4
  975. package/src/cache/redirect-paths.ts +56 -0
  976. package/src/cache/route-cache.ts +22 -0
  977. package/src/cli/commands/import/wordpress.ts +3 -27
  978. package/src/cli/commands/login.ts +35 -43
  979. package/src/cli/commands/migrate.ts +36 -4
  980. package/src/cli/commands/seed.ts +18 -8
  981. package/src/cli/wxr/parser.ts +2 -2
  982. package/src/client/index.ts +12 -2
  983. package/src/client/portable-text.ts +21 -7
  984. package/src/comments/query.ts +8 -2
  985. package/src/components/CommentForm.astro +2 -2
  986. package/src/components/Comments.astro +1 -1
  987. package/src/components/InlinePortableTextEditor.tsx +152 -1325
  988. package/src/components/inline-block-types.ts +278 -0
  989. package/src/components/inline-bubble-menu.tsx +696 -0
  990. package/src/components/inline-editor-ui.tsx +1192 -0
  991. package/src/components/inline-image.tsx +722 -0
  992. package/src/components/inline-media-picker.tsx +1221 -0
  993. package/src/components/inline-slash-menu.tsx +556 -0
  994. package/src/database/collection-cleanup.ts +30 -0
  995. package/src/database/datetime-storage.ts +337 -60
  996. package/src/database/migration-lock.ts +43 -7
  997. package/src/database/repositories/content.ts +3 -1
  998. package/src/database/repositories/plugin-storage.ts +109 -8
  999. package/src/database/repositories/revision.ts +24 -6
  1000. package/src/database/repositories/types.ts +65 -7
  1001. package/src/emdash-runtime.ts +176 -160
  1002. package/src/import/index.ts +1 -0
  1003. package/src/import/registry.ts +17 -0
  1004. package/src/import/sources/wordpress-plugin.ts +151 -9
  1005. package/src/import/types.ts +3 -0
  1006. package/src/import/utils.ts +5 -0
  1007. package/src/loader.ts +36 -2
  1008. package/src/mcp/json-schema.ts +14 -0
  1009. package/src/mcp/plugin-tool-name.ts +36 -0
  1010. package/src/mcp/server.ts +74 -15
  1011. package/src/media/usage/collection-deletion.ts +4 -0
  1012. package/src/migrations/direct-executor.ts +42 -12
  1013. package/src/migrations/protocol.ts +6 -2
  1014. package/src/plugins/adapt-sandbox-entry.ts +16 -6
  1015. package/src/plugins/state.ts +5 -8
  1016. package/src/query.ts +51 -10
  1017. package/src/redirects/cache.ts +34 -2
  1018. package/src/schema/block-values.ts +80 -17
  1019. package/src/schema/registry.ts +9 -1
  1020. package/src/search/query.ts +3 -1
  1021. package/src/seed/apply.ts +32 -8
  1022. package/src/settings/index.ts +20 -0
  1023. package/src/settings/types.ts +2 -0
  1024. package/src/visual-editing/toolbar.ts +46 -12
  1025. package/dist/action-token-BdWad2YG.mjs +0 -26
  1026. package/dist/action-token-BdWad2YG.mjs.map +0 -1
  1027. package/dist/activation-xomsCMJg.mjs +0 -387
  1028. package/dist/activation-xomsCMJg.mjs.map +0 -1
  1029. package/dist/adapters-B4-nbElt.d.mts +0 -173
  1030. package/dist/adapters-B4-nbElt.d.mts.map +0 -1
  1031. package/dist/allowed-origins-CLpHGGlc.mjs +0 -116
  1032. package/dist/allowed-origins-CLpHGGlc.mjs.map +0 -1
  1033. package/dist/api-DBw_IWoi.mjs +0 -5024
  1034. package/dist/api-DBw_IWoi.mjs.map +0 -1
  1035. package/dist/api-tokens-B0ZipcZ-.mjs +0 -173
  1036. package/dist/api-tokens-B0ZipcZ-.mjs.map +0 -1
  1037. package/dist/apply-Cx48saFC.mjs +0 -1680
  1038. package/dist/apply-Cx48saFC.mjs.map +0 -1
  1039. package/dist/approvals-BXgtXA2s.mjs +0 -460
  1040. package/dist/approvals-BXgtXA2s.mjs.map +0 -1
  1041. package/dist/artifact-fetch-DsRczRGG.mjs +0 -659
  1042. package/dist/artifact-fetch-DsRczRGG.mjs.map +0 -1
  1043. package/dist/artifacts-D-O-qj9C.mjs +0 -307
  1044. package/dist/artifacts-D-O-qj9C.mjs.map +0 -1
  1045. package/dist/audit-CCH3MA4Y.mjs +0 -127
  1046. package/dist/audit-CCH3MA4Y.mjs.map +0 -1
  1047. package/dist/authoritative-records-Dcs7l2H5.mjs +0 -5183
  1048. package/dist/authoritative-records-Dcs7l2H5.mjs.map +0 -1
  1049. package/dist/authorize-TdIGpRSE.mjs +0 -49
  1050. package/dist/authorize-TdIGpRSE.mjs.map +0 -1
  1051. package/dist/backup-CZt5Mzwx.mjs +0 -246
  1052. package/dist/backup-CZt5Mzwx.mjs.map +0 -1
  1053. package/dist/block-types-DHnkzE6u.mjs +0 -132
  1054. package/dist/block-types-DHnkzE6u.mjs.map +0 -1
  1055. package/dist/block-values-C4N_F2-G.mjs +0 -175
  1056. package/dist/block-values-C4N_F2-G.mjs.map +0 -1
  1057. package/dist/byline-BmVKOQ8l.mjs +0 -909
  1058. package/dist/byline-BmVKOQ8l.mjs.map +0 -1
  1059. package/dist/byline-fields-B8SDs3M_.mjs +0 -123
  1060. package/dist/byline-fields-B8SDs3M_.mjs.map +0 -1
  1061. package/dist/byline-fields-Bze3ZdAw.mjs +0 -280
  1062. package/dist/byline-fields-Bze3ZdAw.mjs.map +0 -1
  1063. package/dist/bylines-CHhR28r9.mjs +0 -150
  1064. package/dist/bylines-CHhR28r9.mjs.map +0 -1
  1065. package/dist/bylines-DZS4OflA.mjs +0 -234
  1066. package/dist/bylines-DZS4OflA.mjs.map +0 -1
  1067. package/dist/cache-x0z8t_m9.mjs +0 -133
  1068. package/dist/cache-x0z8t_m9.mjs.map +0 -1
  1069. package/dist/canonical-BUcKRYpG.mjs +0 -174
  1070. package/dist/canonical-BUcKRYpG.mjs.map +0 -1
  1071. package/dist/capture-triggers-C9JKoIdT.mjs +0 -362
  1072. package/dist/capture-triggers-C9JKoIdT.mjs.map +0 -1
  1073. package/dist/challenge-store-BHgdPVze.mjs +0 -51
  1074. package/dist/challenge-store-BHgdPVze.mjs.map +0 -1
  1075. package/dist/checksum-BYR5i7qe.mjs +0 -162
  1076. package/dist/checksum-BYR5i7qe.mjs.map +0 -1
  1077. package/dist/chunks-Dr5Vr0zA.mjs +0 -25
  1078. package/dist/chunks-Dr5Vr0zA.mjs.map +0 -1
  1079. package/dist/collection-slugs-cache-B2Gs9Jwx.mjs +0 -85
  1080. package/dist/collection-slugs-cache-B2Gs9Jwx.mjs.map +0 -1
  1081. package/dist/comment-CWla6OHV.mjs +0 -325
  1082. package/dist/comment-CWla6OHV.mjs.map +0 -1
  1083. package/dist/comment-reaction-RZrcs5cW.mjs +0 -85
  1084. package/dist/comment-reaction-RZrcs5cW.mjs.map +0 -1
  1085. package/dist/comments-BzmIKVb2.mjs +0 -99
  1086. package/dist/comments-BzmIKVb2.mjs.map +0 -1
  1087. package/dist/comments-Da_dI2O1.mjs +0 -195
  1088. package/dist/comments-Da_dI2O1.mjs.map +0 -1
  1089. package/dist/components-oFXumpf5.mjs +0 -112
  1090. package/dist/components-oFXumpf5.mjs.map +0 -1
  1091. package/dist/config--wamYxBW.d.mts +0 -39
  1092. package/dist/config--wamYxBW.d.mts.map +0 -1
  1093. package/dist/config-Bo4eOOdV.mjs +0 -228
  1094. package/dist/config-Bo4eOOdV.mjs.map +0 -1
  1095. package/dist/config-C4-UxIk7.d.mts +0 -6790
  1096. package/dist/config-C4-UxIk7.d.mts.map +0 -1
  1097. package/dist/connection-UpzYxtE2.mjs +0 -36
  1098. package/dist/connection-UpzYxtE2.mjs.map +0 -1
  1099. package/dist/content-CcHrqkgp.mjs +0 -2072
  1100. package/dist/content-CcHrqkgp.mjs.map +0 -1
  1101. package/dist/content-list-query-Bxxdd9fv.d.mts +0 -26
  1102. package/dist/content-list-query-Bxxdd9fv.d.mts.map +0 -1
  1103. package/dist/content-repair-havk1F0-.mjs +0 -442
  1104. package/dist/content-repair-havk1F0-.mjs.map +0 -1
  1105. package/dist/context-CvhgHgSH.mjs +0 -2043
  1106. package/dist/context-CvhgHgSH.mjs.map +0 -1
  1107. package/dist/credits-CygUrPOi.mjs +0 -110
  1108. package/dist/credits-CygUrPOi.mjs.map +0 -1
  1109. package/dist/cron-C6ytTOLw.mjs +0 -306
  1110. package/dist/cron-C6ytTOLw.mjs.map +0 -1
  1111. package/dist/dashboard-7_FYfafc.mjs +0 -151
  1112. package/dist/dashboard-7_FYfafc.mjs.map +0 -1
  1113. package/dist/default-CHCUkV4Z.mjs +0 -81
  1114. package/dist/default-CHCUkV4Z.mjs.map +0 -1
  1115. package/dist/deferred-tasks-G0xhcJTl.d.mts +0 -9
  1116. package/dist/deferred-tasks-G0xhcJTl.d.mts.map +0 -1
  1117. package/dist/dev-typegen-Dtl8AfS6.mjs +0 -29
  1118. package/dist/dev-typegen-Dtl8AfS6.mjs.map +0 -1
  1119. package/dist/device-flow-CzDJmQ1q.mjs +0 -521
  1120. package/dist/device-flow-CzDJmQ1q.mjs.map +0 -1
  1121. package/dist/digest-xJmyPv2r.mjs +0 -194
  1122. package/dist/digest-xJmyPv2r.mjs.map +0 -1
  1123. package/dist/direct-executor-BXiYIVJ9.mjs +0 -104
  1124. package/dist/direct-executor-BXiYIVJ9.mjs.map +0 -1
  1125. package/dist/email-console-7ZPApLlm.mjs +0 -50
  1126. package/dist/email-console-7ZPApLlm.mjs.map +0 -1
  1127. package/dist/email-locale-DFdUA6UF.mjs +0 -25
  1128. package/dist/email-locale-DFdUA6UF.mjs.map +0 -1
  1129. package/dist/emdash-runtime-C4oFeVpN.mjs +0 -4363
  1130. package/dist/emdash-runtime-C4oFeVpN.mjs.map +0 -1
  1131. package/dist/entry-lock-B4n0HdQ_.mjs +0 -163
  1132. package/dist/entry-lock-B4n0HdQ_.mjs.map +0 -1
  1133. package/dist/entry-lock-BAAlKYrz.d.mts +0 -4566
  1134. package/dist/entry-lock-BAAlKYrz.d.mts.map +0 -1
  1135. package/dist/entry-lock-Cjz0h45X.mjs +0 -1209
  1136. package/dist/entry-lock-Cjz0h45X.mjs.map +0 -1
  1137. package/dist/env-types-4bkF6Bqg.mjs +0 -38
  1138. package/dist/env-types-4bkF6Bqg.mjs.map +0 -1
  1139. package/dist/error-DxgQdaZ_.mjs +0 -90
  1140. package/dist/error-DxgQdaZ_.mjs.map +0 -1
  1141. package/dist/errors-CjtE5aWF.mjs +0 -120
  1142. package/dist/errors-CjtE5aWF.mjs.map +0 -1
  1143. package/dist/errors-hskQ0C8G.mjs +0 -479
  1144. package/dist/errors-hskQ0C8G.mjs.map +0 -1
  1145. package/dist/escape-ESFhYzwG.mjs +0 -9
  1146. package/dist/escape-ESFhYzwG.mjs.map +0 -1
  1147. package/dist/fence-vc3aHgRA.mjs +0 -162
  1148. package/dist/fence-vc3aHgRA.mjs.map +0 -1
  1149. package/dist/field-defs-cache-zoow36nz.mjs +0 -77
  1150. package/dist/field-defs-cache-zoow36nz.mjs.map +0 -1
  1151. package/dist/field-map-JD1wG0Tq.mjs +0 -83
  1152. package/dist/field-map-JD1wG0Tq.mjs.map +0 -1
  1153. package/dist/fts-manager-WJCN8uU6.mjs +0 -443
  1154. package/dist/fts-manager-WJCN8uU6.mjs.map +0 -1
  1155. package/dist/gc-CsGZiKdH.mjs +0 -75
  1156. package/dist/gc-CsGZiKdH.mjs.map +0 -1
  1157. package/dist/hash-C4DFoJ7Z.mjs +0 -37
  1158. package/dist/hash-C4DFoJ7Z.mjs.map +0 -1
  1159. package/dist/hook-result-CXjtMk7Q.d.mts +0 -31
  1160. package/dist/hook-result-CXjtMk7Q.d.mts.map +0 -1
  1161. package/dist/hreflang-BAma7iRr.mjs +0 -105
  1162. package/dist/hreflang-BAma7iRr.mjs.map +0 -1
  1163. package/dist/hreflang-BsYo4x_M.d.mts +0 -50
  1164. package/dist/hreflang-BsYo4x_M.d.mts.map +0 -1
  1165. package/dist/http-route-dispatch-C8G7hAK6.mjs +0 -342
  1166. package/dist/http-route-dispatch-C8G7hAK6.mjs.map +0 -1
  1167. package/dist/identity-BwBKM1fH.mjs +0 -35
  1168. package/dist/identity-BwBKM1fH.mjs.map +0 -1
  1169. package/dist/import-DJ3Z2wxE.mjs +0 -2021
  1170. package/dist/import-DJ3Z2wxE.mjs.map +0 -1
  1171. package/dist/index-DYsn97dY.d.mts +0 -623
  1172. package/dist/index-DYsn97dY.d.mts.map +0 -1
  1173. package/dist/install-finalization-DCFnFSHv.mjs +0 -58
  1174. package/dist/install-finalization-DCFnFSHv.mjs.map +0 -1
  1175. package/dist/keys-CGvAndSp.mjs +0 -61
  1176. package/dist/keys-CGvAndSp.mjs.map +0 -1
  1177. package/dist/kinds-DT1W4T4Y.mjs +0 -974
  1178. package/dist/kinds-DT1W4T4Y.mjs.map +0 -1
  1179. package/dist/lifecycle-BzglCSY0.mjs +0 -25
  1180. package/dist/lifecycle-BzglCSY0.mjs.map +0 -1
  1181. package/dist/load-DjUqmf3s.mjs +0 -28
  1182. package/dist/load-DjUqmf3s.mjs.map +0 -1
  1183. package/dist/loader-CetY659y.mjs +0 -1355
  1184. package/dist/loader-CetY659y.mjs.map +0 -1
  1185. package/dist/loops-DkT1zkPH.mjs +0 -205
  1186. package/dist/loops-DkT1zkPH.mjs.map +0 -1
  1187. package/dist/manifest-builder-BOFCd9rX.mjs +0 -189
  1188. package/dist/manifest-builder-BOFCd9rX.mjs.map +0 -1
  1189. package/dist/manifest-schema-BiFBPEsp.mjs +0 -497
  1190. package/dist/manifest-schema-BiFBPEsp.mjs.map +0 -1
  1191. package/dist/marketplace-CUlenvZm.mjs +0 -257
  1192. package/dist/marketplace-CUlenvZm.mjs.map +0 -1
  1193. package/dist/media-CRKsKlfK.mjs +0 -416
  1194. package/dist/media-CRKsKlfK.mjs.map +0 -1
  1195. package/dist/media-C_z7sRuC.mjs +0 -294
  1196. package/dist/media-C_z7sRuC.mjs.map +0 -1
  1197. package/dist/media-IT8hQleU.mjs +0 -373
  1198. package/dist/media-IT8hQleU.mjs.map +0 -1
  1199. package/dist/media-allowlist-Ct6wvnT2.mjs +0 -45
  1200. package/dist/media-allowlist-Ct6wvnT2.mjs.map +0 -1
  1201. package/dist/media-folders-DtMt-vAA.mjs +0 -210
  1202. package/dist/media-folders-DtMt-vAA.mjs.map +0 -1
  1203. package/dist/media-url-BpXLqCmf.mjs +0 -43
  1204. package/dist/media-url-BpXLqCmf.mjs.map +0 -1
  1205. package/dist/media-usage-DEPHZZ9X.mjs +0 -282
  1206. package/dist/media-usage-DEPHZZ9X.mjs.map +0 -1
  1207. package/dist/media-usage-activation-V2Siabtw.mjs +0 -78
  1208. package/dist/media-usage-activation-V2Siabtw.mjs.map +0 -1
  1209. package/dist/media-usage-work-Cv1OE59F.mjs +0 -151
  1210. package/dist/media-usage-work-Cv1OE59F.mjs.map +0 -1
  1211. package/dist/media-usage-work-cgDYGvrt.mjs +0 -1015
  1212. package/dist/media-usage-work-cgDYGvrt.mjs.map +0 -1
  1213. package/dist/menus-CvVYfsuk.mjs +0 -753
  1214. package/dist/menus-CvVYfsuk.mjs.map +0 -1
  1215. package/dist/menus-D1HC8npj.mjs +0 -92
  1216. package/dist/menus-D1HC8npj.mjs.map +0 -1
  1217. package/dist/menus-DL8IPIcm.mjs +0 -3721
  1218. package/dist/menus-DL8IPIcm.mjs.map +0 -1
  1219. package/dist/mode-eieqAWLe.mjs +0 -23
  1220. package/dist/mode-eieqAWLe.mjs.map +0 -1
  1221. package/dist/node-sqlite-compat-VuyzJw1b.mjs +0 -63
  1222. package/dist/node-sqlite-compat-VuyzJw1b.mjs.map +0 -1
  1223. package/dist/oauth-authorization-B6ZJbMd2.mjs +0 -274
  1224. package/dist/oauth-authorization-B6ZJbMd2.mjs.map +0 -1
  1225. package/dist/oauth-clients-DVjRc9v3.mjs +0 -266
  1226. package/dist/oauth-clients-DVjRc9v3.mjs.map +0 -1
  1227. package/dist/oauth-state-store-CnmYYsVQ.mjs +0 -50
  1228. package/dist/oauth-state-store-CnmYYsVQ.mjs.map +0 -1
  1229. package/dist/oauth-user-lookup-Dz1_R5vT.mjs +0 -26
  1230. package/dist/oauth-user-lookup-Dz1_R5vT.mjs.map +0 -1
  1231. package/dist/options-BR9XZl7h.d.mts +0 -81
  1232. package/dist/options-BR9XZl7h.d.mts.map +0 -1
  1233. package/dist/ownership-COPyVysP.mjs +0 -12
  1234. package/dist/ownership-COPyVysP.mjs.map +0 -1
  1235. package/dist/parse-BOGhrwSq.d.mts +0 -174
  1236. package/dist/parse-BOGhrwSq.d.mts.map +0 -1
  1237. package/dist/parse-Cn5aSk1N.mjs +0 -81
  1238. package/dist/parse-Cn5aSk1N.mjs.map +0 -1
  1239. package/dist/passkey-config-mMFRQUCj.mjs +0 -46
  1240. package/dist/passkey-config-mMFRQUCj.mjs.map +0 -1
  1241. package/dist/paths-BmcAdBo9.mjs +0 -77
  1242. package/dist/paths-BmcAdBo9.mjs.map +0 -1
  1243. package/dist/placeholder-nOep3_Gn.d.mts +0 -306
  1244. package/dist/placeholder-nOep3_Gn.d.mts.map +0 -1
  1245. package/dist/plan-CDY4K8CH.mjs +0 -135
  1246. package/dist/plan-CDY4K8CH.mjs.map +0 -1
  1247. package/dist/plugins-DFBpfbO3.mjs +0 -261
  1248. package/dist/plugins-DFBpfbO3.mjs.map +0 -1
  1249. package/dist/policy-B_2qnHSy.mjs +0 -45
  1250. package/dist/policy-B_2qnHSy.mjs.map +0 -1
  1251. package/dist/portable-text-Dc2YAusw.mjs +0 -307
  1252. package/dist/portable-text-Dc2YAusw.mjs.map +0 -1
  1253. package/dist/preview-BtzikJ9O.mjs +0 -107
  1254. package/dist/preview-BtzikJ9O.mjs.map +0 -1
  1255. package/dist/protocol-M268ox8L.d.mts +0 -61
  1256. package/dist/protocol-M268ox8L.d.mts.map +0 -1
  1257. package/dist/public-submission-BQZavgZU.mjs +0 -251
  1258. package/dist/public-submission-BQZavgZU.mjs.map +0 -1
  1259. package/dist/public-url-uT1Ok2Tu.mjs +0 -101
  1260. package/dist/public-url-uT1Ok2Tu.mjs.map +0 -1
  1261. package/dist/query-BGG3sDEd.mjs +0 -1127
  1262. package/dist/query-BGG3sDEd.mjs.map +0 -1
  1263. package/dist/query-C_CWlifp.mjs +0 -41
  1264. package/dist/query-C_CWlifp.mjs.map +0 -1
  1265. package/dist/range-CXK_kDbI.mjs +0 -51
  1266. package/dist/range-CXK_kDbI.mjs.map +0 -1
  1267. package/dist/rate-limit-Dvamvay-.mjs +0 -127
  1268. package/dist/rate-limit-Dvamvay-.mjs.map +0 -1
  1269. package/dist/receipt-BmQGzquP.mjs +0 -43
  1270. package/dist/receipt-BmQGzquP.mjs.map +0 -1
  1271. package/dist/redirect-B39kTQ_0.mjs +0 -423
  1272. package/dist/redirect-B39kTQ_0.mjs.map +0 -1
  1273. package/dist/redirect-BguJ00Pv.mjs +0 -19
  1274. package/dist/redirect-BguJ00Pv.mjs.map +0 -1
  1275. package/dist/redirects-C8G4BsfP.mjs +0 -446
  1276. package/dist/redirects-C8G4BsfP.mjs.map +0 -1
  1277. package/dist/redirects-DFT7Wr-e.mjs +0 -148
  1278. package/dist/redirects-DFT7Wr-e.mjs.map +0 -1
  1279. package/dist/registry-DeZ27gVi.mjs +0 -8374
  1280. package/dist/registry-DeZ27gVi.mjs.map +0 -1
  1281. package/dist/relations-DBB1bRJW.mjs +0 -776
  1282. package/dist/relations-DBB1bRJW.mjs.map +0 -1
  1283. package/dist/request-meta-BSvkhIBX.mjs +0 -141
  1284. package/dist/request-meta-BSvkhIBX.mjs.map +0 -1
  1285. package/dist/resolve-BxH64HN9.mjs +0 -100
  1286. package/dist/resolve-BxH64HN9.mjs.map +0 -1
  1287. package/dist/revision-BWEH2qQB.mjs +0 -368
  1288. package/dist/revision-BWEH2qQB.mjs.map +0 -1
  1289. package/dist/route-wire-CwbWB_6O.mjs +0 -197
  1290. package/dist/route-wire-CwbWB_6O.mjs.map +0 -1
  1291. package/dist/routes-BfIxc7ft.mjs +0 -272
  1292. package/dist/routes-BfIxc7ft.mjs.map +0 -1
  1293. package/dist/runner-DkeafPBA.d.mts +0 -68
  1294. package/dist/runner-DkeafPBA.d.mts.map +0 -1
  1295. package/dist/runner-wqt4BrIW.mjs +0 -6383
  1296. package/dist/runner-wqt4BrIW.mjs.map +0 -1
  1297. package/dist/schema-BXIW-JHi.mjs +0 -815
  1298. package/dist/schema-BXIW-JHi.mjs.map +0 -1
  1299. package/dist/schema-I74JwYte.mjs +0 -13
  1300. package/dist/schema-I74JwYte.mjs.map +0 -1
  1301. package/dist/scopes-RWZ5ft_Z.mjs +0 -34
  1302. package/dist/scopes-RWZ5ft_Z.mjs.map +0 -1
  1303. package/dist/search-DxwagyWS.mjs +0 -450
  1304. package/dist/search-DxwagyWS.mjs.map +0 -1
  1305. package/dist/sections-Ccq9ZgyD.mjs +0 -346
  1306. package/dist/sections-Ccq9ZgyD.mjs.map +0 -1
  1307. package/dist/seo-CCnfPWAQ.mjs +0 -133
  1308. package/dist/seo-CCnfPWAQ.mjs.map +0 -1
  1309. package/dist/seo-QCtJ1jjV.mjs +0 -188
  1310. package/dist/seo-QCtJ1jjV.mjs.map +0 -1
  1311. package/dist/service-DX84s2rw.mjs +0 -150
  1312. package/dist/service-DX84s2rw.mjs.map +0 -1
  1313. package/dist/session-user-1dtJc2zv.mjs +0 -61
  1314. package/dist/session-user-1dtJc2zv.mjs.map +0 -1
  1315. package/dist/settings-B1jOxAIl.mjs +0 -443
  1316. package/dist/settings-B1jOxAIl.mjs.map +0 -1
  1317. package/dist/settings-Bc1IBl1t.mjs +0 -66
  1318. package/dist/settings-Bc1IBl1t.mjs.map +0 -1
  1319. package/dist/settings-GaZ5sVgg.mjs +0 -73
  1320. package/dist/settings-GaZ5sVgg.mjs.map +0 -1
  1321. package/dist/setup-complete-DidMAWJS.mjs +0 -65
  1322. package/dist/setup-complete-DidMAWJS.mjs.map +0 -1
  1323. package/dist/setup-nonce-DKl4S4c6.mjs +0 -25
  1324. package/dist/setup-nonce-DKl4S4c6.mjs.map +0 -1
  1325. package/dist/site-domain-CbI51Pc2.mjs +0 -113
  1326. package/dist/site-domain-CbI51Pc2.mjs.map +0 -1
  1327. package/dist/site-settings-CDdT4mVm.mjs +0 -50
  1328. package/dist/site-settings-CDdT4mVm.mjs.map +0 -1
  1329. package/dist/site-url-CrDZaAvo.mjs +0 -45
  1330. package/dist/site-url-CrDZaAvo.mjs.map +0 -1
  1331. package/dist/sitemap-name-W3BTor6X.mjs +0 -26
  1332. package/dist/sitemap-name-W3BTor6X.mjs.map +0 -1
  1333. package/dist/slug-BJhHKoOH.mjs +0 -16
  1334. package/dist/slug-BJhHKoOH.mjs.map +0 -1
  1335. package/dist/snapshot-BuI_2uDe.mjs +0 -414
  1336. package/dist/snapshot-BuI_2uDe.mjs.map +0 -1
  1337. package/dist/ssrf-LM_0wpGA.mjs +0 -406
  1338. package/dist/ssrf-LM_0wpGA.mjs.map +0 -1
  1339. package/dist/stage-DhzZuYaT.mjs +0 -662
  1340. package/dist/stage-DhzZuYaT.mjs.map +0 -1
  1341. package/dist/staged-DboEaWsV.mjs +0 -686
  1342. package/dist/staged-DboEaWsV.mjs.map +0 -1
  1343. package/dist/state-DCXDzjHq.mjs +0 -178
  1344. package/dist/state-DCXDzjHq.mjs.map +0 -1
  1345. package/dist/status-Dl85BK39.mjs +0 -30
  1346. package/dist/status-Dl85BK39.mjs.map +0 -1
  1347. package/dist/storage-query-BOBmeDMD.d.mts +0 -1615
  1348. package/dist/storage-query-BOBmeDMD.d.mts.map +0 -1
  1349. package/dist/tar-K40edFMt.mjs +0 -449
  1350. package/dist/tar-K40edFMt.mjs.map +0 -1
  1351. package/dist/target-BOighEY1.mjs +0 -27
  1352. package/dist/target-BOighEY1.mjs.map +0 -1
  1353. package/dist/taxonomies-DQSywBvX.mjs +0 -697
  1354. package/dist/taxonomies-DQSywBvX.mjs.map +0 -1
  1355. package/dist/taxonomies-Dj5eaobC.mjs +0 -939
  1356. package/dist/taxonomies-Dj5eaobC.mjs.map +0 -1
  1357. package/dist/taxonomy-QrNmTfIZ.mjs +0 -550
  1358. package/dist/taxonomy-QrNmTfIZ.mjs.map +0 -1
  1359. package/dist/tokens-j5L0as2H.mjs +0 -171
  1360. package/dist/tokens-j5L0as2H.mjs.map +0 -1
  1361. package/dist/transfer-CYEw8Tu4.mjs +0 -8873
  1362. package/dist/transfer-CYEw8Tu4.mjs.map +0 -1
  1363. package/dist/transfer-DDX10hkD.mjs +0 -166
  1364. package/dist/transfer-DDX10hkD.mjs.map +0 -1
  1365. package/dist/transfer-download-BAqq6GJv.mjs +0 -33
  1366. package/dist/transfer-download-BAqq6GJv.mjs.map +0 -1
  1367. package/dist/transformations-De44wqV_.mjs +0 -196
  1368. package/dist/transformations-De44wqV_.mjs.map +0 -1
  1369. package/dist/transport-1QjUhCRO.d.mts +0 -42
  1370. package/dist/transport-1QjUhCRO.d.mts.map +0 -1
  1371. package/dist/transport-Ds5pVX7p.mjs +0 -136
  1372. package/dist/transport-Ds5pVX7p.mjs.map +0 -1
  1373. package/dist/trusted-proxy-d4Tk6biT.mjs +0 -51
  1374. package/dist/trusted-proxy-d4Tk6biT.mjs.map +0 -1
  1375. package/dist/turnstile-DaFLtyrs.mjs +0 -58
  1376. package/dist/turnstile-DaFLtyrs.mjs.map +0 -1
  1377. package/dist/types-B4-1P2DK.d.mts +0 -227
  1378. package/dist/types-B4-1P2DK.d.mts.map +0 -1
  1379. package/dist/types-BKXA0f-c.mjs +0 -16
  1380. package/dist/types-BKXA0f-c.mjs.map +0 -1
  1381. package/dist/types-BiHcpUoO.d.mts +0 -374
  1382. package/dist/types-BiHcpUoO.d.mts.map +0 -1
  1383. package/dist/types-BihhvkyN.d.mts +0 -85
  1384. package/dist/types-BihhvkyN.d.mts.map +0 -1
  1385. package/dist/types-Bq9Wohd7.d.mts +0 -363
  1386. package/dist/types-Bq9Wohd7.d.mts.map +0 -1
  1387. package/dist/types-C-Xp0CcN.mjs +0 -103
  1388. package/dist/types-C-Xp0CcN.mjs.map +0 -1
  1389. package/dist/types-C4P7F1Vq.d.mts +0 -1741
  1390. package/dist/types-C4P7F1Vq.d.mts.map +0 -1
  1391. package/dist/types-CGaqwHw4.mjs +0 -37
  1392. package/dist/types-CGaqwHw4.mjs.map +0 -1
  1393. package/dist/types-D4ECCE4X.mjs +0 -77
  1394. package/dist/types-D4ECCE4X.mjs.map +0 -1
  1395. package/dist/types-DcRJp0vS.d.mts +0 -125
  1396. package/dist/types-DcRJp0vS.d.mts.map +0 -1
  1397. package/dist/types-Ff85fTzU.d.mts +0 -289
  1398. package/dist/types-Ff85fTzU.d.mts.map +0 -1
  1399. package/dist/types-UKr5Sf4y.d.mts +0 -916
  1400. package/dist/types-UKr5Sf4y.d.mts.map +0 -1
  1401. package/dist/types-YpN8hZW7.d.mts +0 -204
  1402. package/dist/types-YpN8hZW7.d.mts.map +0 -1
  1403. package/dist/update-check-DrlsK-tt.mjs +0 -161
  1404. package/dist/update-check-DrlsK-tt.mjs.map +0 -1
  1405. package/dist/upload-attempts-D8CPPvRU.mjs +0 -32
  1406. package/dist/upload-attempts-D8CPPvRU.mjs.map +0 -1
  1407. package/dist/url-pattern-Di4Nn3vP.mjs +0 -41
  1408. package/dist/url-pattern-Di4Nn3vP.mjs.map +0 -1
  1409. package/dist/user-B-ZdGjhI.mjs +0 -171
  1410. package/dist/user-B-ZdGjhI.mjs.map +0 -1
  1411. package/dist/utils-D7wL3r6-.mjs +0 -437
  1412. package/dist/utils-D7wL3r6-.mjs.map +0 -1
  1413. package/dist/validate-BSZbSUDk.mjs +0 -524
  1414. package/dist/validate-BSZbSUDk.mjs.map +0 -1
  1415. package/dist/validate-Dfv0DpZi.d.mts +0 -468
  1416. package/dist/validate-Dfv0DpZi.d.mts.map +0 -1
  1417. package/dist/validation-DRyC_Vm5.mjs +0 -219
  1418. package/dist/validation-DRyC_Vm5.mjs.map +0 -1
  1419. package/dist/version-C4kz0PcO.mjs +0 -7
  1420. package/dist/version-C4kz0PcO.mjs.map +0 -1
  1421. package/dist/version-jhs2BRtl.mjs +0 -9
  1422. package/dist/version-jhs2BRtl.mjs.map +0 -1
  1423. package/dist/video-DReZ48Un.mjs +0 -54
  1424. package/dist/video-DReZ48Un.mjs.map +0 -1
  1425. package/dist/virtual-modules-D0e6VbEv.mjs +0 -516
  1426. package/dist/virtual-modules-D0e6VbEv.mjs.map +0 -1
  1427. package/dist/widgets-BkcMzKct.mjs +0 -121
  1428. package/dist/widgets-BkcMzKct.mjs.map +0 -1
  1429. package/dist/wxr-taxonomies-BxI0CbTg.mjs +0 -453
  1430. package/dist/wxr-taxonomies-BxI0CbTg.mjs.map +0 -1
  1431. package/dist/wxr-taxonomies-Dad33GJi.d.mts +0 -34
  1432. package/dist/wxr-taxonomies-Dad33GJi.d.mts.map +0 -1
  1433. package/dist/zod-generator-BQilAboC.mjs +0 -424
  1434. package/dist/zod-generator-BQilAboC.mjs.map +0 -1
  1435. /package/dist/{api-tokens-D2zgAIEt.mjs → api-tokens-CdP49zVF.mjs} +0 -0
  1436. /package/dist/{ssrf-BvNItdxk.mjs → ssrf-DM0E-D_8.mjs} +0 -0
@@ -1,1680 +0,0 @@
1
- import { d as __exportAll } from "./runner-wqt4BrIW.mjs";
2
- import { o as resolveConfiguredLocale, r as getI18nConfig } from "./config-CvmjJcVw.mjs";
3
- import { t as OptionsRepository } from "./options-DhrI7eMv.mjs";
4
- import { t as ContentRepository } from "./content-CcHrqkgp.mjs";
5
- import { d as invalidateMenuObjectCache, r as coalesceObjectCacheWrites } from "./object-cache-Bo6DGaC9.mjs";
6
- import { n as chunks, t as SQL_BATCH_SIZE } from "./chunks-Dr5Vr0zA.mjs";
7
- import { t as RevisionRepository } from "./revision-BWEH2qQB.mjs";
8
- import { t as withTransaction } from "./transaction-BVYIo_yu.mjs";
9
- import { t as MediaRepository } from "./media-IT8hQleU.mjs";
10
- import { t as TaxonomyRepository } from "./taxonomy-QrNmTfIZ.mjs";
11
- import { t as RedirectRepository } from "./redirect-B39kTQ_0.mjs";
12
- import { t as BylineRepository } from "./byline-BmVKOQ8l.mjs";
13
- import { t as INTERNAL_MEDIA_PREFIX } from "./normalize-BuWa0lvd.mjs";
14
- import { t as imageSize } from "./dist-Cfu8mMBs.mjs";
15
- import { t as FTSManager } from "./fts-manager-WJCN8uU6.mjs";
16
- import { h as saveTaxonomyStructure, p as findTaxonomyStructure } from "./loader-CetY659y.mjs";
17
- import { L as BlockTypeRegistry, U as markContentMediaUsageCollectionStaleSafely, n as SchemaRegistry, t as SchemaError } from "./registry-DeZ27gVi.mjs";
18
- import { i as resolveBlockTypes, r as normalizeBlocksData } from "./block-values-C4N_F2-G.mjs";
19
- import { m as setReferenceSelection } from "./relations-DBB1bRJW.mjs";
20
- import { n as createFieldRelation, t as bindReferenceField } from "./schema-BXIW-JHi.mjs";
21
- import { c as invalidateSiteSettingsCache, l as setSiteSettings } from "./settings-B1jOxAIl.mjs";
22
- import { a as ssrfSafeFetch, s as validateExternalUrl } from "./ssrf-LM_0wpGA.mjs";
23
- import { n as validateSeed, t as findTaxonomyStructureSource } from "./validate-BSZbSUDk.mjs";
24
- import { ulid } from "ulidx";
25
- import mime from "mime/lite";
26
-
27
- //#region src/media/url.ts
28
- /**
29
- * Build the internal file route URL for a storage key, encoding each path
30
- * segment so `?`, `#` and `%` stay inside the path. A key with an empty, `.` or
31
- * `..` segment is encoded whole, because the URL parser would collapse those
32
- * segments and move the request off the route. Mirrors the admin's
33
- * `localMediaFileUrl`.
34
- */
35
- function localMediaFileUrl(key) {
36
- const segments = key.split("/");
37
- if (segments.some((segment) => segment === "" || segment === "." || segment === "..")) return `${INTERNAL_MEDIA_PREFIX}${encodeURIComponent(key)}`;
38
- return `${INTERNAL_MEDIA_PREFIX}${segments.map(encodeURIComponent).join("/")}`;
39
- }
40
- /**
41
- * Resolve the public URL for a locally stored media key. Returns an empty
42
- * string when no key is given. When a storage adapter is supplied, defers to
43
- * `storage.getPublicUrl()`; otherwise returns the internal proxy route.
44
- */
45
- function resolvePublicMediaUrl(storage, storageKey) {
46
- if (!storageKey) return "";
47
- if (storage) return storage.getPublicUrl(storageKey);
48
- return `/_emdash/api/media/file/${storageKey}`;
49
- }
50
- /**
51
- * Build the `getPublicMediaUrl` closure attached to `Astro.locals.emdash`.
52
- * Shared by the anonymous fast path and the full-runtime path in middleware.
53
- *
54
- * @internal
55
- */
56
- function createPublicMediaUrlResolver(storage) {
57
- return (key) => resolvePublicMediaUrl(storage, key);
58
- }
59
-
60
- //#endregion
61
- //#region src/content/converters/gallery.ts
62
- /**
63
- * Shared sanitization for gallery block images and image media, used by both
64
- * converters so the editor round-trip and the stored shape stay in lockstep.
65
- */
66
- /**
67
- * Read an image's media reference, alt text, and dimensions. Accepts the
68
- * reference shape (`_ref`, `url`) and the MediaValue that seeded `$media`
69
- * stores instead (`id`, `src`, `meta.storageKey`, dimensions). The image's own
70
- * `alt`, `width`, and `height` take precedence over the asset's.
71
- */
72
- function resolveImageMedia(image) {
73
- const record = isRecord(image) ? image : {};
74
- const asset = isRecord(record.asset) ? record.asset : {};
75
- const storageKey = isRecord(asset.meta) ? nonEmptyString(asset.meta.storageKey) : void 0;
76
- const url = nonEmptyString(asset.url) ?? nonEmptyString(asset.src) ?? (storageKey ? localMediaFileUrl(storageKey) : void 0);
77
- const provider = nonEmptyString(asset.provider);
78
- const alt = nonEmptyString(record.alt) ?? nonEmptyString(asset.alt);
79
- const width = typeof record.width === "number" ? record.width : asset.width;
80
- const height = typeof record.height === "number" ? record.height : asset.height;
81
- const media = { asset: {
82
- _type: "reference",
83
- _ref: nonEmptyString(asset._ref) ?? nonEmptyString(asset.id) ?? "",
84
- ...url ? { url } : {},
85
- ...provider ? { provider } : {}
86
- } };
87
- if (alt) media.alt = alt;
88
- if (typeof width === "number") media.width = width;
89
- if (typeof height === "number") media.height = height;
90
- return media;
91
- }
92
- /**
93
- * Normalize an untrusted `images` value into well-formed gallery images.
94
- * Non-object entries and entries without an asset object are dropped.
95
- * Missing `_key`s are filled via `generateKey` when provided (PM → PT);
96
- * left empty otherwise (PT → PM keeps whatever the block carried).
97
- */
98
- function sanitizeGalleryImages(value, generateKey) {
99
- if (!Array.isArray(value)) return [];
100
- const images = [];
101
- for (const entry of value) {
102
- if (!isRecord(entry)) continue;
103
- const record = entry;
104
- if (!isRecord(record.asset)) continue;
105
- const { asset, alt, width, height } = resolveImageMedia(record);
106
- const image = {
107
- _type: "image",
108
- _key: typeof record._key === "string" && record._key ? record._key : generateKey ? generateKey() : "",
109
- asset
110
- };
111
- if (alt) image.alt = alt;
112
- if (typeof record.caption === "string" && record.caption) image.caption = record.caption;
113
- if (width !== void 0) image.width = width;
114
- if (height !== void 0) image.height = height;
115
- if (typeof record.focalX === "number") image.focalX = record.focalX;
116
- if (typeof record.focalY === "number") image.focalY = record.focalY;
117
- if (typeof record.blurhash === "string" && record.blurhash) image.blurhash = record.blurhash;
118
- if (typeof record.dominantColor === "string" && record.dominantColor) image.dominantColor = record.dominantColor;
119
- images.push(image);
120
- }
121
- return images;
122
- }
123
- function nonEmptyString(value) {
124
- return typeof value === "string" && value ? value : void 0;
125
- }
126
- function isRecord(value) {
127
- return typeof value === "object" && value !== null && !Array.isArray(value);
128
- }
129
-
130
- //#endregion
131
- //#region src/seed/apply.ts
132
- /**
133
- * Seed engine - applies seed files to database
134
- *
135
- * This is the core implementation that bootstraps an EmDash site from a seed file.
136
- * Apply order is critical for foreign keys and references.
137
- */
138
- var apply_exports = /* @__PURE__ */ __exportAll({
139
- applySeed: () => applySeed,
140
- applySeedWithinBudget: () => applySeedWithinBudget
141
- });
142
- async function applySiteSettings(db, settings, onConflict, result) {
143
- const entries = Object.entries(settings).filter(([, value]) => value !== void 0);
144
- if (entries.length === 0) return;
145
- if (onConflict === "update") {
146
- await setSiteSettings(settings, db);
147
- result.settings.applied += entries.length;
148
- return;
149
- }
150
- const options = new OptionsRepository(db);
151
- let applied = 0;
152
- try {
153
- for (const [key, value] of entries) {
154
- const write = await options.compareAndSet(`site:${key}`, null, value);
155
- if (!write.applied && onConflict === "error") throw new Error(`Conflict: site setting "site:${key}" already exists`);
156
- if (write.applied) applied++;
157
- }
158
- } finally {
159
- if (applied > 0) {
160
- result.settings.applied += applied;
161
- invalidateSiteSettingsCache();
162
- }
163
- }
164
- }
165
- /**
166
- * Set a collection's `titleField`/`dateField`: a separate write run after the
167
- * fields exist, so `updateCollection` can validate them. No-op when neither is set.
168
- */
169
- async function applyDisplayDateFields(registry, collection) {
170
- if (collection.titleField === void 0 && collection.dateField === void 0) return;
171
- await registry.updateCollection(collection.slug, {
172
- titleField: collection.titleField,
173
- dateField: collection.dateField
174
- });
175
- }
176
- const FILE_EXTENSION_PATTERN = /\.([a-z0-9]+)(?:\?|$)/i;
177
- const SEED_RELATION_NAME_MAX_ATTEMPTS = 5;
178
- const SEED_RELATION_INSERT_BATCH_SIZE = 10;
179
- /** Pattern to remove file extensions */
180
- const EXTENSION_PATTERN = /\.[^.]+$/;
181
- /** Pattern to remove query parameters */
182
- const QUERY_PARAM_PATTERN = /\?.*$/;
183
- /** Pattern to remove non-alphanumeric characters (except dash and underscore) */
184
- const SANITIZE_PATTERN = /[^a-zA-Z0-9_-]/g;
185
- /** Pattern to collapse multiple hyphens */
186
- const MULTIPLE_HYPHENS_PATTERN = /-+/g;
187
- /** The `category` and `tag` defs that migrations insert on every new database. */
188
- const BUILT_IN_TAXONOMY_DEFS = new Map([["taxdef_category", {
189
- label: "Categories",
190
- label_singular: "Category",
191
- hierarchical: 1,
192
- collections: "[\"posts\"]"
193
- }], ["taxdef_tag", {
194
- label: "Tags",
195
- label_singular: "Tag",
196
- hierarchical: 0,
197
- collections: "[\"posts\"]"
198
- }]]);
199
- /** Whether `def` is a built-in `category`/`tag` definition still holding its migration defaults. */
200
- function isUntouchedBuiltInTaxonomyDef(def) {
201
- const builtIn = BUILT_IN_TAXONOMY_DEFS.get(def.id);
202
- return builtIn !== void 0 && def.label === builtIn.label && def.label_singular === builtIn.label_singular && def.hierarchical === builtIn.hierarchical && def.collections === builtIn.collections;
203
- }
204
- /**
205
- * Apply a seed file to the database
206
- *
207
- * This function is idempotent - safe to run multiple times.
208
- *
209
- * @param db - Kysely database instance
210
- * @param seed - Seed file to apply
211
- * @param options - Application options
212
- * @returns Result summary
213
- */
214
- async function applySeed(db, seed, options = {}) {
215
- const { result } = await coalesceObjectCacheWrites(() => applySeedWrites(db, seed, options, null));
216
- return result;
217
- }
218
- /**
219
- * Apply a seed over several calls, for a platform that caps the queries or
220
- * fetches of one request.
221
- *
222
- * The limits are thresholds, checked before each taxonomy term, byline and
223
- * content entry is created and before the phases that follow content. Schema,
224
- * taxonomy definitions and settings are applied in every call, the item that
225
- * crosses a threshold finishes, and the phases after content (menus,
226
- * redirects, widgets, sections) run in one call, so set the limits well below
227
- * the platform's. A call that stops returns `complete: false`; applying the
228
- * same seed again continues with the first item not yet created. A call
229
- * creates at least one item before it stops, so repeated calls finish. A
230
- * `$media` URL used by entries in different calls is downloaded and stored
231
- * again, as a new media row, in each of those calls. Requires
232
- * `onConflict: "skip"`.
233
- */
234
- async function applySeedWithinBudget(db, seed, options, limits) {
235
- const budget = new SeedBudget(limits);
236
- return coalesceObjectCacheWrites(() => applySeedWrites(db.withPlugin(budget), seed, options, budget));
237
- }
238
- /**
239
- * Counts what a budgeted call spends. As a Kysely plugin it sees every query
240
- * the call runs, including those inside transactions.
241
- */
242
- var SeedBudget = class {
243
- #queries = 0;
244
- #mediaDownloads = 0;
245
- constructor(limits) {
246
- this.limits = limits;
247
- }
248
- transformQuery(args) {
249
- this.#queries++;
250
- return args.node;
251
- }
252
- transformResult(args) {
253
- return Promise.resolve(args.result);
254
- }
255
- countMediaDownload() {
256
- this.#mediaDownloads++;
257
- }
258
- isSpent() {
259
- const { queries, mediaDownloads } = this.limits;
260
- return queries !== void 0 && this.#queries >= queries || mediaDownloads !== void 0 && this.#mediaDownloads >= mediaDownloads;
261
- }
262
- };
263
- async function applySeedWrites(db, seed, options, budget) {
264
- const validation = validateSeed(seed);
265
- if (!validation.valid) throw new Error(`Invalid seed file:\n${validation.errors.join("\n")}`);
266
- const { includeContent = false, storage, skipMediaDownload = false, onConflict = "skip" } = options;
267
- if (budget && onConflict !== "skip") throw new Error("A seed budget requires onConflict: \"skip\"");
268
- const result = {
269
- blockTypes: {
270
- created: 0,
271
- skipped: 0,
272
- updated: 0
273
- },
274
- collections: {
275
- created: 0,
276
- skipped: 0,
277
- updated: 0
278
- },
279
- fields: {
280
- created: 0,
281
- skipped: 0,
282
- updated: 0
283
- },
284
- relations: {
285
- created: 0,
286
- skipped: 0,
287
- updated: 0
288
- },
289
- taxonomies: {
290
- created: 0,
291
- skipped: 0,
292
- terms: 0
293
- },
294
- bylines: {
295
- created: 0,
296
- skipped: 0,
297
- updated: 0
298
- },
299
- menus: {
300
- created: 0,
301
- items: 0
302
- },
303
- redirects: {
304
- created: 0,
305
- skipped: 0,
306
- updated: 0
307
- },
308
- widgetAreas: {
309
- created: 0,
310
- widgets: 0
311
- },
312
- sections: {
313
- created: 0,
314
- skipped: 0,
315
- updated: 0
316
- },
317
- settings: { applied: 0 },
318
- content: {
319
- created: 0,
320
- skipped: 0,
321
- updated: 0
322
- },
323
- media: {
324
- created: 0,
325
- skipped: 0
326
- }
327
- };
328
- let complete = true;
329
- const progress = {
330
- done: 0,
331
- total: countSeedItems(seed, includeContent)
332
- };
333
- const mayCreateItem = () => !budget || result.taxonomies.terms + result.bylines.created + result.content.created === 0 || !budget.isSpent();
334
- const mediaContext = {
335
- db,
336
- storage: storage ?? null,
337
- skipMediaDownload,
338
- mediaCache: /* @__PURE__ */ new Map(),
339
- budget
340
- };
341
- const seedIdMap = /* @__PURE__ */ new Map();
342
- const seedBylineIdMap = /* @__PURE__ */ new Map();
343
- const staleMarkedContentCollections = /* @__PURE__ */ new Set();
344
- const failedStaleContentCollections = /* @__PURE__ */ new Set();
345
- const defaultLocale = getI18nConfig()?.defaultLocale ?? seed.defaultLocale ?? "en";
346
- const markSeedContentCollectionStale = async (collectionSlug) => {
347
- if (staleMarkedContentCollections.has(collectionSlug)) return;
348
- if (await markContentMediaUsageCollectionStaleSafely(db, collectionSlug, "CONTENT_USAGE_STALE")) {
349
- staleMarkedContentCollections.add(collectionSlug);
350
- failedStaleContentCollections.delete(collectionSlug);
351
- } else failedStaleContentCollections.add(collectionSlug);
352
- };
353
- const retryFailedSeedContentStaleMarks = async () => {
354
- for (const collectionSlug of failedStaleContentCollections) if (await markContentMediaUsageCollectionStaleSafely(db, collectionSlug, "CONTENT_USAGE_STALE")) {
355
- staleMarkedContentCollections.add(collectionSlug);
356
- failedStaleContentCollections.delete(collectionSlug);
357
- }
358
- };
359
- if (seed.settings) await applySiteSettings(db, seed.settings, onConflict, result);
360
- if (seed.relations) await applySeedRelations(db, seed.relations, seed.collections ?? [], onConflict, result);
361
- if (seed.blockTypes) {
362
- const registry = new BlockTypeRegistry(db);
363
- for (const blockType of seed.blockTypes) {
364
- const existing = await registry.getBlockType(blockType.slug);
365
- await registry.applySeedBlockType(blockType, onConflict);
366
- if (!existing) result.blockTypes.created++;
367
- else if (onConflict === "update") result.blockTypes.updated++;
368
- else result.blockTypes.skipped++;
369
- }
370
- }
371
- if (seed.collections) {
372
- const registry = new SchemaRegistry(db);
373
- const seedCollectionSlugs = new Set(seed.collections.map((collection) => collection.slug));
374
- const knownRelations = await readRelationEnds(db);
375
- const relationSlugs = new Set(knownRelations.keys());
376
- const externalTargetExists = /* @__PURE__ */ new Map();
377
- const pendingRelations = [];
378
- for (const collection of seed.collections) {
379
- if (await registry.getCollection(collection.slug)) {
380
- if (onConflict === "error") throw new Error(`Conflict: collection "${collection.slug}" already exists`);
381
- if (onConflict === "update") {
382
- await registry.updateCollection(collection.slug, {
383
- label: collection.label,
384
- labelSingular: collection.labelSingular,
385
- description: collection.description,
386
- icon: collection.icon,
387
- admin: collection.admin,
388
- supports: collection.supports || [],
389
- urlPattern: collection.urlPattern,
390
- routable: collection.routable,
391
- hidden: collection.hidden,
392
- sortOrder: collection.sortOrder,
393
- group: collection.group,
394
- commentsEnabled: collection.commentsEnabled,
395
- editLocking: collection.editLocking
396
- });
397
- result.collections.updated++;
398
- for (const field of collection.fields) {
399
- const existingField = await registry.getField(collection.slug, field.slug);
400
- await upsertSeedField(db, collection.slug, field, existingField, knownRelations);
401
- if (existingField) result.fields.updated++;
402
- else result.fields.created++;
403
- }
404
- await applyDisplayDateFields(registry, collection);
405
- continue;
406
- }
407
- result.collections.skipped++;
408
- result.fields.skipped += collection.fields.length;
409
- continue;
410
- }
411
- const fields = [];
412
- for (const field of collection.fields) {
413
- let fieldValidation = field.validation;
414
- const bound = resolveSeedFieldRelation(collection.slug, field, knownRelations);
415
- const targetCollection = !bound && field.type === "reference" && typeof fieldValidation?.targetCollection === "string" ? fieldValidation.targetCollection : void 0;
416
- if (bound) fieldValidation = {
417
- ...fieldValidation,
418
- ...bound
419
- };
420
- if (targetCollection) {
421
- let targetExists = seedCollectionSlugs.has(targetCollection);
422
- if (!targetExists) {
423
- targetExists = externalTargetExists.get(targetCollection) ?? false;
424
- if (!externalTargetExists.has(targetCollection)) {
425
- targetExists = Boolean(await registry.getCollection(targetCollection));
426
- externalTargetExists.set(targetCollection, targetExists);
427
- }
428
- }
429
- if (!targetExists) throw new SchemaError(`Target collection "${targetCollection}" not found`, "COLLECTION_NOT_FOUND");
430
- const relationId = ulid();
431
- const relationSlug = allocateSeedRelationName(collection.slug, field.slug, relationSlugs);
432
- pendingRelations.push({
433
- id: relationId,
434
- slug: relationSlug,
435
- parent_collection: collection.slug,
436
- child_collection: targetCollection,
437
- parent_label: collection.label,
438
- parent_label_singular: collection.labelSingular ?? null,
439
- child_label: field.label,
440
- max_children_per_parent: fieldValidation?.multiple ? null : 1
441
- });
442
- fieldValidation = {
443
- ...fieldValidation,
444
- relation: relationSlug,
445
- relationSide: "parent"
446
- };
447
- }
448
- fields.push({
449
- slug: field.slug,
450
- label: field.label,
451
- type: field.type,
452
- required: field.required || false,
453
- unique: field.unique || false,
454
- searchable: field.searchable || false,
455
- indexed: field.indexed || false,
456
- translatable: field.translatable,
457
- defaultValue: field.defaultValue,
458
- validation: fieldValidation,
459
- widget: field.widget,
460
- options: field.options
461
- });
462
- }
463
- await registry.createSeedCollection({
464
- slug: collection.slug,
465
- label: collection.label,
466
- labelSingular: collection.labelSingular,
467
- description: collection.description,
468
- icon: collection.icon,
469
- admin: collection.admin,
470
- supports: collection.supports || [],
471
- urlPattern: collection.urlPattern,
472
- routable: collection.routable,
473
- hidden: collection.hidden,
474
- sortOrder: collection.sortOrder,
475
- group: collection.group,
476
- commentsEnabled: collection.commentsEnabled,
477
- editLocking: collection.editLocking
478
- }, fields);
479
- await applyDisplayDateFields(registry, collection);
480
- result.collections.created++;
481
- result.fields.created += collection.fields.length;
482
- }
483
- for (const relationBatch of chunks(pendingRelations, SEED_RELATION_INSERT_BATCH_SIZE)) await db.insertInto("_emdash_relations").values(relationBatch).execute();
484
- }
485
- if (seed.taxonomies) {
486
- const termSeedIdMap = /* @__PURE__ */ new Map();
487
- const taxonomiesBySeedId = /* @__PURE__ */ new Map();
488
- for (const taxonomy of seed.taxonomies) if (taxonomy.id) taxonomiesBySeedId.set(taxonomy.id, taxonomy);
489
- const untouchedBuiltInDefIds = new Set((await db.selectFrom("_emdash_taxonomy_defs").select([
490
- "id",
491
- "label",
492
- "label_singular",
493
- "hierarchical",
494
- "collections"
495
- ]).where("id", "in", [...BUILT_IN_TAXONOMY_DEFS.keys()]).execute()).filter(isUntouchedBuiltInTaxonomyDef).map((def) => def.id));
496
- const declaresOwnStructure = (taxonomy) => findTaxonomyStructureSource(taxonomy, taxonomiesBySeedId) === taxonomy;
497
- const orderedTaxonomies = [...seed.taxonomies.filter(declaresOwnStructure), ...seed.taxonomies.filter((taxonomy) => !declaresOwnStructure(taxonomy))];
498
- for (const taxonomy of orderedTaxonomies) {
499
- const defLocale = resolveConfiguredLocale(taxonomy.locale ?? defaultLocale);
500
- const defsOfName = await db.selectFrom("_emdash_taxonomy_defs").select(["id", "locale"]).where("name", "=", taxonomy.name).execute();
501
- const existingDef = defsOfName.find((def) => def.locale === defLocale);
502
- const unclaimed = existingDef !== void 0 && untouchedBuiltInDefIds.has(existingDef.id);
503
- if (existingDef && onConflict === "error" && !unclaimed) throw new Error(`Conflict: taxonomy "${taxonomy.name}" (${defLocale}) already exists`);
504
- const replacesDef = onConflict === "update" || unclaimed;
505
- const existingStructure = await findTaxonomyStructure(db, taxonomy.name);
506
- const replacesStructure = replacesDef || defsOfName.every((def) => untouchedBuiltInDefIds.has(def.id));
507
- const writesStructure = !existingStructure || replacesStructure && !taxonomy.translationOf;
508
- const structure = existingStructure && !writesStructure ? existingStructure : {
509
- hierarchical: taxonomy.hierarchical ?? existingStructure?.hierarchical ?? false,
510
- collections: taxonomy.collections ?? existingStructure?.collections ?? []
511
- };
512
- const defId = existingDef?.id ?? ulid();
513
- const translationGroup = writesStructure ? await saveTaxonomyStructure(db, taxonomy.name, existingStructure?.id ?? defId, structure) : existingStructure.id;
514
- if (existingDef) if (replacesDef) await db.updateTable("_emdash_taxonomy_defs").set({
515
- label: taxonomy.label,
516
- label_singular: taxonomy.labelSingular ?? null
517
- }).where("id", "=", existingDef.id).execute();
518
- else result.taxonomies.skipped++;
519
- else {
520
- await db.insertInto("_emdash_taxonomy_defs").values({
521
- id: defId,
522
- name: taxonomy.name,
523
- label: taxonomy.label,
524
- label_singular: taxonomy.labelSingular ?? null,
525
- hierarchical: structure.hierarchical ? 1 : 0,
526
- collections: JSON.stringify(structure.collections),
527
- locale: defLocale,
528
- translation_group: translationGroup
529
- }).execute();
530
- result.taxonomies.created++;
531
- }
532
- if (includeContent && taxonomy.terms && taxonomy.terms.length > 0) {
533
- const termRepo = new TaxonomyRepository(db);
534
- const existingTerms = await findExistingSeedTerms(db, taxonomy.name, taxonomy.terms);
535
- if (structure.hierarchical) {
536
- const applied = await applyHierarchicalTerms(termRepo, taxonomy.name, defLocale, taxonomy.terms, existingTerms, termSeedIdMap, result, onConflict, mayCreateItem);
537
- progress.done += applied.processed;
538
- complete = applied.complete;
539
- } else for (const term of taxonomy.terms) {
540
- const termLocale = resolveConfiguredLocale(term.locale ?? defLocale);
541
- const termKey = seedTermKey(termLocale, term.slug);
542
- const existingId = existingTerms.get(termKey);
543
- if (existingId) {
544
- if (onConflict === "error") throw new Error(`Conflict: taxonomy term "${term.slug}" in "${taxonomy.name}" (${termLocale}) already exists`);
545
- if (onConflict === "update") {
546
- await termRepo.update(existingId, {
547
- label: term.label,
548
- data: term.description ? { description: term.description } : {}
549
- });
550
- result.taxonomies.terms++;
551
- }
552
- if (term.id) termSeedIdMap.set(term.id, existingId);
553
- progress.done++;
554
- } else {
555
- if (!mayCreateItem()) {
556
- complete = false;
557
- break;
558
- }
559
- const translationOf = term.translationOf ? termSeedIdMap.get(term.translationOf) : void 0;
560
- const created = await termRepo.create({
561
- name: taxonomy.name,
562
- slug: term.slug,
563
- label: term.label,
564
- data: term.description ? { description: term.description } : void 0,
565
- locale: termLocale,
566
- translationOf
567
- });
568
- existingTerms.set(termKey, created.id);
569
- if (term.id) termSeedIdMap.set(term.id, created.id);
570
- result.taxonomies.terms++;
571
- progress.done++;
572
- }
573
- }
574
- }
575
- if (!complete) break;
576
- }
577
- const { invalidateTaxonomyDefsCache } = await import("./taxonomies-DQSywBvX.mjs").then((n) => n.f);
578
- invalidateTaxonomyDefsCache();
579
- }
580
- if (complete && includeContent && seed.bylines) {
581
- const bylineRepo = new BylineRepository(db);
582
- const existingBylines = await findExistingSeedBylines(db, seed.bylines.map((byline) => byline.slug));
583
- for (const byline of seed.bylines) {
584
- const existingId = existingBylines.get(byline.slug);
585
- if (existingId) {
586
- if (onConflict === "error") throw new Error(`Conflict: byline "${byline.slug}" already exists`);
587
- if (onConflict === "update") {
588
- const avatar = byline.avatar ? await resolveSeedBylineAvatar(db, byline.avatar) : null;
589
- try {
590
- if (!await bylineRepo.update(existingId, {
591
- displayName: byline.displayName,
592
- bio: byline.bio ?? null,
593
- websiteUrl: byline.websiteUrl ?? null,
594
- isGuest: byline.isGuest,
595
- ...avatar ? { avatarMediaId: avatar.id } : {}
596
- })) throw new Error(`Byline "${byline.slug}" disappeared during update`);
597
- } catch (error) {
598
- if (avatar?.created) await deleteMediaRow(db, avatar.id);
599
- throw error;
600
- }
601
- seedBylineIdMap.set(byline.id, existingId);
602
- result.bylines.updated++;
603
- if (avatar?.created) result.media.created++;
604
- progress.done++;
605
- continue;
606
- }
607
- seedBylineIdMap.set(byline.id, existingId);
608
- result.bylines.skipped++;
609
- progress.done++;
610
- continue;
611
- }
612
- if (!mayCreateItem()) {
613
- complete = false;
614
- break;
615
- }
616
- const avatar = byline.avatar ? await resolveSeedBylineAvatar(db, byline.avatar) : null;
617
- let createdId;
618
- try {
619
- createdId = (await bylineRepo.create({
620
- slug: byline.slug,
621
- displayName: byline.displayName,
622
- bio: byline.bio ?? null,
623
- websiteUrl: byline.websiteUrl ?? null,
624
- isGuest: byline.isGuest,
625
- avatarMediaId: avatar?.id ?? null
626
- })).id;
627
- } catch (error) {
628
- if (avatar?.created) await deleteMediaRow(db, avatar.id);
629
- throw error;
630
- }
631
- existingBylines.set(byline.slug, createdId);
632
- seedBylineIdMap.set(byline.id, createdId);
633
- result.bylines.created++;
634
- if (avatar?.created) result.media.created++;
635
- progress.done++;
636
- }
637
- }
638
- if (complete && includeContent && seed.content) {
639
- const contentRepo = new ContentRepository(db);
640
- const schemaRegistry = new SchemaRegistry(db);
641
- const datetimeContexts = /* @__PURE__ */ new Map();
642
- try {
643
- for (const [collectionSlug, entries] of Object.entries(seed.content)) {
644
- const collectionInfo = await schemaRegistry.getCollectionWithFields(collectionSlug);
645
- const collectionRoutable = collectionInfo?.routable !== false;
646
- const referenceFields = referenceFieldsOf(collectionInfo);
647
- const resolvedBlockTypes = collectionInfo?.fields.some((field) => field.type === "blocks") ? await resolveBlockTypes(db) : void 0;
648
- const existingEntries = await findExistingSeedEntries(contentRepo, collectionSlug, entries, defaultLocale);
649
- const trashedEntries = await findExistingSeedEntries(contentRepo, collectionSlug, entries.filter((entry) => {
650
- const { slug, locale } = seedEntryIdentity(entry, defaultLocale);
651
- return !existingEntries.has(seedEntryKey(entry, slug, locale));
652
- }), defaultLocale, true);
653
- for (const entry of entries) {
654
- const { slug: entrySlug, locale: entryLocale } = seedEntryIdentity(entry, defaultLocale);
655
- const entryKey = seedEntryKey(entry, entrySlug, entryLocale);
656
- const existing = existingEntries.get(entryKey);
657
- if (!existing) {
658
- if (trashedEntries.get(entryKey)) {
659
- if (onConflict === "error") throw new Error(`Conflict: content "${entrySlug ?? entry.id}" in "${collectionSlug}" already exists (in trash)`);
660
- console.warn(`content.${collectionSlug}: "${entrySlug ?? entry.id}" (${entryLocale}) exists in the trash — skipping`);
661
- result.content.skipped++;
662
- progress.done++;
663
- continue;
664
- }
665
- }
666
- if (existing) {
667
- if (onConflict === "error") throw new Error(`Conflict: content "${entrySlug ?? entry.id}" in "${collectionSlug}" already exists`);
668
- if (onConflict === "update") {
669
- let resolvedData = await resolveReferences(entry.data, seedIdMap, mediaContext, result);
670
- if (collectionInfo) resolvedData = await normalizeBlocksData(db, collectionInfo, resolvedData, existing.data, { restoreBlocks: true }, false, resolvedBlockTypes);
671
- const { columnData, edges } = splitReferenceFields(collectionSlug, referenceFields, resolvedData);
672
- const status = entry.status || "published";
673
- let contentMutated = false;
674
- try {
675
- await withTransaction(db, async (trx) => {
676
- const trxContentRepo = new ContentRepository(trx, datetimeContexts);
677
- const trxBylineRepo = new BylineRepository(trx);
678
- const trxRevisionRepo = new RevisionRepository(trx, datetimeContexts);
679
- await trxContentRepo.update(collectionSlug, existing.id, {
680
- status,
681
- data: columnData
682
- });
683
- contentMutated = true;
684
- await applyContentBylines(trxBylineRepo, collectionSlug, existing.id, entry, seedBylineIdMap, true);
685
- await applyContentTaxonomies(trx, collectionSlug, existing.id, entry, true);
686
- await applyContentReferences(trx, collectionSlug, existing.id, edges);
687
- if (status === "published") {
688
- const draft = await trxRevisionRepo.create({
689
- collection: collectionSlug,
690
- entryId: existing.id,
691
- data: columnData
692
- });
693
- try {
694
- await trxContentRepo.setDraftRevision(collectionSlug, existing.id, draft.id);
695
- await trxContentRepo.publish(collectionSlug, existing.id, void 0, false, void 0, true, collectionRoutable);
696
- } catch (error) {
697
- try {
698
- await trxRevisionRepo.deleteIfUnreferenced(collectionSlug, existing.id, draft.id);
699
- } catch (cleanupError) {
700
- console.error(`[seed] Failed to clean up unstaged revision ${draft.id}:`, cleanupError);
701
- }
702
- throw error;
703
- }
704
- }
705
- });
706
- } catch (error) {
707
- if (contentMutated) await markSeedContentCollectionStale(collectionSlug);
708
- throw error;
709
- }
710
- seedIdMap.set(entry.id, existing.id);
711
- result.content.updated++;
712
- progress.done++;
713
- await markSeedContentCollectionStale(collectionSlug);
714
- continue;
715
- }
716
- result.content.skipped++;
717
- seedIdMap.set(entry.id, existing.id);
718
- progress.done++;
719
- continue;
720
- }
721
- if (!mayCreateItem()) {
722
- complete = false;
723
- break;
724
- }
725
- let resolvedData = await resolveReferences(entry.data, seedIdMap, mediaContext, result);
726
- if (collectionInfo) resolvedData = await normalizeBlocksData(db, collectionInfo, resolvedData, {}, { restoreBlocks: true }, false, resolvedBlockTypes);
727
- const { columnData, edges } = splitReferenceFields(collectionSlug, referenceFields, resolvedData);
728
- let translationOf;
729
- if (entry.translationOf) {
730
- const sourceId = seedIdMap.get(entry.translationOf);
731
- if (!sourceId) console.warn(`content.${collectionSlug}: translationOf "${entry.translationOf}" not found (not yet created or missing). Skipping translation link.`);
732
- else translationOf = sourceId;
733
- }
734
- const status = entry.status || "published";
735
- let contentMutated = false;
736
- let created;
737
- try {
738
- created = await withTransaction(db, async (trx) => {
739
- const trxContentRepo = new ContentRepository(trx, datetimeContexts);
740
- const trxBylineRepo = new BylineRepository(trx);
741
- const item = await trxContentRepo.create({
742
- ...entrySlug ? {} : { id: entry.id },
743
- type: collectionSlug,
744
- slug: entrySlug,
745
- status,
746
- data: columnData,
747
- locale: entryLocale,
748
- translationOf,
749
- publishedAt: status === "published" ? (/* @__PURE__ */ new Date()).toISOString() : null
750
- });
751
- contentMutated = true;
752
- await applyContentBylines(trxBylineRepo, collectionSlug, item.id, entry, seedBylineIdMap);
753
- await applyContentTaxonomies(trx, collectionSlug, item.id, entry, false);
754
- await applyContentReferences(trx, collectionSlug, item.id, edges);
755
- if (status === "published") await trxContentRepo.publish(collectionSlug, item.id, void 0, false, void 0, true, collectionRoutable);
756
- return item;
757
- });
758
- } catch (error) {
759
- if (contentMutated) await markSeedContentCollectionStale(collectionSlug);
760
- throw error;
761
- }
762
- seedIdMap.set(entry.id, created.id);
763
- existingEntries.set(entryKey, created);
764
- result.content.created++;
765
- progress.done++;
766
- await markSeedContentCollectionStale(collectionSlug);
767
- }
768
- if (!complete) break;
769
- }
770
- } finally {
771
- await retryFailedSeedContentStaleMarks();
772
- }
773
- }
774
- if (complete && !mayCreateItem()) complete = false;
775
- if (!complete) {
776
- await invalidateSeedCaches();
777
- return {
778
- result,
779
- complete,
780
- progress
781
- };
782
- }
783
- if (seed.menus) {
784
- const menuSeedIdMap = /* @__PURE__ */ new Map();
785
- const itemSeedIdMap = /* @__PURE__ */ new Map();
786
- try {
787
- for (const menu of seed.menus) {
788
- const locale = resolveConfiguredLocale(menu.locale ?? defaultLocale);
789
- const existingMenu = await db.selectFrom("_emdash_menus").selectAll().where("name", "=", menu.name).where("locale", "=", locale).executeTakeFirst();
790
- let menuId;
791
- let translationGroup;
792
- if (existingMenu) {
793
- menuId = existingMenu.id;
794
- translationGroup = existingMenu.translation_group ?? existingMenu.id;
795
- await db.deleteFrom("_emdash_menu_items").where("menu_id", "=", menuId).execute();
796
- } else {
797
- menuId = ulid();
798
- translationGroup = menuId;
799
- if (menu.translationOf) {
800
- const source = menuSeedIdMap.get(menu.translationOf);
801
- if (source) translationGroup = source.translationGroup;
802
- else console.warn(`menu "${menu.name}" (${locale}): translationOf "${menu.translationOf}" not found yet; minting a fresh group.`);
803
- }
804
- await db.insertInto("_emdash_menus").values({
805
- id: menuId,
806
- name: menu.name,
807
- label: menu.label,
808
- created_at: (/* @__PURE__ */ new Date()).toISOString(),
809
- updated_at: (/* @__PURE__ */ new Date()).toISOString(),
810
- locale,
811
- translation_group: translationGroup
812
- }).execute();
813
- result.menus.created++;
814
- }
815
- if (menu.id) menuSeedIdMap.set(menu.id, {
816
- id: menuId,
817
- translationGroup
818
- });
819
- const itemCount = await applyMenuItems(db, menuId, locale, menu.items, null, 0, seedIdMap, itemSeedIdMap);
820
- result.menus.items += itemCount;
821
- }
822
- } finally {
823
- invalidateMenuObjectCache();
824
- }
825
- }
826
- if (seed.redirects) {
827
- const redirectRepo = new RedirectRepository(db);
828
- for (const redirect of seed.redirects) {
829
- const existing = await redirectRepo.findBySource(redirect.source);
830
- if (existing) {
831
- if (onConflict === "error") throw new Error(`Conflict: redirect "${redirect.source}" already exists`);
832
- if (onConflict === "update") {
833
- await redirectRepo.update(existing.id, {
834
- destination: redirect.destination,
835
- type: redirect.type,
836
- enabled: redirect.enabled,
837
- groupName: redirect.groupName
838
- });
839
- result.redirects.updated++;
840
- continue;
841
- }
842
- result.redirects.skipped++;
843
- continue;
844
- }
845
- await redirectRepo.create({
846
- source: redirect.source,
847
- destination: redirect.destination,
848
- type: redirect.type,
849
- enabled: redirect.enabled,
850
- groupName: redirect.groupName
851
- });
852
- result.redirects.created++;
853
- }
854
- }
855
- if (seed.widgetAreas) for (const area of seed.widgetAreas) {
856
- const existingArea = await db.selectFrom("_emdash_widget_areas").selectAll().where("name", "=", area.name).executeTakeFirst();
857
- let areaId;
858
- if (existingArea) {
859
- areaId = existingArea.id;
860
- await db.deleteFrom("_emdash_widgets").where("area_id", "=", areaId).execute();
861
- } else {
862
- areaId = ulid();
863
- await db.insertInto("_emdash_widget_areas").values({
864
- id: areaId,
865
- name: area.name,
866
- label: area.label,
867
- description: area.description ?? null
868
- }).execute();
869
- result.widgetAreas.created++;
870
- }
871
- for (let i = 0; i < area.widgets.length; i++) {
872
- const widget = area.widgets[i];
873
- await applyWidget(db, areaId, widget, i);
874
- result.widgetAreas.widgets++;
875
- }
876
- }
877
- if (seed.sections) for (const section of seed.sections) {
878
- const existing = await db.selectFrom("_emdash_sections").select("id").where("slug", "=", section.slug).executeTakeFirst();
879
- if (existing) {
880
- if (onConflict === "error") throw new Error(`Conflict: section "${section.slug}" already exists`);
881
- if (onConflict === "update") {
882
- await db.updateTable("_emdash_sections").set({
883
- title: section.title,
884
- description: section.description ?? null,
885
- keywords: section.keywords ? JSON.stringify(section.keywords) : null,
886
- content: JSON.stringify(section.content),
887
- source: section.source || "theme",
888
- updated_at: (/* @__PURE__ */ new Date()).toISOString()
889
- }).where("id", "=", existing.id).execute();
890
- result.sections.updated++;
891
- continue;
892
- }
893
- result.sections.skipped++;
894
- continue;
895
- }
896
- const id = ulid();
897
- const now = (/* @__PURE__ */ new Date()).toISOString();
898
- await db.insertInto("_emdash_sections").values({
899
- id,
900
- slug: section.slug,
901
- title: section.title,
902
- description: section.description ?? null,
903
- keywords: section.keywords ? JSON.stringify(section.keywords) : null,
904
- content: JSON.stringify(section.content),
905
- preview_media_id: null,
906
- source: section.source || "theme",
907
- theme_id: section.source === "theme" ? section.slug : null,
908
- created_at: now,
909
- updated_at: now
910
- }).execute();
911
- result.sections.created++;
912
- }
913
- if (seed.collections) {
914
- const ftsManager = new FTSManager(db);
915
- for (const collection of seed.collections) if (collection.supports?.includes("search")) {
916
- if ((await ftsManager.getSearchableFields(collection.slug)).length > 0) try {
917
- await ftsManager.enableSearch(collection.slug);
918
- } catch (err) {
919
- console.warn(`Failed to enable search for ${collection.slug}:`, err);
920
- }
921
- }
922
- }
923
- if (result.redirects.created + result.redirects.updated > 0) {
924
- const { publishRedirectChanges } = await import("./artifacts-D-O-qj9C.mjs").then((n) => n.t);
925
- await publishRedirectChanges(db);
926
- }
927
- await invalidateSeedCaches();
928
- return {
929
- result,
930
- complete,
931
- progress
932
- };
933
- }
934
- function countSeedItems(seed, includeContent) {
935
- if (!includeContent) return 0;
936
- const terms = (seed.taxonomies ?? []).reduce((total, taxonomy) => total + (taxonomy.terms?.length ?? 0), 0);
937
- const entries = Object.values(seed.content ?? {}).reduce((total, collectionEntries) => total + collectionEntries.length, 0);
938
- return terms + (seed.bylines?.length ?? 0) + entries;
939
- }
940
- function seedTermKey(locale, slug) {
941
- return `${locale}::${slug}`;
942
- }
943
- /**
944
- * Find which of a taxonomy's seed terms already exist, as term ids keyed by
945
- * `seedTermKey`. Each query covers a batch of slugs.
946
- */
947
- async function findExistingSeedTerms(db, taxonomyName, terms) {
948
- const existing = /* @__PURE__ */ new Map();
949
- for (const batch of chunks([...new Set(terms.map((term) => term.slug))], SQL_BATCH_SIZE)) {
950
- const rows = await db.selectFrom("taxonomies").select([
951
- "id",
952
- "slug",
953
- "locale"
954
- ]).where("name", "=", taxonomyName).where("slug", "in", batch).execute();
955
- for (const row of rows) existing.set(seedTermKey(row.locale, row.slug), row.id);
956
- }
957
- return existing;
958
- }
959
- /**
960
- * Find which seed bylines already exist, as byline ids keyed by slug. A slug
961
- * in several locales resolves to the lowest locale code, as
962
- * `BylineRepository.findBySlug` does. Each query covers a batch of slugs.
963
- */
964
- async function findExistingSeedBylines(db, slugs) {
965
- const existing = /* @__PURE__ */ new Map();
966
- for (const batch of chunks([...new Set(slugs)], SQL_BATCH_SIZE)) {
967
- const rows = await db.selectFrom("_emdash_bylines").select(["id", "slug"]).where("slug", "in", batch).orderBy("locale", "asc").execute();
968
- for (const row of rows) if (!existing.has(row.slug)) existing.set(row.slug, row.id);
969
- }
970
- return existing;
971
- }
972
- /**
973
- * Invalidate caches that may have been affected by seed data.
974
- * Seed creates bylines, redirects, and collections, all of which
975
- * have module-level caches in the hot path.
976
- */
977
- async function invalidateSeedCaches() {
978
- const { invalidateBylineCache } = await import("./bylines-CHhR28r9.mjs").then((n) => n.t);
979
- const { invalidateRedirectCache } = await import("./cache-x0z8t_m9.mjs").then((n) => n.t);
980
- const { invalidateUrlPatternCache } = await import("./query-BGG3sDEd.mjs").then((n) => n.s);
981
- invalidateBylineCache();
982
- invalidateRedirectCache();
983
- invalidateUrlPatternCache();
984
- }
985
- function seedEntryIdentity(entry, defaultLocale) {
986
- return {
987
- slug: typeof entry.slug === "string" && entry.slug.trim().length > 0 ? entry.slug : null,
988
- locale: resolveConfiguredLocale(entry.locale ?? defaultLocale)
989
- };
990
- }
991
- async function readRelationEnds(db) {
992
- const rows = await db.selectFrom("_emdash_relations").select([
993
- "slug",
994
- "parent_collection",
995
- "child_collection"
996
- ]).execute();
997
- return new Map(rows.map((row) => [row.slug, {
998
- parentCollection: row.parent_collection,
999
- childCollection: row.child_collection
1000
- }]));
1001
- }
1002
- /**
1003
- * Resolve the relation a seed reference field names, and which end of it this
1004
- * collection sits on.
1005
- *
1006
- * `relationSide` is only needed for a self-referential relation, where both ends
1007
- * are this collection; otherwise the side follows from which end matches.
1008
- * `targetCollection` is the collection at the other end, derived rather than
1009
- * trusted, so a seed cannot declare a target the relation disagrees with.
1010
- */
1011
- function resolveSeedFieldRelation(collectionSlug, field, knownRelations) {
1012
- if (field.type !== "reference") return null;
1013
- const named = field.validation?.relation;
1014
- if (typeof named !== "string" || named.length === 0) return null;
1015
- const relation = knownRelations.get(named);
1016
- if (!relation) throw new SchemaError(`Relation "${named}" not found`, "RELATION_NOT_FOUND");
1017
- const declared = field.validation?.relationSide;
1018
- const side = declared === "parent" || declared === "child" ? declared : relation.parentCollection === collectionSlug ? "parent" : "child";
1019
- if ((side === "parent" ? relation.parentCollection : relation.childCollection) !== collectionSlug) throw new SchemaError(`Relation "${named}" has no ${side} end on collection "${collectionSlug}"`, "VALIDATION_ERROR");
1020
- return {
1021
- relation: named,
1022
- relationSide: side,
1023
- targetCollection: side === "parent" ? relation.childCollection : relation.parentCollection
1024
- };
1025
- }
1026
- /**
1027
- * Create or update the relations a seed declares, before the fields that name
1028
- * them.
1029
- *
1030
- * A relation's two collections are fixed once it exists: changing one would
1031
- * leave its links pointing into a collection that is no longer an end of it, so
1032
- * a seed that names different ones fails rather than rewriting the row. Labels
1033
- * and limits are updated under `onConflict: "update"`.
1034
- */
1035
- async function applySeedRelations(db, relations, seedCollections, onConflict, result) {
1036
- const existing = await readRelationEnds(db);
1037
- const known = new Set(seedCollections.map((collection) => collection.slug));
1038
- for (const row of await db.selectFrom("_emdash_collections").select("slug").execute()) known.add(row.slug);
1039
- const now = (/* @__PURE__ */ new Date()).toISOString();
1040
- for (const relation of relations) {
1041
- for (const end of [relation.parentCollection, relation.childCollection]) if (!known.has(end)) throw new SchemaError(`Relation "${relation.slug}" names collection "${end}", which does not exist`, "COLLECTION_NOT_FOUND");
1042
- const current = existing.get(relation.slug);
1043
- if (current) {
1044
- if (current.parentCollection !== relation.parentCollection || current.childCollection !== relation.childCollection) throw new SchemaError(`Relation "${relation.slug}" joins ${current.parentCollection} to ${current.childCollection}; a relation's collections cannot change`, "RELATION_COLLECTIONS_IMMUTABLE");
1045
- if (onConflict === "error") throw new Error(`Conflict: relation "${relation.slug}" already exists`);
1046
- if (onConflict !== "update") {
1047
- result.relations.skipped++;
1048
- continue;
1049
- }
1050
- await db.updateTable("_emdash_relations").set({
1051
- parent_label: relation.parentLabel,
1052
- parent_label_singular: relation.parentLabelSingular ?? null,
1053
- child_label: relation.childLabel,
1054
- child_label_singular: relation.childLabelSingular ?? null,
1055
- max_children_per_parent: relation.maxChildrenPerParent ?? null,
1056
- max_parents_per_child: relation.maxParentsPerChild ?? null,
1057
- updated_at: now
1058
- }).where("slug", "=", relation.slug).execute();
1059
- result.relations.updated++;
1060
- continue;
1061
- }
1062
- await db.insertInto("_emdash_relations").values({
1063
- id: ulid(),
1064
- slug: relation.slug,
1065
- parent_collection: relation.parentCollection,
1066
- child_collection: relation.childCollection,
1067
- parent_label: relation.parentLabel,
1068
- parent_label_singular: relation.parentLabelSingular ?? null,
1069
- child_label: relation.childLabel,
1070
- child_label_singular: relation.childLabelSingular ?? null,
1071
- max_children_per_parent: relation.maxChildrenPerParent ?? null,
1072
- max_parents_per_child: relation.maxParentsPerChild ?? null,
1073
- created_at: now,
1074
- updated_at: now
1075
- }).execute();
1076
- existing.set(relation.slug, {
1077
- parentCollection: relation.parentCollection,
1078
- childCollection: relation.childCollection
1079
- });
1080
- result.relations.created++;
1081
- }
1082
- }
1083
- function allocateSeedRelationName(collectionSlug, fieldSlug, usedNames) {
1084
- const baseName = `${collectionSlug}_${fieldSlug}`.slice(0, 63);
1085
- for (let attempt = 0; attempt < SEED_RELATION_NAME_MAX_ATTEMPTS; attempt++) {
1086
- const suffix = attempt === 0 ? "" : `_${attempt + 1}`;
1087
- const name = attempt === 0 ? baseName : `${baseName.slice(0, 63 - suffix.length)}${suffix}`;
1088
- if (!usedNames.has(name)) {
1089
- usedNames.add(name);
1090
- return name;
1091
- }
1092
- }
1093
- throw new SchemaError("Could not allocate a unique relation name", "RELATION_NAME_CONFLICT");
1094
- }
1095
- /**
1096
- * Slugful entries use the existing locale-aware key. Slugless seed entries
1097
- * persist their seed ID, which keeps re-application idempotent.
1098
- */
1099
- function seedEntryKey(entry, slug, locale) {
1100
- return slug === null ? `id:${entry.id}` : `slug:${locale}:${slug}`;
1101
- }
1102
- /**
1103
- * Find which of a collection's seed entries already exist, keyed by
1104
- * `seedEntryKey`. Each query covers a batch of entries.
1105
- */
1106
- async function findExistingSeedEntries(repo, collectionSlug, entries, defaultLocale, includeTrashed = false) {
1107
- const identities = entries.map((entry) => ({
1108
- entry,
1109
- ...seedEntryIdentity(entry, defaultLocale)
1110
- }));
1111
- const slugsByLocale = /* @__PURE__ */ new Map();
1112
- for (const { slug, locale } of identities) {
1113
- if (slug === null) continue;
1114
- const slugs = slugsByLocale.get(locale);
1115
- if (slugs) slugs.push(slug);
1116
- else slugsByLocale.set(locale, [slug]);
1117
- }
1118
- const bySlug = /* @__PURE__ */ new Map();
1119
- for (const [locale, slugs] of slugsByLocale) bySlug.set(locale, await repo.findManyBySlugsInLocale(collectionSlug, slugs, locale, { includeTrashed }));
1120
- const byId = await repo.findManyByIds(collectionSlug, identities.filter(({ slug }) => slug === null).map(({ entry }) => entry.id), { includeTrashed });
1121
- const existing = /* @__PURE__ */ new Map();
1122
- for (const { entry, slug, locale } of identities) {
1123
- const item = slug === null ? byId.get(entry.id) : bySlug.get(locale)?.get(slug);
1124
- if (item) existing.set(seedEntryKey(entry, slug, locale), item);
1125
- }
1126
- return existing;
1127
- }
1128
- /**
1129
- * Apply hierarchical taxonomy terms (parents before children). Stops before
1130
- * creating a term once `mayCreate` returns false, and returns how many terms
1131
- * were found or created.
1132
- */
1133
- async function applyHierarchicalTerms(termRepo, taxonomyName, defLocale, terms, existingTerms, termSeedIdMap, result, onConflict, mayCreate) {
1134
- let processed = 0;
1135
- const slugToId = /* @__PURE__ */ new Map();
1136
- const resolveTermLocale = (term) => resolveConfiguredLocale(term.locale ?? defLocale);
1137
- let remaining = [...terms];
1138
- let maxPasses = 10;
1139
- while (remaining.length > 0 && maxPasses > 0) {
1140
- const processedThisPass = [];
1141
- for (const term of remaining) {
1142
- const termLocale = resolveTermLocale(term);
1143
- const parentReady = !term.parent || slugToId.has(`${termLocale}::${term.parent}`);
1144
- const translationReady = !term.translationOf || termSeedIdMap.has(term.translationOf);
1145
- if (!parentReady || !translationReady) continue;
1146
- const parentId = term.parent ? slugToId.get(`${termLocale}::${term.parent}`) : void 0;
1147
- const translationOf = term.translationOf ? termSeedIdMap.get(term.translationOf) : void 0;
1148
- const termKey = seedTermKey(termLocale, term.slug);
1149
- const existingId = existingTerms.get(termKey);
1150
- if (existingId) {
1151
- if (onConflict === "error") throw new Error(`Conflict: taxonomy term "${term.slug}" in "${taxonomyName}" (${termLocale}) already exists`);
1152
- if (onConflict === "update") {
1153
- await termRepo.update(existingId, {
1154
- label: term.label,
1155
- parentId,
1156
- data: term.description ? { description: term.description } : {}
1157
- });
1158
- result.taxonomies.terms++;
1159
- }
1160
- slugToId.set(termKey, existingId);
1161
- if (term.id) termSeedIdMap.set(term.id, existingId);
1162
- } else {
1163
- if (!mayCreate()) return {
1164
- processed,
1165
- complete: false
1166
- };
1167
- const created = await termRepo.create({
1168
- name: taxonomyName,
1169
- slug: term.slug,
1170
- label: term.label,
1171
- parentId,
1172
- data: term.description ? { description: term.description } : void 0,
1173
- locale: termLocale,
1174
- translationOf
1175
- });
1176
- existingTerms.set(termKey, created.id);
1177
- slugToId.set(termKey, created.id);
1178
- if (term.id) termSeedIdMap.set(term.id, created.id);
1179
- result.taxonomies.terms++;
1180
- }
1181
- processed++;
1182
- processedThisPass.push(term.slug + "::" + termLocale);
1183
- }
1184
- remaining = remaining.filter((term) => !processedThisPass.includes(term.slug + "::" + resolveTermLocale(term)));
1185
- maxPasses--;
1186
- }
1187
- if (remaining.length > 0) console.warn(`Could not process ${remaining.length} terms due to missing parents/translations`);
1188
- return {
1189
- processed,
1190
- complete: true
1191
- };
1192
- }
1193
- /**
1194
- * Apply byline credits to a content entry.
1195
- * In update mode, clears existing credits even if the seed has none.
1196
- */
1197
- async function applyContentBylines(bylineRepo, collectionSlug, contentId, entry, seedBylineIdMap, isUpdate = false) {
1198
- if (!entry.bylines || entry.bylines.length === 0) {
1199
- if (isUpdate) await bylineRepo.setContentBylines(collectionSlug, contentId, []);
1200
- return;
1201
- }
1202
- const credits = entry.bylines.map((credit) => {
1203
- const bylineId = seedBylineIdMap.get(credit.byline);
1204
- if (!bylineId) return null;
1205
- return {
1206
- bylineId,
1207
- roleLabel: credit.roleLabel ?? null
1208
- };
1209
- }).filter((credit) => Boolean(credit));
1210
- if (credits.length !== entry.bylines.length) console.warn(`content.${collectionSlug}.${entry.slug ?? entry.id}: one or more byline refs could not be resolved`);
1211
- if (credits.length > 0 || isUpdate) await bylineRepo.setContentBylines(collectionSlug, contentId, credits);
1212
- }
1213
- /**
1214
- * Apply taxonomy term assignments to a content entry.
1215
- * In update mode, clears existing assignments before re-attaching.
1216
- */
1217
- /**
1218
- * Create or update a field from a seed.
1219
- *
1220
- * A reference field bound to a relation is storage-less: it persists no column
1221
- * and its edges live in `_emdash_content_references`. Seeds create fields
1222
- * through the registry (not the schema handler that owns the relation
1223
- * lifecycle), so this mirrors the handler — it creates the relation on first
1224
- * insert (field + relation in one transaction) and preserves the
1225
- * server-assigned `validation.relation`/`targetCollection` on re-apply, since a
1226
- * seed's field validation omits them and would otherwise orphan the relation. A
1227
- * reference field with no `targetCollection` cannot form a relation, so it is
1228
- * created column-backed, holding a plain entry id.
1229
- */
1230
- async function upsertSeedField(db, collectionSlug, field, existing, knownRelations) {
1231
- const bound = resolveSeedFieldRelation(collectionSlug, field, knownRelations);
1232
- if (existing) {
1233
- const update = {
1234
- label: field.label,
1235
- type: field.type,
1236
- required: field.required || false,
1237
- unique: field.unique || false,
1238
- searchable: field.searchable || false,
1239
- indexed: field.indexed || false,
1240
- translatable: field.translatable,
1241
- defaultValue: field.defaultValue,
1242
- widget: field.widget,
1243
- options: field.options
1244
- };
1245
- if (!bound && field.type === "reference" && !existing.validation?.relation && typeof field.validation?.targetCollection === "string") {
1246
- await bindReferenceField(db, collectionSlug, existing, {
1247
- ...update,
1248
- validation: field.validation
1249
- }, field.validation.targetCollection);
1250
- return;
1251
- }
1252
- const validation = bound ? {
1253
- ...field.validation,
1254
- ...bound
1255
- } : field.type === "reference" && existing.validation?.relation ? {
1256
- ...field.validation,
1257
- relation: existing.validation.relation,
1258
- relationSide: existing.validation.relationSide,
1259
- targetCollection: existing.validation.targetCollection
1260
- } : field.validation;
1261
- await new SchemaRegistry(db).updateField(collectionSlug, field.slug, {
1262
- ...update,
1263
- validation
1264
- });
1265
- return;
1266
- }
1267
- const input = {
1268
- slug: field.slug,
1269
- label: field.label,
1270
- type: field.type,
1271
- required: field.required || false,
1272
- unique: field.unique || false,
1273
- searchable: field.searchable || false,
1274
- indexed: field.indexed || false,
1275
- translatable: field.translatable,
1276
- defaultValue: field.defaultValue,
1277
- validation: field.validation,
1278
- widget: field.widget,
1279
- options: field.options
1280
- };
1281
- if (bound) {
1282
- await new SchemaRegistry(db).createField(collectionSlug, {
1283
- ...input,
1284
- validation: {
1285
- ...field.validation,
1286
- ...bound
1287
- }
1288
- });
1289
- return;
1290
- }
1291
- const targetCollection = field.type === "reference" && typeof field.validation?.targetCollection === "string" ? field.validation.targetCollection : void 0;
1292
- if (targetCollection) {
1293
- await withTransaction(db, async (trx) => {
1294
- const relation = await createFieldRelation(trx, collectionSlug, field.slug, field.label, targetCollection, field.validation?.multiple ? null : 1);
1295
- await new SchemaRegistry(trx).createField(collectionSlug, {
1296
- ...input,
1297
- validation: {
1298
- ...field.validation,
1299
- relation: relation.slug,
1300
- relationSide: "parent"
1301
- }
1302
- });
1303
- });
1304
- return;
1305
- }
1306
- await new SchemaRegistry(db).createField(collectionSlug, input);
1307
- }
1308
- /**
1309
- * Split resolved content `data` into the plain column data and the reference
1310
- * edge writes. A reference field bound to a relation is storage-less, so its key
1311
- * left in `data` would hit the column writer (and `syncDataColumns` on publish)
1312
- * and throw "no such column". Its `$ref:`-resolved value — a child entry id or
1313
- * an array of them — is captured as an edge write instead, keyed by the field's
1314
- * relation. A reference field with no relation still owns its column, so its
1315
- * resolved id is written there like any other string.
1316
- */
1317
- /** One collection's reference fields by slug, read once per collection: the
1318
- * schema phase has finished by the time content is applied. */
1319
- function referenceFieldsOf(collection) {
1320
- return new Map((collection?.fields ?? []).filter((f) => f.type === "reference").map((f) => [f.slug, f]));
1321
- }
1322
- function splitReferenceFields(collectionSlug, referenceFields, data) {
1323
- if (referenceFields.size === 0) return {
1324
- columnData: data,
1325
- edges: []
1326
- };
1327
- const columnData = {};
1328
- const edges = [];
1329
- for (const [key, value] of Object.entries(data)) {
1330
- if (!referenceFields.get(key)?.validation?.relation) {
1331
- columnData[key] = value;
1332
- continue;
1333
- }
1334
- const childIds = [];
1335
- for (const candidate of Array.isArray(value) ? value : [value]) {
1336
- if (typeof candidate !== "string" || candidate.length === 0) continue;
1337
- if (candidate.startsWith("$ref:")) {
1338
- console.warn(`content.${collectionSlug}: reference "${candidate}" in field "${key}" did not resolve (not yet created or missing). Skipping.`);
1339
- continue;
1340
- }
1341
- childIds.push(candidate);
1342
- }
1343
- edges.push({
1344
- fieldSlug: key,
1345
- childIds
1346
- });
1347
- }
1348
- return {
1349
- columnData,
1350
- edges
1351
- };
1352
- }
1353
- /**
1354
- * Write reference edges for a content entry, replacing any existing set per
1355
- * relation (so re-applying a seed is idempotent). Throws to abort the enclosing
1356
- * transaction if a child entry cannot be resolved — a half-written entry is
1357
- * worse than a failed apply.
1358
- */
1359
- async function applyContentReferences(trx, collectionSlug, contentId, edges) {
1360
- for (const { fieldSlug, childIds } of edges) {
1361
- const result = await setReferenceSelection(trx, collectionSlug, contentId, fieldSlug, childIds);
1362
- if (!result.success) throw new Error(`content.${collectionSlug}: failed to write references for "${contentId}": ${result.error.message}`);
1363
- }
1364
- }
1365
- async function applyContentTaxonomies(db, collectionSlug, contentId, entry, isUpdate) {
1366
- const termRepo = new TaxonomyRepository(db);
1367
- if (isUpdate) await termRepo.clearEntryTerms(collectionSlug, contentId);
1368
- if (!entry.taxonomies) {
1369
- if (isUpdate) {
1370
- const { invalidateTermCache } = await import("./taxonomies-DQSywBvX.mjs").then((n) => n.f);
1371
- invalidateTermCache();
1372
- }
1373
- return;
1374
- }
1375
- for (const [taxonomyName, termSlugs] of Object.entries(entry.taxonomies)) for (const termSlug of termSlugs) {
1376
- const term = await termRepo.findBySlug(taxonomyName, termSlug);
1377
- if (term) await termRepo.attachToEntry(collectionSlug, contentId, term.id);
1378
- }
1379
- const { invalidateTermCache } = await import("./taxonomies-DQSywBvX.mjs").then((n) => n.f);
1380
- invalidateTermCache();
1381
- }
1382
- /**
1383
- * Apply menu items recursively.
1384
- *
1385
- * When a `SeedMenuItem` carries `id`/`translationOf`, the import resolves the
1386
- * source item's `translation_group` so cross-locale "same nav entry" links
1387
- * survive export → apply. Items without `translationOf` get a fresh group
1388
- * (= their own id).
1389
- */
1390
- async function applyMenuItems(db, menuId, locale, items, parentId, startOrder, seedIdMap, itemSeedIdMap) {
1391
- let count = 0;
1392
- let order = startOrder;
1393
- for (const item of items) {
1394
- const itemId = ulid();
1395
- const itemLocale = item.locale ?? locale;
1396
- let referenceId = null;
1397
- let referenceCollection = null;
1398
- if (item.type !== "custom" && item.type !== "taxonomy") {
1399
- const collection = item.collection || (item.type === "page" || item.type === "post" ? `${item.type}s` : null);
1400
- if (item.ref) {
1401
- const resolved = seedIdMap.get(item.ref);
1402
- if (resolved && collection) {
1403
- referenceId = resolved;
1404
- referenceCollection = collection;
1405
- }
1406
- } else referenceCollection = collection;
1407
- }
1408
- let translationGroup = itemId;
1409
- if (item.translationOf) {
1410
- const source = itemSeedIdMap.get(item.translationOf);
1411
- if (source) translationGroup = source.translationGroup;
1412
- else console.warn(`menu item "${item.label ?? item.url ?? item.ref ?? "(unlabeled)"}" (${itemLocale}): translationOf "${item.translationOf}" not found yet; minting a fresh group.`);
1413
- }
1414
- await db.insertInto("_emdash_menu_items").values({
1415
- id: itemId,
1416
- menu_id: menuId,
1417
- parent_id: parentId,
1418
- sort_order: order,
1419
- type: item.type,
1420
- reference_collection: referenceCollection,
1421
- reference_id: referenceId,
1422
- custom_url: item.url ?? null,
1423
- label: item.label || "",
1424
- title_attr: item.titleAttr ?? null,
1425
- target: item.target ?? null,
1426
- css_classes: item.cssClasses ?? null,
1427
- created_at: (/* @__PURE__ */ new Date()).toISOString(),
1428
- locale: itemLocale,
1429
- translation_group: translationGroup
1430
- }).execute();
1431
- if (item.id) itemSeedIdMap.set(item.id, {
1432
- id: itemId,
1433
- translationGroup
1434
- });
1435
- count++;
1436
- order++;
1437
- if (item.children && item.children.length > 0) {
1438
- const childCount = await applyMenuItems(db, menuId, itemLocale, item.children, itemId, 0, seedIdMap, itemSeedIdMap);
1439
- count += childCount;
1440
- }
1441
- }
1442
- return count;
1443
- }
1444
- /**
1445
- * Apply a widget
1446
- */
1447
- async function applyWidget(db, areaId, widget, sortOrder) {
1448
- await db.insertInto("_emdash_widgets").values({
1449
- id: ulid(),
1450
- area_id: areaId,
1451
- sort_order: sortOrder,
1452
- type: widget.type,
1453
- title: widget.title ?? null,
1454
- content: widget.content ? JSON.stringify(widget.content) : null,
1455
- menu_name: widget.menuName ?? null,
1456
- component_id: widget.componentId ?? null,
1457
- component_props: widget.props ? JSON.stringify(widget.props) : null
1458
- }).execute();
1459
- }
1460
- /**
1461
- * Type guard for $media reference
1462
- */
1463
- function isSeedMediaReference(value) {
1464
- if (typeof value !== "object" || value === null || !("$media" in value)) return false;
1465
- const media = value.$media;
1466
- return typeof media === "object" && media !== null && "url" in media && typeof media.url === "string";
1467
- }
1468
- /**
1469
- * Resolve $ref: and $media references in content data
1470
- */
1471
- async function resolveReferences(data, seedIdMap, mediaContext, result) {
1472
- const resolved = {};
1473
- for (const [key, value] of Object.entries(data)) resolved[key] = await resolveValue(value, seedIdMap, mediaContext, result);
1474
- return resolved;
1475
- }
1476
- /**
1477
- * Resolve a single value recursively
1478
- */
1479
- async function resolveValue(value, seedIdMap, mediaContext, result) {
1480
- if (typeof value === "string" && value.startsWith("$ref:")) {
1481
- const seedId = value.slice(5);
1482
- return seedIdMap.get(seedId) ?? value;
1483
- }
1484
- if (isSeedMediaReference(value)) return resolveMedia(value, mediaContext, result);
1485
- if (Array.isArray(value)) return Promise.all(value.map((item) => resolveValue(item, seedIdMap, mediaContext, result)));
1486
- if (typeof value === "object" && value !== null) {
1487
- const resolved = {};
1488
- for (const [k, v] of Object.entries(value)) resolved[k] = await resolveValue(v, seedIdMap, mediaContext, result);
1489
- if (resolved._type === "gallery" && Array.isArray(resolved.images)) resolved.images = sanitizeGalleryImages(resolved.images, ulid);
1490
- else if (resolved._type === "image" && "asset" in value && isSeedMediaReference(value.asset)) {
1491
- const [image] = sanitizeGalleryImages([resolved], ulid);
1492
- if (image) Object.assign(resolved, image);
1493
- }
1494
- return resolved;
1495
- }
1496
- return value;
1497
- }
1498
- /**
1499
- * Resolve a seeded byline avatar to a `media` row id. The file is assumed to
1500
- * already exist in storage (the caller supplies its `storageKey`), so nothing
1501
- * is downloaded or uploaded.
1502
- *
1503
- * Idempotent: if a media row with the same `storageKey` already exists it is
1504
- * reused rather than duplicated, so re-applying a seed in `update` mode does
1505
- * not leak rows. `created` reports whether a new row was inserted, so the
1506
- * caller can both account for it and delete it if the subsequent byline write
1507
- * fails (the only cross-dialect way to avoid an orphan — `withTransaction`
1508
- * is a no-op on D1).
1509
- */
1510
- async function resolveSeedBylineAvatar(db, avatar) {
1511
- const existing = await db.selectFrom("media").select("id").where("storage_key", "=", avatar.storageKey).orderBy("id", "asc").executeTakeFirst();
1512
- if (existing) return {
1513
- id: existing.id,
1514
- created: false
1515
- };
1516
- const basename = avatar.storageKey.split("/").pop();
1517
- const filename = avatar.filename ?? (basename && basename.length > 0 ? basename : avatar.storageKey);
1518
- return {
1519
- id: (await new MediaRepository(db).create({
1520
- filename,
1521
- mimeType: avatar.mimeType ?? "image/jpeg",
1522
- storageKey: avatar.storageKey,
1523
- alt: avatar.alt,
1524
- width: avatar.width,
1525
- height: avatar.height,
1526
- status: "ready"
1527
- })).id,
1528
- created: true
1529
- };
1530
- }
1531
- /**
1532
- * Delete a media row by id. Best-effort cleanup for a failed byline write: a
1533
- * failure here must not mask the original error that triggered the cleanup, so
1534
- * it is logged and swallowed rather than thrown.
1535
- */
1536
- async function deleteMediaRow(db, id) {
1537
- try {
1538
- await db.deleteFrom("media").where("id", "=", id).execute();
1539
- } catch (error) {
1540
- console.warn(`[seed] failed to clean up orphaned avatar media ${id}:`, error);
1541
- }
1542
- }
1543
- /**
1544
- * Resolve a $media reference by downloading and uploading the media
1545
- */
1546
- async function resolveMedia(ref, ctx, result) {
1547
- const { url, alt, filename, caption } = ref.$media;
1548
- const cached = ctx.mediaCache.get(url);
1549
- if (cached) {
1550
- result.media.skipped++;
1551
- return {
1552
- ...cached,
1553
- alt: alt ?? cached.alt
1554
- };
1555
- }
1556
- if (ctx.skipMediaDownload) {
1557
- const mediaValue = {
1558
- provider: "external",
1559
- id: ulid(),
1560
- src: url,
1561
- alt: alt ?? void 0,
1562
- filename: filename ?? void 0
1563
- };
1564
- ctx.mediaCache.set(url, mediaValue);
1565
- result.media.created++;
1566
- return mediaValue;
1567
- }
1568
- if (!ctx.storage) {
1569
- console.warn(`Skipping $media reference (no storage configured): ${url}`);
1570
- result.media.skipped++;
1571
- return null;
1572
- }
1573
- try {
1574
- validateExternalUrl(url);
1575
- console.log(` 📥 Downloading: ${url}`);
1576
- ctx.budget?.countMediaDownload();
1577
- const response = await ssrfSafeFetch(url, { headers: { "User-Agent": "EmDash-CMS/1.0" } });
1578
- if (!response.ok) {
1579
- console.warn(` ⚠️ Failed to download ${url}: ${response.status}`);
1580
- result.media.skipped++;
1581
- return null;
1582
- }
1583
- const contentType = response.headers.get("content-type") || "application/octet-stream";
1584
- const ext = getExtensionFromContentType(contentType) || getExtensionFromUrl(url) || ".bin";
1585
- const storageId = ulid();
1586
- const finalFilename = filename || generateFilename(url, ext);
1587
- const storageKey = `${storageId}${ext}`;
1588
- const arrayBuffer = await response.arrayBuffer();
1589
- const body = new Uint8Array(arrayBuffer);
1590
- let width;
1591
- let height;
1592
- if (contentType.startsWith("image/")) {
1593
- const dimensions = getImageDimensions(body);
1594
- width = dimensions?.width;
1595
- height = dimensions?.height;
1596
- }
1597
- await ctx.storage.upload({
1598
- key: storageKey,
1599
- body,
1600
- contentType
1601
- });
1602
- const mediaValue = {
1603
- provider: "local",
1604
- id: (await new MediaRepository(ctx.db).create({
1605
- filename: finalFilename,
1606
- mimeType: contentType,
1607
- size: body.length,
1608
- width,
1609
- height,
1610
- alt,
1611
- caption,
1612
- storageKey,
1613
- status: "ready"
1614
- })).id,
1615
- alt: alt ?? void 0,
1616
- width,
1617
- height,
1618
- mimeType: contentType,
1619
- filename: finalFilename,
1620
- meta: { storageKey }
1621
- };
1622
- ctx.mediaCache.set(url, mediaValue);
1623
- result.media.created++;
1624
- console.log(` ✅ Uploaded: ${finalFilename}`);
1625
- return mediaValue;
1626
- } catch (error) {
1627
- console.warn(` ⚠️ Error processing $media ${url}:`, error instanceof Error ? error.message : error);
1628
- result.media.skipped++;
1629
- return null;
1630
- }
1631
- }
1632
- /**
1633
- * Get file extension from content type
1634
- */
1635
- function getExtensionFromContentType(contentType) {
1636
- const baseMime = contentType.split(";")[0].trim();
1637
- const ext = mime.getExtension(baseMime);
1638
- return ext ? `.${ext}` : null;
1639
- }
1640
- /**
1641
- * Get file extension from URL
1642
- */
1643
- function getExtensionFromUrl(url) {
1644
- try {
1645
- const match = new URL(url).pathname.match(FILE_EXTENSION_PATTERN);
1646
- return match ? `.${match[1]}` : null;
1647
- } catch {
1648
- return null;
1649
- }
1650
- }
1651
- /**
1652
- * Generate a filename from URL
1653
- */
1654
- function generateFilename(url, ext) {
1655
- try {
1656
- return `${(new URL(url).pathname.split("/").pop() || "media").replace(EXTENSION_PATTERN, "").replace(QUERY_PARAM_PATTERN, "").replace(SANITIZE_PATTERN, "-").replace(MULTIPLE_HYPHENS_PATTERN, "-") || "media"}${ext}`;
1657
- } catch {
1658
- return `media${ext}`;
1659
- }
1660
- }
1661
- /**
1662
- * Get image dimensions from buffer using image-size.
1663
- * Supports PNG, JPEG, GIF, WebP, AVIF, SVG, TIFF, and more.
1664
- */
1665
- function getImageDimensions(buffer) {
1666
- try {
1667
- const result = imageSize(buffer);
1668
- if (result.width != null && result.height != null) return {
1669
- width: result.width,
1670
- height: result.height
1671
- };
1672
- return null;
1673
- } catch {
1674
- return null;
1675
- }
1676
- }
1677
-
1678
- //#endregion
1679
- export { sanitizeGalleryImages as a, resolveImageMedia as i, applySeedWithinBudget as n, createPublicMediaUrlResolver as o, apply_exports as r, applySeed as t };
1680
- //# sourceMappingURL=apply-Cx48saFC.mjs.map