kitcn 0.12.9 → 0.12.11
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 +32 -8
- package/dist/auth/generated/index.d.ts +1 -1
- package/dist/auth/index.d.ts +15 -15
- package/dist/backend-core-DUsUG58E.mjs +14929 -0
- package/dist/cli.mjs +256 -11746
- package/dist/{generated-contract-disabled-Dzx2IRId.d.ts → generated-contract-disabled-Cf7sqlVD.d.ts} +30 -30
- package/dist/orm/index.d.ts +1 -1
- package/dist/orm/index.js +2878 -2870
- package/dist/react/index.d.ts +5 -1
- package/dist/react/index.js +67 -47
- package/dist/watcher.mjs +63 -3
- package/dist/{where-clause-compiler-Dw3EVdi6.d.ts → where-clause-compiler-DJ2S06w0.d.ts} +56 -56
- package/package.json +1 -1
- package/skills/convex/references/setup/auth.md +9 -1
- package/dist/codegen-B60fOYhd.mjs +0 -3420
|
@@ -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-DJ2S06w0.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";
|
|
@@ -52,6 +52,13 @@ function ConvexAuthProviderInner({ children, client, authClient }) {
|
|
|
52
52
|
const pendingTokenRef = useRef(null);
|
|
53
53
|
sessionRef.current = session;
|
|
54
54
|
isPendingRef.current = isPending;
|
|
55
|
+
const getCachedJwt = useCallback((minTimeRemainingMs = 0) => {
|
|
56
|
+
const cachedToken = authStore.get("token");
|
|
57
|
+
if (!cachedToken) return null;
|
|
58
|
+
const expiresAt = decodeJwtExp(cachedToken);
|
|
59
|
+
if (expiresAt === null || expiresAt <= Date.now() + minTimeRemainingMs) return null;
|
|
60
|
+
return cachedToken;
|
|
61
|
+
}, [authStore]);
|
|
55
62
|
useEffect(() => {
|
|
56
63
|
if (hasActiveSessionData(session)) {
|
|
57
64
|
authStore.set("sessionSyncGraceUntil", null);
|
|
@@ -86,11 +93,23 @@ function ConvexAuthProviderInner({ children, client, authClient }) {
|
|
|
86
93
|
authStore.set("sessionSyncGraceUntil", null);
|
|
87
94
|
return jwt;
|
|
88
95
|
}
|
|
96
|
+
const cachedJwt = getCachedJwt();
|
|
97
|
+
if (cachedJwt) {
|
|
98
|
+
authStore.set("expiresAt", decodeJwtExp(cachedJwt));
|
|
99
|
+
authStore.set("sessionSyncGraceUntil", null);
|
|
100
|
+
return cachedJwt;
|
|
101
|
+
}
|
|
89
102
|
authStore.set("token", null);
|
|
90
103
|
authStore.set("expiresAt", null);
|
|
91
104
|
authStore.set("sessionSyncGraceUntil", null);
|
|
92
105
|
return null;
|
|
93
106
|
}).catch((error) => {
|
|
107
|
+
const cachedJwt = getCachedJwt();
|
|
108
|
+
if (cachedJwt) {
|
|
109
|
+
authStore.set("expiresAt", decodeJwtExp(cachedJwt));
|
|
110
|
+
authStore.set("sessionSyncGraceUntil", null);
|
|
111
|
+
return cachedJwt;
|
|
112
|
+
}
|
|
94
113
|
authStore.set("token", null);
|
|
95
114
|
authStore.set("expiresAt", null);
|
|
96
115
|
authStore.set("sessionSyncGraceUntil", null);
|
|
@@ -102,9 +121,10 @@ function ConvexAuthProviderInner({ children, client, authClient }) {
|
|
|
102
121
|
return pendingTokenRef.current;
|
|
103
122
|
};
|
|
104
123
|
const fetchFreshTokenForced = async () => {
|
|
124
|
+
const cachedJwt = getCachedJwt();
|
|
105
125
|
if (pendingTokenRef.current) {
|
|
106
126
|
const token = await pendingTokenRef.current;
|
|
107
|
-
if (token) return token;
|
|
127
|
+
if (token && (!cachedJwt || token !== cachedJwt)) return token;
|
|
108
128
|
}
|
|
109
129
|
return fetchFreshToken();
|
|
110
130
|
};
|
|
@@ -114,16 +134,16 @@ function ConvexAuthProviderInner({ children, client, authClient }) {
|
|
|
114
134
|
const hasSessionSyncGrace = isSessionSyncGraceActive(authStore.get("sessionSyncGraceUntil"));
|
|
115
135
|
if (!hasSession) {
|
|
116
136
|
if (currentIsPending || hasSessionSyncGrace) {
|
|
117
|
-
const
|
|
137
|
+
const cachedJwt = getCachedJwt();
|
|
118
138
|
if (!forceRefreshToken) {
|
|
119
|
-
if (
|
|
139
|
+
if (cachedJwt) return cachedJwt;
|
|
120
140
|
return fetchFreshToken();
|
|
121
141
|
}
|
|
122
142
|
const freshToken = await fetchFreshTokenForced();
|
|
123
|
-
if (!freshToken &&
|
|
124
|
-
authStore.set("token",
|
|
125
|
-
authStore.set("expiresAt", decodeJwtExp(
|
|
126
|
-
return
|
|
143
|
+
if (!freshToken && cachedJwt) {
|
|
144
|
+
authStore.set("token", cachedJwt);
|
|
145
|
+
authStore.set("expiresAt", decodeJwtExp(cachedJwt));
|
|
146
|
+
return cachedJwt;
|
|
127
147
|
}
|
|
128
148
|
return freshToken;
|
|
129
149
|
}
|
|
@@ -139,7 +159,11 @@ function ConvexAuthProviderInner({ children, client, authClient }) {
|
|
|
139
159
|
if (!forceRefreshToken && pendingTokenRef.current) return pendingTokenRef.current;
|
|
140
160
|
if (forceRefreshToken) return fetchFreshTokenForced();
|
|
141
161
|
return fetchFreshToken();
|
|
142
|
-
}, [
|
|
162
|
+
}, [
|
|
163
|
+
authStore,
|
|
164
|
+
authClient,
|
|
165
|
+
getCachedJwt
|
|
166
|
+
]);
|
|
143
167
|
const useAuth = useCallback(function useConvexAuthHook() {
|
|
144
168
|
const token = authStore.get("token");
|
|
145
169
|
const hasSession = hasActiveSessionData(sessionRef.current);
|
|
@@ -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-
|
|
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-Cf7sqlVD.js";
|
|
2
2
|
export { type AuthRuntime, BetterAuthOptionsWithoutDatabase, type GeneratedAuthDisabledReasonKind, GenericAuthBeforeResult, GenericAuthDefinition, GenericAuthTriggerChange, GenericAuthTriggerHandlers, GenericAuthTriggers, createDisabledAuthRuntime, defineAuth, getGeneratedAuthDisabledReason };
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as QueryCtxWithPreferredOrmQueryTable, n as LookupByIdResultByCtx, t as DocByCtx } from "../query-context-CFZqIvD7.js";
|
|
2
2
|
import { t as GetAuth } from "../types-BiJE7qxR.js";
|
|
3
3
|
import { t as GenericCtx } from "../context-utils-HPC5nXzx.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-
|
|
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-Cf7sqlVD.js";
|
|
5
5
|
import * as convex_values0 from "convex/values";
|
|
6
6
|
import { Infer } from "convex/values";
|
|
7
7
|
import { DocumentByName, GenericDataModel, GenericMutationCtx, GenericQueryCtx, GenericSchema, PaginationOptions, PaginationResult, SchemaDefinition, TableNamesInDataModel } from "convex/server";
|
|
@@ -103,29 +103,29 @@ type AdapterPaginationOptions = PaginationOptions & {
|
|
|
103
103
|
maximumRowsRead?: number;
|
|
104
104
|
};
|
|
105
105
|
declare const adapterWhereValidator: convex_values0.VObject<{
|
|
106
|
+
operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
106
107
|
connector?: "AND" | "OR" | undefined;
|
|
107
|
-
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
108
108
|
value: string | number | boolean | string[] | number[] | null;
|
|
109
109
|
field: string;
|
|
110
110
|
}, {
|
|
111
111
|
connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
|
|
112
112
|
field: convex_values0.VString<string, "required">;
|
|
113
|
-
operator: convex_values0.VUnion<"
|
|
113
|
+
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>;
|
|
114
114
|
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>;
|
|
115
|
-
}, "required", "value" | "
|
|
115
|
+
}, "required", "value" | "operator" | "field" | "connector">;
|
|
116
116
|
declare const adapterArgsValidator: convex_values0.VObject<{
|
|
117
|
-
|
|
117
|
+
limit?: number | undefined;
|
|
118
118
|
where?: {
|
|
119
|
+
operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
119
120
|
connector?: "AND" | "OR" | undefined;
|
|
120
|
-
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
121
121
|
value: string | number | boolean | string[] | number[] | null;
|
|
122
122
|
field: string;
|
|
123
123
|
}[] | undefined;
|
|
124
|
-
|
|
124
|
+
select?: string[] | undefined;
|
|
125
125
|
offset?: number | undefined;
|
|
126
126
|
sortBy?: {
|
|
127
|
-
field: string;
|
|
128
127
|
direction: "asc" | "desc";
|
|
128
|
+
field: string;
|
|
129
129
|
} | undefined;
|
|
130
130
|
model: string;
|
|
131
131
|
}, {
|
|
@@ -134,29 +134,29 @@ declare const adapterArgsValidator: convex_values0.VObject<{
|
|
|
134
134
|
offset: convex_values0.VFloat64<number | undefined, "optional">;
|
|
135
135
|
select: convex_values0.VArray<string[] | undefined, convex_values0.VString<string, "required">, "optional">;
|
|
136
136
|
sortBy: convex_values0.VObject<{
|
|
137
|
-
field: string;
|
|
138
137
|
direction: "asc" | "desc";
|
|
138
|
+
field: string;
|
|
139
139
|
} | undefined, {
|
|
140
140
|
direction: convex_values0.VUnion<"asc" | "desc", [convex_values0.VLiteral<"asc", "required">, convex_values0.VLiteral<"desc", "required">], "required", never>;
|
|
141
141
|
field: convex_values0.VString<string, "required">;
|
|
142
|
-
}, "optional", "
|
|
142
|
+
}, "optional", "direction" | "field">;
|
|
143
143
|
where: convex_values0.VArray<{
|
|
144
|
+
operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
144
145
|
connector?: "AND" | "OR" | undefined;
|
|
145
|
-
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
146
146
|
value: string | number | boolean | string[] | number[] | null;
|
|
147
147
|
field: string;
|
|
148
148
|
}[] | undefined, convex_values0.VObject<{
|
|
149
|
+
operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
149
150
|
connector?: "AND" | "OR" | undefined;
|
|
150
|
-
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
151
151
|
value: string | number | boolean | string[] | number[] | null;
|
|
152
152
|
field: string;
|
|
153
153
|
}, {
|
|
154
154
|
connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
|
|
155
155
|
field: convex_values0.VString<string, "required">;
|
|
156
|
-
operator: convex_values0.VUnion<"
|
|
156
|
+
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>;
|
|
157
157
|
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>;
|
|
158
|
-
}, "required", "value" | "
|
|
159
|
-
}, "required", "
|
|
158
|
+
}, "required", "value" | "operator" | "field" | "connector">, "optional">;
|
|
159
|
+
}, "required", "limit" | "where" | "model" | "select" | "offset" | "sortBy" | "sortBy.direction" | "sortBy.field">;
|
|
160
160
|
declare const hasUniqueFields: (betterAuthSchema: BetterAuthDBSchema, model: string, input: Record<string, any>) => boolean;
|
|
161
161
|
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>;
|
|
162
162
|
declare const selectFields: <T extends TableNamesInDataModel<GenericDataModel>, D extends DocumentByName<GenericDataModel, T>>(doc: D | null, select?: string[]) => D | null;
|