@matrixai/db
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -35,5 +35,5 @@ /// <reference types="node" /> | ||
}; | ||
lock?: MutexInterface; | ||
fs?: FileSystem; | ||
logger?: Logger; | ||
lock: MutexInterface; | ||
fs: FileSystem; | ||
logger: Logger; | ||
}); | ||
@@ -40,0 +40,0 @@ get db(): LevelDB<string, Buffer>; |
@@ -34,6 +34,6 @@ "use strict"; | ||
class DB { | ||
constructor({ dbPath, crypto, lock = new async_mutex_1.Mutex(), fs = require('fs'), logger, }) { | ||
constructor({ dbPath, crypto, lock, fs, logger, }) { | ||
this._running = false; | ||
this._destroyed = false; | ||
this.logger = logger ?? new logger_1.default(this.constructor.name); | ||
this.logger = logger; | ||
this.dbPath = dbPath; | ||
@@ -44,3 +44,3 @@ this.crypto = crypto; | ||
} | ||
static async createDB({ dbPath, crypto, lock, fs, logger, }) { | ||
static async createDB({ dbPath, crypto, lock = new async_mutex_1.Mutex(), fs = require('fs'), logger = new logger_1.default(this.name), }) { | ||
const db = new DB({ | ||
@@ -123,4 +123,6 @@ dbPath, | ||
} | ||
this.logger.info('Destroying DB'); | ||
await this.fs.promises.rm(this.dbPath, { recursive: true }); | ||
this._destroyed = true; | ||
this.logger.info('Destroyed DB'); | ||
}); | ||
@@ -127,0 +129,0 @@ } |
{ | ||
"name": "@matrixai/db", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"author": "Roger Qiu", | ||
@@ -24,3 +24,3 @@ "description": "DB", | ||
"@matrixai/logger": "^2.0.1", | ||
"@matrixai/workers": "^1.2.2", | ||
"@matrixai/workers": "^1.2.3", | ||
"abstract-leveldown": "^7.0.0", | ||
@@ -27,0 +27,0 @@ "async-mutex": "^0.3.1", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57853
818
Updated@matrixai/workers@^1.2.3