@cap-js/sqlite 2.2.1 → 3.0.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 CHANGED
@@ -4,6 +4,58 @@
4
4
  - The format is based on [Keep a Changelog](http://keepachangelog.com/).
5
5
  - This project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ ## [3.0.0](https://github.com/cap-js/cds-dbs/compare/sqlite-v2.4.0...sqlite-v3.0.0) (2026-06-01)
8
+
9
+
10
+ ### ⚠ BREAKING CHANGES
11
+
12
+ * require cds10 ([#1628](https://github.com/cap-js/cds-dbs/issues/1628))
13
+
14
+ ### Added
15
+
16
+ * require cds10 ([#1628](https://github.com/cap-js/cds-dbs/issues/1628)) ([93e8305](https://github.com/cap-js/cds-dbs/commit/93e83053679f9ef94293caa08917855404db880d))
17
+ * **sqlite:** use node:sqlite as default driver ([#1598](https://github.com/cap-js/cds-dbs/issues/1598)) ([b386996](https://github.com/cap-js/cds-dbs/commit/b3869961640543d55f39cc27620a4396fb7924d1))
18
+
19
+
20
+ ### Dependencies
21
+
22
+ * The following workspace dependencies were updated
23
+ * dependencies
24
+ * @cap-js/db-service bumped from ^2.11.0 to ^3.0.0
25
+
26
+ ## [2.4.0](https://github.com/cap-js/cds-dbs/compare/sqlite-v2.3.0...sqlite-v2.4.0) (2026-04-29)
27
+
28
+
29
+ ### Added
30
+
31
+ * supersede potentially compromised release ([#1590](https://github.com/cap-js/cds-dbs/issues/1590)) ([3be4044](https://github.com/cap-js/cds-dbs/commit/3be404417229a2dd539e4b40393d3bd346e4388c))
32
+
33
+
34
+ ### Dependencies
35
+
36
+ * The following workspace dependencies were updated
37
+ * dependencies
38
+ * @cap-js/db-service bumped from ^2.10.1 to ^2.11.0
39
+
40
+ ## [2.3.0](https://github.com/cap-js/cds-dbs/compare/sqlite-v2.2.1...sqlite-v2.3.0) (2026-04-29)
41
+
42
+
43
+ ### Added
44
+
45
+ * decimal affinity in sqlite ([#1547](https://github.com/cap-js/cds-dbs/issues/1547)) ([9228adc](https://github.com/cap-js/cds-dbs/commit/9228adc22733b18934997506271a0c7fa6505eb8))
46
+
47
+
48
+ ### Fixed
49
+
50
+ * supersede potentially compromised release ([#1589](https://github.com/cap-js/cds-dbs/issues/1589)) ([bd73895](https://github.com/cap-js/cds-dbs/commit/bd7389524d00ddd6ed73fc79308e19e7bf952b53))
51
+
52
+
53
+ ### Dependencies
54
+
55
+ * The following workspace dependencies were updated
56
+ * dependencies
57
+ * @cap-js/db-service bumped from ^2.10.0 to ^2.10.1
58
+
7
59
  ## [2.2.1](https://github.com/cap-js/cds-dbs/compare/sqlite-v2.2.0...sqlite-v2.2.1) (2026-04-22)
8
60
 
9
61
 
package/index.js CHANGED
@@ -1 +1,2 @@
1
1
  module.exports = require('./lib/SQLiteService.js')
2
+
@@ -183,7 +183,8 @@ class SQLiteService extends SQLService {
183
183
  const { sql, values } = this.cqn2sql(query, data)
184
184
  let ps = await this.prepare(sql)
185
185
  const vals = await this._prepareStreams(values)
186
- return (await ps.run(vals)).changes
186
+ const { changes } = await ps.run(vals)
187
+ return this._return_affected (changes)
187
188
  }
188
189
 
189
190
  onPlainSQL({ query, data }, next) {
@@ -270,9 +271,11 @@ class SQLiteService extends SQLService {
270
271
  Int64: cds.env.features.ieee754compatible ? expr => `CAST(${expr} as TEXT)` : undefined,
271
272
  // REVISIT: always cast to string in next major
272
273
  // Reading decimal as string to not loose precision
273
- Decimal: cds.env.features.ieee754compatible ? (expr, elem) => elem?.scale
274
- ? `CASE WHEN ${expr} IS NULL THEN NULL ELSE format('%.${elem.scale}f', ${expr}) END`
275
- : `CAST(${expr} as TEXT)`
274
+ Decimal: cds.env.features.ieee754compatible
275
+ ? (expr, elem) =>
276
+ elem?.scale
277
+ ? `CASE WHEN ${expr} IS NULL THEN NULL ELSE format('%.${elem.scale}f', ${expr}) END`
278
+ : `CASE WHEN ${expr} IS NULL THEN NULL ELSE rtrim(rtrim(format('%.999f', ${expr}), '0'), '.') END`
276
279
  : undefined,
277
280
  // Binary is not allowed in json objects
278
281
  Binary: expr => `${expr} || ''`,
@@ -289,7 +292,8 @@ class SQLiteService extends SQLService {
289
292
  Time: () => 'TIME_TEXT',
290
293
  DateTime: () => 'DATETIME_TEXT',
291
294
  Timestamp: () => 'TIMESTAMP_TEXT',
292
- Map: () => 'JSON_TEXT'
295
+ Map: () => 'JSON_TEXT',
296
+ Decimal: cds.env.requires.db?.decimal_affinity?.match(/^real$/i) ? () => 'REAL_DECIMAL' : undefined,
293
297
  }
294
298
 
295
299
  get is_distinct_from_() {
@@ -312,13 +316,8 @@ function loadSQLite(driver) {
312
316
 
313
317
  if (driver) {
314
318
  sqlite = require(drivers[driver])
315
- return
316
- }
317
-
318
- try { sqlite = require(drivers['better-sqlite3']) }
319
- catch {
320
- try { sqlite = require(drivers.node) }
321
- catch { sqlite = require(drivers['sql.js']) }
319
+ } else {
320
+ sqlite = require(drivers.node)
322
321
  }
323
322
  }
324
323
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cap-js/sqlite",
3
- "version": "2.2.1",
3
+ "version": "3.0.0",
4
4
  "description": "CDS database service for SQLite",
5
5
  "homepage": "https://github.com/cap-js/cds-dbs/tree/main/sqlite#cds-database-service-for-sqlite",
6
6
  "repository": {
@@ -26,16 +26,19 @@
26
26
  "test": "cds-test"
27
27
  },
28
28
  "dependencies": {
29
- "better-sqlite3": "^12.0.0",
30
- "@cap-js/db-service": "^2.10.0"
29
+ "@cap-js/db-service": "^3.0.0"
31
30
  },
32
31
  "peerDependencies": {
33
- "@sap/cds": ">=9.8",
34
- "sql.js": "^1.13.0"
32
+ "@sap/cds": "^10",
33
+ "sql.js": "^1.13.0",
34
+ "better-sqlite3": "^12.0.0"
35
35
  },
36
36
  "peerDependenciesMeta": {
37
37
  "sql.js": {
38
38
  "optional": true
39
+ },
40
+ "better-sqlite3": {
41
+ "optional": true
39
42
  }
40
43
  },
41
44
  "cds": {
@@ -60,4 +63,4 @@
60
63
  }
61
64
  },
62
65
  "license": "Apache-2.0"
63
- }
66
+ }