qarpeo 0.4.13 → 0.4.14
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 +12 -6
- package/dist/apps/cms.d.ts +1 -1
- package/dist/apps/comments.d.ts +1 -1
- package/dist/apps/payments.d.ts +1 -1
- package/dist/apps/store.d.ts +1 -1
- package/dist/chunks/{manifest.get.mjs → tools.mjs} +445 -430
- package/dist/cli/index.mjs +756 -746
- package/dist/core/aliases.d.ts +1 -1
- package/dist/core/context.d.ts +1 -1
- package/dist/core/d1-migrate.d.ts +1 -1
- package/dist/core/devtools.d.ts +1 -1
- package/dist/core/nitro.d.ts +1 -1
- package/dist/core/schema.d.ts +1 -1
- package/dist/core/server-utils.d.ts +1 -1
- package/dist/core/wrangler.d.ts +1 -1
- package/dist/fate/index.d.ts +8 -8
- package/dist/fate/index.mjs +3 -1
- package/dist/features/agents.d.ts +1 -1
- package/dist/features/auth.d.ts +1 -1
- package/dist/features/bots.d.ts +1 -1
- package/dist/features/console.d.ts +1 -1
- package/dist/features/fate.d.ts +1 -1
- package/dist/features/mail.d.ts +1 -1
- package/dist/features/mcp.d.ts +1 -1
- package/dist/features/multitenant.d.ts +1 -1
- package/dist/features/notifications.d.ts +1 -1
- package/dist/features/realtime.d.ts +1 -1
- package/dist/features/studio.d.ts +4 -0
- package/dist/module.d.ts +1 -1
- package/dist/module.mjs +5139 -5067
- package/dist/primitives/ai.d.ts +1 -1
- package/dist/primitives/analytics.d.ts +1 -1
- package/dist/primitives/blob.d.ts +1 -1
- package/dist/primitives/browser.d.ts +1 -1
- package/dist/primitives/cache.d.ts +1 -1
- package/dist/primitives/d1.d.ts +1 -1
- package/dist/primitives/do.d.ts +1 -1
- package/dist/primitives/email.d.ts +1 -1
- package/dist/primitives/hyperdrive.d.ts +1 -1
- package/dist/primitives/kv.d.ts +1 -1
- package/dist/primitives/queue.d.ts +1 -1
- package/dist/primitives/ratelimit.d.ts +1 -1
- package/dist/primitives/vectorize.d.ts +1 -1
- package/dist/primitives/workflows.d.ts +1 -1
- package/dist/runtime/ai.mjs +4 -1
- package/dist/runtime/app/components/CMSEditor.vue +439 -0
- package/dist/runtime/app/components/CMSEditorImageNode.vue +90 -0
- package/dist/runtime/app/components/CMSEditorLinkPopover.vue +120 -0
- package/dist/runtime/app/components/QDropZone.vue +327 -0
- package/dist/runtime/app/components/QImageCropper.vue +658 -0
- package/dist/runtime/app/components/QImageStudio.vue +300 -0
- package/dist/runtime/app/components/QImg.vue +7 -4
- package/dist/runtime/app/composables/analytics.d.ts +8 -8
- package/dist/runtime/app/composables/api-tokens.d.ts +5 -5
- package/dist/runtime/app/composables/auth.d.ts +23 -19
- package/dist/runtime/app/composables/chat.d.ts +7 -6
- package/dist/runtime/app/composables/cms-preview.d.ts +7 -8
- package/dist/runtime/app/composables/cms.d.ts +6 -6
- package/dist/runtime/app/composables/comments.d.ts +5 -5
- package/dist/runtime/app/composables/comments.mjs +7 -4
- package/dist/runtime/app/composables/console.d.ts +6 -14
- package/dist/runtime/app/composables/docs-version.d.ts +8 -8
- package/dist/runtime/app/composables/impersonation.d.ts +5 -5
- package/dist/runtime/app/composables/organization.d.ts +5 -5
- package/dist/runtime/app/composables/passkey.d.ts +5 -5
- package/dist/runtime/app/composables/passwordless.d.ts +5 -5
- package/dist/runtime/app/composables/payments.d.ts +5 -5
- package/dist/runtime/app/composables/rbac.d.ts +5 -5
- package/dist/runtime/app/composables/site.d.ts +2 -2
- package/dist/runtime/app/composables/sse.d.ts +20 -33
- package/dist/runtime/app/composables/sse.mjs +6 -3
- package/dist/runtime/app/composables/storage.d.ts +6 -8
- package/dist/runtime/app/composables/store.d.ts +37 -36
- package/dist/runtime/app/composables/store.mjs +7 -6
- package/dist/runtime/app/composables/studio.d.ts +59 -0
- package/dist/runtime/app/composables/studio.mjs +129 -0
- package/dist/runtime/app/composables/tenant.d.ts +7 -7
- package/dist/runtime/app/composables/turnstile.d.ts +5 -5
- package/dist/runtime/app/composables/two-factor.d.ts +5 -5
- package/dist/runtime/app/pages/devtools/notifications.vue +1 -6
- package/dist/runtime/app/plugins/pwa.mjs +1 -3
- package/dist/runtime/app/utils/cms-editor.d.ts +25 -0
- package/dist/runtime/app/utils/cms-editor.mjs +43 -0
- package/dist/runtime/auth.d.ts +9 -9
- package/dist/runtime/blob.d.ts +1 -3
- package/dist/runtime/blob.mjs +3 -1
- package/dist/runtime/cache.d.ts +8 -6
- package/dist/runtime/cache.mjs +8 -11
- package/dist/runtime/db.d.ts +4 -3
- package/dist/runtime/drizzle.d.ts +2 -1
- package/dist/runtime/drizzle.mjs +2 -2
- package/dist/runtime/queue.d.ts +1 -0
- package/dist/runtime/replica.d.ts +6 -10
- package/dist/runtime/replica.mjs +3 -1
- package/dist/runtime/schema-mysql.d.ts +16 -32
- package/dist/runtime/schema-pg.d.ts +15 -31
- package/dist/runtime/schema-shared.d.ts +20 -17
- package/dist/runtime/schema.d.ts +21 -33
- package/dist/runtime/server/durable-objects/agent.mjs +4 -1
- package/dist/runtime/server/durable-objects/room.d.ts +4 -6
- package/dist/runtime/server/durable-objects/room.mjs +18 -8
- package/dist/runtime/server/plugins/comments.d.ts +2 -3
- package/dist/runtime/server/plugins/email-inbound.d.ts +1 -3
- package/dist/runtime/server/plugins/store.d.ts +2 -3
- package/dist/runtime/server/routes/__qarpeo/cloud/agents/run.post.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/cloud/cms/entry.get.mjs +10 -2
- package/dist/runtime/server/routes/__qarpeo/cloud/cms/entry.post.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/cloud/cms/entry.post.mjs +10 -2
- package/dist/runtime/server/routes/__qarpeo/cloud/cms.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/cloud/cms.get.mjs +7 -1
- package/dist/runtime/server/routes/__qarpeo/cloud/comments/moderate.post.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/cloud/comments/moderate.post.mjs +5 -1
- package/dist/runtime/server/routes/__qarpeo/cloud/comments.get.d.ts +1 -3
- package/dist/runtime/server/routes/__qarpeo/cloud/extras.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/cloud/extras.get.mjs +15 -4
- package/dist/runtime/server/routes/__qarpeo/cloud/mail/unsuppress.post.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/cloud/migrate/cms.post.mjs +13 -4
- package/dist/runtime/server/routes/__qarpeo/cloud/migrate/products.post.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/cloud/migrate.post.d.ts +3 -3
- package/dist/runtime/server/routes/__qarpeo/cloud/migrate.post.mjs +22 -6
- package/dist/runtime/server/routes/__qarpeo/cloud/notifications/test.post.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/cloud/operations.get.d.ts +6 -5
- package/dist/runtime/server/routes/__qarpeo/cloud/store/order-status.post.d.ts +1 -3
- package/dist/runtime/server/routes/__qarpeo/cloud/store/order-status.post.mjs +14 -2
- package/dist/runtime/server/routes/__qarpeo/cloud/store/orders.get.d.ts +1 -3
- package/dist/runtime/server/routes/__qarpeo/cloud/store/orders.get.mjs +7 -1
- package/dist/runtime/server/routes/__qarpeo/cloud/store/products.get.d.ts +1 -3
- package/dist/runtime/server/routes/__qarpeo/cloud/tasks/run.post.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/cloud/users/action.post.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/cloud/users/action.post.mjs +5 -1
- package/dist/runtime/server/routes/__qarpeo/cloud/users.get.d.ts +6 -5
- package/dist/runtime/server/routes/__qarpeo/cloud/users.get.mjs +1 -3
- package/dist/runtime/server/routes/__qarpeo/mail/track/click/[id].get.mjs +2 -2
- package/dist/runtime/server/routes/__qarpeo/manifest.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/og.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/rbac/me.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/rbac/roles.delete.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/rbac/roles.delete.mjs +5 -1
- package/dist/runtime/server/routes/__qarpeo/rbac/roles.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/rbac/roles.get.mjs +1 -5
- package/dist/runtime/server/routes/__qarpeo/rbac/roles.post.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/rbac/roles.post.mjs +5 -1
- package/dist/runtime/server/routes/__qarpeo/rbac/users.post.d.ts +2 -2
- package/dist/runtime/server/routes/agents/[agent]/chat.post.mjs +1 -6
- package/dist/runtime/server/routes/agents/[agent]/clear.post.mjs +1 -6
- package/dist/runtime/server/routes/agents/[agent]/history.get.mjs +1 -6
- package/dist/runtime/server/routes/auth/2fa/disable.post.mjs +5 -1
- package/dist/runtime/server/routes/auth/2fa/verify.post.mjs +7 -1
- package/dist/runtime/server/routes/auth/magic-link/send.post.mjs +1 -1
- package/dist/runtime/server/routes/auth/otp/send.post.mjs +1 -1
- package/dist/runtime/server/routes/cms/search.get.mjs +2 -6
- package/dist/runtime/server/routes/comments/[id]/report.post.mjs +1 -4
- package/dist/runtime/server/routes/comments/[id].patch.mjs +1 -4
- package/dist/runtime/server/routes/comments/batch.post.mjs +1 -3
- package/dist/runtime/server/routes/comments/index.post.mjs +1 -5
- package/dist/runtime/server/routes/fate.mjs +1 -1
- package/dist/runtime/server/routes/mail/webhooks.post.mjs +1 -1
- package/dist/runtime/server/routes/sitemap.xml.get.mjs +2 -1
- package/dist/runtime/server/routes/storage/presigned-r2.post.d.ts +5 -6
- package/dist/runtime/server/routes/storage/presigned-r2.post.mjs +1 -1
- package/dist/runtime/server/routes/store/cart/items/[id].delete.mjs +1 -1
- package/dist/runtime/server/routes/store/cart/items/[id].patch.mjs +1 -1
- package/dist/runtime/server/routes/store/currencies.get.mjs +1 -4
- package/dist/runtime/server/routes/store/orders/[id].get.mjs +1 -1
- package/dist/runtime/server/routes/store/orders/download/[token].get.mjs +13 -4
- package/dist/runtime/server/routes/store/orders/index.get.mjs +1 -1
- package/dist/runtime/server/routes/store/tax/calculate.post.d.ts +2 -1
- package/dist/runtime/server/routes/store/tax/calculate.post.mjs +12 -3
- package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/index.delete.mjs +4 -1
- package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/verify.post.mjs +4 -1
- package/dist/runtime/server/utils/ai.d.ts +38 -35
- package/dist/runtime/server/utils/ai.mjs +7 -11
- package/dist/runtime/server/utils/analytics-query.d.ts +4 -4
- package/dist/runtime/server/utils/auth.d.ts +25 -25
- package/dist/runtime/server/utils/auth.mjs +22 -8
- package/dist/runtime/server/utils/bots.d.ts +7 -7
- package/dist/runtime/server/utils/browser-utils.d.ts +26 -27
- package/dist/runtime/server/utils/cache.d.ts +20 -20
- package/dist/runtime/server/utils/cms/collections.mjs +1 -6
- package/dist/runtime/server/utils/cms/common.mjs +1 -0
- package/dist/runtime/server/utils/cms/markdown.d.ts +2 -2
- package/dist/runtime/server/utils/cms/markdown.mjs +5 -5
- package/dist/runtime/server/utils/cms/mutations.mjs +8 -23
- package/dist/runtime/server/utils/cms/navigation.mjs +4 -4
- package/dist/runtime/server/utils/cms/path.d.ts +1 -0
- package/dist/runtime/server/utils/cms/path.mjs +8 -2
- package/dist/runtime/server/utils/cms/references.mjs +1 -7
- package/dist/runtime/server/utils/cms/search.d.ts +2 -2
- package/dist/runtime/server/utils/cms/sync.mjs +4 -2
- package/dist/runtime/server/utils/cms/taxonomy.d.ts +2 -2
- package/dist/runtime/server/utils/cms.d.ts +1 -1
- package/dist/runtime/server/utils/cms.mjs +1 -5
- package/dist/runtime/server/utils/comments-filter.d.ts +9 -7
- package/dist/runtime/server/utils/comments.d.ts +68 -55
- package/dist/runtime/server/utils/comments.mjs +21 -9
- package/dist/runtime/server/utils/config.d.ts +2 -2
- package/dist/runtime/server/utils/console.d.ts +3 -5
- package/dist/runtime/server/utils/context.d.ts +10 -10
- package/dist/runtime/server/utils/crypto.d.ts +20 -20
- package/dist/runtime/server/utils/domains.mjs +3 -1
- package/dist/runtime/server/utils/drizzle.d.ts +24 -25
- package/dist/runtime/server/utils/drizzle.mjs +17 -17
- package/dist/runtime/server/utils/durable-object.d.ts +27 -25
- package/dist/runtime/server/utils/durable-object.mjs +3 -10
- package/dist/runtime/server/utils/email-inbound.d.ts +10 -10
- package/dist/runtime/server/utils/impersonation.d.ts +18 -18
- package/dist/runtime/server/utils/legacy-hash.d.ts +23 -27
- package/dist/runtime/server/utils/lock.d.ts +20 -23
- package/dist/runtime/server/utils/mail.d.ts +19 -19
- package/dist/runtime/server/utils/mail.mjs +4 -2
- package/dist/runtime/server/utils/mcp.d.ts +20 -20
- package/dist/runtime/server/utils/mcp.mjs +22 -38
- package/dist/runtime/server/utils/notifications.d.ts +49 -38
- package/dist/runtime/server/utils/oauth.d.ts +3 -9
- package/dist/runtime/server/utils/organization.d.ts +28 -28
- package/dist/runtime/server/utils/organization.mjs +15 -5
- package/dist/runtime/server/utils/passwordless.d.ts +24 -24
- package/dist/runtime/server/utils/payments/checkout.d.ts +12 -12
- package/dist/runtime/server/utils/payments/checkout.mjs +1 -3
- package/dist/runtime/server/utils/payments/common.d.ts +3 -3
- package/dist/runtime/server/utils/payments/paddle.d.ts +4 -1
- package/dist/runtime/server/utils/payments/polar.d.ts +4 -1
- package/dist/runtime/server/utils/payments/stripe.mjs +5 -7
- package/dist/runtime/server/utils/payments/subscriptions.d.ts +14 -14
- package/dist/runtime/server/utils/payments/subscriptions.mjs +2 -6
- package/dist/runtime/server/utils/payments/usage.mjs +1 -3
- package/dist/runtime/server/utils/payments/webhooks.mjs +2 -2
- package/dist/runtime/server/utils/queue.d.ts +54 -58
- package/dist/runtime/server/utils/queue.mjs +2 -6
- package/dist/runtime/server/utils/rag.d.ts +23 -23
- package/dist/runtime/server/utils/rag.mjs +10 -5
- package/dist/runtime/server/utils/ratelimit.d.ts +21 -18
- package/dist/runtime/server/utils/rbac.d.ts +13 -15
- package/dist/runtime/server/utils/rbac.mjs +44 -10
- package/dist/runtime/server/utils/realtime.d.ts +53 -52
- package/dist/runtime/server/utils/role-env.d.ts +5 -4
- package/dist/runtime/server/utils/scheduled-task.d.ts +14 -15
- package/dist/runtime/server/utils/session.d.ts +40 -40
- package/dist/runtime/server/utils/sse.d.ts +23 -33
- package/dist/runtime/server/utils/sse.mjs +5 -14
- package/dist/runtime/server/utils/sso.mjs +3 -1
- package/dist/runtime/server/utils/storage.d.ts +20 -22
- package/dist/runtime/server/utils/storage.mjs +2 -2
- package/dist/runtime/server/utils/store/cart.d.ts +5 -3
- package/dist/runtime/server/utils/store/cart.mjs +14 -10
- package/dist/runtime/server/utils/store/checkout.mjs +4 -1
- package/dist/runtime/server/utils/store/common.d.ts +1 -1
- package/dist/runtime/server/utils/store/common.mjs +36 -12
- package/dist/runtime/server/utils/store/inventory.mjs +3 -1
- package/dist/runtime/server/utils/store/orders.mjs +32 -24
- package/dist/runtime/server/utils/store-localization.d.ts +9 -27
- package/dist/runtime/server/utils/store-localization.mjs +3 -3
- package/dist/runtime/server/utils/table-names.d.ts +15 -15
- package/dist/runtime/server/utils/table-names.mjs +1 -1
- package/dist/runtime/server/utils/tenant.d.ts +12 -12
- package/dist/runtime/server/utils/tenant.mjs +7 -4
- package/dist/runtime/server/utils/totp.d.ts +18 -18
- package/dist/runtime/server/utils/tracker.d.ts +5 -5
- package/dist/runtime/server/utils/turnstile.d.ts +9 -9
- package/dist/runtime/server/utils/urn.d.ts +5 -8
- package/dist/runtime/server/utils/workflows.d.ts +30 -31
- package/dist/runtime/server/utils/workflows.mjs +2 -4
- package/dist/runtime/server.d.ts +2 -2
- package/dist/runtime/service.d.ts +10 -10
- package/dist/runtime/test-utils.d.ts +10 -10
- package/dist/runtime/test-utils.mjs +9 -2
- package/dist/runtime/types/ai.d.ts +14 -14
- package/dist/runtime/types/d1.d.ts +6 -11
- package/dist/runtime/types/durable-object.d.ts +4 -8
- package/dist/runtime/types/email.d.ts +3 -9
- package/dist/runtime/types/index.d.ts +15 -21
- package/dist/runtime/types/r2.d.ts +5 -5
- package/dist/runtime/types/workflows.d.ts +5 -6
- package/dist/runtime/workflows.d.ts +1 -3
- package/dist/types/ai.d.ts +10 -17
- package/dist/types/auth.d.ts +5 -3
- package/dist/types/cache.d.ts +7 -7
- package/dist/types/cms.d.ts +30 -5
- package/dist/types/comments.d.ts +23 -21
- package/dist/types/console.d.ts +1 -3
- package/dist/types/db.d.ts +7 -7
- package/dist/types/index.d.ts +1 -0
- package/dist/types/options.d.ts +36 -24
- package/dist/types/site.d.ts +8 -2
- package/dist/types/storage.d.ts +2 -1
- package/dist/types/store-options.d.ts +10 -26
- package/dist/types/studio.d.ts +79 -0
- package/dist/utils/bots.d.ts +7 -3
- package/dist/utils/cms-table-names.d.ts +1 -1
- package/dist/utils/drizzle.d.ts +13 -14
- package/dist/utils/email-inbound.d.ts +4 -4
- package/dist/utils/features.d.ts +19 -5
- package/dist/utils/mcp.d.ts +1 -0
- package/dist/utils/migration-lock.d.ts +15 -29
- package/dist/utils/pkg.d.ts +6 -7
- package/dist/utils/schema-diff.d.ts +7 -11
- package/dist/utils/store-schema.d.ts +4 -6
- package/dist/utils/tools.d.ts +3 -3
- package/package.json +55 -5
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { defineEventHandler, useRuntimeConfig } from 'nuxt/server';
|
|
1
2
|
import { spawnSync } from 'node:child_process';
|
|
2
3
|
import { existsSync, statSync, readdirSync, readFileSync } from 'node:fs';
|
|
3
4
|
import { createRequire } from 'node:module';
|
|
@@ -5,11 +6,10 @@ import { resolve, dirname, join, extname, basename, relative } from 'pathe';
|
|
|
5
6
|
import { stdin, stdout } from 'node:process';
|
|
6
7
|
import readline from 'node:readline/promises';
|
|
7
8
|
import { fileURLToPath } from 'node:url';
|
|
8
|
-
import { useRuntimeConfig, defineEventHandler } from 'nuxt/server';
|
|
9
9
|
import { mkdir, writeFile, readFile } from 'node:fs/promises';
|
|
10
10
|
import { defu } from 'defu';
|
|
11
11
|
|
|
12
|
-
const version = "0.4.
|
|
12
|
+
const version = "0.4.14";
|
|
13
13
|
|
|
14
14
|
function spawnBinSync(bin, args, options = {}) {
|
|
15
15
|
const isWindows = process.platform === "win32";
|
|
@@ -167,6 +167,20 @@ const FEATURE_DEPS = {
|
|
|
167
167
|
shiki: "4.6.0"
|
|
168
168
|
}
|
|
169
169
|
},
|
|
170
|
+
editor: {
|
|
171
|
+
description: "CMS rich-text editor (@tiptap/vue-3, @tiptap/starter-kit, tables, text-align)",
|
|
172
|
+
dependencies: {
|
|
173
|
+
"@tiptap/core": "3.35.1",
|
|
174
|
+
"@tiptap/pm": "3.35.1",
|
|
175
|
+
"@tiptap/starter-kit": "3.35.1",
|
|
176
|
+
"@tiptap/vue-3": "3.35.1",
|
|
177
|
+
"@tiptap/extension-text-align": "3.35.1",
|
|
178
|
+
"@tiptap/extension-table": "3.35.1",
|
|
179
|
+
"@tiptap/extension-table-row": "3.35.1",
|
|
180
|
+
"@tiptap/extension-table-header": "3.35.1",
|
|
181
|
+
"@tiptap/extension-table-cell": "3.35.1"
|
|
182
|
+
}
|
|
183
|
+
},
|
|
170
184
|
drizzle: {
|
|
171
185
|
description: "Drizzle ORM, Drizzle Kit, and Drizzle Seed",
|
|
172
186
|
dependencies: {
|
|
@@ -304,6 +318,232 @@ async function ensureEnabledFeatures(options, nuxt, logger) {
|
|
|
304
318
|
}
|
|
305
319
|
}
|
|
306
320
|
|
|
321
|
+
function buildQarpeoManifest(options, qarpeoVersion = "0.0.0") {
|
|
322
|
+
const opts = options;
|
|
323
|
+
const hasDb = Boolean(opts.db || opts.d1);
|
|
324
|
+
const hasKv = Boolean(opts.kv);
|
|
325
|
+
const hasBlob = Boolean(opts.blob || opts.r2);
|
|
326
|
+
const hasAi = Boolean(opts.ai);
|
|
327
|
+
const hasVectorize = Boolean(opts.vectorize);
|
|
328
|
+
const hasQueue = Boolean(opts.queue);
|
|
329
|
+
const hasHyperdrive = Boolean(opts.hyperdrive);
|
|
330
|
+
const hasBrowser = Boolean(opts.browser);
|
|
331
|
+
const hasAnalytics = Boolean(opts.analytics);
|
|
332
|
+
const hasDo = Boolean(opts.do || opts.agents);
|
|
333
|
+
const hasAuth = Boolean(opts.auth);
|
|
334
|
+
const hasEmail = Boolean(opts.email || opts.mail);
|
|
335
|
+
const hasPayments = Boolean(opts.payments);
|
|
336
|
+
const hasNotifications = Boolean(opts.notifications || opts.notify);
|
|
337
|
+
const hasComments = Boolean(opts.comments);
|
|
338
|
+
const hasCms = Boolean(opts.cms);
|
|
339
|
+
const hasStore = Boolean(opts.store);
|
|
340
|
+
const hasAgents = Boolean(opts.agents);
|
|
341
|
+
const hasMultitenant = Boolean(opts.multitenant);
|
|
342
|
+
const hasSite = Boolean(opts.site || opts.seo);
|
|
343
|
+
const hasPwa = Boolean(opts.pwa || typeof opts.site === "object" && opts.site?.pwa);
|
|
344
|
+
const features = {
|
|
345
|
+
db: hasDb,
|
|
346
|
+
kv: hasKv,
|
|
347
|
+
blob: hasBlob,
|
|
348
|
+
ai: hasAi,
|
|
349
|
+
vectorize: hasVectorize,
|
|
350
|
+
queue: hasQueue,
|
|
351
|
+
workflows: Boolean(opts.workflows),
|
|
352
|
+
hyperdrive: hasHyperdrive,
|
|
353
|
+
browser: hasBrowser,
|
|
354
|
+
analytics: hasAnalytics,
|
|
355
|
+
ratelimit: Boolean(opts.ratelimit),
|
|
356
|
+
do: hasDo,
|
|
357
|
+
auth: hasAuth,
|
|
358
|
+
email: hasEmail,
|
|
359
|
+
payments: hasPayments,
|
|
360
|
+
notifications: hasNotifications,
|
|
361
|
+
comments: hasComments,
|
|
362
|
+
cms: hasCms,
|
|
363
|
+
store: hasStore,
|
|
364
|
+
agents: hasAgents,
|
|
365
|
+
multitenant: hasMultitenant,
|
|
366
|
+
site: hasSite,
|
|
367
|
+
pwa: hasPwa
|
|
368
|
+
};
|
|
369
|
+
const expectedBindings = [];
|
|
370
|
+
if (hasDb) {
|
|
371
|
+
expectedBindings.push({
|
|
372
|
+
type: "d1",
|
|
373
|
+
name: typeof opts.db === "object" && opts.db.binding ? opts.db.binding : "DB",
|
|
374
|
+
feature: "db",
|
|
375
|
+
required: true
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
if (hasKv) {
|
|
379
|
+
expectedBindings.push({
|
|
380
|
+
type: "kv_namespace",
|
|
381
|
+
name: typeof opts.kv === "object" && opts.kv.binding ? opts.kv.binding : "KV",
|
|
382
|
+
feature: "kv",
|
|
383
|
+
required: true
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
if (hasBlob) {
|
|
387
|
+
expectedBindings.push({
|
|
388
|
+
type: "r2_bucket",
|
|
389
|
+
name: typeof opts.blob === "object" && opts.blob.binding ? opts.blob.binding : "BLOB",
|
|
390
|
+
feature: "blob",
|
|
391
|
+
required: true
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
if (hasAi) {
|
|
395
|
+
expectedBindings.push({ type: "ai", name: "AI", feature: "ai", required: true });
|
|
396
|
+
}
|
|
397
|
+
if (hasVectorize) {
|
|
398
|
+
expectedBindings.push({
|
|
399
|
+
type: "vectorize",
|
|
400
|
+
name: typeof opts.vectorize === "object" && opts.vectorize.binding ? opts.vectorize.binding : "VECTORIZE",
|
|
401
|
+
feature: "vectorize",
|
|
402
|
+
required: true
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
if (hasQueue) {
|
|
406
|
+
expectedBindings.push({
|
|
407
|
+
type: "queue",
|
|
408
|
+
name: typeof opts.queue === "object" && opts.queue.binding ? opts.queue.binding : "QUEUE",
|
|
409
|
+
feature: "queue",
|
|
410
|
+
required: true
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
if (hasHyperdrive) {
|
|
414
|
+
expectedBindings.push({
|
|
415
|
+
type: "hyperdrive",
|
|
416
|
+
name: typeof opts.hyperdrive === "object" && opts.hyperdrive.binding ? opts.hyperdrive.binding : "HYPERDRIVE",
|
|
417
|
+
feature: "hyperdrive",
|
|
418
|
+
required: true
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
if (hasBrowser) {
|
|
422
|
+
expectedBindings.push({
|
|
423
|
+
type: "browser",
|
|
424
|
+
name: "BROWSER",
|
|
425
|
+
feature: "browser",
|
|
426
|
+
required: false
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
if (hasAnalytics) {
|
|
430
|
+
expectedBindings.push({
|
|
431
|
+
type: "analytics_engine",
|
|
432
|
+
name: "ANALYTICS",
|
|
433
|
+
feature: "analytics",
|
|
434
|
+
required: false
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
const expectedSecrets = [];
|
|
438
|
+
if (hasAuth || hasBlob || hasStore) {
|
|
439
|
+
expectedSecrets.push({
|
|
440
|
+
key: "NUXT_APP_SECRET",
|
|
441
|
+
feature: hasAuth ? "auth" : hasBlob ? "blob" : "store",
|
|
442
|
+
required: true,
|
|
443
|
+
description: "Signing secret for auth sessions, preview tokens, and signed R2 URLs.",
|
|
444
|
+
generatable: "secret"
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
if (hasNotifications) {
|
|
448
|
+
expectedSecrets.push(
|
|
449
|
+
{
|
|
450
|
+
key: "VAPID_PUBLIC_KEY",
|
|
451
|
+
feature: "notifications",
|
|
452
|
+
required: false,
|
|
453
|
+
description: "Web Push VAPID public key.",
|
|
454
|
+
generatable: "vapid"
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
key: "VAPID_PRIVATE_KEY",
|
|
458
|
+
feature: "notifications",
|
|
459
|
+
required: false,
|
|
460
|
+
description: "Web Push VAPID private key.",
|
|
461
|
+
generatable: "vapid"
|
|
462
|
+
}
|
|
463
|
+
);
|
|
464
|
+
}
|
|
465
|
+
if (hasPayments) {
|
|
466
|
+
expectedSecrets.push(
|
|
467
|
+
{
|
|
468
|
+
key: "STRIPE_SECRET_KEY",
|
|
469
|
+
feature: "payments",
|
|
470
|
+
required: true,
|
|
471
|
+
description: "Stripe API secret key for checkout & portal."
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
key: "STRIPE_WEBHOOK_SECRET",
|
|
475
|
+
feature: "payments",
|
|
476
|
+
required: true,
|
|
477
|
+
description: "Stripe webhook signing secret."
|
|
478
|
+
}
|
|
479
|
+
);
|
|
480
|
+
}
|
|
481
|
+
if (hasEmail) {
|
|
482
|
+
expectedSecrets.push({
|
|
483
|
+
key: "RESEND_API_KEY",
|
|
484
|
+
feature: "email",
|
|
485
|
+
required: false,
|
|
486
|
+
description: "Transactional email provider API key (when not using CF Email Routing)."
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
const endpoints = {};
|
|
490
|
+
if (hasSite) {
|
|
491
|
+
endpoints.robots = "/robots.txt";
|
|
492
|
+
endpoints.sitemap = "/sitemap.xml";
|
|
493
|
+
endpoints.og = "/__qarpeo/og";
|
|
494
|
+
}
|
|
495
|
+
if (hasPwa) {
|
|
496
|
+
endpoints.manifest = "/manifest.webmanifest";
|
|
497
|
+
endpoints.sw = "/sw.js";
|
|
498
|
+
}
|
|
499
|
+
return {
|
|
500
|
+
qarpeoVersion,
|
|
501
|
+
workerName: typeof opts.workerName === "string" ? opts.workerName : null,
|
|
502
|
+
features,
|
|
503
|
+
expectedBindings,
|
|
504
|
+
expectedSecrets,
|
|
505
|
+
endpoints
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
defineEventHandler((event) => {
|
|
509
|
+
const config = useRuntimeConfig();
|
|
510
|
+
const baseManifest = config.qarpeo?.manifest;
|
|
511
|
+
const cfEnv = event.context?.cloudflare?.env;
|
|
512
|
+
const manifest = baseManifest || {
|
|
513
|
+
qarpeoVersion: config.public?.qarpeoVersion || "0.0.0",
|
|
514
|
+
workerName: null,
|
|
515
|
+
features: {},
|
|
516
|
+
expectedBindings: [],
|
|
517
|
+
expectedSecrets: [],
|
|
518
|
+
endpoints: {}
|
|
519
|
+
};
|
|
520
|
+
const bindingPresence = {};
|
|
521
|
+
for (const b of manifest.expectedBindings) {
|
|
522
|
+
bindingPresence[b.name] = Boolean(cfEnv && b.name in cfEnv && cfEnv[b.name] !== void 0);
|
|
523
|
+
}
|
|
524
|
+
const secretPresence = {};
|
|
525
|
+
for (const s of manifest.expectedSecrets) {
|
|
526
|
+
secretPresence[s.key] = Boolean(
|
|
527
|
+
cfEnv && typeof cfEnv[s.key] === "string" && cfEnv[s.key].length > 0 || typeof process !== "undefined" && typeof process.env?.[s.key] === "string" && process.env[s.key].length > 0
|
|
528
|
+
);
|
|
529
|
+
}
|
|
530
|
+
return new Response(
|
|
531
|
+
JSON.stringify({
|
|
532
|
+
...manifest,
|
|
533
|
+
liveEnvPresence: {
|
|
534
|
+
bindings: bindingPresence,
|
|
535
|
+
secrets: secretPresence
|
|
536
|
+
}
|
|
537
|
+
}),
|
|
538
|
+
{
|
|
539
|
+
headers: {
|
|
540
|
+
"Content-Type": "application/json; charset=UTF-8",
|
|
541
|
+
"Cache-Control": "no-store"
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
);
|
|
545
|
+
});
|
|
546
|
+
|
|
307
547
|
function resolveBindingName(service, override, defaultName) {
|
|
308
548
|
if (override && typeof override === "string") {
|
|
309
549
|
return override;
|
|
@@ -320,7 +560,8 @@ function singularize(name) {
|
|
|
320
560
|
if (clean.endsWith("xes") && clean.length > 3) return clean.slice(0, -2);
|
|
321
561
|
if (clean.endsWith("ches") && clean.length > 4) return clean.slice(0, -2);
|
|
322
562
|
if (clean.endsWith("shes") && clean.length > 4) return clean.slice(0, -2);
|
|
323
|
-
if (clean.endsWith("us") || clean.endsWith("is") || clean.endsWith("ss") || clean === "news")
|
|
563
|
+
if (clean.endsWith("us") || clean.endsWith("is") || clean.endsWith("ss") || clean === "news")
|
|
564
|
+
return clean;
|
|
324
565
|
if (clean.endsWith("s") && clean.length > 2) return clean.slice(0, -1);
|
|
325
566
|
return clean;
|
|
326
567
|
}
|
|
@@ -348,7 +589,9 @@ function scanSchemaExports(schemaFiles) {
|
|
|
348
589
|
for (const m of src.matchAll(/^export\s+const\s+([a-z][A-Za-z0-9_]*Schema)\b/gm)) {
|
|
349
590
|
zod.push({ name: m[1], file });
|
|
350
591
|
}
|
|
351
|
-
for (const m of src.matchAll(
|
|
592
|
+
for (const m of src.matchAll(
|
|
593
|
+
/^export\s+const\s+([a-zA-Z0-9_]+)\s*=\s*(?:[a-zA-Z0-9_$.]+\.)?(?:snakeCase\.table|sqliteTable|pgTable|mysqlTable|msTable|sqlTable|table)\b/gm
|
|
594
|
+
)) {
|
|
352
595
|
const varName = m[1];
|
|
353
596
|
if (varName.startsWith("ALL_") || varName.endsWith("_NAMES")) continue;
|
|
354
597
|
const singular = singularize(varName);
|
|
@@ -540,8 +783,10 @@ function hasDatabaseSchema(dirPath) {
|
|
|
540
783
|
try {
|
|
541
784
|
const stat = statSync(dirPath);
|
|
542
785
|
if (!stat.isDirectory()) return false;
|
|
543
|
-
if (existsSync(resolve(dirPath, "schema.ts")) || existsSync(resolve(dirPath, "schema.js")))
|
|
544
|
-
|
|
786
|
+
if (existsSync(resolve(dirPath, "schema.ts")) || existsSync(resolve(dirPath, "schema.js")))
|
|
787
|
+
return true;
|
|
788
|
+
if (existsSync(resolve(dirPath, "index.ts")) || existsSync(resolve(dirPath, "index.js")))
|
|
789
|
+
return true;
|
|
545
790
|
const schemaDir = resolve(dirPath, "schema");
|
|
546
791
|
if (existsSync(schemaDir) && statSync(schemaDir).isDirectory()) {
|
|
547
792
|
const files = readdirSync(schemaDir);
|
|
@@ -1114,7 +1359,7 @@ function resolveTableName(baseName, prefixOrEventOrOptions, event) {
|
|
|
1114
1359
|
effectiveEvent = prefixOrEventOrOptions;
|
|
1115
1360
|
}
|
|
1116
1361
|
const runtimeOverrides = getTableOverrides(effectiveEvent);
|
|
1117
|
-
const mergedTables = { ...runtimeOverrides, ...tablesMap
|
|
1362
|
+
const mergedTables = { ...runtimeOverrides, ...tablesMap };
|
|
1118
1363
|
const camelKey = toCamelCase$1(baseName);
|
|
1119
1364
|
const override = mergedTables[baseName] || mergedTables[camelKey];
|
|
1120
1365
|
if (override) {
|
|
@@ -1411,24 +1656,126 @@ function getActiveCmsTableNames(cms, prefixOrOptions) {
|
|
|
1411
1656
|
];
|
|
1412
1657
|
}
|
|
1413
1658
|
|
|
1414
|
-
const
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
"
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
"store_discount",
|
|
1424
|
-
"store_customer_address"
|
|
1425
|
-
];
|
|
1426
|
-
function getActiveStoreTableNames(store, prefixOrOptions) {
|
|
1427
|
-
if (!store) return [];
|
|
1428
|
-
const resolvedPrefix = prefixOrOptions !== void 0 ? prefixOrOptions : typeof store === "object" && store.tablePrefix !== void 0 ? store.tablePrefix : void 0;
|
|
1429
|
-
return ALL_STORE_TABLE_NAMES.map((name) => resolveTableName(name, resolvedPrefix));
|
|
1659
|
+
const ALL_COMMENTS_TABLE_NAMES = ["comment", "comment_report", "comment_reaction"];
|
|
1660
|
+
function getActiveCommentsTableNames(comments, prefixOrOptions) {
|
|
1661
|
+
if (!comments) return [];
|
|
1662
|
+
const resolvedPrefix = prefixOrOptions !== void 0 ? prefixOrOptions : typeof comments === "object" && comments.tablePrefix !== void 0 ? comments.tablePrefix : void 0;
|
|
1663
|
+
return [
|
|
1664
|
+
resolveTableName("comment", resolvedPrefix),
|
|
1665
|
+
resolveTableName("comment_report", resolvedPrefix),
|
|
1666
|
+
resolveTableName("comment_reaction", resolvedPrefix)
|
|
1667
|
+
];
|
|
1430
1668
|
}
|
|
1431
|
-
function
|
|
1669
|
+
function generateCommentsSchema(comments, prefixOrOptions) {
|
|
1670
|
+
if (!comments) {
|
|
1671
|
+
return "// Qarpeo Comments is disabled\nexport default {};\n";
|
|
1672
|
+
}
|
|
1673
|
+
const resolvedPrefix = prefixOrOptions !== void 0 ? prefixOrOptions : typeof comments === "object" && comments.tablePrefix !== void 0 ? comments.tablePrefix : void 0;
|
|
1674
|
+
const commentTbl = resolveTableName("comment", resolvedPrefix);
|
|
1675
|
+
const reportTbl = resolveTableName("comment_report", resolvedPrefix);
|
|
1676
|
+
const reactionTbl = resolveTableName("comment_reaction", resolvedPrefix);
|
|
1677
|
+
const lines = [
|
|
1678
|
+
`// Auto-generated by qarpeo \u2014 Threaded Comments System`,
|
|
1679
|
+
`// snakeCase.table maps camelCase property names \u2192 snake_case column names automatically`,
|
|
1680
|
+
`import { integer, text, index, uniqueIndex, snakeCase } from "drizzle-orm/sqlite-core";`,
|
|
1681
|
+
``,
|
|
1682
|
+
`// \u2500\u2500\u2500 1. Comments \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
|
|
1683
|
+
`export const comment = snakeCase.table("${commentTbl}", {`,
|
|
1684
|
+
` id: text().primaryKey(),`,
|
|
1685
|
+
` /** Universal Resource Name of the target entity, e.g. "urn:cms:blog:abc123" */`,
|
|
1686
|
+
` targetUrn: text().notNull(),`,
|
|
1687
|
+
` tenantId: text(),`,
|
|
1688
|
+
` /** Parent comment ID; null for root-level comments */`,
|
|
1689
|
+
` parentId: text(),`,
|
|
1690
|
+
` /** Materialized path for fast subtree queries, e.g. "/0001/0002/" */`,
|
|
1691
|
+
` path: text().notNull().default("/"),`,
|
|
1692
|
+
` depth: integer().notNull().default(0),`,
|
|
1693
|
+
` /** Authenticated author user ID; null for anonymous guest comments */`,
|
|
1694
|
+
` authorId: text(),`,
|
|
1695
|
+
` authorName: text().notNull(),`,
|
|
1696
|
+
` authorEmail: text(),`,
|
|
1697
|
+
` /** Deterministic inline SVG data-URI avatar \u2014 no external CDN calls */`,
|
|
1698
|
+
` authorAvatar: text(),`,
|
|
1699
|
+
` /** Anonymous author IP; never exposed in public API responses */`,
|
|
1700
|
+
` authorIp: text(),`,
|
|
1701
|
+
` content: text().notNull(),`,
|
|
1702
|
+
` /** pending | approved | spam | deleted */`,
|
|
1703
|
+
` status: text().notNull().default("pending"),`,
|
|
1704
|
+
` /** Unix ms timestamp; non-null means the comment is tombstoned */`,
|
|
1705
|
+
` deletedAt: integer(),`,
|
|
1706
|
+
` reportCount: integer().notNull().default(0),`,
|
|
1707
|
+
` /** JSON map of reaction type \u2192 count, e.g. {"like":3,"heart":1} */`,
|
|
1708
|
+
` reactionCounts: text().notNull().default("{}"),`,
|
|
1709
|
+
` metadataJson: text().notNull().default("{}"),`,
|
|
1710
|
+
` createdAt: integer().notNull(),`,
|
|
1711
|
+
` updatedAt: integer().notNull(),`,
|
|
1712
|
+
`}, (t) => [`,
|
|
1713
|
+
` index("${resolveIndexName(commentTbl, "target")}").on(t.targetUrn, t.status, t.createdAt),`,
|
|
1714
|
+
` index("${resolveIndexName(commentTbl, "parent")}").on(t.parentId),`,
|
|
1715
|
+
` index("${resolveIndexName(commentTbl, "path")}").on(t.path),`,
|
|
1716
|
+
` index("${resolveIndexName(commentTbl, "tenant")}").on(t.tenantId),`,
|
|
1717
|
+
` index("${resolveIndexName(commentTbl, "author")}").on(t.authorId),`,
|
|
1718
|
+
`]);`,
|
|
1719
|
+
``,
|
|
1720
|
+
`// Backward-compatibility alias`,
|
|
1721
|
+
`export const qarpeoComments = comment;`,
|
|
1722
|
+
``,
|
|
1723
|
+
`// \u2500\u2500\u2500 2. Community Reports \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
|
|
1724
|
+
`export const commentReport = snakeCase.table("${reportTbl}", {`,
|
|
1725
|
+
` id: text().primaryKey(),`,
|
|
1726
|
+
` commentId: text().notNull(),`,
|
|
1727
|
+
` reporterIp: text(),`,
|
|
1728
|
+
` reporterUserId: text(),`,
|
|
1729
|
+
` /** spam | harassment | off-topic | misinformation | other */`,
|
|
1730
|
+
` reason: text().notNull(),`,
|
|
1731
|
+
` note: text(),`,
|
|
1732
|
+
` createdAt: integer().notNull(),`,
|
|
1733
|
+
`}, (t) => [`,
|
|
1734
|
+
` index("${resolveIndexName(reportTbl, "comment")}").on(t.commentId),`,
|
|
1735
|
+
`]);`,
|
|
1736
|
+
``,
|
|
1737
|
+
`// Backward-compatibility alias`,
|
|
1738
|
+
`export const qarpeoCommentReports = commentReport;`,
|
|
1739
|
+
``,
|
|
1740
|
+
`// \u2500\u2500\u2500 3. Comment Reactions \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
|
|
1741
|
+
`export const commentReaction = snakeCase.table("${reactionTbl}", {`,
|
|
1742
|
+
` id: text().primaryKey(),`,
|
|
1743
|
+
` commentId: text().notNull(),`,
|
|
1744
|
+
` /** Authenticated user ID; null for anonymous reactions (keyed by IP) */`,
|
|
1745
|
+
` userId: text(),`,
|
|
1746
|
+
` ip: text(),`,
|
|
1747
|
+
` /** like | heart | fire | unicorn \u2014 or any string from CommentsOptions.reactions */`,
|
|
1748
|
+
` reaction: text().notNull(),`,
|
|
1749
|
+
` createdAt: integer().notNull(),`,
|
|
1750
|
+
`}, (t) => [`,
|
|
1751
|
+
` index("${resolveIndexName(reactionTbl, "comment")}").on(t.commentId),`,
|
|
1752
|
+
` uniqueIndex("${resolveIndexName(reactionTbl, "unique_user")}").on(t.commentId, t.userId, t.reaction),`,
|
|
1753
|
+
`]);`,
|
|
1754
|
+
``,
|
|
1755
|
+
`// Backward-compatibility alias`,
|
|
1756
|
+
`export const qarpeoCommentReactions = commentReaction;`
|
|
1757
|
+
];
|
|
1758
|
+
return lines.join("\n") + "\n";
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
const ALL_STORE_TABLE_NAMES = [
|
|
1762
|
+
"store_product",
|
|
1763
|
+
"store_product_variant",
|
|
1764
|
+
"store_inventory",
|
|
1765
|
+
"store_category",
|
|
1766
|
+
"store_cart",
|
|
1767
|
+
"store_cart_item",
|
|
1768
|
+
"store_order",
|
|
1769
|
+
"store_order_item",
|
|
1770
|
+
"store_discount",
|
|
1771
|
+
"store_customer_address"
|
|
1772
|
+
];
|
|
1773
|
+
function getActiveStoreTableNames(store, prefixOrOptions) {
|
|
1774
|
+
if (!store) return [];
|
|
1775
|
+
const resolvedPrefix = prefixOrOptions !== void 0 ? prefixOrOptions : typeof store === "object" && store.tablePrefix !== void 0 ? store.tablePrefix : void 0;
|
|
1776
|
+
return ALL_STORE_TABLE_NAMES.map((name) => resolveTableName(name, resolvedPrefix));
|
|
1777
|
+
}
|
|
1778
|
+
function generateStoreSchema(store, prefixOrOptions) {
|
|
1432
1779
|
if (!store) {
|
|
1433
1780
|
return "// Qarpeo Store App is disabled\nexport default {};\n";
|
|
1434
1781
|
}
|
|
@@ -1674,110 +2021,53 @@ function generateStoreSchema(store, prefixOrOptions) {
|
|
|
1674
2021
|
return lines.join("\n");
|
|
1675
2022
|
}
|
|
1676
2023
|
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
"comment_report",
|
|
1680
|
-
"comment_reaction"
|
|
1681
|
-
];
|
|
1682
|
-
function getActiveCommentsTableNames(comments, prefixOrOptions) {
|
|
1683
|
-
if (!comments) return [];
|
|
1684
|
-
const resolvedPrefix = prefixOrOptions !== void 0 ? prefixOrOptions : typeof comments === "object" && comments.tablePrefix !== void 0 ? comments.tablePrefix : void 0;
|
|
1685
|
-
return [
|
|
1686
|
-
resolveTableName("comment", resolvedPrefix),
|
|
1687
|
-
resolveTableName("comment_report", resolvedPrefix),
|
|
1688
|
-
resolveTableName("comment_reaction", resolvedPrefix)
|
|
1689
|
-
];
|
|
2024
|
+
function toPascalCase(str) {
|
|
2025
|
+
return str.replace(/[-_](\w)/g, (_, c) => c.toUpperCase()).replace(/^(\w)/, (_, c) => c.toUpperCase());
|
|
1690
2026
|
}
|
|
1691
|
-
function
|
|
1692
|
-
|
|
1693
|
-
|
|
2027
|
+
function toConstantCase(str) {
|
|
2028
|
+
return str.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[-\s]/g, "_").toUpperCase();
|
|
2029
|
+
}
|
|
2030
|
+
function findDurableObjectFiles(layers, customDir) {
|
|
2031
|
+
const doMap = /* @__PURE__ */ new Map();
|
|
2032
|
+
const candidateDirs = customDir ? [customDir] : ["server/do"];
|
|
2033
|
+
for (const layer of layers) {
|
|
2034
|
+
const baseDirs = /* @__PURE__ */ new Set();
|
|
2035
|
+
if (layer.config?.srcDir) baseDirs.add(layer.config.srcDir);
|
|
2036
|
+
if (layer.config?.rootDir) baseDirs.add(layer.config.rootDir);
|
|
2037
|
+
if (layer.cwd) baseDirs.add(layer.cwd);
|
|
2038
|
+
for (const baseDir of baseDirs) {
|
|
2039
|
+
for (const relDir of candidateDirs) {
|
|
2040
|
+
const fullDir = resolve(baseDir, relDir);
|
|
2041
|
+
if (!existsSync(fullDir)) continue;
|
|
2042
|
+
try {
|
|
2043
|
+
const entries = readdirSync(fullDir);
|
|
2044
|
+
for (const entry of entries) {
|
|
2045
|
+
const fullPath = join(fullDir, entry);
|
|
2046
|
+
const stat = statSync(fullPath);
|
|
2047
|
+
if (stat.isFile() && (entry.endsWith(".ts") || entry.endsWith(".js") || entry.endsWith(".mjs"))) {
|
|
2048
|
+
if (entry.endsWith(".d.ts")) continue;
|
|
2049
|
+
const ext = extname(entry);
|
|
2050
|
+
const rawName = basename(entry, ext);
|
|
2051
|
+
const name = rawName.replace(/\.do$/, "");
|
|
2052
|
+
const pascal = toPascalCase(name);
|
|
2053
|
+
const className = pascal.endsWith("DO") ? pascal : `${pascal}DO`;
|
|
2054
|
+
const bindingName = toConstantCase(name);
|
|
2055
|
+
const importPath = fullPath.replace(/\\/g, "/").replace(/\.(ts|js|mjs)$/, "");
|
|
2056
|
+
doMap.set(name, {
|
|
2057
|
+
name,
|
|
2058
|
+
className,
|
|
2059
|
+
bindingName,
|
|
2060
|
+
file: fullPath,
|
|
2061
|
+
importPath
|
|
2062
|
+
});
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
} catch {
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
}
|
|
1694
2069
|
}
|
|
1695
|
-
|
|
1696
|
-
const commentTbl = resolveTableName("comment", resolvedPrefix);
|
|
1697
|
-
const reportTbl = resolveTableName("comment_report", resolvedPrefix);
|
|
1698
|
-
const reactionTbl = resolveTableName("comment_reaction", resolvedPrefix);
|
|
1699
|
-
const lines = [
|
|
1700
|
-
`// Auto-generated by qarpeo \u2014 Threaded Comments System`,
|
|
1701
|
-
`// snakeCase.table maps camelCase property names \u2192 snake_case column names automatically`,
|
|
1702
|
-
`import { integer, text, index, uniqueIndex, snakeCase } from "drizzle-orm/sqlite-core";`,
|
|
1703
|
-
``,
|
|
1704
|
-
`// \u2500\u2500\u2500 1. Comments \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
|
|
1705
|
-
`export const comment = snakeCase.table("${commentTbl}", {`,
|
|
1706
|
-
` id: text().primaryKey(),`,
|
|
1707
|
-
` /** Universal Resource Name of the target entity, e.g. "urn:cms:blog:abc123" */`,
|
|
1708
|
-
` targetUrn: text().notNull(),`,
|
|
1709
|
-
` tenantId: text(),`,
|
|
1710
|
-
` /** Parent comment ID; null for root-level comments */`,
|
|
1711
|
-
` parentId: text(),`,
|
|
1712
|
-
` /** Materialized path for fast subtree queries, e.g. "/0001/0002/" */`,
|
|
1713
|
-
` path: text().notNull().default("/"),`,
|
|
1714
|
-
` depth: integer().notNull().default(0),`,
|
|
1715
|
-
` /** Authenticated author user ID; null for anonymous guest comments */`,
|
|
1716
|
-
` authorId: text(),`,
|
|
1717
|
-
` authorName: text().notNull(),`,
|
|
1718
|
-
` authorEmail: text(),`,
|
|
1719
|
-
` /** Deterministic inline SVG data-URI avatar \u2014 no external CDN calls */`,
|
|
1720
|
-
` authorAvatar: text(),`,
|
|
1721
|
-
` /** Anonymous author IP; never exposed in public API responses */`,
|
|
1722
|
-
` authorIp: text(),`,
|
|
1723
|
-
` content: text().notNull(),`,
|
|
1724
|
-
` /** pending | approved | spam | deleted */`,
|
|
1725
|
-
` status: text().notNull().default("pending"),`,
|
|
1726
|
-
` /** Unix ms timestamp; non-null means the comment is tombstoned */`,
|
|
1727
|
-
` deletedAt: integer(),`,
|
|
1728
|
-
` reportCount: integer().notNull().default(0),`,
|
|
1729
|
-
` /** JSON map of reaction type \u2192 count, e.g. {"like":3,"heart":1} */`,
|
|
1730
|
-
` reactionCounts: text().notNull().default("{}"),`,
|
|
1731
|
-
` metadataJson: text().notNull().default("{}"),`,
|
|
1732
|
-
` createdAt: integer().notNull(),`,
|
|
1733
|
-
` updatedAt: integer().notNull(),`,
|
|
1734
|
-
`}, (t) => [`,
|
|
1735
|
-
` index("${resolveIndexName(commentTbl, "target")}").on(t.targetUrn, t.status, t.createdAt),`,
|
|
1736
|
-
` index("${resolveIndexName(commentTbl, "parent")}").on(t.parentId),`,
|
|
1737
|
-
` index("${resolveIndexName(commentTbl, "path")}").on(t.path),`,
|
|
1738
|
-
` index("${resolveIndexName(commentTbl, "tenant")}").on(t.tenantId),`,
|
|
1739
|
-
` index("${resolveIndexName(commentTbl, "author")}").on(t.authorId),`,
|
|
1740
|
-
`]);`,
|
|
1741
|
-
``,
|
|
1742
|
-
`// Backward-compatibility alias`,
|
|
1743
|
-
`export const qarpeoComments = comment;`,
|
|
1744
|
-
``,
|
|
1745
|
-
`// \u2500\u2500\u2500 2. Community Reports \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
|
|
1746
|
-
`export const commentReport = snakeCase.table("${reportTbl}", {`,
|
|
1747
|
-
` id: text().primaryKey(),`,
|
|
1748
|
-
` commentId: text().notNull(),`,
|
|
1749
|
-
` reporterIp: text(),`,
|
|
1750
|
-
` reporterUserId: text(),`,
|
|
1751
|
-
` /** spam | harassment | off-topic | misinformation | other */`,
|
|
1752
|
-
` reason: text().notNull(),`,
|
|
1753
|
-
` note: text(),`,
|
|
1754
|
-
` createdAt: integer().notNull(),`,
|
|
1755
|
-
`}, (t) => [`,
|
|
1756
|
-
` index("${resolveIndexName(reportTbl, "comment")}").on(t.commentId),`,
|
|
1757
|
-
`]);`,
|
|
1758
|
-
``,
|
|
1759
|
-
`// Backward-compatibility alias`,
|
|
1760
|
-
`export const qarpeoCommentReports = commentReport;`,
|
|
1761
|
-
``,
|
|
1762
|
-
`// \u2500\u2500\u2500 3. Comment Reactions \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
|
|
1763
|
-
`export const commentReaction = snakeCase.table("${reactionTbl}", {`,
|
|
1764
|
-
` id: text().primaryKey(),`,
|
|
1765
|
-
` commentId: text().notNull(),`,
|
|
1766
|
-
` /** Authenticated user ID; null for anonymous reactions (keyed by IP) */`,
|
|
1767
|
-
` userId: text(),`,
|
|
1768
|
-
` ip: text(),`,
|
|
1769
|
-
` /** like | heart | fire | unicorn \u2014 or any string from CommentsOptions.reactions */`,
|
|
1770
|
-
` reaction: text().notNull(),`,
|
|
1771
|
-
` createdAt: integer().notNull(),`,
|
|
1772
|
-
`}, (t) => [`,
|
|
1773
|
-
` index("${resolveIndexName(reactionTbl, "comment")}").on(t.commentId),`,
|
|
1774
|
-
` uniqueIndex("${resolveIndexName(reactionTbl, "unique_user")}").on(t.commentId, t.userId, t.reaction),`,
|
|
1775
|
-
`]);`,
|
|
1776
|
-
``,
|
|
1777
|
-
`// Backward-compatibility alias`,
|
|
1778
|
-
`export const qarpeoCommentReactions = commentReaction;`
|
|
1779
|
-
];
|
|
1780
|
-
return lines.join("\n") + "\n";
|
|
2070
|
+
return Array.from(doMap.values());
|
|
1781
2071
|
}
|
|
1782
2072
|
|
|
1783
2073
|
function findJobFiles(layers, dirName = "server/jobs") {
|
|
@@ -1898,88 +2188,39 @@ function scanDirectory(currentDir, rootDir, map) {
|
|
|
1898
2188
|
importPath,
|
|
1899
2189
|
cron,
|
|
1900
2190
|
description
|
|
1901
|
-
});
|
|
1902
|
-
}
|
|
1903
|
-
}
|
|
1904
|
-
}
|
|
1905
|
-
|
|
1906
|
-
function findWorkflowFiles(layers, dirName = "server/workflows") {
|
|
1907
|
-
const workflowsMap = /* @__PURE__ */ new Map();
|
|
1908
|
-
for (const layer of layers) {
|
|
1909
|
-
const baseDirs = /* @__PURE__ */ new Set();
|
|
1910
|
-
if (layer.config?.srcDir) baseDirs.add(layer.config.srcDir);
|
|
1911
|
-
if (layer.config?.rootDir) baseDirs.add(layer.config.rootDir);
|
|
1912
|
-
if (layer.cwd) baseDirs.add(layer.cwd);
|
|
1913
|
-
for (const baseDir of baseDirs) {
|
|
1914
|
-
const workflowsDir = resolve(baseDir, dirName);
|
|
1915
|
-
if (!existsSync(workflowsDir)) continue;
|
|
1916
|
-
try {
|
|
1917
|
-
const entries = readdirSync(workflowsDir);
|
|
1918
|
-
for (const entry of entries) {
|
|
1919
|
-
const fullPath = join(workflowsDir, entry);
|
|
1920
|
-
const stat = statSync(fullPath);
|
|
1921
|
-
if (stat.isFile() && (entry.endsWith(".ts") || entry.endsWith(".js") || entry.endsWith(".mjs"))) {
|
|
1922
|
-
if (entry.endsWith(".d.ts")) continue;
|
|
1923
|
-
const ext = extname(entry);
|
|
1924
|
-
const name = basename(entry, ext);
|
|
1925
|
-
const importPath = fullPath.replace(/\\/g, "/").replace(/\.(ts|js|mjs)$/, "");
|
|
1926
|
-
workflowsMap.set(name, { name, file: fullPath, importPath });
|
|
1927
|
-
}
|
|
1928
|
-
}
|
|
1929
|
-
} catch {
|
|
1930
|
-
}
|
|
1931
|
-
}
|
|
1932
|
-
}
|
|
1933
|
-
return Array.from(workflowsMap.values());
|
|
1934
|
-
}
|
|
1935
|
-
|
|
1936
|
-
function toPascalCase(str) {
|
|
1937
|
-
return str.replace(/[-_](\w)/g, (_, c) => c.toUpperCase()).replace(/^(\w)/, (_, c) => c.toUpperCase());
|
|
1938
|
-
}
|
|
1939
|
-
function toConstantCase(str) {
|
|
1940
|
-
return str.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[-\s]/g, "_").toUpperCase();
|
|
1941
|
-
}
|
|
1942
|
-
function findDurableObjectFiles(layers, customDir) {
|
|
1943
|
-
const doMap = /* @__PURE__ */ new Map();
|
|
1944
|
-
const candidateDirs = customDir ? [customDir] : ["server/do"];
|
|
1945
|
-
for (const layer of layers) {
|
|
1946
|
-
const baseDirs = /* @__PURE__ */ new Set();
|
|
1947
|
-
if (layer.config?.srcDir) baseDirs.add(layer.config.srcDir);
|
|
1948
|
-
if (layer.config?.rootDir) baseDirs.add(layer.config.rootDir);
|
|
1949
|
-
if (layer.cwd) baseDirs.add(layer.cwd);
|
|
1950
|
-
for (const baseDir of baseDirs) {
|
|
1951
|
-
for (const relDir of candidateDirs) {
|
|
1952
|
-
const fullDir = resolve(baseDir, relDir);
|
|
1953
|
-
if (!existsSync(fullDir)) continue;
|
|
1954
|
-
try {
|
|
1955
|
-
const entries = readdirSync(fullDir);
|
|
1956
|
-
for (const entry of entries) {
|
|
1957
|
-
const fullPath = join(fullDir, entry);
|
|
1958
|
-
const stat = statSync(fullPath);
|
|
1959
|
-
if (stat.isFile() && (entry.endsWith(".ts") || entry.endsWith(".js") || entry.endsWith(".mjs"))) {
|
|
1960
|
-
if (entry.endsWith(".d.ts")) continue;
|
|
1961
|
-
const ext = extname(entry);
|
|
1962
|
-
const rawName = basename(entry, ext);
|
|
1963
|
-
const name = rawName.replace(/\.do$/, "");
|
|
1964
|
-
const pascal = toPascalCase(name);
|
|
1965
|
-
const className = pascal.endsWith("DO") ? pascal : `${pascal}DO`;
|
|
1966
|
-
const bindingName = toConstantCase(name);
|
|
1967
|
-
const importPath = fullPath.replace(/\\/g, "/").replace(/\.(ts|js|mjs)$/, "");
|
|
1968
|
-
doMap.set(name, {
|
|
1969
|
-
name,
|
|
1970
|
-
className,
|
|
1971
|
-
bindingName,
|
|
1972
|
-
file: fullPath,
|
|
1973
|
-
importPath
|
|
1974
|
-
});
|
|
1975
|
-
}
|
|
2191
|
+
});
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2195
|
+
|
|
2196
|
+
function findWorkflowFiles(layers, dirName = "server/workflows") {
|
|
2197
|
+
const workflowsMap = /* @__PURE__ */ new Map();
|
|
2198
|
+
for (const layer of layers) {
|
|
2199
|
+
const baseDirs = /* @__PURE__ */ new Set();
|
|
2200
|
+
if (layer.config?.srcDir) baseDirs.add(layer.config.srcDir);
|
|
2201
|
+
if (layer.config?.rootDir) baseDirs.add(layer.config.rootDir);
|
|
2202
|
+
if (layer.cwd) baseDirs.add(layer.cwd);
|
|
2203
|
+
for (const baseDir of baseDirs) {
|
|
2204
|
+
const workflowsDir = resolve(baseDir, dirName);
|
|
2205
|
+
if (!existsSync(workflowsDir)) continue;
|
|
2206
|
+
try {
|
|
2207
|
+
const entries = readdirSync(workflowsDir);
|
|
2208
|
+
for (const entry of entries) {
|
|
2209
|
+
const fullPath = join(workflowsDir, entry);
|
|
2210
|
+
const stat = statSync(fullPath);
|
|
2211
|
+
if (stat.isFile() && (entry.endsWith(".ts") || entry.endsWith(".js") || entry.endsWith(".mjs"))) {
|
|
2212
|
+
if (entry.endsWith(".d.ts")) continue;
|
|
2213
|
+
const ext = extname(entry);
|
|
2214
|
+
const name = basename(entry, ext);
|
|
2215
|
+
const importPath = fullPath.replace(/\\/g, "/").replace(/\.(ts|js|mjs)$/, "");
|
|
2216
|
+
workflowsMap.set(name, { name, file: fullPath, importPath });
|
|
1976
2217
|
}
|
|
1977
|
-
} catch {
|
|
1978
2218
|
}
|
|
2219
|
+
} catch {
|
|
1979
2220
|
}
|
|
1980
2221
|
}
|
|
1981
2222
|
}
|
|
1982
|
-
return Array.from(
|
|
2223
|
+
return Array.from(workflowsMap.values());
|
|
1983
2224
|
}
|
|
1984
2225
|
|
|
1985
2226
|
function resolveProjectName(nuxt, options) {
|
|
@@ -2655,230 +2896,4 @@ function findToolFiles(layers, customDir) {
|
|
|
2655
2896
|
return Array.from(toolsMap.values());
|
|
2656
2897
|
}
|
|
2657
2898
|
|
|
2658
|
-
|
|
2659
|
-
const opts = options;
|
|
2660
|
-
const hasDb = Boolean(opts.db || opts.d1);
|
|
2661
|
-
const hasKv = Boolean(opts.kv);
|
|
2662
|
-
const hasBlob = Boolean(opts.blob || opts.r2);
|
|
2663
|
-
const hasAi = Boolean(opts.ai);
|
|
2664
|
-
const hasVectorize = Boolean(opts.vectorize);
|
|
2665
|
-
const hasQueue = Boolean(opts.queue);
|
|
2666
|
-
const hasHyperdrive = Boolean(opts.hyperdrive);
|
|
2667
|
-
const hasBrowser = Boolean(opts.browser);
|
|
2668
|
-
const hasAnalytics = Boolean(opts.analytics);
|
|
2669
|
-
const hasDo = Boolean(opts.do || opts.agents);
|
|
2670
|
-
const hasAuth = Boolean(opts.auth);
|
|
2671
|
-
const hasEmail = Boolean(opts.email || opts.mail);
|
|
2672
|
-
const hasPayments = Boolean(opts.payments);
|
|
2673
|
-
const hasNotifications = Boolean(opts.notifications || opts.notify);
|
|
2674
|
-
const hasComments = Boolean(opts.comments);
|
|
2675
|
-
const hasCms = Boolean(opts.cms);
|
|
2676
|
-
const hasStore = Boolean(opts.store);
|
|
2677
|
-
const hasAgents = Boolean(opts.agents);
|
|
2678
|
-
const hasMultitenant = Boolean(opts.multitenant);
|
|
2679
|
-
const hasSite = Boolean(opts.site || opts.seo);
|
|
2680
|
-
const hasPwa = Boolean(opts.pwa || typeof opts.site === "object" && opts.site?.pwa);
|
|
2681
|
-
const features = {
|
|
2682
|
-
db: hasDb,
|
|
2683
|
-
kv: hasKv,
|
|
2684
|
-
blob: hasBlob,
|
|
2685
|
-
ai: hasAi,
|
|
2686
|
-
vectorize: hasVectorize,
|
|
2687
|
-
queue: hasQueue,
|
|
2688
|
-
workflows: Boolean(opts.workflows),
|
|
2689
|
-
hyperdrive: hasHyperdrive,
|
|
2690
|
-
browser: hasBrowser,
|
|
2691
|
-
analytics: hasAnalytics,
|
|
2692
|
-
ratelimit: Boolean(opts.ratelimit),
|
|
2693
|
-
do: hasDo,
|
|
2694
|
-
auth: hasAuth,
|
|
2695
|
-
email: hasEmail,
|
|
2696
|
-
payments: hasPayments,
|
|
2697
|
-
notifications: hasNotifications,
|
|
2698
|
-
comments: hasComments,
|
|
2699
|
-
cms: hasCms,
|
|
2700
|
-
store: hasStore,
|
|
2701
|
-
agents: hasAgents,
|
|
2702
|
-
multitenant: hasMultitenant,
|
|
2703
|
-
site: hasSite,
|
|
2704
|
-
pwa: hasPwa
|
|
2705
|
-
};
|
|
2706
|
-
const expectedBindings = [];
|
|
2707
|
-
if (hasDb) {
|
|
2708
|
-
expectedBindings.push({
|
|
2709
|
-
type: "d1",
|
|
2710
|
-
name: typeof opts.db === "object" && opts.db.binding ? opts.db.binding : "DB",
|
|
2711
|
-
feature: "db",
|
|
2712
|
-
required: true
|
|
2713
|
-
});
|
|
2714
|
-
}
|
|
2715
|
-
if (hasKv) {
|
|
2716
|
-
expectedBindings.push({
|
|
2717
|
-
type: "kv_namespace",
|
|
2718
|
-
name: typeof opts.kv === "object" && opts.kv.binding ? opts.kv.binding : "KV",
|
|
2719
|
-
feature: "kv",
|
|
2720
|
-
required: true
|
|
2721
|
-
});
|
|
2722
|
-
}
|
|
2723
|
-
if (hasBlob) {
|
|
2724
|
-
expectedBindings.push({
|
|
2725
|
-
type: "r2_bucket",
|
|
2726
|
-
name: typeof opts.blob === "object" && opts.blob.binding ? opts.blob.binding : "BLOB",
|
|
2727
|
-
feature: "blob",
|
|
2728
|
-
required: true
|
|
2729
|
-
});
|
|
2730
|
-
}
|
|
2731
|
-
if (hasAi) {
|
|
2732
|
-
expectedBindings.push({ type: "ai", name: "AI", feature: "ai", required: true });
|
|
2733
|
-
}
|
|
2734
|
-
if (hasVectorize) {
|
|
2735
|
-
expectedBindings.push({
|
|
2736
|
-
type: "vectorize",
|
|
2737
|
-
name: typeof opts.vectorize === "object" && opts.vectorize.binding ? opts.vectorize.binding : "VECTORIZE",
|
|
2738
|
-
feature: "vectorize",
|
|
2739
|
-
required: true
|
|
2740
|
-
});
|
|
2741
|
-
}
|
|
2742
|
-
if (hasQueue) {
|
|
2743
|
-
expectedBindings.push({
|
|
2744
|
-
type: "queue",
|
|
2745
|
-
name: typeof opts.queue === "object" && opts.queue.binding ? opts.queue.binding : "QUEUE",
|
|
2746
|
-
feature: "queue",
|
|
2747
|
-
required: true
|
|
2748
|
-
});
|
|
2749
|
-
}
|
|
2750
|
-
if (hasHyperdrive) {
|
|
2751
|
-
expectedBindings.push({
|
|
2752
|
-
type: "hyperdrive",
|
|
2753
|
-
name: typeof opts.hyperdrive === "object" && opts.hyperdrive.binding ? opts.hyperdrive.binding : "HYPERDRIVE",
|
|
2754
|
-
feature: "hyperdrive",
|
|
2755
|
-
required: true
|
|
2756
|
-
});
|
|
2757
|
-
}
|
|
2758
|
-
if (hasBrowser) {
|
|
2759
|
-
expectedBindings.push({
|
|
2760
|
-
type: "browser",
|
|
2761
|
-
name: "BROWSER",
|
|
2762
|
-
feature: "browser",
|
|
2763
|
-
required: false
|
|
2764
|
-
});
|
|
2765
|
-
}
|
|
2766
|
-
if (hasAnalytics) {
|
|
2767
|
-
expectedBindings.push({
|
|
2768
|
-
type: "analytics_engine",
|
|
2769
|
-
name: "ANALYTICS",
|
|
2770
|
-
feature: "analytics",
|
|
2771
|
-
required: false
|
|
2772
|
-
});
|
|
2773
|
-
}
|
|
2774
|
-
const expectedSecrets = [];
|
|
2775
|
-
if (hasAuth || hasBlob || hasStore) {
|
|
2776
|
-
expectedSecrets.push({
|
|
2777
|
-
key: "NUXT_APP_SECRET",
|
|
2778
|
-
feature: hasAuth ? "auth" : hasBlob ? "blob" : "store",
|
|
2779
|
-
required: true,
|
|
2780
|
-
description: "Signing secret for auth sessions, preview tokens, and signed R2 URLs.",
|
|
2781
|
-
generatable: "secret"
|
|
2782
|
-
});
|
|
2783
|
-
}
|
|
2784
|
-
if (hasNotifications) {
|
|
2785
|
-
expectedSecrets.push(
|
|
2786
|
-
{
|
|
2787
|
-
key: "VAPID_PUBLIC_KEY",
|
|
2788
|
-
feature: "notifications",
|
|
2789
|
-
required: false,
|
|
2790
|
-
description: "Web Push VAPID public key.",
|
|
2791
|
-
generatable: "vapid"
|
|
2792
|
-
},
|
|
2793
|
-
{
|
|
2794
|
-
key: "VAPID_PRIVATE_KEY",
|
|
2795
|
-
feature: "notifications",
|
|
2796
|
-
required: false,
|
|
2797
|
-
description: "Web Push VAPID private key.",
|
|
2798
|
-
generatable: "vapid"
|
|
2799
|
-
}
|
|
2800
|
-
);
|
|
2801
|
-
}
|
|
2802
|
-
if (hasPayments) {
|
|
2803
|
-
expectedSecrets.push(
|
|
2804
|
-
{
|
|
2805
|
-
key: "STRIPE_SECRET_KEY",
|
|
2806
|
-
feature: "payments",
|
|
2807
|
-
required: true,
|
|
2808
|
-
description: "Stripe API secret key for checkout & portal."
|
|
2809
|
-
},
|
|
2810
|
-
{
|
|
2811
|
-
key: "STRIPE_WEBHOOK_SECRET",
|
|
2812
|
-
feature: "payments",
|
|
2813
|
-
required: true,
|
|
2814
|
-
description: "Stripe webhook signing secret."
|
|
2815
|
-
}
|
|
2816
|
-
);
|
|
2817
|
-
}
|
|
2818
|
-
if (hasEmail) {
|
|
2819
|
-
expectedSecrets.push({
|
|
2820
|
-
key: "RESEND_API_KEY",
|
|
2821
|
-
feature: "email",
|
|
2822
|
-
required: false,
|
|
2823
|
-
description: "Transactional email provider API key (when not using CF Email Routing)."
|
|
2824
|
-
});
|
|
2825
|
-
}
|
|
2826
|
-
const endpoints = {};
|
|
2827
|
-
if (hasSite) {
|
|
2828
|
-
endpoints.robots = "/robots.txt";
|
|
2829
|
-
endpoints.sitemap = "/sitemap.xml";
|
|
2830
|
-
endpoints.og = "/__qarpeo/og";
|
|
2831
|
-
}
|
|
2832
|
-
if (hasPwa) {
|
|
2833
|
-
endpoints.manifest = "/manifest.webmanifest";
|
|
2834
|
-
endpoints.sw = "/sw.js";
|
|
2835
|
-
}
|
|
2836
|
-
return {
|
|
2837
|
-
qarpeoVersion,
|
|
2838
|
-
workerName: typeof opts.workerName === "string" ? opts.workerName : null,
|
|
2839
|
-
features,
|
|
2840
|
-
expectedBindings,
|
|
2841
|
-
expectedSecrets,
|
|
2842
|
-
endpoints
|
|
2843
|
-
};
|
|
2844
|
-
}
|
|
2845
|
-
defineEventHandler((event) => {
|
|
2846
|
-
const config = useRuntimeConfig();
|
|
2847
|
-
const baseManifest = config.qarpeo?.manifest;
|
|
2848
|
-
const cfEnv = event.context?.cloudflare?.env;
|
|
2849
|
-
const manifest = baseManifest || {
|
|
2850
|
-
qarpeoVersion: config.public?.qarpeoVersion || "0.0.0",
|
|
2851
|
-
workerName: null,
|
|
2852
|
-
features: {},
|
|
2853
|
-
expectedBindings: [],
|
|
2854
|
-
expectedSecrets: [],
|
|
2855
|
-
endpoints: {}
|
|
2856
|
-
};
|
|
2857
|
-
const bindingPresence = {};
|
|
2858
|
-
for (const b of manifest.expectedBindings) {
|
|
2859
|
-
bindingPresence[b.name] = Boolean(cfEnv && b.name in cfEnv && cfEnv[b.name] !== void 0);
|
|
2860
|
-
}
|
|
2861
|
-
const secretPresence = {};
|
|
2862
|
-
for (const s of manifest.expectedSecrets) {
|
|
2863
|
-
secretPresence[s.key] = Boolean(
|
|
2864
|
-
cfEnv && typeof cfEnv[s.key] === "string" && cfEnv[s.key].length > 0 || typeof process !== "undefined" && typeof process.env?.[s.key] === "string" && process.env[s.key].length > 0
|
|
2865
|
-
);
|
|
2866
|
-
}
|
|
2867
|
-
return new Response(
|
|
2868
|
-
JSON.stringify({
|
|
2869
|
-
...manifest,
|
|
2870
|
-
liveEnvPresence: {
|
|
2871
|
-
bindings: bindingPresence,
|
|
2872
|
-
secrets: secretPresence
|
|
2873
|
-
}
|
|
2874
|
-
}),
|
|
2875
|
-
{
|
|
2876
|
-
headers: {
|
|
2877
|
-
"Content-Type": "application/json; charset=UTF-8",
|
|
2878
|
-
"Cache-Control": "no-store"
|
|
2879
|
-
}
|
|
2880
|
-
}
|
|
2881
|
-
);
|
|
2882
|
-
});
|
|
2883
|
-
|
|
2884
|
-
export { ALL_CMS_TABLE_NAMES as A, resolveTableName as B, resolveIndexName as C, buildDevWranglerConfig as D, generateAuthSchema as E, FEATURE_DEPS as F, generateCommentsSchema as G, generateStoreSchema as H, findScheduledTasks as I, formatDlxCommand as J, resolveBindingName as K, createWranglerConfig as L, generateDevWranglerConfig as M, applyD1Migrations as N, findQueueFiles as O, findDurableObjectFiles as P, isPackageInstalled as Q, ensureEnabledFeatures as R, getActiveCmsTableNames as S, getActiveCommentsTableNames as T, getActiveStoreTableNames as U, hasDatabaseSchema as V, localDb as W, authSchema as X, wrangler as Y, resolveDatabaseTarget as a, resolveBinaryPath as b, getLocalDatabaseContext as c, getActiveAuthTableNames as d, ensurePackage as e, ALL_STORE_TABLE_NAMES as f, getFeatureNames as g, ALL_COMMENTS_TABLE_NAMES as h, discoverDatabases as i, findLocalD1Database as j, spawnBinSync as k, getJiti as l, resolveProjectName as m, checkDrizzleVersion as n, findSchemaFiles as o, findAgentFiles as p, findToolFiles as q, resolveFeatureInstall as r, scanSchemaExports as s, findBotFiles as t, findMcpFiles as u, findJobFiles as v, findWorkflowFiles as w, findEmailHandlerFiles as x, buildQarpeoManifest as y, version as z };
|
|
2899
|
+
export { ALL_CMS_TABLE_NAMES as A, resolveTableName as B, resolveIndexName as C, isPackageInstalled as D, applyD1Migrations as E, FEATURE_DEPS as F, findScheduledTasks as G, formatDlxCommand as H, resolveBindingName as I, createWranglerConfig as J, generateDevWranglerConfig as K, generateAuthSchema as L, generateCommentsSchema as M, generateStoreSchema as N, buildDevWranglerConfig as O, findDurableObjectFiles as P, findQueueFiles as Q, ensureEnabledFeatures as R, getActiveCmsTableNames as S, getActiveCommentsTableNames as T, getActiveStoreTableNames as U, hasDatabaseSchema as V, localDb as W, authSchema as X, wrangler as Y, resolveDatabaseTarget as a, buildQarpeoManifest as b, resolveBinaryPath as c, getLocalDatabaseContext as d, ensurePackage as e, getActiveAuthTableNames as f, getFeatureNames as g, ALL_STORE_TABLE_NAMES as h, ALL_COMMENTS_TABLE_NAMES as i, discoverDatabases as j, findLocalD1Database as k, spawnBinSync as l, getJiti as m, resolveProjectName as n, checkDrizzleVersion as o, findSchemaFiles as p, findAgentFiles as q, resolveFeatureInstall as r, scanSchemaExports as s, findToolFiles as t, findBotFiles as u, version as v, findMcpFiles as w, findJobFiles as x, findWorkflowFiles as y, findEmailHandlerFiles as z };
|