@auth/drizzle-adapter 0.0.0-manual.4331e59d → 0.0.0-manual.acabcfb4
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/README.md +1 -1
- package/index.d.ts +16 -12
- package/index.d.ts.map +1 -1
- package/index.js +29 -23
- package/lib/mysql.d.ts +26 -244
- package/lib/mysql.d.ts.map +1 -1
- package/lib/mysql.js +69 -65
- package/lib/pg.d.ts +26 -244
- package/lib/pg.d.ts.map +1 -1
- package/lib/pg.js +59 -56
- package/lib/sqlite.d.ts +26 -244
- package/lib/sqlite.d.ts.map +1 -1
- package/lib/sqlite.js +59 -56
- package/lib/utils.d.ts +7 -9
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +1 -12
- package/package.json +3 -3
- package/src/index.ts +35 -31
- package/src/lib/mysql.ts +83 -74
- package/src/lib/pg.ts +72 -64
- package/src/lib/sqlite.ts +69 -61
- package/src/lib/utils.ts +13 -19
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<img height="64px" src="https://authjs.dev/img/logo/logo-sm.png" />
|
|
5
5
|
</a>
|
|
6
6
|
<a href="https://github.com/drizzle-team/drizzle-orm" target="_blank">
|
|
7
|
-
<img height="64px" src="https://
|
|
7
|
+
<img height="64px" src="https://authjs.dev/img/adapters/drizzle-orm.png"/>
|
|
8
8
|
</a>
|
|
9
9
|
<h3 align="center"><b>Drizzle ORM Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
|
10
10
|
<p align="center" style="align: center;">
|
package/index.d.ts
CHANGED
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
*
|
|
16
16
|
* @module @auth/drizzle-adapter
|
|
17
17
|
*/
|
|
18
|
-
import { SqlFlavorOptions } from "./lib/utils";
|
|
18
|
+
import { SqlFlavorOptions, TableFn } from "./lib/utils.js";
|
|
19
19
|
import type { Adapter } from "@auth/core/adapters";
|
|
20
20
|
/**
|
|
21
|
-
* Add the adapter to your `
|
|
21
|
+
* Add the adapter to your `pages/api/[...nextauth].ts` next-auth configuration object.
|
|
22
22
|
*
|
|
23
23
|
* ```ts title="pages/api/auth/[...nextauth].ts"
|
|
24
24
|
* import NextAuth from "next-auth"
|
|
@@ -37,6 +37,10 @@ import type { Adapter } from "@auth/core/adapters";
|
|
|
37
37
|
* })
|
|
38
38
|
* ```
|
|
39
39
|
*
|
|
40
|
+
* :::info
|
|
41
|
+
* If you're using multi-project schemas, you can pass your table function as a second argument
|
|
42
|
+
* :::
|
|
43
|
+
*
|
|
40
44
|
* ## Setup
|
|
41
45
|
*
|
|
42
46
|
* First, create a schema that includes [the minimum requirements for a `next-auth` adapter](/reference/adapters#models). You can select your favorite SQL flavor below and copy it.
|
|
@@ -58,7 +62,7 @@ import type { Adapter } from "@auth/core/adapters";
|
|
|
58
62
|
* } from "drizzle-orm/pg-core"
|
|
59
63
|
* import type { AdapterAccount } from '@auth/core/adapters'
|
|
60
64
|
*
|
|
61
|
-
* export const users = pgTable("
|
|
65
|
+
* export const users = pgTable("user", {
|
|
62
66
|
* id: text("id").notNull().primaryKey(),
|
|
63
67
|
* name: text("name"),
|
|
64
68
|
* email: text("email").notNull(),
|
|
@@ -67,7 +71,7 @@ import type { Adapter } from "@auth/core/adapters";
|
|
|
67
71
|
* })
|
|
68
72
|
*
|
|
69
73
|
* export const accounts = pgTable(
|
|
70
|
-
* "
|
|
74
|
+
* "account",
|
|
71
75
|
* {
|
|
72
76
|
* userId: text("userId")
|
|
73
77
|
* .notNull()
|
|
@@ -88,7 +92,7 @@ import type { Adapter } from "@auth/core/adapters";
|
|
|
88
92
|
* })
|
|
89
93
|
* )
|
|
90
94
|
*
|
|
91
|
-
* export const sessions = pgTable("
|
|
95
|
+
* export const sessions = pgTable("session", {
|
|
92
96
|
* sessionToken: text("sessionToken").notNull().primaryKey(),
|
|
93
97
|
* userId: text("userId")
|
|
94
98
|
* .notNull()
|
|
@@ -121,7 +125,7 @@ import type { Adapter } from "@auth/core/adapters";
|
|
|
121
125
|
* } from "drizzle-orm/mysql-core"
|
|
122
126
|
* import type { AdapterAccount } from "@auth/core/adapters"
|
|
123
127
|
*
|
|
124
|
-
* export const users = mysqlTable("
|
|
128
|
+
* export const users = mysqlTable("user", {
|
|
125
129
|
* id: varchar("id", { length: 255 }).notNull().primaryKey(),
|
|
126
130
|
* name: varchar("name", { length: 255 }),
|
|
127
131
|
* email: varchar("email", { length: 255 }).notNull(),
|
|
@@ -130,7 +134,7 @@ import type { Adapter } from "@auth/core/adapters";
|
|
|
130
134
|
* })
|
|
131
135
|
*
|
|
132
136
|
* export const accounts = mysqlTable(
|
|
133
|
-
* "
|
|
137
|
+
* "account",
|
|
134
138
|
* {
|
|
135
139
|
* userId: varchar("userId", { length: 255 })
|
|
136
140
|
* .notNull()
|
|
@@ -151,7 +155,7 @@ import type { Adapter } from "@auth/core/adapters";
|
|
|
151
155
|
* })
|
|
152
156
|
* )
|
|
153
157
|
*
|
|
154
|
-
* export const sessions = mysqlTable("
|
|
158
|
+
* export const sessions = mysqlTable("session", {
|
|
155
159
|
* sessionToken: varchar("sessionToken", { length: 255 }).notNull().primaryKey(),
|
|
156
160
|
* userId: varchar("userId", { length: 255 })
|
|
157
161
|
* .notNull()
|
|
@@ -178,7 +182,7 @@ import type { Adapter } from "@auth/core/adapters";
|
|
|
178
182
|
* import { integer, sqliteTable, text, primaryKey } from "drizzle-orm/sqlite-core"
|
|
179
183
|
* import type { AdapterAccount } from "@auth/core/adapters"
|
|
180
184
|
*
|
|
181
|
-
* export const users = sqliteTable("
|
|
185
|
+
* export const users = sqliteTable("user", {
|
|
182
186
|
* id: text("id").notNull().primaryKey(),
|
|
183
187
|
* name: text("name"),
|
|
184
188
|
* email: text("email").notNull(),
|
|
@@ -187,7 +191,7 @@ import type { Adapter } from "@auth/core/adapters";
|
|
|
187
191
|
* })
|
|
188
192
|
*
|
|
189
193
|
* export const accounts = sqliteTable(
|
|
190
|
-
* "
|
|
194
|
+
* "account",
|
|
191
195
|
* {
|
|
192
196
|
* userId: text("userId")
|
|
193
197
|
* .notNull()
|
|
@@ -208,7 +212,7 @@ import type { Adapter } from "@auth/core/adapters";
|
|
|
208
212
|
* })
|
|
209
213
|
* )
|
|
210
214
|
*
|
|
211
|
-
* export const sessions = sqliteTable("
|
|
215
|
+
* export const sessions = sqliteTable("session", {
|
|
212
216
|
* sessionToken: text("sessionToken").notNull().primaryKey(),
|
|
213
217
|
* userId: text("userId")
|
|
214
218
|
* .notNull()
|
|
@@ -237,5 +241,5 @@ import type { Adapter } from "@auth/core/adapters";
|
|
|
237
241
|
* ---
|
|
238
242
|
*
|
|
239
243
|
**/
|
|
240
|
-
export declare function DrizzleAdapter<SqlFlavor extends SqlFlavorOptions>(db: SqlFlavor): Adapter;
|
|
244
|
+
export declare function DrizzleAdapter<SqlFlavor extends SqlFlavorOptions>(db: SqlFlavor, table?: TableFn<SqlFlavor>): Adapter;
|
|
241
245
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAWH,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAG1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA+NI;AACJ,wBAAgB,cAAc,CAAC,SAAS,SAAS,gBAAgB,EAC/D,EAAE,EAAE,SAAS,EACb,KAAK,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,GACzB,OAAO,CAYT"}
|
package/index.js
CHANGED
|
@@ -15,12 +15,15 @@
|
|
|
15
15
|
*
|
|
16
16
|
* @module @auth/drizzle-adapter
|
|
17
17
|
*/
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
18
|
+
import { MySqlDatabase } from "drizzle-orm/mysql-core/index.js";
|
|
19
|
+
import { PgDatabase } from "drizzle-orm/pg-core/index.js";
|
|
20
|
+
import { BaseSQLiteDatabase, } from "drizzle-orm/sqlite-core/index.js";
|
|
21
|
+
import { mySqlDrizzleAdapter } from "./lib/mysql.js";
|
|
22
|
+
import { pgDrizzleAdapter } from "./lib/pg.js";
|
|
23
|
+
import { SQLiteDrizzleAdapter } from "./lib/sqlite.js";
|
|
24
|
+
import { is } from "drizzle-orm";
|
|
22
25
|
/**
|
|
23
|
-
* Add the adapter to your `
|
|
26
|
+
* Add the adapter to your `pages/api/[...nextauth].ts` next-auth configuration object.
|
|
24
27
|
*
|
|
25
28
|
* ```ts title="pages/api/auth/[...nextauth].ts"
|
|
26
29
|
* import NextAuth from "next-auth"
|
|
@@ -39,6 +42,10 @@ import { isMySqlDatabase, isPgDatabase, isSQLiteDatabase, } from "./lib/utils";
|
|
|
39
42
|
* })
|
|
40
43
|
* ```
|
|
41
44
|
*
|
|
45
|
+
* :::info
|
|
46
|
+
* If you're using multi-project schemas, you can pass your table function as a second argument
|
|
47
|
+
* :::
|
|
48
|
+
*
|
|
42
49
|
* ## Setup
|
|
43
50
|
*
|
|
44
51
|
* First, create a schema that includes [the minimum requirements for a `next-auth` adapter](/reference/adapters#models). You can select your favorite SQL flavor below and copy it.
|
|
@@ -60,7 +67,7 @@ import { isMySqlDatabase, isPgDatabase, isSQLiteDatabase, } from "./lib/utils";
|
|
|
60
67
|
* } from "drizzle-orm/pg-core"
|
|
61
68
|
* import type { AdapterAccount } from '@auth/core/adapters'
|
|
62
69
|
*
|
|
63
|
-
* export const users = pgTable("
|
|
70
|
+
* export const users = pgTable("user", {
|
|
64
71
|
* id: text("id").notNull().primaryKey(),
|
|
65
72
|
* name: text("name"),
|
|
66
73
|
* email: text("email").notNull(),
|
|
@@ -69,7 +76,7 @@ import { isMySqlDatabase, isPgDatabase, isSQLiteDatabase, } from "./lib/utils";
|
|
|
69
76
|
* })
|
|
70
77
|
*
|
|
71
78
|
* export const accounts = pgTable(
|
|
72
|
-
* "
|
|
79
|
+
* "account",
|
|
73
80
|
* {
|
|
74
81
|
* userId: text("userId")
|
|
75
82
|
* .notNull()
|
|
@@ -90,7 +97,7 @@ import { isMySqlDatabase, isPgDatabase, isSQLiteDatabase, } from "./lib/utils";
|
|
|
90
97
|
* })
|
|
91
98
|
* )
|
|
92
99
|
*
|
|
93
|
-
* export const sessions = pgTable("
|
|
100
|
+
* export const sessions = pgTable("session", {
|
|
94
101
|
* sessionToken: text("sessionToken").notNull().primaryKey(),
|
|
95
102
|
* userId: text("userId")
|
|
96
103
|
* .notNull()
|
|
@@ -123,7 +130,7 @@ import { isMySqlDatabase, isPgDatabase, isSQLiteDatabase, } from "./lib/utils";
|
|
|
123
130
|
* } from "drizzle-orm/mysql-core"
|
|
124
131
|
* import type { AdapterAccount } from "@auth/core/adapters"
|
|
125
132
|
*
|
|
126
|
-
* export const users = mysqlTable("
|
|
133
|
+
* export const users = mysqlTable("user", {
|
|
127
134
|
* id: varchar("id", { length: 255 }).notNull().primaryKey(),
|
|
128
135
|
* name: varchar("name", { length: 255 }),
|
|
129
136
|
* email: varchar("email", { length: 255 }).notNull(),
|
|
@@ -132,7 +139,7 @@ import { isMySqlDatabase, isPgDatabase, isSQLiteDatabase, } from "./lib/utils";
|
|
|
132
139
|
* })
|
|
133
140
|
*
|
|
134
141
|
* export const accounts = mysqlTable(
|
|
135
|
-
* "
|
|
142
|
+
* "account",
|
|
136
143
|
* {
|
|
137
144
|
* userId: varchar("userId", { length: 255 })
|
|
138
145
|
* .notNull()
|
|
@@ -153,7 +160,7 @@ import { isMySqlDatabase, isPgDatabase, isSQLiteDatabase, } from "./lib/utils";
|
|
|
153
160
|
* })
|
|
154
161
|
* )
|
|
155
162
|
*
|
|
156
|
-
* export const sessions = mysqlTable("
|
|
163
|
+
* export const sessions = mysqlTable("session", {
|
|
157
164
|
* sessionToken: varchar("sessionToken", { length: 255 }).notNull().primaryKey(),
|
|
158
165
|
* userId: varchar("userId", { length: 255 })
|
|
159
166
|
* .notNull()
|
|
@@ -180,7 +187,7 @@ import { isMySqlDatabase, isPgDatabase, isSQLiteDatabase, } from "./lib/utils";
|
|
|
180
187
|
* import { integer, sqliteTable, text, primaryKey } from "drizzle-orm/sqlite-core"
|
|
181
188
|
* import type { AdapterAccount } from "@auth/core/adapters"
|
|
182
189
|
*
|
|
183
|
-
* export const users = sqliteTable("
|
|
190
|
+
* export const users = sqliteTable("user", {
|
|
184
191
|
* id: text("id").notNull().primaryKey(),
|
|
185
192
|
* name: text("name"),
|
|
186
193
|
* email: text("email").notNull(),
|
|
@@ -189,7 +196,7 @@ import { isMySqlDatabase, isPgDatabase, isSQLiteDatabase, } from "./lib/utils";
|
|
|
189
196
|
* })
|
|
190
197
|
*
|
|
191
198
|
* export const accounts = sqliteTable(
|
|
192
|
-
* "
|
|
199
|
+
* "account",
|
|
193
200
|
* {
|
|
194
201
|
* userId: text("userId")
|
|
195
202
|
* .notNull()
|
|
@@ -210,7 +217,7 @@ import { isMySqlDatabase, isPgDatabase, isSQLiteDatabase, } from "./lib/utils";
|
|
|
210
217
|
* })
|
|
211
218
|
* )
|
|
212
219
|
*
|
|
213
|
-
* export const sessions = sqliteTable("
|
|
220
|
+
* export const sessions = sqliteTable("session", {
|
|
214
221
|
* sessionToken: text("sessionToken").notNull().primaryKey(),
|
|
215
222
|
* userId: text("userId")
|
|
216
223
|
* .notNull()
|
|
@@ -239,16 +246,15 @@ import { isMySqlDatabase, isPgDatabase, isSQLiteDatabase, } from "./lib/utils";
|
|
|
239
246
|
* ---
|
|
240
247
|
*
|
|
241
248
|
**/
|
|
242
|
-
export function DrizzleAdapter(db) {
|
|
243
|
-
if (
|
|
244
|
-
|
|
245
|
-
return mySqlDrizzleAdapter(db);
|
|
249
|
+
export function DrizzleAdapter(db, table) {
|
|
250
|
+
if (is(db, MySqlDatabase)) {
|
|
251
|
+
return mySqlDrizzleAdapter(db, table);
|
|
246
252
|
}
|
|
247
|
-
if (
|
|
248
|
-
return pgDrizzleAdapter(db);
|
|
253
|
+
else if (is(db, PgDatabase)) {
|
|
254
|
+
return pgDrizzleAdapter(db, table);
|
|
249
255
|
}
|
|
250
|
-
if (
|
|
251
|
-
return SQLiteDrizzleAdapter(db);
|
|
256
|
+
else if (is(db, BaseSQLiteDatabase)) {
|
|
257
|
+
return SQLiteDrizzleAdapter(db, table);
|
|
252
258
|
}
|
|
253
|
-
throw new Error(
|
|
259
|
+
throw new Error(`Unsupported database type (${typeof db}) in Auth.js Drizzle adapter.`);
|
|
254
260
|
}
|
package/lib/mysql.d.ts
CHANGED
|
@@ -1,230 +1,12 @@
|
|
|
1
|
+
import { MySqlTableFn, MySqlDatabase } from "drizzle-orm/mysql-core";
|
|
1
2
|
import type { Adapter } from "@auth/core/adapters";
|
|
2
|
-
|
|
3
|
-
export declare const users: import("drizzle-orm/select.types.d-b947a018").aw<{
|
|
4
|
-
name: "users";
|
|
5
|
-
schema: undefined;
|
|
6
|
-
columns: {
|
|
7
|
-
id: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
8
|
-
tableName: "users";
|
|
9
|
-
enumValues: [string, ...string[]];
|
|
10
|
-
name: "id";
|
|
11
|
-
data: string;
|
|
12
|
-
driverParam: string | number;
|
|
13
|
-
hasDefault: false;
|
|
14
|
-
notNull: true;
|
|
15
|
-
}>;
|
|
16
|
-
name: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
17
|
-
tableName: "users";
|
|
18
|
-
name: "name";
|
|
19
|
-
data: string;
|
|
20
|
-
driverParam: string | number;
|
|
21
|
-
enumValues: [string, ...string[]];
|
|
22
|
-
notNull: false;
|
|
23
|
-
hasDefault: false;
|
|
24
|
-
}>;
|
|
25
|
-
email: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
26
|
-
tableName: "users";
|
|
27
|
-
enumValues: [string, ...string[]];
|
|
28
|
-
name: "email";
|
|
29
|
-
data: string;
|
|
30
|
-
driverParam: string | number;
|
|
31
|
-
hasDefault: false;
|
|
32
|
-
notNull: true;
|
|
33
|
-
}>;
|
|
34
|
-
emailVerified: import("drizzle-orm/mysql-core").MySqlTimestamp<{
|
|
35
|
-
tableName: "users";
|
|
36
|
-
name: "emailVerified";
|
|
37
|
-
data: Date;
|
|
38
|
-
driverParam: string | number;
|
|
39
|
-
notNull: false;
|
|
40
|
-
hasDefault: true;
|
|
41
|
-
}>;
|
|
42
|
-
image: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
43
|
-
tableName: "users";
|
|
44
|
-
name: "image";
|
|
45
|
-
data: string;
|
|
46
|
-
driverParam: string | number;
|
|
47
|
-
enumValues: [string, ...string[]];
|
|
48
|
-
notNull: false;
|
|
49
|
-
hasDefault: false;
|
|
50
|
-
}>;
|
|
51
|
-
};
|
|
52
|
-
}>;
|
|
53
|
-
export declare const accounts: import("drizzle-orm/select.types.d-b947a018").aw<{
|
|
54
|
-
name: "accounts";
|
|
55
|
-
schema: undefined;
|
|
56
|
-
columns: {
|
|
57
|
-
userId: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
58
|
-
tableName: "accounts";
|
|
59
|
-
enumValues: [string, ...string[]];
|
|
60
|
-
name: "userId";
|
|
61
|
-
data: string;
|
|
62
|
-
driverParam: string | number;
|
|
63
|
-
hasDefault: false;
|
|
64
|
-
notNull: true;
|
|
65
|
-
}>;
|
|
66
|
-
type: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
67
|
-
tableName: "accounts";
|
|
68
|
-
enumValues: [string, ...string[]];
|
|
69
|
-
name: "type";
|
|
70
|
-
data: "email" | "oidc" | "oauth";
|
|
71
|
-
driverParam: string | number;
|
|
72
|
-
hasDefault: false;
|
|
73
|
-
notNull: true;
|
|
74
|
-
}>;
|
|
75
|
-
provider: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
76
|
-
tableName: "accounts";
|
|
77
|
-
enumValues: [string, ...string[]];
|
|
78
|
-
name: "provider";
|
|
79
|
-
data: string;
|
|
80
|
-
driverParam: string | number;
|
|
81
|
-
hasDefault: false;
|
|
82
|
-
notNull: true;
|
|
83
|
-
}>;
|
|
84
|
-
providerAccountId: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
85
|
-
tableName: "accounts";
|
|
86
|
-
enumValues: [string, ...string[]];
|
|
87
|
-
name: "providerAccountId";
|
|
88
|
-
data: string;
|
|
89
|
-
driverParam: string | number;
|
|
90
|
-
hasDefault: false;
|
|
91
|
-
notNull: true;
|
|
92
|
-
}>;
|
|
93
|
-
refresh_token: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
94
|
-
tableName: "accounts";
|
|
95
|
-
name: "refresh_token";
|
|
96
|
-
data: string;
|
|
97
|
-
driverParam: string | number;
|
|
98
|
-
enumValues: [string, ...string[]];
|
|
99
|
-
notNull: false;
|
|
100
|
-
hasDefault: false;
|
|
101
|
-
}>;
|
|
102
|
-
access_token: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
103
|
-
tableName: "accounts";
|
|
104
|
-
name: "access_token";
|
|
105
|
-
data: string;
|
|
106
|
-
driverParam: string | number;
|
|
107
|
-
enumValues: [string, ...string[]];
|
|
108
|
-
notNull: false;
|
|
109
|
-
hasDefault: false;
|
|
110
|
-
}>;
|
|
111
|
-
expires_at: import("drizzle-orm/mysql-core").MySqlInt<{
|
|
112
|
-
tableName: "accounts";
|
|
113
|
-
name: "expires_at";
|
|
114
|
-
data: number;
|
|
115
|
-
driverParam: string | number;
|
|
116
|
-
notNull: false;
|
|
117
|
-
hasDefault: false;
|
|
118
|
-
}>;
|
|
119
|
-
token_type: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
120
|
-
tableName: "accounts";
|
|
121
|
-
name: "token_type";
|
|
122
|
-
data: string;
|
|
123
|
-
driverParam: string | number;
|
|
124
|
-
enumValues: [string, ...string[]];
|
|
125
|
-
notNull: false;
|
|
126
|
-
hasDefault: false;
|
|
127
|
-
}>;
|
|
128
|
-
scope: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
129
|
-
tableName: "accounts";
|
|
130
|
-
name: "scope";
|
|
131
|
-
data: string;
|
|
132
|
-
driverParam: string | number;
|
|
133
|
-
enumValues: [string, ...string[]];
|
|
134
|
-
notNull: false;
|
|
135
|
-
hasDefault: false;
|
|
136
|
-
}>;
|
|
137
|
-
id_token: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
138
|
-
tableName: "accounts";
|
|
139
|
-
name: "id_token";
|
|
140
|
-
data: string;
|
|
141
|
-
driverParam: string | number;
|
|
142
|
-
enumValues: [string, ...string[]];
|
|
143
|
-
notNull: false;
|
|
144
|
-
hasDefault: false;
|
|
145
|
-
}>;
|
|
146
|
-
session_state: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
147
|
-
tableName: "accounts";
|
|
148
|
-
name: "session_state";
|
|
149
|
-
data: string;
|
|
150
|
-
driverParam: string | number;
|
|
151
|
-
enumValues: [string, ...string[]];
|
|
152
|
-
notNull: false;
|
|
153
|
-
hasDefault: false;
|
|
154
|
-
}>;
|
|
155
|
-
};
|
|
156
|
-
}>;
|
|
157
|
-
export declare const sessions: import("drizzle-orm/select.types.d-b947a018").aw<{
|
|
158
|
-
name: "sessions";
|
|
159
|
-
schema: undefined;
|
|
160
|
-
columns: {
|
|
161
|
-
sessionToken: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
162
|
-
tableName: "sessions";
|
|
163
|
-
enumValues: [string, ...string[]];
|
|
164
|
-
name: "sessionToken";
|
|
165
|
-
data: string;
|
|
166
|
-
driverParam: string | number;
|
|
167
|
-
hasDefault: false;
|
|
168
|
-
notNull: true;
|
|
169
|
-
}>;
|
|
170
|
-
userId: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
171
|
-
tableName: "sessions";
|
|
172
|
-
enumValues: [string, ...string[]];
|
|
173
|
-
name: "userId";
|
|
174
|
-
data: string;
|
|
175
|
-
driverParam: string | number;
|
|
176
|
-
hasDefault: false;
|
|
177
|
-
notNull: true;
|
|
178
|
-
}>;
|
|
179
|
-
expires: import("drizzle-orm/mysql-core").MySqlTimestamp<{
|
|
180
|
-
tableName: "sessions";
|
|
181
|
-
name: "expires";
|
|
182
|
-
data: Date;
|
|
183
|
-
driverParam: string | number;
|
|
184
|
-
hasDefault: false;
|
|
185
|
-
notNull: true;
|
|
186
|
-
}>;
|
|
187
|
-
};
|
|
188
|
-
}>;
|
|
189
|
-
export declare const verificationTokens: import("drizzle-orm/select.types.d-b947a018").aw<{
|
|
190
|
-
name: "verificationToken";
|
|
191
|
-
schema: undefined;
|
|
192
|
-
columns: {
|
|
193
|
-
identifier: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
194
|
-
tableName: "verificationToken";
|
|
195
|
-
enumValues: [string, ...string[]];
|
|
196
|
-
name: "identifier";
|
|
197
|
-
data: string;
|
|
198
|
-
driverParam: string | number;
|
|
199
|
-
hasDefault: false;
|
|
200
|
-
notNull: true;
|
|
201
|
-
}>;
|
|
202
|
-
token: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
203
|
-
tableName: "verificationToken";
|
|
204
|
-
enumValues: [string, ...string[]];
|
|
205
|
-
name: "token";
|
|
206
|
-
data: string;
|
|
207
|
-
driverParam: string | number;
|
|
208
|
-
hasDefault: false;
|
|
209
|
-
notNull: true;
|
|
210
|
-
}>;
|
|
211
|
-
expires: import("drizzle-orm/mysql-core").MySqlTimestamp<{
|
|
212
|
-
tableName: "verificationToken";
|
|
213
|
-
name: "expires";
|
|
214
|
-
data: Date;
|
|
215
|
-
driverParam: string | number;
|
|
216
|
-
hasDefault: false;
|
|
217
|
-
notNull: true;
|
|
218
|
-
}>;
|
|
219
|
-
};
|
|
220
|
-
}>;
|
|
221
|
-
export declare const schema: {
|
|
3
|
+
export declare function createTables(mySqlTable: MySqlTableFn): {
|
|
222
4
|
users: import("drizzle-orm/select.types.d-b947a018").aw<{
|
|
223
|
-
name: "
|
|
5
|
+
name: "user";
|
|
224
6
|
schema: undefined;
|
|
225
7
|
columns: {
|
|
226
8
|
id: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
227
|
-
tableName: "
|
|
9
|
+
tableName: "user";
|
|
228
10
|
enumValues: [string, ...string[]];
|
|
229
11
|
name: "id";
|
|
230
12
|
data: string;
|
|
@@ -233,7 +15,7 @@ export declare const schema: {
|
|
|
233
15
|
notNull: true;
|
|
234
16
|
}>;
|
|
235
17
|
name: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
236
|
-
tableName: "
|
|
18
|
+
tableName: "user";
|
|
237
19
|
name: "name";
|
|
238
20
|
data: string;
|
|
239
21
|
driverParam: string | number;
|
|
@@ -242,7 +24,7 @@ export declare const schema: {
|
|
|
242
24
|
hasDefault: false;
|
|
243
25
|
}>;
|
|
244
26
|
email: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
245
|
-
tableName: "
|
|
27
|
+
tableName: "user";
|
|
246
28
|
enumValues: [string, ...string[]];
|
|
247
29
|
name: "email";
|
|
248
30
|
data: string;
|
|
@@ -251,7 +33,7 @@ export declare const schema: {
|
|
|
251
33
|
notNull: true;
|
|
252
34
|
}>;
|
|
253
35
|
emailVerified: import("drizzle-orm/mysql-core").MySqlTimestamp<{
|
|
254
|
-
tableName: "
|
|
36
|
+
tableName: "user";
|
|
255
37
|
name: "emailVerified";
|
|
256
38
|
data: Date;
|
|
257
39
|
driverParam: string | number;
|
|
@@ -259,7 +41,7 @@ export declare const schema: {
|
|
|
259
41
|
hasDefault: true;
|
|
260
42
|
}>;
|
|
261
43
|
image: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
262
|
-
tableName: "
|
|
44
|
+
tableName: "user";
|
|
263
45
|
name: "image";
|
|
264
46
|
data: string;
|
|
265
47
|
driverParam: string | number;
|
|
@@ -270,11 +52,11 @@ export declare const schema: {
|
|
|
270
52
|
};
|
|
271
53
|
}>;
|
|
272
54
|
accounts: import("drizzle-orm/select.types.d-b947a018").aw<{
|
|
273
|
-
name: "
|
|
55
|
+
name: "account";
|
|
274
56
|
schema: undefined;
|
|
275
57
|
columns: {
|
|
276
58
|
userId: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
277
|
-
tableName: "
|
|
59
|
+
tableName: "account";
|
|
278
60
|
enumValues: [string, ...string[]];
|
|
279
61
|
name: "userId";
|
|
280
62
|
data: string;
|
|
@@ -283,7 +65,7 @@ export declare const schema: {
|
|
|
283
65
|
notNull: true;
|
|
284
66
|
}>;
|
|
285
67
|
type: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
286
|
-
tableName: "
|
|
68
|
+
tableName: "account";
|
|
287
69
|
enumValues: [string, ...string[]];
|
|
288
70
|
name: "type";
|
|
289
71
|
data: "email" | "oidc" | "oauth";
|
|
@@ -292,7 +74,7 @@ export declare const schema: {
|
|
|
292
74
|
notNull: true;
|
|
293
75
|
}>;
|
|
294
76
|
provider: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
295
|
-
tableName: "
|
|
77
|
+
tableName: "account";
|
|
296
78
|
enumValues: [string, ...string[]];
|
|
297
79
|
name: "provider";
|
|
298
80
|
data: string;
|
|
@@ -301,7 +83,7 @@ export declare const schema: {
|
|
|
301
83
|
notNull: true;
|
|
302
84
|
}>;
|
|
303
85
|
providerAccountId: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
304
|
-
tableName: "
|
|
86
|
+
tableName: "account";
|
|
305
87
|
enumValues: [string, ...string[]];
|
|
306
88
|
name: "providerAccountId";
|
|
307
89
|
data: string;
|
|
@@ -310,7 +92,7 @@ export declare const schema: {
|
|
|
310
92
|
notNull: true;
|
|
311
93
|
}>;
|
|
312
94
|
refresh_token: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
313
|
-
tableName: "
|
|
95
|
+
tableName: "account";
|
|
314
96
|
name: "refresh_token";
|
|
315
97
|
data: string;
|
|
316
98
|
driverParam: string | number;
|
|
@@ -319,7 +101,7 @@ export declare const schema: {
|
|
|
319
101
|
hasDefault: false;
|
|
320
102
|
}>;
|
|
321
103
|
access_token: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
322
|
-
tableName: "
|
|
104
|
+
tableName: "account";
|
|
323
105
|
name: "access_token";
|
|
324
106
|
data: string;
|
|
325
107
|
driverParam: string | number;
|
|
@@ -328,7 +110,7 @@ export declare const schema: {
|
|
|
328
110
|
hasDefault: false;
|
|
329
111
|
}>;
|
|
330
112
|
expires_at: import("drizzle-orm/mysql-core").MySqlInt<{
|
|
331
|
-
tableName: "
|
|
113
|
+
tableName: "account";
|
|
332
114
|
name: "expires_at";
|
|
333
115
|
data: number;
|
|
334
116
|
driverParam: string | number;
|
|
@@ -336,7 +118,7 @@ export declare const schema: {
|
|
|
336
118
|
hasDefault: false;
|
|
337
119
|
}>;
|
|
338
120
|
token_type: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
339
|
-
tableName: "
|
|
121
|
+
tableName: "account";
|
|
340
122
|
name: "token_type";
|
|
341
123
|
data: string;
|
|
342
124
|
driverParam: string | number;
|
|
@@ -345,7 +127,7 @@ export declare const schema: {
|
|
|
345
127
|
hasDefault: false;
|
|
346
128
|
}>;
|
|
347
129
|
scope: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
348
|
-
tableName: "
|
|
130
|
+
tableName: "account";
|
|
349
131
|
name: "scope";
|
|
350
132
|
data: string;
|
|
351
133
|
driverParam: string | number;
|
|
@@ -354,7 +136,7 @@ export declare const schema: {
|
|
|
354
136
|
hasDefault: false;
|
|
355
137
|
}>;
|
|
356
138
|
id_token: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
357
|
-
tableName: "
|
|
139
|
+
tableName: "account";
|
|
358
140
|
name: "id_token";
|
|
359
141
|
data: string;
|
|
360
142
|
driverParam: string | number;
|
|
@@ -363,7 +145,7 @@ export declare const schema: {
|
|
|
363
145
|
hasDefault: false;
|
|
364
146
|
}>;
|
|
365
147
|
session_state: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
366
|
-
tableName: "
|
|
148
|
+
tableName: "account";
|
|
367
149
|
name: "session_state";
|
|
368
150
|
data: string;
|
|
369
151
|
driverParam: string | number;
|
|
@@ -374,11 +156,11 @@ export declare const schema: {
|
|
|
374
156
|
};
|
|
375
157
|
}>;
|
|
376
158
|
sessions: import("drizzle-orm/select.types.d-b947a018").aw<{
|
|
377
|
-
name: "
|
|
159
|
+
name: "session";
|
|
378
160
|
schema: undefined;
|
|
379
161
|
columns: {
|
|
380
162
|
sessionToken: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
381
|
-
tableName: "
|
|
163
|
+
tableName: "session";
|
|
382
164
|
enumValues: [string, ...string[]];
|
|
383
165
|
name: "sessionToken";
|
|
384
166
|
data: string;
|
|
@@ -387,7 +169,7 @@ export declare const schema: {
|
|
|
387
169
|
notNull: true;
|
|
388
170
|
}>;
|
|
389
171
|
userId: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
390
|
-
tableName: "
|
|
172
|
+
tableName: "session";
|
|
391
173
|
enumValues: [string, ...string[]];
|
|
392
174
|
name: "userId";
|
|
393
175
|
data: string;
|
|
@@ -396,7 +178,7 @@ export declare const schema: {
|
|
|
396
178
|
notNull: true;
|
|
397
179
|
}>;
|
|
398
180
|
expires: import("drizzle-orm/mysql-core").MySqlTimestamp<{
|
|
399
|
-
tableName: "
|
|
181
|
+
tableName: "session";
|
|
400
182
|
name: "expires";
|
|
401
183
|
data: Date;
|
|
402
184
|
driverParam: string | number;
|
|
@@ -438,6 +220,6 @@ export declare const schema: {
|
|
|
438
220
|
};
|
|
439
221
|
}>;
|
|
440
222
|
};
|
|
441
|
-
export type DefaultSchema = typeof
|
|
442
|
-
export declare function mySqlDrizzleAdapter(client:
|
|
223
|
+
export type DefaultSchema = ReturnType<typeof createTables>;
|
|
224
|
+
export declare function mySqlDrizzleAdapter(client: InstanceType<typeof MySqlDatabase>, tableFn?: MySqlTableFn<undefined>): Adapter;
|
|
443
225
|
//# sourceMappingURL=mysql.d.ts.map
|
package/lib/mysql.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mysql.d.ts","sourceRoot":"","sources":["../src/lib/mysql.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mysql.d.ts","sourceRoot":"","sources":["../src/lib/mysql.ts"],"names":[],"mappings":"AACA,OAAO,EAML,YAAY,EACZ,aAAa,EACd,MAAM,wBAAwB,CAAA;AAE/B,OAAO,KAAK,EAAE,OAAO,EAAkB,MAAM,qBAAqB,CAAA;AAElE,wBAAgB,YAAY,CAAC,UAAU,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6DpD;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAA;AAE3D,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,YAAY,CAAC,OAAO,aAAa,CAAC,EAC1C,OAAO,0BAAsB,GAC5B,OAAO,CAsLT"}
|