parent
0373873b7d
commit
962e6f4137
204 changed files with 9530 additions and 1 deletions
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@ |
||||
{"ast":null,"code":"import { createStore, applyMiddleware, combineReducers } from \"redux\";\nimport { composeWithDevTools } from \"redux-devtools-extension\";\nimport { persistStore, persistReducer } from \"redux-persist\"; // import * as reducers from \"./reducers\";\n\nimport thunk from \"redux-thunk\";\nimport storage from \"redux-persist/lib/storage\"; // defaults to localStorage for web\n\nconst persistConfig = {\n key: \"root\",\n storage\n};\nconst initialState = {};\nconst middleware = [thunk];\nconst persistedReducer = persistReducer(persistConfig, combineReducers(reducers));\nexport default (() => {\n let store = createStore(persistedReducer, initialState, composeWithDevTools(applyMiddleware(...middleware)));\n const persistor = persistStore(store);\n return {\n store,\n persistor\n };\n});","map":{"version":3,"names":["createStore","applyMiddleware","combineReducers","composeWithDevTools","persistStore","persistReducer","thunk","storage","persistConfig","key","initialState","middleware","persistedReducer","reducers","store","persistor"],"sources":["/Users/mahdi/Documents/work/programming/barnameNegar/arbaeenWebApp/src/redux/store.js"],"sourcesContent":["import { createStore, applyMiddleware, combineReducers } from \"redux\";\nimport { composeWithDevTools } from \"redux-devtools-extension\";\nimport { persistStore, persistReducer } from \"redux-persist\";\n\n// import * as reducers from \"./reducers\";\nimport thunk from \"redux-thunk\";\nimport storage from \"redux-persist/lib/storage\"; // defaults to localStorage for web\n\nconst persistConfig = {\n key: \"root\",\n storage,\n};\n\nconst initialState = {};\nconst middleware = [thunk];\n\nconst persistedReducer = persistReducer(\n persistConfig,\n combineReducers(reducers)\n);\n\nexport default () => {\n let store = createStore(\n persistedReducer,\n initialState,\n composeWithDevTools(applyMiddleware(...middleware))\n );\n const persistor = persistStore(store);\n\n return { store, persistor };\n};\n"],"mappings":"AAAA,SAASA,WAAT,EAAsBC,eAAtB,EAAuCC,eAAvC,QAA8D,OAA9D;AACA,SAASC,mBAAT,QAAoC,0BAApC;AACA,SAASC,YAAT,EAAuBC,cAAvB,QAA6C,eAA7C,C,CAEA;;AACA,OAAOC,KAAP,MAAkB,aAAlB;AACA,OAAOC,OAAP,MAAoB,2BAApB,C,CAAiD;;AAEjD,MAAMC,aAAa,GAAG;EACpBC,GAAG,EAAE,MADe;EAEpBF;AAFoB,CAAtB;AAKA,MAAMG,YAAY,GAAG,EAArB;AACA,MAAMC,UAAU,GAAG,CAACL,KAAD,CAAnB;AAEA,MAAMM,gBAAgB,GAAGP,cAAc,CACrCG,aADqC,EAErCN,eAAe,CAACW,QAAD,CAFsB,CAAvC;AAKA,gBAAe,MAAM;EACnB,IAAIC,KAAK,GAAGd,WAAW,CACrBY,gBADqB,EAErBF,YAFqB,EAGrBP,mBAAmB,CAACF,eAAe,CAAC,GAAGU,UAAJ,CAAhB,CAHE,CAAvB;EAKA,MAAMI,SAAS,GAAGX,YAAY,CAACU,KAAD,CAA9B;EAEA,OAAO;IAAEA,KAAF;IAASC;EAAT,CAAP;AACD,CATD"},"metadata":{},"sourceType":"module"} |
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@ |
||||
{"ast":null,"code":"import { KEY_PREFIX } from './constants';\nexport default function purgeStoredState(config) {\n var storage = config.storage;\n var storageKey = \"\".concat(config.keyPrefix !== undefined ? config.keyPrefix : KEY_PREFIX).concat(config.key);\n return storage.removeItem(storageKey, warnIfRemoveError);\n}\n\nfunction warnIfRemoveError(err) {\n if (err && process.env.NODE_ENV !== 'production') {\n console.error('redux-persist/purgeStoredState: Error purging data stored state', err);\n }\n}","map":{"version":3,"names":["KEY_PREFIX","purgeStoredState","config","storage","storageKey","concat","keyPrefix","undefined","key","removeItem","warnIfRemoveError","err","process","env","NODE_ENV","console","error"],"sources":["/Users/mahdi/Documents/work/programming/barnameNegar/arbaeenWebApp/node_modules/redux-persist/es/purgeStoredState.js"],"sourcesContent":["import { KEY_PREFIX } from './constants';\nexport default function purgeStoredState(config) {\n var storage = config.storage;\n var storageKey = \"\".concat(config.keyPrefix !== undefined ? config.keyPrefix : KEY_PREFIX).concat(config.key);\n return storage.removeItem(storageKey, warnIfRemoveError);\n}\n\nfunction warnIfRemoveError(err) {\n if (err && process.env.NODE_ENV !== 'production') {\n console.error('redux-persist/purgeStoredState: Error purging data stored state', err);\n }\n}"],"mappings":"AAAA,SAASA,UAAT,QAA2B,aAA3B;AACA,eAAe,SAASC,gBAAT,CAA0BC,MAA1B,EAAkC;EAC/C,IAAIC,OAAO,GAAGD,MAAM,CAACC,OAArB;EACA,IAAIC,UAAU,GAAG,GAAGC,MAAH,CAAUH,MAAM,CAACI,SAAP,KAAqBC,SAArB,GAAiCL,MAAM,CAACI,SAAxC,GAAoDN,UAA9D,EAA0EK,MAA1E,CAAiFH,MAAM,CAACM,GAAxF,CAAjB;EACA,OAAOL,OAAO,CAACM,UAAR,CAAmBL,UAAnB,EAA+BM,iBAA/B,CAAP;AACD;;AAED,SAASA,iBAAT,CAA2BC,GAA3B,EAAgC;EAC9B,IAAIA,GAAG,IAAIC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAApC,EAAkD;IAChDC,OAAO,CAACC,KAAR,CAAc,iEAAd,EAAiFL,GAAjF;EACD;AACF"},"metadata":{},"sourceType":"module"} |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@ |
||||
{"ast":null,"code":"export { default as persistReducer } from './persistReducer';\nexport { default as persistCombineReducers } from './persistCombineReducers';\nexport { default as persistStore } from './persistStore';\nexport { default as createMigrate } from './createMigrate';\nexport { default as createTransform } from './createTransform';\nexport { default as getStoredState } from './getStoredState';\nexport { default as createPersistoid } from './createPersistoid';\nexport { default as purgeStoredState } from './purgeStoredState';\nexport * from './constants';","map":{"version":3,"names":["default","persistReducer","persistCombineReducers","persistStore","createMigrate","createTransform","getStoredState","createPersistoid","purgeStoredState"],"sources":["/Users/mahdi/Documents/work/programming/barnameNegar/arbaeenWebApp/node_modules/redux-persist/es/index.js"],"sourcesContent":["export { default as persistReducer } from './persistReducer';\nexport { default as persistCombineReducers } from './persistCombineReducers';\nexport { default as persistStore } from './persistStore';\nexport { default as createMigrate } from './createMigrate';\nexport { default as createTransform } from './createTransform';\nexport { default as getStoredState } from './getStoredState';\nexport { default as createPersistoid } from './createPersistoid';\nexport { default as purgeStoredState } from './purgeStoredState';\nexport * from './constants';"],"mappings":"AAAA,SAASA,OAAO,IAAIC,cAApB,QAA0C,kBAA1C;AACA,SAASD,OAAO,IAAIE,sBAApB,QAAkD,0BAAlD;AACA,SAASF,OAAO,IAAIG,YAApB,QAAwC,gBAAxC;AACA,SAASH,OAAO,IAAII,aAApB,QAAyC,iBAAzC;AACA,SAASJ,OAAO,IAAIK,eAApB,QAA2C,mBAA3C;AACA,SAASL,OAAO,IAAIM,cAApB,QAA0C,kBAA1C;AACA,SAASN,OAAO,IAAIO,gBAApB,QAA4C,oBAA5C;AACA,SAASP,OAAO,IAAIQ,gBAApB,QAA4C,oBAA5C;AACA,cAAc,aAAd"},"metadata":{},"sourceType":"module"} |
@ -0,0 +1 @@ |
||||
{"ast":null,"code":"import { combineReducers } from 'redux';\nimport persistReducer from './persistReducer';\nimport autoMergeLevel2 from './stateReconciler/autoMergeLevel2'; // combineReducers + persistReducer with stateReconciler defaulted to autoMergeLevel2\n\nexport default function persistCombineReducers(config, reducers) {\n config.stateReconciler = config.stateReconciler === undefined ? autoMergeLevel2 : config.stateReconciler;\n return persistReducer(config, combineReducers(reducers));\n}","map":{"version":3,"names":["combineReducers","persistReducer","autoMergeLevel2","persistCombineReducers","config","reducers","stateReconciler","undefined"],"sources":["/Users/mahdi/Documents/work/programming/barnameNegar/arbaeenWebApp/node_modules/redux-persist/es/persistCombineReducers.js"],"sourcesContent":["import { combineReducers } from 'redux';\nimport persistReducer from './persistReducer';\nimport autoMergeLevel2 from './stateReconciler/autoMergeLevel2';\n// combineReducers + persistReducer with stateReconciler defaulted to autoMergeLevel2\nexport default function persistCombineReducers(config, reducers) {\n config.stateReconciler = config.stateReconciler === undefined ? autoMergeLevel2 : config.stateReconciler;\n return persistReducer(config, combineReducers(reducers));\n}"],"mappings":"AAAA,SAASA,eAAT,QAAgC,OAAhC;AACA,OAAOC,cAAP,MAA2B,kBAA3B;AACA,OAAOC,eAAP,MAA4B,mCAA5B,C,CACA;;AACA,eAAe,SAASC,sBAAT,CAAgCC,MAAhC,EAAwCC,QAAxC,EAAkD;EAC/DD,MAAM,CAACE,eAAP,GAAyBF,MAAM,CAACE,eAAP,KAA2BC,SAA3B,GAAuCL,eAAvC,GAAyDE,MAAM,CAACE,eAAzF;EACA,OAAOL,cAAc,CAACG,MAAD,EAASJ,eAAe,CAACK,QAAD,CAAxB,CAArB;AACD"},"metadata":{},"sourceType":"module"} |
@ -0,0 +1 @@ |
||||
{"ast":null,"code":"export var KEY_PREFIX = 'persist:';\nexport var FLUSH = 'persist/FLUSH';\nexport var REHYDRATE = 'persist/REHYDRATE';\nexport var PAUSE = 'persist/PAUSE';\nexport var PERSIST = 'persist/PERSIST';\nexport var PURGE = 'persist/PURGE';\nexport var REGISTER = 'persist/REGISTER';\nexport var DEFAULT_VERSION = -1;","map":{"version":3,"names":["KEY_PREFIX","FLUSH","REHYDRATE","PAUSE","PERSIST","PURGE","REGISTER","DEFAULT_VERSION"],"sources":["/Users/mahdi/Documents/work/programming/barnameNegar/arbaeenWebApp/node_modules/redux-persist/es/constants.js"],"sourcesContent":["export var KEY_PREFIX = 'persist:';\nexport var FLUSH = 'persist/FLUSH';\nexport var REHYDRATE = 'persist/REHYDRATE';\nexport var PAUSE = 'persist/PAUSE';\nexport var PERSIST = 'persist/PERSIST';\nexport var PURGE = 'persist/PURGE';\nexport var REGISTER = 'persist/REGISTER';\nexport var DEFAULT_VERSION = -1;"],"mappings":"AAAA,OAAO,IAAIA,UAAU,GAAG,UAAjB;AACP,OAAO,IAAIC,KAAK,GAAG,eAAZ;AACP,OAAO,IAAIC,SAAS,GAAG,mBAAhB;AACP,OAAO,IAAIC,KAAK,GAAG,eAAZ;AACP,OAAO,IAAIC,OAAO,GAAG,iBAAd;AACP,OAAO,IAAIC,KAAK,GAAG,eAAZ;AACP,OAAO,IAAIC,QAAQ,GAAG,kBAAf;AACP,OAAO,IAAIC,eAAe,GAAG,CAAC,CAAvB"},"metadata":{},"sourceType":"module"} |
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@ |
||||
{"ast":null,"code":"\"use strict\";\n\nexports.__esModule = true;\nexports.default = createWebStorage;\n\nvar _getStorage = _interopRequireDefault(require(\"./getStorage\"));\n\nfunction _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n}\n\nfunction createWebStorage(type) {\n var storage = (0, _getStorage.default)(type);\n return {\n getItem: function getItem(key) {\n return new Promise(function (resolve, reject) {\n resolve(storage.getItem(key));\n });\n },\n setItem: function setItem(key, item) {\n return new Promise(function (resolve, reject) {\n resolve(storage.setItem(key, item));\n });\n },\n removeItem: function removeItem(key) {\n return new Promise(function (resolve, reject) {\n resolve(storage.removeItem(key));\n });\n }\n };\n}","map":{"version":3,"names":["exports","__esModule","default","createWebStorage","_getStorage","_interopRequireDefault","require","obj","type","storage","getItem","key","Promise","resolve","reject","setItem","item","removeItem"],"sources":["/Users/mahdi/Documents/work/programming/barnameNegar/arbaeenWebApp/node_modules/redux-persist/lib/storage/createWebStorage.js"],"sourcesContent":["\"use strict\";\n\nexports.__esModule = true;\nexports.default = createWebStorage;\n\nvar _getStorage = _interopRequireDefault(require(\"./getStorage\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction createWebStorage(type) {\n var storage = (0, _getStorage.default)(type);\n return {\n getItem: function getItem(key) {\n return new Promise(function (resolve, reject) {\n resolve(storage.getItem(key));\n });\n },\n setItem: function setItem(key, item) {\n return new Promise(function (resolve, reject) {\n resolve(storage.setItem(key, item));\n });\n },\n removeItem: function removeItem(key) {\n return new Promise(function (resolve, reject) {\n resolve(storage.removeItem(key));\n });\n }\n };\n}"],"mappings":"AAAA;;AAEAA,OAAO,CAACC,UAAR,GAAqB,IAArB;AACAD,OAAO,CAACE,OAAR,GAAkBC,gBAAlB;;AAEA,IAAIC,WAAW,GAAGC,sBAAsB,CAACC,OAAO,CAAC,cAAD,CAAR,CAAxC;;AAEA,SAASD,sBAAT,CAAgCE,GAAhC,EAAqC;EAAE,OAAOA,GAAG,IAAIA,GAAG,CAACN,UAAX,GAAwBM,GAAxB,GAA8B;IAAEL,OAAO,EAAEK;EAAX,CAArC;AAAwD;;AAE/F,SAASJ,gBAAT,CAA0BK,IAA1B,EAAgC;EAC9B,IAAIC,OAAO,GAAG,CAAC,GAAGL,WAAW,CAACF,OAAhB,EAAyBM,IAAzB,CAAd;EACA,OAAO;IACLE,OAAO,EAAE,SAASA,OAAT,CAAiBC,GAAjB,EAAsB;MAC7B,OAAO,IAAIC,OAAJ,CAAY,UAAUC,OAAV,EAAmBC,MAAnB,EAA2B;QAC5CD,OAAO,CAACJ,OAAO,CAACC,OAAR,CAAgBC,GAAhB,CAAD,CAAP;MACD,CAFM,CAAP;IAGD,CALI;IAMLI,OAAO,EAAE,SAASA,OAAT,CAAiBJ,GAAjB,EAAsBK,IAAtB,EAA4B;MACnC,OAAO,IAAIJ,OAAJ,CAAY,UAAUC,OAAV,EAAmBC,MAAnB,EAA2B;QAC5CD,OAAO,CAACJ,OAAO,CAACM,OAAR,CAAgBJ,GAAhB,EAAqBK,IAArB,CAAD,CAAP;MACD,CAFM,CAAP;IAGD,CAVI;IAWLC,UAAU,EAAE,SAASA,UAAT,CAAoBN,GAApB,EAAyB;MACnC,OAAO,IAAIC,OAAJ,CAAY,UAAUC,OAAV,EAAmBC,MAAnB,EAA2B;QAC5CD,OAAO,CAACJ,OAAO,CAACQ,UAAR,CAAmBN,GAAnB,CAAD,CAAP;MACD,CAFM,CAAP;IAGD;EAfI,CAAP;AAiBD"},"metadata":{},"sourceType":"script"} |
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@ |
||||
{"ast":null,"code":"export { default as components } from \"./components\";\nexport { default as alert } from \"./alert\";","map":{"version":3,"names":["default","components","alert"],"sources":["/Users/mahdi/Documents/work/programming/barnameNegar/arbaeenWebApp/src/redux/reducers/index.js"],"sourcesContent":["export { default as components } from \"./components\";\nexport { default as alert } from \"./alert\";\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,UAApB,QAAsC,cAAtC;AACA,SAASD,OAAO,IAAIE,KAApB,QAAiC,SAAjC"},"metadata":{},"sourceType":"module"} |
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@ |
||||
{"ast":null,"code":"export default function createTransform( // @NOTE inbound: transform state coming from redux on its way to being serialized and stored\ninbound, // @NOTE outbound: transform state coming from storage, on its way to be rehydrated into redux\noutbound) {\n var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var whitelist = config.whitelist || null;\n var blacklist = config.blacklist || null;\n\n function whitelistBlacklistCheck(key) {\n if (whitelist && whitelist.indexOf(key) === -1) return true;\n if (blacklist && blacklist.indexOf(key) !== -1) return true;\n return false;\n }\n\n return {\n in: function _in(state, key, fullState) {\n return !whitelistBlacklistCheck(key) && inbound ? inbound(state, key, fullState) : state;\n },\n out: function out(state, key, fullState) {\n return !whitelistBlacklistCheck(key) && outbound ? outbound(state, key, fullState) : state;\n }\n };\n}","map":{"version":3,"names":["createTransform","inbound","outbound","config","arguments","length","undefined","whitelist","blacklist","whitelistBlacklistCheck","key","indexOf","in","_in","state","fullState","out"],"sources":["/Users/mahdi/Documents/work/programming/barnameNegar/arbaeenWebApp/node_modules/redux-persist/es/createTransform.js"],"sourcesContent":["export default function createTransform( // @NOTE inbound: transform state coming from redux on its way to being serialized and stored\ninbound, // @NOTE outbound: transform state coming from storage, on its way to be rehydrated into redux\noutbound) {\n var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var whitelist = config.whitelist || null;\n var blacklist = config.blacklist || null;\n\n function whitelistBlacklistCheck(key) {\n if (whitelist && whitelist.indexOf(key) === -1) return true;\n if (blacklist && blacklist.indexOf(key) !== -1) return true;\n return false;\n }\n\n return {\n in: function _in(state, key, fullState) {\n return !whitelistBlacklistCheck(key) && inbound ? inbound(state, key, fullState) : state;\n },\n out: function out(state, key, fullState) {\n return !whitelistBlacklistCheck(key) && outbound ? outbound(state, key, fullState) : state;\n }\n };\n}"],"mappings":"AAAA,eAAe,SAASA,eAAT,EAA0B;AACzCC,OADe,EACN;AACTC,QAFe,EAEL;EACR,IAAIC,MAAM,GAAGC,SAAS,CAACC,MAAV,GAAmB,CAAnB,IAAwBD,SAAS,CAAC,CAAD,CAAT,KAAiBE,SAAzC,GAAqDF,SAAS,CAAC,CAAD,CAA9D,GAAoE,EAAjF;EACA,IAAIG,SAAS,GAAGJ,MAAM,CAACI,SAAP,IAAoB,IAApC;EACA,IAAIC,SAAS,GAAGL,MAAM,CAACK,SAAP,IAAoB,IAApC;;EAEA,SAASC,uBAAT,CAAiCC,GAAjC,EAAsC;IACpC,IAAIH,SAAS,IAAIA,SAAS,CAACI,OAAV,CAAkBD,GAAlB,MAA2B,CAAC,CAA7C,EAAgD,OAAO,IAAP;IAChD,IAAIF,SAAS,IAAIA,SAAS,CAACG,OAAV,CAAkBD,GAAlB,MAA2B,CAAC,CAA7C,EAAgD,OAAO,IAAP;IAChD,OAAO,KAAP;EACD;;EAED,OAAO;IACLE,EAAE,EAAE,SAASC,GAAT,CAAaC,KAAb,EAAoBJ,GAApB,EAAyBK,SAAzB,EAAoC;MACtC,OAAO,CAACN,uBAAuB,CAACC,GAAD,CAAxB,IAAiCT,OAAjC,GAA2CA,OAAO,CAACa,KAAD,EAAQJ,GAAR,EAAaK,SAAb,CAAlD,GAA4ED,KAAnF;IACD,CAHI;IAILE,GAAG,EAAE,SAASA,GAAT,CAAaF,KAAb,EAAoBJ,GAApB,EAAyBK,SAAzB,EAAoC;MACvC,OAAO,CAACN,uBAAuB,CAACC,GAAD,CAAxB,IAAiCR,QAAjC,GAA4CA,QAAQ,CAACY,KAAD,EAAQJ,GAAR,EAAaK,SAAb,CAApD,GAA8ED,KAArF;IACD;EANI,CAAP;AAQD"},"metadata":{},"sourceType":"module"} |
@ -0,0 +1 @@ |
||||
{"ast":null,"code":"'use strict';\n\nvar compose = require('redux').compose;\n\nexports.__esModule = true;\nexports.composeWithDevTools = typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function () {\n if (arguments.length === 0) return undefined;\n if (typeof arguments[0] === 'object') return compose;\n return compose.apply(null, arguments);\n};\nexports.devToolsEnhancer = typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__ : function () {\n return function (noop) {\n return noop;\n };\n};","map":{"version":3,"names":["compose","require","exports","__esModule","composeWithDevTools","window","__REDUX_DEVTOOLS_EXTENSION_COMPOSE__","arguments","length","undefined","apply","devToolsEnhancer","__REDUX_DEVTOOLS_EXTENSION__","noop"],"sources":["/Users/mahdi/Documents/work/programming/barnameNegar/arbaeenWebApp/node_modules/redux-devtools-extension/index.js"],"sourcesContent":["'use strict';\n\nvar compose = require('redux').compose;\n\nexports.__esModule = true;\nexports.composeWithDevTools =\n typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__\n ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__\n : function () {\n if (arguments.length === 0) return undefined;\n if (typeof arguments[0] === 'object') return compose;\n return compose.apply(null, arguments);\n };\n\nexports.devToolsEnhancer =\n typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__\n ? window.__REDUX_DEVTOOLS_EXTENSION__\n : function () {\n return function (noop) {\n return noop;\n };\n };\n"],"mappings":"AAAA;;AAEA,IAAIA,OAAO,GAAGC,OAAO,CAAC,OAAD,CAAP,CAAiBD,OAA/B;;AAEAE,OAAO,CAACC,UAAR,GAAqB,IAArB;AACAD,OAAO,CAACE,mBAAR,GACE,OAAOC,MAAP,KAAkB,WAAlB,IAAiCA,MAAM,CAACC,oCAAxC,GACID,MAAM,CAACC,oCADX,GAEI,YAAY;EACV,IAAIC,SAAS,CAACC,MAAV,KAAqB,CAAzB,EAA4B,OAAOC,SAAP;EAC5B,IAAI,OAAOF,SAAS,CAAC,CAAD,CAAhB,KAAwB,QAA5B,EAAsC,OAAOP,OAAP;EACtC,OAAOA,OAAO,CAACU,KAAR,CAAc,IAAd,EAAoBH,SAApB,CAAP;AACD,CAPP;AASAL,OAAO,CAACS,gBAAR,GACE,OAAON,MAAP,KAAkB,WAAlB,IAAiCA,MAAM,CAACO,4BAAxC,GACIP,MAAM,CAACO,4BADX,GAEI,YAAY;EACV,OAAO,UAAUC,IAAV,EAAgB;IACrB,OAAOA,IAAP;EACD,CAFD;AAGD,CAPP"},"metadata":{},"sourceType":"script"} |
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@ |
||||
{"ast":null,"code":"\"use strict\";\n\nexports.__esModule = true;\nexports.default = void 0;\n\nvar _createWebStorage = _interopRequireDefault(require(\"./createWebStorage\"));\n\nfunction _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n}\n\nvar _default = (0, _createWebStorage.default)('local');\n\nexports.default = _default;","map":{"version":3,"names":["exports","__esModule","default","_createWebStorage","_interopRequireDefault","require","obj","_default"],"sources":["/Users/mahdi/Documents/work/programming/barnameNegar/arbaeenWebApp/node_modules/redux-persist/lib/storage/index.js"],"sourcesContent":["\"use strict\";\n\nexports.__esModule = true;\nexports.default = void 0;\n\nvar _createWebStorage = _interopRequireDefault(require(\"./createWebStorage\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar _default = (0, _createWebStorage.default)('local');\n\nexports.default = _default;"],"mappings":"AAAA;;AAEAA,OAAO,CAACC,UAAR,GAAqB,IAArB;AACAD,OAAO,CAACE,OAAR,GAAkB,KAAK,CAAvB;;AAEA,IAAIC,iBAAiB,GAAGC,sBAAsB,CAACC,OAAO,CAAC,oBAAD,CAAR,CAA9C;;AAEA,SAASD,sBAAT,CAAgCE,GAAhC,EAAqC;EAAE,OAAOA,GAAG,IAAIA,GAAG,CAACL,UAAX,GAAwBK,GAAxB,GAA8B;IAAEJ,OAAO,EAAEI;EAAX,CAArC;AAAwD;;AAE/F,IAAIC,QAAQ,GAAG,CAAC,GAAGJ,iBAAiB,CAACD,OAAtB,EAA+B,OAA/B,CAAf;;AAEAF,OAAO,CAACE,OAAR,GAAkBK,QAAlB"},"metadata":{},"sourceType":"script"} |
@ -0,0 +1 @@ |
||||
{"ast":null,"code":"import { KEY_PREFIX } from './constants';\nexport default function getStoredState(config) {\n var transforms = config.transforms || [];\n var storageKey = \"\".concat(config.keyPrefix !== undefined ? config.keyPrefix : KEY_PREFIX).concat(config.key);\n var storage = config.storage;\n var debug = config.debug;\n var deserialize;\n\n if (config.deserialize === false) {\n deserialize = function deserialize(x) {\n return x;\n };\n } else if (typeof config.deserialize === 'function') {\n deserialize = config.deserialize;\n } else {\n deserialize = defaultDeserialize;\n }\n\n return storage.getItem(storageKey).then(function (serialized) {\n if (!serialized) return undefined;else {\n try {\n var state = {};\n var rawState = deserialize(serialized);\n Object.keys(rawState).forEach(function (key) {\n state[key] = transforms.reduceRight(function (subState, transformer) {\n return transformer.out(subState, key, rawState);\n }, deserialize(rawState[key]));\n });\n return state;\n } catch (err) {\n if (process.env.NODE_ENV !== 'production' && debug) console.log(\"redux-persist/getStoredState: Error restoring data \".concat(serialized), err);\n throw err;\n }\n }\n });\n}\n\nfunction defaultDeserialize(serial) {\n return JSON.parse(serial);\n}","map":{"version":3,"names":["KEY_PREFIX","getStoredState","config","transforms","storageKey","concat","keyPrefix","undefined","key","storage","debug","deserialize","x","defaultDeserialize","getItem","then","serialized","state","rawState","Object","keys","forEach","reduceRight","subState","transformer","out","err","process","env","NODE_ENV","console","log","serial","JSON","parse"],"sources":["/Users/mahdi/Documents/work/programming/barnameNegar/arbaeenWebApp/node_modules/redux-persist/es/getStoredState.js"],"sourcesContent":["import { KEY_PREFIX } from './constants';\nexport default function getStoredState(config) {\n var transforms = config.transforms || [];\n var storageKey = \"\".concat(config.keyPrefix !== undefined ? config.keyPrefix : KEY_PREFIX).concat(config.key);\n var storage = config.storage;\n var debug = config.debug;\n var deserialize;\n\n if (config.deserialize === false) {\n deserialize = function deserialize(x) {\n return x;\n };\n } else if (typeof config.deserialize === 'function') {\n deserialize = config.deserialize;\n } else {\n deserialize = defaultDeserialize;\n }\n\n return storage.getItem(storageKey).then(function (serialized) {\n if (!serialized) return undefined;else {\n try {\n var state = {};\n var rawState = deserialize(serialized);\n Object.keys(rawState).forEach(function (key) {\n state[key] = transforms.reduceRight(function (subState, transformer) {\n return transformer.out(subState, key, rawState);\n }, deserialize(rawState[key]));\n });\n return state;\n } catch (err) {\n if (process.env.NODE_ENV !== 'production' && debug) console.log(\"redux-persist/getStoredState: Error restoring data \".concat(serialized), err);\n throw err;\n }\n }\n });\n}\n\nfunction defaultDeserialize(serial) {\n return JSON.parse(serial);\n}"],"mappings":"AAAA,SAASA,UAAT,QAA2B,aAA3B;AACA,eAAe,SAASC,cAAT,CAAwBC,MAAxB,EAAgC;EAC7C,IAAIC,UAAU,GAAGD,MAAM,CAACC,UAAP,IAAqB,EAAtC;EACA,IAAIC,UAAU,GAAG,GAAGC,MAAH,CAAUH,MAAM,CAACI,SAAP,KAAqBC,SAArB,GAAiCL,MAAM,CAACI,SAAxC,GAAoDN,UAA9D,EAA0EK,MAA1E,CAAiFH,MAAM,CAACM,GAAxF,CAAjB;EACA,IAAIC,OAAO,GAAGP,MAAM,CAACO,OAArB;EACA,IAAIC,KAAK,GAAGR,MAAM,CAACQ,KAAnB;EACA,IAAIC,WAAJ;;EAEA,IAAIT,MAAM,CAACS,WAAP,KAAuB,KAA3B,EAAkC;IAChCA,WAAW,GAAG,SAASA,WAAT,CAAqBC,CAArB,EAAwB;MACpC,OAAOA,CAAP;IACD,CAFD;EAGD,CAJD,MAIO,IAAI,OAAOV,MAAM,CAACS,WAAd,KAA8B,UAAlC,EAA8C;IACnDA,WAAW,GAAGT,MAAM,CAACS,WAArB;EACD,CAFM,MAEA;IACLA,WAAW,GAAGE,kBAAd;EACD;;EAED,OAAOJ,OAAO,CAACK,OAAR,CAAgBV,UAAhB,EAA4BW,IAA5B,CAAiC,UAAUC,UAAV,EAAsB;IAC5D,IAAI,CAACA,UAAL,EAAiB,OAAOT,SAAP,CAAjB,KAAuC;MACrC,IAAI;QACF,IAAIU,KAAK,GAAG,EAAZ;QACA,IAAIC,QAAQ,GAAGP,WAAW,CAACK,UAAD,CAA1B;QACAG,MAAM,CAACC,IAAP,CAAYF,QAAZ,EAAsBG,OAAtB,CAA8B,UAAUb,GAAV,EAAe;UAC3CS,KAAK,CAACT,GAAD,CAAL,GAAaL,UAAU,CAACmB,WAAX,CAAuB,UAAUC,QAAV,EAAoBC,WAApB,EAAiC;YACnE,OAAOA,WAAW,CAACC,GAAZ,CAAgBF,QAAhB,EAA0Bf,GAA1B,EAA+BU,QAA/B,CAAP;UACD,CAFY,EAEVP,WAAW,CAACO,QAAQ,CAACV,GAAD,CAAT,CAFD,CAAb;QAGD,CAJD;QAKA,OAAOS,KAAP;MACD,CATD,CASE,OAAOS,GAAP,EAAY;QACZ,IAAIC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAAzB,IAAyCnB,KAA7C,EAAoDoB,OAAO,CAACC,GAAR,CAAY,sDAAsD1B,MAAtD,CAA6DW,UAA7D,CAAZ,EAAsFU,GAAtF;QACpD,MAAMA,GAAN;MACD;IACF;EACF,CAhBM,CAAP;AAiBD;;AAED,SAASb,kBAAT,CAA4BmB,MAA5B,EAAoC;EAClC,OAAOC,IAAI,CAACC,KAAL,CAAWF,MAAX,CAAP;AACD"},"metadata":{},"sourceType":"module"} |
@ -0,0 +1 @@ |
||||
{"ast":null,"code":"/** A function that accepts a potential \"extra argument\" value to be injected later,\r\n * and returns an instance of the thunk middleware that uses that value\r\n */\nfunction createThunkMiddleware(extraArgument) {\n // Standard Redux middleware definition pattern:\n // See: https://redux.js.org/tutorials/fundamentals/part-4-store#writing-custom-middleware\n var middleware = function middleware(_ref) {\n var dispatch = _ref.dispatch,\n getState = _ref.getState;\n return function (next) {\n return function (action) {\n // The thunk middleware looks for any functions that were passed to `store.dispatch`.\n // If this \"action\" is really a function, call it and return the result.\n if (typeof action === 'function') {\n // Inject the store's `dispatch` and `getState` methods, as well as any \"extra arg\"\n return action(dispatch, getState, extraArgument);\n } // Otherwise, pass the action down the middleware chain as usual\n\n\n return next(action);\n };\n };\n };\n\n return middleware;\n}\n\nvar thunk = createThunkMiddleware(); // Attach the factory function so users can create a customized version\n// with whatever \"extra arg\" they want to inject into their thunks\n\nthunk.withExtraArgument = createThunkMiddleware;\nexport default thunk;","map":{"version":3,"names":["createThunkMiddleware","extraArgument","middleware","_ref","dispatch","getState","next","action","thunk","withExtraArgument"],"sources":["/Users/mahdi/Documents/work/programming/barnameNegar/arbaeenWebApp/node_modules/redux-thunk/es/index.js"],"sourcesContent":["/** A function that accepts a potential \"extra argument\" value to be injected later,\r\n * and returns an instance of the thunk middleware that uses that value\r\n */\nfunction createThunkMiddleware(extraArgument) {\n // Standard Redux middleware definition pattern:\n // See: https://redux.js.org/tutorials/fundamentals/part-4-store#writing-custom-middleware\n var middleware = function middleware(_ref) {\n var dispatch = _ref.dispatch,\n getState = _ref.getState;\n return function (next) {\n return function (action) {\n // The thunk middleware looks for any functions that were passed to `store.dispatch`.\n // If this \"action\" is really a function, call it and return the result.\n if (typeof action === 'function') {\n // Inject the store's `dispatch` and `getState` methods, as well as any \"extra arg\"\n return action(dispatch, getState, extraArgument);\n } // Otherwise, pass the action down the middleware chain as usual\n\n\n return next(action);\n };\n };\n };\n\n return middleware;\n}\n\nvar thunk = createThunkMiddleware(); // Attach the factory function so users can create a customized version\n// with whatever \"extra arg\" they want to inject into their thunks\n\nthunk.withExtraArgument = createThunkMiddleware;\nexport default thunk;"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,qBAAT,CAA+BC,aAA/B,EAA8C;EAC5C;EACA;EACA,IAAIC,UAAU,GAAG,SAASA,UAAT,CAAoBC,IAApB,EAA0B;IACzC,IAAIC,QAAQ,GAAGD,IAAI,CAACC,QAApB;IAAA,IACIC,QAAQ,GAAGF,IAAI,CAACE,QADpB;IAEA,OAAO,UAAUC,IAAV,EAAgB;MACrB,OAAO,UAAUC,MAAV,EAAkB;QACvB;QACA;QACA,IAAI,OAAOA,MAAP,KAAkB,UAAtB,EAAkC;UAChC;UACA,OAAOA,MAAM,CAACH,QAAD,EAAWC,QAAX,EAAqBJ,aAArB,CAAb;QACD,CANsB,CAMrB;;;QAGF,OAAOK,IAAI,CAACC,MAAD,CAAX;MACD,CAVD;IAWD,CAZD;EAaD,CAhBD;;EAkBA,OAAOL,UAAP;AACD;;AAED,IAAIM,KAAK,GAAGR,qBAAqB,EAAjC,C,CAAqC;AACrC;;AAEAQ,KAAK,CAACC,iBAAN,GAA0BT,qBAA1B;AACA,eAAeQ,KAAf"},"metadata":{},"sourceType":"module"} |
@ -0,0 +1 @@ |
||||
{"ast":null,"code":"","map":{"version":3,"names":[],"sources":["/Users/mahdi/Documents/work/programming/barnameNegar/arbaeenWebApp/src/redux/reducers/index.js"],"sourcesContent":[""],"mappings":""},"metadata":{},"sourceType":"module"} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,8 @@ |
||||
# Change Log |
||||
|
||||
All notable changes to this project will be documented in this file. |
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. |
||||
|
||||
## 2.13.9 (2021-03-06) |
||||
|
||||
**Note:** Version bump only for package redux-devtools-extension |
@ -0,0 +1,50 @@ |
||||
# Redux DevTools Extension's helper |
||||
|
||||
[![Join the chat at https://gitter.im/zalmoxisus/redux-devtools-extension](https://badges.gitter.im/zalmoxisus/redux-devtools-extension.svg)](https://gitter.im/zalmoxisus/redux-devtools-extension?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) |
||||
|
||||
## Usage |
||||
|
||||
Install: |
||||
|
||||
``` |
||||
npm install --save redux-devtools-extension |
||||
``` |
||||
|
||||
and use like that: |
||||
|
||||
```js |
||||
import { createStore, applyMiddleware } from 'redux'; |
||||
import { composeWithDevTools } from 'redux-devtools-extension'; |
||||
|
||||
const store = createStore( |
||||
reducer, |
||||
composeWithDevTools( |
||||
applyMiddleware(...middleware) |
||||
// other store enhancers if any |
||||
) |
||||
); |
||||
``` |
||||
|
||||
or if needed to apply [extension’s options](https://github.com/zalmoxisus/redux-devtools-extension/blob/master/docs/API/Arguments.md#windowdevtoolsextensionconfig): |
||||
|
||||
```js |
||||
import { createStore, applyMiddleware } from 'redux'; |
||||
import { composeWithDevTools } from 'redux-devtools-extension'; |
||||
|
||||
const composeEnhancers = composeWithDevTools({ |
||||
// Specify here name, actionsBlacklist, actionsCreators and other options |
||||
}); |
||||
const store = createStore( |
||||
reducer, |
||||
composeEnhancers( |
||||
applyMiddleware(...middleware) |
||||
// other store enhancers if any |
||||
) |
||||
); |
||||
``` |
||||
|
||||
There’re just [few lines of code](https://github.com/zalmoxisus/redux-devtools-extension/blob/master/npm-package/index.js). If you don’t want to allow the extension in production, just use ‘redux-devtools-extension/developmentOnly’ instead of ‘redux-devtools-extension’. |
||||
|
||||
## License |
||||
|
||||
MIT |
@ -0,0 +1 @@ |
||||
export * from 'redux-devtools-extension'; |
@ -0,0 +1,26 @@ |
||||
'use strict'; |
||||
|
||||
var compose = require('redux').compose; |
||||
|
||||
exports.__esModule = true; |
||||
exports.composeWithDevTools = |
||||
process.env.NODE_ENV !== 'production' && |
||||
typeof window !== 'undefined' && |
||||
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ |
||||
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ |
||||
: function () { |
||||
if (arguments.length === 0) return undefined; |
||||
if (typeof arguments[0] === 'object') return compose; |
||||
return compose.apply(null, arguments); |
||||
}; |
||||
|
||||
exports.devToolsEnhancer = |
||||
process.env.NODE_ENV !== 'production' && |
||||
typeof window !== 'undefined' && |
||||
window.__REDUX_DEVTOOLS_EXTENSION__ |
||||
? window.__REDUX_DEVTOOLS_EXTENSION__ |
||||
: function () { |
||||
return function (noop) { |
||||
return noop; |
||||
}; |
||||
}; |
@ -0,0 +1,174 @@ |
||||
import { Action, ActionCreator, StoreEnhancer, compose } from 'redux'; |
||||
|
||||
export interface EnhancerOptions { |
||||
/** |
||||
* the instance name to be showed on the monitor page. Default value is `document.title`. |
||||
* If not specified and there's no document title, it will consist of `tabId` and `instanceId`. |
||||
*/ |
||||
name?: string; |
||||
/** |
||||
* action creators functions to be available in the Dispatcher. |
||||
*/ |
||||
actionCreators?: ActionCreator<any>[] | { [key: string]: ActionCreator<any> }; |
||||
/** |
||||
* if more than one action is dispatched in the indicated interval, all new actions will be collected and sent at once. |
||||
* It is the joint between performance and speed. When set to `0`, all actions will be sent instantly. |
||||
* Set it to a higher value when experiencing perf issues (also `maxAge` to a lower value). |
||||
* |
||||
* @default 500 ms. |
||||
*/ |
||||
latency?: number; |
||||
/** |
||||
* (> 1) - maximum allowed actions to be stored in the history tree. The oldest actions are removed once maxAge is reached. It's critical for performance. |
||||
* |
||||
* @default 50 |
||||
*/ |
||||
maxAge?: number; |
||||
/** |
||||
* - `undefined` - will use regular `JSON.stringify` to send data (it's the fast mode). |
||||
* - `false` - will handle also circular references. |
||||
* - `true` - will handle also date, regex, undefined, error objects, symbols, maps, sets and functions. |
||||
* - object, which contains `date`, `regex`, `undefined`, `error`, `symbol`, `map`, `set` and `function` keys. |
||||
* For each of them you can indicate if to include (by setting as `true`). |
||||
* For `function` key you can also specify a custom function which handles serialization. |
||||
* See [`jsan`](https://github.com/kolodny/jsan) for more details.
|
||||
*/ |
||||
serialize?: |
||||
| boolean |
||||
| { |
||||
date?: boolean; |
||||
regex?: boolean; |
||||
undefined?: boolean; |
||||
error?: boolean; |
||||
symbol?: boolean; |
||||
map?: boolean; |
||||
set?: boolean; |
||||
function?: boolean | Function; |
||||
}; |
||||
/** |
||||
* function which takes `action` object and id number as arguments, and should return `action` object back. |
||||
*/ |
||||
actionSanitizer?: <A extends Action>(action: A, id: number) => A; |
||||
/** |
||||
* function which takes `state` object and index as arguments, and should return `state` object back. |
||||
*/ |
||||
stateSanitizer?: <S>(state: S, index: number) => S; |
||||
/** |
||||
* *string or array of strings as regex* - actions types to be hidden / shown in the monitors (while passed to the reducers). |
||||
* If `actionsWhitelist` specified, `actionsBlacklist` is ignored. |
||||
*/ |
||||
actionsBlacklist?: string | string[]; |
||||
/** |
||||
* *string or array of strings as regex* - actions types to be hidden / shown in the monitors (while passed to the reducers). |
||||
* If `actionsWhitelist` specified, `actionsBlacklist` is ignored. |
||||
*/ |
||||
actionsWhitelist?: string | string[]; |
||||
/** |
||||
* called for every action before sending, takes `state` and `action` object, and returns `true` in case it allows sending the current data to the monitor. |
||||
* Use it as a more advanced version of `actionsBlacklist`/`actionsWhitelist` parameters. |
||||
*/ |
||||
predicate?: <S, A extends Action>(state: S, action: A) => boolean; |
||||
/** |
||||
* if specified as `false`, it will not record the changes till clicking on `Start recording` button. |
||||
* Available only for Redux enhancer, for others use `autoPause`. |
||||
* |
||||
* @default true |
||||
*/ |
||||
shouldRecordChanges?: boolean; |
||||
/** |
||||
* if specified, whenever clicking on `Pause recording` button and there are actions in the history log, will add this action type. |
||||
* If not specified, will commit when paused. Available only for Redux enhancer. |
||||
* |
||||
* @default "@@PAUSED"" |
||||
*/ |
||||
pauseActionType?: string; |
||||
/** |
||||
* auto pauses when the extension’s window is not opened, and so has zero impact on your app when not in use. |
||||
* Not available for Redux enhancer (as it already does it but storing the data to be sent). |
||||
* |
||||
* @default false |
||||
*/ |
||||
autoPause?: boolean; |
||||
/** |
||||
* if specified as `true`, it will not allow any non-monitor actions to be dispatched till clicking on `Unlock changes` button. |
||||
* Available only for Redux enhancer. |
||||
* |
||||
* @default false |
||||
*/ |
||||
shouldStartLocked?: boolean; |
||||
/** |
||||
* if set to `false`, will not recompute the states on hot reloading (or on replacing the reducers). Available only for Redux enhancer. |
||||
* |
||||
* @default true |
||||
*/ |
||||
shouldHotReload?: boolean; |
||||
/** |
||||
* if specified as `true`, whenever there's an exception in reducers, the monitors will show the error message, and next actions will not be dispatched. |
||||
* |
||||
* @default false |
||||
*/ |
||||
shouldCatchErrors?: boolean; |
||||
/** |
||||
* If you want to restrict the extension, specify the features you allow. |
||||
* If not specified, all of the features are enabled. When set as an object, only those included as `true` will be allowed. |
||||
* Note that except `true`/`false`, `import` and `export` can be set as `custom` (which is by default for Redux enhancer), meaning that the importing/exporting occurs on the client side. |
||||
* Otherwise, you'll get/set the data right from the monitor part. |
||||
*/ |
||||
features?: { |
||||
/** |
||||
* start/pause recording of dispatched actions |
||||
*/ |
||||
pause?: boolean; |
||||
/** |
||||
* lock/unlock dispatching actions and side effects |
||||
*/ |
||||
lock?: boolean; |
||||
/** |
||||
* persist states on page reloading |
||||
*/ |
||||
persist?: boolean; |
||||
/** |
||||
* export history of actions in a file |
||||
*/ |
||||
export?: boolean | 'custom'; |
||||
/** |
||||
* import history of actions from a file |
||||
*/ |
||||
import?: boolean | 'custom'; |
||||
/** |
||||
* jump back and forth (time travelling) |
||||
*/ |
||||
jump?: boolean; |
||||
/** |
||||
* skip (cancel) actions |
||||
*/ |
||||
skip?: boolean; |
||||
/** |
||||
* drag and drop actions in the history list |
||||
*/ |
||||
reorder?: boolean; |
||||
/** |
||||
* dispatch custom actions or action creators |
||||
*/ |
||||
dispatch?: boolean; |
||||
/** |
||||
* generate tests for the selected actions |
||||
*/ |
||||
test?: boolean; |
||||
}; |
||||
/** |
||||
* Set to true or a stacktrace-returning function to record call stack traces for dispatched actions. |
||||
* Defaults to false. |
||||
*/ |
||||
trace?: boolean | (<A extends Action>(action: A) => string); |
||||
/** |
||||
* The maximum number of stack trace entries to record per action. Defaults to 10. |
||||
*/ |
||||
traceLimit?: number; |
||||
} |
||||
|
||||
export function composeWithDevTools<StoreExt, StateExt>( |
||||
...funcs: Array<StoreEnhancer<StoreExt>> |
||||
): StoreEnhancer<StoreExt>; |
||||
export function composeWithDevTools(options: EnhancerOptions): typeof compose; |
||||
export function devToolsEnhancer(options: EnhancerOptions): StoreEnhancer<any>; |
@ -0,0 +1,22 @@ |
||||
'use strict'; |
||||
|
||||
var compose = require('redux').compose; |
||||
|
||||
exports.__esModule = true; |
||||
exports.composeWithDevTools = |
||||
typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ |
||||
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ |
||||
: function () { |
||||
if (arguments.length === 0) return undefined; |
||||
if (typeof arguments[0] === 'object') return compose; |
||||
return compose.apply(null, arguments); |
||||
}; |
||||
|
||||
exports.devToolsEnhancer = |
||||
typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__ |
||||
? window.__REDUX_DEVTOOLS_EXTENSION__ |
||||
: function () { |
||||
return function (noop) { |
||||
return noop; |
||||
}; |
||||
}; |
@ -0,0 +1 @@ |
||||
export * from 'redux-devtools-extension'; |
@ -0,0 +1,60 @@ |
||||
'use strict'; |
||||
|
||||
var assign = require('./utils/assign'); |
||||
var compose = require('redux').compose; |
||||
|
||||
function enhancer() { |
||||
var config = arguments[0] || {}; |
||||
config.features = { pause: true, export: true, test: true }; |
||||
config.type = 'redux'; |
||||
if (config.autoPause === undefined) config.autoPause = true; |
||||
if (config.latency === undefined) config.latency = 500; |
||||
|
||||
return function (createStore) { |
||||
return function (reducer, preloadedState, enhancer) { |
||||
var store = createStore(reducer, preloadedState, enhancer); |
||||
var origDispatch = store.dispatch; |
||||
|
||||
var devTools = window.__REDUX_DEVTOOLS_EXTENSION__.connect(config); |
||||
devTools.init(store.getState()); |
||||
|
||||
var dispatch = function (action) { |
||||
var r = origDispatch(action); |
||||
devTools.send(action, store.getState()); |
||||
return r; |
||||
}; |
||||
|
||||
if (Object.assign) return Object.assign(store, { dispatch: dispatch }); |
||||
return assign(store, 'dispatch', dispatch); |
||||
}; |
||||
}; |
||||
} |
||||
|
||||
function composeWithEnhancer(config) { |
||||
return function () { |
||||
return compose(compose.apply(null, arguments), enhancer(config)); |
||||
}; |
||||
} |
||||
|
||||
exports.__esModule = true; |
||||
exports.composeWithDevTools = function () { |
||||
if (typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__) { |
||||
if (arguments.length === 0) return enhancer(); |
||||
if (typeof arguments[0] === 'object') |
||||
return composeWithEnhancer(arguments[0]); |
||||
return composeWithEnhancer().apply(null, arguments); |
||||
} |
||||
|
||||
if (arguments.length === 0) return undefined; |
||||
if (typeof arguments[0] === 'object') return compose; |
||||
return compose.apply(null, arguments); |
||||
}; |
||||
|
||||
exports.devToolsEnhancer = |
||||
typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__ |
||||
? enhancer |
||||
: function () { |
||||
return function (noop) { |
||||
return noop; |
||||
}; |
||||
}; |
@ -0,0 +1 @@ |
||||
export * from 'redux-devtools-extension'; |
@ -0,0 +1,28 @@ |
||||
'use strict'; |
||||
|
||||
var compose = require('redux').compose; |
||||
var logOnly = require('./logOnly'); |
||||
|
||||
exports.__esModule = true; |
||||
exports.composeWithDevTools = |
||||
process.env.NODE_ENV === 'production' |
||||
? logOnly.composeWithDevTools |
||||
: typeof window !== 'undefined' && |
||||
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ |
||||
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ |
||||
: function () { |
||||
if (arguments.length === 0) return undefined; |
||||
if (typeof arguments[0] === 'object') return compose; |
||||
return compose.apply(null, arguments); |
||||
}; |
||||
|
||||
exports.devToolsEnhancer = |
||||
process.env.NODE_ENV === 'production' |
||||
? logOnly.devToolsEnhancer |
||||
: typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__ |
||||
? window.__REDUX_DEVTOOLS_EXTENSION__ |
||||
: function () { |
||||
return function (noop) { |
||||
return noop; |
||||
}; |
||||
}; |
@ -0,0 +1,17 @@ |
||||
{ |
||||
"name": "redux-devtools-extension", |
||||
"version": "2.13.9", |
||||
"description": "Wrappers for Redux DevTools Extension.", |
||||
"main": "index.js", |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "https://github.com/zalmoxisus/redux-devtools-extension" |
||||
}, |
||||
"homepage": "https://github.com/zalmoxisus/redux-devtools-extension", |
||||
"author": "Mihail Diordiev <zalmoxisus@gmail.com> (https://github.com/zalmoxisus)", |
||||
"license": "MIT", |
||||
"peerDependencies": { |
||||
"redux": "^3.1.0 || ^4.0.0" |
||||
}, |
||||
"gitHead": "5ef9b00cd4717ac878068ce8003e1999e680c72e" |
||||
} |
@ -0,0 +1,24 @@ |
||||
var objectKeys = |
||||
Object.keys || |
||||
function (obj) { |
||||
var keys = []; |
||||
for (var key in obj) { |
||||
if ({}.hasOwnProperty.call(obj, key)) keys.push(key); |
||||
} |
||||
return keys; |
||||
}; |
||||
|
||||
function assign(obj, newKey, newValue) { |
||||
var keys = objectKeys(obj); |
||||
var copy = {}; |
||||
|
||||
for (var i = 0, l = keys.length; i < l; i++) { |
||||
var key = keys[i]; |
||||
copy[key] = obj[key]; |
||||
} |
||||
|
||||
copy[newKey] = newValue; |
||||
return copy; |
||||
} |
||||
|
||||
module.exports = assign; |
@ -0,0 +1,20 @@ |
||||
# Changelog |
||||
All notable changes to this project will be documented in this file. |
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), |
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). |
||||
|
||||
## [Unreleased] |
||||
### Added |
||||
- [PR #974](https://github.com/rt2zz/redux-persist/pull/974) **Add correct PersistGate defaultProps to support newer flow versions.** Adds `children` to defaultProps in `PersistGate` component and removes the optional (`?`) flag in order to be compatible with flow type checking (more explanation can be found in [this flow issue](facebook/flow#1660)). Fixes [#953](https://github.com/rt2zz/redux-persist/issues/953) |
||||
- [PR #949](https://github.com/rt2zz/redux-persist/pull/949) **Allow onWriteFail |
||||
to be passed in config.** The value should be a function to be called in the |
||||
case a write fails (i.e. because the disk it out of space). |
||||
- **Add Community section to README.** Add link to Reactiflux #redux-persist |
||||
channel. Add blog articles about redux-persist from the community. |
||||
|
||||
## 0.2.0 through 5.10.0 - 2015-07-24 through 2018-06-05 |
||||
See notes on [GitHub releases page](https://github.com/rt2zz/redux-persist/releases) |
||||
|
||||
[Unreleased]: https://github.com/olivierlacan/keep-a-changelog/compare/v5.10.0...HEAD |
||||
[0.2.0 through 5.10.0]: See notes on [GitHub releases page](https://github.com/rt2zz/redux-persist/releases) |
@ -0,0 +1,21 @@ |
||||
MIT License |
||||
|
||||
Copyright (c) 2017 Zack Story |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
of this software and associated documentation files (the "Software"), to deal |
||||
in the Software without restriction, including without limitation the rights |
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
copies of the Software, and to permit persons to whom the Software is |
||||
furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in all |
||||
copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||
SOFTWARE. |
@ -0,0 +1,266 @@ |
||||
# Redux Persist |
||||
|
||||
Persist and rehydrate a redux store. |
||||
|
||||
[![build status](https://img.shields.io/travis/rt2zz/redux-persist/master.svg?style=flat-square)](https://travis-ci.org/rt2zz/redux-persist) [![npm version](https://img.shields.io/npm/v/redux-persist.svg?style=flat-square)](https://www.npmjs.com/package/redux-persist) [![npm downloads](https://img.shields.io/npm/dm/redux-persist.svg?style=flat-square)](https://www.npmjs.com/package/redux-persist) |
||||
[![#redux-persist on Discord](https://img.shields.io/discord/102860784329052160.svg)](https://discord.gg/ExrEvmv) |
||||
|
||||
## Quickstart |
||||
`npm install redux-persist` |
||||
|
||||
Usage Examples: |
||||
1. [Basic Usage](#basic-usage) |
||||
2. [Nested Persists](#nested-persists) |
||||
3. [Hot Module Replacement](./docs/hot-module-replacement.md) |
||||
4. Code Splitting [coming soon] |
||||
|
||||
#### Basic Usage |
||||
Basic usage involves adding `persistReducer` and `persistStore` to your setup. **IMPORTANT** Every app needs to decide how many levels of state they want to "merge". The default is 1 level. Please read through the [state reconciler docs](#state-reconciler) for more information. |
||||
|
||||
```js |
||||
// configureStore.js |
||||
|
||||
import { createStore } from 'redux' |
||||
import { persistStore, persistReducer } from 'redux-persist' |
||||
import storage from 'redux-persist/lib/storage' // defaults to localStorage for web |
||||
|
||||
import rootReducer from './reducers' |
||||
|
||||
const persistConfig = { |
||||
key: 'root', |
||||
storage, |
||||
} |
||||
|
||||
const persistedReducer = persistReducer(persistConfig, rootReducer) |
||||
|
||||
export default () => { |
||||
let store = createStore(persistedReducer) |
||||
let persistor = persistStore(store) |
||||
return { store, persistor } |
||||
} |
||||
``` |
||||
|
||||
If you are using react, wrap your root component with [PersistGate](./docs/PersistGate.md). This delays the rendering of your app's UI until your persisted state has been retrieved and saved to redux. **NOTE** the `PersistGate` loading prop can be null, or any react instance, e.g. `loading={<Loading />}` |
||||
|
||||
```js |
||||
import { PersistGate } from 'redux-persist/integration/react' |
||||
|
||||
// ... normal setup, create store and persistor, import components etc. |
||||
|
||||
const App = () => { |
||||
return ( |
||||
<Provider store={store}> |
||||
<PersistGate loading={null} persistor={persistor}> |
||||
<RootComponent /> |
||||
</PersistGate> |
||||
</Provider> |
||||
); |
||||
}; |
||||
``` |
||||
|
||||
## API |
||||
[Full API](./docs/api.md) |
||||
|
||||
#### `persistReducer(config, reducer)` |
||||
- arguments |
||||
- [**config**](https://github.com/rt2zz/redux-persist/blob/master/src/types.js#L13-L27) *object* |
||||
- required config: `key, storage` |
||||
- notable other config: `whitelist, blacklist, version, stateReconciler, debug` |
||||
- **reducer** *function* |
||||
- any reducer will work, typically this would be the top level reducer returned by `combineReducers` |
||||
- returns an enhanced reducer |
||||
|
||||
#### `persistStore(store, [config, callback])` |
||||
- arguments |
||||
- **store** *redux store* The store to be persisted. |
||||
- **config** *object* (typically null) |
||||
- If you want to avoid that the persistence starts immediately after calling `persistStore`, set the option manualPersist. Example: `{ manualPersist: true }` Persistence can then be started at any point with `peristor.persist()`. You usually want to do this if your storage is not ready when the `persistStore` call is made. |
||||
- **callback** *function* will be called after rehydration is finished. |
||||
- returns **persistor** object |
||||
|
||||
#### `persistor object` |
||||
- the persistor object is returned by persistStore with the following methods: |
||||
- `.purge()` |
||||
- purges state from disk and returns a promise |
||||
- `.flush()` |
||||
- immediately writes all pending state to disk and returns a promise |
||||
- `.pause()` |
||||
- pauses persistence |
||||
- `.persist()` |
||||
- resumes persistence |
||||
|
||||
## State Reconciler |
||||
State reconcilers define how incoming state is merged in with initial state. It is critical to choose the right state reconciler for your state. There are three options that ship out of the box, let's look at how each operates: |
||||
|
||||
1. **hardSet** (`import hardSet from 'redux-persist/lib/stateReconciler/hardSet'`) |
||||
This will hard set incoming state. This can be desirable in some cases where persistReducer is nested deeper in your reducer tree, or if you do not rely on initialState in your reducer. |
||||
- **incoming state**: `{ foo: incomingFoo }` |
||||
- **initial state**: `{ foo: initialFoo, bar: initialBar }` |
||||
- **reconciled state**: `{ foo: incomingFoo }` // note bar has been dropped |
||||
2. **autoMergeLevel1** (default) |
||||
This will auto merge one level deep. Auto merge means if the some piece of substate was modified by your reducer during the REHYDRATE action, it will skip this piece of state. Level 1 means it will shallow merge 1 level deep. |
||||
- **incoming state**: `{ foo: incomingFoo }` |
||||
- **initial state**: `{ foo: initialFoo, bar: initialBar }` |
||||
- **reconciled state**: `{ foo: incomingFoo, bar: initialBar }` // note incomingFoo overwrites initialFoo |
||||
3. **autoMergeLevel2** (`import autoMergeLevel2 from 'redux-persist/lib/stateReconciler/autoMergeLevel2'`) |
||||
This acts just like autoMergeLevel1, except it shallow merges two levels |
||||
- **incoming state**: `{ foo: incomingFoo }` |
||||
- **initial state**: `{ foo: initialFoo, bar: initialBar }` |
||||
- **reconciled state**: `{ foo: mergedFoo, bar: initialBar }` // note: initialFoo and incomingFoo are shallow merged |
||||
|
||||
#### Example |
||||
```js |
||||
import hardSet from 'redux-persist/lib/stateReconciler/hardSet' |
||||
|
||||
const persistConfig = { |
||||
key: 'root', |
||||
storage, |
||||
stateReconciler: hardSet, |
||||
} |
||||
``` |
||||
|
||||
## React Integration |
||||
Redux persist ships with react integration as a convenience. The `PersistGate` component is the recommended way to delay rendering until persistence is complete. It works in one of two modes: |
||||
1. `loading` prop: The provided loading value will be rendered until persistence is complete at which point children will be rendered. |
||||
2. function children: The function will be invoked with a single `bootstrapped` argument. When bootstrapped is true, persistence is complete and it is safe to render the full app. This can be useful for adding transition animations. |
||||
|
||||
## Blacklist & Whitelist |
||||
By Example: |
||||
```js |
||||
// BLACKLIST |
||||
const persistConfig = { |
||||
key: 'root', |
||||
storage: storage, |
||||
blacklist: ['navigation'] // navigation will not be persisted |
||||
}; |
||||
|
||||
// WHITELIST |
||||
const persistConfig = { |
||||
key: 'root', |
||||
storage: storage, |
||||
whitelist: ['navigation'] // only navigation will be persisted |
||||
}; |
||||
``` |
||||
|
||||
## Nested Persists |
||||
Nested persist can be useful for including different storage adapters, code splitting, or deep filtering. For example while blacklist and whitelist only work one level deep, but we can use a nested persist to blacklist a deeper value: |
||||
```js |
||||
import { combineReducers } from 'redux' |
||||
import { persistReducer } from 'redux-persist' |
||||
import storage from 'redux-persist/lib/storage' |
||||
|
||||
import { authReducer, otherReducer } from './reducers' |
||||
|
||||
const rootPersistConfig = { |
||||
key: 'root', |
||||
storage: storage, |
||||
blacklist: ['auth'] |
||||
} |
||||
|
||||
const authPersistConfig = { |
||||
key: 'auth', |
||||
storage: storage, |
||||
blacklist: ['somethingTemporary'] |
||||
} |
||||
|
||||
const rootReducer = combineReducers({ |
||||
auth: persistReducer(authPersistConfig, authReducer), |
||||
other: otherReducer, |
||||
}) |
||||
|
||||
export default persistReducer(rootPersistConfig, rootReducer) |
||||
``` |
||||
|
||||
## Migrations |
||||
`persistReducer` has a general purpose "migrate" config which will be called after getting stored state but before actually reconciling with the reducer. It can be any function which takes state as an argument and returns a promise to return a new state object. |
||||
|
||||
Redux Persist ships with `createMigrate`, which helps create a synchronous migration for moving from any version of stored state to the current state version. [[Additional information]](./docs/migrations.md) |
||||
|
||||
## Transforms |
||||
Transforms allow you to customize the state object that gets persisted and rehydrated. |
||||
|
||||
There are several libraries that tackle some of the common implementations for transforms. |
||||
- [immutable](https://github.com/rt2zz/redux-persist-transform-immutable) - support immutable reducers |
||||
- [seamless-immutable](https://github.com/hilkeheremans/redux-persist-seamless-immutable) - support seamless-immutable reducers |
||||
- [compress](https://github.com/rt2zz/redux-persist-transform-compress) - compress your serialized state with lz-string |
||||
- [encrypt](https://github.com/maxdeviant/redux-persist-transform-encrypt) - encrypt your serialized state with AES |
||||
- [filter](https://github.com/edy/redux-persist-transform-filter) - store or load a subset of your state |
||||
- [filter-immutable](https://github.com/actra-development/redux-persist-transform-filter-immutable) - store or load a subset of your state with support for immutablejs |
||||
- [expire](https://github.com/gabceb/redux-persist-transform-expire) - expire a specific subset of your state based on a property |
||||
- [expire-reducer](https://github.com/kamranahmedse/redux-persist-expire) - more flexible alternative to expire transformer above with more options |
||||
|
||||
When the state object gets persisted, it first gets serialized with `JSON.stringify()`. If parts of your state object are not mappable to JSON objects, the serialization process may transform these parts of your state in unexpected ways. For example, the javascript [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) type does not exist in JSON. When you try to serialize a Set via `JSON.stringify()`, it gets converted to an empty object. Probably not what you want. |
||||
|
||||
Below is a Transform that successfully persists a Set property, which simply converts it to an array and back. In this way, the Set gets converted to an Array, which is a recognized data structure in JSON. When pulled out of the persisted store, the array gets converted back to a Set before being saved to the redux store. |
||||
|
||||
```js |
||||
import { createTransform } from 'redux-persist'; |
||||
|
||||
const SetTransform = createTransform( |
||||
// transform state on its way to being serialized and persisted. |
||||
(inboundState, key) => { |
||||
// convert mySet to an Array. |
||||
return { ...inboundState, mySet: [...inboundState.mySet] }; |
||||
}, |
||||
// transform state being rehydrated |
||||
(outboundState, key) => { |
||||
// convert mySet back to a Set. |
||||
return { ...outboundState, mySet: new Set(outboundState.mySet) }; |
||||
}, |
||||
// define which reducers this transform gets called for. |
||||
{ whitelist: ['someReducer'] } |
||||
); |
||||
|
||||
export default SetTransform; |
||||
``` |
||||
|
||||
The `createTransform` function takes three parameters. |
||||
1. An "inbound" function that gets called right before state is persisted (optional). |
||||
2. An "outbound" function that gets called right before state is rehydrated (optional). |
||||
3. A config object that determines which keys in your state will be transformed (by default no keys are transformed). |
||||
|
||||
In order to take effect transforms need to be added to a `PersistReducer`’s config object. |
||||
|
||||
``` |
||||
import storage from 'redux-persist/lib/storage'; |
||||
import { SetTransform } from './transforms'; |
||||
|
||||
const persistConfig = { |
||||
key: 'root', |
||||
storage: storage, |
||||
transforms: [SetTransform] |
||||
}; |
||||
``` |
||||
|
||||
## Storage Engines |
||||
- **localStorage** `import storage from 'redux-persist/lib/storage'` |
||||
- **sessionStorage** `import storageSession from 'redux-persist/lib/storage/session'` |
||||
- **AsyncStorage** react-native `import AsyncStorage from '@react-native-community/async-storage'` |
||||
- **[localForage](https://github.com/mozilla/localForage)** recommended for web |
||||
- **[electron storage](https://github.com/psperber/redux-persist-electron-storage)** Electron support via [electron store](https://github.com/sindresorhus/electron-store) |
||||
- **[redux-persist-filesystem-storage](https://github.com/robwalkerco/redux-persist-filesystem-storage)** react-native, to mitigate storage size limitations in android ([#199](https://github.com/rt2zz/redux-persist/issues/199), [#284](https://github.com/rt2zz/redux-persist/issues/284)) |
||||
- **[redux-persist-node-storage](https://github.com/pellejacobs/redux-persist-node-storage)** for use in nodejs environments. |
||||
- **[redux-persist-sensitive-storage](https://github.com/CodingZeal/redux-persist-sensitive-storage)** react-native, for sensitive information (uses [react-native-sensitive-info](https://github.com/mCodex/react-native-sensitive-info)). |
||||
- **[redux-persist-expo-filesystem](https://github.com/t73liu/redux-persist-expo-filesystem)** react-native, similar to redux-persist-filesystem-storage but does not require linking or ejecting CRNA/Expo app. Only available if using Expo SDK (Expo, create-react-native-app, standalone). |
||||
- **[redux-persist-expo-securestore](https://github.com/Cretezy/redux-persist-expo-securestore)** react-native, for sensitive information using Expo's SecureStore. Only available if using Expo SDK (Expo, create-react-native-app, standalone). |
||||
- **[redux-persist-fs-storage](https://github.com/leethree/redux-persist-fs-storage)** react-native-fs engine |
||||
- **[redux-persist-cookie-storage](https://github.com/abersager/redux-persist-cookie-storage)** Cookie storage engine, works in browser and Node.js, for universal / isomorphic apps |
||||
- **[redux-persist-weapp-storage](https://github.com/cuijiemmx/redux-casa/tree/master/packages/redux-persist-weapp-storage)** Storage engine for wechat mini program, also compatible with wepy |
||||
- **[redux-persist-webextension-storage](https://github.com/ssorallen/redux-persist-webextension-storage)** Storage engine for browser (Chrome, Firefox) web extension storage |
||||
- **[@bankify/redux-persist-realm](https://github.com/bankifyio/redux-persist-realm)** Storage engine for Realm database, you will need to install Realm first |
||||
- **[redux-persist-pouchdb](https://github.com/yanick/redux-persist-pouchdb)** Storage engine for PouchDB. |
||||
- **custom** any conforming storage api implementing the following methods: `setItem` `getItem` `removeItem`. (**NB**: These methods must support promises) |
||||
|
||||
## Community |
||||
|
||||
### Chat Room |
||||
|
||||
[![#redux-persist on Discord](https://img.shields.io/discord/102860784329052160.svg)](https://discord.gg/ExrEvmv) #redux-persist channel in the [Reactiflux](https://www.reactiflux.com/) Discord |
||||
|
||||
### Blog articles from the community |
||||
|
||||
* [The Definitive Guide to Redux Persist: Persist your Redux state in between app launches with Redux Persist](https://blog.reactnativecoach.com/the-definitive-guide-to-redux-persist-84738167975) by Mark Newton |
||||
* [Redux-persist: The Good Parts](https://codeburst.io/redux-persist-the-good-parts-adfab9f91c3b) by Feargal Walsh |
||||
* [Redux: Persist Your State](https://medium.com/async-la/redux-persist-your-state-7ad346c4dd07) by Zack |
||||
* [{Persist}ence is Key: Using Redux-Persist to Store Your State in LocalStorage](https://medium.com/@clrksanford/persist-ence-is-key-using-redux-persist-to-store-your-state-in-localstorage-ac6a000aee63) by Clark Sanford |
||||
* [How to use Redux Persist when migrating your states](https://medium.freecodecamp.org/how-to-use-redux-persist-when-migrating-your-states-a5dee16b5ead) by Lusan Das |
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,8 @@ |
||||
export var KEY_PREFIX = 'persist:'; |
||||
export var FLUSH = 'persist/FLUSH'; |
||||
export var REHYDRATE = 'persist/REHYDRATE'; |
||||
export var PAUSE = 'persist/PAUSE'; |
||||
export var PERSIST = 'persist/PERSIST'; |
||||
export var PURGE = 'persist/PURGE'; |
||||
export var REGISTER = 'persist/REGISTER'; |
||||
export var DEFAULT_VERSION = -1; |
@ -0,0 +1,10 @@ |
||||
// @flow |
||||
|
||||
export const KEY_PREFIX = 'persist:' |
||||
export const FLUSH = 'persist/FLUSH' |
||||
export const REHYDRATE = 'persist/REHYDRATE' |
||||
export const PAUSE = 'persist/PAUSE' |
||||
export const PERSIST = 'persist/PERSIST' |
||||
export const PURGE = 'persist/PURGE' |
||||
export const REGISTER = 'persist/REGISTER' |
||||
export const DEFAULT_VERSION = -1 |
@ -0,0 +1,43 @@ |
||||
import { DEFAULT_VERSION } from './constants'; |
||||
export default function createMigrate(migrations, config) { |
||||
var _ref = config || {}, |
||||
debug = _ref.debug; |
||||
|
||||
return function (state, currentVersion) { |
||||
if (!state) { |
||||
if (process.env.NODE_ENV !== 'production' && debug) console.log('redux-persist: no inbound state, skipping migration'); |
||||
return Promise.resolve(undefined); |
||||
} |
||||
|
||||
var inboundVersion = state._persist && state._persist.version !== undefined ? state._persist.version : DEFAULT_VERSION; |
||||
|
||||
if (inboundVersion === currentVersion) { |
||||
if (process.env.NODE_ENV !== 'production' && debug) console.log('redux-persist: versions match, noop migration'); |
||||
return Promise.resolve(state); |
||||
} |
||||
|
||||
if (inboundVersion > currentVersion) { |
||||
if (process.env.NODE_ENV !== 'production') console.error('redux-persist: downgrading version is not supported'); |
||||
return Promise.resolve(state); |
||||
} |
||||
|
||||
var migrationKeys = Object.keys(migrations).map(function (ver) { |
||||
return parseInt(ver); |
||||
}).filter(function (key) { |
||||
return currentVersion >= key && key > inboundVersion; |
||||
}).sort(function (a, b) { |
||||
return a - b; |
||||
}); |
||||
if (process.env.NODE_ENV !== 'production' && debug) console.log('redux-persist: migrationKeys', migrationKeys); |
||||
|
||||
try { |
||||
var migratedState = migrationKeys.reduce(function (state, versionKey) { |
||||
if (process.env.NODE_ENV !== 'production' && debug) console.log('redux-persist: running migration for versionKey', versionKey); |
||||
return migrations[versionKey](state); |
||||
}, state); |
||||
return Promise.resolve(migratedState); |
||||
} catch (err) { |
||||
return Promise.reject(err); |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,58 @@ |
||||
// @flow |
||||
|
||||
import { DEFAULT_VERSION } from './constants' |
||||
|
||||
import type { PersistedState, MigrationManifest } from './types' |
||||
|
||||
export default function createMigrate( |
||||
migrations: MigrationManifest, |
||||
config?: { debug: boolean } |
||||
) { |
||||
let { debug } = config || {} |
||||
return function( |
||||
state: PersistedState, |
||||
currentVersion: number |
||||
): Promise<PersistedState> { |
||||
if (!state) { |
||||
if (process.env.NODE_ENV !== 'production' && debug) |
||||
console.log('redux-persist: no inbound state, skipping migration') |
||||
return Promise.resolve(undefined) |
||||
} |
||||
|
||||
let inboundVersion: number = |
||||
state._persist && state._persist.version !== undefined |
||||
? state._persist.version |
||||
: DEFAULT_VERSION |
||||
if (inboundVersion === currentVersion) { |
||||
if (process.env.NODE_ENV !== 'production' && debug) |
||||
console.log('redux-persist: versions match, noop migration') |
||||
return Promise.resolve(state) |
||||
} |
||||
if (inboundVersion > currentVersion) { |
||||
if (process.env.NODE_ENV !== 'production') |
||||
console.error('redux-persist: downgrading version is not supported') |
||||
return Promise.resolve(state) |
||||
} |
||||
|
||||
let migrationKeys = Object.keys(migrations) |
||||
.map(ver => parseInt(ver)) |
||||
.filter(key => currentVersion >= key && key > inboundVersion) |
||||
.sort((a, b) => a - b) |
||||
|
||||
if (process.env.NODE_ENV !== 'production' && debug) |
||||
console.log('redux-persist: migrationKeys', migrationKeys) |
||||
try { |
||||
let migratedState = migrationKeys.reduce((state, versionKey) => { |
||||
if (process.env.NODE_ENV !== 'production' && debug) |
||||
console.log( |
||||
'redux-persist: running migration for versionKey', |
||||
versionKey |
||||
) |
||||
return migrations[versionKey](state) |
||||
}, state) |
||||
return Promise.resolve(migratedState) |
||||
} catch (err) { |
||||
return Promise.reject(err) |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,127 @@ |
||||
import { KEY_PREFIX, REHYDRATE } from './constants'; |
||||
// @TODO remove once flow < 0.63 support is no longer required.
|
||||
export default function createPersistoid(config) { |
||||
// defaults
|
||||
var blacklist = config.blacklist || null; |
||||
var whitelist = config.whitelist || null; |
||||
var transforms = config.transforms || []; |
||||
var throttle = config.throttle || 0; |
||||
var storageKey = "".concat(config.keyPrefix !== undefined ? config.keyPrefix : KEY_PREFIX).concat(config.key); |
||||
var storage = config.storage; |
||||
var serialize; |
||||
|
||||
if (config.serialize === false) { |
||||
serialize = function serialize(x) { |
||||
return x; |
||||
}; |
||||
} else if (typeof config.serialize === 'function') { |
||||
serialize = config.serialize; |
||||
} else { |
||||
serialize = defaultSerialize; |
||||
} |
||||
|
||||
var writeFailHandler = config.writeFailHandler || null; // initialize stateful values
|
||||
|
||||
var lastState = {}; |
||||
var stagedState = {}; |
||||
var keysToProcess = []; |
||||
var timeIterator = null; |
||||
var writePromise = null; |
||||
|
||||
var update = function update(state) { |
||||
// add any changed keys to the queue
|
||||
Object.keys(state).forEach(function (key) { |
||||
if (!passWhitelistBlacklist(key)) return; // is keyspace ignored? noop
|
||||
|
||||
if (lastState[key] === state[key]) return; // value unchanged? noop
|
||||
|
||||
if (keysToProcess.indexOf(key) !== -1) return; // is key already queued? noop
|
||||
|
||||
keysToProcess.push(key); // add key to queue
|
||||
}); //if any key is missing in the new state which was present in the lastState,
|
||||
//add it for processing too
|
||||
|
||||
Object.keys(lastState).forEach(function (key) { |
||||
if (state[key] === undefined && passWhitelistBlacklist(key) && keysToProcess.indexOf(key) === -1 && lastState[key] !== undefined) { |
||||
keysToProcess.push(key); |
||||
} |
||||
}); // start the time iterator if not running (read: throttle)
|
||||
|
||||
if (timeIterator === null) { |
||||
timeIterator = setInterval(processNextKey, throttle); |
||||
} |
||||
|
||||
lastState = state; |
||||
}; |
||||
|
||||
function processNextKey() { |
||||
if (keysToProcess.length === 0) { |
||||
if (timeIterator) clearInterval(timeIterator); |
||||
timeIterator = null; |
||||
return; |
||||
} |
||||
|
||||
var key = keysToProcess.shift(); |
||||
var endState = transforms.reduce(function (subState, transformer) { |
||||
return transformer.in(subState, key, lastState); |
||||
}, lastState[key]); |
||||
|
||||
if (endState !== undefined) { |
||||
try { |
||||
stagedState[key] = serialize(endState); |
||||
} catch (err) { |
||||
console.error('redux-persist/createPersistoid: error serializing state', err); |
||||
} |
||||
} else { |
||||
//if the endState is undefined, no need to persist the existing serialized content
|
||||
delete stagedState[key]; |
||||
} |
||||
|
||||
if (keysToProcess.length === 0) { |
||||
writeStagedState(); |
||||
} |
||||
} |
||||
|
||||
function writeStagedState() { |
||||
// cleanup any removed keys just before write.
|
||||
Object.keys(stagedState).forEach(function (key) { |
||||
if (lastState[key] === undefined) { |
||||
delete stagedState[key]; |
||||
} |
||||
}); |
||||
writePromise = storage.setItem(storageKey, serialize(stagedState)).catch(onWriteFail); |
||||
} |
||||
|
||||
function passWhitelistBlacklist(key) { |
||||
if (whitelist && whitelist.indexOf(key) === -1 && key !== '_persist') return false; |
||||
if (blacklist && blacklist.indexOf(key) !== -1) return false; |
||||
return true; |
||||
} |
||||
|
||||
function onWriteFail(err) { |
||||
// @TODO add fail handlers (typically storage full)
|
||||
if (writeFailHandler) writeFailHandler(err); |
||||
|
||||
if (err && process.env.NODE_ENV !== 'production') { |
||||
console.error('Error storing data', err); |
||||
} |
||||
} |
||||
|
||||
var flush = function flush() { |
||||
while (keysToProcess.length !== 0) { |
||||
processNextKey(); |
||||
} |
||||
|
||||
return writePromise || Promise.resolve(); |
||||
}; // return `persistoid`
|
||||
|
||||
|
||||
return { |
||||
update: update, |
||||
flush: flush |
||||
}; |
||||
} // @NOTE in the future this may be exposed via config
|
||||
|
||||
function defaultSerialize(data) { |
||||
return JSON.stringify(data); |
||||
} |
@ -0,0 +1,142 @@ |
||||
// @flow |
||||
|
||||
import { KEY_PREFIX, REHYDRATE } from './constants' |
||||
|
||||
import type { Persistoid, PersistConfig, Transform } from './types' |
||||
|
||||
type IntervalID = any // @TODO remove once flow < 0.63 support is no longer required. |
||||
|
||||
export default function createPersistoid(config: PersistConfig): Persistoid { |
||||
// defaults |
||||
const blacklist: ?Array<string> = config.blacklist || null |
||||
const whitelist: ?Array<string> = config.whitelist || null |
||||
const transforms = config.transforms || [] |
||||
const throttle = config.throttle || 0 |
||||
const storageKey = `${ |
||||
config.keyPrefix !== undefined ? config.keyPrefix : KEY_PREFIX |
||||
}${config.key}` |
||||
const storage = config.storage |
||||
let serialize |
||||
if (config.serialize === false) { |
||||
serialize = x => x |
||||
} else if (typeof config.serialize === 'function') { |
||||
serialize = config.serialize |
||||
} else { |
||||
serialize = defaultSerialize |
||||
} |
||||
const writeFailHandler = config.writeFailHandler || null |
||||
|
||||
// initialize stateful values |
||||
let lastState = {} |
||||
let stagedState = {} |
||||
let keysToProcess = [] |
||||
let timeIterator: ?IntervalID = null |
||||
let writePromise = null |
||||
|
||||
const update = (state: Object) => { |
||||
// add any changed keys to the queue |
||||
Object.keys(state).forEach(key => { |
||||
if (!passWhitelistBlacklist(key)) return // is keyspace ignored? noop |
||||
if (lastState[key] === state[key]) return // value unchanged? noop |
||||
if (keysToProcess.indexOf(key) !== -1) return // is key already queued? noop |
||||
keysToProcess.push(key) // add key to queue |
||||
}) |
||||
|
||||
//if any key is missing in the new state which was present in the lastState, |
||||
//add it for processing too |
||||
Object.keys(lastState).forEach(key => { |
||||
if ( |
||||
state[key] === undefined && |
||||
passWhitelistBlacklist(key) && |
||||
keysToProcess.indexOf(key) === -1 && |
||||
lastState[key] !== undefined |
||||
) { |
||||
keysToProcess.push(key) |
||||
} |
||||
}) |
||||
|
||||
// start the time iterator if not running (read: throttle) |
||||
if (timeIterator === null) { |
||||
timeIterator = setInterval(processNextKey, throttle) |
||||
} |
||||
|
||||
lastState = state |
||||
} |
||||
|
||||
function processNextKey() { |
||||
if (keysToProcess.length === 0) { |
||||
if (timeIterator) clearInterval(timeIterator) |
||||
timeIterator = null |
||||
return |
||||
} |
||||
|
||||
let key = keysToProcess.shift() |
||||
let endState = transforms.reduce((subState, transformer) => { |
||||
return transformer.in(subState, key, lastState) |
||||
}, lastState[key]) |
||||
|
||||
if (endState !== undefined) { |
||||
try { |
||||
stagedState[key] = serialize(endState) |
||||
} catch (err) { |
||||
console.error( |
||||
'redux-persist/createPersistoid: error serializing state', |
||||
err |
||||
) |
||||
} |
||||
} else { |
||||
//if the endState is undefined, no need to persist the existing serialized content |
||||
delete stagedState[key] |
||||
} |
||||
|
||||
if (keysToProcess.length === 0) { |
||||
writeStagedState() |
||||
} |
||||
} |
||||
|
||||
function writeStagedState() { |
||||
// cleanup any removed keys just before write. |
||||
Object.keys(stagedState).forEach(key => { |
||||
if (lastState[key] === undefined) { |
||||
delete stagedState[key] |
||||
} |
||||
}) |
||||
|
||||
writePromise = storage |
||||
.setItem(storageKey, serialize(stagedState)) |
||||
.catch(onWriteFail) |
||||
} |
||||
|
||||
function passWhitelistBlacklist(key) { |
||||
if (whitelist && whitelist.indexOf(key) === -1 && key !== '_persist') |
||||
return false |
||||
if (blacklist && blacklist.indexOf(key) !== -1) return false |
||||
return true |
||||
} |
||||
|