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
package/dist/chunks/wrangler.mjs
DELETED
|
@@ -1,897 +0,0 @@
|
|
|
1
|
-
import { spawnSync } from 'node:child_process';
|
|
2
|
-
import { existsSync, statSync, readdirSync, readFileSync } from 'node:fs';
|
|
3
|
-
import { createRequire } from 'node:module';
|
|
4
|
-
import { drizzle } from 'drizzle-orm/node-sqlite';
|
|
5
|
-
import { resolve, dirname, join, extname, basename, relative } from 'pathe';
|
|
6
|
-
import { stdin, stdout } from 'node:process';
|
|
7
|
-
import readline from 'node:readline/promises';
|
|
8
|
-
import { fileURLToPath } from 'node:url';
|
|
9
|
-
import { mkdir, writeFile, readFile } from 'node:fs/promises';
|
|
10
|
-
import { defu } from 'defu';
|
|
11
|
-
|
|
12
|
-
const version = "0.1.34";
|
|
13
|
-
|
|
14
|
-
function scanSchemaExports(schemaFiles) {
|
|
15
|
-
const types = [];
|
|
16
|
-
const zod = [];
|
|
17
|
-
for (const file of schemaFiles) {
|
|
18
|
-
let src;
|
|
19
|
-
try {
|
|
20
|
-
src = readFileSync(file, "utf-8");
|
|
21
|
-
} catch {
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
for (const m of src.matchAll(/^export\s+type\s+([A-Z][A-Za-z0-9_]*)\b/gm)) {
|
|
25
|
-
types.push({ name: m[1], file });
|
|
26
|
-
}
|
|
27
|
-
for (const m of src.matchAll(/^export\s+const\s+([a-z][A-Za-z0-9_]*Schema)\b/gm)) {
|
|
28
|
-
zod.push({ name: m[1], file });
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return { types, zod };
|
|
32
|
-
}
|
|
33
|
-
function checkDrizzleVersion(rootDir) {
|
|
34
|
-
try {
|
|
35
|
-
let req;
|
|
36
|
-
let entry;
|
|
37
|
-
try {
|
|
38
|
-
req = createRequire(resolve(rootDir, "package.json"));
|
|
39
|
-
entry = req.resolve("drizzle-orm");
|
|
40
|
-
} catch {
|
|
41
|
-
req = createRequire(import.meta.url);
|
|
42
|
-
entry = req.resolve("drizzle-orm");
|
|
43
|
-
}
|
|
44
|
-
let dir = dirname(entry);
|
|
45
|
-
let pkgJsonPath = null;
|
|
46
|
-
while (dir !== dirname(dir)) {
|
|
47
|
-
const candidate = resolve(dir, "package.json");
|
|
48
|
-
if (existsSync(candidate)) {
|
|
49
|
-
try {
|
|
50
|
-
const pkg2 = JSON.parse(readFileSync(candidate, "utf-8"));
|
|
51
|
-
if (pkg2.name === "drizzle-orm") {
|
|
52
|
-
pkgJsonPath = candidate;
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
} catch {
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
dir = dirname(dir);
|
|
59
|
-
}
|
|
60
|
-
if (!pkgJsonPath) {
|
|
61
|
-
return {
|
|
62
|
-
installed: false,
|
|
63
|
-
isRC: false,
|
|
64
|
-
error: `[qarpeo] Could not locate drizzle-orm package.json.`
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
const pkg = JSON.parse(readFileSync(pkgJsonPath, "utf-8"));
|
|
68
|
-
const version = pkg.version || "";
|
|
69
|
-
const isLegacy = version.startsWith("0.");
|
|
70
|
-
if (isLegacy) {
|
|
71
|
-
return {
|
|
72
|
-
installed: true,
|
|
73
|
-
version,
|
|
74
|
-
isRC: false,
|
|
75
|
-
error: `[qarpeo] Outdated "drizzle-orm" detected in your project (v${version}).
|
|
76
|
-
qarpeo requires Drizzle ORM v1.0.0 RC (drizzle-orm@rc) or newer.
|
|
77
|
-
Please remove or upgrade your project's drizzle-orm dependency:
|
|
78
|
-
vp add drizzle-orm@rc`
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
return {
|
|
82
|
-
installed: true,
|
|
83
|
-
version,
|
|
84
|
-
isRC: true
|
|
85
|
-
};
|
|
86
|
-
} catch {
|
|
87
|
-
return {
|
|
88
|
-
installed: false,
|
|
89
|
-
isRC: false,
|
|
90
|
-
error: `[qarpeo] Drizzle ORM is enabled (db: { orm: 'drizzle' }), but "drizzle-orm" could not be resolved.
|
|
91
|
-
Please ensure qarpeo dependencies are installed.`
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
function findSchemaFiles(layers) {
|
|
96
|
-
const schemaFiles = /* @__PURE__ */ new Set();
|
|
97
|
-
for (const layer of layers) {
|
|
98
|
-
const baseDirs = /* @__PURE__ */ new Set();
|
|
99
|
-
if (layer.config?.srcDir) baseDirs.add(layer.config.srcDir);
|
|
100
|
-
if (layer.config?.rootDir) baseDirs.add(layer.config.rootDir);
|
|
101
|
-
if (layer.cwd) baseDirs.add(layer.cwd);
|
|
102
|
-
for (const baseDir of baseDirs) {
|
|
103
|
-
const dbSchemaFile = resolve(baseDir, "server/db/schema.ts");
|
|
104
|
-
if (existsSync(dbSchemaFile)) {
|
|
105
|
-
schemaFiles.add(dbSchemaFile);
|
|
106
|
-
}
|
|
107
|
-
const dbSchemaDir = resolve(baseDir, "server/db/schema");
|
|
108
|
-
if (existsSync(dbSchemaDir) && statSync(dbSchemaDir).isDirectory()) {
|
|
109
|
-
const indexFile = resolve(dbSchemaDir, "index.ts");
|
|
110
|
-
if (existsSync(indexFile)) {
|
|
111
|
-
schemaFiles.add(indexFile);
|
|
112
|
-
} else {
|
|
113
|
-
for (const file of readdirSync(dbSchemaDir)) {
|
|
114
|
-
if (file.endsWith(".ts") && !file.endsWith(".d.ts")) {
|
|
115
|
-
schemaFiles.add(resolve(dbSchemaDir, file));
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
const databaseSchemaFile = resolve(baseDir, "server/database/schema.ts");
|
|
121
|
-
if (existsSync(databaseSchemaFile)) {
|
|
122
|
-
schemaFiles.add(databaseSchemaFile);
|
|
123
|
-
}
|
|
124
|
-
const databaseSchemaDir = resolve(baseDir, "server/database/schema");
|
|
125
|
-
if (existsSync(databaseSchemaDir) && statSync(databaseSchemaDir).isDirectory()) {
|
|
126
|
-
const indexFile = resolve(databaseSchemaDir, "index.ts");
|
|
127
|
-
if (existsSync(indexFile)) {
|
|
128
|
-
schemaFiles.add(indexFile);
|
|
129
|
-
} else {
|
|
130
|
-
for (const file of readdirSync(databaseSchemaDir)) {
|
|
131
|
-
if (file.endsWith(".ts") && !file.endsWith(".d.ts")) {
|
|
132
|
-
schemaFiles.add(resolve(databaseSchemaDir, file));
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
const serverSchema = resolve(baseDir, "server/schema.ts");
|
|
138
|
-
if (existsSync(serverSchema)) {
|
|
139
|
-
schemaFiles.add(serverSchema);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
return Array.from(schemaFiles);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
function spawnBinSync(bin, args, options = {}) {
|
|
147
|
-
const isWindows = process.platform === "win32";
|
|
148
|
-
const env = {
|
|
149
|
-
...process.env,
|
|
150
|
-
...options.env,
|
|
151
|
-
WRANGLER_HIDE_BANNER: "true"
|
|
152
|
-
};
|
|
153
|
-
if (isWindows && (bin.endsWith(".cmd") || bin.endsWith(".bat"))) {
|
|
154
|
-
const cmd = process.env.ComSpec || "cmd.exe";
|
|
155
|
-
return spawnSync(cmd, ["/d", "/s", "/c", bin, ...args], {
|
|
156
|
-
...options,
|
|
157
|
-
env,
|
|
158
|
-
shell: false
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
return spawnSync(bin, args, { ...options, env, shell: false });
|
|
162
|
-
}
|
|
163
|
-
function isPackageInstalled(packageName, cwd = process.cwd()) {
|
|
164
|
-
const localDir = resolve(cwd, "node_modules", packageName);
|
|
165
|
-
const rootDir = resolve(cwd, "../node_modules", packageName);
|
|
166
|
-
if (existsSync(localDir) || existsSync(rootDir)) {
|
|
167
|
-
return true;
|
|
168
|
-
}
|
|
169
|
-
try {
|
|
170
|
-
const req = createRequire(resolve(cwd, "package.json"));
|
|
171
|
-
req.resolve(packageName);
|
|
172
|
-
return true;
|
|
173
|
-
} catch {
|
|
174
|
-
try {
|
|
175
|
-
const selfReq = createRequire(import.meta.url);
|
|
176
|
-
selfReq.resolve(packageName);
|
|
177
|
-
return true;
|
|
178
|
-
} catch {
|
|
179
|
-
return false;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
function resolveBinaryPath(binName, cwd = process.cwd()) {
|
|
184
|
-
const isWindows = process.platform === "win32";
|
|
185
|
-
const actualBin = isWindows ? `${binName}.cmd` : binName;
|
|
186
|
-
const localBin = resolve(cwd, "node_modules/.bin", actualBin);
|
|
187
|
-
if (existsSync(localBin)) return localBin;
|
|
188
|
-
const rootBin = resolve(cwd, "../node_modules/.bin", actualBin);
|
|
189
|
-
if (existsSync(rootBin)) return rootBin;
|
|
190
|
-
try {
|
|
191
|
-
let currentDir = dirname(fileURLToPath(import.meta.url));
|
|
192
|
-
while (currentDir !== dirname(currentDir)) {
|
|
193
|
-
const binCandidate = resolve(currentDir, "node_modules/.bin", actualBin);
|
|
194
|
-
if (existsSync(binCandidate)) {
|
|
195
|
-
return binCandidate;
|
|
196
|
-
}
|
|
197
|
-
currentDir = dirname(currentDir);
|
|
198
|
-
}
|
|
199
|
-
} catch {
|
|
200
|
-
}
|
|
201
|
-
return null;
|
|
202
|
-
}
|
|
203
|
-
async function confirmInstall(packageName, purpose) {
|
|
204
|
-
if (!stdin.isTTY) {
|
|
205
|
-
return false;
|
|
206
|
-
}
|
|
207
|
-
const rl = readline.createInterface({ input: stdin, output: stdout });
|
|
208
|
-
try {
|
|
209
|
-
const answer = await rl.question(
|
|
210
|
-
`
|
|
211
|
-
\u{1F4E6} [qarpeo] "${packageName}" is required for ${purpose}.
|
|
212
|
-
Would you like to install it now? (Y/n): `
|
|
213
|
-
);
|
|
214
|
-
return answer.trim().toLowerCase() !== "n";
|
|
215
|
-
} finally {
|
|
216
|
-
rl.close();
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
async function ensurePackage(packageName, options = {}) {
|
|
220
|
-
const cwd = options?.cwd || process.cwd();
|
|
221
|
-
const purpose = options?.purpose || "this operation";
|
|
222
|
-
if (isPackageInstalled(packageName, cwd)) {
|
|
223
|
-
return true;
|
|
224
|
-
}
|
|
225
|
-
const confirmed = await confirmInstall(packageName, purpose);
|
|
226
|
-
if (!confirmed) {
|
|
227
|
-
console.error(
|
|
228
|
-
`
|
|
229
|
-
\u274C [qarpeo] Missing dependency: "${packageName}". Please install it manually:
|
|
230
|
-
vp add ${options.dev ? "-D " : ""}${packageName}
|
|
231
|
-
`
|
|
232
|
-
);
|
|
233
|
-
return false;
|
|
234
|
-
}
|
|
235
|
-
console.log(`
|
|
236
|
-
\u26A1 [qarpeo] Installing ${packageName}...`);
|
|
237
|
-
try {
|
|
238
|
-
const { addDependency } = await import('nypm');
|
|
239
|
-
await addDependency(packageName, {
|
|
240
|
-
cwd,
|
|
241
|
-
dev: options.dev ?? true,
|
|
242
|
-
silent: false
|
|
243
|
-
});
|
|
244
|
-
console.log(`\u2705 [qarpeo] Successfully installed ${packageName}!
|
|
245
|
-
`);
|
|
246
|
-
return true;
|
|
247
|
-
} catch (err) {
|
|
248
|
-
console.error(`\u274C [qarpeo] Failed to install ${packageName}:`, err?.message || err);
|
|
249
|
-
return false;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
function findLocalD1Database(cwd) {
|
|
254
|
-
const possibleDirs = [
|
|
255
|
-
resolve(cwd, ".wrangler/state/v3/d1/miniflare-D1DatabaseObject"),
|
|
256
|
-
resolve(cwd, ".data/db")
|
|
257
|
-
];
|
|
258
|
-
for (const dir of possibleDirs) {
|
|
259
|
-
if (existsSync(dir)) {
|
|
260
|
-
const files = readdirSync(dir).filter((f) => f.endsWith(".sqlite") || f.endsWith(".db")).filter((f) => !f.endsWith("-journal") && !f.endsWith("-wal") && !f.endsWith("-shm"));
|
|
261
|
-
if (files.length === 1) {
|
|
262
|
-
return resolve(dir, files[0]);
|
|
263
|
-
}
|
|
264
|
-
if (files.length > 1) {
|
|
265
|
-
const sorted = files.map((f) => ({ path: resolve(dir, f), mtime: statSync(resolve(dir, f)).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
266
|
-
return sorted[0].path;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
return null;
|
|
271
|
-
}
|
|
272
|
-
async function getJiti(cwd) {
|
|
273
|
-
const req = createRequire(import.meta.url);
|
|
274
|
-
try {
|
|
275
|
-
const jitiEntry = req.resolve("jiti");
|
|
276
|
-
const { createJiti } = await import(jitiEntry);
|
|
277
|
-
return createJiti(cwd, { interopDefault: true });
|
|
278
|
-
} catch {
|
|
279
|
-
const jitiMod = await import('jiti');
|
|
280
|
-
return (jitiMod.createJiti || jitiMod.default || jitiMod)(cwd, { interopDefault: true });
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
async function getLocalDatabaseContext(cwd, nuxtConfig) {
|
|
284
|
-
const sqlitePath = findLocalD1Database(cwd);
|
|
285
|
-
if (!sqlitePath) {
|
|
286
|
-
throw new Error(
|
|
287
|
-
`No local D1 database found in .wrangler/state/v3/d1.
|
|
288
|
-
Please apply migrations first: qp db:migrate`
|
|
289
|
-
);
|
|
290
|
-
}
|
|
291
|
-
const layers = nuxtConfig._layers || [{ cwd, config: nuxtConfig }];
|
|
292
|
-
const schemaFiles = findSchemaFiles(layers);
|
|
293
|
-
if (schemaFiles.length === 0) {
|
|
294
|
-
throw new Error(
|
|
295
|
-
`No database schema files found. Create a schema file at server/db/schema.ts first.`
|
|
296
|
-
);
|
|
297
|
-
}
|
|
298
|
-
const jiti = await getJiti(cwd);
|
|
299
|
-
const schema = {};
|
|
300
|
-
for (const file of schemaFiles) {
|
|
301
|
-
try {
|
|
302
|
-
const mod = await jiti.import(file);
|
|
303
|
-
Object.assign(schema, mod);
|
|
304
|
-
} catch (err) {
|
|
305
|
-
console.warn(`[qarpeo] Warning: Failed to import schema file ${file}: ${err?.message || err}`);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
const db = drizzle(sqlitePath);
|
|
309
|
-
let customSeedPath = null;
|
|
310
|
-
for (const candidate of [
|
|
311
|
-
resolve(cwd, "server/db/seed.ts"),
|
|
312
|
-
resolve(cwd, "server/db/seed.js"),
|
|
313
|
-
resolve(cwd, "server/database/seed.ts"),
|
|
314
|
-
resolve(cwd, "server/database/seed.js")
|
|
315
|
-
]) {
|
|
316
|
-
if (existsSync(candidate)) {
|
|
317
|
-
customSeedPath = candidate;
|
|
318
|
-
break;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
return {
|
|
322
|
-
sqlitePath,
|
|
323
|
-
schema,
|
|
324
|
-
db,
|
|
325
|
-
customSeedPath
|
|
326
|
-
};
|
|
327
|
-
}
|
|
328
|
-
function applyD1Migrations(cwd, options = {}) {
|
|
329
|
-
const serverDir = options.serverDir || resolve(cwd, "server");
|
|
330
|
-
const migrationsDir = resolve(serverDir, "db/migrations");
|
|
331
|
-
if (!existsSync(migrationsDir)) {
|
|
332
|
-
return true;
|
|
333
|
-
}
|
|
334
|
-
try {
|
|
335
|
-
const entries = readdirSync(migrationsDir, { withFileTypes: true });
|
|
336
|
-
const hasSql = entries.some(
|
|
337
|
-
(e) => e.isFile() && e.name.endsWith(".sql") || e.isDirectory() && existsSync(resolve(migrationsDir, e.name, "migration.sql"))
|
|
338
|
-
);
|
|
339
|
-
if (!hasSql) {
|
|
340
|
-
return true;
|
|
341
|
-
}
|
|
342
|
-
} catch {
|
|
343
|
-
return true;
|
|
344
|
-
}
|
|
345
|
-
const isWindows = process.platform === "win32";
|
|
346
|
-
let execPath = resolveBinaryPath("wrangler", cwd);
|
|
347
|
-
if (!execPath) {
|
|
348
|
-
execPath = isWindows ? "wrangler.cmd" : "wrangler";
|
|
349
|
-
}
|
|
350
|
-
const dbName = options.dbName || "DB";
|
|
351
|
-
const rootWranglerPath = resolve(cwd, "wrangler.json");
|
|
352
|
-
const wranglerConfigPath = options.wranglerConfigPath || (existsSync(rootWranglerPath) ? rootWranglerPath : resolve(cwd, ".nuxt/wrangler.json"));
|
|
353
|
-
const wranglerArgs = ["d1", "migrations", "apply", dbName];
|
|
354
|
-
if (existsSync(wranglerConfigPath)) {
|
|
355
|
-
wranglerArgs.push("-c", wranglerConfigPath);
|
|
356
|
-
}
|
|
357
|
-
if (options.remote) {
|
|
358
|
-
wranglerArgs.push("--remote");
|
|
359
|
-
} else {
|
|
360
|
-
wranglerArgs.push("--local", "--persist-to", resolve(cwd, ".wrangler/state"));
|
|
361
|
-
}
|
|
362
|
-
const targetLabel = options.remote ? "remote Cloudflare D1" : "local Cloudflare D1";
|
|
363
|
-
const actionLabel = options.label || "Auto-checking";
|
|
364
|
-
console.log(`\u26A1 [qarpeo] ${actionLabel}: applying ${targetLabel} migrations...`);
|
|
365
|
-
try {
|
|
366
|
-
const result = spawnSync(execPath, wranglerArgs, {
|
|
367
|
-
cwd,
|
|
368
|
-
stdio: "inherit",
|
|
369
|
-
shell: isWindows
|
|
370
|
-
});
|
|
371
|
-
return result.status === 0;
|
|
372
|
-
} catch (err) {
|
|
373
|
-
console.warn(`\u26A0\uFE0F [qarpeo] Migration failed: ${err?.message || err}`);
|
|
374
|
-
return false;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
const localDb = {
|
|
379
|
-
__proto__: null,
|
|
380
|
-
applyD1Migrations: applyD1Migrations,
|
|
381
|
-
findLocalD1Database: findLocalD1Database,
|
|
382
|
-
getJiti: getJiti,
|
|
383
|
-
getLocalDatabaseContext: getLocalDatabaseContext
|
|
384
|
-
};
|
|
385
|
-
|
|
386
|
-
function resolveBindingName(service, override, defaultName) {
|
|
387
|
-
if (override && typeof override === "string") {
|
|
388
|
-
return override;
|
|
389
|
-
}
|
|
390
|
-
const upper = service.toUpperCase();
|
|
391
|
-
return process.env[`QARPEO_DEFAULT_${upper}_BINDING`] || process.env[`QARPEO_${upper}_BINDING`] || process.env[`${upper}_BINDING`] || defaultName || upper;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
function findJobFiles(layers, dirName = "server/jobs") {
|
|
395
|
-
const jobsMap = /* @__PURE__ */ new Map();
|
|
396
|
-
for (const layer of layers) {
|
|
397
|
-
const baseDirs = /* @__PURE__ */ new Set();
|
|
398
|
-
if (layer.config?.srcDir) baseDirs.add(layer.config.srcDir);
|
|
399
|
-
if (layer.config?.rootDir) baseDirs.add(layer.config.rootDir);
|
|
400
|
-
if (layer.cwd) baseDirs.add(layer.cwd);
|
|
401
|
-
for (const baseDir of baseDirs) {
|
|
402
|
-
const jobsDir = resolve(baseDir, dirName);
|
|
403
|
-
if (!existsSync(jobsDir)) continue;
|
|
404
|
-
try {
|
|
405
|
-
const entries = readdirSync(jobsDir);
|
|
406
|
-
for (const entry of entries) {
|
|
407
|
-
const fullPath = join(jobsDir, entry);
|
|
408
|
-
const stat = statSync(fullPath);
|
|
409
|
-
if (stat.isFile() && (entry.endsWith(".ts") || entry.endsWith(".js") || entry.endsWith(".mjs"))) {
|
|
410
|
-
if (entry.endsWith(".d.ts")) continue;
|
|
411
|
-
const ext = extname(entry);
|
|
412
|
-
const name = basename(entry, ext);
|
|
413
|
-
const importPath = fullPath.replace(/\\/g, "/").replace(/\.(ts|js|mjs)$/, "");
|
|
414
|
-
jobsMap.set(name, { name, file: fullPath, importPath });
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
} catch {
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
return Array.from(jobsMap.values());
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
function findQueueFiles(layers) {
|
|
425
|
-
const queueFiles = /* @__PURE__ */ new Set();
|
|
426
|
-
for (const layer of layers) {
|
|
427
|
-
const baseDirs = /* @__PURE__ */ new Set();
|
|
428
|
-
if (layer.config?.srcDir) baseDirs.add(layer.config.srcDir);
|
|
429
|
-
if (layer.config?.rootDir) baseDirs.add(layer.config.rootDir);
|
|
430
|
-
if (layer.cwd) baseDirs.add(layer.cwd);
|
|
431
|
-
for (const baseDir of baseDirs) {
|
|
432
|
-
const queueFile = resolve(baseDir, "server/queue.ts");
|
|
433
|
-
if (existsSync(queueFile)) {
|
|
434
|
-
queueFiles.add(queueFile);
|
|
435
|
-
}
|
|
436
|
-
const queueIndexFile = resolve(baseDir, "server/queue/index.ts");
|
|
437
|
-
if (existsSync(queueIndexFile)) {
|
|
438
|
-
queueFiles.add(queueIndexFile);
|
|
439
|
-
}
|
|
440
|
-
const queuesDir = resolve(baseDir, "server/queues");
|
|
441
|
-
if (existsSync(queuesDir)) {
|
|
442
|
-
try {
|
|
443
|
-
const files = readdirSync(queuesDir);
|
|
444
|
-
for (const file of files) {
|
|
445
|
-
if ((file.endsWith(".ts") || file.endsWith(".js") || file.endsWith(".mjs")) && !file.endsWith(".d.ts")) {
|
|
446
|
-
queueFiles.add(resolve(queuesDir, file));
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
} catch {
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
return Array.from(queueFiles);
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
function findScheduledTasks(layers, dirNames = ["server/tasks", "server/cron"]) {
|
|
458
|
-
const tasksMap = /* @__PURE__ */ new Map();
|
|
459
|
-
for (const layer of layers) {
|
|
460
|
-
const baseDirs = /* @__PURE__ */ new Set();
|
|
461
|
-
if (layer.config?.srcDir) baseDirs.add(layer.config.srcDir);
|
|
462
|
-
if (layer.config?.rootDir) baseDirs.add(layer.config.rootDir);
|
|
463
|
-
if (layer.cwd) baseDirs.add(layer.cwd);
|
|
464
|
-
for (const baseDir of baseDirs) {
|
|
465
|
-
for (const dirName of dirNames) {
|
|
466
|
-
const tasksDir = resolve(baseDir, dirName);
|
|
467
|
-
if (!existsSync(tasksDir)) continue;
|
|
468
|
-
try {
|
|
469
|
-
scanDirectory(tasksDir, tasksDir, tasksMap);
|
|
470
|
-
} catch {
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
return Array.from(tasksMap.values());
|
|
476
|
-
}
|
|
477
|
-
function scanDirectory(currentDir, rootDir, map) {
|
|
478
|
-
const entries = readdirSync(currentDir);
|
|
479
|
-
for (const entry of entries) {
|
|
480
|
-
const fullPath = join(currentDir, entry);
|
|
481
|
-
const stat = statSync(fullPath);
|
|
482
|
-
if (stat.isDirectory()) {
|
|
483
|
-
scanDirectory(fullPath, rootDir, map);
|
|
484
|
-
continue;
|
|
485
|
-
}
|
|
486
|
-
if (stat.isFile() && (entry.endsWith(".ts") || entry.endsWith(".js") || entry.endsWith(".mjs"))) {
|
|
487
|
-
if (entry.endsWith(".d.ts")) continue;
|
|
488
|
-
const relPath = fullPath.slice(rootDir.length + 1).replace(/\\/g, "/");
|
|
489
|
-
const ext = extname(relPath);
|
|
490
|
-
const taskName = relPath.slice(0, -ext.length).replace(/\//g, ":");
|
|
491
|
-
let cron;
|
|
492
|
-
let description;
|
|
493
|
-
try {
|
|
494
|
-
const content = readFileSync(fullPath, "utf8");
|
|
495
|
-
const cronMatch = content.match(/cron:\s*["']([^"']+)["']/);
|
|
496
|
-
if (cronMatch) {
|
|
497
|
-
cron = cronMatch[1];
|
|
498
|
-
}
|
|
499
|
-
const descMatch = content.match(/description:\s*["']([^"']+)["']/);
|
|
500
|
-
if (descMatch) {
|
|
501
|
-
description = descMatch[1];
|
|
502
|
-
}
|
|
503
|
-
} catch {
|
|
504
|
-
}
|
|
505
|
-
const importPath = fullPath.replace(/\\/g, "/").replace(/\.(ts|js|mjs)$/, "");
|
|
506
|
-
map.set(taskName, {
|
|
507
|
-
name: taskName,
|
|
508
|
-
file: fullPath,
|
|
509
|
-
importPath,
|
|
510
|
-
cron,
|
|
511
|
-
description
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
function resolveProjectName(nuxt, options) {
|
|
518
|
-
let rawName = "";
|
|
519
|
-
if (options?.workerName) rawName = options.workerName;
|
|
520
|
-
else if (options?.site?.name) rawName = options.site.name;
|
|
521
|
-
else if (options?.name) rawName = options.name;
|
|
522
|
-
else {
|
|
523
|
-
const qarpeoConfig = nuxt.options.qarpeo || {};
|
|
524
|
-
if (qarpeoConfig.workerName) rawName = qarpeoConfig.workerName;
|
|
525
|
-
else if (qarpeoConfig.site?.name) rawName = qarpeoConfig.site.name;
|
|
526
|
-
else if (qarpeoConfig.name) rawName = qarpeoConfig.name;
|
|
527
|
-
else {
|
|
528
|
-
const siteConfig = nuxt.options.site || {};
|
|
529
|
-
if (siteConfig.name) rawName = siteConfig.name;
|
|
530
|
-
else if (process.env.CLOUDFLARE_PROJECT_NAME) rawName = process.env.CLOUDFLARE_PROJECT_NAME;
|
|
531
|
-
else if (process.env.WRANGLER_NAME) rawName = process.env.WRANGLER_NAME;
|
|
532
|
-
else if (process.env.QARPEO_WORKER_NAME) rawName = process.env.QARPEO_WORKER_NAME;
|
|
533
|
-
else if (process.env.WORKER_NAME) rawName = process.env.WORKER_NAME;
|
|
534
|
-
else if (process.env.CF_WORKER_NAME) rawName = process.env.CF_WORKER_NAME;
|
|
535
|
-
else {
|
|
536
|
-
try {
|
|
537
|
-
const pkgPath = resolve(nuxt.options.rootDir, "package.json");
|
|
538
|
-
if (existsSync(pkgPath)) {
|
|
539
|
-
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
540
|
-
if (pkg.name) rawName = pkg.name;
|
|
541
|
-
}
|
|
542
|
-
} catch {
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
const sanitized = (rawName || "").toLowerCase().replace(/^@/, "").replace(/[^a-z0-9-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
548
|
-
return sanitized || "qarpeo-app";
|
|
549
|
-
}
|
|
550
|
-
async function createWranglerConfig(nuxt, options) {
|
|
551
|
-
let rootConfig = {};
|
|
552
|
-
for (const file of ["wrangler.jsonc", "wrangler.json"]) {
|
|
553
|
-
const rootPath = join(nuxt.options.rootDir, file);
|
|
554
|
-
if (existsSync(rootPath)) {
|
|
555
|
-
try {
|
|
556
|
-
const content = await readFile(rootPath, "utf8");
|
|
557
|
-
const stripped = content.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\/\/.*$/gm, "").replace(/,\s*([}\]])/g, "$1");
|
|
558
|
-
rootConfig = JSON.parse(stripped);
|
|
559
|
-
break;
|
|
560
|
-
} catch {
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
const compatDate = typeof nuxt.options.compatibilityDate === "string" ? nuxt.options.compatibilityDate : nuxt.options.compatibilityDate?.default || "2025-02-01";
|
|
565
|
-
const projectName = resolveProjectName(nuxt, options);
|
|
566
|
-
const baseConfig = {
|
|
567
|
-
$schema: "node_modules/wrangler/config-schema.json",
|
|
568
|
-
name: projectName,
|
|
569
|
-
compatibility_date: compatDate,
|
|
570
|
-
compatibility_flags: ["nodejs_compat"],
|
|
571
|
-
observability: { enabled: true }
|
|
572
|
-
};
|
|
573
|
-
const isRemote = Boolean(options.remote || process.env.QARPEO_CF_REMOTE);
|
|
574
|
-
const accountId = process.env.CLOUDFLARE_ACCOUNT_ID || process.env.CF_ACCOUNT_ID;
|
|
575
|
-
if (accountId) {
|
|
576
|
-
baseConfig.account_id = accountId;
|
|
577
|
-
}
|
|
578
|
-
if (options.kv || options.cache || options.auth || options.realtime || options.payments || options.ratelimit || options.agents || options.multitenant) {
|
|
579
|
-
const kvBinding = resolveBindingName("kv");
|
|
580
|
-
const kvId = process.env.QARPEO_KV_ID || process.env.KV_ID || `${kvBinding}_LOCAL_DEV`;
|
|
581
|
-
baseConfig.kv_namespaces = [
|
|
582
|
-
{
|
|
583
|
-
binding: kvBinding,
|
|
584
|
-
id: kvId,
|
|
585
|
-
...isRemote ? { remote: true } : {}
|
|
586
|
-
}
|
|
587
|
-
];
|
|
588
|
-
}
|
|
589
|
-
if (options.blob || options.r2 || options.cms || options.storage) {
|
|
590
|
-
const blobBinding = resolveBindingName("blob");
|
|
591
|
-
const bucketName = process.env.QARPEO_BLOB_BUCKET || process.env.BLOB_NAME || `${blobBinding.toLowerCase().replace(/[^a-z0-9-]/g, "-")}-local-dev`;
|
|
592
|
-
baseConfig.r2_buckets = [
|
|
593
|
-
{
|
|
594
|
-
binding: blobBinding,
|
|
595
|
-
bucket_name: bucketName,
|
|
596
|
-
...isRemote ? { remote: true } : {}
|
|
597
|
-
}
|
|
598
|
-
];
|
|
599
|
-
}
|
|
600
|
-
if (options.db || options.d1 || options.cms || options.auth || options.payments) {
|
|
601
|
-
const dbBinding = resolveBindingName(
|
|
602
|
-
"db",
|
|
603
|
-
typeof options.db === "object" ? options.db.binding : void 0
|
|
604
|
-
);
|
|
605
|
-
const dbId = typeof options.db === "object" && options.db.databaseId || process.env.QARPEO_DB_ID || process.env.DATABASE_ID || process.env.DB_ID || `${dbBinding}_LOCAL_DEV`;
|
|
606
|
-
const serverDir = nuxt.options.serverDir || resolve(nuxt.options.rootDir, "server");
|
|
607
|
-
const migrationsDir = resolve(serverDir, "db/migrations");
|
|
608
|
-
const buildDir = nuxt.options.buildDir || resolve(nuxt.options.rootDir, ".nuxt");
|
|
609
|
-
const relMigrationsDir = relative(buildDir, migrationsDir).replace(/\\/g, "/");
|
|
610
|
-
baseConfig.d1_databases = [
|
|
611
|
-
{
|
|
612
|
-
binding: dbBinding,
|
|
613
|
-
database_name: dbBinding,
|
|
614
|
-
database_id: dbId,
|
|
615
|
-
migrations_dir: relMigrationsDir,
|
|
616
|
-
migrations_pattern: `${relMigrationsDir}/*/migration.sql`,
|
|
617
|
-
...isRemote ? { remote: true } : {}
|
|
618
|
-
}
|
|
619
|
-
];
|
|
620
|
-
}
|
|
621
|
-
if (options.cache) {
|
|
622
|
-
const cacheConfig = typeof options.cache === "object" ? options.cache : {};
|
|
623
|
-
const cacheBinding = cacheConfig.binding || resolveBindingName("cache");
|
|
624
|
-
const cacheId = process.env.QARPEO_CACHE_ID || process.env.CACHE_ID || `${cacheBinding}_LOCAL_DEV`;
|
|
625
|
-
baseConfig.kv_namespaces = baseConfig.kv_namespaces || [];
|
|
626
|
-
baseConfig.kv_namespaces.push({
|
|
627
|
-
binding: cacheBinding,
|
|
628
|
-
id: cacheId,
|
|
629
|
-
...isRemote ? { remote: true } : {}
|
|
630
|
-
});
|
|
631
|
-
}
|
|
632
|
-
if (options.ai || options.agents) {
|
|
633
|
-
const hasToken = Boolean(
|
|
634
|
-
process.env.CLOUDFLARE_API_TOKEN || process.env.CLOUDFLARE_ACCOUNT_ID || isRemote
|
|
635
|
-
);
|
|
636
|
-
if (hasToken || !nuxt.options.dev) {
|
|
637
|
-
const aiBinding = resolveBindingName("ai");
|
|
638
|
-
baseConfig.ai = {
|
|
639
|
-
binding: aiBinding
|
|
640
|
-
};
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
if (options.vectorize || options.agents) {
|
|
644
|
-
const vectorizeBinding = resolveBindingName("vectorize");
|
|
645
|
-
const indexName = `${vectorizeBinding.toLowerCase().replace(/[^a-z0-9-]/g, "-")}-local-dev`;
|
|
646
|
-
baseConfig.vectorize = [
|
|
647
|
-
{
|
|
648
|
-
binding: vectorizeBinding,
|
|
649
|
-
index_name: indexName,
|
|
650
|
-
...isRemote ? { remote: true } : {}
|
|
651
|
-
}
|
|
652
|
-
];
|
|
653
|
-
}
|
|
654
|
-
if (options.queue || options.jobs || options.payments) {
|
|
655
|
-
const queueBinding = resolveBindingName("queue");
|
|
656
|
-
const queueName = process.env.QARPEO_QUEUE_NAME || `${queueBinding.toLowerCase().replace(/[^a-z0-9-]/g, "-")}-local-dev`;
|
|
657
|
-
baseConfig.queues = baseConfig.queues || {};
|
|
658
|
-
baseConfig.queues.producers = [
|
|
659
|
-
{
|
|
660
|
-
binding: queueBinding,
|
|
661
|
-
queue: queueName,
|
|
662
|
-
...isRemote ? { remote: true } : {}
|
|
663
|
-
}
|
|
664
|
-
];
|
|
665
|
-
const queueFiles = findQueueFiles(
|
|
666
|
-
nuxt.options._layers || [{ cwd: nuxt.options.rootDir, config: nuxt.options }]
|
|
667
|
-
);
|
|
668
|
-
const jobFiles = options.jobs ? findJobFiles(
|
|
669
|
-
nuxt.options._layers || [{ cwd: nuxt.options.rootDir, config: nuxt.options }],
|
|
670
|
-
typeof options.jobs === "object" && options.jobs.dir ? options.jobs.dir : "server/jobs"
|
|
671
|
-
) : [];
|
|
672
|
-
if (queueFiles.length > 0 || jobFiles.length > 0) {
|
|
673
|
-
const jobsConfig = typeof options.jobs === "object" ? options.jobs : {};
|
|
674
|
-
baseConfig.queues.consumers = [
|
|
675
|
-
{
|
|
676
|
-
queue: queueName,
|
|
677
|
-
max_batch_size: jobsConfig.maxBatchSize ?? 10,
|
|
678
|
-
max_batch_timeout: jobsConfig.maxBatchTimeout ?? 5
|
|
679
|
-
}
|
|
680
|
-
];
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
if (options.analytics) {
|
|
684
|
-
const analyticsOpts = typeof options.analytics === "object" ? options.analytics : void 0;
|
|
685
|
-
const analyticsBinding = resolveBindingName("analytics", analyticsOpts?.binding);
|
|
686
|
-
const datasetName = analyticsOpts?.dataset || process.env.QARPEO_ANALYTICS_DATASET || `${analyticsBinding.toLowerCase().replace(/[^a-z0-9-]/g, "-")}-local-dev`;
|
|
687
|
-
baseConfig.analytics_engine_datasets = [
|
|
688
|
-
{
|
|
689
|
-
binding: analyticsBinding,
|
|
690
|
-
dataset: datasetName
|
|
691
|
-
}
|
|
692
|
-
];
|
|
693
|
-
}
|
|
694
|
-
if (options.ratelimit) {
|
|
695
|
-
const rateLimitBinding = resolveBindingName("ratelimit", void 0, "RATE_LIMITER");
|
|
696
|
-
const limit = typeof options.ratelimit === "object" ? options.ratelimit.limit ?? 100 : 100;
|
|
697
|
-
const period = typeof options.ratelimit === "object" ? options.ratelimit.period ?? 60 : 60;
|
|
698
|
-
const namespaceId = typeof options.ratelimit === "object" ? options.ratelimit.namespaceId ?? 1001 : 1001;
|
|
699
|
-
baseConfig.ratelimits = [
|
|
700
|
-
{
|
|
701
|
-
name: rateLimitBinding,
|
|
702
|
-
namespace_id: String(namespaceId),
|
|
703
|
-
simple: {
|
|
704
|
-
limit,
|
|
705
|
-
period
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
];
|
|
709
|
-
}
|
|
710
|
-
if (options.hyperdrive) {
|
|
711
|
-
const hyperdriveBinding = resolveBindingName("hyperdrive");
|
|
712
|
-
const id = process.env.QARPEO_HYPERDRIVE_ID || `${hyperdriveBinding}_LOCAL_DEV`;
|
|
713
|
-
const localConnectionString = (typeof options.hyperdrive === "object" ? options.hyperdrive.localConnectionString : void 0) || process.env.LOCAL_CONNECTION_STRING || process.env.QARPEO_HYPERDRIVE_LOCAL_URL;
|
|
714
|
-
baseConfig.hyperdrive = [
|
|
715
|
-
{
|
|
716
|
-
binding: hyperdriveBinding,
|
|
717
|
-
id,
|
|
718
|
-
...localConnectionString ? { localConnectionString } : nuxt.options.dev && !isRemote ? { localConnectionString: "postgresql://postgres:postgres@localhost:5432/postgres" } : {},
|
|
719
|
-
...isRemote ? { remote: true } : {}
|
|
720
|
-
}
|
|
721
|
-
];
|
|
722
|
-
}
|
|
723
|
-
if (options.browser) {
|
|
724
|
-
const browserBinding = resolveBindingName("browser");
|
|
725
|
-
baseConfig.browser = {
|
|
726
|
-
binding: browserBinding
|
|
727
|
-
};
|
|
728
|
-
}
|
|
729
|
-
if (options.email || options.mail) {
|
|
730
|
-
const emailBinding = resolveBindingName(
|
|
731
|
-
"email",
|
|
732
|
-
typeof options.email === "object" ? options.email.binding : void 0,
|
|
733
|
-
"EMAIL"
|
|
734
|
-
);
|
|
735
|
-
baseConfig.send_email = [
|
|
736
|
-
{
|
|
737
|
-
name: emailBinding,
|
|
738
|
-
...isRemote ? { remote: true } : {}
|
|
739
|
-
}
|
|
740
|
-
];
|
|
741
|
-
}
|
|
742
|
-
const isCronDisabled = options.cron === false;
|
|
743
|
-
if (!isCronDisabled) {
|
|
744
|
-
let crons = [];
|
|
745
|
-
if (options.cron && typeof options.cron === "object") {
|
|
746
|
-
crons = Object.keys(options.cron);
|
|
747
|
-
}
|
|
748
|
-
if (!crons.length) {
|
|
749
|
-
const nitroScheduled = nuxt.options.nitro?.scheduledTasks;
|
|
750
|
-
const nitroCrons = nitroScheduled ? Object.keys(nitroScheduled) : [];
|
|
751
|
-
crons = nuxt.options.nitro?.cloudflare?.wrangler?.triggers?.crons || nitroCrons;
|
|
752
|
-
}
|
|
753
|
-
const discoveredTasks = findScheduledTasks(
|
|
754
|
-
nuxt.options._layers || [{ cwd: nuxt.options.rootDir, config: nuxt.options }]
|
|
755
|
-
);
|
|
756
|
-
for (const task of discoveredTasks) {
|
|
757
|
-
if (task.cron && !crons.includes(task.cron)) {
|
|
758
|
-
crons.push(task.cron);
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
const cmsScheduled = typeof options.cms === "object" && options.cms?.scheduledPublish;
|
|
762
|
-
if (cmsScheduled && !crons.includes("*/5 * * * *")) {
|
|
763
|
-
crons.push("*/5 * * * *");
|
|
764
|
-
}
|
|
765
|
-
if (crons.length > 0) {
|
|
766
|
-
baseConfig.triggers = { crons };
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
if (options.do || options.realtime || options.agents) {
|
|
770
|
-
baseConfig.durable_objects = baseConfig.durable_objects || { bindings: [] };
|
|
771
|
-
baseConfig.durable_objects.bindings = baseConfig.durable_objects.bindings || [];
|
|
772
|
-
baseConfig.migrations = baseConfig.migrations || [];
|
|
773
|
-
if (options.realtime || !options.agents && options.do) {
|
|
774
|
-
const doBinding = resolveBindingName(
|
|
775
|
-
"do",
|
|
776
|
-
typeof options.realtime === "object" ? options.realtime.binding : void 0,
|
|
777
|
-
"QARPEO_ROOM_DO"
|
|
778
|
-
);
|
|
779
|
-
baseConfig.durable_objects.bindings.push({
|
|
780
|
-
name: doBinding,
|
|
781
|
-
class_name: "QarpeoRoomDO"
|
|
782
|
-
});
|
|
783
|
-
baseConfig.migrations.push({
|
|
784
|
-
tag: "v1-realtime-room",
|
|
785
|
-
new_classes: ["QarpeoRoomDO"]
|
|
786
|
-
});
|
|
787
|
-
}
|
|
788
|
-
if (options.agents) {
|
|
789
|
-
const agentsConfig = typeof options.agents === "object" ? options.agents : {};
|
|
790
|
-
const agentBinding = agentsConfig.binding || "QARPEO_AGENT_DO";
|
|
791
|
-
baseConfig.durable_objects.bindings.push({
|
|
792
|
-
name: agentBinding,
|
|
793
|
-
class_name: "QarpeoAgentDO"
|
|
794
|
-
});
|
|
795
|
-
baseConfig.migrations.push({
|
|
796
|
-
tag: "v1-agent-do",
|
|
797
|
-
new_sqlite_classes: ["QarpeoAgentDO"]
|
|
798
|
-
});
|
|
799
|
-
}
|
|
800
|
-
}
|
|
801
|
-
const merged = defu(rootConfig, baseConfig);
|
|
802
|
-
if (Array.isArray(merged.kv_namespaces)) {
|
|
803
|
-
const seen = /* @__PURE__ */ new Set();
|
|
804
|
-
merged.kv_namespaces = merged.kv_namespaces.filter((item) => {
|
|
805
|
-
if (!item?.binding || seen.has(item.binding)) return false;
|
|
806
|
-
seen.add(item.binding);
|
|
807
|
-
return true;
|
|
808
|
-
});
|
|
809
|
-
}
|
|
810
|
-
if (Array.isArray(merged.r2_buckets)) {
|
|
811
|
-
const seen = /* @__PURE__ */ new Set();
|
|
812
|
-
merged.r2_buckets = merged.r2_buckets.filter((item) => {
|
|
813
|
-
if (!item?.binding || seen.has(item.binding)) return false;
|
|
814
|
-
seen.add(item.binding);
|
|
815
|
-
return true;
|
|
816
|
-
});
|
|
817
|
-
}
|
|
818
|
-
if (Array.isArray(merged.d1_databases)) {
|
|
819
|
-
const seen = /* @__PURE__ */ new Set();
|
|
820
|
-
merged.d1_databases = merged.d1_databases.filter((item) => {
|
|
821
|
-
if (!item?.binding || seen.has(item.binding)) return false;
|
|
822
|
-
seen.add(item.binding);
|
|
823
|
-
return true;
|
|
824
|
-
});
|
|
825
|
-
}
|
|
826
|
-
if (Array.isArray(merged.vectorize)) {
|
|
827
|
-
const seen = /* @__PURE__ */ new Set();
|
|
828
|
-
merged.vectorize = merged.vectorize.filter((item) => {
|
|
829
|
-
if (!item?.binding || seen.has(item.binding)) return false;
|
|
830
|
-
seen.add(item.binding);
|
|
831
|
-
return true;
|
|
832
|
-
});
|
|
833
|
-
}
|
|
834
|
-
if (Array.isArray(merged.analytics_engine_datasets)) {
|
|
835
|
-
const seen = /* @__PURE__ */ new Set();
|
|
836
|
-
merged.analytics_engine_datasets = merged.analytics_engine_datasets.filter((item) => {
|
|
837
|
-
if (!item?.binding || seen.has(item.binding)) return false;
|
|
838
|
-
seen.add(item.binding);
|
|
839
|
-
return true;
|
|
840
|
-
});
|
|
841
|
-
}
|
|
842
|
-
if (Array.isArray(merged.ratelimits)) {
|
|
843
|
-
const seen = /* @__PURE__ */ new Set();
|
|
844
|
-
merged.ratelimits = merged.ratelimits.filter((item) => {
|
|
845
|
-
if (!item?.name || seen.has(item.name)) return false;
|
|
846
|
-
seen.add(item.name);
|
|
847
|
-
return true;
|
|
848
|
-
});
|
|
849
|
-
}
|
|
850
|
-
if (Array.isArray(merged.hyperdrive)) {
|
|
851
|
-
const seen = /* @__PURE__ */ new Set();
|
|
852
|
-
merged.hyperdrive = merged.hyperdrive.filter((item) => {
|
|
853
|
-
if (!item?.binding || seen.has(item.binding)) return false;
|
|
854
|
-
seen.add(item.binding);
|
|
855
|
-
return true;
|
|
856
|
-
});
|
|
857
|
-
}
|
|
858
|
-
if (Array.isArray(merged.send_email)) {
|
|
859
|
-
const seen = /* @__PURE__ */ new Set();
|
|
860
|
-
merged.send_email = merged.send_email.filter((item) => {
|
|
861
|
-
if (!item?.name || seen.has(item.name)) return false;
|
|
862
|
-
seen.add(item.name);
|
|
863
|
-
return true;
|
|
864
|
-
});
|
|
865
|
-
}
|
|
866
|
-
if (merged.durable_objects && Array.isArray(merged.durable_objects.bindings)) {
|
|
867
|
-
const seen = /* @__PURE__ */ new Set();
|
|
868
|
-
merged.durable_objects.bindings = merged.durable_objects.bindings.filter((item) => {
|
|
869
|
-
if (!item?.name || seen.has(item.name)) return false;
|
|
870
|
-
seen.add(item.name);
|
|
871
|
-
return true;
|
|
872
|
-
});
|
|
873
|
-
}
|
|
874
|
-
return merged;
|
|
875
|
-
}
|
|
876
|
-
async function generateDevWranglerConfig(nuxt, options) {
|
|
877
|
-
const buildDir = nuxt.options.buildDir;
|
|
878
|
-
const configPath = join(buildDir, "wrangler.json");
|
|
879
|
-
const merged = await createWranglerConfig(nuxt, options);
|
|
880
|
-
const isRemote = Boolean(options.remote || process.env.QARPEO_CF_REMOTE);
|
|
881
|
-
const hasToken = Boolean(process.env.CLOUDFLARE_API_TOKEN || process.env.CLOUDFLARE_ACCOUNT_ID);
|
|
882
|
-
if (!isRemote && !hasToken && merged.ai) {
|
|
883
|
-
delete merged.ai;
|
|
884
|
-
}
|
|
885
|
-
await mkdir(buildDir, { recursive: true });
|
|
886
|
-
await writeFile(configPath, JSON.stringify(merged, null, 2), "utf8");
|
|
887
|
-
return configPath;
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
const wrangler = {
|
|
891
|
-
__proto__: null,
|
|
892
|
-
createWranglerConfig: createWranglerConfig,
|
|
893
|
-
generateDevWranglerConfig: generateDevWranglerConfig,
|
|
894
|
-
resolveProjectName: resolveProjectName
|
|
895
|
-
};
|
|
896
|
-
|
|
897
|
-
export { getJiti as a, resolveProjectName as b, checkDrizzleVersion as c, findLocalD1Database as d, ensurePackage as e, findSchemaFiles as f, getLocalDatabaseContext as g, createWranglerConfig as h, resolveBindingName as i, scanSchemaExports as j, findScheduledTasks as k, findQueueFiles as l, findJobFiles as m, generateDevWranglerConfig as n, applyD1Migrations as o, localDb as p, resolveBinaryPath as r, spawnBinSync as s, version as v, wrangler as w };
|