Socket
Socket
Sign inDemoInstall

aeproject-logger

Package Overview
Dependencies
12
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 2.0.0

logger-service/log-node-service.js

6

index.js
const history = require('./logger-service/log-store-service');
const { LogNodeService } = require('./logger-service/log-node-service');
module.exports = history
module.exports = {
history,
LogNodeService
}

27

logger-service/log-store-service.js

@@ -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"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc