kitcn 0.15.2 → 0.15.4

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.
@@ -1,4 +1,4 @@
1
- import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial, dn as ConvexTableWithColumns, tr as ConvexTextBuilderInitial } from "../where-clause-compiler-DLiYI2EF.js";
1
+ import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial, dn as ConvexTableWithColumns, tr as ConvexTextBuilderInitial } from "../where-clause-compiler-Dv-3mnJF.js";
2
2
  import * as convex_values0 from "convex/values";
3
3
  import { GenericId, Infer, Value } from "convex/values";
4
4
  import { DocumentByName, GenericDataModel, GenericDatabaseReader, GenericDatabaseWriter, TableNamesInDataModel } from "convex/server";
@@ -1,4 +1,5 @@
1
1
  'use client';
2
+ import { r as AuthStore } from "../../auth-store-B_ARzzEX.js";
2
3
  import { ConvexReactClient } from "convex/react";
3
4
  import { ReactNode } from "react";
4
5
  import * as react_jsx_runtime0 from "react/jsx-runtime";
@@ -314,10 +315,14 @@ type AuthClientWithPlugins<Plugins extends PluginsWithCrossDomain | PluginsWitho
314
315
  type AuthClient = AuthClientWithPlugins<PluginsWithCrossDomain> | AuthClientWithPlugins<PluginsWithoutCrossDomain>;
315
316
  //#endregion
316
317
  //#region src/auth-client/convex-auth-provider.d.ts
318
+ type ConvexAuthProviderQueryClient = {
319
+ updateAuthStore: (authStore?: AuthStore) => void;
320
+ };
317
321
  type ConvexAuthProviderProps = {
318
322
  children: ReactNode; /** Convex client instance */
319
323
  client: ConvexReactClient; /** Better Auth client instance */
320
- authClient: AuthClient; /** Initial session token (from SSR) */
324
+ authClient: AuthClient; /** Shared Convex query client to sync with auth state */
325
+ convexQueryClient?: ConvexAuthProviderQueryClient; /** Initial session token (from SSR) */
321
326
  initialToken?: string; /** Callback when mutation called while unauthorized */
322
327
  onMutationUnauthorized?: () => void; /** Callback when query called while unauthorized */
323
328
  onQueryUnauthorized?: (info: {
@@ -336,10 +341,11 @@ declare function ConvexAuthProvider({
336
341
  children,
337
342
  client,
338
343
  authClient,
344
+ convexQueryClient,
339
345
  initialToken,
340
346
  onMutationUnauthorized,
341
347
  onQueryUnauthorized,
342
348
  isUnauthorized
343
349
  }: ConvexAuthProviderProps): react_jsx_runtime0.JSX.Element;
344
350
  //#endregion
345
- export { type AuthClient, type AuthClientWithPlugins, ConvexAuthProvider, ConvexAuthProviderProps, type PluginsWithCrossDomain, type PluginsWithoutCrossDomain, convexClient };
351
+ export { type AuthClient, type AuthClientWithPlugins, ConvexAuthProvider, ConvexAuthProviderProps, ConvexAuthProviderQueryClient, type PluginsWithCrossDomain, type PluginsWithoutCrossDomain, convexClient };
@@ -77,7 +77,7 @@ const clearSessionAtom = (authClient) => {
77
77
  * Structure: AuthProvider wraps ConvexAuthProviderInner so that
78
78
  * useAuthStore() is available when creating fetchAccessToken.
79
79
  */
80
- function ConvexAuthProvider({ children, client, authClient, initialToken, onMutationUnauthorized, onQueryUnauthorized, isUnauthorized }) {
80
+ function ConvexAuthProvider({ children, client, authClient, convexQueryClient, initialToken, onMutationUnauthorized, onQueryUnauthorized, isUnauthorized }) {
81
81
  useOTTHandler(authClient);
82
82
  return /* @__PURE__ */ jsx(AuthProvider, {
83
83
  initialValues: useMemo(() => ({
@@ -90,6 +90,7 @@ function ConvexAuthProvider({ children, client, authClient, initialToken, onMuta
90
90
  children: /* @__PURE__ */ jsx(ConvexAuthProviderInner, {
91
91
  authClient,
92
92
  client,
93
+ convexQueryClient,
93
94
  children
94
95
  })
95
96
  });
@@ -98,8 +99,9 @@ function ConvexAuthProvider({ children, client, authClient, initialToken, onMuta
98
99
  * Inner provider that has access to AuthStore via useAuthStore().
99
100
  * Creates fetchAccessToken and passes it through context (no race condition).
100
101
  */
101
- function ConvexAuthProviderInner({ children, client, authClient }) {
102
+ function ConvexAuthProviderInner({ children, client, authClient, convexQueryClient }) {
102
103
  const authStore = useAuthStore();
104
+ convexQueryClient?.updateAuthStore(authStore);
103
105
  const { data: session, isPending } = authClient.useSession();
104
106
  const sessionRef = useRef(session);
105
107
  const isPendingRef = useRef(isPending);
@@ -1,2 +1,2 @@
1
- import { S as defineAuth, _ as GenericAuthBeforeResult, b as GenericAuthTriggerHandlers, g as BetterAuthOptionsWithoutDatabase, i as getGeneratedAuthDisabledReason, n as GeneratedAuthDisabledReasonKind, r as createDisabledAuthRuntime, t as AuthRuntime, v as GenericAuthDefinition, x as GenericAuthTriggers, y as GenericAuthTriggerChange } from "../../generated-contract-disabled-C_-KWRfT.js";
1
+ import { S as defineAuth, _ as GenericAuthBeforeResult, b as GenericAuthTriggerHandlers, g as BetterAuthOptionsWithoutDatabase, i as getGeneratedAuthDisabledReason, n as GeneratedAuthDisabledReasonKind, r as createDisabledAuthRuntime, t as AuthRuntime, v as GenericAuthDefinition, x as GenericAuthTriggers, y as GenericAuthTriggerChange } from "../../generated-contract-disabled-xOmfTKh8.js";
2
2
  export { type AuthRuntime, BetterAuthOptionsWithoutDatabase, type GeneratedAuthDisabledReasonKind, GenericAuthBeforeResult, GenericAuthDefinition, GenericAuthTriggerChange, GenericAuthTriggerHandlers, GenericAuthTriggers, createDisabledAuthRuntime, defineAuth, getGeneratedAuthDisabledReason };
@@ -1,7 +1,7 @@
1
1
  import { a as QueryCtxWithPreferredOrmQueryTable, n as LookupByIdResultByCtx, t as DocByCtx } from "../query-context-CNo9ffvI.js";
2
2
  import { t as GetAuth } from "../types-BCl8gfGy.js";
3
3
  import { t as GenericCtx } from "../context-utils-OMkMGhBk.js";
4
- import { S as defineAuth, _ as GenericAuthBeforeResult, a as AuthFunctions, b as GenericAuthTriggerHandlers, c as createApi, d as deleteOneHandler, f as findManyHandler, g as BetterAuthOptionsWithoutDatabase, h as updateOneHandler, i as getGeneratedAuthDisabledReason, l as createHandler, m as updateManyHandler, n as GeneratedAuthDisabledReasonKind, o as Triggers, p as findOneHandler, r as createDisabledAuthRuntime, s as createClient, t as AuthRuntime, u as deleteManyHandler, v as GenericAuthDefinition, x as GenericAuthTriggers, y as GenericAuthTriggerChange } from "../generated-contract-disabled-C_-KWRfT.js";
4
+ import { S as defineAuth, _ as GenericAuthBeforeResult, a as AuthFunctions, b as GenericAuthTriggerHandlers, c as createApi, d as deleteOneHandler, f as findManyHandler, g as BetterAuthOptionsWithoutDatabase, h as updateOneHandler, i as getGeneratedAuthDisabledReason, l as createHandler, m as updateManyHandler, n as GeneratedAuthDisabledReasonKind, o as Triggers, p as findOneHandler, r as createDisabledAuthRuntime, s as createClient, t as AuthRuntime, u as deleteManyHandler, v as GenericAuthDefinition, x as GenericAuthTriggers, y as GenericAuthTriggerChange } from "../generated-contract-disabled-xOmfTKh8.js";
5
5
  import * as convex_values0 from "convex/values";
6
6
  import { Infer } from "convex/values";
7
7
  import { AuthConfig, DocumentByName, GenericDataModel, GenericMutationCtx, GenericQueryCtx, GenericSchema, PaginationOptions, PaginationResult, SchemaDefinition, TableNamesInDataModel } from "convex/server";
@@ -107,27 +107,27 @@ type AdapterPaginationOptions = PaginationOptions & {
107
107
  };
108
108
  declare const adapterWhereValidator: convex_values0.VObject<{
109
109
  mode?: "sensitive" | "insensitive" | undefined;
110
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
110
111
  connector?: "AND" | "OR" | undefined;
111
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
112
112
  value: string | number | boolean | string[] | number[] | null;
113
113
  field: string;
114
114
  }, {
115
115
  connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
116
116
  field: convex_values0.VString<string, "required">;
117
117
  mode: convex_values0.VUnion<"sensitive" | "insensitive" | undefined, [convex_values0.VLiteral<"sensitive", "required">, convex_values0.VLiteral<"insensitive", "required">], "optional", never>;
118
- operator: convex_values0.VUnion<"lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined, [convex_values0.VLiteral<"lt", "required">, convex_values0.VLiteral<"lte", "required">, convex_values0.VLiteral<"gt", "required">, convex_values0.VLiteral<"gte", "required">, convex_values0.VLiteral<"eq", "required">, convex_values0.VLiteral<"in", "required">, convex_values0.VLiteral<"not_in", "required">, convex_values0.VLiteral<"ne", "required">, convex_values0.VLiteral<"contains", "required">, convex_values0.VLiteral<"starts_with", "required">, convex_values0.VLiteral<"ends_with", "required">], "optional", never>;
118
+ operator: convex_values0.VUnion<"eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined, [convex_values0.VLiteral<"lt", "required">, convex_values0.VLiteral<"lte", "required">, convex_values0.VLiteral<"gt", "required">, convex_values0.VLiteral<"gte", "required">, convex_values0.VLiteral<"eq", "required">, convex_values0.VLiteral<"in", "required">, convex_values0.VLiteral<"not_in", "required">, convex_values0.VLiteral<"ne", "required">, convex_values0.VLiteral<"contains", "required">, convex_values0.VLiteral<"starts_with", "required">, convex_values0.VLiteral<"ends_with", "required">], "optional", never>;
119
119
  value: convex_values0.VUnion<string | number | boolean | string[] | number[] | null, [convex_values0.VString<string, "required">, convex_values0.VFloat64<number, "required">, convex_values0.VBoolean<boolean, "required">, convex_values0.VArray<string[], convex_values0.VString<string, "required">, "required">, convex_values0.VArray<number[], convex_values0.VFloat64<number, "required">, "required">, convex_values0.VNull<null, "required">], "required", never>;
120
- }, "required", "mode" | "value" | "connector" | "field" | "operator">;
120
+ }, "required", "mode" | "operator" | "value" | "field" | "connector">;
121
121
  declare const adapterArgsValidator: convex_values0.VObject<{
122
- select?: string[] | undefined;
122
+ limit?: number | undefined;
123
123
  where?: {
124
124
  mode?: "sensitive" | "insensitive" | undefined;
125
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
125
126
  connector?: "AND" | "OR" | undefined;
126
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
127
127
  value: string | number | boolean | string[] | number[] | null;
128
128
  field: string;
129
129
  }[] | undefined;
130
- limit?: number | undefined;
130
+ select?: string[] | undefined;
131
131
  offset?: number | undefined;
132
132
  sortBy?: {
133
133
  field: string;
@@ -148,24 +148,24 @@ declare const adapterArgsValidator: convex_values0.VObject<{
148
148
  }, "optional", "field" | "direction">;
149
149
  where: convex_values0.VArray<{
150
150
  mode?: "sensitive" | "insensitive" | undefined;
151
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
151
152
  connector?: "AND" | "OR" | undefined;
152
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
153
153
  value: string | number | boolean | string[] | number[] | null;
154
154
  field: string;
155
155
  }[] | undefined, convex_values0.VObject<{
156
156
  mode?: "sensitive" | "insensitive" | undefined;
157
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
157
158
  connector?: "AND" | "OR" | undefined;
158
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
159
159
  value: string | number | boolean | string[] | number[] | null;
160
160
  field: string;
161
161
  }, {
162
162
  connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
163
163
  field: convex_values0.VString<string, "required">;
164
164
  mode: convex_values0.VUnion<"sensitive" | "insensitive" | undefined, [convex_values0.VLiteral<"sensitive", "required">, convex_values0.VLiteral<"insensitive", "required">], "optional", never>;
165
- operator: convex_values0.VUnion<"lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined, [convex_values0.VLiteral<"lt", "required">, convex_values0.VLiteral<"lte", "required">, convex_values0.VLiteral<"gt", "required">, convex_values0.VLiteral<"gte", "required">, convex_values0.VLiteral<"eq", "required">, convex_values0.VLiteral<"in", "required">, convex_values0.VLiteral<"not_in", "required">, convex_values0.VLiteral<"ne", "required">, convex_values0.VLiteral<"contains", "required">, convex_values0.VLiteral<"starts_with", "required">, convex_values0.VLiteral<"ends_with", "required">], "optional", never>;
165
+ operator: convex_values0.VUnion<"eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined, [convex_values0.VLiteral<"lt", "required">, convex_values0.VLiteral<"lte", "required">, convex_values0.VLiteral<"gt", "required">, convex_values0.VLiteral<"gte", "required">, convex_values0.VLiteral<"eq", "required">, convex_values0.VLiteral<"in", "required">, convex_values0.VLiteral<"not_in", "required">, convex_values0.VLiteral<"ne", "required">, convex_values0.VLiteral<"contains", "required">, convex_values0.VLiteral<"starts_with", "required">, convex_values0.VLiteral<"ends_with", "required">], "optional", never>;
166
166
  value: convex_values0.VUnion<string | number | boolean | string[] | number[] | null, [convex_values0.VString<string, "required">, convex_values0.VFloat64<number, "required">, convex_values0.VBoolean<boolean, "required">, convex_values0.VArray<string[], convex_values0.VString<string, "required">, "required">, convex_values0.VArray<number[], convex_values0.VFloat64<number, "required">, "required">, convex_values0.VNull<null, "required">], "required", never>;
167
- }, "required", "mode" | "value" | "connector" | "field" | "operator">, "optional">;
168
- }, "required", "model" | "select" | "where" | "limit" | "offset" | "sortBy" | "sortBy.field" | "sortBy.direction">;
167
+ }, "required", "mode" | "operator" | "value" | "field" | "connector">, "optional">;
168
+ }, "required", "limit" | "where" | "model" | "select" | "offset" | "sortBy" | "sortBy.field" | "sortBy.direction">;
169
169
  declare const hasUniqueFields: (betterAuthSchema: BetterAuthDBSchema, model: string, input: Record<string, any>) => boolean;
170
170
  declare const checkUniqueFields: <Schema extends SchemaDefinition<any, any>>(ctx: GenericQueryCtx<GenericDataModel>, schema: Schema, betterAuthSchema: BetterAuthDBSchema, table: string, input: Record<string, any>, doc?: Record<string, any>) => Promise<void>;
171
171
  declare const selectFields: <T extends TableNamesInDataModel<GenericDataModel>, D extends DocumentByName<GenericDataModel, T>>(doc: D | null, select?: string[]) => D | null;
@@ -0,0 +1,156 @@
1
+ 'use client';
2
+ import { ConvexProviderWithAuth } from "convex/react";
3
+ import * as react from "react";
4
+ import * as jotai_x0 from "jotai-x";
5
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
6
+ import * as jotai_vanilla0 from "jotai/vanilla";
7
+
8
+ //#region src/react/auth-store.d.ts
9
+ type FetchAccessTokenFn = (args: {
10
+ forceRefreshToken: boolean;
11
+ }) => Promise<string | null>;
12
+ declare const FetchAccessTokenContext: react.Context<FetchAccessTokenFn | null>;
13
+ /** Get fetchAccessToken from context (available immediately, no race condition) */
14
+ declare const useFetchAccessToken: () => FetchAccessTokenFn | null;
15
+ type ConvexAuthResult = {
16
+ isAuthenticated: boolean;
17
+ isLoading: boolean;
18
+ };
19
+ /** Get auth from bridge context (null if no bridge configured) */
20
+ declare const useConvexAuthBridge: () => ConvexAuthResult | null;
21
+ type AuthStoreState = {
22
+ /** Callback when mutation/action called while unauthorized. Throws by default. */onMutationUnauthorized: () => void; /** Callback when query called while unauthorized. Noop by default. */
23
+ onQueryUnauthorized: (info: {
24
+ queryName: string;
25
+ }) => void; /** Custom function to detect UNAUTHORIZED errors. Default checks code or "auth" in message. */
26
+ isUnauthorized: (error: unknown) => boolean; /** Cached Convex JWT for HTTP requests */
27
+ token: string | null; /** JWT expiration timestamp (ms) */
28
+ expiresAt: number | null; /** Auth loading state (synced from useConvexAuth for class methods) */
29
+ isLoading: boolean; /** Auth state (synced from useConvexAuth for class methods) */
30
+ isAuthenticated: boolean; /** Grace window for freshly seeded auth tokens while session sync catches up */
31
+ sessionSyncGraceUntil: number | null;
32
+ };
33
+ declare const AUTH_SESSION_SYNC_GRACE_MS = 10000;
34
+ declare const isSessionSyncGraceActive: (sessionSyncGraceUntil: number | null) => boolean;
35
+ /** Decode JWT expiration (ms timestamp) from token */
36
+ declare function decodeJwtExp(token: string): number | null;
37
+ declare const AuthProvider: react.FC<jotai_x0.ProviderProps<{
38
+ onMutationUnauthorized: () => void;
39
+ onQueryUnauthorized: (info: {
40
+ queryName: string;
41
+ }) => void;
42
+ isUnauthorized: (error: unknown) => boolean;
43
+ token: string | null;
44
+ expiresAt: number | null;
45
+ isLoading: boolean;
46
+ isAuthenticated: boolean;
47
+ sessionSyncGraceUntil: number | null;
48
+ }>>, useAuthStore: jotai_x0.UseStoreApi<AuthStoreState, object>, useAuthState: <K extends keyof AuthStoreState>(key: K, options?: string | jotai_x0.UseAtomOptions) => ({
49
+ onMutationUnauthorized: jotai_x0.SimpleWritableAtom<() => void>;
50
+ onQueryUnauthorized: jotai_x0.SimpleWritableAtom<(info: {
51
+ queryName: string;
52
+ }) => void>;
53
+ isUnauthorized: jotai_x0.SimpleWritableAtom<(error: unknown) => boolean>;
54
+ token: jotai_x0.SimpleWritableAtom<string | null>;
55
+ expiresAt: jotai_x0.SimpleWritableAtom<number | null>;
56
+ isLoading: jotai_x0.SimpleWritableAtom<boolean>;
57
+ isAuthenticated: jotai_x0.SimpleWritableAtom<boolean>;
58
+ sessionSyncGraceUntil: jotai_x0.SimpleWritableAtom<number | null>;
59
+ } & object)[K] extends jotai_vanilla0.WritableAtom<infer V, infer A extends unknown[], infer R> ? [V, (...args: A) => R] : never, useAuthValue: <K extends keyof AuthStoreState, S = (({
60
+ onMutationUnauthorized: jotai_x0.SimpleWritableAtom<() => void>;
61
+ onQueryUnauthorized: jotai_x0.SimpleWritableAtom<(info: {
62
+ queryName: string;
63
+ }) => void>;
64
+ isUnauthorized: jotai_x0.SimpleWritableAtom<(error: unknown) => boolean>;
65
+ token: jotai_x0.SimpleWritableAtom<string | null>;
66
+ expiresAt: jotai_x0.SimpleWritableAtom<number | null>;
67
+ isLoading: jotai_x0.SimpleWritableAtom<boolean>;
68
+ isAuthenticated: jotai_x0.SimpleWritableAtom<boolean>;
69
+ sessionSyncGraceUntil: jotai_x0.SimpleWritableAtom<number | null>;
70
+ } & object)[K] extends jotai_vanilla0.Atom<infer V> ? V : never)>(key: K, options?: ({
71
+ selector?: ((v: ({
72
+ onMutationUnauthorized: jotai_x0.SimpleWritableAtom<() => void>;
73
+ onQueryUnauthorized: jotai_x0.SimpleWritableAtom<(info: {
74
+ queryName: string;
75
+ }) => void>;
76
+ isUnauthorized: jotai_x0.SimpleWritableAtom<(error: unknown) => boolean>;
77
+ token: jotai_x0.SimpleWritableAtom<string | null>;
78
+ expiresAt: jotai_x0.SimpleWritableAtom<number | null>;
79
+ isLoading: jotai_x0.SimpleWritableAtom<boolean>;
80
+ isAuthenticated: jotai_x0.SimpleWritableAtom<boolean>;
81
+ sessionSyncGraceUntil: jotai_x0.SimpleWritableAtom<number | null>;
82
+ } & object)[K] extends jotai_vanilla0.Atom<infer V_1> ? V_1 : never, prevSelectorOutput?: S | undefined) => S) | undefined;
83
+ equalityFn?: ((prev: S, next: S) => boolean) | undefined;
84
+ } & jotai_x0.UseAtomOptions) | undefined, deps?: unknown[]) => S;
85
+ type AuthStore = ReturnType<typeof useAuthStore>;
86
+ /**
87
+ * Safe wrapper around useConvexAuth that doesn't throw when used outside auth provider.
88
+ * Returns { isAuthenticated: false, isLoading: false } when no auth provider.
89
+ *
90
+ * Supports both:
91
+ * - better-auth users (via AuthProvider)
92
+ * - @convex-dev/auth users (via ConvexAuthBridge)
93
+ */
94
+ declare function useSafeConvexAuth(): ConvexAuthResult;
95
+ /**
96
+ * Internal bridge component. Use `ConvexProviderWithAuth` instead.
97
+ * @internal
98
+ */
99
+ declare function ConvexAuthBridge({
100
+ children
101
+ }: {
102
+ children: React.ReactNode;
103
+ }): react_jsx_runtime0.JSX.Element;
104
+ /**
105
+ * Convex provider with auth bridge for @convex-dev/auth users.
106
+ * Automatically wraps children with ConvexAuthBridge.
107
+ *
108
+ * @example
109
+ * ```tsx
110
+ * import { ConvexProviderWithAuth } from 'kitcn/react';
111
+ *
112
+ * <ConvexProviderWithAuth client={convex} useAuth={useAuthFromConvexDev}>
113
+ * <App />
114
+ * </ConvexProviderWithAuth>
115
+ * ```
116
+ */
117
+ declare function ConvexProviderWithAuth$1({
118
+ children,
119
+ ...props
120
+ }: React.ComponentProps<typeof ConvexProviderWithAuth>): react_jsx_runtime0.JSX.Element;
121
+ declare const useAuth: () => {
122
+ hasSession: boolean;
123
+ isAuthenticated: boolean;
124
+ isLoading: boolean;
125
+ };
126
+ /** Check if user maybe has auth (optimistic, has token) */
127
+ declare const useMaybeAuth: () => boolean;
128
+ /** Check if user is authenticated (server-verified) */
129
+ declare const useIsAuth: () => boolean;
130
+ declare const useAuthGuard: () => (callback?: () => Promise<void> | void) => boolean | undefined;
131
+ /** Render children only when maybe has auth (optimistic) */
132
+ declare function MaybeAuthenticated({
133
+ children
134
+ }: {
135
+ children: React.ReactNode;
136
+ }): react.ReactNode;
137
+ /** Render children only when authenticated (server-verified) */
138
+ declare function Authenticated({
139
+ children
140
+ }: {
141
+ children: React.ReactNode;
142
+ }): react.ReactNode;
143
+ /** Render children only when maybe not auth (optimistic) */
144
+ declare function MaybeUnauthenticated({
145
+ children
146
+ }: {
147
+ children: React.ReactNode;
148
+ }): react.ReactNode;
149
+ /** Render children only when not authenticated (server-verified) */
150
+ declare function Unauthenticated({
151
+ children
152
+ }: {
153
+ children: React.ReactNode;
154
+ }): react.ReactNode;
155
+ //#endregion
156
+ export { useMaybeAuth as C, useIsAuth as S, useAuthState as _, Authenticated as a, useConvexAuthBridge as b, FetchAccessTokenContext as c, MaybeUnauthenticated as d, Unauthenticated as f, useAuthGuard as g, useAuth as h, AuthStoreState as i, FetchAccessTokenFn as l, isSessionSyncGraceActive as m, AuthProvider as n, ConvexAuthBridge as o, decodeJwtExp as p, AuthStore as r, ConvexProviderWithAuth$1 as s, AUTH_SESSION_SYNC_GRACE_MS as t, MaybeAuthenticated as u, useAuthStore as v, useSafeConvexAuth as w, useFetchAccessToken as x, useAuthValue as y };
@@ -8453,7 +8453,6 @@ import {
8453
8453
  ConvexReactClient,
8454
8454
  getConvexQueryClientSingleton,
8455
8455
  getQueryClientSingleton,
8456
- useAuthStore,
8457
8456
  } from 'kitcn/react';
8458
8457
  import { useRouter } from 'next/navigation';
8459
8458
  import type { ReactNode } from 'react';
@@ -8470,11 +8469,17 @@ export function AppConvexProvider({
8470
8469
  children: ReactNode;
8471
8470
  }) {
8472
8471
  const router = useRouter();
8472
+ const queryClient = getQueryClientSingleton(createQueryClient);
8473
+ const convexQueryClient = getConvexQueryClientSingleton({
8474
+ convex,
8475
+ queryClient,
8476
+ });
8473
8477
 
8474
8478
  return (
8475
8479
  <ConvexAuthProvider
8476
8480
  authClient={authClient}
8477
8481
  client={convex}
8482
+ convexQueryClient={convexQueryClient}
8478
8483
  onMutationUnauthorized={() => {
8479
8484
  router.push('/auth');
8480
8485
  }}
@@ -8482,28 +8487,14 @@ export function AppConvexProvider({
8482
8487
  router.push('/auth');
8483
8488
  }}
8484
8489
  >
8485
- <QueryProvider>{children}</QueryProvider>
8490
+ <TanstackQueryClientProvider client={queryClient}>
8491
+ <CRPCProvider convexClient={convex} convexQueryClient={convexQueryClient}>
8492
+ {children}
8493
+ </CRPCProvider>
8494
+ </TanstackQueryClientProvider>
8486
8495
  </ConvexAuthProvider>
8487
8496
  );
8488
8497
  }
8489
-
8490
- function QueryProvider({ children }: { children: ReactNode }) {
8491
- const authStore = useAuthStore();
8492
- const queryClient = getQueryClientSingleton(createQueryClient);
8493
- const convexQueryClient = getConvexQueryClientSingleton({
8494
- authStore,
8495
- convex,
8496
- queryClient,
8497
- });
8498
-
8499
- return (
8500
- <TanstackQueryClientProvider client={queryClient}>
8501
- <CRPCProvider convexClient={convex} convexQueryClient={convexQueryClient}>
8502
- {children}
8503
- </CRPCProvider>
8504
- </TanstackQueryClientProvider>
8505
- );
8506
- }
8507
8498
  `;
8508
8499
 
8509
8500
  //#endregion
@@ -8662,7 +8653,6 @@ import {
8662
8653
  ConvexReactClient,
8663
8654
  getConvexQueryClientSingleton,
8664
8655
  getQueryClientSingleton,
8665
- useAuthStore,
8666
8656
  } from 'kitcn/react';
8667
8657
  import type { ReactNode } from 'react';
8668
8658
 
@@ -8678,11 +8668,17 @@ export function AppConvexProvider({
8678
8668
  children: ReactNode;
8679
8669
  }) {
8680
8670
  const router = useRouter();
8671
+ const queryClient = getQueryClientSingleton(createQueryClient);
8672
+ const convexQueryClient = getConvexQueryClientSingleton({
8673
+ convex,
8674
+ queryClient,
8675
+ });
8681
8676
 
8682
8677
  return (
8683
8678
  <ConvexAuthProvider
8684
8679
  authClient={authClient}
8685
8680
  client={convex}
8681
+ convexQueryClient={convexQueryClient}
8686
8682
  onMutationUnauthorized={() => {
8687
8683
  router.push('/auth');
8688
8684
  }}
@@ -8690,28 +8686,14 @@ export function AppConvexProvider({
8690
8686
  router.push('/auth');
8691
8687
  }}
8692
8688
  >
8693
- <QueryProvider>{children}</QueryProvider>
8689
+ <TanstackQueryClientProvider client={queryClient}>
8690
+ <CRPCProvider convexClient={convex} convexQueryClient={convexQueryClient}>
8691
+ {children}
8692
+ </CRPCProvider>
8693
+ </TanstackQueryClientProvider>
8694
8694
  </ConvexAuthProvider>
8695
8695
  );
8696
8696
  }
8697
-
8698
- function QueryProvider({ children }: { children: ReactNode }) {
8699
- const authStore = useAuthStore();
8700
- const queryClient = getQueryClientSingleton(createQueryClient);
8701
- const convexQueryClient = getConvexQueryClientSingleton({
8702
- authStore,
8703
- convex,
8704
- queryClient,
8705
- });
8706
-
8707
- return (
8708
- <TanstackQueryClientProvider client={queryClient}>
8709
- <CRPCProvider convexClient={convex} convexQueryClient={convexQueryClient}>
8710
- {children}
8711
- </CRPCProvider>
8712
- </TanstackQueryClientProvider>
8713
- );
8714
- }
8715
8697
  `;
8716
8698
 
8717
8699
  //#endregion
@@ -9129,7 +9111,6 @@ import {
9129
9111
  ConvexReactClient,
9130
9112
  getConvexQueryClientSingleton,
9131
9113
  getQueryClientSingleton,
9132
- useAuthStore,
9133
9114
  } from 'kitcn/react';
9134
9115
  import type { ReactNode } from 'react';
9135
9116
 
@@ -9146,32 +9127,25 @@ export function AppConvexProvider({
9146
9127
  children: ReactNode;
9147
9128
  token?: string;
9148
9129
  }) {
9149
- return (
9150
- <ConvexAuthProvider
9151
- authClient={authClient}
9152
- client={convex}
9153
- initialToken={token}
9154
- >
9155
- <QueryProvider>{children}</QueryProvider>
9156
- </ConvexAuthProvider>
9157
- );
9158
- }
9159
-
9160
- function QueryProvider({ children }: { children: ReactNode }) {
9161
- const authStore = useAuthStore();
9162
9130
  const queryClient = getQueryClientSingleton(createQueryClient);
9163
9131
  const convexQueryClient = getConvexQueryClientSingleton({
9164
- authStore,
9165
9132
  convex,
9166
9133
  queryClient,
9167
9134
  });
9168
9135
 
9169
9136
  return (
9170
- <TanstackQueryClientProvider client={queryClient}>
9171
- <CRPCProvider convexClient={convex} convexQueryClient={convexQueryClient}>
9172
- {children}
9173
- </CRPCProvider>
9174
- </TanstackQueryClientProvider>
9137
+ <ConvexAuthProvider
9138
+ authClient={authClient}
9139
+ client={convex}
9140
+ convexQueryClient={convexQueryClient}
9141
+ initialToken={token}
9142
+ >
9143
+ <TanstackQueryClientProvider client={queryClient}>
9144
+ <CRPCProvider convexClient={convex} convexQueryClient={convexQueryClient}>
9145
+ {children}
9146
+ </CRPCProvider>
9147
+ </TanstackQueryClientProvider>
9148
+ </ConvexAuthProvider>
9175
9149
  );
9176
9150
  }
9177
9151
  `;
@@ -9372,7 +9346,6 @@ import {
9372
9346
  ConvexReactClient,
9373
9347
  getConvexQueryClientSingleton,
9374
9348
  getQueryClientSingleton,
9375
- useAuthStore,
9376
9349
  } from 'kitcn/react';
9377
9350
  import type { ReactNode } from 'react';
9378
9351
 
@@ -9387,28 +9360,24 @@ export function AppConvexProvider({
9387
9360
  }: {
9388
9361
  children: ReactNode;
9389
9362
  }) {
9390
- return (
9391
- <ConvexAuthProvider authClient={authClient} client={convex}>
9392
- <QueryProvider>{children}</QueryProvider>
9393
- </ConvexAuthProvider>
9394
- );
9395
- }
9396
-
9397
- function QueryProvider({ children }: { children: ReactNode }) {
9398
- const authStore = useAuthStore();
9399
9363
  const queryClient = getQueryClientSingleton(createQueryClient);
9400
9364
  const convexQueryClient = getConvexQueryClientSingleton({
9401
- authStore,
9402
9365
  convex,
9403
9366
  queryClient,
9404
9367
  });
9405
9368
 
9406
9369
  return (
9407
- <TanstackQueryClientProvider client={queryClient}>
9408
- <CRPCProvider convexClient={convex} convexQueryClient={convexQueryClient}>
9409
- {children}
9410
- </CRPCProvider>
9411
- </TanstackQueryClientProvider>
9370
+ <ConvexAuthProvider
9371
+ authClient={authClient}
9372
+ client={convex}
9373
+ convexQueryClient={convexQueryClient}
9374
+ >
9375
+ <TanstackQueryClientProvider client={queryClient}>
9376
+ <CRPCProvider convexClient={convex} convexQueryClient={convexQueryClient}>
9377
+ {children}
9378
+ </CRPCProvider>
9379
+ </TanstackQueryClientProvider>
9380
+ </ConvexAuthProvider>
9412
9381
  );
9413
9382
  }
9414
9383
  `;
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { $ as promptForScaffoldTemplateSelection, A as resolveCodegenTrimSegments, At as highlighter, B as runConfiguredCodegen, C as isEntryPoint, Ct as formatDependencyInstallCommand, D as parseInitCommandArgs, E as parseBackendRunJson, Et as stripConvexCommandNoise, F as resolveRunDeps, G as runMigrationFlow, H as runDevSchemaBackfillIfNeeded, I as runAfterScaffoldScript, J as withWorkingDirectory, K as trackProcess, L as runAggregateBackfillFlow, M as resolveDocTopic, N as resolveInitProjectDir, O as readPackageVersions, P as resolveMigrationConfig, Q as promptForPluginSelection, R as runAggregatePruneFlow, S as isConvexDevPreRunConflictFlag, St as detectPackageManager, T as parseArgs, Tt as serializeEnvValue, U as runInitCommandFlow, V as runConvexInitIfNeeded, W as runMigrationCreate, X as collectPluginScaffoldTemplates, Y as createSpinner, Z as filterScaffoldTemplatePathMap, _ as formatInfoOutput, _t as applyPlanningDependencyInstall, a as cleanup, at as getPluginCatalogEntry, b as getDevAggregateBackfillStatePath, bt as resolveSupportedDependencyWarnings, c as createCommandEnv, ct as buildPluginInstallPlan, d as extractBackfillCliOptions, dt as collectInstalledPluginKeys, et as resolveAddTemplateDefaults, f as extractConcaveRunTargetArgs, ft as getPluginLockfilePath, g as formatDocsOutput, gt as applyDependencyHintsInstall, h as extractResetCliOptions, ht as resolveSchemaInstalledPlugins, i as buildInitializationPlan, it as resolveTemplatesByIdOrThrow, j as resolveConfiguredBackend, k as resolveBackfillConfig, kt as logger, l as ensureConvexGitignoreEntry, lt as resolvePluginScaffoldRoots, m as extractMigrationDownOptions, mt as readPluginLockfile, n as applyPluginInstallPlanFiles, nt as resolvePresetScaffoldTemplates, o as createBackendAdapter, ot as getSupportedPluginKeys, p as extractMigrationCliOptions, pt as getSchemaFilePath, q as withLocalCodegenEnv, r as assertNoRemovedDevPreRunFlag, rt as resolveTemplateSelectionSource, s as createBackendCommandEnv, st as isSupportedPluginKey, t as applyDependencyInstallPlan, tt as resolvePluginPreset, u as extractBackendRunTargetArgs, ut as assertSchemaFileExists, v as getAggregateBackfillDeploymentKey, vt as applyPluginDependencyInstall, w as isInitialized, wt as resolveAuthEnvState, x as hasRemoteConvexDeploymentEnv, xt as resolveProjectScaffoldContext, y as getConvexDeploymentCommandEnv, yt as inspectPluginDependencyInstall, z as runBackendFunction } from "./backend-core-BYs_6mO4.mjs";
2
+ import { $ as promptForScaffoldTemplateSelection, A as resolveCodegenTrimSegments, At as highlighter, B as runConfiguredCodegen, C as isEntryPoint, Ct as formatDependencyInstallCommand, D as parseInitCommandArgs, E as parseBackendRunJson, Et as stripConvexCommandNoise, F as resolveRunDeps, G as runMigrationFlow, H as runDevSchemaBackfillIfNeeded, I as runAfterScaffoldScript, J as withWorkingDirectory, K as trackProcess, L as runAggregateBackfillFlow, M as resolveDocTopic, N as resolveInitProjectDir, O as readPackageVersions, P as resolveMigrationConfig, Q as promptForPluginSelection, R as runAggregatePruneFlow, S as isConvexDevPreRunConflictFlag, St as detectPackageManager, T as parseArgs, Tt as serializeEnvValue, U as runInitCommandFlow, V as runConvexInitIfNeeded, W as runMigrationCreate, X as collectPluginScaffoldTemplates, Y as createSpinner, Z as filterScaffoldTemplatePathMap, _ as formatInfoOutput, _t as applyPlanningDependencyInstall, a as cleanup, at as getPluginCatalogEntry, b as getDevAggregateBackfillStatePath, bt as resolveSupportedDependencyWarnings, c as createCommandEnv, ct as buildPluginInstallPlan, d as extractBackfillCliOptions, dt as collectInstalledPluginKeys, et as resolveAddTemplateDefaults, f as extractConcaveRunTargetArgs, ft as getPluginLockfilePath, g as formatDocsOutput, gt as applyDependencyHintsInstall, h as extractResetCliOptions, ht as resolveSchemaInstalledPlugins, i as buildInitializationPlan, it as resolveTemplatesByIdOrThrow, j as resolveConfiguredBackend, k as resolveBackfillConfig, kt as logger, l as ensureConvexGitignoreEntry, lt as resolvePluginScaffoldRoots, m as extractMigrationDownOptions, mt as readPluginLockfile, n as applyPluginInstallPlanFiles, nt as resolvePresetScaffoldTemplates, o as createBackendAdapter, ot as getSupportedPluginKeys, p as extractMigrationCliOptions, pt as getSchemaFilePath, q as withLocalCodegenEnv, r as assertNoRemovedDevPreRunFlag, rt as resolveTemplateSelectionSource, s as createBackendCommandEnv, st as isSupportedPluginKey, t as applyDependencyInstallPlan, tt as resolvePluginPreset, u as extractBackendRunTargetArgs, ut as assertSchemaFileExists, v as getAggregateBackfillDeploymentKey, vt as applyPluginDependencyInstall, w as isInitialized, wt as resolveAuthEnvState, x as hasRemoteConvexDeploymentEnv, xt as resolveProjectScaffoldContext, y as getConvexDeploymentCommandEnv, yt as inspectPluginDependencyInstall, z as runBackendFunction } from "./backend-core-BA0CgHrL.mjs";
3
3
  import fs, { existsSync, readFileSync } from "node:fs";
4
4
  import path, { delimiter, dirname, join, relative, resolve } from "node:path";
5
5
  import { fileURLToPath } from "node:url";
@@ -173,10 +173,18 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
173
173
  };
174
174
  }, Promise<any>>;
175
175
  deleteMany: convex_server0.RegisteredMutation<"internal", {
176
+ paginationOpts: {
177
+ id?: number;
178
+ endCursor?: string | null;
179
+ maximumRowsRead?: number;
180
+ maximumBytesRead?: number;
181
+ numItems: number;
182
+ cursor: string | null;
183
+ };
176
184
  input: {
177
185
  where?: {
186
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
178
187
  connector?: "AND" | "OR" | undefined;
179
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
180
188
  value: string | number | boolean | string[] | number[] | null;
181
189
  field: string;
182
190
  }[] | undefined;
@@ -185,14 +193,6 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
185
193
  where?: any[] | undefined;
186
194
  model: string;
187
195
  };
188
- paginationOpts: {
189
- id?: number;
190
- endCursor?: string | null;
191
- maximumRowsRead?: number;
192
- maximumBytesRead?: number;
193
- numItems: number;
194
- cursor: string | null;
195
- };
196
196
  }, Promise<{
197
197
  count: number;
198
198
  ids: any[];
@@ -204,8 +204,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
204
204
  deleteOne: convex_server0.RegisteredMutation<"internal", {
205
205
  input: {
206
206
  where?: {
207
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
207
208
  connector?: "AND" | "OR" | undefined;
208
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
209
209
  value: string | number | boolean | string[] | number[] | null;
210
210
  field: string;
211
211
  }[] | undefined;
@@ -216,21 +216,20 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
216
216
  };
217
217
  }, Promise<Record<string, unknown> | undefined>>;
218
218
  findMany: convex_server0.RegisteredQuery<"internal", {
219
+ limit?: number | undefined;
219
220
  join?: any;
220
221
  where?: {
221
222
  mode?: "sensitive" | "insensitive" | undefined;
223
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
222
224
  connector?: "AND" | "OR" | undefined;
223
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
224
225
  value: string | number | boolean | string[] | number[] | null;
225
226
  field: string;
226
227
  }[] | undefined;
227
- limit?: number | undefined;
228
228
  offset?: number | undefined;
229
229
  sortBy?: {
230
230
  field: string;
231
231
  direction: "asc" | "desc";
232
232
  } | undefined;
233
- model: string;
234
233
  paginationOpts: {
235
234
  id?: number;
236
235
  endCursor?: string | null;
@@ -239,47 +238,48 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
239
238
  numItems: number;
240
239
  cursor: string | null;
241
240
  };
241
+ model: string;
242
242
  }, Promise<convex_server0.PaginationResult<convex_server0.GenericDocument>>>;
243
243
  findOne: convex_server0.RegisteredQuery<"internal", {
244
244
  join?: any;
245
- select?: string[] | undefined;
246
245
  where?: {
247
246
  mode?: "sensitive" | "insensitive" | undefined;
247
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
248
248
  connector?: "AND" | "OR" | undefined;
249
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
250
249
  value: string | number | boolean | string[] | number[] | null;
251
250
  field: string;
252
251
  }[] | undefined;
252
+ select?: string[] | undefined;
253
253
  model: string;
254
254
  }, Promise<convex_server0.GenericDocument | null>>;
255
255
  getLatestJwks: convex_server0.RegisteredAction<"internal", {}, Promise<unknown>>;
256
256
  rotateKeys: convex_server0.RegisteredAction<"internal", {}, Promise<unknown>>;
257
257
  updateMany: convex_server0.RegisteredMutation<"internal", {
258
+ paginationOpts: {
259
+ id?: number;
260
+ endCursor?: string | null;
261
+ maximumRowsRead?: number;
262
+ maximumBytesRead?: number;
263
+ numItems: number;
264
+ cursor: string | null;
265
+ };
258
266
  input: {
259
267
  where?: {
268
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
260
269
  connector?: "AND" | "OR" | undefined;
261
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
262
270
  value: string | number | boolean | string[] | number[] | null;
263
271
  field: string;
264
272
  }[] | undefined;
265
- model: string;
266
273
  update: {
267
274
  [x: string]: unknown;
268
275
  [x: number]: unknown;
269
276
  [x: symbol]: unknown;
270
277
  };
278
+ model: string;
271
279
  } | {
272
280
  where?: any[] | undefined;
273
- model: string;
274
281
  update: any;
275
- };
276
- paginationOpts: {
277
- id?: number;
278
- endCursor?: string | null;
279
- maximumRowsRead?: number;
280
- maximumBytesRead?: number;
281
- numItems: number;
282
- cursor: string | null;
282
+ model: string;
283
283
  };
284
284
  }, Promise<{
285
285
  count: number;
@@ -292,21 +292,21 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
292
292
  updateOne: convex_server0.RegisteredMutation<"internal", {
293
293
  input: {
294
294
  where?: {
295
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
295
296
  connector?: "AND" | "OR" | undefined;
296
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
297
297
  value: string | number | boolean | string[] | number[] | null;
298
298
  field: string;
299
299
  }[] | undefined;
300
- model: string;
301
300
  update: {
302
301
  [x: string]: unknown;
303
302
  [x: number]: unknown;
304
303
  [x: symbol]: unknown;
305
304
  };
305
+ model: string;
306
306
  } | {
307
307
  where?: any[] | undefined;
308
- model: string;
309
308
  update: any;
309
+ model: string;
310
310
  };
311
311
  }, Promise<any>>;
312
312
  };
@@ -1,4 +1,4 @@
1
- import { $ as GenericOrmCtx$1, $n as unique, $r as endsWith, $t as ManyConfig, A as ConvexDateMode, An as ConvexRankIndexBuilder, Ar as ReturningResult, At as MigrationManifestEntry, B as ConvexBytesBuilderInitial, Bn as rankIndex, Br as OrmSchemaRelations, Bt as defineMigration, C as ConvexNumberBuilderInitial, Ci as ColumnBuilderWithTableName, Cn as RlsRole, Cr as MutationReturning, Ct as MigrationStatusArgs, D as id, Di as IsPrimaryKey, Dn as ConvexAggregateIndexBuilderOn, Dr as PaginatedResult, Dt as MigrationDoc, E as ConvexIdBuilderInitial, Ei as HasDefault, En as ConvexAggregateIndexBuilder, Er as OrderDirection, Et as MigrationDirection, F as custom, Fn as ConvexVectorIndexBuilder, Fr as unsetToken, Ft as MigrationStateMap, G as ConvexBigIntBuilder, Gn as ConvexCheckConfig, Gr as ExpressionVisitor, Gt as OrmReader$1, H as ConvexBooleanBuilder, Hn as uniqueIndex, Hr as TableName, Ht as detectMigrationDrift, I as json, In as ConvexVectorIndexBuilderOn, Ir as Brand, It as MigrationStep, J as CountBackfillChunkArgs, Jn as ConvexUniqueConstraintBuilder, Jr as LogicalExpression, Jt as RlsMode, K as ConvexBigIntBuilderInitial, Kn as ConvexForeignKeyBuilder, Kr as FieldReference, Kt as OrmWriter$1, L as objectOf, Ln as ConvexVectorIndexConfig, Lr as Columns, Lt as MigrationTableName, M as ConvexCustomBuilder, Mn as ConvexSearchIndexBuilder, Mr as UpdateSet, Mt as MigrationPlan, N as ConvexCustomBuilderInitial, Nn as ConvexSearchIndexBuilderOn, Nr as VectorQueryConfig, Nt as MigrationRunStatus, O as ConvexDateBuilder, Oi as IsUnique, On as ConvexIndexBuilder, Or as PredicateWhereIndexConfig, Ot as MigrationDocContext, P as arrayOf, Pn as ConvexSearchIndexConfig, Pr as VectorSearchProvider, Pt as MigrationSet, Q as GenericOrm$1, Qn as foreignKey, Qr as contains, Qt as ExtractTablesWithRelations, R as unionOf, Rn as aggregateIndex, Rr as OrmSchemaExtensionTables, Rt as MigrationWriteMode, S as ConvexNumberBuilder, Si as ColumnBuilderTypeConfig, Sn as rlsPolicy, Sr as MutationResult, St as MigrationRunChunkArgs, T as ConvexIdBuilder, Ti as DrizzleEntity, Tn as rlsRole, Tr as OrderByClause, Tt as MigrationDefinition, U as ConvexBooleanBuilderInitial, Un as vectorIndex, Ur as SystemFields, Ut as DatabaseWithMutations, V as bytes, Vn as searchIndex, Vr as OrmSchemaTriggers, Vt as defineMigrationSet, W as boolean, Wn as ConvexCheckBuilder, Wr as BinaryExpression, Wt as DatabaseWithQuery, X as CountBackfillStatusArgs, Xn as ConvexUniqueConstraintConfig, Xr as and, Xt as extractRelationsConfig, Y as CountBackfillKickoffArgs, Yn as ConvexUniqueConstraintBuilderOn, Yr as UnaryExpression, Yt as EdgeMetadata, Z as CreateOrmOptions, Zn as check, Zr as between, Zt as ExtractTablesFromSchema, _ as ConvexTimestampMode, _i as startsWith, _n as deletion, _r as MutationExecuteConfig, _t as OrmTriggerContext, a as requireSchemaRelations, ai as inArray, an as TablesRelationalConfig, ar as AggregateResult, at as OrmWriterCtx, b as ConvexTextEnumBuilderInitial, bi as ColumnBuilderBaseConfig, bn as RlsPolicyConfig, br as MutationPaginateConfig, bt as MigrationCancelArgs, c as TableConfigResult, ci as isNull, cn as ConvexDeletionBuilder, cr as CountConfig, ct as ScheduledMutationBatchArgs, d as OrmNotFoundError, di as lte, dn as ConvexTableWithColumns, dr as FilterOperators, dt as scheduledDeleteFactory, ei as eq, en as OneConfig, er as ConvexTextBuilder, et as OrmApiResult, f as ConvexVectorBuilder, fi as ne, fn as DiscriminatorBuilderConfig, fr as GetColumnData, ft as SchemaExtension, g as ConvexTimestampBuilderInitial, gi as or, gn as convexTable, gr as InsertValue, gt as OrmTriggerChange, h as ConvexTimestampBuilder, hi as notInArray, hn as TableConfig, hr as InferSelectModel, ht as OrmTableTriggers, i as getSchemaTriggers, ii as ilike, in as TableRelationalConfig, ir as AggregateFieldValue, it as OrmReaderCtx, j as date, jn as ConvexRankIndexBuilderOn, jr as ReturningSelection, jt as MigrationMigrateOne, k as ConvexDateBuilderInitial, ki as NotNull, kn as ConvexIndexBuilderOn, kr as ReturningAll, kt as MigrationDriftIssue, l as getTableColumns, li as like, ln as ConvexDeletionConfig, lr as CountResult, lt as scheduledMutationBatchFactory, m as vector, mi as notBetween, mn as OrmLifecycleOperation, mr as InferModelFromColumns, mt as OrmBeforeResult, n as defineSchema, ni as gt, nn as RelationsBuilderColumnBase, nr as text, nt as OrmClientWithApi$1, o as asc, oi as isFieldReference, on as defineRelations, or as BuildQueryResult, ot as ResolveOrmSchema, p as ConvexVectorBuilderInitial, pi as not, pn as OrmLifecycleChange, pr as InferInsertModel, pt as defineSchemaExtension, q as bigint, qn as ConvexForeignKeyConfig, qr as FilterExpression, qt as RlsContext, r as getSchemaRelations, ri as gte, rn as RelationsBuilderColumnConfig, rr as AggregateConfig, rt as OrmFunctions, s as desc, si as isNotNull, sn as defineRelationsPart, sr as BuildRelationResult, st as createOrm, t as WhereClauseResult, ti as fieldRef, tn as RelationsBuilder, tr as ConvexTextBuilderInitial, tt as OrmClientBase$1, u as getTableConfig, ui as lt, un as ConvexTable, ur as DBQueryConfig, ut as ScheduledDeleteArgs, v as timestamp, vi as AnyColumn, vn as discriminator, vr as MutationExecuteResult, vt as OrmTriggers, w as integer, wi as ColumnDataType, wn as RlsRoleConfig, wr as MutationRunMode, wt as MigrationAppliedState, x as textEnum, xi as ColumnBuilderRuntimeConfig, xn as RlsPolicyToOption, xr as MutationPaginatedResult, xt as MigrationRunArgs, y as ConvexTextEnumBuilder, yi as ColumnBuilder, yn as RlsPolicy, yr as MutationExecutionMode, yt as defineTriggers, z as ConvexBytesBuilder, zn as index, zr as OrmSchemaExtensions, zt as buildMigrationPlan } from "../where-clause-compiler-DLiYI2EF.js";
1
+ import { $ as GenericOrmCtx$1, $n as unique, $r as endsWith, $t as ManyConfig, A as ConvexDateMode, An as ConvexRankIndexBuilder, Ar as ReturningResult, At as MigrationManifestEntry, B as ConvexBytesBuilderInitial, Bn as rankIndex, Br as OrmSchemaRelations, Bt as defineMigration, C as ConvexNumberBuilderInitial, Ci as ColumnBuilderWithTableName, Cn as RlsRole, Cr as MutationReturning, Ct as MigrationStatusArgs, D as id, Di as IsPrimaryKey, Dn as ConvexAggregateIndexBuilderOn, Dr as PaginatedResult, Dt as MigrationDoc, E as ConvexIdBuilderInitial, Ei as HasDefault, En as ConvexAggregateIndexBuilder, Er as OrderDirection, Et as MigrationDirection, F as custom, Fn as ConvexVectorIndexBuilder, Fr as unsetToken, Ft as MigrationStateMap, G as ConvexBigIntBuilder, Gn as ConvexCheckConfig, Gr as ExpressionVisitor, Gt as OrmReader$1, H as ConvexBooleanBuilder, Hn as uniqueIndex, Hr as TableName, Ht as detectMigrationDrift, I as json, In as ConvexVectorIndexBuilderOn, Ir as Brand, It as MigrationStep, J as CountBackfillChunkArgs, Jn as ConvexUniqueConstraintBuilder, Jr as LogicalExpression, Jt as RlsMode, K as ConvexBigIntBuilderInitial, Kn as ConvexForeignKeyBuilder, Kr as FieldReference, Kt as OrmWriter$1, L as objectOf, Ln as ConvexVectorIndexConfig, Lr as Columns, Lt as MigrationTableName, M as ConvexCustomBuilder, Mn as ConvexSearchIndexBuilder, Mr as UpdateSet, Mt as MigrationPlan, N as ConvexCustomBuilderInitial, Nn as ConvexSearchIndexBuilderOn, Nr as VectorQueryConfig, Nt as MigrationRunStatus, O as ConvexDateBuilder, Oi as IsUnique, On as ConvexIndexBuilder, Or as PredicateWhereIndexConfig, Ot as MigrationDocContext, P as arrayOf, Pn as ConvexSearchIndexConfig, Pr as VectorSearchProvider, Pt as MigrationSet, Q as GenericOrm$1, Qn as foreignKey, Qr as contains, Qt as ExtractTablesWithRelations, R as unionOf, Rn as aggregateIndex, Rr as OrmSchemaExtensionTables, Rt as MigrationWriteMode, S as ConvexNumberBuilder, Si as ColumnBuilderTypeConfig, Sn as rlsPolicy, Sr as MutationResult, St as MigrationRunChunkArgs, T as ConvexIdBuilder, Ti as DrizzleEntity, Tn as rlsRole, Tr as OrderByClause, Tt as MigrationDefinition, U as ConvexBooleanBuilderInitial, Un as vectorIndex, Ur as SystemFields, Ut as DatabaseWithMutations, V as bytes, Vn as searchIndex, Vr as OrmSchemaTriggers, Vt as defineMigrationSet, W as boolean, Wn as ConvexCheckBuilder, Wr as BinaryExpression, Wt as DatabaseWithQuery, X as CountBackfillStatusArgs, Xn as ConvexUniqueConstraintConfig, Xr as and, Xt as extractRelationsConfig, Y as CountBackfillKickoffArgs, Yn as ConvexUniqueConstraintBuilderOn, Yr as UnaryExpression, Yt as EdgeMetadata, Z as CreateOrmOptions, Zn as check, Zr as between, Zt as ExtractTablesFromSchema, _ as ConvexTimestampMode, _i as startsWith, _n as deletion, _r as MutationExecuteConfig, _t as OrmTriggerContext, a as requireSchemaRelations, ai as inArray, an as TablesRelationalConfig, ar as AggregateResult, at as OrmWriterCtx, b as ConvexTextEnumBuilderInitial, bi as ColumnBuilderBaseConfig, bn as RlsPolicyConfig, br as MutationPaginateConfig, bt as MigrationCancelArgs, c as TableConfigResult, ci as isNull, cn as ConvexDeletionBuilder, cr as CountConfig, ct as ScheduledMutationBatchArgs, d as OrmNotFoundError, di as lte, dn as ConvexTableWithColumns, dr as FilterOperators, dt as scheduledDeleteFactory, ei as eq, en as OneConfig, er as ConvexTextBuilder, et as OrmApiResult, f as ConvexVectorBuilder, fi as ne, fn as DiscriminatorBuilderConfig, fr as GetColumnData, ft as SchemaExtension, g as ConvexTimestampBuilderInitial, gi as or, gn as convexTable, gr as InsertValue, gt as OrmTriggerChange, h as ConvexTimestampBuilder, hi as notInArray, hn as TableConfig, hr as InferSelectModel, ht as OrmTableTriggers, i as getSchemaTriggers, ii as ilike, in as TableRelationalConfig, ir as AggregateFieldValue, it as OrmReaderCtx, j as date, jn as ConvexRankIndexBuilderOn, jr as ReturningSelection, jt as MigrationMigrateOne, k as ConvexDateBuilderInitial, ki as NotNull, kn as ConvexIndexBuilderOn, kr as ReturningAll, kt as MigrationDriftIssue, l as getTableColumns, li as like, ln as ConvexDeletionConfig, lr as CountResult, lt as scheduledMutationBatchFactory, m as vector, mi as notBetween, mn as OrmLifecycleOperation, mr as InferModelFromColumns, mt as OrmBeforeResult, n as defineSchema, ni as gt, nn as RelationsBuilderColumnBase, nr as text, nt as OrmClientWithApi$1, o as asc, oi as isFieldReference, on as defineRelations, or as BuildQueryResult, ot as ResolveOrmSchema, p as ConvexVectorBuilderInitial, pi as not, pn as OrmLifecycleChange, pr as InferInsertModel, pt as defineSchemaExtension, q as bigint, qn as ConvexForeignKeyConfig, qr as FilterExpression, qt as RlsContext, r as getSchemaRelations, ri as gte, rn as RelationsBuilderColumnConfig, rr as AggregateConfig, rt as OrmFunctions, s as desc, si as isNotNull, sn as defineRelationsPart, sr as BuildRelationResult, st as createOrm, t as WhereClauseResult, ti as fieldRef, tn as RelationsBuilder, tr as ConvexTextBuilderInitial, tt as OrmClientBase$1, u as getTableConfig, ui as lt, un as ConvexTable, ur as DBQueryConfig, ut as ScheduledDeleteArgs, v as timestamp, vi as AnyColumn, vn as discriminator, vr as MutationExecuteResult, vt as OrmTriggers, w as integer, wi as ColumnDataType, wn as RlsRoleConfig, wr as MutationRunMode, wt as MigrationAppliedState, x as textEnum, xi as ColumnBuilderRuntimeConfig, xn as RlsPolicyToOption, xr as MutationPaginatedResult, xt as MigrationRunArgs, y as ConvexTextEnumBuilder, yi as ColumnBuilder, yn as RlsPolicy, yr as MutationExecutionMode, yt as defineTriggers, z as ConvexBytesBuilder, zn as index, zr as OrmSchemaExtensions, zt as buildMigrationPlan } from "../where-clause-compiler-Dv-3mnJF.js";
2
2
  import { i as pretendRequired, n as deprecated, r as pretend } from "../validators-BhsByJeg.js";
3
3
  import { a as QueryCtxWithPreferredOrmQueryTable, i as QueryCtxWithOrmQueryTable, n as LookupByIdResultByCtx, o as getByIdWithOrmQueryFallback, r as QueryCtxWithOptionalOrmQueryTable, t as DocByCtx } from "../query-context-CNo9ffvI.js";
4
4
  import { DefineSchemaOptions, GenericDatabaseReader, GenericDatabaseWriter, GenericSchema, SchemaDefinition } from "convex/server";
@@ -1,13 +1,11 @@
1
1
  'use client';
2
- import { ConvexProvider, ConvexProviderWithAuth as ConvexProviderWithAuth$1, ConvexReactClient, ConvexReactClient as ConvexReactClient$1, ConvexReactClientOptions, Watch, WatchQueryOptions, useConvex } from "convex/react";
3
- import * as react from "react";
2
+ import { C as useMaybeAuth, S as useIsAuth, _ as useAuthState, a as Authenticated, b as useConvexAuthBridge, c as FetchAccessTokenContext, d as MaybeUnauthenticated, f as Unauthenticated, g as useAuthGuard, h as useAuth, i as AuthStoreState, l as FetchAccessTokenFn, m as isSessionSyncGraceActive, n as AuthProvider, o as ConvexAuthBridge, p as decodeJwtExp, r as AuthStore, s as ConvexProviderWithAuth, t as AUTH_SESSION_SYNC_GRACE_MS, u as MaybeAuthenticated, v as useAuthStore, w as useSafeConvexAuth, x as useFetchAccessToken, y as useAuthValue } from "../auth-store-B_ARzzEX.js";
3
+ import { ConvexProvider, ConvexReactClient, ConvexReactClient as ConvexReactClient$1, ConvexReactClientOptions, Watch, WatchQueryOptions, useConvex } from "convex/react";
4
4
  import { ReactNode } from "react";
5
- import * as jotai_x0 from "jotai-x";
6
5
  import * as react_jsx_runtime0 from "react/jsx-runtime";
7
6
  import { FunctionArgs, FunctionReference, FunctionReturnType } from "convex/server";
8
7
  import { DefaultError, QueryCache, QueryClient, QueryFilters, QueryFunction, QueryFunctionContext, QueryKey, SkipToken, UseMutationOptions, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
9
8
  import { ConvexHttpClient } from "convex/browser";
10
- import * as jotai_vanilla0 from "jotai/vanilla";
11
9
  import { z } from "zod";
12
10
 
13
11
  //#region src/crpc/auth-error.d.ts
@@ -112,154 +110,6 @@ type AuthMutationsResult = {
112
110
  };
113
111
  declare function createAuthMutations(authClient: AuthClient): AuthMutationsResult;
114
112
  //#endregion
115
- //#region src/react/auth-store.d.ts
116
- type FetchAccessTokenFn = (args: {
117
- forceRefreshToken: boolean;
118
- }) => Promise<string | null>;
119
- declare const FetchAccessTokenContext: react.Context<FetchAccessTokenFn | null>;
120
- /** Get fetchAccessToken from context (available immediately, no race condition) */
121
- declare const useFetchAccessToken: () => FetchAccessTokenFn | null;
122
- type ConvexAuthResult = {
123
- isAuthenticated: boolean;
124
- isLoading: boolean;
125
- };
126
- /** Get auth from bridge context (null if no bridge configured) */
127
- declare const useConvexAuthBridge: () => ConvexAuthResult | null;
128
- type AuthStoreState = {
129
- /** Callback when mutation/action called while unauthorized. Throws by default. */onMutationUnauthorized: () => void; /** Callback when query called while unauthorized. Noop by default. */
130
- onQueryUnauthorized: (info: {
131
- queryName: string;
132
- }) => void; /** Custom function to detect UNAUTHORIZED errors. Default checks code or "auth" in message. */
133
- isUnauthorized: (error: unknown) => boolean; /** Cached Convex JWT for HTTP requests */
134
- token: string | null; /** JWT expiration timestamp (ms) */
135
- expiresAt: number | null; /** Auth loading state (synced from useConvexAuth for class methods) */
136
- isLoading: boolean; /** Auth state (synced from useConvexAuth for class methods) */
137
- isAuthenticated: boolean; /** Grace window for freshly seeded auth tokens while session sync catches up */
138
- sessionSyncGraceUntil: number | null;
139
- };
140
- declare const AUTH_SESSION_SYNC_GRACE_MS = 10000;
141
- declare const isSessionSyncGraceActive: (sessionSyncGraceUntil: number | null) => boolean;
142
- /** Decode JWT expiration (ms timestamp) from token */
143
- declare function decodeJwtExp(token: string): number | null;
144
- declare const AuthProvider: react.FC<jotai_x0.ProviderProps<{
145
- onMutationUnauthorized: () => void;
146
- onQueryUnauthorized: (info: {
147
- queryName: string;
148
- }) => void;
149
- isUnauthorized: (error: unknown) => boolean;
150
- token: string | null;
151
- expiresAt: number | null;
152
- isLoading: boolean;
153
- isAuthenticated: boolean;
154
- sessionSyncGraceUntil: number | null;
155
- }>>, useAuthStore: jotai_x0.UseStoreApi<AuthStoreState, object>, useAuthState: <K extends keyof AuthStoreState>(key: K, options?: string | jotai_x0.UseAtomOptions) => ({
156
- onMutationUnauthorized: jotai_x0.SimpleWritableAtom<() => void>;
157
- onQueryUnauthorized: jotai_x0.SimpleWritableAtom<(info: {
158
- queryName: string;
159
- }) => void>;
160
- isUnauthorized: jotai_x0.SimpleWritableAtom<(error: unknown) => boolean>;
161
- token: jotai_x0.SimpleWritableAtom<string | null>;
162
- expiresAt: jotai_x0.SimpleWritableAtom<number | null>;
163
- isLoading: jotai_x0.SimpleWritableAtom<boolean>;
164
- isAuthenticated: jotai_x0.SimpleWritableAtom<boolean>;
165
- sessionSyncGraceUntil: jotai_x0.SimpleWritableAtom<number | null>;
166
- } & object)[K] extends jotai_vanilla0.WritableAtom<infer V, infer A extends unknown[], infer R> ? [V, (...args: A) => R] : never, useAuthValue: <K extends keyof AuthStoreState, S = (({
167
- onMutationUnauthorized: jotai_x0.SimpleWritableAtom<() => void>;
168
- onQueryUnauthorized: jotai_x0.SimpleWritableAtom<(info: {
169
- queryName: string;
170
- }) => void>;
171
- isUnauthorized: jotai_x0.SimpleWritableAtom<(error: unknown) => boolean>;
172
- token: jotai_x0.SimpleWritableAtom<string | null>;
173
- expiresAt: jotai_x0.SimpleWritableAtom<number | null>;
174
- isLoading: jotai_x0.SimpleWritableAtom<boolean>;
175
- isAuthenticated: jotai_x0.SimpleWritableAtom<boolean>;
176
- sessionSyncGraceUntil: jotai_x0.SimpleWritableAtom<number | null>;
177
- } & object)[K] extends jotai_vanilla0.Atom<infer V> ? V : never)>(key: K, options?: ({
178
- selector?: ((v: ({
179
- onMutationUnauthorized: jotai_x0.SimpleWritableAtom<() => void>;
180
- onQueryUnauthorized: jotai_x0.SimpleWritableAtom<(info: {
181
- queryName: string;
182
- }) => void>;
183
- isUnauthorized: jotai_x0.SimpleWritableAtom<(error: unknown) => boolean>;
184
- token: jotai_x0.SimpleWritableAtom<string | null>;
185
- expiresAt: jotai_x0.SimpleWritableAtom<number | null>;
186
- isLoading: jotai_x0.SimpleWritableAtom<boolean>;
187
- isAuthenticated: jotai_x0.SimpleWritableAtom<boolean>;
188
- sessionSyncGraceUntil: jotai_x0.SimpleWritableAtom<number | null>;
189
- } & object)[K] extends jotai_vanilla0.Atom<infer V_1> ? V_1 : never, prevSelectorOutput?: S | undefined) => S) | undefined;
190
- equalityFn?: ((prev: S, next: S) => boolean) | undefined;
191
- } & jotai_x0.UseAtomOptions) | undefined, deps?: unknown[]) => S;
192
- type AuthStore = ReturnType<typeof useAuthStore>;
193
- /**
194
- * Safe wrapper around useConvexAuth that doesn't throw when used outside auth provider.
195
- * Returns { isAuthenticated: false, isLoading: false } when no auth provider.
196
- *
197
- * Supports both:
198
- * - better-auth users (via AuthProvider)
199
- * - @convex-dev/auth users (via ConvexAuthBridge)
200
- */
201
- declare function useSafeConvexAuth(): ConvexAuthResult;
202
- /**
203
- * Internal bridge component. Use `ConvexProviderWithAuth` instead.
204
- * @internal
205
- */
206
- declare function ConvexAuthBridge({
207
- children
208
- }: {
209
- children: React.ReactNode;
210
- }): react_jsx_runtime0.JSX.Element;
211
- /**
212
- * Convex provider with auth bridge for @convex-dev/auth users.
213
- * Automatically wraps children with ConvexAuthBridge.
214
- *
215
- * @example
216
- * ```tsx
217
- * import { ConvexProviderWithAuth } from 'kitcn/react';
218
- *
219
- * <ConvexProviderWithAuth client={convex} useAuth={useAuthFromConvexDev}>
220
- * <App />
221
- * </ConvexProviderWithAuth>
222
- * ```
223
- */
224
- declare function ConvexProviderWithAuth({
225
- children,
226
- ...props
227
- }: React.ComponentProps<typeof ConvexProviderWithAuth$1>): react_jsx_runtime0.JSX.Element;
228
- declare const useAuth: () => {
229
- hasSession: boolean;
230
- isAuthenticated: boolean;
231
- isLoading: boolean;
232
- };
233
- /** Check if user maybe has auth (optimistic, has token) */
234
- declare const useMaybeAuth: () => boolean;
235
- /** Check if user is authenticated (server-verified) */
236
- declare const useIsAuth: () => boolean;
237
- declare const useAuthGuard: () => (callback?: () => Promise<void> | void) => boolean | undefined;
238
- /** Render children only when maybe has auth (optimistic) */
239
- declare function MaybeAuthenticated({
240
- children
241
- }: {
242
- children: React.ReactNode;
243
- }): react.ReactNode;
244
- /** Render children only when authenticated (server-verified) */
245
- declare function Authenticated({
246
- children
247
- }: {
248
- children: React.ReactNode;
249
- }): react.ReactNode;
250
- /** Render children only when maybe not auth (optimistic) */
251
- declare function MaybeUnauthenticated({
252
- children
253
- }: {
254
- children: React.ReactNode;
255
- }): react.ReactNode;
256
- /** Render children only when not authenticated (server-verified) */
257
- declare function Unauthenticated({
258
- children
259
- }: {
260
- children: React.ReactNode;
261
- }): react.ReactNode;
262
- //#endregion
263
113
  //#region src/crpc/transformer.d.ts
264
114
  /**
265
115
  * Generic transformer contract (mirrors tRPC shape).
@@ -1926,7 +1926,7 @@ var ConvexQueryClient = class {
1926
1926
  }
1927
1927
  if (result.ok) {
1928
1928
  const existingData = this.queryClient.getQueryData(queryKey);
1929
- if (result.value !== null && result.value !== void 0 || !(existingData !== null && existingData !== void 0)) this.queryClient.setQueryData(queryKey, this.transformer.output.deserialize(result.value));
1929
+ if (result.value !== void 0 || !(existingData !== void 0)) this.queryClient.setQueryData(queryKey, this.transformer.output.deserialize(result.value));
1930
1930
  } else {
1931
1931
  const { error } = result;
1932
1932
  const authState = this.getAuthState();
@@ -2048,7 +2048,7 @@ var ConvexQueryClient = class {
2048
2048
  };
2049
2049
  if (result.ok) {
2050
2050
  const existingData = this.queryClient.getQueryData(queryKey);
2051
- if (result.value !== null && result.value !== void 0 || !(existingData !== null && existingData !== void 0)) this.queryClient.setQueryData(queryKey, this.transformer.output.deserialize(result.value));
2051
+ if (result.value !== void 0 || !(existingData !== void 0)) this.queryClient.setQueryData(queryKey, this.transformer.output.deserialize(result.value));
2052
2052
  } else {
2053
2053
  const { error } = result;
2054
2054
  const authState = this.getAuthState();
package/dist/watcher.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { Dt as generateMeta, F as resolveRunDeps, Ot as getConvexConfig, j as resolveConfiguredBackend, kt as logger, q as withLocalCodegenEnv } from "./backend-core-BYs_6mO4.mjs";
2
+ import { Dt as generateMeta, F as resolveRunDeps, Ot as getConvexConfig, j as resolveConfiguredBackend, kt as logger, q as withLocalCodegenEnv } from "./backend-core-BA0CgHrL.mjs";
3
3
  import path from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
 
@@ -3717,7 +3717,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
3717
3717
  readonly aggregate_bucket: ConvexTableWithColumns<{
3718
3718
  name: "aggregate_bucket";
3719
3719
  columns: {
3720
- updatedAt: ConvexNumberBuilderInitial<""> & {
3720
+ count: ConvexNumberBuilderInitial<""> & {
3721
3721
  _: {
3722
3722
  notNull: true;
3723
3723
  };
@@ -3727,10 +3727,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
3727
3727
  };
3728
3728
  } & {
3729
3729
  _: {
3730
- fieldName: "updatedAt";
3730
+ fieldName: "count";
3731
3731
  };
3732
3732
  };
3733
- count: ConvexNumberBuilderInitial<""> & {
3733
+ updatedAt: ConvexNumberBuilderInitial<""> & {
3734
3734
  _: {
3735
3735
  notNull: true;
3736
3736
  };
@@ -3740,7 +3740,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
3740
3740
  };
3741
3741
  } & {
3742
3742
  _: {
3743
- fieldName: "count";
3743
+ fieldName: "updatedAt";
3744
3744
  };
3745
3745
  };
3746
3746
  tableKey: ConvexTextBuilderInitial<""> & {
@@ -3992,11 +3992,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
3992
3992
  readonly aggregate_extrema: ConvexTableWithColumns<{
3993
3993
  name: "aggregate_extrema";
3994
3994
  columns: {
3995
- value: ConvexCustomBuilderInitial<"", convex_values0.VAny<any, "required", string>> & {
3996
- _: {
3997
- $type: convex_values0.Value;
3998
- };
3999
- } & {
3995
+ count: ConvexNumberBuilderInitial<""> & {
4000
3996
  _: {
4001
3997
  notNull: true;
4002
3998
  };
@@ -4006,10 +4002,14 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
4006
4002
  };
4007
4003
  } & {
4008
4004
  _: {
4009
- fieldName: "value";
4005
+ fieldName: "count";
4010
4006
  };
4011
4007
  };
4012
- updatedAt: ConvexNumberBuilderInitial<""> & {
4008
+ value: ConvexCustomBuilderInitial<"", convex_values0.VAny<any, "required", string>> & {
4009
+ _: {
4010
+ $type: convex_values0.Value;
4011
+ };
4012
+ } & {
4013
4013
  _: {
4014
4014
  notNull: true;
4015
4015
  };
@@ -4019,10 +4019,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
4019
4019
  };
4020
4020
  } & {
4021
4021
  _: {
4022
- fieldName: "updatedAt";
4022
+ fieldName: "value";
4023
4023
  };
4024
4024
  };
4025
- count: ConvexNumberBuilderInitial<""> & {
4025
+ updatedAt: ConvexNumberBuilderInitial<""> & {
4026
4026
  _: {
4027
4027
  notNull: true;
4028
4028
  };
@@ -4032,7 +4032,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
4032
4032
  };
4033
4033
  } & {
4034
4034
  _: {
4035
- fieldName: "count";
4035
+ fieldName: "updatedAt";
4036
4036
  };
4037
4037
  };
4038
4038
  tableKey: ConvexTextBuilderInitial<""> & {
@@ -4411,22 +4411,22 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
4411
4411
  fieldName: "status";
4412
4412
  };
4413
4413
  };
4414
- cursor: ConvexTextBuilderInitial<""> & {
4414
+ direction: ConvexTextBuilderInitial<""> & {
4415
4415
  _: {
4416
4416
  tableName: "migration_state";
4417
4417
  };
4418
4418
  } & {
4419
4419
  _: {
4420
- fieldName: "cursor";
4420
+ fieldName: "direction";
4421
4421
  };
4422
4422
  };
4423
- direction: ConvexTextBuilderInitial<""> & {
4423
+ cursor: ConvexTextBuilderInitial<""> & {
4424
4424
  _: {
4425
4425
  tableName: "migration_state";
4426
4426
  };
4427
4427
  } & {
4428
4428
  _: {
4429
- fieldName: "direction";
4429
+ fieldName: "cursor";
4430
4430
  };
4431
4431
  };
4432
4432
  updatedAt: ConvexNumberBuilderInitial<""> & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitcn",
3
- "version": "0.15.2",
3
+ "version": "0.15.4",
4
4
  "description": "kitcn - React Query integration and CLI tools for Convex",
5
5
  "keywords": [
6
6
  "convex",
@@ -387,6 +387,7 @@ All from `kitcn/react`:
387
387
  <ConvexAuthProvider
388
388
  client={convex}
389
389
  authClient={authClient}
390
+ convexQueryClient={convexQueryClient} // when using TanStack Query
390
391
  initialToken={token} // from SSR (caller.getToken())
391
392
  onMutationUnauthorized={() => router.push('/login')}
392
393
  onQueryUnauthorized={({ queryName }) => console.log(`Unauth: ${queryName}`)}
@@ -113,37 +113,32 @@ function QueryProvider({ children }) {
113
113
  **With auth** — swap `ConvexProvider` for `ConvexAuthProvider`:
114
114
  ```tsx
115
115
  import { ConvexAuthProvider } from 'kitcn/auth/client';
116
- import { ConvexReactClient, getConvexQueryClientSingleton, getQueryClientSingleton, useAuthStore } from 'kitcn/react';
116
+ import { ConvexReactClient, getConvexQueryClientSingleton, getQueryClientSingleton } from 'kitcn/react';
117
117
 
118
118
  const convex = new ConvexReactClient(process.env.NEXT_PUBLIC_CONVEX_URL!);
119
119
 
120
120
  export function AppConvexProvider({ children, token }: { children: ReactNode; token?: string }) {
121
121
  const router = useRouter();
122
+ const queryClient = getQueryClientSingleton(createQueryClient);
123
+ const convexQueryClient = getConvexQueryClientSingleton({ convex, queryClient });
124
+
122
125
  return (
123
126
  <ConvexAuthProvider
124
127
  authClient={authClient}
125
128
  client={convex}
129
+ convexQueryClient={convexQueryClient}
126
130
  initialToken={token}
127
131
  onMutationUnauthorized={() => router.push('/login')}
128
132
  onQueryUnauthorized={() => router.push('/login')}
129
133
  >
130
- <QueryProvider>{children}</QueryProvider>
134
+ <QueryClientProvider client={queryClient}>
135
+ <CRPCProvider convexClient={convex} convexQueryClient={convexQueryClient}>
136
+ {children}
137
+ </CRPCProvider>
138
+ </QueryClientProvider>
131
139
  </ConvexAuthProvider>
132
140
  );
133
141
  }
134
-
135
- function QueryProvider({ children }) {
136
- const authStore = useAuthStore(); // pass to singleton
137
- const queryClient = getQueryClientSingleton(createQueryClient);
138
- const convexQueryClient = getConvexQueryClientSingleton({ authStore, convex, queryClient });
139
- return (
140
- <QueryClientProvider client={queryClient}>
141
- <CRPCProvider convexClient={convex} convexQueryClient={convexQueryClient}>
142
- {children}
143
- </CRPCProvider>
144
- </QueryClientProvider>
145
- );
146
- }
147
142
  ```
148
143
 
149
144
  ### Singleton Helpers
@@ -156,7 +151,7 @@ function QueryProvider({ children }) {
156
151
  `getConvexQueryClientSingleton` options:
157
152
  - `convex` — ConvexReactClient
158
153
  - `queryClient` — TanStack QueryClient
159
- - `authStore` — from `useAuthStore()` (auth apps only)
154
+ - `authStore` — optional manual auth-store bridge
160
155
  - `unsubscribeDelay` — ms before unsubscribing after unmount (default 3000). Covers StrictMode + quick back-nav.
161
156
 
162
157
  ### ConvexQueryClient (Bridge)
@@ -119,7 +119,6 @@ import {
119
119
  ConvexReactClient,
120
120
  getConvexQueryClientSingleton,
121
121
  getQueryClientSingleton,
122
- useAuthStore,
123
122
  } from "kitcn/react";
124
123
  import type { ReactNode } from "react";
125
124
 
@@ -136,33 +135,25 @@ export function AppConvexProvider({
136
135
  children: ReactNode;
137
136
  token?: string;
138
137
  }) {
139
- return (
140
- <ConvexAuthProvider
141
- authClient={authClient}
142
- client={convex}
143
- initialToken={token}
144
- >
145
- <QueryProvider>{children}</QueryProvider>
146
- </ConvexAuthProvider>
147
- );
148
- }
149
-
150
- function QueryProvider({ children }: { children: ReactNode }) {
151
- const authStore = useAuthStore();
152
-
153
138
  const queryClient = getQueryClientSingleton(createQueryClient);
154
139
  const convexQueryClient = getConvexQueryClientSingleton({
155
- authStore,
156
140
  convex,
157
141
  queryClient,
158
142
  });
159
143
 
160
144
  return (
161
- <TanstackQueryClientProvider client={queryClient}>
162
- <CRPCProvider convexClient={convex} convexQueryClient={convexQueryClient}>
163
- {children}
164
- </CRPCProvider>
165
- </TanstackQueryClientProvider>
145
+ <ConvexAuthProvider
146
+ authClient={authClient}
147
+ client={convex}
148
+ convexQueryClient={convexQueryClient}
149
+ initialToken={token}
150
+ >
151
+ <TanstackQueryClientProvider client={queryClient}>
152
+ <CRPCProvider convexClient={convex} convexQueryClient={convexQueryClient}>
153
+ {children}
154
+ </CRPCProvider>
155
+ </TanstackQueryClientProvider>
156
+ </ConvexAuthProvider>
166
157
  );
167
158
  }
168
159
  ```