@nxtedition/lib 19.0.47 → 19.0.49

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 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
- get url() {
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/deepstream.js CHANGED
@@ -1,4 +1,4 @@
1
- import assert from 'node:assert'
1
+ // import assert from 'node:assert'
2
2
  import qs from 'qs'
3
3
  import cached from './util/cached.js'
4
4
  import * as rxjs from 'rxjs'
@@ -156,16 +156,16 @@ function query(ds, designId, options) {
156
156
  )
157
157
  .pipe(
158
158
  rxjs.switchMap(({ rows, finished }) => {
159
- assert(Array.isArray(rows))
160
- assert(typeof finished === 'boolean')
159
+ // assert(Array.isArray(rows))
160
+ // assert(typeof finished === 'boolean')
161
161
 
162
162
  const nextRows = prevRows.length ? [...prevRows, ...rows] : rows
163
163
  if (finished) {
164
164
  return rxjs.of({ rows: nextRows })
165
165
  } else {
166
166
  const last = rows.pop()
167
- assert(last.key)
168
- assert(rows.length > 0)
167
+ // assert(last.key)
168
+ // assert(rows.length > 0)
169
169
  return next(last.key, nextRows, limit - rows.length)
170
170
  }
171
171
  }),
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "19.0.47",
3
+ "version": "19.0.49",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",
@@ -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._observer.error(
360
- Object.assign(new Error('expression failed'), {
361
- cause: err,
362
- data: self._expression,
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 ?? true) {
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 ?? true) {
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 ?? true) {
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 ?? true) {
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 ?? true) {
542
+ if (suspend ?? this._errored) {
535
543
  throw kSuspend
536
544
  } else {
537
545
  return entry.record.data