@naturalcycles/db-lib 10.56.3 → 10.57.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.
- package/dist/adapter/cachedb/cache.db.js +2 -1
- package/dist/adapter/cachedb/cache.db.model.d.ts +1 -1
- package/dist/adapter/file/file.db.js +2 -1
- package/dist/adapter/file/file.db.model.d.ts +1 -1
- package/dist/commondao/common.dao.js +2 -1
- package/dist/commondao/common.dao.model.d.ts +1 -1
- package/dist/commondao/commonDaoTransaction.js +1 -1
- package/dist/inmemory/inMemory.db.d.ts +1 -1
- package/dist/inmemory/inMemory.db.js +2 -1
- package/dist/kv/commonKeyValueDao.d.ts +1 -1
- package/dist/kv/commonKeyValueDao.js +4 -3
- package/package.json +1 -1
- package/src/adapter/cachedb/cache.db.model.ts +1 -1
- package/src/adapter/cachedb/cache.db.ts +2 -1
- package/src/adapter/file/file.db.model.ts +1 -1
- package/src/adapter/file/file.db.ts +2 -1
- package/src/commondao/common.dao.model.ts +1 -1
- package/src/commondao/common.dao.ts +2 -1
- package/src/commondao/commonDaoTransaction.ts +1 -1
- package/src/inmemory/inMemory.db.ts +3 -2
- package/src/kv/commonKeyValueDao.ts +5 -4
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { _isTruthy } from '@naturalcycles/js-lib';
|
|
2
|
+
import { consoleLogger } from '@naturalcycles/js-lib/log';
|
|
2
3
|
import { Pipeline } from '@naturalcycles/nodejs-lib/stream';
|
|
3
4
|
import { BaseCommonDB } from '../../commondb/base.common.db.js';
|
|
4
5
|
import { commonDBFullSupport } from '../../commondb/common.db.js';
|
|
@@ -17,7 +18,7 @@ export class CacheDB extends BaseCommonDB {
|
|
|
17
18
|
constructor(cfg) {
|
|
18
19
|
super();
|
|
19
20
|
this.cfg = {
|
|
20
|
-
logger:
|
|
21
|
+
logger: consoleLogger,
|
|
21
22
|
...cfg,
|
|
22
23
|
};
|
|
23
24
|
}
|
|
@@ -2,6 +2,7 @@ import { Readable } from 'node:stream';
|
|
|
2
2
|
import { _by, _sortBy } from '@naturalcycles/js-lib/array';
|
|
3
3
|
import { _since, localTime } from '@naturalcycles/js-lib/datetime';
|
|
4
4
|
import { _assert } from '@naturalcycles/js-lib/error/assert.js';
|
|
5
|
+
import { consoleLogger } from '@naturalcycles/js-lib/log';
|
|
5
6
|
import { _deepEquals, _filterUndefinedValues, _sortObjectDeep } from '@naturalcycles/js-lib/object';
|
|
6
7
|
import { _stringMapValues } from '@naturalcycles/js-lib/types';
|
|
7
8
|
import { generateJsonSchemaFromData } from '@naturalcycles/nodejs-lib/ajv';
|
|
@@ -36,7 +37,7 @@ export class FileDB extends BaseCommonDB {
|
|
|
36
37
|
this.cfg = {
|
|
37
38
|
sortObjects: true,
|
|
38
39
|
logFinished: true,
|
|
39
|
-
logger:
|
|
40
|
+
logger: consoleLogger,
|
|
40
41
|
...cfg,
|
|
41
42
|
};
|
|
42
43
|
}
|
|
@@ -2,6 +2,7 @@ import { _isTruthy } from '@naturalcycles/js-lib';
|
|
|
2
2
|
import { _uniqBy } from '@naturalcycles/js-lib/array/array.util.js';
|
|
3
3
|
import { localTime } from '@naturalcycles/js-lib/datetime/localTime.js';
|
|
4
4
|
import { _assert, ErrorMode } from '@naturalcycles/js-lib/error';
|
|
5
|
+
import { consoleLogger } from '@naturalcycles/js-lib/log';
|
|
5
6
|
import { _deepJsonEquals } from '@naturalcycles/js-lib/object/deepEquals.js';
|
|
6
7
|
import { _filterUndefinedValues, _objectAssignExact, _omitWithUndefined, _pick, } from '@naturalcycles/js-lib/object/object.util.js';
|
|
7
8
|
import { pMap } from '@naturalcycles/js-lib/promise/pMap.js';
|
|
@@ -32,7 +33,7 @@ export class CommonDao {
|
|
|
32
33
|
useUpdatedProperty: true,
|
|
33
34
|
validateOnLoad: true,
|
|
34
35
|
validateOnSave: true,
|
|
35
|
-
logger:
|
|
36
|
+
logger: consoleLogger,
|
|
36
37
|
...cfg,
|
|
37
38
|
hooks: {
|
|
38
39
|
parseNaturalId: () => ({}),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { _isEmptyObject } from '@naturalcycles/js-lib';
|
|
2
2
|
import { _assert } from '@naturalcycles/js-lib/error/assert.js';
|
|
3
|
+
import { consoleLogger } from '@naturalcycles/js-lib/log';
|
|
3
4
|
import { _deepCopy, _sortObjectDeep } from '@naturalcycles/js-lib/object';
|
|
4
5
|
import { _stringMapEntries, _stringMapValues } from '@naturalcycles/js-lib/types';
|
|
5
6
|
import { generateJsonSchemaFromData } from '@naturalcycles/nodejs-lib/ajv';
|
|
@@ -17,7 +18,7 @@ export class InMemoryDB {
|
|
|
17
18
|
// defaults
|
|
18
19
|
tablesPrefix: '',
|
|
19
20
|
forbidTransactionReadAfterWrite: true,
|
|
20
|
-
logger:
|
|
21
|
+
logger: consoleLogger,
|
|
21
22
|
...cfg,
|
|
22
23
|
};
|
|
23
24
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AppError } from '@naturalcycles/js-lib/error/error.util.js';
|
|
2
|
+
import { consoleLogger } from '@naturalcycles/js-lib/log';
|
|
2
3
|
import { SKIP } from '@naturalcycles/js-lib/types';
|
|
3
4
|
import { zip2 } from '@naturalcycles/nodejs-lib/zip';
|
|
4
5
|
/**
|
|
@@ -31,7 +32,7 @@ export function commonKeyValueDaoCompressedTransformer() {
|
|
|
31
32
|
export class CommonKeyValueDao {
|
|
32
33
|
constructor(cfg) {
|
|
33
34
|
this.cfg = {
|
|
34
|
-
logger:
|
|
35
|
+
logger: consoleLogger,
|
|
35
36
|
...cfg,
|
|
36
37
|
};
|
|
37
38
|
}
|
|
@@ -118,7 +119,7 @@ export class CommonKeyValueDao {
|
|
|
118
119
|
return transformer.bufferToValue(buf);
|
|
119
120
|
}
|
|
120
121
|
catch (err) {
|
|
121
|
-
this.cfg.logger.error(err);
|
|
122
|
+
this.cfg.logger.error({ err });
|
|
122
123
|
return SKIP;
|
|
123
124
|
}
|
|
124
125
|
});
|
|
@@ -133,7 +134,7 @@ export class CommonKeyValueDao {
|
|
|
133
134
|
return [id, transformer.bufferToValue(buf)];
|
|
134
135
|
}
|
|
135
136
|
catch (err) {
|
|
136
|
-
this.cfg.logger.error(err);
|
|
137
|
+
this.cfg.logger.error({ err });
|
|
137
138
|
return SKIP;
|
|
138
139
|
}
|
|
139
140
|
});
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { _isTruthy } from '@naturalcycles/js-lib'
|
|
2
|
+
import { consoleLogger } from '@naturalcycles/js-lib/log'
|
|
2
3
|
import type { ObjectWithId, StringMap } from '@naturalcycles/js-lib/types'
|
|
3
4
|
import type { JsonSchema } from '@naturalcycles/nodejs-lib/ajv'
|
|
4
5
|
import { Pipeline } from '@naturalcycles/nodejs-lib/stream'
|
|
@@ -31,7 +32,7 @@ export class CacheDB extends BaseCommonDB implements CommonDB {
|
|
|
31
32
|
constructor(cfg: CacheDBCfg) {
|
|
32
33
|
super()
|
|
33
34
|
this.cfg = {
|
|
34
|
-
logger:
|
|
35
|
+
logger: consoleLogger,
|
|
35
36
|
...cfg,
|
|
36
37
|
}
|
|
37
38
|
}
|
|
@@ -2,6 +2,7 @@ import { Readable } from 'node:stream'
|
|
|
2
2
|
import { _by, _sortBy } from '@naturalcycles/js-lib/array'
|
|
3
3
|
import { _since, localTime } from '@naturalcycles/js-lib/datetime'
|
|
4
4
|
import { _assert } from '@naturalcycles/js-lib/error/assert.js'
|
|
5
|
+
import { consoleLogger } from '@naturalcycles/js-lib/log'
|
|
5
6
|
import { _deepEquals, _filterUndefinedValues, _sortObjectDeep } from '@naturalcycles/js-lib/object'
|
|
6
7
|
import { _stringMapValues } from '@naturalcycles/js-lib/types'
|
|
7
8
|
import type { ObjectWithId, UnixTimestampMillis } from '@naturalcycles/js-lib/types'
|
|
@@ -50,7 +51,7 @@ export class FileDB extends BaseCommonDB implements CommonDB {
|
|
|
50
51
|
this.cfg = {
|
|
51
52
|
sortObjects: true,
|
|
52
53
|
logFinished: true,
|
|
53
|
-
logger:
|
|
54
|
+
logger: consoleLogger,
|
|
54
55
|
...cfg,
|
|
55
56
|
}
|
|
56
57
|
}
|
|
@@ -2,6 +2,7 @@ import { _isTruthy } from '@naturalcycles/js-lib'
|
|
|
2
2
|
import { _uniqBy } from '@naturalcycles/js-lib/array/array.util.js'
|
|
3
3
|
import { localTime } from '@naturalcycles/js-lib/datetime/localTime.js'
|
|
4
4
|
import { _assert, ErrorMode } from '@naturalcycles/js-lib/error'
|
|
5
|
+
import { consoleLogger } from '@naturalcycles/js-lib/log'
|
|
5
6
|
import { _deepJsonEquals } from '@naturalcycles/js-lib/object/deepEquals.js'
|
|
6
7
|
import {
|
|
7
8
|
_filterUndefinedValues,
|
|
@@ -75,7 +76,7 @@ export class CommonDao<
|
|
|
75
76
|
useUpdatedProperty: true,
|
|
76
77
|
validateOnLoad: true,
|
|
77
78
|
validateOnSave: true,
|
|
78
|
-
logger:
|
|
79
|
+
logger: consoleLogger,
|
|
79
80
|
...cfg,
|
|
80
81
|
hooks: {
|
|
81
82
|
parseNaturalId: () => ({}),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { _isEmptyObject } from '@naturalcycles/js-lib'
|
|
2
2
|
import { _assert } from '@naturalcycles/js-lib/error/assert.js'
|
|
3
|
+
import { consoleLogger } from '@naturalcycles/js-lib/log'
|
|
3
4
|
import type { CommonLogger } from '@naturalcycles/js-lib/log'
|
|
4
5
|
import { _deepCopy, _sortObjectDeep } from '@naturalcycles/js-lib/object'
|
|
5
6
|
import { _stringMapEntries, _stringMapValues } from '@naturalcycles/js-lib/types'
|
|
@@ -49,7 +50,7 @@ export interface InMemoryDBCfg {
|
|
|
49
50
|
forbidTransactionReadAfterWrite?: boolean
|
|
50
51
|
|
|
51
52
|
/**
|
|
52
|
-
* Defaults to `
|
|
53
|
+
* Defaults to `consoleLogger`.
|
|
53
54
|
*/
|
|
54
55
|
logger?: CommonLogger
|
|
55
56
|
}
|
|
@@ -67,7 +68,7 @@ export class InMemoryDB implements CommonDB {
|
|
|
67
68
|
// defaults
|
|
68
69
|
tablesPrefix: '',
|
|
69
70
|
forbidTransactionReadAfterWrite: true,
|
|
70
|
-
logger:
|
|
71
|
+
logger: consoleLogger,
|
|
71
72
|
...cfg,
|
|
72
73
|
}
|
|
73
74
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AppError } from '@naturalcycles/js-lib/error/error.util.js'
|
|
2
|
+
import { consoleLogger } from '@naturalcycles/js-lib/log'
|
|
2
3
|
import type { CommonLogger } from '@naturalcycles/js-lib/log'
|
|
3
4
|
import { SKIP } from '@naturalcycles/js-lib/types'
|
|
4
5
|
import type { Integer, KeyValueTuple } from '@naturalcycles/js-lib/types'
|
|
@@ -25,7 +26,7 @@ export interface CommonKeyValueDaoCfg<V> {
|
|
|
25
26
|
readOnly?: boolean
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
|
-
* Default to
|
|
29
|
+
* Default to consoleLogger
|
|
29
30
|
*/
|
|
30
31
|
logger?: CommonLogger
|
|
31
32
|
|
|
@@ -87,7 +88,7 @@ export function commonKeyValueDaoCompressedTransformer<T = any>(): CommonKeyValu
|
|
|
87
88
|
export class CommonKeyValueDao<K extends string = string, V = Buffer> {
|
|
88
89
|
constructor(cfg: CommonKeyValueDaoCfg<V>) {
|
|
89
90
|
this.cfg = {
|
|
90
|
-
logger:
|
|
91
|
+
logger: consoleLogger,
|
|
91
92
|
...cfg,
|
|
92
93
|
}
|
|
93
94
|
}
|
|
@@ -198,7 +199,7 @@ export class CommonKeyValueDao<K extends string = string, V = Buffer> {
|
|
|
198
199
|
try {
|
|
199
200
|
return transformer.bufferToValue(buf)
|
|
200
201
|
} catch (err) {
|
|
201
|
-
this.cfg.logger.error(err)
|
|
202
|
+
this.cfg.logger.error({ err })
|
|
202
203
|
return SKIP
|
|
203
204
|
}
|
|
204
205
|
})
|
|
@@ -215,7 +216,7 @@ export class CommonKeyValueDao<K extends string = string, V = Buffer> {
|
|
|
215
216
|
try {
|
|
216
217
|
return [id as K, transformer.bufferToValue(buf)]
|
|
217
218
|
} catch (err) {
|
|
218
|
-
this.cfg.logger.error(err)
|
|
219
|
+
this.cfg.logger.error({ err })
|
|
219
220
|
return SKIP
|
|
220
221
|
}
|
|
221
222
|
})
|