kitcn 0.0.1 → 0.12.1

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 (93) hide show
  1. package/bin/intent.js +3 -0
  2. package/dist/aggregate/index.d.ts +388 -0
  3. package/dist/aggregate/index.js +37 -0
  4. package/dist/api-entry-BckXqaLb.js +66 -0
  5. package/dist/auth/client/index.d.ts +37 -0
  6. package/dist/auth/client/index.js +217 -0
  7. package/dist/auth/config/index.d.ts +45 -0
  8. package/dist/auth/config/index.js +24 -0
  9. package/dist/auth/generated/index.d.ts +2 -0
  10. package/dist/auth/generated/index.js +3 -0
  11. package/dist/auth/http/index.d.ts +64 -0
  12. package/dist/auth/http/index.js +461 -0
  13. package/dist/auth/index.d.ts +221 -0
  14. package/dist/auth/index.js +1398 -0
  15. package/dist/auth/nextjs/index.d.ts +50 -0
  16. package/dist/auth/nextjs/index.js +81 -0
  17. package/dist/auth-store-Cljlmdmi.js +197 -0
  18. package/dist/builder-CBdG5W6A.js +1974 -0
  19. package/dist/caller-factory-cTXNvYdz.js +216 -0
  20. package/dist/cli.mjs +13264 -0
  21. package/dist/codegen-lF80HSWu.mjs +3416 -0
  22. package/dist/context-utils-HPC5nXzx.d.ts +17 -0
  23. package/dist/create-schema-odyF4kCy.js +156 -0
  24. package/dist/create-schema-orm-DOyiNDCx.js +246 -0
  25. package/dist/crpc/index.d.ts +105 -0
  26. package/dist/crpc/index.js +169 -0
  27. package/dist/customFunctions-C0voKmtx.js +144 -0
  28. package/dist/error-BZEnI7Sq.js +41 -0
  29. package/dist/generated-contract-disabled-Cih4eITO.js +50 -0
  30. package/dist/generated-contract-disabled-D-sOFy92.d.ts +354 -0
  31. package/dist/http-types-DqJubRPJ.d.ts +292 -0
  32. package/dist/meta-utils-0Pu0Nrap.js +117 -0
  33. package/dist/middleware-BUybuv9n.d.ts +34 -0
  34. package/dist/middleware-C2qTZ3V7.js +84 -0
  35. package/dist/orm/index.d.ts +17 -0
  36. package/dist/orm/index.js +10713 -0
  37. package/dist/plugins/index.d.ts +2 -0
  38. package/dist/plugins/index.js +3 -0
  39. package/dist/procedure-caller-DtxLmGwA.d.ts +1467 -0
  40. package/dist/procedure-caller-MWcxhQDv.js +349 -0
  41. package/dist/query-context-B8o6-8kC.js +1518 -0
  42. package/dist/query-context-CFZqIvD7.d.ts +42 -0
  43. package/dist/query-options-Dw7cOyXl.js +121 -0
  44. package/dist/ratelimit/index.d.ts +269 -0
  45. package/dist/ratelimit/index.js +856 -0
  46. package/dist/ratelimit/react/index.d.ts +76 -0
  47. package/dist/ratelimit/react/index.js +183 -0
  48. package/dist/react/index.d.ts +1284 -0
  49. package/dist/react/index.js +2526 -0
  50. package/dist/rsc/index.d.ts +276 -0
  51. package/dist/rsc/index.js +233 -0
  52. package/dist/runtime-CtvJPkur.js +2453 -0
  53. package/dist/server/index.d.ts +5 -0
  54. package/dist/server/index.js +6 -0
  55. package/dist/solid/index.d.ts +1221 -0
  56. package/dist/solid/index.js +2940 -0
  57. package/dist/transformer-DtDhR3Lc.js +194 -0
  58. package/dist/types-BTb_4BaU.d.ts +42 -0
  59. package/dist/types-BiJE7qxR.d.ts +4 -0
  60. package/dist/types-DEJpkIhw.d.ts +88 -0
  61. package/dist/types-HhO_R6pd.d.ts +213 -0
  62. package/dist/validators-B7oIJCAp.js +279 -0
  63. package/dist/validators-vzRKjBJC.d.ts +88 -0
  64. package/dist/watcher.mjs +96 -0
  65. package/dist/where-clause-compiler-DdjN63Io.d.ts +4756 -0
  66. package/package.json +107 -34
  67. package/skills/convex/SKILL.md +486 -0
  68. package/skills/convex/references/features/aggregates.md +353 -0
  69. package/skills/convex/references/features/auth-admin.md +446 -0
  70. package/skills/convex/references/features/auth-organizations.md +1141 -0
  71. package/skills/convex/references/features/auth-polar.md +579 -0
  72. package/skills/convex/references/features/auth.md +470 -0
  73. package/skills/convex/references/features/create-plugins.md +153 -0
  74. package/skills/convex/references/features/http.md +676 -0
  75. package/skills/convex/references/features/migrations.md +162 -0
  76. package/skills/convex/references/features/orm.md +1166 -0
  77. package/skills/convex/references/features/react.md +657 -0
  78. package/skills/convex/references/features/scheduling.md +267 -0
  79. package/skills/convex/references/features/testing.md +209 -0
  80. package/skills/convex/references/setup/auth.md +501 -0
  81. package/skills/convex/references/setup/biome.md +190 -0
  82. package/skills/convex/references/setup/doc-guidelines.md +145 -0
  83. package/skills/convex/references/setup/index.md +761 -0
  84. package/skills/convex/references/setup/next.md +116 -0
  85. package/skills/convex/references/setup/react.md +175 -0
  86. package/skills/convex/references/setup/server.md +473 -0
  87. package/skills/convex/references/setup/start.md +67 -0
  88. package/LICENSE +0 -21
  89. package/README.md +0 -0
  90. package/dist/index.d.mts +0 -5
  91. package/dist/index.d.mts.map +0 -1
  92. package/dist/index.mjs +0 -6
  93. package/dist/index.mjs.map +0 -1
@@ -0,0 +1,1221 @@
1
+ import { FunctionArgs, FunctionReference, FunctionReturnType } from "convex/server";
2
+ import * as solid_js0 from "solid-js";
3
+ import { JSX, ParentProps } from "solid-js";
4
+ import { DefaultError, QueryCache, QueryClient, QueryFilters, QueryFunction, QueryFunctionContext, QueryKey, SkipToken, SolidMutationOptions, SolidQueryOptions } from "@tanstack/solid-query";
5
+ import { AuthTokenFetcher, ConvexClient, ConvexHttpClient } from "convex/browser";
6
+ import { z } from "zod";
7
+ import { convexClient, crossDomainClient } from "@convex-dev/better-auth/client/plugins";
8
+ import { BetterAuthClientPlugin } from "better-auth";
9
+ import { createAuthClient } from "better-auth/solid";
10
+
11
+ //#region src/crpc/types.d.ts
12
+ /** Symbol key for attaching FunctionReference to options (non-serializable) */
13
+ declare const FUNC_REF_SYMBOL: unique symbol;
14
+ /** Options controlled by convexQuery/convexAction factories */
15
+ type ReservedQueryOptions$2 = 'queryKey' | 'queryFn' | 'staleTime';
16
+ /** Options controlled by mutation factories */
17
+ type ReservedMutationOptions$2 = 'mutationFn';
18
+ /** Reserved options controlled by infinite query factories */
19
+ type ReservedInfiniteQueryOptions = 'queryKey' | 'queryFn' | 'staleTime' | 'refetchInterval' | 'refetchOnMount' | 'refetchOnReconnect' | 'refetchOnWindowFocus' | 'persister' | 'placeholderData';
20
+ /** Metadata for a single Convex function */
21
+ type FnMeta$1 = {
22
+ auth?: 'required' | 'optional';
23
+ role?: string;
24
+ ratelimit?: string;
25
+ type?: 'query' | 'mutation' | 'action';
26
+ limit?: number;
27
+ [key: string]: unknown;
28
+ };
29
+ /** Metadata for paginated functions (limit is required) */
30
+ type PaginatedFnMeta = Omit<FnMeta$1, 'limit'> & {
31
+ limit: number;
32
+ };
33
+ /** Metadata for all Convex functions by namespace.fnName, with _http for HTTP routes */
34
+ type Meta = Record<string, Record<string, FnMeta$1>> & {
35
+ _http?: Record<string, {
36
+ path: string;
37
+ method: string;
38
+ }>;
39
+ };
40
+ /** Query key structure for Convex queries */
41
+ type ConvexQueryKey<T extends FunctionReference<'query'>> = readonly ['convexQuery', string, FunctionArgs<T>];
42
+ /** Query key structure for Convex actions */
43
+ type ConvexActionKey<T extends FunctionReference<'action'>> = readonly ['convexAction', string, FunctionArgs<T>];
44
+ /** Mutation key structure for Convex mutations/actions */
45
+ type ConvexMutationKey = ['convexMutation', string];
46
+ /**
47
+ * Meta passed to TanStack Query for auth and subscription control.
48
+ * Set by convexQuery, read by ConvexQueryClient.queryFn() and subscribeInner().
49
+ */
50
+ type ConvexQueryMeta = {
51
+ /** Auth type from generated Convex metadata via getMeta() */authType?: 'required' | 'optional'; /** Skip query silently when unauthenticated (returns null) */
52
+ skipUnauth?: boolean; /** Whether to create WebSocket subscription (default: true) */
53
+ subscribe?: boolean;
54
+ };
55
+ /** Hook options for Convex queries */
56
+ type ConvexQueryHookOptions = {
57
+ /** Skip query silently when unauthenticated (default: false, calls onQueryUnauthorized) */skipUnauth?: boolean; /** Set to false to fetch once without subscribing (default: true) */
58
+ subscribe?: boolean;
59
+ };
60
+ /** Extract input args without cursor/limit (user's filter args only) */
61
+ type InfiniteQueryInput<TInput> = Omit<TInput, 'cursor' | 'limit'>;
62
+ /** Extract item type from PaginationResult<T> */
63
+ type ExtractPaginatedItem<TOutput> = TOutput extends {
64
+ page: (infer T)[];
65
+ } ? T : never;
66
+ /** Metadata for infinite query (extends ConvexQueryMeta) */
67
+ type ConvexInfiniteQueryMeta = ConvexQueryMeta & {
68
+ /** The query function name (serializable for RSC) */queryName: string; /** Query args without cursor/limit (user's filter args only) */
69
+ args: Record<string, unknown>; /** Items per page (optional - server uses .paginated() default) */
70
+ limit?: number;
71
+ };
72
+ type EmptyObject = Record<string, never>;
73
+ /** Static query options parameter type (non-hook, for event handlers) */
74
+ type StaticQueryOptsParam = {
75
+ skipUnauth?: boolean;
76
+ };
77
+ /** Check if a type has cursor key (pagination detection) */
78
+ type IsPaginated<T> = 'cursor' extends keyof T ? true : false;
79
+ /** Mutation variables type - undefined when no args required (allows mutateAsync() without args) */
80
+ type MutationVariables<T extends FunctionReference<'mutation' | 'action'>> = keyof FunctionArgs<T> extends never ? void : EmptyObject extends FunctionArgs<T> ? FunctionArgs<T> | undefined : FunctionArgs<T>;
81
+ /** Vanilla mutation - direct .mutate() call without TanStack Query */
82
+ type VanillaMutation<T extends FunctionReference<'mutation'>> = {
83
+ mutate: keyof FunctionArgs<T> extends never ? (args?: EmptyObject) => Promise<FunctionReturnType<T>> : EmptyObject extends FunctionArgs<T> ? (args?: FunctionArgs<T>) => Promise<FunctionReturnType<T>> : (args: FunctionArgs<T>) => Promise<FunctionReturnType<T>>;
84
+ };
85
+ /** Vanilla action - both .query() and .mutate() for direct calls */
86
+ type VanillaAction<T extends FunctionReference<'action'>> = {
87
+ query: keyof FunctionArgs<T> extends never ? (args?: EmptyObject) => Promise<FunctionReturnType<T>> : EmptyObject extends FunctionArgs<T> ? (args?: FunctionArgs<T>) => Promise<FunctionReturnType<T>> : (args: FunctionArgs<T>) => Promise<FunctionReturnType<T>>;
88
+ mutate: keyof FunctionArgs<T> extends never ? (args?: EmptyObject) => Promise<FunctionReturnType<T>> : EmptyObject extends FunctionArgs<T> ? (args?: FunctionArgs<T>) => Promise<FunctionReturnType<T>> : (args: FunctionArgs<T>) => Promise<FunctionReturnType<T>>;
89
+ };
90
+ //#endregion
91
+ //#region src/solid/auth.d.ts
92
+ declare const MetaContext: solid_js0.Context<Meta | undefined>;
93
+ /**
94
+ * Hook to access the meta object from context.
95
+ * Returns undefined if meta was not provided.
96
+ */
97
+ declare function useMeta(): Meta | undefined;
98
+ /**
99
+ * Hook to get function metadata from the meta index.
100
+ */
101
+ declare function useFnMeta(): (namespace: string, fnName: string) => FnMeta$1 | undefined;
102
+ type AuthType = 'required' | 'optional' | undefined;
103
+ /** Get auth type from meta for a function */
104
+ declare function getAuthType(meta: Meta | undefined, funcName: string): AuthType;
105
+ /** Hook to compute auth-based skip logic for queries */
106
+ declare function useAuthSkip(funcRef: FunctionReference<'query' | 'mutation' | 'action'>, opts?: {
107
+ skipUnauth?: boolean;
108
+ enabled?: boolean;
109
+ }): {
110
+ authType: AuthType;
111
+ readonly isAuthLoading: boolean;
112
+ readonly isAuthenticated: boolean;
113
+ readonly shouldSkip: boolean;
114
+ };
115
+ //#endregion
116
+ //#region src/crpc/auth-error.d.ts
117
+ /**
118
+ * Auth Mutation Error
119
+ *
120
+ * Framework-agnostic error class for Better Auth mutations.
121
+ */
122
+ /**
123
+ * Error thrown when a Better Auth mutation fails.
124
+ * Contains the original error details from Better Auth.
125
+ */
126
+ declare class AuthMutationError extends Error {
127
+ /** Error code from Better Auth (e.g., 'INVALID_PASSWORD', 'EMAIL_ALREADY_REGISTERED') */
128
+ code?: string;
129
+ /** HTTP status code */
130
+ status: number;
131
+ /** HTTP status text */
132
+ statusText: string;
133
+ constructor(authError: {
134
+ message?: string;
135
+ status: number;
136
+ statusText: string;
137
+ code?: string;
138
+ });
139
+ }
140
+ /**
141
+ * Type guard to check if an error is an AuthMutationError.
142
+ */
143
+ declare function isAuthMutationError(error: unknown): error is AuthMutationError;
144
+ //#endregion
145
+ //#region src/solid/auth-mutations.d.ts
146
+ type MutationOptionsHook<TData, TVariables = void> = (options?: Omit<SolidMutationOptions<TData, DefaultError, TVariables>, 'mutationFn'>) => SolidMutationOptions<TData, DefaultError, TVariables>;
147
+ type AnyFn = (...args: any[]) => Promise<any>;
148
+ type AuthClient = {
149
+ signOut: AnyFn;
150
+ signIn: {
151
+ social: AnyFn;
152
+ email: AnyFn;
153
+ };
154
+ signUp: {
155
+ email: AnyFn;
156
+ };
157
+ };
158
+ type AuthMutationsResult<T extends AuthClient> = {
159
+ useSignOutMutationOptions: MutationOptionsHook<Awaited<ReturnType<T['signOut']>>, Parameters<T['signOut']>[0] | void>;
160
+ useSignInSocialMutationOptions: MutationOptionsHook<Awaited<ReturnType<T['signIn']['social']>>, Parameters<T['signIn']['social']>[0]>;
161
+ useSignInMutationOptions: MutationOptionsHook<Awaited<ReturnType<T['signIn']['email']>>, Parameters<T['signIn']['email']>[0]>;
162
+ useSignUpMutationOptions: MutationOptionsHook<Awaited<ReturnType<T['signUp']['email']>>, Parameters<T['signUp']['email']>[0]>;
163
+ };
164
+ /**
165
+ * Create mutation option hooks from a better-auth client.
166
+ *
167
+ * @example
168
+ * ```tsx
169
+ * // lib/auth-client.ts
170
+ * import { createAuthMutations } from 'kitcn/solid';
171
+ *
172
+ * export const authClient = createAuthClient({...});
173
+ *
174
+ * export const {
175
+ * useSignOutMutationOptions,
176
+ * useSignInSocialMutationOptions,
177
+ * useSignInMutationOptions,
178
+ * useSignUpMutationOptions,
179
+ * } = createAuthMutations(authClient);
180
+ *
181
+ * // components/header.tsx
182
+ * const signOutMutation = createMutation(() => useSignOutMutationOptions({
183
+ * onSuccess: () => navigate('/login'),
184
+ * }));
185
+ * ```
186
+ */
187
+ declare function createAuthMutations<T extends AuthClient>(authClient: T): AuthMutationsResult<T>;
188
+ //#endregion
189
+ //#region src/solid/auth-store.d.ts
190
+ type FetchAccessTokenFn = (args: {
191
+ forceRefreshToken: boolean;
192
+ }) => Promise<string | null>;
193
+ declare const FetchAccessTokenContext: solid_js0.Context<FetchAccessTokenFn | null>;
194
+ /** Get fetchAccessToken from context (available immediately, no race condition) */
195
+ declare const useFetchAccessToken: () => FetchAccessTokenFn | null;
196
+ type ConvexAuthResult = {
197
+ isAuthenticated: boolean;
198
+ isLoading: boolean;
199
+ };
200
+ /** Get auth from bridge context (null if no bridge configured) */
201
+ declare const useConvexAuthBridge: () => ConvexAuthResult | null;
202
+ type AuthStoreState = {
203
+ /** Callback when mutation/action called while unauthorized. Throws by default. */onMutationUnauthorized: () => void; /** Callback when query called while unauthorized. Noop by default. */
204
+ onQueryUnauthorized: (info: {
205
+ queryName: string;
206
+ }) => void; /** Custom function to detect UNAUTHORIZED errors. Default checks code or "auth" in message. */
207
+ isUnauthorized: (error: unknown) => boolean; /** Cached Convex JWT for HTTP requests */
208
+ token: string | null; /** JWT expiration timestamp (ms) */
209
+ expiresAt: number | null; /** Auth loading state (synced from useConvexAuth for class methods) */
210
+ isLoading: boolean; /** Auth state (synced from useConvexAuth for class methods) */
211
+ isAuthenticated: boolean;
212
+ };
213
+ /** Decode JWT expiration (ms timestamp) from token */
214
+ declare function decodeJwtExp(token: string): number | null;
215
+ type AuthStore = {
216
+ get: <K extends keyof AuthStoreState>(key: K) => AuthStoreState[K];
217
+ set: <K extends keyof AuthStoreState>(key: K, value: AuthStoreState[K]) => void;
218
+ store: AuthStoreState;
219
+ };
220
+ declare function useAuthStore(): AuthStore;
221
+ declare function useAuthValue<K extends keyof AuthStoreState>(key: K): AuthStoreState[K];
222
+ declare function AuthProvider(props: {
223
+ children: JSX.Element;
224
+ initialValues?: Partial<AuthStoreState>;
225
+ isUnauthorized?: (error: unknown) => boolean;
226
+ onMutationUnauthorized?: () => void;
227
+ onQueryUnauthorized?: (info: {
228
+ queryName: string;
229
+ }) => void;
230
+ }): JSX.Element;
231
+ /**
232
+ * Safe wrapper that doesn't throw when used outside auth provider.
233
+ * Returns { isAuthenticated: false, isLoading: false } when no auth provider.
234
+ *
235
+ * Supports both:
236
+ * - better-auth users (via AuthProvider)
237
+ * - @convex-dev/auth users (via ConvexAuthBridge)
238
+ */
239
+ declare function useSafeConvexAuth(): ConvexAuthResult;
240
+ /**
241
+ * Bridge component that provides auth state via context.
242
+ * @internal
243
+ */
244
+ declare function ConvexAuthBridge(props: ParentProps<{
245
+ isLoading: boolean;
246
+ isAuthenticated: boolean;
247
+ }>): JSX.Element;
248
+ declare const useAuth: () => {
249
+ readonly hasSession: boolean;
250
+ readonly isAuthenticated: boolean;
251
+ readonly isLoading: boolean;
252
+ };
253
+ /** Check if user maybe has auth (optimistic, has token) */
254
+ declare const useMaybeAuth: () => () => boolean;
255
+ /** Check if user is authenticated (server-verified) */
256
+ declare const useIsAuth: () => () => boolean;
257
+ declare const useAuthGuard: () => (callback?: () => Promise<void> | void) => boolean | undefined;
258
+ /** Render children only when maybe has auth (optimistic) */
259
+ declare function MaybeAuthenticated(props: {
260
+ children: JSX.Element;
261
+ }): JSX.Element;
262
+ /** Render children only when authenticated (server-verified) */
263
+ declare function Authenticated(props: {
264
+ children: JSX.Element;
265
+ }): JSX.Element;
266
+ /** Render children only when maybe not auth (optimistic) */
267
+ declare function MaybeUnauthenticated(props: {
268
+ children: JSX.Element;
269
+ }): JSX.Element;
270
+ /** Render children only when not authenticated (server-verified) */
271
+ declare function Unauthenticated(props: {
272
+ children: JSX.Element;
273
+ }): JSX.Element;
274
+ //#endregion
275
+ //#region src/crpc/transformer.d.ts
276
+ /**
277
+ * Generic transformer contract (mirrors tRPC shape).
278
+ */
279
+ interface DataTransformer {
280
+ deserialize(object: any): any;
281
+ serialize(object: any): any;
282
+ }
283
+ /**
284
+ * Separate input/output transformers.
285
+ */
286
+ interface CombinedDataTransformer {
287
+ input: DataTransformer;
288
+ output: DataTransformer;
289
+ }
290
+ /**
291
+ * Transformer config accepted by cRPC.
292
+ */
293
+ type DataTransformerOptions = CombinedDataTransformer | DataTransformer;
294
+ //#endregion
295
+ //#region src/solid/client.d.ts
296
+ interface ConvexQueryClientOptions {
297
+ /** Auth store for checking auth state in queryFn */
298
+ authStore?: AuthStore;
299
+ /**
300
+ * Opt out of consistent SSR queries for faster performance.
301
+ * Trade-off: queries may return results from different timestamps.
302
+ */
303
+ dangerouslyUseInconsistentQueriesDuringSSR?: boolean;
304
+ /** TanStack QueryClient. Can also be set later via .connect(queryClient) */
305
+ queryClient?: QueryClient;
306
+ /** Custom fetch for SSR. Avoid bundling on client. */
307
+ serverFetch?: typeof globalThis.fetch;
308
+ /** Optional payload transformer (always composed with built-in Date support). */
309
+ transformer?: DataTransformerOptions;
310
+ /**
311
+ * Delay in ms before unsubscribing when a query has no observers.
312
+ * Prevents wasteful unsubscribe/subscribe cycles from component
313
+ * mount/unmount cycles and quick back/forward navigation.
314
+ * Set to 0 to unsubscribe immediately.
315
+ * @default 3000
316
+ */
317
+ unsubscribeDelay?: number;
318
+ }
319
+ /**
320
+ * Bridges TanStack Query with Convex real-time subscriptions (SolidJS).
321
+ *
322
+ * Uses `ConvexClient.onUpdate()` instead of `ConvexReactClient.watchQuery()`.
323
+ */
324
+ declare class ConvexQueryClient {
325
+ /** Convex client for WebSocket subscriptions (client) and one-shot queries */
326
+ convexClient: ConvexClient;
327
+ /**
328
+ * Active WebSocket subscriptions, keyed by TanStack query hash.
329
+ * Each subscription has:
330
+ * - getCurrentValue: getter for latest query result
331
+ * - unsubscribe: cleanup function to remove the subscription
332
+ * - queryKey: original query key for cache updates
333
+ * - lastError: most recent error from onError callback
334
+ */
335
+ subscriptions: Record<string, {
336
+ getCurrentValue: () => unknown;
337
+ unsubscribe: () => void;
338
+ queryKey: ['convexQuery', string, Record<string, unknown>];
339
+ lastError: unknown;
340
+ }>;
341
+ /** Cleanup function for QueryCache subscription */
342
+ unsubscribe: (() => void) | undefined;
343
+ /**
344
+ * Pending unsubscribes with timeout IDs.
345
+ * Used to debounce unsubscribe/subscribe cycles.
346
+ */
347
+ private pendingUnsubscribes;
348
+ /** HTTP client for SSR queries (no WebSocket on server) */
349
+ serverHttpClient?: ConvexHttpClient;
350
+ /** TanStack QueryClient reference */
351
+ _queryClient: QueryClient | undefined;
352
+ /** SSR query mode: 'consistent' guarantees same timestamp, 'inconsistent' is faster */
353
+ ssrQueryMode: 'consistent' | 'inconsistent';
354
+ /** Auth store for checking auth state */
355
+ private authStore?;
356
+ /** Delay before unsubscribing when query has no observers */
357
+ private unsubscribeDelay;
358
+ /** Payload transformer used across request/response boundaries. */
359
+ private transformer;
360
+ /** Stored URL for creating HTTP client on server */
361
+ private convexUrl;
362
+ /** Runtime-safe accessor for pending unsubscribe map (defensive for HMR edge cases) */
363
+ private getPendingUnsubscribesMap;
364
+ /** Cancel a pending delayed unsubscribe for a query hash. */
365
+ private cancelPendingUnsubscribe;
366
+ /** Unsubscribe a live Convex subscription (if present) and remove it from the subscription map. */
367
+ private unsubscribeQueryByHash;
368
+ /** Update auth store (for HMR where store may reset) */
369
+ updateAuthStore(authStore?: AuthStore): void;
370
+ /** Get current auth state from store */
371
+ private getAuthState;
372
+ /**
373
+ * Check if subscription should be skipped due to auth state.
374
+ * Needed for useSuspenseQuery which ignores enabled: false.
375
+ */
376
+ private shouldSkipSubscription;
377
+ /** Get QueryClient, throwing if not connected */
378
+ get queryClient(): QueryClient;
379
+ /**
380
+ * Create a ConvexQueryClient.
381
+ *
382
+ * @param client - Convex URL string or existing ConvexClient
383
+ * @param options - Configuration options
384
+ */
385
+ constructor(client: ConvexClient | string, options?: ConvexQueryClientOptions);
386
+ /**
387
+ * Connect to TanStack QueryClient.
388
+ * Starts listening to cache events for subscription management.
389
+ */
390
+ connect(queryClient: QueryClient): void;
391
+ /**
392
+ * Clean up all subscriptions.
393
+ * Call this when the client is no longer needed.
394
+ */
395
+ destroy(): void;
396
+ /**
397
+ * Unsubscribe from all auth-required queries.
398
+ * Call before logout to prevent UNAUTHORIZED errors during session invalidation.
399
+ */
400
+ unsubscribeAuthQueries(): void;
401
+ /**
402
+ * Batch update all subscriptions.
403
+ * Called internally when Convex client reconnects.
404
+ */
405
+ onUpdate: () => void;
406
+ /**
407
+ * Handle Convex subscription update for a specific query.
408
+ * Reads latest value from getCurrentValue and updates TanStack cache.
409
+ *
410
+ * @param queryHash - TanStack query hash identifying the query
411
+ */
412
+ onUpdateQueryKeyHash(queryHash: string): void;
413
+ /**
414
+ * Subscribe to TanStack QueryCache events.
415
+ * Creates/removes Convex WebSocket subscriptions as queries are added/removed.
416
+ *
417
+ * @param queryCache - TanStack QueryCache to subscribe to
418
+ * @returns Cleanup function to unsubscribe
419
+ */
420
+ subscribeInner(queryCache: QueryCache): () => void;
421
+ /**
422
+ * Create a WebSocket subscription via ConvexClient.onUpdate().
423
+ * Stores the subscription in the subscriptions map.
424
+ */
425
+ private createSubscription;
426
+ /**
427
+ * Create default queryFn for TanStack QueryClient.
428
+ *
429
+ * Handles:
430
+ * - Convex queries and actions
431
+ * - Auth checking (throws CRPCClientError if unauthorized)
432
+ * - SSR via HTTP client
433
+ * - Client via WebSocket client
434
+ *
435
+ * @param otherFetch - Fallback queryFn for non-Convex queries
436
+ * @returns QueryFunction compatible with TanStack Query
437
+ */
438
+ queryFn(otherFetch?: QueryFunction<unknown, QueryKey>): <T extends FunctionReference<"query", "public">>(context: QueryFunctionContext<readonly unknown[]>) => Promise<FunctionReturnType<T>>;
439
+ /**
440
+ * Create hash function for TanStack QueryClient.
441
+ *
442
+ * Uses Convex-specific hashing for Convex queries to ensure
443
+ * consistent cache keys across serialization.
444
+ *
445
+ * @param fallback - Fallback hash function for non-Convex queries
446
+ * @returns Hash function compatible with TanStack Query
447
+ */
448
+ hashFn(fallback?: (queryKey: readonly unknown[]) => string): (queryKey: readonly unknown[]) => string;
449
+ }
450
+ //#endregion
451
+ //#region src/internal/types.d.ts
452
+ /**
453
+ * Simplify complex type intersections for better IDE display.
454
+ * Pattern from Drizzle ORM: The & {} intersection "seals" the type to prevent
455
+ * distributive conditional behavior that can cause union widening.
456
+ * @see https://github.com/drizzle-team/drizzle-orm/blob/main/drizzle-orm/src/utils.ts#L144-L149
457
+ */
458
+ type Simplify<TType> = TType extends any[] | Date ? TType : { [K in keyof TType]: TType[K] } & {};
459
+ /**
460
+ * Omit keys without removing a potential union.
461
+ * Unlike standard Omit, this preserves union types.
462
+ */
463
+ type DistributiveOmit<TObj, TKey extends keyof any> = TObj extends any ? Omit<TObj, TKey> : never;
464
+ /** Makes the object recursively optional */
465
+ type DeepPartial<TObject> = TObject extends object ? { [P in keyof TObject]?: DeepPartial<TObject[P]> } : TObject;
466
+ //#endregion
467
+ //#region src/server/types.d.ts
468
+ /** Marker for unset values - branded type to distinguish "not set" from actual types */
469
+ type UnsetMarker = {
470
+ readonly __brand: 'UnsetMarker';
471
+ };
472
+ //#endregion
473
+ //#region src/server/http-types.d.ts
474
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
475
+ interface HttpRouteDefinition<TMethod extends HttpMethod = HttpMethod> {
476
+ method: TMethod;
477
+ path: string;
478
+ pathParamNames: string[];
479
+ usePathPrefix: boolean;
480
+ }
481
+ interface HttpActionHandler {
482
+ isHttp: true;
483
+ }
484
+ interface HttpProcedure<TInput extends UnsetMarker | z.ZodTypeAny = any, TOutput extends UnsetMarker | z.ZodTypeAny = any, TParams extends UnsetMarker | z.ZodTypeAny = any, TQuery extends UnsetMarker | z.ZodTypeAny = any, TMethod extends HttpMethod = HttpMethod, TForm extends UnsetMarker | z.ZodTypeAny = any> extends HttpActionHandler {
485
+ _crpcHttpRoute: HttpRouteDefinition<TMethod>;
486
+ /** @internal Expose def for client-side type inference */
487
+ _def: {
488
+ inputSchema?: TInput;
489
+ outputSchema?: TOutput;
490
+ paramsSchema?: TParams;
491
+ querySchema?: TQuery;
492
+ formSchema?: TForm;
493
+ };
494
+ }
495
+ //#endregion
496
+ //#region src/server/http-router.d.ts
497
+ /**
498
+ * Recursive router record - can contain procedures or nested routers
499
+ */
500
+ interface HttpRouterRecord {
501
+ [key: string]: HttpProcedure | HttpRouterRecord | CRPCHttpRouter<any>;
502
+ }
503
+ /**
504
+ * Router definition - stores both flat procedures and hierarchical record
505
+ */
506
+ interface HttpRouterDef<TRecord extends HttpRouterRecord> {
507
+ /** Flat map with dot-notation keys (e.g., "todos.get") for lookup */
508
+ procedures: Record<string, HttpProcedure>;
509
+ /** Hierarchical structure for type inference */
510
+ record: TRecord;
511
+ router: true;
512
+ }
513
+ /**
514
+ * HTTP Router - like tRPC's BuiltRouter
515
+ */
516
+ interface CRPCHttpRouter<TRecord extends HttpRouterRecord> {
517
+ _def: HttpRouterDef<TRecord>;
518
+ }
519
+ //#endregion
520
+ //#region src/crpc/http-types.d.ts
521
+ /** Error codes that can be returned from HTTP endpoints */
522
+ type HttpErrorCode = 'BAD_REQUEST' | 'UNAUTHORIZED' | 'FORBIDDEN' | 'NOT_FOUND' | 'METHOD_NOT_SUPPORTED' | 'CONFLICT' | 'UNPROCESSABLE_CONTENT' | 'TOO_MANY_REQUESTS' | 'INTERNAL_SERVER_ERROR' | 'UNKNOWN';
523
+ /** HTTP client error */
524
+ declare class HttpClientError extends Error {
525
+ readonly name = "HttpClientError";
526
+ readonly code: HttpErrorCode;
527
+ readonly status: number;
528
+ readonly procedureName: string;
529
+ constructor(opts: {
530
+ code: HttpErrorCode;
531
+ status: number;
532
+ procedureName: string;
533
+ message?: string;
534
+ });
535
+ }
536
+ //#endregion
537
+ //#region src/solid/crpc-types.d.ts
538
+ /** Stops callbacks from running. Matches convex/browser Unsubscribe<T>. */
539
+ type Unsubscribe<T> = {
540
+ /** Stop calling callback when query results change. */(): void; /** Stop calling callback when query results change. */
541
+ unsubscribe(): void; /** Get the last known value, possibly with local optimistic updates applied. */
542
+ getCurrentValue(): T | undefined;
543
+ };
544
+ /** Options returned by `convexQuery` factory */
545
+ type ConvexQueryOptions<T extends FunctionReference<'query'>> = Pick<SolidQueryOptions<FunctionReturnType<T>, Error, FunctionReturnType<T>, ConvexQueryKey<T>>, 'queryKey' | 'staleTime' | 'enabled'>;
546
+ /** Options returned by `convexAction` factory */
547
+ type ConvexActionOptions<T extends FunctionReference<'action'>> = Pick<SolidQueryOptions<FunctionReturnType<T>, Error, FunctionReturnType<T>, ConvexActionKey<T>>, 'queryKey' | 'staleTime' | 'enabled'>;
548
+ /** Query options parameter type */
549
+ type QueryOptsParam<T extends FunctionReference<'query'>> = Simplify<ConvexQueryHookOptions & DistributiveOmit<SolidQueryOptions<FunctionReturnType<T>, DefaultError>, ReservedQueryOptions$2>>;
550
+ /** Query options return type */
551
+ type QueryOptsReturn<T extends FunctionReference<'query'>> = ConvexQueryOptions<T> & {
552
+ meta: ConvexQueryMeta;
553
+ };
554
+ /** Action query options parameter type (actions don't support subscriptions) */
555
+ type ActionQueryOptsParam<T extends FunctionReference<'action'>> = DistributiveOmit<SolidQueryOptions<FunctionReturnType<T>, DefaultError>, ReservedQueryOptions$2>;
556
+ /** Action query options return type */
557
+ type ActionQueryOptsReturn<T extends FunctionReference<'action'>> = ConvexActionOptions<T>;
558
+ /**
559
+ * Decorated query procedure with queryOptions, queryKey, and queryFilter methods.
560
+ * Args are optional when the function has no required parameters.
561
+ * Supports skipToken for type-safe conditional queries.
562
+ */
563
+ type DecorateQuery<T extends FunctionReference<'query'>> = {
564
+ queryOptions: keyof FunctionArgs<T> extends never ? (args?: EmptyObject | SkipToken, opts?: QueryOptsParam<T>) => QueryOptsReturn<T> : EmptyObject extends FunctionArgs<T> ? (args?: FunctionArgs<T> | SkipToken, opts?: QueryOptsParam<T>) => QueryOptsReturn<T> : (args: FunctionArgs<T> | SkipToken, opts?: QueryOptsParam<T>) => QueryOptsReturn<T>; /** Static (non-hook) query options for event handlers and prefetching */
565
+ staticQueryOptions: keyof FunctionArgs<T> extends never ? (args?: EmptyObject | SkipToken, opts?: StaticQueryOptsParam) => ConvexQueryOptions<T> & {
566
+ meta: ConvexQueryMeta;
567
+ } : EmptyObject extends FunctionArgs<T> ? (args?: FunctionArgs<T> | SkipToken, opts?: StaticQueryOptsParam) => ConvexQueryOptions<T> & {
568
+ meta: ConvexQueryMeta;
569
+ } : (args: FunctionArgs<T> | SkipToken, opts?: StaticQueryOptsParam) => ConvexQueryOptions<T> & {
570
+ meta: ConvexQueryMeta;
571
+ }; /** Get query key for QueryClient methods (setQueryData, getQueryData, etc.) */
572
+ queryKey: (args?: DeepPartial<FunctionArgs<T>>) => ConvexQueryKey<T>; /** Get query filter for QueryClient methods (invalidateQueries, removeQueries, etc.) */
573
+ queryFilter: (args?: DeepPartial<FunctionArgs<T>>, filters?: DistributiveOmit<QueryFilters, 'queryKey'>) => QueryFilters;
574
+ };
575
+ /** Options for infinite query - extends TanStack Query options */
576
+ type InfiniteQueryOptsParam<T extends FunctionReference<'query'> = FunctionReference<'query'>> = {
577
+ /** Items per page. Optional - server uses .paginated() default if not provided. */limit?: number; /** Skip query silently when unauthenticated */
578
+ skipUnauth?: boolean; /** Placeholder data shown while loading (item array, not pagination result) */
579
+ placeholderData?: ExtractPaginatedItem<FunctionReturnType<T>>[];
580
+ } & DistributiveOmit<SolidQueryOptions<FunctionReturnType<T>, DefaultError>, ReservedInfiniteQueryOptions>;
581
+ /** Return type of infiniteQueryOptions - compatible with TanStack prefetch */
582
+ type ConvexInfiniteQueryOptions<T extends FunctionReference<'query'>> = Pick<SolidQueryOptions<FunctionReturnType<T>, Error, FunctionReturnType<T>, ConvexQueryKey<T>>, 'queryKey' | 'staleTime' | 'enabled'> & {
583
+ meta: ConvexInfiniteQueryMeta;
584
+ refetchInterval: false;
585
+ refetchOnMount: false;
586
+ refetchOnReconnect: false;
587
+ refetchOnWindowFocus: false; /** Placeholder data shown while loading (item array, not pagination result) */
588
+ placeholderData?: ExtractPaginatedItem<FunctionReturnType<T>>[];
589
+ } & DistributiveOmit<SolidQueryOptions<FunctionReturnType<T>, DefaultError>, ReservedInfiniteQueryOptions>;
590
+ /** Infinite query options with attached function reference (client-only) */
591
+ type ConvexInfiniteQueryOptionsWithRef<T extends FunctionReference<'query'>> = ConvexInfiniteQueryOptions<T> & {
592
+ [FUNC_REF_SYMBOL]: T;
593
+ };
594
+ /** Infinite query options return type */
595
+ type InfiniteQueryOptsReturn<T extends FunctionReference<'query'>> = ConvexInfiniteQueryOptionsWithRef<T>;
596
+ /**
597
+ * Decorated infinite query procedure.
598
+ * Only available on queries that have cursor/limit in their input (paginated).
599
+ * Supports skipToken for conditional queries.
600
+ * Args are optional when the function has no required parameters (besides cursor/limit).
601
+ */
602
+ type DecorateInfiniteQuery<T extends FunctionReference<'query'>> = {
603
+ /** Create infinite query options for useInfiniteQuery and prefetch */infiniteQueryOptions: keyof InfiniteQueryInput<FunctionArgs<T>> extends never ? (args?: EmptyObject | SkipToken, opts?: InfiniteQueryOptsParam<T>) => InfiniteQueryOptsReturn<T> : EmptyObject extends InfiniteQueryInput<FunctionArgs<T>> ? (args?: InfiniteQueryInput<FunctionArgs<T>> | SkipToken, opts?: InfiniteQueryOptsParam<T>) => InfiniteQueryOptsReturn<T> : (args: InfiniteQueryInput<FunctionArgs<T>> | SkipToken, opts?: InfiniteQueryOptsParam<T>) => InfiniteQueryOptsReturn<T>; /** Get query key for infinite query (QueryClient methods like setQueryData, getQueryData) */
604
+ infiniteQueryKey: (args?: DeepPartial<InfiniteQueryInput<FunctionArgs<T>>>) => ConvexQueryKey<T>; /** Function metadata from server (auth, limit, rateLimit, role, type) */
605
+ meta: PaginatedFnMeta;
606
+ };
607
+ /**
608
+ * Decorated mutation procedure with mutationOptions and mutationKey methods.
609
+ */
610
+ type DecorateMutation<T extends FunctionReference<'mutation'>> = {
611
+ mutationOptions: (opts?: DistributiveOmit<SolidMutationOptions<FunctionReturnType<T>, DefaultError, MutationVariables<T>>, ReservedMutationOptions$2>) => SolidMutationOptions<FunctionReturnType<T>, DefaultError, MutationVariables<T>>; /** Get mutation key for QueryClient methods */
612
+ mutationKey: () => ConvexMutationKey;
613
+ };
614
+ /**
615
+ * Decorated action procedure with queryOptions, mutationOptions, and key methods.
616
+ * Actions can be used as one-shot queries (no subscription) or as mutations.
617
+ * Supports skipToken for conditional queries.
618
+ */
619
+ type DecorateAction<T extends FunctionReference<'action'>> = {
620
+ /** Use action as a one-shot query (no WebSocket subscription) */queryOptions: keyof FunctionArgs<T> extends never ? (args?: EmptyObject | SkipToken, opts?: ActionQueryOptsParam<T>) => ActionQueryOptsReturn<T> : EmptyObject extends FunctionArgs<T> ? (args?: FunctionArgs<T> | SkipToken, opts?: ActionQueryOptsParam<T>) => ActionQueryOptsReturn<T> : (args: FunctionArgs<T> | SkipToken, opts?: ActionQueryOptsParam<T>) => ActionQueryOptsReturn<T>; /** Static (non-hook) action query options for event handlers and prefetching */
621
+ staticQueryOptions: keyof FunctionArgs<T> extends never ? (args?: EmptyObject | SkipToken, opts?: StaticQueryOptsParam) => ConvexActionOptions<T> & {
622
+ meta: ConvexQueryMeta;
623
+ } : EmptyObject extends FunctionArgs<T> ? (args?: FunctionArgs<T> | SkipToken, opts?: StaticQueryOptsParam) => ConvexActionOptions<T> & {
624
+ meta: ConvexQueryMeta;
625
+ } : (args: FunctionArgs<T> | SkipToken, opts?: StaticQueryOptsParam) => ConvexActionOptions<T> & {
626
+ meta: ConvexQueryMeta;
627
+ }; /** Use action as a mutation */
628
+ mutationOptions: (opts?: DistributiveOmit<SolidMutationOptions<FunctionReturnType<T>, DefaultError, MutationVariables<T>>, ReservedMutationOptions$2>) => SolidMutationOptions<FunctionReturnType<T>, DefaultError, MutationVariables<T>>; /** Get mutation key for QueryClient methods */
629
+ mutationKey: () => ConvexMutationKey; /** Get query key for QueryClient methods */
630
+ queryKey: (args?: DeepPartial<FunctionArgs<T>>) => ConvexActionKey<T>; /** Get query filter for QueryClient methods */
631
+ queryFilter: (args?: DeepPartial<FunctionArgs<T>>, filters?: DistributiveOmit<QueryFilters, 'queryKey'>) => QueryFilters;
632
+ };
633
+ /** Vanilla query - direct .query() and .onUpdate() calls without Solid Query */
634
+ type VanillaQuery<T extends FunctionReference<'query'>> = {
635
+ query: keyof FunctionArgs<T> extends never ? (args?: EmptyObject) => Promise<FunctionReturnType<T>> : EmptyObject extends FunctionArgs<T> ? (args?: FunctionArgs<T>) => Promise<FunctionReturnType<T>> : (args: FunctionArgs<T>) => Promise<FunctionReturnType<T>>;
636
+ onUpdate: keyof FunctionArgs<T> extends never ? (args?: EmptyObject, callback?: (result: FunctionReturnType<T>) => void, onError?: (e: Error) => void) => Unsubscribe<FunctionReturnType<T>> : EmptyObject extends FunctionArgs<T> ? (args?: FunctionArgs<T>, callback?: (result: FunctionReturnType<T>) => void, onError?: (e: Error) => void) => Unsubscribe<FunctionReturnType<T>> : (args: FunctionArgs<T>, callback: (result: FunctionReturnType<T>) => void, onError?: (e: Error) => void) => Unsubscribe<FunctionReturnType<T>>;
637
+ };
638
+ /**
639
+ * Recursively creates vanilla client type for direct procedural calls.
640
+ */
641
+ type VanillaCRPCClient<TApi> = { [K in keyof TApi as K extends string ? K extends `_${string}` ? never : K : K]: TApi[K] extends FunctionReference<'query'> ? VanillaQuery<TApi[K]> : TApi[K] extends FunctionReference<'mutation'> ? VanillaMutation<TApi[K]> : TApi[K] extends FunctionReference<'action'> ? VanillaAction<TApi[K]> : TApi[K] extends Record<string, unknown> ? VanillaCRPCClient<TApi[K]> : never };
642
+ /**
643
+ * Recursively decorates all procedures in a Convex API object.
644
+ */
645
+ type CRPCClient<TApi> = { [K in keyof TApi as K extends string ? K extends `_${string}` ? never : K : K]: TApi[K] extends FunctionReference<'query'> ? IsPaginated<FunctionArgs<TApi[K]>> extends true ? DecorateQuery<TApi[K]> & DecorateInfiniteQuery<TApi[K]> : DecorateQuery<TApi[K]> : TApi[K] extends FunctionReference<'mutation'> ? DecorateMutation<TApi[K]> : TApi[K] extends FunctionReference<'action'> ? DecorateAction<TApi[K]> : TApi[K] extends Record<string, unknown> ? CRPCClient<TApi[K]> : never };
646
+ //#endregion
647
+ //#region src/crpc/http-client.d.ts
648
+ /** Form value types (matches Hono's FormValue) */
649
+ type HttpFormValue = string | Blob;
650
+ /**
651
+ * Hybrid input args: JSON body fields at root, explicit params/searchParams/form.
652
+ * - JSON body: spread at root level (tRPC-style)
653
+ * - Path params: { params: { id: '123' } }
654
+ * - Query params: { searchParams: { limit: '10' } }
655
+ * - Form data: { form: { file: blob } } - typed via .form() builder
656
+ * - Client options: { headers, fetch, init } - for per-call customization
657
+ */
658
+ type HttpInputArgs = {
659
+ /** Path parameters (e.g., :id in /users/:id) */params?: Record<string, string>; /** Query string parameters */
660
+ searchParams?: Record<string, string | string[]>; /** Form data body (Content-Type: multipart/form-data) - typed via .form() builder */
661
+ form?: Record<string, HttpFormValue | HttpFormValue[]>; /** Custom fetch function (per-call override) */
662
+ fetch?: typeof fetch; /** Standard RequestInit (per-call override) */
663
+ init?: RequestInit; /** Additional headers (per-call override) */
664
+ headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>); /** Any other properties are JSON body fields */
665
+ [key: string]: unknown;
666
+ };
667
+ /**
668
+ * Client request options (matches Hono's ClientRequestOptions).
669
+ * Standard RequestInit in `init` takes highest priority and can override
670
+ * things that are set automatically like body, method, headers.
671
+ */
672
+ type HttpClientOptions = {
673
+ /** Custom fetch function */fetch?: typeof fetch;
674
+ /**
675
+ * Standard RequestInit - takes highest priority.
676
+ * Can override body, method, headers if needed.
677
+ */
678
+ init?: RequestInit; /** Additional headers (or async function returning headers) */
679
+ headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>);
680
+ };
681
+ //#endregion
682
+ //#region src/solid/http-proxy.d.ts
683
+ type HttpRouteInfo = {
684
+ path: string;
685
+ method: string;
686
+ };
687
+ type HttpRouteMap = Record<string, HttpRouteInfo>;
688
+ /** Infer schema type or return empty object if UnsetMarker */
689
+ type InferSchemaOrEmpty<T> = T extends UnsetMarker ? object : T extends z.ZodTypeAny ? z.infer<T> : object;
690
+ /** Infer merged input from HttpProcedure (flat - used internally) */
691
+ type InferHttpInput<T> = T extends HttpProcedure<infer TInput, infer _TOutput, infer TParams, infer TQuery> ? Simplify<InferSchemaOrEmpty<TParams> & InferSchemaOrEmpty<TQuery> & InferSchemaOrEmpty<TInput>> : object;
692
+ /**
693
+ * Extract string keys from a Zod object schema.
694
+ * Used for param/query which are always strings in URLs.
695
+ */
696
+ type ZodObjectKeys<T> = T extends z.ZodObject<infer Shape> ? { [K in keyof Shape]: string } : Record<string, string>;
697
+ /**
698
+ * Extract string or string[] keys from a Zod object schema.
699
+ * Query params can have array values.
700
+ */
701
+ type ZodQueryKeys<T> = T extends z.ZodObject<infer Shape> ? { [K in keyof Shape]?: string | string[] } : Record<string, string | string[]>;
702
+ /**
703
+ * Infer client-side args from HttpProcedure with proper nesting.
704
+ * - params: only present if TParams is defined, always strings (URL path params)
705
+ * - searchParams: only present if TQuery is defined, always strings (URL query params)
706
+ * - form: only present if TForm is defined, typed from schema
707
+ * - JSON body fields spread at root level (typed from schema)
708
+ * - Client options (fetch, init, headers) always optional for per-call overrides
709
+ */
710
+ type InferHttpClientArgs<T> = T extends HttpProcedure<infer TInput, infer _TOutput, infer TParams, infer TQuery, infer _TMethod, infer TForm> ? Simplify<(TParams extends UnsetMarker ? object : {
711
+ params: ZodObjectKeys<TParams>;
712
+ }) & (TQuery extends UnsetMarker ? object : {
713
+ searchParams: ZodQueryKeys<TQuery>;
714
+ }) & (TForm extends UnsetMarker ? object : TForm extends z.ZodTypeAny ? {
715
+ form: z.infer<TForm>;
716
+ } : object) & (TInput extends UnsetMarker ? object : TInput extends z.ZodTypeAny ? z.infer<TInput> : object) & {
717
+ fetch?: typeof fetch;
718
+ init?: RequestInit;
719
+ headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>);
720
+ }> : HttpInputArgs;
721
+ /** Infer output type from HttpProcedure */
722
+ type InferHttpOutput<T> = T extends HttpProcedure<infer _TInput, infer TOutput, infer _TParams, infer _TQuery> ? TOutput extends UnsetMarker ? unknown : TOutput extends z.ZodTypeAny ? z.infer<TOutput> : unknown : unknown;
723
+ /** Query key with args (3-element) or prefix key without args (2-element) for invalidation */
724
+ type HttpQueryKey = readonly ['httpQuery', string, unknown] | readonly ['httpQuery', string];
725
+ type HttpMutationKey = readonly ['httpMutation', string];
726
+ type ReservedQueryOptions$1 = 'queryKey' | 'queryFn';
727
+ type ReservedMutationOptions$1 = 'mutationFn';
728
+ /** Query options for GET HTTP endpoints - compatible with both createQuery and createSuspenseQuery */
729
+ type HttpQueryOptsReturn<T extends HttpProcedure> = Omit<SolidQueryOptions<InferHttpOutput<T>, Error, InferHttpOutput<T>, HttpQueryKey>, 'queryFn'> & {
730
+ queryFn: () => Promise<InferHttpOutput<T>>;
731
+ };
732
+ /** Mutation options for POST/PUT/PATCH/DELETE HTTP endpoints - typed variables */
733
+ type HttpMutationOptsReturn<T extends HttpProcedure> = SolidMutationOptions<InferHttpOutput<T>, DefaultError, InferHttpClientArgs<T>>;
734
+ /** Query options (TanStack Query only - client opts go in args) */
735
+ type HttpQueryOptions<T extends HttpProcedure> = DistributiveOmit<HttpQueryOptsReturn<T>, ReservedQueryOptions$1>;
736
+ /** Mutation options (TanStack Query only - client opts go in mutate args) */
737
+ type HttpMutationOptions<T extends HttpProcedure> = DistributiveOmit<HttpMutationOptsReturn<T>, ReservedMutationOptions$1>;
738
+ /**
739
+ * Decorated GET procedure with queryOptions and mutationOptions.
740
+ * - queryOptions: For cached data fetching (createQuery/createSuspenseQuery)
741
+ * - mutationOptions: For one-time actions like exports (createMutation)
742
+ */
743
+ type DecorateHttpQuery<T extends HttpProcedure> = {
744
+ queryOptions: keyof InferHttpInput<T> extends never ? (args?: InferHttpClientArgs<T>, opts?: HttpQueryOptions<T>) => HttpQueryOptsReturn<T> : object extends InferHttpInput<T> ? (args?: InferHttpClientArgs<T>, opts?: HttpQueryOptions<T>) => HttpQueryOptsReturn<T> : (args: InferHttpClientArgs<T>, opts?: HttpQueryOptions<T>) => HttpQueryOptsReturn<T>; /** Get query key for QueryClient methods (with args = exact match, without = prefix) */
745
+ queryKey: (args?: InferHttpClientArgs<T>) => HttpQueryKey; /** Get query filter for QueryClient methods (e.g., invalidateQueries) */
746
+ queryFilter: (args?: InferHttpClientArgs<T>, filters?: DistributiveOmit<QueryFilters, 'queryKey'>) => QueryFilters; /** Mutation options for GET endpoints (exports, downloads - no caching) */
747
+ mutationOptions: (opts?: HttpMutationOptions<T>) => HttpMutationOptsReturn<T>; /** Get mutation key for QueryClient methods */
748
+ mutationKey: () => HttpMutationKey;
749
+ };
750
+ /**
751
+ * Decorated POST/PUT/PATCH/DELETE procedure with mutationOptions.
752
+ * The mutationFn receives typed args inferred from server schemas.
753
+ */
754
+ type DecorateHttpMutation<T extends HttpProcedure> = {
755
+ mutationOptions: (opts?: HttpMutationOptions<T>) => HttpMutationOptsReturn<T>; /** Get mutation key for QueryClient methods */
756
+ mutationKey: () => HttpMutationKey;
757
+ };
758
+ /** Vanilla HTTP query - only direct call, no TanStack Query */
759
+ type VanillaHttpQuery<T extends HttpProcedure> = {
760
+ query: keyof InferHttpInput<T> extends never ? (args?: InferHttpClientArgs<T>) => Promise<InferHttpOutput<T>> : object extends InferHttpInput<T> ? (args?: InferHttpClientArgs<T>) => Promise<InferHttpOutput<T>> : (args: InferHttpClientArgs<T>) => Promise<InferHttpOutput<T>>;
761
+ };
762
+ /** Vanilla HTTP mutation - only direct call, no TanStack Query */
763
+ type VanillaHttpMutation<T extends HttpProcedure> = {
764
+ mutate: keyof InferHttpInput<T> extends never ? (args?: InferHttpClientArgs<T>) => Promise<InferHttpOutput<T>> : object extends InferHttpInput<T> ? (args?: InferHttpClientArgs<T>) => Promise<InferHttpOutput<T>> : (args: InferHttpClientArgs<T>) => Promise<InferHttpOutput<T>>;
765
+ };
766
+ /** Vanilla HTTP client type - only query/mutate methods */
767
+ type VanillaHttpCRPCClient<T extends HttpRouterRecord> = { [K in keyof T]: T[K] extends HttpProcedure<infer _TInput, infer _TOutput, infer _TParams, infer _TQuery, infer TMethod, infer _TForm> ? TMethod extends 'GET' ? VanillaHttpQuery<T[K]> : VanillaHttpMutation<T[K]> : T[K] extends CRPCHttpRouter<infer R> ? VanillaHttpCRPCClient<R> : T[K] extends HttpRouterRecord ? VanillaHttpCRPCClient<T[K]> : never };
768
+ /** Extract vanilla HTTP client from router */
769
+ type VanillaHttpCRPCClientFromRouter<T> = T extends CRPCHttpRouter<infer R> ? VanillaHttpCRPCClient<R> : never;
770
+ /**
771
+ * HTTP Client type from router record.
772
+ * Maps each procedure to queryOptions (GET) or mutationOptions (POST/etc).
773
+ * Uses infer to extract the method type literal for proper GET/non-GET distinction.
774
+ */
775
+ type HttpCRPCClient<T extends HttpRouterRecord> = { [K in keyof T]: T[K] extends HttpProcedure<infer _TInput, infer _TOutput, infer _TParams, infer _TQuery, infer TMethod, infer _TForm> ? TMethod extends 'GET' ? DecorateHttpQuery<T[K]> : DecorateHttpMutation<T[K]> : T[K] extends CRPCHttpRouter<infer R> ? HttpCRPCClient<R> : T[K] extends HttpRouterRecord ? HttpCRPCClient<T[K]> : never };
776
+ /**
777
+ * HTTP Client type from a CRPCHttpRouter.
778
+ * Use this when your type is the router object (with _def).
779
+ */
780
+ type HttpCRPCClientFromRouter<TRouter extends CRPCHttpRouter<any>> = HttpCRPCClient<TRouter['_def']['record']>;
781
+ interface HttpProxyOptions<TRoutes extends HttpRouteMap> {
782
+ /** Base URL for the Convex HTTP API (e.g., https://your-site.convex.site) */
783
+ convexSiteUrl: string;
784
+ /** Custom fetch function (defaults to global fetch) */
785
+ fetch?: typeof fetch;
786
+ /** Default headers or async function returning headers (for auth tokens) */
787
+ headers?: {
788
+ [key: string]: string | undefined;
789
+ } | (() => {
790
+ [key: string]: string | undefined;
791
+ } | Promise<{
792
+ [key: string]: string | undefined;
793
+ }>);
794
+ /** Error handler called on HTTP errors */
795
+ onError?: (error: HttpClientError) => void;
796
+ /** Runtime route definitions (from codegen httpRoutes) */
797
+ routes: TRoutes;
798
+ /** Optional payload transformer (always composed with built-in Date support). */
799
+ transformer?: DataTransformerOptions;
800
+ }
801
+ /**
802
+ * Create an HTTP proxy with TanStack Query integration for SolidJS.
803
+ *
804
+ * Returns a proxy that provides:
805
+ * - `queryOptions` for GET endpoints (no subscription)
806
+ * - `mutationOptions` for POST/PUT/PATCH/DELETE endpoints
807
+ *
808
+ * @example
809
+ * ```ts
810
+ * const httpProxy = createHttpProxy<AppRouter>({
811
+ * convexSiteUrl: import.meta.env.VITE_CONVEX_SITE_URL,
812
+ * routes: httpRoutes,
813
+ * });
814
+ *
815
+ * // GET endpoint
816
+ * const opts = httpProxy.todos.get.queryOptions({ id: '123' });
817
+ * const query = createQuery(() => opts);
818
+ *
819
+ * // POST endpoint
820
+ * const mutation = createMutation(() => httpProxy.todos.create.mutationOptions());
821
+ * await mutation.mutateAsync({ title: 'New todo' });
822
+ * ```
823
+ */
824
+ declare function createHttpProxy<TRouter extends CRPCHttpRouter<any>, TRoutes extends HttpRouteMap = HttpRouteMap>(opts: HttpProxyOptions<TRoutes>): HttpCRPCClientFromRouter<TRouter>;
825
+ //#endregion
826
+ //#region src/solid/context.d.ts
827
+ /** Access ConvexQueryClient (e.g., for logout cleanup) */
828
+ declare const useConvexQueryClient: () => ConvexQueryClient | null;
829
+ /** Headers record that allows empty objects and optional properties */
830
+ type HeadersInput = {
831
+ [key: string]: string | undefined;
832
+ };
833
+ type CRPCHttpOptions = {
834
+ /** Base URL for the Convex HTTP API (e.g., https://your-site.convex.site) */convexSiteUrl: string; /** Default headers or async function returning headers (for auth tokens) */
835
+ headers?: HeadersInput | (() => HeadersInput | Promise<HeadersInput>); /** Custom fetch function (defaults to global fetch) */
836
+ fetch?: typeof fetch; /** Error handler called on HTTP errors */
837
+ onError?: (error: HttpClientError) => void;
838
+ };
839
+ type CreateCRPCContextOptions<TApi> = {
840
+ api: TApi; /** Optional payload transformer (always composed with built-in Date support). */
841
+ transformer?: DataTransformerOptions;
842
+ } & Partial<CRPCHttpOptions>;
843
+ /**
844
+ * Extract HTTP router from TApi['http'] if present (optional).
845
+ * Uses NonNullable to handle optional http property.
846
+ */
847
+ type ExtractHttpRouter<TApi> = TApi extends {
848
+ http?: infer R;
849
+ } ? NonNullable<R> extends CRPCHttpRouter<HttpRouterRecord> ? NonNullable<R> : undefined : undefined;
850
+ /**
851
+ * Create CRPC context, provider, and hooks for a Convex API.
852
+ *
853
+ * @param options - Configuration object containing api and optional HTTP settings
854
+ * @returns Object with CRPCProvider, useCRPC, and useCRPCClient
855
+ *
856
+ * @example
857
+ * ```tsx
858
+ * // lib/crpc.ts
859
+ * import { api } from '@convex/api';
860
+ * import { createCRPCContext } from 'kitcn/solid';
861
+ *
862
+ * // Works for both regular Convex functions and generated HTTP router types
863
+ * export const { useCRPC } = createCRPCContext({
864
+ * api,
865
+ * convexSiteUrl: import.meta.env.VITE_CONVEX_SITE_URL,
866
+ * });
867
+ *
868
+ * // components/user-profile.tsx
869
+ * function UserProfile({ id }) {
870
+ * const crpc = useCRPC();
871
+ * const { data } = createQuery(() => crpc.user.get.queryOptions({ id }));
872
+ *
873
+ * // HTTP endpoints (if configured)
874
+ * const { data: httpData } = createQuery(() => crpc.http.todos.get.queryOptions({ id }));
875
+ * }
876
+ * ```
877
+ */
878
+ declare function createCRPCContext<TApi extends Record<string, unknown>>(options: CreateCRPCContextOptions<TApi>): {
879
+ CRPCProvider: (props: {
880
+ children: JSX.Element;
881
+ convexClient: ConvexClient;
882
+ convexQueryClient: ConvexQueryClient;
883
+ }) => JSX.Element;
884
+ useCRPC: () => ExtractHttpRouter<TApi> extends CRPCHttpRouter<HttpRouterRecord> ? CRPCClient<Omit<TApi, "http">> & {
885
+ http: HttpCRPCClientFromRouter<ExtractHttpRouter<TApi>>;
886
+ } : CRPCClient<TApi>;
887
+ useCRPCClient: () => ExtractHttpRouter<TApi> extends CRPCHttpRouter<HttpRouterRecord> ? VanillaCRPCClient<Omit<TApi, "http">> & {
888
+ http: VanillaHttpCRPCClientFromRouter<ExtractHttpRouter<TApi>>;
889
+ } : VanillaCRPCClient<TApi>;
890
+ };
891
+ //#endregion
892
+ //#region src/solid/types.d.ts
893
+ type CrossDomainClient = ReturnType<typeof crossDomainClient>;
894
+ type ConvexClient$1 = ReturnType<typeof convexClient>;
895
+ type PluginsWithCrossDomain = (CrossDomainClient | ConvexClient$1 | BetterAuthClientPlugin)[];
896
+ type PluginsWithoutCrossDomain = (ConvexClient$1 | BetterAuthClientPlugin)[];
897
+ type AuthClientWithPlugins<Plugins extends PluginsWithCrossDomain | PluginsWithoutCrossDomain> = ReturnType<typeof createAuthClient<BetterAuthClientPlugin & {
898
+ plugins: Plugins;
899
+ }>>;
900
+ type SolidAuthClient = AuthClientWithPlugins<PluginsWithCrossDomain> | AuthClientWithPlugins<PluginsWithoutCrossDomain>;
901
+ //#endregion
902
+ //#region src/solid/convex-auth-provider.d.ts
903
+ type ConvexAuthProviderProps = {
904
+ children: JSX.Element; /** Convex client instance */
905
+ client: ConvexClient; /** Better Auth client instance */
906
+ authClient: SolidAuthClient; /** Initial session token (from SSR) */
907
+ initialToken?: string; /** Callback when mutation called while unauthorized */
908
+ onMutationUnauthorized?: () => void; /** Callback when query called while unauthorized */
909
+ onQueryUnauthorized?: (info: {
910
+ queryName: string;
911
+ }) => void; /** Custom function to detect UNAUTHORIZED errors. Default checks code property. */
912
+ isUnauthorized?: (error: unknown) => boolean;
913
+ };
914
+ /**
915
+ * Unified auth provider for Convex + Better Auth (SolidJS).
916
+ * Handles token sync and auth callbacks.
917
+ *
918
+ * Structure: AuthProvider wraps ConvexAuthProviderInner so that
919
+ * useAuthStore() is available when creating fetchAccessToken.
920
+ */
921
+ declare function ConvexAuthProvider(props: ConvexAuthProviderProps): JSX.Element;
922
+ //#endregion
923
+ //#region src/solid/convex-solid.d.ts
924
+ /** Get the ConvexClient instance from context */
925
+ declare function useConvex(): ConvexClient;
926
+ declare function ConvexProvider(props: ParentProps<{
927
+ client: ConvexClient;
928
+ }>): solid_js0.JSX.Element;
929
+ declare function ConvexProviderWithAuth(props: ParentProps<{
930
+ client: ConvexClient;
931
+ useAuth: () => {
932
+ isLoading: boolean;
933
+ isAuthenticated: boolean;
934
+ fetchAccessToken: AuthTokenFetcher;
935
+ };
936
+ }>): solid_js0.JSX.Element;
937
+ /** Hook returning auth state from Convex */
938
+ declare function useConvexAuth(): {
939
+ isLoading: boolean;
940
+ isAuthenticated: boolean;
941
+ };
942
+ //#endregion
943
+ //#region src/server/caller.d.ts
944
+ /** Metadata for a single function */
945
+ type FnMeta = {
946
+ type?: 'query' | 'mutation' | 'action';
947
+ [key: string]: unknown;
948
+ };
949
+ /** Metadata for all functions in a module */
950
+ type ModuleMeta = Record<string, FnMeta>;
951
+ /** Metadata for all modules - from generated `@convex/api` */
952
+ type CallerMeta = Record<string, ModuleMeta>;
953
+ //#endregion
954
+ //#region src/solid/proxy.d.ts
955
+ /**
956
+ * Create a CRPC proxy for a Convex API object.
957
+ *
958
+ * The proxy provides a tRPC-like interface for accessing Convex functions
959
+ * with TanStack Query options builders.
960
+ *
961
+ * @param api - The Convex API object (from `@convex/api`)
962
+ * @param meta - Generated function metadata for runtime type detection
963
+ * @returns A typed proxy with queryOptions/mutationOptions methods
964
+ *
965
+ * @example
966
+ * ```tsx
967
+ * import { api } from '@convex/api';
968
+ *
969
+ * // Usually you should use createCRPCContext({ api }) instead.
970
+ * // createCRPCOptionsProxy is a low-level helper.
971
+ * const crpc = createCRPCOptionsProxy(api, {} as any);
972
+ *
973
+ * function MyComponent() {
974
+ * const { data } = useQuery(crpc.user.get.queryOptions({ id }));
975
+ * const { mutate } = useMutation(crpc.user.update.mutationOptions());
976
+ * }
977
+ * ```
978
+ */
979
+ declare function createCRPCOptionsProxy<TApi extends Record<string, unknown>>(api: TApi, meta: CallerMeta, transformer?: DataTransformerOptions): CRPCClient<TApi>;
980
+ //#endregion
981
+ //#region src/solid/singleton.d.ts
982
+ type QueryClientFactory = () => QueryClient;
983
+ /** Get/create QueryClient singleton (fresh on SSR, singleton on client) */
984
+ declare const getQueryClientSingleton: (factory: QueryClientFactory, symbolKey?: string) => QueryClient;
985
+ type ConvexQueryClientSingletonOptions = {
986
+ authStore?: AuthStore;
987
+ convex: ConvexClient;
988
+ queryClient: QueryClient;
989
+ symbolKey?: string;
990
+ /**
991
+ * Delay in ms before unsubscribing when a query has no observers.
992
+ * @default 3000
993
+ */
994
+ unsubscribeDelay?: number; /** Optional payload transformer (always composed with built-in Date support). */
995
+ transformer?: DataTransformerOptions;
996
+ };
997
+ /** Get/create ConvexQueryClient singleton (fresh on SSR, singleton on client) */
998
+ declare const getConvexQueryClientSingleton: ({
999
+ authStore,
1000
+ convex,
1001
+ queryClient,
1002
+ symbolKey,
1003
+ unsubscribeDelay,
1004
+ transformer
1005
+ }: ConvexQueryClientSingletonOptions) => ConvexQueryClient;
1006
+ //#endregion
1007
+ //#region src/solid/use-infinite-query.d.ts
1008
+ /**
1009
+ * Pagination state persisted in queryClient.
1010
+ * Enables scroll restoration when navigating back to a paginated list.
1011
+ *
1012
+ * Uses flat { cursor, limit } structure like tRPC.
1013
+ */
1014
+ type PaginationState = {
1015
+ id: number;
1016
+ nextPageKey: number;
1017
+ pageKeys: number[];
1018
+ queries: Record<number, {
1019
+ /** Flat pagination args - tRPC style */args: Record<string, unknown> & {
1020
+ cursor: string | null;
1021
+ limit?: number; /** Internal pagination ID for subscription management */
1022
+ __paginationId?: number;
1023
+ };
1024
+ endCursor?: string | null;
1025
+ }>;
1026
+ version: number; /** Recovery key to prevent infinite recovery loops */
1027
+ autoRecoveryAttempted?: string;
1028
+ };
1029
+ type PaginationStatus = 'CanLoadMore' | 'Exhausted' | 'LoadingFirstPage' | 'LoadingMore';
1030
+ /** Return type for infinite query hooks */
1031
+ type UseInfiniteQueryResult<T> = {
1032
+ /** Flattened array of all loaded items */data: T[]; /** The combined error from all pages */
1033
+ error: Error | null; /** Whether fetching next page failed */
1034
+ isFetchNextPageError: boolean; /** Whether any page has an error */
1035
+ isError: boolean; /** Whether any page is fetching */
1036
+ isFetching: boolean; /** Whether the query is fetching the next page */
1037
+ isFetchingNextPage: boolean; /** Whether the first page is loading */
1038
+ isLoading: boolean; /** Whether data is placeholder data */
1039
+ isPlaceholderData: boolean; /** Whether the query is refetching */
1040
+ isRefetching: boolean; /** Failure reason */
1041
+ failureReason: Error | null; /** Fetch the next page */
1042
+ fetchNextPage: (limit?: number) => void; /** Whether the query has a next page */
1043
+ hasNextPage: boolean; /** Array of page arrays (raw, not flattened) */
1044
+ pages: T[][]; /** Current pagination status */
1045
+ status: PaginationStatus;
1046
+ };
1047
+ /**
1048
+ * Infinite query hook using cRPC-style options.
1049
+ * Accepts options from `crpc.posts.list.infiniteQueryOptions()`.
1050
+ *
1051
+ * @example
1052
+ * ```tsx
1053
+ * const crpc = useCRPC();
1054
+ * const { data, fetchNextPage } = useInfiniteQuery(
1055
+ * crpc.posts.list.infiniteQueryOptions({ userId }, { limit: 20 })
1056
+ * );
1057
+ * ```
1058
+ */
1059
+ declare function useInfiniteQuery<T extends FunctionReference<'query'>, TItem = ExtractPaginatedItem<FunctionReturnType<T>>>(infiniteOptions: ConvexInfiniteQueryOptionsWithRef<T>): UseInfiniteQueryResult<TItem>;
1060
+ //#endregion
1061
+ //#region src/solid/use-query-options.d.ts
1062
+ type ReservedQueryOptions = 'queryKey' | 'queryFn' | 'staleTime';
1063
+ type ReservedMutationOptions = 'mutationFn';
1064
+ /**
1065
+ * Hook that returns query options for use with useQuery.
1066
+ * Handles skipUnauth by setting enabled: false when unauthorized.
1067
+ *
1068
+ * @example
1069
+ * ```tsx
1070
+ * const { data } = useQuery(useConvexQueryOptions(api.user.get, { id }));
1071
+ * ```
1072
+ *
1073
+ * @example With skipToken for conditional queries
1074
+ * ```tsx
1075
+ * const { data } = useQuery(useConvexQueryOptions(api.user.get, userId ? { id: userId } : skipToken));
1076
+ * ```
1077
+ *
1078
+ * @example With skipUnauth
1079
+ * ```tsx
1080
+ * const { data } = useQuery(useConvexQueryOptions(api.user.get, { id }, { skipUnauth: true }));
1081
+ * ```
1082
+ *
1083
+ * @example With TanStack Query options
1084
+ * ```tsx
1085
+ * const { data } = useQuery(useConvexQueryOptions(api.user.get, { id }, { enabled: !!id, placeholderData: [] }));
1086
+ * ```
1087
+ */
1088
+ declare function useConvexQueryOptions<T extends FunctionReference<'query'>>(funcRef: T, args: FunctionArgs<T> | SkipToken, options?: ConvexQueryHookOptions & DistributiveOmit<SolidQueryOptions<FunctionReturnType<T>, DefaultError>, ReservedQueryOptions>): ConvexQueryOptions<T> & {
1089
+ meta: ConvexQueryMeta;
1090
+ };
1091
+ /**
1092
+ * Hook that returns infinite query options for use with useInfiniteQuery.
1093
+ * Handles auth type detection from meta and skipUnauth.
1094
+ *
1095
+ * @example
1096
+ * ```tsx
1097
+ * const { data } = useInfiniteQuery(
1098
+ * useConvexInfiniteQueryOptions(api.posts.list, { userId }, { limit: 20 })
1099
+ * );
1100
+ * ```
1101
+ *
1102
+ * @example With skipToken for conditional queries
1103
+ * ```tsx
1104
+ * const { data } = useInfiniteQuery(
1105
+ * useConvexInfiniteQueryOptions(api.posts.list, userId ? { userId } : skipToken, { limit: 20 })
1106
+ * );
1107
+ * ```
1108
+ *
1109
+ * @example With skipUnauth
1110
+ * ```tsx
1111
+ * const { data } = useInfiniteQuery(
1112
+ * useConvexInfiniteQueryOptions(api.posts.list, { userId }, { limit: 20, skipUnauth: true })
1113
+ * );
1114
+ * ```
1115
+ */
1116
+ declare function useConvexInfiniteQueryOptions<T extends FunctionReference<'query'>>(funcRef: T, args: InfiniteQueryInput<FunctionArgs<T>> | SkipToken, opts: InfiniteQueryOptsParam<T>): ConvexInfiniteQueryOptions<T>;
1117
+ /**
1118
+ * Hook that returns query options for using an action as a one-shot query.
1119
+ * Actions don't support WebSocket subscriptions - they're one-time calls.
1120
+ *
1121
+ * @example
1122
+ * ```tsx
1123
+ * const { data } = useQuery(useConvexActionQueryOptions(api.ai.analyze, { id }));
1124
+ * ```
1125
+ *
1126
+ * @example With skipToken for conditional queries
1127
+ * ```tsx
1128
+ * const { data } = useQuery(useConvexActionQueryOptions(api.ai.analyze, id ? { id } : skipToken));
1129
+ * ```
1130
+ *
1131
+ * @example With skipUnauth
1132
+ * ```tsx
1133
+ * const { data } = useQuery(useConvexActionQueryOptions(api.ai.analyze, { id }, { skipUnauth: true }));
1134
+ * ```
1135
+ */
1136
+ declare function useConvexActionQueryOptions<Action extends FunctionReference<'action'>>(action: Action, args: FunctionArgs<Action> | SkipToken, options?: {
1137
+ skipUnauth?: boolean;
1138
+ } & DistributiveOmit<SolidQueryOptions<FunctionReturnType<Action>, DefaultError>, ReservedQueryOptions>): ConvexActionOptions<Action>;
1139
+ /**
1140
+ * Hook that returns mutation options for use with useMutation.
1141
+ * Wraps the Convex mutation with auth guard logic.
1142
+ *
1143
+ * @example
1144
+ * ```tsx
1145
+ * const { mutate } = useMutation(useConvexMutationOptions(api.user.update));
1146
+ * ```
1147
+ *
1148
+ * @example With TanStack Query options
1149
+ * ```tsx
1150
+ * const { mutate } = useMutation(useConvexMutationOptions(api.user.update, {
1151
+ * onSuccess: () => toast.success('Updated!'),
1152
+ * }));
1153
+ * ```
1154
+ */
1155
+ declare function useConvexMutationOptions<Mutation extends FunctionReference<'mutation'>>(mutation: Mutation, options?: DistributiveOmit<SolidMutationOptions<FunctionReturnType<Mutation>, DefaultError, FunctionArgs<Mutation>>, ReservedMutationOptions>, transformer?: DataTransformerOptions): SolidMutationOptions<FunctionReturnType<Mutation>, DefaultError, FunctionArgs<Mutation>>;
1156
+ /**
1157
+ * Hook that returns action options for use with useMutation.
1158
+ * Wraps the Convex action with auth guard logic.
1159
+ *
1160
+ * @example
1161
+ * ```tsx
1162
+ * const { mutate } = useMutation(useConvexActionOptions(api.ai.generate));
1163
+ * ```
1164
+ *
1165
+ * @example With TanStack Query options
1166
+ * ```tsx
1167
+ * const { mutate } = useMutation(useConvexActionOptions(api.ai.generate, {
1168
+ * onSuccess: (data) => console.info(data),
1169
+ * }));
1170
+ * ```
1171
+ */
1172
+ declare function useConvexActionOptions<Action extends FunctionReference<'action'>>(action: Action, options?: DistributiveOmit<SolidMutationOptions<FunctionReturnType<Action>, DefaultError, FunctionArgs<Action>>, ReservedMutationOptions>, transformer?: DataTransformerOptions): SolidMutationOptions<FunctionReturnType<Action>, DefaultError, FunctionArgs<Action>>;
1173
+ /**
1174
+ * Hook that returns upload mutation options for use with useMutation.
1175
+ * Generates a presigned URL, then uploads the file directly to storage.
1176
+ *
1177
+ * @example
1178
+ * ```tsx
1179
+ * const { mutate } = useMutation(useUploadMutationOptions(api.storage.generateUrl));
1180
+ * mutate({ file, ...otherArgs });
1181
+ * ```
1182
+ *
1183
+ * @example With TanStack Query options
1184
+ * ```tsx
1185
+ * const { mutate } = useMutation(useUploadMutationOptions(api.storage.generateUrl, {
1186
+ * onSuccess: (result) => console.info('Uploaded:', result.key),
1187
+ * }));
1188
+ * ```
1189
+ */
1190
+ declare function useUploadMutationOptions<TGenerateUrlMutation extends FunctionReference<'mutation', 'public', any, {
1191
+ key: string;
1192
+ url: string;
1193
+ }>>(generateUrlMutation: TGenerateUrlMutation, options?: DistributiveOmit<SolidMutationOptions<FunctionReturnType<TGenerateUrlMutation>, DefaultError, {
1194
+ file: File;
1195
+ } & FunctionArgs<TGenerateUrlMutation>>, ReservedMutationOptions>): SolidMutationOptions<FunctionReturnType<TGenerateUrlMutation>, DefaultError, {
1196
+ file: File;
1197
+ } & FunctionArgs<TGenerateUrlMutation>>;
1198
+ //#endregion
1199
+ //#region src/solid/vanilla-client.d.ts
1200
+ /**
1201
+ * Create a vanilla CRPC proxy for direct procedural calls.
1202
+ *
1203
+ * The proxy provides a tRPC-like interface for imperative Convex function calls.
1204
+ *
1205
+ * @param api - The Convex API object (from `@convex/api`)
1206
+ * @param meta - Generated function metadata for runtime type detection
1207
+ * @param convexClient - The ConvexClient instance
1208
+ * @returns A typed proxy with query/mutate methods
1209
+ *
1210
+ * @example
1211
+ * ```tsx
1212
+ * const client = createVanillaCRPCProxy(api, meta, convexClient);
1213
+ *
1214
+ * // Direct calls (no Solid Query)
1215
+ * const user = await client.user.get.query({ id });
1216
+ * await client.user.update.mutate({ id, name: 'test' });
1217
+ * ```
1218
+ */
1219
+ declare function createVanillaCRPCProxy<TApi extends Record<string, unknown>>(api: TApi, meta: CallerMeta, convexClient: ConvexClient, transformer?: DataTransformerOptions): VanillaCRPCClient<TApi>;
1220
+ //#endregion
1221
+ export { AuthMutationError, AuthProvider, AuthStore, AuthStoreState, AuthType, Authenticated, CRPCClient, CRPCHttpOptions, ConvexActionOptions, ConvexAuthBridge, ConvexAuthProvider, ConvexAuthProviderProps, ConvexInfiniteQueryOptions, ConvexInfiniteQueryOptionsWithRef, ConvexProvider, ConvexProviderWithAuth, ConvexQueryClient, ConvexQueryClientOptions, ConvexQueryClientSingletonOptions, ConvexQueryOptions, CreateCRPCContextOptions, DecorateAction, DecorateInfiniteQuery, DecorateMutation, DecorateQuery, FetchAccessTokenContext, FetchAccessTokenFn, HttpCRPCClient, HttpCRPCClientFromRouter, type HttpClientOptions, type HttpFormValue, type HttpInputArgs, HttpMutationKey, HttpProxyOptions, HttpQueryKey, HttpRouteInfo, HttpRouteMap, InfiniteQueryOptsParam, MaybeAuthenticated, MaybeUnauthenticated, MetaContext, PaginationState, PaginationStatus, SolidAuthClient, Unauthenticated, Unsubscribe, UseInfiniteQueryResult, VanillaCRPCClient, VanillaHttpCRPCClient, VanillaHttpCRPCClientFromRouter, VanillaQuery, createAuthMutations, createCRPCContext, createCRPCOptionsProxy, createHttpProxy, createVanillaCRPCProxy, decodeJwtExp, getAuthType, getConvexQueryClientSingleton, getQueryClientSingleton, isAuthMutationError, useAuth, useAuthGuard, useAuthSkip, useAuthStore, useAuthValue, useConvex, useConvexActionOptions, useConvexActionQueryOptions, useConvexAuth, useConvexAuthBridge, useConvexInfiniteQueryOptions, useConvexMutationOptions, useConvexQueryClient, useConvexQueryOptions, useFetchAccessToken, useFnMeta, useInfiniteQuery, useIsAuth, useMaybeAuth, useMeta, useSafeConvexAuth, useUploadMutationOptions };