Skip to content

Commit 0c698ee

Browse files
committed
fix(orm): update to kysely 0.28.x and simplify typing
1 parent 0d1faf1 commit 0c698ee

File tree

15 files changed

+259
-264
lines changed

15 files changed

+259
-264
lines changed

packages/orm/src/client/client-impl.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
type KyselyProps,
1212
} from 'kysely';
1313
import type { GetModels, ProcedureDef, SchemaDef } from '../schema';
14+
import type { AnyKysely } from '../utils/kysely-utils';
1415
import type { UnwrapTuplePromises } from '../utils/type-utils';
1516
import type {
1617
AuthType,
@@ -53,7 +54,7 @@ export const ZenStackClient = function <Schema extends SchemaDef>(
5354

5455
export class ClientImpl<Schema extends SchemaDef> {
5556
private kysely: ToKysely<Schema>;
56-
private kyselyRaw: ToKysely<any>;
57+
private kyselyRaw: AnyKysely;
5758
public readonly $options: ClientOptions<Schema>;
5859
public readonly $schema: Schema;
5960
readonly kyselyProps: KyselyProps;
@@ -192,7 +193,7 @@ export class ClientImpl<Schema extends SchemaDef> {
192193
arg: ZenStackPromise<Schema, any>[],
193194
options?: { isolationLevel?: TransactionIsolationLevel },
194195
) {
195-
const execute = async (tx: Kysely<any>) => {
196+
const execute = async (tx: AnyKysely) => {
196197
const txClient = new ClientImpl<Schema>(this.schema, this.$options, this);
197198
txClient.kysely = tx;
198199
const result: any[] = [];
@@ -210,7 +211,7 @@ export class ClientImpl<Schema extends SchemaDef> {
210211
if (options?.isolationLevel) {
211212
txBuilder = txBuilder.setIsolationLevel(options.isolationLevel);
212213
}
213-
return txBuilder.execute((tx) => execute(tx as Kysely<any>));
214+
return txBuilder.execute((tx) => execute(tx as AnyKysely));
214215
}
215216
}
216217

packages/orm/src/client/contract.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type Decimal from 'decimal.js';
22
import { type GetModels, type IsDelegateModel, type ProcedureDef, type SchemaDef } from '../schema';
3+
import type { AnyKysely } from '../utils/kysely-utils';
34
import type { OrUndefinedIf, Simplify, UnwrapTuplePromises } from '../utils/type-utils';
45
import type { TRANSACTION_UNSUPPORTED_METHODS } from './constants';
56
import type {
@@ -116,7 +117,7 @@ export type ClientContract<Schema extends SchemaDef> = {
116117
/**
117118
* The raw Kysely query builder without any ZenStack enhancements.
118119
*/
119-
readonly $qbRaw: ToKysely<any>;
120+
readonly $qbRaw: AnyKysely;
120121

121122
/**
122123
* Starts an interactive transaction.

packages/orm/src/client/crud/dialects/base-dialect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export abstract class BaseCrudDialect<Schema extends SchemaDef> {
6464
}
6565

6666
buildFilterSortTake(
67-
model: GetModels<Schema>,
67+
model: string,
6868
args: FindArgs<Schema, GetModels<Schema>, true>,
6969
query: SelectQueryBuilder<any, any, {}>,
7070
modelAlias: string,

0 commit comments

Comments
 (0)