aeproject-logger
Advanced tools
Comparing version 1.0.1 to 2.0.0
const history = require('./logger-service/log-store-service'); | ||
const { LogNodeService } = require('./logger-service/log-node-service'); | ||
module.exports = history | ||
module.exports = { | ||
history, | ||
LogNodeService | ||
} |
@@ -69,31 +69,6 @@ const LogJSONStore = require('../logger-store/log-json-store'); | ||
} | ||
let { | ||
deployerType, | ||
nameOrLabel, | ||
transactionHash, | ||
status, | ||
gasPrice, | ||
gasUsed, | ||
result, | ||
networkId, | ||
error, | ||
initState, | ||
options, | ||
publicKey | ||
} = actionInfo; | ||
const record = { | ||
eventTimestamp: Date.now(), | ||
deployerType, | ||
nameOrLabel, | ||
transactionHash, | ||
status, | ||
gasPrice, | ||
gasUsed, | ||
result, | ||
networkId, | ||
error, | ||
initState, | ||
options, | ||
publicKey | ||
...actionInfo | ||
} | ||
@@ -100,0 +75,0 @@ |
@@ -8,3 +8,3 @@ const fs = require('fs-extra') | ||
/** | ||
/** | ||
* Instantiates a new JSON storage very similar to local storage in the browser | ||
@@ -14,11 +14,13 @@ * | ||
*/ | ||
constructor(path) { | ||
this.path = `${process.cwd()}/${path}`; | ||
if (!fs.existsSync(path)) { | ||
fs.outputJsonSync(path, { data: {} }); | ||
} | ||
this.store = require(this.path); | ||
} | ||
constructor (path) { | ||
this.path = `${ process.cwd() }/${ path }`; | ||
if (!fs.existsSync(path)) { | ||
fs.outputJsonSync(path, { | ||
data: {} | ||
}); | ||
} | ||
this.store = require(this.path); | ||
} | ||
/** | ||
/** | ||
* | ||
@@ -29,10 +31,10 @@ * get stored item by its key | ||
*/ | ||
get(key) { | ||
if (!key) { | ||
return this._clone(this.store.data); | ||
} | ||
return this._clone(this.store.data[key]); | ||
} | ||
get (key) { | ||
if (!key) { | ||
return this._clone(this.store.data); | ||
} | ||
return this._clone(this.store.data[key]); | ||
} | ||
/** | ||
/** | ||
* | ||
@@ -44,8 +46,8 @@ * set item in the storage | ||
*/ | ||
set(key, value) { | ||
this.store.data[key] = this._clone(value); | ||
this._save(); | ||
} | ||
set (key, value) { | ||
this.store.data[key] = this._clone(value); | ||
this._save(); | ||
} | ||
/** | ||
/** | ||
* | ||
@@ -56,26 +58,26 @@ * remove item from the storage | ||
*/ | ||
remove(key) { | ||
delete this.store.data[key]; | ||
this._save(); | ||
} | ||
remove (key) { | ||
delete this.store.data[key]; | ||
this._save(); | ||
} | ||
/** | ||
/** | ||
* writes the data in the storage file | ||
*/ | ||
_save() { | ||
fs.outputJsonSync(this.path, this.store); | ||
} | ||
_save () { | ||
fs.outputJsonSync(this.path, this.store); | ||
} | ||
/** | ||
/** | ||
* Returns an array with all the stored properties in the JSON store | ||
*/ | ||
list() { | ||
const keys = []; | ||
for (const key in this.store.data) { | ||
keys.push(this.store.data[key]); | ||
} | ||
return keys; | ||
} | ||
list () { | ||
const keys = []; | ||
for (const key in this.store.data) { | ||
keys.push(this.store.data[key]); | ||
} | ||
return keys; | ||
} | ||
/** | ||
/** | ||
* | ||
@@ -86,8 +88,8 @@ * Clone a data in order to use it | ||
*/ | ||
_clone(data) { | ||
if (!data) { | ||
return undefined; | ||
} | ||
return JSON.parse(JSON.stringify(data)); | ||
} | ||
_clone (data) { | ||
if (!data) { | ||
return undefined; | ||
} | ||
return JSON.parse(JSON.stringify(data)); | ||
} | ||
@@ -97,3 +99,3 @@ } | ||
module.exports = function (path) { | ||
return new LogJSONStore(path); | ||
return new LogJSONStore(path); | ||
} |
{ | ||
"name": "aeproject-logger", | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"description": "", | ||
@@ -13,4 +13,5 @@ "main": "index.js", | ||
"dependencies": { | ||
"chai-as-promised": "^7.1.1", | ||
"fs-extra": "^7.0.1" | ||
} | ||
} |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
7602
6
267
2
5
+ Addedchai-as-promised@^7.1.1
+ Addedassertion-error@2.0.1(transitive)
+ Addedchai@5.1.1(transitive)
+ Addedchai-as-promised@7.1.2(transitive)
+ Addedcheck-error@1.0.32.1.1(transitive)
+ Addeddeep-eql@5.0.1(transitive)
+ Addedget-func-name@2.0.2(transitive)
+ Addedloupe@3.1.1(transitive)
+ Addedpathval@2.0.0(transitive)