@nxtedition/lib 22.0.4 → 22.0.5
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/app.js +2 -1
- package/couch.js +3 -5
- package/http.js +10 -2
- package/package.json +2 -1
- package/sequence.js +9 -6
package/app.js
CHANGED
|
@@ -876,7 +876,8 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
876
876
|
|
|
877
877
|
// TODO (fix): Determinisitc port also in dev mode... hash of something?
|
|
878
878
|
const port =
|
|
879
|
-
appConfig.inspect?.port ??
|
|
879
|
+
appConfig.inspect?.port ??
|
|
880
|
+
(isProduction ? 38603 : Math.floor(38000 + Math.random() * 10000))
|
|
880
881
|
const server = http
|
|
881
882
|
.createServer(async (req, res) => {
|
|
882
883
|
try {
|
package/couch.js
CHANGED
|
@@ -43,9 +43,7 @@ export function makeCouch(opts) {
|
|
|
43
43
|
)
|
|
44
44
|
|
|
45
45
|
const defaultClientOpts = {
|
|
46
|
-
|
|
47
|
-
headersTimeout: 10 * 60e3,
|
|
48
|
-
bodyTimeout: 2 * 60e3,
|
|
46
|
+
connectTimeout: 2e3,
|
|
49
47
|
}
|
|
50
48
|
|
|
51
49
|
const userAgent = config.userAgent || globalThis.userAgent
|
|
@@ -116,7 +114,7 @@ export function makeCouch(opts) {
|
|
|
116
114
|
* @param {boolean} [options.live=false]
|
|
117
115
|
* @param {number} [options.heartbeat=60000]
|
|
118
116
|
* @param {function} [options.retry=null]
|
|
119
|
-
* @param {string} [options.since=null]
|
|
117
|
+
* @param {string|null} [options.since=null]
|
|
120
118
|
* @param {number} [options.highWaterMark=128 * 1024]
|
|
121
119
|
* @param {object} [options.selector=null]
|
|
122
120
|
* @param {import('pino').Logger} [options.logger=null]
|
|
@@ -1092,7 +1090,7 @@ export function request(url, opts) {
|
|
|
1092
1090
|
const signal = opts.signal
|
|
1093
1091
|
|
|
1094
1092
|
if (opts.stream) {
|
|
1095
|
-
const handler = new StreamOutput({ signal,
|
|
1093
|
+
const handler = new StreamOutput({ signal, highWaterMark: stream.highWaterMark })
|
|
1096
1094
|
dispatch(dispatcher, ureq, handler)
|
|
1097
1095
|
return handler
|
|
1098
1096
|
} else {
|
package/http.js
CHANGED
|
@@ -152,7 +152,7 @@ export async function requestMiddleware(ctx, next) {
|
|
|
152
152
|
await thenable
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
assert(res.destroyed, 'response not completed')
|
|
155
|
+
assert(res.destroyed || res.writableEnded, 'response not completed')
|
|
156
156
|
|
|
157
157
|
const elapsedTime = performance.now() - startTime
|
|
158
158
|
|
|
@@ -391,7 +391,15 @@ export class ServerResponse extends http.ServerResponse {
|
|
|
391
391
|
super(req)
|
|
392
392
|
|
|
393
393
|
this.#created = performance.now()
|
|
394
|
-
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
assignSocket(socket) {
|
|
397
|
+
if (!this.destroyed) {
|
|
398
|
+
if (this.#timing.connect === -1) {
|
|
399
|
+
this.#timing.connect = performance.now() - this.#created
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
return super.assignSocket(socket)
|
|
395
403
|
}
|
|
396
404
|
|
|
397
405
|
flushHeaders() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxtedition/lib",
|
|
3
|
-
"version": "22.0.
|
|
3
|
+
"version": "22.0.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Robert Nagy <robert.nagy@boffins.se>",
|
|
6
6
|
"type": "module",
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"lodash": "^4.17.21",
|
|
69
69
|
"lru-cache": "^11.0.1",
|
|
70
70
|
"mime": "^4.0.4",
|
|
71
|
+
"mitata": "^1.0.11",
|
|
71
72
|
"moment-timezone": "^0.5.46",
|
|
72
73
|
"nconf": "^0.12.1",
|
|
73
74
|
"nested-error-stacks": "^2.1.1",
|
package/sequence.js
CHANGED
|
@@ -20,10 +20,10 @@ const cyrb53 = (str, seed = 0) => {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export class Sequence {
|
|
23
|
-
#value
|
|
23
|
+
#value = ''
|
|
24
24
|
#parts = []
|
|
25
25
|
#identity
|
|
26
|
-
#count
|
|
26
|
+
#count = 0
|
|
27
27
|
|
|
28
28
|
// TODO (perf): Optimize
|
|
29
29
|
/**
|
|
@@ -139,7 +139,10 @@ export class Sequence {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
} catch (err) {
|
|
142
|
-
throw Object.assign(new Error('Invalid sequence value'
|
|
142
|
+
throw Object.assign(new Error('Invalid sequence value: ' + err.message), {
|
|
143
|
+
cause: err,
|
|
144
|
+
data: value,
|
|
145
|
+
})
|
|
143
146
|
}
|
|
144
147
|
}
|
|
145
148
|
|
|
@@ -184,8 +187,8 @@ export class Sequence {
|
|
|
184
187
|
assert(Number.isFinite(sequence) && sequence >= 0)
|
|
185
188
|
if (this.#parts[index * 2 + 1] !== sequence) {
|
|
186
189
|
this.#parts[index * 2 + 1] = sequence
|
|
187
|
-
this.#value =
|
|
188
|
-
this.#count =
|
|
190
|
+
this.#value = ''
|
|
191
|
+
this.#count = 0
|
|
189
192
|
}
|
|
190
193
|
}
|
|
191
194
|
|
|
@@ -220,7 +223,7 @@ export class Sequence {
|
|
|
220
223
|
let token = ''
|
|
221
224
|
for (let n = 0; n < this.#parts.length; n += 2) {
|
|
222
225
|
count += this.#parts[n + 1]
|
|
223
|
-
token += (n === 0 ? '-' : '_') + this.#parts[n + 1] + ID_SEP + this.#parts[n]
|
|
226
|
+
token += (n === 0 ? '-' : '_') + this.#parts[n + 1] + ID_SEP + this.#parts[n + 0]
|
|
224
227
|
}
|
|
225
228
|
this.#value = String(count) + token
|
|
226
229
|
}
|