nuxt-backend 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1017) hide show
  1. package/README.md +17 -6
  2. package/dist/capabilities/detect.js +16 -7
  3. package/dist/capabilities/gateway-route.js +24 -0
  4. package/dist/capabilities/registry.js +3 -2
  5. package/dist/capabilities/status.js +3 -1
  6. package/dist/chunks/catalog.mjs +1 -1
  7. package/dist/chunks/doctor.mjs +565 -75
  8. package/dist/chunks/email-previews.mjs +1 -1
  9. package/dist/chunks/health.mjs +2 -2
  10. package/dist/chunks/index.mjs +3 -3
  11. package/dist/chunks/install.mjs +4 -4
  12. package/dist/chunks/run.mjs +1 -1
  13. package/dist/chunks/server.mjs +10 -6
  14. package/dist/cli.mjs +509 -55
  15. package/dist/convex/access-tickets.d.ts +20 -1
  16. package/dist/convex/access-tickets.d.ts.map +1 -1
  17. package/dist/convex/access-tickets.js +28 -0
  18. package/dist/convex/access-tickets.js.map +1 -1
  19. package/dist/convex/account-data.d.ts +25 -5
  20. package/dist/convex/account-data.d.ts.map +1 -1
  21. package/dist/convex/account-data.js +26 -7
  22. package/dist/convex/account-data.js.map +1 -1
  23. package/dist/convex/app.d.ts +15 -2
  24. package/dist/convex/app.d.ts.map +1 -1
  25. package/dist/convex/app.js +16 -2
  26. package/dist/convex/app.js.map +1 -1
  27. package/dist/convex/billing-launch.d.ts +36 -0
  28. package/dist/convex/billing-launch.d.ts.map +1 -0
  29. package/dist/convex/billing-launch.js +18 -0
  30. package/dist/convex/billing-launch.js.map +1 -0
  31. package/dist/convex/catalog.d.ts +38 -2
  32. package/dist/convex/catalog.d.ts.map +1 -1
  33. package/dist/convex/catalog.js.map +1 -1
  34. package/dist/convex/client/better-auth-options.d.ts.map +1 -1
  35. package/dist/convex/client/better-auth-options.js +11 -1
  36. package/dist/convex/client/better-auth-options.js.map +1 -1
  37. package/dist/convex/client/client-address.d.ts +21 -0
  38. package/dist/convex/client/client-address.d.ts.map +1 -0
  39. package/dist/convex/client/client-address.js +37 -0
  40. package/dist/convex/client/client-address.js.map +1 -0
  41. package/dist/convex/client/code-binding.js +1 -1
  42. package/dist/convex/client/component.d.ts.map +1 -1
  43. package/dist/convex/client/guards.js +3 -3
  44. package/dist/convex/client/guards.js.map +1 -1
  45. package/dist/convex/client/index.d.ts +128 -42
  46. package/dist/convex/client/index.d.ts.map +1 -1
  47. package/dist/convex/client/index.js +4 -3
  48. package/dist/convex/client/index.js.map +1 -1
  49. package/dist/convex/client/plugins.d.ts +67 -30
  50. package/dist/convex/client/plugins.d.ts.map +1 -1
  51. package/dist/convex/client/plugins.js +43 -19
  52. package/dist/convex/client/plugins.js.map +1 -1
  53. package/dist/convex/components/backend/_generated/api.d.ts +2 -0
  54. package/dist/convex/components/backend/_generated/api.d.ts.map +1 -1
  55. package/dist/convex/components/backend/_generated/api.js.map +1 -1
  56. package/dist/convex/components/backend/_generated/component.d.ts +460 -4
  57. package/dist/convex/components/backend/_generated/component.d.ts.map +1 -1
  58. package/dist/convex/components/backend/access.d.ts +47 -6
  59. package/dist/convex/components/backend/access.d.ts.map +1 -1
  60. package/dist/convex/components/backend/access.js +108 -16
  61. package/dist/convex/components/backend/access.js.map +1 -1
  62. package/dist/convex/components/backend/account.d.ts +12 -6
  63. package/dist/convex/components/backend/account.d.ts.map +1 -1
  64. package/dist/convex/components/backend/account.js +55 -4
  65. package/dist/convex/components/backend/account.js.map +1 -1
  66. package/dist/convex/components/backend/adapter.d.ts +1 -1
  67. package/dist/convex/components/backend/adapter.d.ts.map +1 -1
  68. package/dist/convex/components/backend/adapter.js +5 -2
  69. package/dist/convex/components/backend/adapter.js.map +1 -1
  70. package/dist/convex/components/backend/ai.d.ts +11 -3
  71. package/dist/convex/components/backend/ai.d.ts.map +1 -1
  72. package/dist/convex/components/backend/ai.js +18 -52
  73. package/dist/convex/components/backend/ai.js.map +1 -1
  74. package/dist/convex/components/backend/billing.d.ts +22 -1
  75. package/dist/convex/components/backend/billing.d.ts.map +1 -1
  76. package/dist/convex/components/backend/billing.js +89 -44
  77. package/dist/convex/components/backend/billing.js.map +1 -1
  78. package/dist/convex/components/backend/consents.d.ts.map +1 -1
  79. package/dist/convex/components/backend/consents.js +2 -1
  80. package/dist/convex/components/backend/consents.js.map +1 -1
  81. package/dist/convex/components/backend/costs.d.ts +1 -1
  82. package/dist/convex/components/backend/crons.d.ts.map +1 -1
  83. package/dist/convex/components/backend/crons.js +3 -0
  84. package/dist/convex/components/backend/crons.js.map +1 -1
  85. package/dist/convex/components/backend/funnel.d.ts +2 -2
  86. package/dist/convex/components/backend/gifts.d.ts +3 -3
  87. package/dist/convex/components/backend/gifts.d.ts.map +1 -1
  88. package/dist/convex/components/backend/gifts.js +11 -6
  89. package/dist/convex/components/backend/gifts.js.map +1 -1
  90. package/dist/convex/components/backend/jobs.d.ts +53 -10
  91. package/dist/convex/components/backend/jobs.d.ts.map +1 -1
  92. package/dist/convex/components/backend/jobs.js +58 -13
  93. package/dist/convex/components/backend/jobs.js.map +1 -1
  94. package/dist/convex/components/backend/lifecycle.d.ts.map +1 -1
  95. package/dist/convex/components/backend/lifecycle.js +18 -14
  96. package/dist/convex/components/backend/lifecycle.js.map +1 -1
  97. package/dist/convex/components/backend/maintenance.d.ts +2 -2
  98. package/dist/convex/components/backend/maintenance.d.ts.map +1 -1
  99. package/dist/convex/components/backend/maintenance.js +11 -1
  100. package/dist/convex/components/backend/maintenance.js.map +1 -1
  101. package/dist/convex/components/backend/moderation.d.ts +94 -0
  102. package/dist/convex/components/backend/moderation.d.ts.map +1 -0
  103. package/dist/convex/components/backend/moderation.js +53 -0
  104. package/dist/convex/components/backend/moderation.js.map +1 -0
  105. package/dist/convex/components/backend/notifications.d.ts +13 -0
  106. package/dist/convex/components/backend/notifications.d.ts.map +1 -1
  107. package/dist/convex/components/backend/notifications.js +21 -0
  108. package/dist/convex/components/backend/notifications.js.map +1 -1
  109. package/dist/convex/components/backend/referrals.d.ts.map +1 -1
  110. package/dist/convex/components/backend/referrals.js +13 -16
  111. package/dist/convex/components/backend/referrals.js.map +1 -1
  112. package/dist/convex/components/backend/reports.js +7 -7
  113. package/dist/convex/components/backend/reports.js.map +1 -1
  114. package/dist/convex/components/backend/schema.d.ts +548 -59
  115. package/dist/convex/components/backend/schema.d.ts.map +1 -1
  116. package/dist/convex/components/backend/schema.js +233 -155
  117. package/dist/convex/components/backend/schema.js.map +1 -1
  118. package/dist/convex/components/backend/storage.d.ts +19 -0
  119. package/dist/convex/components/backend/storage.d.ts.map +1 -1
  120. package/dist/convex/components/backend/storage.js +67 -10
  121. package/dist/convex/components/backend/storage.js.map +1 -1
  122. package/dist/convex/components/backend/subscriptions.d.ts +4 -4
  123. package/dist/convex/components/backend/subscriptions.d.ts.map +1 -1
  124. package/dist/convex/components/backend/subscriptions.js +7 -36
  125. package/dist/convex/components/backend/subscriptions.js.map +1 -1
  126. package/dist/convex/components/backend/waitlist.d.ts +1 -1
  127. package/dist/convex/components/backend/webhooks.d.ts +0 -1
  128. package/dist/convex/components/backend/webhooks.d.ts.map +1 -1
  129. package/dist/convex/components/backend/webhooks.js +1 -1
  130. package/dist/convex/components/backend/webhooks.js.map +1 -1
  131. package/dist/convex/consent-rules.d.ts +0 -2
  132. package/dist/convex/consent-rules.d.ts.map +1 -1
  133. package/dist/convex/consent-rules.js.map +1 -1
  134. package/dist/convex/constants.d.ts +19 -5
  135. package/dist/convex/constants.d.ts.map +1 -1
  136. package/dist/convex/constants.js +19 -5
  137. package/dist/convex/constants.js.map +1 -1
  138. package/dist/convex/email-templates.d.ts +56 -7
  139. package/dist/convex/email-templates.d.ts.map +1 -1
  140. package/dist/convex/email-templates.js +69 -15
  141. package/dist/convex/email-templates.js.map +1 -1
  142. package/dist/convex/emails/notification.d.ts +9 -0
  143. package/dist/convex/emails/notification.d.ts.map +1 -0
  144. package/dist/convex/emails/notification.js +21 -0
  145. package/dist/convex/emails/notification.js.map +1 -0
  146. package/dist/convex/errors.d.ts +8 -3
  147. package/dist/convex/errors.d.ts.map +1 -1
  148. package/dist/convex/errors.js +55 -7
  149. package/dist/convex/errors.js.map +1 -1
  150. package/dist/convex/events.d.ts +4 -4
  151. package/dist/convex/events.js +4 -4
  152. package/dist/convex/events.js.map +1 -1
  153. package/dist/convex/files.d.ts +30 -4
  154. package/dist/convex/files.d.ts.map +1 -1
  155. package/dist/convex/files.js +44 -6
  156. package/dist/convex/files.js.map +1 -1
  157. package/dist/convex/integrations/account.d.ts +7 -0
  158. package/dist/convex/integrations/account.d.ts.map +1 -1
  159. package/dist/convex/integrations/account.js +2 -0
  160. package/dist/convex/integrations/account.js.map +1 -1
  161. package/dist/convex/integrations/admin.d.ts +2 -1
  162. package/dist/convex/integrations/admin.d.ts.map +1 -1
  163. package/dist/convex/integrations/admin.js.map +1 -1
  164. package/dist/convex/integrations/ai/chat.js +9 -9
  165. package/dist/convex/integrations/ai/chat.js.map +1 -1
  166. package/dist/convex/integrations/ai/config.d.ts +157 -37
  167. package/dist/convex/integrations/ai/config.d.ts.map +1 -1
  168. package/dist/convex/integrations/ai/context.d.ts +3 -0
  169. package/dist/convex/integrations/ai/context.d.ts.map +1 -1
  170. package/dist/convex/integrations/ai/context.js +4 -3
  171. package/dist/convex/integrations/ai/context.js.map +1 -1
  172. package/dist/convex/integrations/ai/costs.d.ts.map +1 -1
  173. package/dist/convex/integrations/ai/costs.js +49 -2
  174. package/dist/convex/integrations/ai/costs.js.map +1 -1
  175. package/dist/convex/integrations/ai/embeddings.d.ts +6 -6
  176. package/dist/convex/integrations/ai/embeddings.d.ts.map +1 -1
  177. package/dist/convex/integrations/ai/embeddings.js +17 -30
  178. package/dist/convex/integrations/ai/embeddings.js.map +1 -1
  179. package/dist/convex/integrations/ai/images.d.ts +25 -0
  180. package/dist/convex/integrations/ai/images.d.ts.map +1 -0
  181. package/dist/convex/integrations/ai/images.js +104 -0
  182. package/dist/convex/integrations/ai/images.js.map +1 -0
  183. package/dist/convex/integrations/ai/job-errors.d.ts +19 -0
  184. package/dist/convex/integrations/ai/job-errors.d.ts.map +1 -1
  185. package/dist/convex/integrations/ai/job-errors.js +40 -2
  186. package/dist/convex/integrations/ai/job-errors.js.map +1 -1
  187. package/dist/convex/integrations/ai/jobs.d.ts +176 -10
  188. package/dist/convex/integrations/ai/jobs.d.ts.map +1 -1
  189. package/dist/convex/integrations/ai/jobs.js +336 -70
  190. package/dist/convex/integrations/ai/jobs.js.map +1 -1
  191. package/dist/convex/integrations/ai/knowledge.d.ts.map +1 -1
  192. package/dist/convex/integrations/ai/knowledge.js +10 -11
  193. package/dist/convex/integrations/ai/knowledge.js.map +1 -1
  194. package/dist/convex/integrations/ai/metering.d.ts +26 -4
  195. package/dist/convex/integrations/ai/metering.d.ts.map +1 -1
  196. package/dist/convex/integrations/ai/metering.js +91 -35
  197. package/dist/convex/integrations/ai/metering.js.map +1 -1
  198. package/dist/convex/integrations/ai/model-id.d.ts +14 -1
  199. package/dist/convex/integrations/ai/model-id.d.ts.map +1 -1
  200. package/dist/convex/integrations/ai/model-id.js +24 -2
  201. package/dist/convex/integrations/ai/model-id.js.map +1 -1
  202. package/dist/convex/integrations/ai/models.d.ts +103 -20
  203. package/dist/convex/integrations/ai/models.d.ts.map +1 -1
  204. package/dist/convex/integrations/ai/models.js +223 -46
  205. package/dist/convex/integrations/ai/models.js.map +1 -1
  206. package/dist/convex/integrations/ai/moderation-providers.d.ts +136 -0
  207. package/dist/convex/integrations/ai/moderation-providers.d.ts.map +1 -0
  208. package/dist/convex/integrations/ai/moderation-providers.js +277 -0
  209. package/dist/convex/integrations/ai/moderation-providers.js.map +1 -0
  210. package/dist/convex/integrations/ai/moderation-taxonomy.d.ts +54 -0
  211. package/dist/convex/integrations/ai/moderation-taxonomy.d.ts.map +1 -0
  212. package/dist/convex/integrations/ai/moderation-taxonomy.js +141 -0
  213. package/dist/convex/integrations/ai/moderation-taxonomy.js.map +1 -0
  214. package/dist/convex/integrations/ai/moderation.d.ts +220 -19
  215. package/dist/convex/integrations/ai/moderation.d.ts.map +1 -1
  216. package/dist/convex/integrations/ai/moderation.js +388 -39
  217. package/dist/convex/integrations/ai/moderation.js.map +1 -1
  218. package/dist/convex/integrations/ai/provenance.d.ts +6 -0
  219. package/dist/convex/integrations/ai/provenance.d.ts.map +1 -1
  220. package/dist/convex/integrations/ai/provenance.js +4 -1
  221. package/dist/convex/integrations/ai/provenance.js.map +1 -1
  222. package/dist/convex/integrations/ai/setup.js +5 -5
  223. package/dist/convex/integrations/ai/setup.js.map +1 -1
  224. package/dist/convex/integrations/ai/stream.d.ts +1 -1
  225. package/dist/convex/integrations/ai/stream.d.ts.map +1 -1
  226. package/dist/convex/integrations/ai/stream.js +6 -12
  227. package/dist/convex/integrations/ai/stream.js.map +1 -1
  228. package/dist/convex/integrations/ai.d.ts +15 -8
  229. package/dist/convex/integrations/ai.d.ts.map +1 -1
  230. package/dist/convex/integrations/ai.js +4 -1
  231. package/dist/convex/integrations/ai.js.map +1 -1
  232. package/dist/convex/integrations/billing/checkout.d.ts +1 -1
  233. package/dist/convex/integrations/billing/checkout.d.ts.map +1 -1
  234. package/dist/convex/integrations/billing/checkout.js +4 -4
  235. package/dist/convex/integrations/billing/checkout.js.map +1 -1
  236. package/dist/convex/integrations/billing/context.d.ts +8 -1
  237. package/dist/convex/integrations/billing/context.d.ts.map +1 -1
  238. package/dist/convex/integrations/billing/context.js +21 -5
  239. package/dist/convex/integrations/billing/context.js.map +1 -1
  240. package/dist/convex/integrations/billing/credits.d.ts +6 -0
  241. package/dist/convex/integrations/billing/credits.d.ts.map +1 -1
  242. package/dist/convex/integrations/billing/credits.js +21 -6
  243. package/dist/convex/integrations/billing/credits.js.map +1 -1
  244. package/dist/convex/integrations/billing/customers.d.ts.map +1 -1
  245. package/dist/convex/integrations/billing/customers.js +25 -5
  246. package/dist/convex/integrations/billing/customers.js.map +1 -1
  247. package/dist/convex/integrations/billing/features.d.ts.map +1 -1
  248. package/dist/convex/integrations/billing/free-plan.d.ts +42 -2
  249. package/dist/convex/integrations/billing/free-plan.d.ts.map +1 -1
  250. package/dist/convex/integrations/billing/free-plan.js +110 -33
  251. package/dist/convex/integrations/billing/free-plan.js.map +1 -1
  252. package/dist/convex/integrations/billing/functions.d.ts +11 -3
  253. package/dist/convex/integrations/billing/functions.d.ts.map +1 -1
  254. package/dist/convex/integrations/billing/functions.js +33 -12
  255. package/dist/convex/integrations/billing/functions.js.map +1 -1
  256. package/dist/convex/integrations/billing/gifts.d.ts +4 -0
  257. package/dist/convex/integrations/billing/gifts.d.ts.map +1 -1
  258. package/dist/convex/integrations/billing/gifts.js +39 -8
  259. package/dist/convex/integrations/billing/gifts.js.map +1 -1
  260. package/dist/convex/integrations/billing/history.d.ts.map +1 -1
  261. package/dist/convex/integrations/billing/history.js +3 -1
  262. package/dist/convex/integrations/billing/history.js.map +1 -1
  263. package/dist/convex/integrations/billing/lifecycle.d.ts +13 -4
  264. package/dist/convex/integrations/billing/lifecycle.d.ts.map +1 -1
  265. package/dist/convex/integrations/billing/lifecycle.js +47 -7
  266. package/dist/convex/integrations/billing/lifecycle.js.map +1 -1
  267. package/dist/convex/integrations/billing/passes.d.ts +0 -2
  268. package/dist/convex/integrations/billing/passes.d.ts.map +1 -1
  269. package/dist/convex/integrations/billing/passes.js +4 -5
  270. package/dist/convex/integrations/billing/passes.js.map +1 -1
  271. package/dist/convex/integrations/billing/pricing.d.ts +12 -2
  272. package/dist/convex/integrations/billing/pricing.d.ts.map +1 -1
  273. package/dist/convex/integrations/billing/pricing.js +48 -12
  274. package/dist/convex/integrations/billing/pricing.js.map +1 -1
  275. package/dist/convex/integrations/billing/purchase.d.ts.map +1 -1
  276. package/dist/convex/integrations/billing/purchase.js +1 -2
  277. package/dist/convex/integrations/billing/purchase.js.map +1 -1
  278. package/dist/convex/integrations/billing/quotas.d.ts.map +1 -1
  279. package/dist/convex/integrations/billing/rate-limit.d.ts +16 -0
  280. package/dist/convex/integrations/billing/rate-limit.d.ts.map +1 -0
  281. package/dist/convex/integrations/billing/rate-limit.js +45 -0
  282. package/dist/convex/integrations/billing/rate-limit.js.map +1 -0
  283. package/dist/convex/integrations/billing/referral-orders.d.ts +1 -1
  284. package/dist/convex/integrations/billing/referral-orders.js +1 -1
  285. package/dist/convex/integrations/billing/resync.d.ts +28 -0
  286. package/dist/convex/integrations/billing/resync.d.ts.map +1 -0
  287. package/dist/convex/integrations/billing/resync.js +139 -0
  288. package/dist/convex/integrations/billing/resync.js.map +1 -0
  289. package/dist/convex/integrations/billing/subscriptions.d.ts +1 -1
  290. package/dist/convex/integrations/billing/subscriptions.d.ts.map +1 -1
  291. package/dist/convex/integrations/billing/subscriptions.js +6 -2
  292. package/dist/convex/integrations/billing/subscriptions.js.map +1 -1
  293. package/dist/convex/integrations/billing/types/lifecycle.d.ts +13 -1
  294. package/dist/convex/integrations/billing/types/lifecycle.d.ts.map +1 -1
  295. package/dist/convex/integrations/billing/types/options.d.ts +4 -1
  296. package/dist/convex/integrations/billing/types/options.d.ts.map +1 -1
  297. package/dist/convex/integrations/billing/types/records.d.ts +75 -4
  298. package/dist/convex/integrations/billing/types/records.d.ts.map +1 -1
  299. package/dist/convex/integrations/billing/types/setup.d.ts +9 -4
  300. package/dist/convex/integrations/billing/types/setup.d.ts.map +1 -1
  301. package/dist/convex/integrations/billing/types/surface.d.ts +42 -5
  302. package/dist/convex/integrations/billing/types/surface.d.ts.map +1 -1
  303. package/dist/convex/integrations/billing/webhooks.js +2 -2
  304. package/dist/convex/integrations/billing/welcome.d.ts +16 -0
  305. package/dist/convex/integrations/billing/welcome.d.ts.map +1 -0
  306. package/dist/convex/integrations/billing/welcome.js +93 -0
  307. package/dist/convex/integrations/billing/welcome.js.map +1 -0
  308. package/dist/convex/integrations/billing.d.ts +5 -4
  309. package/dist/convex/integrations/billing.d.ts.map +1 -1
  310. package/dist/convex/integrations/billing.js +18 -5
  311. package/dist/convex/integrations/billing.js.map +1 -1
  312. package/dist/convex/integrations/email-preferences.d.ts +1 -1
  313. package/dist/convex/integrations/email-preferences.d.ts.map +1 -1
  314. package/dist/convex/integrations/email-sync.d.ts.map +1 -1
  315. package/dist/convex/integrations/email-sync.js +43 -1
  316. package/dist/convex/integrations/email-sync.js.map +1 -1
  317. package/dist/convex/integrations/email.d.ts +17 -3
  318. package/dist/convex/integrations/email.d.ts.map +1 -1
  319. package/dist/convex/integrations/email.js.map +1 -1
  320. package/dist/convex/integrations/functions.d.ts +2 -2
  321. package/dist/convex/integrations/functions.d.ts.map +1 -1
  322. package/dist/convex/integrations/functions.js +1 -1
  323. package/dist/convex/integrations/functions.js.map +1 -1
  324. package/dist/convex/integrations/launch.d.ts +108 -3
  325. package/dist/convex/integrations/launch.d.ts.map +1 -1
  326. package/dist/convex/integrations/launch.js +143 -22
  327. package/dist/convex/integrations/launch.js.map +1 -1
  328. package/dist/convex/integrations/notifications.d.ts +30 -6
  329. package/dist/convex/integrations/notifications.d.ts.map +1 -1
  330. package/dist/convex/integrations/notifications.js +42 -28
  331. package/dist/convex/integrations/notifications.js.map +1 -1
  332. package/dist/convex/integrations/rate-limit.d.ts +24 -5
  333. package/dist/convex/integrations/rate-limit.d.ts.map +1 -1
  334. package/dist/convex/integrations/rate-limit.js +24 -8
  335. package/dist/convex/integrations/rate-limit.js.map +1 -1
  336. package/dist/convex/integrations/reports.d.ts +5 -2
  337. package/dist/convex/integrations/reports.d.ts.map +1 -1
  338. package/dist/convex/integrations/reports.js +14 -14
  339. package/dist/convex/integrations/reports.js.map +1 -1
  340. package/dist/convex/integrations/retention.d.ts +42 -4
  341. package/dist/convex/integrations/retention.d.ts.map +1 -1
  342. package/dist/convex/integrations/retention.js +62 -4
  343. package/dist/convex/integrations/retention.js.map +1 -1
  344. package/dist/convex/integrations/storage.d.ts +71 -3
  345. package/dist/convex/integrations/storage.d.ts.map +1 -1
  346. package/dist/convex/integrations/storage.js +22 -4
  347. package/dist/convex/integrations/storage.js.map +1 -1
  348. package/dist/convex/integrations/webhooks.d.ts +1 -3
  349. package/dist/convex/integrations/webhooks.d.ts.map +1 -1
  350. package/dist/convex/integrations/webhooks.js.map +1 -1
  351. package/dist/convex/label-format.d.ts +2 -2
  352. package/dist/convex/label-format.d.ts.map +1 -1
  353. package/dist/convex/label-format.js +2 -2
  354. package/dist/convex/label-format.js.map +1 -1
  355. package/dist/convex/label-groups/admin.d.ts +27 -0
  356. package/dist/convex/label-groups/admin.d.ts.map +1 -1
  357. package/dist/convex/label-groups/admin.js +28 -0
  358. package/dist/convex/label-groups/admin.js.map +1 -1
  359. package/dist/convex/label-groups/cancelFlow.d.ts +4 -1
  360. package/dist/convex/label-groups/cancelFlow.d.ts.map +1 -1
  361. package/dist/convex/label-groups/cancelFlow.js +7 -2
  362. package/dist/convex/label-groups/cancelFlow.js.map +1 -1
  363. package/dist/convex/label-groups/credits.d.ts +14 -1
  364. package/dist/convex/label-groups/credits.d.ts.map +1 -1
  365. package/dist/convex/label-groups/credits.js +17 -2
  366. package/dist/convex/label-groups/credits.js.map +1 -1
  367. package/dist/convex/label-groups/email.d.ts.map +1 -1
  368. package/dist/convex/label-groups/email.js +2 -1
  369. package/dist/convex/label-groups/email.js.map +1 -1
  370. package/dist/convex/label-groups/errors.d.ts +4 -0
  371. package/dist/convex/label-groups/errors.d.ts.map +1 -1
  372. package/dist/convex/label-groups/errors.js +6 -1
  373. package/dist/convex/label-groups/errors.js.map +1 -1
  374. package/dist/convex/label-groups/gift.d.ts +2 -0
  375. package/dist/convex/label-groups/gift.d.ts.map +1 -1
  376. package/dist/convex/label-groups/gift.js +5 -2
  377. package/dist/convex/label-groups/gift.js.map +1 -1
  378. package/dist/convex/label-groups/legal.d.ts +27 -1
  379. package/dist/convex/label-groups/legal.d.ts.map +1 -1
  380. package/dist/convex/label-groups/legal.js +31 -0
  381. package/dist/convex/label-groups/legal.js.map +1 -1
  382. package/dist/convex/label-groups/notifications.d.ts +21 -2
  383. package/dist/convex/label-groups/notifications.d.ts.map +1 -1
  384. package/dist/convex/label-groups/notifications.js +21 -15
  385. package/dist/convex/label-groups/notifications.js.map +1 -1
  386. package/dist/convex/label-groups/pastDue.d.ts +1 -1
  387. package/dist/convex/label-groups/pastDue.d.ts.map +1 -1
  388. package/dist/convex/label-groups/pastDue.js +1 -1
  389. package/dist/convex/label-groups/pastDue.js.map +1 -1
  390. package/dist/convex/label-groups/pricing.d.ts +2 -0
  391. package/dist/convex/label-groups/pricing.d.ts.map +1 -1
  392. package/dist/convex/label-groups/pricing.js +12 -8
  393. package/dist/convex/label-groups/pricing.js.map +1 -1
  394. package/dist/convex/label-groups/referral.d.ts +2 -2
  395. package/dist/convex/label-groups/referral.js +2 -2
  396. package/dist/convex/label-groups/report.d.ts +8 -1
  397. package/dist/convex/label-groups/report.d.ts.map +1 -1
  398. package/dist/convex/label-groups/report.js +10 -1
  399. package/dist/convex/label-groups/report.js.map +1 -1
  400. package/dist/convex/label-groups/settings.d.ts.map +1 -1
  401. package/dist/convex/label-groups/settings.js +4 -3
  402. package/dist/convex/label-groups/settings.js.map +1 -1
  403. package/dist/convex/label-groups/upload.d.ts +1 -0
  404. package/dist/convex/label-groups/upload.d.ts.map +1 -1
  405. package/dist/convex/label-groups/upload.js +2 -0
  406. package/dist/convex/label-groups/upload.js.map +1 -1
  407. package/dist/convex/label-groups/usage.d.ts +1 -1
  408. package/dist/convex/label-groups/usage.d.ts.map +1 -1
  409. package/dist/convex/label-groups/usage.js +2 -2
  410. package/dist/convex/label-groups/usage.js.map +1 -1
  411. package/dist/convex/label-groups/withdrawal.d.ts +1 -1
  412. package/dist/convex/label-groups/withdrawal.js +1 -1
  413. package/dist/convex/label-translations.d.ts.map +1 -1
  414. package/dist/convex/label-translations.js +141 -29
  415. package/dist/convex/label-translations.js.map +1 -1
  416. package/dist/convex/labels.d.ts +123 -1
  417. package/dist/convex/labels.d.ts.map +1 -1
  418. package/dist/convex/legal.d.ts +12 -2
  419. package/dist/convex/legal.d.ts.map +1 -1
  420. package/dist/convex/legal.js +2 -2
  421. package/dist/convex/legal.js.map +1 -1
  422. package/dist/convex/log.js +14 -1
  423. package/dist/convex/log.js.map +1 -1
  424. package/dist/convex/monitoring.d.ts +6 -4
  425. package/dist/convex/monitoring.d.ts.map +1 -1
  426. package/dist/convex/monitoring.js +6 -4
  427. package/dist/convex/monitoring.js.map +1 -1
  428. package/dist/convex/notifications.d.ts +77 -0
  429. package/dist/convex/notifications.d.ts.map +1 -1
  430. package/dist/convex/notifications.js +64 -13
  431. package/dist/convex/notifications.js.map +1 -1
  432. package/dist/convex/proof.d.ts +25 -0
  433. package/dist/convex/proof.d.ts.map +1 -1
  434. package/dist/convex/proof.js +39 -0
  435. package/dist/convex/proof.js.map +1 -1
  436. package/dist/convex/referral-rules.d.ts +0 -2
  437. package/dist/convex/referral-rules.d.ts.map +1 -1
  438. package/dist/convex/referral-rules.js +0 -2
  439. package/dist/convex/referral-rules.js.map +1 -1
  440. package/dist/convex/report-rules.d.ts +2 -0
  441. package/dist/convex/report-rules.d.ts.map +1 -1
  442. package/dist/convex/report-rules.js +2 -0
  443. package/dist/convex/report-rules.js.map +1 -1
  444. package/dist/convex/sensitive-actions.d.ts.map +1 -1
  445. package/dist/convex/sensitive-actions.js +1 -0
  446. package/dist/convex/sensitive-actions.js.map +1 -1
  447. package/dist/convex/test-models.d.ts +7 -0
  448. package/dist/convex/test-models.d.ts.map +1 -1
  449. package/dist/convex/test-models.js +25 -2
  450. package/dist/convex/test-models.js.map +1 -1
  451. package/dist/convex/test-moderation.d.ts +24 -0
  452. package/dist/convex/test-moderation.d.ts.map +1 -0
  453. package/dist/convex/test-moderation.js +114 -0
  454. package/dist/convex/test-moderation.js.map +1 -0
  455. package/dist/convex/waitlist-rules.d.ts +1 -13
  456. package/dist/convex/waitlist-rules.d.ts.map +1 -1
  457. package/dist/convex/waitlist-rules.js +2 -14
  458. package/dist/convex/waitlist-rules.js.map +1 -1
  459. package/dist/devtools-client/_nuxt/CiCAOwUc.js +5 -0
  460. package/dist/devtools-client/index.html +1 -1
  461. package/dist/env-registry.js +37 -5
  462. package/dist/module.d.ts +51 -1
  463. package/dist/module.js +2 -2
  464. package/dist/module.json +1 -1
  465. package/dist/runtime/config.d.ts +95 -14
  466. package/dist/runtime/config.js +13 -1
  467. package/dist/runtime/locales/de.json +138 -39
  468. package/dist/runtime/locales/en.json +138 -39
  469. package/dist/runtime/locales/es.json +138 -39
  470. package/dist/runtime/locales/fr.json +138 -39
  471. package/dist/runtime/locales/ru.json +138 -39
  472. package/dist/runtime/monitoring/sdk/sentry.client.config.js +2 -1
  473. package/dist/runtime/monitoring/sdk/sentry.server.config.js +6 -1
  474. package/dist/runtime/server/content-wasm.d.ts +13 -0
  475. package/dist/runtime/server/content-wasm.js +9 -0
  476. package/dist/runtime/server/csp.d.ts +17 -0
  477. package/dist/runtime/server/csp.js +18 -0
  478. package/dist/runtime/server/monitoring/csp.d.ts +12 -0
  479. package/dist/runtime/server/monitoring/csp.js +19 -0
  480. package/dist/runtime/server/protection/csp.d.ts +1 -7
  481. package/dist/runtime/server/protection/csp.js +4 -17
  482. package/dist/runtime/server/protection/gate.d.ts +4 -2
  483. package/dist/runtime/server/protection/gate.js +14 -4
  484. package/dist/runtime/test-utils/aliases.d.ts +6 -4
  485. package/dist/runtime/test-utils/aliases.js +3 -9
  486. package/dist/runtime/test-utils/base-modules.d.ts +9 -13
  487. package/dist/runtime/test-utils/install.js +4 -2
  488. package/dist/runtime/vue/a11y.js +1 -1
  489. package/dist/runtime/vue/admin-client.d.ts +18 -0
  490. package/dist/runtime/vue/admin-client.js +32 -0
  491. package/dist/runtime/vue/auth-client.d.ts +22 -14
  492. package/dist/runtime/vue/auth-client.js +3 -1
  493. package/dist/runtime/vue/components/account/AccountData.vue +2 -0
  494. package/dist/runtime/vue/components/account/AccountDeletion.css +1 -1
  495. package/dist/runtime/vue/components/account/ActivationChecklist.css +1 -1
  496. package/dist/runtime/vue/components/account/ActivationChecklist.vue +1 -0
  497. package/dist/runtime/vue/components/account/ConsentPrompt.css +1 -1
  498. package/dist/runtime/vue/components/account/ConsentPromptDialog.vue +1 -0
  499. package/dist/runtime/vue/components/account/ConsentPromptStorage.vue +1 -0
  500. package/dist/runtime/vue/components/account/EmailUnsubscribe.css +1 -1
  501. package/dist/runtime/vue/components/account/EmailUnsubscribe.vue +2 -2
  502. package/dist/runtime/vue/components/account/HowDidYouHear.css +1 -1
  503. package/dist/runtime/vue/components/account/HowDidYouHear.vue +1 -0
  504. package/dist/runtime/vue/components/account/KeepAccount.css +1 -1
  505. package/dist/runtime/vue/components/account/OnboardingFlow.css +1 -1
  506. package/dist/runtime/vue/components/account/OnboardingFlow.vue +1 -0
  507. package/dist/runtime/vue/components/account/ProfileIdentity.css +1 -1
  508. package/dist/runtime/vue/components/account/ProfilePreferencesSection.css +1 -1
  509. package/dist/runtime/vue/components/account/ProfilePreferencesSection.vue +3 -1
  510. package/dist/runtime/vue/components/account/ProfileSettings.css +1 -1
  511. package/dist/runtime/vue/components/account/ProfileSettings.vue +1 -0
  512. package/dist/runtime/vue/components/account/SecurityAlerts.css +1 -1
  513. package/dist/runtime/vue/components/account/SecurityAlerts.vue +2 -1
  514. package/dist/runtime/vue/components/account/SecurityPasskeys.css +1 -1
  515. package/dist/runtime/vue/components/account/SecuritySettings.css +1 -1
  516. package/dist/runtime/vue/components/account/SecuritySettings.vue +1 -0
  517. package/dist/runtime/vue/components/account/security-alerts.d.ts +7 -0
  518. package/dist/runtime/vue/components/account/security-alerts.js +6 -2
  519. package/dist/runtime/vue/components/admin/AdminAccess.css +1 -1
  520. package/dist/runtime/vue/components/admin/AdminAccess.vue +2 -0
  521. package/dist/runtime/vue/components/admin/AdminAccessMemberTickets.d.vue.ts +7 -0
  522. package/dist/runtime/vue/components/admin/AdminAccessMemberTickets.vue +42 -0
  523. package/dist/runtime/vue/components/admin/AdminAccessMemberTickets.vue.d.ts +7 -0
  524. package/dist/runtime/vue/components/admin/AdminAnnouncements.css +1 -1
  525. package/dist/runtime/vue/components/admin/AdminBilling.css +1 -1
  526. package/dist/runtime/vue/components/admin/AdminChart.css +1 -1
  527. package/dist/runtime/vue/components/admin/AdminConsole.css +1 -1
  528. package/dist/runtime/vue/components/admin/AdminExperiments.css +1 -1
  529. package/dist/runtime/vue/components/admin/AdminFlags.css +1 -1
  530. package/dist/runtime/vue/components/admin/AdminModeration.d.vue.ts +3 -0
  531. package/dist/runtime/vue/components/admin/AdminModeration.vue +135 -0
  532. package/dist/runtime/vue/components/admin/AdminModeration.vue.d.ts +3 -0
  533. package/dist/runtime/vue/components/admin/AdminQueue.css +1 -1
  534. package/dist/runtime/vue/components/admin/AdminReferrals.css +1 -1
  535. package/dist/runtime/vue/components/admin/AdminReports.css +1 -1
  536. package/dist/runtime/vue/components/admin/AdminRevenue.css +1 -1
  537. package/dist/runtime/vue/components/admin/AdminUsers.d.vue.ts +28 -1
  538. package/dist/runtime/vue/components/admin/AdminUsers.vue +1 -0
  539. package/dist/runtime/vue/components/admin/AdminUsers.vue.d.ts +28 -1
  540. package/dist/runtime/vue/components/admin/AdminWorkspaces.d.vue.ts +27 -0
  541. package/dist/runtime/vue/components/admin/AdminWorkspaces.vue +1 -0
  542. package/dist/runtime/vue/components/admin/AdminWorkspaces.vue.d.ts +27 -0
  543. package/dist/runtime/vue/components/admin/admin-moderation-tab.d.ts +1 -0
  544. package/dist/runtime/vue/components/admin/admin-moderation-tab.js +34 -0
  545. package/dist/runtime/vue/components/admin/admin-tabs.js +2 -0
  546. package/dist/runtime/vue/components/admin/admin.css +1 -1
  547. package/dist/runtime/vue/components/auth/AuthForm.css +1 -1
  548. package/dist/runtime/vue/components/auth/AuthForm.vue +3 -2
  549. package/dist/runtime/vue/components/auth/AuthFormChoose.css +1 -1
  550. package/dist/runtime/vue/components/auth/AuthFormPasskeyOffer.css +1 -1
  551. package/dist/runtime/vue/components/auth/InviteRedeem.css +1 -1
  552. package/dist/runtime/vue/components/auth/ReauthenticateCode.css +1 -1
  553. package/dist/runtime/vue/components/auth/ReauthenticateDialog.css +1 -1
  554. package/dist/runtime/vue/components/auth/ReauthenticateDialog.vue +3 -2
  555. package/dist/runtime/vue/components/auth/WaitlistForm.css +1 -1
  556. package/dist/runtime/vue/components/auth/WaitlistForm.vue +1 -0
  557. package/dist/runtime/vue/components/auth/WaitlistPlace.css +1 -1
  558. package/dist/runtime/vue/components/auth/WaitlistShare.css +1 -1
  559. package/dist/runtime/vue/components/billing/BillingCheckoutLink.d.vue.ts +1 -1
  560. package/dist/runtime/vue/components/billing/BillingCheckoutLink.vue +2 -0
  561. package/dist/runtime/vue/components/billing/BillingCheckoutLink.vue.d.ts +1 -1
  562. package/dist/runtime/vue/components/billing/BillingHistory.css +1 -1
  563. package/dist/runtime/vue/components/billing/BillingHistory.vue +1 -0
  564. package/dist/runtime/vue/components/billing/BillingPortalLink.vue +1 -0
  565. package/dist/runtime/vue/components/billing/CancelFlow.css +1 -1
  566. package/dist/runtime/vue/components/billing/CancelFlow.d.vue.ts +3 -0
  567. package/dist/runtime/vue/components/billing/CancelFlow.vue +11 -3
  568. package/dist/runtime/vue/components/billing/CancelFlow.vue.d.ts +3 -0
  569. package/dist/runtime/vue/components/billing/CancelFlowConfirm.d.vue.ts +3 -0
  570. package/dist/runtime/vue/components/billing/CancelFlowConfirm.vue +34 -0
  571. package/dist/runtime/vue/components/billing/CancelFlowConfirm.vue.d.ts +3 -0
  572. package/dist/runtime/vue/components/billing/CancelFlowEnd.vue +3 -1
  573. package/dist/runtime/vue/components/billing/CancelFlowQuestion.vue +2 -1
  574. package/dist/runtime/vue/components/billing/GiftList.css +1 -1
  575. package/dist/runtime/vue/components/billing/GiftSent.d.vue.ts +2 -2
  576. package/dist/runtime/vue/components/billing/GiftSent.vue.d.ts +2 -2
  577. package/dist/runtime/vue/components/billing/PricingPackCard.css +1 -1
  578. package/dist/runtime/vue/components/billing/PricingPackCard.vue +6 -3
  579. package/dist/runtime/vue/components/billing/PricingPlanCard.css +1 -1
  580. package/dist/runtime/vue/components/billing/PricingPlanCard.vue +11 -2
  581. package/dist/runtime/vue/components/billing/PricingTable.css +1 -1
  582. package/dist/runtime/vue/components/billing/PricingTable.d.vue.ts +4 -2
  583. package/dist/runtime/vue/components/billing/PricingTable.vue +25 -4
  584. package/dist/runtime/vue/components/billing/PricingTable.vue.d.ts +4 -2
  585. package/dist/runtime/vue/components/billing/ReferralCard.css +1 -1
  586. package/dist/runtime/vue/components/billing/ReferralCard.vue +1 -0
  587. package/dist/runtime/vue/components/billing/ReferralLanding.css +1 -1
  588. package/dist/runtime/vue/components/billing/UpgradePrompt.css +1 -1
  589. package/dist/runtime/vue/components/billing/UpgradePrompt.vue +1 -0
  590. package/dist/runtime/vue/components/billing/UsageHistory.css +1 -1
  591. package/dist/runtime/vue/components/billing/UsageHistory.vue +1 -0
  592. package/dist/runtime/vue/components/billing/UsageHistoryEvent.vue +3 -1
  593. package/dist/runtime/vue/components/billing/WithdrawalButton.css +1 -1
  594. package/dist/runtime/vue/components/billing/WithdrawalButton.vue +1 -0
  595. package/dist/runtime/vue/components/billing/cancel-flow.d.ts +28 -7
  596. package/dist/runtime/vue/components/billing/cancel-flow.js +25 -2
  597. package/dist/runtime/vue/components/billing/pricing-table.d.ts +6 -0
  598. package/dist/runtime/vue/components/billing/withdrawal-button.d.ts +1 -1
  599. package/dist/runtime/vue/components/shared.css +1 -1
  600. package/dist/runtime/vue/components/shell/AccessDenied.css +1 -1
  601. package/dist/runtime/vue/components/shell/AccessDenied.vue +1 -0
  602. package/dist/runtime/vue/components/shell/AccountMenu.vue +1 -0
  603. package/dist/runtime/vue/components/shell/AiLabel.css +1 -1
  604. package/dist/runtime/vue/components/shell/AiLabel.vue +4 -1
  605. package/dist/runtime/vue/components/shell/AppShell.css +1 -1
  606. package/dist/runtime/vue/components/shell/AppShell.vue +3 -0
  607. package/dist/runtime/vue/components/shell/BackendNotices.vue +1 -0
  608. package/dist/runtime/vue/components/shell/ConfirmDialog.css +1 -1
  609. package/dist/runtime/vue/components/shell/ConnectionStatus.css +1 -1
  610. package/dist/runtime/vue/components/shell/ConnectionStatus.vue +1 -0
  611. package/dist/runtime/vue/components/shell/ContactForm.css +1 -1
  612. package/dist/runtime/vue/components/shell/ContactForm.vue +1 -0
  613. package/dist/runtime/vue/components/shell/FrameMain.vue +2 -0
  614. package/dist/runtime/vue/components/shell/Gate.css +1 -1
  615. package/dist/runtime/vue/components/shell/Gate.vue +2 -0
  616. package/dist/runtime/vue/components/shell/GateQuota.vue +1 -0
  617. package/dist/runtime/vue/components/shell/LegalCompany.d.vue.ts +3 -0
  618. package/dist/runtime/vue/components/shell/LegalCompany.vue +23 -0
  619. package/dist/runtime/vue/components/shell/LegalCompany.vue.d.ts +3 -0
  620. package/dist/runtime/vue/components/shell/LegalContactPoints.d.vue.ts +10 -0
  621. package/dist/runtime/vue/components/shell/LegalContactPoints.vue +51 -0
  622. package/dist/runtime/vue/components/shell/LegalContactPoints.vue.d.ts +10 -0
  623. package/dist/runtime/vue/components/shell/LegalDetail.d.vue.ts +11 -0
  624. package/dist/runtime/vue/components/shell/LegalDetail.vue +30 -0
  625. package/dist/runtime/vue/components/shell/LegalDetail.vue.d.ts +11 -0
  626. package/dist/runtime/vue/components/shell/LegalDocument.css +1 -1
  627. package/dist/runtime/vue/components/shell/LegalDocument.vue +49 -13
  628. package/dist/runtime/vue/components/shell/LegalModeration.d.vue.ts +8 -0
  629. package/dist/runtime/vue/components/shell/LegalModeration.vue +72 -0
  630. package/dist/runtime/vue/components/shell/LegalModeration.vue.d.ts +8 -0
  631. package/dist/runtime/vue/components/shell/LegalProcessors.d.vue.ts +3 -2
  632. package/dist/runtime/vue/components/shell/LegalProcessors.vue +46 -15
  633. package/dist/runtime/vue/components/shell/LegalProcessors.vue.d.ts +3 -2
  634. package/dist/runtime/vue/components/shell/LegalStorage.d.vue.ts +3 -2
  635. package/dist/runtime/vue/components/shell/LegalStorage.vue +49 -16
  636. package/dist/runtime/vue/components/shell/LegalStorage.vue.d.ts +3 -2
  637. package/dist/runtime/vue/components/shell/LegalVersion.d.vue.ts +10 -0
  638. package/dist/runtime/vue/components/shell/LegalVersion.vue +24 -0
  639. package/dist/runtime/vue/components/shell/LegalVersion.vue.d.ts +10 -0
  640. package/dist/runtime/vue/components/shell/NoticeAnnouncement.css +1 -1
  641. package/dist/runtime/vue/components/shell/NoticeDeletion.css +1 -1
  642. package/dist/runtime/vue/components/shell/NoticeGift.css +1 -1
  643. package/dist/runtime/vue/components/shell/NoticeGift.vue +7 -4
  644. package/dist/runtime/vue/components/shell/NoticeImpersonation.css +1 -1
  645. package/dist/runtime/vue/components/shell/NoticeLowCredits.css +1 -1
  646. package/dist/runtime/vue/components/shell/NoticeLowCredits.vue +3 -1
  647. package/dist/runtime/vue/components/shell/NoticeMaintenance.css +1 -1
  648. package/dist/runtime/vue/components/shell/NoticePastDue.css +1 -1
  649. package/dist/runtime/vue/components/shell/NotificationInbox.css +1 -1
  650. package/dist/runtime/vue/components/shell/NotificationInbox.vue +1 -0
  651. package/dist/runtime/vue/components/shell/ReportNotice.css +1 -1
  652. package/dist/runtime/vue/components/shell/UploadField.css +1 -1
  653. package/dist/runtime/vue/components/shell/UploadField.d.vue.ts +2 -0
  654. package/dist/runtime/vue/components/shell/UploadField.vue +16 -3
  655. package/dist/runtime/vue/components/shell/UploadField.vue.d.ts +2 -0
  656. package/dist/runtime/vue/components/shell/WorkspaceSwitcher.css +1 -1
  657. package/dist/runtime/vue/components/shell/WorkspaceSwitcher.vue +1 -0
  658. package/dist/runtime/vue/components/shell/legal.d.ts +35 -4
  659. package/dist/runtime/vue/components/shell/legal.js +126 -13
  660. package/dist/runtime/vue/components/shell/upload-field.d.ts +3 -1
  661. package/dist/runtime/vue/components/tokens.css +1 -1
  662. package/dist/runtime/vue/components/workspaces/AcceptInvitation.vue +1 -0
  663. package/dist/runtime/vue/components/workspaces/AuditLog.css +1 -1
  664. package/dist/runtime/vue/components/workspaces/AuditLog.vue +1 -0
  665. package/dist/runtime/vue/components/workspaces/WorkspaceBilling.css +1 -1
  666. package/dist/runtime/vue/components/workspaces/WorkspaceCredits.css +1 -1
  667. package/dist/runtime/vue/components/workspaces/WorkspaceCredits.vue +6 -3
  668. package/dist/runtime/vue/components/workspaces/WorkspaceList.css +1 -1
  669. package/dist/runtime/vue/components/workspaces/WorkspaceSettings.d.vue.ts +2 -2
  670. package/dist/runtime/vue/components/workspaces/WorkspaceSettings.vue +1 -0
  671. package/dist/runtime/vue/components/workspaces/WorkspaceSettings.vue.d.ts +2 -2
  672. package/dist/runtime/vue/composables/use-access.d.ts +51 -6
  673. package/dist/runtime/vue/composables/use-access.js +36 -0
  674. package/dist/runtime/vue/composables/use-auth.d.ts +13 -1
  675. package/dist/runtime/vue/composables/use-auth.js +4 -1
  676. package/dist/runtime/vue/composables/use-billing.d.ts +16 -7
  677. package/dist/runtime/vue/composables/use-credits.d.ts +3 -0
  678. package/dist/runtime/vue/composables/use-credits.js +1 -0
  679. package/dist/runtime/vue/composables/use-email-link.d.ts +55 -4
  680. package/dist/runtime/vue/composables/use-email-link.js +9 -9
  681. package/dist/runtime/vue/composables/use-gift-list.js +3 -1
  682. package/dist/runtime/vue/composables/use-labels.js +13 -8
  683. package/dist/runtime/vue/composables/use-login-flow.js +1 -1
  684. package/dist/runtime/vue/composables/use-notifications.d.ts +5 -1
  685. package/dist/runtime/vue/composables/use-notifications.js +15 -4
  686. package/dist/runtime/vue/composables/use-passkeys.js +2 -2
  687. package/dist/runtime/vue/composables/use-pricing.d.ts +15 -0
  688. package/dist/runtime/vue/composables/use-pricing.js +4 -0
  689. package/dist/runtime/vue/composables/use-referral-invite.d.ts +33 -4
  690. package/dist/runtime/vue/composables/use-referral-invite.js +20 -9
  691. package/dist/runtime/vue/composables/use-report-form.d.ts +178 -0
  692. package/dist/runtime/vue/composables/use-report-form.js +278 -0
  693. package/dist/runtime/vue/composables/use-sign-in-alerts.d.ts +85 -0
  694. package/dist/runtime/vue/composables/use-sign-in-alerts.js +70 -0
  695. package/dist/runtime/vue/composables/use-upload-field.d.ts +32 -6
  696. package/dist/runtime/vue/composables/use-upload-field.js +75 -36
  697. package/dist/runtime/vue/composables/use-waitlist.d.ts +8 -1
  698. package/dist/runtime/vue/composables/use-waitlist.js +14 -1
  699. package/dist/runtime/vue/composables/use-webhook-log.d.ts +4 -2
  700. package/dist/runtime/vue/organization-client.d.ts +15 -0
  701. package/dist/runtime/vue/organization-client.js +65 -0
  702. package/dist/runtime/vue/pages/gifts.vue +9 -0
  703. package/dist/runtime/vue/parts.d.ts +2 -1
  704. package/dist/runtime/vue/passkey-ceremony.d.ts +42 -0
  705. package/dist/runtime/vue/passkey-ceremony.js +37 -0
  706. package/dist/runtime/vue/passkey-client.d.ts +11 -49
  707. package/dist/runtime/vue/passkey-client.js +2 -34
  708. package/dist/runtime/vue/plugins/checkout-return.d.ts +5 -3
  709. package/dist/runtime/vue/plugins/checkout-return.js +3 -5
  710. package/dist/runtime/vue/plugins/first-touch.js +2 -4
  711. package/dist/runtime/vue/plugins/passkey-ceremony.d.ts +3 -1
  712. package/dist/runtime/vue/plugins/passkey-ceremony.js +1 -1
  713. package/dist/runtime/vue/protection/state.d.ts +6 -0
  714. package/dist/runtime/vue/utils/auth-session.js +1 -1
  715. package/dist/runtime/vue/utils/billing-access.d.ts +1 -1
  716. package/dist/runtime/vue/utils/checkout-return.d.ts +14 -6
  717. package/dist/runtime/vue/utils/checkout-return.js +5 -4
  718. package/dist/runtime/vue/utils/every-page.d.ts +10 -0
  719. package/dist/runtime/vue/utils/every-page.js +6 -0
  720. package/dist/runtime/vue/utils/login-bindings.js +1 -1
  721. package/dist/runtime/vue/utils/meter-unit.d.ts +14 -0
  722. package/dist/runtime/vue/utils/meter-unit.js +18 -0
  723. package/dist/runtime/vue/utils/page-guard.js +6 -5
  724. package/dist/runtime/vue/utils/passkey-prompt.d.ts +12 -0
  725. package/dist/runtime/vue/utils/passkey-prompt.js +8 -0
  726. package/dist/runtime/vue/utils/renamed-component.js +1 -1
  727. package/dist/shared/{nuxt-backend.OQMX-0U7.mjs → nuxt-backend.Bq_mhlky.mjs} +582 -61
  728. package/dist/shared/{nuxt-backend.CPq101Wi.mjs → nuxt-backend.D9qXcOOI.mjs} +1 -1
  729. package/dist/shared/{nuxt-backend.S5C2b-4I.mjs → nuxt-backend.DmZI-QSO.mjs} +2 -2
  730. package/dist/shared/{nuxt-backend.-uB5CGw-.mjs → nuxt-backend.G4JryO1q.mjs} +144 -32
  731. package/dist/shared/{nuxt-backend.2YoiKo8j.mjs → nuxt-backend.Lk2MQI2u.mjs} +6 -2
  732. package/dist/types.d.ts +1 -1
  733. package/package.json +14 -14
  734. package/skills/nuxt-backend/SKILL.md +3 -3
  735. package/skills/nuxt-backend/references/api.md +107 -27
  736. package/skills/nuxt-backend/references/renames.json +114 -2054
  737. package/skills/nuxt-backend/references/surface.json +124 -3
  738. package/skills/nuxt-backend-ai/SKILL.md +13 -6
  739. package/skills/nuxt-backend-ai/references/api.md +21 -3
  740. package/skills/nuxt-backend-auth/SKILL.md +2 -1
  741. package/skills/nuxt-backend-auth/references/api.md +20 -3
  742. package/skills/nuxt-backend-billing/SKILL.md +7 -0
  743. package/skills/nuxt-backend-billing/references/api.md +31 -6
  744. package/skills/nuxt-backend-data/SKILL.md +7 -4
  745. package/skills/nuxt-backend-data/references/api.md +4 -3
  746. package/skills/nuxt-backend-email/SKILL.md +4 -0
  747. package/skills/nuxt-backend-email/references/api.md +3 -2
  748. package/skills/nuxt-backend-growth/references/api.md +1 -0
  749. package/skills/nuxt-backend-ship/SKILL.md +14 -22
  750. package/skills/nuxt-backend-ship/references/api.md +25 -2
  751. package/skills/nuxt-backend-ship/references/operate.md +28 -0
  752. package/skills/nuxt-backend-ui/SKILL.md +10 -5
  753. package/skills/nuxt-backend-upgrade/SKILL.md +16 -11
  754. package/skills/nuxt-backend-upgrade/references/api.md +2 -2
  755. package/skills/nuxt-backend-upgrade/references/upgrade.md +37 -438
  756. package/src/convex/access-tickets.ts +30 -1
  757. package/src/convex/account-data.ts +26 -8
  758. package/src/convex/app.ts +16 -2
  759. package/src/convex/billing-launch.ts +42 -0
  760. package/src/convex/catalog.ts +39 -2
  761. package/src/convex/client/better-auth-options.ts +11 -1
  762. package/src/convex/client/client-address.ts +37 -0
  763. package/src/convex/client/code-binding.ts +1 -1
  764. package/src/convex/client/guards.ts +3 -3
  765. package/src/convex/client/index.ts +4 -3
  766. package/src/convex/client/plugins.ts +43 -19
  767. package/src/convex/components/backend/_generated/api.ts +2 -0
  768. package/src/convex/components/backend/_generated/component.ts +1267 -242
  769. package/src/convex/components/backend/access.ts +109 -16
  770. package/src/convex/components/backend/account.ts +55 -4
  771. package/src/convex/components/backend/adapter.ts +8 -1
  772. package/src/convex/components/backend/ai.ts +20 -54
  773. package/src/convex/components/backend/billing.ts +89 -45
  774. package/src/convex/components/backend/consents.ts +2 -1
  775. package/src/convex/components/backend/crons.ts +4 -0
  776. package/src/convex/components/backend/gifts.ts +13 -7
  777. package/src/convex/components/backend/jobs.ts +58 -13
  778. package/src/convex/components/backend/lifecycle.ts +17 -12
  779. package/src/convex/components/backend/maintenance.ts +14 -1
  780. package/src/convex/components/backend/moderation.ts +57 -0
  781. package/src/convex/components/backend/notifications.ts +22 -0
  782. package/src/convex/components/backend/referrals.ts +14 -16
  783. package/src/convex/components/backend/reports.ts +7 -7
  784. package/src/convex/components/backend/schema.ts +251 -163
  785. package/src/convex/components/backend/storage.ts +67 -10
  786. package/src/convex/components/backend/subscriptions.ts +8 -36
  787. package/src/convex/components/backend/webhooks.ts +1 -10
  788. package/src/convex/consent-rules.ts +0 -3
  789. package/src/convex/constants.ts +20 -5
  790. package/src/convex/email-templates.ts +124 -22
  791. package/src/convex/emails/notification.ts +22 -0
  792. package/src/convex/errors.ts +64 -8
  793. package/src/convex/events.ts +4 -4
  794. package/src/convex/files.ts +48 -6
  795. package/src/convex/integrations/account.ts +4 -0
  796. package/src/convex/integrations/admin.ts +2 -1
  797. package/src/convex/integrations/ai/chat.ts +9 -9
  798. package/src/convex/integrations/ai/config.ts +147 -37
  799. package/src/convex/integrations/ai/context.ts +7 -4
  800. package/src/convex/integrations/ai/costs.ts +45 -2
  801. package/src/convex/integrations/ai/embeddings.ts +24 -39
  802. package/src/convex/integrations/ai/images.ts +141 -0
  803. package/src/convex/integrations/ai/job-errors.ts +40 -2
  804. package/src/convex/integrations/ai/jobs.ts +466 -72
  805. package/src/convex/integrations/ai/knowledge.ts +9 -10
  806. package/src/convex/integrations/ai/metering.ts +105 -36
  807. package/src/convex/integrations/ai/model-id.ts +24 -2
  808. package/src/convex/integrations/ai/models.ts +276 -59
  809. package/src/convex/integrations/ai/moderation-providers.ts +373 -0
  810. package/src/convex/integrations/ai/moderation-taxonomy.ts +174 -0
  811. package/src/convex/integrations/ai/moderation.ts +561 -49
  812. package/src/convex/integrations/ai/provenance.ts +10 -1
  813. package/src/convex/integrations/ai/setup.ts +5 -5
  814. package/src/convex/integrations/ai/stream.ts +6 -13
  815. package/src/convex/integrations/ai.ts +19 -6
  816. package/src/convex/integrations/billing/checkout.ts +4 -4
  817. package/src/convex/integrations/billing/context.ts +35 -11
  818. package/src/convex/integrations/billing/credits.ts +23 -6
  819. package/src/convex/integrations/billing/customers.ts +28 -5
  820. package/src/convex/integrations/billing/free-plan.ts +140 -29
  821. package/src/convex/integrations/billing/functions.ts +37 -13
  822. package/src/convex/integrations/billing/gifts.ts +36 -8
  823. package/src/convex/integrations/billing/history.ts +2 -1
  824. package/src/convex/integrations/billing/lifecycle.ts +43 -8
  825. package/src/convex/integrations/billing/passes.ts +4 -6
  826. package/src/convex/integrations/billing/pricing.ts +56 -14
  827. package/src/convex/integrations/billing/purchase.ts +1 -2
  828. package/src/convex/integrations/billing/rate-limit.ts +46 -0
  829. package/src/convex/integrations/billing/referral-orders.ts +1 -1
  830. package/src/convex/integrations/billing/resync.ts +187 -0
  831. package/src/convex/integrations/billing/rewards.ts +1 -1
  832. package/src/convex/integrations/billing/subscriptions.ts +4 -2
  833. package/src/convex/integrations/billing/types/lifecycle.ts +14 -1
  834. package/src/convex/integrations/billing/types/options.ts +4 -1
  835. package/src/convex/integrations/billing/types/records.ts +74 -4
  836. package/src/convex/integrations/billing/types/setup.ts +6 -5
  837. package/src/convex/integrations/billing/types/surface.ts +40 -5
  838. package/src/convex/integrations/billing/webhooks.ts +2 -2
  839. package/src/convex/integrations/billing/welcome.ts +103 -0
  840. package/src/convex/integrations/billing.ts +23 -7
  841. package/src/convex/integrations/email-preferences.ts +1 -1
  842. package/src/convex/integrations/email-sync.ts +44 -1
  843. package/src/convex/integrations/email.ts +17 -2
  844. package/src/convex/integrations/functions.ts +2 -2
  845. package/src/convex/integrations/launch.ts +247 -28
  846. package/src/convex/integrations/notifications.ts +80 -32
  847. package/src/convex/integrations/rate-limit.ts +24 -8
  848. package/src/convex/integrations/reports.ts +19 -6
  849. package/src/convex/integrations/retention.ts +73 -5
  850. package/src/convex/integrations/storage.ts +91 -6
  851. package/src/convex/integrations/webhooks.ts +1 -4
  852. package/src/convex/label-format.ts +2 -2
  853. package/src/convex/label-groups/admin.ts +28 -0
  854. package/src/convex/label-groups/cancelFlow.ts +7 -2
  855. package/src/convex/label-groups/credits.ts +17 -2
  856. package/src/convex/label-groups/email.ts +2 -1
  857. package/src/convex/label-groups/errors.ts +6 -1
  858. package/src/convex/label-groups/gift.ts +5 -2
  859. package/src/convex/label-groups/legal.ts +31 -0
  860. package/src/convex/label-groups/notifications.ts +21 -15
  861. package/src/convex/label-groups/pastDue.ts +1 -1
  862. package/src/convex/label-groups/pricing.ts +12 -8
  863. package/src/convex/label-groups/referral.ts +2 -2
  864. package/src/convex/label-groups/report.ts +10 -1
  865. package/src/convex/label-groups/settings.ts +4 -3
  866. package/src/convex/label-groups/upload.ts +2 -0
  867. package/src/convex/label-groups/usage.ts +2 -2
  868. package/src/convex/label-groups/withdrawal.ts +1 -1
  869. package/src/convex/label-translations.ts +141 -29
  870. package/src/convex/labels.ts +25 -0
  871. package/src/convex/legal.ts +12 -2
  872. package/src/convex/log.ts +14 -1
  873. package/src/convex/monitoring.ts +6 -4
  874. package/src/convex/notifications.ts +99 -13
  875. package/src/convex/proof.ts +43 -0
  876. package/src/convex/referral-rules.ts +0 -2
  877. package/src/convex/report-rules.ts +3 -0
  878. package/src/convex/sensitive-actions.ts +1 -0
  879. package/src/convex/test-models.ts +26 -2
  880. package/src/convex/test-moderation.ts +122 -0
  881. package/src/convex/test.ts +405 -8
  882. package/src/convex/waitlist-rules.ts +2 -22
  883. package/src/runtime/vue/components/account/AccountData.vue +2 -0
  884. package/src/runtime/vue/components/account/AccountDeletion.css +2 -1
  885. package/src/runtime/vue/components/account/ActivationChecklist.css +5 -2
  886. package/src/runtime/vue/components/account/ActivationChecklist.vue +1 -0
  887. package/src/runtime/vue/components/account/ConsentPrompt.css +8 -5
  888. package/src/runtime/vue/components/account/ConsentPromptDialog.vue +1 -0
  889. package/src/runtime/vue/components/account/ConsentPromptStorage.vue +1 -0
  890. package/src/runtime/vue/components/account/EmailUnsubscribe.css +6 -2
  891. package/src/runtime/vue/components/account/EmailUnsubscribe.vue +2 -2
  892. package/src/runtime/vue/components/account/HowDidYouHear.css +8 -3
  893. package/src/runtime/vue/components/account/HowDidYouHear.vue +1 -0
  894. package/src/runtime/vue/components/account/KeepAccount.css +3 -1
  895. package/src/runtime/vue/components/account/OnboardingFlow.css +6 -3
  896. package/src/runtime/vue/components/account/OnboardingFlow.vue +1 -0
  897. package/src/runtime/vue/components/account/ProfileIdentity.css +1 -1
  898. package/src/runtime/vue/components/account/ProfilePreferencesSection.css +3 -1
  899. package/src/runtime/vue/components/account/ProfilePreferencesSection.vue +4 -2
  900. package/src/runtime/vue/components/account/ProfileSettings.css +3 -1
  901. package/src/runtime/vue/components/account/ProfileSettings.vue +1 -0
  902. package/src/runtime/vue/components/account/SecurityAlerts.css +2 -1
  903. package/src/runtime/vue/components/account/SecurityAlerts.vue +2 -2
  904. package/src/runtime/vue/components/account/SecurityPasskeys.css +5 -3
  905. package/src/runtime/vue/components/account/SecuritySettings.css +2 -1
  906. package/src/runtime/vue/components/account/SecuritySettings.vue +1 -0
  907. package/src/runtime/vue/components/admin/AdminAccess.css +1 -1
  908. package/src/runtime/vue/components/admin/AdminAccess.vue +3 -1
  909. package/src/runtime/vue/components/admin/AdminAccessMemberTickets.vue +51 -0
  910. package/src/runtime/vue/components/admin/AdminAnnouncements.css +4 -2
  911. package/src/runtime/vue/components/admin/AdminBilling.css +1 -1
  912. package/src/runtime/vue/components/admin/AdminChart.css +2 -1
  913. package/src/runtime/vue/components/admin/AdminConsole.css +1 -0
  914. package/src/runtime/vue/components/admin/AdminExperiments.css +2 -1
  915. package/src/runtime/vue/components/admin/AdminFlags.css +4 -2
  916. package/src/runtime/vue/components/admin/AdminModeration.vue +148 -0
  917. package/src/runtime/vue/components/admin/AdminQueue.css +4 -2
  918. package/src/runtime/vue/components/admin/AdminReferrals.css +3 -1
  919. package/src/runtime/vue/components/admin/AdminReports.css +2 -1
  920. package/src/runtime/vue/components/admin/AdminRevenue.css +2 -1
  921. package/src/runtime/vue/components/admin/AdminUsers.vue +1 -0
  922. package/src/runtime/vue/components/admin/AdminWorkspaces.vue +1 -0
  923. package/src/runtime/vue/components/admin/admin.css +2 -1
  924. package/src/runtime/vue/components/auth/AuthForm.css +6 -3
  925. package/src/runtime/vue/components/auth/AuthForm.vue +4 -3
  926. package/src/runtime/vue/components/auth/AuthFormChoose.css +1 -0
  927. package/src/runtime/vue/components/auth/AuthFormPasskeyOffer.css +2 -1
  928. package/src/runtime/vue/components/auth/InviteRedeem.css +2 -0
  929. package/src/runtime/vue/components/auth/ReauthenticateCode.css +1 -1
  930. package/src/runtime/vue/components/auth/ReauthenticateDialog.css +6 -2
  931. package/src/runtime/vue/components/auth/ReauthenticateDialog.vue +3 -2
  932. package/src/runtime/vue/components/auth/WaitlistForm.css +3 -1
  933. package/src/runtime/vue/components/auth/WaitlistForm.vue +1 -0
  934. package/src/runtime/vue/components/auth/WaitlistPlace.css +3 -1
  935. package/src/runtime/vue/components/auth/WaitlistShare.css +6 -3
  936. package/src/runtime/vue/components/billing/BillingCheckoutLink.vue +2 -0
  937. package/src/runtime/vue/components/billing/BillingHistory.css +2 -1
  938. package/src/runtime/vue/components/billing/BillingHistory.vue +1 -0
  939. package/src/runtime/vue/components/billing/BillingPortalLink.vue +1 -0
  940. package/src/runtime/vue/components/billing/CancelFlow.css +24 -4
  941. package/src/runtime/vue/components/billing/CancelFlow.vue +18 -7
  942. package/src/runtime/vue/components/billing/CancelFlowConfirm.vue +35 -0
  943. package/src/runtime/vue/components/billing/CancelFlowEnd.vue +3 -1
  944. package/src/runtime/vue/components/billing/CancelFlowQuestion.vue +8 -2
  945. package/src/runtime/vue/components/billing/GiftList.css +5 -2
  946. package/src/runtime/vue/components/billing/PricingPackCard.css +2 -1
  947. package/src/runtime/vue/components/billing/PricingPackCard.vue +6 -3
  948. package/src/runtime/vue/components/billing/PricingPlanCard.css +5 -3
  949. package/src/runtime/vue/components/billing/PricingPlanCard.vue +11 -2
  950. package/src/runtime/vue/components/billing/PricingTable.css +1 -1
  951. package/src/runtime/vue/components/billing/PricingTable.vue +26 -4
  952. package/src/runtime/vue/components/billing/ReferralCard.css +6 -3
  953. package/src/runtime/vue/components/billing/ReferralCard.vue +1 -0
  954. package/src/runtime/vue/components/billing/ReferralLanding.css +5 -2
  955. package/src/runtime/vue/components/billing/UpgradePrompt.css +6 -3
  956. package/src/runtime/vue/components/billing/UpgradePrompt.vue +1 -0
  957. package/src/runtime/vue/components/billing/UsageHistory.css +2 -1
  958. package/src/runtime/vue/components/billing/UsageHistory.vue +1 -0
  959. package/src/runtime/vue/components/billing/UsageHistoryEvent.vue +3 -1
  960. package/src/runtime/vue/components/billing/WithdrawalButton.css +6 -2
  961. package/src/runtime/vue/components/billing/WithdrawalButton.vue +2 -1
  962. package/src/runtime/vue/components/shared.css +24 -3
  963. package/src/runtime/vue/components/shell/AccessDenied.css +4 -1
  964. package/src/runtime/vue/components/shell/AccessDenied.vue +1 -0
  965. package/src/runtime/vue/components/shell/AccountMenu.vue +1 -0
  966. package/src/runtime/vue/components/shell/AiLabel.css +3 -2
  967. package/src/runtime/vue/components/shell/AiLabel.vue +4 -1
  968. package/src/runtime/vue/components/shell/AppShell.css +5 -3
  969. package/src/runtime/vue/components/shell/AppShell.vue +3 -0
  970. package/src/runtime/vue/components/shell/BackendNotices.vue +3 -2
  971. package/src/runtime/vue/components/shell/ConfirmDialog.css +5 -2
  972. package/src/runtime/vue/components/shell/ConnectionStatus.css +1 -1
  973. package/src/runtime/vue/components/shell/ConnectionStatus.vue +1 -0
  974. package/src/runtime/vue/components/shell/ContactForm.css +8 -1
  975. package/src/runtime/vue/components/shell/ContactForm.vue +1 -0
  976. package/src/runtime/vue/components/shell/FrameMain.vue +2 -0
  977. package/src/runtime/vue/components/shell/Gate.css +5 -2
  978. package/src/runtime/vue/components/shell/Gate.vue +2 -0
  979. package/src/runtime/vue/components/shell/GateQuota.vue +1 -0
  980. package/src/runtime/vue/components/shell/LegalCompany.vue +38 -0
  981. package/src/runtime/vue/components/shell/LegalContactPoints.vue +74 -0
  982. package/src/runtime/vue/components/shell/LegalDetail.vue +54 -0
  983. package/src/runtime/vue/components/shell/LegalDocument.css +21 -4
  984. package/src/runtime/vue/components/shell/LegalDocument.vue +54 -15
  985. package/src/runtime/vue/components/shell/LegalModeration.vue +94 -0
  986. package/src/runtime/vue/components/shell/LegalProcessors.vue +64 -22
  987. package/src/runtime/vue/components/shell/LegalStorage.vue +64 -23
  988. package/src/runtime/vue/components/shell/LegalVersion.vue +44 -0
  989. package/src/runtime/vue/components/shell/NoticeAnnouncement.css +2 -1
  990. package/src/runtime/vue/components/shell/NoticeDeletion.css +5 -2
  991. package/src/runtime/vue/components/shell/NoticeGift.css +2 -1
  992. package/src/runtime/vue/components/shell/NoticeGift.vue +8 -5
  993. package/src/runtime/vue/components/shell/NoticeImpersonation.css +2 -1
  994. package/src/runtime/vue/components/shell/NoticeLowCredits.css +6 -2
  995. package/src/runtime/vue/components/shell/NoticeLowCredits.vue +3 -1
  996. package/src/runtime/vue/components/shell/NoticeMaintenance.css +2 -1
  997. package/src/runtime/vue/components/shell/NoticePastDue.css +6 -2
  998. package/src/runtime/vue/components/shell/NoticePastDue.vue +1 -1
  999. package/src/runtime/vue/components/shell/NotificationInbox.css +6 -4
  1000. package/src/runtime/vue/components/shell/NotificationInbox.vue +1 -0
  1001. package/src/runtime/vue/components/shell/ReportNotice.css +2 -1
  1002. package/src/runtime/vue/components/shell/UploadField.css +4 -2
  1003. package/src/runtime/vue/components/shell/UploadField.vue +21 -5
  1004. package/src/runtime/vue/components/shell/WorkspaceSwitcher.css +4 -1
  1005. package/src/runtime/vue/components/shell/WorkspaceSwitcher.vue +1 -0
  1006. package/src/runtime/vue/components/tokens.css +40 -16
  1007. package/src/runtime/vue/components/workspaces/AcceptInvitation.vue +1 -0
  1008. package/src/runtime/vue/components/workspaces/AuditLog.css +2 -1
  1009. package/src/runtime/vue/components/workspaces/AuditLog.vue +1 -0
  1010. package/src/runtime/vue/components/workspaces/WorkspaceBilling.css +2 -1
  1011. package/src/runtime/vue/components/workspaces/WorkspaceCredits.css +1 -0
  1012. package/src/runtime/vue/components/workspaces/WorkspaceCredits.vue +6 -3
  1013. package/src/runtime/vue/components/workspaces/WorkspaceList.css +2 -1
  1014. package/src/runtime/vue/components/workspaces/WorkspaceSettings.vue +1 -0
  1015. package/src/runtime/vue/pages/gifts.vue +13 -2
  1016. package/src/runtime/vue/pages/referral.vue +1 -2
  1017. package/dist/devtools-client/_nuxt/CfQg3BRt.js +0 -5
@@ -1,12 +1,13 @@
1
1
  import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
2
2
  import { createRequire } from 'node:module';
3
3
  import { resolve, join, dirname, relative, sep } from 'node:path';
4
- import { k as executeEnvPush, f as runConvex, aL as envNames, $ as REQUIRED_DEPLOYMENT_ENV, aM as DEV_ONLY_DEPLOYMENT_ENV, l as generateAuthSecret, aN as DEV_SITE_URL, g as deploymentFlags, aO as finding, j as deployKeyType, h as readEnvFiles, r as resolveFunctionsDir, aP as parseBackendEnvironment, c as billingEnvironment, P as packageDir, aQ as proofKeys, aR as TEST_CHALLENGE_SITE_KEYS, aS as deploymentEnvId, aT as protectionTakes, ac as DEFAULT_AUTH_ROUTE, aU as TEST_CHALLENGE_SECRET_KEYS, aV as PROTECTED_AUTH_ROUTES, aW as PROOF_HEADER, aX as signProof, aY as proofAudience, b as deploymentBackendEnvironment, aZ as deploymentSiteOrigin, n as isLoopbackUrl, a6 as HEALTH_ROUTE, a3 as resolveSiteUrl, a0 as deriveDeploymentUrls, a as deploymentEnvNames, a_ as isLocalDeploymentId, A as configuredDeployment, Z as collectPreflightFindings, F as computeDeployment, a$ as applyProductionPosture, b0 as capabilityOfGroup, b1 as agentFilesFinding, O as installedVersion, _ as OPTIONAL_DEPLOYMENT_ENV, aA as BACKEND_ENV, b2 as pinnedRegion, b3 as namedModels, b4 as usesProvenance, b5 as monitoringDsnFinding, b6 as monitoringFindings, b7 as usageAlertsFinding, b8 as readUsageLimits, b9 as billingWebhookSecretHint, v as backendPathsOf, ba as BACKEND_PATH_KEYS, bb as pathOption, t as pathsSourceOf, bc as aiFeatures, bd as pathsFileFinding, be as brandFileFinding, x as appBrandOf, aC as REMOVED_DEPLOYMENT_ENV, bf as installableFinding, d as deploymentFunctionSpec, bg as mountsComponent } from '../shared/nuxt-backend.OQMX-0U7.mjs';
4
+ import { l as executeEnvPush, f as runConvex, aY as envNames, a3 as REQUIRED_DEPLOYMENT_ENV, aZ as DEV_ONLY_DEPLOYMENT_ENV, m as generateAuthSecret, a_ as DEV_SITE_URL, g as deploymentFlags, a$ as finding, e as deployKeyType, r as readEnvFiles, j as resolveFunctionsDir, b0 as parseBackendEnvironment, c as billingEnvironment, V as packageDir, b1 as proofKeys, b2 as TEST_CHALLENGE_SITE_KEYS, b3 as deploymentEnvId, b4 as protectionTakes, ak as DEFAULT_AUTH_ROUTE, b5 as TEST_CHALLENGE_SECRET_KEYS, b6 as PROTECTED_AUTH_ROUTES, b7 as PROOF_HEADER, b8 as signProof, b9 as proofAudience, b as deploymentBackendEnvironment, ba as deploymentSiteOrigin, p as isLoopbackUrl, aa as HEALTH_ROUTE, a7 as resolveSiteUrl, a4 as deriveDeploymentUrls, a as deploymentEnvNames, bb as isLocalDeploymentId, H as configuredDeployment, J as computeDeployment, a1 as collectPreflightFindings, bc as capabilityOfGroup, bd as agentFilesFinding, U as installedVersion, a2 as OPTIONAL_DEPLOYMENT_ENV, aN as BACKEND_ENV, be as chosenRoutes, bf as chosenGateways, bg as pinnedRegion, bh as namedModels, bi as usesProvenance, bj as moderationProviders, bk as monitoringDsnFinding, bl as monitoringFindings, bm as usageAlertsFinding, bn as readUsageLimits, bo as applyProductionPosture, bp as billingWebhookSecretHint, w as backendPathsOf, bq as BACKEND_PATH_KEYS, br as pathOption, u as pathsSourceOf, bs as aiFeatures, bt as pathsFileFinding, bu as brandFileFinding, y as appBrandOf, bv as labelsFileFinding, E as appLabelsOf, aP as REMOVED_DEPLOYMENT_ENV, bw as checksImages, bx as namesModerationModel, by as GATEWAY_ORDER_UNREAD, bz as routeKeyFor, bA as installableFinding, d as deploymentFunctionSpec, bB as gatewayKeyIsTheFix, bC as DEFAULT_MODERATION_MODEL, bD as mountsComponent, bE as GATEWAY_KEY_FIX } from '../shared/nuxt-backend.Bq_mhlky.mjs';
5
5
  import { defineCommand } from 'citty';
6
- import { w as withContract, p as progress, b as devScriptFinding } from '../shared/nuxt-backend.2YoiKo8j.mjs';
6
+ import { w as withContract, f as finish, p as progress, b as devScriptFinding } from '../shared/nuxt-backend.Lk2MQI2u.mjs';
7
7
  import { pathToFileURL } from 'node:url';
8
8
  import { Polar } from '@polar-sh/sdk';
9
9
  import { benefitsList } from '@polar-sh/sdk/funcs/benefitsList.js';
10
+ import { checkoutLinksList } from '@polar-sh/sdk/funcs/checkoutLinksList.js';
10
11
  import { membersListMembers } from '@polar-sh/sdk/funcs/membersListMembers.js';
11
12
  import { organizationsListOrganizations } from '@polar-sh/sdk/funcs/organizationsListOrganizations.js';
12
13
  import { productsList } from '@polar-sh/sdk/funcs/productsList.js';
@@ -14,16 +15,18 @@ import { discountsCreate } from '@polar-sh/sdk/funcs/discountsCreate.js';
14
15
  import { discountsList } from '@polar-sh/sdk/funcs/discountsList.js';
15
16
  import { discountsUpdate } from '@polar-sh/sdk/funcs/discountsUpdate.js';
16
17
  import { ServerList } from '@polar-sh/sdk/lib/config.js';
18
+ import { productsUpdate } from '@polar-sh/sdk/funcs/productsUpdate.js';
17
19
  import { benefitsCreate } from '@polar-sh/sdk/funcs/benefitsCreate.js';
18
20
  import { benefitsUpdate } from '@polar-sh/sdk/funcs/benefitsUpdate.js';
19
21
  import { productsUpdateBenefits } from '@polar-sh/sdk/funcs/productsUpdateBenefits.js';
20
- import { productsUpdate } from '@polar-sh/sdk/funcs/productsUpdate.js';
21
22
  import { organizationsUpdate } from '@polar-sh/sdk/funcs/organizationsUpdate.js';
22
23
  import { webhooksListWebhookEndpoints } from '@polar-sh/sdk/funcs/webhooksListWebhookEndpoints.js';
23
24
  import { webhooksUpdateWebhookEndpoint } from '@polar-sh/sdk/funcs/webhooksUpdateWebhookEndpoint.js';
25
+ import { customersGet } from '@polar-sh/sdk/funcs/customersGet.js';
26
+ import '@convex-dev/polar';
24
27
  import { metricsLimits } from '@polar-sh/sdk/funcs/metricsLimits.js';
25
28
  import { r as readLastRun, i as installChangedSince, a as formatSize } from './report.mjs';
26
- import { c as convexConfigFinding } from '../shared/nuxt-backend.CPq101Wi.mjs';
29
+ import { c as convexConfigFinding } from '../shared/nuxt-backend.D9qXcOOI.mjs';
27
30
 
28
31
  const ENV_DEFAULT_TYPES = ["preview", "dev"];
29
32
  const ENV_DEFAULT_NAMES = [...REQUIRED_DEPLOYMENT_ENV, "BACKEND_ENVIRONMENT"];
@@ -72,6 +75,30 @@ async function runEnvDefaults(rootDir, options) {
72
75
  return { deployment: `defaults:${options.type}`, dev: false, deployedNames: defaultNames, results, missingRequired };
73
76
  }
74
77
 
78
+ const INVITE_LABEL_MAX = 64;
79
+ const ADMIT_BATCH_MAX = 500;
80
+ const ADMISSION_TTL_MS = 30 * 24 * 60 * 60 * 1e3;
81
+ new TextEncoder();
82
+ function admissionEmail(address) {
83
+ return address.trim().toLowerCase();
84
+ }
85
+ const EMAIL_SHAPE = /^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/;
86
+ const RESERVED_DOMAINS = /(?:^|\.)(?:example\.(?:com|net|org)|example|test|invalid|localhost)$/;
87
+ function admissionProblem(address) {
88
+ if (address.length > 254 || !EMAIL_SHAPE.test(address)) return "malformed";
89
+ return RESERVED_DOMAINS.test(address.slice(address.lastIndexOf("@") + 1)) ? "reserved" : null;
90
+ }
91
+ function cleanAddresses(emails) {
92
+ const clean = [];
93
+ const skipped = [];
94
+ for (const email of emails.map(admissionEmail).filter(Boolean)) {
95
+ const problem = admissionProblem(email);
96
+ if (problem) skipped.push({ email, reason: problem });
97
+ else clean.push(email);
98
+ }
99
+ return { clean, skipped };
100
+ }
101
+
75
102
  const SCAN_LIMIT = 8e3;
76
103
  const HAS_ADMIN_QUERY = [
77
104
  "let read = 0",
@@ -108,15 +135,41 @@ function addressOf(answer) {
108
135
  return /^[^\s@]+@[^\s@]+$/.test(email) ? email : null;
109
136
  }
110
137
  const FIRST_ADMIN_ADMISSION_MS = 24 * 60 * 60 * 1e3;
111
- async function admitAddress(rootDir, email, prod) {
138
+ const CLI_ADMISSION_LABEL = "command line";
139
+ function admitRefused(prod, note) {
140
+ return { deployment: prod ? "production" : "dev", status: "refused", admitted: [], skipped: [], expiresAt: null, note };
141
+ }
142
+ async function admitAddresses(rootDir, emails, { prod, label, expiresAt }, run) {
143
+ const deployment = prod ? "production" : "dev";
144
+ const report = (status, admitted, skipped, note) => ({ deployment, status, admitted, skipped, expiresAt, ...note ? { note } : {} });
145
+ if (emails.length === 0) return report("admitted", [], []);
112
146
  try {
113
- const args = { emails: [email], source: "invitation", label: "first-administrator", expiresAt: Date.now() + FIRST_ADMIN_ADMISSION_MS };
114
- await runConvex(rootDir, ["run", ...deploymentFlags({ prod }), "--component", "backend", "access:admit", JSON.stringify(args)]);
115
- return true;
116
- } catch {
117
- return false;
147
+ const args = { emails, source: "invitation", label, expiresAt };
148
+ const { stdout } = await run(rootDir, ["run", ...deploymentFlags({ prod }), "--component", "backend", "access:admit", JSON.stringify(args)]);
149
+ const stored = JSON.parse(stdout || "null") ?? {};
150
+ return report("admitted", stored.admitted ?? [], (stored.skipped ?? []).map((row) => ({ email: row.email, reason: "account" })));
151
+ } catch (error) {
152
+ if (error?.missingFunction === true) return report("missing", [], [], `the ${deployment} deployment's backend has no launch access to admit through (access:admit): push the backend first.`);
153
+ return report("failed", [], [], `the ${deployment} deployment refused the admission (${error instanceof Error ? error.message : String(error)}).`);
118
154
  }
119
155
  }
156
+ async function admitCleaned(rootDir, emails, options, run = runConvex) {
157
+ const { clean, skipped } = cleanAddresses(emails);
158
+ const report = await admitAddresses(rootDir, clean, options, run);
159
+ return { ...report, skipped: [...skipped, ...report.skipped] };
160
+ }
161
+ function admitInputRefusal(emails, label, days) {
162
+ if (emails.length === 0) return "name at least one address: npx nuxt-backend access admit you@example.com";
163
+ if (emails.length > ADMIT_BATCH_MAX) return `at most ${ADMIT_BATCH_MAX} addresses at a time.`;
164
+ if (!label.trim() || label.trim().length > INVITE_LABEL_MAX) return `--label is 1-${INVITE_LABEL_MAX} characters.`;
165
+ if (!Number.isInteger(days) || days < 1 || days > 365) return "--days is a whole number of days from 1 to 365.";
166
+ return null;
167
+ }
168
+ const ADMISSION_DAYS = ADMISSION_TTL_MS / (24 * 60 * 60 * 1e3);
169
+ async function admitAddress(rootDir, email, prod) {
170
+ const { status, admitted } = await admitAddresses(rootDir, [email], { prod, label: "first-administrator", expiresAt: Date.now() + FIRST_ADMIN_ADMISSION_MS }, runConvex);
171
+ return status === "admitted" && admitted.includes(email);
172
+ }
120
173
  async function bootstrapAdmin(rootDir, { prod, ask, print }) {
121
174
  if (await deploymentHasAdmin(rootDir, { prod }) !== false) return null;
122
175
  const answer = await ask("[nuxt-backend] doctor --fix: no account holds the admin role. Make which account the first administrator? Its email (empty to skip): ");
@@ -149,10 +202,11 @@ function namesNoFunction(error) {
149
202
  if (typeof error?.missingFunction === "boolean") return error.missingFunction;
150
203
  return /could not find|not found|no such function/i.test(error instanceof Error ? error.message : String(error));
151
204
  }
205
+ const EMAIL_SYNC_TIMEOUT_MS = 5 * 6e4;
152
206
  async function runEmailSync(rootDir, { prod = false, dryRun = false, webhook, enableWebhook, rotateWebhookSecret } = {}, run = runConvex) {
153
207
  let stdout;
154
208
  try {
155
- ({ stdout } = await run(rootDir, ["run", ...deploymentFlags({ prod }), "email:syncEmail", JSON.stringify({ dryRun, ...webhook ? { webhook } : {}, ...enableWebhook ? { enableWebhook } : {}, ...rotateWebhookSecret ? { rotateWebhookSecret } : {} })]));
209
+ ({ stdout } = await run(rootDir, ["run", ...deploymentFlags({ prod }), "email:syncEmail", JSON.stringify({ dryRun, ...webhook ? { webhook } : {}, ...enableWebhook ? { enableWebhook } : {}, ...rotateWebhookSecret ? { rotateWebhookSecret } : {} })], { timeout: EMAIL_SYNC_TIMEOUT_MS }));
156
210
  } catch (error) {
157
211
  if (namesNoFunction(error)) return null;
158
212
  throw error;
@@ -323,13 +377,11 @@ const emailSync = withContract("email sync", {
323
377
  "json": { type: "boolean", description: "Print the outcome as one JSON document; progress goes to stderr", default: false }
324
378
  },
325
379
  async run({ args }) {
326
- const { exitCode, output } = await runEmailSyncCommand(resolve(process.cwd(), args.cwd), {
380
+ finish(args.json, await runEmailSyncCommand(resolve(process.cwd(), args.cwd), {
327
381
  prod: args.prod,
328
382
  dryRun: args["dry-run"],
329
383
  ...args.webhook ? { webhook: args.webhook } : {}
330
- }, progress(args.json));
331
- if (args.json && output) console.log(JSON.stringify(output, null, 2));
332
- if (exitCode !== 0) process.exitCode = exitCode;
384
+ }, progress(args.json)));
333
385
  }
334
386
  }));
335
387
  const email = defineCommand({
@@ -363,6 +415,7 @@ const REQUIRED_FUNCTION_EXPORTS = {
363
415
  "runGiftSweep",
364
416
  "updateSubscription",
365
417
  "cancelSubscription",
418
+ "getCancelFlow",
366
419
  "acceptSaveOffer",
367
420
  "getWithdrawal",
368
421
  "withdraw",
@@ -960,7 +1013,7 @@ function refuseUnpricedPlans(catalog) {
960
1013
  for (const [key, plan] of Object.entries(catalog.plans ?? {})) {
961
1014
  const line = legacyPlanLine(plan);
962
1015
  if (line) {
963
- throw new Error(`[nuxt-backend] billing sync: plans.${key} has \`interval\` and \`price\`, which became \`prices: { month, year }\` \u2014 write ${line} (the Upgrade page has the rest).`);
1016
+ throw new Error(`[nuxt-backend] billing sync: plans.${key} has \`interval\` and \`price\`, which became \`prices: { month, year }\` \u2014 write ${line} (https://nuxt-backend.dev/docs/build/billing/catalog#declare has the rest).`);
964
1017
  }
965
1018
  if (pricedIntervals(plan).length === 0) {
966
1019
  throw new Error(`[nuxt-backend] billing sync: plans.${key} has no price \u2014 give it \`prices: { month }\`, \`prices: { year }\` or both.`);
@@ -1012,11 +1065,48 @@ function refuseInvalidPrices(catalog) {
1012
1065
  throw new Error(`[nuxt-backend] billing sync: ${free.join(", ")} are all free plans \u2014 a catalog has at most one, which every new billing entity starts on. Price the others, or retire them.`);
1013
1066
  }
1014
1067
  }
1068
+ function onceCreditsProblem(catalog, key, plan) {
1069
+ const grant = plan.credits;
1070
+ if (!grant?.once) return void 0;
1071
+ if (plan.retired || !isFreePlan(plan)) return `plans.${key} grants its credits \`once\`, which only the free plan does: welcome credits for every new billing entity. Drop \`once\` to grant them every cycle`;
1072
+ if (typeof grant.units !== "number" || !Number.isInteger(grant.units) || grant.units <= 0) return `plans.${key} grants its welcome credits \`once\`: \`units\` is one whole number above 0, not one per interval`;
1073
+ const meter = catalog.meters?.[grant.meter];
1074
+ if (!meter) return `plans.${key} grants its welcome credits on \`${grant.meter}\`, which is no meter of the catalog \u2014 declare it in \`meters\``;
1075
+ if (meter.aggregation === "count") return `plans.${key} grants its welcome credits on \`${grant.meter}\`, which counts events: they are given as a refund, which only a sum meter takes`;
1076
+ return void 0;
1077
+ }
1078
+ function refuseOnceCredits(catalog) {
1079
+ for (const [key, plan] of Object.entries(catalog.plans ?? {})) {
1080
+ const problem = onceCreditsProblem(catalog, key, plan);
1081
+ if (problem) throw new Error(`[nuxt-backend] billing sync: ${problem}.`);
1082
+ }
1083
+ }
1015
1084
  function refuseMissingDefaultCurrency(catalog, currency) {
1016
1085
  if (!currency || catalog.currency) return;
1017
1086
  for (const [key, plan] of Object.entries(catalog.plans ?? {})) refuseCurrencies(`plans.${key}`, planPricesByCurrency(plan, currency).map(([code]) => code), currency);
1018
1087
  for (const [key, pack] of Object.entries(catalog.packs ?? {})) refuseCurrencies(`packs.${key}`, packPricesByCurrency(pack, currency).map(([code]) => code), currency);
1019
1088
  }
1089
+ function missingOrganizationCurrency(catalog, currency, organizationCurrency) {
1090
+ if (!organizationCurrency) return [];
1091
+ const lacks = (codes) => !codes.includes(organizationCurrency);
1092
+ return [
1093
+ ...Object.entries(catalog.plans ?? {}).filter(([, plan]) => !plan.retired && !isFreePlan(plan) && lacks(planPricesByCurrency(plan, currency).map(([code]) => code))).map(([key]) => `plans.${key}`),
1094
+ ...Object.entries(catalog.packs ?? {}).filter(([, pack]) => lacks(packPricesByCurrency(pack, currency).map(([code]) => code))).map(([key]) => `packs.${key}`)
1095
+ ];
1096
+ }
1097
+ function organizationCurrencyProblem(missing, organizationCurrency) {
1098
+ return `the organization's default currency is ${organizationCurrency}, and ${missing.join(", ")} ${missing.length === 1 ? "has" : "have"} no price in it: the provider makes no product without one. Add ${organizationCurrency} to ${missing.length === 1 ? "its" : "their"} prices (\`prices: { usd: \u2026, ${organizationCurrency}: \u2026 }\`), or change the organization's default currency in the provider dashboard`;
1099
+ }
1100
+ function refuseMissingOrganizationCurrency(catalog, currency, organizationCurrency) {
1101
+ const missing = missingOrganizationCurrency(catalog, currency, organizationCurrency);
1102
+ if (missing.length > 0) throw new Error(`[nuxt-backend] billing sync: ${organizationCurrencyProblem(missing, organizationCurrency)}.`);
1103
+ }
1104
+ function zeroPrices(plan, currency, organizationCurrency) {
1105
+ const codes = planPricesByCurrency(plan, currency).map(([code]) => code);
1106
+ if (organizationCurrency && !codes.includes(organizationCurrency)) codes.push(organizationCurrency);
1107
+ const named = [...new Set(codes.filter((code) => code !== void 0))];
1108
+ return named.length > 0 ? named.map((code) => [code, 0]) : [[void 0, 0]];
1109
+ }
1020
1110
  function findPlanProduct(products, key, interval) {
1021
1111
  const tagged = (product) => product.metadata;
1022
1112
  return products.find((product) => tagged(product)?.managedBy === MANAGED_BY && tagged(product)?.key === key && tagged(product)?.interval === interval) ?? products.find((product) => tagged(product)?.managedBy === MANAGED_BY && tagged(product)?.key === key && tagged(product)?.interval === void 0 && product.recurringInterval === interval);
@@ -1274,7 +1364,7 @@ async function planBenefits(key, plan, { creditBenefitFor, planCreditKey, benefi
1274
1364
  return [...credits, ...(plan.features ?? []).flatMap((featureKey) => benefitIdByKey.get(featureKey) ?? [])];
1275
1365
  }
1276
1366
  async function syncPassProducts(catalog, context) {
1277
- const { client, ids, managedProducts, ensureProduct, price, currency, quotasByPlan, adopt, dryRun, log } = context;
1367
+ const { client, ids, managedProducts, ensureProduct, price, currency, organizationCurrency, quotasByPlan, adopt, dryRun, log } = context;
1278
1368
  for (const [key, plan, lengths] of giftablePlans(catalog)) {
1279
1369
  const trialDays = trialPassDays(plan.trial);
1280
1370
  const entry = { pass: "", months: {}, ...trialDays === void 0 ? {} : { trialDays } };
@@ -1285,8 +1375,8 @@ async function syncPassProducts(catalog, context) {
1285
1375
  name: `${plan.name} (pass)`,
1286
1376
  description: plan.description,
1287
1377
  recurringInterval: "month",
1288
- // Free is a fixed price of nothing, as the free plan's is.
1289
- prices: price([[currency, 0]], plan),
1378
+ // Free is a fixed price of nothing, as the free plan's is, in each currency of the plan and the organization's.
1379
+ prices: price(zeroPrices(plan, currency, organizationCurrency), plan),
1290
1380
  visibility: "private",
1291
1381
  metadata: { managedBy: MANAGED_BY, key: passKey, passOf: key }
1292
1382
  }), managedProducts.find((item) => isManaged(item.metadata, passKey)), (id) => {
@@ -1332,17 +1422,37 @@ function customerEmailsOff(settings) {
1332
1422
  }
1333
1423
  async function readManagedProducts(polar) {
1334
1424
  const productByKey = {};
1425
+ const keyById = /* @__PURE__ */ new Map();
1335
1426
  for (const product of await listAllPages((page) => productsList(polar, { metadata: { managedBy: MANAGED_BY }, limit: 100, page }))) {
1336
1427
  const { metadata, prices, visibility, benefits } = product;
1337
1428
  if (typeof metadata?.key !== "string") continue;
1338
1429
  const fixed = (prices ?? []).filter((price) => price.amountType === "fixed" && !price.isArchived && typeof price.priceAmount === "number");
1339
- productByKey[metadata.interval === "year" ? planProductKey(metadata.key, "year") : metadata.key] = {
1430
+ const key = metadata.interval === "year" ? planProductKey(metadata.key, "year") : metadata.key;
1431
+ const benefitKeys = (benefits ?? []).flatMap((benefit) => {
1432
+ const tag = benefit.metadata;
1433
+ return tag?.managedBy === MANAGED_BY && typeof tag.key === "string" ? [tag.key] : [];
1434
+ });
1435
+ productByKey[key] = {
1340
1436
  visibility: typeof visibility === "string" ? visibility : "",
1341
1437
  ...fixed.length > 0 ? { prices: Object.fromEntries(fixed.map((price) => [price.priceCurrency ?? "", price.priceAmount])) } : {},
1342
- benefits: benefits?.length ?? 0
1438
+ benefits: benefits?.length ?? 0,
1439
+ benefitKeys
1343
1440
  };
1441
+ keyById.set(product.id, key);
1442
+ }
1443
+ return { productByKey, keyById };
1444
+ }
1445
+ async function readCheckoutLinks(polar, keyById) {
1446
+ try {
1447
+ const links = await listAllPages((page) => checkoutLinksList(polar, { limit: 100, page }));
1448
+ return links.flatMap((link) => {
1449
+ const { label, products } = link;
1450
+ const keys = [...new Set((products ?? []).filter((product) => !product.isArchived).flatMap((product) => keyById.get(product.id) ?? []))];
1451
+ return keys.length > 0 ? [{ label: label ?? null, keys }] : [];
1452
+ });
1453
+ } catch {
1454
+ return void 0;
1344
1455
  }
1345
- return productByKey;
1346
1456
  }
1347
1457
  async function readBillingOrganizationState(options, client) {
1348
1458
  try {
@@ -1357,7 +1467,8 @@ async function readBillingOrganizationState(options, client) {
1357
1467
  benefitTypeByKey[metadata.key] = benefit.type ?? "";
1358
1468
  }
1359
1469
  const { subscriptionSettings: subscription, customerPortalSettings: portal } = organization;
1360
- const productByKey = await readManagedProducts(polar);
1470
+ const { productByKey, keyById } = await readManagedProducts(polar);
1471
+ const checkoutLinks = await readCheckoutLinks(polar, keyById);
1361
1472
  const members = await membersListMembers(polar, { limit: 1 });
1362
1473
  return {
1363
1474
  slug: organization.slug,
@@ -1367,10 +1478,12 @@ async function readBillingOrganizationState(options, client) {
1367
1478
  preventTrialAbuse: subscription.preventTrialAbuse,
1368
1479
  customerEmailsOff: customerEmailsOff(organization.customerEmailSettings),
1369
1480
  portal: { updatePlan: portal.subscription.updatePlan, pause: portal.subscription.pause ?? false },
1481
+ ...typeof organization.defaultPresentmentCurrency === "string" ? { defaultCurrency: organization.defaultPresentmentCurrency.toLowerCase() } : {},
1370
1482
  benefitTypeByKey,
1371
1483
  memberModel: organization.featureSettings?.memberModelEnabled === true,
1372
1484
  membersReadable: members.ok,
1373
- productByKey
1485
+ productByKey,
1486
+ ...checkoutLinks ? { checkoutLinks } : {}
1374
1487
  };
1375
1488
  } catch {
1376
1489
  return null;
@@ -1404,6 +1517,17 @@ function customerEmailsFinding(state) {
1404
1517
  "Turn the provider's customer emails back on in its dashboard (Settings, Customer notifications); the app never sends a copy of them."
1405
1518
  );
1406
1519
  }
1520
+ function checkoutLinksFinding(state) {
1521
+ if (!state.checkoutLinks) return [];
1522
+ if (state.checkoutLinks.length === 0) return [finding("billing-checkout-links", "pass", "No checkout link of the provider's own sells a catalog product: every purchase goes through the app's checkout.")];
1523
+ const links = state.checkoutLinks.map((link) => `${link.label ? `"${link.label}"` : "an unlabelled link"} (${link.keys.join(", ")})`);
1524
+ return [finding(
1525
+ "billing-checkout-links",
1526
+ "warn",
1527
+ `The provider also sells catalog products through checkout links of its own: ${links.join("; ")}. A purchase there names no billing entity, so the buyer pays and the app grants nothing, or a second plan lands beside the free one.`,
1528
+ "Delete those checkout links in the provider's dashboard (Products, Checkout Links), and link to the app's pricing page, whose checkout names the billing entity, instead."
1529
+ )];
1530
+ }
1407
1531
  function stackedSubscriptionsMessage(catalog, offered) {
1408
1532
  const free = freePlanOf(catalog);
1409
1533
  return free ? `The organization lets a customer hold several subscriptions at once beside the free plan (${free[0]}) \u2014 every billing entity holds it, so a checkout outside the package, which does not upgrade it in place, leaves the customer on two plans, and useBilling() reports only the first.` : `The organization lets a customer hold several subscriptions at once while the catalog offers ${offered} plan prices \u2014 someone can end up on two of them, and useBilling() reports only the first.`;
@@ -1460,6 +1584,46 @@ function passProductsFinding(plans, state) {
1460
1584
  "Run `npx nuxt-backend billing sync`: it creates the missing products. Make a public one private in the provider dashboard."
1461
1585
  );
1462
1586
  }
1587
+ function planCreditBenefit(key, plan, interval) {
1588
+ const monthly = interval === "month" || plan.meterCycle === "month";
1589
+ if (!plan.credits || plan.credits.once || planCreditUnits(plan.credits, monthly ? "month" : interval) === void 0) return void 0;
1590
+ return monthly ? `${key}-credits` : `${key}-credits-${interval}`;
1591
+ }
1592
+ function planBenefitProblems(catalog, state) {
1593
+ return Object.entries(catalog.plans ?? {}).filter(([, plan]) => !plan.retired).flatMap(([key, plan]) => pricedIntervals(plan).flatMap((interval) => {
1594
+ const productKey = planProductKey(key, interval);
1595
+ const carried = state.productByKey[productKey]?.benefitKeys;
1596
+ if (!carried) return [];
1597
+ const credits = planCreditBenefit(key, plan, interval);
1598
+ const lacks = [
1599
+ ...credits && !carried.some((name) => name === `${key}-credits` || name.startsWith(`${key}-credits-`)) ? [credits] : [],
1600
+ ...(plan.features ?? []).filter((feature) => feature in (catalog.features ?? {}) && !carried.includes(feature))
1601
+ ];
1602
+ return lacks.length > 0 ? [`product ${productKey} lacks ${lacks.join(", ")}`] : [];
1603
+ }));
1604
+ }
1605
+ function planBenefitsFinding(catalog, state) {
1606
+ const granting = Object.values(catalog.plans ?? {}).some((plan) => !plan.retired && (plan.credits && !plan.credits.once || (plan.features ?? []).length > 0));
1607
+ if (!granting) return [];
1608
+ const problems = planBenefitProblems(catalog, state);
1609
+ return [problems.length === 0 ? finding("billing-plan-benefits", "pass", "Every plan product carries the credits and features the catalog gives its plan.") : finding(
1610
+ "billing-plan-benefits",
1611
+ "warn",
1612
+ `${problems.join("; ")}: ${problems.length === 1 ? "its" : "their"} subscribers are granted none of it.`,
1613
+ "Run `npx nuxt-backend billing sync`: it attaches a missing benefit to the product that exists, and the provider grants it to the product's current subscribers too. A product that grants other credits on the same meter is drift there: swap them in the provider dashboard."
1614
+ )];
1615
+ }
1616
+ function currencyFinding(catalog, state) {
1617
+ const organization = state.defaultCurrency;
1618
+ if (!organization || !catalog.plans && !catalog.packs) return [];
1619
+ const missing = missingOrganizationCurrency(catalog, catalog.currency?.toLowerCase() ?? organization, organization);
1620
+ return [missing.length === 0 ? finding("billing-currency", "pass", `Every plan and pack has a price in ${organization}, the organization's default currency.`) : finding(
1621
+ "billing-currency",
1622
+ "warn",
1623
+ `${organizationCurrencyProblem(missing, organization)}. \`billing sync\` refuses the catalog until they do.`,
1624
+ `Add ${organization} to those prices in billing.catalog.ts and run \`npx nuxt-backend billing sync\`, or make the catalog's currency the organization's default in the provider dashboard.`
1625
+ )];
1626
+ }
1463
1627
  function passFindings(catalog, state) {
1464
1628
  const giftable = giftablePlans(catalog).map(([key, , months]) => [key, months]);
1465
1629
  return giftable.length > 0 ? [passProductsFinding(giftable, state)] : [];
@@ -1489,7 +1653,27 @@ function providerSdkFindings(rootDir) {
1489
1653
  const { version } = sdk;
1490
1654
  return [Number.parseInt(version, 10) >= 1 ? finding("billing-provider-sdk", "warn", `The billing component (@convex-dev/polar 0.9) resolves @polar-sh/sdk ${version}, but it is built on the 0.x SDK, which 1.0 rewrote: checkout, the portal and webhook parsing break on it.`, 'Pin "@polar-sh/sdk": "^0.49.0" in package.json and reinstall, until nuxt-backend supports the 1.x SDK.') : finding("billing-provider-sdk", "pass", `The billing component resolves @polar-sh/sdk ${version}, the line it is built on.`)];
1491
1655
  }
1492
- function collectBillingFindings(catalog, state, { tokenPresent }) {
1656
+ function unreadOrganizationFindings(tokenPresent, deployedToken) {
1657
+ if (tokenPresent) {
1658
+ return [finding(
1659
+ "billing-organization",
1660
+ "warn",
1661
+ "BILLING_ACCESS_TOKEN is set here but the provider would not answer with it (expired, revoked, or issued for the other environment) \u2014 the catalog cross-checks were skipped.",
1662
+ "Issue a fresh organization access token for the billing environment BACKEND_ENVIRONMENT names (the provider sandbox unless it is production), put it in .env.local, and run `npx nuxt-backend env push`."
1663
+ )];
1664
+ }
1665
+ return deployedToken ? [skippedOrganizationFinding(deployedToken.prod)] : [];
1666
+ }
1667
+ function skippedOrganizationFinding(prod) {
1668
+ const flag = prod ? " --prod" : "";
1669
+ return finding(
1670
+ "billing-organization",
1671
+ "warn",
1672
+ `The ${prod ? "production" : "dev"} deployment holds BILLING_ACCESS_TOKEN, and the env doctor reads here does not, so the checks that read the provider were skipped: its organization's settings against the catalog (subscriptions, proration, trials, portal, emails, team customers, checkout links, gift and pass products, feature benefits), the webhook endpoint and the customer mappings.`,
1673
+ `Run them with the deployment's token in the env: \`BILLING_ACCESS_TOKEN=<the deployment's token>${prod ? " BACKEND_ENVIRONMENT=production" : ""} npx nuxt-backend doctor${flag} --only billing\`, or keep it in .env.local.`
1674
+ );
1675
+ }
1676
+ function collectBillingFindings(catalog, state, { tokenPresent, deployedToken = null }) {
1493
1677
  if (!catalog) return [];
1494
1678
  const findings = [];
1495
1679
  const plans = Object.entries(catalog.plans ?? {});
@@ -1513,17 +1697,7 @@ function collectBillingFindings(catalog, state, { tokenPresent }) {
1513
1697
  ));
1514
1698
  }
1515
1699
  findings.push(...promotionLimitsFinding(catalog));
1516
- if (!state) {
1517
- if (tokenPresent) {
1518
- findings.push(finding(
1519
- "billing-organization",
1520
- "warn",
1521
- "BILLING_ACCESS_TOKEN is set here but the provider would not answer with it (expired, revoked, or issued for the other environment) \u2014 the catalog cross-checks were skipped.",
1522
- "Issue a fresh organization access token for the billing environment BACKEND_ENVIRONMENT names (the provider sandbox unless it is production), put it in .env.local, and run `npx nuxt-backend env push`."
1523
- ));
1524
- }
1525
- return findings;
1526
- }
1700
+ if (!state) return [...findings, ...unreadOrganizationFindings(tokenPresent, deployedToken)];
1527
1701
  findings.push(state.allowMultipleSubscriptions && offered > 1 ? finding(
1528
1702
  "billing-multiple-subscriptions",
1529
1703
  "warn",
@@ -1559,6 +1733,9 @@ function collectBillingFindings(catalog, state, { tokenPresent }) {
1559
1733
  findings.push(customerEmailsFinding(state));
1560
1734
  findings.push(...promotionPortalFinding(catalog, state));
1561
1735
  findings.push(teamCustomersFinding(state));
1736
+ findings.push(...checkoutLinksFinding(state));
1737
+ findings.push(...currencyFinding(catalog, state));
1738
+ findings.push(...planBenefitsFinding(catalog, state));
1562
1739
  if (packs.length > 0) findings.push(giftTwinsFinding(packs.map(([key]) => key), state));
1563
1740
  findings.push(...passFindings(catalog, state));
1564
1741
  if (features.length > 0) {
@@ -1611,7 +1788,7 @@ function missingProductionIds(catalog, ids) {
1611
1788
  const discounts = Object.entries(catalog.discounts ?? {}).filter(([key, discount]) => !discount.retired && !ids?.discounts?.[key]).map(([key]) => `discount ${key}`);
1612
1789
  return [...plans, ...packs, ...meters, ...discounts];
1613
1790
  }
1614
- async function productionCatalogFindings(rootDir, environment) {
1791
+ async function productionCatalogFindings(rootDir, environment, launched = true) {
1615
1792
  let catalog;
1616
1793
  let ids;
1617
1794
  try {
@@ -1625,7 +1802,98 @@ async function productionCatalogFindings(rootDir, environment) {
1625
1802
  if (missing.length === 0) return [finding("billing-catalog-production", "pass", "Every plan price, pack, meter and promotion of the catalog has its production id.")];
1626
1803
  const gap = `The catalog has no production id for ${missing.join(", ")}`;
1627
1804
  const hint = "Run npx nuxt-backend billing sync --env production, and commit the billing.generated.ts it writes.";
1628
- return [environment === "production" ? finding("billing-catalog-production", "fail", `${gap}: production refuses their checkout.`, hint) : finding("billing-catalog-production", "warn", `${gap}: once production bills in the production environment, their checkout is refused.`, hint)];
1805
+ if (environment !== "production") return [finding("billing-catalog-production", "warn", `${gap}: once production bills in the production environment, their checkout is refused.`, hint)];
1806
+ return [launched ? finding("billing-catalog-production", "fail", `${gap}: production refuses their checkout.`, hint) : finding("billing-catalog-production", "warn", `${gap}: billing is not launched on production yet, so nothing sells there until it has them.`, hint)];
1807
+ }
1808
+
1809
+ function billingLaunch({ environment, accessToken, products }) {
1810
+ if (!accessToken) return { launched: false, reason: "no_access_token" };
1811
+ if (Object.keys(products ?? {}).length === 0) return { launched: false, reason: "no_catalog" };
1812
+ return { launched: true };
1813
+ }
1814
+
1815
+ function isProviderNotFound(error) {
1816
+ const fields = typeof error === "object" && error !== null ? error : {};
1817
+ return fields.statusCode === 404 || fields.error === "ResourceNotFound";
1818
+ }
1819
+
1820
+ const PROVIDER_COMPONENT = "polar";
1821
+ const SAMPLE_SIZE = 10;
1822
+ const MAPPED_CUSTOMERS_QUERY = `return (await ctx.db.query("customers").take(${SAMPLE_SIZE})).map(customer => customer.id)`;
1823
+ async function readMappedCustomers(rootDir, { prod }) {
1824
+ try {
1825
+ const { stdout } = await runConvex(rootDir, ["run", ...deploymentFlags({ prod }), "--component", PROVIDER_COMPONENT, "--inline-query", MAPPED_CUSTOMERS_QUERY]);
1826
+ const ids = JSON.parse(stdout);
1827
+ return Array.isArray(ids) && ids.every((id) => typeof id === "string") ? ids : null;
1828
+ } catch {
1829
+ return null;
1830
+ }
1831
+ }
1832
+ async function checkMappedCustomers(client, ids) {
1833
+ try {
1834
+ const answers = await Promise.all(ids.map(async (id) => {
1835
+ const found = await customersGet(client, { id });
1836
+ if (found.ok) return "known";
1837
+ return isProviderNotFound(found.error) ? "unknown" : "unread";
1838
+ }));
1839
+ if (answers.includes("unread")) return null;
1840
+ return { sampled: ids.length, unknown: answers.filter((answer) => answer === "unknown").length };
1841
+ } catch {
1842
+ return null;
1843
+ }
1844
+ }
1845
+ function customerMappingFindings(read, { prod }) {
1846
+ if (!read) return [];
1847
+ if (read.sampled === 0) return [finding("billing-customer-mapping", "pass", "No billing entity is mapped onto a provider customer yet.")];
1848
+ if (read.unknown === 0) return [finding("billing-customer-mapping", "pass", `The provider knows the ${read.sampled === 1 ? "customer" : `${read.sampled} customers`} the deployment maps billing entities onto (a sample).`)];
1849
+ const message = read.unknown === read.sampled ? `The provider knows none of the ${read.sampled === 1 ? "customer" : `${read.sampled} customers`} the deployment maps billing entities onto: the deployment's billing data belongs to another organization than the one BILLING_ACCESS_TOKEN names (a new sandbox, say).` : `The provider does not know ${read.unknown} of the ${read.sampled} customers the deployment maps billing entities onto (a sample): billing data from another organization than the one BILLING_ACCESS_TOKEN names, or customers deleted at the provider.`;
1850
+ return [finding(
1851
+ "billing-customer-mapping",
1852
+ "warn",
1853
+ `${message} Checkout, the portal and the free plan are refused for ${read.unknown === 1 ? "that entity" : "those entities"} (unavailable, reason customer_unknown).`,
1854
+ prod ? "Point production's BILLING_ACCESS_TOKEN back at the organization its billing data came from (`npx convex env set --prod BILLING_ACCESS_TOKEN` asks for it). `billing reset` clears a dev deployment only." : "Run `npx nuxt-backend billing reset`: it syncs the catalog to the organization, clears the deployment's billing data and puts every billing entity back on the free plan. Or point BILLING_ACCESS_TOKEN back at the organization the data came from."
1855
+ )];
1856
+ }
1857
+
1858
+ const PRELAUNCH_FINDINGS = /* @__PURE__ */ new Set([
1859
+ "billing-access",
1860
+ "deployment-billing-access-token",
1861
+ "billing-webhook-secret",
1862
+ "deployment-billing-webhook-secret",
1863
+ "billing-webhook-route",
1864
+ "billing-catalog-production"
1865
+ ]);
1866
+ async function productionBillingLaunch(rootDir, deployed) {
1867
+ try {
1868
+ if (!(await loadCatalog(rootDir))?.catalog) return null;
1869
+ const products = (await loadGenerated(rootDir)).production?.products;
1870
+ return billingLaunch({ environment: "production", accessToken: deployed.includes("BILLING_ACCESS_TOKEN"), products });
1871
+ } catch {
1872
+ return null;
1873
+ }
1874
+ }
1875
+ const NOT_LAUNCHED_BECAUSE = {
1876
+ no_access_token: "it bills in the provider's production environment and holds no BILLING_ACCESS_TOKEN",
1877
+ no_catalog: "it holds BILLING_ACCESS_TOKEN, but billing.generated.ts has no production products (billing sync --env production has not run)"
1878
+ };
1879
+ function launchSteps(reason) {
1880
+ const token = "put the live organization token in .env.local as BILLING_ACCESS_TOKEN and run `npx nuxt-backend env push --prod`; ";
1881
+ return `Once the provider has reviewed the organization: ${reason === "no_access_token" ? token : ""}run \`npx nuxt-backend billing sync --env production\` with production's deploy key, commit and deploy the billing.generated.ts it writes, then start everyone who joined meanwhile on the free plan: \`npx convex run --prod billing:startFreePlan '{}'\`.`;
1882
+ }
1883
+ function billingLaunchFinding(launch) {
1884
+ if (launch.launched) return finding("billing-launch", "pass", "Billing is launched on production: it holds BILLING_ACCESS_TOKEN and the catalog has production products, so its pricing sells.");
1885
+ return finding(
1886
+ "billing-launch",
1887
+ "warn",
1888
+ `Billing is not launched on production yet: ${NOT_LAUNCHED_BECAUSE[launch.reason]}. Its pricing reads "Plans open soon" and every sale is refused (unavailable, reason not_launched); the rest of the app runs. Until it launches, the token, webhook and production catalog findings warn rather than fail.`,
1889
+ launchSteps(launch.reason)
1890
+ );
1891
+ }
1892
+ function withBillingLaunch(findings, launch) {
1893
+ const said = launch.launched ? [...findings] : findings.map((reported) => PRELAUNCH_FINDINGS.has(reported.id) && reported.status === "warn" ? { ...reported, message: `${reported.message} (billing is not launched yet: see billing-launch)` } : reported);
1894
+ const at = said.findIndex((reported) => reported.capability === "billing");
1895
+ const led = at === -1 ? [...said, billingLaunchFinding(launch)] : [...said.slice(0, at), billingLaunchFinding(launch), ...said.slice(at)];
1896
+ return { findings: led, settled: launch.launched ? [] : [...PRELAUNCH_FINDINGS] };
1629
1897
  }
1630
1898
 
1631
1899
  const CUSTOMER_EMAILS = [
@@ -2422,20 +2690,35 @@ async function docsFinding(input, fetcher) {
2422
2690
  return [finding("agent-docs", "warn", `The app declares docs for agents (llms), and ${url} answered ${response?.status ?? "nothing"}${response?.status === 200 ? " with no text document" : ""}.`, "Check the llms options in nuxt.config, and that the build ran its module.")];
2423
2691
  }
2424
2692
  const STATES = /* @__PURE__ */ new Set(["live", "test", "missing", "failing"]);
2425
- async function healthFinding(input, fetcher) {
2426
- const url = `${input.origin}${HEALTH_ROUTE}`;
2693
+ async function readHealth(url, fetcher) {
2427
2694
  const response = await probe(url, { headers: { accept: "application/json" } }, fetcher);
2428
- if (!response) return finding("monitoring-health", "warn", `${url} did not answer.`, "Check the app host's logs.");
2429
- if (response.status === 404) return finding("monitoring-health", "warn", `${url} is not served (404): an uptime check has nothing to ask.`, "Check that the app was built with this package.");
2695
+ if (!response) return { found: finding("monitoring-health", "warn", `${url} did not answer.`, "Check the app host's logs."), answers: false };
2696
+ if (response.status === 404) return { found: finding("monitoring-health", "warn", `${url} is not served (404): an uptime check has nothing to ask.`, "Check that the app was built with this package."), answers: false };
2430
2697
  const body = response.status === 200 || response.status === 503 ? await jsonOf(response) : null;
2431
2698
  const capabilities = body?.capabilities;
2432
2699
  const shaped = body && ["ok", "degraded", "failing"].includes(body.status) && typeof capabilities === "object" && capabilities !== null && Object.values(capabilities).every((state) => STATES.has(state));
2433
- if (!shaped) return finding("monitoring-health", "warn", `${url} answered ${response.status} without the health's shape ({ status, capabilities }).`, "A route of your own shadows it, or a proxy rewrote the answer.");
2700
+ if (!shaped) return { found: finding("monitoring-health", "warn", `${url} answered ${response.status} without the health's shape ({ status, capabilities }).`, "A route of your own shadows it, or a proxy rewrote the answer."), answers: false };
2701
+ return { found: shapedHealthFinding(url, body, capabilities), answers: true };
2702
+ }
2703
+ function shapedHealthFinding(url, body, capabilities) {
2434
2704
  if ("detail" in body) return finding("monitoring-health", "fail", `${url} shows the capabilities' detail to an anonymous caller: their env names and findings.`, "Production names itself development (BACKEND_ENVIRONMENT), which shows the detail to everyone: name it production with npx nuxt-backend env push --prod --force BACKEND_ENVIRONMENT (env push leaves a value already set unless forced).");
2435
2705
  const failing = Object.entries(capabilities).filter(([, state]) => state === "failing").map(([name]) => name);
2436
2706
  if (body.status === "failing") return finding("monitoring-health", "warn", `${url} answers its public shape, and reports the app failing (${failing.join(", ") || "the backend unreachable"}).`, "npx nuxt-backend status --prod says why.");
2437
2707
  return finding("monitoring-health", "pass", `${url} answers its public shape: ${body.status}, ${Object.keys(capabilities).length} capabilities, no detail.`);
2438
2708
  }
2709
+ function uptimeFinding(url) {
2710
+ return finding(
2711
+ "monitoring-uptime",
2712
+ "pass",
2713
+ `Not checked: whether an uptime monitor asks ${url}. doctor reads no monitoring account; the endpoint answers its public shape, so a monitor has something to ask.`,
2714
+ `Without one, an outage is heard of when someone reports it. In Sentry: Monitors, Add Monitor, Uptime, at ${url}, every minute; it opens an issue after three failures in a row. Any uptime service that GETs the URL works the same way.`
2715
+ );
2716
+ }
2717
+ async function healthFindings(input, fetcher) {
2718
+ const url = `${input.origin}${HEALTH_ROUTE}`;
2719
+ const { found, answers } = await readHealth(url, fetcher);
2720
+ return answers ? [found, uptimeFinding(url)] : [found];
2721
+ }
2439
2722
  const PROBE_IDS = [["site", "site-https"], ["auth", "site-gated-page"], ["monitoring", "monitoring-health"]];
2440
2723
  function unprobedSiteFindings(why, fixHint, wants) {
2441
2724
  const first = PROBE_IDS.find(([group]) => wants(group));
@@ -2450,7 +2733,7 @@ async function siteProbeFindings(input, fetcher = fetch) {
2450
2733
  input.wants("auth") ? gatedPageFinding(input, fetcher) : [],
2451
2734
  input.wants("auth") ? authProxyFinding(input, fetcher) : [],
2452
2735
  input.wants("site") ? docsFinding(input, fetcher) : [],
2453
- input.wants("monitoring") ? healthFinding(input, fetcher) : []
2736
+ input.wants("monitoring") ? healthFindings(input, fetcher) : []
2454
2737
  ]);
2455
2738
  return results.flat();
2456
2739
  }
@@ -2479,7 +2762,8 @@ async function loadedBackendOptions(appConfig) {
2479
2762
  return config ? pathsSourceOf(config) : null;
2480
2763
  }
2481
2764
  async function generatedFileFindings(rootDir, appConfig) {
2482
- return [codegenFinding(rootDir), ...pathsFileFinding(rootDir, await loadedBackendOptions(appConfig)), ...brandFileFinding(rootDir, await appBrandOf(await appConfig()))];
2765
+ const config = await appConfig();
2766
+ return [codegenFinding(rootDir), ...pathsFileFinding(rootDir, await loadedBackendOptions(appConfig)), ...brandFileFinding(rootDir, await appBrandOf(config)), ...labelsFileFinding(rootDir, await appLabelsOf(config))];
2483
2767
  }
2484
2768
  async function installableFindings(rootDir, appConfig, { wanted, pushKeys }) {
2485
2769
  const config = wanted ? await appConfig() : null;
@@ -2489,7 +2773,9 @@ async function installableFindings(rootDir, appConfig, { wanted, pushKeys }) {
2489
2773
  return typeof name === "string" ? [name] : [];
2490
2774
  });
2491
2775
  const publicDir = join(rootDir, config.dir?.public ?? "public");
2492
- return installableFinding(publicDir, await appBrandOf(config), { modules, pushKeys });
2776
+ const options = pathsSourceOf(config).installable;
2777
+ const links = config.app?.head?.link ?? [];
2778
+ return installableFinding(publicDir, await appBrandOf(config), { modules, pushKeys, options, links });
2493
2779
  }
2494
2780
  function servesAgentDocs(config) {
2495
2781
  return config?.llms !== void 0 || (config?.modules ?? []).some((entry) => (Array.isArray(entry) ? entry[0] : entry) === "nuxt-llms");
@@ -2544,7 +2830,7 @@ async function pagePathFindings(appConfig, deployed) {
2544
2830
  "Pass the `paths` of paths.generated.ts to defineBackendAuthConfig (auth.config.ts), setupAuth (auth.ts) and setupAccount (account.ts), then let `npx convex dev` push or deploy."
2545
2831
  )];
2546
2832
  }
2547
- async function billingCatalogFindings(rootDir, env) {
2833
+ async function billingCatalogFindings(rootDir, env, { deployed, prod = false } = {}) {
2548
2834
  let catalog;
2549
2835
  try {
2550
2836
  catalog = (await loadCatalog(rootDir))?.catalog ?? null;
@@ -2555,7 +2841,8 @@ async function billingCatalogFindings(rootDir, env) {
2555
2841
  const accessToken = env.BILLING_ACCESS_TOKEN;
2556
2842
  const environment = billingEnvironment(parseBackendEnvironment(env.BACKEND_ENVIRONMENT));
2557
2843
  const state = accessToken ? await readBillingOrganizationState({ accessToken, environment }) : null;
2558
- return collectBillingFindings(catalog, state, { tokenPresent: Boolean(accessToken) });
2844
+ const deployedToken = !accessToken && (await deployed)?.includes("BILLING_ACCESS_TOKEN") ? { prod } : null;
2845
+ return collectBillingFindings(catalog, state, { tokenPresent: Boolean(accessToken), deployedToken });
2559
2846
  }
2560
2847
  async function probeWebhookRoute(url) {
2561
2848
  try {
@@ -2610,6 +2897,20 @@ async function billingEndpointCheck(env, { prod, siteUrl }) {
2610
2897
  const url = `${siteUrl.replace(/\/+$/, "")}/billing/events`;
2611
2898
  return billingEndpointFindings(await readProviderEndpoint(providerClient(target.accessToken, target.environment), url), url);
2612
2899
  }
2900
+ async function customerMappingCheck(rootDir, env, { prod }) {
2901
+ const target = billingProviderTarget(env, prod);
2902
+ if (!target) return [];
2903
+ const ids = await readMappedCustomers(rootDir, { prod });
2904
+ if (!ids) return [];
2905
+ return customerMappingFindings(await checkMappedCustomers(providerClient(target.accessToken, target.environment), ids), { prod });
2906
+ }
2907
+ async function billingProviderFindings(rootDir, env, { prod, reachable, siteUrl }) {
2908
+ const [endpoint, mappings] = await Promise.all([
2909
+ siteUrl ? billingEndpointCheck(env, { prod, siteUrl }) : [],
2910
+ reachable ? customerMappingCheck(rootDir, env, { prod }) : []
2911
+ ]);
2912
+ return [...endpoint, ...mappings];
2913
+ }
2613
2914
  async function emailSetupFindings(rootDir, { prod, reachable, identifiers }) {
2614
2915
  if (!reachable || !identifiers?.has("email:syncEmail")) return [];
2615
2916
  try {
@@ -2656,6 +2957,9 @@ function listed(names) {
2656
2957
  return names.length < 2 ? names.join("") : `${names.slice(0, -1).join(", ")} and ${names.at(-1)}`;
2657
2958
  }
2658
2959
  const CONVEX_GATEWAY_PROVIDER = "@convex-dev/ai-sdk-provider";
2960
+ const keyFix = (flag) => flag ? GATEWAY_KEY_FIX.prod : GATEWAY_KEY_FIX.dev;
2961
+ const routesNameConvex = (routes) => routes === "unread" || Object.values(routes ?? {}).some((order) => order.includes("convex"));
2962
+ const namesConvex = (order) => order === void 0 || order === "unread" || order.includes("convex");
2659
2963
  const SPENDING_LIMIT = "Cap its spend with `npx convex deployment usage-limits set` (the `aiGatewayCostDollars` limit).";
2660
2964
  function convexGatewayProviderInstalled(rootDir) {
2661
2965
  try {
@@ -2677,29 +2981,104 @@ function cloudRouteFinding(id, models, { keyed, provider, flag }) {
2677
2981
  id,
2678
2982
  "warn",
2679
2983
  `The backend names ${listed(models)}, but no model route is ready on the deployment: ${CONVEX_GATEWAY_PROVIDER} is not installed and AI_GATEWAY_API_KEY is not set, so those model calls are refused.`,
2680
- `Install ${CONVEX_GATEWAY_PROVIDER} (\`pnpm add ${CONVEX_GATEWAY_PROVIDER}\`) to use the Convex AI Gateway on a paid plan, or add AI_GATEWAY_API_KEY to .env.local and run \`npx nuxt-backend env push${flag}\`.`
2984
+ `${keyFix(flag)} Or install ${CONVEX_GATEWAY_PROVIDER} (\`pnpm add ${CONVEX_GATEWAY_PROVIDER}\`) to use the Convex AI Gateway on a paid plan.`
2681
2985
  );
2682
2986
  }
2683
- function gatewayKeyFinding(deployed, { models, local, cloud, provider, prod, region }) {
2987
+ function convexRouteFinding(id, models, { cloud, linked, local, provider, keyed, alone, flag }) {
2988
+ const how = alone ? `setupAi({ gateway: 'convex' }) sends ${listed(models)} through the Convex AI Gateway alone` : `AI_GATEWAY_API_KEY is not set on the deployment, so ${listed(models)} go through the Convex AI Gateway, next in setupAi({ gateway })`;
2989
+ const elsewhere = alone ? `Add 'vercel' to setupAi({ gateway }), then: ${keyFix(flag)}` : keyFix(flag);
2990
+ const install = `Install ${CONVEX_GATEWAY_PROVIDER} (\`pnpm add ${CONVEX_GATEWAY_PROVIDER}\`)`;
2991
+ if (!provider) {
2992
+ return finding(id, "warn", `${how}, but ${CONVEX_GATEWAY_PROVIDER} is not installed: those model calls are refused.`, alone ? `${install}, or: ${elsewhere}` : `${elsewhere} Or: ${install}.`);
2993
+ }
2994
+ if (cloud || linked) {
2995
+ const unused = alone && keyed ? " AI_GATEWAY_API_KEY is set on the deployment and never read." : "";
2996
+ const whose = cloud ? "the team" : "the team of the project this local deployment is linked to";
2997
+ return finding(id, "pass", `${how}, which bills ${whose}; a free plan refuses it (AiGatewayDisabled), and no other gateway is tried.${unused} ${SPENDING_LIMIT}`);
2998
+ }
2999
+ if (local) {
3000
+ const login = "Run `npx convex login` to link the local deployment to a project on a paid plan, then restart `npx nuxt-backend dev`.";
3001
+ return finding(id, "warn", `${how}, which an anonymous local deployment cannot reach: those model calls are refused.`, alone ? `${login} Or: ${elsewhere}` : `${elsewhere} Or: ${login}`);
3002
+ }
3003
+ return finding(id, "warn", `${how}, which a self-hosted deployment never has: those model calls are refused.`, elsewhere);
3004
+ }
3005
+ function gatewayKeyFinding(deployed, { models, local, linked, cloud, provider, prod, region, gateways = ["convex", "vercel"], routes }) {
2684
3006
  const id = deploymentEnvId("AI_GATEWAY_API_KEY");
2685
3007
  const flag = prod ? " --prod" : "";
2686
3008
  const keyed = deployed.includes("AI_GATEWAY_API_KEY");
2687
3009
  if (models.length === 0) {
2688
3010
  return finding(id, "pass", keyed ? "AI_GATEWAY_API_KEY is set on the deployment." : "AI_GATEWAY_API_KEY is not set, and no backend file names a provider/model id that needs a model route.");
2689
3011
  }
2690
- if (region) {
2691
- if (keyed) return finding(id, "pass", `AI_GATEWAY_API_KEY is set on the deployment: ${listed(models)} go through the Vercel AI Gateway, pinned to the '${region}' inference region.`);
2692
- return finding(id, "warn", `The backend pins its model calls to the '${region}' inference region, which only the Vercel AI Gateway serves, but AI_GATEWAY_API_KEY is not set on the deployment: ${listed(models)} are refused.`, `Add AI_GATEWAY_API_KEY to .env.local and run \`npx nuxt-backend env push${flag}\`.`);
2693
- }
2694
- if (cloud) return cloudRouteFinding(id, models, { keyed, provider, flag });
3012
+ if (gateways === "unread" || routes === "unread") return unreadOrderFinding(id, models, routes === "unread" ? "routes" : "gateway");
3013
+ const routeless = Object.entries(routes ?? {}).find(([, order]) => !order.includes("vercel"))?.[0];
3014
+ if (region) return regionRouteFinding(id, models, { region, keyed, vercel: gateways.includes("vercel"), routeless, flag });
3015
+ const facts = { keyed, cloud, linked, local, provider, flag };
3016
+ const groups = routedGroups(models, gateways, routes);
3017
+ if (groups.length === 1 && groups[0].key === void 0) return orderRouteFinding(id, models, { gateways, ...facts });
3018
+ return routesFinding(id, groups.map((group) => ({ group, found: orderRouteFinding(id, group.models, { gateways: group.order, ...facts }) })));
3019
+ }
3020
+ function unreadOrderFinding(id, models, option) {
3021
+ const literal = option === "gateway" ? "'convex', 'vercel' or a list of them" : "a map of quoted model ids or patterns to 'convex', 'vercel' or a list of them";
3022
+ return finding(
3023
+ id,
3024
+ "warn",
3025
+ `${GATEWAY_ORDER_UNREAD}: setupAi({ ${option} }) is no literal it reads (a variable, the shorthand { ${option} }, ${option === "gateway" ? "an empty list" : "a computed key"}, spread options, or two setupAi calls that differ), so the route of ${listed(models)} is not checked.`,
3026
+ `Write \`${option}\` in setupAi as ${literal}, in one setupAi call, then run doctor again.`
3027
+ );
3028
+ }
3029
+ function routedGroups(models, gateways, routes) {
3030
+ const groups = /* @__PURE__ */ new Map();
3031
+ for (const model of models) {
3032
+ const key = routes ? routeKeyFor(model, routes) : void 0;
3033
+ const group = groups.get(key) ?? { key, order: key === void 0 ? gateways : routes[key], models: [] };
3034
+ group.models.push(model);
3035
+ groups.set(key, group);
3036
+ }
3037
+ return [...groups.values()];
3038
+ }
3039
+ const STATUS_RANK = { pass: 0, warn: 1, fail: 2 };
3040
+ function routesFinding(id, parts) {
3041
+ const routed = (text, key) => text.replace(/setupAi\(\{ gateway(?:: '[a-z]+')? \}\)/g, `its route '${key}' in setupAi({ routes })`);
3042
+ const said = parts.map(({ group, found }) => {
3043
+ if (group.key === void 0) return { ...found, message: `Under setupAi({ gateway })'s order: ${found.message}` };
3044
+ const unread = group.order.length === 1 && group.order[0] === "convex" ? ` AI_GATEWAY_API_KEY is never read for ${listed(group.models)}.` : "";
3045
+ return { ...found, message: `Routed by '${group.key}' (${group.order.join(", then ")}): ${routed(found.message, group.key)}${unread}`, fixHint: routed(found.fixHint, group.key) };
3046
+ });
3047
+ const worst = said.reduce((a, b) => STATUS_RANK[b.status] > STATUS_RANK[a.status] ? b : a);
3048
+ const hints = [...new Set(said.map((part) => part.fixHint).filter(Boolean))].sort((a, b) => Number(gatewayKeyIsTheFix({ fixHint: b })) - Number(gatewayKeyIsTheFix({ fixHint: a })));
3049
+ return finding(id, worst.status, said.map((part) => part.message).join(" "), hints.join(" "));
3050
+ }
3051
+ function orderRouteFinding(id, models, { gateways, ...facts }) {
3052
+ const vercelFirst = gateways[0] === "vercel";
3053
+ if (!gateways.includes("convex")) return vercelRouteFinding(id, models, facts);
3054
+ if (vercelFirst && facts.keyed) return finding(id, "pass", `AI_GATEWAY_API_KEY is set on the deployment: ${listed(models)} go through the Vercel AI Gateway, first in setupAi({ gateway }).`);
3055
+ if (vercelFirst || !gateways.includes("vercel")) return convexRouteFinding(id, models, { ...facts, alone: !vercelFirst });
3056
+ return defaultRouteFinding(id, models, facts);
3057
+ }
3058
+ function vercelRouteFinding(id, models, { keyed, flag }) {
3059
+ if (keyed) return finding(id, "pass", `AI_GATEWAY_API_KEY is set on the deployment: ${listed(models)} go through the Vercel AI Gateway (setupAi({ gateway: 'vercel' })).`);
3060
+ return finding(id, "warn", `setupAi({ gateway: 'vercel' }) sends ${listed(models)} through the Vercel AI Gateway alone, but AI_GATEWAY_API_KEY is not set on the deployment: those model calls are refused.`, keyFix(flag));
3061
+ }
3062
+ function defaultRouteFinding(id, models, { cloud, linked, local, provider, keyed, flag }) {
3063
+ if (cloud || linked) return cloudRouteFinding(id, models, { keyed, provider, flag });
2695
3064
  if (keyed) return finding(id, "pass", `AI_GATEWAY_API_KEY is set on the deployment: ${listed(models)} go through the Vercel AI Gateway.`);
2696
3065
  return finding(
2697
3066
  id,
2698
3067
  "warn",
2699
- `The backend names ${listed(models)}, but AI_GATEWAY_API_KEY is not set on the deployment${local && provider ? ", so those model calls go to the Convex AI Gateway only when the deployment is linked to a team that has it, and are refused otherwise" : ": those model calls are refused"}.`,
2700
- `Add AI_GATEWAY_API_KEY to .env.local and run \`npx nuxt-backend env push${flag}\`.`
3068
+ `The backend names ${listed(models)}, but AI_GATEWAY_API_KEY is not set on the deployment${local && provider ? ", and an anonymous local deployment cannot reach the Convex AI Gateway: those model calls are refused" : ": those model calls are refused"}.`,
3069
+ local && provider ? `${keyFix(flag)} Or run \`npx convex login\` to link the local deployment to a project on a paid plan.` : keyFix(flag)
2701
3070
  );
2702
3071
  }
3072
+ function regionRouteFinding(id, models, { region, keyed, vercel, routeless, flag }) {
3073
+ if (!vercel) {
3074
+ return finding(id, "warn", `The backend pins its model calls to the '${region}' inference region, which only the Vercel AI Gateway serves, but setupAi({ gateway }) does not name 'vercel': setupAi refuses the pin, and the push fails.`, "Add 'vercel' to setupAi({ gateway }), or drop inferenceRegion.");
3075
+ }
3076
+ if (routeless) {
3077
+ return finding(id, "warn", `The backend pins its model calls to the '${region}' inference region, which only the Vercel AI Gateway serves, but the route for '${routeless}' in setupAi({ routes }) does not name 'vercel': setupAi refuses the pin, and the push fails.`, `Add 'vercel' to the route for '${routeless}', or drop inferenceRegion.`);
3078
+ }
3079
+ if (keyed) return finding(id, "pass", `AI_GATEWAY_API_KEY is set on the deployment: ${listed(models)} go through the Vercel AI Gateway, pinned to the '${region}' inference region.`);
3080
+ return finding(id, "warn", `The backend pins its model calls to the '${region}' inference region, which only the Vercel AI Gateway serves, but AI_GATEWAY_API_KEY is not set on the deployment: ${listed(models)} are refused.`, keyFix(flag));
3081
+ }
2703
3082
  function provenanceKeyFinding(name, deployed, { on, prod }) {
2704
3083
  const id = deploymentEnvId(name);
2705
3084
  if (!on) return finding(id, "pass", `${name} is not needed: no backend file turns provenance on.`);
@@ -2745,10 +3124,10 @@ function declaredFeatureFindings(rootDir, { wants, deployed, prod }) {
2745
3124
  ];
2746
3125
  }
2747
3126
  function deploymentRoute(kind, prod) {
2748
- if (prod) return { local: false, cloud: kind !== "self-hosted" };
2749
- return { local: ["local", "anonymous"].includes(kind), cloud: ["cloud-dev", "preview", "production"].includes(kind) };
3127
+ if (prod) return { local: false, linked: false, cloud: kind !== "self-hosted" };
3128
+ return { local: ["local", "anonymous"].includes(kind), linked: kind === "local", cloud: ["cloud-dev", "preview", "production"].includes(kind) };
2750
3129
  }
2751
- function deploymentEnvFindings(rootDir, deployed, { prod, local, cloud, posture }) {
3130
+ function deploymentEnvFindings(rootDir, deployed, { prod, local, linked, cloud, posture }) {
2752
3131
  const sandboxInbox = prod && posture?.environment === "sandbox" && reExportsName(rootDir, "getSandboxInbox");
2753
3132
  if (!deployed) {
2754
3133
  return [finding("deployment-env", "warn", "Could not read the deployment env (no deployment configured, or `npx convex env list` failed).", "Run `npx convex dev` once to provision, then re-run doctor.")];
@@ -2759,17 +3138,81 @@ function deploymentEnvFindings(rootDir, deployed, { prod, local, cloud, posture
2759
3138
  // A name with no finding of its own (the marketing sender, the region) reports nothing yet.
2760
3139
  // The dev inbox's opt-in reports only once it is set: unset is every app's state, and nothing to say.
2761
3140
  ...Object.entries(OPTIONAL_DEPLOYMENT_ENV).filter(([name]) => !name.startsWith("PROTECTION_") && BACKEND_ENV[name].findings.length > 0 && (name !== "EMAIL_DEV_INBOX" || deployed.includes(name) || sandboxInbox)).map(([name, degradation]) => {
2762
- if (name === "AI_GATEWAY_API_KEY") return gatewayKeyFinding(deployed, { models: namedModels(rootDir), local, cloud, provider: convexGatewayProviderInstalled(rootDir), prod, region: pinnedRegion(rootDir) });
3141
+ if (name === "AI_GATEWAY_API_KEY") return gatewayKeyFinding(deployed, { models: namedModels(rootDir), local, linked, cloud, provider: convexGatewayProviderInstalled(rootDir), prod, region: pinnedRegion(rootDir), gateways: chosenGateways(rootDir), routes: chosenRoutes(rootDir) });
2763
3142
  if (name === "PROVENANCE_PRIVATE_KEY" || name === "PROVENANCE_CERTIFICATE") return provenanceKeyFinding(name, deployed, { on: usesProvenance(rootDir), prod });
3143
+ if (isModerationKey(name)) return moderationKeyFinding(name, moderationProviders(rootDir), deployed, { prod });
2764
3144
  if (name === "MONITORING_DSN") return monitoringDsnFinding(deployed.includes(name), { prod });
2765
3145
  if (name === "EMAIL_DEV_INBOX") return devInboxFinding({ prod, posture, set: deployed.includes(name) });
2766
3146
  const valued = posture ? productionEnvFinding(name, deployed, posture) : null;
2767
3147
  if (valued) return valued;
2768
3148
  return optionalDeploymentEnvFinding(name, degradation, deployed.includes(name), { prod });
2769
3149
  }),
2770
- removedEnvFinding(deployed, { prod })
3150
+ removedEnvFinding(deployed, { prod }),
3151
+ moderationImagesFinding(rootDir, deployed, { cloud, linked, prod }),
3152
+ moderationProvidersFinding(rootDir)
2771
3153
  ];
2772
3154
  }
3155
+ const EU_AZURE_REGIONS = /* @__PURE__ */ new Set(["austriaeast", "belgiumcentral", "denmarkeast", "francecentral", "francesouth", "germanynorth", "germanywestcentral", "italynorth", "northeurope", "polandcentral", "spaincentral", "swedencentral", "swedensouth", "westeurope"]);
3156
+ function moderationProvidersFinding(rootDir) {
3157
+ const id = "ai-moderation-providers";
3158
+ const providers = moderationProviders(rootDir);
3159
+ if (providers.length === 0) return finding(id, "pass", "The backend names no moderation provider: its safety classifier checks content alone.");
3160
+ const knownAbuse = providers.some((provider) => provider.id === "arachnid-shield");
3161
+ const problems = [unmatchedImages(rootDir, knownAbuse), regionOutsideEu(rootDir, providers)].filter((problem) => problem !== void 0);
3162
+ const minors = checksImages(rootDir) ? ` ${MINORS_NOTE}` : "";
3163
+ if (problems.length === 0) return finding(id, "pass", `The backend names ${listed(providers.map((provider) => provider.id))}${knownAbuse ? ", a known-abuse match first" : ""}.${minors}`);
3164
+ return finding(id, "warn", `${problems.map((problem) => problem.message).join(" ")}${minors}`, problems.map((problem) => problem.fix).join(" "));
3165
+ }
3166
+ const MINORS_NOTE = "No image provider judges minors in an image: child sexual abuse material no hash list knows is caught as `S4` by a classifier that reads images (Llama Guard 4), and otherwise only as `sexual`, which `block` covers.";
3167
+ const MODERATION_KEYS = /* @__PURE__ */ new Set(["CONTENT_SAFETY_ENDPOINT", "CONTENT_SAFETY_KEY", "SECOND_OPINION_KEY", "KNOWN_ABUSE_KEY"]);
3168
+ function isModerationKey(name) {
3169
+ return MODERATION_KEYS.has(name);
3170
+ }
3171
+ function moderationKeyFinding(name, providers, deployed, { prod }) {
3172
+ const id = deploymentEnvId(name);
3173
+ const readers = providers.filter((provider) => provider.env.includes(name)).map((provider) => provider.id);
3174
+ if (readers.length === 0) return finding(id, "pass", `${name} is not needed: no backend file names a moderation provider that reads it.`);
3175
+ if (deployed.includes(name)) return finding(id, "pass", `${name} is set on the deployment: ${listed(readers)} can check content.`);
3176
+ return finding(
3177
+ id,
3178
+ "warn",
3179
+ `The backend names ${listed(readers)}, but ${name} is not set on the deployment: every check it is asked for is refused, and the content is refused as unchecked.`,
3180
+ `Add ${name} to .env.local and run \`npx nuxt-backend env push${prod ? " --prod" : ""}\`.`
3181
+ );
3182
+ }
3183
+ function unmatchedImages(rootDir, knownAbuse) {
3184
+ if (knownAbuse || !checksImages(rootDir)) return void 0;
3185
+ return { message: "The backend checks images with no known-abuse match: no hash list stands between an upload of known child sexual abuse material and the other providers.", fix: "Add `knownAbuse: arachnidShield()` to setupAi({ moderation }) (free once your organization is vetted)." };
3186
+ }
3187
+ function regionOutsideEu(rootDir, providers) {
3188
+ const azure = providers.find((provider) => provider.id === "azure-content-safety");
3189
+ if (pinnedRegion(rootDir) !== "eu" || azure === void 0 || EU_AZURE_REGIONS.has(azure.region ?? "")) return void 0;
3190
+ const named = azure.region ? `'${azure.region}'` : "no region";
3191
+ return { message: `The backend pins its model calls to the EU, but azureContentSafety() names ${named}, which is no EU region: images it checks are processed outside the EU.`, fix: "Create the Content Safety resource in an EU region, such as francecentral, and name it in azureContentSafety({ region })." };
3192
+ }
3193
+ function answeringGateway(order, { keyed, convex }) {
3194
+ return order.find((gateway) => gateway === "vercel" ? keyed : convex);
3195
+ }
3196
+ function moderationImagesFinding(rootDir, deployed, { cloud, linked, prod }) {
3197
+ const id = "ai-moderation-images";
3198
+ if (!checksImages(rootDir)) return finding(id, "pass", "No backend file checks images with the safety classifier.");
3199
+ if (namesModerationModel(rootDir)) return finding(id, "pass", "The backend checks images with the classifier it names in setupAi({ moderation: { model } }).");
3200
+ const order = chosenGateways(rootDir);
3201
+ const routes = chosenRoutes(rootDir);
3202
+ if (order === "unread" || routes === "unread") return finding(id, "pass", `${GATEWAY_ORDER_UNREAD}, so which classifier checks the backend's images is not known.`);
3203
+ const pinned = pinnedRegion(rootDir) !== void 0;
3204
+ const convex = (cloud || linked || prod) && convexGatewayProviderInstalled(rootDir);
3205
+ const routed = routes ? routeKeyFor(DEFAULT_MODERATION_MODEL, routes) : void 0;
3206
+ const classifierOrder = routed === void 0 ? order ?? ["convex", "vercel"] : routes[routed];
3207
+ const answers = pinned ? "vercel" : answeringGateway(classifierOrder, { keyed: deployed.includes("AI_GATEWAY_API_KEY"), convex });
3208
+ if (answers !== "vercel") return finding(id, "pass", "The backend checks images with Llama Guard 4, through the Convex AI Gateway, which reads them.");
3209
+ return finding(
3210
+ id,
3211
+ "warn",
3212
+ `The backend checks images, but its default safety classifier goes through the Vercel AI Gateway here${pinned ? " (inference is pinned to a region)" : ""}, which serves none that reads images: openai/gpt-oss-safeguard-20b reads text only, so every check with images is refused as unchecked.`,
3213
+ "Route moderation through the Convex AI Gateway (a paid Convex plan, @convex-dev/ai-sdk-provider installed, and 'convex' first in setupAi({ gateway })), or name a classifier that reads images in setupAi({ moderation: { model } })."
3214
+ );
3215
+ }
2773
3216
  async function envDefaultsFindings(rootDir) {
2774
3217
  const names = await projectEnvDefaultNames(rootDir, "preview");
2775
3218
  if (!names) return [];
@@ -2826,7 +3269,7 @@ async function deployedSurfaceFindings(rootDir, { prod, deployed, env, local, si
2826
3269
  const reachable = deployed !== null;
2827
3270
  const probes = wants("billing") || wants("email") || wants("ai");
2828
3271
  const { identifiers, authConfig, probeSiteUrl, deploymentUrl } = await readSurface(rootDir, { prod, reachable, siteUrl, wants, probes });
2829
- const [routes, pages, protection, site, admins, email, endpoint] = await Promise.all([
3272
+ const [routes, pages, protection, site, admins, email, billing] = await Promise.all([
2830
3273
  probes && probeSiteUrl ? webhookRouteFindings(probeSiteUrl, { ai: identifiers ? [...identifiers].some((id) => id.startsWith("ai:")) : true, wants, prod }) : [],
2831
3274
  authConfig ? pagePathFindings(appConfig, authConfig) : [],
2832
3275
  wants("protection") ? protectionFindings(protectionInput(rootDir, { prod, deployed, env, local, siteUrl: probeSiteUrl })) : [],
@@ -2835,11 +3278,11 @@ async function deployedSurfaceFindings(rootDir, { prod, deployed, env, local, si
2835
3278
  reachable && wants("auth") ? deploymentHasAdmin(rootDir, { prod }).then((hasAdmin) => adminBootstrapFindings(hasAdmin, { prod })) : [],
2836
3279
  // The topics, the webhook's events and the key's reach, as the deployment's own email sync reads them (a dry run).
2837
3280
  emailSetupFindings(rootDir, { prod, reachable: reachable && wants("email"), identifiers }),
2838
- wants("billing") && probeSiteUrl ? billingEndpointCheck(env, { prod, siteUrl: probeSiteUrl }) : []
3281
+ wants("billing") ? billingProviderFindings(rootDir, env, { prod, reachable, siteUrl: probeSiteUrl }) : []
2839
3282
  ]);
2840
3283
  return [
2841
3284
  ...routes,
2842
- ...endpoint,
3285
+ ...billing,
2843
3286
  ...protection,
2844
3287
  // The composable function contract.
2845
3288
  ...identifiers && wants("scaffold") ? functionContractFindings(identifiers) : [],
@@ -2866,13 +3309,14 @@ function readSurface(rootDir, { prod, reachable, siteUrl, wants, probes }) {
2866
3309
  function productionBillsIn({ environment }) {
2867
3310
  return environment === "unset" || environment === "unread" ? environment : billingEnvironment(environment);
2868
3311
  }
2869
- async function productionPostureFindings(rootDir, posture, wants) {
3312
+ async function productionPostureFindings(rootDir, posture, wants, { launch, deployed, cloud }) {
2870
3313
  if (!posture) return [];
2871
3314
  return [
2872
3315
  ...wants("auth") ? siteOriginFinding(posture) : [],
2873
3316
  ...wants("email") ? emailPostureFindings(posture) : [],
2874
- ...wants("billing") ? await productionCatalogFindings(rootDir, productionBillsIn(posture)) : [],
2875
- ...wants("ai") ? aiSpendLimitFinding(rootDir, posture) : []
3317
+ ...wants("billing") ? await productionCatalogFindings(rootDir, productionBillsIn(posture), launch?.launched ?? true) : [],
3318
+ ...wants("ai") ? aiSpendLimitFinding(rootDir, posture) : [],
3319
+ ...wants("ai") ? aiGatewayBudgetFinding(rootDir, posture, { deployed, cloud }) : []
2876
3320
  ];
2877
3321
  }
2878
3322
  function aiSpendLimitFinding(rootDir, posture) {
@@ -2887,6 +3331,45 @@ function aiSpendLimitFinding(rootDir, posture) {
2887
3331
  "Pass `spendLimit: { usdPerDay }` to setupAi in backend/ai.ts: once a UTC day costs that much, pause_ai turns on until the day ends."
2888
3332
  )];
2889
3333
  }
3334
+ const GATEWAY_CAP = {
3335
+ convex: {
3336
+ name: "the Convex AI Gateway",
3337
+ cap: "the team's spending limit, on its billing page",
3338
+ fix: "For the Convex AI Gateway, set the team's spending limit on its billing page in the Convex dashboard."
3339
+ },
3340
+ vercel: {
3341
+ name: "the Vercel AI Gateway",
3342
+ cap: "a budget on its key, the project or the team",
3343
+ fix: "For the Vercel AI Gateway: `vercel ai-gateway budgets set api-key <the key production holds> --amount <dollars> --refresh-period monthly`."
3344
+ }
3345
+ };
3346
+ function productionGateways(rootDir, deployed, cloud) {
3347
+ const models = namedModels(rootDir);
3348
+ const order = chosenGateways(rootDir);
3349
+ const routes = chosenRoutes(rootDir);
3350
+ if (models.length === 0 || order === "unread" || routes === "unread") return [];
3351
+ const keyed = deployed.includes("AI_GATEWAY_API_KEY");
3352
+ if (pinnedRegion(rootDir) !== void 0) return keyed ? ["vercel"] : [];
3353
+ const facts = { keyed, convex: cloud && convexGatewayProviderInstalled(rootDir) };
3354
+ const answering = routedGroups(models, order ?? ["convex", "vercel"], routes).map((group) => answeringGateway(group.order, facts));
3355
+ return [...new Set(answering.filter((gateway) => gateway !== void 0))];
3356
+ }
3357
+ function aiGatewayBudgetFinding(rootDir, posture, { deployed, cloud }) {
3358
+ if (posture.environment === "sandbox") return [];
3359
+ const { setupAi, spendLimit } = aiFeatures(rootDir);
3360
+ const gateways = setupAi ? productionGateways(rootDir, deployed, cloud) : [];
3361
+ if (gateways.length === 0) return [];
3362
+ const through = `Production's model calls go through ${gateways.map((gateway) => GATEWAY_CAP[gateway].name).join(" and ")}`;
3363
+ const unchecked = `Not checked: ${gateways.map((gateway) => `${GATEWAY_CAP[gateway].name}'s own cap, ${GATEWAY_CAP[gateway].cap}`).join("; ")}, as doctor reads no account of ${gateways.length === 1 ? "it" : "theirs"}.`;
3364
+ const fixes = gateways.map((gateway) => GATEWAY_CAP[gateway].fix).join(" ");
3365
+ if (spendLimit) return [finding("ai-gateway-budget", "pass", `${through}, and setupAi's daily spendLimit pauses AI once a UTC day's spend reaches it. ${unchecked}`, fixes)];
3366
+ return [finding(
3367
+ "ai-gateway-budget",
3368
+ "warn",
3369
+ `${through}, and setupAi sets no spendLimit: nothing doctor can read caps what they cost in dollars. ${unchecked}`,
3370
+ `Pass \`spendLimit: { usdPerDay }\` to setupAi in backend/ai.ts: once a UTC day costs that much, AI pauses itself until the day ends. And cap the gateway: ${fixes}`
3371
+ )];
3372
+ }
2890
3373
  async function scaffoldFindings(rootDir, appConfig) {
2891
3374
  return [
2892
3375
  ...await generatedFileFindings(rootDir, appConfig),
@@ -2903,7 +3386,7 @@ async function localFeatureFindings(rootDir, { env, wants, deployed, prod, appCo
2903
3386
  ...wants("monitoring") ? monitoringFindings(rootDir, { env, deployed, prod }) : [],
2904
3387
  ...declaredFeatureFindings(rootDir, { wants, deployed, prod }),
2905
3388
  // Production's own usage warnings: Convex emails the team; the deployment cannot read its usage itself.
2906
- ...wants("monitoring") && prod ? [usageAlertsFinding(await readUsageLimits(rootDir), { convexGateway: convexGatewayProviderInstalled(rootDir) })] : [],
3389
+ ...wants("monitoring") && prod ? [usageAlertsFinding(await readUsageLimits(rootDir), { convexGateway: convexGatewayProviderInstalled(rootDir) && (namesConvex(chosenGateways(rootDir)) || routesNameConvex(chosenRoutes(rootDir))) })] : [],
2907
3390
  ...wants("auth") ? await consentFindings(rootDir, { prod }) : [],
2908
3391
  // The installable app iPhone and iPad take web push from: the brand and the two icons.
2909
3392
  ...await installableFindings(rootDir, appConfig, { wanted: wants("notifications"), pushKeys: Boolean(env.PUSH_PUBLIC_KEY) || (deployed ?? []).includes("PUSH_PUBLIC_KEY") })
@@ -2915,16 +3398,19 @@ async function runDoctorChecks(rootDir, { prod, only, deployedNames, posture: gi
2915
3398
  const env = { ...readEnvFiles(rootDir), ...process.env };
2916
3399
  const appConfig = appConfigLoader(rootDir);
2917
3400
  const siteUrl = resolveSiteUrl({ env, derived: deriveDeploymentUrls(rootDir, env) });
2918
- const [{ deployed, surface, posture }, catalog, metrics] = await Promise.all([
3401
+ const namesRead = deployedNames !== void 0 ? Promise.resolve(deployedNames) : deploymentEnvNames(rootDir, { prod });
3402
+ const [{ deployed, surface, posture, launch }, catalog, metrics] = await Promise.all([
2919
3403
  (async () => {
2920
- const names = deployedNames !== void 0 ? deployedNames : await deploymentEnvNames(rootDir, { prod });
3404
+ const names = await namesRead;
2921
3405
  const posture2 = given ?? (prod && names ? readProductionPosture(rootDir, names, wants) : Promise.resolve(null));
2922
3406
  const [surface2, defaults, read] = await Promise.all([
2923
3407
  deployedSurfaceFindings(rootDir, { prod, deployed: names, env, local: !prod && isLocalDeploymentId(configuredDeployment(rootDir)), siteUrl, wants, posture: posture2, appConfig }),
2924
3408
  names !== null && !prod && wants("deployment") ? envDefaultsFindings(rootDir) : [],
2925
3409
  posture2
2926
3410
  ]);
2927
- return { deployed: names, surface: [...surface2, ...defaults, ...await productionPostureFindings(rootDir, read, wants)], posture: read };
3411
+ const launch2 = read && wants("billing") && productionBillsIn(read) === "production" ? await productionBillingLaunch(rootDir, names ?? []) : null;
3412
+ const cloud = deploymentRoute(computeDeployment(rootDir, env).kind, true).cloud;
3413
+ return { deployed: names, surface: [...surface2, ...defaults, ...await productionPostureFindings(rootDir, read, wants, { launch: launch2, deployed: names ?? [], cloud })], posture: read, launch: launch2 };
2928
3414
  })(),
2929
3415
  // Billing catalog cross-checks: what backend/billing.catalog.ts declares
2930
3416
  // against the organization's own subscription + portal settings. Every
@@ -2932,7 +3418,7 @@ async function runDoctorChecks(rootDir, { prod, only, deployedNames, posture: gi
2932
3418
  // provider, only the catalog-only checks (see collectBillingFindings).
2933
3419
  // Local files and the provider only, so they run beside the deployment
2934
3420
  // reads.
2935
- wants("billing") ? billingCatalogFindings(rootDir, env) : [],
3421
+ wants("billing") ? billingCatalogFindings(rootDir, env, { deployed: namesRead, prod }) : [],
2936
3422
  // The funnel's activation kind, recorded by a backend file; then the
2937
3423
  // Revenue view's metrics read, with the token visible here (analytics).
2938
3424
  wants("analytics") ? Promise.resolve(activationFindings(rootDir)) : [],
@@ -2952,7 +3438,11 @@ async function runDoctorChecks(rootDir, { prod, only, deployedNames, posture: gi
2952
3438
  ...catalog,
2953
3439
  ...metrics
2954
3440
  ].filter((reported) => wantsCapability(reported.capability));
2955
- return prod ? applyProductionPosture(findings, posture ? /* @__PURE__ */ new Set(["deployment-backend-environment"]) : void 0) : findings;
3441
+ return prod ? productionFindings(findings, { posture, launch }) : findings;
3442
+ }
3443
+ function productionFindings(findings, { posture, launch }) {
3444
+ const launched = launch ? withBillingLaunch(findings, launch) : { findings, settled: [] };
3445
+ return applyProductionPosture(launched.findings, /* @__PURE__ */ new Set([...posture ? ["deployment-backend-environment"] : [], ...launched.settled]));
2956
3446
  }
2957
3447
 
2958
3448
  const doctor = {
@@ -2962,4 +3452,4 @@ const doctor = {
2962
3452
  runDoctorChecks: runDoctorChecks
2963
3453
  };
2964
3454
 
2965
- export { bootstrapAdmin as $, planCreditUnits as A, planQuotasBenefits as B, providerTrialOf as C, pushPlanTrial as D, attachPlanQuotas as E, isFreePlan as F, BILLING_WEBHOOK_PROVISION_EVENTS as G, planProductKey as H, recordPlanProduct as I, loadGenerated as J, renderGenerated as K, loadCatalog as L, MANAGED_BY as M, probeWebhookRoute as N, runEmailSync as O, planSettingChanges as P, planEndpointChanges as Q, applyProviderChanges as R, billingProviderTarget as S, providerClient as T, readProviderOrganization as U, readProviderEndpoint as V, emailSyncRefusal as W, runDoctorChecks as X, readProductionPosture as Y, email as Z, runEnvDefaults as _, refuseInvalidPrices as a, runEmailSyncCommand as a0, ENV_DEFAULT_TYPES as a1, REQUIRED_FUNCTION_EXPORTS as a2, doctor as a3, refuseInvalidGifts as b, refuseInvalidQuotas as c, refuseInvalidDiscounts as d, refuseMissingDefaultCurrency as e, refuseUnpricedDiscounts as f, ensurePlanQuotas as g, retirePlan as h, isManaged as i, attachRetiredPlanQuotas as j, recordQuotaKeys as k, listAllPages as l, packPricesByCurrency as m, syncDiscounts as n, planQuotasKeys as o, pricedIntervals as p, derivedPassKeys as q, refuseUnpricedPlans as r, syncPassProducts as s, droppedQuotasKeys as t, unpricedPlanProducts as u, providerClientOptions as v, planQuotasKey as w, planPricesByCurrency as x, findPlanProduct as y, isUntaggedPlanProduct as z };
3455
+ export { emailSyncRefusal as $, planQuotasKey as A, planPricesByCurrency as B, findPlanProduct as C, isUntaggedPlanProduct as D, planCreditUnits as E, planQuotasBenefits as F, isFreePlan as G, zeroPrices as H, providerTrialOf as I, pushPlanTrial as J, attachPlanQuotas as K, BILLING_WEBHOOK_PROVISION_EVENTS as L, MANAGED_BY as M, planProductKey as N, recordPlanProduct as O, PROVIDER_COMPONENT as P, loadGenerated as Q, renderGenerated as R, probeWebhookRoute as S, runEmailSync as T, planSettingChanges as U, planEndpointChanges as V, applyProviderChanges as W, billingProviderTarget as X, providerClient as Y, readProviderOrganization as Z, readProviderEndpoint as _, refuseInvalidPrices as a, ADMISSION_DAYS as a0, CLI_ADMISSION_LABEL as a1, admitInputRefusal as a2, admitRefused as a3, admitCleaned as a4, runDoctorChecks as a5, readProductionPosture as a6, email as a7, runEnvDefaults as a8, bootstrapAdmin as a9, runEmailSyncCommand as aa, ENV_DEFAULT_TYPES as ab, REQUIRED_FUNCTION_EXPORTS as ac, doctor as ad, refuseOnceCredits as b, refuseInvalidGifts as c, refuseInvalidQuotas as d, refuseInvalidDiscounts as e, freePlanOf as f, listAllPages as g, refuseMissingDefaultCurrency as h, isManaged as i, refuseMissingOrganizationCurrency as j, refuseUnpricedDiscounts as k, loadCatalog as l, ensurePlanQuotas as m, retirePlan as n, attachRetiredPlanQuotas as o, pricedIntervals as p, recordQuotaKeys as q, refuseUnpricedPlans as r, packPricesByCurrency as s, syncPassProducts as t, syncDiscounts as u, planQuotasKeys as v, derivedPassKeys as w, droppedQuotasKeys as x, unpricedPlanProducts as y, providerClientOptions as z };