molly-db 1.3.3 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
package/module/init_handler.js
CHANGED
package/module/memory_handler.js
CHANGED
@@ -23,7 +23,7 @@ module.exports = function( data,inst,db ){
|
|
23
23
|
const cfg = copy(data,input[i]); try {
|
24
24
|
const bool = await utils.validator(db,cfg);
|
25
25
|
if( !bool[0] ) return reject(bool[1]);
|
26
|
-
else result.push(utils[cfg.type](cfg,db));
|
26
|
+
else result.push(await utils[cfg.type](cfg,db));
|
27
27
|
} catch(e) {
|
28
28
|
return reject({ status:404, message:`error: ${e.message}` })
|
29
29
|
}
|
package/module/utils.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
/*--────────────────────────────────────────────────────────────────────────────────────────────--*/
|
2
2
|
|
3
3
|
const crypto = require('./crypto_handler');
|
4
|
+
const init = require('./init_handler');
|
4
5
|
const path = require('path');
|
5
6
|
const output = new Object();
|
6
7
|
const fs = require('fs');
|
@@ -335,4 +336,22 @@ output.saveAll = async function(data,db){
|
|
335
336
|
|
336
337
|
/*--────────────────────────────────────────────────────────────────────────────────────────────--*/
|
337
338
|
|
339
|
+
output.reset = async function(data,db){
|
340
|
+
const args = JSON.parse(process.env.MOLLY_DB_ARGS);
|
341
|
+
return new Promise((response,reject)=>{
|
342
|
+
init( args ).then((ndb)=>{ db = ndb;
|
343
|
+
|
344
|
+
return response({
|
345
|
+
status: 200,
|
346
|
+
database: data.db,
|
347
|
+
table: data.table,
|
348
|
+
message: 'DB Reseted'
|
349
|
+
});
|
350
|
+
|
351
|
+
}).catch((e)=>{ response(parseError(db,data,e)) });
|
352
|
+
})
|
353
|
+
}
|
354
|
+
|
355
|
+
/*--────────────────────────────────────────────────────────────────────────────────────────────--*/
|
356
|
+
|
338
357
|
module.exports = output;
|
package/module/worker_handler.js
CHANGED
@@ -26,6 +26,7 @@ function saveTimeout(data,db){
|
|
26
26
|
/*--────────────────────────────────────────────────────────────────────────────────────────────--*/
|
27
27
|
|
28
28
|
module.exports = (args)=>{
|
29
|
+
process.env.MOLLY_DB_ARGS = JSON.stringify(args);
|
29
30
|
init( args ).then((db)=>{ saveTimeout( args, db );
|
30
31
|
const dir = path.join(__dirname,'server_worker.js');
|
31
32
|
const srv = new worker.Worker(dir,{ workerData: args });
|
package/package.json
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
"license": "MIT",
|
10
10
|
"main": "main.js",
|
11
11
|
"name": "molly-db",
|
12
|
-
"version": "1.3.
|
12
|
+
"version": "1.3.4",
|
13
13
|
"author": "bececrazy",
|
14
14
|
"description": "Molly-db is a free and open source library for nodejs that allow you create a lightweight encrypted database using Json files",
|
15
15
|
"keywords": [
|