kitcn 0.27.5 → 0.28.0
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 +200 -0
- package/dist/aggregate/index.d.ts +1 -1
- 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 +55 -30
- 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/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-Btfy2opW.d.ts} +53 -11
- package/dist/{generated-contract-disabled-CZa0iyV0.js → generated-contract-disabled-_1Mjg9pW.js} +2 -0
- package/dist/orm/index.d.ts +1 -1
- package/dist/orm/migrations/index.d.ts +1 -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-CETRjurp.d.ts} +16 -16
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,205 @@
|
|
|
1
1
|
# kitcn
|
|
2
2
|
|
|
3
|
+
## 0.28.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#430](https://github.com/udecode/kitcn/pull/430) [`d90c209`](https://github.com/udecode/kitcn/commit/d90c20987a5a94a29d3fcb57aee85e060146a2a8) Thanks [@zbeyens](https://github.com/zbeyens)! - ## Breaking changes
|
|
8
|
+
|
|
9
|
+
- Require Better Auth 1.7. Existing deployments need a maintenance window and
|
|
10
|
+
two schema deployments. Do not refresh the required Better Auth 1.7 schema
|
|
11
|
+
first: the old schema rejects new fields, while the required schema rejects
|
|
12
|
+
old rows.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
// Before
|
|
16
|
+
const account = { accountId, providerId, userId };
|
|
17
|
+
|
|
18
|
+
// After
|
|
19
|
+
const account = { accountId, issuer, providerId, userId };
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Deployment 1: optional fields and backfills
|
|
23
|
+
|
|
24
|
+
Stop authentication writes, background jobs, and admin APIs that write
|
|
25
|
+
`account`, `team`, or `teamMember`. Keep them stopped through deployment 2.
|
|
26
|
+
|
|
27
|
+
Keep the currently deployed Better Auth version. Temporarily add `issuer` and
|
|
28
|
+
the lookup index to the existing account schema owner. Apps using organization
|
|
29
|
+
teams must also add optional `memberCount` and `membershipKey` fields plus the
|
|
30
|
+
`membershipKey` index:
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
// ORM account field/index
|
|
34
|
+
issuer: text(),
|
|
35
|
+
index("accountId_issuer").on(accountTable.accountId, accountTable.issuer),
|
|
36
|
+
|
|
37
|
+
// ORM team and teamMember fields/index
|
|
38
|
+
memberCount: integer(),
|
|
39
|
+
membershipKey: text(),
|
|
40
|
+
uniqueIndex("membershipKey").on(teamMemberTable.membershipKey),
|
|
41
|
+
|
|
42
|
+
// Raw Convex account field/index
|
|
43
|
+
issuer: v.optional(v.string()),
|
|
44
|
+
.index("accountId_issuer", ["accountId", "issuer"])
|
|
45
|
+
|
|
46
|
+
// Raw Convex team and teamMember fields/index
|
|
47
|
+
memberCount: v.optional(v.number()),
|
|
48
|
+
membershipKey: v.optional(v.string()),
|
|
49
|
+
.index("membershipKey", ["membershipKey"])
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
`membershipKey` stays optional in the generated Better Auth 1.7 schema, and
|
|
53
|
+
the 1.7 adapter falls back to the existing `(teamId, userId)` pair when it is
|
|
54
|
+
absent. Existing rows do not need a membership-key backfill; new 1.7 writes
|
|
55
|
+
populate it.
|
|
56
|
+
|
|
57
|
+
Create a migration with `bunx kitcn migrate create backfill_account_issuer`.
|
|
58
|
+
Inventory every provider and resolve both parts of its 1.7 identity from
|
|
59
|
+
trusted provider data. Credential accounts use `local:credential` and their
|
|
60
|
+
linked user ID. OAuth providers without an issuer use
|
|
61
|
+
`local:oauth:${encodeURIComponent(providerId)}` and keep their stable provider
|
|
62
|
+
subject unless the 1.7 provider contract changed it.
|
|
63
|
+
|
|
64
|
+
Microsoft is a required exception: map every `microsoft` and
|
|
65
|
+
`microsoft-entra-id` row from its old `sub` to the verified directory `oid`
|
|
66
|
+
from a verified stored ID token or trusted Entra export. Apply the same rule to
|
|
67
|
+
custom OAuth/OIDC providers whose 1.7 `accountSubject` differs. Never derive an
|
|
68
|
+
identity from email or another mutable profile field. The
|
|
69
|
+
[Better Auth 1.7 upgrade guide](https://www.better-auth.com/docs/guides/1-7-upgrade-guide)
|
|
70
|
+
owns the provider-specific mapping rules.
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
import { defineMigration } from "kitcn/orm";
|
|
74
|
+
|
|
75
|
+
const issuerByProviderId = {
|
|
76
|
+
credential: "local:credential",
|
|
77
|
+
github: "local:oauth:github",
|
|
78
|
+
google: "https://accounts.google.com",
|
|
79
|
+
} as const;
|
|
80
|
+
|
|
81
|
+
// Add every row whose trusted 1.7 provider subject differs from accountId.
|
|
82
|
+
const accountIdByRowId: Record<string, string> = {
|
|
83
|
+
"microsoft-account-row-id": "verified-directory-oid",
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const migration = defineMigration({
|
|
87
|
+
id: "20260826_000000_backfill_account_issuer",
|
|
88
|
+
up: {
|
|
89
|
+
table: "account",
|
|
90
|
+
migrateOne: async (ctx, account) => {
|
|
91
|
+
const issuer =
|
|
92
|
+
issuerByProviderId[
|
|
93
|
+
account.providerId as keyof typeof issuerByProviderId
|
|
94
|
+
];
|
|
95
|
+
|
|
96
|
+
if (!issuer) {
|
|
97
|
+
throw new Error(`Map issuer for provider ${account.providerId}`);
|
|
98
|
+
}
|
|
99
|
+
const mappedAccountId = accountIdByRowId[account._id];
|
|
100
|
+
if (
|
|
101
|
+
(account.providerId === "microsoft" ||
|
|
102
|
+
account.providerId === "microsoft-entra-id") &&
|
|
103
|
+
!mappedAccountId
|
|
104
|
+
) {
|
|
105
|
+
throw new Error(`Map verified Microsoft oid for ${account._id}`);
|
|
106
|
+
}
|
|
107
|
+
const accountId =
|
|
108
|
+
mappedAccountId ??
|
|
109
|
+
(account.providerId === "credential"
|
|
110
|
+
? account.userId
|
|
111
|
+
: account.accountId);
|
|
112
|
+
if (!accountId) {
|
|
113
|
+
throw new Error(`Map account subject for ${account._id}`);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (account.issuer !== undefined && account.issuer !== issuer) {
|
|
117
|
+
throw new Error(`Issuer mismatch for account ${account._id}`);
|
|
118
|
+
}
|
|
119
|
+
if (account.issuer === issuer && account.accountId === accountId) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const collision = await ctx.db
|
|
124
|
+
.query("account")
|
|
125
|
+
.withIndex("accountId_issuer", (query) =>
|
|
126
|
+
query.eq("accountId", accountId).eq("issuer", issuer)
|
|
127
|
+
)
|
|
128
|
+
.unique();
|
|
129
|
+
|
|
130
|
+
if (collision && collision._id !== account._id) {
|
|
131
|
+
throw new Error(`Duplicate account identity ${issuer}:${accountId}`);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return { accountId, issuer };
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Apps using organization teams must also create a migration that sets every
|
|
141
|
+
team's count from the indexed `teamMember` rows:
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
export const teamMemberCountMigration = defineMigration({
|
|
145
|
+
id: "20260826_000001_backfill_team_member_count",
|
|
146
|
+
up: {
|
|
147
|
+
table: "team",
|
|
148
|
+
migrateOne: async (ctx, team) => {
|
|
149
|
+
const members = await ctx.db
|
|
150
|
+
.query("teamMember")
|
|
151
|
+
.withIndex("teamId", (query) => query.eq("teamId", team._id))
|
|
152
|
+
.collect();
|
|
153
|
+
|
|
154
|
+
return { memberCount: members.length };
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Deploy the optional schema and migration, then require a completed status:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
bunx kitcn codegen
|
|
164
|
+
bunx kitcn deploy --prod
|
|
165
|
+
bunx kitcn migrate status --prod
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Raw Convex apps use the same resolver and indexed collision check in a
|
|
169
|
+
paginated internal mutation after deploying the optional fields and indexes.
|
|
170
|
+
Team users must also count `teamMember` rows by the `teamId` index and patch
|
|
171
|
+
every team using the team's Convex `_id`. Finish every page, verify no account
|
|
172
|
+
lacks either identity field, verify no `(issuer, accountId)` collision exists,
|
|
173
|
+
and verify every team count before continuing.
|
|
174
|
+
|
|
175
|
+
### Deployment 2: required Better Auth 1.7 schema
|
|
176
|
+
|
|
177
|
+
After the backfill is complete, upgrade KitCN and Better Auth, refresh the
|
|
178
|
+
auth-owned schema, and deploy the required field and compound identity index:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Default KitCN schema owner
|
|
182
|
+
bunx kitcn add auth --schema --yes
|
|
183
|
+
|
|
184
|
+
# Raw Convex schema owner; use this command instead of the default command
|
|
185
|
+
bunx kitcn add auth --preset convex --yes
|
|
186
|
+
|
|
187
|
+
bunx kitcn deploy --prod
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Verify returning credential, OAuth, and Microsoft sign-in plus team membership
|
|
191
|
+
changes against the migrated data. Resume writes only after these checks pass.
|
|
192
|
+
|
|
193
|
+
## Features
|
|
194
|
+
|
|
195
|
+
- Support Better Auth 1.7 account identity constraints, declared table indexes,
|
|
196
|
+
atomic adapter mutations, stable join configuration, session hydration, and
|
|
197
|
+
organization metadata reads.
|
|
198
|
+
|
|
199
|
+
## Patches
|
|
200
|
+
|
|
201
|
+
- Fix OpenID discovery to advertise the configured JWT signing algorithm.
|
|
202
|
+
|
|
3
203
|
## 0.27.5
|
|
4
204
|
|
|
5
205
|
### Patch Changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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-
|
|
2
|
+
import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial } from "../where-clause-compiler-CETRjurp.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: (
|
|
180
|
-
handler:
|
|
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
|
-
},
|
|
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: (
|
|
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
|
|
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 {
|
|
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-Btfy2opW.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-
|
|
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 };
|
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-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
|
|
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-Btfy2opW.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:
|
|
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:
|
|
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<
|
|
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<
|
|
103
|
+
}) => better_auth_adapters0.AdapterFactory<BetterAuthOptions>;
|
|
106
104
|
//#endregion
|
|
107
105
|
//#region src/auth/adapter-utils.d.ts
|
|
108
106
|
type AdapterPaginationOptions = PaginationOptions & {
|
|
@@ -113,26 +111,26 @@ declare const adapterWhereValidator: convex_values0.VObject<{
|
|
|
113
111
|
mode?: "sensitive" | "insensitive" | undefined;
|
|
114
112
|
connector?: "AND" | "OR" | undefined;
|
|
115
113
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
116
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
117
114
|
field: string;
|
|
115
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
118
116
|
}, {
|
|
119
117
|
connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
|
|
120
118
|
field: convex_values0.VString<string, "required">;
|
|
121
119
|
mode: convex_values0.VUnion<"sensitive" | "insensitive" | undefined, [convex_values0.VLiteral<"sensitive", "required">, convex_values0.VLiteral<"insensitive", "required">], "optional", never>;
|
|
122
120
|
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>;
|
|
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
|
-
}, "required", "mode" | "
|
|
122
|
+
}, "required", "mode" | "connector" | "field" | "operator" | "value">;
|
|
125
123
|
declare const adapterArgsValidator: convex_values0.VObject<{
|
|
126
|
-
|
|
124
|
+
limit?: number | undefined;
|
|
127
125
|
where?: {
|
|
128
126
|
mode?: "sensitive" | "insensitive" | undefined;
|
|
129
127
|
connector?: "AND" | "OR" | undefined;
|
|
130
128
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
131
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
132
129
|
field: string;
|
|
130
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
133
131
|
}[] | undefined;
|
|
134
|
-
limit?: number | undefined;
|
|
135
132
|
offset?: number | undefined;
|
|
133
|
+
select?: string[] | undefined;
|
|
136
134
|
sortBy?: {
|
|
137
135
|
field: string;
|
|
138
136
|
direction: "asc" | "desc";
|
|
@@ -154,22 +152,22 @@ declare const adapterArgsValidator: convex_values0.VObject<{
|
|
|
154
152
|
mode?: "sensitive" | "insensitive" | undefined;
|
|
155
153
|
connector?: "AND" | "OR" | undefined;
|
|
156
154
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
157
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
158
155
|
field: string;
|
|
156
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
159
157
|
}[] | undefined, convex_values0.VObject<{
|
|
160
158
|
mode?: "sensitive" | "insensitive" | undefined;
|
|
161
159
|
connector?: "AND" | "OR" | undefined;
|
|
162
160
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
163
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
164
161
|
field: string;
|
|
162
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
165
163
|
}, {
|
|
166
164
|
connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
|
|
167
165
|
field: convex_values0.VString<string, "required">;
|
|
168
166
|
mode: convex_values0.VUnion<"sensitive" | "insensitive" | undefined, [convex_values0.VLiteral<"sensitive", "required">, convex_values0.VLiteral<"insensitive", "required">], "optional", never>;
|
|
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
|
-
}, "required", "mode" | "
|
|
172
|
-
}, "required", "
|
|
169
|
+
}, "required", "mode" | "connector" | "field" | "operator" | "value">, "optional">;
|
|
170
|
+
}, "required", "limit" | "model" | "where" | "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: (
|
|
398
|
-
handler:
|
|
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
|
-
},
|
|
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: (
|
|
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 };
|