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
|
@@ -3,7 +3,8 @@ import type { QarpeoSubscription } from "../../../types";
|
|
|
3
3
|
* Reactive composable for managing customer subscription status, initiating checkout sessions,
|
|
4
4
|
* opening the customer billing portal, and reporting/querying metered usage.
|
|
5
5
|
*
|
|
6
|
-
* Usage: const { subscription, isSubscribed, checkout, openPortal, reportUsage, getUsage } =
|
|
6
|
+
* Usage: const { subscription, isSubscribed, checkout, openPortal, reportUsage, getUsage } =
|
|
7
|
+
* useSubscription()
|
|
7
8
|
*/
|
|
8
9
|
export declare function useSubscription(): {
|
|
9
10
|
subscription: import("vue").ComputedRef<QarpeoSubscription | null>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { computed } from "vue";
|
|
2
1
|
import { useRuntimeConfig, useAsyncData } from "nuxt/app";
|
|
2
|
+
import { computed } from "vue";
|
|
3
3
|
export function useSubscription() {
|
|
4
4
|
const runtimeConfig = useRuntimeConfig();
|
|
5
5
|
const paymentsConfig = runtimeConfig.public?.qarpeo?.payments || {};
|
|
@@ -44,8 +44,8 @@ export interface UseRealtimeReturn<Events extends Record<string, any> = Record<s
|
|
|
44
44
|
/** Listen for an event broadcasted in the room. Returns an unsubscribe function. */
|
|
45
45
|
on: <E extends string = string>(event: E, handler: (payload: E extends keyof Events ? Events[E] : any, message: RealtimeMessage) => void) => () => void;
|
|
46
46
|
/**
|
|
47
|
-
* Remove a specific handler (or all handlers) for an event.
|
|
48
|
-
*
|
|
47
|
+
* Remove a specific handler (or all handlers) for an event. If `handler` is omitted, all
|
|
48
|
+
* listeners for that event are removed.
|
|
49
49
|
*/
|
|
50
50
|
off: <E extends string = string>(event: E, handler?: (payload: E extends keyof Events ? Events[E] : any, message: RealtimeMessage) => void) => void;
|
|
51
51
|
/** Broadcast an event to peers in the room. */
|
|
@@ -74,23 +74,23 @@ export declare function useRealtime<Events extends Record<string, any> = Record<
|
|
|
74
74
|
* High-level composable for live presence, user tracking, typing indicators, and cursors.
|
|
75
75
|
*
|
|
76
76
|
* @example
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
77
|
+
* ;```vue
|
|
78
|
+
* <script setup>
|
|
79
|
+
* const { myPresence, updatePresence, peers, onlineCount, onCursorMove } = usePresence("doc:42", {
|
|
80
80
|
* initial: { status: "viewing" }
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
81
|
+
* })
|
|
82
|
+
* </script>
|
|
83
|
+
* ```
|
|
84
84
|
*/
|
|
85
85
|
export declare function usePresence<T extends Record<string, any> = Record<string, any>>(room: MaybeRefOrGetter<string>, options?: UsePresenceOptions<T>): UsePresenceReturn<T>;
|
|
86
86
|
/**
|
|
87
87
|
* High-level composable for synchronized reactive room state across all connected users.
|
|
88
88
|
*
|
|
89
89
|
* @example
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
90
|
+
* ;```vue
|
|
91
|
+
* <script setup>
|
|
92
|
+
* const { state, patchState } = useRoomState("poll:101", { votes: 0 })
|
|
93
|
+
* </script>
|
|
94
|
+
* ```
|
|
95
95
|
*/
|
|
96
96
|
export declare function useRoomState<T extends Record<string, any> = Record<string, any>>(room: MaybeRefOrGetter<string>, initialState?: T): UseRoomStateReturn<T>;
|
|
@@ -357,7 +357,7 @@ export function useRealtime(room, options = {}) {
|
|
|
357
357
|
}
|
|
358
358
|
export function usePresence(room, options = {}) {
|
|
359
359
|
const realtime = useRealtime(room, { presence: options.initial });
|
|
360
|
-
const myPresence = ref({ ...options.initial
|
|
360
|
+
const myPresence = ref({ ...options.initial });
|
|
361
361
|
const throttleMs = options.throttle ?? 50;
|
|
362
362
|
let throttleTimer = null;
|
|
363
363
|
let pendingUpdate = null;
|
|
@@ -369,7 +369,7 @@ export function usePresence(room, options = {}) {
|
|
|
369
369
|
}
|
|
370
370
|
function updatePresence(partial) {
|
|
371
371
|
myPresence.value = { ...myPresence.value, ...partial };
|
|
372
|
-
pendingUpdate = { ...pendingUpdate
|
|
372
|
+
pendingUpdate = { ...pendingUpdate, ...partial };
|
|
373
373
|
if (!throttleTimer) {
|
|
374
374
|
flushPresence();
|
|
375
375
|
throttleTimer = setTimeout(() => {
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import type { ResumableUploadOptions, UseResumableUploadReturn } from "../../../types";
|
|
2
2
|
/**
|
|
3
|
-
* High-performance edge composable for chunked, resumable large file uploads
|
|
4
|
-
*
|
|
3
|
+
* High-performance edge composable for chunked, resumable large file uploads directly to Cloudflare
|
|
4
|
+
* R2 using Multipart Uploads.
|
|
5
5
|
*
|
|
6
6
|
* Supports pausing, resuming, aborting, and granular reactive progress tracking.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* ```vue
|
|
10
|
+
* <script setup>
|
|
11
|
+
* const { upload, pause, resume, abort, isUploading, isPaused, progress, currentPart, totalParts } = useResumableUpload()
|
|
12
12
|
*
|
|
13
|
-
*
|
|
13
|
+
* async function handleFile(e) {
|
|
14
14
|
* const file = e.target.files[0]
|
|
15
15
|
* const result = await upload(file, {
|
|
16
|
-
*
|
|
17
|
-
*
|
|
16
|
+
* chunkSize: 5 * 1024 * 1024, // 5MB chunks
|
|
17
|
+
* onProgress: (p) => console.log(`Progress: ${p}%`)
|
|
18
18
|
* })
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* }
|
|
20
|
+
* </script>
|
|
21
|
+
* ```
|
|
22
22
|
*/
|
|
23
23
|
export declare function useResumableUpload(initialOptions?: ResumableUploadOptions): UseResumableUploadReturn;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ref } from "vue";
|
|
2
1
|
import { useRuntimeConfig } from "nuxt/app";
|
|
2
|
+
import { ref } from "vue";
|
|
3
3
|
export function useResumableUpload(initialOptions = {}) {
|
|
4
4
|
const runtimeConfig = useRuntimeConfig();
|
|
5
5
|
const storageConfig = runtimeConfig.public?.qarpeo?.storage || runtimeConfig.public?.qarpeo?.blob || {};
|
|
@@ -18,12 +18,91 @@ export interface UploadOptions {
|
|
|
18
18
|
/** Use presigned URL upload directly to R2 */
|
|
19
19
|
presigned?: boolean;
|
|
20
20
|
}
|
|
21
|
-
export
|
|
21
|
+
export interface OpenFileDialogOptions {
|
|
22
|
+
/** Accepted MIME types or extensions (e.g. 'image/*', '.png,.pdf') */
|
|
23
|
+
accept?: string;
|
|
24
|
+
/** Allow selecting multiple files */
|
|
25
|
+
multiple?: boolean;
|
|
26
|
+
/** Camera capture mode (e.g. 'user', 'environment') */
|
|
27
|
+
capture?: string;
|
|
28
|
+
/** Automatically trigger upload immediately after user selects file(s) */
|
|
29
|
+
upload?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface UseStorageOptions {
|
|
32
|
+
/** Custom upload endpoint or prefix URL (e.g. '/api/storage/upload' or '/api/storage') */
|
|
33
|
+
endpoint?: string | Ref<string> | (() => string);
|
|
34
|
+
prefix?: string;
|
|
35
|
+
cdnUrl?: string;
|
|
36
|
+
/** File dialog accept attribute (e.g. 'image/*', '.pdf') */
|
|
37
|
+
accept?: string;
|
|
38
|
+
/** Allow multiple files selection */
|
|
39
|
+
multiple?: boolean;
|
|
40
|
+
/** Camera capture mode (e.g. 'user', 'environment') */
|
|
41
|
+
capture?: string;
|
|
42
|
+
/** Automatically trigger upload immediately after picking a file */
|
|
43
|
+
autoUpload?: boolean;
|
|
44
|
+
}
|
|
45
|
+
export declare function useStorage(endpointOrOptions?: string | Ref<string> | (() => string) | UseStorageOptions): {
|
|
46
|
+
file: Ref<{
|
|
47
|
+
readonly lastModified: number;
|
|
48
|
+
readonly name: string;
|
|
49
|
+
readonly webkitRelativePath: string;
|
|
50
|
+
readonly size: number;
|
|
51
|
+
readonly type: string;
|
|
52
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
53
|
+
bytes: () => Promise<Uint8Array<ArrayBuffer>>;
|
|
54
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
55
|
+
stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
|
|
56
|
+
text: () => Promise<string>;
|
|
57
|
+
} | null, File | {
|
|
58
|
+
readonly lastModified: number;
|
|
59
|
+
readonly name: string;
|
|
60
|
+
readonly webkitRelativePath: string;
|
|
61
|
+
readonly size: number;
|
|
62
|
+
readonly type: string;
|
|
63
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
64
|
+
bytes: () => Promise<Uint8Array<ArrayBuffer>>;
|
|
65
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
66
|
+
stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
|
|
67
|
+
text: () => Promise<string>;
|
|
68
|
+
} | null>;
|
|
69
|
+
files: Ref<{
|
|
70
|
+
readonly lastModified: number;
|
|
71
|
+
readonly name: string;
|
|
72
|
+
readonly webkitRelativePath: string;
|
|
73
|
+
readonly size: number;
|
|
74
|
+
readonly type: string;
|
|
75
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
76
|
+
bytes: () => Promise<Uint8Array<ArrayBuffer>>;
|
|
77
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
78
|
+
stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
|
|
79
|
+
text: () => Promise<string>;
|
|
80
|
+
}[], File[] | {
|
|
81
|
+
readonly lastModified: number;
|
|
82
|
+
readonly name: string;
|
|
83
|
+
readonly webkitRelativePath: string;
|
|
84
|
+
readonly size: number;
|
|
85
|
+
readonly type: string;
|
|
86
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
87
|
+
bytes: () => Promise<Uint8Array<ArrayBuffer>>;
|
|
88
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
89
|
+
stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
|
|
90
|
+
text: () => Promise<string>;
|
|
91
|
+
}[]>;
|
|
92
|
+
preview: Ref<string | null, string | null>;
|
|
93
|
+
open: <T extends OpenFileDialogOptions>(opts?: T) => Promise<T extends {
|
|
94
|
+
upload: true;
|
|
95
|
+
} ? UploadedFile | UploadedFile[] | null : T extends {
|
|
96
|
+
multiple: true;
|
|
97
|
+
} ? File[] | null : File | null>;
|
|
22
98
|
isUploading: Ref<boolean, boolean>;
|
|
23
99
|
progress: Ref<number, number>;
|
|
24
100
|
error: Ref<Error | null, Error | null>;
|
|
25
|
-
upload: (
|
|
26
|
-
uploadMultiple: (
|
|
101
|
+
upload: (fileOrOptions?: File | Blob | UploadOptions, maybeOptions?: UploadOptions) => Promise<UploadedFile>;
|
|
102
|
+
uploadMultiple: (filesOrOptions?: FileList | File[] | {
|
|
103
|
+
customMetadata?: Record<string, string>;
|
|
104
|
+
access?: BlobAccessTier;
|
|
105
|
+
}, maybeOptions?: {
|
|
27
106
|
customMetadata?: Record<string, string>;
|
|
28
107
|
access?: BlobAccessTier;
|
|
29
108
|
}) => Promise<UploadedFile[]>;
|
|
@@ -52,6 +131,14 @@ export interface UseUploadOptions {
|
|
|
52
131
|
headers?: Record<string, string>;
|
|
53
132
|
/** Additional form data fields to attach */
|
|
54
133
|
body?: Record<string, any>;
|
|
134
|
+
/** File dialog accept attribute (e.g. 'image/*', '.pdf,.doc') */
|
|
135
|
+
accept?: string;
|
|
136
|
+
/** Allow multiple files in file dialog */
|
|
137
|
+
multiple?: boolean;
|
|
138
|
+
/** Camera capture mode (e.g. 'user', 'environment') */
|
|
139
|
+
capture?: string;
|
|
140
|
+
/** Automatically trigger upload immediately after picking a file */
|
|
141
|
+
autoUpload?: boolean;
|
|
55
142
|
}
|
|
56
143
|
export interface UploadFileOptions {
|
|
57
144
|
/** Override the upload endpoint for this specific call */
|
|
@@ -71,17 +158,70 @@ export interface UploadFileOptions {
|
|
|
71
158
|
* Primary composable for file uploads with custom API endpoints.
|
|
72
159
|
*
|
|
73
160
|
* @example
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
161
|
+
* ;```ts
|
|
162
|
+
* // Using default '/api/upload'
|
|
163
|
+
* const { upload, isUploading, progress, error } = useUpload()
|
|
77
164
|
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
165
|
+
* // Using a custom API route
|
|
166
|
+
* const { upload, uploadMultiple, isUploading, progress, error, abort, reset } =
|
|
167
|
+
* useUpload("/api/avatars")
|
|
168
|
+
* ```
|
|
81
169
|
*/
|
|
82
170
|
export declare function useUpload(endpointOrOptions?: string | Ref<string> | (() => string) | UseUploadOptions, initialOptions?: UseUploadOptions): {
|
|
83
|
-
|
|
84
|
-
|
|
171
|
+
file: Ref<{
|
|
172
|
+
readonly lastModified: number;
|
|
173
|
+
readonly name: string;
|
|
174
|
+
readonly webkitRelativePath: string;
|
|
175
|
+
readonly size: number;
|
|
176
|
+
readonly type: string;
|
|
177
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
178
|
+
bytes: () => Promise<Uint8Array<ArrayBuffer>>;
|
|
179
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
180
|
+
stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
|
|
181
|
+
text: () => Promise<string>;
|
|
182
|
+
} | null, File | {
|
|
183
|
+
readonly lastModified: number;
|
|
184
|
+
readonly name: string;
|
|
185
|
+
readonly webkitRelativePath: string;
|
|
186
|
+
readonly size: number;
|
|
187
|
+
readonly type: string;
|
|
188
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
189
|
+
bytes: () => Promise<Uint8Array<ArrayBuffer>>;
|
|
190
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
191
|
+
stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
|
|
192
|
+
text: () => Promise<string>;
|
|
193
|
+
} | null>;
|
|
194
|
+
files: Ref<{
|
|
195
|
+
readonly lastModified: number;
|
|
196
|
+
readonly name: string;
|
|
197
|
+
readonly webkitRelativePath: string;
|
|
198
|
+
readonly size: number;
|
|
199
|
+
readonly type: string;
|
|
200
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
201
|
+
bytes: () => Promise<Uint8Array<ArrayBuffer>>;
|
|
202
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
203
|
+
stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
|
|
204
|
+
text: () => Promise<string>;
|
|
205
|
+
}[], File[] | {
|
|
206
|
+
readonly lastModified: number;
|
|
207
|
+
readonly name: string;
|
|
208
|
+
readonly webkitRelativePath: string;
|
|
209
|
+
readonly size: number;
|
|
210
|
+
readonly type: string;
|
|
211
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
212
|
+
bytes: () => Promise<Uint8Array<ArrayBuffer>>;
|
|
213
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
214
|
+
stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
|
|
215
|
+
text: () => Promise<string>;
|
|
216
|
+
}[]>;
|
|
217
|
+
preview: Ref<string | null, string | null>;
|
|
218
|
+
open: <T extends OpenFileDialogOptions>(opts?: T) => Promise<T extends {
|
|
219
|
+
upload: true;
|
|
220
|
+
} ? UploadedFile | UploadedFile[] | null : T extends {
|
|
221
|
+
multiple: true;
|
|
222
|
+
} ? File[] | null : File | null>;
|
|
223
|
+
upload: (fileOrOpts?: File | Blob | UploadFileOptions, maybeOpts?: UploadFileOptions) => Promise<UploadedFile>;
|
|
224
|
+
uploadMultiple: (filesOrOpts?: FileList | File[] | UploadFileOptions, maybeOpts?: UploadFileOptions) => Promise<UploadedFile[]>;
|
|
85
225
|
isUploading: Ref<boolean, boolean>;
|
|
86
226
|
progress: Ref<number, number>;
|
|
87
227
|
error: Ref<Error | null, Error | null>;
|