qarpeo 0.4.13 → 0.4.15
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 +197 -191
- 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 +5451 -5249
- 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 +52 -36
- package/dist/runtime/app/composables/store.mjs +70 -11
- 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/products/index.get.mjs +2 -0
- 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/vendor.d.ts +11 -1
- package/dist/runtime/server/utils/store/vendor.mjs +47 -0
- 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/store.d.ts +7 -0
- 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 +31 -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/overridable-routes.d.ts +12 -0
- 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,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>>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GET /__qarpeo/rbac/me
|
|
3
3
|
*
|
|
4
|
-
* Returns the current authenticated user's resolved roles, effective role
|
|
5
|
-
*
|
|
4
|
+
* Returns the current authenticated user's resolved roles, effective role permissions, and per-user
|
|
5
|
+
* `allow` / `deny` overrides for client UI checks (`useCan`).
|
|
6
6
|
*/
|
|
7
7
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
8
8
|
authenticated: boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* DELETE /__qarpeo/rbac/roles?id=<roleId>
|
|
3
3
|
*
|
|
4
|
-
* Deletes a custom role or resets an overridden built-in role back to code defaults.
|
|
5
|
-
*
|
|
4
|
+
* Deletes a custom role or resets an overridden built-in role back to code defaults. Requires
|
|
5
|
+
* `roles:manage` (or `super`).
|
|
6
6
|
*/
|
|
7
7
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
8
8
|
reset: boolean;
|
|
@@ -5,7 +5,11 @@ export default defineEventHandler(async (event) => {
|
|
|
5
5
|
const body = await readBody(event).catch(() => ({}));
|
|
6
6
|
const roleId = typeof qs?.id === "string" && qs.id.trim() || typeof body?.id === "string" && body.id.trim() || "";
|
|
7
7
|
if (!roleId) {
|
|
8
|
-
throw createError({
|
|
8
|
+
throw createError({
|
|
9
|
+
statusCode: 400,
|
|
10
|
+
statusMessage: "Bad Request",
|
|
11
|
+
message: "role id is required."
|
|
12
|
+
});
|
|
9
13
|
}
|
|
10
14
|
const result = await deleteRole(event, roleId);
|
|
11
15
|
return { ok: true, id: roleId, ...result };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GET /__qarpeo/rbac/roles
|
|
3
3
|
*
|
|
4
|
-
* Lists all built-in + D1-overridden + custom roles and the standard permission catalog.
|
|
5
|
-
*
|
|
4
|
+
* Lists all built-in + D1-overridden + custom roles and the standard permission catalog. Requires
|
|
5
|
+
* `roles:manage` (or `super`).
|
|
6
6
|
*/
|
|
7
7
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
8
8
|
ok: boolean;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { defineEventHandler } from "nuxt/server";
|
|
2
|
-
import {
|
|
3
|
-
listRoles,
|
|
4
|
-
PERMISSION_CATALOG,
|
|
5
|
-
requirePermission
|
|
6
|
-
} from "../../../utils/rbac.mjs";
|
|
2
|
+
import { listRoles, PERMISSION_CATALOG, requirePermission } from "../../../utils/rbac.mjs";
|
|
7
3
|
export default defineEventHandler(async (event) => {
|
|
8
4
|
await requirePermission(event, "roles:manage");
|
|
9
5
|
const roles = await listRoles(event);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* POST /__qarpeo/rbac/roles
|
|
3
3
|
*
|
|
4
|
-
* Creates or updates a role's permissions in D1.
|
|
5
|
-
*
|
|
4
|
+
* Creates or updates a role's permissions in D1. Requires `roles:manage` (or `super`). `super`
|
|
5
|
+
* itself is immutable.
|
|
6
6
|
*/
|
|
7
7
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
8
8
|
ok: boolean;
|
|
@@ -4,7 +4,11 @@ export default defineEventHandler(async (event) => {
|
|
|
4
4
|
const body = await readBody(event).catch(() => ({}));
|
|
5
5
|
const id = typeof body?.id === "string" ? body.id.trim() : "";
|
|
6
6
|
if (!id) {
|
|
7
|
-
throw createError({
|
|
7
|
+
throw createError({
|
|
8
|
+
statusCode: 400,
|
|
9
|
+
statusMessage: "Bad Request",
|
|
10
|
+
message: "role id is required."
|
|
11
|
+
});
|
|
8
12
|
}
|
|
9
13
|
const role = await upsertRole(event, {
|
|
10
14
|
id,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* POST /__qarpeo/rbac/users
|
|
3
3
|
*
|
|
4
|
-
* Updates per-user `extraRoles`, `allow`, and `deny` permission overrides in D1.
|
|
5
|
-
*
|
|
4
|
+
* Updates per-user `extraRoles`, `allow`, and `deny` permission overrides in D1. Requires
|
|
5
|
+
* `roles:manage` (or `super`).
|
|
6
6
|
*/
|
|
7
7
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
8
8
|
userId: string;
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineEventHandler,
|
|
3
|
-
getRouterParam,
|
|
4
|
-
readBody,
|
|
5
|
-
createError
|
|
6
|
-
} from "nuxt/server";
|
|
1
|
+
import { defineEventHandler, getRouterParam, readBody, createError } from "nuxt/server";
|
|
7
2
|
import { useAgent, resolveAgentInstanceId } from "../../../utils/ai.mjs";
|
|
8
3
|
import { getQarpeoConfig } from "../../../utils/config.mjs";
|
|
9
4
|
import { getAuthSession } from "../../../utils/session.mjs";
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineEventHandler,
|
|
3
|
-
getRouterParam,
|
|
4
|
-
readBody,
|
|
5
|
-
createError
|
|
6
|
-
} from "nuxt/server";
|
|
1
|
+
import { defineEventHandler, getRouterParam, readBody, createError } from "nuxt/server";
|
|
7
2
|
import { useAgent, resolveAgentInstanceId } from "../../../utils/ai.mjs";
|
|
8
3
|
import { getQarpeoConfig } from "../../../utils/config.mjs";
|
|
9
4
|
import { getAuthSession } from "../../../utils/session.mjs";
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineEventHandler,
|
|
3
|
-
getRouterParam,
|
|
4
|
-
getQuery,
|
|
5
|
-
createError
|
|
6
|
-
} from "nuxt/server";
|
|
1
|
+
import { defineEventHandler, getRouterParam, getQuery, createError } from "nuxt/server";
|
|
7
2
|
import { useAgent, resolveAgentInstanceId } from "../../../utils/ai.mjs";
|
|
8
3
|
import { getQarpeoConfig } from "../../../utils/config.mjs";
|
|
9
4
|
import { getAuthSession } from "../../../utils/session.mjs";
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { defineEventHandler, readBody, createError } from "nuxt/server";
|
|
2
2
|
import { getD1Binding } from "../../../../db.mjs";
|
|
3
3
|
import { decryptToken } from "../../../utils/crypto.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
requireAuthSession,
|
|
6
|
+
revokeOtherDeviceSessions,
|
|
7
|
+
setAuthSession
|
|
8
|
+
} from "../../../utils/session.mjs";
|
|
5
9
|
import { resolveTableName } from "../../../utils/table-names.mjs";
|
|
6
10
|
import { verifyTOTPCode } from "../../../utils/totp.mjs";
|
|
7
11
|
export default defineEventHandler(async (event) => {
|
|
@@ -87,7 +87,13 @@ export default defineEventHandler(async (event) => {
|
|
|
87
87
|
INSERT INTO ${twoFactorTbl} (id, user_id, secret, backup_codes, enabled, created_at)
|
|
88
88
|
VALUES (?, ?, ?, ?, 1, ?)
|
|
89
89
|
ON CONFLICT(user_id) DO UPDATE SET secret = excluded.secret, backup_codes = excluded.backup_codes, enabled = 1
|
|
90
|
-
`).bind(
|
|
90
|
+
`).bind(
|
|
91
|
+
id,
|
|
92
|
+
user.id,
|
|
93
|
+
await encryptToken(secret, event),
|
|
94
|
+
JSON.stringify(hashedBackupCodes),
|
|
95
|
+
now
|
|
96
|
+
).run();
|
|
91
97
|
try {
|
|
92
98
|
const kv = getKVBinding("KV", event);
|
|
93
99
|
await kv.delete(`2fa:setup:${user.id}`);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineEventHandler, readBody, createError } from "nuxt/server";
|
|
2
2
|
import { getQarpeoConfig } from "../../../utils/config.mjs";
|
|
3
3
|
import { sendMagicLink } from "../../../utils/passwordless.mjs";
|
|
4
|
-
import { requireTurnstile } from "../../../utils/turnstile.mjs";
|
|
5
4
|
import { assertRateLimit, getClientIp } from "../../../utils/ratelimit.mjs";
|
|
5
|
+
import { requireTurnstile } from "../../../utils/turnstile.mjs";
|
|
6
6
|
export default defineEventHandler(async (event) => {
|
|
7
7
|
const body = await readBody(event);
|
|
8
8
|
const email = body?.email;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineEventHandler, readBody, createError } from "nuxt/server";
|
|
2
2
|
import { getQarpeoConfig } from "../../../utils/config.mjs";
|
|
3
3
|
import { sendOTPCode } from "../../../utils/passwordless.mjs";
|
|
4
|
-
import { requireTurnstile } from "../../../utils/turnstile.mjs";
|
|
5
4
|
import { assertRateLimit, getClientIp } from "../../../utils/ratelimit.mjs";
|
|
5
|
+
import { requireTurnstile } from "../../../utils/turnstile.mjs";
|
|
6
6
|
export default defineEventHandler(async (event) => {
|
|
7
7
|
const body = await readBody(event);
|
|
8
8
|
const email = body?.email;
|
|
@@ -64,18 +64,14 @@ export default defineEventHandler(async (event) => {
|
|
|
64
64
|
try {
|
|
65
65
|
const ftsQuery = buildFtsQuery(q, "AND");
|
|
66
66
|
if (ftsQuery) {
|
|
67
|
-
const ftsRes = await db.prepare(
|
|
68
|
-
`SELECT id FROM ${ftsTbl} WHERE ${ftsTbl} MATCH ? ORDER BY rank LIMIT 100`
|
|
69
|
-
).bind(ftsQuery).all();
|
|
67
|
+
const ftsRes = await db.prepare(`SELECT id FROM ${ftsTbl} WHERE ${ftsTbl} MATCH ? ORDER BY rank LIMIT 100`).bind(ftsQuery).all();
|
|
70
68
|
const ids = (ftsRes.results || []).map((r) => r.id).filter(Boolean);
|
|
71
69
|
if (ids.length > 0) {
|
|
72
70
|
ftsMatchedIds = ids;
|
|
73
71
|
} else {
|
|
74
72
|
const ftsOrQuery = buildFtsQuery(q, "OR");
|
|
75
73
|
if (ftsOrQuery && ftsOrQuery !== ftsQuery) {
|
|
76
|
-
const orRes = await db.prepare(
|
|
77
|
-
`SELECT id FROM ${ftsTbl} WHERE ${ftsTbl} MATCH ? ORDER BY rank LIMIT 100`
|
|
78
|
-
).bind(ftsOrQuery).all();
|
|
74
|
+
const orRes = await db.prepare(`SELECT id FROM ${ftsTbl} WHERE ${ftsTbl} MATCH ? ORDER BY rank LIMIT 100`).bind(ftsOrQuery).all();
|
|
79
75
|
const orIds = (orRes.results || []).map((r) => r.id).filter(Boolean);
|
|
80
76
|
if (orIds.length > 0) {
|
|
81
77
|
ftsMatchedIds = orIds;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { createError, defineEventHandler, getRouterParam, readBody } from "nuxt/server";
|
|
2
|
-
import {
|
|
3
|
-
getComment,
|
|
4
|
-
reportComment
|
|
5
|
-
} from "../../../utils/comments.mjs";
|
|
2
|
+
import { getComment, reportComment } from "../../../utils/comments.mjs";
|
|
6
3
|
import { getAuthContext } from "../../../utils/context.mjs";
|
|
7
4
|
import { assertRateLimit } from "../../../utils/ratelimit.mjs";
|
|
8
5
|
const ALLOWED_REASONS = [
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { createError, defineEventHandler, getRouterParam, readBody } from "nuxt/server";
|
|
2
|
-
import {
|
|
3
|
-
getComment,
|
|
4
|
-
updateCommentStatus
|
|
5
|
-
} from "../../utils/comments.mjs";
|
|
2
|
+
import { getComment, updateCommentStatus } from "../../utils/comments.mjs";
|
|
6
3
|
import { getAuthContext } from "../../utils/context.mjs";
|
|
7
4
|
import { getTenant } from "../../utils/tenant.mjs";
|
|
8
5
|
export default defineEventHandler(async (event) => {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { createError, defineEventHandler, readBody } from "nuxt/server";
|
|
2
|
-
import {
|
|
3
|
-
batchModerateComments
|
|
4
|
-
} from "../../utils/comments.mjs";
|
|
2
|
+
import { batchModerateComments } from "../../utils/comments.mjs";
|
|
5
3
|
import { getAuthContext } from "../../utils/context.mjs";
|
|
6
4
|
const ALLOWED_ACTIONS = ["approve", "spam", "delete"];
|
|
7
5
|
export default defineEventHandler(async (event) => {
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { createError, defineEventHandler, readBody } from "nuxt/server";
|
|
2
|
-
import {
|
|
3
|
-
createComment,
|
|
4
|
-
validateTargetUrn,
|
|
5
|
-
getCommentsConfig
|
|
6
|
-
} from "../../utils/comments.mjs";
|
|
2
|
+
import { createComment, validateTargetUrn, getCommentsConfig } from "../../utils/comments.mjs";
|
|
7
3
|
import { getAuthContext } from "../../utils/context.mjs";
|
|
8
4
|
import { getTenant } from "../../utils/tenant.mjs";
|
|
9
5
|
export default defineEventHandler(async (event) => {
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
createError,
|
|
6
6
|
useRuntimeConfig
|
|
7
7
|
} from "nuxt/server";
|
|
8
|
-
import { getAuthSession } from "../utils/session.mjs";
|
|
9
8
|
import { fateViews } from "#qarpeo/fate/views";
|
|
9
|
+
import { getAuthSession } from "../utils/session.mjs";
|
|
10
10
|
let _fateHandler;
|
|
11
11
|
async function getFateHandler() {
|
|
12
12
|
if (_fateHandler) return _fateHandler;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createError, defineEventHandler, getQuery, getRequestHeader, readBody } from "nuxt/server";
|
|
2
2
|
import { getQarpeoConfig } from "../../utils/config.mjs";
|
|
3
3
|
import { timingSafeEqualString } from "../../utils/crypto.mjs";
|
|
4
|
-
import { sanitizeUrl } from "../../utils/string.mjs";
|
|
5
4
|
import {
|
|
6
5
|
recordEmailBounce,
|
|
7
6
|
recordEmailClick,
|
|
@@ -9,6 +8,7 @@ import {
|
|
|
9
8
|
recordSoftBounce,
|
|
10
9
|
suppressEmail
|
|
11
10
|
} from "../../utils/mail.mjs";
|
|
11
|
+
import { sanitizeUrl } from "../../utils/string.mjs";
|
|
12
12
|
export default defineEventHandler(async (event) => {
|
|
13
13
|
const mailConfig = getQarpeoConfig(event).mail || {};
|
|
14
14
|
const webhookSecret = mailConfig.webhookSecret || globalThis.process?.env?.QARPEO_MAIL_WEBHOOK_SECRET;
|
|
@@ -105,7 +105,8 @@ export default defineEventHandler(async (event) => {
|
|
|
105
105
|
`;
|
|
106
106
|
if (img.title) entry += ` <image:title>${escapeXml(img.title)}</image:title>
|
|
107
107
|
`;
|
|
108
|
-
if (img.caption)
|
|
108
|
+
if (img.caption)
|
|
109
|
+
entry += ` <image:caption>${escapeXml(img.caption)}</image:caption>
|
|
109
110
|
`;
|
|
110
111
|
entry += ` </image:image>
|
|
111
112
|
`;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* POST /api/storage/presigned-r2
|
|
3
3
|
*
|
|
4
|
-
* Generates a **true R2 presigned URL** so the client can PUT a file directly to
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* native R2 presigned URL instead.
|
|
4
|
+
* Generates a **true R2 presigned URL** so the client can PUT a file directly to Cloudflare R2
|
|
5
|
+
* without routing the bytes through the Worker. The endpoint mirrors the security model of
|
|
6
|
+
* `presigned.post.ts` (HMAC-ticket) but returns a native R2 presigned URL instead.
|
|
8
7
|
*
|
|
9
|
-
* Body: { pathname: string, contentType?: string, expiresIn?: string | number }
|
|
10
|
-
*
|
|
8
|
+
* Body: { pathname: string, contentType?: string, expiresIn?: string | number } Response: { url:
|
|
9
|
+
* string, key: string, expiresAt: number }
|
|
11
10
|
*/
|
|
12
11
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
13
12
|
url: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineEventHandler, readBody, createError } from "nuxt/server";
|
|
2
|
+
import { createBlob } from "../../../blob.mjs";
|
|
2
3
|
import { getAuthContext } from "../../utils/context.mjs";
|
|
3
4
|
import { getStorageConfig } from "../../utils/storage.mjs";
|
|
4
|
-
import { createBlob } from "../../../blob.mjs";
|
|
5
5
|
export default defineEventHandler(async (event) => {
|
|
6
6
|
const config = getStorageConfig(event);
|
|
7
7
|
const body = await readBody(event) || {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineEventHandler, getRouterParam, createError } from "nuxt/server";
|
|
2
|
+
import { getCloudflareEnv } from "../../../../../bindings.mjs";
|
|
2
3
|
import {
|
|
3
4
|
resolveStoreCart,
|
|
4
5
|
removeStoreCartItem,
|
|
@@ -6,7 +7,6 @@ import {
|
|
|
6
7
|
getStoreCart,
|
|
7
8
|
storeCartItemTbl
|
|
8
9
|
} from "../../../../utils/store/index.mjs";
|
|
9
|
-
import { getCloudflareEnv } from "../../../../../bindings.mjs";
|
|
10
10
|
export default defineEventHandler(async (event) => {
|
|
11
11
|
const itemId = getRouterParam(event, "id");
|
|
12
12
|
if (!itemId) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineEventHandler, readBody, getRouterParam, createError } from "nuxt/server";
|
|
2
|
+
import { getCloudflareEnv } from "../../../../../bindings.mjs";
|
|
2
3
|
import {
|
|
3
4
|
resolveStoreCart,
|
|
4
5
|
updateStoreCartItem,
|
|
@@ -6,7 +7,6 @@ import {
|
|
|
6
7
|
getStoreCart,
|
|
7
8
|
storeCartItemTbl
|
|
8
9
|
} from "../../../../utils/store/index.mjs";
|
|
9
|
-
import { getCloudflareEnv } from "../../../../../bindings.mjs";
|
|
10
10
|
export default defineEventHandler(async (event) => {
|
|
11
11
|
const itemId = getRouterParam(event, "id");
|
|
12
12
|
if (!itemId) {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { defineEventHandler } from "nuxt/server";
|
|
2
|
-
import {
|
|
3
|
-
SUPPORTED_STORE_CURRENCIES,
|
|
4
|
-
DEFAULT_STORE_RATES
|
|
5
|
-
} from "../../utils/store-localization.mjs";
|
|
2
|
+
import { SUPPORTED_STORE_CURRENCIES, DEFAULT_STORE_RATES } from "../../utils/store-localization.mjs";
|
|
6
3
|
export default defineEventHandler((_event) => {
|
|
7
4
|
return {
|
|
8
5
|
currencies: Object.values(SUPPORTED_STORE_CURRENCIES).map((c) => ({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineEventHandler, getRouterParam, createError } from "nuxt/server";
|
|
2
|
-
import { getStoreOrder } from "../../../utils/store/index.mjs";
|
|
3
2
|
import { getAuthContext } from "../../../utils/context.mjs";
|
|
3
|
+
import { getStoreOrder } from "../../../utils/store/index.mjs";
|
|
4
4
|
import { getTenant } from "../../../utils/tenant.mjs";
|
|
5
5
|
export default defineEventHandler(async (event) => {
|
|
6
6
|
const id = getRouterParam(event, "id");
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
defineEventHandler,
|
|
3
|
+
getRouterParam,
|
|
4
|
+
getQuery,
|
|
5
|
+
createError,
|
|
6
|
+
sendRedirect
|
|
7
|
+
} from "nuxt/server";
|
|
4
8
|
import { getCloudflareEnv } from "../../../../../bindings.mjs";
|
|
9
|
+
import { verifyHmacSha256 } from "../../../../utils/crypto.mjs";
|
|
10
|
+
import { storeOrderItemTbl, storeOrderTbl } from "../../../../utils/store/index.mjs";
|
|
5
11
|
export default defineEventHandler(async (event) => {
|
|
6
12
|
const token = getRouterParam(event, "token");
|
|
7
13
|
if (!token) {
|
|
@@ -11,7 +17,10 @@ export default defineEventHandler(async (event) => {
|
|
|
11
17
|
const expires = Number(query.expires);
|
|
12
18
|
const sig = typeof query.sig === "string" ? query.sig : "";
|
|
13
19
|
if (!expires || Number.isNaN(expires) || !sig) {
|
|
14
|
-
throw createError({
|
|
20
|
+
throw createError({
|
|
21
|
+
statusCode: 400,
|
|
22
|
+
statusMessage: "Signed expiration and signature are required."
|
|
23
|
+
});
|
|
15
24
|
}
|
|
16
25
|
if (Date.now() > expires) {
|
|
17
26
|
throw createError({ statusCode: 410, statusMessage: "Download link has expired." });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineEventHandler, getQuery, createError } from "nuxt/server";
|
|
2
|
-
import { queryStoreOrders } from "../../../utils/store/index.mjs";
|
|
3
2
|
import { getAuthContext } from "../../../utils/context.mjs";
|
|
3
|
+
import { queryStoreOrders } from "../../../utils/store/index.mjs";
|
|
4
4
|
import { getTenant } from "../../../utils/tenant.mjs";
|
|
5
5
|
export default defineEventHandler(async (event) => {
|
|
6
6
|
const auth = await getAuthContext(event).catch(() => null);
|
|
@@ -8,6 +8,7 @@ export default defineEventHandler(async (event) => {
|
|
|
8
8
|
const search = query.search ? String(query.search).trim() : void 0;
|
|
9
9
|
const categoryId = query.category ? String(query.category) : void 0;
|
|
10
10
|
const type = query.type ? String(query.type) : void 0;
|
|
11
|
+
const vendorId = query.vendorId ? String(query.vendorId) : void 0;
|
|
11
12
|
const sortBy = query.sortBy ? String(query.sortBy) : void 0;
|
|
12
13
|
const activeTenant = getTenant(event);
|
|
13
14
|
const tenantId = activeTenant ? activeTenant.id : query.tenantId ? String(query.tenantId) : void 0;
|
|
@@ -19,6 +20,7 @@ export default defineEventHandler(async (event) => {
|
|
|
19
20
|
search,
|
|
20
21
|
categoryId,
|
|
21
22
|
type,
|
|
23
|
+
vendorId,
|
|
22
24
|
sortBy,
|
|
23
25
|
minPrice,
|
|
24
26
|
maxPrice,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* POST /api/store/tax/calculate
|
|
3
3
|
*
|
|
4
|
-
* Body: { subtotal: number, country: string, state?: string, vatNumber?: string, isDigital?:
|
|
4
|
+
* Body: { subtotal: number, country: string, state?: string, vatNumber?: string, isDigital?:
|
|
5
|
+
* boolean, shippingTotal?: number }
|
|
5
6
|
*
|
|
6
7
|
* Returns StoreTaxResult with breakdown.
|
|
7
8
|
*/
|
|
@@ -3,13 +3,22 @@ import { calculateStoreTax } from "../../../utils/store-localization.mjs";
|
|
|
3
3
|
export default defineEventHandler(async (event) => {
|
|
4
4
|
const body = await readBody(event).catch(() => null);
|
|
5
5
|
if (typeof body?.subtotal !== "number" || typeof body?.country !== "string") {
|
|
6
|
-
throw createError({
|
|
6
|
+
throw createError({
|
|
7
|
+
statusCode: 400,
|
|
8
|
+
statusMessage: "subtotal (number) and country (string) are required"
|
|
9
|
+
});
|
|
7
10
|
}
|
|
8
11
|
if (body.subtotal < 0 || !Number.isFinite(body.subtotal)) {
|
|
9
|
-
throw createError({
|
|
12
|
+
throw createError({
|
|
13
|
+
statusCode: 400,
|
|
14
|
+
statusMessage: "subtotal must be a positive finite number"
|
|
15
|
+
});
|
|
10
16
|
}
|
|
11
17
|
if (body.shippingTotal !== void 0 && (body.shippingTotal < 0 || !Number.isFinite(body.shippingTotal))) {
|
|
12
|
-
throw createError({
|
|
18
|
+
throw createError({
|
|
19
|
+
statusCode: 400,
|
|
20
|
+
statusMessage: "shippingTotal must be a positive finite number"
|
|
21
|
+
});
|
|
13
22
|
}
|
|
14
23
|
const cleanCountry = body.country.trim().toUpperCase();
|
|
15
24
|
if (!cleanCountry || !/^[A-Z]{2,3}$/.test(cleanCountry)) {
|
|
@@ -23,7 +23,10 @@ export default defineEventHandler(async (event) => {
|
|
|
23
23
|
}
|
|
24
24
|
const tenant = await getTenantById(domainRecord.tenantId, event) || await getTenantBySlug(domainRecord.tenantId, event);
|
|
25
25
|
if (!tenant || tenant.id !== tenantParam && tenant.slug !== tenantParam) {
|
|
26
|
-
throw createError({
|
|
26
|
+
throw createError({
|
|
27
|
+
statusCode: 403,
|
|
28
|
+
message: "Tenant mismatch: domain does not belong to this tenant."
|
|
29
|
+
});
|
|
27
30
|
}
|
|
28
31
|
if (tenant.organizationId) {
|
|
29
32
|
try {
|
|
@@ -23,7 +23,10 @@ export default defineEventHandler(async (event) => {
|
|
|
23
23
|
}
|
|
24
24
|
const tenant = await getTenantById(domainRecord.tenantId, event) || await getTenantBySlug(domainRecord.tenantId, event);
|
|
25
25
|
if (!tenant || tenant.id !== tenantParam && tenant.slug !== tenantParam) {
|
|
26
|
-
throw createError({
|
|
26
|
+
throw createError({
|
|
27
|
+
statusCode: 403,
|
|
28
|
+
message: "Tenant mismatch: domain does not belong to this tenant."
|
|
29
|
+
});
|
|
27
30
|
}
|
|
28
31
|
if (tenant.organizationId) {
|
|
29
32
|
try {
|