Skip to content

Commit 167e185

Browse files
committed
address pr comments
1 parent 6390570 commit 167e185

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

packages/auth-adapters/better-auth/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
"ts-pattern": "catalog:"
4242
},
4343
"peerDependencies": {
44-
"@better-auth/core": "^1.0.0",
45-
"better-auth": "^1.0.0"
44+
"@better-auth/core": "^1.3.0",
45+
"better-auth": "^1.3.0"
4646
},
4747
"devDependencies": {
4848
"@better-auth/core": "^1.3.0",

packages/auth-adapters/better-auth/src/adapter.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,7 @@ export const zenstackAdapter = <Schema extends SchemaDef>(db: ClientContract<Sch
214214
};
215215
};
216216

217-
let adapterOptions: AdapterFactoryOptions | null = null;
218-
adapterOptions = {
217+
const adapterOptions: AdapterFactoryOptions = {
219218
config: {
220219
adapterId: 'zenstack',
221220
adapterName: 'ZenStack Adapter',

packages/auth-adapters/better-auth/src/schema-generator.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import { type BetterAuthOptions } from 'better-auth';
2424
import type { DBAdapterSchemaCreation } from 'better-auth/adapters';
2525
import type { BetterAuthDBSchema, DBFieldAttribute, DBFieldType } from 'better-auth/db';
2626
import fs from 'node:fs';
27-
import path from 'node:path';
2827
import { match } from 'ts-pattern';
2928
import type { AdapterConfig } from './adapter';
3029

@@ -45,7 +44,7 @@ export async function generateSchema(
4544
}
4645
}
4746

48-
const schemaExists = !!(filePath && fs.existsSync(path.join(process.cwd(), filePath)));
47+
const schemaExists = !!(filePath && fs.existsSync(filePath));
4948

5049
const schema = await updateSchema(filePath, tables, config, options);
5150

@@ -234,7 +233,7 @@ function initializeZmodel(config: AdapterConfig) {
234233
config.provider === 'sqlite'
235234
? {
236235
$type: 'StringLiteral',
237-
value: 'file:./test.db',
236+
value: 'file:./dev.db',
238237
$container: urlField,
239238
}
240239
: envCall;
@@ -283,11 +282,11 @@ function addOrUpdateModel(
283282
}
284283

285284
for (const [fName, field] of Object.entries(table.fields)) {
286-
if (dataModel.fields.some((f) => f.name === fName)) {
285+
const fieldName = field.fieldName ?? fName;
286+
if (dataModel.fields.some((f) => f.name === fieldName)) {
287287
continue;
288288
}
289289

290-
const fieldName = field.fieldName ?? fName;
291290
changed = true;
292291

293292
if (!field.references) {

0 commit comments

Comments
 (0)