mutano 3.5.0 → 3.7.1

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 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
@@ -41,6 +41,10 @@ interface Config {
41
41
  origin: {
42
42
  type: 'prisma';
43
43
  path: string;
44
+ } | {
45
+ type: 'sql';
46
+ path: string;
47
+ dialect?: 'mysql' | 'postgres' | 'sqlite';
44
48
  } | {
45
49
  type: 'mysql';
46
50
  host: string;