@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
- // Default is to NOT log in AppEngine and in CI,
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 = 16 } = opt;
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 }),
@@ -138,7 +138,7 @@ export interface CommonDaoCfg<BM extends BaseDBEntity, DBM extends BaseDBEntity
138
138
  */
139
139
  logger?: CommonLogger;
140
140
  /**
141
- * @default OPERATIONS
141
+ * @default NONE
142
142
  */
143
143
  logLevel?: CommonDaoLogLevel;
144
144
  /**
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@naturalcycles/db-lib",
3
3
  "type": "module",
4
- "version": "10.1.5",
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
- "lbt": "dev-lib lbt"
60
+ "clean": "dev-lib clean",
61
+ "typecheck": "dev-lib typecheck",
62
+ "check": "dev-lib check"
61
63
  }
62
64
  }
@@ -176,7 +176,7 @@ export interface CommonDaoCfg<
176
176
  logger?: CommonLogger
177
177
 
178
178
  /**
179
- * @default OPERATIONS
179
+ * @default NONE
180
180
  */
181
181
  logLevel?: CommonDaoLogLevel
182
182
 
@@ -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
- // Default is to NOT log in AppEngine and in CI,
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 = 16 } = opt
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),