drizzle-kit 0.20.5-e91a5f5 → 0.20.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,51 @@
1
+ import { entityKind } from "drizzle-orm";
2
+ import type { Logger } from "drizzle-orm";
3
+ import { type RelationalSchemaConfig, type TablesRelationalConfig } from "drizzle-orm";
4
+ import { type Query } from "drizzle-orm";
5
+ import { SQLiteAsyncDialect, SQLiteExecuteMethod, SQLitePreparedQuery, SQLiteSession } from "drizzle-orm/sqlite-core";
6
+ import type { SelectedFieldsOrdered } from "drizzle-orm/sqlite-core";
7
+ import { type PreparedQueryConfig as PreparedQueryConfigBase, type SQLiteTransactionConfig } from "drizzle-orm/sqlite-core";
8
+ export interface SQLiteD1SessionOptions {
9
+ logger?: Logger;
10
+ }
11
+ type PreparedQueryConfig = Omit<PreparedQueryConfigBase, "statement" | "run">;
12
+ export type D1WranglerResults<T = unknown> = {
13
+ results?: T[];
14
+ };
15
+ export declare class SQLiteWranglerD1Session<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends SQLiteSession<"async", D1WranglerResults, TFullSchema, TSchema> {
16
+ private client;
17
+ private configPath;
18
+ private dbName;
19
+ private schema;
20
+ private options;
21
+ static readonly [entityKind]: string;
22
+ private logger;
23
+ constructor(client: (query: string, configPath: string, dbName: string) => Promise<any>, configPath: string, dbName: string, dialect: SQLiteAsyncDialect, schema: RelationalSchemaConfig<TSchema> | undefined, options?: SQLiteD1SessionOptions);
24
+ prepareQuery(query: Query, fields: SelectedFieldsOrdered | undefined, executeMethod: SQLiteExecuteMethod, customResultMapper?: (rows: unknown[][]) => unknown): PreparedQuery;
25
+ transaction<T>(transaction: (tx: any) => T | Promise<T>, config?: SQLiteTransactionConfig): Promise<T>;
26
+ }
27
+ export declare class PreparedQuery<T extends PreparedQueryConfig = PreparedQueryConfig> extends SQLitePreparedQuery<{
28
+ type: "async";
29
+ run: D1WranglerResults;
30
+ all: T["all"];
31
+ get: T["get"];
32
+ values: T["values"];
33
+ execute: T["execute"];
34
+ }> {
35
+ private stmt;
36
+ private configPath;
37
+ private dbName;
38
+ private queryString;
39
+ private params;
40
+ private logger;
41
+ private fields;
42
+ private customResultMapper?;
43
+ static readonly [entityKind]: string;
44
+ constructor(stmt: (query: string, configPath: string, dbName: string) => Promise<any>, configPath: string, dbName: string, queryString: string, params: unknown[], logger: Logger, fields: SelectedFieldsOrdered | undefined, executeMethod: SQLiteExecuteMethod, customResultMapper?: ((rows: unknown[][]) => unknown) | undefined);
45
+ run(placeholderValues?: Record<string, unknown>): Promise<D1WranglerResults>;
46
+ all(placeholderValues?: Record<string, unknown>): Promise<T["all"]>;
47
+ get(placeholderValues?: Record<string, unknown>): Promise<T["get"]>;
48
+ private d1ToRawMapping;
49
+ values(placeholderValues?: Record<string, unknown>): Promise<unknown[][]>;
50
+ }
51
+ export {};
@@ -0,0 +1,3 @@
1
+ export declare function execute(query: string, configPath: string, dbName: string): Promise<{
2
+ results: any;
3
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.20.5-e91a5f5",
3
+ "version": "0.20.5",
4
4
  "repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
5
5
  "author": "Drizzle Team",
6
6
  "license": "MIT",
@@ -10,7 +10,7 @@
10
10
  "scripts": {
11
11
  "test:pg:push": "drizzle-kit push:pg",
12
12
  "payload": "tsx ./dev/payload.ts",
13
- "migrate:old": "drizzle-kit generate:pg --out ./dev/migrations-pg --schema ./dev/migrations-pg/schema.ts",
13
+ "migrate:old": "drizzle-kit generate:pg --out ./dev/migrations-pg --schema ./dev/migrations-pg/schema2.ts",
14
14
  "push": "node -r esbuild-register ./src/cli/index.ts push:mysql",
15
15
  "push:sqlite": "node -r ./src/loader.mjs ./src/cli/index.ts push:sqlite",
16
16
  "try1": "tsx ./src/t.ts",
@@ -41,7 +41,7 @@
41
41
  "packit": "pnpm build && cp package.json dist/ && cd dist && pnpm pack",
42
42
  "tsc": "tsc -p tsconfig.build.json",
43
43
  "pub": "cp package.json readme.md dist/ && cd dist && npm publish",
44
- "studio": "./dist/index.cjs studio --verbose",
44
+ "studio": "tsx ./src/cli/index.ts studio --verbose --port=3000",
45
45
  "studio:dev": "tsx ./src/cli/index.ts studio --verbose"
46
46
  },
47
47
  "ava": {
@@ -56,17 +56,18 @@
56
56
  ]
57
57
  },
58
58
  "dependencies": {
59
- "@drizzle-team/studio": "^0.0.27",
59
+ "@drizzle-team/studio": "^0.0.34",
60
60
  "@esbuild-kit/esm-loader": "^2.5.5",
61
61
  "camelcase": "^7.0.1",
62
62
  "chalk": "^5.2.0",
63
63
  "commander": "^9.4.1",
64
- "esbuild": "^0.18.6",
65
- "esbuild-register": "^3.4.2",
64
+ "esbuild": "^0.19.7",
65
+ "esbuild-register": "^3.5.0",
66
66
  "glob": "^8.1.0",
67
67
  "hanji": "^0.0.5",
68
68
  "json-diff": "0.9.0",
69
69
  "minimatch": "^7.4.3",
70
+ "semver": "^7.5.4",
70
71
  "wrangler": "^3.7.0",
71
72
  "zod": "^3.20.2"
72
73
  },
@@ -79,13 +80,14 @@
79
80
  "@types/minimatch": "^5.1.2",
80
81
  "@types/node": "^18.11.15",
81
82
  "@types/pg": "^8.10.7",
83
+ "@types/semver": "^7.5.5",
82
84
  "@typescript-eslint/eslint-plugin": "^5.46.1",
83
85
  "@typescript-eslint/parser": "^5.46.1",
84
86
  "ava": "^5.1.0",
85
87
  "better-sqlite3": "^8.4.0",
86
88
  "dockerode": "^3.3.4",
87
89
  "dotenv": "^16.0.3",
88
- "drizzle-orm": "0.29.0-d3b1c58",
90
+ "drizzle-orm": "0.29.0",
89
91
  "esbuild-node-externals": "^1.9.0",
90
92
  "eslint": "^8.29.0",
91
93
  "eslint-config-prettier": "^8.5.0",
@@ -124,18 +126,6 @@
124
126
  },
125
127
  "types": "./utils-studio.d.mts",
126
128
  "default": "./utils-studio.mjs"
127
- },
128
- "./payload": {
129
- "import": {
130
- "types": "./payload.d.mts",
131
- "default": "./payload.mjs"
132
- },
133
- "require": {
134
- "types": "./payload.d.ts",
135
- "default": "./payload.js"
136
- },
137
- "types": "./payload.d.mts",
138
- "default": "./payload.mjs"
139
129
  }
140
130
  }
141
131
  }
@@ -1,9 +1,4 @@
1
1
  import { AnyMySqlTable, MySqlSchema } from "drizzle-orm/mysql-core";
2
- export declare const prepareFromExports: (exports: Record<string, unknown>) => {
3
- tables: AnyMySqlTable<{}>[];
4
- enums: any[];
5
- schemas: MySqlSchema<string>[];
6
- };
7
2
  export declare const prepareFromMySqlImports: (imports: string[]) => Promise<{
8
3
  tables: AnyMySqlTable<{}>[];
9
4
  enums: any[];
@@ -1,7 +1,7 @@
1
1
  import { AnyMySqlTable, MySqlSchema } from "drizzle-orm/mysql-core";
2
2
  import { MySqlSchemaInternal } from "src/serializer/mysqlSchema";
3
+ import { Connection } from "mysql2/promise";
3
4
  import { IntrospectStage, IntrospectStatus } from "src/cli/views";
4
- import { DrizzleDbClient } from "src/drivers";
5
5
  export declare const indexName: (tableName: string, columns: string[]) => string;
6
6
  export declare const generateMySqlSnapshot: (tables: AnyMySqlTable[], enums: any[], mysqlSchemas: MySqlSchema[]) => MySqlSchemaInternal;
7
- export declare const fromDatabase: (db: DrizzleDbClient, inputSchema: string, tablesFilter?: (table: string) => boolean, progressCallback?: ((stage: IntrospectStage, count: number, status: IntrospectStatus) => void) | undefined) => Promise<MySqlSchemaInternal>;
7
+ export declare const fromDatabase: (db: Connection, inputSchema: string, tablesFilter?: (table: string) => boolean, progressCallback?: ((stage: IntrospectStage, count: number, status: IntrospectStatus) => void) | undefined) => Promise<MySqlSchemaInternal>;
@@ -1,8 +1,4 @@
1
1
  import { AnySQLiteTable } from "drizzle-orm/sqlite-core";
2
- export declare const prepareFromExports: (exports: Record<string, unknown>) => {
3
- tables: AnySQLiteTable<{}>[];
4
- enums: any[];
5
- };
6
2
  export declare const prepareFromSqliteImports: (imports: string[]) => Promise<{
7
3
  tables: AnySQLiteTable<{}>[];
8
4
  enums: any[];
@@ -0,0 +1,65 @@
1
+ import type { Setup } from "@drizzle-team/studio";
2
+ import { Relations } from "drizzle-orm";
3
+ import { AnyMySqlTable } from "drizzle-orm/mysql-core";
4
+ import { AnyPgTable } from "drizzle-orm/pg-core";
5
+ import { AnySQLiteTable } from "drizzle-orm/sqlite-core";
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
+ }>;
21
+ export declare const prepareModels: (path: string | string[]) => Promise<{
22
+ pgSchema: Record<string, AnyPgTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
23
+ mysqlSchema: Record<string, AnyMySqlTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
24
+ sqliteSchema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>>;
25
+ }>;
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>;
41
+ export declare const drizzleDb: (drizzleConfig: StudioConfigConnections, models: {
42
+ pgSchema?: Record<string, AnyPgTable | Relations>;
43
+ mysqlSchema?: Record<string, AnyMySqlTable | Relations>;
44
+ sqliteSchema?: Record<string, AnySQLiteTable | Relations>;
45
+ }, logger: boolean) => Promise<{
46
+ db: import("drizzle-orm/node-postgres").NodePgDatabase<Record<string, never>>;
47
+ type: "pg";
48
+ schema: Record<string, AnyPgTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
49
+ } | {
50
+ db: import("drizzle-orm/mysql2").MySql2Database<Record<string, never>>;
51
+ type: "mysql";
52
+ schema: Record<string, AnyMySqlTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
53
+ } | {
54
+ db: import("../orm-extenstions/d1-driver/driver").DrizzleD1WranglerDatabase<Record<string, never>>;
55
+ type: "sqlite";
56
+ schema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>> | undefined;
57
+ } | {
58
+ db: import("drizzle-orm/better-sqlite3").BetterSQLite3Database<Record<string, never>>;
59
+ type: "sqlite";
60
+ schema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>> | undefined;
61
+ } | {
62
+ db: import("drizzle-orm/libsql").LibSQLDatabase<Record<string, never>>;
63
+ type: "sqlite";
64
+ schema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>> | undefined;
65
+ }>;