@naturalcycles/db-lib 8.24.0 → 8.24.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.
- package/dist/adapter/cachedb/cache.db.js +2 -1
- package/dist/adapter/cachedb/cache.db.model.d.ts +2 -1
- package/dist/adapter/file/file.db.js +2 -1
- package/dist/adapter/file/file.db.model.d.ts +2 -1
- package/dist/adapter/inmemory/inMemory.db.d.ts +2 -1
- package/dist/adapter/inmemory/inMemory.db.js +2 -1
- package/dist/commondao/common.dao.js +2 -1
- package/dist/commondao/common.dao.model.d.ts +2 -1
- package/package.json +1 -1
- package/src/adapter/cachedb/cache.db.model.ts +2 -1
- package/src/adapter/cachedb/cache.db.ts +3 -1
- package/src/adapter/file/file.db.model.ts +2 -1
- package/src/adapter/file/file.db.ts +3 -1
- package/src/adapter/inmemory/inMemory.db.ts +5 -2
- package/src/commondao/common.dao.model.ts +2 -1
- package/src/commondao/common.dao.ts +3 -1
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CacheDB = void 0;
|
|
4
4
|
const stream_1 = require("stream");
|
|
5
5
|
const base_common_db_1 = require("../../base.common.db");
|
|
6
|
+
const isGAE = !!process.env['GAE_INSTANCE'];
|
|
6
7
|
/**
|
|
7
8
|
* CommonDB implementation that proxies requests to downstream CommonDB
|
|
8
9
|
* and does in-memory caching.
|
|
@@ -13,7 +14,7 @@ class CacheDB extends base_common_db_1.BaseCommonDB {
|
|
|
13
14
|
constructor(cfg) {
|
|
14
15
|
super();
|
|
15
16
|
this.cfg = {
|
|
16
|
-
logger: console,
|
|
17
|
+
logger: isGAE ? undefined : console,
|
|
17
18
|
...cfg,
|
|
18
19
|
};
|
|
19
20
|
}
|
|
@@ -5,6 +5,7 @@ const js_lib_1 = require("@naturalcycles/js-lib");
|
|
|
5
5
|
const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
|
|
6
6
|
const colors_1 = require("@naturalcycles/nodejs-lib/dist/colors");
|
|
7
7
|
const __1 = require("../..");
|
|
8
|
+
const isGAE = !!process.env['GAE_INSTANCE'];
|
|
8
9
|
/**
|
|
9
10
|
* Provides barebone implementation for "whole file" based CommonDB.
|
|
10
11
|
* "whole file" means that the persistence layer doesn't allow any querying,
|
|
@@ -21,7 +22,7 @@ class FileDB extends __1.BaseCommonDB {
|
|
|
21
22
|
this.cfg = {
|
|
22
23
|
sortObjects: true,
|
|
23
24
|
logFinished: true,
|
|
24
|
-
logger: console,
|
|
25
|
+
logger: isGAE ? undefined : console,
|
|
25
26
|
...cfg,
|
|
26
27
|
};
|
|
27
28
|
}
|
|
@@ -8,6 +8,7 @@ const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
|
|
|
8
8
|
const colors_1 = require("@naturalcycles/nodejs-lib/dist/colors");
|
|
9
9
|
const fs = require("fs-extra");
|
|
10
10
|
const __1 = require("../..");
|
|
11
|
+
const isGAE = !!process.env['GAE_INSTANCE'];
|
|
11
12
|
class InMemoryDB {
|
|
12
13
|
constructor(cfg) {
|
|
13
14
|
// data[table][id] > {id: 'a', created: ... }
|
|
@@ -18,7 +19,7 @@ class InMemoryDB {
|
|
|
18
19
|
persistenceEnabled: false,
|
|
19
20
|
persistZip: true,
|
|
20
21
|
persistentStoragePath: './tmp/inmemorydb',
|
|
21
|
-
logger: console,
|
|
22
|
+
logger: isGAE ? undefined : console,
|
|
22
23
|
...cfg,
|
|
23
24
|
};
|
|
24
25
|
}
|
|
@@ -8,6 +8,7 @@ const db_model_1 = require("../db.model");
|
|
|
8
8
|
const dbQuery_1 = require("../query/dbQuery");
|
|
9
9
|
const common_dao_model_1 = require("./common.dao.model");
|
|
10
10
|
/* eslint-disable no-dupe-class-members */
|
|
11
|
+
const isGAE = !!process.env['GAE_INSTANCE'];
|
|
11
12
|
/**
|
|
12
13
|
* Lowest common denominator API between supported Databases.
|
|
13
14
|
*
|
|
@@ -21,7 +22,7 @@ class CommonDao {
|
|
|
21
22
|
this.cfg = {
|
|
22
23
|
logLevel: common_dao_model_1.CommonDaoLogLevel.OPERATIONS,
|
|
23
24
|
createdUpdated: true,
|
|
24
|
-
logger: console,
|
|
25
|
+
logger: isGAE ? undefined : console,
|
|
25
26
|
...cfg,
|
|
26
27
|
hooks: {
|
|
27
28
|
createId: () => (0, nodejs_lib_1.stringId)(),
|
|
@@ -56,7 +56,8 @@ export interface CommonDaoCfg<BM extends Partial<ObjectWithId>, DBM extends Obje
|
|
|
56
56
|
/**
|
|
57
57
|
* Pass undefined (or noopLogger) to disable logging completely.
|
|
58
58
|
*
|
|
59
|
-
*
|
|
59
|
+
* Defaults to `console` in dev.
|
|
60
|
+
* Default to noop in AppEngine.
|
|
60
61
|
*/
|
|
61
62
|
logger?: CommonLogger;
|
|
62
63
|
/**
|
package/package.json
CHANGED
|
@@ -16,6 +16,8 @@ import {
|
|
|
16
16
|
CacheDBStreamOptions,
|
|
17
17
|
} from './cache.db.model'
|
|
18
18
|
|
|
19
|
+
const isGAE = !!process.env['GAE_INSTANCE']
|
|
20
|
+
|
|
19
21
|
/**
|
|
20
22
|
* CommonDB implementation that proxies requests to downstream CommonDB
|
|
21
23
|
* and does in-memory caching.
|
|
@@ -26,7 +28,7 @@ export class CacheDB extends BaseCommonDB implements CommonDB {
|
|
|
26
28
|
constructor(cfg: CacheDBCfg) {
|
|
27
29
|
super()
|
|
28
30
|
this.cfg = {
|
|
29
|
-
logger: console,
|
|
31
|
+
logger: isGAE ? undefined : console,
|
|
30
32
|
...cfg,
|
|
31
33
|
}
|
|
32
34
|
}
|
|
@@ -28,6 +28,8 @@ import { DBQuery } from '../../query/dbQuery'
|
|
|
28
28
|
import { DBTransaction } from '../../transaction/dbTransaction'
|
|
29
29
|
import { FileDBCfg } from './file.db.model'
|
|
30
30
|
|
|
31
|
+
const isGAE = !!process.env['GAE_INSTANCE']
|
|
32
|
+
|
|
31
33
|
/**
|
|
32
34
|
* Provides barebone implementation for "whole file" based CommonDB.
|
|
33
35
|
* "whole file" means that the persistence layer doesn't allow any querying,
|
|
@@ -44,7 +46,7 @@ export class FileDB extends BaseCommonDB implements CommonDB {
|
|
|
44
46
|
this.cfg = {
|
|
45
47
|
sortObjects: true,
|
|
46
48
|
logFinished: true,
|
|
47
|
-
logger: console,
|
|
49
|
+
logger: isGAE ? undefined : console,
|
|
48
50
|
...cfg,
|
|
49
51
|
}
|
|
50
52
|
}
|
|
@@ -65,11 +65,14 @@ export interface InMemoryDBCfg {
|
|
|
65
65
|
persistZip: boolean
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
68
|
+
* Defaults to `console` in dev.
|
|
69
|
+
* Default to noop in AppEngine.
|
|
69
70
|
*/
|
|
70
71
|
logger?: CommonLogger
|
|
71
72
|
}
|
|
72
73
|
|
|
74
|
+
const isGAE = !!process.env['GAE_INSTANCE']
|
|
75
|
+
|
|
73
76
|
export class InMemoryDB implements CommonDB {
|
|
74
77
|
constructor(cfg?: Partial<InMemoryDBCfg>) {
|
|
75
78
|
this.cfg = {
|
|
@@ -78,7 +81,7 @@ export class InMemoryDB implements CommonDB {
|
|
|
78
81
|
persistenceEnabled: false,
|
|
79
82
|
persistZip: true,
|
|
80
83
|
persistentStoragePath: './tmp/inmemorydb',
|
|
81
|
-
logger: console,
|
|
84
|
+
logger: isGAE ? undefined : console,
|
|
82
85
|
...cfg,
|
|
83
86
|
}
|
|
84
87
|
}
|
|
@@ -73,7 +73,8 @@ export interface CommonDaoCfg<BM extends Partial<ObjectWithId>, DBM extends Obje
|
|
|
73
73
|
/**
|
|
74
74
|
* Pass undefined (or noopLogger) to disable logging completely.
|
|
75
75
|
*
|
|
76
|
-
*
|
|
76
|
+
* Defaults to `console` in dev.
|
|
77
|
+
* Default to noop in AppEngine.
|
|
77
78
|
*/
|
|
78
79
|
logger?: CommonLogger
|
|
79
80
|
|
|
@@ -46,6 +46,8 @@ import {
|
|
|
46
46
|
|
|
47
47
|
/* eslint-disable no-dupe-class-members */
|
|
48
48
|
|
|
49
|
+
const isGAE = !!process.env['GAE_INSTANCE']
|
|
50
|
+
|
|
49
51
|
/**
|
|
50
52
|
* Lowest common denominator API between supported Databases.
|
|
51
53
|
*
|
|
@@ -62,7 +64,7 @@ export class CommonDao<
|
|
|
62
64
|
this.cfg = {
|
|
63
65
|
logLevel: CommonDaoLogLevel.OPERATIONS,
|
|
64
66
|
createdUpdated: true,
|
|
65
|
-
logger: console,
|
|
67
|
+
logger: isGAE ? undefined : console,
|
|
66
68
|
...cfg,
|
|
67
69
|
hooks: {
|
|
68
70
|
createId: () => stringId(),
|