drizzle-kit 0.20.17 → 0.20.18-d190692

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. package/bin.cjs +101440 -53514
  2. package/index.d.mts +46 -68
  3. package/index.d.ts +46 -68
  4. package/index.js +1 -0
  5. package/package.json +31 -64
  6. package/payload.d.mts +1052 -18
  7. package/payload.d.ts +1052 -18
  8. package/payload.js +20367 -34639
  9. package/payload.mjs +20377 -34642
  10. package/utils-studio.js +4580 -805
  11. package/utils-studio.mjs +4556 -784
  12. package/utils.js +4410 -6940
  13. package/utils.mjs +4852 -7382
  14. package/@types/utils.d.ts +0 -12
  15. package/cli/commands/migrate.d.ts +0 -270
  16. package/cli/commands/mysqlIntrospect.d.ts +0 -119
  17. package/cli/commands/mysqlPushUtils.d.ts +0 -18
  18. package/cli/commands/mysqlUp.d.ts +0 -4
  19. package/cli/commands/pgConnect.d.ts +0 -5
  20. package/cli/commands/pgIntrospect.d.ts +0 -123
  21. package/cli/commands/pgPushUtils.d.ts +0 -14
  22. package/cli/commands/pgUp.d.ts +0 -4
  23. package/cli/commands/sqliteIntrospect.d.ts +0 -107
  24. package/cli/commands/sqlitePushUtils.d.ts +0 -21
  25. package/cli/commands/sqliteUtils.d.ts +0 -162
  26. package/cli/commands/upFolders.d.ts +0 -27
  27. package/cli/commands/utils.d.ts +0 -274
  28. package/cli/selector-ui.d.ts +0 -13
  29. package/cli/validations/common.d.ts +0 -13
  30. package/cli/validations/mysql.d.ts +0 -365
  31. package/cli/validations/outputs.d.ts +0 -40
  32. package/cli/validations/pg.d.ts +0 -438
  33. package/cli/views.d.ts +0 -61
  34. package/drivers/index.d.ts +0 -39
  35. package/global.d.ts +0 -4
  36. package/introspect-mysql.d.ts +0 -9
  37. package/introspect-pg.d.ts +0 -12
  38. package/introspect-sqlite.d.ts +0 -10
  39. package/jsonDiffer.d.ts +0 -76
  40. package/jsonStatements.d.ts +0 -349
  41. package/migrationPreparator.d.ts +0 -35
  42. package/schemaValidator.d.ts +0 -1313
  43. package/serializer/index.d.ts +0 -9
  44. package/serializer/mysqlImports.d.ts +0 -11
  45. package/serializer/mysqlSchema.d.ts +0 -3833
  46. package/serializer/mysqlSerializer.d.ts +0 -7
  47. package/serializer/pgImports.d.ts +0 -11
  48. package/serializer/pgSchema.d.ts +0 -4333
  49. package/serializer/pgSerializer.d.ts +0 -7
  50. package/serializer/schemaToDrizzle.d.ts +0 -7
  51. package/serializer/sqliteImports.d.ts +0 -9
  52. package/serializer/sqliteSchema.d.ts +0 -3227
  53. package/serializer/sqliteSerializer.d.ts +0 -6
  54. package/snapshotsDiffer.d.ts +0 -2660
  55. package/sqlgenerator.d.ts +0 -33
  56. package/utils/words.d.ts +0 -7
  57. package/utils-studio.d.mts +0 -5
  58. package/utils-studio.d.ts +0 -5
  59. package/utils.d.ts +0 -199
package/index.d.mts CHANGED
@@ -1,79 +1,44 @@
1
- export type DbConnection = {
2
- driver: "turso";
3
- dbCredentials: {
4
- url: string;
5
- authToken?: string;
6
- };
7
- } | {
8
- driver: "better-sqlite";
9
- dbCredentials: {
10
- url: string;
11
- };
12
- } | {
13
- driver: "libsql";
14
- dbCredentials: {
15
- url: string;
16
- };
17
- } | {
18
- driver: "d1";
19
- dbCredentials: {
20
- wranglerConfigPath: string;
21
- dbName: string;
22
- };
23
- } | {
24
- driver: "pg";
25
- dbCredentials: {
26
- host: string;
27
- port?: number;
28
- user?: string;
29
- password?: string;
30
- database: string;
31
- ssl?: boolean;
32
- } | {
33
- connectionString: string;
34
- };
35
- } | {
36
- driver: "mysql2";
37
- dbCredentials: {
38
- host: string;
39
- port?: number;
40
- user?: string;
41
- password?: string;
42
- database: string;
43
- } | {
44
- uri: string;
45
- };
46
- };
47
- export type Config = {
48
- out?: string | undefined;
49
- breakpoints?: boolean | undefined;
50
- tablesFilter?: string | string[] | undefined;
51
- schemaFilter?: string | string[] | undefined;
1
+ import { SslOptions } from 'mysql2';
2
+ import * as zod from 'zod';
3
+ import { TypeOf } from 'zod';
4
+
5
+ declare const driver: zod.ZodUnion<[zod.ZodUnion<[zod.ZodLiteral<"better-sqlite">, zod.ZodLiteral<"turso">, zod.ZodLiteral<"libsql">, zod.ZodLiteral<"d1">, zod.ZodLiteral<"expo">]>, zod.ZodLiteral<"aws-data-api">, zod.ZodLiteral<"mysql2">]>;
6
+ type Driver = TypeOf<typeof driver>;
7
+
8
+ declare const dialect: zod.ZodEnum<["postgresql", "mysql", "sqlite"]>;
9
+ type Dialect = TypeOf<typeof dialect>;
10
+
11
+ type Verify<T, U extends T> = U;
12
+ type Config = {
13
+ dialect: Dialect;
14
+ out?: string;
15
+ breakpoints?: boolean;
16
+ tablesFilter?: string | string[];
17
+ schemaFilter?: string | string[];
52
18
  schema?: string | string[];
53
- verbose?: boolean | undefined;
54
- strict?: boolean | undefined;
55
- } & {
19
+ verbose?: boolean;
20
+ strict?: boolean;
21
+ migrations?: {
22
+ table?: string;
23
+ schema?: string;
24
+ };
56
25
  introspect?: {
57
26
  casing: "camel" | "preserve";
58
27
  };
59
28
  } & ({
60
- driver: "turso";
29
+ dialect: Verify<Dialect, "sqlite">;
30
+ driver: Verify<Driver, "turso">;
61
31
  dbCredentials: {
62
32
  url: string;
63
33
  authToken?: string;
64
34
  };
65
35
  } | {
66
- driver: "better-sqlite";
67
- dbCredentials: {
68
- url: string;
69
- };
70
- } | {
71
- driver: "libsql";
36
+ dialect: "sqlite";
72
37
  dbCredentials: {
73
38
  url: string;
74
39
  };
75
40
  } | {
76
- driver: "pg";
41
+ dialect: Verify<Dialect, "postgresql">;
77
42
  dbCredentials: {
78
43
  host: string;
79
44
  port?: number;
@@ -82,26 +47,39 @@ export type Config = {
82
47
  database: string;
83
48
  ssl?: boolean;
84
49
  } | {
85
- connectionString: string;
50
+ url: string;
86
51
  };
87
52
  } | {
88
- driver: "mysql2";
53
+ dialect: Verify<Dialect, "postgresql">;
54
+ driver: Verify<Driver, "aws-data-api">;
55
+ dbCredentials: {
56
+ database: string;
57
+ secretArn: string;
58
+ resourceArn: string;
59
+ };
60
+ } | {
61
+ dialect: Verify<Dialect, "mysql">;
89
62
  dbCredentials: {
90
63
  host: string;
91
64
  port?: number;
92
65
  user?: string;
93
66
  password?: string;
94
67
  database: string;
68
+ ssl?: string | SslOptions;
95
69
  } | {
96
- uri: string;
70
+ url: string;
97
71
  };
98
72
  } | {
99
- driver: "d1";
73
+ dialect: Verify<Dialect, "sqlite">;
74
+ driver: Verify<Driver, "d1">;
100
75
  dbCredentials: {
101
76
  wranglerConfigPath: string;
102
77
  dbName: string;
103
78
  };
104
79
  } | {
105
- driver: "expo";
80
+ dialect: Verify<Dialect, "sqlite">;
81
+ driver: Verify<Driver, "expo">;
106
82
  } | {});
107
- export declare function defineConfig(config: Config): Config;
83
+ declare function defineConfig(config: Config): Config;
84
+
85
+ export { type Config, defineConfig };
package/index.d.ts CHANGED
@@ -1,79 +1,44 @@
1
- export type DbConnection = {
2
- driver: "turso";
3
- dbCredentials: {
4
- url: string;
5
- authToken?: string;
6
- };
7
- } | {
8
- driver: "better-sqlite";
9
- dbCredentials: {
10
- url: string;
11
- };
12
- } | {
13
- driver: "libsql";
14
- dbCredentials: {
15
- url: string;
16
- };
17
- } | {
18
- driver: "d1";
19
- dbCredentials: {
20
- wranglerConfigPath: string;
21
- dbName: string;
22
- };
23
- } | {
24
- driver: "pg";
25
- dbCredentials: {
26
- host: string;
27
- port?: number;
28
- user?: string;
29
- password?: string;
30
- database: string;
31
- ssl?: boolean;
32
- } | {
33
- connectionString: string;
34
- };
35
- } | {
36
- driver: "mysql2";
37
- dbCredentials: {
38
- host: string;
39
- port?: number;
40
- user?: string;
41
- password?: string;
42
- database: string;
43
- } | {
44
- uri: string;
45
- };
46
- };
47
- export type Config = {
48
- out?: string | undefined;
49
- breakpoints?: boolean | undefined;
50
- tablesFilter?: string | string[] | undefined;
51
- schemaFilter?: string | string[] | undefined;
1
+ import { SslOptions } from 'mysql2';
2
+ import * as zod from 'zod';
3
+ import { TypeOf } from 'zod';
4
+
5
+ declare const driver: zod.ZodUnion<[zod.ZodUnion<[zod.ZodLiteral<"better-sqlite">, zod.ZodLiteral<"turso">, zod.ZodLiteral<"libsql">, zod.ZodLiteral<"d1">, zod.ZodLiteral<"expo">]>, zod.ZodLiteral<"aws-data-api">, zod.ZodLiteral<"mysql2">]>;
6
+ type Driver = TypeOf<typeof driver>;
7
+
8
+ declare const dialect: zod.ZodEnum<["postgresql", "mysql", "sqlite"]>;
9
+ type Dialect = TypeOf<typeof dialect>;
10
+
11
+ type Verify<T, U extends T> = U;
12
+ type Config = {
13
+ dialect: Dialect;
14
+ out?: string;
15
+ breakpoints?: boolean;
16
+ tablesFilter?: string | string[];
17
+ schemaFilter?: string | string[];
52
18
  schema?: string | string[];
53
- verbose?: boolean | undefined;
54
- strict?: boolean | undefined;
55
- } & {
19
+ verbose?: boolean;
20
+ strict?: boolean;
21
+ migrations?: {
22
+ table?: string;
23
+ schema?: string;
24
+ };
56
25
  introspect?: {
57
26
  casing: "camel" | "preserve";
58
27
  };
59
28
  } & ({
60
- driver: "turso";
29
+ dialect: Verify<Dialect, "sqlite">;
30
+ driver: Verify<Driver, "turso">;
61
31
  dbCredentials: {
62
32
  url: string;
63
33
  authToken?: string;
64
34
  };
65
35
  } | {
66
- driver: "better-sqlite";
67
- dbCredentials: {
68
- url: string;
69
- };
70
- } | {
71
- driver: "libsql";
36
+ dialect: "sqlite";
72
37
  dbCredentials: {
73
38
  url: string;
74
39
  };
75
40
  } | {
76
- driver: "pg";
41
+ dialect: Verify<Dialect, "postgresql">;
77
42
  dbCredentials: {
78
43
  host: string;
79
44
  port?: number;
@@ -82,26 +47,39 @@ export type Config = {
82
47
  database: string;
83
48
  ssl?: boolean;
84
49
  } | {
85
- connectionString: string;
50
+ url: string;
86
51
  };
87
52
  } | {
88
- driver: "mysql2";
53
+ dialect: Verify<Dialect, "postgresql">;
54
+ driver: Verify<Driver, "aws-data-api">;
55
+ dbCredentials: {
56
+ database: string;
57
+ secretArn: string;
58
+ resourceArn: string;
59
+ };
60
+ } | {
61
+ dialect: Verify<Dialect, "mysql">;
89
62
  dbCredentials: {
90
63
  host: string;
91
64
  port?: number;
92
65
  user?: string;
93
66
  password?: string;
94
67
  database: string;
68
+ ssl?: string | SslOptions;
95
69
  } | {
96
- uri: string;
70
+ url: string;
97
71
  };
98
72
  } | {
99
- driver: "d1";
73
+ dialect: Verify<Dialect, "sqlite">;
74
+ driver: Verify<Driver, "d1">;
100
75
  dbCredentials: {
101
76
  wranglerConfigPath: string;
102
77
  dbName: string;
103
78
  };
104
79
  } | {
105
- driver: "expo";
80
+ dialect: Verify<Dialect, "sqlite">;
81
+ driver: Verify<Driver, "expo">;
106
82
  } | {});
107
- export declare function defineConfig(config: Config): Config;
83
+ declare function defineConfig(config: Config): Config;
84
+
85
+ export { type Config, defineConfig };
package/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.20.17",
3
+ "version": "0.20.18-d190692",
4
4
  "repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
5
5
  "author": "Drizzle Team",
6
6
  "license": "MIT",
@@ -8,57 +8,21 @@
8
8
  "drizzle-kit": "./bin.cjs"
9
9
  },
10
10
  "scripts": {
11
- "test:pg:push": "drizzle-kit push:pg",
12
11
  "payload": "tsx ./dev/payload.ts",
13
12
  "migrate:old": "drizzle-kit generate:mysql",
14
- "push": "node -r esbuild-register ./src/cli/index.ts push:mysql",
15
- "push:sqlite": "node -r ./src/loader.mjs ./src/cli/index.ts push:sqlite",
16
- "try1": "tsx ./src/t.ts",
17
- "migrate:old:mysql": "drizzle-kit generate:mysql --out ./dev/migrations-mysql --schema ./dev/migrations-mysql/schema.ts",
18
- "start:pg": "node -r esbuild-register ./src/cli/index.ts generate:pg",
19
- "start:sqlite": "node -r esbuild-register ./src/cli/index.ts generate:sqlite",
20
- "start:mysql": "node -r esbuild-register ./src/cli/index.ts generate:mysql",
21
- "check:pg": "node -r esbuild-register ./src/cli/index.ts check --out ./dev/migrations --dialect pg",
22
- "introspect:mysql": "node -r esbuild-register ./src/cli/index.ts introspect:mysql --config drizzle.config2.ts",
23
- "introspect:sqlite": "node -r esbuild-register ./src/cli/index.ts introspect:sqlite --driver=sqlite",
24
- "introspect:pg": "node -r esbuild-register ./src/cli/index.ts introspect:pg --out ./dev/introspect-pg --connectionString=postgresql://postgres@localhost:5432/introspect",
25
- "drop": "node -r esbuild-register ./src/cli/index.ts drop",
26
- "up:pg": "node -r esbuild-register ./src/cli/index.ts up:pg --out ./dev/migrations-pg",
27
- "up:mysql": "node -r esbuild-register ./src/cli/index.ts up:mysql --out ./dev/migrations-mysql",
28
- "check:equedi": "node -r esbuild-register ./src/cli/index.ts check --out ./dev/equedi --dialect pg",
29
- "run": "node -r esbuild-register index.ts",
30
- "watch": "esbuild ./src/clie/index.ts --bundle --platform=node --target=node10.4 --outfile=./dist/index.js --external:esbuild --external:pg-native --sourcemap --watch",
31
- "diff": "esbuild ./src/clie/index.ts ./dev/diff.ts",
32
- "prepare:mysql": "node -r esbuild-register dev/mysql/index.ts",
33
- "prepare:pg": "node -r esbuild-register dev/index.ts",
34
- "prepare-snapshot": "node -r esbuild-register ./dev/prepare-snapshot prepare ./dev/data",
35
- "sim": "node -r esbuild-register ./dev/simulate.ts",
36
- "sim:sqlite": "node -r esbuild-register ./dev/sqlite/index.ts",
37
- "test": "ava test --timeout=60s",
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 && cp dist/payload.d.ts dist/payload.d.mts",
13
+ "cli": "tsx ./src/cli/index.ts",
14
+ "test": "vitest",
15
+ "build": "rm -rf ./dist && tsx build.ts && cp package.json dist/ && attw --pack dist",
40
16
  "build:dev": "rm -rf ./dist && tsx build.dev.ts && tsc -p tsconfig.cli-types.json && chmod +x ./dist/index.cjs",
41
17
  "packit": "pnpm build && cp package.json dist/ && cd dist && pnpm pack",
42
18
  "tsc": "tsc -p tsconfig.build.json",
43
- "pub": "cp package.json readme.md dist/ && cd dist && npm publish",
44
- "studio": "tsx ./src/cli/index.ts studio --verbose --port=3000",
45
- "studio:dev": "tsx ./src/cli/index.ts studio --verbose"
46
- },
47
- "ava": {
48
- "files": [
49
- "test/**/*.ts"
50
- ],
51
- "extensions": {
52
- "ts": "module"
53
- },
54
- "nodeArguments": [
55
- "--loader=tsx"
56
- ]
19
+ "pub": "cp package.json readme.md dist/ && cd dist && npm publish"
57
20
  },
58
21
  "dependencies": {
59
22
  "@esbuild-kit/esm-loader": "^2.5.5",
60
23
  "@hono/node-server": "^1.9.0",
61
24
  "@hono/zod-validator": "^0.2.0",
25
+ "@types/json-diff": "^1.0.3",
62
26
  "camelcase": "^7.0.1",
63
27
  "chalk": "^5.2.0",
64
28
  "commander": "^9.4.1",
@@ -70,40 +34,55 @@
70
34
  "hono": "^4.1.4",
71
35
  "json-diff": "0.9.0",
72
36
  "minimatch": "^7.4.3",
37
+ "pluralize": "^8.0.0",
73
38
  "semver": "^7.5.4",
74
39
  "superjson": "^2.2.1",
40
+ "ws": "^8.16.0",
75
41
  "zod": "^3.20.2"
76
42
  },
77
43
  "devDependencies": {
44
+ "@arethetypeswrong/cli": "^0.15.3",
45
+ "@aws-sdk/client-rds-data": "^3.556.0",
78
46
  "@cloudflare/workers-types": "^4.20230518.0",
47
+ "@electric-sql/pglite": "^0.1.3",
79
48
  "@libsql/client": "^0.4.2",
49
+ "@neondatabase/serverless": "^0.9.1",
50
+ "@originjs/vite-plugin-commonjs": "^1.0.3",
51
+ "@planetscale/database": "^1.16.0",
80
52
  "@types/better-sqlite3": "^7.6.4",
81
- "@types/dockerode": "^3.3.14",
53
+ "@types/dockerode": "^3.3.28",
82
54
  "@types/glob": "^8.1.0",
83
55
  "@types/minimatch": "^5.1.2",
84
56
  "@types/node": "^18.11.15",
85
57
  "@types/pg": "^8.10.7",
58
+ "@types/pluralize": "^0.0.33",
86
59
  "@types/semver": "^7.5.5",
87
- "@typescript-eslint/eslint-plugin": "^5.46.1",
88
- "@typescript-eslint/parser": "^5.46.1",
60
+ "@types/uuid": "^9.0.8",
61
+ "@types/ws": "^8.5.10",
62
+ "@typescript-eslint/eslint-plugin": "^7.2.0",
63
+ "@typescript-eslint/parser": "^7.2.0",
64
+ "@vercel/postgres": "^0.8.0",
89
65
  "ava": "^5.1.0",
90
66
  "better-sqlite3": "^9.4.3",
91
67
  "dockerode": "^3.3.4",
92
68
  "dotenv": "^16.0.3",
93
69
  "drizzle-kit": "0.20.14",
94
- "drizzle-orm": "0.30.5",
70
+ "drizzle-orm": "0.30.9-f9be0ab",
95
71
  "esbuild-node-externals": "^1.9.0",
96
- "eslint": "^8.29.0",
97
- "eslint-config-prettier": "^8.5.0",
98
- "eslint-plugin-prettier": "^4.2.1",
72
+ "eslint": "^8.57.0",
73
+ "eslint-config-prettier": "^9.1.0",
74
+ "eslint-plugin-prettier": "^5.1.3",
99
75
  "get-port": "^6.1.2",
100
76
  "mysql2": "2.3.3",
101
77
  "pg": "^8.11.3",
102
- "postgres": "^3.3.5",
78
+ "postgres": "^3.4.4",
103
79
  "prettier": "^2.8.1",
80
+ "tsup": "^8.0.2",
104
81
  "tsx": "^3.12.1",
105
- "typescript": "^4.9.4",
106
- "uvu": "^0.5.6",
82
+ "typescript": "^5.4.3",
83
+ "uuid": "^9.0.1",
84
+ "vite-tsconfig-paths": "^4.3.2",
85
+ "vitest": "^1.4.0",
107
86
  "wrangler": "^3.22.1",
108
87
  "zx": "^7.2.2"
109
88
  },
@@ -120,18 +99,6 @@
120
99
  "types": "./index.d.mts",
121
100
  "default": "./index.mjs"
122
101
  },
123
- "./utils-studio": {
124
- "import": {
125
- "types": "./utils-studio.d.mts",
126
- "default": "./utils-studio.mjs"
127
- },
128
- "require": {
129
- "types": "./utils-studio.d.ts",
130
- "default": "./utils-studio.js"
131
- },
132
- "types": "./utils-studio.d.mts",
133
- "default": "./utils-studio.mjs"
134
- },
135
102
  "./payload": {
136
103
  "import": {
137
104
  "types": "./payload.d.mts",