@nxtedition/lib 19.3.3 → 19.3.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/couch.js +8 -20
- package/package.json +1 -1
package/couch.js
CHANGED
|
@@ -1027,12 +1027,9 @@ class StreamOutput extends stream.Readable {
|
|
|
1027
1027
|
#abort
|
|
1028
1028
|
#state
|
|
1029
1029
|
#decoder
|
|
1030
|
-
#batched
|
|
1031
|
-
#didPush = false
|
|
1032
1030
|
|
|
1033
|
-
constructor({
|
|
1031
|
+
constructor({ highWaterMark = 128 }) {
|
|
1034
1032
|
super({ objectMode: true, highWaterMark })
|
|
1035
|
-
this.#batched = batched
|
|
1036
1033
|
}
|
|
1037
1034
|
|
|
1038
1035
|
_read() {
|
|
@@ -1047,13 +1044,13 @@ class StreamOutput extends stream.Readable {
|
|
|
1047
1044
|
onConnect(abort) {
|
|
1048
1045
|
if (this.destroyed) {
|
|
1049
1046
|
abort(this.errored)
|
|
1050
|
-
} else if (
|
|
1047
|
+
} else if (this.#state) {
|
|
1048
|
+
throw new Error('unusable')
|
|
1049
|
+
} else {
|
|
1051
1050
|
this.#state = 0
|
|
1052
1051
|
this.#str = ''
|
|
1053
1052
|
this.#abort = abort
|
|
1054
1053
|
this.#decoder = new TextDecoder()
|
|
1055
|
-
} else {
|
|
1056
|
-
throw new Error('unusable')
|
|
1057
1054
|
}
|
|
1058
1055
|
}
|
|
1059
1056
|
|
|
@@ -1070,7 +1067,7 @@ class StreamOutput extends stream.Readable {
|
|
|
1070
1067
|
lines[0] = this.#str + lines[0]
|
|
1071
1068
|
this.#str = lines.pop() ?? ''
|
|
1072
1069
|
|
|
1073
|
-
|
|
1070
|
+
let ret = true
|
|
1074
1071
|
for (const line of lines) {
|
|
1075
1072
|
if (this.#state === 0) {
|
|
1076
1073
|
if (line.endsWith('[')) {
|
|
@@ -1083,22 +1080,13 @@ class StreamOutput extends stream.Readable {
|
|
|
1083
1080
|
this.#state = 2
|
|
1084
1081
|
} else {
|
|
1085
1082
|
const row = JSON.parse(line.slice(0, line.lastIndexOf('}') + 1))
|
|
1086
|
-
if (
|
|
1087
|
-
|
|
1088
|
-
} else {
|
|
1089
|
-
this.push(row)
|
|
1090
|
-
this.#didPush = true
|
|
1083
|
+
if (!this.push(row)) {
|
|
1084
|
+
ret = false
|
|
1091
1085
|
}
|
|
1092
1086
|
}
|
|
1093
1087
|
}
|
|
1094
1088
|
}
|
|
1095
|
-
|
|
1096
|
-
if (rows) {
|
|
1097
|
-
this.push(rows)
|
|
1098
|
-
this.#didPush = true
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
|
-
return this.readableLength < this.readableHighWaterMark
|
|
1089
|
+
return ret
|
|
1102
1090
|
}
|
|
1103
1091
|
|
|
1104
1092
|
onComplete() {
|