New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@aofl/resource-enumerate

Package Overview
Dependencies
Maintainers
2
Versions
155
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aofl/resource-enumerate - npm Package Compare versions

Comparing version 3.0.0-beta.6 to 3.0.0-beta.8

5

.aofl.js

@@ -7,3 +7,3 @@ const path = require('path');

build: {
filename: 'index.js',
filename: '[name].js',
path: path.join(__dirname, 'dist'),

@@ -26,3 +26,4 @@ entryReplace: {

output: {
libraryTarget: "commonjs2"
library: 'aoflResourceEnumerate',
libraryTarget: 'umd'
},

@@ -29,0 +30,0 @@ optimization: {

2

dist/index.js

@@ -1,2 +0,2 @@

module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s="QfWi")}({MmcY:function(e,t){e.exports=require("@babel/runtime/helpers/classCallCheck")},QfWi:function(e,t,r){"use strict";r.r(t);var n=r("dvlR"),a=r.n(n),i=r("RNGJ"),s=r.n(i),o=r("MmcY"),u=r.n(o),c=r("iTvO"),l=r.n(c),h={DEV:"development",STAGE:"stage",PROD:"production"};var f,d=function(){function e(){u()(this,e),this.middleware={};for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];for(var a=0;a<r.length;a++)this.middleware[r[a]]=[]}return l()(e,[{key:"use",value:function(e,t){if("function"!=typeof e)throw new Error("callback must be a function");if(void 0===this.middleware[t])throw new Error("Only ".concat(Object.keys(this.middleware)," hooks are supported."));return this.middleware[t].push({callback:e,hook:t}),this.createUnsubscribeFn(t,e)}},{key:"getMiddlewareIterator",value:function(e){var t=this.middleware[e],r=0;return{next:function(){return r<t.length?{value:t[r++],done:!1}:{done:!0}}}}},{key:"iterateMiddleware",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return new Promise((function(a){var i=r.getMiddlewareIterator(t),s=null;!function t(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;!0!==(s=i.next()).done?s.value.callback(e,r,t):a(r)}(n)}))}},{key:"createUnsubscribeFn",value:function(e,t){var r=this;return function n(){if(!n.executed){Object.defineProperty(n,"executed",{value:!0});var a=r.middleware[e].indexOf(t);a>-1&&r.middleware[e].splice(a,1)}}}}]),e}(),p=function(){function e(){u()(this,e),this.formatters={}}return l()(e,[{key:"getFormatter",value:function(e){if(this.formatters.hasOwnProperty(e))return this.formatters[e]}},{key:"addFormatter",value:function(e,t){if("function"!=typeof t.pack||"function"!=typeof t.unpack)throw new TypeError("formatter must implement pack() and unpack() functions");if(void 0!==this.formatters[e])throw new Error("".concat(e," already exists. Cannot replace an existing format."));this.formatters[e]=t}}]),e}(),v=r("lSNA"),y=r.n(v),g={MEMORY:0,LOCAL:1,SESSION:2},m=function(){function e(){u()(this,e)}return l()(e,null,[{key:"clear",value:function(){for(var t in e)e.hasOwnProperty(t)&&e.removeItem(t)}},{key:"getItem",value:function(t){return e.hasOwnProperty(t)?e[t]:null}},{key:"setItem",value:function(t,r){e[t]=r}},{key:"removeItem",value:function(t){e[t]=null,delete e[t]}},{key:"size",get:function(){var t=0;for(var r in e)e.hasOwnProperty(r)&&t++;return t}}]),e}(),k=r("q+NK"),b=r.n(k),w=(f={},y()(f,g.LOCAL,localStorage),y()(f,g.SESSION,sessionStorage),y()(f,g.MEMORY,m),f),x=Symbol("expire"),O=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g.MEMORY,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:36e5;u()(this,e),this.storage=w[r],this.storageType=r,this.namespace=t,this.storedKeys=this.getStoredKeys(),this.expire=n}return l()(e,[{key:"getStoredKeys",value:function(){var e=[];for(var t in this.storage)this.storage.hasOwnProperty(t)&&0===t.indexOf(this.namespace+"_")&&e.push(t);return e}},{key:"getNamespaceKey",value:function(e){return this.storedKeys.indexOf(e)>-1?e:this.namespace+"_"+b()(e)}},{key:"setItem",value:function(e,t){var r={t:Date.now(),v:t};this.storageType!==g.LOCAL&&this.storageType!==g.SESSION||(r=JSON.stringify(r));var n=this.getNamespaceKey(e);this.storage.setItem(n,r),this.storedKeys.push(n)}},{key:"getItem",value:function(e){var t=this.storage.getItem(this.getNamespaceKey(e));return this.storageType!==g.LOCAL&&this.storageType!==g.SESSION||(t=JSON.parse(t)),null!==t&&t.hasOwnProperty("t")?this.isExpired(e)?(this.removeItem(e),null):t.v:t}},{key:"getCollection",value:function(){var e={};this.storedKeys=this.getStoredKeys();for(var t=0;t<this.storedKeys.length;t++)this.isExpired(this.storedKeys[t])||(e[this.storedKeys[t]]=this.getItem(this.storedKeys[t]));return e}},{key:"removeItem",value:function(e){var t=this.getNamespaceKey(e),r=this.storedKeys.indexOf(t);r>-1&&(this.storage.removeItem(t),this.storedKeys.splice(r,1))}},{key:"clear",value:function(){for(var e=0;e<this.storedKeys.length;e++)this.storage.removeItem(this.storedKeys[e]);this.storedKeys=[]}},{key:"isExpired",value:function(e){if("number"!=typeof this.expire||this.expire<=0)return!1;var t=this.getNamespaceKey(e),r=this.storage.getItem(t);return this.storageType!==g.LOCAL&&this.storageType!==g.SESSION||(r=JSON.parse(r)),r.t<Date.now()-this.expire}},{key:"removeExpired",value:function(){for(var e=0;e<this.storedKeys.length;e++)this.isExpired(this.storedKeys[e])&&this.removeItem(this.storedKeys[e])}},{key:"destruct",value:function(){clearInterval(this.interval),this.namespace=null,this.storage=null,this.storageType=null,this.expire=null,this.storedKeys=null,this.interval=null}},{key:"expire",get:function(){return this[x]},set:function(e){var t=this;this[x]=e,null!==this.interval&&clearInterval(this.interval),e>0&&e<2147483647&&(this.interval=setInterval((function(){return t.removeExpired()}),e))}},{key:"size",get:function(){var e=this.getCollection();return Object.keys(e).length}}]),e}(),M=function(){function e(){u()(this,e),this.formatterManager=new p,this.cacheManagers={},this.addCacheManager("default")}return l()(e,null,[{key:"DEFAULT_CACHE_NAMESPACE",get:function(){return"ApiRequest"}}]),l()(e,[{key:"addFormatter",value:function(e,t){this.formatterManager.addFormatter(e,t)}},{key:"addCacheManager",value:function(e,t){if(this.cacheManagers.hasOwnProperty(e))throw new Error("ApiRequest: Cache namespace ".concat(e," already exists"));this.cacheManagers[e]=new O(e,g.MEMORY,t)}},{key:"getCacheManager",value:function(e,t){try{void 0===e?this.addCacheManager(this[this.DEFAULT_CACHE_NAMESPACE],t):this.addCacheManager(e,t)}catch(e){}return this.cacheManagers[e]}},{key:"updateCacheInterval",value:function(e,t){this.getCacheManager(e,t).expire=t}},{key:"purgeCache",value:function(e){if(void 0===e)for(var t in this.cacheManagers)this.cacheManagers.hasOwnProperty(t)&&this.cacheManagers[t].clear();else this.cacheManagers[e].clear()}},{key:"request",value:function(e,t,r){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"default",i=arguments.length>5?arguments[5]:void 0,s=this.formatterManager.getFormatter(r),o=e+JSON.stringify(t),u=this.getCacheManager(a,i),c=u.getItem(o);if(n&&c)return c;var l=fetch(e,s.pack(t)).then(s.unpack);return u.setItem(o,l),l}},{key:"clearCache",value:function(e){this.getCacheManager(e).clear()}}]),e}(),S=function(){function e(t){var r=this;u()(this,e),this.environment=t,this.ready=new Promise((function(e){r.resolve=e})),this.middlewareInstance=new d("before","after"),this.apiRequestInstance=new M}var t,r;return l()(e,[{key:"init",value:(r=s()(a.a.mark((function e(t){var r,n,i,s,o,u,c=this,l=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t.apis,n=t.developmentConfig,i=t.stageConfig,s=l.length>1&&void 0!==l[1]&&l[1],this.apis=r,o=function(e){if(!Object.hasOwnProperty.call(c.apis,e))return"continue";var t=c.apis[e];c.apiRequestInstance.addFormatter(e,{pack:function(){return t.requestOptions||{}},unpack:function(e){return e.json()}})},e.t0=a.a.keys(this.apis);case 5:if((e.t1=e.t0()).done){e.next=12;break}if(u=e.t1.value,"continue"!==o(u)){e.next=10;break}return e.abrupt("continue",5);case 10:e.next=5;break;case 12:if(!1!==s||this.environment===h.PROD){e.next=17;break}return e.next=15,this.updateApis(n,i);case 15:case 17:return this.resolve(),e.abrupt("return",this.ready);case 19:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"before",value:function(e){this.middlewareInstance.use(e,"before")}},{key:"after",value:function(e){this.middlewareInstance.use(e,"after")}},{key:"get",value:(t=s()(a.a.mark((function t(r){var n,i,s,o,u,c,l,h=this,f=arguments;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=!(f.length>1&&void 0!==f[1])||f[1],t.next=3,this.ready;case 3:if(i=this.apis[r],s=n,void 0!==i){t.next=7;break}throw new TypeError("".concat(r," is not a valid api namespace."));case 7:return(!s||"function"==typeof i.invalidateCache&&i.invalidateCache.call(null))&&(this.apiRequestInstance.clearCache(e.NAMESPACE),s=!1),o=this.apiRequestInstance.getCacheManager(e.NAMESPACE),u=o.getItem(i.url+JSON.stringify("")),c={namespace:r,cached:null!==u},t.next=13,this.middlewareInstance.iterateMiddleware(c,"before");case 13:return l=null,l=null!==u?u:this.apiRequestInstance.request(i.url,"",r,s,e.NAMESPACE),t.abrupt("return",l.then((function(e){return h.middlewareInstance.iterateMiddleware(c,"after",e)})));case 16:case"end":return t.stop()}}),t,this)}))),function(e){return t.apply(this,arguments)})},{key:"updateApis",value:function(e,t){var r=this,n=e;return this.environment===h.STAGE&&(n=t),n().then((function(e){for(var t in r.apis)if(Object.hasOwnProperty.call(r.apis,t)){var n=r.apis[t],a={};"function"==typeof n[r.environment+"Variables"]&&(a=n[r.environment+"Variables"].call(null)),n.url=e.default(t,a)}}))}}],[{key:"NAMESPACE",get:function(){return"resource-enumerate"}}]),e}();r.d(t,"ResourceEnumerate",(function(){return S}))},RNGJ:function(e,t){e.exports=require("@babel/runtime/helpers/asyncToGenerator")},dvlR:function(e,t){e.exports=require("@babel/runtime/regenerator")},iTvO:function(e,t){e.exports=require("@babel/runtime/helpers/createClass")},lSNA:function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},"q+NK":function(e,t){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={exports:{},id:n,loaded:!1};return e[n].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}return r.m=e,r.c=t,r.p="",r(0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){var n=r(2);e.exports=n},function(e,t){var r;r=function(){for(var e=[],t=0;t<64;)e[t]=0|4294967296*Math.abs(Math.sin(++t));return function(t){for(var r,n,a,i,s=[],o=unescape(encodeURI(t)),u=o.length,c=[r=1732584193,n=-271733879,~r,~n],l=0;l<=u;)s[l>>2]|=(o.charCodeAt(l)||128)<<l++%4*8;for(s[t=16*(u+8>>6)+14]=8*u,l=0;l<t;l+=16){for(u=c,i=0;i<64;)u=[a=u[3],(r=0|u[1])+((a=u[0]+[r&(n=u[2])|~r&a,a&r|~a&n,r^n^a,n^(r|~a)][u=i>>4]+(e[i]+(0|s[[i,5*i+1,3*i+5,7*i][u]%16+l])))<<(u=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*u+i++%4])|a>>>32-u),r,n];for(i=4;i;)c[--i]=c[i]+u[i]}for(t="";i<32;)t+=(c[i>>3]>>4*(1^7&i++)&15).toString(16);return t}}(),e.exports=r}])}});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@babel/runtime/helpers/classCallCheck"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/regenerator"),require("@babel/runtime/helpers/createClass")):"function"==typeof define&&define.amd?define(["@babel/runtime/helpers/classCallCheck","@babel/runtime/helpers/asyncToGenerator","@babel/runtime/regenerator","@babel/runtime/helpers/createClass"],t):"object"==typeof exports?exports.aoflResourceEnumerate=t(require("@babel/runtime/helpers/classCallCheck"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/regenerator"),require("@babel/runtime/helpers/createClass")):e.aoflResourceEnumerate=t(e[void 0],e[void 0],e[void 0],e[void 0])}(window,(function(e,t,r,n){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s="QfWi")}({MmcY:function(t,r){t.exports=e},QfWi:function(e,t,r){"use strict";r.r(t);var n=r("dvlR"),a=r.n(n),i=r("RNGJ"),s=r.n(i),o=r("MmcY"),u=r.n(o),c=r("iTvO"),l=r.n(c),h={DEV:"development",STAGE:"stage",PROD:"production"};var f,d=function(){function e(){u()(this,e),this.middleware={};for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];for(var a=0;a<r.length;a++)this.middleware[r[a]]=[]}return l()(e,[{key:"use",value:function(e,t){if("function"!=typeof e)throw new Error("callback must be a function");if(void 0===this.middleware[t])throw new Error("Only ".concat(Object.keys(this.middleware)," hooks are supported."));return this.middleware[t].push({callback:e,hook:t}),this.createUnsubscribeFn(t,e)}},{key:"getMiddlewareIterator",value:function(e){var t=this.middleware[e],r=0;return{next:function(){return r<t.length?{value:t[r++],done:!1}:{done:!0}}}}},{key:"iterateMiddleware",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return new Promise((function(a){var i=r.getMiddlewareIterator(t),s=null;!function t(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;!0!==(s=i.next()).done?s.value.callback(e,r,t):a(r)}(n)}))}},{key:"createUnsubscribeFn",value:function(e,t){var r=this;return function n(){if(!n.executed){Object.defineProperty(n,"executed",{value:!0});var a=r.middleware[e].indexOf(t);a>-1&&r.middleware[e].splice(a,1)}}}}]),e}(),p=function(){function e(){u()(this,e),this.formatters={}}return l()(e,[{key:"getFormatter",value:function(e){if(this.formatters.hasOwnProperty(e))return this.formatters[e]}},{key:"addFormatter",value:function(e,t){if("function"!=typeof t.pack||"function"!=typeof t.unpack)throw new TypeError("formatter must implement pack() and unpack() functions");if(void 0!==this.formatters[e])throw new Error("".concat(e," already exists. Cannot replace an existing format."));this.formatters[e]=t}}]),e}(),v=r("lSNA"),y=r.n(v),m={MEMORY:0,LOCAL:1,SESSION:2},g=function(){function e(){u()(this,e)}return l()(e,null,[{key:"clear",value:function(){for(var t in e)e.hasOwnProperty(t)&&e.removeItem(t)}},{key:"getItem",value:function(t){return e.hasOwnProperty(t)?e[t]:null}},{key:"setItem",value:function(t,r){e[t]=r}},{key:"removeItem",value:function(t){e[t]=null,delete e[t]}},{key:"size",get:function(){var t=0;for(var r in e)e.hasOwnProperty(r)&&t++;return t}}]),e}(),b=r("q+NK"),k=r.n(b),x=(f={},y()(f,m.LOCAL,localStorage),y()(f,m.SESSION,sessionStorage),y()(f,m.MEMORY,g),f),w=Symbol("expire"),O=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:m.MEMORY,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:36e5;u()(this,e),this.storage=x[r],this.storageType=r,this.namespace=t,this.storedKeys=this.getStoredKeys(),this.expire=n}return l()(e,[{key:"getStoredKeys",value:function(){var e=[];for(var t in this.storage)this.storage.hasOwnProperty(t)&&0===t.indexOf(this.namespace+"_")&&e.push(t);return e}},{key:"getNamespaceKey",value:function(e){return this.storedKeys.indexOf(e)>-1?e:this.namespace+"_"+k()(e)}},{key:"setItem",value:function(e,t){var r={t:Date.now(),v:t};this.storageType!==m.LOCAL&&this.storageType!==m.SESSION||(r=JSON.stringify(r));var n=this.getNamespaceKey(e);this.storage.setItem(n,r),this.storedKeys.push(n)}},{key:"getItem",value:function(e){var t=this.storage.getItem(this.getNamespaceKey(e));return this.storageType!==m.LOCAL&&this.storageType!==m.SESSION||(t=JSON.parse(t)),null!==t&&t.hasOwnProperty("t")?this.isExpired(e)?(this.removeItem(e),null):t.v:t}},{key:"getCollection",value:function(){var e={};this.storedKeys=this.getStoredKeys();for(var t=0;t<this.storedKeys.length;t++)this.isExpired(this.storedKeys[t])||(e[this.storedKeys[t]]=this.getItem(this.storedKeys[t]));return e}},{key:"removeItem",value:function(e){var t=this.getNamespaceKey(e),r=this.storedKeys.indexOf(t);r>-1&&(this.storage.removeItem(t),this.storedKeys.splice(r,1))}},{key:"clear",value:function(){for(var e=0;e<this.storedKeys.length;e++)this.storage.removeItem(this.storedKeys[e]);this.storedKeys=[]}},{key:"isExpired",value:function(e){if("number"!=typeof this.expire||this.expire<=0)return!1;var t=this.getNamespaceKey(e),r=this.storage.getItem(t);return this.storageType!==m.LOCAL&&this.storageType!==m.SESSION||(r=JSON.parse(r)),r.t<Date.now()-this.expire}},{key:"removeExpired",value:function(){for(var e=0;e<this.storedKeys.length;e++)this.isExpired(this.storedKeys[e])&&this.removeItem(this.storedKeys[e])}},{key:"destruct",value:function(){clearInterval(this.interval),this.namespace=null,this.storage=null,this.storageType=null,this.expire=null,this.storedKeys=null,this.interval=null}},{key:"expire",get:function(){return this[w]},set:function(e){var t=this;this[w]=e,null!==this.interval&&clearInterval(this.interval),e>0&&e<2147483647&&(this.interval=setInterval((function(){return t.removeExpired()}),e))}},{key:"size",get:function(){var e=this.getCollection();return Object.keys(e).length}}]),e}(),M=function(){function e(){u()(this,e),this.formatterManager=new p,this.cacheManagers={},this.addCacheManager("default")}return l()(e,null,[{key:"DEFAULT_CACHE_NAMESPACE",get:function(){return"ApiRequest"}}]),l()(e,[{key:"addFormatter",value:function(e,t){this.formatterManager.addFormatter(e,t)}},{key:"addCacheManager",value:function(e,t){if(this.cacheManagers.hasOwnProperty(e))throw new Error("ApiRequest: Cache namespace ".concat(e," already exists"));this.cacheManagers[e]=new O(e,m.MEMORY,t)}},{key:"getCacheManager",value:function(e,t){try{void 0===e?this.addCacheManager(this[this.DEFAULT_CACHE_NAMESPACE],t):this.addCacheManager(e,t)}catch(e){}return this.cacheManagers[e]}},{key:"updateCacheInterval",value:function(e,t){this.getCacheManager(e,t).expire=t}},{key:"purgeCache",value:function(e){if(void 0===e)for(var t in this.cacheManagers)this.cacheManagers.hasOwnProperty(t)&&this.cacheManagers[t].clear();else this.cacheManagers[e].clear()}},{key:"request",value:function(e,t,r){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"default",i=arguments.length>5?arguments[5]:void 0,s=this.formatterManager.getFormatter(r),o=e+JSON.stringify(t),u=this.getCacheManager(a,i),c=u.getItem(o);if(n&&c)return c;var l=fetch(e,s.pack(t)).then(s.unpack);return u.setItem(o,l),l}},{key:"clearCache",value:function(e){this.getCacheManager(e).clear()}}]),e}(),C=function(){function e(t){var r=this;u()(this,e),this.environment=t,this.ready=new Promise((function(e){r.resolve=e})),this.middlewareInstance=new d("before","after"),this.apiRequestInstance=new M}var t,r;return l()(e,[{key:"init",value:(r=s()(a.a.mark((function e(t){var r,n,i,s,o,u,c=this,l=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t.apis,n=t.developmentConfig,i=t.stageConfig,s=l.length>1&&void 0!==l[1]&&l[1],this.apis=r,o=function(e){if(!Object.hasOwnProperty.call(c.apis,e))return"continue";var t=c.apis[e];c.apiRequestInstance.addFormatter(e,{pack:function(){return t.requestOptions||{}},unpack:function(e){return e.json()}})},e.t0=a.a.keys(this.apis);case 5:if((e.t1=e.t0()).done){e.next=12;break}if(u=e.t1.value,"continue"!==o(u)){e.next=10;break}return e.abrupt("continue",5);case 10:e.next=5;break;case 12:if(!1!==s||this.environment===h.PROD){e.next=17;break}return e.next=15,this.updateApis(n,i);case 15:case 17:return this.resolve(),e.abrupt("return",this.ready);case 19:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"before",value:function(e){this.middlewareInstance.use(e,"before")}},{key:"after",value:function(e){this.middlewareInstance.use(e,"after")}},{key:"get",value:(t=s()(a.a.mark((function t(r){var n,i,s,o,u,c,l,h=this,f=arguments;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=!(f.length>1&&void 0!==f[1])||f[1],t.next=3,this.ready;case 3:if(i=this.apis[r],s=n,void 0!==i){t.next=7;break}throw new TypeError("".concat(r," is not a valid api namespace."));case 7:return(!s||"function"==typeof i.invalidateCache&&i.invalidateCache.call(null))&&(this.apiRequestInstance.clearCache(e.NAMESPACE),s=!1),o=this.apiRequestInstance.getCacheManager(e.NAMESPACE),u=o.getItem(i.url+JSON.stringify("")),c={namespace:r,cached:null!==u},t.next=13,this.middlewareInstance.iterateMiddleware(c,"before");case 13:return l=null,l=null!==u?u:this.apiRequestInstance.request(i.url,"",r,s,e.NAMESPACE),t.abrupt("return",l.then((function(e){return h.middlewareInstance.iterateMiddleware(c,"after",e)})));case 16:case"end":return t.stop()}}),t,this)}))),function(e){return t.apply(this,arguments)})},{key:"updateApis",value:function(e,t){var r=this,n=e;return this.environment===h.STAGE&&(n=t),n().then((function(e){for(var t in r.apis)if(Object.hasOwnProperty.call(r.apis,t)){var n=r.apis[t],a={};"function"==typeof n[r.environment+"Variables"]&&(a=n[r.environment+"Variables"].call(null)),n.url=e.default(t,a)}}))}}],[{key:"NAMESPACE",get:function(){return"resource-enumerate"}}]),e}();r.d(t,"ResourceEnumerate",(function(){return C}))},RNGJ:function(e,r){e.exports=t},dvlR:function(e,t){e.exports=r},iTvO:function(e,t){e.exports=n},lSNA:function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},"q+NK":function(e,t){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={exports:{},id:n,loaded:!1};return e[n].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}return r.m=e,r.c=t,r.p="",r(0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){var n=r(2);e.exports=n},function(e,t){var r;r=function(){for(var e=[],t=0;t<64;)e[t]=0|4294967296*Math.abs(Math.sin(++t));return function(t){for(var r,n,a,i,s=[],o=unescape(encodeURI(t)),u=o.length,c=[r=1732584193,n=-271733879,~r,~n],l=0;l<=u;)s[l>>2]|=(o.charCodeAt(l)||128)<<l++%4*8;for(s[t=16*(u+8>>6)+14]=8*u,l=0;l<t;l+=16){for(u=c,i=0;i<64;)u=[a=u[3],(r=0|u[1])+((a=u[0]+[r&(n=u[2])|~r&a,a&r|~a&n,r^n^a,n^(r|~a)][u=i>>4]+(e[i]+(0|s[[i,5*i+1,3*i+5,7*i][u]%16+l])))<<(u=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*u+i++%4])|a>>>32-u),r,n];for(i=4;i;)c[--i]=c[i]+u[i]}for(t="";i<32;)t+=(c[i>>3]>>4*(1^7&i++)&15).toString(16);return t}}(),e.exports=r}])}})}));
//# sourceMappingURL=index.js.map
{
"name": "@aofl/resource-enumerate",
"version": "3.0.0-beta.6",
"version": "3.0.0-beta.8",
"description": "Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint",
"main": "dist/index.js",
"module": "index.js",
"scripts": {

@@ -29,7 +30,7 @@ "test": "echo \"Error: no test specified\" && exit 1",

"devDependencies": {
"@aofl/api-request": "^3.0.0-beta.6",
"@aofl/cache-manager": "^3.0.0-beta.6",
"@aofl/api-request": "^3.0.0-beta.8",
"@aofl/cache-manager": "^3.0.0-beta.8",
"@aofl/cli": "^3.0.0-beta.6",
"@aofl/middleware": "^3.0.0-beta.6",
"@aofl/server-environment": "^3.0.0-beta.6",
"@aofl/middleware": "^3.0.0-beta.8",
"@aofl/server-environment": "^3.0.0-beta.8",
"cross-env": "^6.0.3"

@@ -43,3 +44,3 @@ },

},
"gitHead": "23e8e9dd00e515c9305baf320436e43f51d7edd3"
"gitHead": "31f766f3cf621147bfa1530b863757cb08e5fc10"
}

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