Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

redux-orm

Package Overview
Dependencies
Maintainers
4
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-orm - npm Package Compare versions

Comparing version 0.16.1 to 0.16.2

5

CHANGELOG.md
**Minor changes before v1.0.0 can include breaking changes.**
### 0.16.1
* Fixed map selectors being stored under the same key. ([ad9d0c7](https://github.com/redux-orm/redux-orm/commit/ad9d0c797130a90c293c605514defb4dbb8adea7))
* Prevent map selectors from returning unrelated refs. ([27bddb6](https://github.com/redux-orm/redux-orm/commit/27bddb6327896ac4161d7755b62dd69b230deba0))
### 0.16.0

@@ -4,0 +9,0 @@

2

dist/redux-orm.min.js

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("ReduxOrm",[],t):"object"==typeof exports?exports.ReduxOrm=t():e.ReduxOrm=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=33)}([function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}},function(e,t){e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},function(e,t,n){var r=n(14),o=n(15),s=n(16);e.exports=function(e){return r(e)||o(e)||s()}},function(e,t,n){"use strict";function r(e,t){return e===t}function o(e,t,n){if(null===t||null===n||t.length!==n.length)return!1;for(var r=t.length,o=0;o<r;o++)if(!e(t[o],n[o]))return!1;return!0}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r,n=null,s=null;return function(){return o(t,n,arguments)||(s=e.apply(null,arguments)),n=arguments,s}}function i(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every((function(e){return"function"==typeof e}))){var n=t.map((function(e){return typeof e})).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+n+"]")}return t}function a(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return function(){for(var t=arguments.length,r=Array(t),o=0;o<t;o++)r[o]=arguments[o];var a=0,c=r.pop(),u=i(r),l=e.apply(void 0,[function(){return a++,c.apply(null,arguments)}].concat(n)),d=s((function(){for(var e=[],t=u.length,n=0;n<t;n++)e.push(u[n].apply(null,arguments));return l.apply(null,e)}));return d.resultFunc=c,d.recomputations=function(){return a},d.resetRecomputations=function(){return a=0},d}}t.__esModule=!0,t.defaultMemoize=s,t.createSelectorCreator=a,t.createStructuredSelector=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c;if("object"!=typeof e)throw new Error("createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof e);var n=Object.keys(e);return t(n.map((function(t){return e[t]})),(function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.reduce((function(e,t,r){return e[n[r]]=t,e}),{})}))};var c=t.createSelector=a(s)},function(e,t,n){!function(e,t){"use strict";function n(e){return"string"==typeof e||"number"==typeof e}var r=function(){function e(){this._cache={}}var t=e.prototype;return t.set=function(e,t){this._cache[e]=t},t.get=function(e){return this._cache[e]},t.remove=function(e){delete this._cache[e]},t.clear=function(){this._cache={}},t.isValidCacheKey=function(e){return n(e)},e}(),o=r,s=function(){return!0};function i(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return function(e,r){if("function"==typeof r)throw new Error('[re-reselect] Second argument "options" must be an object. Please use "options.selectorCreator" to provide a custom selectorCreator.');var i={};"function"==typeof e?Object.assign(i,r,{keySelector:e}):Object.assign(i,e);var a=0,c=n.pop(),u=Array.isArray(n[0])?n[0]:[].concat(n);n.push((function(){return a++,c.apply(void 0,arguments)}));var l=i.cacheObject||new o,d=i.selectorCreator||t.createSelector,h=l.isValidCacheKey||s;i.keySelectorCreator&&(i.keySelector=i.keySelectorCreator({keySelector:i.keySelector,inputSelectors:u,resultFunc:c}));var f=function(){var e=i.keySelector.apply(i,arguments);if(h(e)){var t=l.get(e);return void 0===t&&(t=d.apply(void 0,n),l.set(e,t)),t.apply(void 0,arguments)}console.warn('[re-reselect] Invalid cache key "'+e+'" has been returned by keySelector function.')};return f.getMatchingSelector=function(){var e=i.keySelector.apply(i,arguments);return l.get(e)},f.removeMatchingSelector=function(){var e=i.keySelector.apply(i,arguments);l.remove(e)},f.clearCache=function(){l.clear()},f.resultFunc=c,f.dependencies=u,f.cache=l,f.recomputations=function(){return a},f.resetRecomputations=function(){return a=0},f.keySelector=i.keySelector,f}}function a(e){if(void 0===e)throw new Error('Missing the required property "cacheSize".');if(!Number.isInteger(e)||e<=0)throw new Error('The "cacheSize" property must be a positive integer value.')}var c=function(){function e(e){var t=(void 0===e?{}:e).cacheSize;a(t),this._cache={},this._cacheOrdering=[],this._cacheSize=t}var t=e.prototype;return t.set=function(e,t){if(this._cache[e]=t,this._cacheOrdering.push(e),this._cacheOrdering.length>this._cacheSize){var n=this._cacheOrdering[0];this.remove(n)}},t.get=function(e){return this._cache[e]},t.remove=function(e){var t=this._cacheOrdering.indexOf(e);t>-1&&this._cacheOrdering.splice(t,1),delete this._cache[e]},t.clear=function(){this._cache={},this._cacheOrdering=[]},t.isValidCacheKey=function(e){return n(e)},e}(),u=function(){function e(e){var t=(void 0===e?{}:e).cacheSize;a(t),this._cache={},this._cacheOrdering=[],this._cacheSize=t}var t=e.prototype;return t.set=function(e,t){if(this._cache[e]=t,this._registerCacheHit(e),this._cacheOrdering.length>this._cacheSize){var n=this._cacheOrdering[0];this.remove(n)}},t.get=function(e){return this._registerCacheHit(e),this._cache[e]},t.remove=function(e){this._deleteCacheHit(e),delete this._cache[e]},t.clear=function(){this._cache={},this._cacheOrdering=[]},t._registerCacheHit=function(e){this._deleteCacheHit(e),this._cacheOrdering.push(e)},t._deleteCacheHit=function(e){var t=this._cacheOrdering.indexOf(e);t>-1&&this._cacheOrdering.splice(t,1)},t.isValidCacheKey=function(e){return n(e)},e}(),l=function(){function e(){this._cache=new Map}var t=e.prototype;return t.set=function(e,t){this._cache.set(e,t)},t.get=function(e){return this._cache.get(e)},t.remove=function(e){this._cache.delete(e)},t.clear=function(){this._cache.clear()},e}(),d=function(){function e(e){var t=(void 0===e?{}:e).cacheSize;a(t),this._cache=new Map,this._cacheSize=t}var t=e.prototype;return t.set=function(e,t){if(this._cache.set(e,t),this._cache.size>this._cacheSize){var n=this._cache.keys().next().value;this.remove(n)}},t.get=function(e){return this._cache.get(e)},t.remove=function(e){this._cache.delete(e)},t.clear=function(){this._cache.clear()},e}(),h=function(){function e(e){var t=(void 0===e?{}:e).cacheSize;a(t),this._cache=new Map,this._cacheSize=t}var t=e.prototype;return t.set=function(e,t){if(this._cache.set(e,t),this._cache.size>this._cacheSize){var n=this._cache.keys().next().value;this.remove(n)}},t.get=function(e){var t=this._cache.get(e);return this._cache.has(e)&&(this.remove(e),this._cache.set(e,t)),t},t.remove=function(e){this._cache.delete(e)},t.clear=function(){this._cache.clear()},e}();e.FifoCacheObject=c,e.FifoMapCache=d,e.FifoObjectCache=c,e.FlatCacheObject=r,e.FlatMapCache=l,e.FlatObjectCache=r,e.LruCacheObject=h,e.LruMapCache=h,e.LruObjectCache=u,e.createStructuredCachedSelector=function(e){return t.createStructuredSelector(e,i)},e.default=i,Object.defineProperty(e,"__esModule",{value:!0})}(t,n(4))},function(e,t,n){var r=n(17),o=n(7),s=n(18),i=n(19),a=n(20),c=n(21),u=n(8);e.exports=function(e,t,n){var l=-1;t=r(t.length?t:[u],a(o));var d=s(e,(function(e,n,o){return{criteria:r(t,(function(t){return t(e)})),index:++l,value:e}}));return i(d,(function(e,t){return c(e,t,n)}))}},function(e,t){e.exports=function(e){return e}},function(e,t){e.exports=function(e){return e}},function(e,t){var n=Array.isArray;e.exports=n},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,s=[];++n<r;){var i=e[n];t(i,n,e)&&(s[o++]=i)}return s}},function(e,t,n){var r=n(6),o=n(9);e.exports=function(e,t,n,s){return null==e?[]:(o(t)||(t=null==t?[]:[t]),o(n=s?void 0:n)||(n=null==n?[]:[n]),r(e,t,n))}},function(e,t,n){var r=n(24),o=n(25),s=n(7),i=n(9),a=n(26);e.exports=function(e,t){return(i(e)?r:o)(e,a(s(t,3)))}},function(e,t,n){var r=n(27),o=n(6),s=n(28),i=n(32),a=s((function(e,t){if(null==e)return[];var n=t.length;return n>1&&i(e,t[0],t[1])?t=[]:n>2&&i(t[0],t[1],t[2])&&(t=[t[0]]),o(e,r(t,1),[])}));e.exports=a},function(e,t){e.exports=function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}},function(e,t){e.exports=function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}},function(e,t){e.exports=function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}},function(e,t){e.exports=function(e){return function(t){return e(t)}}},function(e,t,n){var r=n(22);e.exports=function(e,t,n){for(var o=-1,s=e.criteria,i=t.criteria,a=s.length,c=n.length;++o<a;){var u=r(s[o],i[o]);if(u)return o>=c?u:u*("desc"==n[o]?-1:1)}return e.index-t.index}},function(e,t,n){var r=n(23);e.exports=function(e,t){if(e!==t){var n=void 0!==e,o=null===e,s=e==e,i=r(e),a=void 0!==t,c=null===t,u=t==t,l=r(t);if(!c&&!l&&!i&&e>t||i&&a&&u&&!c&&!l||o&&a&&u||!n&&u||!s)return 1;if(!o&&!i&&!l&&e<t||l&&n&&s&&!o&&!i||c&&n&&s||!a&&s||!u)return-1}return 0}},function(e,t){e.exports=function(){return!1}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,s=[];++n<r;){var i=e[n];t(i,n,e)&&(s[o++]=i)}return s}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,s=[];++n<r;){var i=e[n];t(i,n,e)&&(s[o++]=i)}return s}},function(e,t){var n="Expected a function";e.exports=function(e){if("function"!=typeof e)throw new TypeError(n);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}},function(e,t){e.exports=function(e){return e&&e.length?e[0]:void 0}},function(e,t,n){var r=n(8),o=n(29),s=n(31);e.exports=function(e,t){return s(o(e,t,r),e+"")}},function(e,t,n){var r=n(30),o=Math.max;e.exports=function(e,t,n){return t=o(void 0===t?e.length-1:t,0),function(){for(var s=arguments,i=-1,a=o(s.length-t,0),c=Array(a);++i<a;)c[i]=s[t+i];i=-1;for(var u=Array(t+1);++i<t;)u[i]=s[i];return u[t]=n(c),r(e,this,u)}}},function(e,t){e.exports=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}},function(e,t){e.exports=function(e){return e}},function(e,t){e.exports=function(){return!1}},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n.n(r),s=n(3),i=n.n(s),a=n(2),c=n.n(a);function u(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function l(e){return function t(n){return 0===arguments.length||u(n)?t:e.apply(this,arguments)}}function d(e,t){switch(e){case 0:return function(){return t.apply(this,arguments)};case 1:return function(e){return t.apply(this,arguments)};case 2:return function(e,n){return t.apply(this,arguments)};case 3:return function(e,n,r){return t.apply(this,arguments)};case 4:return function(e,n,r,o){return t.apply(this,arguments)};case 5:return function(e,n,r,o,s){return t.apply(this,arguments)};case 6:return function(e,n,r,o,s,i){return t.apply(this,arguments)};case 7:return function(e,n,r,o,s,i,a){return t.apply(this,arguments)};case 8:return function(e,n,r,o,s,i,a,c){return t.apply(this,arguments)};case 9:return function(e,n,r,o,s,i,a,c,u){return t.apply(this,arguments)};case 10:return function(e,n,r,o,s,i,a,c,u,l){return t.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function h(e){return function t(n,r){switch(arguments.length){case 0:return t;case 1:return u(n)?t:l((function(t){return e(n,t)}));default:return u(n)&&u(r)?t:u(n)?l((function(t){return e(t,r)})):u(r)?l((function(t){return e(n,t)})):e(n,r)}}}var f=h((function(e,t){return 1===e?l(t):d(e,function e(t,n,r){return function(){for(var o=[],s=0,i=t,a=0;a<n.length||s<arguments.length;){var c;a<n.length&&(!u(n[a])||s>=arguments.length)?c=n[a]:(c=arguments[s],s+=1),o[a]=c,u(c)||(i-=1),a+=1}return i<=0?r.apply(this,o):d(i,e(t,o,r))}}(e,[],t))})),p=l((function(e){return f(e.length,e)})),m={"@@functional/placeholder":!0};function y(e,t){for(var n in e)e.hasOwnProperty(n)&&t(e[n],n)}var g="@@_______immutableOpsOwnerID";function b(e,t){return!!t&&e[g]===t}var w="function"==typeof Symbol?function(){return Symbol("ownerID")}:function(){return{}};function v(e,t){return t&&function(e,t){Object.defineProperty(e,g,{value:t,configurable:!0,enumerable:!1})}(e,t),e}function _(e){return e instanceof Array?e:[e]}var M=".";function O(e){return"string"==typeof e?-1===e.indexOf(M)?[e]:e.split(M):e}function N(e,t,n){return n[e]=t,n}function S(e,t,n){var r=_(t);return e?r.forEach((function(t){y(t,(function(t,r){var o;e&&n.hasOwnProperty(r)?(o="object"===c()(t)?S(e,[t],n[r]):t,n[r]=o):n[r]=t}))})):Object.assign.apply(Object,[n].concat(i()(r))),n}var k=S.bind(null,!1),E=S.bind(null,!0);function j(e,t){return _(e).forEach((function(e){delete t[e]})),t}function x(e,t,n){return e[n]!==t[n]}function F(e,t,n,r){if(b(r,t))return S(e,n,r);var o=_(n),s=!1,i=r,a=function(){s||(s=!0,v(i=Object.assign({},r),t))};return o.forEach((function(n){y(n,(function(o,s){if(e&&r.hasOwnProperty(s)){var u=i[s];if("object"===c()(o)&&!(o instanceof Array)){if(x(i,n,s)){var l=F(e,t,o,u);l!==u&&(a(),i[s]=l)}return!0}}x(i,n,s)&&(a(),i[s]=o)}))})),i}var C=F.bind(null,!0);function A(e,t,n,r){if(b(r,e))return N(t,n,r);if(r[t]===n)return r;var o=function(e){for(var t=new Array(e.length),n=0;n<e.length;n++)t[n]=e[n];return t}(r);return o[t]=n,v(o,e),o}function I(e,t){for(var n=0,r=0;n<t.length;){e(t[n],r)?n++:t.splice(n,1),r++}return t}function R(e,t,n,r){var o=_(n);return r.splice.apply(r,[e,t].concat(i()(o))),r}function D(e,t,n){return R(e,0,t,n)}function $(e,t,n,r,o){if(b(o,e))return R(t,n,r,o);var s=_(r),a=o.slice();return v(a,e),a.splice.apply(a,[t,n].concat(i()(s))),a}function T(e,t,n,r){return b(r,e)?D(t,n,r):$(e,t,0,n,r)}var P={merge:F.bind(null,!1),deepMerge:C,omit:function(e,t,n){if(b(n,e))return j(t,n);var r=_(t).filter((function(e){return n.hasOwnProperty(e)}));if(0===r.length)return n;var o=Object.assign({},n);return r.forEach((function(e){delete o[e]})),v(o,e),o},setIn:function(e,t,n,r){var o=O(t),s=function(e,t){for(var n=O(e),r=t,o=0;o<n.length;o++){var s=r[n[o]];if(o===n.length-1)return s;if("object"!==c()(s))return;r=s}}(o,r);if(n===s)return r;var i,a=o.length,u=i=b(r,e)?r:Object.assign(v({},e),r);return o.forEach((function(t,r){if(r!==a-1){var s=i[t],u=c()(s);if("object"!==u){if("undefined"===u){var l=v({},e);return i[t]=l,void(i=l)}var d="".concat(o[r-1],".").concat(t);throw new Error("A non-object value was encountered when traversing setIn path at ".concat(d,"."))}if(b(s,e))i=s;else{var h=v({},e);i[t]=Object.assign(h,s),i=h}}else i[t]=n})),u},insert:T,push:function(e,t,n){return T(e,n.length,t,n)},filter:function(e,t,n){if(b(n,e))return I(t,n);var r=n.filter(t);return r.length===n.length?n:(v(r,e),r)},splice:$,set:function(e,t,n,r){if(function(e){return e&&"object"===c()(e)&&"number"==typeof e.length&&e.length>=0&&e.length%1==0}(r))return A(e,t,n,r);if(b(r,e))return N(t,n,r);if(r[t]===n)return r;var o=Object.assign({},r);return v(o,e),o[t]=n,o}},B={merge:k,deepMerge:E,omit:j,setIn:function(e,t,n){for(var r=O(e),o=r.length,s=!1,i=0,a=n,u=r[i];!s;)if(i===o-1)a[u]=t,s=!0;else{var l=c()(a[u]);if("undefined"===l){var d={};v(d,null),a[u]=d}else if("object"!==l){var h="".concat(r[i-1],".").concat(u);throw new Error("A non-object value was encountered when traversing setIn path at ".concat(h,"."))}a=a[u],u=r[++i]}return n},insert:D,push:function(e,t){var n=_(e);return t.push.apply(t,i()(n)),t},filter:I,splice:R,set:N};var V=function(){var e=Object.assign({},P);y(e,(function(t,n){e[n]=p(t.bind(null,null))}));var t=Object.assign({},B);y(t,(function(e,n){t[n]=p(e)}));var n=Object.assign({},P);return y(n,(function(e,t){n[t]=p(e)})),Object.assign(e,{mutable:t,batch:n,batched:function(e,t){var n,r;"function"==typeof e?(r=e,n=w()):(n=e,r=t);var o=Object.assign({},P);return y(o,(function(e,t){o[t]=p(e.bind(null,n))})),r(o)},__:m,getBatchToken:w})}();const U="REDUX_ORM_UPDATE",q="REDUX_ORM_DELETE",z="REDUX_ORM_CREATE",L="REDUX_ORM_FILTER",Q="REDUX_ORM_EXCLUDE",X="SUCCESS",H=Symbol("REDUX_ORM_ALL_INSTANCES"),Y=(e,t)=>void 0===t?H:t;function K(e){return("function"==typeof console.warn?console.warn.bind(console):console.log.bind(console))(e)}function G(e,t){return e+((n=t).charAt(0).toUpperCase()+n.slice(1));var n}function J(e){return`from${e}Id`}function W(e){return`to${e}Id`}function Z(e){return function(...t){return this.getQuerySet()[e](...t)}}function ee(e){return function(){return this.getQuerySet()[e]}}function te(e,t){const n=t.sharedMethods.slice();!function(e,t){let n=e;for(;n!==Function.prototype;)t(n),n=Object.getPrototypeOf(n)}(t,t=>{for(let r=0;r<n.length;r++){let o=!1;const s=n[r],i=Object.getOwnPropertyDescriptor(t.prototype,s);void 0!==i&&(void 0!==i.get?(i.get=ee(s),Object.defineProperty(e,s,i)):e[s]=Z(s),o=!0),o&&n.splice(r--,1)}})}function ne(e){return null!=e&&"function"==typeof e.getId?e.getId():e}const{getBatchToken:re}=V;function oe({type:e,payload:t},n){if(e!==L)return!1;if("object"!=typeof t)return!1;if(!t.hasOwnProperty(n))return!1;const r=t[n];return null!==r&&void 0!==r}function se(e,t){return Object.entries(e).reduce((e,[n,r])=>(e[n]=t(r),e),{})}function ie(e){return e&&"string"!=typeof e?e.modelName:e}const ae=function(){function e(e,t,n){Object.assign(this,{modelClass:e,clauses:t||[]}),this._opts=n}e.addSharedMethod=function(e){this.sharedMethods=this.sharedMethods.concat(e)};var t=e.prototype;return t._new=function(e,t){const n={...this._opts,...t};return new this.constructor(this.modelClass,e,n)},t.toString=function(){return this._evaluate(),`QuerySet contents:\n - ${this.rows.map(({id:e})=>this.modelClass.withId(e).toString()).join("\n - ")}`},t.toRefArray=function(){return this._evaluate()},t.toModelArray=function(){const{modelClass:e}=this;return this._evaluate().map(t=>new e(t))},t.count=function(){return this._evaluate(),this.rows.length},t.exists=function(){return Boolean(this.count())},t.at=function(e){const{modelClass:t}=this,n=this._evaluate();if(e>=0&&e<n.length)return new t(n[e])},t.first=function(){return this.at(0)},t.last=function(){const e=this._evaluate();return this.at(e.length-1)},t.all=function(){return this._new(this.clauses)},t.filter=function(e){const t="object"==typeof e?se(e,ne):e,n={type:L,payload:t};return this._new(this.clauses.concat(n))},t.exclude=function(e){const t="object"==typeof e?se(e,ne):e,n={type:Q,payload:t};return this._new(this.clauses.concat(n))},t._evaluate=function(){if(void 0===this.modelClass.session)throw new Error([`Tried to query the ${this.modelClass.modelName} model's table without a session. `,"Create a session using `session = orm.session()` and use ",`\`session["${this.modelClass.modelName}"]\` for querying instead.`].join(""));if(!this._evaluated){const{session:e,modelName:t}=this.modelClass,n={table:t,clauses:this.clauses};this.rows=e.query(n).rows,this._evaluated=!0}return this.rows},t.orderBy=function(e,t){const n={type:"REDUX_ORM_ORDER_BY",payload:[e,t]};return this._new(this.clauses.concat(n))},t.update=function(e){const{session:t,modelName:n}=this.modelClass;t.applyUpdate({action:U,query:{table:n,clauses:this.clauses},payload:e}),this._evaluated=!1},t.delete=function(){const{session:e,modelName:t}=this.modelClass;this.toModelArray().forEach(e=>e._onDelete()),e.applyUpdate({action:q,query:{table:t,clauses:this.clauses}}),this._evaluated=!1},t.map=function(){throw new Error("`QuerySet.prototype.map` has been removed. Call `.toModelArray()` or `.toRefArray()` first to map.")},t.forEach=function(){throw new Error("`QuerySet.prototype.forEach` has been removed. Call `.toModelArray()` or `.toRefArray()` first to iterate.")},o()(e,[{key:"withModels",get:function(){throw new Error("`QuerySet.prototype.withModels` has been removed. Use `.toModelArray()` or predicate functions that instantiate Models from refs, e.g. `new Model(ref)`.")}},{key:"withRefs",get:function(){K("`QuerySet.prototype.withRefs` has been deprecated. Query building operates on refs only now.")}}]),e}();ae.sharedMethods=["count","at","all","last","first","filter","exclude","orderBy","update","delete"];var ce=ae;var ue=function(){function e(e,t,n,r,o){this.schema=e,this.db=t,this.state=n||t.getEmptyState(),this.initialState=this.state,this.withMutations=Boolean(r),this.batchToken=o||w(),this.modelData={},this.models=e.getModelClasses(),this.sessionBoundModels=this.models.map(e=>{function t(){return Reflect.construct(e,arguments,t)}return Reflect.setPrototypeOf(t.prototype,e.prototype),Reflect.setPrototypeOf(t,e),Object.defineProperty(this,e.modelName,{get:()=>t}),t.connect(this),t})}var t=e.prototype;return t.getDataForModel=function(e){return this.modelData[e]||(this.modelData[e]={}),this.modelData[e]},t.getModelData=function(){return this.modelData},t.markAccessed=function(e,t){const n=this.getDataForModel(e);n.accessedInstances||(n.accessedInstances={}),t.forEach(e=>{n.accessedInstances[e]=!0})},t.markFullTableScanned=function(e){this.getDataForModel(e).fullTableScanned=!0},t.markAccessedIndexes=function(e){e.forEach(([e,t,n])=>{const r=this.getDataForModel(e);r.accessedIndexes||(r.accessedIndexes={}),r.accessedIndexes[t]=[...r.accessedIndexes[t]||[],n]})},t.applyUpdate=function(e){const t=this._getTransaction(e),n=this.db.update(e,t,this.state),{status:r,state:o,payload:s}=n;if(r!==X)throw new Error(`Applying update failed with status ${r}. Payload: ${s}`);return this.state=o,s},t.query=function(e){const t=this.db.query(e,this.state);return this._markAccessedByQuery(e,t),t},t._getTransaction=function(e){const{withMutations:t}=this,{action:n}=e;let{batchToken:r}=this;return[U,q].includes(n)&&(r=w()),{batchToken:r,withMutations:t}},t._markAccessedByQuery=function(e,t){const{table:n,clauses:r}=e,{rows:o}=t,{idAttribute:s}=this[n],i=new Set(o.map(e=>e[s])),a=r.some(e=>!!oe(e,s)&&(i.add(e.payload[s]),!0)),c=[],{indexes:u}=this.state[n];r.forEach(e=>{Object.keys(u).forEach(t=>{if(!oe(e,t))return;const r=e.payload[t];c.push([n,t,r])})}),a?this.markAccessed(n,i):c.length?(this.markAccessed(n,i),this.markAccessedIndexes(c)):this.markFullTableScanned(n)},t.getNextState=function(){return K("`Session.prototype.getNextState` has been deprecated. Access the `Session.prototype.state` property instead."),this.state},t.reduce=function(){throw new Error("`Session.prototype.reduce` has been removed. The Redux integration API is now decoupled from ORM and Session - see the 0.9 migration guide in the GitHub repo.")},o()(e,[{key:"accessedModelInstances",get:function(){return Object.entries(this.getModelData()).reduce((e,[t,n])=>(n.accessedInstances&&(e[t]=n.accessedInstances),e),{})}},{key:"fullTableScannedModels",get:function(){return Object.entries(this.getModelData()).reduce((e,[t,n])=>(n.fullTableScanned&&e.push(t),e),[])}},{key:"accessedIndexes",get:function(){return Object.entries(this.getModelData()).reduce((e,[t,n])=>(n.accessedIndexes&&(e[t]=n.accessedIndexes),e),{})}}]),e}(),le=n(1),de=n.n(le);var he=function(e){function t(){return e.apply(this,arguments)||this}de()(t,e);var n=t.prototype;return n.installForwardsDescriptor=function(){Object.defineProperty(this.model.prototype,this.fieldName,this.field.createForwardsDescriptor(this.fieldName,this.model,this.toModel,this.throughModel))},n.installForwardsVirtualField=function(){this.model.virtualFields[this.fieldName]=this.field.createForwardsVirtualField(this.fieldName,this.model,this.toModel,this.throughModel)},n.installBackwardsDescriptor=function(){if(Object.getOwnPropertyDescriptor(this.toModel.prototype,this.backwardsFieldName))throw new Error((e=this.model.modelName,t=this.fieldName,n=this.toModel.modelName,[`Reverse field ${this.backwardsFieldName} already defined`,` on model ${n}. To fix, set a custom related`,` name on ${e}.${t}.`].join("")));var e,t,n;Object.defineProperty(this.toModel.prototype,this.backwardsFieldName,this.field.createBackwardsDescriptor(this.fieldName,this.model,this.toModel,this.throughModel))},n.installBackwardsVirtualField=function(){this.toModel.virtualFields[this.backwardsFieldName]=this.field.createBackwardsVirtualField(this.fieldName,this.model,this.toModel,this.throughModel)},t}(function(){function e(e){this.field=e.field,this.fieldName=e.fieldName,this.model=e.model,this.orm=e.orm,this.field.references(this.model)&&(this.field.toModelName="this")}return e.prototype.run=function(){this.installForwardsDescriptor(),this.field.installsForwardsVirtualField&&this.installForwardsVirtualField(),this.field.installsBackwardsDescriptor&&this.installBackwardsDescriptor(),this.field.installsBackwardsVirtualField&&this.installBackwardsVirtualField()},o()(e,[{key:"toModel",get:function(){if(void 0===this._toModel){const{toModelName:e}=this.field;this._toModel=e?"this"===e?this.model:this.orm.get(e):null}return this._toModel}},{key:"throughModel",get:function(){if(void 0===this._throughModel){const e=this.field.getThroughModelName(this.fieldName,this.model);this._throughModel=e?this.orm.get(e):null}return this._throughModel}},{key:"backwardsFieldName",get:function(){return this.field.getBackwardsFieldName(this.model)}}]),e}());var fe=function(){function e(){}var t=e.prototype;return t.getClass=function(){return this.constructor},t.references=function(e){return!1},t.getThroughModelName=function(e,t){return null},o()(e,[{key:"installerClass",get:function(){return he}},{key:"installsForwardsVirtualField",get:function(){return!1}},{key:"installsBackwardsDescriptor",get:function(){return!1}},{key:"installsBackwardsVirtualField",get:function(){return!1}},{key:"index",get:function(){return!1}}]),e}();function pe(e,t){return{get(){const{session:{[t]:n}}=this.getClass(),{[e]:r}=this._fields;return n.withId(r)},set(t){this.update({[e]:ne(t)})}}}function me(e,t,n,r,o){return{get(){const{session:{[e]:s,[t]:i,[n]:a}}=this.getClass(),c=o?i:s,u=o?s:i,l=o?r.to:r.from,d=o?r.from:r.to,h=this.getId(),f=a.filter({[l]:h}),p=new Set(f.toRefArray().map(e=>e[d])),m=u.filter(e=>p.has(e[u.idAttribute]));return m.add=function(...e){const t=new Set(e.map(ne)),n=f.filter(e=>t.has(e[d]));if(n.exists()){const e=n.toRefArray().map(e=>e[d]);throw new Error(`Tried to add already existing ${u.modelName} id(s) ${e} to the ${c.modelName} instance with id ${h}`)}t.forEach(e=>{a.create({[d]:e,[l]:h})})},m.clear=function(){f.delete()},m.remove=function(...e){const t=new Set(e.map(ne)),n=f.filter(e=>t.has(e[d]));if(n.count()!==t.size){const e=n.toRefArray().map(e=>e[d]),r=[...t].filter(t=>!e.includes(t));throw new Error(`Tried to delete non-existing ${u.modelName} id(s) ${r} from the ${c.modelName} instance with id ${h}`)}n.delete()},m},set(){throw new Error("Tried setting a M2M field. Please use the related QuerySet methods add, remove and clear.")}}}var ye=function(e){function t(t){var n;return(n=e.call(this)||this).opts=t||{},n.opts.hasOwnProperty("getDefault")&&(n.getDefault=n.opts.getDefault),n}return de()(t,e),t.prototype.createForwardsDescriptor=function(e,t){return function(e){return{get(){return this._fields[e]},set(t){return this.set(e,t)},enumerable:!0,configurable:!0}}(e)},t}(fe);var ge=function(e){function t(...t){var n;if(n=e.call(this)||this,1===t.length&&"object"==typeof t[0]){const e=t[0];n.toModelName=ie(e.to),n.relatedName=e.relatedName,n.through=ie(e.through),n.throughFields=e.throughFields,n.as=e.as}else[n.toModelName,n.relatedName]=[ie(t[0]),t[1]];return n}de()(t,e);var n=t.prototype;return n.getBackwardsFieldName=function(e){return this.relatedName||e.modelName.toLowerCase()+"Set"},n.createBackwardsVirtualField=function(e,t,n,r){return new(this.getClass())(t.modelName,e)},n.references=function(e){return this.toModelName===e.modelName},o()(t,[{key:"installsBackwardsVirtualField",get:function(){return!0}},{key:"installsBackwardsDescriptor",get:function(){return!0}},{key:"installerClass",get:function(){return function(e){function t(){return e.apply(this,arguments)||this}return de()(t,e),t.prototype.installForwardsDescriptor=function(){Object.defineProperty(this.model.prototype,this.field.as||this.fieldName,this.field.createForwardsDescriptor(this.fieldName,this.model,this.toModel,this.throughModel))},t}(he)}}]),t}(fe);var be=function(e){function t(){return e.apply(this,arguments)||this}de()(t,e);var n=t.prototype;return n.createForwardsDescriptor=function(e,t,n,r){return pe(e,n.modelName)},n.createBackwardsDescriptor=function(e,t,n,r){return o=e,s=t.modelName,{get(){const{session:{[s]:e}}=this.getClass();return e.filter({[o]:this.getId()})},set(){throw new Error("Can't mutate a reverse many-to-one relation.")}};var o,s},o()(t,[{key:"index",get:function(){return!0}}]),t}(ge);var we=function(e){function t(){return e.apply(this,arguments)||this}de()(t,e);var n=t.prototype;return n.getDefault=function(){return[]},n.getThroughModelName=function(e,t){return this.through||G(t.modelName,e)},n.createForwardsDescriptor=function(e,t,n,r){return me(t.modelName,n.modelName,r.modelName,this.getThroughFields(e,t,n,r),!1)},n.createBackwardsDescriptor=function(e,t,n,r){return me(t.modelName,n.modelName,r.modelName,this.getThroughFields(e,t,n,r),!0)},n.createBackwardsVirtualField=function(e,t,n,r){return new(this.getClass())({to:t.modelName,relatedName:e,through:r.modelName,throughFields:this.getThroughFields(e,t,n,r)})},n.createForwardsVirtualField=function(e,t,n,r){return new(this.getClass())({to:n.modelName,relatedName:e,through:this.through,throughFields:this.getThroughFields(e,t,n,r),as:this.as})},n.getThroughFields=function(e,t,n,r){if(this.throughFields){const[e,t]=this.throughFields,o=r.fields[e];return{to:o.references(n)?e:t,from:o.references(n)?t:e}}if(t.modelName===n.modelName)return{to:W(n.modelName),from:J(t.modelName)};const o=e=>Object.keys(r.fields).find(t=>r.fields[t].references(e));return{to:o(n),from:o(t)}},o()(t,[{key:"installsForwardsVirtualField",get:function(){return!0}}]),t}(ge);var ve=function(e){function t(){return e.apply(this,arguments)||this}de()(t,e);var n=t.prototype;return n.getBackwardsFieldName=function(e){return this.relatedName||e.modelName.toLowerCase()},n.createForwardsDescriptor=function(e,t,n,r){return function(...e){return pe(...e)}(e,n.modelName)},n.createBackwardsDescriptor=function(e,t,n,r){return o=e,s=t.modelName,{get(){const{session:{[s]:e}}=this.getClass();return e.get({[o]:this.getId()})},set(){throw new Error("Can't mutate a reverse one-to-one relation.")}};var o,s},t}(ge);function _e(e){return new ye(e)}function Me(...e){return new be(...e)}function Oe(...e){return new we(...e)}function Ne(...e){return new ve(...e)}function Se(e){const t=e.getClass(),{idAttribute:n,modelName:r}=t;return{table:r,clauses:[{type:L,payload:{[n]:e.getId()}}]}}const ke=function(){function e(e){this._initFields(e)}var t=e.prototype;return t._initFields=function(e){const t=Object(e);this._fields={...t},Object.keys(t).forEach(e=>{e in this||Object.defineProperty(this,e,{get:()=>this._fields[e],set:t=>this.set(e,t),configurable:!0,enumerable:!0})})},e.toString=function(){return`ModelClass: ${this.modelName}`},e.options=function(){return{}},e.markAccessed=function(e){if(void 0===this._session)throw new Error([`Tried to mark rows of the ${this.modelName} model as accessed without a session. `,"Create a session using `session = orm.session()` and call ",`\`session["${this.modelName}"].markAccessed\` instead.`].join(""));this.session.markAccessed(this.modelName,e)},e.markFullTableScanned=function(){if(void 0===this._session)throw new Error([`Tried to mark the ${this.modelName} model as full table scanned without a session. `,"Create a session using `session = orm.session()` and call ",`\`session["${this.modelName}"].markFullTableScanned\` instead.`].join(""));this.session.markFullTableScanned(this.modelName)},e.markAccessedIndexes=function(e){if(void 0===this._session)throw new Error([`Tried to mark indexes for the ${this.modelName} model as accessed without a session. `,"Create a session using `session = orm.session()` and call ",`\`session["${this.modelName}"].markAccessedIndexes\` instead.`].join(""));this.session.markAccessedIndexes(e.map(([e,t])=>[this.modelName,e,t]))},e.connect=function(e){if(!(e instanceof ue))throw new Error("A model can only be connected to instances of Session.");this._session=e},e.getQuerySet=function(){const{querySetClass:e}=this;return new e(this)},e.invalidateClassCache=function(){this.isSetUp=void 0,this.virtualFields={}},e.tableOptions=function(){return"function"==typeof this.backend?(K("`Model.backend` has been deprecated. Please rename to `.options`."),this.backend()):this.backend?(K("`Model.backend` has been deprecated. Please rename to `.options`."),this.backend):"function"==typeof this.options?this.options():this.options},e.create=function(e){if(void 0===this._session)throw new Error([`Tried to create a ${this.modelName} model instance without a session. `,"Create a session using `session = orm.session()` and call ",`\`session["${this.modelName}"].create\` instead.`].join(""));const t={...e},n={},r=Object.keys(this.fields),o=Object.keys(this.virtualFields);r.forEach(r=>{const o=this.fields[r],s=e.hasOwnProperty(r);if(o instanceof we)s&&(n[r]=e[r],o.as||delete t[r]);else if(s){const n=e[r];t[r]=ne(n)}else o.getDefault&&(t[r]=o.getDefault())}),o.forEach(r=>{if(!n.hasOwnProperty(r)){const o=this.virtualFields[r];e.hasOwnProperty(r)&&o instanceof we&&(n[r]=e[r],delete t[r])}});const s=new this(this.session.applyUpdate({action:z,table:this.modelName,payload:t}));return s._refreshMany2Many(n),s},e.upsert=function(e){if(void 0===this.session)throw new Error([`Tried to upsert a ${this.modelName} model instance without a session. `,"Create a session using `session = orm.session()` and call ",`\`session["${this.modelName}"].upsert\` instead.`].join(""));const{idAttribute:t}=this;if(e.hasOwnProperty(t)){const n=e[t];if(this.idExists(n)){const t=this.withId(n);return t.update(e),t}}return this.create(e)},e.withId=function(e){return this.get({[this.idAttribute]:e})},e.idExists=function(e){return this.exists({[this.idAttribute]:e})},e.exists=function(e){if(void 0===this.session)throw new Error([`Tried to check if a ${this.modelName} model instance exists without a session. `,"Create a session using `session = orm.session()` and call ",`\`session["${this.modelName}"].exists\` instead.`].join(""));return Boolean(this._findDatabaseRows(e).length)},e.get=function(e){const t=this._findDatabaseRows(e);if(0===t.length)return null;if(t.length>1)throw new Error(`Expected to find a single row in \`${this.modelName}.get\`. Found ${t.length}.`);return new this(t[0])},t.getClass=function(){return this.constructor},t.getId=function(){return this._fields[this.getClass().idAttribute]},e._findDatabaseRows=function(e){const t={table:this.modelName};return e&&(t.clauses=[{type:L,payload:e}]),this.session.query(t).rows},t.toString=function(){const e=this.getClass();return`${e.modelName}: {${Object.keys(e.fields).map(t=>{if(e.fields[t]instanceof we){return`${t}: [${this[t].toModelArray().map(e=>e.getId()).join(", ")}]`}return`${t}: ${this._fields[t]}`}).join(", ")}}`},t.equals=function(e){return function(e,t){const n=Object.entries(Object(e));return n.length===Object.keys(t).length&&n.every(([e,n])=>t.hasOwnProperty(e)&&t[e]===n)}(this._fields,e._fields)},t.set=function(e,t){this.update({[e]:t})},t.update=function(e){const t=this.getClass();if(void 0===t.session)throw new Error([`Tried to update a ${t.modelName} model instance without a session. `,"You cannot call `.update` on an instance that you did not receive from the database."].join(""));const n={...e},{fields:r,virtualFields:o}=t,s={};for(const e in n){if(r.hasOwnProperty(e)){const t=r[e];t instanceof be||t instanceof ve?n[e]=ne(n[e]):t instanceof we&&(s[e]=n[e],t.as||delete n[e])}else if(o.hasOwnProperty(e)){o[e]instanceof we&&(s[e]=n[e],delete n[e])}}const i={...this._fields,...n},a=new t(i);this.equals(a)||(this._initFields(i),t.session.applyUpdate({action:U,query:Se(this),payload:n})),this._refreshMany2Many(s)},t.refreshFromState=function(){this._initFields(this.ref)},t.delete=function(){const e=this.getClass();if(void 0===e.session)throw new Error([`Tried to delete a ${e.modelName} model instance without a session. `,"You cannot call `.delete` on an instance that you did not receive from the database."].join(""));this._onDelete(),e.session.applyUpdate({action:q,query:Se(this)})},t._refreshMany2Many=function(e){const t=this.getClass(),{fields:n,virtualFields:r,modelName:o}=t;Object.keys(e).forEach(s=>{const i=!n.hasOwnProperty(s),a=r[s],c=e[s];if(!Array.isArray(c))throw new TypeError(`Failed to resolve many-to-many relationship: ${o}[${s}] must be an array (passed: ${c})`);const u=c.map(ne),l=[...new Set(u)];if(u.length!==l.length)throw new Error(`Found duplicate id(s) when passing "${u}" to ${t.modelName}.${s} value`);const d=a.through||G(t.modelName,s),h=t.session[d];let f,p;i?({from:p,to:f}=a.throughFields):({from:f,to:p}=a.throughFields);const m=function(e,t){const n=e.filter(e=>t.includes(e)),r=e.filter(e=>!n.includes(e)),o=t.filter(e=>!n.includes(e));return r.length||o.length?{delete:r,add:o}:null}(h.filter(e=>e[f]===this[t.idAttribute]).toRefArray().map(e=>e[p]),u);if(m){const{delete:e,add:t}=m;e.length>0&&this[a.as||s].remove(...e),t.length>0&&this[a.as||s].add(...t)}})},t._onDelete=function(){const{virtualFields:e}=this.getClass();for(const t in e){const n=e[t];if(n instanceof we)this[t].clear();else if(n instanceof be){const e=this[t];e.exists()&&e.update({[n.relatedName]:null})}else n instanceof ve&&null!==this[t]&&(this[t][n.relatedName]=null)}},e.hasId=function(e){return console.warn("`Model.hasId` has been deprecated. Please use `Model.idExists` instead."),this.idExists(e)},t.getNextState=function(){throw new Error("`Model.prototype.getNextState` has been removed. See the 0.9 migration guide on the GitHub repo.")},o()(e,[{key:"ref",get:function(){const e=this.getClass();return e._findDatabaseRows({[e.idAttribute]:this.getId()})[0]}}],[{key:"idAttribute",get:function(){if(void 0===this._session)throw new Error([`Tried to get the ${this.modelName} model's id attribute without a session. `,"Create a session using `session = orm.session()` and access ",`\`session["${this.modelName}"].idAttribute\` instead.`].join(""));return this.session.db.describe(this.modelName).idAttribute}},{key:"session",get:function(){return this._session}},{key:"query",get:function(){return this.getQuerySet()}}]),e}();ke.fields={id:_e()},ke.virtualFields={},ke.querySetClass=ce;var Ee=ke,je=n(10),xe=n.n(je),Fe=n(11),Ce=n.n(Fe),Ae=n(12),Ie=n.n(Ae),Re=n(13),De=n.n(Re);const $e={idAttribute:"id",arrName:"items",mapName:"itemsById",fields:{}};var Te=function(){function e(e){Object.assign(this,$e,e)}var t=e.prototype;return t.accessId=function(e,t){return e[this.mapName][t]},t.accessIds=function(e,t){const n=e[this.mapName];return t.map(e=>n[e])},t.idExists=function(e,t){return e[this.mapName].hasOwnProperty(t)},t.accessIdList=function(e){return e[this.arrName]},t.accessList=function(e){return this.accessIds(e,this.accessIdList(e))},t.getMaxId=function(e){return this.getMeta(e,"maxId")},t.setMaxId=function(e,t,n){return this.setMeta(e,t,"maxId",n)},t.nextId=function(e){return e+1},t.getEmptyState=function(){return{...{[this.arrName]:[],[this.mapName]:{}},indexes:Object.keys(this.fields).filter(e=>e!==this.idAttribute).filter(e=>this.fields[e].index).reduce((e,t)=>({...e,[t]:{}}),{}),meta:{}}},t.setMeta=function(e,t,n,r){const{batchToken:o,withMutations:s}=e;if(s){return V.mutable.setIn(["meta",n],r,t)}return V.batch.setIn(o,["meta",n],r,t)},t.getMeta=function(e,t){return e.meta[t]},t.query=function(e,t){if(0===t.length)return this.accessList(e);const{idAttribute:n}=this,r=De()(t,e=>oe(e,n)?1:function({type:e}){return[L,Q].includes(e)}(e)?2:3),o=(t,r)=>{const{type:s,payload:i}=r;if(!t){if(oe(r,n)){const t=i[n],s=Object.keys(i).reduce((e,t)=>(t!==n&&(e[t]=i[t]),e),{}),a=this.idExists(e,t)?[t]:[];return Object.keys(s).length?o(this.accessIds(e,a),{...r,payload:s}):this.accessIds(e,a)}if(s===L&&"object"==typeof i){const t=Object.entries(e.indexes),n=[],s=[];if(t.forEach(([e,t])=>{oe(r,e)&&t.hasOwnProperty(i[e])&&(n.push(t[i[e]]),s.push(e))}),n.length){const t=n.pop(),a=n.reduce((e,t)=>{const n=new Set(t);return e.filter(Set.prototype.has,n)},t),c=Object.keys(i).reduce((e,t)=>(s.includes(t)||(e[t]=i[t]),e),{});return Object.keys(c).length?o(this.accessIds(e,a),{...r,payload:c}):this.accessIds(e,a)}}return o(this.accessList(e),r)}switch(s){case L:return xe()(t,i);case Q:return Ie()(t,i);case"REDUX_ORM_ORDER_BY":{const[e,n]=i;return Ce()(t,e,function(e){if(void 0===e)return;const t=e=>["desc",!1].includes(e)?"desc":"asc";return Array.isArray(e)?e.map(t):t(e)}(n))}default:return t}};return r.reduce(o,void 0)},t.insert=function(e,t,n){const{batchToken:r,withMutations:o}=e,s=n.hasOwnProperty(this.idAttribute);let i=t;const[a,c]=function(e,t){let n,r,o=e;return void 0===o&&(o=-1),void 0===t?(n=o+1,r=n):(n=Math.max(o+1,t),r=t),[n,r]}(this.getMaxId(t),n[this.idAttribute]);i=this.setMaxId(e,t,a);const u=s?n:V.batch.set(r,this.idAttribute,c,n),l=Object.keys(i.indexes).filter(e=>n.hasOwnProperty(e)&&null!==n[e]).map(e=>[e,n[e]]);if(o)return V.mutable.push(c,i[this.arrName]),V.mutable.set(c,u,i[this.mapName]),l.forEach(([e,t])=>{const n=i.indexes[e];n.hasOwnProperty(t)?V.mutable.push(c,n[t]):V.mutable.set(t,[c],n)}),{state:i,created:u};const d=V.batch.merge(r,l.reduce((e,[t,n])=>(e[t]=V.batch.merge(r,{[n]:V.batch.push(r,c,e[t][n]||[])},e[t]),e),{...i.indexes}),i.indexes);return{state:V.batch.merge(r,{[this.arrName]:V.batch.push(r,c,i[this.arrName]),[this.mapName]:V.batch.merge(r,{[c]:u},i[this.mapName]),indexes:d},i),created:u}},t.update=function(e,t,n,r){const{batchToken:o,withMutations:s}=e,i=s?V.mutable.set:V.batch.set(o),a=Object.keys(t.indexes).filter(e=>r.hasOwnProperty(e)),c=[],u=[],l=n.reduce((e,t)=>{const n=a.reduce((e,n)=>({...e,[n]:t[n]}),{}),l=(e=>{return(s?V.mutable.merge:V.batch.merge(o))(r,e)})(t),d=a.reduce((e,t)=>({...e,[t]:l[t]}),{}),h=l[this.idAttribute],f=i(h,l,e);return a.forEach(e=>{const{[e]:t}=n,{[e]:r}=d;t!==r&&(null!==t&&u.push([e,t,h]),null!==r&&c.push([e,r,h]))}),f},t[this.mapName]);let d=t.indexes;return s?(u.forEach(([e,t,n])=>{const r=d[e][t],o=r.indexOf(n);V.mutable.splice(o,1,[],r)}),c.forEach(([e,t,n])=>{V.mutable.push(n,d[e][t])})):(c.length&&(d=V.batch.merge(o,c.reduce((e,[t,n,r])=>(e[t]=V.batch.merge(o,{[n]:V.batch.push(o,r,e[t][n]||[])},e[t]),e),{...d}),d)),u.length&&(d=V.batch.merge(o,u.reduce((e,[t,n,r])=>(e[t]=V.batch.merge(o,{[n]:V.batch.filter(o,e=>e!==r,e[t][n])},e[t]),e),{...d}),d))),V.batch.merge(o,{[this.mapName]:l,indexes:d},t)},t.delete=function(e,t,n){const{batchToken:r,withMutations:o}=e,{arrName:s,mapName:i}=this,a=t[s],c=n.map(e=>e[this.idAttribute]);if(o)return c.forEach(e=>{const n=a.indexOf(e);V.mutable.splice(n,1,[],a),V.mutable.omit(e,t[i])}),Object.values(t.indexes).forEach(e=>Object.values(e).forEach(e=>c.forEach(t=>{const n=e.indexOf(t);-1!==n&&V.mutable.splice(n,1,[],e)}))),t;const u=V.batch.merge(r,Object.entries(t.indexes).reduce((e,[t,n])=>(e[t]=V.batch.merge(r,Object.entries(n).reduce((e,[t,n])=>(e[t]=V.batch.filter(r,e=>!c.includes(e),n),e),{...e[t]}),e[t]),e),{...t.indexes}),t.indexes);return V.batch.merge(r,{[s]:V.batch.filter(r,e=>!c.includes(e),t[s]),[i]:V.batch.omit(r,c,t[i]),indexes:V.batch.merge(r,u,t.indexes)},t)},e}();const Pe={};function Be(e,t,n){const{table:r,clauses:o}=t;return{rows:e[r].query(n[r],o)}}function Ve(e,t,n,r){const{action:o,payload:s}=t;let i,a,c;if(o===z){({table:i}=t);const o=e[i],u=r[i],l=o.insert(n,u,s);a=l.state,c=l.created}else{const{query:u}=t;({table:i}=u);const{rows:l}=Be(e,u,r),d=e[i],h=r[i];if(o===U)a=d.update(n,h,l,s),c=Be(e,u,r).rows;else{if(o!==q)throw new Error(`Database received unknown update type: ${o}`);a=d.delete(n,h,l),c=l}}const u=function(e,t,n,r){const{batchToken:o,withMutations:s}=n;return s?(r[e]=t,r):V.batch.set(o,e,t,r)}(i,a,n,r);return{status:X,state:u,payload:c}}Object.defineProperty(Pe,"@@_______REDUX_ORM_STATE_FLAG",{enumerable:!0,value:!0});var Ue=function(e){const{tables:t}=e,n=Object.entries(t).reduce((e,[t,n])=>({...e,[t]:new Te(n)}),{});return{getEmptyState:()=>Object.entries(n).reduce((e,[t,n])=>({...e,[t]:n.getEmptyState()}),Pe),query:Be.bind(null,n),update:Ve.bind(null,n),describe:e=>n[e]}};let qe=function(){function e({parent:e,orm:t}){this._parent=e,this._orm=t,this.keySelector=Y}return o()(e,[{key:"cachePath",get:function(){return[...this._parent?this._parent.cachePath:[],this.key]}},{key:"orm",get:function(){return this._orm}},{key:"parent",get:function(){return this._parent}}]),e}(),ze=function(e){function t({model:t,...n}){var r;return(r=e.call(this,n)||this)._model=t,r}return de()(t,e),o()(t,[{key:"resultFunc",get:function(){return(e,t,...n)=>{const{[this._model.modelName]:r}=e;return void 0===t?r.all().toModelArray().map(t=>this.valueForInstance(t,e,...n)):Array.isArray(t)?t.map(t=>this.valueForInstance(r.withId(t),e,...n)):this.valueForInstance(r.withId(t),e,...n)}}},{key:"model",get:function(){return this._model}}]),t}(qe);function Le(e,t){return t}let Qe=function(e){function t({field:t,selector:n,...r}){var o;return(o=e.call(this,r)||this)._field=t,o._selector=n,o}return de()(t,e),t.prototype.createResultFunc=function(e){const{idAttribute:t}=this._parent.toModel;return(n,...r)=>{const o=e(n,...r),s=Le(n,...r),i=e=>null===e?null:e.map(e=>this._selector(n,e[t]));return void 0===s||Array.isArray(s)?o.map(i):i(o)}},o()(t,[{key:"selector",get:function(){return this._selector},set:function(e){this._selector=e}},{key:"key",get:function(){return this._selector}}]),t}(ze),Xe=function(e){function t({model:t,...n}){var r;return(r=e.call(this,n)||this)._model=t,r}return de()(t,e),o()(t,[{key:"key",get:function(){return this._model.modelName}},{key:"dependencies",get:function(){return[this._orm,Le]}},{key:"resultFunc",get:function(){return({[this._model.modelName]:e},t)=>{if(void 0===t)return e.all().toRefArray();if(Array.isArray(t))return t.map(t=>{const n=e.withId(t);return n?n.ref:null});const n=e.withId(t);return n?n.ref:null}}},{key:"model",get:function(){return this._model}}]),t}(qe),He=function(e){function t({field:t,fieldModel:n,accessorName:r,isVirtual:o,...s}){var i;return(i=e.call(this,s)||this)._field=t,i._fieldModel=n,i._accessorName=r,i._isVirtual=o,i}de()(t,e);var n=t.prototype;return n.valueForInstance=function(e,t){if(!e)return null;let n;if(this._parent instanceof Xe)n=e[this._accessorName];else{const{[this._parent.toModelName]:r}=t,o=this._parent.valueForInstance(e,t),s=o?new r(o):null;n=s?s[this._accessorName]:null}return n instanceof Ee?n.ref:n instanceof ce?n.toRefArray():n},n.map=function(e){if(e instanceof Xe)throw this.toModelName===e.model.modelName?new Error(`Cannot select models in a \`map()\` call. If you just want the \`${this._accessorName}\` as a ref array then you can simply drop the \`map()\`. Otherwise make sure you're passing a field selector of the form \`${this.toModelName}.<field>\` or a custom selector instead.`):new Error(`Cannot select \`${e.model.modelName}\` models in this \`map()\` call. Make sure you're passing a field selector of the form \`${this.toModelName}.<field>\` or a custom selector instead.`);if(e instanceof t||e instanceof Qe){if(this.toModelName!==e.model.modelName)throw new Error(`Cannot select fields of the \`${e.model.modelName}\` model in this \`map()\` call. Make sure you're passing a field selector of the form \`${this.toModelName}.<field>\` or a custom selector instead.`)}else if(!e||"function"!=typeof e||!e.recomputations)throw new Error(`\`map()\` requires a selector as an input. Received: ${JSON.stringify(e)} of type ${typeof e}`);if(!(this._field instanceof be||this._field instanceof we))throw new Error("Cannot map selectors for non-collection fields");return new Qe({parent:this,model:this._model,orm:this._orm,field:this._field,selector:e})},o()(t,[{key:"key",get:function(){return this._accessorName}},{key:"dependencies",get:function(){return[this._orm,Le]}},{key:"toModelName",get:function(){return"this"===this._field.toModelName?this._fieldModel.modelName:this._field.toModelName}},{key:"toModel",get:function(){return this._orm.getDatabase().describe(this.toModelName)}}]),t}(ze);function Ye({parent:e,model:t,field:n,fieldModel:r,accessorName:o,orm:s,isVirtual:i}){const a=new He({parent:e,model:t,field:n,fieldModel:r,accessorName:o,orm:s,isVirtual:i});if(!(n instanceof ge))return a;if(e instanceof He&&(e._field instanceof be&&e._isVirtual||e._field instanceof we))throw new Error(`Cannot create a selector for \`${e._accessorName}.${o}\` because \`${e._accessorName}\` is a collection field.`);const{toModelName:c}=n,u=s.get("this"===c?t.modelName:c);return Object.entries(u.fields).forEach(([e,n])=>{const r=n.as||e;Object.defineProperty(a,r,{get:()=>Ye({parent:a,model:t,fieldModel:u,field:n,accessorName:r,orm:s,isVirtual:!1})})}),Object.entries(u.virtualFields).forEach(([e,n])=>{const r=n.as||e;a.hasOwnProperty(r)||Object.defineProperty(a,r,{get:()=>Ye({parent:a,model:t,fieldModel:u,field:n,accessorName:r,orm:s,isVirtual:!0})})}),a}const Ke={createDatabase:Ue},Ge=["indexes","meta"],Je=e=>Ge.includes(e);let We=function(){function e(e){const{createDatabase:t}={...Ke,...e||{}};this.createDatabase=t,this.registry=[],this.implicitThroughModels=[],this.installedFields={},this.stateSelector=e?e.stateSelector:null}var t=e.prototype;return t.register=function(...e){e.forEach(e=>{if(void 0===e.modelName)throw new Error("A model was passed that doesn't have a modelName set");e.invalidateClassCache(),this.registerManyToManyModelsFor(e),this.registry.push(e),Object.defineProperty(this,e.modelName,{get:()=>(this._setupModelPrototypes(this.registry),function({model:e,orm:t}){const n=new Xe({parent:null,orm:t,model:e});return Object.entries(e.fields).forEach(([r,o])=>{const s=o.as||r;Object.defineProperty(n,s,{get:()=>Ye({parent:n,model:e,fieldModel:e,field:o,accessorName:s,orm:t,isVirtual:!1})})}),Object.entries(e.virtualFields).forEach(([r,o])=>{const s=o.as||r;n.hasOwnProperty(s)||Object.defineProperty(n,s,{get:()=>Ye({parent:n,model:e,fieldModel:e,field:o,accessorName:s,orm:t,isVirtual:!0})})}),n}({model:e,orm:this}))})})},t.registerManyToManyModelsFor=function(e){const{fields:t}=e,n=e.modelName;Object.entries(t).forEach(([e,t])=>{if(!(t instanceof we))return;let r;r="this"===t.toModelName?n:t.toModelName;const s=n===r,i=J(n),a=W(r);if(t.through){if(s&&!t.throughFields)throw new Error("Self-referencing many-to-many relationship at "+`"${n}.${e}" using custom `+`model "${t.through}" has no `+"throughFields key. Cannot determine which fields reference the instances partaking in the relationship.")}else{const t=function(e){function t(){return e.apply(this,arguments)||this}return de()(t,e),t}(Ee);t.modelName=G(n,e);const c=function(e){function t(){return e.apply(this,arguments)||this}return de()(t,e),o()(t,[{key:"installsBackwardsVirtualField",get:function(){return!1}},{key:"installsBackwardsDescriptor",get:function(){return!1}}]),t}(be),u=s?c:be;t.fields={id:_e(),[i]:new u(n),[a]:new u(r)},t.invalidateClassCache(),this.implicitThroughModels.push(t)}})},t.get=function(e){const t=this.registry.concat(this.implicitThroughModels),n=Object.values(t).find(t=>t.modelName===e);if(void 0===n)throw new Error(`Did not find model ${e} from registry.`);return n},t.getModelClasses=function(){return this._setupModelPrototypes(this.registry),this._setupModelPrototypes(this.implicitThroughModels),this.registry.concat(this.implicitThroughModels)},t.generateSchemaSpec=function(){return{tables:this.getModelClasses().reduce((e,t)=>{const n=t.modelName,r=t.tableOptions();return Object.keys(r).filter(Je).forEach(e=>{throw new Error(`Reserved keyword \`${e}\` used in ${n}.options.`)}),e[n]={fields:{...t.fields},...r},e},{})}},t.getDatabase=function(){return this.db||(this.db=this.createDatabase(this.generateSchemaSpec())),this.db},t.getEmptyState=function(){return this.getDatabase().getEmptyState()},t.session=function(e){return new ue(this,this.getDatabase(),e)},t.mutableSession=function(e){return new ue(this,this.getDatabase(),e,!0)},t._setupModelPrototypes=function(e){e.filter(e=>!e.isSetUp).forEach(e=>{const{fields:t,modelName:n,querySetClass:r}=e;Object.entries(t).forEach(([t,r])=>{if(!(r instanceof fe))throw new Error(`${n}.${t} is of type "${typeof r}" `+"but must be an instance of Field. Please use the `attr`, `fk`, `oneToOne` and `many` functions to define fields.");this._isFieldInstalled(n,t)||(this._installField(r,t,e),this._setFieldInstalled(n,t))}),te(e,r),e.isSetUp=!0})},t._isFieldInstalled=function(e,t){return!!this.installedFields.hasOwnProperty(e)&&!!this.installedFields[e][t]},t._setFieldInstalled=function(e,t){this.installedFields.hasOwnProperty(e)||(this.installedFields[e]={}),this.installedFields[e][t]=!0},t._installField=function(e,t,n){new(0,e.installerClass)({field:e,fieldName:t,model:n,orm:this}).run()},t.withMutations=function(e){return K("`ORM.prototype.withMutations` has been deprecated. Use `ORM.prototype.mutableSession` instead."),this.mutableSession(e)},t.from=function(e){return K("`ORM.prototype.from` has been deprecated. Use `ORM.prototype.session` instead."),this.session(e)},t.getDefaultState=function(){return K("`ORM.prototype.getDefaultState` has been deprecated. Use `ORM.prototype.getEmptyState` instead."),this.getEmptyState()},t.define=function(){throw new Error("`ORM.prototype.define` has been removed. Please define a Model class.")},e}();var Ze=n(4),et=n(5),tt=n.n(et);const nt=(e,t)=>e===t,rt=e=>e&&"object"==typeof e&&e.hasOwnProperty("@@_______REDUX_ORM_STATE_FLAG"),ot=(e,t,n)=>t.every((t,r)=>rt(t)&&rt(e[r])||n(t,e[r])),st=(e,t,n)=>{const{accessedInstances:r}=e;return Object.entries(r).every(([r,o])=>{if(e.ormState[r]===t[r])return!0;const{mapName:s}=n.getDatabase().describe(r),{[s]:i}=e.ormState[r],{[s]:a}=t[r];return((e,t,n)=>e.every(e=>t[e]===n[e]))(Object.keys(o),i,a)})},it=(e,t)=>{const{accessedIndexes:n}=e;return Object.entries(n).every(([n,r])=>Object.entries(r).every(([r,o])=>o.every(o=>e.ormState[n].indexes[r][o]===t[n].indexes[r][o])))},at=(e,t)=>e.fullTableScannedModels.every(n=>e.ormState[n]===t[n]);function ct(e,t=nt,n){let r={result:null,args:null,ormState:null,fullTableScannedModels:[],accessedInstances:{},accessedIndexes:{}};return(...o)=>{const[s,...i]=o;if(Boolean(r.args)&&ot(r.args,i,t)&&at(r,s)&&it(r,s)&&st(r,s,n))return r.result;const a=n.session(s),c=i.map(e=>rt(e)?a:e),u=e.apply(null,c);return r={args:i,result:u,ormState:s,accessedInstances:a.accessedModelInstances,accessedIndexes:a.accessedIndexes,fullTableScannedModels:a.fullTableScannedModels},u}}function ut(e,t){e.sessionBoundModels.forEach(n=>{"function"==typeof n.reducer&&n.reducer(t,n,e)})}function lt(e,t=ut){return(n,r)=>{const o=e.session(n||e.getEmptyState());return t(o,r),o.state}}function dt(e){return e instanceof We?e:e instanceof qe&&e._orm}const ht=new Map,ft=Symbol.for("REDUX_ORM_SELECTOR");function pt(e){if("function"==typeof e)return e;if(e instanceof We)return e.stateSelector;if(e instanceof Qe&&(e.selector=pt(e.selector)),e instanceof qe){const{orm:t,cachePath:n}=e;let r;ht.has(t)||ht.set(t,new Map),r=ht.get(t);for(let e=0;e<n.length;++e){const t=n[e];r.has(t)||r.set(t,new Map),r=r.get(t)}if(r&&r.has(ft))return r.get(ft);const o=function e(t){if(t instanceof Qe){const n=e(t.parent);return t.createResultFunc(n)}return tt()(t.dependencies,t.resultFunc)({keySelector:t.keySelector,cacheObject:new et.FlatMapCache,selectorCreator:mt})}(e);return r.set(ft,o),o}throw new Error(`Failed to interpret selector argument: ${JSON.stringify(e)} of type ${typeof e}`)}function mt(...e){if(!e.length)throw new Error("Cannot create a selector without arguments.");const t=e.pop(),n=Array.isArray(e[0])?e[0]:e,r=n.map(dt).find(Boolean),o=n.map(pt);if("function"==typeof t){if(!r)throw new Error("Failed to resolve the current ORM database state. Please pass an ORM instance or an ORM selector as an argument to `createSelector()`.");if(!r.stateSelector)throw new Error("Failed to resolve the current ORM database state. Please pass an object to the ORM constructor that specifies a `stateSelector` function.");if("function"!=typeof r.stateSelector)throw new Error(`Failed to resolve the current ORM database state. Please pass a function when specifying the ORM's \`stateSelector\`. Received: ${JSON.stringify(r.stateSelector)} of type ${typeof r.stateSelector}`);return Object(Ze.createSelectorCreator)(ct,void 0,r)([r.stateSelector,...o],t)}if(t instanceof We)throw new Error("ORM instances cannot be the result function of selectors. You can access your models in the last function that you pass to `createSelector()`.");return o.length&&console.warn("Your input selectors will be ignored: the passed result function does not require any input."),pt(t)}n.d(t,"Schema",(function(){return yt})),n.d(t,"Backend",(function(){return gt})),n.d(t,"Attribute",(function(){return ye})),n.d(t,"QuerySet",(function(){return ce})),n.d(t,"Model",(function(){return Ee})),n.d(t,"ORM",(function(){return We})),n.d(t,"Session",(function(){return ue})),n.d(t,"ForeignKey",(function(){return be})),n.d(t,"ManyToMany",(function(){return we})),n.d(t,"OneToOne",(function(){return ve})),n.d(t,"fk",(function(){return Me})),n.d(t,"many",(function(){return Oe})),n.d(t,"attr",(function(){return _e})),n.d(t,"oneToOne",(function(){return Ne})),n.d(t,"createReducer",(function(){return lt})),n.d(t,"createSelector",(function(){return mt}));const yt=function(){throw new Error("Schema has been renamed to ORM. Please import ORM instead of Schema from Redux-ORM.")},gt=function(){throw new Error("Having a custom Backend instance is now unsupported. Documentation for database customization is upcoming, for now please look at the db folder in the source.")};t.default=Ee}])}));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("ReduxOrm",[],t):"object"==typeof exports?exports.ReduxOrm=t():e.ReduxOrm=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=35)}([function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}},function(e,t){e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},function(e,t,n){var r=n(15),o=n(16),s=n(17),i=n(18);e.exports=function(e){return r(e)||o(e)||s(e)||i()}},function(e,t,n){"use strict";function r(e,t){return e===t}function o(e,t,n){if(null===t||null===n||t.length!==n.length)return!1;for(var r=t.length,o=0;o<r;o++)if(!e(t[o],n[o]))return!1;return!0}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r,n=null,s=null;return function(){return o(t,n,arguments)||(s=e.apply(null,arguments)),n=arguments,s}}function i(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every((function(e){return"function"==typeof e}))){var n=t.map((function(e){return typeof e})).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+n+"]")}return t}function a(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return function(){for(var t=arguments.length,r=Array(t),o=0;o<t;o++)r[o]=arguments[o];var a=0,c=r.pop(),u=i(r),l=e.apply(void 0,[function(){return a++,c.apply(null,arguments)}].concat(n)),d=s((function(){for(var e=[],t=u.length,n=0;n<t;n++)e.push(u[n].apply(null,arguments));return l.apply(null,e)}));return d.resultFunc=c,d.recomputations=function(){return a},d.resetRecomputations=function(){return a=0},d}}t.__esModule=!0,t.defaultMemoize=s,t.createSelectorCreator=a,t.createStructuredSelector=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c;if("object"!=typeof e)throw new Error("createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof e);var n=Object.keys(e);return t(n.map((function(t){return e[t]})),(function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.reduce((function(e,t,r){return e[n[r]]=t,e}),{})}))};var c=t.createSelector=a(s)},function(e,t,n){!function(e,t){"use strict";function n(e){return"string"==typeof e||"number"==typeof e}var r=function(){function e(){this._cache={}}var t=e.prototype;return t.set=function(e,t){this._cache[e]=t},t.get=function(e){return this._cache[e]},t.remove=function(e){delete this._cache[e]},t.clear=function(){this._cache={}},t.isValidCacheKey=function(e){return n(e)},e}(),o=r,s=function(){return!0};function i(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return function(e,r){if("function"==typeof r)throw new Error('[re-reselect] Second argument "options" must be an object. Please use "options.selectorCreator" to provide a custom selectorCreator.');var i={};"function"==typeof e?Object.assign(i,r,{keySelector:e}):Object.assign(i,e);var a=0,c=n.pop(),u=Array.isArray(n[0])?n[0]:[].concat(n);n.push((function(){return a++,c.apply(void 0,arguments)}));var l=i.cacheObject||new o,d=i.selectorCreator||t.createSelector,h=l.isValidCacheKey||s;i.keySelectorCreator&&(i.keySelector=i.keySelectorCreator({keySelector:i.keySelector,inputSelectors:u,resultFunc:c}));var f=function(){var e=i.keySelector.apply(i,arguments);if(h(e)){var t=l.get(e);return void 0===t&&(t=d.apply(void 0,n),l.set(e,t)),t.apply(void 0,arguments)}console.warn('[re-reselect] Invalid cache key "'+e+'" has been returned by keySelector function.')};return f.getMatchingSelector=function(){var e=i.keySelector.apply(i,arguments);return l.get(e)},f.removeMatchingSelector=function(){var e=i.keySelector.apply(i,arguments);l.remove(e)},f.clearCache=function(){l.clear()},f.resultFunc=c,f.dependencies=u,f.cache=l,f.recomputations=function(){return a},f.resetRecomputations=function(){return a=0},f.keySelector=i.keySelector,f}}function a(e){if(void 0===e)throw new Error('Missing the required property "cacheSize".');if(!Number.isInteger(e)||e<=0)throw new Error('The "cacheSize" property must be a positive integer value.')}var c=function(){function e(e){var t=(void 0===e?{}:e).cacheSize;a(t),this._cache={},this._cacheOrdering=[],this._cacheSize=t}var t=e.prototype;return t.set=function(e,t){if(this._cache[e]=t,this._cacheOrdering.push(e),this._cacheOrdering.length>this._cacheSize){var n=this._cacheOrdering[0];this.remove(n)}},t.get=function(e){return this._cache[e]},t.remove=function(e){var t=this._cacheOrdering.indexOf(e);t>-1&&this._cacheOrdering.splice(t,1),delete this._cache[e]},t.clear=function(){this._cache={},this._cacheOrdering=[]},t.isValidCacheKey=function(e){return n(e)},e}(),u=function(){function e(e){var t=(void 0===e?{}:e).cacheSize;a(t),this._cache={},this._cacheOrdering=[],this._cacheSize=t}var t=e.prototype;return t.set=function(e,t){if(this._cache[e]=t,this._registerCacheHit(e),this._cacheOrdering.length>this._cacheSize){var n=this._cacheOrdering[0];this.remove(n)}},t.get=function(e){return this._registerCacheHit(e),this._cache[e]},t.remove=function(e){this._deleteCacheHit(e),delete this._cache[e]},t.clear=function(){this._cache={},this._cacheOrdering=[]},t._registerCacheHit=function(e){this._deleteCacheHit(e),this._cacheOrdering.push(e)},t._deleteCacheHit=function(e){var t=this._cacheOrdering.indexOf(e);t>-1&&this._cacheOrdering.splice(t,1)},t.isValidCacheKey=function(e){return n(e)},e}(),l=function(){function e(){this._cache=new Map}var t=e.prototype;return t.set=function(e,t){this._cache.set(e,t)},t.get=function(e){return this._cache.get(e)},t.remove=function(e){this._cache.delete(e)},t.clear=function(){this._cache.clear()},e}(),d=function(){function e(e){var t=(void 0===e?{}:e).cacheSize;a(t),this._cache=new Map,this._cacheSize=t}var t=e.prototype;return t.set=function(e,t){if(this._cache.set(e,t),this._cache.size>this._cacheSize){var n=this._cache.keys().next().value;this.remove(n)}},t.get=function(e){return this._cache.get(e)},t.remove=function(e){this._cache.delete(e)},t.clear=function(){this._cache.clear()},e}(),h=function(){function e(e){var t=(void 0===e?{}:e).cacheSize;a(t),this._cache=new Map,this._cacheSize=t}var t=e.prototype;return t.set=function(e,t){if(this._cache.set(e,t),this._cache.size>this._cacheSize){var n=this._cache.keys().next().value;this.remove(n)}},t.get=function(e){var t=this._cache.get(e);return this._cache.has(e)&&(this.remove(e),this._cache.set(e,t)),t},t.remove=function(e){this._cache.delete(e)},t.clear=function(){this._cache.clear()},e}();e.FifoCacheObject=c,e.FifoMapCache=d,e.FifoObjectCache=c,e.FlatCacheObject=r,e.FlatMapCache=l,e.FlatObjectCache=r,e.LruCacheObject=h,e.LruMapCache=h,e.LruObjectCache=u,e.createStructuredCachedSelector=function(e){return t.createStructuredSelector(e,i)},e.default=i,Object.defineProperty(e,"__esModule",{value:!0})}(t,n(4))},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}},function(e,t,n){var r=n(19),o=n(8),s=n(20),i=n(21),a=n(22),c=n(23),u=n(9);e.exports=function(e,t,n){var l=-1;t=r(t.length?t:[u],a(o));var d=s(e,(function(e,n,o){return{criteria:r(t,(function(t){return t(e)})),index:++l,value:e}}));return i(d,(function(e,t){return c(e,t,n)}))}},function(e,t){e.exports=function(e){return e}},function(e,t){e.exports=function(e){return e}},function(e,t){var n=Array.isArray;e.exports=n},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,s=[];++n<r;){var i=e[n];t(i,n,e)&&(s[o++]=i)}return s}},function(e,t,n){var r=n(7),o=n(10);e.exports=function(e,t,n,s){return null==e?[]:(o(t)||(t=null==t?[]:[t]),o(n=s?void 0:n)||(n=null==n?[]:[n]),r(e,t,n))}},function(e,t,n){var r=n(26),o=n(27),s=n(8),i=n(10),a=n(28);e.exports=function(e,t){return(i(e)?r:o)(e,a(s(t,3)))}},function(e,t,n){var r=n(29),o=n(7),s=n(30),i=n(34),a=s((function(e,t){if(null==e)return[];var n=t.length;return n>1&&i(e,t[0],t[1])?t=[]:n>2&&i(t[0],t[1],t[2])&&(t=[t[0]]),o(e,r(t,1),[])}));e.exports=a},function(e,t,n){var r=n(6);e.exports=function(e){if(Array.isArray(e))return r(e)}},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}},function(e,t,n){var r=n(6);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}},function(e,t){e.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.")}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}},function(e,t){e.exports=function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}},function(e,t){e.exports=function(e){return function(t){return e(t)}}},function(e,t,n){var r=n(24);e.exports=function(e,t,n){for(var o=-1,s=e.criteria,i=t.criteria,a=s.length,c=n.length;++o<a;){var u=r(s[o],i[o]);if(u)return o>=c?u:u*("desc"==n[o]?-1:1)}return e.index-t.index}},function(e,t,n){var r=n(25);e.exports=function(e,t){if(e!==t){var n=void 0!==e,o=null===e,s=e==e,i=r(e),a=void 0!==t,c=null===t,u=t==t,l=r(t);if(!c&&!l&&!i&&e>t||i&&a&&u&&!c&&!l||o&&a&&u||!n&&u||!s)return 1;if(!o&&!i&&!l&&e<t||l&&n&&s&&!o&&!i||c&&n&&s||!a&&s||!u)return-1}return 0}},function(e,t){e.exports=function(){return!1}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,s=[];++n<r;){var i=e[n];t(i,n,e)&&(s[o++]=i)}return s}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,s=[];++n<r;){var i=e[n];t(i,n,e)&&(s[o++]=i)}return s}},function(e,t){var n="Expected a function";e.exports=function(e){if("function"!=typeof e)throw new TypeError(n);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}},function(e,t){e.exports=function(e){return e&&e.length?e[0]:void 0}},function(e,t,n){var r=n(9),o=n(31),s=n(33);e.exports=function(e,t){return s(o(e,t,r),e+"")}},function(e,t,n){var r=n(32),o=Math.max;e.exports=function(e,t,n){return t=o(void 0===t?e.length-1:t,0),function(){for(var s=arguments,i=-1,a=o(s.length-t,0),c=Array(a);++i<a;)c[i]=s[t+i];i=-1;for(var u=Array(t+1);++i<t;)u[i]=s[i];return u[t]=n(c),r(e,this,u)}}},function(e,t){e.exports=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}},function(e,t){e.exports=function(e){return e}},function(e,t){e.exports=function(){return!1}},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n.n(r),s=n(3),i=n.n(s),a=n(2),c=n.n(a);function u(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function l(e){return function t(n){return 0===arguments.length||u(n)?t:e.apply(this,arguments)}}function d(e,t){switch(e){case 0:return function(){return t.apply(this,arguments)};case 1:return function(e){return t.apply(this,arguments)};case 2:return function(e,n){return t.apply(this,arguments)};case 3:return function(e,n,r){return t.apply(this,arguments)};case 4:return function(e,n,r,o){return t.apply(this,arguments)};case 5:return function(e,n,r,o,s){return t.apply(this,arguments)};case 6:return function(e,n,r,o,s,i){return t.apply(this,arguments)};case 7:return function(e,n,r,o,s,i,a){return t.apply(this,arguments)};case 8:return function(e,n,r,o,s,i,a,c){return t.apply(this,arguments)};case 9:return function(e,n,r,o,s,i,a,c,u){return t.apply(this,arguments)};case 10:return function(e,n,r,o,s,i,a,c,u,l){return t.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function h(e){return function t(n,r){switch(arguments.length){case 0:return t;case 1:return u(n)?t:l((function(t){return e(n,t)}));default:return u(n)&&u(r)?t:u(n)?l((function(t){return e(t,r)})):u(r)?l((function(t){return e(n,t)})):e(n,r)}}}var f=h((function(e,t){return 1===e?l(t):d(e,function e(t,n,r){return function(){for(var o=[],s=0,i=t,a=0;a<n.length||s<arguments.length;){var c;a<n.length&&(!u(n[a])||s>=arguments.length)?c=n[a]:(c=arguments[s],s+=1),o[a]=c,u(c)||(i-=1),a+=1}return i<=0?r.apply(this,o):d(i,e(t,o,r))}}(e,[],t))})),p=l((function(e){return f(e.length,e)})),m={"@@functional/placeholder":!0};function y(e,t){for(var n in e)e.hasOwnProperty(n)&&t(e[n],n)}var g="@@_______immutableOpsOwnerID";function b(e,t){return!!t&&e[g]===t}var w="function"==typeof Symbol?function(){return Symbol("ownerID")}:function(){return{}};function v(e,t){return t&&function(e,t){Object.defineProperty(e,g,{value:t,configurable:!0,enumerable:!1})}(e,t),e}function _(e){return e instanceof Array?e:[e]}var M=".";function O(e){return"string"==typeof e?-1===e.indexOf(M)?[e]:e.split(M):e}function N(e,t,n){return n[e]=t,n}function S(e,t,n){var r=_(t);return e?r.forEach((function(t){y(t,(function(t,r){var o;e&&n.hasOwnProperty(r)?(o="object"===c()(t)?S(e,[t],n[r]):t,n[r]=o):n[r]=t}))})):Object.assign.apply(Object,[n].concat(i()(r))),n}var k=S.bind(null,!1),E=S.bind(null,!0);function j(e,t){return _(e).forEach((function(e){delete t[e]})),t}function x(e,t,n){return e[n]!==t[n]}function F(e,t,n,r){if(b(r,t))return S(e,n,r);var o=_(n),s=!1,i=r,a=function(){s||(s=!0,v(i=Object.assign({},r),t))};return o.forEach((function(n){y(n,(function(o,s){if(e&&r.hasOwnProperty(s)){var u=i[s];if("object"===c()(o)&&!(o instanceof Array)){if(x(i,n,s)){var l=F(e,t,o,u);l!==u&&(a(),i[s]=l)}return!0}}x(i,n,s)&&(a(),i[s]=o)}))})),i}var A=F.bind(null,!0);function C(e,t,n,r){if(b(r,e))return N(t,n,r);if(r[t]===n)return r;var o=function(e){for(var t=new Array(e.length),n=0;n<e.length;n++)t[n]=e[n];return t}(r);return o[t]=n,v(o,e),o}function I(e,t){for(var n=0,r=0;n<t.length;){e(t[n],r)?n++:t.splice(n,1),r++}return t}function R(e,t,n,r){var o=_(n);return r.splice.apply(r,[e,t].concat(i()(o))),r}function D(e,t,n){return R(e,0,t,n)}function $(e,t,n,r,o){if(b(o,e))return R(t,n,r,o);var s=_(r),a=o.slice();return v(a,e),a.splice.apply(a,[t,n].concat(i()(s))),a}function T(e,t,n,r){return b(r,e)?D(t,n,r):$(e,t,0,n,r)}var P={merge:F.bind(null,!1),deepMerge:A,omit:function(e,t,n){if(b(n,e))return j(t,n);var r=_(t).filter((function(e){return n.hasOwnProperty(e)}));if(0===r.length)return n;var o=Object.assign({},n);return r.forEach((function(e){delete o[e]})),v(o,e),o},setIn:function(e,t,n,r){var o=O(t),s=function(e,t){for(var n=O(e),r=t,o=0;o<n.length;o++){var s=r[n[o]];if(o===n.length-1)return s;if("object"!==c()(s))return;r=s}}(o,r);if(n===s)return r;var i,a=o.length,u=i=b(r,e)?r:Object.assign(v({},e),r);return o.forEach((function(t,r){if(r!==a-1){var s=i[t],u=c()(s);if("object"!==u){if("undefined"===u){var l=v({},e);return i[t]=l,void(i=l)}var d="".concat(o[r-1],".").concat(t);throw new Error("A non-object value was encountered when traversing setIn path at ".concat(d,"."))}if(b(s,e))i=s;else{var h=v({},e);i[t]=Object.assign(h,s),i=h}}else i[t]=n})),u},insert:T,push:function(e,t,n){return T(e,n.length,t,n)},filter:function(e,t,n){if(b(n,e))return I(t,n);var r=n.filter(t);return r.length===n.length?n:(v(r,e),r)},splice:$,set:function(e,t,n,r){if(function(e){return e&&"object"===c()(e)&&"number"==typeof e.length&&e.length>=0&&e.length%1==0}(r))return C(e,t,n,r);if(b(r,e))return N(t,n,r);if(r[t]===n)return r;var o=Object.assign({},r);return v(o,e),o[t]=n,o}},B={merge:k,deepMerge:E,omit:j,setIn:function(e,t,n){for(var r=O(e),o=r.length,s=!1,i=0,a=n,u=r[i];!s;)if(i===o-1)a[u]=t,s=!0;else{var l=c()(a[u]);if("undefined"===l){var d={};v(d,null),a[u]=d}else if("object"!==l){var h="".concat(r[i-1],".").concat(u);throw new Error("A non-object value was encountered when traversing setIn path at ".concat(h,"."))}a=a[u],u=r[++i]}return n},insert:D,push:function(e,t){var n=_(e);return t.push.apply(t,i()(n)),t},filter:I,splice:R,set:N};var U=function(){var e=Object.assign({},P);y(e,(function(t,n){e[n]=p(t.bind(null,null))}));var t=Object.assign({},B);y(t,(function(e,n){t[n]=p(e)}));var n=Object.assign({},P);return y(n,(function(e,t){n[t]=p(e)})),Object.assign(e,{mutable:t,batch:n,batched:function(e,t){var n,r;"function"==typeof e?(r=e,n=w()):(n=e,r=t);var o=Object.assign({},P);return y(o,(function(e,t){o[t]=p(e.bind(null,n))})),r(o)},__:m,getBatchToken:w})}();const V="REDUX_ORM_UPDATE",q="REDUX_ORM_DELETE",z="REDUX_ORM_CREATE",L="REDUX_ORM_FILTER",Q="REDUX_ORM_EXCLUDE",X="SUCCESS",H=Symbol("REDUX_ORM_ALL_INSTANCES"),Y=(e,t)=>void 0===t?H:t;function K(e){return("function"==typeof console.warn?console.warn.bind(console):console.log.bind(console))(e)}function G(e,t){return e+((n=t).charAt(0).toUpperCase()+n.slice(1));var n}function J(e){return`from${e}Id`}function W(e){return`to${e}Id`}function Z(e){return function(...t){return this.getQuerySet()[e](...t)}}function ee(e){return function(){return this.getQuerySet()[e]}}function te(e,t){const n=t.sharedMethods.slice();!function(e,t){let n=e;for(;n!==Function.prototype;)t(n),n=Object.getPrototypeOf(n)}(t,t=>{for(let r=0;r<n.length;r++){let o=!1;const s=n[r],i=Object.getOwnPropertyDescriptor(t.prototype,s);void 0!==i&&(void 0!==i.get?(i.get=ee(s),Object.defineProperty(e,s,i)):e[s]=Z(s),o=!0),o&&n.splice(r--,1)}})}function ne(e){return null!=e&&"function"==typeof e.getId?e.getId():e}const{getBatchToken:re}=U;function oe({type:e,payload:t},n){if(e!==L)return!1;if("object"!=typeof t)return!1;if(!t.hasOwnProperty(n))return!1;const r=t[n];return null!==r&&void 0!==r}function se(e,t){return Object.entries(e).reduce((e,[n,r])=>(e[n]=t(r),e),{})}function ie(e){return e&&"string"!=typeof e?e.modelName:e}const ae=function(){function e(e,t,n){Object.assign(this,{modelClass:e,clauses:t||[]}),this._opts=n}e.addSharedMethod=function(e){this.sharedMethods=this.sharedMethods.concat(e)};var t=e.prototype;return t._new=function(e,t){const n={...this._opts,...t};return new this.constructor(this.modelClass,e,n)},t.toString=function(){return this._evaluate(),`QuerySet contents:\n - ${this.rows.map(({id:e})=>this.modelClass.withId(e).toString()).join("\n - ")}`},t.toRefArray=function(){return this._evaluate()},t.toModelArray=function(){const{modelClass:e}=this;return this._evaluate().map(t=>new e(t))},t.count=function(){return this._evaluate(),this.rows.length},t.exists=function(){return Boolean(this.count())},t.at=function(e){const{modelClass:t}=this,n=this._evaluate();if(e>=0&&e<n.length)return new t(n[e])},t.first=function(){return this.at(0)},t.last=function(){const e=this._evaluate();return this.at(e.length-1)},t.all=function(){return this._new(this.clauses)},t.filter=function(e){const t="object"==typeof e?se(e,ne):e,n={type:L,payload:t};return this._new(this.clauses.concat(n))},t.exclude=function(e){const t="object"==typeof e?se(e,ne):e,n={type:Q,payload:t};return this._new(this.clauses.concat(n))},t._evaluate=function(){if(void 0===this.modelClass.session)throw new Error([`Tried to query the ${this.modelClass.modelName} model's table without a session. `,"Create a session using `session = orm.session()` and use ",`\`session["${this.modelClass.modelName}"]\` for querying instead.`].join(""));if(!this._evaluated){const{session:e,modelName:t}=this.modelClass,n={table:t,clauses:this.clauses};this.rows=e.query(n).rows,this._evaluated=!0}return this.rows},t.orderBy=function(e,t){const n={type:"REDUX_ORM_ORDER_BY",payload:[e,t]};return this._new(this.clauses.concat(n))},t.update=function(e){const{session:t,modelName:n}=this.modelClass;t.applyUpdate({action:V,query:{table:n,clauses:this.clauses},payload:e}),this._evaluated=!1},t.delete=function(){const{session:e,modelName:t}=this.modelClass;this.toModelArray().forEach(e=>e._onDelete()),e.applyUpdate({action:q,query:{table:t,clauses:this.clauses}}),this._evaluated=!1},t.map=function(){throw new Error("`QuerySet.prototype.map` has been removed. Call `.toModelArray()` or `.toRefArray()` first to map.")},t.forEach=function(){throw new Error("`QuerySet.prototype.forEach` has been removed. Call `.toModelArray()` or `.toRefArray()` first to iterate.")},o()(e,[{key:"withModels",get:function(){throw new Error("`QuerySet.prototype.withModels` has been removed. Use `.toModelArray()` or predicate functions that instantiate Models from refs, e.g. `new Model(ref)`.")}},{key:"withRefs",get:function(){K("`QuerySet.prototype.withRefs` has been deprecated. Query building operates on refs only now.")}}]),e}();ae.sharedMethods=["count","at","all","last","first","filter","exclude","orderBy","update","delete"];var ce=ae;var ue=function(){function e(e,t,n,r,o){this.schema=e,this.db=t,this.state=n||t.getEmptyState(),this.initialState=this.state,this.withMutations=Boolean(r),this.batchToken=o||w(),this.modelData={},this.models=e.getModelClasses(),this.sessionBoundModels=this.models.map(e=>{function t(){return Reflect.construct(e,arguments,t)}return Reflect.setPrototypeOf(t.prototype,e.prototype),Reflect.setPrototypeOf(t,e),Object.defineProperty(this,e.modelName,{get:()=>t}),t.connect(this),t})}var t=e.prototype;return t.getDataForModel=function(e){return this.modelData[e]||(this.modelData[e]={}),this.modelData[e]},t.getModelData=function(){return this.modelData},t.markAccessed=function(e,t){const n=this.getDataForModel(e);n.accessedInstances||(n.accessedInstances={}),t.forEach(e=>{n.accessedInstances[e]=!0})},t.markFullTableScanned=function(e){this.getDataForModel(e).fullTableScanned=!0},t.markAccessedIndexes=function(e){e.forEach(([e,t,n])=>{const r=this.getDataForModel(e);r.accessedIndexes||(r.accessedIndexes={}),r.accessedIndexes[t]=[...r.accessedIndexes[t]||[],n]})},t.applyUpdate=function(e){const t=this._getTransaction(e),n=this.db.update(e,t,this.state),{status:r,state:o,payload:s}=n;if(r!==X)throw new Error(`Applying update failed with status ${r}. Payload: ${s}`);return this.state=o,s},t.query=function(e){const t=this.db.query(e,this.state);return this._markAccessedByQuery(e,t),t},t._getTransaction=function(e){const{withMutations:t}=this,{action:n}=e;let{batchToken:r}=this;return[V,q].includes(n)&&(r=w()),{batchToken:r,withMutations:t}},t._markAccessedByQuery=function(e,t){const{table:n,clauses:r}=e,{rows:o}=t,{idAttribute:s}=this[n],i=new Set(o.map(e=>e[s])),a=r.some(e=>!!oe(e,s)&&(i.add(e.payload[s]),!0)),c=[],{indexes:u}=this.state[n];r.forEach(e=>{Object.keys(u).forEach(t=>{if(!oe(e,t))return;const r=e.payload[t];c.push([n,t,r])})}),a?this.markAccessed(n,i):c.length?(this.markAccessed(n,i),this.markAccessedIndexes(c)):this.markFullTableScanned(n)},t.getNextState=function(){return K("`Session.prototype.getNextState` has been deprecated. Access the `Session.prototype.state` property instead."),this.state},t.reduce=function(){throw new Error("`Session.prototype.reduce` has been removed. The Redux integration API is now decoupled from ORM and Session - see the 0.9 migration guide in the GitHub repo.")},o()(e,[{key:"accessedModelInstances",get:function(){return Object.entries(this.getModelData()).reduce((e,[t,n])=>(n.accessedInstances&&(e[t]=n.accessedInstances),e),{})}},{key:"fullTableScannedModels",get:function(){return Object.entries(this.getModelData()).reduce((e,[t,n])=>(n.fullTableScanned&&e.push(t),e),[])}},{key:"accessedIndexes",get:function(){return Object.entries(this.getModelData()).reduce((e,[t,n])=>(n.accessedIndexes&&(e[t]=n.accessedIndexes),e),{})}}]),e}(),le=n(1),de=n.n(le);var he=function(e){function t(){return e.apply(this,arguments)||this}de()(t,e);var n=t.prototype;return n.installForwardsDescriptor=function(){Object.defineProperty(this.model.prototype,this.fieldName,this.field.createForwardsDescriptor(this.fieldName,this.model,this.toModel,this.throughModel))},n.installForwardsVirtualField=function(){this.model.virtualFields[this.fieldName]=this.field.createForwardsVirtualField(this.fieldName,this.model,this.toModel,this.throughModel)},n.installBackwardsDescriptor=function(){if(Object.getOwnPropertyDescriptor(this.toModel.prototype,this.backwardsFieldName))throw new Error((e=this.model.modelName,t=this.fieldName,n=this.toModel.modelName,[`Reverse field ${this.backwardsFieldName} already defined`,` on model ${n}. To fix, set a custom related`,` name on ${e}.${t}.`].join("")));var e,t,n;Object.defineProperty(this.toModel.prototype,this.backwardsFieldName,this.field.createBackwardsDescriptor(this.fieldName,this.model,this.toModel,this.throughModel))},n.installBackwardsVirtualField=function(){this.toModel.virtualFields[this.backwardsFieldName]=this.field.createBackwardsVirtualField(this.fieldName,this.model,this.toModel,this.throughModel)},t}(function(){function e(e){this.field=e.field,this.fieldName=e.fieldName,this.model=e.model,this.orm=e.orm,this.field.references(this.model)&&(this.field.toModelName="this")}return e.prototype.run=function(){this.installForwardsDescriptor(),this.field.installsForwardsVirtualField&&this.installForwardsVirtualField(),this.field.installsBackwardsDescriptor&&this.installBackwardsDescriptor(),this.field.installsBackwardsVirtualField&&this.installBackwardsVirtualField()},o()(e,[{key:"toModel",get:function(){if(void 0===this._toModel){const{toModelName:e}=this.field;this._toModel=e?"this"===e?this.model:this.orm.get(e):null}return this._toModel}},{key:"throughModel",get:function(){if(void 0===this._throughModel){const e=this.field.getThroughModelName(this.fieldName,this.model);this._throughModel=e?this.orm.get(e):null}return this._throughModel}},{key:"backwardsFieldName",get:function(){return this.field.getBackwardsFieldName(this.model)}}]),e}());var fe=function(){function e(){}var t=e.prototype;return t.getClass=function(){return this.constructor},t.references=function(e){return!1},t.getThroughModelName=function(e,t){return null},o()(e,[{key:"installerClass",get:function(){return he}},{key:"installsForwardsVirtualField",get:function(){return!1}},{key:"installsBackwardsDescriptor",get:function(){return!1}},{key:"installsBackwardsVirtualField",get:function(){return!1}},{key:"index",get:function(){return!1}}]),e}();function pe(e,t){return{get(){const{session:{[t]:n}}=this.getClass(),{[e]:r}=this._fields;return n.withId(r)},set(t){this.update({[e]:ne(t)})}}}function me(e,t,n,r,o){return{get(){const{session:{[e]:s,[t]:i,[n]:a}}=this.getClass(),c=o?i:s,u=o?s:i,l=o?r.to:r.from,d=o?r.from:r.to,h=this.getId(),f=a.filter({[l]:h}),p=new Set(f.toRefArray().map(e=>e[d])),m=u.filter(e=>p.has(e[u.idAttribute]));return m.add=function(...e){const t=new Set(e.map(ne)),n=f.filter(e=>t.has(e[d]));if(n.exists()){const e=n.toRefArray().map(e=>e[d]);throw new Error(`Tried to add already existing ${u.modelName} id(s) ${e} to the ${c.modelName} instance with id ${h}`)}t.forEach(e=>{a.create({[d]:e,[l]:h})})},m.clear=function(){f.delete()},m.remove=function(...e){const t=new Set(e.map(ne)),n=f.filter(e=>t.has(e[d]));if(n.count()!==t.size){const e=n.toRefArray().map(e=>e[d]),r=[...t].filter(t=>!e.includes(t));throw new Error(`Tried to delete non-existing ${u.modelName} id(s) ${r} from the ${c.modelName} instance with id ${h}`)}n.delete()},m},set(){throw new Error("Tried setting a M2M field. Please use the related QuerySet methods add, remove and clear.")}}}var ye=function(e){function t(t){var n;return(n=e.call(this)||this).opts=t||{},n.opts.hasOwnProperty("getDefault")&&(n.getDefault=n.opts.getDefault),n}return de()(t,e),t.prototype.createForwardsDescriptor=function(e,t){return function(e){return{get(){return this._fields[e]},set(t){return this.set(e,t)},enumerable:!0,configurable:!0}}(e)},t}(fe);var ge=function(e){function t(...t){var n;if(n=e.call(this)||this,1===t.length&&"object"==typeof t[0]){const e=t[0];n.toModelName=ie(e.to),n.relatedName=e.relatedName,n.through=ie(e.through),n.throughFields=e.throughFields,n.as=e.as}else[n.toModelName,n.relatedName]=[ie(t[0]),t[1]];return n}de()(t,e);var n=t.prototype;return n.getBackwardsFieldName=function(e){return this.relatedName||e.modelName.toLowerCase()+"Set"},n.createBackwardsVirtualField=function(e,t,n,r){return new(this.getClass())(t.modelName,e)},n.references=function(e){return this.toModelName===e.modelName},o()(t,[{key:"installsBackwardsVirtualField",get:function(){return!0}},{key:"installsBackwardsDescriptor",get:function(){return!0}},{key:"installerClass",get:function(){return function(e){function t(){return e.apply(this,arguments)||this}return de()(t,e),t.prototype.installForwardsDescriptor=function(){Object.defineProperty(this.model.prototype,this.field.as||this.fieldName,this.field.createForwardsDescriptor(this.fieldName,this.model,this.toModel,this.throughModel))},t}(he)}}]),t}(fe);var be=function(e){function t(){return e.apply(this,arguments)||this}de()(t,e);var n=t.prototype;return n.createForwardsDescriptor=function(e,t,n,r){return pe(e,n.modelName)},n.createBackwardsDescriptor=function(e,t,n,r){return o=e,s=t.modelName,{get(){const{session:{[s]:e}}=this.getClass();return e.filter({[o]:this.getId()})},set(){throw new Error("Can't mutate a reverse many-to-one relation.")}};var o,s},o()(t,[{key:"index",get:function(){return!0}}]),t}(ge);var we=function(e){function t(){return e.apply(this,arguments)||this}de()(t,e);var n=t.prototype;return n.getDefault=function(){return[]},n.getThroughModelName=function(e,t){return this.through||G(t.modelName,e)},n.createForwardsDescriptor=function(e,t,n,r){return me(t.modelName,n.modelName,r.modelName,this.getThroughFields(e,t,n,r),!1)},n.createBackwardsDescriptor=function(e,t,n,r){return me(t.modelName,n.modelName,r.modelName,this.getThroughFields(e,t,n,r),!0)},n.createBackwardsVirtualField=function(e,t,n,r){return new(this.getClass())({to:t.modelName,relatedName:e,through:r.modelName,throughFields:this.getThroughFields(e,t,n,r)})},n.createForwardsVirtualField=function(e,t,n,r){return new(this.getClass())({to:n.modelName,relatedName:e,through:this.through,throughFields:this.getThroughFields(e,t,n,r),as:this.as})},n.getThroughFields=function(e,t,n,r){if(this.throughFields){const[e,t]=this.throughFields,o=r.fields[e];return{to:o.references(n)?e:t,from:o.references(n)?t:e}}if(t.modelName===n.modelName)return{to:W(n.modelName),from:J(t.modelName)};const o=e=>Object.keys(r.fields).find(t=>r.fields[t].references(e));return{to:o(n),from:o(t)}},o()(t,[{key:"installsForwardsVirtualField",get:function(){return!0}}]),t}(ge);var ve=function(e){function t(){return e.apply(this,arguments)||this}de()(t,e);var n=t.prototype;return n.getBackwardsFieldName=function(e){return this.relatedName||e.modelName.toLowerCase()},n.createForwardsDescriptor=function(e,t,n,r){return function(...e){return pe(...e)}(e,n.modelName)},n.createBackwardsDescriptor=function(e,t,n,r){return o=e,s=t.modelName,{get(){const{session:{[s]:e}}=this.getClass();return e.get({[o]:this.getId()})},set(){throw new Error("Can't mutate a reverse one-to-one relation.")}};var o,s},t}(ge);function _e(e){return new ye(e)}function Me(...e){return new be(...e)}function Oe(...e){return new we(...e)}function Ne(...e){return new ve(...e)}function Se(e){const t=e.getClass(),{idAttribute:n,modelName:r}=t;return{table:r,clauses:[{type:L,payload:{[n]:e.getId()}}]}}const ke=function(){function e(e){this._initFields(e)}var t=e.prototype;return t._initFields=function(e){const t=Object(e);this._fields={...t},Object.keys(t).forEach(e=>{e in this||Object.defineProperty(this,e,{get:()=>this._fields[e],set:t=>this.set(e,t),configurable:!0,enumerable:!0})})},e.toString=function(){return`ModelClass: ${this.modelName}`},e.options=function(){return{}},e.markAccessed=function(e){if(void 0===this._session)throw new Error([`Tried to mark rows of the ${this.modelName} model as accessed without a session. `,"Create a session using `session = orm.session()` and call ",`\`session["${this.modelName}"].markAccessed\` instead.`].join(""));this.session.markAccessed(this.modelName,e)},e.markFullTableScanned=function(){if(void 0===this._session)throw new Error([`Tried to mark the ${this.modelName} model as full table scanned without a session. `,"Create a session using `session = orm.session()` and call ",`\`session["${this.modelName}"].markFullTableScanned\` instead.`].join(""));this.session.markFullTableScanned(this.modelName)},e.markAccessedIndexes=function(e){if(void 0===this._session)throw new Error([`Tried to mark indexes for the ${this.modelName} model as accessed without a session. `,"Create a session using `session = orm.session()` and call ",`\`session["${this.modelName}"].markAccessedIndexes\` instead.`].join(""));this.session.markAccessedIndexes(e.map(([e,t])=>[this.modelName,e,t]))},e.connect=function(e){if(!(e instanceof ue))throw new Error("A model can only be connected to instances of Session.");this._session=e},e.getQuerySet=function(){const{querySetClass:e}=this;return new e(this)},e.invalidateClassCache=function(){this.isSetUp=void 0,this.virtualFields={}},e.tableOptions=function(){return"function"==typeof this.backend?(K("`Model.backend` has been deprecated. Please rename to `.options`."),this.backend()):this.backend?(K("`Model.backend` has been deprecated. Please rename to `.options`."),this.backend):"function"==typeof this.options?this.options():this.options},e.create=function(e){if(void 0===this._session)throw new Error([`Tried to create a ${this.modelName} model instance without a session. `,"Create a session using `session = orm.session()` and call ",`\`session["${this.modelName}"].create\` instead.`].join(""));const t={...e},n={},r=Object.keys(this.fields),o=Object.keys(this.virtualFields);r.forEach(r=>{const o=this.fields[r],s=e.hasOwnProperty(r);if(o instanceof we)s&&(n[r]=e[r],o.as||delete t[r]);else if(s){const n=e[r];t[r]=ne(n)}else o.getDefault&&(t[r]=o.getDefault())}),o.forEach(r=>{if(!n.hasOwnProperty(r)){const o=this.virtualFields[r];e.hasOwnProperty(r)&&o instanceof we&&(n[r]=e[r],delete t[r])}});const s=new this(this.session.applyUpdate({action:z,table:this.modelName,payload:t}));return s._refreshMany2Many(n),s},e.upsert=function(e){if(void 0===this.session)throw new Error([`Tried to upsert a ${this.modelName} model instance without a session. `,"Create a session using `session = orm.session()` and call ",`\`session["${this.modelName}"].upsert\` instead.`].join(""));const{idAttribute:t}=this;if(e.hasOwnProperty(t)){const n=e[t];if(this.idExists(n)){const t=this.withId(n);return t.update(e),t}}return this.create(e)},e.withId=function(e){return this.get({[this.idAttribute]:e})},e.idExists=function(e){return this.exists({[this.idAttribute]:e})},e.exists=function(e){if(void 0===this.session)throw new Error([`Tried to check if a ${this.modelName} model instance exists without a session. `,"Create a session using `session = orm.session()` and call ",`\`session["${this.modelName}"].exists\` instead.`].join(""));return Boolean(this._findDatabaseRows(e).length)},e.get=function(e){const t=this._findDatabaseRows(e);if(0===t.length)return null;if(t.length>1)throw new Error(`Expected to find a single row in \`${this.modelName}.get\`. Found ${t.length}.`);return new this(t[0])},t.getClass=function(){return this.constructor},t.getId=function(){return this._fields[this.getClass().idAttribute]},e._findDatabaseRows=function(e){const t={table:this.modelName};return e&&(t.clauses=[{type:L,payload:e}]),this.session.query(t).rows},t.toString=function(){const e=this.getClass();return`${e.modelName}: {${Object.keys(e.fields).map(t=>{if(e.fields[t]instanceof we){return`${t}: [${this[t].toModelArray().map(e=>e.getId()).join(", ")}]`}return`${t}: ${this._fields[t]}`}).join(", ")}}`},t.equals=function(e){return function(e,t){const n=Object.entries(Object(e));return n.length===Object.keys(t).length&&n.every(([e,n])=>t.hasOwnProperty(e)&&t[e]===n)}(this._fields,e._fields)},t.set=function(e,t){this.update({[e]:t})},t.update=function(e){const t=this.getClass();if(void 0===t.session)throw new Error([`Tried to update a ${t.modelName} model instance without a session. `,"You cannot call `.update` on an instance that you did not receive from the database."].join(""));const n={...e},{fields:r,virtualFields:o}=t,s={};for(const e in n){if(r.hasOwnProperty(e)){const t=r[e];t instanceof be||t instanceof ve?n[e]=ne(n[e]):t instanceof we&&(s[e]=n[e],t.as||delete n[e])}else if(o.hasOwnProperty(e)){o[e]instanceof we&&(s[e]=n[e],delete n[e])}}const i={...this._fields,...n},a=new t(i);this.equals(a)||(this._initFields(i),t.session.applyUpdate({action:V,query:Se(this),payload:n})),this._refreshMany2Many(s)},t.refreshFromState=function(){this._initFields(this.ref)},t.delete=function(){const e=this.getClass();if(void 0===e.session)throw new Error([`Tried to delete a ${e.modelName} model instance without a session. `,"You cannot call `.delete` on an instance that you did not receive from the database."].join(""));this._onDelete(),e.session.applyUpdate({action:q,query:Se(this)})},t._refreshMany2Many=function(e){const t=this.getClass(),{fields:n,virtualFields:r,modelName:o}=t;Object.keys(e).forEach(s=>{const i=!n.hasOwnProperty(s),a=r[s],c=e[s];if(!Array.isArray(c))throw new TypeError(`Failed to resolve many-to-many relationship: ${o}[${s}] must be an array (passed: ${c})`);const u=c.map(ne),l=[...new Set(u)];if(u.length!==l.length)throw new Error(`Found duplicate id(s) when passing "${u}" to ${t.modelName}.${s} value`);const d=a.through||G(t.modelName,s),h=t.session[d];let f,p;i?({from:p,to:f}=a.throughFields):({from:f,to:p}=a.throughFields);const m=function(e,t){const n=e.filter(e=>t.includes(e)),r=e.filter(e=>!n.includes(e)),o=t.filter(e=>!n.includes(e));return r.length||o.length?{delete:r,add:o}:null}(h.filter(e=>e[f]===this[t.idAttribute]).toRefArray().map(e=>e[p]),u);if(m){const{delete:e,add:t}=m;e.length>0&&this[a.as||s].remove(...e),t.length>0&&this[a.as||s].add(...t)}})},t._onDelete=function(){const{virtualFields:e}=this.getClass();for(const t in e){const n=e[t];if(n instanceof we){this[n.as||t].clear()}else if(n instanceof be){const e=this[t];e.exists()&&e.update({[n.relatedName]:null})}else n instanceof ve&&null!==this[t]&&(this[t][n.relatedName]=null)}},e.hasId=function(e){return console.warn("`Model.hasId` has been deprecated. Please use `Model.idExists` instead."),this.idExists(e)},t.getNextState=function(){throw new Error("`Model.prototype.getNextState` has been removed. See the 0.9 migration guide on the GitHub repo.")},o()(e,[{key:"ref",get:function(){const e=this.getClass();return e._findDatabaseRows({[e.idAttribute]:this.getId()})[0]}}],[{key:"idAttribute",get:function(){if(void 0===this._session)throw new Error([`Tried to get the ${this.modelName} model's id attribute without a session. `,"Create a session using `session = orm.session()` and access ",`\`session["${this.modelName}"].idAttribute\` instead.`].join(""));return this.session.db.describe(this.modelName).idAttribute}},{key:"session",get:function(){return this._session}},{key:"query",get:function(){return this.getQuerySet()}}]),e}();ke.fields={id:_e()},ke.virtualFields={},ke.querySetClass=ce;var Ee=ke,je=n(11),xe=n.n(je),Fe=n(12),Ae=n.n(Fe),Ce=n(13),Ie=n.n(Ce),Re=n(14),De=n.n(Re);const $e={idAttribute:"id",arrName:"items",mapName:"itemsById",fields:{}};var Te=function(){function e(e){Object.assign(this,$e,e)}var t=e.prototype;return t.accessId=function(e,t){return e[this.mapName][t]},t.accessIds=function(e,t){const n=e[this.mapName];return t.map(e=>n[e])},t.idExists=function(e,t){return e[this.mapName].hasOwnProperty(t)},t.accessIdList=function(e){return e[this.arrName]},t.accessList=function(e){return this.accessIds(e,this.accessIdList(e))},t.getMaxId=function(e){return this.getMeta(e,"maxId")},t.setMaxId=function(e,t,n){return this.setMeta(e,t,"maxId",n)},t.nextId=function(e){return e+1},t.getEmptyState=function(){return{...{[this.arrName]:[],[this.mapName]:{}},indexes:Object.keys(this.fields).filter(e=>e!==this.idAttribute).filter(e=>this.fields[e].index).reduce((e,t)=>({...e,[t]:{}}),{}),meta:{}}},t.setMeta=function(e,t,n,r){const{batchToken:o,withMutations:s}=e;if(s){return U.mutable.setIn(["meta",n],r,t)}return U.batch.setIn(o,["meta",n],r,t)},t.getMeta=function(e,t){return e.meta[t]},t.query=function(e,t){if(0===t.length)return this.accessList(e);const{idAttribute:n}=this,r=De()(t,e=>oe(e,n)?1:function({type:e}){return[L,Q].includes(e)}(e)?2:3),o=(t,r)=>{const{type:s,payload:i}=r;if(!t){if(oe(r,n)){const t=i[n],s=Object.keys(i).reduce((e,t)=>(t!==n&&(e[t]=i[t]),e),{}),a=this.idExists(e,t)?[t]:[];return Object.keys(s).length?o(this.accessIds(e,a),{...r,payload:s}):this.accessIds(e,a)}if(s===L&&"object"==typeof i){const t=Object.entries(e.indexes),n=[],s=[];if(t.forEach(([e,t])=>{oe(r,e)&&t.hasOwnProperty(i[e])&&(n.push(t[i[e]]),s.push(e))}),n.length){const t=n.pop(),a=n.reduce((e,t)=>{const n=new Set(t);return e.filter(Set.prototype.has,n)},t),c=Object.keys(i).reduce((e,t)=>(s.includes(t)||(e[t]=i[t]),e),{});return Object.keys(c).length?o(this.accessIds(e,a),{...r,payload:c}):this.accessIds(e,a)}}return o(this.accessList(e),r)}switch(s){case L:return xe()(t,i);case Q:return Ie()(t,i);case"REDUX_ORM_ORDER_BY":{const[e,n]=i;return Ae()(t,e,function(e){if(void 0===e)return;const t=e=>["desc",!1].includes(e)?"desc":"asc";return Array.isArray(e)?e.map(t):t(e)}(n))}default:return t}};return r.reduce(o,void 0)},t.insert=function(e,t,n){const{batchToken:r,withMutations:o}=e,s=n.hasOwnProperty(this.idAttribute);let i=t;const[a,c]=function(e,t){let n,r,o=e;return void 0===o&&(o=-1),void 0===t?(n=o+1,r=n):(n=Math.max(o+1,t),r=t),[n,r]}(this.getMaxId(t),n[this.idAttribute]);i=this.setMaxId(e,t,a);const u=s?n:U.batch.set(r,this.idAttribute,c,n),l=Object.keys(i.indexes).filter(e=>n.hasOwnProperty(e)&&null!==n[e]).map(e=>[e,n[e]]);if(o)return U.mutable.push(c,i[this.arrName]),U.mutable.set(c,u,i[this.mapName]),l.forEach(([e,t])=>{const n=i.indexes[e];n.hasOwnProperty(t)?U.mutable.push(c,n[t]):U.mutable.set(t,[c],n)}),{state:i,created:u};const d=U.batch.merge(r,l.reduce((e,[t,n])=>(e[t]=U.batch.merge(r,{[n]:U.batch.push(r,c,e[t][n]||[])},e[t]),e),{...i.indexes}),i.indexes);return{state:U.batch.merge(r,{[this.arrName]:U.batch.push(r,c,i[this.arrName]),[this.mapName]:U.batch.merge(r,{[c]:u},i[this.mapName]),indexes:d},i),created:u}},t.update=function(e,t,n,r){const{batchToken:o,withMutations:s}=e,i=s?U.mutable.set:U.batch.set(o),a=Object.keys(t.indexes).filter(e=>r.hasOwnProperty(e)),c=[],u=[],l=n.reduce((e,t)=>{const n=a.reduce((e,n)=>({...e,[n]:t[n]}),{}),l=(e=>{return(s?U.mutable.merge:U.batch.merge(o))(r,e)})(t),d=a.reduce((e,t)=>({...e,[t]:l[t]}),{}),h=l[this.idAttribute],f=i(h,l,e);return a.forEach(e=>{const{[e]:t}=n,{[e]:r}=d;t!==r&&(null!=t&&u.push([e,t,h]),null!==r&&c.push([e,r,h]))}),f},t[this.mapName]);let d=t.indexes;return s?(u.forEach(([e,t,n])=>{const r=d[e][t],o=r.indexOf(n);U.mutable.splice(o,1,[],r)}),c.forEach(([e,t,n])=>{U.mutable.push(n,d[e][t])})):(c.length&&(d=U.batch.merge(o,c.reduce((e,[t,n,r])=>(e[t]=U.batch.merge(o,{[n]:U.batch.push(o,r,e[t][n]||[])},e[t]),e),{...d}),d)),u.length&&(d=U.batch.merge(o,u.reduce((e,[t,n,r])=>(e[t]=U.batch.merge(o,{[n]:U.batch.filter(o,e=>e!==r,e[t][n])},e[t]),e),{...d}),d))),U.batch.merge(o,{[this.mapName]:l,indexes:d},t)},t.delete=function(e,t,n){const{batchToken:r,withMutations:o}=e,{arrName:s,mapName:i}=this,a=t[s],c=n.map(e=>e[this.idAttribute]);if(o)return c.forEach(e=>{const n=a.indexOf(e);U.mutable.splice(n,1,[],a),U.mutable.omit(e,t[i])}),Object.values(t.indexes).forEach(e=>Object.values(e).forEach(e=>c.forEach(t=>{const n=e.indexOf(t);-1!==n&&U.mutable.splice(n,1,[],e)}))),t;const u=U.batch.merge(r,Object.entries(t.indexes).reduce((e,[t,n])=>(e[t]=U.batch.merge(r,Object.entries(n).reduce((e,[t,n])=>(e[t]=U.batch.filter(r,e=>!c.includes(e),n),e),{...e[t]}),e[t]),e),{...t.indexes}),t.indexes);return U.batch.merge(r,{[s]:U.batch.filter(r,e=>!c.includes(e),t[s]),[i]:U.batch.omit(r,c,t[i]),indexes:U.batch.merge(r,u,t.indexes)},t)},e}();const Pe={};function Be(e,t,n){const{table:r,clauses:o}=t;return{rows:e[r].query(n[r],o)}}function Ue(e,t,n,r){const{action:o,payload:s}=t;let i,a,c;if(o===z){({table:i}=t);const o=e[i],u=r[i],l=o.insert(n,u,s);a=l.state,c=l.created}else{const{query:u}=t;({table:i}=u);const{rows:l}=Be(e,u,r),d=e[i],h=r[i];if(o===V)a=d.update(n,h,l,s),c=Be(e,u,r).rows;else{if(o!==q)throw new Error(`Database received unknown update type: ${o}`);a=d.delete(n,h,l),c=l}}const u=function(e,t,n,r){const{batchToken:o,withMutations:s}=n;return s?(r[e]=t,r):U.batch.set(o,e,t,r)}(i,a,n,r);return{status:X,state:u,payload:c}}Object.defineProperty(Pe,"@@_______REDUX_ORM_STATE_FLAG",{enumerable:!0,value:!0});var Ve=function(e){const{tables:t}=e,n=Object.entries(t).reduce((e,[t,n])=>({...e,[t]:new Te(n)}),{});return{getEmptyState:()=>Object.entries(n).reduce((e,[t,n])=>({...e,[t]:n.getEmptyState()}),Pe),query:Be.bind(null,n),update:Ue.bind(null,n),describe:e=>n[e]}};let qe=function(){function e({parent:e,orm:t}){this._parent=e,this._orm=t,this.keySelector=Y}return o()(e,[{key:"cachePath",get:function(){return[...this._parent?this._parent.cachePath:[],this.key]}},{key:"orm",get:function(){return this._orm}},{key:"parent",get:function(){return this._parent}}]),e}(),ze=function(e){function t({model:t,...n}){var r;return(r=e.call(this,n)||this)._model=t,r}return de()(t,e),o()(t,[{key:"resultFunc",get:function(){return(e,t,...n)=>{const{[this._model.modelName]:r}=e;return void 0===t?r.all().toModelArray().map(t=>this.valueForInstance(t,e,...n)):Array.isArray(t)?t.map(t=>this.valueForInstance(r.withId(t),e,...n)):this.valueForInstance(r.withId(t),e,...n)}}},{key:"model",get:function(){return this._model}}]),t}(qe);function Le(e,t){return t}let Qe=function(e){function t({field:t,selector:n,...r}){var o;return(o=e.call(this,r)||this)._field=t,o._selector=n,o}return de()(t,e),t.prototype.createResultFunc=function(e){const{idAttribute:t}=this._parent.toModel;return(n,...r)=>{const o=e(n,...r),s=Le(n,...r),i=e=>null===e?null:e.map(e=>this._selector(n,e[t]));return void 0===s||Array.isArray(s)?o.map(i):i(o)}},o()(t,[{key:"selector",get:function(){return this._selector},set:function(e){this._selector=e}},{key:"key",get:function(){return this._selector}}]),t}(ze),Xe=function(e){function t({model:t,...n}){var r;return(r=e.call(this,n)||this)._model=t,r}return de()(t,e),o()(t,[{key:"key",get:function(){return this._model.modelName}},{key:"dependencies",get:function(){return[this._orm,Le]}},{key:"resultFunc",get:function(){return({[this._model.modelName]:e},t)=>{if(void 0===t)return e.all().toRefArray();if(Array.isArray(t))return t.map(t=>{const n=e.withId(t);return n?n.ref:null});const n=e.withId(t);return n?n.ref:null}}},{key:"model",get:function(){return this._model}}]),t}(qe),He=function(e){function t({field:t,fieldModel:n,accessorName:r,isVirtual:o,...s}){var i;return(i=e.call(this,s)||this)._field=t,i._fieldModel=n,i._accessorName=r,i._isVirtual=o,i}de()(t,e);var n=t.prototype;return n.valueForInstance=function(e,t){if(!e)return null;let n;if(this._parent instanceof Xe)n=e[this._accessorName];else{const{[this._parent.toModelName]:r}=t,o=this._parent.valueForInstance(e,t),s=o?new r(o):null;n=s?s[this._accessorName]:null}return n instanceof Ee?n.ref:n instanceof ce?n.toRefArray():n},n.map=function(e){if(e instanceof Xe)throw this.toModelName===e.model.modelName?new Error(`Cannot select models in a \`map()\` call. If you just want the \`${this._accessorName}\` as a ref array then you can simply drop the \`map()\`. Otherwise make sure you're passing a field selector of the form \`${this.toModelName}.<field>\` or a custom selector instead.`):new Error(`Cannot select \`${e.model.modelName}\` models in this \`map()\` call. Make sure you're passing a field selector of the form \`${this.toModelName}.<field>\` or a custom selector instead.`);if(e instanceof t||e instanceof Qe){if(this.toModelName!==e.model.modelName)throw new Error(`Cannot select fields of the \`${e.model.modelName}\` model in this \`map()\` call. Make sure you're passing a field selector of the form \`${this.toModelName}.<field>\` or a custom selector instead.`)}else if(!e||"function"!=typeof e||!e.recomputations)throw new Error(`\`map()\` requires a selector as an input. Received: ${JSON.stringify(e)} of type ${typeof e}`);if(!(this._field instanceof be||this._field instanceof we))throw new Error("Cannot map selectors for non-collection fields");return new Qe({parent:this,model:this._model,orm:this._orm,field:this._field,selector:e})},o()(t,[{key:"key",get:function(){return this._accessorName}},{key:"dependencies",get:function(){return[this._orm,Le]}},{key:"toModelName",get:function(){return"this"===this._field.toModelName?this._fieldModel.modelName:this._field.toModelName}},{key:"toModel",get:function(){return this._orm.getDatabase().describe(this.toModelName)}}]),t}(ze);function Ye({parent:e,model:t,field:n,fieldModel:r,accessorName:o,orm:s,isVirtual:i}){const a=new He({parent:e,model:t,field:n,fieldModel:r,accessorName:o,orm:s,isVirtual:i});if(!(n instanceof ge))return a;if(e instanceof He&&(e._field instanceof be&&e._isVirtual||e._field instanceof we))throw new Error(`Cannot create a selector for \`${e._accessorName}.${o}\` because \`${e._accessorName}\` is a collection field.`);const{toModelName:c}=n,u=s.get("this"===c?t.modelName:c);return Object.entries(u.fields).forEach(([e,n])=>{const r=n.as||e;Object.defineProperty(a,r,{get:()=>Ye({parent:a,model:t,fieldModel:u,field:n,accessorName:r,orm:s,isVirtual:!1})})}),Object.entries(u.virtualFields).forEach(([e,n])=>{const r=n.as||e;a.hasOwnProperty(r)||Object.defineProperty(a,r,{get:()=>Ye({parent:a,model:t,fieldModel:u,field:n,accessorName:r,orm:s,isVirtual:!0})})}),a}const Ke={createDatabase:Ve},Ge=["indexes","meta"],Je=e=>Ge.includes(e);let We=function(){function e(e){const{createDatabase:t}={...Ke,...e||{}};this.createDatabase=t,this.registry=[],this.implicitThroughModels=[],this.installedFields={},this.stateSelector=e?e.stateSelector:null}var t=e.prototype;return t.register=function(...e){e.forEach(e=>{if(void 0===e.modelName)throw new Error("A model was passed that doesn't have a modelName set");e.invalidateClassCache(),this.registerManyToManyModelsFor(e),this.registry.push(e),Object.defineProperty(this,e.modelName,{get:()=>(this._setupModelPrototypes(this.registry),function({model:e,orm:t}){const n=new Xe({parent:null,orm:t,model:e});return Object.entries(e.fields).forEach(([r,o])=>{const s=o.as||r;Object.defineProperty(n,s,{get:()=>Ye({parent:n,model:e,fieldModel:e,field:o,accessorName:s,orm:t,isVirtual:!1})})}),Object.entries(e.virtualFields).forEach(([r,o])=>{const s=o.as||r;n.hasOwnProperty(s)||Object.defineProperty(n,s,{get:()=>Ye({parent:n,model:e,fieldModel:e,field:o,accessorName:s,orm:t,isVirtual:!0})})}),n}({model:e,orm:this}))})})},t.registerManyToManyModelsFor=function(e){const{fields:t}=e,n=e.modelName;Object.entries(t).forEach(([e,t])=>{if(!(t instanceof we))return;let r;r="this"===t.toModelName?n:t.toModelName;const s=n===r,i=J(n),a=W(r);if(t.through){if(s&&!t.throughFields)throw new Error("Self-referencing many-to-many relationship at "+`"${n}.${e}" using custom `+`model "${t.through}" has no `+"throughFields key. Cannot determine which fields reference the instances partaking in the relationship.")}else{const t=function(e){function t(){return e.apply(this,arguments)||this}return de()(t,e),t}(Ee);t.modelName=G(n,e);const c=function(e){function t(){return e.apply(this,arguments)||this}return de()(t,e),o()(t,[{key:"installsBackwardsVirtualField",get:function(){return!1}},{key:"installsBackwardsDescriptor",get:function(){return!1}}]),t}(be),u=s?c:be;t.fields={id:_e(),[i]:new u(n),[a]:new u(r)},t.invalidateClassCache(),this.implicitThroughModels.push(t)}})},t.get=function(e){const t=this.registry.concat(this.implicitThroughModels),n=Object.values(t).find(t=>t.modelName===e);if(void 0===n)throw new Error(`Did not find model ${e} from registry.`);return n},t.getModelClasses=function(){return this._setupModelPrototypes(this.registry),this._setupModelPrototypes(this.implicitThroughModels),this.registry.concat(this.implicitThroughModels)},t.generateSchemaSpec=function(){return{tables:this.getModelClasses().reduce((e,t)=>{const n=t.modelName,r=t.tableOptions();return Object.keys(r).filter(Je).forEach(e=>{throw new Error(`Reserved keyword \`${e}\` used in ${n}.options.`)}),e[n]={fields:{...t.fields},...r},e},{})}},t.getDatabase=function(){return this.db||(this.db=this.createDatabase(this.generateSchemaSpec())),this.db},t.getEmptyState=function(){return this.getDatabase().getEmptyState()},t.session=function(e){return new ue(this,this.getDatabase(),e)},t.mutableSession=function(e){return new ue(this,this.getDatabase(),e,!0)},t._setupModelPrototypes=function(e){e.filter(e=>!e.isSetUp).forEach(e=>{const{fields:t,modelName:n,querySetClass:r}=e;Object.entries(t).forEach(([t,r])=>{if(!(r instanceof fe))throw new Error(`${n}.${t} is of type "${typeof r}" `+"but must be an instance of Field. Please use the `attr`, `fk`, `oneToOne` and `many` functions to define fields.");this._isFieldInstalled(n,t)||(this._installField(r,t,e),this._setFieldInstalled(n,t))}),te(e,r),e.isSetUp=!0})},t._isFieldInstalled=function(e,t){return!!this.installedFields.hasOwnProperty(e)&&!!this.installedFields[e][t]},t._setFieldInstalled=function(e,t){this.installedFields.hasOwnProperty(e)||(this.installedFields[e]={}),this.installedFields[e][t]=!0},t._installField=function(e,t,n){new(0,e.installerClass)({field:e,fieldName:t,model:n,orm:this}).run()},t.withMutations=function(e){return K("`ORM.prototype.withMutations` has been deprecated. Use `ORM.prototype.mutableSession` instead."),this.mutableSession(e)},t.from=function(e){return K("`ORM.prototype.from` has been deprecated. Use `ORM.prototype.session` instead."),this.session(e)},t.getDefaultState=function(){return K("`ORM.prototype.getDefaultState` has been deprecated. Use `ORM.prototype.getEmptyState` instead."),this.getEmptyState()},t.define=function(){throw new Error("`ORM.prototype.define` has been removed. Please define a Model class.")},e}();var Ze=n(4),et=n(5),tt=n.n(et);const nt=(e,t)=>e===t,rt=e=>e&&"object"==typeof e&&e.hasOwnProperty("@@_______REDUX_ORM_STATE_FLAG"),ot=(e,t,n)=>t.every((t,r)=>rt(t)&&rt(e[r])||n(t,e[r])),st=(e,t,n)=>{const{accessedInstances:r}=e;return Object.entries(r).every(([r,o])=>{if(e.ormState[r]===t[r])return!0;const{mapName:s}=n.getDatabase().describe(r),{[s]:i}=e.ormState[r],{[s]:a}=t[r];return((e,t,n)=>e.every(e=>t[e]===n[e]))(Object.keys(o),i,a)})},it=(e,t)=>{const{accessedIndexes:n}=e;return Object.entries(n).every(([n,r])=>Object.entries(r).every(([r,o])=>o.every(o=>e.ormState[n].indexes[r][o]===t[n].indexes[r][o])))},at=(e,t)=>e.fullTableScannedModels.every(n=>e.ormState[n]===t[n]);function ct(e,t=nt,n){let r={result:null,args:null,ormState:null,fullTableScannedModels:[],accessedInstances:{},accessedIndexes:{}};return(...o)=>{const[s,...i]=o;if(Boolean(r.args)&&ot(r.args,i,t)&&at(r,s)&&it(r,s)&&st(r,s,n))return r.result;const a=n.session(s),c=i.map(e=>rt(e)?a:e),u=e.apply(null,c);return r={args:i,result:u,ormState:s,accessedInstances:a.accessedModelInstances,accessedIndexes:a.accessedIndexes,fullTableScannedModels:a.fullTableScannedModels},u}}function ut(e,t){e.sessionBoundModels.forEach(n=>{"function"==typeof n.reducer&&n.reducer(t,n,e)})}function lt(e,t=ut){return(n,r)=>{const o=e.session(n||e.getEmptyState());return t(o,r),o.state}}function dt(e){return e instanceof We?e:e instanceof qe&&e._orm}const ht=new Map,ft=Symbol.for("REDUX_ORM_SELECTOR");function pt(e){if("function"==typeof e)return e;if(e instanceof We)return e.stateSelector;if(e instanceof Qe&&(e.selector=pt(e.selector)),e instanceof qe){const{orm:t,cachePath:n}=e;let r;ht.has(t)||ht.set(t,new Map),r=ht.get(t);for(let e=0;e<n.length;++e){const t=n[e];r.has(t)||r.set(t,new Map),r=r.get(t)}if(r&&r.has(ft))return r.get(ft);const o=function e(t){if(t instanceof Qe){const n=e(t.parent);return t.createResultFunc(n)}return tt()(t.dependencies,t.resultFunc)({keySelector:t.keySelector,cacheObject:new et.FlatMapCache,selectorCreator:mt})}(e);return r.set(ft,o),o}throw new Error(`Failed to interpret selector argument: ${JSON.stringify(e)} of type ${typeof e}`)}function mt(...e){if(!e.length)throw new Error("Cannot create a selector without arguments.");const t=e.pop(),n=Array.isArray(e[0])?e[0]:e,r=n.map(dt).find(Boolean),o=n.map(pt);if("function"==typeof t){if(!r)throw new Error("Failed to resolve the current ORM database state. Please pass an ORM instance or an ORM selector as an argument to `createSelector()`.");if(!r.stateSelector)throw new Error("Failed to resolve the current ORM database state. Please pass an object to the ORM constructor that specifies a `stateSelector` function.");if("function"!=typeof r.stateSelector)throw new Error(`Failed to resolve the current ORM database state. Please pass a function when specifying the ORM's \`stateSelector\`. Received: ${JSON.stringify(r.stateSelector)} of type ${typeof r.stateSelector}`);return Object(Ze.createSelectorCreator)(ct,void 0,r)([r.stateSelector,...o],t)}if(t instanceof We)throw new Error("ORM instances cannot be the result function of selectors. You can access your models in the last function that you pass to `createSelector()`.");return o.length&&console.warn("Your input selectors will be ignored: the passed result function does not require any input."),pt(t)}n.d(t,"Schema",(function(){return yt})),n.d(t,"Backend",(function(){return gt})),n.d(t,"Attribute",(function(){return ye})),n.d(t,"QuerySet",(function(){return ce})),n.d(t,"Model",(function(){return Ee})),n.d(t,"ORM",(function(){return We})),n.d(t,"Session",(function(){return ue})),n.d(t,"ForeignKey",(function(){return be})),n.d(t,"ManyToMany",(function(){return we})),n.d(t,"OneToOne",(function(){return ve})),n.d(t,"fk",(function(){return Me})),n.d(t,"many",(function(){return Oe})),n.d(t,"attr",(function(){return _e})),n.d(t,"oneToOne",(function(){return Ne})),n.d(t,"createReducer",(function(){return lt})),n.d(t,"createSelector",(function(){return mt}));const yt=function(){throw new Error("Schema has been renamed to ORM. Please import ORM instead of Schema from Redux-ORM.")},gt=function(){throw new Error("Having a custom Backend instance is now unsupported. Documentation for database customization is upcoming, for now please look at the db folder in the source.")};t.default=Ee}])}));
//# sourceMappingURL=redux-orm.min.js.map

@@ -102,3 +102,3 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";

return _objectSpread({}, map, _defineProperty({}, tableName, new Table(tableSpec)));
return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, tableName, new Table(tableSpec)));
}, {});

@@ -112,3 +112,3 @@

return _objectSpread({}, map, _defineProperty({}, tableName, table.getEmptyState()));
return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, tableName, table.getEmptyState()));
}, BASE_EMPTY_STATE);

@@ -115,0 +115,0 @@ };

@@ -89,5 +89,3 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";

export var Table =
/*#__PURE__*/
function () {
export var Table = /*#__PURE__*/function () {
/**

@@ -170,5 +168,5 @@ * Creates a new {@link Table} instance.

}).reduce(function (indexes, attr) {
return _objectSpread({}, indexes, _defineProperty({}, attr, {}));
return _objectSpread(_objectSpread({}, indexes), {}, _defineProperty({}, attr, {}));
}, {});
return _objectSpread({}, pkIndex, {
return _objectSpread(_objectSpread({}, pkIndex), {}, {
indexes: attrIndexes,

@@ -244,3 +242,3 @@ meta: {}

*/
return reducer(_this2.accessIds(branch, ids), _objectSpread({}, clause, {
return reducer(_this2.accessIds(branch, ids), _objectSpread(_objectSpread({}, clause), {}, {
payload: remainingPayload

@@ -303,3 +301,3 @@ }));

*/
return reducer(_this2.accessIds(branch, indexedIds), _objectSpread({}, clause, {
return reducer(_this2.accessIds(branch, indexedIds), _objectSpread(_objectSpread({}, clause), {}, {
payload: _remainingPayload

@@ -450,7 +448,7 @@ }));

var prevAttrValues = indexedAttrs.reduce(function (valueMap, attr) {
return _objectSpread({}, valueMap, _defineProperty({}, attr, row[attr]));
return _objectSpread(_objectSpread({}, valueMap), {}, _defineProperty({}, attr, row[attr]));
}, {});
var result = mergeObjInto(row);
var nextAttrValues = indexedAttrs.reduce(function (valueMap, attr) {
return _objectSpread({}, valueMap, _defineProperty({}, attr, result[attr]));
return _objectSpread(_objectSpread({}, valueMap), {}, _defineProperty({}, attr, result[attr]));
}, {});

@@ -468,3 +466,3 @@ var id = result[_this3.idAttribute];

if (prevValue !== null) {
if (prevValue !== null && typeof prevValue !== "undefined") {
// remove id from attribute's index for its old value

@@ -471,0 +469,0 @@ indexIdsToDelete.push([attr, prevValue, id]);

@@ -8,5 +8,3 @@ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";

export var Attribute =
/*#__PURE__*/
function (_Field) {
export var Attribute = /*#__PURE__*/function (_Field) {
_inheritsLoose(Attribute, _Field);

@@ -13,0 +11,0 @@

@@ -10,5 +10,3 @@ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";

export var DefaultFieldInstaller =
/*#__PURE__*/
function (_FieldInstallerTempla) {
export var DefaultFieldInstaller = /*#__PURE__*/function (_FieldInstallerTempla) {
_inheritsLoose(DefaultFieldInstaller, _FieldInstallerTempla);

@@ -15,0 +13,0 @@

@@ -8,5 +8,3 @@ import _createClass from "@babel/runtime/helpers/createClass";

export var Field =
/*#__PURE__*/
function () {
export var Field = /*#__PURE__*/function () {
function Field() {}

@@ -13,0 +11,0 @@

@@ -9,5 +9,3 @@ import _createClass from "@babel/runtime/helpers/createClass";

*/
export var FieldInstallerTemplate =
/*#__PURE__*/
function () {
export var FieldInstallerTemplate = /*#__PURE__*/function () {
function FieldInstallerTemplate(opts) {

@@ -14,0 +12,0 @@ this.field = opts.field;

@@ -9,5 +9,3 @@ import _createClass from "@babel/runtime/helpers/createClass";

export var ForeignKey =
/*#__PURE__*/
function (_RelationalField) {
export var ForeignKey = /*#__PURE__*/function (_RelationalField) {
_inheritsLoose(ForeignKey, _RelationalField);

@@ -14,0 +12,0 @@

@@ -11,5 +11,3 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";

export var ManyToMany =
/*#__PURE__*/
function (_RelationalField) {
export var ManyToMany = /*#__PURE__*/function (_RelationalField) {
_inheritsLoose(ManyToMany, _RelationalField);

@@ -16,0 +14,0 @@

@@ -8,5 +8,3 @@ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";

export var OneToOne =
/*#__PURE__*/
function (_RelationalField) {
export var OneToOne = /*#__PURE__*/function (_RelationalField) {
_inheritsLoose(OneToOne, _RelationalField);

@@ -13,0 +11,0 @@

@@ -14,5 +14,3 @@ import _typeof from "@babel/runtime/helpers/typeof";

export var RelationalField =
/*#__PURE__*/
function (_Field) {
export var RelationalField = /*#__PURE__*/function (_Field) {
_inheritsLoose(RelationalField, _Field);

@@ -69,21 +67,18 @@

get: function get() {
return (
/*#__PURE__*/
function (_DefaultFieldInstalle) {
_inheritsLoose(AliasedForwardsDescriptorInstaller, _DefaultFieldInstalle);
return /*#__PURE__*/function (_DefaultFieldInstalle) {
_inheritsLoose(AliasedForwardsDescriptorInstaller, _DefaultFieldInstalle);
function AliasedForwardsDescriptorInstaller() {
return _DefaultFieldInstalle.apply(this, arguments) || this;
}
function AliasedForwardsDescriptorInstaller() {
return _DefaultFieldInstalle.apply(this, arguments) || this;
}
var _proto2 = AliasedForwardsDescriptorInstaller.prototype;
var _proto2 = AliasedForwardsDescriptorInstaller.prototype;
_proto2.installForwardsDescriptor = function installForwardsDescriptor() {
Object.defineProperty(this.model.prototype, this.field.as || this.fieldName, // use supplied name if possible
this.field.createForwardsDescriptor(this.fieldName, this.model, this.toModel, this.throughModel));
};
_proto2.installForwardsDescriptor = function installForwardsDescriptor() {
Object.defineProperty(this.model.prototype, this.field.as || this.fieldName, // use supplied name if possible
this.field.createForwardsDescriptor(this.fieldName, this.model, this.toModel, this.throughModel));
};
return AliasedForwardsDescriptorInstaller;
}(DefaultFieldInstaller)
);
return AliasedForwardsDescriptorInstaller;
}(DefaultFieldInstaller);
}

@@ -90,0 +85,0 @@ }]);

@@ -58,5 +58,3 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";

var Model =
/*#__PURE__*/
function () {
var Model = /*#__PURE__*/function () {
/**

@@ -598,3 +596,3 @@ * Creates a Model instance from it's properties.

var mergedFields = _objectSpread({}, this._fields, {}, mergeObj);
var mergedFields = _objectSpread(_objectSpread({}, this._fields), mergeObj);

@@ -736,3 +734,4 @@ var updatedModel = new ThisModel(mergedFields); // only update fields if they have changed (referentially)

// Delete any many-to-many rows the entity is included in.
this[key].clear();
var descriptorKey = field.as || key;
this[descriptorKey].clear();
} else if (field instanceof ForeignKey) {

@@ -739,0 +738,0 @@ var relatedQs = this[key];

@@ -44,5 +44,3 @@ import _typeof from "@babel/runtime/helpers/typeof";

var ORM =
/*#__PURE__*/
function () {
var ORM = /*#__PURE__*/function () {
/**

@@ -59,3 +57,3 @@ * Creates a new ORM instance.

function ORM(opts) {
var _ORM_DEFAULTS = _objectSpread({}, ORM_DEFAULTS, {}, opts || {}),
var _ORM_DEFAULTS = _objectSpread(_objectSpread({}, ORM_DEFAULTS), opts || {}),
createDatabase = _ORM_DEFAULTS.createDatabase;

@@ -148,5 +146,3 @@

var Through =
/*#__PURE__*/
function (_Model) {
var Through = /*#__PURE__*/function (_Model) {
_inheritsLoose(ThroughModel, _Model);

@@ -163,5 +159,3 @@

var PlainForeignKey =
/*#__PURE__*/
function (_ForeignKey) {
var PlainForeignKey = /*#__PURE__*/function (_ForeignKey) {
_inheritsLoose(PlainForeignKey, _ForeignKey);

@@ -168,0 +162,0 @@

@@ -33,5 +33,3 @@ import _typeof from "@babel/runtime/helpers/typeof";

var QuerySet =
/*#__PURE__*/
function () {
var QuerySet = /*#__PURE__*/function () {
/**

@@ -60,3 +58,3 @@ * Creates a QuerySet. The constructor is mainly for internal use;

_proto._new = function _new(clauses, userOpts) {
var opts = _objectSpread({}, this._opts, {}, userOpts);
var opts = _objectSpread(_objectSpread({}, this._opts), userOpts);

@@ -63,0 +61,0 @@ return new this.constructor(this.modelClass, clauses, opts);

@@ -14,5 +14,3 @@ import _typeof from "@babel/runtime/helpers/typeof";

var FieldSelectorSpec =
/*#__PURE__*/
function (_ModelBasedSelectorSp) {
var FieldSelectorSpec = /*#__PURE__*/function (_ModelBasedSelectorSp) {
_inheritsLoose(FieldSelectorSpec, _ModelBasedSelectorSp);

@@ -19,0 +17,0 @@

@@ -7,5 +7,3 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";

var MapSelectorSpec =
/*#__PURE__*/
function (_ModelBasedSelectorSp) {
var MapSelectorSpec = /*#__PURE__*/function (_ModelBasedSelectorSp) {
_inheritsLoose(MapSelectorSpec, _ModelBasedSelectorSp);

@@ -12,0 +10,0 @@

@@ -6,5 +6,3 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";

var ModelBasedSelectorSpec =
/*#__PURE__*/
function (_SelectorSpec) {
var ModelBasedSelectorSpec = /*#__PURE__*/function (_SelectorSpec) {
_inheritsLoose(ModelBasedSelectorSpec, _SelectorSpec);

@@ -11,0 +9,0 @@

@@ -7,5 +7,3 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";

var ModelSelectorSpec =
/*#__PURE__*/
function (_SelectorSpec) {
var ModelSelectorSpec = /*#__PURE__*/function (_SelectorSpec) {
_inheritsLoose(ModelSelectorSpec, _SelectorSpec);

@@ -12,0 +10,0 @@

@@ -5,5 +5,3 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";

var SelectorSpec =
/*#__PURE__*/
function () {
var SelectorSpec = /*#__PURE__*/function () {
function SelectorSpec(_ref) {

@@ -10,0 +8,0 @@ var parent = _ref.parent,

@@ -8,5 +8,3 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";

var Session =
/*#__PURE__*/
function () {
var Session = /*#__PURE__*/function () {
/**

@@ -13,0 +11,0 @@ * Creates a new Session.

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

return _objectSpread({}, map, (0, _defineProperty2["default"])({}, tableName, new _Table["default"](tableSpec)));
return _objectSpread(_objectSpread({}, map), {}, (0, _defineProperty2["default"])({}, tableName, new _Table["default"](tableSpec)));
}, {});

@@ -126,3 +126,3 @@

return _objectSpread({}, map, (0, _defineProperty2["default"])({}, tableName, table.getEmptyState()));
return _objectSpread(_objectSpread({}, map), {}, (0, _defineProperty2["default"])({}, tableName, table.getEmptyState()));
}, BASE_EMPTY_STATE);

@@ -129,0 +129,0 @@ };

@@ -107,5 +107,3 @@ "use strict";

var Table =
/*#__PURE__*/
function () {
var Table = /*#__PURE__*/function () {
/**

@@ -188,5 +186,5 @@ * Creates a new {@link Table} instance.

}).reduce(function (indexes, attr) {
return _objectSpread({}, indexes, (0, _defineProperty2["default"])({}, attr, {}));
return _objectSpread(_objectSpread({}, indexes), {}, (0, _defineProperty2["default"])({}, attr, {}));
}, {});
return _objectSpread({}, pkIndex, {
return _objectSpread(_objectSpread({}, pkIndex), {}, {
indexes: attrIndexes,

@@ -263,3 +261,3 @@ meta: {}

*/
return reducer(_this2.accessIds(branch, ids), _objectSpread({}, clause, {
return reducer(_this2.accessIds(branch, ids), _objectSpread(_objectSpread({}, clause), {}, {
payload: remainingPayload

@@ -322,3 +320,3 @@ }));

*/
return reducer(_this2.accessIds(branch, indexedIds), _objectSpread({}, clause, {
return reducer(_this2.accessIds(branch, indexedIds), _objectSpread(_objectSpread({}, clause), {}, {
payload: _remainingPayload

@@ -473,7 +471,7 @@ }));

var prevAttrValues = indexedAttrs.reduce(function (valueMap, attr) {
return _objectSpread({}, valueMap, (0, _defineProperty2["default"])({}, attr, row[attr]));
return _objectSpread(_objectSpread({}, valueMap), {}, (0, _defineProperty2["default"])({}, attr, row[attr]));
}, {});
var result = mergeObjInto(row);
var nextAttrValues = indexedAttrs.reduce(function (valueMap, attr) {
return _objectSpread({}, valueMap, (0, _defineProperty2["default"])({}, attr, result[attr]));
return _objectSpread(_objectSpread({}, valueMap), {}, (0, _defineProperty2["default"])({}, attr, result[attr]));
}, {});

@@ -491,3 +489,3 @@ var id = result[_this3.idAttribute];

if (prevValue !== null) {
if (prevValue !== null && typeof prevValue !== "undefined") {
// remove id from attribute's index for its old value

@@ -494,0 +492,0 @@ indexIdsToDelete.push([attr, prevValue, id]);

@@ -19,5 +19,3 @@ "use strict";

*/
var Attribute =
/*#__PURE__*/
function (_Field) {
var Attribute = /*#__PURE__*/function (_Field) {
(0, _inheritsLoose2["default"])(Attribute, _Field);

@@ -24,0 +22,0 @@

@@ -21,5 +21,3 @@ "use strict";

*/
var DefaultFieldInstaller =
/*#__PURE__*/
function (_FieldInstallerTempla) {
var DefaultFieldInstaller = /*#__PURE__*/function (_FieldInstallerTempla) {
(0, _inheritsLoose2["default"])(DefaultFieldInstaller, _FieldInstallerTempla);

@@ -26,0 +24,0 @@

@@ -18,5 +18,3 @@ "use strict";

*/
var Field =
/*#__PURE__*/
function () {
var Field = /*#__PURE__*/function () {
function Field() {}

@@ -23,0 +21,0 @@

@@ -18,5 +18,3 @@ "use strict";

*/
var FieldInstallerTemplate =
/*#__PURE__*/
function () {
var FieldInstallerTemplate = /*#__PURE__*/function () {
function FieldInstallerTemplate(opts) {

@@ -23,0 +21,0 @@ this.field = opts.field;

@@ -21,5 +21,3 @@ "use strict";

*/
var ForeignKey =
/*#__PURE__*/
function (_RelationalField) {
var ForeignKey = /*#__PURE__*/function (_RelationalField) {
(0, _inheritsLoose2["default"])(ForeignKey, _RelationalField);

@@ -26,0 +24,0 @@

@@ -25,5 +25,3 @@ "use strict";

*/
var ManyToMany =
/*#__PURE__*/
function (_RelationalField) {
var ManyToMany = /*#__PURE__*/function (_RelationalField) {
(0, _inheritsLoose2["default"])(ManyToMany, _RelationalField);

@@ -30,0 +28,0 @@

@@ -19,5 +19,3 @@ "use strict";

*/
var OneToOne =
/*#__PURE__*/
function (_RelationalField) {
var OneToOne = /*#__PURE__*/function (_RelationalField) {
(0, _inheritsLoose2["default"])(OneToOne, _RelationalField);

@@ -24,0 +22,0 @@

@@ -28,5 +28,3 @@ "use strict";

*/
var RelationalField =
/*#__PURE__*/
function (_Field) {
var RelationalField = /*#__PURE__*/function (_Field) {
(0, _inheritsLoose2["default"])(RelationalField, _Field);

@@ -83,21 +81,18 @@

get: function get() {
return (
/*#__PURE__*/
function (_DefaultFieldInstalle) {
(0, _inheritsLoose2["default"])(AliasedForwardsDescriptorInstaller, _DefaultFieldInstalle);
return /*#__PURE__*/function (_DefaultFieldInstalle) {
(0, _inheritsLoose2["default"])(AliasedForwardsDescriptorInstaller, _DefaultFieldInstalle);
function AliasedForwardsDescriptorInstaller() {
return _DefaultFieldInstalle.apply(this, arguments) || this;
}
function AliasedForwardsDescriptorInstaller() {
return _DefaultFieldInstalle.apply(this, arguments) || this;
}
var _proto2 = AliasedForwardsDescriptorInstaller.prototype;
var _proto2 = AliasedForwardsDescriptorInstaller.prototype;
_proto2.installForwardsDescriptor = function installForwardsDescriptor() {
Object.defineProperty(this.model.prototype, this.field.as || this.fieldName, // use supplied name if possible
this.field.createForwardsDescriptor(this.fieldName, this.model, this.toModel, this.throughModel));
};
_proto2.installForwardsDescriptor = function installForwardsDescriptor() {
Object.defineProperty(this.model.prototype, this.field.as || this.fieldName, // use supplied name if possible
this.field.createForwardsDescriptor(this.fieldName, this.model, this.toModel, this.throughModel));
};
return AliasedForwardsDescriptorInstaller;
}(_DefaultFieldInstaller["default"])
);
return AliasedForwardsDescriptorInstaller;
}(_DefaultFieldInstaller["default"]);
}

@@ -104,0 +99,0 @@ }]);

@@ -77,5 +77,3 @@ "use strict";

var Model =
/*#__PURE__*/
function () {
var Model = /*#__PURE__*/function () {
/**

@@ -617,3 +615,3 @@ * Creates a Model instance from it's properties.

var mergedFields = _objectSpread({}, this._fields, {}, mergeObj);
var mergedFields = _objectSpread(_objectSpread({}, this._fields), mergeObj);

@@ -754,3 +752,4 @@ var updatedModel = new ThisModel(mergedFields); // only update fields if they have changed (referentially)

// Delete any many-to-many rows the entity is included in.
this[key].clear();
var descriptorKey = field.as || key;
this[descriptorKey].clear();
} else if (field instanceof _ForeignKey["default"]) {

@@ -757,0 +756,0 @@ var relatedQs = this[key];

@@ -66,5 +66,3 @@ "use strict";

var ORM =
/*#__PURE__*/
function () {
var ORM = /*#__PURE__*/function () {
/**

@@ -81,3 +79,3 @@ * Creates a new ORM instance.

function ORM(opts) {
var _ORM_DEFAULTS = _objectSpread({}, ORM_DEFAULTS, {}, opts || {}),
var _ORM_DEFAULTS = _objectSpread(_objectSpread({}, ORM_DEFAULTS), opts || {}),
createDatabase = _ORM_DEFAULTS.createDatabase;

@@ -170,5 +168,3 @@

var Through =
/*#__PURE__*/
function (_Model) {
var Through = /*#__PURE__*/function (_Model) {
(0, _inheritsLoose2["default"])(ThroughModel, _Model);

@@ -185,5 +181,3 @@

var PlainForeignKey =
/*#__PURE__*/
function (_ForeignKey) {
var PlainForeignKey = /*#__PURE__*/function (_ForeignKey) {
(0, _inheritsLoose2["default"])(PlainForeignKey, _ForeignKey);

@@ -190,0 +184,0 @@

@@ -45,5 +45,3 @@ "use strict";

*/
var QuerySet =
/*#__PURE__*/
function () {
var QuerySet = /*#__PURE__*/function () {
/**

@@ -72,3 +70,3 @@ * Creates a QuerySet. The constructor is mainly for internal use;

_proto._new = function _new(clauses, userOpts) {
var opts = _objectSpread({}, this._opts, {}, userOpts);
var opts = _objectSpread(_objectSpread({}, this._opts), userOpts);

@@ -75,0 +73,0 @@ return new this.constructor(this.modelClass, clauses, opts);

@@ -34,5 +34,3 @@ "use strict";

var FieldSelectorSpec =
/*#__PURE__*/
function (_ModelBasedSelectorSp) {
var FieldSelectorSpec = /*#__PURE__*/function (_ModelBasedSelectorSp) {
(0, _inheritsLoose2["default"])(FieldSelectorSpec, _ModelBasedSelectorSp);

@@ -39,0 +37,0 @@

@@ -20,5 +20,3 @@ "use strict";

var MapSelectorSpec =
/*#__PURE__*/
function (_ModelBasedSelectorSp) {
var MapSelectorSpec = /*#__PURE__*/function (_ModelBasedSelectorSp) {
(0, _inheritsLoose2["default"])(MapSelectorSpec, _ModelBasedSelectorSp);

@@ -25,0 +23,0 @@

@@ -18,5 +18,3 @@ "use strict";

var ModelBasedSelectorSpec =
/*#__PURE__*/
function (_SelectorSpec) {
var ModelBasedSelectorSpec = /*#__PURE__*/function (_SelectorSpec) {
(0, _inheritsLoose2["default"])(ModelBasedSelectorSpec, _SelectorSpec);

@@ -23,0 +21,0 @@

@@ -20,5 +20,3 @@ "use strict";

var ModelSelectorSpec =
/*#__PURE__*/
function (_SelectorSpec) {
var ModelSelectorSpec = /*#__PURE__*/function (_SelectorSpec) {
(0, _inheritsLoose2["default"])(ModelSelectorSpec, _SelectorSpec);

@@ -25,0 +23,0 @@

@@ -16,5 +16,3 @@ "use strict";

var SelectorSpec =
/*#__PURE__*/
function () {
var SelectorSpec = /*#__PURE__*/function () {
function SelectorSpec(_ref) {

@@ -21,0 +19,0 @@ var parent = _ref.parent,

@@ -22,5 +22,3 @@ "use strict";

var Session =
/*#__PURE__*/
function () {
var Session = /*#__PURE__*/function () {
/**

@@ -27,0 +25,0 @@ * Creates a new Session.

{
"name": "redux-orm",
"version": "0.16.1",
"version": "0.16.2",
"description": "Simple ORM to manage and query your state trees",

@@ -43,24 +43,24 @@ "main": "lib/index.js",

"devDependencies": {
"@babel/cli": "^7.8.0",
"@babel/core": "^7.8.0",
"@babel/plugin-proposal-class-properties": "^7.8.0",
"@babel/plugin-proposal-decorators": "^7.8.0",
"@babel/plugin-proposal-export-namespace-from": "^7.8.0",
"@babel/plugin-proposal-function-sent": "^7.8.0",
"@babel/plugin-proposal-json-strings": "^7.8.0",
"@babel/plugin-proposal-numeric-separator": "^7.8.0",
"@babel/plugin-proposal-throw-expressions": "^7.8.0",
"@babel/plugin-syntax-dynamic-import": "^7.8.0",
"@babel/plugin-syntax-import-meta": "^7.8.0",
"@babel/plugin-transform-classes": "^7.8.0",
"@babel/plugin-transform-destructuring": "^7.8.0",
"@babel/plugin-transform-modules-commonjs": "^7.8.0",
"@babel/plugin-transform-runtime": "^7.8.0",
"@babel/preset-env": "^7.8.0",
"@babel/register": "^7.8.0",
"@babel/cli": "^7.10.5",
"@babel/core": "^7.11.1",
"@babel/plugin-proposal-class-properties": "^7.10.4",
"@babel/plugin-proposal-decorators": "^7.10.5",
"@babel/plugin-proposal-export-namespace-from": "^7.10.4",
"@babel/plugin-proposal-function-sent": "^7.10.4",
"@babel/plugin-proposal-json-strings": "^7.10.4",
"@babel/plugin-proposal-numeric-separator": "^7.10.4",
"@babel/plugin-proposal-throw-expressions": "^7.10.4",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-import-meta": "^7.10.4",
"@babel/plugin-transform-classes": "^7.10.4",
"@babel/plugin-transform-destructuring": "^7.10.4",
"@babel/plugin-transform-modules-commonjs": "^7.10.4",
"@babel/plugin-transform-runtime": "^7.11.0",
"@babel/preset-env": "^7.11.0",
"@babel/register": "^7.10.5",
"@types/jsdoc-to-markdown": "^4.0.0",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.0.3",
"babel-eslint": "^10.1.0",
"babel-jest": "^24.9.0",
"babel-loader": "^8.0.6",
"babel-loader": "^8.1.0",
"babel-plugin-lodash": "^3.3.4",

@@ -92,3 +92,3 @@ "codecov": "^3.6.1",

"dependencies": {
"@babel/runtime": "^7.8.0",
"@babel/runtime": "^7.11.2",
"immutable-ops": "^0.7.0",

@@ -95,0 +95,0 @@ "lodash": "^4.17.15",

@@ -470,3 +470,3 @@ import ops from "immutable-ops";

}
if (prevValue !== null) {
if (prevValue !== null && typeof prevValue !== "undefined") {
// remove id from attribute's index for its old value

@@ -473,0 +473,0 @@ indexIdsToDelete.push([attr, prevValue, id]);

@@ -765,3 +765,4 @@ import Session from "./Session";

// Delete any many-to-many rows the entity is included in.
this[key].clear();
const descriptorKey = field.as || key;
this[descriptorKey].clear();
} else if (field instanceof ForeignKey) {

@@ -768,0 +769,0 @@ const relatedQs = this[key];

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc