drizzle-kit 0.20.2 → 0.20.4-38bea13
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +280 -155
- package/cli/commands/pgIntrospect.d.ts +6 -1
- package/cli/commands/sqliteIntrospect.d.ts +6 -1
- package/introspect-pg.d.ts +9 -0
- package/introspect-sqlite.d.ts +10 -0
- package/package.json +17 -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 +22 -17
- 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: {
|
@@ -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-38bea13",
|
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.33",
|
59
60
|
"@esbuild-kit/esm-loader": "^2.5.5",
|
60
61
|
"camelcase": "^7.0.1",
|
61
62
|
"chalk": "^5.2.0",
|
@@ -111,6 +112,18 @@
|
|
111
112
|
},
|
112
113
|
"types": "./index.d.mts",
|
113
114
|
"default": "./index.mjs"
|
115
|
+
},
|
116
|
+
"./utils-studio": {
|
117
|
+
"import": {
|
118
|
+
"types": "./utils-studio.d.mts",
|
119
|
+
"default": "./utils-studio.mjs"
|
120
|
+
},
|
121
|
+
"require": {
|
122
|
+
"types": "./utils-studio.d.ts",
|
123
|
+
"default": "./utils-studio.js"
|
124
|
+
},
|
125
|
+
"types": "./utils-studio.d.mts",
|
126
|
+
"default": "./utils-studio.mjs"
|
114
127
|
}
|
115
128
|
}
|
116
129
|
}
|
@@ -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,
|