@cap-js/postgres 2.0.3 → 2.0.4

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,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.4](https://github.com/cap-js/cds-dbs/compare/postgres-v2.0.3...postgres-v2.0.4) (2025-07-28)
8
+
9
+
10
+ ### Fixed
11
+
12
+ * ensure ordering of `ParameterStream` chunks ([#1280](https://github.com/cap-js/cds-dbs/issues/1280)) ([a49e200](https://github.com/cap-js/cds-dbs/commit/a49e200eb3c08cedcea04ffc5ecb7c664ee885c0))
13
+
7
14
  ## [2.0.3](https://github.com/cap-js/cds-dbs/compare/postgres-v2.0.2...postgres-v2.0.3) (2025-06-30)
8
15
 
9
16
 
@@ -808,17 +808,17 @@ class ParameterStream extends Writable {
808
808
  this.lengthBuffer = Buffer.from([0x64, 0, 0, 0, 0])
809
809
 
810
810
  // Flush quote character before input stream
811
- this.flushChunk = chunk => {
811
+ this.flushChunk = (chunk, cb) => {
812
812
  delete this.flushChunk
813
813
 
814
814
  this.lengthBuffer.writeUInt32BE(chunk.length + 5, 1)
815
815
  this.connection.stream.write(this.lengthBuffer)
816
- this.connection.stream.write(Buffer.from(this.constructor.sep))
817
- return this.connection.stream.write(chunk)
816
+ this.connection.stream.write(this.constructor.sep)
817
+ this.connection.stream.write(chunk, cb)
818
818
  }
819
819
  }
820
820
 
821
- static sep = String.fromCharCode(31) // Separator One
821
+ static sep = Buffer.from(String.fromCharCode(31)) // Separator One
822
822
  static done = Buffer.from([0x63, 0, 0, 0, 4])
823
823
 
824
824
  then(resolve, reject) {
@@ -869,17 +869,14 @@ class ParameterStream extends Writable {
869
869
  })
870
870
  }
871
871
 
872
- flush(chunk, callback) {
873
- if (this.flushChunk(chunk)) {
874
- return callback()
875
- }
876
- this.connection.stream.once('drain', callback)
872
+ flush(chunk, cb) {
873
+ this.flushChunk(chunk, cb)
877
874
  }
878
875
 
879
- flushChunk(chunk) {
876
+ flushChunk(chunk, cb) {
880
877
  this.lengthBuffer.writeUInt32BE(chunk.length + 4, 1)
881
878
  this.connection.stream.write(this.lengthBuffer)
882
- return this.connection.stream.write(chunk)
879
+ this.connection.stream.write(chunk, cb)
883
880
  }
884
881
 
885
882
  handleError(e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cap-js/postgres",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "CDS database service for Postgres",
5
5
  "homepage": "https://github.com/cap-js/cds-dbs/tree/main/postgres#cds-database-service-for-postgres",
6
6
  "repository": {