@nxtedition/lib 19.8.0 → 19.8.1

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.
Files changed (2) hide show
  1. package/couch.js +13 -3
  2. package/package.json +1 -1
package/couch.js CHANGED
@@ -1139,7 +1139,9 @@ class PromiseOutput {
1139
1139
  #stats = {
1140
1140
  connect: -1,
1141
1141
  headers: -1,
1142
- ttfb: -1,
1142
+ data: -1,
1143
+ complete: -1,
1144
+ error: -1,
1143
1145
  }
1144
1146
 
1145
1147
  constructor({ resolve, reject }) {
@@ -1165,14 +1167,18 @@ class PromiseOutput {
1165
1167
  }
1166
1168
 
1167
1169
  onData(data) {
1168
- if (this.#stats.ttfb === -1) {
1169
- this.#stats.ttfb = performance.now() - this.#startTime - this.#stats.headers
1170
+ if (this.#stats.data === -1) {
1171
+ this.#stats.data = performance.now() - this.#startTime - this.#stats.headers
1170
1172
  }
1171
1173
 
1172
1174
  this.#str += this.#decoder.decode(data, { stream: true })
1173
1175
  }
1174
1176
 
1175
1177
  onComplete() {
1178
+ if (this.#stats.complete === -1) {
1179
+ this.#stats.complete = performance.now() - this.#startTime - this.#stats.data
1180
+ }
1181
+
1176
1182
  this.#str += this.#decoder.decode(undefined, { stream: false })
1177
1183
 
1178
1184
  this.#resolve(
@@ -1181,6 +1187,10 @@ class PromiseOutput {
1181
1187
  }
1182
1188
 
1183
1189
  onError(err) {
1190
+ if (this.#stats.error === -1) {
1191
+ this.#stats.error = performance.now() - this.#startTime - this.#stats.data
1192
+ }
1193
+
1184
1194
  this.#reject(err)
1185
1195
  }
1186
1196
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "19.8.0",
3
+ "version": "19.8.1",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",