@naturalcycles/db-lib 10.1.5 → 10.2.0
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.
|
@@ -4,8 +4,6 @@ import { _pipeline, AjvSchema, getValidationResult, stringId, transformChunk, tr
|
|
|
4
4
|
import { DBLibError } from '../cnst.js';
|
|
5
5
|
import { RunnableDBQuery } from '../query/dbQuery.js';
|
|
6
6
|
import { CommonDaoLogLevel } from './common.dao.model.js';
|
|
7
|
-
const isGAE = !!process.env['GAE_INSTANCE'];
|
|
8
|
-
const isCI = !!process.env['CI'];
|
|
9
7
|
/**
|
|
10
8
|
* Lowest common denominator API between supported Databases.
|
|
11
9
|
*
|
|
@@ -18,10 +16,7 @@ export class CommonDao {
|
|
|
18
16
|
constructor(cfg) {
|
|
19
17
|
this.cfg = cfg;
|
|
20
18
|
this.cfg = {
|
|
21
|
-
|
|
22
|
-
// otherwise to log Operations
|
|
23
|
-
// e.g in Dev (local machine), Test - it will log operations (useful for debugging)
|
|
24
|
-
logLevel: isGAE || isCI ? CommonDaoLogLevel.NONE : CommonDaoLogLevel.OPERATIONS,
|
|
19
|
+
logLevel: CommonDaoLogLevel.NONE,
|
|
25
20
|
generateId: true,
|
|
26
21
|
assignGeneratedIds: false,
|
|
27
22
|
useCreatedProperty: true,
|
|
@@ -806,7 +801,7 @@ export class CommonDao {
|
|
|
806
801
|
const started = this.logStarted(op, q.table);
|
|
807
802
|
let deleted = 0;
|
|
808
803
|
if (opt.chunkSize) {
|
|
809
|
-
const { chunkSize, chunkConcurrency =
|
|
804
|
+
const { chunkSize, chunkConcurrency = 8 } = opt;
|
|
810
805
|
await _pipeline([
|
|
811
806
|
this.cfg.db.streamQuery(q.select(['id']), opt).map(r => r.id),
|
|
812
807
|
transformChunk({ chunkSize }),
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/db-lib",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "10.
|
|
4
|
+
"version": "10.2.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@naturalcycles/js-lib": "^15",
|
|
7
7
|
"@naturalcycles/nodejs-lib": "^14"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"@naturalcycles/dev-lib": "
|
|
10
|
+
"@naturalcycles/dev-lib": "18.4.2"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"dist",
|
|
@@ -57,6 +57,8 @@
|
|
|
57
57
|
"test": "dev-lib test",
|
|
58
58
|
"lint": "dev-lib lint",
|
|
59
59
|
"bt": "dev-lib bt",
|
|
60
|
-
"
|
|
60
|
+
"clean": "dev-lib clean",
|
|
61
|
+
"typecheck": "dev-lib typecheck",
|
|
62
|
+
"check": "dev-lib check"
|
|
61
63
|
}
|
|
62
64
|
}
|
|
@@ -68,9 +68,6 @@ import type {
|
|
|
68
68
|
} from './common.dao.model.js'
|
|
69
69
|
import { CommonDaoLogLevel } from './common.dao.model.js'
|
|
70
70
|
|
|
71
|
-
const isGAE = !!process.env['GAE_INSTANCE']
|
|
72
|
-
const isCI = !!process.env['CI']
|
|
73
|
-
|
|
74
71
|
/**
|
|
75
72
|
* Lowest common denominator API between supported Databases.
|
|
76
73
|
*
|
|
@@ -81,10 +78,7 @@ const isCI = !!process.env['CI']
|
|
|
81
78
|
export class CommonDao<BM extends BaseDBEntity, DBM extends BaseDBEntity = BM, ID = BM['id']> {
|
|
82
79
|
constructor(public cfg: CommonDaoCfg<BM, DBM, ID>) {
|
|
83
80
|
this.cfg = {
|
|
84
|
-
|
|
85
|
-
// otherwise to log Operations
|
|
86
|
-
// e.g in Dev (local machine), Test - it will log operations (useful for debugging)
|
|
87
|
-
logLevel: isGAE || isCI ? CommonDaoLogLevel.NONE : CommonDaoLogLevel.OPERATIONS,
|
|
81
|
+
logLevel: CommonDaoLogLevel.NONE,
|
|
88
82
|
generateId: true,
|
|
89
83
|
assignGeneratedIds: false,
|
|
90
84
|
useCreatedProperty: true,
|
|
@@ -1051,7 +1045,7 @@ export class CommonDao<BM extends BaseDBEntity, DBM extends BaseDBEntity = BM, I
|
|
|
1051
1045
|
let deleted = 0
|
|
1052
1046
|
|
|
1053
1047
|
if (opt.chunkSize) {
|
|
1054
|
-
const { chunkSize, chunkConcurrency =
|
|
1048
|
+
const { chunkSize, chunkConcurrency = 8 } = opt
|
|
1055
1049
|
|
|
1056
1050
|
await _pipeline([
|
|
1057
1051
|
this.cfg.db.streamQuery<DBM>(q.select(['id']), opt).map(r => r.id),
|