1+ import type { SqliteDialectConfig } from 'kysely' ;
12import {
23 DefaultConnectionProvider ,
34 DefaultQueryExecutor ,
78 SqliteDialect ,
89 type KyselyProps ,
910 type PostgresDialectConfig ,
10- type SqliteDialectConfig ,
1111} from 'kysely' ;
1212import { match } from 'ts-pattern' ;
1313import type { GetModels , ProcedureDef , SchemaDef } from '../schema' ;
@@ -41,7 +41,7 @@ import { ResultProcessor } from './result-processor';
4141export const ZenStackClient = function < Schema extends SchemaDef > (
4242 this : any ,
4343 schema : any ,
44- options ? : ClientOptions < Schema >
44+ options : ClientOptions < Schema >
4545) {
4646 return new ClientImpl < Schema > ( schema , options ) ;
4747} as unknown as ClientConstructor ;
@@ -56,7 +56,7 @@ export class ClientImpl<Schema extends SchemaDef> {
5656
5757 constructor (
5858 private readonly schema : Schema ,
59- private options ? : ClientOptions < Schema > ,
59+ private options : ClientOptions < Schema > ,
6060 baseClient ?: ClientImpl < Schema >
6161 ) {
6262 this . $schema = schema ;
@@ -140,21 +140,15 @@ export class ClientImpl<Schema extends SchemaDef> {
140140 }
141141
142142 private makePostgresKyselyDialect ( ) : PostgresDialect {
143- const { dialectConfigProvider } = this . schema . provider ;
144- const mergedConfig = {
145- ...dialectConfigProvider ( ) ,
146- ...this . options ?. dialectConfig ,
147- } as PostgresDialectConfig ;
148- return new PostgresDialect ( mergedConfig ) ;
143+ return new PostgresDialect (
144+ this . options . dialectConfig as PostgresDialectConfig
145+ ) ;
149146 }
150147
151148 private makeSqliteKyselyDialect ( ) : SqliteDialect {
152- const { dialectConfigProvider } = this . schema . provider ;
153- const mergedConfig = {
154- ...dialectConfigProvider ( ) ,
155- ...this . options ?. dialectConfig ,
156- } as SqliteDialectConfig ;
157- return new SqliteDialect ( mergedConfig ) ;
149+ return new SqliteDialect (
150+ this . options . dialectConfig as SqliteDialectConfig
151+ ) ;
158152 }
159153
160154 async $transaction < T > (
0 commit comments