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
|
@@ -71,55 +71,136 @@ export async function purgeCacheTag(...tags) {
|
|
|
71
71
|
}
|
|
72
72
|
return Array.from(purgedKeys);
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (
|
|
77
|
-
|
|
74
|
+
function serializeCacheArg(arg) {
|
|
75
|
+
if (arg === null || arg === void 0) return "";
|
|
76
|
+
if (typeof arg === "object") {
|
|
77
|
+
try {
|
|
78
|
+
return JSON.stringify(arg);
|
|
79
|
+
} catch {
|
|
80
|
+
return String(arg);
|
|
81
|
+
}
|
|
78
82
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (opts
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
return String(arg);
|
|
84
|
+
}
|
|
85
|
+
function resolveFunctionCacheKey(fn, opts, args = []) {
|
|
86
|
+
if (opts?.getKey) {
|
|
87
|
+
const custom = opts.getKey(...args);
|
|
88
|
+
const prefix = opts.name || (typeof opts.key === "string" ? opts.key : "") || fn.name || "cache";
|
|
89
|
+
return `${prefix}:${custom}`.replace(/^:+|:+$/g, "");
|
|
86
90
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
91
|
+
if (typeof opts?.key === "function") {
|
|
92
|
+
return opts.key(...args);
|
|
93
|
+
}
|
|
94
|
+
if (typeof opts?.key === "string") {
|
|
95
|
+
if (args.length === 0) return opts.key;
|
|
96
|
+
return `${opts.key}:${args.map(serializeCacheArg).join(":")}`;
|
|
97
|
+
}
|
|
98
|
+
if (opts?.name) {
|
|
99
|
+
if (args.length === 0) return opts.name;
|
|
100
|
+
return `${opts.name}:${args.map(serializeCacheArg).join(":")}`;
|
|
101
|
+
}
|
|
102
|
+
const base = fn.name || "cache";
|
|
103
|
+
if (args.length === 0) return base;
|
|
104
|
+
return `${base}:${args.map(serializeCacheArg).join(":")}`;
|
|
105
|
+
}
|
|
106
|
+
function resolveDurationSec(opts) {
|
|
107
|
+
const duration = opts?.maxAge ?? opts?.ttl;
|
|
108
|
+
return duration ? parseDurationSeconds(duration) : 3600;
|
|
109
|
+
}
|
|
110
|
+
function resolveSwrSec(opts, ttlSec = 3600) {
|
|
111
|
+
if (opts?.swr === true) {
|
|
112
|
+
return ttlSec * 2;
|
|
113
|
+
}
|
|
114
|
+
if (opts?.swr) {
|
|
115
|
+
return parseDurationSeconds(opts.swr);
|
|
116
|
+
}
|
|
117
|
+
return 0;
|
|
118
|
+
}
|
|
119
|
+
function resolveCacheTags(opts, args = []) {
|
|
120
|
+
if (typeof opts?.tags === "function") {
|
|
121
|
+
return opts.tags(...args);
|
|
122
|
+
}
|
|
123
|
+
if (Array.isArray(opts?.tags) && opts.tags.length > 0) {
|
|
124
|
+
return opts.tags;
|
|
125
|
+
}
|
|
126
|
+
return void 0;
|
|
127
|
+
}
|
|
128
|
+
function createCachedFunction(fn, opts) {
|
|
129
|
+
const ttlSec = resolveDurationSec(opts);
|
|
130
|
+
const swrSec = resolveSwrSec(opts, ttlSec);
|
|
131
|
+
return async (...args) => {
|
|
132
|
+
const storage = useCacheStorage();
|
|
133
|
+
if (!storage) {
|
|
134
|
+
return await fn(...args);
|
|
135
|
+
}
|
|
136
|
+
const key = resolveFunctionCacheKey(fn, opts, args);
|
|
137
|
+
const cleanKey = key.replace(/^\/+/, "");
|
|
138
|
+
const tags = resolveCacheTags(opts, args);
|
|
139
|
+
try {
|
|
140
|
+
const raw = await storage.getItem(cleanKey);
|
|
141
|
+
if (raw !== null && typeof raw === "object" && "value" in raw && "expiresAt" in raw) {
|
|
142
|
+
const entry = raw;
|
|
143
|
+
const now = Date.now();
|
|
144
|
+
if (now < entry.expiresAt) {
|
|
145
|
+
return entry.value;
|
|
146
|
+
}
|
|
147
|
+
if (entry.swrUntil && now < entry.swrUntil) {
|
|
148
|
+
Promise.resolve(fn(...args)).then(async (freshValue) => {
|
|
149
|
+
await setCacheItem(cleanKey, freshValue, {
|
|
150
|
+
ttl: ttlSec,
|
|
151
|
+
swr: swrSec,
|
|
152
|
+
tags
|
|
153
|
+
});
|
|
154
|
+
}).catch(() => {
|
|
103
155
|
});
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
156
|
+
return entry.value;
|
|
157
|
+
}
|
|
158
|
+
} else if (raw !== null && raw !== void 0) {
|
|
159
|
+
return raw;
|
|
107
160
|
}
|
|
108
|
-
}
|
|
109
|
-
return raw;
|
|
161
|
+
} catch {
|
|
110
162
|
}
|
|
111
|
-
|
|
163
|
+
const value = await fn(...args);
|
|
164
|
+
try {
|
|
165
|
+
await setCacheItem(cleanKey, value, {
|
|
166
|
+
ttl: ttlSec,
|
|
167
|
+
swr: swrSec,
|
|
168
|
+
tags
|
|
169
|
+
});
|
|
170
|
+
} catch {
|
|
171
|
+
}
|
|
172
|
+
return value;
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
export function defineCachedFunction(fn, options) {
|
|
176
|
+
return createCachedFunction(fn, options);
|
|
177
|
+
}
|
|
178
|
+
export function rememberCache(arg1, arg2, arg3) {
|
|
179
|
+
if (typeof arg1 === "string") {
|
|
180
|
+
let fetcher;
|
|
181
|
+
let opts = {};
|
|
182
|
+
if (typeof arg2 === "function") {
|
|
183
|
+
fetcher = arg2;
|
|
184
|
+
opts = typeof arg3 === "object" ? arg3 : arg3 !== void 0 ? { maxAge: arg3 } : {};
|
|
185
|
+
} else if (typeof arg3 === "function") {
|
|
186
|
+
fetcher = arg3;
|
|
187
|
+
opts = typeof arg2 === "object" ? arg2 : arg2 !== void 0 ? { maxAge: arg2 } : {};
|
|
188
|
+
}
|
|
189
|
+
if (!fetcher) {
|
|
190
|
+
throw new TypeError("rememberCache requires a fetcher function");
|
|
191
|
+
}
|
|
192
|
+
const cachedFn = createCachedFunction(fetcher, { key: arg1, ...opts });
|
|
193
|
+
return cachedFn();
|
|
112
194
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
} catch {
|
|
195
|
+
if (typeof arg1 === "function") {
|
|
196
|
+
const opts = typeof arg2 === "object" ? arg2 : arg2 !== void 0 ? { maxAge: arg2 } : {};
|
|
197
|
+
const cachedFn = createCachedFunction(arg1, opts);
|
|
198
|
+
const callable = (...args) => cachedFn(...args);
|
|
199
|
+
callable.then = (onResolve, onReject) => cachedFn().then(onResolve, onReject);
|
|
200
|
+
callable.catch = (onReject) => cachedFn().catch(onReject);
|
|
201
|
+
return callable;
|
|
121
202
|
}
|
|
122
|
-
|
|
203
|
+
throw new TypeError("Invalid arguments passed to rememberCache");
|
|
123
204
|
}
|
|
124
205
|
export async function getCacheItem(key) {
|
|
125
206
|
const storage = useCacheStorage();
|
|
@@ -145,26 +226,22 @@ export async function setCacheItem(key, value, ttlOrOptions) {
|
|
|
145
226
|
const storage = useCacheStorage();
|
|
146
227
|
if (!storage) return;
|
|
147
228
|
const cleanKey = key.replace(/^\/+/, "");
|
|
148
|
-
const opts = typeof ttlOrOptions === "object" ? ttlOrOptions : {
|
|
149
|
-
const durationSec =
|
|
150
|
-
|
|
151
|
-
if (opts.swr === true) {
|
|
152
|
-
swrSec = durationSec * 2;
|
|
153
|
-
} else if (opts.swr) {
|
|
154
|
-
swrSec = parseDurationSeconds(opts.swr);
|
|
155
|
-
}
|
|
229
|
+
const opts = typeof ttlOrOptions === "object" ? ttlOrOptions : { maxAge: ttlOrOptions };
|
|
230
|
+
const durationSec = resolveDurationSec(opts);
|
|
231
|
+
const swrSec = resolveSwrSec(opts, durationSec);
|
|
156
232
|
const now = Date.now();
|
|
157
233
|
const expiresAt = now + durationSec * 1e3;
|
|
158
234
|
const swrUntil = swrSec > 0 ? expiresAt + swrSec * 1e3 : void 0;
|
|
235
|
+
const tags = resolveCacheTags(opts);
|
|
159
236
|
const entry = {
|
|
160
237
|
value,
|
|
161
238
|
expiresAt,
|
|
162
239
|
...swrUntil ? { swrUntil } : {},
|
|
163
|
-
...
|
|
240
|
+
...tags ? { tags } : {}
|
|
164
241
|
};
|
|
165
242
|
await storage.setItem(cleanKey, entry);
|
|
166
|
-
if (
|
|
167
|
-
for (const tag of
|
|
243
|
+
if (tags && tags.length > 0) {
|
|
244
|
+
for (const tag of tags) {
|
|
168
245
|
const tagIndexKey = `${TAG_INDEX_PREFIX}${tag}`;
|
|
169
246
|
try {
|
|
170
247
|
const existing = await storage.getItem(tagIndexKey);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type RequestEvent } from "nuxt/server";
|
|
2
|
+
import type { CMSCollection, CMSFieldDefinition } from "../../../../types";
|
|
3
|
+
import { getCMSConfig } from "./common";
|
|
4
|
+
export declare function rowToCollection(row: Record<string, unknown>, config?: ReturnType<typeof getCMSConfig>): CMSCollection;
|
|
5
|
+
/** Returns a single collection by ID. Reads from KV (TTL 5 min) with D1 fallback. */
|
|
6
|
+
export declare function getCMSCollection(event: RequestEvent, collectionId: string): Promise<CMSCollection | null>;
|
|
7
|
+
/** Lists all collections from D1. */
|
|
8
|
+
export declare function listCMSCollections(event: RequestEvent): Promise<CMSCollection[]>;
|
|
9
|
+
/** Creates a new collection in D1 (from CMS Admin, source: 'db'). */
|
|
10
|
+
export declare function createCMSCollection(event: RequestEvent, data: {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
fields?: Record<string, CMSFieldDefinition>;
|
|
15
|
+
}): Promise<CMSCollection>;
|
|
16
|
+
/** Updates a collection schema in D1. Invalidates KV cache. */
|
|
17
|
+
export declare function updateCMSCollection(event: RequestEvent, id: string, data: {
|
|
18
|
+
name?: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
fields?: Record<string, CMSFieldDefinition>;
|
|
21
|
+
}): Promise<void>;
|
|
22
|
+
/** Deletes a collection from D1. Only source: 'db' collections can be deleted. Invalidates KV cache. */
|
|
23
|
+
export declare function deleteCMSCollection(event: RequestEvent, id: string): Promise<void>;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { createError } from "nuxt/server";
|
|
2
|
+
import { getKVBinding } from "../../../kv.mjs";
|
|
3
|
+
import {
|
|
4
|
+
getCMSDb,
|
|
5
|
+
getCMSConfig,
|
|
6
|
+
getCMSTenantPrefix,
|
|
7
|
+
cmsCollectionTbl
|
|
8
|
+
} from "./common.mjs";
|
|
9
|
+
import { ensureCMSSynced } from "./sync.mjs";
|
|
10
|
+
export function rowToCollection(row, config) {
|
|
11
|
+
let fields;
|
|
12
|
+
try {
|
|
13
|
+
fields = JSON.parse(row.schema_json || "{}");
|
|
14
|
+
} catch {
|
|
15
|
+
fields = {};
|
|
16
|
+
}
|
|
17
|
+
const id = row.id;
|
|
18
|
+
const resolvedConfig = config || getCMSConfig();
|
|
19
|
+
const colCfg = resolvedConfig.collections?.[id];
|
|
20
|
+
return {
|
|
21
|
+
id,
|
|
22
|
+
name: row.name,
|
|
23
|
+
description: row.description,
|
|
24
|
+
schemaJson: row.schema_json,
|
|
25
|
+
fields,
|
|
26
|
+
source: row.source,
|
|
27
|
+
order: row.order ?? 0,
|
|
28
|
+
singleton: colCfg?.singleton,
|
|
29
|
+
tenantId: row.tenant_id || void 0,
|
|
30
|
+
createdAt: row.created_at,
|
|
31
|
+
updatedAt: row.updated_at
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export async function getCMSCollection(event, collectionId) {
|
|
35
|
+
const config = getCMSConfig(event);
|
|
36
|
+
const tenantPrefix = getCMSTenantPrefix(event);
|
|
37
|
+
if (config.cache) {
|
|
38
|
+
try {
|
|
39
|
+
const kv = getKVBinding("KV", event);
|
|
40
|
+
const cached = await kv.get(`${tenantPrefix}cms:schema:${collectionId}`, {
|
|
41
|
+
type: "json"
|
|
42
|
+
});
|
|
43
|
+
if (cached) return cached;
|
|
44
|
+
} catch {
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const db = getCMSDb(event);
|
|
48
|
+
const row = await db.prepare(`SELECT * FROM ${cmsCollectionTbl(event)} WHERE id = ?`).bind(collectionId).first();
|
|
49
|
+
if (!row) return null;
|
|
50
|
+
const collection = rowToCollection(row);
|
|
51
|
+
if (config.cache) {
|
|
52
|
+
try {
|
|
53
|
+
const kv = getKVBinding("KV", event);
|
|
54
|
+
await kv.put(`${tenantPrefix}cms:schema:${collectionId}`, JSON.stringify(collection), {
|
|
55
|
+
expirationTtl: 300
|
|
56
|
+
});
|
|
57
|
+
} catch {
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return collection;
|
|
61
|
+
}
|
|
62
|
+
export async function listCMSCollections(event) {
|
|
63
|
+
await ensureCMSSynced(event).catch(() => {
|
|
64
|
+
});
|
|
65
|
+
const db = getCMSDb(event);
|
|
66
|
+
if (db) {
|
|
67
|
+
try {
|
|
68
|
+
const results = await db.prepare(`SELECT * FROM ${cmsCollectionTbl(event)} ORDER BY "order" ASC, name ASC`).all();
|
|
69
|
+
return (results.results || []).map(
|
|
70
|
+
(r) => rowToCollection(r)
|
|
71
|
+
);
|
|
72
|
+
} catch {
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
const { manifestCollections } = await import("#qarpeo/cms/manifest");
|
|
77
|
+
if (manifestCollections) {
|
|
78
|
+
return Object.entries(manifestCollections).map(([id, cfg]) => ({
|
|
79
|
+
id,
|
|
80
|
+
name: cfg.name || id.charAt(0).toUpperCase() + id.slice(1).replace(/-/g, " "),
|
|
81
|
+
description: cfg.description,
|
|
82
|
+
schemaJson: JSON.stringify(cfg.fields || {}),
|
|
83
|
+
fields: cfg.fields || {},
|
|
84
|
+
source: "config",
|
|
85
|
+
order: cfg.order ?? 0,
|
|
86
|
+
createdAt: 0,
|
|
87
|
+
updatedAt: 0
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
} catch {
|
|
91
|
+
}
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
export async function createCMSCollection(event, data) {
|
|
95
|
+
const db = getCMSDb(event);
|
|
96
|
+
const now = Date.now();
|
|
97
|
+
const schemaJson = JSON.stringify(data.fields || {});
|
|
98
|
+
await db.prepare(
|
|
99
|
+
`INSERT INTO ${cmsCollectionTbl(event)} (id, name, description, schema_json, source, created_at, updated_at) VALUES (?, ?, ?, ?, 'db', ?, ?)`
|
|
100
|
+
).bind(data.id, data.name, data.description ?? null, schemaJson, now, now).run();
|
|
101
|
+
return {
|
|
102
|
+
id: data.id,
|
|
103
|
+
name: data.name,
|
|
104
|
+
description: data.description ?? null,
|
|
105
|
+
schemaJson,
|
|
106
|
+
fields: data.fields,
|
|
107
|
+
source: "db",
|
|
108
|
+
createdAt: now,
|
|
109
|
+
updatedAt: now
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
export async function updateCMSCollection(event, id, data) {
|
|
113
|
+
const db = getCMSDb(event);
|
|
114
|
+
const now = Date.now();
|
|
115
|
+
const schemaJson = JSON.stringify(data.fields || {});
|
|
116
|
+
await db.prepare(
|
|
117
|
+
`UPDATE ${cmsCollectionTbl(event)} SET name = COALESCE(?, name), description = COALESCE(?, description), schema_json = ?, updated_at = ? WHERE id = ?`
|
|
118
|
+
).bind(data.name ?? null, data.description ?? null, schemaJson, now, id).run();
|
|
119
|
+
try {
|
|
120
|
+
const kv = getKVBinding("KV", event);
|
|
121
|
+
const tenantPrefix = getCMSTenantPrefix(event);
|
|
122
|
+
await kv.delete(`${tenantPrefix}cms:schema:${id}`);
|
|
123
|
+
} catch {
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
export async function deleteCMSCollection(event, id) {
|
|
127
|
+
const db = getCMSDb(event);
|
|
128
|
+
const row = await db.prepare(`SELECT source FROM ${cmsCollectionTbl(event)} WHERE id = ?`).bind(id).first();
|
|
129
|
+
if (!row) throw createError({ statusCode: 404, message: `Collection '${id}' not found` });
|
|
130
|
+
if (row.source === "config") {
|
|
131
|
+
throw createError({
|
|
132
|
+
statusCode: 403,
|
|
133
|
+
message: "Cannot delete a config-seeded collection from the API. Remove it from nuxt.config.ts instead."
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
await db.prepare(`DELETE FROM ${cmsCollectionTbl(event)} WHERE id = ?`).bind(id).run();
|
|
137
|
+
try {
|
|
138
|
+
const kv = getKVBinding("KV", event);
|
|
139
|
+
const tenantPrefix = getCMSTenantPrefix(event);
|
|
140
|
+
await kv.delete(`${tenantPrefix}cms:schema:${id}`);
|
|
141
|
+
} catch {
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -2,6 +2,15 @@ import { type RequestEvent } from "nuxt/server";
|
|
|
2
2
|
import type { CMSOptions, CMSCollectionConfig, CMSGitHubConfig, CMSDeployTriggerConfig, CMSApprovalConfig, CMSCommentsConfig } from "../../../../types";
|
|
3
3
|
import { nanoid } from "../crypto";
|
|
4
4
|
export { nanoid };
|
|
5
|
+
export declare function cmsCollectionTbl(event?: RequestEvent): string;
|
|
6
|
+
export declare function cmsEntryTbl(event?: RequestEvent): string;
|
|
7
|
+
export declare function cmsRevisionTbl(event?: RequestEvent): string;
|
|
8
|
+
export declare function cmsCategoryTbl(event?: RequestEvent): string;
|
|
9
|
+
export declare function cmsTagTbl(event?: RequestEvent): string;
|
|
10
|
+
export declare function cmsBookmarkTbl(event?: RequestEvent): string;
|
|
11
|
+
export declare function cmsSubscriberTbl(event?: RequestEvent): string;
|
|
12
|
+
export declare function cmsCommentTbl(event?: RequestEvent): string;
|
|
13
|
+
export declare function cmsEntryFtsTbl(event?: RequestEvent): string;
|
|
5
14
|
export declare function getCMSDb(event?: RequestEvent): any;
|
|
6
15
|
export declare function getCMSConfig(event?: RequestEvent): Omit<Required<CMSOptions>, "github" | "deploy" | "approval" | "exclude" | "webhookSecret" | "roles"> & {
|
|
7
16
|
collections: Record<string, CMSCollectionConfig>;
|
|
@@ -1,7 +1,35 @@
|
|
|
1
1
|
import { useRuntimeConfig } from "nuxt/server";
|
|
2
2
|
import { getD1Binding } from "../../../db.mjs";
|
|
3
3
|
import { nanoid } from "../crypto.mjs";
|
|
4
|
+
import { resolveTableName } from "../table-names.mjs";
|
|
4
5
|
export { nanoid };
|
|
6
|
+
export function cmsCollectionTbl(event) {
|
|
7
|
+
return resolveTableName("cms_collection", event);
|
|
8
|
+
}
|
|
9
|
+
export function cmsEntryTbl(event) {
|
|
10
|
+
return resolveTableName("cms_entry", event);
|
|
11
|
+
}
|
|
12
|
+
export function cmsRevisionTbl(event) {
|
|
13
|
+
return resolveTableName("cms_revision", event);
|
|
14
|
+
}
|
|
15
|
+
export function cmsCategoryTbl(event) {
|
|
16
|
+
return resolveTableName("cms_category", event);
|
|
17
|
+
}
|
|
18
|
+
export function cmsTagTbl(event) {
|
|
19
|
+
return resolveTableName("cms_tag", event);
|
|
20
|
+
}
|
|
21
|
+
export function cmsBookmarkTbl(event) {
|
|
22
|
+
return resolveTableName("cms_bookmark", event);
|
|
23
|
+
}
|
|
24
|
+
export function cmsSubscriberTbl(event) {
|
|
25
|
+
return resolveTableName("cms_subscriber", event);
|
|
26
|
+
}
|
|
27
|
+
export function cmsCommentTbl(event) {
|
|
28
|
+
return resolveTableName("comment", event);
|
|
29
|
+
}
|
|
30
|
+
export function cmsEntryFtsTbl(event) {
|
|
31
|
+
return `${cmsEntryTbl(event)}_fts`;
|
|
32
|
+
}
|
|
5
33
|
export function getCMSDb(event) {
|
|
6
34
|
try {
|
|
7
35
|
return getD1Binding("DB", event);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { timingSafeEqualString } from "../crypto.mjs";
|
|
2
|
-
import { computeContentHash, getCMSConfig, getCMSDb } from "./common.mjs";
|
|
2
|
+
import { computeContentHash, getCMSConfig, getCMSDb, cmsEntryTbl } from "./common.mjs";
|
|
3
3
|
function toBase64(str) {
|
|
4
4
|
if (typeof Buffer !== "undefined") {
|
|
5
5
|
return Buffer.from(str, "utf8").toString("base64");
|
|
@@ -52,7 +52,7 @@ export async function syncEntryToGit(event, collectionId, entry, action) {
|
|
|
52
52
|
if (e.id) {
|
|
53
53
|
const db = getCMSDb(event);
|
|
54
54
|
await db.prepare(
|
|
55
|
-
|
|
55
|
+
`UPDATE ${cmsEntryTbl(event)} SET file_path = ?, content_hash = ?, source = 'file' WHERE id = ?`
|
|
56
56
|
).bind(resolvedFsPath, contentHash, e.id).run();
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type RequestEvent } from "nuxt/server";
|
|
2
|
+
import type { CMSEntry, CMSEntryStatus, CMSNavigationItem, CMSNavigationOptions } from "../../../../types";
|
|
3
|
+
/**
|
|
4
|
+
* Fetches a single "page" collection entry by its computed URL path. e.g. path =
|
|
5
|
+
* "/docs/getting-started". Supports draft preview via editor session, HMAC preview token, or
|
|
6
|
+
* preview cookie.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getCMSEntryByPath(event: RequestEvent, collectionId: string, path: string, locale?: string, options?: {
|
|
9
|
+
preview?: boolean;
|
|
10
|
+
previewToken?: string;
|
|
11
|
+
previewExpires?: string | number;
|
|
12
|
+
fields?: string[] | string;
|
|
13
|
+
}): Promise<CMSEntry | null>;
|
|
14
|
+
/**
|
|
15
|
+
* Returns [prev, next] entries surrounding the given path, sorted by `order` ASC. Fields can be
|
|
16
|
+
* restricted to a subset (e.g. ["description"]).
|
|
17
|
+
*/
|
|
18
|
+
export declare function getCMSEntrySurroundings(event: RequestEvent, collectionId: string, path: string, fields?: string[]): Promise<[CMSEntry | null, CMSEntry | null]>;
|
|
19
|
+
/**
|
|
20
|
+
* Builds a recursive navigation tree for a "page" collection from D1 entries. Uses the `path`,
|
|
21
|
+
* `order`, `navigation` metadata stored at sync time. Returns an array compatible with @nuxt/ui's
|
|
22
|
+
* <UContentNavigation>.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getCMSNavigationTree(event: RequestEvent, collectionId: string, options?: CMSNavigationOptions): Promise<CMSNavigationItem[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Server-side chainable query builder for CMS collections. Queries directly against D1 / SQLite
|
|
27
|
+
* with KV caching, with zero HTTP fetch overhead.
|
|
28
|
+
*
|
|
29
|
+
* Usage: const page = await queryCollection(event, "docs").path("/docs/intro").first() const posts
|
|
30
|
+
* = await queryCollection(event, "blog").order("published_at", "DESC").limit(10).all()
|
|
31
|
+
*/
|
|
32
|
+
export declare function queryCollection(event: RequestEvent, collection: string): {
|
|
33
|
+
select(...fields: string[]): /*elided*/ any;
|
|
34
|
+
locale(loc: string): /*elided*/ any;
|
|
35
|
+
path(p: string): /*elided*/ any;
|
|
36
|
+
limit(n: number): /*elided*/ any;
|
|
37
|
+
page(n: number): /*elided*/ any;
|
|
38
|
+
order(field: string, direction?: "ASC" | "DESC"): /*elided*/ any;
|
|
39
|
+
where(field: string, value: any): /*elided*/ any;
|
|
40
|
+
status(s: "all" | CMSEntryStatus): /*elided*/ any;
|
|
41
|
+
tag(t: string): /*elided*/ any;
|
|
42
|
+
preview(enabled?: boolean): /*elided*/ any;
|
|
43
|
+
first(): Promise<CMSEntry | null>;
|
|
44
|
+
all(): Promise<CMSEntry[]>;
|
|
45
|
+
count(): Promise<number>;
|
|
46
|
+
};
|