@telorun/sql-sqlite 0.2.0 → 0.2.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
@@ -23,7 +23,7 @@ Built to be language-agnostic and infinitely extensible.
23
23
 
24
24
  ```bash
25
25
  # Reconcile your manifest into a running backend
26
- $ telo ./examples/hello-api.yaml
26
+ $ telo ./examples/hello-api
27
27
 
28
28
  {"level":30,"time":1771610393008,"pid":1310178,"hostname":"dev","msg":"Server listening at http://127.0.0.1:8844"}
29
29
  ```
@@ -5,7 +5,14 @@ export function openDatabase(file) {
5
5
  prepare(sql) {
6
6
  const stmt = db.prepare(sql);
7
7
  return {
8
- reader: true,
8
+ // A statement is a reader iff it yields a result set. bun:sqlite has no
9
+ // `reader` flag (better-sqlite3 does), so derive it from the output
10
+ // columns: SELECT and `... RETURNING` expose column names, plain
11
+ // INSERT/UPDATE/DELETE expose none. Kysely routes readers through
12
+ // `all()` and everything else through `run()` — getting this wrong sent
13
+ // every mutation down the `all()` path, so `numAffectedRows` was never
14
+ // reported (rowCount always 0).
15
+ reader: stmt.columnNames.length > 0,
9
16
  all(params) {
10
17
  return stmt.all(...params);
11
18
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telorun/sql-sqlite",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Telo SqlSqlite.Connection — SQLite backend for the Sql.Connection abstract (better-sqlite3 / bun:sqlite, transactional DDL).",
5
5
  "keywords": [
6
6
  "telo",
@@ -8,7 +8,14 @@ export function openDatabase(file: string): SqliteDb {
8
8
  prepare(sql: string) {
9
9
  const stmt = db.prepare(sql);
10
10
  return {
11
- reader: true,
11
+ // A statement is a reader iff it yields a result set. bun:sqlite has no
12
+ // `reader` flag (better-sqlite3 does), so derive it from the output
13
+ // columns: SELECT and `... RETURNING` expose column names, plain
14
+ // INSERT/UPDATE/DELETE expose none. Kysely routes readers through
15
+ // `all()` and everything else through `run()` — getting this wrong sent
16
+ // every mutation down the `all()` path, so `numAffectedRows` was never
17
+ // reported (rowCount always 0).
18
+ reader: stmt.columnNames.length > 0,
12
19
  all(params: ReadonlyArray<unknown>) {
13
20
  return stmt.all(...(params as any[]));
14
21
  },