@naturalcycles/db-lib 10.15.0 → 10.15.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.
|
@@ -346,8 +346,9 @@ export class CommonDao {
|
|
|
346
346
|
const stream = this.cfg.db.streamQuery(q, opt);
|
|
347
347
|
if (partialQuery)
|
|
348
348
|
return stream;
|
|
349
|
-
return stream
|
|
350
|
-
|
|
349
|
+
return (stream
|
|
350
|
+
// the commented out line was causing RangeError: Maximum call stack size exceeded
|
|
351
|
+
// .on('error', err => stream.emit('error', err))
|
|
351
352
|
.pipe(transformMap(async (dbm) => {
|
|
352
353
|
if (this.cfg.hooks.afterLoad) {
|
|
353
354
|
dbm = (await this.cfg.hooks.afterLoad(dbm));
|
|
@@ -357,7 +358,7 @@ export class CommonDao {
|
|
|
357
358
|
return this.anyToDBM(dbm, opt);
|
|
358
359
|
}, {
|
|
359
360
|
errorMode: opt.errorMode,
|
|
360
|
-
}));
|
|
361
|
+
})));
|
|
361
362
|
}
|
|
362
363
|
/**
|
|
363
364
|
* Stream as Readable, to be able to .pipe() it further with support of backpressure.
|
|
@@ -392,7 +393,8 @@ export class CommonDao {
|
|
|
392
393
|
// optimization: 1 validation is enough
|
|
393
394
|
// .pipe(transformMap<any, DBM>(dbm => this.anyToDBM(dbm, opt), safeOpt))
|
|
394
395
|
// .pipe(transformMap<DBM, BM>(dbm => this.dbmToBM(dbm, opt), safeOpt))
|
|
395
|
-
|
|
396
|
+
// the commented out line was causing RangeError: Maximum call stack size exceeded
|
|
397
|
+
// .on('error', err => stream.emit('error', err))
|
|
396
398
|
.pipe(transformMap(async (dbm) => {
|
|
397
399
|
if (this.cfg.hooks.afterLoad) {
|
|
398
400
|
dbm = (await this.cfg.hooks.afterLoad(dbm));
|
package/package.json
CHANGED
|
@@ -457,23 +457,26 @@ export class CommonDao<BM extends BaseDBEntity, DBM extends BaseDBEntity = BM, I
|
|
|
457
457
|
const stream = this.cfg.db.streamQuery<DBM>(q, opt)
|
|
458
458
|
if (partialQuery) return stream
|
|
459
459
|
|
|
460
|
-
return
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
if (
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
460
|
+
return (
|
|
461
|
+
stream
|
|
462
|
+
// the commented out line was causing RangeError: Maximum call stack size exceeded
|
|
463
|
+
// .on('error', err => stream.emit('error', err))
|
|
464
|
+
.pipe(
|
|
465
|
+
transformMap<any, DBM>(
|
|
466
|
+
async dbm => {
|
|
467
|
+
if (this.cfg.hooks!.afterLoad) {
|
|
468
|
+
dbm = (await this.cfg.hooks!.afterLoad(dbm))!
|
|
469
|
+
if (dbm === null) return SKIP
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
return this.anyToDBM(dbm, opt)
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
errorMode: opt.errorMode,
|
|
476
|
+
},
|
|
477
|
+
),
|
|
478
|
+
)
|
|
479
|
+
)
|
|
477
480
|
}
|
|
478
481
|
|
|
479
482
|
/**
|
|
@@ -512,7 +515,8 @@ export class CommonDao<BM extends BaseDBEntity, DBM extends BaseDBEntity = BM, I
|
|
|
512
515
|
// optimization: 1 validation is enough
|
|
513
516
|
// .pipe(transformMap<any, DBM>(dbm => this.anyToDBM(dbm, opt), safeOpt))
|
|
514
517
|
// .pipe(transformMap<DBM, BM>(dbm => this.dbmToBM(dbm, opt), safeOpt))
|
|
515
|
-
|
|
518
|
+
// the commented out line was causing RangeError: Maximum call stack size exceeded
|
|
519
|
+
// .on('error', err => stream.emit('error', err))
|
|
516
520
|
.pipe(
|
|
517
521
|
transformMap<DBM, BM>(
|
|
518
522
|
async dbm => {
|