Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

layer2storage

Package Overview
Dependencies
Maintainers
5
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

layer2storage - npm Package Compare versions

Comparing version 0.0.2 to 0.0.4

118

dist/layer2storage.es5.js

@@ -207,21 +207,22 @@ /*! *****************************************************************************

// latest by nonce
GunStorageProxy.prototype.getLCs = function () {
return __awaiter(this, void 0, void 0, function () {
var timeout, lcs;
return __generator(this, function (_a) {
timeout = function (ms) { return new Promise(function (res) { return setTimeout(res, ms); }); };
lcs = [];
this._lcs
.once()
.map()
.once(function (x) {
// console.log('x', x)
if (!!x)
lcs.push(x);
});
return [2 /*return*/, timeout(850).then(function (x) { return lcs; })];
});
});
};
GunStorageProxy.prototype.getLCsMap = function (cb) {
/*
async getLCs(): Promise<LCState[]> {
// going to hell for this but it must be done like this (for now)..
// .. must use timeout to aggregate the collection until
// .. gun supports length tracked lists
// TODO: store a length param as a seperate key with some atomic-like
const timeout = (ms: number) => new Promise(res => setTimeout(res, ms))
let lcs: LCState[] = []
this._lcs
.once()
.map()
.once((x: any) => {
// console.log('x', x)
if (!!x) lcs.push(x)
})
return timeout(850).then((x: any) => lcs)
}
*/
GunStorageProxy.prototype.getLCs = function (cb) {
this._lcs

@@ -331,6 +332,9 @@ .once()

throw new Error('vc ' + id + ' does not exist to delete');
return [4 /*yield*/, this._vcs.unset(vc)];
return [4 /*yield*/, this._vcs.unset(vc)
// console.log('delVChannel', vcc, !!vcc.ledger)
//if (vcc.ledger) {
];
case 2:
_a.sent();
console.log('delVChannel', vcc, !!vcc.ledger);
// console.log('delVChannel', vcc, !!vcc.ledger)
//if (vcc.ledger) {

@@ -344,2 +348,3 @@ return [4 /*yield*/, vc

case 3:
// console.log('delVChannel', vcc, !!vcc.ledger)
//if (vcc.ledger) {

@@ -391,49 +396,44 @@ _a.sent();

GunStorageProxy.prototype.getVChannels = function (ledger, cb) {
return __awaiter(this, void 0, void 0, function () {
var lc;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
lc = this._ledgerByID(ledger);
return [4 /*yield*/, lc];
case 1:
if (!(_a.sent()))
throw new Error('no ledger matching ' + ledger);
return [2 /*return*/, lc
.get(LC_VCHANNELS_KEY)
.once()
.map(function (x) {
//console.log('xxxxxxxxxxxx', x)
if (!!x)
cb(x);
return x;
})
.once()
// return Promise.resolve([] as VCState[])
];
}
});
var lc = this._ledgerByID(ledger);
//if (!(await lc)) throw new Error('no ledger matching ' + ledger)
return lc
.get(LC_VCHANNELS_KEY)
.once()
.map()
.once(function (x) {
if (x)
cb(x);
return x;
});
// return Promise.resolve([] as VCState[])
};
GunStorageProxy.prototype.getAllVChannels = function (cb) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this._vcs
.once() // bug
.map(function (x) {
//console.log('yyyyyyyyyy', x)
if (!!x)
cb(x);
return x;
})
.once()
// return Promise.resolve([] as VCState[])
];
});
return this._vcs
.once() // bug
.map()
.once(function (x) {
if (x)
cb(x);
return x;
});
// return Promise.resolve([] as VCState[])
};
return GunStorageProxy;
}());
/*
(x: any) => {
//console.log('yyyyyyyyyy', x)
if (!!x) cb(x)
return x
}
*/
/*
.map((x: any) => {
//console.log('xxxxxxxxxxxx', x)
if (!!x) cb(x)
return x
})
*/
export { makeLCState, makeVCState, GunStorageProxy };
//# sourceMappingURL=layer2storage.es5.js.map

@@ -213,21 +213,22 @@ (function (global, factory) {

// latest by nonce
GunStorageProxy.prototype.getLCs = function () {
return __awaiter(this, void 0, void 0, function () {
var timeout, lcs;
return __generator(this, function (_a) {
timeout = function (ms) { return new Promise(function (res) { return setTimeout(res, ms); }); };
lcs = [];
this._lcs
.once()
.map()
.once(function (x) {
// console.log('x', x)
if (!!x)
lcs.push(x);
});
return [2 /*return*/, timeout(850).then(function (x) { return lcs; })];
});
});
};
GunStorageProxy.prototype.getLCsMap = function (cb) {
/*
async getLCs(): Promise<LCState[]> {
// going to hell for this but it must be done like this (for now)..
// .. must use timeout to aggregate the collection until
// .. gun supports length tracked lists
// TODO: store a length param as a seperate key with some atomic-like
const timeout = (ms: number) => new Promise(res => setTimeout(res, ms))
let lcs: LCState[] = []
this._lcs
.once()
.map()
.once((x: any) => {
// console.log('x', x)
if (!!x) lcs.push(x)
})
return timeout(850).then((x: any) => lcs)
}
*/
GunStorageProxy.prototype.getLCs = function (cb) {
this._lcs

@@ -337,6 +338,9 @@ .once()

throw new Error('vc ' + id + ' does not exist to delete');
return [4 /*yield*/, this._vcs.unset(vc)];
return [4 /*yield*/, this._vcs.unset(vc)
// console.log('delVChannel', vcc, !!vcc.ledger)
//if (vcc.ledger) {
];
case 2:
_a.sent();
console.log('delVChannel', vcc, !!vcc.ledger);
// console.log('delVChannel', vcc, !!vcc.ledger)
//if (vcc.ledger) {

@@ -350,2 +354,3 @@ return [4 /*yield*/, vc

case 3:
// console.log('delVChannel', vcc, !!vcc.ledger)
//if (vcc.ledger) {

@@ -397,47 +402,42 @@ _a.sent();

GunStorageProxy.prototype.getVChannels = function (ledger, cb) {
return __awaiter(this, void 0, void 0, function () {
var lc;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
lc = this._ledgerByID(ledger);
return [4 /*yield*/, lc];
case 1:
if (!(_a.sent()))
throw new Error('no ledger matching ' + ledger);
return [2 /*return*/, lc
.get(LC_VCHANNELS_KEY)
.once()
.map(function (x) {
//console.log('xxxxxxxxxxxx', x)
if (!!x)
cb(x);
return x;
})
.once()
// return Promise.resolve([] as VCState[])
];
}
});
var lc = this._ledgerByID(ledger);
//if (!(await lc)) throw new Error('no ledger matching ' + ledger)
return lc
.get(LC_VCHANNELS_KEY)
.once()
.map()
.once(function (x) {
if (x)
cb(x);
return x;
});
// return Promise.resolve([] as VCState[])
};
GunStorageProxy.prototype.getAllVChannels = function (cb) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this._vcs
.once() // bug
.map(function (x) {
//console.log('yyyyyyyyyy', x)
if (!!x)
cb(x);
return x;
})
.once()
// return Promise.resolve([] as VCState[])
];
});
return this._vcs
.once() // bug
.map()
.once(function (x) {
if (x)
cb(x);
return x;
});
// return Promise.resolve([] as VCState[])
};
return GunStorageProxy;
}());
/*
(x: any) => {
//console.log('yyyyyyyyyy', x)
if (!!x) cb(x)
return x
}
*/
/*
.map((x: any) => {
//console.log('xxxxxxxxxxxx', x)
if (!!x) cb(x)
return x
})
*/

@@ -444,0 +444,0 @@ exports.makeLCState = makeLCState;

@@ -194,21 +194,22 @@ "use strict";

// latest by nonce
GunStorageProxy.prototype.getLCs = function () {
return __awaiter(this, void 0, void 0, function () {
var timeout, lcs;
return __generator(this, function (_a) {
timeout = function (ms) { return new Promise(function (res) { return setTimeout(res, ms); }); };
lcs = [];
this._lcs
.once()
.map()
.once(function (x) {
// console.log('x', x)
if (!!x)
lcs.push(x);
});
return [2 /*return*/, timeout(850).then(function (x) { return lcs; })];
});
});
};
GunStorageProxy.prototype.getLCsMap = function (cb) {
/*
async getLCs(): Promise<LCState[]> {
// going to hell for this but it must be done like this (for now)..
// .. must use timeout to aggregate the collection until
// .. gun supports length tracked lists
// TODO: store a length param as a seperate key with some atomic-like
const timeout = (ms: number) => new Promise(res => setTimeout(res, ms))
let lcs: LCState[] = []
this._lcs
.once()
.map()
.once((x: any) => {
// console.log('x', x)
if (!!x) lcs.push(x)
})
return timeout(850).then((x: any) => lcs)
}
*/
GunStorageProxy.prototype.getLCs = function (cb) {
this._lcs

@@ -318,6 +319,9 @@ .once()

throw new Error('vc ' + id + ' does not exist to delete');
return [4 /*yield*/, this._vcs.unset(vc)];
return [4 /*yield*/, this._vcs.unset(vc)
// console.log('delVChannel', vcc, !!vcc.ledger)
//if (vcc.ledger) {
];
case 2:
_a.sent();
console.log('delVChannel', vcc, !!vcc.ledger);
// console.log('delVChannel', vcc, !!vcc.ledger)
//if (vcc.ledger) {

@@ -331,2 +335,3 @@ return [4 /*yield*/, vc

case 3:
// console.log('delVChannel', vcc, !!vcc.ledger)
//if (vcc.ledger) {

@@ -378,44 +383,25 @@ _a.sent();

GunStorageProxy.prototype.getVChannels = function (ledger, cb) {
return __awaiter(this, void 0, void 0, function () {
var lc;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
lc = this._ledgerByID(ledger);
return [4 /*yield*/, lc];
case 1:
if (!(_a.sent()))
throw new Error('no ledger matching ' + ledger);
return [2 /*return*/, lc
.get(LC_VCHANNELS_KEY)
.once()
.map(function (x) {
//console.log('xxxxxxxxxxxx', x)
if (!!x)
cb(x);
return x;
})
.once()
// return Promise.resolve([] as VCState[])
];
}
});
var lc = this._ledgerByID(ledger);
//if (!(await lc)) throw new Error('no ledger matching ' + ledger)
return lc
.get(LC_VCHANNELS_KEY)
.once()
.map()
.once(function (x) {
if (x)
cb(x);
return x;
});
// return Promise.resolve([] as VCState[])
};
GunStorageProxy.prototype.getAllVChannels = function (cb) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this._vcs
.once() // bug
.map(function (x) {
//console.log('yyyyyyyyyy', x)
if (!!x)
cb(x);
return x;
})
.once()
// return Promise.resolve([] as VCState[])
];
});
return this._vcs
.once() // bug
.map()
.once(function (x) {
if (x)
cb(x);
return x;
});
// return Promise.resolve([] as VCState[])
};

@@ -425,2 +411,16 @@ return GunStorageProxy;

exports.GunStorageProxy = GunStorageProxy;
/*
(x: any) => {
//console.log('yyyyyyyyyy', x)
if (!!x) cb(x)
return x
}
*/
/*
.map((x: any) => {
//console.log('xxxxxxxxxxxx', x)
if (!!x) cb(x)
return x
})
*/
//# sourceMappingURL=layer2storage.js.map

@@ -38,4 +38,3 @@ declare type StrObject = {

getLC(ledgerID: LCID): Promise<LCState>;
getLCs(): Promise<LCState[]>;
getLCsMap(cb: (lc: LCState) => void): void;
getLCs(cb: (lc: LCState) => void): void;
delLC(id: LCID): Promise<void>;

@@ -46,4 +45,4 @@ storeVChannel(data: VCState): Promise<VCState>;

getVChannel(ledger: VCID): Promise<VCState>;
getVChannels(ledger: LCID, cb: (lc: VCState) => void): Promise<void>;
getAllVChannels(cb: (lc: VCState) => void): Promise<void>;
getVChannels(ledger: LCID, cb: (lc: VCState) => void): void;
getAllVChannels(cb: (lc: VCState) => void): void;
}

@@ -70,4 +69,3 @@ declare type Gun = any;

getLC(ledgerID: LCID): Promise<LCState>;
getLCs(): Promise<LCState[]>;
getLCsMap(cb: (lc: LCState) => void): void;
getLCs(cb: (lc: LCState) => void): void;
delLC(id: LCID): Promise<void>;

@@ -78,5 +76,5 @@ storeVChannel(data: VCState): Promise<VCState>;

getVChannel(id: VCID): Promise<VCState>;
getVChannels(ledger: LCID, cb: (lc: VCState) => void): Promise<void>;
getAllVChannels(cb: (lc: VCState) => void): Promise<void>;
getVChannels(ledger: LCID, cb: (lc: VCState) => void): void;
getAllVChannels(cb: (lc: VCState) => void): void;
}
export {};
{
"name": "layer2storage",
"version": "0.0.2",
"version": "0.0.4",
"description": "",

@@ -5,0 +5,0 @@ "keywords": [],

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc