mutano 3.4.0 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -3
- package/dist/main.d.ts +6 -0
- package/dist/main.js +15423 -167
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Convert database schemas to TypeScript types, Zod schemas, or Kysely definitions.
|
|
4
4
|
|
|
5
|
-
- **Supports:** MySQL, PostgreSQL, SQLite, Prisma
|
|
5
|
+
- **Supports:** MySQL, PostgreSQL, SQLite, Prisma, **SQL DDL Files**
|
|
6
6
|
- **Features:** Views, Magic Comments, Type Overrides, Multiple Outputs
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
@@ -16,10 +16,10 @@ npm install mutano
|
|
|
16
16
|
```typescript
|
|
17
17
|
import { generate } from 'mutano'
|
|
18
18
|
|
|
19
|
-
// Basic usage
|
|
19
|
+
// Basic usage with database
|
|
20
20
|
await generate({
|
|
21
21
|
origin: {
|
|
22
|
-
type: 'mysql', // or 'postgres', 'sqlite', 'prisma'
|
|
22
|
+
type: 'mysql', // or 'postgres', 'sqlite', 'prisma', 'sql'
|
|
23
23
|
host: '127.0.0.1',
|
|
24
24
|
port: 3306,
|
|
25
25
|
user: 'root',
|
|
@@ -32,6 +32,19 @@ await generate({
|
|
|
32
32
|
}]
|
|
33
33
|
})
|
|
34
34
|
|
|
35
|
+
// Using SQL DDL files (no database required)
|
|
36
|
+
await generate({
|
|
37
|
+
origin: {
|
|
38
|
+
type: 'sql',
|
|
39
|
+
path: './schemas/myapp.sql', // Path to SQL file
|
|
40
|
+
dialect: 'mysql' // or 'postgres', 'sqlite'
|
|
41
|
+
},
|
|
42
|
+
destinations: [{
|
|
43
|
+
type: 'zod',
|
|
44
|
+
folder: './generated'
|
|
45
|
+
}]
|
|
46
|
+
})
|
|
47
|
+
|
|
35
48
|
// Multiple outputs
|
|
36
49
|
await generate({
|
|
37
50
|
origin: { /* ... */ },
|
|
@@ -129,6 +142,13 @@ export type UpdateableUser = Updateable<User>;
|
|
|
129
142
|
type: 'prisma',
|
|
130
143
|
path: string
|
|
131
144
|
}
|
|
145
|
+
|
|
146
|
+
// SQL DDL Files (no database required)
|
|
147
|
+
{
|
|
148
|
+
type: 'sql',
|
|
149
|
+
path: string, // Path to .sql file with CREATE TABLE statements
|
|
150
|
+
dialect: 'mysql' | 'postgres' | 'sqlite' // Determines type mappings
|
|
151
|
+
}
|
|
132
152
|
```
|
|
133
153
|
|
|
134
154
|
### Destination Options
|
package/dist/main.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ interface Desc {
|
|
|
7
7
|
Extra: string;
|
|
8
8
|
Null: string;
|
|
9
9
|
Type: string;
|
|
10
|
+
DataType?: string;
|
|
10
11
|
Comment: string;
|
|
11
12
|
EnumOptions?: string[];
|
|
12
13
|
}
|
|
@@ -40,6 +41,10 @@ interface Config {
|
|
|
40
41
|
origin: {
|
|
41
42
|
type: 'prisma';
|
|
42
43
|
path: string;
|
|
44
|
+
} | {
|
|
45
|
+
type: 'sql';
|
|
46
|
+
path: string;
|
|
47
|
+
dialect?: 'mysql' | 'postgres' | 'sqlite';
|
|
43
48
|
} | {
|
|
44
49
|
type: 'mysql';
|
|
45
50
|
host: string;
|
|
@@ -48,6 +53,7 @@ interface Config {
|
|
|
48
53
|
password: string;
|
|
49
54
|
database: string;
|
|
50
55
|
ssl?: Record<string, any>;
|
|
56
|
+
tinyIntAsBoolean?: boolean;
|
|
51
57
|
} | {
|
|
52
58
|
type: 'postgres';
|
|
53
59
|
host: string;
|