@nxtedition/lib 21.9.0 → 21.10.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/couch.js +6 -12
- package/package.json +1 -1
- package/sequence.js +1 -1
package/couch.js
CHANGED
|
@@ -999,13 +999,11 @@ class PromiseOutput {
|
|
|
999
999
|
#decoder
|
|
1000
1000
|
#signal
|
|
1001
1001
|
#abort
|
|
1002
|
-
#parse
|
|
1003
1002
|
|
|
1004
|
-
constructor({ resolve, reject, signal
|
|
1003
|
+
constructor({ resolve, reject, signal }) {
|
|
1005
1004
|
this.#resolve = resolve
|
|
1006
1005
|
this.#reject = reject
|
|
1007
1006
|
this.#signal = signal
|
|
1008
|
-
this.#parse = parse ?? true
|
|
1009
1007
|
}
|
|
1010
1008
|
|
|
1011
1009
|
onConnect(abort) {
|
|
@@ -1032,14 +1030,10 @@ class PromiseOutput {
|
|
|
1032
1030
|
|
|
1033
1031
|
onComplete() {
|
|
1034
1032
|
this.#str += this.#decoder.decode(undefined, { stream: false })
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
this.#onDone(Object.assign(new Error('invalid json'), { data: this.#str, cause: err }))
|
|
1040
|
-
}
|
|
1041
|
-
} else {
|
|
1042
|
-
this.#onDone(null, this.#str)
|
|
1033
|
+
try {
|
|
1034
|
+
this.#onDone(null, JSON.parse(this.#str))
|
|
1035
|
+
} catch (err) {
|
|
1036
|
+
this.#onDone(Object.assign(new Error('invalid json'), { data: this.#str, cause: err }))
|
|
1043
1037
|
}
|
|
1044
1038
|
}
|
|
1045
1039
|
|
|
@@ -1103,7 +1097,7 @@ export function request(url, opts) {
|
|
|
1103
1097
|
return handler
|
|
1104
1098
|
} else {
|
|
1105
1099
|
return new Promise((resolve, reject) => {
|
|
1106
|
-
const handler = new PromiseOutput({ resolve, reject, signal
|
|
1100
|
+
const handler = new PromiseOutput({ resolve, reject, signal })
|
|
1107
1101
|
dispatch(dispatcher, ureq, handler)
|
|
1108
1102
|
})
|
|
1109
1103
|
}
|
package/package.json
CHANGED
package/sequence.js
CHANGED