state-decorator 6.6.0 → 6.6.1

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/middlewares.es.js CHANGED
@@ -1,2 +1,2 @@
1
- function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function e(t){var e={exports:{}};return t(e,e.exports),e.exports}var r=t(e((function(t){t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t},t.exports.default=t.exports,t.exports.__esModule=!0}))),n=t(e((function(t){function e(r){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(t.exports=e=function(t){return typeof t},t.exports.default=t.exports,t.exports.__esModule=!0):(t.exports=e=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.default=t.exports,t.exports.__esModule=!0),e(r)}t.exports=e,t.exports.default=t.exports,t.exports.__esModule=!0}))),o=Array.isArray,i=Object.keys,a=Object.prototype.hasOwnProperty,c=function t(e,r){if(e===r)return!0;if(e&&r&&"object"==typeof e&&"object"==typeof r){var n,c,u,s=o(e),l=o(r);if(s&&l){if((c=e.length)!=r.length)return!1;for(n=c;0!=n--;)if(!t(e[n],r[n]))return!1;return!0}if(s!=l)return!1;var f=e instanceof Date,p=r instanceof Date;if(f!=p)return!1;if(f&&p)return e.getTime()==r.getTime();var d=e instanceof RegExp,h=r instanceof RegExp;if(d!=h)return!1;if(d&&h)return e.toString()==r.toString();var y=i(e);if((c=y.length)!==i(r).length)return!1;for(n=c;0!=n--;)if(!a.call(r,y[n]))return!1;for(n=c;0!=n--;)if(!t(e[u=y[n]],r[u]))return!1;return!0}return e!=e&&r!=r},u=e((function(t){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n},t.exports.default=t.exports,t.exports.__esModule=!0})),s=e((function(t){t.exports=function(t){if(Array.isArray(t))return u(t)},t.exports.default=t.exports,t.exports.__esModule=!0})),l=e((function(t){t.exports=function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)},t.exports.default=t.exports,t.exports.__esModule=!0})),f=e((function(t){t.exports=function(t,e){if(t){if("string"==typeof t)return u(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}},t.exports.default=t.exports,t.exports.__esModule=!0})),p=e((function(t){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.default=t.exports,t.exports.__esModule=!0}));e((function(t){t.exports=function(t){return s(t)||l(t)||f(t)||p()},t.exports.default=t.exports,t.exports.__esModule=!0}));var d,h=e((function(t){t.exports=function(t){if(Array.isArray(t))return t},t.exports.default=t.exports,t.exports.__esModule=!0})),y=e((function(t){t.exports=function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var r=[],n=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(n=(a=c.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==c.return||c.return()}finally{if(o)throw i}}return r}},t.exports.default=t.exports,t.exports.__esModule=!0})),v=e((function(t){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.default=t.exports,t.exports.__esModule=!0}));e((function(t){t.exports=function(t,e){return h(t)||y(t,e)||f(t,e)||v()},t.exports.default=t.exports,t.exports.__esModule=!0})),e((function(t){function e(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}t.exports=function(t){return function(){var r=this,n=arguments;return new Promise((function(o,i){var a=t.apply(r,n);function c(t){e(a,o,i,c,u,"next",t)}function u(t){e(a,o,i,c,u,"throw",t)}c(void 0)}))}},t.exports.default=t.exports,t.exports.__esModule=!0})),e((function(t){var e=function(t){var e,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o=e&&e.prototype instanceof v?e:v,i=Object.create(o.prototype),a=new N(n||[]);return i._invoke=function(t,e,r){var n=f;return function(o,i){if(n===d)throw new Error("Generator is already running");if(n===h){if("throw"===o)throw i;return P()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=j(a,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var u=l(t,e,r);if("normal"===u.type){if(n=r.done?h:p,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=h,r.method="throw",r.arg=u.arg)}}}(t,r,a),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var f="suspendedStart",p="suspendedYield",d="executing",h="completed",y={};function v(){}function g(){}function m(){}var x={};x[i]=function(){return this};var E=Object.getPrototypeOf,b=E&&E(E(A([])));b&&b!==r&&n.call(b,i)&&(x=b);var w=m.prototype=v.prototype=Object.create(x);function O(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,i,a,c){var u=l(t[o],t,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}}function j(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method))return y;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=l(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,y;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,y):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function A(t){if(t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}return{next:P}}function P(){return{value:e,done:!0}}return g.prototype=w.constructor=m,m.constructor=g,g.displayName=u(m,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,u(t,c,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},O(_.prototype),_.prototype[a]=function(){return this},t.AsyncIterator=_,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new _(s(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(w),u(w,c,"Generator"),w[i]=function(){return this},w.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=A,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:A(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),y}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}})),function(t){t.REJECT="reject",t.IGNORE="ignore",t.KEEP_LAST="keepLast",t.KEEP_ALL="keepAll",t.PARALLEL="parallel",t.REUSE="reuse"}(d||(d={}));var g={clone:function(t){return JSON.parse(JSON.stringify(t))},comparator:function(t,e){if(Object.is(t,e))return!0;if("object"!==n(t)||null===t||"object"!==n(e)||null===e)return!1;var r=Object.keys(t);if(r.length!==Object.keys(e).length)return!1;for(var o=0;o<r.length;o++)if(!Object.prototype.hasOwnProperty.call(e,r[o])||!Object.is(t[r[o]],e[r[o]]))return!1;return!0},asyncErrorHandler:function(){},retryOnErrorFunction:function(t){return t instanceof TypeError},notifySuccess:void 0,notifyError:void 0,notifyWarning:void 0,getErrorMessage:void 0,defaultMiddlewares:[]};function m(t){return"function"==typeof t}function x(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function E(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?x(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):x(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function b(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:console.log,e=function(){var e=t,r="";return{init:function(t){if("development"===process.env.NODE_ENV||"test"===process.env.NODE_ENV){var n,o;r=null!==(n=t.options)&&void 0!==n&&n.name?"[".concat(null===(o=t.options)||void 0===o?void 0:o.name,"]"):"";var i=t.state;e(r,"initialState",i)}},destroy:null,effects:function(t,n,o,i){return"development"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV||e(r,t.name,t.type,null===o?"no effect":o,t.isAsync?"preEffects"!==t.type||i?"loading: ".concat(i):"Promise cancelled":""),null}}};return e}function w(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:console;return function(){var e="",r=t;if("development"===process.env.NODE_ENV||"test"===process.env.NODE_ENV){var o=function(t,e){var r;if(e!==t){var o=n(null!=t?t:e);if("number"===o||"string"===o||"boolean"===o)r="".concat(t," => ").concat(""===e?'""':e);else if(t&&t.length||e&&e.length)if(null==t)r="was ".concat(t,", now contains ").concat(e.length," element(s)");else if(null==e)r="contained ".concat(t.length," element(s), now is ").concat(e);else if(0===t.length)r="was empty, now contains ".concat(e.length," elements");else if(0===e.length)r="contained ".concat(t.length," elements, now is empty");else{var i=e.filter((function(e){return!t.find((function(t){return c(e,t)}))})),a=t.filter((function(t){return!e.find((function(e){return c(t,e)}))}));i.length>10&&(i="".concat(i.length," element(s) added")),a.length>10&&(a="".concat(a.length," element(s) removed")),r={added:i,removed:a}}else r=e}return r},i=function(t){return"string"==typeof t?'"'.concat(t,'"'):t};return{init:function(n){var o,a;e=null!==(o=n.options)&&void 0!==o&&o.name?"[".concat(null===(a=n.options)||void 0===a?void 0:a.name,"]"):"";var c=n.state;t.group(e,"initialState"),Object.keys(c).forEach((function(t){r.log(t,":",i(c[t]))})),t.groupEnd()},destroy:null,effects:function(t,n,a,c){var u,s=null===(u=t.context)||void 0===u?void 0:u.args,l=[e,t.name.toString()];if(t.isAsync&&("preEffects"===t.type?l.push(c?"START":"CANCELLED"):"effects"===t.type?l.push("DONE"):l.push("FAILED")),null!=a||s&&0!==Object.keys(s).length?r.group.apply(r,l):r.log.apply(r,l),s&&Object.keys(s).length>0&&(r.group("Arguments"),s.forEach((function(t){r.log(t,":",i(t))})),r.groupEnd()),null!=a){if(r.groupCollapsed("Before"),null==n)r.log("was null");else Object.keys(n).forEach((function(t){r.log(t,":",i(n[t]))}));if(r.groupEnd(),r.groupCollapsed("After"),null==a)r.log("was null");else Object.keys(a).forEach((function(t){r.log(t,":",i(a[t]))}));if(r.groupEnd(),null!=a){r.group("Diff");var f=function(t,e){var r={};"development"===process.env.NODE_ENV&&(t&&Object.keys(t).forEach((function(n){if(e.hasOwnProperty(n)){var i=t[n],a=e[n],c=o(i,a);c&&(r[n]=c)}else r[n]="was deleted"})),Object.keys(e).forEach((function(n){if(null==t||!t.hasOwnProperty(n)){var i=e[n];r[n]=o(void 0,i)}})));return r}(n,a);Object.keys(f).forEach((function(t){return r.log(t,":",f[t])})),r.groupEnd()}}return r.groupEnd(),null}}}return{init:function(){},destroy:null,effects:function(){return null}}}}function O(t){return function(){var e=null,r={history:null,optimisticActions:{},shouldRecordHistory:!1},n=function(e){return(t||g.clone)(e)},o=function(t,e){return"".concat(t,"_").concat(e)};function i(t,e,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=r.shouldRecordHistory,c=r.history;if(a){null===c&&(r.history=[]);var u=n(o);delete u.state,delete u.s,delete u.abortSignal,u.error=o.err,u.err=o.err;var s={effectType:e,actionName:t,promiseId:o.promiseId,ctx:u,beforeEffectState:i?n(i):null};r.history.push(s)}}function a(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,i=r.optimisticActions,a=r.history,c=o(t,e);delete i[c];var u=Object.keys(i);if(0===u.length)r.history=null,r.shouldRecordHistory=!1;else{var s=void 0===n?a.findIndex((function(t){return o(t.actionName,t.promiseId)===c})):n;if(0===s){var l=a.slice(1).findIndex((function(t){return null!=t.beforeEffectState}))+1;a.splice(0,l)}else void 0===n&&(a[s].beforeEffectState=null)}}return{init:function(t){e=t},destroy:function(){e=null,r.history=null,r.optimisticActions={},r.shouldRecordHistory=!1},effects:function(t,n,c,u){var s=t.name,l=t.type,f=t.context,p=t.isAsync;if((null!=c&&m(e.actions[s])||"onPropsChange"===s||null!=e.actions[s][l])&&i(s,l,f,null),p){var d=e.actions[s];if(u&&null!=d.optimisticEffects&&"preEffects"===l){r.shouldRecordHistory=!0,r.optimisticActions[o(s,f.promiseId)]=!0;var h=c||n;return i(s,"optimisticEffects",f,h),{loading:!1,state:d.optimisticEffects(E(E({},f),{},{state:h,s:h}))}}if(null!=d.optimisticEffects&&"effects"===l)return a(s,f.promiseId),{loading:u,state:c};if(null!=d.optimisticEffects&&"errorEffects"===l)return{state:function(t,n){for(var o=r.history,i=o.findIndex((function(e){return"optimisticEffects"===e.effectType&&e.actionName===t&&e.promiseId===n})),c=o[i].beforeEffectState,u=i+1;u<o.length;u++){var s=o[u];s.beforeEffectState&&(s.beforeEffectState=c);var l=E(E({},s.ctx),{},{state:c,s:c});c="onPropsChange"===s.actionName?(Array.isArray(e.options.onPropsChange)?e.options.onPropsChange:[e.options.onPropsChange])[l.index].effects(l):m(e.actions[s.actionName])?e.actions[s.actionName](l):e.actions[s.actionName][s.effectType](l)}return a(t,n,i),c}(s,f.promiseId),loading:u}}return null}}}}function _(){return function(){var t,e,r;try{t=window.__REDUX_DEVTOOLS_EXTENSION__||window.top.__REDUX_DEVTOOLS_EXTENSION__}catch(t){}return t?{init:function(n){var o,i;(e=t.connect({name:null!==(o=null===(i=n.options)||void 0===i?void 0:i.name)&&void 0!==o?o:"StateDecorator"})).init(n.state);var a=null,c=n.state;r=e.subscribe((function(t){var e,r,o,i;if("DISPATCH"===t.type&&t.state&&"ROLLBACK"!==(null===(e=t.payload)||void 0===e?void 0:e.type)){var u=JSON.parse(t.state);n.setState(u)}else"COMMIT"===(null===(r=t.payload)||void 0===r?void 0:r.type)?a=n.state:"ROLLBACK"===(null===(o=t.payload)||void 0===o?void 0:o.type)?null!=a&&n.setState(a):"RESET"===(null===(i=t.payload)||void 0===i?void 0:i.type)&&n.setState(c)}))},effects:function(t,r,n){if(null!=n){var o=E({},t.context);delete o.a,delete o.s,delete o.p,delete o.res,delete o.err,delete o.ds,e.send({type:"".concat(t.name," ").concat(t.type),args:o.args,context:o},n)}return null},destroy:function(){r(),e=null}}:{init:function(){},destroy:null,effects:function(){return null}}}}export{_ as devtools,w as logDetailedEffects,b as logEffects,O as optimisticActions};
1
+ function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function e(t){var e={exports:{}};return t(e,e.exports),e.exports}var r=t(e((function(t){t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t},t.exports.default=t.exports,t.exports.__esModule=!0}))),n=t(e((function(t){function e(r){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(t.exports=e=function(t){return typeof t},t.exports.default=t.exports,t.exports.__esModule=!0):(t.exports=e=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.default=t.exports,t.exports.__esModule=!0),e(r)}t.exports=e,t.exports.default=t.exports,t.exports.__esModule=!0}))),o=Array.isArray,i=Object.keys,a=Object.prototype.hasOwnProperty,c=function t(e,r){if(e===r)return!0;if(e&&r&&"object"==typeof e&&"object"==typeof r){var n,c,u,s=o(e),l=o(r);if(s&&l){if((c=e.length)!=r.length)return!1;for(n=c;0!=n--;)if(!t(e[n],r[n]))return!1;return!0}if(s!=l)return!1;var f=e instanceof Date,p=r instanceof Date;if(f!=p)return!1;if(f&&p)return e.getTime()==r.getTime();var d=e instanceof RegExp,h=r instanceof RegExp;if(d!=h)return!1;if(d&&h)return e.toString()==r.toString();var y=i(e);if((c=y.length)!==i(r).length)return!1;for(n=c;0!=n--;)if(!a.call(r,y[n]))return!1;for(n=c;0!=n--;)if(!t(e[u=y[n]],r[u]))return!1;return!0}return e!=e&&r!=r},u=e((function(t){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n},t.exports.default=t.exports,t.exports.__esModule=!0})),s=e((function(t){t.exports=function(t){if(Array.isArray(t))return u(t)},t.exports.default=t.exports,t.exports.__esModule=!0})),l=e((function(t){t.exports=function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)},t.exports.default=t.exports,t.exports.__esModule=!0})),f=e((function(t){t.exports=function(t,e){if(t){if("string"==typeof t)return u(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}},t.exports.default=t.exports,t.exports.__esModule=!0})),p=e((function(t){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.default=t.exports,t.exports.__esModule=!0}));e((function(t){t.exports=function(t){return s(t)||l(t)||f(t)||p()},t.exports.default=t.exports,t.exports.__esModule=!0}));var d,h=e((function(t){t.exports=function(t){if(Array.isArray(t))return t},t.exports.default=t.exports,t.exports.__esModule=!0})),y=e((function(t){t.exports=function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var r=[],n=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(n=(a=c.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==c.return||c.return()}finally{if(o)throw i}}return r}},t.exports.default=t.exports,t.exports.__esModule=!0})),v=e((function(t){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.default=t.exports,t.exports.__esModule=!0}));e((function(t){t.exports=function(t,e){return h(t)||y(t,e)||f(t,e)||v()},t.exports.default=t.exports,t.exports.__esModule=!0})),e((function(t){function e(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}t.exports=function(t){return function(){var r=this,n=arguments;return new Promise((function(o,i){var a=t.apply(r,n);function c(t){e(a,o,i,c,u,"next",t)}function u(t){e(a,o,i,c,u,"throw",t)}c(void 0)}))}},t.exports.default=t.exports,t.exports.__esModule=!0})),e((function(t){var e=function(t){var e,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o=e&&e.prototype instanceof v?e:v,i=Object.create(o.prototype),a=new N(n||[]);return i._invoke=function(t,e,r){var n=f;return function(o,i){if(n===d)throw new Error("Generator is already running");if(n===h){if("throw"===o)throw i;return P()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=S(a,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var u=l(t,e,r);if("normal"===u.type){if(n=r.done?h:p,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=h,r.method="throw",r.arg=u.arg)}}}(t,r,a),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var f="suspendedStart",p="suspendedYield",d="executing",h="completed",y={};function v(){}function g(){}function m(){}var x={};x[i]=function(){return this};var E=Object.getPrototypeOf,b=E&&E(E(A([])));b&&b!==r&&n.call(b,i)&&(x=b);var w=m.prototype=v.prototype=Object.create(x);function O(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,i,a,c){var u=l(t[o],t,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}}function S(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method))return y;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=l(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,y;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,y):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function A(t){if(t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}return{next:P}}function P(){return{value:e,done:!0}}return g.prototype=w.constructor=m,m.constructor=g,g.displayName=u(m,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,u(t,c,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},O(_.prototype),_.prototype[a]=function(){return this},t.AsyncIterator=_,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new _(s(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(w),u(w,c,"Generator"),w[i]=function(){return this},w.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=A,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:A(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),y}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}})),function(t){t.REJECT="reject",t.IGNORE="ignore",t.KEEP_LAST="keepLast",t.KEEP_ALL="keepAll",t.PARALLEL="parallel",t.REUSE="reuse"}(d||(d={}));var g={clone:function(t){return JSON.parse(JSON.stringify(t))},comparator:function(t,e){if(Object.is(t,e))return!0;if("object"!==n(t)||null===t||"object"!==n(e)||null===e)return!1;if(t instanceof Set||e instanceof Set)return!1;var r=Object.keys(t),o=Object.keys(e);if(r.length!==o.length)return!1;for(var i=0;i<r.length;i++)if(!Object.prototype.hasOwnProperty.call(e,r[i])||!Object.is(t[r[i]],e[r[i]]))return!1;return!0},asyncErrorHandler:function(){},retryOnErrorFunction:function(t){return t instanceof TypeError},notifySuccess:void 0,notifyError:void 0,notifyWarning:void 0,getErrorMessage:void 0,defaultMiddlewares:[]};function m(t){return"function"==typeof t}function x(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function E(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?x(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):x(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function b(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:console.log,e=function(){var e=t,r="";return{init:function(t){if("development"===process.env.NODE_ENV||"test"===process.env.NODE_ENV){var n,o;r=null!==(n=t.options)&&void 0!==n&&n.name?"[".concat(null===(o=t.options)||void 0===o?void 0:o.name,"]"):"";var i=t.state;e(r,"initialState",i)}},destroy:null,effects:function(t,n,o,i){return"development"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV||e(r,t.name,t.type,null===o?"no effect":o,t.isAsync?"preEffects"!==t.type||i?"loading: ".concat(i):"Promise cancelled":""),null}}};return e}function w(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:console;return function(){var e="",r=t;if("development"===process.env.NODE_ENV||"test"===process.env.NODE_ENV){var o=function(t,e){var r;if(e!==t){var o=n(null!=t?t:e);if("number"===o||"string"===o||"boolean"===o)r="".concat(t," => ").concat(""===e?'""':e);else if(t&&t.length||e&&e.length)if(null==t)r="was ".concat(t,", now contains ").concat(e.length," element(s)");else if(null==e)r="contained ".concat(t.length," element(s), now is ").concat(e);else if(0===t.length)r="was empty, now contains ".concat(e.length," elements");else if(0===e.length)r="contained ".concat(t.length," elements, now is empty");else{var i=e.filter((function(e){return!t.find((function(t){return c(e,t)}))})),a=t.filter((function(t){return!e.find((function(e){return c(t,e)}))}));i.length>10&&(i="".concat(i.length," element(s) added")),a.length>10&&(a="".concat(a.length," element(s) removed")),r={added:i,removed:a}}else r=e}return r},i=function(t){return"string"==typeof t?'"'.concat(t,'"'):t};return{init:function(n){var o,a;e=null!==(o=n.options)&&void 0!==o&&o.name?"[".concat(null===(a=n.options)||void 0===a?void 0:a.name,"]"):"";var c=n.state;t.group(e,"initialState"),Object.keys(c).forEach((function(t){r.log(t,":",i(c[t]))})),t.groupEnd()},destroy:null,effects:function(t,n,a,c){var u,s=null===(u=t.context)||void 0===u?void 0:u.args,l=[e,t.name.toString()];if(t.isAsync&&("preEffects"===t.type?l.push(c?"START":"CANCELLED"):"effects"===t.type?l.push("DONE"):l.push("FAILED")),null!=a||s&&0!==Object.keys(s).length?r.group.apply(r,l):r.log.apply(r,l),s&&Object.keys(s).length>0&&(r.group("Arguments"),s.forEach((function(t){r.log(t,":",i(t))})),r.groupEnd()),null!=a){if(r.groupCollapsed("Before"),null==n)r.log("was null");else Object.keys(n).forEach((function(t){r.log(t,":",i(n[t]))}));if(r.groupEnd(),r.groupCollapsed("After"),null==a)r.log("was null");else Object.keys(a).forEach((function(t){r.log(t,":",i(a[t]))}));if(r.groupEnd(),null!=a){r.group("Diff");var f=function(t,e){var r={};"development"===process.env.NODE_ENV&&(t&&Object.keys(t).forEach((function(n){if(e.hasOwnProperty(n)){var i=t[n],a=e[n],c=o(i,a);c&&(r[n]=c)}else r[n]="was deleted"})),Object.keys(e).forEach((function(n){if(null==t||!t.hasOwnProperty(n)){var i=e[n];r[n]=o(void 0,i)}})));return r}(n,a);Object.keys(f).forEach((function(t){return r.log(t,":",f[t])})),r.groupEnd()}}return r.groupEnd(),null}}}return{init:function(){},destroy:null,effects:function(){return null}}}}function O(t){return function(){var e=null,r={history:null,optimisticActions:{},shouldRecordHistory:!1},n=function(e){return(t||g.clone)(e)},o=function(t,e){return"".concat(t,"_").concat(e)};function i(t,e,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=r.shouldRecordHistory,c=r.history;if(a){null===c&&(r.history=[]);var u=n(o);delete u.state,delete u.s,delete u.abortSignal,u.error=o.err,u.err=o.err;var s={effectType:e,actionName:t,promiseId:o.promiseId,ctx:u,beforeEffectState:i?n(i):null};r.history.push(s)}}function a(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,i=r.optimisticActions,a=r.history,c=o(t,e);delete i[c];var u=Object.keys(i);if(0===u.length)r.history=null,r.shouldRecordHistory=!1;else{var s=void 0===n?a.findIndex((function(t){return o(t.actionName,t.promiseId)===c})):n;if(0===s){var l=a.slice(1).findIndex((function(t){return null!=t.beforeEffectState}))+1;a.splice(0,l)}else void 0===n&&(a[s].beforeEffectState=null)}}return{init:function(t){e=t},destroy:function(){e=null,r.history=null,r.optimisticActions={},r.shouldRecordHistory=!1},effects:function(t,n,c,u){var s=t.name,l=t.type,f=t.context,p=t.isAsync;if((null!=c&&m(e.actions[s])||"onPropsChange"===s||null!=e.actions[s][l])&&i(s,l,f,null),p){var d=e.actions[s];if(u&&null!=d.optimisticEffects&&"preEffects"===l){r.shouldRecordHistory=!0,r.optimisticActions[o(s,f.promiseId)]=!0;var h=c||n;return i(s,"optimisticEffects",f,h),{loading:!1,state:d.optimisticEffects(E(E({},f),{},{state:h,s:h}))}}if(null!=d.optimisticEffects&&"effects"===l)return a(s,f.promiseId),{loading:u,state:c};if(null!=d.optimisticEffects&&"errorEffects"===l)return{state:function(t,n){for(var o=r.history,i=o.findIndex((function(e){return"optimisticEffects"===e.effectType&&e.actionName===t&&e.promiseId===n})),c=o[i].beforeEffectState,u=i+1;u<o.length;u++){var s=o[u];s.beforeEffectState&&(s.beforeEffectState=c);var l=E(E({},s.ctx),{},{state:c,s:c});c="onPropsChange"===s.actionName?(Array.isArray(e.options.onPropsChange)?e.options.onPropsChange:[e.options.onPropsChange])[l.index].effects(l):m(e.actions[s.actionName])?e.actions[s.actionName](l):e.actions[s.actionName][s.effectType](l)}return a(t,n,i),c}(s,f.promiseId),loading:u}}return null}}}}function _(){return function(){var t,e,r;try{t=window.__REDUX_DEVTOOLS_EXTENSION__||window.top.__REDUX_DEVTOOLS_EXTENSION__}catch(t){}return t?{init:function(n){var o,i;(e=t.connect({name:null!==(o=null===(i=n.options)||void 0===i?void 0:i.name)&&void 0!==o?o:"StateDecorator"})).init(n.state);var a=null,c=n.state;r=e.subscribe((function(t){var e,r,o,i;if("DISPATCH"===t.type&&t.state&&"ROLLBACK"!==(null===(e=t.payload)||void 0===e?void 0:e.type)){var u=JSON.parse(t.state);n.setState(u)}else"COMMIT"===(null===(r=t.payload)||void 0===r?void 0:r.type)?a=n.state:"ROLLBACK"===(null===(o=t.payload)||void 0===o?void 0:o.type)?null!=a&&n.setState(a):"RESET"===(null===(i=t.payload)||void 0===i?void 0:i.type)&&n.setState(c)}))},effects:function(t,r,n){if(null!=n){var o=E({},t.context);delete o.a,delete o.s,delete o.p,delete o.res,delete o.err,delete o.ds,e.send({type:"".concat(t.name," ").concat(t.type),args:o.args,context:o},n)}return null},destroy:function(){r(),e=null}}:{init:function(){},destroy:null,effects:function(){return null}}}}export{_ as devtools,w as logDetailedEffects,b as logEffects,O as optimisticActions};
2
2
  //# sourceMappingURL=middlewares.es.js.map