@naturalcycles/db-lib 10.0.1 → 10.0.2
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.d.ts +6 -6
- package/dist/adapter/cachedb/cache.db.js +6 -5
- package/dist/adapter/cachedb/cache.db.model.d.ts +3 -3
- package/dist/adapter/cachedb/index.d.ts +1 -1
- package/dist/adapter/file/file.db.d.ts +8 -7
- package/dist/adapter/file/file.db.js +11 -10
- package/dist/adapter/file/file.db.model.d.ts +2 -2
- package/dist/adapter/file/inMemory.persistence.plugin.d.ts +3 -3
- package/dist/adapter/file/inMemory.persistence.plugin.js +1 -3
- package/dist/adapter/file/index.d.ts +1 -1
- package/dist/adapter/file/localFile.persistence.plugin.d.ts +3 -3
- package/dist/adapter/file/localFile.persistence.plugin.js +1 -0
- package/dist/adapter/file/noop.persistence.plugin.d.ts +3 -3
- package/dist/adapter/inmemory/inMemory.db.d.ts +6 -5
- package/dist/adapter/inmemory/inMemory.db.js +13 -10
- package/dist/adapter/inmemory/inMemoryKeyValueDB.d.ts +4 -4
- package/dist/adapter/inmemory/inMemoryKeyValueDB.js +6 -5
- package/dist/adapter/inmemory/queryInMemory.d.ts +2 -2
- package/dist/base.common.db.d.ts +6 -5
- package/dist/base.common.db.js +2 -4
- package/dist/common.db.d.ts +3 -3
- package/dist/commondao/common.dao.d.ts +9 -6
- package/dist/commondao/common.dao.js +6 -2
- package/dist/commondao/common.dao.model.d.ts +5 -4
- package/dist/db.model.d.ts +2 -2
- package/dist/kv/commonKeyValueDB.d.ts +3 -3
- package/dist/kv/commonKeyValueDao.d.ts +5 -5
- package/dist/kv/commonKeyValueDao.js +1 -0
- package/dist/kv/commonKeyValueDaoMemoCache.d.ts +3 -2
- package/dist/kv/commonKeyValueDaoMemoCache.js +1 -0
- package/dist/model.util.d.ts +1 -1
- package/dist/pipeline/dbPipelineBackup.d.ts +5 -3
- package/dist/pipeline/dbPipelineCopy.d.ts +6 -4
- package/dist/pipeline/dbPipelineRestore.d.ts +6 -4
- package/dist/query/dbQuery.d.ts +5 -5
- package/dist/query/dbQuery.js +15 -5
- package/dist/testing/daoTest.d.ts +2 -2
- package/dist/testing/dbTest.d.ts +1 -1
- package/dist/testing/index.d.ts +4 -2
- package/dist/testing/keyValueDBTest.d.ts +1 -1
- package/dist/testing/keyValueDaoTest.d.ts +1 -1
- package/dist/testing/test.model.d.ts +1 -1
- package/dist/testing/timeSeriesTest.util.d.ts +1 -1
- package/dist/timeseries/commonTimeSeriesDao.d.ts +1 -1
- package/dist/timeseries/commonTimeSeriesDao.js +1 -0
- package/dist/timeseries/timeSeries.model.d.ts +1 -1
- package/dist/transaction/dbTransaction.util.d.ts +2 -2
- package/dist/transaction/dbTransaction.util.js +1 -0
- package/dist/validation/index.d.ts +2 -2
- package/package.json +3 -2
- package/src/adapter/cachedb/cache.db.model.ts +3 -3
- package/src/adapter/cachedb/cache.db.ts +8 -7
- package/src/adapter/cachedb/index.ts +1 -1
- package/src/adapter/file/file.db.model.ts +2 -2
- package/src/adapter/file/file.db.ts +9 -15
- package/src/adapter/file/inMemory.persistence.plugin.ts +4 -3
- package/src/adapter/file/index.ts +1 -1
- package/src/adapter/file/localFile.persistence.plugin.ts +4 -3
- package/src/adapter/file/noop.persistence.plugin.ts +3 -3
- package/src/adapter/inmemory/inMemory.db.ts +14 -20
- package/src/adapter/inmemory/inMemoryKeyValueDB.ts +5 -9
- package/src/adapter/inmemory/queryInMemory.ts +3 -2
- package/src/base.common.db.ts +6 -5
- package/src/common.db.ts +3 -3
- package/src/commondao/common.dao.model.ts +5 -6
- package/src/commondao/common.dao.ts +25 -21
- package/src/db.model.ts +2 -2
- package/src/kv/commonKeyValueDB.ts +3 -3
- package/src/kv/commonKeyValueDao.ts +7 -5
- package/src/kv/commonKeyValueDaoMemoCache.ts +3 -8
- package/src/model.util.ts +2 -1
- package/src/pipeline/dbPipelineBackup.ts +4 -13
- package/src/pipeline/dbPipelineCopy.ts +5 -13
- package/src/pipeline/dbPipelineRestore.ts +9 -8
- package/src/query/dbQuery.ts +6 -11
- package/src/testing/daoTest.ts +3 -3
- package/src/testing/dbTest.ts +3 -2
- package/src/testing/index.ts +3 -4
- package/src/testing/keyValueDBTest.ts +3 -2
- package/src/testing/keyValueDaoTest.ts +1 -1
- package/src/testing/test.model.ts +2 -7
- package/src/testing/timeSeriesTest.util.ts +1 -1
- package/src/timeseries/commonTimeSeriesDao.ts +3 -2
- package/src/timeseries/timeSeries.model.ts +1 -1
- package/src/transaction/dbTransaction.util.ts +2 -2
- package/src/validation/index.ts +3 -8
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AsyncMapper,
|
|
3
|
+
BaseDBEntity,
|
|
4
|
+
JsonSchemaObject,
|
|
5
|
+
UnixTimestamp,
|
|
6
|
+
} from '@naturalcycles/js-lib'
|
|
1
7
|
import {
|
|
2
8
|
_hb,
|
|
3
9
|
_mapValues,
|
|
4
10
|
_passthroughMapper,
|
|
5
|
-
AsyncMapper,
|
|
6
|
-
BaseDBEntity,
|
|
7
11
|
ErrorMode,
|
|
8
|
-
JsonSchemaObject,
|
|
9
12
|
localTime,
|
|
10
13
|
pMap,
|
|
11
|
-
UnixTimestamp,
|
|
12
14
|
} from '@naturalcycles/js-lib'
|
|
15
|
+
import type { TransformLogProgressOptions, TransformMapOptions } from '@naturalcycles/nodejs-lib'
|
|
13
16
|
import {
|
|
14
17
|
_pipeline,
|
|
15
18
|
boldWhite,
|
|
@@ -20,15 +23,13 @@ import {
|
|
|
20
23
|
transformChunk,
|
|
21
24
|
transformFilterSync,
|
|
22
25
|
transformLogProgress,
|
|
23
|
-
TransformLogProgressOptions,
|
|
24
26
|
transformMap,
|
|
25
|
-
TransformMapOptions,
|
|
26
27
|
transformTap,
|
|
27
28
|
writableForEach,
|
|
28
29
|
yellow,
|
|
29
30
|
} from '@naturalcycles/nodejs-lib'
|
|
30
|
-
import { CommonDB } from '../common.db'
|
|
31
|
-
import { CommonDBSaveOptions } from '../index'
|
|
31
|
+
import type { CommonDB } from '../common.db'
|
|
32
|
+
import type { CommonDBSaveOptions } from '../index'
|
|
32
33
|
|
|
33
34
|
export interface DBPipelineRestoreOptions extends TransformLogProgressOptions {
|
|
34
35
|
/**
|
package/src/query/dbQuery.ts
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
BaseDBEntity,
|
|
6
|
-
ObjectWithId,
|
|
7
|
-
} from '@naturalcycles/js-lib'
|
|
8
|
-
import { ReadableTyped } from '@naturalcycles/nodejs-lib'
|
|
9
|
-
import {
|
|
1
|
+
import type { AsyncMapper, BaseDBEntity, ObjectWithId } from '@naturalcycles/js-lib'
|
|
2
|
+
import { _objectAssign, _truncate } from '@naturalcycles/js-lib'
|
|
3
|
+
import type { ReadableTyped } from '@naturalcycles/nodejs-lib'
|
|
4
|
+
import type {
|
|
10
5
|
CommonDaoOptions,
|
|
11
6
|
CommonDaoReadOptions,
|
|
12
7
|
CommonDaoStreamDeleteOptions,
|
|
13
8
|
CommonDaoStreamForEachOptions,
|
|
14
9
|
CommonDaoStreamOptions,
|
|
15
10
|
} from '..'
|
|
16
|
-
import { CommonDao } from '../commondao/common.dao'
|
|
17
|
-
import { RunQueryResult } from '../db.model'
|
|
11
|
+
import type { CommonDao } from '../commondao/common.dao'
|
|
12
|
+
import type { RunQueryResult } from '../db.model'
|
|
18
13
|
|
|
19
14
|
/**
|
|
20
15
|
* Modeled after Firestore operators (WhereFilterOp type)
|
package/src/testing/daoTest.ts
CHANGED
|
@@ -2,10 +2,10 @@ import { Readable } from 'node:stream'
|
|
|
2
2
|
import { _deepCopy, _filterObject, _omit, _pick, _sortBy, localTime } from '@naturalcycles/js-lib'
|
|
3
3
|
import { _pipeline } from '@naturalcycles/nodejs-lib'
|
|
4
4
|
import { CommonDaoLogLevel, DBQuery } from '..'
|
|
5
|
-
import { CommonDB } from '../common.db'
|
|
5
|
+
import type { CommonDB } from '../common.db'
|
|
6
6
|
import { CommonDao } from '../commondao/common.dao'
|
|
7
|
-
import { TestItemBM } from '.'
|
|
8
|
-
import { CommonDBImplementationQuirks } from './dbTest'
|
|
7
|
+
import type { TestItemBM } from '.'
|
|
8
|
+
import type { CommonDBImplementationQuirks } from './dbTest'
|
|
9
9
|
import {
|
|
10
10
|
createTestItemBM,
|
|
11
11
|
createTestItemsBM,
|
package/src/testing/dbTest.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { _deepFreeze, _filterObject, _pick, _sortBy, localTime, pMap } from '@naturalcycles/js-lib'
|
|
2
|
-
import { CommonDB
|
|
2
|
+
import type { CommonDB } from '../common.db'
|
|
3
|
+
import { CommonDBType } from '../common.db'
|
|
3
4
|
import { DBQuery } from '../query/dbQuery'
|
|
5
|
+
import type { TestItemDBM } from './test.model'
|
|
4
6
|
import {
|
|
5
7
|
createTestItemDBM,
|
|
6
8
|
createTestItemsDBM,
|
|
7
9
|
TEST_TABLE,
|
|
8
10
|
testItemBMJsonSchema,
|
|
9
|
-
TestItemDBM,
|
|
10
11
|
} from './test.model'
|
|
11
12
|
|
|
12
13
|
/**
|
package/src/testing/index.ts
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { runCommonDaoTest } from './daoTest'
|
|
2
|
-
import { CommonDBImplementationQuirks
|
|
2
|
+
import type { CommonDBImplementationQuirks } from './dbTest'
|
|
3
|
+
import { runCommonDBTest } from './dbTest'
|
|
3
4
|
import { runCommonKeyValueDaoTest } from './keyValueDaoTest'
|
|
4
5
|
import { runCommonKeyValueDBTest } from './keyValueDBTest'
|
|
6
|
+
import type { TestItemBM, TestItemDBM, TestItemTM } from './test.model'
|
|
5
7
|
import {
|
|
6
8
|
createTestItemBM,
|
|
7
9
|
createTestItemDBM,
|
|
8
10
|
createTestItemsBM,
|
|
9
11
|
createTestItemsDBM,
|
|
10
12
|
TEST_TABLE,
|
|
11
|
-
TestItemBM,
|
|
12
13
|
testItemBMJsonSchema,
|
|
13
14
|
testItemBMSchema,
|
|
14
|
-
TestItemDBM,
|
|
15
|
-
TestItemTM,
|
|
16
15
|
testItemTMSchema,
|
|
17
16
|
} from './test.model'
|
|
18
17
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { KeyValueTuple } from '@naturalcycles/js-lib'
|
|
2
|
+
import { _range, _sortBy } from '@naturalcycles/js-lib'
|
|
3
|
+
import type { CommonKeyValueDB } from '../kv/commonKeyValueDB'
|
|
3
4
|
import { TEST_TABLE } from './test.model'
|
|
4
5
|
|
|
5
6
|
const testIds = _range(1, 4).map(n => `id${n}`)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _sortBy } from '@naturalcycles/js-lib'
|
|
2
2
|
import { CommonKeyValueDao } from '../kv/commonKeyValueDao'
|
|
3
|
-
import { CommonKeyValueDB, KeyValueDBTuple } from '../kv/commonKeyValueDB'
|
|
3
|
+
import type { CommonKeyValueDB, KeyValueDBTuple } from '../kv/commonKeyValueDB'
|
|
4
4
|
import { createTestItemsBM, TEST_TABLE } from './test.model'
|
|
5
5
|
|
|
6
6
|
const testItems = createTestItemsBM(4)
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
BaseDBEntity,
|
|
4
|
-
jsonSchema,
|
|
5
|
-
JsonSchemaObject,
|
|
6
|
-
UnixTimestamp,
|
|
7
|
-
} from '@naturalcycles/js-lib'
|
|
1
|
+
import type { BaseDBEntity, JsonSchemaObject, UnixTimestamp } from '@naturalcycles/js-lib'
|
|
2
|
+
import { _range, jsonSchema } from '@naturalcycles/js-lib'
|
|
8
3
|
import {
|
|
9
4
|
baseDBEntitySchema,
|
|
10
5
|
binarySchema,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _randomInt, _range } from '@naturalcycles/js-lib'
|
|
2
|
-
import { TimeSeriesDataPoint } from '../timeseries/timeSeries.model'
|
|
2
|
+
import type { TimeSeriesDataPoint } from '../timeseries/timeSeries.model'
|
|
3
3
|
|
|
4
4
|
export function createTestTimeSeries(count = 10): TimeSeriesDataPoint[] {
|
|
5
5
|
const ts = Date.now()
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ObjectWithId } from '@naturalcycles/js-lib'
|
|
2
|
+
import { _isTruthy } from '@naturalcycles/js-lib'
|
|
2
3
|
import { DBQuery } from '../query/dbQuery'
|
|
3
|
-
import {
|
|
4
|
+
import type {
|
|
4
5
|
CommonTimeSeriesDaoCfg,
|
|
5
6
|
TimeSeriesDataPoint,
|
|
6
7
|
TimeSeriesQuery,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ObjectWithId } from '@naturalcycles/js-lib'
|
|
1
|
+
import type { ObjectWithId } from '@naturalcycles/js-lib'
|
|
2
2
|
import type { CommonDB } from '../common.db'
|
|
3
|
-
import { CommonDBOptions, CommonDBSaveOptions, DBTransaction } from '../db.model'
|
|
3
|
+
import type { CommonDBOptions, CommonDBSaveOptions, DBTransaction } from '../db.model'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Optimizes the Transaction (list of DBOperations) to do less operations.
|
package/src/validation/index.ts
CHANGED
|
@@ -7,14 +7,9 @@ import {
|
|
|
7
7
|
objectSchema,
|
|
8
8
|
stringSchema,
|
|
9
9
|
} from '@naturalcycles/nodejs-lib'
|
|
10
|
-
import { CommonDBOptions, CommonDBSaveOptions } from '../db.model'
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
DBQueryFilter,
|
|
14
|
-
DBQueryFilterOperator,
|
|
15
|
-
dbQueryFilterOperatorValues,
|
|
16
|
-
DBQueryOrder,
|
|
17
|
-
} from '../query/dbQuery'
|
|
10
|
+
import type { CommonDBOptions, CommonDBSaveOptions } from '../db.model'
|
|
11
|
+
import type { DBQuery, DBQueryFilter, DBQueryFilterOperator, DBQueryOrder } from '../query/dbQuery'
|
|
12
|
+
import { dbQueryFilterOperatorValues } from '../query/dbQuery'
|
|
18
13
|
|
|
19
14
|
export const commonDBOptionsSchema = objectSchema<CommonDBOptions>({
|
|
20
15
|
['onlyCache' as any]: booleanSchema.optional(),
|