Comparing version 1.1.0 to 1.1.1
@@ -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()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";var n=r(3)["default"];Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=n(o),u=r(2),c=n(u);e["default"]={Server:i["default"],Collection:c["default"]},t.exports=e["default"]},function(t,e,r){"use strict";function n(t){if(!t)return{};var e={},r=t.split("&");return r.map(function(t){if(-1===t.indexOf("="))e[t]=!0;else{var r=t.split("="),n=u(r,2),o=n[0],i=n[1];(0===i.indexOf("[")||0===i.indexOf("{"))&&(i=JSON.parse(i)),e[o.trim()]=i}}),e}var o=r(4)["default"],i=r(5)["default"],u=r(6)["default"],c=r(7)["default"],a=r(8)["default"],s=r(3)["default"];Object.defineProperty(e,"__esModule",{value:!0});var f=r(9),l=s(f),p=r(2),d=s(p),h=l["default"].getPolyfill(),y=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?"":arguments[0];i(this,t),this.baseUrl=e,this.loggingEnabled=!1,this.defaultQuery=function(){},this.batchUrl=null,this.collections={},this.requestInterceptors=[],this.responseInterceptors=[]}return o(t,[{key:"init",value:function(t){for(var e in t)this.addCollection(e,new d["default"](t[e],"id"))}},{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 c(this.collections)}},{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[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:"decode",value:function(t){if(t.queryString=decodeURIComponent(t.url.slice(t.url.indexOf("?")+1)),t.params=n(t.queryString),t.requestBody)try{t.json=JSON.parse(t.requestBody)}catch(e){}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]?200:arguments[3];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=c(e).reduce(function(t,n){var o,i={url:e[n],method:"GET",params:{},respond:function(t,e,r){o={code:t,headers:c(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=!0,r=!1,n=void 0;try{for(var o,i=a(this.getCollectionNames());!(e=(o=i.next()).done);e=!0){var u=o.value,c=t.url.match(new RegExp("^"+this.baseUrl+"\\/("+u+")(\\/(\\d+))?(\\?.*)?$"));if(c){var s=h({},this.defaultQuery(u),t.params);if(c[2]){var f=c[3];if("GET"==t.method)try{var l=this.getOne(u,f,s);return this.respond(l,null,t)}catch(p){return t.respond(404)}if("PUT"==t.method)try{var l=this.updateOne(u,f,t.json);return this.respond(l,null,t)}catch(p){return t.respond(404)}if("PATCH"==t.method)try{var l=this.updateOne(u,f,t.json);return this.respond(l,null,t)}catch(p){return t.respond(404)}if("DELETE"==t.method)try{var l=this.removeOne(u,f);return this.respond(l,null,t)}catch(p){return t.respond(404)}}else{if("GET"==t.method){var d={};for(var y in s)"range"!==y&&(d[y]=s[y]);var v=this.getCount(u,d),g=void 0,b=void 0,m=void 0;if(v>0){g=this.getAll(u,s);var O=s.range?s.range[0]:0,j=s.range?Math.min(g.length-1+O,s.range[1]):g.length-1;b="items "+O+"-"+j+"/"+v,m=g.length==v?200:206}else g=[],b="items */0",m=200;return this.respond(g,{"Content-Range":b},t,m)}if("POST"==t.method){var w=this.addOne(u,t.json),x=this.baseUrl+"/"+u+"/"+w[this.getCollection(u).identifierName];return this.respond(w,{Location:x},t,201)}}}}}catch(S){r=!0,n=S}finally{try{!e&&i["return"]&&i["return"]()}finally{if(r)throw n}}}},{key:"getHandler",value:function(){return this.handle.bind(this)}}]),t}();e["default"]=y,t.exports=e["default"]},function(t,e,r){"use strict";function n(t,e){if("function"==typeof e)return t.filter(e);if(e instanceof Object){var r=a(e).map(function(t){if("q"===t){var r=function(){var t=new RegExp(e.q,"i");return{v:function(e){for(var r in e)if(e[r]&&e[r].match&&null!==e[r].match(t))return!0;return!1}}}();if("object"==typeof r)return r.v}var n=e[t];if(-1!==t.indexOf("_lte")){var o=function(){var e=t.replace(/(_lte)$/,"");return{v:function(t){return t[e]<=n}}}();if("object"==typeof o)return o.v}if(-1!==t.indexOf("_gte")){var i=function(){var e=t.replace(/(_gte)$/,"");return{v:function(t){return t[e]>=n}}}();if("object"==typeof i)return i.v}if(-1!==t.indexOf("_lt")){var u=function(){var e=t.replace(/(_lt)$/,"");return{v:function(t){return t[e]<n}}}();if("object"==typeof u)return u.v}if(-1!==t.indexOf("_gt")){var c=function(){var e=t.replace(/(_gt)$/,"");return{v:function(t){return t[e]>n}}}();if("object"==typeof c)return c.v}return Array.isArray(n)?function(e){return n.filter(function(r){return r==e[t]}).length>0}:function(e){return Array.isArray(e[t])&&"string"==typeof n?-1!==e[t].indexOf(n):"boolean"==typeof e[t]&&"string"==typeof n?e[t]==("true"===n?!0:!1):e[t]==n}});return t.filter(function(t){return r.reduce(function(e,r){return e&&r(t)},!0)})}throw new Error("Unsupported filter type")}function o(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=function(){var r=e[0],n="asc"==e[1].toLowerCase()?1:-1;return{v:t.sort(function(t,e){return t[r]>e[r]?n:t[r]<e[r]?-1*n:0})}}();if("object"==typeof r)return r.v}throw new Error("Unsupported sort type")}function i(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")}var u=r(4)["default"],c=r(5)["default"],a=r(7)["default"];Object.defineProperty(e,"__esModule",{value:!0}),r(10),r(13);var s=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],r=arguments.length<=1||void 0===arguments[1]?"id":arguments[1];if(c(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))}return u(t,[{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),n=r+"_id";return function(r){var o=e.server.collections[t];if(!o)throw new Error("Can't embed a non-existing collection "+t);return r[t]=o.getAll(Array.isArray(r[t])?{filter:function(e){return-1!==r[t].indexOf(e[o.identifierName])}}:{filter:function(t){return t[n]==r[e.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 "+t);try{o[t]=i.getOne(o[n])}catch(u){}return o}}},{key:"_itemEmbedder",value:function(t){var e=this,r=Array.isArray(t)?t:[t],n=r.map(function(t){return t.endsWith("s")?e._oneToManyEmbedder(t):e._manyToOneEmbedder(t)});return function(t){return n.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,r=this.items.map(function(t){return t});return t&&(t.filter&&(r=n(r,t.filter)),t.sort&&(r=o(r,t.sort)),t.range&&(r=i(r,t.range)),t.embed&&this.server&&(r=r.map(function(r){return e._itemEmbedder(t.embed)(r)}))),r}},{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 "+t);var n=this.items[r];return 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 "+e+" already exists");this.sequence=Math.max(this.sequence,e)+1}else t[this.identifierName]=this.sequence++;return this.items.push(t),t}},{key:"updateOne",value:function(t,e){var r=this.getIndex(t);if(-1===r)throw new Error("No item with identifier "+t);for(var n in e)this.items[r][n]=e[n];return this.items[r]}},{key:"removeOne",value:function(t){var e=this.getIndex(t);if(-1===e)throw new Error("No item with identifier "+t);var r=this.items[e];return this.items.splice(e,1),t==this.sequence-1&&this.sequence--,r}}]),t}();e["default"]=s,t.exports=e["default"]},function(t,e){"use strict";e["default"]=function(t){return t&&t.__esModule?t:{"default":t}},e.__esModule=!0},function(t,e,r){"use strict";var n=r(11)["default"];e["default"]=function(){function t(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),n(t,o.key,o)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),e.__esModule=!0},function(t,e){"use strict";e["default"]=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},e.__esModule=!0},function(t,e,r){"use strict";var n=r(8)["default"],o=r(12)["default"];e["default"]=function(){function t(t,e){var r=[],o=!0,i=!1,u=void 0;try{for(var c,a=n(t);!(o=(c=a.next()).done)&&(r.push(c.value),!e||r.length!==e);o=!0);}catch(s){i=!0,u=s}finally{try{!o&&a["return"]&&a["return"]()}finally{if(i)throw u}}return r}return function(e,r){if(Array.isArray(e))return e;if(o(Object(e)))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),e.__esModule=!0},function(t,e,r){t.exports={"default":r(18),__esModule:!0}},function(t,e,r){t.exports={"default":r(17),__esModule:!0}},function(t,e,r){"use strict";var n=r(21),o=r(14),i=r(15),u=r(16);n(o,{implementation:o,getPolyfill:i,shim:u}),t.exports=o},function(){!function(){if(!Array.prototype.findIndex){var t=function(t){var e=Object(this),r=Math.max(0,e.length)>>>0;if(0===r)return-1;if("function"!=typeof t||"[object Function]"!==Object.prototype.toString.call(t))throw new TypeError("Array#findIndex: predicate must be a function");for(var n=arguments.length>1?arguments[1]:void 0,o=0;r>o;o++)if(t.call(n,e[o],o,e))return o;return-1};if(Object.defineProperty)try{Object.defineProperty(Array.prototype,"findIndex",{value:t,configurable:!0,writable:!0})}catch(e){}Array.prototype.findIndex||(Array.prototype.findIndex=t)}}(this)},function(t,e,r){t.exports={"default":r(19),__esModule:!0}},function(t,e,r){t.exports={"default":r(20),__esModule:!0}},function(){/*! http://mths.be/endswith v0.2.0 by @mathias */ | ||
String.prototype.endsWith||!function(){"use strict";var t=function(){try{var t={},e=Object.defineProperty,r=e(t,t,t)&&e}catch(n){}return r}(),e={}.toString,r=function(t){if(null==this)throw TypeError();var r=String(this);if(t&&"[object RegExp]"==e.call(t))throw TypeError();var n=r.length,o=String(t),i=o.length,u=n;if(arguments.length>1){var c=arguments[1];void 0!==c&&(u=c?Number(c):0,u!=u&&(u=0))}var a=Math.min(Math.max(u,0),n),s=a-i;if(0>s)return!1;for(var f=-1;++f<i;)if(r.charCodeAt(s+f)!=o.charCodeAt(f))return!1;return!0};t?t(String.prototype,"endsWith",{value:r,configurable:!0,writable:!0}):String.prototype.endsWith=r}()},function(t,e,r){"use strict";var n=r(23),o=r(24),i=function(t){return"undefined"!=typeof t&&null!==t},u=r(22)(),c=Object,a=o.call(Function.call,Array.prototype.push),s=o.call(Function.call,Object.prototype.propertyIsEnumerable);t.exports=function(t){if(!i(t))throw new TypeError("target must be an object");var e,r,o,f,l,p=c(t);for(e=1;e<arguments.length;++e){if(r=c(arguments[e]),f=n(r),u&&Object.getOwnPropertySymbols)for(l=Object.getOwnPropertySymbols(r),o=0;o<l.length;++o)s(r,l[o])&&a(f,l[o]);for(o=0;o<f.length;++o)p[f[o]]=r[f[o]]}return p}},function(t,e,r){"use strict";var n=r(14),o=function(){if(!Object.assign||!Object.preventExtensions)return!1;var t=Object.preventExtensions({1:2});try{Object.assign(t,"xy")}catch(e){return"y"===t[1]}};t.exports=function(){return!Object.assign||o()?n:Object.assign}},function(t,e,r){"use strict";var n=r(21),o=r(15);t.exports=function(){var t=o();return Object.assign!==t&&n(Object,{assign:t}),t}},function(t,e,r){r(27),r(28),r(29),t.exports=r(26).core.getIterator},function(t,e,r){r(25),t.exports=r(26).core.Object.keys},function(t,e,r){var n=r(26);t.exports=function(t,e,r){return n.setDesc(t,e,r)}},function(t,e,r){r(27),r(28),r(29),t.exports=r(26).core.isIterable},function(t,e,r){"use strict";var n=r(23),o=r(30),i="function"==typeof Symbol&&"symbol"==typeof Symbol(),u=Object.prototype.toString,c=function(t){return"function"==typeof t&&"[object Function]"===u.call(t)},a=function(){var t={};try{Object.defineProperty(t,"x",{value:t,enumerable:!1});for(var e in t)return!1;return t.x===t}catch(r){return!1}},s=Object.defineProperty&&a(),f=function(t,e,r,n){(!(e in t)||c(n)&&n())&&(s?Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:!0,value:r}):t[e]=r)},l=function(t,e){var r=arguments.length>2?arguments[2]:{},u=n(e);i&&(u=u.concat(Object.getOwnPropertySymbols(e))),o(u,function(n){f(t,n,e[n],r[n])})};l.supportsDescriptors=!!s,t.exports=l},function(t,e,r){"use strict";var n=r(23);t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test");if("string"==typeof e)return!1;if(e instanceof Symbol)return!1;t[e]=42;for(e in t)return!1;if(0!==n(t).length)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var r=Object.getOwnPropertySymbols(t);if(1!==r.length||r[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(t,e);if(42!==o.value||o.enumerable!==!0)return!1}return!0}},function(t,e,r){"use strict";var n=Object.prototype.hasOwnProperty,o=Object.prototype.toString,i=Array.prototype.slice,u=r(31),c=!{toString:null}.propertyIsEnumerable("toString"),a=function(){}.propertyIsEnumerable("prototype"),s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],f=function(t){var e=t.constructor;return e&&e.prototype===t},l={$window:!0,$console:!0,$parent:!0,$self:!0,$frames:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0},p=function(){if("undefined"==typeof window)return!1;for(var t in window)if(!l["$"+t]&&n.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{f(window[t])}catch(e){return!0}return!1}(),d=function(t){if("undefined"==typeof window&&!p)return f(t);try{return f(t)}catch(e){return!1}},h=function(t){var e=null!==t&&"object"==typeof t,r="[object Function]"===o.call(t),i=u(t),f=e&&"[object String]"===o.call(t),l=[];if(!e&&!r&&!i)throw new TypeError("Object.keys called on a non-object");var p=a&&r;if(f&&t.length>0&&!n.call(t,0))for(var h=0;h<t.length;++h)l.push(String(h));if(i&&t.length>0)for(var y=0;y<t.length;++y)l.push(String(y));else for(var v in t)p&&"prototype"===v||!n.call(t,v)||l.push(String(v));if(c)for(var g=d(t),b=0;b<s.length;++b)g&&"constructor"===s[b]||!n.call(t,s[b])||l.push(s[b]);return l};h.shim=function(){if(Object.keys){var t=function(){return 2===(Object.keys(arguments)||"").length}(1,2);if(!t){var e=Object.keys;Object.keys=function(t){return e(u(t)?i.call(t):t)}}}else Object.keys=h;return Object.keys||h},t.exports=h},function(t){var e="Function.prototype.bind called on incompatible ",r=Array.prototype.slice,n=Object.prototype.toString,o="[object Function]";t.exports=function(t){var i=this;if("function"!=typeof i||n.call(i)!==o)throw new TypeError(e+i);for(var u=r.call(arguments,1),c=function(){if(this instanceof l){var e=i.apply(this,u.concat(r.call(arguments)));return Object(e)===e?e:this}return i.apply(t,u.concat(r.call(arguments)))},a=Math.max(0,i.length-u.length),s=[],f=0;a>f;f++)s.push("$"+f);var l=Function("binder","return function ("+s.join(",")+"){ return binder.apply(this,arguments); }")(c);if(i.prototype){var p=function(){};p.prototype=i.prototype,l.prototype=new p,p.prototype=null}return l}},function(t,e,r){var n=r(26),o=r(32),i=n.isObject,u=n.toObject;n.each.call("freeze,seal,preventExtensions,isFrozen,isSealed,isExtensible,getOwnPropertyDescriptor,getPrototypeOf,keys,getOwnPropertyNames".split(","),function(t,e){var c=(n.core.Object||{})[t]||Object[t],a=0,s={};s[t]=0==e?function(t){return i(t)?c(t):t}:1==e?function(t){return i(t)?c(t):t}:2==e?function(t){return i(t)?c(t):t}:3==e?function(t){return i(t)?c(t):!0}:4==e?function(t){return i(t)?c(t):!0}:5==e?function(t){return i(t)?c(t):!1}:6==e?function(t,e){return c(u(t),e)}:7==e?function(t){return c(Object(n.assertDefined(t)))}:8==e?function(t){return c(u(t))}:r(33).get;try{c("z")}catch(f){a=1}o(o.S+o.F*a,"Object",s)})},function(t,e,r){"use strict";function n(t){return isNaN(t=+t)?0:(t>0?y:h)(t)}function o(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}function i(t,e,r){return t[e]=r,t}function u(t){return b?function(e,r,n){return O.setDesc(e,r,o(t,n))}:i}function c(t){return null!==t&&("object"==typeof t||"function"==typeof t)}function a(t){return"function"==typeof t}function s(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}var f="undefined"!=typeof self?self:Function("return this")(),l={},p=Object.defineProperty,d={}.hasOwnProperty,h=Math.ceil,y=Math.floor,v=Math.max,g=Math.min,b=!!function(){try{return 2==p({},"a",{get:function(){return 2}}).a}catch(t){}}(),m=u(1),O=t.exports=r(37)({g:f,core:l,html:f.document&&document.documentElement,isObject:c,isFunction:a,that:function(){return this},toInteger:n,toLength:function(t){return t>0?g(n(t),9007199254740991):0},toIndex:function(t,e){return t=n(t),0>t?v(t+e,0):g(t,e)},has:function(t,e){return d.call(t,e)},create:Object.create,getProto:Object.getPrototypeOf,DESC:b,desc:o,getDesc:Object.getOwnPropertyDescriptor,setDesc:p,setDescs:Object.defineProperties,getKeys:Object.keys,getNames:Object.getOwnPropertyNames,getSymbols:Object.getOwnPropertySymbols,assertDefined:s,ES5Object:Object,toObject:function(t){return O.ES5Object(s(t))},hide:m,def:u(0),set:f.Symbol?i:m,each:[].forEach});"undefined"!=typeof __e&&(__e=l),"undefined"!=typeof __g&&(__g=f)},function(t,e,r){r(34);var n=r(26),o=r(35).Iterators,i=r(36)("iterator"),u=o.Array,c=n.g.NodeList,a=n.g.HTMLCollection,s=c&&c.prototype,f=a&&a.prototype;n.FW&&(!c||i in s||n.hide(s,i,u),!a||i in f||n.hide(f,i,u)),o.NodeList=o.HTMLCollection=u},function(t,e,r){var n=r(26).set,o=r(38)(!0),i=r(39).safe("iter"),u=r(35),c=u.step;r(40)(String,"String",function(t){n(this,i,{o:String(t),i:0})},function(){var t,e=this[i],r=e.o,n=e.i;return n>=r.length?c(1):(t=o(r,n),e.i+=t.length,c(0,t))})},function(t,e,r){var n=r(26).core,o=r(35);n.isIterable=o.is,n.getIterator=o.get},function(t){var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString;t.exports=function(t,n,o){if("[object Function]"!==r.call(n))throw new TypeError("iterator must be a function");var i=t.length;if(i===+i)for(var u=0;i>u;u++)n.call(o,t[u],u,t);else for(var c in t)e.call(t,c)&&n.call(o,t[c],c,t)}},function(t){"use strict";var e=Object.prototype.toString;t.exports=function(t){var r=e.call(t),n="[object Arguments]"===r;return n||(n="[object Array]"!==r&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===e.call(t.callee)),n}},function(t,e,r){function n(t,e){return function(){return t.apply(e,arguments)}}function o(t,e,r){var i,s,f,l,p=t&o.G,d=t&o.P,h=p?u:t&o.S?u[e]:(u[e]||{}).prototype,y=p?c:c[e]||(c[e]={});p&&(r=e);for(i in r)s=!(t&o.F)&&h&&i in h,s&&i in y||(f=s?h[i]:r[i],p&&!a(h[i])?l=r[i]:t&o.B&&s?l=n(f,u):t&o.W&&h[i]==f?!function(t){l=function(e){return this instanceof t?new t(e):t(e)},l.prototype=t.prototype}(f):l=d&&a(f)?n(Function.call,f):f,y[i]=l,d&&((y.prototype||(y.prototype={}))[i]=f))}var i=r(26),u=i.g,c=i.core,a=i.isFunction;o.F=1,o.G=2,o.S=4,o.P=8,o.B=16,o.W=32,t.exports=o},function(t,e,r){function n(t){try{return u(t)}catch(e){return c.slice()}}var o=r(26),i={}.toString,u=o.getNames,c="object"==typeof window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.get=function(t){return c&&"[object Window]"==i.call(t)?n(t):u(o.toObject(t))}},function(t,e,r){var n=r(26),o=r(41),i=r(39).safe("iter"),u=r(35),c=u.step,a=u.Iterators;r(40)(Array,"Array",function(t,e){n.set(this,i,{o:n.toObject(t),i:0,k:e})},function(){var t=this[i],e=t.o,r=t.k,n=t.i++;return!e||n>=e.length?(t.o=void 0,c(1)):"keys"==r?c(0,n):"values"==r?c(0,e[n]):c(0,[n,e[n]])},"values"),a.Arguments=a.Array,o("keys"),o("values"),o("entries")},function(t,e,r){"use strict";function n(t,e){o.hide(t,s,e),f in[]&&o.hide(t,f,e)}var o=r(26),i=r(42),u=i.classof,c=r(43),a=c.obj,s=r(36)("iterator"),f="@@iterator",l=r(44)("iterators"),p={};n(p,o.that),t.exports={BUGGY:"keys"in[]&&!("next"in[].keys()),Iterators:l,step:function(t,e){return{value:e,done:!!t}},is:function(t){var e=Object(t),r=o.g.Symbol;return(r&&r.iterator||f)in e||s in e||o.has(l,u(e))},get:function(t){var e,r=o.g.Symbol;return void 0!=t&&(e=t[r&&r.iterator||f]||t[s]||l[u(t)]),c(o.isFunction(e),t," is not iterable!"),a(e.call(t))},set:n,create:function(t,e,r,n){t.prototype=o.create(n||p,{next:o.desc(1,r)}),i.set(t,e+" Iterator")}}},function(t,e,r){var n=r(26).g,o=r(44)("wks");t.exports=function(t){return o[t]||(o[t]=n.Symbol&&n.Symbol[t]||r(39).safe("Symbol."+t))}},function(t){t.exports=function(t){return t.FW=!1,t.path=t.core,t}},function(t,e,r){var n=r(26);t.exports=function(t){return function(e,r){var o,i,u=String(n.assertDefined(e)),c=n.toInteger(r),a=u.length;return 0>c||c>=a?t?"":void 0:(o=u.charCodeAt(c),55296>o||o>56319||c+1===a||(i=u.charCodeAt(c+1))<56320||i>57343?t?u.charAt(c):o:t?u.slice(c,c+2):(o-55296<<10)+(i-56320)+65536)}}},function(t,e,r){function n(t){return"Symbol(".concat(void 0===t?"":t,")_",(++o+Math.random()).toString(36))}var o=0;n.safe=r(26).g.Symbol||n,t.exports=n},function(t,e,r){var n=r(32),o=r(45),i=r(26),u=r(42),c=r(35),a=r(36)("iterator"),s="@@iterator",f="keys",l="values",p=c.Iterators;t.exports=function(t,e,r,d,h,y,v){function g(t){function e(e){return new r(e,t)}switch(t){case f:return function(){return e(this)};case l:return function(){return e(this)}}return function(){return e(this)}}c.create(r,e,d);var b,m,O=e+" Iterator",j=t.prototype,w=j[a]||j[s]||h&&j[h],x=w||g(h);if(w){var S=i.getProto(x.call(new t));u.set(S,O,!0),i.FW&&i.has(j,s)&&c.set(S,i.that)}if((i.FW||v)&&c.set(j,x),p[e]=x,p[O]=i.that,h)if(b={keys:y?x:g(f),values:h==l?x:g(l),entries:h!=l?x:g("entries")},v)for(m in b)m in j||o(j,m,b[m]);else n(n.P+n.F*c.BUGGY,e,b)}},function(t){t.exports=function(){}},function(t,e,r){function n(t){return u.call(t).slice(8,-1)}var o=r(26),i=r(36)("toStringTag"),u={}.toString;n.classof=function(t){var e,r;return void 0==t?void 0===t?"Undefined":"Null":"string"==typeof(r=(e=Object(t))[i])?r:n(e)},n.set=function(t,e,r){t&&!o.has(t=r?t:t.prototype,i)&&o.hide(t,i,e)},t.exports=n},function(t,e,r){function n(t,e,r){if(!t)throw TypeError(r?e+r:e)}var o=r(26);n.def=o.assertDefined,n.fn=function(t){if(!o.isFunction(t))throw TypeError(t+" is not a function!");return t},n.obj=function(t){if(!o.isObject(t))throw TypeError(t+" is not an object!");return t},n.inst=function(t,e,r){if(!(t instanceof e))throw TypeError(r+": use the 'new' operator!");return t},t.exports=n},function(t,e,r){var n=r(26),o="__core-js_shared__",i=n.g[o]||(n.g[o]={});t.exports=function(t){return i[t]||(i[t]={})}},function(t,e,r){t.exports=r(26).hide}])}); | ||
!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(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";var n=r(3)["default"];Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=n(o),u=r(2),c=n(u);e["default"]={Server:i["default"],Collection:c["default"]},t.exports=e["default"]},function(t,e,r){"use strict";function n(t){if(!t)return{};var e={},r=t.split("&");return r.map(function(t){if(-1===t.indexOf("="))e[t]=!0;else{var r=t.split("="),n=u(r,2),o=n[0],i=n[1];(0===i.indexOf("[")||0===i.indexOf("{"))&&(i=JSON.parse(i)),e[o.trim()]=i}}),e}var o=r(4)["default"],i=r(5)["default"],u=r(6)["default"],c=r(7)["default"],a=r(8)["default"],s=r(3)["default"];Object.defineProperty(e,"__esModule",{value:!0});var f=r(9),l=s(f),p=r(2),d=s(p),h=l["default"].getPolyfill(),y=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?"":arguments[0];i(this,t),this.baseUrl=e,this.loggingEnabled=!1,this.defaultQuery=function(){},this.batchUrl=null,this.collections={},this.requestInterceptors=[],this.responseInterceptors=[]}return o(t,[{key:"init",value:function(t){for(var e in t)this.addCollection(e,new d["default"](t[e],"id"))}},{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 c(this.collections)}},{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[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:"decode",value:function(t){if(t.queryString=decodeURIComponent(t.url.slice(t.url.indexOf("?")+1)),t.params=n(t.queryString),t.requestBody)try{t.json=JSON.parse(t.requestBody)}catch(e){}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]?200:arguments[3];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=c(e).reduce(function(t,n){var o,i={url:e[n],method:"GET",params:{},respond:function(t,e,r){o={code:t,headers:c(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=!0,r=!1,n=void 0;try{for(var o,i=a(this.getCollectionNames());!(e=(o=i.next()).done);e=!0){var u=o.value,c=t.url.match(new RegExp("^"+this.baseUrl+"\\/("+u+")(\\/(\\d+))?(\\?.*)?$"));if(c){var s=h({},this.defaultQuery(u),t.params);if(c[2]){var f=c[3];if("GET"==t.method)try{var l=this.getOne(u,f,s);return this.respond(l,null,t)}catch(p){return t.respond(404)}if("PUT"==t.method)try{var l=this.updateOne(u,f,t.json);return this.respond(l,null,t)}catch(p){return t.respond(404)}if("PATCH"==t.method)try{var l=this.updateOne(u,f,t.json);return this.respond(l,null,t)}catch(p){return t.respond(404)}if("DELETE"==t.method)try{var l=this.removeOne(u,f);return this.respond(l,null,t)}catch(p){return t.respond(404)}}else{if("GET"==t.method){var d={};for(var y in s)"range"!==y&&(d[y]=s[y]);var v=this.getCount(u,d),g=void 0,b=void 0,m=void 0;if(v>0){g=this.getAll(u,s);var O=s.range?s.range[0]:0,j=s.range?Math.min(g.length-1+O,s.range[1]):g.length-1;b="items "+O+"-"+j+"/"+v,m=g.length==v?200:206}else g=[],b="items */0",m=200;return this.respond(g,{"Content-Range":b},t,m)}if("POST"==t.method){var w=this.addOne(u,t.json),x=this.baseUrl+"/"+u+"/"+w[this.getCollection(u).identifierName];return this.respond(w,{Location:x},t,201)}}}}}catch(S){r=!0,n=S}finally{try{!e&&i["return"]&&i["return"]()}finally{if(r)throw n}}}},{key:"getHandler",value:function(){return this.handle.bind(this)}}]),t}();e["default"]=y,t.exports=e["default"]},function(t,e,r){"use strict";function n(t,e){if("function"==typeof e)return t.filter(e);if(e instanceof Object){var r=a(e).map(function(t){if("q"===t){var r=function(){var t=new RegExp(e.q,"i");return{v:function(e){for(var r in e)if(e[r]&&e[r].match&&null!==e[r].match(t))return!0;return!1}}}();if("object"==typeof r)return r.v}var n=e[t];if(-1!==t.indexOf("_lte")){var o=function(){var e=t.replace(/(_lte)$/,"");return{v:function(t){return t[e]<=n}}}();if("object"==typeof o)return o.v}if(-1!==t.indexOf("_gte")){var i=function(){var e=t.replace(/(_gte)$/,"");return{v:function(t){return t[e]>=n}}}();if("object"==typeof i)return i.v}if(-1!==t.indexOf("_lt")){var u=function(){var e=t.replace(/(_lt)$/,"");return{v:function(t){return t[e]<n}}}();if("object"==typeof u)return u.v}if(-1!==t.indexOf("_gt")){var c=function(){var e=t.replace(/(_gt)$/,"");return{v:function(t){return t[e]>n}}}();if("object"==typeof c)return c.v}return Array.isArray(n)?function(e){return n.filter(function(r){return r==e[t]}).length>0}:function(e){return Array.isArray(e[t])&&"string"==typeof n?-1!==e[t].indexOf(n):"boolean"==typeof e[t]&&"string"==typeof n?e[t]==("true"===n?!0:!1):e[t]==n}});return t.filter(function(t){return r.reduce(function(e,r){return e&&r(t)},!0)})}throw new Error("Unsupported filter type")}function o(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=function(){var r=e[0],n="asc"==e[1].toLowerCase()?1:-1;return{v:t.sort(function(t,e){return t[r]>e[r]?n:t[r]<e[r]?-1*n:0})}}();if("object"==typeof r)return r.v}throw new Error("Unsupported sort type")}function i(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")}var u=r(4)["default"],c=r(5)["default"],a=r(7)["default"];Object.defineProperty(e,"__esModule",{value:!0}),r(10),r(11);var s=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],r=arguments.length<=1||void 0===arguments[1]?"id":arguments[1];if(c(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))}return u(t,[{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),n=r+"_id";return function(r){var o=e.server.collections[t];if(!o)throw new Error("Can't embed a non-existing collection "+t);return r[t]=o.getAll(Array.isArray(r[t])?{filter:function(e){return-1!==r[t].indexOf(e[o.identifierName])}}:{filter:function(t){return t[n]==r[e.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 "+t);try{o[t]=i.getOne(o[n])}catch(u){}return o}}},{key:"_itemEmbedder",value:function(t){var e=this,r=Array.isArray(t)?t:[t],n=r.map(function(t){return t.endsWith("s")?e._oneToManyEmbedder(t):e._manyToOneEmbedder(t)});return function(t){return n.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,r=this.items.map(function(t){return t});return t&&(t.filter&&(r=n(r,t.filter)),t.sort&&(r=o(r,t.sort)),t.range&&(r=i(r,t.range)),t.embed&&this.server&&(r=r.map(function(r){return e._itemEmbedder(t.embed)(r)}))),r}},{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 "+t);var n=this.items[r];return 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 "+e+" already exists");this.sequence=Math.max(this.sequence,e)+1}else t[this.identifierName]=this.sequence++;return this.items.push(t),t}},{key:"updateOne",value:function(t,e){var r=this.getIndex(t);if(-1===r)throw new Error("No item with identifier "+t);for(var n in e)this.items[r][n]=e[n];return this.items[r]}},{key:"removeOne",value:function(t){var e=this.getIndex(t);if(-1===e)throw new Error("No item with identifier "+t);var r=this.items[e];return this.items.splice(e,1),t==this.sequence-1&&this.sequence--,r}}]),t}();e["default"]=s,t.exports=e["default"]},function(t,e){"use strict";e["default"]=function(t){return t&&t.__esModule?t:{"default":t}},e.__esModule=!0},function(t,e,r){"use strict";var n=r(13)["default"];e["default"]=function(){function t(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),n(t,o.key,o)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),e.__esModule=!0},function(t,e){"use strict";e["default"]=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},e.__esModule=!0},function(t,e,r){"use strict";var n=r(8)["default"],o=r(12)["default"];e["default"]=function(){function t(t,e){var r=[],o=!0,i=!1,u=void 0;try{for(var c,a=n(t);!(o=(c=a.next()).done)&&(r.push(c.value),!e||r.length!==e);o=!0);}catch(s){i=!0,u=s}finally{try{!o&&a["return"]&&a["return"]()}finally{if(i)throw u}}return r}return function(e,r){if(Array.isArray(e))return e;if(o(Object(e)))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),e.__esModule=!0},function(t,e,r){t.exports={"default":r(18),__esModule:!0}},function(t,e,r){t.exports={"default":r(17),__esModule:!0}},function(t,e,r){"use strict";var n=r(21),o=r(14),i=r(15),u=r(16);n(o,{implementation:o,getPolyfill:i,shim:u}),t.exports=o},function(){!function(){if(!Array.prototype.findIndex){var t=function(t){var e=Object(this),r=Math.max(0,e.length)>>>0;if(0===r)return-1;if("function"!=typeof t||"[object Function]"!==Object.prototype.toString.call(t))throw new TypeError("Array#findIndex: predicate must be a function");for(var n=arguments.length>1?arguments[1]:void 0,o=0;r>o;o++)if(t.call(n,e[o],o,e))return o;return-1};if(Object.defineProperty)try{Object.defineProperty(Array.prototype,"findIndex",{value:t,configurable:!0,writable:!0})}catch(e){}Array.prototype.findIndex||(Array.prototype.findIndex=t)}}(this)},function(){/*! http://mths.be/endswith v0.2.0 by @mathias */ | ||
String.prototype.endsWith||!function(){"use strict";var t=function(){try{var t={},e=Object.defineProperty,r=e(t,t,t)&&e}catch(n){}return r}(),e={}.toString,r=function(t){if(null==this)throw TypeError();var r=String(this);if(t&&"[object RegExp]"==e.call(t))throw TypeError();var n=r.length,o=String(t),i=o.length,u=n;if(arguments.length>1){var c=arguments[1];void 0!==c&&(u=c?Number(c):0,u!=u&&(u=0))}var a=Math.min(Math.max(u,0),n),s=a-i;if(0>s)return!1;for(var f=-1;++f<i;)if(r.charCodeAt(s+f)!=o.charCodeAt(f))return!1;return!0};t?t(String.prototype,"endsWith",{value:r,configurable:!0,writable:!0}):String.prototype.endsWith=r}()},function(t,e,r){t.exports={"default":r(20),__esModule:!0}},function(t,e,r){t.exports={"default":r(19),__esModule:!0}},function(t,e,r){"use strict";var n=r(28),o=r(29),i=function(t){return"undefined"!=typeof t&&null!==t},u=r(22)(),c=Object,a=o.call(Function.call,Array.prototype.push),s=o.call(Function.call,Object.prototype.propertyIsEnumerable);t.exports=function(t){if(!i(t))throw new TypeError("target must be an object");var e,r,o,f,l,p=c(t);for(e=1;e<arguments.length;++e){if(r=c(arguments[e]),f=n(r),u&&Object.getOwnPropertySymbols)for(l=Object.getOwnPropertySymbols(r),o=0;o<l.length;++o)s(r,l[o])&&a(f,l[o]);for(o=0;o<f.length;++o)p[f[o]]=r[f[o]]}return p}},function(t,e,r){"use strict";var n=r(14),o=function(){if(!Object.assign||!Object.preventExtensions)return!1;var t=Object.preventExtensions({1:2});try{Object.assign(t,"xy")}catch(e){return"y"===t[1]}};t.exports=function(){return!Object.assign||o()?n:Object.assign}},function(t,e,r){"use strict";var n=r(21),o=r(15);t.exports=function(){var t=o();return Object.assign!==t&&n(Object,{assign:t}),t}},function(t,e,r){r(23),r(24),r(25),t.exports=r(26).core.getIterator},function(t,e,r){r(27),t.exports=r(26).core.Object.keys},function(t,e,r){var n=r(26);t.exports=function(t,e,r){return n.setDesc(t,e,r)}},function(t,e,r){r(23),r(24),r(25),t.exports=r(26).core.isIterable},function(t,e,r){"use strict";var n=r(28),o=r(30),i="function"==typeof Symbol&&"symbol"==typeof Symbol(),u=Object.prototype.toString,c=function(t){return"function"==typeof t&&"[object Function]"===u.call(t)},a=function(){var t={};try{Object.defineProperty(t,"x",{value:t,enumerable:!1});for(var e in t)return!1;return t.x===t}catch(r){return!1}},s=Object.defineProperty&&a(),f=function(t,e,r,n){(!(e in t)||c(n)&&n())&&(s?Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:!0,value:r}):t[e]=r)},l=function(t,e){var r=arguments.length>2?arguments[2]:{},u=n(e);i&&(u=u.concat(Object.getOwnPropertySymbols(e))),o(u,function(n){f(t,n,e[n],r[n])})};l.supportsDescriptors=!!s,t.exports=l},function(t,e,r){"use strict";var n=r(28);t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test");if("string"==typeof e)return!1;if(e instanceof Symbol)return!1;t[e]=42;for(e in t)return!1;if(0!==n(t).length)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var r=Object.getOwnPropertySymbols(t);if(1!==r.length||r[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(t,e);if(42!==o.value||o.enumerable!==!0)return!1}return!0}},function(t,e,r){r(35);var n=r(26),o=r(33).Iterators,i=r(36)("iterator"),u=o.Array,c=n.g.NodeList,a=n.g.HTMLCollection,s=c&&c.prototype,f=a&&a.prototype;n.FW&&(!c||i in s||n.hide(s,i,u),!a||i in f||n.hide(f,i,u)),o.NodeList=o.HTMLCollection=u},function(t,e,r){var n=r(26).set,o=r(31)(!0),i=r(32).safe("iter"),u=r(33),c=u.step;r(34)(String,"String",function(t){n(this,i,{o:String(t),i:0})},function(){var t,e=this[i],r=e.o,n=e.i;return n>=r.length?c(1):(t=o(r,n),e.i+=t.length,c(0,t))})},function(t,e,r){var n=r(26).core,o=r(33);n.isIterable=o.is,n.getIterator=o.get},function(t,e,r){"use strict";function n(t){return isNaN(t=+t)?0:(t>0?y:h)(t)}function o(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}function i(t,e,r){return t[e]=r,t}function u(t){return b?function(e,r,n){return O.setDesc(e,r,o(t,n))}:i}function c(t){return null!==t&&("object"==typeof t||"function"==typeof t)}function a(t){return"function"==typeof t}function s(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}var f="undefined"!=typeof self?self:Function("return this")(),l={},p=Object.defineProperty,d={}.hasOwnProperty,h=Math.ceil,y=Math.floor,v=Math.max,g=Math.min,b=!!function(){try{return 2==p({},"a",{get:function(){return 2}}).a}catch(t){}}(),m=u(1),O=t.exports=r(37)({g:f,core:l,html:f.document&&document.documentElement,isObject:c,isFunction:a,that:function(){return this},toInteger:n,toLength:function(t){return t>0?g(n(t),9007199254740991):0},toIndex:function(t,e){return t=n(t),0>t?v(t+e,0):g(t,e)},has:function(t,e){return d.call(t,e)},create:Object.create,getProto:Object.getPrototypeOf,DESC:b,desc:o,getDesc:Object.getOwnPropertyDescriptor,setDesc:p,setDescs:Object.defineProperties,getKeys:Object.keys,getNames:Object.getOwnPropertyNames,getSymbols:Object.getOwnPropertySymbols,assertDefined:s,ES5Object:Object,toObject:function(t){return O.ES5Object(s(t))},hide:m,def:u(0),set:f.Symbol?i:m,each:[].forEach});"undefined"!=typeof __e&&(__e=l),"undefined"!=typeof __g&&(__g=f)},function(t,e,r){var n=r(26),o=r(38),i=n.isObject,u=n.toObject;n.each.call("freeze,seal,preventExtensions,isFrozen,isSealed,isExtensible,getOwnPropertyDescriptor,getPrototypeOf,keys,getOwnPropertyNames".split(","),function(t,e){var c=(n.core.Object||{})[t]||Object[t],a=0,s={};s[t]=0==e?function(t){return i(t)?c(t):t}:1==e?function(t){return i(t)?c(t):t}:2==e?function(t){return i(t)?c(t):t}:3==e?function(t){return i(t)?c(t):!0}:4==e?function(t){return i(t)?c(t):!0}:5==e?function(t){return i(t)?c(t):!1}:6==e?function(t,e){return c(u(t),e)}:7==e?function(t){return c(Object(n.assertDefined(t)))}:8==e?function(t){return c(u(t))}:r(39).get;try{c("z")}catch(f){a=1}o(o.S+o.F*a,"Object",s)})},function(t,e,r){"use strict";var n=Object.prototype.hasOwnProperty,o=Object.prototype.toString,i=Array.prototype.slice,u=r(40),c=!{toString:null}.propertyIsEnumerable("toString"),a=function(){}.propertyIsEnumerable("prototype"),s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],f=function(t){var e=t.constructor;return e&&e.prototype===t},l={$window:!0,$console:!0,$parent:!0,$self:!0,$frames:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0},p=function(){if("undefined"==typeof window)return!1;for(var t in window)if(!l["$"+t]&&n.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{f(window[t])}catch(e){return!0}return!1}(),d=function(t){if("undefined"==typeof window&&!p)return f(t);try{return f(t)}catch(e){return!1}},h=function(t){var e=null!==t&&"object"==typeof t,r="[object Function]"===o.call(t),i=u(t),f=e&&"[object String]"===o.call(t),l=[];if(!e&&!r&&!i)throw new TypeError("Object.keys called on a non-object");var p=a&&r;if(f&&t.length>0&&!n.call(t,0))for(var h=0;h<t.length;++h)l.push(String(h));if(i&&t.length>0)for(var y=0;y<t.length;++y)l.push(String(y));else for(var v in t)p&&"prototype"===v||!n.call(t,v)||l.push(String(v));if(c)for(var g=d(t),b=0;b<s.length;++b)g&&"constructor"===s[b]||!n.call(t,s[b])||l.push(s[b]);return l};h.shim=function(){if(Object.keys){var t=function(){return 2===(Object.keys(arguments)||"").length}(1,2);if(!t){var e=Object.keys;Object.keys=function(t){return e(u(t)?i.call(t):t)}}}else Object.keys=h;return Object.keys||h},t.exports=h},function(t){var e="Function.prototype.bind called on incompatible ",r=Array.prototype.slice,n=Object.prototype.toString,o="[object Function]";t.exports=function(t){var i=this;if("function"!=typeof i||n.call(i)!==o)throw new TypeError(e+i);for(var u=r.call(arguments,1),c=function(){if(this instanceof l){var e=i.apply(this,u.concat(r.call(arguments)));return Object(e)===e?e:this}return i.apply(t,u.concat(r.call(arguments)))},a=Math.max(0,i.length-u.length),s=[],f=0;a>f;f++)s.push("$"+f);var l=Function("binder","return function ("+s.join(",")+"){ return binder.apply(this,arguments); }")(c);if(i.prototype){var p=function(){};p.prototype=i.prototype,l.prototype=new p,p.prototype=null}return l}},function(t){var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString;t.exports=function(t,n,o){if("[object Function]"!==r.call(n))throw new TypeError("iterator must be a function");var i=t.length;if(i===+i)for(var u=0;i>u;u++)n.call(o,t[u],u,t);else for(var c in t)e.call(t,c)&&n.call(o,t[c],c,t)}},function(t,e,r){var n=r(26);t.exports=function(t){return function(e,r){var o,i,u=String(n.assertDefined(e)),c=n.toInteger(r),a=u.length;return 0>c||c>=a?t?"":void 0:(o=u.charCodeAt(c),55296>o||o>56319||c+1===a||(i=u.charCodeAt(c+1))<56320||i>57343?t?u.charAt(c):o:t?u.slice(c,c+2):(o-55296<<10)+(i-56320)+65536)}}},function(t,e,r){function n(t){return"Symbol(".concat(void 0===t?"":t,")_",(++o+Math.random()).toString(36))}var o=0;n.safe=r(26).g.Symbol||n,t.exports=n},function(t,e,r){"use strict";function n(t,e){o.hide(t,s,e),f in[]&&o.hide(t,f,e)}var o=r(26),i=r(42),u=i.classof,c=r(43),a=c.obj,s=r(36)("iterator"),f="@@iterator",l=r(44)("iterators"),p={};n(p,o.that),t.exports={BUGGY:"keys"in[]&&!("next"in[].keys()),Iterators:l,step:function(t,e){return{value:e,done:!!t}},is:function(t){var e=Object(t),r=o.g.Symbol;return(r&&r.iterator||f)in e||s in e||o.has(l,u(e))},get:function(t){var e,r=o.g.Symbol;return void 0!=t&&(e=t[r&&r.iterator||f]||t[s]||l[u(t)]),c(o.isFunction(e),t," is not iterable!"),a(e.call(t))},set:n,create:function(t,e,r,n){t.prototype=o.create(n||p,{next:o.desc(1,r)}),i.set(t,e+" Iterator")}}},function(t,e,r){var n=r(38),o=r(41),i=r(26),u=r(42),c=r(33),a=r(36)("iterator"),s="@@iterator",f="keys",l="values",p=c.Iterators;t.exports=function(t,e,r,d,h,y,v){function g(t){function e(e){return new r(e,t)}switch(t){case f:return function(){return e(this)};case l:return function(){return e(this)}}return function(){return e(this)}}c.create(r,e,d);var b,m,O=e+" Iterator",j=t.prototype,w=j[a]||j[s]||h&&j[h],x=w||g(h);if(w){var S=i.getProto(x.call(new t));u.set(S,O,!0),i.FW&&i.has(j,s)&&c.set(S,i.that)}if((i.FW||v)&&c.set(j,x),p[e]=x,p[O]=i.that,h)if(b={keys:y?x:g(f),values:h==l?x:g(l),entries:h!=l?x:g("entries")},v)for(m in b)m in j||o(j,m,b[m]);else n(n.P+n.F*c.BUGGY,e,b)}},function(t,e,r){var n=r(26),o=r(45),i=r(32).safe("iter"),u=r(33),c=u.step,a=u.Iterators;r(34)(Array,"Array",function(t,e){n.set(this,i,{o:n.toObject(t),i:0,k:e})},function(){var t=this[i],e=t.o,r=t.k,n=t.i++;return!e||n>=e.length?(t.o=void 0,c(1)):"keys"==r?c(0,n):"values"==r?c(0,e[n]):c(0,[n,e[n]])},"values"),a.Arguments=a.Array,o("keys"),o("values"),o("entries")},function(t,e,r){var n=r(26).g,o=r(44)("wks");t.exports=function(t){return o[t]||(o[t]=n.Symbol&&n.Symbol[t]||r(32).safe("Symbol."+t))}},function(t){t.exports=function(t){return t.FW=!1,t.path=t.core,t}},function(t,e,r){function n(t,e){return function(){return t.apply(e,arguments)}}function o(t,e,r){var i,s,f,l,p=t&o.G,d=t&o.P,h=p?u:t&o.S?u[e]:(u[e]||{}).prototype,y=p?c:c[e]||(c[e]={});p&&(r=e);for(i in r)s=!(t&o.F)&&h&&i in h,s&&i in y||(f=s?h[i]:r[i],p&&!a(h[i])?l=r[i]:t&o.B&&s?l=n(f,u):t&o.W&&h[i]==f?!function(t){l=function(e){return this instanceof t?new t(e):t(e)},l.prototype=t.prototype}(f):l=d&&a(f)?n(Function.call,f):f,y[i]=l,d&&((y.prototype||(y.prototype={}))[i]=f))}var i=r(26),u=i.g,c=i.core,a=i.isFunction;o.F=1,o.G=2,o.S=4,o.P=8,o.B=16,o.W=32,t.exports=o},function(t,e,r){function n(t){try{return u(t)}catch(e){return c.slice()}}var o=r(26),i={}.toString,u=o.getNames,c="object"==typeof window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.get=function(t){return c&&"[object Window]"==i.call(t)?n(t):u(o.toObject(t))}},function(t){"use strict";var e=Object.prototype.toString;t.exports=function(t){var r=e.call(t),n="[object Arguments]"===r;return n||(n="[object Array]"!==r&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===e.call(t.callee)),n}},function(t,e,r){t.exports=r(26).hide},function(t,e,r){function n(t){return u.call(t).slice(8,-1)}var o=r(26),i=r(36)("toStringTag"),u={}.toString;n.classof=function(t){var e,r;return void 0==t?void 0===t?"Undefined":"Null":"string"==typeof(r=(e=Object(t))[i])?r:n(e)},n.set=function(t,e,r){t&&!o.has(t=r?t:t.prototype,i)&&o.hide(t,i,e)},t.exports=n},function(t,e,r){function n(t,e,r){if(!t)throw TypeError(r?e+r:e)}var o=r(26);n.def=o.assertDefined,n.fn=function(t){if(!o.isFunction(t))throw TypeError(t+" is not a function!");return t},n.obj=function(t){if(!o.isObject(t))throw TypeError(t+" is not an object!");return t},n.inst=function(t,e,r){if(!(t instanceof e))throw TypeError(r+": use the 'new' operator!");return t},t.exports=n},function(t,e,r){var n=r(26),o="__core-js_shared__",i=n.g[o]||(n.g[o]={});t.exports=function(t){return i[t]||(i[t]={})}},function(t){t.exports=function(){}}])}); |
{ | ||
"name": "fakerest", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"repository": "https://github.com/marmelab/FakeRest", | ||
@@ -5,0 +5,0 @@ "description": "Patch XMLHttpRequest to fake a REST server based on JSON data. ", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2129