qarpeo 0.1.34 → 0.2.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 +114 -26
- package/dist/apps/cms.d.ts +4 -0
- package/dist/apps/comments.d.ts +4 -0
- package/dist/apps/payments.d.ts +4 -0
- package/dist/apps/store.d.ts +4 -0
- package/dist/chunks/auth-schema.mjs +169 -30
- package/dist/chunks/tools.mjs +1680 -0
- package/dist/cli/index.mjs +1256 -221
- package/dist/core/aliases.d.ts +5 -0
- package/dist/core/context.d.ts +10 -0
- package/dist/core/cross-drive.d.ts +2 -0
- package/dist/core/d1-migrate.d.ts +4 -0
- package/dist/core/devtools.d.ts +4 -0
- package/dist/core/nitro.d.ts +4 -0
- package/dist/core/schema.d.ts +4 -0
- package/dist/core/server-utils.d.ts +4 -0
- package/dist/core/wrangler.d.ts +4 -0
- package/dist/dev/wrangler.d.ts +1 -0
- package/dist/fate/index.d.ts +8 -8
- package/dist/features/agents.d.ts +4 -0
- package/dist/features/auth.d.ts +4 -0
- package/dist/features/bots.d.ts +4 -0
- package/dist/features/fate.d.ts +4 -0
- package/dist/features/mail.d.ts +4 -0
- package/dist/features/mcp.d.ts +4 -0
- package/dist/features/multitenant.d.ts +4 -0
- package/dist/features/notifications.d.ts +4 -0
- package/dist/features/realtime.d.ts +4 -0
- package/dist/module.d.ts +10 -2
- package/dist/module.mjs +6313 -5114
- package/dist/primitives/ai.d.ts +4 -0
- package/dist/primitives/analytics.d.ts +4 -0
- package/dist/primitives/blob.d.ts +4 -0
- package/dist/primitives/browser.d.ts +4 -0
- package/dist/primitives/cache.d.ts +4 -0
- package/dist/primitives/d1.d.ts +4 -0
- package/dist/primitives/do.d.ts +4 -0
- package/dist/primitives/email.d.ts +4 -0
- package/dist/primitives/hyperdrive.d.ts +4 -0
- package/dist/primitives/kv.d.ts +4 -0
- package/dist/primitives/queue.d.ts +4 -0
- package/dist/primitives/ratelimit.d.ts +4 -0
- package/dist/primitives/vectorize.d.ts +4 -0
- package/dist/primitives/workflows.d.ts +4 -0
- package/dist/runtime/ai.d.ts +3 -3
- package/dist/runtime/ai.mjs +8 -1
- package/dist/runtime/app/components/RealtimeCursors.vue +2 -2
- package/dist/runtime/app/composables/ai.d.ts +56 -29
- package/dist/runtime/app/composables/analytics.d.ts +26 -106
- package/dist/runtime/app/composables/api-tokens.d.ts +31 -34
- package/dist/runtime/app/composables/auth.d.ts +147 -51
- package/dist/runtime/app/composables/auth.mjs +0 -7
- package/dist/runtime/app/composables/chat.d.ts +38 -35
- package/dist/runtime/app/composables/cms-preview.d.ts +30 -25
- package/dist/runtime/app/composables/cms.d.ts +57 -282
- package/dist/runtime/app/composables/cms.mjs +0 -35
- package/dist/runtime/app/composables/comments.d.ts +32 -5
- package/dist/runtime/app/composables/comments.mjs +29 -1
- package/dist/runtime/app/composables/docs-version.d.ts +25 -28
- package/dist/runtime/app/composables/impersonation.d.ts +22 -5
- package/dist/runtime/app/composables/organization.d.ts +38 -91
- package/dist/runtime/app/composables/passkey.d.ts +22 -6
- package/dist/runtime/app/composables/passwordless.d.ts +24 -7
- package/dist/runtime/app/composables/payments.d.ts +50 -34
- package/dist/runtime/app/composables/payments.mjs +1 -0
- package/dist/runtime/app/composables/sse.d.ts +76 -0
- package/dist/runtime/app/composables/sse.mjs +152 -0
- package/dist/runtime/app/composables/storage.d.ts +53 -65
- package/dist/runtime/app/composables/storage.mjs +17 -0
- package/dist/runtime/app/composables/store.d.ts +198 -0
- package/dist/runtime/app/composables/store.mjs +414 -0
- package/dist/runtime/app/composables/tenant.d.ts +31 -72
- package/dist/runtime/app/composables/turnstile.d.ts +16 -3
- package/dist/runtime/app/composables/two-factor.d.ts +23 -6
- package/dist/runtime/app/pages/devtools/notifications.vue +30 -27
- package/dist/runtime/app/pages/devtools/realtime.vue +19 -31
- package/dist/runtime/app/pages/devtools.vue +0 -7
- package/dist/runtime/auth.d.ts +9 -9
- package/dist/runtime/blob.d.ts +10 -1
- package/dist/runtime/blob.mjs +83 -0
- package/dist/runtime/cache.d.ts +48 -0
- package/dist/runtime/cache.mjs +92 -0
- package/dist/runtime/comments.d.ts +4 -0
- package/dist/runtime/comments.mjs +2 -0
- package/dist/runtime/db.d.ts +21 -1
- package/dist/runtime/db.mjs +54 -0
- package/dist/runtime/drizzle.d.ts +4 -2
- package/dist/runtime/drizzle.mjs +68 -1
- package/dist/runtime/durable-object.d.ts +2 -0
- package/dist/runtime/durable-object.mjs +2 -0
- package/dist/runtime/email.d.ts +1 -1
- package/dist/runtime/email.mjs +1 -1
- package/dist/runtime/kv.mjs +50 -1
- package/dist/runtime/mcp.d.ts +2 -0
- package/dist/runtime/mcp.mjs +2 -0
- package/dist/runtime/queue.d.ts +12 -2
- package/dist/runtime/queue.mjs +19 -1
- package/dist/runtime/ratelimit.d.ts +1 -0
- package/dist/runtime/ratelimit.mjs +7 -0
- package/dist/runtime/schema.d.ts +313 -0
- package/dist/runtime/schema.mjs +259 -0
- package/dist/runtime/server/db/cms-schema.d.ts +1225 -171
- package/dist/runtime/server/db/cms-schema.mjs +69 -70
- package/dist/runtime/server/db/store-schema.d.ts +4344 -0
- package/dist/runtime/server/db/store-schema.mjs +266 -0
- package/dist/runtime/server/durable-objects/agent.mjs +35 -0
- package/dist/runtime/server/durable-objects/room.mjs +0 -1
- package/dist/runtime/server/middleware/ratelimit.mjs +10 -8
- package/dist/runtime/server/plugins/comments.d.ts +7 -0
- package/dist/runtime/server/plugins/comments.mjs +7 -0
- package/dist/runtime/server/plugins/email-inbound.d.ts +5 -0
- package/dist/runtime/server/plugins/email-inbound.mjs +17 -0
- package/dist/runtime/server/plugins/store.d.ts +7 -0
- package/dist/runtime/server/plugins/store.mjs +7 -0
- package/dist/runtime/server/routes/__qarpeo/db/tables.get.mjs +2 -2
- package/dist/runtime/server/routes/atom.xml.get.mjs +3 -1
- package/dist/runtime/server/routes/auth/2fa/disable.post.mjs +13 -2
- package/dist/runtime/server/routes/auth/2fa/setup.post.mjs +9 -3
- package/dist/runtime/server/routes/auth/2fa/verify.post.mjs +11 -3
- package/dist/runtime/server/routes/auth/account.delete.mjs +2 -1
- package/dist/runtime/server/routes/auth/audit-logs.get.mjs +1 -1
- package/dist/runtime/server/routes/auth/magic-link/send.post.d.ts +1 -9
- package/dist/runtime/server/routes/auth/magic-link/send.post.mjs +8 -0
- package/dist/runtime/server/routes/auth/organization/sso/[id].delete.mjs +1 -1
- package/dist/runtime/server/routes/auth/organization/sso/index.get.mjs +1 -1
- package/dist/runtime/server/routes/auth/organization/sso/index.post.mjs +1 -1
- package/dist/runtime/server/routes/auth/otp/send.post.d.ts +1 -9
- package/dist/runtime/server/routes/auth/otp/send.post.mjs +8 -0
- package/dist/runtime/server/routes/auth/sso/login.get.mjs +3 -3
- package/dist/runtime/server/routes/auth/sso/oidc/callback.get.mjs +1 -1
- package/dist/runtime/server/routes/auth/sso/saml/acs.post.mjs +2 -2
- package/dist/runtime/server/routes/auth/webauthn/login/options.post.mjs +1 -1
- package/dist/runtime/server/routes/auth/webauthn/login/verify.post.mjs +1 -1
- package/dist/runtime/server/routes/auth/webauthn/register/options.post.mjs +2 -2
- package/dist/runtime/server/routes/auth/webauthn/register/verify.post.mjs +1 -1
- package/dist/runtime/server/routes/cms/[collection]/[id]/preview-token.post.mjs +1 -1
- package/dist/runtime/server/routes/cms/[collection]/atom.xml.get.mjs +3 -1
- package/dist/runtime/server/routes/cms/[collection]/feed.xml.get.mjs +3 -1
- package/dist/runtime/server/routes/cms/bookmarks/[id].delete.mjs +1 -1
- package/dist/runtime/server/routes/cms/bookmarks/check.post.mjs +1 -1
- package/dist/runtime/server/routes/cms/bookmarks/index.get.mjs +1 -1
- package/dist/runtime/server/routes/cms/bookmarks/index.post.mjs +1 -1
- package/dist/runtime/server/routes/cms/deploy.post.mjs +1 -1
- package/dist/runtime/server/routes/cms/export.post.mjs +4 -3
- package/dist/runtime/server/routes/cms/search.get.mjs +7 -5
- package/dist/runtime/server/routes/cms/sync.post.mjs +2 -1
- package/dist/runtime/server/routes/comments/[id]/react.post.mjs +1 -2
- package/dist/runtime/server/routes/comments/[id]/report.post.d.ts +1 -1
- package/dist/runtime/server/routes/comments/[id]/report.post.mjs +0 -2
- package/dist/runtime/server/routes/comments/[id].delete.mjs +8 -4
- package/dist/runtime/server/routes/comments/[id].get.d.ts +1 -1
- package/dist/runtime/server/routes/comments/[id].get.mjs +1 -2
- package/dist/runtime/server/routes/comments/[id].patch.d.ts +1 -1
- package/dist/runtime/server/routes/comments/[id].patch.mjs +6 -3
- package/dist/runtime/server/routes/comments/batch.post.d.ts +2 -0
- package/dist/runtime/server/routes/comments/batch.post.mjs +33 -0
- package/dist/runtime/server/routes/comments/index.get.d.ts +1 -1
- package/dist/runtime/server/routes/comments/index.get.mjs +6 -4
- package/dist/runtime/server/routes/comments/index.post.d.ts +1 -1
- package/dist/runtime/server/routes/comments/index.post.mjs +6 -2
- package/dist/runtime/server/routes/feed.xml.get.mjs +3 -1
- package/dist/runtime/server/routes/sitemap.xml.get.mjs +3 -1
- package/dist/runtime/server/routes/storage/presigned-r2.post.d.ts +17 -0
- package/dist/runtime/server/routes/storage/presigned-r2.post.mjs +29 -0
- package/dist/runtime/server/routes/store/cart/index.delete.d.ts +6 -0
- package/dist/runtime/server/routes/store/cart/index.delete.mjs +11 -0
- package/dist/runtime/server/routes/store/cart/index.get.d.ts +5 -0
- package/dist/runtime/server/routes/store/cart/index.get.mjs +14 -0
- package/dist/runtime/server/routes/store/cart/items/[id].delete.d.ts +6 -0
- package/dist/runtime/server/routes/store/cart/items/[id].delete.mjs +25 -0
- package/dist/runtime/server/routes/store/cart/items/[id].patch.d.ts +6 -0
- package/dist/runtime/server/routes/store/cart/items/[id].patch.mjs +29 -0
- package/dist/runtime/server/routes/store/cart/items.post.d.ts +6 -0
- package/dist/runtime/server/routes/store/cart/items.post.mjs +36 -0
- package/dist/runtime/server/routes/store/categories/index.get.d.ts +2 -0
- package/dist/runtime/server/routes/store/categories/index.get.mjs +8 -0
- package/dist/runtime/server/routes/store/checkout.post.d.ts +6 -0
- package/dist/runtime/server/routes/store/checkout.post.mjs +21 -0
- package/dist/runtime/server/routes/store/coupons/apply.post.d.ts +7 -0
- package/dist/runtime/server/routes/store/coupons/apply.post.mjs +18 -0
- package/dist/runtime/server/routes/store/currencies.get.d.ts +15 -0
- package/dist/runtime/server/routes/store/currencies.get.mjs +13 -0
- package/dist/runtime/server/routes/store/orders/[id].get.d.ts +2 -0
- package/dist/runtime/server/routes/store/orders/[id].get.mjs +26 -0
- package/dist/runtime/server/routes/store/orders/download/[token].get.d.ts +7 -0
- package/dist/runtime/server/routes/store/orders/download/[token].get.mjs +57 -0
- package/dist/runtime/server/routes/store/orders/index.get.d.ts +5 -0
- package/dist/runtime/server/routes/store/orders/index.get.mjs +30 -0
- package/dist/runtime/server/routes/store/products/[slug].get.d.ts +2 -0
- package/dist/runtime/server/routes/store/products/[slug].get.mjs +18 -0
- package/dist/runtime/server/routes/store/products/index.get.d.ts +5 -0
- package/dist/runtime/server/routes/store/products/index.get.mjs +33 -0
- package/dist/runtime/server/routes/store/tax/calculate.post.d.ts +9 -0
- package/dist/runtime/server/routes/store/tax/calculate.post.mjs +18 -0
- package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/index.delete.mjs +14 -1
- package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/verify.post.mjs +14 -1
- package/dist/runtime/server/routes/tenants/[tenant]/domains/index.get.mjs +24 -1
- package/dist/runtime/server/routes/tenants/[tenant]/domains/index.post.mjs +6 -0
- package/dist/runtime/server/utils/ai.d.ts +146 -21
- package/dist/runtime/server/utils/ai.mjs +406 -11
- package/dist/runtime/server/utils/analytics-query.d.ts +13 -58
- package/dist/runtime/server/utils/audit.d.ts +5 -4
- package/dist/runtime/server/utils/audit.mjs +25 -14
- package/dist/runtime/server/utils/auth.d.ts +29 -12
- package/dist/runtime/server/utils/auth.mjs +88 -70
- package/dist/runtime/server/utils/bots.d.ts +20 -4
- package/dist/runtime/server/utils/bots.mjs +7 -3
- package/dist/runtime/server/utils/browser-utils.d.ts +23 -23
- package/dist/runtime/server/utils/cache.d.ts +31 -10
- package/dist/runtime/server/utils/cache.mjs +130 -53
- package/dist/runtime/server/utils/cms/collections.d.ts +23 -0
- package/dist/runtime/server/utils/cms/collections.mjs +143 -0
- package/dist/runtime/server/utils/cms/common.d.ts +9 -0
- package/dist/runtime/server/utils/cms/common.mjs +28 -0
- package/dist/runtime/server/utils/cms/git.mjs +2 -2
- package/dist/runtime/server/utils/cms/navigation.d.ts +46 -0
- package/dist/runtime/server/utils/cms/navigation.mjs +683 -0
- package/dist/runtime/server/utils/cms/preview.d.ts +11 -0
- package/dist/runtime/server/utils/cms/preview.mjs +50 -0
- package/dist/runtime/server/utils/cms/search.d.ts +1 -1
- package/dist/runtime/server/utils/cms/search.mjs +11 -7
- package/dist/runtime/server/utils/cms/sync.d.ts +34 -0
- package/dist/runtime/server/utils/cms/sync.mjs +1082 -0
- package/dist/runtime/server/utils/cms/taxonomy.d.ts +103 -0
- package/dist/runtime/server/utils/cms/taxonomy.mjs +348 -0
- package/dist/runtime/server/utils/cms.d.ts +13 -249
- package/dist/runtime/server/utils/cms.mjs +108 -2350
- package/dist/runtime/server/utils/comments-filter.d.ts +45 -0
- package/dist/runtime/server/utils/comments-filter.mjs +541 -0
- package/dist/runtime/server/utils/comments.d.ts +71 -0
- package/dist/runtime/server/utils/comments.mjs +137 -61
- package/dist/runtime/server/utils/config.d.ts +4 -3
- package/dist/runtime/server/utils/config.mjs +7 -6
- package/dist/runtime/server/utils/context.d.ts +14 -0
- package/dist/runtime/server/utils/context.mjs +2 -2
- package/dist/runtime/server/utils/crypto.d.ts +44 -5
- package/dist/runtime/server/utils/crypto.mjs +18 -0
- package/dist/runtime/server/utils/domains.mjs +9 -5
- package/dist/runtime/server/utils/drizzle.d.ts +35 -3
- package/dist/runtime/server/utils/drizzle.mjs +115 -6
- package/dist/runtime/server/utils/durable-object.d.ts +106 -0
- package/dist/runtime/server/utils/durable-object.mjs +628 -0
- package/dist/runtime/server/utils/email-inbound.d.ts +29 -0
- package/dist/runtime/server/utils/email-inbound.mjs +76 -0
- package/dist/runtime/server/utils/impersonation.d.ts +32 -2
- package/dist/runtime/server/utils/impersonation.mjs +16 -13
- package/dist/runtime/server/utils/lock.d.ts +71 -0
- package/dist/runtime/server/utils/lock.mjs +139 -0
- package/dist/runtime/server/utils/mail-suppression.mjs +7 -7
- package/dist/runtime/server/utils/mail.d.ts +30 -19
- package/dist/runtime/server/utils/mcp.d.ts +44 -0
- package/dist/runtime/server/utils/mcp.mjs +308 -0
- package/dist/runtime/server/utils/notifications.d.ts +72 -7
- package/dist/runtime/server/utils/notifications.mjs +67 -55
- package/dist/runtime/server/utils/oauth.d.ts +27 -4
- package/dist/runtime/server/utils/organization.d.ts +63 -7
- package/dist/runtime/server/utils/organization.mjs +26 -21
- package/dist/runtime/server/utils/passwordless.d.ts +62 -33
- package/dist/runtime/server/utils/payments.d.ts +51 -12
- package/dist/runtime/server/utils/payments.mjs +472 -282
- package/dist/runtime/server/utils/queue.d.ts +106 -13
- package/dist/runtime/server/utils/queue.mjs +313 -28
- package/dist/runtime/server/utils/rag.d.ts +42 -14
- package/dist/runtime/server/utils/rag.mjs +169 -4
- package/dist/runtime/server/utils/ratelimit.d.ts +34 -5
- package/dist/runtime/server/utils/ratelimit.mjs +95 -14
- package/dist/runtime/server/utils/realtime.d.ts +68 -52
- package/dist/runtime/server/utils/scheduled-task.d.ts +42 -1
- package/dist/runtime/server/utils/scheduled-task.mjs +29 -0
- package/dist/runtime/server/utils/schema-fallback.d.ts +1 -1
- package/dist/runtime/server/utils/schema-fallback.mjs +1 -1
- package/dist/runtime/server/utils/session.d.ts +84 -10
- package/dist/runtime/server/utils/session.mjs +12 -10
- package/dist/runtime/server/utils/sse.d.ts +75 -0
- package/dist/runtime/server/utils/sse.mjs +147 -0
- package/dist/runtime/server/utils/sso.d.ts +1 -1
- package/dist/runtime/server/utils/storage.d.ts +53 -4
- package/dist/runtime/server/utils/storage.mjs +15 -11
- package/dist/runtime/server/utils/store-localization.d.ts +51 -0
- package/dist/runtime/server/utils/store-localization.mjs +417 -0
- package/dist/runtime/server/utils/store.d.ts +207 -0
- package/dist/runtime/server/utils/store.mjs +2227 -0
- package/dist/runtime/server/utils/table-names.d.ts +51 -0
- package/dist/runtime/server/utils/table-names.mjs +69 -0
- package/dist/runtime/server/utils/tenant.d.ts +26 -2
- package/dist/runtime/server/utils/tenant.mjs +16 -12
- package/dist/runtime/server/utils/tools-registry-fallback.d.ts +1 -0
- package/dist/runtime/server/utils/tools-registry-fallback.mjs +1 -0
- package/dist/runtime/server/utils/totp.d.ts +45 -2
- package/dist/runtime/server/utils/tracker.d.ts +10 -11
- package/dist/runtime/server/utils/turnstile.d.ts +16 -1
- package/dist/runtime/server/utils/workflows.d.ts +92 -0
- package/dist/runtime/server/utils/workflows.mjs +299 -0
- package/dist/runtime/server.d.ts +8 -1
- package/dist/runtime/server.mjs +8 -5
- package/dist/runtime/service.d.ts +10 -10
- package/dist/runtime/storage.d.ts +1 -0
- package/dist/runtime/storage.mjs +1 -0
- package/dist/runtime/store.d.ts +4 -0
- package/dist/runtime/store.mjs +2 -0
- package/dist/runtime/test-utils.d.ts +11 -10
- package/dist/runtime/test-utils.mjs +64 -4
- package/dist/runtime/types/ai.d.ts +21 -2
- package/dist/runtime/types/d1.d.ts +17 -0
- package/dist/runtime/types/drizzle.d.ts +2 -2
- package/dist/runtime/types/durable-object.d.ts +62 -2
- package/dist/runtime/types/email.d.ts +46 -0
- package/dist/runtime/types/imports.d.ts +6 -1
- package/dist/runtime/types/index.d.ts +58 -0
- package/dist/runtime/types/index.mjs +3 -0
- package/dist/runtime/types/mcp.d.ts +83 -0
- package/dist/runtime/types/mcp.mjs +0 -0
- package/dist/runtime/types/queue.d.ts +36 -0
- package/dist/runtime/types/r2.d.ts +41 -0
- package/dist/runtime/types/store.d.ts +313 -0
- package/dist/runtime/types/store.mjs +0 -0
- package/dist/runtime/types/workflows.d.ts +98 -0
- package/dist/runtime/types/workflows.mjs +0 -0
- package/dist/runtime/workflows.d.ts +5 -0
- package/dist/runtime/workflows.mjs +2 -0
- package/dist/types/ai.d.ts +721 -0
- package/dist/types/cms.d.ts +710 -0
- package/dist/types.d.ts +430 -1292
- package/dist/utils/auth-schema.d.ts +3 -2
- package/dist/utils/bots.d.ts +20 -0
- package/dist/utils/comments-schema.d.ts +5 -4
- package/dist/utils/drizzle.d.ts +83 -3
- package/dist/utils/durable-objects.d.ts +10 -0
- package/dist/utils/email-inbound.d.ts +10 -0
- package/dist/utils/local-db.d.ts +1 -3
- package/dist/utils/mcp.d.ts +24 -0
- package/dist/utils/notifications-schema.d.ts +5 -4
- package/dist/utils/payments-schema.d.ts +4 -3
- package/dist/utils/store-schema.d.ts +14 -0
- package/dist/utils/table-names.d.ts +1 -0
- package/dist/utils/tenants-schema.d.ts +4 -3
- package/dist/utils/tools.d.ts +20 -0
- package/dist/utils/workflows.d.ts +8 -0
- package/package.json +34 -4
- package/dist/chunks/wrangler.mjs +0 -897
- package/dist/runtime/app/components/AuthRegister.vue +0 -306
- package/dist/runtime/app/components/AuthSessionsList.vue +0 -137
- package/dist/runtime/app/components/AuthSignIn.vue +0 -298
- package/dist/runtime/app/components/CMSBookmarkButton.vue +0 -59
- package/dist/runtime/app/components/CMSImage.vue +0 -47
- package/dist/runtime/app/components/CMSLocaleSwitcher.vue +0 -110
- package/dist/runtime/app/components/CMSNewsletter.vue +0 -81
- package/dist/runtime/app/components/CMSPreviewBanner.vue +0 -83
- package/dist/runtime/app/components/CMSTableOfContents.vue +0 -84
- package/dist/runtime/app/components/CMSVersionBanner.vue +0 -53
- package/dist/runtime/app/components/CMSVersionSwitcher.vue +0 -140
- package/dist/runtime/app/components/Comments.vue +0 -411
- package/dist/runtime/app/components/FileUpload.vue +0 -200
- package/dist/runtime/app/components/ImpersonationBanner.vue +0 -61
- package/dist/runtime/app/components/NotificationBell.vue +0 -263
- package/dist/runtime/app/components/NotificationList.vue +0 -205
- package/dist/runtime/app/components/NotificationPrompt.vue +0 -133
- package/dist/runtime/app/components/PricingGated.vue +0 -81
- package/dist/runtime/app/components/PricingTable.vue +0 -274
- package/dist/runtime/app/components/RealtimeChat.vue +0 -164
- package/dist/runtime/app/components/RealtimePresence.vue +0 -129
- package/dist/runtime/app/components/RealtimeStatus.vue +0 -79
- package/dist/runtime/app/components/SubscriptionCard.vue +0 -207
- package/dist/runtime/app/components/UserProfile.vue +0 -558
|
@@ -2,7 +2,17 @@ import { type RequestEvent } from "nuxt/server";
|
|
|
2
2
|
import type { QarpeoOrganization, QarpeoMember } from "../../types/auth";
|
|
3
3
|
import { slugify } from "./string";
|
|
4
4
|
export { slugify };
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new organization with the current authenticated user as "owner".
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const { organization, member } = await createOrganization(event, {
|
|
11
|
+
* name: "Acme Corp",
|
|
12
|
+
* slug: "acme",
|
|
13
|
+
* })
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
6
16
|
export declare function createOrganization(event: RequestEvent, input: {
|
|
7
17
|
name: string;
|
|
8
18
|
slug?: string;
|
|
@@ -11,18 +21,43 @@ export declare function createOrganization(event: RequestEvent, input: {
|
|
|
11
21
|
organization: QarpeoOrganization;
|
|
12
22
|
member: QarpeoMember;
|
|
13
23
|
}>;
|
|
14
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Lists all organizations the authenticated user belongs to.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const orgs = await listUserOrganizations(event, user.id)
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
15
32
|
export declare function listUserOrganizations(event: RequestEvent, userId: string): Promise<Array<QarpeoOrganization & {
|
|
16
33
|
role: string;
|
|
17
34
|
memberId: string;
|
|
18
35
|
}>>;
|
|
19
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* Switches the active organization for the current user's session.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* const res = await switchActiveOrganization(event, "org_123")
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
20
44
|
export declare function switchActiveOrganization(event: RequestEvent, organizationId: string): Promise<{
|
|
21
45
|
success: boolean;
|
|
22
46
|
organization: QarpeoOrganization;
|
|
23
47
|
role: string;
|
|
24
48
|
}>;
|
|
25
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Invites a new member to an organization via email.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* const invite = await inviteOrganizationMember(event, {
|
|
55
|
+
* organizationId: "org_123",
|
|
56
|
+
* email: "colleague@example.com",
|
|
57
|
+
* role: "member",
|
|
58
|
+
* })
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
26
61
|
export declare function inviteOrganizationMember(event: RequestEvent, input: {
|
|
27
62
|
organizationId: string;
|
|
28
63
|
email: string;
|
|
@@ -35,20 +70,41 @@ export declare function inviteOrganizationMember(event: RequestEvent, input: {
|
|
|
35
70
|
sent: boolean;
|
|
36
71
|
error?: string;
|
|
37
72
|
}>;
|
|
38
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* Removes a member from an organization.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* await removeOrganizationMember(event, { organizationId: "org_123", memberId: "mem_456" })
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
39
81
|
export declare function removeOrganizationMember(event: RequestEvent, input: {
|
|
40
82
|
organizationId: string;
|
|
41
83
|
memberId: string;
|
|
42
84
|
}): Promise<{
|
|
43
85
|
success: boolean;
|
|
44
86
|
}>;
|
|
45
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* Accepts an invitation token and adds user as a member.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* const res = await acceptOrganizationInvitation(event, "raw-invite-token")
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
46
95
|
export declare function acceptOrganizationInvitation(event: RequestEvent, token: string): Promise<{
|
|
47
96
|
success: boolean;
|
|
48
97
|
organizationId: string;
|
|
49
98
|
role: string;
|
|
50
99
|
}>;
|
|
51
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* Lists all members for a given organization (requires organization membership).
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* const members = await listOrganizationMembers(event, "org_123")
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
52
108
|
export declare function listOrganizationMembers(event: RequestEvent, organizationId: string): Promise<Array<QarpeoMember & {
|
|
53
109
|
email?: string;
|
|
54
110
|
name?: string;
|
|
@@ -6,6 +6,11 @@ import { getQarpeoConfig } from "./config.mjs";
|
|
|
6
6
|
import { escapeHtml, sanitizeUrl } from "./email-templates.mjs";
|
|
7
7
|
import { hashSessionToken, getAuthSession, setAuthSession } from "./session.mjs";
|
|
8
8
|
import { slugify } from "./string.mjs";
|
|
9
|
+
import { resolveTableName } from "./table-names.mjs";
|
|
10
|
+
const orgTbl = (e) => resolveTableName("organization", e);
|
|
11
|
+
const memberTbl = (e) => resolveTableName("member", e);
|
|
12
|
+
const invitationTbl = (e) => resolveTableName("invitation", e);
|
|
13
|
+
const userTbl = (e) => resolveTableName("user", e);
|
|
9
14
|
export { slugify };
|
|
10
15
|
function getD1(event) {
|
|
11
16
|
const bindingName = globalThis.process?.env?.QARPEO_DEFAULT_DB_BINDING || "DB";
|
|
@@ -30,7 +35,7 @@ export async function createOrganization(event, input) {
|
|
|
30
35
|
const orgId = crypto.randomUUID();
|
|
31
36
|
const baseSlug = slugify(input.slug || name) || `org-${orgId.slice(0, 6)}`;
|
|
32
37
|
let finalSlug = baseSlug;
|
|
33
|
-
const existing = await d1.prepare(
|
|
38
|
+
const existing = await d1.prepare(`SELECT id FROM ${orgTbl(event)} WHERE slug = ? LIMIT 1`).bind(finalSlug).first();
|
|
34
39
|
if (existing) {
|
|
35
40
|
finalSlug = `${baseSlug}-${crypto.randomUUID().slice(0, 6)}`;
|
|
36
41
|
}
|
|
@@ -51,7 +56,7 @@ export async function createOrganization(event, input) {
|
|
|
51
56
|
createdAt: now
|
|
52
57
|
};
|
|
53
58
|
await d1.batch([
|
|
54
|
-
d1.prepare(
|
|
59
|
+
d1.prepare(`INSERT INTO ${orgTbl(event)} (id, name, slug, logo, created_at) VALUES (?, ?, ?, ?, ?)`).bind(
|
|
55
60
|
organization.id,
|
|
56
61
|
organization.name,
|
|
57
62
|
organization.slug,
|
|
@@ -59,7 +64,7 @@ export async function createOrganization(event, input) {
|
|
|
59
64
|
organization.createdAt
|
|
60
65
|
),
|
|
61
66
|
d1.prepare(
|
|
62
|
-
|
|
67
|
+
`INSERT INTO ${memberTbl(event)} (id, organization_id, user_id, role, created_at) VALUES (?, ?, ?, ?, ?)`
|
|
63
68
|
).bind(member.id, member.organizationId, member.userId, member.role, member.createdAt)
|
|
64
69
|
]);
|
|
65
70
|
try {
|
|
@@ -84,8 +89,8 @@ export async function listUserOrganizations(event, userId) {
|
|
|
84
89
|
const results = await d1.prepare(`
|
|
85
90
|
SELECT o.id, o.name, o.slug, o.logo as logoUrl, o.created_at as createdAt,
|
|
86
91
|
m.id as memberId, m.role
|
|
87
|
-
FROM
|
|
88
|
-
JOIN
|
|
92
|
+
FROM ${memberTbl(event)} m
|
|
93
|
+
JOIN ${orgTbl(event)} o ON m.organization_id = o.id
|
|
89
94
|
WHERE m.user_id = ?
|
|
90
95
|
ORDER BY o.name ASC
|
|
91
96
|
`).bind(userId).all();
|
|
@@ -99,7 +104,7 @@ export async function switchActiveOrganization(event, organizationId) {
|
|
|
99
104
|
}
|
|
100
105
|
const d1 = getD1(event);
|
|
101
106
|
await ensureAuthTables(d1);
|
|
102
|
-
const member = await d1.prepare(
|
|
107
|
+
const member = await d1.prepare(`SELECT id, role FROM ${memberTbl(event)} WHERE organization_id = ? AND user_id = ? LIMIT 1`).bind(organizationId, user.id).first();
|
|
103
108
|
if (!member) {
|
|
104
109
|
throw createError({
|
|
105
110
|
statusCode: 403,
|
|
@@ -108,7 +113,7 @@ export async function switchActiveOrganization(event, organizationId) {
|
|
|
108
113
|
});
|
|
109
114
|
}
|
|
110
115
|
const orgRecord = await d1.prepare(
|
|
111
|
-
|
|
116
|
+
`SELECT id, name, slug, logo as logoUrl, created_at as createdAt FROM ${orgTbl(event)} WHERE id = ? LIMIT 1`
|
|
112
117
|
).bind(organizationId).first();
|
|
113
118
|
if (!orgRecord) {
|
|
114
119
|
throw createError({
|
|
@@ -148,7 +153,7 @@ export async function inviteOrganizationMember(event, input) {
|
|
|
148
153
|
}
|
|
149
154
|
const d1 = getD1(event);
|
|
150
155
|
await ensureAuthTables(d1);
|
|
151
|
-
const callerMember = await d1.prepare(
|
|
156
|
+
const callerMember = await d1.prepare(`SELECT role FROM ${memberTbl(event)} WHERE organization_id = ? AND user_id = ? LIMIT 1`).bind(input.organizationId, user.id).first();
|
|
152
157
|
if (!callerMember || !["owner", "admin"].includes(callerMember.role)) {
|
|
153
158
|
throw createError({
|
|
154
159
|
statusCode: 403,
|
|
@@ -157,7 +162,7 @@ export async function inviteOrganizationMember(event, input) {
|
|
|
157
162
|
});
|
|
158
163
|
}
|
|
159
164
|
const org = await d1.prepare(
|
|
160
|
-
|
|
165
|
+
`SELECT id, name, slug, logo as logoUrl, created_at as createdAt FROM ${orgTbl(event)} WHERE id = ? LIMIT 1`
|
|
161
166
|
).bind(input.organizationId).first();
|
|
162
167
|
if (!org) {
|
|
163
168
|
throw createError({
|
|
@@ -173,7 +178,7 @@ export async function inviteOrganizationMember(event, input) {
|
|
|
173
178
|
const now = Date.now();
|
|
174
179
|
const expiresAt = now + 7 * 24 * 60 * 60 * 1e3;
|
|
175
180
|
await d1.prepare(`
|
|
176
|
-
INSERT INTO
|
|
181
|
+
INSERT INTO ${invitationTbl(event)} (id, organization_id, email, role, token_hash, expires_at, created_at)
|
|
177
182
|
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
178
183
|
`).bind(invitationId, org.id, email, role, tokenHash, expiresAt, now).run();
|
|
179
184
|
const reqUrl = getRequestURL(event);
|
|
@@ -242,7 +247,7 @@ export async function removeOrganizationMember(event, input) {
|
|
|
242
247
|
}
|
|
243
248
|
const d1 = getD1(event);
|
|
244
249
|
await ensureAuthTables(d1);
|
|
245
|
-
const callerMember = await d1.prepare(
|
|
250
|
+
const callerMember = await d1.prepare(`SELECT id, role FROM ${memberTbl(event)} WHERE organization_id = ? AND user_id = ? LIMIT 1`).bind(input.organizationId, user.id).first();
|
|
246
251
|
if (!callerMember) {
|
|
247
252
|
throw createError({
|
|
248
253
|
statusCode: 403,
|
|
@@ -251,7 +256,7 @@ export async function removeOrganizationMember(event, input) {
|
|
|
251
256
|
});
|
|
252
257
|
}
|
|
253
258
|
const targetMember = await d1.prepare(
|
|
254
|
-
|
|
259
|
+
`SELECT id, user_id as userId, role FROM ${memberTbl(event)} WHERE id = ? AND organization_id = ? LIMIT 1`
|
|
255
260
|
).bind(input.memberId, input.organizationId).first();
|
|
256
261
|
if (!targetMember) {
|
|
257
262
|
throw createError({
|
|
@@ -266,7 +271,7 @@ export async function removeOrganizationMember(event, input) {
|
|
|
266
271
|
throw createError({ statusCode: 403, statusMessage: "Forbidden", message: "Permission denied" });
|
|
267
272
|
}
|
|
268
273
|
if (targetMember.role === "owner") {
|
|
269
|
-
const ownerCount = await d1.prepare(
|
|
274
|
+
const ownerCount = await d1.prepare(`SELECT count(*) as count FROM ${memberTbl(event)} WHERE organization_id = ? AND role = 'owner'`).bind(input.organizationId).first();
|
|
270
275
|
if ((ownerCount?.count || 0) <= 1) {
|
|
271
276
|
throw createError({
|
|
272
277
|
statusCode: 400,
|
|
@@ -275,7 +280,7 @@ export async function removeOrganizationMember(event, input) {
|
|
|
275
280
|
});
|
|
276
281
|
}
|
|
277
282
|
}
|
|
278
|
-
await d1.prepare(
|
|
283
|
+
await d1.prepare(`DELETE FROM ${memberTbl(event)} WHERE id = ?`).bind(input.memberId).run();
|
|
279
284
|
if (isSelf && session.currentOrganizationId === input.organizationId) {
|
|
280
285
|
await setAuthSession(event, {
|
|
281
286
|
...session,
|
|
@@ -299,7 +304,7 @@ export async function acceptOrganizationInvitation(event, token) {
|
|
|
299
304
|
const tokenHash = await hashSessionToken(token);
|
|
300
305
|
const d1 = getD1(event);
|
|
301
306
|
await ensureAuthTables(d1);
|
|
302
|
-
const invitation = await d1.prepare(
|
|
307
|
+
const invitation = await d1.prepare(`SELECT * FROM ${invitationTbl(event)} WHERE token_hash = ? LIMIT 1`).bind(tokenHash).first();
|
|
303
308
|
if (!invitation) {
|
|
304
309
|
throw createError({
|
|
305
310
|
statusCode: 404,
|
|
@@ -308,18 +313,18 @@ export async function acceptOrganizationInvitation(event, token) {
|
|
|
308
313
|
});
|
|
309
314
|
}
|
|
310
315
|
if (Date.now() > invitation.expires_at) {
|
|
311
|
-
await d1.prepare(
|
|
316
|
+
await d1.prepare(`DELETE FROM ${invitationTbl(event)} WHERE id = ?`).bind(invitation.id).run();
|
|
312
317
|
throw createError({ statusCode: 410, statusMessage: "Gone", message: "Invitation has expired" });
|
|
313
318
|
}
|
|
314
319
|
const memberId = crypto.randomUUID();
|
|
315
320
|
const now = Date.now();
|
|
316
321
|
await d1.batch([
|
|
317
322
|
d1.prepare(`
|
|
318
|
-
INSERT INTO
|
|
323
|
+
INSERT INTO ${memberTbl(event)} (id, organization_id, user_id, role, created_at)
|
|
319
324
|
VALUES (?, ?, ?, ?, ?)
|
|
320
325
|
ON CONFLICT(organization_id, user_id) DO UPDATE SET role = excluded.role
|
|
321
326
|
`).bind(memberId, invitation.organization_id, user.id, invitation.role, now),
|
|
322
|
-
d1.prepare(
|
|
327
|
+
d1.prepare(`DELETE FROM ${invitationTbl(event)} WHERE id = ?`).bind(invitation.id)
|
|
323
328
|
]);
|
|
324
329
|
await switchActiveOrganization(event, invitation.organization_id);
|
|
325
330
|
return { success: true, organizationId: invitation.organization_id, role: invitation.role };
|
|
@@ -332,7 +337,7 @@ export async function listOrganizationMembers(event, organizationId) {
|
|
|
332
337
|
}
|
|
333
338
|
const d1 = getD1(event);
|
|
334
339
|
await ensureAuthTables(d1);
|
|
335
|
-
const caller = await d1.prepare(
|
|
340
|
+
const caller = await d1.prepare(`SELECT id FROM ${memberTbl(event)} WHERE organization_id = ? AND user_id = ? LIMIT 1`).bind(organizationId, user.id).first();
|
|
336
341
|
if (!caller) {
|
|
337
342
|
throw createError({
|
|
338
343
|
statusCode: 403,
|
|
@@ -343,8 +348,8 @@ export async function listOrganizationMembers(event, organizationId) {
|
|
|
343
348
|
const results = await d1.prepare(`
|
|
344
349
|
SELECT m.id, m.organization_id as organizationId, m.user_id as userId, m.role, m.created_at as createdAt,
|
|
345
350
|
u.email, u.name, u.image as avatarUrl
|
|
346
|
-
FROM
|
|
347
|
-
LEFT JOIN
|
|
351
|
+
FROM ${memberTbl(event)} m
|
|
352
|
+
LEFT JOIN ${userTbl(event)} u ON m.user_id = u.id
|
|
348
353
|
WHERE m.organization_id = ?
|
|
349
354
|
ORDER BY m.created_at ASC
|
|
350
355
|
`).bind(organizationId).all();
|
|
@@ -7,43 +7,72 @@ export interface OTPRecord {
|
|
|
7
7
|
attempts: number;
|
|
8
8
|
expiresAt: number;
|
|
9
9
|
}
|
|
10
|
-
export
|
|
10
|
+
export interface SendOTPResult {
|
|
11
11
|
sent: boolean;
|
|
12
12
|
expiresAt: number;
|
|
13
|
-
error
|
|
14
|
-
}
|
|
13
|
+
error?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface VerifyOTPResult {
|
|
16
|
+
valid: boolean;
|
|
17
|
+
reason?: "expired" | "too_many_attempts" | "invalid_code";
|
|
18
|
+
attemptsRemaining?: number;
|
|
19
|
+
}
|
|
20
|
+
export interface SendMagicLinkResult {
|
|
15
21
|
sent: boolean;
|
|
16
22
|
expiresAt: number;
|
|
17
|
-
error?:
|
|
18
|
-
}
|
|
19
|
-
export
|
|
20
|
-
valid: boolean;
|
|
21
|
-
reason: string;
|
|
22
|
-
attemptsRemaining?: undefined;
|
|
23
|
-
} | {
|
|
24
|
-
valid: boolean;
|
|
25
|
-
reason: string;
|
|
26
|
-
attemptsRemaining: number;
|
|
27
|
-
} | {
|
|
23
|
+
error?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface VerifyMagicLinkResult {
|
|
28
26
|
valid: boolean;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
email?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Sends a one-time password (OTP) verification code to the specified email address.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const result = await sendOTPCode(event, "user@example.com")
|
|
35
|
+
* if (result.sent) {
|
|
36
|
+
* console.log("OTP code sent successfully, expires at", result.expiresAt)
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function sendOTPCode(event: RequestEvent, email: string, options?: SendOTPOptions): Promise<SendOTPResult>;
|
|
41
|
+
/**
|
|
42
|
+
* Verifies a submitted OTP code for an email address against KV.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const result = await verifyOTPCode(event, "user@example.com", "123456")
|
|
47
|
+
* if (result.valid) {
|
|
48
|
+
* console.log("OTP successfully verified")
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function verifyOTPCode(event: RequestEvent, email: string, code: string): Promise<VerifyOTPResult>;
|
|
53
|
+
/**
|
|
54
|
+
* Sends a passwordless magic sign-in link to the specified email address.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const result = await sendMagicLink(event, "user@example.com")
|
|
59
|
+
* if (result.sent) {
|
|
60
|
+
* console.log("Magic link sent successfully")
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
32
64
|
export declare function sendMagicLink(event: RequestEvent, email: string, options?: {
|
|
33
65
|
ttl?: number;
|
|
34
|
-
}): Promise<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
valid: boolean;
|
|
48
|
-
email: string;
|
|
49
|
-
}>;
|
|
66
|
+
}): Promise<SendMagicLinkResult>;
|
|
67
|
+
/**
|
|
68
|
+
* Verifies and consumes a passwordless magic sign-in link token.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const result = await verifyMagicLinkToken(event, token)
|
|
73
|
+
* if (result.valid) {
|
|
74
|
+
* console.log("Verified email:", result.email)
|
|
75
|
+
* }
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export declare function verifyMagicLinkToken(event: RequestEvent, token: string): Promise<VerifyMagicLinkResult>;
|
|
@@ -10,10 +10,14 @@ export declare function ensurePaymentsTables(event?: RequestEvent): Promise<void
|
|
|
10
10
|
export declare function verifyStripeSignature(rawBody: string, signatureHeader: string | null | undefined, secret: string, toleranceSec?: number): Promise<boolean>;
|
|
11
11
|
/** Verifies Lemon Squeezy webhook signature (X-Signature header) */
|
|
12
12
|
export declare function verifyLemonSqueezySignature(rawBody: string, signatureHeader: string | null | undefined, secret: string): Promise<boolean>;
|
|
13
|
-
/** Verifies Polar webhook signature (webhook-signature header) */
|
|
14
|
-
export declare function verifyPolarSignature(rawBody: string, signatureHeader: string | null | undefined, secret: string
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
/** Verifies Polar webhook signature (webhook-signature header with optional Standard Webhooks headers) */
|
|
14
|
+
export declare function verifyPolarSignature(rawBody: string, signatureHeader: string | null | undefined, secret: string, options?: {
|
|
15
|
+
timestamp?: string | null;
|
|
16
|
+
webhookId?: string | null;
|
|
17
|
+
toleranceSec?: number;
|
|
18
|
+
}): Promise<boolean>;
|
|
19
|
+
/** Verifies Paddle Billing webhook signature (Paddle-Signature header: `ts=TIMESTAMP;h1=HMAC_HEX`) with replay protection */
|
|
20
|
+
export declare function verifyPaddleSignature(rawBody: string, signatureHeader: string | null | undefined, secret: string, toleranceSec?: number): Promise<boolean>;
|
|
17
21
|
export declare function processPaymentWebhook(event: RequestEvent, rawBody: string): Promise<{
|
|
18
22
|
success: boolean;
|
|
19
23
|
eventType?: string;
|
|
@@ -26,12 +30,30 @@ export declare function processPaymentWebhook(event: RequestEvent, rawBody: stri
|
|
|
26
30
|
/**
|
|
27
31
|
* Creates a Stripe checkout session via Stripe REST API. Runs 100% edge-native on Cloudflare
|
|
28
32
|
* Workers using standard `fetch`.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const { url } = await createCheckoutSession(event, {
|
|
37
|
+
* planId: "pro_monthly",
|
|
38
|
+
* successUrl: "https://example.com/billing?success=true",
|
|
39
|
+
* cancelUrl: "https://example.com/pricing",
|
|
40
|
+
* })
|
|
41
|
+
* ```
|
|
29
42
|
*/
|
|
30
43
|
export declare function createCheckoutSession(event: RequestEvent, options: CreateCheckoutOptions): Promise<{
|
|
31
44
|
id: string;
|
|
32
45
|
url: string;
|
|
33
46
|
}>;
|
|
34
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Creates a Customer Billing Portal session for the current user.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* const { url } = await createCustomerPortalSession(event, {
|
|
53
|
+
* returnUrl: "https://example.com/settings/billing",
|
|
54
|
+
* })
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
35
57
|
export declare function createCustomerPortalSession(event: RequestEvent, options?: {
|
|
36
58
|
returnUrl?: string;
|
|
37
59
|
}): Promise<{
|
|
@@ -65,7 +87,17 @@ export declare function changePlan(event: RequestEvent, subscriptionId: string,
|
|
|
65
87
|
subscriptionId: string;
|
|
66
88
|
planId: string;
|
|
67
89
|
}>;
|
|
68
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* Gets the current active subscription for a user or organization from D1.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* const sub = await getSubscription(event)
|
|
96
|
+
* if (sub?.status === "active") {
|
|
97
|
+
* console.log("Plan:", sub.planId)
|
|
98
|
+
* }
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
69
101
|
export declare function getSubscription(event: RequestEvent, options?: {
|
|
70
102
|
userId?: string;
|
|
71
103
|
orgId?: string;
|
|
@@ -76,18 +108,25 @@ export interface RequireSubscriptionOptions {
|
|
|
76
108
|
status?: SubscriptionStatus[];
|
|
77
109
|
message?: string;
|
|
78
110
|
}
|
|
79
|
-
/**
|
|
111
|
+
/**
|
|
112
|
+
* Server guard: throws 402 Payment Required if caller has no active subscription.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts
|
|
116
|
+
* const sub = await requireSubscription(event, { plan: "pro" })
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
80
119
|
export declare function requireSubscription(event: RequestEvent, options?: RequireSubscriptionOptions): Promise<QarpeoSubscription>;
|
|
81
120
|
/**
|
|
82
121
|
* Checks whether the current user or organization's active subscription plan includes a specific
|
|
83
122
|
* feature flag.
|
|
84
123
|
*
|
|
85
124
|
* @example
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
125
|
+
* ```ts
|
|
126
|
+
* if (!(await hasFeature(event, "custom_domain"))) {
|
|
127
|
+
* throw createError({ statusCode: 403, message: "Custom domains require Pro plan" })
|
|
128
|
+
* }
|
|
129
|
+
* ```
|
|
91
130
|
*/
|
|
92
131
|
export declare function hasFeature(event: RequestEvent, feature: string): Promise<boolean>;
|
|
93
132
|
/**
|