drizzle-kit 0.19.14-039355d → 0.20.0-3aac705

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. package/@types/utils.d.ts +12 -0
  2. package/cli/commands/migrate.d.ts +260 -0
  3. package/cli/commands/mysqlUp.d.ts +4 -0
  4. package/cli/commands/pgIntrospect.d.ts +118 -0
  5. package/cli/commands/pgPushUtils.d.ts +14 -0
  6. package/cli/commands/pgUp.d.ts +4 -0
  7. package/cli/commands/sqliteIntrospect.d.ts +102 -0
  8. package/cli/commands/sqliteUtils.d.ts +162 -0
  9. package/cli/commands/upFolders.d.ts +27 -0
  10. package/cli/commands/utils.d.ts +265 -0
  11. package/cli/selector-ui.d.ts +13 -0
  12. package/cli/validations/common.d.ts +13 -0
  13. package/cli/validations/mysql.d.ts +414 -0
  14. package/cli/validations/outputs.d.ts +40 -0
  15. package/cli/validations/pg.d.ts +438 -0
  16. package/cli/validations/sqlite.d.ts +220 -0
  17. package/cli/validations/studio.d.ts +548 -0
  18. package/cli/views.d.ts +61 -0
  19. package/drivers/index.d.ts +25 -0
  20. package/global.d.ts +2 -0
  21. package/index.cjs +28898 -37071
  22. package/index.d.ts +48 -0
  23. package/introspect.d.ts +4 -0
  24. package/jsonDiffer.d.ts +76 -0
  25. package/jsonStatements.d.ts +349 -0
  26. package/migrationPreparator.d.ts +35 -0
  27. package/orm-extenstions/d1-driver/driver.d.ts +8 -0
  28. package/orm-extenstions/d1-driver/session.d.ts +52 -0
  29. package/orm-extenstions/d1-driver/wrangler-client.d.ts +3 -0
  30. package/package.json +5 -4
  31. package/schemaValidator.d.ts +1306 -0
  32. package/serializer/index.d.ts +9 -0
  33. package/serializer/mysqlImports.d.ts +6 -0
  34. package/serializer/mysqlSchema.d.ts +3833 -0
  35. package/serializer/mysqlSerializer.d.ts +7 -0
  36. package/serializer/pgImports.d.ts +11 -0
  37. package/serializer/pgSchema.d.ts +4244 -0
  38. package/serializer/pgSerializer.d.ts +9 -0
  39. package/serializer/sqliteImports.d.ts +5 -0
  40. package/serializer/sqliteSchema.d.ts +3227 -0
  41. package/serializer/sqliteSerializer.d.ts +8 -0
  42. package/serializer/studioUtils.d.ts +35 -0
  43. package/snapshotsDiffer.d.ts +2660 -0
  44. package/sqlgenerator.d.ts +33 -0
  45. package/sqlite-introspect.d.ts +5 -0
  46. package/utils/words.d.ts +7 -0
  47. package/utils.d.ts +33 -0
  48. package/utils.js +51709 -11732
  49. package/utilsR.d.ts +232 -0
@@ -0,0 +1,27 @@
1
+ import { Dialect } from "src/schemaValidator";
2
+ import { Named, NamedWithSchema } from "./migrate";
3
+ export declare const resolveSchemas: <T extends Named>(missingSchemas: T[], newSchemas: T[], predicate: (leftMissing: T[], created: T) => T | undefined) => {
4
+ created: T[];
5
+ renamed: {
6
+ from: T;
7
+ to: T;
8
+ }[];
9
+ deleted: T[];
10
+ };
11
+ export declare const resolveTables: <T extends NamedWithSchema>(missingTables: T[], newTables: T[], resolver: (leftMissing: T[], created: T) => T | undefined) => {
12
+ created: T[];
13
+ renamed: {
14
+ from: T;
15
+ to: T;
16
+ }[];
17
+ deleted: T[];
18
+ };
19
+ export declare const resolveColumns: <T extends Named>(missingColumns: T[], newColumns: T[], predicate: (leftMissing: T[], created: T) => T | undefined) => {
20
+ created: T[];
21
+ renamed: {
22
+ from: T;
23
+ to: T;
24
+ }[];
25
+ deleted: T[];
26
+ };
27
+ export declare const upgradeFolders: (dialect: Dialect, out: string) => void;
@@ -0,0 +1,265 @@
1
+ import { TypeOf } from "zod";
2
+ export declare const safeRegister: () => {
3
+ unregister(): void;
4
+ };
5
+ export type GenerateConfig = {
6
+ schema: string | string[];
7
+ out: string;
8
+ breakpoints: boolean;
9
+ custom: boolean;
10
+ };
11
+ export declare const prepareGenerateConfig: (options: {
12
+ schema?: string | string[];
13
+ out?: string;
14
+ config?: string;
15
+ breakpoints: boolean;
16
+ custom: boolean;
17
+ }) => Promise<GenerateConfig>;
18
+ export declare const assertOutFolder: (it: {
19
+ config?: string;
20
+ } | {
21
+ out: string;
22
+ }) => Promise<string>;
23
+ export declare const configCommonSchema: import("zod").ZodObject<{
24
+ schema: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>;
25
+ out: import("zod").ZodOptional<import("zod").ZodString>;
26
+ breakpoints: import("zod").ZodDefault<import("zod").ZodBoolean>;
27
+ tablesFilter: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
28
+ schemaFilter: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
29
+ }, "strip", import("zod").ZodTypeAny, {
30
+ out?: string | undefined;
31
+ tablesFilter?: string | string[] | undefined;
32
+ schema: string | string[];
33
+ breakpoints: boolean;
34
+ schemaFilter: string | string[];
35
+ }, {
36
+ out?: string | undefined;
37
+ breakpoints?: boolean | undefined;
38
+ tablesFilter?: string | string[] | undefined;
39
+ schemaFilter?: string | string[] | undefined;
40
+ schema: string | string[];
41
+ }>;
42
+ export declare const introspectCasing: import("zod").ZodDefault<import("zod").ZodObject<{
43
+ casing: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodLiteral<"camel">, import("zod").ZodLiteral<"preserve">]>>;
44
+ }, "strip", import("zod").ZodTypeAny, {
45
+ casing: "camel" | "preserve";
46
+ }, {
47
+ casing?: "camel" | "preserve" | undefined;
48
+ }>>;
49
+ export declare const configIntrospectSchema: import("zod").ZodObject<{
50
+ schema: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
51
+ out: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>;
52
+ breakpoints: import("zod").ZodDefault<import("zod").ZodBoolean>;
53
+ tablesFilter: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
54
+ schemaFilter: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
55
+ introspect: import("zod").ZodDefault<import("zod").ZodObject<{
56
+ casing: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodLiteral<"camel">, import("zod").ZodLiteral<"preserve">]>>;
57
+ }, "strip", import("zod").ZodTypeAny, {
58
+ casing: "camel" | "preserve";
59
+ }, {
60
+ casing?: "camel" | "preserve" | undefined;
61
+ }>>;
62
+ }, "strip", import("zod").ZodTypeAny, {
63
+ schema?: string | string[] | undefined;
64
+ tablesFilter?: string | string[] | undefined;
65
+ out: string;
66
+ breakpoints: boolean;
67
+ schemaFilter: string | string[];
68
+ introspect: {
69
+ casing: "camel" | "preserve";
70
+ };
71
+ }, {
72
+ schema?: string | string[] | undefined;
73
+ out?: string | undefined;
74
+ breakpoints?: boolean | undefined;
75
+ tablesFilter?: string | string[] | undefined;
76
+ schemaFilter?: string | string[] | undefined;
77
+ introspect?: {
78
+ casing?: "camel" | "preserve" | undefined;
79
+ } | undefined;
80
+ }>;
81
+ export type ConfigIntrospectSchema = TypeOf<typeof configIntrospectSchema>;
82
+ export type ConfigIntrospectCasing = TypeOf<typeof introspectCasing>;
83
+ export declare const configIntrospectCliSchema: import("zod").ZodObject<{
84
+ schema: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
85
+ out: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>;
86
+ breakpoints: import("zod").ZodDefault<import("zod").ZodBoolean>;
87
+ tablesFilter: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
88
+ schemaFilter: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
89
+ introspectCasing: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodLiteral<"camel">, import("zod").ZodLiteral<"preserve">]>>;
90
+ }, "strip", import("zod").ZodTypeAny, {
91
+ schema?: string | string[] | undefined;
92
+ tablesFilter?: string | string[] | undefined;
93
+ out: string;
94
+ breakpoints: boolean;
95
+ schemaFilter: string | string[];
96
+ introspectCasing: "camel" | "preserve";
97
+ }, {
98
+ schema?: string | string[] | undefined;
99
+ out?: string | undefined;
100
+ breakpoints?: boolean | undefined;
101
+ tablesFilter?: string | string[] | undefined;
102
+ schemaFilter?: string | string[] | undefined;
103
+ introspectCasing?: "camel" | "preserve" | undefined;
104
+ }>;
105
+ export declare const configGenerateSchema: import("zod").ZodObject<{
106
+ schema: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>;
107
+ out: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>;
108
+ breakpoints: import("zod").ZodDefault<import("zod").ZodBoolean>;
109
+ }, "strip", import("zod").ZodTypeAny, {
110
+ schema: string | string[];
111
+ out: string;
112
+ breakpoints: boolean;
113
+ }, {
114
+ out?: string | undefined;
115
+ breakpoints?: boolean | undefined;
116
+ schema: string | string[];
117
+ }>;
118
+ export type GenerateSchema = TypeOf<typeof configGenerateSchema>;
119
+ export declare const configPushSchema: import("zod").ZodObject<{
120
+ schema: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>;
121
+ tablesFilter: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
122
+ schemaFilter: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
123
+ verbose: import("zod").ZodDefault<import("zod").ZodBoolean>;
124
+ strict: import("zod").ZodDefault<import("zod").ZodBoolean>;
125
+ }, "strip", import("zod").ZodTypeAny, {
126
+ tablesFilter?: string | string[] | undefined;
127
+ strict: boolean;
128
+ schema: string | string[];
129
+ schemaFilter: string | string[];
130
+ verbose: boolean;
131
+ }, {
132
+ strict?: boolean | undefined;
133
+ tablesFilter?: string | string[] | undefined;
134
+ schemaFilter?: string | string[] | undefined;
135
+ verbose?: boolean | undefined;
136
+ schema: string | string[];
137
+ }>;
138
+ export declare const mysqlConnectionSchema: import("zod").ZodUnion<[import("zod").ZodObject<{
139
+ host: import("zod").ZodString;
140
+ port: import("zod").ZodOptional<import("zod").ZodNumber>;
141
+ user: import("zod").ZodDefault<import("zod").ZodString>;
142
+ password: import("zod").ZodOptional<import("zod").ZodString>;
143
+ database: import("zod").ZodString;
144
+ }, "strip", import("zod").ZodTypeAny, {
145
+ port?: number | undefined;
146
+ password?: string | undefined;
147
+ host: string;
148
+ user: string;
149
+ database: string;
150
+ }, {
151
+ port?: number | undefined;
152
+ user?: string | undefined;
153
+ password?: string | undefined;
154
+ host: string;
155
+ database: string;
156
+ }>, import("zod").ZodObject<{
157
+ connectionString: import("zod").ZodString;
158
+ }, "strip", import("zod").ZodTypeAny, {
159
+ connectionString: string;
160
+ }, {
161
+ connectionString: string;
162
+ }>, import("zod").ZodObject<{}, "strip", import("zod").ZodTypeAny, {}, {}>]>;
163
+ export declare const mySqlCliConfigSchema: import("zod").ZodIntersection<import("zod").ZodObject<{
164
+ schema: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>;
165
+ out: import("zod").ZodOptional<import("zod").ZodString>;
166
+ breakpoints: import("zod").ZodDefault<import("zod").ZodBoolean>;
167
+ tablesFilter: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
168
+ schemaFilter: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
169
+ }, "strip", import("zod").ZodTypeAny, {
170
+ out?: string | undefined;
171
+ tablesFilter?: string | string[] | undefined;
172
+ schema: string | string[];
173
+ breakpoints: boolean;
174
+ schemaFilter: string | string[];
175
+ }, {
176
+ out?: string | undefined;
177
+ breakpoints?: boolean | undefined;
178
+ tablesFilter?: string | string[] | undefined;
179
+ schemaFilter?: string | string[] | undefined;
180
+ schema: string | string[];
181
+ }>, import("zod").ZodUnion<[import("zod").ZodObject<{
182
+ host: import("zod").ZodString;
183
+ port: import("zod").ZodOptional<import("zod").ZodNumber>;
184
+ user: import("zod").ZodDefault<import("zod").ZodString>;
185
+ password: import("zod").ZodOptional<import("zod").ZodString>;
186
+ database: import("zod").ZodString;
187
+ }, "strip", import("zod").ZodTypeAny, {
188
+ port?: number | undefined;
189
+ password?: string | undefined;
190
+ host: string;
191
+ user: string;
192
+ database: string;
193
+ }, {
194
+ port?: number | undefined;
195
+ user?: string | undefined;
196
+ password?: string | undefined;
197
+ host: string;
198
+ database: string;
199
+ }>, import("zod").ZodObject<{
200
+ connectionString: import("zod").ZodString;
201
+ }, "strip", import("zod").ZodTypeAny, {
202
+ connectionString: string;
203
+ }, {
204
+ connectionString: string;
205
+ }>, import("zod").ZodObject<{}, "strip", import("zod").ZodTypeAny, {}, {}>]>>;
206
+ export declare const mySqlIntrospectConfigSchema: import("zod").ZodIntersection<import("zod").ZodObject<{
207
+ schema: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
208
+ out: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>;
209
+ breakpoints: import("zod").ZodDefault<import("zod").ZodBoolean>;
210
+ tablesFilter: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
211
+ schemaFilter: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
212
+ introspect: import("zod").ZodDefault<import("zod").ZodObject<{
213
+ casing: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodLiteral<"camel">, import("zod").ZodLiteral<"preserve">]>>;
214
+ }, "strip", import("zod").ZodTypeAny, {
215
+ casing: "camel" | "preserve";
216
+ }, {
217
+ casing?: "camel" | "preserve" | undefined;
218
+ }>>;
219
+ }, "strip", import("zod").ZodTypeAny, {
220
+ schema?: string | string[] | undefined;
221
+ tablesFilter?: string | string[] | undefined;
222
+ out: string;
223
+ breakpoints: boolean;
224
+ schemaFilter: string | string[];
225
+ introspect: {
226
+ casing: "camel" | "preserve";
227
+ };
228
+ }, {
229
+ schema?: string | string[] | undefined;
230
+ out?: string | undefined;
231
+ breakpoints?: boolean | undefined;
232
+ tablesFilter?: string | string[] | undefined;
233
+ schemaFilter?: string | string[] | undefined;
234
+ introspect?: {
235
+ casing?: "camel" | "preserve" | undefined;
236
+ } | undefined;
237
+ }>, import("zod").ZodUnion<[import("zod").ZodObject<{
238
+ host: import("zod").ZodString;
239
+ port: import("zod").ZodOptional<import("zod").ZodNumber>;
240
+ user: import("zod").ZodDefault<import("zod").ZodString>;
241
+ password: import("zod").ZodOptional<import("zod").ZodString>;
242
+ database: import("zod").ZodString;
243
+ }, "strip", import("zod").ZodTypeAny, {
244
+ port?: number | undefined;
245
+ password?: string | undefined;
246
+ host: string;
247
+ user: string;
248
+ database: string;
249
+ }, {
250
+ port?: number | undefined;
251
+ user?: string | undefined;
252
+ password?: string | undefined;
253
+ host: string;
254
+ database: string;
255
+ }>, import("zod").ZodObject<{
256
+ connectionString: import("zod").ZodString;
257
+ }, "strip", import("zod").ZodTypeAny, {
258
+ connectionString: string;
259
+ }, {
260
+ connectionString: string;
261
+ }>, import("zod").ZodObject<{}, "strip", import("zod").ZodTypeAny, {}, {}>]>>;
262
+ export type MySqlCliConfig = TypeOf<typeof mySqlCliConfigSchema>;
263
+ export type CliConfig = MySqlCliConfig;
264
+ export declare const drizzleConfigFromFile: (configPath?: string) => Promise<CliConfig>;
265
+ export declare const readDrizzleConfig: (configPath?: string) => Promise<any>;
@@ -0,0 +1,13 @@
1
+ import { Prompt } from "hanji";
2
+ export declare class Select extends Prompt<{
3
+ index: number;
4
+ value: string;
5
+ }> {
6
+ private readonly data;
7
+ constructor(items: string[]);
8
+ render(status: "idle" | "submitted" | "aborted"): string;
9
+ result(): {
10
+ index: number;
11
+ value: string;
12
+ };
13
+ }
@@ -0,0 +1,13 @@
1
+ export type CollusionCheckOutput = {
2
+ success: boolean;
3
+ message?: string;
4
+ action: "config" | "cli" | "error";
5
+ };
6
+ export type Commands = "push:sqlite" | "introspect:sqlite" | "introspect:pg" | "generate:pg" | "generate:sqlite" | "generate:mysql" | "check:pg" | "check:mysql" | "check:sqlite" | "up:pg" | "up:mysql" | "up:sqlite" | "drop" | "introspect:mysql" | "push:mysql" | "push:pg";
7
+ /**
8
+ * This function checks an input from a user and if there are any params together with config path - return true
9
+ * @param options - user input
10
+ * @param inputWhitelist - whitelist some cli options that can be used together with config option
11
+ * @returns true if there was a collision, false if everything is valid
12
+ */
13
+ export declare const checkCollisions: (options: Record<string, unknown>, command: Commands, inputWhitelist?: string[]) => CollusionCheckOutput;