kitcn 0.27.5 → 0.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +210 -0
- package/dist/aggregate/index.d.ts +2 -2
- package/dist/auth/client/index.d.ts +44 -16
- package/dist/auth/generated/index.d.ts +1 -1
- package/dist/auth/generated/index.js +1 -1
- package/dist/auth/index.d.ts +48 -23
- package/dist/auth/index.js +175 -52
- package/dist/auth/nextjs/index.js +1 -1
- package/dist/auth/start/server/index.js +1 -1
- package/dist/{capabilities-DkfnnNp7.d.ts → capabilities-BAiI8avr.d.ts} +16 -0
- package/dist/cli.mjs +43 -11
- package/dist/{convex-plugin-DfOhBU9g.js → convex-plugin-Dic0l-k8.js} +77 -68
- package/dist/{create-schema-DqhLA_UF.js → create-schema-ojI-OH_9.js} +15 -3
- package/dist/{create-schema-orm-C3y6GLwQ.js → create-schema-orm-HcJzGCxj.js} +26 -6
- package/dist/{generated-contract-disabled-BEc4d98x.d.ts → generated-contract-disabled-BBCcpNyF.d.ts} +46 -4
- package/dist/{generated-contract-disabled-CZa0iyV0.js → generated-contract-disabled-_1Mjg9pW.js} +2 -0
- package/dist/orm/aggregate-index/index.d.ts +1 -1
- package/dist/orm/aggregate-index/index.js +99 -1
- package/dist/orm/index.d.ts +2 -2
- package/dist/orm/index.js +38 -6
- package/dist/orm/migrations/index.d.ts +2 -2
- package/dist/{schema-D95Z3Kss.js → schema-CzdjX7nx.js} +5 -1
- package/dist/solid/index.d.ts +44 -16
- package/dist/{token-DcV_0fkF.js → token-B0NKKxqP.js} +1 -1
- package/dist/{where-clause-compiler-DuC8Nr7e.d.ts → where-clause-compiler-DdAw9rNV.d.ts} +63 -63
- package/package.json +2 -2
|
@@ -2,16 +2,9 @@ import { r as omit } from "./upstream-BCgGZX6q.js";
|
|
|
2
2
|
import { createAuthEndpoint, createAuthMiddleware, sessionMiddleware } from "better-auth/api";
|
|
3
3
|
import { bearer } from "better-auth/plugins/bearer";
|
|
4
4
|
import { jwt } from "better-auth/plugins/jwt";
|
|
5
|
-
import { oidcProvider } from "better-auth/plugins/oidc-provider";
|
|
6
5
|
|
|
7
6
|
//#region src/auth/internal/convex-plugin.ts
|
|
8
7
|
const JWT_COOKIE_NAME = "convex_jwt";
|
|
9
|
-
const normalizeAfterHooks = (hooks) => {
|
|
10
|
-
return hooks.map((hook) => ({
|
|
11
|
-
...hook,
|
|
12
|
-
matcher: (ctx) => Boolean(hook.matcher(ctx))
|
|
13
|
-
}));
|
|
14
|
-
};
|
|
15
8
|
const getJwksAlg = (authProvider) => {
|
|
16
9
|
const isCustomJwt = "type" in authProvider && authProvider.type === "customJwt";
|
|
17
10
|
if (isCustomJwt && authProvider.algorithm !== "RS256") throw new Error("Only RS256 is supported for custom JWT with Better Auth");
|
|
@@ -28,27 +21,53 @@ const parseAuthConfig = (authConfig, opts) => {
|
|
|
28
21
|
if (!isDataUriJwks && opts.jwks) console.warn("Static JWKS provided to Convex plugin, but not to auth config. This adds an unnecessary network request for token verification.");
|
|
29
22
|
return providerConfig;
|
|
30
23
|
};
|
|
31
|
-
const
|
|
32
|
-
const getOidcProvider = (basePath) => {
|
|
24
|
+
const createOpenIdConfig = (basePath, signingAlgorithm) => {
|
|
33
25
|
const siteUrl = `${process.env.CONVEX_SITE_URL}`;
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
26
|
+
const baseUrl = `${siteUrl}${basePath}`;
|
|
27
|
+
return {
|
|
28
|
+
issuer: siteUrl,
|
|
29
|
+
authorization_endpoint: `${baseUrl}/oauth2/authorize`,
|
|
30
|
+
token_endpoint: `${baseUrl}/oauth2/token`,
|
|
31
|
+
userinfo_endpoint: `${baseUrl}/oauth2/userinfo`,
|
|
32
|
+
jwks_uri: `${baseUrl}/convex/jwks`,
|
|
33
|
+
registration_endpoint: `${baseUrl}/oauth2/register`,
|
|
34
|
+
end_session_endpoint: `${baseUrl}/oauth2/endsession`,
|
|
35
|
+
scopes_supported: [
|
|
36
|
+
"openid",
|
|
37
|
+
"profile",
|
|
38
|
+
"email",
|
|
39
|
+
"offline_access"
|
|
40
|
+
],
|
|
41
|
+
response_types_supported: ["code"],
|
|
42
|
+
response_modes_supported: ["query"],
|
|
43
|
+
grant_types_supported: ["authorization_code", "refresh_token"],
|
|
44
|
+
acr_values_supported: ["urn:mace:incommon:iap:silver", "urn:mace:incommon:iap:bronze"],
|
|
45
|
+
subject_types_supported: ["public"],
|
|
46
|
+
id_token_signing_alg_values_supported: [signingAlgorithm],
|
|
47
|
+
token_endpoint_auth_methods_supported: [
|
|
48
|
+
"client_secret_basic",
|
|
49
|
+
"client_secret_post",
|
|
50
|
+
"none"
|
|
51
|
+
],
|
|
52
|
+
code_challenge_methods_supported: ["S256"],
|
|
53
|
+
claims_supported: [
|
|
54
|
+
"sub",
|
|
55
|
+
"iss",
|
|
56
|
+
"aud",
|
|
57
|
+
"exp",
|
|
58
|
+
"nbf",
|
|
59
|
+
"iat",
|
|
60
|
+
"jti",
|
|
61
|
+
"email",
|
|
62
|
+
"email_verified",
|
|
63
|
+
"name"
|
|
64
|
+
]
|
|
65
|
+
};
|
|
47
66
|
};
|
|
48
67
|
const convex = (opts) => {
|
|
49
68
|
const jwtExpirationSeconds = opts.jwt?.expirationSeconds ?? opts.jwtExpirationSeconds ?? 900;
|
|
50
|
-
const
|
|
51
|
-
const
|
|
69
|
+
const signingAlgorithm = getJwksAlg(parseAuthConfig(opts.authConfig, opts));
|
|
70
|
+
const openIdConfig = createOpenIdConfig(opts.options?.basePath ?? "/api/auth", signingAlgorithm);
|
|
52
71
|
const jwtOptions = {
|
|
53
72
|
jwt: {
|
|
54
73
|
issuer: `${process.env.CONVEX_SITE_URL}`,
|
|
@@ -63,7 +82,7 @@ const convex = (opts) => {
|
|
|
63
82
|
iat: Math.floor(Date.now() / 1e3)
|
|
64
83
|
})
|
|
65
84
|
},
|
|
66
|
-
jwks: { keyPairConfig: { alg:
|
|
85
|
+
jwks: { keyPairConfig: { alg: signingAlgorithm } }
|
|
67
86
|
};
|
|
68
87
|
const jwks = opts.jwks ? JSON.parse(opts.jwks) : void 0;
|
|
69
88
|
const jwt$1 = jwt({
|
|
@@ -123,13 +142,14 @@ const convex = (opts) => {
|
|
|
123
142
|
};
|
|
124
143
|
ctx.context.internalAdapter.deleteSession = async (..._args) => {};
|
|
125
144
|
const knownSafePaths = ["/api-key/list", "/api-key/get"];
|
|
126
|
-
const noopWrite = (method) => {
|
|
145
|
+
const noopWrite = (method, result = 0) => {
|
|
127
146
|
return async (..._args) => {
|
|
128
147
|
if (ctx.path && !knownSafePaths.includes(ctx.path)) console.warn(`[convex-better-auth] Write operation "${method}" skipped in query context for ${ctx.path}`);
|
|
129
|
-
return
|
|
148
|
+
return result;
|
|
130
149
|
};
|
|
131
150
|
};
|
|
132
151
|
ctx.context.adapter.create = noopWrite("create");
|
|
152
|
+
ctx.context.adapter.incrementOne = noopWrite("incrementOne", {});
|
|
133
153
|
ctx.context.adapter.update = noopWrite("update");
|
|
134
154
|
ctx.context.adapter.updateMany = noopWrite("updateMany");
|
|
135
155
|
ctx.context.adapter.delete = noopWrite("delete");
|
|
@@ -137,53 +157,42 @@ const convex = (opts) => {
|
|
|
137
157
|
return { context: ctx };
|
|
138
158
|
})
|
|
139
159
|
}],
|
|
140
|
-
after: [
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
matcher: (ctx) => {
|
|
144
|
-
return Boolean(ctx.path?.startsWith("/sign-in") || ctx.path?.startsWith("/sign-up") || ctx.path?.startsWith("/callback") || ctx.path?.startsWith("/oauth2/callback") || ctx.path?.startsWith("/magic-link/verify") || ctx.path?.startsWith("/email-otp/verify-email") || ctx.path?.startsWith("/phone-number/verify") || ctx.path?.startsWith("/siwe/verify") || ctx.path?.startsWith("/update-session") || ctx.path?.startsWith("/get-session") && ctx.context.session);
|
|
145
|
-
},
|
|
146
|
-
handler: createAuthMiddleware(async (ctx) => {
|
|
147
|
-
const originalSession = ctx.context.session;
|
|
148
|
-
try {
|
|
149
|
-
ctx.context.session = ctx.context.session ?? ctx.context.newSession;
|
|
150
|
-
const { token } = await jwt$1.endpoints.getToken({
|
|
151
|
-
...ctx,
|
|
152
|
-
asResponse: false,
|
|
153
|
-
headers: {},
|
|
154
|
-
method: "GET",
|
|
155
|
-
returnHeaders: false,
|
|
156
|
-
returnStatus: false
|
|
157
|
-
});
|
|
158
|
-
const jwtCookie = ctx.context.createAuthCookie(JWT_COOKIE_NAME, { maxAge: jwtExpirationSeconds });
|
|
159
|
-
ctx.setCookie(jwtCookie.name, token, jwtCookie.attributes);
|
|
160
|
-
} catch (_error) {}
|
|
161
|
-
ctx.context.session = originalSession;
|
|
162
|
-
})
|
|
160
|
+
after: [{
|
|
161
|
+
matcher: (ctx) => {
|
|
162
|
+
return Boolean(ctx.path?.startsWith("/sign-in") || ctx.path?.startsWith("/sign-up") || ctx.path?.startsWith("/callback") || ctx.path?.startsWith("/oauth2/callback") || ctx.path?.startsWith("/magic-link/verify") || ctx.path?.startsWith("/email-otp/verify-email") || ctx.path?.startsWith("/phone-number/verify") || ctx.path?.startsWith("/siwe/verify") || ctx.path?.startsWith("/update-session") || ctx.path?.startsWith("/get-session") && ctx.context.session);
|
|
163
163
|
},
|
|
164
|
-
{
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
164
|
+
handler: createAuthMiddleware(async (ctx) => {
|
|
165
|
+
const originalSession = ctx.context.session;
|
|
166
|
+
try {
|
|
167
|
+
ctx.context.session = ctx.context.session ?? ctx.context.newSession;
|
|
168
|
+
const { token } = await jwt$1.endpoints.getToken({
|
|
169
|
+
...ctx,
|
|
170
|
+
asResponse: false,
|
|
171
|
+
headers: {},
|
|
172
|
+
method: "GET",
|
|
173
|
+
returnHeaders: false,
|
|
174
|
+
returnStatus: false
|
|
175
|
+
});
|
|
176
|
+
const jwtCookie = ctx.context.createAuthCookie(JWT_COOKIE_NAME, { maxAge: jwtExpirationSeconds });
|
|
177
|
+
ctx.setCookie(jwtCookie.name, token, jwtCookie.attributes);
|
|
178
|
+
} catch (_error) {}
|
|
179
|
+
ctx.context.session = originalSession;
|
|
180
|
+
})
|
|
181
|
+
}, {
|
|
182
|
+
matcher: (ctx) => {
|
|
183
|
+
return Boolean(ctx.path?.startsWith("/sign-out") || ctx.path?.startsWith("/delete-user") || ctx.path?.startsWith("/get-session") && !ctx.context.session);
|
|
184
|
+
},
|
|
185
|
+
handler: createAuthMiddleware(async (ctx) => {
|
|
186
|
+
const jwtCookie = ctx.context.createAuthCookie(JWT_COOKIE_NAME, { maxAge: 0 });
|
|
187
|
+
ctx.setCookie(jwtCookie.name, "", jwtCookie.attributes);
|
|
188
|
+
})
|
|
189
|
+
}]
|
|
174
190
|
},
|
|
175
191
|
endpoints: {
|
|
176
192
|
getOpenIdConfig: createAuthEndpoint("/convex/.well-known/openid-configuration", {
|
|
177
193
|
method: "GET",
|
|
178
194
|
metadata: { isAction: false }
|
|
179
|
-
}, async (
|
|
180
|
-
return await oidcProvider.endpoints.getOpenIdConfig({
|
|
181
|
-
...ctx,
|
|
182
|
-
asResponse: false,
|
|
183
|
-
returnHeaders: false,
|
|
184
|
-
returnStatus: false
|
|
185
|
-
});
|
|
186
|
-
}),
|
|
195
|
+
}, async () => openIdConfig),
|
|
187
196
|
getJwks: createAuthEndpoint("/convex/jwks", {
|
|
188
197
|
method: "GET",
|
|
189
198
|
metadata: { openapi: {
|
|
@@ -111,8 +111,20 @@ const mergedIndexFields = (tables) => Object.fromEntries(Object.entries(tables).
|
|
|
111
111
|
if (resolved.length === index.length) indexes.push(resolved);
|
|
112
112
|
return indexes;
|
|
113
113
|
}, []) || [];
|
|
114
|
-
const
|
|
115
|
-
|
|
114
|
+
const declaredIndexes = (table.indexes ?? []).reduce((indexes, index) => {
|
|
115
|
+
const resolved = index.fields.map((fieldKey) => resolveIndexField(fieldKey)).filter((fieldName) => fieldName !== null);
|
|
116
|
+
if (resolved.length === index.fields.length) indexes.push(resolved.length === 1 ? resolved[0] : resolved);
|
|
117
|
+
return indexes;
|
|
118
|
+
}, []);
|
|
119
|
+
const explicitIndexes = manualIndexes.concat(declaredIndexes);
|
|
120
|
+
const specialFieldIndexes = Object.keys(specialFields(tables)[key] || {}).filter((index) => !explicitIndexes.some((m) => Array.isArray(m) ? m[0] === index : m === index));
|
|
121
|
+
const seen = /* @__PURE__ */ new Set();
|
|
122
|
+
return [key, explicitIndexes.concat(specialFieldIndexes).filter((index) => {
|
|
123
|
+
const key = (Array.isArray(index) ? index : [index]).join("\0");
|
|
124
|
+
if (seen.has(key)) return false;
|
|
125
|
+
seen.add(key);
|
|
126
|
+
return true;
|
|
127
|
+
})];
|
|
116
128
|
}));
|
|
117
129
|
const createSchema = async ({ exportName = "tables", file, regenerateCommand, tables }) => {
|
|
118
130
|
const path = await import(Buffer.from("cGF0aA==", "base64").toString());
|
|
@@ -143,7 +155,7 @@ export const ${exportName} = {
|
|
|
143
155
|
}[type];
|
|
144
156
|
}
|
|
145
157
|
const indexes = mergedIndexFields(tables)[tableKey]?.map((index) => {
|
|
146
|
-
const indexArray = Array.isArray(index) ? index
|
|
158
|
+
const indexArray = Array.isArray(index) ? index : [index];
|
|
147
159
|
return `.index("${indexArray.join("_")}", ${JSON.stringify(indexArray)})`;
|
|
148
160
|
}) || [];
|
|
149
161
|
const schema = `${modelName}: defineTable({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { augmentBetterAuthTables, indexFields } from "./create-schema-
|
|
1
|
+
import { augmentBetterAuthTables, indexFields } from "./create-schema-ojI-OH_9.js";
|
|
2
2
|
|
|
3
3
|
//#region src/auth/create-schema-orm.ts
|
|
4
4
|
const specialFields = (tables) => Object.fromEntries(Object.entries(tables).map(([key, table]) => {
|
|
@@ -24,8 +24,20 @@ const mergedIndexFields = (tables) => Object.fromEntries(Object.entries(tables).
|
|
|
24
24
|
if (resolved.length === index.length) indexes.push(resolved);
|
|
25
25
|
return indexes;
|
|
26
26
|
}, []) || [];
|
|
27
|
-
const
|
|
28
|
-
|
|
27
|
+
const declaredIndexes = (table.indexes ?? []).reduce((indexes, index) => {
|
|
28
|
+
const resolved = index.fields.map((fieldKey) => resolveIndexField(fieldKey)).filter((fieldName) => fieldName !== null);
|
|
29
|
+
if (resolved.length === index.fields.length) indexes.push(resolved.length === 1 ? resolved[0] : resolved);
|
|
30
|
+
return indexes;
|
|
31
|
+
}, []);
|
|
32
|
+
const explicitIndexes = manualIndexes.concat(declaredIndexes);
|
|
33
|
+
const specialFieldIndexes = Object.entries(tableSpecialFields).filter(([, fieldMeta]) => fieldMeta.unique !== true).map(([fieldName]) => fieldName).filter((index) => !explicitIndexes.some((m) => Array.isArray(m) ? m[0] === index : m === index));
|
|
34
|
+
const seen = /* @__PURE__ */ new Set();
|
|
35
|
+
return [key, explicitIndexes.concat(specialFieldIndexes).filter((index) => {
|
|
36
|
+
const key = (Array.isArray(index) ? index : [index]).join("\0");
|
|
37
|
+
if (seen.has(key)) return false;
|
|
38
|
+
seen.add(key);
|
|
39
|
+
return true;
|
|
40
|
+
})];
|
|
29
41
|
}));
|
|
30
42
|
const VALID_IDENTIFIER_REGEX = /^[$A-Z_][0-9A-Z_$]*$/i;
|
|
31
43
|
const LEADING_DIGIT_REGEX = /^[0-9]/;
|
|
@@ -175,11 +187,19 @@ const renderSchemaOrmFile = async ({ extensionKey, exportName, file, mode, regen
|
|
|
175
187
|
return ` ${key}: ${expression},`;
|
|
176
188
|
});
|
|
177
189
|
const indexes = mergedIndexFields(tables)[entry.key]?.map((indexSpec) => {
|
|
178
|
-
const indexArray = Array.isArray(indexSpec) ?
|
|
190
|
+
const indexArray = Array.isArray(indexSpec) ? indexSpec : [indexSpec];
|
|
179
191
|
const indexName = indexArray.join("_");
|
|
180
|
-
|
|
192
|
+
const indexFactory = (entry.table.indexes ?? []).some((index) => {
|
|
193
|
+
if (!index.unique) return false;
|
|
194
|
+
const resolvedFields = index.fields.map((fieldKey) => {
|
|
195
|
+
const field = entry.table.fields[fieldKey];
|
|
196
|
+
return field ? field.fieldName ?? fieldKey : null;
|
|
197
|
+
}).filter((fieldName) => fieldName !== null);
|
|
198
|
+
return resolvedFields.length === index.fields.length && resolvedFields.join("\0") === indexArray.join("\0");
|
|
199
|
+
}) ? "uniqueIndex" : "index";
|
|
200
|
+
state.ormImports.add(indexFactory);
|
|
181
201
|
const fieldsCall = indexArray.map((fieldName) => renderPropertyAccess(entry.varName, fieldName)).join(", ");
|
|
182
|
-
return
|
|
202
|
+
return `${indexFactory}(${JSON.stringify(indexName)}).on(${fieldsCall})`;
|
|
183
203
|
}) || [];
|
|
184
204
|
const extraConfig = indexes.length > 0 ? `,\n (${entry.varName}) => [\n ${indexes.join(",\n ")},\n ]` : "";
|
|
185
205
|
tableBlocks.push(`export const ${entry.varName} = convexTable(\n ${JSON.stringify(entry.modelName)},\n {\n${fieldLines.join("\n")}\n }${extraConfig}\n);`);
|
package/dist/{generated-contract-disabled-BEc4d98x.d.ts → generated-contract-disabled-BBCcpNyF.d.ts}
RENAMED
|
@@ -113,6 +113,16 @@ declare const updateOneHandler: (ctx: any, args: {
|
|
|
113
113
|
tableTriggers?: RuntimeTableTriggers;
|
|
114
114
|
triggerCtx?: unknown;
|
|
115
115
|
}, schema: Schema, betterAuthSchema: any) => Promise<any>;
|
|
116
|
+
declare const incrementOneHandler: (ctx: any, args: {
|
|
117
|
+
input: {
|
|
118
|
+
increment: Record<string, number>;
|
|
119
|
+
model: string;
|
|
120
|
+
set?: Record<string, unknown>;
|
|
121
|
+
where?: any[];
|
|
122
|
+
};
|
|
123
|
+
tableTriggers?: RuntimeTableTriggers;
|
|
124
|
+
triggerCtx?: unknown;
|
|
125
|
+
}, schema: Schema, betterAuthSchema: any) => Promise<any>;
|
|
116
126
|
declare const updateManyHandler: (ctx: any, args: {
|
|
117
127
|
input: {
|
|
118
128
|
model: string;
|
|
@@ -130,14 +140,16 @@ declare const updateManyHandler: (ctx: any, args: {
|
|
|
130
140
|
splitCursor?: convex_server0.Cursor | null;
|
|
131
141
|
pageStatus?: "SplitRecommended" | "SplitRequired" | null;
|
|
132
142
|
}>;
|
|
133
|
-
|
|
143
|
+
type DeleteOneArgs = {
|
|
134
144
|
input: {
|
|
135
145
|
model: string;
|
|
136
146
|
where?: any[];
|
|
137
147
|
};
|
|
138
148
|
tableTriggers?: RuntimeTableTriggers;
|
|
139
149
|
triggerCtx?: unknown;
|
|
140
|
-
}
|
|
150
|
+
};
|
|
151
|
+
declare const deleteOneHandler: (ctx: any, args: DeleteOneArgs, schema: Schema, betterAuthSchema: any) => Promise<Record<string, unknown> | undefined>;
|
|
152
|
+
declare const consumeOneHandler: (ctx: any, args: DeleteOneArgs, schema: Schema, betterAuthSchema: any) => Promise<convex_server0.GenericDocument | null>;
|
|
141
153
|
declare const deleteManyHandler: (ctx: any, args: {
|
|
142
154
|
input: {
|
|
143
155
|
model: string;
|
|
@@ -166,6 +178,20 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
|
|
|
166
178
|
triggers?: GenericAuthTriggers<DataModel, Schema, TriggerCtx> | ((ctx: TriggerCtx) => GenericAuthTriggers<DataModel, Schema, TriggerCtx> | undefined); /** Validate input validators against auth table schemas. Defaults to false for smaller generated types. */
|
|
167
179
|
validateInput?: boolean;
|
|
168
180
|
}) => {
|
|
181
|
+
consumeOne: convex_server0.RegisteredMutation<"internal", {
|
|
182
|
+
input: {
|
|
183
|
+
where?: {
|
|
184
|
+
connector?: "AND" | "OR" | undefined;
|
|
185
|
+
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
186
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
187
|
+
field: string;
|
|
188
|
+
}[] | undefined;
|
|
189
|
+
model: string;
|
|
190
|
+
} | {
|
|
191
|
+
where?: any[] | undefined;
|
|
192
|
+
model: string;
|
|
193
|
+
};
|
|
194
|
+
}, Promise<convex_server0.GenericDocument | null>>;
|
|
169
195
|
create: convex_server0.RegisteredMutation<"internal", {
|
|
170
196
|
select?: string[] | undefined;
|
|
171
197
|
input: {
|
|
@@ -250,7 +276,6 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
|
|
|
250
276
|
}, Promise<PaginationResult<convex_server0.GenericDocument>>>;
|
|
251
277
|
findOne: convex_server0.RegisteredQuery<"internal", {
|
|
252
278
|
join?: any;
|
|
253
|
-
select?: string[] | undefined;
|
|
254
279
|
where?: {
|
|
255
280
|
mode?: "sensitive" | "insensitive" | undefined;
|
|
256
281
|
connector?: "AND" | "OR" | undefined;
|
|
@@ -258,9 +283,24 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
|
|
|
258
283
|
value: string | number | boolean | string[] | number[] | null;
|
|
259
284
|
field: string;
|
|
260
285
|
}[] | undefined;
|
|
286
|
+
select?: string[] | undefined;
|
|
261
287
|
model: string;
|
|
262
288
|
}, Promise<convex_server0.GenericDocument | null>>;
|
|
263
289
|
getLatestJwks: convex_server0.RegisteredAction<"internal", {}, Promise<unknown>>;
|
|
290
|
+
incrementOne: convex_server0.RegisteredMutation<"internal", {
|
|
291
|
+
input: {
|
|
292
|
+
where?: {
|
|
293
|
+
mode?: "sensitive" | "insensitive" | undefined;
|
|
294
|
+
connector?: "AND" | "OR" | undefined;
|
|
295
|
+
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
296
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
297
|
+
field: string;
|
|
298
|
+
}[] | undefined;
|
|
299
|
+
set?: Record<string, any> | undefined;
|
|
300
|
+
model: string;
|
|
301
|
+
increment: Record<string, number>;
|
|
302
|
+
};
|
|
303
|
+
}, Promise<any>>;
|
|
264
304
|
rotateKeys: convex_server0.RegisteredAction<"internal", {}, Promise<unknown>>;
|
|
265
305
|
updateMany: convex_server0.RegisteredMutation<"internal", {
|
|
266
306
|
input: {
|
|
@@ -321,11 +361,13 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
|
|
|
321
361
|
//#endregion
|
|
322
362
|
//#region src/auth/create-client.d.ts
|
|
323
363
|
type AuthFunctions = {
|
|
364
|
+
consumeOne: FunctionReference<'mutation', 'internal', Record<string, any>>;
|
|
324
365
|
create: FunctionReference<'mutation', 'internal', Record<string, any>>;
|
|
325
366
|
deleteMany: FunctionReference<'mutation', 'internal', Record<string, any>>;
|
|
326
367
|
deleteOne: FunctionReference<'mutation', 'internal', Record<string, any>>;
|
|
327
368
|
findMany: FunctionReference<'query', 'internal', Record<string, any>>;
|
|
328
369
|
findOne: FunctionReference<'query', 'internal', Record<string, any>>;
|
|
370
|
+
incrementOne: FunctionReference<'mutation', 'internal', Record<string, any>>;
|
|
329
371
|
updateMany: FunctionReference<'mutation', 'internal', Record<string, any>>;
|
|
330
372
|
updateOne: FunctionReference<'mutation', 'internal', Record<string, any>>;
|
|
331
373
|
};
|
|
@@ -366,4 +408,4 @@ declare const createDisabledAuthRuntime: <DataModel extends GenericDataModel, Sc
|
|
|
366
408
|
reason?: string;
|
|
367
409
|
}) => AuthRuntime<DataModel, Schema, TriggerCtx, GenericCtx, AuthOptions>;
|
|
368
410
|
//#endregion
|
|
369
|
-
export {
|
|
411
|
+
export { GenericAuthTriggers as C, GenericAuthTriggerHandlers as S, updateOneHandler as _, AuthFunctions as a, GenericAuthDefinition as b, consumeOneHandler as c, deleteManyHandler as d, deleteOneHandler as f, updateManyHandler as g, incrementOneHandler as h, getGeneratedAuthDisabledReason as i, createApi as l, findOneHandler as m, GeneratedAuthDisabledReasonKind as n, Triggers as o, findManyHandler as p, createDisabledAuthRuntime as r, createClient as s, AuthRuntime as t, createHandler as u, BetterAuthOptionsWithoutDatabase as v, defineAuth as w, GenericAuthTriggerChange as x, GenericAuthBeforeResult as y };
|
package/dist/{generated-contract-disabled-CZa0iyV0.js → generated-contract-disabled-_1Mjg9pW.js}
RENAMED
|
@@ -34,11 +34,13 @@ const createDisabledAuthRuntime = (config) => {
|
|
|
34
34
|
throw new Error(`${message} (auth)`);
|
|
35
35
|
} }),
|
|
36
36
|
getAuth: createDisabledError(message, "getAuth"),
|
|
37
|
+
consumeOne: createDisabledRuntimeExport(message, "consumeOne"),
|
|
37
38
|
create: createDisabledRuntimeExport(message, "create"),
|
|
38
39
|
deleteMany: createDisabledRuntimeExport(message, "deleteMany"),
|
|
39
40
|
deleteOne: createDisabledRuntimeExport(message, "deleteOne"),
|
|
40
41
|
findMany: createDisabledRuntimeExport(message, "findMany"),
|
|
41
42
|
findOne: createDisabledRuntimeExport(message, "findOne"),
|
|
43
|
+
incrementOne: createDisabledRuntimeExport(message, "incrementOne"),
|
|
42
44
|
updateMany: createDisabledRuntimeExport(message, "updateMany"),
|
|
43
45
|
updateOne: createDisabledRuntimeExport(message, "updateOne"),
|
|
44
46
|
getLatestJwks: createDisabledRuntimeExport(message, "getLatestJwks"),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as RankOrderField, G as CountBackfillKickoffArgs, J as AggregateQueryPlan, K as CountBackfillMode, Q as RankIndexDefinition, W as CountBackfillChunkArgs, X as AggregateIndexDefinition, Y as CountQueryPlan, Z as CountIndexDefinition, q as CountBackfillStatusArgs, r as OrmCapability } from "../../capabilities-
|
|
1
|
+
import { $ as RankOrderField, G as CountBackfillKickoffArgs, J as AggregateQueryPlan, K as CountBackfillMode, Q as RankIndexDefinition, W as CountBackfillChunkArgs, X as AggregateIndexDefinition, Y as CountQueryPlan, Z as CountIndexDefinition, q as CountBackfillStatusArgs, r as OrmCapability } from "../../capabilities-BAiI8avr.js";
|
|
2
2
|
|
|
3
3
|
//#region src/orm/aggregate-index/capability.d.ts
|
|
4
4
|
/**
|
|
@@ -1,7 +1,76 @@
|
|
|
1
1
|
import { t as DirectAggregate } from "../../runtime-CcOvOf4K.js";
|
|
2
2
|
import { a as Columns } from "../../table-CX2lnX7e.js";
|
|
3
|
-
import {
|
|
3
|
+
import { Dt as usesSystemCreatedAtAlias, Et as PUBLIC_CREATED_AT_FIELD, Q as normalizeTemporalComparableValue, Tt as INTERNAL_CREATION_TIME_FIELD, a as AGGREGATE_STATE_TABLE, c as getAggregateIndexDefinitions, d as COUNT_ERROR, ht as mapWithConcurrency, i as AGGREGATE_RANK_TREE_TABLE, l as getRankIndexDefinitions, m as createError, n as AGGREGATE_EXTREMA_TABLE, r as AGGREGATE_MEMBER_TABLE, s as rankAggregateName, t as AGGREGATE_BUCKET_TABLE, u as AGGREGATE_ERROR } from "../../schema-CzdjX7nx.js";
|
|
4
4
|
|
|
5
|
+
//#region src/orm/transaction-cache.ts
|
|
6
|
+
/**
|
|
7
|
+
* Per-transaction memo storage for the ORM.
|
|
8
|
+
*
|
|
9
|
+
* The ORM already has isolate-, execution-, statement- and row-scoped memos.
|
|
10
|
+
* The lifetime it lacked is the one a hook needs: `prependWriteBarrier` is
|
|
11
|
+
* built inside `createOrmDbLifecycle`, which `createOrm` runs at module scope,
|
|
12
|
+
* so a flag in that closure lives as long as the isolate and would leak an
|
|
13
|
+
* answer from one transaction into the next.
|
|
14
|
+
*
|
|
15
|
+
* Deliberately dependency-free, for the same reason as `write-fanout`:
|
|
16
|
+
* `aggregate-index/runtime` is contractually unreachable from `orm/index`
|
|
17
|
+
* (`import-graph.test.ts`), so importing `lifecycle` here to read one symbol
|
|
18
|
+
* would drag the trigger runtime into the aggregate entry's bundle.
|
|
19
|
+
* `Symbol.for` is registry-based, so re-declaring the key resolves to the same
|
|
20
|
+
* symbol `lifecycle` installs.
|
|
21
|
+
*/
|
|
22
|
+
const ORMLIFECYCLE_INNER_DB = Symbol.for("kitcn:OrmLifecycleInnerDB");
|
|
23
|
+
/**
|
|
24
|
+
* The object whose identity stands in for "this transaction".
|
|
25
|
+
*
|
|
26
|
+
* Convex builds `ctx.db` fresh on every UDF invocation, so it can never be
|
|
27
|
+
* shared by two transactions. `getOrmLifecycleInnerDb` cannot be used on its
|
|
28
|
+
* own: the lifecycle refuses to wrap readers and returns a no-op wrapper for
|
|
29
|
+
* schemas with no triggers and no aggregate indexes, so the inner-db symbol is
|
|
30
|
+
* absent for every query and for most mutations. Resolving through it when it
|
|
31
|
+
* is there, and falling back to the db itself when it is not, converges on the
|
|
32
|
+
* same raw writer from the main scope, `skipRules`, `withoutTriggers` and the
|
|
33
|
+
* scheduled workers.
|
|
34
|
+
*
|
|
35
|
+
* A nested `ctx.runMutation` shares the transaction but gets its own `ctx.db`,
|
|
36
|
+
* so it starts a fresh memo. That direction only costs extra reads.
|
|
37
|
+
*/
|
|
38
|
+
const resolveTransactionAnchor = (db) => {
|
|
39
|
+
if (typeof db !== "object" || db === null) return;
|
|
40
|
+
const inner = db[ORMLIFECYCLE_INNER_DB];
|
|
41
|
+
return typeof inner === "object" && inner !== null ? inner : db;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* One memo namespace with transaction lifetime.
|
|
45
|
+
*
|
|
46
|
+
* The store is a `WeakMap` keyed on the anchor rather than a slot on the db,
|
|
47
|
+
* because `createDatabase` promises not to mutate the `ctx.db` it was handed.
|
|
48
|
+
* Entries die with the transaction's db object.
|
|
49
|
+
*
|
|
50
|
+
* Callers own staleness: only memoize a fact that nothing inside the
|
|
51
|
+
* transaction can invalidate.
|
|
52
|
+
*/
|
|
53
|
+
const createOrmTransactionMemo = () => {
|
|
54
|
+
const byTransaction = /* @__PURE__ */ new WeakMap();
|
|
55
|
+
return {
|
|
56
|
+
get(db, key) {
|
|
57
|
+
const anchor = resolveTransactionAnchor(db);
|
|
58
|
+
return anchor ? byTransaction.get(anchor)?.get(key) : void 0;
|
|
59
|
+
},
|
|
60
|
+
set(db, key, value) {
|
|
61
|
+
const anchor = resolveTransactionAnchor(db);
|
|
62
|
+
if (!anchor) return;
|
|
63
|
+
const existing = byTransaction.get(anchor);
|
|
64
|
+
if (existing) {
|
|
65
|
+
existing.set(key, value);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
byTransaction.set(anchor, new Map([[key, value]]));
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
//#endregion
|
|
5
74
|
//#region src/orm/aggregate-index/runtime.ts
|
|
6
75
|
const UNDEFINED_SENTINEL = "__kitcnUndefined";
|
|
7
76
|
const FLOAT64_SIGN_BIT = 1n << 63n;
|
|
@@ -1247,8 +1316,36 @@ const getCountState = async (db, tableName, indexName, kind = AGGREGATE_STATE_KI
|
|
|
1247
1316
|
tableName: tableKey
|
|
1248
1317
|
};
|
|
1249
1318
|
};
|
|
1319
|
+
/**
|
|
1320
|
+
* Bumped by every `setCountState`, which is the only writer that can move a
|
|
1321
|
+
* state row into CLEARING.
|
|
1322
|
+
*
|
|
1323
|
+
* Isolate-scoped mutable state is exactly what the write barrier must not rely
|
|
1324
|
+
* on, so this counter only ever invalidates: a bump can turn a cache hit into a
|
|
1325
|
+
* re-read, never a re-read into a hit. That direction stays safe when a
|
|
1326
|
+
* mutation reaches the backfill through `ctx.runMutation`, whose nested
|
|
1327
|
+
* invocation gets its own `ctx.db` and so cannot be reached by any
|
|
1328
|
+
* transaction-scoped invalidation.
|
|
1329
|
+
*/
|
|
1330
|
+
let aggregateStateGeneration = 0;
|
|
1331
|
+
/**
|
|
1332
|
+
* Tables whose CLEARING range was read and found empty, with the generation
|
|
1333
|
+
* that read was valid at.
|
|
1334
|
+
*
|
|
1335
|
+
* The barrier runs from a before-hook, once per written row, so a 40-row
|
|
1336
|
+
* statement re-scanned the same empty range 40 times. Only the empty result is
|
|
1337
|
+
* memoized: a blocking state throws, so it never loops, and refusing to cache
|
|
1338
|
+
* it keeps `convex/orm/count.test.ts`'s interleaved state writes honest.
|
|
1339
|
+
*/
|
|
1340
|
+
const clearingRangeEmptyAtGeneration = createOrmTransactionMemo();
|
|
1250
1341
|
const assertAggregateIndexesWritable = async (db, tableName, metricIndexNames, rankIndexNames) => {
|
|
1342
|
+
const generation = aggregateStateGeneration;
|
|
1343
|
+
if (clearingRangeEmptyAtGeneration.get(db, tableName) === generation) return;
|
|
1251
1344
|
const clearingStates = await db.query(AGGREGATE_STATE_TABLE).withIndex("by_table_status", (q) => q.eq("tableKey", tableName).eq("status", COUNT_STATUS_CLEARING)).collect();
|
|
1345
|
+
if (clearingStates.length === 0) {
|
|
1346
|
+
clearingRangeEmptyAtGeneration.set(db, tableName, generation);
|
|
1347
|
+
return;
|
|
1348
|
+
}
|
|
1252
1349
|
const metricNames = new Set(metricIndexNames);
|
|
1253
1350
|
const rankNames = new Set(rankIndexNames);
|
|
1254
1351
|
const blockingState = clearingStates.find((state) => state.kind === AGGREGATE_STATE_KIND_RANK ? rankNames.has(state.indexName) : metricNames.has(state.indexName));
|
|
@@ -1269,6 +1366,7 @@ const isIndexStateDrained = async (db, kind, tableName, indexName) => {
|
|
|
1269
1366
|
return bucket === null && extrema === null;
|
|
1270
1367
|
};
|
|
1271
1368
|
const setCountState = async (db, nextState, kind = AGGREGATE_STATE_KIND_METRIC) => {
|
|
1369
|
+
aggregateStateGeneration += 1;
|
|
1272
1370
|
const existing = await getCountState(db, nextState.tableName, nextState.indexName, kind);
|
|
1273
1371
|
const payload = {
|
|
1274
1372
|
kind,
|
package/dist/orm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $n as BinaryExpression, $t as OrmLifecycleOperation, A as DatabaseWithMutations, An as ConvexCheckConfig, Ar as AnyColumn, At as VectorQueryConfig, B as RlsContext, Bn as ConvexTextBuilderInitial, Br as IsUnique, Bt as RelationsBuilderColumnConfig, C as MigrationTableName, Cn as aggregateIndex, Cr as notBetween, Ct as OrderDirection, D as defineMigrationSet, Dn as uniqueIndex, Dt as ReturningResult, E as defineMigration, En as searchIndex, Er as startsWith, Et as ReturningAll, Fn as ConvexUniqueConstraintConfig, Fr as ColumnBuilderWithTableName, Ft as ExtractTablesWithRelations, Gt as defineRelations, H as EdgeMetadata, In as check, Ir as ColumnDataType, It as ManyConfig, Jt as ConvexDeletionConfig, Kt as defineRelationsPart, Ln as foreignKey, Lr as DrizzleEntity, Lt as OneConfig, M as OrmReader$1, Mn as ConvexForeignKeyConfig, Mr as ColumnBuilderBaseConfig, Mt as unsetToken, N as OrmWriter$1, Nn as ConvexUniqueConstraintBuilder, Nr as ColumnBuilderRuntimeConfig, O as detectMigrationDrift, On as vectorIndex, Or as SystemFields, Ot as ReturningSelection, Pn as ConvexUniqueConstraintBuilderOn, Pr as ColumnBuilderTypeConfig, Pt as ExtractTablesFromSchema, Qn as TableName, Qt as OrmLifecycleChange, Rn as unique, Rr as HasDefault, Rt as RelationsBuilder, S as MigrationStep, Sn as ConvexVectorIndexConfig, Sr as not, St as OrderByClause, T as buildMigrationPlan, Tn as rankIndex, Tr as or, Tt as PredicateWhereIndexConfig, U as extractRelationsConfig, Un as Brand, Ut as TableRelationalConfig, V as RlsMode, Vn as text, Vr as NotNull, Wn as Columns, Wt as TablesRelationalConfig, Xn as OrmSchemaRelations, Xt as ConvexTableWithColumns, Yn as OrmSchemaExtensions, Yt as ConvexTable, Zn as OrmSchemaTriggers, Zt as DiscriminatorBuilderConfig, _ as MigrationMigrateOne, _n as ConvexSearchIndexBuilder, _r as isNull, _t as MutationPaginateConfig, an as RlsPolicyConfig, ar as and, at as CountConfig, b as MigrationSet, bn as ConvexVectorIndexBuilder, br as lte, bt as MutationReturning, cn as RlsRole, cr as endsWith, ct as FilterOperators, d as MigrationDefinition, dn as ConvexAggregateIndexBuilder, dr as gt, dt as InferModelFromColumns, en as TableConfig, er as ExpressionVisitor, et as AggregateConfig, f as MigrationDirection, fn as ConvexAggregateIndexBuilderOn, fr as gte, ft as InferSelectModel, g as MigrationManifestEntry, gn as ConvexRankIndexBuilderOn, gr as isNotNull, gt as MutationExecutionMode, h as MigrationDriftIssue, hn as ConvexRankIndexBuilder, hr as isFieldReference, ht as MutationExecuteResult, i as OrmMigrationCapability, in as RlsPolicy, ir as UnaryExpression, it as BuildRelationResult, j as DatabaseWithQuery, jn as ConvexForeignKeyBuilder, jr as ColumnBuilder, jt as VectorSearchProvider, kn as ConvexCheckBuilder, kt as UpdateSet, ln as RlsRoleConfig, lr as eq, lt as GetColumnData, m as MigrationDocContext, mn as ConvexIndexBuilderOn, mr as inArray, mt as MutationExecuteConfig, n as OrmCapabilities, nn as deletion, nr as FilterExpression, nt as AggregateResult, on as RlsPolicyToOption, or as between, ot as CountResult, p as MigrationDoc, pn as ConvexIndexBuilder, pr as ilike, pt as InsertValue, qn as OrmSchemaExtensionTables, qt as ConvexDeletionBuilder, r as OrmCapability, rn as discriminator, rr as LogicalExpression, rt as BuildQueryResult, sn as rlsPolicy, sr as contains, st as DBQueryConfig, t as OrmAggregateCapability, tn as convexTable, tr as FieldReference, tt as AggregateFieldValue, u as MigrationAppliedState, un as rlsRole, ur as fieldRef, ut as InferInsertModel, v as MigrationPlan, vn as ConvexSearchIndexBuilderOn, vr as like, vt as MutationPaginatedResult, w as MigrationWriteMode, wn as index, wr as notInArray, wt as PaginatedResult, x as MigrationStateMap, xn as ConvexVectorIndexBuilderOn, xr as ne, xt as MutationRunMode, y as MigrationRunStatus, yn as ConvexSearchIndexConfig, yr as lt, yt as MutationResult, zn as ConvexTextBuilder, zr as IsPrimaryKey, zt as RelationsBuilderColumnBase } from "../capabilities-
|
|
2
|
-
import { $ as OrmClientWithApi$1, A as ConvexDateMode, B as ConvexBytesBuilderInitial, C as ConvexNumberBuilderInitial, D as id, E as ConvexIdBuilderInitial, F as custom, G as ConvexBigIntBuilder, H as ConvexBooleanBuilder, I as json, J as CreateOrmOptions, K as ConvexBigIntBuilderInitial, L as objectOf, M as ConvexCustomBuilder, N as ConvexCustomBuilderInitial, O as ConvexDateBuilder, P as arrayOf, Q as OrmClientBase$1, R as unionOf, S as ConvexNumberBuilder, St as defineTriggers, T as ConvexIdBuilder, U as ConvexBooleanBuilderInitial, V as bytes, W as boolean, X as GenericOrmCtx$1, Y as GenericOrm$1, Z as OrmApiResult, _ as ConvexTimestampMode, _t as OrmBeforeResult, a as requireSchemaRelations, at as ScheduledMutationBatchArgs, b as ConvexTextEnumBuilderInitial, bt as OrmTriggerContext, c as TableConfigResult, ct as scheduledDeleteFactory, d as OrmNotFoundError, et as OrmFunctions, f as ConvexVectorBuilder, g as ConvexTimestampBuilderInitial, gt as defineSchemaExtension, h as ConvexTimestampBuilder, ht as SchemaExtension, i as getSchemaTriggers, it as createOrm, j as date, k as ConvexDateBuilderInitial, l as getTableColumns, m as vector, n as defineSchema, nt as OrmWriterCtx, o as asc, ot as scheduledMutationBatchFactory, p as ConvexVectorBuilderInitial, q as bigint, r as getSchemaRelations, rt as ResolveOrmSchema, s as desc, st as ScheduledDeleteArgs, t as WhereClauseResult, tt as OrmReaderCtx, u as getTableConfig, v as timestamp, vt as OrmTableTriggers, w as integer, x as textEnum, xt as OrmTriggers, y as ConvexTextEnumBuilder, yt as OrmTriggerChange, z as ConvexBytesBuilder } from "../where-clause-compiler-
|
|
1
|
+
import { $n as BinaryExpression, $t as OrmLifecycleOperation, A as DatabaseWithMutations, An as ConvexCheckConfig, Ar as AnyColumn, At as VectorQueryConfig, B as RlsContext, Bn as ConvexTextBuilderInitial, Br as IsUnique, Bt as RelationsBuilderColumnConfig, C as MigrationTableName, Cn as aggregateIndex, Cr as notBetween, Ct as OrderDirection, D as defineMigrationSet, Dn as uniqueIndex, Dt as ReturningResult, E as defineMigration, En as searchIndex, Er as startsWith, Et as ReturningAll, Fn as ConvexUniqueConstraintConfig, Fr as ColumnBuilderWithTableName, Ft as ExtractTablesWithRelations, Gt as defineRelations, H as EdgeMetadata, In as check, Ir as ColumnDataType, It as ManyConfig, Jt as ConvexDeletionConfig, Kt as defineRelationsPart, Ln as foreignKey, Lr as DrizzleEntity, Lt as OneConfig, M as OrmReader$1, Mn as ConvexForeignKeyConfig, Mr as ColumnBuilderBaseConfig, Mt as unsetToken, N as OrmWriter$1, Nn as ConvexUniqueConstraintBuilder, Nr as ColumnBuilderRuntimeConfig, O as detectMigrationDrift, On as vectorIndex, Or as SystemFields, Ot as ReturningSelection, Pn as ConvexUniqueConstraintBuilderOn, Pr as ColumnBuilderTypeConfig, Pt as ExtractTablesFromSchema, Qn as TableName, Qt as OrmLifecycleChange, Rn as unique, Rr as HasDefault, Rt as RelationsBuilder, S as MigrationStep, Sn as ConvexVectorIndexConfig, Sr as not, St as OrderByClause, T as buildMigrationPlan, Tn as rankIndex, Tr as or, Tt as PredicateWhereIndexConfig, U as extractRelationsConfig, Un as Brand, Ut as TableRelationalConfig, V as RlsMode, Vn as text, Vr as NotNull, Wn as Columns, Wt as TablesRelationalConfig, Xn as OrmSchemaRelations, Xt as ConvexTableWithColumns, Yn as OrmSchemaExtensions, Yt as ConvexTable, Zn as OrmSchemaTriggers, Zt as DiscriminatorBuilderConfig, _ as MigrationMigrateOne, _n as ConvexSearchIndexBuilder, _r as isNull, _t as MutationPaginateConfig, an as RlsPolicyConfig, ar as and, at as CountConfig, b as MigrationSet, bn as ConvexVectorIndexBuilder, br as lte, bt as MutationReturning, cn as RlsRole, cr as endsWith, ct as FilterOperators, d as MigrationDefinition, dn as ConvexAggregateIndexBuilder, dr as gt, dt as InferModelFromColumns, en as TableConfig, er as ExpressionVisitor, et as AggregateConfig, f as MigrationDirection, fn as ConvexAggregateIndexBuilderOn, fr as gte, ft as InferSelectModel, g as MigrationManifestEntry, gn as ConvexRankIndexBuilderOn, gr as isNotNull, gt as MutationExecutionMode, h as MigrationDriftIssue, hn as ConvexRankIndexBuilder, hr as isFieldReference, ht as MutationExecuteResult, i as OrmMigrationCapability, in as RlsPolicy, ir as UnaryExpression, it as BuildRelationResult, j as DatabaseWithQuery, jn as ConvexForeignKeyBuilder, jr as ColumnBuilder, jt as VectorSearchProvider, kn as ConvexCheckBuilder, kt as UpdateSet, ln as RlsRoleConfig, lr as eq, lt as GetColumnData, m as MigrationDocContext, mn as ConvexIndexBuilderOn, mr as inArray, mt as MutationExecuteConfig, n as OrmCapabilities, nn as deletion, nr as FilterExpression, nt as AggregateResult, on as RlsPolicyToOption, or as between, ot as CountResult, p as MigrationDoc, pn as ConvexIndexBuilder, pr as ilike, pt as InsertValue, qn as OrmSchemaExtensionTables, qt as ConvexDeletionBuilder, r as OrmCapability, rn as discriminator, rr as LogicalExpression, rt as BuildQueryResult, sn as rlsPolicy, sr as contains, st as DBQueryConfig, t as OrmAggregateCapability, tn as convexTable, tr as FieldReference, tt as AggregateFieldValue, u as MigrationAppliedState, un as rlsRole, ur as fieldRef, ut as InferInsertModel, v as MigrationPlan, vn as ConvexSearchIndexBuilderOn, vr as like, vt as MutationPaginatedResult, w as MigrationWriteMode, wn as index, wr as notInArray, wt as PaginatedResult, x as MigrationStateMap, xn as ConvexVectorIndexBuilderOn, xr as ne, xt as MutationRunMode, y as MigrationRunStatus, yn as ConvexSearchIndexConfig, yr as lt, yt as MutationResult, zn as ConvexTextBuilder, zr as IsPrimaryKey, zt as RelationsBuilderColumnBase } from "../capabilities-BAiI8avr.js";
|
|
2
|
+
import { $ as OrmClientWithApi$1, A as ConvexDateMode, B as ConvexBytesBuilderInitial, C as ConvexNumberBuilderInitial, D as id, E as ConvexIdBuilderInitial, F as custom, G as ConvexBigIntBuilder, H as ConvexBooleanBuilder, I as json, J as CreateOrmOptions, K as ConvexBigIntBuilderInitial, L as objectOf, M as ConvexCustomBuilder, N as ConvexCustomBuilderInitial, O as ConvexDateBuilder, P as arrayOf, Q as OrmClientBase$1, R as unionOf, S as ConvexNumberBuilder, St as defineTriggers, T as ConvexIdBuilder, U as ConvexBooleanBuilderInitial, V as bytes, W as boolean, X as GenericOrmCtx$1, Y as GenericOrm$1, Z as OrmApiResult, _ as ConvexTimestampMode, _t as OrmBeforeResult, a as requireSchemaRelations, at as ScheduledMutationBatchArgs, b as ConvexTextEnumBuilderInitial, bt as OrmTriggerContext, c as TableConfigResult, ct as scheduledDeleteFactory, d as OrmNotFoundError, et as OrmFunctions, f as ConvexVectorBuilder, g as ConvexTimestampBuilderInitial, gt as defineSchemaExtension, h as ConvexTimestampBuilder, ht as SchemaExtension, i as getSchemaTriggers, it as createOrm, j as date, k as ConvexDateBuilderInitial, l as getTableColumns, m as vector, n as defineSchema, nt as OrmWriterCtx, o as asc, ot as scheduledMutationBatchFactory, p as ConvexVectorBuilderInitial, q as bigint, r as getSchemaRelations, rt as ResolveOrmSchema, s as desc, st as ScheduledDeleteArgs, t as WhereClauseResult, tt as OrmReaderCtx, u as getTableConfig, v as timestamp, vt as OrmTableTriggers, w as integer, x as textEnum, xt as OrmTriggers, y as ConvexTextEnumBuilder, yt as OrmTriggerChange, z as ConvexBytesBuilder } from "../where-clause-compiler-DdAw9rNV.js";
|
|
3
3
|
import { i as pretendRequired, n as deprecated, r as pretend } from "../validators-wOIjhkfN.js";
|
|
4
4
|
import { a as QueryCtxWithPreferredOrmQueryTable, i as QueryCtxWithOrmQueryTable, n as LookupByIdResultByCtx, o as getByIdWithOrmQueryFallback, r as QueryCtxWithOptionalOrmQueryTable, t as DocByCtx } from "../query-context-DJONf8X5.js";
|
|
5
5
|
import { DefineSchemaOptions, GenericDatabaseReader, GenericDatabaseWriter, GenericSchema, SchemaDefinition } from "convex/server";
|