dineway 0.1.45 → 0.1.46

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 (387) hide show
  1. package/dist/{activity-events-CpcTzKpF.mjs → activity-events-CNk3clTT.mjs} +1 -1
  2. package/dist/{allowed-origins-3RuuoFjC.mjs → allowed-origins-DhipQNLb.mjs} +1 -1
  3. package/dist/api/route-utils.d.mts +9 -10
  4. package/dist/api/route-utils.mjs +13 -13
  5. package/dist/api/schemas/index.d.mts +2 -2
  6. package/dist/api/schemas/index.mjs +4 -4
  7. package/dist/{api-DkFSCD74.mjs → api-Bmfii2mH.mjs} +101 -56
  8. package/dist/{api-tokens-BFg7tiOQ.mjs → api-tokens-DtvdtIkm.mjs} +1 -1
  9. package/dist/{apply-TIoQ00aH.mjs → apply-BpRBCqUt.mjs} +76 -31
  10. package/dist/astro/index.d.mts +10 -11
  11. package/dist/astro/index.mjs +23 -3
  12. package/dist/astro/middleware/auth.d.mts +9 -10
  13. package/dist/astro/middleware/auth.mjs +5 -5
  14. package/dist/astro/middleware/redirect.mjs +13 -7
  15. package/dist/astro/middleware/request-context.mjs +3 -3
  16. package/dist/astro/middleware/seed.d.mts +1 -1
  17. package/dist/astro/middleware/seed.mjs +2 -2
  18. package/dist/astro/middleware/setup.mjs +1 -1
  19. package/dist/astro/middleware.mjs +120 -82
  20. package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +5 -5
  21. package/dist/astro/routes/api/admin/allowed-domains/index.mjs +5 -5
  22. package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +4 -4
  23. package/dist/astro/routes/api/admin/api-tokens/index.mjs +6 -6
  24. package/dist/astro/routes/api/admin/briefing.mjs +17 -17
  25. package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.d.mts +7 -0
  26. package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +17 -0
  27. package/dist/astro/routes/api/admin/byline-fields/_slug_.d.mts +9 -0
  28. package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +38 -0
  29. package/dist/astro/routes/api/admin/byline-fields/index.d.mts +8 -0
  30. package/dist/astro/routes/api/admin/byline-fields/index.mjs +31 -0
  31. package/dist/astro/routes/api/admin/byline-fields/reorder.d.mts +7 -0
  32. package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +24 -0
  33. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +27 -27
  34. package/dist/astro/routes/api/admin/bylines/_id_/translations.d.mts +8 -0
  35. package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +57 -0
  36. package/dist/astro/routes/api/admin/bylines/index.mjs +30 -26
  37. package/dist/astro/routes/api/admin/comments/_id_/status.mjs +11 -11
  38. package/dist/astro/routes/api/admin/comments/_id_.mjs +5 -5
  39. package/dist/astro/routes/api/admin/comments/bulk.mjs +9 -9
  40. package/dist/astro/routes/api/admin/comments/counts.mjs +5 -5
  41. package/dist/astro/routes/api/admin/comments/index.mjs +9 -9
  42. package/dist/astro/routes/api/admin/context/_id_/history.mjs +23 -23
  43. package/dist/astro/routes/api/admin/context/_id_/index.mjs +23 -23
  44. package/dist/astro/routes/api/admin/context/_id_/review.mjs +27 -27
  45. package/dist/astro/routes/api/admin/context/_id_/supersede.mjs +27 -27
  46. package/dist/astro/routes/api/admin/context/diff.mjs +26 -26
  47. package/dist/astro/routes/api/admin/context/index.mjs +27 -27
  48. package/dist/astro/routes/api/admin/context/stale.mjs +26 -26
  49. package/dist/astro/routes/api/admin/hitl-requests/_id_/index.mjs +23 -23
  50. package/dist/astro/routes/api/admin/hitl-requests/_id_/resolve.mjs +26 -26
  51. package/dist/astro/routes/api/admin/hitl-requests/index.mjs +26 -26
  52. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +24 -24
  53. package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +2 -2
  54. package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +6 -6
  55. package/dist/astro/routes/api/admin/oauth-clients/index.mjs +6 -6
  56. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +48 -44
  57. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +48 -44
  58. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +42 -38
  59. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +47 -43
  60. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +47 -43
  61. package/dist/astro/routes/api/admin/plugins/index.mjs +42 -38
  62. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +2 -2
  63. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +42 -38
  64. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +47 -43
  65. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +42 -38
  66. package/dist/astro/routes/api/admin/plugins/updates.mjs +42 -38
  67. package/dist/astro/routes/api/admin/review-requests/_id_/index.mjs +5 -5
  68. package/dist/astro/routes/api/admin/review-requests/_id_/resolve.mjs +26 -26
  69. package/dist/astro/routes/api/admin/review-requests/index.mjs +9 -9
  70. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +42 -38
  71. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +2 -2
  72. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +42 -38
  73. package/dist/astro/routes/api/admin/users/_id_/disable.mjs +1 -1
  74. package/dist/astro/routes/api/admin/users/_id_/enable.mjs +1 -1
  75. package/dist/astro/routes/api/admin/users/_id_/index.mjs +5 -5
  76. package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +2 -2
  77. package/dist/astro/routes/api/admin/users/index.mjs +5 -5
  78. package/dist/astro/routes/api/auth/dev-bypass.mjs +5 -5
  79. package/dist/astro/routes/api/auth/invite/accept.mjs +1 -1
  80. package/dist/astro/routes/api/auth/invite/complete.mjs +9 -9
  81. package/dist/astro/routes/api/auth/invite/index.mjs +6 -6
  82. package/dist/astro/routes/api/auth/invite/register-options.mjs +8 -8
  83. package/dist/astro/routes/api/auth/logout.mjs +2 -2
  84. package/dist/astro/routes/api/auth/magic-link/send.mjs +8 -8
  85. package/dist/astro/routes/api/auth/magic-link/verify.mjs +2 -2
  86. package/dist/astro/routes/api/auth/me.mjs +20 -11
  87. package/dist/astro/routes/api/auth/mode.mjs +1 -1
  88. package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +2 -2
  89. package/dist/astro/routes/api/auth/oauth/_provider_.mjs +2 -2
  90. package/dist/astro/routes/api/auth/passkey/_id_.mjs +5 -5
  91. package/dist/astro/routes/api/auth/passkey/index.mjs +1 -1
  92. package/dist/astro/routes/api/auth/passkey/options.mjs +10 -10
  93. package/dist/astro/routes/api/auth/passkey/register/options.mjs +8 -8
  94. package/dist/astro/routes/api/auth/passkey/register/verify.mjs +9 -9
  95. package/dist/astro/routes/api/auth/passkey/verify.mjs +9 -9
  96. package/dist/astro/routes/api/auth/setup-token/index.mjs +5 -5
  97. package/dist/astro/routes/api/auth/setup-token/verify.mjs +2 -2
  98. package/dist/astro/routes/api/auth/signup/complete.mjs +9 -9
  99. package/dist/astro/routes/api/auth/signup/request.mjs +8 -8
  100. package/dist/astro/routes/api/auth/signup/verify.mjs +1 -1
  101. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +12 -12
  102. package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +2 -2
  103. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +5 -5
  104. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +5 -5
  105. package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +5 -5
  106. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +11 -11
  107. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +9 -9
  108. package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +5 -5
  109. package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +2 -2
  110. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +9 -9
  111. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +20 -14
  112. package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +2 -2
  113. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +5 -5
  114. package/dist/astro/routes/api/content/_collection_/_id_.mjs +12 -10
  115. package/dist/astro/routes/api/content/_collection_/index.mjs +9 -9
  116. package/dist/astro/routes/api/content/_collection_/trash.mjs +6 -6
  117. package/dist/astro/routes/api/dashboard.mjs +8 -8
  118. package/dist/astro/routes/api/dev/emails.mjs +2 -2
  119. package/dist/astro/routes/api/health.mjs +1 -1
  120. package/dist/astro/routes/api/import/probe.d.mts +3 -3
  121. package/dist/astro/routes/api/import/probe.mjs +10 -10
  122. package/dist/astro/routes/api/import/wordpress/analyze.mjs +7 -7
  123. package/dist/astro/routes/api/import/wordpress/execute.mjs +29 -28
  124. package/dist/astro/routes/api/import/wordpress/media.mjs +10 -10
  125. package/dist/astro/routes/api/import/wordpress/prepare.mjs +31 -31
  126. package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.d.mts +5 -1
  127. package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.mjs +16 -1
  128. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +30 -30
  129. package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
  130. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +13 -13
  131. package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +1 -1
  132. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +31 -30
  133. package/dist/astro/routes/api/manifest.mjs +4 -4
  134. package/dist/astro/routes/api/mcp.mjs +75 -50
  135. package/dist/astro/routes/api/media/_id_/confirm.mjs +8 -8
  136. package/dist/astro/routes/api/media/_id_.mjs +6 -6
  137. package/dist/astro/routes/api/media/file/_...key_.mjs +1 -1
  138. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +2 -2
  139. package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +2 -2
  140. package/dist/astro/routes/api/media/providers/index.mjs +2 -2
  141. package/dist/astro/routes/api/media/upload-url.mjs +10 -10
  142. package/dist/astro/routes/api/media.mjs +14 -13
  143. package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +27 -27
  144. package/dist/astro/routes/api/menus/_name_/items.mjs +27 -27
  145. package/dist/astro/routes/api/menus/_name_/reorder.mjs +27 -27
  146. package/dist/astro/routes/api/menus/_name_/translations.mjs +27 -27
  147. package/dist/astro/routes/api/menus/_name_.mjs +27 -27
  148. package/dist/astro/routes/api/menus/index.mjs +27 -27
  149. package/dist/astro/routes/api/oauth/authorize.mjs +7 -7
  150. package/dist/astro/routes/api/oauth/device/authorize.mjs +6 -6
  151. package/dist/astro/routes/api/oauth/device/code.mjs +9 -9
  152. package/dist/astro/routes/api/oauth/device/token.mjs +8 -8
  153. package/dist/astro/routes/api/oauth/register.mjs +4 -4
  154. package/dist/astro/routes/api/oauth/token/refresh.mjs +6 -6
  155. package/dist/astro/routes/api/oauth/token/revoke.mjs +6 -6
  156. package/dist/astro/routes/api/oauth/token.mjs +6 -6
  157. package/dist/astro/routes/api/openapi.json.mjs +10 -7
  158. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +3 -3
  159. package/dist/astro/routes/api/redirects/404s/index.mjs +10 -10
  160. package/dist/astro/routes/api/redirects/404s/summary.mjs +10 -10
  161. package/dist/astro/routes/api/redirects/_id_.mjs +28 -28
  162. package/dist/astro/routes/api/redirects/index.mjs +28 -28
  163. package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +2 -2
  164. package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +2 -2
  165. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +43 -39
  166. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +43 -39
  167. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +43 -39
  168. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +43 -39
  169. package/dist/astro/routes/api/schema/collections/index.mjs +43 -39
  170. package/dist/astro/routes/api/schema/index.mjs +7 -7
  171. package/dist/astro/routes/api/schema/orphans/_slug_.mjs +42 -38
  172. package/dist/astro/routes/api/schema/orphans/index.mjs +42 -38
  173. package/dist/astro/routes/api/search/enable.mjs +11 -11
  174. package/dist/astro/routes/api/search/index.mjs +10 -10
  175. package/dist/astro/routes/api/search/rebuild.mjs +11 -11
  176. package/dist/astro/routes/api/search/stats.mjs +7 -7
  177. package/dist/astro/routes/api/search/suggest.mjs +10 -10
  178. package/dist/astro/routes/api/sections/_slug_.mjs +27 -27
  179. package/dist/astro/routes/api/sections/index.mjs +27 -27
  180. package/dist/astro/routes/api/settings/email.mjs +3 -3
  181. package/dist/astro/routes/api/settings.mjs +27 -27
  182. package/dist/astro/routes/api/setup/admin-verify.mjs +11 -11
  183. package/dist/astro/routes/api/setup/admin.mjs +9 -9
  184. package/dist/astro/routes/api/setup/dev-bypass.mjs +24 -23
  185. package/dist/astro/routes/api/setup/dev-reset.mjs +1 -1
  186. package/dist/astro/routes/api/setup/index.mjs +25 -24
  187. package/dist/astro/routes/api/setup/status.mjs +3 -3
  188. package/dist/astro/routes/api/snapshot.mjs +7 -6
  189. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +30 -29
  190. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +30 -29
  191. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +30 -29
  192. package/dist/astro/routes/api/taxonomies/index.mjs +30 -29
  193. package/dist/astro/routes/api/themes/preview.mjs +4 -4
  194. package/dist/astro/routes/api/typegen.mjs +4 -4
  195. package/dist/astro/routes/api/well-known/auth.mjs +2 -2
  196. package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +3 -3
  197. package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +3 -3
  198. package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +26 -26
  199. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +27 -27
  200. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +27 -27
  201. package/dist/astro/routes/api/widget-areas/_name_.mjs +25 -25
  202. package/dist/astro/routes/api/widget-areas/index.mjs +27 -27
  203. package/dist/astro/routes/api/widget-components.mjs +2 -2
  204. package/dist/astro/routes/robots.txt.mjs +7 -7
  205. package/dist/astro/routes/sitemap-_collection_.xml.mjs +59 -15
  206. package/dist/astro/routes/sitemap.xml.mjs +8 -8
  207. package/dist/astro/session-driver.d.mts +1 -1
  208. package/dist/astro/session-driver.mjs +3 -3
  209. package/dist/astro/types.d.mts +16 -14
  210. package/dist/{audit-NgiRzqP9.mjs → audit-DuRbTm8L.mjs} +1 -1
  211. package/dist/auth/providers/github.d.mts +1 -1
  212. package/dist/auth/providers/google.d.mts +1 -1
  213. package/dist/{auth-control-guard-1FHtkDP6.mjs → auth-control-guard-Dr14I98m.mjs} +1 -1
  214. package/dist/{authorize-BbIhZi3a.mjs → authorize-BLO0m7fW.mjs} +1 -1
  215. package/dist/{briefing-Jsxs587i.mjs → briefing-BFEWeJtR.mjs} +6 -6
  216. package/dist/{briefing-DD82WaEy.mjs → briefing-C4fJSVYW.mjs} +1 -1
  217. package/dist/byline-CXQcMsBu.mjs +628 -0
  218. package/dist/{bylines-BU6b8jSi.d.mts → byline-fields-CaF_xfpj.d.mts} +146 -15
  219. package/dist/{import-Br7aP9yh.mjs → byline-fields-D7TJ_oHF.mjs} +57 -3
  220. package/dist/byline-fields-Dc7L6Yry.mjs +113 -0
  221. package/dist/byline-registry-CL8BxPPp.mjs +287 -0
  222. package/dist/bylines-BgriNlW7.mjs +165 -0
  223. package/dist/bylines-D2vqm1aZ.mjs +163 -0
  224. package/dist/{cache-DQyZ-QaB.mjs → cache-GRK71jOU.mjs} +2 -2
  225. package/dist/{chunks-D8KL0nCY.mjs → chunks-DgEw12Bc.mjs} +1 -1
  226. package/dist/cli/index.mjs +958 -89
  227. package/dist/client/external-auth-headers.d.mts +1 -1
  228. package/dist/client/index.d.mts +2 -1
  229. package/dist/client/index.mjs +5 -2
  230. package/dist/{comment-BmJXz3lc.mjs → comment-ogMaF1gk.mjs} +1 -1
  231. package/dist/{comments-yTbeIYc2.mjs → comments-CTSOKrZq.mjs} +1 -1
  232. package/dist/{connection-BCNICDWN.mjs → connection-CiJWiWya.mjs} +44 -13
  233. package/dist/{content-DvpMad_N.mjs → content-BfyjOiMi.mjs} +24 -4
  234. package/dist/content-index-names-Bbu1FY1r.mjs +26 -0
  235. package/dist/{context-DgqEfcWz.mjs → context-DRhmPCiE.mjs} +2 -2
  236. package/dist/{context-Ufrm1lOv.mjs → context-ZMHhwzkG.mjs} +8 -8
  237. package/dist/{context-route-helpers-Dq5U_AXp.mjs → context-route-helpers-YLWx2N1j.mjs} +1 -1
  238. package/dist/{dashboard-BC9bgPOH.mjs → dashboard-D0gWuzNp.mjs} +4 -4
  239. package/dist/db/index.d.mts +3 -3
  240. package/dist/db/index.mjs +2 -2
  241. package/dist/db/libsql.d.mts +1 -1
  242. package/dist/db/libsql.mjs +1 -1
  243. package/dist/db/postgres.d.mts +1 -1
  244. package/dist/db/sqlite.d.mts +1 -1
  245. package/dist/db/sqlite.mjs +1 -1
  246. package/dist/{device-flow-CTS91g4A.mjs → device-flow-BL5ZRlc1.mjs} +4 -4
  247. package/dist/{dialect-helpers-TkdbkFad.mjs → dialect-helpers-fk43GbDb.mjs} +13 -3
  248. package/dist/{fts-manager-DnfOsF4s.mjs → fts-manager-EHY2Kes9.mjs} +2 -2
  249. package/dist/{hitl-requests-DaRuZ7tb.mjs → hitl-requests-B4Hkt0TO.mjs} +2 -2
  250. package/dist/{hitl-route-helpers-DcPySbZ3.mjs → hitl-route-helpers-CHjdfQ0s.mjs} +4 -4
  251. package/dist/{import-DSXK3aQF.mjs → import-CvHY6sf5.mjs} +3 -3
  252. package/dist/{index-BwOO3vu2.d.mts → index-DJVaYiUV.d.mts} +2 -2
  253. package/dist/index.d.mts +16 -17
  254. package/dist/index.mjs +69 -65
  255. package/dist/{jsonld-CLbYsYYH.d.mts → jsonld-AcPnCEGD.d.mts} +2 -2
  256. package/dist/{load-BCCcmoW9.mjs → load-BdbvtoDb.mjs} +1 -1
  257. package/dist/{loader-p2imNN98.mjs → loader-Y0QvC_QO.mjs} +167 -61
  258. package/dist/media/index.d.mts +1 -2
  259. package/dist/media/index.mjs +2 -2
  260. package/dist/media/local-runtime.d.mts +11 -12
  261. package/dist/media/local-runtime.mjs +2 -2
  262. package/dist/{media-Cg4zc9fq.mjs → media-DhBwiCYR.mjs} +6 -1
  263. package/dist/{media-allowlist-D8gsm8_t.mjs → media-allowlist-BsXkT9RK.mjs} +1 -1
  264. package/dist/{menus-DOaL6NaF.mjs → menus-BzGQpw9d.mjs} +2 -2
  265. package/dist/{menus-DzG3-9tQ.mjs → menus-fqqzXyHd.mjs} +5 -5
  266. package/dist/{oauth-authorization-DyOFXQWq.mjs → oauth-authorization-Dk3_LOfj.mjs} +4 -4
  267. package/dist/{oauth-clients-BMs_bmoz.mjs → oauth-clients-CzeMGyUU.mjs} +2 -2
  268. package/dist/page/index.d.mts +2 -2
  269. package/dist/page/index.mjs +1 -1
  270. package/dist/{parse-D7Tu6ku4.mjs → parse-CneSgl7-.mjs} +1 -1
  271. package/dist/{types-cn-fvYQ1.d.mts → placeholder-CXfoCtCd.d.mts} +38 -1
  272. package/dist/plugin-utils.d.mts +22 -10
  273. package/dist/plugin-utils.mjs +8 -10
  274. package/dist/plugins/adapt-sandbox-entry.d.mts +9 -10
  275. package/dist/plugins/adapt-sandbox-entry.mjs +1 -1
  276. package/dist/{plugins-DCDVDF4B.mjs → plugins-BQ5Joz6v.mjs} +36 -6
  277. package/dist/{preview-BhgxNRWI.mjs → preview-D5rvDhRt.mjs} +7 -7
  278. package/dist/{provider-loader-B19YyyBp.d.mts → provider-loader-B5PMjpN7.d.mts} +1 -1
  279. package/dist/{query-BnRpB09I.mjs → query-BJuUydtD.mjs} +3 -3
  280. package/dist/{query-DHvNhBhi.mjs → query-CSx0EdSW.mjs} +30 -18
  281. package/dist/{rate-limit-BWP_kKiZ.mjs → rate-limit-i0G3IAOX.mjs} +2 -2
  282. package/dist/{redirect-BaVvo2te.mjs → redirect-BqFMj67n.mjs} +20 -6
  283. package/dist/{redirects-Ba-lJA5j.mjs → redirects-CJwHl_YG.mjs} +3 -3
  284. package/dist/{redirects-x5ol_Qj9.mjs → redirects-q_cToaHv.mjs} +29 -8
  285. package/dist/{registry-i__XP2WV.mjs → registry-Cq3QRBW2.mjs} +14 -5
  286. package/dist/{request-cache-BpwuE2ix.mjs → request-cache-w5cj5itT.mjs} +9 -1
  287. package/dist/{request-meta-DUGfAeXy.mjs → request-meta-DAb6xaP9.mjs} +1 -1
  288. package/dist/resolve-DTuDyYKs.mjs +100 -0
  289. package/dist/{review-requests-DuIxM4YM.mjs → review-requests-GYqjl2jO.mjs} +1 -1
  290. package/dist/{review-requests-CTUU_RJm.mjs → review-requests-tPw8_pAO.mjs} +1 -1
  291. package/dist/{runner-FhUNNaqA.d.mts → runner-Cnz4dl0f.d.mts} +1 -1
  292. package/dist/{runner-DF2DgD_B.mjs → runner-DTfG5v0G.mjs} +574 -196
  293. package/dist/{runtime-1bE80cmL.d.mts → runtime-Cd-kjPfN.d.mts} +1155 -273
  294. package/dist/runtime.d.mts +10 -11
  295. package/dist/runtime.mjs +4 -4
  296. package/dist/schema-DmHMWnSA.mjs +8 -0
  297. package/dist/{search-Cl9preJT.mjs → search-BAiFLz81.mjs} +3 -3
  298. package/dist/{sections-Zx-2q9IH.mjs → sections-DsuIrFDC.mjs} +2 -2
  299. package/dist/seed/index.d.mts +2 -2
  300. package/dist/seed/index.mjs +18 -17
  301. package/dist/seo/index.d.mts +1 -1
  302. package/dist/seo/index.mjs +1 -0
  303. package/dist/{seo-CJBiMDkj.mjs → seo-5lJOtB5J.mjs} +4 -2
  304. package/dist/{seo-BPb_reaG.mjs → seo-uMFBaR8G.mjs} +1 -1
  305. package/dist/{service-wPGgmbUa.mjs → service-CifrxCru.mjs} +2 -2
  306. package/dist/{settings-nr15a8uv.mjs → settings-BYGdocdj.mjs} +2 -2
  307. package/dist/{settings-DORe02PC.mjs → settings-DNRQuX3d.mjs} +3 -3
  308. package/dist/{site-activity-KFZprBZM.mjs → site-activity-6x1JccoR.mjs} +1 -1
  309. package/dist/{site-context-DuBQk6Mp.mjs → site-context-sN12ehZF.mjs} +13 -13
  310. package/dist/storage/local.d.mts +1 -1
  311. package/dist/storage/local.mjs +1 -1
  312. package/dist/storage/s3.d.mts +1 -1
  313. package/dist/storage/s3.mjs +1 -1
  314. package/dist/{taxonomies-DGaw_-aU.mjs → taxonomies-CQFmkP5u.mjs} +3 -3
  315. package/dist/{taxonomies-BVBKoXRf.mjs → taxonomies-faQVeMgj.mjs} +7 -32
  316. package/dist/{taxonomy-BvXRL85P.mjs → taxonomy-BnH-6VsX.mjs} +2 -2
  317. package/dist/{types-DvwHUku7.d.mts → types-B7_vSiPD.d.mts} +16 -0
  318. package/dist/{types-D1DjBFA9.mjs → types-Ck7-WoUD.mjs} +1 -1
  319. package/dist/{types-t7_nCCA9.d.mts → types-DEAQG87T.d.mts} +2 -56
  320. package/dist/{types-C-CMfzSl.d.mts → types-DYKtk8f1.d.mts} +31 -0
  321. package/dist/{types-C3Em8xpG.mjs → types-DbZhHtqS.mjs} +23 -1
  322. package/dist/{types-BIM7jwxr.d.mts → types-UGmU5sWx.d.mts} +1 -1
  323. package/dist/types-nP9vGUFq.d.mts +56 -0
  324. package/dist/ui/server-runtime.d.mts +13 -7
  325. package/dist/ui/server-runtime.mjs +18 -17
  326. package/dist/{user-2aI21yV1.mjs → user-CqZwN21P.mjs} +1 -1
  327. package/dist/{validate-CvQ6cvHH.d.mts → validate-BJuG-ISL.d.mts} +21 -3
  328. package/dist/{validate-JE-WfUQ5.mjs → validate-CK4a1sIF.mjs} +22 -2
  329. package/dist/version-Cg6ur4zS.mjs +6 -0
  330. package/dist/{widgets-Cj6ULpED.mjs → widgets-CdDvF4fV.mjs} +2 -2
  331. package/dist/{wordpress-slugs-hqItqJrQ.mjs → wordpress-slugs-B6Gw9q3Q.mjs} +1 -1
  332. package/dist/{zod-generator-C4BgFBZV.mjs → zod-generator-D1ROBNuC.mjs} +2 -2
  333. package/package.json +7 -8
  334. package/src/components/InlinePortableTextEditor.tsx +66 -0
  335. package/src/components/code-block-languages.ts +76 -0
  336. package/src/components/inline-code-block.tsx +241 -0
  337. package/dist/byline-DpNNSjET.mjs +0 -219
  338. package/dist/bylines-75_STR73.mjs +0 -114
  339. package/dist/chunk-ClPoSABd.mjs +0 -21
  340. package/dist/db-errors-DHJCB_gY.mjs +0 -23
  341. package/dist/index-Ct0pjZwW.d.mts +0 -835
  342. package/dist/placeholder-BZpCpid_.d.mts +0 -40
  343. package/dist/schema-U-SeFWwn.mjs +0 -8
  344. package/dist/version-DTpFm69w.mjs +0 -6
  345. /package/dist/{adapters-kZjS7plb.d.mts → adapters-OQCImOL7.d.mts} +0 -0
  346. /package/dist/{api-tokens-L0o9Bd7v.mjs → api-tokens-CYUoFGo7.mjs} +0 -0
  347. /package/dist/{challenge-store-cJam-E5R.mjs → challenge-store-CRSz-Xim.mjs} +0 -0
  348. /package/dist/{components-BJfa-F6n.mjs → components--pg6zBvu.mjs} +0 -0
  349. /package/dist/{config-XW5tMrH8.mjs → config-CVssduLe.mjs} +0 -0
  350. /package/dist/{context-types-BrSQNye5.mjs → context-types-DQh_XKkn.mjs} +0 -0
  351. /package/dist/{cron-D7FDsRu-.mjs → cron-DxCAU_Sn.mjs} +0 -0
  352. /package/dist/{default-5A3XVR7L.mjs → default-BHauvIdG.mjs} +0 -0
  353. /package/dist/{email-console-Bs1qKx59.mjs → email-console-BOVqIYpB.mjs} +0 -0
  354. /package/dist/{error-DLkgOP5m.mjs → error-DCSuUAZW.mjs} +0 -0
  355. /package/dist/{escape-r8_GbEU2.mjs → escape-BDgouFFY.mjs} +0 -0
  356. /package/dist/{experimental-workflows-BbZbIEZp.mjs → experimental-workflows-Dh4DUoD_.mjs} +0 -0
  357. /package/dist/{hash-DFFrkivP.mjs → hash-BPmX6P8I.mjs} +0 -0
  358. /package/dist/{manifest-schema-C6fzQoWn.mjs → manifest-schema-qh2P7RDX.mjs} +0 -0
  359. /package/dist/{mime-DYP4V5Ks.mjs → mime-8pAB8-77.mjs} +0 -0
  360. /package/dist/{mode-Bd55iLcP.mjs → mode-CpyEz8pe.mjs} +0 -0
  361. /package/dist/{normalize-BY_EJnd9.mjs → normalize-O-hi3a27.mjs} +0 -0
  362. /package/dist/{oauth-state-store-BRSUEkmx.mjs → oauth-state-store-qncPB_IU.mjs} +0 -0
  363. /package/dist/{oauth-user-lookup-DdcI8ZVL.mjs → oauth-user-lookup-BFjWF8wK.mjs} +0 -0
  364. /package/dist/{parser-egIGEco-.mjs → parser-DxfsARXL.mjs} +0 -0
  365. /package/dist/{passkey-config-AX4sjpQ4.mjs → passkey-config-DzHQK90v.mjs} +0 -0
  366. /package/dist/{patterns-CiyXeDgr.mjs → patterns-D9iDO3j8.mjs} +0 -0
  367. /package/dist/{placeholder-b0Ufu0La.mjs → placeholder-BDo81Is5.mjs} +0 -0
  368. /package/dist/{provider-loader-BdRV01gr.mjs → provider-loader-DzUxejk7.mjs} +0 -0
  369. /package/dist/{public-url-BL2r8dmQ.mjs → public-url-DLUM5OOv.mjs} +0 -0
  370. /package/dist/{redirect-Ce_6Yb6z.mjs → redirect-BjIBtDWY.mjs} +0 -0
  371. /package/dist/{secrets-DfeNNoLa.mjs → secrets-CN6FCpcB.mjs} +0 -0
  372. /package/dist/{seo-contributions-C0LXoWw3.mjs → seo-contributions-CqVvReEj.mjs} +0 -0
  373. /package/dist/{setup-complete-C2ztsNhJ.mjs → setup-complete-BytMc6HO.mjs} +0 -0
  374. /package/dist/{setup-nonce-BTKq7uBi.mjs → setup-nonce-pyGfc9hV.mjs} +0 -0
  375. /package/dist/{sidecar-client-lrf7ErYJ.mjs → sidecar-client-mJxwayYN.mjs} +0 -0
  376. /package/dist/{site-url-C18yBhtv.mjs → site-url-C-cu8Ff2.mjs} +0 -0
  377. /package/dist/{ssrf-KAIQS48_.mjs → ssrf-DiKqWd3N.mjs} +0 -0
  378. /package/dist/{tokens-CsP8Se8S.mjs → tokens-CjSgb0AC.mjs} +0 -0
  379. /package/dist/{transport-nNEGdHkI.d.mts → transport-DidKKxvW.d.mts} +0 -0
  380. /package/dist/{transport-B7kO-4ee.mjs → transport-LSdZVXHF.mjs} +0 -0
  381. /package/dist/{trusted-proxy-Bbm6PLR6.mjs → trusted-proxy-BgIIcbsN.mjs} +0 -0
  382. /package/dist/{types-CNNQ8l0v.mjs → types-Cg276-3z.mjs} +0 -0
  383. /package/dist/{types-BYjPylrZ.d.mts → types-DZpT-PnG.d.mts} +0 -0
  384. /package/dist/{types-BgE6gMFI.d.mts → types-Dryvv7LH.d.mts} +0 -0
  385. /package/dist/{types-BBETcziA.d.mts → types-GaCtZ1k9.d.mts} +0 -0
  386. /package/dist/{url-BzhfYtRn.mjs → url-w7Mp5qAD.mjs} +0 -0
  387. /package/dist/{utils-FEbQMgB5.mjs → utils-wv-zvC-Y.mjs} +0 -0
@@ -1,37 +1,40 @@
1
1
  #!/usr/bin/env node
2
- import { t as __exportAll } from "../chunk-ClPoSABd.mjs";
3
- import { n as createDatabase } from "../connection-BCNICDWN.mjs";
4
- import { c as listTablesLike } from "../dialect-helpers-TkdbkFad.mjs";
5
- import { i as runMigrations, n as getMigrationStatus, t as getMigrationFingerprint } from "../runner-DF2DgD_B.mjs";
6
- import { r as isI18nEnabled } from "../config-XW5tMrH8.mjs";
2
+ import { a as __exportAll, i as runMigrations, n as getMigrationStatus, t as getMigrationFingerprint } from "../runner-DTfG5v0G.mjs";
3
+ import { t as createDatabase } from "../connection-CiJWiWya.mjs";
4
+ import { t as validateIdentifier } from "../validate-VPnKoIzW.mjs";
5
+ import { l as listTablesLike } from "../dialect-helpers-fk43GbDb.mjs";
6
+ import { r as isI18nEnabled } from "../config-CVssduLe.mjs";
7
7
  import { n as slugify } from "../slugify-BzGxlOFx.mjs";
8
- import { t as ContentRepository } from "../content-DvpMad_N.mjs";
8
+ import { t as ContentRepository } from "../content-BfyjOiMi.mjs";
9
9
  import { i as encodeBase64url } from "../base64-C1Q9yr0B.mjs";
10
- import "../types-D1DjBFA9.mjs";
11
- import { t as MediaRepository } from "../media-Cg4zc9fq.mjs";
12
- import { t as TaxonomyRepository } from "../taxonomy-BvXRL85P.mjs";
10
+ import "../types-Ck7-WoUD.mjs";
11
+ import { t as MediaRepository } from "../media-DhBwiCYR.mjs";
12
+ import { t as TaxonomyRepository } from "../taxonomy-BnH-6VsX.mjs";
13
13
  import { t as OptionsRepository } from "../options-BF11H_FD.mjs";
14
- import "../redirect-BaVvo2te.mjs";
15
- import "../byline-DpNNSjET.mjs";
16
- import "../request-cache-BpwuE2ix.mjs";
17
- import "../fts-manager-DnfOsF4s.mjs";
18
- import { n as SchemaRegistry } from "../registry-i__XP2WV.mjs";
19
- import "../loader-p2imNN98.mjs";
20
- import "../settings-DORe02PC.mjs";
21
- import { i as pluginManifestSchema } from "../manifest-schema-C6fzQoWn.mjs";
22
- import "../ssrf-KAIQS48_.mjs";
23
- import { t as validateSeed } from "../validate-JE-WfUQ5.mjs";
24
- import { t as applySeed } from "../apply-TIoQ00aH.mjs";
25
- import { n as fingerprintKey, r as generateEncryptionKey, t as DinewaySecretsError } from "../secrets-DfeNNoLa.mjs";
14
+ import "../redirect-BqFMj67n.mjs";
15
+ import "../request-cache-w5cj5itT.mjs";
16
+ import "../byline-registry-CL8BxPPp.mjs";
17
+ import { t as BylineRepository } from "../byline-CXQcMsBu.mjs";
18
+ import "../fts-manager-EHY2Kes9.mjs";
19
+ import { n as SchemaRegistry } from "../registry-Cq3QRBW2.mjs";
20
+ import { a as isMissingTableError } from "../loader-Y0QvC_QO.mjs";
21
+ import "../settings-DNRQuX3d.mjs";
22
+ import { i as pluginManifestSchema } from "../manifest-schema-qh2P7RDX.mjs";
23
+ import "../ssrf-DiKqWd3N.mjs";
24
+ import { t as validateSeed } from "../validate-CK4a1sIF.mjs";
25
+ import { t as applySeed } from "../apply-BpRBCqUt.mjs";
26
+ import { n as fingerprintKey, r as generateEncryptionKey, t as DinewaySecretsError } from "../secrets-CN6FCpcB.mjs";
26
27
  import { createHeaderAwareFetch, customHeadersInterceptor, isRedirectResponse, resolveCustomHeaders } from "../client/external-auth-headers.mjs";
27
- import { o as convertDataForRead } from "../transport-B7kO-4ee.mjs";
28
+ import { o as convertDataForRead } from "../transport-LSdZVXHF.mjs";
28
29
  import { DinewayClient } from "../client/index.mjs";
29
30
  import { LocalStorage } from "../storage/local.mjs";
30
31
  import { createHash } from "node:crypto";
32
+ import { sql } from "kysely";
31
33
  import { imageSize } from "image-size";
32
34
  import { createGzipDecoder, unpackTar } from "modern-tar";
33
35
  import { createReadStream, createWriteStream, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
34
36
  import { basename, dirname, extname, isAbsolute, join, relative, resolve } from "node:path";
37
+ import { pathToFileURL } from "node:url";
35
38
  import { defineCommand, runCommand, runMain } from "citty";
36
39
  import consola, { consola as consola$1 } from "consola";
37
40
  import pc from "picocolors";
@@ -718,6 +721,10 @@ const updateCommand = defineCommand({
718
721
  description: "Revision token from get (prevents overwriting unseen changes)",
719
722
  required: true
720
723
  },
724
+ locale: {
725
+ type: "string",
726
+ description: "Locale for slug resolution"
727
+ },
721
728
  draft: {
722
729
  type: "boolean",
723
730
  description: "Keep as draft instead of auto-publishing"
@@ -731,10 +738,11 @@ const updateCommand = defineCommand({
731
738
  const client = createClientFromArgs(args);
732
739
  const updated = await client.update(args.collection, args.id, {
733
740
  data,
734
- _rev: args.rev
741
+ _rev: args.rev,
742
+ locale: args.locale
735
743
  });
736
- if (!args.draft && updated.draftRevisionId) await client.publish(args.collection, args.id);
737
- output(await client.get(args.collection, args.id), args);
744
+ if (!args.draft && updated.draftRevisionId) await client.publish(args.collection, updated.id);
745
+ output(await client.get(args.collection, updated.id), args);
738
746
  } catch (error) {
739
747
  consola$1.error(error instanceof Error ? error.message : "Unknown error");
740
748
  process.exit(1);
@@ -1631,13 +1639,33 @@ async function writeForgewayDeployMetadata(cwd, metadata) {
1631
1639
  //#endregion
1632
1640
  //#region src/cli/commands/deploy/utils/forgeway-secrets.ts
1633
1641
  const DINEWAY_CONFIG_DIR_NAME = ".dineway";
1634
- const TRAILING_SLASH_PATTERN$1 = /\/$/;
1642
+ const DINEWAY_USER_CONFIG_DIR_NAME = "dineway";
1643
+ const TRAILING_SLASH_PATTERN$2 = /\/$/;
1635
1644
  function getDinewayConfigDir(cwd = process.cwd()) {
1636
1645
  return join(cwd, DINEWAY_CONFIG_DIR_NAME);
1637
1646
  }
1647
+ function getDinewayUserConfigDir() {
1648
+ return join(process.env.XDG_CONFIG_HOME || join(homedir(), ".config"), DINEWAY_USER_CONFIG_DIR_NAME);
1649
+ }
1638
1650
  function getForgewaySecretPath(cwd = process.cwd()) {
1639
1651
  return join(getDinewayConfigDir(cwd), "forgeway.json");
1640
1652
  }
1653
+ function getForgewayAccountSecretPath() {
1654
+ return join(getDinewayUserConfigDir(), "forgeway.json");
1655
+ }
1656
+ function normalizePlatformApiUrl$1(platformApiUrl) {
1657
+ return platformApiUrl.replace(TRAILING_SLASH_PATTERN$2, "");
1658
+ }
1659
+ function normalizeEmail$2(email) {
1660
+ return email.trim().toLowerCase();
1661
+ }
1662
+ function accountKey(platformApiUrl, email) {
1663
+ return `${normalizePlatformApiUrl$1(platformApiUrl)}#${normalizeEmail$2(email)}`;
1664
+ }
1665
+ function normalizeLookup(lookup) {
1666
+ if (typeof lookup === "string") return { cwd: lookup };
1667
+ return lookup ?? {};
1668
+ }
1641
1669
  async function readStore(cwd = process.cwd()) {
1642
1670
  try {
1643
1671
  const raw = await readFile(getForgewaySecretPath(cwd), "utf-8");
@@ -1658,16 +1686,66 @@ async function writeStore(store, cwd = process.cwd()) {
1658
1686
  });
1659
1687
  await chmod(file, 384);
1660
1688
  }
1661
- async function readForgewayCredentials(cwd) {
1662
- return (await readStore(cwd)).credentials ?? null;
1689
+ async function readAccountStore() {
1690
+ try {
1691
+ const raw = await readFile(getForgewayAccountSecretPath(), "utf-8");
1692
+ return JSON.parse(raw);
1693
+ } catch {
1694
+ return { version: 1 };
1695
+ }
1663
1696
  }
1664
- async function writeForgewayCredentials(credentials, cwd) {
1665
- const store = await readStore(cwd);
1666
- store.credentials = credentials;
1667
- await writeStore(store, cwd);
1697
+ async function writeAccountStore(store) {
1698
+ await mkdir(getDinewayUserConfigDir(), {
1699
+ recursive: true,
1700
+ mode: 448
1701
+ });
1702
+ const file = getForgewayAccountSecretPath();
1703
+ await writeFile(file, JSON.stringify({
1704
+ ...store,
1705
+ version: 1
1706
+ }, null, " ") + "\n", {
1707
+ encoding: "utf-8",
1708
+ mode: 384
1709
+ });
1710
+ await chmod(file, 384);
1711
+ }
1712
+ function accountMatches(credentials, lookup) {
1713
+ if (lookup.platformApiUrl && normalizePlatformApiUrl$1(credentials.platformApiUrl) !== normalizePlatformApiUrl$1(lookup.platformApiUrl)) return false;
1714
+ if (lookup.email && normalizeEmail$2(credentials.user?.email ?? "") !== normalizeEmail$2(lookup.email)) return false;
1715
+ return true;
1716
+ }
1717
+ async function readForgewayCredentials(lookup) {
1718
+ const normalizedLookup = normalizeLookup(lookup);
1719
+ const store = await readAccountStore();
1720
+ const accounts = Object.values(store.accounts ?? {}).filter((credentials) => accountMatches(credentials, normalizedLookup));
1721
+ if (normalizedLookup.platformApiUrl && normalizedLookup.email) return store.accounts?.[accountKey(normalizedLookup.platformApiUrl, normalizedLookup.email)] ?? null;
1722
+ if (accounts.length === 1) return accounts[0] ?? null;
1723
+ return null;
1724
+ }
1725
+ async function writeForgewayCredentials(credentials, lookup) {
1726
+ const normalizedLookup = normalizeLookup(lookup);
1727
+ const platformApiUrl = normalizePlatformApiUrl$1(normalizedLookup.platformApiUrl ?? credentials.platformApiUrl);
1728
+ const email = normalizeEmail$2(normalizedLookup.email ?? credentials.user?.email ?? "");
1729
+ if (!email) throw new Error("Forgeway credentials require a user email before they can be stored.");
1730
+ const key = accountKey(platformApiUrl, email);
1731
+ const store = await readAccountStore();
1732
+ store.accounts = {
1733
+ ...store.accounts,
1734
+ [key]: {
1735
+ ...credentials,
1736
+ platformApiUrl
1737
+ }
1738
+ };
1739
+ store.lastAccountKey = key;
1740
+ await writeAccountStore(store);
1741
+ }
1742
+ async function listForgewayCredentials(platformApiUrl) {
1743
+ const lookup = platformApiUrl ? { platformApiUrl } : {};
1744
+ const store = await readAccountStore();
1745
+ return Object.values(store.accounts ?? {}).filter((credentials) => accountMatches(credentials, lookup));
1668
1746
  }
1669
1747
  function shadowGrantKey(platformApiUrl, placeId) {
1670
- return `${platformApiUrl.replace(TRAILING_SLASH_PATTERN$1, "")}#${placeId ?? "__unbound__"}`;
1748
+ return `${platformApiUrl.replace(TRAILING_SLASH_PATTERN$2, "")}#${placeId ?? "__unbound__"}`;
1671
1749
  }
1672
1750
  async function readForgewayShadowGrant(platformApiUrl, placeId, cwd) {
1673
1751
  const store = await readStore(cwd);
@@ -1690,7 +1768,7 @@ async function writeForgewayShadowGrant(grant, cwd) {
1690
1768
 
1691
1769
  //#endregion
1692
1770
  //#region src/cli/commands/deploy/targets/forgeway.ts
1693
- const DEFAULT_DINEWAY_API_BASE_URL = "https://api.dineway.ai";
1771
+ const DEFAULT_DINEWAY_API_BASE_URL$1 = "https://api.dineway.ai";
1694
1772
  const DATABASE_ENV_VAR_NAMES = ["DINEWAY_DATABASE_URL", "DINEWAY_DATABASE_AUTH_TOKEN"];
1695
1773
  const POLL_INTERVAL_MS$1 = 5e3;
1696
1774
  const POLL_TIMEOUT_MS$1 = 3e5;
@@ -1705,9 +1783,9 @@ const NON_COMPARE_PATTERN = /[^\p{Letter}\p{Number}]+/gu;
1705
1783
  const LOCATION_PARTS_PATTERN = /[,;|/]+|\s+-\s+/u;
1706
1784
  const JWT_PATTERN = /[A-Za-z0-9_-]{32,}\.[A-Za-z0-9_-]{16,}\.[A-Za-z0-9_-]{16,}/g;
1707
1785
  const TOKEN_ASSIGNMENT_PATTERN = /(DINEWAY_DATABASE_AUTH_TOKEN|DATABASE_AUTH_TOKEN|AUTH_TOKEN)=\S+/gi;
1708
- const TRAILING_SLASH_PATTERN = /\/$/;
1786
+ const TRAILING_SLASH_PATTERN$1 = /\/$/;
1709
1787
  const BACKSLASH_PATTERN = /\\/g;
1710
- const SHADOW_EMAIL_PATTERN = /^shadow_[a-f0-9]{16}@dineway\.ai$/i;
1788
+ const SHADOW_EMAIL_PATTERN$1 = /^shadow_[a-f0-9]{16}@dineway\.ai$/i;
1711
1789
  const OTP_PATTERN = /^\d{6}$/;
1712
1790
  const FOOD_TYPES = new Set([
1713
1791
  "restaurant",
@@ -1756,7 +1834,7 @@ var ForgewayApiError = class extends Error {
1756
1834
  this.name = "ForgewayApiError";
1757
1835
  }
1758
1836
  };
1759
- function normalizeForgewayUser(user) {
1837
+ function normalizeForgewayUser$1(user) {
1760
1838
  return {
1761
1839
  id: user.id,
1762
1840
  name: user.profile?.name ?? user.name ?? user.email,
@@ -1777,7 +1855,7 @@ async function fileExists$8(path) {
1777
1855
  }
1778
1856
  }
1779
1857
  function normalizePlatformApiUrl(value) {
1780
- return (value || DEFAULT_DINEWAY_API_BASE_URL).replace(TRAILING_SLASH_PATTERN, "");
1858
+ return (value || DEFAULT_DINEWAY_API_BASE_URL$1).replace(TRAILING_SLASH_PATTERN$1, "");
1781
1859
  }
1782
1860
  function resolvePlatformApiUrl(savedPlatformApiUrl) {
1783
1861
  return normalizePlatformApiUrl(getEnv("DINEWAY_API_BASE_URL") ?? (typeof savedPlatformApiUrl === "string" ? savedPlatformApiUrl : void 0));
@@ -1840,7 +1918,7 @@ async function parseErrorResponse(response) {
1840
1918
  }
1841
1919
  return `Forgeway request failed: ${response.status}`;
1842
1920
  }
1843
- function normalizeEmail(email) {
1921
+ function normalizeEmail$1(email) {
1844
1922
  return email.trim().toLowerCase();
1845
1923
  }
1846
1924
  function normalizeOtp(otp) {
@@ -1848,8 +1926,8 @@ function normalizeOtp(otp) {
1848
1926
  if (!OTP_PATTERN.test(value)) throw new Error("Forgeway email verification OTP must be a 6-digit numeric code.");
1849
1927
  return value;
1850
1928
  }
1851
- function isShadowEmail(email) {
1852
- return Boolean(email && SHADOW_EMAIL_PATTERN.test(email));
1929
+ function isShadowEmail$1(email) {
1930
+ return Boolean(email && SHADOW_EMAIL_PATTERN$1.test(email));
1853
1931
  }
1854
1932
  async function refreshFormalAccessToken(context, deps) {
1855
1933
  if (!context.refreshToken) throw new Error("Forgeway formal account refresh token is missing. Run dineway deploy again.");
@@ -1861,19 +1939,22 @@ async function refreshFormalAccessToken(context, deps) {
1861
1939
  if (!response.ok) throw new Error("Failed to refresh Forgeway formal account credentials. Run dineway deploy again.");
1862
1940
  const payload = await response.json();
1863
1941
  if (!payload.accessToken) throw new Error("Forgeway refresh response was missing accessToken.");
1864
- const user = assertVerifiedFormalAccountUser(payload.user ? normalizeForgewayUser(payload.user) : context.user, context.user?.email);
1942
+ const user = assertVerifiedFormalAccountUser(payload.user ? normalizeForgewayUser$1(payload.user) : context.user, context.user?.email);
1865
1943
  const updated = {
1866
1944
  platformApiUrl: context.platformApiUrl,
1867
1945
  accessToken: payload.accessToken,
1868
1946
  refreshToken: payload.refreshToken ?? context.refreshToken,
1869
1947
  ...user ? { user } : {},
1870
- source: "shadow-email-upgrade",
1871
- ...context.placeId ? { placeId: context.placeId } : {}
1948
+ source: "shadow-email-upgrade"
1872
1949
  };
1873
1950
  context.accessToken = updated.accessToken;
1874
1951
  context.refreshToken = updated.refreshToken;
1875
1952
  context.user = updated.user;
1876
- await (deps.writeCredentials ?? writeForgewayCredentials)(updated, context.projectDir);
1953
+ await (deps.writeCredentials ?? writeForgewayCredentials)(updated, {
1954
+ cwd: context.projectDir,
1955
+ platformApiUrl: context.platformApiUrl,
1956
+ email: user.email
1957
+ });
1877
1958
  return payload.accessToken;
1878
1959
  }
1879
1960
  async function refreshShadowAccessToken(context, deps) {
@@ -1895,7 +1976,7 @@ async function refreshShadowAccessToken(context, deps) {
1895
1976
  refreshToken: payload.refreshToken,
1896
1977
  restaurantName: context.restaurantName,
1897
1978
  city: context.city,
1898
- user: payload.user ? normalizeForgewayUser(payload.user) : void 0,
1979
+ user: payload.user ? normalizeForgewayUser$1(payload.user) : void 0,
1899
1980
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
1900
1981
  }, context.projectDir);
1901
1982
  return payload.accessToken;
@@ -1922,25 +2003,33 @@ async function promptRequired(question, initialValue, deps, errorMessage) {
1922
2003
  async function readSavedForgewayMetadata(cwd) {
1923
2004
  return await readForgewayDeployMetadata(cwd).catch(() => ({}));
1924
2005
  }
1925
- async function resolveForgewayAccountEmail(options, grant, cwd, deps) {
1926
- const stored = await (deps.readCredentials ?? readForgewayCredentials)(cwd);
1927
- const storedEmail = stored?.source === "shadow-email-upgrade" && stored.placeId === grant.placeId && stored.user?.emailVerified === true && !isShadowEmail(stored.user?.email) ? stored.user?.email : void 0;
1928
- const suppliedEmail = options.email ?? getEnv("DINEWAY_EMAIL") ?? getEnv("FORGEWAY_EMAIL");
1929
- if ((options.sendOtp || options.otp) && !suppliedEmail) throw new Error("Forgeway OTP deploy requires --email or DINEWAY_EMAIL.");
1930
- const email = normalizeEmail(suppliedEmail ?? storedEmail ?? await promptRequired("Dineway account email: ", void 0, deps, "Dineway account email is required. Pass --email or set DINEWAY_EMAIL."));
1931
- if (!email || isShadowEmail(email)) throw new Error("Dineway account email must be a real owner email, not a shadow user email.");
2006
+ function explicitPublisherEmail(options) {
2007
+ return options.email ?? getEnv("DINEWAY_EMAIL") ?? getEnv("FORGEWAY_EMAIL");
2008
+ }
2009
+ function savedPublisherEmail(saved) {
2010
+ return typeof saved.publisherEmail === "string" && saved.publisherEmail.trim() ? saved.publisherEmail : void 0;
2011
+ }
2012
+ function validatePublisherEmail(rawEmail) {
2013
+ const email = normalizeEmail$1(rawEmail);
2014
+ if (!email || isShadowEmail$1(email)) throw new Error("Dineway account email must be a real owner email, not a shadow user email.");
1932
2015
  return email;
1933
2016
  }
1934
- function isStoredFormalCredentialForGrant(stored, grant, email) {
1935
- if (!stored?.accessToken || stored.source !== "shadow-email-upgrade" || stored.placeId !== grant.placeId || !stored.user) return false;
1936
- if (normalizeEmail(stored.user.email) !== email) return false;
2017
+ async function resolveForgewayAccountEmail(options, saved, deps, preferredEmail) {
2018
+ const suppliedEmail = options.email ?? getEnv("DINEWAY_EMAIL") ?? getEnv("FORGEWAY_EMAIL");
2019
+ const savedEmail = savedPublisherEmail(saved);
2020
+ if ((options.sendOtp || options.otp) && !suppliedEmail && !preferredEmail && !savedEmail) throw new Error("Forgeway OTP deploy requires --email or DINEWAY_EMAIL.");
2021
+ return validatePublisherEmail(suppliedEmail ?? preferredEmail ?? savedEmail ?? await promptRequired("Dineway account email: ", void 0, deps, "Dineway account email is required. Pass --email or set DINEWAY_EMAIL."));
2022
+ }
2023
+ function isStoredFormalCredentialForEmail(stored, email) {
2024
+ if (!stored?.accessToken || !stored.user) return false;
2025
+ if (email && normalizeEmail$1(stored.user.email) !== email) return false;
1937
2026
  if (stored.user.emailVerified !== true) return false;
1938
- if (isShadowEmail(stored.user.email)) return false;
2027
+ if (isShadowEmail$1(stored.user.email)) return false;
1939
2028
  return true;
1940
2029
  }
1941
2030
  function assertVerifiedFormalAccountUser(user, expectedEmail) {
1942
- if (!user || user.emailVerified !== true || isShadowEmail(user.email)) throw new Error("Forgeway formal account credentials require a verified formal account.");
1943
- if (expectedEmail && normalizeEmail(user.email) !== normalizeEmail(expectedEmail)) throw new Error("Forgeway refresh returned credentials for a different email.");
2031
+ if (!user || user.emailVerified !== true || isShadowEmail$1(user.email)) throw new Error("Forgeway formal account credentials require a verified formal account.");
2032
+ if (expectedEmail && normalizeEmail$1(user.email) !== normalizeEmail$1(expectedEmail)) throw new Error("Forgeway refresh returned credentials for a different email.");
1944
2033
  return user;
1945
2034
  }
1946
2035
  async function shadowUpgradeFetch(context, path, deps, options) {
@@ -1963,7 +2052,7 @@ async function startShadowEmailUpgrade(context, email, deps) {
1963
2052
  method: "POST",
1964
2053
  body: JSON.stringify({ email })
1965
2054
  });
1966
- if (payload.email && normalizeEmail(payload.email) !== email) throw new Error("Forgeway email verification response returned a different email.");
2055
+ if (payload.email && normalizeEmail$1(payload.email) !== email) throw new Error("Forgeway email verification response returned a different email.");
1967
2056
  return payload;
1968
2057
  }
1969
2058
  async function verifyShadowEmailUpgrade(context, email, otp, deps) {
@@ -1975,21 +2064,24 @@ async function verifyShadowEmailUpgrade(context, email, otp, deps) {
1975
2064
  })
1976
2065
  });
1977
2066
  if (!payload.accessToken || !payload.refreshToken || !payload.user) throw new Error("Forgeway email upgrade response was missing credentials.");
1978
- const user = normalizeForgewayUser(payload.user);
1979
- if (normalizeEmail(user.email) !== email) throw new Error("Forgeway email upgrade returned credentials for a different email.");
1980
- if (user.emailVerified !== true || isShadowEmail(user.email)) throw new Error("Forgeway email upgrade did not return a verified formal account.");
2067
+ const user = normalizeForgewayUser$1(payload.user);
2068
+ if (normalizeEmail$1(user.email) !== email) throw new Error("Forgeway email upgrade returned credentials for a different email.");
2069
+ if (user.emailVerified !== true || isShadowEmail$1(user.email)) throw new Error("Forgeway email upgrade did not return a verified formal account.");
1981
2070
  return {
1982
2071
  platformApiUrl: context.platformApiUrl,
1983
2072
  accessToken: payload.accessToken,
1984
2073
  refreshToken: payload.refreshToken,
1985
2074
  user,
1986
- source: "shadow-email-upgrade",
1987
- ...context.placeId ? { placeId: context.placeId } : {}
2075
+ source: "shadow-email-upgrade"
1988
2076
  };
1989
2077
  }
1990
- async function resolveFormalAccountCredentials(context, grant, email, options, deps) {
1991
- const stored = await (deps.readCredentials ?? readForgewayCredentials)(context.projectDir);
1992
- if (!options.sendOtp && !options.otp && isStoredFormalCredentialForGrant(stored, grant, email)) return {
2078
+ async function resolveFormalAccountCredentials(context, email, options, deps) {
2079
+ const stored = await (deps.readCredentials ?? readForgewayCredentials)({
2080
+ cwd: context.projectDir,
2081
+ platformApiUrl: context.platformApiUrl,
2082
+ email
2083
+ });
2084
+ if (!options.sendOtp && !options.otp && isStoredFormalCredentialForEmail(stored, email)) return {
1993
2085
  status: "verified",
1994
2086
  credentials: {
1995
2087
  ...stored,
@@ -2000,13 +2092,17 @@ async function resolveFormalAccountCredentials(context, grant, email, options, d
2000
2092
  const response = await startShadowEmailUpgrade(context, email, deps);
2001
2093
  return {
2002
2094
  status: "otp-sent",
2003
- email: response.email ? normalizeEmail(response.email) : email,
2095
+ email: response.email ? normalizeEmail$1(response.email) : email,
2004
2096
  expiresAt: response.expiresAt
2005
2097
  };
2006
2098
  }
2007
2099
  if (options.otp) {
2008
2100
  const credentials = await verifyShadowEmailUpgrade(context, email, normalizeOtp(options.otp), deps);
2009
- await (deps.writeCredentials ?? writeForgewayCredentials)(credentials, context.projectDir);
2101
+ await (deps.writeCredentials ?? writeForgewayCredentials)(credentials, {
2102
+ cwd: context.projectDir,
2103
+ platformApiUrl: context.platformApiUrl,
2104
+ email
2105
+ });
2010
2106
  return {
2011
2107
  status: "verified",
2012
2108
  credentials
@@ -2015,13 +2111,111 @@ async function resolveFormalAccountCredentials(context, grant, email, options, d
2015
2111
  await startShadowEmailUpgrade(context, email, deps);
2016
2112
  consola.info(`Sent Forgeway email verification code to ${email}`);
2017
2113
  const credentials = await verifyShadowEmailUpgrade(context, email, await promptRequired("Email verification code: ", void 0, deps, "Email verification code is required."), deps);
2018
- await (deps.writeCredentials ?? writeForgewayCredentials)(credentials, context.projectDir);
2114
+ await (deps.writeCredentials ?? writeForgewayCredentials)(credentials, {
2115
+ cwd: context.projectDir,
2116
+ platformApiUrl: context.platformApiUrl,
2117
+ email
2118
+ });
2019
2119
  return {
2020
2120
  status: "verified",
2021
2121
  credentials
2022
2122
  };
2023
2123
  }
2024
- async function resolveShadowProjectContext(cwd, options, deps) {
2124
+ async function readCachedPublisherCredentials(cwd, platformApiUrl, email, deps) {
2125
+ const credentials = await (deps.readCredentials ?? readForgewayCredentials)({
2126
+ cwd,
2127
+ platformApiUrl,
2128
+ email
2129
+ });
2130
+ return isStoredFormalCredentialForEmail(credentials, email) ? credentials : void 0;
2131
+ }
2132
+ async function resolveCachedPublisherAccount(cwd, options, saved, platformApiUrl, deps) {
2133
+ const suppliedEmail = explicitPublisherEmail(options);
2134
+ if (suppliedEmail) {
2135
+ const email = validatePublisherEmail(suppliedEmail);
2136
+ return {
2137
+ email,
2138
+ credentials: await readCachedPublisherCredentials(cwd, platformApiUrl, email, deps)
2139
+ };
2140
+ }
2141
+ const projectEmail = savedPublisherEmail(saved);
2142
+ if (projectEmail) {
2143
+ const email = validatePublisherEmail(projectEmail);
2144
+ return {
2145
+ email,
2146
+ credentials: await readCachedPublisherCredentials(cwd, platformApiUrl, email, deps)
2147
+ };
2148
+ }
2149
+ const singleCredentials = await (deps.readCredentials ?? readForgewayCredentials)({
2150
+ cwd,
2151
+ platformApiUrl
2152
+ });
2153
+ if (isStoredFormalCredentialForEmail(singleCredentials)) return {
2154
+ email: normalizeEmail$1(singleCredentials.user.email),
2155
+ credentials: singleCredentials
2156
+ };
2157
+ const accounts = (await (deps.listCredentials ?? listForgewayCredentials)(platformApiUrl)).filter((credentials) => isStoredFormalCredentialForEmail(credentials));
2158
+ if (accounts.length === 1) {
2159
+ const credentials = accounts[0];
2160
+ return {
2161
+ email: normalizeEmail$1(credentials.user.email),
2162
+ credentials
2163
+ };
2164
+ }
2165
+ if (accounts.length > 1) {
2166
+ const email = validatePublisherEmail(await promptRequired("Dineway account email: ", void 0, deps, "Multiple Dineway accounts are stored on this computer. Pass --email or set DINEWAY_EMAIL."));
2167
+ return {
2168
+ email,
2169
+ credentials: await readCachedPublisherCredentials(cwd, platformApiUrl, email, deps)
2170
+ };
2171
+ }
2172
+ return {};
2173
+ }
2174
+ async function resolveFormalProjectContext(cwd, options, deps) {
2175
+ const saved = await readSavedForgewayMetadata(cwd);
2176
+ const platformApiUrl = resolvePlatformApiUrl(saved.platformApiUrl);
2177
+ const account = await resolveCachedPublisherAccount(cwd, options, saved, platformApiUrl, deps);
2178
+ if (!account.credentials) return {
2179
+ status: "missing",
2180
+ email: account.email
2181
+ };
2182
+ const user = assertVerifiedFormalAccountUser(account.credentials.user, account.email);
2183
+ const savedPlaceId = options.placeId ?? getEnv("DINEWAY_PLACE_ID") ?? (typeof saved.placeId === "string" ? saved.placeId : void 0);
2184
+ if (savedPlaceId && !PLACE_ID_PATTERN.test(savedPlaceId)) throw new Error("Could not resolve a valid Dineway place id for Forgeway deploy.");
2185
+ const context = {
2186
+ projectDir: cwd,
2187
+ platformApiUrl,
2188
+ authKind: "formal-account",
2189
+ accessToken: account.credentials.accessToken,
2190
+ refreshToken: account.credentials.refreshToken,
2191
+ user,
2192
+ ossHost: platformApiUrl,
2193
+ placeId: savedPlaceId,
2194
+ restaurantName: options.restaurantName,
2195
+ city: options.city
2196
+ };
2197
+ let restaurant = {
2198
+ name: options.restaurantName,
2199
+ city: options.city
2200
+ };
2201
+ if (!context.placeId) {
2202
+ const resolvedRestaurant = await resolveShadowRestaurantInfo(options, deps);
2203
+ restaurant = resolvedRestaurant;
2204
+ context.placeId = await resolvePlaceIdWithFormalSearch({
2205
+ context,
2206
+ restaurant: resolvedRestaurant,
2207
+ deps
2208
+ });
2209
+ context.restaurantName = resolvedRestaurant.name;
2210
+ context.city = resolvedRestaurant.city;
2211
+ }
2212
+ return {
2213
+ status: "ready",
2214
+ context,
2215
+ restaurant
2216
+ };
2217
+ }
2218
+ async function resolveShadowProjectContext(cwd, options, deps, preferredEmail) {
2025
2219
  const saved = await readSavedForgewayMetadata(cwd);
2026
2220
  const platformApiUrl = resolvePlatformApiUrl(saved.platformApiUrl);
2027
2221
  const savedPlaceId = options.placeId ?? getEnv("DINEWAY_PLACE_ID") ?? (typeof saved.placeId === "string" ? saved.placeId : void 0);
@@ -2077,8 +2271,7 @@ async function resolveShadowProjectContext(cwd, options, deps) {
2077
2271
  restaurantName: restaurant.name,
2078
2272
  city: restaurant.city
2079
2273
  };
2080
- const accountEmail = await resolveForgewayAccountEmail(options, grant, cwd, deps);
2081
- const credentialsResult = await resolveFormalAccountCredentials(shadowContext, grant, accountEmail, options, deps);
2274
+ const credentialsResult = await resolveFormalAccountCredentials(shadowContext, await resolveForgewayAccountEmail(options, saved, deps, preferredEmail), options, deps);
2082
2275
  if (credentialsResult.status === "otp-sent") return credentialsResult;
2083
2276
  const { credentials } = credentialsResult;
2084
2277
  return {
@@ -2095,7 +2288,13 @@ async function resolveShadowProjectContext(cwd, options, deps) {
2095
2288
  };
2096
2289
  }
2097
2290
  async function resolveProjectContext(cwd, options, deps) {
2098
- return await resolveShadowProjectContext(cwd, options, deps);
2291
+ let preferredEmail;
2292
+ if (!options.sendOtp && !options.otp) {
2293
+ const formal = await resolveFormalProjectContext(cwd, options, deps);
2294
+ if (formal.status !== "missing") return formal;
2295
+ preferredEmail = formal.email;
2296
+ }
2297
+ return await resolveShadowProjectContext(cwd, options, deps, preferredEmail);
2099
2298
  }
2100
2299
  async function createShadowUser(platformApiUrl, placeId, deps) {
2101
2300
  const response = await forgewayRequest(`${platformApiUrl}/api/auth/users/shadow`, {
@@ -2344,7 +2543,7 @@ async function bindShadowGrantPlace(options) {
2344
2543
  refreshToken: payload.refreshToken ?? context.refreshToken ?? options.grant.refreshToken,
2345
2544
  restaurantName: options.restaurant.name,
2346
2545
  city: options.restaurant.city,
2347
- user: payload.user ? normalizeForgewayUser(payload.user) : context.user ?? options.grant.user
2546
+ user: payload.user ? normalizeForgewayUser$1(payload.user) : context.user ?? options.grant.user
2348
2547
  });
2349
2548
  await (options.deps.writeShadowGrant ?? writeForgewayShadowGrant)(grant, options.cwd);
2350
2549
  return grant;
@@ -2364,6 +2563,20 @@ async function resolvePlaceIdWithShadowSearch(options) {
2364
2563
  placeId: finalPlaceId
2365
2564
  });
2366
2565
  }
2566
+ async function resolvePlaceIdWithFormalSearch(options) {
2567
+ const candidates = extractPlaceCandidates(await ossFetch(options.context, "/api/places/search", options.deps, {
2568
+ method: "POST",
2569
+ body: JSON.stringify({ textQuery: `${options.restaurant.name} in ${options.restaurant.city}` })
2570
+ }));
2571
+ if (candidates.length === 0) throw new Error(`Dineway place search returned no candidates for "${options.restaurant.name} in ${options.restaurant.city}".`);
2572
+ const selected = selectPlaceCandidate(candidates, {
2573
+ name: options.restaurant.name,
2574
+ city: options.restaurant.city
2575
+ });
2576
+ const finalPlaceId = selected ? candidatePlaceId(selected.candidate) : "";
2577
+ if (!PLACE_ID_PATTERN.test(finalPlaceId)) throw new Error("Could not resolve a valid Dineway place id for Forgeway deploy.");
2578
+ return finalPlaceId;
2579
+ }
2367
2580
  async function createShadowGrant(options) {
2368
2581
  if (options.placeId && !PLACE_ID_PATTERN.test(options.placeId)) throw new Error("Could not resolve a valid Dineway place id for Forgeway deploy.");
2369
2582
  const auth = await createShadowUser(options.platformApiUrl, options.placeId, options.deps);
@@ -2374,14 +2587,14 @@ async function createShadowGrant(options) {
2374
2587
  refreshToken: auth.refreshToken,
2375
2588
  restaurantName: options.restaurantName,
2376
2589
  city: options.city,
2377
- user: auth.user ? normalizeForgewayUser(auth.user) : void 0,
2590
+ user: auth.user ? normalizeForgewayUser$1(auth.user) : void 0,
2378
2591
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
2379
2592
  };
2380
2593
  await (options.deps.writeShadowGrant ?? writeForgewayShadowGrant)(grant, options.cwd);
2381
2594
  return grant;
2382
2595
  }
2383
2596
  async function ossFetch(context, path, deps, options = {}) {
2384
- const request = async (token) => await forgewayRequest(`${context.ossHost.replace(TRAILING_SLASH_PATTERN, "")}${path}`, {
2597
+ const request = async (token) => await forgewayRequest(`${context.ossHost.replace(TRAILING_SLASH_PATTERN$1, "")}${path}`, {
2385
2598
  ...options,
2386
2599
  headers: {
2387
2600
  "Content-Type": "application/json",
@@ -2905,6 +3118,7 @@ async function deployForgeway(cwd, options, deps = {}) {
2905
3118
  deps,
2906
3119
  verbose
2907
3120
  });
3121
+ if (context.user?.email) await writeForgewayDeployMetadata(cwd, { publisherEmail: normalizeEmail$1(context.user.email) });
2908
3122
  const url = deployment.liveUrl ?? `https://${site.domain}`;
2909
3123
  await (deps.writeProjectEnv ?? persistForgewayCliEnv)(cwd, {
2910
3124
  siteUrl: url,
@@ -3961,15 +4175,77 @@ async function exportSeed(db, withContent) {
3961
4175
  };
3962
4176
  seed.settings = await exportSettings(db);
3963
4177
  seed.collections = await exportCollections(db);
3964
- seed.taxonomies = await exportTaxonomies(db);
3965
- seed.menus = await exportMenus(db);
4178
+ const i18nEnabled = await detectI18nEnabled(db, seed.collections);
4179
+ seed.taxonomies = await exportTaxonomies(db, i18nEnabled);
4180
+ seed.menus = await exportMenus(db, i18nEnabled);
3966
4181
  seed.widgetAreas = await exportWidgetAreas(db);
4182
+ const { bylines, idToSeedId: bylineIdToSeedId } = await exportBylines(db);
4183
+ if (bylines.length > 0) seed.bylines = bylines;
3967
4184
  if (withContent !== void 0) {
3968
4185
  const collections = withContent === "" || withContent === "true" ? null : withContent.split(",").map((s) => s.trim()).filter(Boolean);
3969
- seed.content = await exportContent(db, seed.collections || [], collections);
4186
+ seed.content = await exportContent(db, seed.collections || [], collections, bylineIdToSeedId, i18nEnabled);
3970
4187
  }
3971
4188
  return seed;
3972
4189
  }
4190
+ async function exportBylines(db) {
4191
+ const bylineRepo = new BylineRepository(db);
4192
+ const bylines = [];
4193
+ const idToSeedId = /* @__PURE__ */ new Map();
4194
+ let cursor;
4195
+ do {
4196
+ const result = await bylineRepo.findMany({
4197
+ limit: 100,
4198
+ cursor
4199
+ });
4200
+ for (const byline of result.items) {
4201
+ const seedId = `byline:${byline.slug}`;
4202
+ idToSeedId.set(byline.id, seedId);
4203
+ bylines.push({
4204
+ id: seedId,
4205
+ slug: byline.slug,
4206
+ displayName: byline.displayName,
4207
+ bio: byline.bio || void 0,
4208
+ websiteUrl: byline.websiteUrl || void 0,
4209
+ isGuest: byline.isGuest || void 0
4210
+ });
4211
+ }
4212
+ cursor = result.nextCursor;
4213
+ } while (cursor);
4214
+ return {
4215
+ bylines,
4216
+ idToSeedId
4217
+ };
4218
+ }
4219
+ /**
4220
+ * Determine whether export should preserve locale-suffixed seed ids.
4221
+ *
4222
+ * Runtime i18n config is initialized by middleware, but `dineway export-seed`
4223
+ * runs in a CLI process. When the runtime flag is unset, derive multi-locale
4224
+ * status from stored rows instead: a project is multi-locale when any
4225
+ * i18n-aware table contains more than one distinct locale.
4226
+ */
4227
+ async function detectI18nEnabled(db, collections) {
4228
+ if (isI18nEnabled()) return true;
4229
+ const locales = /* @__PURE__ */ new Set();
4230
+ const collectDistinctLocales = async (tableRef) => {
4231
+ const result = await sql`
4232
+ SELECT DISTINCT locale FROM ${tableRef}
4233
+ `.execute(db);
4234
+ for (const row of result.rows) if (row.locale) locales.add(row.locale);
4235
+ return locales.size > 1;
4236
+ };
4237
+ if (await collectDistinctLocales(sql.ref("_dineway_taxonomy_defs"))) return true;
4238
+ if (await collectDistinctLocales(sql.ref("_dineway_menus"))) return true;
4239
+ for (const collection of collections) {
4240
+ validateIdentifier(collection.slug, "collection slug");
4241
+ try {
4242
+ if (await collectDistinctLocales(sql.ref(`ec_${collection.slug}`))) return true;
4243
+ } catch (error) {
4244
+ if (!isMissingTableError(error)) throw error;
4245
+ }
4246
+ }
4247
+ return false;
4248
+ }
3973
4249
  /**
3974
4250
  * Export site settings
3975
4251
  */
@@ -4019,8 +4295,7 @@ async function exportCollections(db) {
4019
4295
  /**
4020
4296
  * Export taxonomy definitions and terms
4021
4297
  */
4022
- async function exportTaxonomies(db) {
4023
- const i18nEnabled = isI18nEnabled();
4298
+ async function exportTaxonomies(db, i18nEnabled) {
4024
4299
  const defs = await db.selectFrom("_dineway_taxonomy_defs").selectAll().orderBy(["name", "locale"]).execute();
4025
4300
  const result = [];
4026
4301
  const termRepo = new TaxonomyRepository(db);
@@ -4077,8 +4352,7 @@ async function exportTaxonomies(db) {
4077
4352
  /**
4078
4353
  * Export menus with their items
4079
4354
  */
4080
- async function exportMenus(db) {
4081
- const i18nEnabled = isI18nEnabled();
4355
+ async function exportMenus(db, i18nEnabled) {
4082
4356
  const menus = await db.selectFrom("_dineway_menus").selectAll().orderBy(["name", "locale"]).execute();
4083
4357
  const result = [];
4084
4358
  const groupToSeedId = /* @__PURE__ */ new Map();
@@ -4200,11 +4474,12 @@ async function exportWidgetAreas(db) {
4200
4474
  /**
4201
4475
  * Export content from collections
4202
4476
  */
4203
- async function exportContent(db, collections, includeCollections) {
4477
+ async function exportContent(db, collections, includeCollections, bylineIdToSeedId, i18nEnabled) {
4204
4478
  const content = {};
4205
4479
  const contentRepo = new ContentRepository(db);
4206
4480
  const taxonomyRepo = new TaxonomyRepository(db);
4207
4481
  const mediaRepo = new MediaRepository(db);
4482
+ const bylineRepo = new BylineRepository(db);
4208
4483
  const mediaMap = /* @__PURE__ */ new Map();
4209
4484
  try {
4210
4485
  let cursor;
@@ -4223,7 +4498,6 @@ async function exportContent(db, collections, includeCollections) {
4223
4498
  cursor = result.nextCursor;
4224
4499
  } while (cursor);
4225
4500
  } catch {}
4226
- const i18nEnabled = isI18nEnabled();
4227
4501
  for (const collection of collections) {
4228
4502
  if (includeCollections && !includeCollections.includes(collection.slug)) continue;
4229
4503
  const entries = [];
@@ -4253,6 +4527,8 @@ async function exportContent(db, collections, includeCollections) {
4253
4527
  }
4254
4528
  const taxonomies = await getTaxonomyAssignments(taxonomyRepo, collection.slug, item.id);
4255
4529
  if (Object.keys(taxonomies).length > 0) entry.taxonomies = taxonomies;
4530
+ const bylines = await getBylineCredits(bylineRepo, collection.slug, item.id, bylineIdToSeedId);
4531
+ if (bylines.length > 0) entry.bylines = bylines;
4256
4532
  entries.push(entry);
4257
4533
  }
4258
4534
  cursor = result.nextCursor;
@@ -4299,6 +4575,15 @@ function processDataForExport(data, fields, mediaMap) {
4299
4575
  }
4300
4576
  return result;
4301
4577
  }
4578
+ async function getBylineCredits(bylineRepo, collection, entryId, bylineIdToSeedId) {
4579
+ return (await bylineRepo.getContentBylines(collection, entryId)).flatMap((credit) => {
4580
+ const seedId = bylineIdToSeedId.get(credit.byline.id);
4581
+ if (!seedId) return [];
4582
+ const seedCredit = { byline: seedId };
4583
+ if (credit.roleLabel) seedCredit.roleLabel = credit.roleLabel;
4584
+ return [seedCredit];
4585
+ });
4586
+ }
4302
4587
  /**
4303
4588
  * Get taxonomy term assignments for a content entry
4304
4589
  */
@@ -4977,6 +5262,9 @@ const MAX_SCREENSHOTS = 5;
4977
5262
  const MAX_SCREENSHOT_WIDTH = 1920;
4978
5263
  const MAX_SCREENSHOT_HEIGHT = 1080;
4979
5264
  const ICON_SIZE = 256;
5265
+ function toFileImportSpecifier(filePath) {
5266
+ return pathToFileURL(filePath).href;
5267
+ }
4980
5268
  /** Matches Node.js built-in imports in bundled output. */
4981
5269
  const NODE_BUILTIN_IMPORT_RE = /(?:import|export|require)\s*(?:\(|[^(]*?\bfrom\s+)["'](?:node:)?([a-z_]+)(?:\/[^"']*)?\s*["']\)?/g;
4982
5270
  const LEADING_DOT_SLASH_RE = /^\.\//;
@@ -5303,7 +5591,7 @@ const bundleCommand = defineCommand({
5303
5591
  consola.error("Failed to build main entry — no output found in", mainOutDir);
5304
5592
  process.exit(1);
5305
5593
  }
5306
- const pluginModule = await import(mainOutputPath);
5594
+ const pluginModule = await import(toFileImportSpecifier(mainOutputPath));
5307
5595
  let resolvedPlugin;
5308
5596
  if (typeof pluginModule.createPlugin === "function") resolvedPlugin = pluginModule.createPlugin();
5309
5597
  else if (typeof pluginModule.default === "function") resolvedPlugin = pluginModule.default();
@@ -5347,7 +5635,7 @@ const bundleCommand = defineCommand({
5347
5635
  });
5348
5636
  const backendProbePath = await findBuildOutput(backendProbeDir, basename(backendEntry).replace(TS_EXT_RE, ""));
5349
5637
  if (backendProbePath) {
5350
- const standardDef = (await import(backendProbePath)).default ?? {};
5638
+ const standardDef = (await import(toFileImportSpecifier(backendProbePath))).default ?? {};
5351
5639
  const hooks = standardDef.hooks;
5352
5640
  const routes = standardDef.routes;
5353
5641
  if (hooks) for (const hookName of Object.keys(hooks)) {
@@ -6858,6 +7146,586 @@ const seedCommand = defineCommand({
6858
7146
  }
6859
7147
  });
6860
7148
 
7149
+ //#endregion
7150
+ //#region src/cli/forgeway-seo-client.ts
7151
+ const DEFAULT_DINEWAY_API_BASE_URL = "https://api.dineway.ai";
7152
+ const TRAILING_SLASH_PATTERN = /\/$/;
7153
+ const SHADOW_EMAIL_PATTERN = /^shadow_[a-f0-9]{16}@dineway\.ai$/i;
7154
+ var ForgewaySeoApiError = class extends Error {
7155
+ constructor(message, status, body) {
7156
+ super(message);
7157
+ this.status = status;
7158
+ this.body = body;
7159
+ this.name = "ForgewaySeoApiError";
7160
+ }
7161
+ };
7162
+ function normalizeApiUrl(value) {
7163
+ return (value || DEFAULT_DINEWAY_API_BASE_URL).replace(TRAILING_SLASH_PATTERN, "");
7164
+ }
7165
+ function resolveForgewaySeoApiUrl(savedPlatformApiUrl, cwd = process.cwd()) {
7166
+ return normalizeApiUrl(getProjectEnvValue("DINEWAY_API_BASE_URL", cwd) ?? (typeof savedPlatformApiUrl === "string" ? savedPlatformApiUrl : void 0));
7167
+ }
7168
+ function normalizeEmail(value) {
7169
+ return value?.trim().toLowerCase() ?? "";
7170
+ }
7171
+ function isShadowEmail(email) {
7172
+ return Boolean(email && SHADOW_EMAIL_PATTERN.test(email));
7173
+ }
7174
+ function assertFormalUser(user) {
7175
+ if (!user || user.emailVerified !== true || isShadowEmail(user.email)) throw new Error("Forgeway SEO provider access requires verified formal Forgeway credentials. Run `dineway deploy forgeway` and complete email verification first.");
7176
+ return user;
7177
+ }
7178
+ function normalizeForgewayUser(user, fallback) {
7179
+ if (!user?.id || !user.email) return fallback;
7180
+ return {
7181
+ id: user.id,
7182
+ name: user.profile?.name ?? user.name ?? user.email,
7183
+ email: user.email,
7184
+ avatarUrl: user.profile?.avatar_url ?? user.avatarUrl ?? user.avatar_url ?? null,
7185
+ emailVerified: user.emailVerified ?? user.email_verified ?? false
7186
+ };
7187
+ }
7188
+ async function parseJsonResponse(response) {
7189
+ const text = await response.text();
7190
+ if (!text) return {};
7191
+ try {
7192
+ return JSON.parse(text);
7193
+ } catch {
7194
+ return { message: text };
7195
+ }
7196
+ }
7197
+ function errorMessage(body, fallback) {
7198
+ if (typeof body !== "object" || body === null) return fallback;
7199
+ const record = body;
7200
+ if (typeof record.message === "string") return record.message;
7201
+ if (typeof record.error === "string") return record.error;
7202
+ const nestedError = record.error;
7203
+ if (typeof nestedError === "object" && nestedError !== null) {
7204
+ const message = nestedError.message;
7205
+ if (typeof message === "string") return message;
7206
+ }
7207
+ return fallback;
7208
+ }
7209
+ var ForgewaySeoGatewayClient = class {
7210
+ fetchImpl;
7211
+ readCredentials;
7212
+ writeCredentials;
7213
+ cwd;
7214
+ constructor(deps = {}) {
7215
+ this.fetchImpl = deps.fetch ?? fetch;
7216
+ this.readCredentials = deps.readCredentials ?? readForgewayCredentials;
7217
+ this.writeCredentials = deps.writeCredentials ?? writeForgewayCredentials;
7218
+ this.cwd = deps.cwd ?? process.cwd();
7219
+ }
7220
+ async loadCredentials() {
7221
+ const metadata = await readForgewayDeployMetadata(this.cwd).catch(() => ({}));
7222
+ const platformApiUrl = resolveForgewaySeoApiUrl(metadata.platformApiUrl, this.cwd);
7223
+ const credentials = await this.readCredentials({
7224
+ cwd: this.cwd,
7225
+ platformApiUrl,
7226
+ email: typeof metadata.publisherEmail === "string" ? metadata.publisherEmail : void 0
7227
+ });
7228
+ if (!credentials?.accessToken) throw new Error("Forgeway SEO provider access requires stored Forgeway credentials. Run `dineway deploy forgeway` first.");
7229
+ assertFormalUser(credentials.user);
7230
+ if (!credentials.refreshToken) throw new Error("Forgeway SEO provider access requires a stored formal-account refresh token. Run `dineway deploy forgeway` again.");
7231
+ return {
7232
+ ...credentials,
7233
+ platformApiUrl: resolveForgewaySeoApiUrl(credentials.platformApiUrl, this.cwd)
7234
+ };
7235
+ }
7236
+ async refreshAccessToken(credentials) {
7237
+ const response = await this.fetchImpl(`${credentials.platformApiUrl}/api/auth/refresh?client_type=server`, {
7238
+ method: "POST",
7239
+ headers: { "Content-Type": "application/json" },
7240
+ body: JSON.stringify({ refreshToken: credentials.refreshToken })
7241
+ });
7242
+ const body = await parseJsonResponse(response);
7243
+ if (!response.ok) throw new ForgewaySeoApiError(errorMessage(body, "Failed to refresh Forgeway formal account credentials. Run `dineway deploy forgeway` again."), response.status, body);
7244
+ if (!body.accessToken) throw new Error("Forgeway refresh response was missing accessToken.");
7245
+ const user = assertFormalUser(normalizeForgewayUser(body.user, credentials.user));
7246
+ if (credentials.user?.email && normalizeEmail(user.email) !== normalizeEmail(credentials.user.email)) throw new Error("Forgeway refresh returned credentials for a different email.");
7247
+ const updated = {
7248
+ ...credentials,
7249
+ accessToken: body.accessToken,
7250
+ refreshToken: body.refreshToken ?? credentials.refreshToken,
7251
+ user
7252
+ };
7253
+ await this.writeCredentials(updated, {
7254
+ cwd: this.cwd,
7255
+ platformApiUrl: updated.platformApiUrl,
7256
+ email: user.email
7257
+ });
7258
+ return updated;
7259
+ }
7260
+ async request(path, body, init) {
7261
+ const credentials = await this.refreshAccessToken(await this.loadCredentials());
7262
+ const response = await this.fetchImpl(`${credentials.platformApiUrl}${path}`, {
7263
+ method: init?.method ?? "POST",
7264
+ headers: {
7265
+ Authorization: `Bearer ${credentials.accessToken}`,
7266
+ "Content-Type": "application/json"
7267
+ },
7268
+ body: init?.method === "GET" ? void 0 : JSON.stringify(body ?? {})
7269
+ });
7270
+ const payload = await parseJsonResponse(response);
7271
+ if (!response.ok) throw new ForgewaySeoApiError(errorMessage(payload, `Forgeway SEO request failed with status ${response.status}.`), response.status, payload);
7272
+ return payload;
7273
+ }
7274
+ };
7275
+
7276
+ //#endregion
7277
+ //#region src/cli/commands/seo.ts
7278
+ const hostedProviderArgs = {
7279
+ json: {
7280
+ type: "boolean",
7281
+ description: "Output as JSON"
7282
+ },
7283
+ "force-refresh": {
7284
+ type: "boolean",
7285
+ description: "Bypass Forgeway SEO provider cache"
7286
+ }
7287
+ };
7288
+ const dataForSeoCommonArgs = {
7289
+ ...hostedProviderArgs,
7290
+ "location-code": {
7291
+ type: "string",
7292
+ description: "DataForSEO location code",
7293
+ default: "2840"
7294
+ },
7295
+ "language-code": {
7296
+ type: "string",
7297
+ description: "DataForSEO language code",
7298
+ default: "en"
7299
+ },
7300
+ device: {
7301
+ type: "string",
7302
+ description: "Device type: desktop or mobile",
7303
+ default: "desktop"
7304
+ }
7305
+ };
7306
+ function toStringValue(value) {
7307
+ return typeof value === "string" && value.trim() ? value.trim() : void 0;
7308
+ }
7309
+ function toNumberValue(value, fallback) {
7310
+ const raw = toStringValue(value);
7311
+ if (!raw) return fallback;
7312
+ const parsed = Number(raw);
7313
+ return Number.isFinite(parsed) ? parsed : fallback;
7314
+ }
7315
+ function forceRefresh(args) {
7316
+ return args["force-refresh"] === true;
7317
+ }
7318
+ function formats(value) {
7319
+ const raw = toStringValue(value);
7320
+ if (!raw) return void 0;
7321
+ return raw.split(",").map((item) => item.trim()).filter(Boolean);
7322
+ }
7323
+ function requireArg(value, name) {
7324
+ const normalized = toStringValue(value);
7325
+ if (!normalized) throw new Error(`${name} is required.`);
7326
+ return normalized;
7327
+ }
7328
+ async function runSeoRequest(args, path, body) {
7329
+ configureOutputMode(args);
7330
+ try {
7331
+ output(await new ForgewaySeoGatewayClient().request(path, body), args);
7332
+ } catch (error) {
7333
+ consola$1.error(error instanceof Error ? error.message : "Unknown error");
7334
+ process.exit(1);
7335
+ }
7336
+ }
7337
+ const firecrawlCommand = defineCommand({
7338
+ meta: {
7339
+ name: "firecrawl",
7340
+ description: "Forgeway-hosted Firecrawl workflows"
7341
+ },
7342
+ subCommands: {
7343
+ scrape: defineCommand({
7344
+ meta: {
7345
+ name: "scrape",
7346
+ description: "Scrape one URL through Forgeway-hosted Firecrawl"
7347
+ },
7348
+ args: {
7349
+ url: {
7350
+ type: "positional",
7351
+ description: "URL to scrape",
7352
+ required: true
7353
+ },
7354
+ ...hostedProviderArgs,
7355
+ formats: {
7356
+ type: "string",
7357
+ description: "Comma-separated Firecrawl formats",
7358
+ default: "markdown"
7359
+ },
7360
+ "only-main-content": {
7361
+ type: "boolean",
7362
+ description: "Return main content only",
7363
+ default: true
7364
+ },
7365
+ "timeout-ms": {
7366
+ type: "string",
7367
+ description: "Provider timeout in milliseconds",
7368
+ default: "60000"
7369
+ }
7370
+ },
7371
+ async run({ args }) {
7372
+ await runSeoRequest(args, "/api/firecrawl/scrape", {
7373
+ url: requireArg(args.url, "url"),
7374
+ formats: formats(args.formats),
7375
+ onlyMainContent: args["only-main-content"] !== false,
7376
+ timeoutMs: toNumberValue(args["timeout-ms"], 6e4),
7377
+ forceRefresh: forceRefresh(args)
7378
+ });
7379
+ }
7380
+ }),
7381
+ map: defineCommand({
7382
+ meta: {
7383
+ name: "map",
7384
+ description: "Map URLs through Forgeway-hosted Firecrawl"
7385
+ },
7386
+ args: {
7387
+ url: {
7388
+ type: "positional",
7389
+ description: "Base URL to map",
7390
+ required: true
7391
+ },
7392
+ ...hostedProviderArgs,
7393
+ search: {
7394
+ type: "string",
7395
+ description: "Optional relevance search term"
7396
+ },
7397
+ sitemap: {
7398
+ type: "string",
7399
+ description: "Sitemap mode: skip, include, or only",
7400
+ default: "include"
7401
+ },
7402
+ limit: {
7403
+ type: "string",
7404
+ description: "Maximum URLs",
7405
+ default: "100"
7406
+ },
7407
+ "include-subdomains": {
7408
+ type: "boolean",
7409
+ description: "Include subdomains"
7410
+ },
7411
+ "ignore-query-parameters": {
7412
+ type: "boolean",
7413
+ description: "Ignore query parameters",
7414
+ default: true
7415
+ }
7416
+ },
7417
+ async run({ args }) {
7418
+ await runSeoRequest(args, "/api/firecrawl/map", {
7419
+ url: requireArg(args.url, "url"),
7420
+ search: toStringValue(args.search),
7421
+ sitemap: toStringValue(args.sitemap) ?? "include",
7422
+ limit: toNumberValue(args.limit, 100),
7423
+ includeSubdomains: args["include-subdomains"] === true,
7424
+ ignoreQueryParameters: args["ignore-query-parameters"] !== false,
7425
+ forceRefresh: forceRefresh(args)
7426
+ });
7427
+ }
7428
+ }),
7429
+ crawl: defineCommand({
7430
+ meta: {
7431
+ name: "crawl",
7432
+ description: "Start a bounded Firecrawl crawl, or check status with --id"
7433
+ },
7434
+ args: {
7435
+ url: {
7436
+ type: "positional",
7437
+ description: "Base URL to crawl"
7438
+ },
7439
+ ...hostedProviderArgs,
7440
+ id: {
7441
+ type: "string",
7442
+ description: "Existing Firecrawl crawl id to check"
7443
+ },
7444
+ limit: {
7445
+ type: "string",
7446
+ description: "Maximum pages",
7447
+ default: "25"
7448
+ },
7449
+ "max-depth": {
7450
+ type: "string",
7451
+ description: "Maximum discovery depth",
7452
+ default: "3"
7453
+ },
7454
+ "allow-subdomains": {
7455
+ type: "boolean",
7456
+ description: "Allow subdomains"
7457
+ },
7458
+ "allow-external-links": {
7459
+ type: "boolean",
7460
+ description: "Allow external links"
7461
+ },
7462
+ formats: {
7463
+ type: "string",
7464
+ description: "Comma-separated scrape formats",
7465
+ default: "markdown"
7466
+ }
7467
+ },
7468
+ async run({ args }) {
7469
+ const crawlId = toStringValue(args.id);
7470
+ if (crawlId) {
7471
+ configureOutputMode(args);
7472
+ try {
7473
+ output(await new ForgewaySeoGatewayClient().request(`/api/firecrawl/crawl/${encodeURIComponent(crawlId)}`, void 0, { method: "GET" }), args);
7474
+ } catch (error) {
7475
+ consola$1.error(error instanceof Error ? error.message : "Unknown error");
7476
+ process.exit(1);
7477
+ }
7478
+ return;
7479
+ }
7480
+ await runSeoRequest(args, "/api/firecrawl/crawl", {
7481
+ url: requireArg(args.url, "url"),
7482
+ limit: toNumberValue(args.limit, 25),
7483
+ maxDiscoveryDepth: toNumberValue(args["max-depth"], 3),
7484
+ allowExternalLinks: args["allow-external-links"] === true,
7485
+ allowSubdomains: args["allow-subdomains"] === true,
7486
+ scrapeFormats: formats(args.formats),
7487
+ forceRefresh: forceRefresh(args)
7488
+ });
7489
+ }
7490
+ }),
7491
+ search: defineCommand({
7492
+ meta: {
7493
+ name: "search",
7494
+ description: "Search through Forgeway-hosted Firecrawl"
7495
+ },
7496
+ args: {
7497
+ query: {
7498
+ type: "positional",
7499
+ description: "Search query",
7500
+ required: true
7501
+ },
7502
+ ...hostedProviderArgs,
7503
+ limit: {
7504
+ type: "string",
7505
+ description: "Maximum results",
7506
+ default: "10"
7507
+ },
7508
+ scrape: {
7509
+ type: "boolean",
7510
+ description: "Scrape result markdown"
7511
+ }
7512
+ },
7513
+ async run({ args }) {
7514
+ await runSeoRequest(args, "/api/firecrawl/search", {
7515
+ query: requireArg(args.query, "query"),
7516
+ limit: toNumberValue(args.limit, 10),
7517
+ scrape: args.scrape === true,
7518
+ forceRefresh: forceRefresh(args)
7519
+ });
7520
+ }
7521
+ })
7522
+ }
7523
+ });
7524
+ function dataForSeoBase(args) {
7525
+ return {
7526
+ locationCode: toNumberValue(args["location-code"], 2840),
7527
+ languageCode: toStringValue(args["language-code"]) ?? "en",
7528
+ device: toStringValue(args.device) ?? "desktop",
7529
+ forceRefresh: forceRefresh(args)
7530
+ };
7531
+ }
7532
+ const dataForSeoSerpCommand = defineCommand({
7533
+ meta: {
7534
+ name: "serp",
7535
+ description: "Fetch Google organic SERP data"
7536
+ },
7537
+ args: {
7538
+ keyword: {
7539
+ type: "positional",
7540
+ description: "Keyword",
7541
+ required: true
7542
+ },
7543
+ ...dataForSeoCommonArgs,
7544
+ depth: {
7545
+ type: "string",
7546
+ description: "SERP depth",
7547
+ default: "10"
7548
+ }
7549
+ },
7550
+ async run({ args }) {
7551
+ await runSeoRequest(args, "/api/dataforseo/serp", {
7552
+ keyword: requireArg(args.keyword, "keyword"),
7553
+ depth: toNumberValue(args.depth, 10),
7554
+ ...dataForSeoBase(args)
7555
+ });
7556
+ }
7557
+ });
7558
+ const dataForSeoMapsCommand = defineCommand({
7559
+ meta: {
7560
+ name: "maps",
7561
+ description: "Fetch Google Maps SERP data"
7562
+ },
7563
+ args: {
7564
+ keyword: {
7565
+ type: "positional",
7566
+ description: "Keyword",
7567
+ required: true
7568
+ },
7569
+ ...dataForSeoCommonArgs,
7570
+ depth: {
7571
+ type: "string",
7572
+ description: "Maps depth",
7573
+ default: "10"
7574
+ }
7575
+ },
7576
+ async run({ args }) {
7577
+ await runSeoRequest(args, "/api/dataforseo/maps", {
7578
+ keyword: requireArg(args.keyword, "keyword"),
7579
+ depth: toNumberValue(args.depth, 10),
7580
+ ...dataForSeoBase(args)
7581
+ });
7582
+ }
7583
+ });
7584
+ const dataForSeoKeywordsCommand = defineCommand({
7585
+ meta: {
7586
+ name: "keywords",
7587
+ description: "Fetch keyword suggestions"
7588
+ },
7589
+ args: {
7590
+ keyword: {
7591
+ type: "positional",
7592
+ description: "Seed keyword",
7593
+ required: true
7594
+ },
7595
+ ...dataForSeoCommonArgs,
7596
+ limit: {
7597
+ type: "string",
7598
+ description: "Maximum suggestions",
7599
+ default: "20"
7600
+ }
7601
+ },
7602
+ async run({ args }) {
7603
+ await runSeoRequest(args, "/api/dataforseo/keywords", {
7604
+ keyword: requireArg(args.keyword, "keyword"),
7605
+ limit: toNumberValue(args.limit, 20),
7606
+ includeSerpInfo: true,
7607
+ includeSeedKeyword: true,
7608
+ ...dataForSeoBase(args)
7609
+ });
7610
+ }
7611
+ });
7612
+ const dataForSeoCompetitorsCommand = defineCommand({
7613
+ meta: {
7614
+ name: "competitors",
7615
+ description: "Fetch competitor-domain data"
7616
+ },
7617
+ args: {
7618
+ domain: {
7619
+ type: "positional",
7620
+ description: "Target domain",
7621
+ required: true
7622
+ },
7623
+ ...dataForSeoCommonArgs,
7624
+ limit: {
7625
+ type: "string",
7626
+ description: "Maximum competitors",
7627
+ default: "20"
7628
+ }
7629
+ },
7630
+ async run({ args }) {
7631
+ await runSeoRequest(args, "/api/dataforseo/competitors", {
7632
+ targetDomain: requireArg(args.domain, "domain"),
7633
+ limit: toNumberValue(args.limit, 20),
7634
+ ...dataForSeoBase(args)
7635
+ });
7636
+ }
7637
+ });
7638
+ const dataForSeoAiScrapeCommand = defineCommand({
7639
+ meta: {
7640
+ name: "ai-scrape",
7641
+ description: "Fetch DataForSEO AI scraper response data"
7642
+ },
7643
+ args: {
7644
+ keyword: {
7645
+ type: "positional",
7646
+ description: "AI search keyword",
7647
+ required: true
7648
+ },
7649
+ ...dataForSeoCommonArgs,
7650
+ platform: {
7651
+ type: "string",
7652
+ description: "AI platform: chat_gpt, gemini, or perplexity",
7653
+ default: "chat_gpt"
7654
+ }
7655
+ },
7656
+ async run({ args }) {
7657
+ await runSeoRequest(args, "/api/dataforseo/ai-scrape", {
7658
+ keyword: requireArg(args.keyword, "keyword"),
7659
+ platform: toStringValue(args.platform) ?? "chat_gpt",
7660
+ ...dataForSeoBase(args)
7661
+ });
7662
+ }
7663
+ });
7664
+ const dataForSeoAiMentionsCommand = defineCommand({
7665
+ meta: {
7666
+ name: "ai-mentions",
7667
+ description: "Fetch DataForSEO LLM mention data"
7668
+ },
7669
+ args: {
7670
+ ...dataForSeoCommonArgs,
7671
+ domain: {
7672
+ type: "string",
7673
+ description: "Target domain"
7674
+ },
7675
+ keyword: {
7676
+ type: "string",
7677
+ description: "Target keyword"
7678
+ },
7679
+ platform: {
7680
+ type: "string",
7681
+ description: "Mention platform: google or chat_gpt",
7682
+ default: "google"
7683
+ },
7684
+ limit: {
7685
+ type: "string",
7686
+ description: "Maximum mentions",
7687
+ default: "20"
7688
+ }
7689
+ },
7690
+ async run({ args }) {
7691
+ if (!toStringValue(args.domain) && !toStringValue(args.keyword)) {
7692
+ consola$1.error("domain or keyword is required.");
7693
+ process.exit(1);
7694
+ }
7695
+ await runSeoRequest(args, "/api/dataforseo/ai-mentions", {
7696
+ targetDomain: toStringValue(args.domain),
7697
+ keyword: toStringValue(args.keyword),
7698
+ platform: toStringValue(args.platform) ?? "google",
7699
+ limit: toNumberValue(args.limit, 20),
7700
+ ...dataForSeoBase(args)
7701
+ });
7702
+ }
7703
+ });
7704
+ const dataForSeoCommand = defineCommand({
7705
+ meta: {
7706
+ name: "dataforseo",
7707
+ description: "Forgeway-hosted DataForSEO workflows"
7708
+ },
7709
+ subCommands: {
7710
+ serp: dataForSeoSerpCommand,
7711
+ maps: dataForSeoMapsCommand,
7712
+ keywords: dataForSeoKeywordsCommand,
7713
+ competitors: dataForSeoCompetitorsCommand,
7714
+ "ai-scrape": dataForSeoAiScrapeCommand,
7715
+ "ai-mentions": dataForSeoAiMentionsCommand
7716
+ }
7717
+ });
7718
+ const seoCommand = defineCommand({
7719
+ meta: {
7720
+ name: "seo",
7721
+ description: "Hosted SEO provider workflows through Forgeway"
7722
+ },
7723
+ subCommands: {
7724
+ firecrawl: firecrawlCommand,
7725
+ dataforseo: dataForSeoCommand
7726
+ }
7727
+ });
7728
+
6861
7729
  //#endregion
6862
7730
  //#region src/cli/commands/taxonomy.ts
6863
7731
  /**
@@ -7074,6 +7942,7 @@ runMain(defineCommand({
7074
7942
  schema: schemaCommand,
7075
7943
  media: mediaCommand,
7076
7944
  search: searchCommand,
7945
+ seo: seoCommand,
7077
7946
  taxonomy: taxonomyCommand,
7078
7947
  menu: menuCommand,
7079
7948
  plugin: pluginCommand