drizzle-kit 0.20.14-a183d8b → 0.20.14-b6f235e

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. package/bin.cjs +20571 -19934
  2. package/cli/commands/migrate.d.ts +114 -90
  3. package/cli/commands/mysqlIntrospect.d.ts +8 -14
  4. package/cli/commands/pgIntrospect.d.ts +17 -10
  5. package/cli/commands/sqliteIntrospect.d.ts +8 -8
  6. package/cli/commands/utils.d.ts +5 -5
  7. package/cli/{index.d.ts → validations/cli.d.ts} +33 -20
  8. package/cli/validations/common.d.ts +1 -1
  9. package/cli/views.d.ts +6 -4
  10. package/global.d.ts +3 -1
  11. package/index.js +1 -0
  12. package/introspect-pg.d.ts +4 -1
  13. package/jsonDiffer.d.ts +14 -29
  14. package/jsonStatements.d.ts +38 -11
  15. package/package.json +18 -50
  16. package/payload.js +7697 -8205
  17. package/payload.mjs +6841 -7355
  18. package/schemaValidator.d.ts +72 -69
  19. package/serializer/mysqlImports.d.ts +3 -7
  20. package/serializer/mysqlSchema.d.ts +1624 -493
  21. package/serializer/mysqlSerializer.d.ts +2 -2
  22. package/serializer/pgImports.d.ts +2 -2
  23. package/serializer/pgSchema.d.ts +1260 -801
  24. package/serializer/sqliteImports.d.ts +2 -4
  25. package/serializer/sqliteSchema.d.ts +144 -570
  26. package/serializer/sqliteSerializer.d.ts +1 -1
  27. package/snapshotsDiffer.d.ts +1908 -1050
  28. package/utils/words.d.ts +1 -1
  29. package/utils-studio.js +4144 -85
  30. package/utils-studio.mjs +4144 -85
  31. package/utils.d.ts +6 -140
  32. package/utils.js +4112 -7326
  33. package/utils.mjs +4195 -7409
  34. package/cli/commands/check.d.ts +0 -2
  35. package/cli/commands/drop.d.ts +0 -4
  36. package/cli/commands/mysqlUp.d.ts +0 -4
  37. package/cli/commands/pgUp.d.ts +0 -4
  38. package/cli/commands/push.d.ts +0 -6
  39. package/cli/commands/sqliteUp.d.ts +0 -2
  40. package/cli/commands/upFolders.d.ts +0 -27
  41. package/cli/utils.d.ts +0 -12
  42. package/cli/validations/studio.d.ts +0 -593
  43. package/orm-extenstions/d1-driver/driver.d.ts +0 -8
  44. package/orm-extenstions/d1-driver/session.d.ts +0 -51
  45. package/orm-extenstions/d1-driver/wrangler-client.d.ts +0 -3
  46. package/serializer/studioUtils.d.ts +0 -65
  47. package/utils/certs.d.ts +0 -4
@@ -1,4 +1,5 @@
1
- import { CommonSchema, CommonSquashedSchema, Dialect } from "../../schemaValidator";
1
+ import { Column, ColumnsResolverInput, ColumnsResolverOutput, Enum, ResolverInput, ResolverOutput, ResolverOutputWithMoved, Table } from "../../snapshotsDiffer";
2
+ import { CommonSchema } from "../../schemaValidator";
2
3
  import { schema } from "../views";
3
4
  import { PgSchema } from "../../serializer/pgSchema";
4
5
  import { SQLiteSchema } from "../../serializer/sqliteSchema";
@@ -10,9 +11,77 @@ export type Named = {
10
11
  };
11
12
  export type NamedWithSchema = {
12
13
  name: string;
13
- schema?: string;
14
+ schema: string;
14
15
  };
16
+ export declare const schemasResolver: (input: ResolverInput<Table>) => Promise<ResolverOutput<Table>>;
17
+ export declare const tablesResolver: (input: ResolverInput<Table>) => Promise<ResolverOutputWithMoved<Table>>;
18
+ export declare const enumsResolver: (input: ResolverInput<Enum>) => Promise<ResolverOutputWithMoved<Enum>>;
19
+ export declare const columnsResolver: (input: ColumnsResolverInput<Column>) => Promise<ColumnsResolverOutput<Column>>;
15
20
  export declare const prepareAndMigratePg: (config: GenerateConfig) => Promise<void>;
21
+ export declare const preparePgPush: (config: {
22
+ schema: string | string[];
23
+ }, snapshot: PgSchema, schemaFilter: string[]) => Promise<{
24
+ sqlStatements: string[];
25
+ statements: import("../../jsonStatements").JsonStatement[];
26
+ squashedPrev: {
27
+ tables: Record<string, {
28
+ name: string;
29
+ columns: Record<string, {
30
+ isUnique?: any;
31
+ default?: any;
32
+ typeSchema?: string | undefined;
33
+ uniqueName?: string | undefined;
34
+ nullsNotDistinct?: boolean | undefined;
35
+ name: string;
36
+ type: string;
37
+ primaryKey: boolean;
38
+ notNull: boolean;
39
+ }>;
40
+ indexes: Record<string, string>;
41
+ foreignKeys: Record<string, string>;
42
+ schema: string;
43
+ compositePrimaryKeys: Record<string, string>;
44
+ uniqueConstraints: Record<string, string>;
45
+ }>;
46
+ version: "6";
47
+ dialect: "pg";
48
+ schemas: Record<string, string>;
49
+ enums: Record<string, {
50
+ name: string;
51
+ values: string[];
52
+ schema: string;
53
+ }>;
54
+ };
55
+ squashedCur: {
56
+ tables: Record<string, {
57
+ name: string;
58
+ columns: Record<string, {
59
+ isUnique?: any;
60
+ default?: any;
61
+ typeSchema?: string | undefined;
62
+ uniqueName?: string | undefined;
63
+ nullsNotDistinct?: boolean | undefined;
64
+ name: string;
65
+ type: string;
66
+ primaryKey: boolean;
67
+ notNull: boolean;
68
+ }>;
69
+ indexes: Record<string, string>;
70
+ foreignKeys: Record<string, string>;
71
+ schema: string;
72
+ compositePrimaryKeys: Record<string, string>;
73
+ uniqueConstraints: Record<string, string>;
74
+ }>;
75
+ version: "6";
76
+ dialect: "pg";
77
+ schemas: Record<string, string>;
78
+ enums: Record<string, {
79
+ name: string;
80
+ values: string[];
81
+ schema: string;
82
+ }>;
83
+ };
84
+ }>;
16
85
  export declare const prepareMySQLPush: (config: {
17
86
  schema: string | string[];
18
87
  }, snapshot: MySqlSchema) => Promise<{
@@ -26,12 +95,7 @@ export declare const prepareMySQLPush: (config: {
26
95
  } | undefined>;
27
96
  } | undefined>;
28
97
  } | undefined;
29
- id: string;
30
- prevId: string;
31
- version: "5";
32
- dialect: "mysql";
33
98
  tables: Record<string, {
34
- schema?: string | undefined;
35
99
  name: string;
36
100
  columns: Record<string, {
37
101
  default?: any;
@@ -68,11 +132,13 @@ export declare const prepareMySQLPush: (config: {
68
132
  columns: string[];
69
133
  }>;
70
134
  }>;
71
- schemas: Record<string, string>;
135
+ id: string;
136
+ prevId: string;
137
+ version: "6";
138
+ dialect: "mysql";
72
139
  _meta: {
73
140
  columns: Record<string, string>;
74
141
  tables: Record<string, string>;
75
- schemas: Record<string, string>;
76
142
  };
77
143
  };
78
144
  validatedPrev: {
@@ -83,12 +149,7 @@ export declare const prepareMySQLPush: (config: {
83
149
  } | undefined>;
84
150
  } | undefined>;
85
151
  } | undefined;
86
- id: string;
87
- prevId: string;
88
- version: "5";
89
- dialect: "mysql";
90
152
  tables: Record<string, {
91
- schema?: string | undefined;
92
153
  name: string;
93
154
  columns: Record<string, {
94
155
  default?: any;
@@ -125,14 +186,18 @@ export declare const prepareMySQLPush: (config: {
125
186
  columns: string[];
126
187
  }>;
127
188
  }>;
128
- schemas: Record<string, string>;
189
+ id: string;
190
+ prevId: string;
191
+ version: "6";
192
+ dialect: "mysql";
129
193
  _meta: {
130
194
  columns: Record<string, string>;
131
195
  tables: Record<string, string>;
132
- schemas: Record<string, string>;
133
196
  };
134
197
  };
135
198
  }>;
199
+ export declare const prepareAndMigrateMysql: (config: GenerateConfig) => Promise<void>;
200
+ export declare const prepareAndMigrateSqlite: (config: GenerateConfig) => Promise<void>;
136
201
  export declare const prepareSQLitePush: (config: {
137
202
  schema: string | string[];
138
203
  }, snapshot: SQLiteSchema) => Promise<{
@@ -140,8 +205,6 @@ export declare const prepareSQLitePush: (config: {
140
205
  statements: import("../../jsonStatements").JsonStatement[];
141
206
  squashedPrev: {
142
207
  enums?: any;
143
- version: "5";
144
- dialect: "sqlite";
145
208
  tables: Record<string, {
146
209
  name: string;
147
210
  columns: Record<string, {
@@ -157,11 +220,11 @@ export declare const prepareSQLitePush: (config: {
157
220
  compositePrimaryKeys: Record<string, string>;
158
221
  uniqueConstraints: Record<string, string>;
159
222
  }>;
223
+ version: "5";
224
+ dialect: "sqlite";
160
225
  };
161
226
  squashedCur: {
162
227
  enums?: any;
163
- version: "5";
164
- dialect: "sqlite";
165
228
  tables: Record<string, {
166
229
  name: string;
167
230
  columns: Record<string, {
@@ -177,6 +240,8 @@ export declare const prepareSQLitePush: (config: {
177
240
  compositePrimaryKeys: Record<string, string>;
178
241
  uniqueConstraints: Record<string, string>;
179
242
  }>;
243
+ version: "5";
244
+ dialect: "sqlite";
180
245
  };
181
246
  meta: {
182
247
  schemas: {};
@@ -184,85 +249,44 @@ export declare const prepareSQLitePush: (config: {
184
249
  columns: {};
185
250
  } | undefined;
186
251
  }>;
187
- export declare const preparePgPush: (config: {
188
- schema: string | string[];
189
- }, snapshot: PgSchema, schemaFilter: string[]) => Promise<{
190
- sqlStatements: string[];
191
- statements: import("../../jsonStatements").JsonStatement[];
192
- squashedPrev: {
193
- version: "5";
194
- dialect: "pg";
195
- tables: Record<string, {
196
- name: string;
197
- columns: Record<string, {
198
- isUnique?: any;
199
- default?: any;
200
- uniqueName?: string | undefined;
201
- nullsNotDistinct?: boolean | undefined;
202
- name: string;
203
- type: string;
204
- primaryKey: boolean;
205
- notNull: boolean;
206
- }>;
207
- indexes: Record<string, string>;
208
- foreignKeys: Record<string, string>;
209
- schema: string;
210
- compositePrimaryKeys: Record<string, string>;
211
- uniqueConstraints: Record<string, string>;
212
- }>;
213
- schemas: Record<string, string>;
214
- enums: Record<string, {
215
- name: string;
216
- values: Record<string, string>;
217
- }>;
218
- };
219
- squashedCur: {
220
- version: "5";
221
- dialect: "pg";
222
- tables: Record<string, {
223
- name: string;
224
- columns: Record<string, {
225
- isUnique?: any;
226
- default?: any;
227
- uniqueName?: string | undefined;
228
- nullsNotDistinct?: boolean | undefined;
229
- name: string;
230
- type: string;
231
- primaryKey: boolean;
232
- notNull: boolean;
233
- }>;
234
- indexes: Record<string, string>;
235
- foreignKeys: Record<string, string>;
236
- schema: string;
237
- compositePrimaryKeys: Record<string, string>;
238
- uniqueConstraints: Record<string, string>;
239
- }>;
240
- schemas: Record<string, string>;
241
- enums: Record<string, {
242
- name: string;
243
- values: Record<string, string>;
244
- }>;
245
- };
252
+ export declare const promptColumnsConflicts: <T extends Named>(tableName: string, newColumns: T[], missingColumns: T[]) => Promise<{
253
+ created: T[];
254
+ renamed: {
255
+ from: T;
256
+ to: T;
257
+ }[];
258
+ deleted: T[];
246
259
  }>;
247
- export declare const prepareAndMigrateMySql: (config: GenerateConfig) => Promise<void>;
248
- export declare const prepareAndMigrateSqlite: (config: GenerateConfig) => Promise<void>;
249
- export declare const prepareSQL: (prev: CommonSquashedSchema, cur: CommonSquashedSchema, dialect: Dialect, prevFull?: any, curFull?: any) => Promise<{
250
- statements: import("../../jsonStatements").JsonStatement[];
251
- sqlStatements: string[];
252
- _meta: {
253
- schemas: {};
254
- tables: {};
255
- columns: {};
256
- } | undefined;
260
+ export declare const promptNamedWithSchemasConflict: <T extends NamedWithSchema>(newItems: T[], missingItems: T[], entity: "table" | "enum") => Promise<{
261
+ created: T[];
262
+ renamed: {
263
+ from: T;
264
+ to: T;
265
+ }[];
266
+ moved: {
267
+ name: string;
268
+ schemaFrom: string;
269
+ schemaTo: string;
270
+ }[];
271
+ deleted: T[];
272
+ }>;
273
+ export declare const promptSchemasConflict: <T extends Named>(newSchemas: T[], missingSchemas: T[]) => Promise<{
274
+ created: T[];
275
+ renamed: {
276
+ from: T;
277
+ to: T;
278
+ }[];
279
+ deleted: T[];
257
280
  }>;
258
281
  export declare const BREAKPOINT = "--> statement-breakpoint\n";
259
- export declare const writeResult: ({ cur, sqlStatements, journal, _meta, outFolder, breakpoints, bundle, type, }: {
282
+ export declare const writeResult: ({ cur, sqlStatements, journal, _meta, outFolder, breakpoints, name, bundle, type, }: {
260
283
  cur: CommonSchema;
261
284
  sqlStatements: string[];
262
285
  journal: Journal;
263
286
  _meta?: any;
264
287
  outFolder: string;
265
288
  breakpoints: boolean;
289
+ name?: string | undefined;
266
290
  bundle?: boolean | undefined;
267
291
  type?: "none" | "custom" | "introspect" | undefined;
268
292
  }) => void;
@@ -6,12 +6,7 @@ export declare const connectToMySQL: (config: MySQLConnectionConfig) => Promise<
6
6
  }>;
7
7
  export declare const mysqlIntrospect: (config: MySQLConfigIntrospect, filters: string[]) => Promise<{
8
8
  schema: {
9
- id: string;
10
- prevId: string;
11
- version: "5";
12
- dialect: "mysql";
13
9
  tables: Record<string, {
14
- schema?: string | undefined;
15
10
  name: string;
16
11
  columns: Record<string, {
17
12
  default?: any;
@@ -48,11 +43,13 @@ export declare const mysqlIntrospect: (config: MySQLConfigIntrospect, filters: s
48
43
  columns: string[];
49
44
  }>;
50
45
  }>;
51
- schemas: Record<string, string>;
46
+ id: string;
47
+ prevId: string;
48
+ version: "6";
49
+ dialect: "mysql";
52
50
  _meta: {
53
51
  columns: Record<string, string>;
54
52
  tables: Record<string, string>;
55
- schemas: Record<string, string>;
56
53
  };
57
54
  };
58
55
  ts: {
@@ -67,12 +64,7 @@ export declare const mysqlPushIntrospect: (connection: {
67
64
  databaseName: string;
68
65
  }, filters: string[]) => Promise<{
69
66
  schema: {
70
- id: string;
71
- prevId: string;
72
- version: "5";
73
- dialect: "mysql";
74
67
  tables: Record<string, {
75
- schema?: string | undefined;
76
68
  name: string;
77
69
  columns: Record<string, {
78
70
  default?: any;
@@ -109,11 +101,13 @@ export declare const mysqlPushIntrospect: (connection: {
109
101
  columns: string[];
110
102
  }>;
111
103
  }>;
112
- schemas: Record<string, string>;
104
+ id: string;
105
+ prevId: string;
106
+ version: "6";
107
+ dialect: "mysql";
113
108
  _meta: {
114
109
  columns: Record<string, string>;
115
110
  tables: Record<string, string>;
116
- schemas: Record<string, string>;
117
111
  };
118
112
  };
119
113
  }>;
@@ -5,15 +5,12 @@ export declare const pgPushIntrospect: (connection: {
5
5
  client: DrizzleDbClient;
6
6
  }, filters: string[], schemaFilters: string[]) => Promise<{
7
7
  schema: {
8
- id: string;
9
- prevId: string;
10
- version: "5";
11
- dialect: "pg";
12
8
  tables: Record<string, {
13
9
  name: string;
14
10
  columns: Record<string, {
15
11
  isUnique?: any;
16
12
  default?: any;
13
+ typeSchema?: string | undefined;
17
14
  uniqueName?: string | undefined;
18
15
  nullsNotDistinct?: boolean | undefined;
19
16
  name: string;
@@ -47,6 +44,10 @@ export declare const pgPushIntrospect: (connection: {
47
44
  nullsNotDistinct: boolean;
48
45
  }>;
49
46
  }>;
47
+ id: string;
48
+ prevId: string;
49
+ version: "6";
50
+ dialect: "pg";
50
51
  schemas: Record<string, string>;
51
52
  _meta: {
52
53
  columns: Record<string, string>;
@@ -55,21 +56,19 @@ export declare const pgPushIntrospect: (connection: {
55
56
  };
56
57
  enums: Record<string, {
57
58
  name: string;
58
- values: Record<string, string>;
59
+ values: string[];
60
+ schema: string;
59
61
  }>;
60
62
  };
61
63
  }>;
62
64
  export declare const pgIntrospect: (config: PgConfigIntrospect, filters: string[], schemaFilters: string[]) => Promise<{
63
65
  schema: {
64
- id: string;
65
- prevId: string;
66
- version: "5";
67
- dialect: "pg";
68
66
  tables: Record<string, {
69
67
  name: string;
70
68
  columns: Record<string, {
71
69
  isUnique?: any;
72
70
  default?: any;
71
+ typeSchema?: string | undefined;
73
72
  uniqueName?: string | undefined;
74
73
  nullsNotDistinct?: boolean | undefined;
75
74
  name: string;
@@ -103,6 +102,10 @@ export declare const pgIntrospect: (config: PgConfigIntrospect, filters: string[
103
102
  nullsNotDistinct: boolean;
104
103
  }>;
105
104
  }>;
105
+ id: string;
106
+ prevId: string;
107
+ version: "6";
108
+ dialect: "pg";
106
109
  schemas: Record<string, string>;
107
110
  _meta: {
108
111
  columns: Record<string, string>;
@@ -111,7 +114,8 @@ export declare const pgIntrospect: (config: PgConfigIntrospect, filters: string[
111
114
  };
112
115
  enums: Record<string, {
113
116
  name: string;
114
- values: Record<string, string>;
117
+ values: string[];
118
+ schema: string;
115
119
  }>;
116
120
  };
117
121
  ts: {
@@ -120,4 +124,7 @@ export declare const pgIntrospect: (config: PgConfigIntrospect, filters: string[
120
124
  decalrations: string;
121
125
  schemaEntry: string;
122
126
  };
127
+ relationsTs: {
128
+ file: string;
129
+ };
123
130
  }>;
@@ -7,10 +7,6 @@ export declare const connectToSQLite: (config: SQLiteConnectionConfig) => Promis
7
7
  }>;
8
8
  export declare const sqliteIntrospect: (config: SQLiteCliConfig, filters: string[]) => Promise<{
9
9
  schema: {
10
- id: string;
11
- prevId: string;
12
- version: "5";
13
- dialect: "sqlite";
14
10
  tables: Record<string, {
15
11
  name: string;
16
12
  columns: Record<string, {
@@ -45,6 +41,10 @@ export declare const sqliteIntrospect: (config: SQLiteCliConfig, filters: string
45
41
  columns: string[];
46
42
  }>;
47
43
  }>;
44
+ id: string;
45
+ prevId: string;
46
+ version: "5";
47
+ dialect: "sqlite";
48
48
  _meta: {
49
49
  columns: Record<string, string>;
50
50
  tables: Record<string, string>;
@@ -60,10 +60,6 @@ export declare const sqliteIntrospect: (config: SQLiteCliConfig, filters: string
60
60
  }>;
61
61
  export declare const sqlitePushIntrospect: (client: DrizzleDbClient, filters: string[]) => Promise<{
62
62
  schema: {
63
- id: string;
64
- prevId: string;
65
- version: "5";
66
- dialect: "sqlite";
67
63
  tables: Record<string, {
68
64
  name: string;
69
65
  columns: Record<string, {
@@ -98,6 +94,10 @@ export declare const sqlitePushIntrospect: (client: DrizzleDbClient, filters: st
98
94
  columns: string[];
99
95
  }>;
100
96
  }>;
97
+ id: string;
98
+ prevId: string;
99
+ version: "5";
100
+ dialect: "sqlite";
101
101
  _meta: {
102
102
  columns: Record<string, string>;
103
103
  tables: Record<string, string>;
@@ -1,9 +1,9 @@
1
- import { CliConfigGenerate, CliParamsPush } from "..";
2
1
  import { MySQLPushConfig } from "../validations/mysql";
3
2
  import { PgPushConfig } from "../validations/pg";
4
3
  import { SQLitePushConfig } from "../validations/sqlite";
5
4
  import { CliConfig } from "../validations/common";
6
5
  import { Dialect } from "src/schemaValidator";
6
+ import { CliCheckConfig, CliConfigGenerate, CliParamsPush } from "../validations/cli";
7
7
  export declare const safeRegister: () => Promise<{
8
8
  unregister: () => void;
9
9
  }>;
@@ -12,6 +12,7 @@ export type GenerateConfig = {
12
12
  schema: string | string[];
13
13
  out: string;
14
14
  breakpoints: boolean;
15
+ name?: string;
15
16
  custom: boolean;
16
17
  bundle: boolean;
17
18
  };
@@ -21,10 +22,9 @@ export declare const preparePushConfig: (options: CliParamsPush) => Promise<{
21
22
  schemaFiles: string[];
22
23
  tablesFilter: string[];
23
24
  }>;
24
- export declare const assertOutFolder: (it: {
25
- config?: string;
26
- } | {
25
+ export declare const assertOutFolder: (it: CliCheckConfig) => Promise<{
27
26
  out: string;
28
- }) => Promise<string>;
27
+ dialect: Dialect;
28
+ }>;
29
29
  export declare const drizzleConfigFromFile: (configPath?: string) => Promise<CliConfig>;
30
30
  export declare const readDrizzleConfig: (configPath?: string) => Promise<any>;
@@ -1,14 +1,14 @@
1
1
  import { TypeOf } from "zod";
2
- import "../@types/utils";
3
- import "dotenv/config";
4
- declare const cliConfigGenerate: import("zod").ZodObject<{
2
+ export declare const cliConfigGenerate: import("zod").ZodObject<{
5
3
  dialect: import("zod").ZodOptional<import("zod").ZodEnum<["pg", "mysql", "sqlite"]>>;
6
4
  schema: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
7
5
  out: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>;
8
6
  config: import("zod").ZodOptional<import("zod").ZodString>;
7
+ name: import("zod").ZodOptional<import("zod").ZodString>;
9
8
  breakpoints: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodBoolean>>;
10
9
  custom: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodBoolean>>;
11
10
  }, "strict", import("zod").ZodTypeAny, {
11
+ name?: string | undefined;
12
12
  schema?: string | string[] | undefined;
13
13
  dialect?: "mysql" | "pg" | "sqlite" | undefined;
14
14
  config?: string | undefined;
@@ -16,28 +16,29 @@ declare const cliConfigGenerate: import("zod").ZodObject<{
16
16
  out: string;
17
17
  breakpoints: boolean;
18
18
  }, {
19
+ name?: string | undefined;
19
20
  custom?: boolean | undefined;
20
21
  schema?: string | string[] | undefined;
21
22
  dialect?: "mysql" | "pg" | "sqlite" | undefined;
22
- out?: string | undefined;
23
23
  config?: string | undefined;
24
+ out?: string | undefined;
24
25
  breakpoints?: boolean | undefined;
25
26
  }>;
26
27
  export type CliConfigGenerate = TypeOf<typeof cliConfigGenerate>;
27
- declare const cliParamsPush: import("zod").ZodObject<{
28
+ export declare const cliParamsPush: import("zod").ZodObject<{
28
29
  config: import("zod").ZodOptional<import("zod").ZodString>;
29
30
  dialect: import("zod").ZodOptional<import("zod").ZodEnum<["pg", "mysql", "sqlite"]>>;
30
31
  schema: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
31
32
  tablesFilter: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
32
33
  driver: import("zod").ZodOptional<import("zod").ZodString>;
33
34
  connectionString: import("zod").ZodOptional<import("zod").ZodString>;
35
+ uri: import("zod").ZodOptional<import("zod").ZodString>;
34
36
  host: import("zod").ZodOptional<import("zod").ZodString>;
35
37
  port: import("zod").ZodOptional<import("zod").ZodString>;
36
38
  user: import("zod").ZodOptional<import("zod").ZodString>;
37
39
  password: import("zod").ZodOptional<import("zod").ZodString>;
38
40
  database: import("zod").ZodOptional<import("zod").ZodString>;
39
41
  ssl: import("zod").ZodOptional<import("zod").ZodString>;
40
- uri: import("zod").ZodOptional<import("zod").ZodString>;
41
42
  authToken: import("zod").ZodOptional<import("zod").ZodString>;
42
43
  verbose: import("zod").ZodOptional<import("zod").ZodBoolean>;
43
44
  strict: import("zod").ZodOptional<import("zod").ZodBoolean>;
@@ -55,9 +56,9 @@ declare const cliParamsPush: import("zod").ZodObject<{
55
56
  password?: string | undefined;
56
57
  database?: string | undefined;
57
58
  connectionString?: string | undefined;
58
- authToken?: string | undefined;
59
- ssl?: string | undefined;
60
59
  uri?: string | undefined;
60
+ ssl?: string | undefined;
61
+ authToken?: string | undefined;
61
62
  }, {
62
63
  strict?: boolean | undefined;
63
64
  schema?: string | string[] | undefined;
@@ -72,23 +73,35 @@ declare const cliParamsPush: import("zod").ZodObject<{
72
73
  password?: string | undefined;
73
74
  database?: string | undefined;
74
75
  connectionString?: string | undefined;
75
- authToken?: string | undefined;
76
- ssl?: string | undefined;
77
76
  uri?: string | undefined;
77
+ ssl?: string | undefined;
78
+ authToken?: string | undefined;
78
79
  }>;
79
80
  export type CliParamsPush = TypeOf<typeof cliParamsPush>;
80
- export declare const checkSchema: import("zod").ZodObject<{
81
+ export declare const configCheck: import("zod").ZodObject<{
82
+ dialect: import("zod").ZodOptional<import("zod").ZodEnum<["pg", "mysql", "sqlite"]>>;
81
83
  out: import("zod").ZodOptional<import("zod").ZodString>;
82
- config: import("zod").ZodOptional<import("zod").ZodString>;
83
- driver: import("zod").ZodOptional<import("zod").ZodString>;
84
- }, "strict", import("zod").ZodTypeAny, {
84
+ }, "strip", import("zod").ZodTypeAny, {
85
+ dialect?: "mysql" | "pg" | "sqlite" | undefined;
85
86
  out?: string | undefined;
86
- config?: string | undefined;
87
- driver?: string | undefined;
88
87
  }, {
88
+ dialect?: "mysql" | "pg" | "sqlite" | undefined;
89
89
  out?: string | undefined;
90
- config?: string | undefined;
91
- driver?: string | undefined;
92
90
  }>;
93
- export type CheckConfig = TypeOf<typeof checkSchema>;
94
- export {};
91
+ export declare const cliConfigCheck: import("zod").ZodIntersection<import("zod").ZodObject<{
92
+ config: import("zod").ZodOptional<import("zod").ZodString>;
93
+ }, "strip", import("zod").ZodTypeAny, {
94
+ config?: string | undefined;
95
+ }, {
96
+ config?: string | undefined;
97
+ }>, import("zod").ZodObject<{
98
+ dialect: import("zod").ZodOptional<import("zod").ZodEnum<["pg", "mysql", "sqlite"]>>;
99
+ out: import("zod").ZodOptional<import("zod").ZodString>;
100
+ }, "strip", import("zod").ZodTypeAny, {
101
+ dialect?: "mysql" | "pg" | "sqlite" | undefined;
102
+ out?: string | undefined;
103
+ }, {
104
+ dialect?: "mysql" | "pg" | "sqlite" | undefined;
105
+ out?: string | undefined;
106
+ }>>;
107
+ export type CliCheckConfig = TypeOf<typeof cliConfigCheck>;
@@ -1,5 +1,5 @@
1
1
  import { TypeOf } from "zod";
2
- export type Commands = "introspect:sqlite" | "introspect:pg" | "generate" | "check:pg" | "check:mysql" | "check:sqlite" | "up:pg" | "up:mysql" | "up:sqlite" | "drop" | "introspect:mysql" | "push";
2
+ export type Commands = "introspect:sqlite" | "introspect:pg" | "generate" | "check" | "up" | "drop" | "introspect:mysql" | "push";
3
3
  /**
4
4
  * This function checks an input from a user and if there are any params together with config path - return true
5
5
  * @param options - user input
package/cli/views.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Prompt, TaskView } from "hanji";
2
2
  import type { CommonSchema } from "../schemaValidator";
3
- import type { Named } from "./commands/migrate";
3
+ import type { Named, NamedWithSchema } from "./commands/migrate";
4
4
  export declare const warning: (msg: string) => void;
5
5
  export declare const err: (msg: string) => void;
6
6
  export declare const info: (msg: string, greyMsg?: string) => string;
@@ -10,7 +10,7 @@ export interface RenamePropmtItem<T> {
10
10
  from: T;
11
11
  to: T;
12
12
  }
13
- export declare const isRenamePromptItem: <T extends Named>(item: T | RenamePropmtItem<T>) => item is RenamePropmtItem<T>;
13
+ export declare const isRenamePromptItem: <T extends Named>(item: RenamePropmtItem<T> | T) => item is RenamePropmtItem<T>;
14
14
  export declare class ResolveColumnSelect<T extends Named> extends Prompt<RenamePropmtItem<T> | T> {
15
15
  private readonly tableName;
16
16
  private readonly base;
@@ -19,10 +19,12 @@ export declare class ResolveColumnSelect<T extends Named> extends Prompt<RenameP
19
19
  render(status: "idle" | "submitted" | "aborted"): string;
20
20
  result(): RenamePropmtItem<T> | T;
21
21
  }
22
- export declare class ResolveTableSelect<T extends Named> extends Prompt<RenamePropmtItem<T> | T> {
22
+ export declare const tableKey: (it: NamedWithSchema) => string;
23
+ export declare class ResolveSelect<T extends NamedWithSchema> extends Prompt<RenamePropmtItem<T> | T> {
23
24
  private readonly base;
25
+ private readonly entityType;
24
26
  private readonly state;
25
- constructor(base: Named, data: (RenamePropmtItem<T> | T)[]);
27
+ constructor(base: T, data: (RenamePropmtItem<T> | T)[], entityType: "table" | "enum");
26
28
  render(status: "idle" | "submitted" | "aborted"): string;
27
29
  result(): RenamePropmtItem<T> | T;
28
30
  }
package/global.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  export declare const originUUID = "00000000-0000-0000-0000-000000000000";
2
- export declare const snapshotVersion = "5";
2
+ export declare const snapshotVersion = "6";
3
3
  export declare function assertUnreachable(x: never): never;
4
4
  export declare const mapValues: <IN, OUT>(obj: Record<string, IN>, map: (input: IN) => OUT) => Record<string, OUT>;
5
+ export declare const mapKeys: <T>(obj: Record<string, T>, map: (key: string, value: T) => string) => Record<string, T>;
6
+ export declare const mapEntries: <T>(obj: Record<string, T>, map: (key: string, value: T) => [string, T]) => Record<string, T>;
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;