UNPKG

59.3 kBSource Map (JSON)View Raw
1{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///external \"@aws-amplify/core\"","webpack:///../../src/Utils/CacheUtils.ts","webpack:///../src/StorageCache.ts","webpack:///../src/BrowserStorageCache.ts","webpack:///../../src/Utils/CacheList.ts","webpack:///../src/InMemoryCache.ts","webpack:///../src/index.ts"],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE__0__","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","config"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,sBACR,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,oBAAqB,CAAC,qBAAsBJ,GACzB,iBAAZC,QACdA,QAA2B,kBAAID,EAAQG,QAAQ,sBAE/CJ,EAAwB,kBAAIC,EAAQD,EAAK,sBAR3C,CASGO,MAAM,SAASC,GAClB,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUT,QAGnC,IAAIC,EAASM,EAAiBE,GAAY,CACzCC,EAAGD,EACHE,GAAG,EACHX,QAAS,IAUV,OANAY,EAAQH,GAAUI,KAAKZ,EAAOD,QAASC,EAAQA,EAAOD,QAASQ,GAG/DP,EAAOU,GAAI,EAGJV,EAAOD,QA0Df,OArDAQ,EAAoBM,EAAIF,EAGxBJ,EAAoBO,EAAIR,EAGxBC,EAAoBQ,EAAI,SAAShB,EAASiB,EAAMC,GAC3CV,EAAoBW,EAAEnB,EAASiB,IAClCG,OAAOC,eAAerB,EAASiB,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEV,EAAoBgB,EAAI,S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,WAIM,OAHN,OAAI,GACK,KAAR,eAED,EAEG,OAAJ,MAQM,uBAAP,YACC,IAAM,EAAsB,sBADA,EAItB,EAAyB,iBAA/B,IACA,IAAI,GACH,mBAA8B,EAA9B,IAOO,EAAF,gBAAP,WACK,I,QAAK,EAAT,EAAgB,EAAI,KAApB,YAAsC,GAAtC,E,IACS,IAAU,gDAA2B,IAA7C,QAA6C,EAA7C,KAA6C,IAA7C,OAA+C,CAA1C,IAAM,EAAG,EAAT,MACM,KAAV,kB,mGAQI,uBAAP,WAEC,I,QADM,EAAN,GACS,EAAT,EAAgB,EAAI,KAApB,YAAsC,GAAtC,E,IACC,IAAkB,gDAA2B,IAA7C,QAA6C,EAA7C,KAA6C,IAA7C,OAA+C,CAA1C,IAAM,EAAG,EAAT,MACJ,OAAU,YAAc,sBAAxB,U,iGAIF,UAQM,4BAAP,WACC,OAAO,KAAP,gBAOM,2BAAP,YACC,OAAO,MAAP,IAEF,EAtUA,KCPA,YAEA","file":"aws-amplify-cache.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"@aws-amplify/core\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"aws_amplify_cache\", [\"@aws-amplify/core\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"aws_amplify_cache\"] = factory(require(\"@aws-amplify/core\"));\n\telse\n\t\troot[\"aws_amplify_cache\"] = factory(root[\"@aws-amplify/core\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE__0__) {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n","module.exports = __WEBPACK_EXTERNAL_MODULE__0__;","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nimport { StorageHelper } from '@aws-amplify/core';\n/**\n * Default cache config\n */\nexport var defaultConfig = {\n keyPrefix: 'aws-amplify-cache',\n capacityInBytes: 1048576,\n itemMaxSize: 210000,\n defaultTTL: 259200000,\n defaultPriority: 5,\n warningThreshold: 0.8,\n // the storage helper will check if localStorage exists,\n // if not, will use a in-memory object instead\n storage: new StorageHelper().getStorage(),\n};\n/**\n * return the byte size of the string\n * @param str\n */\nexport function getByteLength(str) {\n var ret = 0;\n ret = str.length;\n for (var i = str.length; i >= 0; i -= 1) {\n var charCode = str.charCodeAt(i);\n if (charCode > 0x7f && charCode <= 0x7ff) {\n ret += 1;\n }\n else if (charCode > 0x7ff && charCode <= 0xffff) {\n ret += 2;\n }\n // trail surrogate\n if (charCode >= 0xdc00 && charCode <= 0xdfff) {\n i -= 1;\n }\n }\n return ret;\n}\n/**\n * get current time\n */\nexport function getCurrTime() {\n var currTime = new Date();\n return currTime.getTime();\n}\n/**\n * check if passed value is an integer\n */\nexport function isInteger(value) {\n if (Number.isInteger) {\n return Number.isInteger(value);\n }\n return _isInteger(value);\n}\nfunction _isInteger(value) {\n return (typeof value === 'number' && isFinite(value) && Math.floor(value) === value);\n}\n/**\n * provide an object as the in-memory cache\n */\nvar store = {};\nvar CacheObject = /** @class */ (function () {\n function CacheObject() {\n }\n CacheObject.clear = function () {\n store = {};\n };\n CacheObject.getItem = function (key) {\n return store[key] || null;\n };\n CacheObject.setItem = function (key, value) {\n store[key] = value;\n };\n CacheObject.removeItem = function (key) {\n delete store[key];\n };\n return CacheObject;\n}());\nexport { CacheObject };\n//# sourceMappingURL=CacheUtils.js.map","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nimport { getCurrTime, getByteLength, defaultConfig, isInteger } from './Utils';\nimport { ConsoleLogger as Logger } from '@aws-amplify/core';\nvar logger = new Logger('StorageCache');\n/**\n * Initialization of the cache\n *\n */\nvar StorageCache = /** @class */ (function () {\n /**\n * Initialize the cache\n * @param config - the configuration of the cache\n */\n function StorageCache(config) {\n this.config = Object.assign({}, config);\n this.cacheCurSizeKey = this.config.keyPrefix + 'CurSize';\n this.checkConfig();\n }\n StorageCache.prototype.getModuleName = function () {\n return 'Cache';\n };\n StorageCache.prototype.checkConfig = function () {\n // check configuration\n if (!isInteger(this.config.capacityInBytes)) {\n logger.error('Invalid parameter: capacityInBytes. It should be an Integer. Setting back to default.');\n this.config.capacityInBytes = defaultConfig.capacityInBytes;\n }\n if (!isInteger(this.config.itemMaxSize)) {\n logger.error('Invalid parameter: itemMaxSize. It should be an Integer. Setting back to default.');\n this.config.itemMaxSize = defaultConfig.itemMaxSize;\n }\n if (!isInteger(this.config.defaultTTL)) {\n logger.error('Invalid parameter: defaultTTL. It should be an Integer. Setting back to default.');\n this.config.defaultTTL = defaultConfig.defaultTTL;\n }\n if (!isInteger(this.config.defaultPriority)) {\n logger.error('Invalid parameter: defaultPriority. It should be an Integer. Setting back to default.');\n this.config.defaultPriority = defaultConfig.defaultPriority;\n }\n if (this.config.itemMaxSize > this.config.capacityInBytes) {\n logger.error('Invalid parameter: itemMaxSize. It should be smaller than capacityInBytes. Setting back to default.');\n this.config.itemMaxSize = defaultConfig.itemMaxSize;\n }\n if (this.config.defaultPriority > 5 || this.config.defaultPriority < 1) {\n logger.error('Invalid parameter: defaultPriority. It should be between 1 and 5. Setting back to default.');\n this.config.defaultPriority = defaultConfig.defaultPriority;\n }\n if (Number(this.config.warningThreshold) > 1 ||\n Number(this.config.warningThreshold) < 0) {\n logger.error('Invalid parameter: warningThreshold. It should be between 0 and 1. Setting back to default.');\n this.config.warningThreshold = defaultConfig.warningThreshold;\n }\n // set 5MB limit\n var cacheLimit = 5 * 1024 * 1024;\n if (this.config.capacityInBytes > cacheLimit) {\n logger.error('Cache Capacity should be less than 5MB. Setting back to default. Setting back to default.');\n this.config.capacityInBytes = defaultConfig.capacityInBytes;\n }\n };\n /**\n * produce a JSON object with meta-data and data value\n * @param value - the value of the item\n * @param options - optional, the specified meta-data\n *\n * @return - the item which has the meta-data and the value\n */\n StorageCache.prototype.fillCacheItem = function (key, value, options) {\n var ret = {\n key: key,\n data: value,\n timestamp: getCurrTime(),\n visitedTime: getCurrTime(),\n priority: options.priority,\n expires: options.expires,\n type: typeof value,\n byteSize: 0,\n };\n ret.byteSize = getByteLength(JSON.stringify(ret));\n // for accurate size\n ret.byteSize = getByteLength(JSON.stringify(ret));\n return ret;\n };\n /**\n * set cache with customized configuration\n * @param config - customized configuration\n *\n * @return - the current configuration\n */\n StorageCache.prototype.configure = function (config) {\n if (!config) {\n return this.config;\n }\n if (config.keyPrefix) {\n logger.warn(\"Don't try to configure keyPrefix!\");\n }\n this.config = Object.assign({}, this.config, config, config.Cache);\n this.checkConfig();\n return this.config;\n };\n return StorageCache;\n}());\nexport { StorageCache };\n/**\n * @deprecated use named import\n */\nexport default StorageCache;\n//# sourceMappingURL=StorageCache.js.map","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nimport { defaultConfig, getCurrTime } from './Utils';\nimport { StorageCache } from './StorageCache';\nimport { ConsoleLogger as Logger } from '@aws-amplify/core';\nvar logger = new Logger('Cache');\n/**\n * Customized storage based on the SessionStorage or LocalStorage with LRU implemented\n */\nvar BrowserStorageCacheClass = /** @class */ (function (_super) {\n __extends(BrowserStorageCacheClass, _super);\n /**\n * initialize the cache\n * @param config - the configuration of the cache\n */\n function BrowserStorageCacheClass(config) {\n var _this = this;\n var cacheConfig = config\n ? Object.assign({}, defaultConfig, config)\n : defaultConfig;\n _this = _super.call(this, cacheConfig) || this;\n _this.config.storage = cacheConfig.storage;\n _this.getItem = _this.getItem.bind(_this);\n _this.setItem = _this.setItem.bind(_this);\n _this.removeItem = _this.removeItem.bind(_this);\n return _this;\n }\n /**\n * decrease current size of the cache\n *\n * @private\n * @param amount - the amount of the cache size which needs to be decreased\n */\n BrowserStorageCacheClass.prototype._decreaseCurSizeInBytes = function (amount) {\n var curSize = this.getCacheCurSize();\n this.config.storage.setItem(this.cacheCurSizeKey, (curSize - amount).toString());\n };\n /**\n * increase current size of the cache\n *\n * @private\n * @param amount - the amount of the cache szie which need to be increased\n */\n BrowserStorageCacheClass.prototype._increaseCurSizeInBytes = function (amount) {\n var curSize = this.getCacheCurSize();\n this.config.storage.setItem(this.cacheCurSizeKey, (curSize + amount).toString());\n };\n /**\n * update the visited time if item has been visited\n *\n * @private\n * @param item - the item which need to be refreshed\n * @param prefixedKey - the key of the item\n *\n * @return the refreshed item\n */\n BrowserStorageCacheClass.prototype._refreshItem = function (item, prefixedKey) {\n item.visitedTime = getCurrTime();\n this.config.storage.setItem(prefixedKey, JSON.stringify(item));\n return item;\n };\n /**\n * check wether item is expired\n *\n * @private\n * @param key - the key of the item\n *\n * @return true if the item is expired.\n */\n BrowserStorageCacheClass.prototype._isExpired = function (key) {\n var text = this.config.storage.getItem(key);\n var item = JSON.parse(text);\n if (getCurrTime() >= item.expires) {\n return true;\n }\n return false;\n };\n /**\n * delete item from cache\n *\n * @private\n * @param prefixedKey - the key of the item\n * @param size - optional, the byte size of the item\n */\n BrowserStorageCacheClass.prototype._removeItem = function (prefixedKey, size) {\n var itemSize = size\n ? size\n : JSON.parse(this.config.storage.getItem(prefixedKey)).byteSize;\n this._decreaseCurSizeInBytes(itemSize);\n // remove the cache item\n this.config.storage.removeItem(prefixedKey);\n };\n /**\n * put item into cache\n *\n * @private\n * @param prefixedKey - the key of the item\n * @param itemData - the value of the item\n * @param itemSizeInBytes - the byte size of the item\n */\n BrowserStorageCacheClass.prototype._setItem = function (prefixedKey, item) {\n // update the cache size\n this._increaseCurSizeInBytes(item.byteSize);\n try {\n this.config.storage.setItem(prefixedKey, JSON.stringify(item));\n }\n catch (setItemErr) {\n // if failed, we need to rollback the cache size\n this._decreaseCurSizeInBytes(item.byteSize);\n logger.error(\"Failed to set item \" + setItemErr);\n }\n };\n /**\n * total space needed when poping out items\n *\n * @private\n * @param itemSize\n *\n * @return total space needed\n */\n BrowserStorageCacheClass.prototype._sizeToPop = function (itemSize) {\n var spaceItemNeed = this.getCacheCurSize() + itemSize - this.config.capacityInBytes;\n var cacheThresholdSpace = (1 - this.config.warningThreshold) * this.config.capacityInBytes;\n return spaceItemNeed > cacheThresholdSpace\n ? spaceItemNeed\n : cacheThresholdSpace;\n };\n /**\n * see whether cache is full\n *\n * @private\n * @param itemSize\n *\n * @return true if cache is full\n */\n BrowserStorageCacheClass.prototype._isCacheFull = function (itemSize) {\n return itemSize + this.getCacheCurSize() > this.config.capacityInBytes;\n };\n /**\n * scan the storage and find out all the keys owned by this cache\n * also clean the expired keys while scanning\n *\n * @private\n *\n * @return array of keys\n */\n BrowserStorageCacheClass.prototype._findValidKeys = function () {\n var keys = [];\n var keyInCache = [];\n // get all keys in Storage\n for (var i = 0; i < this.config.storage.length; i += 1) {\n keyInCache.push(this.config.storage.key(i));\n }\n // find those items which belong to our cache and also clean those expired items\n for (var i = 0; i < keyInCache.length; i += 1) {\n var key = keyInCache[i];\n if (key.indexOf(this.config.keyPrefix) === 0 &&\n key !== this.cacheCurSizeKey) {\n if (this._isExpired(key)) {\n this._removeItem(key);\n }\n else {\n keys.push(key);\n }\n }\n }\n return keys;\n };\n /**\n * get all the items we have, sort them by their priority,\n * if priority is same, sort them by their last visited time\n * pop out items from the low priority (5 is the lowest)\n *\n * @private\n * @param keys - all the keys in this cache\n * @param sizeToPop - the total size of the items which needed to be poped out\n */\n BrowserStorageCacheClass.prototype._popOutItems = function (keys, sizeToPop) {\n var items = [];\n var remainedSize = sizeToPop;\n // get the items from Storage\n for (var i = 0; i < keys.length; i += 1) {\n var val = this.config.storage.getItem(keys[i]);\n if (val != null) {\n var item = JSON.parse(val);\n items.push(item);\n }\n }\n // first compare priority\n // then compare visited time\n items.sort(function (a, b) {\n if (a.priority > b.priority) {\n return -1;\n }\n else if (a.priority < b.priority) {\n return 1;\n }\n else {\n if (a.visitedTime < b.visitedTime) {\n return -1;\n }\n else\n return 1;\n }\n });\n for (var i = 0; i < items.length; i += 1) {\n // pop out items until we have enough room for new item\n this._removeItem(items[i].key, items[i].byteSize);\n remainedSize -= items[i].byteSize;\n if (remainedSize <= 0) {\n return;\n }\n }\n };\n /**\n * Set item into cache. You can put number, string, boolean or object.\n * The cache will first check whether has the same key.\n * If it has, it will delete the old item and then put the new item in\n * The cache will pop out items if it is full\n * You can specify the cache item options. The cache will abort and output a warning:\n * If the key is invalid\n * If the size of the item exceeds itemMaxSize.\n * If the value is undefined\n * If incorrect cache item configuration\n * If error happened with browser storage\n *\n * @param key - the key of the item\n * @param value - the value of the item\n * @param {Object} [options] - optional, the specified meta-data\n */\n BrowserStorageCacheClass.prototype.setItem = function (key, value, options) {\n logger.log(\"Set item: key is \" + key + \", value is \" + value + \" with options: \" + options);\n var prefixedKey = this.config.keyPrefix + key;\n // invalid keys\n if (prefixedKey === this.config.keyPrefix ||\n prefixedKey === this.cacheCurSizeKey) {\n logger.warn(\"Invalid key: should not be empty or 'CurSize'\");\n return;\n }\n if (typeof value === 'undefined') {\n logger.warn(\"The value of item should not be undefined!\");\n return;\n }\n var cacheItemOptions = {\n priority: options && options.priority !== undefined\n ? options.priority\n : this.config.defaultPriority,\n expires: options && options.expires !== undefined\n ? options.expires\n : this.config.defaultTTL + getCurrTime(),\n };\n if (cacheItemOptions.priority < 1 || cacheItemOptions.priority > 5) {\n logger.warn(\"Invalid parameter: priority due to out or range. It should be within 1 and 5.\");\n return;\n }\n var item = this.fillCacheItem(prefixedKey, value, cacheItemOptions);\n // check wether this item is too big;\n if (item.byteSize > this.config.itemMaxSize) {\n logger.warn(\"Item with key: \" + key + \" you are trying to put into is too big!\");\n return;\n }\n try {\n // first look into the storage, if it exists, delete it.\n var val = this.config.storage.getItem(prefixedKey);\n if (val) {\n this._removeItem(prefixedKey, JSON.parse(val).byteSize);\n }\n // check whether the cache is full\n if (this._isCacheFull(item.byteSize)) {\n var validKeys = this._findValidKeys();\n // check again and then pop out items\n if (this._isCacheFull(item.byteSize)) {\n var sizeToPop = this._sizeToPop(item.byteSize);\n this._popOutItems(validKeys, sizeToPop);\n }\n }\n // put item in the cache\n // may failed due to storage full\n this._setItem(prefixedKey, item);\n }\n catch (e) {\n logger.warn(\"setItem failed! \" + e);\n }\n };\n /**\n * Get item from cache. It will return null if item doesn’t exist or it has been expired.\n * If you specified callback function in the options,\n * then the function will be executed if no such item in the cache\n * and finally put the return value into cache.\n * Please make sure the callback function will return the value you want to put into the cache.\n * The cache will abort output a warning:\n * If the key is invalid\n * If error happened with browser storage\n *\n * @param key - the key of the item\n * @param {Object} [options] - the options of callback function\n *\n * @return - return the value of the item\n */\n BrowserStorageCacheClass.prototype.getItem = function (key, options) {\n logger.log(\"Get item: key is \" + key + \" with options \" + options);\n var ret = null;\n var prefixedKey = this.config.keyPrefix + key;\n if (prefixedKey === this.config.keyPrefix ||\n prefixedKey === this.cacheCurSizeKey) {\n logger.warn(\"Invalid key: should not be empty or 'CurSize'\");\n return null;\n }\n try {\n ret = this.config.storage.getItem(prefixedKey);\n if (ret != null) {\n if (this._isExpired(prefixedKey)) {\n // if expired, remove that item and return null\n this._removeItem(prefixedKey, JSON.parse(ret).byteSize);\n ret = null;\n }\n else {\n // if not expired, great, return the value and refresh it\n var item = JSON.parse(ret);\n item = this._refreshItem(item, prefixedKey);\n return item.data;\n }\n }\n if (options && options.callback !== undefined) {\n var val = options.callback();\n if (val !== null) {\n this.setItem(key, val, options);\n }\n return val;\n }\n return null;\n }\n catch (e) {\n logger.warn(\"getItem failed! \" + e);\n return null;\n }\n };\n /**\n * remove item from the cache\n * The cache will abort output a warning:\n * If error happened with browser storage\n * @param key - the key of the item\n */\n BrowserStorageCacheClass.prototype.removeItem = function (key) {\n logger.log(\"Remove item: key is \" + key);\n var prefixedKey = this.config.keyPrefix + key;\n if (prefixedKey === this.config.keyPrefix ||\n prefixedKey === this.cacheCurSizeKey) {\n return;\n }\n try {\n var val = this.config.storage.getItem(prefixedKey);\n if (val) {\n this._removeItem(prefixedKey, JSON.parse(val).byteSize);\n }\n }\n catch (e) {\n logger.warn(\"removeItem failed! \" + e);\n }\n };\n /**\n * clear the entire cache\n * The cache will abort output a warning:\n * If error happened with browser storage\n */\n BrowserStorageCacheClass.prototype.clear = function () {\n logger.log(\"Clear Cache\");\n var keysToRemove = [];\n for (var i = 0; i < this.config.storage.length; i += 1) {\n var key = this.config.storage.key(i);\n if (key.indexOf(this.config.keyPrefix) === 0) {\n keysToRemove.push(key);\n }\n }\n try {\n for (var i = 0; i < keysToRemove.length; i += 1) {\n this.config.storage.removeItem(keysToRemove[i]);\n }\n }\n catch (e) {\n logger.warn(\"clear failed! \" + e);\n }\n };\n /**\n * Return all the keys in the cache.\n *\n * @return - all keys in the cache\n */\n BrowserStorageCacheClass.prototype.getAllKeys = function () {\n var keys = [];\n for (var i = 0; i < this.config.storage.length; i += 1) {\n var key = this.config.storage.key(i);\n if (key.indexOf(this.config.keyPrefix) === 0 &&\n key !== this.cacheCurSizeKey) {\n keys.push(key.substring(this.config.keyPrefix.length));\n }\n }\n return keys;\n };\n /**\n * return the current size of the cache\n *\n * @return - current size of the cache\n */\n BrowserStorageCacheClass.prototype.getCacheCurSize = function () {\n var ret = this.config.storage.getItem(this.cacheCurSizeKey);\n if (!ret) {\n this.config.storage.setItem(this.cacheCurSizeKey, '0');\n ret = '0';\n }\n return Number(ret);\n };\n /**\n * Return a new instance of cache with customized configuration.\n * @param config - the customized configuration\n *\n * @return - new instance of Cache\n */\n BrowserStorageCacheClass.prototype.createInstance = function (config) {\n if (!config.keyPrefix || config.keyPrefix === defaultConfig.keyPrefix) {\n logger.error('invalid keyPrefix, setting keyPrefix with timeStamp');\n config.keyPrefix = getCurrTime.toString();\n }\n return new BrowserStorageCacheClass(config);\n };\n return BrowserStorageCacheClass;\n}(StorageCache));\nexport { BrowserStorageCacheClass };\nexport var BrowserStorageCache = new BrowserStorageCacheClass();\n/**\n * @deprecated use named import\n */\nexport default BrowserStorageCache;\n//# sourceMappingURL=BrowserStorageCache.js.map","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nvar __values = (this && this.__values) || function(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n};\nvar DoubleLinkedNode = /** @class */ (function () {\n function DoubleLinkedNode(keyVal) {\n this.key = keyVal ? keyVal : '';\n this.prevNode = null;\n this.nextNode = null;\n }\n return DoubleLinkedNode;\n}());\n/**\n * double linked list plus a hash table inside\n * each key in the cache stored as a node in the list\n * recently visited node will be rotated to the head\n * so the Last Recently Visited node will be at the tail\n *\n * @member head - dummy head of the linked list\n * @member tail - dummy tail of the linked list\n * @member hashtable - the hashtable which maps cache key to list node\n * @member length - length of the list\n */\nvar CacheList = /** @class */ (function () {\n /**\n * initialization\n */\n function CacheList() {\n this.head = new DoubleLinkedNode();\n this.tail = new DoubleLinkedNode();\n this.hashtable = {};\n this.length = 0;\n this.head.nextNode = this.tail;\n this.tail.prevNode = this.head;\n }\n /**\n * insert node to the head of the list\n *\n * @param node\n */\n CacheList.prototype.insertNodeToHead = function (node) {\n var tmp = this.head.nextNode;\n this.head.nextNode = node;\n node.nextNode = tmp;\n node.prevNode = this.head;\n tmp.prevNode = node;\n this.length = this.length + 1;\n };\n /**\n * remove node\n *\n * @param node\n */\n CacheList.prototype.removeNode = function (node) {\n node.prevNode.nextNode = node.nextNode;\n node.nextNode.prevNode = node.prevNode;\n node.prevNode = null;\n node.nextNode = null;\n this.length = this.length - 1;\n };\n /**\n * @return true if list is empty\n */\n CacheList.prototype.isEmpty = function () {\n return this.length === 0;\n };\n /**\n * refresh node so it is rotated to the head\n *\n * @param key - key of the node\n */\n CacheList.prototype.refresh = function (key) {\n var node = this.hashtable[key];\n this.removeNode(node);\n this.insertNodeToHead(node);\n };\n /**\n * insert new node to the head and add it in the hashtable\n *\n * @param key - the key of the node\n */\n CacheList.prototype.insertItem = function (key) {\n var node = new DoubleLinkedNode(key);\n this.hashtable[key] = node;\n this.insertNodeToHead(node);\n };\n /**\n * @return the LAST Recently Visited key\n */\n CacheList.prototype.getLastItem = function () {\n return this.tail.prevNode.key;\n };\n /**\n * remove the cache key from the list and hashtable\n * @param key - the key of the node\n */\n CacheList.prototype.removeItem = function (key) {\n var removedItem = this.hashtable[key];\n this.removeNode(removedItem);\n delete this.hashtable[key];\n };\n /**\n * @return length of the list\n */\n CacheList.prototype.getSize = function () {\n return this.length;\n };\n /**\n * @return true if the key is in the hashtable\n * @param key\n */\n CacheList.prototype.containsKey = function (key) {\n return key in this.hashtable;\n };\n /**\n * clean up the list and hashtable\n */\n CacheList.prototype.clearList = function () {\n var e_1, _a;\n try {\n for (var _b = __values(Object.keys(this.hashtable)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var key = _c.value;\n if (this.hashtable.hasOwnProperty(key)) {\n delete this.hashtable[key];\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n this.head.nextNode = this.tail;\n this.tail.prevNode = this.head;\n this.length = 0;\n };\n /**\n * @return all keys in the hashtable\n */\n CacheList.prototype.getKeys = function () {\n return Object.keys(this.hashtable);\n };\n /**\n * mainly for test\n *\n * @param key\n * @return true if key is the head node\n */\n CacheList.prototype.isHeadNode = function (key) {\n var node = this.hashtable[key];\n return node.prevNode === this.head;\n };\n /**\n * mainly for test\n *\n * @param key\n * @return true if key is the tail node\n */\n CacheList.prototype.isTailNode = function (key) {\n var node = this.hashtable[key];\n return node.nextNode === this.tail;\n };\n return CacheList;\n}());\nexport default CacheList;\n//# sourceMappingURL=CacheList.js.map","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __values = (this && this.__values) || function(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n};\nimport { CacheList, defaultConfig, getCurrTime, CacheObject } from './Utils';\nimport { StorageCache } from './StorageCache';\nimport { ConsoleLogger as Logger } from '@aws-amplify/core';\nvar logger = new Logger('InMemoryCache');\n/**\n * Customized in-memory cache with LRU implemented\n * @member cacheObj - object which store items\n * @member cacheList - list of keys in the cache with LRU\n * @member curSizeInBytes - current size of the cache\n * @member maxPriority - max of the priority\n * @member cacheSizeLimit - the limit of cache size\n */\nvar InMemoryCacheClass = /** @class */ (function (_super) {\n __extends(InMemoryCacheClass, _super);\n /**\n * initialize the cache\n *\n * @param config - the configuration of the cache\n */\n function InMemoryCacheClass(config) {\n var _this = this;\n var cacheConfig = config\n ? Object.assign({}, defaultConfig, config)\n : defaultConfig;\n _this = _super.call(this, cacheConfig) || this;\n logger.debug('now we start!');\n _this.cacheList = [];\n _this.curSizeInBytes = 0;\n _this.maxPriority = 5;\n _this.getItem = _this.getItem.bind(_this);\n _this.setItem = _this.setItem.bind(_this);\n _this.removeItem = _this.removeItem.bind(_this);\n // initialize list for every priority\n for (var i = 0; i < _this.maxPriority; i += 1) {\n _this.cacheList[i] = new CacheList();\n }\n return _this;\n }\n /**\n * decrease current size of the cache\n *\n * @param amount - the amount of the cache size which needs to be decreased\n */\n InMemoryCacheClass.prototype._decreaseCurSizeInBytes = function (amount) {\n this.curSizeInBytes -= amount;\n };\n /**\n * increase current size of the cache\n *\n * @param amount - the amount of the cache szie which need to be increased\n */\n InMemoryCacheClass.prototype._increaseCurSizeInBytes = function (amount) {\n this.curSizeInBytes += amount;\n };\n /**\n * check whether item is expired\n *\n * @param key - the key of the item\n *\n * @return true if the item is expired.\n */\n InMemoryCacheClass.prototype._isExpired = function (key) {\n var text = CacheObject.getItem(key);\n var item = JSON.parse(text);\n if (getCurrTime() >= item.expires) {\n return true;\n }\n return false;\n };\n /**\n * delete item from cache\n *\n * @param prefixedKey - the key of the item\n * @param listIdx - indicates which cache list the key belongs to\n */\n InMemoryCacheClass.prototype._removeItem = function (prefixedKey, listIdx) {\n // delete the key from the list\n this.cacheList[listIdx].removeItem(prefixedKey);\n // decrease the current size of the cache\n this._decreaseCurSizeInBytes(JSON.parse(CacheObject.getItem(prefixedKey)).byteSize);\n // finally remove the item from memory\n CacheObject.removeItem(prefixedKey);\n };\n /**\n * put item into cache\n *\n * @param prefixedKey - the key of the item\n * @param itemData - the value of the item\n * @param itemSizeInBytes - the byte size of the item\n * @param listIdx - indicates which cache list the key belongs to\n */\n InMemoryCacheClass.prototype._setItem = function (prefixedKey, item, listIdx) {\n // insert the key into the list\n this.cacheList[listIdx].insertItem(prefixedKey);\n // increase the current size of the cache\n this._increaseCurSizeInBytes(item.byteSize);\n // finally add the item into memory\n CacheObject.setItem(prefixedKey, JSON.stringify(item));\n };\n /**\n * see whether cache is full\n *\n * @param itemSize\n *\n * @return true if cache is full\n */\n InMemoryCacheClass.prototype._isCacheFull = function (itemSize) {\n return this.curSizeInBytes + itemSize > this.config.capacityInBytes;\n };\n /**\n * check whether the cache contains the key\n *\n * @param key\n */\n InMemoryCacheClass.prototype.containsKey = function (key) {\n var prefixedKey = this.config.keyPrefix + key;\n for (var i = 0; i < this.maxPriority; i += 1) {\n if (this.cacheList[i].containsKey(prefixedKey)) {\n return i + 1;\n }\n }\n return -1;\n };\n /**\n * * Set item into cache. You can put number, string, boolean or object.\n * The cache will first check whether has the same key.\n * If it has, it will delete the old item and then put the new item in\n * The cache will pop out items if it is full\n * You can specify the cache item options. The cache will abort and output a warning:\n * If the key is invalid\n * If the size of the item exceeds itemMaxSize.\n * If the value is undefined\n * If incorrect cache item configuration\n * If error happened with browser storage\n *\n * @param key - the key of the item\n * @param value - the value of the item\n * @param options - optional, the specified meta-data\n *\n * @throws if the item is too big which exceeds the limit of single item size\n * @throws if the key is invalid\n */\n InMemoryCacheClass.prototype.setItem = function (key, value, options) {\n var prefixedKey = this.config.keyPrefix + key;\n // invalid keys\n if (prefixedKey === this.config.keyPrefix ||\n prefixedKey === this.cacheCurSizeKey) {\n logger.warn(\"Invalid key: should not be empty or 'CurSize'\");\n return;\n }\n if (typeof value === 'undefined') {\n logger.warn(\"The value of item should not be undefined!\");\n return;\n }\n var cacheItemOptions = {\n priority: options && options.priority !== undefined\n ? options.priority\n : this.config.defaultPriority,\n expires: options && options.expires !== undefined\n ? options.expires\n : this.config.defaultTTL + getCurrTime(),\n };\n if (cacheItemOptions.priority < 1 || cacheItemOptions.priority > 5) {\n logger.warn(\"Invalid parameter: priority due to out or range. It should be within 1 and 5.\");\n return;\n }\n var item = this.fillCacheItem(prefixedKey, value, cacheItemOptions);\n // check wether this item is too big;\n if (item.byteSize > this.config.itemMaxSize) {\n logger.warn(\"Item with key: \" + key + \" you are trying to put into is too big!\");\n return;\n }\n // if key already in the cache, then delete it.\n var presentKeyPrio = this.containsKey(key);\n if (presentKeyPrio !== -1) {\n this._removeItem(prefixedKey, presentKeyPrio - 1);\n }\n // pop out items in the cache when cache is full based on LRU\n // first start from lowest priority cache list\n var cacheListIdx = this.maxPriority - 1;\n while (this._isCacheFull(item.byteSize) && cacheListIdx >= 0) {\n if (!this.cacheList[cacheListIdx].isEmpty()) {\n var popedItemKey = this.cacheList[cacheListIdx].getLastItem();\n this._removeItem(popedItemKey, cacheListIdx);\n }\n else {\n cacheListIdx -= 1;\n }\n }\n this._setItem(prefixedKey, item, Number(item.priority) - 1);\n };\n /**\n * Get item from cache. It will return null if item doesn’t exist or it has been expired.\n * If you specified callback function in the options,\n * then the function will be executed if no such item in the cache\n * and finally put the return value into cache.\n * Please make sure the callback function will return the value you want to put into the cache.\n * The cache will abort output a warning:\n * If the key is invalid\n *\n * @param key - the key of the item\n * @param options - the options of callback function\n */\n InMemoryCacheClass.prototype.getItem = function (key, options) {\n var ret = null;\n var prefixedKey = this.config.keyPrefix + key;\n if (prefixedKey === this.config.keyPrefix ||\n prefixedKey === this.cacheCurSizeKey) {\n logger.warn(\"Invalid key: should not be empty or 'CurSize'\");\n return null;\n }\n // check whether it's in the cachelist\n var presentKeyPrio = this.containsKey(key);\n if (presentKeyPrio !== -1) {\n if (this._isExpired(prefixedKey)) {\n // if expired, remove that item and return null\n this._removeItem(prefixedKey, presentKeyPrio - 1);\n }\n else {\n // if not expired, great, return the value and refresh it\n ret = CacheObject.getItem(prefixedKey);\n var item = JSON.parse(ret);\n this.cacheList[item.priority - 1].refresh(prefixedKey);\n return item.data;\n }\n }\n if (options && options.callback !== undefined) {\n var val = options.callback();\n if (val !== null) {\n this.setItem(key, val, options);\n }\n return val;\n }\n return null;\n };\n /**\n * remove item from the cache\n *\n * @param key - the key of the item\n */\n InMemoryCacheClass.prototype.removeItem = function (key) {\n var prefixedKey = this.config.keyPrefix + key;\n // check if the key is in the cache\n var presentKeyPrio = this.containsKey(key);\n if (presentKeyPrio !== -1) {\n this._removeItem(prefixedKey, presentKeyPrio - 1);\n }\n };\n /**\n * clear the entire cache\n */\n InMemoryCacheClass.prototype.clear = function () {\n var e_1, _a;\n for (var i = 0; i < this.maxPriority; i += 1) {\n try {\n for (var _b = (e_1 = void 0, __values(this.cacheList[i].getKeys())), _c = _b.next(); !_c.done; _c = _b.next()) {\n var key = _c.value;\n this._removeItem(key, i);\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n }\n };\n /**\n * Return all the keys in the cache.\n */\n InMemoryCacheClass.prototype.getAllKeys = function () {\n var e_2, _a;\n var keys = [];\n for (var i = 0; i < this.maxPriority; i += 1) {\n try {\n for (var _b = (e_2 = void 0, __values(this.cacheList[i].getKeys())), _c = _b.next(); !_c.done; _c = _b.next()) {\n var key = _c.value;\n keys.push(key.substring(this.config.keyPrefix.length));\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_2) throw e_2.error; }\n }\n }\n return keys;\n };\n /**\n * return the current size of the cache\n *\n * @return the current size of the cache\n */\n InMemoryCacheClass.prototype.getCacheCurSize = function () {\n return this.curSizeInBytes;\n };\n /**\n * Return a new instance of cache with customized configuration.\n * @param config - the customized configuration\n */\n InMemoryCacheClass.prototype.createInstance = function (config) {\n return new InMemoryCacheClass(config);\n };\n return InMemoryCacheClass;\n}(StorageCache));\nexport { InMemoryCacheClass };\nexport var InMemoryCache = new InMemoryCacheClass();\n/**\n * @deprecated use named import\n */\nexport default InMemoryCache;\n//# sourceMappingURL=InMemoryCache.js.map","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nimport { Amplify } from '@aws-amplify/core';\nimport { BrowserStorageCache } from './BrowserStorageCache';\nimport { InMemoryCache } from './InMemoryCache';\nexport { BrowserStorageCache, InMemoryCache };\n/**\n * @deprecated use named import\n */\nexport default BrowserStorageCache;\nAmplify.register(BrowserStorageCache);\n//# sourceMappingURL=index.js.map"],"sourceRoot":""}
\No newline at end of file