@iqprotocol/abstract-storage
Advanced tools
Comparing version 0.9.0 to 0.10.0
@@ -237,7 +237,5 @@ 'use strict'; | ||
var IteratorPrototype = {}; | ||
IteratorPrototype[iteratorSymbol] = function () { | ||
define(IteratorPrototype, iteratorSymbol, function () { | ||
return this; | ||
}; | ||
}); | ||
var getProto = Object.getPrototypeOf; | ||
@@ -253,4 +251,5 @@ var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); | ||
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); | ||
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; | ||
GeneratorFunctionPrototype.constructor = GeneratorFunction; | ||
GeneratorFunction.prototype = GeneratorFunctionPrototype; | ||
define(Gp, "constructor", GeneratorFunctionPrototype); | ||
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction); | ||
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the | ||
@@ -360,7 +359,5 @@ // Iterator interface in terms of a single ._invoke method. | ||
defineIteratorMethods(AsyncIterator.prototype); | ||
AsyncIterator.prototype[asyncIteratorSymbol] = function () { | ||
define(AsyncIterator.prototype, asyncIteratorSymbol, function () { | ||
return this; | ||
}; | ||
}); | ||
exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of | ||
@@ -542,9 +539,8 @@ // AsyncIterator objects; they just return a Promise for the value of | ||
Gp[iteratorSymbol] = function () { | ||
define(Gp, iteratorSymbol, function () { | ||
return this; | ||
}; | ||
Gp.toString = function () { | ||
}); | ||
define(Gp, "toString", function () { | ||
return "[object Generator]"; | ||
}; | ||
}); | ||
@@ -861,3 +857,4 @@ function pushTryEntry(locs) { | ||
// assignment should always work unless something is misconfigured. Just | ||
// in case runtime.js accidentally runs in strict mode, we can escape | ||
// in case runtime.js accidentally runs in strict mode, in modern engines | ||
// we can explicitly access globalThis. In older engines we can escape | ||
// strict mode using a global Function call. This could conceivably fail | ||
@@ -869,3 +866,7 @@ // if a Content Security Policy forbids using Function, but in that case | ||
// problems, please detail your unique predicament in a GitHub issue. | ||
Function("r", "regeneratorRuntime = r")(runtime); | ||
if (typeof globalThis === "object") { | ||
globalThis.regeneratorRuntime = runtime; | ||
} else { | ||
Function("r", "regeneratorRuntime = r")(runtime); | ||
} | ||
} | ||
@@ -872,0 +873,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
"use strict";function t(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function r(r){return function(){var e=this,n=arguments;return new Promise((function(o,i){var a=r.apply(e,n);function c(r){t(a,o,i,c,u,"next",r)}function u(r){t(a,o,i,c,u,"throw",r)}c(void 0)}))}}function e(t){return(e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function n(t,r){return(n=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t})(t,r)}function o(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function i(t,r,e){return(i=o()?Reflect.construct:function(t,r,e){var o=[null];o.push.apply(o,r);var i=new(Function.bind.apply(t,o));return e&&n(i,e.prototype),i}).apply(null,arguments)}function a(t){var r="function"==typeof Map?new Map:void 0;return(a=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,o)}function o(){return i(t,arguments,e(this).constructor)}return o.prototype=Object.create(t.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),n(o,t)})(t)}function c(t,r){return t(r={exports:{}},r.exports),r.exports}Object.defineProperty(exports,"__esModule",{value:!0});var u=c((function(t){var r=function(t){var r=Object.prototype,e=r.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{c({},"")}catch(t){c=function(t,r,e){return t[r]=e}}function u(t,r,e,n){var o=Object.create((r&&r.prototype instanceof l?r:l).prototype),i=new L(n||[]);return o._invoke=function(t,r,e){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=x(a,e);if(c){if(c===s)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var u=f(t,r,e);if("normal"===u.type){if(n=e.done?"completed":"suspendedYield",u.arg===s)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n="completed",e.method="throw",e.arg=u.arg)}}}(t,e,i),o}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var s={};function l(){}function h(){}function p(){}var v={};v[o]=function(){return this};var d=Object.getPrototypeOf,y=d&&d(d(_([])));y&&y!==r&&e.call(y,o)&&(v=y);var g=p.prototype=l.prototype=Object.create(v);function w(t){["next","throw","return"].forEach((function(r){c(t,r,(function(t){return this._invoke(r,t)}))}))}function m(t,r){var n;this._invoke=function(o,i){function a(){return new r((function(n,a){!function n(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&e.call(l,"__await")?r.resolve(l.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):r.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function x(t,r){var e=t.iterator[r.method];if(void 0===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,x(t,r),"throw"===r.method))return s;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var n=f(e,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,s;var o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,s):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,s)}function b(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function E(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function _(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function r(){for(;++n<t.length;)if(e.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return h.prototype=g.constructor=p,p.constructor=h,h.displayName=c(p,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===h||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,c(t,a,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},w(m.prototype),m.prototype[i]=function(){return this},t.AsyncIterator=m,t.async=function(r,e,n,o,i){void 0===i&&(i=Promise);var a=new m(u(r,e,n,o),i);return t.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(g),c(g,a,"Generator"),g[o]=function(){return this},g.toString=function(){return"[object Generator]"},t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var r in this)"t"===r.charAt(0)&&e.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(e,n){return a.type="throw",a.arg=t,r.next=e,n&&(r.method="next",r.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=e.call(i,"catchLoc"),u=e.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,r){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&e.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,s):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),s},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),E(e),s}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;E(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:_(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),s}},t}(t.exports);try{regeneratorRuntime=r}catch(t){Function("r","regeneratorRuntime = r")(r)}})),f=function(t){var r,e;function o(r){var e;return e=t.call(this,r)||this,Error.captureStackTrace&&Error.captureStackTrace(function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(e),o),e.name="AccountStateError",e}return e=t,(r=o).prototype=Object.create(e.prototype),r.prototype.constructor=r,n(r,e),o}(a(Error)),s=function(t){return null==t||!String(t).trim().length},l=function(){function t(){}var r=t.prototype;return r.validateAccount=function(t){if(s(t.id))throw new Error("Empty id")},r.validateAccountState=function(t){if(["serviceId","accountId","gapHalvingPeriod","power","lockedPower","energyCap","energy","energyCalculatedAt"].forEach((function(r){if(s(t[r]))throw new f("Empty "+r)})),t.power<0)throw new f("Negative power");if(t.gapHalvingPeriod<=0)throw new f("Invalid gap halving period");if(t.lockedPower<0)throw new f("Negative locked power");if(t.energy>t.energyCap)throw new f("Energy above cap");if(t.energyCalculatedAt<0)throw new f("Negative energy calculation time")},t}();exports.AbstractStore=function(){function t(t){var r;this.validator=null!=(r=t.validator)?r:new l}var e=t.prototype;return e.saveAccount=function(){var t=r(u.mark((function t(r){return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.validator.validateAccount(r),t.abrupt("return",this._saveAccount(r));case 2:case"end":return t.stop()}}),t,this)})));return function(r){return t.apply(this,arguments)}}(),e.initAccountState=function(){var t=r(u.mark((function t(r){return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.validator.validateAccountState(r),t.abrupt("return",this._initAccountState(r));case 2:case"end":return t.stop()}}),t,this)})));return function(r){return t.apply(this,arguments)}}(),e.changeAccountState=function(){var t=r(u.mark((function t(r,e){return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r.accountId===e.accountId){t.next=2;break}throw new Error("Account ID mismatch");case 2:if(r.serviceId===e.serviceId){t.next=4;break}throw new Error("Service ID mismatch");case 4:return this.validator.validateAccountState(e),t.abrupt("return",this._changeAccountState(r,e));case 6:case"end":return t.stop()}}),t,this)})));return function(r,e){return t.apply(this,arguments)}}(),t}(),exports.AccountStateError=f,exports.DefaultValidator=l; | ||
"use strict";function t(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function r(r){return function(){var e=this,n=arguments;return new Promise((function(o,i){var a=r.apply(e,n);function c(r){t(a,o,i,c,u,"next",r)}function u(r){t(a,o,i,c,u,"throw",r)}c(void 0)}))}}function e(t){return(e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function n(t,r){return(n=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t})(t,r)}function o(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function i(t,r,e){return(i=o()?Reflect.construct:function(t,r,e){var o=[null];o.push.apply(o,r);var i=new(Function.bind.apply(t,o));return e&&n(i,e.prototype),i}).apply(null,arguments)}function a(t){var r="function"==typeof Map?new Map:void 0;return(a=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,o)}function o(){return i(t,arguments,e(this).constructor)}return o.prototype=Object.create(t.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),n(o,t)})(t)}function c(t,r){return t(r={exports:{}},r.exports),r.exports}Object.defineProperty(exports,"__esModule",{value:!0});var u=c((function(t){var r=function(t){var r=Object.prototype,e=r.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{c({},"")}catch(t){c=function(t,r,e){return t[r]=e}}function u(t,r,e,n){var o=Object.create((r&&r.prototype instanceof s?r:s).prototype),i=new L(n||[]);return o._invoke=function(t,r,e){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=b(a,e);if(c){if(c===l)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var u=f(t,r,e);if("normal"===u.type){if(n=e.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n="completed",e.method="throw",e.arg=u.arg)}}}(t,e,i),o}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function s(){}function h(){}function p(){}var v={};c(v,o,(function(){return this}));var d=Object.getPrototypeOf,y=d&&d(d(_([])));y&&y!==r&&e.call(y,o)&&(v=y);var g=p.prototype=s.prototype=Object.create(v);function w(t){["next","throw","return"].forEach((function(r){c(t,r,(function(t){return this._invoke(r,t)}))}))}function m(t,r){var n;this._invoke=function(o,i){function a(){return new r((function(n,a){!function n(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==typeof s&&e.call(s,"__await")?r.resolve(s.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):r.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function b(t,r){var e=t.iterator[r.method];if(void 0===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,b(t,r),"throw"===r.method))return l;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=f(e,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,l;var o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,l):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,l)}function x(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function E(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function _(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function r(){for(;++n<t.length;)if(e.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return h.prototype=p,c(g,"constructor",p),c(p,"constructor",h),h.displayName=c(p,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===h||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,c(t,a,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},w(m.prototype),c(m.prototype,i,(function(){return this})),t.AsyncIterator=m,t.async=function(r,e,n,o,i){void 0===i&&(i=Promise);var a=new m(u(r,e,n,o),i);return t.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(g),c(g,a,"Generator"),c(g,o,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var r in this)"t"===r.charAt(0)&&e.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(e,n){return a.type="throw",a.arg=t,r.next=e,n&&(r.method="next",r.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=e.call(i,"catchLoc"),u=e.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,r){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&e.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),l},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),E(e),l}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;E(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:_(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=r}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}})),f=function(t){var r,e;function o(r){var e;return e=t.call(this,r)||this,Error.captureStackTrace&&Error.captureStackTrace(function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(e),o),e.name="AccountStateError",e}return e=t,(r=o).prototype=Object.create(e.prototype),r.prototype.constructor=r,n(r,e),o}(a(Error)),l=function(t){return null==t||!String(t).trim().length},s=function(){function t(){}var r=t.prototype;return r.validateAccount=function(t){if(l(t.id))throw new Error("Empty id")},r.validateAccountState=function(t){if(["serviceId","accountId","gapHalvingPeriod","power","lockedPower","energyCap","energy","energyCalculatedAt"].forEach((function(r){if(l(t[r]))throw new f("Empty "+r)})),t.power<0)throw new f("Negative power");if(t.gapHalvingPeriod<=0)throw new f("Invalid gap halving period");if(t.lockedPower<0)throw new f("Negative locked power");if(t.energy>t.energyCap)throw new f("Energy above cap");if(t.energyCalculatedAt<0)throw new f("Negative energy calculation time")},t}();exports.AbstractStore=function(){function t(t){var r;this.validator=null!=(r=t.validator)?r:new s}var e=t.prototype;return e.saveAccount=function(){var t=r(u.mark((function t(r){return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.validator.validateAccount(r),t.abrupt("return",this._saveAccount(r));case 2:case"end":return t.stop()}}),t,this)})));return function(r){return t.apply(this,arguments)}}(),e.initAccountState=function(){var t=r(u.mark((function t(r){return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.validator.validateAccountState(r),t.abrupt("return",this._initAccountState(r));case 2:case"end":return t.stop()}}),t,this)})));return function(r){return t.apply(this,arguments)}}(),e.changeAccountState=function(){var t=r(u.mark((function t(r,e){return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r.accountId===e.accountId){t.next=2;break}throw new Error("Account ID mismatch");case 2:if(r.serviceId===e.serviceId){t.next=4;break}throw new Error("Service ID mismatch");case 4:return this.validator.validateAccountState(e),t.abrupt("return",this._changeAccountState(r,e));case 6:case"end":return t.stop()}}),t,this)})));return function(r,e){return t.apply(this,arguments)}}(),t}(),exports.AccountStateError=f,exports.DefaultValidator=s; | ||
//# sourceMappingURL=abstract-storage.cjs.production.min.js.map |
@@ -233,7 +233,5 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
var IteratorPrototype = {}; | ||
IteratorPrototype[iteratorSymbol] = function () { | ||
define(IteratorPrototype, iteratorSymbol, function () { | ||
return this; | ||
}; | ||
}); | ||
var getProto = Object.getPrototypeOf; | ||
@@ -249,4 +247,5 @@ var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); | ||
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); | ||
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; | ||
GeneratorFunctionPrototype.constructor = GeneratorFunction; | ||
GeneratorFunction.prototype = GeneratorFunctionPrototype; | ||
define(Gp, "constructor", GeneratorFunctionPrototype); | ||
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction); | ||
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the | ||
@@ -356,7 +355,5 @@ // Iterator interface in terms of a single ._invoke method. | ||
defineIteratorMethods(AsyncIterator.prototype); | ||
AsyncIterator.prototype[asyncIteratorSymbol] = function () { | ||
define(AsyncIterator.prototype, asyncIteratorSymbol, function () { | ||
return this; | ||
}; | ||
}); | ||
exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of | ||
@@ -538,9 +535,8 @@ // AsyncIterator objects; they just return a Promise for the value of | ||
Gp[iteratorSymbol] = function () { | ||
define(Gp, iteratorSymbol, function () { | ||
return this; | ||
}; | ||
Gp.toString = function () { | ||
}); | ||
define(Gp, "toString", function () { | ||
return "[object Generator]"; | ||
}; | ||
}); | ||
@@ -857,3 +853,4 @@ function pushTryEntry(locs) { | ||
// assignment should always work unless something is misconfigured. Just | ||
// in case runtime.js accidentally runs in strict mode, we can escape | ||
// in case runtime.js accidentally runs in strict mode, in modern engines | ||
// we can explicitly access globalThis. In older engines we can escape | ||
// strict mode using a global Function call. This could conceivably fail | ||
@@ -865,3 +862,7 @@ // if a Content Security Policy forbids using Function, but in that case | ||
// problems, please detail your unique predicament in a GitHub issue. | ||
Function("r", "regeneratorRuntime = r")(runtime); | ||
if (typeof globalThis === "object") { | ||
globalThis.regeneratorRuntime = runtime; | ||
} else { | ||
Function("r", "regeneratorRuntime = r")(runtime); | ||
} | ||
} | ||
@@ -868,0 +869,0 @@ }); |
{ | ||
"name": "@iqprotocol/abstract-storage", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"license": "UNLICENSED", | ||
@@ -21,3 +21,3 @@ "scripts": { | ||
}, | ||
"gitHead": "4ef51024704a0cdf55f1c59d96ad00d80684a32b" | ||
"gitHead": "f464db766f57cc190e2e526ca204ff10a346b270" | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
228452
1817