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
|
@@ -46,7 +46,7 @@ export default defineEventHandler(async (event) => {
|
|
|
46
46
|
const now = Date.now();
|
|
47
47
|
const normalizedDomain = domain ? domain.toLowerCase().trim() : null;
|
|
48
48
|
await d1.prepare(`
|
|
49
|
-
INSERT INTO
|
|
49
|
+
INSERT INTO sso_connection (
|
|
50
50
|
id, organization_id, provider_type, name, domain, client_id, client_secret, issuer, sso_url, token_url, userinfo_url, cert, enabled, created_at, updated_at
|
|
51
51
|
)
|
|
52
52
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?)
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
declare const _default: import("nuxt/server").EventHandler<Promise<
|
|
2
|
-
sent: boolean;
|
|
3
|
-
expiresAt: number;
|
|
4
|
-
error: string;
|
|
5
|
-
} | {
|
|
6
|
-
sent: boolean;
|
|
7
|
-
expiresAt: number;
|
|
8
|
-
error?: undefined;
|
|
9
|
-
}>>;
|
|
1
|
+
declare const _default: import("nuxt/server").EventHandler<Promise<import("../../../utils/passwordless").SendOTPResult>>;
|
|
10
2
|
export default _default;
|
|
@@ -2,6 +2,7 @@ import { defineEventHandler, readBody, createError } from "nuxt/server";
|
|
|
2
2
|
import { getQarpeoConfig } from "../../../utils/config.mjs";
|
|
3
3
|
import { sendOTPCode } from "../../../utils/passwordless.mjs";
|
|
4
4
|
import { requireTurnstile } from "../../../utils/turnstile.mjs";
|
|
5
|
+
import { assertRateLimit, getClientIp } from "../../../utils/ratelimit.mjs";
|
|
5
6
|
export default defineEventHandler(async (event) => {
|
|
6
7
|
const body = await readBody(event);
|
|
7
8
|
const email = body?.email;
|
|
@@ -17,6 +18,13 @@ export default defineEventHandler(async (event) => {
|
|
|
17
18
|
if (turnstileProtect) {
|
|
18
19
|
await requireTurnstile(event, body?.turnstileToken);
|
|
19
20
|
}
|
|
21
|
+
const ip = getClientIp(event);
|
|
22
|
+
await assertRateLimit(event, {
|
|
23
|
+
key: `auth:otp:send:ip:${ip}`,
|
|
24
|
+
max: 10,
|
|
25
|
+
window: "10m",
|
|
26
|
+
message: "Too many OTP requests from this IP address. Please try again later."
|
|
27
|
+
});
|
|
20
28
|
const result = await sendOTPCode(event, email);
|
|
21
29
|
if (!result.sent) {
|
|
22
30
|
throw createError({
|
|
@@ -38,12 +38,12 @@ export default defineEventHandler(async (event) => {
|
|
|
38
38
|
}
|
|
39
39
|
let connection = null;
|
|
40
40
|
if (connectionId) {
|
|
41
|
-
connection = await d1.prepare("SELECT * FROM
|
|
41
|
+
connection = await d1.prepare("SELECT * FROM sso_connection WHERE id = ? AND enabled = 1 LIMIT 1").bind(connectionId).first();
|
|
42
42
|
} else if (domain) {
|
|
43
|
-
connection = await d1.prepare("SELECT * FROM
|
|
43
|
+
connection = await d1.prepare("SELECT * FROM sso_connection WHERE domain = ? AND enabled = 1 LIMIT 1").bind(domain).first();
|
|
44
44
|
} else if (orgSlug) {
|
|
45
45
|
connection = await d1.prepare(`
|
|
46
|
-
SELECT c.* FROM
|
|
46
|
+
SELECT c.* FROM sso_connection c
|
|
47
47
|
JOIN organization o ON c.organization_id = o.id
|
|
48
48
|
WHERE o.slug = ? AND c.enabled = 1
|
|
49
49
|
LIMIT 1
|
|
@@ -45,7 +45,7 @@ export default defineEventHandler(async (event) => {
|
|
|
45
45
|
const bindingName = globalThis.process?.env?.QARPEO_DEFAULT_DB_BINDING || "DB";
|
|
46
46
|
const d1 = getD1Binding(bindingName, event);
|
|
47
47
|
const now = Date.now();
|
|
48
|
-
const connection = await d1.prepare("SELECT * FROM
|
|
48
|
+
const connection = await d1.prepare("SELECT * FROM sso_connection WHERE id = ? LIMIT 1").bind(connectionId).first();
|
|
49
49
|
if (!connection) {
|
|
50
50
|
throw createError({
|
|
51
51
|
statusCode: 404,
|
|
@@ -49,12 +49,12 @@ export default defineEventHandler(async (event) => {
|
|
|
49
49
|
const now = Date.now();
|
|
50
50
|
let connection = null;
|
|
51
51
|
if (connectionId) {
|
|
52
|
-
connection = await d1.prepare("SELECT * FROM
|
|
52
|
+
connection = await d1.prepare("SELECT * FROM sso_connection WHERE id = ? LIMIT 1").bind(connectionId).first();
|
|
53
53
|
}
|
|
54
54
|
const assertion = parseSAMLResponse(samlResponse);
|
|
55
55
|
const email = assertion.email;
|
|
56
56
|
if (!connection && assertion.issuer) {
|
|
57
|
-
connection = await d1.prepare("SELECT * FROM
|
|
57
|
+
connection = await d1.prepare("SELECT * FROM sso_connection WHERE issuer = ? AND enabled = 1 LIMIT 1").bind(assertion.issuer).first();
|
|
58
58
|
}
|
|
59
59
|
if (!connection || !connection.cert) {
|
|
60
60
|
throw createError({
|
|
@@ -6,7 +6,7 @@ export default defineEventHandler(async (event) => {
|
|
|
6
6
|
const rpID = reqUrl.hostname;
|
|
7
7
|
const options = await generateAuthenticationOptions({
|
|
8
8
|
rpID,
|
|
9
|
-
userVerification: "
|
|
9
|
+
userVerification: "required"
|
|
10
10
|
});
|
|
11
11
|
try {
|
|
12
12
|
const kv = getKVBinding("KV", event);
|
|
@@ -39,8 +39,8 @@ export default defineEventHandler(async (event) => {
|
|
|
39
39
|
attestationType: "none",
|
|
40
40
|
excludeCredentials,
|
|
41
41
|
authenticatorSelection: {
|
|
42
|
-
residentKey: "
|
|
43
|
-
userVerification: "
|
|
42
|
+
residentKey: "required",
|
|
43
|
+
userVerification: "required"
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
try {
|
|
@@ -9,7 +9,7 @@ export default defineEventHandler(async (event) => {
|
|
|
9
9
|
const id = getRouterParam(event, "id");
|
|
10
10
|
const db = getD1Binding("DB", event);
|
|
11
11
|
const entryRow = await db.prepare(
|
|
12
|
-
"SELECT id, slug, path FROM
|
|
12
|
+
"SELECT id, slug, path FROM cms_entry WHERE collection_id = ? AND (id = ? OR slug = ?) LIMIT 1"
|
|
13
13
|
).bind(collection, id, id).first();
|
|
14
14
|
const targetIdentifier = entryRow?.slug || id;
|
|
15
15
|
const { token, expires } = await generatePreviewToken(event, collection, targetIdentifier);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineEventHandler, getRouterParam } from "nuxt/server";
|
|
2
2
|
import { getCloudflareEnv } from "../../../../bindings.mjs";
|
|
3
3
|
import { buildAtomXml, formatISO8601, rowToFeedEntry } from "../../../utils/feed.mjs";
|
|
4
|
+
import { resolveTableName } from "../../../utils/table-names.mjs";
|
|
4
5
|
export default defineEventHandler(async (event) => {
|
|
5
6
|
const collection = getRouterParam(event, "collection") || "";
|
|
6
7
|
const runtimeConfig = globalThis.__NUXT_RUNTIME_CONFIG__ || {};
|
|
@@ -27,7 +28,8 @@ export default defineEventHandler(async (event) => {
|
|
|
27
28
|
const env = getCloudflareEnv(event);
|
|
28
29
|
const d1Binding = env.DB || env.DATABASE || env.d1;
|
|
29
30
|
if (d1Binding && typeof d1Binding.prepare === "function") {
|
|
30
|
-
const
|
|
31
|
+
const entryTbl = resolveTableName("cms_entry", event);
|
|
32
|
+
const query = `SELECT id, slug, path, collection, title, description, tags, published_at, created_at, updated_at, author_id FROM ${entryTbl} WHERE status = 'published' AND visibility = 'public' AND collection = ? ORDER BY published_at DESC, created_at DESC LIMIT ?`;
|
|
31
33
|
const stmt = d1Binding.prepare(query);
|
|
32
34
|
const res = await stmt.bind(collection, maxItems).all();
|
|
33
35
|
const rows = res?.results || [];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineEventHandler, getRouterParam } from "nuxt/server";
|
|
2
2
|
import { getCloudflareEnv } from "../../../../bindings.mjs";
|
|
3
3
|
import { buildRSSXml, rowToFeedEntry } from "../../../utils/feed.mjs";
|
|
4
|
+
import { resolveTableName } from "../../../utils/table-names.mjs";
|
|
4
5
|
export default defineEventHandler(async (event) => {
|
|
5
6
|
const collection = getRouterParam(event, "collection") || "";
|
|
6
7
|
const runtimeConfig = globalThis.__NUXT_RUNTIME_CONFIG__ || {};
|
|
@@ -27,7 +28,8 @@ export default defineEventHandler(async (event) => {
|
|
|
27
28
|
const env = getCloudflareEnv(event);
|
|
28
29
|
const d1Binding = env.DB || env.DATABASE || env.d1;
|
|
29
30
|
if (d1Binding && typeof d1Binding.prepare === "function") {
|
|
30
|
-
const
|
|
31
|
+
const entryTbl = resolveTableName("cms_entry", event);
|
|
32
|
+
const query = `SELECT id, slug, path, collection, title, description, tags, published_at, created_at, updated_at, author_id FROM ${entryTbl} WHERE status = 'published' AND visibility = 'public' AND collection = ? ORDER BY published_at DESC, created_at DESC LIMIT ?`;
|
|
31
33
|
const stmt = d1Binding.prepare(query);
|
|
32
34
|
const res = await stmt.bind(collection, maxItems).all();
|
|
33
35
|
const rows = res?.results || [];
|
|
@@ -8,7 +8,7 @@ export default defineEventHandler(async (event) => {
|
|
|
8
8
|
}
|
|
9
9
|
const auth = await getAuthContext(event).catch(() => null);
|
|
10
10
|
const isPrivileged = Boolean(
|
|
11
|
-
auth?.isAdmin || auth?.role && ["admin", "
|
|
11
|
+
auth?.isAdmin || auth?.role && ["admin", "super"].includes(auth.role)
|
|
12
12
|
);
|
|
13
13
|
const userId = auth?.user?.id || event.context?.user?.id;
|
|
14
14
|
if (!userId && !isPrivileged) {
|
|
@@ -5,7 +5,7 @@ export default defineEventHandler(async (event) => {
|
|
|
5
5
|
const auth = await getAuthContext(event).catch(() => null);
|
|
6
6
|
const body = await readBody(event);
|
|
7
7
|
const isPrivileged = Boolean(
|
|
8
|
-
auth?.isAdmin || auth?.role && ["admin", "
|
|
8
|
+
auth?.isAdmin || auth?.role && ["admin", "super"].includes(auth.role)
|
|
9
9
|
);
|
|
10
10
|
const userId = isPrivileged && body?.userId ? String(body.userId) : auth?.user?.id || event.context?.user?.id;
|
|
11
11
|
if (!userId) {
|
|
@@ -5,7 +5,7 @@ export default defineEventHandler(async (event) => {
|
|
|
5
5
|
const auth = await getAuthContext(event).catch(() => null);
|
|
6
6
|
const query = getQuery(event);
|
|
7
7
|
const isPrivileged = Boolean(
|
|
8
|
-
auth?.isAdmin || auth?.role && ["admin", "
|
|
8
|
+
auth?.isAdmin || auth?.role && ["admin", "super"].includes(auth.role)
|
|
9
9
|
);
|
|
10
10
|
const userId = isPrivileged && query.userId ? String(query.userId) : auth?.user?.id || event.context?.user?.id;
|
|
11
11
|
if (!userId) {
|
|
@@ -5,7 +5,7 @@ export default defineEventHandler(async (event) => {
|
|
|
5
5
|
const auth = await getAuthContext(event).catch(() => null);
|
|
6
6
|
const body = await readBody(event);
|
|
7
7
|
const isPrivileged = Boolean(
|
|
8
|
-
auth?.isAdmin || auth?.role && ["admin", "
|
|
8
|
+
auth?.isAdmin || auth?.role && ["admin", "super"].includes(auth.role)
|
|
9
9
|
);
|
|
10
10
|
const userId = isPrivileged && body?.userId ? String(body.userId) : auth?.user?.id || event.context?.user?.id;
|
|
11
11
|
if (!userId) {
|
|
@@ -2,7 +2,7 @@ import { defineEventHandler, createError } from "nuxt/server";
|
|
|
2
2
|
import { getCMSConfig } from "../../utils/cms.mjs";
|
|
3
3
|
import { requireAuth } from "../../utils/context.mjs";
|
|
4
4
|
export default defineEventHandler(async (event) => {
|
|
5
|
-
await requireAuth(event, { role: ["admin", "
|
|
5
|
+
await requireAuth(event, { role: ["admin", "super"] });
|
|
6
6
|
const config = getCMSConfig(event);
|
|
7
7
|
if (!config.deploy) {
|
|
8
8
|
throw createError({ statusCode: 400, message: "No deploy trigger configured" });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineEventHandler } from "nuxt/server";
|
|
2
2
|
import { getD1Binding } from "../../../db.mjs";
|
|
3
|
-
import { getCMSConfig, formatFrontmatter, computeContentHash } from "../../utils/cms.mjs";
|
|
3
|
+
import { getCMSConfig, formatFrontmatter, computeContentHash, cmsEntryTbl } from "../../utils/cms.mjs";
|
|
4
4
|
import { requireAuth } from "../../utils/context.mjs";
|
|
5
5
|
export default defineEventHandler(async (event) => {
|
|
6
6
|
const config = getCMSConfig(event);
|
|
@@ -20,7 +20,8 @@ export default defineEventHandler(async (event) => {
|
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
const db = getD1Binding("DB", event);
|
|
23
|
-
const
|
|
23
|
+
const entryTbl = cmsEntryTbl(event);
|
|
24
|
+
const rows = await db.prepare(`SELECT * FROM ${entryTbl} ORDER BY collection_id, slug`).all();
|
|
24
25
|
const entries = rows.results || [];
|
|
25
26
|
let exported = 0;
|
|
26
27
|
const baseContentDir = resolvePath(config.contentDir || "content");
|
|
@@ -55,7 +56,7 @@ export default defineEventHandler(async (event) => {
|
|
|
55
56
|
await writeFile(filePath, fileContent, "utf8");
|
|
56
57
|
const newHash = await computeContentHash(fileContent);
|
|
57
58
|
await db.prepare(
|
|
58
|
-
|
|
59
|
+
`UPDATE ${entryTbl} SET content_hash = ?, file_path = ?, source = 'file' WHERE id = ?`
|
|
59
60
|
).bind(newHash, filePath, entry.id).run();
|
|
60
61
|
exported++;
|
|
61
62
|
}
|
|
@@ -2,7 +2,7 @@ import { defineEventHandler, getQuery } from "nuxt/server";
|
|
|
2
2
|
import { getCloudflareEnv } from "../../../bindings.mjs";
|
|
3
3
|
import { getD1Binding } from "../../../db.mjs";
|
|
4
4
|
import { similaritySearch } from "../../utils/ai.mjs";
|
|
5
|
-
import { getCMSConfig, buildFtsQuery } from "../../utils/cms.mjs";
|
|
5
|
+
import { getCMSConfig, buildFtsQuery, cmsEntryTbl, cmsEntryFtsTbl } from "../../utils/cms.mjs";
|
|
6
6
|
import { getAuthContext } from "../../utils/context.mjs";
|
|
7
7
|
export default defineEventHandler(async (event) => {
|
|
8
8
|
const query = getQuery(event);
|
|
@@ -59,12 +59,13 @@ export default defineEventHandler(async (event) => {
|
|
|
59
59
|
conditions.push(`id IN (${placeholders})`);
|
|
60
60
|
binds.push(...matchedIdsFromVectorize);
|
|
61
61
|
} else {
|
|
62
|
+
const ftsTbl = cmsEntryFtsTbl(event);
|
|
62
63
|
let ftsMatchedIds = null;
|
|
63
64
|
try {
|
|
64
65
|
const ftsQuery = buildFtsQuery(q, "AND");
|
|
65
66
|
if (ftsQuery) {
|
|
66
67
|
const ftsRes = await db.prepare(
|
|
67
|
-
|
|
68
|
+
`SELECT id FROM ${ftsTbl} WHERE ${ftsTbl} MATCH ? ORDER BY rank LIMIT 100`
|
|
68
69
|
).bind(ftsQuery).all();
|
|
69
70
|
const ids = (ftsRes.results || []).map((r) => r.id).filter(Boolean);
|
|
70
71
|
if (ids.length > 0) {
|
|
@@ -73,7 +74,7 @@ export default defineEventHandler(async (event) => {
|
|
|
73
74
|
const ftsOrQuery = buildFtsQuery(q, "OR");
|
|
74
75
|
if (ftsOrQuery && ftsOrQuery !== ftsQuery) {
|
|
75
76
|
const orRes = await db.prepare(
|
|
76
|
-
|
|
77
|
+
`SELECT id FROM ${ftsTbl} WHERE ${ftsTbl} MATCH ? ORDER BY rank LIMIT 100`
|
|
77
78
|
).bind(ftsOrQuery).all();
|
|
78
79
|
const orIds = (orRes.results || []).map((r) => r.id).filter(Boolean);
|
|
79
80
|
if (orIds.length > 0) {
|
|
@@ -97,13 +98,14 @@ export default defineEventHandler(async (event) => {
|
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
100
|
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
101
|
+
const entryTbl = cmsEntryTbl(event);
|
|
100
102
|
const [countRes, dataRes] = await Promise.all([
|
|
101
|
-
db.prepare(`SELECT COUNT(*) as total FROM
|
|
103
|
+
db.prepare(`SELECT COUNT(*) as total FROM ${entryTbl} ${where}`).bind(...binds).first(),
|
|
102
104
|
db.prepare(
|
|
103
105
|
`SELECT id, collection_id, slug, title, description, cover_image, tags, "order",
|
|
104
106
|
content_md, content_html, metadata_json, status, source, file_path,
|
|
105
107
|
locale, published_at, created_at, updated_at
|
|
106
|
-
FROM
|
|
108
|
+
FROM ${entryTbl} ${where}
|
|
107
109
|
ORDER BY published_at DESC LIMIT ? OFFSET ?`
|
|
108
110
|
).bind(...binds, limit, offset).all()
|
|
109
111
|
]);
|
|
@@ -3,7 +3,8 @@ import { getCMSConfig, seedCollectionsFromConfig, syncLocalContentFiles } from "
|
|
|
3
3
|
import { requireAuth } from "../../utils/context.mjs";
|
|
4
4
|
export default defineEventHandler(async (event) => {
|
|
5
5
|
const config = getCMSConfig(event);
|
|
6
|
-
|
|
6
|
+
const allowedRoles = config.roles && config.roles.length > 0 ? config.roles : ["admin", "super"];
|
|
7
|
+
await requireAuth(event, { role: allowedRoles });
|
|
7
8
|
await seedCollectionsFromConfig(event, config.collections);
|
|
8
9
|
const syncResult = await syncLocalContentFiles(
|
|
9
10
|
event,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { createError, defineEventHandler, getRouterParam, readBody } from "nuxt/server";
|
|
2
|
-
import {
|
|
2
|
+
import { getComment, reactToComment } from "../../../utils/comments.mjs";
|
|
3
3
|
import { getAuthContext } from "../../../utils/context.mjs";
|
|
4
4
|
import { assertRateLimit } from "../../../utils/ratelimit.mjs";
|
|
5
5
|
export default defineEventHandler(async (event) => {
|
|
6
|
-
await ensureCommentsTables(event);
|
|
7
6
|
const id = getRouterParam(event, "id");
|
|
8
7
|
if (!id) {
|
|
9
8
|
throw createError({ statusCode: 400, statusMessage: "Missing comment id" });
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createError, defineEventHandler, getRouterParam, readBody } from "nuxt/server";
|
|
2
2
|
import {
|
|
3
|
-
ensureCommentsTables,
|
|
4
3
|
getComment,
|
|
5
4
|
reportComment
|
|
6
5
|
} from "../../../utils/comments.mjs";
|
|
@@ -14,7 +13,6 @@ const ALLOWED_REASONS = [
|
|
|
14
13
|
"other"
|
|
15
14
|
];
|
|
16
15
|
export default defineEventHandler(async (event) => {
|
|
17
|
-
await ensureCommentsTables(event);
|
|
18
16
|
const id = getRouterParam(event, "id");
|
|
19
17
|
if (!id) {
|
|
20
18
|
throw createError({ statusCode: 400, statusMessage: "Missing comment id" });
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createError, defineEventHandler, getRouterParam } from "nuxt/server";
|
|
2
|
-
import { deleteComment,
|
|
2
|
+
import { deleteComment, getComment } from "../../utils/comments.mjs";
|
|
3
3
|
import { getAuthContext } from "../../utils/context.mjs";
|
|
4
|
+
import { getTenant } from "../../utils/tenant.mjs";
|
|
4
5
|
export default defineEventHandler(async (event) => {
|
|
5
|
-
await ensureCommentsTables(event);
|
|
6
6
|
const id = getRouterParam(event, "id");
|
|
7
7
|
if (!id) {
|
|
8
8
|
throw createError({ statusCode: 400, statusMessage: "Missing comment id" });
|
|
@@ -11,10 +11,14 @@ export default defineEventHandler(async (event) => {
|
|
|
11
11
|
if (!existing) {
|
|
12
12
|
throw createError({ statusCode: 404, statusMessage: "Comment not found" });
|
|
13
13
|
}
|
|
14
|
+
const activeTenant = getTenant(event);
|
|
15
|
+
if (activeTenant && existing.tenantId && existing.tenantId !== activeTenant.id) {
|
|
16
|
+
throw createError({ statusCode: 404, statusMessage: "Comment not found" });
|
|
17
|
+
}
|
|
14
18
|
const auth = await getAuthContext(event).catch(() => null);
|
|
15
19
|
const role = auth?.user?.role || "";
|
|
16
|
-
const isModerator = role === "admin" || role === "
|
|
17
|
-
const isAuthor = auth?.user?.email && existing.authorEmail && auth.user.email === existing.authorEmail;
|
|
20
|
+
const isModerator = role === "admin" || role === "super" || role === "moderator";
|
|
21
|
+
const isAuthor = auth?.user?.id && existing.authorId && auth.user.id === existing.authorId || auth?.user?.email && existing.authorEmail && auth.user.email === existing.authorEmail;
|
|
18
22
|
if (!isModerator && !isAuthor) {
|
|
19
23
|
throw createError({
|
|
20
24
|
statusCode: 403,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createError, defineEventHandler, getRouterParam } from "nuxt/server";
|
|
2
|
-
import {
|
|
2
|
+
import { getComment } from "../../utils/comments.mjs";
|
|
3
3
|
export default defineEventHandler(async (event) => {
|
|
4
|
-
await ensureCommentsTables(event);
|
|
5
4
|
const id = getRouterParam(event, "id");
|
|
6
5
|
if (!id) {
|
|
7
6
|
throw createError({ statusCode: 400, statusMessage: "Missing comment id" });
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { createError, defineEventHandler, getRouterParam, readBody } from "nuxt/server";
|
|
2
2
|
import {
|
|
3
|
-
ensureCommentsTables,
|
|
4
3
|
getComment,
|
|
5
4
|
updateCommentStatus
|
|
6
5
|
} from "../../utils/comments.mjs";
|
|
7
6
|
import { getAuthContext } from "../../utils/context.mjs";
|
|
7
|
+
import { getTenant } from "../../utils/tenant.mjs";
|
|
8
8
|
export default defineEventHandler(async (event) => {
|
|
9
|
-
await ensureCommentsTables(event);
|
|
10
9
|
const id = getRouterParam(event, "id");
|
|
11
10
|
if (!id) {
|
|
12
11
|
throw createError({ statusCode: 400, statusMessage: "Missing comment id" });
|
|
13
12
|
}
|
|
14
13
|
const auth = await getAuthContext(event).catch(() => null);
|
|
15
14
|
const role = auth?.user?.role || "";
|
|
16
|
-
const isModerator = role === "admin" || role === "
|
|
15
|
+
const isModerator = role === "admin" || role === "super" || role === "moderator";
|
|
17
16
|
if (!isModerator) {
|
|
18
17
|
throw createError({
|
|
19
18
|
statusCode: 403,
|
|
@@ -32,6 +31,10 @@ export default defineEventHandler(async (event) => {
|
|
|
32
31
|
if (!existing) {
|
|
33
32
|
throw createError({ statusCode: 404, statusMessage: "Comment not found" });
|
|
34
33
|
}
|
|
34
|
+
const activeTenant = getTenant(event);
|
|
35
|
+
if (activeTenant && existing.tenantId && existing.tenantId !== activeTenant.id) {
|
|
36
|
+
throw createError({ statusCode: 404, statusMessage: "Comment not found" });
|
|
37
|
+
}
|
|
35
38
|
const updated = await updateCommentStatus(id, body.status, event);
|
|
36
39
|
return { comment: updated };
|
|
37
40
|
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createError, defineEventHandler, readBody } from "nuxt/server";
|
|
2
|
+
import {
|
|
3
|
+
batchModerateComments
|
|
4
|
+
} from "../../utils/comments.mjs";
|
|
5
|
+
import { getAuthContext } from "../../utils/context.mjs";
|
|
6
|
+
const ALLOWED_ACTIONS = ["approve", "spam", "delete"];
|
|
7
|
+
export default defineEventHandler(async (event) => {
|
|
8
|
+
const auth = await getAuthContext(event).catch(() => null);
|
|
9
|
+
const role = auth?.user?.role || "";
|
|
10
|
+
const isModerator = role === "admin" || role === "super" || role === "moderator";
|
|
11
|
+
if (!isModerator) {
|
|
12
|
+
throw createError({
|
|
13
|
+
statusCode: 403,
|
|
14
|
+
statusMessage: "Forbidden",
|
|
15
|
+
message: "Moderator or admin privileges required to perform batch comment moderation."
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
const body = await readBody(event) || {};
|
|
19
|
+
if (!body.action || !ALLOWED_ACTIONS.includes(body.action)) {
|
|
20
|
+
throw createError({
|
|
21
|
+
statusCode: 400,
|
|
22
|
+
statusMessage: "Invalid action. Must be one of: approve, spam, delete."
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
if (!Array.isArray(body.ids) || body.ids.length === 0) {
|
|
26
|
+
throw createError({
|
|
27
|
+
statusCode: 400,
|
|
28
|
+
statusMessage: "ids array is required and must not be empty."
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
const result = await batchModerateComments(body, event);
|
|
32
|
+
return result;
|
|
33
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineEventHandler, getQuery } from "nuxt/server";
|
|
2
|
-
import { queryComments,
|
|
2
|
+
import { queryComments, validateTargetUrn } from "../../utils/comments.mjs";
|
|
3
3
|
import { getAuthContext } from "../../utils/context.mjs";
|
|
4
|
+
import { getTenant } from "../../utils/tenant.mjs";
|
|
4
5
|
export default defineEventHandler(async (event) => {
|
|
5
|
-
await ensureCommentsTables(event);
|
|
6
6
|
const query = getQuery(event);
|
|
7
7
|
const targetUrn = String(query.targetUrn || "");
|
|
8
8
|
if (!targetUrn) {
|
|
@@ -10,7 +10,7 @@ export default defineEventHandler(async (event) => {
|
|
|
10
10
|
}
|
|
11
11
|
validateTargetUrn(targetUrn);
|
|
12
12
|
const auth = await getAuthContext(event).catch(() => null);
|
|
13
|
-
const isAdmin = auth?.user?.role === "admin" || auth?.user?.role === "
|
|
13
|
+
const isAdmin = auth?.user?.role === "admin" || auth?.user?.role === "super" || auth?.user?.role === "moderator";
|
|
14
14
|
let status = "approved";
|
|
15
15
|
if (isAdmin && query.status) {
|
|
16
16
|
const raw = String(query.status);
|
|
@@ -19,6 +19,8 @@ export default defineEventHandler(async (event) => {
|
|
|
19
19
|
const limit = Math.min(Number(query.limit) || 50, 200);
|
|
20
20
|
const offset = Number(query.offset) || 0;
|
|
21
21
|
const threaded = query.threaded !== "false";
|
|
22
|
+
const activeTenant = getTenant(event);
|
|
23
|
+
const tenantId = activeTenant ? activeTenant.id : query.tenantId ? String(query.tenantId) : void 0;
|
|
22
24
|
return queryComments(
|
|
23
25
|
{
|
|
24
26
|
targetUrn,
|
|
@@ -26,7 +28,7 @@ export default defineEventHandler(async (event) => {
|
|
|
26
28
|
limit,
|
|
27
29
|
offset,
|
|
28
30
|
threaded,
|
|
29
|
-
tenantId
|
|
31
|
+
tenantId,
|
|
30
32
|
orderBy: query.order === "asc" ? "asc" : "desc"
|
|
31
33
|
},
|
|
32
34
|
event
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { createError, defineEventHandler, readBody } from "nuxt/server";
|
|
2
2
|
import {
|
|
3
3
|
createComment,
|
|
4
|
-
ensureCommentsTables,
|
|
5
4
|
validateTargetUrn,
|
|
6
5
|
getCommentsConfig
|
|
7
6
|
} from "../../utils/comments.mjs";
|
|
8
7
|
import { getAuthContext } from "../../utils/context.mjs";
|
|
8
|
+
import { getTenant } from "../../utils/tenant.mjs";
|
|
9
9
|
export default defineEventHandler(async (event) => {
|
|
10
|
-
await ensureCommentsTables(event);
|
|
11
10
|
const body = await readBody(event) || {};
|
|
12
11
|
if (!body.targetUrn) {
|
|
13
12
|
throw createError({ statusCode: 400, statusMessage: "targetUrn is required." });
|
|
@@ -25,9 +24,14 @@ export default defineEventHandler(async (event) => {
|
|
|
25
24
|
if (!body.content || !body.content.trim()) {
|
|
26
25
|
throw createError({ statusCode: 400, statusMessage: "content is required." });
|
|
27
26
|
}
|
|
27
|
+
const activeTenant = getTenant(event);
|
|
28
|
+
const tenantId = activeTenant ? activeTenant.id : body.tenantId;
|
|
28
29
|
const comment = await createComment(
|
|
29
30
|
{
|
|
30
31
|
...body,
|
|
32
|
+
tenantId,
|
|
33
|
+
authorId: auth?.user?.id ?? body.authorId,
|
|
34
|
+
authorEmail: body.authorEmail ?? auth?.user?.email,
|
|
31
35
|
authorName
|
|
32
36
|
},
|
|
33
37
|
event
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineEventHandler } from "nuxt/server";
|
|
2
2
|
import { getCloudflareEnv } from "../../bindings.mjs";
|
|
3
3
|
import { buildRSSXml, rowToFeedEntry } from "../utils/feed.mjs";
|
|
4
|
+
import { resolveTableName } from "../utils/table-names.mjs";
|
|
4
5
|
export default defineEventHandler(async (event) => {
|
|
5
6
|
const runtimeConfig = globalThis.__NUXT_RUNTIME_CONFIG__ || {};
|
|
6
7
|
const site = runtimeConfig.public?.qarpeo?.site || {};
|
|
@@ -26,7 +27,8 @@ export default defineEventHandler(async (event) => {
|
|
|
26
27
|
const env = getCloudflareEnv(event);
|
|
27
28
|
const d1Binding = env.DB || env.DATABASE || env.d1;
|
|
28
29
|
if (d1Binding && typeof d1Binding.prepare === "function") {
|
|
29
|
-
|
|
30
|
+
const entryTbl = resolveTableName("cms_entry", event);
|
|
31
|
+
let query = `SELECT id, slug, path, collection, title, description, tags, published_at, created_at, updated_at, author_id FROM ${entryTbl} WHERE status = 'published' AND visibility = 'public'`;
|
|
30
32
|
const params = [];
|
|
31
33
|
if (feedConfig.collections?.length) {
|
|
32
34
|
const placeholders = feedConfig.collections.map(() => "?").join(", ");
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineEventHandler } from "nuxt/server";
|
|
2
2
|
import { getCloudflareEnv } from "../../bindings.mjs";
|
|
3
|
+
import { resolveTableName } from "../utils/table-names.mjs";
|
|
3
4
|
function matchesPattern(path, pattern) {
|
|
4
5
|
const regexPattern = pattern.replace(/\*\*/g, ".*").replace(/\*/g, "[^/]*").replace(/\//g, "\\/");
|
|
5
6
|
return new RegExp(`^${regexPattern}$`).test(path);
|
|
@@ -25,8 +26,9 @@ export default defineEventHandler(async (event) => {
|
|
|
25
26
|
const env = getCloudflareEnv(event);
|
|
26
27
|
const d1Binding = env.DB || env.DATABASE || env.d1;
|
|
27
28
|
if (d1Binding && typeof d1Binding.prepare === "function") {
|
|
29
|
+
const entryTbl = resolveTableName("cms_entry", event);
|
|
28
30
|
const stmt = d1Binding.prepare(
|
|
29
|
-
|
|
31
|
+
`SELECT slug, path, collection, updated_at FROM ${entryTbl} WHERE status = 'published' AND visibility = 'public'`
|
|
30
32
|
);
|
|
31
33
|
const res = await stmt.all();
|
|
32
34
|
if (res && Array.isArray(res.results)) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* POST /api/storage/presigned-r2
|
|
3
|
+
*
|
|
4
|
+
* Generates a **true R2 presigned URL** so the client can PUT a file directly to
|
|
5
|
+
* Cloudflare R2 without routing the bytes through the Worker. The endpoint
|
|
6
|
+
* mirrors the security model of `presigned.post.ts` (HMAC-ticket) but returns a
|
|
7
|
+
* native R2 presigned URL instead.
|
|
8
|
+
*
|
|
9
|
+
* Body: { pathname: string, contentType?: string, expiresIn?: string | number }
|
|
10
|
+
* Response: { url: string, key: string, expiresAt: number }
|
|
11
|
+
*/
|
|
12
|
+
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
13
|
+
url: string;
|
|
14
|
+
key: string;
|
|
15
|
+
expiresAt: number;
|
|
16
|
+
}>>;
|
|
17
|
+
export default _default;
|