@rest-hooks/normalizr
Advanced tools
Comparing version 7.0.1 to 7.0.2
@@ -6,2 +6,10 @@ # Change Log | ||
### [7.0.2](https://github.com/coinbase/rest-hooks/compare/@rest-hooks/normalizr@7.0.1...@rest-hooks/normalizr@7.0.2) (2021-05-30) | ||
**Note:** Version bump only for package @rest-hooks/normalizr | ||
### [7.0.1](https://github.com/coinbase/rest-hooks/compare/@rest-hooks/normalizr@7.0.0...@rest-hooks/normalizr@7.0.1) (2021-05-24) | ||
@@ -8,0 +16,0 @@ |
@@ -739,3 +739,3 @@ define(['exports'], function (exports) { 'use strict'; | ||
/* istanbul ignore next */ | ||
if (process.env.NODE_ENV !== 'production' && (this.name === '' || this.name === 'Entity')) throw new Error('Entity classes without a name must define `static get key()`'); | ||
if (process.env.NODE_ENV !== 'production' && (this.name === '' || this.name === 'Entity' || this.name === '_temp')) throw new Error('Entity classes without a name must define `static get key()`'); | ||
return this.name; | ||
@@ -742,0 +742,0 @@ } |
@@ -1,1 +0,1 @@ | ||
define(["exports"],(function(e){"use strict";function t(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function n(e,t,n){var r=!0,i=!1;return[Object.keys(e).reduce((function(t,o){var s=""+o,a=n(t.get(s),e[s]),u=a[0],c=a[1],f=a[2];return c||(r=!1),f&&(i=!0),t.has(s)?t.set(s,u):t}),t),r,i]}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function o(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)}}function s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=function(){function e(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=e.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var s=this.inferSchema(e,t,n);if(!s){if("production"!==process.env.NODE_ENV){var a=this.getSchemaAttribute(e,t,n);console.warn("Schema attribute "+JSON.stringify(a,void 0,2)+" is not expected.\nExpected one of: "+Object.keys(this.schema).map((function(e){return'"'+e+'"'})).join(", ")+"\n\nValue: "+JSON.stringify(e,void 0,2))}return e}var u=r(e,t,n,s,i,o);return this.isSingleSchema||null==u?u:{id:u,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){if(void 0===e)return[e,!1,!1];var r=t(e)?e.get("schema"):e.schema;return this.isSingleSchema||r?n((this.isSingleSchema?void 0:t(e)?e.get("id"):e.id)||e,this.isSingleSchema?this.schema:this.schema[r]):[e,!0,!1]},s(e,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),e}(),u=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},c=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},f=function(e){var t=e[0],n=e[2];return void 0!==t&&!n},l=function(e,t,n,r,i,o,s){return e=u(e),c(t).map((function(t,a){return i(t,n,r,e,o,s)}))},h=function(e,t,n){e=u(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(f).map((function(e){return e[0]})):t,i,r]},p=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return c(e).map((function(e,a){return s.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},n.denormalize=function(e,t){var n=this,r=!1,i=!0;if(void 0===e&&this.schema){var o=t(void 0,this.schema);i=o[1],r=o[2]}return[e&&e.map?e.map((function(e){return n.denormalizeValue(e,t)})).filter(f).map((function(e){return e[0]})):e,i,r]},t}(a),d=function(e,t,n,r,i,o,s){var a=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,s);null==u?delete a[n]:a[n]=u})),a},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),s=!0,a=!1;return Object.keys(e).forEach((function(t){var n=i(o[t],e[t]),r=n[0],u=n[1],c=n[2];void 0!==o[t]&&(o[t]=r),c&&(a=!0),u||(s=!1)})),[o,s,a]},y=function(){function e(e){this.define(e)}var t=e.prototype;return t.define=function(e){this.schema=Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object.assign({},t,((r={})[n]=i,r))}),this.schema||{})},t.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},t.denormalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.apply(void 0,[this.schema].concat(t))},e}();function v(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 g(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return v(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)?v(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var b=Symbol("Defined Members"),O=Symbol("unq"),w=function(){function e(){}return e.prototype.toString=function(){return this[O]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,b,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,O,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[b].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=g(e[b]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[b]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},e.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,s=!0;return Object.keys(this.schema).forEach((function(e){var a=t(i[e],n.schema[e]),u=a[0],c=a[1],f=a[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(s=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),s,o]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},e}();w.schema={};var k=function(e){function r(){return e.apply(this,arguments)||this}return i(r,e),r.toJSON=function(){return Object.assign({},e.toJSON.call(this),{key:this.key})},r.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},r.normalize=function(e,t,n,r,i,o){var s=this;if("string"==typeof e)return e;var a=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(a),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=g(l);!(u=y()).done;){var v=u.value;f.has(v)?p.push(v):m.push(v)}for(var b,O=g(f);!(b=O()).done;){var w=b.value;p.includes(w)||d.push(w)}if(f.size){if(Array.isArray(e)&&m.length){var k="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var E=new Error(k);throw E.status=400,E}console.warn(k)}var S=Math.max(l.length/2,1)<=m.length&&f.size>Math.max(m.length,2)&&Math.pow(p.length,1.5)/2<=m.length,j=p.length<Math.min(1,f.size/2);if(S||j){var z="",N="substantially different than expected keys";j&&(z+="\n Missing: "+d,N="no matching keys found"),S&&(z+="\n Unexpected keys: "+m,N="a large number of unexpected keys found");var _="Attempted to initialize "+this.name+" with "+N+"\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n If this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\n Expected keys:\n Found: "+p+z+"\n Value: "+JSON.stringify(this.toObjectDefined(a),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var A=new Error(_);throw A.status=400,A}console.warn(_)}}}var D=a.pk(t,n);if(void 0!==D&&""!==D){var x=this.key;return x in o||(o[x]={}),D in o[x]||(o[x][D]=[]),o[x][D].some((function(t){return t===e}))?D:(o[x][D].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(a,e)){var t=s.schema[e];a[e]=r(a[e],a,e,t,i,o)}else if("production"!==process.env.NODE_ENV){var n=new Error("Schema key is missing in Entity\n\n Be sure all schema members are also part of the entity\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about nesting schemas: https://resthooks.io/docs/guides/nested-response\n\n Entity keys: "+Object.keys(a)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,a,D),D)}if("production"!==process.env.NODE_ENV){var V=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Entity: "+this.name+"\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw V.status=400,V}},r.denormalize=function(e,r){var i,o=this,s=t(e)?e:this.fromJS(e instanceof w?this.toObjectDefined(e):e);if(null===(i=r.setLocal)||void 0===i||i.call(r,s),t(e)){var a=n(this.schema,e,r),u=a[0],c=a[1],f=a[2];return[this.fromJS(u.toObject()),c,f]}var l=new this,h=!1;return Object.keys(this.schema).forEach((function(t){var n=o.schema[t],i=Object.hasOwnProperty.call(e,t)?e[t]:void 0,a=r(i,n),u=a[0];!a[2]||Object.hasOwnProperty.call(e,t)&&!l[t]||(h=!0),Object.hasOwnProperty.call(e,t)&&e[t]!==u&&(s[t]=u)})),[s,!0,h]},s(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(w);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(k.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return w.fromJS.call(this,e)});var S=Symbol("ENTITY WAS DELETED");function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function N(e,t,n){return(N=z()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&r(o,n.prototype),o}).apply(null,arguments)}function _(e){var t="function"==typeof Map?new Map:void 0;return(_=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return N(e,arguments,j(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var A=function(){this.children=new WeakMap},D=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return i(t,e),t}(_(Error)),x=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new D;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new A,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),V=function(e,t,n,r){var i=J(e);function o(e,n){if(!n)return[e,!0,!1];if(!n.denormalize||"function"!=typeof n.denormalize){if("function"==typeof n)return e instanceof n?[e,!0,!1]:[new n(e),!0,!1];if("object"==typeof n)return(Array.isArray(n)?h:m)(n,e,a)}return null===e?[e,!0,!1]:E(n)?void 0===e?[e,!1,!1]:function(e,t,n,r,i,o){var s=r(e,t);if(s===S)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===i[t.key]&&(i[t.key]={});var a=!0,u=!1;if(!i[t.key][e]){var c=[s],f=P(n,c);f.setLocal=function(n){return i[t.key][e]=n},o[t.key]||(o[t.key]={}),o[t.key][e]||(o[t.key][e]=new x);var l=o[t.key][e],h=t.denormalize(s,f);i[t.key][e]=h[0],a=h[1],u=h[2],l.has(c)?i[t.key][e]=l.get(c):l.set(c,i[t.key][e])}return[i[t.key][e],a,u]}(e,n,a,i,r,t):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}var s=[],a=P(o,s);return function(e,t){s.push(e);var r=o(e,t);return Object(e)!==e?r:n.has(s)?[n.get(s),r[1],r[2]]:(n.set(s,r[0]),r)}},J=function(e){var n=t(e);return function(t,r){var i=r.key;return"object"==typeof t?t:n?e.getIn([i,t]):e[i]&&e[i][t]}};function P(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&E(r))if(Object(i[0])===i[0])t.push(i[0]);else if("production"!==process.env.NODE_ENV)throw new Error("Unexpected primitive found during denormalization\nFound: "+i[0]+"\nExpected entity: "+r);return i};return r.og=e,r}var M=function e(t,n,r,i,o,s){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):(Array.isArray(i)?l:d)(i,t,n,r,e,o,s):t};var T=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},n.denormalize=function(e,t){return this.denormalizeValue(e,t)},t}(a),I=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return Object.keys(e).reduce((function(t,n,a){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=s.normalizeValue(c,e,n,r,i,o),u)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,s){var a,u=e[s],c=n.denormalizeValue(u,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((a={})[s]=f,a))}),{}),r,i]},t}(a),L=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var s=this._entity.fromJS(e,t,n).pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===s||""===s)){var a,u=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Delete(Entity): Delete("+(null!=(a=this._entity.name)?a:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw u.status=400,u}return i(this._entity,S,s),s},t.denormalize=function(e,t){return t(e,this._entity)},t._denormalizeNullable=function(){return[]},t._normalizeNullable=function(){return[]},t.merge=function(e,t){return t},e}(),U=Object.freeze({__proto__:null,Union:T,Values:I,Array:p,Object:y,Delete:L}),F=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(k);e.DELETED=S,e.Entity=k,e.FlatEntity=F,e.SimpleRecord=w,e.WeakListMap=x,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new x),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=V(n,r,i,o);return[].concat(s(e,t),[o])},e.isEntity=E,e.normalize=function(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===t)return{entities:n,indexes:r,result:e};var i=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==i){if("production"!==process.env.NODE_ENV){throw"string"==typeof e&&function(e){try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}}(e)?new Error('Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/docs/guides/custom-networking for more information\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"'):new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"')}throw new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".')}var o={},s={},a=function(e,t,n,r){return function(r,i,o){var s=r.key;s in e||(e[s]={});var a=e[s][o];if(e[s][o]=a?r.merge(a,i):i,Array.isArray(r.indexes)){var u=e[s][o];s in t||(t[s]={});for(var c,f=g(r.indexes);!(c=f()).done;){var l=c.value;l in t[s]||(t[s][l]={});var h=t[s][l];a&&delete h[a[l]],n[s]&&n[s][o]&&n[s][o][l]!==u[l]&&(h[n[s][o][l]]=S),l in u?h[u[l]]=o:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+l+"\nEntity: "+JSON.stringify(u,void 0,2))}}}}(o,s,n);return{entities:o,indexes:s,result:M(e,e,void 0,t,a,{})}},e.schema=U,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
define(["exports"],(function(e){"use strict";function t(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function n(e,t,n){var r=!0,i=!1;return[Object.keys(e).reduce((function(t,o){var s=""+o,a=n(t.get(s),e[s]),u=a[0],c=a[1],f=a[2];return c||(r=!1),f&&(i=!0),t.has(s)?t.set(s,u):t}),t),r,i]}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function o(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)}}function s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=function(){function e(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=e.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var s=this.inferSchema(e,t,n);if(!s){if("production"!==process.env.NODE_ENV){var a=this.getSchemaAttribute(e,t,n);console.warn("Schema attribute "+JSON.stringify(a,void 0,2)+" is not expected.\nExpected one of: "+Object.keys(this.schema).map((function(e){return'"'+e+'"'})).join(", ")+"\n\nValue: "+JSON.stringify(e,void 0,2))}return e}var u=r(e,t,n,s,i,o);return this.isSingleSchema||null==u?u:{id:u,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){if(void 0===e)return[e,!1,!1];var r=t(e)?e.get("schema"):e.schema;return this.isSingleSchema||r?n((this.isSingleSchema?void 0:t(e)?e.get("id"):e.id)||e,this.isSingleSchema?this.schema:this.schema[r]):[e,!0,!1]},s(e,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),e}(),u=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},c=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},f=function(e){var t=e[0],n=e[2];return void 0!==t&&!n},l=function(e,t,n,r,i,o,s){return e=u(e),c(t).map((function(t,a){return i(t,n,r,e,o,s)}))},h=function(e,t,n){e=u(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(f).map((function(e){return e[0]})):t,i,r]},p=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return c(e).map((function(e,a){return s.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},n.denormalize=function(e,t){var n=this,r=!1,i=!0;if(void 0===e&&this.schema){var o=t(void 0,this.schema);i=o[1],r=o[2]}return[e&&e.map?e.map((function(e){return n.denormalizeValue(e,t)})).filter(f).map((function(e){return e[0]})):e,i,r]},t}(a),d=function(e,t,n,r,i,o,s){var a=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,s);null==u?delete a[n]:a[n]=u})),a},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),s=!0,a=!1;return Object.keys(e).forEach((function(t){var n=i(o[t],e[t]),r=n[0],u=n[1],c=n[2];void 0!==o[t]&&(o[t]=r),c&&(a=!0),u||(s=!1)})),[o,s,a]},y=function(){function e(e){this.define(e)}var t=e.prototype;return t.define=function(e){this.schema=Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object.assign({},t,((r={})[n]=i,r))}),this.schema||{})},t.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},t.denormalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.apply(void 0,[this.schema].concat(t))},e}();function v(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 g(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return v(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)?v(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var b=Symbol("Defined Members"),O=Symbol("unq"),w=function(){function e(){}return e.prototype.toString=function(){return this[O]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,b,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,O,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[b].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=g(e[b]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[b]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},e.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,s=!0;return Object.keys(this.schema).forEach((function(e){var a=t(i[e],n.schema[e]),u=a[0],c=a[1],f=a[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(s=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),s,o]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},e}();w.schema={};var k=function(e){function r(){return e.apply(this,arguments)||this}return i(r,e),r.toJSON=function(){return Object.assign({},e.toJSON.call(this),{key:this.key})},r.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},r.normalize=function(e,t,n,r,i,o){var s=this;if("string"==typeof e)return e;var a=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(a),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=g(l);!(u=y()).done;){var v=u.value;f.has(v)?p.push(v):m.push(v)}for(var b,O=g(f);!(b=O()).done;){var w=b.value;p.includes(w)||d.push(w)}if(f.size){if(Array.isArray(e)&&m.length){var k="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var E=new Error(k);throw E.status=400,E}console.warn(k)}var S=Math.max(l.length/2,1)<=m.length&&f.size>Math.max(m.length,2)&&Math.pow(p.length,1.5)/2<=m.length,j=p.length<Math.min(1,f.size/2);if(S||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),S&&(z+="\n Unexpected keys: "+m,_="a large number of unexpected keys found");var N="Attempted to initialize "+this.name+" with "+_+"\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n If this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\n Expected keys:\n Found: "+p+z+"\n Value: "+JSON.stringify(this.toObjectDefined(a),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var A=new Error(N);throw A.status=400,A}console.warn(N)}}}var D=a.pk(t,n);if(void 0!==D&&""!==D){var x=this.key;return x in o||(o[x]={}),D in o[x]||(o[x][D]=[]),o[x][D].some((function(t){return t===e}))?D:(o[x][D].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(a,e)){var t=s.schema[e];a[e]=r(a[e],a,e,t,i,o)}else if("production"!==process.env.NODE_ENV){var n=new Error("Schema key is missing in Entity\n\n Be sure all schema members are also part of the entity\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about nesting schemas: https://resthooks.io/docs/guides/nested-response\n\n Entity keys: "+Object.keys(a)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,a,D),D)}if("production"!==process.env.NODE_ENV){var V=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Entity: "+this.name+"\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw V.status=400,V}},r.denormalize=function(e,r){var i,o=this,s=t(e)?e:this.fromJS(e instanceof w?this.toObjectDefined(e):e);if(null===(i=r.setLocal)||void 0===i||i.call(r,s),t(e)){var a=n(this.schema,e,r),u=a[0],c=a[1],f=a[2];return[this.fromJS(u.toObject()),c,f]}var l=new this,h=!1;return Object.keys(this.schema).forEach((function(t){var n=o.schema[t],i=Object.hasOwnProperty.call(e,t)?e[t]:void 0,a=r(i,n),u=a[0];!a[2]||Object.hasOwnProperty.call(e,t)&&!l[t]||(h=!0),Object.hasOwnProperty.call(e,t)&&e[t]!==u&&(s[t]=u)})),[s,!0,h]},s(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name||"_temp"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(w);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(k.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return w.fromJS.call(this,e)});var S=Symbol("ENTITY WAS DELETED");function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _(e,t,n){return(_=z()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&r(o,n.prototype),o}).apply(null,arguments)}function N(e){var t="function"==typeof Map?new Map:void 0;return(N=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return _(e,arguments,j(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var A=function(){this.children=new WeakMap},D=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return i(t,e),t}(N(Error)),x=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new D;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new A,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),V=function(e,t,n,r){var i=J(e);function o(e,n){if(!n)return[e,!0,!1];if(!n.denormalize||"function"!=typeof n.denormalize){if("function"==typeof n)return e instanceof n?[e,!0,!1]:[new n(e),!0,!1];if("object"==typeof n)return(Array.isArray(n)?h:m)(n,e,a)}return null===e?[e,!0,!1]:E(n)?void 0===e?[e,!1,!1]:function(e,t,n,r,i,o){var s=r(e,t);if(s===S)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===i[t.key]&&(i[t.key]={});var a=!0,u=!1;if(!i[t.key][e]){var c=[s],f=P(n,c);f.setLocal=function(n){return i[t.key][e]=n},o[t.key]||(o[t.key]={}),o[t.key][e]||(o[t.key][e]=new x);var l=o[t.key][e],h=t.denormalize(s,f);i[t.key][e]=h[0],a=h[1],u=h[2],l.has(c)?i[t.key][e]=l.get(c):l.set(c,i[t.key][e])}return[i[t.key][e],a,u]}(e,n,a,i,r,t):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}var s=[],a=P(o,s);return function(e,t){s.push(e);var r=o(e,t);return Object(e)!==e?r:n.has(s)?[n.get(s),r[1],r[2]]:(n.set(s,r[0]),r)}},J=function(e){var n=t(e);return function(t,r){var i=r.key;return"object"==typeof t?t:n?e.getIn([i,t]):e[i]&&e[i][t]}};function P(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&E(r))if(Object(i[0])===i[0])t.push(i[0]);else if("production"!==process.env.NODE_ENV)throw new Error("Unexpected primitive found during denormalization\nFound: "+i[0]+"\nExpected entity: "+r);return i};return r.og=e,r}var M=function e(t,n,r,i,o,s){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):(Array.isArray(i)?l:d)(i,t,n,r,e,o,s):t};var T=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},n.denormalize=function(e,t){return this.denormalizeValue(e,t)},t}(a),I=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return Object.keys(e).reduce((function(t,n,a){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=s.normalizeValue(c,e,n,r,i,o),u)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,s){var a,u=e[s],c=n.denormalizeValue(u,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((a={})[s]=f,a))}),{}),r,i]},t}(a),L=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var s=this._entity.fromJS(e,t,n).pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===s||""===s)){var a,u=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Delete(Entity): Delete("+(null!=(a=this._entity.name)?a:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw u.status=400,u}return i(this._entity,S,s),s},t.denormalize=function(e,t){return t(e,this._entity)},t._denormalizeNullable=function(){return[]},t._normalizeNullable=function(){return[]},t.merge=function(e,t){return t},e}(),U=Object.freeze({__proto__:null,Union:T,Values:I,Array:p,Object:y,Delete:L}),F=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(k);e.DELETED=S,e.Entity=k,e.FlatEntity=F,e.SimpleRecord=w,e.WeakListMap=x,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new x),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=V(n,r,i,o);return[].concat(s(e,t),[o])},e.isEntity=E,e.normalize=function(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===t)return{entities:n,indexes:r,result:e};var i=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==i){if("production"!==process.env.NODE_ENV){throw"string"==typeof e&&function(e){try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}}(e)?new Error('Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/docs/guides/custom-networking for more information\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"'):new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"')}throw new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".')}var o={},s={},a=function(e,t,n,r){return function(r,i,o){var s=r.key;s in e||(e[s]={});var a=e[s][o];if(e[s][o]=a?r.merge(a,i):i,Array.isArray(r.indexes)){var u=e[s][o];s in t||(t[s]={});for(var c,f=g(r.indexes);!(c=f()).done;){var l=c.value;l in t[s]||(t[s][l]={});var h=t[s][l];a&&delete h[a[l]],n[s]&&n[s][o]&&n[s][o][l]!==u[l]&&(h[n[s][o][l]]=S),l in u?h[u[l]]=o:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+l+"\nEntity: "+JSON.stringify(u,void 0,2))}}}}(o,s,n);return{entities:o,indexes:s,result:M(e,e,void 0,t,a,{})}},e.schema=U,Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -740,3 +740,3 @@ var rest_hooks_normalizr = (function (exports) { | ||
/* istanbul ignore next */ | ||
if (process.env.NODE_ENV !== 'production' && (this.name === '' || this.name === 'Entity')) throw new Error('Entity classes without a name must define `static get key()`'); | ||
if (process.env.NODE_ENV !== 'production' && (this.name === '' || this.name === 'Entity' || this.name === '_temp')) throw new Error('Entity classes without a name must define `static get key()`'); | ||
return this.name; | ||
@@ -743,0 +743,0 @@ } |
@@ -1,1 +0,1 @@ | ||
var rest_hooks_normalizr=function(e){"use strict";function t(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function n(e,t,n){var r=!0,i=!1;return[Object.keys(e).reduce((function(t,o){var s=""+o,a=n(t.get(s),e[s]),u=a[0],c=a[1],f=a[2];return c||(r=!1),f&&(i=!0),t.has(s)?t.set(s,u):t}),t),r,i]}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function o(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)}}function s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=function(){function e(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=e.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var s=this.inferSchema(e,t,n);if(!s){if("production"!==process.env.NODE_ENV){var a=this.getSchemaAttribute(e,t,n);console.warn("Schema attribute "+JSON.stringify(a,void 0,2)+" is not expected.\nExpected one of: "+Object.keys(this.schema).map((function(e){return'"'+e+'"'})).join(", ")+"\n\nValue: "+JSON.stringify(e,void 0,2))}return e}var u=r(e,t,n,s,i,o);return this.isSingleSchema||null==u?u:{id:u,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){if(void 0===e)return[e,!1,!1];var r=t(e)?e.get("schema"):e.schema;return this.isSingleSchema||r?n((this.isSingleSchema?void 0:t(e)?e.get("id"):e.id)||e,this.isSingleSchema?this.schema:this.schema[r]):[e,!0,!1]},s(e,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),e}(),u=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},c=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},f=function(e){var t=e[0],n=e[2];return void 0!==t&&!n},l=function(e,t,n,r,i,o,s){return e=u(e),c(t).map((function(t,a){return i(t,n,r,e,o,s)}))},h=function(e,t,n){e=u(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(f).map((function(e){return e[0]})):t,i,r]},p=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return c(e).map((function(e,a){return s.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},n.denormalize=function(e,t){var n=this,r=!1,i=!0;if(void 0===e&&this.schema){var o=t(void 0,this.schema);i=o[1],r=o[2]}return[e&&e.map?e.map((function(e){return n.denormalizeValue(e,t)})).filter(f).map((function(e){return e[0]})):e,i,r]},t}(a),d=function(e,t,n,r,i,o,s){var a=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,s);null==u?delete a[n]:a[n]=u})),a},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),s=!0,a=!1;return Object.keys(e).forEach((function(t){var n=i(o[t],e[t]),r=n[0],u=n[1],c=n[2];void 0!==o[t]&&(o[t]=r),c&&(a=!0),u||(s=!1)})),[o,s,a]},y=function(){function e(e){this.define(e)}var t=e.prototype;return t.define=function(e){this.schema=Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object.assign({},t,((r={})[n]=i,r))}),this.schema||{})},t.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},t.denormalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.apply(void 0,[this.schema].concat(t))},e}();function v(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 g(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return v(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)?v(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var b=Symbol("Defined Members"),O=Symbol("unq"),k=function(){function e(){}return e.prototype.toString=function(){return this[O]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,b,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,O,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[b].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=g(e[b]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[b]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},e.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,s=!0;return Object.keys(this.schema).forEach((function(e){var a=t(i[e],n.schema[e]),u=a[0],c=a[1],f=a[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(s=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),s,o]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},e}();k.schema={};var w=function(e){function r(){return e.apply(this,arguments)||this}return i(r,e),r.toJSON=function(){return Object.assign({},e.toJSON.call(this),{key:this.key})},r.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},r.normalize=function(e,t,n,r,i,o){var s=this;if("string"==typeof e)return e;var a=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(a),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=g(l);!(u=y()).done;){var v=u.value;f.has(v)?p.push(v):m.push(v)}for(var b,O=g(f);!(b=O()).done;){var k=b.value;p.includes(k)||d.push(k)}if(f.size){if(Array.isArray(e)&&m.length){var w="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var E=new Error(w);throw E.status=400,E}console.warn(w)}var S=Math.max(l.length/2,1)<=m.length&&f.size>Math.max(m.length,2)&&Math.pow(p.length,1.5)/2<=m.length,j=p.length<Math.min(1,f.size/2);if(S||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),S&&(z+="\n Unexpected keys: "+m,_="a large number of unexpected keys found");var N="Attempted to initialize "+this.name+" with "+_+"\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n If this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\n Expected keys:\n Found: "+p+z+"\n Value: "+JSON.stringify(this.toObjectDefined(a),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var A=new Error(N);throw A.status=400,A}console.warn(N)}}}var D=a.pk(t,n);if(void 0!==D&&""!==D){var V=this.key;return V in o||(o[V]={}),D in o[V]||(o[V][D]=[]),o[V][D].some((function(t){return t===e}))?D:(o[V][D].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(a,e)){var t=s.schema[e];a[e]=r(a[e],a,e,t,i,o)}else if("production"!==process.env.NODE_ENV){var n=new Error("Schema key is missing in Entity\n\n Be sure all schema members are also part of the entity\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about nesting schemas: https://resthooks.io/docs/guides/nested-response\n\n Entity keys: "+Object.keys(a)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,a,D),D)}if("production"!==process.env.NODE_ENV){var x=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Entity: "+this.name+"\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw x.status=400,x}},r.denormalize=function(e,r){var i,o=this,s=t(e)?e:this.fromJS(e instanceof k?this.toObjectDefined(e):e);if(null===(i=r.setLocal)||void 0===i||i.call(r,s),t(e)){var a=n(this.schema,e,r),u=a[0],c=a[1],f=a[2];return[this.fromJS(u.toObject()),c,f]}var l=new this,h=!1;return Object.keys(this.schema).forEach((function(t){var n=o.schema[t],i=Object.hasOwnProperty.call(e,t)?e[t]:void 0,a=r(i,n),u=a[0];!a[2]||Object.hasOwnProperty.call(e,t)&&!l[t]||(h=!0),Object.hasOwnProperty.call(e,t)&&e[t]!==u&&(s[t]=u)})),[s,!0,h]},s(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(k);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(w.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return k.fromJS.call(this,e)});var S=Symbol("ENTITY WAS DELETED");function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _(e,t,n){return(_=z()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&r(o,n.prototype),o}).apply(null,arguments)}function N(e){var t="function"==typeof Map?new Map:void 0;return(N=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return _(e,arguments,j(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var A=function(){this.children=new WeakMap},D=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return i(t,e),t}(N(Error)),V=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new D;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new A,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),x=function(e,t,n,r){var i=J(e);function o(e,n){if(!n)return[e,!0,!1];if(!n.denormalize||"function"!=typeof n.denormalize){if("function"==typeof n)return e instanceof n?[e,!0,!1]:[new n(e),!0,!1];if("object"==typeof n)return(Array.isArray(n)?h:m)(n,e,a)}return null===e?[e,!0,!1]:E(n)?void 0===e?[e,!1,!1]:function(e,t,n,r,i,o){var s=r(e,t);if(s===S)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===i[t.key]&&(i[t.key]={});var a=!0,u=!1;if(!i[t.key][e]){var c=[s],f=P(n,c);f.setLocal=function(n){return i[t.key][e]=n},o[t.key]||(o[t.key]={}),o[t.key][e]||(o[t.key][e]=new V);var l=o[t.key][e],h=t.denormalize(s,f);i[t.key][e]=h[0],a=h[1],u=h[2],l.has(c)?i[t.key][e]=l.get(c):l.set(c,i[t.key][e])}return[i[t.key][e],a,u]}(e,n,a,i,r,t):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}var s=[],a=P(o,s);return function(e,t){s.push(e);var r=o(e,t);return Object(e)!==e?r:n.has(s)?[n.get(s),r[1],r[2]]:(n.set(s,r[0]),r)}},J=function(e){var n=t(e);return function(t,r){var i=r.key;return"object"==typeof t?t:n?e.getIn([i,t]):e[i]&&e[i][t]}};function P(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&E(r))if(Object(i[0])===i[0])t.push(i[0]);else if("production"!==process.env.NODE_ENV)throw new Error("Unexpected primitive found during denormalization\nFound: "+i[0]+"\nExpected entity: "+r);return i};return r.og=e,r}var M=function e(t,n,r,i,o,s){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):(Array.isArray(i)?l:d)(i,t,n,r,e,o,s):t};var T=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},n.denormalize=function(e,t){return this.denormalizeValue(e,t)},t}(a),I=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return Object.keys(e).reduce((function(t,n,a){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=s.normalizeValue(c,e,n,r,i,o),u)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,s){var a,u=e[s],c=n.denormalizeValue(u,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((a={})[s]=f,a))}),{}),r,i]},t}(a),L=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var s=this._entity.fromJS(e,t,n).pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===s||""===s)){var a,u=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Delete(Entity): Delete("+(null!=(a=this._entity.name)?a:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw u.status=400,u}return i(this._entity,S,s),s},t.denormalize=function(e,t){return t(e,this._entity)},t._denormalizeNullable=function(){return[]},t._normalizeNullable=function(){return[]},t.merge=function(e,t){return t},e}(),U=Object.freeze({__proto__:null,Union:T,Values:I,Array:p,Object:y,Delete:L}),F=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(w);return e.DELETED=S,e.Entity=w,e.FlatEntity=F,e.SimpleRecord=k,e.WeakListMap=V,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new V),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=x(n,r,i,o);return[].concat(s(e,t),[o])},e.isEntity=E,e.normalize=function(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===t)return{entities:n,indexes:r,result:e};var i=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==i){if("production"!==process.env.NODE_ENV){throw"string"==typeof e&&function(e){try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}}(e)?new Error('Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/docs/guides/custom-networking for more information\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"'):new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"')}throw new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".')}var o={},s={},a=function(e,t,n,r){return function(r,i,o){var s=r.key;s in e||(e[s]={});var a=e[s][o];if(e[s][o]=a?r.merge(a,i):i,Array.isArray(r.indexes)){var u=e[s][o];s in t||(t[s]={});for(var c,f=g(r.indexes);!(c=f()).done;){var l=c.value;l in t[s]||(t[s][l]={});var h=t[s][l];a&&delete h[a[l]],n[s]&&n[s][o]&&n[s][o][l]!==u[l]&&(h[n[s][o][l]]=S),l in u?h[u[l]]=o:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+l+"\nEntity: "+JSON.stringify(u,void 0,2))}}}}(o,s,n);return{entities:o,indexes:s,result:M(e,e,void 0,t,a,{})}},e.schema=U,Object.defineProperty(e,"__esModule",{value:!0}),e}({}); | ||
var rest_hooks_normalizr=function(e){"use strict";function t(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function n(e,t,n){var r=!0,i=!1;return[Object.keys(e).reduce((function(t,o){var s=""+o,a=n(t.get(s),e[s]),u=a[0],c=a[1],f=a[2];return c||(r=!1),f&&(i=!0),t.has(s)?t.set(s,u):t}),t),r,i]}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function o(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)}}function s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=function(){function e(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=e.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var s=this.inferSchema(e,t,n);if(!s){if("production"!==process.env.NODE_ENV){var a=this.getSchemaAttribute(e,t,n);console.warn("Schema attribute "+JSON.stringify(a,void 0,2)+" is not expected.\nExpected one of: "+Object.keys(this.schema).map((function(e){return'"'+e+'"'})).join(", ")+"\n\nValue: "+JSON.stringify(e,void 0,2))}return e}var u=r(e,t,n,s,i,o);return this.isSingleSchema||null==u?u:{id:u,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){if(void 0===e)return[e,!1,!1];var r=t(e)?e.get("schema"):e.schema;return this.isSingleSchema||r?n((this.isSingleSchema?void 0:t(e)?e.get("id"):e.id)||e,this.isSingleSchema?this.schema:this.schema[r]):[e,!0,!1]},s(e,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),e}(),u=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},c=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},f=function(e){var t=e[0],n=e[2];return void 0!==t&&!n},l=function(e,t,n,r,i,o,s){return e=u(e),c(t).map((function(t,a){return i(t,n,r,e,o,s)}))},h=function(e,t,n){e=u(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(f).map((function(e){return e[0]})):t,i,r]},p=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return c(e).map((function(e,a){return s.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},n.denormalize=function(e,t){var n=this,r=!1,i=!0;if(void 0===e&&this.schema){var o=t(void 0,this.schema);i=o[1],r=o[2]}return[e&&e.map?e.map((function(e){return n.denormalizeValue(e,t)})).filter(f).map((function(e){return e[0]})):e,i,r]},t}(a),d=function(e,t,n,r,i,o,s){var a=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,s);null==u?delete a[n]:a[n]=u})),a},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),s=!0,a=!1;return Object.keys(e).forEach((function(t){var n=i(o[t],e[t]),r=n[0],u=n[1],c=n[2];void 0!==o[t]&&(o[t]=r),c&&(a=!0),u||(s=!1)})),[o,s,a]},y=function(){function e(e){this.define(e)}var t=e.prototype;return t.define=function(e){this.schema=Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object.assign({},t,((r={})[n]=i,r))}),this.schema||{})},t.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},t.denormalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.apply(void 0,[this.schema].concat(t))},e}();function v(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 g(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return v(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)?v(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var b=Symbol("Defined Members"),O=Symbol("unq"),k=function(){function e(){}return e.prototype.toString=function(){return this[O]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,b,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,O,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[b].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=g(e[b]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[b]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},e.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,s=!0;return Object.keys(this.schema).forEach((function(e){var a=t(i[e],n.schema[e]),u=a[0],c=a[1],f=a[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(s=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),s,o]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},e}();k.schema={};var w=function(e){function r(){return e.apply(this,arguments)||this}return i(r,e),r.toJSON=function(){return Object.assign({},e.toJSON.call(this),{key:this.key})},r.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},r.normalize=function(e,t,n,r,i,o){var s=this;if("string"==typeof e)return e;var a=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(a),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=g(l);!(u=y()).done;){var v=u.value;f.has(v)?p.push(v):m.push(v)}for(var b,O=g(f);!(b=O()).done;){var k=b.value;p.includes(k)||d.push(k)}if(f.size){if(Array.isArray(e)&&m.length){var w="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var E=new Error(w);throw E.status=400,E}console.warn(w)}var S=Math.max(l.length/2,1)<=m.length&&f.size>Math.max(m.length,2)&&Math.pow(p.length,1.5)/2<=m.length,j=p.length<Math.min(1,f.size/2);if(S||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),S&&(z+="\n Unexpected keys: "+m,_="a large number of unexpected keys found");var N="Attempted to initialize "+this.name+" with "+_+"\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n If this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\n Expected keys:\n Found: "+p+z+"\n Value: "+JSON.stringify(this.toObjectDefined(a),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var A=new Error(N);throw A.status=400,A}console.warn(N)}}}var D=a.pk(t,n);if(void 0!==D&&""!==D){var V=this.key;return V in o||(o[V]={}),D in o[V]||(o[V][D]=[]),o[V][D].some((function(t){return t===e}))?D:(o[V][D].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(a,e)){var t=s.schema[e];a[e]=r(a[e],a,e,t,i,o)}else if("production"!==process.env.NODE_ENV){var n=new Error("Schema key is missing in Entity\n\n Be sure all schema members are also part of the entity\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about nesting schemas: https://resthooks.io/docs/guides/nested-response\n\n Entity keys: "+Object.keys(a)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,a,D),D)}if("production"!==process.env.NODE_ENV){var x=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Entity: "+this.name+"\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw x.status=400,x}},r.denormalize=function(e,r){var i,o=this,s=t(e)?e:this.fromJS(e instanceof k?this.toObjectDefined(e):e);if(null===(i=r.setLocal)||void 0===i||i.call(r,s),t(e)){var a=n(this.schema,e,r),u=a[0],c=a[1],f=a[2];return[this.fromJS(u.toObject()),c,f]}var l=new this,h=!1;return Object.keys(this.schema).forEach((function(t){var n=o.schema[t],i=Object.hasOwnProperty.call(e,t)?e[t]:void 0,a=r(i,n),u=a[0];!a[2]||Object.hasOwnProperty.call(e,t)&&!l[t]||(h=!0),Object.hasOwnProperty.call(e,t)&&e[t]!==u&&(s[t]=u)})),[s,!0,h]},s(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name||"_temp"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(k);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(w.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return k.fromJS.call(this,e)});var S=Symbol("ENTITY WAS DELETED");function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _(e,t,n){return(_=z()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&r(o,n.prototype),o}).apply(null,arguments)}function N(e){var t="function"==typeof Map?new Map:void 0;return(N=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return _(e,arguments,j(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var A=function(){this.children=new WeakMap},D=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return i(t,e),t}(N(Error)),V=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new D;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new A,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),x=function(e,t,n,r){var i=J(e);function o(e,n){if(!n)return[e,!0,!1];if(!n.denormalize||"function"!=typeof n.denormalize){if("function"==typeof n)return e instanceof n?[e,!0,!1]:[new n(e),!0,!1];if("object"==typeof n)return(Array.isArray(n)?h:m)(n,e,a)}return null===e?[e,!0,!1]:E(n)?void 0===e?[e,!1,!1]:function(e,t,n,r,i,o){var s=r(e,t);if(s===S)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===i[t.key]&&(i[t.key]={});var a=!0,u=!1;if(!i[t.key][e]){var c=[s],f=P(n,c);f.setLocal=function(n){return i[t.key][e]=n},o[t.key]||(o[t.key]={}),o[t.key][e]||(o[t.key][e]=new V);var l=o[t.key][e],h=t.denormalize(s,f);i[t.key][e]=h[0],a=h[1],u=h[2],l.has(c)?i[t.key][e]=l.get(c):l.set(c,i[t.key][e])}return[i[t.key][e],a,u]}(e,n,a,i,r,t):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}var s=[],a=P(o,s);return function(e,t){s.push(e);var r=o(e,t);return Object(e)!==e?r:n.has(s)?[n.get(s),r[1],r[2]]:(n.set(s,r[0]),r)}},J=function(e){var n=t(e);return function(t,r){var i=r.key;return"object"==typeof t?t:n?e.getIn([i,t]):e[i]&&e[i][t]}};function P(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&E(r))if(Object(i[0])===i[0])t.push(i[0]);else if("production"!==process.env.NODE_ENV)throw new Error("Unexpected primitive found during denormalization\nFound: "+i[0]+"\nExpected entity: "+r);return i};return r.og=e,r}var M=function e(t,n,r,i,o,s){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):(Array.isArray(i)?l:d)(i,t,n,r,e,o,s):t};var T=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},n.denormalize=function(e,t){return this.denormalizeValue(e,t)},t}(a),I=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return Object.keys(e).reduce((function(t,n,a){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=s.normalizeValue(c,e,n,r,i,o),u)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,s){var a,u=e[s],c=n.denormalizeValue(u,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((a={})[s]=f,a))}),{}),r,i]},t}(a),L=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var s=this._entity.fromJS(e,t,n).pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===s||""===s)){var a,u=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Delete(Entity): Delete("+(null!=(a=this._entity.name)?a:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw u.status=400,u}return i(this._entity,S,s),s},t.denormalize=function(e,t){return t(e,this._entity)},t._denormalizeNullable=function(){return[]},t._normalizeNullable=function(){return[]},t.merge=function(e,t){return t},e}(),U=Object.freeze({__proto__:null,Union:T,Values:I,Array:p,Object:y,Delete:L}),F=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(w);return e.DELETED=S,e.Entity=w,e.FlatEntity=F,e.SimpleRecord=k,e.WeakListMap=V,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new V),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=x(n,r,i,o);return[].concat(s(e,t),[o])},e.isEntity=E,e.normalize=function(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===t)return{entities:n,indexes:r,result:e};var i=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==i){if("production"!==process.env.NODE_ENV){throw"string"==typeof e&&function(e){try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}}(e)?new Error('Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/docs/guides/custom-networking for more information\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"'):new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"')}throw new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".')}var o={},s={},a=function(e,t,n,r){return function(r,i,o){var s=r.key;s in e||(e[s]={});var a=e[s][o];if(e[s][o]=a?r.merge(a,i):i,Array.isArray(r.indexes)){var u=e[s][o];s in t||(t[s]={});for(var c,f=g(r.indexes);!(c=f()).done;){var l=c.value;l in t[s]||(t[s][l]={});var h=t[s][l];a&&delete h[a[l]],n[s]&&n[s][o]&&n[s][o][l]!==u[l]&&(h[n[s][o][l]]=S),l in u?h[u[l]]=o:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+l+"\nEntity: "+JSON.stringify(u,void 0,2))}}}}(o,s,n);return{entities:o,indexes:s,result:M(e,e,void 0,t,a,{})}},e.schema=U,Object.defineProperty(e,"__esModule",{value:!0}),e}({}); |
@@ -741,3 +741,3 @@ 'use strict'; | ||
/* istanbul ignore next */ | ||
if (process.env.NODE_ENV !== 'production' && (this.name === '' || this.name === 'Entity')) throw new Error('Entity classes without a name must define `static get key()`'); | ||
if (process.env.NODE_ENV !== 'production' && (this.name === '' || this.name === 'Entity' || this.name === '_temp')) throw new Error('Entity classes without a name must define `static get key()`'); | ||
return this.name; | ||
@@ -744,0 +744,0 @@ } |
@@ -1,1 +0,1 @@ | ||
"use strict";function e(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function t(e,t,n){var r=!0,i=!1;return[Object.keys(e).reduce((function(t,o){var s=""+o,a=n(t.get(s),e[s]),u=a[0],c=a[1],f=a[2];return c||(r=!1),f&&(i=!0),t.has(s)?t.set(s,u):t}),t),r,i]}function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,n(e,t)}function i(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)}}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}Object.defineProperty(exports,"__esModule",{value:!0});var s=function(){function t(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=t.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var s=this.inferSchema(e,t,n);if(!s){if("production"!==process.env.NODE_ENV){var a=this.getSchemaAttribute(e,t,n);console.warn("Schema attribute "+JSON.stringify(a,void 0,2)+" is not expected.\nExpected one of: "+Object.keys(this.schema).map((function(e){return'"'+e+'"'})).join(", ")+"\n\nValue: "+JSON.stringify(e,void 0,2))}return e}var u=r(e,t,n,s,i,o);return this.isSingleSchema||null==u?u:{id:u,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(t,n){if(void 0===t)return[t,!1,!1];var r=e(t)?t.get("schema"):t.schema;return this.isSingleSchema||r?n((this.isSingleSchema?void 0:e(t)?t.get("id"):t.id)||t,this.isSingleSchema?this.schema:this.schema[r]):[t,!0,!1]},o(t,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),t}(),a=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},u=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},c=function(e){var t=e[0],n=e[2];return void 0!==t&&!n},f=function(e,t,n,r,i,o,s){return e=a(e),u(t).map((function(t,a){return i(t,n,r,e,o,s)}))},l=function(e,t,n){e=a(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(c).map((function(e){return e[0]})):t,i,r]},h=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return u(e).map((function(e,a){return s.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},n.denormalize=function(e,t){var n=this,r=!1,i=!0;if(void 0===e&&this.schema){var o=t(void 0,this.schema);i=o[1],r=o[2]}return[e&&e.map?e.map((function(e){return n.denormalizeValue(e,t)})).filter(c).map((function(e){return e[0]})):e,i,r]},t}(s),p=function(e,t,n,r,i,o,s){var a=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,s);null==u?delete a[n]:a[n]=u})),a},d=function(n,r,i){if(e(r))return t(n,r,i);var o=Object.assign({},r),s=!0,a=!1;return Object.keys(n).forEach((function(e){var t=i(o[e],n[e]),r=t[0],u=t[1],c=t[2];void 0!==o[e]&&(o[e]=r),c&&(a=!0),u||(s=!1)})),[o,s,a]},m=function(){function e(e){this.define(e)}var t=e.prototype;return t.define=function(e){this.schema=Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object.assign({},t,((r={})[n]=i,r))}),this.schema||{})},t.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return p.apply(void 0,[this.schema].concat(t))},t.denormalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},e}();function y(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 v(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return y(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)?y(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var g=Symbol("Defined Members"),b=Symbol("unq"),O=function(){function e(){}return e.prototype.toString=function(){return this[b]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,g,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,b,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[g].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=v(e[g]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[g]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return p.apply(void 0,[this.schema].concat(t))},e.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,s=!0;return Object.keys(this.schema).forEach((function(e){var a=t(i[e],n.schema[e]),u=a[0],c=a[1],f=a[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(s=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),s,o]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},e}();O.schema={};var w=function(n){function i(){return n.apply(this,arguments)||this}return r(i,n),i.toJSON=function(){return Object.assign({},n.toJSON.call(this),{key:this.key})},i.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},i.normalize=function(e,t,n,r,i,o){var s=this;if("string"==typeof e)return e;var a=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(a),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=v(l);!(u=y()).done;){var g=u.value;f.has(g)?p.push(g):m.push(g)}for(var b,O=v(f);!(b=O()).done;){var w=b.value;p.includes(w)||d.push(w)}if(f.size){if(Array.isArray(e)&&m.length){var k="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var E=new Error(k);throw E.status=400,E}console.warn(k)}var S=Math.max(l.length/2,1)<=m.length&&f.size>Math.max(m.length,2)&&Math.pow(p.length,1.5)/2<=m.length,j=p.length<Math.min(1,f.size/2);if(S||j){var z="",N="substantially different than expected keys";j&&(z+="\n Missing: "+d,N="no matching keys found"),S&&(z+="\n Unexpected keys: "+m,N="a large number of unexpected keys found");var _="Attempted to initialize "+this.name+" with "+N+"\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n If this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\n Expected keys:\n Found: "+p+z+"\n Value: "+JSON.stringify(this.toObjectDefined(a),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var x=new Error(_);throw x.status=400,x}console.warn(_)}}}var A=a.pk(t,n);if(void 0!==A&&""!==A){var D=this.key;return D in o||(o[D]={}),A in o[D]||(o[D][A]=[]),o[D][A].some((function(t){return t===e}))?A:(o[D][A].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(a,e)){var t=s.schema[e];a[e]=r(a[e],a,e,t,i,o)}else if("production"!==process.env.NODE_ENV){var n=new Error("Schema key is missing in Entity\n\n Be sure all schema members are also part of the entity\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about nesting schemas: https://resthooks.io/docs/guides/nested-response\n\n Entity keys: "+Object.keys(a)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,a,A),A)}if("production"!==process.env.NODE_ENV){var V=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Entity: "+this.name+"\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw V.status=400,V}},i.denormalize=function(n,r){var i,o=this,s=e(n)?n:this.fromJS(n instanceof O?this.toObjectDefined(n):n);if(null===(i=r.setLocal)||void 0===i||i.call(r,s),e(n)){var a=t(this.schema,n,r),u=a[0],c=a[1],f=a[2];return[this.fromJS(u.toObject()),c,f]}var l=new this,h=!1;return Object.keys(this.schema).forEach((function(e){var t=o.schema[e],i=Object.hasOwnProperty.call(n,e)?n[e]:void 0,a=r(i,t),u=a[0];!a[2]||Object.hasOwnProperty.call(n,e)&&!l[e]||(h=!0),Object.hasOwnProperty.call(n,e)&&n[e]!==u&&(s[e]=u)})),[s,!0,h]},o(i,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),i}(O);function k(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(w.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return O.fromJS.call(this,e)});var E=Symbol("ENTITY WAS DELETED");function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function j(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function z(e,t,r){return(z=j()?Reflect.construct:function(e,t,r){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return r&&n(o,r.prototype),o}).apply(null,arguments)}function N(e){var t="function"==typeof Map?new Map:void 0;return(N=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return z(e,arguments,S(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),n(i,e)})(e)}var _=function(){this.children=new WeakMap},x=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return r(t,e),t}(N(Error)),A=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new x;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new _,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),D=function(e,t,n,r){var i=V(e);function o(e,n){if(!n)return[e,!0,!1];if(!n.denormalize||"function"!=typeof n.denormalize){if("function"==typeof n)return e instanceof n?[e,!0,!1]:[new n(e),!0,!1];if("object"==typeof n)return(Array.isArray(n)?l:d)(n,e,a)}return null===e?[e,!0,!1]:k(n)?void 0===e?[e,!1,!1]:function(e,t,n,r,i,o){var s=r(e,t);if(s===E)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===i[t.key]&&(i[t.key]={});var a=!0,u=!1;if(!i[t.key][e]){var c=[s],f=J(n,c);f.setLocal=function(n){return i[t.key][e]=n},o[t.key]||(o[t.key]={}),o[t.key][e]||(o[t.key][e]=new A);var l=o[t.key][e],h=t.denormalize(s,f);i[t.key][e]=h[0],a=h[1],u=h[2],l.has(c)?i[t.key][e]=l.get(c):l.set(c,i[t.key][e])}return[i[t.key][e],a,u]}(e,n,a,i,r,t):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}var s=[],a=J(o,s);return function(e,t){s.push(e);var r=o(e,t);return Object(e)!==e?r:n.has(s)?[n.get(s),r[1],r[2]]:(n.set(s,r[0]),r)}},V=function(t){var n=e(t);return function(e,r){var i=r.key;return"object"==typeof e?e:n?t.getIn([i,e]):t[i]&&t[i][e]}};function J(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&k(r))if(Object(i[0])===i[0])t.push(i[0]);else if("production"!==process.env.NODE_ENV)throw new Error("Unexpected primitive found during denormalization\nFound: "+i[0]+"\nExpected entity: "+r);return i};return r.og=e,r}var P=function e(t,n,r,i,o,s){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):(Array.isArray(i)?f:p)(i,t,n,r,e,o,s):t};var M=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}r(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},n.denormalize=function(e,t){return this.denormalizeValue(e,t)},t}(s),T=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return Object.keys(e).reduce((function(t,n,a){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=s.normalizeValue(c,e,n,r,i,o),u)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,s){var a,u=e[s],c=n.denormalizeValue(u,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((a={})[s]=f,a))}),{}),r,i]},t}(s),I=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var s=this._entity.fromJS(e,t,n).pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===s||""===s)){var a,u=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Delete(Entity): Delete("+(null!=(a=this._entity.name)?a:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw u.status=400,u}return i(this._entity,E,s),s},t.denormalize=function(e,t){return t(e,this._entity)},t._denormalizeNullable=function(){return[]},t._normalizeNullable=function(){return[]},t.merge=function(e,t){return t},e}(),L=Object.freeze({__proto__:null,Union:M,Values:T,Array:h,Object:m,Delete:I}),U=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(w);exports.DELETED=E,exports.Entity=w,exports.FlatEntity=U,exports.SimpleRecord=O,exports.WeakListMap=A,exports.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new A),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=D(n,r,i,o);return[].concat(s(e,t),[o])},exports.isEntity=k,exports.normalize=function(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===t)return{entities:n,indexes:r,result:e};var i=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==i){if("production"!==process.env.NODE_ENV){throw"string"==typeof e&&function(e){try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}}(e)?new Error('Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/docs/guides/custom-networking for more information\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"'):new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"')}throw new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".')}var o={},s={},a=function(e,t,n,r){return function(r,i,o){var s=r.key;s in e||(e[s]={});var a=e[s][o];if(e[s][o]=a?r.merge(a,i):i,Array.isArray(r.indexes)){var u=e[s][o];s in t||(t[s]={});for(var c,f=v(r.indexes);!(c=f()).done;){var l=c.value;l in t[s]||(t[s][l]={});var h=t[s][l];a&&delete h[a[l]],n[s]&&n[s][o]&&n[s][o][l]!==u[l]&&(h[n[s][o][l]]=E),l in u?h[u[l]]=o:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+l+"\nEntity: "+JSON.stringify(u,void 0,2))}}}}(o,s,n);return{entities:o,indexes:s,result:P(e,e,void 0,t,a,{})}},exports.schema=L; | ||
"use strict";function e(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function t(e,t,n){var r=!0,i=!1;return[Object.keys(e).reduce((function(t,o){var s=""+o,a=n(t.get(s),e[s]),u=a[0],c=a[1],f=a[2];return c||(r=!1),f&&(i=!0),t.has(s)?t.set(s,u):t}),t),r,i]}function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,n(e,t)}function i(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)}}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}Object.defineProperty(exports,"__esModule",{value:!0});var s=function(){function t(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=t.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var s=this.inferSchema(e,t,n);if(!s){if("production"!==process.env.NODE_ENV){var a=this.getSchemaAttribute(e,t,n);console.warn("Schema attribute "+JSON.stringify(a,void 0,2)+" is not expected.\nExpected one of: "+Object.keys(this.schema).map((function(e){return'"'+e+'"'})).join(", ")+"\n\nValue: "+JSON.stringify(e,void 0,2))}return e}var u=r(e,t,n,s,i,o);return this.isSingleSchema||null==u?u:{id:u,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(t,n){if(void 0===t)return[t,!1,!1];var r=e(t)?t.get("schema"):t.schema;return this.isSingleSchema||r?n((this.isSingleSchema?void 0:e(t)?t.get("id"):t.id)||t,this.isSingleSchema?this.schema:this.schema[r]):[t,!0,!1]},o(t,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),t}(),a=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},u=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},c=function(e){var t=e[0],n=e[2];return void 0!==t&&!n},f=function(e,t,n,r,i,o,s){return e=a(e),u(t).map((function(t,a){return i(t,n,r,e,o,s)}))},l=function(e,t,n){e=a(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(c).map((function(e){return e[0]})):t,i,r]},h=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return u(e).map((function(e,a){return s.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},n.denormalize=function(e,t){var n=this,r=!1,i=!0;if(void 0===e&&this.schema){var o=t(void 0,this.schema);i=o[1],r=o[2]}return[e&&e.map?e.map((function(e){return n.denormalizeValue(e,t)})).filter(c).map((function(e){return e[0]})):e,i,r]},t}(s),p=function(e,t,n,r,i,o,s){var a=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,s);null==u?delete a[n]:a[n]=u})),a},d=function(n,r,i){if(e(r))return t(n,r,i);var o=Object.assign({},r),s=!0,a=!1;return Object.keys(n).forEach((function(e){var t=i(o[e],n[e]),r=t[0],u=t[1],c=t[2];void 0!==o[e]&&(o[e]=r),c&&(a=!0),u||(s=!1)})),[o,s,a]},m=function(){function e(e){this.define(e)}var t=e.prototype;return t.define=function(e){this.schema=Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object.assign({},t,((r={})[n]=i,r))}),this.schema||{})},t.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return p.apply(void 0,[this.schema].concat(t))},t.denormalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},e}();function y(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 v(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return y(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)?y(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var g=Symbol("Defined Members"),b=Symbol("unq"),O=function(){function e(){}return e.prototype.toString=function(){return this[b]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,g,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,b,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[g].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=v(e[g]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[g]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return p.apply(void 0,[this.schema].concat(t))},e.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,s=!0;return Object.keys(this.schema).forEach((function(e){var a=t(i[e],n.schema[e]),u=a[0],c=a[1],f=a[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(s=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),s,o]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},e}();O.schema={};var w=function(n){function i(){return n.apply(this,arguments)||this}return r(i,n),i.toJSON=function(){return Object.assign({},n.toJSON.call(this),{key:this.key})},i.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},i.normalize=function(e,t,n,r,i,o){var s=this;if("string"==typeof e)return e;var a=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(a),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=v(l);!(u=y()).done;){var g=u.value;f.has(g)?p.push(g):m.push(g)}for(var b,O=v(f);!(b=O()).done;){var w=b.value;p.includes(w)||d.push(w)}if(f.size){if(Array.isArray(e)&&m.length){var k="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var E=new Error(k);throw E.status=400,E}console.warn(k)}var S=Math.max(l.length/2,1)<=m.length&&f.size>Math.max(m.length,2)&&Math.pow(p.length,1.5)/2<=m.length,j=p.length<Math.min(1,f.size/2);if(S||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),S&&(z+="\n Unexpected keys: "+m,_="a large number of unexpected keys found");var N="Attempted to initialize "+this.name+" with "+_+"\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n If this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\n Expected keys:\n Found: "+p+z+"\n Value: "+JSON.stringify(this.toObjectDefined(a),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var x=new Error(N);throw x.status=400,x}console.warn(N)}}}var A=a.pk(t,n);if(void 0!==A&&""!==A){var D=this.key;return D in o||(o[D]={}),A in o[D]||(o[D][A]=[]),o[D][A].some((function(t){return t===e}))?A:(o[D][A].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(a,e)){var t=s.schema[e];a[e]=r(a[e],a,e,t,i,o)}else if("production"!==process.env.NODE_ENV){var n=new Error("Schema key is missing in Entity\n\n Be sure all schema members are also part of the entity\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about nesting schemas: https://resthooks.io/docs/guides/nested-response\n\n Entity keys: "+Object.keys(a)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,a,A),A)}if("production"!==process.env.NODE_ENV){var V=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Entity: "+this.name+"\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw V.status=400,V}},i.denormalize=function(n,r){var i,o=this,s=e(n)?n:this.fromJS(n instanceof O?this.toObjectDefined(n):n);if(null===(i=r.setLocal)||void 0===i||i.call(r,s),e(n)){var a=t(this.schema,n,r),u=a[0],c=a[1],f=a[2];return[this.fromJS(u.toObject()),c,f]}var l=new this,h=!1;return Object.keys(this.schema).forEach((function(e){var t=o.schema[e],i=Object.hasOwnProperty.call(n,e)?n[e]:void 0,a=r(i,t),u=a[0];!a[2]||Object.hasOwnProperty.call(n,e)&&!l[e]||(h=!0),Object.hasOwnProperty.call(n,e)&&n[e]!==u&&(s[e]=u)})),[s,!0,h]},o(i,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name||"_temp"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),i}(O);function k(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(w.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return O.fromJS.call(this,e)});var E=Symbol("ENTITY WAS DELETED");function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function j(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function z(e,t,r){return(z=j()?Reflect.construct:function(e,t,r){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return r&&n(o,r.prototype),o}).apply(null,arguments)}function _(e){var t="function"==typeof Map?new Map:void 0;return(_=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return z(e,arguments,S(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),n(i,e)})(e)}var N=function(){this.children=new WeakMap},x=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return r(t,e),t}(_(Error)),A=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new x;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new N,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),D=function(e,t,n,r){var i=V(e);function o(e,n){if(!n)return[e,!0,!1];if(!n.denormalize||"function"!=typeof n.denormalize){if("function"==typeof n)return e instanceof n?[e,!0,!1]:[new n(e),!0,!1];if("object"==typeof n)return(Array.isArray(n)?l:d)(n,e,a)}return null===e?[e,!0,!1]:k(n)?void 0===e?[e,!1,!1]:function(e,t,n,r,i,o){var s=r(e,t);if(s===E)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===i[t.key]&&(i[t.key]={});var a=!0,u=!1;if(!i[t.key][e]){var c=[s],f=J(n,c);f.setLocal=function(n){return i[t.key][e]=n},o[t.key]||(o[t.key]={}),o[t.key][e]||(o[t.key][e]=new A);var l=o[t.key][e],h=t.denormalize(s,f);i[t.key][e]=h[0],a=h[1],u=h[2],l.has(c)?i[t.key][e]=l.get(c):l.set(c,i[t.key][e])}return[i[t.key][e],a,u]}(e,n,a,i,r,t):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}var s=[],a=J(o,s);return function(e,t){s.push(e);var r=o(e,t);return Object(e)!==e?r:n.has(s)?[n.get(s),r[1],r[2]]:(n.set(s,r[0]),r)}},V=function(t){var n=e(t);return function(e,r){var i=r.key;return"object"==typeof e?e:n?t.getIn([i,e]):t[i]&&t[i][e]}};function J(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&k(r))if(Object(i[0])===i[0])t.push(i[0]);else if("production"!==process.env.NODE_ENV)throw new Error("Unexpected primitive found during denormalization\nFound: "+i[0]+"\nExpected entity: "+r);return i};return r.og=e,r}var P=function e(t,n,r,i,o,s){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):(Array.isArray(i)?f:p)(i,t,n,r,e,o,s):t};var M=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}r(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},n.denormalize=function(e,t){return this.denormalizeValue(e,t)},t}(s),T=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return Object.keys(e).reduce((function(t,n,a){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=s.normalizeValue(c,e,n,r,i,o),u)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,s){var a,u=e[s],c=n.denormalizeValue(u,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((a={})[s]=f,a))}),{}),r,i]},t}(s),I=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var s=this._entity.fromJS(e,t,n).pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===s||""===s)){var a,u=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Delete(Entity): Delete("+(null!=(a=this._entity.name)?a:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw u.status=400,u}return i(this._entity,E,s),s},t.denormalize=function(e,t){return t(e,this._entity)},t._denormalizeNullable=function(){return[]},t._normalizeNullable=function(){return[]},t.merge=function(e,t){return t},e}(),L=Object.freeze({__proto__:null,Union:M,Values:T,Array:h,Object:m,Delete:I}),U=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(w);exports.DELETED=E,exports.Entity=w,exports.FlatEntity=U,exports.SimpleRecord=O,exports.WeakListMap=A,exports.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new A),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=D(n,r,i,o);return[].concat(s(e,t),[o])},exports.isEntity=k,exports.normalize=function(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===t)return{entities:n,indexes:r,result:e};var i=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==i){if("production"!==process.env.NODE_ENV){throw"string"==typeof e&&function(e){try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}}(e)?new Error('Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/docs/guides/custom-networking for more information\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"'):new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"')}throw new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".')}var o={},s={},a=function(e,t,n,r){return function(r,i,o){var s=r.key;s in e||(e[s]={});var a=e[s][o];if(e[s][o]=a?r.merge(a,i):i,Array.isArray(r.indexes)){var u=e[s][o];s in t||(t[s]={});for(var c,f=v(r.indexes);!(c=f()).done;){var l=c.value;l in t[s]||(t[s][l]={});var h=t[s][l];a&&delete h[a[l]],n[s]&&n[s][o]&&n[s][o][l]!==u[l]&&(h[n[s][o][l]]=E),l in u?h[u[l]]=o:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+l+"\nEntity: "+JSON.stringify(u,void 0,2))}}}}(o,s,n);return{entities:o,indexes:s,result:P(e,e,void 0,t,a,{})}},exports.schema=L; |
@@ -743,3 +743,3 @@ (function (global, factory) { | ||
/* istanbul ignore next */ | ||
if (process.env.NODE_ENV !== 'production' && (this.name === '' || this.name === 'Entity')) throw new Error('Entity classes without a name must define `static get key()`'); | ||
if (process.env.NODE_ENV !== 'production' && (this.name === '' || this.name === 'Entity' || this.name === '_temp')) throw new Error('Entity classes without a name must define `static get key()`'); | ||
return this.name; | ||
@@ -746,0 +746,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).rest_hooks_normalizr={})}(this,(function(e){"use strict";function t(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function n(e,t,n){var r=!0,i=!1;return[Object.keys(e).reduce((function(t,o){var s=""+o,a=n(t.get(s),e[s]),u=a[0],c=a[1],f=a[2];return c||(r=!1),f&&(i=!0),t.has(s)?t.set(s,u):t}),t),r,i]}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function o(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)}}function s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=function(){function e(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=e.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var s=this.inferSchema(e,t,n);if(!s){if("production"!==process.env.NODE_ENV){var a=this.getSchemaAttribute(e,t,n);console.warn("Schema attribute "+JSON.stringify(a,void 0,2)+" is not expected.\nExpected one of: "+Object.keys(this.schema).map((function(e){return'"'+e+'"'})).join(", ")+"\n\nValue: "+JSON.stringify(e,void 0,2))}return e}var u=r(e,t,n,s,i,o);return this.isSingleSchema||null==u?u:{id:u,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){if(void 0===e)return[e,!1,!1];var r=t(e)?e.get("schema"):e.schema;return this.isSingleSchema||r?n((this.isSingleSchema?void 0:t(e)?e.get("id"):e.id)||e,this.isSingleSchema?this.schema:this.schema[r]):[e,!0,!1]},s(e,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),e}(),u=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},c=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},f=function(e){var t=e[0],n=e[2];return void 0!==t&&!n},l=function(e,t,n,r,i,o,s){return e=u(e),c(t).map((function(t,a){return i(t,n,r,e,o,s)}))},h=function(e,t,n){e=u(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(f).map((function(e){return e[0]})):t,i,r]},p=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return c(e).map((function(e,a){return s.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},n.denormalize=function(e,t){var n=this,r=!1,i=!0;if(void 0===e&&this.schema){var o=t(void 0,this.schema);i=o[1],r=o[2]}return[e&&e.map?e.map((function(e){return n.denormalizeValue(e,t)})).filter(f).map((function(e){return e[0]})):e,i,r]},t}(a),d=function(e,t,n,r,i,o,s){var a=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,s);null==u?delete a[n]:a[n]=u})),a},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),s=!0,a=!1;return Object.keys(e).forEach((function(t){var n=i(o[t],e[t]),r=n[0],u=n[1],c=n[2];void 0!==o[t]&&(o[t]=r),c&&(a=!0),u||(s=!1)})),[o,s,a]},y=function(){function e(e){this.define(e)}var t=e.prototype;return t.define=function(e){this.schema=Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object.assign({},t,((r={})[n]=i,r))}),this.schema||{})},t.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},t.denormalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.apply(void 0,[this.schema].concat(t))},e}();function v(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 g(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return v(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)?v(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var b=Symbol("Defined Members"),O=Symbol("unq"),k=function(){function e(){}return e.prototype.toString=function(){return this[O]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,b,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,O,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[b].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=g(e[b]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[b]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},e.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,s=!0;return Object.keys(this.schema).forEach((function(e){var a=t(i[e],n.schema[e]),u=a[0],c=a[1],f=a[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(s=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),s,o]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},e}();k.schema={};var w=function(e){function r(){return e.apply(this,arguments)||this}return i(r,e),r.toJSON=function(){return Object.assign({},e.toJSON.call(this),{key:this.key})},r.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},r.normalize=function(e,t,n,r,i,o){var s=this;if("string"==typeof e)return e;var a=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(a),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=g(l);!(u=y()).done;){var v=u.value;f.has(v)?p.push(v):m.push(v)}for(var b,O=g(f);!(b=O()).done;){var k=b.value;p.includes(k)||d.push(k)}if(f.size){if(Array.isArray(e)&&m.length){var w="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var E=new Error(w);throw E.status=400,E}console.warn(w)}var S=Math.max(l.length/2,1)<=m.length&&f.size>Math.max(m.length,2)&&Math.pow(p.length,1.5)/2<=m.length,j=p.length<Math.min(1,f.size/2);if(S||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),S&&(z+="\n Unexpected keys: "+m,_="a large number of unexpected keys found");var N="Attempted to initialize "+this.name+" with "+_+"\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n If this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\n Expected keys:\n Found: "+p+z+"\n Value: "+JSON.stringify(this.toObjectDefined(a),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var A=new Error(N);throw A.status=400,A}console.warn(N)}}}var x=a.pk(t,n);if(void 0!==x&&""!==x){var D=this.key;return D in o||(o[D]={}),x in o[D]||(o[D][x]=[]),o[D][x].some((function(t){return t===e}))?x:(o[D][x].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(a,e)){var t=s.schema[e];a[e]=r(a[e],a,e,t,i,o)}else if("production"!==process.env.NODE_ENV){var n=new Error("Schema key is missing in Entity\n\n Be sure all schema members are also part of the entity\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about nesting schemas: https://resthooks.io/docs/guides/nested-response\n\n Entity keys: "+Object.keys(a)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,a,x),x)}if("production"!==process.env.NODE_ENV){var V=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Entity: "+this.name+"\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw V.status=400,V}},r.denormalize=function(e,r){var i,o=this,s=t(e)?e:this.fromJS(e instanceof k?this.toObjectDefined(e):e);if(null===(i=r.setLocal)||void 0===i||i.call(r,s),t(e)){var a=n(this.schema,e,r),u=a[0],c=a[1],f=a[2];return[this.fromJS(u.toObject()),c,f]}var l=new this,h=!1;return Object.keys(this.schema).forEach((function(t){var n=o.schema[t],i=Object.hasOwnProperty.call(e,t)?e[t]:void 0,a=r(i,n),u=a[0];!a[2]||Object.hasOwnProperty.call(e,t)&&!l[t]||(h=!0),Object.hasOwnProperty.call(e,t)&&e[t]!==u&&(s[t]=u)})),[s,!0,h]},s(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(k);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(w.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return k.fromJS.call(this,e)});var S=Symbol("ENTITY WAS DELETED");function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _(e,t,n){return(_=z()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&r(o,n.prototype),o}).apply(null,arguments)}function N(e){var t="function"==typeof Map?new Map:void 0;return(N=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return _(e,arguments,j(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var A=function(){this.children=new WeakMap},x=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return i(t,e),t}(N(Error)),D=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new x;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new A,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),V=function(e,t,n,r){var i=J(e);function o(e,n){if(!n)return[e,!0,!1];if(!n.denormalize||"function"!=typeof n.denormalize){if("function"==typeof n)return e instanceof n?[e,!0,!1]:[new n(e),!0,!1];if("object"==typeof n)return(Array.isArray(n)?h:m)(n,e,a)}return null===e?[e,!0,!1]:E(n)?void 0===e?[e,!1,!1]:function(e,t,n,r,i,o){var s=r(e,t);if(s===S)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===i[t.key]&&(i[t.key]={});var a=!0,u=!1;if(!i[t.key][e]){var c=[s],f=P(n,c);f.setLocal=function(n){return i[t.key][e]=n},o[t.key]||(o[t.key]={}),o[t.key][e]||(o[t.key][e]=new D);var l=o[t.key][e],h=t.denormalize(s,f);i[t.key][e]=h[0],a=h[1],u=h[2],l.has(c)?i[t.key][e]=l.get(c):l.set(c,i[t.key][e])}return[i[t.key][e],a,u]}(e,n,a,i,r,t):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}var s=[],a=P(o,s);return function(e,t){s.push(e);var r=o(e,t);return Object(e)!==e?r:n.has(s)?[n.get(s),r[1],r[2]]:(n.set(s,r[0]),r)}},J=function(e){var n=t(e);return function(t,r){var i=r.key;return"object"==typeof t?t:n?e.getIn([i,t]):e[i]&&e[i][t]}};function P(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&E(r))if(Object(i[0])===i[0])t.push(i[0]);else if("production"!==process.env.NODE_ENV)throw new Error("Unexpected primitive found during denormalization\nFound: "+i[0]+"\nExpected entity: "+r);return i};return r.og=e,r}var M=function e(t,n,r,i,o,s){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):(Array.isArray(i)?l:d)(i,t,n,r,e,o,s):t};var T=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},n.denormalize=function(e,t){return this.denormalizeValue(e,t)},t}(a),I=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return Object.keys(e).reduce((function(t,n,a){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=s.normalizeValue(c,e,n,r,i,o),u)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,s){var a,u=e[s],c=n.denormalizeValue(u,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((a={})[s]=f,a))}),{}),r,i]},t}(a),L=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var s=this._entity.fromJS(e,t,n).pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===s||""===s)){var a,u=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Delete(Entity): Delete("+(null!=(a=this._entity.name)?a:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw u.status=400,u}return i(this._entity,S,s),s},t.denormalize=function(e,t){return t(e,this._entity)},t._denormalizeNullable=function(){return[]},t._normalizeNullable=function(){return[]},t.merge=function(e,t){return t},e}(),U=Object.freeze({__proto__:null,Union:T,Values:I,Array:p,Object:y,Delete:L}),F=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(w);e.DELETED=S,e.Entity=w,e.FlatEntity=F,e.SimpleRecord=k,e.WeakListMap=D,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new D),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=V(n,r,i,o);return[].concat(s(e,t),[o])},e.isEntity=E,e.normalize=function(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===t)return{entities:n,indexes:r,result:e};var i=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==i){if("production"!==process.env.NODE_ENV){throw"string"==typeof e&&function(e){try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}}(e)?new Error('Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/docs/guides/custom-networking for more information\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"'):new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"')}throw new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".')}var o={},s={},a=function(e,t,n,r){return function(r,i,o){var s=r.key;s in e||(e[s]={});var a=e[s][o];if(e[s][o]=a?r.merge(a,i):i,Array.isArray(r.indexes)){var u=e[s][o];s in t||(t[s]={});for(var c,f=g(r.indexes);!(c=f()).done;){var l=c.value;l in t[s]||(t[s][l]={});var h=t[s][l];a&&delete h[a[l]],n[s]&&n[s][o]&&n[s][o][l]!==u[l]&&(h[n[s][o][l]]=S),l in u?h[u[l]]=o:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+l+"\nEntity: "+JSON.stringify(u,void 0,2))}}}}(o,s,n);return{entities:o,indexes:s,result:M(e,e,void 0,t,a,{})}},e.schema=U,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).rest_hooks_normalizr={})}(this,(function(e){"use strict";function t(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function n(e,t,n){var r=!0,i=!1;return[Object.keys(e).reduce((function(t,o){var s=""+o,a=n(t.get(s),e[s]),u=a[0],c=a[1],f=a[2];return c||(r=!1),f&&(i=!0),t.has(s)?t.set(s,u):t}),t),r,i]}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function o(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)}}function s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=function(){function e(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=e.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var s=this.inferSchema(e,t,n);if(!s){if("production"!==process.env.NODE_ENV){var a=this.getSchemaAttribute(e,t,n);console.warn("Schema attribute "+JSON.stringify(a,void 0,2)+" is not expected.\nExpected one of: "+Object.keys(this.schema).map((function(e){return'"'+e+'"'})).join(", ")+"\n\nValue: "+JSON.stringify(e,void 0,2))}return e}var u=r(e,t,n,s,i,o);return this.isSingleSchema||null==u?u:{id:u,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){if(void 0===e)return[e,!1,!1];var r=t(e)?e.get("schema"):e.schema;return this.isSingleSchema||r?n((this.isSingleSchema?void 0:t(e)?e.get("id"):e.id)||e,this.isSingleSchema?this.schema:this.schema[r]):[e,!0,!1]},s(e,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),e}(),u=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},c=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},f=function(e){var t=e[0],n=e[2];return void 0!==t&&!n},l=function(e,t,n,r,i,o,s){return e=u(e),c(t).map((function(t,a){return i(t,n,r,e,o,s)}))},h=function(e,t,n){e=u(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(f).map((function(e){return e[0]})):t,i,r]},p=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return c(e).map((function(e,a){return s.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},n.denormalize=function(e,t){var n=this,r=!1,i=!0;if(void 0===e&&this.schema){var o=t(void 0,this.schema);i=o[1],r=o[2]}return[e&&e.map?e.map((function(e){return n.denormalizeValue(e,t)})).filter(f).map((function(e){return e[0]})):e,i,r]},t}(a),d=function(e,t,n,r,i,o,s){var a=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,s);null==u?delete a[n]:a[n]=u})),a},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),s=!0,a=!1;return Object.keys(e).forEach((function(t){var n=i(o[t],e[t]),r=n[0],u=n[1],c=n[2];void 0!==o[t]&&(o[t]=r),c&&(a=!0),u||(s=!1)})),[o,s,a]},y=function(){function e(e){this.define(e)}var t=e.prototype;return t.define=function(e){this.schema=Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object.assign({},t,((r={})[n]=i,r))}),this.schema||{})},t.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},t.denormalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.apply(void 0,[this.schema].concat(t))},e}();function v(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 g(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return v(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)?v(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var b=Symbol("Defined Members"),O=Symbol("unq"),k=function(){function e(){}return e.prototype.toString=function(){return this[O]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,b,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,O,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[b].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=g(e[b]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[b]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},e.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,s=!0;return Object.keys(this.schema).forEach((function(e){var a=t(i[e],n.schema[e]),u=a[0],c=a[1],f=a[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(s=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),s,o]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},e}();k.schema={};var w=function(e){function r(){return e.apply(this,arguments)||this}return i(r,e),r.toJSON=function(){return Object.assign({},e.toJSON.call(this),{key:this.key})},r.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},r.normalize=function(e,t,n,r,i,o){var s=this;if("string"==typeof e)return e;var a=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(a),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=g(l);!(u=y()).done;){var v=u.value;f.has(v)?p.push(v):m.push(v)}for(var b,O=g(f);!(b=O()).done;){var k=b.value;p.includes(k)||d.push(k)}if(f.size){if(Array.isArray(e)&&m.length){var w="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var E=new Error(w);throw E.status=400,E}console.warn(w)}var S=Math.max(l.length/2,1)<=m.length&&f.size>Math.max(m.length,2)&&Math.pow(p.length,1.5)/2<=m.length,j=p.length<Math.min(1,f.size/2);if(S||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),S&&(z+="\n Unexpected keys: "+m,_="a large number of unexpected keys found");var N="Attempted to initialize "+this.name+" with "+_+"\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n If this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\n Expected keys:\n Found: "+p+z+"\n Value: "+JSON.stringify(this.toObjectDefined(a),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var A=new Error(N);throw A.status=400,A}console.warn(N)}}}var x=a.pk(t,n);if(void 0!==x&&""!==x){var D=this.key;return D in o||(o[D]={}),x in o[D]||(o[D][x]=[]),o[D][x].some((function(t){return t===e}))?x:(o[D][x].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(a,e)){var t=s.schema[e];a[e]=r(a[e],a,e,t,i,o)}else if("production"!==process.env.NODE_ENV){var n=new Error("Schema key is missing in Entity\n\n Be sure all schema members are also part of the entity\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about nesting schemas: https://resthooks.io/docs/guides/nested-response\n\n Entity keys: "+Object.keys(a)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,a,x),x)}if("production"!==process.env.NODE_ENV){var V=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Entity: "+this.name+"\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw V.status=400,V}},r.denormalize=function(e,r){var i,o=this,s=t(e)?e:this.fromJS(e instanceof k?this.toObjectDefined(e):e);if(null===(i=r.setLocal)||void 0===i||i.call(r,s),t(e)){var a=n(this.schema,e,r),u=a[0],c=a[1],f=a[2];return[this.fromJS(u.toObject()),c,f]}var l=new this,h=!1;return Object.keys(this.schema).forEach((function(t){var n=o.schema[t],i=Object.hasOwnProperty.call(e,t)?e[t]:void 0,a=r(i,n),u=a[0];!a[2]||Object.hasOwnProperty.call(e,t)&&!l[t]||(h=!0),Object.hasOwnProperty.call(e,t)&&e[t]!==u&&(s[t]=u)})),[s,!0,h]},s(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name||"_temp"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(k);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(w.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return k.fromJS.call(this,e)});var S=Symbol("ENTITY WAS DELETED");function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _(e,t,n){return(_=z()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&r(o,n.prototype),o}).apply(null,arguments)}function N(e){var t="function"==typeof Map?new Map:void 0;return(N=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return _(e,arguments,j(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var A=function(){this.children=new WeakMap},x=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return i(t,e),t}(N(Error)),D=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new x;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new A,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),V=function(e,t,n,r){var i=J(e);function o(e,n){if(!n)return[e,!0,!1];if(!n.denormalize||"function"!=typeof n.denormalize){if("function"==typeof n)return e instanceof n?[e,!0,!1]:[new n(e),!0,!1];if("object"==typeof n)return(Array.isArray(n)?h:m)(n,e,a)}return null===e?[e,!0,!1]:E(n)?void 0===e?[e,!1,!1]:function(e,t,n,r,i,o){var s=r(e,t);if(s===S)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===i[t.key]&&(i[t.key]={});var a=!0,u=!1;if(!i[t.key][e]){var c=[s],f=P(n,c);f.setLocal=function(n){return i[t.key][e]=n},o[t.key]||(o[t.key]={}),o[t.key][e]||(o[t.key][e]=new D);var l=o[t.key][e],h=t.denormalize(s,f);i[t.key][e]=h[0],a=h[1],u=h[2],l.has(c)?i[t.key][e]=l.get(c):l.set(c,i[t.key][e])}return[i[t.key][e],a,u]}(e,n,a,i,r,t):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}var s=[],a=P(o,s);return function(e,t){s.push(e);var r=o(e,t);return Object(e)!==e?r:n.has(s)?[n.get(s),r[1],r[2]]:(n.set(s,r[0]),r)}},J=function(e){var n=t(e);return function(t,r){var i=r.key;return"object"==typeof t?t:n?e.getIn([i,t]):e[i]&&e[i][t]}};function P(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&E(r))if(Object(i[0])===i[0])t.push(i[0]);else if("production"!==process.env.NODE_ENV)throw new Error("Unexpected primitive found during denormalization\nFound: "+i[0]+"\nExpected entity: "+r);return i};return r.og=e,r}var M=function e(t,n,r,i,o,s){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):(Array.isArray(i)?l:d)(i,t,n,r,e,o,s):t};var T=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},n.denormalize=function(e,t){return this.denormalizeValue(e,t)},t}(a),I=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return Object.keys(e).reduce((function(t,n,a){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=s.normalizeValue(c,e,n,r,i,o),u)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,s){var a,u=e[s],c=n.denormalizeValue(u,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((a={})[s]=f,a))}),{}),r,i]},t}(a),L=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var s=this._entity.fromJS(e,t,n).pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===s||""===s)){var a,u=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Delete(Entity): Delete("+(null!=(a=this._entity.name)?a:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw u.status=400,u}return i(this._entity,S,s),s},t.denormalize=function(e,t){return t(e,this._entity)},t._denormalizeNullable=function(){return[]},t._normalizeNullable=function(){return[]},t.merge=function(e,t){return t},e}(),U=Object.freeze({__proto__:null,Union:T,Values:I,Array:p,Object:y,Delete:L}),F=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(w);e.DELETED=S,e.Entity=w,e.FlatEntity=F,e.SimpleRecord=k,e.WeakListMap=D,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new D),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=V(n,r,i,o);return[].concat(s(e,t),[o])},e.isEntity=E,e.normalize=function(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===t)return{entities:n,indexes:r,result:e};var i=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==i){if("production"!==process.env.NODE_ENV){throw"string"==typeof e&&function(e){try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}}(e)?new Error('Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/docs/guides/custom-networking for more information\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"'):new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"')}throw new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".')}var o={},s={},a=function(e,t,n,r){return function(r,i,o){var s=r.key;s in e||(e[s]={});var a=e[s][o];if(e[s][o]=a?r.merge(a,i):i,Array.isArray(r.indexes)){var u=e[s][o];s in t||(t[s]={});for(var c,f=g(r.indexes);!(c=f()).done;){var l=c.value;l in t[s]||(t[s][l]={});var h=t[s][l];a&&delete h[a[l]],n[s]&&n[s][o]&&n[s][o][l]!==u[l]&&(h[n[s][o][l]]=S),l in u?h[u[l]]=o:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+l+"\nEntity: "+JSON.stringify(u,void 0,2))}}}}(o,s,n);return{entities:o,indexes:s,result:M(e,e,void 0,t,a,{})}},e.schema=U,Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -23,3 +23,3 @@ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | ||
/* istanbul ignore next */ | ||
if (process.env.NODE_ENV !== 'production' && (this.name === '' || this.name === 'Entity')) throw new Error('Entity classes without a name must define `static get key()`'); | ||
if (process.env.NODE_ENV !== 'production' && (this.name === '' || this.name === 'Entity' || this.name === '_temp')) throw new Error('Entity classes without a name must define `static get key()`'); | ||
return this.name; | ||
@@ -243,2 +243,2 @@ } | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9lbnRpdGllcy9FbnRpdHkudHMiXSwibmFtZXMiOlsiU2ltcGxlUmVjb3JkIiwiaXNJbW11dGFibGUiLCJkZW5vcm1hbGl6ZUltbXV0YWJsZSIsIkVudGl0eSIsInRvSlNPTiIsImtleSIsInByb2Nlc3MiLCJlbnYiLCJOT0RFX0VOViIsIm5hbWUiLCJFcnJvciIsInBrIiwidmFsdWUiLCJwYXJlbnQiLCJwcm90b3R5cGUiLCJjYWxsIiwibm9ybWFsaXplIiwiaW5wdXQiLCJ2aXNpdCIsImFkZEVudGl0eSIsInZpc2l0ZWRFbnRpdGllcyIsInByb2Nlc3NlZEVudGl0eSIsImZyb21KUyIsImF1dG9tYXRpY1ZhbGlkYXRpb24iLCJpbnN0YW5jZVNhbXBsZSIsImtleXNPZlJlY29yZCIsIlNldCIsIk9iamVjdCIsImtleXMiLCJrZXlzT2ZQcm9wcyIsImtleXNEZWZpbmVkIiwiZm91bmQiLCJtaXNzaW5nIiwidW5leHBlY3RlZCIsImtleU9mUHJvcHMiLCJoYXMiLCJwdXNoIiwia2V5T2ZSZWNvcmQiLCJpbmNsdWRlcyIsInNpemUiLCJBcnJheSIsImlzQXJyYXkiLCJsZW5ndGgiLCJlcnJvck1lc3NhZ2UiLCJKU09OIiwic3RyaW5naWZ5Iiwic2xpY2UiLCJlcnJvciIsInN0YXR1cyIsImNvbnNvbGUiLCJ3YXJuIiwidG9vTWFueVVuZXhwZWN0ZWQiLCJNYXRoIiwibWF4IiwiZm91bmROb3RoaW5nIiwibWluIiwiZXh0cmEiLCJyZWFzb24iLCJ0b09iamVjdERlZmluZWQiLCJpZCIsInVuZGVmaW5lZCIsImVudGl0eVR5cGUiLCJzb21lIiwiZW50aXR5Iiwic2NoZ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@ -21,4 +21,2 @@ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | ||
if (process.env.NODE_ENV !== 'production' && (id === undefined || id === '')) { | ||
var _name; | ||
const error = new Error(`Missing usable primary key when normalizing response. | ||
@@ -31,3 +29,3 @@ | ||
Delete(Entity): Delete(${(_name = this._entity.name) != null ? _name : this._entity}) | ||
Delete(Entity): Delete(${this._entity.name ?? this._entity}) | ||
Value: ${input && JSON.stringify(input, null, 2)} | ||
@@ -66,2 +64,2 @@ `); | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWFzL0RlbGV0ZS50cyJdLCJuYW1lcyI6WyJERUxFVEVEIiwiRGVsZXRlIiwiY29uc3RydWN0b3IiLCJlbnRpdHkiLCJwcm9jZXNzIiwiZW52IiwiTk9ERV9FTlYiLCJFcnJvciIsIl9lbnRpdHkiLCJub3JtYWxpemUiLCJpbnB1dCIsInBhcmVudCIsImtleSIsInZpc2l0IiwiYWRkRW50aXR5IiwidmlzaXRlZEVudGl0aWVzIiwicHJvY2Vzc2VkRW50aXR5IiwiZnJvbUpTIiwiaWQiLCJwayIsInVuZGVmaW5lZCIsImVycm9yIiwibmFtZSIsIkpTT04iLCJzdHJpbmdpZnkiLCJzdGF0dXMiLCJkZW5vcm1hbGl6ZSIsInVudmlzaXQiLCJfZGVub3JtYWxpemVOdWxsYWJsZSIsIl9ub3JtYWxpemVOdWxsYWJsZSIsIm1lcmdlIiwiZXhpc3RpbmciLCJpbmNvbWluZyJdLCJtYXBwaW5ncyI6IkFBQUE7QUFFQSxTQUFTQSxPQUFULFFBQXdCLFlBQXhCO0FBR0EsZUFBZSxNQUFNQyxNQUFOLENBRWY7QUFHRUMsRUFBQUEsV0FBVyxDQUFDQyxNQUFELEVBQVk7QUFDckIsUUFBSUMsT0FBTyxDQUFDQyxHQUFSLENBQVlDLFFBQVosS0FBeUIsWUFBekIsSU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IHVudmlzaXQ6IFVudmlzaXRGdW5jdGlvbixcbiAgKTogW0Fic3RyYWN0SW5zdGFuY2VUeXBlPEU+LCBib29sZWFuLCBib29sZWFuXSB7XG4gICAgcmV0dXJuIHVudmlzaXQoaWQsIHRoaXMuX2VudGl0eSkgYXMgYW55O1xuICB9XG5cbiAgLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi9cbiAgX2Rlbm9ybWFsaXplTnVsbGFibGUoKTogW1xuICAgIEFic3RyYWN0SW5zdGFuY2VUeXBlPEU+IHwgdW5kZWZpbmVkLFxuICAgIGJvb2xlYW4sXG4gICAgZmFsc2UsXG4gIF0ge1xuICAgIHJldHVybiBbXSBhcyBhbnk7XG4gIH1cblxuICAvKiBpc3RhbmJ1bCBpZ25vcmUgbmV4dCAqL1xuICBfbm9ybWFsaXplTnVsbGFibGUoKTogc3RyaW5nIHwgdW5kZWZpbmVkIHtcbiAgICByZXR1cm4gW10gYXMgYW55O1xuICB9XG5cbiAgLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi9cbiAgbWVyZ2UoZXhpc3Rpbmc6IGFueSwgaW5jb21pbmc6IGFueSkge1xuICAgIHJldHVybiBpbmNvbWluZztcbiAgfVxufVxuIl19 |
@@ -1,2 +0,2 @@ | ||
export {}; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZXNDb250ZW50IjpbXX0= |
{ | ||
"name": "@rest-hooks/normalizr", | ||
"version": "7.0.1", | ||
"version": "7.0.2", | ||
"description": "Normalizes and denormalizes JSON according to schema for Redux and Flux applications", | ||
@@ -83,3 +83,3 @@ "homepage": "https://github.com/coinbase/rest-hooks/tree/master/packages/normalizr#readme", | ||
}, | ||
"gitHead": "8f08fbe6f2fdaae40dc63c3d13081a1d2b3c97f5" | ||
"gitHead": "ff04c3ba45467581005e7492640d389f86b9cce1" | ||
} |
505920