qarpeo 0.1.18 → 0.1.21
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 +96 -96
- package/dist/chunks/auth-schema.mjs +3 -1
- package/dist/chunks/wrangler.mjs +22 -3
- package/dist/cli/index.mjs +448 -221
- package/dist/fate/index.d.ts +29 -22
- package/dist/fate/index.mjs +1 -3
- package/dist/module.d.ts +1 -1
- package/dist/module.mjs +103 -82
- package/dist/runtime/ai.d.ts +2 -2
- package/dist/runtime/app/components/BlobImage.vue +119 -107
- package/dist/runtime/app/components/CMSBlocks.vue +104 -93
- package/dist/runtime/app/components/CMSContent.vue +24 -23
- package/dist/runtime/app/components/CMSImage.vue +49 -49
- package/dist/runtime/app/components/CMSLocaleSwitcher.vue +110 -110
- package/dist/runtime/app/components/CMSPreviewBanner.vue +83 -79
- package/dist/runtime/app/components/CMSVersionBanner.vue +53 -49
- package/dist/runtime/app/components/CMSVersionSwitcher.vue +140 -140
- package/dist/runtime/app/components/ContentRenderer.vue +83 -80
- package/dist/runtime/app/components/FileUpload.vue +200 -196
- package/dist/runtime/app/components/ImpersonationBanner.vue +61 -57
- package/dist/runtime/app/components/QarpeoWelcome.vue +84 -84
- package/dist/runtime/app/components/SignedIn.vue +13 -13
- package/dist/runtime/app/components/SignedOut.vue +13 -13
- package/dist/runtime/app/components/shiki.css +34 -34
- package/dist/runtime/app/composables/ai.d.ts +22 -22
- package/dist/runtime/app/composables/ai.mjs +3 -7
- package/dist/runtime/app/composables/analytics.mjs +1 -1
- package/dist/runtime/app/composables/api-tokens.mjs +1 -1
- package/dist/runtime/app/composables/auth.d.ts +6 -7
- package/dist/runtime/app/composables/auth.mjs +6 -3
- package/dist/runtime/app/composables/chat.mjs +3 -7
- package/dist/runtime/app/composables/cms-preview.d.ts +3 -3
- package/dist/runtime/app/composables/cms-preview.mjs +1 -1
- package/dist/runtime/app/composables/cms.d.ts +3 -5
- package/dist/runtime/app/composables/cms.mjs +2 -2
- package/dist/runtime/app/composables/docs-version.d.ts +8 -7
- package/dist/runtime/app/composables/docs-version.mjs +3 -3
- package/dist/runtime/app/composables/impersonation.mjs +1 -1
- package/dist/runtime/app/composables/notifications.d.ts +5 -5
- package/dist/runtime/app/composables/notifications.mjs +4 -5
- package/dist/runtime/app/composables/organization.mjs +1 -1
- package/dist/runtime/app/composables/passkey.mjs +1 -1
- package/dist/runtime/app/composables/passwordless.mjs +1 -1
- package/dist/runtime/app/composables/payments.d.ts +2 -1
- package/dist/runtime/app/composables/payments.mjs +1 -1
- package/dist/runtime/app/composables/realtime.d.ts +13 -13
- package/dist/runtime/app/composables/realtime.mjs +2 -2
- package/dist/runtime/app/composables/resumable-upload.d.ts +11 -11
- package/dist/runtime/app/composables/resumable-upload.mjs +1 -1
- package/dist/runtime/app/composables/site.mjs +1 -1
- package/dist/runtime/app/composables/storage.d.ts +151 -11
- package/dist/runtime/app/composables/storage.mjs +291 -33
- package/dist/runtime/app/composables/turnstile.mjs +1 -1
- package/dist/runtime/app/composables/two-factor.mjs +1 -1
- package/dist/runtime/app/pages/devtools/agents.vue +716 -716
- package/dist/runtime/app/pages/devtools/analytics.vue +616 -616
- package/dist/runtime/app/pages/devtools/auth.vue +381 -350
- package/dist/runtime/app/pages/devtools/blob.vue +743 -744
- package/dist/runtime/app/pages/devtools/db.vue +545 -545
- package/dist/runtime/app/pages/devtools/domains.vue +771 -771
- package/dist/runtime/app/pages/devtools/kv.vue +827 -828
- package/dist/runtime/app/pages/devtools/logs.vue +649 -653
- package/dist/runtime/app/pages/devtools/mail.vue +388 -388
- package/dist/runtime/app/pages/devtools/overview.vue +391 -389
- package/dist/runtime/app/pages/devtools/realtime.vue +89 -27
- package/dist/runtime/app/pages/devtools/security.vue +20 -5
- package/dist/runtime/app/pages/devtools/settings.vue +559 -559
- package/dist/runtime/app/pages/devtools/tasks.vue +26 -10
- package/dist/runtime/app/pages/devtools.vue +176 -176
- package/dist/runtime/app/plugins/seo.mjs +1 -1
- package/dist/runtime/app/plugins/shortcuts.client.d.ts +1 -4
- package/dist/runtime/app/public/sw-notifications.mjs +47 -52
- package/dist/runtime/blob.mjs +11 -4
- package/dist/runtime/browser.d.ts +1 -1
- package/dist/runtime/browser.mjs +12 -2
- package/dist/runtime/cache.d.ts +2 -1
- package/dist/runtime/kv.mjs +4 -1
- package/dist/runtime/providers/qarpeo.d.ts +3 -3
- package/dist/runtime/server/durable-objects/agent.mjs +1 -1
- package/dist/runtime/server/durable-objects/room.d.ts +2 -2
- package/dist/runtime/server/durable-objects/room.mjs +5 -5
- package/dist/runtime/server/middleware/devtools.mjs +6 -2
- package/dist/runtime/server/plugins/cms.d.ts +4 -2
- package/dist/runtime/server/plugins/dev-proxy.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/agents/chat.post.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/agents/chat.post.mjs +4 -1
- package/dist/runtime/server/routes/__qarpeo/analytics/events.get.d.ts +1 -4
- package/dist/runtime/server/routes/__qarpeo/analytics/summary.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/analytics/summary.get.mjs +5 -1
- package/dist/runtime/server/routes/__qarpeo/db/tables.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/db/tables.get.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/logs.get.d.ts +4 -1
- package/dist/runtime/server/routes/__qarpeo/mail/track/click/[id].get.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/mail/track/open/[id].get.mjs +2 -2
- package/dist/runtime/server/routes/__qarpeo/overview.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/realtime/broadcast.post.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/realtime/broadcast.post.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/realtime/clear.post.d.ts +1 -4
- package/dist/runtime/server/routes/__qarpeo/realtime/clear.post.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/realtime/disconnect.post.d.ts +1 -4
- package/dist/runtime/server/routes/__qarpeo/realtime/disconnect.post.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/realtime/room.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/realtime/rooms.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/security/analytics.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/security/ban.post.d.ts +1 -4
- package/dist/runtime/server/routes/__qarpeo/security/clear.post.d.ts +1 -4
- package/dist/runtime/server/routes/__qarpeo/security/unban.post.d.ts +1 -4
- package/dist/runtime/server/routes/__qarpeo/settings.get.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/tasks/run.post.mjs +3 -1
- package/dist/runtime/server/routes/agents/[agent]/chat.post.mjs +8 -2
- package/dist/runtime/server/routes/agents/[agent]/clear.post.mjs +8 -2
- package/dist/runtime/server/routes/agents/[agent]/history.get.mjs +8 -2
- package/dist/runtime/server/routes/ai/embed.post.d.ts +1 -4
- package/dist/runtime/server/routes/ai/search.post.d.ts +2 -2
- package/dist/runtime/server/routes/auth/account.delete.mjs +1 -1
- package/dist/runtime/server/routes/auth/handler.mjs +6 -1
- package/dist/runtime/server/routes/auth/magic-link/verify.get.mjs +1 -1
- package/dist/runtime/server/routes/auth/organization/members/[id].delete.mjs +7 -1
- package/dist/runtime/server/routes/auth/otp/verify.post.mjs +1 -1
- package/dist/runtime/server/routes/auth/sso/login.get.mjs +7 -1
- package/dist/runtime/server/routes/auth/sso/oidc/callback.get.mjs +8 -2
- package/dist/runtime/server/routes/auth/sso/saml/acs.post.mjs +7 -2
- package/dist/runtime/server/routes/auth/webauthn/login/options.post.mjs +1 -1
- package/dist/runtime/server/routes/auth/webauthn/login/verify.post.mjs +7 -2
- package/dist/runtime/server/routes/auth/webauthn/register/options.post.mjs +6 -1
- package/dist/runtime/server/routes/auth/webauthn/register/verify.post.mjs +6 -1
- package/dist/runtime/server/routes/browser/crawl.post.d.ts +1 -2
- package/dist/runtime/server/routes/browser/invoice.post.d.ts +1 -2
- package/dist/runtime/server/routes/browser/og-image.post.d.ts +2 -2
- package/dist/runtime/server/routes/browser/pdf.post.d.ts +1 -2
- package/dist/runtime/server/routes/browser/pdf.post.mjs +6 -1
- package/dist/runtime/server/routes/browser/screenshot.post.d.ts +2 -2
- package/dist/runtime/server/routes/browser/screenshot.post.mjs +5 -1
- package/dist/runtime/server/routes/cms/components/index.get.d.ts +2 -2
- package/dist/runtime/server/routes/cms/preview/disable.get.d.ts +4 -3
- package/dist/runtime/server/routes/cms/preview/enable.get.d.ts +8 -8
- package/dist/runtime/server/routes/cms/search.get.mjs +1 -1
- package/dist/runtime/server/routes/cms/webhooks/[provider].post.d.ts +7 -7
- package/dist/runtime/server/routes/cms/webhooks/[provider].post.mjs +9 -2
- package/dist/runtime/server/routes/docs/search.get.d.ts +9 -9
- package/dist/runtime/server/routes/fate.mjs +5 -8
- package/dist/runtime/server/routes/mail/bounce.post.d.ts +2 -2
- package/dist/runtime/server/routes/mail/unsubscribe.d.ts +2 -2
- package/dist/runtime/server/routes/mail/webhooks.post.d.ts +2 -2
- package/dist/runtime/server/routes/mail/webhooks.post.mjs +7 -1
- package/dist/runtime/server/routes/payments/usage.get.d.ts +8 -8
- package/dist/runtime/server/routes/payments/usage.post.d.ts +2 -2
- package/dist/runtime/server/routes/realtime/history.delete.d.ts +4 -3
- package/dist/runtime/server/routes/realtime/history.get.d.ts +7 -6
- package/dist/runtime/server/routes/realtime/ws.get.mjs +6 -1
- package/dist/runtime/server/routes/robots.txt.get.mjs +1 -1
- package/dist/runtime/server/routes/sitemap.xml.get.mjs +2 -1
- package/dist/runtime/server/routes/storage/multipart/abort.post.d.ts +2 -2
- package/dist/runtime/server/routes/storage/multipart/complete.post.d.ts +2 -2
- package/dist/runtime/server/routes/storage/multipart/complete.post.mjs +2 -2
- package/dist/runtime/server/routes/storage/multipart/create.post.d.ts +2 -2
- package/dist/runtime/server/routes/storage/multipart/create.post.mjs +7 -3
- package/dist/runtime/server/routes/storage/multipart/part.put.d.ts +2 -2
- package/dist/runtime/server/routes/storage/multipart/part.put.mjs +1 -1
- package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/index.delete.mjs +2 -4
- package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/verify.post.mjs +2 -4
- package/dist/runtime/server/routes/tenants/[tenant]/domains/index.get.mjs +1 -1
- package/dist/runtime/server/routes/tenants/[tenant]/domains/index.post.mjs +2 -4
- package/dist/runtime/server/tasks/cms/publish.mjs +1 -1
- package/dist/runtime/server/utils/ai.d.ts +9 -9
- package/dist/runtime/server/utils/ai.mjs +3 -3
- package/dist/runtime/server/utils/auth.d.ts +12 -16
- package/dist/runtime/server/utils/auth.mjs +15 -9
- package/dist/runtime/server/utils/bots.mjs +21 -7
- package/dist/runtime/server/utils/browser-utils.d.ts +44 -41
- package/dist/runtime/server/utils/browser-utils.mjs +14 -4
- package/dist/runtime/server/utils/cache.d.ts +5 -5
- package/dist/runtime/server/utils/cms/common.d.ts +26 -0
- package/dist/runtime/server/utils/cms/common.mjs +68 -0
- package/dist/runtime/server/utils/cms/git.d.ts +24 -0
- package/dist/runtime/server/utils/cms/git.mjs +240 -0
- package/dist/runtime/server/utils/cms/markdown.d.ts +22 -0
- package/dist/runtime/server/utils/cms/markdown.mjs +92 -0
- package/dist/runtime/server/utils/cms/path.d.ts +51 -0
- package/dist/runtime/server/utils/cms/path.mjs +127 -0
- package/dist/runtime/server/utils/cms/search.d.ts +22 -0
- package/dist/runtime/server/utils/cms/search.mjs +221 -0
- package/dist/runtime/server/utils/cms-events.d.ts +1 -1
- package/dist/runtime/server/utils/cms-events.mjs +2 -2
- package/dist/runtime/server/utils/cms-filter.mjs +2 -2
- package/dist/runtime/server/utils/cms.d.ts +17 -149
- package/dist/runtime/server/utils/cms.mjs +52 -761
- package/dist/runtime/server/utils/config.d.ts +5 -4
- package/dist/runtime/server/utils/domains.mjs +7 -4
- package/dist/runtime/server/utils/email-templates.d.ts +10 -7
- package/dist/runtime/server/utils/email-templates.mjs +20 -5
- package/dist/runtime/server/utils/feed.d.ts +2 -2
- package/dist/runtime/server/utils/feed.mjs +3 -1
- package/dist/runtime/server/utils/mail-suppression.d.ts +8 -24
- package/dist/runtime/server/utils/mail-suppression.mjs +2 -2
- package/dist/runtime/server/utils/mail.d.ts +7 -8
- package/dist/runtime/server/utils/mail.mjs +17 -12
- package/dist/runtime/server/utils/multipart-store.d.ts +2 -2
- package/dist/runtime/server/utils/notifications.d.ts +9 -23
- package/dist/runtime/server/utils/organization.mjs +4 -12
- package/dist/runtime/server/utils/passwordless.mjs +1 -1
- package/dist/runtime/server/utils/payments.d.ts +2 -6
- package/dist/runtime/server/utils/payments.mjs +1 -1
- package/dist/runtime/server/utils/queue.d.ts +21 -31
- package/dist/runtime/server/utils/rag.d.ts +4 -4
- package/dist/runtime/server/utils/rag.mjs +8 -8
- package/dist/runtime/server/utils/realtime-store.d.ts +2 -2
- package/dist/runtime/server/utils/realtime.d.ts +26 -28
- package/dist/runtime/server/utils/scheduled-task.d.ts +1 -3
- package/dist/runtime/server/utils/security-store.d.ts +2 -2
- package/dist/runtime/server/utils/session.d.ts +9 -11
- package/dist/runtime/server/utils/sso.d.ts +9 -15
- package/dist/runtime/server/utils/sso.mjs +4 -8
- package/dist/runtime/server/utils/storage.d.ts +19 -2
- package/dist/runtime/server/utils/storage.mjs +36 -7
- package/dist/runtime/server/utils/tenant.mjs +3 -1
- package/dist/runtime/server/utils/turnstile.d.ts +3 -5
- package/dist/runtime/server/utils/vapid.d.ts +5 -8
- package/dist/runtime/server/utils/vapid.mjs +26 -13
- package/dist/runtime/service.d.ts +13 -13
- package/dist/runtime/service.mjs +4 -2
- package/dist/runtime/test-utils.d.ts +20 -30
- package/dist/runtime/test-utils.mjs +5 -4
- package/dist/runtime/types/auth-globals.d.ts +14 -14
- package/dist/runtime/types/imports.d.ts +82 -82
- package/dist/runtime/types/index.d.ts +2 -2
- package/dist/runtime/types/r2.d.ts +5 -0
- package/dist/runtime/types/service.d.ts +11 -18
- package/dist/types.d.ts +100 -107
- package/dist/utils/auth-schema.d.ts +2 -2
- package/dist/utils/cms-sources.d.ts +3 -3
- package/dist/utils/local-db.d.ts +3 -3
- package/dist/utils/notifications-schema.d.ts +1 -3
- package/dist/utils/pkg.d.ts +7 -0
- package/dist/utils/queue.d.ts +3 -3
- package/dist/utils/tasks.d.ts +3 -2
- package/package.json +11 -8
|
@@ -7,7 +7,12 @@ export default defineEventHandler(async (event) => {
|
|
|
7
7
|
} catch {
|
|
8
8
|
body = event?._body || event?.body || {};
|
|
9
9
|
}
|
|
10
|
-
const {
|
|
10
|
+
const {
|
|
11
|
+
url,
|
|
12
|
+
html,
|
|
13
|
+
options = {},
|
|
14
|
+
filename
|
|
15
|
+
} = body || {};
|
|
11
16
|
const target = html || url;
|
|
12
17
|
if (!target || typeof target !== "string" || !target.trim()) {
|
|
13
18
|
throw createError({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* POST /api/browser/screenshot
|
|
3
3
|
*
|
|
4
|
-
* Body: { url?: string; html?: string; options?: ScreenshotOptions }
|
|
5
|
-
*
|
|
4
|
+
* Body: { url?: string; html?: string; options?: ScreenshotOptions } Returns: image bytes with
|
|
5
|
+
* Content-Type header
|
|
6
6
|
*/
|
|
7
7
|
declare const _default: import("nuxt/server").EventHandler<Promise<Response>>;
|
|
8
8
|
export default _default;
|
|
@@ -7,7 +7,11 @@ export default defineEventHandler(async (event) => {
|
|
|
7
7
|
} catch {
|
|
8
8
|
body = event?._body || event?.body || {};
|
|
9
9
|
}
|
|
10
|
-
const {
|
|
10
|
+
const {
|
|
11
|
+
url,
|
|
12
|
+
html,
|
|
13
|
+
options = {}
|
|
14
|
+
} = body || {};
|
|
11
15
|
const target = html || url;
|
|
12
16
|
if (!target || typeof target !== "string" || !target.trim()) {
|
|
13
17
|
throw createError({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GET /api/cms/components
|
|
3
3
|
*
|
|
4
|
-
* Returns all globally registered CMS component definitions from `nuxt.config.ts`
|
|
5
|
-
*
|
|
4
|
+
* Returns all globally registered CMS component definitions from `nuxt.config.ts` `cms.components`.
|
|
5
|
+
* Used by the CMS Admin UI to populate component field pickers.
|
|
6
6
|
*/
|
|
7
7
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
8
8
|
components: {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* GET /api/cms/preview/disable
|
|
3
|
-
*
|
|
2
|
+
* GET /api/cms/preview/disable Disables CMS preview mode by clearing the `qarpeo_preview` cookie
|
|
3
|
+
* and redirecting.
|
|
4
4
|
*
|
|
5
5
|
* Query params:
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
|
+
* - Redirect: string (optional page to redirect back to, default: "/")
|
|
7
8
|
*/
|
|
8
9
|
declare const _default: import("nuxt/server").EventHandler<string>;
|
|
9
10
|
export default _default;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* GET /api/cms/preview/enable
|
|
3
|
-
*
|
|
4
|
-
* Redirects the user to the target document page.
|
|
2
|
+
* GET /api/cms/preview/enable Activates preview mode by verifying an HMAC preview token and setting
|
|
3
|
+
* a `qarpeo_preview` cookie. Redirects the user to the target document page.
|
|
5
4
|
*
|
|
6
5
|
* Query params:
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
6
|
+
*
|
|
7
|
+
* - Collection: string (collection ID)
|
|
8
|
+
* - Slug: string (entry slug or ID)
|
|
9
|
+
* - Token: string (HMAC-SHA256 signature)
|
|
10
|
+
* - Expires: string (expiration timestamp)
|
|
11
|
+
* - Redirect: string (target page URL)
|
|
12
12
|
*/
|
|
13
13
|
declare const _default: import("nuxt/server").EventHandler<Promise<string>>;
|
|
14
14
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineEventHandler, getQuery } from "nuxt/server";
|
|
2
|
-
import { getD1Binding } from "../../../db.mjs";
|
|
3
2
|
import { getCloudflareEnv } from "../../../bindings.mjs";
|
|
3
|
+
import { getD1Binding } from "../../../db.mjs";
|
|
4
4
|
import { similaritySearch } from "../../utils/ai.mjs";
|
|
5
5
|
import { getCMSConfig, buildFtsQuery } from "../../utils/cms.mjs";
|
|
6
6
|
import { getAuthContext } from "../../utils/context.mjs";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* POST /cms/webhooks/:provider and POST /api/cms/webhooks/:provider
|
|
3
3
|
*
|
|
4
|
-
* Ingests external webhook events and triggers automated CMS operations.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
4
|
+
* Ingests external webhook events and triggers automated CMS operations. Supported providers:
|
|
5
|
+
*
|
|
6
|
+
* - "github": Push events with X-Hub-Signature-256 HMAC verification. Automatically re-syncs modified
|
|
7
|
+
* markdown content files and updates D1 + SQLite FTS5 indexes.
|
|
8
|
+
* - "queue" / "cloudflare": Asynchronous task dispatch from Cloudflare Queues for content sync,
|
|
9
|
+
* scheduled publishing, or FTS re-indexing.
|
|
10
|
+
* - "generic": CI/CD or manual trigger endpoint with X-CMS-Secret / Bearer token.
|
|
11
11
|
*/
|
|
12
12
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
13
13
|
ok: boolean;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
defineEventHandler,
|
|
3
|
+
getRouterParam,
|
|
4
|
+
createError,
|
|
5
|
+
getRequestHeader
|
|
6
|
+
} from "nuxt/server";
|
|
2
7
|
function getH3Header(event, name) {
|
|
3
8
|
return getRequestHeader(event, name) || event?.node?.req?.headers?.[name.toLowerCase()];
|
|
4
9
|
}
|
|
@@ -154,7 +159,9 @@ export default defineEventHandler(async (event) => {
|
|
|
154
159
|
} else if (action2 === "invalidate-cache") {
|
|
155
160
|
if (item.collection) {
|
|
156
161
|
await invalidateCMSEntryCache(event, item.collection, item.slug);
|
|
157
|
-
executedActions.push(
|
|
162
|
+
executedActions.push(
|
|
163
|
+
`invalidate-cache:${item.collection}${item.slug ? `/${item.slug}` : ""}`
|
|
164
|
+
);
|
|
158
165
|
}
|
|
159
166
|
}
|
|
160
167
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* GET /api/docs/search
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* and returns ranked excerpts compatible with CommandPalettes and search dialogs.
|
|
2
|
+
* GET /api/docs/search Server endpoint for granular section-level documentation search. Splits
|
|
3
|
+
* markdown content by headings, scores matches against query keywords, and returns ranked excerpts
|
|
4
|
+
* compatible with CommandPalettes and search dialogs.
|
|
6
5
|
*
|
|
7
6
|
* Query params:
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
7
|
+
*
|
|
8
|
+
* - Q: search keywords (e.g. "webhooks")
|
|
9
|
+
* - Locale: optional language code (e.g. "en", "es")
|
|
10
|
+
* - Collection: optional collection name (default: "docs")
|
|
11
|
+
* - Limit: maximum results (default: 20)
|
|
12
|
+
* - Version: optional documentation version
|
|
13
13
|
*/
|
|
14
14
|
declare const _default: import("nuxt/server").EventHandler<Promise<import("../../../../types").DocsSearchResponse>>;
|
|
15
15
|
export default _default;
|
|
@@ -23,13 +23,10 @@ export default defineEventHandler(async (event) => {
|
|
|
23
23
|
const handler = await getFateHandler();
|
|
24
24
|
const ev = event;
|
|
25
25
|
const headers = getRequestHeaders(event);
|
|
26
|
-
const req = ev.req instanceof Request ? ev.req : new Request(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
body: ["POST", "PUT", "PATCH"].includes(ev.method) ? JSON.stringify(await readBody(event)) : void 0
|
|
32
|
-
}
|
|
33
|
-
);
|
|
26
|
+
const req = ev.req instanceof Request ? ev.req : new Request(`http://${headers["host"] ?? "localhost"}${ev.path ?? "/fate"}`, {
|
|
27
|
+
method: ev.method,
|
|
28
|
+
headers: ev.headers,
|
|
29
|
+
body: ["POST", "PUT", "PATCH"].includes(ev.method) ? JSON.stringify(await readBody(event)) : void 0
|
|
30
|
+
});
|
|
34
31
|
return handler(req, event);
|
|
35
32
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* POST /api/mail/bounce
|
|
3
3
|
*
|
|
4
|
-
* Universal bounce webhook endpoint for Cloudflare Email Routing, Resend,
|
|
5
|
-
*
|
|
4
|
+
* Universal bounce webhook endpoint for Cloudflare Email Routing, Resend, Postmark, SendGrid, and
|
|
5
|
+
* custom SMTP delivery notifications.
|
|
6
6
|
*/
|
|
7
7
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
8
8
|
success: boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GET & POST /api/mail/unsubscribe
|
|
3
3
|
*
|
|
4
|
-
* Implements RFC 8058 One-Click Unsubscribe and browser unsubscribe landing page.
|
|
5
|
-
*
|
|
4
|
+
* Implements RFC 8058 One-Click Unsubscribe and browser unsubscribe landing page. Automatically
|
|
5
|
+
* adds the authenticated recipient email to the suppression list.
|
|
6
6
|
*/
|
|
7
7
|
declare const _default: import("nuxt/server").EventHandler<Promise<string | {
|
|
8
8
|
success: boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* POST /api/mail/webhooks
|
|
3
3
|
*
|
|
4
|
-
* Ingests webhook events from Resend, Postmark, SendGrid, and Cloudflare.
|
|
5
|
-
*
|
|
4
|
+
* Ingests webhook events from Resend, Postmark, SendGrid, and Cloudflare. Handles bounces, spam
|
|
5
|
+
* complaints, unsubscriptions, and delivery tracking.
|
|
6
6
|
*/
|
|
7
7
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
8
8
|
success: boolean;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { defineEventHandler, readBody } from "nuxt/server";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
recordEmailBounce,
|
|
4
|
+
recordEmailClick,
|
|
5
|
+
recordEmailOpen,
|
|
6
|
+
recordSoftBounce,
|
|
7
|
+
suppressEmail
|
|
8
|
+
} from "../../utils/mail.mjs";
|
|
3
9
|
export default defineEventHandler(async (event) => {
|
|
4
10
|
const body = await readBody(event).catch(() => ({})) || {};
|
|
5
11
|
const events = Array.isArray(body) ? body : [body];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* GET /api/payments/usage
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
2
|
+
* GET /api/payments/usage Queries metered billing usage summary and consumption records. Query
|
|
3
|
+
* params:
|
|
4
|
+
*
|
|
5
|
+
* - EventName: optional filter for a specific metric name
|
|
6
|
+
* - Since: optional start timestamp in milliseconds
|
|
7
|
+
* - Until: optional end timestamp in milliseconds
|
|
8
|
+
* - UserId: optional specific userId override (server-to-server)
|
|
9
|
+
* - OrgId: optional specific orgId override
|
|
10
10
|
*/
|
|
11
11
|
declare const _default: import("nuxt/server").EventHandler<Promise<import("../../../../types").UsageSummary>>;
|
|
12
12
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* POST /api/payments/usage
|
|
3
|
-
*
|
|
2
|
+
* POST /api/payments/usage Records a metered usage event (API requests, storage bytes, compute
|
|
3
|
+
* units, etc.)
|
|
4
4
|
*/
|
|
5
5
|
declare const _default: import("nuxt/server").EventHandler<Promise<import("../../../../types").MeterUsageResult>>;
|
|
6
6
|
export default _default;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* DELETE /api/realtime/history
|
|
3
3
|
*
|
|
4
|
-
* Clears the persistent message history replay buffer for a room from Durable Object storage.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Clears the persistent message history replay buffer for a room from Durable Object storage. Query
|
|
5
|
+
* parameters:
|
|
6
|
+
*
|
|
7
|
+
* - Room: Room ID (default: "general")
|
|
7
8
|
*/
|
|
8
9
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
9
10
|
success: boolean;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GET /api/realtime/history
|
|
3
3
|
*
|
|
4
|
-
* Retrieves the recent message history buffer for a room from Durable Object storage.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
4
|
+
* Retrieves the recent message history buffer for a room from Durable Object storage. Query
|
|
5
|
+
* parameters:
|
|
6
|
+
*
|
|
7
|
+
* - Room: Room ID (default: "general")
|
|
8
|
+
* - Limit: Maximum messages to return (default: 50)
|
|
9
|
+
* - SinceSeq: Monotonic sequence offset for incremental history retrieval
|
|
10
|
+
* - Since: Timestamp offset (ms)
|
|
10
11
|
*/
|
|
11
12
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
12
13
|
room: string;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
defineEventHandler,
|
|
3
|
+
getQuery,
|
|
4
|
+
createError,
|
|
5
|
+
getRequestURL
|
|
6
|
+
} from "nuxt/server";
|
|
2
7
|
import { getQarpeoConfig } from "../../utils/config.mjs";
|
|
3
8
|
import { getAuthContext } from "../../utils/context.mjs";
|
|
4
9
|
import { getRoomDurableObject } from "../../utils/realtime.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineEventHandler } from "nuxt/server";
|
|
2
|
-
export default defineEventHandler((
|
|
2
|
+
export default defineEventHandler((_event) => {
|
|
3
3
|
const runtimeConfig = globalThis.__NUXT_RUNTIME_CONFIG__ || {};
|
|
4
4
|
const site = runtimeConfig.public?.qarpeo?.site || {};
|
|
5
5
|
const procEnv = globalThis.process?.env || {};
|
|
@@ -65,7 +65,8 @@ export default defineEventHandler(async (event) => {
|
|
|
65
65
|
`;
|
|
66
66
|
if (u.changefreq) entry += ` <changefreq>${u.changefreq}</changefreq>
|
|
67
67
|
`;
|
|
68
|
-
if (typeof u.priority === "number")
|
|
68
|
+
if (typeof u.priority === "number")
|
|
69
|
+
entry += ` <priority>${u.priority.toFixed(1)}</priority>
|
|
69
70
|
`;
|
|
70
71
|
entry += ` </url>`;
|
|
71
72
|
return entry;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* POST /api/storage/multipart/abort
|
|
3
|
-
*
|
|
2
|
+
* POST /api/storage/multipart/abort Aborts an active R2 multipart upload session and frees
|
|
3
|
+
* resources.
|
|
4
4
|
*/
|
|
5
5
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
6
6
|
ok: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* POST /api/storage/multipart/complete
|
|
3
|
-
*
|
|
2
|
+
* POST /api/storage/multipart/complete Assembles all uploaded chunks and completes the R2 multipart
|
|
3
|
+
* upload.
|
|
4
4
|
*/
|
|
5
5
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
6
6
|
key: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineEventHandler, readBody, createError } from "nuxt/server";
|
|
2
2
|
import { getR2Binding } from "../../../../blob.mjs";
|
|
3
|
-
import { getDevMultipartSession, deleteDevMultipartSession } from "../../../utils/multipart-store.mjs";
|
|
4
3
|
import { getDevMockBlobStore } from "../../../utils/blob-store.mjs";
|
|
4
|
+
import { getDevMultipartSession, deleteDevMultipartSession } from "../../../utils/multipart-store.mjs";
|
|
5
5
|
import { buildStorageUrl } from "../../../utils/storage.mjs";
|
|
6
6
|
export default defineEventHandler(async (event) => {
|
|
7
7
|
let body = {};
|
|
@@ -33,7 +33,7 @@ export default defineEventHandler(async (event) => {
|
|
|
33
33
|
totalSize = completedObj.size;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
} catch
|
|
36
|
+
} catch {
|
|
37
37
|
}
|
|
38
38
|
const session = getDevMultipartSession(uploadId);
|
|
39
39
|
const access = session?.access || "public";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BlobAccessTier } from "../../../../types";
|
|
2
2
|
/**
|
|
3
|
-
* POST /api/storage/multipart/create
|
|
4
|
-
*
|
|
3
|
+
* POST /api/storage/multipart/create Initiates an R2 multipart upload session and returns uploadId,
|
|
4
|
+
* key, and chunking specs.
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
7
7
|
uploadId: string;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { defineEventHandler, readBody, createError } from "nuxt/server";
|
|
2
|
-
import { getStorageConfig, resolveStorageScopePrefix, sanitizeFilename } from "../../../utils/storage.mjs";
|
|
3
|
-
import { getAuthContext } from "../../../utils/context.mjs";
|
|
4
2
|
import { getR2Binding } from "../../../../blob.mjs";
|
|
3
|
+
import { getAuthContext } from "../../../utils/context.mjs";
|
|
5
4
|
import { createDevMultipartSession } from "../../../utils/multipart-store.mjs";
|
|
5
|
+
import {
|
|
6
|
+
getStorageConfig,
|
|
7
|
+
resolveStorageScopePrefix,
|
|
8
|
+
sanitizeFilename
|
|
9
|
+
} from "../../../utils/storage.mjs";
|
|
6
10
|
export default defineEventHandler(async (event) => {
|
|
7
11
|
const config = getStorageConfig(event);
|
|
8
12
|
let body = {};
|
|
@@ -48,7 +52,7 @@ export default defineEventHandler(async (event) => {
|
|
|
48
52
|
});
|
|
49
53
|
uploadId = mp.uploadId;
|
|
50
54
|
}
|
|
51
|
-
} catch
|
|
55
|
+
} catch {
|
|
52
56
|
}
|
|
53
57
|
if (!uploadId) {
|
|
54
58
|
uploadId = `mp_${Date.now()}_${crypto.randomUUID().replace(/-/g, "").slice(0, 16)}`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* PUT /api/storage/multipart/part
|
|
3
|
-
*
|
|
2
|
+
* PUT /api/storage/multipart/part Uploads a single chunk/part for an active multipart upload
|
|
3
|
+
* session.
|
|
4
4
|
*/
|
|
5
5
|
declare const _default: import("nuxt/server").EventHandler<Promise<{
|
|
6
6
|
partNumber: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineEventHandler, getRouterParam, createError } from "nuxt/server";
|
|
2
|
-
import { getAuthSession } from "../../../../../utils/session.mjs";
|
|
3
2
|
import { getD1Binding } from "../../../../../../db.mjs";
|
|
4
3
|
import { deleteCustomDomain, getCustomDomain } from "../../../../../utils/domains.mjs";
|
|
4
|
+
import { getAuthSession } from "../../../../../utils/session.mjs";
|
|
5
5
|
import { getTenantById } from "../../../../../utils/tenant.mjs";
|
|
6
6
|
export default defineEventHandler(async (event) => {
|
|
7
7
|
const session = await getAuthSession(event).catch(() => null);
|
|
@@ -20,9 +20,7 @@ export default defineEventHandler(async (event) => {
|
|
|
20
20
|
try {
|
|
21
21
|
const bindingName = globalThis.process?.env?.QARPEO_DEFAULT_DB_BINDING || "DB";
|
|
22
22
|
const d1 = getD1Binding(bindingName, event);
|
|
23
|
-
const membership = await d1.prepare(
|
|
24
|
-
"SELECT role FROM member WHERE organization_id = ? AND user_id = ? LIMIT 1"
|
|
25
|
-
).bind(tenant.organizationId, userId).first();
|
|
23
|
+
const membership = await d1.prepare("SELECT role FROM member WHERE organization_id = ? AND user_id = ? LIMIT 1").bind(tenant.organizationId, userId).first();
|
|
26
24
|
if (!membership || !["owner", "admin"].includes(membership.role)) {
|
|
27
25
|
throw createError({
|
|
28
26
|
statusCode: 403,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineEventHandler, getRouterParam, createError } from "nuxt/server";
|
|
2
|
-
import { getAuthSession } from "../../../../../utils/session.mjs";
|
|
3
2
|
import { getD1Binding } from "../../../../../../db.mjs";
|
|
4
3
|
import { getCustomDomain, verifyCustomDomain } from "../../../../../utils/domains.mjs";
|
|
4
|
+
import { getAuthSession } from "../../../../../utils/session.mjs";
|
|
5
5
|
import { getTenantById } from "../../../../../utils/tenant.mjs";
|
|
6
6
|
export default defineEventHandler(async (event) => {
|
|
7
7
|
const session = await getAuthSession(event).catch(() => null);
|
|
@@ -20,9 +20,7 @@ export default defineEventHandler(async (event) => {
|
|
|
20
20
|
try {
|
|
21
21
|
const bindingName = globalThis.process?.env?.QARPEO_DEFAULT_DB_BINDING || "DB";
|
|
22
22
|
const d1 = getD1Binding(bindingName, event);
|
|
23
|
-
const membership = await d1.prepare(
|
|
24
|
-
"SELECT role FROM member WHERE organization_id = ? AND user_id = ? LIMIT 1"
|
|
25
|
-
).bind(tenant.organizationId, userId).first();
|
|
23
|
+
const membership = await d1.prepare("SELECT role FROM member WHERE organization_id = ? AND user_id = ? LIMIT 1").bind(tenant.organizationId, userId).first();
|
|
26
24
|
if (!membership || !["owner", "admin"].includes(membership.role)) {
|
|
27
25
|
throw createError({
|
|
28
26
|
statusCode: 403,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineEventHandler, getRouterParam, createError } from "nuxt/server";
|
|
2
|
-
import { getAuthSession } from "../../../../utils/session.mjs";
|
|
3
2
|
import { listTenantDomains } from "../../../../utils/domains.mjs";
|
|
3
|
+
import { getAuthSession } from "../../../../utils/session.mjs";
|
|
4
4
|
import { getTenantById, getTenantBySlug } from "../../../../utils/tenant.mjs";
|
|
5
5
|
export default defineEventHandler(async (event) => {
|
|
6
6
|
const session = await getAuthSession(event).catch(() => null);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineEventHandler, getRouterParam, readBody, createError } from "nuxt/server";
|
|
2
|
-
import { getAuthSession } from "../../../../utils/session.mjs";
|
|
3
2
|
import { getD1Binding } from "../../../../../db.mjs";
|
|
4
3
|
import { registerCustomDomain } from "../../../../utils/domains.mjs";
|
|
4
|
+
import { getAuthSession } from "../../../../utils/session.mjs";
|
|
5
5
|
import { getTenantById, getTenantBySlug } from "../../../../utils/tenant.mjs";
|
|
6
6
|
export default defineEventHandler(async (event) => {
|
|
7
7
|
const session = await getAuthSession(event).catch(() => null);
|
|
@@ -21,9 +21,7 @@ export default defineEventHandler(async (event) => {
|
|
|
21
21
|
try {
|
|
22
22
|
const bindingName = globalThis.process?.env?.QARPEO_DEFAULT_DB_BINDING || "DB";
|
|
23
23
|
const d1 = getD1Binding(bindingName, event);
|
|
24
|
-
const membership = await d1.prepare(
|
|
25
|
-
"SELECT role FROM member WHERE organization_id = ? AND user_id = ? LIMIT 1"
|
|
26
|
-
).bind(tenant.organizationId, userId).first();
|
|
24
|
+
const membership = await d1.prepare("SELECT role FROM member WHERE organization_id = ? AND user_id = ? LIMIT 1").bind(tenant.organizationId, userId).first();
|
|
27
25
|
if (!membership || !["owner", "admin"].includes(membership.role)) {
|
|
28
26
|
throw createError({
|
|
29
27
|
statusCode: 403,
|
|
@@ -5,7 +5,7 @@ export default defineTask({
|
|
|
5
5
|
name: "cms:publish",
|
|
6
6
|
description: "Publish due scheduled CMS entries"
|
|
7
7
|
},
|
|
8
|
-
async run({
|
|
8
|
+
async run({ context }) {
|
|
9
9
|
try {
|
|
10
10
|
const event = context?.event;
|
|
11
11
|
const published = await publishDueScheduledEntries(event);
|
|
@@ -87,12 +87,12 @@ export declare function streamText(options: StreamTextOptions): Promise<Response
|
|
|
87
87
|
/**
|
|
88
88
|
* Generate an image using Cloudflare Workers AI.
|
|
89
89
|
*
|
|
90
|
-
* @param options Text prompt string or configuration options
|
|
91
|
-
* @default model "@cf/black-forest-labs/flux-1-schnell"
|
|
92
|
-
*
|
|
93
90
|
* @example
|
|
94
91
|
* const img = await generateImage("A futuristic city at sunset, synthwave style")
|
|
95
92
|
* return img.toResponse()
|
|
93
|
+
*
|
|
94
|
+
* @default model "@cf/black-forest-labs/flux-1-schnell"
|
|
95
|
+
* @param options Text prompt string or configuration options
|
|
96
96
|
*/
|
|
97
97
|
export declare function generateImage(options: string | GenerateImageOptions): Promise<GenerateImageResult>;
|
|
98
98
|
/** Alias for `generateImage`. */
|
|
@@ -100,12 +100,12 @@ export declare const textToImage: typeof generateImage;
|
|
|
100
100
|
/**
|
|
101
101
|
* Generate spoken audio from text using Cloudflare Workers AI Text-to-Speech (TTS).
|
|
102
102
|
*
|
|
103
|
-
* @param options Text script or configuration options
|
|
104
|
-
* @default model "@cf/meta/mms-tts-eng"
|
|
105
|
-
*
|
|
106
103
|
* @example
|
|
107
104
|
* const audio = await generateSpeech("Welcome to our platform!")
|
|
108
105
|
* return audio.toResponse()
|
|
106
|
+
*
|
|
107
|
+
* @default model "@cf/meta/mms-tts-eng"
|
|
108
|
+
* @param options Text script or configuration options
|
|
109
109
|
*/
|
|
110
110
|
export declare function generateSpeech(options: string | GenerateSpeechOptions): Promise<GenerateSpeechResult>;
|
|
111
111
|
/** Alias for `generateSpeech`. */
|
|
@@ -113,12 +113,12 @@ export declare const textToSpeech: typeof generateSpeech;
|
|
|
113
113
|
/**
|
|
114
114
|
* Transcribe spoken audio to text using Cloudflare Workers AI Whisper (STT).
|
|
115
115
|
*
|
|
116
|
-
* @param options Audio data (Uint8Array, ArrayBuffer, Blob, number array) or configuration options
|
|
117
|
-
* @default model "@cf/openai/whisper"
|
|
118
|
-
*
|
|
119
116
|
* @example
|
|
120
117
|
* const result = await transcribeAudio(audioBytes)
|
|
121
118
|
* console.log(result.text)
|
|
119
|
+
*
|
|
120
|
+
* @default model "@cf/openai/whisper"
|
|
121
|
+
* @param options Audio data (Uint8Array, ArrayBuffer, Blob, number array) or configuration options
|
|
122
122
|
*/
|
|
123
123
|
export declare function transcribeAudio(options: TranscribeAudioInput | TranscribeAudioOptions): Promise<TranscribeAudioResult>;
|
|
124
124
|
/** Alias for `transcribeAudio`. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "#qarpeo/agents-registry";
|
|
2
2
|
import { getAIBinding } from "../../ai.mjs";
|
|
3
3
|
import { getCloudflareEnv } from "../../bindings.mjs";
|
|
4
|
-
import { getVectorizeBinding } from "../../vectorize.mjs";
|
|
5
4
|
import { getR2Binding } from "../../blob.mjs";
|
|
5
|
+
import { getVectorizeBinding } from "../../vectorize.mjs";
|
|
6
6
|
const GLOBAL_AGENT_REGISTRY_KEY = "__qarpeo_agent_registry__";
|
|
7
7
|
function getAgentRegistry() {
|
|
8
8
|
const g = globalThis;
|
|
@@ -132,7 +132,7 @@ export async function embedText(text, options) {
|
|
|
132
132
|
} catch (err) {
|
|
133
133
|
if (err?.message?.includes("was not found")) {
|
|
134
134
|
return texts.map((txt) => {
|
|
135
|
-
const vec =
|
|
135
|
+
const vec = Array.from({ length: 768 }, () => 0);
|
|
136
136
|
for (let i = 0; i < txt.length; i++) {
|
|
137
137
|
vec[i % 768] = (vec[i % 768] + txt.charCodeAt(i)) / 1e3;
|
|
138
138
|
}
|
|
@@ -208,7 +208,7 @@ export async function streamText(options) {
|
|
|
208
208
|
const { readable, writable } = new TransformStream();
|
|
209
209
|
const writer = writable.getWriter();
|
|
210
210
|
const encoder = new TextEncoder();
|
|
211
|
-
(async () => {
|
|
211
|
+
void (async () => {
|
|
212
212
|
try {
|
|
213
213
|
const runOptions = {
|
|
214
214
|
messages,
|