drizzle-kit 0.20.17-cab52ad → 0.20.17-d71f2ee

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. package/@types/utils.d.ts +13 -0
  2. package/bin.cjs +372 -7335
  3. package/cli/commands/migrate.d.ts +287 -0
  4. package/cli/commands/mysqlIntrospect.d.ts +50 -0
  5. package/cli/commands/mysqlPushUtils.d.ts +14 -0
  6. package/cli/commands/pgIntrospect.d.ts +59 -0
  7. package/cli/commands/pgPushUtils.d.ts +11 -0
  8. package/cli/commands/sqliteIntrospect.d.ts +103 -0
  9. package/cli/commands/sqlitePushUtils.d.ts +15 -0
  10. package/cli/commands/utils.d.ts +180 -0
  11. package/cli/connections.d.ts +18 -0
  12. package/cli/selector-ui.d.ts +13 -0
  13. package/cli/utils.d.ts +13 -0
  14. package/cli/validations/cli.d.ts +169 -0
  15. package/cli/validations/common.d.ts +214 -0
  16. package/cli/validations/mysql.d.ts +29 -0
  17. package/cli/validations/outputs.d.ts +41 -0
  18. package/cli/validations/pg.d.ts +46 -0
  19. package/cli/validations/sqlite.d.ts +22 -0
  20. package/cli/validations/studio.d.ts +92 -0
  21. package/cli/views.d.ts +70 -0
  22. package/global.d.ts +6 -0
  23. package/index.d.mts +6 -14
  24. package/index.d.ts +6 -14
  25. package/introspect-sqlite.d.ts +10 -0
  26. package/jsonDiffer.d.ts +61 -0
  27. package/jsonStatements.d.ts +376 -0
  28. package/migrationPreparator.d.ts +35 -0
  29. package/package.json +16 -5
  30. package/payload.d.mts +18 -987
  31. package/payload.d.ts +18 -987
  32. package/payload.js +16831 -19058
  33. package/payload.mjs +16827 -19079
  34. package/schemaValidator.d.ts +1316 -0
  35. package/serializer/index.d.ts +9 -0
  36. package/serializer/mysqlImports.d.ts +7 -0
  37. package/serializer/mysqlSchema.d.ts +4650 -0
  38. package/serializer/mysqlSerializer.d.ts +7 -0
  39. package/serializer/pgImports.d.ts +11 -0
  40. package/serializer/pgSchema.d.ts +4792 -0
  41. package/serializer/pgSerializer.d.ts +7 -0
  42. package/serializer/schemaToDrizzle.d.ts +7 -0
  43. package/serializer/sqliteImports.d.ts +7 -0
  44. package/serializer/sqliteSchema.d.ts +2801 -0
  45. package/serializer/sqliteSerializer.d.ts +6 -0
  46. package/serializer/studio.d.ts +53 -0
  47. package/snapshotsDiffer.d.ts +3936 -0
  48. package/sqlgenerator.d.ts +33 -0
  49. package/utils/words.d.ts +7 -0
  50. package/utils-studio.d.mts +4 -0
  51. package/utils-studio.d.ts +4 -0
  52. package/utils.d.ts +78 -0
@@ -0,0 +1,41 @@
1
+ export declare const withStyle: {
2
+ error: (str: string) => string;
3
+ warning: (str: string) => string;
4
+ errorWarning: (str: string) => string;
5
+ fullWarning: (str: string) => string;
6
+ suggestion: (str: string) => string;
7
+ info: (str: string) => string;
8
+ };
9
+ export declare const outputs: {
10
+ studio: {
11
+ drivers: (param: string) => string;
12
+ noCredentials: () => string;
13
+ noDriver: () => string;
14
+ noDialect: () => string;
15
+ };
16
+ common: {
17
+ ambiguousParams: (command: string) => string;
18
+ schema: (command: string) => string;
19
+ };
20
+ postgres: {
21
+ connection: {
22
+ required: () => string;
23
+ awsDataApi: () => void;
24
+ };
25
+ };
26
+ mysql: {
27
+ connection: {
28
+ driver: () => string;
29
+ required: () => string;
30
+ };
31
+ };
32
+ sqlite: {
33
+ connection: {
34
+ driver: () => string;
35
+ url: (driver: string) => string;
36
+ authToken: (driver: string) => string;
37
+ };
38
+ introspect: {};
39
+ push: {};
40
+ };
41
+ };
@@ -0,0 +1,46 @@
1
+ import { TypeOf } from "zod";
2
+ export declare const postgresCredentials: import("zod").ZodUnion<[import("zod").ZodObject<{
3
+ host: import("zod").ZodString;
4
+ port: import("zod").ZodOptional<import("zod").ZodNumber>;
5
+ user: import("zod").ZodDefault<import("zod").ZodString>;
6
+ password: import("zod").ZodOptional<import("zod").ZodString>;
7
+ database: import("zod").ZodString;
8
+ ssl: import("zod").ZodOptional<import("zod").ZodBoolean>;
9
+ }, "strip", import("zod").ZodTypeAny, {
10
+ host: string;
11
+ user: string;
12
+ database: string;
13
+ port?: number | undefined;
14
+ password?: string | undefined;
15
+ ssl?: boolean | undefined;
16
+ }, {
17
+ host: string;
18
+ database: string;
19
+ port?: number | undefined;
20
+ user?: string | undefined;
21
+ password?: string | undefined;
22
+ ssl?: boolean | undefined;
23
+ }>, import("zod").ZodObject<{
24
+ url: import("zod").ZodString;
25
+ }, "strip", import("zod").ZodTypeAny, {
26
+ url: string;
27
+ }, {
28
+ url: string;
29
+ }>, import("zod").ZodObject<{
30
+ driver: import("zod").ZodLiteral<"aws-data-api">;
31
+ database: import("zod").ZodString;
32
+ secretArn: import("zod").ZodString;
33
+ resourceArn: import("zod").ZodString;
34
+ }, "strip", import("zod").ZodTypeAny, {
35
+ driver: "aws-data-api";
36
+ database: string;
37
+ secretArn: string;
38
+ resourceArn: string;
39
+ }, {
40
+ driver: "aws-data-api";
41
+ database: string;
42
+ secretArn: string;
43
+ resourceArn: string;
44
+ }>]>;
45
+ export type PostgresCredentials = TypeOf<typeof postgresCredentials>;
46
+ export declare const printConfigConnectionIssues: (options: Record<string, unknown>) => void;
@@ -0,0 +1,22 @@
1
+ import { TypeOf } from "zod";
2
+ export declare const sqliteCredentials: import("zod").ZodUnion<[import("zod").ZodObject<{
3
+ driver: import("zod").ZodLiteral<"turso">;
4
+ url: import("zod").ZodString;
5
+ authToken: import("zod").ZodString;
6
+ }, "strip", import("zod").ZodTypeAny, {
7
+ url: string;
8
+ driver: "turso";
9
+ authToken: string;
10
+ }, {
11
+ url: string;
12
+ driver: "turso";
13
+ authToken: string;
14
+ }>, import("zod").ZodObject<{
15
+ url: import("zod").ZodString;
16
+ }, "strip", import("zod").ZodTypeAny, {
17
+ url: string;
18
+ }, {
19
+ url: string;
20
+ }>]>;
21
+ export type SqliteCredentials = TypeOf<typeof sqliteCredentials>;
22
+ export declare const printConfigConnectionIssues: (options: Record<string, unknown>) => void;
@@ -0,0 +1,92 @@
1
+ import { TypeOf } from "zod";
2
+ export declare const credentials: import("zod").ZodIntersection<import("zod").ZodUnion<[import("zod").ZodObject<{
3
+ host: import("zod").ZodString;
4
+ port: import("zod").ZodOptional<import("zod").ZodNumber>;
5
+ user: import("zod").ZodDefault<import("zod").ZodString>;
6
+ password: import("zod").ZodOptional<import("zod").ZodString>;
7
+ database: import("zod").ZodString;
8
+ ssl: import("zod").ZodOptional<import("zod").ZodBoolean>;
9
+ }, "strip", import("zod").ZodTypeAny, {
10
+ host: string;
11
+ user: string;
12
+ database: string;
13
+ port?: number | undefined;
14
+ password?: string | undefined;
15
+ ssl?: boolean | undefined;
16
+ }, {
17
+ host: string;
18
+ database: string;
19
+ port?: number | undefined;
20
+ user?: string | undefined;
21
+ password?: string | undefined;
22
+ ssl?: boolean | undefined;
23
+ }>, import("zod").ZodObject<{
24
+ url: import("zod").ZodString;
25
+ }, "strip", import("zod").ZodTypeAny, {
26
+ url: string;
27
+ }, {
28
+ url: string;
29
+ }>, import("zod").ZodObject<{
30
+ driver: import("zod").ZodLiteral<"aws-data-api">;
31
+ database: import("zod").ZodString;
32
+ secretArn: import("zod").ZodString;
33
+ resourceArn: import("zod").ZodString;
34
+ }, "strip", import("zod").ZodTypeAny, {
35
+ driver: "aws-data-api";
36
+ database: string;
37
+ secretArn: string;
38
+ resourceArn: string;
39
+ }, {
40
+ driver: "aws-data-api";
41
+ database: string;
42
+ secretArn: string;
43
+ resourceArn: string;
44
+ }>]>, import("zod").ZodUnion<[import("zod").ZodObject<{
45
+ host: import("zod").ZodString;
46
+ port: import("zod").ZodOptional<import("zod").ZodNumber>;
47
+ user: import("zod").ZodDefault<import("zod").ZodString>;
48
+ password: import("zod").ZodOptional<import("zod").ZodString>;
49
+ database: import("zod").ZodString;
50
+ }, "strip", import("zod").ZodTypeAny, {
51
+ host: string;
52
+ user: string;
53
+ database: string;
54
+ port?: number | undefined;
55
+ password?: string | undefined;
56
+ }, {
57
+ host: string;
58
+ database: string;
59
+ port?: number | undefined;
60
+ user?: string | undefined;
61
+ password?: string | undefined;
62
+ }>, import("zod").ZodObject<{
63
+ url: import("zod").ZodString;
64
+ }, "strip", import("zod").ZodTypeAny, {
65
+ url: string;
66
+ }, {
67
+ url: string;
68
+ }>]>>;
69
+ export type Credentials = TypeOf<typeof credentials>;
70
+ export declare const studioCliParams: import("zod").ZodObject<{
71
+ port: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>;
72
+ host: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>;
73
+ config: import("zod").ZodOptional<import("zod").ZodString>;
74
+ }, "strip", import("zod").ZodTypeAny, {
75
+ host: string;
76
+ port: number;
77
+ config?: string | undefined;
78
+ }, {
79
+ config?: string | undefined;
80
+ host?: string | undefined;
81
+ port?: number | undefined;
82
+ }>;
83
+ export declare const studioConfig: import("zod").ZodObject<{
84
+ dialect: import("zod").ZodEnum<["postgresql", "mysql", "sqlite"]>;
85
+ schema: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>;
86
+ }, "strip", import("zod").ZodTypeAny, {
87
+ schema: string | string[];
88
+ dialect: "mysql" | "postgresql" | "sqlite";
89
+ }, {
90
+ schema: string | string[];
91
+ dialect: "mysql" | "postgresql" | "sqlite";
92
+ }>;
package/cli/views.d.ts ADDED
@@ -0,0 +1,70 @@
1
+ import { Prompt, TaskView } from "hanji";
2
+ import type { CommonSchema } from "../schemaValidator";
3
+ import type { Named, NamedWithSchema } from "./commands/migrate";
4
+ export declare const warning: (msg: string) => void;
5
+ export declare const err: (msg: string) => void;
6
+ export declare const info: (msg: string, greyMsg?: string) => string;
7
+ export declare const grey: (msg: string) => string;
8
+ export declare const error: (error: string, greyMsg?: string) => string;
9
+ export declare const schema: (schema: CommonSchema) => string;
10
+ export interface RenamePropmtItem<T> {
11
+ from: T;
12
+ to: T;
13
+ }
14
+ export declare const isRenamePromptItem: <T extends Named>(item: RenamePropmtItem<T> | T) => item is RenamePropmtItem<T>;
15
+ export declare class ResolveColumnSelect<T extends Named> extends Prompt<RenamePropmtItem<T> | T> {
16
+ private readonly tableName;
17
+ private readonly base;
18
+ private readonly data;
19
+ constructor(tableName: string, base: Named, data: (RenamePropmtItem<T> | T)[]);
20
+ render(status: "idle" | "submitted" | "aborted"): string;
21
+ result(): RenamePropmtItem<T> | T;
22
+ }
23
+ export declare const tableKey: (it: NamedWithSchema) => string;
24
+ export declare class ResolveSelect<T extends NamedWithSchema> extends Prompt<RenamePropmtItem<T> | T> {
25
+ private readonly base;
26
+ private readonly entityType;
27
+ private readonly state;
28
+ constructor(base: T, data: (RenamePropmtItem<T> | T)[], entityType: "table" | "enum");
29
+ render(status: "idle" | "submitted" | "aborted"): string;
30
+ result(): RenamePropmtItem<T> | T;
31
+ }
32
+ export declare class ResolveSchemasSelect<T extends Named> extends Prompt<RenamePropmtItem<T> | T> {
33
+ private readonly base;
34
+ private readonly state;
35
+ constructor(base: Named, data: (RenamePropmtItem<T> | T)[]);
36
+ render(status: "idle" | "submitted" | "aborted"): string;
37
+ result(): RenamePropmtItem<T> | T;
38
+ }
39
+ export type IntrospectStatus = "fetching" | "done";
40
+ export type IntrospectStage = "tables" | "columns" | "enums" | "indexes" | "fks";
41
+ export declare class IntrospectProgress extends TaskView {
42
+ private readonly spinner;
43
+ private timeout;
44
+ private state;
45
+ constructor();
46
+ update(stage: IntrospectStage, count: number, status: IntrospectStatus): void;
47
+ private formatCount;
48
+ private statusText;
49
+ render(): string;
50
+ }
51
+ export declare class MigrateProgress extends TaskView {
52
+ private readonly spinner;
53
+ private timeout;
54
+ constructor();
55
+ render(status: "pending" | "done"): string;
56
+ }
57
+ export declare class DropMigrationView<T extends {
58
+ tag: string;
59
+ }> extends Prompt<T> {
60
+ private readonly data;
61
+ constructor(data: T[]);
62
+ render(status: "idle" | "submitted" | "aborted"): string;
63
+ result(): T;
64
+ }
65
+ export declare const trimmedRange: <T>(arr: T[], index: number, limitLines: number) => {
66
+ trimmed: T[];
67
+ offset: number;
68
+ startTrimmed: boolean;
69
+ endTrimmed: boolean;
70
+ };
package/global.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ export declare const originUUID = "00000000-0000-0000-0000-000000000000";
2
+ export declare const snapshotVersion = "6";
3
+ export declare function assertUnreachable(x: never): never;
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.d.mts CHANGED
@@ -1,14 +1,7 @@
1
- import * as zod from 'zod';
2
- import { TypeOf } from 'zod';
3
-
4
- 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">]>;
5
- type Driver = TypeOf<typeof driver>;
6
-
7
- declare const dialect: zod.ZodEnum<["postgresql", "mysql", "sqlite"]>;
8
- type Dialect = TypeOf<typeof dialect>;
9
-
10
- type Verify<T, U extends T> = U;
11
- type Config = {
1
+ import type { Driver } from "./cli/validations/common";
2
+ import type { Dialect } from "./schemaValidator";
3
+ type Verify<T, U extends T> = T extends U ? U : never;
4
+ export type Config = {
12
5
  dialect: Dialect;
13
6
  out?: string;
14
7
  breakpoints?: boolean;
@@ -78,6 +71,5 @@ type Config = {
78
71
  dialect: Verify<Dialect, "sqlite">;
79
72
  driver: Verify<Driver, "expo">;
80
73
  } | {});
81
- declare function defineConfig(config: Config): Config;
82
-
83
- export { type Config, defineConfig };
74
+ export declare function defineConfig(config: Config): Config;
75
+ export {};
package/index.d.ts CHANGED
@@ -1,14 +1,7 @@
1
- import * as zod from 'zod';
2
- import { TypeOf } from 'zod';
3
-
4
- 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">]>;
5
- type Driver = TypeOf<typeof driver>;
6
-
7
- declare const dialect: zod.ZodEnum<["postgresql", "mysql", "sqlite"]>;
8
- type Dialect = TypeOf<typeof dialect>;
9
-
10
- type Verify<T, U extends T> = U;
11
- type Config = {
1
+ import type { Driver } from "./cli/validations/common";
2
+ import type { Dialect } from "./schemaValidator";
3
+ type Verify<T, U extends T> = T extends U ? U : never;
4
+ export type Config = {
12
5
  dialect: Dialect;
13
6
  out?: string;
14
7
  breakpoints?: boolean;
@@ -78,6 +71,5 @@ type Config = {
78
71
  dialect: Verify<Dialect, "sqlite">;
79
72
  driver: Verify<Driver, "expo">;
80
73
  } | {});
81
- declare function defineConfig(config: Config): Config;
82
-
83
- export { type Config, defineConfig };
74
+ export declare function defineConfig(config: Config): Config;
75
+ export {};
@@ -0,0 +1,10 @@
1
+ import "./@types/utils";
2
+ import type { Casing } from "./cli/validations/common";
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: Casing) => {
6
+ file: string;
7
+ imports: string;
8
+ decalrations: string;
9
+ schemaEntry: string;
10
+ };
@@ -0,0 +1,61 @@
1
+ export function diffForRenamedTables(pairs: any): any;
2
+ export function diffForRenamedColumn(t1: any, t2: any): any;
3
+ export function diffSchemasOrTables(left: any, right: any): {
4
+ added: any[];
5
+ deleted: any[];
6
+ };
7
+ export function diffColumns(left: any, right: any): {
8
+ [k: string]: any;
9
+ };
10
+ export function applyJsonDiff(json1: any, json2: any): {
11
+ alteredTablesWithColumns: {
12
+ name: any;
13
+ schema: any;
14
+ altered: any[];
15
+ addedIndexes: {
16
+ [k: string]: any;
17
+ };
18
+ deletedIndexes: {
19
+ [k: string]: any;
20
+ };
21
+ alteredIndexes: {
22
+ [k: string]: any;
23
+ };
24
+ addedForeignKeys: {
25
+ [k: string]: any;
26
+ };
27
+ deletedForeignKeys: {
28
+ [k: string]: any;
29
+ };
30
+ alteredForeignKeys: {
31
+ [k: string]: any;
32
+ };
33
+ addedCompositePKs: {
34
+ [k: string]: any;
35
+ };
36
+ deletedCompositePKs: {
37
+ [k: string]: any;
38
+ };
39
+ alteredCompositePKs: {
40
+ [k: string]: any;
41
+ };
42
+ addedUniqueConstraints: {
43
+ [k: string]: any;
44
+ };
45
+ deletedUniqueConstraints: {
46
+ [k: string]: any;
47
+ };
48
+ alteredUniqueConstraints: {
49
+ [k: string]: any;
50
+ };
51
+ }[];
52
+ alteredEnums: {
53
+ name: any;
54
+ schema: any;
55
+ addedValues: {
56
+ before: any;
57
+ value: any;
58
+ }[];
59
+ deletedValues: any[];
60
+ }[];
61
+ };