@@ -74,38 +74,38 @@ export function SQLiteDrizzleAdapter(
74
74
createTables ( tableFn )
75
75
76
76
return {
77
- createUser ( data ) {
77
+ async createUser ( data ) {
78
78
return client
79
79
. insert ( users )
80
80
. values ( { ...data , id : crypto . randomUUID ( ) } )
81
81
. returning ( )
82
82
. get ( )
83
83
} ,
84
- getUser ( data ) {
85
- return client . select ( ) . from ( users ) . where ( eq ( users . id , data ) ) . get ( ) ?? null
84
+ async getUser ( data ) {
85
+ return ( await client . select ( ) . from ( users ) . where ( eq ( users . id , data ) ) . get ( ) ) ?? null
86
86
} ,
87
- getUserByEmail ( data ) {
87
+ async getUserByEmail ( data ) {
88
88
return (
89
- client . select ( ) . from ( users ) . where ( eq ( users . email , data ) ) . get ( ) ?? null
89
+ ( await client . select ( ) . from ( users ) . where ( eq ( users . email , data ) ) . get ( ) ) ?? null
90
90
)
91
91
} ,
92
- createSession ( data ) {
92
+ async createSession ( data ) {
93
93
return client . insert ( sessions ) . values ( data ) . returning ( ) . get ( )
94
94
} ,
95
- getSessionAndUser ( data ) {
95
+ async getSessionAndUser ( data ) {
96
96
return (
97
- client
97
+ ( await client
98
98
. select ( {
99
99
session : sessions ,
100
100
user : users ,
101
101
} )
102
102
. from ( sessions )
103
103
. where ( eq ( sessions . sessionToken , data ) )
104
104
. innerJoin ( users , eq ( users . id , sessions . userId ) )
105
- . get ( ) ?? null
105
+ . get ( ) ) ?? null
106
106
)
107
107
} ,
108
- updateUser ( data ) {
108
+ async updateUser ( data ) {
109
109
if ( ! data . id ) {
110
110
throw new Error ( "No user id." )
111
111
}
@@ -117,20 +117,20 @@ export function SQLiteDrizzleAdapter(
117
117
. returning ( )
118
118
. get ( )
119
119
} ,
120
- updateSession ( data ) {
120
+ async updateSession ( data ) {
121
121
return client
122
122
. update ( sessions )
123
123
. set ( data )
124
124
. where ( eq ( sessions . sessionToken , data . sessionToken ) )
125
125
. returning ( )
126
126
. get ( )
127
127
} ,
128
- linkAccount ( rawAccount ) {
129
- const updatedAccount = client
128
+ async linkAccount ( rawAccount ) {
129
+ const updatedAccount = await ( client
130
130
. insert ( accounts )
131
131
. values ( rawAccount )
132
132
. returning ( )
133
- . get ( )
133
+ . get ( ) )
134
134
135
135
const account : AdapterAccount = {
136
136
...updatedAccount ,
@@ -146,8 +146,8 @@ export function SQLiteDrizzleAdapter(
146
146
147
147
return account
148
148
} ,
149
- getUserByAccount ( account ) {
150
- const results = client
149
+ async getUserByAccount ( account ) {
150
+ const results = await ( client
151
151
. select ( )
152
152
. from ( accounts )
153
153
. leftJoin ( users , eq ( users . id , accounts . userId ) )
@@ -157,26 +157,26 @@ export function SQLiteDrizzleAdapter(
157
157
eq ( accounts . providerAccountId , account . providerAccountId )
158
158
)
159
159
)
160
- . get ( )
160
+ . get ( ) )
161
161
162
162
return results ?. user ?? null
163
163
} ,
164
- deleteSession ( sessionToken ) {
164
+ async deleteSession ( sessionToken ) {
165
165
return (
166
- client
166
+ ( await client
167
167
. delete ( sessions )
168
168
. where ( eq ( sessions . sessionToken , sessionToken ) )
169
169
. returning ( )
170
- . get ( ) ?? null
170
+ . get ( ) ) ?? null
171
171
)
172
172
} ,
173
- createVerificationToken ( token ) {
173
+ async createVerificationToken ( token ) {
174
174
return client . insert ( verificationTokens ) . values ( token ) . returning ( ) . get ( )
175
175
} ,
176
- useVerificationToken ( token ) {
176
+ async useVerificationToken ( token ) {
177
177
try {
178
178
return (
179
- client
179
+ ( await client
180
180
. delete ( verificationTokens )
181
181
. where (
182
182
and (
@@ -185,17 +185,17 @@ export function SQLiteDrizzleAdapter(
185
185
)
186
186
)
187
187
. returning ( )
188
- . get ( ) ?? null
188
+ . get ( ) ) ?? null
189
189
)
190
190
} catch ( err ) {
191
191
throw new Error ( "No verification token found." )
192
192
}
193
193
} ,
194
- deleteUser ( id ) {
194
+ async deleteUser ( id ) {
195
195
return client . delete ( users ) . where ( eq ( users . id , id ) ) . returning ( ) . get ( )
196
196
} ,
197
- unlinkAccount ( account ) {
198
- client
197
+ async unlinkAccount ( account ) {
198
+ await client
199
199
. delete ( accounts )
200
200
. where (
201
201
and (
0 commit comments