Socket
Socket
Sign inDemoInstall

redux-persist

Package Overview
Dependencies
1
Maintainers
2
Versions
186
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.0.0-pre2 to 6.0.0-pre2.0

16

dist/redux-persist.js

@@ -387,3 +387,10 @@ (function (global, factory) {

if (_persist) return state;
if (_persist) {
// We still need to call the base reducer because there might be nested
// uses of persistReducer which need to be aware of the PERSIST action
return _objectSpread({}, baseReducer(restState, action), {
_persist: _persist
});
}
if (typeof action.rehydrate !== 'function' || typeof action.register !== 'function') throw new Error('redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.');

@@ -1055,3 +1062,3 @@ action.register(config.key);

var _pStore = createStore(persistorReducer, initialState, options ? options.enhancer : undefined);
var _pStore = createStore(persistorReducer, initialState, options && options.enhancer ? options.enhancer : undefined);

@@ -1118,3 +1125,6 @@ var register = function register(key) {

persistor.persist();
if (!(options && options.manualPersist)) {
persistor.persist();
}
return persistor;

@@ -1121,0 +1131,0 @@ }

2

dist/redux-persist.min.js

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.ReduxPersist={})}(this,function(e){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){r(e,t,n[t])})}return e}function o(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;i.length>n;n++)0>t.indexOf(r=i[n])&&(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;i.length>n;n++)0>t.indexOf(r=i[n])&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function i(e){return function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);e.length>t;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var u="persist:",s="persist/FLUSH",c="persist/REHYDRATE",a="persist/PAUSE",f="persist/PERSIST",l="persist/PURGE",d="persist/REGISTER",p=-1;function y(e,r,o,i){var u=n({},o);return e&&"object"===t(e)&&Object.keys(e).forEach(function(t){"_persist"!==t&&r[t]===o[t]&&(u[t]=e[t])}),u}function h(e){var t,r=e.blacklist||null,n=e.whitelist||null,o=e.transforms||[],i=e.throttle||0,s="".concat(void 0!==e.keyPrefix?e.keyPrefix:u).concat(e.key),c=e.storage;t=!1===e.serialize?function(e){return e}:"function"==typeof e.serialize?e.serialize:v;var a=e.writeFailHandler||null,f={},l={},d=[],p=null,y=null;function h(){if(0===d.length)return p&&clearInterval(p),void(p=null);var e=d.shift(),r=o.reduce(function(t,r){return r.in(t,e,f)},f[e]);if(void 0!==r)try{l[e]=t(r)}catch(e){console.error("redux-persist/createPersistoid: error serializing state",e)}else delete l[e];0===d.length&&(Object.keys(l).forEach(function(e){void 0===f[e]&&delete l[e]}),y=c.setItem(s,t(l)).catch(m))}function b(e){return(!n||-1!==n.indexOf(e)||"_persist"===e)&&(!r||-1===r.indexOf(e))}function m(e){a&&a(e)}return{update:function(e){Object.keys(e).forEach(function(t){b(t)&&f[t]!==e[t]&&-1===d.indexOf(t)&&d.push(t)}),Object.keys(f).forEach(function(t){void 0===e[t]&&b(t)&&-1===d.indexOf(t)&&void 0!==f[t]&&d.push(t)}),null===p&&(p=setInterval(h,i)),f=e},flush:function(){for(;0!==d.length;)h();return y||Promise.resolve()}}}function v(e){return JSON.stringify(e)}function b(e){var t,r=e.transforms||[],n="".concat(void 0!==e.keyPrefix?e.keyPrefix:u).concat(e.key);return t=!1===e.deserialize?function(e){return e}:"function"==typeof e.deserialize?e.deserialize:m,e.storage.getItem(n).then(function(e){if(e)try{var n={},o=t(e);return Object.keys(o).forEach(function(e){n[e]=r.reduceRight(function(t,r){return r.out(t,e,o)},t(o[e]))}),n}catch(e){throw e}})}function m(e){return JSON.parse(e)}function g(e){var t=e.storage,r="".concat(void 0!==e.keyPrefix?e.keyPrefix:u).concat(e.key);return t.removeItem(r,E)}function E(e){0}var O=5e3;function w(e,t){var r=void 0!==e.version?e.version:p,i=void 0===e.stateReconciler?y:e.stateReconciler,u=e.getStoredState||b,d=void 0!==e.timeout?e.timeout:O,v=null,m=!1,E=!0,w=function(e){return e._persist.rehydrated&&v&&!E&&v.update(e),e};return function(p,y){var b=p||{},O=b._persist,x=o(b,["_persist"]);if(y.type===f){var P=!1,S=function(t,r){P||(y.rehydrate(e.key,t,r),P=!0)};if(d&&setTimeout(function(){!P&&S(void 0,Error('redux-persist: persist timed out for persist key "'.concat(e.key,'"')))},d),E=!1,v||(v=h(e)),O)return p;if("function"!=typeof y.rehydrate||"function"!=typeof y.register)throw Error("redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.");return y.register(e.key),u(e).then(function(t){(e.migrate||function(e,t){return Promise.resolve(e)})(t,r).then(function(e){S(e)},function(e){S(void 0,e)})},function(e){S(void 0,e)}),n({},t(x,y),{_persist:{version:r,rehydrated:!1}})}if(y.type===l)return m=!0,y.result(g(e)),n({},t(x,y),{_persist:O});if(y.type===s)return y.result(v&&v.flush()),n({},t(x,y),{_persist:O});if(y.type===a)E=!0;else if(y.type===c){if(m)return n({},x,{_persist:n({},O,{rehydrated:!0})});if(y.key===e.key){var k=t(x,y),j=y.payload,I=n({},!1!==i&&void 0!==j?i(j,p,k,e):k,{_persist:n({},O,{rehydrated:!0})});return w(I)}}if(!O)return t(p,y);var R=t(x,y);return R===x?p:w(n({},R,{_persist:O}))}}var x=function(e){var t,r=e.Symbol;return"function"==typeof r?r.observable?t=r.observable:(t=r("observable"),r.observable=t):t="@@observable",t}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")()),P=function(){return Math.random().toString(36).substring(7).split("").join(".")},S={INIT:"@@redux/INIT"+P(),REPLACE:"@@redux/REPLACE"+P(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+P()}};function k(e,t,r){var n;if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function");if("function"==typeof t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw Error("Expected the enhancer to be a function.");return r(k)(e,t)}if("function"!=typeof e)throw Error("Expected the reducer to be a function.");var o=e,i=t,u=[],s=u,c=!1;function a(){s===u&&(s=u.slice())}function f(){if(c)throw Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function l(e){if("function"!=typeof e)throw Error("Expected the listener to be a function.");if(c)throw Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");var t=!0;return a(),s.push(e),function(){if(t){if(c)throw Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");t=!1,a();var r=s.indexOf(e);s.splice(r,1)}}}function d(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(c)throw Error("Reducers may not dispatch actions.");try{c=!0,i=o(i,e)}finally{c=!1}for(var t=u=s,r=0;t.length>r;r++){(0,t[r])()}return e}return d({type:S.INIT}),(n={dispatch:d,subscribe:l,getState:f,replaceReducer:function(e){if("function"!=typeof e)throw Error("Expected the nextReducer to be a function.");o=e,d({type:S.REPLACE})}})[x]=function(){var e,t=l;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new TypeError("Expected the observer to be an object.");function r(){e.next&&e.next(f())}return r(),{unsubscribe:t(r)}}})[x]=function(){return this},e},n}function j(e,t){var r=t&&t.type;return"Given "+(r&&'action "'+r+'"'||"an action")+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}function I(e){for(var t=Object.keys(e),r={},n=0;t.length>n;n++){var o=t[n];"function"==typeof e[o]&&(r[o]=e[o])}var i,u=Object.keys(r);try{!function(e){Object.keys(e).forEach(function(t){var r=e[t];if(void 0===r(void 0,{type:S.INIT}))throw Error('Reducer "'+t+"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.");if(void 0===r(void 0,{type:S.PROBE_UNKNOWN_ACTION()}))throw Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+S.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.')})}(r)}catch(e){i=e}return function(e,t){if(void 0===e&&(e={}),i)throw i;for(var n=!1,o={},s=0;u.length>s;s++){var c=u[s],a=e[c],f=(0,r[c])(a,t);if(void 0===f){var l=j(c,t);throw Error(l)}o[c]=f,n=n||f!==a}return n?o:e}}function R(e,r,o,i){var u=n({},o);return e&&"object"===t(e)&&Object.keys(e).forEach(function(i){var s;"_persist"!==i&&(r[i]===o[i]&&(u[i]=null===(s=o[i])||Array.isArray(s)||"object"!==t(s)?e[i]:n({},u[i],e[i])))}),u}var T={registry:[],bootstrapped:!1},_=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:T,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case d:return n({},e,{registry:[].concat(i(e.registry),[t.key])});case c:var r=e.registry.indexOf(t.key),o=i(e.registry);return o.splice(r,1),n({},e,{registry:o,bootstrapped:0===o.length});default:return e}};e.persistReducer=w,e.persistCombineReducers=function(e,t){return e.stateReconciler=void 0===e.stateReconciler?R:e.stateReconciler,w(e,I(t))},e.persistStore=function(e,t,r){var o=r||!1,i=k(_,T,t?t.enhancer:void 0),u=function(e){i.dispatch({type:d,key:e})},p=function(t,r,n){var u={type:c,payload:r,err:n,key:t};e.dispatch(u),i.dispatch(u),o&&y.getState().bootstrapped&&(o(),o=!1)},y=n({},i,{purge:function(){var t=[];return e.dispatch({type:l,result:function(e){t.push(e)}}),Promise.all(t)},flush:function(){var t=[];return e.dispatch({type:s,result:function(e){t.push(e)}}),Promise.all(t)},pause:function(){e.dispatch({type:a})},persist:function(){e.dispatch({type:f,register:u,rehydrate:p})}});return y.persist(),y},e.createMigrate=function(e,t){return function(t,r){if(!t)return Promise.resolve(void 0);var n=t._persist&&void 0!==t._persist.version?t._persist.version:p;if(n===r)return Promise.resolve(t);if(n>r)return Promise.resolve(t);var o=Object.keys(e).map(function(e){return parseInt(e)}).filter(function(e){return r>=e&&e>n}).sort(function(e,t){return e-t});try{var i=o.reduce(function(t,r){return e[r](t)},t);return Promise.resolve(i)}catch(e){return Promise.reject(e)}}},e.createTransform=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.whitelist||null,o=r.blacklist||null;function i(e){return!(!n||-1!==n.indexOf(e))||!(!o||-1===o.indexOf(e))}return{in:function(t,r,n){return!i(r)&&e?e(t,r,n):t},out:function(e,r,n){return!i(r)&&t?t(e,r,n):e}}},e.getStoredState=b,e.createPersistoid=h,e.purgeStoredState=g,e.KEY_PREFIX=u,e.FLUSH=s,e.REHYDRATE=c,e.PAUSE=a,e.PERSIST=f,e.PURGE=l,e.REGISTER=d,e.DEFAULT_VERSION=p,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.ReduxPersist={})}(this,function(e){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){r(e,t,n[t])})}return e}function o(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;i.length>n;n++)0>t.indexOf(r=i[n])&&(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;i.length>n;n++)0>t.indexOf(r=i[n])&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function i(e){return function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);e.length>t;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var u="persist:",s="persist/FLUSH",c="persist/REHYDRATE",a="persist/PAUSE",f="persist/PERSIST",l="persist/PURGE",d="persist/REGISTER",p=-1;function y(e,r,o,i){var u=n({},o);return e&&"object"===t(e)&&Object.keys(e).forEach(function(t){"_persist"!==t&&r[t]===o[t]&&(u[t]=e[t])}),u}function h(e){var t,r=e.blacklist||null,n=e.whitelist||null,o=e.transforms||[],i=e.throttle||0,s="".concat(void 0!==e.keyPrefix?e.keyPrefix:u).concat(e.key),c=e.storage;t=!1===e.serialize?function(e){return e}:"function"==typeof e.serialize?e.serialize:v;var a=e.writeFailHandler||null,f={},l={},d=[],p=null,y=null;function h(){if(0===d.length)return p&&clearInterval(p),void(p=null);var e=d.shift(),r=o.reduce(function(t,r){return r.in(t,e,f)},f[e]);if(void 0!==r)try{l[e]=t(r)}catch(e){console.error("redux-persist/createPersistoid: error serializing state",e)}else delete l[e];0===d.length&&(Object.keys(l).forEach(function(e){void 0===f[e]&&delete l[e]}),y=c.setItem(s,t(l)).catch(m))}function b(e){return(!n||-1!==n.indexOf(e)||"_persist"===e)&&(!r||-1===r.indexOf(e))}function m(e){a&&a(e)}return{update:function(e){Object.keys(e).forEach(function(t){b(t)&&f[t]!==e[t]&&-1===d.indexOf(t)&&d.push(t)}),Object.keys(f).forEach(function(t){void 0===e[t]&&b(t)&&-1===d.indexOf(t)&&void 0!==f[t]&&d.push(t)}),null===p&&(p=setInterval(h,i)),f=e},flush:function(){for(;0!==d.length;)h();return y||Promise.resolve()}}}function v(e){return JSON.stringify(e)}function b(e){var t,r=e.transforms||[],n="".concat(void 0!==e.keyPrefix?e.keyPrefix:u).concat(e.key);return t=!1===e.deserialize?function(e){return e}:"function"==typeof e.deserialize?e.deserialize:m,e.storage.getItem(n).then(function(e){if(e)try{var n={},o=t(e);return Object.keys(o).forEach(function(e){n[e]=r.reduceRight(function(t,r){return r.out(t,e,o)},t(o[e]))}),n}catch(e){throw e}})}function m(e){return JSON.parse(e)}function g(e){var t=e.storage,r="".concat(void 0!==e.keyPrefix?e.keyPrefix:u).concat(e.key);return t.removeItem(r,E)}function E(e){0}var O=5e3;function w(e,t){var r=void 0!==e.version?e.version:p,i=void 0===e.stateReconciler?y:e.stateReconciler,u=e.getStoredState||b,d=void 0!==e.timeout?e.timeout:O,v=null,m=!1,E=!0,w=function(e){return e._persist.rehydrated&&v&&!E&&v.update(e),e};return function(p,y){var b=p||{},O=b._persist,P=o(b,["_persist"]);if(y.type===f){var x=!1,S=function(t,r){x||(y.rehydrate(e.key,t,r),x=!0)};if(d&&setTimeout(function(){!x&&S(void 0,Error('redux-persist: persist timed out for persist key "'.concat(e.key,'"')))},d),E=!1,v||(v=h(e)),O)return n({},t(P,y),{_persist:O});if("function"!=typeof y.rehydrate||"function"!=typeof y.register)throw Error("redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.");return y.register(e.key),u(e).then(function(t){(e.migrate||function(e,t){return Promise.resolve(e)})(t,r).then(function(e){S(e)},function(e){S(void 0,e)})},function(e){S(void 0,e)}),n({},t(P,y),{_persist:{version:r,rehydrated:!1}})}if(y.type===l)return m=!0,y.result(g(e)),n({},t(P,y),{_persist:O});if(y.type===s)return y.result(v&&v.flush()),n({},t(P,y),{_persist:O});if(y.type===a)E=!0;else if(y.type===c){if(m)return n({},P,{_persist:n({},O,{rehydrated:!0})});if(y.key===e.key){var k=t(P,y),j=y.payload,I=n({},!1!==i&&void 0!==j?i(j,p,k,e):k,{_persist:n({},O,{rehydrated:!0})});return w(I)}}if(!O)return t(p,y);var R=t(P,y);return R===P?p:w(n({},R,{_persist:O}))}}var P=function(e){var t,r=e.Symbol;return"function"==typeof r?r.observable?t=r.observable:(t=r("observable"),r.observable=t):t="@@observable",t}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")()),x=function(){return Math.random().toString(36).substring(7).split("").join(".")},S={INIT:"@@redux/INIT"+x(),REPLACE:"@@redux/REPLACE"+x(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+x()}};function k(e,t,r){var n;if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function");if("function"==typeof t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw Error("Expected the enhancer to be a function.");return r(k)(e,t)}if("function"!=typeof e)throw Error("Expected the reducer to be a function.");var o=e,i=t,u=[],s=u,c=!1;function a(){s===u&&(s=u.slice())}function f(){if(c)throw Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function l(e){if("function"!=typeof e)throw Error("Expected the listener to be a function.");if(c)throw Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");var t=!0;return a(),s.push(e),function(){if(t){if(c)throw Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");t=!1,a();var r=s.indexOf(e);s.splice(r,1)}}}function d(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(c)throw Error("Reducers may not dispatch actions.");try{c=!0,i=o(i,e)}finally{c=!1}for(var t=u=s,r=0;t.length>r;r++){(0,t[r])()}return e}return d({type:S.INIT}),(n={dispatch:d,subscribe:l,getState:f,replaceReducer:function(e){if("function"!=typeof e)throw Error("Expected the nextReducer to be a function.");o=e,d({type:S.REPLACE})}})[P]=function(){var e,t=l;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new TypeError("Expected the observer to be an object.");function r(){e.next&&e.next(f())}return r(),{unsubscribe:t(r)}}})[P]=function(){return this},e},n}function j(e,t){var r=t&&t.type;return"Given "+(r&&'action "'+r+'"'||"an action")+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}function I(e){for(var t=Object.keys(e),r={},n=0;t.length>n;n++){var o=t[n];"function"==typeof e[o]&&(r[o]=e[o])}var i,u=Object.keys(r);try{!function(e){Object.keys(e).forEach(function(t){var r=e[t];if(void 0===r(void 0,{type:S.INIT}))throw Error('Reducer "'+t+"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.");if(void 0===r(void 0,{type:S.PROBE_UNKNOWN_ACTION()}))throw Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+S.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.')})}(r)}catch(e){i=e}return function(e,t){if(void 0===e&&(e={}),i)throw i;for(var n=!1,o={},s=0;u.length>s;s++){var c=u[s],a=e[c],f=(0,r[c])(a,t);if(void 0===f){var l=j(c,t);throw Error(l)}o[c]=f,n=n||f!==a}return n?o:e}}function R(e,r,o,i){var u=n({},o);return e&&"object"===t(e)&&Object.keys(e).forEach(function(i){var s;"_persist"!==i&&(r[i]===o[i]&&(u[i]=null===(s=o[i])||Array.isArray(s)||"object"!==t(s)?e[i]:n({},u[i],e[i])))}),u}var T={registry:[],bootstrapped:!1},_=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:T,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case d:return n({},e,{registry:[].concat(i(e.registry),[t.key])});case c:var r=e.registry.indexOf(t.key),o=i(e.registry);return o.splice(r,1),n({},e,{registry:o,bootstrapped:0===o.length});default:return e}};e.persistReducer=w,e.persistCombineReducers=function(e,t){return e.stateReconciler=void 0===e.stateReconciler?R:e.stateReconciler,w(e,I(t))},e.persistStore=function(e,t,r){var o=r||!1,i=k(_,T,t&&t.enhancer?t.enhancer:void 0),u=function(e){i.dispatch({type:d,key:e})},p=function(t,r,n){var u={type:c,payload:r,err:n,key:t};e.dispatch(u),i.dispatch(u),o&&y.getState().bootstrapped&&(o(),o=!1)},y=n({},i,{purge:function(){var t=[];return e.dispatch({type:l,result:function(e){t.push(e)}}),Promise.all(t)},flush:function(){var t=[];return e.dispatch({type:s,result:function(e){t.push(e)}}),Promise.all(t)},pause:function(){e.dispatch({type:a})},persist:function(){e.dispatch({type:f,register:u,rehydrate:p})}});return t&&t.manualPersist||y.persist(),y},e.createMigrate=function(e,t){return function(t,r){if(!t)return Promise.resolve(void 0);var n=t._persist&&void 0!==t._persist.version?t._persist.version:p;if(n===r)return Promise.resolve(t);if(n>r)return Promise.resolve(t);var o=Object.keys(e).map(function(e){return parseInt(e)}).filter(function(e){return r>=e&&e>n}).sort(function(e,t){return e-t});try{var i=o.reduce(function(t,r){return e[r](t)},t);return Promise.resolve(i)}catch(e){return Promise.reject(e)}}},e.createTransform=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.whitelist||null,o=r.blacklist||null;function i(e){return!(!n||-1!==n.indexOf(e))||!(!o||-1===o.indexOf(e))}return{in:function(t,r,n){return!i(r)&&e?e(t,r,n):t},out:function(e,r,n){return!i(r)&&t?t(e,r,n):e}}},e.getStoredState=b,e.createPersistoid=h,e.purgeStoredState=g,e.KEY_PREFIX=u,e.FLUSH=s,e.REHYDRATE=c,e.PAUSE=a,e.PERSIST=f,e.PURGE=l,e.REGISTER=d,e.DEFAULT_VERSION=p,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=redux-persist.min.js.map

@@ -72,3 +72,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }

if (_persist) return state;
if (_persist) {
// We still need to call the base reducer because there might be nested
// uses of persistReducer which need to be aware of the PERSIST action
return _objectSpread({}, baseReducer(restState, action), {
_persist: _persist
});
}
if (typeof action.rehydrate !== 'function' || typeof action.register !== 'function') throw new Error('redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.');

@@ -75,0 +82,0 @@ action.register(config.key);

@@ -58,3 +58,3 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }

var _pStore = createStore(persistorReducer, initialState, options ? options.enhancer : undefined);
var _pStore = createStore(persistorReducer, initialState, options && options.enhancer ? options.enhancer : undefined);

@@ -121,4 +121,7 @@ var register = function register(key) {

persistor.persist();
if (!(options && options.manualPersist)) {
persistor.persist();
}
return persistor;
}

@@ -84,3 +84,10 @@ "use strict";

if (_persist) return state;
if (_persist) {
// We still need to call the base reducer because there might be nested
// uses of persistReducer which need to be aware of the PERSIST action
return _objectSpread({}, baseReducer(restState, action), {
_persist: _persist
});
}
if (typeof action.rehydrate !== 'function' || typeof action.register !== 'function') throw new Error('redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.');

@@ -87,0 +94,0 @@ action.register(config.key);

@@ -65,3 +65,3 @@ "use strict";

var _pStore = (0, _redux.createStore)(persistorReducer, initialState, options ? options.enhancer : undefined);
var _pStore = (0, _redux.createStore)(persistorReducer, initialState, options && options.enhancer ? options.enhancer : undefined);

@@ -128,4 +128,7 @@ var register = function register(key) {

persistor.persist();
if (!(options && options.manualPersist)) {
persistor.persist();
}
return persistor;
}
{
"name": "redux-persist",
"version": "6.0.0-pre2",
"version": "6.0.0-pre2.0",
"description": "persist and rehydrate redux stores",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -77,2 +77,3 @@ # Redux Persist

- **config** *object* (typically null)
- If you want to avoid that the persistence starts immediatly after calling `persistStore`, set the option manualPersist. Example: `{ manualPersist: true }` Persistence can than be started at any point with `peristor.persist()`. You usually want to do this, if your storage is not ready when the `persisStore` call is made.
- **callback** *function* will be called after rehydration is finished.

@@ -190,2 +191,3 @@ - returns **persistor** object

- [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

@@ -251,2 +253,3 @@ 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.

- **[@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)

@@ -253,0 +256,0 @@

@@ -109,3 +109,11 @@ // @flow

// @NOTE PERSIST can be called multiple times, noop after the first
if (_persist) return state
if (_persist) {
// We still need to call the base reducer because there might be nested
// uses of persistReducer which need to be aware of the PERSIST action
return {
...baseReducer(restState, action),
_persist,
};
}
if (

@@ -112,0 +120,0 @@ typeof action.rehydrate !== 'function' ||

@@ -68,3 +68,3 @@ // @flow

initialState,
options ? options.enhancer : undefined
options && options.enhancer ? options.enhancer : undefined
)

@@ -126,5 +126,7 @@ let register = (key: string) => {

persistor.persist()
if (!(options && options.manualPersist)){
persistor.persist()
}
return persistor
}

@@ -34,2 +34,3 @@ // @flow

enhancer?: Function,
manualPersist?: boolean
}

@@ -36,0 +37,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc