nuxt-convex-module 0.0.0 → 0.9.0
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/LICENSE +1 -1
- package/README.md +51 -157
- package/dist/chunks/index.mjs +1 -1
- package/dist/devtools-client/200.html +1 -1
- package/dist/devtools-client/404.html +1 -1
- package/dist/devtools-client/_nuxt/71bSMC-_.js +2 -0
- package/dist/devtools-client/_nuxt/{CZbAGcNC.js → BAaUCl_m.js} +1 -1
- package/dist/devtools-client/_nuxt/BhmjAr2Q.js +1 -0
- package/dist/devtools-client/_nuxt/BmBQNDID.js +1 -0
- package/dist/devtools-client/_nuxt/C6YdTgGl.js +2 -0
- package/dist/devtools-client/_nuxt/{DPWXUmcI.js → CKakiU_h.js} +1 -1
- package/dist/devtools-client/_nuxt/Cm7YqZQ-.js +1 -0
- package/dist/devtools-client/_nuxt/{dy_xXcv9.js → DQmVr-EY.js} +1 -1
- package/dist/devtools-client/_nuxt/D_Rij7MD.js +1 -0
- package/dist/devtools-client/_nuxt/EZ4-8Xzm.js +3 -0
- package/dist/devtools-client/_nuxt/Kba0XpjH.js +1 -0
- package/dist/devtools-client/_nuxt/OVE7s6ty.js +1 -0
- package/dist/devtools-client/_nuxt/_Lf3mfPR.js +1 -0
- package/dist/devtools-client/_nuxt/builds/latest.json +1 -1
- package/dist/devtools-client/_nuxt/builds/meta/7dfea6da-3eca-4a35-ba06-5e069ac7e8df.json +1 -0
- package/dist/devtools-client/_nuxt/entry.HF8C6P11.css +1 -0
- package/dist/devtools-client/_nuxt/error-404.CLlwiMp-.css +1 -0
- package/dist/devtools-client/_nuxt/error-500.Bxr6fpDU.css +1 -0
- package/dist/devtools-client/_nuxt/queries.DNBUjWk2.css +1 -0
- package/dist/devtools-client/_nuxt/vZZlEX5A.js +1 -0
- package/dist/devtools-client/auth/index.html +1 -1
- package/dist/devtools-client/index.html +1 -1
- package/dist/devtools-client/logs/index.html +1 -1
- package/dist/devtools-client/queries/index.html +1 -1
- package/dist/module.d.mts +129 -0
- package/dist/module.json +2 -2
- package/dist/module.mjs +576 -0
- package/dist/runtime/auth0/vue/index.d.ts +3 -3
- package/dist/runtime/better-auth/nuxt/middleware.d.ts +4 -2
- package/dist/runtime/better-auth/nuxt/middleware.js +15 -12
- package/dist/runtime/better-auth/nuxt/proxy.d.ts +18 -2
- package/dist/runtime/better-auth/nuxt/proxy.js +7 -7
- package/dist/runtime/better-auth/nuxt/server.d.ts +6 -6
- package/dist/runtime/better-auth/nuxt/server.js +15 -0
- package/dist/runtime/better-auth/vue/auth-boundary.d.ts +3 -1
- package/dist/runtime/better-auth/vue/client.d.ts +1 -1
- package/dist/runtime/better-auth/vue/cross-domain.d.ts +4 -5
- package/dist/runtime/better-auth/vue/cross-domain.js +11 -4
- package/dist/runtime/better-auth/vue/hydration.d.ts +1 -1
- package/dist/runtime/better-auth/vue/index.d.ts +2 -1
- package/dist/runtime/better-auth/vue/index.js +2 -1
- package/dist/runtime/better-auth/vue/plugin.client.d.ts +1 -5
- package/dist/runtime/better-auth/vue/plugin.client.js +6 -10
- package/dist/runtime/better-auth/vue/plugin.server.d.ts +5 -16
- package/dist/runtime/better-auth/vue/plugin.server.js +3 -6
- package/dist/runtime/better-auth/vue/redirect.d.ts +33 -0
- package/dist/runtime/better-auth/vue/redirect.js +14 -0
- package/dist/runtime/better-auth/vue/{use-auth.d.ts → use-better-auth.d.ts} +31 -11
- package/dist/runtime/better-auth/vue/{use-auth.js → use-better-auth.js} +4 -3
- package/dist/runtime/clerk/vue/index.d.ts +4 -4
- package/dist/runtime/devtools/bridge.js +1 -1
- package/dist/runtime/nuxt/app.d.ts +48 -0
- package/dist/runtime/nuxt/app.js +8 -0
- package/dist/runtime/nuxt/composables/use-async-paginated-query.d.ts +88 -0
- package/dist/runtime/nuxt/composables/use-async-paginated-query.js +90 -0
- package/dist/runtime/nuxt/composables/use-async-query.d.ts +7 -16
- package/dist/runtime/nuxt/composables/use-async-query.js +14 -9
- package/dist/runtime/nuxt/config.d.ts +11 -0
- package/dist/runtime/nuxt/config.js +1 -0
- package/dist/runtime/nuxt/csp.d.ts +44 -0
- package/dist/runtime/nuxt/csp.js +46 -0
- package/dist/runtime/nuxt/index.d.ts +8 -8
- package/dist/runtime/nuxt/security.d.ts +33 -0
- package/dist/runtime/nuxt/security.js +14 -0
- package/dist/runtime/polar/vue/components.d.ts +8 -1
- package/dist/runtime/polar/vue/components.js +3 -3
- package/dist/runtime/vue/auth/index.d.ts +4 -4
- package/dist/runtime/vue/auth/index.js +6 -2
- package/dist/runtime/vue/client.d.ts +5 -55
- package/dist/runtime/vue/client.js +4 -0
- package/dist/runtime/vue/components/convex-image.d.ts +50 -0
- package/dist/runtime/vue/components/convex-image.js +21 -0
- package/dist/runtime/vue/composables/use-connection-state.d.ts +1 -0
- package/dist/runtime/vue/composables/use-paginated-query.d.ts +5 -1
- package/dist/runtime/vue/composables/use-paginated-query.js +2 -2
- package/dist/runtime/vue/composables/use-query.d.ts +2 -0
- package/dist/runtime/vue/composables/use-subscription.d.ts +1 -15
- package/dist/runtime/vue/composables/use-upload-queue.d.ts +2 -3
- package/dist/runtime/vue/hydration.d.ts +3 -24
- package/dist/runtime/vue/index.d.ts +2 -2
- package/dist/runtime/vue/index.js +1 -0
- package/dist/runtime/vue/plugin.js +1 -1
- package/dist/runtime/vue/provide.d.ts +5 -5
- package/dist/types.d.mts +3 -0
- package/package.json +103 -56
- package/dist/devtools-client/_nuxt/B29GGJ5n.js +0 -1
- package/dist/devtools-client/_nuxt/BSDEpQet.js +0 -1
- package/dist/devtools-client/_nuxt/BY23OQOo.js +0 -1
- package/dist/devtools-client/_nuxt/BZYRaL-G.js +0 -1
- package/dist/devtools-client/_nuxt/Byw6FxnC.js +0 -1
- package/dist/devtools-client/_nuxt/CJJ_hcZN.js +0 -1
- package/dist/devtools-client/_nuxt/CS6WMFOx.js +0 -2
- package/dist/devtools-client/_nuxt/Cr6_aklh.js +0 -2
- package/dist/devtools-client/_nuxt/DNfpyBVU.js +0 -3
- package/dist/devtools-client/_nuxt/builds/meta/a7708498-bd09-4de2-b5ab-19b380293c77.json +0 -1
- package/dist/devtools-client/_nuxt/entry.DbTJhkHT.css +0 -1
- package/dist/devtools-client/_nuxt/error-404.CwGGO2Kz.css +0 -1
- package/dist/devtools-client/_nuxt/error-500.8ZJqCQm8.css +0 -1
- package/dist/devtools-client/_nuxt/ncgEdbEt.js +0 -1
- package/dist/devtools-client/_nuxt/queries.CE_dtt9-.css +0 -1
- package/dist/module.d.ts +0 -189
- package/dist/module.js +0 -489
- package/dist/types.d.ts +0 -3
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
import type { InjectionKey } from 'vue';
|
|
2
|
-
import { BaseConvexClient } from 'convex/browser';
|
|
3
2
|
import type { AuthTokenFetcher, BaseConvexClientOptions, ConnectionState, OptimisticUpdate, PaginationStatus, QueryJournal, QueryOptions } from 'convex/browser';
|
|
4
3
|
import type { Watch as ConvexWatch } from 'convex/react';
|
|
5
|
-
import type { ArgsAndOptions, FunctionArgs, FunctionReference, FunctionReturnType, OptionalRestArgs
|
|
4
|
+
import type { ArgsAndOptions, FunctionArgs, FunctionReference, FunctionReturnType, OptionalRestArgs } from 'convex/server';
|
|
6
5
|
import type { Value } from 'convex/values';
|
|
7
6
|
export type { AuthTokenFetcher, ConnectionState, OptimisticUpdate };
|
|
8
7
|
/**
|
|
9
8
|
* A watch on the output of a Convex query function.
|
|
10
9
|
*
|
|
11
10
|
* Derived from upstream's `Watch` (per-member docs live there), extended with
|
|
12
|
-
* the
|
|
11
|
+
* the internal `localQueryLogs`, which is stripped from the published
|
|
13
12
|
* `convex/react` types but present at runtime.
|
|
14
13
|
*
|
|
15
14
|
* @public
|
|
16
15
|
*/
|
|
17
16
|
export interface Watch<T> extends ConvexWatch<T> {
|
|
18
|
-
/**
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
|
-
localQueryLogs(): string[] | undefined;
|
|
22
17
|
}
|
|
23
18
|
/**
|
|
24
19
|
* A watch on the output of a paginated Convex query function.
|
|
@@ -61,10 +56,6 @@ export interface WatchQueryOptions {
|
|
|
61
56
|
* name and arguments, this journal will have no effect.
|
|
62
57
|
*/
|
|
63
58
|
journal?: QueryJournal;
|
|
64
|
-
/**
|
|
65
|
-
* @internal
|
|
66
|
-
*/
|
|
67
|
-
componentPath?: string;
|
|
68
59
|
}
|
|
69
60
|
/**
|
|
70
61
|
* Options for {@link ConvexVueClient.mutation}.
|
|
@@ -101,7 +92,7 @@ export type ConvexLogger = Exclude<BaseConvexClientOptions['logger'], boolean |
|
|
|
101
92
|
* This loads reactive queries and executes mutations over a WebSocket.
|
|
102
93
|
*
|
|
103
94
|
* In a Nuxt app the client is provided automatically by the plugin and
|
|
104
|
-
* available via the {@link useConvex} composable
|
|
95
|
+
* available via the {@link useConvex} composable.
|
|
105
96
|
*
|
|
106
97
|
* @public
|
|
107
98
|
*/
|
|
@@ -127,13 +118,6 @@ export declare class ConvexVueClient {
|
|
|
127
118
|
* it may be canonicalized.
|
|
128
119
|
*/
|
|
129
120
|
get url(): string;
|
|
130
|
-
/**
|
|
131
|
-
* Lazily instantiate the `BaseConvexClient` so we don't create the WebSocket
|
|
132
|
-
* when server-side rendering.
|
|
133
|
-
*
|
|
134
|
-
* @internal
|
|
135
|
-
*/
|
|
136
|
-
get sync(): BaseConvexClient;
|
|
137
121
|
/**
|
|
138
122
|
* Set the authentication token to be used for subsequent queries and mutations.
|
|
139
123
|
* `fetchToken` will be called automatically again if a token expires.
|
|
@@ -148,10 +132,6 @@ export declare class ConvexVueClient {
|
|
|
148
132
|
* Clear the current authentication token if set.
|
|
149
133
|
*/
|
|
150
134
|
clearAuth(): void;
|
|
151
|
-
/**
|
|
152
|
-
* @internal
|
|
153
|
-
*/
|
|
154
|
-
setAdminAuth(token: string, identity?: UserIdentityAttributes): void;
|
|
155
135
|
/**
|
|
156
136
|
* Construct a new {@link Watch} on a Convex query function.
|
|
157
137
|
*
|
|
@@ -183,30 +163,6 @@ export declare class ConvexVueClient {
|
|
|
183
163
|
prewarmQuery<Query extends FunctionReference<'query'>>(queryOptions: QueryOptions<Query> & {
|
|
184
164
|
extendSubscriptionFor?: number;
|
|
185
165
|
}): void;
|
|
186
|
-
/**
|
|
187
|
-
* Construct a new {@link PaginatedWatch} on a Convex paginated query function.
|
|
188
|
-
*
|
|
189
|
-
* **Not supported in the Vue port — use the {@link usePaginatedQuery}
|
|
190
|
-
* composable instead.** Convex's paginated-subscription engine
|
|
191
|
-
* (`PaginatedQueryClient`) is not part of the public `convex` exports, so a
|
|
192
|
-
* third-party package cannot instantiate it; pagination is handled entirely
|
|
193
|
-
* in the composable layer via ordinary {@link watchQuery} subscriptions.
|
|
194
|
-
*
|
|
195
|
-
* The method is retained for structural parity with
|
|
196
|
-
* `ConvexReactClient.watchPaginatedQuery`. It is reachable only if a caller
|
|
197
|
-
* passes `paginationOptions` to {@link useConvexQueries} (the React-shaped
|
|
198
|
-
* escape hatch); doing so throws this error to fail loudly rather than
|
|
199
|
-
* silently mis-subscribe.
|
|
200
|
-
*
|
|
201
|
-
* Upstream wires {@link usePaginatedQuery_experimental} to this method's
|
|
202
|
-
* `PaginatedQueryClient`; the port re-bases that hook on the same manual
|
|
203
|
-
* page-management engine as {@link usePaginatedQuery}, so both hooks work
|
|
204
|
-
* without ever calling this method (only the experimental single-request
|
|
205
|
-
* network path is not reproduced).
|
|
206
|
-
*
|
|
207
|
-
* @internal
|
|
208
|
-
*/
|
|
209
|
-
watchPaginatedQuery<Query extends FunctionReference<'query'>>(_query: Query, _args: Query['_args'], _options: unknown): PaginatedWatch<FunctionReturnType<Query>>;
|
|
210
166
|
/**
|
|
211
167
|
* Execute a mutation function.
|
|
212
168
|
*
|
|
@@ -246,6 +202,7 @@ export declare class ConvexVueClient {
|
|
|
246
202
|
* deployment.
|
|
247
203
|
*
|
|
248
204
|
* @returns The {@link ConnectionState} with the Convex deployment.
|
|
205
|
+
* @experimental May change in a minor release — see STABILITY.md.
|
|
249
206
|
*/
|
|
250
207
|
connectionState(): ConnectionState;
|
|
251
208
|
/**
|
|
@@ -259,6 +216,7 @@ export declare class ConvexVueClient {
|
|
|
259
216
|
* out what information is most useful. As such this API is considered unstable.
|
|
260
217
|
*
|
|
261
218
|
* @returns An unsubscribe function to stop listening.
|
|
219
|
+
* @experimental May change in a minor release — see STABILITY.md.
|
|
262
220
|
*/
|
|
263
221
|
subscribeToConnectionState(cb: (connectionState: ConnectionState) => void): () => void;
|
|
264
222
|
/**
|
|
@@ -295,11 +253,3 @@ export declare const ConvexClientKey: InjectionKey<ConvexVueClient>;
|
|
|
295
253
|
* @public
|
|
296
254
|
*/
|
|
297
255
|
export declare function useConvex(): ConvexVueClient;
|
|
298
|
-
/**
|
|
299
|
-
* Inject the Convex client for a composable, throwing the per-composable
|
|
300
|
-
* missing-client error when absent — mirrors the checks at the top of
|
|
301
|
-
* upstream's `useQuery`/`useMutation`/`useAction`/`useConvexConnectionState`.
|
|
302
|
-
*
|
|
303
|
-
* @internal
|
|
304
|
-
*/
|
|
305
|
-
export declare function useConvexOrThrow(composableName: string): ConvexVueClient;
|
|
@@ -243,6 +243,8 @@ export class ConvexVueClient {
|
|
|
243
243
|
* without ever calling this method (only the experimental single-request
|
|
244
244
|
* network path is not reproduced).
|
|
245
245
|
*
|
|
246
|
+
* PARITY: D-05
|
|
247
|
+
*
|
|
246
248
|
* @internal
|
|
247
249
|
*/
|
|
248
250
|
watchPaginatedQuery(_query, _args, _options) {
|
|
@@ -312,6 +314,7 @@ export class ConvexVueClient {
|
|
|
312
314
|
* deployment.
|
|
313
315
|
*
|
|
314
316
|
* @returns The {@link ConnectionState} with the Convex deployment.
|
|
317
|
+
* @experimental May change in a minor release — see STABILITY.md.
|
|
315
318
|
*/
|
|
316
319
|
connectionState() {
|
|
317
320
|
return this.sync.connectionState();
|
|
@@ -327,6 +330,7 @@ export class ConvexVueClient {
|
|
|
327
330
|
* out what information is most useful. As such this API is considered unstable.
|
|
328
331
|
*
|
|
329
332
|
* @returns An unsubscribe function to stop listening.
|
|
333
|
+
* @experimental May change in a minor release — see STABILITY.md.
|
|
330
334
|
*/
|
|
331
335
|
subscribeToConnectionState(cb) {
|
|
332
336
|
return this.sync.subscribeToConnectionState(cb);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
import { type GetStorageUrl } from '../composables/use-storage-url.js';
|
|
3
|
+
import type { StorageId } from '../composables/use-upload.js';
|
|
4
|
+
/**
|
|
5
|
+
* An `<img>` for a file in Convex storage. Resolves the served URL through
|
|
6
|
+
* {@link useStorageUrl} and renders the image once it is known; every other
|
|
7
|
+
* attribute (`alt`, `class`, `loading`, `width`, …) goes onto the `<img>`.
|
|
8
|
+
*
|
|
9
|
+
* - default slot — rendered while the URL is loading or `storageId` is empty
|
|
10
|
+
* - `missing` slot — rendered when the file no longer exists (the query returned `null`)
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```vue
|
|
14
|
+
* <ConvexImage :get-url="api.files.url" :storage-id="doc.imageId" alt="Cover" class="rounded">
|
|
15
|
+
* <div class="skeleton" />
|
|
16
|
+
* <template #missing><div class="placeholder" /></template>
|
|
17
|
+
* </ConvexImage>
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export declare const ConvexImage: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
23
|
+
/** The public `getUrl` query: `{ storageId }` → served URL or `null`. Read once, at setup. */
|
|
24
|
+
getUrl: {
|
|
25
|
+
type: PropType<GetStorageUrl>;
|
|
26
|
+
required: true;
|
|
27
|
+
};
|
|
28
|
+
/** The file to show; `null`/`undefined` renders the default slot. */
|
|
29
|
+
storageId: {
|
|
30
|
+
type: PropType<StorageId | string | null | undefined>;
|
|
31
|
+
default: undefined;
|
|
32
|
+
};
|
|
33
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
}>[] | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
38
|
+
/** The public `getUrl` query: `{ storageId }` → served URL or `null`. Read once, at setup. */
|
|
39
|
+
getUrl: {
|
|
40
|
+
type: PropType<GetStorageUrl>;
|
|
41
|
+
required: true;
|
|
42
|
+
};
|
|
43
|
+
/** The file to show; `null`/`undefined` renders the default slot. */
|
|
44
|
+
storageId: {
|
|
45
|
+
type: PropType<StorageId | string | null | undefined>;
|
|
46
|
+
default: undefined;
|
|
47
|
+
};
|
|
48
|
+
}>> & Readonly<{}>, {
|
|
49
|
+
storageId: string | StorageId | null | undefined;
|
|
50
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineComponent, h } from "vue";
|
|
2
|
+
import { useStorageUrl } from "../composables/use-storage-url.js";
|
|
3
|
+
export const ConvexImage = defineComponent({
|
|
4
|
+
name: "ConvexImage",
|
|
5
|
+
inheritAttrs: false,
|
|
6
|
+
props: {
|
|
7
|
+
/** The public `getUrl` query: `{ storageId }` → served URL or `null`. Read once, at setup. */
|
|
8
|
+
getUrl: { type: Object, required: true },
|
|
9
|
+
/** The file to show; `null`/`undefined` renders the default slot. */
|
|
10
|
+
storageId: { type: String, default: void 0 }
|
|
11
|
+
},
|
|
12
|
+
setup(props, { attrs, slots }) {
|
|
13
|
+
const url = useStorageUrl(props.getUrl, () => props.storageId);
|
|
14
|
+
return () => {
|
|
15
|
+
const value = url.value;
|
|
16
|
+
if (value) return h("img", { ...attrs, src: value });
|
|
17
|
+
if (value === null) return slots.missing?.() ?? null;
|
|
18
|
+
return slots.default?.() ?? null;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
});
|
|
@@ -26,5 +26,6 @@ import type { ShallowRef } from 'vue';
|
|
|
26
26
|
* @returns The current {@link ConnectionState} with the Convex deployment.
|
|
27
27
|
*
|
|
28
28
|
* @public
|
|
29
|
+
* @experimental May change in a minor release — see STABILITY.md.
|
|
29
30
|
*/
|
|
30
31
|
export declare function useConvexConnectionState(): ShallowRef<ConnectionState>;
|
|
@@ -32,7 +32,10 @@ export type { PaginatedQueryReference, PaginatedQueryArgs, PaginatedQueryItem, U
|
|
|
32
32
|
export declare function usePaginatedQuery<Query extends PaginatedQueryReference>(query: Query, args: MaybeRefOrGetter<PaginatedQueryArgs<Query> | 'skip'>, options: {
|
|
33
33
|
initialNumItems: number;
|
|
34
34
|
}): UsePaginatedQueryReturnType<Query>;
|
|
35
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Reset pagination id for tests only, so tests know what it is.
|
|
37
|
+
* @experimental May change in a minor release — see STABILITY.md.
|
|
38
|
+
*/
|
|
36
39
|
export declare function resetPaginationId(): void;
|
|
37
40
|
/**
|
|
38
41
|
* Return shape of {@link usePaginatedQuery} — the fields of upstream's
|
|
@@ -125,6 +128,7 @@ export declare function insertAtPosition<Query extends PaginatedQueryReference>(
|
|
|
125
128
|
* identical observable results (`results`/`data`, `status`, `loadMore`).
|
|
126
129
|
*
|
|
127
130
|
* @public
|
|
131
|
+
* @experimental May change in a minor release — see STABILITY.md.
|
|
128
132
|
*/
|
|
129
133
|
export declare function usePaginatedQuery_experimental<Query extends PaginatedQueryReference>(query: Query, args: MaybeRefOrGetter<PaginatedQueryArgs<Query> | 'skip'>, options: {
|
|
130
134
|
initialNumItems: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getFunctionName } from "convex/server";
|
|
2
2
|
import { ConvexError, compareValues, convexToJson } from "convex/values";
|
|
3
3
|
import { computed, shallowRef, toValue } from "vue";
|
|
4
|
-
import {
|
|
4
|
+
import { useConvexOrThrow } from "../client.js";
|
|
5
5
|
import { useConvexQueries } from "./use-queries.js";
|
|
6
6
|
const splitQuery = (key, splitCursor, continueCursor) => (prevState) => {
|
|
7
7
|
const queries = { ...prevState.queries };
|
|
@@ -98,7 +98,7 @@ function usePaginatedQueryInternal(query, args, options) {
|
|
|
98
98
|
`\`options.initialNumItems\` must be a positive number. Received \`${initialOptions?.initialNumItems}\`.`
|
|
99
99
|
);
|
|
100
100
|
}
|
|
101
|
-
const convex =
|
|
101
|
+
const convex = useConvexOrThrow("usePaginatedQuery");
|
|
102
102
|
const logger = convex.logger;
|
|
103
103
|
function createInitialState(q, currentArgs, skip, initialNumItems) {
|
|
104
104
|
const id = nextPaginationId();
|
|
@@ -6,6 +6,7 @@ export type OptionalRestArgsOrSkip<FuncRef extends FunctionReference<any>> = Fun
|
|
|
6
6
|
* Result returned by object-form {@link useQuery_experimental}.
|
|
7
7
|
*
|
|
8
8
|
* @public
|
|
9
|
+
* @experimental May change in a minor release — see STABILITY.md.
|
|
9
10
|
*/
|
|
10
11
|
export type UseQueryResult<QueryResult, ThrowOnError extends boolean = false> = ConvexUseQueryResult<QueryResult, ThrowOnError>;
|
|
11
12
|
type UseQueryOptions<Query extends FunctionReference<'query'>, ThrowOnError extends boolean> = {
|
|
@@ -80,6 +81,7 @@ export declare function useQuery<Query extends FunctionReference<'query'>>(query
|
|
|
80
81
|
* {@link UseQueryResult} object.
|
|
81
82
|
*
|
|
82
83
|
* @public
|
|
84
|
+
* @experimental May change in a minor release — see STABILITY.md.
|
|
83
85
|
*/
|
|
84
86
|
export declare function useQuery_experimental<Query extends FunctionReference<'query'>, ThrowOnError extends boolean = false>(options: UseQueryOptions<Query, ThrowOnError>): ComputedRef<UseQueryResult<Query['_returnType'], ThrowOnError>>;
|
|
85
87
|
/** @public */
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Composable used for safely managing subscriptions in concurrent mode.
|
|
4
|
-
*
|
|
5
|
-
* In order to avoid removing and re-adding subscriptions each time this composable is called,
|
|
6
|
-
* the parameters passed to this composable should be memoized in some way–
|
|
7
|
-
* either by wrapping the entire params object with useMemo()
|
|
8
|
-
* or by wrapping the individual callbacks with useCallback().
|
|
9
|
-
*
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
export declare function useSubscription<Value>({ getCurrentValue, subscribe, }: {
|
|
13
|
-
getCurrentValue: () => Value;
|
|
14
|
-
subscribe: (callback: () => void) => () => void;
|
|
15
|
-
}): ShallowRef<Value>;
|
|
1
|
+
export {};
|
|
@@ -40,8 +40,8 @@ export interface UseUploadQueueOptions {
|
|
|
40
40
|
/** Called once every queued item has settled (succeeded or failed). */
|
|
41
41
|
onComplete?: (items: UploadQueueItem[]) => void;
|
|
42
42
|
}
|
|
43
|
-
/** Accepted inputs to {@link VueUploadQueue.enqueue}. */
|
|
44
|
-
type EnqueueInput = Blob | Blob[] | FileList | null | undefined;
|
|
43
|
+
/** Accepted inputs to {@link VueUploadQueue.enqueue}. @public */
|
|
44
|
+
export type EnqueueInput = Blob | Blob[] | FileList | null | undefined;
|
|
45
45
|
/**
|
|
46
46
|
* The reactive queue returned by {@link useUploadQueue}.
|
|
47
47
|
*
|
|
@@ -114,4 +114,3 @@ export interface VueUploadQueue {
|
|
|
114
114
|
export declare function useUploadQueue(generateUploadUrl: GenerateUploadUrl, options?: UseUploadQueueOptions): VueUploadQueue;
|
|
115
115
|
/** @public */
|
|
116
116
|
export declare const useConvexUploadQueue: typeof useUploadQueue;
|
|
117
|
-
export {};
|
|
@@ -14,10 +14,10 @@ export type Preloaded<Query extends FunctionReference<'query'>> = {
|
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
16
|
* Load a reactive query within a Vue component using a `Preloaded` payload
|
|
17
|
-
* from the server returned by {@link preloadQuery}.
|
|
17
|
+
* from the server returned by {@link server!preloadQuery | preloadQuery}.
|
|
18
18
|
*
|
|
19
|
-
* This Vue composable
|
|
20
|
-
*
|
|
19
|
+
* This Vue composable returns a computed that updates whenever the query
|
|
20
|
+
* result changes.
|
|
21
21
|
*
|
|
22
22
|
* Throws an error if no Convex client has been provided (see {@link useConvex}).
|
|
23
23
|
*
|
|
@@ -43,24 +43,3 @@ export type Preloaded<Query extends FunctionReference<'query'>> = {
|
|
|
43
43
|
* @public
|
|
44
44
|
*/
|
|
45
45
|
export declare function usePreloadedQuery<Query extends FunctionReference<'query'>>(preloadedQuery: MaybeRefOrGetter<Preloaded<Query>>): ComputedRef<Query['_returnType']>;
|
|
46
|
-
/**
|
|
47
|
-
* Derive the query reference and reactive args/fallback from a (possibly
|
|
48
|
-
* reactive) `Preloaded` payload. All three are reactive: swapping in a payload
|
|
49
|
-
* for a different query re-derives the reference, matching upstream's
|
|
50
|
-
* `usePreloadedQuery`, which recomputes `makeFunctionReference(_name)` on
|
|
51
|
-
* every render.
|
|
52
|
-
*
|
|
53
|
-
* @internal
|
|
54
|
-
*/
|
|
55
|
-
export declare function usePreloadedPayload<Query extends FunctionReference<'query'>>(preloadedQuery: MaybeRefOrGetter<Preloaded<Query>>): {
|
|
56
|
-
query: ComputedRef<Query>;
|
|
57
|
-
args: ComputedRef<Query['_args']>;
|
|
58
|
-
preloadedResult: ComputedRef<Query['_returnType']>;
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* A `useQuery` variant whose query *reference* is reactive alongside its args.
|
|
62
|
-
* Pass `'skip'` args to pause the subscription.
|
|
63
|
-
*
|
|
64
|
-
* @internal
|
|
65
|
-
*/
|
|
66
|
-
export declare function useReactiveQuery<Query extends FunctionReference<'query'>>(query: ComputedRef<Query>, args: ComputedRef<Query['_args'] | 'skip'>): ComputedRef<Query['_returnType'] | undefined>;
|
|
@@ -69,7 +69,6 @@ export type { AuthTokenFetcher } from 'convex/browser';
|
|
|
69
69
|
export * from './auth/helpers.js';
|
|
70
70
|
export * from './auth/index.js';
|
|
71
71
|
export { usePreloadedQuery, type Preloaded } from './hydration.js';
|
|
72
|
-
export { useSubscription } from './composables/use-subscription.js';
|
|
73
72
|
export { type VueMutation } from './composables/use-mutation.js';
|
|
74
73
|
export { type VueAction } from './composables/use-action.js';
|
|
75
74
|
export { type Watch, type WatchQueryOptions, type MutationOptions, type ConvexVueClientOptions, } from './client.js';
|
|
@@ -89,6 +88,7 @@ export type { ConnectionState, OptimisticUpdate, QueryJournal, } from 'convex/br
|
|
|
89
88
|
export type { FunctionReference, FunctionArgs, FunctionReturnType, OptionalRestArgs, ArgsAndOptions, } from 'convex/server';
|
|
90
89
|
export type { Value } from 'convex/values';
|
|
91
90
|
export { useUpload, useConvexUpload, uploadFile, type VueUpload, type UseUploadOptions, type UploadFileOptions, type GenerateUploadUrl, type StorageId, } from './composables/use-upload.js';
|
|
92
|
-
export { useUploadQueue, useConvexUploadQueue, type VueUploadQueue, type UseUploadQueueOptions, type UploadQueueItem, type UploadItemStatus, } from './composables/use-upload-queue.js';
|
|
91
|
+
export { useUploadQueue, useConvexUploadQueue, type VueUploadQueue, type UseUploadQueueOptions, type UploadQueueItem, type UploadItemStatus, type EnqueueInput, } from './composables/use-upload-queue.js';
|
|
93
92
|
export { useStorageUrl, useConvexStorageUrl, type GetStorageUrl, } from './composables/use-storage-url.js';
|
|
93
|
+
export { ConvexImage } from './components/convex-image.js';
|
|
94
94
|
export { provideConvexApi, useConvexApi, useConvexNamespace, ConvexApiKey, type ConvexApi, } from './provide.js';
|
|
@@ -6,7 +6,7 @@ export default defineNuxtPlugin({
|
|
|
6
6
|
const url = useRuntimeConfig().public.convex.url;
|
|
7
7
|
if (!url) {
|
|
8
8
|
if (import.meta.client) {
|
|
9
|
-
console.warn("[nuxt-convex-module] No Convex URL configured
|
|
9
|
+
console.warn("[nuxt-convex-module] No Convex deployment URL configured \u2014 client not created. Set NUXT_PUBLIC_CONVEX_URL or `convex.url` in nuxt.config.");
|
|
10
10
|
}
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
@@ -9,8 +9,8 @@ export type ConvexApi = Record<string, Record<string, unknown>>;
|
|
|
9
9
|
export declare const ConvexApiKey: InjectionKey<ConvexApi>;
|
|
10
10
|
/**
|
|
11
11
|
* Make the generated Convex `api` available to every `nuxt-convex-module` composable
|
|
12
|
-
* and component, so
|
|
13
|
-
* with zero arguments.
|
|
12
|
+
* and component, so `<CheckoutLink>`, `<CustomerPortalLink>`, `useConvexNamespace()`,
|
|
13
|
+
* … work with zero arguments.
|
|
14
14
|
*
|
|
15
15
|
* The packaged Nuxt plugin calls this automatically with `#convex/api`. Call it
|
|
16
16
|
* yourself (e.g. with a custom `api`) only to override that default — pass the
|
|
@@ -30,9 +30,9 @@ export declare function provideConvexApi(api: ConvexApi, app?: App): void;
|
|
|
30
30
|
*/
|
|
31
31
|
export declare function useConvexApi(): ConvexApi | undefined;
|
|
32
32
|
/**
|
|
33
|
-
* The named function group from the generated `api` (e.g. `'
|
|
34
|
-
* `
|
|
35
|
-
*
|
|
33
|
+
* The named function group from the generated `api` (e.g. `'polar'`), or
|
|
34
|
+
* `undefined` when that group isn't scaffolded — letting the feature degrade
|
|
35
|
+
* to a graceful no-op rather than throwing.
|
|
36
36
|
*
|
|
37
37
|
* @typeParam T - The expected shape of the namespace's function references.
|
|
38
38
|
*/
|
package/dist/types.d.mts
ADDED