@vanit-co/sql-ts 1.0.4 → 1.2.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/CHANGELOG.md +87 -0
- package/README.md +550 -320
- package/dist/generate.d.mts +19 -0
- package/dist/generate.d.ts +19 -0
- package/dist/generate.js +83 -0
- package/dist/generate.js.map +1 -0
- package/dist/generate.mjs +80 -0
- package/dist/generate.mjs.map +1 -0
- package/dist/index.d.mts +150 -0
- package/dist/index.d.ts +101 -22
- package/dist/index.js +63 -17
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +223 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +72 -12
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses
|
|
5
|
+
[Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [1.2.0] - 2026-12-02
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- `updateAs(table, colsVals)`: an `update` whose table carries its alias
|
|
11
|
+
(`update "users" as "u" set ...`), so a `where` built with the `where` tag
|
|
12
|
+
resolves against it. `update` is unchanged.
|
|
13
|
+
- Inferred result rows: a query carries the row its `all(...)`, `pick(...)` and
|
|
14
|
+
`expr(...)` select, merged through `append` and `concat`, and `RowOf<typeof q>`
|
|
15
|
+
reads it for the driver. `Result` is now `Result<R = any>`; `Result` alone is
|
|
16
|
+
the untyped result it always was.
|
|
17
|
+
- `expr<V>()(fragment, name)`: a computed column, rendered `(<fragment>) as "name"`
|
|
18
|
+
and typed `name: V`.
|
|
19
|
+
- `@vanit-co/sql-ts/generate`: `postgresColumns` (the introspection query) and
|
|
20
|
+
`generate(columns, options)`, which writes the type records for `schema<R>()`,
|
|
21
|
+
typed the way node-postgres parses each column by default.
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
- A fragment interpolated into a tag is spliced in. It used to be bound as one
|
|
25
|
+
parameter holding the whole object.
|
|
26
|
+
|
|
27
|
+
## [1.1.0] - 2026-11-28
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
- Native ES module build (`dist/index.mjs`) alongside the CommonJS build, with an
|
|
31
|
+
`exports` map and separate type declarations for `import` and `require`.
|
|
32
|
+
- `sideEffects: false` for better tree-shaking.
|
|
33
|
+
- Opt-in typed result rows: `schema<{ ... }>()({ ... })` builds a typed table, and the
|
|
34
|
+
new `SelectAsRow<...>` / `Row<...>` types derive row shapes from it. `as()` returns
|
|
35
|
+
the literal key (`'u_id'`) for typed columns. Plain `schema({ ... })` keeps exactly
|
|
36
|
+
the types it had.
|
|
37
|
+
- Public type exports: `Fragment`, `Result`, `SchemaTable`, `TypedTable`, `SelectAsRow`, `Row`.
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
- **Zero runtime dependencies**: `ramda` is no longer a dependency. Output is
|
|
41
|
+
unchanged.
|
|
42
|
+
|
|
43
|
+
## [1.0.4] - 2026-10-28
|
|
44
|
+
|
|
45
|
+
### Added
|
|
46
|
+
- SQLite support documented and tested through `.sql` (`better-sqlite3`, `node:sqlite`).
|
|
47
|
+
|
|
48
|
+
## [1.0.0] - 2026-07-31
|
|
49
|
+
|
|
50
|
+
### Added
|
|
51
|
+
- `insert` and `update` accept `raw(...)` SQL expressions as values.
|
|
52
|
+
- `insert` and `update` accept column references as values, rendered as quoted identifiers.
|
|
53
|
+
|
|
54
|
+
## [0.9.0] - 2026-06-10
|
|
55
|
+
|
|
56
|
+
### Changed
|
|
57
|
+
- `undefined` interpolations are discarded instead of becoming bind parameters,
|
|
58
|
+
which makes optional values easy to drop.
|
|
59
|
+
|
|
60
|
+
## [0.7.0] - 2026-05-03
|
|
61
|
+
|
|
62
|
+
### Security
|
|
63
|
+
- Identifiers are escaped (embedded quotes are doubled), fixing SQL injection
|
|
64
|
+
through crafted table or column names.
|
|
65
|
+
|
|
66
|
+
## [0.5.0] - 2026-04-28
|
|
67
|
+
|
|
68
|
+
### Added
|
|
69
|
+
- `null` accepted as a bind parameter.
|
|
70
|
+
|
|
71
|
+
## [0.3.0] - 2026-04-06
|
|
72
|
+
|
|
73
|
+
### Added
|
|
74
|
+
- `groupBy`, `having` and `orderBy` tags (semantic aliases of `select`).
|
|
75
|
+
|
|
76
|
+
## [0.2.0] - 2026-04-02
|
|
77
|
+
|
|
78
|
+
### Added
|
|
79
|
+
- Column helpers, including `as(column)`.
|
|
80
|
+
|
|
81
|
+
## [0.0.1] - 2026-03-28
|
|
82
|
+
|
|
83
|
+
### Added
|
|
84
|
+
- First release: `schema`, the `sql` / `select` / `selectAs` / `join` / `where`
|
|
85
|
+
tags, `all`, `pick`, `raw`, `insert`, `update`, `concat`, `empty`,
|
|
86
|
+
`toMysql`, `toPostgres` and `preparedStatementName`.
|
|
87
|
+
|