@naturalcycles/db-lib 10.5.0 → 10.7.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.d.ts +4 -3
- package/dist/adapter/cachedb/cache.db.js +2 -2
- package/dist/adapter/cachedb/cache.db.model.d.ts +3 -2
- package/dist/adapter/file/file.db.d.ts +4 -3
- package/dist/adapter/file/file.db.js +10 -5
- package/dist/adapter/file/file.db.model.d.ts +2 -1
- package/dist/adapter/file/inMemory.persistence.plugin.d.ts +1 -1
- package/dist/adapter/file/localFile.persistence.plugin.d.ts +1 -1
- package/dist/adapter/file/localFile.persistence.plugin.js +5 -5
- package/dist/adapter/file/noop.persistence.plugin.d.ts +1 -1
- package/dist/commondao/common.dao.d.ts +3 -1
- package/dist/commondao/common.dao.js +7 -1
- package/dist/commondao/common.dao.model.d.ts +4 -2
- package/dist/commondao/index.d.ts +2 -0
- package/dist/commondao/index.js +2 -0
- package/dist/{base.common.db.d.ts → commondb/base.common.db.d.ts} +4 -3
- package/dist/{base.common.db.js → commondb/base.common.db.js} +1 -1
- package/dist/{common.db.d.ts → commondb/common.db.d.ts} +4 -3
- package/dist/db.model.d.ts +2 -2
- package/dist/index.d.ts +2 -13
- package/dist/index.js +2 -13
- package/dist/{adapter/inmemory → inmemory}/inMemory.db.d.ts +7 -5
- package/dist/{adapter/inmemory → inmemory}/inMemory.db.js +13 -7
- package/dist/{adapter/inmemory → inmemory}/inMemoryKeyValueDB.d.ts +3 -3
- package/dist/{adapter/inmemory → inmemory}/inMemoryKeyValueDB.js +1 -1
- package/dist/inmemory/index.d.ts +3 -0
- package/dist/inmemory/index.js +3 -0
- package/dist/inmemory/queryInMemory.d.ts +3 -0
- package/dist/{adapter/inmemory → inmemory}/queryInMemory.js +1 -1
- package/dist/kv/commonKeyValueDB.d.ts +1 -1
- package/dist/kv/commonKeyValueDao.d.ts +2 -1
- package/dist/kv/commonKeyValueDao.js +3 -2
- package/dist/kv/commonKeyValueDaoMemoCache.d.ts +3 -2
- package/dist/kv/commonKeyValueDaoMemoCache.js +2 -1
- package/dist/kv/index.d.ts +3 -0
- package/dist/kv/index.js +3 -0
- package/dist/model.util.d.ts +1 -1
- package/dist/model.util.js +1 -1
- package/dist/pipeline/dbPipelineBackup.d.ts +4 -4
- package/dist/pipeline/dbPipelineBackup.js +8 -4
- package/dist/pipeline/dbPipelineCopy.d.ts +3 -3
- package/dist/pipeline/dbPipelineCopy.js +5 -2
- package/dist/pipeline/dbPipelineRestore.d.ts +4 -4
- package/dist/pipeline/dbPipelineRestore.js +10 -4
- package/dist/pipeline/index.d.ts +3 -0
- package/dist/pipeline/index.js +3 -0
- package/dist/query/dbQuery.d.ts +1 -1
- package/dist/query/dbQuery.js +2 -1
- package/dist/testing/commonDBTest.d.ts +1 -1
- package/dist/testing/commonDBTest.js +5 -2
- package/dist/testing/commonDaoTest.d.ts +1 -1
- package/dist/testing/commonDaoTest.js +3 -1
- package/dist/testing/test.model.d.ts +2 -1
- package/dist/testing/test.model.js +2 -1
- package/dist/timeseries/timeSeries.model.d.ts +1 -1
- package/dist/transaction/dbTransaction.util.d.ts +2 -2
- package/package.json +8 -4
- package/src/adapter/cachedb/cache.db.model.ts +3 -2
- package/src/adapter/cachedb/cache.db.ts +5 -9
- package/src/adapter/file/file.db.model.ts +2 -1
- package/src/adapter/file/file.db.ts +14 -16
- package/src/adapter/file/inMemory.persistence.plugin.ts +1 -1
- package/src/adapter/file/localFile.persistence.plugin.ts +10 -6
- package/src/adapter/file/noop.persistence.plugin.ts +1 -1
- package/src/commondao/common.dao.model.ts +4 -4
- package/src/commondao/common.dao.ts +15 -22
- package/src/commondao/index.ts +2 -0
- package/src/{base.common.db.ts → commondb/base.common.db.ts} +7 -11
- package/src/{common.db.ts → commondb/common.db.ts} +4 -8
- package/src/db.model.ts +2 -2
- package/src/index.ts +2 -13
- package/src/{adapter/inmemory → inmemory}/inMemory.db.ts +30 -27
- package/src/{adapter/inmemory → inmemory}/inMemoryKeyValueDB.ts +4 -8
- package/src/inmemory/index.ts +3 -0
- package/src/{adapter/inmemory → inmemory}/queryInMemory.ts +3 -3
- package/src/kv/commonKeyValueDB.ts +1 -1
- package/src/kv/commonKeyValueDao.ts +5 -3
- package/src/kv/commonKeyValueDaoMemoCache.ts +4 -2
- package/src/kv/index.ts +3 -0
- package/src/model.util.ts +2 -2
- package/src/pipeline/dbPipelineBackup.ts +13 -9
- package/src/pipeline/dbPipelineCopy.ts +7 -4
- package/src/pipeline/dbPipelineRestore.ts +15 -20
- package/src/pipeline/index.ts +3 -0
- package/src/query/dbQuery.ts +3 -2
- package/src/testing/commonDBTest.ts +6 -3
- package/src/testing/commonDaoTest.ts +4 -2
- package/src/testing/keyValueDBTest.ts +1 -1
- package/src/testing/test.model.ts +4 -2
- package/src/timeseries/commonTimeSeriesDao.ts +1 -1
- package/src/timeseries/timeSeries.model.ts +1 -1
- package/src/transaction/dbTransaction.util.ts +2 -2
- package/dist/adapter/inmemory/queryInMemory.d.ts +0 -3
- /package/dist/{common.db.js → commondb/common.db.js} +0 -0
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from '@naturalcycles/js-lib'
|
|
1
|
+
import { _hb } from '@naturalcycles/js-lib'
|
|
2
|
+
import { localTime } from '@naturalcycles/js-lib/datetime'
|
|
3
|
+
import { ErrorMode } from '@naturalcycles/js-lib/error'
|
|
4
|
+
import type { JsonSchemaObject } from '@naturalcycles/js-lib/json-schema'
|
|
5
|
+
import { _mapValues } from '@naturalcycles/js-lib/object'
|
|
6
|
+
import { pMap } from '@naturalcycles/js-lib/promise'
|
|
7
|
+
import type { AsyncMapper, BaseDBEntity, UnixTimestamp } from '@naturalcycles/js-lib/types'
|
|
8
|
+
import { _passthroughMapper } from '@naturalcycles/js-lib/types'
|
|
9
|
+
import { boldWhite, dimWhite, grey, yellow } from '@naturalcycles/nodejs-lib/colors'
|
|
10
|
+
import { fs2 } from '@naturalcycles/nodejs-lib/fs2'
|
|
7
11
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
ErrorMode,
|
|
12
|
-
localTime,
|
|
13
|
-
pMap,
|
|
14
|
-
} from '@naturalcycles/js-lib'
|
|
15
|
-
import { boldWhite, dimWhite, grey, yellow } from '@naturalcycles/nodejs-lib'
|
|
16
|
-
import { fs2 } from '@naturalcycles/nodejs-lib/fs'
|
|
17
|
-
import type {
|
|
18
|
-
TransformLogProgressOptions,
|
|
19
|
-
TransformMapOptions,
|
|
12
|
+
createReadStreamAsNDJSON,
|
|
13
|
+
type TransformLogProgressOptions,
|
|
14
|
+
type TransformMapOptions,
|
|
20
15
|
} from '@naturalcycles/nodejs-lib/stream'
|
|
21
16
|
import {
|
|
22
17
|
_pipeline,
|
|
@@ -28,7 +23,7 @@ import {
|
|
|
28
23
|
transformTap,
|
|
29
24
|
writableForEach,
|
|
30
25
|
} from '@naturalcycles/nodejs-lib/stream'
|
|
31
|
-
import type { CommonDB } from '../common.db.js'
|
|
26
|
+
import type { CommonDB } from '../commondb/common.db.js'
|
|
32
27
|
import type { CommonDBSaveOptions } from '../db.model.js'
|
|
33
28
|
|
|
34
29
|
export interface DBPipelineRestoreOptions extends TransformLogProgressOptions {
|
|
@@ -200,7 +195,7 @@ export async function dbPipelineRestore(opt: DBPipelineRestoreOptions): Promise<
|
|
|
200
195
|
console.log(`<< ${grey(filePath)} ${dimWhite(_hb(sizeBytes))} started...`)
|
|
201
196
|
|
|
202
197
|
await _pipeline([
|
|
203
|
-
|
|
198
|
+
createReadStreamAsNDJSON(filePath).take(limit || Number.POSITIVE_INFINITY),
|
|
204
199
|
transformTap(() => rows++),
|
|
205
200
|
transformLogProgress({
|
|
206
201
|
logEvery: 1000,
|
package/src/query/dbQuery.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { _truncate } from '@naturalcycles/js-lib/string'
|
|
2
|
+
import type { AsyncIndexedMapper, BaseDBEntity, ObjectWithId } from '@naturalcycles/js-lib/types'
|
|
3
|
+
import { _objectAssign } from '@naturalcycles/js-lib/types'
|
|
3
4
|
import type { ReadableTyped } from '@naturalcycles/nodejs-lib/stream'
|
|
4
5
|
import type { CommonDao } from '../commondao/common.dao.js'
|
|
5
6
|
import type {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { _sortBy } from '@naturalcycles/js-lib'
|
|
2
|
+
import { localTime } from '@naturalcycles/js-lib/datetime'
|
|
3
|
+
import { _deepFreeze, _filterObject, _pick } from '@naturalcycles/js-lib/object'
|
|
4
|
+
import { pMap } from '@naturalcycles/js-lib/promise'
|
|
5
|
+
import type { CommonDB } from '../commondb/common.db.js'
|
|
6
|
+
import { CommonDBType } from '../commondb/common.db.js'
|
|
4
7
|
import { DBQuery } from '../query/dbQuery.js'
|
|
5
8
|
import type { TestItemDBM } from './test.model.js'
|
|
6
9
|
import {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Readable } from 'node:stream'
|
|
2
|
-
import {
|
|
2
|
+
import { _sortBy } from '@naturalcycles/js-lib'
|
|
3
|
+
import { localTime } from '@naturalcycles/js-lib/datetime'
|
|
4
|
+
import { _deepCopy, _filterObject, _omit, _pick } from '@naturalcycles/js-lib/object'
|
|
3
5
|
import { _pipeline } from '@naturalcycles/nodejs-lib/stream'
|
|
4
|
-
import type { CommonDB } from '../common.db.js'
|
|
5
6
|
import { CommonDao } from '../commondao/common.dao.js'
|
|
6
7
|
import { CommonDaoLogLevel } from '../commondao/common.dao.model.js'
|
|
8
|
+
import type { CommonDB } from '../commondb/common.db.js'
|
|
7
9
|
import { DBQuery } from '../query/dbQuery.js'
|
|
8
10
|
import type { CommonDBImplementationQuirks } from './commonDBTest.js'
|
|
9
11
|
import type { TestItemBM } from './test.model.js'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { KeyValueTuple } from '@naturalcycles/js-lib'
|
|
2
1
|
import { _range, _sortBy } from '@naturalcycles/js-lib'
|
|
2
|
+
import type { KeyValueTuple } from '@naturalcycles/js-lib/types'
|
|
3
3
|
import type { CommonKeyValueDB } from '../kv/commonKeyValueDB.js'
|
|
4
4
|
import { TEST_TABLE } from './test.model.js'
|
|
5
5
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { _range } from '@naturalcycles/js-lib'
|
|
2
|
+
import type { JsonSchemaObject } from '@naturalcycles/js-lib/json-schema'
|
|
3
|
+
import { jsonSchema } from '@naturalcycles/js-lib/json-schema'
|
|
4
|
+
import type { BaseDBEntity, UnixTimestamp } from '@naturalcycles/js-lib/types'
|
|
3
5
|
import {
|
|
4
6
|
baseDBEntitySchema,
|
|
5
7
|
binarySchema,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ObjectWithId } from '@naturalcycles/js-lib'
|
|
2
|
-
import type { CommonDB } from '../common.db.js'
|
|
1
|
+
import type { ObjectWithId } from '@naturalcycles/js-lib/types'
|
|
2
|
+
import type { CommonDB } from '../commondb/common.db.js'
|
|
3
3
|
import type { CommonDBOptions, CommonDBSaveOptions, DBTransaction } from '../db.model.js'
|
|
4
4
|
|
|
5
5
|
/**
|
|
File without changes
|