@nxtedition/lib 19.0.46 → 19.0.48
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 +3 -6
- package/http.js +1 -1
- package/package.json +1 -1
- package/s3.js +2 -2
- package/util/template/javascript.js +19 -11
package/couch.js
CHANGED
|
@@ -251,7 +251,6 @@ export function makeCouch(opts) {
|
|
|
251
251
|
'request-id': genReqId(),
|
|
252
252
|
...(body ? { 'content-type': 'application/json' } : {}),
|
|
253
253
|
},
|
|
254
|
-
highWaterMark: 256 * 1024, // TODO (fix): Needs support in undici...
|
|
255
254
|
bodyTimeout: 2 * (params.heartbeat || 60e3),
|
|
256
255
|
}
|
|
257
256
|
|
|
@@ -833,10 +832,8 @@ export function makeCouch(opts) {
|
|
|
833
832
|
// TODO (fix): Close other clients.
|
|
834
833
|
}
|
|
835
834
|
|
|
836
|
-
return {
|
|
837
|
-
|
|
838
|
-
return config.url
|
|
839
|
-
},
|
|
835
|
+
return Object.freeze({
|
|
836
|
+
url: new URL(config.url),
|
|
840
837
|
request,
|
|
841
838
|
bulkDocs,
|
|
842
839
|
allDocs,
|
|
@@ -849,5 +846,5 @@ export function makeCouch(opts) {
|
|
|
849
846
|
changes,
|
|
850
847
|
close,
|
|
851
848
|
up,
|
|
852
|
-
}
|
|
849
|
+
})
|
|
853
850
|
}
|
package/http.js
CHANGED
|
@@ -18,7 +18,7 @@ const ERR_HEADER_EXPR =
|
|
|
18
18
|
// In the worst cases, it will become a float, losing accuracy.
|
|
19
19
|
const maxInt = 2147483647
|
|
20
20
|
let nextReqId = Math.floor(Math.random() * maxInt)
|
|
21
|
-
function genReqId() {
|
|
21
|
+
export function genReqId() {
|
|
22
22
|
nextReqId = (nextReqId + 1) & maxInt
|
|
23
23
|
return `req-${nextReqId.toString(36)}`
|
|
24
24
|
}
|
package/package.json
CHANGED
package/s3.js
CHANGED
|
@@ -79,7 +79,7 @@ export async function upload({ client: s3, signal, logger, partSize = 16e6, para
|
|
|
79
79
|
const chunks = part.chunks
|
|
80
80
|
const number = part.number
|
|
81
81
|
const size = part.size
|
|
82
|
-
const
|
|
82
|
+
const hash = part.hasher.digest('hex')
|
|
83
83
|
|
|
84
84
|
part.chunks = []
|
|
85
85
|
part.number += 1
|
|
@@ -98,7 +98,7 @@ export async function upload({ client: s3, signal, logger, partSize = 16e6, para
|
|
|
98
98
|
Bucket,
|
|
99
99
|
Key,
|
|
100
100
|
UploadId: uploadId,
|
|
101
|
-
ContentMD5:
|
|
101
|
+
ContentMD5: Buffer.from(hash, 'hex').toString('base64'),
|
|
102
102
|
ContentLength: size,
|
|
103
103
|
PartNumber: number,
|
|
104
104
|
Body: new stream.Readable({
|
|
@@ -232,6 +232,7 @@ export default function ({ ds, proxify, compiler }) {
|
|
|
232
232
|
this._args = kEmpty
|
|
233
233
|
this._wrap = null
|
|
234
234
|
this._suspended = false
|
|
235
|
+
this._errored = false
|
|
235
236
|
|
|
236
237
|
if (rxjs.isObservable(args)) {
|
|
237
238
|
this._subscription = args.subscribe({
|
|
@@ -343,6 +344,7 @@ export default function ({ ds, proxify, compiler }) {
|
|
|
343
344
|
try {
|
|
344
345
|
assert(self._suspended === false)
|
|
345
346
|
const value = self._script.runInContext(self._context)
|
|
347
|
+
self._errored = false
|
|
346
348
|
if (self._suspended) {
|
|
347
349
|
return
|
|
348
350
|
}
|
|
@@ -356,12 +358,18 @@ export default function ({ ds, proxify, compiler }) {
|
|
|
356
358
|
return
|
|
357
359
|
}
|
|
358
360
|
|
|
359
|
-
self.
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
)
|
|
361
|
+
self._errored = true
|
|
362
|
+
|
|
363
|
+
const error = Object.assign(new Error('expression failed'), {
|
|
364
|
+
cause: err,
|
|
365
|
+
data: self._expression,
|
|
366
|
+
})
|
|
367
|
+
|
|
368
|
+
if (self._suspended) {
|
|
369
|
+
process.emitWarning(error)
|
|
370
|
+
} else {
|
|
371
|
+
self._observer.error(error)
|
|
372
|
+
}
|
|
365
373
|
} finally {
|
|
366
374
|
compiler.current = previous
|
|
367
375
|
|
|
@@ -426,7 +434,7 @@ export default function ({ ds, proxify, compiler }) {
|
|
|
426
434
|
|
|
427
435
|
if (!entry.status) {
|
|
428
436
|
this._suspended = true
|
|
429
|
-
if (suspend ??
|
|
437
|
+
if (suspend ?? this._errored) {
|
|
430
438
|
throw kSuspend
|
|
431
439
|
} else {
|
|
432
440
|
return null
|
|
@@ -453,7 +461,7 @@ export default function ({ ds, proxify, compiler }) {
|
|
|
453
461
|
|
|
454
462
|
if (entry.value === kEmpty) {
|
|
455
463
|
this._suspended = true
|
|
456
|
-
if (suspend ??
|
|
464
|
+
if (suspend ?? this._errored) {
|
|
457
465
|
throw kSuspend
|
|
458
466
|
} else {
|
|
459
467
|
return null
|
|
@@ -480,7 +488,7 @@ export default function ({ ds, proxify, compiler }) {
|
|
|
480
488
|
|
|
481
489
|
if (entry.value === kEmpty) {
|
|
482
490
|
this._suspended = true
|
|
483
|
-
if (suspend ??
|
|
491
|
+
if (suspend ?? this._errored) {
|
|
484
492
|
throw kSuspend
|
|
485
493
|
} else {
|
|
486
494
|
return null
|
|
@@ -500,7 +508,7 @@ export default function ({ ds, proxify, compiler }) {
|
|
|
500
508
|
if (Number.isFinite(dueTime) && timeout > 0) {
|
|
501
509
|
this._suspended = true
|
|
502
510
|
this._getEntry(key, TimerEntry, timeout)
|
|
503
|
-
if (suspend ??
|
|
511
|
+
if (suspend ?? this._errored) {
|
|
504
512
|
throw kSuspend
|
|
505
513
|
} else {
|
|
506
514
|
return dueValue
|
|
@@ -531,7 +539,7 @@ export default function ({ ds, proxify, compiler }) {
|
|
|
531
539
|
|
|
532
540
|
if (entry.record.state < state) {
|
|
533
541
|
this._suspended = true
|
|
534
|
-
if (suspend ??
|
|
542
|
+
if (suspend ?? this._errored) {
|
|
535
543
|
throw kSuspend
|
|
536
544
|
} else {
|
|
537
545
|
return entry.record.data
|