redux-astroglide 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/createSelectorHook/index.es.js +17 -0
- package/dist/createSelectorHook/index.js +22 -0
- package/dist/createSelectorHook/index.umd.js +779 -0
- package/dist/index.es.js +3 -0
- package/dist/index.js +3 -0
- package/dist/index.umd.js +3 -0
- package/dist/plugins/index.es.js +16 -11
- package/dist/plugins/index.js +16 -11
- package/dist/plugins/index.umd.js +16 -11
- package/dist/plugins/persist/index.es.js +16 -11
- package/dist/plugins/persist/index.js +16 -11
- package/dist/plugins/persist/index.umd.js +16 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Redux-Astroglide
|
|
2
2
|
|
|
3
|
-
#### Taking the pain out of state management by
|
|
3
|
+
#### Taking the pain out of state management by stuffing a huge package into a tiny API
|
|
4
4
|
|
|
5
5
|
Astroglide is a set of configuration and automation tools built on top of Redux Toolkit in order to provide the most succinct API with the least boilerplate possible. It's the easiest way to get up and running with redux state, and has the lowest mental overhead of any state management tool for React.
|
|
6
6
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createDraftSafeSelector } from '@reduxjs/toolkit';
|
|
2
|
+
import { useSelector, shallowEqual } from 'react-redux';
|
|
3
|
+
|
|
4
|
+
var makeSelectorHook = function makeSelectorHook(selector) {
|
|
5
|
+
return function () {
|
|
6
|
+
return useSelector(selector, shallowEqual);
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
var index = (function () {
|
|
10
|
+
// creates a redux selector and a react hook that produce identical results
|
|
11
|
+
var selector = createDraftSafeSelector.apply(void 0, arguments);
|
|
12
|
+
var hook = makeSelectorHook(selector);
|
|
13
|
+
hook.select = selector;
|
|
14
|
+
return hook;
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export { index as default, makeSelectorHook };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var toolkit = require('@reduxjs/toolkit');
|
|
6
|
+
var reactRedux = require('react-redux');
|
|
7
|
+
|
|
8
|
+
var makeSelectorHook = function makeSelectorHook(selector) {
|
|
9
|
+
return function () {
|
|
10
|
+
return reactRedux.useSelector(selector, reactRedux.shallowEqual);
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
var index = (function () {
|
|
14
|
+
// creates a redux selector and a react hook that produce identical results
|
|
15
|
+
var selector = toolkit.createDraftSafeSelector.apply(void 0, arguments);
|
|
16
|
+
var hook = makeSelectorHook(selector);
|
|
17
|
+
hook.select = selector;
|
|
18
|
+
return hook;
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
exports["default"] = index;
|
|
22
|
+
exports.makeSelectorHook = makeSelectorHook;
|
|
@@ -0,0 +1,779 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react-redux')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react-redux'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["redux-astroglide/createSelectorHook"] = {}, global.reactRedux));
|
|
5
|
+
})(this, (function (exports, reactRedux) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function n(n){for(var r=arguments.length,t=Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];if("production"!==process.env.NODE_ENV){var i=Y[n],o=i?"function"==typeof i?i.apply(null,t):i:"unknown error nr: "+n;throw Error("[Immer] "+o)}throw Error("[Immer] minified error nr: "+n+(t.length?" "+t.map((function(n){return "'"+n+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function r(n){return !!n&&!!n[Q]}function t(n){var r;return !!n&&(function(n){if(!n||"object"!=typeof n)return !1;var r=Object.getPrototypeOf(n);if(null===r)return !0;var t=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return t===Object||"function"==typeof t&&Function.toString.call(t)===Z}(n)||Array.isArray(n)||!!n[L]||!!(null===(r=n.constructor)||void 0===r?void 0:r[L])||s(n)||v(n))}function i(n,r,t){void 0===t&&(t=!1),0===o(n)?(t?Object.keys:nn)(n).forEach((function(e){t&&"symbol"==typeof e||r(e,n[e],n);})):n.forEach((function(t,e){return r(e,t,n)}));}function o(n){var r=n[Q];return r?r.i>3?r.i-4:r.i:Array.isArray(n)?1:s(n)?2:v(n)?3:0}function u(n,r){return 2===o(n)?n.has(r):Object.prototype.hasOwnProperty.call(n,r)}function a(n,r){return 2===o(n)?n.get(r):n[r]}function f(n,r,t){var e=o(n);2===e?n.set(r,t):3===e?n.add(t):n[r]=t;}function c(n,r){return n===r?0!==n||1/n==1/r:n!=n&&r!=r}function s(n){return X&&n instanceof Map}function v(n){return q&&n instanceof Set}function p(n){return n.o||n.t}function l(n){if(Array.isArray(n))return Array.prototype.slice.call(n);var r=rn(n);delete r[Q];for(var t=nn(r),e=0;e<t.length;e++){var i=t[e],o=r[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:n[i]});}return Object.create(Object.getPrototypeOf(n),r)}function d(n,e){return void 0===e&&(e=!1),y(n)||r(n)||!t(n)||(o(n)>1&&(n.set=n.add=n.clear=n.delete=h),Object.freeze(n),e&&i(n,(function(n,r){return d(r,!0)}),!0)),n}function h(){n(2);}function y(n){return null==n||"object"!=typeof n||Object.isFrozen(n)}function b(r){var t=tn[r];return t||n(18,r),t}function m(n,r){tn[n]||(tn[n]=r);}function _(){return "production"===process.env.NODE_ENV||U||n(0),U}function j(n,r){r&&(b("Patches"),n.u=[],n.s=[],n.v=r);}function g(n){O(n),n.p.forEach(S),n.p=null;}function O(n){n===U&&(U=n.l);}function w(n){return U={p:[],l:U,h:n,m:!0,_:0}}function S(n){var r=n[Q];0===r.i||1===r.i?r.j():r.g=!0;}function P(r,e){e._=e.p.length;var i=e.p[0],o=void 0!==r&&r!==i;return e.h.O||b("ES5").S(e,r,o),o?(i[Q].P&&(g(e),n(4)),t(r)&&(r=M(e,r),e.l||x(e,r)),e.u&&b("Patches").M(i[Q].t,r,e.u,e.s)):r=M(e,i,[]),g(e),e.u&&e.v(e.u,e.s),r!==H?r:void 0}function M(n,r,t){if(y(r))return r;var e=r[Q];if(!e)return i(r,(function(i,o){return A(n,e,r,i,o,t)}),!0),r;if(e.A!==n)return r;if(!e.P)return x(n,e.t,!0),e.t;if(!e.I){e.I=!0,e.A._--;var o=4===e.i||5===e.i?e.o=l(e.k):e.o,u=o,a=!1;3===e.i&&(u=new Set(o),o.clear(),a=!0),i(u,(function(r,i){return A(n,e,o,r,i,t,a)})),x(n,o,!1),t&&n.u&&b("Patches").N(e,t,n.u,n.s);}return e.o}function A(e,i,o,a,c,s,v){if("production"!==process.env.NODE_ENV&&c===o&&n(5),r(c)){var p=M(e,c,s&&i&&3!==i.i&&!u(i.R,a)?s.concat(a):void 0);if(f(o,a,p),!r(p))return;e.m=!1;}else v&&o.add(c);if(t(c)&&!y(c)){if(!e.h.D&&e._<1)return;M(e,c),i&&i.A.l||x(e,c);}}function x(n,r,t){void 0===t&&(t=!1),!n.l&&n.h.D&&n.m&&d(r,t);}function z(n,r){var t=n[Q];return (t?p(t):n)[r]}function I(n,r){if(r in n)for(var t=Object.getPrototypeOf(n);t;){var e=Object.getOwnPropertyDescriptor(t,r);if(e)return e;t=Object.getPrototypeOf(t);}}function k(n){n.P||(n.P=!0,n.l&&k(n.l));}function E(n){n.o||(n.o=l(n.t));}function N(n,r,t){var e=s(r)?b("MapSet").F(r,t):v(r)?b("MapSet").T(r,t):n.O?function(n,r){var t=Array.isArray(n),e={i:t?1:0,A:r?r.A:_(),P:!1,I:!1,R:{},l:r,t:n,k:null,o:null,j:null,C:!1},i=e,o=en;t&&(i=[e],o=on);var u=Proxy.revocable(i,o),a=u.revoke,f=u.proxy;return e.k=f,e.j=a,f}(r,t):b("ES5").J(r,t);return (t?t.A:_()).p.push(e),e}function R(e){return r(e)||n(22,e),function n(r){if(!t(r))return r;var e,u=r[Q],c=o(r);if(u){if(!u.P&&(u.i<4||!b("ES5").K(u)))return u.t;u.I=!0,e=D(r,c),u.I=!1;}else e=D(r,c);return i(e,(function(r,t){u&&a(u.t,r)===t||f(e,r,n(t));})),3===c?new Set(e):e}(e)}function D(n,r){switch(r){case 2:return new Map(n);case 3:return Array.from(n)}return l(n)}function F(){function t(n,r){var t=s[n];return t?t.enumerable=r:s[n]=t={configurable:!0,enumerable:r,get:function(){var r=this[Q];return "production"!==process.env.NODE_ENV&&f(r),en.get(r,n)},set:function(r){var t=this[Q];"production"!==process.env.NODE_ENV&&f(t),en.set(t,n,r);}},t}function e(n){for(var r=n.length-1;r>=0;r--){var t=n[r][Q];if(!t.P)switch(t.i){case 5:a(t)&&k(t);break;case 4:o(t)&&k(t);}}}function o(n){for(var r=n.t,t=n.k,e=nn(t),i=e.length-1;i>=0;i--){var o=e[i];if(o!==Q){var a=r[o];if(void 0===a&&!u(r,o))return !0;var f=t[o],s=f&&f[Q];if(s?s.t!==a:!c(f,a))return !0}}var v=!!r[Q];return e.length!==nn(r).length+(v?0:1)}function a(n){var r=n.k;if(r.length!==n.t.length)return !0;var t=Object.getOwnPropertyDescriptor(r,r.length-1);if(t&&!t.get)return !0;for(var e=0;e<r.length;e++)if(!r.hasOwnProperty(e))return !0;return !1}function f(r){r.g&&n(3,JSON.stringify(p(r)));}var s={};m("ES5",{J:function(n,r){var e=Array.isArray(n),i=function(n,r){if(n){for(var e=Array(r.length),i=0;i<r.length;i++)Object.defineProperty(e,""+i,t(i,!0));return e}var o=rn(r);delete o[Q];for(var u=nn(o),a=0;a<u.length;a++){var f=u[a];o[f]=t(f,n||!!o[f].enumerable);}return Object.create(Object.getPrototypeOf(r),o)}(e,n),o={i:e?5:4,A:r?r.A:_(),P:!1,I:!1,R:{},l:r,t:n,k:i,o:null,g:!1,C:!1};return Object.defineProperty(i,Q,{value:o,writable:!0}),i},S:function(n,t,o){o?r(t)&&t[Q].A===n&&e(n.p):(n.u&&function n(r){if(r&&"object"==typeof r){var t=r[Q];if(t){var e=t.t,o=t.k,f=t.R,c=t.i;if(4===c)i(o,(function(r){r!==Q&&(void 0!==e[r]||u(e,r)?f[r]||n(o[r]):(f[r]=!0,k(t)));})),i(e,(function(n){void 0!==o[n]||u(o,n)||(f[n]=!1,k(t));}));else if(5===c){if(a(t)&&(k(t),f.length=!0),o.length<e.length)for(var s=o.length;s<e.length;s++)f[s]=!1;else for(var v=e.length;v<o.length;v++)f[v]=!0;for(var p=Math.min(o.length,e.length),l=0;l<p;l++)o.hasOwnProperty(l)||(f[l]=!0),void 0===f[l]&&n(o[l]);}}}}(n.p[0]),e(n.p));},K:function(n){return 4===n.i?o(n):a(n)}});}var G,U,W="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),X="undefined"!=typeof Map,q="undefined"!=typeof Set,B="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,H=W?Symbol.for("immer-nothing"):((G={})["immer-nothing"]=!0,G),L=W?Symbol.for("immer-draftable"):"__$immer_draftable",Q=W?Symbol.for("immer-state"):"__$immer_state",Y={0:"Illegal state",1:"Immer drafts cannot have computed properties",2:"This object has been frozen and should not be mutated",3:function(n){return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+n},4:"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",5:"Immer forbids circular references",6:"The first or second argument to `produce` must be a function",7:"The third argument to `produce` must be a function or undefined",8:"First argument to `createDraft` must be a plain object, an array, or an immerable object",9:"First argument to `finishDraft` must be a draft returned by `createDraft`",10:"The given draft is already finalized",11:"Object.defineProperty() cannot be used on an Immer draft",12:"Object.setPrototypeOf() cannot be used on an Immer draft",13:"Immer only supports deleting array indices",14:"Immer only supports setting array indices and the 'length' property",15:function(n){return "Cannot apply patch, path doesn't resolve: "+n},16:'Sets cannot have "replace" patches.',17:function(n){return "Unsupported patch operation: "+n},18:function(n){return "The plugin for '"+n+"' has not been loaded into Immer. To enable the plugin, import and call `enable"+n+"()` when initializing your application."},20:"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",21:function(n){return "produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '"+n+"'"},22:function(n){return "'current' expects a draft, got: "+n},23:function(n){return "'original' expects a draft, got: "+n},24:"Patching reserved attributes like __proto__, prototype and constructor is not allowed"},Z=""+Object.prototype.constructor,nn="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:Object.getOwnPropertyNames,rn=Object.getOwnPropertyDescriptors||function(n){var r={};return nn(n).forEach((function(t){r[t]=Object.getOwnPropertyDescriptor(n,t);})),r},tn={},en={get:function(n,r){if(r===Q)return n;var e=p(n);if(!u(e,r))return function(n,r,t){var e,i=I(r,t);return i?"value"in i?i.value:null===(e=i.get)||void 0===e?void 0:e.call(n.k):void 0}(n,e,r);var i=e[r];return n.I||!t(i)?i:i===z(n.t,r)?(E(n),n.o[r]=N(n.A.h,i,n)):i},has:function(n,r){return r in p(n)},ownKeys:function(n){return Reflect.ownKeys(p(n))},set:function(n,r,t){var e=I(p(n),r);if(null==e?void 0:e.set)return e.set.call(n.k,t),!0;if(!n.P){var i=z(p(n),r),o=null==i?void 0:i[Q];if(o&&o.t===t)return n.o[r]=t,n.R[r]=!1,!0;if(c(t,i)&&(void 0!==t||u(n.t,r)))return !0;E(n),k(n);}return n.o[r]===t&&(void 0!==t||r in n.o)||Number.isNaN(t)&&Number.isNaN(n.o[r])||(n.o[r]=t,n.R[r]=!0),!0},deleteProperty:function(n,r){return void 0!==z(n.t,r)||r in n.t?(n.R[r]=!1,E(n),k(n)):delete n.R[r],n.o&&delete n.o[r],!0},getOwnPropertyDescriptor:function(n,r){var t=p(n),e=Reflect.getOwnPropertyDescriptor(t,r);return e?{writable:!0,configurable:1!==n.i||"length"!==r,enumerable:e.enumerable,value:t[r]}:e},defineProperty:function(){n(11);},getPrototypeOf:function(n){return Object.getPrototypeOf(n.t)},setPrototypeOf:function(){n(12);}},on={};i(en,(function(n,r){on[n]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)};})),on.deleteProperty=function(r,t){return "production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&n(13),on.set.call(this,r,t,void 0)},on.set=function(r,t,e){return "production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&n(14),en.set.call(this,r[0],t,e,r[0])};var un=function(){function e(r){var e=this;this.O=B,this.D=!0,this.produce=function(r,i,o){if("function"==typeof r&&"function"!=typeof i){var u=i;i=r;var a=e;return function(n){var r=this;void 0===n&&(n=u);for(var t=arguments.length,e=Array(t>1?t-1:0),o=1;o<t;o++)e[o-1]=arguments[o];return a.produce(n,(function(n){var t;return (t=i).call.apply(t,[r,n].concat(e))}))}}var f;if("function"!=typeof i&&n(6),void 0!==o&&"function"!=typeof o&&n(7),t(r)){var c=w(e),s=N(e,r,void 0),v=!0;try{f=i(s),v=!1;}finally{v?g(c):O(c);}return "undefined"!=typeof Promise&&f instanceof Promise?f.then((function(n){return j(c,o),P(n,c)}),(function(n){throw g(c),n})):(j(c,o),P(f,c))}if(!r||"object"!=typeof r){if(void 0===(f=i(r))&&(f=r),f===H&&(f=void 0),e.D&&d(f,!0),o){var p=[],l=[];b("Patches").M(r,f,p,l),o(p,l);}return f}n(21,r);},this.produceWithPatches=function(n,r){if("function"==typeof n)return function(r){for(var t=arguments.length,i=Array(t>1?t-1:0),o=1;o<t;o++)i[o-1]=arguments[o];return e.produceWithPatches(r,(function(r){return n.apply(void 0,[r].concat(i))}))};var t,i,o=e.produce(n,r,(function(n,r){t=n,i=r;}));return "undefined"!=typeof Promise&&o instanceof Promise?o.then((function(n){return [n,t,i]})):[o,t,i]},"boolean"==typeof(null==r?void 0:r.useProxies)&&this.setUseProxies(r.useProxies),"boolean"==typeof(null==r?void 0:r.autoFreeze)&&this.setAutoFreeze(r.autoFreeze);}var i=e.prototype;return i.createDraft=function(e){t(e)||n(8),r(e)&&(e=R(e));var i=w(this),o=N(this,e,void 0);return o[Q].C=!0,O(i),o},i.finishDraft=function(r,t){var e=r&&r[Q];"production"!==process.env.NODE_ENV&&(e&&e.C||n(9),e.I&&n(10));var i=e.A;return j(i,t),P(void 0,i)},i.setAutoFreeze=function(n){this.D=n;},i.setUseProxies=function(r){r&&!B&&n(20),this.O=r;},i.applyPatches=function(n,t){var e;for(e=t.length-1;e>=0;e--){var i=t[e];if(0===i.path.length&&"replace"===i.op){n=i.value;break}}e>-1&&(t=t.slice(e+1));var o=b("Patches").$;return r(n)?o(n,t):this.produce(n,(function(n){return o(n,t)}))},e}(),an=new un;an.produce;an.produceWithPatches.bind(an);an.setAutoFreeze.bind(an);an.setUseProxies.bind(an);an.applyPatches.bind(an);an.createDraft.bind(an);an.finishDraft.bind(an);
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* These are private action types reserved by Redux.
|
|
11
|
+
* For any unknown actions, you must return the current state.
|
|
12
|
+
* If the current state is undefined, you must return the initial state.
|
|
13
|
+
* Do not reference these action types directly in your code.
|
|
14
|
+
*/
|
|
15
|
+
var randomString = function randomString() {
|
|
16
|
+
return Math.random().toString(36).substring(7).split('').join('.');
|
|
17
|
+
};
|
|
18
|
+
({
|
|
19
|
+
INIT: "@@redux/INIT" + randomString(),
|
|
20
|
+
REPLACE: "@@redux/REPLACE" + randomString(),
|
|
21
|
+
PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
|
|
22
|
+
return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// Cache implementation based on Erik Rasmussen's `lru-memoize`:
|
|
27
|
+
// https://github.com/erikras/lru-memoize
|
|
28
|
+
var NOT_FOUND = 'NOT_FOUND';
|
|
29
|
+
function createSingletonCache(equals) {
|
|
30
|
+
var entry;
|
|
31
|
+
return {
|
|
32
|
+
get: function get(key) {
|
|
33
|
+
if (entry && equals(entry.key, key)) {
|
|
34
|
+
return entry.value;
|
|
35
|
+
}
|
|
36
|
+
return NOT_FOUND;
|
|
37
|
+
},
|
|
38
|
+
put: function put(key, value) {
|
|
39
|
+
entry = {
|
|
40
|
+
key: key,
|
|
41
|
+
value: value
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
getEntries: function getEntries() {
|
|
45
|
+
return entry ? [entry] : [];
|
|
46
|
+
},
|
|
47
|
+
clear: function clear() {
|
|
48
|
+
entry = undefined;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function createLruCache(maxSize, equals) {
|
|
53
|
+
var entries = [];
|
|
54
|
+
function get(key) {
|
|
55
|
+
var cacheIndex = entries.findIndex(function (entry) {
|
|
56
|
+
return equals(key, entry.key);
|
|
57
|
+
}); // We found a cached entry
|
|
58
|
+
|
|
59
|
+
if (cacheIndex > -1) {
|
|
60
|
+
var entry = entries[cacheIndex]; // Cached entry not at top of cache, move it to the top
|
|
61
|
+
|
|
62
|
+
if (cacheIndex > 0) {
|
|
63
|
+
entries.splice(cacheIndex, 1);
|
|
64
|
+
entries.unshift(entry);
|
|
65
|
+
}
|
|
66
|
+
return entry.value;
|
|
67
|
+
} // No entry found in cache, return sentinel
|
|
68
|
+
|
|
69
|
+
return NOT_FOUND;
|
|
70
|
+
}
|
|
71
|
+
function put(key, value) {
|
|
72
|
+
if (get(key) === NOT_FOUND) {
|
|
73
|
+
// TODO Is unshift slow?
|
|
74
|
+
entries.unshift({
|
|
75
|
+
key: key,
|
|
76
|
+
value: value
|
|
77
|
+
});
|
|
78
|
+
if (entries.length > maxSize) {
|
|
79
|
+
entries.pop();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function getEntries() {
|
|
84
|
+
return entries;
|
|
85
|
+
}
|
|
86
|
+
function clear() {
|
|
87
|
+
entries = [];
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
get: get,
|
|
91
|
+
put: put,
|
|
92
|
+
getEntries: getEntries,
|
|
93
|
+
clear: clear
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
var defaultEqualityCheck = function defaultEqualityCheck(a, b) {
|
|
97
|
+
return a === b;
|
|
98
|
+
};
|
|
99
|
+
function createCacheKeyComparator(equalityCheck) {
|
|
100
|
+
return function areArgumentsShallowlyEqual(prev, next) {
|
|
101
|
+
if (prev === null || next === null || prev.length !== next.length) {
|
|
102
|
+
return false;
|
|
103
|
+
} // Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible.
|
|
104
|
+
|
|
105
|
+
var length = prev.length;
|
|
106
|
+
for (var i = 0; i < length; i++) {
|
|
107
|
+
if (!equalityCheck(prev[i], next[i])) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return true;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
// defaultMemoize now supports a configurable cache size with LRU behavior,
|
|
115
|
+
// and optional comparison of the result value with existing values
|
|
116
|
+
function defaultMemoize(func, equalityCheckOrOptions) {
|
|
117
|
+
var providedOptions = typeof equalityCheckOrOptions === 'object' ? equalityCheckOrOptions : {
|
|
118
|
+
equalityCheck: equalityCheckOrOptions
|
|
119
|
+
};
|
|
120
|
+
var _providedOptions$equa = providedOptions.equalityCheck,
|
|
121
|
+
equalityCheck = _providedOptions$equa === void 0 ? defaultEqualityCheck : _providedOptions$equa,
|
|
122
|
+
_providedOptions$maxS = providedOptions.maxSize,
|
|
123
|
+
maxSize = _providedOptions$maxS === void 0 ? 1 : _providedOptions$maxS,
|
|
124
|
+
resultEqualityCheck = providedOptions.resultEqualityCheck;
|
|
125
|
+
var comparator = createCacheKeyComparator(equalityCheck);
|
|
126
|
+
var cache = maxSize === 1 ? createSingletonCache(comparator) : createLruCache(maxSize, comparator); // we reference arguments instead of spreading them for performance reasons
|
|
127
|
+
|
|
128
|
+
function memoized() {
|
|
129
|
+
var value = cache.get(arguments);
|
|
130
|
+
if (value === NOT_FOUND) {
|
|
131
|
+
// @ts-ignore
|
|
132
|
+
value = func.apply(null, arguments);
|
|
133
|
+
if (resultEqualityCheck) {
|
|
134
|
+
var entries = cache.getEntries();
|
|
135
|
+
var matchingEntry = entries.find(function (entry) {
|
|
136
|
+
return resultEqualityCheck(entry.value, value);
|
|
137
|
+
});
|
|
138
|
+
if (matchingEntry) {
|
|
139
|
+
value = matchingEntry.value;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
cache.put(arguments, value);
|
|
143
|
+
}
|
|
144
|
+
return value;
|
|
145
|
+
}
|
|
146
|
+
memoized.clearCache = function () {
|
|
147
|
+
return cache.clear();
|
|
148
|
+
};
|
|
149
|
+
return memoized;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function getDependencies(funcs) {
|
|
153
|
+
var dependencies = Array.isArray(funcs[0]) ? funcs[0] : funcs;
|
|
154
|
+
if (!dependencies.every(function (dep) {
|
|
155
|
+
return typeof dep === 'function';
|
|
156
|
+
})) {
|
|
157
|
+
var dependencyTypes = dependencies.map(function (dep) {
|
|
158
|
+
return typeof dep === 'function' ? "function " + (dep.name || 'unnamed') + "()" : typeof dep;
|
|
159
|
+
}).join(', ');
|
|
160
|
+
throw new Error("createSelector expects all input-selectors to be functions, but received the following types: [" + dependencyTypes + "]");
|
|
161
|
+
}
|
|
162
|
+
return dependencies;
|
|
163
|
+
}
|
|
164
|
+
function createSelectorCreator(memoize) {
|
|
165
|
+
for (var _len = arguments.length, memoizeOptionsFromArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
166
|
+
memoizeOptionsFromArgs[_key - 1] = arguments[_key];
|
|
167
|
+
}
|
|
168
|
+
var createSelector = function createSelector() {
|
|
169
|
+
for (var _len2 = arguments.length, funcs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
170
|
+
funcs[_key2] = arguments[_key2];
|
|
171
|
+
}
|
|
172
|
+
var _recomputations = 0;
|
|
173
|
+
var _lastResult; // Due to the intricacies of rest params, we can't do an optional arg after `...funcs`.
|
|
174
|
+
// So, start by declaring the default value here.
|
|
175
|
+
// (And yes, the words 'memoize' and 'options' appear too many times in this next sequence.)
|
|
176
|
+
|
|
177
|
+
var directlyPassedOptions = {
|
|
178
|
+
memoizeOptions: undefined
|
|
179
|
+
}; // Normally, the result func or "output selector" is the last arg
|
|
180
|
+
|
|
181
|
+
var resultFunc = funcs.pop(); // If the result func is actually an _object_, assume it's our options object
|
|
182
|
+
|
|
183
|
+
if (typeof resultFunc === 'object') {
|
|
184
|
+
directlyPassedOptions = resultFunc; // and pop the real result func off
|
|
185
|
+
|
|
186
|
+
resultFunc = funcs.pop();
|
|
187
|
+
}
|
|
188
|
+
if (typeof resultFunc !== 'function') {
|
|
189
|
+
throw new Error("createSelector expects an output function after the inputs, but received: [" + typeof resultFunc + "]");
|
|
190
|
+
} // Determine which set of options we're using. Prefer options passed directly,
|
|
191
|
+
// but fall back to options given to createSelectorCreator.
|
|
192
|
+
|
|
193
|
+
var _directlyPassedOption = directlyPassedOptions,
|
|
194
|
+
_directlyPassedOption2 = _directlyPassedOption.memoizeOptions,
|
|
195
|
+
memoizeOptions = _directlyPassedOption2 === void 0 ? memoizeOptionsFromArgs : _directlyPassedOption2; // Simplifying assumption: it's unlikely that the first options arg of the provided memoizer
|
|
196
|
+
// is an array. In most libs I've looked at, it's an equality function or options object.
|
|
197
|
+
// Based on that, if `memoizeOptions` _is_ an array, we assume it's a full
|
|
198
|
+
// user-provided array of options. Otherwise, it must be just the _first_ arg, and so
|
|
199
|
+
// we wrap it in an array so we can apply it.
|
|
200
|
+
|
|
201
|
+
var finalMemoizeOptions = Array.isArray(memoizeOptions) ? memoizeOptions : [memoizeOptions];
|
|
202
|
+
var dependencies = getDependencies(funcs);
|
|
203
|
+
var memoizedResultFunc = memoize.apply(void 0, [function recomputationWrapper() {
|
|
204
|
+
_recomputations++; // apply arguments instead of spreading for performance.
|
|
205
|
+
|
|
206
|
+
return resultFunc.apply(null, arguments);
|
|
207
|
+
}].concat(finalMemoizeOptions)); // If a selector is called with the exact same arguments we don't need to traverse our dependencies again.
|
|
208
|
+
|
|
209
|
+
var selector = memoize(function dependenciesChecker() {
|
|
210
|
+
var params = [];
|
|
211
|
+
var length = dependencies.length;
|
|
212
|
+
for (var i = 0; i < length; i++) {
|
|
213
|
+
// apply arguments instead of spreading and mutate a local list of params for performance.
|
|
214
|
+
// @ts-ignore
|
|
215
|
+
params.push(dependencies[i].apply(null, arguments));
|
|
216
|
+
} // apply arguments instead of spreading for performance.
|
|
217
|
+
|
|
218
|
+
_lastResult = memoizedResultFunc.apply(null, params);
|
|
219
|
+
return _lastResult;
|
|
220
|
+
});
|
|
221
|
+
Object.assign(selector, {
|
|
222
|
+
resultFunc: resultFunc,
|
|
223
|
+
memoizedResultFunc: memoizedResultFunc,
|
|
224
|
+
dependencies: dependencies,
|
|
225
|
+
lastResult: function lastResult() {
|
|
226
|
+
return _lastResult;
|
|
227
|
+
},
|
|
228
|
+
recomputations: function recomputations() {
|
|
229
|
+
return _recomputations;
|
|
230
|
+
},
|
|
231
|
+
resetRecomputations: function resetRecomputations() {
|
|
232
|
+
return _recomputations = 0;
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
return selector;
|
|
236
|
+
}; // @ts-ignore
|
|
237
|
+
|
|
238
|
+
return createSelector;
|
|
239
|
+
}
|
|
240
|
+
var createSelector = /* #__PURE__ */createSelectorCreator(defaultMemoize);
|
|
241
|
+
|
|
242
|
+
/** A function that accepts a potential "extra argument" value to be injected later,
|
|
243
|
+
* and returns an instance of the thunk middleware that uses that value
|
|
244
|
+
*/
|
|
245
|
+
function createThunkMiddleware(extraArgument) {
|
|
246
|
+
// Standard Redux middleware definition pattern:
|
|
247
|
+
// See: https://redux.js.org/tutorials/fundamentals/part-4-store#writing-custom-middleware
|
|
248
|
+
var middleware = function middleware(_ref) {
|
|
249
|
+
var dispatch = _ref.dispatch,
|
|
250
|
+
getState = _ref.getState;
|
|
251
|
+
return function (next) {
|
|
252
|
+
return function (action) {
|
|
253
|
+
// The thunk middleware looks for any functions that were passed to `store.dispatch`.
|
|
254
|
+
// If this "action" is really a function, call it and return the result.
|
|
255
|
+
if (typeof action === 'function') {
|
|
256
|
+
// Inject the store's `dispatch` and `getState` methods, as well as any "extra arg"
|
|
257
|
+
return action(dispatch, getState, extraArgument);
|
|
258
|
+
} // Otherwise, pass the action down the middleware chain as usual
|
|
259
|
+
|
|
260
|
+
return next(action);
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
return middleware;
|
|
265
|
+
}
|
|
266
|
+
var thunk = createThunkMiddleware(); // Attach the factory function so users can create a customized version
|
|
267
|
+
// with whatever "extra arg" they want to inject into their thunks
|
|
268
|
+
|
|
269
|
+
thunk.withExtraArgument = createThunkMiddleware;
|
|
270
|
+
|
|
271
|
+
var __extends = undefined && undefined.__extends || function () {
|
|
272
|
+
var extendStatics = function (d, b) {
|
|
273
|
+
extendStatics = Object.setPrototypeOf || {
|
|
274
|
+
__proto__: []
|
|
275
|
+
} instanceof Array && function (d, b) {
|
|
276
|
+
d.__proto__ = b;
|
|
277
|
+
} || function (d, b) {
|
|
278
|
+
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
|
279
|
+
};
|
|
280
|
+
return extendStatics(d, b);
|
|
281
|
+
};
|
|
282
|
+
return function (d, b) {
|
|
283
|
+
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
284
|
+
extendStatics(d, b);
|
|
285
|
+
function __() {
|
|
286
|
+
this.constructor = d;
|
|
287
|
+
}
|
|
288
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
289
|
+
};
|
|
290
|
+
}();
|
|
291
|
+
var __generator = undefined && undefined.__generator || function (thisArg, body) {
|
|
292
|
+
var _ = {
|
|
293
|
+
label: 0,
|
|
294
|
+
sent: function () {
|
|
295
|
+
if (t[0] & 1) throw t[1];
|
|
296
|
+
return t[1];
|
|
297
|
+
},
|
|
298
|
+
trys: [],
|
|
299
|
+
ops: []
|
|
300
|
+
},
|
|
301
|
+
f,
|
|
302
|
+
y,
|
|
303
|
+
t,
|
|
304
|
+
g;
|
|
305
|
+
return g = {
|
|
306
|
+
next: verb(0),
|
|
307
|
+
"throw": verb(1),
|
|
308
|
+
"return": verb(2)
|
|
309
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
310
|
+
return this;
|
|
311
|
+
}), g;
|
|
312
|
+
function verb(n) {
|
|
313
|
+
return function (v) {
|
|
314
|
+
return step([n, v]);
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
function step(op) {
|
|
318
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
319
|
+
while (_) try {
|
|
320
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
321
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
322
|
+
switch (op[0]) {
|
|
323
|
+
case 0:
|
|
324
|
+
case 1:
|
|
325
|
+
t = op;
|
|
326
|
+
break;
|
|
327
|
+
case 4:
|
|
328
|
+
_.label++;
|
|
329
|
+
return {
|
|
330
|
+
value: op[1],
|
|
331
|
+
done: false
|
|
332
|
+
};
|
|
333
|
+
case 5:
|
|
334
|
+
_.label++;
|
|
335
|
+
y = op[1];
|
|
336
|
+
op = [0];
|
|
337
|
+
continue;
|
|
338
|
+
case 7:
|
|
339
|
+
op = _.ops.pop();
|
|
340
|
+
_.trys.pop();
|
|
341
|
+
continue;
|
|
342
|
+
default:
|
|
343
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
344
|
+
_ = 0;
|
|
345
|
+
continue;
|
|
346
|
+
}
|
|
347
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
348
|
+
_.label = op[1];
|
|
349
|
+
break;
|
|
350
|
+
}
|
|
351
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
352
|
+
_.label = t[1];
|
|
353
|
+
t = op;
|
|
354
|
+
break;
|
|
355
|
+
}
|
|
356
|
+
if (t && _.label < t[2]) {
|
|
357
|
+
_.label = t[2];
|
|
358
|
+
_.ops.push(op);
|
|
359
|
+
break;
|
|
360
|
+
}
|
|
361
|
+
if (t[2]) _.ops.pop();
|
|
362
|
+
_.trys.pop();
|
|
363
|
+
continue;
|
|
364
|
+
}
|
|
365
|
+
op = body.call(thisArg, _);
|
|
366
|
+
} catch (e) {
|
|
367
|
+
op = [6, e];
|
|
368
|
+
y = 0;
|
|
369
|
+
} finally {
|
|
370
|
+
f = t = 0;
|
|
371
|
+
}
|
|
372
|
+
if (op[0] & 5) throw op[1];
|
|
373
|
+
return {
|
|
374
|
+
value: op[0] ? op[1] : void 0,
|
|
375
|
+
done: true
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
var __spreadArray = undefined && undefined.__spreadArray || function (to, from) {
|
|
380
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) to[j] = from[i];
|
|
381
|
+
return to;
|
|
382
|
+
};
|
|
383
|
+
var __defProp = Object.defineProperty;
|
|
384
|
+
var __defProps = Object.defineProperties;
|
|
385
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
386
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
387
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
388
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
389
|
+
var __defNormalProp = function (obj, key, value) {
|
|
390
|
+
return key in obj ? __defProp(obj, key, {
|
|
391
|
+
enumerable: true,
|
|
392
|
+
configurable: true,
|
|
393
|
+
writable: true,
|
|
394
|
+
value: value
|
|
395
|
+
}) : obj[key] = value;
|
|
396
|
+
};
|
|
397
|
+
var __spreadValues = function (a, b) {
|
|
398
|
+
for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
399
|
+
if (__getOwnPropSymbols) for (var _i = 0, _c = __getOwnPropSymbols(b); _i < _c.length; _i++) {
|
|
400
|
+
var prop = _c[_i];
|
|
401
|
+
if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
402
|
+
}
|
|
403
|
+
return a;
|
|
404
|
+
};
|
|
405
|
+
var __spreadProps = function (a, b) {
|
|
406
|
+
return __defProps(a, __getOwnPropDescs(b));
|
|
407
|
+
};
|
|
408
|
+
var __async = function (__this, __arguments, generator) {
|
|
409
|
+
return new Promise(function (resolve, reject) {
|
|
410
|
+
var fulfilled = function (value) {
|
|
411
|
+
try {
|
|
412
|
+
step(generator.next(value));
|
|
413
|
+
} catch (e) {
|
|
414
|
+
reject(e);
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
var rejected = function (value) {
|
|
418
|
+
try {
|
|
419
|
+
step(generator.throw(value));
|
|
420
|
+
} catch (e) {
|
|
421
|
+
reject(e);
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
var step = function (x) {
|
|
425
|
+
return x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
426
|
+
};
|
|
427
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
428
|
+
});
|
|
429
|
+
};
|
|
430
|
+
var createDraftSafeSelector = function () {
|
|
431
|
+
var args = [];
|
|
432
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
433
|
+
args[_i] = arguments[_i];
|
|
434
|
+
}
|
|
435
|
+
var selector = createSelector.apply(void 0, args);
|
|
436
|
+
var wrappedSelector = function (value) {
|
|
437
|
+
var rest = [];
|
|
438
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
439
|
+
rest[_i - 1] = arguments[_i];
|
|
440
|
+
}
|
|
441
|
+
return selector.apply(void 0, __spreadArray([r(value) ? R(value) : value], rest));
|
|
442
|
+
};
|
|
443
|
+
return wrappedSelector;
|
|
444
|
+
};
|
|
445
|
+
/** @class */(function (_super) {
|
|
446
|
+
__extends(MiddlewareArray, _super);
|
|
447
|
+
function MiddlewareArray() {
|
|
448
|
+
var args = [];
|
|
449
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
450
|
+
args[_i] = arguments[_i];
|
|
451
|
+
}
|
|
452
|
+
var _this = _super.apply(this, args) || this;
|
|
453
|
+
Object.setPrototypeOf(_this, MiddlewareArray.prototype);
|
|
454
|
+
return _this;
|
|
455
|
+
}
|
|
456
|
+
Object.defineProperty(MiddlewareArray, Symbol.species, {
|
|
457
|
+
get: function () {
|
|
458
|
+
return MiddlewareArray;
|
|
459
|
+
},
|
|
460
|
+
enumerable: false,
|
|
461
|
+
configurable: true
|
|
462
|
+
});
|
|
463
|
+
MiddlewareArray.prototype.concat = function () {
|
|
464
|
+
var arr = [];
|
|
465
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
466
|
+
arr[_i] = arguments[_i];
|
|
467
|
+
}
|
|
468
|
+
return _super.prototype.concat.apply(this, arr);
|
|
469
|
+
};
|
|
470
|
+
MiddlewareArray.prototype.prepend = function () {
|
|
471
|
+
var arr = [];
|
|
472
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
473
|
+
arr[_i] = arguments[_i];
|
|
474
|
+
}
|
|
475
|
+
if (arr.length === 1 && Array.isArray(arr[0])) {
|
|
476
|
+
return new (MiddlewareArray.bind.apply(MiddlewareArray, __spreadArray([void 0], arr[0].concat(this))))();
|
|
477
|
+
}
|
|
478
|
+
return new (MiddlewareArray.bind.apply(MiddlewareArray, __spreadArray([void 0], arr.concat(this))))();
|
|
479
|
+
};
|
|
480
|
+
return MiddlewareArray;
|
|
481
|
+
})(Array);
|
|
482
|
+
// src/immutableStateInvariantMiddleware.ts
|
|
483
|
+
process.env.NODE_ENV === "production";
|
|
484
|
+
// src/configureStore.ts
|
|
485
|
+
process.env.NODE_ENV === "production";
|
|
486
|
+
// src/createAction.ts
|
|
487
|
+
function createAction(type, prepareAction) {
|
|
488
|
+
function actionCreator() {
|
|
489
|
+
var args = [];
|
|
490
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
491
|
+
args[_i] = arguments[_i];
|
|
492
|
+
}
|
|
493
|
+
if (prepareAction) {
|
|
494
|
+
var prepared = prepareAction.apply(void 0, args);
|
|
495
|
+
if (!prepared) {
|
|
496
|
+
throw new Error("prepareAction did not return an object");
|
|
497
|
+
}
|
|
498
|
+
return __spreadValues(__spreadValues({
|
|
499
|
+
type: type,
|
|
500
|
+
payload: prepared.payload
|
|
501
|
+
}, "meta" in prepared && {
|
|
502
|
+
meta: prepared.meta
|
|
503
|
+
}), "error" in prepared && {
|
|
504
|
+
error: prepared.error
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
return {
|
|
508
|
+
type: type,
|
|
509
|
+
payload: args[0]
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
actionCreator.toString = function () {
|
|
513
|
+
return "" + type;
|
|
514
|
+
};
|
|
515
|
+
actionCreator.type = type;
|
|
516
|
+
actionCreator.match = function (action) {
|
|
517
|
+
return action.type === type;
|
|
518
|
+
};
|
|
519
|
+
return actionCreator;
|
|
520
|
+
}
|
|
521
|
+
// src/nanoid.ts
|
|
522
|
+
var urlAlphabet = "ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW";
|
|
523
|
+
var nanoid = function (size) {
|
|
524
|
+
if (size === void 0) {
|
|
525
|
+
size = 21;
|
|
526
|
+
}
|
|
527
|
+
var id = "";
|
|
528
|
+
var i = size;
|
|
529
|
+
while (i--) {
|
|
530
|
+
id += urlAlphabet[Math.random() * 64 | 0];
|
|
531
|
+
}
|
|
532
|
+
return id;
|
|
533
|
+
};
|
|
534
|
+
// src/createAsyncThunk.ts
|
|
535
|
+
var commonProperties = ["name", "message", "stack", "code"];
|
|
536
|
+
var RejectWithValue = /** @class */function () {
|
|
537
|
+
function RejectWithValue(payload, meta) {
|
|
538
|
+
this.payload = payload;
|
|
539
|
+
this.meta = meta;
|
|
540
|
+
}
|
|
541
|
+
return RejectWithValue;
|
|
542
|
+
}();
|
|
543
|
+
var FulfillWithMeta = /** @class */function () {
|
|
544
|
+
function FulfillWithMeta(payload, meta) {
|
|
545
|
+
this.payload = payload;
|
|
546
|
+
this.meta = meta;
|
|
547
|
+
}
|
|
548
|
+
return FulfillWithMeta;
|
|
549
|
+
}();
|
|
550
|
+
var miniSerializeError = function (value) {
|
|
551
|
+
if (typeof value === "object" && value !== null) {
|
|
552
|
+
var simpleError = {};
|
|
553
|
+
for (var _i = 0, commonProperties_1 = commonProperties; _i < commonProperties_1.length; _i++) {
|
|
554
|
+
var property = commonProperties_1[_i];
|
|
555
|
+
if (typeof value[property] === "string") {
|
|
556
|
+
simpleError[property] = value[property];
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
return simpleError;
|
|
560
|
+
}
|
|
561
|
+
return {
|
|
562
|
+
message: String(value)
|
|
563
|
+
};
|
|
564
|
+
};
|
|
565
|
+
(function () {
|
|
566
|
+
function createAsyncThunk2(typePrefix, payloadCreator, options) {
|
|
567
|
+
var fulfilled = createAction(typePrefix + "/fulfilled", function (payload, requestId, arg, meta) {
|
|
568
|
+
return {
|
|
569
|
+
payload: payload,
|
|
570
|
+
meta: __spreadProps(__spreadValues({}, meta || {}), {
|
|
571
|
+
arg: arg,
|
|
572
|
+
requestId: requestId,
|
|
573
|
+
requestStatus: "fulfilled"
|
|
574
|
+
})
|
|
575
|
+
};
|
|
576
|
+
});
|
|
577
|
+
var pending = createAction(typePrefix + "/pending", function (requestId, arg, meta) {
|
|
578
|
+
return {
|
|
579
|
+
payload: void 0,
|
|
580
|
+
meta: __spreadProps(__spreadValues({}, meta || {}), {
|
|
581
|
+
arg: arg,
|
|
582
|
+
requestId: requestId,
|
|
583
|
+
requestStatus: "pending"
|
|
584
|
+
})
|
|
585
|
+
};
|
|
586
|
+
});
|
|
587
|
+
var rejected = createAction(typePrefix + "/rejected", function (error, requestId, arg, payload, meta) {
|
|
588
|
+
return {
|
|
589
|
+
payload: payload,
|
|
590
|
+
error: (options && options.serializeError || miniSerializeError)(error || "Rejected"),
|
|
591
|
+
meta: __spreadProps(__spreadValues({}, meta || {}), {
|
|
592
|
+
arg: arg,
|
|
593
|
+
requestId: requestId,
|
|
594
|
+
rejectedWithValue: !!payload,
|
|
595
|
+
requestStatus: "rejected",
|
|
596
|
+
aborted: (error == null ? void 0 : error.name) === "AbortError",
|
|
597
|
+
condition: (error == null ? void 0 : error.name) === "ConditionError"
|
|
598
|
+
})
|
|
599
|
+
};
|
|
600
|
+
});
|
|
601
|
+
var displayedWarning = false;
|
|
602
|
+
var AC = typeof AbortController !== "undefined" ? AbortController : /** @class */function () {
|
|
603
|
+
function class_1() {
|
|
604
|
+
this.signal = {
|
|
605
|
+
aborted: false,
|
|
606
|
+
addEventListener: function () {},
|
|
607
|
+
dispatchEvent: function () {
|
|
608
|
+
return false;
|
|
609
|
+
},
|
|
610
|
+
onabort: function () {},
|
|
611
|
+
removeEventListener: function () {},
|
|
612
|
+
reason: void 0,
|
|
613
|
+
throwIfAborted: function () {}
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
class_1.prototype.abort = function () {
|
|
617
|
+
if (process.env.NODE_ENV !== "production") {
|
|
618
|
+
if (!displayedWarning) {
|
|
619
|
+
displayedWarning = true;
|
|
620
|
+
console.info("This platform does not implement AbortController. \nIf you want to use the AbortController to react to `abort` events, please consider importing a polyfill like 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'.");
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
};
|
|
624
|
+
return class_1;
|
|
625
|
+
}();
|
|
626
|
+
function actionCreator(arg) {
|
|
627
|
+
return function (dispatch, getState, extra) {
|
|
628
|
+
var requestId = (options == null ? void 0 : options.idGenerator) ? options.idGenerator(arg) : nanoid();
|
|
629
|
+
var abortController = new AC();
|
|
630
|
+
var abortReason;
|
|
631
|
+
function abort(reason) {
|
|
632
|
+
abortReason = reason;
|
|
633
|
+
abortController.abort();
|
|
634
|
+
}
|
|
635
|
+
var promise2 = function () {
|
|
636
|
+
return __async(this, null, function () {
|
|
637
|
+
var _a, _b, finalAction, conditionResult, abortedPromise, err_1, skipDispatch;
|
|
638
|
+
return __generator(this, function (_c) {
|
|
639
|
+
switch (_c.label) {
|
|
640
|
+
case 0:
|
|
641
|
+
_c.trys.push([0, 4,, 5]);
|
|
642
|
+
conditionResult = (_a = options == null ? void 0 : options.condition) == null ? void 0 : _a.call(options, arg, {
|
|
643
|
+
getState: getState,
|
|
644
|
+
extra: extra
|
|
645
|
+
});
|
|
646
|
+
if (!isThenable(conditionResult)) return [3 /*break*/, 2];
|
|
647
|
+
return [4 /*yield*/, conditionResult];
|
|
648
|
+
case 1:
|
|
649
|
+
conditionResult = _c.sent();
|
|
650
|
+
_c.label = 2;
|
|
651
|
+
case 2:
|
|
652
|
+
if (conditionResult === false || abortController.signal.aborted) {
|
|
653
|
+
throw {
|
|
654
|
+
name: "ConditionError",
|
|
655
|
+
message: "Aborted due to condition callback returning false."
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
abortedPromise = new Promise(function (_, reject) {
|
|
659
|
+
return abortController.signal.addEventListener("abort", function () {
|
|
660
|
+
return reject({
|
|
661
|
+
name: "AbortError",
|
|
662
|
+
message: abortReason || "Aborted"
|
|
663
|
+
});
|
|
664
|
+
});
|
|
665
|
+
});
|
|
666
|
+
dispatch(pending(requestId, arg, (_b = options == null ? void 0 : options.getPendingMeta) == null ? void 0 : _b.call(options, {
|
|
667
|
+
requestId: requestId,
|
|
668
|
+
arg: arg
|
|
669
|
+
}, {
|
|
670
|
+
getState: getState,
|
|
671
|
+
extra: extra
|
|
672
|
+
})));
|
|
673
|
+
return [4 /*yield*/, Promise.race([abortedPromise, Promise.resolve(payloadCreator(arg, {
|
|
674
|
+
dispatch: dispatch,
|
|
675
|
+
getState: getState,
|
|
676
|
+
extra: extra,
|
|
677
|
+
requestId: requestId,
|
|
678
|
+
signal: abortController.signal,
|
|
679
|
+
abort: abort,
|
|
680
|
+
rejectWithValue: function (value, meta) {
|
|
681
|
+
return new RejectWithValue(value, meta);
|
|
682
|
+
},
|
|
683
|
+
fulfillWithValue: function (value, meta) {
|
|
684
|
+
return new FulfillWithMeta(value, meta);
|
|
685
|
+
}
|
|
686
|
+
})).then(function (result) {
|
|
687
|
+
if (result instanceof RejectWithValue) {
|
|
688
|
+
throw result;
|
|
689
|
+
}
|
|
690
|
+
if (result instanceof FulfillWithMeta) {
|
|
691
|
+
return fulfilled(result.payload, requestId, arg, result.meta);
|
|
692
|
+
}
|
|
693
|
+
return fulfilled(result, requestId, arg);
|
|
694
|
+
})])];
|
|
695
|
+
case 3:
|
|
696
|
+
finalAction = _c.sent();
|
|
697
|
+
return [3 /*break*/, 5];
|
|
698
|
+
case 4:
|
|
699
|
+
err_1 = _c.sent();
|
|
700
|
+
finalAction = err_1 instanceof RejectWithValue ? rejected(null, requestId, arg, err_1.payload, err_1.meta) : rejected(err_1, requestId, arg);
|
|
701
|
+
return [3 /*break*/, 5];
|
|
702
|
+
case 5:
|
|
703
|
+
skipDispatch = options && !options.dispatchConditionRejection && rejected.match(finalAction) && finalAction.meta.condition;
|
|
704
|
+
if (!skipDispatch) {
|
|
705
|
+
dispatch(finalAction);
|
|
706
|
+
}
|
|
707
|
+
return [2 /*return*/, finalAction];
|
|
708
|
+
}
|
|
709
|
+
});
|
|
710
|
+
});
|
|
711
|
+
}();
|
|
712
|
+
return Object.assign(promise2, {
|
|
713
|
+
abort: abort,
|
|
714
|
+
requestId: requestId,
|
|
715
|
+
arg: arg,
|
|
716
|
+
unwrap: function () {
|
|
717
|
+
return promise2.then(unwrapResult);
|
|
718
|
+
}
|
|
719
|
+
});
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
return Object.assign(actionCreator, {
|
|
723
|
+
pending: pending,
|
|
724
|
+
rejected: rejected,
|
|
725
|
+
fulfilled: fulfilled,
|
|
726
|
+
typePrefix: typePrefix
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
createAsyncThunk2.withTypes = function () {
|
|
730
|
+
return createAsyncThunk2;
|
|
731
|
+
};
|
|
732
|
+
return createAsyncThunk2;
|
|
733
|
+
})();
|
|
734
|
+
function unwrapResult(action) {
|
|
735
|
+
if (action.meta && action.meta.rejectedWithValue) {
|
|
736
|
+
throw action.payload;
|
|
737
|
+
}
|
|
738
|
+
if (action.error) {
|
|
739
|
+
throw action.error;
|
|
740
|
+
}
|
|
741
|
+
return action.payload;
|
|
742
|
+
}
|
|
743
|
+
function isThenable(value) {
|
|
744
|
+
return value !== null && typeof value === "object" && typeof value.then === "function";
|
|
745
|
+
}
|
|
746
|
+
var alm = "listenerMiddleware";
|
|
747
|
+
createAction(alm + "/add");
|
|
748
|
+
createAction(alm + "/removeAll");
|
|
749
|
+
createAction(alm + "/remove");
|
|
750
|
+
var promise;
|
|
751
|
+
typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : globalThis) : function (cb) {
|
|
752
|
+
return (promise || (promise = Promise.resolve())).then(cb).catch(function (err) {
|
|
753
|
+
return setTimeout(function () {
|
|
754
|
+
throw err;
|
|
755
|
+
}, 0);
|
|
756
|
+
});
|
|
757
|
+
};
|
|
758
|
+
// src/index.ts
|
|
759
|
+
F();
|
|
760
|
+
|
|
761
|
+
var makeSelectorHook = function makeSelectorHook(selector) {
|
|
762
|
+
return function () {
|
|
763
|
+
return reactRedux.useSelector(selector, reactRedux.shallowEqual);
|
|
764
|
+
};
|
|
765
|
+
};
|
|
766
|
+
var index = (function () {
|
|
767
|
+
// creates a redux selector and a react hook that produce identical results
|
|
768
|
+
var selector = createDraftSafeSelector.apply(void 0, arguments);
|
|
769
|
+
var hook = makeSelectorHook(selector);
|
|
770
|
+
hook.select = selector;
|
|
771
|
+
return hook;
|
|
772
|
+
});
|
|
773
|
+
|
|
774
|
+
exports["default"] = index;
|
|
775
|
+
exports.makeSelectorHook = makeSelectorHook;
|
|
776
|
+
|
|
777
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
778
|
+
|
|
779
|
+
}));
|
package/dist/index.es.js
CHANGED
|
@@ -3878,6 +3878,9 @@ var configure = function configure(_ref) {
|
|
|
3878
3878
|
var _slice$actions;
|
|
3879
3879
|
return (_slice$actions = slice.actions)[sliceSetterKey].apply(_slice$actions, _toConsumableArray(getParams.apply(void 0, arguments)));
|
|
3880
3880
|
};
|
|
3881
|
+
updateFn.toString = function () {
|
|
3882
|
+
return slice.actions[sliceSetterKey].toString();
|
|
3883
|
+
};
|
|
3881
3884
|
|
|
3882
3885
|
/* eslint-disable react-hooks/rules-of-hooks */
|
|
3883
3886
|
hooks[domainHookKey] = function () {
|
package/dist/index.js
CHANGED
|
@@ -3882,6 +3882,9 @@ var configure = function configure(_ref) {
|
|
|
3882
3882
|
var _slice$actions;
|
|
3883
3883
|
return (_slice$actions = slice.actions)[sliceSetterKey].apply(_slice$actions, _toConsumableArray(getParams.apply(void 0, arguments)));
|
|
3884
3884
|
};
|
|
3885
|
+
updateFn.toString = function () {
|
|
3886
|
+
return slice.actions[sliceSetterKey].toString();
|
|
3887
|
+
};
|
|
3885
3888
|
|
|
3886
3889
|
/* eslint-disable react-hooks/rules-of-hooks */
|
|
3887
3890
|
hooks[domainHookKey] = function () {
|
package/dist/index.umd.js
CHANGED
|
@@ -5936,6 +5936,9 @@
|
|
|
5936
5936
|
var _slice$actions;
|
|
5937
5937
|
return (_slice$actions = slice.actions)[sliceSetterKey].apply(_slice$actions, _toConsumableArray(getParams.apply(void 0, arguments)));
|
|
5938
5938
|
};
|
|
5939
|
+
updateFn.toString = function () {
|
|
5940
|
+
return slice.actions[sliceSetterKey].toString();
|
|
5941
|
+
};
|
|
5939
5942
|
|
|
5940
5943
|
/* eslint-disable react-hooks/rules-of-hooks */
|
|
5941
5944
|
hooks[domainHookKey] = function () {
|
package/dist/plugins/index.es.js
CHANGED
|
@@ -523,8 +523,9 @@ var getPersistedStore = /*#__PURE__*/function () {
|
|
|
523
523
|
return storage.getItem(PERSISTENCE_KEY);
|
|
524
524
|
case 3:
|
|
525
525
|
result = _context.sent;
|
|
526
|
+
console.log("result: ", result);
|
|
526
527
|
return _context.abrupt("return", JSON.parse(result || "{}"));
|
|
527
|
-
case
|
|
528
|
+
case 6:
|
|
528
529
|
case "end":
|
|
529
530
|
return _context.stop();
|
|
530
531
|
}
|
|
@@ -543,28 +544,32 @@ var storePersistedValue = /*#__PURE__*/function () {
|
|
|
543
544
|
while (1) switch (_context2.prev = _context2.next) {
|
|
544
545
|
case 0:
|
|
545
546
|
storage = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : localStorage;
|
|
546
|
-
|
|
547
|
+
_context2.next = 3;
|
|
548
|
+
return getPersistedStore(storage);
|
|
549
|
+
case 3:
|
|
550
|
+
store = _context2.sent;
|
|
551
|
+
console.log("namespace: ", namespace);
|
|
547
552
|
if (namespace) {
|
|
548
553
|
store[namespace] = store[namespace] || {};
|
|
549
554
|
store[namespace][key] = value;
|
|
550
555
|
} else {
|
|
551
556
|
store[key] = value;
|
|
552
557
|
}
|
|
553
|
-
_context2.prev =
|
|
554
|
-
_context2.next =
|
|
558
|
+
_context2.prev = 6;
|
|
559
|
+
_context2.next = 9;
|
|
555
560
|
return storage.setItem(PERSISTENCE_KEY, JSON.stringify(store));
|
|
556
|
-
case
|
|
557
|
-
_context2.next =
|
|
561
|
+
case 9:
|
|
562
|
+
_context2.next = 14;
|
|
558
563
|
break;
|
|
559
|
-
case 8:
|
|
560
|
-
_context2.prev = 8;
|
|
561
|
-
_context2.t0 = _context2["catch"](3);
|
|
562
|
-
console.error(_context2.t0);
|
|
563
564
|
case 11:
|
|
565
|
+
_context2.prev = 11;
|
|
566
|
+
_context2.t0 = _context2["catch"](6);
|
|
567
|
+
console.error(_context2.t0);
|
|
568
|
+
case 14:
|
|
564
569
|
case "end":
|
|
565
570
|
return _context2.stop();
|
|
566
571
|
}
|
|
567
|
-
}, _callee2, null, [[
|
|
572
|
+
}, _callee2, null, [[6, 11]]);
|
|
568
573
|
}));
|
|
569
574
|
return function storePersistedValue(_x, _x2, _x3) {
|
|
570
575
|
return _ref2.apply(this, arguments);
|
package/dist/plugins/index.js
CHANGED
|
@@ -531,8 +531,9 @@ var getPersistedStore = /*#__PURE__*/function () {
|
|
|
531
531
|
return storage.getItem(PERSISTENCE_KEY);
|
|
532
532
|
case 3:
|
|
533
533
|
result = _context.sent;
|
|
534
|
+
console.log("result: ", result);
|
|
534
535
|
return _context.abrupt("return", JSON.parse(result || "{}"));
|
|
535
|
-
case
|
|
536
|
+
case 6:
|
|
536
537
|
case "end":
|
|
537
538
|
return _context.stop();
|
|
538
539
|
}
|
|
@@ -551,28 +552,32 @@ var storePersistedValue = /*#__PURE__*/function () {
|
|
|
551
552
|
while (1) switch (_context2.prev = _context2.next) {
|
|
552
553
|
case 0:
|
|
553
554
|
storage = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : localStorage;
|
|
554
|
-
|
|
555
|
+
_context2.next = 3;
|
|
556
|
+
return getPersistedStore(storage);
|
|
557
|
+
case 3:
|
|
558
|
+
store = _context2.sent;
|
|
559
|
+
console.log("namespace: ", namespace);
|
|
555
560
|
if (namespace) {
|
|
556
561
|
store[namespace] = store[namespace] || {};
|
|
557
562
|
store[namespace][key] = value;
|
|
558
563
|
} else {
|
|
559
564
|
store[key] = value;
|
|
560
565
|
}
|
|
561
|
-
_context2.prev =
|
|
562
|
-
_context2.next =
|
|
566
|
+
_context2.prev = 6;
|
|
567
|
+
_context2.next = 9;
|
|
563
568
|
return storage.setItem(PERSISTENCE_KEY, JSON.stringify(store));
|
|
564
|
-
case
|
|
565
|
-
_context2.next =
|
|
569
|
+
case 9:
|
|
570
|
+
_context2.next = 14;
|
|
566
571
|
break;
|
|
567
|
-
case 8:
|
|
568
|
-
_context2.prev = 8;
|
|
569
|
-
_context2.t0 = _context2["catch"](3);
|
|
570
|
-
console.error(_context2.t0);
|
|
571
572
|
case 11:
|
|
573
|
+
_context2.prev = 11;
|
|
574
|
+
_context2.t0 = _context2["catch"](6);
|
|
575
|
+
console.error(_context2.t0);
|
|
576
|
+
case 14:
|
|
572
577
|
case "end":
|
|
573
578
|
return _context2.stop();
|
|
574
579
|
}
|
|
575
|
-
}, _callee2, null, [[
|
|
580
|
+
}, _callee2, null, [[6, 11]]);
|
|
576
581
|
}));
|
|
577
582
|
return function storePersistedValue(_x, _x2, _x3) {
|
|
578
583
|
return _ref2.apply(this, arguments);
|
|
@@ -611,8 +611,9 @@
|
|
|
611
611
|
return storage.getItem(PERSISTENCE_KEY);
|
|
612
612
|
case 3:
|
|
613
613
|
result = _context.sent;
|
|
614
|
+
console.log("result: ", result);
|
|
614
615
|
return _context.abrupt("return", JSON.parse(result || "{}"));
|
|
615
|
-
case
|
|
616
|
+
case 6:
|
|
616
617
|
case "end":
|
|
617
618
|
return _context.stop();
|
|
618
619
|
}
|
|
@@ -631,28 +632,32 @@
|
|
|
631
632
|
while (1) switch (_context2.prev = _context2.next) {
|
|
632
633
|
case 0:
|
|
633
634
|
storage = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : localStorage;
|
|
634
|
-
|
|
635
|
+
_context2.next = 3;
|
|
636
|
+
return getPersistedStore(storage);
|
|
637
|
+
case 3:
|
|
638
|
+
store = _context2.sent;
|
|
639
|
+
console.log("namespace: ", namespace);
|
|
635
640
|
if (namespace) {
|
|
636
641
|
store[namespace] = store[namespace] || {};
|
|
637
642
|
store[namespace][key] = value;
|
|
638
643
|
} else {
|
|
639
644
|
store[key] = value;
|
|
640
645
|
}
|
|
641
|
-
_context2.prev =
|
|
642
|
-
_context2.next =
|
|
646
|
+
_context2.prev = 6;
|
|
647
|
+
_context2.next = 9;
|
|
643
648
|
return storage.setItem(PERSISTENCE_KEY, JSON.stringify(store));
|
|
644
|
-
case
|
|
645
|
-
_context2.next =
|
|
649
|
+
case 9:
|
|
650
|
+
_context2.next = 14;
|
|
646
651
|
break;
|
|
647
|
-
case 8:
|
|
648
|
-
_context2.prev = 8;
|
|
649
|
-
_context2.t0 = _context2["catch"](3);
|
|
650
|
-
console.error(_context2.t0);
|
|
651
652
|
case 11:
|
|
653
|
+
_context2.prev = 11;
|
|
654
|
+
_context2.t0 = _context2["catch"](6);
|
|
655
|
+
console.error(_context2.t0);
|
|
656
|
+
case 14:
|
|
652
657
|
case "end":
|
|
653
658
|
return _context2.stop();
|
|
654
659
|
}
|
|
655
|
-
}, _callee2, null, [[
|
|
660
|
+
}, _callee2, null, [[6, 11]]);
|
|
656
661
|
}));
|
|
657
662
|
return function storePersistedValue(_x, _x2, _x3) {
|
|
658
663
|
return _ref2.apply(this, arguments);
|
|
@@ -347,8 +347,9 @@ var getPersistedStore = /*#__PURE__*/function () {
|
|
|
347
347
|
return storage.getItem(PERSISTENCE_KEY);
|
|
348
348
|
case 3:
|
|
349
349
|
result = _context.sent;
|
|
350
|
+
console.log("result: ", result);
|
|
350
351
|
return _context.abrupt("return", JSON.parse(result || "{}"));
|
|
351
|
-
case
|
|
352
|
+
case 6:
|
|
352
353
|
case "end":
|
|
353
354
|
return _context.stop();
|
|
354
355
|
}
|
|
@@ -367,28 +368,32 @@ var storePersistedValue = /*#__PURE__*/function () {
|
|
|
367
368
|
while (1) switch (_context2.prev = _context2.next) {
|
|
368
369
|
case 0:
|
|
369
370
|
storage = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : localStorage;
|
|
370
|
-
|
|
371
|
+
_context2.next = 3;
|
|
372
|
+
return getPersistedStore(storage);
|
|
373
|
+
case 3:
|
|
374
|
+
store = _context2.sent;
|
|
375
|
+
console.log("namespace: ", namespace);
|
|
371
376
|
if (namespace) {
|
|
372
377
|
store[namespace] = store[namespace] || {};
|
|
373
378
|
store[namespace][key] = value;
|
|
374
379
|
} else {
|
|
375
380
|
store[key] = value;
|
|
376
381
|
}
|
|
377
|
-
_context2.prev =
|
|
378
|
-
_context2.next =
|
|
382
|
+
_context2.prev = 6;
|
|
383
|
+
_context2.next = 9;
|
|
379
384
|
return storage.setItem(PERSISTENCE_KEY, JSON.stringify(store));
|
|
380
|
-
case
|
|
381
|
-
_context2.next =
|
|
385
|
+
case 9:
|
|
386
|
+
_context2.next = 14;
|
|
382
387
|
break;
|
|
383
|
-
case 8:
|
|
384
|
-
_context2.prev = 8;
|
|
385
|
-
_context2.t0 = _context2["catch"](3);
|
|
386
|
-
console.error(_context2.t0);
|
|
387
388
|
case 11:
|
|
389
|
+
_context2.prev = 11;
|
|
390
|
+
_context2.t0 = _context2["catch"](6);
|
|
391
|
+
console.error(_context2.t0);
|
|
392
|
+
case 14:
|
|
388
393
|
case "end":
|
|
389
394
|
return _context2.stop();
|
|
390
395
|
}
|
|
391
|
-
}, _callee2, null, [[
|
|
396
|
+
}, _callee2, null, [[6, 11]]);
|
|
392
397
|
}));
|
|
393
398
|
return function storePersistedValue(_x, _x2, _x3) {
|
|
394
399
|
return _ref2.apply(this, arguments);
|
|
@@ -351,8 +351,9 @@ var getPersistedStore = /*#__PURE__*/function () {
|
|
|
351
351
|
return storage.getItem(PERSISTENCE_KEY);
|
|
352
352
|
case 3:
|
|
353
353
|
result = _context.sent;
|
|
354
|
+
console.log("result: ", result);
|
|
354
355
|
return _context.abrupt("return", JSON.parse(result || "{}"));
|
|
355
|
-
case
|
|
356
|
+
case 6:
|
|
356
357
|
case "end":
|
|
357
358
|
return _context.stop();
|
|
358
359
|
}
|
|
@@ -371,28 +372,32 @@ var storePersistedValue = /*#__PURE__*/function () {
|
|
|
371
372
|
while (1) switch (_context2.prev = _context2.next) {
|
|
372
373
|
case 0:
|
|
373
374
|
storage = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : localStorage;
|
|
374
|
-
|
|
375
|
+
_context2.next = 3;
|
|
376
|
+
return getPersistedStore(storage);
|
|
377
|
+
case 3:
|
|
378
|
+
store = _context2.sent;
|
|
379
|
+
console.log("namespace: ", namespace);
|
|
375
380
|
if (namespace) {
|
|
376
381
|
store[namespace] = store[namespace] || {};
|
|
377
382
|
store[namespace][key] = value;
|
|
378
383
|
} else {
|
|
379
384
|
store[key] = value;
|
|
380
385
|
}
|
|
381
|
-
_context2.prev =
|
|
382
|
-
_context2.next =
|
|
386
|
+
_context2.prev = 6;
|
|
387
|
+
_context2.next = 9;
|
|
383
388
|
return storage.setItem(PERSISTENCE_KEY, JSON.stringify(store));
|
|
384
|
-
case
|
|
385
|
-
_context2.next =
|
|
389
|
+
case 9:
|
|
390
|
+
_context2.next = 14;
|
|
386
391
|
break;
|
|
387
|
-
case 8:
|
|
388
|
-
_context2.prev = 8;
|
|
389
|
-
_context2.t0 = _context2["catch"](3);
|
|
390
|
-
console.error(_context2.t0);
|
|
391
392
|
case 11:
|
|
393
|
+
_context2.prev = 11;
|
|
394
|
+
_context2.t0 = _context2["catch"](6);
|
|
395
|
+
console.error(_context2.t0);
|
|
396
|
+
case 14:
|
|
392
397
|
case "end":
|
|
393
398
|
return _context2.stop();
|
|
394
399
|
}
|
|
395
|
-
}, _callee2, null, [[
|
|
400
|
+
}, _callee2, null, [[6, 11]]);
|
|
396
401
|
}));
|
|
397
402
|
return function storePersistedValue(_x, _x2, _x3) {
|
|
398
403
|
return _ref2.apply(this, arguments);
|
|
@@ -353,8 +353,9 @@
|
|
|
353
353
|
return storage.getItem(PERSISTENCE_KEY);
|
|
354
354
|
case 3:
|
|
355
355
|
result = _context.sent;
|
|
356
|
+
console.log("result: ", result);
|
|
356
357
|
return _context.abrupt("return", JSON.parse(result || "{}"));
|
|
357
|
-
case
|
|
358
|
+
case 6:
|
|
358
359
|
case "end":
|
|
359
360
|
return _context.stop();
|
|
360
361
|
}
|
|
@@ -373,28 +374,32 @@
|
|
|
373
374
|
while (1) switch (_context2.prev = _context2.next) {
|
|
374
375
|
case 0:
|
|
375
376
|
storage = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : localStorage;
|
|
376
|
-
|
|
377
|
+
_context2.next = 3;
|
|
378
|
+
return getPersistedStore(storage);
|
|
379
|
+
case 3:
|
|
380
|
+
store = _context2.sent;
|
|
381
|
+
console.log("namespace: ", namespace);
|
|
377
382
|
if (namespace) {
|
|
378
383
|
store[namespace] = store[namespace] || {};
|
|
379
384
|
store[namespace][key] = value;
|
|
380
385
|
} else {
|
|
381
386
|
store[key] = value;
|
|
382
387
|
}
|
|
383
|
-
_context2.prev =
|
|
384
|
-
_context2.next =
|
|
388
|
+
_context2.prev = 6;
|
|
389
|
+
_context2.next = 9;
|
|
385
390
|
return storage.setItem(PERSISTENCE_KEY, JSON.stringify(store));
|
|
386
|
-
case
|
|
387
|
-
_context2.next =
|
|
391
|
+
case 9:
|
|
392
|
+
_context2.next = 14;
|
|
388
393
|
break;
|
|
389
|
-
case 8:
|
|
390
|
-
_context2.prev = 8;
|
|
391
|
-
_context2.t0 = _context2["catch"](3);
|
|
392
|
-
console.error(_context2.t0);
|
|
393
394
|
case 11:
|
|
395
|
+
_context2.prev = 11;
|
|
396
|
+
_context2.t0 = _context2["catch"](6);
|
|
397
|
+
console.error(_context2.t0);
|
|
398
|
+
case 14:
|
|
394
399
|
case "end":
|
|
395
400
|
return _context2.stop();
|
|
396
401
|
}
|
|
397
|
-
}, _callee2, null, [[
|
|
402
|
+
}, _callee2, null, [[6, 11]]);
|
|
398
403
|
}));
|
|
399
404
|
return function storePersistedValue(_x, _x2, _x3) {
|
|
400
405
|
return _ref2.apply(this, arguments);
|