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
|
@@ -33,14 +33,12 @@ export declare class QarpeoRoomDO {
|
|
|
33
33
|
private broadcast;
|
|
34
34
|
/** Returns current active users list in the room. */
|
|
35
35
|
private getPresenceList;
|
|
36
|
-
/**
|
|
37
|
-
* Validates internal server control requests against REALTIME_ROOM_SECRET (if configured).
|
|
38
|
-
*/
|
|
36
|
+
/** Validates internal server control requests against REALTIME_ROOM_SECRET (if configured). */
|
|
39
37
|
private isAuthorizedServerRequest;
|
|
40
38
|
/**
|
|
41
|
-
* Authorizes client state mutation (state:patch / state:set).
|
|
42
|
-
*
|
|
43
|
-
*
|
|
39
|
+
* Authorizes client state mutation (state:patch / state:set). Restricts anonymous users by
|
|
40
|
+
* default unless REALTIME_ALLOW_ANONYMOUS_STATE_WRITE is enabled, or matches against configured
|
|
41
|
+
* REALTIME_STATE_WRITE_ROLES.
|
|
44
42
|
*/
|
|
45
43
|
private isStateWriteAuthorized;
|
|
46
44
|
}
|
|
@@ -456,7 +456,13 @@ export class QarpeoRoomDO {
|
|
|
456
456
|
const att2 = getAttachment(ws);
|
|
457
457
|
if (!this.isStateWriteAuthorized(att2?.user)) {
|
|
458
458
|
try {
|
|
459
|
-
ws.send(
|
|
459
|
+
ws.send(
|
|
460
|
+
JSON.stringify({
|
|
461
|
+
type: "error",
|
|
462
|
+
code: "unauthorized",
|
|
463
|
+
message: "Not authorized to mutate room state"
|
|
464
|
+
})
|
|
465
|
+
);
|
|
460
466
|
} catch {
|
|
461
467
|
}
|
|
462
468
|
return;
|
|
@@ -480,7 +486,13 @@ export class QarpeoRoomDO {
|
|
|
480
486
|
const att2 = getAttachment(ws);
|
|
481
487
|
if (!this.isStateWriteAuthorized(att2?.user)) {
|
|
482
488
|
try {
|
|
483
|
-
ws.send(
|
|
489
|
+
ws.send(
|
|
490
|
+
JSON.stringify({
|
|
491
|
+
type: "error",
|
|
492
|
+
code: "unauthorized",
|
|
493
|
+
message: "Not authorized to mutate room state"
|
|
494
|
+
})
|
|
495
|
+
);
|
|
484
496
|
} catch {
|
|
485
497
|
}
|
|
486
498
|
return;
|
|
@@ -590,9 +602,7 @@ export class QarpeoRoomDO {
|
|
|
590
602
|
}
|
|
591
603
|
return users;
|
|
592
604
|
}
|
|
593
|
-
/**
|
|
594
|
-
* Validates internal server control requests against REALTIME_ROOM_SECRET (if configured).
|
|
595
|
-
*/
|
|
605
|
+
/** Validates internal server control requests against REALTIME_ROOM_SECRET (if configured). */
|
|
596
606
|
isAuthorizedServerRequest(request) {
|
|
597
607
|
const roomSecret = this.env?.REALTIME_ROOM_SECRET || this.env?.roomSecret;
|
|
598
608
|
if (!roomSecret) return true;
|
|
@@ -600,9 +610,9 @@ export class QarpeoRoomDO {
|
|
|
600
610
|
return timingSafeEqual(provided, String(roomSecret));
|
|
601
611
|
}
|
|
602
612
|
/**
|
|
603
|
-
* Authorizes client state mutation (state:patch / state:set).
|
|
604
|
-
*
|
|
605
|
-
*
|
|
613
|
+
* Authorizes client state mutation (state:patch / state:set). Restricts anonymous users by
|
|
614
|
+
* default unless REALTIME_ALLOW_ANONYMOUS_STATE_WRITE is enabled, or matches against configured
|
|
615
|
+
* REALTIME_STATE_WRITE_ROLES.
|
|
606
616
|
*/
|
|
607
617
|
isStateWriteAuthorized(user) {
|
|
608
618
|
if (!user) return false;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { NitroApp } from "nitro/types";
|
|
2
2
|
/**
|
|
3
|
-
* Nitro server plugin for Qarpeo Comments.
|
|
4
|
-
*
|
|
5
|
-
* do not need to repeat DDL checks.
|
|
3
|
+
* Nitro server plugin for Qarpeo Comments. Pre-warms database tables on request lifecycle so
|
|
4
|
+
* individual route handlers do not need to repeat DDL checks.
|
|
6
5
|
*/
|
|
7
6
|
export default function (nitroApp: NitroApp): void;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import type { NitroApp } from "nitro/types";
|
|
2
|
-
/**
|
|
3
|
-
* Nitro server plugin that dispatches incoming Cloudflare emails to the user's email handler.
|
|
4
|
-
*/
|
|
2
|
+
/** Nitro server plugin that dispatches incoming Cloudflare emails to the user's email handler. */
|
|
5
3
|
export default function (nitroApp: NitroApp): void;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { NitroApp } from "nitro/types";
|
|
2
2
|
/**
|
|
3
|
-
* Nitro server plugin for Qarpeo Store App.
|
|
4
|
-
*
|
|
5
|
-
* so individual route handlers do not need to repeat DDL checks.
|
|
3
|
+
* Nitro server plugin for Qarpeo Store App. Pre-warms database tables on request lifecycle with
|
|
4
|
+
* module-level promise caching so individual route handlers do not need to repeat DDL checks.
|
|
6
5
|
*/
|
|
7
6
|
export default function (nitroApp: NitroApp): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* POST /__qarpeo/cloud/agents/run
|
|
3
3
|
*
|
|
4
|
-
* Invokes a registered AI agent with a test prompt from Qarpeo Cloud.
|
|
5
|
-
*
|
|
4
|
+
* Invokes a registered AI agent with a test prompt from Qarpeo Cloud. Requires `Authorization:
|
|
5
|
+
* Bearer <QARPEO_CLOUD_SECRET>`.
|
|
6
6
|
*/
|
|
7
7
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
8
8
|
ok: boolean;
|
|
@@ -11,7 +11,11 @@ export default defineEventHandler(async (event) => {
|
|
|
11
11
|
}
|
|
12
12
|
const d1 = getD1Binding(event);
|
|
13
13
|
if (!d1) {
|
|
14
|
-
throw createError({
|
|
14
|
+
throw createError({
|
|
15
|
+
statusCode: 500,
|
|
16
|
+
statusMessage: "Internal Server Error",
|
|
17
|
+
message: "D1 unavailable"
|
|
18
|
+
});
|
|
15
19
|
}
|
|
16
20
|
const entryTable = resolveTableName("cms_entry").replace(/"/g, "");
|
|
17
21
|
const row = await d1.prepare(
|
|
@@ -19,7 +23,11 @@ export default defineEventHandler(async (event) => {
|
|
|
19
23
|
FROM "${entryTable}" WHERE id = ?1 LIMIT 1`
|
|
20
24
|
).bind(id).first();
|
|
21
25
|
if (!row) {
|
|
22
|
-
throw createError({
|
|
26
|
+
throw createError({
|
|
27
|
+
statusCode: 404,
|
|
28
|
+
statusMessage: "Not Found",
|
|
29
|
+
message: "CMS entry not found"
|
|
30
|
+
});
|
|
23
31
|
}
|
|
24
32
|
return {
|
|
25
33
|
ok: true,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* POST /__qarpeo/cloud/cms/entry
|
|
3
3
|
*
|
|
4
|
-
* Create, update, or delete a CMS entry directly from Qarpeo Cloud.
|
|
5
|
-
*
|
|
4
|
+
* Create, update, or delete a CMS entry directly from Qarpeo Cloud. Body: `{ action?: "save" |
|
|
5
|
+
* "delete", id?, collection, title, slug?, description?, body?, status? }`
|
|
6
6
|
*/
|
|
7
7
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
8
8
|
ok: boolean;
|
|
@@ -8,12 +8,20 @@ export default defineEventHandler(async (event) => {
|
|
|
8
8
|
const body = await readBody(event);
|
|
9
9
|
const d1 = getD1Binding(event);
|
|
10
10
|
if (!d1) {
|
|
11
|
-
throw createError({
|
|
11
|
+
throw createError({
|
|
12
|
+
statusCode: 500,
|
|
13
|
+
statusMessage: "Internal Server Error",
|
|
14
|
+
message: "D1 unavailable"
|
|
15
|
+
});
|
|
12
16
|
}
|
|
13
17
|
const entryTable = resolveTableName("cms_entry").replace(/"/g, "");
|
|
14
18
|
if (body?.action === "delete") {
|
|
15
19
|
if (!body.id) {
|
|
16
|
-
throw createError({
|
|
20
|
+
throw createError({
|
|
21
|
+
statusCode: 400,
|
|
22
|
+
statusMessage: "Bad Request",
|
|
23
|
+
message: "id is required for delete"
|
|
24
|
+
});
|
|
17
25
|
}
|
|
18
26
|
await d1.prepare(`DELETE FROM "${entryTable}" WHERE id = ?1`).bind(body.id).run();
|
|
19
27
|
return { ok: true, deleted: body.id };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GET /__qarpeo/cloud/cms
|
|
3
3
|
*
|
|
4
|
-
* Returns a paginated list of CMS entries for the Qarpeo Cloud CMS Dashboard.
|
|
5
|
-
*
|
|
4
|
+
* Returns a paginated list of CMS entries for the Qarpeo Cloud CMS Dashboard. Requires
|
|
5
|
+
* `Authorization: Bearer <QARPEO_CLOUD_SECRET>`.
|
|
6
6
|
*/
|
|
7
7
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
8
8
|
ok: boolean;
|
|
@@ -75,6 +75,12 @@ export default defineEventHandler(async (event) => {
|
|
|
75
75
|
pages: Math.ceil(total / limit)
|
|
76
76
|
};
|
|
77
77
|
} catch (err) {
|
|
78
|
-
return {
|
|
78
|
+
return {
|
|
79
|
+
ok: false,
|
|
80
|
+
error: err?.message || "Query failed",
|
|
81
|
+
entries: [],
|
|
82
|
+
collections: [],
|
|
83
|
+
total: 0
|
|
84
|
+
};
|
|
79
85
|
}
|
|
80
86
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* POST /__qarpeo/cloud/comments/moderate
|
|
3
|
-
*
|
|
2
|
+
* POST /__qarpeo/cloud/comments/moderate Body: `{ commentId: string, action: "approve" | "spam" |
|
|
3
|
+
* "reject" | "delete" }`
|
|
4
4
|
*/
|
|
5
5
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
6
6
|
ok: boolean;
|
|
@@ -16,7 +16,11 @@ export default defineEventHandler(async (event) => {
|
|
|
16
16
|
}
|
|
17
17
|
const d1 = getD1Binding(event);
|
|
18
18
|
if (!d1) {
|
|
19
|
-
throw createError({
|
|
19
|
+
throw createError({
|
|
20
|
+
statusCode: 500,
|
|
21
|
+
statusMessage: "Internal Server Error",
|
|
22
|
+
message: "D1 unavailable"
|
|
23
|
+
});
|
|
20
24
|
}
|
|
21
25
|
const commentTable = resolveTableName("comment").replace(/"/g, "");
|
|
22
26
|
const now = Math.floor(Date.now() / 1e3);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GET /__qarpeo/cloud/extras
|
|
3
3
|
*
|
|
4
|
-
* Returns D1 schema health (missing expected tables per enabled feature),
|
|
5
|
-
*
|
|
4
|
+
* Returns D1 schema health (missing expected tables per enabled feature), active tenants (if
|
|
5
|
+
* multitenant), and mail/push stats.
|
|
6
6
|
*/
|
|
7
7
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
8
8
|
ok: boolean;
|
|
@@ -31,10 +31,16 @@ export default defineEventHandler(async (event) => {
|
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
33
|
if (features.cms) {
|
|
34
|
-
expectedByFeature.push({
|
|
34
|
+
expectedByFeature.push({
|
|
35
|
+
feature: "cms",
|
|
36
|
+
table: resolveTableName("cms_entry").replace(/"/g, "")
|
|
37
|
+
});
|
|
35
38
|
}
|
|
36
39
|
if (features.comments) {
|
|
37
|
-
expectedByFeature.push({
|
|
40
|
+
expectedByFeature.push({
|
|
41
|
+
feature: "comments",
|
|
42
|
+
table: resolveTableName("comment").replace(/"/g, "")
|
|
43
|
+
});
|
|
38
44
|
}
|
|
39
45
|
if (features.store) {
|
|
40
46
|
expectedByFeature.push(
|
|
@@ -43,14 +49,19 @@ export default defineEventHandler(async (event) => {
|
|
|
43
49
|
);
|
|
44
50
|
}
|
|
45
51
|
if (features.multitenant) {
|
|
46
|
-
expectedByFeature.push({
|
|
52
|
+
expectedByFeature.push({
|
|
53
|
+
feature: "multitenant",
|
|
54
|
+
table: resolveTableName("tenant").replace(/"/g, "")
|
|
55
|
+
});
|
|
47
56
|
}
|
|
48
57
|
const missingTables = d1 ? expectedByFeature.filter((item) => !existingTables.has(item.table)) : [];
|
|
49
58
|
let tenants = [];
|
|
50
59
|
if (features.multitenant && d1 && existingTables.has(resolveTableName("tenant").replace(/"/g, ""))) {
|
|
51
60
|
try {
|
|
52
61
|
const tenantTbl = resolveTableName("tenant").replace(/"/g, "");
|
|
53
|
-
tenants = await d1.prepare(
|
|
62
|
+
tenants = await d1.prepare(
|
|
63
|
+
`SELECT id, slug, name, plan FROM "${tenantTbl}" ORDER BY created_at DESC LIMIT 25`
|
|
64
|
+
).all().then((r) => r.results ?? []);
|
|
54
65
|
} catch {
|
|
55
66
|
tenants = [];
|
|
56
67
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* POST /__qarpeo/cloud/mail/unsuppress
|
|
3
3
|
*
|
|
4
|
-
* Removes an email address from the D1 `mail_suppression` table.
|
|
5
|
-
*
|
|
4
|
+
* Removes an email address from the D1 `mail_suppression` table. Requires `Authorization: Bearer
|
|
5
|
+
* <QARPEO_CLOUD_SECRET>`.
|
|
6
6
|
*/
|
|
7
7
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
8
8
|
ok: boolean;
|
|
@@ -43,9 +43,7 @@ export default defineEventHandler(async (event) => {
|
|
|
43
43
|
}
|
|
44
44
|
const slug = typeof item.slug === "string" && item.slug.trim() ? item.slug.trim() : title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 120);
|
|
45
45
|
try {
|
|
46
|
-
const existing = await d1.prepare(
|
|
47
|
-
`SELECT id FROM "${entryTable}" WHERE collection_id = ?1 AND slug = ?2 LIMIT 1`
|
|
48
|
-
).bind(collection, slug).first();
|
|
46
|
+
const existing = await d1.prepare(`SELECT id FROM "${entryTable}" WHERE collection_id = ?1 AND slug = ?2 LIMIT 1`).bind(collection, slug).first();
|
|
49
47
|
const now = Math.floor(Date.now() / 1e3);
|
|
50
48
|
const createdAt = item.createdAt || now;
|
|
51
49
|
const publishedAt = item.publishedAt || (item.status === "published" ? createdAt : null);
|
|
@@ -71,7 +69,18 @@ export default defineEventHandler(async (event) => {
|
|
|
71
69
|
`INSERT INTO "${entryTable}"
|
|
72
70
|
(id, collection_id, slug, title, description, content_md, content_html, metadata_json, status, source, created_at, updated_at, published_at)
|
|
73
71
|
VALUES (?1, ?2, ?3, ?4, ?5, ?6, '', ?7, ?8, 'db', ?9, ?9, ?10)`
|
|
74
|
-
).bind(
|
|
72
|
+
).bind(
|
|
73
|
+
id,
|
|
74
|
+
collection,
|
|
75
|
+
slug,
|
|
76
|
+
title,
|
|
77
|
+
description,
|
|
78
|
+
contentMd,
|
|
79
|
+
metaStr,
|
|
80
|
+
status,
|
|
81
|
+
createdAt,
|
|
82
|
+
publishedAt
|
|
83
|
+
).run();
|
|
75
84
|
imported++;
|
|
76
85
|
} catch (err) {
|
|
77
86
|
errors.push({ slug, reason: err?.message || "Insert failed" });
|
|
@@ -57,7 +57,7 @@ export default defineEventHandler(async (event) => {
|
|
|
57
57
|
const description = item.description || "";
|
|
58
58
|
const imagesJson = item.image ? JSON.stringify([item.image]) : "[]";
|
|
59
59
|
const metadataObj = {
|
|
60
|
-
...item.meta
|
|
60
|
+
...item.meta,
|
|
61
61
|
...item.externalId ? { externalId: item.externalId } : {}
|
|
62
62
|
};
|
|
63
63
|
const metadataJson = JSON.stringify(metadataObj);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* POST /__qarpeo/cloud/migrate
|
|
3
3
|
*
|
|
4
|
-
* Runs idempotent `CREATE TABLE IF NOT EXISTS` migrations for enabled Qarpeo
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Runs idempotent `CREATE TABLE IF NOT EXISTS` migrations for enabled Qarpeo features (or an
|
|
5
|
+
* explicit `features` list) against the bound D1 database. Requires `Authorization: Bearer
|
|
6
|
+
* <QARPEO_CLOUD_SECRET>`.
|
|
7
7
|
*/
|
|
8
8
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
9
9
|
ok: boolean;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createError, defineEventHandler, readBody, useRuntimeConfig } from "nuxt/server";
|
|
2
2
|
import { getD1Binding } from "../../../../index.mjs";
|
|
3
3
|
import { ensureAuditTables } from "../../../utils/audit.mjs";
|
|
4
|
-
import { ensureAuthTables } from "../../../utils/auth.mjs";
|
|
5
4
|
import { verifyCloudSecret } from "../../../utils/cloud-auth.mjs";
|
|
6
5
|
import { ensureCMSTables } from "../../../utils/cms/sync.mjs";
|
|
7
6
|
import { ensureCommentsTables } from "../../../utils/comments.mjs";
|
|
@@ -24,7 +23,9 @@ export default defineEventHandler(async (event) => {
|
|
|
24
23
|
message: "D1 database binding is not available on this Worker."
|
|
25
24
|
});
|
|
26
25
|
}
|
|
27
|
-
const body = await readBody(event).catch(
|
|
26
|
+
const body = await readBody(event).catch(
|
|
27
|
+
() => ({})
|
|
28
|
+
);
|
|
28
29
|
const config = useRuntimeConfig();
|
|
29
30
|
const manifestFeatures = config.qarpeo?.manifest?.features || {};
|
|
30
31
|
const targetFeatures = new Set(
|
|
@@ -33,7 +34,13 @@ export default defineEventHandler(async (event) => {
|
|
|
33
34
|
const applied = [];
|
|
34
35
|
const errors = [];
|
|
35
36
|
const runners = [
|
|
36
|
-
[
|
|
37
|
+
[
|
|
38
|
+
"auth",
|
|
39
|
+
async () => {
|
|
40
|
+
const { ensureAuthTables } = await import("../../../utils/auth.mjs");
|
|
41
|
+
return ensureAuthTables(d1, event);
|
|
42
|
+
}
|
|
43
|
+
],
|
|
37
44
|
["cms", () => ensureCMSTables(event)],
|
|
38
45
|
["comments", () => ensureCommentsTables(event)],
|
|
39
46
|
["store", () => ensureStoreTables(event)],
|
|
@@ -66,10 +73,16 @@ export default defineEventHandler(async (event) => {
|
|
|
66
73
|
);
|
|
67
74
|
}
|
|
68
75
|
if (manifestFeatures.cms) {
|
|
69
|
-
expectedByFeature.push({
|
|
76
|
+
expectedByFeature.push({
|
|
77
|
+
feature: "cms",
|
|
78
|
+
table: resolveTableName("cms_entry").replace(/"/g, "")
|
|
79
|
+
});
|
|
70
80
|
}
|
|
71
81
|
if (manifestFeatures.comments) {
|
|
72
|
-
expectedByFeature.push({
|
|
82
|
+
expectedByFeature.push({
|
|
83
|
+
feature: "comments",
|
|
84
|
+
table: resolveTableName("comment").replace(/"/g, "")
|
|
85
|
+
});
|
|
73
86
|
}
|
|
74
87
|
if (manifestFeatures.store) {
|
|
75
88
|
expectedByFeature.push(
|
|
@@ -78,7 +91,10 @@ export default defineEventHandler(async (event) => {
|
|
|
78
91
|
);
|
|
79
92
|
}
|
|
80
93
|
if (manifestFeatures.multitenant) {
|
|
81
|
-
expectedByFeature.push({
|
|
94
|
+
expectedByFeature.push({
|
|
95
|
+
feature: "multitenant",
|
|
96
|
+
table: resolveTableName("tenant").replace(/"/g, "")
|
|
97
|
+
});
|
|
82
98
|
}
|
|
83
99
|
const missingTables = expectedByFeature.filter((item) => !existingTables.has(item.table));
|
|
84
100
|
return {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* POST /__qarpeo/cloud/notifications/test
|
|
3
3
|
*
|
|
4
|
-
* Sends a test in-app and/or Web Push notification from Qarpeo Cloud.
|
|
5
|
-
*
|
|
4
|
+
* Sends a test in-app and/or Web Push notification from Qarpeo Cloud. Requires `Authorization:
|
|
5
|
+
* Bearer <QARPEO_CLOUD_SECRET>`.
|
|
6
6
|
*/
|
|
7
7
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
8
8
|
ok: boolean;
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
* GET /__qarpeo/cloud/operations
|
|
3
3
|
*
|
|
4
4
|
* Returns runtime operational state for Qarpeo Cloud:
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
*
|
|
6
|
+
* - Discovered & active AI Agents + Tools
|
|
7
|
+
* - Discovered MCP Servers
|
|
8
|
+
* - Nitro Scheduled Tasks & Cron schedules
|
|
9
|
+
* - Mail suppression stats + recent suppressed addresses
|
|
10
|
+
* - Web Push subscriptions & Notifications stats
|
|
10
11
|
*/
|
|
11
12
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
12
13
|
ok: boolean;
|
|
@@ -2,7 +2,15 @@ import { createError, defineEventHandler, readBody } from "nuxt/server";
|
|
|
2
2
|
import { getD1Binding } from "../../../../../index.mjs";
|
|
3
3
|
import { verifyCloudSecret } from "../../../../utils/cloud-auth.mjs";
|
|
4
4
|
import { resolveTableName } from "../../../../utils/table-names.mjs";
|
|
5
|
-
const ALLOWED_STATUSES = [
|
|
5
|
+
const ALLOWED_STATUSES = [
|
|
6
|
+
"pending",
|
|
7
|
+
"paid",
|
|
8
|
+
"processing",
|
|
9
|
+
"shipped",
|
|
10
|
+
"delivered",
|
|
11
|
+
"cancelled",
|
|
12
|
+
"refunded"
|
|
13
|
+
];
|
|
6
14
|
export default defineEventHandler(async (event) => {
|
|
7
15
|
verifyCloudSecret(event);
|
|
8
16
|
const body = await readBody(event);
|
|
@@ -17,7 +25,11 @@ export default defineEventHandler(async (event) => {
|
|
|
17
25
|
}
|
|
18
26
|
const d1 = getD1Binding(event);
|
|
19
27
|
if (!d1) {
|
|
20
|
-
throw createError({
|
|
28
|
+
throw createError({
|
|
29
|
+
statusCode: 500,
|
|
30
|
+
statusMessage: "Internal Server Error",
|
|
31
|
+
message: "D1 unavailable"
|
|
32
|
+
});
|
|
21
33
|
}
|
|
22
34
|
const orderTable = resolveTableName("store_order").replace(/"/g, "");
|
|
23
35
|
const now = Math.floor(Date.now() / 1e3);
|
|
@@ -51,6 +51,12 @@ export default defineEventHandler(async (event) => {
|
|
|
51
51
|
pages: Math.ceil(total / limit)
|
|
52
52
|
};
|
|
53
53
|
} catch (err) {
|
|
54
|
-
return {
|
|
54
|
+
return {
|
|
55
|
+
ok: false,
|
|
56
|
+
error: err?.message || "Query failed",
|
|
57
|
+
orders: [],
|
|
58
|
+
total: 0,
|
|
59
|
+
totalRevenue: 0
|
|
60
|
+
};
|
|
55
61
|
}
|
|
56
62
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* POST /__qarpeo/cloud/tasks/run
|
|
3
3
|
*
|
|
4
|
-
* Manually triggers a Nitro scheduled task by name from Qarpeo Cloud.
|
|
5
|
-
*
|
|
4
|
+
* Manually triggers a Nitro scheduled task by name from Qarpeo Cloud. Requires `Authorization:
|
|
5
|
+
* Bearer <QARPEO_CLOUD_SECRET>`.
|
|
6
6
|
*/
|
|
7
7
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
8
8
|
ok: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* POST /__qarpeo/cloud/users/action
|
|
3
|
-
*
|
|
2
|
+
* POST /__qarpeo/cloud/users/action Body: `{ userId: string, action: "set-role" | "ban" | "unban" |
|
|
3
|
+
* "revoke-sessions", role?: string }`
|
|
4
4
|
*/
|
|
5
5
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
6
6
|
ok: boolean;
|
|
@@ -16,7 +16,11 @@ export default defineEventHandler(async (event) => {
|
|
|
16
16
|
}
|
|
17
17
|
const d1 = getD1Binding(event);
|
|
18
18
|
if (!d1) {
|
|
19
|
-
throw createError({
|
|
19
|
+
throw createError({
|
|
20
|
+
statusCode: 500,
|
|
21
|
+
statusMessage: "Internal Server Error",
|
|
22
|
+
message: "D1 unavailable"
|
|
23
|
+
});
|
|
20
24
|
}
|
|
21
25
|
const userTable = resolveTableName("user").replace(/"/g, "");
|
|
22
26
|
const sessionTable = resolveTableName("session").replace(/"/g, "");
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GET /__qarpeo/cloud/users
|
|
3
3
|
*
|
|
4
|
-
* Returns a paginated list of auth users for the Qarpeo Cloud Auth Dashboard.
|
|
5
|
-
*
|
|
4
|
+
* Returns a paginated list of auth users for the Qarpeo Cloud Auth Dashboard. Requires
|
|
5
|
+
* `Authorization: Bearer <QARPEO_CLOUD_SECRET>`.
|
|
6
6
|
*
|
|
7
7
|
* Query params:
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
*
|
|
9
|
+
* - Page (default 1)
|
|
10
|
+
* - Limit (default 25, max 100)
|
|
11
|
+
* - Q (optional email/name search substring)
|
|
11
12
|
*/
|
|
12
13
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
13
14
|
ok: boolean;
|
|
@@ -21,9 +21,7 @@ export default defineEventHandler(async (event) => {
|
|
|
21
21
|
let rows;
|
|
22
22
|
if (q) {
|
|
23
23
|
const pattern = `%${q}%`;
|
|
24
|
-
countRow = await d1.prepare(
|
|
25
|
-
`SELECT COUNT(*) as total FROM "${userTable}" WHERE email LIKE ?1 OR name LIKE ?1`
|
|
26
|
-
).bind(pattern).first();
|
|
24
|
+
countRow = await d1.prepare(`SELECT COUNT(*) as total FROM "${userTable}" WHERE email LIKE ?1 OR name LIKE ?1`).bind(pattern).first();
|
|
27
25
|
rows = await d1.prepare(
|
|
28
26
|
`SELECT u.id, u.name, u.email, u.email_verified, u.role, u.created_at, u.updated_at,
|
|
29
27
|
(SELECT COUNT(*) FROM "${sessionTable}" s WHERE s.user_id = u.id) as session_count,
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
getRequestHeader,
|
|
6
6
|
sendRedirect
|
|
7
7
|
} from "nuxt/server";
|
|
8
|
-
import { sanitizeUrl } from "../../../../../utils/string.mjs";
|
|
9
|
-
import { getDevEmail, recordEmailClick } from "../../../../../utils/mail.mjs";
|
|
10
8
|
import { verifyHmacSha256 } from "../../../../../utils/crypto.mjs";
|
|
9
|
+
import { getDevEmail, recordEmailClick } from "../../../../../utils/mail.mjs";
|
|
10
|
+
import { sanitizeUrl } from "../../../../../utils/string.mjs";
|
|
11
11
|
export default defineEventHandler(async (event) => {
|
|
12
12
|
const id = getRouterParam(event, "id");
|
|
13
13
|
const query = getQuery(event);
|
|
@@ -31,8 +31,8 @@ export interface QarpeoCloudManifest {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
* Builds a safe, secret-free structural manifest of Qarpeo features, expected Cloudflare
|
|
35
|
-
*
|
|
34
|
+
* Builds a safe, secret-free structural manifest of Qarpeo features, expected Cloudflare bindings,
|
|
35
|
+
* expected secret keys, and well-known endpoints for Qarpeo Cloud inspection.
|
|
36
36
|
*/
|
|
37
37
|
export declare function buildQarpeoManifest(options: QarpeoOptions, qarpeoVersion?: string): QarpeoCloudManifest;
|
|
38
38
|
declare const _default: import("nuxt/server").EventHandler<Response>;
|
|
@@ -7,8 +7,8 @@ export interface BuildOgSvgOptions {
|
|
|
7
7
|
author?: string;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
* Generates a zero-dependency 1200x630 SVG OpenGraph social card.
|
|
11
|
-
*
|
|
10
|
+
* Generates a zero-dependency 1200x630 SVG OpenGraph social card. Used as the edge fallback when
|
|
11
|
+
* Cloudflare Browser Rendering (`browser: true`) is not bound.
|
|
12
12
|
*/
|
|
13
13
|
export declare function buildOgSvg(opts: BuildOgSvgOptions): string;
|
|
14
14
|
declare const _default: import("nuxt/server").EventHandler<Promise<Response>>;
|