drizzle-kit 0.20.0-5198fb7 → 0.20.0-588929f
Sign up to get free protection for your applications and to get access to all the features.
- package/{index.cjs → bin.cjs} +6696 -6251
- package/cli/commands/migrate.d.ts +1 -1
- package/cli/commands/pgConnect.d.ts +5 -0
- package/cli/commands/pgIntrospect.d.ts +3 -5
- package/cli/commands/sqliteIntrospect.d.ts +3 -3
- package/cli/commands/utils.d.ts +2 -2
- package/cli/utils.d.ts +11 -0
- package/cli/validations/mysql.d.ts +77 -126
- package/cli/validations/pg.d.ts +18 -18
- package/cli/validations/studio.d.ts +132 -87
- package/cli/views.d.ts +2 -2
- package/drivers/index.d.ts +3 -3
- package/global.d.ts +1 -0
- package/index.d.mts +105 -0
- package/index.d.ts +3 -2
- package/index.js +31 -0
- package/index.mjs +7 -0
- package/orm-extenstions/d1-driver/session.d.ts +2 -3
- package/package.json +24 -8
- package/serializer/index.d.ts +4 -4
- package/serializer/pgSchema.d.ts +16 -16
- package/serializer/pgSerializer.d.ts +5 -3
- package/serializer/sqliteSerializer.d.ts +3 -3
- package/serializer/studioUtils.d.ts +23 -5
- package/sqlite-introspect.d.ts +2 -2
- package/utils-studio.d.ts +5 -0
- package/utils-studio.js +3367 -0
- package/utils.d.ts +204 -26
- package/utils.js +7007 -6028
- package/loader.mjs +0 -57
- package/utilsR.d.ts +0 -232
package/package.json
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
{
|
2
2
|
"name": "drizzle-kit",
|
3
|
-
"version": "0.20.0-
|
3
|
+
"version": "0.20.0-588929f",
|
4
4
|
"repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
|
5
5
|
"author": "Drizzle Team",
|
6
6
|
"license": "MIT",
|
7
7
|
"bin": {
|
8
|
-
"drizzle-kit": "./
|
8
|
+
"drizzle-kit": "./bin.cjs"
|
9
9
|
},
|
10
10
|
"scripts": {
|
11
11
|
"test:pg:push": "drizzle-kit push:pg",
|
@@ -35,12 +35,13 @@
|
|
35
35
|
"sim": "node -r esbuild-register ./dev/simulate.ts",
|
36
36
|
"sim:sqlite": "node -r esbuild-register ./dev/sqlite/index.ts",
|
37
37
|
"test": "ava test --timeout=60s",
|
38
|
-
"build": "rm -rf ./dist &&
|
38
|
+
"build": "rm -rf ./dist && tsc -p tsconfig.cli-types.json && cp dist/index.d.ts dist/index.d.mts && tsx build.ts",
|
39
39
|
"build:dev": "rm -rf ./dist && tsx build.dev.ts && tsc -p tsconfig.cli-types.json && chmod +x ./dist/index.cjs",
|
40
40
|
"packit": "pnpm build && cp package.json dist/ && cd dist && pnpm pack",
|
41
41
|
"tsc": "tsc -p tsconfig.build.json",
|
42
42
|
"pub": "cp package.json readme.md dist/ && cd dist && npm publish",
|
43
|
-
"studio": "./dist/index.cjs studio --verbose"
|
43
|
+
"studio": "./dist/index.cjs studio --verbose",
|
44
|
+
"studio:dev": "tsx ./src/cli/index.ts studio --verbose"
|
44
45
|
},
|
45
46
|
"ava": {
|
46
47
|
"files": [
|
@@ -54,7 +55,7 @@
|
|
54
55
|
]
|
55
56
|
},
|
56
57
|
"dependencies": {
|
57
|
-
"@drizzle-team/studio": "^0.0.
|
58
|
+
"@drizzle-team/studio": "^0.0.27",
|
58
59
|
"@esbuild-kit/esm-loader": "^2.5.5",
|
59
60
|
"camelcase": "^7.0.1",
|
60
61
|
"chalk": "^5.2.0",
|
@@ -76,25 +77,40 @@
|
|
76
77
|
"@types/glob": "^8.1.0",
|
77
78
|
"@types/minimatch": "^5.1.2",
|
78
79
|
"@types/node": "^18.11.15",
|
79
|
-
"@types/pg": "^8.
|
80
|
+
"@types/pg": "^8.10.7",
|
80
81
|
"@typescript-eslint/eslint-plugin": "^5.46.1",
|
81
82
|
"@typescript-eslint/parser": "^5.46.1",
|
82
83
|
"ava": "^5.1.0",
|
83
84
|
"better-sqlite3": "^8.4.0",
|
84
85
|
"dockerode": "^3.3.4",
|
85
86
|
"dotenv": "^16.0.3",
|
86
|
-
"drizzle-orm": "0.
|
87
|
+
"drizzle-orm": "0.29.0-d3b1c58",
|
88
|
+
"esbuild-node-externals": "^1.9.0",
|
87
89
|
"eslint": "^8.29.0",
|
88
90
|
"eslint-config-prettier": "^8.5.0",
|
89
91
|
"eslint-plugin-prettier": "^4.2.1",
|
90
92
|
"get-port": "^6.1.2",
|
91
93
|
"mysql2": "2.3.3",
|
92
|
-
"pg": "^8.
|
94
|
+
"pg": "^8.11.3",
|
93
95
|
"postgres": "^3.3.5",
|
94
96
|
"prettier": "^2.8.1",
|
95
97
|
"tsx": "^3.12.1",
|
96
98
|
"typescript": "^4.9.4",
|
97
99
|
"uvu": "^0.5.6",
|
98
100
|
"zx": "^7.2.2"
|
101
|
+
},
|
102
|
+
"exports": {
|
103
|
+
".": {
|
104
|
+
"import": {
|
105
|
+
"types": "./index.d.mts",
|
106
|
+
"default": "./index.mjs"
|
107
|
+
},
|
108
|
+
"require": {
|
109
|
+
"types": "./index.d.ts",
|
110
|
+
"default": "./index.js"
|
111
|
+
},
|
112
|
+
"types": "./index.d.mts",
|
113
|
+
"default": "./index.mjs"
|
114
|
+
}
|
99
115
|
}
|
100
116
|
}
|
package/serializer/index.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import { PgSchemaInternal } from "./pgSchema";
|
2
|
-
import { SQLiteSchemaInternal } from "./sqliteSchema";
|
3
|
-
import { MySqlSchemaInternal } from "./mysqlSchema";
|
4
|
-
import { SQL } from "drizzle-orm";
|
1
|
+
import type { PgSchemaInternal } from "./pgSchema";
|
2
|
+
import type { SQLiteSchemaInternal } from "./sqliteSchema";
|
3
|
+
import type { MySqlSchemaInternal } from "./mysqlSchema";
|
4
|
+
import type { SQL } from "drizzle-orm";
|
5
5
|
export declare const sqlToStr: (sql: SQL) => string;
|
6
6
|
export declare const serializeMySql: (path: string | string[]) => Promise<MySqlSchemaInternal>;
|
7
7
|
export declare const serializePg: (path: string | string[], schemaFilter?: string[]) => Promise<PgSchemaInternal>;
|
package/serializer/pgSchema.d.ts
CHANGED
@@ -171,24 +171,24 @@ export declare const pgSchemaV1: import("zod").ZodObject<{
|
|
171
171
|
}, "strict", import("zod").ZodTypeAny, {
|
172
172
|
onUpdate?: string | undefined;
|
173
173
|
onDelete?: string | undefined;
|
174
|
-
column: string;
|
175
174
|
foreignKeyName: string;
|
176
175
|
table: string;
|
176
|
+
column: string;
|
177
177
|
}, {
|
178
178
|
onUpdate?: string | undefined;
|
179
179
|
onDelete?: string | undefined;
|
180
|
-
column: string;
|
181
180
|
foreignKeyName: string;
|
182
181
|
table: string;
|
182
|
+
column: string;
|
183
183
|
}>>;
|
184
184
|
}, "strict", import("zod").ZodTypeAny, {
|
185
185
|
default?: any;
|
186
186
|
references?: {
|
187
187
|
onUpdate?: string | undefined;
|
188
188
|
onDelete?: string | undefined;
|
189
|
-
column: string;
|
190
189
|
foreignKeyName: string;
|
191
190
|
table: string;
|
191
|
+
column: string;
|
192
192
|
} | undefined;
|
193
193
|
name: string;
|
194
194
|
type: string;
|
@@ -199,9 +199,9 @@ export declare const pgSchemaV1: import("zod").ZodObject<{
|
|
199
199
|
references?: {
|
200
200
|
onUpdate?: string | undefined;
|
201
201
|
onDelete?: string | undefined;
|
202
|
-
column: string;
|
203
202
|
foreignKeyName: string;
|
204
203
|
table: string;
|
204
|
+
column: string;
|
205
205
|
} | undefined;
|
206
206
|
name: string;
|
207
207
|
type: string;
|
@@ -238,9 +238,9 @@ export declare const pgSchemaV1: import("zod").ZodObject<{
|
|
238
238
|
references?: {
|
239
239
|
onUpdate?: string | undefined;
|
240
240
|
onDelete?: string | undefined;
|
241
|
-
column: string;
|
242
241
|
foreignKeyName: string;
|
243
242
|
table: string;
|
243
|
+
column: string;
|
244
244
|
} | undefined;
|
245
245
|
name: string;
|
246
246
|
type: string;
|
@@ -261,9 +261,9 @@ export declare const pgSchemaV1: import("zod").ZodObject<{
|
|
261
261
|
references?: {
|
262
262
|
onUpdate?: string | undefined;
|
263
263
|
onDelete?: string | undefined;
|
264
|
-
column: string;
|
265
264
|
foreignKeyName: string;
|
266
265
|
table: string;
|
266
|
+
column: string;
|
267
267
|
} | undefined;
|
268
268
|
name: string;
|
269
269
|
type: string;
|
@@ -297,9 +297,9 @@ export declare const pgSchemaV1: import("zod").ZodObject<{
|
|
297
297
|
references?: {
|
298
298
|
onUpdate?: string | undefined;
|
299
299
|
onDelete?: string | undefined;
|
300
|
-
column: string;
|
301
300
|
foreignKeyName: string;
|
302
301
|
table: string;
|
302
|
+
column: string;
|
303
303
|
} | undefined;
|
304
304
|
name: string;
|
305
305
|
type: string;
|
@@ -327,9 +327,9 @@ export declare const pgSchemaV1: import("zod").ZodObject<{
|
|
327
327
|
references?: {
|
328
328
|
onUpdate?: string | undefined;
|
329
329
|
onDelete?: string | undefined;
|
330
|
-
column: string;
|
331
330
|
foreignKeyName: string;
|
332
331
|
table: string;
|
332
|
+
column: string;
|
333
333
|
} | undefined;
|
334
334
|
name: string;
|
335
335
|
type: string;
|
@@ -3059,24 +3059,24 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
|
|
3059
3059
|
}, "strict", import("zod").ZodTypeAny, {
|
3060
3060
|
onUpdate?: string | undefined;
|
3061
3061
|
onDelete?: string | undefined;
|
3062
|
-
column: string;
|
3063
3062
|
foreignKeyName: string;
|
3064
3063
|
table: string;
|
3064
|
+
column: string;
|
3065
3065
|
}, {
|
3066
3066
|
onUpdate?: string | undefined;
|
3067
3067
|
onDelete?: string | undefined;
|
3068
|
-
column: string;
|
3069
3068
|
foreignKeyName: string;
|
3070
3069
|
table: string;
|
3070
|
+
column: string;
|
3071
3071
|
}>>;
|
3072
3072
|
}, "strict", import("zod").ZodTypeAny, {
|
3073
3073
|
default?: any;
|
3074
3074
|
references?: {
|
3075
3075
|
onUpdate?: string | undefined;
|
3076
3076
|
onDelete?: string | undefined;
|
3077
|
-
column: string;
|
3078
3077
|
foreignKeyName: string;
|
3079
3078
|
table: string;
|
3079
|
+
column: string;
|
3080
3080
|
} | undefined;
|
3081
3081
|
name: string;
|
3082
3082
|
type: string;
|
@@ -3087,9 +3087,9 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
|
|
3087
3087
|
references?: {
|
3088
3088
|
onUpdate?: string | undefined;
|
3089
3089
|
onDelete?: string | undefined;
|
3090
|
-
column: string;
|
3091
3090
|
foreignKeyName: string;
|
3092
3091
|
table: string;
|
3092
|
+
column: string;
|
3093
3093
|
} | undefined;
|
3094
3094
|
name: string;
|
3095
3095
|
type: string;
|
@@ -3126,9 +3126,9 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
|
|
3126
3126
|
references?: {
|
3127
3127
|
onUpdate?: string | undefined;
|
3128
3128
|
onDelete?: string | undefined;
|
3129
|
-
column: string;
|
3130
3129
|
foreignKeyName: string;
|
3131
3130
|
table: string;
|
3131
|
+
column: string;
|
3132
3132
|
} | undefined;
|
3133
3133
|
name: string;
|
3134
3134
|
type: string;
|
@@ -3149,9 +3149,9 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
|
|
3149
3149
|
references?: {
|
3150
3150
|
onUpdate?: string | undefined;
|
3151
3151
|
onDelete?: string | undefined;
|
3152
|
-
column: string;
|
3153
3152
|
foreignKeyName: string;
|
3154
3153
|
table: string;
|
3154
|
+
column: string;
|
3155
3155
|
} | undefined;
|
3156
3156
|
name: string;
|
3157
3157
|
type: string;
|
@@ -3185,9 +3185,9 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
|
|
3185
3185
|
references?: {
|
3186
3186
|
onUpdate?: string | undefined;
|
3187
3187
|
onDelete?: string | undefined;
|
3188
|
-
column: string;
|
3189
3188
|
foreignKeyName: string;
|
3190
3189
|
table: string;
|
3190
|
+
column: string;
|
3191
3191
|
} | undefined;
|
3192
3192
|
name: string;
|
3193
3193
|
type: string;
|
@@ -3215,9 +3215,9 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
|
|
3215
3215
|
references?: {
|
3216
3216
|
onUpdate?: string | undefined;
|
3217
3217
|
onDelete?: string | undefined;
|
3218
|
-
column: string;
|
3219
3218
|
foreignKeyName: string;
|
3220
3219
|
table: string;
|
3220
|
+
column: string;
|
3221
3221
|
} | undefined;
|
3222
3222
|
name: string;
|
3223
3223
|
type: string;
|
@@ -1,7 +1,9 @@
|
|
1
1
|
import { AnyPgTable, PgEnum, PgSchema } from "drizzle-orm/pg-core";
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
2
|
+
import { Relations } from "drizzle-orm";
|
3
|
+
import type { IntrospectStage, IntrospectStatus } from "../cli/views";
|
4
|
+
import type { PgSchemaInternal } from "../serializer/pgSchema";
|
5
|
+
import type { DrizzleDbClient } from "../drivers";
|
5
6
|
export declare const indexName: (tableName: string, columns: string[]) => string;
|
6
7
|
export declare const generatePgSnapshot: (tables: AnyPgTable[], enums: PgEnum<any>[], schemas: PgSchema[], schemaFilter?: string[]) => PgSchemaInternal;
|
7
8
|
export declare const fromDatabase: (db: DrizzleDbClient, tablesFilter: ((table: string) => boolean) | undefined, schemaFilters: string[], progressCallback?: ((stage: IntrospectStage, count: number, status: IntrospectStatus) => void) | undefined) => Promise<PgSchemaInternal>;
|
9
|
+
export declare const toDrizzle: (schema: PgSchemaInternal, schemaName: string) => Record<string, AnyPgTable | Relations>;
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import { SQLiteSchemaInternal } from "
|
1
|
+
import type { SQLiteSchemaInternal } from "../serializer/sqliteSchema";
|
2
2
|
import { Relations } from "drizzle-orm";
|
3
3
|
import { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
4
|
-
import { IntrospectStage, IntrospectStatus } from "src/cli/views";
|
5
|
-
import { DrizzleDbClient } from "src/drivers";
|
4
|
+
import type { IntrospectStage, IntrospectStatus } from "src/cli/views";
|
5
|
+
import type { DrizzleDbClient } from "src/drivers";
|
6
6
|
export declare const generateSqliteSnapshot: (tables: AnySQLiteTable[], enums: any[]) => SQLiteSchemaInternal;
|
7
7
|
export declare const fromDatabase: (db: DrizzleDbClient, tablesFilter?: (table: string) => boolean, progressCallback?: ((stage: IntrospectStage, count: number, status: IntrospectStatus) => void) | undefined) => Promise<SQLiteSchemaInternal>;
|
8
8
|
export declare const toDrizzle: (schema: SQLiteSchemaInternal) => Record<string, AnySQLiteTable | Relations>;
|
@@ -1,13 +1,31 @@
|
|
1
|
+
import type { Setup } from "@drizzle-team/studio";
|
1
2
|
import { Relations } from "drizzle-orm";
|
2
3
|
import { AnyMySqlTable } from "drizzle-orm/mysql-core";
|
3
4
|
import { AnyPgTable } from "drizzle-orm/pg-core";
|
4
5
|
import { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
5
|
-
import {
|
6
|
+
import { MySQLConnectionConfig } from "src/cli/validations/mysql";
|
7
|
+
import { PgConnectionConfig } from "src/cli/validations/pg";
|
8
|
+
import { StudioConfigConnections, StudioSqliteConnectionConfig as StudioSQLiteConnectionConfig } from "src/cli/validations/studio";
|
9
|
+
export declare const preparePgSchema: (path: string | string[]) => Promise<{
|
10
|
+
schema: Record<string, Record<string, AnyPgTable<{}>>>;
|
11
|
+
relations: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
|
12
|
+
}>;
|
13
|
+
export declare const prepareMySqlSchema: (path: string | string[]) => Promise<{
|
14
|
+
schema: Record<string, Record<string, AnyMySqlTable<{}>>>;
|
15
|
+
relations: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
|
16
|
+
}>;
|
17
|
+
export declare const prepareSQLiteSchema: (path: string | string[]) => Promise<{
|
18
|
+
schema: Record<string, Record<string, AnySQLiteTable<{}>>>;
|
19
|
+
relations: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
|
20
|
+
}>;
|
6
21
|
export declare const prepareModels: (path: string | string[]) => Promise<{
|
7
22
|
pgSchema: Record<string, AnyPgTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
|
8
23
|
mysqlSchema: Record<string, AnyMySqlTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
|
9
|
-
sqliteSchema: Record<string,
|
24
|
+
sqliteSchema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>>;
|
10
25
|
}>;
|
26
|
+
export declare const drizzleForPostgres: (connectionConfig: PgConnectionConfig, pgSchema: Record<string, Record<string, AnyPgTable>>, relations: Record<string, Relations>, verbose: boolean) => Promise<Setup>;
|
27
|
+
export declare const drizzleForMySQL: (config: MySQLConnectionConfig, mysqlSchema: Record<string, Record<string, AnyMySqlTable>>, relations: Record<string, Relations>, verbose: boolean) => Promise<Setup>;
|
28
|
+
export declare const drizzleForSQLite: (config: StudioSQLiteConnectionConfig, sqliteSchema: Record<string, Record<string, AnySQLiteTable>>, relations: Record<string, Relations>, verbose: boolean) => Promise<Setup>;
|
11
29
|
export declare const drizzleDb: (drizzleConfig: StudioConfigConnections, models: {
|
12
30
|
pgSchema?: Record<string, AnyPgTable | Relations>;
|
13
31
|
mysqlSchema?: Record<string, AnyMySqlTable | Relations>;
|
@@ -23,13 +41,13 @@ export declare const drizzleDb: (drizzleConfig: StudioConfigConnections, models:
|
|
23
41
|
} | {
|
24
42
|
db: import("../orm-extenstions/d1-driver/driver").DrizzleD1WranglerDatabase<Record<string, never>>;
|
25
43
|
type: "sqlite";
|
26
|
-
schema: Record<string,
|
44
|
+
schema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>> | undefined;
|
27
45
|
} | {
|
28
46
|
db: import("drizzle-orm/better-sqlite3").BetterSQLite3Database<Record<string, never>>;
|
29
47
|
type: "sqlite";
|
30
|
-
schema: Record<string,
|
48
|
+
schema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>> | undefined;
|
31
49
|
} | {
|
32
50
|
db: import("drizzle-orm/libsql").LibSQLDatabase<Record<string, never>>;
|
33
51
|
type: "sqlite";
|
34
|
-
schema: Record<string,
|
52
|
+
schema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>> | undefined;
|
35
53
|
}>;
|
package/sqlite-introspect.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import "./@types/utils";
|
2
|
-
import { ConfigIntrospectCasing } from "./cli/commands/utils";
|
3
|
-
import { SQLiteSchema } from "./serializer/sqliteSchema";
|
2
|
+
import type { ConfigIntrospectCasing } from "./cli/commands/utils";
|
3
|
+
import type { SQLiteSchema } from "./serializer/sqliteSchema";
|
4
4
|
export declare const indexName: (tableName: string, columns: string[]) => string;
|
5
5
|
export declare const schemaToTypeScript: (schema: SQLiteSchema, casing: ConfigIntrospectCasing["casing"]) => string;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
export { toDrizzle as drizzleSchemaPg } from "./serializer/pgSerializer";
|
2
|
+
export { toDrizzle as drizzleSchemaSQLite } from "./serializer/sqliteSerializer";
|
3
|
+
export { sqlitePushIntrospect } from "./cli/commands/sqliteIntrospect";
|
4
|
+
export { pgPushIntrospect } from "./cli/commands/pgIntrospect";
|
5
|
+
export { DrizzleORMPgClient } from "./drivers";
|