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
@@ -32,16 +32,16 @@ export type CheckoutArgs = {
32
32
  /**
33
33
  * The subset of the Polar component's action references these components need —
34
34
  * a Vue port mirror of `@convex-dev/polar`'s `PolarComponentApi`
35
- * (`Pick<…, 'generateCheckoutLink' | 'generateCustomerPortalUrl'>`). Supplied
36
- * via the auto-provided `api.billing` namespace, or passed through `:polar-api`.
35
+ * (`Pick<…, 'generateCheckoutLink' | 'generateCustomerPortalUrl'>`), passed
36
+ * through `:polar-api` — usually the app's `api.billing`.
37
37
  *
38
38
  * @public
39
39
  */
40
40
  export interface PolarComponentApi {
41
- generateCheckoutLink?: FunctionReference<'action', 'public', CheckoutArgs, {
41
+ generateCheckoutLink: FunctionReference<'action', 'public', CheckoutArgs, {
42
42
  url: string;
43
43
  }>;
44
- generateCustomerPortalUrl?: FunctionReference<'action', 'public', {
44
+ generateCustomerPortalUrl: FunctionReference<'action', 'public', {
45
45
  returnUrl?: string;
46
46
  }, {
47
47
  url: string;
@@ -53,15 +53,15 @@ export interface PolarComponentApi {
53
53
  *
54
54
  * @example
55
55
  * ```vue
56
- * <CustomerPortalLink>Manage subscription</CustomerPortalLink>
56
+ * <CustomerPortalLink :polar-api="api.billing">Manage subscription</CustomerPortalLink>
57
57
  * ```
58
58
  *
59
59
  * @public
60
60
  */
61
61
  export declare const CustomerPortalLink: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
62
62
  polarApi: {
63
- type: PropType<PolarComponentApi>;
64
- default: undefined;
63
+ type: PropType<Pick<PolarComponentApi, "generateCustomerPortalUrl">>;
64
+ required: true;
65
65
  };
66
66
  returnUrl: {
67
67
  type: StringConstructor;
@@ -71,8 +71,8 @@ export declare const CustomerPortalLink: import("vue").DefineComponent<import("v
71
71
  [key: string]: any;
72
72
  }> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
73
73
  polarApi: {
74
- type: PropType<PolarComponentApi>;
75
- default: undefined;
74
+ type: PropType<Pick<PolarComponentApi, "generateCustomerPortalUrl">>;
75
+ required: true;
76
76
  };
77
77
  returnUrl: {
78
78
  type: StringConstructor;
@@ -80,14 +80,13 @@ export declare const CustomerPortalLink: import("vue").DefineComponent<import("v
80
80
  };
81
81
  }>> & Readonly<{}>, {
82
82
  returnUrl: string;
83
- polarApi: PolarComponentApi;
84
83
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
85
84
  /**
86
85
  * Renders a checkout link. Supports embedded or redirect checkout, with optional lazy loading and trial configuration.
87
86
  *
88
87
  * @example
89
88
  * ```vue
90
- * <CheckoutLink :product-ids="[productId]" :trial-interval-count="7" trial-interval="day">
89
+ * <CheckoutLink :polar-api="api.billing" :product-ids="[productId]" :trial-interval-count="7" trial-interval="day">
91
90
  * Start free trial
92
91
  * </CheckoutLink>
93
92
  * ```
@@ -96,8 +95,8 @@ export declare const CustomerPortalLink: import("vue").DefineComponent<import("v
96
95
  */
97
96
  export declare const CheckoutLink: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
98
97
  polarApi: {
99
- type: PropType<PolarComponentApi>;
100
- default: undefined;
98
+ type: PropType<Pick<PolarComponentApi, "generateCheckoutLink">>;
99
+ required: true;
101
100
  };
102
101
  productIds: {
103
102
  type: PropType<string[]>;
@@ -139,8 +138,8 @@ export declare const CheckoutLink: import("vue").DefineComponent<import("vue").E
139
138
  [key: string]: any;
140
139
  }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
141
140
  polarApi: {
142
- type: PropType<PolarComponentApi>;
143
- default: undefined;
141
+ type: PropType<Pick<PolarComponentApi, "generateCheckoutLink">>;
142
+ required: true;
144
143
  };
145
144
  productIds: {
146
145
  type: PropType<string[]>;
@@ -186,6 +185,5 @@ export declare const CheckoutLink: import("vue").DefineComponent<import("vue").E
186
185
  trialInterval: "day" | "week" | "month" | "year" | null;
187
186
  trialIntervalCount: number | null;
188
187
  locale: string;
189
- polarApi: PolarComponentApi;
190
188
  theme: "dark" | "light";
191
189
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -1,19 +1,16 @@
1
1
  import { defineComponent, h, mergeProps, ref, watch } from "vue";
2
2
  import { useAction } from "../../vue/composables/use-action.js";
3
- import { useConvexNamespace } from "../../vue/provide.js";
4
- export const CustomerPortalLink = defineComponent({
3
+ export const CustomerPortalLink = /* @__PURE__ */ defineComponent({
5
4
  name: "CustomerPortalLink",
6
5
  inheritAttrs: false,
7
6
  props: {
8
- // Optional in the port: defaults to the auto-provided `api.billing` namespace.
9
- polarApi: { type: Object, default: void 0 },
7
+ polarApi: { type: Object, required: true },
10
8
  returnUrl: { type: String, default: void 0 }
11
9
  },
12
10
  setup(props, { slots, attrs }) {
13
- const polarApi = props.polarApi ?? useConvexNamespace("billing");
14
- const generateCustomerPortalUrl = polarApi?.generateCustomerPortalUrl ? useAction(polarApi.generateCustomerPortalUrl) : void 0;
11
+ const generateCustomerPortalUrl = useAction(props.polarApi.generateCustomerPortalUrl);
15
12
  const portalUrl = ref();
16
- if (!import.meta.server && generateCustomerPortalUrl) {
13
+ if (!import.meta.server) {
17
14
  watch(
18
15
  () => props.returnUrl,
19
16
  (returnUrl) => {
@@ -34,12 +31,11 @@ export const CustomerPortalLink = defineComponent({
34
31
  };
35
32
  }
36
33
  });
37
- export const CheckoutLink = defineComponent({
34
+ export const CheckoutLink = /* @__PURE__ */ defineComponent({
38
35
  name: "CheckoutLink",
39
36
  inheritAttrs: false,
40
37
  props: {
41
- // Optional in the port: defaults to the auto-provided `api.billing` namespace.
42
- polarApi: { type: Object, default: void 0 },
38
+ polarApi: { type: Object, required: true },
43
39
  productIds: { type: Array, required: true },
44
40
  subscriptionId: { type: String, default: void 0 },
45
41
  metadata: { type: Object, default: void 0 },
@@ -51,11 +47,10 @@ export const CheckoutLink = defineComponent({
51
47
  lazy: { type: Boolean, default: false }
52
48
  },
53
49
  setup(props, { slots, attrs }) {
54
- const polarApi = props.polarApi ?? useConvexNamespace("billing");
55
- const generateCheckoutLink = polarApi?.generateCheckoutLink ? useAction(polarApi.generateCheckoutLink) : void 0;
50
+ const generateCheckoutLink = useAction(props.polarApi.generateCheckoutLink);
56
51
  const checkoutLink = ref();
57
52
  const isLoading = ref(false);
58
- if (!import.meta.server && generateCheckoutLink) {
53
+ if (!import.meta.server) {
59
54
  watch(
60
55
  () => [props.lazy, props.productIds, props.subscriptionId, props.metadata, props.embed, props.trialInterval, props.trialIntervalCount, props.locale],
61
56
  async () => {
@@ -80,7 +75,7 @@ export const CheckoutLink = defineComponent({
80
75
  { immediate: true }
81
76
  );
82
77
  }
83
- const handleClick = generateCheckoutLink ? async (e) => {
78
+ const handleClick = async (e) => {
84
79
  e.preventDefault();
85
80
  if (isLoading.value) return;
86
81
  isLoading.value = true;
@@ -104,7 +99,7 @@ export const CheckoutLink = defineComponent({
104
99
  } finally {
105
100
  isLoading.value = false;
106
101
  }
107
- } : void 0;
102
+ };
108
103
  return () => h("a", mergeProps(attrs, {
109
104
  "href": checkoutLink.value ?? (props.lazy ? "#" : void 0),
110
105
  "onClick": props.lazy ? handleClick : void 0,
@@ -1,6 +1,6 @@
1
1
  import { defineComponent } from "vue";
2
2
  import { useConvexAuth } from "./index.js";
3
- export const Authenticated = defineComponent({
3
+ export const Authenticated = /* @__PURE__ */ defineComponent({
4
4
  name: "Authenticated",
5
5
  setup(_, { slots }) {
6
6
  const { isLoading, isAuthenticated } = useConvexAuth();
@@ -12,7 +12,7 @@ export const Authenticated = defineComponent({
12
12
  };
13
13
  }
14
14
  });
15
- export const Unauthenticated = defineComponent({
15
+ export const Unauthenticated = /* @__PURE__ */ defineComponent({
16
16
  name: "Unauthenticated",
17
17
  setup(_, { slots }) {
18
18
  const { isLoading, isAuthenticated } = useConvexAuth();
@@ -24,7 +24,7 @@ export const Unauthenticated = defineComponent({
24
24
  };
25
25
  }
26
26
  });
27
- export const AuthLoading = defineComponent({
27
+ export const AuthLoading = /* @__PURE__ */ defineComponent({
28
28
  name: "AuthLoading",
29
29
  setup(_, { slots }) {
30
30
  const { isLoading } = useConvexAuth();
@@ -36,7 +36,7 @@ export const AuthLoading = defineComponent({
36
36
  };
37
37
  }
38
38
  });
39
- export const AuthRefreshing = defineComponent({
39
+ export const AuthRefreshing = /* @__PURE__ */ defineComponent({
40
40
  name: "AuthRefreshing",
41
41
  setup(_, { slots }) {
42
42
  const { isAuthenticated, isRefreshing } = useConvexAuth();
@@ -1,7 +1,7 @@
1
1
  import type { InjectionKey } from 'vue';
2
2
  import type { AuthTokenFetcher, BaseConvexClientOptions, ConnectionState, OptimisticUpdate, PaginationStatus, QueryJournal, QueryOptions } from 'convex/browser';
3
3
  import type { Watch as ConvexWatch } from 'convex/react';
4
- import type { ArgsAndOptions, FunctionArgs, FunctionReference, FunctionReturnType, OptionalRestArgs } from 'convex/server';
4
+ import type { ArgsAndOptions, FunctionArgs, FunctionReference, FunctionReference_future, FunctionReturnType, OptionalRestArgs } from 'convex/server';
5
5
  import type { Value } from 'convex/values';
6
6
  export type { AuthTokenFetcher, ConnectionState, OptimisticUpdate };
7
7
  /**
@@ -147,7 +147,7 @@ export declare class ConvexVueClient {
147
147
  *
148
148
  * @returns The {@link Watch} object.
149
149
  */
150
- watchQuery<Query extends FunctionReference<'query'>>(query: Query, ...argsAndOptions: ArgsAndOptions<Query, WatchQueryOptions>): Watch<FunctionReturnType<Query>>;
150
+ watchQuery<Query extends FunctionReference<'query'> | FunctionReference_future<'query'>>(query: Query, ...argsAndOptions: ArgsAndOptions<Query, WatchQueryOptions>): Watch<FunctionReturnType<Query>>;
151
151
  /**
152
152
  * Indicates likely future interest in a query subscription.
153
153
  *
@@ -160,7 +160,7 @@ export declare class ConvexVueClient {
160
160
  * @param queryOptions - A query (function reference from an api object) and its args, plus
161
161
  * an optional extendSubscriptionFor for how long to subscribe to the query.
162
162
  */
163
- prewarmQuery<Query extends FunctionReference<'query'>>(queryOptions: QueryOptions<Query> & {
163
+ prewarmQuery<Query extends FunctionReference<'query'> | FunctionReference_future<'query'>>(queryOptions: QueryOptions<Query> & {
164
164
  extendSubscriptionFor?: number;
165
165
  }): void;
166
166
  /**
@@ -173,7 +173,7 @@ export declare class ConvexVueClient {
173
173
  * @param options - A {@link MutationOptions} options object for the mutation.
174
174
  * @returns A promise of the mutation's result.
175
175
  */
176
- mutation<Mutation extends FunctionReference<'mutation'>>(mutation: Mutation, ...argsAndOptions: ArgsAndOptions<Mutation, MutationOptions<FunctionArgs<Mutation>>>): Promise<FunctionReturnType<Mutation>>;
176
+ mutation<Mutation extends FunctionReference<'mutation'> | FunctionReference_future<'mutation'>>(mutation: Mutation, ...argsAndOptions: ArgsAndOptions<Mutation, MutationOptions<FunctionArgs<Mutation>>>): Promise<FunctionReturnType<Mutation>>;
177
177
  /**
178
178
  * Execute an action function.
179
179
  *
@@ -183,7 +183,7 @@ export declare class ConvexVueClient {
183
183
  * the arguments will be `{}`.
184
184
  * @returns A promise of the action's result.
185
185
  */
186
- action<Action extends FunctionReference<'action'>>(action: Action, ...args: OptionalRestArgs<Action>): Promise<FunctionReturnType<Action>>;
186
+ action<Action extends FunctionReference<'action'> | FunctionReference_future<'action'>>(action: Action, ...args: OptionalRestArgs<Action>): Promise<FunctionReturnType<Action>>;
187
187
  /**
188
188
  * Fetch a query result once.
189
189
  *
@@ -196,7 +196,7 @@ export declare class ConvexVueClient {
196
196
  * the arguments will be `{}`.
197
197
  * @returns A promise of the query's result.
198
198
  */
199
- query<Query extends FunctionReference<'query'>>(query: Query, ...args: OptionalRestArgs<Query>): Promise<FunctionReturnType<Query>>;
199
+ query<Query extends FunctionReference<'query'> | FunctionReference_future<'query'>>(query: Query, ...args: OptionalRestArgs<Query>): Promise<FunctionReturnType<Query>>;
200
200
  /**
201
201
  * Get the current {@link ConnectionState} between the client and the Convex
202
202
  * deployment.
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, h } from "vue";
2
2
  import { useStorageUrl } from "../composables/use-storage-url.js";
3
- export const ConvexImage = defineComponent({
3
+ export const ConvexImage = /* @__PURE__ */ defineComponent({
4
4
  name: "ConvexImage",
5
5
  inheritAttrs: false,
6
6
  props: {
@@ -1,10 +1,10 @@
1
- import type { FunctionReference, FunctionReturnType, OptionalRestArgs } from 'convex/server';
1
+ import type { FunctionReference, FunctionReference_future, FunctionReturnType, OptionalRestArgs } from 'convex/server';
2
2
  /**
3
3
  * An interface to execute a Convex action on the server.
4
4
  *
5
5
  * @public
6
6
  */
7
- export interface VueAction<Action extends FunctionReference<'action'>> {
7
+ export interface VueAction<Action extends FunctionReference<'action'> | FunctionReference_future<'action'>> {
8
8
  /**
9
9
  * Execute the function on the server, returning a `Promise` of its return value.
10
10
  *
@@ -57,6 +57,6 @@ export interface VueAction<Action extends FunctionReference<'action'>> {
57
57
  *
58
58
  * @public
59
59
  */
60
- export declare function useAction<Action extends FunctionReference<'action'>>(action: Action): VueAction<Action>;
60
+ export declare function useAction<Action extends FunctionReference<'action'> | FunctionReference_future<'action'>>(action: Action): VueAction<Action>;
61
61
  /** @public */
62
62
  export declare const useConvexAction: typeof useAction;
@@ -1,12 +1,12 @@
1
1
  import type { OptimisticUpdate } from 'convex/browser';
2
- import type { FunctionArgs, FunctionReference, FunctionReturnType, OptionalRestArgs } from 'convex/server';
2
+ import type { FunctionArgs, FunctionReference, FunctionReference_future, FunctionReturnType, OptionalRestArgs } from 'convex/server';
3
3
  import { type ConvexVueClient } from '../client.js';
4
4
  /**
5
5
  * An interface to execute a Convex mutation function on the server.
6
6
  *
7
7
  * @public
8
8
  */
9
- export interface VueMutation<Mutation extends FunctionReference<'mutation'>> {
9
+ export interface VueMutation<Mutation extends FunctionReference<'mutation'> | FunctionReference_future<'mutation'>> {
10
10
  /**
11
11
  * Execute the mutation on the server, returning a `Promise` of its return value.
12
12
  *
@@ -37,7 +37,7 @@ export interface VueMutation<Mutation extends FunctionReference<'mutation'>> {
37
37
  */
38
38
  withOptimisticUpdate<T extends OptimisticUpdate<FunctionArgs<Mutation>>>(optimisticUpdate: T & (ReturnType<T> extends Promise<any> ? 'Optimistic update handlers must be synchronous' : {})): VueMutation<Mutation>;
39
39
  }
40
- export declare function createMutation(mutationReference: FunctionReference<'mutation'>, client: ConvexVueClient, update?: OptimisticUpdate<any>): VueMutation<any>;
40
+ export declare function createMutation(mutationReference: FunctionReference<'mutation'> | FunctionReference_future<'mutation'>, client: ConvexVueClient, update?: OptimisticUpdate<any>): VueMutation<any>;
41
41
  /**
42
42
  * Construct a new {@link VueMutation}.
43
43
  *
@@ -71,6 +71,6 @@ export declare function createMutation(mutationReference: FunctionReference<'mut
71
71
  *
72
72
  * @public
73
73
  */
74
- export declare function useMutation<Mutation extends FunctionReference<'mutation'>>(mutation: Mutation): VueMutation<Mutation>;
74
+ export declare function useMutation<Mutation extends FunctionReference<'mutation'> | FunctionReference_future<'mutation'>>(mutation: Mutation): VueMutation<Mutation>;
75
75
  /** @public */
76
76
  export declare const useConvexMutation: typeof useMutation;
@@ -1,6 +1,7 @@
1
+ import type { Value } from 'convex/values';
1
2
  import { type MaybeRefOrGetter, type ShallowRef } from 'vue';
2
- import { type CreateWatch } from '../queries-observer.js';
3
- import type { RequestForQueries } from 'convex/react';
3
+ import { type CreateWatch, type SubscribeToPaginatedQueryOptions } from '../queries-observer.js';
4
+ import type { FunctionReference, FunctionReference_future } from 'convex/server';
4
5
  /**
5
6
  * Load a variable number of reactive Convex queries.
6
7
  *
@@ -9,9 +10,10 @@ import type { RequestForQueries } from 'convex/react';
9
10
  * of queries without violating the rules of composables.
10
11
  *
11
12
  * This composable accepts an object whose keys are identifiers for each query and the
12
- * values are objects of `{ query: FunctionReference, args: Record<string, Value> }`. The
13
- * `query` is a FunctionReference for the Convex query function to load, and the `args` are
14
- * the arguments to that function.
13
+ * values are objects of
14
+ * `{ query: FunctionReference | FunctionReference_future, args: Record<string, Value> }`.
15
+ * The `query` is a reference to the Convex query function to load, and the
16
+ * `args` are the arguments to that function.
15
17
  *
16
18
  * The composable returns an object that maps each identifier to the result of the query,
17
19
  * `undefined` if the query is still loading, or an instance of `Error` if the query
@@ -52,11 +54,16 @@ import type { RequestForQueries } from 'convex/react';
52
54
  *
53
55
  * @public
54
56
  */
55
- export declare function useQueries(queries: MaybeRefOrGetter<RequestForQueries>): ShallowRef<Record<string, any | undefined | Error>>;
57
+ export declare function useQueries(queries: MaybeRefOrGetter<RequestForQueriesCompat>): ShallowRef<Record<string, any | undefined | Error>>;
56
58
  /**
57
59
  * Internal version of `useQueries` that is exported for testing.
58
60
  */
59
- export declare function useQueriesHelper(queries: MaybeRefOrGetter<RequestForQueries>, createWatch: CreateWatch): ShallowRef<Record<string, any | undefined | Error>>;
61
+ export declare function useQueriesHelper(queries: MaybeRefOrGetter<RequestForQueriesCompat>, createWatch: CreateWatch): ShallowRef<Record<string, any | undefined | Error>>;
60
62
  export type { RequestForQueries } from 'convex/react';
63
+ type RequestForQueriesCompat = Record<string, {
64
+ query: FunctionReference<'query'> | FunctionReference_future<'query'>;
65
+ args: Record<string, Value>;
66
+ paginationOptions?: SubscribeToPaginatedQueryOptions;
67
+ }>;
61
68
  /** @public */
62
69
  export declare const useConvexQueries: typeof useQueries;
@@ -1,7 +1,7 @@
1
- import type { FunctionArgs, FunctionReference } from 'convex/server';
1
+ import type { FunctionArgs, FunctionReference, FunctionReference_future, FunctionReturnType } from 'convex/server';
2
2
  import { type ComputedRef, type MaybeRefOrGetter } from 'vue';
3
3
  import type { UseQueryResult as ConvexUseQueryResult } from 'convex/react';
4
- export type OptionalRestArgsOrSkip<FuncRef extends FunctionReference<any>> = FuncRef['_args'] extends Record<string, never> ? [args?: MaybeRefOrGetter<Record<string, never> | 'skip'>] : [args: MaybeRefOrGetter<FuncRef['_args'] | 'skip'>];
4
+ export type OptionalRestArgsOrSkip<FuncRef extends FunctionReference<any> | FunctionReference_future<any>> = FunctionArgs<FuncRef> extends Record<string, never> ? [args?: MaybeRefOrGetter<Record<string, never> | 'skip'>] : [args: MaybeRefOrGetter<FunctionArgs<FuncRef> | 'skip'>];
5
5
  /**
6
6
  * Result returned by object-form {@link useQuery_experimental}.
7
7
  *
@@ -9,7 +9,7 @@ export type OptionalRestArgsOrSkip<FuncRef extends FunctionReference<any>> = Fun
9
9
  * @experimental May change in a minor release — see STABILITY.md.
10
10
  */
11
11
  export type UseQueryResult<QueryResult, ThrowOnError extends boolean = false> = ConvexUseQueryResult<QueryResult, ThrowOnError>;
12
- type UseQueryOptions<Query extends FunctionReference<'query'>, ThrowOnError extends boolean> = {
12
+ type UseQueryOptions<Query extends FunctionReference<'query'> | FunctionReference_future<'query'>, ThrowOnError extends boolean> = {
13
13
  query: Query;
14
14
  args: MaybeRefOrGetter<FunctionArgs<Query> | 'skip'>;
15
15
  throwOnError?: ThrowOnError;
@@ -53,7 +53,7 @@ type UseQueryOptions<Query extends FunctionReference<'query'>, ThrowOnError exte
53
53
  *
54
54
  * @public
55
55
  */
56
- export declare function useQuery<Query extends FunctionReference<'query'>>(query: Query, ...args: OptionalRestArgsOrSkip<Query>): ComputedRef<Query['_returnType'] | undefined>;
56
+ export declare function useQuery<Query extends FunctionReference<'query'> | FunctionReference_future<'query'>>(query: Query, ...args: OptionalRestArgsOrSkip<Query>): ComputedRef<FunctionReturnType<Query> | undefined>;
57
57
  /**
58
58
  * Load a reactive query within a Vue component using an options object.
59
59
  *
@@ -83,7 +83,7 @@ export declare function useQuery<Query extends FunctionReference<'query'>>(query
83
83
  * @public
84
84
  * @experimental May change in a minor release — see STABILITY.md.
85
85
  */
86
- export declare function useQuery_experimental<Query extends FunctionReference<'query'>, ThrowOnError extends boolean = false>(options: UseQueryOptions<Query, ThrowOnError>): ComputedRef<UseQueryResult<Query['_returnType'], ThrowOnError>>;
86
+ export declare function useQuery_experimental<Query extends FunctionReference<'query'> | FunctionReference_future<'query'>, ThrowOnError extends boolean = false>(options: UseQueryOptions<Query, ThrowOnError>): ComputedRef<UseQueryResult<FunctionReturnType<Query>, ThrowOnError>>;
87
87
  /** @public */
88
88
  export declare const useConvexQuery: typeof useQuery;
89
89
  export {};
@@ -1,4 +1,4 @@
1
- import type { FunctionReference } from 'convex/server';
1
+ import type { FunctionReference, FunctionReference_future, FunctionReturnType } from 'convex/server';
2
2
  import { type ComputedRef, type MaybeRefOrGetter } from 'vue';
3
3
  /**
4
4
  * The preloaded query payload, which should be passed to a client component
@@ -6,7 +6,7 @@ import { type ComputedRef, type MaybeRefOrGetter } from 'vue';
6
6
  *
7
7
  * @public
8
8
  */
9
- export type Preloaded<Query extends FunctionReference<'query'>> = {
9
+ export type Preloaded<Query extends FunctionReference<'query'> | FunctionReference_future<'query'>> = {
10
10
  __type: Query;
11
11
  _name: string;
12
12
  _argsJSON: string;
@@ -42,4 +42,4 @@ export type Preloaded<Query extends FunctionReference<'query'>> = {
42
42
  *
43
43
  * @public
44
44
  */
45
- export declare function usePreloadedQuery<Query extends FunctionReference<'query'>>(preloadedQuery: MaybeRefOrGetter<Preloaded<Query>>): ComputedRef<Query['_returnType']>;
45
+ export declare function usePreloadedQuery<Query extends FunctionReference<'query'> | FunctionReference_future<'query'>>(preloadedQuery: MaybeRefOrGetter<Preloaded<Query>>): ComputedRef<FunctionReturnType<Query>>;
@@ -85,10 +85,9 @@ export { useConvexMutation } from './composables/use-mutation.js';
85
85
  export { useConvexAction } from './composables/use-action.js';
86
86
  export { type PaginatedWatch, type VueMutationOptions, type ConvexLogger, } from './client.js';
87
87
  export type { ConnectionState, OptimisticUpdate, QueryJournal, } from 'convex/browser';
88
- export type { FunctionReference, FunctionArgs, FunctionReturnType, OptionalRestArgs, ArgsAndOptions, } from 'convex/server';
88
+ export type { FunctionReference, FunctionReference_future, FunctionArgs, FunctionReturnType, OptionalRestArgs, ArgsAndOptions, } from 'convex/server';
89
89
  export type { Value } from 'convex/values';
90
90
  export { useUpload, useConvexUpload, uploadFile, type VueUpload, type UseUploadOptions, type UploadFileOptions, type GenerateUploadUrl, type StorageId, } from './composables/use-upload.js';
91
91
  export { useUploadQueue, useConvexUploadQueue, type VueUploadQueue, type UseUploadQueueOptions, type UploadQueueItem, type UploadItemStatus, type EnqueueInput, } from './composables/use-upload-queue.js';
92
92
  export { useStorageUrl, useConvexStorageUrl, type GetStorageUrl, } from './composables/use-storage-url.js';
93
93
  export { ConvexImage } from './components/convex-image.js';
94
- export { provideConvexApi, useConvexApi, useConvexNamespace, ConvexApiKey, type ConvexApi, } from './provide.js';
@@ -35,9 +35,3 @@ export {
35
35
  useConvexStorageUrl
36
36
  } from "./composables/use-storage-url.js";
37
37
  export { ConvexImage } from "./components/convex-image.js";
38
- export {
39
- provideConvexApi,
40
- useConvexApi,
41
- useConvexNamespace,
42
- ConvexApiKey
43
- } from "./provide.js";
@@ -1,16 +1,20 @@
1
1
  import { type Value } from 'convex/values';
2
2
  import type { PaginatedWatch, Watch } from './client.js';
3
3
  import type { QueryJournal } from 'convex/browser';
4
- import { type FunctionReference } from 'convex/server';
5
- import type { RequestForQueries } from './composables/use-queries.js';
4
+ import { type FunctionReference, type FunctionReference_future } from 'convex/server';
6
5
  type PaginatedQueryResult<T> = NonNullable<ReturnType<PaginatedWatch<T>['localQueryResult']>>;
7
6
  export interface SubscribeToPaginatedQueryOptions {
8
7
  initialNumItems: number;
9
8
  id: number;
10
9
  }
11
10
  type Identifier = string;
11
+ type RequestForQueriesCompat = Record<Identifier, {
12
+ query: FunctionReference<'query'> | FunctionReference_future<'query'>;
13
+ args: Record<string, Value>;
14
+ paginationOptions?: SubscribeToPaginatedQueryOptions;
15
+ }>;
12
16
  export interface CreateWatch {
13
- (query: FunctionReference<'query'>, args: Record<string, Value>, options: {
17
+ (query: FunctionReference<'query'> | FunctionReference_future<'query'>, args: Record<string, Value>, options: {
14
18
  journal?: QueryJournal;
15
19
  paginationOptions?: SubscribeToPaginatedQueryOptions;
16
20
  }): Watch<Value> | PaginatedWatch<Value>;
@@ -25,13 +29,9 @@ export declare class QueriesObserver {
25
29
  private queries;
26
30
  private listeners;
27
31
  constructor(createWatch: CreateWatch);
28
- setQueries(newQueries: Record<Identifier, {
29
- query: FunctionReference<'query'>;
30
- args: Record<string, Value>;
31
- paginationOptions?: SubscribeToPaginatedQueryOptions;
32
- }>): void;
32
+ setQueries(newQueries: RequestForQueriesCompat): void;
33
33
  subscribe(listener: () => void): () => void;
34
- getLocalResults(queries: RequestForQueries): Record<Identifier, Value | undefined | Error | PaginatedQueryResult<Value>>;
34
+ getLocalResults(queries: RequestForQueriesCompat): Record<Identifier, Value | undefined | Error | PaginatedQueryResult<Value>>;
35
35
  setCreateWatch(createWatch: CreateWatch): void;
36
36
  destroy(): void;
37
37
  private addQuery;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "nuxt-convex-module",
4
- "version": "0.10.0",
5
- "description": "Connects a Nuxt app to a Convex backend: live queries, mutations, actions, pagination, file storage and SSR, auto-imported and typed against your deployment. The same Vue client runs without Nuxt; Better Auth, Clerk, Auth0 and Polar are opt-in.",
4
+ "version": "0.12.0",
5
+ "description": "Convex backend integration with live queries, mutations, actions, pagination, file storage and SSR, auto-imported and typed against your deployment. The same Vue client runs without Nuxt; Better Auth, Clerk, Auth0 and Polar are opt-in.",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/qruto/nuxt-convex-module.git"
@@ -37,6 +37,7 @@
37
37
  "billing"
38
38
  ],
39
39
  "type": "module",
40
+ "sideEffects": false,
40
41
  "exports": {
41
42
  "./package.json": "./package.json",
42
43
  ".": {
@@ -150,20 +151,18 @@
150
151
  "node": ">=24.11.0"
151
152
  },
152
153
  "dependencies": {
153
- "@nuxt/devtools-kit": "^3.4.2",
154
- "@nuxt/kit": "^4.5.2",
155
- "h3": "^1.15.11",
156
- "sirv": "^3.0.2"
154
+ "@nuxt/kit": "^4.6.2",
155
+ "std-env": "^4.2.0"
157
156
  },
158
157
  "peerDependencies": {
159
- "@auth0/auth0-vue": ">=2.0.0",
160
- "@clerk/vue": ">=2.0.0",
158
+ "@auth0/auth0-vue": "^2.0.0",
159
+ "@clerk/vue": "^2.0.0",
161
160
  "@convex-dev/better-auth": ">=0.12.0 <0.13.0",
162
161
  "@convex-dev/polar": ">=0.9.0 <0.10.0",
163
- "@polar-sh/checkout": ">=0.4.0",
162
+ "@polar-sh/checkout": "^0.4.0",
164
163
  "better-auth": "~1.6.11",
165
- "convex": "^1.40.0",
166
- "nuxt-security": ">=2.6.0",
164
+ "convex": "^1.46.0",
165
+ "nuxt-security": "^2.6.0",
167
166
  "vue": "^3.5.0"
168
167
  },
169
168
  "peerDependenciesMeta": {
@@ -191,45 +190,47 @@
191
190
  },
192
191
  "devDependencies": {
193
192
  "@arethetypeswrong/cli": "^0.18.5",
194
- "@auth0/auth0-vue": "^2.9.0",
195
- "@clerk/vue": "2.5.1",
196
- "@commitlint/cli": "^21.2.2",
197
- "@commitlint/config-conventional": "^21.2.2",
193
+ "@auth0/auth0-vue": "^2.11.0",
194
+ "@clerk/vue": "2.5.13",
195
+ "@commitlint/cli": "^21.2.4",
196
+ "@commitlint/config-conventional": "^21.2.4",
198
197
  "@convex-dev/better-auth": "^0.12.5",
199
198
  "@convex-dev/polar": "^0.9.2",
200
- "@nuxt/devtools": "^3.4.2",
199
+ "@nuxt/devtools": "4.0.0-beta.7",
200
+ "@nuxt/devtools-kit": "4.0.0-beta.7",
201
201
  "@nuxt/eslint": "^1.17.0",
202
202
  "@nuxt/eslint-config": "^1.17.0",
203
203
  "@nuxt/module-builder": "^1.0.3",
204
- "@nuxt/schema": "^4.5.2",
205
- "@nuxt/test-utils": "^4.3.2",
206
- "@polar-sh/checkout": "^0.4.1",
207
- "@types/node": "^26.5.1",
208
- "@types/ws": "^8.18.1",
209
- "@unhead/vue": "^3.4.0",
210
- "@vitest/coverage-v8": "^5.0.0",
211
- "@vue/test-utils": "^2.5.0",
212
- "better-auth": "~1.6.31",
204
+ "@nuxt/schema": "^4.6.2",
205
+ "@nuxt/test-utils": "^4.3.4",
206
+ "@polar-sh/checkout": "^0.4.3",
207
+ "@types/node": "^26.6.5",
208
+ "@types/ws": "^8.18.2",
209
+ "@unhead/vue": "^3.4.2",
210
+ "@vitejs/devtools-kit": "^0.8.0",
211
+ "@vitest/coverage-v8": "^5.0.5",
212
+ "@vue/test-utils": "^2.5.1",
213
+ "better-auth": "~1.6.33",
213
214
  "changelogen": "^0.6.2",
214
- "convex": "^1.45.0",
215
- "eslint": "^10.10.0",
216
- "fallow": "3.25.0",
217
- "happy-dom": "^20.14.5",
215
+ "convex": "^1.48.0",
216
+ "eslint": "^10.13.0",
217
+ "fallow": "3.34.1",
218
+ "happy-dom": "^21.0.4",
218
219
  "installed-check": "^11.0.0",
219
- "nuxt": "^4.5.2",
220
+ "nuxt": "^4.6.2",
220
221
  "nuxt-security": "^2.6.0",
221
- "pkg-pr-new": "^0.0.88",
222
- "playwright-core": "^1.63.0",
223
- "portless": "0.15.6",
222
+ "pkg-pr-new": "^0.0.91",
223
+ "playwright-core": "^1.64.1",
224
+ "portless": "0.15.8",
224
225
  "publint": "^0.3.24",
225
- "taze": "^21.1.0",
226
+ "taze": "^21.3.0",
226
227
  "typedoc": "^0.28.20",
227
- "typedoc-plugin-frontmatter": "^1.3.2",
228
- "typedoc-plugin-markdown": "^4.13.0",
228
+ "typedoc-plugin-frontmatter": "^1.3.3",
229
+ "typedoc-plugin-markdown": "^4.14.1",
229
230
  "typescript": "~6.0.3",
230
- "vitest": "^5.0.0",
231
- "vue-tsc": "^3.3.11",
232
- "ws": "^8.21.3"
231
+ "vitest": "^5.0.5",
232
+ "vue-tsc": "^3.3.13",
233
+ "ws": "^8.22.0"
233
234
  },
234
235
  "publishConfig": {
235
236
  "access": "public"
@@ -247,11 +248,11 @@
247
248
  },
248
249
  "scripts": {
249
250
  "build": "nuxt-module-build build && pnpm run build:devtools-client",
250
- "build:devtools-client": "nuxt generate devtools-client-app",
251
+ "build:devtools-client": "pnpm --filter nuxt-convex-module-devtools-client run generate",
251
252
  "dev:prepare:lib": "nuxt-module-build build --stub && nuxt-module-build prepare",
252
253
  "dev:prepare": "pnpm run dev:prepare:lib && nuxt prepare website",
253
254
  "dev": "pnpm run dev:prepare && pnpm --dir website exec convex dev --start 'portless run --name nuxt-convex-module nuxt dev'",
254
- "dev:devtools-client": "nuxt dev devtools-client-app --port 3630",
255
+ "dev:devtools-client": "pnpm --filter nuxt-convex-module-devtools-client run dev",
255
256
  "start": "pnpm run dev",
256
257
  "lint": "eslint .",
257
258
  "lint:fix": "eslint . --fix",
@@ -275,6 +276,7 @@
275
276
  "check:manifest": "installed-check -d --no-workspaces",
276
277
  "check:tarball": "node scripts/check-tarball.mjs",
277
278
  "check:rulesets": "node scripts/check-rulesets.mjs",
279
+ "parity:diff": "node scripts/parity-diff.mjs",
278
280
  "check:consumer-types": "node scripts/check-consumer-types.mjs"
279
281
  }
280
282
  }
@@ -1 +0,0 @@
1
- <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><script type="importmap">{"imports":{"#entry":"/__nuxt-convex-module/_nuxt/C6YdTgGl.js"}}</script><link rel="stylesheet" href="/__nuxt-convex-module/_nuxt/entry.HF8C6P11.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-convex-module/_nuxt/C6YdTgGl.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-convex-module/_nuxt/DQmVr-EY.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-convex-module/_nuxt/EZ4-8Xzm.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-convex-module/_nuxt/vZZlEX5A.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-convex-module/_nuxt/BmBQNDID.js"><script type="module" src="/__nuxt-convex-module/_nuxt/C6YdTgGl.js" crossorigin></script><link rel="prefetch" as="style" crossorigin href="/__nuxt-convex-module/_nuxt/error-404.CLlwiMp-.css"><link rel="prefetch" as="script" crossorigin href="/__nuxt-convex-module/_nuxt/BhmjAr2Q.js"><link rel="prefetch" as="script" crossorigin href="/__nuxt-convex-module/_nuxt/D_Rij7MD.js"><link rel="prefetch" as="style" crossorigin href="/__nuxt-convex-module/_nuxt/error-500.Bxr6fpDU.css"><link rel="prefetch" as="script" crossorigin href="/__nuxt-convex-module/_nuxt/_Lf3mfPR.js"></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-convex-module",buildId:"1734dcfa-caf6-447b-a68b-4dd3cf138875",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1789568252378,false]</script></body></html>