nuxt-backend 0.3.0 → 0.5.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 (573) hide show
  1. package/README.md +10 -1
  2. package/dist/chunks/catalog.mjs +1 -1
  3. package/dist/chunks/doctor.mjs +103 -9
  4. package/dist/chunks/email-previews.mjs +1 -1
  5. package/dist/chunks/health.mjs +2 -2
  6. package/dist/chunks/index.mjs +3 -3
  7. package/dist/chunks/install.mjs +8 -8
  8. package/dist/chunks/run.mjs +1 -1
  9. package/dist/chunks/server.mjs +6 -6
  10. package/dist/cli.mjs +290 -188
  11. package/dist/convex/catalog.d.ts +8 -0
  12. package/dist/convex/catalog.d.ts.map +1 -1
  13. package/dist/convex/catalog.js +16 -0
  14. package/dist/convex/catalog.js.map +1 -1
  15. package/dist/convex/components/backend/_generated/component.d.ts +21 -1
  16. package/dist/convex/components/backend/_generated/component.d.ts.map +1 -1
  17. package/dist/convex/components/backend/billing.d.ts +7 -0
  18. package/dist/convex/components/backend/billing.d.ts.map +1 -1
  19. package/dist/convex/components/backend/billing.js +20 -5
  20. package/dist/convex/components/backend/billing.js.map +1 -1
  21. package/dist/convex/components/backend/jobs.d.ts +69 -1
  22. package/dist/convex/components/backend/jobs.d.ts.map +1 -1
  23. package/dist/convex/components/backend/jobs.js +103 -5
  24. package/dist/convex/components/backend/jobs.js.map +1 -1
  25. package/dist/convex/components/backend/schema.d.ts +46 -18
  26. package/dist/convex/components/backend/schema.d.ts.map +1 -1
  27. package/dist/convex/components/backend/schema.js +11 -0
  28. package/dist/convex/components/backend/schema.js.map +1 -1
  29. package/dist/convex/components/backend/subscriptions.d.ts +3 -3
  30. package/dist/convex/delivery.d.ts +17 -0
  31. package/dist/convex/delivery.d.ts.map +1 -1
  32. package/dist/convex/delivery.js +26 -1
  33. package/dist/convex/delivery.js.map +1 -1
  34. package/dist/convex/emails/renewal-reminder.d.ts.map +1 -1
  35. package/dist/convex/emails/renewal-reminder.js +17 -1
  36. package/dist/convex/emails/renewal-reminder.js.map +1 -1
  37. package/dist/convex/errors.d.ts +7 -5
  38. package/dist/convex/errors.d.ts.map +1 -1
  39. package/dist/convex/errors.js +24 -9
  40. package/dist/convex/errors.js.map +1 -1
  41. package/dist/convex/events.d.ts +10 -0
  42. package/dist/convex/events.d.ts.map +1 -1
  43. package/dist/convex/events.js +7 -0
  44. package/dist/convex/events.js.map +1 -1
  45. package/dist/convex/integrations/ai/images.d.ts.map +1 -1
  46. package/dist/convex/integrations/ai/images.js +20 -7
  47. package/dist/convex/integrations/ai/images.js.map +1 -1
  48. package/dist/convex/integrations/ai/job-errors.d.ts +32 -4
  49. package/dist/convex/integrations/ai/job-errors.d.ts.map +1 -1
  50. package/dist/convex/integrations/ai/job-errors.js +55 -8
  51. package/dist/convex/integrations/ai/job-errors.js.map +1 -1
  52. package/dist/convex/integrations/ai/jobs.d.ts +128 -7
  53. package/dist/convex/integrations/ai/jobs.d.ts.map +1 -1
  54. package/dist/convex/integrations/ai/jobs.js +395 -63
  55. package/dist/convex/integrations/ai/jobs.js.map +1 -1
  56. package/dist/convex/integrations/ai/models.d.ts +1 -1
  57. package/dist/convex/integrations/ai/models.d.ts.map +1 -1
  58. package/dist/convex/integrations/ai/moderation.d.ts +9 -3
  59. package/dist/convex/integrations/ai/moderation.d.ts.map +1 -1
  60. package/dist/convex/integrations/ai/moderation.js +4 -2
  61. package/dist/convex/integrations/ai/moderation.js.map +1 -1
  62. package/dist/convex/integrations/ai.d.ts +2 -2
  63. package/dist/convex/integrations/ai.d.ts.map +1 -1
  64. package/dist/convex/integrations/ai.js +1 -1
  65. package/dist/convex/integrations/ai.js.map +1 -1
  66. package/dist/convex/integrations/billing/context.d.ts.map +1 -1
  67. package/dist/convex/integrations/billing/context.js +5 -2
  68. package/dist/convex/integrations/billing/context.js.map +1 -1
  69. package/dist/convex/integrations/billing/credits.d.ts +1 -0
  70. package/dist/convex/integrations/billing/credits.d.ts.map +1 -1
  71. package/dist/convex/integrations/billing/credits.js +4 -1
  72. package/dist/convex/integrations/billing/credits.js.map +1 -1
  73. package/dist/convex/integrations/billing/features.d.ts.map +1 -1
  74. package/dist/convex/integrations/billing/gifts.d.ts.map +1 -1
  75. package/dist/convex/integrations/billing/history.d.ts.map +1 -1
  76. package/dist/convex/integrations/billing/passes.d.ts +2 -2
  77. package/dist/convex/integrations/billing/passes.d.ts.map +1 -1
  78. package/dist/convex/integrations/billing/passes.js +3 -11
  79. package/dist/convex/integrations/billing/passes.js.map +1 -1
  80. package/dist/convex/integrations/billing/provider-failure.d.ts +17 -0
  81. package/dist/convex/integrations/billing/provider-failure.d.ts.map +1 -0
  82. package/dist/convex/integrations/billing/provider-failure.js +52 -0
  83. package/dist/convex/integrations/billing/provider-failure.js.map +1 -0
  84. package/dist/convex/integrations/billing/quotas.d.ts.map +1 -1
  85. package/dist/convex/integrations/billing/subscriptions.d.ts.map +1 -1
  86. package/dist/convex/integrations/billing/types/setup.d.ts +1 -0
  87. package/dist/convex/integrations/billing/types/setup.d.ts.map +1 -1
  88. package/dist/convex/integrations/billing/types/surface.d.ts +9 -1
  89. package/dist/convex/integrations/billing/types/surface.d.ts.map +1 -1
  90. package/dist/convex/integrations/email-sync.d.ts +24 -2
  91. package/dist/convex/integrations/email-sync.d.ts.map +1 -1
  92. package/dist/convex/integrations/email-sync.js +54 -23
  93. package/dist/convex/integrations/email-sync.js.map +1 -1
  94. package/dist/convex/integrations/inbound.d.ts +16 -7
  95. package/dist/convex/integrations/inbound.d.ts.map +1 -1
  96. package/dist/convex/integrations/inbound.js +21 -10
  97. package/dist/convex/integrations/inbound.js.map +1 -1
  98. package/dist/convex/integrations/launch.d.ts +17 -1
  99. package/dist/convex/integrations/launch.d.ts.map +1 -1
  100. package/dist/convex/integrations/launch.js +32 -3
  101. package/dist/convex/integrations/launch.js.map +1 -1
  102. package/dist/convex/integrations/referrals.d.ts +20 -0
  103. package/dist/convex/integrations/referrals.d.ts.map +1 -1
  104. package/dist/convex/integrations/referrals.js +14 -9
  105. package/dist/convex/integrations/referrals.js.map +1 -1
  106. package/dist/convex/integrations/storage.d.ts +67 -0
  107. package/dist/convex/integrations/storage.d.ts.map +1 -1
  108. package/dist/convex/integrations/storage.js +42 -1
  109. package/dist/convex/integrations/storage.js.map +1 -1
  110. package/dist/convex/label-groups/admin.d.ts +3 -0
  111. package/dist/convex/label-groups/admin.d.ts.map +1 -1
  112. package/dist/convex/label-groups/admin.js +3 -0
  113. package/dist/convex/label-groups/admin.js.map +1 -1
  114. package/dist/convex/label-groups/audit.d.ts +1 -0
  115. package/dist/convex/label-groups/audit.d.ts.map +1 -1
  116. package/dist/convex/label-groups/audit.js +1 -0
  117. package/dist/convex/label-groups/audit.js.map +1 -1
  118. package/dist/convex/label-groups/auth.d.ts +7 -0
  119. package/dist/convex/label-groups/auth.d.ts.map +1 -1
  120. package/dist/convex/label-groups/auth.js +7 -0
  121. package/dist/convex/label-groups/auth.js.map +1 -1
  122. package/dist/convex/label-groups/errors.d.ts +9 -0
  123. package/dist/convex/label-groups/errors.d.ts.map +1 -1
  124. package/dist/convex/label-groups/errors.js +12 -0
  125. package/dist/convex/label-groups/errors.js.map +1 -1
  126. package/dist/convex/label-groups/gift.d.ts +24 -0
  127. package/dist/convex/label-groups/gift.d.ts.map +1 -1
  128. package/dist/convex/label-groups/gift.js +27 -0
  129. package/dist/convex/label-groups/gift.js.map +1 -1
  130. package/dist/convex/label-groups/legal.d.ts +1 -1
  131. package/dist/convex/label-groups/pricing.d.ts +15 -0
  132. package/dist/convex/label-groups/pricing.d.ts.map +1 -1
  133. package/dist/convex/label-groups/pricing.js +20 -0
  134. package/dist/convex/label-groups/pricing.js.map +1 -1
  135. package/dist/convex/label-groups/referral.d.ts +4 -0
  136. package/dist/convex/label-groups/referral.d.ts.map +1 -1
  137. package/dist/convex/label-groups/referral.js +4 -0
  138. package/dist/convex/label-groups/referral.js.map +1 -1
  139. package/dist/convex/label-groups/settings.d.ts +34 -0
  140. package/dist/convex/label-groups/settings.d.ts.map +1 -1
  141. package/dist/convex/label-groups/settings.js +39 -0
  142. package/dist/convex/label-groups/settings.js.map +1 -1
  143. package/dist/convex/label-groups/waitlist.d.ts +5 -0
  144. package/dist/convex/label-groups/waitlist.d.ts.map +1 -1
  145. package/dist/convex/label-groups/waitlist.js +7 -2
  146. package/dist/convex/label-groups/waitlist.js.map +1 -1
  147. package/dist/convex/labels.d.ts +103 -1
  148. package/dist/convex/labels.d.ts.map +1 -1
  149. package/dist/convex/legal.d.ts +18 -1
  150. package/dist/convex/legal.d.ts.map +1 -1
  151. package/dist/convex/legal.js +17 -2
  152. package/dist/convex/legal.js.map +1 -1
  153. package/dist/convex/log.js +8 -0
  154. package/dist/convex/log.js.map +1 -1
  155. package/dist/convex/money.d.ts +10 -0
  156. package/dist/convex/money.d.ts.map +1 -0
  157. package/dist/convex/money.js +37 -0
  158. package/dist/convex/money.js.map +1 -0
  159. package/dist/convex/report-rules.d.ts +6 -0
  160. package/dist/convex/report-rules.d.ts.map +1 -1
  161. package/dist/convex/report-rules.js +15 -0
  162. package/dist/convex/report-rules.js.map +1 -1
  163. package/dist/convex/test-billing.d.ts +83 -0
  164. package/dist/convex/test-billing.d.ts.map +1 -0
  165. package/dist/convex/test-billing.js +131 -0
  166. package/dist/convex/test-billing.js.map +1 -0
  167. package/dist/convex/test-models.d.ts +14 -2
  168. package/dist/convex/test-models.d.ts.map +1 -1
  169. package/dist/convex/test-models.js +61 -4
  170. package/dist/convex/test-models.js.map +1 -1
  171. package/dist/devtools-client/index.html +1 -1
  172. package/dist/eslint.d.mts +2 -1
  173. package/dist/eslint.mjs +2 -1
  174. package/dist/module.d.ts +45 -2
  175. package/dist/module.js +2 -2
  176. package/dist/module.json +1 -1
  177. package/dist/runtime/chunk-recovery.d.ts +13 -0
  178. package/dist/runtime/chunk-recovery.js +1 -0
  179. package/dist/runtime/locales/de.json +113 -7
  180. package/dist/runtime/locales/en.json +114 -8
  181. package/dist/runtime/locales/es.json +113 -7
  182. package/dist/runtime/locales/fr.json +113 -7
  183. package/dist/runtime/locales/ru.json +113 -7
  184. package/dist/runtime/server/chunk-recovery.d.ts +49 -0
  185. package/dist/runtime/server/chunk-recovery.js +44 -0
  186. package/dist/runtime/server/csp.d.ts +7 -2
  187. package/dist/runtime/server/csp.js +2 -2
  188. package/dist/runtime/server/photo-decoder-csp.d.ts +17 -0
  189. package/dist/runtime/server/photo-decoder-csp.js +9 -0
  190. package/dist/runtime/vue/components/account/AccountDeletion.css +1 -1
  191. package/dist/runtime/vue/components/account/ActivationChecklist.css +1 -1
  192. package/dist/runtime/vue/components/account/ConsentPrompt.css +1 -1
  193. package/dist/runtime/vue/components/account/EmailUnsubscribe.css +1 -1
  194. package/dist/runtime/vue/components/account/HowDidYouHear.css +1 -1
  195. package/dist/runtime/vue/components/account/KeepAccount.css +1 -1
  196. package/dist/runtime/vue/components/account/OnboardingFlow.css +1 -1
  197. package/dist/runtime/vue/components/account/ProfileIdentity.css +1 -1
  198. package/dist/runtime/vue/components/account/ProfilePreferencesSection.css +1 -1
  199. package/dist/runtime/vue/components/account/ProfileSettings.css +1 -1
  200. package/dist/runtime/vue/components/account/SecurityAlerts.css +1 -1
  201. package/dist/runtime/vue/components/account/SecurityPasskeys.css +1 -1
  202. package/dist/runtime/vue/components/account/SecuritySessions.css +1 -1
  203. package/dist/runtime/vue/components/account/SecuritySettings.css +1 -1
  204. package/dist/runtime/vue/components/admin/AdminAccess.css +1 -1
  205. package/dist/runtime/vue/components/admin/AdminAnnouncements.css +1 -1
  206. package/dist/runtime/vue/components/admin/AdminBilling.css +1 -1
  207. package/dist/runtime/vue/components/admin/AdminChart.css +1 -1
  208. package/dist/runtime/vue/components/admin/AdminConsole.css +1 -1
  209. package/dist/runtime/vue/components/admin/AdminExperiments.css +1 -1
  210. package/dist/runtime/vue/components/admin/AdminFlags.css +1 -1
  211. package/dist/runtime/vue/components/admin/AdminQueue.css +1 -1
  212. package/dist/runtime/vue/components/admin/AdminQueueJob.vue +5 -2
  213. package/dist/runtime/vue/components/admin/AdminReferrals.css +1 -1
  214. package/dist/runtime/vue/components/admin/AdminReports.css +1 -1
  215. package/dist/runtime/vue/components/admin/AdminRevenue.css +1 -1
  216. package/dist/runtime/vue/components/admin/AdminUsers.d.vue.ts +3 -0
  217. package/dist/runtime/vue/components/admin/AdminUsers.vue.d.ts +3 -0
  218. package/dist/runtime/vue/components/admin/AdminWorkspaces.d.vue.ts +3 -0
  219. package/dist/runtime/vue/components/admin/AdminWorkspaces.vue.d.ts +3 -0
  220. package/dist/runtime/vue/components/admin/admin-access-tab.js +2 -1
  221. package/dist/runtime/vue/components/admin/admin-revenue-tab.js +4 -1
  222. package/dist/runtime/vue/components/admin/admin.css +1 -1
  223. package/dist/runtime/vue/components/auth/AuthForm.css +1 -1
  224. package/dist/runtime/vue/components/auth/AuthForm.d.vue.ts +7 -0
  225. package/dist/runtime/vue/components/auth/AuthForm.vue +1 -2
  226. package/dist/runtime/vue/components/auth/AuthForm.vue.d.ts +7 -0
  227. package/dist/runtime/vue/components/auth/AuthFormChoose.css +1 -1
  228. package/dist/runtime/vue/components/auth/AuthFormHeader.css +1 -1
  229. package/dist/runtime/vue/components/auth/AuthFormPasskeyOffer.css +1 -1
  230. package/dist/runtime/vue/components/auth/InviteRedeem.css +1 -1
  231. package/dist/runtime/vue/components/auth/InviteRedeem.vue +79 -10
  232. package/dist/runtime/vue/components/auth/ReauthenticateCode.css +1 -1
  233. package/dist/runtime/vue/components/auth/ReauthenticateDialog.css +1 -1
  234. package/dist/runtime/vue/components/auth/ReauthenticatePasskey.css +1 -1
  235. package/dist/runtime/vue/components/auth/WaitlistForm.css +1 -1
  236. package/dist/runtime/vue/components/auth/WaitlistForm.d.vue.ts +5 -0
  237. package/dist/runtime/vue/components/auth/WaitlistForm.vue +3 -5
  238. package/dist/runtime/vue/components/auth/WaitlistForm.vue.d.ts +5 -0
  239. package/dist/runtime/vue/components/auth/WaitlistPlace.css +1 -1
  240. package/dist/runtime/vue/components/auth/WaitlistShare.css +1 -1
  241. package/dist/runtime/vue/components/auth/WaitlistShare.vue +1 -7
  242. package/dist/runtime/vue/components/auth/WaitlistStatus.css +1 -1
  243. package/dist/runtime/vue/components/auth/WaitlistStatus.vue +116 -29
  244. package/dist/runtime/vue/components/auth/auth-form.d.ts +1 -1
  245. package/dist/runtime/vue/components/auth/waitlist-form.js +1 -1
  246. package/dist/runtime/vue/components/billing/BillingHistory.css +1 -1
  247. package/dist/runtime/vue/components/billing/BillingHistoryOrder.css +1 -1
  248. package/dist/runtime/vue/components/billing/CancelConfirmGroup.vue +2 -7
  249. package/dist/runtime/vue/components/billing/CancelFlow.css +1 -1
  250. package/dist/runtime/vue/components/billing/GiftForm.css +1 -0
  251. package/dist/runtime/vue/components/billing/GiftForm.d.vue.ts +105 -0
  252. package/dist/runtime/vue/components/billing/GiftForm.vue +228 -0
  253. package/dist/runtime/vue/components/billing/GiftForm.vue.d.ts +105 -0
  254. package/dist/runtime/vue/components/billing/GiftList.css +1 -1
  255. package/dist/runtime/vue/components/billing/GiftList.d.vue.ts +87 -2
  256. package/dist/runtime/vue/components/billing/GiftList.vue +7 -4
  257. package/dist/runtime/vue/components/billing/GiftList.vue.d.ts +87 -2
  258. package/dist/runtime/vue/components/billing/GiftReceived.vue +11 -3
  259. package/dist/runtime/vue/components/billing/PlanChangeConfirmGroup.d.vue.ts +7 -0
  260. package/dist/runtime/vue/components/billing/PlanChangeConfirmGroup.vue +50 -0
  261. package/dist/runtime/vue/components/billing/PlanChangeConfirmGroup.vue.d.ts +7 -0
  262. package/dist/runtime/vue/components/billing/PricingChangeConfirm.d.vue.ts +4 -0
  263. package/dist/runtime/vue/components/billing/PricingChangeConfirm.vue +17 -0
  264. package/dist/runtime/vue/components/billing/PricingChangeConfirm.vue.d.ts +4 -0
  265. package/dist/runtime/vue/components/billing/PricingPackCard.css +1 -1
  266. package/dist/runtime/vue/components/billing/PricingPlanCard.css +1 -1
  267. package/dist/runtime/vue/components/billing/PricingPlanCard.vue +15 -0
  268. package/dist/runtime/vue/components/billing/PricingTable.css +1 -1
  269. package/dist/runtime/vue/components/billing/PricingTable.d.vue.ts +24 -2
  270. package/dist/runtime/vue/components/billing/PricingTable.vue +70 -37
  271. package/dist/runtime/vue/components/billing/PricingTable.vue.d.ts +24 -2
  272. package/dist/runtime/vue/components/billing/ReferralCard.css +1 -1
  273. package/dist/runtime/vue/components/billing/ReferralCard.d.vue.ts +4 -0
  274. package/dist/runtime/vue/components/billing/ReferralCard.vue.d.ts +4 -0
  275. package/dist/runtime/vue/components/billing/ReferralLanding.css +1 -1
  276. package/dist/runtime/vue/components/billing/ReferralLanding.vue +43 -2
  277. package/dist/runtime/vue/components/billing/UpgradePrompt.css +1 -1
  278. package/dist/runtime/vue/components/billing/UsageHistory.css +1 -1
  279. package/dist/runtime/vue/components/billing/WithdrawalButton.css +1 -1
  280. package/dist/runtime/vue/components/billing/cancel-flow.js +2 -1
  281. package/dist/runtime/vue/components/billing/pricing-table.d.ts +10 -0
  282. package/dist/runtime/vue/components/billing/withdrawal-button.d.ts +3 -2
  283. package/dist/runtime/vue/components/billing/withdrawal-button.js +13 -33
  284. package/dist/runtime/vue/components/shared.css +1 -1
  285. package/dist/runtime/vue/components/shell/AccessDenied.css +1 -1
  286. package/dist/runtime/vue/components/shell/AiLabel.css +1 -1
  287. package/dist/runtime/vue/components/shell/AppShell.css +1 -1
  288. package/dist/runtime/vue/components/shell/ConfirmDialog.css +1 -1
  289. package/dist/runtime/vue/components/shell/ConnectionStatus.css +1 -1
  290. package/dist/runtime/vue/components/shell/ContactForm.css +1 -1
  291. package/dist/runtime/vue/components/shell/Gate.css +1 -1
  292. package/dist/runtime/vue/components/shell/LegalDocument.css +1 -1
  293. package/dist/runtime/vue/components/shell/NoticeAnnouncement.css +1 -1
  294. package/dist/runtime/vue/components/shell/NoticeDeletion.css +1 -1
  295. package/dist/runtime/vue/components/shell/NoticeGift.css +1 -1
  296. package/dist/runtime/vue/components/shell/NoticeImpersonation.css +1 -1
  297. package/dist/runtime/vue/components/shell/NoticeLowCredits.css +1 -1
  298. package/dist/runtime/vue/components/shell/NoticeMaintenance.css +1 -1
  299. package/dist/runtime/vue/components/shell/NoticePastDue.css +1 -1
  300. package/dist/runtime/vue/components/shell/NotificationInbox.css +1 -1
  301. package/dist/runtime/vue/components/shell/ReportAppeal.vue +16 -13
  302. package/dist/runtime/vue/components/shell/ReportNotice.css +1 -1
  303. package/dist/runtime/vue/components/shell/UploadField.css +1 -1
  304. package/dist/runtime/vue/components/shell/WorkspaceSwitcher.css +1 -1
  305. package/dist/runtime/vue/components/shell/report-form.js +1 -44
  306. package/dist/runtime/vue/components/tokens.css +1 -1
  307. package/dist/runtime/vue/components/workspaces/AuditLog.css +1 -1
  308. package/dist/runtime/vue/components/workspaces/AuditLog.d.vue.ts +1 -0
  309. package/dist/runtime/vue/components/workspaces/AuditLog.vue.d.ts +1 -0
  310. package/dist/runtime/vue/components/workspaces/WorkspaceBilling.css +1 -1
  311. package/dist/runtime/vue/components/workspaces/WorkspaceBilling.vue +34 -58
  312. package/dist/runtime/vue/components/workspaces/WorkspaceBillingPause.d.vue.ts +3 -0
  313. package/dist/runtime/vue/components/workspaces/WorkspaceBillingPause.vue +68 -0
  314. package/dist/runtime/vue/components/workspaces/WorkspaceBillingPause.vue.d.ts +3 -0
  315. package/dist/runtime/vue/components/workspaces/WorkspaceBillingSwitch.d.vue.ts +3 -0
  316. package/dist/runtime/vue/components/workspaces/WorkspaceBillingSwitch.vue +54 -0
  317. package/dist/runtime/vue/components/workspaces/WorkspaceBillingSwitch.vue.d.ts +3 -0
  318. package/dist/runtime/vue/components/workspaces/WorkspaceCredits.css +1 -1
  319. package/dist/runtime/vue/components/workspaces/WorkspaceList.css +1 -1
  320. package/dist/runtime/vue/components/workspaces/WorkspaceSettings.d.vue.ts +40 -2
  321. package/dist/runtime/vue/components/workspaces/WorkspaceSettings.vue +20 -2
  322. package/dist/runtime/vue/components/workspaces/WorkspaceSettings.vue.d.ts +40 -2
  323. package/dist/runtime/vue/components/workspaces/workspace-billing.d.ts +46 -13
  324. package/dist/runtime/vue/components/workspaces/workspace-billing.js +93 -16
  325. package/dist/runtime/vue/components/workspaces/workspace-settings.d.ts +4 -0
  326. package/dist/runtime/vue/composables/billing-format.d.ts +9 -4
  327. package/dist/runtime/vue/composables/billing-format.js +17 -9
  328. package/dist/runtime/vue/composables/billing-provider.js +3 -2
  329. package/dist/runtime/vue/composables/prepare-photo.d.ts +75 -0
  330. package/dist/runtime/vue/composables/prepare-photo.js +223 -0
  331. package/dist/runtime/vue/composables/use-access.d.ts +41 -2
  332. package/dist/runtime/vue/composables/use-access.js +54 -8
  333. package/dist/runtime/vue/composables/use-billing-section.d.ts +115 -0
  334. package/dist/runtime/vue/composables/use-billing-section.js +76 -0
  335. package/dist/runtime/vue/composables/use-billing.d.ts +76 -5
  336. package/dist/runtime/vue/composables/use-billing.js +48 -0
  337. package/dist/runtime/vue/composables/use-gift-form.d.ts +123 -0
  338. package/dist/runtime/vue/composables/use-gift-form.js +152 -0
  339. package/dist/runtime/vue/composables/use-gift-list.d.ts +62 -5
  340. package/dist/runtime/vue/composables/use-gift-list.js +17 -6
  341. package/dist/runtime/vue/composables/use-install-prompt.d.ts +71 -0
  342. package/dist/runtime/vue/composables/use-install-prompt.js +53 -0
  343. package/dist/runtime/vue/composables/use-labels.js +17 -23
  344. package/dist/runtime/vue/composables/use-login-flow.d.ts +9 -0
  345. package/dist/runtime/vue/composables/use-login-flow.js +7 -0
  346. package/dist/runtime/vue/composables/use-orders.d.ts +1 -1
  347. package/dist/runtime/vue/composables/use-plan-change.d.ts +148 -0
  348. package/dist/runtime/vue/composables/use-plan-change.js +130 -0
  349. package/dist/runtime/vue/composables/use-pricing.d.ts +83 -5
  350. package/dist/runtime/vue/composables/use-pricing.js +83 -17
  351. package/dist/runtime/vue/composables/use-push-subscription.js +1 -7
  352. package/dist/runtime/vue/composables/use-referral-invite.d.ts +24 -2
  353. package/dist/runtime/vue/composables/use-referral-invite.js +14 -2
  354. package/dist/runtime/vue/composables/use-referrals.js +2 -1
  355. package/dist/runtime/vue/composables/use-report-appeal.d.ts +86 -0
  356. package/dist/runtime/vue/composables/use-report-appeal.js +61 -0
  357. package/dist/runtime/vue/composables/use-return-path.d.ts +5 -4
  358. package/dist/runtime/vue/composables/use-return-path.js +16 -2
  359. package/dist/runtime/vue/composables/use-waitlist.d.ts +31 -1
  360. package/dist/runtime/vue/composables/use-waitlist.js +39 -4
  361. package/dist/runtime/vue/composables/use-withdrawal.d.ts +63 -0
  362. package/dist/runtime/vue/composables/use-withdrawal.js +38 -0
  363. package/dist/runtime/vue/middleware/page-access.js +2 -2
  364. package/dist/runtime/vue/pages/gifts.vue +2 -0
  365. package/dist/runtime/vue/pages/login.vue +5 -7
  366. package/dist/runtime/vue/pages/pricing.vue +1 -2
  367. package/dist/runtime/vue/pages/report.vue +2 -3
  368. package/dist/runtime/vue/parts.d.ts +5 -0
  369. package/dist/runtime/vue/plugins/checkout-return.js +9 -2
  370. package/dist/runtime/vue/plugins/chunk-recovery.client.d.ts +10 -0
  371. package/dist/runtime/vue/plugins/chunk-recovery.client.js +10 -0
  372. package/dist/runtime/vue/plugins/install-banner.client.d.ts +7 -0
  373. package/dist/runtime/vue/plugins/install-banner.client.js +5 -0
  374. package/dist/runtime/vue/plugins/install-prompt.client.d.ts +7 -0
  375. package/dist/runtime/vue/plugins/install-prompt.client.js +6 -0
  376. package/dist/runtime/vue/plugins/session-ended.js +2 -3
  377. package/dist/runtime/vue/utils/active-locale.js +8 -0
  378. package/dist/runtime/vue/utils/checkout-return.d.ts +11 -1
  379. package/dist/runtime/vue/utils/checkout-return.js +6 -2
  380. package/dist/runtime/vue/utils/confirm-group.d.ts +18 -0
  381. package/dist/runtime/vue/utils/confirm-group.js +17 -0
  382. package/dist/runtime/vue/utils/display-mode.d.ts +8 -0
  383. package/dist/runtime/vue/utils/display-mode.js +11 -0
  384. package/dist/runtime/vue/utils/gift-days.d.ts +20 -0
  385. package/dist/runtime/vue/utils/gift-days.js +32 -0
  386. package/dist/runtime/vue/utils/heic-absent.d.ts +2 -0
  387. package/dist/runtime/vue/utils/heic-absent.js +3 -0
  388. package/dist/runtime/vue/utils/intl.d.ts +12 -4
  389. package/dist/runtime/vue/utils/intl.js +13 -2
  390. package/dist/runtime/vue/utils/kept-invite.js +6 -29
  391. package/dist/runtime/vue/utils/namespace.js +7 -2
  392. package/dist/runtime/vue/utils/page-open.d.ts +1 -0
  393. package/dist/runtime/vue/utils/page-open.js +12 -0
  394. package/dist/runtime/vue/utils/page-origin.d.ts +15 -0
  395. package/dist/runtime/vue/utils/page-origin.js +8 -0
  396. package/dist/runtime/vue/utils/page-rules.d.ts +9 -0
  397. package/dist/runtime/vue/utils/page-rules.js +3 -0
  398. package/dist/runtime/vue/utils/plan-change-confirm.d.ts +88 -0
  399. package/dist/runtime/vue/utils/plan-change-confirm.js +48 -0
  400. package/dist/runtime/vue/utils/pricing-bindings.d.ts +7 -1
  401. package/dist/runtime/vue/utils/pricing-bindings.js +21 -0
  402. package/dist/runtime/vue/utils/pricing-checkout.d.ts +39 -0
  403. package/dist/runtime/vue/utils/pricing-checkout.js +22 -0
  404. package/dist/runtime/vue/utils/pricing-seo.js +4 -2
  405. package/dist/runtime/vue/utils/tab-keep.d.ts +19 -0
  406. package/dist/runtime/vue/utils/tab-keep.js +46 -0
  407. package/dist/shared/{nuxt-backend.G4JryO1q.mjs → nuxt-backend.BqXAZChe.mjs} +277 -51
  408. package/dist/shared/{nuxt-backend.Lk2MQI2u.mjs → nuxt-backend.CBvrM7pG.mjs} +26 -2
  409. package/dist/shared/{nuxt-backend.D9qXcOOI.mjs → nuxt-backend.DH1Ya3uB.mjs} +1 -1
  410. package/dist/shared/{nuxt-backend.Bq_mhlky.mjs → nuxt-backend.DbaXvH__.mjs} +55 -10
  411. package/dist/shared/{nuxt-backend.DmZI-QSO.mjs → nuxt-backend.Dikfaocl.mjs} +54 -30
  412. package/package.json +6 -1
  413. package/skills/nuxt-backend/references/api.md +28 -10
  414. package/skills/nuxt-backend/references/install.md +4 -1
  415. package/skills/nuxt-backend/references/renames.json +112 -0
  416. package/skills/nuxt-backend/references/surface.json +32 -2
  417. package/skills/nuxt-backend-ai/references/api.md +2 -1
  418. package/skills/nuxt-backend-auth/references/api.md +1 -1
  419. package/skills/nuxt-backend-billing/SKILL.md +9 -0
  420. package/skills/nuxt-backend-billing/references/api.md +4 -0
  421. package/skills/nuxt-backend-data/references/api.md +4 -1
  422. package/skills/nuxt-backend-email/SKILL.md +5 -2
  423. package/skills/nuxt-backend-email/references/api.md +1 -0
  424. package/skills/nuxt-backend-growth/references/api.md +4 -0
  425. package/skills/nuxt-backend-ship/SKILL.md +1 -1
  426. package/skills/nuxt-backend-ship/references/api.md +9 -5
  427. package/skills/nuxt-backend-ui/SKILL.md +10 -5
  428. package/skills/nuxt-backend-upgrade/SKILL.md +4 -3
  429. package/skills/nuxt-backend-upgrade/references/upgrade.md +49 -0
  430. package/src/convex/catalog.ts +17 -0
  431. package/src/convex/components/backend/_generated/component.ts +30 -2
  432. package/src/convex/components/backend/billing.ts +19 -5
  433. package/src/convex/components/backend/jobs.ts +102 -5
  434. package/src/convex/components/backend/schema.ts +11 -0
  435. package/src/convex/delivery.ts +26 -1
  436. package/src/convex/emails/renewal-reminder.ts +19 -1
  437. package/src/convex/errors.ts +23 -9
  438. package/src/convex/events.ts +7 -0
  439. package/src/convex/integrations/ai/images.ts +22 -8
  440. package/src/convex/integrations/ai/job-errors.ts +64 -9
  441. package/src/convex/integrations/ai/jobs.ts +509 -64
  442. package/src/convex/integrations/ai/models.ts +1 -1
  443. package/src/convex/integrations/ai/moderation.ts +10 -5
  444. package/src/convex/integrations/ai.ts +6 -1
  445. package/src/convex/integrations/billing/context.ts +6 -3
  446. package/src/convex/integrations/billing/credits.ts +4 -1
  447. package/src/convex/integrations/billing/passes.ts +3 -11
  448. package/src/convex/integrations/billing/provider-failure.ts +56 -0
  449. package/src/convex/integrations/billing/types/setup.ts +1 -1
  450. package/src/convex/integrations/billing/types/surface.ts +9 -2
  451. package/src/convex/integrations/email-sync.ts +74 -26
  452. package/src/convex/integrations/inbound.ts +32 -16
  453. package/src/convex/integrations/launch.ts +52 -5
  454. package/src/convex/integrations/referrals.ts +25 -7
  455. package/src/convex/integrations/storage.ts +107 -1
  456. package/src/convex/label-groups/admin.ts +3 -0
  457. package/src/convex/label-groups/audit.ts +1 -0
  458. package/src/convex/label-groups/auth.ts +7 -0
  459. package/src/convex/label-groups/errors.ts +12 -0
  460. package/src/convex/label-groups/gift.ts +27 -0
  461. package/src/convex/label-groups/pricing.ts +20 -0
  462. package/src/convex/label-groups/referral.ts +4 -0
  463. package/src/convex/label-groups/settings.ts +39 -0
  464. package/src/convex/label-groups/waitlist.ts +7 -2
  465. package/src/convex/legal.ts +23 -2
  466. package/src/convex/log.ts +8 -0
  467. package/src/convex/money.ts +40 -0
  468. package/src/convex/report-rules.ts +16 -0
  469. package/src/convex/test-billing.ts +189 -0
  470. package/src/convex/test-models.ts +59 -4
  471. package/src/convex/test.ts +95 -8
  472. package/src/runtime/vue/components/account/AccountDeletion.css +1 -1
  473. package/src/runtime/vue/components/account/ActivationChecklist.css +5 -3
  474. package/src/runtime/vue/components/account/ConsentPrompt.css +7 -5
  475. package/src/runtime/vue/components/account/EmailUnsubscribe.css +8 -4
  476. package/src/runtime/vue/components/account/HowDidYouHear.css +9 -5
  477. package/src/runtime/vue/components/account/KeepAccount.css +4 -2
  478. package/src/runtime/vue/components/account/OnboardingFlow.css +6 -4
  479. package/src/runtime/vue/components/account/ProfileIdentity.css +1 -1
  480. package/src/runtime/vue/components/account/ProfilePreferencesSection.css +4 -2
  481. package/src/runtime/vue/components/account/ProfileSettings.css +4 -2
  482. package/src/runtime/vue/components/account/SecurityAlerts.css +1 -1
  483. package/src/runtime/vue/components/account/SecurityPasskeys.css +3 -3
  484. package/src/runtime/vue/components/account/SecuritySessions.css +1 -1
  485. package/src/runtime/vue/components/account/SecuritySettings.css +1 -1
  486. package/src/runtime/vue/components/admin/AdminAccess.css +1 -1
  487. package/src/runtime/vue/components/admin/AdminAnnouncements.css +2 -2
  488. package/src/runtime/vue/components/admin/AdminBilling.css +1 -1
  489. package/src/runtime/vue/components/admin/AdminChart.css +1 -1
  490. package/src/runtime/vue/components/admin/AdminConsole.css +1 -0
  491. package/src/runtime/vue/components/admin/AdminExperiments.css +1 -1
  492. package/src/runtime/vue/components/admin/AdminFlags.css +2 -2
  493. package/src/runtime/vue/components/admin/AdminQueue.css +5 -3
  494. package/src/runtime/vue/components/admin/AdminQueueJob.vue +6 -2
  495. package/src/runtime/vue/components/admin/AdminReferrals.css +4 -2
  496. package/src/runtime/vue/components/admin/AdminReports.css +1 -1
  497. package/src/runtime/vue/components/admin/AdminRevenue.css +1 -1
  498. package/src/runtime/vue/components/admin/admin.css +3 -3
  499. package/src/runtime/vue/components/auth/AuthForm.css +7 -4
  500. package/src/runtime/vue/components/auth/AuthForm.vue +1 -2
  501. package/src/runtime/vue/components/auth/AuthFormChoose.css +2 -1
  502. package/src/runtime/vue/components/auth/AuthFormHeader.css +1 -1
  503. package/src/runtime/vue/components/auth/AuthFormPasskeyOffer.css +1 -1
  504. package/src/runtime/vue/components/auth/InviteRedeem.css +56 -2
  505. package/src/runtime/vue/components/auth/InviteRedeem.vue +92 -12
  506. package/src/runtime/vue/components/auth/ReauthenticateCode.css +1 -1
  507. package/src/runtime/vue/components/auth/ReauthenticateDialog.css +6 -3
  508. package/src/runtime/vue/components/auth/ReauthenticatePasskey.css +1 -1
  509. package/src/runtime/vue/components/auth/WaitlistForm.css +4 -2
  510. package/src/runtime/vue/components/auth/WaitlistForm.vue +5 -6
  511. package/src/runtime/vue/components/auth/WaitlistPlace.css +4 -2
  512. package/src/runtime/vue/components/auth/WaitlistShare.css +6 -4
  513. package/src/runtime/vue/components/auth/WaitlistShare.vue +2 -8
  514. package/src/runtime/vue/components/auth/WaitlistStatus.css +27 -1
  515. package/src/runtime/vue/components/auth/WaitlistStatus.vue +149 -36
  516. package/src/runtime/vue/components/billing/BillingHistory.css +2 -2
  517. package/src/runtime/vue/components/billing/BillingHistoryOrder.css +1 -1
  518. package/src/runtime/vue/components/billing/CancelConfirmGroup.vue +2 -8
  519. package/src/runtime/vue/components/billing/CancelFlow.css +6 -4
  520. package/src/runtime/vue/components/billing/GiftForm.css +89 -0
  521. package/src/runtime/vue/components/billing/GiftForm.vue +251 -0
  522. package/src/runtime/vue/components/billing/GiftList.css +5 -3
  523. package/src/runtime/vue/components/billing/GiftList.vue +21 -9
  524. package/src/runtime/vue/components/billing/GiftReceived.vue +11 -3
  525. package/src/runtime/vue/components/billing/PlanChangeConfirmGroup.vue +59 -0
  526. package/src/runtime/vue/components/billing/PricingChangeConfirm.vue +22 -0
  527. package/src/runtime/vue/components/billing/PricingPackCard.css +1 -1
  528. package/src/runtime/vue/components/billing/PricingPlanCard.css +31 -4
  529. package/src/runtime/vue/components/billing/PricingPlanCard.vue +17 -2
  530. package/src/runtime/vue/components/billing/PricingTable.css +2 -2
  531. package/src/runtime/vue/components/billing/PricingTable.vue +122 -66
  532. package/src/runtime/vue/components/billing/ReferralCard.css +6 -4
  533. package/src/runtime/vue/components/billing/ReferralLanding.css +14 -3
  534. package/src/runtime/vue/components/billing/ReferralLanding.vue +53 -3
  535. package/src/runtime/vue/components/billing/UpgradePrompt.css +6 -4
  536. package/src/runtime/vue/components/billing/UsageHistory.css +2 -2
  537. package/src/runtime/vue/components/billing/WithdrawalButton.css +5 -3
  538. package/src/runtime/vue/components/shared.css +62 -9
  539. package/src/runtime/vue/components/shell/AccessDenied.css +5 -3
  540. package/src/runtime/vue/components/shell/AiLabel.css +2 -2
  541. package/src/runtime/vue/components/shell/AppShell.css +5 -3
  542. package/src/runtime/vue/components/shell/ConfirmDialog.css +5 -3
  543. package/src/runtime/vue/components/shell/ConnectionStatus.css +1 -1
  544. package/src/runtime/vue/components/shell/ContactForm.css +4 -2
  545. package/src/runtime/vue/components/shell/Gate.css +5 -3
  546. package/src/runtime/vue/components/shell/LegalDocument.css +1 -1
  547. package/src/runtime/vue/components/shell/NoticeAnnouncement.css +1 -1
  548. package/src/runtime/vue/components/shell/NoticeDeletion.css +5 -3
  549. package/src/runtime/vue/components/shell/NoticeGift.css +1 -1
  550. package/src/runtime/vue/components/shell/NoticeImpersonation.css +1 -1
  551. package/src/runtime/vue/components/shell/NoticeLowCredits.css +6 -3
  552. package/src/runtime/vue/components/shell/NoticeMaintenance.css +1 -1
  553. package/src/runtime/vue/components/shell/NoticePastDue.css +5 -3
  554. package/src/runtime/vue/components/shell/NotificationInbox.css +6 -4
  555. package/src/runtime/vue/components/shell/ReportAppeal.vue +17 -14
  556. package/src/runtime/vue/components/shell/ReportNotice.css +1 -1
  557. package/src/runtime/vue/components/shell/UploadField.css +5 -3
  558. package/src/runtime/vue/components/shell/WorkspaceSwitcher.css +5 -3
  559. package/src/runtime/vue/components/tokens.css +30 -0
  560. package/src/runtime/vue/components/workspaces/AuditLog.css +2 -2
  561. package/src/runtime/vue/components/workspaces/WorkspaceBilling.css +75 -2
  562. package/src/runtime/vue/components/workspaces/WorkspaceBilling.vue +51 -63
  563. package/src/runtime/vue/components/workspaces/WorkspaceBillingPause.vue +78 -0
  564. package/src/runtime/vue/components/workspaces/WorkspaceBillingSwitch.vue +63 -0
  565. package/src/runtime/vue/components/workspaces/WorkspaceCredits.css +1 -0
  566. package/src/runtime/vue/components/workspaces/WorkspaceList.css +2 -2
  567. package/src/runtime/vue/components/workspaces/WorkspaceSettings.vue +35 -5
  568. package/src/runtime/vue/pages/gifts.vue +12 -7
  569. package/src/runtime/vue/pages/invite.vue +4 -2
  570. package/src/runtime/vue/pages/login.vue +8 -8
  571. package/src/runtime/vue/pages/pricing.vue +1 -4
  572. package/src/runtime/vue/pages/report.vue +2 -3
  573. package/src/runtime/vue/pages/waitlist.vue +8 -5
package/dist/cli.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import { defineCommand, parseArgs, runMain } from 'citty';
3
3
  import { mkdtempSync, writeFileSync, rmSync, existsSync, readFileSync, readdirSync, mkdirSync, cpSync, symlinkSync } from 'node:fs';
4
- import { join, resolve, dirname, posix, relative, isAbsolute, sep } from 'node:path';
5
- import { C as CAPABILITY_STATES, d as deploymentFunctionSpec, a as deploymentEnvNames, i as isHttpUrl, b as deploymentBackendEnvironment, c as billingEnvironment, s as siteFromCloudUrl, e as deployKeyType, r as readEnvFiles, f as runConvex, R as RESYNC_ENTITLEMENTS_FUNCTION, g as deploymentFlags, h as ConvexCliError, n as nonProductionDeployKey, j as resolveFunctionsDir, k as readTextIfPresent, l as executeEnvPush, m as generateAuthSecret, o as setDeploymentEnv, p as isLoopbackUrl, q as spawnConvex, B as BACKEND_ENV_NAMES, D as DERIVED_DEPLOYMENT_ENV, t as scaffoldBackendFiles, u as pathsSourceOf, v as syncPathsFile, w as backendPathsOf, x as pathsFileLocation, y as appBrandOf, z as syncBrandFile, A as brandFileLocation, E as appLabelsOf, F as syncLabelsFile, G as labelsFileLocation, H as configuredDeployment, I as isDevDeploymentId, M as MCP_SDK, J as computeDeployment, K as appMonitoringDsn, L as monitoringSdkInstalled, N as detectCapabilities, O as DEPLOYMENT_KIND_LABEL, P as CAPABILITY_NAMES, Q as REGISTERED_UI, S as uiPath, T as BACKEND_PAGE_DEFS, U as installedVersion, V as packageDir, W as uiEntry, X as agentsMdVersion, Y as packageVersion, Z as doctorReport, _ as formatPreflightSummary, $ as runEnvPush, a0 as devPushRefusal } from './shared/nuxt-backend.Bq_mhlky.mjs';
6
- import { s as setUpProject, n as nextCommands$1, f as formatNextSteps, a as setUpAgentFiles } from './shared/nuxt-backend.DmZI-QSO.mjs';
7
- import { P as PROVIDER_COMPONENT, l as loadCatalog, f as freePlanOf, M as MANAGED_BY, i as isManaged, r as refuseUnpricedPlans, a as refuseInvalidPrices, b as refuseOnceCredits, c as refuseInvalidGifts, d as refuseInvalidQuotas, e as refuseInvalidDiscounts, g as listAllPages, h as refuseMissingDefaultCurrency, j as refuseMissingOrganizationCurrency, k as refuseUnpricedDiscounts, m as ensurePlanQuotas, n as retirePlan, p as pricedIntervals, o as attachRetiredPlanQuotas, q as recordQuotaKeys, s as packPricesByCurrency, t as syncPassProducts, u as syncDiscounts, v as planQuotasKeys, w as derivedPassKeys, x as droppedQuotasKeys, y as unpricedPlanProducts, z as providerClientOptions, A as planQuotasKey, B as planPricesByCurrency, C as findPlanProduct, D as isUntaggedPlanProduct, E as planCreditUnits, F as planQuotasBenefits, G as isFreePlan, H as zeroPrices, I as providerTrialOf, J as pushPlanTrial, K as attachPlanQuotas, L as BILLING_WEBHOOK_PROVISION_EVENTS, N as planProductKey, O as recordPlanProduct, Q as loadGenerated, R as renderGenerated, S as probeWebhookRoute, T as runEmailSync, U as planSettingChanges, V as planEndpointChanges, W as applyProviderChanges, X as billingProviderTarget, Y as providerClient, Z as readProviderOrganization, _ as readProviderEndpoint, $ as emailSyncRefusal, a0 as ADMISSION_DAYS, a1 as CLI_ADMISSION_LABEL, a2 as admitInputRefusal, a3 as admitRefused, a4 as admitCleaned, a5 as runDoctorChecks, a6 as readProductionPosture, a7 as email, a8 as runEnvDefaults, a9 as bootstrapAdmin, aa as runEmailSyncCommand, ab as ENV_DEFAULT_TYPES } from './chunks/doctor.mjs';
4
+ import { join, resolve, posix, relative, dirname, isAbsolute, sep } from 'node:path';
5
+ import { C as CAPABILITY_STATES, d as deploymentFunctionSpec, a as deploymentEnvNames, i as isHttpUrl, b as deploymentBackendEnvironment, c as billingEnvironment, s as siteFromCloudUrl, e as deployKeyType, r as readEnvFiles, f as runConvex, R as RESYNC_ENTITLEMENTS_FUNCTION, g as deploymentFlags, h as ConvexCliError, n as nonProductionDeployKey, j as resolveFunctionsDir, k as readTextIfPresent, l as executeEnvPush, m as generateAuthSecret, o as setDeploymentEnv, p as isLoopbackUrl, q as configuredDeployment, t as spawnConvex, B as BACKEND_ENV_NAMES, D as DERIVED_DEPLOYMENT_ENV, u as scaffoldBackendFiles, v as pathsSourceOf, w as syncPathsFile, x as backendPathsOf, y as pathsFileLocation, z as appBrandOf, A as syncBrandFile, E as brandFileLocation, F as appLabelsOf, G as syncLabelsFile, H as labelsFileLocation, I as isDevDeploymentId, M as MCP_SDK, J as computeDeployment, K as appMonitoringDsn, L as monitoringSdkInstalled, N as detectCapabilities, O as DEPLOYMENT_KIND_LABEL, P as CAPABILITY_NAMES, Q as REGISTERED_UI, S as uiPath, T as BACKEND_PAGE_DEFS, U as installedVersion, V as packageDir, W as uiEntry, X as agentsMdVersion, Y as packageVersion, Z as doctorReport, _ as formatPreflightSummary, $ as runEnvPush, a0 as devPushRefusal } from './shared/nuxt-backend.DbaXvH__.mjs';
6
+ import { e as execBinary, r as runScript, p as packageManagerOf, s as setUpProject, n as nextCommands$1, f as formatNextSteps, a as setUpAgentFiles, i as installCommand } from './shared/nuxt-backend.Dikfaocl.mjs';
7
+ import { P as PROVIDER_COMPONENT, l as loadCatalog, f as freePlanOf, M as MANAGED_BY, i as isManaged, r as refuseUnpricedPlans, a as refuseInvalidPrices, b as refuseOnceCredits, c as refuseInvalidGifts, d as refuseInvalidQuotas, e as refuseInvalidDiscounts, g as listAllPages, h as refuseMissingDefaultCurrency, j as refuseMissingOrganizationCurrency, k as refuseUnpricedDiscounts, m as ensurePlanQuotas, n as retirePlan, p as pricedIntervals, o as attachRetiredPlanQuotas, q as recordQuotaKeys, s as packPricesByCurrency, t as syncPassProducts, u as syncDiscounts, v as planQuotasKeys, w as derivedPassKeys, x as droppedQuotasKeys, y as unpricedPlanProducts, z as providerClientOptions, A as planQuotasKey, B as planPricesByCurrency, C as findPlanProduct, D as isUntaggedPlanProduct, E as planCreditUnits, F as planQuotasBenefits, G as isFreePlan, H as zeroPrices, I as providerTrialOf, J as pushPlanTrial, K as attachPlanQuotas, L as BILLING_WEBHOOK_PROVISION_EVENTS, N as planProductKey, O as recordPlanProduct, Q as loadGenerated, R as renderGenerated, S as runEmailSync, T as runInboundSync, U as emailSyncLines, V as runEmailSyncCommand, W as probeWebhookRoute, X as emailSyncRefusal, Y as inboundSyncLines, Z as planSettingChanges, _ as planEndpointChanges, $ as applyProviderChanges, a0 as billingProviderTarget, a1 as providerClient, a2 as readProviderOrganization, a3 as readProviderEndpoint, a4 as ADMISSION_DAYS, a5 as CLI_ADMISSION_LABEL, a6 as admitInputRefusal, a7 as admitRefused, a8 as admitCleaned, a9 as runDoctorChecks, aa as readProductionPosture, ab as email, ac as runEnvDefaults, ad as firstAdministratorOnFix, ae as ENV_DEFAULT_TYPES } from './chunks/doctor.mjs';
8
8
  import { createInterface } from 'node:readline';
9
9
  import { webhooksResetWebhookEndpointSecret } from '@polar-sh/sdk/funcs/webhooksResetWebhookEndpointSecret.js';
10
- import { w as withContract, p as progress, f as finish, a as adoptBackendDevScript, d as dev } from './shared/nuxt-backend.Lk2MQI2u.mjs';
10
+ import { w as withContract, p as progress, f as finish, a as adoptBackendDevScript, d as dev } from './shared/nuxt-backend.CBvrM7pG.mjs';
11
11
  import { runAnalyze, halvesOf } from './chunks/run.mjs';
12
12
  import { f as formatReport, b as budgetFailures, a as formatSize, p as parseSize, B as BUDGET_FLAGS } from './chunks/report.mjs';
13
13
  import { tmpdir } from 'node:os';
@@ -28,12 +28,12 @@ import { organizationsListOrganizations } from '@polar-sh/sdk/funcs/organization
28
28
  import { randomBytes } from 'node:crypto';
29
29
  import { spawn } from 'node:child_process';
30
30
  import { Resend } from 'resend';
31
- import { f as fixConvexConfig } from './shared/nuxt-backend.D9qXcOOI.mjs';
31
+ import { setTimeout } from 'node:timers/promises';
32
+ import { f as fixConvexConfig } from './shared/nuxt-backend.DH1Ya3uB.mjs';
32
33
  import { isSandboxAddress, findCode } from '../dist/runtime/vue/utils/sandbox-code.js';
33
34
  import { styleText } from 'node:util';
34
35
  import { v } from 'convex/values';
35
36
  import { D as DARK_SCHEME_QUERY, t as textDirection } from './shared/nuxt-backend.C62dpRH3.mjs';
36
- import { setTimeout } from 'node:timers/promises';
37
37
  import 'node:url';
38
38
  import 'node:module';
39
39
  import 'dedent';
@@ -1262,14 +1262,15 @@ async function fixBilling(rootDir, { prod, confirm, print, report, probe }) {
1262
1262
  }
1263
1263
  }
1264
1264
  async function fixEmail(rootDir, { prod, confirm, print, report, probe, emailSync }) {
1265
- const read = await emailSync(rootDir, { prod, dryRun: true }).catch(() => null);
1265
+ const read = await emailSync(rootDir, { prod, dryRun: true, enableWebhook: true }).catch(() => null);
1266
1266
  const url = read?.webhook.url;
1267
1267
  if (!read || !url || read.webhook.enabled !== false) return;
1268
1268
  if ((await probe(url)).state !== "mounted") {
1269
1269
  print("[nuxt-backend] doctor --fix: the email webhook stays off: its route does not answer the probe yet. Fix the route (doctor's email-webhook-route), then run doctor --fix again.");
1270
1270
  return;
1271
1271
  }
1272
- const change = { description: `Turn the email webhook ${url} back on: its route answers the probe now.` };
1272
+ const alongside = read.log.length > 0 ? emailSyncPlans(read) : [];
1273
+ const change = { description: `Turn the email webhook ${url} back on: its route answers the probe now.${alongside.length > 0 ? ` The deployment runs an older backend, whose sync makes the rest with it: ${alongside.join(", ")}.` : ""}` };
1273
1274
  if (!await confirm(change)) {
1274
1275
  report.skipped.push("email-webhook-enabled");
1275
1276
  return;
@@ -1298,6 +1299,70 @@ async function fixProviderSettings(rootDir, { prod, confirm, print, billing = tr
1298
1299
  if (report.skipped.length > 0) print(`[nuxt-backend] doctor --fix: left as they are (not confirmed): ${report.skipped.join(", ")}.`);
1299
1300
  return report;
1300
1301
  }
1302
+ function emailSyncPlans(report) {
1303
+ const entries = report.log.filter((entry) => entry.action === "would-create" || entry.action === "would-update").map((entry) => `${entry.action === "would-create" ? "create" : "update"} the ${entry.kind} ${entry.key}`);
1304
+ const ids = (report.ids ?? []).map((id) => `store the provider's id for the ${id.kind} ${id.key} on the deployment`);
1305
+ const webhook = report.webhook.action === "would-create" ? [`create the webhook ${report.webhook.url} and store its signing secret on the deployment as EMAIL_WEBHOOK_SECRET`] : report.webhook.action === "would-update" ? [`give the webhook ${report.webhook.missingEvents.join(", ")}`] : [];
1306
+ const flows = (report.flows?.unsynced ?? []).map((flow) => `configure the flow ${flow}`);
1307
+ const retired = (report.flows?.retired ?? []).map((flow) => `stop the flow ${flow}, which backend/email.ts no longer declares`);
1308
+ return [...entries, ...ids, ...webhook, ...flows, ...retired];
1309
+ }
1310
+ function inboundSyncPlans(inbound, email) {
1311
+ const inbox = inbound.inbox === "would-create" ? [`create the support inbox ${inbound.support}`] : [];
1312
+ if (inbound.webhook.state === "would-update") return [...inbox, `give the webhook ${inbound.webhook.added.join(", ")}`];
1313
+ const madeFirst = inbound.support !== null && inbound.webhook.state === "missing" && email.webhook.action === "would-create";
1314
+ return [...inbox, ...madeFirst ? ["give the new webhook the support inbox's events"] : []];
1315
+ }
1316
+ async function planInboundSync(rootDir, prod, email, plan) {
1317
+ let inbound;
1318
+ try {
1319
+ inbound = await plan(rootDir, { prod, dryRun: true });
1320
+ } catch (error) {
1321
+ return { plans: [`sync the support inbox, which the deployment could not plan (${error instanceof Error ? error.message : String(error)})`], lines: [] };
1322
+ }
1323
+ if (!inbound) return { plans: [], lines: [] };
1324
+ return { plans: inboundSyncPlans(inbound, email), lines: inboundSyncLines(inbound) };
1325
+ }
1326
+ async function syncEmailOnFix(rootDir, { prod, confirm, print }, deps = {}) {
1327
+ const planned = await planEmailSync(rootDir, prod, print, deps.plan ?? runEmailSync);
1328
+ if (typeof planned === "string") return planned;
1329
+ const inbound = await planInboundSync(rootDir, prod, planned.report, deps.planInbound ?? runInboundSync);
1330
+ const plans = [...planned.plans, ...inbound.plans];
1331
+ if (plans.length === 0) {
1332
+ print("[nuxt-backend] doctor --fix: email sync: the email provider has what backend/email.ts declares.");
1333
+ return "unchanged";
1334
+ }
1335
+ for (const line of [...emailSyncLines(planned.report), ...inbound.lines]) print(line);
1336
+ const account = prod ? "production's email provider account" : "the dev email provider account";
1337
+ if (!await confirm({ description: `Sync ${account}: ${plans.join(", ")}.` })) return "declined";
1338
+ const { exitCode } = await (deps.apply ?? runEmailSyncCommand)(rootDir, { prod }, print);
1339
+ if (exitCode === 0) return "applied";
1340
+ print(`[nuxt-backend] doctor --fix: email sync failed: run \`npx nuxt-backend email sync${prod ? " --prod" : ""}\` for its full output.`);
1341
+ return "failed";
1342
+ }
1343
+ async function planEmailSync(rootDir, prod, print, plan) {
1344
+ const refusal = emailSyncRefusal(rootDir, prod);
1345
+ if (refusal) {
1346
+ print(`[nuxt-backend] doctor --fix: email sync refused: ${refusal}`);
1347
+ return "failed";
1348
+ }
1349
+ let report;
1350
+ try {
1351
+ report = await plan(rootDir, { prod, dryRun: true });
1352
+ } catch (error) {
1353
+ print(`[nuxt-backend] doctor --fix: email sync failed: ${error instanceof Error ? error.message : String(error)}`);
1354
+ return "failed";
1355
+ }
1356
+ if (!report) {
1357
+ print("[nuxt-backend] doctor --fix: email sync skipped: the deployment has no email:syncEmail.");
1358
+ return "skipped";
1359
+ }
1360
+ if (report.key !== "full") {
1361
+ for (const line of emailSyncLines(report)) print(line);
1362
+ return "skipped";
1363
+ }
1364
+ return { report, plans: emailSyncPlans(report) };
1365
+ }
1301
1366
  function changeConfirmation({ yes, interactive, ask, print }) {
1302
1367
  return async ({ description }) => {
1303
1368
  if (yes) return true;
@@ -1669,49 +1734,6 @@ const analyze = withContract("analyze", {
1669
1734
  }
1670
1735
  }));
1671
1736
 
1672
- const LOCKFILES = [
1673
- ["pnpm-lock.yaml", "pnpm"],
1674
- ["yarn.lock", "yarn"],
1675
- ["bun.lock", "bun"],
1676
- ["bun.lockb", "bun"],
1677
- ["package-lock.json", "npm"],
1678
- ["npm-shrinkwrap.json", "npm"]
1679
- ];
1680
- function pinned(dir) {
1681
- try {
1682
- const field = JSON.parse(readFileSync(join(dir, "package.json"), "utf8")).packageManager;
1683
- const name = typeof field === "string" ? field.split("@")[0] : void 0;
1684
- return LOCKFILES.find(([, manager]) => manager === name)?.[1] ?? null;
1685
- } catch {
1686
- return null;
1687
- }
1688
- }
1689
- function packageManagerOf(rootDir) {
1690
- let dir = rootDir;
1691
- for (; ; ) {
1692
- const manager = pinned(dir) ?? LOCKFILES.find(([file]) => existsSync(join(dir, file)))?.[1];
1693
- if (manager) return manager;
1694
- if (dir === dirname(dir) || existsSync(join(dir, ".git"))) return "npm";
1695
- dir = dirname(dir);
1696
- }
1697
- }
1698
- function runScript(manager, script) {
1699
- return `${manager} run ${script}`;
1700
- }
1701
- function execBinary(manager, binary) {
1702
- switch (manager) {
1703
- case "pnpm":
1704
- return `pnpm exec ${binary}`;
1705
- // Yarn 1 and Yarn Berry both run an installed binary by its name, Plug'n'Play too.
1706
- case "yarn":
1707
- return `yarn ${binary}`;
1708
- case "bun":
1709
- return `bunx ${binary}`;
1710
- default:
1711
- return `npx ${binary}`;
1712
- }
1713
- }
1714
-
1715
1737
  const BUILD_COMMAND = "npx convex deploy --cmd 'npm run build' --cmd-url-env-var-name NUXT_PUBLIC_BACKEND_URL";
1716
1738
  function isVercelLinked(rootDir) {
1717
1739
  return existsSync(join(rootDir, ".vercel", "project.json"));
@@ -1954,6 +1976,56 @@ async function catalogIdsStep(state, generated) {
1954
1976
  const code = await state.deps.backend.push();
1955
1977
  record(state, code === 0 ? { ...base, outcome: "done", detail: `billing sync wrote new ids: pushed the backend again, so production reads them. ${commit}` } : { ...base, outcome: "failed", detail: `billing sync wrote new ids, and npx convex deploy exited with code ${code}: run deploy again. ${commit}` });
1956
1978
  }
1979
+ const MIGRATE_BY_HAND = "npx nuxt-backend upgrade --prod --yes";
1980
+ function migrationsOutcome({ data, pools }, dryRun) {
1981
+ if (dryRun) return { outcome: "planned", detail: `${plannedMigrations(data)}, then start the workpool backfill on every pool` };
1982
+ const failed = failedMigrations(data);
1983
+ if (failed) return { outcome: "failed", detail: `${failed}: fix it, then run ${MIGRATE_BY_HAND}` };
1984
+ const unfinished = unfinishedMigrations({ data, pools });
1985
+ if (unfinished) return migrationsUnanswered(unfinished);
1986
+ return { outcome: "done", detail: `${migratedDetail(data)}; ${backfillDetail(pools)}` };
1987
+ }
1988
+ function migrationsUnanswered(reason) {
1989
+ return { outcome: "skipped", detail: `${reason}: the deploy goes on; run ${MIGRATE_BY_HAND} to finish them` };
1990
+ }
1991
+ const waiting = (data) => data.migrations.filter((migration) => migration.state !== "done").map((migration) => migration.name).join(", ");
1992
+ function plannedMigrations(data) {
1993
+ if (data.state === "done" || data.state === "none") return "no data migration left";
1994
+ if (data.state === "pending" || data.state === "running") return `would run ${waiting(data)}`;
1995
+ return "would run the package's data migrations once the backend is pushed";
1996
+ }
1997
+ function failedMigrations(data) {
1998
+ const failed = data.migrations.filter((migration) => migration.state === "failed");
1999
+ if (failed.length === 0) return void 0;
2000
+ return failed.map((migration) => `${migration.name} failed${migration.error ? ` (${migration.error})` : ""}`).join(", ");
2001
+ }
2002
+ function unfinishedMigrations({ data, pools }) {
2003
+ if (data.state === "failed" || data.state === "needs-push" || data.state === "skipped") return data.reason ?? "production did not answer the data migrations";
2004
+ if (pools.state === "failed") return `the workpool backfill was refused by ${pools.failed.map((pool) => `${pool.component} (${pool.reason})`).join(", ")}`;
2005
+ return void 0;
2006
+ }
2007
+ function migratedDetail(data) {
2008
+ if (data.state === "none") return "no data migration in this version";
2009
+ if (data.state === "running") return `${waiting(data)} still running on production's scheduler (${MIGRATE_BY_HAND} shows them finish)`;
2010
+ return "every data migration done";
2011
+ }
2012
+ function backfillDetail(pools) {
2013
+ if (pools.state === "started") return `the workpool backfill started on ${pools.pools.join(", ")}`;
2014
+ if (pools.state === "skipped") return `the workpool backfill not asked: ${pools.reason ?? "production did not list its components"}`;
2015
+ return "no pool needs the workpool backfill";
2016
+ }
2017
+ async function migrationsStep(state) {
2018
+ if (!state.deps.migrate) return;
2019
+ const base = { id: "data-migrations", capability: "data", title: "The data migrations" };
2020
+ if (!state.options.dryRun && !state.steps.some((step) => step.id === "backend" && step.outcome === "done")) {
2021
+ return record(state, { ...base, outcome: "skipped", detail: `they run on the backend this version pushes, which did not go up: run deploy again, or ${MIGRATE_BY_HAND} after the push` });
2022
+ }
2023
+ try {
2024
+ record(state, { ...base, ...migrationsOutcome(await state.deps.migrate({ dryRun: state.options.dryRun }), state.options.dryRun) });
2025
+ } catch (error) {
2026
+ record(state, { ...base, ...migrationsUnanswered(error instanceof Error ? error.message : String(error)) });
2027
+ }
2028
+ }
1957
2029
  async function emailEndpoint(state) {
1958
2030
  const url = state.url ?? (state.options.dryRun ? await state.deps.backend.url() : null);
1959
2031
  const site = state.deps.env.NUXT_PUBLIC_CONVEX_SITE_URL || (url ? siteFromCloudUrl(url) : null);
@@ -2064,6 +2136,7 @@ async function runDeploy(options, deps) {
2064
2136
  for (const step of ENV_STEPS) await step(state);
2065
2137
  await backendStep(state);
2066
2138
  await catalogIdsStep(state, await billingStep(state));
2139
+ await migrationsStep(state);
2067
2140
  await emailWebhookStep(state);
2068
2141
  await emailSyncStep(state);
2069
2142
  await appEnvStep(state);
@@ -2118,7 +2191,19 @@ async function runBuild(deps) {
2118
2191
  return 1;
2119
2192
  }
2120
2193
  }
2121
- return deps.convexDeploy(["deploy", "--cmd", buildCmd(preview, deps.env, deps.packageManager), "--cmd-url-env-var-name", "NUXT_PUBLIC_BACKEND_URL", ...preview ? previewRun(deps.env, deps.print) : []]);
2194
+ const code = await deps.convexDeploy(["deploy", "--cmd", buildCmd(preview, deps.env, deps.packageManager), "--cmd-url-env-var-name", "NUXT_PUBLIC_BACKEND_URL", ...preview ? previewRun(deps.env, deps.print) : []]);
2195
+ if (code !== 0 || preview || !deps.migrate) return code;
2196
+ return migrateProduction(deps.migrate, deps.print);
2197
+ }
2198
+ async function migrateProduction(migrate, print) {
2199
+ let outcome;
2200
+ try {
2201
+ outcome = migrationsOutcome(await migrate(), false);
2202
+ } catch (error) {
2203
+ outcome = migrationsUnanswered(error instanceof Error ? error.message : String(error));
2204
+ }
2205
+ print(`[nuxt-backend] deploy --build: the data migrations${outcome.outcome === "skipped" ? " (warning)" : ""}: ${outcome.detail}`);
2206
+ return outcome.outcome === "failed" ? 1 : 0;
2122
2207
  }
2123
2208
 
2124
2209
  const EMAIL_WEBHOOK_EVENTS = [
@@ -2167,6 +2252,127 @@ async function ensureEmailWebhook(apiKey, url, { dryRun = false, client } = {})
2167
2252
  return { action: "created", secret: created.data.signing_secret };
2168
2253
  }
2169
2254
 
2255
+ const PACKAGE_MIGRATIONS = [
2256
+ {
2257
+ name: "personalWorkspaces",
2258
+ table: "user",
2259
+ since: "0.2.0",
2260
+ does: "gives each signed-in user without a workspace the personal one their sign-in would have made"
2261
+ },
2262
+ {
2263
+ name: "activeWorkspaces",
2264
+ table: "session",
2265
+ since: "0.2.0",
2266
+ does: "activates a workspace on each live session that has none, so a signed-in user need not sign in again"
2267
+ }
2268
+ ];
2269
+
2270
+ const POOL_BACKFILL = "migrations:backfillPendingStartIds";
2271
+ const PROBE = "__nuxt_backend_component_listing__";
2272
+ const BATCH_WORKER = "batchWorker";
2273
+ const CONCURRENCY = 4;
2274
+ async function listComponents(rootDir, prod, run) {
2275
+ try {
2276
+ await run(rootDir, ["run", ...deploymentFlags({ prod }), "--component", PROBE, "--inline-query", "return null"], { timeout: 6e4 });
2277
+ } catch (error) {
2278
+ if (error instanceof ConvexCliError && error.components) return error.components;
2279
+ return { reason: `the deployment did not list its components: ${error instanceof Error ? error.message : String(error)}` };
2280
+ }
2281
+ return { reason: "the deployment did not list its components" };
2282
+ }
2283
+ async function backfill(rootDir, component, prod, run) {
2284
+ try {
2285
+ await run(rootDir, ["run", ...deploymentFlags({ prod }), "--component", component, POOL_BACKFILL, "{}"], { timeout: 6e4 });
2286
+ return "started";
2287
+ } catch (error) {
2288
+ if (error instanceof ConvexCliError && error.missingFunction) return "absent";
2289
+ return { reason: error instanceof Error ? error.message : String(error) };
2290
+ }
2291
+ }
2292
+ async function inBatches(items, limit, task) {
2293
+ const results = [];
2294
+ for (let start = 0; start < items.length; start += limit) {
2295
+ results.push(...await Promise.all(items.slice(start, start + limit).map(task)));
2296
+ }
2297
+ return results;
2298
+ }
2299
+ async function backfillPools(rootDir, { prod, dryRun }, run = runConvex) {
2300
+ if (dryRun) return { state: "pending", pools: [], failed: [], reason: `a dry run starts nothing: upgrade runs ${POOL_BACKFILL} on every workpool the deployment mounts` };
2301
+ const components = await listComponents(rootDir, prod, run);
2302
+ if (!Array.isArray(components)) return { state: "skipped", pools: [], failed: [], reason: components.reason };
2303
+ const candidates = components.filter((path) => path.split("/").at(-1) !== BATCH_WORKER);
2304
+ const answers = await inBatches(candidates, CONCURRENCY, (component) => backfill(rootDir, component, prod, run));
2305
+ const pools = candidates.filter((_, index) => answers[index] === "started");
2306
+ const failed = candidates.flatMap((component, index) => {
2307
+ const answer = answers[index];
2308
+ return typeof answer === "object" ? [{ component, reason: answer.reason }] : [];
2309
+ });
2310
+ return { state: failed.length > 0 ? "failed" : pools.length > 0 ? "started" : "none", pools, failed };
2311
+ }
2312
+
2313
+ const COMPONENT = "backend";
2314
+ function missingFunction(error) {
2315
+ const text = error instanceof ConvexCliError ? error.stderrTail : String(error);
2316
+ return /could not find function|•\s*[\w/.-]+:\w+/i.test(text);
2317
+ }
2318
+ async function call(rootDir, fn, prod) {
2319
+ const { stdout } = await runConvex(rootDir, ["run", "--component", COMPONENT, ...deploymentFlags({ prod }), `migrations:${fn}`, "{}"], { timeout: 6e4 });
2320
+ return JSON.parse(stdout);
2321
+ }
2322
+ function overall(migrations) {
2323
+ if (migrations.length === 0) return "none";
2324
+ if (migrations.some((migration) => migration.state === "failed")) return "failed";
2325
+ if (migrations.every((migration) => migration.state === "done")) return "done";
2326
+ return migrations.some((migration) => migration.state === "running") ? "running" : "pending";
2327
+ }
2328
+ function unread() {
2329
+ return PACKAGE_MIGRATIONS.map(({ name, since, does }) => ({ name, since, does, state: "pending", processed: 0 }));
2330
+ }
2331
+ const settled = (state) => state === "done" || state === "none" || state === "failed";
2332
+ async function readStatus(rootDir, options) {
2333
+ const deployment = options.prod ? "production" : "dev";
2334
+ if (!options.prod && !configuredDeployment(rootDir) && deployKeyType({ ...readEnvFiles(rootDir), ...process.env }) === null) {
2335
+ return { deployment, state: "skipped", reason: "no dev deployment is configured: `npx nuxt-backend dev` sets one up", migrations: unread() };
2336
+ }
2337
+ try {
2338
+ return await call(rootDir, "status", options.prod);
2339
+ } catch (error) {
2340
+ if (missingFunction(error)) return { deployment, state: "needs-push", reason: `the ${deployment} deployment runs a backend older than this version: push it first`, migrations: unread() };
2341
+ return { deployment, state: options.prod ? "failed" : "skipped", reason: `the ${deployment} deployment did not answer: ${error instanceof Error ? error.message : String(error)}`, migrations: unread() };
2342
+ }
2343
+ }
2344
+ async function follow(rootDir, started, options) {
2345
+ let migrations = started;
2346
+ const deadline = Date.now() + (options.wait ?? 12e4);
2347
+ while (!settled(overall(migrations)) && Date.now() < deadline) {
2348
+ options.print?.(`[nuxt-backend] ${options.command ?? "upgrade"}: ${migrations.filter((migration) => migration.state === "done").length} of ${migrations.length} package migrations done\u2026`);
2349
+ await setTimeout(options.interval ?? 1500);
2350
+ migrations = await call(rootDir, "status", options.prod).catch(() => migrations);
2351
+ }
2352
+ return migrations;
2353
+ }
2354
+ async function migrateData(rootDir, options) {
2355
+ const deployment = options.prod ? "production" : "dev";
2356
+ const status = await readStatus(rootDir, options);
2357
+ if (!Array.isArray(status)) return status;
2358
+ const before = overall(status);
2359
+ if (options.dryRun || before === "done" || before === "none") return { deployment, state: before, migrations: status };
2360
+ let started;
2361
+ try {
2362
+ started = await call(rootDir, "run", options.prod);
2363
+ } catch (error) {
2364
+ return { deployment, state: "failed", reason: `starting the migrations failed: ${error instanceof Error ? error.message : String(error)}`, migrations: status };
2365
+ }
2366
+ const migrations = await follow(rootDir, started, options);
2367
+ const state = overall(migrations);
2368
+ return { deployment, state: state === "pending" ? "running" : state, migrations };
2369
+ }
2370
+ async function migrateDeployment(rootDir, options) {
2371
+ const data = await migrateData(rootDir, options);
2372
+ const pools = data.state === "skipped" ? { state: "skipped", pools: [], failed: [], ...data.reason ? { reason: data.reason } : {} } : await backfillPools(rootDir, { prod: options.prod, dryRun: options.dryRun });
2373
+ return { data, pools };
2374
+ }
2375
+
2170
2376
  const HOST_KEY_NAME = "nuxt-backend-host";
2171
2377
  function deployKeyOf(output) {
2172
2378
  const key = output.split("\n").map((line) => line.trim()).reverse().find((line) => /^[\w-]+:[\w:-]+\|\S+$/.test(line));
@@ -2203,7 +2409,7 @@ const deploy = withContract("deploy", {
2203
2409
  1: "refused, a step failed, or `doctor --prod` fails"
2204
2410
  }
2205
2411
  }, defineCommand({
2206
- meta: { name: "deploy", description: "Take production from nothing to a passing doctor --prod: link or create the production deployment, push its env, push the backend, sync the billing catalog, register both webhooks, write the app's env into the Vercel project, then run doctor --prod. Safe to run again" },
2412
+ meta: { name: "deploy", description: "Take production from nothing to a passing doctor --prod: link or create the production deployment, push its env, push the backend, sync the billing catalog, run the package's data migrations, register both webhooks, write the app's env into the Vercel project, then run doctor --prod. Safe to run again" },
2207
2413
  args: {
2208
2414
  "cwd": { type: "string", description: "Project directory", default: "." },
2209
2415
  "dry-run": { type: "boolean", description: "Print every step it would take, and change nothing", default: false },
@@ -2220,7 +2426,8 @@ const deploy = withContract("deploy", {
2220
2426
  process.exitCode = 1;
2221
2427
  return;
2222
2428
  }
2223
- process.exitCode = await runBuild({ backend: convexBackend(rootDir, { json: false }), convexDeploy: (deployArgs) => spawnConvex(rootDir, deployArgs), env: process.env, packageManager: packageManagerOf(rootDir), print: (line) => console.error(line) });
2429
+ const print2 = (line) => console.error(line);
2430
+ process.exitCode = await runBuild({ backend: convexBackend(rootDir, { json: false }), convexDeploy: (deployArgs) => spawnConvex(rootDir, deployArgs), env: process.env, packageManager: packageManagerOf(rootDir), migrate: () => migrateDeployment(rootDir, { prod: true, dryRun: false, print: print2, command: "deploy --build" }), print: print2 });
2224
2431
  return;
2225
2432
  }
2226
2433
  const key = nonProductionDeployKey({ ...readEnvFiles(rootDir), ...process.env });
@@ -2239,6 +2446,7 @@ const deploy = withContract("deploy", {
2239
2446
  billingSync: (options) => runBillingSync(rootDir, options, { print }),
2240
2447
  emailWebhook: (apiKey, url, options) => ensureEmailWebhook(apiKey, url, options),
2241
2448
  emailSync: ({ dryRun }) => runEmailSync(rootDir, { prod: true, dryRun }),
2449
+ migrate: ({ dryRun }) => migrateDeployment(rootDir, { prod: true, dryRun, print, command: "deploy" }),
2242
2450
  doctor: () => runDoctorChecks(rootDir, { prod: true }),
2243
2451
  buildAdvice: host.kind === "vercel" ? buildCommandAdvice(rootDir) : null,
2244
2452
  print
@@ -2276,11 +2484,11 @@ function parseEnvPushArgs(rawArgs, args) {
2276
2484
  }
2277
2485
 
2278
2486
  async function repairProjectFiles(rootDir, print = () => {
2279
- }) {
2487
+ }, { configRoot = rootDir } = {}) {
2280
2488
  const written = scaffoldBackendFiles(rootDir, { log: print });
2281
2489
  const changes = await fixConvexConfig(rootDir);
2282
2490
  for (const change of changes) print(`[nuxt-backend] doctor --fix: ${change}`);
2283
- const config = await loadConfig(rootDir);
2491
+ const config = await loadConfig(configRoot);
2284
2492
  const source = config ? pathsSourceOf(config) : null;
2285
2493
  if (source && syncPathsFile(rootDir, backendPathsOf(source)) === "written") {
2286
2494
  const line = `${pathsFileLocation(rootDir).name} \u2192 the paths nuxt.config declares`;
@@ -2803,10 +3011,18 @@ ${note}`,
2803
3011
  };
2804
3012
  }
2805
3013
 
3014
+ const WHOLE_UNITS = "BIF CLP DJF GNF JPY KMF KRW MGA PYG RWF VND VUV XAF XOF XPF".split(" ");
3015
+ const THOUSANDTHS = "BHD JOD KWD OMR TND".split(" ");
3016
+ function minorUnitDigits(code) {
3017
+ return WHOLE_UNITS.includes(code) ? 0 : THOUSANDTHS.includes(code) ? 3 : 2;
3018
+ }
2806
3019
  function renewalReminder({ email, plan, amount, currency, interval, intervalCount, renewsAt, manageUrl }, context) {
2807
3020
  const { t } = context;
2808
3021
  const date = new Intl.DateTimeFormat(context.locale, { dateStyle: "long", timeZone: "UTC" }).format(renewsAt);
2809
- const price = new Intl.NumberFormat(context.locale, { style: "currency", currency: currency.toUpperCase() || "USD" }).format(amount / 100);
3022
+ const code = currency.toUpperCase() || "USD";
3023
+ const digits = minorUnitDigits(code);
3024
+ const shown = amount % 10 ** digits === 0 ? 0 : digits;
3025
+ const price = new Intl.NumberFormat(context.locale, { style: "currency", currency: code, minimumFractionDigits: shown, maximumFractionDigits: shown }).format(amount / 10 ** digits);
2810
3026
  const every = t(`email.renewalReminder.every.${interval === "day" || interval === "week" ? interval : "month"}`, { count: intervalCount });
2811
3027
  const intro = t("email.renewalReminder.intro", { plan, price, every, date });
2812
3028
  const cancel = t("email.renewalReminder.cancel");
@@ -3291,79 +3507,6 @@ const ejectCommand = withContract("eject", {
3291
3507
  }
3292
3508
  }));
3293
3509
 
3294
- const PACKAGE_MIGRATIONS = [
3295
- {
3296
- name: "personalWorkspaces",
3297
- table: "user",
3298
- since: "0.2.0",
3299
- does: "gives each signed-in user without a workspace the personal one their sign-in would have made"
3300
- },
3301
- {
3302
- name: "activeWorkspaces",
3303
- table: "session",
3304
- since: "0.2.0",
3305
- does: "activates a workspace on each live session that has none, so a signed-in user need not sign in again"
3306
- }
3307
- ];
3308
-
3309
- const COMPONENT = "backend";
3310
- function missingFunction(error) {
3311
- const text = error instanceof ConvexCliError ? error.stderrTail : String(error);
3312
- return /could not find function|•\s*[\w/.-]+:\w+/i.test(text);
3313
- }
3314
- async function call(rootDir, fn, prod) {
3315
- const { stdout } = await runConvex(rootDir, ["run", "--component", COMPONENT, ...deploymentFlags({ prod }), `migrations:${fn}`, "{}"], { timeout: 6e4 });
3316
- return JSON.parse(stdout);
3317
- }
3318
- function overall(migrations) {
3319
- if (migrations.length === 0) return "none";
3320
- if (migrations.some((migration) => migration.state === "failed")) return "failed";
3321
- if (migrations.every((migration) => migration.state === "done")) return "done";
3322
- return migrations.some((migration) => migration.state === "running") ? "running" : "pending";
3323
- }
3324
- function unread() {
3325
- return PACKAGE_MIGRATIONS.map(({ name, since, does }) => ({ name, since, does, state: "pending", processed: 0 }));
3326
- }
3327
- const settled = (state) => state === "done" || state === "none" || state === "failed";
3328
- async function readStatus(rootDir, options) {
3329
- const deployment = options.prod ? "production" : "dev";
3330
- if (!options.prod && !configuredDeployment(rootDir) && deployKeyType({ ...readEnvFiles(rootDir), ...process.env }) === null) {
3331
- return { deployment, state: "skipped", reason: "no dev deployment is configured: `npx nuxt-backend dev` sets one up", migrations: unread() };
3332
- }
3333
- try {
3334
- return await call(rootDir, "status", options.prod);
3335
- } catch (error) {
3336
- if (missingFunction(error)) return { deployment, state: "needs-push", reason: `the ${deployment} deployment runs a backend older than this version: push it first`, migrations: unread() };
3337
- return { deployment, state: options.prod ? "failed" : "skipped", reason: `the ${deployment} deployment did not answer: ${error instanceof Error ? error.message : String(error)}`, migrations: unread() };
3338
- }
3339
- }
3340
- async function follow(rootDir, started, options) {
3341
- let migrations = started;
3342
- const deadline = Date.now() + (options.wait ?? 12e4);
3343
- while (!settled(overall(migrations)) && Date.now() < deadline) {
3344
- options.print?.(`[nuxt-backend] upgrade: ${migrations.filter((migration) => migration.state === "done").length} of ${migrations.length} package migrations done\u2026`);
3345
- await setTimeout(options.interval ?? 1500);
3346
- migrations = await call(rootDir, "status", options.prod).catch(() => migrations);
3347
- }
3348
- return migrations;
3349
- }
3350
- async function migrateData(rootDir, options) {
3351
- const deployment = options.prod ? "production" : "dev";
3352
- const status = await readStatus(rootDir, options);
3353
- if (!Array.isArray(status)) return status;
3354
- const before = overall(status);
3355
- if (options.dryRun || before === "done" || before === "none") return { deployment, state: before, migrations: status };
3356
- let started;
3357
- try {
3358
- started = await call(rootDir, "run", options.prod);
3359
- } catch (error) {
3360
- return { deployment, state: "failed", reason: `starting the migrations failed: ${error instanceof Error ? error.message : String(error)}`, migrations: status };
3361
- }
3362
- const migrations = await follow(rootDir, started, options);
3363
- const state = overall(migrations);
3364
- return { deployment, state: state === "pending" ? "running" : state, migrations };
3365
- }
3366
-
3367
3510
  const MAX_CELLS = 4e6;
3368
3511
  function subsequences(left, right) {
3369
3512
  const width = right.length + 1;
@@ -3509,49 +3652,6 @@ function formatUpgrade(report) {
3509
3652
  ];
3510
3653
  }
3511
3654
 
3512
- const POOL_BACKFILL = "migrations:backfillPendingStartIds";
3513
- const PROBE = "__nuxt_backend_component_listing__";
3514
- const BATCH_WORKER = "batchWorker";
3515
- const CONCURRENCY = 4;
3516
- async function listComponents(rootDir, prod, run) {
3517
- try {
3518
- await run(rootDir, ["run", ...deploymentFlags({ prod }), "--component", PROBE, "--inline-query", "return null"], { timeout: 6e4 });
3519
- } catch (error) {
3520
- if (error instanceof ConvexCliError && error.components) return error.components;
3521
- return { reason: `the deployment did not list its components: ${error instanceof Error ? error.message : String(error)}` };
3522
- }
3523
- return { reason: "the deployment did not list its components" };
3524
- }
3525
- async function backfill(rootDir, component, prod, run) {
3526
- try {
3527
- await run(rootDir, ["run", ...deploymentFlags({ prod }), "--component", component, POOL_BACKFILL, "{}"], { timeout: 6e4 });
3528
- return "started";
3529
- } catch (error) {
3530
- if (error instanceof ConvexCliError && error.missingFunction) return "absent";
3531
- return { reason: error instanceof Error ? error.message : String(error) };
3532
- }
3533
- }
3534
- async function inBatches(items, limit, task) {
3535
- const results = [];
3536
- for (let start = 0; start < items.length; start += limit) {
3537
- results.push(...await Promise.all(items.slice(start, start + limit).map(task)));
3538
- }
3539
- return results;
3540
- }
3541
- async function backfillPools(rootDir, { prod, dryRun }, run = runConvex) {
3542
- if (dryRun) return { state: "pending", pools: [], failed: [], reason: `a dry run starts nothing: upgrade runs ${POOL_BACKFILL} on every workpool the deployment mounts` };
3543
- const components = await listComponents(rootDir, prod, run);
3544
- if (!Array.isArray(components)) return { state: "skipped", pools: [], failed: [], reason: components.reason };
3545
- const candidates = components.filter((path) => path.split("/").at(-1) !== BATCH_WORKER);
3546
- const answers = await inBatches(candidates, CONCURRENCY, (component) => backfill(rootDir, component, prod, run));
3547
- const pools = candidates.filter((_, index) => answers[index] === "started");
3548
- const failed = candidates.flatMap((component, index) => {
3549
- const answer = answers[index];
3550
- return typeof answer === "object" ? [{ component, reason: answer.reason }] : [];
3551
- });
3552
- return { state: failed.length > 0 ? "failed" : pools.length > 0 ? "started" : "none", pools, failed };
3553
- }
3554
-
3555
3655
  function filesUnder(dir, prefix = "") {
3556
3656
  if (!existsSync(dir)) return [];
3557
3657
  return readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
@@ -3582,7 +3682,7 @@ async function planRepairs(rootDir) {
3582
3682
  const scratch = projectCopy(scratchDir, rootDir, functionsDir);
3583
3683
  if (!scratch) return { written: [], changes: [`${functionsDir}: on another drive, which the dry run cannot copy; \`npx nuxt-backend doctor\` names what the repairs would change`], files: [] };
3584
3684
  copyProject(rootDir, scratch, functionsDir);
3585
- const { written, changes } = await repairProjectFiles(scratch);
3685
+ const { written, changes } = await repairProjectFiles(scratch, void 0, { configRoot: rootDir });
3586
3686
  const files = [...filesUnder(join(scratch, functionsDir), `${functionsDir}/`), "convex.json", "package.json"].flatMap((path) => {
3587
3687
  if (!existsSync(join(scratch, path))) return [];
3588
3688
  const after = readFileSync(join(scratch, path), "utf-8");
@@ -3616,8 +3716,7 @@ async function runUpgrade(rootDir, options) {
3616
3716
  }
3617
3717
  const ejected = await ejectedChanges(rootDir);
3618
3718
  options.print(`[nuxt-backend] upgrade: the package's data migrations, ${options.prod ? "production" : "dev"} deployment\u2026`);
3619
- const data = await migrateData(rootDir, { prod: options.prod, dryRun: options.dryRun, print: options.print });
3620
- const pools = data.state === "skipped" ? { state: "skipped", pools: [], failed: [], ...data.reason ? { reason: data.reason } : {} } : await backfillPools(rootDir, { prod: options.prod, dryRun: options.dryRun });
3719
+ const { data, pools } = await migrateDeployment(rootDir, { prod: options.prod, dryRun: options.dryRun, print: options.print });
3621
3720
  const report = { to, dryRun: options.dryRun, scaffold, ejected, data, pools };
3622
3721
  return { ...report, next: nextCommands(rootDir, report, options.prod) };
3623
3722
  }
@@ -3714,7 +3813,7 @@ function refreshAgentFiles(rootDir, json, print) {
3714
3813
  const { agentsMd, mcpJson, skills, messages, mcpSdkDependency } = setUpAgentFiles(rootDir, true, print);
3715
3814
  if (agentsMd === "malformed") process.exitCode = 1;
3716
3815
  if (messages.length === 0 && !mcpSdkDependency) print(`[nuxt-backend] AGENTS.md, .mcp.json and the agent skills are current for nuxt-backend ${installedVersion(rootDir)}`);
3717
- if (mcpSdkDependency) print(`[nuxt-backend] Run \`npm install\` to link it, then restart your agent.`);
3816
+ if (mcpSdkDependency) print(`[nuxt-backend] Run \`${installCommand(packageManagerOf(rootDir))}\` to link it, then restart your agent.`);
3718
3817
  if (json) {
3719
3818
  const report = { agentsMd, mcpJson, skills, mcpSdkDependency };
3720
3819
  console.log(JSON.stringify(report, null, 2));
@@ -3743,17 +3842,17 @@ const init = withContract("init", {
3743
3842
  refreshAgentFiles(rootDir, args.json, print);
3744
3843
  return;
3745
3844
  }
3746
- const { start, ...setup } = setUpProject(rootDir, { force: args.force, agents: args.agents !== false, print });
3845
+ const { start, packageManager, ...setup } = setUpProject(rootDir, { force: args.force, agents: args.agents !== false, print });
3747
3846
  if (setup.agentsMd === "malformed") process.exitCode = 1;
3748
3847
  const listed = await addModuleToNuxtConfig(rootDir);
3749
3848
  print(listed ? "[nuxt-backend] Added 'nuxt-backend' to nuxt.config modules" : "[nuxt-backend] Add the module yourself: modules: ['nuxt-backend'] in nuxt.config.ts");
3750
3849
  if (args.json) {
3751
- const report = { ...setup, nuxtConfig: listed ? "listed" : "manual", next: nextCommands$1({ ...setup, start }) };
3850
+ const report = { ...setup, nuxtConfig: listed ? "listed" : "manual", next: nextCommands$1({ ...setup, packageManager, start }) };
3752
3851
  console.log(JSON.stringify(report, null, 2));
3753
3852
  return;
3754
3853
  }
3755
3854
  console.log(`
3756
- ${formatNextSteps({ ...setup, start })}
3855
+ ${formatNextSteps({ ...setup, packageManager, start })}
3757
3856
  `);
3758
3857
  }
3759
3858
  }));
@@ -3766,13 +3865,16 @@ async function repairProject(rootDir, prod, print, { interactive, yes, only }) {
3766
3865
  }
3767
3866
  print(`[nuxt-backend] doctor --fix: env push \u2192 ${run.deployment ?? "deployment"}`);
3768
3867
  reportEnvPush(run, { json: false, dryRun: false, print });
3769
- if (interactive) await bootstrapAdmin(rootDir, { prod, ask: askOnTerminal, print });
3770
- print("[nuxt-backend] doctor --fix: email sync");
3771
- await runEmailSyncCommand(rootDir, { prod }, print);
3868
+ await firstAdministratorOnFix(rootDir, { prod, interactive, ask: askOnTerminal, print });
3869
+ const confirm = changeConfirmation({ yes, interactive, ask: askOnTerminal, print });
3772
3870
  const wanted = (capability) => !only || only.length === 0 || only.includes(capability);
3871
+ if (wanted("email")) {
3872
+ print("[nuxt-backend] doctor --fix: email sync");
3873
+ if (await syncEmailOnFix(rootDir, { prod, confirm, print }) === "failed") process.exitCode = 1;
3874
+ }
3773
3875
  if (wanted("billing") || wanted("email")) {
3774
3876
  print("[nuxt-backend] doctor --fix: provider settings");
3775
- await fixProviderSettings(rootDir, { prod, confirm: changeConfirmation({ yes, interactive, ask: askOnTerminal, print }), print, billing: wanted("billing"), email: wanted("email") });
3877
+ await fixProviderSettings(rootDir, { prod, confirm, print, billing: wanted("billing"), email: wanted("email") });
3776
3878
  }
3777
3879
  const set = run.results.filter((result) => result.outcome === "set").map((result) => result.action.name);
3778
3880
  return [.../* @__PURE__ */ new Set([...run.deployedNames, ...set])];
@@ -3930,15 +4032,15 @@ const doctor = withContract("doctor", {
3930
4032
  json: "`{ $schema, findings, summary }`, described by https://nuxt-backend.dev/schemas/doctor.json; with `--fix`, the repair's progress goes to stderr",
3931
4033
  exitCodes: {
3932
4034
  0: "no finding failed (warnings allowed)",
3933
- 1: "a finding failed, or the flags were refused"
4035
+ 1: "a finding failed, the flags were refused, or with `--fix`, `email sync` was refused or failed"
3934
4036
  }
3935
4037
  }, defineCommand({
3936
4038
  meta: { name: "doctor", description: "Check the project + deployment configuration" },
3937
4039
  args: {
3938
4040
  ...cwdArg,
3939
4041
  json: { type: "boolean", description: "Machine-readable output", default: false },
3940
- fix: { type: "boolean", description: "Repair what doctor can: restore missing scaffold files, add missing mounts and routes, push env (`env push`), at a terminal make the first administrator, and apply the provider settings the billing findings recommend and turn a webhook endpoint back on, each after you confirm it", default: false },
3941
- yes: { type: "boolean", description: "With --fix: apply the provider changes without asking (for a script or CI)", default: false },
4042
+ fix: { type: "boolean", description: "Repair what doctor can: restore missing scaffold files, add missing mounts and routes, push env (`env push`), at a terminal make the first administrator, then, each after you confirm it, run `email sync`, apply the provider settings the billing findings recommend and turn a webhook endpoint back on", default: false },
4043
+ yes: { type: "boolean", description: "With --fix: run `email sync` and apply the provider changes without asking (for a script or CI; without it and without a terminal, they are listed and skipped)", default: false },
3942
4044
  prod: { type: "boolean", description: "Check the production deployment: missing email/billing config becomes a failure, its switches and email are read, and its live site is probed", default: false },
3943
4045
  only: { type: "string", description: `Check only these capabilities, comma-separated: ${CAPABILITY_NAMES.join(", ")}` }
3944
4046
  },