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

fakerest

Package Overview
Dependencies
Maintainers
2
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fakerest - npm Package Compare versions

Comparing version 3.3.0 to 3.4.0

.github/workflows/ci.yml

2

dist/FakeRest.min.js

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

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.FakeRest=e():t.FakeRest=e()}(self,(function(){return function(){var t={6499:function(t,e,r){"use strict";r.r(e),r.d(e,{Collection:function(){return y},FetchServer:function(){return q},Server:function(){return w},Single:function(){return v},default:function(){return R}});var n=r(7361),o=r.n(n),i=r(6410),u=r.n(i);function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function s(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var u,a=t[Symbol.iterator]();!(n=(u=a.next()).done)&&(r.push(u.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return f(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return f(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var p=function(t,e){if(-1!==t.indexOf("_lte")){var r=t.replace(/(_lte)$/,"");return function(t){return o()(t,r)<=e}}if(-1!==t.indexOf("_gte")){var n=t.replace(/(_gte)$/,"");return function(t){return o()(t,n)>=e}}if(-1!==t.indexOf("_lt")){var i=t.replace(/(_lt)$/,"");return function(t){return o()(t,i)<e}}if(-1!==t.indexOf("_gt")){var a=t.replace(/(_gt)$/,"");return function(t){return o()(t,a)>e}}if(-1!==t.indexOf("_neq")){var c=t.replace(/(_neq)$/,"");return function(t){return o()(t,c)!=e}}return Array.isArray(e)?function(r){return Array.isArray(o()(r,t))?(n=function(e){return n=o()(r,t),i=function(t){return t==e},n.reduce((function(t,e){return t||i(e)}),!1);var n,i},e.reduce((function(t,e){return t&&n(e)}),!0)):e.filter((function(e){return e==o()(r,t)})).length>0;var n}:"object"===l(e)?function(r){return u()(e)(o()(r,t))}:function(r){return Array.isArray(o()(r,t))&&"string"==typeof e?-1!==o()(r,t).indexOf(e):"boolean"==typeof o()(r,t)&&"string"==typeof e?o()(r,t)==("true"===e):o()(r,t)==e}};function h(t,e){if("function"==typeof e)return t.filter(e);if(e instanceof Object){var r=Object.keys(e).map((function(t){if("q"===t){var r=new RegExp(e.q,"i");return function(t){for(var e in t)if(t[e]&&t[e].match&&null!==t[e].match(r))return!0;return!1}}var n=t.split("."),i=e[t];return n.length>1?function(e){var r=function(t,e){return t.reduce((function(r,n,i){if(null!=r)return r;var u=t.slice(0,i+1).join("."),a=t.slice(i+1).join("."),c=o()(e,u);return Array.isArray(c)&&i<t.length-1?[u,a]:void 0}),void 0)}(n,e);if(r){var u=s(r,2),a=u[0],c=u[1];return h(o()(e,a),function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}({},c,i)).length>0}return p(t,i)(e)}:p(t,i)}));return t.filter((function(t){return r.reduce((function(e,r){return e&&r(t)}),!0)}))}throw new Error("Unsupported filter type")}var y=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"id";if(a(this,t),!Array.isArray(e))throw new Error("Can't initialize a Collection with anything else than an array of items");this.sequence=0,this.identifierName=r,this.items=[],this.server=null,this.name=null,e.map(this.addOne.bind(this))}var e,r,n;return e=t,(r=[{key:"setServer",value:function(t){this.server=t}},{key:"setName",value:function(t){this.name=t}},{key:"_oneToManyEmbedder",value:function(t){var e=this,r=this.name.slice(0,-1)+"_id";return function(n){var o=e.server.collections[t];if(!o)throw new Error("Can't embed a non-existing collection ".concat(t));return Array.isArray(n[t])?n[t]=o.getAll({filter:function(e){return-1!==n[t].indexOf(e[o.identifierName])}}):n[t]=o.getAll({filter:function(t){return t[r]==n[e.identifierName]}}),n}}},{key:"_manyToOneEmbedder",value:function(t){var e=this,r=t+"s",n=t+"_id";return function(o){var i=e.server.collections[r];if(!i)throw new Error("Can't embed a non-existing collection ".concat(t));try{o[t]=i.getOne(o[n])}catch(t){}return o}}},{key:"_itemEmbedder",value:function(t){var e=this,r=(Array.isArray(t)?t:[t]).map((function(t){return t.endsWith("s")?e._oneToManyEmbedder(t):e._manyToOneEmbedder(t)}));return function(t){return r.reduce((function(t,e){return e(t)}),t)}}},{key:"getCount",value:function(t){return this.getAll(t).length}},{key:"getAll",value:function(t){var e=this.items.slice(0);return t&&(t.filter&&(e=h(e,t.filter)),t.sort&&(e=function(t,e){if("function"==typeof e)return t.sort(e);if("string"==typeof e)return t.sort((function(t,r){return t[e]>r[e]?1:t[e]<r[e]?-1:0}));if(Array.isArray(e)){var r=e[0],n="asc"==e[1].toLowerCase()?1:-1;return t.sort((function(t,e){return t[r]>e[r]?n:t[r]<e[r]?-1*n:0}))}throw new Error("Unsupported sort type")}(e,t.sort)),t.range&&(e=function(t,e){if(Array.isArray(e))return t.slice(e[0],void 0!==e[1]?e[1]+1:void 0);throw new Error("Unsupported range type")}(e,t.range)),e=e.map((function(t){return Object.assign({},t)})),t.embed&&this.server&&(e=e.map(this._itemEmbedder(t.embed)))),e}},{key:"getIndex",value:function(t){var e=this;return this.items.findIndex((function(r){return r[e.identifierName]==t}))}},{key:"getOne",value:function(t,e){var r=this.getIndex(t);if(-1===r)throw new Error("No item with identifier ".concat(t));var n=this.items[r];return n=Object.assign({},n),e&&e.embed&&this.server&&(n=this._itemEmbedder(e.embed)(n)),n}},{key:"addOne",value:function(t){var e=t[this.identifierName];if(void 0!==e){if(-1!==this.getIndex(e))throw new Error("An item with the identifier ".concat(e," already exists"));this.sequence=Math.max(this.sequence,e)+1}else t[this.identifierName]=this.sequence++;return this.items.push(t),Object.assign({},t)}},{key:"updateOne",value:function(t,e){var r=this.getIndex(t);if(-1===r)throw new Error("No item with identifier ".concat(t));for(var n in e)this.items[r][n]=e[n];return Object.assign({},this.items[r])}},{key:"removeOne",value:function(t){var e=this.getIndex(t);if(-1===e)throw new Error("No item with identifier ".concat(t));var r=this.items[e];return this.items.splice(e,1),t==this.sequence-1&&this.sequence--,r}}])&&c(e.prototype,r),n&&c(e,n),t}();function d(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var v=function(){function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!(e instanceof Object))throw new Error("Can't initialize a Single with anything except an object");this.obj=e,this.server=null,this.name=null}var e,r,n;return e=t,(r=[{key:"setServer",value:function(t){this.server=t}},{key:"setName",value:function(t){this.name=t}},{key:"_oneToManyEmbedder",value:function(t){var e=this;return function(r){var n=e.server.collections[t];if(!n)throw new Error("Can't embed a non-existing collection ".concat(t));return r[t]=n.getAll({filter:function(e){return-1!==r[t].indexOf(e[n.identifierName])}}),r}}},{key:"_manyToOneEmbedder",value:function(t){var e=this,r=t+"s",n=t+"_id";return function(o){var i=e.server.collections[r];if(!i)throw new Error("Can't embed a non-existing collection ".concat(t));try{o[t]=i.getOne(o[n])}catch(t){}return o}}},{key:"_itemEmbedder",value:function(t){var e=this,r=(Array.isArray(t)?t:[t]).map((function(t){return t.endsWith("s")?e._oneToManyEmbedder(t):e._manyToOneEmbedder(t)}));return function(t){return r.reduce((function(t,e){return e(t)}),t)}}},{key:"getOnly",value:function(t){var e=this.obj;return t&&t.embed&&this.server&&(e=Object.assign({},e),e=this._itemEmbedder(t.embed)(e)),e}},{key:"updateOnly",value:function(t){for(var e in t)this.obj[e]=t[e];return this.obj}}])&&d(e.prototype,r),n&&d(e,n),t}();function b(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var u,a=t[Symbol.iterator]();!(n=(u=a.next()).done)&&(r.push(u.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return g(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return g(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function m(t){if(!t)return{};var e={};return t.split("&").map((function(t){if(-1===t.indexOf("="))e[t]=!0;else{var r=b(t.split("="),2),n=r[0],o=r[1];0!==o.indexOf("[")&&0!==o.indexOf("{")||(o=JSON.parse(o)),e[n.trim()]=o}})),e}function j(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return x(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return x(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}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 i,u=!0,a=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}function x(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function O(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var w=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";O(this,t),this.baseUrl=e,this.loggingEnabled=!1,this.defaultQuery=function(){},this.batchUrl=null,this.collections={},this.singles={},this.requestInterceptors=[],this.responseInterceptors=[]}var e,r,n;return e=t,(r=[{key:"init",value:function(t){for(var e in t)Array.isArray(t[e])?this.addCollection(e,new y(t[e],"id")):this.addSingle(e,new v(t[e]))}},{key:"toggleLogging",value:function(){this.loggingEnabled=!this.loggingEnabled}},{key:"setDefaultQuery",value:function(t){this.defaultQuery=t}},{key:"setBatchUrl",value:function(t){this.batchUrl=t}},{key:"setBatch",value:function(t){console.warn("Server.setBatch() is deprecated, use Server.setBatchUrl() instead"),this.batchUrl=t}},{key:"addCollection",value:function(t,e){this.collections[t]=e,e.setServer(this),e.setName(t)}},{key:"getCollection",value:function(t){return this.collections[t]}},{key:"getCollectionNames",value:function(){return Object.keys(this.collections)}},{key:"addSingle",value:function(t,e){this.singles[t]=e,e.setServer(this),e.setName(t)}},{key:"getSingle",value:function(t){return this.singles[t]}},{key:"getSingleNames",value:function(){return Object.keys(this.singles)}},{key:"addRequestInterceptor",value:function(t){this.requestInterceptors.push(t)}},{key:"addResponseInterceptor",value:function(t){this.responseInterceptors.push(t)}},{key:"getCount",value:function(t,e){return this.collections[t].getCount(e)}},{key:"getAll",value:function(t,e){return this.collections[t].getAll(e)}},{key:"getOne",value:function(t,e,r){return this.collections[t].getOne(e,r)}},{key:"addOne",value:function(t,e){return this.collections.hasOwnProperty(t)||this.addCollection(t,new y([],"id")),this.collections[t].addOne(e)}},{key:"updateOne",value:function(t,e,r){return this.collections[t].updateOne(e,r)}},{key:"removeOne",value:function(t,e){return this.collections[t].removeOne(e)}},{key:"getOnly",value:function(t,e){return this.singles[t].getOnly()}},{key:"updateOnly",value:function(t,e){return this.singles[t].updateOnly(e)}},{key:"decode",value:function(t){if(t.queryString=decodeURIComponent(t.url.slice(t.url.indexOf("?")+1)),t.params=m(t.queryString),t.requestBody)try{t.json=JSON.parse(t.requestBody)}catch(t){}return this.requestInterceptors.reduce((function(t,e){return e(t)}),t)}},{key:"respond",value:function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:200;e||(e={}),e["Content-Type"]||(e["Content-Type"]="application/json");var o={status:n,headers:e,body:t};return o=this.responseInterceptors.reduce((function(t,e){return e(t,r)}),o),this.log(r,o),r.respond(o.status,o.headers,JSON.stringify(o.body))}},{key:"log",value:function(t,e){this.loggingEnabled&&(console.group?(console.groupCollapsed(t.method,t.url,"(FakeRest)"),console.group("request"),console.log(t.method,t.url),console.log("headers",t.requestHeaders),console.log("body ",t.requestBody),console.groupEnd(),console.group("response",e.status),console.log("headers",e.headers),console.log("body ",e.body),console.groupEnd(),console.groupEnd()):(console.log("FakeRest request ",t.method,t.url,"headers",t.requestHeaders,"body",t.requestBody),console.log("FakeRest response",e.status,"headers",e.headers,"body",e.body)))}},{key:"batch",value:function(t){var e=t.json,r=this.handle.bind(this),n=Object.keys(e).reduce((function(t,n){var o,i={url:e[n],method:"GET",params:{},respond:function(t,e,r){o={code:t,headers:Object.keys(e||{}).map((function(t){return{name:t,value:e[t]}})),body:r||{}}}};return r(i),t[n]=o||{code:404,headers:[],body:{}},t}),{});return this.respond(n,{},t,200)}},{key:"handle",value:function(t){if(t=this.decode(t),this.batchUrl&&this.batchUrl===t.url&&"POST"===t.method)return this.batch(t);var e,r=j(this.getSingleNames());try{for(r.s();!(e=r.n()).done;){var n=e.value;if(t.url.match(new RegExp("^"+this.baseUrl+"\\/("+n+")(\\/?.*)?$"))){if("GET"==t.method)try{var o=this.getOnly(n);return this.respond(o,null,t)}catch(e){return t.respond(404)}if("PUT"==t.method)try{var i=this.updateOnly(n,t.json);return this.respond(i,null,t)}catch(e){return t.respond(404)}if("PATCH"==t.method)try{var u=this.updateOnly(n,t.json);return this.respond(u,null,t)}catch(e){return t.respond(404)}}}}catch(t){r.e(t)}finally{r.f()}var a=t.url.match(new RegExp("^"+this.baseUrl+"\\/([^\\/?]+)(\\/(\\d+))?(\\?.*)?$"));if(a){var c=a[1],s=Object.assign({},this.defaultQuery(c),t.params);if(a[2]){if(!this.getCollection(c))return;var f=a[3];if("GET"==t.method)try{var l=this.getOne(c,f,s);return this.respond(l,null,t)}catch(e){return t.respond(404)}if("PUT"==t.method)try{var p=this.updateOne(c,f,t.json);return this.respond(p,null,t)}catch(e){return t.respond(404)}if("PATCH"==t.method)try{var h=this.updateOne(c,f,t.json);return this.respond(h,null,t)}catch(e){return t.respond(404)}if("DELETE"==t.method)try{var y=this.removeOne(c,f);return this.respond(y,null,t)}catch(e){return t.respond(404)}}else{if("GET"==t.method){if(!this.getCollection(c))return;var d,v,b,g=this.getCount(c,s.filter?{filter:s.filter}:{});if(g>0){d=this.getAll(c,s);var m=s.range?s.range[0]:0,x=s.range?Math.min(d.length-1+m,s.range[1]):d.length-1;v="items ".concat(m,"-").concat(x,"/").concat(g),b=d.length==g?200:206}else d=[],v="items */0",b=200;return this.respond(d,{"Content-Range":v},t,b)}if("POST"==t.method){var O=this.addOne(c,t.json),_=this.baseUrl+"/"+c+"/"+O[this.getCollection(c).identifierName];return this.respond(O,{Location:_},t,201)}}}}},{key:"getHandler",value:function(){return this.handle.bind(this)}}])&&_(e.prototype,r),n&&_(e,n),t}();function A(t){return(A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function S(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return E(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return E(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}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 i,u=!0,a=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}function E(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function k(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function T(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function C(t,e){return(C=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function P(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=U(t);if(e){var o=U(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return I(this,r)}}function I(t,e){return!e||"object"!==A(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function U(t){return(U=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var q=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&C(t,e)}(i,t);var e,r,n,o=P(i);function i(){return k(this,i),o.apply(this,arguments)}return e=i,(r=[{key:"decode",value:function(t,e){var r=this,n="string"==typeof t?new Request(t,e):t;return n.queryString=decodeURIComponent(n.url.slice(n.url.indexOf("?")+1)),n.params=m(n.queryString),n.text().then((function(t){n.requestBody=t;try{n.requestJson=JSON.parse(t)}catch(t){}})).then((function(){return r.requestInterceptors.reduce((function(t,e){return e(t)}),n)}))}},{key:"respond",value:function(t,e){return t=this.responseInterceptors.reduce((function(t,r){return r(t,e)}),t),this.log(e,t),t.headers=new Headers(t.headers),t}},{key:"log",value:function(t,e){this.loggingEnabled&&(console.group?(console.groupCollapsed(t.method,t.url,"(FakeRest)"),console.group("request"),console.log(t.method,t.url),console.log("headers",t.headers),console.log("body ",t.requestBody),console.groupEnd(),console.group("response",e.status),console.log("headers",e.headers),console.log("body ",e.body),console.groupEnd(),console.groupEnd()):(console.log("FakeRest request ",t.method,t.url,"headers",t.headers,"body",t.requestBody),console.log("FakeRest response",e.status,"headers",e.headers,"body",e.body)))}},{key:"batch",value:function(t){throw new Error("not implemented")}},{key:"handle",value:function(t,e){var r=this;return this.decode(t,e).then((function(t){var e={headers:{"Content-Type":"application/json"},status:200};if(r.batchUrl&&r.batchUrl===t.url&&"POST"===t.method)return r.batch(t);var n,o=S(r.getSingleNames());try{for(o.s();!(n=o.n()).done;){var i=n.value;if(t.url.match(new RegExp("^"+r.baseUrl+"\\/("+i+")(\\/?.*)?$"))){if("GET"==t.method){try{e.body=r.getOnly(i)}catch(t){reponse.status=404}return r.respond(e,t)}if("PUT"==t.method){try{e.body=r.updateOnly(i,t.requestJson)}catch(t){reponse.status=404}return r.respond(e,t)}if("PATCH"==t.method){try{e.body=r.updateOnly(i,t.requestJson)}catch(t){reponse.status=404}return r.respond(e,t)}}}}catch(t){o.e(t)}finally{o.f()}var u,a=S(r.getCollectionNames());try{for(a.s();!(u=a.n()).done;){var c=u.value,s=t.url.match(new RegExp("^"+r.baseUrl+"\\/("+c+")(\\/(\\d+))?(\\?.*)?$"));if(s){var f=Object.assign({},r.defaultQuery(c),t.params);if(s[2]){var l=s[3];if("GET"==t.method){try{e.body=r.getOne(c,l,f)}catch(t){e.status=404}return r.respond(e,t)}if("PUT"==t.method){try{e.body=r.updateOne(c,l,t.requestJson)}catch(t){e.status=404}return r.respond(e,t)}if("PATCH"==t.method){try{e.body=r.updateOne(c,l,t.requestJson)}catch(t){e.status=404}return r.respond(e,t)}if("DELETE"==t.method){try{e.body=r.removeOne(c,l)}catch(t){e.status=404}return r.respond(e,t)}}else{if("GET"==t.method){var p=r.getCount(c,f.filter?{filter:f.filter}:{});if(p>0){var h=r.getAll(c,f),y=f.range?f.range[0]:0,d=f.range?Math.min(h.length-1+y,f.range[1]):h.length-1;e.body=h,e.headers["Content-Range"]="items ".concat(y,"-").concat(d,"/").concat(p),e.status=h.length==p?200:206}else e.body=[],e.headers["Content-Range"]="items */0";return r.respond(e,t)}if("POST"==t.method){var v=r.addOne(c,t.requestJson),b=r.baseUrl+"/"+c+"/"+v[r.getCollection(c).identifierName];return e.body=v,e.headers.Location=b,e.status=201,r.respond(e,t)}}}}}catch(t){a.e(t)}finally{a.f()}return r.respond(e,t)}))}}])&&T(e.prototype,r),n&&T(e,n),i}(w),R={Server:w,FetchServer:q,Collection:y,Single:v}},8552:function(t,e,r){var n=r(852)(r(5639),"DataView");t.exports=n},1989:function(t,e,r){var n=r(1789),o=r(401),i=r(7667),u=r(1327),a=r(1866);function c(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}c.prototype.clear=n,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=u,c.prototype.set=a,t.exports=c},8407:function(t,e,r){var n=r(7040),o=r(4125),i=r(2117),u=r(7518),a=r(4705);function c(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}c.prototype.clear=n,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=u,c.prototype.set=a,t.exports=c},7071:function(t,e,r){var n=r(852)(r(5639),"Map");t.exports=n},3369:function(t,e,r){var n=r(4785),o=r(1285),i=r(6e3),u=r(9916),a=r(5265);function c(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}c.prototype.clear=n,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=u,c.prototype.set=a,t.exports=c},3818:function(t,e,r){var n=r(852)(r(5639),"Promise");t.exports=n},8525:function(t,e,r){var n=r(852)(r(5639),"Set");t.exports=n},8668:function(t,e,r){var n=r(3369),o=r(619),i=r(2385);function u(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new n;++e<r;)this.add(t[e])}u.prototype.add=u.prototype.push=o,u.prototype.has=i,t.exports=u},6384:function(t,e,r){var n=r(8407),o=r(7465),i=r(3779),u=r(7599),a=r(4758),c=r(4309);function s(t){var e=this.__data__=new n(t);this.size=e.size}s.prototype.clear=o,s.prototype.delete=i,s.prototype.get=u,s.prototype.has=a,s.prototype.set=c,t.exports=s},2705:function(t,e,r){var n=r(5639).Symbol;t.exports=n},1149:function(t,e,r){var n=r(5639).Uint8Array;t.exports=n},577:function(t,e,r){var n=r(852)(r(5639),"WeakMap");t.exports=n},7412:function(t){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}},4963:function(t){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var u=t[r];e(u,r,t)&&(i[o++]=u)}return i}},4636:function(t,e,r){var n=r(2545),o=r(5694),i=r(1469),u=r(4144),a=r(5776),c=r(6719),s=Object.prototype.hasOwnProperty;t.exports=function(t,e){var r=i(t),f=!r&&o(t),l=!r&&!f&&u(t),p=!r&&!f&&!l&&c(t),h=r||f||l||p,y=h?n(t.length,String):[],d=y.length;for(var v in t)!e&&!s.call(t,v)||h&&("length"==v||l&&("offset"==v||"parent"==v)||p&&("buffer"==v||"byteLength"==v||"byteOffset"==v)||a(v,d))||y.push(v);return y}},9932:function(t){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}},2488:function(t){t.exports=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}},2908:function(t){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}},4865:function(t,e,r){var n=r(9465),o=r(7813),i=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){var u=t[e];i.call(t,e)&&o(u,r)&&(void 0!==r||e in t)||n(t,e,r)}},8470:function(t,e,r){var n=r(7813);t.exports=function(t,e){for(var r=t.length;r--;)if(n(t[r][0],e))return r;return-1}},4037:function(t,e,r){var n=r(8363),o=r(3674);t.exports=function(t,e){return t&&n(e,o(e),t)}},3886:function(t,e,r){var n=r(8363),o=r(1704);t.exports=function(t,e){return t&&n(e,o(e),t)}},9465:function(t,e,r){var n=r(8777);t.exports=function(t,e,r){"__proto__"==e&&n?n(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}},5990:function(t,e,r){var n=r(6384),o=r(7412),i=r(4865),u=r(4037),a=r(3886),c=r(4626),s=r(278),f=r(8805),l=r(1911),p=r(8234),h=r(6904),y=r(4160),d=r(3824),v=r(9148),b=r(8517),g=r(1469),m=r(4144),j=r(6688),x=r(3218),O=r(2928),_=r(3674),w=r(1704),A="[object Arguments]",S="[object Function]",E="[object Object]",k={};k[A]=k["[object Array]"]=k["[object ArrayBuffer]"]=k["[object DataView]"]=k["[object Boolean]"]=k["[object Date]"]=k["[object Float32Array]"]=k["[object Float64Array]"]=k["[object Int8Array]"]=k["[object Int16Array]"]=k["[object Int32Array]"]=k["[object Map]"]=k["[object Number]"]=k[E]=k["[object RegExp]"]=k["[object Set]"]=k["[object String]"]=k["[object Symbol]"]=k["[object Uint8Array]"]=k["[object Uint8ClampedArray]"]=k["[object Uint16Array]"]=k["[object Uint32Array]"]=!0,k["[object Error]"]=k[S]=k["[object WeakMap]"]=!1,t.exports=function t(e,r,T,C,P,I){var U,q=1&r,R=2&r,N=4&r;if(T&&(U=P?T(e,C,P,I):T(e)),void 0!==U)return U;if(!x(e))return e;var z=g(e);if(z){if(U=d(e),!q)return s(e,U)}else{var F=y(e),M=F==S||"[object GeneratorFunction]"==F;if(m(e))return c(e,q);if(F==E||F==A||M&&!P){if(U=R||M?{}:b(e),!q)return R?l(e,a(U,e)):f(e,u(U,e))}else{if(!k[F])return P?e:{};U=v(e,F,q)}}I||(I=new n);var $=I.get(e);if($)return $;I.set(e,U),O(e)?e.forEach((function(n){U.add(t(n,r,T,n,e,I))})):j(e)&&e.forEach((function(n,o){U.set(o,t(n,r,T,o,e,I))}));var B=z?void 0:(N?R?h:p:R?w:_)(e);return o(B||e,(function(n,o){B&&(n=e[o=n]),i(U,o,t(n,r,T,o,e,I))})),U}},3118:function(t,e,r){var n=r(3218),o=Object.create,i=function(){function t(){}return function(e){if(!n(e))return{};if(o)return o(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();t.exports=i},7786:function(t,e,r){var n=r(1811),o=r(327);t.exports=function(t,e){for(var r=0,i=(e=n(e,t)).length;null!=t&&r<i;)t=t[o(e[r++])];return r&&r==i?t:void 0}},8866:function(t,e,r){var n=r(2488),o=r(1469);t.exports=function(t,e,r){var i=e(t);return o(t)?i:n(i,r(t))}},4239:function(t,e,r){var n=r(2705),o=r(9607),i=r(2333),u=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":u&&u in Object(t)?o(t):i(t)}},9454:function(t,e,r){var n=r(4239),o=r(7005);t.exports=function(t){return o(t)&&"[object Arguments]"==n(t)}},939:function(t,e,r){var n=r(2492),o=r(7005);t.exports=function t(e,r,i,u,a){return e===r||(null==e||null==r||!o(e)&&!o(r)?e!=e&&r!=r:n(e,r,i,u,t,a))}},2492:function(t,e,r){var n=r(6384),o=r(7114),i=r(8351),u=r(6096),a=r(4160),c=r(1469),s=r(4144),f=r(6719),l="[object Arguments]",p="[object Array]",h="[object Object]",y=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,d,v,b){var g=c(t),m=c(e),j=g?p:a(t),x=m?p:a(e),O=(j=j==l?h:j)==h,_=(x=x==l?h:x)==h,w=j==x;if(w&&s(t)){if(!s(e))return!1;g=!0,O=!1}if(w&&!O)return b||(b=new n),g||f(t)?o(t,e,r,d,v,b):i(t,e,j,r,d,v,b);if(!(1&r)){var A=O&&y.call(t,"__wrapped__"),S=_&&y.call(e,"__wrapped__");if(A||S){var E=A?t.value():t,k=S?e.value():e;return b||(b=new n),v(E,k,r,d,b)}}return!!w&&(b||(b=new n),u(t,e,r,d,v,b))}},5588:function(t,e,r){var n=r(4160),o=r(7005);t.exports=function(t){return o(t)&&"[object Map]"==n(t)}},2958:function(t,e,r){var n=r(6384),o=r(939);t.exports=function(t,e,r,i){var u=r.length,a=u,c=!i;if(null==t)return!a;for(t=Object(t);u--;){var s=r[u];if(c&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++u<a;){var f=(s=r[u])[0],l=t[f],p=s[1];if(c&&s[2]){if(void 0===l&&!(f in t))return!1}else{var h=new n;if(i)var y=i(l,p,f,t,e,h);if(!(void 0===y?o(p,l,3,i,h):y))return!1}}return!0}},8458:function(t,e,r){var n=r(3560),o=r(5346),i=r(3218),u=r(346),a=/^\[object .+?Constructor\]$/,c=Function.prototype,s=Object.prototype,f=c.toString,l=s.hasOwnProperty,p=RegExp("^"+f.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!i(t)||o(t))&&(n(t)?p:a).test(u(t))}},9221:function(t,e,r){var n=r(4160),o=r(7005);t.exports=function(t){return o(t)&&"[object Set]"==n(t)}},8749:function(t,e,r){var n=r(4239),o=r(1780),i=r(7005),u={};u["[object Float32Array]"]=u["[object Float64Array]"]=u["[object Int8Array]"]=u["[object Int16Array]"]=u["[object Int32Array]"]=u["[object Uint8Array]"]=u["[object Uint8ClampedArray]"]=u["[object Uint16Array]"]=u["[object Uint32Array]"]=!0,u["[object Arguments]"]=u["[object Array]"]=u["[object ArrayBuffer]"]=u["[object Boolean]"]=u["[object DataView]"]=u["[object Date]"]=u["[object Error]"]=u["[object Function]"]=u["[object Map]"]=u["[object Number]"]=u["[object Object]"]=u["[object RegExp]"]=u["[object Set]"]=u["[object String]"]=u["[object WeakMap]"]=!1,t.exports=function(t){return i(t)&&o(t.length)&&!!u[n(t)]}},280:function(t,e,r){var n=r(5726),o=r(6916),i=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return o(t);var e=[];for(var r in Object(t))i.call(t,r)&&"constructor"!=r&&e.push(r);return e}},313:function(t,e,r){var n=r(3218),o=r(5726),i=r(3498),u=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return i(t);var e=o(t),r=[];for(var a in t)("constructor"!=a||!e&&u.call(t,a))&&r.push(a);return r}},1573:function(t,e,r){var n=r(2958),o=r(1499),i=r(2634);t.exports=function(t){var e=o(t);return 1==e.length&&e[0][2]?i(e[0][0],e[0][1]):function(r){return r===t||n(r,t,e)}}},2545:function(t){t.exports=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}},531:function(t,e,r){var n=r(2705),o=r(9932),i=r(1469),u=r(3448),a=n?n.prototype:void 0,c=a?a.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(i(e))return o(e,t)+"";if(u(e))return c?c.call(e):"";var r=e+"";return"0"==r&&1/e==-Infinity?"-0":r}},1717:function(t){t.exports=function(t){return function(e){return t(e)}}},4757:function(t){t.exports=function(t,e){return t.has(e)}},1811:function(t,e,r){var n=r(1469),o=r(5403),i=r(5514),u=r(9833);t.exports=function(t,e){return n(t)?t:o(t,e)?[t]:i(u(t))}},4318:function(t,e,r){var n=r(1149);t.exports=function(t){var e=new t.constructor(t.byteLength);return new n(e).set(new n(t)),e}},4626:function(t,e,r){t=r.nmd(t);var n=r(5639),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,u=i&&i.exports===o?n.Buffer:void 0,a=u?u.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=a?a(r):new t.constructor(r);return t.copy(n),n}},7157:function(t,e,r){var n=r(4318);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}},3147:function(t){var e=/\w*$/;t.exports=function(t){var r=new t.constructor(t.source,e.exec(t));return r.lastIndex=t.lastIndex,r}},419:function(t,e,r){var n=r(2705),o=n?n.prototype:void 0,i=o?o.valueOf:void 0;t.exports=function(t){return i?Object(i.call(t)):{}}},7133:function(t,e,r){var n=r(4318);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}},278:function(t){t.exports=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}},8363:function(t,e,r){var n=r(4865),o=r(9465);t.exports=function(t,e,r,i){var u=!r;r||(r={});for(var a=-1,c=e.length;++a<c;){var s=e[a],f=i?i(r[s],t[s],s,r,t):void 0;void 0===f&&(f=t[s]),u?o(r,s,f):n(r,s,f)}return r}},8805:function(t,e,r){var n=r(8363),o=r(9551);t.exports=function(t,e){return n(t,o(t),e)}},1911:function(t,e,r){var n=r(8363),o=r(1442);t.exports=function(t,e){return n(t,o(t),e)}},4429:function(t,e,r){var n=r(5639)["__core-js_shared__"];t.exports=n},8777:function(t,e,r){var n=r(852),o=function(){try{var t=n(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},7114:function(t,e,r){var n=r(8668),o=r(2908),i=r(4757);t.exports=function(t,e,r,u,a,c){var s=1&r,f=t.length,l=e.length;if(f!=l&&!(s&&l>f))return!1;var p=c.get(t),h=c.get(e);if(p&&h)return p==e&&h==t;var y=-1,d=!0,v=2&r?new n:void 0;for(c.set(t,e),c.set(e,t);++y<f;){var b=t[y],g=e[y];if(u)var m=s?u(g,b,y,e,t,c):u(b,g,y,t,e,c);if(void 0!==m){if(m)continue;d=!1;break}if(v){if(!o(e,(function(t,e){if(!i(v,e)&&(b===t||a(b,t,r,u,c)))return v.push(e)}))){d=!1;break}}else if(b!==g&&!a(b,g,r,u,c)){d=!1;break}}return c.delete(t),c.delete(e),d}},8351:function(t,e,r){var n=r(2705),o=r(1149),i=r(7813),u=r(7114),a=r(8776),c=r(1814),s=n?n.prototype:void 0,f=s?s.valueOf:void 0;t.exports=function(t,e,r,n,s,l,p){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!l(new o(t),new o(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var h=a;case"[object Set]":var y=1&n;if(h||(h=c),t.size!=e.size&&!y)return!1;var d=p.get(t);if(d)return d==e;n|=2,p.set(t,e);var v=u(h(t),h(e),n,s,l,p);return p.delete(t),v;case"[object Symbol]":if(f)return f.call(t)==f.call(e)}return!1}},6096:function(t,e,r){var n=r(8234),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,i,u,a){var c=1&r,s=n(t),f=s.length;if(f!=n(e).length&&!c)return!1;for(var l=f;l--;){var p=s[l];if(!(c?p in e:o.call(e,p)))return!1}var h=a.get(t),y=a.get(e);if(h&&y)return h==e&&y==t;var d=!0;a.set(t,e),a.set(e,t);for(var v=c;++l<f;){var b=t[p=s[l]],g=e[p];if(i)var m=c?i(g,b,p,e,t,a):i(b,g,p,t,e,a);if(!(void 0===m?b===g||u(b,g,r,i,a):m)){d=!1;break}v||(v="constructor"==p)}if(d&&!v){var j=t.constructor,x=e.constructor;j==x||!("constructor"in t)||!("constructor"in e)||"function"==typeof j&&j instanceof j&&"function"==typeof x&&x instanceof x||(d=!1)}return a.delete(t),a.delete(e),d}},1957:function(t,e,r){var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;t.exports=n},8234:function(t,e,r){var n=r(8866),o=r(9551),i=r(3674);t.exports=function(t){return n(t,i,o)}},6904:function(t,e,r){var n=r(8866),o=r(1442),i=r(1704);t.exports=function(t){return n(t,i,o)}},5050:function(t,e,r){var n=r(7019);t.exports=function(t,e){var r=t.__data__;return n(e)?r["string"==typeof e?"string":"hash"]:r.map}},1499:function(t,e,r){var n=r(9162),o=r(3674);t.exports=function(t){for(var e=o(t),r=e.length;r--;){var i=e[r],u=t[i];e[r]=[i,u,n(u)]}return e}},852:function(t,e,r){var n=r(8458),o=r(7801);t.exports=function(t,e){var r=o(t,e);return n(r)?r:void 0}},5924:function(t,e,r){var n=r(5569)(Object.getPrototypeOf,Object);t.exports=n},9607:function(t,e,r){var n=r(2705),o=Object.prototype,i=o.hasOwnProperty,u=o.toString,a=n?n.toStringTag:void 0;t.exports=function(t){var e=i.call(t,a),r=t[a];try{t[a]=void 0;var n=!0}catch(t){}var o=u.call(t);return n&&(e?t[a]=r:delete t[a]),o}},9551:function(t,e,r){var n=r(4963),o=r(479),i=Object.prototype.propertyIsEnumerable,u=Object.getOwnPropertySymbols,a=u?function(t){return null==t?[]:(t=Object(t),n(u(t),(function(e){return i.call(t,e)})))}:o;t.exports=a},1442:function(t,e,r){var n=r(2488),o=r(5924),i=r(9551),u=r(479),a=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)n(e,i(t)),t=o(t);return e}:u;t.exports=a},4160:function(t,e,r){var n=r(8552),o=r(7071),i=r(3818),u=r(8525),a=r(577),c=r(4239),s=r(346),f="[object Map]",l="[object Promise]",p="[object Set]",h="[object WeakMap]",y="[object DataView]",d=s(n),v=s(o),b=s(i),g=s(u),m=s(a),j=c;(n&&j(new n(new ArrayBuffer(1)))!=y||o&&j(new o)!=f||i&&j(i.resolve())!=l||u&&j(new u)!=p||a&&j(new a)!=h)&&(j=function(t){var e=c(t),r="[object Object]"==e?t.constructor:void 0,n=r?s(r):"";if(n)switch(n){case d:return y;case v:return f;case b:return l;case g:return p;case m:return h}return e}),t.exports=j},7801:function(t){t.exports=function(t,e){return null==t?void 0:t[e]}},1789:function(t,e,r){var n=r(4536);t.exports=function(){this.__data__=n?n(null):{},this.size=0}},401:function(t){t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},7667:function(t,e,r){var n=r(4536),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(n){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return o.call(e,t)?e[t]:void 0}},1327:function(t,e,r){var n=r(4536),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return n?void 0!==e[t]:o.call(e,t)}},1866:function(t,e,r){var n=r(4536);t.exports=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=n&&void 0===e?"__lodash_hash_undefined__":e,this}},3824:function(t){var e=Object.prototype.hasOwnProperty;t.exports=function(t){var r=t.length,n=new t.constructor(r);return r&&"string"==typeof t[0]&&e.call(t,"index")&&(n.index=t.index,n.input=t.input),n}},9148:function(t,e,r){var n=r(4318),o=r(7157),i=r(3147),u=r(419),a=r(7133);t.exports=function(t,e,r){var c=t.constructor;switch(e){case"[object ArrayBuffer]":return n(t);case"[object Boolean]":case"[object Date]":return new c(+t);case"[object DataView]":return o(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return a(t,r);case"[object Map]":return new c;case"[object Number]":case"[object String]":return new c(t);case"[object RegExp]":return i(t);case"[object Set]":return new c;case"[object Symbol]":return u(t)}}},8517:function(t,e,r){var n=r(3118),o=r(5924),i=r(5726);t.exports=function(t){return"function"!=typeof t.constructor||i(t)?{}:n(o(t))}},5776:function(t){var e=/^(?:0|[1-9]\d*)$/;t.exports=function(t,r){var n=typeof t;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&e.test(t))&&t>-1&&t%1==0&&t<r}},5403:function(t,e,r){var n=r(1469),o=r(3448),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,u=/^\w*$/;t.exports=function(t,e){if(n(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!o(t))||(u.test(t)||!i.test(t)||null!=e&&t in Object(e))}},7019:function(t){t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},5346:function(t,e,r){var n,o=r(4429),i=(n=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";t.exports=function(t){return!!i&&i in t}},5726:function(t){var e=Object.prototype;t.exports=function(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||e)}},9162:function(t,e,r){var n=r(3218);t.exports=function(t){return t==t&&!n(t)}},7040:function(t){t.exports=function(){this.__data__=[],this.size=0}},4125:function(t,e,r){var n=r(8470),o=Array.prototype.splice;t.exports=function(t){var e=this.__data__,r=n(e,t);return!(r<0)&&(r==e.length-1?e.pop():o.call(e,r,1),--this.size,!0)}},2117:function(t,e,r){var n=r(8470);t.exports=function(t){var e=this.__data__,r=n(e,t);return r<0?void 0:e[r][1]}},7518:function(t,e,r){var n=r(8470);t.exports=function(t){return n(this.__data__,t)>-1}},4705:function(t,e,r){var n=r(8470);t.exports=function(t,e){var r=this.__data__,o=n(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}},4785:function(t,e,r){var n=r(1989),o=r(8407),i=r(7071);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(i||o),string:new n}}},1285:function(t,e,r){var n=r(5050);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},6e3:function(t,e,r){var n=r(5050);t.exports=function(t){return n(this,t).get(t)}},9916:function(t,e,r){var n=r(5050);t.exports=function(t){return n(this,t).has(t)}},5265:function(t,e,r){var n=r(5050);t.exports=function(t,e){var r=n(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}},8776:function(t){t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}},2634:function(t){t.exports=function(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}}},4523:function(t,e,r){var n=r(8306);t.exports=function(t){var e=n(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}},4536:function(t,e,r){var n=r(852)(Object,"create");t.exports=n},6916:function(t,e,r){var n=r(5569)(Object.keys,Object);t.exports=n},3498:function(t){t.exports=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}},1167:function(t,e,r){t=r.nmd(t);var n=r(1957),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,u=i&&i.exports===o&&n.process,a=function(){try{var t=i&&i.require&&i.require("util").types;return t||u&&u.binding&&u.binding("util")}catch(t){}}();t.exports=a},2333:function(t){var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},5569:function(t){t.exports=function(t,e){return function(r){return t(e(r))}}},5639:function(t,e,r){var n=r(1957),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();t.exports=i},619:function(t){t.exports=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}},2385:function(t){t.exports=function(t){return this.__data__.has(t)}},1814:function(t){t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}},7465:function(t,e,r){var n=r(8407);t.exports=function(){this.__data__=new n,this.size=0}},3779:function(t){t.exports=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}},7599:function(t){t.exports=function(t){return this.__data__.get(t)}},4758:function(t){t.exports=function(t){return this.__data__.has(t)}},4309:function(t,e,r){var n=r(8407),o=r(7071),i=r(3369);t.exports=function(t,e){var r=this.__data__;if(r instanceof n){var u=r.__data__;if(!o||u.length<199)return u.push([t,e]),this.size=++r.size,this;r=this.__data__=new i(u)}return r.set(t,e),this.size=r.size,this}},5514:function(t,e,r){var n=r(4523),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,u=n((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(o,(function(t,r,n,o){e.push(n?o.replace(i,"$1"):r||t)})),e}));t.exports=u},327:function(t,e,r){var n=r(3448);t.exports=function(t){if("string"==typeof t||n(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e}},346:function(t){var e=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},7813:function(t){t.exports=function(t,e){return t===e||t!=t&&e!=e}},7361:function(t,e,r){var n=r(7786);t.exports=function(t,e,r){var o=null==t?void 0:n(t,e);return void 0===o?r:o}},5694:function(t,e,r){var n=r(9454),o=r(7005),i=Object.prototype,u=i.hasOwnProperty,a=i.propertyIsEnumerable,c=n(function(){return arguments}())?n:function(t){return o(t)&&u.call(t,"callee")&&!a.call(t,"callee")};t.exports=c},1469:function(t){var e=Array.isArray;t.exports=e},8612:function(t,e,r){var n=r(3560),o=r(1780);t.exports=function(t){return null!=t&&o(t.length)&&!n(t)}},4144:function(t,e,r){t=r.nmd(t);var n=r(5639),o=r(5062),i=e&&!e.nodeType&&e,u=i&&t&&!t.nodeType&&t,a=u&&u.exports===i?n.Buffer:void 0,c=(a?a.isBuffer:void 0)||o;t.exports=c},3560:function(t,e,r){var n=r(4239),o=r(3218);t.exports=function(t){if(!o(t))return!1;var e=n(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},1780:function(t){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},6688:function(t,e,r){var n=r(5588),o=r(1717),i=r(1167),u=i&&i.isMap,a=u?o(u):n;t.exports=a},3218:function(t){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},7005:function(t){t.exports=function(t){return null!=t&&"object"==typeof t}},2928:function(t,e,r){var n=r(9221),o=r(1717),i=r(1167),u=i&&i.isSet,a=u?o(u):n;t.exports=a},3448:function(t,e,r){var n=r(4239),o=r(7005);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==n(t)}},6719:function(t,e,r){var n=r(8749),o=r(1717),i=r(1167),u=i&&i.isTypedArray,a=u?o(u):n;t.exports=a},3674:function(t,e,r){var n=r(4636),o=r(280),i=r(8612);t.exports=function(t){return i(t)?n(t):o(t)}},1704:function(t,e,r){var n=r(4636),o=r(313),i=r(8612);t.exports=function(t){return i(t)?n(t,!0):o(t)}},6410:function(t,e,r){var n=r(5990),o=r(1573);t.exports=function(t){return o(n(t,1))}},8306:function(t,e,r){var n=r(3369);function o(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var u=t.apply(this,n);return r.cache=i.set(o,u)||i,u};return r.cache=new(o.Cache||n),r}o.Cache=n,t.exports=o},479:function(t){t.exports=function(){return[]}},5062:function(t){t.exports=function(){return!1}},9833:function(t,e,r){var n=r(531);t.exports=function(t){return null==t?"":n(t)}}},e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={id:n,loaded:!1,exports:{}};return t[n](o,o.exports,r),o.loaded=!0,o.exports}return r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=function(t){return t.paths=[],t.children||(t.children=[]),t},r(6499)}()}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.FakeRest=e():t.FakeRest=e()}(this,(function(){return function(){var t={8552:function(t,e,r){var n=r(852)(r(5639),"DataView");t.exports=n},1989:function(t,e,r){var n=r(1789),o=r(401),i=r(7667),u=r(1327),a=r(1866);function c(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}c.prototype.clear=n,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=u,c.prototype.set=a,t.exports=c},8407:function(t,e,r){var n=r(7040),o=r(4125),i=r(2117),u=r(7518),a=r(4705);function c(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}c.prototype.clear=n,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=u,c.prototype.set=a,t.exports=c},7071:function(t,e,r){var n=r(852)(r(5639),"Map");t.exports=n},3369:function(t,e,r){var n=r(4785),o=r(1285),i=r(6e3),u=r(9916),a=r(5265);function c(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}c.prototype.clear=n,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=u,c.prototype.set=a,t.exports=c},3818:function(t,e,r){var n=r(852)(r(5639),"Promise");t.exports=n},8525:function(t,e,r){var n=r(852)(r(5639),"Set");t.exports=n},8668:function(t,e,r){var n=r(3369),o=r(619),i=r(2385);function u(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new n;++e<r;)this.add(t[e])}u.prototype.add=u.prototype.push=o,u.prototype.has=i,t.exports=u},6384:function(t,e,r){var n=r(8407),o=r(7465),i=r(3779),u=r(7599),a=r(4758),c=r(4309);function s(t){var e=this.__data__=new n(t);this.size=e.size}s.prototype.clear=o,s.prototype.delete=i,s.prototype.get=u,s.prototype.has=a,s.prototype.set=c,t.exports=s},2705:function(t,e,r){var n=r(5639).Symbol;t.exports=n},1149:function(t,e,r){var n=r(5639).Uint8Array;t.exports=n},577:function(t,e,r){var n=r(852)(r(5639),"WeakMap");t.exports=n},7412:function(t){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}},4963:function(t){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var u=t[r];e(u,r,t)&&(i[o++]=u)}return i}},4636:function(t,e,r){var n=r(2545),o=r(5694),i=r(1469),u=r(4144),a=r(5776),c=r(6719),s=Object.prototype.hasOwnProperty;t.exports=function(t,e){var r=i(t),f=!r&&o(t),l=!r&&!f&&u(t),p=!r&&!f&&!l&&c(t),h=r||f||l||p,d=h?n(t.length,String):[],y=d.length;for(var v in t)!e&&!s.call(t,v)||h&&("length"==v||l&&("offset"==v||"parent"==v)||p&&("buffer"==v||"byteLength"==v||"byteOffset"==v)||a(v,y))||d.push(v);return d}},9932:function(t){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}},2488:function(t){t.exports=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}},2908:function(t){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}},4865:function(t,e,r){var n=r(9465),o=r(7813),i=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){var u=t[e];i.call(t,e)&&o(u,r)&&(void 0!==r||e in t)||n(t,e,r)}},8470:function(t,e,r){var n=r(7813);t.exports=function(t,e){for(var r=t.length;r--;)if(n(t[r][0],e))return r;return-1}},4037:function(t,e,r){var n=r(8363),o=r(3674);t.exports=function(t,e){return t&&n(e,o(e),t)}},3886:function(t,e,r){var n=r(8363),o=r(1704);t.exports=function(t,e){return t&&n(e,o(e),t)}},9465:function(t,e,r){var n=r(8777);t.exports=function(t,e,r){"__proto__"==e&&n?n(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}},5990:function(t,e,r){var n=r(6384),o=r(7412),i=r(4865),u=r(4037),a=r(3886),c=r(4626),s=r(278),f=r(8805),l=r(1911),p=r(8234),h=r(6904),d=r(4160),y=r(3824),v=r(9148),b=r(8517),g=r(1469),m=r(4144),j=r(6688),x=r(3218),O=r(2928),w=r(3674),_=r(1704),A="[object Arguments]",S="[object Function]",E="[object Object]",k={};k[A]=k["[object Array]"]=k["[object ArrayBuffer]"]=k["[object DataView]"]=k["[object Boolean]"]=k["[object Date]"]=k["[object Float32Array]"]=k["[object Float64Array]"]=k["[object Int8Array]"]=k["[object Int16Array]"]=k["[object Int32Array]"]=k["[object Map]"]=k["[object Number]"]=k[E]=k["[object RegExp]"]=k["[object Set]"]=k["[object String]"]=k["[object Symbol]"]=k["[object Uint8Array]"]=k["[object Uint8ClampedArray]"]=k["[object Uint16Array]"]=k["[object Uint32Array]"]=!0,k["[object Error]"]=k[S]=k["[object WeakMap]"]=!1,t.exports=function t(e,r,C,T,P,I){var U,q=1&r,R=2&r,N=4&r;if(C&&(U=P?C(e,T,P,I):C(e)),void 0!==U)return U;if(!x(e))return e;var z=g(e);if(z){if(U=y(e),!q)return s(e,U)}else{var F=d(e),M=F==S||"[object GeneratorFunction]"==F;if(m(e))return c(e,q);if(F==E||F==A||M&&!P){if(U=R||M?{}:b(e),!q)return R?l(e,a(U,e)):f(e,u(U,e))}else{if(!k[F])return P?e:{};U=v(e,F,q)}}I||(I=new n);var B=I.get(e);if(B)return B;I.set(e,U),O(e)?e.forEach((function(n){U.add(t(n,r,C,n,e,I))})):j(e)&&e.forEach((function(n,o){U.set(o,t(n,r,C,o,e,I))}));var $=z?void 0:(N?R?h:p:R?_:w)(e);return o($||e,(function(n,o){$&&(n=e[o=n]),i(U,o,t(n,r,C,o,e,I))})),U}},3118:function(t,e,r){var n=r(3218),o=Object.create,i=function(){function t(){}return function(e){if(!n(e))return{};if(o)return o(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();t.exports=i},7786:function(t,e,r){var n=r(1811),o=r(327);t.exports=function(t,e){for(var r=0,i=(e=n(e,t)).length;null!=t&&r<i;)t=t[o(e[r++])];return r&&r==i?t:void 0}},8866:function(t,e,r){var n=r(2488),o=r(1469);t.exports=function(t,e,r){var i=e(t);return o(t)?i:n(i,r(t))}},4239:function(t,e,r){var n=r(2705),o=r(9607),i=r(2333),u=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":u&&u in Object(t)?o(t):i(t)}},9454:function(t,e,r){var n=r(4239),o=r(7005);t.exports=function(t){return o(t)&&"[object Arguments]"==n(t)}},939:function(t,e,r){var n=r(2492),o=r(7005);t.exports=function t(e,r,i,u,a){return e===r||(null==e||null==r||!o(e)&&!o(r)?e!=e&&r!=r:n(e,r,i,u,t,a))}},2492:function(t,e,r){var n=r(6384),o=r(7114),i=r(8351),u=r(6096),a=r(4160),c=r(1469),s=r(4144),f=r(6719),l="[object Arguments]",p="[object Array]",h="[object Object]",d=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,y,v,b){var g=c(t),m=c(e),j=g?p:a(t),x=m?p:a(e),O=(j=j==l?h:j)==h,w=(x=x==l?h:x)==h,_=j==x;if(_&&s(t)){if(!s(e))return!1;g=!0,O=!1}if(_&&!O)return b||(b=new n),g||f(t)?o(t,e,r,y,v,b):i(t,e,j,r,y,v,b);if(!(1&r)){var A=O&&d.call(t,"__wrapped__"),S=w&&d.call(e,"__wrapped__");if(A||S){var E=A?t.value():t,k=S?e.value():e;return b||(b=new n),v(E,k,r,y,b)}}return!!_&&(b||(b=new n),u(t,e,r,y,v,b))}},5588:function(t,e,r){var n=r(4160),o=r(7005);t.exports=function(t){return o(t)&&"[object Map]"==n(t)}},2958:function(t,e,r){var n=r(6384),o=r(939);t.exports=function(t,e,r,i){var u=r.length,a=u,c=!i;if(null==t)return!a;for(t=Object(t);u--;){var s=r[u];if(c&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++u<a;){var f=(s=r[u])[0],l=t[f],p=s[1];if(c&&s[2]){if(void 0===l&&!(f in t))return!1}else{var h=new n;if(i)var d=i(l,p,f,t,e,h);if(!(void 0===d?o(p,l,3,i,h):d))return!1}}return!0}},8458:function(t,e,r){var n=r(3560),o=r(5346),i=r(3218),u=r(346),a=/^\[object .+?Constructor\]$/,c=Function.prototype,s=Object.prototype,f=c.toString,l=s.hasOwnProperty,p=RegExp("^"+f.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!i(t)||o(t))&&(n(t)?p:a).test(u(t))}},9221:function(t,e,r){var n=r(4160),o=r(7005);t.exports=function(t){return o(t)&&"[object Set]"==n(t)}},8749:function(t,e,r){var n=r(4239),o=r(1780),i=r(7005),u={};u["[object Float32Array]"]=u["[object Float64Array]"]=u["[object Int8Array]"]=u["[object Int16Array]"]=u["[object Int32Array]"]=u["[object Uint8Array]"]=u["[object Uint8ClampedArray]"]=u["[object Uint16Array]"]=u["[object Uint32Array]"]=!0,u["[object Arguments]"]=u["[object Array]"]=u["[object ArrayBuffer]"]=u["[object Boolean]"]=u["[object DataView]"]=u["[object Date]"]=u["[object Error]"]=u["[object Function]"]=u["[object Map]"]=u["[object Number]"]=u["[object Object]"]=u["[object RegExp]"]=u["[object Set]"]=u["[object String]"]=u["[object WeakMap]"]=!1,t.exports=function(t){return i(t)&&o(t.length)&&!!u[n(t)]}},280:function(t,e,r){var n=r(5726),o=r(6916),i=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return o(t);var e=[];for(var r in Object(t))i.call(t,r)&&"constructor"!=r&&e.push(r);return e}},313:function(t,e,r){var n=r(3218),o=r(5726),i=r(3498),u=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return i(t);var e=o(t),r=[];for(var a in t)("constructor"!=a||!e&&u.call(t,a))&&r.push(a);return r}},1573:function(t,e,r){var n=r(2958),o=r(1499),i=r(2634);t.exports=function(t){var e=o(t);return 1==e.length&&e[0][2]?i(e[0][0],e[0][1]):function(r){return r===t||n(r,t,e)}}},2545:function(t){t.exports=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}},531:function(t,e,r){var n=r(2705),o=r(9932),i=r(1469),u=r(3448),a=n?n.prototype:void 0,c=a?a.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(i(e))return o(e,t)+"";if(u(e))return c?c.call(e):"";var r=e+"";return"0"==r&&1/e==-Infinity?"-0":r}},1717:function(t){t.exports=function(t){return function(e){return t(e)}}},4757:function(t){t.exports=function(t,e){return t.has(e)}},1811:function(t,e,r){var n=r(1469),o=r(5403),i=r(5514),u=r(9833);t.exports=function(t,e){return n(t)?t:o(t,e)?[t]:i(u(t))}},4318:function(t,e,r){var n=r(1149);t.exports=function(t){var e=new t.constructor(t.byteLength);return new n(e).set(new n(t)),e}},4626:function(t,e,r){t=r.nmd(t);var n=r(5639),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,u=i&&i.exports===o?n.Buffer:void 0,a=u?u.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=a?a(r):new t.constructor(r);return t.copy(n),n}},7157:function(t,e,r){var n=r(4318);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}},3147:function(t){var e=/\w*$/;t.exports=function(t){var r=new t.constructor(t.source,e.exec(t));return r.lastIndex=t.lastIndex,r}},419:function(t,e,r){var n=r(2705),o=n?n.prototype:void 0,i=o?o.valueOf:void 0;t.exports=function(t){return i?Object(i.call(t)):{}}},7133:function(t,e,r){var n=r(4318);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}},278:function(t){t.exports=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}},8363:function(t,e,r){var n=r(4865),o=r(9465);t.exports=function(t,e,r,i){var u=!r;r||(r={});for(var a=-1,c=e.length;++a<c;){var s=e[a],f=i?i(r[s],t[s],s,r,t):void 0;void 0===f&&(f=t[s]),u?o(r,s,f):n(r,s,f)}return r}},8805:function(t,e,r){var n=r(8363),o=r(9551);t.exports=function(t,e){return n(t,o(t),e)}},1911:function(t,e,r){var n=r(8363),o=r(1442);t.exports=function(t,e){return n(t,o(t),e)}},4429:function(t,e,r){var n=r(5639)["__core-js_shared__"];t.exports=n},8777:function(t,e,r){var n=r(852),o=function(){try{var t=n(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},7114:function(t,e,r){var n=r(8668),o=r(2908),i=r(4757);t.exports=function(t,e,r,u,a,c){var s=1&r,f=t.length,l=e.length;if(f!=l&&!(s&&l>f))return!1;var p=c.get(t),h=c.get(e);if(p&&h)return p==e&&h==t;var d=-1,y=!0,v=2&r?new n:void 0;for(c.set(t,e),c.set(e,t);++d<f;){var b=t[d],g=e[d];if(u)var m=s?u(g,b,d,e,t,c):u(b,g,d,t,e,c);if(void 0!==m){if(m)continue;y=!1;break}if(v){if(!o(e,(function(t,e){if(!i(v,e)&&(b===t||a(b,t,r,u,c)))return v.push(e)}))){y=!1;break}}else if(b!==g&&!a(b,g,r,u,c)){y=!1;break}}return c.delete(t),c.delete(e),y}},8351:function(t,e,r){var n=r(2705),o=r(1149),i=r(7813),u=r(7114),a=r(8776),c=r(1814),s=n?n.prototype:void 0,f=s?s.valueOf:void 0;t.exports=function(t,e,r,n,s,l,p){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!l(new o(t),new o(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var h=a;case"[object Set]":var d=1&n;if(h||(h=c),t.size!=e.size&&!d)return!1;var y=p.get(t);if(y)return y==e;n|=2,p.set(t,e);var v=u(h(t),h(e),n,s,l,p);return p.delete(t),v;case"[object Symbol]":if(f)return f.call(t)==f.call(e)}return!1}},6096:function(t,e,r){var n=r(8234),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,i,u,a){var c=1&r,s=n(t),f=s.length;if(f!=n(e).length&&!c)return!1;for(var l=f;l--;){var p=s[l];if(!(c?p in e:o.call(e,p)))return!1}var h=a.get(t),d=a.get(e);if(h&&d)return h==e&&d==t;var y=!0;a.set(t,e),a.set(e,t);for(var v=c;++l<f;){var b=t[p=s[l]],g=e[p];if(i)var m=c?i(g,b,p,e,t,a):i(b,g,p,t,e,a);if(!(void 0===m?b===g||u(b,g,r,i,a):m)){y=!1;break}v||(v="constructor"==p)}if(y&&!v){var j=t.constructor,x=e.constructor;j==x||!("constructor"in t)||!("constructor"in e)||"function"==typeof j&&j instanceof j&&"function"==typeof x&&x instanceof x||(y=!1)}return a.delete(t),a.delete(e),y}},1957:function(t,e,r){var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;t.exports=n},8234:function(t,e,r){var n=r(8866),o=r(9551),i=r(3674);t.exports=function(t){return n(t,i,o)}},6904:function(t,e,r){var n=r(8866),o=r(1442),i=r(1704);t.exports=function(t){return n(t,i,o)}},5050:function(t,e,r){var n=r(7019);t.exports=function(t,e){var r=t.__data__;return n(e)?r["string"==typeof e?"string":"hash"]:r.map}},1499:function(t,e,r){var n=r(9162),o=r(3674);t.exports=function(t){for(var e=o(t),r=e.length;r--;){var i=e[r],u=t[i];e[r]=[i,u,n(u)]}return e}},852:function(t,e,r){var n=r(8458),o=r(7801);t.exports=function(t,e){var r=o(t,e);return n(r)?r:void 0}},5924:function(t,e,r){var n=r(5569)(Object.getPrototypeOf,Object);t.exports=n},9607:function(t,e,r){var n=r(2705),o=Object.prototype,i=o.hasOwnProperty,u=o.toString,a=n?n.toStringTag:void 0;t.exports=function(t){var e=i.call(t,a),r=t[a];try{t[a]=void 0;var n=!0}catch(t){}var o=u.call(t);return n&&(e?t[a]=r:delete t[a]),o}},9551:function(t,e,r){var n=r(4963),o=r(479),i=Object.prototype.propertyIsEnumerable,u=Object.getOwnPropertySymbols,a=u?function(t){return null==t?[]:(t=Object(t),n(u(t),(function(e){return i.call(t,e)})))}:o;t.exports=a},1442:function(t,e,r){var n=r(2488),o=r(5924),i=r(9551),u=r(479),a=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)n(e,i(t)),t=o(t);return e}:u;t.exports=a},4160:function(t,e,r){var n=r(8552),o=r(7071),i=r(3818),u=r(8525),a=r(577),c=r(4239),s=r(346),f="[object Map]",l="[object Promise]",p="[object Set]",h="[object WeakMap]",d="[object DataView]",y=s(n),v=s(o),b=s(i),g=s(u),m=s(a),j=c;(n&&j(new n(new ArrayBuffer(1)))!=d||o&&j(new o)!=f||i&&j(i.resolve())!=l||u&&j(new u)!=p||a&&j(new a)!=h)&&(j=function(t){var e=c(t),r="[object Object]"==e?t.constructor:void 0,n=r?s(r):"";if(n)switch(n){case y:return d;case v:return f;case b:return l;case g:return p;case m:return h}return e}),t.exports=j},7801:function(t){t.exports=function(t,e){return null==t?void 0:t[e]}},1789:function(t,e,r){var n=r(4536);t.exports=function(){this.__data__=n?n(null):{},this.size=0}},401:function(t){t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},7667:function(t,e,r){var n=r(4536),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(n){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return o.call(e,t)?e[t]:void 0}},1327:function(t,e,r){var n=r(4536),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return n?void 0!==e[t]:o.call(e,t)}},1866:function(t,e,r){var n=r(4536);t.exports=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=n&&void 0===e?"__lodash_hash_undefined__":e,this}},3824:function(t){var e=Object.prototype.hasOwnProperty;t.exports=function(t){var r=t.length,n=new t.constructor(r);return r&&"string"==typeof t[0]&&e.call(t,"index")&&(n.index=t.index,n.input=t.input),n}},9148:function(t,e,r){var n=r(4318),o=r(7157),i=r(3147),u=r(419),a=r(7133);t.exports=function(t,e,r){var c=t.constructor;switch(e){case"[object ArrayBuffer]":return n(t);case"[object Boolean]":case"[object Date]":return new c(+t);case"[object DataView]":return o(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return a(t,r);case"[object Map]":case"[object Set]":return new c;case"[object Number]":case"[object String]":return new c(t);case"[object RegExp]":return i(t);case"[object Symbol]":return u(t)}}},8517:function(t,e,r){var n=r(3118),o=r(5924),i=r(5726);t.exports=function(t){return"function"!=typeof t.constructor||i(t)?{}:n(o(t))}},5776:function(t){var e=/^(?:0|[1-9]\d*)$/;t.exports=function(t,r){var n=typeof t;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&e.test(t))&&t>-1&&t%1==0&&t<r}},5403:function(t,e,r){var n=r(1469),o=r(3448),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,u=/^\w*$/;t.exports=function(t,e){if(n(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!o(t))||(u.test(t)||!i.test(t)||null!=e&&t in Object(e))}},7019:function(t){t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},5346:function(t,e,r){var n,o=r(4429),i=(n=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";t.exports=function(t){return!!i&&i in t}},5726:function(t){var e=Object.prototype;t.exports=function(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||e)}},9162:function(t,e,r){var n=r(3218);t.exports=function(t){return t==t&&!n(t)}},7040:function(t){t.exports=function(){this.__data__=[],this.size=0}},4125:function(t,e,r){var n=r(8470),o=Array.prototype.splice;t.exports=function(t){var e=this.__data__,r=n(e,t);return!(r<0)&&(r==e.length-1?e.pop():o.call(e,r,1),--this.size,!0)}},2117:function(t,e,r){var n=r(8470);t.exports=function(t){var e=this.__data__,r=n(e,t);return r<0?void 0:e[r][1]}},7518:function(t,e,r){var n=r(8470);t.exports=function(t){return n(this.__data__,t)>-1}},4705:function(t,e,r){var n=r(8470);t.exports=function(t,e){var r=this.__data__,o=n(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}},4785:function(t,e,r){var n=r(1989),o=r(8407),i=r(7071);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(i||o),string:new n}}},1285:function(t,e,r){var n=r(5050);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},6e3:function(t,e,r){var n=r(5050);t.exports=function(t){return n(this,t).get(t)}},9916:function(t,e,r){var n=r(5050);t.exports=function(t){return n(this,t).has(t)}},5265:function(t,e,r){var n=r(5050);t.exports=function(t,e){var r=n(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}},8776:function(t){t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}},2634:function(t){t.exports=function(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}}},4523:function(t,e,r){var n=r(8306);t.exports=function(t){var e=n(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}},4536:function(t,e,r){var n=r(852)(Object,"create");t.exports=n},6916:function(t,e,r){var n=r(5569)(Object.keys,Object);t.exports=n},3498:function(t){t.exports=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}},1167:function(t,e,r){t=r.nmd(t);var n=r(1957),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,u=i&&i.exports===o&&n.process,a=function(){try{var t=i&&i.require&&i.require("util").types;return t||u&&u.binding&&u.binding("util")}catch(t){}}();t.exports=a},2333:function(t){var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},5569:function(t){t.exports=function(t,e){return function(r){return t(e(r))}}},5639:function(t,e,r){var n=r(1957),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();t.exports=i},619:function(t){t.exports=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}},2385:function(t){t.exports=function(t){return this.__data__.has(t)}},1814:function(t){t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}},7465:function(t,e,r){var n=r(8407);t.exports=function(){this.__data__=new n,this.size=0}},3779:function(t){t.exports=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}},7599:function(t){t.exports=function(t){return this.__data__.get(t)}},4758:function(t){t.exports=function(t){return this.__data__.has(t)}},4309:function(t,e,r){var n=r(8407),o=r(7071),i=r(3369);t.exports=function(t,e){var r=this.__data__;if(r instanceof n){var u=r.__data__;if(!o||u.length<199)return u.push([t,e]),this.size=++r.size,this;r=this.__data__=new i(u)}return r.set(t,e),this.size=r.size,this}},5514:function(t,e,r){var n=r(4523),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,u=n((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(o,(function(t,r,n,o){e.push(n?o.replace(i,"$1"):r||t)})),e}));t.exports=u},327:function(t,e,r){var n=r(3448);t.exports=function(t){if("string"==typeof t||n(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e}},346:function(t){var e=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},7813:function(t){t.exports=function(t,e){return t===e||t!=t&&e!=e}},7361:function(t,e,r){var n=r(7786);t.exports=function(t,e,r){var o=null==t?void 0:n(t,e);return void 0===o?r:o}},5694:function(t,e,r){var n=r(9454),o=r(7005),i=Object.prototype,u=i.hasOwnProperty,a=i.propertyIsEnumerable,c=n(function(){return arguments}())?n:function(t){return o(t)&&u.call(t,"callee")&&!a.call(t,"callee")};t.exports=c},1469:function(t){var e=Array.isArray;t.exports=e},8612:function(t,e,r){var n=r(3560),o=r(1780);t.exports=function(t){return null!=t&&o(t.length)&&!n(t)}},4144:function(t,e,r){t=r.nmd(t);var n=r(5639),o=r(5062),i=e&&!e.nodeType&&e,u=i&&t&&!t.nodeType&&t,a=u&&u.exports===i?n.Buffer:void 0,c=(a?a.isBuffer:void 0)||o;t.exports=c},3560:function(t,e,r){var n=r(4239),o=r(3218);t.exports=function(t){if(!o(t))return!1;var e=n(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},1780:function(t){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},6688:function(t,e,r){var n=r(5588),o=r(1717),i=r(1167),u=i&&i.isMap,a=u?o(u):n;t.exports=a},3218:function(t){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},7005:function(t){t.exports=function(t){return null!=t&&"object"==typeof t}},2928:function(t,e,r){var n=r(9221),o=r(1717),i=r(1167),u=i&&i.isSet,a=u?o(u):n;t.exports=a},3448:function(t,e,r){var n=r(4239),o=r(7005);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==n(t)}},6719:function(t,e,r){var n=r(8749),o=r(1717),i=r(1167),u=i&&i.isTypedArray,a=u?o(u):n;t.exports=a},3674:function(t,e,r){var n=r(4636),o=r(280),i=r(8612);t.exports=function(t){return i(t)?n(t):o(t)}},1704:function(t,e,r){var n=r(4636),o=r(313),i=r(8612);t.exports=function(t){return i(t)?n(t,!0):o(t)}},6410:function(t,e,r){var n=r(5990),o=r(1573);t.exports=function(t){return o(n(t,1))}},8306:function(t,e,r){var n=r(3369);function o(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var u=t.apply(this,n);return r.cache=i.set(o,u)||i,u};return r.cache=new(o.Cache||n),r}o.Cache=n,t.exports=o},479:function(t){t.exports=function(){return[]}},5062:function(t){t.exports=function(){return!1}},9833:function(t,e,r){var n=r(531);t.exports=function(t){return null==t?"":n(t)}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={id:n,loaded:!1,exports:{}};return t[n](i,i.exports,r),i.loaded=!0,i.exports}r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=function(t){return t.paths=[],t.children||(t.children=[]),t};var n={};return function(){"use strict";r.r(n),r.d(n,{Collection:function(){return d},FetchServer:function(){return N},Server:function(){return S},Single:function(){return b},default:function(){return z}});var t=r(7361),e=r.n(t),o=r(6410),i=r.n(o);function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function c(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function s(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,o,i=[],u=!0,a=!1;try{for(r=r.call(t);!(u=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==r.return||r.return()}finally{if(a)throw o}}return i}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return f(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return f(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}var p=function(t,r){if(-1!==t.indexOf("_q")){var n=t.replace(/(_q)$/,""),o=new RegExp(r,"i");return function(t){var r;return null!==(null===(r=e()(t,n))||void 0===r?void 0:r.match(o))}}if(-1!==t.indexOf("_lte")){var u=t.replace(/(_lte)$/,"");return function(t){return e()(t,u)<=r}}if(-1!==t.indexOf("_gte")){var a=t.replace(/(_gte)$/,"");return function(t){return e()(t,a)>=r}}if(-1!==t.indexOf("_lt")){var c=t.replace(/(_lt)$/,"");return function(t){return e()(t,c)<r}}if(-1!==t.indexOf("_gt")){var s=t.replace(/(_gt)$/,"");return function(t){return e()(t,s)>r}}if(-1!==t.indexOf("_neq")){var f=t.replace(/(_neq)$/,"");return function(t){return e()(t,f)!=r}}return Array.isArray(r)?function(n){return Array.isArray(e()(n,t))?(o=function(r){return o=e()(n,t),i=function(t){return t==r},o.reduce((function(t,e){return t||i(e)}),!1);var o,i},r.reduce((function(t,e){return t&&o(e)}),!0)):r.filter((function(r){return r==e()(n,t)})).length>0;var o}:"object"===l(r)?function(n){return i()(r)(e()(n,t))}:function(n){return Array.isArray(e()(n,t))&&"string"==typeof r?-1!==e()(n,t).indexOf(r):"boolean"==typeof e()(n,t)&&"string"==typeof r?e()(n,t)==("true"===r):e()(n,t)==r}};function h(t,r){if("function"==typeof r)return t.filter(r);if(r instanceof Object){var n=Object.keys(r).map((function(t){if("q"===t){var n=new RegExp(r.q,"i");return function t(e){for(var r in e){if("object"===l(e[r])&&t(e[r]))return!0;if(e[r]&&e[r].match&&null!==e[r].match(n))return!0}return!1}}var o=t.split("."),i=r[t];return o.length>1?function(r){var n=function(t,r){return t.reduce((function(n,o,i){if(null!=n)return n;var u=t.slice(0,i+1).join("."),a=t.slice(i+1).join("."),c=e()(r,u);return Array.isArray(c)&&i<t.length-1?[u,a]:void 0}),void 0)}(o,r);if(n){var u=s(n,2),a=u[0],f=u[1];return h(e()(r,a),c({},f,i)).length>0}return p(t,i)(r)}:p(t,i)}));return t.filter((function(t){return n.reduce((function(e,r){return e&&r(t)}),!0)}))}throw new Error("Unsupported filter type")}var d=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"id";if(u(this,t),c(this,"sequence",0),c(this,"items",[]),c(this,"server",null),c(this,"name",null),c(this,"identifierName","id"),!Array.isArray(e))throw new Error("Can't initialize a Collection with anything else than an array of items");this.identifierName=r,e.map(this.addOne.bind(this))}var e,r,n;return e=t,(r=[{key:"setServer",value:function(t){this.server=t}},{key:"setName",value:function(t){this.name=t}},{key:"_oneToManyEmbedder",value:function(t){var e=this;if(null==this.name)throw new Error("Can't embed references without a collection name");var r=this.name.slice(0,-1)+"_id";return function(n){if(null==e.server)throw new Error("Can't embed references without a server");var o=e.server.collections[t];if(!o)throw new Error("Can't embed a non-existing collection ".concat(t));return Array.isArray(n[t])?n[t]=o.getAll({filter:function(e){return-1!==n[t].indexOf(e[o.identifierName])}}):n[t]=o.getAll({filter:function(t){return t[r]==n[e.identifierName]}}),n}}},{key:"_manyToOneEmbedder",value:function(t){var e=this,r=t+"s",n=t+"_id";return function(o){if(null==e.server)throw new Error("Can't embed references without a server");var i=e.server.collections[r];if(!i)throw new Error("Can't embed a non-existing collection ".concat(t));try{o[t]=i.getOne(o[n])}catch(t){}return o}}},{key:"_itemEmbedder",value:function(t){var e=this,r=(Array.isArray(t)?t:[t]).map((function(t){return t.endsWith("s")?e._oneToManyEmbedder(t):e._manyToOneEmbedder(t)}));return function(t){return r.reduce((function(t,e){return e(t)}),t)}}},{key:"getCount",value:function(t){return this.getAll(t).length}},{key:"getAll",value:function(t){var e=this.items.slice(0);return t&&(t.filter&&(e=h(e,t.filter)),t.sort&&(e=function(t,e){if("function"==typeof e)return t.sort(e);if("string"==typeof e)return t.sort((function(t,r){return t[e]>r[e]?1:t[e]<r[e]?-1:0}));if(Array.isArray(e)){var r=e[0],n="asc"==e[1].toLowerCase()?1:-1;return t.sort((function(t,e){return t[r]>e[r]?n:t[r]<e[r]?-1*n:0}))}throw new Error("Unsupported sort type")}(e,t.sort)),t.range&&(e=function(t,e){if(Array.isArray(e))return t.slice(e[0],void 0!==e[1]?e[1]+1:void 0);throw new Error("Unsupported range type")}(e,t.range)),e=e.map((function(t){return Object.assign({},t)})),t.embed&&this.server&&(e=e.map(this._itemEmbedder(t.embed)))),e}},{key:"getIndex",value:function(t){var e=this;return this.items.findIndex((function(r){return r[e.identifierName]==t}))}},{key:"getOne",value:function(t,e){var r=this.getIndex(t);if(-1===r)throw new Error("No item with identifier ".concat(t));var n=this.items[r];return n=Object.assign({},n),e&&e.embed&&this.server&&(n=this._itemEmbedder(e.embed)(n)),n}},{key:"addOne",value:function(t){var e=t[this.identifierName];if(void 0!==e){if(-1!==this.getIndex(e))throw new Error("An item with the identifier ".concat(e," already exists"));this.sequence=Math.max(this.sequence,e)+1}else t[this.identifierName]=this.sequence++;return this.items.push(t),Object.assign({},t)}},{key:"updateOne",value:function(t,e){var r=this.getIndex(t);if(-1===r)throw new Error("No item with identifier ".concat(t));for(var n in e)this.items[r][n]=e[n];return Object.assign({},this.items[r])}},{key:"removeOne",value:function(t){var e=this.getIndex(t);if(-1===e)throw new Error("No item with identifier ".concat(t));var r=this.items[e];return this.items.splice(e,1),t==this.sequence-1&&this.sequence--,r}}])&&a(e.prototype,r),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function y(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function v(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var b=function(){function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),v(this,"obj",null),v(this,"server",null),v(this,"name",null),!(e instanceof Object))throw new Error("Can't initialize a Single with anything except an object");this.obj=e}var e,r,n;return e=t,(r=[{key:"setServer",value:function(t){this.server=t}},{key:"setName",value:function(t){this.name=t}},{key:"_oneToManyEmbedder",value:function(t){var e=this;return function(r){if(null==e.server)throw new Error("Can't embed references without a server");var n=e.server.collections[t];if(!n)throw new Error("Can't embed a non-existing collection ".concat(t));return r[t]=n.getAll({filter:function(e){return-1!==r[t].indexOf(e[n.identifierName])}}),r}}},{key:"_manyToOneEmbedder",value:function(t){var e=this,r=t+"s",n=t+"_id";return function(o){if(null==e.server)throw new Error("Can't embed references without a server");var i=e.server.collections[r];if(!i)throw new Error("Can't embed a non-existing collection ".concat(t));try{o[t]=i.getOne(o[n])}catch(t){}return o}}},{key:"_itemEmbedder",value:function(t){var e=this,r=(Array.isArray(t)?t:[t]).map((function(t){return t.endsWith("s")?e._oneToManyEmbedder(t):e._manyToOneEmbedder(t)}));return function(t){return r.reduce((function(t,e){return e(t)}),t)}}},{key:"getOnly",value:function(t){var e=this.obj;return t&&t.embed&&this.server&&(e=Object.assign({},e),e=this._itemEmbedder(t.embed)(e)),e}},{key:"updateOnly",value:function(t){for(var e in t)this.obj[e]=t[e];return this.obj}}])&&y(e.prototype,r),n&&y(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function g(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,o,i=[],u=!0,a=!1;try{for(r=r.call(t);!(u=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==r.return||r.return()}finally{if(a)throw o}}return i}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return m(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return m(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function j(t){if(!t)return{};var e={};return t.split("&").map((function(t){if(-1===t.indexOf("="))e[t]=!0;else{var r=g(t.split("="),2),n=r[0],o=r[1];0!==o.indexOf("[")&&0!==o.indexOf("{")||(o=JSON.parse(o)),e[n.trim()]=o}})),e}function x(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return O(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return O(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}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 i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}function O(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function w(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function A(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var S=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";w(this,t),A(this,"baseUrl",null),A(this,"loggingEnabled",!1),A(this,"defaultQuery",(function(){})),A(this,"batchUrl",null),A(this,"collections",{}),A(this,"singles",{}),A(this,"requestInterceptors",[]),A(this,"responseInterceptors",[]),this.baseUrl=e}var e,r,n;return e=t,r=[{key:"init",value:function(t){for(var e in t)Array.isArray(t[e])?this.addCollection(e,new d(t[e],"id")):this.addSingle(e,new b(t[e]))}},{key:"toggleLogging",value:function(){this.loggingEnabled=!this.loggingEnabled}},{key:"setDefaultQuery",value:function(t){this.defaultQuery=t}},{key:"setBatchUrl",value:function(t){this.batchUrl=t}},{key:"setBatch",value:function(t){console.warn("Server.setBatch() is deprecated, use Server.setBatchUrl() instead"),this.batchUrl=t}},{key:"addCollection",value:function(t,e){this.collections[t]=e,e.setServer(this),e.setName(t)}},{key:"getCollection",value:function(t){return this.collections[t]}},{key:"getCollectionNames",value:function(){return Object.keys(this.collections)}},{key:"addSingle",value:function(t,e){this.singles[t]=e,e.setServer(this),e.setName(t)}},{key:"getSingle",value:function(t){return this.singles[t]}},{key:"getSingleNames",value:function(){return Object.keys(this.singles)}},{key:"addRequestInterceptor",value:function(t){this.requestInterceptors.push(t)}},{key:"addResponseInterceptor",value:function(t){this.responseInterceptors.push(t)}},{key:"getCount",value:function(t,e){return this.collections[t].getCount(e)}},{key:"getAll",value:function(t,e){return this.collections[t].getAll(e)}},{key:"getOne",value:function(t,e,r){return this.collections[t].getOne(e,r)}},{key:"addOne",value:function(t,e){return this.collections.hasOwnProperty(t)||this.addCollection(t,new d([],"id")),this.collections[t].addOne(e)}},{key:"updateOne",value:function(t,e,r){return this.collections[t].updateOne(e,r)}},{key:"removeOne",value:function(t,e){return this.collections[t].removeOne(e)}},{key:"getOnly",value:function(t,e){return this.singles[t].getOnly()}},{key:"updateOnly",value:function(t,e){return this.singles[t].updateOnly(e)}},{key:"decode",value:function(t){if(t.queryString=decodeURIComponent(t.url.slice(t.url.indexOf("?")+1)),t.params=j(t.queryString),t.requestBody)try{t.json=JSON.parse(t.requestBody)}catch(t){}return this.requestInterceptors.reduce((function(t,e){return e(t)}),t)}},{key:"respond",value:function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:200;e||(e={}),e["Content-Type"]||(e["Content-Type"]="application/json");var o={status:n,headers:e,body:t};return o=this.responseInterceptors.reduce((function(t,e){return e(t,r)}),o),this.log(r,o),r.respond(o.status,o.headers,JSON.stringify(o.body))}},{key:"log",value:function(t,e){this.loggingEnabled&&(console.group?(console.groupCollapsed(t.method,t.url,"(FakeRest)"),console.group("request"),console.log(t.method,t.url),console.log("headers",t.requestHeaders),console.log("body ",t.requestBody),console.groupEnd(),console.group("response",e.status),console.log("headers",e.headers),console.log("body ",e.body),console.groupEnd(),console.groupEnd()):(console.log("FakeRest request ",t.method,t.url,"headers",t.requestHeaders,"body",t.requestBody),console.log("FakeRest response",e.status,"headers",e.headers,"body",e.body)))}},{key:"batch",value:function(t){var e=t.json,r=this.handle.bind(this),n=Object.keys(e).reduce((function(t,n){var o,i={url:e[n],method:"GET",params:{},respond:function(t,e,r){o={code:t,headers:Object.keys(e||{}).map((function(t){return{name:t,value:e[t]}})),body:r||{}}}};return r(i),t[n]=o||{code:404,headers:[],body:{}},t}),{});return this.respond(n,{},t,200)}},{key:"handle",value:function(t){if(t=this.decode(t),this.batchUrl&&this.batchUrl===t.url&&"POST"===t.method)return this.batch(t);var e,r=x(this.getSingleNames());try{for(r.s();!(e=r.n()).done;){var n=e.value;if(t.url.match(new RegExp("^"+this.baseUrl+"\\/("+n+")(\\/?.*)?$"))){if("GET"==t.method)try{var o=this.getOnly(n);return this.respond(o,null,t)}catch(e){return t.respond(404)}if("PUT"==t.method)try{var i=this.updateOnly(n,t.json);return this.respond(i,null,t)}catch(e){return t.respond(404)}if("PATCH"==t.method)try{var u=this.updateOnly(n,t.json);return this.respond(u,null,t)}catch(e){return t.respond(404)}}}}catch(t){r.e(t)}finally{r.f()}var a=t.url.match(new RegExp("^"+this.baseUrl+"\\/([^\\/?]+)(\\/(\\d+))?(\\?.*)?$"));if(a){var c=a[1],s=Object.assign({},this.defaultQuery(c),t.params);if(a[2]){if(!this.getCollection(c))return;var f=a[3];if("GET"==t.method)try{var l=this.getOne(c,f,s);return this.respond(l,null,t)}catch(e){return t.respond(404)}if("PUT"==t.method)try{var p=this.updateOne(c,f,t.json);return this.respond(p,null,t)}catch(e){return t.respond(404)}if("PATCH"==t.method)try{var h=this.updateOne(c,f,t.json);return this.respond(h,null,t)}catch(e){return t.respond(404)}if("DELETE"==t.method)try{var d=this.removeOne(c,f);return this.respond(d,null,t)}catch(e){return t.respond(404)}}else{if("GET"==t.method){if(!this.getCollection(c))return;var y,v,b,g=this.getCount(c,s.filter?{filter:s.filter}:{});if(g>0){y=this.getAll(c,s);var m=s.range?s.range[0]:0,j=s.range?Math.min(y.length-1+m,s.range[1]):y.length-1;v="items ".concat(m,"-").concat(j,"/").concat(g),b=y.length==g?200:206}else y=[],v="items */0",b=200;return this.respond(y,{"Content-Range":v},t,b)}if("POST"==t.method){var O=this.addOne(c,t.json),w=this.baseUrl+"/"+c+"/"+O[this.getCollection(c).identifierName];return this.respond(O,{Location:w},t,201)}}}}},{key:"getHandler",value:function(){return this.handle.bind(this)}}],r&&_(e.prototype,r),n&&_(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function E(t){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},E(t)}function k(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return C(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return C(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}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 i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}function C(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function T(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function P(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function I(t,e){return I=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},I(t,e)}function U(t){var e=function(){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(t){return!1}}();return function(){var r,n=R(t);if(e){var o=R(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return q(this,r)}}function q(t,e){if(e&&("object"===E(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function R(t){return R=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},R(t)}var N=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&I(t,e)}(i,t);var e,r,n,o=U(i);function i(){return T(this,i),o.apply(this,arguments)}return e=i,(r=[{key:"decode",value:function(t,e){var r=this,n="string"==typeof t?new Request(t,e):t;return n.queryString=decodeURIComponent(n.url.slice(n.url.indexOf("?")+1)),n.params=j(n.queryString),n.text().then((function(t){n.requestBody=t;try{n.requestJson=JSON.parse(t)}catch(t){}})).then((function(){return r.requestInterceptors.reduce((function(t,e){return e(t)}),n)}))}},{key:"respond",value:function(t,e){return t=this.responseInterceptors.reduce((function(t,r){return r(t,e)}),t),this.log(e,t),t.headers=new Headers(t.headers),t}},{key:"log",value:function(t,e){this.loggingEnabled&&(console.group?(console.groupCollapsed(t.method,t.url,"(FakeRest)"),console.group("request"),console.log(t.method,t.url),console.log("headers",t.headers),console.log("body ",t.requestBody),console.groupEnd(),console.group("response",e.status),console.log("headers",e.headers),console.log("body ",e.body),console.groupEnd(),console.groupEnd()):(console.log("FakeRest request ",t.method,t.url,"headers",t.headers,"body",t.requestBody),console.log("FakeRest response",e.status,"headers",e.headers,"body",e.body)))}},{key:"batch",value:function(t){throw new Error("not implemented")}},{key:"handle",value:function(t,e){var r=this;return this.decode(t,e).then((function(t){var e={headers:{"Content-Type":"application/json"},status:200};if(r.batchUrl&&r.batchUrl===t.url&&"POST"===t.method)return r.batch(t);var n,o=k(r.getSingleNames());try{for(o.s();!(n=o.n()).done;){var i=n.value;if(t.url.match(new RegExp("^"+r.baseUrl+"\\/("+i+")(\\/?.*)?$"))){if("GET"==t.method){try{e.body=r.getOnly(i)}catch(t){reponse.status=404}return r.respond(e,t)}if("PUT"==t.method){try{e.body=r.updateOnly(i,t.requestJson)}catch(t){reponse.status=404}return r.respond(e,t)}if("PATCH"==t.method){try{e.body=r.updateOnly(i,t.requestJson)}catch(t){reponse.status=404}return r.respond(e,t)}}}}catch(t){o.e(t)}finally{o.f()}var u,a=k(r.getCollectionNames());try{for(a.s();!(u=a.n()).done;){var c=u.value,s=t.url.match(new RegExp("^"+r.baseUrl+"\\/("+c+")(\\/(\\d+))?(\\?.*)?$"));if(s){var f=Object.assign({},r.defaultQuery(c),t.params);if(s[2]){var l=s[3];if("GET"==t.method){try{e.body=r.getOne(c,l,f)}catch(t){e.status=404}return r.respond(e,t)}if("PUT"==t.method){try{e.body=r.updateOne(c,l,t.requestJson)}catch(t){e.status=404}return r.respond(e,t)}if("PATCH"==t.method){try{e.body=r.updateOne(c,l,t.requestJson)}catch(t){e.status=404}return r.respond(e,t)}if("DELETE"==t.method){try{e.body=r.removeOne(c,l)}catch(t){e.status=404}return r.respond(e,t)}}else{if("GET"==t.method){var p=r.getCount(c,f.filter?{filter:f.filter}:{});if(p>0){var h=r.getAll(c,f),d=f.range?f.range[0]:0,y=f.range?Math.min(h.length-1+d,f.range[1]):h.length-1;e.body=h,e.headers["Content-Range"]="items ".concat(d,"-").concat(y,"/").concat(p),e.status=h.length==p?200:206}else e.body=[],e.headers["Content-Range"]="items */0";return r.respond(e,t)}if("POST"==t.method){var v=r.addOne(c,t.requestJson),b=r.baseUrl+"/"+c+"/"+v[r.getCollection(c).identifierName];return e.body=v,e.headers.Location=b,e.status=201,r.respond(e,t)}}}}}catch(t){a.e(t)}finally{a.f()}return r.respond(e,t)}))}}])&&P(e.prototype,r),n&&P(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}(S),z={Server:S,FetchServer:N,Collection:d,Single:b}}(),n}()}));
//# sourceMappingURL=FakeRest.min.js.map
{
"name": "fakerest",
"version": "3.3.0",
"version": "3.4.0",
"repository": "https://github.com/marmelab/FakeRest",

@@ -5,0 +5,0 @@ "description": "Patch XMLHttpRequest to fake a REST server based on JSON data. ",

@@ -65,3 +65,3 @@ # FakeRest [![Build Status](https://travis-ci.org/marmelab/FakeRest.svg?branch=master)](https://travis-ci.org/marmelab/FakeRest)

FakeRest will now intercept every XmlHTTPResquest to the REST server. The handled routes for collections of items are:
FakeRest will now intercept every `XmlHttpRequest` to the REST server. The handled routes for collections of items are:

@@ -142,3 +142,3 @@ ```

FakeRest uses a standard REST flavor, described below.
FakeRest defines a REST flavor, described below. It is inspired by commonly used ways how to handle aspects like filtering and sorting.

@@ -157,3 +157,3 @@ * `GET /foo` returns a JSON array. It accepts three query parameters: `filter`, `sort`, and `range`. It responds with a status 200 if there is no pagination, or 206 if the list of items is paginated. The response contains a mention of the total count in the `Content-Range` header.

The `filter` param must be a serialized object litteral describing the criteria to apply to the search query.
The `filter` param must be a serialized object literal describing the criteria to apply to the search query.

@@ -160,0 +160,0 @@ GET /books?filter={"author_id":1} // return books where author_id is equal to 1

@@ -30,2 +30,9 @@ import get from 'lodash/get';

const getSimpleFilter = (key, value) => {
if (key.indexOf('_q') !== -1) {
// text search
let realKey = key.replace(/(_q)$/, '');
let regex = new RegExp(value, 'i');
return (item) => get(item, realKey)?.match(regex) !== null;
}
if (key.indexOf('_lte') !== -1) {

@@ -96,10 +103,22 @@ // less than or equal

if (key === 'q') {
let regex = new RegExp(filter.q, 'i');
// full-text filter
return item => {
let regex = new RegExp(filter.q, "i");
const filterWithQuery = (item) => {
for (let itemKey in item) {
if (item[itemKey] && item[itemKey].match && item[itemKey].match(regex) !== null) return true;
if (typeof item[itemKey] === "object") {
if (filterWithQuery(item[itemKey])) {
return true;
}
}
if (
item[itemKey] &&
item[itemKey].match &&
item[itemKey].match(regex) !== null
)
return true;
}
return false;
};
// full-text filter
return filterWithQuery;
}

@@ -173,2 +192,7 @@

export class Collection {
sequence = 0;
items = [];
server = null;
name = null;
identifierName = 'id';

@@ -179,7 +203,3 @@ constructor(items=[], identifierName='id') {

}
this.sequence = 0; // id of the next item
this.identifierName = identifierName;
this.items = [];
this.server = null;
this.name = null;
items.map(this.addOne.bind(this));

@@ -210,5 +230,11 @@ }

_oneToManyEmbedder(resourceName) {
if (this.name == null) {
throw new Error('Can\'t embed references without a collection name');
}
const singularResourceName = this.name.slice(0,-1);
const referenceName = singularResourceName + '_id';
return (item) => {
if (this.server == null) {
throw new Error('Can\'t embed references without a server');
}
const otherCollection = this.server.collections[resourceName];

@@ -244,2 +270,5 @@ if (!otherCollection) throw new Error(`Can't embed a non-existing collection ${resourceName}`);

return (item) => {
if (this.server == null) {
throw new Error('Can\'t embed references without a server');
}
const otherCollection = this.server.collections[pluralResourceName];

@@ -246,0 +275,0 @@ if (!otherCollection) throw new Error(`Can't embed a non-existing collection ${resourceName}`);

@@ -335,2 +335,3 @@ import expect from "expect";

{ a: "foo", b: "bar" },
{ a: { b: "bar" } },
{ a: "", b: "" },

@@ -346,2 +347,3 @@ { a: null, b: null },

{ id: 2, a: "foo", b: "bar" },
{ id: 3, a: { b: "bar" } },
]);

@@ -378,2 +380,12 @@ });

it("should filter by text search using _q", () => {
const collection = new Collection([{ v: 'abCd' }, { v: 'cDef' }, { v: 'EFgh' }]);
expect(collection.getAll({ filter: { v_q: 'cd' } })).toEqual([
{ id: 0, v: 'abCd' }, { id: 1, v: 'cDef' }
]);
expect(collection.getAll({ filter: { v_q: 'ef' } })).toEqual([
{ id: 1, v: 'cDef' }, { id: 2, v: 'EFgh' }
]);
});
it("should filter by array", () => {

@@ -380,0 +392,0 @@ const collection = new Collection([

@@ -1,348 +0,403 @@

import { Collection } from './Collection';
import { Single } from './Single';
import { parseQueryString } from './parseQueryString';
import { Collection } from "./Collection";
import { Single } from "./Single";
import { parseQueryString } from "./parseQueryString";
export class Server {
constructor(baseUrl='') {
this.baseUrl = baseUrl;
this.loggingEnabled = false;
this.defaultQuery = () => {};
this.batchUrl = null;
this.collections = {};
this.singles = {};
this.requestInterceptors = [];
this.responseInterceptors = [];
}
baseUrl = null;
loggingEnabled = false;
defaultQuery = () => {};
batchUrl = null;
collections = {};
singles = {};
requestInterceptors = [];
responseInterceptors = [];
/**
* Shortcut for adding several collections if identifierName is always 'id'
*/
init(data) {
for (let name in data) {
if (Array.isArray(data[name])) {
this.addCollection(name, new Collection(data[name], 'id'));
} else {
this.addSingle(name, new Single(data[name]));
}
}
}
constructor(baseUrl = "") {
this.baseUrl = baseUrl;
}
toggleLogging() {
this.loggingEnabled = !this.loggingEnabled;
/**
* Shortcut for adding several collections if identifierName is always 'id'
*/
init(data) {
for (let name in data) {
if (Array.isArray(data[name])) {
this.addCollection(name, new Collection(data[name], "id"));
} else {
this.addSingle(name, new Single(data[name]));
}
}
}
/**
* @param Function ResourceName => object
*/
setDefaultQuery(query) {
this.defaultQuery = query;
}
toggleLogging() {
this.loggingEnabled = !this.loggingEnabled;
}
setBatchUrl(batchUrl) {
this.batchUrl = batchUrl;
}
/**
* @param Function ResourceName => object
*/
setDefaultQuery(query) {
this.defaultQuery = query;
}
/**
* @deprecated use setBatchUrl instead
*/
setBatch(url) {
console.warn('Server.setBatch() is deprecated, use Server.setBatchUrl() instead');
this.batchUrl = url;
}
setBatchUrl(batchUrl) {
this.batchUrl = batchUrl;
}
addCollection(name, collection) {
this.collections[name] = collection;
collection.setServer(this);
collection.setName(name);
}
/**
* @deprecated use setBatchUrl instead
*/
setBatch(url) {
console.warn(
"Server.setBatch() is deprecated, use Server.setBatchUrl() instead"
);
this.batchUrl = url;
}
getCollection(name) {
return this.collections[name];
}
addCollection(name, collection) {
this.collections[name] = collection;
collection.setServer(this);
collection.setName(name);
}
getCollectionNames() {
return Object.keys(this.collections);
}
getCollection(name) {
return this.collections[name];
}
addSingle(name, single) {
this.singles[name] = single;
single.setServer(this);
single.setName(name);
}
getCollectionNames() {
return Object.keys(this.collections);
}
getSingle(name) {
return this.singles[name];
}
addSingle(name, single) {
this.singles[name] = single;
single.setServer(this);
single.setName(name);
}
getSingleNames() {
return Object.keys(this.singles);
}
getSingle(name) {
return this.singles[name];
}
addRequestInterceptor(interceptor) {
this.requestInterceptors.push(interceptor);
}
getSingleNames() {
return Object.keys(this.singles);
}
addResponseInterceptor(interceptor) {
this.responseInterceptors.push(interceptor);
}
addRequestInterceptor(interceptor) {
this.requestInterceptors.push(interceptor);
}
/**
* @param {string} name
* @param {string} params As decoded from the query string, e.g. { sort: "name", filter: {enabled:true}, slice: [10, 20] }
*/
getCount(name, params) {
return this.collections[name].getCount(params);
}
addResponseInterceptor(interceptor) {
this.responseInterceptors.push(interceptor);
}
/**
* @param {string} name
* @param {string} params As decoded from the query string, e.g. { sort: "name", filter: {enabled:true}, slice: [10, 20] }
*/
getAll(name, params) {
return this.collections[name].getAll(params);
}
/**
* @param {string} name
* @param {string} params As decoded from the query string, e.g. { sort: "name", filter: {enabled:true}, slice: [10, 20] }
*/
getCount(name, params) {
return this.collections[name].getCount(params);
}
getOne(name, identifier, params) {
return this.collections[name].getOne(identifier, params);
}
/**
* @param {string} name
* @param {string} params As decoded from the query string, e.g. { sort: "name", filter: {enabled:true}, slice: [10, 20] }
*/
getAll(name, params) {
return this.collections[name].getAll(params);
}
addOne(name, item) {
if (!this.collections.hasOwnProperty(name)) {
this.addCollection(name, new Collection([], 'id'));
}
return this.collections[name].addOne(item);
}
getOne(name, identifier, params) {
return this.collections[name].getOne(identifier, params);
}
updateOne(name, identifier, item) {
return this.collections[name].updateOne(identifier, item);
addOne(name, item) {
if (!this.collections.hasOwnProperty(name)) {
this.addCollection(name, new Collection([], "id"));
}
return this.collections[name].addOne(item);
}
removeOne(name, identifier) {
return this.collections[name].removeOne(identifier);
}
updateOne(name, identifier, item) {
return this.collections[name].updateOne(identifier, item);
}
getOnly(name, params) {
return this.singles[name].getOnly();
}
removeOne(name, identifier) {
return this.collections[name].removeOne(identifier);
}
updateOnly(name, item) {
return this.singles[name].updateOnly(item);
}
getOnly(name, params) {
return this.singles[name].getOnly();
}
updateOnly(name, item) {
return this.singles[name].updateOnly(item);
}
decode(request) {
request.queryString = decodeURIComponent(request.url.slice(request.url.indexOf('?') + 1));
request.params = parseQueryString(request.queryString);
if (request.requestBody) {
try {
request.json = JSON.parse(request.requestBody);
} catch(error) {
// body isn't JSON, skipping
}
}
return this.requestInterceptors.reduce(function(previous, current) {
return current(previous);
}, request);
decode(request) {
request.queryString = decodeURIComponent(
request.url.slice(request.url.indexOf("?") + 1)
);
request.params = parseQueryString(request.queryString);
if (request.requestBody) {
try {
request.json = JSON.parse(request.requestBody);
} catch (error) {
// body isn't JSON, skipping
}
}
return this.requestInterceptors.reduce(function (previous, current) {
return current(previous);
}, request);
}
respond(body, headers, request, status=200) {
if (!headers) {
headers = {};
}
if (!headers['Content-Type']) {
headers['Content-Type'] = 'application/json';
}
let response = { status: status, headers: headers, body: body };
response = this.responseInterceptors.reduce(function(previous, current) {
return current(previous, request);
}, response);
this.log(request, response);
return request.respond(response.status, response.headers, JSON.stringify(response.body));
respond(body, headers, request, status = 200) {
if (!headers) {
headers = {};
}
if (!headers["Content-Type"]) {
headers["Content-Type"] = "application/json";
}
let response = { status: status, headers: headers, body: body };
response = this.responseInterceptors.reduce(function (previous, current) {
return current(previous, request);
}, response);
this.log(request, response);
log(request, response) {
if (!this.loggingEnabled) return;
if (console.group) {
// Better logging in Chrome
console.groupCollapsed(request.method, request.url, '(FakeRest)');
console.group('request');
console.log(request.method, request.url);
console.log('headers', request.requestHeaders);
console.log('body ', request.requestBody);
console.groupEnd();
console.group('response', response.status);
console.log('headers', response.headers);
console.log('body ', response.body);
console.groupEnd();
console.groupEnd();
} else {
console.log('FakeRest request ', request.method, request.url, 'headers', request.requestHeaders, 'body', request.requestBody);
console.log('FakeRest response', response.status, 'headers', response.headers, 'body', response.body);
}
return request.respond(
response.status,
response.headers,
JSON.stringify(response.body)
);
}
log(request, response) {
if (!this.loggingEnabled) return;
if (console.group) {
// Better logging in Chrome
console.groupCollapsed(request.method, request.url, "(FakeRest)");
console.group("request");
console.log(request.method, request.url);
console.log("headers", request.requestHeaders);
console.log("body ", request.requestBody);
console.groupEnd();
console.group("response", response.status);
console.log("headers", response.headers);
console.log("body ", response.body);
console.groupEnd();
console.groupEnd();
} else {
console.log(
"FakeRest request ",
request.method,
request.url,
"headers",
request.requestHeaders,
"body",
request.requestBody
);
console.log(
"FakeRest response",
response.status,
"headers",
response.headers,
"body",
response.body
);
}
}
batch(request) {
batch(request) {
var json = request.json;
var handle = this.handle.bind(this);
var json = request.json;
var handle = this.handle.bind(this);
var jsonResponse = Object.keys(json).reduce(function (
jsonResponse,
requestName
) {
var subResponse;
var sub = {
url: json[requestName],
method: "GET",
params: {},
respond: function (code, headers, body) {
subResponse = {
code: code,
headers: Object.keys(headers || {}).map(function (headerName) {
return {
name: headerName,
value: headers[headerName],
};
}),
body: body || {},
};
},
};
handle(sub);
var jsonResponse = Object.keys(json).reduce(function (jsonResponse, requestName) {
var subResponse;
var sub = {
url: json[requestName],
method: 'GET',
params: {},
respond: function (code, headers, body) {
subResponse = {
code: code,
headers: Object.keys(headers || {}).map(function (headerName) {
return {
'name': headerName,
'value': headers[headerName]
};
}),
body: body || {}
};
}
};
handle(sub);
jsonResponse[requestName] = subResponse || {
code: 404,
headers: [],
body: {},
};
jsonResponse[requestName] = subResponse || {
code: 404,
headers: [],
body: {}
};
return jsonResponse;
},
{});
return jsonResponse;
}, {});
return this.respond(jsonResponse, {}, request, 200);
}
return this.respond(jsonResponse, {}, request, 200);
/**
* @param {FakeXMLHttpRequest} request
*
* String request.url The URL set on the request object.
* String request.method The request method as a string.
* Object request.requestHeaders An object of all request headers, i.e.:
* {
* "Accept": "text/html",
* "Connection": "keep-alive"
* }
* String request.requestBody The request body
* String request.username Username, if any.
* String request.password Password, if any.
*/
handle(request) {
request = this.decode(request);
if (
this.batchUrl &&
this.batchUrl === request.url &&
request.method === "POST"
) {
return this.batch(request);
}
/**
* @param {FakeXMLHttpRequest} request
*
* String request.url The URL set on the request object.
* String request.method The request method as a string.
* Object request.requestHeaders An object of all request headers, i.e.:
* {
* "Accept": "text/html",
* "Connection": "keep-alive"
* }
* String request.requestBody The request body
* String request.username Username, if any.
* String request.password Password, if any.
*/
handle(request) {
request = this.decode(request);
// Handle Single Objects
for (let name of this.getSingleNames()) {
let matches = request.url.match(
new RegExp("^" + this.baseUrl + "\\/(" + name + ")(\\/?.*)?$")
);
if (!matches) continue;
if (this.batchUrl && this.batchUrl === request.url && request.method === 'POST') {
return this.batch(request);
if (request.method == "GET") {
try {
let item = this.getOnly(name);
return this.respond(item, null, request);
} catch (error) {
return request.respond(404);
}
}
if (request.method == "PUT") {
try {
let item = this.updateOnly(name, request.json);
return this.respond(item, null, request);
} catch (error) {
return request.respond(404);
}
}
if (request.method == "PATCH") {
try {
let item = this.updateOnly(name, request.json);
return this.respond(item, null, request);
} catch (error) {
return request.respond(404);
}
}
}
// Handle Single Objects
for (let name of this.getSingleNames()) {
let matches = request.url.match(new RegExp('^' + this.baseUrl + '\\/(' + name + ')(\\/?.*)?$' ));
if (!matches) continue;
if (request.method == 'GET') {
try {
let item = this.getOnly(name);
return this.respond(item, null, request);
} catch (error) {
return request.respond(404);
}
}
if (request.method == 'PUT') {
try {
let item = this.updateOnly(name, request.json);
return this.respond(item, null, request);
} catch (error) {
return request.respond(404);
}
}
if (request.method == 'PATCH') {
try {
let item = this.updateOnly(name, request.json);
return this.respond(item, null, request);
} catch (error) {
return request.respond(404);
}
}
// Handle collections
let matches = request.url.match(
new RegExp("^" + this.baseUrl + "\\/([^\\/?]+)(\\/(\\d+))?(\\?.*)?$")
);
if (!matches) return;
let name = matches[1];
let params = Object.assign({}, this.defaultQuery(name), request.params);
if (!matches[2]) {
if (request.method == "GET") {
if (!this.getCollection(name)) {
return;
}
// Handle collections
let matches = request.url.match(new RegExp('^' + this.baseUrl + '\\/([^\\/?]+)(\\/(\\d+))?(\\?.*)?$' ));
if (!matches) return;
let name = matches[1];
let params = Object.assign({}, this.defaultQuery(name), request.params);
if (!matches[2]) {
if (request.method == 'GET') {
if (!this.getCollection(name)) {
return;
}
let count = this.getCount(name, params.filter ? { filter: params.filter } : {});
let items, contentRange, status;
if (count > 0) {
items = this.getAll(name, params);
let first = params.range ? params.range[0] : 0;
let last = params.range ? Math.min(items.length - 1 + first, params.range[1]) : (items.length - 1);
contentRange = `items ${first}-${last}/${count}`;
status = (items.length == count) ? 200 : 206;
} else {
items = [];
contentRange = 'items */0';
status = 200;
}
return this.respond(items, { 'Content-Range': contentRange }, request, status);
}
if (request.method == 'POST') {
let newResource = this.addOne(name, request.json);
let newResourceURI = this.baseUrl + '/' + name + '/' + newResource[this.getCollection(name).identifierName];
return this.respond(newResource, { Location: newResourceURI }, request, 201);
}
let count = this.getCount(
name,
params.filter ? { filter: params.filter } : {}
);
let items, contentRange, status;
if (count > 0) {
items = this.getAll(name, params);
let first = params.range ? params.range[0] : 0;
let last = params.range
? Math.min(items.length - 1 + first, params.range[1])
: items.length - 1;
contentRange = `items ${first}-${last}/${count}`;
status = items.length == count ? 200 : 206;
} else {
if (!this.getCollection(name)) {
return;
}
let id = matches[3];
if (request.method == 'GET') {
try {
let item = this.getOne(name, id, params);
return this.respond(item, null, request);
} catch (error) {
return request.respond(404);
}
}
if (request.method == 'PUT') {
try {
let item = this.updateOne(name, id, request.json);
return this.respond(item, null, request);
} catch (error) {
return request.respond(404);
}
}
if (request.method == 'PATCH') {
try {
let item = this.updateOne(name, id, request.json);
return this.respond(item, null, request);
} catch (error) {
return request.respond(404);
}
}
if (request.method == 'DELETE') {
try {
let item = this.removeOne(name, id);
return this.respond(item, null, request);
} catch (error) {
return request.respond(404);
}
}
items = [];
contentRange = "items */0";
status = 200;
}
return this.respond(
items,
{ "Content-Range": contentRange },
request,
status
);
}
if (request.method == "POST") {
let newResource = this.addOne(name, request.json);
let newResourceURI =
this.baseUrl +
"/" +
name +
"/" +
newResource[this.getCollection(name).identifierName];
return this.respond(
newResource,
{ Location: newResourceURI },
request,
201
);
}
} else {
if (!this.getCollection(name)) {
return;
}
let id = matches[3];
if (request.method == "GET") {
try {
let item = this.getOne(name, id, params);
return this.respond(item, null, request);
} catch (error) {
return request.respond(404);
}
}
if (request.method == "PUT") {
try {
let item = this.updateOne(name, id, request.json);
return this.respond(item, null, request);
} catch (error) {
return request.respond(404);
}
}
if (request.method == "PATCH") {
try {
let item = this.updateOne(name, id, request.json);
return this.respond(item, null, request);
} catch (error) {
return request.respond(404);
}
}
if (request.method == "DELETE") {
try {
let item = this.removeOne(name, id);
return this.respond(item, null, request);
} catch (error) {
return request.respond(404);
}
}
}
}
getHandler() {
return this.handle.bind(this);
}
getHandler() {
return this.handle.bind(this);
}
}
export class Single {
constructor(obj) {
if (!(obj instanceof Object)) {
throw new Error('Can\'t initialize a Single with anything except an object');
}
this.obj = obj;
this.server = null;
this.name = null;
}
obj = null;
server = null;
name = null;
/**
* A Single may need to access other collections (e.g. for embedded
* references) This is done through a reference to the parent server.
*/
setServer(server) {
this.server = server;
constructor(obj) {
if (!(obj instanceof Object)) {
throw new Error(
"Can't initialize a Single with anything except an object"
);
}
this.obj = obj;
}
setName(name) {
this.name = name;
}
/**
* A Single may need to access other collections (e.g. for embedded
* references) This is done through a reference to the parent server.
*/
setServer(server) {
this.server = server;
}
// No need to embed Singles, since they are by their nature top-level
// No need to worry about remote references, (i.e. mysingleton_id=1) since
// it is by definition a singleton
_oneToManyEmbedder(resourceName) {
return (item) => {
const otherCollection = this.server.collections[resourceName];
if (!otherCollection) throw new Error(`Can't embed a non-existing collection ${resourceName}`);
// We have an array of ids {posts: [1,2]} (back refs are not valid
// for singleton)
item[resourceName] = otherCollection.getAll({
filter: i => item[resourceName].indexOf(i[otherCollection.identifierName]) !== -1
});
return item;
};
}
setName(name) {
this.name = name;
}
_manyToOneEmbedder(resourceName) {
const pluralResourceName = resourceName + 's';
const referenceName = resourceName + '_id';
return (item) => {
const otherCollection = this.server.collections[pluralResourceName];
if (!otherCollection) throw new Error(`Can't embed a non-existing collection ${resourceName}`);
try {
item[resourceName] = otherCollection.getOne(item[referenceName]);
} catch (e) {
// Resource doesn't exist, so don't embed
}
return item;
};
}
// No need to embed Singles, since they are by their nature top-level
// No need to worry about remote references, (i.e. mysingleton_id=1) since
// it is by definition a singleton
_oneToManyEmbedder(resourceName) {
return (item) => {
if (this.server == null) {
throw new Error("Can't embed references without a server");
}
const otherCollection = this.server.collections[resourceName];
if (!otherCollection)
throw new Error(
`Can't embed a non-existing collection ${resourceName}`
);
// We have an array of ids {posts: [1,2]} (back refs are not valid
// for singleton)
item[resourceName] = otherCollection.getAll({
filter: (i) =>
item[resourceName].indexOf(i[otherCollection.identifierName]) !== -1,
});
return item;
};
}
_itemEmbedder(embed) {
const resourceNames = Array.isArray(embed) ? embed : [embed];
const resourceEmbedders = resourceNames.map(resourceName =>
resourceName.endsWith('s') ? this._oneToManyEmbedder(resourceName) : this._manyToOneEmbedder(resourceName)
_manyToOneEmbedder(resourceName) {
const pluralResourceName = resourceName + "s";
const referenceName = resourceName + "_id";
return (item) => {
if (this.server == null) {
throw new Error("Can't embed references without a server");
}
const otherCollection = this.server.collections[pluralResourceName];
if (!otherCollection)
throw new Error(
`Can't embed a non-existing collection ${resourceName}`
);
return item => resourceEmbedders.reduce((itemWithEmbeds, embedder) => embedder(itemWithEmbeds), item);
}
try {
item[resourceName] = otherCollection.getOne(item[referenceName]);
} catch (e) {
// Resource doesn't exist, so don't embed
}
return item;
};
}
getOnly(query) {
let item = this.obj;
if (query && query.embed && this.server) {
item = Object.assign({}, item); // Clone
item = this._itemEmbedder(query.embed)(item);
}
return item;
_itemEmbedder(embed) {
const resourceNames = Array.isArray(embed) ? embed : [embed];
const resourceEmbedders = resourceNames.map((resourceName) =>
resourceName.endsWith("s")
? this._oneToManyEmbedder(resourceName)
: this._manyToOneEmbedder(resourceName)
);
return (item) =>
resourceEmbedders.reduce(
(itemWithEmbeds, embedder) => embedder(itemWithEmbeds),
item
);
}
getOnly(query) {
let item = this.obj;
if (query && query.embed && this.server) {
item = Object.assign({}, item); // Clone
item = this._itemEmbedder(query.embed)(item);
}
return item;
}
updateOnly(item) {
for (let key in item) {
this.obj[key] = item[key];
}
return this.obj;
updateOnly(item) {
for (let key in item) {
this.obj[key] = item[key];
}
return this.obj;
}
}

@@ -1,36 +0,40 @@

const path = require('path');
const path = require("path");
const TerserPlugin = require("terser-webpack-plugin");
module.exports = {
mode: 'development',
entry: {
FakeRest: './src/FakeRest.js',
"FakeRest.min": './src/FakeRest.js'
mode: "development",
entry: {
FakeRest: "./src/FakeRest.js",
"FakeRest.min": "./src/FakeRest.js",
},
devtool: "source-map",
resolve: {
modules: ["node_modules", path.join(__dirname, "src")],
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader",
},
],
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
include: /\.min\.js$/,
}),
],
},
output: {
path: path.resolve(__dirname, "./dist"),
filename: "[name].js",
globalObject: 'this',
library: {
name: "FakeRest",
type: "umd",
},
devtool: "source-map",
resolve:{
modules: [
'node_modules',
path.join(__dirname, "src")
]
},
module: {
rules: [{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
}]
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin({
include: /\.min\.js$/
})]
},
output: {
path: path.resolve(__dirname, './dist'),
filename: '[name].js',
library: 'FakeRest',
libraryTarget: 'umd'
}
},
};

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc