@cap-js/sqlite 1.7.8 → 1.8.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 +7 -0
- package/lib/SQLiteService.js +6 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,13 @@
|
|
|
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
|
+
## [1.8.0](https://github.com/cap-js/cds-dbs/compare/sqlite-v1.7.8...sqlite-v1.8.0) (2025-01-28)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
* support for cds.Map ([#889](https://github.com/cap-js/cds-dbs/issues/889)) ([cde7514](https://github.com/cap-js/cds-dbs/commit/cde7514df20396383e0179ffce838596e3706bb2))
|
|
13
|
+
|
|
7
14
|
## [1.7.8](https://github.com/cap-js/cds-dbs/compare/sqlite-v1.7.7...sqlite-v1.7.8) (2024-12-16)
|
|
8
15
|
|
|
9
16
|
|
package/lib/SQLiteService.js
CHANGED
|
@@ -5,6 +5,7 @@ const $session = Symbol('dbc.session')
|
|
|
5
5
|
const convStrm = require('stream/consumers')
|
|
6
6
|
const { Readable } = require('stream')
|
|
7
7
|
|
|
8
|
+
const SANITIZE_VALUES = process.env.NODE_ENV === 'production' && cds.env.log.sanitize_values !== false
|
|
8
9
|
const keywords = cds.compiler.to.sql.sqlite.keywords
|
|
9
10
|
// keywords come as array
|
|
10
11
|
const sqliteKeywords = keywords.reduce((prev, curr) => {
|
|
@@ -247,6 +248,7 @@ class SQLiteService extends SQLService {
|
|
|
247
248
|
Time: () => 'TIME_TEXT',
|
|
248
249
|
DateTime: () => 'DATETIME_TEXT',
|
|
249
250
|
Timestamp: () => 'TIMESTAMP_TEXT',
|
|
251
|
+
Map: () => 'JSON_TEXT'
|
|
250
252
|
}
|
|
251
253
|
|
|
252
254
|
get is_distinct_from_() {
|
|
@@ -267,7 +269,7 @@ class SQLiteService extends SQLService {
|
|
|
267
269
|
try {
|
|
268
270
|
return await super.onINSERT(req)
|
|
269
271
|
} catch (err) {
|
|
270
|
-
throw _not_unique(err, 'ENTITY_ALREADY_EXISTS')
|
|
272
|
+
throw _not_unique(err, 'ENTITY_ALREADY_EXISTS', req.data)
|
|
271
273
|
}
|
|
272
274
|
}
|
|
273
275
|
|
|
@@ -275,7 +277,7 @@ class SQLiteService extends SQLService {
|
|
|
275
277
|
try {
|
|
276
278
|
return await super.onUPDATE(req)
|
|
277
279
|
} catch (err) {
|
|
278
|
-
throw _not_unique(err, 'UNIQUE_CONSTRAINT_VIOLATION')
|
|
280
|
+
throw _not_unique(err, 'UNIQUE_CONSTRAINT_VIOLATION', req.data)
|
|
279
281
|
}
|
|
280
282
|
}
|
|
281
283
|
}
|
|
@@ -288,13 +290,14 @@ class SQLiteService extends SQLService {
|
|
|
288
290
|
// })
|
|
289
291
|
// }
|
|
290
292
|
|
|
291
|
-
function _not_unique(err, code) {
|
|
293
|
+
function _not_unique(err, code, data) {
|
|
292
294
|
if (err.message.match(/unique constraint/i))
|
|
293
295
|
return Object.assign(err, {
|
|
294
296
|
originalMessage: err.message, // FIXME: required because of next line
|
|
295
297
|
message: code, // FIXME: misusing message as code
|
|
296
298
|
code: 400, // FIXME: misusing code as (http) status
|
|
297
299
|
})
|
|
300
|
+
if (data) err.values = SANITIZE_VALUES ? ['***'] : data
|
|
298
301
|
return err
|
|
299
302
|
}
|
|
300
303
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cap-js/sqlite",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.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": {
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"CHANGELOG.md"
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
|
-
"test": "cds-test
|
|
26
|
+
"test": "cds-test"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@cap-js/db-service": "^1.
|
|
29
|
+
"@cap-js/db-service": "^1.17.0",
|
|
30
30
|
"better-sqlite3": "^11.0.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|