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

@aofl/cache-manager

Package Overview
Dependencies
Maintainers
2
Versions
145
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aofl/cache-manager - npm Package Compare versions

Comparing version 4.0.0-alpha.21 to 4.0.0-alpha.22

.aofl.cjs

2

dist/index.js

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

!function(){"use strict";var e={n:function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,{a:r}),r},d:function(t,r){for(var s in r)e.o(r,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:r[s]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{CacheManager:function(){return f},MemoryStorage:function(){return h},cacheTypeEnumerate:function(){return l}});var r,s=require("@babel/runtime/helpers/classCallCheck"),n=e.n(s),i=require("@babel/runtime/helpers/createClass"),o=e.n(i),a=require("@babel/runtime/helpers/defineProperty"),u=e.n(a),l={MEMORY:0,LOCAL:1,SESSION:2},h=function(){function e(){n()(this,e)}return o()(e,null,[{key:"clear",value:function(){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&e.removeItem(t)}},{key:"size",get:function(){var t=0;for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}},{key:"getItem",value:function(t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:null}},{key:"setItem",value:function(t,r){e[t]=r}},{key:"removeItem",value:function(t){e[t]=null,delete e[t]}}]),e}(),c=require("tiny-js-md5"),y=e.n(c),p=(r={},u()(r,l.LOCAL,localStorage),u()(r,l.SESSION,sessionStorage),u()(r,l.MEMORY,h),r),v=Symbol("expire"),f=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.MEMORY,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:36e5;n()(this,e),this.storage=p[r],this.storageType=r,this.namespace=t,this.storedKeys=this.getStoredKeys(),this.expire=s}return o()(e,[{key:"expire",get:function(){return this[v]},set:function(e){var t=this;this[v]=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}},{key:"getStoredKeys",value:function(){var e=[];for(var t in this.storage)Object.hasOwnProperty.call(this.storage,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+"_"+y()(e)}},{key:"setItem",value:function(e,t){var r={t:Date.now(),v:t};this.storageType!==l.LOCAL&&this.storageType!==l.SESSION||(r=JSON.stringify(r));var s=this.getNamespaceKey(e);this.storage.setItem(s,r),this.storedKeys.push(s)}},{key:"getItem",value:function(e){var t=this.storage.getItem(this.getNamespaceKey(e));return this.storageType!==l.LOCAL&&this.storageType!==l.SESSION||(t=JSON.parse(t)),null!==t&&Object.hasOwnProperty.call(t,"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);if(this.storageType===l.LOCAL||this.storageType===l.SESSION)try{r=JSON.parse(r)}catch(e){}return null===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}}]),e}();module.exports=t}();
!function(){"use strict";var e,t,r={},i={};function s(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={exports:{}};return r[e](n,n.exports,s),n.exports}t=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},s.t=function(r,i){if(1&i&&(r=this(r)),8&i)return r;if("object"==typeof r&&r){if(4&i&&r.__esModule)return r;if(16&i&&"function"==typeof r.then)return r}var n=Object.create(null);s.r(n);var o={};e=e||[null,t({}),t([]),t(t)];for(var a=2&i&&r;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((function(e){o[e]=function(){return r[e]}}));return o.default=function(){return r},s.d(n,o),n},s.d=function(e,t){for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};s.r(n),s.d(n,{CacheManager:function(){return v},CacheType:function(){return a},MemoryStorage:function(){return c}});var o,a,u=require("@babel/runtime/helpers/classCallCheck"),h=require("@babel/runtime/helpers/createClass"),l=require("@babel/runtime/helpers/defineProperty"),c=function(){function e(){u(this,e)}return h(e,[{key:"length",get:function(){var e=0;for(var t in this)Object.prototype.hasOwnProperty.call(this,t)&&e++;return e}},{key:"key",value:function(e){var t=0;for(var r in this)if(Object.prototype.hasOwnProperty.call(this,r)){if(t===e)return r;t+=1}return null}},{key:"getItem",value:function(e){return Object.prototype.hasOwnProperty.call(this,e)?this[e]:null}},{key:"setItem",value:function(e,t){this[e]=t}},{key:"removeItem",value:function(e){this[e]=null,delete this[e]}},{key:"clear",value:function(){for(var e in this)Object.prototype.hasOwnProperty.call(this,e)&&this.removeItem(e)}}]),e}(),y=require("tiny-js-md5"),f=s.t(y,2);!function(e){e[e.MEMORY=0]="MEMORY",e[e.LOCAL=1]="LOCAL",e[e.SESSION=2]="SESSION"}(a||(a={}));var p=(l(o={},a.LOCAL,localStorage),l(o,a.SESSION,sessionStorage),l(o,a.MEMORY,new c),o),v=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.MEMORY,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:36e5;u(this,e),this.interval=null,this.expireTimeout=36e5,this.storage=p[r],this.storageType=r,this.namespace=t,this.storedKeys=this.getStoredKeys(),this.expire=i}return h(e,[{key:"expire",get:function(){return this.expireTimeout},set:function(e){var t=this;this.expireTimeout=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}},{key:"getStoredKeys",value:function(){var e=[];for(var t in this.storage)Object.hasOwnProperty.call(this.storage,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+"_"+f(e)}},{key:"setItem",value:function(e,t){var r={t:Date.now(),v:t},i=this.getNamespaceKey(e);if(this.storedKeys.push(i),this.storageType===a.LOCAL||this.storageType===a.SESSION){var s=JSON.stringify(r);this.storage.setItem(i,s)}else this.storage.setItem(i,r)}},{key:"getItem",value:function(e){var t=this.storage.getItem(this.getNamespaceKey(e));return this.storageType!==a.LOCAL&&this.storageType!==a.SESSION||(t=JSON.parse(t)),null!==t&&Object.hasOwnProperty.call(t,"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);if(this.storageType===a.LOCAL||this.storageType===a.SESSION)try{r=JSON.parse(r)}catch(e){}return null===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])}}]),e}();module.exports=n}();
//# sourceMappingURL=index.js.map
{
"name": "@aofl/cache-manager",
"version": "4.0.0-alpha.21",
"version": "4.0.0-alpha.22",
"description": "Provides a unified class for storing objects in Storage-like Objects",
"main": "index.js",
"browser": "dist/index.js",
"module": "index.js",
"typings": "types.d.ts",
"keywords": [

@@ -16,4 +12,20 @@ "aofljs",

],
"type": "module",
"main": "lib/index.js",
"browser": "dist/index.js",
"module": "lib/index.js",
"types": "lib/index.d.ts",
"exports": {
".": {
"default": "./lib/index.js"
}
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"clean": "rm -rf dist lib",
"test": "echo \"Error: no test specified\" && exit 1",
"tsc": "cross-env NODE_ENV=production tsc -p tsconfig.json",
"build-ci": "npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs",
"build": "npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs",
"build:dev": "npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs",
"prepublishOnly": "npm run build-ci"
},

@@ -31,7 +43,4 @@ "repository": {

"devDependencies": {
"@aofl/cli": "^4.0.0-alpha.21",
"cross-env": "^7.0.3",
"jsdoc": "^3.6.6",
"tiny-js-md5": "1.1.2",
"tsd-jsdoc": "^2.5.0"
"tiny-js-md5": "1.1.2"
},

@@ -38,0 +47,0 @@ "peerDependencies": {

@@ -5,4 +5,6 @@ # @aofl/cache-manager

[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_cache-manager.html)
#
[Api Documentation](https://ageoflearning.github.io/aofl/v4.x/api-docs/modules/_aofl_cache_manager.html)
## Examples

@@ -9,0 +11,0 @@ * [Basic Example](https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/cache-manager/examples/simple)

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