kysely-gen 0.6.0 → 0.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.
Files changed (3) hide show
  1. package/README.md +35 -2
  2. package/dist/cli.js +65995 -32
  3. package/package.json +16 -3
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Generate TypeScript types from your database for [Kysely](https://kysely.dev/).
4
4
 
5
- Supports PostgreSQL, MySQL, and SQLite.
5
+ Supports PostgreSQL, MySQL, SQLite, and MSSQL.
6
6
 
7
7
  ## Install
8
8
 
@@ -15,6 +15,9 @@ npm install kysely-gen kysely mysql2
15
15
 
16
16
  # SQLite
17
17
  npm install kysely-gen kysely better-sqlite3
18
+
19
+ # MSSQL
20
+ npm install kysely-gen kysely tedious tarn
18
21
  ```
19
22
 
20
23
  ## Usage
@@ -29,6 +32,10 @@ DATABASE_URL=mysql://user:pass@localhost:3306/db npx kysely-gen
29
32
  # SQLite (auto-detected from file extension)
30
33
  npx kysely-gen --url ./database.db
31
34
 
35
+ # MSSQL (auto-detected from URL or connection string)
36
+ npx kysely-gen --url "mssql://user:pass@localhost:1433/db"
37
+ npx kysely-gen --url "Server=localhost;Database=db;User Id=user;Password=pass"
38
+
32
39
  # Explicit dialect
33
40
  npx kysely-gen --dialect mysql --url mysql://user:pass@localhost:3306/db
34
41
  ```
@@ -37,7 +44,7 @@ npx kysely-gen --dialect mysql --url mysql://user:pass@localhost:3306/db
37
44
 
38
45
  | Option | Description |
39
46
  |--------|-------------|
40
- | `--dialect <name>` | Database dialect: `postgres`, `mysql`, or `sqlite` (auto-detected) |
47
+ | `--dialect <name>` | Database dialect: `postgres`, `mysql`, `sqlite`, or `mssql` (auto-detected) |
41
48
  | `--out <path>` | Output file (default: `./db.d.ts`) |
42
49
  | `--schema <name>` | Schema to introspect (repeatable) |
43
50
  | `--url <string>` | Database URL (overrides `DATABASE_URL`) |
@@ -97,6 +104,13 @@ export interface DB {
97
104
  - JSON columns mapped to `JsonValue`
98
105
  - Simple type affinity mapping (no ColumnType wrappers)
99
106
 
107
+ ### MSSQL
108
+ - `Generated<T>` for identity and computed columns
109
+ - Views
110
+ - Multi-schema support (default: `dbo`)
111
+ - All MSSQL types: `uniqueidentifier`, `datetime2`, `datetimeoffset`, `money`, `xml`, `varbinary`, etc.
112
+ - Both URL (`mssql://`) and ADO.NET connection string formats
113
+
100
114
  ## Type Mappings
101
115
 
102
116
  Types are generated to match the default behavior of each database driver. If you customize your driver's type parsers, the generated types may not match.
@@ -151,6 +165,25 @@ Generated types match `better-sqlite3` defaults. SQLite has simpler type affinit
151
165
  | `JSON` | `JsonValue` |
152
166
  | `BOOLEAN` | `number` (0/1) |
153
167
 
168
+ ### MSSQL
169
+
170
+ Generated types match `tedious` defaults. The driver handles type conversions, so simple types are used without `ColumnType` wrappers.
171
+
172
+ | MSSQL | TypeScript |
173
+ |-------|------------|
174
+ | `int`, `smallint`, `tinyint`, `bigint` | `number` |
175
+ | `decimal`, `numeric`, `money`, `smallmoney` | `number` |
176
+ | `float`, `real` | `number` |
177
+ | `datetime`, `datetime2`, `date`, `time` | `Date` |
178
+ | `datetimeoffset`, `smalldatetime` | `Date` |
179
+ | `char`, `varchar`, `nchar`, `nvarchar` | `string` |
180
+ | `text`, `ntext` | `string` |
181
+ | `uniqueidentifier` | `string` |
182
+ | `xml` | `string` |
183
+ | `bit` | `boolean` |
184
+ | `binary`, `varbinary`, `image` | `Buffer` |
185
+ | `sql_variant` | `unknown` |
186
+
154
187
  ## License
155
188
 
156
189
  MIT