Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
4fe85134c4 | |||
c307b7c7b0 |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/npmextra",
|
"name": "@pushrocks/npmextra",
|
||||||
"version": "3.0.3",
|
"version": "3.0.4",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/npmextra",
|
"name": "@pushrocks/npmextra",
|
||||||
"version": "3.0.3",
|
"version": "3.0.4",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "do more with npm",
|
"description": "do more with npm",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
@ -9,14 +9,14 @@ export type TKeyValueStore = 'path' | 'gitProject' | 'custom';
|
|||||||
* kvStore is a simple key vlaue store to store data about projects between runs
|
* kvStore is a simple key vlaue store to store data about projects between runs
|
||||||
*/
|
*/
|
||||||
export class KeyValueStore {
|
export class KeyValueStore {
|
||||||
dataObject: any;
|
public dataObject: any;
|
||||||
deletedObject: any = {};
|
public deletedObject: any = {};
|
||||||
initialReadTask = new TaskOnce({
|
public initialReadTask = new TaskOnce({
|
||||||
taskFunction: async () => {
|
taskFunction: async () => {
|
||||||
this.dataObject = plugins.smartfile.fs.toObjectSync(this.filePath);
|
this.dataObject = plugins.smartfile.fs.toObjectSync(this.filePath);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
syncTask = new Task({
|
public syncTask = new Task({
|
||||||
buffered: true,
|
buffered: true,
|
||||||
bufferMax: 2,
|
bufferMax: 2,
|
||||||
execDelay: 500,
|
execDelay: 500,
|
||||||
@ -33,9 +33,9 @@ export class KeyValueStore {
|
|||||||
},
|
},
|
||||||
name: 'syncTask'
|
name: 'syncTask'
|
||||||
});
|
});
|
||||||
type: TKeyValueStore; // the type of the kvStore
|
public type: TKeyValueStore; // the type of the kvStore
|
||||||
identity: string; // the identity of the kvStore
|
public identity: string; // the identity of the kvStore
|
||||||
filePath: string; // the filePath of the kvStore
|
public filePath: string; // the filePath of the kvStore
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the constructor of keyvalue store
|
* the constructor of keyvalue store
|
||||||
@ -52,7 +52,7 @@ export class KeyValueStore {
|
|||||||
/**
|
/**
|
||||||
* reads all keyValue pairs at once and returns them
|
* reads all keyValue pairs at once and returns them
|
||||||
*/
|
*/
|
||||||
async readAll() {
|
public async readAll() {
|
||||||
await this.initialReadTask.trigger();
|
await this.initialReadTask.trigger();
|
||||||
this.syncTask.trigger();
|
this.syncTask.trigger();
|
||||||
return this.dataObject;
|
return this.dataObject;
|
||||||
@ -61,7 +61,7 @@ export class KeyValueStore {
|
|||||||
/**
|
/**
|
||||||
* reads a keyValueFile from disk
|
* reads a keyValueFile from disk
|
||||||
*/
|
*/
|
||||||
async readKey(keyArg: string) {
|
public async readKey(keyArg: string) {
|
||||||
let data = await this.readAll();
|
let data = await this.readAll();
|
||||||
return data[keyArg];
|
return data[keyArg];
|
||||||
}
|
}
|
||||||
@ -95,7 +95,7 @@ export class KeyValueStore {
|
|||||||
/**
|
/**
|
||||||
* updates a value
|
* updates a value
|
||||||
*/
|
*/
|
||||||
async update(keyObject) {}
|
public async update(keyObject) {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* computes the identity
|
* computes the identity
|
||||||
|
Reference in New Issue
Block a user