@cap-js/postgres 2.0.1 → 2.0.2
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/PostgresService.js +10 -5
- package/package.json +1 -1
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
|
+
## [2.0.2](https://github.com/cap-js/cds-dbs/compare/postgres-v2.0.1...postgres-v2.0.2) (2025-06-04)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
* Allow raw streams to have empty results ([#1224](https://github.com/cap-js/cds-dbs/issues/1224)) ([0a59e69](https://github.com/cap-js/cds-dbs/commit/0a59e69eae2f701b5c475512fd1cd83cfb586153))
|
|
13
|
+
|
|
7
14
|
## [2.0.1](https://github.com/cap-js/cds-dbs/compare/postgres-v2.0.0...postgres-v2.0.1) (2025-05-27)
|
|
8
15
|
|
|
9
16
|
|
package/lib/PostgresService.js
CHANGED
|
@@ -48,7 +48,7 @@ class PostgresService extends SQLService {
|
|
|
48
48
|
ca: cr.sslrootcert,
|
|
49
49
|
}),
|
|
50
50
|
}
|
|
51
|
-
const dbc = new Client({...credentials, ...clientOptions})
|
|
51
|
+
const dbc = new Client({ ...credentials, ...clientOptions })
|
|
52
52
|
await dbc.connect()
|
|
53
53
|
return dbc
|
|
54
54
|
},
|
|
@@ -367,8 +367,8 @@ GROUP BY k
|
|
|
367
367
|
const nulls = c.nulls || (c.sort?.toLowerCase() === 'desc' || c.sort === -1 ? 'LAST' : 'FIRST')
|
|
368
368
|
const o = localized
|
|
369
369
|
? this.expr(c) +
|
|
370
|
-
|
|
371
|
-
|
|
370
|
+
(c.element?.[this.class._localized] && locale ? ` COLLATE "${locale}"` : '') +
|
|
371
|
+
(c.sort?.toLowerCase() === 'desc' || c.sort === -1 ? ' DESC' : ' ASC')
|
|
372
372
|
: this.expr(c) + (c.sort?.toLowerCase() === 'desc' || c.sort === -1 ? ' DESC' : ' ASC')
|
|
373
373
|
return o + ' NULLS ' + (nulls.toLowerCase() === 'first' ? 'FIRST' : 'LAST')
|
|
374
374
|
})
|
|
@@ -710,14 +710,19 @@ class QueryStream extends Query {
|
|
|
710
710
|
this.push = this.stream.push.bind(this.stream)
|
|
711
711
|
|
|
712
712
|
this._prom = new Promise((resolve, reject) => {
|
|
713
|
+
let hasData = false
|
|
713
714
|
this.once('error', reject)
|
|
714
715
|
this.once('end', () => {
|
|
715
|
-
if (!objectMode && !this._one)
|
|
716
|
+
if (!objectMode && !this._one) {
|
|
717
|
+
if (!hasData) this.push(this.constructor.open)
|
|
718
|
+
this.push(this.constructor.close)
|
|
719
|
+
}
|
|
716
720
|
this.push(null)
|
|
717
721
|
if (this.stream.isPaused()) this.stream.resume()
|
|
718
|
-
resolve(null)
|
|
722
|
+
resolve(this._one ? null : this.stream)
|
|
719
723
|
})
|
|
720
724
|
this.once('row', row => {
|
|
725
|
+
hasData = true
|
|
721
726
|
if (row == null) return resolve(null)
|
|
722
727
|
resolve(this.stream)
|
|
723
728
|
})
|
package/package.json
CHANGED