@naturalcycles/db-lib 10.25.0 → 10.26.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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { pMap } from '@naturalcycles/js-lib/promise/pMap.js';
|
|
2
2
|
import { fs2 } from '@naturalcycles/nodejs-lib/fs2';
|
|
3
|
-
import {
|
|
3
|
+
import { Pipeline } from '@naturalcycles/nodejs-lib/stream';
|
|
4
4
|
/**
|
|
5
5
|
* Persists in local filesystem as ndjson.
|
|
6
6
|
*/
|
|
@@ -25,7 +25,7 @@ export class LocalFilePersistencePlugin {
|
|
|
25
25
|
const filePath = `${this.cfg.storagePath}/${table}.${ext}`;
|
|
26
26
|
if (!(await fs2.pathExistsAsync(filePath)))
|
|
27
27
|
return [];
|
|
28
|
-
return await
|
|
28
|
+
return await Pipeline.fromNDJsonFile(filePath).toArray();
|
|
29
29
|
}
|
|
30
30
|
async saveFiles(ops) {
|
|
31
31
|
await pMap(ops, async (op) => await this.saveFile(op.table, op.rows), { concurrency: 32 });
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/db-lib",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "10.
|
|
4
|
+
"version": "10.26.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@naturalcycles/js-lib": "^15",
|
|
7
7
|
"@naturalcycles/nodejs-lib": "^15"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"@naturalcycles/dev-lib": "
|
|
10
|
+
"@naturalcycles/dev-lib": "18.4.2"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"dist",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { pMap } from '@naturalcycles/js-lib/promise/pMap.js'
|
|
2
2
|
import type { ObjectWithId } from '@naturalcycles/js-lib/types'
|
|
3
3
|
import { fs2 } from '@naturalcycles/nodejs-lib/fs2'
|
|
4
|
-
import {
|
|
4
|
+
import { Pipeline } from '@naturalcycles/nodejs-lib/stream'
|
|
5
5
|
import type { DBSaveBatchOperation } from '../../db.model.js'
|
|
6
6
|
import type { FileDBPersistencePlugin } from './file.db.model.js'
|
|
7
7
|
|
|
@@ -46,7 +46,7 @@ export class LocalFilePersistencePlugin implements FileDBPersistencePlugin {
|
|
|
46
46
|
|
|
47
47
|
if (!(await fs2.pathExistsAsync(filePath))) return []
|
|
48
48
|
|
|
49
|
-
return await
|
|
49
|
+
return await Pipeline.fromNDJsonFile<ROW>(filePath).toArray()
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
async saveFiles(ops: DBSaveBatchOperation<any>[]): Promise<void> {
|