layer2storage
Advanced tools
Comparing version
@@ -401,6 +401,65 @@ /*! ***************************************************************************** | ||
}); | ||
// return Promise.resolve([] as VCState[]) | ||
}; | ||
GunStorageProxy.prototype.getLCsList = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var listPromise; | ||
return __generator(this, function (_a) { | ||
listPromise = this._lcs.once(); | ||
return [2 /*return*/, _listify(listPromise)]; | ||
}); | ||
}); | ||
}; | ||
GunStorageProxy.prototype.getVChannelsList = function (ledger) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var listPromise; | ||
return __generator(this, function (_a) { | ||
listPromise = this._ledgerByID(ledger) | ||
.get(LC_VCHANNELS_KEY) | ||
.once(); | ||
return [2 /*return*/, _listify(listPromise)]; | ||
}); | ||
}); | ||
}; | ||
GunStorageProxy.prototype.getAllVChannelsList = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var listPromise; | ||
return __generator(this, function (_a) { | ||
listPromise = this._vcs.once(); | ||
return [2 /*return*/, _listify(listPromise)]; | ||
}); | ||
}); | ||
}; | ||
return GunStorageProxy; | ||
}()); | ||
function _listify(gunkey) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var listPromise, listVal, len, count, total, p; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
listPromise = gunkey.once(); | ||
return [4 /*yield*/, listPromise]; | ||
case 1: | ||
listVal = _a.sent(); | ||
len = Object.keys(listVal).length - 1; | ||
count = 0; | ||
total = []; | ||
p = new Promise(function (resolve, rejected) { | ||
listPromise.map().once(function (x, index) { | ||
if (!listVal[index]) { | ||
console.log('discarding new entry'); | ||
return; | ||
} | ||
count++; | ||
if (!!x) | ||
total.push(x); | ||
if (count == len) | ||
resolve(total); | ||
}); | ||
}); | ||
return [2 /*return*/, p]; | ||
} | ||
}); | ||
}); | ||
} | ||
/* | ||
@@ -407,0 +466,0 @@ (x: any) => { |
@@ -407,6 +407,65 @@ (function (global, factory) { | ||
}); | ||
// return Promise.resolve([] as VCState[]) | ||
}; | ||
GunStorageProxy.prototype.getLCsList = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var listPromise; | ||
return __generator(this, function (_a) { | ||
listPromise = this._lcs.once(); | ||
return [2 /*return*/, _listify(listPromise)]; | ||
}); | ||
}); | ||
}; | ||
GunStorageProxy.prototype.getVChannelsList = function (ledger) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var listPromise; | ||
return __generator(this, function (_a) { | ||
listPromise = this._ledgerByID(ledger) | ||
.get(LC_VCHANNELS_KEY) | ||
.once(); | ||
return [2 /*return*/, _listify(listPromise)]; | ||
}); | ||
}); | ||
}; | ||
GunStorageProxy.prototype.getAllVChannelsList = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var listPromise; | ||
return __generator(this, function (_a) { | ||
listPromise = this._vcs.once(); | ||
return [2 /*return*/, _listify(listPromise)]; | ||
}); | ||
}); | ||
}; | ||
return GunStorageProxy; | ||
}()); | ||
function _listify(gunkey) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var listPromise, listVal, len, count, total, p; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
listPromise = gunkey.once(); | ||
return [4 /*yield*/, listPromise]; | ||
case 1: | ||
listVal = _a.sent(); | ||
len = Object.keys(listVal).length - 1; | ||
count = 0; | ||
total = []; | ||
p = new Promise(function (resolve, rejected) { | ||
listPromise.map().once(function (x, index) { | ||
if (!listVal[index]) { | ||
console.log('discarding new entry'); | ||
return; | ||
} | ||
count++; | ||
if (!!x) | ||
total.push(x); | ||
if (count == len) | ||
resolve(total); | ||
}); | ||
}); | ||
return [2 /*return*/, p]; | ||
} | ||
}); | ||
}); | ||
} | ||
/* | ||
@@ -413,0 +472,0 @@ (x: any) => { |
@@ -386,7 +386,66 @@ "use strict"; | ||
}); | ||
// return Promise.resolve([] as VCState[]) | ||
}; | ||
GunStorageProxy.prototype.getLCsList = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var listPromise; | ||
return __generator(this, function (_a) { | ||
listPromise = this._lcs.once(); | ||
return [2 /*return*/, _listify(listPromise)]; | ||
}); | ||
}); | ||
}; | ||
GunStorageProxy.prototype.getVChannelsList = function (ledger) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var listPromise; | ||
return __generator(this, function (_a) { | ||
listPromise = this._ledgerByID(ledger) | ||
.get(LC_VCHANNELS_KEY) | ||
.once(); | ||
return [2 /*return*/, _listify(listPromise)]; | ||
}); | ||
}); | ||
}; | ||
GunStorageProxy.prototype.getAllVChannelsList = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var listPromise; | ||
return __generator(this, function (_a) { | ||
listPromise = this._vcs.once(); | ||
return [2 /*return*/, _listify(listPromise)]; | ||
}); | ||
}); | ||
}; | ||
return GunStorageProxy; | ||
}()); | ||
exports.GunStorageProxy = GunStorageProxy; | ||
function _listify(gunkey) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var listPromise, listVal, len, count, total, p; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
listPromise = gunkey.once(); | ||
return [4 /*yield*/, listPromise]; | ||
case 1: | ||
listVal = _a.sent(); | ||
len = Object.keys(listVal).length - 1; | ||
count = 0; | ||
total = []; | ||
p = new Promise(function (resolve, rejected) { | ||
listPromise.map().once(function (x, index) { | ||
if (!listVal[index]) { | ||
console.log('discarding new entry'); | ||
return; | ||
} | ||
count++; | ||
if (!!x) | ||
total.push(x); | ||
if (count == len) | ||
resolve(total); | ||
}); | ||
}); | ||
return [2 /*return*/, p]; | ||
} | ||
}); | ||
}); | ||
} | ||
/* | ||
@@ -393,0 +452,0 @@ (x: any) => { |
@@ -37,2 +37,3 @@ declare type StrObject = { | ||
getLCs(cb: (lc: LCState) => void): void; | ||
getLCsList(): Promise<LCState[]>; | ||
delLC(id: LCID): Promise<void>; | ||
@@ -44,3 +45,5 @@ storeVChannel(data: VCState): Promise<VCState>; | ||
getVChannels(ledger: LCID, cb: (lc: VCState) => void): void; | ||
getVChannelsList(ledger: LCID): Promise<VCState[]>; | ||
getAllVChannels(cb: (lc: VCState) => void): void; | ||
getAllVChannelsList(): Promise<VCState[]>; | ||
} | ||
@@ -75,3 +78,6 @@ declare type Gun = any; | ||
getAllVChannels(cb: (lc: VCState) => void): void; | ||
getLCsList(): Promise<LCState[]>; | ||
getVChannelsList(ledger: LCID): Promise<VCState[]>; | ||
getAllVChannelsList(): Promise<VCState[]>; | ||
} | ||
export {}; |
{ | ||
"name": "layer2storage", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"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
111062
14.05%1495
13.95%