kitcn 0.15.2 → 0.15.5

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 (31) hide show
  1. package/dist/aggregate/index.d.ts +1 -1
  2. package/dist/auth/client/index.d.ts +8 -2
  3. package/dist/auth/client/index.js +4 -2
  4. package/dist/auth/generated/index.d.ts +1 -1
  5. package/dist/auth/index.d.ts +1 -1
  6. package/dist/auth/start/index.d.ts +1 -15
  7. package/dist/auth/start/index.js +1 -124
  8. package/dist/auth/start/server/index.d.ts +17 -0
  9. package/dist/auth/start/server/index.js +126 -0
  10. package/dist/auth-store-B_ARzzEX.d.ts +156 -0
  11. package/dist/{backend-core-BYs_6mO4.mjs → backend-core-PsWKI66u.mjs} +46 -77
  12. package/dist/cli.mjs +1 -1
  13. package/dist/crpc/index.d.ts +1 -1
  14. package/dist/orm/index.d.ts +1 -1
  15. package/dist/plugins/index.d.ts +1 -1
  16. package/dist/ratelimit/index.d.ts +1 -1
  17. package/dist/react/index.d.ts +2 -152
  18. package/dist/react/index.js +4 -3
  19. package/dist/rsc/index.d.ts +1 -1
  20. package/dist/solid/index.js +1 -1
  21. package/dist/watcher.mjs +1 -1
  22. package/dist/{where-clause-compiler-DLiYI2EF.d.ts → where-clause-compiler-DcEhkJ12.d.ts} +8 -8
  23. package/package.json +7 -1
  24. package/skills/kitcn/references/features/auth.md +1 -0
  25. package/skills/kitcn/references/features/react.md +11 -16
  26. package/skills/kitcn/references/setup/index.md +1 -1
  27. package/skills/kitcn/references/setup/react.md +12 -21
  28. package/skills/kitcn/references/setup/start.md +1 -1
  29. /package/dist/{generated-contract-disabled-C_-KWRfT.d.ts → generated-contract-disabled-0xEF3NtW.d.ts} +0 -0
  30. /package/dist/{middleware-DrtexzF3.d.ts → middleware-Br5zubu7.d.ts} +0 -0
  31. /package/dist/{types-YHpe0rsb.d.ts → types-jNTcza_a.d.ts} +0 -0
@@ -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)
@@ -799,7 +799,7 @@ This runbook + references map to the canonical template shape as follows:
799
799
  | `Property 'insert'/'update' does not exist on type 'OrmReader'` | Using query context for mutations | Ensure mutation handlers use `publicMutation` / `protectedMutation` builders |
800
800
  | `useCRPC must be used within CRPCProvider` | Provider chain not mounted around route tree | Wrap app with `AppConvexProvider` and verify `CRPCProvider` is inside QueryClientProvider (Section 7.4 / 8.A.4) |
801
801
  | Route auth cookies not set | Missing CORS auth headers | Add `Better-Auth-Cookie` allow/expose headers + credentials |
802
- | TanStack Start auth helper import errors | Using `kitcn/auth/nextjs` in Start app | Use the TanStack Start helper from `kitcn/auth/start` |
802
+ | TanStack Start auth helper import errors | Using `kitcn/auth/nextjs` in Start app | Use the shared Start loader helper from `kitcn/auth/start` and the server adapter from `kitcn/auth/start/server` |
803
803
  | `Returned promise will never resolve` from internal function | Trigger path is recursively querying/updating related rows or stale component wiring still runs | Isolate failing write with logs, disable/move trigger-side sync into explicit mutation helper, rerun `bunx kitcn verify`, then retry the runtime proof |
804
804
  | Better Auth secret mismatch/warnings in setup flows | `BETTER_AUTH_SECRET` manually set inconsistently or low entropy | Let `bunx kitcn dev` manage local bootstrap, or regenerate/push via `bunx kitcn env push` for active non-local targets |
805
805
  | `Invalid orderBy value. Use a column or asc()/desc()` | Wrong `orderBy` shape (`[{ field, direction }]`) | Use object form only, e.g. `orderBy: { updatedAt: "desc" }` |
@@ -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
  ```
@@ -34,7 +34,7 @@ export const {
34
34
  **Create:** `src/lib/convex/auth-server.ts`
35
35
 
36
36
  ```ts
37
- import { convexBetterAuthReactStart } from "kitcn/auth/start";
37
+ import { convexBetterAuthReactStart } from "kitcn/auth/start/server";
38
38
 
39
39
  export const {
40
40
  handler,