File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " drizzle-zero" ,
3- "version" : " 0.12.0 " ,
3+ "version" : " 0.12.1 " ,
44 "description" : " Generate Zero schemas from Drizzle ORM schemas" ,
55 "type" : " module" ,
66 "scripts" : {
Original file line number Diff line number Diff line change @@ -7,9 +7,12 @@ import type {
77import type { PgTransaction } from "drizzle-orm/pg-core" ;
88import type { ExtractTablesWithRelations } from "drizzle-orm/relations" ;
99
10- export type NodePgZeroTransaction <
11- TDatabase extends NodePgDatabase < Record < string , unknown > > ,
12- > = Parameters < Parameters < TDatabase [ "transaction" ] > [ 0 ] > [ 0 ] & { } ;
10+ export type NodePgZeroTransaction < TSchema extends Record < string , unknown > > =
11+ PgTransaction <
12+ NodePgQueryResultHKT ,
13+ TSchema ,
14+ ExtractTablesWithRelations < TSchema >
15+ > ;
1316
1417export class NodePgConnection <
1518 TDrizzle extends NodePgDatabase < Record < string , unknown > > & {
@@ -18,11 +21,7 @@ export class NodePgConnection<
1821 TSchema extends TDrizzle extends NodePgDatabase < infer TSchema >
1922 ? TSchema
2023 : never ,
21- TTransaction extends PgTransaction <
22- NodePgQueryResultHKT ,
23- TSchema ,
24- ExtractTablesWithRelations < TSchema >
25- > ,
24+ TTransaction extends NodePgZeroTransaction < TSchema > ,
2625> implements DBConnection < TTransaction >
2726{
2827 readonly #drizzle: TDrizzle ;
Original file line number Diff line number Diff line change @@ -7,9 +7,12 @@ import type {
77import type { ExtractTablesWithRelations } from "drizzle-orm/relations" ;
88import type postgres from "postgres" ;
99
10- export type PostgresJsZeroTransaction <
11- TDatabase extends PostgresJsDatabase < Record < string , unknown > > ,
12- > = Parameters < Parameters < TDatabase [ "transaction" ] > [ 0 ] > [ 0 ] & { } ;
10+ export type PostgresJsZeroTransaction < TSchema extends Record < string , unknown > > =
11+ PgTransaction <
12+ PostgresJsQueryResultHKT ,
13+ TSchema ,
14+ ExtractTablesWithRelations < TSchema >
15+ > ;
1316
1417export class PostgresJsConnection <
1518 TDrizzle extends PostgresJsDatabase < Record < string , unknown > > & {
@@ -18,11 +21,7 @@ export class PostgresJsConnection<
1821 TSchema extends TDrizzle extends PostgresJsDatabase < infer TSchema >
1922 ? TSchema
2023 : never ,
21- TTransaction extends PgTransaction <
22- PostgresJsQueryResultHKT ,
23- TSchema ,
24- ExtractTablesWithRelations < TSchema >
25- > ,
24+ TTransaction extends PostgresJsZeroTransaction < TSchema > ,
2625> implements DBConnection < TTransaction >
2726{
2827 readonly #drizzle: TDrizzle ;
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ describe("node-postgres", () => {
6363 } ) ;
6464
6565 test ( "types" , async ( ) => {
66- const s = null as unknown as NodePgZeroTransaction < typeof db > ;
66+ const s = null as unknown as NodePgZeroTransaction < typeof drizzleSchema > ;
6767
6868 const user = null as unknown as Awaited <
6969 ReturnType < typeof s . query . user . findFirst >
@@ -210,7 +210,7 @@ describe("postgres-js", () => {
210210 } ) ;
211211
212212 test ( "types" , async ( ) => {
213- const s = null as unknown as PostgresJsZeroTransaction < typeof db > ;
213+ const s = null as unknown as PostgresJsZeroTransaction < typeof drizzleSchema > ;
214214
215215 const user = null as unknown as Awaited <
216216 ReturnType < typeof s . query . user . findFirst >
You can’t perform that action at this time.
0 commit comments