@naturalcycles/db-lib 8.54.3 → 8.54.5

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.
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FileDB = void 0;
4
4
  const js_lib_1 = require("@naturalcycles/js-lib");
5
5
  const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
6
- const colors_1 = require("@naturalcycles/nodejs-lib/dist/colors");
6
+ const nodejs_lib_2 = require("@naturalcycles/nodejs-lib");
7
7
  const __1 = require("../..");
8
8
  /**
9
9
  * Provides barebone implementation for "whole file" based CommonDB.
@@ -195,7 +195,7 @@ class FileDB extends __1.BaseCommonDB {
195
195
  logFinished(started, op) {
196
196
  if (!this.cfg.logFinished)
197
197
  return;
198
- this.cfg.logger?.log(`<< ${op} ${(0, colors_1.dimGrey)(`in ${(0, js_lib_1._since)(started)}`)}`);
198
+ this.cfg.logger?.log(`<< ${op} ${(0, nodejs_lib_2.dimGrey)(`in ${(0, js_lib_1._since)(started)}`)}`);
199
199
  }
200
200
  }
201
201
  exports.FileDB = FileDB;
@@ -7,7 +7,7 @@ const node_stream_1 = require("node:stream");
7
7
  const node_zlib_1 = require("node:zlib");
8
8
  const js_lib_1 = require("@naturalcycles/js-lib");
9
9
  const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
10
- const colors_1 = require("@naturalcycles/nodejs-lib/dist/colors");
10
+ const nodejs_lib_2 = require("@naturalcycles/nodejs-lib");
11
11
  const __1 = require("../..");
12
12
  const dbQuery_1 = require("../../query/dbQuery");
13
13
  class InMemoryDB {
@@ -184,7 +184,7 @@ class InMemoryDB {
184
184
  fs.createWriteStream(fname),
185
185
  ]);
186
186
  });
187
- this.cfg.logger.log(`flushToDisk took ${(0, colors_1.dimGrey)((0, js_lib_1._since)(started))} to save ${(0, colors_1.yellow)(tables)} tables`);
187
+ this.cfg.logger.log(`flushToDisk took ${(0, nodejs_lib_2.dimGrey)((0, js_lib_1._since)(started))} to save ${(0, nodejs_lib_2.yellow)(tables)} tables`);
188
188
  }
189
189
  /**
190
190
  * Restores all tables (all namespaces) at once.
@@ -211,7 +211,7 @@ class InMemoryDB {
211
211
  ]);
212
212
  this.data[table] = (0, js_lib_1._by)(rows, r => r.id);
213
213
  });
214
- this.cfg.logger.log(`restoreFromDisk took ${(0, colors_1.dimGrey)((0, js_lib_1._since)(started))} to read ${(0, colors_1.yellow)(files.length)} tables`);
214
+ this.cfg.logger.log(`restoreFromDisk took ${(0, nodejs_lib_2.dimGrey)((0, js_lib_1._since)(started))} to read ${(0, nodejs_lib_2.yellow)(files.length)} tables`);
215
215
  }
216
216
  }
217
217
  exports.InMemoryDB = InMemoryDB;
@@ -216,7 +216,6 @@ class CommonDao {
216
216
  throwRequiredError(id, opt) {
217
217
  const table = opt.table || this.cfg.table;
218
218
  throw new js_lib_1.AppError(`DB row required, but not found in ${table}`, {
219
- code: cnst_1.DBLibError.DB_ROW_REQUIRED,
220
219
  table,
221
220
  id,
222
221
  });
@@ -227,7 +226,6 @@ class CommonDao {
227
226
  requireWriteAccess() {
228
227
  if (this.cfg.readOnly) {
229
228
  throw new js_lib_1.AppError(cnst_1.DBLibError.DAO_IS_READ_ONLY, {
230
- code: cnst_1.DBLibError.DAO_IS_READ_ONLY,
231
229
  table: this.cfg.table,
232
230
  });
233
231
  }
@@ -238,7 +236,6 @@ class CommonDao {
238
236
  requireObjectMutability(opt) {
239
237
  if (this.cfg.immutable && !opt.allowMutability) {
240
238
  throw new js_lib_1.AppError(cnst_1.DBLibError.OBJECT_IS_IMMUTABLE, {
241
- code: cnst_1.DBLibError.OBJECT_IS_IMMUTABLE,
242
239
  table: this.cfg.table,
243
240
  });
244
241
  }
@@ -249,7 +246,6 @@ class CommonDao {
249
246
  if (existing.length) {
250
247
  throw new js_lib_1.AppError(cnst_1.DBLibError.NON_UNIQUE_ID, {
251
248
  table,
252
- code: cnst_1.DBLibError.NON_UNIQUE_ID,
253
249
  ids: existing.map(i => i.id),
254
250
  });
255
251
  }
package/dist/index.d.ts CHANGED
@@ -2,7 +2,6 @@ export * from './adapter/inmemory/inMemory.db';
2
2
  export * from './adapter/inmemory/inMemoryKeyValueDB';
3
3
  export * from './adapter/inmemory/queryInMemory';
4
4
  export * from './base.common.db';
5
- export * from './cnst';
6
5
  export * from './common.db';
7
6
  export * from './commondao/common.dao';
8
7
  export * from './commondao/common.dao.model';
package/dist/index.js CHANGED
@@ -5,7 +5,6 @@ tslib_1.__exportStar(require("./adapter/inmemory/inMemory.db"), exports);
5
5
  tslib_1.__exportStar(require("./adapter/inmemory/inMemoryKeyValueDB"), exports);
6
6
  tslib_1.__exportStar(require("./adapter/inmemory/queryInMemory"), exports);
7
7
  tslib_1.__exportStar(require("./base.common.db"), exports);
8
- tslib_1.__exportStar(require("./cnst"), exports);
9
8
  tslib_1.__exportStar(require("./common.db"), exports);
10
9
  tslib_1.__exportStar(require("./commondao/common.dao"), exports);
11
10
  tslib_1.__exportStar(require("./commondao/common.dao.model"), exports);
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CommonKeyValueDao = void 0;
4
4
  const js_lib_1 = require("@naturalcycles/js-lib");
5
5
  const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
6
- const cnst_1 = require("../cnst");
7
6
  // todo: logging
8
7
  // todo: readonly
9
8
  class CommonKeyValueDao {
@@ -45,7 +44,6 @@ class CommonKeyValueDao {
45
44
  if (!r) {
46
45
  const { table } = this.cfg;
47
46
  throw new js_lib_1.AppError(`DB row required, but not found in ${table}`, {
48
- code: cnst_1.DBLibError.DB_ROW_REQUIRED,
49
47
  table,
50
48
  id,
51
49
  });
@@ -57,7 +55,6 @@ class CommonKeyValueDao {
57
55
  if (!r) {
58
56
  const { table } = this.cfg;
59
57
  throw new js_lib_1.AppError(`DB row required, but not found in ${table}`, {
60
- code: cnst_1.DBLibError.DB_ROW_REQUIRED,
61
58
  table,
62
59
  id,
63
60
  });
@@ -6,7 +6,7 @@ const fsp = require("node:fs/promises");
6
6
  const node_zlib_1 = require("node:zlib");
7
7
  const js_lib_1 = require("@naturalcycles/js-lib");
8
8
  const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
9
- const colors_1 = require("@naturalcycles/nodejs-lib/dist/colors");
9
+ const nodejs_lib_2 = require("@naturalcycles/nodejs-lib");
10
10
  const index_1 = require("../index");
11
11
  /**
12
12
  * Pipeline from input stream(s) to a NDJSON file (optionally gzipped).
@@ -22,11 +22,11 @@ async function dbPipelineBackup(opt) {
22
22
  const strict = errorMode !== js_lib_1.ErrorMode.SUPPRESS;
23
23
  const gzip = opt.gzip !== false; // default to true
24
24
  let { tables } = opt;
25
- const sinceUpdatedStr = sinceUpdated ? ' since ' + (0, colors_1.grey)((0, js_lib_1.localTime)(sinceUpdated).toPretty()) : '';
26
- console.log(`>> ${(0, colors_1.dimWhite)('dbPipelineBackup')} started in ${(0, colors_1.grey)(outputDirPath)}...${sinceUpdatedStr}`);
25
+ const sinceUpdatedStr = sinceUpdated ? ' since ' + (0, nodejs_lib_2.grey)((0, js_lib_1.localTime)(sinceUpdated).toPretty()) : '';
26
+ console.log(`>> ${(0, nodejs_lib_2.dimWhite)('dbPipelineBackup')} started in ${(0, nodejs_lib_2.grey)(outputDirPath)}...${sinceUpdatedStr}`);
27
27
  (0, nodejs_lib_1._ensureDirSync)(outputDirPath);
28
28
  tables ||= await db.getTables();
29
- console.log(`${(0, colors_1.yellow)(tables.length)} ${(0, colors_1.boldWhite)('table(s)')}:\n` + tables.join('\n'));
29
+ console.log(`${(0, nodejs_lib_2.yellow)(tables.length)} ${(0, nodejs_lib_2.boldWhite)('table(s)')}:\n` + tables.join('\n'));
30
30
  const statsPerTable = {};
31
31
  await (0, js_lib_1.pMap)(tables, async (table) => {
32
32
  let q = index_1.DBQuery.create(table).limit(limit);
@@ -41,11 +41,11 @@ async function dbPipelineBackup(opt) {
41
41
  const started = Date.now();
42
42
  let rows = 0;
43
43
  (0, nodejs_lib_1._ensureFileSync)(filePath);
44
- console.log(`>> ${(0, colors_1.grey)(filePath)} started...`);
44
+ console.log(`>> ${(0, nodejs_lib_2.grey)(filePath)} started...`);
45
45
  if (emitSchemaFromDB) {
46
46
  const schema = await db.getTableSchema(table);
47
- await (0, nodejs_lib_1._writeJsonFile)(schemaFilePath, schema, { spaces: 2 });
48
- console.log(`>> ${(0, colors_1.grey)(schemaFilePath)} saved (generated from DB)`);
47
+ await (0, nodejs_lib_1._writeJson)(schemaFilePath, schema, { spaces: 2 });
48
+ console.log(`>> ${(0, nodejs_lib_2.grey)(schemaFilePath)} saved (generated from DB)`);
49
49
  }
50
50
  await (0, nodejs_lib_1._pipeline)([
51
51
  db.streamQuery(q),
@@ -73,7 +73,7 @@ async function dbPipelineBackup(opt) {
73
73
  rows,
74
74
  sizeBytes,
75
75
  });
76
- console.log(`>> ${(0, colors_1.grey)(filePath)}\n` + stats.toPretty());
76
+ console.log(`>> ${(0, nodejs_lib_2.grey)(filePath)}\n` + stats.toPretty());
77
77
  statsPerTable[table] = stats;
78
78
  }, { concurrency, errorMode });
79
79
  const statsTotal = nodejs_lib_1.NDJsonStats.createCombined(Object.values(statsPerTable));
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.dbPipelineCopy = void 0;
4
4
  const js_lib_1 = require("@naturalcycles/js-lib");
5
5
  const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
6
- const colors_1 = require("@naturalcycles/nodejs-lib/dist/colors");
6
+ const nodejs_lib_2 = require("@naturalcycles/nodejs-lib");
7
7
  const dbQuery_1 = require("../query/dbQuery");
8
8
  /**
9
9
  * Pipeline from input stream(s) to CommonDB .saveBatch().
@@ -14,10 +14,10 @@ const dbQuery_1 = require("../query/dbQuery");
14
14
  async function dbPipelineCopy(opt) {
15
15
  const { batchSize = 100, dbInput, dbOutput, concurrency = 16, limit = 0, sinceUpdated, mapperPerTable = {}, saveOptionsPerTable = {}, transformMapOptions, errorMode = js_lib_1.ErrorMode.SUPPRESS, } = opt;
16
16
  let { tables } = opt;
17
- const sinceUpdatedStr = sinceUpdated ? ' since ' + (0, colors_1.grey)((0, js_lib_1.localTime)(sinceUpdated).toPretty()) : '';
18
- console.log(`>> ${(0, colors_1.dimWhite)('dbPipelineCopy')} started...${sinceUpdatedStr}`);
17
+ const sinceUpdatedStr = sinceUpdated ? ' since ' + (0, nodejs_lib_2.grey)((0, js_lib_1.localTime)(sinceUpdated).toPretty()) : '';
18
+ console.log(`>> ${(0, nodejs_lib_2.dimWhite)('dbPipelineCopy')} started...${sinceUpdatedStr}`);
19
19
  tables ||= await dbInput.getTables();
20
- console.log(`${(0, colors_1.yellow)(tables.length)} ${(0, colors_1.boldWhite)('table(s)')}:\n` + tables.join('\n'));
20
+ console.log(`${(0, nodejs_lib_2.yellow)(tables.length)} ${(0, nodejs_lib_2.boldWhite)('table(s)')}:\n` + tables.join('\n'));
21
21
  const statsPerTable = {};
22
22
  await (0, js_lib_1.pMap)(tables, async (table) => {
23
23
  let q = dbQuery_1.DBQuery.create(table).limit(limit);
@@ -53,7 +53,7 @@ async function dbPipelineCopy(opt) {
53
53
  rows,
54
54
  sizeBytes: 0, // n/a
55
55
  });
56
- console.log(`>> ${(0, colors_1.grey)(table)}\n` + stats.toPretty());
56
+ console.log(`>> ${(0, nodejs_lib_2.grey)(table)}\n` + stats.toPretty());
57
57
  statsPerTable[table] = stats;
58
58
  }, { concurrency, errorMode });
59
59
  const statsTotal = nodejs_lib_1.NDJsonStats.createCombined(Object.values(statsPerTable));
@@ -5,7 +5,7 @@ const fs = require("node:fs");
5
5
  const node_zlib_1 = require("node:zlib");
6
6
  const js_lib_1 = require("@naturalcycles/js-lib");
7
7
  const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
8
- const colors_1 = require("@naturalcycles/nodejs-lib/dist/colors");
8
+ const nodejs_lib_2 = require("@naturalcycles/nodejs-lib");
9
9
  /**
10
10
  * Pipeline from NDJSON files in a folder (optionally gzipped) to CommonDB.
11
11
  * Allows to define a mapper and a predicate to map/filter objects between input and output.
@@ -17,8 +17,8 @@ async function dbPipelineRestore(opt) {
17
17
  const { db, concurrency = 16, batchSize = 100, limit, sinceUpdated, inputDirPath, mapperPerTable = {}, saveOptionsPerTable = {}, transformMapOptions, errorMode = js_lib_1.ErrorMode.SUPPRESS, recreateTables = false, } = opt;
18
18
  const strict = errorMode !== js_lib_1.ErrorMode.SUPPRESS;
19
19
  const onlyTables = opt.tables && new Set(opt.tables);
20
- const sinceUpdatedStr = sinceUpdated ? ' since ' + (0, colors_1.grey)((0, js_lib_1.localTime)(sinceUpdated).toPretty()) : '';
21
- console.log(`>> ${(0, colors_1.dimWhite)('dbPipelineRestore')} started in ${(0, colors_1.grey)(inputDirPath)}...${sinceUpdatedStr}`);
20
+ const sinceUpdatedStr = sinceUpdated ? ' since ' + (0, nodejs_lib_2.grey)((0, js_lib_1.localTime)(sinceUpdated).toPretty()) : '';
21
+ console.log(`>> ${(0, nodejs_lib_2.dimWhite)('dbPipelineRestore')} started in ${(0, nodejs_lib_2.grey)(inputDirPath)}...${sinceUpdatedStr}`);
22
22
  (0, nodejs_lib_1._ensureDirSync)(inputDirPath);
23
23
  const tablesToGzip = new Set();
24
24
  const sizeByTable = {};
@@ -45,7 +45,7 @@ async function dbPipelineRestore(opt) {
45
45
  sizeByTable[table] = fs.statSync(`${inputDirPath}/${f}`).size;
46
46
  });
47
47
  const sizeStrByTable = (0, js_lib_1._mapValues)(sizeByTable, (_k, b) => (0, js_lib_1._hb)(b));
48
- console.log(`${(0, colors_1.yellow)(tables.length)} ${(0, colors_1.boldWhite)('table(s)')}:\n`, sizeStrByTable);
48
+ console.log(`${(0, nodejs_lib_2.yellow)(tables.length)} ${(0, nodejs_lib_2.boldWhite)('table(s)')}:\n`, sizeStrByTable);
49
49
  // const schemaByTable: Record<string, CommonSchema> = {}
50
50
  if (recreateTables) {
51
51
  await (0, js_lib_1.pMap)(tables, async (table) => {
@@ -54,7 +54,7 @@ async function dbPipelineRestore(opt) {
54
54
  console.warn(`${schemaFilePath} does not exist!`);
55
55
  return;
56
56
  }
57
- const schema = await (0, nodejs_lib_1._readJsonFile)(schemaFilePath);
57
+ const schema = await (0, nodejs_lib_1._readJson)(schemaFilePath);
58
58
  await db.createTable(table, schema, { dropIfExists: true });
59
59
  });
60
60
  }
@@ -65,7 +65,7 @@ async function dbPipelineRestore(opt) {
65
65
  const started = Date.now();
66
66
  let rows = 0;
67
67
  const sizeBytes = sizeByTable[table];
68
- console.log(`<< ${(0, colors_1.grey)(filePath)} ${(0, colors_1.dimWhite)((0, js_lib_1._hb)(sizeBytes))} started...`);
68
+ console.log(`<< ${(0, nodejs_lib_2.grey)(filePath)} ${(0, nodejs_lib_2.dimWhite)((0, js_lib_1._hb)(sizeBytes))} started...`);
69
69
  await (0, nodejs_lib_1._pipeline)([
70
70
  fs.createReadStream(filePath),
71
71
  ...(gzip ? [(0, node_zlib_1.createUnzip)()] : []),
@@ -97,7 +97,7 @@ async function dbPipelineRestore(opt) {
97
97
  rows,
98
98
  sizeBytes,
99
99
  });
100
- console.log(`<< ${(0, colors_1.grey)(filePath)}\n` + stats.toPretty());
100
+ console.log(`<< ${(0, nodejs_lib_2.grey)(filePath)}\n` + stats.toPretty());
101
101
  statsPerTable[table] = stats;
102
102
  }, { concurrency, errorMode });
103
103
  const statsTotal = nodejs_lib_1.NDJsonStats.createCombined(Object.values(statsPerTable));
package/package.json CHANGED
@@ -40,7 +40,7 @@
40
40
  "engines": {
41
41
  "node": ">=18.12"
42
42
  },
43
- "version": "8.54.3",
43
+ "version": "8.54.5",
44
44
  "description": "Lowest Common Denominator API to supported Databases",
45
45
  "keywords": [
46
46
  "db",
@@ -18,7 +18,7 @@ import {
18
18
  Saved,
19
19
  } from '@naturalcycles/js-lib'
20
20
  import { readableCreate, ReadableTyped } from '@naturalcycles/nodejs-lib'
21
- import { dimGrey } from '@naturalcycles/nodejs-lib/dist/colors'
21
+ import { dimGrey } from '@naturalcycles/nodejs-lib'
22
22
  import { BaseCommonDB, DBSaveBatchOperation, queryInMemory } from '../..'
23
23
  import { CommonDB } from '../../common.db'
24
24
  import {
@@ -28,7 +28,7 @@ import {
28
28
  _emptyDir,
29
29
  _ensureDir,
30
30
  } from '@naturalcycles/nodejs-lib'
31
- import { dimGrey, yellow } from '@naturalcycles/nodejs-lib/dist/colors'
31
+ import { dimGrey, yellow } from '@naturalcycles/nodejs-lib'
32
32
  import { CommonDB, DBIncrement, DBPatch, DBTransaction, queryInMemory } from '../..'
33
33
  import {
34
34
  CommonDBCreateOptions,
@@ -250,7 +250,6 @@ export class CommonDao<
250
250
  private throwRequiredError(id: ID, opt: CommonDaoOptions): never {
251
251
  const table = opt.table || this.cfg.table
252
252
  throw new AppError(`DB row required, but not found in ${table}`, {
253
- code: DBLibError.DB_ROW_REQUIRED,
254
253
  table,
255
254
  id,
256
255
  })
@@ -262,7 +261,6 @@ export class CommonDao<
262
261
  private requireWriteAccess(): void {
263
262
  if (this.cfg.readOnly) {
264
263
  throw new AppError(DBLibError.DAO_IS_READ_ONLY, {
265
- code: DBLibError.DAO_IS_READ_ONLY,
266
264
  table: this.cfg.table,
267
265
  })
268
266
  }
@@ -274,7 +272,6 @@ export class CommonDao<
274
272
  private requireObjectMutability(opt: CommonDaoOptions): void {
275
273
  if (this.cfg.immutable && !opt.allowMutability) {
276
274
  throw new AppError(DBLibError.OBJECT_IS_IMMUTABLE, {
277
- code: DBLibError.OBJECT_IS_IMMUTABLE,
278
275
  table: this.cfg.table,
279
276
  })
280
277
  }
@@ -286,7 +283,6 @@ export class CommonDao<
286
283
  if (existing.length) {
287
284
  throw new AppError(DBLibError.NON_UNIQUE_ID, {
288
285
  table,
289
- code: DBLibError.NON_UNIQUE_ID,
290
286
  ids: existing.map(i => i.id),
291
287
  })
292
288
  }
package/src/index.ts CHANGED
@@ -2,7 +2,6 @@ export * from './adapter/inmemory/inMemory.db'
2
2
  export * from './adapter/inmemory/inMemoryKeyValueDB'
3
3
  export * from './adapter/inmemory/queryInMemory'
4
4
  export * from './base.common.db'
5
- export * from './cnst'
6
5
  export * from './common.db'
7
6
  export * from './commondao/common.dao'
8
7
  export * from './commondao/common.dao.model'
@@ -5,7 +5,6 @@ import {
5
5
  ReadableTyped,
6
6
  transformMap,
7
7
  } from '@naturalcycles/nodejs-lib'
8
- import { DBLibError } from '../cnst'
9
8
  import { CommonDaoLogLevel } from '../commondao/common.dao.model'
10
9
  import { CommonDBCreateOptions } from '../db.model'
11
10
  import { CommonKeyValueDB, KeyValueDBTuple } from './commonKeyValueDB'
@@ -91,7 +90,6 @@ export class CommonKeyValueDao<T> {
91
90
  if (!r) {
92
91
  const { table } = this.cfg
93
92
  throw new AppError(`DB row required, but not found in ${table}`, {
94
- code: DBLibError.DB_ROW_REQUIRED,
95
93
  table,
96
94
  id,
97
95
  })
@@ -106,7 +104,6 @@ export class CommonKeyValueDao<T> {
106
104
  if (!r) {
107
105
  const { table } = this.cfg
108
106
  throw new AppError(`DB row required, but not found in ${table}`, {
109
- code: DBLibError.DB_ROW_REQUIRED,
110
107
  table,
111
108
  id,
112
109
  })
@@ -21,9 +21,9 @@ import {
21
21
  _ensureDirSync,
22
22
  _pathExistsSync,
23
23
  _ensureFileSync,
24
- _writeJsonFile,
24
+ _writeJson,
25
25
  } from '@naturalcycles/nodejs-lib'
26
- import { boldWhite, dimWhite, grey, yellow } from '@naturalcycles/nodejs-lib/dist/colors'
26
+ import { boldWhite, dimWhite, grey, yellow } from '@naturalcycles/nodejs-lib'
27
27
  import { CommonDB } from '../common.db'
28
28
  import { DBQuery } from '../index'
29
29
 
@@ -194,7 +194,7 @@ export async function dbPipelineBackup(opt: DBPipelineBackupOptions): Promise<ND
194
194
 
195
195
  if (emitSchemaFromDB) {
196
196
  const schema = await db.getTableSchema(table)
197
- await _writeJsonFile(schemaFilePath, schema, { spaces: 2 })
197
+ await _writeJson(schemaFilePath, schema, { spaces: 2 })
198
198
  console.log(`>> ${grey(schemaFilePath)} saved (generated from DB)`)
199
199
  }
200
200
 
@@ -10,7 +10,7 @@ import {
10
10
  writableForEach,
11
11
  _pipeline,
12
12
  } from '@naturalcycles/nodejs-lib'
13
- import { boldWhite, dimWhite, grey, yellow } from '@naturalcycles/nodejs-lib/dist/colors'
13
+ import { boldWhite, dimWhite, grey, yellow } from '@naturalcycles/nodejs-lib'
14
14
  import { CommonDB } from '../common.db'
15
15
  import { CommonDBSaveOptions } from '../db.model'
16
16
  import { DBQuery } from '../query/dbQuery'
@@ -26,9 +26,9 @@ import {
26
26
  writableForEach,
27
27
  _pipeline,
28
28
  _ensureDirSync,
29
- _readJsonFile,
29
+ _readJson,
30
30
  } from '@naturalcycles/nodejs-lib'
31
- import { boldWhite, dimWhite, grey, yellow } from '@naturalcycles/nodejs-lib/dist/colors'
31
+ import { boldWhite, dimWhite, grey, yellow } from '@naturalcycles/nodejs-lib'
32
32
  import { CommonDB } from '../common.db'
33
33
  import { CommonDBSaveOptions } from '../index'
34
34
 
@@ -182,7 +182,7 @@ export async function dbPipelineRestore(opt: DBPipelineRestoreOptions): Promise<
182
182
  return
183
183
  }
184
184
 
185
- const schema = await _readJsonFile<JsonSchemaObject<any>>(schemaFilePath)
185
+ const schema = await _readJson<JsonSchemaObject<any>>(schemaFilePath)
186
186
  await db.createTable(table, schema, { dropIfExists: true })
187
187
  })
188
188
  }