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 CHANGED
@@ -1,5 +1,215 @@
1
1
  # kitcn
2
2
 
3
+ ## 0.28.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#420](https://github.com/udecode/kitcn/pull/420) [`73741ed`](https://github.com/udecode/kitcn/commit/73741ed08779d539c9f186db366e326b138dbd36) Thanks [@MikeyZhang75](https://github.com/MikeyZhang75)! - ## Patches
8
+
9
+ - Fix `insert()` re-reading the same parent row once per inserted row. Rows of one statement that share a foreign key now cost one existence check instead of one per row.
10
+ - Fix the aggregate write barrier re-scanning the `CLEARING` index-state range once per written row. A multi-row write now checks it once per transaction, and a backfill that starts clearing an index still blocks the writes that follow it.
11
+ - Fix a relation `where` re-reading the same related document once per scanned row. Filtering by a relation now reads each distinct related document once per query instead of once per candidate row.
12
+
13
+ ## 0.28.0
14
+
15
+ ### Minor Changes
16
+
17
+ - [#430](https://github.com/udecode/kitcn/pull/430) [`d90c209`](https://github.com/udecode/kitcn/commit/d90c20987a5a94a29d3fcb57aee85e060146a2a8) Thanks [@zbeyens](https://github.com/zbeyens)! - ## Breaking changes
18
+
19
+ - Require Better Auth 1.7. Existing deployments need a maintenance window and
20
+ two schema deployments. Do not refresh the required Better Auth 1.7 schema
21
+ first: the old schema rejects new fields, while the required schema rejects
22
+ old rows.
23
+
24
+ ```ts
25
+ // Before
26
+ const account = { accountId, providerId, userId };
27
+
28
+ // After
29
+ const account = { accountId, issuer, providerId, userId };
30
+ ```
31
+
32
+ ### Deployment 1: optional fields and backfills
33
+
34
+ Stop authentication writes, background jobs, and admin APIs that write
35
+ `account`, `team`, or `teamMember`. Keep them stopped through deployment 2.
36
+
37
+ Keep the currently deployed Better Auth version. Temporarily add `issuer` and
38
+ the lookup index to the existing account schema owner. Apps using organization
39
+ teams must also add optional `memberCount` and `membershipKey` fields plus the
40
+ `membershipKey` index:
41
+
42
+ ```ts
43
+ // ORM account field/index
44
+ issuer: text(),
45
+ index("accountId_issuer").on(accountTable.accountId, accountTable.issuer),
46
+
47
+ // ORM team and teamMember fields/index
48
+ memberCount: integer(),
49
+ membershipKey: text(),
50
+ uniqueIndex("membershipKey").on(teamMemberTable.membershipKey),
51
+
52
+ // Raw Convex account field/index
53
+ issuer: v.optional(v.string()),
54
+ .index("accountId_issuer", ["accountId", "issuer"])
55
+
56
+ // Raw Convex team and teamMember fields/index
57
+ memberCount: v.optional(v.number()),
58
+ membershipKey: v.optional(v.string()),
59
+ .index("membershipKey", ["membershipKey"])
60
+ ```
61
+
62
+ `membershipKey` stays optional in the generated Better Auth 1.7 schema, and
63
+ the 1.7 adapter falls back to the existing `(teamId, userId)` pair when it is
64
+ absent. Existing rows do not need a membership-key backfill; new 1.7 writes
65
+ populate it.
66
+
67
+ Create a migration with `bunx kitcn migrate create backfill_account_issuer`.
68
+ Inventory every provider and resolve both parts of its 1.7 identity from
69
+ trusted provider data. Credential accounts use `local:credential` and their
70
+ linked user ID. OAuth providers without an issuer use
71
+ `local:oauth:${encodeURIComponent(providerId)}` and keep their stable provider
72
+ subject unless the 1.7 provider contract changed it.
73
+
74
+ Microsoft is a required exception: map every `microsoft` and
75
+ `microsoft-entra-id` row from its old `sub` to the verified directory `oid`
76
+ from a verified stored ID token or trusted Entra export. Apply the same rule to
77
+ custom OAuth/OIDC providers whose 1.7 `accountSubject` differs. Never derive an
78
+ identity from email or another mutable profile field. The
79
+ [Better Auth 1.7 upgrade guide](https://www.better-auth.com/docs/guides/1-7-upgrade-guide)
80
+ owns the provider-specific mapping rules.
81
+
82
+ ```ts
83
+ import { defineMigration } from "kitcn/orm";
84
+
85
+ const issuerByProviderId = {
86
+ credential: "local:credential",
87
+ github: "local:oauth:github",
88
+ google: "https://accounts.google.com",
89
+ } as const;
90
+
91
+ // Add every row whose trusted 1.7 provider subject differs from accountId.
92
+ const accountIdByRowId: Record<string, string> = {
93
+ "microsoft-account-row-id": "verified-directory-oid",
94
+ };
95
+
96
+ export const migration = defineMigration({
97
+ id: "20260826_000000_backfill_account_issuer",
98
+ up: {
99
+ table: "account",
100
+ migrateOne: async (ctx, account) => {
101
+ const issuer =
102
+ issuerByProviderId[
103
+ account.providerId as keyof typeof issuerByProviderId
104
+ ];
105
+
106
+ if (!issuer) {
107
+ throw new Error(`Map issuer for provider ${account.providerId}`);
108
+ }
109
+ const mappedAccountId = accountIdByRowId[account._id];
110
+ if (
111
+ (account.providerId === "microsoft" ||
112
+ account.providerId === "microsoft-entra-id") &&
113
+ !mappedAccountId
114
+ ) {
115
+ throw new Error(`Map verified Microsoft oid for ${account._id}`);
116
+ }
117
+ const accountId =
118
+ mappedAccountId ??
119
+ (account.providerId === "credential"
120
+ ? account.userId
121
+ : account.accountId);
122
+ if (!accountId) {
123
+ throw new Error(`Map account subject for ${account._id}`);
124
+ }
125
+
126
+ if (account.issuer !== undefined && account.issuer !== issuer) {
127
+ throw new Error(`Issuer mismatch for account ${account._id}`);
128
+ }
129
+ if (account.issuer === issuer && account.accountId === accountId) {
130
+ return;
131
+ }
132
+
133
+ const collision = await ctx.db
134
+ .query("account")
135
+ .withIndex("accountId_issuer", (query) =>
136
+ query.eq("accountId", accountId).eq("issuer", issuer)
137
+ )
138
+ .unique();
139
+
140
+ if (collision && collision._id !== account._id) {
141
+ throw new Error(`Duplicate account identity ${issuer}:${accountId}`);
142
+ }
143
+
144
+ return { accountId, issuer };
145
+ },
146
+ },
147
+ });
148
+ ```
149
+
150
+ Apps using organization teams must also create a migration that sets every
151
+ team's count from the indexed `teamMember` rows:
152
+
153
+ ```ts
154
+ export const teamMemberCountMigration = defineMigration({
155
+ id: "20260826_000001_backfill_team_member_count",
156
+ up: {
157
+ table: "team",
158
+ migrateOne: async (ctx, team) => {
159
+ const members = await ctx.db
160
+ .query("teamMember")
161
+ .withIndex("teamId", (query) => query.eq("teamId", team._id))
162
+ .collect();
163
+
164
+ return { memberCount: members.length };
165
+ },
166
+ },
167
+ });
168
+ ```
169
+
170
+ Deploy the optional schema and migration, then require a completed status:
171
+
172
+ ```bash
173
+ bunx kitcn codegen
174
+ bunx kitcn deploy --prod
175
+ bunx kitcn migrate status --prod
176
+ ```
177
+
178
+ Raw Convex apps use the same resolver and indexed collision check in a
179
+ paginated internal mutation after deploying the optional fields and indexes.
180
+ Team users must also count `teamMember` rows by the `teamId` index and patch
181
+ every team using the team's Convex `_id`. Finish every page, verify no account
182
+ lacks either identity field, verify no `(issuer, accountId)` collision exists,
183
+ and verify every team count before continuing.
184
+
185
+ ### Deployment 2: required Better Auth 1.7 schema
186
+
187
+ After the backfill is complete, upgrade KitCN and Better Auth, refresh the
188
+ auth-owned schema, and deploy the required field and compound identity index:
189
+
190
+ ```bash
191
+ # Default KitCN schema owner
192
+ bunx kitcn add auth --schema --yes
193
+
194
+ # Raw Convex schema owner; use this command instead of the default command
195
+ bunx kitcn add auth --preset convex --yes
196
+
197
+ bunx kitcn deploy --prod
198
+ ```
199
+
200
+ Verify returning credential, OAuth, and Microsoft sign-in plus team membership
201
+ changes against the migrated data. Resume writes only after these checks pass.
202
+
203
+ ## Features
204
+
205
+ - Support Better Auth 1.7 account identity constraints, declared table indexes,
206
+ atomic adapter mutations, stable join configuration, session hydration, and
207
+ organization metadata reads.
208
+
209
+ ## Patches
210
+
211
+ - Fix OpenID discovery to advertise the configured JWT signing algorithm.
212
+
3
213
  ## 0.27.5
4
214
 
5
215
  ### Patch Changes
@@ -1,5 +1,5 @@
1
- import { Bn as ConvexTextBuilderInitial, Xt as ConvexTableWithColumns } from "../capabilities-DkfnnNp7.js";
2
- import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial } from "../where-clause-compiler-DuC8Nr7e.js";
1
+ import { Bn as ConvexTextBuilderInitial, Xt as ConvexTableWithColumns } from "../capabilities-BAiI8avr.js";
2
+ import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial } from "../where-clause-compiler-DdAw9rNV.js";
3
3
  import * as convex_values0 from "convex/values";
4
4
  import { GenericId, Infer, Value } from "convex/values";
5
5
  import { DocumentByName, GenericDataModel, GenericDatabaseReader, GenericDatabaseWriter, TableNamesInDataModel } from "convex/server";
@@ -6,8 +6,6 @@ import * as react_jsx_runtime0 from "react/jsx-runtime";
6
6
  import { AuthConfig } from "convex/server";
7
7
  import * as better_auth0 from "better-auth";
8
8
  import { Session, User } from "better-auth";
9
- import * as better_auth_api0 from "better-auth/api";
10
- import * as better_auth_plugins_oidc_provider0 from "better-auth/plugins/oidc-provider";
11
9
  import * as jose from "jose";
12
10
  import { BetterAuthOptions } from "better-auth/minimal";
13
11
  import { BetterAuthClientPlugin } from "better-auth/client";
@@ -36,18 +34,15 @@ declare const convex: (opts: {
36
34
  hooks: {
37
35
  before: ({
38
36
  matcher(context: better_auth0.HookEndpointContext): boolean;
39
- handler: (inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
37
+ handler: better_auth0.Middleware<better_auth0.MiddlewareOptions, (inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
40
38
  context: {
41
39
  headers: Headers;
42
40
  };
43
- } | undefined>;
41
+ } | undefined>>;
44
42
  } | {
45
43
  matcher: (ctx: better_auth0.HookEndpointContext) => boolean;
46
- handler: (inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
47
- context: better_auth0.MiddlewareContext<better_auth0.MiddlewareOptions, {
48
- returned?: unknown | undefined;
49
- responseHeaders?: Headers | undefined;
50
- } & better_auth0.PluginContext<BetterAuthOptions> & better_auth0.InfoContext & {
44
+ handler: better_auth0.Middleware<better_auth0.MiddlewareOptions, (inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
45
+ context: better_auth0.MiddlewareContext<better_auth0.MiddlewareOptions, better_auth0.PluginContext<BetterAuthOptions> & better_auth0.InfoContext & {
51
46
  options: BetterAuthOptions;
52
47
  trustedOrigins: string[];
53
48
  trustedProviders: string[];
@@ -139,6 +134,7 @@ declare const convex: (opts: {
139
134
  updateAge: number;
140
135
  expiresIn: number;
141
136
  freshAge: number;
137
+ cookieCacheSigner?: better_auth0.CookieCacheSigner | undefined;
142
138
  cookieRefreshCache: false | {
143
139
  enabled: true;
144
140
  updateAge: number;
@@ -172,12 +168,15 @@ declare const convex: (opts: {
172
168
  skipCSRFCheck: boolean;
173
169
  runInBackground: (promise: Promise<unknown>) => void;
174
170
  runInBackgroundOrAwait: (promise: Promise<unknown> | void) => better_auth0.Awaitable<unknown>;
171
+ } & {
172
+ returned?: unknown | undefined;
173
+ responseHeaders?: Headers | undefined;
175
174
  }>;
176
- }>;
175
+ }>>;
177
176
  })[];
178
177
  after: {
179
- matcher: (context: better_auth0.HookEndpointContext) => boolean;
180
- handler: better_auth_api0.AuthMiddleware;
178
+ matcher: (ctx: better_auth0.HookEndpointContext) => boolean;
179
+ handler: better_auth0.Middleware<better_auth0.MiddlewareOptions, (inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<void>>;
181
180
  }[];
182
181
  };
183
182
  endpoints: {
@@ -186,7 +185,25 @@ declare const convex: (opts: {
186
185
  metadata: {
187
186
  isAction: false;
188
187
  };
189
- }, better_auth_plugins_oidc_provider0.OIDCMetadata>;
188
+ }, {
189
+ issuer: string;
190
+ authorization_endpoint: string;
191
+ token_endpoint: string;
192
+ userinfo_endpoint: string;
193
+ jwks_uri: string;
194
+ registration_endpoint: string;
195
+ end_session_endpoint: string;
196
+ scopes_supported: string[];
197
+ response_types_supported: string[];
198
+ response_modes_supported: string[];
199
+ grant_types_supported: string[];
200
+ acr_values_supported: string[];
201
+ subject_types_supported: string[];
202
+ id_token_signing_alg_values_supported: string[];
203
+ token_endpoint_auth_methods_supported: string[];
204
+ code_challenge_methods_supported: string[];
205
+ claims_supported: string[];
206
+ }>;
190
207
  getJwks: better_auth0.StrictEndpoint<"/convex/jwks", {
191
208
  method: "GET";
192
209
  metadata: {
@@ -223,7 +240,7 @@ declare const convex: (opts: {
223
240
  getToken: better_auth0.StrictEndpoint<"/convex/token", {
224
241
  method: "GET";
225
242
  requireHeaders: true;
226
- use: ((inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
243
+ use: better_auth0.Middleware<better_auth0.MiddlewareOptions, (inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
227
244
  session: {
228
245
  session: Record<string, any> & {
229
246
  id: string;
@@ -245,7 +262,7 @@ declare const convex: (opts: {
245
262
  image?: string | null | undefined;
246
263
  };
247
264
  };
248
- }>)[];
265
+ }>>[];
249
266
  metadata: {
250
267
  openapi: {
251
268
  description: string;
@@ -274,6 +291,14 @@ declare const convex: (opts: {
274
291
  type: "date";
275
292
  required: false;
276
293
  };
294
+ alg: {
295
+ type: "string";
296
+ required: false;
297
+ };
298
+ crv: {
299
+ type: "string";
300
+ required: false;
301
+ };
277
302
  };
278
303
  };
279
304
  user: {
@@ -353,7 +378,10 @@ type ConvexAuthProviderClient = {
353
378
  type AuthClientWithPlugins<Plugins extends BetterAuthClientPlugin[]> = ReturnType<typeof createAuthClient<{
354
379
  plugins: Plugins;
355
380
  }>>;
356
- type AuthClient = AuthClientWithPlugins<PluginsWithCrossDomain> | AuthClientWithPlugins<PluginsWithoutCrossDomain>;
381
+ type HydratableAuthClient<Plugins extends BetterAuthClientPlugin[]> = Omit<AuthClientWithPlugins<Plugins>, 'hydrateSession'> & {
382
+ hydrateSession(session: Parameters<AuthClientWithPlugins<Plugins>['hydrateSession']>[0]): void;
383
+ };
384
+ type AuthClient = HydratableAuthClient<PluginsWithCrossDomain> | HydratableAuthClient<PluginsWithoutCrossDomain>;
357
385
  //#endregion
358
386
  //#region src/auth-client/convex-auth-provider.d.ts
359
387
  type ConvexAuthProviderQueryClient = {
@@ -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-BEc4d98x.js";
1
+ import { C as GenericAuthTriggers, S as GenericAuthTriggerHandlers, b as GenericAuthDefinition, i as getGeneratedAuthDisabledReason, n as GeneratedAuthDisabledReasonKind, r as createDisabledAuthRuntime, t as AuthRuntime, v as BetterAuthOptionsWithoutDatabase, w as defineAuth, x as GenericAuthTriggerChange, y as GenericAuthBeforeResult } from "../../generated-contract-disabled-BBCcpNyF.js";
2
2
  export { type AuthRuntime, BetterAuthOptionsWithoutDatabase, type GeneratedAuthDisabledReasonKind, GenericAuthBeforeResult, GenericAuthDefinition, GenericAuthTriggerChange, GenericAuthTriggerHandlers, GenericAuthTriggers, createDisabledAuthRuntime, defineAuth, getGeneratedAuthDisabledReason };
@@ -1,3 +1,3 @@
1
- import { i as defineAuth, n as createDisabledAuthRuntime, r as getGeneratedAuthDisabledReason } from "../../generated-contract-disabled-CZa0iyV0.js";
1
+ import { i as defineAuth, n as createDisabledAuthRuntime, r as getGeneratedAuthDisabledReason } from "../../generated-contract-disabled-_1Mjg9pW.js";
2
2
 
3
3
  export { createDisabledAuthRuntime, defineAuth, getGeneratedAuthDisabledReason };
@@ -1,7 +1,7 @@
1
1
  import { a as QueryCtxWithPreferredOrmQueryTable, n as LookupByIdResultByCtx, t as DocByCtx } from "../query-context-DJONf8X5.js";
2
2
  import { t as GetAuth } from "../types-Bf3XQex5.js";
3
3
  import { t as GenericCtx } from "../context-utils-DwZ3Cam1.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-BEc4d98x.js";
4
+ import { C as GenericAuthTriggers, S as GenericAuthTriggerHandlers, _ as updateOneHandler, a as AuthFunctions, b as GenericAuthDefinition, c as consumeOneHandler, d as deleteManyHandler, f as deleteOneHandler, g as updateManyHandler, h as incrementOneHandler, i as getGeneratedAuthDisabledReason, l as createApi, m as findOneHandler, n as GeneratedAuthDisabledReasonKind, o as Triggers, p as findManyHandler, r as createDisabledAuthRuntime, s as createClient, t as AuthRuntime, u as createHandler, v as BetterAuthOptionsWithoutDatabase, w as defineAuth, x as GenericAuthTriggerChange, y as GenericAuthBeforeResult } from "../generated-contract-disabled-BBCcpNyF.js";
5
5
  import * as convex_values0 from "convex/values";
6
6
  import { Infer } from "convex/values";
7
7
  import { AuthConfig, DocumentByName, GenericDataModel, GenericMutationCtx, GenericQueryCtx, GenericSchema, PaginationOptions, PaginationResult, SchemaDefinition, TableNamesInDataModel } from "convex/server";
@@ -9,8 +9,6 @@ import * as better_auth_adapters0 from "better-auth/adapters";
9
9
  import { DBAdapterDebugLogOption } from "better-auth/adapters";
10
10
  import { BetterAuthDBSchema } from "better-auth/db";
11
11
  import { BetterAuthOptions } from "better-auth/minimal";
12
- import * as better_auth_api0 from "better-auth/api";
13
- import * as better_auth_plugins_oidc_provider0 from "better-auth/plugins/oidc-provider";
14
12
  import * as jose from "jose";
15
13
  import * as better_auth0 from "better-auth";
16
14
  import { Session, User } from "better-auth";
@@ -68,7 +66,7 @@ declare const adapterConfig: {
68
66
  action: "create" | "update" | "findOne" | "findMany" | "updateMany" | "delete" | "deleteMany" | "consumeOne" | "incrementOne" | "count";
69
67
  model: string;
70
68
  schema: BetterAuthDBSchema;
71
- options: better_auth0.BetterAuthOptions;
69
+ options: BetterAuthOptions;
72
70
  }) => any;
73
71
  customTransformOutput: ({
74
72
  data,
@@ -80,7 +78,7 @@ declare const adapterConfig: {
80
78
  select: string[];
81
79
  model: string;
82
80
  schema: BetterAuthDBSchema;
83
- options: better_auth0.BetterAuthOptions;
81
+ options: BetterAuthOptions;
84
82
  }) => any;
85
83
  };
86
84
  declare const httpAdapter: <DataModel extends GenericDataModel, Schema extends SchemaDefinition<any, any>>(ctx: GenericCtx<DataModel>, {
@@ -91,7 +89,7 @@ declare const httpAdapter: <DataModel extends GenericDataModel, Schema extends S
91
89
  authFunctions: AuthFunctions;
92
90
  debugLogs?: DBAdapterDebugLogOption;
93
91
  schema?: Schema;
94
- }) => better_auth_adapters0.AdapterFactory<better_auth0.BetterAuthOptions>;
92
+ }) => better_auth_adapters0.AdapterFactory<BetterAuthOptions>;
95
93
  declare const dbAdapter: <DataModel extends GenericDataModel, Schema extends SchemaDefinition<any, any>>(ctx: GenericCtx<DataModel>, {
96
94
  authFunctions,
97
95
  debugLogs,
@@ -102,7 +100,7 @@ declare const dbAdapter: <DataModel extends GenericDataModel, Schema extends Sch
102
100
  getBetterAuthSchema: () => BetterAuthDBSchema;
103
101
  schema: Schema;
104
102
  debugLogs?: DBAdapterDebugLogOption;
105
- }) => better_auth_adapters0.AdapterFactory<better_auth0.BetterAuthOptions>;
103
+ }) => better_auth_adapters0.AdapterFactory<BetterAuthOptions>;
106
104
  //#endregion
107
105
  //#region src/auth/adapter-utils.d.ts
108
106
  type AdapterPaginationOptions = PaginationOptions & {
@@ -123,7 +121,6 @@ declare const adapterWhereValidator: convex_values0.VObject<{
123
121
  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>;
124
122
  }, "required", "mode" | "value" | "connector" | "field" | "operator">;
125
123
  declare const adapterArgsValidator: convex_values0.VObject<{
126
- select?: string[] | undefined;
127
124
  where?: {
128
125
  mode?: "sensitive" | "insensitive" | undefined;
129
126
  connector?: "AND" | "OR" | undefined;
@@ -133,6 +130,7 @@ declare const adapterArgsValidator: convex_values0.VObject<{
133
130
  }[] | undefined;
134
131
  limit?: number | undefined;
135
132
  offset?: number | undefined;
133
+ select?: string[] | undefined;
136
134
  sortBy?: {
137
135
  field: string;
138
136
  direction: "asc" | "desc";
@@ -169,7 +167,7 @@ declare const adapterArgsValidator: convex_values0.VObject<{
169
167
  operator: convex_values0.VUnion<"lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined, [convex_values0.VLiteral<"lt", "required">, convex_values0.VLiteral<"lte", "required">, convex_values0.VLiteral<"gt", "required">, convex_values0.VLiteral<"gte", "required">, convex_values0.VLiteral<"eq", "required">, convex_values0.VLiteral<"in", "required">, convex_values0.VLiteral<"not_in", "required">, convex_values0.VLiteral<"ne", "required">, convex_values0.VLiteral<"contains", "required">, convex_values0.VLiteral<"starts_with", "required">, convex_values0.VLiteral<"ends_with", "required">], "optional", never>;
170
168
  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>;
171
169
  }, "required", "mode" | "value" | "connector" | "field" | "operator">, "optional">;
172
- }, "required", "model" | "select" | "where" | "limit" | "offset" | "sortBy" | "sortBy.field" | "sortBy.direction">;
170
+ }, "required", "model" | "where" | "limit" | "offset" | "select" | "sortBy" | "sortBy.field" | "sortBy.direction">;
173
171
  declare const hasUniqueFields: (betterAuthSchema: BetterAuthDBSchema, model: string, input: Record<string, any>) => boolean;
174
172
  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>;
175
173
  declare const selectFields: <T extends TableNamesInDataModel<GenericDataModel>, D extends DocumentByName<GenericDataModel, T>>(doc: D | null, select?: string[]) => D | null;
@@ -254,18 +252,15 @@ declare const convex: (opts: {
254
252
  hooks: {
255
253
  before: ({
256
254
  matcher(context: better_auth0.HookEndpointContext): boolean;
257
- handler: (inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
255
+ handler: better_auth0.Middleware<better_auth0.MiddlewareOptions, (inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
258
256
  context: {
259
257
  headers: Headers;
260
258
  };
261
- } | undefined>;
259
+ } | undefined>>;
262
260
  } | {
263
261
  matcher: (ctx: better_auth0.HookEndpointContext) => boolean;
264
- handler: (inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
265
- context: better_auth0.MiddlewareContext<better_auth0.MiddlewareOptions, {
266
- returned?: unknown | undefined;
267
- responseHeaders?: Headers | undefined;
268
- } & better_auth0.PluginContext<BetterAuthOptions> & better_auth0.InfoContext & {
262
+ handler: better_auth0.Middleware<better_auth0.MiddlewareOptions, (inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
263
+ context: better_auth0.MiddlewareContext<better_auth0.MiddlewareOptions, better_auth0.PluginContext<BetterAuthOptions> & better_auth0.InfoContext & {
269
264
  options: BetterAuthOptions;
270
265
  trustedOrigins: string[];
271
266
  trustedProviders: string[];
@@ -357,6 +352,7 @@ declare const convex: (opts: {
357
352
  updateAge: number;
358
353
  expiresIn: number;
359
354
  freshAge: number;
355
+ cookieCacheSigner?: better_auth0.CookieCacheSigner | undefined;
360
356
  cookieRefreshCache: false | {
361
357
  enabled: true;
362
358
  updateAge: number;
@@ -390,12 +386,15 @@ declare const convex: (opts: {
390
386
  skipCSRFCheck: boolean;
391
387
  runInBackground: (promise: Promise<unknown>) => void;
392
388
  runInBackgroundOrAwait: (promise: Promise<unknown> | void) => better_auth0.Awaitable<unknown>;
389
+ } & {
390
+ returned?: unknown | undefined;
391
+ responseHeaders?: Headers | undefined;
393
392
  }>;
394
- }>;
393
+ }>>;
395
394
  })[];
396
395
  after: {
397
- matcher: (context: better_auth0.HookEndpointContext) => boolean;
398
- handler: better_auth_api0.AuthMiddleware;
396
+ matcher: (ctx: better_auth0.HookEndpointContext) => boolean;
397
+ handler: better_auth0.Middleware<better_auth0.MiddlewareOptions, (inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<void>>;
399
398
  }[];
400
399
  };
401
400
  endpoints: {
@@ -404,7 +403,25 @@ declare const convex: (opts: {
404
403
  metadata: {
405
404
  isAction: false;
406
405
  };
407
- }, better_auth_plugins_oidc_provider0.OIDCMetadata>;
406
+ }, {
407
+ issuer: string;
408
+ authorization_endpoint: string;
409
+ token_endpoint: string;
410
+ userinfo_endpoint: string;
411
+ jwks_uri: string;
412
+ registration_endpoint: string;
413
+ end_session_endpoint: string;
414
+ scopes_supported: string[];
415
+ response_types_supported: string[];
416
+ response_modes_supported: string[];
417
+ grant_types_supported: string[];
418
+ acr_values_supported: string[];
419
+ subject_types_supported: string[];
420
+ id_token_signing_alg_values_supported: string[];
421
+ token_endpoint_auth_methods_supported: string[];
422
+ code_challenge_methods_supported: string[];
423
+ claims_supported: string[];
424
+ }>;
408
425
  getJwks: better_auth0.StrictEndpoint<"/convex/jwks", {
409
426
  method: "GET";
410
427
  metadata: {
@@ -441,7 +458,7 @@ declare const convex: (opts: {
441
458
  getToken: better_auth0.StrictEndpoint<"/convex/token", {
442
459
  method: "GET";
443
460
  requireHeaders: true;
444
- use: ((inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
461
+ use: better_auth0.Middleware<better_auth0.MiddlewareOptions, (inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
445
462
  session: {
446
463
  session: Record<string, any> & {
447
464
  id: string;
@@ -463,7 +480,7 @@ declare const convex: (opts: {
463
480
  image?: string | null | undefined;
464
481
  };
465
482
  };
466
- }>)[];
483
+ }>>[];
467
484
  metadata: {
468
485
  openapi: {
469
486
  description: string;
@@ -492,6 +509,14 @@ declare const convex: (opts: {
492
509
  type: "date";
493
510
  required: false;
494
511
  };
512
+ alg: {
513
+ type: "string";
514
+ required: false;
515
+ };
516
+ crv: {
517
+ type: "string";
518
+ required: false;
519
+ };
495
520
  };
496
521
  };
497
522
  user: {
@@ -506,4 +531,4 @@ declare const convex: (opts: {
506
531
  };
507
532
  };
508
533
  //#endregion
509
- export { type AuthFunctions, type AuthRuntime, BetterAuthOptionsWithoutDatabase, ConvexCleanedWhere, type GeneratedAuthDisabledReasonKind, GenericAuthBeforeResult, GenericAuthDefinition, GenericAuthTriggerChange, GenericAuthTriggerHandlers, GenericAuthTriggers, GetAuth, SessionClientSignals, type Triggers, adapterArgsValidator, adapterConfig, adapterWhereValidator, checkUniqueFields, convex, createApi, createAuthRuntime, createClient, createDisabledAuthRuntime, createHandler, dbAdapter, defineAuth, deleteManyHandler, deleteOneHandler, findManyHandler, findOneHandler, getAuthUserId, getAuthUserIdentity, getGeneratedAuthDisabledReason, getHeaders, getInvalidAuthDefinitionExportReason, getSession, getSessionNetworkSignals, handlePagination, hasUniqueFields, httpAdapter, listOne, paginate, resolveGeneratedAuthDefinition, selectFields, updateManyHandler, updateOneHandler };
534
+ export { type AuthFunctions, type AuthRuntime, BetterAuthOptionsWithoutDatabase, ConvexCleanedWhere, type GeneratedAuthDisabledReasonKind, GenericAuthBeforeResult, GenericAuthDefinition, GenericAuthTriggerChange, GenericAuthTriggerHandlers, GenericAuthTriggers, GetAuth, SessionClientSignals, type Triggers, adapterArgsValidator, adapterConfig, adapterWhereValidator, checkUniqueFields, consumeOneHandler, convex, createApi, createAuthRuntime, createClient, createDisabledAuthRuntime, createHandler, dbAdapter, defineAuth, deleteManyHandler, deleteOneHandler, findManyHandler, findOneHandler, getAuthUserId, getAuthUserIdentity, getGeneratedAuthDisabledReason, getHeaders, getInvalidAuthDefinitionExportReason, getSession, getSessionNetworkSignals, handlePagination, hasUniqueFields, httpAdapter, incrementOneHandler, listOne, paginate, resolveGeneratedAuthDefinition, selectFields, updateManyHandler, updateOneHandler };