nuxt-backend 0.2.0 → 0.2.1
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/dist/chunks/catalog.mjs +1 -1
- package/dist/chunks/doctor.mjs +71 -12
- 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 +7 -5
- package/dist/cli.mjs +122 -23
- package/dist/convex/account-data.d.ts +0 -2
- package/dist/convex/account-data.d.ts.map +1 -1
- package/dist/convex/account-data.js +0 -4
- package/dist/convex/account-data.js.map +1 -1
- package/dist/convex/catalog.d.ts +22 -0
- 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/index.d.ts +34 -2
- package/dist/convex/client/index.d.ts.map +1 -1
- package/dist/convex/components/backend/_generated/component.d.ts +6 -0
- package/dist/convex/components/backend/_generated/component.d.ts.map +1 -1
- package/dist/convex/components/backend/account.d.ts +6 -6
- package/dist/convex/components/backend/account.d.ts.map +1 -1
- package/dist/convex/components/backend/account.js +6 -2
- package/dist/convex/components/backend/account.js.map +1 -1
- package/dist/convex/components/backend/adapter.d.ts.map +1 -1
- package/dist/convex/components/backend/adapter.js +4 -1
- 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.map +1 -1
- package/dist/convex/components/backend/billing.js +12 -32
- 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/gifts.d.ts +1 -1
- package/dist/convex/components/backend/gifts.d.ts.map +1 -1
- package/dist/convex/components/backend/gifts.js +9 -4
- package/dist/convex/components/backend/gifts.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/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 +151 -35
- package/dist/convex/components/backend/schema.d.ts.map +1 -1
- package/dist/convex/components/backend/schema.js +127 -153
- package/dist/convex/components/backend/schema.js.map +1 -1
- package/dist/convex/components/backend/storage.d.ts.map +1 -1
- package/dist/convex/components/backend/storage.js +10 -10
- package/dist/convex/components/backend/storage.js.map +1 -1
- package/dist/convex/components/backend/subscriptions.d.ts +3 -3
- package/dist/convex/components/backend/subscriptions.d.ts.map +1 -1
- package/dist/convex/components/backend/subscriptions.js +6 -35
- 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 +0 -1
- package/dist/convex/constants.d.ts.map +1 -1
- package/dist/convex/constants.js +0 -1
- package/dist/convex/constants.js.map +1 -1
- package/dist/convex/email-templates.d.ts +0 -1
- package/dist/convex/email-templates.d.ts.map +1 -1
- package/dist/convex/email-templates.js +0 -1
- package/dist/convex/email-templates.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/job-errors.d.ts +7 -0
- package/dist/convex/integrations/ai/job-errors.d.ts.map +1 -1
- package/dist/convex/integrations/ai/job-errors.js +22 -0
- package/dist/convex/integrations/ai/job-errors.js.map +1 -1
- package/dist/convex/integrations/ai/metering.d.ts +12 -0
- package/dist/convex/integrations/ai/metering.d.ts.map +1 -1
- package/dist/convex/integrations/ai/metering.js +19 -10
- package/dist/convex/integrations/ai/metering.js.map +1 -1
- package/dist/convex/integrations/ai/models.d.ts.map +1 -1
- package/dist/convex/integrations/ai/models.js +3 -1
- package/dist/convex/integrations/ai/models.js.map +1 -1
- package/dist/convex/integrations/ai/moderation.d.ts +2 -0
- package/dist/convex/integrations/ai/moderation.d.ts.map +1 -1
- package/dist/convex/integrations/ai/moderation.js +29 -2
- package/dist/convex/integrations/ai/moderation.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 +3 -11
- package/dist/convex/integrations/ai/stream.js.map +1 -1
- package/dist/convex/integrations/billing/context.d.ts +0 -1
- package/dist/convex/integrations/billing/context.d.ts.map +1 -1
- package/dist/convex/integrations/billing/context.js +1 -4
- package/dist/convex/integrations/billing/context.js.map +1 -1
- package/dist/convex/integrations/billing/credits.d.ts.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 +1 -1
- package/dist/convex/integrations/billing/free-plan.d.ts.map +1 -1
- package/dist/convex/integrations/billing/free-plan.js +18 -4
- package/dist/convex/integrations/billing/free-plan.js.map +1 -1
- package/dist/convex/integrations/billing/functions.d.ts +5 -1
- package/dist/convex/integrations/billing/functions.d.ts.map +1 -1
- package/dist/convex/integrations/billing/functions.js +16 -5
- package/dist/convex/integrations/billing/functions.js.map +1 -1
- package/dist/convex/integrations/billing/gifts.d.ts.map +1 -1
- package/dist/convex/integrations/billing/gifts.js +2 -2
- 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 +4 -1
- package/dist/convex/integrations/billing/lifecycle.d.ts.map +1 -1
- package/dist/convex/integrations/billing/lifecycle.js +33 -2
- 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 +2 -3
- package/dist/convex/integrations/billing/passes.js.map +1 -1
- package/dist/convex/integrations/billing/pricing.d.ts +4 -1
- package/dist/convex/integrations/billing/pricing.d.ts.map +1 -1
- package/dist/convex/integrations/billing/pricing.js +11 -9
- 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/subscriptions.d.ts.map +1 -1
- package/dist/convex/integrations/billing/types/lifecycle.d.ts +12 -0
- 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 +7 -1
- package/dist/convex/integrations/billing/types/records.d.ts.map +1 -1
- package/dist/convex/integrations/billing/types/surface.d.ts +5 -1
- package/dist/convex/integrations/billing/types/surface.d.ts.map +1 -1
- package/dist/convex/integrations/billing.d.ts +2 -2
- package/dist/convex/integrations/billing.d.ts.map +1 -1
- package/dist/convex/integrations/billing.js +1 -0
- 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/notifications.d.ts +24 -4
- package/dist/convex/integrations/notifications.d.ts.map +1 -1
- package/dist/convex/integrations/notifications.js +30 -14
- package/dist/convex/integrations/notifications.js.map +1 -1
- package/dist/convex/integrations/rate-limit.d.ts +6 -5
- package/dist/convex/integrations/rate-limit.d.ts.map +1 -1
- package/dist/convex/integrations/rate-limit.js +6 -5
- package/dist/convex/integrations/rate-limit.js.map +1 -1
- package/dist/convex/integrations/reports.d.ts +1 -1
- package/dist/convex/integrations/reports.d.ts.map +1 -1
- package/dist/convex/integrations/reports.js +0 -11
- package/dist/convex/integrations/reports.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-groups/cancelFlow.d.ts +3 -0
- package/dist/convex/label-groups/cancelFlow.d.ts.map +1 -1
- package/dist/convex/label-groups/cancelFlow.js +5 -0
- 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/notifications.d.ts +19 -2
- package/dist/convex/label-groups/notifications.d.ts.map +1 -1
- package/dist/convex/label-groups/notifications.js +19 -15
- package/dist/convex/label-groups/notifications.js.map +1 -1
- package/dist/convex/label-groups/pricing.js +8 -8
- package/dist/convex/label-groups/pricing.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/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-translations.d.ts.map +1 -1
- package/dist/convex/label-translations.js +52 -0
- package/dist/convex/label-translations.js.map +1 -1
- package/dist/convex/labels.d.ts +23 -0
- package/dist/convex/labels.d.ts.map +1 -1
- package/dist/convex/log.js +2 -0
- package/dist/convex/log.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/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/index.html +1 -1
- package/dist/module.js +2 -2
- package/dist/module.json +1 -1
- package/dist/runtime/locales/de.json +47 -24
- package/dist/runtime/locales/en.json +47 -24
- package/dist/runtime/locales/es.json +47 -24
- package/dist/runtime/locales/fr.json +47 -24
- package/dist/runtime/locales/ru.json +47 -24
- package/dist/runtime/server/protection/gate.d.ts +4 -2
- package/dist/runtime/server/protection/gate.js +14 -4
- 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 +16 -11
- package/dist/runtime/vue/auth-client.js +3 -1
- package/dist/runtime/vue/components/admin/AdminUsers.d.vue.ts +1 -1
- package/dist/runtime/vue/components/admin/AdminUsers.vue.d.ts +1 -1
- package/dist/runtime/vue/components/billing/BillingCheckoutLink.d.vue.ts +1 -1
- package/dist/runtime/vue/components/billing/BillingCheckoutLink.vue.d.ts +1 -1
- 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 +10 -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/CancelFlowQuestion.vue +2 -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.vue +6 -3
- package/dist/runtime/vue/components/billing/PricingPlanCard.vue +3 -1
- package/dist/runtime/vue/components/billing/PricingTable.d.vue.ts +2 -2
- package/dist/runtime/vue/components/billing/PricingTable.vue +3 -1
- package/dist/runtime/vue/components/billing/PricingTable.vue.d.ts +2 -2
- package/dist/runtime/vue/components/billing/UsageHistoryEvent.vue +3 -1
- 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/shell/NoticeLowCredits.vue +3 -1
- package/dist/runtime/vue/components/tokens.css +1 -1
- package/dist/runtime/vue/components/workspaces/WorkspaceCredits.vue +6 -3
- package/dist/runtime/vue/components/workspaces/WorkspaceSettings.d.vue.ts +2 -2
- package/dist/runtime/vue/components/workspaces/WorkspaceSettings.vue.d.ts +2 -2
- 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 +10 -2
- 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-notifications.d.ts +5 -1
- package/dist/runtime/vue/composables/use-notifications.js +12 -4
- 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/parts.d.ts +2 -1
- package/dist/runtime/vue/plugins/checkout-return.d.ts +3 -2
- package/dist/runtime/vue/plugins/checkout-return.js +2 -4
- package/dist/runtime/vue/plugins/first-touch.js +2 -4
- package/dist/runtime/vue/utils/checkout-return.d.ts +9 -2
- package/dist/runtime/vue/utils/checkout-return.js +2 -1
- 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/meter-unit.d.ts +14 -0
- package/dist/runtime/vue/utils/meter-unit.js +18 -0
- package/dist/shared/{nuxt-backend.2YoiKo8j.mjs → nuxt-backend.2m535CLS.mjs} +6 -2
- package/dist/shared/{nuxt-backend.CPq101Wi.mjs → nuxt-backend.DXEf0rrv.mjs} +1 -1
- package/dist/shared/{nuxt-backend.-uB5CGw-.mjs → nuxt-backend.Dm1NkY7v.mjs} +1 -1
- package/dist/shared/{nuxt-backend.OQMX-0U7.mjs → nuxt-backend.KEzfHO2K.mjs} +6 -3
- package/dist/shared/{nuxt-backend.S5C2b-4I.mjs → nuxt-backend.ikObmtHs.mjs} +2 -2
- package/package.json +2 -2
- package/skills/nuxt-backend/references/api.md +13 -3
- package/skills/nuxt-backend/references/surface.json +12 -0
- package/skills/nuxt-backend-auth/SKILL.md +2 -1
- package/skills/nuxt-backend-billing/SKILL.md +7 -0
- package/skills/nuxt-backend-billing/references/api.md +12 -2
- package/skills/nuxt-backend-data/SKILL.md +4 -1
- package/skills/nuxt-backend-email/SKILL.md +4 -0
- package/skills/nuxt-backend-email/references/api.md +1 -1
- package/skills/nuxt-backend-ui/SKILL.md +6 -5
- package/src/convex/account-data.ts +0 -5
- package/src/convex/catalog.ts +23 -0
- package/src/convex/client/better-auth-options.ts +11 -1
- package/src/convex/client/client-address.ts +37 -0
- package/src/convex/components/backend/_generated/component.ts +12 -0
- package/src/convex/components/backend/account.ts +7 -2
- package/src/convex/components/backend/adapter.ts +4 -1
- package/src/convex/components/backend/ai.ts +20 -54
- package/src/convex/components/backend/billing.ts +14 -33
- package/src/convex/components/backend/consents.ts +2 -1
- package/src/convex/components/backend/gifts.ts +11 -5
- package/src/convex/components/backend/lifecycle.ts +17 -12
- 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 +143 -161
- package/src/convex/components/backend/storage.ts +11 -10
- package/src/convex/components/backend/subscriptions.ts +7 -35
- package/src/convex/components/backend/webhooks.ts +1 -10
- package/src/convex/consent-rules.ts +0 -3
- package/src/convex/constants.ts +0 -1
- package/src/convex/email-templates.ts +0 -1
- package/src/convex/integrations/admin.ts +2 -1
- package/src/convex/integrations/ai/job-errors.ts +21 -0
- package/src/convex/integrations/ai/metering.ts +24 -10
- package/src/convex/integrations/ai/models.ts +3 -1
- package/src/convex/integrations/ai/moderation.ts +31 -2
- package/src/convex/integrations/ai/stream.ts +3 -11
- package/src/convex/integrations/billing/context.ts +1 -9
- package/src/convex/integrations/billing/customers.ts +28 -5
- package/src/convex/integrations/billing/free-plan.ts +20 -5
- package/src/convex/integrations/billing/functions.ts +17 -5
- package/src/convex/integrations/billing/gifts.ts +2 -2
- package/src/convex/integrations/billing/history.ts +2 -1
- package/src/convex/integrations/billing/lifecycle.ts +30 -3
- package/src/convex/integrations/billing/passes.ts +2 -4
- package/src/convex/integrations/billing/pricing.ts +14 -10
- package/src/convex/integrations/billing/purchase.ts +1 -2
- package/src/convex/integrations/billing/types/lifecycle.ts +13 -0
- package/src/convex/integrations/billing/types/options.ts +4 -1
- package/src/convex/integrations/billing/types/records.ts +7 -1
- package/src/convex/integrations/billing/types/surface.ts +3 -1
- package/src/convex/integrations/billing.ts +3 -2
- package/src/convex/integrations/email-preferences.ts +1 -1
- package/src/convex/integrations/email-sync.ts +44 -1
- package/src/convex/integrations/notifications.ts +65 -16
- package/src/convex/integrations/rate-limit.ts +6 -5
- package/src/convex/integrations/reports.ts +1 -1
- package/src/convex/integrations/webhooks.ts +1 -4
- package/src/convex/label-groups/cancelFlow.ts +5 -0
- package/src/convex/label-groups/credits.ts +17 -2
- package/src/convex/label-groups/notifications.ts +19 -15
- package/src/convex/label-groups/pricing.ts +8 -8
- package/src/convex/label-groups/settings.ts +4 -3
- package/src/convex/label-groups/usage.ts +2 -2
- package/src/convex/label-translations.ts +52 -0
- package/src/convex/log.ts +2 -0
- 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/waitlist-rules.ts +2 -22
- package/src/runtime/vue/components/billing/CancelFlow.css +16 -0
- package/src/runtime/vue/components/billing/CancelFlow.vue +16 -6
- package/src/runtime/vue/components/billing/CancelFlowConfirm.vue +35 -0
- package/src/runtime/vue/components/billing/CancelFlowQuestion.vue +8 -2
- package/src/runtime/vue/components/billing/PricingPackCard.vue +6 -3
- package/src/runtime/vue/components/billing/PricingPlanCard.vue +3 -1
- package/src/runtime/vue/components/billing/PricingTable.vue +3 -1
- package/src/runtime/vue/components/billing/UsageHistoryEvent.vue +3 -1
- package/src/runtime/vue/components/shell/NoticeLowCredits.vue +3 -1
- package/src/runtime/vue/components/tokens.css +19 -15
- package/src/runtime/vue/components/workspaces/WorkspaceCredits.vue +6 -3
|
@@ -262,51 +262,93 @@ export const vPendingSpend = v.object({
|
|
|
262
262
|
* recipient — identified by email — receives. Created at gift checkout, marked
|
|
263
263
|
* `paid` by the billing webhook, and `claimed` once the entitlement is attached
|
|
264
264
|
* to the recipient's billing entity (automatically when the recipient already
|
|
265
|
-
* has an account, otherwise on their first sign-in).
|
|
265
|
+
* has an account, otherwise on their first sign-in). The `billingGifts` row.
|
|
266
266
|
*/
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
const vGiftRow = v.object({
|
|
268
|
+
// Stored lowercased; matched case-insensitively against the claimant's email.
|
|
269
269
|
recipientEmail: v.string(),
|
|
270
270
|
purchaserUserId: v.string(),
|
|
271
271
|
purchaserEmail: v.optional(v.string()),
|
|
272
272
|
purchaserName: v.optional(v.string()),
|
|
273
|
+
// The credit pack the recipient receives: its provider product.
|
|
273
274
|
productIds: v.array(v.string()),
|
|
275
|
+
// Plain text, shown only inside the app once the recipient signs in.
|
|
274
276
|
message: v.optional(v.string()),
|
|
277
|
+
// 'pending' (checkout created) → 'paid' (the purchase order is paid and
|
|
278
|
+
// its claim discount minted) → 'claimed' (the recipient's $0 order is
|
|
279
|
+
// paid), or 'refunded' (the purchase was refunded before the claim).
|
|
275
280
|
status: v.string(),
|
|
281
|
+
// Before 0.2: the provider customer keyed by the recipient's email,
|
|
282
|
+
// which the purchase was billed to. Gifts are billed to the purchaser now.
|
|
276
283
|
billingCustomerId: v.optional(v.string()),
|
|
284
|
+
// The purchase order, paid by the purchaser's own billing entity.
|
|
277
285
|
billingOrderId: v.optional(v.string()),
|
|
278
286
|
purchaserEntityId: v.optional(v.string()),
|
|
287
|
+
// The pack's catalog key, and the private gift product the purchaser bought.
|
|
279
288
|
pack: v.optional(v.string()),
|
|
280
289
|
giftProductId: v.optional(v.string()),
|
|
290
|
+
// What the purchase order charged, in the currency's smallest unit.
|
|
281
291
|
amount: v.optional(v.number()),
|
|
282
292
|
currency: v.optional(v.string()),
|
|
293
|
+
// The single-use 100% discount the recipient claims the pack with.
|
|
283
294
|
discountId: v.optional(v.string()),
|
|
295
|
+
// The claim checkout in flight: who opened it, for which entity. A plan
|
|
296
|
+
// pass's claim holds the gift until `claimingUntil`, while it switches the
|
|
297
|
+
// workspace at the provider.
|
|
284
298
|
claimingEntityId: v.optional(v.string()),
|
|
285
299
|
claimingUserId: v.optional(v.string()),
|
|
300
|
+
claimingUntil: v.optional(v.number()),
|
|
301
|
+
// The purchaser's cancellation in flight, until then: no claim starts meanwhile.
|
|
302
|
+
cancelingUntil: v.optional(v.number()),
|
|
286
303
|
claimOrderId: v.optional(v.string()),
|
|
287
304
|
claimedByUserId: v.optional(v.string()),
|
|
305
|
+
// The entity the credits landed on: workspace id or user id.
|
|
288
306
|
claimedEntityId: v.optional(v.string()),
|
|
289
307
|
createdAt: v.number(),
|
|
290
308
|
paidAt: v.optional(v.number()),
|
|
291
309
|
notifiedAt: v.optional(v.number()),
|
|
292
310
|
claimedAt: v.optional(v.number()),
|
|
293
311
|
refundedAt: v.optional(v.number()),
|
|
312
|
+
// A plan pass (the gift is a plan for `months` months, not a pack): the
|
|
313
|
+
// plan's catalog key and the length the purchaser paid for.
|
|
294
314
|
plan: v.optional(v.string()),
|
|
295
315
|
months: v.optional(v.number()),
|
|
316
|
+
// When the notice goes out: set when the purchase is paid (the moment
|
|
317
|
+
// it is paid, or the date the purchaser chose). The gift is the
|
|
318
|
+
// recipient's to see and claim once `deliveredAt` is stamped; a row
|
|
319
|
+
// with neither is a gift paid before delivery dates, delivered when paid.
|
|
296
320
|
deliverAt: v.optional(v.number()),
|
|
297
321
|
deliveredAt: v.optional(v.number()),
|
|
322
|
+
// The last notice sent (the first, a reminder or a resend), and how many.
|
|
298
323
|
noticedAt: v.optional(v.number()),
|
|
299
324
|
noticeCount: v.optional(v.number()),
|
|
325
|
+
// How many times the purchaser changed the address: each address's notices carry their own idempotency keys.
|
|
300
326
|
recipientChanges: v.optional(v.number()),
|
|
327
|
+
// The one reminder, a week after delivery.
|
|
301
328
|
remindedAt: v.optional(v.number()),
|
|
329
|
+
// A pass once claimed: the free subscription it switched, when it began
|
|
330
|
+
// and ends (the package keeps the end date), the scheduled return to the
|
|
331
|
+
// free plan, the ending notice and the end itself.
|
|
302
332
|
passSubscriptionId: v.optional(v.string()),
|
|
303
333
|
passStartedAt: v.optional(v.number()),
|
|
304
334
|
passEndsAt: v.optional(v.number()),
|
|
335
|
+
// From when the return may be booked: once the pass's last billing cycle began.
|
|
336
|
+
passReturnFrom: v.optional(v.number()),
|
|
305
337
|
passReturnScheduledAt: v.optional(v.number()),
|
|
306
338
|
passNoticedAt: v.optional(v.number()),
|
|
307
339
|
passEndedAt: v.optional(v.number()),
|
|
340
|
+
// A reverse trial (LIFECYCLE): the pass a new workspace started on,
|
|
341
|
+
// with no purchaser (`status` 'trial'). `recipientEmail` holds its
|
|
342
|
+
// owner's address with plus tags and dots taken out, so an address
|
|
343
|
+
// starts one.
|
|
308
344
|
reverseTrial: v.optional(v.boolean()),
|
|
345
|
+
// A referral reward (REF): the pass a referrer on the free plan got for
|
|
346
|
+
// free months, with no purchaser (`status` 'reward'). `rewardId` is the
|
|
347
|
+
// referral it came from; `recipientEmail` is empty.
|
|
348
|
+
rewardId: v.optional(v.string()),
|
|
309
349
|
});
|
|
350
|
+
/** A gift as the component's reads return it: its id, without the claim and cancel holds or the reward it came from. */
|
|
351
|
+
export const vGift = vGiftRow.omit('claimingUntil', 'cancelingUntil', 'passReturnFrom', 'rewardId').extend({ id: v.string() });
|
|
310
352
|
/** A save offer's terms, as the cancel flow made it (LIFECYCLE). */
|
|
311
353
|
export const vSaveOfferTerms = v.object({
|
|
312
354
|
kind: v.union(v.literal('pause'), v.literal('downgrade'), v.literal('discount')),
|
|
@@ -316,6 +358,21 @@ export const vSaveOfferTerms = v.object({
|
|
|
316
358
|
productId: v.optional(v.string()),
|
|
317
359
|
discount: v.optional(v.string()),
|
|
318
360
|
});
|
|
361
|
+
/** A renewing checkout's consent proof, as the `billingRenewalConsents` table stores it. */
|
|
362
|
+
export const vRenewalConsent = v.object({
|
|
363
|
+
checkoutId: v.string(),
|
|
364
|
+
entityId: v.string(),
|
|
365
|
+
userId: v.optional(v.string()),
|
|
366
|
+
productId: v.string(),
|
|
367
|
+
amount: v.number(),
|
|
368
|
+
currency: v.string(),
|
|
369
|
+
interval: v.string(),
|
|
370
|
+
intervalCount: v.number(),
|
|
371
|
+
termsVersion: v.optional(v.string()),
|
|
372
|
+
createdAt: v.number(),
|
|
373
|
+
subscriptionId: v.optional(v.string()),
|
|
374
|
+
consentedAt: v.optional(v.number()),
|
|
375
|
+
});
|
|
319
376
|
export const billingTables = {
|
|
320
377
|
billingEntitlements: defineTable({
|
|
321
378
|
// The billing entity id — the workspace id (billTo: 'workspace', the
|
|
@@ -404,89 +461,7 @@ export const billingTables = {
|
|
|
404
461
|
})
|
|
405
462
|
.index('entityId', ['entityId'])
|
|
406
463
|
.index('at', ['at']),
|
|
407
|
-
billingGifts: defineTable(
|
|
408
|
-
// Stored lowercased; matched case-insensitively against the claimant's email.
|
|
409
|
-
recipientEmail: v.string(),
|
|
410
|
-
purchaserUserId: v.string(),
|
|
411
|
-
purchaserEmail: v.optional(v.string()),
|
|
412
|
-
purchaserName: v.optional(v.string()),
|
|
413
|
-
// The credit pack the recipient receives: its provider product.
|
|
414
|
-
productIds: v.array(v.string()),
|
|
415
|
-
// Plain text, shown only inside the app once the recipient signs in.
|
|
416
|
-
message: v.optional(v.string()),
|
|
417
|
-
// 'pending' (checkout created) → 'paid' (the purchase order is paid and
|
|
418
|
-
// its claim discount minted) → 'claimed' (the recipient's $0 order is
|
|
419
|
-
// paid), or 'refunded' (the purchase was refunded before the claim).
|
|
420
|
-
status: v.string(),
|
|
421
|
-
// Before 0.2: the provider customer keyed by the recipient's email,
|
|
422
|
-
// which the purchase was billed to. Gifts are billed to the purchaser now.
|
|
423
|
-
billingCustomerId: v.optional(v.string()),
|
|
424
|
-
// The purchase order, paid by the purchaser's own billing entity.
|
|
425
|
-
billingOrderId: v.optional(v.string()),
|
|
426
|
-
purchaserEntityId: v.optional(v.string()),
|
|
427
|
-
// The pack's catalog key, and the private gift product the purchaser bought.
|
|
428
|
-
pack: v.optional(v.string()),
|
|
429
|
-
giftProductId: v.optional(v.string()),
|
|
430
|
-
// What the purchase order charged, in the currency's smallest unit.
|
|
431
|
-
amount: v.optional(v.number()),
|
|
432
|
-
currency: v.optional(v.string()),
|
|
433
|
-
// The single-use 100% discount the recipient claims the pack with.
|
|
434
|
-
discountId: v.optional(v.string()),
|
|
435
|
-
// The claim checkout in flight: who opened it, for which entity. A plan
|
|
436
|
-
// pass's claim holds the gift until `claimingUntil`, while it switches the
|
|
437
|
-
// workspace at the provider.
|
|
438
|
-
claimingEntityId: v.optional(v.string()),
|
|
439
|
-
claimingUserId: v.optional(v.string()),
|
|
440
|
-
claimingUntil: v.optional(v.number()),
|
|
441
|
-
// The purchaser's cancellation in flight, until then: no claim starts meanwhile.
|
|
442
|
-
cancelingUntil: v.optional(v.number()),
|
|
443
|
-
claimOrderId: v.optional(v.string()),
|
|
444
|
-
claimedByUserId: v.optional(v.string()),
|
|
445
|
-
// The entity the credits landed on: workspace id or user id.
|
|
446
|
-
claimedEntityId: v.optional(v.string()),
|
|
447
|
-
createdAt: v.number(),
|
|
448
|
-
paidAt: v.optional(v.number()),
|
|
449
|
-
notifiedAt: v.optional(v.number()),
|
|
450
|
-
claimedAt: v.optional(v.number()),
|
|
451
|
-
refundedAt: v.optional(v.number()),
|
|
452
|
-
// A plan pass (the gift is a plan for `months` months, not a pack): the
|
|
453
|
-
// plan's catalog key and the length the purchaser paid for.
|
|
454
|
-
plan: v.optional(v.string()),
|
|
455
|
-
months: v.optional(v.number()),
|
|
456
|
-
// When the notice goes out: set when the purchase is paid (the moment
|
|
457
|
-
// it is paid, or the date the purchaser chose). The gift is the
|
|
458
|
-
// recipient's to see and claim once `deliveredAt` is stamped; a row
|
|
459
|
-
// with neither is a gift paid before delivery dates, delivered when paid.
|
|
460
|
-
deliverAt: v.optional(v.number()),
|
|
461
|
-
deliveredAt: v.optional(v.number()),
|
|
462
|
-
// The last notice sent (the first, a reminder or a resend), and how many.
|
|
463
|
-
noticedAt: v.optional(v.number()),
|
|
464
|
-
noticeCount: v.optional(v.number()),
|
|
465
|
-
// How many times the purchaser changed the address: each address's notices carry their own idempotency keys.
|
|
466
|
-
recipientChanges: v.optional(v.number()),
|
|
467
|
-
// The one reminder, a week after delivery.
|
|
468
|
-
remindedAt: v.optional(v.number()),
|
|
469
|
-
// A pass once claimed: the free subscription it switched, when it began
|
|
470
|
-
// and ends (the package keeps the end date), the scheduled return to the
|
|
471
|
-
// free plan, the ending notice and the end itself.
|
|
472
|
-
passSubscriptionId: v.optional(v.string()),
|
|
473
|
-
passStartedAt: v.optional(v.number()),
|
|
474
|
-
passEndsAt: v.optional(v.number()),
|
|
475
|
-
// From when the return may be booked: once the pass's last billing cycle began.
|
|
476
|
-
passReturnFrom: v.optional(v.number()),
|
|
477
|
-
passReturnScheduledAt: v.optional(v.number()),
|
|
478
|
-
passNoticedAt: v.optional(v.number()),
|
|
479
|
-
passEndedAt: v.optional(v.number()),
|
|
480
|
-
// A reverse trial (LIFECYCLE): the pass a new workspace started on,
|
|
481
|
-
// with no purchaser (`status` 'trial'). `recipientEmail` holds its
|
|
482
|
-
// owner's address with plus tags and dots taken out, so an address
|
|
483
|
-
// starts one.
|
|
484
|
-
reverseTrial: v.optional(v.boolean()),
|
|
485
|
-
// A referral reward (REF): the pass a referrer on the free plan got for
|
|
486
|
-
// free months, with no purchaser (`status` 'reward'). `rewardId` is the
|
|
487
|
-
// referral it came from; `recipientEmail` is empty.
|
|
488
|
-
rewardId: v.optional(v.string()),
|
|
489
|
-
})
|
|
464
|
+
billingGifts: defineTable(vGiftRow)
|
|
490
465
|
.index('recipientEmail', ['recipientEmail'])
|
|
491
466
|
.index('recipientEmail_status', ['recipientEmail', 'status'])
|
|
492
467
|
.index('recipientEmail_createdAt', ['recipientEmail', 'createdAt'])
|
|
@@ -533,20 +508,7 @@ export const billingTables = {
|
|
|
533
508
|
// (what it showed: the plan, the price and its interval, the terms
|
|
534
509
|
// version, who), confirmed when the subscription it started arrives, and
|
|
535
510
|
// deleted three years after. An unconfirmed row goes after two days.
|
|
536
|
-
billingRenewalConsents: defineTable(
|
|
537
|
-
checkoutId: v.string(),
|
|
538
|
-
entityId: v.string(),
|
|
539
|
-
userId: v.optional(v.string()),
|
|
540
|
-
productId: v.string(),
|
|
541
|
-
amount: v.number(),
|
|
542
|
-
currency: v.string(),
|
|
543
|
-
interval: v.string(),
|
|
544
|
-
intervalCount: v.number(),
|
|
545
|
-
termsVersion: v.optional(v.string()),
|
|
546
|
-
createdAt: v.number(),
|
|
547
|
-
subscriptionId: v.optional(v.string()),
|
|
548
|
-
consentedAt: v.optional(v.number()),
|
|
549
|
-
})
|
|
511
|
+
billingRenewalConsents: defineTable(vRenewalConsent)
|
|
550
512
|
.index('checkoutId', ['checkoutId'])
|
|
551
513
|
.index('entityId', ['entityId'])
|
|
552
514
|
.index('userId', ['userId'])
|
|
@@ -576,6 +538,42 @@ export const billingTables = {
|
|
|
576
538
|
.index('userId', ['userId'])
|
|
577
539
|
.index('at', ['at']),
|
|
578
540
|
};
|
|
541
|
+
/** A metered stream's request, as the `aiRequests` table stores it. */
|
|
542
|
+
export const vAiRequest = v.object({
|
|
543
|
+
streamId: v.string(),
|
|
544
|
+
/** Which `ai.stream({ name })` definition drives this request. */
|
|
545
|
+
name: v.string(),
|
|
546
|
+
/** The billing entity (workspace/user) the credits reserve against. */
|
|
547
|
+
entityId: v.string(),
|
|
548
|
+
/** The signed-in caller (for member attribution inside workspaces). */
|
|
549
|
+
userId: v.string(),
|
|
550
|
+
/** JSON-encoded handler args. */
|
|
551
|
+
args: v.string(),
|
|
552
|
+
meterId: v.optional(v.string()),
|
|
553
|
+
cost: v.number(),
|
|
554
|
+
externalId: v.string(),
|
|
555
|
+
status: v.union(v.literal('reserved'), v.literal('streaming'), v.literal('settled'), v.literal('released')),
|
|
556
|
+
createdAt: v.number(),
|
|
557
|
+
});
|
|
558
|
+
/** A knowledge document, as the `aiDocuments` table stores it. */
|
|
559
|
+
export const vAiDocument = v.object({
|
|
560
|
+
/** The knowledge store: its embedding model and dimension. */
|
|
561
|
+
store: v.string(),
|
|
562
|
+
/** The namespace: the billing entity whose members find it, or `app`. */
|
|
563
|
+
owner: v.string(),
|
|
564
|
+
/** The member who added it; empty for the app's own. */
|
|
565
|
+
addedBy: v.string(),
|
|
566
|
+
title: v.string(),
|
|
567
|
+
key: v.optional(v.string()),
|
|
568
|
+
status: v.union(v.literal('pending'), v.literal('ready'), v.literal('failed')),
|
|
569
|
+
entryId: v.optional(v.string()),
|
|
570
|
+
characters: v.number(),
|
|
571
|
+
createdAt: v.number(),
|
|
572
|
+
remove: v.string(),
|
|
573
|
+
read: v.string(),
|
|
574
|
+
namespaces: v.optional(v.string()),
|
|
575
|
+
removeNamespace: v.optional(v.string()),
|
|
576
|
+
});
|
|
579
577
|
/**
|
|
580
578
|
* Metered-stream request plumbing for `setupAi().stream` — the HTTP stream
|
|
581
579
|
* endpoint can't carry Convex args, so `start` records the request (args,
|
|
@@ -587,22 +585,7 @@ export const billingTables = {
|
|
|
587
585
|
* prune.
|
|
588
586
|
*/
|
|
589
587
|
export const aiTables = {
|
|
590
|
-
aiRequests: defineTable(
|
|
591
|
-
streamId: v.string(),
|
|
592
|
-
/** Which `ai.stream({ name })` definition drives this request. */
|
|
593
|
-
name: v.string(),
|
|
594
|
-
/** The billing entity (workspace/user) the credits reserve against. */
|
|
595
|
-
entityId: v.string(),
|
|
596
|
-
/** The signed-in caller (for member attribution inside workspaces). */
|
|
597
|
-
userId: v.string(),
|
|
598
|
-
/** JSON-encoded handler args. */
|
|
599
|
-
args: v.string(),
|
|
600
|
-
meterId: v.optional(v.string()),
|
|
601
|
-
cost: v.number(),
|
|
602
|
-
externalId: v.string(),
|
|
603
|
-
status: v.union(v.literal('reserved'), v.literal('streaming'), v.literal('settled'), v.literal('released')),
|
|
604
|
-
createdAt: v.number(),
|
|
605
|
-
})
|
|
588
|
+
aiRequests: defineTable(vAiRequest)
|
|
606
589
|
.index('streamId', ['streamId'])
|
|
607
590
|
// Maintenance: finished requests past their window.
|
|
608
591
|
.index('status_createdAt', ['status', 'createdAt'])
|
|
@@ -641,24 +624,7 @@ export const aiTables = {
|
|
|
641
624
|
* `namespaces` and `removeNamespace` find its owner's namespace there
|
|
642
625
|
* and delete it, passages and all, when the owner goes.
|
|
643
626
|
*/
|
|
644
|
-
aiDocuments: defineTable(
|
|
645
|
-
/** The knowledge store: its embedding model and dimension. */
|
|
646
|
-
store: v.string(),
|
|
647
|
-
/** The namespace: the billing entity whose members find it, or `app`. */
|
|
648
|
-
owner: v.string(),
|
|
649
|
-
/** The member who added it; empty for the app's own. */
|
|
650
|
-
addedBy: v.string(),
|
|
651
|
-
title: v.string(),
|
|
652
|
-
key: v.optional(v.string()),
|
|
653
|
-
status: v.union(v.literal('pending'), v.literal('ready'), v.literal('failed')),
|
|
654
|
-
entryId: v.optional(v.string()),
|
|
655
|
-
characters: v.number(),
|
|
656
|
-
createdAt: v.number(),
|
|
657
|
-
remove: v.string(),
|
|
658
|
-
read: v.string(),
|
|
659
|
-
namespaces: v.optional(v.string()),
|
|
660
|
-
removeNamespace: v.optional(v.string()),
|
|
661
|
-
})
|
|
627
|
+
aiDocuments: defineTable(vAiDocument)
|
|
662
628
|
.index('store_owner_createdAt', ['store', 'owner', 'createdAt'])
|
|
663
629
|
.index('store_owner_key', ['store', 'owner', 'key'])
|
|
664
630
|
.index('owner', ['owner'])
|
|
@@ -728,6 +694,8 @@ export const aiTables = {
|
|
|
728
694
|
})
|
|
729
695
|
.index('by_day_and_shard', ['day', 'shard']),
|
|
730
696
|
};
|
|
697
|
+
/** How a webhook delivery ended, as the delivery log records it. */
|
|
698
|
+
export const vDeliveryOutcome = v.union(v.literal('ok'), v.literal('invalid_signature'), v.literal('unknown_type'), v.literal('handler_error'), v.literal('duplicate'), v.literal('oversized'), v.literal('missing_secret'));
|
|
731
699
|
/**
|
|
732
700
|
* The webhook delivery log (see `webhooks.ts`) — powers redelivery dedupe and
|
|
733
701
|
* the DevTools Webhooks page, never a source of truth. A delivery whose
|
|
@@ -743,7 +711,7 @@ export const webhookTables = {
|
|
|
743
711
|
type: v.optional(v.string()),
|
|
744
712
|
// The tallied outcomes stay in the union for rows written before they
|
|
745
713
|
// were tallied; the trim ages them out with the rest.
|
|
746
|
-
outcome:
|
|
714
|
+
outcome: vDeliveryOutcome,
|
|
747
715
|
note: v.optional(v.string()),
|
|
748
716
|
receivedAt: v.number(),
|
|
749
717
|
/** When an administrator last asked the provider to send this delivery again (`replayWebhookDelivery`). */
|
|
@@ -1166,6 +1134,10 @@ export const storageTables = {
|
|
|
1166
1134
|
.index('tokenHash', ['tokenHash'])
|
|
1167
1135
|
.index('sharedBy', ['sharedBy']),
|
|
1168
1136
|
};
|
|
1137
|
+
/** What a report decision did to the content. */
|
|
1138
|
+
export const vDecisionAction = v.union(v.literal('hidden'), v.literal('dismissed'));
|
|
1139
|
+
/** What a report decision rests on: the law, or the app's terms. */
|
|
1140
|
+
export const vDecisionGround = v.union(v.literal('illegal'), v.literal('terms'));
|
|
1169
1141
|
/** Why someone reported content: the one-click reasons, and the notice form's legal ones. */
|
|
1170
1142
|
export const vReportReason = v.union(v.literal('abuse'), v.literal('sexual'), v.literal('violence'), v.literal('spam'), v.literal('intimate'), v.literal('child_abuse'), v.literal('illegal'), v.literal('other'));
|
|
1171
1143
|
/**
|
|
@@ -1243,11 +1215,11 @@ export const reportTables = {
|
|
|
1243
1215
|
subject: v.optional(v.id('reportSubjects')),
|
|
1244
1216
|
/** The notice decided, for one the app could not place. */
|
|
1245
1217
|
notice: v.optional(v.id('reports')),
|
|
1246
|
-
action:
|
|
1218
|
+
action: vDecisionAction,
|
|
1247
1219
|
/** The facts and the term or law it rests on, as the administrator wrote them. */
|
|
1248
1220
|
reason: v.string(),
|
|
1249
1221
|
/** Whether the content broke the law or the app's terms. */
|
|
1250
|
-
ground:
|
|
1222
|
+
ground: vDecisionGround,
|
|
1251
1223
|
/** The administrator who decided. */
|
|
1252
1224
|
by: v.string(),
|
|
1253
1225
|
at: v.number(),
|
|
@@ -1445,6 +1417,23 @@ export const monitoringTables = {
|
|
|
1445
1417
|
.index('by_alert_and_period', ['alert', 'period'])
|
|
1446
1418
|
.index('by_at', ['at']),
|
|
1447
1419
|
};
|
|
1420
|
+
/** A consent decision, as the `consents` table stores it. */
|
|
1421
|
+
export const vConsent = v.object({
|
|
1422
|
+
userId: v.optional(v.string()),
|
|
1423
|
+
/** SHA-256 of the lower-cased address, for a decision given before the account existed. */
|
|
1424
|
+
emailHash: v.optional(v.string()),
|
|
1425
|
+
kind: v.string(),
|
|
1426
|
+
version: v.string(),
|
|
1427
|
+
/** `true` a grant, `false` a withdrawal. */
|
|
1428
|
+
granted: v.boolean(),
|
|
1429
|
+
at: v.number(),
|
|
1430
|
+
/** Where it came from: `sign-up`, `prompt`, `settings`, `waitlist` or `topic`. */
|
|
1431
|
+
source: v.string(),
|
|
1432
|
+
/** The words the person agreed to, when the form showed its own (the launch-news box). */
|
|
1433
|
+
text: v.optional(v.string()),
|
|
1434
|
+
/** What the decision came with: `checkout:<id>` for a topic's soft opt-in at checkout. */
|
|
1435
|
+
reference: v.optional(v.string()),
|
|
1436
|
+
});
|
|
1448
1437
|
/**
|
|
1449
1438
|
* The consent ledger (see `consents.ts`): one row per decision, a grant or a
|
|
1450
1439
|
* withdrawal, of one kind at one version, never overwritten, so the history
|
|
@@ -1453,22 +1442,7 @@ export const monitoringTables = {
|
|
|
1453
1442
|
* signs up.
|
|
1454
1443
|
*/
|
|
1455
1444
|
export const consentTables = {
|
|
1456
|
-
consents: defineTable(
|
|
1457
|
-
userId: v.optional(v.string()),
|
|
1458
|
-
/** SHA-256 of the lower-cased address, for a decision given before the account existed. */
|
|
1459
|
-
emailHash: v.optional(v.string()),
|
|
1460
|
-
kind: v.string(),
|
|
1461
|
-
version: v.string(),
|
|
1462
|
-
/** `true` a grant, `false` a withdrawal. */
|
|
1463
|
-
granted: v.boolean(),
|
|
1464
|
-
at: v.number(),
|
|
1465
|
-
/** Where it came from: `sign-up`, `prompt`, `settings`, `waitlist` or `topic`. */
|
|
1466
|
-
source: v.string(),
|
|
1467
|
-
/** The words the person agreed to, when the form showed its own (the launch-news box). */
|
|
1468
|
-
text: v.optional(v.string()),
|
|
1469
|
-
/** What the decision came with: `checkout:<id>` for a topic's soft opt-in at checkout. */
|
|
1470
|
-
reference: v.optional(v.string()),
|
|
1471
|
-
})
|
|
1445
|
+
consents: defineTable(vConsent)
|
|
1472
1446
|
.index('userId_kind_at', ['userId', 'kind', 'at'])
|
|
1473
1447
|
.index('userId_at', ['userId', 'at'])
|
|
1474
1448
|
.index('emailHash_at', ['emailHash', 'at']),
|