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.
- package/README.md +17 -6
- package/dist/capabilities/detect.js +16 -7
- package/dist/capabilities/gateway-route.js +24 -0
- package/dist/capabilities/registry.js +3 -2
- package/dist/capabilities/status.js +3 -1
- package/dist/chunks/catalog.mjs +1 -1
- package/dist/chunks/doctor.mjs +565 -75
- 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 +4 -4
- package/dist/chunks/run.mjs +1 -1
- package/dist/chunks/server.mjs +10 -6
- package/dist/cli.mjs +509 -55
- package/dist/convex/access-tickets.d.ts +20 -1
- package/dist/convex/access-tickets.d.ts.map +1 -1
- package/dist/convex/access-tickets.js +28 -0
- package/dist/convex/access-tickets.js.map +1 -1
- package/dist/convex/account-data.d.ts +25 -5
- package/dist/convex/account-data.d.ts.map +1 -1
- package/dist/convex/account-data.js +26 -7
- package/dist/convex/account-data.js.map +1 -1
- package/dist/convex/app.d.ts +15 -2
- package/dist/convex/app.d.ts.map +1 -1
- package/dist/convex/app.js +16 -2
- package/dist/convex/app.js.map +1 -1
- package/dist/convex/billing-launch.d.ts +36 -0
- package/dist/convex/billing-launch.d.ts.map +1 -0
- package/dist/convex/billing-launch.js +18 -0
- package/dist/convex/billing-launch.js.map +1 -0
- package/dist/convex/catalog.d.ts +38 -2
- package/dist/convex/catalog.d.ts.map +1 -1
- package/dist/convex/catalog.js.map +1 -1
- package/dist/convex/client/better-auth-options.d.ts.map +1 -1
- package/dist/convex/client/better-auth-options.js +11 -1
- package/dist/convex/client/better-auth-options.js.map +1 -1
- package/dist/convex/client/client-address.d.ts +21 -0
- package/dist/convex/client/client-address.d.ts.map +1 -0
- package/dist/convex/client/client-address.js +37 -0
- package/dist/convex/client/client-address.js.map +1 -0
- package/dist/convex/client/code-binding.js +1 -1
- package/dist/convex/client/component.d.ts.map +1 -1
- package/dist/convex/client/guards.js +3 -3
- package/dist/convex/client/guards.js.map +1 -1
- package/dist/convex/client/index.d.ts +128 -42
- package/dist/convex/client/index.d.ts.map +1 -1
- package/dist/convex/client/index.js +4 -3
- package/dist/convex/client/index.js.map +1 -1
- package/dist/convex/client/plugins.d.ts +67 -30
- package/dist/convex/client/plugins.d.ts.map +1 -1
- package/dist/convex/client/plugins.js +43 -19
- package/dist/convex/client/plugins.js.map +1 -1
- package/dist/convex/components/backend/_generated/api.d.ts +2 -0
- package/dist/convex/components/backend/_generated/api.d.ts.map +1 -1
- package/dist/convex/components/backend/_generated/api.js.map +1 -1
- package/dist/convex/components/backend/_generated/component.d.ts +460 -4
- package/dist/convex/components/backend/_generated/component.d.ts.map +1 -1
- package/dist/convex/components/backend/access.d.ts +47 -6
- package/dist/convex/components/backend/access.d.ts.map +1 -1
- package/dist/convex/components/backend/access.js +108 -16
- package/dist/convex/components/backend/access.js.map +1 -1
- package/dist/convex/components/backend/account.d.ts +12 -6
- package/dist/convex/components/backend/account.d.ts.map +1 -1
- package/dist/convex/components/backend/account.js +55 -4
- package/dist/convex/components/backend/account.js.map +1 -1
- package/dist/convex/components/backend/adapter.d.ts +1 -1
- package/dist/convex/components/backend/adapter.d.ts.map +1 -1
- package/dist/convex/components/backend/adapter.js +5 -2
- package/dist/convex/components/backend/adapter.js.map +1 -1
- package/dist/convex/components/backend/ai.d.ts +11 -3
- package/dist/convex/components/backend/ai.d.ts.map +1 -1
- package/dist/convex/components/backend/ai.js +18 -52
- package/dist/convex/components/backend/ai.js.map +1 -1
- package/dist/convex/components/backend/billing.d.ts +22 -1
- package/dist/convex/components/backend/billing.d.ts.map +1 -1
- package/dist/convex/components/backend/billing.js +89 -44
- package/dist/convex/components/backend/billing.js.map +1 -1
- package/dist/convex/components/backend/consents.d.ts.map +1 -1
- package/dist/convex/components/backend/consents.js +2 -1
- package/dist/convex/components/backend/consents.js.map +1 -1
- package/dist/convex/components/backend/costs.d.ts +1 -1
- package/dist/convex/components/backend/crons.d.ts.map +1 -1
- package/dist/convex/components/backend/crons.js +3 -0
- package/dist/convex/components/backend/crons.js.map +1 -1
- package/dist/convex/components/backend/funnel.d.ts +2 -2
- package/dist/convex/components/backend/gifts.d.ts +3 -3
- package/dist/convex/components/backend/gifts.d.ts.map +1 -1
- package/dist/convex/components/backend/gifts.js +11 -6
- package/dist/convex/components/backend/gifts.js.map +1 -1
- package/dist/convex/components/backend/jobs.d.ts +53 -10
- package/dist/convex/components/backend/jobs.d.ts.map +1 -1
- package/dist/convex/components/backend/jobs.js +58 -13
- package/dist/convex/components/backend/jobs.js.map +1 -1
- package/dist/convex/components/backend/lifecycle.d.ts.map +1 -1
- package/dist/convex/components/backend/lifecycle.js +18 -14
- package/dist/convex/components/backend/lifecycle.js.map +1 -1
- package/dist/convex/components/backend/maintenance.d.ts +2 -2
- package/dist/convex/components/backend/maintenance.d.ts.map +1 -1
- package/dist/convex/components/backend/maintenance.js +11 -1
- package/dist/convex/components/backend/maintenance.js.map +1 -1
- package/dist/convex/components/backend/moderation.d.ts +94 -0
- package/dist/convex/components/backend/moderation.d.ts.map +1 -0
- package/dist/convex/components/backend/moderation.js +53 -0
- package/dist/convex/components/backend/moderation.js.map +1 -0
- package/dist/convex/components/backend/notifications.d.ts +13 -0
- package/dist/convex/components/backend/notifications.d.ts.map +1 -1
- package/dist/convex/components/backend/notifications.js +21 -0
- package/dist/convex/components/backend/notifications.js.map +1 -1
- package/dist/convex/components/backend/referrals.d.ts.map +1 -1
- package/dist/convex/components/backend/referrals.js +13 -16
- package/dist/convex/components/backend/referrals.js.map +1 -1
- package/dist/convex/components/backend/reports.js +7 -7
- package/dist/convex/components/backend/reports.js.map +1 -1
- package/dist/convex/components/backend/schema.d.ts +548 -59
- package/dist/convex/components/backend/schema.d.ts.map +1 -1
- package/dist/convex/components/backend/schema.js +233 -155
- package/dist/convex/components/backend/schema.js.map +1 -1
- package/dist/convex/components/backend/storage.d.ts +19 -0
- package/dist/convex/components/backend/storage.d.ts.map +1 -1
- package/dist/convex/components/backend/storage.js +67 -10
- package/dist/convex/components/backend/storage.js.map +1 -1
- package/dist/convex/components/backend/subscriptions.d.ts +4 -4
- package/dist/convex/components/backend/subscriptions.d.ts.map +1 -1
- package/dist/convex/components/backend/subscriptions.js +7 -36
- package/dist/convex/components/backend/subscriptions.js.map +1 -1
- package/dist/convex/components/backend/waitlist.d.ts +1 -1
- package/dist/convex/components/backend/webhooks.d.ts +0 -1
- package/dist/convex/components/backend/webhooks.d.ts.map +1 -1
- package/dist/convex/components/backend/webhooks.js +1 -1
- package/dist/convex/components/backend/webhooks.js.map +1 -1
- package/dist/convex/consent-rules.d.ts +0 -2
- package/dist/convex/consent-rules.d.ts.map +1 -1
- package/dist/convex/consent-rules.js.map +1 -1
- package/dist/convex/constants.d.ts +19 -5
- package/dist/convex/constants.d.ts.map +1 -1
- package/dist/convex/constants.js +19 -5
- package/dist/convex/constants.js.map +1 -1
- package/dist/convex/email-templates.d.ts +56 -7
- package/dist/convex/email-templates.d.ts.map +1 -1
- package/dist/convex/email-templates.js +69 -15
- package/dist/convex/email-templates.js.map +1 -1
- package/dist/convex/emails/notification.d.ts +9 -0
- package/dist/convex/emails/notification.d.ts.map +1 -0
- package/dist/convex/emails/notification.js +21 -0
- package/dist/convex/emails/notification.js.map +1 -0
- package/dist/convex/errors.d.ts +8 -3
- package/dist/convex/errors.d.ts.map +1 -1
- package/dist/convex/errors.js +55 -7
- package/dist/convex/errors.js.map +1 -1
- package/dist/convex/events.d.ts +4 -4
- package/dist/convex/events.js +4 -4
- package/dist/convex/events.js.map +1 -1
- package/dist/convex/files.d.ts +30 -4
- package/dist/convex/files.d.ts.map +1 -1
- package/dist/convex/files.js +44 -6
- package/dist/convex/files.js.map +1 -1
- package/dist/convex/integrations/account.d.ts +7 -0
- package/dist/convex/integrations/account.d.ts.map +1 -1
- package/dist/convex/integrations/account.js +2 -0
- package/dist/convex/integrations/account.js.map +1 -1
- package/dist/convex/integrations/admin.d.ts +2 -1
- package/dist/convex/integrations/admin.d.ts.map +1 -1
- package/dist/convex/integrations/admin.js.map +1 -1
- package/dist/convex/integrations/ai/chat.js +9 -9
- package/dist/convex/integrations/ai/chat.js.map +1 -1
- package/dist/convex/integrations/ai/config.d.ts +157 -37
- package/dist/convex/integrations/ai/config.d.ts.map +1 -1
- package/dist/convex/integrations/ai/context.d.ts +3 -0
- package/dist/convex/integrations/ai/context.d.ts.map +1 -1
- package/dist/convex/integrations/ai/context.js +4 -3
- package/dist/convex/integrations/ai/context.js.map +1 -1
- package/dist/convex/integrations/ai/costs.d.ts.map +1 -1
- package/dist/convex/integrations/ai/costs.js +49 -2
- package/dist/convex/integrations/ai/costs.js.map +1 -1
- package/dist/convex/integrations/ai/embeddings.d.ts +6 -6
- package/dist/convex/integrations/ai/embeddings.d.ts.map +1 -1
- package/dist/convex/integrations/ai/embeddings.js +17 -30
- package/dist/convex/integrations/ai/embeddings.js.map +1 -1
- package/dist/convex/integrations/ai/images.d.ts +25 -0
- package/dist/convex/integrations/ai/images.d.ts.map +1 -0
- package/dist/convex/integrations/ai/images.js +104 -0
- package/dist/convex/integrations/ai/images.js.map +1 -0
- package/dist/convex/integrations/ai/job-errors.d.ts +19 -0
- package/dist/convex/integrations/ai/job-errors.d.ts.map +1 -1
- package/dist/convex/integrations/ai/job-errors.js +40 -2
- package/dist/convex/integrations/ai/job-errors.js.map +1 -1
- package/dist/convex/integrations/ai/jobs.d.ts +176 -10
- package/dist/convex/integrations/ai/jobs.d.ts.map +1 -1
- package/dist/convex/integrations/ai/jobs.js +336 -70
- package/dist/convex/integrations/ai/jobs.js.map +1 -1
- package/dist/convex/integrations/ai/knowledge.d.ts.map +1 -1
- package/dist/convex/integrations/ai/knowledge.js +10 -11
- package/dist/convex/integrations/ai/knowledge.js.map +1 -1
- package/dist/convex/integrations/ai/metering.d.ts +26 -4
- package/dist/convex/integrations/ai/metering.d.ts.map +1 -1
- package/dist/convex/integrations/ai/metering.js +91 -35
- package/dist/convex/integrations/ai/metering.js.map +1 -1
- package/dist/convex/integrations/ai/model-id.d.ts +14 -1
- package/dist/convex/integrations/ai/model-id.d.ts.map +1 -1
- package/dist/convex/integrations/ai/model-id.js +24 -2
- package/dist/convex/integrations/ai/model-id.js.map +1 -1
- package/dist/convex/integrations/ai/models.d.ts +103 -20
- package/dist/convex/integrations/ai/models.d.ts.map +1 -1
- package/dist/convex/integrations/ai/models.js +223 -46
- package/dist/convex/integrations/ai/models.js.map +1 -1
- package/dist/convex/integrations/ai/moderation-providers.d.ts +136 -0
- package/dist/convex/integrations/ai/moderation-providers.d.ts.map +1 -0
- package/dist/convex/integrations/ai/moderation-providers.js +277 -0
- package/dist/convex/integrations/ai/moderation-providers.js.map +1 -0
- package/dist/convex/integrations/ai/moderation-taxonomy.d.ts +54 -0
- package/dist/convex/integrations/ai/moderation-taxonomy.d.ts.map +1 -0
- package/dist/convex/integrations/ai/moderation-taxonomy.js +141 -0
- package/dist/convex/integrations/ai/moderation-taxonomy.js.map +1 -0
- package/dist/convex/integrations/ai/moderation.d.ts +220 -19
- package/dist/convex/integrations/ai/moderation.d.ts.map +1 -1
- package/dist/convex/integrations/ai/moderation.js +388 -39
- package/dist/convex/integrations/ai/moderation.js.map +1 -1
- package/dist/convex/integrations/ai/provenance.d.ts +6 -0
- package/dist/convex/integrations/ai/provenance.d.ts.map +1 -1
- package/dist/convex/integrations/ai/provenance.js +4 -1
- package/dist/convex/integrations/ai/provenance.js.map +1 -1
- package/dist/convex/integrations/ai/setup.js +5 -5
- package/dist/convex/integrations/ai/setup.js.map +1 -1
- package/dist/convex/integrations/ai/stream.d.ts +1 -1
- package/dist/convex/integrations/ai/stream.d.ts.map +1 -1
- package/dist/convex/integrations/ai/stream.js +6 -12
- package/dist/convex/integrations/ai/stream.js.map +1 -1
- package/dist/convex/integrations/ai.d.ts +15 -8
- package/dist/convex/integrations/ai.d.ts.map +1 -1
- package/dist/convex/integrations/ai.js +4 -1
- package/dist/convex/integrations/ai.js.map +1 -1
- package/dist/convex/integrations/billing/checkout.d.ts +1 -1
- package/dist/convex/integrations/billing/checkout.d.ts.map +1 -1
- package/dist/convex/integrations/billing/checkout.js +4 -4
- package/dist/convex/integrations/billing/checkout.js.map +1 -1
- package/dist/convex/integrations/billing/context.d.ts +8 -1
- package/dist/convex/integrations/billing/context.d.ts.map +1 -1
- package/dist/convex/integrations/billing/context.js +21 -5
- package/dist/convex/integrations/billing/context.js.map +1 -1
- package/dist/convex/integrations/billing/credits.d.ts +6 -0
- package/dist/convex/integrations/billing/credits.d.ts.map +1 -1
- package/dist/convex/integrations/billing/credits.js +21 -6
- package/dist/convex/integrations/billing/credits.js.map +1 -1
- package/dist/convex/integrations/billing/customers.d.ts.map +1 -1
- package/dist/convex/integrations/billing/customers.js +25 -5
- package/dist/convex/integrations/billing/customers.js.map +1 -1
- package/dist/convex/integrations/billing/features.d.ts.map +1 -1
- package/dist/convex/integrations/billing/free-plan.d.ts +42 -2
- package/dist/convex/integrations/billing/free-plan.d.ts.map +1 -1
- package/dist/convex/integrations/billing/free-plan.js +110 -33
- package/dist/convex/integrations/billing/free-plan.js.map +1 -1
- package/dist/convex/integrations/billing/functions.d.ts +11 -3
- package/dist/convex/integrations/billing/functions.d.ts.map +1 -1
- package/dist/convex/integrations/billing/functions.js +33 -12
- package/dist/convex/integrations/billing/functions.js.map +1 -1
- package/dist/convex/integrations/billing/gifts.d.ts +4 -0
- package/dist/convex/integrations/billing/gifts.d.ts.map +1 -1
- package/dist/convex/integrations/billing/gifts.js +39 -8
- package/dist/convex/integrations/billing/gifts.js.map +1 -1
- package/dist/convex/integrations/billing/history.d.ts.map +1 -1
- package/dist/convex/integrations/billing/history.js +3 -1
- package/dist/convex/integrations/billing/history.js.map +1 -1
- package/dist/convex/integrations/billing/lifecycle.d.ts +13 -4
- package/dist/convex/integrations/billing/lifecycle.d.ts.map +1 -1
- package/dist/convex/integrations/billing/lifecycle.js +47 -7
- package/dist/convex/integrations/billing/lifecycle.js.map +1 -1
- package/dist/convex/integrations/billing/passes.d.ts +0 -2
- package/dist/convex/integrations/billing/passes.d.ts.map +1 -1
- package/dist/convex/integrations/billing/passes.js +4 -5
- package/dist/convex/integrations/billing/passes.js.map +1 -1
- package/dist/convex/integrations/billing/pricing.d.ts +12 -2
- package/dist/convex/integrations/billing/pricing.d.ts.map +1 -1
- package/dist/convex/integrations/billing/pricing.js +48 -12
- package/dist/convex/integrations/billing/pricing.js.map +1 -1
- package/dist/convex/integrations/billing/purchase.d.ts.map +1 -1
- package/dist/convex/integrations/billing/purchase.js +1 -2
- package/dist/convex/integrations/billing/purchase.js.map +1 -1
- package/dist/convex/integrations/billing/quotas.d.ts.map +1 -1
- package/dist/convex/integrations/billing/rate-limit.d.ts +16 -0
- package/dist/convex/integrations/billing/rate-limit.d.ts.map +1 -0
- package/dist/convex/integrations/billing/rate-limit.js +45 -0
- package/dist/convex/integrations/billing/rate-limit.js.map +1 -0
- package/dist/convex/integrations/billing/referral-orders.d.ts +1 -1
- package/dist/convex/integrations/billing/referral-orders.js +1 -1
- package/dist/convex/integrations/billing/resync.d.ts +28 -0
- package/dist/convex/integrations/billing/resync.d.ts.map +1 -0
- package/dist/convex/integrations/billing/resync.js +139 -0
- package/dist/convex/integrations/billing/resync.js.map +1 -0
- package/dist/convex/integrations/billing/subscriptions.d.ts +1 -1
- package/dist/convex/integrations/billing/subscriptions.d.ts.map +1 -1
- package/dist/convex/integrations/billing/subscriptions.js +6 -2
- package/dist/convex/integrations/billing/subscriptions.js.map +1 -1
- package/dist/convex/integrations/billing/types/lifecycle.d.ts +13 -1
- package/dist/convex/integrations/billing/types/lifecycle.d.ts.map +1 -1
- package/dist/convex/integrations/billing/types/options.d.ts +4 -1
- package/dist/convex/integrations/billing/types/options.d.ts.map +1 -1
- package/dist/convex/integrations/billing/types/records.d.ts +75 -4
- package/dist/convex/integrations/billing/types/records.d.ts.map +1 -1
- package/dist/convex/integrations/billing/types/setup.d.ts +9 -4
- package/dist/convex/integrations/billing/types/setup.d.ts.map +1 -1
- package/dist/convex/integrations/billing/types/surface.d.ts +42 -5
- package/dist/convex/integrations/billing/types/surface.d.ts.map +1 -1
- package/dist/convex/integrations/billing/webhooks.js +2 -2
- package/dist/convex/integrations/billing/welcome.d.ts +16 -0
- package/dist/convex/integrations/billing/welcome.d.ts.map +1 -0
- package/dist/convex/integrations/billing/welcome.js +93 -0
- package/dist/convex/integrations/billing/welcome.js.map +1 -0
- package/dist/convex/integrations/billing.d.ts +5 -4
- package/dist/convex/integrations/billing.d.ts.map +1 -1
- package/dist/convex/integrations/billing.js +18 -5
- package/dist/convex/integrations/billing.js.map +1 -1
- package/dist/convex/integrations/email-preferences.d.ts +1 -1
- package/dist/convex/integrations/email-preferences.d.ts.map +1 -1
- package/dist/convex/integrations/email-sync.d.ts.map +1 -1
- package/dist/convex/integrations/email-sync.js +43 -1
- package/dist/convex/integrations/email-sync.js.map +1 -1
- package/dist/convex/integrations/email.d.ts +17 -3
- package/dist/convex/integrations/email.d.ts.map +1 -1
- package/dist/convex/integrations/email.js.map +1 -1
- package/dist/convex/integrations/functions.d.ts +2 -2
- package/dist/convex/integrations/functions.d.ts.map +1 -1
- package/dist/convex/integrations/functions.js +1 -1
- package/dist/convex/integrations/functions.js.map +1 -1
- package/dist/convex/integrations/launch.d.ts +108 -3
- package/dist/convex/integrations/launch.d.ts.map +1 -1
- package/dist/convex/integrations/launch.js +143 -22
- package/dist/convex/integrations/launch.js.map +1 -1
- package/dist/convex/integrations/notifications.d.ts +30 -6
- package/dist/convex/integrations/notifications.d.ts.map +1 -1
- package/dist/convex/integrations/notifications.js +42 -28
- package/dist/convex/integrations/notifications.js.map +1 -1
- package/dist/convex/integrations/rate-limit.d.ts +24 -5
- package/dist/convex/integrations/rate-limit.d.ts.map +1 -1
- package/dist/convex/integrations/rate-limit.js +24 -8
- package/dist/convex/integrations/rate-limit.js.map +1 -1
- package/dist/convex/integrations/reports.d.ts +5 -2
- package/dist/convex/integrations/reports.d.ts.map +1 -1
- package/dist/convex/integrations/reports.js +14 -14
- package/dist/convex/integrations/reports.js.map +1 -1
- package/dist/convex/integrations/retention.d.ts +42 -4
- package/dist/convex/integrations/retention.d.ts.map +1 -1
- package/dist/convex/integrations/retention.js +62 -4
- package/dist/convex/integrations/retention.js.map +1 -1
- package/dist/convex/integrations/storage.d.ts +71 -3
- package/dist/convex/integrations/storage.d.ts.map +1 -1
- package/dist/convex/integrations/storage.js +22 -4
- package/dist/convex/integrations/storage.js.map +1 -1
- package/dist/convex/integrations/webhooks.d.ts +1 -3
- package/dist/convex/integrations/webhooks.d.ts.map +1 -1
- package/dist/convex/integrations/webhooks.js.map +1 -1
- package/dist/convex/label-format.d.ts +2 -2
- package/dist/convex/label-format.d.ts.map +1 -1
- package/dist/convex/label-format.js +2 -2
- package/dist/convex/label-format.js.map +1 -1
- package/dist/convex/label-groups/admin.d.ts +27 -0
- package/dist/convex/label-groups/admin.d.ts.map +1 -1
- package/dist/convex/label-groups/admin.js +28 -0
- package/dist/convex/label-groups/admin.js.map +1 -1
- package/dist/convex/label-groups/cancelFlow.d.ts +4 -1
- package/dist/convex/label-groups/cancelFlow.d.ts.map +1 -1
- package/dist/convex/label-groups/cancelFlow.js +7 -2
- package/dist/convex/label-groups/cancelFlow.js.map +1 -1
- package/dist/convex/label-groups/credits.d.ts +14 -1
- package/dist/convex/label-groups/credits.d.ts.map +1 -1
- package/dist/convex/label-groups/credits.js +17 -2
- package/dist/convex/label-groups/credits.js.map +1 -1
- package/dist/convex/label-groups/email.d.ts.map +1 -1
- package/dist/convex/label-groups/email.js +2 -1
- package/dist/convex/label-groups/email.js.map +1 -1
- package/dist/convex/label-groups/errors.d.ts +4 -0
- package/dist/convex/label-groups/errors.d.ts.map +1 -1
- package/dist/convex/label-groups/errors.js +6 -1
- package/dist/convex/label-groups/errors.js.map +1 -1
- package/dist/convex/label-groups/gift.d.ts +2 -0
- package/dist/convex/label-groups/gift.d.ts.map +1 -1
- package/dist/convex/label-groups/gift.js +5 -2
- package/dist/convex/label-groups/gift.js.map +1 -1
- package/dist/convex/label-groups/legal.d.ts +27 -1
- package/dist/convex/label-groups/legal.d.ts.map +1 -1
- package/dist/convex/label-groups/legal.js +31 -0
- package/dist/convex/label-groups/legal.js.map +1 -1
- package/dist/convex/label-groups/notifications.d.ts +21 -2
- package/dist/convex/label-groups/notifications.d.ts.map +1 -1
- package/dist/convex/label-groups/notifications.js +21 -15
- package/dist/convex/label-groups/notifications.js.map +1 -1
- package/dist/convex/label-groups/pastDue.d.ts +1 -1
- package/dist/convex/label-groups/pastDue.d.ts.map +1 -1
- package/dist/convex/label-groups/pastDue.js +1 -1
- package/dist/convex/label-groups/pastDue.js.map +1 -1
- package/dist/convex/label-groups/pricing.d.ts +2 -0
- package/dist/convex/label-groups/pricing.d.ts.map +1 -1
- package/dist/convex/label-groups/pricing.js +12 -8
- package/dist/convex/label-groups/pricing.js.map +1 -1
- package/dist/convex/label-groups/referral.d.ts +2 -2
- package/dist/convex/label-groups/referral.js +2 -2
- package/dist/convex/label-groups/report.d.ts +8 -1
- package/dist/convex/label-groups/report.d.ts.map +1 -1
- package/dist/convex/label-groups/report.js +10 -1
- package/dist/convex/label-groups/report.js.map +1 -1
- package/dist/convex/label-groups/settings.d.ts.map +1 -1
- package/dist/convex/label-groups/settings.js +4 -3
- package/dist/convex/label-groups/settings.js.map +1 -1
- package/dist/convex/label-groups/upload.d.ts +1 -0
- package/dist/convex/label-groups/upload.d.ts.map +1 -1
- package/dist/convex/label-groups/upload.js +2 -0
- package/dist/convex/label-groups/upload.js.map +1 -1
- package/dist/convex/label-groups/usage.d.ts +1 -1
- package/dist/convex/label-groups/usage.d.ts.map +1 -1
- package/dist/convex/label-groups/usage.js +2 -2
- package/dist/convex/label-groups/usage.js.map +1 -1
- package/dist/convex/label-groups/withdrawal.d.ts +1 -1
- package/dist/convex/label-groups/withdrawal.js +1 -1
- package/dist/convex/label-translations.d.ts.map +1 -1
- package/dist/convex/label-translations.js +141 -29
- package/dist/convex/label-translations.js.map +1 -1
- package/dist/convex/labels.d.ts +123 -1
- package/dist/convex/labels.d.ts.map +1 -1
- package/dist/convex/legal.d.ts +12 -2
- package/dist/convex/legal.d.ts.map +1 -1
- package/dist/convex/legal.js +2 -2
- package/dist/convex/legal.js.map +1 -1
- package/dist/convex/log.js +14 -1
- package/dist/convex/log.js.map +1 -1
- package/dist/convex/monitoring.d.ts +6 -4
- package/dist/convex/monitoring.d.ts.map +1 -1
- package/dist/convex/monitoring.js +6 -4
- package/dist/convex/monitoring.js.map +1 -1
- package/dist/convex/notifications.d.ts +77 -0
- package/dist/convex/notifications.d.ts.map +1 -1
- package/dist/convex/notifications.js +64 -13
- package/dist/convex/notifications.js.map +1 -1
- package/dist/convex/proof.d.ts +25 -0
- package/dist/convex/proof.d.ts.map +1 -1
- package/dist/convex/proof.js +39 -0
- package/dist/convex/proof.js.map +1 -1
- package/dist/convex/referral-rules.d.ts +0 -2
- package/dist/convex/referral-rules.d.ts.map +1 -1
- package/dist/convex/referral-rules.js +0 -2
- package/dist/convex/referral-rules.js.map +1 -1
- package/dist/convex/report-rules.d.ts +2 -0
- package/dist/convex/report-rules.d.ts.map +1 -1
- package/dist/convex/report-rules.js +2 -0
- package/dist/convex/report-rules.js.map +1 -1
- package/dist/convex/sensitive-actions.d.ts.map +1 -1
- package/dist/convex/sensitive-actions.js +1 -0
- package/dist/convex/sensitive-actions.js.map +1 -1
- package/dist/convex/test-models.d.ts +7 -0
- package/dist/convex/test-models.d.ts.map +1 -1
- package/dist/convex/test-models.js +25 -2
- package/dist/convex/test-models.js.map +1 -1
- package/dist/convex/test-moderation.d.ts +24 -0
- package/dist/convex/test-moderation.d.ts.map +1 -0
- package/dist/convex/test-moderation.js +114 -0
- package/dist/convex/test-moderation.js.map +1 -0
- package/dist/convex/waitlist-rules.d.ts +1 -13
- package/dist/convex/waitlist-rules.d.ts.map +1 -1
- package/dist/convex/waitlist-rules.js +2 -14
- package/dist/convex/waitlist-rules.js.map +1 -1
- package/dist/devtools-client/_nuxt/CiCAOwUc.js +5 -0
- package/dist/devtools-client/index.html +1 -1
- package/dist/env-registry.js +37 -5
- package/dist/module.d.ts +51 -1
- package/dist/module.js +2 -2
- package/dist/module.json +1 -1
- package/dist/runtime/config.d.ts +95 -14
- package/dist/runtime/config.js +13 -1
- package/dist/runtime/locales/de.json +138 -39
- package/dist/runtime/locales/en.json +138 -39
- package/dist/runtime/locales/es.json +138 -39
- package/dist/runtime/locales/fr.json +138 -39
- package/dist/runtime/locales/ru.json +138 -39
- package/dist/runtime/monitoring/sdk/sentry.client.config.js +2 -1
- package/dist/runtime/monitoring/sdk/sentry.server.config.js +6 -1
- package/dist/runtime/server/content-wasm.d.ts +13 -0
- package/dist/runtime/server/content-wasm.js +9 -0
- package/dist/runtime/server/csp.d.ts +17 -0
- package/dist/runtime/server/csp.js +18 -0
- package/dist/runtime/server/monitoring/csp.d.ts +12 -0
- package/dist/runtime/server/monitoring/csp.js +19 -0
- package/dist/runtime/server/protection/csp.d.ts +1 -7
- package/dist/runtime/server/protection/csp.js +4 -17
- package/dist/runtime/server/protection/gate.d.ts +4 -2
- package/dist/runtime/server/protection/gate.js +14 -4
- package/dist/runtime/test-utils/aliases.d.ts +6 -4
- package/dist/runtime/test-utils/aliases.js +3 -9
- package/dist/runtime/test-utils/base-modules.d.ts +9 -13
- package/dist/runtime/test-utils/install.js +4 -2
- package/dist/runtime/vue/a11y.js +1 -1
- package/dist/runtime/vue/admin-client.d.ts +18 -0
- package/dist/runtime/vue/admin-client.js +32 -0
- package/dist/runtime/vue/auth-client.d.ts +22 -14
- package/dist/runtime/vue/auth-client.js +3 -1
- package/dist/runtime/vue/components/account/AccountData.vue +2 -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/ActivationChecklist.vue +1 -0
- package/dist/runtime/vue/components/account/ConsentPrompt.css +1 -1
- package/dist/runtime/vue/components/account/ConsentPromptDialog.vue +1 -0
- package/dist/runtime/vue/components/account/ConsentPromptStorage.vue +1 -0
- package/dist/runtime/vue/components/account/EmailUnsubscribe.css +1 -1
- package/dist/runtime/vue/components/account/EmailUnsubscribe.vue +2 -2
- package/dist/runtime/vue/components/account/HowDidYouHear.css +1 -1
- package/dist/runtime/vue/components/account/HowDidYouHear.vue +1 -0
- 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/OnboardingFlow.vue +1 -0
- 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/ProfilePreferencesSection.vue +3 -1
- package/dist/runtime/vue/components/account/ProfileSettings.css +1 -1
- package/dist/runtime/vue/components/account/ProfileSettings.vue +1 -0
- package/dist/runtime/vue/components/account/SecurityAlerts.css +1 -1
- package/dist/runtime/vue/components/account/SecurityAlerts.vue +2 -1
- package/dist/runtime/vue/components/account/SecurityPasskeys.css +1 -1
- package/dist/runtime/vue/components/account/SecuritySettings.css +1 -1
- package/dist/runtime/vue/components/account/SecuritySettings.vue +1 -0
- package/dist/runtime/vue/components/account/security-alerts.d.ts +7 -0
- package/dist/runtime/vue/components/account/security-alerts.js +6 -2
- package/dist/runtime/vue/components/admin/AdminAccess.css +1 -1
- package/dist/runtime/vue/components/admin/AdminAccess.vue +2 -0
- package/dist/runtime/vue/components/admin/AdminAccessMemberTickets.d.vue.ts +7 -0
- package/dist/runtime/vue/components/admin/AdminAccessMemberTickets.vue +42 -0
- package/dist/runtime/vue/components/admin/AdminAccessMemberTickets.vue.d.ts +7 -0
- 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/AdminModeration.d.vue.ts +3 -0
- package/dist/runtime/vue/components/admin/AdminModeration.vue +135 -0
- package/dist/runtime/vue/components/admin/AdminModeration.vue.d.ts +3 -0
- package/dist/runtime/vue/components/admin/AdminQueue.css +1 -1
- 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 +28 -1
- package/dist/runtime/vue/components/admin/AdminUsers.vue +1 -0
- package/dist/runtime/vue/components/admin/AdminUsers.vue.d.ts +28 -1
- package/dist/runtime/vue/components/admin/AdminWorkspaces.d.vue.ts +27 -0
- package/dist/runtime/vue/components/admin/AdminWorkspaces.vue +1 -0
- package/dist/runtime/vue/components/admin/AdminWorkspaces.vue.d.ts +27 -0
- package/dist/runtime/vue/components/admin/admin-moderation-tab.d.ts +1 -0
- package/dist/runtime/vue/components/admin/admin-moderation-tab.js +34 -0
- package/dist/runtime/vue/components/admin/admin-tabs.js +2 -0
- 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.vue +3 -2
- package/dist/runtime/vue/components/auth/AuthFormChoose.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/ReauthenticateCode.css +1 -1
- package/dist/runtime/vue/components/auth/ReauthenticateDialog.css +1 -1
- package/dist/runtime/vue/components/auth/ReauthenticateDialog.vue +3 -2
- package/dist/runtime/vue/components/auth/WaitlistForm.css +1 -1
- package/dist/runtime/vue/components/auth/WaitlistForm.vue +1 -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/billing/BillingCheckoutLink.d.vue.ts +1 -1
- package/dist/runtime/vue/components/billing/BillingCheckoutLink.vue +2 -0
- package/dist/runtime/vue/components/billing/BillingCheckoutLink.vue.d.ts +1 -1
- package/dist/runtime/vue/components/billing/BillingHistory.css +1 -1
- package/dist/runtime/vue/components/billing/BillingHistory.vue +1 -0
- package/dist/runtime/vue/components/billing/BillingPortalLink.vue +1 -0
- package/dist/runtime/vue/components/billing/CancelFlow.css +1 -1
- package/dist/runtime/vue/components/billing/CancelFlow.d.vue.ts +3 -0
- package/dist/runtime/vue/components/billing/CancelFlow.vue +11 -3
- package/dist/runtime/vue/components/billing/CancelFlow.vue.d.ts +3 -0
- package/dist/runtime/vue/components/billing/CancelFlowConfirm.d.vue.ts +3 -0
- package/dist/runtime/vue/components/billing/CancelFlowConfirm.vue +34 -0
- package/dist/runtime/vue/components/billing/CancelFlowConfirm.vue.d.ts +3 -0
- package/dist/runtime/vue/components/billing/CancelFlowEnd.vue +3 -1
- package/dist/runtime/vue/components/billing/CancelFlowQuestion.vue +2 -1
- package/dist/runtime/vue/components/billing/GiftList.css +1 -1
- package/dist/runtime/vue/components/billing/GiftSent.d.vue.ts +2 -2
- package/dist/runtime/vue/components/billing/GiftSent.vue.d.ts +2 -2
- package/dist/runtime/vue/components/billing/PricingPackCard.css +1 -1
- package/dist/runtime/vue/components/billing/PricingPackCard.vue +6 -3
- package/dist/runtime/vue/components/billing/PricingPlanCard.css +1 -1
- package/dist/runtime/vue/components/billing/PricingPlanCard.vue +11 -2
- package/dist/runtime/vue/components/billing/PricingTable.css +1 -1
- package/dist/runtime/vue/components/billing/PricingTable.d.vue.ts +4 -2
- package/dist/runtime/vue/components/billing/PricingTable.vue +25 -4
- package/dist/runtime/vue/components/billing/PricingTable.vue.d.ts +4 -2
- package/dist/runtime/vue/components/billing/ReferralCard.css +1 -1
- package/dist/runtime/vue/components/billing/ReferralCard.vue +1 -0
- package/dist/runtime/vue/components/billing/ReferralLanding.css +1 -1
- package/dist/runtime/vue/components/billing/UpgradePrompt.css +1 -1
- package/dist/runtime/vue/components/billing/UpgradePrompt.vue +1 -0
- package/dist/runtime/vue/components/billing/UsageHistory.css +1 -1
- package/dist/runtime/vue/components/billing/UsageHistory.vue +1 -0
- package/dist/runtime/vue/components/billing/UsageHistoryEvent.vue +3 -1
- package/dist/runtime/vue/components/billing/WithdrawalButton.css +1 -1
- package/dist/runtime/vue/components/billing/WithdrawalButton.vue +1 -0
- package/dist/runtime/vue/components/billing/cancel-flow.d.ts +28 -7
- package/dist/runtime/vue/components/billing/cancel-flow.js +25 -2
- package/dist/runtime/vue/components/billing/pricing-table.d.ts +6 -0
- package/dist/runtime/vue/components/billing/withdrawal-button.d.ts +1 -1
- 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/AccessDenied.vue +1 -0
- package/dist/runtime/vue/components/shell/AccountMenu.vue +1 -0
- package/dist/runtime/vue/components/shell/AiLabel.css +1 -1
- package/dist/runtime/vue/components/shell/AiLabel.vue +4 -1
- package/dist/runtime/vue/components/shell/AppShell.css +1 -1
- package/dist/runtime/vue/components/shell/AppShell.vue +3 -0
- package/dist/runtime/vue/components/shell/BackendNotices.vue +1 -0
- 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/ConnectionStatus.vue +1 -0
- package/dist/runtime/vue/components/shell/ContactForm.css +1 -1
- package/dist/runtime/vue/components/shell/ContactForm.vue +1 -0
- package/dist/runtime/vue/components/shell/FrameMain.vue +2 -0
- package/dist/runtime/vue/components/shell/Gate.css +1 -1
- package/dist/runtime/vue/components/shell/Gate.vue +2 -0
- package/dist/runtime/vue/components/shell/GateQuota.vue +1 -0
- package/dist/runtime/vue/components/shell/LegalCompany.d.vue.ts +3 -0
- package/dist/runtime/vue/components/shell/LegalCompany.vue +23 -0
- package/dist/runtime/vue/components/shell/LegalCompany.vue.d.ts +3 -0
- package/dist/runtime/vue/components/shell/LegalContactPoints.d.vue.ts +10 -0
- package/dist/runtime/vue/components/shell/LegalContactPoints.vue +51 -0
- package/dist/runtime/vue/components/shell/LegalContactPoints.vue.d.ts +10 -0
- package/dist/runtime/vue/components/shell/LegalDetail.d.vue.ts +11 -0
- package/dist/runtime/vue/components/shell/LegalDetail.vue +30 -0
- package/dist/runtime/vue/components/shell/LegalDetail.vue.d.ts +11 -0
- package/dist/runtime/vue/components/shell/LegalDocument.css +1 -1
- package/dist/runtime/vue/components/shell/LegalDocument.vue +49 -13
- package/dist/runtime/vue/components/shell/LegalModeration.d.vue.ts +8 -0
- package/dist/runtime/vue/components/shell/LegalModeration.vue +72 -0
- package/dist/runtime/vue/components/shell/LegalModeration.vue.d.ts +8 -0
- package/dist/runtime/vue/components/shell/LegalProcessors.d.vue.ts +3 -2
- package/dist/runtime/vue/components/shell/LegalProcessors.vue +46 -15
- package/dist/runtime/vue/components/shell/LegalProcessors.vue.d.ts +3 -2
- package/dist/runtime/vue/components/shell/LegalStorage.d.vue.ts +3 -2
- package/dist/runtime/vue/components/shell/LegalStorage.vue +49 -16
- package/dist/runtime/vue/components/shell/LegalStorage.vue.d.ts +3 -2
- package/dist/runtime/vue/components/shell/LegalVersion.d.vue.ts +10 -0
- package/dist/runtime/vue/components/shell/LegalVersion.vue +24 -0
- package/dist/runtime/vue/components/shell/LegalVersion.vue.d.ts +10 -0
- 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/NoticeGift.vue +7 -4
- 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/NoticeLowCredits.vue +3 -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/NotificationInbox.vue +1 -0
- 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/UploadField.d.vue.ts +2 -0
- package/dist/runtime/vue/components/shell/UploadField.vue +16 -3
- package/dist/runtime/vue/components/shell/UploadField.vue.d.ts +2 -0
- package/dist/runtime/vue/components/shell/WorkspaceSwitcher.css +1 -1
- package/dist/runtime/vue/components/shell/WorkspaceSwitcher.vue +1 -0
- package/dist/runtime/vue/components/shell/legal.d.ts +35 -4
- package/dist/runtime/vue/components/shell/legal.js +126 -13
- package/dist/runtime/vue/components/shell/upload-field.d.ts +3 -1
- package/dist/runtime/vue/components/tokens.css +1 -1
- package/dist/runtime/vue/components/workspaces/AcceptInvitation.vue +1 -0
- package/dist/runtime/vue/components/workspaces/AuditLog.css +1 -1
- package/dist/runtime/vue/components/workspaces/AuditLog.vue +1 -0
- package/dist/runtime/vue/components/workspaces/WorkspaceBilling.css +1 -1
- package/dist/runtime/vue/components/workspaces/WorkspaceCredits.css +1 -1
- package/dist/runtime/vue/components/workspaces/WorkspaceCredits.vue +6 -3
- package/dist/runtime/vue/components/workspaces/WorkspaceList.css +1 -1
- package/dist/runtime/vue/components/workspaces/WorkspaceSettings.d.vue.ts +2 -2
- package/dist/runtime/vue/components/workspaces/WorkspaceSettings.vue +1 -0
- package/dist/runtime/vue/components/workspaces/WorkspaceSettings.vue.d.ts +2 -2
- package/dist/runtime/vue/composables/use-access.d.ts +51 -6
- package/dist/runtime/vue/composables/use-access.js +36 -0
- package/dist/runtime/vue/composables/use-auth.d.ts +13 -1
- package/dist/runtime/vue/composables/use-auth.js +4 -1
- package/dist/runtime/vue/composables/use-billing.d.ts +16 -7
- package/dist/runtime/vue/composables/use-credits.d.ts +3 -0
- package/dist/runtime/vue/composables/use-credits.js +1 -0
- package/dist/runtime/vue/composables/use-email-link.d.ts +55 -4
- package/dist/runtime/vue/composables/use-email-link.js +9 -9
- package/dist/runtime/vue/composables/use-gift-list.js +3 -1
- package/dist/runtime/vue/composables/use-labels.js +13 -8
- package/dist/runtime/vue/composables/use-login-flow.js +1 -1
- package/dist/runtime/vue/composables/use-notifications.d.ts +5 -1
- package/dist/runtime/vue/composables/use-notifications.js +15 -4
- package/dist/runtime/vue/composables/use-passkeys.js +2 -2
- package/dist/runtime/vue/composables/use-pricing.d.ts +15 -0
- package/dist/runtime/vue/composables/use-pricing.js +4 -0
- package/dist/runtime/vue/composables/use-referral-invite.d.ts +33 -4
- package/dist/runtime/vue/composables/use-referral-invite.js +20 -9
- package/dist/runtime/vue/composables/use-report-form.d.ts +178 -0
- package/dist/runtime/vue/composables/use-report-form.js +278 -0
- package/dist/runtime/vue/composables/use-sign-in-alerts.d.ts +85 -0
- package/dist/runtime/vue/composables/use-sign-in-alerts.js +70 -0
- package/dist/runtime/vue/composables/use-upload-field.d.ts +32 -6
- package/dist/runtime/vue/composables/use-upload-field.js +75 -36
- package/dist/runtime/vue/composables/use-waitlist.d.ts +8 -1
- package/dist/runtime/vue/composables/use-waitlist.js +14 -1
- package/dist/runtime/vue/composables/use-webhook-log.d.ts +4 -2
- package/dist/runtime/vue/organization-client.d.ts +15 -0
- package/dist/runtime/vue/organization-client.js +65 -0
- package/dist/runtime/vue/pages/gifts.vue +9 -0
- package/dist/runtime/vue/parts.d.ts +2 -1
- package/dist/runtime/vue/passkey-ceremony.d.ts +42 -0
- package/dist/runtime/vue/passkey-ceremony.js +37 -0
- package/dist/runtime/vue/passkey-client.d.ts +11 -49
- package/dist/runtime/vue/passkey-client.js +2 -34
- package/dist/runtime/vue/plugins/checkout-return.d.ts +5 -3
- package/dist/runtime/vue/plugins/checkout-return.js +3 -5
- package/dist/runtime/vue/plugins/first-touch.js +2 -4
- package/dist/runtime/vue/plugins/passkey-ceremony.d.ts +3 -1
- package/dist/runtime/vue/plugins/passkey-ceremony.js +1 -1
- package/dist/runtime/vue/protection/state.d.ts +6 -0
- package/dist/runtime/vue/utils/auth-session.js +1 -1
- package/dist/runtime/vue/utils/billing-access.d.ts +1 -1
- package/dist/runtime/vue/utils/checkout-return.d.ts +14 -6
- package/dist/runtime/vue/utils/checkout-return.js +5 -4
- package/dist/runtime/vue/utils/every-page.d.ts +10 -0
- package/dist/runtime/vue/utils/every-page.js +6 -0
- package/dist/runtime/vue/utils/login-bindings.js +1 -1
- package/dist/runtime/vue/utils/meter-unit.d.ts +14 -0
- package/dist/runtime/vue/utils/meter-unit.js +18 -0
- package/dist/runtime/vue/utils/page-guard.js +6 -5
- package/dist/runtime/vue/utils/passkey-prompt.d.ts +12 -0
- package/dist/runtime/vue/utils/passkey-prompt.js +8 -0
- package/dist/runtime/vue/utils/renamed-component.js +1 -1
- package/dist/shared/{nuxt-backend.OQMX-0U7.mjs → nuxt-backend.Bq_mhlky.mjs} +582 -61
- package/dist/shared/{nuxt-backend.CPq101Wi.mjs → nuxt-backend.D9qXcOOI.mjs} +1 -1
- package/dist/shared/{nuxt-backend.S5C2b-4I.mjs → nuxt-backend.DmZI-QSO.mjs} +2 -2
- package/dist/shared/{nuxt-backend.-uB5CGw-.mjs → nuxt-backend.G4JryO1q.mjs} +144 -32
- package/dist/shared/{nuxt-backend.2YoiKo8j.mjs → nuxt-backend.Lk2MQI2u.mjs} +6 -2
- package/dist/types.d.ts +1 -1
- package/package.json +14 -14
- package/skills/nuxt-backend/SKILL.md +3 -3
- package/skills/nuxt-backend/references/api.md +107 -27
- package/skills/nuxt-backend/references/renames.json +114 -2054
- package/skills/nuxt-backend/references/surface.json +124 -3
- package/skills/nuxt-backend-ai/SKILL.md +13 -6
- package/skills/nuxt-backend-ai/references/api.md +21 -3
- package/skills/nuxt-backend-auth/SKILL.md +2 -1
- package/skills/nuxt-backend-auth/references/api.md +20 -3
- package/skills/nuxt-backend-billing/SKILL.md +7 -0
- package/skills/nuxt-backend-billing/references/api.md +31 -6
- package/skills/nuxt-backend-data/SKILL.md +7 -4
- package/skills/nuxt-backend-data/references/api.md +4 -3
- package/skills/nuxt-backend-email/SKILL.md +4 -0
- package/skills/nuxt-backend-email/references/api.md +3 -2
- package/skills/nuxt-backend-growth/references/api.md +1 -0
- package/skills/nuxt-backend-ship/SKILL.md +14 -22
- package/skills/nuxt-backend-ship/references/api.md +25 -2
- package/skills/nuxt-backend-ship/references/operate.md +28 -0
- package/skills/nuxt-backend-ui/SKILL.md +10 -5
- package/skills/nuxt-backend-upgrade/SKILL.md +16 -11
- package/skills/nuxt-backend-upgrade/references/api.md +2 -2
- package/skills/nuxt-backend-upgrade/references/upgrade.md +37 -438
- package/src/convex/access-tickets.ts +30 -1
- package/src/convex/account-data.ts +26 -8
- package/src/convex/app.ts +16 -2
- package/src/convex/billing-launch.ts +42 -0
- package/src/convex/catalog.ts +39 -2
- package/src/convex/client/better-auth-options.ts +11 -1
- package/src/convex/client/client-address.ts +37 -0
- package/src/convex/client/code-binding.ts +1 -1
- package/src/convex/client/guards.ts +3 -3
- package/src/convex/client/index.ts +4 -3
- package/src/convex/client/plugins.ts +43 -19
- package/src/convex/components/backend/_generated/api.ts +2 -0
- package/src/convex/components/backend/_generated/component.ts +1267 -242
- package/src/convex/components/backend/access.ts +109 -16
- package/src/convex/components/backend/account.ts +55 -4
- package/src/convex/components/backend/adapter.ts +8 -1
- package/src/convex/components/backend/ai.ts +20 -54
- package/src/convex/components/backend/billing.ts +89 -45
- package/src/convex/components/backend/consents.ts +2 -1
- package/src/convex/components/backend/crons.ts +4 -0
- package/src/convex/components/backend/gifts.ts +13 -7
- package/src/convex/components/backend/jobs.ts +58 -13
- package/src/convex/components/backend/lifecycle.ts +17 -12
- package/src/convex/components/backend/maintenance.ts +14 -1
- package/src/convex/components/backend/moderation.ts +57 -0
- package/src/convex/components/backend/notifications.ts +22 -0
- package/src/convex/components/backend/referrals.ts +14 -16
- package/src/convex/components/backend/reports.ts +7 -7
- package/src/convex/components/backend/schema.ts +251 -163
- package/src/convex/components/backend/storage.ts +67 -10
- package/src/convex/components/backend/subscriptions.ts +8 -36
- package/src/convex/components/backend/webhooks.ts +1 -10
- package/src/convex/consent-rules.ts +0 -3
- package/src/convex/constants.ts +20 -5
- package/src/convex/email-templates.ts +124 -22
- package/src/convex/emails/notification.ts +22 -0
- package/src/convex/errors.ts +64 -8
- package/src/convex/events.ts +4 -4
- package/src/convex/files.ts +48 -6
- package/src/convex/integrations/account.ts +4 -0
- package/src/convex/integrations/admin.ts +2 -1
- package/src/convex/integrations/ai/chat.ts +9 -9
- package/src/convex/integrations/ai/config.ts +147 -37
- package/src/convex/integrations/ai/context.ts +7 -4
- package/src/convex/integrations/ai/costs.ts +45 -2
- package/src/convex/integrations/ai/embeddings.ts +24 -39
- package/src/convex/integrations/ai/images.ts +141 -0
- package/src/convex/integrations/ai/job-errors.ts +40 -2
- package/src/convex/integrations/ai/jobs.ts +466 -72
- package/src/convex/integrations/ai/knowledge.ts +9 -10
- package/src/convex/integrations/ai/metering.ts +105 -36
- package/src/convex/integrations/ai/model-id.ts +24 -2
- package/src/convex/integrations/ai/models.ts +276 -59
- package/src/convex/integrations/ai/moderation-providers.ts +373 -0
- package/src/convex/integrations/ai/moderation-taxonomy.ts +174 -0
- package/src/convex/integrations/ai/moderation.ts +561 -49
- package/src/convex/integrations/ai/provenance.ts +10 -1
- package/src/convex/integrations/ai/setup.ts +5 -5
- package/src/convex/integrations/ai/stream.ts +6 -13
- package/src/convex/integrations/ai.ts +19 -6
- package/src/convex/integrations/billing/checkout.ts +4 -4
- package/src/convex/integrations/billing/context.ts +35 -11
- package/src/convex/integrations/billing/credits.ts +23 -6
- package/src/convex/integrations/billing/customers.ts +28 -5
- package/src/convex/integrations/billing/free-plan.ts +140 -29
- package/src/convex/integrations/billing/functions.ts +37 -13
- package/src/convex/integrations/billing/gifts.ts +36 -8
- package/src/convex/integrations/billing/history.ts +2 -1
- package/src/convex/integrations/billing/lifecycle.ts +43 -8
- package/src/convex/integrations/billing/passes.ts +4 -6
- package/src/convex/integrations/billing/pricing.ts +56 -14
- package/src/convex/integrations/billing/purchase.ts +1 -2
- package/src/convex/integrations/billing/rate-limit.ts +46 -0
- package/src/convex/integrations/billing/referral-orders.ts +1 -1
- package/src/convex/integrations/billing/resync.ts +187 -0
- package/src/convex/integrations/billing/rewards.ts +1 -1
- package/src/convex/integrations/billing/subscriptions.ts +4 -2
- package/src/convex/integrations/billing/types/lifecycle.ts +14 -1
- package/src/convex/integrations/billing/types/options.ts +4 -1
- package/src/convex/integrations/billing/types/records.ts +74 -4
- package/src/convex/integrations/billing/types/setup.ts +6 -5
- package/src/convex/integrations/billing/types/surface.ts +40 -5
- package/src/convex/integrations/billing/webhooks.ts +2 -2
- package/src/convex/integrations/billing/welcome.ts +103 -0
- package/src/convex/integrations/billing.ts +23 -7
- package/src/convex/integrations/email-preferences.ts +1 -1
- package/src/convex/integrations/email-sync.ts +44 -1
- package/src/convex/integrations/email.ts +17 -2
- package/src/convex/integrations/functions.ts +2 -2
- package/src/convex/integrations/launch.ts +247 -28
- package/src/convex/integrations/notifications.ts +80 -32
- package/src/convex/integrations/rate-limit.ts +24 -8
- package/src/convex/integrations/reports.ts +19 -6
- package/src/convex/integrations/retention.ts +73 -5
- package/src/convex/integrations/storage.ts +91 -6
- package/src/convex/integrations/webhooks.ts +1 -4
- package/src/convex/label-format.ts +2 -2
- package/src/convex/label-groups/admin.ts +28 -0
- package/src/convex/label-groups/cancelFlow.ts +7 -2
- package/src/convex/label-groups/credits.ts +17 -2
- package/src/convex/label-groups/email.ts +2 -1
- package/src/convex/label-groups/errors.ts +6 -1
- package/src/convex/label-groups/gift.ts +5 -2
- package/src/convex/label-groups/legal.ts +31 -0
- package/src/convex/label-groups/notifications.ts +21 -15
- package/src/convex/label-groups/pastDue.ts +1 -1
- package/src/convex/label-groups/pricing.ts +12 -8
- package/src/convex/label-groups/referral.ts +2 -2
- package/src/convex/label-groups/report.ts +10 -1
- package/src/convex/label-groups/settings.ts +4 -3
- package/src/convex/label-groups/upload.ts +2 -0
- package/src/convex/label-groups/usage.ts +2 -2
- package/src/convex/label-groups/withdrawal.ts +1 -1
- package/src/convex/label-translations.ts +141 -29
- package/src/convex/labels.ts +25 -0
- package/src/convex/legal.ts +12 -2
- package/src/convex/log.ts +14 -1
- package/src/convex/monitoring.ts +6 -4
- package/src/convex/notifications.ts +99 -13
- package/src/convex/proof.ts +43 -0
- package/src/convex/referral-rules.ts +0 -2
- package/src/convex/report-rules.ts +3 -0
- package/src/convex/sensitive-actions.ts +1 -0
- package/src/convex/test-models.ts +26 -2
- package/src/convex/test-moderation.ts +122 -0
- package/src/convex/test.ts +405 -8
- package/src/convex/waitlist-rules.ts +2 -22
- package/src/runtime/vue/components/account/AccountData.vue +2 -0
- package/src/runtime/vue/components/account/AccountDeletion.css +2 -1
- package/src/runtime/vue/components/account/ActivationChecklist.css +5 -2
- package/src/runtime/vue/components/account/ActivationChecklist.vue +1 -0
- package/src/runtime/vue/components/account/ConsentPrompt.css +8 -5
- package/src/runtime/vue/components/account/ConsentPromptDialog.vue +1 -0
- package/src/runtime/vue/components/account/ConsentPromptStorage.vue +1 -0
- package/src/runtime/vue/components/account/EmailUnsubscribe.css +6 -2
- package/src/runtime/vue/components/account/EmailUnsubscribe.vue +2 -2
- package/src/runtime/vue/components/account/HowDidYouHear.css +8 -3
- package/src/runtime/vue/components/account/HowDidYouHear.vue +1 -0
- package/src/runtime/vue/components/account/KeepAccount.css +3 -1
- package/src/runtime/vue/components/account/OnboardingFlow.css +6 -3
- package/src/runtime/vue/components/account/OnboardingFlow.vue +1 -0
- package/src/runtime/vue/components/account/ProfileIdentity.css +1 -1
- package/src/runtime/vue/components/account/ProfilePreferencesSection.css +3 -1
- package/src/runtime/vue/components/account/ProfilePreferencesSection.vue +4 -2
- package/src/runtime/vue/components/account/ProfileSettings.css +3 -1
- package/src/runtime/vue/components/account/ProfileSettings.vue +1 -0
- package/src/runtime/vue/components/account/SecurityAlerts.css +2 -1
- package/src/runtime/vue/components/account/SecurityAlerts.vue +2 -2
- package/src/runtime/vue/components/account/SecurityPasskeys.css +5 -3
- package/src/runtime/vue/components/account/SecuritySettings.css +2 -1
- package/src/runtime/vue/components/account/SecuritySettings.vue +1 -0
- package/src/runtime/vue/components/admin/AdminAccess.css +1 -1
- package/src/runtime/vue/components/admin/AdminAccess.vue +3 -1
- package/src/runtime/vue/components/admin/AdminAccessMemberTickets.vue +51 -0
- package/src/runtime/vue/components/admin/AdminAnnouncements.css +4 -2
- package/src/runtime/vue/components/admin/AdminBilling.css +1 -1
- package/src/runtime/vue/components/admin/AdminChart.css +2 -1
- package/src/runtime/vue/components/admin/AdminConsole.css +1 -0
- package/src/runtime/vue/components/admin/AdminExperiments.css +2 -1
- package/src/runtime/vue/components/admin/AdminFlags.css +4 -2
- package/src/runtime/vue/components/admin/AdminModeration.vue +148 -0
- package/src/runtime/vue/components/admin/AdminQueue.css +4 -2
- package/src/runtime/vue/components/admin/AdminReferrals.css +3 -1
- package/src/runtime/vue/components/admin/AdminReports.css +2 -1
- package/src/runtime/vue/components/admin/AdminRevenue.css +2 -1
- package/src/runtime/vue/components/admin/AdminUsers.vue +1 -0
- package/src/runtime/vue/components/admin/AdminWorkspaces.vue +1 -0
- package/src/runtime/vue/components/admin/admin.css +2 -1
- package/src/runtime/vue/components/auth/AuthForm.css +6 -3
- package/src/runtime/vue/components/auth/AuthForm.vue +4 -3
- package/src/runtime/vue/components/auth/AuthFormChoose.css +1 -0
- package/src/runtime/vue/components/auth/AuthFormPasskeyOffer.css +2 -1
- package/src/runtime/vue/components/auth/InviteRedeem.css +2 -0
- package/src/runtime/vue/components/auth/ReauthenticateCode.css +1 -1
- package/src/runtime/vue/components/auth/ReauthenticateDialog.css +6 -2
- package/src/runtime/vue/components/auth/ReauthenticateDialog.vue +3 -2
- package/src/runtime/vue/components/auth/WaitlistForm.css +3 -1
- package/src/runtime/vue/components/auth/WaitlistForm.vue +1 -0
- package/src/runtime/vue/components/auth/WaitlistPlace.css +3 -1
- package/src/runtime/vue/components/auth/WaitlistShare.css +6 -3
- package/src/runtime/vue/components/billing/BillingCheckoutLink.vue +2 -0
- package/src/runtime/vue/components/billing/BillingHistory.css +2 -1
- package/src/runtime/vue/components/billing/BillingHistory.vue +1 -0
- package/src/runtime/vue/components/billing/BillingPortalLink.vue +1 -0
- package/src/runtime/vue/components/billing/CancelFlow.css +24 -4
- package/src/runtime/vue/components/billing/CancelFlow.vue +18 -7
- package/src/runtime/vue/components/billing/CancelFlowConfirm.vue +35 -0
- package/src/runtime/vue/components/billing/CancelFlowEnd.vue +3 -1
- package/src/runtime/vue/components/billing/CancelFlowQuestion.vue +8 -2
- package/src/runtime/vue/components/billing/GiftList.css +5 -2
- package/src/runtime/vue/components/billing/PricingPackCard.css +2 -1
- package/src/runtime/vue/components/billing/PricingPackCard.vue +6 -3
- package/src/runtime/vue/components/billing/PricingPlanCard.css +5 -3
- package/src/runtime/vue/components/billing/PricingPlanCard.vue +11 -2
- package/src/runtime/vue/components/billing/PricingTable.css +1 -1
- package/src/runtime/vue/components/billing/PricingTable.vue +26 -4
- package/src/runtime/vue/components/billing/ReferralCard.css +6 -3
- package/src/runtime/vue/components/billing/ReferralCard.vue +1 -0
- package/src/runtime/vue/components/billing/ReferralLanding.css +5 -2
- package/src/runtime/vue/components/billing/UpgradePrompt.css +6 -3
- package/src/runtime/vue/components/billing/UpgradePrompt.vue +1 -0
- package/src/runtime/vue/components/billing/UsageHistory.css +2 -1
- package/src/runtime/vue/components/billing/UsageHistory.vue +1 -0
- package/src/runtime/vue/components/billing/UsageHistoryEvent.vue +3 -1
- package/src/runtime/vue/components/billing/WithdrawalButton.css +6 -2
- package/src/runtime/vue/components/billing/WithdrawalButton.vue +2 -1
- package/src/runtime/vue/components/shared.css +24 -3
- package/src/runtime/vue/components/shell/AccessDenied.css +4 -1
- package/src/runtime/vue/components/shell/AccessDenied.vue +1 -0
- package/src/runtime/vue/components/shell/AccountMenu.vue +1 -0
- package/src/runtime/vue/components/shell/AiLabel.css +3 -2
- package/src/runtime/vue/components/shell/AiLabel.vue +4 -1
- package/src/runtime/vue/components/shell/AppShell.css +5 -3
- package/src/runtime/vue/components/shell/AppShell.vue +3 -0
- package/src/runtime/vue/components/shell/BackendNotices.vue +3 -2
- package/src/runtime/vue/components/shell/ConfirmDialog.css +5 -2
- package/src/runtime/vue/components/shell/ConnectionStatus.css +1 -1
- package/src/runtime/vue/components/shell/ConnectionStatus.vue +1 -0
- package/src/runtime/vue/components/shell/ContactForm.css +8 -1
- package/src/runtime/vue/components/shell/ContactForm.vue +1 -0
- package/src/runtime/vue/components/shell/FrameMain.vue +2 -0
- package/src/runtime/vue/components/shell/Gate.css +5 -2
- package/src/runtime/vue/components/shell/Gate.vue +2 -0
- package/src/runtime/vue/components/shell/GateQuota.vue +1 -0
- package/src/runtime/vue/components/shell/LegalCompany.vue +38 -0
- package/src/runtime/vue/components/shell/LegalContactPoints.vue +74 -0
- package/src/runtime/vue/components/shell/LegalDetail.vue +54 -0
- package/src/runtime/vue/components/shell/LegalDocument.css +21 -4
- package/src/runtime/vue/components/shell/LegalDocument.vue +54 -15
- package/src/runtime/vue/components/shell/LegalModeration.vue +94 -0
- package/src/runtime/vue/components/shell/LegalProcessors.vue +64 -22
- package/src/runtime/vue/components/shell/LegalStorage.vue +64 -23
- package/src/runtime/vue/components/shell/LegalVersion.vue +44 -0
- package/src/runtime/vue/components/shell/NoticeAnnouncement.css +2 -1
- package/src/runtime/vue/components/shell/NoticeDeletion.css +5 -2
- package/src/runtime/vue/components/shell/NoticeGift.css +2 -1
- package/src/runtime/vue/components/shell/NoticeGift.vue +8 -5
- package/src/runtime/vue/components/shell/NoticeImpersonation.css +2 -1
- package/src/runtime/vue/components/shell/NoticeLowCredits.css +6 -2
- package/src/runtime/vue/components/shell/NoticeLowCredits.vue +3 -1
- package/src/runtime/vue/components/shell/NoticeMaintenance.css +2 -1
- package/src/runtime/vue/components/shell/NoticePastDue.css +6 -2
- package/src/runtime/vue/components/shell/NoticePastDue.vue +1 -1
- package/src/runtime/vue/components/shell/NotificationInbox.css +6 -4
- package/src/runtime/vue/components/shell/NotificationInbox.vue +1 -0
- package/src/runtime/vue/components/shell/ReportNotice.css +2 -1
- package/src/runtime/vue/components/shell/UploadField.css +4 -2
- package/src/runtime/vue/components/shell/UploadField.vue +21 -5
- package/src/runtime/vue/components/shell/WorkspaceSwitcher.css +4 -1
- package/src/runtime/vue/components/shell/WorkspaceSwitcher.vue +1 -0
- package/src/runtime/vue/components/tokens.css +40 -16
- package/src/runtime/vue/components/workspaces/AcceptInvitation.vue +1 -0
- package/src/runtime/vue/components/workspaces/AuditLog.css +2 -1
- package/src/runtime/vue/components/workspaces/AuditLog.vue +1 -0
- package/src/runtime/vue/components/workspaces/WorkspaceBilling.css +2 -1
- package/src/runtime/vue/components/workspaces/WorkspaceCredits.css +1 -0
- package/src/runtime/vue/components/workspaces/WorkspaceCredits.vue +6 -3
- package/src/runtime/vue/components/workspaces/WorkspaceList.css +2 -1
- package/src/runtime/vue/components/workspaces/WorkspaceSettings.vue +1 -0
- package/src/runtime/vue/pages/gifts.vue +13 -2
- package/src/runtime/vue/pages/referral.vue +1 -2
- package/dist/devtools-client/_nuxt/CfQg3BRt.js +0 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createFunctionHandle, type FunctionReference, type GenericActionCtx, type GenericDataModel, type GenericMutationCtx, internalActionGeneric, makeFunctionReference, mutationGeneric, paginationOptsValidator, queryGeneric, type RegisteredAction, type RegisteredMutation, type RegisteredQuery } from 'convex/server'
|
|
2
2
|
import { v } from 'convex/values'
|
|
3
3
|
import { readEnv } from '../delivery.js'
|
|
4
|
-
import type { EmailMessage, EmailRenderContext } from '../email-templates.js'
|
|
4
|
+
import type { EmailMessage, EmailRenderContext, EmailTemplateData, EmailTemplateName } from '../email-templates.js'
|
|
5
5
|
import { backendError } from '../errors.js'
|
|
6
6
|
import { logBackend } from '../log.js'
|
|
7
7
|
import {
|
|
@@ -10,8 +10,16 @@ import {
|
|
|
10
10
|
NOTIFICATION_KINDS,
|
|
11
11
|
type NotificationChannel,
|
|
12
12
|
choosableChannels,
|
|
13
|
+
isTransactional,
|
|
14
|
+
listedKind,
|
|
15
|
+
type NotificationEntity,
|
|
16
|
+
notificationEntity,
|
|
17
|
+
type NotificationFeatures,
|
|
18
|
+
notificationKind,
|
|
13
19
|
notificationLabelKey,
|
|
14
20
|
type NotificationPlan,
|
|
21
|
+
type NotificationType,
|
|
22
|
+
notificationWordKeys,
|
|
15
23
|
type NotifyEvent,
|
|
16
24
|
type NotifyOptions,
|
|
17
25
|
notifyProblem,
|
|
@@ -34,9 +42,12 @@ export type {
|
|
|
34
42
|
Delivery,
|
|
35
43
|
NotificationAudience,
|
|
36
44
|
NotificationChannel,
|
|
45
|
+
NotificationEntity,
|
|
46
|
+
NotificationFeature,
|
|
37
47
|
NotificationKind,
|
|
38
48
|
NotificationDestination,
|
|
39
49
|
NotificationPlan,
|
|
50
|
+
NotificationType,
|
|
40
51
|
NotifyEvent,
|
|
41
52
|
NotifyKind,
|
|
42
53
|
NotifyOptions,
|
|
@@ -63,6 +74,13 @@ export interface NotificationEntry {
|
|
|
63
74
|
actor: NotificationParty
|
|
64
75
|
/** The workspace it happened in, by its name now. */
|
|
65
76
|
workspace: { id: string, name: string | null } | null
|
|
77
|
+
/**
|
|
78
|
+
* Whose plan, credits or gift a billing, gift or referral kind is about:
|
|
79
|
+
* `account` the reader's own (`billTo: 'user'`), `workspace` the one
|
|
80
|
+
* `workspace` names. `null` for every other kind. The inbox words an
|
|
81
|
+
* `account` one with the kind's `titleYours` and `bodyYours`.
|
|
82
|
+
*/
|
|
83
|
+
entity: NotificationEntity | null
|
|
66
84
|
/** The thing acted on. */
|
|
67
85
|
targetId: string | null
|
|
68
86
|
/** Where it links, for a kind of your own (`notify`'s `link`); `null` for a package kind, which links to a ready-made page by its type. */
|
|
@@ -173,9 +191,13 @@ export interface ForgottenNotifications {
|
|
|
173
191
|
done: boolean
|
|
174
192
|
}
|
|
175
193
|
|
|
176
|
-
/** What the notifications need of `setupEmail`'s instance: the layout and words, and the sending rules. */
|
|
194
|
+
/** What the notifications need of `setupEmail`'s instance: the layout and words, the templates, and the sending rules. */
|
|
177
195
|
export interface NotificationsEmail {
|
|
178
196
|
compose: <Message extends EmailMessage | null>(build: (context: EmailRenderContext) => Message | Promise<Message>, options?: { locale?: string | null }) => Promise<Message>
|
|
197
|
+
/** Render one of the package's emails, the app's override in effect: a notification's email is the `notification` template. */
|
|
198
|
+
render: <Name extends EmailTemplateName>(name: Name, data: EmailTemplateData<Name>, options?: { locale?: string }) => Promise<EmailMessage>
|
|
199
|
+
/** The transactional send, under no sending rule: a transactional kind's email goes through it. */
|
|
200
|
+
send: (ctx: Pick<GenericActionCtx<GenericDataModel>, 'runMutation'>, message: EmailMessage) => Promise<string | null>
|
|
179
201
|
/**
|
|
180
202
|
* The sending rules the email instance holds: the weekly cap and the quiet hours.
|
|
181
203
|
*
|
|
@@ -201,12 +223,23 @@ export interface SetupNotificationsOptions {
|
|
|
201
223
|
/**
|
|
202
224
|
* The email instance (`setupEmail`), which email and push notifications
|
|
203
225
|
* are worded and rendered with: your messages, your brand and layout,
|
|
204
|
-
* and the weekly cap and quiet hours. Without it, notifications reach the
|
|
226
|
+
* and the weekly cap and quiet hours, which a transactional kind skips. Without it, notifications reach the
|
|
205
227
|
* inbox alone. Re-export `deliverNotification` with it.
|
|
206
228
|
*/
|
|
207
229
|
email?: NotificationsEmail
|
|
208
230
|
/** The paths the Nuxt module writes to `paths.generated.ts`: a package kind's email links to its ready-made page there. */
|
|
209
231
|
paths?: Partial<BackendPaths>
|
|
232
|
+
/**
|
|
233
|
+
* The package's kinds your app sends, for the channel list
|
|
234
|
+
* (`getNotificationChannels`, `useEmailPreferences().channels`): only
|
|
235
|
+
* these appear there, with your own kinds of `notify`, and only these
|
|
236
|
+
* take a choice (`setNotificationChannel`). An app that never shares a
|
|
237
|
+
* workspace leaves out the `workspace.` kinds. Left out, every kind
|
|
238
|
+
* appears but those of a billing feature the deployment has never used:
|
|
239
|
+
* gifts, plan passes, reverse trials and referrals. The list shapes the
|
|
240
|
+
* choices only: a kind it leaves out still reaches the inbox if it happens.
|
|
241
|
+
*/
|
|
242
|
+
kinds?: readonly NotificationType[]
|
|
210
243
|
}
|
|
211
244
|
|
|
212
245
|
/** The `backend` component as the inbox reads it. */
|
|
@@ -214,14 +247,18 @@ export interface NotificationsComponents {
|
|
|
214
247
|
backend: unknown
|
|
215
248
|
}
|
|
216
249
|
|
|
250
|
+
/** A notification as the component reads it: the entry, before the billing entity is told from its workspace. */
|
|
251
|
+
type StoredEntry = Omit<NotificationEntry, 'entity'>
|
|
252
|
+
|
|
217
253
|
interface NotificationsRefs {
|
|
218
254
|
notifications: {
|
|
219
|
-
list: FunctionReference<'query', 'internal', { userId: string, paginationOpts: PaginationArgs }, NotificationsPage>
|
|
255
|
+
list: FunctionReference<'query', 'internal', { userId: string, paginationOpts: PaginationArgs }, Omit<NotificationsPage, 'page'> & { page: StoredEntry[] }>
|
|
220
256
|
unread: FunctionReference<'query', 'internal', { userId: string }, UnreadCount>
|
|
221
257
|
markRead: FunctionReference<'mutation', 'internal', { userId: string, ids: string[] }, number>
|
|
222
258
|
markAllRead: FunctionReference<'mutation', 'internal', { userId: string }, MarkedRead>
|
|
223
259
|
forget: FunctionReference<'mutation', 'internal', { type: string, targetId: string }, ForgottenNotifications>
|
|
224
260
|
listChoices: FunctionReference<'query', 'internal', { userId: string }, Array<{ type: string, channel: NotificationChannel, enabled: boolean }>>
|
|
261
|
+
features: FunctionReference<'query', 'internal', Record<string, never>, NotificationFeatures>
|
|
225
262
|
choose: FunctionReference<'mutation', 'internal', { userId: string, type: string, channel: NotificationChannel, enabled: boolean }, null>
|
|
226
263
|
recipient: FunctionReference<'query', 'internal', { userId: string, type: string, channel: NotificationChannel, actorId?: string, impersonated?: boolean, entityId?: string }, Recipient | null>
|
|
227
264
|
}
|
|
@@ -269,17 +306,20 @@ const PUSH_RETRY_MAX_MS = 60 * 60 * 1000
|
|
|
269
306
|
/** The words of a party, when the event names none by name. */
|
|
270
307
|
const ACTOR_WORDS = { you: 'actorSomeone', user: 'actorSomeone', administrator: 'actorAdministrator', app: 'actorApp', erased: 'actorErased' } as const
|
|
271
308
|
|
|
272
|
-
/** A notification's words in a reader's language: its title and body, the kind's own or the fallback. */
|
|
273
|
-
function notificationWords(t: EmailRenderContext['t'], type: string, recipient: Recipient, data: Record<string, string | number | boolean | string[]
|
|
309
|
+
/** A notification's words in a reader's language: its title and body, the kind's own (those for the reader's own account, when the billing entity is theirs) or the fallback. */
|
|
310
|
+
function notificationWords(t: EmailRenderContext['t'], type: string, recipient: Recipient, data: Record<string, string | number | boolean | string[]>, entity: NotificationEntity | null): { title: string, body: string | null } {
|
|
274
311
|
const params: Record<string, string | number> = {}
|
|
275
312
|
for (const [name, value] of Object.entries(data)) params[name] = Array.isArray(value) ? value.join(', ') : typeof value === 'boolean' ? String(value) : value
|
|
276
313
|
params.actor = recipient.actor.name ?? t(`notifications.${ACTOR_WORDS[recipient.actor.kind]}`)
|
|
277
314
|
params.workspace = recipient.workspace ?? t('notifications.workspaceUnnamed')
|
|
278
315
|
// A package kind's words sit under `backend.notifications` (packaged); an app's own kind's under the same key of its messages.
|
|
279
316
|
const key = type.startsWith('app.') ? `backend.notifications.${notificationLabelKey(type)}` : `notifications.${notificationLabelKey(type)}`
|
|
280
|
-
const read = (part:
|
|
281
|
-
const
|
|
282
|
-
|
|
317
|
+
const read = (part: 'title' | 'body') => {
|
|
318
|
+
for (const name of notificationWordKeys(part, entity)) {
|
|
319
|
+
const text = t(`${key}.${name}`, params)
|
|
320
|
+
if (text !== `${key}.${name}`) return text
|
|
321
|
+
}
|
|
322
|
+
return null
|
|
283
323
|
}
|
|
284
324
|
return { title: read('title') ?? t('notifications.fallbackTitle'), body: read('body') }
|
|
285
325
|
}
|
|
@@ -314,11 +354,15 @@ export function setupNotifications(components: NotificationsComponents, options:
|
|
|
314
354
|
const notify = options.notify ?? {}
|
|
315
355
|
const problem = notifyProblem(notify)
|
|
316
356
|
if (problem) throw new TypeError(`[nuxt-backend] setupNotifications({ notify }): ${problem}`)
|
|
357
|
+
const unknownKind = options.kinds?.find(type => !notificationKind(type))
|
|
358
|
+
if (unknownKind !== undefined) throw new TypeError(`[nuxt-backend] setupNotifications({ kinds }): ${JSON.stringify(unknownKind)} is no kind of the package that notifies. List the package's kinds (\`billing.order_paid\`); your own kinds of \`notify\` are always on the list.`)
|
|
359
|
+
const kinds = options.kinds ? new Set<string>(options.kinds) : null
|
|
317
360
|
|
|
318
361
|
const listNotifications = queryGeneric({
|
|
319
362
|
args: { paginationOpts: paginationOptsValidator },
|
|
320
363
|
handler: async (ctx, { paginationOpts }): Promise<NotificationsPage> => {
|
|
321
|
-
|
|
364
|
+
const result = await ctx.runQuery(refs.notifications.list, { userId: await ownCaller(ctx, 'listNotifications'), paginationOpts })
|
|
365
|
+
return { ...result, page: result.page.map(entry => ({ ...entry, entity: notificationEntity(entry.type, entry.workspace?.id) })) }
|
|
322
366
|
},
|
|
323
367
|
})
|
|
324
368
|
|
|
@@ -344,9 +388,9 @@ export function setupNotifications(components: NotificationsComponents, options:
|
|
|
344
388
|
|
|
345
389
|
// ── Channels, kind by kind ───────────────────────────────────────────
|
|
346
390
|
|
|
347
|
-
/** The channels each kind may use, by the channel matrix, and the email the package sends itself for a new device: the package's kinds that notify, then the app's own. */
|
|
391
|
+
/** The channels each kind may use, by the channel matrix, and the email the package sends itself for a new device: the package's kinds that notify (those `kinds` lists, when it does), then the app's own. */
|
|
348
392
|
const allowed = new Map<string, NotificationChannel[]>([
|
|
349
|
-
...Object.keys(NOTIFICATION_KINDS).map(type => [type, choosableChannels(type, declaredChannels(type))] as const),
|
|
393
|
+
...Object.keys(NOTIFICATION_KINDS).filter(type => listedKind(type, kinds, null)).map(type => [type, choosableChannels(type, declaredChannels(type))] as const),
|
|
350
394
|
...Object.entries(notify).map(([type, kind]) => [type, choosableChannels(type, kind.channels)] as const),
|
|
351
395
|
].filter(([, channels]) => channels.length > 0))
|
|
352
396
|
|
|
@@ -357,7 +401,9 @@ export function setupNotifications(components: NotificationsComponents, options:
|
|
|
357
401
|
if (!identity) return null
|
|
358
402
|
const userId = await ownCaller(ctx, 'getNotificationChannels')
|
|
359
403
|
const chosen = new Map((await ctx.runQuery(refs.notifications.listChoices, { userId })).map(row => [`${row.type} ${row.channel}`, row.enabled]))
|
|
360
|
-
|
|
404
|
+
// Without `kinds`, a billing feature the deployment has never used (no gift bought, no referral) lists none of its kinds.
|
|
405
|
+
const features = kinds ? null : await ctx.runQuery(refs.notifications.features, {})
|
|
406
|
+
return [...allowed].filter(([type]) => listedKind(type, kinds, features)).map(([type, channels]) => ({ type, channels: channels.map(channel => ({ channel, enabled: chosen.get(`${type} ${channel}`) ?? true })) }))
|
|
361
407
|
},
|
|
362
408
|
})
|
|
363
409
|
|
|
@@ -410,17 +456,17 @@ export function setupNotifications(components: NotificationsComponents, options:
|
|
|
410
456
|
const target = (type: string, link: string | null): string => {
|
|
411
457
|
const site = (readEnv('SITE_URL') ?? '').replace(/\/$/, '')
|
|
412
458
|
if (link) return `${site}${link}`
|
|
413
|
-
const kind =
|
|
459
|
+
const kind = notificationKind(type)
|
|
414
460
|
const page = kind?.page === 'security' ? pages.security : kind?.page === 'settings' ? pages.settings : '/profile'
|
|
415
461
|
return `${site}${page}`
|
|
416
462
|
}
|
|
417
463
|
|
|
418
|
-
/** The words and the link of one notification for its reader; `null` without an email instance to word it with. */
|
|
464
|
+
/** The words and the link of one notification for its reader, and the language they are in; `null` without an email instance to word it with. */
|
|
419
465
|
const worded = async (delivery: ScheduledDelivery, recipient: Recipient) => {
|
|
420
466
|
if (!email) return null
|
|
421
467
|
let words: { title: string, body: string | null, url: string, locale: string } | null = null
|
|
422
468
|
await email.compose((context) => {
|
|
423
|
-
words = { ...notificationWords(context.t, delivery.event.type, recipient, delivery.event.data ?? {}), url: context.link(target(delivery.event.type, delivery.link)), locale: context.locale }
|
|
469
|
+
words = { ...notificationWords(context.t, delivery.event.type, recipient, delivery.event.data ?? {}, notificationEntity(delivery.event.type, delivery.event.entityId)), url: context.link(target(delivery.event.type, delivery.link)), locale: context.locale }
|
|
424
470
|
return null
|
|
425
471
|
}, { locale: recipient.locale })
|
|
426
472
|
return words as { title: string, body: string | null, url: string, locale: string } | null
|
|
@@ -428,29 +474,31 @@ export function setupNotifications(components: NotificationsComponents, options:
|
|
|
428
474
|
|
|
429
475
|
const deliverEmail = async (ctx: DeliveryCtx, delivery: ScheduledDelivery, recipient: Recipient) => {
|
|
430
476
|
if (!email || !recipient.email) return
|
|
431
|
-
const
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
477
|
+
const words = await worded(delivery, recipient)
|
|
478
|
+
if (!words) return
|
|
479
|
+
// The `notification` template, the app's override in effect, in the language the words are in: it puts the link in that language itself.
|
|
480
|
+
const message = await email.render('notification', {
|
|
481
|
+
email: recipient.email,
|
|
482
|
+
type: delivery.event.type,
|
|
483
|
+
words: { title: words.title, ...(words.body ? { body: words.body } : {}) },
|
|
484
|
+
link: target(delivery.event.type, delivery.link),
|
|
485
|
+
fields: delivery.event.data ?? {},
|
|
486
|
+
}, { locale: words.locale })
|
|
487
|
+
// A transactional kind goes at once, as a transactional email does: no cap, no quiet hours.
|
|
488
|
+
if (isTransactional(notify, delivery.event.type)) {
|
|
489
|
+
await email.send(ctx, message)
|
|
490
|
+
return
|
|
491
|
+
}
|
|
444
492
|
// The weekly cap and the quiet hours, as for every non-transactional email; never the sunset rule.
|
|
445
493
|
const prepared = await email.preferences.prepare(ctx, message, undefined, async () => ({ unsubscribe: '' }), { sunset: false })
|
|
446
|
-
if (prepared) await ctx.runMutation(refs.email.send, prepared)
|
|
494
|
+
if (prepared) await ctx.runMutation(refs.email.send, { ...prepared })
|
|
447
495
|
}
|
|
448
496
|
|
|
449
497
|
const deliverPush = async (ctx: DeliveryCtx, delivery: ScheduledDelivery, recipient: Recipient) => {
|
|
450
498
|
const keys = pushKeys()
|
|
451
499
|
if (!keys) return
|
|
452
|
-
// The quiet hours hold a push to their end, on the person's own clock.
|
|
453
|
-
if (delivery.attempt === undefined) {
|
|
500
|
+
// The quiet hours hold a push to their end, on the person's own clock; a transactional kind's goes at once.
|
|
501
|
+
if (delivery.attempt === undefined && !isTransactional(notify, delivery.event.type)) {
|
|
454
502
|
const until = await ctx.runQuery(refs.preferences.quietUntil, { userId: delivery.userId, quietHours: email?.preferences.caps.quietHours ?? null })
|
|
455
503
|
if (until !== null && until > Date.now()) {
|
|
456
504
|
await ctx.scheduler.runAt(until, self, { ...delivery, attempt: 1 })
|
|
@@ -40,6 +40,21 @@ export interface RateLimiterComponents {
|
|
|
40
40
|
* `passkeySignInGlobal` the routes anyone may call without a session. The package is passwordless: there are no password limits, and an
|
|
41
41
|
* app that turns passwords on brings its own.
|
|
42
42
|
*
|
|
43
|
+
* The three busiest deployment-wide ceilings, `emailOtpGlobal`, `aiGlobal`
|
|
44
|
+
* and `passkeySignInGlobal`, apply their updates asynchronously
|
|
45
|
+
* (`applyUpdates: 'asynchronously'`): a request checks the window on a
|
|
46
|
+
* snapshot and queues its token, so the requests that spend one never
|
|
47
|
+
* conflict over the window's single row. Under a burst the ceiling lets
|
|
48
|
+
* through every request that read the window before the queue caught up,
|
|
49
|
+
* so more than its rate. The queue then applies every queued spend, without
|
|
50
|
+
* stopping at zero, so the window ends below zero and the overshoot is
|
|
51
|
+
* taken from the next windows: a flood keeps the ceiling closed for longer
|
|
52
|
+
* than one window. Nothing in front of it bounds a flood either: a sign-in
|
|
53
|
+
* code is limited per address, and a flood rotates addresses.
|
|
54
|
+
* An override of one of these three replaces its whole config: without
|
|
55
|
+
* `applyUpdates` it is transactional again, and may be sharded; an
|
|
56
|
+
* asynchronous limit can't be.
|
|
57
|
+
*
|
|
43
58
|
* ## Covering other auth routes
|
|
44
59
|
*
|
|
45
60
|
* These names throttle the routes the package wires itself. Better Auth's own
|
|
@@ -71,7 +86,7 @@ export const DEFAULT_LIMITS = {
|
|
|
71
86
|
* rotating addresses to probe an invite gate or run up the email bill hits
|
|
72
87
|
* this ceiling. Raise it when a launch legitimately signs in more than that.
|
|
73
88
|
*/
|
|
74
|
-
emailOtpGlobal: { kind: 'fixed window', rate: 300, period: HOUR },
|
|
89
|
+
emailOtpGlobal: { kind: 'fixed window', rate: 300, period: HOUR, applyUpdates: 'asynchronously' },
|
|
75
90
|
/**
|
|
76
91
|
* Code checks — 10 per hour per address, burst 10. Every route that checks
|
|
77
92
|
* a code (sign-in, verification, both steps of an email change, a password
|
|
@@ -125,7 +140,7 @@ export const DEFAULT_LIMITS = {
|
|
|
125
140
|
* run up. Over it, a guest job is refused with `rate_limited`. Raise it
|
|
126
141
|
* when a launch legitimately lets more visitors try than that.
|
|
127
142
|
*/
|
|
128
|
-
aiGlobal: { kind: 'fixed window', rate: 300, period: HOUR },
|
|
143
|
+
aiGlobal: { kind: 'fixed window', rate: 300, period: HOUR, applyUpdates: 'asynchronously' },
|
|
129
144
|
/**
|
|
130
145
|
* Administrator actions — 30 per minute per administrator, burst 10. Covers
|
|
131
146
|
* every `/admin/*` route that acts on somebody else (list, create, update,
|
|
@@ -178,11 +193,12 @@ export const DEFAULT_LIMITS = {
|
|
|
178
193
|
* tap on "Sign in with passkey", and each sign-in page that offers
|
|
179
194
|
* passkeys in the browser's autofill, again every four and a half minutes
|
|
180
195
|
* while it stays open in view, a challenge lasting five. Keyed by an
|
|
181
|
-
* HMAC, under the auth secret, of the address
|
|
182
|
-
*
|
|
183
|
-
* proxy
|
|
184
|
-
*
|
|
185
|
-
*
|
|
196
|
+
* HMAC, under the auth secret, of the client's address: the one the app's
|
|
197
|
+
* server signed under `PROTECTION_PROOF_SECRET` for a request through its
|
|
198
|
+
* auth proxy (clientAddressPlugin), else the one Convex wrote into
|
|
199
|
+
* `x-forwarded-for`, the address that connected. Without the secret every
|
|
200
|
+
* visitor through the app's server shares that server's address, so
|
|
201
|
+
* {@link DEFAULT_LIMITS.passkeySignInGlobal} is the ceiling behind it.
|
|
186
202
|
*/
|
|
187
203
|
passkeySignIn: { kind: 'token bucket', rate: 30, period: MINUTE, capacity: 30 },
|
|
188
204
|
/**
|
|
@@ -194,7 +210,7 @@ export const DEFAULT_LIMITS = {
|
|
|
194
210
|
* email codes still sign people in. Raise it when more sign-in pages than
|
|
195
211
|
* that open in an hour (a page left open in view spends about thirteen).
|
|
196
212
|
*/
|
|
197
|
-
passkeySignInGlobal: { kind: 'fixed window', rate: 3000, period: HOUR },
|
|
213
|
+
passkeySignInGlobal: { kind: 'fixed window', rate: 3000, period: HOUR, applyUpdates: 'asynchronously' },
|
|
198
214
|
/**
|
|
199
215
|
* Sign-in codes to addresses with no account yet — 200 per hour across
|
|
200
216
|
* the deployment, a fixed window. Spent in place of `emailOtpGlobal` by a
|
|
@@ -19,7 +19,7 @@ import { backendError } from '../errors.js'
|
|
|
19
19
|
import { EVENT_VALUE_MAX } from '../events.js'
|
|
20
20
|
import { logBackend } from '../log.js'
|
|
21
21
|
import { randomToken, sha256Hex } from '../tokens.js'
|
|
22
|
-
import { APPEAL_FRAGMENT, REMOVAL_DEADLINE_MS, REPORT_REASONS, type ReportReason } from '../report-rules.js'
|
|
22
|
+
import { APPEAL_FRAGMENT, REMOVAL_DEADLINE_MS, REPORT_DETAILS_MAX, REPORT_REASONS, type ReportReason } from '../report-rules.js'
|
|
23
23
|
import { addressDigest, mailboxOf } from '../waitlist-rules.js'
|
|
24
24
|
import { type AdapterFindOne, type Administrators, createAccessReads, isAdministratorNow, refuseCaller, requireAdministratorInPerson } from './access.js'
|
|
25
25
|
import { setupAudit } from './audit.js'
|
|
@@ -39,7 +39,7 @@ import { DEFAULT_LIMITS } from './rate-limit.js'
|
|
|
39
39
|
// goes. Every decision is emailed to whoever the law says must hear of it,
|
|
40
40
|
// and recorded on the activity trail without the reporter.
|
|
41
41
|
|
|
42
|
-
export {
|
|
42
|
+
export type { ReportReason } from '../report-rules.js'
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* A reported thing of the app's: the table it is in and its row id, an id of
|
|
@@ -187,12 +187,14 @@ export type NoticeInput = {
|
|
|
187
187
|
locale?: string
|
|
188
188
|
/** The bot check's token (`useHumanCheck().token('report', email)`). */
|
|
189
189
|
human?: string | null
|
|
190
|
+
/** The honeypot, a field people never see: filled, the notice is a bot's, and nothing is filed or sent. */
|
|
191
|
+
website?: string
|
|
190
192
|
}
|
|
191
193
|
|
|
192
194
|
/** The report functions `backend/admin.ts` re-exports beside the console's reads. */
|
|
193
195
|
export interface ReportsApi {
|
|
194
|
-
/** Report a thing, signed in: one open report per person and thing, at most 10 an hour (the `report` limit). */
|
|
195
|
-
reportContent: RegisteredMutation<'public', { subject: { table: string, id: string }, reason: ReportReason, details?: string }, Promise<null>>
|
|
196
|
+
/** Report a thing, signed in: one open report per person and thing, at most 10 an hour (the `report` limit). A filled `website`, the honeypot, files nothing. */
|
|
197
|
+
reportContent: RegisteredMutation<'public', { subject: { table: string, id: string }, reason: ReportReason, details?: string, website?: string }, Promise<null>>
|
|
196
198
|
/** The public notice form's send, for anyone: the bot check, the `report` limit per address and `reportGlobal`, and a receipt by email. */
|
|
197
199
|
sendNotice: RegisteredAction<'public', NoticeInput, Promise<null>>
|
|
198
200
|
/** A decision by its appeal link's token; `null` for a token no decision has. */
|
|
@@ -210,7 +212,7 @@ export interface ReportsApi {
|
|
|
210
212
|
}
|
|
211
213
|
|
|
212
214
|
/** The longest text each field keeps. */
|
|
213
|
-
const MAX = { url: 2048, details:
|
|
215
|
+
const MAX = { url: 2048, details: REPORT_DETAILS_MAX, name: 200, email: 320, signature: 200, reason: 2000, note: 500, appeal: 4000, table: 64, id: 128 } as const
|
|
214
216
|
|
|
215
217
|
const vReason = v.union(...REPORT_REASONS.map(reason => v.literal(reason)))
|
|
216
218
|
const vSubject = v.object({ table: v.string(), id: v.string() })
|
|
@@ -461,11 +463,16 @@ export function createReports(components: { backend: unknown, rateLimiter?: unkn
|
|
|
461
463
|
}
|
|
462
464
|
|
|
463
465
|
const reportContent = mutationGeneric({
|
|
464
|
-
args: { subject: vSubject, reason: vReason, details: v.optional(v.string()) },
|
|
466
|
+
args: { subject: vSubject, reason: vReason, details: v.optional(v.string()), website: v.optional(v.string()) },
|
|
465
467
|
returns: v.null(),
|
|
466
468
|
handler: async (ctx, args) => {
|
|
467
469
|
const identity = await ctx.auth.getUserIdentity()
|
|
468
470
|
if (!identity) throw backendError('unauthenticated', {}, '[nuxt-backend] Sign in to report content, or use the report form.')
|
|
471
|
+
// The honeypot, a field people never see: a form that filled it is a bot's, and files nothing.
|
|
472
|
+
if (args.website?.trim()) {
|
|
473
|
+
logBackend('info', 'reports.honeypot', 'A report filled the honeypot; nothing was filed.')
|
|
474
|
+
return null
|
|
475
|
+
}
|
|
469
476
|
// A report is the person's own: an administrator visiting the account makes none.
|
|
470
477
|
refuseCaller(identity as unknown as Record<string, unknown>, { impersonation: 'refused' }, 'reportContent')
|
|
471
478
|
const account = await reads.account(ctx, identity.subject)
|
|
@@ -491,9 +498,15 @@ export function createReports(components: { backend: unknown, rateLimiter?: unkn
|
|
|
491
498
|
subject: v.optional(vSubject),
|
|
492
499
|
locale: v.optional(v.string()),
|
|
493
500
|
human: v.optional(v.union(v.string(), v.null())),
|
|
501
|
+
website: v.optional(v.string()),
|
|
494
502
|
},
|
|
495
503
|
returns: v.null(),
|
|
496
504
|
handler: async (ctx, input) => {
|
|
505
|
+
// The honeypot: a form that filled it is a bot's. It is told nothing went wrong, and nothing is filed, mailed or counted.
|
|
506
|
+
if (input.website?.trim()) {
|
|
507
|
+
logBackend('info', 'reports.honeypot', 'A notice filled the honeypot; nothing was filed, mailed or counted.')
|
|
508
|
+
return null
|
|
509
|
+
}
|
|
497
510
|
const notice = checkedNotice(input)
|
|
498
511
|
const address = notice.notifier.email
|
|
499
512
|
// The bot check first: a refused call spends none of the limits.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
type Crons,
|
|
2
3
|
type DocumentByName,
|
|
3
4
|
type FieldTypeFromFieldPath,
|
|
4
5
|
type GenericDataModel,
|
|
@@ -13,6 +14,10 @@ import {
|
|
|
13
14
|
} from 'convex/server'
|
|
14
15
|
import { v } from 'convex/values'
|
|
15
16
|
import { logBackend } from '../log.js'
|
|
17
|
+
import type { BackendCronSchedule } from '../monitoring.js'
|
|
18
|
+
|
|
19
|
+
/** When a rule runs, for {@link scheduleRetention}: `every` an interval (`{ hours: 24 }`), or on a `cron` expression (five fields, UTC). */
|
|
20
|
+
export type RetentionSchedule = BackendCronSchedule
|
|
16
21
|
|
|
17
22
|
/** Rows one batch deletes when the rule says nothing. */
|
|
18
23
|
export const DEFAULT_RETENTION_BATCH = 100
|
|
@@ -62,8 +67,18 @@ export interface RetentionOptions<
|
|
|
62
67
|
batch?: number
|
|
63
68
|
/** Runs before each row is deleted, in the same transaction. */
|
|
64
69
|
onDelete?: (ctx: GenericMutationCtx<DM>, row: DocumentByName<DM, T>) => void | Promise<void>
|
|
70
|
+
/**
|
|
71
|
+
* When the rule runs: `every` an interval, or on a `cron` expression
|
|
72
|
+
* (five fields, UTC). `scheduleRetention(crons, rules)` in
|
|
73
|
+
* `backend/crons.ts` starts every rule that has one. Without it, start the
|
|
74
|
+
* rule from a cron of your own.
|
|
75
|
+
*/
|
|
76
|
+
schedule?: RetentionSchedule
|
|
65
77
|
}
|
|
66
78
|
|
|
79
|
+
/** Each scheduled rule's own function path and schedule, by the mutation `defineRetention` returned. */
|
|
80
|
+
const schedules = new WeakMap<object, { fn: string, schedule: RetentionSchedule }>()
|
|
81
|
+
|
|
67
82
|
/** The query builder and index range, with the index and its fields named at run time: the types above check them against the schema. */
|
|
68
83
|
interface ByIndex<Row> {
|
|
69
84
|
withIndex: (index: string, range: (q: IndexRangeLoose) => IndexRangeLoose) => { take: (count: number) => Promise<Array<Row & { _id: never }>> }
|
|
@@ -80,9 +95,20 @@ function fieldsOfIndex(index: string): string[] {
|
|
|
80
95
|
return named ? named.split('_and_') : []
|
|
81
96
|
}
|
|
82
97
|
|
|
98
|
+
/** A schedule as a rule takes it: exactly one of `every` or `cron`. */
|
|
99
|
+
function checkSchedule(rule: string, schedule: unknown): void {
|
|
100
|
+
const given = schedule as { every?: unknown, cron?: unknown } | null
|
|
101
|
+
const every = given?.every !== undefined && typeof given.every === 'object' && given.every !== null
|
|
102
|
+
const cron = typeof given?.cron === 'string' && given.cron.trim() !== ''
|
|
103
|
+
if (!given || typeof given !== 'object' || every === cron) {
|
|
104
|
+
throw new TypeError(`[nuxt-backend] ${rule}: "schedule" is \`{ every: { hours: 24 } }\` or \`{ cron: '10 3 * * *' }\` (UTC), one of the two.`)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
83
108
|
/** What a rule's options must satisfy, checked when the module loads so a deploy refuses a broken rule. */
|
|
84
|
-
function checkRule(options: { fn: string, table: string, index: string, match?: Record<string, unknown>, ttl: number, batch?: number }): { matched: Array<[string, unknown]>, timeField: string, batch: number } {
|
|
109
|
+
function checkRule(options: { fn: string, table: string, index: string, match?: Record<string, unknown>, ttl: number, batch?: number, schedule?: unknown }): { matched: Array<[string, unknown]>, timeField: string, batch: number } {
|
|
85
110
|
const rule = `defineRetention (${options.fn})`
|
|
111
|
+
if (options.schedule !== undefined) checkSchedule(rule, options.schedule)
|
|
86
112
|
if (!/^[\w./-]+:\w+$/.test(options.fn)) {
|
|
87
113
|
throw new TypeError(`[nuxt-backend] ${rule}: "fn" is the rule's own function path as \`npx convex run\` takes it, such as 'retention:pruneDrafts'.`)
|
|
88
114
|
}
|
|
@@ -107,8 +133,9 @@ function checkRule(options: { fn: string, table: string, index: string, match?:
|
|
|
107
133
|
/**
|
|
108
134
|
* Delete a table's rows once they pass an age, a batch per transaction,
|
|
109
135
|
* until none is left. Returns the rule's internal mutation: export it from
|
|
110
|
-
* a file in `backend/`, and
|
|
111
|
-
*
|
|
136
|
+
* a file in `backend/`, and give it a `schedule` that
|
|
137
|
+
* {@link scheduleRetention} starts from `backend/crons.ts` (or start it
|
|
138
|
+
* from a cron of your own: `crons.cron(..., internal.retention.pruneDrafts, {})`).
|
|
112
139
|
*
|
|
113
140
|
* A pass fixes its cutoff when it starts (the current time minus `ttl`), so
|
|
114
141
|
* it always ends: each batch reads up to `batch` rows older than the cutoff
|
|
@@ -130,7 +157,7 @@ function checkRule(options: { fn: string, table: string, index: string, match?:
|
|
|
130
157
|
* @guarantee Rows are read through an index, never scanned, so a batch reads at most `batch + 1` rows.
|
|
131
158
|
* @guarantee A row whose time field is missing sorts first and is deleted on the first pass.
|
|
132
159
|
*
|
|
133
|
-
* @throws TypeError when `fn`, `ttl`, `batch` or `
|
|
160
|
+
* @throws TypeError when `fn`, `ttl`, `batch`, `index` or `schedule` is malformed, as the module loads.
|
|
134
161
|
*
|
|
135
162
|
* @example
|
|
136
163
|
* ```ts
|
|
@@ -145,6 +172,7 @@ function checkRule(options: { fn: string, table: string, index: string, match?:
|
|
|
145
172
|
* index: 'by_status_and_updatedAt',
|
|
146
173
|
* match: { status: 'draft' },
|
|
147
174
|
* ttl: 30 * DAY,
|
|
175
|
+
* schedule: { cron: '20 3 * * *' },
|
|
148
176
|
* })
|
|
149
177
|
* ```
|
|
150
178
|
*/
|
|
@@ -166,7 +194,7 @@ export function defineRetention<
|
|
|
166
194
|
handler: (ctx: GenericMutationCtx<DM>, args: RetentionArgs) => Promise<RetentionResult>
|
|
167
195
|
}) => RegisteredMutation<'internal', RetentionArgs, Promise<RetentionResult>>
|
|
168
196
|
|
|
169
|
-
|
|
197
|
+
const mutation = define({
|
|
170
198
|
args: { now: v.optional(v.number()) },
|
|
171
199
|
returns: v.object({ deleted: v.number(), more: v.boolean() }),
|
|
172
200
|
handler: async (ctx, { now = Date.now() }) => {
|
|
@@ -193,4 +221,44 @@ export function defineRetention<
|
|
|
193
221
|
return { deleted: rows.length, more }
|
|
194
222
|
},
|
|
195
223
|
})
|
|
224
|
+
if (options.schedule) schedules.set(mutation, { fn, schedule: options.schedule })
|
|
225
|
+
return mutation
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Start every retention rule that has a `schedule` from your
|
|
230
|
+
* `backend/crons.ts`: one cron each, named after the rule's `fn`. Pass the
|
|
231
|
+
* rules' module (`import * as retention from './retention'`) or an object
|
|
232
|
+
* of rules; anything else in it, and a rule with no `schedule`, is left out.
|
|
233
|
+
* A rule it schedules needs no cron of yours: one under another name is a
|
|
234
|
+
* second cron, and the rule runs twice.
|
|
235
|
+
*
|
|
236
|
+
* @guarantee Each rule runs on its own `schedule`, under its `fn` as the cron's name: renaming a rule renames its cron.
|
|
237
|
+
*
|
|
238
|
+
* @returns The `fn` of each rule it scheduled.
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```ts
|
|
242
|
+
* // backend/crons.ts
|
|
243
|
+
* import { cronJobs } from 'convex/server'
|
|
244
|
+
* import { scheduleRetention } from 'nuxt-backend/functions'
|
|
245
|
+
* import * as retention from './retention'
|
|
246
|
+
*
|
|
247
|
+
* const crons = cronJobs()
|
|
248
|
+
* scheduleRetention(crons, retention)
|
|
249
|
+
*
|
|
250
|
+
* export default crons
|
|
251
|
+
* ```
|
|
252
|
+
*/
|
|
253
|
+
export function scheduleRetention(crons: Crons, rules: Record<string, unknown>): string[] {
|
|
254
|
+
const scheduled: string[] = []
|
|
255
|
+
for (const rule of Object.values(rules)) {
|
|
256
|
+
const found = rule !== null && (typeof rule === 'object' || typeof rule === 'function') ? schedules.get(rule) : undefined
|
|
257
|
+
if (!found) continue
|
|
258
|
+
const ref = makeFunctionReference<'mutation', RetentionArgs>(found.fn)
|
|
259
|
+
if (found.schedule.cron !== undefined) crons.cron(found.fn, found.schedule.cron, ref, {})
|
|
260
|
+
else crons.interval(found.fn, found.schedule.every, ref, {})
|
|
261
|
+
scheduled.push(found.fn)
|
|
262
|
+
}
|
|
263
|
+
return scheduled
|
|
196
264
|
}
|