drizzle-kit 0.20.2 → 0.20.4-2a3dc47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin.cjs +2888 -974
- package/cli/commands/pgIntrospect.d.ts +6 -1
- package/cli/commands/sqliteIntrospect.d.ts +6 -1
- package/cli/utils.d.ts +1 -0
- package/introspect-pg.d.ts +9 -0
- package/introspect-sqlite.d.ts +10 -0
- package/package.json +19 -4
- package/serializer/studioUtils.d.ts +15 -3
- package/utils-studio.d.mts +5 -0
- package/utils-studio.d.ts +1 -1
- package/utils-studio.js +13 -3
- package/utils-studio.mjs +3410 -0
- package/utils.js +2600 -814
- package/introspect.d.ts +0 -4
- package/sqlite-introspect.d.ts +0 -5
@@ -112,5 +112,10 @@ export declare const pgIntrospect: (config: PgConfigIntrospect, filters: string[
|
|
112
112
|
values: Record<string, string>;
|
113
113
|
}>;
|
114
114
|
};
|
115
|
-
ts:
|
115
|
+
ts: {
|
116
|
+
file: string;
|
117
|
+
imports: string;
|
118
|
+
decalrations: string;
|
119
|
+
schemaEntry: string;
|
120
|
+
};
|
116
121
|
}>;
|
@@ -51,7 +51,12 @@ export declare const sqliteIntrospect: (config: SQLiteCliConfig, filters: string
|
|
51
51
|
};
|
52
52
|
enums: {};
|
53
53
|
};
|
54
|
-
ts:
|
54
|
+
ts: {
|
55
|
+
file: string;
|
56
|
+
imports: string;
|
57
|
+
decalrations: string;
|
58
|
+
schemaEntry: string;
|
59
|
+
};
|
55
60
|
}>;
|
56
61
|
export declare const sqlitePushIntrospect: (client: DrizzleDbClient, filters: string[]) => Promise<{
|
57
62
|
schema: {
|
package/cli/utils.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
export declare const assertExists: (it?: any) => void;
|
2
|
+
export declare const assertStudioNodeVersion: () => void;
|
2
3
|
export declare const assertPackages: (...pkgs: string[]) => Promise<void>;
|
3
4
|
export declare const assertEitherPackage: (...pkgs: string[]) => Promise<string[]>;
|
4
5
|
export declare const assertOrmCoreVersion: () => Promise<void>;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import "./@types/utils";
|
2
|
+
import { ConfigIntrospectCasing } from "./cli/commands/utils";
|
3
|
+
import { PgSchemaInternal } from "./serializer/pgSchema";
|
4
|
+
export declare const schemaToTypeScript: (schema: PgSchemaInternal, casing: ConfigIntrospectCasing) => {
|
5
|
+
file: string;
|
6
|
+
imports: string;
|
7
|
+
decalrations: string;
|
8
|
+
schemaEntry: string;
|
9
|
+
};
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import "./@types/utils";
|
2
|
+
import type { ConfigIntrospectCasing } from "./cli/commands/utils";
|
3
|
+
import type { SQLiteSchemaInternal } from "./serializer/sqliteSchema";
|
4
|
+
export declare const indexName: (tableName: string, columns: string[]) => string;
|
5
|
+
export declare const schemaToTypeScript: (schema: SQLiteSchemaInternal, casing: ConfigIntrospectCasing["casing"]) => {
|
6
|
+
file: string;
|
7
|
+
imports: string;
|
8
|
+
decalrations: string;
|
9
|
+
schemaEntry: string;
|
10
|
+
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "drizzle-kit",
|
3
|
-
"version": "0.20.
|
3
|
+
"version": "0.20.4-2a3dc47",
|
4
4
|
"repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
|
5
5
|
"author": "Drizzle Team",
|
6
6
|
"license": "MIT",
|
@@ -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 && tsc -p tsconfig.cli-types.json &&
|
38
|
+
"build": "rm -rf ./dist && tsc -p tsconfig.cli-types.json && pnpm mts && tsx build.ts",
|
39
|
+
"mts": "cp dist/index.d.ts dist/index.d.mts && cp dist/utils-studio.d.ts dist/utils-studio.d.mts",
|
39
40
|
"build:dev": "rm -rf ./dist && tsx build.dev.ts && tsc -p tsconfig.cli-types.json && chmod +x ./dist/index.cjs",
|
40
41
|
"packit": "pnpm build && cp package.json dist/ && cd dist && pnpm pack",
|
41
42
|
"tsc": "tsc -p tsconfig.build.json",
|
42
43
|
"pub": "cp package.json readme.md dist/ && cd dist && npm publish",
|
43
|
-
"studio": "./
|
44
|
+
"studio": "tsx ./src/cli/index.ts studio --verbose --port=3000",
|
44
45
|
"studio:dev": "tsx ./src/cli/index.ts studio --verbose"
|
45
46
|
},
|
46
47
|
"ava": {
|
@@ -55,7 +56,7 @@
|
|
55
56
|
]
|
56
57
|
},
|
57
58
|
"dependencies": {
|
58
|
-
"@drizzle-team/studio": "^0.0.
|
59
|
+
"@drizzle-team/studio": "^0.0.34",
|
59
60
|
"@esbuild-kit/esm-loader": "^2.5.5",
|
60
61
|
"camelcase": "^7.0.1",
|
61
62
|
"chalk": "^5.2.0",
|
@@ -66,6 +67,7 @@
|
|
66
67
|
"hanji": "^0.0.5",
|
67
68
|
"json-diff": "0.9.0",
|
68
69
|
"minimatch": "^7.4.3",
|
70
|
+
"semver": "^7.5.4",
|
69
71
|
"wrangler": "^3.7.0",
|
70
72
|
"zod": "^3.20.2"
|
71
73
|
},
|
@@ -78,6 +80,7 @@
|
|
78
80
|
"@types/minimatch": "^5.1.2",
|
79
81
|
"@types/node": "^18.11.15",
|
80
82
|
"@types/pg": "^8.10.7",
|
83
|
+
"@types/semver": "^7.5.5",
|
81
84
|
"@typescript-eslint/eslint-plugin": "^5.46.1",
|
82
85
|
"@typescript-eslint/parser": "^5.46.1",
|
83
86
|
"ava": "^5.1.0",
|
@@ -111,6 +114,18 @@
|
|
111
114
|
},
|
112
115
|
"types": "./index.d.mts",
|
113
116
|
"default": "./index.mjs"
|
117
|
+
},
|
118
|
+
"./utils-studio": {
|
119
|
+
"import": {
|
120
|
+
"types": "./utils-studio.d.mts",
|
121
|
+
"default": "./utils-studio.mjs"
|
122
|
+
},
|
123
|
+
"require": {
|
124
|
+
"types": "./utils-studio.d.ts",
|
125
|
+
"default": "./utils-studio.js"
|
126
|
+
},
|
127
|
+
"types": "./utils-studio.d.mts",
|
128
|
+
"default": "./utils-studio.mjs"
|
114
129
|
}
|
115
130
|
}
|
116
131
|
}
|
@@ -23,9 +23,21 @@ export declare const prepareModels: (path: string | string[]) => Promise<{
|
|
23
23
|
mysqlSchema: Record<string, AnyMySqlTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
|
24
24
|
sqliteSchema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>>;
|
25
25
|
}>;
|
26
|
-
export declare const drizzleForPostgres: (connectionConfig: PgConnectionConfig, pgSchema: Record<string, Record<string, AnyPgTable>>, relations: Record<string, Relations>,
|
27
|
-
|
28
|
-
|
26
|
+
export declare const drizzleForPostgres: (connectionConfig: PgConnectionConfig, pgSchema: Record<string, Record<string, AnyPgTable>>, relations: Record<string, Relations>, ts: {
|
27
|
+
imports: string;
|
28
|
+
declarations: string;
|
29
|
+
schemaEntry: string;
|
30
|
+
}, verbose: boolean) => Promise<Setup>;
|
31
|
+
export declare const drizzleForMySQL: (config: MySQLConnectionConfig, mysqlSchema: Record<string, Record<string, AnyMySqlTable>>, relations: Record<string, Relations>, ts: {
|
32
|
+
imports: string;
|
33
|
+
declarations: string;
|
34
|
+
schemaEntry: string;
|
35
|
+
}, verbose: boolean) => Promise<Setup>;
|
36
|
+
export declare const drizzleForSQLite: (config: StudioSQLiteConnectionConfig, sqliteSchema: Record<string, Record<string, AnySQLiteTable>>, relations: Record<string, Relations>, ts: {
|
37
|
+
imports: string;
|
38
|
+
declarations: string;
|
39
|
+
schemaEntry: string;
|
40
|
+
}, verbose: boolean) => Promise<Setup>;
|
29
41
|
export declare const drizzleDb: (drizzleConfig: StudioConfigConnections, models: {
|
30
42
|
pgSchema?: Record<string, AnyPgTable | Relations>;
|
31
43
|
mysqlSchema?: Record<string, AnyMySqlTable | Relations>;
|
@@ -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, TursoSqlite } from "./drivers";
|
package/utils-studio.d.ts
CHANGED
@@ -2,4 +2,4 @@ export { toDrizzle as drizzleSchemaPg } from "./serializer/pgSerializer";
|
|
2
2
|
export { toDrizzle as drizzleSchemaSQLite } from "./serializer/sqliteSerializer";
|
3
3
|
export { sqlitePushIntrospect } from "./cli/commands/sqliteIntrospect";
|
4
4
|
export { pgPushIntrospect } from "./cli/commands/pgIntrospect";
|
5
|
-
export { DrizzleORMPgClient } from "./drivers";
|
5
|
+
export { DrizzleORMPgClient, TursoSqlite } from "./drivers";
|
package/utils-studio.js
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#!/usr/bin/env node
|
2
1
|
var __create = Object.create;
|
3
2
|
var __defProp = Object.defineProperty;
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
@@ -2109,7 +2108,7 @@ var require_brace_expansion = __commonJS({
|
|
2109
2108
|
});
|
2110
2109
|
|
2111
2110
|
// src/drivers/index.ts
|
2112
|
-
var import_drizzle_orm3, DrizzleDbClient, DrizzleORMPgClient;
|
2111
|
+
var import_drizzle_orm3, DrizzleDbClient, DrizzleORMPgClient, TursoSqlite;
|
2113
2112
|
var init_drivers = __esm({
|
2114
2113
|
"src/drivers/index.ts"() {
|
2115
2114
|
import_drizzle_orm3 = require("drizzle-orm");
|
@@ -2128,6 +2127,15 @@ var init_drivers = __esm({
|
|
2128
2127
|
return res.rows;
|
2129
2128
|
}
|
2130
2129
|
};
|
2130
|
+
TursoSqlite = class extends DrizzleDbClient {
|
2131
|
+
async run(query) {
|
2132
|
+
await this.db.execute(query);
|
2133
|
+
}
|
2134
|
+
async query(query) {
|
2135
|
+
const res = await this.db.execute(query);
|
2136
|
+
return res.rows;
|
2137
|
+
}
|
2138
|
+
};
|
2131
2139
|
}
|
2132
2140
|
});
|
2133
2141
|
|
@@ -2135,6 +2143,7 @@ var init_drivers = __esm({
|
|
2135
2143
|
var utils_studio_exports = {};
|
2136
2144
|
__export(utils_studio_exports, {
|
2137
2145
|
DrizzleORMPgClient: () => DrizzleORMPgClient,
|
2146
|
+
TursoSqlite: () => TursoSqlite,
|
2138
2147
|
drizzleSchemaPg: () => toDrizzle,
|
2139
2148
|
drizzleSchemaSQLite: () => toDrizzle2,
|
2140
2149
|
pgPushIntrospect: () => pgPushIntrospect,
|
@@ -3330,7 +3339,7 @@ var import_hanji3 = __toESM(require_hanji());
|
|
3330
3339
|
init_views();
|
3331
3340
|
init_pgSerializer();
|
3332
3341
|
|
3333
|
-
// src/introspect.ts
|
3342
|
+
// src/introspect-pg.ts
|
3334
3343
|
init_pgSerializer();
|
3335
3344
|
|
3336
3345
|
// src/cli/commands/pgIntrospect.ts
|
@@ -3360,6 +3369,7 @@ init_drivers();
|
|
3360
3369
|
// Annotate the CommonJS export names for ESM import in node:
|
3361
3370
|
0 && (module.exports = {
|
3362
3371
|
DrizzleORMPgClient,
|
3372
|
+
TursoSqlite,
|
3363
3373
|
drizzleSchemaPg,
|
3364
3374
|
drizzleSchemaSQLite,
|
3365
3375
|
pgPushIntrospect,
|