kitcn 0.12.17 → 0.12.18
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.
- package/dist/aggregate/index.d.ts +1 -1
- package/dist/auth/client/index.js +82 -1
- package/dist/auth/nextjs/index.d.ts +1 -1
- package/dist/auth/start/index.d.ts +7 -1
- package/dist/auth/start/index.js +37 -0
- package/dist/{auth-store-Cljlmdmi.js → auth-store-C0iMu34r.js} +53 -1
- package/dist/{backend-core-Rv9NorIW.mjs → backend-core-CGjsBIOp.mjs} +96 -154
- package/dist/{builder-CBdG5W6A.js → builder-Bh18Y2t0.js} +1 -0
- package/dist/cli.mjs +1 -1
- package/dist/{middleware-C2qTZ3V7.js → middleware-C5P1Q29c.js} +1 -1
- package/dist/orm/index.d.ts +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/{procedure-caller-MWcxhQDv.js → procedure-caller-DL0Ubgky.js} +1 -1
- package/dist/{procedure-caller-C15h5Iel.d.ts → procedure-caller-DloN1DNv.d.ts} +6 -4
- package/dist/ratelimit/index.js +2 -2
- package/dist/react/index.js +7 -2
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +2 -2
- package/dist/watcher.mjs +1 -1
- package/dist/{where-clause-compiler-DdjN63Io.d.ts → where-clause-compiler-Dw3EVdi6.d.ts} +23 -23
- package/package.json +1 -1
- package/skills/convex/SKILL.md +3 -0
- package/skills/convex/references/features/react.md +18 -3
|
@@ -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-
|
|
1
|
+
import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial, dn as ConvexTableWithColumns, tr as ConvexTextBuilderInitial } from "../where-clause-compiler-Dw3EVdi6.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,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { C as defaultIsUnauthorized, S as
|
|
2
|
+
import { C as readAuthSessionFallbackData, D as CRPCClientError, O as defaultIsUnauthorized, S as clearAuthSessionFallback, T as writeAuthSessionFallbackData, d as isSessionSyncGraceActive, g as useAuthValue, h as useAuthStore, n as AuthProvider, o as FetchAccessTokenContext, t as AUTH_SESSION_SYNC_GRACE_MS, u as decodeJwtExp, w as readAuthSessionFallbackToken } from "../../auth-store-C0iMu34r.js";
|
|
3
3
|
import { convexClient } from "@convex-dev/better-auth/client/plugins";
|
|
4
4
|
import { ConvexProviderWithAuth, useConvexAuth } from "convex/react";
|
|
5
5
|
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
@@ -16,6 +16,48 @@ const hasActiveSessionData = (session) => {
|
|
|
16
16
|
if (!session || typeof session !== "object") return false;
|
|
17
17
|
return Boolean(session.session);
|
|
18
18
|
};
|
|
19
|
+
const wait = (ms) => new Promise((resolve) => {
|
|
20
|
+
setTimeout(resolve, ms);
|
|
21
|
+
});
|
|
22
|
+
const getSessionFromPersistedToken = async (authClient, token) => {
|
|
23
|
+
await wait(250);
|
|
24
|
+
for (let attempt = 0; attempt < 10; attempt += 1) {
|
|
25
|
+
const result = authClient.$fetch ? await authClient.$fetch("/get-session", {
|
|
26
|
+
credentials: "omit",
|
|
27
|
+
headers: { Authorization: `Bearer ${token}` }
|
|
28
|
+
}) : await authClient.getSession?.({ fetchOptions: {
|
|
29
|
+
credentials: "omit",
|
|
30
|
+
headers: { Authorization: `Bearer ${token}` }
|
|
31
|
+
} });
|
|
32
|
+
if (result?.data) return result.data;
|
|
33
|
+
if (attempt < 9) await wait(100);
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
};
|
|
37
|
+
const syncSessionAtom = (authClient, sessionData) => {
|
|
38
|
+
const sessionAtom = authClient.$store?.atoms?.session;
|
|
39
|
+
if (typeof sessionAtom?.get !== "function" || typeof sessionAtom.set !== "function") return;
|
|
40
|
+
const current = sessionAtom.get();
|
|
41
|
+
sessionAtom.set({
|
|
42
|
+
data: sessionData,
|
|
43
|
+
error: null,
|
|
44
|
+
isPending: false,
|
|
45
|
+
isRefetching: false,
|
|
46
|
+
refetch: current?.refetch ?? (async () => {})
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
const clearSessionAtom = (authClient) => {
|
|
50
|
+
const sessionAtom = authClient.$store?.atoms?.session;
|
|
51
|
+
if (typeof sessionAtom?.get !== "function" || typeof sessionAtom.set !== "function") return;
|
|
52
|
+
const current = sessionAtom.get();
|
|
53
|
+
sessionAtom.set({
|
|
54
|
+
data: null,
|
|
55
|
+
error: null,
|
|
56
|
+
isPending: false,
|
|
57
|
+
isRefetching: false,
|
|
58
|
+
refetch: current?.refetch ?? (async () => {})
|
|
59
|
+
});
|
|
60
|
+
};
|
|
19
61
|
/**
|
|
20
62
|
* Unified auth provider for Convex + Better Auth.
|
|
21
63
|
* Handles token sync, HMR persistence, and auth callbacks.
|
|
@@ -75,6 +117,45 @@ function ConvexAuthProviderInner({ children, client, authClient }) {
|
|
|
75
117
|
isPending,
|
|
76
118
|
authStore
|
|
77
119
|
]);
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
if (hasActiveSessionData(session) || isPending || authStore.get("token")) return;
|
|
122
|
+
const persistedToken = readAuthSessionFallbackToken();
|
|
123
|
+
const persistedSessionData = readAuthSessionFallbackData();
|
|
124
|
+
if (!persistedToken || typeof authClient.getSession !== "function" && typeof authClient.$fetch !== "function") return;
|
|
125
|
+
let cancelled = false;
|
|
126
|
+
authStore.set("token", persistedToken);
|
|
127
|
+
authStore.set("expiresAt", decodeJwtExp(persistedToken));
|
|
128
|
+
authStore.set("sessionSyncGraceUntil", Date.now() + AUTH_SESSION_SYNC_GRACE_MS);
|
|
129
|
+
if (persistedSessionData) syncSessionAtom(authClient, persistedSessionData);
|
|
130
|
+
getSessionFromPersistedToken(authClient, persistedToken).then((result) => {
|
|
131
|
+
if (cancelled) return;
|
|
132
|
+
if (result) {
|
|
133
|
+
syncSessionAtom(authClient, result);
|
|
134
|
+
writeAuthSessionFallbackData(result);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
clearAuthSessionFallback();
|
|
138
|
+
clearSessionAtom(authClient);
|
|
139
|
+
authStore.set("token", null);
|
|
140
|
+
authStore.set("expiresAt", null);
|
|
141
|
+
authStore.set("sessionSyncGraceUntil", null);
|
|
142
|
+
}).catch(() => {
|
|
143
|
+
if (cancelled) return;
|
|
144
|
+
clearAuthSessionFallback();
|
|
145
|
+
clearSessionAtom(authClient);
|
|
146
|
+
authStore.set("token", null);
|
|
147
|
+
authStore.set("expiresAt", null);
|
|
148
|
+
authStore.set("sessionSyncGraceUntil", null);
|
|
149
|
+
});
|
|
150
|
+
return () => {
|
|
151
|
+
cancelled = true;
|
|
152
|
+
};
|
|
153
|
+
}, [
|
|
154
|
+
session,
|
|
155
|
+
isPending,
|
|
156
|
+
authStore,
|
|
157
|
+
authClient
|
|
158
|
+
]);
|
|
78
159
|
const fetchAccessToken = useCallback(async ({ forceRefreshToken = false } = {}) => {
|
|
79
160
|
const fetchFreshToken = () => {
|
|
80
161
|
if (pendingTokenRef.current) return pendingTokenRef.current;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { L as ConvexContext, z as LazyCaller } from "../../procedure-caller-DloN1DNv.js";
|
|
2
2
|
import { GetTokenOptions } from "@convex-dev/better-auth/utils";
|
|
3
3
|
|
|
4
4
|
//#region src/auth-nextjs/index.d.ts
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { convexBetterAuthReactStart as convexBetterAuthReactStart$1 } from "@convex-dev/better-auth/react-start";
|
|
2
|
+
export * from "@convex-dev/better-auth/react-start";
|
|
3
|
+
|
|
4
|
+
//#region src/auth-start/index.d.ts
|
|
5
|
+
declare const convexBetterAuthReactStart: typeof convexBetterAuthReactStart$1;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { convexBetterAuthReactStart };
|
package/dist/auth/start/index.js
CHANGED
|
@@ -1 +1,38 @@
|
|
|
1
|
+
import { convexBetterAuthReactStart as convexBetterAuthReactStart$1 } from "@convex-dev/better-auth/react-start";
|
|
2
|
+
|
|
1
3
|
export * from "@convex-dev/better-auth/react-start"
|
|
4
|
+
|
|
5
|
+
//#region src/auth-start/index.ts
|
|
6
|
+
const appendSetCookieHeaders = (target, source) => {
|
|
7
|
+
const getSetCookie = source.getSetCookie;
|
|
8
|
+
if (typeof getSetCookie === "function") {
|
|
9
|
+
const values = getSetCookie.call(source);
|
|
10
|
+
for (const value of values) target.append("set-cookie", value);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const value = source.get("set-cookie");
|
|
14
|
+
if (value) target.append("set-cookie", value);
|
|
15
|
+
};
|
|
16
|
+
const cloneAuthHandlerResponse = (response) => {
|
|
17
|
+
const headers = new Headers();
|
|
18
|
+
for (const [key, value] of response.headers.entries()) {
|
|
19
|
+
if (key.toLowerCase() === "set-cookie") continue;
|
|
20
|
+
headers.append(key, value);
|
|
21
|
+
}
|
|
22
|
+
appendSetCookieHeaders(headers, response.headers);
|
|
23
|
+
return new Response(response.body, {
|
|
24
|
+
headers,
|
|
25
|
+
status: response.status,
|
|
26
|
+
statusText: response.statusText
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
const convexBetterAuthReactStart = ((...args) => {
|
|
30
|
+
const auth = convexBetterAuthReactStart$1(...args);
|
|
31
|
+
return {
|
|
32
|
+
...auth,
|
|
33
|
+
handler: async (request) => cloneAuthHandlerResponse(await auth.handler(request))
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
export { convexBetterAuthReactStart };
|
|
@@ -32,6 +32,58 @@ const defaultIsUnauthorized = (error) => {
|
|
|
32
32
|
return false;
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/react/auth-session-fallback.ts
|
|
37
|
+
const SESSION_TOKEN_FALLBACK_KEY = "kitcn.auth.session-token";
|
|
38
|
+
const SESSION_DATA_FALLBACK_KEY = "kitcn.auth.session-data";
|
|
39
|
+
const getSessionStorage = () => {
|
|
40
|
+
if (typeof window === "undefined") return null;
|
|
41
|
+
try {
|
|
42
|
+
return window.sessionStorage;
|
|
43
|
+
} catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const readAuthSessionFallbackToken = () => {
|
|
48
|
+
const storage = getSessionStorage();
|
|
49
|
+
if (!storage) return null;
|
|
50
|
+
const token = storage.getItem(SESSION_TOKEN_FALLBACK_KEY);
|
|
51
|
+
return token && token.length > 0 ? token : null;
|
|
52
|
+
};
|
|
53
|
+
const writeAuthSessionFallbackToken = (token) => {
|
|
54
|
+
const storage = getSessionStorage();
|
|
55
|
+
if (!storage) return;
|
|
56
|
+
if (token && token.length > 0) {
|
|
57
|
+
storage.setItem(SESSION_TOKEN_FALLBACK_KEY, token);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
storage.removeItem(SESSION_TOKEN_FALLBACK_KEY);
|
|
61
|
+
};
|
|
62
|
+
const readAuthSessionFallbackData = () => {
|
|
63
|
+
const storage = getSessionStorage();
|
|
64
|
+
if (!storage) return null;
|
|
65
|
+
const value = storage.getItem(SESSION_DATA_FALLBACK_KEY);
|
|
66
|
+
if (!value) return null;
|
|
67
|
+
try {
|
|
68
|
+
return JSON.parse(value);
|
|
69
|
+
} catch {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const writeAuthSessionFallbackData = (data) => {
|
|
74
|
+
const storage = getSessionStorage();
|
|
75
|
+
if (!storage) return;
|
|
76
|
+
if (data === null || data === void 0) {
|
|
77
|
+
storage.removeItem(SESSION_DATA_FALLBACK_KEY);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
storage.setItem(SESSION_DATA_FALLBACK_KEY, JSON.stringify(data));
|
|
81
|
+
};
|
|
82
|
+
const clearAuthSessionFallback = () => {
|
|
83
|
+
writeAuthSessionFallbackToken(null);
|
|
84
|
+
writeAuthSessionFallbackData(null);
|
|
85
|
+
};
|
|
86
|
+
|
|
35
87
|
//#endregion
|
|
36
88
|
//#region src/react/auth-store.tsx
|
|
37
89
|
/**
|
|
@@ -194,4 +246,4 @@ function Unauthenticated({ children }) {
|
|
|
194
246
|
}
|
|
195
247
|
|
|
196
248
|
//#endregion
|
|
197
|
-
export {
|
|
249
|
+
export { readAuthSessionFallbackData as C, CRPCClientError as D, writeAuthSessionFallbackToken as E, defaultIsUnauthorized as O, clearAuthSessionFallback as S, writeAuthSessionFallbackData as T, useConvexAuthBridge as _, ConvexProviderWithAuth$1 as a, useMaybeAuth as b, MaybeUnauthenticated as c, isSessionSyncGraceActive as d, useAuth as f, useAuthValue as g, useAuthStore as h, ConvexAuthBridge as i, isCRPCClientError as k, Unauthenticated as l, useAuthState as m, AuthProvider as n, FetchAccessTokenContext as o, useAuthGuard as p, Authenticated as r, MaybeAuthenticated as s, AUTH_SESSION_SYNC_GRACE_MS as t, decodeJwtExp as u, useFetchAccessToken as v, readAuthSessionFallbackToken as w, useSafeConvexAuth as x, useIsAuth as y };
|
|
@@ -2196,58 +2196,98 @@ const highlighter = {
|
|
|
2196
2196
|
};
|
|
2197
2197
|
|
|
2198
2198
|
//#endregion
|
|
2199
|
-
//#region src/cli/utils/
|
|
2200
|
-
const
|
|
2201
|
-
const JITI_EXPORT_CONDITION_PRIORITY = [
|
|
2202
|
-
"bun",
|
|
2203
|
-
"import",
|
|
2204
|
-
"module",
|
|
2205
|
-
"default",
|
|
2206
|
-
"require"
|
|
2207
|
-
];
|
|
2208
|
-
const SERVER_PARSER_SHIM_SOURCE = `const createMiddleware = (handler = undefined) => ({
|
|
2199
|
+
//#region src/cli/utils/crpc-builder-stub.ts
|
|
2200
|
+
const CRPC_BUILDER_STUB_SOURCE = `const createMiddleware = (handler = undefined) => ({
|
|
2209
2201
|
_handler: handler,
|
|
2210
|
-
pipe(nextHandler) {
|
|
2202
|
+
pipe(nextHandler = undefined) {
|
|
2211
2203
|
return createMiddleware(nextHandler);
|
|
2212
2204
|
},
|
|
2213
2205
|
});
|
|
2214
2206
|
|
|
2215
|
-
const
|
|
2207
|
+
const toMetaObject = (value = undefined) =>
|
|
2208
|
+
value && typeof value === "object" ? value : {};
|
|
2209
|
+
|
|
2210
|
+
const createProcedureExport = (type, state, handler) => ({
|
|
2211
|
+
_crpcMeta: {
|
|
2212
|
+
type,
|
|
2213
|
+
internal: state.internal ?? false,
|
|
2214
|
+
...toMetaObject(state.meta),
|
|
2215
|
+
},
|
|
2216
|
+
_handler: handler,
|
|
2217
|
+
});
|
|
2218
|
+
|
|
2219
|
+
const createProcedureBuilder = (state = {}) => {
|
|
2216
2220
|
const builder = {
|
|
2217
2221
|
internal() {
|
|
2218
|
-
return
|
|
2222
|
+
return createProcedureBuilder({ ...state, internal: true });
|
|
2219
2223
|
},
|
|
2220
2224
|
use() {
|
|
2221
|
-
return
|
|
2225
|
+
return createProcedureBuilder(state);
|
|
2222
2226
|
},
|
|
2223
|
-
meta() {
|
|
2224
|
-
return
|
|
2227
|
+
meta(value = undefined) {
|
|
2228
|
+
return createProcedureBuilder({
|
|
2229
|
+
...state,
|
|
2230
|
+
meta: {
|
|
2231
|
+
...toMetaObject(state.meta),
|
|
2232
|
+
...toMetaObject(value),
|
|
2233
|
+
},
|
|
2234
|
+
});
|
|
2225
2235
|
},
|
|
2226
2236
|
input() {
|
|
2227
|
-
return
|
|
2237
|
+
return createProcedureBuilder(state);
|
|
2238
|
+
},
|
|
2239
|
+
params() {
|
|
2240
|
+
return createProcedureBuilder(state);
|
|
2241
|
+
},
|
|
2242
|
+
searchParams() {
|
|
2243
|
+
return createProcedureBuilder(state);
|
|
2244
|
+
},
|
|
2245
|
+
paginated(options = undefined) {
|
|
2246
|
+
return createProcedureBuilder({
|
|
2247
|
+
...state,
|
|
2248
|
+
meta:
|
|
2249
|
+
typeof options?.limit === "number"
|
|
2250
|
+
? {
|
|
2251
|
+
...toMetaObject(state.meta),
|
|
2252
|
+
limit: options.limit,
|
|
2253
|
+
}
|
|
2254
|
+
: state.meta,
|
|
2255
|
+
});
|
|
2228
2256
|
},
|
|
2229
2257
|
output() {
|
|
2230
|
-
return
|
|
2258
|
+
return createProcedureBuilder(state);
|
|
2231
2259
|
},
|
|
2232
|
-
|
|
2233
|
-
return
|
|
2234
|
-
_crpcMeta: { type: "query" },
|
|
2235
|
-
_handler: handler,
|
|
2236
|
-
};
|
|
2260
|
+
form() {
|
|
2261
|
+
return createProcedureBuilder(state);
|
|
2237
2262
|
},
|
|
2238
|
-
|
|
2239
|
-
return
|
|
2240
|
-
_crpcMeta: { type: "mutation" },
|
|
2241
|
-
_handler: handler,
|
|
2242
|
-
};
|
|
2263
|
+
route() {
|
|
2264
|
+
return createProcedureBuilder(state);
|
|
2243
2265
|
},
|
|
2244
|
-
|
|
2245
|
-
return
|
|
2246
|
-
_crpcMeta: { type: "action" },
|
|
2247
|
-
_handler: handler,
|
|
2248
|
-
};
|
|
2266
|
+
get() {
|
|
2267
|
+
return createProcedureBuilder(state);
|
|
2249
2268
|
},
|
|
2250
|
-
|
|
2269
|
+
post() {
|
|
2270
|
+
return createProcedureBuilder(state);
|
|
2271
|
+
},
|
|
2272
|
+
put() {
|
|
2273
|
+
return createProcedureBuilder(state);
|
|
2274
|
+
},
|
|
2275
|
+
patch() {
|
|
2276
|
+
return createProcedureBuilder(state);
|
|
2277
|
+
},
|
|
2278
|
+
delete() {
|
|
2279
|
+
return createProcedureBuilder(state);
|
|
2280
|
+
},
|
|
2281
|
+
query(handler = undefined) {
|
|
2282
|
+
return createProcedureExport("query", state, handler);
|
|
2283
|
+
},
|
|
2284
|
+
mutation(handler = undefined) {
|
|
2285
|
+
return createProcedureExport("mutation", state, handler);
|
|
2286
|
+
},
|
|
2287
|
+
action(handler = undefined) {
|
|
2288
|
+
return createProcedureExport("action", state, handler);
|
|
2289
|
+
},
|
|
2290
|
+
middleware(handler = undefined) {
|
|
2251
2291
|
return createMiddleware(handler);
|
|
2252
2292
|
},
|
|
2253
2293
|
};
|
|
@@ -2265,7 +2305,7 @@ export const initCRPC = {
|
|
|
2265
2305
|
context() {
|
|
2266
2306
|
return this;
|
|
2267
2307
|
},
|
|
2268
|
-
middleware(handler) {
|
|
2308
|
+
middleware(handler = undefined) {
|
|
2269
2309
|
return createMiddleware(handler);
|
|
2270
2310
|
},
|
|
2271
2311
|
create() {
|
|
@@ -2280,6 +2320,21 @@ export const initCRPC = {
|
|
|
2280
2320
|
},
|
|
2281
2321
|
};
|
|
2282
2322
|
|
|
2323
|
+
export const httpAction = createProcedureBuilder();
|
|
2324
|
+
`;
|
|
2325
|
+
|
|
2326
|
+
//#endregion
|
|
2327
|
+
//#region src/cli/utils/project-jiti.ts
|
|
2328
|
+
const require$2 = createRequire(import.meta.url);
|
|
2329
|
+
const JITI_EXPORT_CONDITION_PRIORITY = [
|
|
2330
|
+
"bun",
|
|
2331
|
+
"import",
|
|
2332
|
+
"module",
|
|
2333
|
+
"default",
|
|
2334
|
+
"require"
|
|
2335
|
+
];
|
|
2336
|
+
const SERVER_PARSER_SHIM_SOURCE = `${CRPC_BUILDER_STUB_SOURCE}
|
|
2337
|
+
|
|
2283
2338
|
export class CRPCError extends Error {
|
|
2284
2339
|
constructor(options = {}) {
|
|
2285
2340
|
super(options.message ?? options.code ?? "CRPC error");
|
|
@@ -4248,7 +4303,8 @@ function getGeneratedRuntimeOutputFile(functionsDir, moduleName) {
|
|
|
4248
4303
|
return path.join(functionsDir, GENERATED_DIR, `${runtimeModuleName}.runtime.ts`);
|
|
4249
4304
|
}
|
|
4250
4305
|
function emitGeneratedServerPlaceholderFile() {
|
|
4251
|
-
return `//
|
|
4306
|
+
return `// @ts-nocheck
|
|
4307
|
+
// biome-ignore-all format: generated
|
|
4252
4308
|
/* eslint-disable @typescript-eslint/no-require-imports, @typescript-eslint/no-unused-vars */
|
|
4253
4309
|
// This file is auto-generated by kitcn
|
|
4254
4310
|
// Do not edit manually. Run \`kitcn codegen\` to regenerate.
|
|
@@ -4264,72 +4320,7 @@ export type MutationCtx = ServerMutationCtx;
|
|
|
4264
4320
|
export type ActionCtx = ServerActionCtx;
|
|
4265
4321
|
export type GenericCtx = QueryCtx | MutationCtx | ActionCtx;
|
|
4266
4322
|
|
|
4267
|
-
|
|
4268
|
-
_handler: handler,
|
|
4269
|
-
pipe(nextHandler?: unknown) {
|
|
4270
|
-
return createMiddleware(nextHandler);
|
|
4271
|
-
},
|
|
4272
|
-
});
|
|
4273
|
-
|
|
4274
|
-
const createProcedureBuilder = () => {
|
|
4275
|
-
const builder = {
|
|
4276
|
-
internal() {
|
|
4277
|
-
return builder;
|
|
4278
|
-
},
|
|
4279
|
-
use() {
|
|
4280
|
-
return builder;
|
|
4281
|
-
},
|
|
4282
|
-
meta() {
|
|
4283
|
-
return builder;
|
|
4284
|
-
},
|
|
4285
|
-
input() {
|
|
4286
|
-
return builder;
|
|
4287
|
-
},
|
|
4288
|
-
output() {
|
|
4289
|
-
return builder;
|
|
4290
|
-
},
|
|
4291
|
-
query(handler?: unknown) {
|
|
4292
|
-
return handler ?? builder;
|
|
4293
|
-
},
|
|
4294
|
-
mutation(handler?: unknown) {
|
|
4295
|
-
return handler ?? builder;
|
|
4296
|
-
},
|
|
4297
|
-
action(handler?: unknown) {
|
|
4298
|
-
return handler ?? builder;
|
|
4299
|
-
},
|
|
4300
|
-
middleware(handler?: unknown) {
|
|
4301
|
-
return createMiddleware(handler);
|
|
4302
|
-
},
|
|
4303
|
-
};
|
|
4304
|
-
|
|
4305
|
-
return builder;
|
|
4306
|
-
};
|
|
4307
|
-
|
|
4308
|
-
export const initCRPC = {
|
|
4309
|
-
meta() {
|
|
4310
|
-
return this;
|
|
4311
|
-
},
|
|
4312
|
-
dataModel() {
|
|
4313
|
-
return this;
|
|
4314
|
-
},
|
|
4315
|
-
context() {
|
|
4316
|
-
return this;
|
|
4317
|
-
},
|
|
4318
|
-
middleware(handler?: unknown) {
|
|
4319
|
-
return createMiddleware(handler);
|
|
4320
|
-
},
|
|
4321
|
-
create() {
|
|
4322
|
-
return {
|
|
4323
|
-
query: createProcedureBuilder(),
|
|
4324
|
-
mutation: createProcedureBuilder(),
|
|
4325
|
-
action: createProcedureBuilder(),
|
|
4326
|
-
httpAction: createProcedureBuilder(),
|
|
4327
|
-
middleware: createMiddleware,
|
|
4328
|
-
router: (record = {}) => record,
|
|
4329
|
-
};
|
|
4330
|
-
},
|
|
4331
|
-
};
|
|
4332
|
-
export const httpAction = createProcedureBuilder();
|
|
4323
|
+
${CRPC_BUILDER_STUB_SOURCE}
|
|
4333
4324
|
|
|
4334
4325
|
export function withOrm<Ctx>(ctx: Ctx): Ctx {
|
|
4335
4326
|
return ctx;
|
|
@@ -12351,7 +12342,8 @@ const AGGREGATE_STATE_VERSION = 1;
|
|
|
12351
12342
|
const INIT_SHADCN_PACKAGE_SPEC = "shadcn@4.0.1";
|
|
12352
12343
|
const INIT_LOCAL_BOOTSTRAP_TIMEOUT_MS = 3e4;
|
|
12353
12344
|
const LOCAL_BACKEND_NOT_RUNNING_RE = /Local backend isn't running/i;
|
|
12354
|
-
const INIT_GENERATED_SERVER_STUB_TEMPLATE =
|
|
12345
|
+
const INIT_GENERATED_SERVER_STUB_TEMPLATE = `// @ts-nocheck
|
|
12346
|
+
import type {
|
|
12355
12347
|
GenericActionCtx,
|
|
12356
12348
|
GenericDataModel,
|
|
12357
12349
|
GenericMutationCtx,
|
|
@@ -12363,57 +12355,7 @@ export type MutationCtx = GenericMutationCtx<GenericDataModel>;
|
|
|
12363
12355
|
export type ActionCtx = GenericActionCtx<GenericDataModel>;
|
|
12364
12356
|
export type GenericCtx = QueryCtx | MutationCtx | ActionCtx;
|
|
12365
12357
|
|
|
12366
|
-
|
|
12367
|
-
const builder = {
|
|
12368
|
-
internal() {
|
|
12369
|
-
return builder;
|
|
12370
|
-
},
|
|
12371
|
-
use() {
|
|
12372
|
-
return builder;
|
|
12373
|
-
},
|
|
12374
|
-
meta() {
|
|
12375
|
-
return builder;
|
|
12376
|
-
},
|
|
12377
|
-
input() {
|
|
12378
|
-
return builder;
|
|
12379
|
-
},
|
|
12380
|
-
output() {
|
|
12381
|
-
return builder;
|
|
12382
|
-
},
|
|
12383
|
-
query(handler?: unknown) {
|
|
12384
|
-
return handler ?? builder;
|
|
12385
|
-
},
|
|
12386
|
-
mutation(handler?: unknown) {
|
|
12387
|
-
return handler ?? builder;
|
|
12388
|
-
},
|
|
12389
|
-
action(handler?: unknown) {
|
|
12390
|
-
return handler ?? builder;
|
|
12391
|
-
},
|
|
12392
|
-
};
|
|
12393
|
-
|
|
12394
|
-
return builder;
|
|
12395
|
-
};
|
|
12396
|
-
|
|
12397
|
-
export const initCRPC = {
|
|
12398
|
-
meta() {
|
|
12399
|
-
return this;
|
|
12400
|
-
},
|
|
12401
|
-
dataModel() {
|
|
12402
|
-
return this;
|
|
12403
|
-
},
|
|
12404
|
-
context() {
|
|
12405
|
-
return this;
|
|
12406
|
-
},
|
|
12407
|
-
create() {
|
|
12408
|
-
return {
|
|
12409
|
-
query: createProcedureBuilder(),
|
|
12410
|
-
mutation: createProcedureBuilder(),
|
|
12411
|
-
action: createProcedureBuilder(),
|
|
12412
|
-
httpAction: createProcedureBuilder(),
|
|
12413
|
-
router: (record = {}) => record,
|
|
12414
|
-
};
|
|
12415
|
-
},
|
|
12416
|
-
};
|
|
12358
|
+
${CRPC_BUILDER_STUB_SOURCE}
|
|
12417
12359
|
`;
|
|
12418
12360
|
const INIT_LOCAL_BOOTSTRAP_READY_RE = /(Convex|Concave) functions ready!/i;
|
|
12419
12361
|
const CONVEX_INIT_CREATED_CONFIG_RE = /Configured a local deployment|Provisioned a .* deployment|saved its name as CONVEX_DEPLOYMENT/i;
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as resolveAddTemplateDefaults, A as resolveConfiguredBackend, B as runConvexInitIfNeeded, C as isInitialized, D as readPackageVersions, E as parseInitCommandArgs, Et as highlighter, F as runAfterScaffoldScript, G as trackProcess, H as runInitCommandFlow, I as runAggregateBackfillFlow, J as createSpinner, K as withLocalCodegenEnv, L as runAggregatePruneFlow, M as resolveInitProjectDir, N as resolveMigrationConfig, O as resolveBackfillConfig, P as resolveRunDeps, Q as promptForScaffoldTemplateSelection, R as runBackendFunction, S as isEntryPoint, St as stripConvexCommandNoise, T as parseBackendRunJson, Tt as logger, U as runMigrationCreate, V as runDevSchemaBackfillIfNeeded, W as runMigrationFlow, X as filterScaffoldTemplatePathMap, Y as collectPluginScaffoldTemplates, Z as promptForPluginSelection, _ as formatInfoOutput, _t as applyPluginDependencyInstall, a as cleanup, at as getSupportedPluginKeys, b as hasRemoteConvexDeploymentEnv, bt as resolveAuthEnvState, c as createCommandEnv, ct as resolvePluginScaffoldRoots, d as extractBackfillCliOptions, dt as getPluginLockfilePath, et as resolvePluginPreset, f as extractConcaveRunTargetArgs, ft as getSchemaFilePath, g as formatDocsOutput, gt as applyPlanningDependencyInstall, h as extractResetCliOptions, ht as applyDependencyHintsInstall, i as buildInitializationPlan, it as getPluginCatalogEntry, j as resolveDocTopic, k as resolveCodegenTrimSegments, l as ensureConvexGitignoreEntry, lt as assertSchemaFileExists, m as extractMigrationDownOptions, mt as resolveSchemaInstalledPlugins, n as applyPluginInstallPlanFiles, nt as resolveTemplateSelectionSource, o as createBackendAdapter, ot as isSupportedPluginKey, p as extractMigrationCliOptions, pt as readPluginLockfile, q as withWorkingDirectory, r as assertNoRemovedDevPreRunFlag, rt as resolveTemplatesByIdOrThrow, s as createBackendCommandEnv, st as buildPluginInstallPlan, t as applyDependencyInstallPlan, tt as resolvePresetScaffoldTemplates, u as extractBackendRunTargetArgs, ut as collectInstalledPluginKeys, v as getAggregateBackfillDeploymentKey, vt as inspectPluginDependencyInstall, w as parseArgs, x as isConvexDevPreRunConflictFlag, xt as serializeEnvValue, y as getDevAggregateBackfillStatePath, yt as resolveProjectScaffoldContext, z as runConfiguredCodegen } from "./backend-core-
|
|
2
|
+
import { $ as resolveAddTemplateDefaults, A as resolveConfiguredBackend, B as runConvexInitIfNeeded, C as isInitialized, D as readPackageVersions, E as parseInitCommandArgs, Et as highlighter, F as runAfterScaffoldScript, G as trackProcess, H as runInitCommandFlow, I as runAggregateBackfillFlow, J as createSpinner, K as withLocalCodegenEnv, L as runAggregatePruneFlow, M as resolveInitProjectDir, N as resolveMigrationConfig, O as resolveBackfillConfig, P as resolveRunDeps, Q as promptForScaffoldTemplateSelection, R as runBackendFunction, S as isEntryPoint, St as stripConvexCommandNoise, T as parseBackendRunJson, Tt as logger, U as runMigrationCreate, V as runDevSchemaBackfillIfNeeded, W as runMigrationFlow, X as filterScaffoldTemplatePathMap, Y as collectPluginScaffoldTemplates, Z as promptForPluginSelection, _ as formatInfoOutput, _t as applyPluginDependencyInstall, a as cleanup, at as getSupportedPluginKeys, b as hasRemoteConvexDeploymentEnv, bt as resolveAuthEnvState, c as createCommandEnv, ct as resolvePluginScaffoldRoots, d as extractBackfillCliOptions, dt as getPluginLockfilePath, et as resolvePluginPreset, f as extractConcaveRunTargetArgs, ft as getSchemaFilePath, g as formatDocsOutput, gt as applyPlanningDependencyInstall, h as extractResetCliOptions, ht as applyDependencyHintsInstall, i as buildInitializationPlan, it as getPluginCatalogEntry, j as resolveDocTopic, k as resolveCodegenTrimSegments, l as ensureConvexGitignoreEntry, lt as assertSchemaFileExists, m as extractMigrationDownOptions, mt as resolveSchemaInstalledPlugins, n as applyPluginInstallPlanFiles, nt as resolveTemplateSelectionSource, o as createBackendAdapter, ot as isSupportedPluginKey, p as extractMigrationCliOptions, pt as readPluginLockfile, q as withWorkingDirectory, r as assertNoRemovedDevPreRunFlag, rt as resolveTemplatesByIdOrThrow, s as createBackendCommandEnv, st as buildPluginInstallPlan, t as applyDependencyInstallPlan, tt as resolvePresetScaffoldTemplates, u as extractBackendRunTargetArgs, ut as collectInstalledPluginKeys, v as getAggregateBackfillDeploymentKey, vt as inspectPluginDependencyInstall, w as parseArgs, x as isConvexDevPreRunConflictFlag, xt as serializeEnvValue, y as getDevAggregateBackfillStatePath, yt as resolveProjectScaffoldContext, z as runConfiguredCodegen } from "./backend-core-CGjsBIOp.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";
|
package/dist/orm/index.d.ts
CHANGED
|
@@ -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-
|
|
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-Dw3EVdi6.js";
|
|
2
2
|
import { i as pretendRequired, n as deprecated, r as pretend } from "../validators-vzRKjBJC.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-CFZqIvD7.js";
|
|
4
4
|
import { DefineSchemaOptions, GenericDatabaseReader, GenericDatabaseWriter, GenericSchema, SchemaDefinition } from "convex/server";
|
package/dist/plugins/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as VRequired } from "./validators-vzRKjBJC.js";
|
|
2
2
|
import { C as HttpProcedure, D as ProcedureMeta, R as getTransformer, S as HttpMethod, c as InferHttpInput, d as CRPCHttpRouter, j as DataTransformerOptions, l as InferHttpOutput, p as HttpRouterRecord, w as HttpProcedureBuilderDef, x as HttpHandlerOpts } from "./http-types-BS63Nsug.js";
|
|
3
3
|
import { d as Overwrite$1, i as IntersectIfDefined, m as UnsetMarker, o as MiddlewareBuilder, s as MiddlewareFunction, t as AnyMiddleware } from "./types-BqUIoMfT.js";
|
|
4
|
-
import { ConvexError, GenericId, GenericValidator, ObjectType, OptionalProperty, PropertyValidators, VAny, VArray, VBoolean, VBytes, VFloat64, VId, VInt64, VLiteral, VNull, VObject, VOptional, VRecord, VString, VUnion, Validator } from "convex/values";
|
|
4
|
+
import { ConvexError, GenericId, GenericValidator, ObjectType, OptionalProperty, PropertyValidators, VAny, VArray, VBoolean, VBytes, VFloat64, VId, VInt64, VLiteral, VNull, VObject, VOptional, VRecord, VString, VUnion, Validator, Value as Value$1 } from "convex/values";
|
|
5
5
|
import * as convex_server0 from "convex/server";
|
|
6
6
|
import { ActionBuilder, ArgsArrayToObject, DefaultFunctionArgs, FunctionReference, FunctionReturnType, FunctionVisibility, GenericActionCtx, GenericDataModel, GenericMutationCtx, GenericQueryCtx, MutationBuilder, QueryBuilder, RegisteredAction, RegisteredMutation, RegisteredQuery, TableNamesInDataModel } from "convex/server";
|
|
7
7
|
import { z } from "zod";
|
|
@@ -1250,10 +1250,11 @@ declare const CRPC_ERROR_CODES_BY_KEY: {
|
|
|
1250
1250
|
type CRPCErrorCode = keyof typeof CRPC_ERROR_CODES_BY_KEY;
|
|
1251
1251
|
/** Map error codes to HTTP status codes */
|
|
1252
1252
|
declare const CRPC_ERROR_CODE_TO_HTTP: Record<CRPCErrorCode, number>;
|
|
1253
|
-
type
|
|
1253
|
+
type CRPCErrorBaseData = {
|
|
1254
1254
|
code: CRPCErrorCode;
|
|
1255
1255
|
message: string;
|
|
1256
1256
|
};
|
|
1257
|
+
type CRPCErrorData<TData extends Record<string, Value$1 | undefined> = Record<string, never>> = CRPCErrorBaseData & TData;
|
|
1257
1258
|
/**
|
|
1258
1259
|
* tRPC-style error extending ConvexError
|
|
1259
1260
|
*
|
|
@@ -1266,13 +1267,14 @@ type CRPCErrorData = {
|
|
|
1266
1267
|
* });
|
|
1267
1268
|
* ```
|
|
1268
1269
|
*/
|
|
1269
|
-
declare class CRPCError extends ConvexError<CRPCErrorData
|
|
1270
|
+
declare class CRPCError<TData extends Record<string, Value$1 | undefined> = Record<string, never>> extends ConvexError<CRPCErrorData<TData>> {
|
|
1270
1271
|
readonly code: CRPCErrorCode;
|
|
1271
1272
|
readonly cause?: Error;
|
|
1272
1273
|
constructor(opts: {
|
|
1273
1274
|
code: CRPCErrorCode;
|
|
1274
1275
|
message?: string;
|
|
1275
1276
|
cause?: unknown;
|
|
1277
|
+
data?: TData;
|
|
1276
1278
|
});
|
|
1277
1279
|
}
|
|
1278
1280
|
/**
|
|
@@ -1464,4 +1466,4 @@ type GeneratedRegistrySource<TCallerRegistry extends GeneratedProcedureRegistry,
|
|
|
1464
1466
|
type GeneratedRegistryRuntimeResult<TQueryCtx, TMutationCtx, TCallerRegistry extends GeneratedProcedureRegistry, TActionCtx, THandlerRegistry extends GeneratedProcedureRegistry | undefined> = THandlerRegistry extends GeneratedProcedureRegistry ? GeneratedRegistryRuntimeWithHandler<TQueryCtx, TMutationCtx, TCallerRegistry, Exclude<THandlerRegistry, undefined>, TActionCtx> : GeneratedRegistryRuntime<TQueryCtx, TMutationCtx, TCallerRegistry, TActionCtx>;
|
|
1465
1467
|
declare function createGeneratedRegistryRuntime<TQueryCtx, TMutationCtx, TCallerRegistry extends GeneratedProcedureRegistry, TActionCtx = never, THandlerRegistry extends GeneratedProcedureRegistry | undefined = undefined>(createRegistryOrRegistry: GeneratedRegistrySource<TCallerRegistry, THandlerRegistry>): GeneratedRegistryRuntimeResult<TQueryCtx, TMutationCtx, TCallerRegistry, TActionCtx, THandlerRegistry>;
|
|
1466
1468
|
//#endregion
|
|
1467
|
-
export {
|
|
1469
|
+
export { createMiddlewareFactory as $, CRPC_ERROR_CODE_TO_HTTP as A, createLazyCaller as B, WithHttpRouter as C, zodToConvexFields as Ct, CRPCErrorCode as D, CRPCError as E, CreateEnvOptions as F, createApiLeaf as G, CallerOpts as H, createEnv as I, ActionProcedureBuilder as J, createGeneratedFunctionReference as K, ConvexContext as L, getHTTPStatusCodeFromError as M, isCRPCError as N, CRPCErrorData as O, toCRPCError as P, QueryProcedureBuilder as Q, createCallerFactory as R, typedProcedureResolver as S, zodToConvex as St, inferApiOutputs as T, ServerCaller as U, CallerMeta as V, createServerCaller as W, MutationProcedureBuilder as X, CRPCFunctionTypeHint as Y, ProcedureBuilder as Z, createGenericHandlerFactory as _, zCustomMutation as _t, GeneratedRegistryCallerForContext as a, matchPathParams as at, defineProcedure as b, zodOutputToConvex as bt, ProcedureActionCallerFromRegistry as c, CustomBuilder as ct, ProcedureDefinition as d, ZodFromValidatorBase as dt, initCRPC as et, ProcedureFromFunctionReference as f, ZodValidatorFromConvex as ft, createGenericCallerFactory as g, zCustomAction as gt, createGeneratedRegistryRuntime as h, withSystemFields as ht, GeneratedRegistryCallerFactory as i, handleHttpError as it, getCRPCErrorFromUnknown as j, CRPC_ERROR_CODES_BY_KEY as k, ProcedureCaller as l, ZCustomCtx as lt, ProcedureScheduleCallerFromRegistry as m, convexToZodFields as mt, GeneratedProcedureRegistry as n, createHttpProcedureBuilder as nt, GeneratedRegistryHandlerFactory as o, ConvexValidatorFromZod as ot, ProcedureSchedulableCallerFromRegistry as p, convexToZod as pt, getGeneratedValue as q, GeneratedProcedureRegistryEntry as r, extractPathParams as rt, GeneratedRegistryHandlerForContext as s, ConvexValidatorFromZodOutput as st, CreateProcedureCallerFactoryOptions as t, HttpProcedureBuilder as tt, ProcedureCallerFromRegistry as u, Zid as ut, createProcedureCallerFactory as v, zCustomQuery as vt, inferApiInputs as w, getGeneratedFunctionReference as x, zodOutputToConvexFields as xt, createProcedureHandlerFactory as y, zid as yt, LazyCaller as z };
|
package/dist/ratelimit/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { l as requireMutationCtx } from "../api-entry-BckXqaLb.js";
|
|
2
|
-
import { h as CRPCError } from "../builder-
|
|
3
|
-
import { t as definePlugin } from "../middleware-
|
|
2
|
+
import { h as CRPCError } from "../builder-Bh18Y2t0.js";
|
|
3
|
+
import { t as definePlugin } from "../middleware-C5P1Q29c.js";
|
|
4
4
|
import { v } from "convex/values";
|
|
5
5
|
import { mutationGeneric, queryGeneric } from "convex/server";
|
|
6
6
|
|
package/dist/react/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
2
|
+
import { D as CRPCClientError, E as writeAuthSessionFallbackToken, O as defaultIsUnauthorized, S as clearAuthSessionFallback, T as writeAuthSessionFallbackData, _ as useConvexAuthBridge, a as ConvexProviderWithAuth, b as useMaybeAuth, c as MaybeUnauthenticated, d as isSessionSyncGraceActive, f as useAuth, g as useAuthValue, h as useAuthStore, i as ConvexAuthBridge, k as isCRPCClientError, l as Unauthenticated, m as useAuthState, n as AuthProvider, o as FetchAccessTokenContext, p as useAuthGuard, r as Authenticated, s as MaybeAuthenticated, t as AUTH_SESSION_SYNC_GRACE_MS, u as decodeJwtExp, v as useFetchAccessToken, x as useSafeConvexAuth, y as useIsAuth } from "../auth-store-C0iMu34r.js";
|
|
3
3
|
import { ConvexProvider, ConvexReactClient, ConvexReactClient as ConvexReactClient$1, useAction, useConvex, useMutation } from "convex/react";
|
|
4
4
|
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -1386,6 +1386,7 @@ const seedReturnedToken = (store, value) => {
|
|
|
1386
1386
|
store.set("token", token);
|
|
1387
1387
|
store.set("expiresAt", decodeJwtExp(token));
|
|
1388
1388
|
store.set("sessionSyncGraceUntil", Date.now() + AUTH_SESSION_SYNC_GRACE_MS);
|
|
1389
|
+
if (decodeJwtExp(token) === null) writeAuthSessionFallbackToken(token);
|
|
1389
1390
|
};
|
|
1390
1391
|
const syncSessionAtom = (authClient, sessionData) => {
|
|
1391
1392
|
const sessionAtom = authClient.$store?.atoms?.session;
|
|
@@ -1406,7 +1407,10 @@ const hydrateReturnedSession = async (authClient, value) => {
|
|
|
1406
1407
|
credentials: "omit",
|
|
1407
1408
|
headers: { Authorization: `Bearer ${token}` }
|
|
1408
1409
|
} });
|
|
1409
|
-
if (session?.data)
|
|
1410
|
+
if (session?.data) {
|
|
1411
|
+
syncSessionAtom(authClient, session.data);
|
|
1412
|
+
writeAuthSessionFallbackData(session.data);
|
|
1413
|
+
}
|
|
1410
1414
|
};
|
|
1411
1415
|
const withDisabledSessionSignal = (args) => {
|
|
1412
1416
|
const record = args && typeof args === "object" ? args : {};
|
|
@@ -1455,6 +1459,7 @@ function createAuthMutations(authClient) {
|
|
|
1455
1459
|
authStoreApi.set("token", null);
|
|
1456
1460
|
authStoreApi.set("expiresAt", null);
|
|
1457
1461
|
authStoreApi.set("sessionSyncGraceUntil", null);
|
|
1462
|
+
clearAuthSessionFallback();
|
|
1458
1463
|
await convexQueryClient?.resetAuthQueries();
|
|
1459
1464
|
return res;
|
|
1460
1465
|
}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as createMiddlewareFactory, A as CRPC_ERROR_CODE_TO_HTTP, B as createLazyCaller, C as WithHttpRouter, Ct as zodToConvexFields, D as CRPCErrorCode, E as CRPCError, F as CreateEnvOptions, G as createApiLeaf, H as CallerOpts, I as createEnv, J as ActionProcedureBuilder, K as createGeneratedFunctionReference, L as ConvexContext, M as getHTTPStatusCodeFromError, N as isCRPCError, O as CRPCErrorData, P as toCRPCError, Q as QueryProcedureBuilder, R as createCallerFactory, S as typedProcedureResolver, St as zodToConvex, T as inferApiOutputs, U as ServerCaller, V as CallerMeta, W as createServerCaller, X as MutationProcedureBuilder, Y as CRPCFunctionTypeHint, Z as ProcedureBuilder, _ as createGenericHandlerFactory, _t as zCustomMutation, a as GeneratedRegistryCallerForContext, at as matchPathParams, b as defineProcedure, bt as zodOutputToConvex, c as ProcedureActionCallerFromRegistry, ct as CustomBuilder, d as ProcedureDefinition, dt as ZodFromValidatorBase, et as initCRPC, f as ProcedureFromFunctionReference, ft as ZodValidatorFromConvex, g as createGenericCallerFactory, gt as zCustomAction, h as createGeneratedRegistryRuntime, ht as withSystemFields, i as GeneratedRegistryCallerFactory, it as handleHttpError, j as getCRPCErrorFromUnknown, k as CRPC_ERROR_CODES_BY_KEY, l as ProcedureCaller, lt as ZCustomCtx, m as ProcedureScheduleCallerFromRegistry, mt as convexToZodFields, n as GeneratedProcedureRegistry, nt as createHttpProcedureBuilder, o as GeneratedRegistryHandlerFactory, ot as ConvexValidatorFromZod, p as ProcedureSchedulableCallerFromRegistry, pt as convexToZod, q as getGeneratedValue, r as GeneratedProcedureRegistryEntry, rt as extractPathParams, s as GeneratedRegistryHandlerForContext, st as ConvexValidatorFromZodOutput, t as CreateProcedureCallerFactoryOptions, tt as HttpProcedureBuilder, u as ProcedureCallerFromRegistry, ut as Zid, v as createProcedureCallerFactory, vt as zCustomQuery, w as inferApiInputs, x as getGeneratedFunctionReference, xt as zodOutputToConvexFields, y as createProcedureHandlerFactory, yt as zid, z as LazyCaller } from "../procedure-caller-DloN1DNv.js";
|
|
2
2
|
import { C as HttpProcedure, D as ProcedureMeta, E as InferHttpInput, S as HttpMethod, T as HttpRouteDefinition, _ as extractRouteMap, b as HttpActionHandler, d as CRPCHttpRouter, f as HttpRouterDef, g as createHttpRouterFactory, h as createHttpRouter, m as HttpRouterWithHono, p as HttpRouterRecord, v as CRPCHonoHandler, w as HttpProcedureBuilderDef, x as HttpHandlerOpts, y as HttpActionConstructor } from "../http-types-BS63Nsug.js";
|
|
3
3
|
import { a as MergeZodObjects, c as MiddlewareMarker, d as Overwrite, f as ResolveIfSet, i as IntersectIfDefined, l as MiddlewareNext, m as UnsetMarker, n as AnyMiddlewareBuilder, o as MiddlewareBuilder, p as Simplify, r as GetRawInputFn, s as MiddlewareFunction, t as AnyMiddleware, u as MiddlewareResult } from "../types-BqUIoMfT.js";
|
|
4
4
|
import { a as isQueryCtx, c as requireMutationCtx, i as isMutationCtx, l as requireQueryCtx, n as RunMutationCtx, o as isRunMutationCtx, r as isActionCtx, s as requireActionCtx, t as GenericCtx, u as requireRunMutationCtx } from "../context-utils-HPC5nXzx.js";
|
|
5
|
-
export { ActionProcedureBuilder, AnyMiddleware, AnyMiddlewareBuilder, CRPCError, CRPCErrorCode, CRPCFunctionTypeHint, CRPCHonoHandler, CRPCHttpRouter, CRPC_ERROR_CODES_BY_KEY, CRPC_ERROR_CODE_TO_HTTP, CallerMeta, CallerOpts, ConvexContext, ConvexValidatorFromZod, ConvexValidatorFromZodOutput, CreateEnvOptions, CreateProcedureCallerFactoryOptions, CustomBuilder, GeneratedProcedureRegistry, GeneratedProcedureRegistryEntry, GeneratedRegistryCallerFactory, GeneratedRegistryCallerForContext, GeneratedRegistryHandlerFactory, GeneratedRegistryHandlerForContext, GenericCtx, GetRawInputFn, HttpActionConstructor, HttpActionHandler, HttpHandlerOpts, HttpMethod, HttpProcedure, HttpProcedureBuilder, HttpProcedureBuilderDef, HttpRouteDefinition, HttpRouterDef, HttpRouterRecord, HttpRouterWithHono, InferHttpInput, IntersectIfDefined, LazyCaller, MergeZodObjects, MiddlewareBuilder, MiddlewareFunction, MiddlewareMarker, MiddlewareNext, MiddlewareResult, MutationProcedureBuilder, Overwrite, ProcedureActionCallerFromRegistry, ProcedureBuilder, ProcedureCaller, ProcedureCallerFromRegistry, ProcedureDefinition, ProcedureFromFunctionReference, ProcedureMeta, ProcedureSchedulableCallerFromRegistry, ProcedureScheduleCallerFromRegistry, QueryProcedureBuilder, ResolveIfSet, RunMutationCtx, ServerCaller, Simplify, UnsetMarker, WithHttpRouter, ZCustomCtx, Zid, ZodFromValidatorBase, ZodValidatorFromConvex, convexToZod, convexToZodFields, createApiLeaf, createCallerFactory, createEnv, createGeneratedFunctionReference, createGeneratedRegistryRuntime, createGenericCallerFactory, createGenericHandlerFactory, createHttpProcedureBuilder, createHttpRouter, createHttpRouterFactory, createLazyCaller, createMiddlewareFactory, createProcedureCallerFactory, createProcedureHandlerFactory, createServerCaller, defineProcedure, extractPathParams, extractRouteMap, getCRPCErrorFromUnknown, getGeneratedFunctionReference, getGeneratedValue, getHTTPStatusCodeFromError, handleHttpError, inferApiInputs, inferApiOutputs, initCRPC, isActionCtx, isCRPCError, isMutationCtx, isQueryCtx, isRunMutationCtx, matchPathParams, requireActionCtx, requireMutationCtx, requireQueryCtx, requireRunMutationCtx, toCRPCError, typedProcedureResolver, withSystemFields, zCustomAction, zCustomMutation, zCustomQuery, zid, zodOutputToConvex, zodOutputToConvexFields, zodToConvex, zodToConvexFields };
|
|
5
|
+
export { ActionProcedureBuilder, AnyMiddleware, AnyMiddlewareBuilder, CRPCError, CRPCErrorCode, CRPCErrorData, CRPCFunctionTypeHint, CRPCHonoHandler, CRPCHttpRouter, CRPC_ERROR_CODES_BY_KEY, CRPC_ERROR_CODE_TO_HTTP, CallerMeta, CallerOpts, ConvexContext, ConvexValidatorFromZod, ConvexValidatorFromZodOutput, CreateEnvOptions, CreateProcedureCallerFactoryOptions, CustomBuilder, GeneratedProcedureRegistry, GeneratedProcedureRegistryEntry, GeneratedRegistryCallerFactory, GeneratedRegistryCallerForContext, GeneratedRegistryHandlerFactory, GeneratedRegistryHandlerForContext, GenericCtx, GetRawInputFn, HttpActionConstructor, HttpActionHandler, HttpHandlerOpts, HttpMethod, HttpProcedure, HttpProcedureBuilder, HttpProcedureBuilderDef, HttpRouteDefinition, HttpRouterDef, HttpRouterRecord, HttpRouterWithHono, InferHttpInput, IntersectIfDefined, LazyCaller, MergeZodObjects, MiddlewareBuilder, MiddlewareFunction, MiddlewareMarker, MiddlewareNext, MiddlewareResult, MutationProcedureBuilder, Overwrite, ProcedureActionCallerFromRegistry, ProcedureBuilder, ProcedureCaller, ProcedureCallerFromRegistry, ProcedureDefinition, ProcedureFromFunctionReference, ProcedureMeta, ProcedureSchedulableCallerFromRegistry, ProcedureScheduleCallerFromRegistry, QueryProcedureBuilder, ResolveIfSet, RunMutationCtx, ServerCaller, Simplify, UnsetMarker, WithHttpRouter, ZCustomCtx, Zid, ZodFromValidatorBase, ZodValidatorFromConvex, convexToZod, convexToZodFields, createApiLeaf, createCallerFactory, createEnv, createGeneratedFunctionReference, createGeneratedRegistryRuntime, createGenericCallerFactory, createGenericHandlerFactory, createHttpProcedureBuilder, createHttpRouter, createHttpRouterFactory, createLazyCaller, createMiddlewareFactory, createProcedureCallerFactory, createProcedureHandlerFactory, createServerCaller, defineProcedure, extractPathParams, extractRouteMap, getCRPCErrorFromUnknown, getGeneratedFunctionReference, getGeneratedValue, getHTTPStatusCodeFromError, handleHttpError, inferApiInputs, inferApiOutputs, initCRPC, isActionCtx, isCRPCError, isMutationCtx, isQueryCtx, isRunMutationCtx, matchPathParams, requireActionCtx, requireMutationCtx, requireQueryCtx, requireRunMutationCtx, toCRPCError, typedProcedureResolver, withSystemFields, zCustomAction, zCustomMutation, zCustomQuery, zid, zodOutputToConvex, zodOutputToConvexFields, zodToConvex, zodToConvexFields };
|
package/dist/server/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as isMutationCtx, c as requireActionCtx, d as requireRunMutationCtx, i as isActionCtx, l as requireMutationCtx, n as createGeneratedFunctionReference, o as isQueryCtx, r as getGeneratedValue, s as isRunMutationCtx, t as createApiLeaf, u as requireQueryCtx } from "../api-entry-BckXqaLb.js";
|
|
2
2
|
import { n as createLazyCaller, r as createServerCaller, t as createCallerFactory } from "../caller-factory-cTXNvYdz.js";
|
|
3
|
-
import { A as zodOutputToConvexFields, C as convexToZodFields, D as zCustomQuery, E as zCustomMutation, M as zodToConvexFields, O as zid, S as convexToZod, T as zCustomAction, _ as CRPC_ERROR_CODE_TO_HTTP, a as createMiddlewareFactory, b as isCRPCError, c as createHttpRouter, d as createHttpProcedureBuilder, f as extractPathParams, g as CRPC_ERROR_CODES_BY_KEY, h as CRPCError, i as QueryProcedureBuilder, j as zodToConvex, k as zodOutputToConvex, l as createHttpRouterFactory, m as matchPathParams, n as MutationProcedureBuilder, o as initCRPC, p as handleHttpError, r as ProcedureBuilder, s as HttpRouterWithHono, t as ActionProcedureBuilder, u as extractRouteMap, v as getCRPCErrorFromUnknown, w as withSystemFields, x as toCRPCError, y as getHTTPStatusCodeFromError } from "../builder-
|
|
4
|
-
import { a as createProcedureHandlerFactory, c as typedProcedureResolver, i as createProcedureCallerFactory, l as createEnv, n as createGenericCallerFactory, o as defineProcedure, r as createGenericHandlerFactory, s as getGeneratedFunctionReference, t as createGeneratedRegistryRuntime } from "../procedure-caller-
|
|
3
|
+
import { A as zodOutputToConvexFields, C as convexToZodFields, D as zCustomQuery, E as zCustomMutation, M as zodToConvexFields, O as zid, S as convexToZod, T as zCustomAction, _ as CRPC_ERROR_CODE_TO_HTTP, a as createMiddlewareFactory, b as isCRPCError, c as createHttpRouter, d as createHttpProcedureBuilder, f as extractPathParams, g as CRPC_ERROR_CODES_BY_KEY, h as CRPCError, i as QueryProcedureBuilder, j as zodToConvex, k as zodOutputToConvex, l as createHttpRouterFactory, m as matchPathParams, n as MutationProcedureBuilder, o as initCRPC, p as handleHttpError, r as ProcedureBuilder, s as HttpRouterWithHono, t as ActionProcedureBuilder, u as extractRouteMap, v as getCRPCErrorFromUnknown, w as withSystemFields, x as toCRPCError, y as getHTTPStatusCodeFromError } from "../builder-Bh18Y2t0.js";
|
|
4
|
+
import { a as createProcedureHandlerFactory, c as typedProcedureResolver, i as createProcedureCallerFactory, l as createEnv, n as createGenericCallerFactory, o as defineProcedure, r as createGenericHandlerFactory, s as getGeneratedFunctionReference, t as createGeneratedRegistryRuntime } from "../procedure-caller-DL0Ubgky.js";
|
|
5
5
|
|
|
6
6
|
export { ActionProcedureBuilder, CRPCError, CRPC_ERROR_CODES_BY_KEY, CRPC_ERROR_CODE_TO_HTTP, HttpRouterWithHono, MutationProcedureBuilder, ProcedureBuilder, QueryProcedureBuilder, convexToZod, convexToZodFields, createApiLeaf, createCallerFactory, createEnv, createGeneratedFunctionReference, createGeneratedRegistryRuntime, createGenericCallerFactory, createGenericHandlerFactory, createHttpProcedureBuilder, createHttpRouter, createHttpRouterFactory, createLazyCaller, createMiddlewareFactory, createProcedureCallerFactory, createProcedureHandlerFactory, createServerCaller, defineProcedure, extractPathParams, extractRouteMap, getCRPCErrorFromUnknown, getGeneratedFunctionReference, getGeneratedValue, getHTTPStatusCodeFromError, handleHttpError, initCRPC, isActionCtx, isCRPCError, isMutationCtx, isQueryCtx, isRunMutationCtx, matchPathParams, requireActionCtx, requireMutationCtx, requireQueryCtx, requireRunMutationCtx, toCRPCError, typedProcedureResolver, withSystemFields, zCustomAction, zCustomMutation, zCustomQuery, zid, zodOutputToConvex, zodOutputToConvexFields, zodToConvex, zodToConvexFields };
|
package/dist/watcher.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { A as resolveConfiguredBackend, Ct as generateMeta, P as resolveRunDeps, Tt as logger, wt as getConvexConfig } from "./backend-core-
|
|
2
|
+
import { A as resolveConfiguredBackend, Ct as generateMeta, P as resolveRunDeps, Tt as logger, wt as getConvexConfig } from "./backend-core-CGjsBIOp.mjs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
|
|
@@ -3717,19 +3717,6 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
3717
3717
|
readonly aggregate_bucket: ConvexTableWithColumns<{
|
|
3718
3718
|
name: "aggregate_bucket";
|
|
3719
3719
|
columns: {
|
|
3720
|
-
count: ConvexNumberBuilderInitial<""> & {
|
|
3721
|
-
_: {
|
|
3722
|
-
notNull: true;
|
|
3723
|
-
};
|
|
3724
|
-
} & {
|
|
3725
|
-
_: {
|
|
3726
|
-
tableName: "aggregate_bucket";
|
|
3727
|
-
};
|
|
3728
|
-
} & {
|
|
3729
|
-
_: {
|
|
3730
|
-
fieldName: "count";
|
|
3731
|
-
};
|
|
3732
|
-
};
|
|
3733
3720
|
tableKey: ConvexTextBuilderInitial<""> & {
|
|
3734
3721
|
_: {
|
|
3735
3722
|
notNull: true;
|
|
@@ -3799,6 +3786,19 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
3799
3786
|
fieldName: "keyParts";
|
|
3800
3787
|
};
|
|
3801
3788
|
};
|
|
3789
|
+
count: ConvexNumberBuilderInitial<""> & {
|
|
3790
|
+
_: {
|
|
3791
|
+
notNull: true;
|
|
3792
|
+
};
|
|
3793
|
+
} & {
|
|
3794
|
+
_: {
|
|
3795
|
+
tableName: "aggregate_bucket";
|
|
3796
|
+
};
|
|
3797
|
+
} & {
|
|
3798
|
+
_: {
|
|
3799
|
+
fieldName: "count";
|
|
3800
|
+
};
|
|
3801
|
+
};
|
|
3802
3802
|
sumValues: (NotNull<$Type<ConvexCustomBuilderInitial<"", convex_values0.VRecord<Record<string, any>, convex_values0.VString<string, "required">, convex_values0.VId<any, any> | convex_values0.VString<any, any> | convex_values0.VFloat64<any, any> | convex_values0.VInt64<any, any> | convex_values0.VBoolean<any, any> | convex_values0.VNull<any, any> | convex_values0.VAny<any, any, string> | convex_values0.VLiteral<any, any> | convex_values0.VBytes<any, any> | convex_values0.VObject<any, Record<string, convex_values0.Validator<any, convex_values0.OptionalProperty, any>>, any, any> | convex_values0.VArray<any, convex_values0.Validator<any, "required", any>, any> | convex_values0.VRecord<any, convex_values0.Validator<string, "required", any>, convex_values0.Validator<any, "required", any>, any, any> | convex_values0.VUnion<any, convex_values0.Validator<any, "required", any>[], any, any>, "required", string>>, Record<string, number>>> | NotNull<$Type<ConvexCustomBuilderInitial<"", convex_values0.VId<any, any> | convex_values0.VString<any, any> | convex_values0.VFloat64<any, any> | convex_values0.VInt64<any, any> | convex_values0.VBoolean<any, any> | convex_values0.VNull<any, any> | convex_values0.VAny<any, any, string> | convex_values0.VLiteral<any, any> | convex_values0.VBytes<any, any> | convex_values0.VObject<any, Record<string, convex_values0.Validator<any, convex_values0.OptionalProperty, any>>, any, any> | convex_values0.VArray<any, convex_values0.Validator<any, "required", any>, any> | convex_values0.VRecord<any, convex_values0.Validator<string, "required", any>, convex_values0.Validator<any, "required", any>, any, any> | convex_values0.VUnion<any, convex_values0.Validator<any, "required", any>[], any, any>>, Record<string, number>>>) & {
|
|
3803
3803
|
_: {
|
|
3804
3804
|
tableName: "aggregate_bucket";
|
|
@@ -4009,7 +4009,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
4009
4009
|
fieldName: "value";
|
|
4010
4010
|
};
|
|
4011
4011
|
};
|
|
4012
|
-
|
|
4012
|
+
tableKey: ConvexTextBuilderInitial<""> & {
|
|
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: "
|
|
4022
|
+
fieldName: "tableKey";
|
|
4023
4023
|
};
|
|
4024
4024
|
};
|
|
4025
|
-
|
|
4025
|
+
indexName: ConvexTextBuilderInitial<""> & {
|
|
4026
4026
|
_: {
|
|
4027
4027
|
notNull: true;
|
|
4028
4028
|
};
|
|
@@ -4032,10 +4032,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
4032
4032
|
};
|
|
4033
4033
|
} & {
|
|
4034
4034
|
_: {
|
|
4035
|
-
fieldName: "
|
|
4035
|
+
fieldName: "indexName";
|
|
4036
4036
|
};
|
|
4037
4037
|
};
|
|
4038
|
-
|
|
4038
|
+
updatedAt: ConvexNumberBuilderInitial<""> & {
|
|
4039
4039
|
_: {
|
|
4040
4040
|
notNull: true;
|
|
4041
4041
|
};
|
|
@@ -4045,10 +4045,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
4045
4045
|
};
|
|
4046
4046
|
} & {
|
|
4047
4047
|
_: {
|
|
4048
|
-
fieldName: "
|
|
4048
|
+
fieldName: "updatedAt";
|
|
4049
4049
|
};
|
|
4050
4050
|
};
|
|
4051
|
-
|
|
4051
|
+
keyHash: ConvexTextBuilderInitial<""> & {
|
|
4052
4052
|
_: {
|
|
4053
4053
|
notNull: true;
|
|
4054
4054
|
};
|
|
@@ -4058,10 +4058,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
4058
4058
|
};
|
|
4059
4059
|
} & {
|
|
4060
4060
|
_: {
|
|
4061
|
-
fieldName: "
|
|
4061
|
+
fieldName: "keyHash";
|
|
4062
4062
|
};
|
|
4063
4063
|
};
|
|
4064
|
-
|
|
4064
|
+
count: ConvexNumberBuilderInitial<""> & {
|
|
4065
4065
|
_: {
|
|
4066
4066
|
notNull: true;
|
|
4067
4067
|
};
|
|
@@ -4071,7 +4071,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
4071
4071
|
};
|
|
4072
4072
|
} & {
|
|
4073
4073
|
_: {
|
|
4074
|
-
fieldName: "
|
|
4074
|
+
fieldName: "count";
|
|
4075
4075
|
};
|
|
4076
4076
|
};
|
|
4077
4077
|
fieldName: ConvexTextBuilderInitial<""> & {
|
package/package.json
CHANGED
package/skills/convex/SKILL.md
CHANGED
|
@@ -317,6 +317,9 @@ Use this map consistently:
|
|
|
317
317
|
5. `CONFLICT`: duplicate or conflicting write.
|
|
318
318
|
6. `TOO_MANY_REQUESTS`: rate limit.
|
|
319
319
|
7. `INTERNAL_SERVER_ERROR`: unexpected failures only.
|
|
320
|
+
8. Add small custom `data` payloads on `CRPCError` when the client needs
|
|
321
|
+
domain metadata like conflicting ids. Read them on the client from
|
|
322
|
+
`error.data`.
|
|
320
323
|
|
|
321
324
|
Required tests:
|
|
322
325
|
|
|
@@ -418,11 +418,21 @@ Each page maintains its own WebSocket subscription. Auto-recovers on `InvalidCur
|
|
|
418
418
|
|
|
419
419
|
### Server Errors
|
|
420
420
|
|
|
421
|
-
`CRPCError` thrown server-side → arrives as `ConvexError` on client. Access
|
|
421
|
+
`CRPCError` thrown server-side → arrives as `ConvexError` on client. Access
|
|
422
|
+
the built-in fields and any custom payload via `error.data`:
|
|
422
423
|
|
|
423
424
|
```ts
|
|
424
|
-
// Server:
|
|
425
|
+
// Server:
|
|
426
|
+
throw new CRPCError({
|
|
427
|
+
code: 'CONFLICT',
|
|
428
|
+
message: 'Domain already exists',
|
|
429
|
+
data: { existingSiteId: 'site_123' },
|
|
430
|
+
});
|
|
431
|
+
|
|
425
432
|
// Client:
|
|
433
|
+
error.data?.message; // 'Domain already exists'
|
|
434
|
+
error.data?.existingSiteId; // 'site_123'
|
|
435
|
+
|
|
426
436
|
const { error, isError } = useQuery(crpc.posts.get.queryOptions({ id }));
|
|
427
437
|
if (isError) toast.error(error.data?.message ?? 'Something went wrong');
|
|
428
438
|
|
|
@@ -430,7 +440,12 @@ if (isError) toast.error(error.data?.message ?? 'Something went wrong');
|
|
|
430
440
|
crpc.posts.create.mutationOptions({ onError: (error) => toast.error(error.data?.message ?? 'Failed') });
|
|
431
441
|
|
|
432
442
|
// Try/catch:
|
|
433
|
-
const error = err as Error & {
|
|
443
|
+
const error = err as Error & {
|
|
444
|
+
data?: {
|
|
445
|
+
message?: string;
|
|
446
|
+
existingSiteId?: string;
|
|
447
|
+
};
|
|
448
|
+
};
|
|
434
449
|
```
|
|
435
450
|
|
|
436
451
|
### Client Errors
|