nuxt-backend 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -1
- package/dist/chunks/catalog.mjs +1 -1
- package/dist/chunks/doctor.mjs +103 -9
- package/dist/chunks/email-previews.mjs +1 -1
- package/dist/chunks/health.mjs +2 -2
- package/dist/chunks/index.mjs +3 -3
- package/dist/chunks/install.mjs +8 -8
- package/dist/chunks/run.mjs +1 -1
- package/dist/chunks/server.mjs +6 -6
- package/dist/cli.mjs +290 -188
- package/dist/convex/catalog.d.ts +8 -0
- package/dist/convex/catalog.d.ts.map +1 -1
- package/dist/convex/catalog.js +16 -0
- package/dist/convex/catalog.js.map +1 -1
- package/dist/convex/components/backend/_generated/component.d.ts +21 -1
- package/dist/convex/components/backend/_generated/component.d.ts.map +1 -1
- package/dist/convex/components/backend/billing.d.ts +7 -0
- package/dist/convex/components/backend/billing.d.ts.map +1 -1
- package/dist/convex/components/backend/billing.js +20 -5
- package/dist/convex/components/backend/billing.js.map +1 -1
- package/dist/convex/components/backend/jobs.d.ts +69 -1
- package/dist/convex/components/backend/jobs.d.ts.map +1 -1
- package/dist/convex/components/backend/jobs.js +103 -5
- package/dist/convex/components/backend/jobs.js.map +1 -1
- package/dist/convex/components/backend/schema.d.ts +46 -18
- package/dist/convex/components/backend/schema.d.ts.map +1 -1
- package/dist/convex/components/backend/schema.js +11 -0
- package/dist/convex/components/backend/schema.js.map +1 -1
- package/dist/convex/components/backend/subscriptions.d.ts +3 -3
- package/dist/convex/delivery.d.ts +17 -0
- package/dist/convex/delivery.d.ts.map +1 -1
- package/dist/convex/delivery.js +26 -1
- package/dist/convex/delivery.js.map +1 -1
- package/dist/convex/emails/renewal-reminder.d.ts.map +1 -1
- package/dist/convex/emails/renewal-reminder.js +17 -1
- package/dist/convex/emails/renewal-reminder.js.map +1 -1
- package/dist/convex/errors.d.ts +7 -5
- package/dist/convex/errors.d.ts.map +1 -1
- package/dist/convex/errors.js +24 -9
- package/dist/convex/errors.js.map +1 -1
- package/dist/convex/events.d.ts +10 -0
- package/dist/convex/events.d.ts.map +1 -1
- package/dist/convex/events.js +7 -0
- package/dist/convex/events.js.map +1 -1
- package/dist/convex/integrations/ai/images.d.ts.map +1 -1
- package/dist/convex/integrations/ai/images.js +20 -7
- package/dist/convex/integrations/ai/images.js.map +1 -1
- package/dist/convex/integrations/ai/job-errors.d.ts +32 -4
- package/dist/convex/integrations/ai/job-errors.d.ts.map +1 -1
- package/dist/convex/integrations/ai/job-errors.js +55 -8
- package/dist/convex/integrations/ai/job-errors.js.map +1 -1
- package/dist/convex/integrations/ai/jobs.d.ts +128 -7
- package/dist/convex/integrations/ai/jobs.d.ts.map +1 -1
- package/dist/convex/integrations/ai/jobs.js +395 -63
- package/dist/convex/integrations/ai/jobs.js.map +1 -1
- package/dist/convex/integrations/ai/models.d.ts +1 -1
- package/dist/convex/integrations/ai/models.d.ts.map +1 -1
- package/dist/convex/integrations/ai/moderation.d.ts +9 -3
- package/dist/convex/integrations/ai/moderation.d.ts.map +1 -1
- package/dist/convex/integrations/ai/moderation.js +4 -2
- package/dist/convex/integrations/ai/moderation.js.map +1 -1
- package/dist/convex/integrations/ai.d.ts +2 -2
- package/dist/convex/integrations/ai.d.ts.map +1 -1
- package/dist/convex/integrations/ai.js +1 -1
- package/dist/convex/integrations/ai.js.map +1 -1
- package/dist/convex/integrations/billing/context.d.ts.map +1 -1
- package/dist/convex/integrations/billing/context.js +5 -2
- package/dist/convex/integrations/billing/context.js.map +1 -1
- package/dist/convex/integrations/billing/credits.d.ts +1 -0
- package/dist/convex/integrations/billing/credits.d.ts.map +1 -1
- package/dist/convex/integrations/billing/credits.js +4 -1
- package/dist/convex/integrations/billing/credits.js.map +1 -1
- package/dist/convex/integrations/billing/features.d.ts.map +1 -1
- package/dist/convex/integrations/billing/gifts.d.ts.map +1 -1
- package/dist/convex/integrations/billing/history.d.ts.map +1 -1
- package/dist/convex/integrations/billing/passes.d.ts +2 -2
- package/dist/convex/integrations/billing/passes.d.ts.map +1 -1
- package/dist/convex/integrations/billing/passes.js +3 -11
- package/dist/convex/integrations/billing/passes.js.map +1 -1
- package/dist/convex/integrations/billing/provider-failure.d.ts +17 -0
- package/dist/convex/integrations/billing/provider-failure.d.ts.map +1 -0
- package/dist/convex/integrations/billing/provider-failure.js +52 -0
- package/dist/convex/integrations/billing/provider-failure.js.map +1 -0
- package/dist/convex/integrations/billing/quotas.d.ts.map +1 -1
- package/dist/convex/integrations/billing/subscriptions.d.ts.map +1 -1
- package/dist/convex/integrations/billing/types/setup.d.ts +1 -0
- package/dist/convex/integrations/billing/types/setup.d.ts.map +1 -1
- package/dist/convex/integrations/billing/types/surface.d.ts +9 -1
- package/dist/convex/integrations/billing/types/surface.d.ts.map +1 -1
- package/dist/convex/integrations/email-sync.d.ts +24 -2
- package/dist/convex/integrations/email-sync.d.ts.map +1 -1
- package/dist/convex/integrations/email-sync.js +54 -23
- package/dist/convex/integrations/email-sync.js.map +1 -1
- package/dist/convex/integrations/inbound.d.ts +16 -7
- package/dist/convex/integrations/inbound.d.ts.map +1 -1
- package/dist/convex/integrations/inbound.js +21 -10
- package/dist/convex/integrations/inbound.js.map +1 -1
- package/dist/convex/integrations/launch.d.ts +17 -1
- package/dist/convex/integrations/launch.d.ts.map +1 -1
- package/dist/convex/integrations/launch.js +32 -3
- package/dist/convex/integrations/launch.js.map +1 -1
- package/dist/convex/integrations/referrals.d.ts +20 -0
- package/dist/convex/integrations/referrals.d.ts.map +1 -1
- package/dist/convex/integrations/referrals.js +14 -9
- package/dist/convex/integrations/referrals.js.map +1 -1
- package/dist/convex/integrations/storage.d.ts +67 -0
- package/dist/convex/integrations/storage.d.ts.map +1 -1
- package/dist/convex/integrations/storage.js +42 -1
- package/dist/convex/integrations/storage.js.map +1 -1
- package/dist/convex/label-groups/admin.d.ts +3 -0
- package/dist/convex/label-groups/admin.d.ts.map +1 -1
- package/dist/convex/label-groups/admin.js +3 -0
- package/dist/convex/label-groups/admin.js.map +1 -1
- package/dist/convex/label-groups/audit.d.ts +1 -0
- package/dist/convex/label-groups/audit.d.ts.map +1 -1
- package/dist/convex/label-groups/audit.js +1 -0
- package/dist/convex/label-groups/audit.js.map +1 -1
- package/dist/convex/label-groups/auth.d.ts +7 -0
- package/dist/convex/label-groups/auth.d.ts.map +1 -1
- package/dist/convex/label-groups/auth.js +7 -0
- package/dist/convex/label-groups/auth.js.map +1 -1
- package/dist/convex/label-groups/errors.d.ts +9 -0
- package/dist/convex/label-groups/errors.d.ts.map +1 -1
- package/dist/convex/label-groups/errors.js +12 -0
- package/dist/convex/label-groups/errors.js.map +1 -1
- package/dist/convex/label-groups/gift.d.ts +24 -0
- package/dist/convex/label-groups/gift.d.ts.map +1 -1
- package/dist/convex/label-groups/gift.js +27 -0
- package/dist/convex/label-groups/gift.js.map +1 -1
- package/dist/convex/label-groups/legal.d.ts +1 -1
- package/dist/convex/label-groups/pricing.d.ts +15 -0
- package/dist/convex/label-groups/pricing.d.ts.map +1 -1
- package/dist/convex/label-groups/pricing.js +20 -0
- package/dist/convex/label-groups/pricing.js.map +1 -1
- package/dist/convex/label-groups/referral.d.ts +4 -0
- package/dist/convex/label-groups/referral.d.ts.map +1 -1
- package/dist/convex/label-groups/referral.js +4 -0
- package/dist/convex/label-groups/referral.js.map +1 -1
- package/dist/convex/label-groups/settings.d.ts +34 -0
- package/dist/convex/label-groups/settings.d.ts.map +1 -1
- package/dist/convex/label-groups/settings.js +39 -0
- package/dist/convex/label-groups/settings.js.map +1 -1
- package/dist/convex/label-groups/waitlist.d.ts +5 -0
- package/dist/convex/label-groups/waitlist.d.ts.map +1 -1
- package/dist/convex/label-groups/waitlist.js +7 -2
- package/dist/convex/label-groups/waitlist.js.map +1 -1
- package/dist/convex/labels.d.ts +103 -1
- package/dist/convex/labels.d.ts.map +1 -1
- package/dist/convex/legal.d.ts +18 -1
- package/dist/convex/legal.d.ts.map +1 -1
- package/dist/convex/legal.js +17 -2
- package/dist/convex/legal.js.map +1 -1
- package/dist/convex/log.js +8 -0
- package/dist/convex/log.js.map +1 -1
- package/dist/convex/money.d.ts +10 -0
- package/dist/convex/money.d.ts.map +1 -0
- package/dist/convex/money.js +37 -0
- package/dist/convex/money.js.map +1 -0
- package/dist/convex/report-rules.d.ts +6 -0
- package/dist/convex/report-rules.d.ts.map +1 -1
- package/dist/convex/report-rules.js +15 -0
- package/dist/convex/report-rules.js.map +1 -1
- package/dist/convex/test-billing.d.ts +83 -0
- package/dist/convex/test-billing.d.ts.map +1 -0
- package/dist/convex/test-billing.js +131 -0
- package/dist/convex/test-billing.js.map +1 -0
- package/dist/convex/test-models.d.ts +14 -2
- package/dist/convex/test-models.d.ts.map +1 -1
- package/dist/convex/test-models.js +61 -4
- package/dist/convex/test-models.js.map +1 -1
- package/dist/devtools-client/index.html +1 -1
- package/dist/eslint.d.mts +2 -1
- package/dist/eslint.mjs +2 -1
- package/dist/module.d.ts +45 -2
- package/dist/module.js +2 -2
- package/dist/module.json +1 -1
- package/dist/runtime/chunk-recovery.d.ts +13 -0
- package/dist/runtime/chunk-recovery.js +1 -0
- package/dist/runtime/locales/de.json +113 -7
- package/dist/runtime/locales/en.json +114 -8
- package/dist/runtime/locales/es.json +113 -7
- package/dist/runtime/locales/fr.json +113 -7
- package/dist/runtime/locales/ru.json +113 -7
- package/dist/runtime/server/chunk-recovery.d.ts +49 -0
- package/dist/runtime/server/chunk-recovery.js +44 -0
- package/dist/runtime/server/csp.d.ts +7 -2
- package/dist/runtime/server/csp.js +2 -2
- package/dist/runtime/server/photo-decoder-csp.d.ts +17 -0
- package/dist/runtime/server/photo-decoder-csp.js +9 -0
- package/dist/runtime/vue/components/account/AccountDeletion.css +1 -1
- package/dist/runtime/vue/components/account/ActivationChecklist.css +1 -1
- package/dist/runtime/vue/components/account/ConsentPrompt.css +1 -1
- package/dist/runtime/vue/components/account/EmailUnsubscribe.css +1 -1
- package/dist/runtime/vue/components/account/HowDidYouHear.css +1 -1
- package/dist/runtime/vue/components/account/KeepAccount.css +1 -1
- package/dist/runtime/vue/components/account/OnboardingFlow.css +1 -1
- package/dist/runtime/vue/components/account/ProfileIdentity.css +1 -1
- package/dist/runtime/vue/components/account/ProfilePreferencesSection.css +1 -1
- package/dist/runtime/vue/components/account/ProfileSettings.css +1 -1
- package/dist/runtime/vue/components/account/SecurityAlerts.css +1 -1
- package/dist/runtime/vue/components/account/SecurityPasskeys.css +1 -1
- package/dist/runtime/vue/components/account/SecuritySessions.css +1 -1
- package/dist/runtime/vue/components/account/SecuritySettings.css +1 -1
- package/dist/runtime/vue/components/admin/AdminAccess.css +1 -1
- package/dist/runtime/vue/components/admin/AdminAnnouncements.css +1 -1
- package/dist/runtime/vue/components/admin/AdminBilling.css +1 -1
- package/dist/runtime/vue/components/admin/AdminChart.css +1 -1
- package/dist/runtime/vue/components/admin/AdminConsole.css +1 -1
- package/dist/runtime/vue/components/admin/AdminExperiments.css +1 -1
- package/dist/runtime/vue/components/admin/AdminFlags.css +1 -1
- package/dist/runtime/vue/components/admin/AdminQueue.css +1 -1
- package/dist/runtime/vue/components/admin/AdminQueueJob.vue +5 -2
- package/dist/runtime/vue/components/admin/AdminReferrals.css +1 -1
- package/dist/runtime/vue/components/admin/AdminReports.css +1 -1
- package/dist/runtime/vue/components/admin/AdminRevenue.css +1 -1
- package/dist/runtime/vue/components/admin/AdminUsers.d.vue.ts +3 -0
- package/dist/runtime/vue/components/admin/AdminUsers.vue.d.ts +3 -0
- package/dist/runtime/vue/components/admin/AdminWorkspaces.d.vue.ts +3 -0
- package/dist/runtime/vue/components/admin/AdminWorkspaces.vue.d.ts +3 -0
- package/dist/runtime/vue/components/admin/admin-access-tab.js +2 -1
- package/dist/runtime/vue/components/admin/admin-revenue-tab.js +4 -1
- package/dist/runtime/vue/components/admin/admin.css +1 -1
- package/dist/runtime/vue/components/auth/AuthForm.css +1 -1
- package/dist/runtime/vue/components/auth/AuthForm.d.vue.ts +7 -0
- package/dist/runtime/vue/components/auth/AuthForm.vue +1 -2
- package/dist/runtime/vue/components/auth/AuthForm.vue.d.ts +7 -0
- package/dist/runtime/vue/components/auth/AuthFormChoose.css +1 -1
- package/dist/runtime/vue/components/auth/AuthFormHeader.css +1 -1
- package/dist/runtime/vue/components/auth/AuthFormPasskeyOffer.css +1 -1
- package/dist/runtime/vue/components/auth/InviteRedeem.css +1 -1
- package/dist/runtime/vue/components/auth/InviteRedeem.vue +79 -10
- package/dist/runtime/vue/components/auth/ReauthenticateCode.css +1 -1
- package/dist/runtime/vue/components/auth/ReauthenticateDialog.css +1 -1
- package/dist/runtime/vue/components/auth/ReauthenticatePasskey.css +1 -1
- package/dist/runtime/vue/components/auth/WaitlistForm.css +1 -1
- package/dist/runtime/vue/components/auth/WaitlistForm.d.vue.ts +5 -0
- package/dist/runtime/vue/components/auth/WaitlistForm.vue +3 -5
- package/dist/runtime/vue/components/auth/WaitlistForm.vue.d.ts +5 -0
- package/dist/runtime/vue/components/auth/WaitlistPlace.css +1 -1
- package/dist/runtime/vue/components/auth/WaitlistShare.css +1 -1
- package/dist/runtime/vue/components/auth/WaitlistShare.vue +1 -7
- package/dist/runtime/vue/components/auth/WaitlistStatus.css +1 -1
- package/dist/runtime/vue/components/auth/WaitlistStatus.vue +116 -29
- package/dist/runtime/vue/components/auth/auth-form.d.ts +1 -1
- package/dist/runtime/vue/components/auth/waitlist-form.js +1 -1
- package/dist/runtime/vue/components/billing/BillingHistory.css +1 -1
- package/dist/runtime/vue/components/billing/BillingHistoryOrder.css +1 -1
- package/dist/runtime/vue/components/billing/CancelConfirmGroup.vue +2 -7
- package/dist/runtime/vue/components/billing/CancelFlow.css +1 -1
- package/dist/runtime/vue/components/billing/GiftForm.css +1 -0
- package/dist/runtime/vue/components/billing/GiftForm.d.vue.ts +105 -0
- package/dist/runtime/vue/components/billing/GiftForm.vue +228 -0
- package/dist/runtime/vue/components/billing/GiftForm.vue.d.ts +105 -0
- package/dist/runtime/vue/components/billing/GiftList.css +1 -1
- package/dist/runtime/vue/components/billing/GiftList.d.vue.ts +87 -2
- package/dist/runtime/vue/components/billing/GiftList.vue +7 -4
- package/dist/runtime/vue/components/billing/GiftList.vue.d.ts +87 -2
- package/dist/runtime/vue/components/billing/GiftReceived.vue +11 -3
- package/dist/runtime/vue/components/billing/PlanChangeConfirmGroup.d.vue.ts +7 -0
- package/dist/runtime/vue/components/billing/PlanChangeConfirmGroup.vue +50 -0
- package/dist/runtime/vue/components/billing/PlanChangeConfirmGroup.vue.d.ts +7 -0
- package/dist/runtime/vue/components/billing/PricingChangeConfirm.d.vue.ts +4 -0
- package/dist/runtime/vue/components/billing/PricingChangeConfirm.vue +17 -0
- package/dist/runtime/vue/components/billing/PricingChangeConfirm.vue.d.ts +4 -0
- package/dist/runtime/vue/components/billing/PricingPackCard.css +1 -1
- package/dist/runtime/vue/components/billing/PricingPlanCard.css +1 -1
- package/dist/runtime/vue/components/billing/PricingPlanCard.vue +15 -0
- package/dist/runtime/vue/components/billing/PricingTable.css +1 -1
- package/dist/runtime/vue/components/billing/PricingTable.d.vue.ts +24 -2
- package/dist/runtime/vue/components/billing/PricingTable.vue +70 -37
- package/dist/runtime/vue/components/billing/PricingTable.vue.d.ts +24 -2
- package/dist/runtime/vue/components/billing/ReferralCard.css +1 -1
- package/dist/runtime/vue/components/billing/ReferralCard.d.vue.ts +4 -0
- package/dist/runtime/vue/components/billing/ReferralCard.vue.d.ts +4 -0
- package/dist/runtime/vue/components/billing/ReferralLanding.css +1 -1
- package/dist/runtime/vue/components/billing/ReferralLanding.vue +43 -2
- package/dist/runtime/vue/components/billing/UpgradePrompt.css +1 -1
- package/dist/runtime/vue/components/billing/UsageHistory.css +1 -1
- package/dist/runtime/vue/components/billing/WithdrawalButton.css +1 -1
- package/dist/runtime/vue/components/billing/cancel-flow.js +2 -1
- package/dist/runtime/vue/components/billing/pricing-table.d.ts +10 -0
- package/dist/runtime/vue/components/billing/withdrawal-button.d.ts +3 -2
- package/dist/runtime/vue/components/billing/withdrawal-button.js +13 -33
- package/dist/runtime/vue/components/shared.css +1 -1
- package/dist/runtime/vue/components/shell/AccessDenied.css +1 -1
- package/dist/runtime/vue/components/shell/AiLabel.css +1 -1
- package/dist/runtime/vue/components/shell/AppShell.css +1 -1
- package/dist/runtime/vue/components/shell/ConfirmDialog.css +1 -1
- package/dist/runtime/vue/components/shell/ConnectionStatus.css +1 -1
- package/dist/runtime/vue/components/shell/ContactForm.css +1 -1
- package/dist/runtime/vue/components/shell/Gate.css +1 -1
- package/dist/runtime/vue/components/shell/LegalDocument.css +1 -1
- package/dist/runtime/vue/components/shell/NoticeAnnouncement.css +1 -1
- package/dist/runtime/vue/components/shell/NoticeDeletion.css +1 -1
- package/dist/runtime/vue/components/shell/NoticeGift.css +1 -1
- package/dist/runtime/vue/components/shell/NoticeImpersonation.css +1 -1
- package/dist/runtime/vue/components/shell/NoticeLowCredits.css +1 -1
- package/dist/runtime/vue/components/shell/NoticeMaintenance.css +1 -1
- package/dist/runtime/vue/components/shell/NoticePastDue.css +1 -1
- package/dist/runtime/vue/components/shell/NotificationInbox.css +1 -1
- package/dist/runtime/vue/components/shell/ReportAppeal.vue +16 -13
- package/dist/runtime/vue/components/shell/ReportNotice.css +1 -1
- package/dist/runtime/vue/components/shell/UploadField.css +1 -1
- package/dist/runtime/vue/components/shell/WorkspaceSwitcher.css +1 -1
- package/dist/runtime/vue/components/shell/report-form.js +1 -44
- package/dist/runtime/vue/components/tokens.css +1 -1
- package/dist/runtime/vue/components/workspaces/AuditLog.css +1 -1
- package/dist/runtime/vue/components/workspaces/AuditLog.d.vue.ts +1 -0
- package/dist/runtime/vue/components/workspaces/AuditLog.vue.d.ts +1 -0
- package/dist/runtime/vue/components/workspaces/WorkspaceBilling.css +1 -1
- package/dist/runtime/vue/components/workspaces/WorkspaceBilling.vue +34 -58
- package/dist/runtime/vue/components/workspaces/WorkspaceBillingPause.d.vue.ts +3 -0
- package/dist/runtime/vue/components/workspaces/WorkspaceBillingPause.vue +68 -0
- package/dist/runtime/vue/components/workspaces/WorkspaceBillingPause.vue.d.ts +3 -0
- package/dist/runtime/vue/components/workspaces/WorkspaceBillingSwitch.d.vue.ts +3 -0
- package/dist/runtime/vue/components/workspaces/WorkspaceBillingSwitch.vue +54 -0
- package/dist/runtime/vue/components/workspaces/WorkspaceBillingSwitch.vue.d.ts +3 -0
- package/dist/runtime/vue/components/workspaces/WorkspaceCredits.css +1 -1
- package/dist/runtime/vue/components/workspaces/WorkspaceList.css +1 -1
- package/dist/runtime/vue/components/workspaces/WorkspaceSettings.d.vue.ts +40 -2
- package/dist/runtime/vue/components/workspaces/WorkspaceSettings.vue +20 -2
- package/dist/runtime/vue/components/workspaces/WorkspaceSettings.vue.d.ts +40 -2
- package/dist/runtime/vue/components/workspaces/workspace-billing.d.ts +46 -13
- package/dist/runtime/vue/components/workspaces/workspace-billing.js +93 -16
- package/dist/runtime/vue/components/workspaces/workspace-settings.d.ts +4 -0
- package/dist/runtime/vue/composables/billing-format.d.ts +9 -4
- package/dist/runtime/vue/composables/billing-format.js +17 -9
- package/dist/runtime/vue/composables/billing-provider.js +3 -2
- package/dist/runtime/vue/composables/prepare-photo.d.ts +75 -0
- package/dist/runtime/vue/composables/prepare-photo.js +223 -0
- package/dist/runtime/vue/composables/use-access.d.ts +41 -2
- package/dist/runtime/vue/composables/use-access.js +54 -8
- package/dist/runtime/vue/composables/use-billing-section.d.ts +115 -0
- package/dist/runtime/vue/composables/use-billing-section.js +76 -0
- package/dist/runtime/vue/composables/use-billing.d.ts +76 -5
- package/dist/runtime/vue/composables/use-billing.js +48 -0
- package/dist/runtime/vue/composables/use-gift-form.d.ts +123 -0
- package/dist/runtime/vue/composables/use-gift-form.js +152 -0
- package/dist/runtime/vue/composables/use-gift-list.d.ts +62 -5
- package/dist/runtime/vue/composables/use-gift-list.js +17 -6
- package/dist/runtime/vue/composables/use-install-prompt.d.ts +71 -0
- package/dist/runtime/vue/composables/use-install-prompt.js +53 -0
- package/dist/runtime/vue/composables/use-labels.js +17 -23
- package/dist/runtime/vue/composables/use-login-flow.d.ts +9 -0
- package/dist/runtime/vue/composables/use-login-flow.js +7 -0
- package/dist/runtime/vue/composables/use-orders.d.ts +1 -1
- package/dist/runtime/vue/composables/use-plan-change.d.ts +148 -0
- package/dist/runtime/vue/composables/use-plan-change.js +130 -0
- package/dist/runtime/vue/composables/use-pricing.d.ts +83 -5
- package/dist/runtime/vue/composables/use-pricing.js +83 -17
- package/dist/runtime/vue/composables/use-push-subscription.js +1 -7
- package/dist/runtime/vue/composables/use-referral-invite.d.ts +24 -2
- package/dist/runtime/vue/composables/use-referral-invite.js +14 -2
- package/dist/runtime/vue/composables/use-referrals.js +2 -1
- package/dist/runtime/vue/composables/use-report-appeal.d.ts +86 -0
- package/dist/runtime/vue/composables/use-report-appeal.js +61 -0
- package/dist/runtime/vue/composables/use-return-path.d.ts +5 -4
- package/dist/runtime/vue/composables/use-return-path.js +16 -2
- package/dist/runtime/vue/composables/use-waitlist.d.ts +31 -1
- package/dist/runtime/vue/composables/use-waitlist.js +39 -4
- package/dist/runtime/vue/composables/use-withdrawal.d.ts +63 -0
- package/dist/runtime/vue/composables/use-withdrawal.js +38 -0
- package/dist/runtime/vue/middleware/page-access.js +2 -2
- package/dist/runtime/vue/pages/gifts.vue +2 -0
- package/dist/runtime/vue/pages/login.vue +5 -7
- package/dist/runtime/vue/pages/pricing.vue +1 -2
- package/dist/runtime/vue/pages/report.vue +2 -3
- package/dist/runtime/vue/parts.d.ts +5 -0
- package/dist/runtime/vue/plugins/checkout-return.js +9 -2
- package/dist/runtime/vue/plugins/chunk-recovery.client.d.ts +10 -0
- package/dist/runtime/vue/plugins/chunk-recovery.client.js +10 -0
- package/dist/runtime/vue/plugins/install-banner.client.d.ts +7 -0
- package/dist/runtime/vue/plugins/install-banner.client.js +5 -0
- package/dist/runtime/vue/plugins/install-prompt.client.d.ts +7 -0
- package/dist/runtime/vue/plugins/install-prompt.client.js +6 -0
- package/dist/runtime/vue/plugins/session-ended.js +2 -3
- package/dist/runtime/vue/utils/active-locale.js +8 -0
- package/dist/runtime/vue/utils/checkout-return.d.ts +11 -1
- package/dist/runtime/vue/utils/checkout-return.js +6 -2
- package/dist/runtime/vue/utils/confirm-group.d.ts +18 -0
- package/dist/runtime/vue/utils/confirm-group.js +17 -0
- package/dist/runtime/vue/utils/display-mode.d.ts +8 -0
- package/dist/runtime/vue/utils/display-mode.js +11 -0
- package/dist/runtime/vue/utils/gift-days.d.ts +20 -0
- package/dist/runtime/vue/utils/gift-days.js +32 -0
- package/dist/runtime/vue/utils/heic-absent.d.ts +2 -0
- package/dist/runtime/vue/utils/heic-absent.js +3 -0
- package/dist/runtime/vue/utils/intl.d.ts +12 -4
- package/dist/runtime/vue/utils/intl.js +13 -2
- package/dist/runtime/vue/utils/kept-invite.js +6 -29
- package/dist/runtime/vue/utils/namespace.js +7 -2
- package/dist/runtime/vue/utils/page-open.d.ts +1 -0
- package/dist/runtime/vue/utils/page-open.js +12 -0
- package/dist/runtime/vue/utils/page-origin.d.ts +15 -0
- package/dist/runtime/vue/utils/page-origin.js +8 -0
- package/dist/runtime/vue/utils/page-rules.d.ts +9 -0
- package/dist/runtime/vue/utils/page-rules.js +3 -0
- package/dist/runtime/vue/utils/plan-change-confirm.d.ts +88 -0
- package/dist/runtime/vue/utils/plan-change-confirm.js +48 -0
- package/dist/runtime/vue/utils/pricing-bindings.d.ts +7 -1
- package/dist/runtime/vue/utils/pricing-bindings.js +21 -0
- package/dist/runtime/vue/utils/pricing-checkout.d.ts +39 -0
- package/dist/runtime/vue/utils/pricing-checkout.js +22 -0
- package/dist/runtime/vue/utils/pricing-seo.js +4 -2
- package/dist/runtime/vue/utils/tab-keep.d.ts +19 -0
- package/dist/runtime/vue/utils/tab-keep.js +46 -0
- package/dist/shared/{nuxt-backend.G4JryO1q.mjs → nuxt-backend.BqXAZChe.mjs} +277 -51
- package/dist/shared/{nuxt-backend.Lk2MQI2u.mjs → nuxt-backend.CBvrM7pG.mjs} +26 -2
- package/dist/shared/{nuxt-backend.D9qXcOOI.mjs → nuxt-backend.DH1Ya3uB.mjs} +1 -1
- package/dist/shared/{nuxt-backend.Bq_mhlky.mjs → nuxt-backend.DbaXvH__.mjs} +55 -10
- package/dist/shared/{nuxt-backend.DmZI-QSO.mjs → nuxt-backend.Dikfaocl.mjs} +54 -30
- package/package.json +6 -1
- package/skills/nuxt-backend/references/api.md +28 -10
- package/skills/nuxt-backend/references/install.md +4 -1
- package/skills/nuxt-backend/references/renames.json +112 -0
- package/skills/nuxt-backend/references/surface.json +32 -2
- package/skills/nuxt-backend-ai/references/api.md +2 -1
- package/skills/nuxt-backend-auth/references/api.md +1 -1
- package/skills/nuxt-backend-billing/SKILL.md +9 -0
- package/skills/nuxt-backend-billing/references/api.md +4 -0
- package/skills/nuxt-backend-data/references/api.md +4 -1
- package/skills/nuxt-backend-email/SKILL.md +5 -2
- package/skills/nuxt-backend-email/references/api.md +1 -0
- package/skills/nuxt-backend-growth/references/api.md +4 -0
- package/skills/nuxt-backend-ship/SKILL.md +1 -1
- package/skills/nuxt-backend-ship/references/api.md +9 -5
- package/skills/nuxt-backend-ui/SKILL.md +10 -5
- package/skills/nuxt-backend-upgrade/SKILL.md +4 -3
- package/skills/nuxt-backend-upgrade/references/upgrade.md +49 -0
- package/src/convex/catalog.ts +17 -0
- package/src/convex/components/backend/_generated/component.ts +30 -2
- package/src/convex/components/backend/billing.ts +19 -5
- package/src/convex/components/backend/jobs.ts +102 -5
- package/src/convex/components/backend/schema.ts +11 -0
- package/src/convex/delivery.ts +26 -1
- package/src/convex/emails/renewal-reminder.ts +19 -1
- package/src/convex/errors.ts +23 -9
- package/src/convex/events.ts +7 -0
- package/src/convex/integrations/ai/images.ts +22 -8
- package/src/convex/integrations/ai/job-errors.ts +64 -9
- package/src/convex/integrations/ai/jobs.ts +509 -64
- package/src/convex/integrations/ai/models.ts +1 -1
- package/src/convex/integrations/ai/moderation.ts +10 -5
- package/src/convex/integrations/ai.ts +6 -1
- package/src/convex/integrations/billing/context.ts +6 -3
- package/src/convex/integrations/billing/credits.ts +4 -1
- package/src/convex/integrations/billing/passes.ts +3 -11
- package/src/convex/integrations/billing/provider-failure.ts +56 -0
- package/src/convex/integrations/billing/types/setup.ts +1 -1
- package/src/convex/integrations/billing/types/surface.ts +9 -2
- package/src/convex/integrations/email-sync.ts +74 -26
- package/src/convex/integrations/inbound.ts +32 -16
- package/src/convex/integrations/launch.ts +52 -5
- package/src/convex/integrations/referrals.ts +25 -7
- package/src/convex/integrations/storage.ts +107 -1
- package/src/convex/label-groups/admin.ts +3 -0
- package/src/convex/label-groups/audit.ts +1 -0
- package/src/convex/label-groups/auth.ts +7 -0
- package/src/convex/label-groups/errors.ts +12 -0
- package/src/convex/label-groups/gift.ts +27 -0
- package/src/convex/label-groups/pricing.ts +20 -0
- package/src/convex/label-groups/referral.ts +4 -0
- package/src/convex/label-groups/settings.ts +39 -0
- package/src/convex/label-groups/waitlist.ts +7 -2
- package/src/convex/legal.ts +23 -2
- package/src/convex/log.ts +8 -0
- package/src/convex/money.ts +40 -0
- package/src/convex/report-rules.ts +16 -0
- package/src/convex/test-billing.ts +189 -0
- package/src/convex/test-models.ts +59 -4
- package/src/convex/test.ts +95 -8
- package/src/runtime/vue/components/account/AccountDeletion.css +1 -1
- package/src/runtime/vue/components/account/ActivationChecklist.css +5 -3
- package/src/runtime/vue/components/account/ConsentPrompt.css +7 -5
- package/src/runtime/vue/components/account/EmailUnsubscribe.css +8 -4
- package/src/runtime/vue/components/account/HowDidYouHear.css +9 -5
- package/src/runtime/vue/components/account/KeepAccount.css +4 -2
- package/src/runtime/vue/components/account/OnboardingFlow.css +6 -4
- package/src/runtime/vue/components/account/ProfileIdentity.css +1 -1
- package/src/runtime/vue/components/account/ProfilePreferencesSection.css +4 -2
- package/src/runtime/vue/components/account/ProfileSettings.css +4 -2
- package/src/runtime/vue/components/account/SecurityAlerts.css +1 -1
- package/src/runtime/vue/components/account/SecurityPasskeys.css +3 -3
- package/src/runtime/vue/components/account/SecuritySessions.css +1 -1
- package/src/runtime/vue/components/account/SecuritySettings.css +1 -1
- package/src/runtime/vue/components/admin/AdminAccess.css +1 -1
- package/src/runtime/vue/components/admin/AdminAnnouncements.css +2 -2
- package/src/runtime/vue/components/admin/AdminBilling.css +1 -1
- package/src/runtime/vue/components/admin/AdminChart.css +1 -1
- package/src/runtime/vue/components/admin/AdminConsole.css +1 -0
- package/src/runtime/vue/components/admin/AdminExperiments.css +1 -1
- package/src/runtime/vue/components/admin/AdminFlags.css +2 -2
- package/src/runtime/vue/components/admin/AdminQueue.css +5 -3
- package/src/runtime/vue/components/admin/AdminQueueJob.vue +6 -2
- package/src/runtime/vue/components/admin/AdminReferrals.css +4 -2
- package/src/runtime/vue/components/admin/AdminReports.css +1 -1
- package/src/runtime/vue/components/admin/AdminRevenue.css +1 -1
- package/src/runtime/vue/components/admin/admin.css +3 -3
- package/src/runtime/vue/components/auth/AuthForm.css +7 -4
- package/src/runtime/vue/components/auth/AuthForm.vue +1 -2
- package/src/runtime/vue/components/auth/AuthFormChoose.css +2 -1
- package/src/runtime/vue/components/auth/AuthFormHeader.css +1 -1
- package/src/runtime/vue/components/auth/AuthFormPasskeyOffer.css +1 -1
- package/src/runtime/vue/components/auth/InviteRedeem.css +56 -2
- package/src/runtime/vue/components/auth/InviteRedeem.vue +92 -12
- package/src/runtime/vue/components/auth/ReauthenticateCode.css +1 -1
- package/src/runtime/vue/components/auth/ReauthenticateDialog.css +6 -3
- package/src/runtime/vue/components/auth/ReauthenticatePasskey.css +1 -1
- package/src/runtime/vue/components/auth/WaitlistForm.css +4 -2
- package/src/runtime/vue/components/auth/WaitlistForm.vue +5 -6
- package/src/runtime/vue/components/auth/WaitlistPlace.css +4 -2
- package/src/runtime/vue/components/auth/WaitlistShare.css +6 -4
- package/src/runtime/vue/components/auth/WaitlistShare.vue +2 -8
- package/src/runtime/vue/components/auth/WaitlistStatus.css +27 -1
- package/src/runtime/vue/components/auth/WaitlistStatus.vue +149 -36
- package/src/runtime/vue/components/billing/BillingHistory.css +2 -2
- package/src/runtime/vue/components/billing/BillingHistoryOrder.css +1 -1
- package/src/runtime/vue/components/billing/CancelConfirmGroup.vue +2 -8
- package/src/runtime/vue/components/billing/CancelFlow.css +6 -4
- package/src/runtime/vue/components/billing/GiftForm.css +89 -0
- package/src/runtime/vue/components/billing/GiftForm.vue +251 -0
- package/src/runtime/vue/components/billing/GiftList.css +5 -3
- package/src/runtime/vue/components/billing/GiftList.vue +21 -9
- package/src/runtime/vue/components/billing/GiftReceived.vue +11 -3
- package/src/runtime/vue/components/billing/PlanChangeConfirmGroup.vue +59 -0
- package/src/runtime/vue/components/billing/PricingChangeConfirm.vue +22 -0
- package/src/runtime/vue/components/billing/PricingPackCard.css +1 -1
- package/src/runtime/vue/components/billing/PricingPlanCard.css +31 -4
- package/src/runtime/vue/components/billing/PricingPlanCard.vue +17 -2
- package/src/runtime/vue/components/billing/PricingTable.css +2 -2
- package/src/runtime/vue/components/billing/PricingTable.vue +122 -66
- package/src/runtime/vue/components/billing/ReferralCard.css +6 -4
- package/src/runtime/vue/components/billing/ReferralLanding.css +14 -3
- package/src/runtime/vue/components/billing/ReferralLanding.vue +53 -3
- package/src/runtime/vue/components/billing/UpgradePrompt.css +6 -4
- package/src/runtime/vue/components/billing/UsageHistory.css +2 -2
- package/src/runtime/vue/components/billing/WithdrawalButton.css +5 -3
- package/src/runtime/vue/components/shared.css +62 -9
- package/src/runtime/vue/components/shell/AccessDenied.css +5 -3
- package/src/runtime/vue/components/shell/AiLabel.css +2 -2
- package/src/runtime/vue/components/shell/AppShell.css +5 -3
- package/src/runtime/vue/components/shell/ConfirmDialog.css +5 -3
- package/src/runtime/vue/components/shell/ConnectionStatus.css +1 -1
- package/src/runtime/vue/components/shell/ContactForm.css +4 -2
- package/src/runtime/vue/components/shell/Gate.css +5 -3
- package/src/runtime/vue/components/shell/LegalDocument.css +1 -1
- package/src/runtime/vue/components/shell/NoticeAnnouncement.css +1 -1
- package/src/runtime/vue/components/shell/NoticeDeletion.css +5 -3
- package/src/runtime/vue/components/shell/NoticeGift.css +1 -1
- package/src/runtime/vue/components/shell/NoticeImpersonation.css +1 -1
- package/src/runtime/vue/components/shell/NoticeLowCredits.css +6 -3
- package/src/runtime/vue/components/shell/NoticeMaintenance.css +1 -1
- package/src/runtime/vue/components/shell/NoticePastDue.css +5 -3
- package/src/runtime/vue/components/shell/NotificationInbox.css +6 -4
- package/src/runtime/vue/components/shell/ReportAppeal.vue +17 -14
- package/src/runtime/vue/components/shell/ReportNotice.css +1 -1
- package/src/runtime/vue/components/shell/UploadField.css +5 -3
- package/src/runtime/vue/components/shell/WorkspaceSwitcher.css +5 -3
- package/src/runtime/vue/components/tokens.css +30 -0
- package/src/runtime/vue/components/workspaces/AuditLog.css +2 -2
- package/src/runtime/vue/components/workspaces/WorkspaceBilling.css +75 -2
- package/src/runtime/vue/components/workspaces/WorkspaceBilling.vue +51 -63
- package/src/runtime/vue/components/workspaces/WorkspaceBillingPause.vue +78 -0
- package/src/runtime/vue/components/workspaces/WorkspaceBillingSwitch.vue +63 -0
- package/src/runtime/vue/components/workspaces/WorkspaceCredits.css +1 -0
- package/src/runtime/vue/components/workspaces/WorkspaceList.css +2 -2
- package/src/runtime/vue/components/workspaces/WorkspaceSettings.vue +35 -5
- package/src/runtime/vue/pages/gifts.vue +12 -7
- package/src/runtime/vue/pages/invite.vue +4 -2
- package/src/runtime/vue/pages/login.vue +8 -8
- package/src/runtime/vue/pages/pricing.vue +1 -4
- package/src/runtime/vue/pages/report.vue +2 -3
- package/src/runtime/vue/pages/waitlist.vue +8 -5
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Money as the billing provider states it: an integer in the currency's
|
|
2
|
+
// smallest unit. The provider counts every currency in hundredths except a
|
|
3
|
+
// fixed few: the ones it counts in whole units (JPY, KRW) and the dinars
|
|
4
|
+
// its payment processor counts in thousandths (KWD, BHD). Shared by the
|
|
5
|
+
// pages, which format prices, and the emails, which state them.
|
|
6
|
+
//
|
|
7
|
+
// A fixed table, never `Intl`'s digits: the CLDR data behind `Intl` writes
|
|
8
|
+
// HUF, ISK, IDR, COP and PKR with no decimals while the provider still
|
|
9
|
+
// states them in hundredths (a 5 000 Ft plan arrives as 500000), and it
|
|
10
|
+
// differs between ICU versions, so the server, the Convex runtime and each
|
|
11
|
+
// browser could disagree. The lists are Polar's own
|
|
12
|
+
// (`get_currency_decimal_factor` in its `server/polar/kit/currency.py`):
|
|
13
|
+
// Stripe's zero-decimal currencies but UGX, which Stripe still takes in
|
|
14
|
+
// hundredths, as it does ISK; and Stripe's three-decimal currencies
|
|
15
|
+
// (docs.stripe.com/currencies), none of which Polar sells yet. The renewal
|
|
16
|
+
// reminder email restates them, since an ejected email imports only from
|
|
17
|
+
// `nuxt-backend/email`; test/unit/billing-money.test.ts holds the two
|
|
18
|
+
// together.
|
|
19
|
+
|
|
20
|
+
/** The currencies the provider states in whole units: `1500` JPY is ¥1,500. */
|
|
21
|
+
const WHOLE_UNITS = new Set(['BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'])
|
|
22
|
+
|
|
23
|
+
/** The currencies stated in thousandths: `1999` KWD is 1.999 KWD. */
|
|
24
|
+
const THOUSANDTHS = new Set(['BHD', 'JOD', 'KWD', 'OMR', 'TND'])
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* How many digits below its main unit the provider states `currency`
|
|
28
|
+
* (ISO 4217, either case) in: 2 for USD, EUR, HUF and ISK, 0 for JPY and
|
|
29
|
+
* KRW, 3 for KWD. Any other code counts as 2, the provider's own default.
|
|
30
|
+
* The same answer on every runtime: it reads no locale data.
|
|
31
|
+
*/
|
|
32
|
+
export function minorUnitDigits(currency: string): number {
|
|
33
|
+
const code = currency.toUpperCase()
|
|
34
|
+
return WHOLE_UNITS.has(code) ? 0 : THOUSANDTHS.has(code) ? 3 : 2
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** An amount in `currency`'s smallest unit, in its main one: 1999 USD cents are 19.99, 1999 JPY are 1999, 500000 HUF are 5000. */
|
|
38
|
+
export function toMajorUnits(amount: number, currency: string): number {
|
|
39
|
+
return amount / 10 ** minorUnitDigits(currency)
|
|
40
|
+
}
|
|
@@ -16,3 +16,19 @@ export const REMOVAL_DEADLINE_MS = 48 * 60 * 60 * 1000
|
|
|
16
16
|
|
|
17
17
|
/** Where the appeal token travels in the `report` page's address: its fragment, never sent to a server. */
|
|
18
18
|
export const APPEAL_FRAGMENT = 'appeal='
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The appeal token an address's fragment carries (`#appeal=<token>`), or
|
|
22
|
+
* `null` for none. A fragment that is not percent-encoded right (`%E0`,
|
|
23
|
+
* from a link cut short) carries none either, rather than throwing.
|
|
24
|
+
*/
|
|
25
|
+
export function appealTokenOf(hash: string): string | null {
|
|
26
|
+
let fragment: string
|
|
27
|
+
try {
|
|
28
|
+
fragment = decodeURIComponent(hash.replace(/^#/, '')).trim()
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return null
|
|
32
|
+
}
|
|
33
|
+
return fragment.startsWith(APPEAL_FRAGMENT) ? fragment.slice(APPEAL_FRAGMENT.length) || null : null
|
|
34
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
// The billing provider's fake `nuxt-backend/test` hands an app: `fetch`
|
|
2
|
+
// answered for the provider's usage-event ingest, as its API answers it, so
|
|
3
|
+
// a test of credits that reach the provider (a job's charge, a refund, a
|
|
4
|
+
// cost report) runs the package's real billing with no network and no
|
|
5
|
+
// account. Each event is kept once by its idempotency key, as the provider
|
|
6
|
+
// keeps it, and a switch refuses the next charges or refunds with a 503.
|
|
7
|
+
// Development and production never load it.
|
|
8
|
+
|
|
9
|
+
/** The provider's API hosts: the sandbox tests bill in, and production. */
|
|
10
|
+
const PROVIDER_HOSTS = new Set(['sandbox-api.polar.sh', 'api.polar.sh'])
|
|
11
|
+
|
|
12
|
+
/** The usage-event ingest, as the provider's API serves it. */
|
|
13
|
+
const INGEST_PATH = '/v1/events/ingest'
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A usage event the fake billing provider took.
|
|
17
|
+
*
|
|
18
|
+
* @experimental
|
|
19
|
+
*/
|
|
20
|
+
export interface TestUsageEvent {
|
|
21
|
+
/** The event's name: the meter's event name, or `job.cost` for a job's cost report. */
|
|
22
|
+
name: string
|
|
23
|
+
/** The billing entity it bills, as the provider's external customer id: a workspace, or an account under `billTo: 'user'`. */
|
|
24
|
+
customer: string
|
|
25
|
+
/** Its idempotency key: a second event with the same key is a duplicate the provider drops. */
|
|
26
|
+
externalId?: string
|
|
27
|
+
/** The credits it moves, read from its numeric metadata (the sum meter's property): positive for a charge, negative for a refund; absent for a report. */
|
|
28
|
+
value?: number
|
|
29
|
+
/** Its metadata as sent: the meter's property, and what the charge named (`userId`, `job`, an app's own keys). */
|
|
30
|
+
metadata: Record<string, unknown>
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* What {@link stubBillingProvider} answers with, and what it took.
|
|
35
|
+
*
|
|
36
|
+
* @experimental
|
|
37
|
+
*/
|
|
38
|
+
export interface TestBillingProvider {
|
|
39
|
+
/** Every event it took, in order, each idempotency key once. */
|
|
40
|
+
readonly events: readonly TestUsageEvent[]
|
|
41
|
+
/** The charges it took: events that move credits up. */
|
|
42
|
+
readonly charges: readonly TestUsageEvent[]
|
|
43
|
+
/** The refunds it took: events that move credits back, their `value` negative. */
|
|
44
|
+
readonly refunds: readonly TestUsageEvent[]
|
|
45
|
+
/** How many ingest calls it refused. */
|
|
46
|
+
readonly refused: number
|
|
47
|
+
/**
|
|
48
|
+
* Refuse the next charges (or refunds) with a 503, as a provider having
|
|
49
|
+
* trouble does: `times` of them, or every one until `accept()`.
|
|
50
|
+
* A refused event is not kept, so a retry under its key is new.
|
|
51
|
+
*/
|
|
52
|
+
refuse: (what?: 'charges' | 'refunds', times?: number) => void
|
|
53
|
+
/** Take every event again. */
|
|
54
|
+
accept: () => void
|
|
55
|
+
/** Put the `fetch` it replaced back: call it after the test. */
|
|
56
|
+
restore: () => void
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* How {@link stubBillingProvider} answers.
|
|
61
|
+
*
|
|
62
|
+
* @experimental
|
|
63
|
+
*/
|
|
64
|
+
export interface StubBillingProviderOptions {
|
|
65
|
+
/** The status a refused event gets. Default `503`. */
|
|
66
|
+
status?: number
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
type Refusals = { charges: number, refunds: number }
|
|
70
|
+
|
|
71
|
+
/** A wire event's credits: its first finite number, the meter's property; the reserved `_cost` and `_llm` are not credits. */
|
|
72
|
+
function valueOf(metadata: Record<string, unknown>): number | undefined {
|
|
73
|
+
for (const [key, value] of Object.entries(metadata)) {
|
|
74
|
+
if (!key.startsWith('_') && typeof value === 'number' && Number.isFinite(value)) return value
|
|
75
|
+
}
|
|
76
|
+
return undefined
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** A wire field that is text, or nothing. */
|
|
80
|
+
const textOf = (value: unknown): string => typeof value === 'string' ? value : ''
|
|
81
|
+
|
|
82
|
+
/** A wire event, as the provider reads it (snake case). */
|
|
83
|
+
function eventOf(entry: Record<string, unknown>): TestUsageEvent {
|
|
84
|
+
const metadata = (entry.metadata && typeof entry.metadata === 'object' ? entry.metadata : {}) as Record<string, unknown>
|
|
85
|
+
const value = valueOf(metadata)
|
|
86
|
+
return {
|
|
87
|
+
name: textOf(entry.name),
|
|
88
|
+
customer: textOf(entry.external_customer_id ?? entry.customer_id),
|
|
89
|
+
...(typeof entry.external_id === 'string' ? { externalId: entry.external_id } : {}),
|
|
90
|
+
...(value === undefined ? {} : { value }),
|
|
91
|
+
metadata,
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Whether the next refusal falls on these events: a batch holding a charge counts as a charge, one holding a refund as a refund. */
|
|
96
|
+
function takesRefusal(refusals: Refusals, events: readonly TestUsageEvent[]): boolean {
|
|
97
|
+
for (const kind of ['charges', 'refunds'] as const) {
|
|
98
|
+
if (refusals[kind] <= 0) continue
|
|
99
|
+
if (!events.some(event => event.value !== undefined && (kind === 'charges' ? event.value > 0 : event.value < 0))) continue
|
|
100
|
+
refusals[kind]--
|
|
101
|
+
return true
|
|
102
|
+
}
|
|
103
|
+
return false
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Answer the billing provider's usage-event ingest in `fetch`, as its API
|
|
108
|
+
* would: every charge, refund and cost report the package's billing sends
|
|
109
|
+
* is taken and kept once by its idempotency key, and reported back in
|
|
110
|
+
* `events`, `charges` and `refunds`. Any other request goes to the `fetch`
|
|
111
|
+
* it replaced, so it composes with `stubStorageFetch` in either order.
|
|
112
|
+
* Returns the fake, with `restore` to put `fetch` back.
|
|
113
|
+
*
|
|
114
|
+
* A charge reaches the provider only for an entity that is its customer:
|
|
115
|
+
* give it one with `seedBilling(t, entityId, { customer: true, credits })`.
|
|
116
|
+
* Without one, the charge is refused `not_ready` (`no_customer`) before any
|
|
117
|
+
* event is sent.
|
|
118
|
+
*
|
|
119
|
+
* @experimental
|
|
120
|
+
*
|
|
121
|
+
* @param options - The status a refused event gets.
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```ts
|
|
125
|
+
* let provider: TestBillingProvider
|
|
126
|
+
* beforeEach(() => { provider = stubBillingProvider() })
|
|
127
|
+
* afterEach(() => provider.restore())
|
|
128
|
+
*
|
|
129
|
+
* test('a refused charge stays owed, then lands', async () => {
|
|
130
|
+
* provider.refuse('charges', 1)
|
|
131
|
+
* // …run the job with drain(t, vi)…
|
|
132
|
+
* expect(provider.charges).toEqual([expect.objectContaining({ value: 3, metadata: expect.objectContaining({ stripId }) })])
|
|
133
|
+
* })
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
export function stubBillingProvider(options: StubBillingProviderOptions = {}): TestBillingProvider {
|
|
137
|
+
const status = options.status ?? 503
|
|
138
|
+
const events: TestUsageEvent[] = []
|
|
139
|
+
const refusals: Refusals = { charges: 0, refunds: 0 }
|
|
140
|
+
let refused = 0
|
|
141
|
+
const original = globalThis.fetch
|
|
142
|
+
globalThis.fetch = async (input: RequestInfo | URL, init?: RequestInit): Promise<Response> => {
|
|
143
|
+
const request = new Request(input, init)
|
|
144
|
+
const url = new URL(request.url)
|
|
145
|
+
if (!PROVIDER_HOSTS.has(url.host)) return original(input, init)
|
|
146
|
+
if (request.method !== 'POST' || url.pathname !== INGEST_PATH) {
|
|
147
|
+
return Response.json({ error: 'NotFound', detail: `The fake billing provider answers ${INGEST_PATH} only, not ${request.method} ${url.pathname}.` }, { status: 404 })
|
|
148
|
+
}
|
|
149
|
+
const body = await request.json() as { events?: Array<Record<string, unknown>> }
|
|
150
|
+
const batch = (body.events ?? []).map(eventOf)
|
|
151
|
+
if (takesRefusal(refusals, batch)) {
|
|
152
|
+
refused++
|
|
153
|
+
return Response.json({ error: 'ServiceUnavailable', detail: 'The fake billing provider refused this event, as asked.' }, { status })
|
|
154
|
+
}
|
|
155
|
+
let inserted = 0
|
|
156
|
+
let duplicates = 0
|
|
157
|
+
for (const event of batch) {
|
|
158
|
+
if (event.externalId !== undefined && events.some(kept => kept.externalId === event.externalId)) {
|
|
159
|
+
duplicates++
|
|
160
|
+
continue
|
|
161
|
+
}
|
|
162
|
+
events.push(event)
|
|
163
|
+
inserted++
|
|
164
|
+
}
|
|
165
|
+
return Response.json({ inserted, duplicates })
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
events,
|
|
169
|
+
get charges() {
|
|
170
|
+
return events.filter(event => event.value !== undefined && event.value > 0)
|
|
171
|
+
},
|
|
172
|
+
get refunds() {
|
|
173
|
+
return events.filter(event => event.value !== undefined && event.value < 0)
|
|
174
|
+
},
|
|
175
|
+
get refused() {
|
|
176
|
+
return refused
|
|
177
|
+
},
|
|
178
|
+
refuse: (what = 'charges', times = Number.POSITIVE_INFINITY) => {
|
|
179
|
+
refusals[what] = times
|
|
180
|
+
},
|
|
181
|
+
accept: () => {
|
|
182
|
+
refusals.charges = 0
|
|
183
|
+
refusals.refunds = 0
|
|
184
|
+
},
|
|
185
|
+
restore: () => {
|
|
186
|
+
globalThis.fetch = original
|
|
187
|
+
},
|
|
188
|
+
}
|
|
189
|
+
}
|
|
@@ -6,7 +6,8 @@ import { TEST_EMBEDDING_MODELS, TEST_IMAGE_MODELS, TEST_MODELS } from './integra
|
|
|
6
6
|
// reports a fixed cost in the shape the AI Gateway reports it, so a test of a
|
|
7
7
|
// metered action settles through the path a live call does, with no key and
|
|
8
8
|
// no network. A safety classifier's id (Llama Guard, a safeguard model) gets
|
|
9
|
-
// a classifier instead, so `ai.requireSafe` passes or refuses on purpose,
|
|
9
|
+
// a classifier instead, so `ai.requireSafe` passes or refuses on purpose,
|
|
10
|
+
// from a marker in the text or in an image's bytes, and
|
|
10
11
|
// an image model's id (`google/gemini-2.5-flash-image`, `openai/gpt-image-1`)
|
|
11
12
|
// answers with a PNG beside the text, so a step that stores the image runs.
|
|
12
13
|
// Development and production never load it: it is installed by
|
|
@@ -29,6 +30,59 @@ function lastUserText(prompt: Parameters<MeteredModel['doGenerate']>[0]['prompt'
|
|
|
29
30
|
/** What text carries for the mock safety classifier to flag it: `unsafe` and `S1`. Anything else is `safe`. */
|
|
30
31
|
export const TEST_UNSAFE_MARKER = '[[unsafe]]'
|
|
31
32
|
|
|
33
|
+
/**
|
|
34
|
+
* The marker that has the mock safety classifier answer chosen Llama Guard
|
|
35
|
+
* codes: `TEST_UNSAFE_CODE('S7')` is `[[unsafe:S7]]`, answered
|
|
36
|
+
* `unsafe\nS7`; several codes join with a comma (`'S1,S10'`). In text,
|
|
37
|
+
* or anywhere in an image's bytes.
|
|
38
|
+
*
|
|
39
|
+
* @experimental
|
|
40
|
+
*/
|
|
41
|
+
export const TEST_UNSAFE_CODE = (codes: string): string => `[[unsafe:${codes}]]`
|
|
42
|
+
|
|
43
|
+
/** The markers the mock classifier reads: `[[unsafe]]`, or `[[unsafe:S7]]` with its codes. */
|
|
44
|
+
const CLASSIFIER_MARKER = /\[\[unsafe(?::(S\d{1,2}(?:,S\d{1,2})*))?\]\]/
|
|
45
|
+
|
|
46
|
+
/** Bytes as text, so a marker inside an image is found. */
|
|
47
|
+
const latin1 = (bytes: Uint8Array): string => {
|
|
48
|
+
let text = ''
|
|
49
|
+
for (const byte of bytes) text += String.fromCharCode(byte)
|
|
50
|
+
return text
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** The bytes of a file part of a prompt, as text: raw bytes, or base64. A file by URL is not read. */
|
|
54
|
+
function fileText(part: { data?: unknown }): string {
|
|
55
|
+
const data = (part.data && typeof part.data === 'object' && 'type' in part.data ? (part.data as { type: string, data?: unknown }).type === 'data' ? (part.data as { data?: unknown }).data : undefined : part.data)
|
|
56
|
+
if (data instanceof Uint8Array) return latin1(data)
|
|
57
|
+
if (typeof data !== 'string') return ''
|
|
58
|
+
try {
|
|
59
|
+
return latin1(Uint8Array.from(atob(data), char => char.charCodeAt(0)))
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return data
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** What the last user message of a prompt holds for the classifier: its text, and its images' bytes as text. */
|
|
67
|
+
function lastUserContent(prompt: Parameters<MeteredModel['doGenerate']>[0]['prompt']): string {
|
|
68
|
+
const user = [...prompt].reverse().find(message => message.role === 'user')
|
|
69
|
+
const content = user?.content as unknown
|
|
70
|
+
if (typeof content === 'string') return content
|
|
71
|
+
if (!Array.isArray(content)) return ''
|
|
72
|
+
return content.map((part) => {
|
|
73
|
+
if (!part || typeof part !== 'object') return ''
|
|
74
|
+
if ('text' in part) return String(part.text)
|
|
75
|
+
return (part as { type?: unknown }).type === 'file' || (part as { type?: unknown }).type === 'image' ? fileText(part as { data?: unknown }) : ''
|
|
76
|
+
}).join(' ')
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** How the mock classifier answers, as Llama Guard does: `safe`, or `unsafe` and the codes a marker asks for (`S1` for `[[unsafe]]`). */
|
|
80
|
+
export function classifierAnswer(content: string): string {
|
|
81
|
+
const marker = CLASSIFIER_MARKER.exec(content)
|
|
82
|
+
if (!marker) return 'safe'
|
|
83
|
+
return `unsafe\n${marker[1] ?? 'S1'}`
|
|
84
|
+
}
|
|
85
|
+
|
|
32
86
|
/** Whether an id names a safety classifier: Llama Guard, or a policy-following safeguard model. */
|
|
33
87
|
const isClassifier = (modelId: string): boolean => /llama-guard|safeguard/i.test(modelId)
|
|
34
88
|
|
|
@@ -49,13 +103,14 @@ const usage = {
|
|
|
49
103
|
/**
|
|
50
104
|
* The mock for a model id: it answers with the prompt it was given, and a
|
|
51
105
|
* fixed cost. A safety classifier's id answers as Llama Guard does: `safe`,
|
|
52
|
-
* or `unsafe` and `S1` for
|
|
53
|
-
*
|
|
106
|
+
* or `unsafe` and `S1` for content that carries {@link TEST_UNSAFE_MARKER},
|
|
107
|
+
* or the codes {@link TEST_UNSAFE_CODE} names, in its text or an image's
|
|
108
|
+
* bytes. An image model's id adds {@link TEST_IMAGE_PNG} as a generated file.
|
|
54
109
|
*/
|
|
55
110
|
export function testModel(modelId: string): MeteredModel {
|
|
56
111
|
if (!sdk) throw new Error('[nuxt-backend/test] A model call under test needs the AI SDK: install it with `pnpm add ai`.')
|
|
57
112
|
const answer = isClassifier(modelId)
|
|
58
|
-
? (prompt: Parameters<MeteredModel['doGenerate']>[0]['prompt']) =>
|
|
113
|
+
? (prompt: Parameters<MeteredModel['doGenerate']>[0]['prompt']) => classifierAnswer(lastUserContent(prompt))
|
|
59
114
|
: (prompt: Parameters<MeteredModel['doGenerate']>[0]['prompt']) => `Test reply to: ${lastUserText(prompt) || 'an empty prompt'}`
|
|
60
115
|
const providerMetadata = { gateway: { cost: String(TEST_MODEL_USD) } }
|
|
61
116
|
const finishReason = { unified: 'stop', raw: 'stop' } as const
|
package/src/convex/test.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="vite/client" />
|
|
2
2
|
import { convexTest, type TestConvex } from 'convex-test'
|
|
3
|
-
import { actionGeneric, componentsGeneric, type FunctionReference, type GenericSchema, type SchemaDefinition } from 'convex/server'
|
|
3
|
+
import { actionGeneric, componentsGeneric, type FunctionReference, type GenericSchema, queryGeneric, type SchemaDefinition } from 'convex/server'
|
|
4
4
|
import { v } from 'convex/values'
|
|
5
5
|
import actionCache from '@convex-dev/action-cache/test'
|
|
6
6
|
import aggregate from '@convex-dev/aggregate/test'
|
|
@@ -29,6 +29,13 @@ const testKitModule = {
|
|
|
29
29
|
args: { bytes: v.bytes(), type: v.optional(v.string()) },
|
|
30
30
|
handler: async (ctx, { bytes, type }) => ctx.storage.store(new Blob([bytes], type ? { type } : {})),
|
|
31
31
|
}),
|
|
32
|
+
exists: queryGeneric({
|
|
33
|
+
args: { storageId: v.string() },
|
|
34
|
+
handler: async (ctx, { storageId }) => {
|
|
35
|
+
const id = ctx.db.system.normalizeId('_storage', storageId)
|
|
36
|
+
return id !== null && await ctx.db.system.get('_storage', id) !== null
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
32
39
|
}
|
|
33
40
|
|
|
34
41
|
/**
|
|
@@ -124,7 +131,8 @@ export function register<Schema extends AnySchema>(
|
|
|
124
131
|
* `@convex-dev/workflow/test`.
|
|
125
132
|
*
|
|
126
133
|
* Each instance also has `upload` ({@link BackendTestApp}): a file sent
|
|
127
|
-
* into the `backend` component's storage, as an upload URL leaves it
|
|
134
|
+
* into the `backend` component's storage, as an upload URL leaves it; and
|
|
135
|
+
* `fileExists`: whether a file is still in that storage.
|
|
128
136
|
*
|
|
129
137
|
* The aggregate's own batch worker is left out, as `@convex-dev/aggregate/test`
|
|
130
138
|
* leaves it out: a test of async aggregate writes registers it from
|
|
@@ -180,7 +188,10 @@ export function defineBackendTestApp<Schema extends AnySchema>(
|
|
|
180
188
|
workpool.register(any)
|
|
181
189
|
for (const kit of optionalKits) kit?.register(any)
|
|
182
190
|
for (const [mount, kit] of mounts) kit.register(any, mount)
|
|
183
|
-
return Object.assign(t, {
|
|
191
|
+
return Object.assign(t, {
|
|
192
|
+
upload: (file?: TestFile, fileOptions?: TestUploadOptions) => upload(t, file, fileOptions),
|
|
193
|
+
fileExists: (storageId: string) => fileExists(t, storageId),
|
|
194
|
+
})
|
|
184
195
|
}
|
|
185
196
|
}
|
|
186
197
|
|
|
@@ -229,6 +240,12 @@ export type BackendTestApp<Schema extends AnySchema = AnySchema> = TestConvex<Sc
|
|
|
229
240
|
* valid 2 × 2 PNG ({@link TEST_PNG}).
|
|
230
241
|
*/
|
|
231
242
|
upload: (file?: TestFile, options?: TestUploadOptions) => Promise<string>
|
|
243
|
+
/**
|
|
244
|
+
* Whether a file is in the `backend` component's storage, by its
|
|
245
|
+
* storage id: `false` once it was deleted, or for an id it never held
|
|
246
|
+
* ({@link fileExists}).
|
|
247
|
+
*/
|
|
248
|
+
fileExists: (storageId: string) => Promise<boolean>
|
|
232
249
|
}
|
|
233
250
|
|
|
234
251
|
/** The value of each deployment variable a test app reads, when the test file sets none. */
|
|
@@ -294,6 +311,34 @@ export async function upload<Schema extends AnySchema>(
|
|
|
294
311
|
return t.action(uploadRef(name), { bytes, ...(type ? { type } : {}) })
|
|
295
312
|
}
|
|
296
313
|
|
|
314
|
+
/** The test kit's existence read, by mount name, through the generic component refs. */
|
|
315
|
+
function existsRef(name: string): FunctionReference<'query', 'internal', { storageId: string }, boolean> {
|
|
316
|
+
return (componentsGeneric() as unknown as Record<string, { testKit: { exists: FunctionReference<'query', 'internal', { storageId: string }, boolean> } }>)[name]!.testKit.exists
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Whether a file is in the `backend` component's storage, by its storage
|
|
321
|
+
* id: what a test of a deletion, a sweep or an erasure checks. `false`
|
|
322
|
+
* once the file is deleted, and for an id the storage never held. An
|
|
323
|
+
* instance from {@link defineBackendTestApp} has it as `t.fileExists(id)`.
|
|
324
|
+
*
|
|
325
|
+
* @experimental
|
|
326
|
+
*
|
|
327
|
+
* @param t - A test instance the `backend` component is registered with.
|
|
328
|
+
* @param storageId - The file's storage id.
|
|
329
|
+
* @param name - The name the `backend` component is mounted under.
|
|
330
|
+
*
|
|
331
|
+
* @example
|
|
332
|
+
* ```ts
|
|
333
|
+
* const fileId = await t.upload()
|
|
334
|
+
* await ada.mutation(api.photos.remove, { fileId })
|
|
335
|
+
* expect(await t.fileExists(fileId)).toBe(false)
|
|
336
|
+
* ```
|
|
337
|
+
*/
|
|
338
|
+
export async function fileExists<Schema extends AnySchema>(t: TestConvex<Schema>, storageId: string, name: string = 'backend'): Promise<boolean> {
|
|
339
|
+
return t.query(existsRef(name), { storageId })
|
|
340
|
+
}
|
|
341
|
+
|
|
297
342
|
type Syscalls = {
|
|
298
343
|
syscall: unknown
|
|
299
344
|
asyncSyscall: (op: string, args: string) => Promise<string>
|
|
@@ -445,13 +490,20 @@ export interface TestTimers {
|
|
|
445
490
|
* that stores a file never runs while another commits. Needs fake timers:
|
|
446
491
|
* pass `vi` after `vi.useFakeTimers()`.
|
|
447
492
|
*
|
|
493
|
+
* With `until`, it stops as soon as the condition holds, checked after
|
|
494
|
+
* each step: a test that changes something midway (a provider that comes
|
|
495
|
+
* back, a cancel while a job runs) drains to that point, acts, and drains
|
|
496
|
+
* on. It throws when every scheduled function ran and the condition never
|
|
497
|
+
* held.
|
|
498
|
+
*
|
|
448
499
|
* @experimental
|
|
449
500
|
*
|
|
450
501
|
* @param t - A test instance, e.g. from {@link defineBackendTestApp}.
|
|
451
502
|
* @param timers - Vitest's `vi`, its fake timers on.
|
|
452
|
-
* @param options - How many timers it fires at most before it gives up
|
|
453
|
-
* @param options.maxSteps - The timers fired at most.
|
|
454
|
-
* @
|
|
503
|
+
* @param options - How many timers it fires at most before it gives up, and when to stop early.
|
|
504
|
+
* @param options.maxSteps - The timers fired at most. Default 5000.
|
|
505
|
+
* @param options.until - Stop once this holds: a function of the test's own reads, sync or async.
|
|
506
|
+
* @throws Error when the scheduled functions keep scheduling past `maxSteps`, or, with `until`, when they all ran and it never held.
|
|
455
507
|
*
|
|
456
508
|
* @example
|
|
457
509
|
* ```ts
|
|
@@ -459,18 +511,43 @@ export interface TestTimers {
|
|
|
459
511
|
* await ada.action(api.photos.attach, { fileId: await t.upload() })
|
|
460
512
|
* await drain(t, vi)
|
|
461
513
|
* ```
|
|
514
|
+
*
|
|
515
|
+
* @example
|
|
516
|
+
* ```ts
|
|
517
|
+
* // Run the job until it starts, cancel it, then run everything else.
|
|
518
|
+
* await drain(t, vi, { until: async () => (await ada.query(api.jobs.getJob, { jobId }))?.status === 'running' })
|
|
519
|
+
* await ada.mutation(api.jobs.cancelJob, { jobId })
|
|
520
|
+
* await drain(t, vi)
|
|
521
|
+
* ```
|
|
462
522
|
*/
|
|
463
|
-
export async function drain<Schema extends AnySchema>(t: TestConvex<Schema>, timers: TestTimers, options:
|
|
523
|
+
export async function drain<Schema extends AnySchema>(t: TestConvex<Schema>, timers: TestTimers, options: DrainOptions = {}): Promise<void> {
|
|
464
524
|
if (timers.isFakeTimers?.() === false) throw new TypeError('[nuxt-backend] drain: turn fake timers on first, with vi.useFakeTimers().')
|
|
465
525
|
const maxSteps = options.maxSteps ?? 5000
|
|
526
|
+
const until = options.until
|
|
466
527
|
for (let step = 0; step < maxSteps; step++) {
|
|
467
528
|
await t.finishInProgressScheduledFunctions()
|
|
468
|
-
if (
|
|
529
|
+
if (until && await until()) return
|
|
530
|
+
if (timers.getTimerCount() === 0) {
|
|
531
|
+
if (until) throw new Error('[nuxt-backend] drain: every scheduled function ran, and `until` never held.')
|
|
532
|
+
return
|
|
533
|
+
}
|
|
469
534
|
timers.advanceTimersToNextTimer()
|
|
470
535
|
}
|
|
471
536
|
throw new Error(`[nuxt-backend] drain: the scheduled functions still scheduled more after ${maxSteps} timers. A function that schedules itself forever never drains.`)
|
|
472
537
|
}
|
|
473
538
|
|
|
539
|
+
/**
|
|
540
|
+
* How {@link drain} runs.
|
|
541
|
+
*
|
|
542
|
+
* @experimental
|
|
543
|
+
*/
|
|
544
|
+
export interface DrainOptions {
|
|
545
|
+
/** The timers it fires at most before it gives up. Default 5000. */
|
|
546
|
+
maxSteps?: number
|
|
547
|
+
/** Stop as soon as this holds, checked after each step. */
|
|
548
|
+
until?: () => boolean | Promise<boolean>
|
|
549
|
+
}
|
|
550
|
+
|
|
474
551
|
/**
|
|
475
552
|
* An entity's billing state, as a sync from the provider leaves it, for {@link seedBilling}.
|
|
476
553
|
*
|
|
@@ -739,4 +816,14 @@ export async function asUser<Schema extends AnySchema>(
|
|
|
739
816
|
*/
|
|
740
817
|
export { TEST_FAINT, TEST_KNOWN_ABUSE, TEST_UNSAFE } from './test-moderation.js'
|
|
741
818
|
|
|
819
|
+
/**
|
|
820
|
+
* The marker the mock safety classifier (a Llama Guard model's id under
|
|
821
|
+
* test) answers with chosen codes: `TEST_UNSAFE_CODE('S7')` in text or an
|
|
822
|
+
* image's bytes is answered `unsafe` and `S7`. `[[unsafe]]` still
|
|
823
|
+
* answers `S1`.
|
|
824
|
+
*/
|
|
825
|
+
export { TEST_UNSAFE_CODE } from './test-models.js'
|
|
826
|
+
|
|
827
|
+
export { stubBillingProvider, type StubBillingProviderOptions, type TestBillingProvider, type TestUsageEvent } from './test-billing.js'
|
|
828
|
+
|
|
742
829
|
export default { register, schema, modules }
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
@layer nuxt-backend {
|
|
7
7
|
[data-account='section-delete'] {
|
|
8
8
|
padding: 0.9rem;
|
|
9
|
-
border: var(--bk-border-width) solid color-mix(in srgb, var(--bk-error) 30%, transparent);
|
|
9
|
+
border: var(--bk-border-width-surface, var(--bk-border-width)) solid color-mix(in srgb, var(--bk-error) 30%, transparent);
|
|
10
10
|
box-shadow: var(--bk-shadow);
|
|
11
11
|
border-radius: var(--bk-radius);
|
|
12
12
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
flex-direction: column;
|
|
10
10
|
gap: 0.6rem;
|
|
11
11
|
padding: 1rem;
|
|
12
|
-
border: var(--bk-border-width) solid var(--bk-edge);
|
|
12
|
+
border: var(--bk-border-width-surface, var(--bk-border-width)) solid var(--bk-edge);
|
|
13
13
|
box-shadow: var(--bk-shadow);
|
|
14
14
|
border-radius: var(--bk-radius);
|
|
15
15
|
background: var(--bk-surface);
|
|
@@ -99,13 +99,15 @@
|
|
|
99
99
|
[data-activation='dismiss'] {
|
|
100
100
|
align-self: flex-start;
|
|
101
101
|
padding: 0.4rem 0.8rem;
|
|
102
|
-
border: var(--bk-border-width) solid var(--bk-edge);
|
|
103
|
-
box-shadow: var(--bk-shadow-control);
|
|
102
|
+
border: var(--bk-border-width-control, var(--bk-border-width)) solid var(--bk-edge);
|
|
103
|
+
box-shadow: var(--_bk-press-shadow, var(--bk-shadow-control));
|
|
104
|
+
translate: var(--_bk-press-offset);
|
|
104
105
|
border-radius: var(--bk-radius-control);
|
|
105
106
|
background: transparent;
|
|
106
107
|
color: inherit;
|
|
107
108
|
font: inherit;
|
|
108
109
|
font-family: var(--bk-font-control, var(--bk-font));
|
|
110
|
+
letter-spacing: var(--bk-tracking-control, revert-layer);
|
|
109
111
|
cursor: pointer;
|
|
110
112
|
}
|
|
111
113
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
margin: auto;
|
|
13
13
|
overflow: auto;
|
|
14
14
|
padding: 1.25rem;
|
|
15
|
-
border: var(--bk-border-width) solid var(--bk-edge);
|
|
15
|
+
border: var(--bk-border-width-surface, var(--bk-border-width)) solid var(--bk-edge);
|
|
16
16
|
box-shadow: var(--bk-shadow-overlay);
|
|
17
17
|
border-radius: var(--bk-radius);
|
|
18
18
|
background: Canvas;
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
[data-consent='age-input'] {
|
|
112
112
|
max-width: 8rem;
|
|
113
113
|
padding: 0.5rem 0.65rem;
|
|
114
|
-
border: var(--bk-border-width) solid var(--bk-edge);
|
|
114
|
+
border: var(--bk-border-width-control, var(--bk-border-width)) solid var(--bk-edge);
|
|
115
115
|
border-radius: var(--bk-radius-control);
|
|
116
116
|
background: var(--bk-surface);
|
|
117
117
|
color: inherit;
|
|
@@ -144,13 +144,15 @@
|
|
|
144
144
|
[data-consent='decline'],
|
|
145
145
|
[data-consent='later'] {
|
|
146
146
|
padding: 0.5rem 0.9rem;
|
|
147
|
-
border: var(--bk-border-width) solid var(--bk-edge);
|
|
148
|
-
box-shadow: var(--bk-shadow-control);
|
|
147
|
+
border: var(--bk-border-width-control, var(--bk-border-width)) solid var(--bk-edge);
|
|
148
|
+
box-shadow: var(--_bk-press-shadow, var(--bk-shadow-control));
|
|
149
|
+
translate: var(--_bk-press-offset);
|
|
149
150
|
border-radius: var(--bk-radius-control);
|
|
150
151
|
background: var(--bk-surface);
|
|
151
152
|
color: inherit;
|
|
152
153
|
font: inherit;
|
|
153
154
|
font-family: var(--bk-font-control, var(--bk-font));
|
|
155
|
+
letter-spacing: var(--bk-tracking-control, revert-layer);
|
|
154
156
|
cursor: pointer;
|
|
155
157
|
}
|
|
156
158
|
|
|
@@ -175,7 +177,7 @@
|
|
|
175
177
|
max-width: 36rem;
|
|
176
178
|
margin-inline: auto;
|
|
177
179
|
padding: 1rem;
|
|
178
|
-
border: var(--bk-border-width) solid var(--bk-edge);
|
|
180
|
+
border: var(--bk-border-width-surface, var(--bk-border-width)) solid var(--bk-edge);
|
|
179
181
|
border-radius: var(--bk-radius);
|
|
180
182
|
background: Canvas;
|
|
181
183
|
color: var(--bk-ink);
|
|
@@ -25,26 +25,30 @@
|
|
|
25
25
|
[data-unsubscribe='leave'],
|
|
26
26
|
[data-unsubscribe='confirm'] {
|
|
27
27
|
padding: 0.5rem 1rem;
|
|
28
|
-
border: var(--bk-border-width) solid var(--bk-accent);
|
|
29
|
-
box-shadow: var(--bk-shadow-control);
|
|
28
|
+
border: var(--bk-border-width-control, var(--bk-border-width)) solid var(--bk-accent);
|
|
29
|
+
box-shadow: var(--_bk-press-shadow, var(--bk-shadow-control));
|
|
30
|
+
translate: var(--_bk-press-offset);
|
|
30
31
|
border-radius: var(--bk-radius-control);
|
|
31
32
|
background: var(--bk-accent);
|
|
32
33
|
color: var(--bk-on-accent);
|
|
33
34
|
font: inherit;
|
|
34
35
|
font-family: var(--bk-font-control, var(--bk-font));
|
|
36
|
+
letter-spacing: var(--bk-tracking-control, revert-layer);
|
|
35
37
|
font-weight: 600;
|
|
36
38
|
cursor: pointer;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
[data-unsubscribe='leave-all'] {
|
|
40
42
|
padding: 0.5rem 1rem;
|
|
41
|
-
border: var(--bk-border-width) solid var(--bk-edge);
|
|
42
|
-
box-shadow: var(--bk-shadow-control);
|
|
43
|
+
border: var(--bk-border-width-control, var(--bk-border-width)) solid var(--bk-edge);
|
|
44
|
+
box-shadow: var(--_bk-press-shadow, var(--bk-shadow-control));
|
|
45
|
+
translate: var(--_bk-press-offset);
|
|
43
46
|
border-radius: var(--bk-radius-control);
|
|
44
47
|
background: transparent;
|
|
45
48
|
color: inherit;
|
|
46
49
|
font: inherit;
|
|
47
50
|
font-family: var(--bk-font-control, var(--bk-font));
|
|
51
|
+
letter-spacing: var(--bk-tracking-control, revert-layer);
|
|
48
52
|
cursor: pointer;
|
|
49
53
|
}
|
|
50
54
|
|