react-native-onyx 1.0.104 → 1.0.106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/web.development.js +26 -41
- package/dist/web.development.js.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/lib/Onyx.js +26 -41
- package/package.json +1 -1
package/dist/web.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.min.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,eAAgBA,QAAQ,cAAeA,QAAQ,aAAcA,QAAQ,cAAeA,QAAQ,oBAAqBA,QAAQ,UACjI,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,CAAC,cAAe,aAAc,YAAa,aAAc,mBAAoB,SAAUJ,GACpE,iBAAZC,QACdA,QAAQ,yBAA2BD,EAAQG,QAAQ,eAAgBA,QAAQ,cAAeA,QAAQ,aAAcA,QAAQ,cAAeA,QAAQ,oBAAqBA,QAAQ,UAE5KJ,EAAK,yBAA2BC,EAAQD,EAAK,eAAgBA,EAAiB,WAAGA,EAAK,aAAcA,EAAK,cAAeA,EAAK,oBAAqBA,EAAY,MAC/J,CATD,CASGO,MAAM,CAACC,EAAkCC,EAAkCC,EAAkCC,EAAkCC,EAAkCC,I,wCCPpL,SAASC,EAAoBC,GAAQ,OAAOA,CAAM,CAClD,SAASC,IAAc,CACvB,SAASC,IAAgB,CACzB,SAASC,IAAgB,C,6HCIzB,IAAIC,EAAuB,EAAQ,KAEnC,SAASC,IAAiB,CAC1B,SAASC,IAA0B,CACnCA,EAAuBC,kBAAoBF,EAE3CjB,EAAOD,QAAU,WACf,SAASqB,EAAKC,EAAOC,EAAUC,EAAeC,EAAUC,EAAcC,GACpE,GAAIA,IAAWV,EAAf,CAIA,IAAIW,EAAM,IAAIC,MACZ,mL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I9D,iBAAtBxG,GAAwCwG,EAAexG,KAEvDwG,EAAexG,GAAmBiI,YAAc5X,GAIpDQ,KAAKuW,oBAAoB/W,GAAOwU,GAAAA,QAAa,IACtC/N,EACHzG,MACA2P,oBACAJ,iBAAkB/O,KAClB4G,eAER,CAEA0P,wBACStW,KAAK4V,qBAIV5V,KAAK4V,oBAAqB,EAE1B5V,KAAKuX,iBAAiBvL,SAASsL,IAC3BtX,KAAKwX,SAASF,EAAS,IAE3BtX,KAAKuX,iBAAmB,GAC5B,CAEAK,SAEI,MAAMC,EAAchW,IAAAA,KAAO7B,KAAKnD,MAAOgF,IAAAA,QAEvC,GAAI7B,KAAKqP,MAAMwH,QACX,OAAO,KAKX,IAAIiB,EAAcjW,IAAAA,KAAO7B,KAAKqP,MAAO,WAIrC,OAHAyI,EAAcjW,IAAAA,KAAOiW,EAAajW,IAAAA,QAI9BsU,KAAAA,cAACH,EAAgB+B,GAAA,CACbC,sBAAuBhY,KAAKsW,uBAExBuB,EAEAC,EAAW,CACfG,IAAKjY,KAAKnD,MAAMqb,eAG5B,EAcJ,OAXAhC,EAASiC,UAAY,CACjBD,aAAcvZ,KAAAA,UAAoB,CAC9BA,KAAAA,KAEAA,KAAAA,MAAgB,CAACyZ,QAASzZ,KAAAA,YAGlCuX,EAASmC,aAAe,CACpBH,kBAAclZ,GAElBkX,EAAStP,YAAe,YAAWA,KAC5BuP,KAAAA,YAAiB,CAACtZ,EAAOob,KAC5B,MAAMK,EAAYpC,EAElB,OAAOC,KAAAA,cAACmC,EAASP,GAAA,GAAKlb,EAAK,CAAEqb,aAAcD,IAAO,GACpD,CAEV,CC3UA,W","sources":["webpack://react-native-onyx/web/webpack/universalModuleDefinition","webpack://react-native-onyx/web/./lib/metrics/index.web.js","webpack://react-native-onyx/web/./node_modules/prop-types/factoryWithThrowingShims.js","webpack://react-native-onyx/web/./node_modules/prop-types/index.js","webpack://react-native-onyx/web/./node_modules/prop-types/lib/ReactPropTypesSecret.js","webpack://react-native-onyx/web/external umd \"fast-equals\"","webpack://react-native-onyx/web/external umd \"idb-keyval\"","webpack://react-native-onyx/web/external umd \"lodash/transform\"","webpack://react-native-onyx/web/external umd \"react\"","webpack://react-native-onyx/web/external umd \"react-dom\"","webpack://react-native-onyx/web/external umd \"underscore\"","webpack://react-native-onyx/web/webpack/bootstrap","webpack://react-native-onyx/web/webpack/runtime/compat get default export","webpack://react-native-onyx/web/webpack/runtime/define property getters","webpack://react-native-onyx/web/webpack/runtime/global","webpack://react-native-onyx/web/webpack/runtime/hasOwnProperty shorthand","webpack://react-native-onyx/web/webpack/runtime/make namespace object","webpack://react-native-onyx/web/./lib/Logger.js","webpack://react-native-onyx/web/./lib/utils.js","webpack://react-native-onyx/web/./lib/OnyxCache.js","webpack://react-native-onyx/web/./lib/Str.js","webpack://react-native-onyx/web/./lib/metrics/PerformanceUtils.js","webpack://react-native-onyx/web/./lib/storage/providers/IDBKeyVal.js","webpack://react-native-onyx/web/./lib/storage/WebStorage.js","webpack://react-native-onyx/web/./lib/storage/index.web.js","webpack://react-native-onyx/web/./lib/batch.js","webpack://react-native-onyx/web/./lib/Onyx.js","webpack://react-native-onyx/web/./lib/createDeferredTask.js","webpack://react-native-onyx/web/./lib/withOnyx.js","webpack://react-native-onyx/web/./lib/index.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"fast-equals\"), require(\"underscore\"), require(\"react-dom\"), require(\"idb-keyval\"), require(\"lodash/transform\"), require(\"react\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"fast-equals\", \"underscore\", \"react-dom\", \"idb-keyval\", \"lodash/transform\", \"react\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"react-native-onyx/web\"] = factory(require(\"fast-equals\"), require(\"underscore\"), require(\"react-dom\"), require(\"idb-keyval\"), require(\"lodash/transform\"), require(\"react\"));\n\telse\n\t\troot[\"react-native-onyx/web\"] = factory(root[\"fast-equals\"], root[\"underscore\"], root[\"react-dom\"], root[\"idb-keyval\"], root[\"lodash/transform\"], root[\"react\"]);\n})(self, (__WEBPACK_EXTERNAL_MODULE__746__, __WEBPACK_EXTERNAL_MODULE__952__, __WEBPACK_EXTERNAL_MODULE__111__, __WEBPACK_EXTERNAL_MODULE__802__, __WEBPACK_EXTERNAL_MODULE__407__, __WEBPACK_EXTERNAL_MODULE__156__) => {\nreturn ","// For web-only implementations of Onyx, this module will just be a no-op\n\nfunction decorateWithMetrics(func) { return func; }\nfunction getMetrics() {}\nfunction printMetrics() {}\nfunction resetMetrics() {}\n\nexport {\n decorateWithMetrics,\n getMetrics,\n resetMetrics,\n printMetrics,\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\n\nfunction emptyFunction() {}\nfunction emptyFunctionWithReset() {}\nemptyFunctionWithReset.resetWarningCache = emptyFunction;\n\nmodule.exports = function() {\n function shim(props, propName, componentName, location, propFullName, secret) {\n if (secret === ReactPropTypesSecret) {\n // It is still safe when called from React.\n return;\n }\n var err = new Error(\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use PropTypes.checkPropTypes() to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n err.name = 'Invariant Violation';\n throw err;\n };\n shim.isRequired = shim;\n function getShim() {\n return shim;\n };\n // Important!\n // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n var ReactPropTypes = {\n array: shim,\n bool: shim,\n func: shim,\n number: shim,\n object: shim,\n string: shim,\n symbol: shim,\n\n any: shim,\n arrayOf: getShim,\n element: shim,\n elementType: shim,\n instanceOf: getShim,\n node: shim,\n objectOf: getShim,\n oneOf: getShim,\n oneOfType: getShim,\n shape: getShim,\n exact: getShim,\n\n checkPropTypes: emptyFunctionWithReset,\n resetWarningCache: emptyFunction\n };\n\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (process.env.NODE_ENV !== 'production') {\n var ReactIs = require('react-is');\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = require('./factoryWithThrowingShims')();\n}\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n","module.exports = __WEBPACK_EXTERNAL_MODULE__746__;","module.exports = __WEBPACK_EXTERNAL_MODULE__802__;","module.exports = __WEBPACK_EXTERNAL_MODULE__407__;","module.exports = __WEBPACK_EXTERNAL_MODULE__156__;","module.exports = __WEBPACK_EXTERNAL_MODULE__111__;","module.exports = __WEBPACK_EXTERNAL_MODULE__952__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// Logging callback\nlet logger = () => {};\n\n/**\n * Register the logging callback\n *\n * @param {Function} callback\n */\nfunction registerLogger(callback) {\n logger = callback;\n}\n\n/**\n * Send an alert message to the logger\n *\n * @param {String} message\n */\nfunction logAlert(message) {\n logger({message: `[Onyx] ${message}`, level: 'alert'});\n}\n\n/**\n * Send an info message to the logger\n *\n * @param {String} message\n */\nfunction logInfo(message) {\n logger({message: `[Onyx] ${message}`, level: 'info'});\n}\n\nexport {\n registerLogger,\n logInfo,\n logAlert,\n};\n","import _ from 'underscore';\n\nfunction areObjectsEmpty(a, b) {\n return (\n typeof a === 'object'\n && typeof b === 'object'\n && _.isEmpty(a)\n && _.isEmpty(b)\n );\n}\n\n// Mostly copied from https://medium.com/@lubaka.a/how-to-remove-lodash-performance-improvement-b306669ad0e1\n\n/**\n * @param {mixed} val\n * @returns {boolean}\n*/\nfunction isMergeableObject(val) {\n const nonNullObject = val != null ? typeof val === 'object' : false;\n return (nonNullObject\n && Object.prototype.toString.call(val) !== '[object RegExp]'\n && Object.prototype.toString.call(val) !== '[object Date]')\n // eslint-disable-next-line rulesdir/prefer-underscore-method\n && !Array.isArray(val);\n}\n\n/**\n* @param {Object} target\n* @param {Object} source\n* @param {Boolean} shouldRemoveNullObjectValues\n* @returns {Object}\n*/\nfunction mergeObject(target, source, shouldRemoveNullObjectValues = true) {\n const destination = {};\n if (isMergeableObject(target)) {\n // lodash adds a small overhead so we don't use it here\n // eslint-disable-next-line rulesdir/prefer-underscore-method\n const targetKeys = Object.keys(target);\n for (let i = 0; i < targetKeys.length; ++i) {\n const key = targetKeys[i];\n\n // If shouldRemoveNullObjectValues is true, we want to remove null values from the merged object\n const isSourceOrTargetNull = target[key] === null || source[key] === null;\n const shouldOmitSourceKey = shouldRemoveNullObjectValues && isSourceOrTargetNull;\n\n if (!shouldOmitSourceKey) {\n destination[key] = target[key];\n }\n }\n }\n\n // lodash adds a small overhead so we don't use it here\n // eslint-disable-next-line rulesdir/prefer-underscore-method\n const sourceKeys = Object.keys(source);\n for (let i = 0; i < sourceKeys.length; ++i) {\n const key = sourceKeys[i];\n\n // If shouldRemoveNullObjectValues is true, we want to remove null values from the merged object\n const shouldOmitSourceKey = shouldRemoveNullObjectValues && source[key] === null;\n\n // If we pass undefined as the updated value for a key, we want to generally ignore it\n const isSourceKeyUndefined = source[key] === undefined;\n\n if (!isSourceKeyUndefined && !shouldOmitSourceKey) {\n const isSourceKeyMergable = isMergeableObject(source[key]);\n\n if (isSourceKeyMergable && target[key]) {\n if ((!shouldRemoveNullObjectValues || isSourceKeyMergable)) {\n // eslint-disable-next-line no-use-before-define\n destination[key] = fastMerge(target[key], source[key], shouldRemoveNullObjectValues);\n }\n } else if (!shouldRemoveNullObjectValues || source[key] !== null) {\n destination[key] = source[key];\n }\n }\n }\n\n return destination;\n}\n\n/**\n * Merges two objects and removes null values if \"shouldRemoveNullObjectValues\" is set to true\n *\n * We generally want to remove null values from objects written to disk and cache, because it decreases the amount of data stored in memory and on disk.\n * On native, when merging an existing value with new changes, SQLite will use JSON_PATCH, which removes top-level nullish values.\n * To be consistent with the behaviour for merge, we'll also want to remove null values for \"set\" operations.\n *\n* @param {Object|Array} target\n* @param {Object|Array} source\n* @param {Boolean} shouldRemoveNullObjectValues\n* @returns {Object|Array}\n*/\nfunction fastMerge(target, source, shouldRemoveNullObjectValues = true) {\n // We have to ignore arrays and nullish values here,\n // otherwise \"mergeObject\" will throw an error,\n // because it expects an object as \"source\"\n if (_.isArray(source) || source === null || source === undefined) {\n return source;\n }\n return mergeObject(target, source, shouldRemoveNullObjectValues);\n}\n\nfunction removeNestedNullValues(value) {\n if (typeof value === 'object' && !_.isArray(value)) {\n return fastMerge(value, value);\n }\n\n return value;\n}\n\nexport default {areObjectsEmpty, fastMerge, removeNestedNullValues};\n","import _ from 'underscore';\nimport {deepEqual} from 'fast-equals';\nimport utils from './utils';\n\nconst isDefined = _.negate(_.isUndefined);\n\n/**\n * In memory cache providing data by reference\n * Encapsulates Onyx cache related functionality\n */\nclass OnyxCache {\n constructor() {\n /**\n * @private\n * Cache of all the storage keys available in persistent storage\n * @type {Set<string>}\n */\n this.storageKeys = new Set();\n\n /**\n * @private\n * Unique list of keys maintained in access order (most recent at the end)\n * @type {Set<string>}\n */\n this.recentKeys = new Set();\n\n /**\n * @private\n * A map of cached values\n * @type {Record<string, *>}\n */\n this.storageMap = {};\n\n /**\n * @private\n * Captured pending tasks for already running storage methods\n * Using a map yields better performance on operations such a delete\n * https://www.zhenghao.io/posts/object-vs-map\n * @type {Map<string, Promise>}\n */\n this.pendingPromises = new Map();\n\n // bind all public methods to prevent problems with `this`\n _.bindAll(\n this,\n 'getAllKeys', 'getValue', 'hasCacheForKey', 'addKey', 'set', 'drop', 'merge',\n 'hasPendingTask', 'getTaskPromise', 'captureTask', 'removeLeastRecentlyUsedKeys',\n 'setRecentKeysLimit',\n );\n }\n\n /**\n * Get all the storage keys\n * @returns {string[]}\n */\n getAllKeys() {\n return Array.from(this.storageKeys);\n }\n\n /**\n * Get a cached value from storage\n * @param {string} key\n * @returns {*}\n */\n getValue(key) {\n this.addToAccessedKeys(key);\n return this.storageMap[key];\n }\n\n /**\n * Check whether cache has data for the given key\n * @param {string} key\n * @returns {boolean}\n */\n hasCacheForKey(key) {\n return isDefined(this.storageMap[key]);\n }\n\n /**\n * Saves a key in the storage keys list\n * Serves to keep the result of `getAllKeys` up to date\n * @param {string} key\n */\n addKey(key) {\n this.storageKeys.add(key);\n }\n\n /**\n * Set's a key value in cache\n * Adds the key to the storage keys list as well\n * @param {string} key\n * @param {*} value\n * @returns {*} value - returns the cache value\n */\n set(key, value) {\n this.addKey(key);\n this.addToAccessedKeys(key);\n this.storageMap[key] = value;\n\n return value;\n }\n\n /**\n * Forget the cached value for the given key\n * @param {string} key\n */\n drop(key) {\n delete this.storageMap[key];\n this.storageKeys.delete(key);\n this.recentKeys.delete(key);\n }\n\n /**\n * Deep merge data to cache, any non existing keys will be created\n * @param {Record<string, *>} data - a map of (cache) key - values\n */\n merge(data) {\n if (!_.isObject(data) || _.isArray(data)) {\n throw new Error('data passed to cache.merge() must be an Object of onyx key/value pairs');\n }\n\n // lodash adds a small overhead so we don't use it here\n // eslint-disable-next-line prefer-object-spread, rulesdir/prefer-underscore-method\n this.storageMap = Object.assign({}, utils.fastMerge(this.storageMap, data));\n\n const storageKeys = this.getAllKeys();\n const mergedKeys = _.keys(data);\n this.storageKeys = new Set([...storageKeys, ...mergedKeys]);\n _.each(mergedKeys, key => this.addToAccessedKeys(key));\n }\n\n /**\n * Check whether the given task is already running\n * @param {string} taskName - unique name given for the task\n * @returns {*}\n */\n hasPendingTask(taskName) {\n return isDefined(this.pendingPromises.get(taskName));\n }\n\n /**\n * Use this method to prevent concurrent calls for the same thing\n * Instead of calling the same task again use the existing promise\n * provided from this function\n * @template T\n * @param {string} taskName - unique name given for the task\n * @returns {Promise<T>}\n */\n getTaskPromise(taskName) {\n return this.pendingPromises.get(taskName);\n }\n\n /**\n * Capture a promise for a given task so other caller can\n * hook up to the promise if it's still pending\n * @template T\n * @param {string} taskName - unique name for the task\n * @param {Promise<T>} promise\n * @returns {Promise<T>}\n */\n captureTask(taskName, promise) {\n const returnPromise = promise.finally(() => {\n this.pendingPromises.delete(taskName);\n });\n\n this.pendingPromises.set(taskName, returnPromise);\n\n return returnPromise;\n }\n\n /**\n * @private\n * Adds a key to the top of the recently accessed keys\n * @param {string} key\n */\n addToAccessedKeys(key) {\n // Removing and re-adding a key ensures it's at the end of the list\n this.recentKeys.delete(key);\n this.recentKeys.add(key);\n }\n\n /**\n * Remove keys that don't fall into the range of recently used keys\n */\n removeLeastRecentlyUsedKeys() {\n let numKeysToRemove = this.recentKeys.size - this.maxRecentKeysSize;\n if (numKeysToRemove <= 0) {\n return;\n }\n const iterator = this.recentKeys.values();\n const temp = [];\n while (numKeysToRemove > 0) {\n const value = iterator.next().value;\n temp.push(value);\n numKeysToRemove--;\n }\n\n for (let i = 0; i < temp.length; ++i) {\n delete this.storageMap[temp[i]];\n this.recentKeys.delete(temp[i]);\n }\n }\n\n /**\n * Set the recent keys list size\n * @param {number} limit\n */\n setRecentKeysLimit(limit) {\n this.maxRecentKeysSize = limit;\n }\n\n /**\n * @param {String} key\n * @param {*} value\n * @returns {Boolean}\n */\n hasValueChanged(key, value) {\n return !deepEqual(this.storageMap[key], value);\n }\n}\n\nconst instance = new OnyxCache();\n\nexport default instance;\n","import _ from 'underscore';\n\n/**\n * Returns true if the haystack begins with the needle\n *\n * @param {String} haystack The full string to be searched\n * @param {String} needle The case-sensitive string to search for\n * @return {Boolean} Returns true if the haystack starts with the needle.\n */\nfunction startsWith(haystack, needle) {\n return _.isString(haystack)\n && _.isString(needle)\n && haystack.startsWith(needle);\n}\n\n/**\n * Checks if parameter is a string or function.\n * If it is a string, then we will just return it.\n * If it is a function, then we will call it with\n * any additional arguments and return the result.\n *\n * @param {String|Function} parameter\n * @returns {*}\n */\nfunction result(parameter, ...args) {\n return _.isFunction(parameter) ? parameter(...args) : parameter;\n}\n\nexport {startsWith, result};\n","import lodashTransform from 'lodash/transform';\nimport _ from 'underscore';\n\nlet debugSetState = false;\n\n/**\n * @param {Boolean} debug\n */\nfunction setShouldDebugSetState(debug) {\n debugSetState = debug;\n}\n\n/**\n * Deep diff between two objects. Useful for figuring out what changed about an object from one render to the next so\n * that state and props updates can be optimized.\n *\n * @param {Object} object\n * @param {Object} base\n * @return {Object}\n */\nfunction diffObject(object, base) {\n function changes(obj, comparisonObject) {\n return lodashTransform(obj, (result, value, key) => {\n if (_.isEqual(value, comparisonObject[key])) {\n return;\n }\n\n // eslint-disable-next-line no-param-reassign\n result[key] = (_.isObject(value) && _.isObject(comparisonObject[key]))\n ? changes(value, comparisonObject[key])\n : value;\n });\n }\n return changes(object, base);\n}\n\n/**\n * Provide insights into why a setState() call occurred by diffing the before and after values.\n *\n * @param {Object} mapping\n * @param {*} previousValue\n * @param {*} newValue\n * @param {String} caller\n * @param {String} [keyThatChanged]\n */\nfunction logSetStateCall(mapping, previousValue, newValue, caller, keyThatChanged) {\n if (!debugSetState) {\n return;\n }\n\n const logParams = {};\n if (keyThatChanged) {\n logParams.keyThatChanged = keyThatChanged;\n }\n if (_.isObject(newValue) && _.isObject(previousValue)) {\n logParams.difference = diffObject(previousValue, newValue);\n } else {\n logParams.previousValue = previousValue;\n logParams.newValue = newValue;\n }\n\n console.debug(`[Onyx-Debug] ${mapping.displayName} setState() called. Subscribed to key '${mapping.key}' (${caller})`, logParams);\n}\n\nexport {\n logSetStateCall,\n setShouldDebugSetState,\n};\n","import {\n set,\n keys,\n getMany,\n setMany,\n get,\n clear,\n del,\n delMany,\n createStore,\n promisifyRequest,\n} from 'idb-keyval';\nimport _ from 'underscore';\nimport utils from '../../utils';\n\n// We don't want to initialize the store while the JS bundle loads as idb-keyval will try to use global.indexedDB\n// which might not be available in certain environments that load the bundle (e.g. electron main process).\nlet customStoreInstance;\nconst getCustomStore = () => {\n if (!customStoreInstance) {\n customStoreInstance = createStore('OnyxDB', 'keyvaluepairs');\n }\n return customStoreInstance;\n};\n\nconst provider = {\n /**\n * Sets the value for a given key. The only requirement is that the value should be serializable to JSON string\n * @param {String} key\n * @param {*} value\n * @return {Promise<void>}\n */\n setItem: (key, value) => set(key, value, getCustomStore()),\n\n /**\n * Get multiple key-value pairs for the give array of keys in a batch.\n * This is optimized to use only one database transaction.\n * @param {String[]} keysParam\n * @return {Promise<Array<[key, value]>>}\n */\n multiGet: keysParam => getMany(keysParam, getCustomStore())\n .then(values => _.map(values, (value, index) => [keysParam[index], value])),\n\n /**\n * Multiple merging of existing and new values in a batch\n * @param {Array<[key, value]>} pairs\n * This function also removes all nested null values from an object.\n * @return {Promise<void>}\n */\n multiMerge: pairs => getCustomStore()('readwrite', (store) => {\n // Note: we are using the manual store transaction here, to fit the read and update\n // of the items in one transaction to achieve best performance.\n\n const getValues = Promise.all(_.map(pairs, ([key]) => promisifyRequest(store.get(key))));\n\n return getValues.then((values) => {\n const upsertMany = _.map(pairs, ([key, value], index) => {\n const prev = values[index];\n const newValue = utils.fastMerge(prev, value);\n return promisifyRequest(store.put(newValue, key));\n });\n return Promise.all(upsertMany);\n });\n }),\n\n /**\n * Merging an existing value with a new one\n * @param {String} key\n * @param {any} _changes - not used, as we rely on the pre-merged data from the `modifiedData`\n * @param {any} modifiedData - the pre-merged data from `Onyx.applyMerge`\n * @return {Promise<void>}\n */\n mergeItem(key, _changes, modifiedData) {\n // Since Onyx also merged the existing value with the changes, we can just set the value directly\n return provider.setItem(key, modifiedData);\n },\n\n /**\n * Stores multiple key-value pairs in a batch\n * @param {Array<[key, value]>} pairs\n * @return {Promise<void>}\n */\n multiSet: pairs => setMany(pairs, getCustomStore()),\n\n /**\n * Clear everything from storage and also stops the SyncQueue from adding anything more to storage\n * @returns {Promise<void>}\n */\n clear: () => clear(getCustomStore()),\n\n // This is a noop for now in order to keep clients from crashing see https://github.com/Expensify/Expensify/issues/312438\n setMemoryOnlyKeys: () => {},\n\n /**\n * Returns all keys available in storage\n * @returns {Promise<String[]>}\n */\n getAllKeys: () => keys(getCustomStore()),\n\n /**\n * Get the value of a given key or return `null` if it's not available in storage\n * @param {String} key\n * @return {Promise<*>}\n */\n getItem: key => get(key, getCustomStore()),\n\n /**\n * Remove given key and it's value from storage\n * @param {String} key\n * @returns {Promise<void>}\n */\n removeItem: key => del(key, getCustomStore()),\n\n /**\n * Remove given keys and their values from storage\n *\n * @param {Array} keysParam\n * @returns {Promise}\n */\n removeItems: keysParam => delMany(keysParam, getCustomStore()),\n\n /**\n * Gets the total bytes of the database file\n * @returns {Promise<number>}\n */\n getDatabaseSize() {\n if (!window.navigator || !window.navigator.storage) {\n throw new Error('StorageManager browser API unavailable');\n }\n\n return window.navigator.storage.estimate()\n .then(value => ({\n bytesUsed: value.usage,\n bytesRemaining: value.quota - value.usage,\n }))\n .catch((error) => {\n throw new Error(`Unable to estimate web storage quota. Original error: ${error}`);\n });\n },\n};\n\nexport default provider;\n","/**\n * This file is here to wrap IDBKeyVal with a layer that provides data-changed events like the ones that exist\n * when using LocalStorage APIs in the browser. These events are great because multiple tabs can listen for when\n * data changes and then stay up-to-date with everything happening in Onyx.\n */\nimport _ from 'underscore';\nimport Storage from './providers/IDBKeyVal';\n\nconst SYNC_ONYX = 'SYNC_ONYX';\n\n/**\n * Raise an event thorough `localStorage` to let other tabs know a value changed\n * @param {String} onyxKey\n */\nfunction raiseStorageSyncEvent(onyxKey) {\n global.localStorage.setItem(SYNC_ONYX, onyxKey);\n global.localStorage.removeItem(SYNC_ONYX, onyxKey);\n}\n\nfunction raiseStorageSyncManyKeysEvent(onyxKeys) {\n _.each(onyxKeys, (onyxKey) => {\n raiseStorageSyncEvent(onyxKey);\n });\n}\n\nconst webStorage = {\n ...Storage,\n\n /**\n * @param {Function} onStorageKeyChanged Storage synchronization mechanism keeping all opened tabs in sync\n */\n keepInstancesSync(onStorageKeyChanged) {\n // Override set, remove and clear to raise storage events that we intercept in other tabs\n this.setItem = (key, value) => Storage.setItem(key, value)\n .then(() => raiseStorageSyncEvent(key));\n\n this.removeItem = key => Storage.removeItem(key)\n .then(() => raiseStorageSyncEvent(key));\n\n this.removeItems = keys => Storage.removeItems(keys)\n .then(() => raiseStorageSyncManyKeysEvent(keys));\n\n this.mergeItem = (key, batchedChanges, modifiedData) => Storage.mergeItem(key, batchedChanges, modifiedData)\n .then(() => raiseStorageSyncEvent(key));\n\n // If we just call Storage.clear other tabs will have no idea which keys were available previously\n // so that they can call keysChanged for them. That's why we iterate over every key and raise a storage sync\n // event for each one\n this.clear = () => {\n let allKeys;\n\n // They keys must be retreived before storage is cleared or else the list of keys would be empty\n return Storage.getAllKeys()\n .then((keys) => {\n allKeys = keys;\n })\n .then(() => Storage.clear())\n .then(() => {\n // Now that storage is cleared, the storage sync event can happen which is a more atomic action\n // for other browser tabs\n _.each(allKeys, raiseStorageSyncEvent);\n });\n };\n\n // This listener will only be triggered by events coming from other tabs\n global.addEventListener('storage', (event) => {\n // Ignore events that don't originate from the SYNC_ONYX logic\n if (event.key !== SYNC_ONYX || !event.newValue) {\n return;\n }\n\n const onyxKey = event.newValue;\n Storage.getItem(onyxKey)\n .then(value => onStorageKeyChanged(onyxKey, value));\n });\n },\n};\n\nexport default webStorage;\n","import WebStorage from './WebStorage';\n\nexport default WebStorage;\n","import {unstable_batchedUpdates} from 'react-dom';\n\nexport default unstable_batchedUpdates;\n","/* eslint-disable no-continue */\nimport {deepEqual} from 'fast-equals';\nimport _ from 'underscore';\nimport * as Logger from './Logger';\nimport cache from './OnyxCache';\nimport * as Str from './Str';\nimport createDeferredTask from './createDeferredTask';\nimport * as PerformanceUtils from './metrics/PerformanceUtils';\nimport Storage from './storage';\nimport utils from './utils';\nimport unstable_batchedUpdates from './batch';\n\n// Method constants\nconst METHOD = {\n SET: 'set',\n MERGE: 'merge',\n MERGE_COLLECTION: 'mergecollection',\n MULTI_SET: 'multiset',\n CLEAR: 'clear',\n};\n\n// Key/value store of Onyx key and arrays of values to merge\nconst mergeQueue = {};\nconst mergeQueuePromise = {};\n\n// Keeps track of the last connectionID that was used so we can keep incrementing it\nlet lastConnectionID = 0;\n\n// Holds a mapping of all the react components that want their state subscribed to a store key\nconst callbackToStateMapping = {};\n\n// Keeps a copy of the values of the onyx collection keys as a map for faster lookups\nlet onyxCollectionKeyMap = new Map();\n\n// Holds a list of keys that have been directly subscribed to or recently modified from least to most recent\nlet recentlyAccessedKeys = [];\n\n// Holds a list of keys that are safe to remove when we reach max storage. If a key does not match with\n// whatever appears in this list it will NEVER be a candidate for eviction.\nlet evictionAllowList = [];\n\n// Holds a map of keys and connectionID arrays whose keys will never be automatically evicted as\n// long as we have at least one subscriber that returns false for the canEvict property.\nconst evictionBlocklist = {};\n\n// Optional user-provided key value states set when Onyx initializes or clears\nlet defaultKeyStates = {};\n\n// Connections can be made before `Onyx.init`. They would wait for this task before resolving\nconst deferredInitTask = createDeferredTask();\n\nlet batchUpdatesPromise = null;\nlet batchUpdatesQueue = [];\n\n/**\n * We are batching together onyx updates. This helps with use cases where we schedule onyx updates after each other.\n * This happens for example in the Onyx.update function, where we process API responses that might contain a lot of\n * update operations. Instead of calling the subscribers for each update operation, we batch them together which will\n * cause react to schedule the updates at once instead of after each other. This is mainly a performance optimization.\n * @returns {Promise}\n */\nfunction maybeFlushBatchUpdates() {\n if (batchUpdatesPromise) {\n return batchUpdatesPromise;\n }\n\n batchUpdatesPromise = new Promise((resolve) => {\n /* We use (setTimeout, 0) here which should be called once native module calls are flushed (usually at the end of the frame)\n * We may investigate if (setTimeout, 1) (which in React Native is equal to requestAnimationFrame) works even better\n * then the batch will be flushed on next frame.\n */\n setTimeout(() => {\n const updatesCopy = batchUpdatesQueue;\n batchUpdatesQueue = [];\n batchUpdatesPromise = null;\n unstable_batchedUpdates(() => {\n updatesCopy.forEach((applyUpdates) => {\n applyUpdates();\n });\n });\n\n resolve();\n }, 0);\n });\n return batchUpdatesPromise;\n}\n\nfunction batchUpdates(updates) {\n batchUpdatesQueue.push(updates);\n return maybeFlushBatchUpdates();\n}\n\n/**\n * Uses a selector function to return a simplified version of sourceData\n * @param {Mixed} sourceData\n * @param {Function} selector Function that takes sourceData and returns a simplified version of it\n * @param {Object} [withOnyxInstanceState]\n * @returns {Mixed}\n */\nconst getSubsetOfData = (sourceData, selector, withOnyxInstanceState) => selector(sourceData, withOnyxInstanceState);\n\n/**\n * Takes a collection of items (eg. {testKey_1:{a:'a'}, testKey_2:{b:'b'}})\n * and runs it through a reducer function to return a subset of the data according to a selector.\n * The resulting collection will only contain items that are returned by the selector.\n * @param {Object} collection\n * @param {String|Function} selector (see method docs for getSubsetOfData() for full details)\n * @param {Object} [withOnyxInstanceState]\n * @returns {Object}\n */\nconst reduceCollectionWithSelector = (collection, selector, withOnyxInstanceState) => _.reduce(collection, (finalCollection, item, key) => {\n // eslint-disable-next-line no-param-reassign\n finalCollection[key] = getSubsetOfData(item, selector, withOnyxInstanceState);\n\n return finalCollection;\n}, {});\n\n/**\n * Get some data from the store\n *\n * @private\n * @param {string} key\n * @returns {Promise<*>}\n */\nfunction get(key) {\n // When we already have the value in cache - resolve right away\n if (cache.hasCacheForKey(key)) {\n return Promise.resolve(cache.getValue(key));\n }\n\n const taskName = `get:${key}`;\n\n // When a value retrieving task for this key is still running hook to it\n if (cache.hasPendingTask(taskName)) {\n return cache.getTaskPromise(taskName);\n }\n\n // Otherwise retrieve the value from storage and capture a promise to aid concurrent usages\n const promise = Storage.getItem(key)\n .then((val) => {\n cache.set(key, val);\n return val;\n })\n .catch(err => Logger.logInfo(`Unable to get item from persistent storage. Key: ${key} Error: ${err}`));\n\n return cache.captureTask(taskName, promise);\n}\n\n/**\n * Returns current key names stored in persisted storage\n * @private\n * @returns {Promise<string[]>}\n */\nfunction getAllKeys() {\n // When we've already read stored keys, resolve right away\n const storedKeys = cache.getAllKeys();\n if (storedKeys.length > 0) {\n return Promise.resolve(storedKeys);\n }\n\n const taskName = 'getAllKeys';\n\n // When a value retrieving task for all keys is still running hook to it\n if (cache.hasPendingTask(taskName)) {\n return cache.getTaskPromise(taskName);\n }\n\n // Otherwise retrieve the keys from storage and capture a promise to aid concurrent usages\n const promise = Storage.getAllKeys()\n .then((keys) => {\n _.each(keys, key => cache.addKey(key));\n return keys;\n });\n\n return cache.captureTask(taskName, promise);\n}\n\n/**\n * Checks to see if the a subscriber's supplied key\n * is associated with a collection of keys.\n *\n * @private\n * @param {String} key\n * @returns {Boolean}\n */\nfunction isCollectionKey(key) {\n return onyxCollectionKeyMap.has(key);\n}\n\n/**\n * @param {String} collectionKey\n * @param {String} key\n * @returns {Boolean}\n */\nfunction isCollectionMemberKey(collectionKey, key) {\n return Str.startsWith(key, collectionKey) && key.length > collectionKey.length;\n}\n\n/**\n * Checks to see if a provided key is the exact configured key of our connected subscriber\n * or if the provided key is a collection member key (in case our configured key is a \"collection key\")\n *\n * @private\n * @param {String} configKey\n * @param {String} key\n * @return {Boolean}\n */\nfunction isKeyMatch(configKey, key) {\n return isCollectionKey(configKey)\n ? Str.startsWith(key, configKey)\n : configKey === key;\n}\n\n/**\n * Checks to see if this key has been flagged as\n * safe for removal.\n *\n * @private\n * @param {String} testKey\n * @returns {Boolean}\n */\nfunction isSafeEvictionKey(testKey) {\n return _.some(evictionAllowList, key => isKeyMatch(key, testKey));\n}\n\n/**\n * Tries to get a value from the cache. If the value is not present in cache it will return the default value or undefined.\n * If the requested key is a collection, it will return an object with all the collection members.\n *\n * @param {String} key\n * @param {Object} mapping\n * @returns {Mixed}\n */\nfunction tryGetCachedValue(key, mapping = {}) {\n let val = cache.getValue(key);\n\n if (isCollectionKey(key)) {\n const allKeys = cache.getAllKeys();\n const matchingKeys = _.filter(allKeys, k => k.startsWith(key));\n const values = _.reduce(matchingKeys, (finalObject, matchedKey) => {\n const cachedValue = cache.getValue(matchedKey);\n if (cachedValue) {\n // This is permissible because we're in the process of constructing the final object in a reduce function.\n // eslint-disable-next-line no-param-reassign\n finalObject[matchedKey] = cachedValue;\n }\n return finalObject;\n }, {});\n if (_.isEmpty(values)) {\n return;\n }\n val = values;\n }\n\n if (mapping.selector) {\n const state = mapping.withOnyxInstance ? mapping.withOnyxInstance.state : undefined;\n if (isCollectionKey(key)) {\n return reduceCollectionWithSelector(val, mapping.selector, state);\n }\n return getSubsetOfData(val, mapping.selector, state);\n }\n\n return val;\n}\n\n/**\n * Remove a key from the recently accessed key list.\n *\n * @private\n * @param {String} key\n */\nfunction removeLastAccessedKey(key) {\n recentlyAccessedKeys = _.without(recentlyAccessedKeys, key);\n}\n\n/**\n * Add a key to the list of recently accessed keys. The least\n * recently accessed key should be at the head and the most\n * recently accessed key at the tail.\n *\n * @private\n * @param {String} key\n */\nfunction addLastAccessedKey(key) {\n // Only specific keys belong in this list since we cannot remove an entire collection.\n if (isCollectionKey(key) || !isSafeEvictionKey(key)) {\n return;\n }\n\n removeLastAccessedKey(key);\n recentlyAccessedKeys.push(key);\n}\n\n/**\n * Removes a key previously added to this list\n * which will enable it to be deleted again.\n *\n * @private\n * @param {String} key\n * @param {Number} connectionID\n */\nfunction removeFromEvictionBlockList(key, connectionID) {\n evictionBlocklist[key] = _.without(evictionBlocklist[key] || [], connectionID);\n\n // Remove the key if there are no more subscribers\n if (evictionBlocklist[key].length === 0) {\n delete evictionBlocklist[key];\n }\n}\n\n/**\n * Keys added to this list can never be deleted.\n *\n * @private\n * @param {String} key\n * @param {Number} connectionID\n */\nfunction addToEvictionBlockList(key, connectionID) {\n removeFromEvictionBlockList(key, connectionID);\n\n if (!evictionBlocklist[key]) {\n evictionBlocklist[key] = [];\n }\n\n evictionBlocklist[key].push(connectionID);\n}\n\n/**\n * Take all the keys that are safe to evict and add them to\n * the recently accessed list when initializing the app. This\n * enables keys that have not recently been accessed to be\n * removed.\n *\n * @private\n * @returns {Promise}\n */\nfunction addAllSafeEvictionKeysToRecentlyAccessedList() {\n return getAllKeys()\n .then((keys) => {\n _.each(evictionAllowList, (safeEvictionKey) => {\n _.each(keys, (key) => {\n if (!isKeyMatch(safeEvictionKey, key)) {\n return;\n }\n addLastAccessedKey(key);\n });\n });\n });\n}\n\n/**\n * @private\n * @param {String} collectionKey\n * @returns {Object}\n */\nfunction getCachedCollection(collectionKey) {\n const collectionMemberKeys = _.filter(cache.getAllKeys(), (\n storedKey => isCollectionMemberKey(collectionKey, storedKey)\n ));\n\n return _.reduce(collectionMemberKeys, (prev, curr) => {\n const cachedValue = cache.getValue(curr);\n if (!cachedValue) {\n return prev;\n }\n\n // eslint-disable-next-line no-param-reassign\n prev[curr] = cachedValue;\n return prev;\n }, {});\n}\n\n/**\n * When a collection of keys change, search for any callbacks matching the collection key and trigger those callbacks\n *\n * @private\n * @param {String} collectionKey\n * @param {Object} partialCollection - a partial collection of grouped member keys\n * @param {boolean} [notifyRegularSubscibers=true]\n * @param {boolean} [notifyWithOnyxSubscibers=true]\n */\nfunction keysChanged(collectionKey, partialCollection, notifyRegularSubscibers = true, notifyWithOnyxSubscibers = true) {\n // We are iterating over all subscribers similar to keyChanged(). However, we are looking for subscribers who are subscribing to either a collection key or\n // individual collection key member for the collection that is being updated. It is important to note that the collection parameter cane be a PARTIAL collection\n // and does not represent all of the combined keys and values for a collection key. It is just the \"new\" data that was merged in via mergeCollection().\n const stateMappingKeys = _.keys(callbackToStateMapping);\n for (let i = 0; i < stateMappingKeys.length; i++) {\n const subscriber = callbackToStateMapping[stateMappingKeys[i]];\n if (!subscriber) {\n continue;\n }\n\n // Skip iteration if we do not have a collection key or a collection member key on this subscriber\n if (!Str.startsWith(subscriber.key, collectionKey)) {\n continue;\n }\n\n /**\n * e.g. Onyx.connect({key: ONYXKEYS.COLLECTION.REPORT, callback: ...});\n */\n const isSubscribedToCollectionKey = subscriber.key === collectionKey;\n\n /**\n * e.g. Onyx.connect({key: `${ONYXKEYS.COLLECTION.REPORT}{reportID}`, callback: ...});\n */\n const isSubscribedToCollectionMemberKey = isCollectionMemberKey(collectionKey, subscriber.key);\n\n // We prepare the \"cached collection\" which is the entire collection + the new partial data that\n // was merged in via mergeCollection().\n const cachedCollection = getCachedCollection(collectionKey);\n\n // Regular Onyx.connect() subscriber found.\n if (_.isFunction(subscriber.callback)) {\n if (!notifyRegularSubscibers) {\n continue;\n }\n\n // If they are subscribed to the collection key and using waitForCollectionCallback then we'll\n // send the whole cached collection.\n if (isSubscribedToCollectionKey) {\n if (subscriber.waitForCollectionCallback) {\n subscriber.callback(cachedCollection);\n continue;\n }\n\n // If they are not using waitForCollectionCallback then we notify the subscriber with\n // the new merged data but only for any keys in the partial collection.\n const dataKeys = _.keys(partialCollection);\n for (let j = 0; j < dataKeys.length; j++) {\n const dataKey = dataKeys[j];\n subscriber.callback(cachedCollection[dataKey], dataKey);\n }\n continue;\n }\n\n // And if the subscriber is specifically only tracking a particular collection member key then we will\n // notify them with the cached data for that key only.\n if (isSubscribedToCollectionMemberKey) {\n subscriber.callback(cachedCollection[subscriber.key], subscriber.key);\n continue;\n }\n\n continue;\n }\n\n // React component subscriber found.\n if (subscriber.withOnyxInstance) {\n if (!notifyWithOnyxSubscibers) {\n continue;\n }\n\n // We are subscribed to a collection key so we must update the data in state with the new\n // collection member key values from the partial update.\n if (isSubscribedToCollectionKey) {\n // If the subscriber has a selector, then the component's state must only be updated with the data\n // returned by the selector.\n if (subscriber.selector) {\n subscriber.withOnyxInstance.setStateProxy((prevState) => {\n const previousData = prevState[subscriber.statePropertyName];\n const newData = reduceCollectionWithSelector(cachedCollection, subscriber.selector, subscriber.withOnyxInstance.state);\n\n if (!deepEqual(previousData, newData)) {\n return {\n [subscriber.statePropertyName]: newData,\n };\n }\n return null;\n });\n continue;\n }\n\n subscriber.withOnyxInstance.setStateProxy((prevState) => {\n const finalCollection = _.clone(prevState[subscriber.statePropertyName] || {});\n const dataKeys = _.keys(partialCollection);\n for (let j = 0; j < dataKeys.length; j++) {\n const dataKey = dataKeys[j];\n finalCollection[dataKey] = cachedCollection[dataKey];\n }\n\n PerformanceUtils.logSetStateCall(subscriber, prevState[subscriber.statePropertyName], finalCollection, 'keysChanged', collectionKey);\n return {\n [subscriber.statePropertyName]: finalCollection,\n };\n });\n continue;\n }\n\n // If a React component is only interested in a single key then we can set the cached value directly to the state name.\n if (isSubscribedToCollectionMemberKey) {\n // However, we only want to update this subscriber if the partial data contains a change.\n // Otherwise, we would update them with a value they already have and trigger an unnecessary re-render.\n const dataFromCollection = partialCollection[subscriber.key];\n if (_.isUndefined(dataFromCollection)) {\n continue;\n }\n\n // If the subscriber has a selector, then the component's state must only be updated with the data\n // returned by the selector and the state should only change when the subset of data changes from what\n // it was previously.\n if (subscriber.selector) {\n subscriber.withOnyxInstance.setStateProxy((prevState) => {\n const prevData = prevState[subscriber.statePropertyName];\n const newData = getSubsetOfData(cachedCollection[subscriber.key], subscriber.selector, subscriber.withOnyxInstance.state);\n if (!deepEqual(prevData, newData)) {\n PerformanceUtils.logSetStateCall(subscriber, prevData, newData, 'keysChanged', collectionKey);\n return {\n [subscriber.statePropertyName]: newData,\n };\n }\n\n return null;\n });\n continue;\n }\n\n subscriber.withOnyxInstance.setStateProxy((prevState) => {\n const data = cachedCollection[subscriber.key];\n const previousData = prevState[subscriber.statePropertyName];\n\n // Avoids triggering unnecessary re-renders when feeding empty objects\n if (utils.areObjectsEmpty(data, previousData)) {\n return null;\n }\n if (data === previousData) {\n return null;\n }\n\n PerformanceUtils.logSetStateCall(subscriber, previousData, data, 'keysChanged', collectionKey);\n return {\n [subscriber.statePropertyName]: data,\n };\n });\n }\n }\n }\n}\n\n/**\n * When a key change happens, search for any callbacks matching the key or collection key and trigger those callbacks\n *\n * @example\n * keyChanged(key, value, subscriber => subscriber.initWithStoredValues === false)\n *\n * @private\n * @param {String} key\n * @param {*} data\n * @param {Function} [canUpdateSubscriber] only subscribers that pass this truth test will be updated\n * @param {boolean} [notifyRegularSubscibers=true]\n * @param {boolean} [notifyWithOnyxSubscibers=true]\n */\nfunction keyChanged(key, data, canUpdateSubscriber, notifyRegularSubscibers = true, notifyWithOnyxSubscibers = true) {\n // Add or remove this key from the recentlyAccessedKeys lists\n if (!_.isNull(data)) {\n addLastAccessedKey(key);\n } else {\n removeLastAccessedKey(key);\n }\n\n // We are iterating over all subscribers to see if they are interested in the key that has just changed. If the subscriber's key is a collection key then we will\n // notify them if the key that changed is a collection member. Or if it is a regular key notify them when there is an exact match. Depending on whether the subscriber\n // was connected via withOnyx we will call setState() directly on the withOnyx instance. If it is a regular connection we will pass the data to the provided callback.\n const stateMappingKeys = _.keys(callbackToStateMapping);\n for (let i = 0; i < stateMappingKeys.length; i++) {\n const subscriber = callbackToStateMapping[stateMappingKeys[i]];\n if (!subscriber || !isKeyMatch(subscriber.key, key) || (_.isFunction(canUpdateSubscriber) && !canUpdateSubscriber(subscriber))) {\n continue;\n }\n\n // Subscriber is a regular call to connect() and provided a callback\n if (_.isFunction(subscriber.callback)) {\n if (!notifyRegularSubscibers) {\n continue;\n }\n if (isCollectionKey(subscriber.key) && subscriber.waitForCollectionCallback) {\n const cachedCollection = getCachedCollection(subscriber.key);\n cachedCollection[key] = data;\n subscriber.callback(cachedCollection);\n continue;\n }\n\n subscriber.callback(data, key);\n continue;\n }\n\n // Subscriber connected via withOnyx() HOC\n if (subscriber.withOnyxInstance) {\n if (!notifyWithOnyxSubscibers) {\n continue;\n }\n\n // Check if we are subscribing to a collection key and overwrite the collection member key value in state\n if (isCollectionKey(subscriber.key)) {\n // If the subscriber has a selector, then the consumer of this data must only be given the data\n // returned by the selector and only when the selected data has changed.\n if (subscriber.selector) {\n subscriber.withOnyxInstance.setStateProxy((prevState) => {\n const prevData = prevState[subscriber.statePropertyName];\n const newData = {\n [key]: getSubsetOfData(data, subscriber.selector, subscriber.withOnyxInstance.state),\n };\n const prevDataWithNewData = {\n ...prevData,\n ...newData,\n };\n if (!deepEqual(prevData, prevDataWithNewData)) {\n PerformanceUtils.logSetStateCall(subscriber, prevData, newData, 'keyChanged', key);\n return {\n [subscriber.statePropertyName]: prevDataWithNewData,\n };\n }\n return null;\n });\n continue;\n }\n\n subscriber.withOnyxInstance.setStateProxy((prevState) => {\n const collection = prevState[subscriber.statePropertyName] || {};\n const newCollection = {\n ...collection,\n [key]: data,\n };\n PerformanceUtils.logSetStateCall(subscriber, collection, newCollection, 'keyChanged', key);\n return {\n [subscriber.statePropertyName]: newCollection,\n };\n });\n continue;\n }\n\n // If the subscriber has a selector, then the component's state must only be updated with the data\n // returned by the selector and only if the selected data has changed.\n if (subscriber.selector) {\n subscriber.withOnyxInstance.setStateProxy((prevState) => {\n const previousValue = getSubsetOfData(prevState[subscriber.statePropertyName], subscriber.selector, subscriber.withOnyxInstance.state);\n const newValue = getSubsetOfData(data, subscriber.selector, subscriber.withOnyxInstance.state);\n if (!deepEqual(previousValue, newValue)) {\n return {\n [subscriber.statePropertyName]: newValue,\n };\n }\n return null;\n });\n continue;\n }\n\n // If we did not match on a collection key then we just set the new data to the state property\n subscriber.withOnyxInstance.setStateProxy((prevState) => {\n const previousData = prevState[subscriber.statePropertyName];\n\n // Avoids triggering unnecessary re-renders when feeding empty objects\n if (utils.areObjectsEmpty(data, previousData)) {\n return null;\n }\n if (previousData === data) {\n return null;\n }\n\n PerformanceUtils.logSetStateCall(subscriber, previousData, data, 'keyChanged', key);\n return {\n [subscriber.statePropertyName]: data,\n };\n });\n continue;\n }\n\n console.error('Warning: Found a matching subscriber to a key that changed, but no callback or withOnyxInstance could be found.');\n }\n}\n\n/**\n * Sends the data obtained from the keys to the connection. It either:\n * - sets state on the withOnyxInstances\n * - triggers the callback function\n *\n * @private\n * @param {Object} mapping\n * @param {Object} [mapping.withOnyxInstance]\n * @param {String} [mapping.statePropertyName]\n * @param {Function} [mapping.callback]\n * @param {String} [mapping.selector]\n * @param {*|null} val\n * @param {String|undefined} matchedKey\n * @param {Boolean} isBatched\n */\nfunction sendDataToConnection(mapping, val, matchedKey, isBatched) {\n // If the mapping no longer exists then we should not send any data.\n // This means our subscriber disconnected or withOnyx wrapped component unmounted.\n if (!callbackToStateMapping[mapping.connectionID]) {\n return;\n }\n\n if (mapping.withOnyxInstance) {\n let newData = val;\n\n // If the mapping has a selector, then the component's state must only be updated with the data\n // returned by the selector.\n if (mapping.selector) {\n if (isCollectionKey(mapping.key)) {\n newData = reduceCollectionWithSelector(val, mapping.selector, mapping.withOnyxInstance.state);\n } else {\n newData = getSubsetOfData(val, mapping.selector, mapping.withOnyxInstance.state);\n }\n }\n\n PerformanceUtils.logSetStateCall(mapping, null, newData, 'sendDataToConnection');\n if (isBatched) {\n batchUpdates(() => {\n mapping.withOnyxInstance.setWithOnyxState(mapping.statePropertyName, newData);\n });\n } else {\n mapping.withOnyxInstance.setWithOnyxState(mapping.statePropertyName, newData);\n }\n return;\n }\n\n if (_.isFunction(mapping.callback)) {\n mapping.callback(val, matchedKey);\n }\n}\n\n/**\n * We check to see if this key is flagged as safe for eviction and add it to the recentlyAccessedKeys list so that when we\n * run out of storage the least recently accessed key can be removed.\n *\n * @private\n * @param {Object} mapping\n */\nfunction addKeyToRecentlyAccessedIfNeeded(mapping) {\n if (!isSafeEvictionKey(mapping.key)) {\n return;\n }\n\n // Try to free some cache whenever we connect to a safe eviction key\n cache.removeLeastRecentlyUsedKeys();\n\n if (mapping.withOnyxInstance && !isCollectionKey(mapping.key)) {\n // All React components subscribing to a key flagged as a safe eviction key must implement the canEvict property.\n if (_.isUndefined(mapping.canEvict)) {\n throw new Error(\n `Cannot subscribe to safe eviction key '${mapping.key}' without providing a canEvict value.`,\n );\n }\n\n addLastAccessedKey(mapping.key);\n }\n}\n\n/**\n * Gets the data for a given an array of matching keys, combines them into an object, and sends the result back to the subscriber.\n *\n * @private\n * @param {Array} matchingKeys\n * @param {Object} mapping\n */\nfunction getCollectionDataAndSendAsObject(matchingKeys, mapping) {\n Promise.all(_.map(matchingKeys, key => get(key)))\n .then(values => _.reduce(values, (finalObject, value, i) => {\n // eslint-disable-next-line no-param-reassign\n finalObject[matchingKeys[i]] = value;\n return finalObject;\n }, {}))\n .then(val => sendDataToConnection(mapping, val, undefined, true));\n}\n\n/**\n * Subscribes a react component's state directly to a store key\n *\n * @example\n * const connectionID = Onyx.connect({\n * key: ONYXKEYS.SESSION,\n * callback: onSessionChange,\n * });\n *\n * @param {Object} mapping the mapping information to connect Onyx to the components state\n * @param {String} mapping.key ONYXKEY to subscribe to\n * @param {String} [mapping.statePropertyName] the name of the property in the state to connect the data to\n * @param {Object} [mapping.withOnyxInstance] whose setState() method will be called with any changed data\n * This is used by React components to connect to Onyx\n * @param {Function} [mapping.callback] a method that will be called with changed data\n * This is used by any non-React code to connect to Onyx\n * @param {Boolean} [mapping.initWithStoredValues] If set to false, then no data will be prefilled into the\n * component\n * @param {Boolean} [mapping.waitForCollectionCallback] If set to true, it will return the entire collection to the callback as a single object\n * @param {Function} [mapping.selector] THIS PARAM IS ONLY USED WITH withOnyx(). If included, this will be used to subscribe to a subset of an Onyx key's data.\n * The sourceData and withOnyx state are passed to the selector and should return the simplified data. Using this setting on `withOnyx` can have very positive\n * performance benefits because the component will only re-render when the subset of data changes. Otherwise, any change of data on any property would normally\n * cause the component to re-render (and that can be expensive from a performance standpoint).\n * @param {String | Number | Boolean | Object} [mapping.initialValue] THIS PARAM IS ONLY USED WITH withOnyx().\n * If included, this will be passed to the component so that something can be rendered while data is being fetched from the DB.\n * Note that it will not cause the component to have the loading prop set to true. |\n * @returns {Number} an ID to use when calling disconnect\n */\nfunction connect(mapping) {\n const connectionID = lastConnectionID++;\n callbackToStateMapping[connectionID] = mapping;\n callbackToStateMapping[connectionID].connectionID = connectionID;\n\n if (mapping.initWithStoredValues === false) {\n return connectionID;\n }\n\n // Commit connection only after init passes\n deferredInitTask.promise\n .then(() => addKeyToRecentlyAccessedIfNeeded(mapping))\n .then(() => {\n // Performance improvement\n // If the mapping is connected to an onyx key that is not a collection\n // we can skip the call to getAllKeys() and return an array with a single item\n if (Boolean(mapping.key)\n && typeof mapping.key === 'string'\n && !(mapping.key.endsWith('_'))\n && cache.storageKeys.has(mapping.key)\n ) {\n return [mapping.key];\n }\n return getAllKeys();\n })\n .then((keys) => {\n // We search all the keys in storage to see if any are a \"match\" for the subscriber we are connecting so that we\n // can send data back to the subscriber. Note that multiple keys can match as a subscriber could either be\n // subscribed to a \"collection key\" or a single key.\n const matchingKeys = _.filter(keys, key => isKeyMatch(mapping.key, key));\n\n // If the key being connected to does not exist we initialize the value with null. For subscribers that connected\n // directly via connect() they will simply get a null value sent to them without any information about which key matched\n // since there are none matched. In withOnyx() we wait for all connected keys to return a value before rendering the child\n // component. This null value will be filtered out so that the connected component can utilize defaultProps.\n if (matchingKeys.length === 0) {\n // Here we cannot use batching because the null value is expected to be set immediately for default props\n // or they will be undefined.\n sendDataToConnection(mapping, null, undefined, false);\n return;\n }\n\n // When using a callback subscriber we will either trigger the provided callback for each key we find or combine all values\n // into an object and just make a single call. The latter behavior is enabled by providing a waitForCollectionCallback key\n // combined with a subscription to a collection key.\n if (_.isFunction(mapping.callback)) {\n if (isCollectionKey(mapping.key)) {\n if (mapping.waitForCollectionCallback) {\n getCollectionDataAndSendAsObject(matchingKeys, mapping);\n return;\n }\n\n // We did not opt into using waitForCollectionCallback mode so the callback is called for every matching key.\n for (let i = 0; i < matchingKeys.length; i++) {\n get(matchingKeys[i]).then(val => sendDataToConnection(mapping, val, matchingKeys[i], true));\n }\n return;\n }\n\n // If we are not subscribed to a collection key then there's only a single key to send an update for.\n get(mapping.key).then(val => sendDataToConnection(mapping, val, mapping.key, true));\n return;\n }\n\n // If we have a withOnyxInstance that means a React component has subscribed via the withOnyx() HOC and we need to\n // group collection key member data into an object.\n if (mapping.withOnyxInstance) {\n if (isCollectionKey(mapping.key)) {\n getCollectionDataAndSendAsObject(matchingKeys, mapping);\n return;\n }\n\n // If the subscriber is not using a collection key then we just send a single value back to the subscriber\n get(mapping.key).then(val => sendDataToConnection(mapping, val, mapping.key, true));\n return;\n }\n\n console.error('Warning: Onyx.connect() was found without a callback or withOnyxInstance');\n });\n\n // The connectionID is returned back to the caller so that it can be used to clean up the connection when it's no longer needed\n // by calling Onyx.disconnect(connectionID).\n return connectionID;\n}\n\n/**\n * Remove the listener for a react component\n * @example\n * Onyx.disconnect(connectionID);\n *\n * @param {Number} connectionID unique id returned by call to Onyx.connect()\n * @param {String} [keyToRemoveFromEvictionBlocklist]\n */\nfunction disconnect(connectionID, keyToRemoveFromEvictionBlocklist) {\n if (!callbackToStateMapping[connectionID]) {\n return;\n }\n\n // Remove this key from the eviction block list as we are no longer\n // subscribing to it and it should be safe to delete again\n if (keyToRemoveFromEvictionBlocklist) {\n removeFromEvictionBlockList(keyToRemoveFromEvictionBlocklist, connectionID);\n }\n\n delete callbackToStateMapping[connectionID];\n}\n\n/**\n * Schedules an update that will be appended to the macro task queue (so it doesn't update the subscribers immediately).\n *\n * @example\n * scheduleSubscriberUpdate(key, value, subscriber => subscriber.initWithStoredValues === false)\n *\n * @param {String} key\n * @param {*} value\n * @param {Function} [canUpdateSubscriber] only subscribers that pass this truth test will be updated\n * @returns {Promise}\n */\nfunction scheduleSubscriberUpdate(key, value, canUpdateSubscriber) {\n const promise = Promise.resolve().then(() => keyChanged(key, value, canUpdateSubscriber, true, false));\n batchUpdates(() => keyChanged(key, value, canUpdateSubscriber, false, true));\n return Promise.all([maybeFlushBatchUpdates(), promise]);\n}\n\n/**\n * This method is similar to notifySubscribersOnNextTick but it is built for working specifically with collections\n * so that keysChanged() is triggered for the collection and not keyChanged(). If this was not done, then the\n * subscriber callbacks receive the data in a different format than they normally expect and it breaks code.\n *\n * @param {String} key\n * @param {*} value\n * @returns {Promise}\n */\nfunction scheduleNotifyCollectionSubscribers(key, value) {\n const promise = Promise.resolve().then(() => keysChanged(key, value, true, false));\n batchUpdates(() => keysChanged(key, value, false, true));\n return Promise.all([maybeFlushBatchUpdates(), promise]);\n}\n\n/**\n * Remove a key from Onyx and update the subscribers\n *\n * @private\n * @param {String} key\n * @return {Promise}\n */\nfunction remove(key) {\n cache.drop(key);\n scheduleSubscriberUpdate(key, null);\n return Storage.removeItem(key);\n}\n\n/**\n * @private\n * @returns {Promise<void>}\n */\nfunction reportStorageQuota() {\n return Storage.getDatabaseSize()\n .then(({bytesUsed, bytesRemaining}) => {\n Logger.logInfo(`Storage Quota Check -- bytesUsed: ${bytesUsed} bytesRemaining: ${bytesRemaining}`);\n })\n .catch((dbSizeError) => {\n Logger.logAlert(`Unable to get database size. Error: ${dbSizeError}`);\n });\n}\n\n/**\n * If we fail to set or merge we must handle this by\n * evicting some data from Onyx and then retrying to do\n * whatever it is we attempted to do.\n *\n * @private\n * @param {Error} error\n * @param {Function} onyxMethod\n * @param {...any} args\n * @return {Promise}\n */\nfunction evictStorageAndRetry(error, onyxMethod, ...args) {\n Logger.logInfo(`Failed to save to storage. Error: ${error}. onyxMethod: ${onyxMethod.name}`);\n\n if (error && Str.startsWith(error.message, 'Failed to execute \\'put\\' on \\'IDBObjectStore\\'')) {\n Logger.logAlert('Attempted to set invalid data set in Onyx. Please ensure all data is serializable.');\n throw error;\n }\n\n // Find the first key that we can remove that has no subscribers in our blocklist\n const keyForRemoval = _.find(recentlyAccessedKeys, key => !evictionBlocklist[key]);\n if (!keyForRemoval) {\n // If we have no acceptable keys to remove then we are possibly trying to save mission critical data. If this is the case,\n // then we should stop retrying as there is not much the user can do to fix this. Instead of getting them stuck in an infinite loop we\n // will allow this write to be skipped.\n Logger.logAlert('Out of storage. But found no acceptable keys to remove.');\n return reportStorageQuota();\n }\n\n // Remove the least recently viewed key that is not currently being accessed and retry.\n Logger.logInfo(`Out of storage. Evicting least recently accessed key (${keyForRemoval}) and retrying.`);\n reportStorageQuota();\n return remove(keyForRemoval)\n .then(() => onyxMethod(...args));\n}\n\n/**\n * Notifys subscribers and writes current value to cache\n *\n * @param {String} key\n * @param {*} value\n * @param {Boolean} hasChanged\n * @param {String} method\n * @returns {Promise}\n */\nfunction broadcastUpdate(key, value, hasChanged, method) {\n // Logging properties only since values could be sensitive things we don't want to log\n Logger.logInfo(`${method}() called for key: ${key}${_.isObject(value) ? ` properties: ${_.keys(value).join(',')}` : ''}`);\n\n // Update subscribers if the cached value has changed, or when the subscriber specifically requires\n // all updates regardless of value changes (indicated by initWithStoredValues set to false).\n if (hasChanged) {\n cache.set(key, value);\n } else {\n cache.addToAccessedKeys(key);\n }\n\n return scheduleSubscriberUpdate(key, value, subscriber => hasChanged || subscriber.initWithStoredValues === false);\n}\n\n/**\n * @param {String} key\n * @returns {Boolean}\n */\nfunction hasPendingMergeForKey(key) {\n return Boolean(mergeQueue[key]);\n}\n\n/**\n * Removes a key from storage if the value is null.\n * Otherwise removes all nested null values in objects and returns the object\n * @param {String} key\n * @param {Mixed} value\n * @returns {Mixed} `null` if the key got removed completely, otherwise the value without null values\n */\nfunction removeNullValues(key, value) {\n if (_.isNull(value)) {\n remove(key);\n return null;\n }\n\n // We can remove all null values in an object by merging it with itself\n // utils.fastMerge recursively goes through the object and removes all null values\n // Passing two identical objects as source and target to fastMerge will not change it, but only remove the null values\n return utils.removeNestedNullValues(value);\n}\n\n/**\n * Write a value to our store with the given key\n *\n * @param {String} key ONYXKEY to set\n * @param {*} value value to store\n *\n * @returns {Promise}\n */\nfunction set(key, value) {\n const valueWithoutNull = removeNullValues(key, value);\n\n if (valueWithoutNull === null) {\n return Promise.resolve();\n }\n\n if (hasPendingMergeForKey(key)) {\n Logger.logAlert(`Onyx.set() called after Onyx.merge() for key: ${key}. It is recommended to use set() or merge() not both.`);\n }\n\n const hasChanged = cache.hasValueChanged(key, valueWithoutNull);\n\n // This approach prioritizes fast UI changes without waiting for data to be stored in device storage.\n const updatePromise = broadcastUpdate(key, valueWithoutNull, hasChanged, 'set');\n\n // If the value has not changed, calling Storage.setItem() would be redundant and a waste of performance, so return early instead.\n if (!hasChanged) {\n return updatePromise;\n }\n\n return Storage.setItem(key, valueWithoutNull)\n .catch(error => evictStorageAndRetry(error, set, key, valueWithoutNull))\n .then(() => updatePromise);\n}\n\n/**\n * Storage expects array like: [[\"@MyApp_user\", value_1], [\"@MyApp_key\", value_2]]\n * This method transforms an object like {'@MyApp_user': myUserValue, '@MyApp_key': myKeyValue}\n * to an array of key-value pairs in the above format\n * @private\n * @param {Record} data\n * @return {Array} an array of key - value pairs <[key, value]>\n */\nfunction prepareKeyValuePairsForStorage(data) {\n return _.map(data, (value, key) => [key, value]);\n}\n\n/**\n * Sets multiple keys and values\n *\n * @example Onyx.multiSet({'key1': 'a', 'key2': 'b'});\n *\n * @param {Object} data object keyed by ONYXKEYS and the values to set\n * @returns {Promise}\n */\nfunction multiSet(data) {\n const keyValuePairs = prepareKeyValuePairsForStorage(data);\n\n const updatePromises = _.map(data, (val, key) => {\n // Update cache and optimistically inform subscribers on the next tick\n cache.set(key, val);\n return scheduleSubscriberUpdate(key, val);\n });\n\n const keyValuePairsWithoutNull = _.filter(_.map(keyValuePairs, ([key, value]) => {\n const valueWithoutNull = removeNullValues(key, value);\n\n if (valueWithoutNull === null) {\n return;\n }\n return [key, valueWithoutNull];\n }), Boolean);\n\n return Storage.multiSet(keyValuePairsWithoutNull)\n .catch(error => evictStorageAndRetry(error, multiSet, data))\n .then(() => Promise.all(updatePromises));\n}\n\n/**\n * Merges an array of changes with an existing value\n *\n * @private\n * @param {*} existingValue\n * @param {Array<*>} changes Array of changes that should be applied to the existing value\n * @param {Boolean} shouldRemoveNullObjectValues\n * @returns {*}\n */\nfunction applyMerge(existingValue, changes, shouldRemoveNullObjectValues) {\n const lastChange = _.last(changes);\n\n if (_.isArray(lastChange)) {\n return lastChange;\n }\n\n if (_.some(changes, _.isObject)) {\n // Object values are then merged one after the other\n return _.reduce(changes, (modifiedData, change) => utils.fastMerge(modifiedData, change, shouldRemoveNullObjectValues),\n existingValue || {});\n }\n\n // If we have anything else we can't merge it so we'll\n // simply return the last value that was queued\n return lastChange;\n}\n\n/**\n * Merge a new value into an existing value at a key.\n *\n * The types of values that can be merged are `Object` and `Array`. To set another type of value use `Onyx.set()`.\n * Values of type `Object` get merged with the old value, whilst for `Array`'s we simply replace the current value with the new one.\n *\n * Calls to `Onyx.merge()` are batched so that any calls performed in a single tick will stack in a queue and get\n * applied in the order they were called. Note: `Onyx.set()` calls do not work this way so use caution when mixing\n * `Onyx.merge()` and `Onyx.set()`.\n *\n * @example\n * Onyx.merge(ONYXKEYS.EMPLOYEE_LIST, ['Joe']); // -> ['Joe']\n * Onyx.merge(ONYXKEYS.EMPLOYEE_LIST, ['Jack']); // -> ['Joe', 'Jack']\n * Onyx.merge(ONYXKEYS.POLICY, {id: 1}); // -> {id: 1}\n * Onyx.merge(ONYXKEYS.POLICY, {name: 'My Workspace'}); // -> {id: 1, name: 'My Workspace'}\n *\n * @param {String} key ONYXKEYS key\n * @param {(Object|Array)} changes Object or Array value to merge\n * @returns {Promise}\n */\nfunction merge(key, changes) {\n // Top-level undefined values are ignored\n // Therefore we need to prevent adding them to the merge queue\n if (_.isUndefined(changes)) {\n return mergeQueue[key] ? mergeQueuePromise[key] : Promise.resolve();\n }\n\n // Merge attempts are batched together. The delta should be applied after a single call to get() to prevent a race condition.\n // Using the initial value from storage in subsequent merge attempts will lead to an incorrect final merged value.\n if (mergeQueue[key]) {\n mergeQueue[key].push(changes);\n return mergeQueuePromise[key];\n }\n mergeQueue[key] = [changes];\n\n mergeQueuePromise[key] = get(key)\n .then((existingValue) => {\n try {\n // We first only merge the changes, so we can provide these to the native implementation (SQLite uses only delta changes in \"JSON_PATCH\" to merge)\n // We don't want to remove null values from the \"batchedChanges\", because SQLite uses them to remove keys from storage natively.\n let batchedChanges = applyMerge(undefined, mergeQueue[key], false);\n\n if (_.isNull(batchedChanges)) {\n remove(key);\n return;\n }\n\n // The presence of a `null` in the merge queue instructs us to drop the existing value.\n // In this case, we can't simply merge the batched changes with the existing value, because then the null in the merge queue would have no effect\n const shouldOverwriteExistingValue = _.includes(mergeQueue[key], null);\n\n // Clean up the write queue, so we don't apply these changes again\n delete mergeQueue[key];\n delete mergeQueuePromise[key];\n\n // After that we merge the batched changes with the existing value\n // We can remove null values from the \"modifiedData\", because \"null\" implicates that the user wants to remove a value from storage.\n // The \"modifiedData\" will be directly \"set\" in storage instead of being merged\n const modifiedData = shouldOverwriteExistingValue ? batchedChanges : applyMerge(existingValue, [batchedChanges], true);\n\n // On native platforms we use SQLite which utilises JSON_PATCH to merge changes.\n // JSON_PATCH generally removes null values from the stored object.\n // When there is no existing value though, SQLite will just insert the changes as a new value and thus the null values won't be removed.\n // Therefore we need to remove null values from the `batchedChanges` which are sent to the SQLite, if no existing value is present.\n if (!existingValue) {\n batchedChanges = applyMerge(undefined, [batchedChanges], true);\n }\n\n const hasChanged = cache.hasValueChanged(key, modifiedData);\n\n // This approach prioritizes fast UI changes without waiting for data to be stored in device storage.\n const updatePromise = broadcastUpdate(key, modifiedData, hasChanged, 'merge');\n\n // If the value has not changed, calling Storage.setItem() would be redundant and a waste of performance, so return early instead.\n if (!hasChanged) {\n return updatePromise;\n }\n\n return Storage.mergeItem(key, batchedChanges, modifiedData)\n .then(() => updatePromise);\n } catch (error) {\n Logger.logAlert(`An error occurred while applying merge for key: ${key}, Error: ${error}`);\n return Promise.resolve();\n }\n });\n\n return mergeQueuePromise[key];\n}\n\n/**\n * Merge user provided default key value pairs.\n * @private\n * @returns {Promise}\n */\nfunction initializeWithDefaultKeyStates() {\n return Storage.multiGet(_.keys(defaultKeyStates))\n .then((pairs) => {\n const asObject = _.object(pairs);\n\n const merged = utils.fastMerge(asObject, defaultKeyStates);\n cache.merge(merged);\n _.each(merged, (val, key) => keyChanged(key, val));\n });\n}\n\n/**\n * Clear out all the data in the store\n *\n * Note that calling Onyx.clear() and then Onyx.set() on a key with a default\n * key state may store an unexpected value in Storage.\n *\n * E.g.\n * Onyx.clear();\n * Onyx.set(ONYXKEYS.DEFAULT_KEY, 'default');\n * Storage.getItem(ONYXKEYS.DEFAULT_KEY)\n * .then((storedValue) => console.log(storedValue));\n * null is logged instead of the expected 'default'\n *\n * Onyx.set() might call Storage.setItem() before Onyx.clear() calls\n * Storage.setItem(). Use Onyx.merge() instead if possible. Onyx.merge() calls\n * Onyx.get(key) before calling Storage.setItem() via Onyx.set().\n * Storage.setItem() from Onyx.clear() will have already finished and the merged\n * value will be saved to storage after the default value.\n *\n * @param {Array} keysToPreserve is a list of ONYXKEYS that should not be cleared with the rest of the data\n * @returns {Promise<void>}\n */\nfunction clear(keysToPreserve = []) {\n return getAllKeys()\n .then((keys) => {\n const keysToBeClearedFromStorage = [];\n const keyValuesToResetAsCollection = {};\n const keyValuesToResetIndividually = {};\n\n // The only keys that should not be cleared are:\n // 1. Anything specifically passed in keysToPreserve (because some keys like language preferences, offline\n // status, or activeClients need to remain in Onyx even when signed out)\n // 2. Any keys with a default state (because they need to remain in Onyx as their default, and setting them\n // to null would cause unknown behavior)\n _.each(keys, (key) => {\n const isKeyToPreserve = _.contains(keysToPreserve, key);\n const isDefaultKey = _.has(defaultKeyStates, key);\n\n // If the key is being removed or reset to default:\n // 1. Update it in the cache\n // 2. Figure out whether it is a collection key or not,\n // since collection key subscribers need to be updated differently\n if (!isKeyToPreserve) {\n const oldValue = cache.getValue(key);\n const newValue = _.get(defaultKeyStates, key, null);\n if (newValue !== oldValue) {\n cache.set(key, newValue);\n const collectionKey = key.substring(0, key.indexOf('_') + 1);\n if (collectionKey) {\n if (!keyValuesToResetAsCollection[collectionKey]) {\n keyValuesToResetAsCollection[collectionKey] = {};\n }\n keyValuesToResetAsCollection[collectionKey][key] = newValue;\n } else {\n keyValuesToResetIndividually[key] = newValue;\n }\n }\n }\n\n if (isKeyToPreserve || isDefaultKey) {\n return;\n }\n\n // If it isn't preserved and doesn't have a default, we'll remove it\n keysToBeClearedFromStorage.push(key);\n });\n\n const updatePromises = [];\n\n // Notify the subscribers for each key/value group so they can receive the new values\n _.each(keyValuesToResetIndividually, (value, key) => {\n updatePromises.push(scheduleSubscriberUpdate(key, value));\n });\n _.each(keyValuesToResetAsCollection, (value, key) => {\n updatePromises.push(scheduleNotifyCollectionSubscribers(key, value));\n });\n\n const defaultKeyValuePairs = _.pairs(_.omit(defaultKeyStates, keysToPreserve));\n\n // Remove only the items that we want cleared from storage, and reset others to default\n _.each(keysToBeClearedFromStorage, key => cache.drop(key));\n return Storage.removeItems(keysToBeClearedFromStorage).then(() => Storage.multiSet(defaultKeyValuePairs)).then(() => Promise.all(updatePromises));\n });\n}\n\n/**\n * Merges a collection based on their keys\n *\n * @example\n *\n * Onyx.mergeCollection(ONYXKEYS.COLLECTION.REPORT, {\n * [`${ONYXKEYS.COLLECTION.REPORT}1`]: report1,\n * [`${ONYXKEYS.COLLECTION.REPORT}2`]: report2,\n * });\n *\n * @param {String} collectionKey e.g. `ONYXKEYS.COLLECTION.REPORT`\n * @param {Object} collection Object collection keyed by individual collection member keys and values\n * @returns {Promise}\n */\nfunction mergeCollection(collectionKey, collection) {\n if (!_.isObject(collection) || _.isArray(collection) || _.isEmpty(collection)) {\n Logger.logInfo('mergeCollection() called with invalid or empty value. Skipping this update.');\n return Promise.resolve();\n }\n\n // Confirm all the collection keys belong to the same parent\n let hasCollectionKeyCheckFailed = false;\n _.each(collection, (_data, dataKey) => {\n if (isKeyMatch(collectionKey, dataKey)) {\n return;\n }\n\n if (process.env.NODE_ENV === 'development') {\n throw new Error(`Provided collection doesn't have all its data belonging to the same parent. CollectionKey: ${collectionKey}, DataKey: ${dataKey}`);\n }\n\n hasCollectionKeyCheckFailed = true;\n Logger.logAlert(`Provided collection doesn't have all its data belonging to the same parent. CollectionKey: ${collectionKey}, DataKey: ${dataKey}`);\n });\n\n // Gracefully handle bad mergeCollection updates so it doesn't block the merge queue\n if (hasCollectionKeyCheckFailed) {\n return Promise.resolve();\n }\n\n return getAllKeys()\n .then((persistedKeys) => {\n // Split to keys that exist in storage and keys that don't\n const [existingKeys, newKeys] = _.chain(collection)\n .pick((value, key) => {\n if (_.isNull(value)) {\n remove(key);\n return false;\n }\n return true;\n })\n .keys()\n .partition(key => persistedKeys.includes(key))\n .value();\n\n const existingKeyCollection = _.pick(collection, existingKeys);\n const newCollection = _.pick(collection, newKeys);\n const keyValuePairsForExistingCollection = prepareKeyValuePairsForStorage(existingKeyCollection);\n const keyValuePairsForNewCollection = prepareKeyValuePairsForStorage(newCollection);\n\n const promises = [];\n\n // New keys will be added via multiSet while existing keys will be updated using multiMerge\n // This is because setting a key that doesn't exist yet with multiMerge will throw errors\n if (keyValuePairsForExistingCollection.length > 0) {\n promises.push(Storage.multiMerge(keyValuePairsForExistingCollection));\n }\n\n if (keyValuePairsForNewCollection.length > 0) {\n promises.push(Storage.multiSet(keyValuePairsForNewCollection));\n }\n\n // Prefill cache if necessary by calling get() on any existing keys and then merge original data to cache\n // and update all subscribers\n const promiseUpdate = Promise.all(_.map(existingKeys, get)).then(() => {\n cache.merge(collection);\n return scheduleNotifyCollectionSubscribers(collectionKey, collection);\n });\n\n return Promise.all(promises)\n .catch(error => evictStorageAndRetry(error, mergeCollection, collection))\n .then(() => promiseUpdate);\n });\n}\n\n/**\n * Internal recursive function to execute the functions in the correct order\n *\n * @param {Array} data An array of objects with shape {onyxMethod: oneOf('set', 'merge', 'mergeCollection', 'multiSet', 'clear'), key: string, value: *}\n * @returns {Promise<Void>}\n */\nfunction innerUpdate(data) {\n if (data.length === 0) {\n return Promise.resolve();\n }\n\n const {onyxMethod, key, value} = data.shift();\n let promise = Promise.resolve();\n switch (onyxMethod) {\n case METHOD.SET:\n promise = set(key, value);\n break;\n case METHOD.MERGE:\n promise = merge(key, value);\n break;\n case METHOD.MERGE_COLLECTION:\n promise = mergeCollection(key, value);\n break;\n case METHOD.MULTI_SET:\n promise = multiSet(value);\n break;\n case METHOD.CLEAR:\n promise = clear();\n break;\n default:\n break;\n }\n\n return promise.then(() => innerUpdate(data));\n}\n\n/**\n * Insert API responses and lifecycle data into Onyx\n *\n * @param {Array} data An array of objects with shape {onyxMethod: oneOf('set', 'merge', 'mergeCollection', 'multiSet', 'clear'), key: string, value: *}\n * @returns {Promise} resolves when all operations are complete\n */\nfunction update(data) {\n // First, validate the Onyx object is in the format we expect\n const validMethods = [METHOD.CLEAR, METHOD.SET, METHOD.MERGE, METHOD.MERGE_COLLECTION, METHOD.MULTI_SET];\n _.each(data, ({onyxMethod, key, value}) => {\n if (!_.contains(validMethods, onyxMethod)) {\n throw new Error(`Invalid onyxMethod ${onyxMethod} in Onyx update.`);\n }\n if (onyxMethod === METHOD.MULTI_SET) {\n // For multiset, we just expect the value to be an object\n if (!_.isObject(value) || _.isArray(value) || _.isFunction(value)) {\n throw new Error('Invalid value provided in Onyx multiSet. Onyx multiSet value must be of type object.');\n }\n } else if (onyxMethod !== METHOD.CLEAR && !_.isString(key)) {\n throw new Error(`Invalid ${typeof key} key provided in Onyx update. Onyx key must be of type string.`);\n }\n });\n\n // Put clear operation on top\n data.sort(a => (a.onyxMethod === METHOD.CLEAR ? -1 : 1));\n\n return innerUpdate(data);\n}\n\n/**\n * When set these keys will not be persisted to storage\n * @param {string[]} keyList\n */\nfunction setMemoryOnlyKeys(keyList) {\n Storage.setMemoryOnlyKeys(keyList);\n\n // When in memory only mode for certain keys we do not want to ever drop items from the cache as the user will have no way to recover them again via storage.\n cache.setRecentKeysLimit(Infinity);\n}\n\n/**\n * Initialize the store with actions and listening for storage events\n *\n * @param {Object} [options={}] config object\n * @param {Object} [options.keys={}] `ONYXKEYS` constants object\n * @param {Object} [options.initialKeyStates={}] initial data to set when `init()` and `clear()` is called\n * @param {String[]} [options.safeEvictionKeys=[]] This is an array of keys\n * (individual or collection patterns) that when provided to Onyx are flagged\n * as \"safe\" for removal. Any components subscribing to these keys must also\n * implement a canEvict option. See the README for more info.\n * @param {Number} [options.maxCachedKeysCount=55] Sets how many recent keys should we try to keep in cache\n * Setting this to 0 would practically mean no cache\n * We try to free cache when we connect to a safe eviction key\n * @param {Boolean} [options.captureMetrics] Enables Onyx benchmarking and exposes the get/print/reset functions\n * @param {Boolean} [options.shouldSyncMultipleInstances] Auto synchronize storage events between multiple instances\n * of Onyx running in different tabs/windows. Defaults to true for platforms that support local storage (web/desktop)\n * @param {Boolean} [options.debugSetState] Enables debugging setState() calls to connected components.\n * @example\n * Onyx.init({\n * keys: ONYXKEYS,\n * initialKeyStates: {\n * [ONYXKEYS.SESSION]: {loading: false},\n * },\n * });\n */\nfunction init({\n keys = {},\n initialKeyStates = {},\n safeEvictionKeys = [],\n maxCachedKeysCount = 1000,\n captureMetrics = false,\n shouldSyncMultipleInstances = Boolean(global.localStorage),\n debugSetState = false,\n} = {}) {\n if (captureMetrics) {\n // The code here is only bundled and applied when the captureMetrics is set\n // eslint-disable-next-line no-use-before-define\n applyDecorators();\n }\n\n if (debugSetState) {\n PerformanceUtils.setShouldDebugSetState(true);\n }\n\n if (maxCachedKeysCount > 0) {\n cache.setRecentKeysLimit(maxCachedKeysCount);\n }\n\n // We need the value of the collection keys later for checking if a\n // key is a collection. We store it in a map for faster lookup.\n const collectionValues = _.values(keys.COLLECTION);\n onyxCollectionKeyMap = _.reduce(collectionValues, (acc, val) => {\n acc.set(val, true);\n return acc;\n }, new Map());\n\n // Set our default key states to use when initializing and clearing Onyx data\n defaultKeyStates = initialKeyStates;\n\n // Let Onyx know about which keys are safe to evict\n evictionAllowList = safeEvictionKeys;\n\n // Initialize all of our keys with data provided then give green light to any pending connections\n Promise.all([\n addAllSafeEvictionKeysToRecentlyAccessedList(),\n initializeWithDefaultKeyStates(),\n ])\n .then(deferredInitTask.resolve);\n\n if (shouldSyncMultipleInstances && _.isFunction(Storage.keepInstancesSync)) {\n Storage.keepInstancesSync((key, value) => {\n cache.set(key, value);\n keyChanged(key, value);\n });\n }\n}\n\nconst Onyx = {\n connect,\n disconnect,\n set,\n multiSet,\n merge,\n mergeCollection,\n update,\n clear,\n getAllKeys,\n init,\n registerLogger: Logger.registerLogger,\n addToEvictionBlockList,\n removeFromEvictionBlockList,\n isSafeEvictionKey,\n METHOD,\n setMemoryOnlyKeys,\n tryGetCachedValue,\n hasPendingMergeForKey,\n};\n\n/**\n * Apply calls statistic decorators to benchmark Onyx\n *\n * @private\n */\nfunction applyDecorators() {\n // We're requiring the script dynamically here so that it's only evaluated when decorators are used\n const decorate = require('./metrics');\n\n // Re-assign with decorated functions\n /* eslint-disable no-func-assign */\n get = decorate.decorateWithMetrics(get, 'Onyx:get');\n set = decorate.decorateWithMetrics(set, 'Onyx:set');\n multiSet = decorate.decorateWithMetrics(multiSet, 'Onyx:multiSet');\n clear = decorate.decorateWithMetrics(clear, 'Onyx:clear');\n merge = decorate.decorateWithMetrics(merge, 'Onyx:merge');\n mergeCollection = decorate.decorateWithMetrics(mergeCollection, 'Onyx:mergeCollection');\n getAllKeys = decorate.decorateWithMetrics(getAllKeys, 'Onyx:getAllKeys');\n initializeWithDefaultKeyStates = decorate.decorateWithMetrics(initializeWithDefaultKeyStates, 'Onyx:defaults');\n update = decorate.decorateWithMetrics(update, 'Onyx:update');\n /* eslint-enable */\n\n // Re-expose decorated methods\n /* eslint-disable rulesdir/prefer-actions-set-data */\n Onyx.set = set;\n Onyx.multiSet = multiSet;\n Onyx.clear = clear;\n Onyx.merge = merge;\n Onyx.mergeCollection = mergeCollection;\n Onyx.update = update;\n /* eslint-enable */\n\n // Expose stats methods on Onyx\n Onyx.getMetrics = decorate.getMetrics;\n Onyx.resetMetrics = decorate.resetMetrics;\n Onyx.printMetrics = decorate.printMetrics;\n}\n\nexport default Onyx;\n","/**\n * Create a deferred task that can be resolved when we call `resolve()`\n * The returned promise will complete when we call `resolve`\n * Useful when we want to wait for a tasks that is resolved from an external action\n *\n * @template T\n * @returns {{ resolve: function(*), promise: Promise<T|void> }}\n */\nexport default function createDeferredTask() {\n const deferred = {};\n deferred.promise = new Promise((res) => {\n deferred.resolve = res;\n });\n\n return deferred;\n}\n","/**\n * This is a higher order component that provides the ability to map a state property directly to\n * something in Onyx (a key/value store). That way, as soon as data in Onyx changes, the state will be set and the view\n * will automatically change to reflect the new data.\n */\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport _ from 'underscore';\nimport Onyx from './Onyx';\nimport * as Str from './Str';\nimport utils from './utils';\n\n/**\n * Returns the display name of a component\n *\n * @param {object} component\n * @returns {string}\n */\nfunction getDisplayName(component) {\n return component.displayName || component.name || 'Component';\n}\n\n/**\n * Removes all the keys from state that are unrelated to the onyx data being mapped to the component.\n *\n * @param {Object} state of the component\n * @param {Object} onyxToStateMapping the object holding all of the mapping configuration for the component\n * @returns {Object}\n */\nconst getOnyxDataFromState = (state, onyxToStateMapping) => _.pick(state, _.keys(onyxToStateMapping));\n\nexport default function (mapOnyxToState, shouldDelayUpdates = false) {\n // A list of keys that must be present in tempState before we can render the WrappedComponent\n const requiredKeysForInit = _.chain(mapOnyxToState)\n .omit(config => config.initWithStoredValues === false)\n .keys()\n .value();\n return (WrappedComponent) => {\n const displayName = getDisplayName(WrappedComponent);\n class withOnyx extends React.Component {\n pendingSetStates = [];\n\n constructor(props) {\n super(props);\n this.shouldDelayUpdates = shouldDelayUpdates;\n this.setWithOnyxState = this.setWithOnyxState.bind(this);\n this.flushPendingSetStates = this.flushPendingSetStates.bind(this);\n\n // This stores all the Onyx connection IDs to be used when the component unmounts so everything can be\n // disconnected. It is a key value store with the format {[mapping.key]: connectionID}.\n this.activeConnectionIDs = {};\n\n const cachedState = _.reduce(\n mapOnyxToState,\n (resultObj, mapping, propertyName) => {\n const key = Str.result(mapping.key, props);\n let value = Onyx.tryGetCachedValue(key, mapping);\n if (!value && mapping.initialValue) {\n value = mapping.initialValue;\n }\n\n /**\n * If we have a pending merge for a key it could mean that data is being set via Onyx.merge() and someone expects a component to have this data immediately.\n *\n * @example\n *\n * Onyx.merge('report_123', value);\n * Navigation.navigate(route); // Where \"route\" expects the \"value\" to be available immediately once rendered.\n *\n * In reality, Onyx.merge() will only update the subscriber after all merges have been batched and the previous value is retrieved via a get() (returns a promise).\n * So, we won't use the cache optimization here as it will lead us to arbitrarily defer various actions in the application code.\n */\n if (\n (value !== undefined\n && !Onyx.hasPendingMergeForKey(key))\n || mapping.allowStaleData\n ) {\n // eslint-disable-next-line no-param-reassign\n resultObj[propertyName] = value;\n }\n\n return resultObj;\n },\n {},\n );\n\n // If we have all the data we need, then we can render the component immediately\n cachedState.loading = _.size(cachedState) < requiredKeysForInit.length;\n\n // Object holding the temporary initial state for the component while we load the various Onyx keys\n this.tempState = cachedState;\n\n this.state = cachedState;\n }\n\n componentDidMount() {\n // Subscribe each of the state properties to the proper Onyx key\n _.each(mapOnyxToState, (mapping, propertyName) => {\n this.connectMappingToOnyx(mapping, propertyName);\n });\n this.checkEvictableKeys();\n }\n\n componentDidUpdate() {\n // When the state is passed to the key functions with Str.result(), omit anything\n // from state that was not part of the mapped keys.\n const onyxDataFromState = getOnyxDataFromState(this.state, mapOnyxToState);\n\n // If any of the mappings use data from the props, then when the props change, all the\n // connections need to be reconnected with the new props\n _.each(mapOnyxToState, (mapping, propName) => {\n const previousKey = mapping.previousKey;\n const newKey = Str.result(mapping.key, {...this.props, ...onyxDataFromState});\n if (previousKey !== newKey) {\n Onyx.disconnect(this.activeConnectionIDs[previousKey], previousKey);\n delete this.activeConnectionIDs[previousKey];\n this.connectMappingToOnyx(mapping, propName);\n }\n });\n this.checkEvictableKeys();\n }\n\n componentWillUnmount() {\n // Disconnect everything from Onyx\n _.each(mapOnyxToState, (mapping) => {\n const key = Str.result(mapping.key, {...this.props, ...getOnyxDataFromState(this.state, mapOnyxToState)});\n Onyx.disconnect(this.activeConnectionIDs[key], key);\n });\n }\n\n setStateProxy(modifier) {\n if (this.shouldDelayUpdates) {\n this.pendingSetStates.push(modifier);\n } else {\n this.setState(modifier);\n }\n }\n\n /**\n * This method is used by the internal raw Onyx `sendDataToConnection`, it is designed to prevent unnecessary renders while a component\n * still in a \"loading\" (read \"mounting\") state. The temporary initial state is saved to the HOC instance and setState()\n * only called once all the necessary data has been collected.\n *\n * There is however the possibility the component could have been updated by a call to setState()\n * before the data was \"initially\" collected. A race condition.\n * For example some update happened on some key, while onyx was still gathering the initial hydration data.\n * This update is disptached directly to setStateProxy and therefore the component has the most up-to-date data\n *\n * This is a design flaw in Onyx itself as dispatching updates before initial hydration is not a correct event flow.\n * We however need to workaround this issue in the HOC. The addition of initialValue makes things even more complex,\n * since you cannot be really sure if the component has been updated before or after the initial hydration. Therefore if\n * initialValue is there, we just check if the update is different than that and then try to handle it as best as we can.\n *\n * @param {String} statePropertyName\n * @param {*} val\n */\n setWithOnyxState(statePropertyName, val) {\n const prevValue = this.state[statePropertyName];\n\n // If the component is not loading (read \"mounting\"), then we can just update the state\n // There is a small race condition.\n // When calling setWithOnyxState we delete the tempState object that is used to hold temporary state updates while the HOC is gathering data.\n // However the loading flag is only set on the setState callback down below. setState however is an async operation that is also batched,\n // therefore there is a small window of time where the loading flag is not false but the tempState is already gone\n // (while the update is queued and waiting to be applied).\n // This simply bypasses the loading check if the tempState is gone and the update can be safely queued with a normal setStateProxy.\n if (!this.state.loading || !this.tempState) {\n // Performance optimization, do not trigger update with same values\n if (prevValue === val || utils.areObjectsEmpty(prevValue, val)) {\n return;\n }\n\n this.setStateProxy({[statePropertyName]: val});\n return;\n }\n\n this.tempState[statePropertyName] = val;\n\n // If some key does not have a value yet, do not update the state yet\n const tempStateIsMissingKey = _.some(requiredKeysForInit, key => _.isUndefined(this.tempState[key]));\n if (tempStateIsMissingKey) {\n return;\n }\n\n const stateUpdate = {...this.tempState};\n delete this.tempState;\n\n // Full of hacky workarounds to prevent the race condition described above.\n this.setState((prevState) => {\n const finalState = _.reduce(stateUpdate, (result, value, key) => {\n if (key === 'loading') {\n return result;\n }\n\n const initialValue = mapOnyxToState[key].initialValue;\n\n // If initialValue is there and the state contains something different it means\n // an update has already been received and we can discard the value we are trying to hydrate\n if (!_.isUndefined(initialValue) && !_.isUndefined(prevState[key]) && prevState[key] !== initialValue) {\n // eslint-disable-next-line no-param-reassign\n result[key] = prevState[key];\n\n // if value is already there (without initial value) then we can discard the value we are trying to hydrate\n } else if (!_.isUndefined(prevState[key])) {\n // eslint-disable-next-line no-param-reassign\n result[key] = prevState[key];\n } else {\n // eslint-disable-next-line no-param-reassign\n result[key] = value;\n }\n return result;\n }, {});\n\n finalState.loading = false;\n return finalState;\n });\n }\n\n /**\n * Makes sure each Onyx key we requested has been set to state with a value of some kind.\n * We are doing this so that the wrapped component will only render when all the data\n * it needs is available to it.\n */\n checkEvictableKeys() {\n // We will add this key to our list of recently accessed keys\n // if the canEvict function returns true. This is necessary criteria\n // we MUST use to specify if a key can be removed or not.\n _.each(mapOnyxToState, (mapping) => {\n if (_.isUndefined(mapping.canEvict)) {\n return;\n }\n\n const canEvict = Str.result(mapping.canEvict, this.props);\n const key = Str.result(mapping.key, this.props);\n\n if (!Onyx.isSafeEvictionKey(key)) {\n throw new Error(`canEvict can't be used on key '${key}'. This key must explicitly be flagged as safe for removal by adding it to Onyx.init({safeEvictionKeys: []}).`);\n }\n\n if (canEvict) {\n Onyx.removeFromEvictionBlockList(key, mapping.connectionID);\n } else {\n Onyx.addToEvictionBlockList(key, mapping.connectionID);\n }\n });\n }\n\n /**\n * Takes a single mapping and binds the state of the component to the store\n *\n * @param {object} mapping\n * @param {string|function} mapping.key key to connect to. can be a string or a\n * function that takes this.props as an argument and returns a string\n * @param {string} statePropertyName the name of the state property that Onyx will add the data to\n * @param {boolean} [mapping.initWithStoredValues] If set to false, then no data will be prefilled into the\n * component\n */\n connectMappingToOnyx(mapping, statePropertyName) {\n const key = Str.result(mapping.key, {...this.props, ...getOnyxDataFromState(this.state, mapOnyxToState)});\n\n // Remember the previous key so that if it ever changes, the component will reconnect to Onyx\n // in componentDidUpdate\n if (statePropertyName !== 'initialValue' && mapOnyxToState[statePropertyName]) {\n // eslint-disable-next-line no-param-reassign\n mapOnyxToState[statePropertyName].previousKey = key;\n }\n\n // eslint-disable-next-line rulesdir/prefer-onyx-connect-in-libs\n this.activeConnectionIDs[key] = Onyx.connect({\n ...mapping,\n key,\n statePropertyName,\n withOnyxInstance: this,\n displayName,\n });\n }\n\n flushPendingSetStates() {\n if (!this.shouldDelayUpdates) {\n return;\n }\n\n this.shouldDelayUpdates = false;\n\n this.pendingSetStates.forEach((modifier) => {\n this.setState(modifier);\n });\n this.pendingSetStates = [];\n }\n\n render() {\n // Remove any null values so that React replaces them with default props\n const propsToPass = _.omit(this.props, _.isNull);\n\n if (this.state.loading) {\n return null;\n }\n\n // Remove any internal state properties used by withOnyx\n // that should not be passed to a wrapped component\n let stateToPass = _.omit(this.state, 'loading');\n stateToPass = _.omit(stateToPass, _.isNull);\n\n // Spreading props and state is necessary in an HOC where the data cannot be predicted\n return (\n <WrappedComponent\n markReadyForHydration={this.flushPendingSetStates}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...propsToPass}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...stateToPass}\n ref={this.props.forwardedRef}\n />\n );\n }\n }\n\n withOnyx.propTypes = {\n forwardedRef: PropTypes.oneOfType([\n PropTypes.func,\n // eslint-disable-next-line react/forbid-prop-types\n PropTypes.shape({current: PropTypes.object}),\n ]),\n };\n withOnyx.defaultProps = {\n forwardedRef: undefined,\n };\n withOnyx.displayName = `withOnyx(${displayName})`;\n return React.forwardRef((props, ref) => {\n const Component = withOnyx;\n // eslint-disable-next-line react/jsx-props-no-spreading\n return <Component {...props} forwardedRef={ref} />;\n });\n };\n}\n","import Onyx from './Onyx';\nimport withOnyx from './withOnyx';\n\nexport default Onyx;\nexport {withOnyx};\n"],"names":["root","factory","exports","module","require","define","amd","self","__WEBPACK_EXTERNAL_MODULE__746__","__WEBPACK_EXTERNAL_MODULE__952__","__WEBPACK_EXTERNAL_MODULE__111__","__WEBPACK_EXTERNAL_MODULE__802__","__WEBPACK_EXTERNAL_MODULE__407__","__WEBPACK_EXTERNAL_MODULE__156__","decorateWithMetrics","func","getMetrics","printMetrics","resetMetrics","ReactPropTypesSecret","emptyFunction","emptyFunctionWithReset","resetWarningCache","shim","props","propName","componentName","location","propFullName","secret","err","Error","name","getShim","isRequired","ReactPropTypes","array","bool","number","object","string","symbol","any","arrayOf","element","elementType","instanceOf","node","objectOf","oneOf","oneOfType","shape","exact","checkPropTypes","PropTypes","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","g","globalThis","this","Function","e","window","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","logger","logAlert","message","level","logInfo","isMergeableObject","val","toString","Array","isArray","fastMerge","target","source","shouldRemoveNullObjectValues","arguments","length","_","destination","targetKeys","keys","i","isSourceOrTargetNull","sourceKeys","shouldOmitSourceKey","isSourceKeyMergable","mergeObject","areObjectsEmpty","b","removeNestedNullValues","isDefined","constructor","storageKeys","Set","recentKeys","storageMap","pendingPromises","Map","getAllKeys","from","getValue","addToAccessedKeys","hasCacheForKey","addKey","add","set","drop","delete","merge","data","assign","utils","mergedKeys","hasPendingTask","taskName","getTaskPromise","captureTask","promise","returnPromise","finally","removeLeastRecentlyUsedKeys","numKeysToRemove","size","maxRecentKeysSize","iterator","values","temp","next","push","setRecentKeysLimit","limit","hasValueChanged","deepEqual","startsWith","haystack","needle","result","parameter","_len","args","_key","debugSetState","setShouldDebugSetState","debug","logSetStateCall","mapping","previousValue","newValue","caller","keyThatChanged","logParams","difference","changes","comparisonObject","lodashTransform","console","displayName","customStoreInstance","getCustomStore","createStore","provider","setItem","multiGet","keysParam","getMany","then","index","multiMerge","pairs","store","Promise","all","_ref","promisifyRequest","upsertMany","_ref2","prev","put","mergeItem","_changes","modifiedData","multiSet","setMany","clear","setMemoryOnlyKeys","getItem","removeItem","del","removeItems","delMany","getDatabaseSize","navigator","storage","estimate","bytesUsed","usage","bytesRemaining","quota","catch","error","SYNC_ONYX","raiseStorageSyncEvent","onyxKey","global","localStorage","Storage","keepInstancesSync","onStorageKeyChanged","raiseStorageSyncManyKeysEvent","onyxKeys","batchedChanges","allKeys","addEventListener","event","METHOD","SET","MERGE","MERGE_COLLECTION","MULTI_SET","CLEAR","mergeQueue","mergeQueuePromise","lastConnectionID","callbackToStateMapping","onyxCollectionKeyMap","recentlyAccessedKeys","evictionAllowList","evictionBlocklist","defaultKeyStates","deferredInitTask","deferred","res","resolve","createDeferredTask","batchUpdatesPromise","batchUpdatesQueue","maybeFlushBatchUpdates","setTimeout","updatesCopy","unstable_batchedUpdates","forEach","applyUpdates","batchUpdates","updates","getSubsetOfData","sourceData","selector","withOnyxInstanceState","reduceCollectionWithSelector","collection","finalCollection","item","cache","Logger","storedKeys","isCollectionKey","has","isCollectionMemberKey","collectionKey","Str","isKeyMatch","configKey","isSafeEvictionKey","testKey","removeLastAccessedKey","addLastAccessedKey","removeFromEvictionBlockList","connectionID","getCachedCollection","collectionMemberKeys","storedKey","curr","cachedValue","keysChanged","partialCollection","notifyRegularSubscibers","notifyWithOnyxSubscibers","stateMappingKeys","subscriber","isSubscribedToCollectionKey","isSubscribedToCollectionMemberKey","cachedCollection","callback","waitForCollectionCallback","dataKeys","j","dataKey","withOnyxInstance","setStateProxy","prevState","previousData","statePropertyName","newData","state","PerformanceUtils","dataFromCollection","prevData","keyChanged","canUpdateSubscriber","prevDataWithNewData","newCollection","sendDataToConnection","matchedKey","isBatched","setWithOnyxState","getCollectionDataAndSendAsObject","matchingKeys","finalObject","scheduleSubscriberUpdate","scheduleNotifyCollectionSubscribers","remove","reportStorageQuota","dbSizeError","evictStorageAndRetry","onyxMethod","keyForRemoval","broadcastUpdate","hasChanged","method","join","initWithStoredValues","hasPendingMergeForKey","Boolean","removeNullValues","valueWithoutNull","updatePromise","prepareKeyValuePairsForStorage","keyValuePairs","updatePromises","keyValuePairsWithoutNull","applyMerge","existingValue","lastChange","change","shouldOverwriteExistingValue","initializeWithDefaultKeyStates","asObject","merged","keysToPreserve","keysToBeClearedFromStorage","keyValuesToResetAsCollection","keyValuesToResetIndividually","isKeyToPreserve","isDefaultKey","oldValue","substring","indexOf","defaultKeyValuePairs","mergeCollection","hasCollectionKeyCheckFailed","_data","persistedKeys","existingKeys","newKeys","pick","partition","includes","existingKeyCollection","keyValuePairsForExistingCollection","keyValuePairsForNewCollection","promises","promiseUpdate","innerUpdate","shift","update","validMethods","_ref3","sort","Onyx","connect","canEvict","addKeyToRecentlyAccessedIfNeeded","endsWith","disconnect","keyToRemoveFromEvictionBlocklist","init","initialKeyStates","safeEvictionKeys","maxCachedKeysCount","captureMetrics","shouldSyncMultipleInstances","decorate","applyDecorators","collectionValues","COLLECTION","acc","safeEvictionKey","registerLogger","addToEvictionBlockList","keyList","Infinity","tryGetCachedValue","k","getOnyxDataFromState","onyxToStateMapping","mapOnyxToState","shouldDelayUpdates","requiredKeysForInit","omit","config","WrappedComponent","component","withOnyx","React","super","bind","flushPendingSetStates","activeConnectionIDs","cachedState","resultObj","propertyName","initialValue","allowStaleData","loading","tempState","componentDidMount","connectMappingToOnyx","checkEvictableKeys","componentDidUpdate","onyxDataFromState","previousKey","componentWillUnmount","modifier","pendingSetStates","setState","prevValue","stateUpdate","finalState","render","propsToPass","stateToPass","_extends","markReadyForHydration","ref","forwardedRef","propTypes","current","defaultProps","Component"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"web.min.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,eAAgBA,QAAQ,cAAeA,QAAQ,aAAcA,QAAQ,cAAeA,QAAQ,oBAAqBA,QAAQ,UACjI,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,CAAC,cAAe,aAAc,YAAa,aAAc,mBAAoB,SAAUJ,GACpE,iBAAZC,QACdA,QAAQ,yBAA2BD,EAAQG,QAAQ,eAAgBA,QAAQ,cAAeA,QAAQ,aAAcA,QAAQ,cAAeA,QAAQ,oBAAqBA,QAAQ,UAE5KJ,EAAK,yBAA2BC,EAAQD,EAAK,eAAgBA,EAAiB,WAAGA,EAAK,aAAcA,EAAK,cAAeA,EAAK,oBAAqBA,EAAY,MAC/J,CATD,CASGO,MAAM,CAACC,EAAkCC,EAAkCC,EAAkCC,EAAkCC,EAAkCC,I,wCCPpL,SAASC,EAAoBC,GAAQ,OAAOA,CAAM,CAClD,SAASC,IAAc,CACvB,SAASC,IAAgB,CACzB,SAASC,IAAgB,C,6HCIzB,IAAIC,EAAuB,EAAQ,KAEnC,SAASC,IAAiB,CAC1B,SAASC,IAA0B,CACnCA,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EAAQzG,IAAK,IAAIQ,KAAKnD,SAAU2Y,GAAqBxV,KAAKqP,MAAOqG,KAI9D,iBAAtBvG,GAAwCuG,EAAevG,KAEvDuG,EAAevG,GAAmBgI,YAAc3X,GAIpDQ,KAAKsW,oBAAoB9W,GAAOuU,GAAAA,QAAa,IACtC9N,EACHzG,MACA2P,oBACAJ,iBAAkB/O,KAClB4G,eAER,CAEAyP,wBACSrW,KAAK2V,qBAIV3V,KAAK2V,oBAAqB,EAE1B3V,KAAKsX,iBAAiBtL,SAASqL,IAC3BrX,KAAKuX,SAASF,EAAS,IAE3BrX,KAAKsX,iBAAmB,GAC5B,CAEAK,SAEI,MAAMC,EAAc/V,IAAAA,KAAO7B,KAAKnD,MAAOgF,IAAAA,QAEvC,GAAI7B,KAAKqP,MAAMuH,QACX,OAAO,KAKX,IAAIiB,EAAchW,IAAAA,KAAO7B,KAAKqP,MAAO,WAIrC,OAHAwI,EAAchW,IAAAA,KAAOgW,EAAahW,IAAAA,QAI9BqU,KAAAA,cAACH,EAAgB+B,GAAA,CACbC,sBAAuB/X,KAAKqW,uBAExBuB,EAEAC,EAAW,CACfG,IAAKhY,KAAKnD,MAAMob,eAG5B,EAcJ,OAXAhC,EAASiC,UAAY,CACjBD,aAActZ,KAAAA,UAAoB,CAC9BA,KAAAA,KAEAA,KAAAA,MAAgB,CAACwZ,QAASxZ,KAAAA,YAGlCsX,EAASmC,aAAe,CACpBH,kBAAcjZ,GAElBiX,EAASrP,YAAe,YAAWA,KAC5BsP,KAAAA,YAAiB,CAACrZ,EAAOmb,KAC5B,MAAMK,EAAYpC,EAElB,OAAOC,KAAAA,cAACmC,EAASP,GAAA,GAAKjb,EAAK,CAAEob,aAAcD,IAAO,GACpD,CAEV,CC3UA,W","sources":["webpack://react-native-onyx/web/webpack/universalModuleDefinition","webpack://react-native-onyx/web/./lib/metrics/index.web.js","webpack://react-native-onyx/web/./node_modules/prop-types/factoryWithThrowingShims.js","webpack://react-native-onyx/web/./node_modules/prop-types/index.js","webpack://react-native-onyx/web/./node_modules/prop-types/lib/ReactPropTypesSecret.js","webpack://react-native-onyx/web/external umd \"fast-equals\"","webpack://react-native-onyx/web/external umd \"idb-keyval\"","webpack://react-native-onyx/web/external umd \"lodash/transform\"","webpack://react-native-onyx/web/external umd \"react\"","webpack://react-native-onyx/web/external umd \"react-dom\"","webpack://react-native-onyx/web/external umd \"underscore\"","webpack://react-native-onyx/web/webpack/bootstrap","webpack://react-native-onyx/web/webpack/runtime/compat get default export","webpack://react-native-onyx/web/webpack/runtime/define property getters","webpack://react-native-onyx/web/webpack/runtime/global","webpack://react-native-onyx/web/webpack/runtime/hasOwnProperty shorthand","webpack://react-native-onyx/web/webpack/runtime/make namespace object","webpack://react-native-onyx/web/./lib/Logger.js","webpack://react-native-onyx/web/./lib/utils.js","webpack://react-native-onyx/web/./lib/OnyxCache.js","webpack://react-native-onyx/web/./lib/Str.js","webpack://react-native-onyx/web/./lib/metrics/PerformanceUtils.js","webpack://react-native-onyx/web/./lib/storage/providers/IDBKeyVal.js","webpack://react-native-onyx/web/./lib/storage/WebStorage.js","webpack://react-native-onyx/web/./lib/storage/index.web.js","webpack://react-native-onyx/web/./lib/batch.js","webpack://react-native-onyx/web/./lib/Onyx.js","webpack://react-native-onyx/web/./lib/createDeferredTask.js","webpack://react-native-onyx/web/./lib/withOnyx.js","webpack://react-native-onyx/web/./lib/index.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"fast-equals\"), require(\"underscore\"), require(\"react-dom\"), require(\"idb-keyval\"), require(\"lodash/transform\"), require(\"react\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"fast-equals\", \"underscore\", \"react-dom\", \"idb-keyval\", \"lodash/transform\", \"react\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"react-native-onyx/web\"] = factory(require(\"fast-equals\"), require(\"underscore\"), require(\"react-dom\"), require(\"idb-keyval\"), require(\"lodash/transform\"), require(\"react\"));\n\telse\n\t\troot[\"react-native-onyx/web\"] = factory(root[\"fast-equals\"], root[\"underscore\"], root[\"react-dom\"], root[\"idb-keyval\"], root[\"lodash/transform\"], root[\"react\"]);\n})(self, (__WEBPACK_EXTERNAL_MODULE__746__, __WEBPACK_EXTERNAL_MODULE__952__, __WEBPACK_EXTERNAL_MODULE__111__, __WEBPACK_EXTERNAL_MODULE__802__, __WEBPACK_EXTERNAL_MODULE__407__, __WEBPACK_EXTERNAL_MODULE__156__) => {\nreturn ","// For web-only implementations of Onyx, this module will just be a no-op\n\nfunction decorateWithMetrics(func) { return func; }\nfunction getMetrics() {}\nfunction printMetrics() {}\nfunction resetMetrics() {}\n\nexport {\n decorateWithMetrics,\n getMetrics,\n resetMetrics,\n printMetrics,\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\n\nfunction emptyFunction() {}\nfunction emptyFunctionWithReset() {}\nemptyFunctionWithReset.resetWarningCache = emptyFunction;\n\nmodule.exports = function() {\n function shim(props, propName, componentName, location, propFullName, secret) {\n if (secret === ReactPropTypesSecret) {\n // It is still safe when called from React.\n return;\n }\n var err = new Error(\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use PropTypes.checkPropTypes() to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n err.name = 'Invariant Violation';\n throw err;\n };\n shim.isRequired = shim;\n function getShim() {\n return shim;\n };\n // Important!\n // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n var ReactPropTypes = {\n array: shim,\n bool: shim,\n func: shim,\n number: shim,\n object: shim,\n string: shim,\n symbol: shim,\n\n any: shim,\n arrayOf: getShim,\n element: shim,\n elementType: shim,\n instanceOf: getShim,\n node: shim,\n objectOf: getShim,\n oneOf: getShim,\n oneOfType: getShim,\n shape: getShim,\n exact: getShim,\n\n checkPropTypes: emptyFunctionWithReset,\n resetWarningCache: emptyFunction\n };\n\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (process.env.NODE_ENV !== 'production') {\n var ReactIs = require('react-is');\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = require('./factoryWithThrowingShims')();\n}\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n","module.exports = __WEBPACK_EXTERNAL_MODULE__746__;","module.exports = __WEBPACK_EXTERNAL_MODULE__802__;","module.exports = __WEBPACK_EXTERNAL_MODULE__407__;","module.exports = __WEBPACK_EXTERNAL_MODULE__156__;","module.exports = __WEBPACK_EXTERNAL_MODULE__111__;","module.exports = __WEBPACK_EXTERNAL_MODULE__952__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// Logging callback\nlet logger = () => {};\n\n/**\n * Register the logging callback\n *\n * @param {Function} callback\n */\nfunction registerLogger(callback) {\n logger = callback;\n}\n\n/**\n * Send an alert message to the logger\n *\n * @param {String} message\n */\nfunction logAlert(message) {\n logger({message: `[Onyx] ${message}`, level: 'alert'});\n}\n\n/**\n * Send an info message to the logger\n *\n * @param {String} message\n */\nfunction logInfo(message) {\n logger({message: `[Onyx] ${message}`, level: 'info'});\n}\n\nexport {\n registerLogger,\n logInfo,\n logAlert,\n};\n","import _ from 'underscore';\n\nfunction areObjectsEmpty(a, b) {\n return (\n typeof a === 'object'\n && typeof b === 'object'\n && _.isEmpty(a)\n && _.isEmpty(b)\n );\n}\n\n// Mostly copied from https://medium.com/@lubaka.a/how-to-remove-lodash-performance-improvement-b306669ad0e1\n\n/**\n * @param {mixed} val\n * @returns {boolean}\n*/\nfunction isMergeableObject(val) {\n const nonNullObject = val != null ? typeof val === 'object' : false;\n return (nonNullObject\n && Object.prototype.toString.call(val) !== '[object RegExp]'\n && Object.prototype.toString.call(val) !== '[object Date]')\n // eslint-disable-next-line rulesdir/prefer-underscore-method\n && !Array.isArray(val);\n}\n\n/**\n* @param {Object} target\n* @param {Object} source\n* @param {Boolean} shouldRemoveNullObjectValues\n* @returns {Object}\n*/\nfunction mergeObject(target, source, shouldRemoveNullObjectValues = true) {\n const destination = {};\n if (isMergeableObject(target)) {\n // lodash adds a small overhead so we don't use it here\n // eslint-disable-next-line rulesdir/prefer-underscore-method\n const targetKeys = Object.keys(target);\n for (let i = 0; i < targetKeys.length; ++i) {\n const key = targetKeys[i];\n\n // If shouldRemoveNullObjectValues is true, we want to remove null values from the merged object\n const isSourceOrTargetNull = target[key] === null || source[key] === null;\n const shouldOmitSourceKey = shouldRemoveNullObjectValues && isSourceOrTargetNull;\n\n if (!shouldOmitSourceKey) {\n destination[key] = target[key];\n }\n }\n }\n\n // lodash adds a small overhead so we don't use it here\n // eslint-disable-next-line rulesdir/prefer-underscore-method\n const sourceKeys = Object.keys(source);\n for (let i = 0; i < sourceKeys.length; ++i) {\n const key = sourceKeys[i];\n\n // If shouldRemoveNullObjectValues is true, we want to remove null values from the merged object\n const shouldOmitSourceKey = shouldRemoveNullObjectValues && source[key] === null;\n\n // If we pass undefined as the updated value for a key, we want to generally ignore it\n const isSourceKeyUndefined = source[key] === undefined;\n\n if (!isSourceKeyUndefined && !shouldOmitSourceKey) {\n const isSourceKeyMergable = isMergeableObject(source[key]);\n\n if (isSourceKeyMergable && target[key]) {\n if ((!shouldRemoveNullObjectValues || isSourceKeyMergable)) {\n // eslint-disable-next-line no-use-before-define\n destination[key] = fastMerge(target[key], source[key], shouldRemoveNullObjectValues);\n }\n } else if (!shouldRemoveNullObjectValues || source[key] !== null) {\n destination[key] = source[key];\n }\n }\n }\n\n return destination;\n}\n\n/**\n * Merges two objects and removes null values if \"shouldRemoveNullObjectValues\" is set to true\n *\n * We generally want to remove null values from objects written to disk and cache, because it decreases the amount of data stored in memory and on disk.\n * On native, when merging an existing value with new changes, SQLite will use JSON_PATCH, which removes top-level nullish values.\n * To be consistent with the behaviour for merge, we'll also want to remove null values for \"set\" operations.\n *\n* @param {Object|Array} target\n* @param {Object|Array} source\n* @param {Boolean} shouldRemoveNullObjectValues\n* @returns {Object|Array}\n*/\nfunction fastMerge(target, source, shouldRemoveNullObjectValues = true) {\n // We have to ignore arrays and nullish values here,\n // otherwise \"mergeObject\" will throw an error,\n // because it expects an object as \"source\"\n if (_.isArray(source) || source === null || source === undefined) {\n return source;\n }\n return mergeObject(target, source, shouldRemoveNullObjectValues);\n}\n\nfunction removeNestedNullValues(value) {\n if (typeof value === 'object' && !_.isArray(value)) {\n return fastMerge(value, value);\n }\n\n return value;\n}\n\nexport default {areObjectsEmpty, fastMerge, removeNestedNullValues};\n","import _ from 'underscore';\nimport {deepEqual} from 'fast-equals';\nimport utils from './utils';\n\nconst isDefined = _.negate(_.isUndefined);\n\n/**\n * In memory cache providing data by reference\n * Encapsulates Onyx cache related functionality\n */\nclass OnyxCache {\n constructor() {\n /**\n * @private\n * Cache of all the storage keys available in persistent storage\n * @type {Set<string>}\n */\n this.storageKeys = new Set();\n\n /**\n * @private\n * Unique list of keys maintained in access order (most recent at the end)\n * @type {Set<string>}\n */\n this.recentKeys = new Set();\n\n /**\n * @private\n * A map of cached values\n * @type {Record<string, *>}\n */\n this.storageMap = {};\n\n /**\n * @private\n * Captured pending tasks for already running storage methods\n * Using a map yields better performance on operations such a delete\n * https://www.zhenghao.io/posts/object-vs-map\n * @type {Map<string, Promise>}\n */\n this.pendingPromises = new Map();\n\n // bind all public methods to prevent problems with `this`\n _.bindAll(\n this,\n 'getAllKeys', 'getValue', 'hasCacheForKey', 'addKey', 'set', 'drop', 'merge',\n 'hasPendingTask', 'getTaskPromise', 'captureTask', 'removeLeastRecentlyUsedKeys',\n 'setRecentKeysLimit',\n );\n }\n\n /**\n * Get all the storage keys\n * @returns {string[]}\n */\n getAllKeys() {\n return Array.from(this.storageKeys);\n }\n\n /**\n * Get a cached value from storage\n * @param {string} key\n * @returns {*}\n */\n getValue(key) {\n this.addToAccessedKeys(key);\n return this.storageMap[key];\n }\n\n /**\n * Check whether cache has data for the given key\n * @param {string} key\n * @returns {boolean}\n */\n hasCacheForKey(key) {\n return isDefined(this.storageMap[key]);\n }\n\n /**\n * Saves a key in the storage keys list\n * Serves to keep the result of `getAllKeys` up to date\n * @param {string} key\n */\n addKey(key) {\n this.storageKeys.add(key);\n }\n\n /**\n * Set's a key value in cache\n * Adds the key to the storage keys list as well\n * @param {string} key\n * @param {*} value\n * @returns {*} value - returns the cache value\n */\n set(key, value) {\n this.addKey(key);\n this.addToAccessedKeys(key);\n this.storageMap[key] = value;\n\n return value;\n }\n\n /**\n * Forget the cached value for the given key\n * @param {string} key\n */\n drop(key) {\n delete this.storageMap[key];\n this.storageKeys.delete(key);\n this.recentKeys.delete(key);\n }\n\n /**\n * Deep merge data to cache, any non existing keys will be created\n * @param {Record<string, *>} data - a map of (cache) key - values\n */\n merge(data) {\n if (!_.isObject(data) || _.isArray(data)) {\n throw new Error('data passed to cache.merge() must be an Object of onyx key/value pairs');\n }\n\n // lodash adds a small overhead so we don't use it here\n // eslint-disable-next-line prefer-object-spread, rulesdir/prefer-underscore-method\n this.storageMap = Object.assign({}, utils.fastMerge(this.storageMap, data));\n\n const storageKeys = this.getAllKeys();\n const mergedKeys = _.keys(data);\n this.storageKeys = new Set([...storageKeys, ...mergedKeys]);\n _.each(mergedKeys, key => this.addToAccessedKeys(key));\n }\n\n /**\n * Check whether the given task is already running\n * @param {string} taskName - unique name given for the task\n * @returns {*}\n */\n hasPendingTask(taskName) {\n return isDefined(this.pendingPromises.get(taskName));\n }\n\n /**\n * Use this method to prevent concurrent calls for the same thing\n * Instead of calling the same task again use the existing promise\n * provided from this function\n * @template T\n * @param {string} taskName - unique name given for the task\n * @returns {Promise<T>}\n */\n getTaskPromise(taskName) {\n return this.pendingPromises.get(taskName);\n }\n\n /**\n * Capture a promise for a given task so other caller can\n * hook up to the promise if it's still pending\n * @template T\n * @param {string} taskName - unique name for the task\n * @param {Promise<T>} promise\n * @returns {Promise<T>}\n */\n captureTask(taskName, promise) {\n const returnPromise = promise.finally(() => {\n this.pendingPromises.delete(taskName);\n });\n\n this.pendingPromises.set(taskName, returnPromise);\n\n return returnPromise;\n }\n\n /**\n * @private\n * Adds a key to the top of the recently accessed keys\n * @param {string} key\n */\n addToAccessedKeys(key) {\n // Removing and re-adding a key ensures it's at the end of the list\n this.recentKeys.delete(key);\n this.recentKeys.add(key);\n }\n\n /**\n * Remove keys that don't fall into the range of recently used keys\n */\n removeLeastRecentlyUsedKeys() {\n let numKeysToRemove = this.recentKeys.size - this.maxRecentKeysSize;\n if (numKeysToRemove <= 0) {\n return;\n }\n const iterator = this.recentKeys.values();\n const temp = [];\n while (numKeysToRemove > 0) {\n const value = iterator.next().value;\n temp.push(value);\n numKeysToRemove--;\n }\n\n for (let i = 0; i < temp.length; ++i) {\n delete this.storageMap[temp[i]];\n this.recentKeys.delete(temp[i]);\n }\n }\n\n /**\n * Set the recent keys list size\n * @param {number} limit\n */\n setRecentKeysLimit(limit) {\n this.maxRecentKeysSize = limit;\n }\n\n /**\n * @param {String} key\n * @param {*} value\n * @returns {Boolean}\n */\n hasValueChanged(key, value) {\n return !deepEqual(this.storageMap[key], value);\n }\n}\n\nconst instance = new OnyxCache();\n\nexport default instance;\n","import _ from 'underscore';\n\n/**\n * Returns true if the haystack begins with the needle\n *\n * @param {String} haystack The full string to be searched\n * @param {String} needle The case-sensitive string to search for\n * @return {Boolean} Returns true if the haystack starts with the needle.\n */\nfunction startsWith(haystack, needle) {\n return _.isString(haystack)\n && _.isString(needle)\n && haystack.startsWith(needle);\n}\n\n/**\n * Checks if parameter is a string or function.\n * If it is a string, then we will just return it.\n * If it is a function, then we will call it with\n * any additional arguments and return the result.\n *\n * @param {String|Function} parameter\n * @returns {*}\n */\nfunction result(parameter, ...args) {\n return _.isFunction(parameter) ? parameter(...args) : parameter;\n}\n\nexport {startsWith, result};\n","import lodashTransform from 'lodash/transform';\nimport _ from 'underscore';\n\nlet debugSetState = false;\n\n/**\n * @param {Boolean} debug\n */\nfunction setShouldDebugSetState(debug) {\n debugSetState = debug;\n}\n\n/**\n * Deep diff between two objects. Useful for figuring out what changed about an object from one render to the next so\n * that state and props updates can be optimized.\n *\n * @param {Object} object\n * @param {Object} base\n * @return {Object}\n */\nfunction diffObject(object, base) {\n function changes(obj, comparisonObject) {\n return lodashTransform(obj, (result, value, key) => {\n if (_.isEqual(value, comparisonObject[key])) {\n return;\n }\n\n // eslint-disable-next-line no-param-reassign\n result[key] = (_.isObject(value) && _.isObject(comparisonObject[key]))\n ? changes(value, comparisonObject[key])\n : value;\n });\n }\n return changes(object, base);\n}\n\n/**\n * Provide insights into why a setState() call occurred by diffing the before and after values.\n *\n * @param {Object} mapping\n * @param {*} previousValue\n * @param {*} newValue\n * @param {String} caller\n * @param {String} [keyThatChanged]\n */\nfunction logSetStateCall(mapping, previousValue, newValue, caller, keyThatChanged) {\n if (!debugSetState) {\n return;\n }\n\n const logParams = {};\n if (keyThatChanged) {\n logParams.keyThatChanged = keyThatChanged;\n }\n if (_.isObject(newValue) && _.isObject(previousValue)) {\n logParams.difference = diffObject(previousValue, newValue);\n } else {\n logParams.previousValue = previousValue;\n logParams.newValue = newValue;\n }\n\n console.debug(`[Onyx-Debug] ${mapping.displayName} setState() called. Subscribed to key '${mapping.key}' (${caller})`, logParams);\n}\n\nexport {\n logSetStateCall,\n setShouldDebugSetState,\n};\n","import {\n set,\n keys,\n getMany,\n setMany,\n get,\n clear,\n del,\n delMany,\n createStore,\n promisifyRequest,\n} from 'idb-keyval';\nimport _ from 'underscore';\nimport utils from '../../utils';\n\n// We don't want to initialize the store while the JS bundle loads as idb-keyval will try to use global.indexedDB\n// which might not be available in certain environments that load the bundle (e.g. electron main process).\nlet customStoreInstance;\nconst getCustomStore = () => {\n if (!customStoreInstance) {\n customStoreInstance = createStore('OnyxDB', 'keyvaluepairs');\n }\n return customStoreInstance;\n};\n\nconst provider = {\n /**\n * Sets the value for a given key. The only requirement is that the value should be serializable to JSON string\n * @param {String} key\n * @param {*} value\n * @return {Promise<void>}\n */\n setItem: (key, value) => set(key, value, getCustomStore()),\n\n /**\n * Get multiple key-value pairs for the give array of keys in a batch.\n * This is optimized to use only one database transaction.\n * @param {String[]} keysParam\n * @return {Promise<Array<[key, value]>>}\n */\n multiGet: keysParam => getMany(keysParam, getCustomStore())\n .then(values => _.map(values, (value, index) => [keysParam[index], value])),\n\n /**\n * Multiple merging of existing and new values in a batch\n * @param {Array<[key, value]>} pairs\n * This function also removes all nested null values from an object.\n * @return {Promise<void>}\n */\n multiMerge: pairs => getCustomStore()('readwrite', (store) => {\n // Note: we are using the manual store transaction here, to fit the read and update\n // of the items in one transaction to achieve best performance.\n\n const getValues = Promise.all(_.map(pairs, ([key]) => promisifyRequest(store.get(key))));\n\n return getValues.then((values) => {\n const upsertMany = _.map(pairs, ([key, value], index) => {\n const prev = values[index];\n const newValue = utils.fastMerge(prev, value);\n return promisifyRequest(store.put(newValue, key));\n });\n return Promise.all(upsertMany);\n });\n }),\n\n /**\n * Merging an existing value with a new one\n * @param {String} key\n * @param {any} _changes - not used, as we rely on the pre-merged data from the `modifiedData`\n * @param {any} modifiedData - the pre-merged data from `Onyx.applyMerge`\n * @return {Promise<void>}\n */\n mergeItem(key, _changes, modifiedData) {\n // Since Onyx also merged the existing value with the changes, we can just set the value directly\n return provider.setItem(key, modifiedData);\n },\n\n /**\n * Stores multiple key-value pairs in a batch\n * @param {Array<[key, value]>} pairs\n * @return {Promise<void>}\n */\n multiSet: pairs => setMany(pairs, getCustomStore()),\n\n /**\n * Clear everything from storage and also stops the SyncQueue from adding anything more to storage\n * @returns {Promise<void>}\n */\n clear: () => clear(getCustomStore()),\n\n // This is a noop for now in order to keep clients from crashing see https://github.com/Expensify/Expensify/issues/312438\n setMemoryOnlyKeys: () => {},\n\n /**\n * Returns all keys available in storage\n * @returns {Promise<String[]>}\n */\n getAllKeys: () => keys(getCustomStore()),\n\n /**\n * Get the value of a given key or return `null` if it's not available in storage\n * @param {String} key\n * @return {Promise<*>}\n */\n getItem: key => get(key, getCustomStore()),\n\n /**\n * Remove given key and it's value from storage\n * @param {String} key\n * @returns {Promise<void>}\n */\n removeItem: key => del(key, getCustomStore()),\n\n /**\n * Remove given keys and their values from storage\n *\n * @param {Array} keysParam\n * @returns {Promise}\n */\n removeItems: keysParam => delMany(keysParam, getCustomStore()),\n\n /**\n * Gets the total bytes of the database file\n * @returns {Promise<number>}\n */\n getDatabaseSize() {\n if (!window.navigator || !window.navigator.storage) {\n throw new Error('StorageManager browser API unavailable');\n }\n\n return window.navigator.storage.estimate()\n .then(value => ({\n bytesUsed: value.usage,\n bytesRemaining: value.quota - value.usage,\n }))\n .catch((error) => {\n throw new Error(`Unable to estimate web storage quota. Original error: ${error}`);\n });\n },\n};\n\nexport default provider;\n","/**\n * This file is here to wrap IDBKeyVal with a layer that provides data-changed events like the ones that exist\n * when using LocalStorage APIs in the browser. These events are great because multiple tabs can listen for when\n * data changes and then stay up-to-date with everything happening in Onyx.\n */\nimport _ from 'underscore';\nimport Storage from './providers/IDBKeyVal';\n\nconst SYNC_ONYX = 'SYNC_ONYX';\n\n/**\n * Raise an event thorough `localStorage` to let other tabs know a value changed\n * @param {String} onyxKey\n */\nfunction raiseStorageSyncEvent(onyxKey) {\n global.localStorage.setItem(SYNC_ONYX, onyxKey);\n global.localStorage.removeItem(SYNC_ONYX, onyxKey);\n}\n\nfunction raiseStorageSyncManyKeysEvent(onyxKeys) {\n _.each(onyxKeys, (onyxKey) => {\n raiseStorageSyncEvent(onyxKey);\n });\n}\n\nconst webStorage = {\n ...Storage,\n\n /**\n * @param {Function} onStorageKeyChanged Storage synchronization mechanism keeping all opened tabs in sync\n */\n keepInstancesSync(onStorageKeyChanged) {\n // Override set, remove and clear to raise storage events that we intercept in other tabs\n this.setItem = (key, value) => Storage.setItem(key, value)\n .then(() => raiseStorageSyncEvent(key));\n\n this.removeItem = key => Storage.removeItem(key)\n .then(() => raiseStorageSyncEvent(key));\n\n this.removeItems = keys => Storage.removeItems(keys)\n .then(() => raiseStorageSyncManyKeysEvent(keys));\n\n this.mergeItem = (key, batchedChanges, modifiedData) => Storage.mergeItem(key, batchedChanges, modifiedData)\n .then(() => raiseStorageSyncEvent(key));\n\n // If we just call Storage.clear other tabs will have no idea which keys were available previously\n // so that they can call keysChanged for them. That's why we iterate over every key and raise a storage sync\n // event for each one\n this.clear = () => {\n let allKeys;\n\n // They keys must be retreived before storage is cleared or else the list of keys would be empty\n return Storage.getAllKeys()\n .then((keys) => {\n allKeys = keys;\n })\n .then(() => Storage.clear())\n .then(() => {\n // Now that storage is cleared, the storage sync event can happen which is a more atomic action\n // for other browser tabs\n _.each(allKeys, raiseStorageSyncEvent);\n });\n };\n\n // This listener will only be triggered by events coming from other tabs\n global.addEventListener('storage', (event) => {\n // Ignore events that don't originate from the SYNC_ONYX logic\n if (event.key !== SYNC_ONYX || !event.newValue) {\n return;\n }\n\n const onyxKey = event.newValue;\n Storage.getItem(onyxKey)\n .then(value => onStorageKeyChanged(onyxKey, value));\n });\n },\n};\n\nexport default webStorage;\n","import WebStorage from './WebStorage';\n\nexport default WebStorage;\n","import {unstable_batchedUpdates} from 'react-dom';\n\nexport default unstable_batchedUpdates;\n","/* eslint-disable no-continue */\nimport {deepEqual} from 'fast-equals';\nimport _ from 'underscore';\nimport * as Logger from './Logger';\nimport cache from './OnyxCache';\nimport * as Str from './Str';\nimport createDeferredTask from './createDeferredTask';\nimport * as PerformanceUtils from './metrics/PerformanceUtils';\nimport Storage from './storage';\nimport utils from './utils';\nimport unstable_batchedUpdates from './batch';\n\n// Method constants\nconst METHOD = {\n SET: 'set',\n MERGE: 'merge',\n MERGE_COLLECTION: 'mergecollection',\n MULTI_SET: 'multiset',\n CLEAR: 'clear',\n};\n\n// Key/value store of Onyx key and arrays of values to merge\nconst mergeQueue = {};\nconst mergeQueuePromise = {};\n\n// Keeps track of the last connectionID that was used so we can keep incrementing it\nlet lastConnectionID = 0;\n\n// Holds a mapping of all the react components that want their state subscribed to a store key\nconst callbackToStateMapping = {};\n\n// Keeps a copy of the values of the onyx collection keys as a map for faster lookups\nlet onyxCollectionKeyMap = new Map();\n\n// Holds a list of keys that have been directly subscribed to or recently modified from least to most recent\nlet recentlyAccessedKeys = [];\n\n// Holds a list of keys that are safe to remove when we reach max storage. If a key does not match with\n// whatever appears in this list it will NEVER be a candidate for eviction.\nlet evictionAllowList = [];\n\n// Holds a map of keys and connectionID arrays whose keys will never be automatically evicted as\n// long as we have at least one subscriber that returns false for the canEvict property.\nconst evictionBlocklist = {};\n\n// Optional user-provided key value states set when Onyx initializes or clears\nlet defaultKeyStates = {};\n\n// Connections can be made before `Onyx.init`. They would wait for this task before resolving\nconst deferredInitTask = createDeferredTask();\n\nlet batchUpdatesPromise = null;\nlet batchUpdatesQueue = [];\n\n/**\n * We are batching together onyx updates. This helps with use cases where we schedule onyx updates after each other.\n * This happens for example in the Onyx.update function, where we process API responses that might contain a lot of\n * update operations. Instead of calling the subscribers for each update operation, we batch them together which will\n * cause react to schedule the updates at once instead of after each other. This is mainly a performance optimization.\n * @returns {Promise}\n */\nfunction maybeFlushBatchUpdates() {\n if (batchUpdatesPromise) {\n return batchUpdatesPromise;\n }\n\n batchUpdatesPromise = new Promise((resolve) => {\n /* We use (setTimeout, 0) here which should be called once native module calls are flushed (usually at the end of the frame)\n * We may investigate if (setTimeout, 1) (which in React Native is equal to requestAnimationFrame) works even better\n * then the batch will be flushed on next frame.\n */\n setTimeout(() => {\n const updatesCopy = batchUpdatesQueue;\n batchUpdatesQueue = [];\n batchUpdatesPromise = null;\n unstable_batchedUpdates(() => {\n updatesCopy.forEach((applyUpdates) => {\n applyUpdates();\n });\n });\n\n resolve();\n }, 0);\n });\n return batchUpdatesPromise;\n}\n\nfunction batchUpdates(updates) {\n batchUpdatesQueue.push(updates);\n return maybeFlushBatchUpdates();\n}\n\n/**\n * Uses a selector function to return a simplified version of sourceData\n * @param {Mixed} sourceData\n * @param {Function} selector Function that takes sourceData and returns a simplified version of it\n * @param {Object} [withOnyxInstanceState]\n * @returns {Mixed}\n */\nconst getSubsetOfData = (sourceData, selector, withOnyxInstanceState) => selector(sourceData, withOnyxInstanceState);\n\n/**\n * Takes a collection of items (eg. {testKey_1:{a:'a'}, testKey_2:{b:'b'}})\n * and runs it through a reducer function to return a subset of the data according to a selector.\n * The resulting collection will only contain items that are returned by the selector.\n * @param {Object} collection\n * @param {String|Function} selector (see method docs for getSubsetOfData() for full details)\n * @param {Object} [withOnyxInstanceState]\n * @returns {Object}\n */\nconst reduceCollectionWithSelector = (collection, selector, withOnyxInstanceState) => _.reduce(collection, (finalCollection, item, key) => {\n // eslint-disable-next-line no-param-reassign\n finalCollection[key] = getSubsetOfData(item, selector, withOnyxInstanceState);\n\n return finalCollection;\n}, {});\n\n/**\n * Get some data from the store\n *\n * @private\n * @param {string} key\n * @returns {Promise<*>}\n */\nfunction get(key) {\n // When we already have the value in cache - resolve right away\n if (cache.hasCacheForKey(key)) {\n return Promise.resolve(cache.getValue(key));\n }\n\n const taskName = `get:${key}`;\n\n // When a value retrieving task for this key is still running hook to it\n if (cache.hasPendingTask(taskName)) {\n return cache.getTaskPromise(taskName);\n }\n\n // Otherwise retrieve the value from storage and capture a promise to aid concurrent usages\n const promise = Storage.getItem(key)\n .then((val) => {\n cache.set(key, val);\n return val;\n })\n .catch(err => Logger.logInfo(`Unable to get item from persistent storage. Key: ${key} Error: ${err}`));\n\n return cache.captureTask(taskName, promise);\n}\n\n/**\n * Returns current key names stored in persisted storage\n * @private\n * @returns {Promise<string[]>}\n */\nfunction getAllKeys() {\n // When we've already read stored keys, resolve right away\n const storedKeys = cache.getAllKeys();\n if (storedKeys.length > 0) {\n return Promise.resolve(storedKeys);\n }\n\n const taskName = 'getAllKeys';\n\n // When a value retrieving task for all keys is still running hook to it\n if (cache.hasPendingTask(taskName)) {\n return cache.getTaskPromise(taskName);\n }\n\n // Otherwise retrieve the keys from storage and capture a promise to aid concurrent usages\n const promise = Storage.getAllKeys()\n .then((keys) => {\n _.each(keys, key => cache.addKey(key));\n return keys;\n });\n\n return cache.captureTask(taskName, promise);\n}\n\n/**\n * Checks to see if the a subscriber's supplied key\n * is associated with a collection of keys.\n *\n * @private\n * @param {String} key\n * @returns {Boolean}\n */\nfunction isCollectionKey(key) {\n return onyxCollectionKeyMap.has(key);\n}\n\n/**\n * @param {String} collectionKey\n * @param {String} key\n * @returns {Boolean}\n */\nfunction isCollectionMemberKey(collectionKey, key) {\n return Str.startsWith(key, collectionKey) && key.length > collectionKey.length;\n}\n\n/**\n * Checks to see if a provided key is the exact configured key of our connected subscriber\n * or if the provided key is a collection member key (in case our configured key is a \"collection key\")\n *\n * @private\n * @param {String} configKey\n * @param {String} key\n * @return {Boolean}\n */\nfunction isKeyMatch(configKey, key) {\n return isCollectionKey(configKey)\n ? Str.startsWith(key, configKey)\n : configKey === key;\n}\n\n/**\n * Checks to see if this key has been flagged as\n * safe for removal.\n *\n * @private\n * @param {String} testKey\n * @returns {Boolean}\n */\nfunction isSafeEvictionKey(testKey) {\n return _.some(evictionAllowList, key => isKeyMatch(key, testKey));\n}\n\n/**\n * Tries to get a value from the cache. If the value is not present in cache it will return the default value or undefined.\n * If the requested key is a collection, it will return an object with all the collection members.\n *\n * @param {String} key\n * @param {Object} mapping\n * @returns {Mixed}\n */\nfunction tryGetCachedValue(key, mapping = {}) {\n let val = cache.getValue(key);\n\n if (isCollectionKey(key)) {\n const allKeys = cache.getAllKeys();\n const matchingKeys = _.filter(allKeys, k => k.startsWith(key));\n const values = _.reduce(matchingKeys, (finalObject, matchedKey) => {\n const cachedValue = cache.getValue(matchedKey);\n if (cachedValue) {\n // This is permissible because we're in the process of constructing the final object in a reduce function.\n // eslint-disable-next-line no-param-reassign\n finalObject[matchedKey] = cachedValue;\n }\n return finalObject;\n }, {});\n if (_.isEmpty(values)) {\n return;\n }\n val = values;\n }\n\n if (mapping.selector) {\n const state = mapping.withOnyxInstance ? mapping.withOnyxInstance.state : undefined;\n if (isCollectionKey(key)) {\n return reduceCollectionWithSelector(val, mapping.selector, state);\n }\n return getSubsetOfData(val, mapping.selector, state);\n }\n\n return val;\n}\n\n/**\n * Remove a key from the recently accessed key list.\n *\n * @private\n * @param {String} key\n */\nfunction removeLastAccessedKey(key) {\n recentlyAccessedKeys = _.without(recentlyAccessedKeys, key);\n}\n\n/**\n * Add a key to the list of recently accessed keys. The least\n * recently accessed key should be at the head and the most\n * recently accessed key at the tail.\n *\n * @private\n * @param {String} key\n */\nfunction addLastAccessedKey(key) {\n // Only specific keys belong in this list since we cannot remove an entire collection.\n if (isCollectionKey(key) || !isSafeEvictionKey(key)) {\n return;\n }\n\n removeLastAccessedKey(key);\n recentlyAccessedKeys.push(key);\n}\n\n/**\n * Removes a key previously added to this list\n * which will enable it to be deleted again.\n *\n * @private\n * @param {String} key\n * @param {Number} connectionID\n */\nfunction removeFromEvictionBlockList(key, connectionID) {\n evictionBlocklist[key] = _.without(evictionBlocklist[key] || [], connectionID);\n\n // Remove the key if there are no more subscribers\n if (evictionBlocklist[key].length === 0) {\n delete evictionBlocklist[key];\n }\n}\n\n/**\n * Keys added to this list can never be deleted.\n *\n * @private\n * @param {String} key\n * @param {Number} connectionID\n */\nfunction addToEvictionBlockList(key, connectionID) {\n removeFromEvictionBlockList(key, connectionID);\n\n if (!evictionBlocklist[key]) {\n evictionBlocklist[key] = [];\n }\n\n evictionBlocklist[key].push(connectionID);\n}\n\n/**\n * Take all the keys that are safe to evict and add them to\n * the recently accessed list when initializing the app. This\n * enables keys that have not recently been accessed to be\n * removed.\n *\n * @private\n * @returns {Promise}\n */\nfunction addAllSafeEvictionKeysToRecentlyAccessedList() {\n return getAllKeys()\n .then((keys) => {\n _.each(evictionAllowList, (safeEvictionKey) => {\n _.each(keys, (key) => {\n if (!isKeyMatch(safeEvictionKey, key)) {\n return;\n }\n addLastAccessedKey(key);\n });\n });\n });\n}\n\n/**\n * @private\n * @param {String} collectionKey\n * @returns {Object}\n */\nfunction getCachedCollection(collectionKey) {\n const collectionMemberKeys = _.filter(cache.getAllKeys(), (\n storedKey => isCollectionMemberKey(collectionKey, storedKey)\n ));\n\n return _.reduce(collectionMemberKeys, (prev, curr) => {\n const cachedValue = cache.getValue(curr);\n if (!cachedValue) {\n return prev;\n }\n\n // eslint-disable-next-line no-param-reassign\n prev[curr] = cachedValue;\n return prev;\n }, {});\n}\n\n/**\n * When a collection of keys change, search for any callbacks matching the collection key and trigger those callbacks\n *\n * @private\n * @param {String} collectionKey\n * @param {Object} partialCollection - a partial collection of grouped member keys\n * @param {boolean} [notifyRegularSubscibers=true]\n * @param {boolean} [notifyWithOnyxSubscibers=true]\n */\nfunction keysChanged(collectionKey, partialCollection, notifyRegularSubscibers = true, notifyWithOnyxSubscibers = true) {\n // We are iterating over all subscribers similar to keyChanged(). However, we are looking for subscribers who are subscribing to either a collection key or\n // individual collection key member for the collection that is being updated. It is important to note that the collection parameter cane be a PARTIAL collection\n // and does not represent all of the combined keys and values for a collection key. It is just the \"new\" data that was merged in via mergeCollection().\n const stateMappingKeys = _.keys(callbackToStateMapping);\n for (let i = 0; i < stateMappingKeys.length; i++) {\n const subscriber = callbackToStateMapping[stateMappingKeys[i]];\n if (!subscriber) {\n continue;\n }\n\n // Skip iteration if we do not have a collection key or a collection member key on this subscriber\n if (!Str.startsWith(subscriber.key, collectionKey)) {\n continue;\n }\n\n /**\n * e.g. Onyx.connect({key: ONYXKEYS.COLLECTION.REPORT, callback: ...});\n */\n const isSubscribedToCollectionKey = subscriber.key === collectionKey;\n\n /**\n * e.g. Onyx.connect({key: `${ONYXKEYS.COLLECTION.REPORT}{reportID}`, callback: ...});\n */\n const isSubscribedToCollectionMemberKey = isCollectionMemberKey(collectionKey, subscriber.key);\n\n // We prepare the \"cached collection\" which is the entire collection + the new partial data that\n // was merged in via mergeCollection().\n const cachedCollection = getCachedCollection(collectionKey);\n\n // Regular Onyx.connect() subscriber found.\n if (_.isFunction(subscriber.callback)) {\n if (!notifyRegularSubscibers) {\n continue;\n }\n\n // If they are subscribed to the collection key and using waitForCollectionCallback then we'll\n // send the whole cached collection.\n if (isSubscribedToCollectionKey) {\n if (subscriber.waitForCollectionCallback) {\n subscriber.callback(cachedCollection);\n continue;\n }\n\n // If they are not using waitForCollectionCallback then we notify the subscriber with\n // the new merged data but only for any keys in the partial collection.\n const dataKeys = _.keys(partialCollection);\n for (let j = 0; j < dataKeys.length; j++) {\n const dataKey = dataKeys[j];\n subscriber.callback(cachedCollection[dataKey], dataKey);\n }\n continue;\n }\n\n // And if the subscriber is specifically only tracking a particular collection member key then we will\n // notify them with the cached data for that key only.\n if (isSubscribedToCollectionMemberKey) {\n subscriber.callback(cachedCollection[subscriber.key], subscriber.key);\n continue;\n }\n\n continue;\n }\n\n // React component subscriber found.\n if (subscriber.withOnyxInstance) {\n if (!notifyWithOnyxSubscibers) {\n continue;\n }\n\n // We are subscribed to a collection key so we must update the data in state with the new\n // collection member key values from the partial update.\n if (isSubscribedToCollectionKey) {\n // If the subscriber has a selector, then the component's state must only be updated with the data\n // returned by the selector.\n if (subscriber.selector) {\n subscriber.withOnyxInstance.setStateProxy((prevState) => {\n const previousData = prevState[subscriber.statePropertyName];\n const newData = reduceCollectionWithSelector(cachedCollection, subscriber.selector, subscriber.withOnyxInstance.state);\n\n if (!deepEqual(previousData, newData)) {\n return {\n [subscriber.statePropertyName]: newData,\n };\n }\n return null;\n });\n continue;\n }\n\n subscriber.withOnyxInstance.setStateProxy((prevState) => {\n const finalCollection = _.clone(prevState[subscriber.statePropertyName] || {});\n const dataKeys = _.keys(partialCollection);\n for (let j = 0; j < dataKeys.length; j++) {\n const dataKey = dataKeys[j];\n finalCollection[dataKey] = cachedCollection[dataKey];\n }\n\n PerformanceUtils.logSetStateCall(subscriber, prevState[subscriber.statePropertyName], finalCollection, 'keysChanged', collectionKey);\n return {\n [subscriber.statePropertyName]: finalCollection,\n };\n });\n continue;\n }\n\n // If a React component is only interested in a single key then we can set the cached value directly to the state name.\n if (isSubscribedToCollectionMemberKey) {\n // However, we only want to update this subscriber if the partial data contains a change.\n // Otherwise, we would update them with a value they already have and trigger an unnecessary re-render.\n const dataFromCollection = partialCollection[subscriber.key];\n if (_.isUndefined(dataFromCollection)) {\n continue;\n }\n\n // If the subscriber has a selector, then the component's state must only be updated with the data\n // returned by the selector and the state should only change when the subset of data changes from what\n // it was previously.\n if (subscriber.selector) {\n subscriber.withOnyxInstance.setStateProxy((prevState) => {\n const prevData = prevState[subscriber.statePropertyName];\n const newData = getSubsetOfData(cachedCollection[subscriber.key], subscriber.selector, subscriber.withOnyxInstance.state);\n if (!deepEqual(prevData, newData)) {\n PerformanceUtils.logSetStateCall(subscriber, prevData, newData, 'keysChanged', collectionKey);\n return {\n [subscriber.statePropertyName]: newData,\n };\n }\n\n return null;\n });\n continue;\n }\n\n subscriber.withOnyxInstance.setStateProxy((prevState) => {\n const data = cachedCollection[subscriber.key];\n const previousData = prevState[subscriber.statePropertyName];\n\n // Avoids triggering unnecessary re-renders when feeding empty objects\n if (utils.areObjectsEmpty(data, previousData)) {\n return null;\n }\n if (data === previousData) {\n return null;\n }\n\n PerformanceUtils.logSetStateCall(subscriber, previousData, data, 'keysChanged', collectionKey);\n return {\n [subscriber.statePropertyName]: data,\n };\n });\n }\n }\n }\n}\n\n/**\n * When a key change happens, search for any callbacks matching the key or collection key and trigger those callbacks\n *\n * @example\n * keyChanged(key, value, subscriber => subscriber.initWithStoredValues === false)\n *\n * @private\n * @param {String} key\n * @param {*} data\n * @param {Function} [canUpdateSubscriber] only subscribers that pass this truth test will be updated\n * @param {boolean} [notifyRegularSubscibers=true]\n * @param {boolean} [notifyWithOnyxSubscibers=true]\n */\nfunction keyChanged(key, data, canUpdateSubscriber, notifyRegularSubscibers = true, notifyWithOnyxSubscibers = true) {\n // Add or remove this key from the recentlyAccessedKeys lists\n if (!_.isNull(data)) {\n addLastAccessedKey(key);\n } else {\n removeLastAccessedKey(key);\n }\n\n // We are iterating over all subscribers to see if they are interested in the key that has just changed. If the subscriber's key is a collection key then we will\n // notify them if the key that changed is a collection member. Or if it is a regular key notify them when there is an exact match. Depending on whether the subscriber\n // was connected via withOnyx we will call setState() directly on the withOnyx instance. If it is a regular connection we will pass the data to the provided callback.\n const stateMappingKeys = _.keys(callbackToStateMapping);\n for (let i = 0; i < stateMappingKeys.length; i++) {\n const subscriber = callbackToStateMapping[stateMappingKeys[i]];\n if (!subscriber || !isKeyMatch(subscriber.key, key) || (_.isFunction(canUpdateSubscriber) && !canUpdateSubscriber(subscriber))) {\n continue;\n }\n\n // Subscriber is a regular call to connect() and provided a callback\n if (_.isFunction(subscriber.callback)) {\n if (!notifyRegularSubscibers) {\n continue;\n }\n if (isCollectionKey(subscriber.key) && subscriber.waitForCollectionCallback) {\n const cachedCollection = getCachedCollection(subscriber.key);\n cachedCollection[key] = data;\n subscriber.callback(cachedCollection);\n continue;\n }\n\n subscriber.callback(data, key);\n continue;\n }\n\n // Subscriber connected via withOnyx() HOC\n if (subscriber.withOnyxInstance) {\n if (!notifyWithOnyxSubscibers) {\n continue;\n }\n\n // Check if we are subscribing to a collection key and overwrite the collection member key value in state\n if (isCollectionKey(subscriber.key)) {\n // If the subscriber has a selector, then the consumer of this data must only be given the data\n // returned by the selector and only when the selected data has changed.\n if (subscriber.selector) {\n subscriber.withOnyxInstance.setStateProxy((prevState) => {\n const prevData = prevState[subscriber.statePropertyName];\n const newData = {\n [key]: getSubsetOfData(data, subscriber.selector, subscriber.withOnyxInstance.state),\n };\n const prevDataWithNewData = {\n ...prevData,\n ...newData,\n };\n if (!deepEqual(prevData, prevDataWithNewData)) {\n PerformanceUtils.logSetStateCall(subscriber, prevData, newData, 'keyChanged', key);\n return {\n [subscriber.statePropertyName]: prevDataWithNewData,\n };\n }\n return null;\n });\n continue;\n }\n\n subscriber.withOnyxInstance.setStateProxy((prevState) => {\n const collection = prevState[subscriber.statePropertyName] || {};\n const newCollection = {\n ...collection,\n [key]: data,\n };\n PerformanceUtils.logSetStateCall(subscriber, collection, newCollection, 'keyChanged', key);\n return {\n [subscriber.statePropertyName]: newCollection,\n };\n });\n continue;\n }\n\n // If the subscriber has a selector, then the component's state must only be updated with the data\n // returned by the selector and only if the selected data has changed.\n if (subscriber.selector) {\n subscriber.withOnyxInstance.setStateProxy((prevState) => {\n const previousValue = getSubsetOfData(prevState[subscriber.statePropertyName], subscriber.selector, subscriber.withOnyxInstance.state);\n const newValue = getSubsetOfData(data, subscriber.selector, subscriber.withOnyxInstance.state);\n if (!deepEqual(previousValue, newValue)) {\n return {\n [subscriber.statePropertyName]: newValue,\n };\n }\n return null;\n });\n continue;\n }\n\n // If we did not match on a collection key then we just set the new data to the state property\n subscriber.withOnyxInstance.setStateProxy((prevState) => {\n const previousData = prevState[subscriber.statePropertyName];\n\n // Avoids triggering unnecessary re-renders when feeding empty objects\n if (utils.areObjectsEmpty(data, previousData)) {\n return null;\n }\n if (previousData === data) {\n return null;\n }\n\n PerformanceUtils.logSetStateCall(subscriber, previousData, data, 'keyChanged', key);\n return {\n [subscriber.statePropertyName]: data,\n };\n });\n continue;\n }\n\n console.error('Warning: Found a matching subscriber to a key that changed, but no callback or withOnyxInstance could be found.');\n }\n}\n\n/**\n * Sends the data obtained from the keys to the connection. It either:\n * - sets state on the withOnyxInstances\n * - triggers the callback function\n *\n * @private\n * @param {Object} mapping\n * @param {Object} [mapping.withOnyxInstance]\n * @param {String} [mapping.statePropertyName]\n * @param {Function} [mapping.callback]\n * @param {String} [mapping.selector]\n * @param {*|null} val\n * @param {String|undefined} matchedKey\n * @param {Boolean} isBatched\n */\nfunction sendDataToConnection(mapping, val, matchedKey, isBatched) {\n // If the mapping no longer exists then we should not send any data.\n // This means our subscriber disconnected or withOnyx wrapped component unmounted.\n if (!callbackToStateMapping[mapping.connectionID]) {\n return;\n }\n\n if (mapping.withOnyxInstance) {\n let newData = val;\n\n // If the mapping has a selector, then the component's state must only be updated with the data\n // returned by the selector.\n if (mapping.selector) {\n if (isCollectionKey(mapping.key)) {\n newData = reduceCollectionWithSelector(val, mapping.selector, mapping.withOnyxInstance.state);\n } else {\n newData = getSubsetOfData(val, mapping.selector, mapping.withOnyxInstance.state);\n }\n }\n\n PerformanceUtils.logSetStateCall(mapping, null, newData, 'sendDataToConnection');\n if (isBatched) {\n batchUpdates(() => {\n mapping.withOnyxInstance.setWithOnyxState(mapping.statePropertyName, newData);\n });\n } else {\n mapping.withOnyxInstance.setWithOnyxState(mapping.statePropertyName, newData);\n }\n return;\n }\n\n if (_.isFunction(mapping.callback)) {\n mapping.callback(val, matchedKey);\n }\n}\n\n/**\n * We check to see if this key is flagged as safe for eviction and add it to the recentlyAccessedKeys list so that when we\n * run out of storage the least recently accessed key can be removed.\n *\n * @private\n * @param {Object} mapping\n */\nfunction addKeyToRecentlyAccessedIfNeeded(mapping) {\n if (!isSafeEvictionKey(mapping.key)) {\n return;\n }\n\n // Try to free some cache whenever we connect to a safe eviction key\n cache.removeLeastRecentlyUsedKeys();\n\n if (mapping.withOnyxInstance && !isCollectionKey(mapping.key)) {\n // All React components subscribing to a key flagged as a safe eviction key must implement the canEvict property.\n if (_.isUndefined(mapping.canEvict)) {\n throw new Error(\n `Cannot subscribe to safe eviction key '${mapping.key}' without providing a canEvict value.`,\n );\n }\n\n addLastAccessedKey(mapping.key);\n }\n}\n\n/**\n * Gets the data for a given an array of matching keys, combines them into an object, and sends the result back to the subscriber.\n *\n * @private\n * @param {Array} matchingKeys\n * @param {Object} mapping\n */\nfunction getCollectionDataAndSendAsObject(matchingKeys, mapping) {\n Promise.all(_.map(matchingKeys, key => get(key)))\n .then(values => _.reduce(values, (finalObject, value, i) => {\n // eslint-disable-next-line no-param-reassign\n finalObject[matchingKeys[i]] = value;\n return finalObject;\n }, {}))\n .then(val => sendDataToConnection(mapping, val, undefined, true));\n}\n\n/**\n * Subscribes a react component's state directly to a store key\n *\n * @example\n * const connectionID = Onyx.connect({\n * key: ONYXKEYS.SESSION,\n * callback: onSessionChange,\n * });\n *\n * @param {Object} mapping the mapping information to connect Onyx to the components state\n * @param {String} mapping.key ONYXKEY to subscribe to\n * @param {String} [mapping.statePropertyName] the name of the property in the state to connect the data to\n * @param {Object} [mapping.withOnyxInstance] whose setState() method will be called with any changed data\n * This is used by React components to connect to Onyx\n * @param {Function} [mapping.callback] a method that will be called with changed data\n * This is used by any non-React code to connect to Onyx\n * @param {Boolean} [mapping.initWithStoredValues] If set to false, then no data will be prefilled into the\n * component\n * @param {Boolean} [mapping.waitForCollectionCallback] If set to true, it will return the entire collection to the callback as a single object\n * @param {Function} [mapping.selector] THIS PARAM IS ONLY USED WITH withOnyx(). If included, this will be used to subscribe to a subset of an Onyx key's data.\n * The sourceData and withOnyx state are passed to the selector and should return the simplified data. Using this setting on `withOnyx` can have very positive\n * performance benefits because the component will only re-render when the subset of data changes. Otherwise, any change of data on any property would normally\n * cause the component to re-render (and that can be expensive from a performance standpoint).\n * @param {String | Number | Boolean | Object} [mapping.initialValue] THIS PARAM IS ONLY USED WITH withOnyx().\n * If included, this will be passed to the component so that something can be rendered while data is being fetched from the DB.\n * Note that it will not cause the component to have the loading prop set to true. |\n * @returns {Number} an ID to use when calling disconnect\n */\nfunction connect(mapping) {\n const connectionID = lastConnectionID++;\n callbackToStateMapping[connectionID] = mapping;\n callbackToStateMapping[connectionID].connectionID = connectionID;\n\n if (mapping.initWithStoredValues === false) {\n return connectionID;\n }\n\n // Commit connection only after init passes\n deferredInitTask.promise\n .then(() => addKeyToRecentlyAccessedIfNeeded(mapping))\n .then(() => {\n // Performance improvement\n // If the mapping is connected to an onyx key that is not a collection\n // we can skip the call to getAllKeys() and return an array with a single item\n if (Boolean(mapping.key)\n && typeof mapping.key === 'string'\n && !(mapping.key.endsWith('_'))\n && cache.storageKeys.has(mapping.key)\n ) {\n return [mapping.key];\n }\n return getAllKeys();\n })\n .then((keys) => {\n // We search all the keys in storage to see if any are a \"match\" for the subscriber we are connecting so that we\n // can send data back to the subscriber. Note that multiple keys can match as a subscriber could either be\n // subscribed to a \"collection key\" or a single key.\n const matchingKeys = _.filter(keys, key => isKeyMatch(mapping.key, key));\n\n // If the key being connected to does not exist we initialize the value with null. For subscribers that connected\n // directly via connect() they will simply get a null value sent to them without any information about which key matched\n // since there are none matched. In withOnyx() we wait for all connected keys to return a value before rendering the child\n // component. This null value will be filtered out so that the connected component can utilize defaultProps.\n if (matchingKeys.length === 0) {\n // Here we cannot use batching because the null value is expected to be set immediately for default props\n // or they will be undefined.\n sendDataToConnection(mapping, null, undefined, false);\n return;\n }\n\n // When using a callback subscriber we will either trigger the provided callback for each key we find or combine all values\n // into an object and just make a single call. The latter behavior is enabled by providing a waitForCollectionCallback key\n // combined with a subscription to a collection key.\n if (_.isFunction(mapping.callback)) {\n if (isCollectionKey(mapping.key)) {\n if (mapping.waitForCollectionCallback) {\n getCollectionDataAndSendAsObject(matchingKeys, mapping);\n return;\n }\n\n // We did not opt into using waitForCollectionCallback mode so the callback is called for every matching key.\n for (let i = 0; i < matchingKeys.length; i++) {\n get(matchingKeys[i]).then(val => sendDataToConnection(mapping, val, matchingKeys[i], true));\n }\n return;\n }\n\n // If we are not subscribed to a collection key then there's only a single key to send an update for.\n get(mapping.key).then(val => sendDataToConnection(mapping, val, mapping.key, true));\n return;\n }\n\n // If we have a withOnyxInstance that means a React component has subscribed via the withOnyx() HOC and we need to\n // group collection key member data into an object.\n if (mapping.withOnyxInstance) {\n if (isCollectionKey(mapping.key)) {\n getCollectionDataAndSendAsObject(matchingKeys, mapping);\n return;\n }\n\n // If the subscriber is not using a collection key then we just send a single value back to the subscriber\n get(mapping.key).then(val => sendDataToConnection(mapping, val, mapping.key, true));\n return;\n }\n\n console.error('Warning: Onyx.connect() was found without a callback or withOnyxInstance');\n });\n\n // The connectionID is returned back to the caller so that it can be used to clean up the connection when it's no longer needed\n // by calling Onyx.disconnect(connectionID).\n return connectionID;\n}\n\n/**\n * Remove the listener for a react component\n * @example\n * Onyx.disconnect(connectionID);\n *\n * @param {Number} connectionID unique id returned by call to Onyx.connect()\n * @param {String} [keyToRemoveFromEvictionBlocklist]\n */\nfunction disconnect(connectionID, keyToRemoveFromEvictionBlocklist) {\n if (!callbackToStateMapping[connectionID]) {\n return;\n }\n\n // Remove this key from the eviction block list as we are no longer\n // subscribing to it and it should be safe to delete again\n if (keyToRemoveFromEvictionBlocklist) {\n removeFromEvictionBlockList(keyToRemoveFromEvictionBlocklist, connectionID);\n }\n\n delete callbackToStateMapping[connectionID];\n}\n\n/**\n * Schedules an update that will be appended to the macro task queue (so it doesn't update the subscribers immediately).\n *\n * @example\n * scheduleSubscriberUpdate(key, value, subscriber => subscriber.initWithStoredValues === false)\n *\n * @param {String} key\n * @param {*} value\n * @param {Function} [canUpdateSubscriber] only subscribers that pass this truth test will be updated\n * @returns {Promise}\n */\nfunction scheduleSubscriberUpdate(key, value, canUpdateSubscriber) {\n const promise = Promise.resolve().then(() => keyChanged(key, value, canUpdateSubscriber, true, false));\n batchUpdates(() => keyChanged(key, value, canUpdateSubscriber, false, true));\n return Promise.all([maybeFlushBatchUpdates(), promise]);\n}\n\n/**\n * This method is similar to notifySubscribersOnNextTick but it is built for working specifically with collections\n * so that keysChanged() is triggered for the collection and not keyChanged(). If this was not done, then the\n * subscriber callbacks receive the data in a different format than they normally expect and it breaks code.\n *\n * @param {String} key\n * @param {*} value\n * @returns {Promise}\n */\nfunction scheduleNotifyCollectionSubscribers(key, value) {\n const promise = Promise.resolve().then(() => keysChanged(key, value, true, false));\n batchUpdates(() => keysChanged(key, value, false, true));\n return Promise.all([maybeFlushBatchUpdates(), promise]);\n}\n\n/**\n * Remove a key from Onyx and update the subscribers\n *\n * @private\n * @param {String} key\n * @return {Promise}\n */\nfunction remove(key) {\n cache.drop(key);\n scheduleSubscriberUpdate(key, null);\n return Storage.removeItem(key);\n}\n\n/**\n * @private\n * @returns {Promise<void>}\n */\nfunction reportStorageQuota() {\n return Storage.getDatabaseSize()\n .then(({bytesUsed, bytesRemaining}) => {\n Logger.logInfo(`Storage Quota Check -- bytesUsed: ${bytesUsed} bytesRemaining: ${bytesRemaining}`);\n })\n .catch((dbSizeError) => {\n Logger.logAlert(`Unable to get database size. Error: ${dbSizeError}`);\n });\n}\n\n/**\n * If we fail to set or merge we must handle this by\n * evicting some data from Onyx and then retrying to do\n * whatever it is we attempted to do.\n *\n * @private\n * @param {Error} error\n * @param {Function} onyxMethod\n * @param {...any} args\n * @return {Promise}\n */\nfunction evictStorageAndRetry(error, onyxMethod, ...args) {\n Logger.logInfo(`Failed to save to storage. Error: ${error}. onyxMethod: ${onyxMethod.name}`);\n\n if (error && Str.startsWith(error.message, 'Failed to execute \\'put\\' on \\'IDBObjectStore\\'')) {\n Logger.logAlert('Attempted to set invalid data set in Onyx. Please ensure all data is serializable.');\n throw error;\n }\n\n // Find the first key that we can remove that has no subscribers in our blocklist\n const keyForRemoval = _.find(recentlyAccessedKeys, key => !evictionBlocklist[key]);\n if (!keyForRemoval) {\n // If we have no acceptable keys to remove then we are possibly trying to save mission critical data. If this is the case,\n // then we should stop retrying as there is not much the user can do to fix this. Instead of getting them stuck in an infinite loop we\n // will allow this write to be skipped.\n Logger.logAlert('Out of storage. But found no acceptable keys to remove.');\n return reportStorageQuota();\n }\n\n // Remove the least recently viewed key that is not currently being accessed and retry.\n Logger.logInfo(`Out of storage. Evicting least recently accessed key (${keyForRemoval}) and retrying.`);\n reportStorageQuota();\n return remove(keyForRemoval)\n .then(() => onyxMethod(...args));\n}\n\n/**\n * Notifys subscribers and writes current value to cache\n *\n * @param {String} key\n * @param {*} value\n * @param {Boolean} hasChanged\n * @param {String} method\n * @returns {Promise}\n */\nfunction broadcastUpdate(key, value, hasChanged, method) {\n // Logging properties only since values could be sensitive things we don't want to log\n Logger.logInfo(`${method}() called for key: ${key}${_.isObject(value) ? ` properties: ${_.keys(value).join(',')}` : ''}`);\n\n // Update subscribers if the cached value has changed, or when the subscriber specifically requires\n // all updates regardless of value changes (indicated by initWithStoredValues set to false).\n if (hasChanged) {\n cache.set(key, value);\n } else {\n cache.addToAccessedKeys(key);\n }\n\n return scheduleSubscriberUpdate(key, value, subscriber => hasChanged || subscriber.initWithStoredValues === false);\n}\n\n/**\n * @param {String} key\n * @returns {Boolean}\n */\nfunction hasPendingMergeForKey(key) {\n return Boolean(mergeQueue[key]);\n}\n\n/**\n * Removes a key from storage if the value is null.\n * Otherwise removes all nested null values in objects and returns the object\n * @param {String} key\n * @param {Mixed} value\n * @returns {Mixed} `null` if the key got removed completely, otherwise the value without null values\n */\nfunction removeNullValues(key, value) {\n if (_.isNull(value)) {\n remove(key);\n return null;\n }\n\n // We can remove all null values in an object by merging it with itself\n // utils.fastMerge recursively goes through the object and removes all null values\n // Passing two identical objects as source and target to fastMerge will not change it, but only remove the null values\n return utils.removeNestedNullValues(value);\n}\n\n/**\n * Write a value to our store with the given key\n *\n * @param {String} key ONYXKEY to set\n * @param {*} value value to store\n *\n * @returns {Promise}\n */\nfunction set(key, value) {\n const valueWithoutNull = removeNullValues(key, value);\n\n if (valueWithoutNull === null) {\n return Promise.resolve();\n }\n\n if (hasPendingMergeForKey(key)) {\n Logger.logAlert(`Onyx.set() called after Onyx.merge() for key: ${key}. It is recommended to use set() or merge() not both.`);\n }\n\n const hasChanged = cache.hasValueChanged(key, valueWithoutNull);\n\n // This approach prioritizes fast UI changes without waiting for data to be stored in device storage.\n const updatePromise = broadcastUpdate(key, valueWithoutNull, hasChanged, 'set');\n\n // If the value has not changed, calling Storage.setItem() would be redundant and a waste of performance, so return early instead.\n if (!hasChanged) {\n return updatePromise;\n }\n\n return Storage.setItem(key, valueWithoutNull)\n .catch(error => evictStorageAndRetry(error, set, key, valueWithoutNull))\n .then(() => updatePromise);\n}\n\n/**\n * Storage expects array like: [[\"@MyApp_user\", value_1], [\"@MyApp_key\", value_2]]\n * This method transforms an object like {'@MyApp_user': myUserValue, '@MyApp_key': myKeyValue}\n * to an array of key-value pairs in the above format\n * @private\n * @param {Record} data\n * @return {Array} an array of key - value pairs <[key, value]>\n */\nfunction prepareKeyValuePairsForStorage(data) {\n return _.map(data, (value, key) => [key, value]);\n}\n\n/**\n * Sets multiple keys and values\n *\n * @example Onyx.multiSet({'key1': 'a', 'key2': 'b'});\n *\n * @param {Object} data object keyed by ONYXKEYS and the values to set\n * @returns {Promise}\n */\nfunction multiSet(data) {\n const keyValuePairs = prepareKeyValuePairsForStorage(data);\n\n const updatePromises = _.map(data, (val, key) => {\n // Update cache and optimistically inform subscribers on the next tick\n cache.set(key, val);\n return scheduleSubscriberUpdate(key, val);\n });\n\n const keyValuePairsWithoutNull = _.filter(_.map(keyValuePairs, ([key, value]) => {\n const valueWithoutNull = removeNullValues(key, value);\n\n if (valueWithoutNull === null) {\n return;\n }\n return [key, valueWithoutNull];\n }), Boolean);\n\n return Storage.multiSet(keyValuePairsWithoutNull)\n .catch(error => evictStorageAndRetry(error, multiSet, data))\n .then(() => Promise.all(updatePromises));\n}\n\n/**\n * Merges an array of changes with an existing value\n *\n * @private\n * @param {*} existingValue\n * @param {Array<*>} changes Array of changes that should be applied to the existing value\n * @param {Boolean} shouldRemoveNullObjectValues\n * @returns {*}\n */\nfunction applyMerge(existingValue, changes, shouldRemoveNullObjectValues) {\n const lastChange = _.last(changes);\n\n if (_.isArray(lastChange)) {\n return lastChange;\n }\n\n if (_.some(changes, _.isObject)) {\n // Object values are then merged one after the other\n return _.reduce(changes, (modifiedData, change) => utils.fastMerge(modifiedData, change, shouldRemoveNullObjectValues),\n existingValue || {});\n }\n\n // If we have anything else we can't merge it so we'll\n // simply return the last value that was queued\n return lastChange;\n}\n\n/**\n * Merge a new value into an existing value at a key.\n *\n * The types of values that can be merged are `Object` and `Array`. To set another type of value use `Onyx.set()`.\n * Values of type `Object` get merged with the old value, whilst for `Array`'s we simply replace the current value with the new one.\n *\n * Calls to `Onyx.merge()` are batched so that any calls performed in a single tick will stack in a queue and get\n * applied in the order they were called. Note: `Onyx.set()` calls do not work this way so use caution when mixing\n * `Onyx.merge()` and `Onyx.set()`.\n *\n * @example\n * Onyx.merge(ONYXKEYS.EMPLOYEE_LIST, ['Joe']); // -> ['Joe']\n * Onyx.merge(ONYXKEYS.EMPLOYEE_LIST, ['Jack']); // -> ['Joe', 'Jack']\n * Onyx.merge(ONYXKEYS.POLICY, {id: 1}); // -> {id: 1}\n * Onyx.merge(ONYXKEYS.POLICY, {name: 'My Workspace'}); // -> {id: 1, name: 'My Workspace'}\n *\n * @param {String} key ONYXKEYS key\n * @param {(Object|Array)} changes Object or Array value to merge\n * @returns {Promise}\n */\nfunction merge(key, changes) {\n // Top-level undefined values are ignored\n // Therefore we need to prevent adding them to the merge queue\n if (_.isUndefined(changes)) {\n return mergeQueue[key] ? mergeQueuePromise[key] : Promise.resolve();\n }\n\n // Merge attempts are batched together. The delta should be applied after a single call to get() to prevent a race condition.\n // Using the initial value from storage in subsequent merge attempts will lead to an incorrect final merged value.\n if (mergeQueue[key]) {\n mergeQueue[key].push(changes);\n return mergeQueuePromise[key];\n }\n mergeQueue[key] = [changes];\n\n mergeQueuePromise[key] = get(key)\n .then((existingValue) => {\n try {\n // We first only merge the changes, so we can provide these to the native implementation (SQLite uses only delta changes in \"JSON_PATCH\" to merge)\n // We don't want to remove null values from the \"batchedChanges\", because SQLite uses them to remove keys from storage natively.\n let batchedChanges = applyMerge(undefined, mergeQueue[key], false);\n\n if (_.isNull(batchedChanges)) {\n remove(key);\n return;\n }\n\n // The presence of a `null` in the merge queue instructs us to drop the existing value.\n // In this case, we can't simply merge the batched changes with the existing value, because then the null in the merge queue would have no effect\n const shouldOverwriteExistingValue = _.includes(mergeQueue[key], null);\n\n // Clean up the write queue, so we don't apply these changes again\n delete mergeQueue[key];\n delete mergeQueuePromise[key];\n\n // After that we merge the batched changes with the existing value\n // We can remove null values from the \"modifiedData\", because \"null\" implicates that the user wants to remove a value from storage.\n // The \"modifiedData\" will be directly \"set\" in storage instead of being merged\n const modifiedData = shouldOverwriteExistingValue ? batchedChanges : applyMerge(existingValue, [batchedChanges], true);\n\n // On native platforms we use SQLite which utilises JSON_PATCH to merge changes.\n // JSON_PATCH generally removes null values from the stored object.\n // When there is no existing value though, SQLite will just insert the changes as a new value and thus the null values won't be removed.\n // Therefore we need to remove null values from the `batchedChanges` which are sent to the SQLite, if no existing value is present.\n if (!existingValue) {\n batchedChanges = applyMerge(undefined, [batchedChanges], true);\n }\n\n const hasChanged = cache.hasValueChanged(key, modifiedData);\n\n // This approach prioritizes fast UI changes without waiting for data to be stored in device storage.\n const updatePromise = broadcastUpdate(key, modifiedData, hasChanged, 'merge');\n\n // If the value has not changed, calling Storage.setItem() would be redundant and a waste of performance, so return early instead.\n if (!hasChanged) {\n return updatePromise;\n }\n\n return Storage.mergeItem(key, batchedChanges, modifiedData)\n .then(() => updatePromise);\n } catch (error) {\n Logger.logAlert(`An error occurred while applying merge for key: ${key}, Error: ${error}`);\n return Promise.resolve();\n }\n });\n\n return mergeQueuePromise[key];\n}\n\n/**\n * Merge user provided default key value pairs.\n * @private\n * @returns {Promise}\n */\nfunction initializeWithDefaultKeyStates() {\n return Storage.multiGet(_.keys(defaultKeyStates))\n .then((pairs) => {\n const asObject = _.object(pairs);\n\n const merged = utils.fastMerge(asObject, defaultKeyStates);\n cache.merge(merged);\n _.each(merged, (val, key) => keyChanged(key, val));\n });\n}\n\n/**\n * Clear out all the data in the store\n *\n * Note that calling Onyx.clear() and then Onyx.set() on a key with a default\n * key state may store an unexpected value in Storage.\n *\n * E.g.\n * Onyx.clear();\n * Onyx.set(ONYXKEYS.DEFAULT_KEY, 'default');\n * Storage.getItem(ONYXKEYS.DEFAULT_KEY)\n * .then((storedValue) => console.log(storedValue));\n * null is logged instead of the expected 'default'\n *\n * Onyx.set() might call Storage.setItem() before Onyx.clear() calls\n * Storage.setItem(). Use Onyx.merge() instead if possible. Onyx.merge() calls\n * Onyx.get(key) before calling Storage.setItem() via Onyx.set().\n * Storage.setItem() from Onyx.clear() will have already finished and the merged\n * value will be saved to storage after the default value.\n *\n * @param {Array} keysToPreserve is a list of ONYXKEYS that should not be cleared with the rest of the data\n * @returns {Promise<void>}\n */\nfunction clear(keysToPreserve = []) {\n return getAllKeys()\n .then((keys) => {\n const keysToBeClearedFromStorage = [];\n const keyValuesToResetAsCollection = {};\n const keyValuesToResetIndividually = {};\n\n // The only keys that should not be cleared are:\n // 1. Anything specifically passed in keysToPreserve (because some keys like language preferences, offline\n // status, or activeClients need to remain in Onyx even when signed out)\n // 2. Any keys with a default state (because they need to remain in Onyx as their default, and setting them\n // to null would cause unknown behavior)\n _.each(keys, (key) => {\n const isKeyToPreserve = _.contains(keysToPreserve, key);\n const isDefaultKey = _.has(defaultKeyStates, key);\n\n // If the key is being removed or reset to default:\n // 1. Update it in the cache\n // 2. Figure out whether it is a collection key or not,\n // since collection key subscribers need to be updated differently\n if (!isKeyToPreserve) {\n const oldValue = cache.getValue(key);\n const newValue = _.get(defaultKeyStates, key, null);\n if (newValue !== oldValue) {\n cache.set(key, newValue);\n const collectionKey = key.substring(0, key.indexOf('_') + 1);\n if (collectionKey) {\n if (!keyValuesToResetAsCollection[collectionKey]) {\n keyValuesToResetAsCollection[collectionKey] = {};\n }\n keyValuesToResetAsCollection[collectionKey][key] = newValue;\n } else {\n keyValuesToResetIndividually[key] = newValue;\n }\n }\n }\n\n if (isKeyToPreserve || isDefaultKey) {\n return;\n }\n\n // If it isn't preserved and doesn't have a default, we'll remove it\n keysToBeClearedFromStorage.push(key);\n });\n\n const updatePromises = [];\n\n // Notify the subscribers for each key/value group so they can receive the new values\n _.each(keyValuesToResetIndividually, (value, key) => {\n updatePromises.push(scheduleSubscriberUpdate(key, value));\n });\n _.each(keyValuesToResetAsCollection, (value, key) => {\n updatePromises.push(scheduleNotifyCollectionSubscribers(key, value));\n });\n\n const defaultKeyValuePairs = _.pairs(_.omit(defaultKeyStates, keysToPreserve));\n\n // Remove only the items that we want cleared from storage, and reset others to default\n _.each(keysToBeClearedFromStorage, key => cache.drop(key));\n return Storage.removeItems(keysToBeClearedFromStorage).then(() => Storage.multiSet(defaultKeyValuePairs)).then(() => Promise.all(updatePromises));\n });\n}\n\n/**\n * Merges a collection based on their keys\n *\n * @example\n *\n * Onyx.mergeCollection(ONYXKEYS.COLLECTION.REPORT, {\n * [`${ONYXKEYS.COLLECTION.REPORT}1`]: report1,\n * [`${ONYXKEYS.COLLECTION.REPORT}2`]: report2,\n * });\n *\n * @param {String} collectionKey e.g. `ONYXKEYS.COLLECTION.REPORT`\n * @param {Object} collection Object collection keyed by individual collection member keys and values\n * @returns {Promise}\n */\nfunction mergeCollection(collectionKey, collection) {\n if (!_.isObject(collection) || _.isArray(collection) || _.isEmpty(collection)) {\n Logger.logInfo('mergeCollection() called with invalid or empty value. Skipping this update.');\n return Promise.resolve();\n }\n\n // Confirm all the collection keys belong to the same parent\n let hasCollectionKeyCheckFailed = false;\n _.each(collection, (_data, dataKey) => {\n if (isKeyMatch(collectionKey, dataKey)) {\n return;\n }\n\n if (process.env.NODE_ENV === 'development') {\n throw new Error(`Provided collection doesn't have all its data belonging to the same parent. CollectionKey: ${collectionKey}, DataKey: ${dataKey}`);\n }\n\n hasCollectionKeyCheckFailed = true;\n Logger.logAlert(`Provided collection doesn't have all its data belonging to the same parent. CollectionKey: ${collectionKey}, DataKey: ${dataKey}`);\n });\n\n // Gracefully handle bad mergeCollection updates so it doesn't block the merge queue\n if (hasCollectionKeyCheckFailed) {\n return Promise.resolve();\n }\n\n return getAllKeys()\n .then((persistedKeys) => {\n // Split to keys that exist in storage and keys that don't\n const [existingKeys, newKeys] = _.chain(collection)\n .pick((value, key) => {\n if (_.isNull(value)) {\n remove(key);\n return false;\n }\n return true;\n })\n .keys()\n .partition(key => persistedKeys.includes(key))\n .value();\n\n const existingKeyCollection = _.pick(collection, existingKeys);\n const newCollection = _.pick(collection, newKeys);\n const keyValuePairsForExistingCollection = prepareKeyValuePairsForStorage(existingKeyCollection);\n const keyValuePairsForNewCollection = prepareKeyValuePairsForStorage(newCollection);\n\n const promises = [];\n\n // New keys will be added via multiSet while existing keys will be updated using multiMerge\n // This is because setting a key that doesn't exist yet with multiMerge will throw errors\n if (keyValuePairsForExistingCollection.length > 0) {\n promises.push(Storage.multiMerge(keyValuePairsForExistingCollection));\n }\n\n if (keyValuePairsForNewCollection.length > 0) {\n promises.push(Storage.multiSet(keyValuePairsForNewCollection));\n }\n\n // Prefill cache if necessary by calling get() on any existing keys and then merge original data to cache\n // and update all subscribers\n const promiseUpdate = Promise.all(_.map(existingKeys, get)).then(() => {\n cache.merge(collection);\n return scheduleNotifyCollectionSubscribers(collectionKey, collection);\n });\n\n return Promise.all(promises)\n .catch(error => evictStorageAndRetry(error, mergeCollection, collection))\n .then(() => promiseUpdate);\n });\n}\n\n/**\n * Insert API responses and lifecycle data into Onyx\n *\n * @param {Array} data An array of objects with shape {onyxMethod: oneOf('set', 'merge', 'mergeCollection', 'multiSet', 'clear'), key: string, value: *}\n * @returns {Promise} resolves when all operations are complete\n */\nfunction update(data) {\n // First, validate the Onyx object is in the format we expect\n _.each(data, ({onyxMethod, key, value}) => {\n if (!_.contains([METHOD.CLEAR, METHOD.SET, METHOD.MERGE, METHOD.MERGE_COLLECTION, METHOD.MULTI_SET], onyxMethod)) {\n throw new Error(`Invalid onyxMethod ${onyxMethod} in Onyx update.`);\n }\n if (onyxMethod === METHOD.MULTI_SET) {\n // For multiset, we just expect the value to be an object\n if (!_.isObject(value) || _.isArray(value) || _.isFunction(value)) {\n throw new Error('Invalid value provided in Onyx multiSet. Onyx multiSet value must be of type object.');\n }\n } else if (onyxMethod !== METHOD.CLEAR && !_.isString(key)) {\n throw new Error(`Invalid ${typeof key} key provided in Onyx update. Onyx key must be of type string.`);\n }\n });\n\n const promises = [];\n let clearPromise = Promise.resolve();\n\n _.each(data, ({onyxMethod, key, value}) => {\n switch (onyxMethod) {\n case METHOD.SET:\n promises.push(() => set(key, value));\n break;\n case METHOD.MERGE:\n promises.push(() => merge(key, value));\n break;\n case METHOD.MERGE_COLLECTION:\n promises.push(() => mergeCollection(key, value));\n break;\n case METHOD.MULTI_SET:\n promises.push(() => multiSet(value));\n break;\n case METHOD.CLEAR:\n clearPromise = clear();\n break;\n default:\n break;\n }\n });\n\n return clearPromise.then(() => Promise.all(_.map(promises, p => p())));\n}\n\n/**\n * When set these keys will not be persisted to storage\n * @param {string[]} keyList\n */\nfunction setMemoryOnlyKeys(keyList) {\n Storage.setMemoryOnlyKeys(keyList);\n\n // When in memory only mode for certain keys we do not want to ever drop items from the cache as the user will have no way to recover them again via storage.\n cache.setRecentKeysLimit(Infinity);\n}\n\n/**\n * Initialize the store with actions and listening for storage events\n *\n * @param {Object} [options={}] config object\n * @param {Object} [options.keys={}] `ONYXKEYS` constants object\n * @param {Object} [options.initialKeyStates={}] initial data to set when `init()` and `clear()` is called\n * @param {String[]} [options.safeEvictionKeys=[]] This is an array of keys\n * (individual or collection patterns) that when provided to Onyx are flagged\n * as \"safe\" for removal. Any components subscribing to these keys must also\n * implement a canEvict option. See the README for more info.\n * @param {Number} [options.maxCachedKeysCount=55] Sets how many recent keys should we try to keep in cache\n * Setting this to 0 would practically mean no cache\n * We try to free cache when we connect to a safe eviction key\n * @param {Boolean} [options.captureMetrics] Enables Onyx benchmarking and exposes the get/print/reset functions\n * @param {Boolean} [options.shouldSyncMultipleInstances] Auto synchronize storage events between multiple instances\n * of Onyx running in different tabs/windows. Defaults to true for platforms that support local storage (web/desktop)\n * @param {Boolean} [options.debugSetState] Enables debugging setState() calls to connected components.\n * @example\n * Onyx.init({\n * keys: ONYXKEYS,\n * initialKeyStates: {\n * [ONYXKEYS.SESSION]: {loading: false},\n * },\n * });\n */\nfunction init({\n keys = {},\n initialKeyStates = {},\n safeEvictionKeys = [],\n maxCachedKeysCount = 1000,\n captureMetrics = false,\n shouldSyncMultipleInstances = Boolean(global.localStorage),\n debugSetState = false,\n} = {}) {\n if (captureMetrics) {\n // The code here is only bundled and applied when the captureMetrics is set\n // eslint-disable-next-line no-use-before-define\n applyDecorators();\n }\n\n if (debugSetState) {\n PerformanceUtils.setShouldDebugSetState(true);\n }\n\n if (maxCachedKeysCount > 0) {\n cache.setRecentKeysLimit(maxCachedKeysCount);\n }\n\n // We need the value of the collection keys later for checking if a\n // key is a collection. We store it in a map for faster lookup.\n const collectionValues = _.values(keys.COLLECTION);\n onyxCollectionKeyMap = _.reduce(collectionValues, (acc, val) => {\n acc.set(val, true);\n return acc;\n }, new Map());\n\n // Set our default key states to use when initializing and clearing Onyx data\n defaultKeyStates = initialKeyStates;\n\n // Let Onyx know about which keys are safe to evict\n evictionAllowList = safeEvictionKeys;\n\n // Initialize all of our keys with data provided then give green light to any pending connections\n Promise.all([\n addAllSafeEvictionKeysToRecentlyAccessedList(),\n initializeWithDefaultKeyStates(),\n ])\n .then(deferredInitTask.resolve);\n\n if (shouldSyncMultipleInstances && _.isFunction(Storage.keepInstancesSync)) {\n Storage.keepInstancesSync((key, value) => {\n cache.set(key, value);\n keyChanged(key, value);\n });\n }\n}\n\nconst Onyx = {\n connect,\n disconnect,\n set,\n multiSet,\n merge,\n mergeCollection,\n update,\n clear,\n getAllKeys,\n init,\n registerLogger: Logger.registerLogger,\n addToEvictionBlockList,\n removeFromEvictionBlockList,\n isSafeEvictionKey,\n METHOD,\n setMemoryOnlyKeys,\n tryGetCachedValue,\n hasPendingMergeForKey,\n};\n\n/**\n * Apply calls statistic decorators to benchmark Onyx\n *\n * @private\n */\nfunction applyDecorators() {\n // We're requiring the script dynamically here so that it's only evaluated when decorators are used\n const decorate = require('./metrics');\n\n // Re-assign with decorated functions\n /* eslint-disable no-func-assign */\n get = decorate.decorateWithMetrics(get, 'Onyx:get');\n set = decorate.decorateWithMetrics(set, 'Onyx:set');\n multiSet = decorate.decorateWithMetrics(multiSet, 'Onyx:multiSet');\n clear = decorate.decorateWithMetrics(clear, 'Onyx:clear');\n merge = decorate.decorateWithMetrics(merge, 'Onyx:merge');\n mergeCollection = decorate.decorateWithMetrics(mergeCollection, 'Onyx:mergeCollection');\n getAllKeys = decorate.decorateWithMetrics(getAllKeys, 'Onyx:getAllKeys');\n initializeWithDefaultKeyStates = decorate.decorateWithMetrics(initializeWithDefaultKeyStates, 'Onyx:defaults');\n update = decorate.decorateWithMetrics(update, 'Onyx:update');\n /* eslint-enable */\n\n // Re-expose decorated methods\n /* eslint-disable rulesdir/prefer-actions-set-data */\n Onyx.set = set;\n Onyx.multiSet = multiSet;\n Onyx.clear = clear;\n Onyx.merge = merge;\n Onyx.mergeCollection = mergeCollection;\n Onyx.update = update;\n /* eslint-enable */\n\n // Expose stats methods on Onyx\n Onyx.getMetrics = decorate.getMetrics;\n Onyx.resetMetrics = decorate.resetMetrics;\n Onyx.printMetrics = decorate.printMetrics;\n}\n\nexport default Onyx;\n","/**\n * Create a deferred task that can be resolved when we call `resolve()`\n * The returned promise will complete when we call `resolve`\n * Useful when we want to wait for a tasks that is resolved from an external action\n *\n * @template T\n * @returns {{ resolve: function(*), promise: Promise<T|void> }}\n */\nexport default function createDeferredTask() {\n const deferred = {};\n deferred.promise = new Promise((res) => {\n deferred.resolve = res;\n });\n\n return deferred;\n}\n","/**\n * This is a higher order component that provides the ability to map a state property directly to\n * something in Onyx (a key/value store). That way, as soon as data in Onyx changes, the state will be set and the view\n * will automatically change to reflect the new data.\n */\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport _ from 'underscore';\nimport Onyx from './Onyx';\nimport * as Str from './Str';\nimport utils from './utils';\n\n/**\n * Returns the display name of a component\n *\n * @param {object} component\n * @returns {string}\n */\nfunction getDisplayName(component) {\n return component.displayName || component.name || 'Component';\n}\n\n/**\n * Removes all the keys from state that are unrelated to the onyx data being mapped to the component.\n *\n * @param {Object} state of the component\n * @param {Object} onyxToStateMapping the object holding all of the mapping configuration for the component\n * @returns {Object}\n */\nconst getOnyxDataFromState = (state, onyxToStateMapping) => _.pick(state, _.keys(onyxToStateMapping));\n\nexport default function (mapOnyxToState, shouldDelayUpdates = false) {\n // A list of keys that must be present in tempState before we can render the WrappedComponent\n const requiredKeysForInit = _.chain(mapOnyxToState)\n .omit(config => config.initWithStoredValues === false)\n .keys()\n .value();\n return (WrappedComponent) => {\n const displayName = getDisplayName(WrappedComponent);\n class withOnyx extends React.Component {\n pendingSetStates = [];\n\n constructor(props) {\n super(props);\n this.shouldDelayUpdates = shouldDelayUpdates;\n this.setWithOnyxState = this.setWithOnyxState.bind(this);\n this.flushPendingSetStates = this.flushPendingSetStates.bind(this);\n\n // This stores all the Onyx connection IDs to be used when the component unmounts so everything can be\n // disconnected. It is a key value store with the format {[mapping.key]: connectionID}.\n this.activeConnectionIDs = {};\n\n const cachedState = _.reduce(\n mapOnyxToState,\n (resultObj, mapping, propertyName) => {\n const key = Str.result(mapping.key, props);\n let value = Onyx.tryGetCachedValue(key, mapping);\n if (!value && mapping.initialValue) {\n value = mapping.initialValue;\n }\n\n /**\n * If we have a pending merge for a key it could mean that data is being set via Onyx.merge() and someone expects a component to have this data immediately.\n *\n * @example\n *\n * Onyx.merge('report_123', value);\n * Navigation.navigate(route); // Where \"route\" expects the \"value\" to be available immediately once rendered.\n *\n * In reality, Onyx.merge() will only update the subscriber after all merges have been batched and the previous value is retrieved via a get() (returns a promise).\n * So, we won't use the cache optimization here as it will lead us to arbitrarily defer various actions in the application code.\n */\n if (\n (value !== undefined\n && !Onyx.hasPendingMergeForKey(key))\n || mapping.allowStaleData\n ) {\n // eslint-disable-next-line no-param-reassign\n resultObj[propertyName] = value;\n }\n\n return resultObj;\n },\n {},\n );\n\n // If we have all the data we need, then we can render the component immediately\n cachedState.loading = _.size(cachedState) < requiredKeysForInit.length;\n\n // Object holding the temporary initial state for the component while we load the various Onyx keys\n this.tempState = cachedState;\n\n this.state = cachedState;\n }\n\n componentDidMount() {\n // Subscribe each of the state properties to the proper Onyx key\n _.each(mapOnyxToState, (mapping, propertyName) => {\n this.connectMappingToOnyx(mapping, propertyName);\n });\n this.checkEvictableKeys();\n }\n\n componentDidUpdate() {\n // When the state is passed to the key functions with Str.result(), omit anything\n // from state that was not part of the mapped keys.\n const onyxDataFromState = getOnyxDataFromState(this.state, mapOnyxToState);\n\n // If any of the mappings use data from the props, then when the props change, all the\n // connections need to be reconnected with the new props\n _.each(mapOnyxToState, (mapping, propName) => {\n const previousKey = mapping.previousKey;\n const newKey = Str.result(mapping.key, {...this.props, ...onyxDataFromState});\n if (previousKey !== newKey) {\n Onyx.disconnect(this.activeConnectionIDs[previousKey], previousKey);\n delete this.activeConnectionIDs[previousKey];\n this.connectMappingToOnyx(mapping, propName);\n }\n });\n this.checkEvictableKeys();\n }\n\n componentWillUnmount() {\n // Disconnect everything from Onyx\n _.each(mapOnyxToState, (mapping) => {\n const key = Str.result(mapping.key, {...this.props, ...getOnyxDataFromState(this.state, mapOnyxToState)});\n Onyx.disconnect(this.activeConnectionIDs[key], key);\n });\n }\n\n setStateProxy(modifier) {\n if (this.shouldDelayUpdates) {\n this.pendingSetStates.push(modifier);\n } else {\n this.setState(modifier);\n }\n }\n\n /**\n * This method is used by the internal raw Onyx `sendDataToConnection`, it is designed to prevent unnecessary renders while a component\n * still in a \"loading\" (read \"mounting\") state. The temporary initial state is saved to the HOC instance and setState()\n * only called once all the necessary data has been collected.\n *\n * There is however the possibility the component could have been updated by a call to setState()\n * before the data was \"initially\" collected. A race condition.\n * For example some update happened on some key, while onyx was still gathering the initial hydration data.\n * This update is disptached directly to setStateProxy and therefore the component has the most up-to-date data\n *\n * This is a design flaw in Onyx itself as dispatching updates before initial hydration is not a correct event flow.\n * We however need to workaround this issue in the HOC. The addition of initialValue makes things even more complex,\n * since you cannot be really sure if the component has been updated before or after the initial hydration. Therefore if\n * initialValue is there, we just check if the update is different than that and then try to handle it as best as we can.\n *\n * @param {String} statePropertyName\n * @param {*} val\n */\n setWithOnyxState(statePropertyName, val) {\n const prevValue = this.state[statePropertyName];\n\n // If the component is not loading (read \"mounting\"), then we can just update the state\n // There is a small race condition.\n // When calling setWithOnyxState we delete the tempState object that is used to hold temporary state updates while the HOC is gathering data.\n // However the loading flag is only set on the setState callback down below. setState however is an async operation that is also batched,\n // therefore there is a small window of time where the loading flag is not false but the tempState is already gone\n // (while the update is queued and waiting to be applied).\n // This simply bypasses the loading check if the tempState is gone and the update can be safely queued with a normal setStateProxy.\n if (!this.state.loading || !this.tempState) {\n // Performance optimization, do not trigger update with same values\n if (prevValue === val || utils.areObjectsEmpty(prevValue, val)) {\n return;\n }\n\n this.setStateProxy({[statePropertyName]: val});\n return;\n }\n\n this.tempState[statePropertyName] = val;\n\n // If some key does not have a value yet, do not update the state yet\n const tempStateIsMissingKey = _.some(requiredKeysForInit, key => _.isUndefined(this.tempState[key]));\n if (tempStateIsMissingKey) {\n return;\n }\n\n const stateUpdate = {...this.tempState};\n delete this.tempState;\n\n // Full of hacky workarounds to prevent the race condition described above.\n this.setState((prevState) => {\n const finalState = _.reduce(stateUpdate, (result, value, key) => {\n if (key === 'loading') {\n return result;\n }\n\n const initialValue = mapOnyxToState[key].initialValue;\n\n // If initialValue is there and the state contains something different it means\n // an update has already been received and we can discard the value we are trying to hydrate\n if (!_.isUndefined(initialValue) && !_.isUndefined(prevState[key]) && prevState[key] !== initialValue) {\n // eslint-disable-next-line no-param-reassign\n result[key] = prevState[key];\n\n // if value is already there (without initial value) then we can discard the value we are trying to hydrate\n } else if (!_.isUndefined(prevState[key])) {\n // eslint-disable-next-line no-param-reassign\n result[key] = prevState[key];\n } else {\n // eslint-disable-next-line no-param-reassign\n result[key] = value;\n }\n return result;\n }, {});\n\n finalState.loading = false;\n return finalState;\n });\n }\n\n /**\n * Makes sure each Onyx key we requested has been set to state with a value of some kind.\n * We are doing this so that the wrapped component will only render when all the data\n * it needs is available to it.\n */\n checkEvictableKeys() {\n // We will add this key to our list of recently accessed keys\n // if the canEvict function returns true. This is necessary criteria\n // we MUST use to specify if a key can be removed or not.\n _.each(mapOnyxToState, (mapping) => {\n if (_.isUndefined(mapping.canEvict)) {\n return;\n }\n\n const canEvict = Str.result(mapping.canEvict, this.props);\n const key = Str.result(mapping.key, this.props);\n\n if (!Onyx.isSafeEvictionKey(key)) {\n throw new Error(`canEvict can't be used on key '${key}'. This key must explicitly be flagged as safe for removal by adding it to Onyx.init({safeEvictionKeys: []}).`);\n }\n\n if (canEvict) {\n Onyx.removeFromEvictionBlockList(key, mapping.connectionID);\n } else {\n Onyx.addToEvictionBlockList(key, mapping.connectionID);\n }\n });\n }\n\n /**\n * Takes a single mapping and binds the state of the component to the store\n *\n * @param {object} mapping\n * @param {string|function} mapping.key key to connect to. can be a string or a\n * function that takes this.props as an argument and returns a string\n * @param {string} statePropertyName the name of the state property that Onyx will add the data to\n * @param {boolean} [mapping.initWithStoredValues] If set to false, then no data will be prefilled into the\n * component\n */\n connectMappingToOnyx(mapping, statePropertyName) {\n const key = Str.result(mapping.key, {...this.props, ...getOnyxDataFromState(this.state, mapOnyxToState)});\n\n // Remember the previous key so that if it ever changes, the component will reconnect to Onyx\n // in componentDidUpdate\n if (statePropertyName !== 'initialValue' && mapOnyxToState[statePropertyName]) {\n // eslint-disable-next-line no-param-reassign\n mapOnyxToState[statePropertyName].previousKey = key;\n }\n\n // eslint-disable-next-line rulesdir/prefer-onyx-connect-in-libs\n this.activeConnectionIDs[key] = Onyx.connect({\n ...mapping,\n key,\n statePropertyName,\n withOnyxInstance: this,\n displayName,\n });\n }\n\n flushPendingSetStates() {\n if (!this.shouldDelayUpdates) {\n return;\n }\n\n this.shouldDelayUpdates = false;\n\n this.pendingSetStates.forEach((modifier) => {\n this.setState(modifier);\n });\n this.pendingSetStates = [];\n }\n\n render() {\n // Remove any null values so that React replaces them with default props\n const propsToPass = _.omit(this.props, _.isNull);\n\n if (this.state.loading) {\n return null;\n }\n\n // Remove any internal state properties used by withOnyx\n // that should not be passed to a wrapped component\n let stateToPass = _.omit(this.state, 'loading');\n stateToPass = _.omit(stateToPass, _.isNull);\n\n // Spreading props and state is necessary in an HOC where the data cannot be predicted\n return (\n <WrappedComponent\n markReadyForHydration={this.flushPendingSetStates}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...propsToPass}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...stateToPass}\n ref={this.props.forwardedRef}\n />\n );\n }\n }\n\n withOnyx.propTypes = {\n forwardedRef: PropTypes.oneOfType([\n PropTypes.func,\n // eslint-disable-next-line react/forbid-prop-types\n PropTypes.shape({current: PropTypes.object}),\n ]),\n };\n withOnyx.defaultProps = {\n forwardedRef: undefined,\n };\n withOnyx.displayName = `withOnyx(${displayName})`;\n return React.forwardRef((props, ref) => {\n const Component = withOnyx;\n // eslint-disable-next-line react/jsx-props-no-spreading\n return <Component {...props} forwardedRef={ref} />;\n });\n };\n}\n","import Onyx from './Onyx';\nimport withOnyx from './withOnyx';\n\nexport default Onyx;\nexport {withOnyx};\n"],"names":["root","factory","exports","module","require","define","amd","self","__WEBPACK_EXTERNAL_MODULE__746__","__WEBPACK_EXTERNAL_MODULE__952__","__WEBPACK_EXTERNAL_MODULE__111__","__WEBPACK_EXTERNAL_MODULE__802__","__WEBPACK_EXTERNAL_MODULE__407__","__WEBPACK_EXTERNAL_MODULE__156__","decorateWithMetrics","func","getMetrics","printMetrics","resetMetrics","ReactPropTypesSecret","emptyFunction","emptyFunctionWithReset","resetWarningCache","shim","props","propName","componentName","location","propFullName","secret","err","Error","name","getShim","isRequired","ReactPropTypes","array","bool","number","object","string","symbol","any","arrayOf","element","elementType","instanceOf","node","objectOf","oneOf","oneOfType","shape","exact","checkPropTypes","PropTypes","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","g","globalThis","this","Function","e","window","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","logger","logAlert","message","level","logInfo","isMergeableObject","val","toString","Array","isArray","fastMerge","target","source","shouldRemoveNullObjectValues","arguments","length","_","destination","targetKeys","keys","i","isSourceOrTargetNull","sourceKeys","shouldOmitSourceKey","isSourceKeyMergable","mergeObject","areObjectsEmpty","b","removeNestedNullValues","isDefined","constructor","storageKeys","Set","recentKeys","storageMap","pendingPromises","Map","getAllKeys","from","getValue","addToAccessedKeys","hasCacheForKey","addKey","add","set","drop","delete","merge","data","assign","utils","mergedKeys","hasPendingTask","taskName","getTaskPromise","captureTask","promise","returnPromise","finally","removeLeastRecentlyUsedKeys","numKeysToRemove","size","maxRecentKeysSize","iterator","values","temp","next","push","setRecentKeysLimit","limit","hasValueChanged","deepEqual","startsWith","haystack","needle","result","parameter","_len","args","_key","debugSetState","setShouldDebugSetState","debug","logSetStateCall","mapping","previousValue","newValue","caller","keyThatChanged","logParams","difference","changes","comparisonObject","lodashTransform","console","displayName","customStoreInstance","getCustomStore","createStore","provider","setItem","multiGet","keysParam","getMany","then","index","multiMerge","pairs","store","Promise","all","_ref","promisifyRequest","upsertMany","_ref2","prev","put","mergeItem","_changes","modifiedData","multiSet","setMany","clear","setMemoryOnlyKeys","getItem","removeItem","del","removeItems","delMany","getDatabaseSize","navigator","storage","estimate","bytesUsed","usage","bytesRemaining","quota","catch","error","SYNC_ONYX","raiseStorageSyncEvent","onyxKey","global","localStorage","Storage","keepInstancesSync","onStorageKeyChanged","raiseStorageSyncManyKeysEvent","onyxKeys","batchedChanges","allKeys","addEventListener","event","METHOD","SET","MERGE","MERGE_COLLECTION","MULTI_SET","CLEAR","mergeQueue","mergeQueuePromise","lastConnectionID","callbackToStateMapping","onyxCollectionKeyMap","recentlyAccessedKeys","evictionAllowList","evictionBlocklist","defaultKeyStates","deferredInitTask","deferred","res","resolve","createDeferredTask","batchUpdatesPromise","batchUpdatesQueue","maybeFlushBatchUpdates","setTimeout","updatesCopy","unstable_batchedUpdates","forEach","applyUpdates","batchUpdates","updates","getSubsetOfData","sourceData","selector","withOnyxInstanceState","reduceCollectionWithSelector","collection","finalCollection","item","cache","Logger","storedKeys","isCollectionKey","has","isCollectionMemberKey","collectionKey","Str","isKeyMatch","configKey","isSafeEvictionKey","testKey","removeLastAccessedKey","addLastAccessedKey","removeFromEvictionBlockList","connectionID","getCachedCollection","collectionMemberKeys","storedKey","curr","cachedValue","keysChanged","partialCollection","notifyRegularSubscibers","notifyWithOnyxSubscibers","stateMappingKeys","subscriber","isSubscribedToCollectionKey","isSubscribedToCollectionMemberKey","cachedCollection","callback","waitForCollectionCallback","dataKeys","j","dataKey","withOnyxInstance","setStateProxy","prevState","previousData","statePropertyName","newData","state","PerformanceUtils","dataFromCollection","prevData","keyChanged","canUpdateSubscriber","prevDataWithNewData","newCollection","sendDataToConnection","matchedKey","isBatched","setWithOnyxState","getCollectionDataAndSendAsObject","matchingKeys","finalObject","scheduleSubscriberUpdate","scheduleNotifyCollectionSubscribers","remove","reportStorageQuota","dbSizeError","evictStorageAndRetry","onyxMethod","keyForRemoval","broadcastUpdate","hasChanged","method","join","initWithStoredValues","hasPendingMergeForKey","Boolean","removeNullValues","valueWithoutNull","updatePromise","prepareKeyValuePairsForStorage","keyValuePairs","updatePromises","keyValuePairsWithoutNull","applyMerge","existingValue","lastChange","change","shouldOverwriteExistingValue","initializeWithDefaultKeyStates","asObject","merged","keysToPreserve","keysToBeClearedFromStorage","keyValuesToResetAsCollection","keyValuesToResetIndividually","isKeyToPreserve","isDefaultKey","oldValue","substring","indexOf","defaultKeyValuePairs","mergeCollection","hasCollectionKeyCheckFailed","_data","persistedKeys","existingKeys","newKeys","pick","partition","includes","existingKeyCollection","keyValuePairsForExistingCollection","keyValuePairsForNewCollection","promises","promiseUpdate","update","_ref3","clearPromise","_ref4","p","Onyx","connect","canEvict","addKeyToRecentlyAccessedIfNeeded","endsWith","disconnect","keyToRemoveFromEvictionBlocklist","init","initialKeyStates","safeEvictionKeys","maxCachedKeysCount","captureMetrics","shouldSyncMultipleInstances","decorate","applyDecorators","collectionValues","COLLECTION","acc","safeEvictionKey","registerLogger","addToEvictionBlockList","keyList","Infinity","tryGetCachedValue","k","getOnyxDataFromState","onyxToStateMapping","mapOnyxToState","shouldDelayUpdates","requiredKeysForInit","omit","config","WrappedComponent","component","withOnyx","React","super","bind","flushPendingSetStates","activeConnectionIDs","cachedState","resultObj","propertyName","initialValue","allowStaleData","loading","tempState","componentDidMount","connectMappingToOnyx","checkEvictableKeys","componentDidUpdate","onyxDataFromState","previousKey","componentWillUnmount","modifier","pendingSetStates","setState","prevValue","stateUpdate","finalState","render","propsToPass","stateToPass","_extends","markReadyForHydration","ref","forwardedRef","propTypes","current","defaultProps","Component"],"sourceRoot":""}
|