drizzle-kit 0.20.17-d1b2821 → 0.20.17-e0821c1

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ import type { PostgresCredentials } from "../cli/validations/pg";
3
3
  import type { MysqlCredentials } from "../cli/validations/mysql";
4
4
  import type { SqliteCredentials } from "../cli/validations/sqlite";
5
5
  import { AnyPgTable } from "drizzle-orm/pg-core";
6
- import { Relations } from "drizzle-orm";
6
+ import { AnyTable, Relations, TablesRelationalConfig } from "drizzle-orm";
7
7
  import { AnyMySqlTable } from "drizzle-orm/mysql-core";
8
8
  import { AnySQLiteTable } from "drizzle-orm/sqlite-core";
9
9
  type CustomDefault = {
@@ -14,12 +14,16 @@ type CustomDefault = {
14
14
  };
15
15
  export type Setup = {
16
16
  dialect: "postgresql" | "mysql" | "sqlite";
17
+ driver?: "aws-data-api";
17
18
  proxy: (params: ProxyParams) => Promise<any[] | any>;
18
19
  customDefaults: CustomDefault[];
20
+ schema: Record<string, Record<string, AnyTable<any>>>;
21
+ relations: Record<string, Relations>;
19
22
  };
20
23
  export type ProxyParams = {
21
24
  sql: string;
22
25
  params: any[];
26
+ typings?: any[];
23
27
  mode: "array" | "object";
24
28
  method: "values" | "get" | "all" | "run" | "execute";
25
29
  };
@@ -38,6 +42,19 @@ export declare const prepareSQLiteSchema: (path: string | string[]) => Promise<{
38
42
  export declare const drizzleForPostgres: (credentials: PostgresCredentials, pgSchema: Record<string, Record<string, AnyPgTable>>, relations: Record<string, Relations>) => Promise<Setup>;
39
43
  export declare const drizzleForMySQL: (credentials: MysqlCredentials, mysqlSchema: Record<string, Record<string, AnyMySqlTable>>, relations: Record<string, Relations>) => Promise<Setup>;
40
44
  export declare const drizzleForSQLite: (credentials: SqliteCredentials, sqliteSchema: Record<string, Record<string, AnySQLiteTable>>, relations: Record<string, Relations>) => Promise<Setup>;
45
+ export declare const extractRelations: (tablesConfig: {
46
+ tables: TablesRelationalConfig;
47
+ tableNamesMap: Record<string, string>;
48
+ }) => {
49
+ name: string;
50
+ type: "many" | "one";
51
+ table: string;
52
+ schema: string;
53
+ columns: string[];
54
+ refTable: string;
55
+ refSchema: string;
56
+ refColumns: string[];
57
+ }[];
41
58
  export type Server = {
42
59
  start: (params: {
43
60
  host: string;
@@ -47,5 +64,5 @@ export type Server = {
47
64
  cb: (err: Error | null, address: string) => void;
48
65
  }) => void;
49
66
  };
50
- export declare const prepareServer: ({ dialect, proxy, customDefaults }: Setup, app?: Hono) => Promise<Server>;
67
+ export declare const prepareServer: ({ dialect, driver, proxy, customDefaults, schema: drizzleSchema, relations }: Setup, app?: Hono) => Promise<Server>;
51
68
  export {};