nuxt-convex-module 0.10.0 → 0.12.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.
Files changed (71) hide show
  1. package/README.md +26 -47
  2. package/dist/chunks/index.mjs +72 -18
  3. package/dist/devtools-client/_nuxt/AqohFEu1.js +1 -0
  4. package/dist/devtools-client/_nuxt/BPtiIkWa.js +3 -0
  5. package/dist/devtools-client/_nuxt/DGCFzitC.js +7 -0
  6. package/dist/devtools-client/_nuxt/entry.egvhSnkx.css +1 -0
  7. package/dist/devtools-client/index.html +1 -1
  8. package/dist/module.d.mts +18 -18
  9. package/dist/module.json +2 -2
  10. package/dist/module.mjs +101 -66
  11. package/dist/runtime/auth0/vue/index.js +1 -1
  12. package/dist/runtime/better-auth/nuxt/middleware.js +2 -13
  13. package/dist/runtime/better-auth/nuxt/proxy.d.ts +12 -12
  14. package/dist/runtime/better-auth/nuxt/proxy.js +8 -6
  15. package/dist/runtime/better-auth/nuxt/server-guard.d.ts +12 -0
  16. package/dist/runtime/better-auth/nuxt/server-guard.js +13 -0
  17. package/dist/runtime/better-auth/nuxt/server.d.ts +22 -10
  18. package/dist/runtime/better-auth/nuxt/server.js +11 -4
  19. package/dist/runtime/better-auth/vue/auth-boundary.js +2 -2
  20. package/dist/runtime/better-auth/vue/client.d.ts +5 -357
  21. package/dist/runtime/better-auth/vue/plugin.server.js +4 -5
  22. package/dist/runtime/better-auth/vue/use-better-auth.d.ts +4 -65
  23. package/dist/runtime/clerk/vue/index.js +1 -1
  24. package/dist/runtime/nuxt/app.d.ts +0 -3
  25. package/dist/runtime/nuxt/composables/use-async-paginated-query.js +12 -12
  26. package/dist/runtime/nuxt/composables/use-async-query.d.ts +2 -2
  27. package/dist/runtime/nuxt/config.js +1 -1
  28. package/dist/runtime/nuxt/index.d.ts +6 -6
  29. package/dist/runtime/nuxt/security.d.ts +2 -1
  30. package/dist/runtime/nuxt/security.js +2 -2
  31. package/dist/runtime/polar/vue/components.d.ts +14 -16
  32. package/dist/runtime/polar/vue/components.js +10 -15
  33. package/dist/runtime/vue/auth/helpers.js +4 -4
  34. package/dist/runtime/vue/client.d.ts +6 -6
  35. package/dist/runtime/vue/components/convex-image.js +1 -1
  36. package/dist/runtime/vue/composables/use-action.d.ts +3 -3
  37. package/dist/runtime/vue/composables/use-mutation.d.ts +4 -4
  38. package/dist/runtime/vue/composables/use-queries.d.ts +14 -7
  39. package/dist/runtime/vue/composables/use-query.d.ts +5 -5
  40. package/dist/runtime/vue/hydration.d.ts +3 -3
  41. package/dist/runtime/vue/index.d.ts +1 -2
  42. package/dist/runtime/vue/index.js +0 -6
  43. package/dist/runtime/vue/queries-observer.d.ts +9 -9
  44. package/package.json +43 -41
  45. package/dist/devtools-client/200.html +0 -1
  46. package/dist/devtools-client/404.html +0 -1
  47. package/dist/devtools-client/_nuxt/71bSMC-_.js +0 -2
  48. package/dist/devtools-client/_nuxt/BAaUCl_m.js +0 -1
  49. package/dist/devtools-client/_nuxt/BhmjAr2Q.js +0 -1
  50. package/dist/devtools-client/_nuxt/BmBQNDID.js +0 -1
  51. package/dist/devtools-client/_nuxt/C6YdTgGl.js +0 -2
  52. package/dist/devtools-client/_nuxt/CKakiU_h.js +0 -1
  53. package/dist/devtools-client/_nuxt/Cm7YqZQ-.js +0 -1
  54. package/dist/devtools-client/_nuxt/DQmVr-EY.js +0 -1
  55. package/dist/devtools-client/_nuxt/D_Rij7MD.js +0 -1
  56. package/dist/devtools-client/_nuxt/EZ4-8Xzm.js +0 -3
  57. package/dist/devtools-client/_nuxt/Kba0XpjH.js +0 -1
  58. package/dist/devtools-client/_nuxt/OVE7s6ty.js +0 -1
  59. package/dist/devtools-client/_nuxt/_Lf3mfPR.js +0 -1
  60. package/dist/devtools-client/_nuxt/builds/latest.json +0 -1
  61. package/dist/devtools-client/_nuxt/builds/meta/1734dcfa-caf6-447b-a68b-4dd3cf138875.json +0 -1
  62. package/dist/devtools-client/_nuxt/entry.HF8C6P11.css +0 -1
  63. package/dist/devtools-client/_nuxt/error-404.CLlwiMp-.css +0 -1
  64. package/dist/devtools-client/_nuxt/error-500.Bxr6fpDU.css +0 -1
  65. package/dist/devtools-client/_nuxt/queries.DNBUjWk2.css +0 -1
  66. package/dist/devtools-client/_nuxt/vZZlEX5A.js +0 -1
  67. package/dist/devtools-client/auth/index.html +0 -1
  68. package/dist/devtools-client/logs/index.html +0 -1
  69. package/dist/devtools-client/queries/index.html +0 -1
  70. package/dist/runtime/vue/provide.d.ts +0 -39
  71. package/dist/runtime/vue/provide.js +0 -15
@@ -2,7 +2,7 @@ import { defineComponent, h, onErrorCaptured, ref, watch } from "vue";
2
2
  import { useConvexAuth } from "../../vue/auth/index.js";
3
3
  import { Authenticated } from "../../vue/auth/helpers.js";
4
4
  import { useQuery } from "../../vue/composables/use-query.js";
5
- const UserSubscription = defineComponent({
5
+ const UserSubscription = /* @__PURE__ */ defineComponent({
6
6
  name: "UserSubscription",
7
7
  props: {
8
8
  getAuthUserFn: { type: Object, required: true }
@@ -15,7 +15,7 @@ const UserSubscription = defineComponent({
15
15
  };
16
16
  }
17
17
  });
18
- export const AuthBoundary = defineComponent({
18
+ export const AuthBoundary = /* @__PURE__ */ defineComponent({
19
19
  name: "AuthBoundary",
20
20
  props: {
21
21
  /**
@@ -1,358 +1,6 @@
1
- export declare const authClient: import("better-auth/vue").VueAuthClient<{
2
- plugins: {
3
- id: "convex";
4
- version: string;
5
- $InferServerPlugin: ReturnType<(opts: {
6
- authConfig: import("convex/server").AuthConfig;
7
- jwt?: {
8
- expirationSeconds?: number;
9
- definePayload?: (session: {
10
- user: import("better-auth").User & Record<string, any>;
11
- session: import("better-auth").Session & Record<string, any>;
12
- }) => Promise<Record<string, any>> | Record<string, any> | undefined;
13
- };
14
- jwtExpirationSeconds?: number;
15
- jwks?: string;
16
- jwksRotateOnTokenGenerationError?: boolean;
17
- options?: import("better-auth").BetterAuthOptions;
18
- }) => {
19
- id: "convex";
20
- version: string;
21
- init: (ctx: import("better-auth").AuthContext) => void;
22
- hooks: {
23
- before: ({
24
- matcher(context: import("better-auth").HookEndpointContext): boolean;
25
- handler: (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
26
- context: {
27
- headers: Headers;
28
- };
29
- } | undefined>;
30
- } | {
31
- matcher: (ctx: import("better-auth").HookEndpointContext) => boolean;
32
- handler: (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
33
- context: import("better-auth").MiddlewareContext<import("better-auth").MiddlewareOptions, {
34
- returned?: unknown | undefined;
35
- responseHeaders?: Headers | undefined;
36
- } & import("better-auth").PluginContext<import("better-auth").BetterAuthOptions> & import("better-auth").InfoContext & {
37
- options: import("better-auth").BetterAuthOptions;
38
- trustedOrigins: string[];
39
- trustedProviders: string[];
40
- isTrustedOrigin: (url: string, settings?: {
41
- allowRelativePaths: boolean;
42
- }) => boolean;
43
- oauthConfig: {
44
- skipStateCookieCheck?: boolean | undefined;
45
- storeStateStrategy: "database" | "cookie";
46
- };
47
- newSession: {
48
- session: {
49
- id: string;
50
- createdAt: Date;
51
- updatedAt: Date;
52
- userId: string;
53
- expiresAt: Date;
54
- token: string;
55
- ipAddress?: string | null | undefined;
56
- userAgent?: string | null | undefined;
57
- } & Record<string, any>;
58
- user: {
59
- id: string;
60
- createdAt: Date;
61
- updatedAt: Date;
62
- email: string;
63
- emailVerified: boolean;
64
- name: string;
65
- image?: string | null | undefined;
66
- } & Record<string, any>;
67
- } | null;
68
- session: {
69
- session: {
70
- id: string;
71
- createdAt: Date;
72
- updatedAt: Date;
73
- userId: string;
74
- expiresAt: Date;
75
- token: string;
76
- ipAddress?: string | null | undefined;
77
- userAgent?: string | null | undefined;
78
- } & Record<string, any>;
79
- user: {
80
- id: string;
81
- createdAt: Date;
82
- updatedAt: Date;
83
- email: string;
84
- emailVerified: boolean;
85
- name: string;
86
- image?: string | null | undefined;
87
- } & Record<string, any>;
88
- } | null;
89
- setNewSession: (session: {
90
- session: {
91
- id: string;
92
- createdAt: Date;
93
- updatedAt: Date;
94
- userId: string;
95
- expiresAt: Date;
96
- token: string;
97
- ipAddress?: string | null | undefined;
98
- userAgent?: string | null | undefined;
99
- } & Record<string, any>;
100
- user: {
101
- id: string;
102
- createdAt: Date;
103
- updatedAt: Date;
104
- email: string;
105
- emailVerified: boolean;
106
- name: string;
107
- image?: string | null | undefined;
108
- } & Record<string, any>;
109
- } | null) => void;
110
- socialProviders: import("better-auth").OAuthProvider[];
111
- authCookies: import("better-auth").BetterAuthCookies;
112
- logger: ReturnType<(options?: import("better-auth").Logger | undefined) => import("better-auth").InternalLogger>;
113
- rateLimit: {
114
- enabled: boolean;
115
- window: number;
116
- max: number;
117
- storage: "memory" | "database" | "secondary-storage";
118
- } & Omit<import("better-auth").BetterAuthRateLimitOptions, "enabled" | "window" | "max" | "storage">;
119
- adapter: import("better-auth").DBAdapter<import("better-auth").BetterAuthOptions>;
120
- internalAdapter: import("better-auth").InternalAdapter<import("better-auth").BetterAuthOptions>;
121
- createAuthCookie: (cookieName: string, overrideAttributes?: Partial<import("better-auth").CookieOptions> | undefined) => import("better-auth").BetterAuthCookie;
122
- secret: string;
123
- secretConfig: string | import("better-auth").SecretConfig;
124
- sessionConfig: {
125
- updateAge: number;
126
- expiresIn: number;
127
- freshAge: number;
128
- cookieRefreshCache: false | {
129
- enabled: true;
130
- updateAge: number;
131
- };
132
- };
133
- generateId: (options: {
134
- model: import("better-auth").ModelNames;
135
- size?: number | undefined;
136
- }) => string | false;
137
- secondaryStorage: import("better-auth").SecondaryStorage | undefined;
138
- password: {
139
- hash: (password: string) => Promise<string>;
140
- verify: (data: {
141
- password: string;
142
- hash: string;
143
- }) => Promise<boolean>;
144
- config: {
145
- minPasswordLength: number;
146
- maxPasswordLength: number;
147
- };
148
- checkPassword: (userId: string, ctx: import("better-auth").GenericEndpointContext<import("better-auth").BetterAuthOptions>) => Promise<boolean>;
149
- };
150
- tables: import("better-auth").BetterAuthDBSchema;
151
- runMigrations: () => Promise<void>;
152
- publishTelemetry: (event: {
153
- type: string;
154
- anonymousId?: string | undefined;
155
- payload: Record<string, any>;
156
- }) => Promise<void>;
157
- skipOriginCheck: boolean | string[];
158
- skipCSRFCheck: boolean;
159
- runInBackground: (promise: Promise<unknown>) => void;
160
- runInBackgroundOrAwait: (promise: Promise<unknown> | void) => import("better-auth").Awaitable<unknown>;
161
- }>;
162
- }>;
163
- })[];
164
- after: {
165
- matcher: (context: import("better-auth").HookEndpointContext) => boolean;
166
- handler: import("better-auth/api").AuthMiddleware;
167
- }[];
168
- };
169
- endpoints: {
170
- getOpenIdConfig: import("better-auth").StrictEndpoint<"/convex/.well-known/openid-configuration", {
171
- method: "GET";
172
- metadata: {
173
- isAction: false;
174
- };
175
- }, import("better-auth/plugins/oidc-provider").OIDCMetadata>;
176
- getJwks: import("better-auth").StrictEndpoint<"/convex/jwks", {
177
- method: "GET";
178
- metadata: {
179
- openapi: {
180
- description: string;
181
- responses: {
182
- "200": {
183
- description: string;
184
- content: {
185
- "application/json": {
186
- schema: {
187
- type: "object";
188
- properties: {
189
- keys: {
190
- type: string;
191
- description: string;
192
- items: {
193
- type: string;
194
- properties: {
195
- kid: {
196
- type: string;
197
- description: string;
198
- };
199
- kty: {
200
- type: string;
201
- description: string;
202
- };
203
- alg: {
204
- type: string;
205
- description: string;
206
- };
207
- use: {
208
- type: string;
209
- description: string;
210
- enum: string[];
211
- nullable: boolean;
212
- };
213
- n: {
214
- type: string;
215
- description: string;
216
- nullable: boolean;
217
- };
218
- e: {
219
- type: string;
220
- description: string;
221
- nullable: boolean;
222
- };
223
- crv: {
224
- type: string;
225
- description: string;
226
- nullable: boolean;
227
- };
228
- x: {
229
- type: string;
230
- description: string;
231
- nullable: boolean;
232
- };
233
- y: {
234
- type: string;
235
- description: string;
236
- nullable: boolean;
237
- };
238
- };
239
- required: string[];
240
- };
241
- };
242
- };
243
- required: string[];
244
- };
245
- };
246
- };
247
- };
248
- };
249
- };
250
- };
251
- }, import("better-auth").JSONWebKeySet>;
252
- getLatestJwks: import("better-auth").StrictEndpoint<"/convex/latest-jwks", {
253
- isAction: boolean;
254
- method: "POST";
255
- metadata: {
256
- SERVER_ONLY: true;
257
- openapi: {
258
- description: string;
259
- };
260
- };
261
- }, any[]>;
262
- rotateKeys: import("better-auth").StrictEndpoint<"/convex/rotate-keys", {
263
- isAction: boolean;
264
- method: "POST";
265
- metadata: {
266
- SERVER_ONLY: true;
267
- openapi: {
268
- description: string;
269
- };
270
- };
271
- }, any[]>;
272
- getToken: import("better-auth").StrictEndpoint<"/convex/token", {
273
- method: "GET";
274
- requireHeaders: true;
275
- use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
276
- session: {
277
- session: Record<string, any> & {
278
- id: string;
279
- createdAt: Date;
280
- updatedAt: Date;
281
- userId: string;
282
- expiresAt: Date;
283
- token: string;
284
- ipAddress?: string | null | undefined;
285
- userAgent?: string | null | undefined;
286
- };
287
- user: Record<string, any> & {
288
- id: string;
289
- createdAt: Date;
290
- updatedAt: Date;
291
- email: string;
292
- emailVerified: boolean;
293
- name: string;
294
- image?: string | null | undefined;
295
- };
296
- };
297
- }>)[];
298
- metadata: {
299
- openapi: {
300
- description: string;
301
- responses: {
302
- 200: {
303
- description: string;
304
- content: {
305
- "application/json": {
306
- schema: {
307
- type: "object";
308
- properties: {
309
- token: {
310
- type: string;
311
- };
312
- };
313
- };
314
- };
315
- };
316
- };
317
- };
318
- };
319
- };
320
- }, {
321
- token: string;
322
- }>;
323
- };
324
- schema: {
325
- jwks: {
326
- fields: {
327
- publicKey: {
328
- type: "string";
329
- required: true;
330
- };
331
- privateKey: {
332
- type: "string";
333
- required: true;
334
- };
335
- createdAt: {
336
- type: "date";
337
- required: true;
338
- };
339
- expiresAt: {
340
- type: "date";
341
- required: false;
342
- };
343
- };
344
- };
345
- user: {
346
- readonly fields: {
347
- readonly userId: {
348
- readonly type: "string";
349
- readonly required: false;
350
- readonly input: false;
351
- };
352
- };
353
- };
354
- };
355
- }>;
356
- }[];
357
- }>;
1
+ import { convexClient } from '@convex-dev/better-auth/client/plugins';
2
+ import { createAuthClient } from 'better-auth/vue';
3
+ export declare const authClient: ReturnType<typeof createAuthClient<{
4
+ plugins: ReturnType<typeof convexClient>[];
5
+ }>>;
358
6
  export type AuthClient = typeof authClient;
@@ -1,16 +1,15 @@
1
1
  import { computed } from "vue";
2
- import { setResponseHeader } from "h3";
3
- import { defineNuxtPlugin, useRuntimeConfig, useState, useRequestEvent } from "#app";
2
+ import { defineNuxtPlugin, useRuntimeConfig, useState, useRequestEvent, useResponseHeader } from "#app";
4
3
  import { ConvexVueClient, ConvexClientKey } from "../../vue/client.js";
5
4
  import { CONVEX_INITIAL_TOKEN_KEY } from "../../nuxt/config.js";
6
5
  import { convexAuth } from "../nuxt/server.js";
7
6
  import { ConvexAuthStateKey } from "../../vue/auth/index.js";
8
- export async function prefetchAuthToken(event, initialToken) {
7
+ export async function prefetchAuthToken(event, initialToken, cacheControl) {
9
8
  try {
10
9
  const token = await convexAuth(event).getToken();
11
10
  initialToken.value = token ?? null;
12
11
  if (token && event) {
13
- setResponseHeader(event, "Cache-Control", "private, no-store");
12
+ cacheControl.value = "private, no-store";
14
13
  }
15
14
  } catch (error) {
16
15
  console.warn("[nuxt-convex-module] Failed to prefetch auth token for SSR:", error);
@@ -33,7 +32,7 @@ export default defineNuxtPlugin({
33
32
  nuxtApp.vueApp.provide(ConvexAuthStateKey, ssrAuthState);
34
33
  const event = useRequestEvent();
35
34
  if (event && !import.meta.prerender) {
36
- await prefetchAuthToken(event, initialToken);
35
+ await prefetchAuthToken(event, initialToken, useResponseHeader("Cache-Control"));
37
36
  }
38
37
  }
39
38
  });
@@ -1,70 +1,10 @@
1
1
  import type { AuthTokenFetcher } from 'convex/browser';
2
2
  import { type ComputedRef } from 'vue';
3
3
  import { type AuthClient } from '#convex/auth-client';
4
- declare const useClientSession: () => Readonly<import("vue").Ref<{
5
- readonly data: {
6
- readonly user: {
7
- readonly id: string;
8
- readonly createdAt: Date;
9
- readonly updatedAt: Date;
10
- readonly email: string;
11
- readonly emailVerified: boolean;
12
- readonly name: string;
13
- readonly image?: string | null | undefined;
14
- readonly userId?: string | null | undefined;
15
- };
16
- readonly session: {
17
- readonly id: string;
18
- readonly createdAt: Date;
19
- readonly updatedAt: Date;
20
- readonly userId: string;
21
- readonly expiresAt: Date;
22
- readonly token: string;
23
- readonly ipAddress?: string | null | undefined;
24
- readonly userAgent?: string | null | undefined;
25
- };
26
- } | null;
27
- readonly isPending: boolean;
28
- readonly isRefetching: boolean;
29
- readonly error: import("better-auth/client").BetterFetchError | null;
30
- readonly refetch: (queryParams
31
- /** The Better Auth client from `#convex/auth-client` — sign-in, sign-out and every plugin flow live here. */
32
- ?: {
33
- query?: import("better-auth").SessionQueryParams;
34
- } | undefined) => Promise<void>;
35
- }, {
36
- readonly data: {
37
- readonly user: {
38
- readonly id: string;
39
- readonly createdAt: Date;
40
- readonly updatedAt: Date;
41
- readonly email: string;
42
- readonly emailVerified: boolean;
43
- readonly name: string;
44
- readonly image?: string | null | undefined;
45
- readonly userId?: string | null | undefined;
46
- };
47
- readonly session: {
48
- readonly id: string;
49
- readonly createdAt: Date;
50
- readonly updatedAt: Date;
51
- readonly userId: string;
52
- readonly expiresAt: Date;
53
- readonly token: string;
54
- readonly ipAddress?: string | null | undefined;
55
- readonly userAgent?: string | null | undefined;
56
- };
57
- } | null;
58
- readonly isPending: boolean;
59
- readonly isRefetching: boolean;
60
- readonly error: import("better-auth/client").BetterFetchError | null;
61
- readonly refetch: (queryParams
62
- /** The Better Auth client from `#convex/auth-client` — sign-in, sign-out and every plugin flow live here. */
63
- ?: {
64
- query?: import("better-auth").SessionQueryParams;
65
- } | undefined) => Promise<void>;
66
- }>>;
67
- export type BetterAuthSession = ReturnType<typeof useClientSession>;
4
+ export type BetterAuthSession = AuthClient['useSession'] extends {
5
+ (): infer R;
6
+ (useFetch: any): any;
7
+ } ? R : never;
68
8
  /** The signed-in user (loose — exact fields depend on your auth schema). */
69
9
  export type BetterAuthUser = {
70
10
  id: string;
@@ -109,4 +49,3 @@ export interface UseBetterAuthReturn {
109
49
  * @public
110
50
  */
111
51
  export declare function useBetterAuth(initialToken?: string | null): UseBetterAuthReturn;
112
- export {};
@@ -7,7 +7,7 @@ export function provideConvexAuthFromClerk(options = {}) {
7
7
  const useAuth = options.useAuth ?? useClerkAuth;
8
8
  return provideConvexAuth({ client, useAuth: () => useAuthFromClerk(useAuth) });
9
9
  }
10
- export const ConvexProviderWithClerk = defineComponent({
10
+ export const ConvexProviderWithClerk = /* @__PURE__ */ defineComponent({
11
11
  name: "ConvexProviderWithClerk",
12
12
  props: {
13
13
  client: { type: Object, default: void 0 },
@@ -39,9 +39,6 @@
39
39
  * const messages: AsyncQueryReturn<Doc<'messages'>[]> = useAsyncQuery(api.messages.list, {})
40
40
  * ```
41
41
  *
42
- * Before 1.0 the composable was auto-imported but reachable from no subpath,
43
- * so neither the explicit form nor the types could be written at all.
44
- *
45
42
  * @module app
46
43
  */
47
44
  export { useAsyncQuery, useConvexAsyncQuery, type AsyncQueryData, type AsyncQueryOptions, type AsyncQueryReturn, type AsyncQueryStatus, } from './composables/use-async-query.js';
@@ -17,20 +17,20 @@ export function useAsyncPaginatedQuery(query, args, options) {
17
17
  key,
18
18
  async () => {
19
19
  const currentArgs = toValue(args);
20
- if (currentArgs === "skip" || !import.meta.server) {
21
- return null;
22
- }
23
- if (!deploymentUrl) {
24
- throw new Error(
25
- "`useAsyncPaginatedQuery` could not fetch during SSR: no Convex deployment URL is configured. Set NUXT_PUBLIC_CONVEX_URL or `convex.url` in nuxt.config."
20
+ if (import.meta.server && currentArgs !== "skip") {
21
+ if (!deploymentUrl) {
22
+ throw new Error(
23
+ "`useAsyncPaginatedQuery` could not fetch during SSR: no Convex deployment URL is configured. Set NUXT_PUBLIC_CONVEX_URL or `convex.url` in nuxt.config."
24
+ );
25
+ }
26
+ const result2 = await fetchQuery(
27
+ query,
28
+ { ...currentArgs, paginationOpts: { numItems: initialNumItems, cursor: null } },
29
+ { token: await resolveToken(), url: deploymentUrl }
26
30
  );
31
+ return { page: convexToJson(result2.page), isDone: result2.isDone };
27
32
  }
28
- const result2 = await fetchQuery(
29
- query,
30
- { ...currentArgs, paginationOpts: { numItems: initialNumItems, cursor: null } },
31
- { token: await resolveToken(), url: deploymentUrl }
32
- );
33
- return { page: convexToJson(result2.page), isDone: result2.isDone };
33
+ return null;
34
34
  },
35
35
  { server, lazy, deep: false, immediate: initialArgs !== "skip" }
36
36
  );
@@ -1,5 +1,5 @@
1
1
  import { type ComputedRef, type MaybeRefOrGetter } from 'vue';
2
- import type { FunctionArgs, FunctionReference, FunctionReturnType } from 'convex/server';
2
+ import type { FunctionArgs, FunctionReference, FunctionReference_future, FunctionReturnType } from 'convex/server';
3
3
  /**
4
4
  * Request status of a {@link useAsyncQuery} call — mirrors Nuxt's
5
5
  * `useAsyncData` statuses.
@@ -130,6 +130,6 @@ export type AsyncQueryData<T> = Pick<AsyncQueryReturn<T>, 'data' | 'error' | 'st
130
130
  *
131
131
  * @public
132
132
  */
133
- export declare function useAsyncQuery<Query extends FunctionReference<'query'>>(query: Query, args?: MaybeRefOrGetter<FunctionArgs<Query> | 'skip'>, options?: AsyncQueryOptions): AsyncQueryReturn<FunctionReturnType<Query>>;
133
+ export declare function useAsyncQuery<Query extends FunctionReference<'query'> | FunctionReference_future<'query'>>(query: Query, args?: MaybeRefOrGetter<FunctionArgs<Query> | 'skip'>, options?: AsyncQueryOptions): AsyncQueryReturn<FunctionReturnType<Query>>;
134
134
  /** @public */
135
135
  export declare const useConvexAsyncQuery: typeof useAsyncQuery;
@@ -5,7 +5,7 @@ export function getConvexRuntimeConfig() {
5
5
  const config = useRuntimeConfig();
6
6
  return {
7
7
  url: config.public?.convex?.url,
8
- siteUrl: config.convex?.siteUrl || config.public?.convex?.siteUrl
8
+ siteUrl: config.public?.convex?.siteUrl
9
9
  };
10
10
  } catch {
11
11
  return {};
@@ -40,7 +40,7 @@
40
40
  *
41
41
  * @module server
42
42
  */
43
- import type { ArgsAndOptions, FunctionReference, FunctionReturnType } from 'convex/server';
43
+ import type { ArgsAndOptions, FunctionReference, FunctionReference_future, FunctionReturnType } from 'convex/server';
44
44
  import type { Preloaded } from '../vue/index.js';
45
45
  /**
46
46
  * Options to {@link preloadQuery}, {@link fetchQuery}, {@link fetchMutation} and {@link fetchAction}.
@@ -85,7 +85,7 @@ export type NuxtOptions = {
85
85
  *
86
86
  * @public
87
87
  */
88
- export declare function preloadQuery<Query extends FunctionReference<'query'>>(query: Query, ...args: ArgsAndOptions<Query, NuxtOptions>): Promise<Preloaded<Query>>;
88
+ export declare function preloadQuery<Query extends FunctionReference<'query'> | FunctionReference_future<'query'>>(query: Query, ...args: ArgsAndOptions<Query, NuxtOptions>): Promise<Preloaded<Query>>;
89
89
  /**
90
90
  * Returns the result of executing a query via {@link preloadQuery}.
91
91
  *
@@ -94,7 +94,7 @@ export declare function preloadQuery<Query extends FunctionReference<'query'>>(q
94
94
  *
95
95
  * @public
96
96
  */
97
- export declare function preloadedQueryResult<Query extends FunctionReference<'query'>>(preloaded: Preloaded<Query>): FunctionReturnType<Query>;
97
+ export declare function preloadedQueryResult<Query extends FunctionReference<'query'> | FunctionReference_future<'query'>>(preloaded: Preloaded<Query>): FunctionReturnType<Query>;
98
98
  /**
99
99
  * Execute a Convex query function.
100
100
  *
@@ -107,7 +107,7 @@ export declare function preloadedQueryResult<Query extends FunctionReference<'qu
107
107
  *
108
108
  * @public
109
109
  */
110
- export declare function fetchQuery<Query extends FunctionReference<'query'>>(query: Query, ...args: ArgsAndOptions<Query, NuxtOptions>): Promise<FunctionReturnType<Query>>;
110
+ export declare function fetchQuery<Query extends FunctionReference<'query'> | FunctionReference_future<'query'>>(query: Query, ...args: ArgsAndOptions<Query, NuxtOptions>): Promise<FunctionReturnType<Query>>;
111
111
  /**
112
112
  * Execute a Convex mutation function.
113
113
  *
@@ -120,7 +120,7 @@ export declare function fetchQuery<Query extends FunctionReference<'query'>>(que
120
120
  *
121
121
  * @public
122
122
  */
123
- export declare function fetchMutation<Mutation extends FunctionReference<'mutation'>>(mutation: Mutation, ...args: ArgsAndOptions<Mutation, NuxtOptions>): Promise<FunctionReturnType<Mutation>>;
123
+ export declare function fetchMutation<Mutation extends FunctionReference<'mutation'> | FunctionReference_future<'mutation'>>(mutation: Mutation, ...args: ArgsAndOptions<Mutation, NuxtOptions>): Promise<FunctionReturnType<Mutation>>;
124
124
  /**
125
125
  * Execute a Convex action function.
126
126
  *
@@ -133,4 +133,4 @@ export declare function fetchMutation<Mutation extends FunctionReference<'mutati
133
133
  *
134
134
  * @public
135
135
  */
136
- export declare function fetchAction<Action extends FunctionReference<'action'>>(action: Action, ...args: ArgsAndOptions<Action, NuxtOptions>): Promise<FunctionReturnType<Action>>;
136
+ export declare function fetchAction<Action extends FunctionReference<'action'> | FunctionReference_future<'action'>>(action: Action, ...args: ArgsAndOptions<Action, NuxtOptions>): Promise<FunctionReturnType<Action>>;
@@ -21,7 +21,8 @@ export interface SecurityNitroApp {
21
21
  * origins are appended to whatever the app configured, whatever the order of
22
22
  * `modules`. nuxt-security sorts its own Nitro plugins last, so this listener
23
23
  * is in place before the hook fires. The deployment URL comes from runtime
24
- * config, so it need not be known at build time.
24
+ * config, so it need not be known at build time. `nuxt/server` is its only
25
+ * server import, so the same file runs on Nitro 2 and Nitro 3.
25
26
  *
26
27
  * `connect-src` is tightened only in production: creating it in dev would
27
28
  * block the Vite HMR and devtools WebSockets, which run on ports `'self'`
@@ -1,10 +1,10 @@
1
- import { getConvexRuntimeConfig } from "./config.js";
1
+ import { useRuntimeConfig } from "nuxt/server";
2
2
  import { applyConvexSecurityDefaults, convexConnectSrc, convexResourceSrc } from "./csp.js";
3
3
  export default function convexSecurityPlugin(nitroApp) {
4
4
  nitroApp.hooks.hook("nuxt-security:routeRules", (rules) => {
5
5
  const global = rules["/**"];
6
6
  if (!global) return;
7
- const { url, siteUrl } = getConvexRuntimeConfig();
7
+ const { url, siteUrl } = useRuntimeConfig().public?.convex ?? {};
8
8
  applyConvexSecurityDefaults(
9
9
  global,
10
10
  import.meta.dev ? [] : convexConnectSrc(url, siteUrl),