restful.js
Advanced tools
Comparing version 0.5.2 to 0.6.0
{ | ||
"name": "restful.js", | ||
"version": "0.5.2", | ||
"version": "0.6.0", | ||
"homepage": "https://github.com/marmelab/restful.js", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -1,2 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):"object"==typeof exports?exports.restful=n():t.restful=n()}(this,function(){return function(t){function n(r){if(e[r])return e[r].exports;var o=e[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var e={};return n.m=t,n.c=e,n.p="",n(0)}([function(t,n,e){"use strict";function r(t,n){var e={baseUrl:t,port:n||80,prefixUrl:"",protocol:"http"},r=function(){var t={_http:f(a),headers:{},requestInterceptors:[],responseInterceptors:[]},n={url:function(t){var n=function(){return t.apply(this,arguments)};return n.toString=function(){return t.toString()},n}(function(){var t=e.protocol+"://"+e.baseUrl;return 80!==e.port&&(t+=":"+e.port),""!==e.prefixUrl&&(t+="/"+e.prefixUrl),t})};return i(n,t),Object.assign(function(){return t._http},n)}(),o={url:function(){return r.url()},one:function(t,n){return c(t,n,o)},all:function(t){return u(t,o)}};return o=Object.assign(s(r),o),i(o,e),o}var o=function(t){return t&&t.__esModule?t["default"]:t};t.exports=r,e(7);var i=o(e(1)),u=o(e(2)),c=o(e(3)),s=o(e(4)),a=o(e(6)),f=o(e(5))},function(t){"use strict";function n(t,n){for(var e in n)n.hasOwnProperty(e)&&!function(e){t[e]=function(r){return arguments.length?(n[e]=r,t):n[e]}}(e)}t.exports=n},function(t,n,e){"use strict";function r(t,n){var e=i([n.url(),t].join("/"),n()),r={get:function(r,o,i){var s=c(t,r,n);return s().headers(e.headers()).responseInterceptors(e.responseInterceptors()).requestInterceptors(e.requestInterceptors()),e.get(r,o,i).then(function(t){return u(r,t,s)})},getAll:function(r,o){return e.getAll(r,o).then(function(r){return r.data.map(function(o){r=JSON.parse(JSON.stringify(r)),r.data=o;var i=c(t,o.id,n);return i().headers(e.headers()).responseInterceptors(e.responseInterceptors()).requestInterceptors(e.requestInterceptors()),u(o.id,r,i)})})},post:function(t,n){return e.post(t,n)},put:function(t,n,r){return e.put(t,n,r)},patch:function(t,n,r){return e.patch(t,n,r)},head:function(t,n,r){return e.head(t,n,r)},"delete":function(t,n){return e["delete"](t,n)},url:function(){return[n.url(),t].join("/")}};return Object.assign(s(e),r)}var o=function(t){return t&&t.__esModule?t["default"]:t};t.exports=r;var i=o(e(8)),u=o(e(9)),c=o(e(3)),s=o(e(4))},function(t,n,e){"use strict";function r(t,n,e){var o=u([e.url(),t].join("/"),e()),a={get:function(t,e){return o.get(n,t,e).then(function(t){return c(n,t,a)})},put:function(t,e){return o.put(n,t,e)},patch:function(t,e){return o.patch(n,t,e)},head:function(t,e){return o.head(n,t,e)},"delete":function(t){return o["delete"](n,t)},one:function(t,n){return r(t,n,a)},all:function(t){return i(t,a)},url:function(){return[e.url(),t,n].join("/")}};return a=Object.assign(s(o),a)}var o=function(t){return t&&t.__esModule?t["default"]:t};t.exports=r;var i=o(e(2)),u=o(e(8)),c=o(e(9)),s=o(e(4))},function(t){"use strict";function n(t){function n(){return t}return n=Object.assign(n,{addRequestInterceptor:function(e){return t.requestInterceptors().push(e),n},requestInterceptors:function(){return t.requestInterceptors()},addResponseInterceptor:function(e){return t.responseInterceptors().push(e),n},responseInterceptors:function(){return t.responseInterceptors},header:function(e,r){return t.headers()[e]=r,n},headers:function(){return t.headers()}})}t.exports=n},function(t){"use strict";function n(t,n,e,r){return r=void 0!==r?!!r:!1,function(o,i){if(r)try{o=JSON.parse(o)}catch(u){}for(var c in t)o=t[c](o,i,n,e);if(!r)try{o=JSON.stringify(o)}catch(u){}return o}}function e(t){var e={request:function(e,r){return r.method=e,-1!==["post","put","patch"].indexOf(e)&&(r.transformRequest=[n(r.requestInterceptors||[],r.method,r.url)],delete r.requestInterceptors),r.transformResponse=[n(r.responseInterceptors||[],r.method,r.url,!0)],delete r.responseInterceptors,t(r)}};return Object.assign(function(){return t},e)}t.exports=e},function(t,n,e){t.exports=e(10)},function(t,n,e){t.exports=e(11)},function(t,n,e){"use strict";function r(t,n){function e(){for(var t=s,n=[];t;)n=n.concat(t.requestInterceptors()),t=t._parent?t._parent():null;return n}function r(){for(var t=s,n=[];t;)n=n.concat(t.responseInterceptors()),t=t._parent?t._parent():null;return n}function o(){for(var t=s,n={};t;)Object.assign(n,t.headers()),t=t._parent?t._parent():null;return n}function u(t){var n=void 0===arguments[1]?{}:arguments[1],i=void 0===arguments[2]?{}:arguments[2],u=void 0===arguments[3]?null:arguments[3],c={url:t,params:n||{},headers:Object.assign({},o(),i||{}),responseInterceptors:r()};return u&&(c.data=u,c.requestInterceptors=e()),c}var c={_parent:n,headers:{},requestInterceptors:[],responseInterceptors:[]},s={get:function(n,e,r){return c._parent().request("get",u(t+"/"+n,e,r))},getAll:function(n,e){return c._parent().request("get",u(t,n,e))},post:function(n,e){return e=e||{},e["Content-Type"]||(e["Content-Type"]="application/json;charset=UTF-8"),c._parent().request("post",u(t,{},e,n))},put:function(n,e,r){return r=r||{},r["Content-Type"]||(r["Content-Type"]="application/json;charset=UTF-8"),c._parent().request("put",u(t+"/"+n,{},r,e))},patch:function(n,e,r){return r=r||{},r["Content-Type"]||(r["Content-Type"]="application/json;charset=UTF-8"),c._parent().request("patch",u(t+"/"+n,{},r,e))},"delete":function(n,e){return c._parent().request("delete",u(t+"/"+n,{},e))},head:function(n,e){return c._parent().request("head",u(t+"/"+n,{},e))}};return s=Object.assign(function(){return c._parent()},s),i(s,c),s}var o=function(t){return t&&t.__esModule?t["default"]:t};t.exports=r;{var i=o(e(1));o(e(9))}},function(t){"use strict";function n(t,n,e){var r={one:function(t,n){return e.one(t,n)},all:function(t){return e.all(t)},save:function(t){return e.put(n.data,t)},remove:function(t){return e["delete"](t)},url:function(){return e.url()},id:function(t){var n=function(){return t.apply(this,arguments)};return n.toString=function(){return t.toString()},n}(function(){return t}),status:function(){return n.status},data:function(){return n.data},headers:function(){return n.headers}};return Object.assign(function(){return n},r)}t.exports=n},function(t,n,e){(function(n){function r(){c.forEach(arguments,function(t){s[t]=function(n,e){return s(c.merge(e||{},{method:t,url:n}))}})}function o(){c.forEach(arguments,function(t){s[t]=function(n,e,r){return s(c.merge(r||{},{method:t,url:n,data:e}))}})}var i=e(24).Promise,u=e(12),c=e(13),s=t.exports=function a(t){function r(t,n,e){try{console.warn("DEPRECATED method `"+t+"`."+(n?" Use `"+n+"` instead.":"")+" This method will be removed in a future release."),e&&console.warn("For more information about usage see "+e)}catch(r){}}t=c.merge({method:"get",headers:{},transformRequest:u.transformRequest,transformResponse:u.transformResponse},t),t.withCredentials=t.withCredentials||u.withCredentials;var o=function(t){return new i(function(r,o){try{"undefined"!=typeof window?e(14)(r,o,t):"undefined"!=typeof n&&e(14)(r,o,t)}catch(i){o(i)}})},s=[o,void 0],f=i.resolve(t);for(c.forEach(a.interceptors.request.handlers,function(t){s.unshift(t.request,t.requestError)}),c.forEach(a.interceptors.response.handlers,function(t){s.push(t.response,t.responseError)});s.length;){var l=s.shift(),p=s.shift();f=f.then(l,p)}return f.success=function(t){return r("success","then","https://github.com/mzabriskie/axios/blob/master/README.md#response-api"),f.then(function(n){t(n.data,n.status,n.headers,n.config)}),f},f.error=function(t){return r("error","catch","https://github.com/mzabriskie/axios/blob/master/README.md#response-api"),f.then(null,function(n){t(n.data,n.status,n.headers,n.config)}),f},f};s.defaults=u,s.all=function(t){return i.all(t)},s.spread=e(15),s.interceptors={request:{handlers:[],use:function(t,n){s.interceptors.request.handlers.push({request:t,requestError:n})}},response:{handlers:[],use:function(t,n){s.interceptors.response.handlers.push({response:t,responseError:n})}}},r("delete","get","head"),o("post","put","patch")}).call(n,e(16))},function(t,n,e){(function(t){"use strict";if(t._babelPolyfill)throw new Error("only one instance of babel/polyfill is allowed");t._babelPolyfill=!0,e(22),e(23)}).call(n,function(){return this}())},function(t,n,e){"use strict";var r=e(13),o=/^\s*(\[|\{[^\{])/,i=/[\}\]]\s*$/,u=/^\)\]\}',?\n/,c={"Content-Type":"application/x-www-form-urlencoded"};t.exports={transformRequest:[function(t,n){return r.isArrayBuffer(t)?t:r.isArrayBufferView(t)?t.buffer:!r.isObject(t)||r.isFile(t)||r.isBlob(t)?t:(!r.isUndefined(n)&&r.isUndefined(n["Content-Type"])&&(n["Content-Type"]="application/json;charset=utf-8"),JSON.stringify(t))}],transformResponse:[function(t){return"string"==typeof t&&(t=t.replace(u,""),o.test(t)&&i.test(t)&&(t=JSON.parse(t))),t}],headers:{common:{Accept:"application/json, text/plain, */*"},patch:r.merge(c),post:r.merge(c),put:r.merge(c)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"}},function(t){function n(t){return"[object Array]"===v.call(t)}function e(t){return"[object ArrayBuffer]"===v.call(t)}function r(t){return"[object FormData]"===v.call(t)}function o(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer}function i(t){return"string"==typeof t}function u(t){return"number"==typeof t}function c(t){return"undefined"==typeof t}function s(t){return null!==t&&"object"==typeof t}function a(t){return"[object Date]"===v.call(t)}function f(t){return"[object File]"===v.call(t)}function l(t){return"[object Blob]"===v.call(t)}function p(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}function h(t,n){if(null!==t&&"undefined"!=typeof t){var e=t.constructor===Array||"function"==typeof t.callee;if("object"==typeof t||e||(t=[t]),e)for(var r=0,o=t.length;o>r;r++)n.call(null,t[r],r,t);else for(var i in t)t.hasOwnProperty(i)&&n.call(null,t[i],i,t)}}function d(){var t={};return h(arguments,function(n){h(n,function(n,e){t[e]=n})}),t}var v=Object.prototype.toString;t.exports={isArray:n,isArrayBuffer:e,isFormData:r,isArrayBufferView:o,isString:i,isNumber:u,isObject:s,isUndefined:c,isDate:a,isFile:f,isBlob:l,forEach:h,merge:d,trim:p}},function(t,n,e){var r=e(12),o=e(13),i=e(17),u=e(18),c=e(19),s=e(20),a=e(21);t.exports=function(t,n,e){var f=s(e.data,e.headers,e.transformRequest),l=o.merge(r.headers.common,r.headers[e.method]||{},e.headers||{});o.isFormData(f)&&delete l["Content-Type"];var p=new(XMLHttpRequest||ActiveXObject)("Microsoft.XMLHTTP");p.open(e.method.toUpperCase(),i(e.url,e.params),!0),p.onreadystatechange=function(){if(p&&4===p.readyState){var r=c(p.getAllResponseHeaders()),o={data:s(p.responseText,r,e.transformResponse),status:p.status,headers:r,config:e};(p.status>=200&&p.status<300?t:n)(o),p=null}};var h=a(e.url)?u.read(e.xsrfCookieName||r.xsrfCookieName):void 0;if(h&&(l[e.xsrfHeaderName||r.xsrfHeaderName]=h),o.forEach(l,function(t,n){f||"content-type"!==n.toLowerCase()?p.setRequestHeader(n,t):delete l[n]}),e.withCredentials&&(p.withCredentials=!0),e.responseType)try{p.responseType=e.responseType}catch(d){if("json"!==p.responseType)throw d}o.isArrayBuffer(f)&&(f=new DataView(f)),p.send(f)}},function(t){t.exports=function(t){return function(n){t.apply(null,n)}}},function(t){function n(){}var e=t.exports={};e.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,n="undefined"!=typeof window&&window.MutationObserver,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};var r=[];if(n){var o=document.createElement("div"),i=new MutationObserver(function(){var t=r.slice();r.length=0,t.forEach(function(t){t()})});return i.observe(o,{attributes:!0}),function(t){r.length||o.setAttribute("yes","no"),r.push(t)}}return e?(window.addEventListener("message",function(t){var n=t.source;if((n===window||null===n)&&"process-tick"===t.data&&(t.stopPropagation(),r.length>0)){var e=r.shift();e()}},!0),function(t){r.push(t),window.postMessage("process-tick","*")}):function(t){setTimeout(t,0)}}(),e.title="browser",e.browser=!0,e.env={},e.argv=[],e.on=n,e.addListener=n,e.once=n,e.off=n,e.removeListener=n,e.removeAllListeners=n,e.emit=n,e.binding=function(){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(){throw new Error("process.chdir is not supported")}},function(t,n,e){"use strict";function r(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}var o=e(13);t.exports=function(t,n){if(!n)return t;var e=[];return o.forEach(n,function(t,n){null!==t&&"undefined"!=typeof t&&(o.isArray(t)||(t=[t]),o.forEach(t,function(t){o.isDate(t)?t=t.toISOString():o.isObject(t)&&(t=JSON.stringify(t)),e.push(r(n)+"="+r(t))}))}),e.length>0&&(t+=(-1===t.indexOf("?")?"?":"&")+e.join("&")),t}},function(t,n,e){"use strict";var r=e(13);t.exports={write:function(t,n,e,o,i,u){var c=[];c.push(t+"="+encodeURIComponent(n)),r.isNumber(e)&&c.push("expires="+new Date(e).toGMTString()),r.isString(o)&&c.push("path="+o),r.isString(i)&&c.push("domain="+i),u===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(t){var n=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}},function(t,n,e){"use strict";var r=e(13);t.exports=function(t){var n,e,o,i={};return t?(r.forEach(t.split("\n"),function(t){o=t.indexOf(":"),n=r.trim(t.substr(0,o)).toLowerCase(),e=r.trim(t.substr(o+1)),n&&(i[n]=i[n]?i[n]+", "+e:e)}),i):i}},function(t,n,e){"use strict";var r=e(13);t.exports=function(t,n,e){return r.forEach(e,function(e){t=e(t,n)}),t}},function(t,n,e){"use strict";function r(t){var n=t;return o&&(u.setAttribute("href",n),n=u.href),u.setAttribute("href",n),{href:u.href,protocol:u.protocol?u.protocol.replace(/:$/,""):"",host:u.host,search:u.search?u.search.replace(/^\?/,""):"",hash:u.hash?u.hash.replace(/^#/,""):"",hostname:u.hostname,port:u.port,pathname:"/"===u.pathname.charAt(0)?u.pathname:"/"+u.pathname}}var o=/(msie|trident)/i.test(navigator.userAgent),i=e(13),u=document.createElement("a"),c=r(window.location.href);t.exports=function(t){var n=i.isString(t)?r(t):t;return n.protocol===c.protocol&&n.host===c.host}},function(t){!function(n,e,r){"use strict";function o(t){return null!==t&&("object"==typeof t||"function"==typeof t)}function i(t){return"function"==typeof t}function u(t,n,e){t&&!me(t=e?t:t[yn],Me)&&ke(t,Me,n)}function c(t){return ie.call(t).slice(8,-1)}function s(t){var n,e;return t==r?t===r?"Undefined":"Null":"string"==typeof(e=(n=Sn(t))[Me])?e:c(n)}function a(){for(var t=A(this),n=arguments.length,e=An(n),r=0,o=Ge._,i=!1;n>r;)(e[r]=arguments[r++])===o&&(i=!0);return function(){var r,u=this,c=arguments.length,s=0,a=0;if(!i&&!c)return l(t,e,u);if(r=e.slice(),i)for(;n>s;s++)r[s]===o&&(r[s]=arguments[a++]);for(;c>a;)r.push(arguments[a++]);return l(t,r,u)}}function f(t,n,e){if(A(t),~e&&n===r)return t;switch(e){case 1:return function(e){return t.call(n,e)};case 2:return function(e,r){return t.call(n,e,r)};case 3:return function(e,r,o){return t.call(n,e,r,o)}}return function(){return t.apply(n,arguments)}}function l(t,n,e){var o=e===r;switch(0|n.length){case 0:return o?t():t.call(e);case 1:return o?t(n[0]):t.call(e,n[0]);case 2:return o?t(n[0],n[1]):t.call(e,n[0],n[1]);case 3:return o?t(n[0],n[1],n[2]):t.call(e,n[0],n[1],n[2]);case 4:return o?t(n[0],n[1],n[2],n[3]):t.call(e,n[0],n[1],n[2],n[3]);case 5:return o?t(n[0],n[1],n[2],n[3],n[4]):t.call(e,n[0],n[1],n[2],n[3],n[4])}return t.apply(e,n)}function p(t){return ye(S(t))}function h(t){return t}function d(){return this}function v(t,n){return me(t,n)?t[n]:void 0}function g(t){return T(t),ve?de(t).concat(ve(t)):de(t)}function m(t,n){for(var e,r=p(t),o=he(r),i=o.length,u=0;i>u;)if(r[e=o[u++]]===n)return e}function y(t){return Tn(t).split(",")}function w(t){var n=1==t,e=2==t,o=3==t,i=4==t,u=6==t,c=5==t||u;return function(s){for(var a,l,p=Sn(S(this)),h=arguments[1],d=ye(p),v=f(s,h,3),g=_(d.length),m=0,y=n?An(g):e?[]:r;g>m;m++)if((c||m in d)&&(a=d[m],l=v(a,m,p),t))if(n)y[m]=l;else if(l)switch(t){case 3:return!0;case 5:return a;case 6:return m;case 2:y.push(a)}else if(i)return!1;return u?-1:o||i?i:y}}function b(t){return function(n){var e=p(this),r=_(e.length),o=O(arguments[1],r);if(t&&n!=n){for(;r>o;o++)if(E(e[o]))return t||o}else for(;r>o;o++)if((t||o in e)&&e[o]===n)return t||o;return!t&&-1}}function x(t,n){return"function"==typeof t?t:n}function E(t){return t!=t}function j(t){return isNaN(t)?0:Ae(t)}function _(t){return t>0?Ne(j(t),Ee):0}function O(t,n){var t=j(t);return 0>t?Pe(t+n,0):Ne(t,n)}function I(t,n,e){var r=o(n)?function(t){return n[t]}:n;return function(n){return Tn(e?n:this).replace(t,r)}}function P(t){return function(n){var e,o,i=Tn(S(this)),u=j(n),c=i.length;return 0>u||u>=c?t?"":r:(e=i.charCodeAt(u),55296>e||e>56319||u+1===c||(o=i.charCodeAt(u+1))<56320||o>57343?t?i.charAt(u):e:t?i.slice(u,u+2):(e-55296<<10)+(o-56320)+65536)}}function N(t,n,e){if(!t)throw Un(e?n+e:n)}function S(t){if(t==r)throw Un("Function called on null or undefined");return t}function A(t){return N(i(t),t," is not a function!"),t}function T(t){return N(o(t),t," is not an object!"),t}function L(t,n,e){N(t instanceof n,e,": use the 'new' operator!")}function k(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}function C(t,n,e){return t[n]=e,t}function F(t){return Te?function(n,e,r){return le(n,e,k(t,r))}:C}function q(t){return dn+"("+t+")_"+(++Le+Se())[bn](36)}function R(t,n){return Mn&&Mn[t]||(n?Mn:Fe)(dn+re+t)}function M(t,n){for(var e in n)ke(t,e,n[e]);return t}function D(t){!Te||!e&&oe(t)||le(t,De,{configurable:!0,get:d})}function U(t,r,o){var u,c,s,a,l=t&Ve,p=l?n:t&$e?n[r]:(n[r]||te)[yn],h=l?Be:Be[r]||(Be[r]={});l&&(o=r);for(u in o)c=!(t&Je)&&p&&u in p&&(!i(p[u])||oe(p[u])),s=(c?p:o)[u],e||!l||i(p[u])?t&Xe&&c?a=f(s,n):t&He&&!e&&p[u]==s?(a=function(t){return this instanceof s?new s(t):s(t)},a[yn]=s[yn]):a=t&We&&i(s)?f(ue,s):s:a=o[u],e&&p&&!c&&(l?p[u]=s:delete p[u]&&ke(p,u,s)),h[u]!=s&&ke(h,u,a)}function B(t,n){ke(t,tn,n),On in Zn&&ke(t,On,n)}function G(t,n,e,r){t[yn]=se(r||tr,{next:k(1,e)}),u(t,n+" Iterator")}function z(t,n,r,o){var i=t[yn],c=v(i,tn)||v(i,On)||o&&v(i,o)||r;if(e&&(B(i,c),c!==r)){var s=ae(c.call(new t));u(s,n+" Iterator",!0),me(i,On)&&B(s,d)}return Ze[n]=c,Ze[n+" Iterator"]=d,c}function J(t,n,e,r,o,i){function u(t){return function(){return new e(this,t)}}G(e,n,r);var c=u(Ke+Qe),s=u(Qe);o==Qe?s=z(t,n,s,"values"):c=z(t,n,c,"entries"),o&&U(We+Je*nr,n,{entries:c,keys:i?s:u(Ke),values:s})}function V(t,n){return{value:n,done:!!t}}function $(t){var e=Sn(t),r=n[dn],o=(r&&r[_n]||On)in e;return o||tn in e||me(Ze,s(e))}function W(t){var e=n[dn],r=t[e&&e[_n]||On],o=r||t[tn]||Ze[s(t)];return T(o.call(t))}function X(t,n,e){return e?l(t,n):t(n)}function H(t){var n=!0,e={next:function(){throw 1},"return":function(){n=!1}};e[tn]=d;try{t(e)}catch(r){}return n}function Y(t){var n=t["return"];n!==r&&n.call(t)}function K(t,n){try{t(n)}catch(e){throw Y(n),e}}function Q(t,n,e,r){K(function(t){for(var o,i=f(e,r,n?2:1);!(o=t.next()).done;)if(X(i,o.value,n)===!1)return Y(t)},W(t))}var Z,tn,nn,en="Object",rn="Function",on="Array",un="String",cn="Number",sn="RegExp",an="Date",fn="Map",ln="Set",pn="WeakMap",hn="WeakSet",dn="Symbol",vn="Promise",gn="Math",mn="Arguments",yn="prototype",wn="constructor",bn="toString",xn=bn+"Tag",En="hasOwnProperty",jn="forEach",_n="iterator",On="@@"+_n,In="process",Pn="createElement",Nn=n[rn],Sn=n[en],An=n[on],Tn=n[un],Ln=n[cn],kn=n[sn],Cn=(n[an],n[fn]),Fn=n[ln],qn=n[pn],Rn=n[hn],Mn=n[dn],Dn=n[gn],Un=n.TypeError,Bn=n.RangeError,Gn=n.setTimeout,zn=n.setImmediate,Jn=n.clearImmediate,Vn=n.parseInt,$n=n.isFinite,Wn=n[In],Xn=Wn&&Wn.nextTick,Hn=n.document,Yn=Hn&&Hn.documentElement,Kn=(n.navigator,n.define),Qn=n.console||{},Zn=An[yn],te=Sn[yn],ne=Nn[yn],ee=1/0,re=".",oe=f(/./.test,/\[native code\]\s*\}\s*$/,1),ie=te[bn],ue=ne.call,ce=ne.apply,se=Sn.create,ae=Sn.getPrototypeOf,fe=Sn.setPrototypeOf,le=Sn.defineProperty,pe=(Sn.defineProperties,Sn.getOwnPropertyDescriptor),he=Sn.keys,de=Sn.getOwnPropertyNames,ve=Sn.getOwnPropertySymbols,ge=Sn.isFrozen,me=f(ue,te[En],2),ye=Sn,we=Sn.assign||function(t){for(var n=Sn(S(t)),e=arguments.length,r=1;e>r;)for(var o,i=ye(arguments[r++]),u=he(i),c=u.length,s=0;c>s;)n[o=u[s++]]=i[o];return n},be=Zn.push,xe=(Zn.unshift,Zn.slice,Zn.splice,Zn.indexOf,Zn[jn]),Ee=9007199254740991,je=Dn.pow,_e=Dn.abs,Oe=Dn.ceil,Ie=Dn.floor,Pe=Dn.max,Ne=Dn.min,Se=Dn.random,Ae=Dn.trunc||function(t){return(t>0?Ie:Oe)(t)},Te=!!function(){try{return 2==le({},"a",{get:function(){return 2}}).a}catch(t){}}(),Le=0,ke=F(1),Ce=Mn?C:ke,Fe=Mn||q,qe=R("unscopables"),Re=Zn[qe]||{},Me=R(xn),De=R("species"),Ue=c(Wn)==In,Be={},Ge=e?n:Be,ze=n.core,Je=1,Ve=2,$e=4,We=8,Xe=16,He=32;"undefined"!=typeof t&&t.exports?t.exports=Be:i(Kn)&&Kn.amd?Kn(function(){return Be}):nn=!0,(nn||e)&&(Be.noConflict=function(){return n.core=ze,Be},n.core=Be),tn=R(_n);var Ye=Fe("iter"),Ke=1,Qe=2,Ze={},tr={},nr="keys"in Zn&&!("next"in[].keys());B(tr,d),!function(t,e,r,o){oe(Mn)||(Mn=function(n){N(!(this instanceof Mn),dn+" is not a "+wn);var e=q(n),i=Ce(se(Mn[yn]),t,e);return r[e]=i,Te&&o&&le(te,e,{configurable:!0,set:function(t){ke(this,e,t)}}),i},ke(Mn[yn],bn,function(){return this[t]})),U(Ve+He,{Symbol:Mn});var i={"for":function(t){return me(e,t+="")?e[t]:e[t]=Mn(t)},iterator:tn||R(_n),keyFor:a.call(m,e),species:De,toStringTag:Me=R(xn,!0),unscopables:qe,pure:Fe,set:Ce,useSetter:function(){o=!0},useSimple:function(){o=!1}};xe.call(y("hasInstance,isConcatSpreadable,match,replace,search,split,toPrimitive"),function(t){i[t]=R(t)}),U($e,dn,i),u(Mn,dn),U($e+Je*!oe(Mn),en,{getOwnPropertyNames:function(t){for(var n,e=de(p(t)),o=[],i=0;e.length>i;)me(r,n=e[i++])||o.push(n);return o},getOwnPropertySymbols:function(t){for(var n,e=de(p(t)),o=[],i=0;e.length>i;)me(r,n=e[i++])&&o.push(r[n]);return o}}),u(Dn,gn,!0),u(n.JSON,"JSON",!0)}(Fe("tag"),{},{},!0),!function(){var t={assign:we,is:function(t,n){return t===n?0!==t||1/t===1/n:t!=t&&n!=n}};"__proto__"in te&&function(n,e){try{e=f(ue,pe(te,"__proto__").set,2),e({},Zn)}catch(r){n=!0}t.setPrototypeOf=fe=fe||function(t,r){return T(t),N(null===r||o(r),r,": can't set as prototype!"),n?t.__proto__=r:e(t,r),t}}(),U($e,en,t)}(),!function(t){t[Me]=re,c(t)!=re&&ke(te,bn,function(){return"[object "+s(this)+"]"})}({}),!function(){function t(t,n){var e=Sn[t],r=Be[en][t],i=0,u={};if(!r||oe(r)){u[t]=1==n?function(t){return o(t)?e(t):t}:2==n?function(t){return o(t)?e(t):!0}:3==n?function(t){return o(t)?e(t):!1}:4==n?function(t,n){return e(p(t),n)}:function(t){return e(p(t))};try{e(re)}catch(c){i=1}U($e+Je*i,en,u)}}t("freeze",1),t("seal",1),t("preventExtensions",1),t("isFrozen",2),t("isSealed",2),t("isExtensible",3),t("getOwnPropertyDescriptor",4),t("getPrototypeOf"),t("keys"),t("getOwnPropertyNames")}(),!function(t){t in ne||Te&&le(ne,t,{configurable:!0,get:function(){var n=Tn(this).match(/^\s*function ([^ (]*)/),e=n?n[1]:"";return me(this,t)||le(this,t,k(5,e)),e},set:function(n){me(this,t)||le(this,t,k(0,n))}})}("name"),Ln("0o1")&&Ln("0b1")||function(t,e){function r(t){if(o(t)&&(t=u(t)),"string"==typeof t&&t.length>2&&48==t.charCodeAt(0)){var n=!1;switch(t.charCodeAt(1)){case 66:case 98:n=!0;case 79:case 111:return Vn(t.slice(2),n?2:8)}}return+t}function u(t){var n,e;if(i(n=t.valueOf)&&!o(e=n.call(t)))return e;if(i(n=t[bn])&&!o(e=n.call(t)))return e;throw Un("Can't convert object to number")}Ln=function c(n){return this instanceof c?new t(r(n)):r(n)},xe.call(Te?de(t):y("MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY"),function(n){n in Ln||le(Ln,n,pe(t,n))}),Ln[yn]=e,e[wn]=Ln,ke(n,cn,Ln)}(Ln,Ln[yn]),!function(t){U($e,cn,{EPSILON:je(2,-52),isFinite:function(t){return"number"==typeof t&&$n(t)},isInteger:t,isNaN:E,isSafeInteger:function(n){return t(n)&&_e(n)<=Ee},MAX_SAFE_INTEGER:Ee,MIN_SAFE_INTEGER:-Ee,parseFloat:parseFloat,parseInt:Vn})}(Ln.isInteger||function(t){return!o(t)&&$n(t)&&Ie(t)===t}),!function(){function t(n){return $n(n=+n)&&0!=n?0>n?-t(-n):o(n+i(n*n+1)):n}function n(t){return 0==(t=+t)?t:t>-1e-6&&1e-6>t?t+t*t/2:r(t)-1}var e=Dn.E,r=Dn.exp,o=Dn.log,i=Dn.sqrt,u=Dn.sign||function(t){return 0==(t=+t)||t!=t?t:0>t?-1:1};U($e,gn,{acosh:function(t){return(t=+t)<1?0/0:$n(t)?o(t/e+i(t+1)*i(t-1)/e)+1:t},asinh:t,atanh:function(t){return 0==(t=+t)?t:o((1+t)/(1-t))/2},cbrt:function(t){return u(t=+t)*je(_e(t),1/3)},clz32:function(t){return(t>>>=0)?32-t[bn](2).length:32},cosh:function(t){return(r(t=+t)+r(-t))/2},expm1:n,fround:function(t){return new Float32Array([t])[0]},hypot:function(){for(var t,n=0,e=arguments.length,r=e,o=An(e),u=-ee;e--;){if(t=o[e]=+arguments[e],t==ee||t==-ee)return ee;t>u&&(u=t)}for(u=t||1;r--;)n+=je(o[r]/u,2);return u*i(n)},imul:function(t,n){var e=65535,r=+t,o=+n,i=e&r,u=e&o;return 0|i*u+((e&r>>>16)*u+i*(e&o>>>16)<<16>>>0)},log1p:function(t){return(t=+t)>-1e-8&&1e-8>t?t-t*t/2:o(1+t)},log10:function(t){return o(t)/Dn.LN10},log2:function(t){return o(t)/Dn.LN2},sign:u,sinh:function(t){return _e(t=+t)<1?(n(t)-n(-t))/2:(r(t-1)-r(-t-1))*(e/2)},tanh:function(t){var e=n(t=+t),o=n(-t);return e==ee?1:o==ee?-1:(e-o)/(r(t)+r(-t))},trunc:Ae})}(),!function(t){function n(t){if(c(t)==sn)throw Un()}U($e,un,{fromCodePoint:function(){for(var n,e=[],r=arguments.length,o=0;r>o;){if(n=+arguments[o++],O(n,1114111)!==n)throw Bn(n+" is not a valid code point");e.push(65536>n?t(n):t(((n-=65536)>>10)+55296,n%1024+56320))}return e.join("")},raw:function(t){for(var n=p(t.raw),e=_(n.length),r=arguments.length,o=[],i=0;e>i;)o.push(Tn(n[i++])),r>i&&o.push(Tn(arguments[i]));return o.join("")}}),U(We,un,{codePointAt:P(!1),endsWith:function(t){n(t);var e=Tn(S(this)),o=arguments[1],i=_(e.length),u=o===r?i:Ne(_(o),i);return t+="",e.slice(u-t.length,u)===t},includes:function(t){return n(t),!!~Tn(S(this)).indexOf(t,arguments[1])},repeat:function(t){var n=Tn(S(this)),e="",r=j(t);if(0>r||r==ee)throw Bn("Count can't be negative");for(;r>0;(r>>>=1)&&(n+=n))1&r&&(e+=n);return e},startsWith:function(t){n(t);var e=Tn(S(this)),r=_(Ne(arguments[1],e.length));return t+="",e.slice(r,r+t.length)===t}})}(Tn.fromCharCode),!function(){U($e+Je*H(An.from),on,{from:function(t){var n,e,o,i=Sn(S(t)),u=arguments[1],c=u!==r,s=c?f(u,arguments[2],2):r,a=0;if($(i))e=new(x(this,An)),K(function(t){for(;!(o=t.next()).done;a++)e[a]=c?s(o.value,a):o.value},W(i));else for(e=new(x(this,An))(n=_(i.length));n>a;a++)e[a]=c?s(i[a],a):i[a];return e.length=a,e}}),U($e,on,{of:function(){for(var t=0,n=arguments.length,e=new(x(this,An))(n);n>t;)e[t]=arguments[t++];return e.length=n,e}}),D(An)}(),!function(){U(We,on,{copyWithin:function(t,n){var e=Sn(S(this)),o=_(e.length),i=O(t,o),u=O(n,o),c=arguments[2],s=c===r?o:O(c,o),a=Ne(s-u,o-i),f=1;for(i>u&&u+a>i&&(f=-1,u=u+a-1,i=i+a-1);a-->0;)u in e?e[i]=e[u]:delete e[i],i+=f,u+=f;return e},fill:function(t){for(var n=Sn(S(this)),e=_(n.length),o=O(arguments[1],e),i=arguments[2],u=i===r?e:O(i,e);u>o;)n[o++]=t;return n},find:w(5),findIndex:w(6)}),e&&(xe.call(y("find,findIndex,fill,copyWithin,entries,keys,values"),function(t){Re[t]=!0}),qe in Zn||ke(Zn,qe,Re))}(),!function(t){J(An,on,function(t,n){Ce(this,Ye,{o:p(t),i:0,k:n})},function(){var t=this[Ye],n=t.o,e=t.k,o=t.i++;return!n||o>=n.length?(t.o=r,V(1)):e==Ke?V(0,o):e==Qe?V(0,n[o]):V(0,[o,n[o]])},Qe),Ze[mn]=Ze[on],J(Tn,un,function(t){Ce(this,Ye,{o:Tn(t),i:0})},function(){var n,e=this[Ye],r=e.o,o=e.i;return o>=r.length?V(1):(n=t.call(r,o),e.i+=n.length,V(0,n))})}(P(!0)),Te&&!function(t,e){(function(){try{return"/a/i"==kn(/a/g,"i")}catch(t){}})()||(kn=function(t,n){return new e(c(t)==sn&&n!==r?t.source:t,n)},xe.call(de(e),function(t){t in kn||le(kn,t,{configurable:!0,get:function(){return e[t]},set:function(n){e[t]=n}})}),t[wn]=kn,kn[yn]=t,ke(n,sn,kn)),"g"!=/./g.flags&&le(t,"flags",{configurable:!0,get:I(/^.*\/(\w*)$/,"$1")}),D(kn)}(kn[yn],kn),i(zn)&&i(Jn)||function(t){function e(t){if(me(v,t)){var n=v[t];delete v[t],n()}}function r(t){e(t.data)}var o,u,c,s=n.postMessage,p=n.addEventListener,h=n.MessageChannel,d=0,v={};zn=function(t){for(var n=[],e=1;arguments.length>e;)n.push(arguments[e++]);return v[++d]=function(){l(i(t)?t:Nn(t),n)},o(d),d},Jn=function(t){delete v[t]},Ue?o=function(t){Xn(a.call(e,t))}:p&&i(s)&&!n.importScripts?(o=function(t){s(t,"*")},p("message",r,!1)):i(h)?(u=new h,c=u.port2,u.port1.onmessage=r,o=f(c.postMessage,c,1)):o=Hn&&t in Hn[Pn]("script")?function(n){Yn.appendChild(Hn[Pn]("script"))[t]=function(){Yn.removeChild(this),e(n)}}:function(t){Gn(e,0,t)}}("onreadystatechange"),U(Ve+Xe,{setImmediate:zn,clearImmediate:Jn}),!function(t,n){i(t)&&i(t.resolve)&&t.resolve(n=new t(function(){}))==n||function(n,e){function u(t){var n;return o(t)&&(n=t.then),i(n)?n:!1}function c(t){var n,r=t[e],o=r.c,i=0;if(r.h)return!0;for(;o.length>i;)if(n=o[i++],n.fail||c(n.P))return!0}function s(t,e){var r=t.c;(e||r.length)&&n(function(){var n=t.p,o=t.v,s=1==t.s,a=0;if(e&&!c(n))Gn(function(){c(n)||(Ue?!Wn.emit("unhandledRejection",o,n):i(Qn.error)&&Qn.error("Unhandled promise rejection",o))},1e3);else for(;r.length>a;)!function(n){var e,r,i=s?n.ok:n.fail;try{i?(s||(t.h=!0),e=i===!0?o:i(o),e===n.P?n.rej(Un(vn+"-chain cycle")):(r=u(e))?r.call(e,n.res,n.rej):n.res(e)):n.rej(o)}catch(c){n.rej(c)}}(r[a++]);r.length=0})}function a(t){var n,e,r=this;if(!r.d){r.d=!0,r=r.r||r;try{(n=u(t))?(e={r:r,d:!1},n.call(t,f(a,e,1),f(l,e,1))):(r.v=t,r.s=1,s(r))}catch(o){l.call(e||{r:r,d:!1},o)}}}function l(t){var n=this;n.d||(n.d=!0,n=n.r||n,n.v=t,n.s=2,s(n,!0))}function p(t){var n=T(t)[De];return n!=r?n:t}t=function(n){A(n),L(this,t,vn);var o={p:this,c:[],s:0,d:!1,v:r,h:!1};ke(this,e,o);try{n(f(a,o,1),f(l,o,1))}catch(i){l.call(o,i)}},M(t[yn],{then:function(n,o){var u=T(T(this)[wn])[De],c={ok:i(n)?n:!0,fail:i(o)?o:!1},a=c.P=new(u!=r?u:t)(function(t,n){c.res=A(t),c.rej=A(n)}),f=this[e];return f.c.push(c),f.s&&s(f),a},"catch":function(t){return this.then(r,t)}}),M(t,{all:function(t){var n=p(this),e=[];return new n(function(r,o){Q(t,!1,be,e);var i=e.length,u=An(i);i?xe.call(e,function(t,e){n.resolve(t).then(function(t){u[e]=t,--i||r(u)},o)}):r(u)})},race:function(t){var n=p(this);return new n(function(e,r){Q(t,!1,function(t){n.resolve(t).then(e,r)})})},reject:function(t){return new(p(this))(function(n,e){e(t)})},resolve:function(t){return o(t)&&e in t&&ae(t)===this[yn]?t:new(p(this))(function(n){n(t)})}})}(Xn||zn,Fe("record")),u(t,vn),D(t),U(Ve+Je*!oe(t),{Promise:t})}(n[vn]),!function(){function t(t,n,o,i,c,s){function a(t,n){return n!=r&&Q(n,c,t[h],t),t}function f(t,n){var r=d[t];e&&(d[t]=function(t,e){var o=r.call(this,0===t?0:t,e);return n?this:o})}var h=c?"set":"add",d=t&&t[yn],y={};if(oe(t)&&(s||!nr&&me(d,jn)&&me(d,"entries"))){var b,x=t,E=new t,j=E[h](s?{}:-0,1);H(function(n){new t(n)})&&(t=function(e){return L(this,t,n),a(new x,e)},t[yn]=d,e&&(d[wn]=t)),s||E[jn](function(t,n){b=1/n===-ee}),b&&(f("delete"),f("has"),c&&f("get")),(b||j!==E)&&f(h,!0)}else t=s?function(e){L(this,t,n),Ce(this,l,w++),a(this,e)}:function(e){var o=this;L(o,t,n),Ce(o,p,se(null)),Ce(o,m,0),Ce(o,v,r),Ce(o,g,r),a(o,e)},M(M(t[yn],o),i),s||!Te||le(t[yn],"size",{get:function(){return S(this[m])}});return u(t,n),D(t),y[n]=t,U(Ve+He+Je*!oe(t),y),s||J(t,n,function(t,n){Ce(this,Ye,{o:t,k:n})},function(){for(var t=this[Ye],n=t.k,e=t.l;e&&e.r;)e=e.p;return t.o&&(t.l=e=e?e.n:t.o[g])?n==Ke?V(0,e.k):n==Qe?V(0,e.v):V(0,[e.k,e.v]):(t.o=r,V(1))},c?Ke+Qe:Qe,!c),t}function n(t,n){if(!o(t))return("string"==typeof t?"S":"P")+t;if(ge(t))return"F";if(!me(t,l)){if(!n)return"E";ke(t,l,++w)}return"O"+t[l]}function i(t,e){var r,o=n(e);if("F"!=o)return t[p][o];for(r=t[g];r;r=r.n)if(r.k==e)return r}function c(t,e,o){var u,c,s=i(t,e);return s?s.v=o:(t[v]=s={i:c=n(e,!0),k:e,v:o,p:u=t[v],n:r,r:!1},t[g]||(t[g]=s),u&&(u.n=s),t[m]++,"F"!=c&&(t[p][c]=s)),t}function s(t,n,e){return ge(T(n))?a(t).set(n,e):(me(n,h)||ke(n,h,{}),n[h][t[l]]=e),t}function a(t){return t[d]||ke(t,d,new Cn)[d]}var l=Fe("uid"),p=Fe("O1"),h=Fe("weak"),d=Fe("leak"),v=Fe("last"),g=Fe("first"),m=Te?Fe("size"):"size",w=0,b={},x={clear:function(){for(var t=this,n=t[p],e=t[g];e;e=e.n)e.r=!0,e.p&&(e.p=e.p.n=r),delete n[e.i]; | ||
t[g]=t[v]=r,t[m]=0},"delete":function(t){var n=this,e=i(n,t);if(e){var r=e.n,o=e.p;delete n[p][e.i],e.r=!0,o&&(o.n=r),r&&(r.p=o),n[g]==e&&(n[g]=r),n[v]==e&&(n[v]=o),n[m]--}return!!e},forEach:function(t){for(var n,e=f(t,arguments[1],3);n=n?n.n:this[g];)for(e(n.v,n.k,this);n&&n.r;)n=n.p},has:function(t){return!!i(this,t)}};Cn=t(Cn,fn,{get:function(t){var n=i(this,t);return n&&n.v},set:function(t,n){return c(this,0===t?0:t,n)}},x,!0),Fn=t(Fn,ln,{add:function(t){return c(this,t=0===t?0:t,t)}},x);var E={"delete":function(t){return o(t)?ge(t)?a(this)["delete"](t):me(t,h)&&me(t[h],this[l])&&delete t[h][this[l]]:!1},has:function(t){return o(t)?ge(t)?a(this).has(t):me(t,h)&&me(t[h],this[l]):!1}};qn=t(qn,pn,{get:function(t){if(o(t)){if(ge(t))return a(this).get(t);if(me(t,h))return t[h][this[l]]}},set:function(t,n){return s(this,t,n)}},E,!0,!0),e&&7!=(new qn).set(Sn.freeze(b),7).get(b)&&xe.call(y("delete,has,get,set"),function(t){var n=qn[yn][t];qn[yn][t]=function(e,r){if(o(e)&&ge(e)){var i=a(this)[t](e,r);return"set"==t?this:i}return n.call(this,e,r)}}),Rn=t(Rn,hn,{add:function(t){return s(this,t,!0)}},E,!1,!0)}(),!function(){function t(t){var n,e=[];for(n in t)e.push(n);Ce(this,Ye,{o:t,a:e,i:0})}function n(t){return function(n){T(n);try{return t.apply(r,arguments),!0}catch(e){return!1}}}function e(t,n){var i,u=arguments.length<3?t:arguments[2],c=pe(T(t),n);return c?me(c,"value")?c.value:c.get===r?r:c.get.call(u):o(i=ae(t))?e(i,n,u):r}function i(t,n,e){var u,c,s=arguments.length<4?t:arguments[3],a=pe(T(t),n);if(!a){if(o(c=ae(t)))return i(c,n,e,s);a=k(0)}return me(a,"value")?a.writable!==!1&&o(s)?(u=pe(s,n)||k(0),u.value=e,le(s,n,u),!0):!1:a.set===r?!1:(a.set.call(s,e),!0)}G(t,en,function(){var t,n=this[Ye],e=n.a;do if(n.i>=e.length)return V(1);while(!((t=e[n.i++])in n.o));return V(0,t)});var u=Sn.isExtensible||h,c={apply:f(ue,ce,3),construct:function(t,n){var e=A(arguments.length<3?t:arguments[2])[yn],r=se(o(e)?e:te),i=ce.call(t,r,n);return o(i)?i:r},defineProperty:n(le),deleteProperty:function(t,n){var e=pe(T(t),n);return e&&!e.configurable?!1:delete t[n]},enumerate:function(n){return new t(T(n))},get:e,getOwnPropertyDescriptor:function(t,n){return pe(T(t),n)},getPrototypeOf:function(t){return ae(T(t))},has:function(t,n){return n in t},isExtensible:function(t){return!!u(T(t))},ownKeys:g,preventExtensions:n(Sn.preventExtensions||h),set:i};fe&&(c.setPrototypeOf=function(t,n){return fe(T(t),n),!0}),U(Ve,{Reflect:{}}),U($e,"Reflect",c)}(),!function(){function t(t){return function(n){var e,r=p(n),o=he(n),i=o.length,u=0,c=An(i);if(t)for(;i>u;)c[u]=[e=o[u++],r[e]];else for(;i>u;)c[u]=r[o[u++]];return c}}U(We,on,{includes:b(!0)}),U(We,un,{at:P(!0)}),U($e,en,{getOwnPropertyDescriptors:function(t){var n=p(t),e={};return xe.call(g(n),function(t){le(e,t,k(0,pe(n,t)))}),e},values:t(!1),entries:t(!0)}),U($e,sn,{escape:I(/([\\\-[\]{}()*+?.,^$|])/g,"\\$1",!0)})}(),!function(t){function n(t){if(t){var n=t[yn];ke(n,Z,n.get),ke(n,e,n.set),ke(n,r,n["delete"])}}Z=R(t+"Get",!0);var e=R(t+ln,!0),r=R(t+"Delete",!0);U($e,dn,{referenceGet:Z,referenceSet:e,referenceDelete:r}),ke(ne,Z,d),n(Cn),n(qn)}("reference"),!function(t){function n(n,e){xe.call(y(n),function(n){n in Zn&&(t[n]=f(ue,Zn[n],e))})}n("pop,reverse,shift,keys,values,entries",1),n("indexOf,every,some,forEach,map,filter,find,findIndex,includes",3),n("join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill,turn"),U($e,on,t)}({}),!function(t){!e||!t||tn in t[yn]||ke(t[yn],tn,Ze[on]),Ze.NodeList=Ze[on]}(n.NodeList)}("undefined"!=typeof self&&self.Math===Math?self:Function("return this")(),!0)},function(t,n){(function(n){!function(n){"use strict";function e(t,n,e,r){return new u(t,n,e||null,r||[])}function r(t,n,e){try{return{type:"normal",arg:t.call(n,e)}}catch(r){return{type:"throw",arg:r}}}function o(){}function i(){}function u(t,n,e,o){function i(n,o){if(s===w)throw new Error("Generator is already running");if(s===b)return l();for(;;){var i=c.delegate;if(i){var u=r(i.iterator[n],i.iterator,o);if("throw"===u.type){c.delegate=null,n="throw",o=u.arg;continue}n="next",o=p;var a=u.arg;if(!a.done)return s=y,a;c[i.resultName]=a.value,c.next=i.nextLoc,c.delegate=null}if("next"===n){if(s===m&&"undefined"!=typeof o)throw new TypeError("attempt to send "+JSON.stringify(o)+" to newborn generator");s===y?c.sent=o:delete c.sent}else if("throw"===n){if(s===m)throw s=b,o;c.dispatchException(o)&&(n="next",o=p)}else"return"===n&&c.abrupt("return",o);s=w;var u=r(t,e,c);if("normal"===u.type){s=c.done?b:y;var a={value:u.arg,done:c.done};if(u.arg!==x)return a;c.delegate&&"next"===n&&(o=p)}else"throw"===u.type&&(s=b,"next"===n?c.dispatchException(u.arg):o=u.arg)}}var u=n?Object.create(n.prototype):this,c=new a(o),s=m;return u.next=i.bind(u,"next"),u["throw"]=i.bind(u,"throw"),u["return"]=i.bind(u,"return"),u}function c(t){var n={tryLoc:t[0]};1 in t&&(n.catchLoc=t[1]),2 in t&&(n.finallyLoc=t[2],n.afterLoc=t[3]),this.tryEntries.push(n)}function s(t){var n=t.completion||{};n.type="normal",delete n.arg,t.completion=n}function a(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(c,this),this.reset()}function f(t){if(t){var n=t[d];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var e=-1,r=function o(){for(;++e<t.length;)if(h.call(t,e))return o.value=t[e],o.done=!1,o;return o.value=p,o.done=!0,o};return r.next=r}}return{next:l}}function l(){return{value:p,done:!0}}var p,h=Object.prototype.hasOwnProperty,d="function"==typeof Symbol&&Symbol.iterator||"@@iterator",v="object"==typeof t,g=n.regeneratorRuntime;if(g)return void(v&&(t.exports=g));g=n.regeneratorRuntime=v?t.exports:{},g.wrap=e;var m="suspendedStart",y="suspendedYield",w="executing",b="completed",x={},E=i.prototype=u.prototype;o.prototype=E.constructor=i,i.constructor=o,o.displayName="GeneratorFunction",g.isGeneratorFunction=function(t){var n="function"==typeof t&&t.constructor;return n?n===o||"GeneratorFunction"===(n.displayName||n.name):!1},g.mark=function(t){return t.__proto__=i,t.prototype=Object.create(E),t},g.async=function(t,n,o,i){return new Promise(function(u,c){function s(t){var n=r(this,null,t);if("throw"===n.type)return void c(n.arg);var e=n.arg;e.done?u(e.value):Promise.resolve(e.value).then(f,l)}var a=e(t,n,o,i),f=s.bind(a.next),l=s.bind(a["throw"]);f()})},E[d]=function(){return this},E.toString=function(){return"[object Generator]"},g.keys=function(t){var n=[];for(var e in t)n.push(e);return n.reverse(),function r(){for(;n.length;){var e=n.pop();if(e in t)return r.value=e,r.done=!1,r}return r.done=!0,r}},g.values=f,a.prototype={constructor:a,reset:function(){this.prev=0,this.next=0,this.sent=p,this.done=!1,this.delegate=null,this.tryEntries.forEach(s);for(var t,n=0;h.call(this,t="t"+n)||20>n;++n)this[t]=null},stop:function(){this.done=!0;var t=this.tryEntries[0],n=t.completion;if("throw"===n.type)throw n.arg;return this.rval},dispatchException:function(t){function n(n,r){return i.type="throw",i.arg=t,e.next=n,!!r}if(this.done)throw t;for(var e=this,r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var u=h.call(o,"catchLoc"),c=h.call(o,"finallyLoc");if(u&&c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,n){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc<=this.prev&&h.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=n&&n<o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=n,o?this.next=o.finallyLoc:this.complete(i),x},complete:function(t,n){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=t.arg,this.next="end"):"normal"===t.type&&n&&(this.next=n),x},finish:function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var e=this.tryEntries[n];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc)}},"catch":function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var e=this.tryEntries[n];if(e.tryLoc===t){var r=e.completion;if("throw"===r.type){var o=r.arg;s(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,e){return this.delegate={iterator:f(t),resultName:n,nextLoc:e},x}}}("object"==typeof n?n:"object"==typeof window?window:this)}).call(n,function(){return this}())},function(t,n,e){"use strict";var r=e(25).Promise,o=e(26).polyfill;n.Promise=r,n.polyfill=o},function(t,n,e){"use strict";function r(t){if(!g(t))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof r))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._subscribers=[],o(t,this)}function o(t,n){function e(t){a(n,t)}function r(t){l(n,t)}try{t(e,r)}catch(o){r(o)}}function i(t,n,e,r){var o,i,u,c,f=g(e);if(f)try{o=e(r),u=!0}catch(p){c=!0,i=p}else o=r,u=!0;s(n,o)||(f&&u?a(n,o):c?l(n,i):t===_?a(n,o):t===O&&l(n,o))}function u(t,n,e,r){var o=t._subscribers,i=o.length;o[i]=n,o[i+_]=e,o[i+O]=r}function c(t,n){for(var e,r,o=t._subscribers,u=t._detail,c=0;c<o.length;c+=3)e=o[c],r=o[c+n],i(n,e,r,u);t._subscribers=null}function s(t,n){var e,r=null;try{if(t===n)throw new TypeError("A promises callback cannot return that same promise.");if(v(n)&&(r=n.then,g(r)))return r.call(n,function(r){return e?!0:(e=!0,void(n!==r?a(t,r):f(t,r)))},function(n){return e?!0:(e=!0,void l(t,n))}),!0}catch(o){return e?!0:(l(t,o),!0)}return!1}function a(t,n){t===n?f(t,n):s(t,n)||f(t,n)}function f(t,n){t._state===E&&(t._state=j,t._detail=n,d.async(p,t))}function l(t,n){t._state===E&&(t._state=j,t._detail=n,d.async(h,t))}function p(t){c(t,t._state=_)}function h(t){c(t,t._state=O)}var d=e(27).config,v=(e(27).configure,e(28).objectOrFunction),g=e(28).isFunction,m=(e(28).now,e(29).all),y=e(30).race,w=e(31).resolve,b=e(32).reject,x=e(33).asap;d.async=x;var E=void 0,j=0,_=1,O=2;r.prototype={constructor:r,_state:void 0,_detail:void 0,_subscribers:void 0,then:function(t,n){var e=this,r=new this.constructor(function(){});if(this._state){var o=arguments;d.async(function(){i(e._state,r,o[e._state-1],e._detail)})}else u(this,r,t,n);return r},"catch":function(t){return this.then(null,t)}},r.all=m,r.race=y,r.resolve=w,r.reject=b,n.Promise=r},function(t,n,e){(function(t){"use strict";function r(){var n;n="undefined"!=typeof t?t:"undefined"!=typeof window&&window.document?window:self;var e="Promise"in n&&"resolve"in n.Promise&&"reject"in n.Promise&&"all"in n.Promise&&"race"in n.Promise&&function(){var t;return new n.Promise(function(n){t=n}),i(t)}();e||(n.Promise=o)}var o=e(25).Promise,i=e(28).isFunction;n.polyfill=r}).call(n,function(){return this}())},function(t,n){"use strict";function e(t,n){return 2!==arguments.length?r[t]:void(r[t]=n)}var r={instrument:!1};n.config=r,n.configure=e},function(t,n){"use strict";function e(t){return r(t)||"object"==typeof t&&null!==t}function r(t){return"function"==typeof t}function o(t){return"[object Array]"===Object.prototype.toString.call(t)}var i=Date.now||function(){return(new Date).getTime()};n.objectOrFunction=e,n.isFunction=r,n.isArray=o,n.now=i},function(t,n,e){"use strict";function r(t){var n=this;if(!o(t))throw new TypeError("You must pass an array to all.");return new n(function(n,e){function r(t){return function(n){o(t,n)}}function o(t,e){c[t]=e,0===--s&&n(c)}var u,c=[],s=t.length;0===s&&n([]);for(var a=0;a<t.length;a++)u=t[a],u&&i(u.then)?u.then(r(a),e):o(a,u)})}var o=e(28).isArray,i=e(28).isFunction;n.all=r},function(t,n,e){"use strict";function r(t){var n=this;if(!o(t))throw new TypeError("You must pass an array to race.");return new n(function(n,e){for(var r,o=0;o<t.length;o++)r=t[o],r&&"function"==typeof r.then?r.then(n,e):n(r)})}var o=e(28).isArray;n.race=r},function(t,n){"use strict";function e(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var n=this;return new n(function(n){n(t)})}n.resolve=e},function(t,n){"use strict";function e(t){var n=this;return new n(function(n,e){e(t)})}n.reject=e},function(t,n,e){(function(t,e){"use strict";function r(){return function(){e.nextTick(u)}}function o(){var t=0,n=new f(u),e=document.createTextNode("");return n.observe(e,{characterData:!0}),function(){e.data=t=++t%2}}function i(){return function(){l.setTimeout(u,1)}}function u(){for(var t=0;t<p.length;t++){var n=p[t],e=n[0],r=n[1];e(r)}p=[]}function c(t,n){var e=p.push([t,n]);1===e&&s()}var s,a="undefined"!=typeof window?window:{},f=a.MutationObserver||a.WebKitMutationObserver,l="undefined"!=typeof t?t:void 0===this?window:this,p=[];s="undefined"!=typeof e&&"[object process]"==={}.toString.call(e)?r():f?o():i(),n.asap=c}).call(n,function(){return this}(),e(16))}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):"object"==typeof exports?exports.restful=e():t.restful=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t,e){var n={baseUrl:t,port:e||80,prefixUrl:"",protocol:"http"},r=function(){var t={_http:p(f),headers:{},requestInterceptors:[],responseInterceptors:[]},e={url:function(t){var e=function(){return t.apply(this,arguments)};return e.toString=function(){return t.toString()},e}(function(){var t=n.protocol+"://"+n.baseUrl;return 80!==n.port&&(t+=":"+n.port),""!==n.prefixUrl&&(t+="/"+n.prefixUrl),t})};return i(e,t),Object.assign(function(){return t._http},e)}(),o={url:function(){return r.url()},one:function(t,e){return c(t,e,o)},all:function(t){return s(t,o)}};return o=Object.assign(a(r),o),i(o,n),o}var o=function(t){return t&&t.__esModule?t["default"]:t};t.exports=r;var u=o(n(6)),i=o(n(1)),s=o(n(2)),c=o(n(3)),a=o(n(4)),f=o(n(7)),p=o(n(5));u(Object.prototype,{assign:u})},function(t){"use strict";function e(t,e){for(var n in e)e.hasOwnProperty(n)&&!function(n){t[n]=function(r){return arguments.length?(e[n]=r,t):e[n]}}(n)}t.exports=e},function(t,e,n){"use strict";function r(t,e){function n(n){var o=s(t,n,e);return o().headers(r.headers()).responseInterceptors(r.responseInterceptors()).requestInterceptors(r.requestInterceptors()),o}var r=u([e.url(),t].join("/"),e()),o={get:function(t,e,o){return r.get(t,e,o).then(function(t){return i(t,n)})},getAll:function(t,e){return r.getAll(t,e).then(function(t){return i(t,n)})},post:function(t,e){return r.post(t,e).then(function(t){return i(t)})},put:function(t,e,n){return r.put(t,e,n).then(function(t){return i(t)})},patch:function(t,e,n){return r.patch(t,e,n).then(function(t){return i(t)})},head:function(t,e,n){return r.head(t,e,n).then(function(t){return i(t)})},"delete":function(t,e){return r["delete"](t,e).then(function(t){return i(t)})},url:function(){return[e.url(),t].join("/")}};return Object.assign(c(r),o)}var o=function(t){return t&&t.__esModule?t["default"]:t};t.exports=r;var u=o(n(8)),i=o(n(9)),s=o(n(3)),c=o(n(4))},function(t,e,n){"use strict";function r(t,e,n){var o=i([n.url(),t].join("/"),n()),a={get:function(t,n){return o.get(e,t,n).then(function(t){return s(t,function(){return a})})},put:function(t,n){return o.put(e,t,n).then(function(t){return s(t)})},patch:function(t,n){return o.patch(e,t,n).then(function(t){return s(t)})},head:function(t,n){return o.head(e,t,n).then(function(t){return s(t)})},"delete":function(t){return o["delete"](e,t).then(function(t){return s(t)})},one:function(t,e){return r(t,e,a)},all:function(t){return u(t,a)},url:function(){return[n.url(),t,e].join("/")}};return a=Object.assign(c(o),a)}var o=function(t){return t&&t.__esModule?t["default"]:t};t.exports=r;var u=o(n(2)),i=o(n(8)),s=o(n(9)),c=o(n(4))},function(t){"use strict";function e(t){function e(){return t}return e=Object.assign(e,{addRequestInterceptor:function(n){return t.requestInterceptors().push(n),e},requestInterceptors:function(){return t.requestInterceptors()},addResponseInterceptor:function(n){return t.responseInterceptors().push(n),e},responseInterceptors:function(){return t.responseInterceptors},header:function(n,r){return t.headers()[n]=r,e},headers:function(){return t.headers()}})}t.exports=e},function(t){"use strict";function e(t,e,n,r){return r=void 0!==r?!!r:!1,function(o,u){if(r)try{o=JSON.parse(o)}catch(i){}for(var s in t)o=t[s](o,u,e,n);if(!r)try{o=JSON.stringify(o)}catch(i){}return o}}function n(t){var n={request:function(n,r){return r.method=n,-1!==["post","put","patch"].indexOf(n)&&(r.transformRequest=[e(r.requestInterceptors||[],r.method,r.url)],delete r.requestInterceptors),r.transformResponse=[e(r.responseInterceptors||[],r.method,r.url,!0)],delete r.responseInterceptors,t(r)}};return Object.assign(function(){return t},n)}t.exports=n},function(t){"use strict";function e(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=Object.assign||function(t){for(var n,r,o=e(t),u=1;u<arguments.length;u++){n=arguments[u],r=Object.keys(Object(n));for(var i=0;i<r.length;i++)o[r[i]]=n[r[i]]}return o}},function(t,e,n){t.exports=n(10)},function(t,e,n){"use strict";function r(t,e){function n(){for(var t=c,e=[];t;)e=e.concat(t.requestInterceptors()),t=t._parent?t._parent():null;return e}function r(){for(var t=c,e=[];t;)e=e.concat(t.responseInterceptors()),t=t._parent?t._parent():null;return e}function o(){for(var t=c,e={};t;)Object.assign(e,t.headers()),t=t._parent?t._parent():null;return e}function i(t){var e=void 0===arguments[1]?{}:arguments[1],u=void 0===arguments[2]?{}:arguments[2],i=void 0===arguments[3]?null:arguments[3],s={url:t,params:e||{},headers:Object.assign({},o(),u||{}),responseInterceptors:r()};return i&&(s.data=i,s.requestInterceptors=n()),s}var s={_parent:e,headers:{},requestInterceptors:[],responseInterceptors:[]},c={get:function(e,n,r){return s._parent().request("get",i(t+"/"+e,n,r))},getAll:function(e,n){return s._parent().request("get",i(t,e,n))},post:function(e,n){return n=n||{},n["Content-Type"]||(n["Content-Type"]="application/json;charset=UTF-8"),s._parent().request("post",i(t,{},n,e))},put:function(e,n,r){return r=r||{},r["Content-Type"]||(r["Content-Type"]="application/json;charset=UTF-8"),s._parent().request("put",i(t+"/"+e,{},r,n))},patch:function(e,n,r){return r=r||{},r["Content-Type"]||(r["Content-Type"]="application/json;charset=UTF-8"),s._parent().request("patch",i(t+"/"+e,{},r,n))},"delete":function(e,n){return s._parent().request("delete",i(t+"/"+e,{},n))},head:function(e,n){return s._parent().request("head",i(t+"/"+e,{},n))}};return c=Object.assign(function(){return s._parent()},c),u(c,s),c}var o=function(t){return t&&t.__esModule?t["default"]:t};t.exports=r;{var u=o(n(1));o(n(11))}},function(t,e,n){"use strict";var r=function(t){return t&&t.__esModule?t["default"]:t},o=r(n(12));t.exports=function(t,e){return new Promise(function(n,r){var u=t.status;return u>=200&&400>u?n(o(t,e)):void r(o(t))})}},function(t,e,n){(function(e){function r(){s.forEach(arguments,function(t){c[t]=function(e,n){return c(s.merge(n||{},{method:t,url:e}))}})}function o(){s.forEach(arguments,function(t){c[t]=function(e,n,r){return c(s.merge(r||{},{method:t,url:e,data:n}))}})}var u=n(23).Promise,i=n(13),s=n(14),c=t.exports=function a(t){function r(t,e,n){try{console.warn("DEPRECATED method `"+t+"`."+(e?" Use `"+e+"` instead.":"")+" This method will be removed in a future release."),n&&console.warn("For more information about usage see "+n)}catch(r){}}t=s.merge({method:"get",headers:{},transformRequest:i.transformRequest,transformResponse:i.transformResponse},t),t.withCredentials=t.withCredentials||i.withCredentials;var o=function(t){return new u(function(r,o){try{"undefined"!=typeof window?n(15)(r,o,t):"undefined"!=typeof e&&n(15)(r,o,t)}catch(u){o(u)}})},c=[o,void 0],f=u.resolve(t);for(s.forEach(a.interceptors.request.handlers,function(t){c.unshift(t.request,t.requestError)}),s.forEach(a.interceptors.response.handlers,function(t){c.push(t.response,t.responseError)});c.length;){var p=c.shift(),l=c.shift();f=f.then(p,l)}return f.success=function(t){return r("success","then","https://github.com/mzabriskie/axios/blob/master/README.md#response-api"),f.then(function(e){t(e.data,e.status,e.headers,e.config)}),f},f.error=function(t){return r("error","catch","https://github.com/mzabriskie/axios/blob/master/README.md#response-api"),f.then(null,function(e){t(e.data,e.status,e.headers,e.config)}),f},f};c.defaults=i,c.all=function(t){return u.all(t)},c.spread=n(16),c.interceptors={request:{handlers:[],use:function(t,e){c.interceptors.request.handlers.push({request:t,requestError:e})}},response:{handlers:[],use:function(t,e){c.interceptors.response.handlers.push({response:t,responseError:e})}}},r("delete","get","head"),o("post","put","patch")}).call(e,n(17))},function(t){"use strict";function e(t,e,n){var r={one:function(t,e){return n.one(t,e)},all:function(t){return n.all(t)},save:function(t){return n.put(e,t)},remove:function(t){return n["delete"](t)},url:function(){return n.url()},id:function(t){var e=function(){return t.apply(this,arguments)};return e.toString=function(){return t.toString()},e}(function(){return t}),data:function(t){var e=function(){return t.apply(this,arguments)};return e.toString=function(){return t.toString()},e}(function(){return e})};return Object.assign(function(){return e},r)}t.exports=e},function(t,e,n){"use strict";function r(t,e){var n={status:function(){return t.status},body:function(){var n=void 0===arguments[0]?!0:arguments[0];return n&&e?"[object Array]"===Object.prototype.toString.call(t.data)?t.data.map(function(t){return u(t.id,t,e(t.id))}):u(t.data.id,t.data,e(t.data.id)):t.data},headers:function(){return t.headers},config:function(){return t.config}};return Object.assign(function(){return t},n)}var o=function(t){return t&&t.__esModule?t["default"]:t};t.exports=r;var u=o(n(11))},function(t,e,n){"use strict";var r=n(14),o=/^\s*(\[|\{[^\{])/,u=/[\}\]]\s*$/,i=/^\)\]\}',?\n/,s={"Content-Type":"application/x-www-form-urlencoded"};t.exports={transformRequest:[function(t,e){return r.isArrayBuffer(t)?t:r.isArrayBufferView(t)?t.buffer:!r.isObject(t)||r.isFile(t)||r.isBlob(t)?t:(!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]="application/json;charset=utf-8"),JSON.stringify(t))}],transformResponse:[function(t){return"string"==typeof t&&(t=t.replace(i,""),o.test(t)&&u.test(t)&&(t=JSON.parse(t))),t}],headers:{common:{Accept:"application/json, text/plain, */*"},patch:r.merge(s),post:r.merge(s),put:r.merge(s)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"}},function(t){function e(t){return"[object Array]"===m.call(t)}function n(t){return"[object ArrayBuffer]"===m.call(t)}function r(t){return"[object FormData]"===m.call(t)}function o(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer}function u(t){return"string"==typeof t}function i(t){return"number"==typeof t}function s(t){return"undefined"==typeof t}function c(t){return null!==t&&"object"==typeof t}function a(t){return"[object Date]"===m.call(t)}function f(t){return"[object File]"===m.call(t)}function p(t){return"[object Blob]"===m.call(t)}function l(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}function d(t,e){if(null!==t&&"undefined"!=typeof t){var n=t.constructor===Array||"function"==typeof t.callee;if("object"==typeof t||n||(t=[t]),n)for(var r=0,o=t.length;o>r;r++)e.call(null,t[r],r,t);else for(var u in t)t.hasOwnProperty(u)&&e.call(null,t[u],u,t)}}function h(){var t={};return d(arguments,function(e){d(e,function(e,n){t[n]=e})}),t}var m=Object.prototype.toString;t.exports={isArray:e,isArrayBuffer:n,isFormData:r,isArrayBufferView:o,isString:u,isNumber:i,isObject:c,isUndefined:s,isDate:a,isFile:f,isBlob:p,forEach:d,merge:h,trim:l}},function(t,e,n){var r=n(13),o=n(14),u=n(18),i=n(19),s=n(20),c=n(21),a=n(22);t.exports=function(t,e,n){var f=c(n.data,n.headers,n.transformRequest),p=o.merge(r.headers.common,r.headers[n.method]||{},n.headers||{});o.isFormData(f)&&delete p["Content-Type"];var l=new(XMLHttpRequest||ActiveXObject)("Microsoft.XMLHTTP");l.open(n.method.toUpperCase(),u(n.url,n.params),!0),l.onreadystatechange=function(){if(l&&4===l.readyState){var r=s(l.getAllResponseHeaders()),o={data:c(l.responseText,r,n.transformResponse),status:l.status,headers:r,config:n};(l.status>=200&&l.status<300?t:e)(o),l=null}};var d=a(n.url)?i.read(n.xsrfCookieName||r.xsrfCookieName):void 0;if(d&&(p[n.xsrfHeaderName||r.xsrfHeaderName]=d),o.forEach(p,function(t,e){f||"content-type"!==e.toLowerCase()?l.setRequestHeader(e,t):delete p[e]}),n.withCredentials&&(l.withCredentials=!0),n.responseType)try{l.responseType=n.responseType}catch(h){if("json"!==l.responseType)throw h}o.isArrayBuffer(f)&&(f=new DataView(f)),l.send(f)}},function(t){t.exports=function(t){return function(e){t.apply(null,e)}}},function(t){function e(){}var n=t.exports={};n.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.MutationObserver,n="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};var r=[];if(e){var o=document.createElement("div"),u=new MutationObserver(function(){var t=r.slice();r.length=0,t.forEach(function(t){t()})});return u.observe(o,{attributes:!0}),function(t){r.length||o.setAttribute("yes","no"),r.push(t)}}return n?(window.addEventListener("message",function(t){var e=t.source;if((e===window||null===e)&&"process-tick"===t.data&&(t.stopPropagation(),r.length>0)){var n=r.shift();n()}},!0),function(t){r.push(t),window.postMessage("process-tick","*")}):function(t){setTimeout(t,0)}}(),n.title="browser",n.browser=!0,n.env={},n.argv=[],n.on=e,n.addListener=e,n.once=e,n.off=e,n.removeListener=e,n.removeAllListeners=e,n.emit=e,n.binding=function(){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(){throw new Error("process.chdir is not supported")}},function(t,e,n){"use strict";function r(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}var o=n(14);t.exports=function(t,e){if(!e)return t;var n=[];return o.forEach(e,function(t,e){null!==t&&"undefined"!=typeof t&&(o.isArray(t)||(t=[t]),o.forEach(t,function(t){o.isDate(t)?t=t.toISOString():o.isObject(t)&&(t=JSON.stringify(t)),n.push(r(e)+"="+r(t))}))}),n.length>0&&(t+=(-1===t.indexOf("?")?"?":"&")+n.join("&")),t}},function(t,e,n){"use strict";var r=n(14);t.exports={write:function(t,e,n,o,u,i){var s=[];s.push(t+"="+encodeURIComponent(e)),r.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),r.isString(o)&&s.push("path="+o),r.isString(u)&&s.push("domain="+u),i===!0&&s.push("secure"),document.cookie=s.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}},function(t,e,n){"use strict";var r=n(14);t.exports=function(t){var e,n,o,u={};return t?(r.forEach(t.split("\n"),function(t){o=t.indexOf(":"),e=r.trim(t.substr(0,o)).toLowerCase(),n=r.trim(t.substr(o+1)),e&&(u[e]=u[e]?u[e]+", "+n:n)}),u):u}},function(t,e,n){"use strict";var r=n(14);t.exports=function(t,e,n){return r.forEach(n,function(n){t=n(t,e)}),t}},function(t,e,n){"use strict";function r(t){var e=t;return o&&(i.setAttribute("href",e),e=i.href),i.setAttribute("href",e),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:"/"===i.pathname.charAt(0)?i.pathname:"/"+i.pathname}}var o=/(msie|trident)/i.test(navigator.userAgent),u=n(14),i=document.createElement("a"),s=r(window.location.href);t.exports=function(t){var e=u.isString(t)?r(t):t;return e.protocol===s.protocol&&e.host===s.host}},function(t,e,n){"use strict";var r=n(24).Promise,o=n(25).polyfill;e.Promise=r,e.polyfill=o},function(t,e,n){"use strict";function r(t){if(!v(t))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof r))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._subscribers=[],o(t,this)}function o(t,e){function n(t){a(e,t)}function r(t){p(e,t)}try{t(n,r)}catch(o){r(o)}}function u(t,e,n,r){var o,u,i,s,f=v(n);if(f)try{o=n(r),i=!0}catch(l){s=!0,u=l}else o=r,i=!0;c(e,o)||(f&&i?a(e,o):s?p(e,u):t===O?a(e,o):t===E&&p(e,o))}function i(t,e,n,r){var o=t._subscribers,u=o.length;o[u]=e,o[u+O]=n,o[u+E]=r}function s(t,e){for(var n,r,o=t._subscribers,i=t._detail,s=0;s<o.length;s+=3)n=o[s],r=o[s+e],u(e,n,r,i);t._subscribers=null}function c(t,e){var n,r=null;try{if(t===e)throw new TypeError("A promises callback cannot return that same promise.");if(m(e)&&(r=e.then,v(r)))return r.call(e,function(r){return n?!0:(n=!0,void(e!==r?a(t,r):f(t,r)))},function(e){return n?!0:(n=!0,void p(t,e))}),!0}catch(o){return n?!0:(p(t,o),!0)}return!1}function a(t,e){t===e?f(t,e):c(t,e)||f(t,e)}function f(t,e){t._state===x&&(t._state=_,t._detail=e,h.async(l,t))}function p(t,e){t._state===x&&(t._state=_,t._detail=e,h.async(d,t))}function l(t){s(t,t._state=O)}function d(t){s(t,t._state=E)}var h=n(26).config,m=(n(26).configure,n(27).objectOrFunction),v=n(27).isFunction,g=(n(27).now,n(28).all),y=n(29).race,w=n(30).resolve,b=n(31).reject,j=n(32).asap;h.async=j;var x=void 0,_=0,O=1,E=2;r.prototype={constructor:r,_state:void 0,_detail:void 0,_subscribers:void 0,then:function(t,e){var n=this,r=new this.constructor(function(){});if(this._state){var o=arguments;h.async(function(){u(n._state,r,o[n._state-1],n._detail)})}else i(this,r,t,e);return r},"catch":function(t){return this.then(null,t)}},r.all=g,r.race=y,r.resolve=w,r.reject=b,e.Promise=r},function(t,e,n){(function(t){"use strict";function r(){var e;e="undefined"!=typeof t?t:"undefined"!=typeof window&&window.document?window:self;var n="Promise"in e&&"resolve"in e.Promise&&"reject"in e.Promise&&"all"in e.Promise&&"race"in e.Promise&&function(){var t;return new e.Promise(function(e){t=e}),u(t)}();n||(e.Promise=o)}var o=n(24).Promise,u=n(27).isFunction;e.polyfill=r}).call(e,function(){return this}())},function(t,e){"use strict";function n(t,e){return 2!==arguments.length?r[t]:void(r[t]=e)}var r={instrument:!1};e.config=r,e.configure=n},function(t,e){"use strict";function n(t){return r(t)||"object"==typeof t&&null!==t}function r(t){return"function"==typeof t}function o(t){return"[object Array]"===Object.prototype.toString.call(t)}var u=Date.now||function(){return(new Date).getTime()};e.objectOrFunction=n,e.isFunction=r,e.isArray=o,e.now=u},function(t,e,n){"use strict";function r(t){var e=this;if(!o(t))throw new TypeError("You must pass an array to all.");return new e(function(e,n){function r(t){return function(e){o(t,e)}}function o(t,n){s[t]=n,0===--c&&e(s)}var i,s=[],c=t.length;0===c&&e([]);for(var a=0;a<t.length;a++)i=t[a],i&&u(i.then)?i.then(r(a),n):o(a,i)})}var o=n(27).isArray,u=n(27).isFunction;e.all=r},function(t,e,n){"use strict";function r(t){var e=this;if(!o(t))throw new TypeError("You must pass an array to race.");return new e(function(e,n){for(var r,o=0;o<t.length;o++)r=t[o],r&&"function"==typeof r.then?r.then(e,n):e(r)})}var o=n(27).isArray;e.race=r},function(t,e){"use strict";function n(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=this;return new e(function(e){e(t)})}e.resolve=n},function(t,e){"use strict";function n(t){var e=this;return new e(function(e,n){n(t)})}e.reject=n},function(t,e,n){(function(t,n){"use strict";function r(){return function(){n.nextTick(i)}}function o(){var t=0,e=new f(i),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function u(){return function(){p.setTimeout(i,1)}}function i(){for(var t=0;t<l.length;t++){var e=l[t],n=e[0],r=e[1];n(r)}l=[]}function s(t,e){var n=l.push([t,e]);1===n&&c()}var c,a="undefined"!=typeof window?window:{},f=a.MutationObserver||a.WebKitMutationObserver,p="undefined"!=typeof t?t:void 0===this?window:this,l=[];c="undefined"!=typeof n&&"[object process]"==={}.toString.call(n)?r():f?o():u(),e.asap=s}).call(e,function(){return this}(),n(17))}])}); |
{ | ||
"name": "restful.js", | ||
"version": "0.5.2", | ||
"version": "0.6.0", | ||
"repository": "https://github.com/marmelab/restful.js", | ||
@@ -20,4 +20,6 @@ "description": "A pure JS client for interacting with server-side RESTful resources. Think Restangular without Angular.", | ||
"karma-phantomjs-launcher": "0.1.4", | ||
"karma-spec-reporter": "0.0.16", | ||
"object-assign": "^2.0.0", | ||
"webpack": "^1.7.1" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# restful.js [![Build Status](https://magnum.travis-ci.com/marmelab/restful.js.svg?token=DxaAjqa57mtbLmyaMhJj&branch=master)](https://magnum.travis-ci.com/marmelab/restful.js) | ||
# restful.js [![Build Status](https://travis-ci.org/marmelab/restful.js.svg?branch=master)](https://travis-ci.org/marmelab/restful.js) | ||
@@ -74,7 +74,9 @@ A pure JS client for interacting with server-side RESTful resources. Think Restangular without Angular. | ||
Once you have collections and members endpoints, fetch them to get *entities*. Restful.js exposes `get()` and `getAll()` methods for fetching endpoints. Since these methods are asynchronous, they return a Promise ([based on the ES6 Promise specification](https://github.com/jakearchibald/es6-promise)) for an entity or an array of entities. | ||
Once you have collections and members endpoints, fetch them to get *entities*. Restful.js exposes `get()` and `getAll()` methods for fetching endpoints. Since these methods are asynchronous, they return a Promise ([based on the ES6 Promise specification](https://github.com/jakearchibald/es6-promise)) for response. | ||
```js | ||
var articleMember = api.one('articles', 1); // http://api.example.com/articles/1 | ||
articleMember.get().then(function(articleEntity) { | ||
articleMember.get().then(function(response) { | ||
var articleEntity = response.body(); | ||
var article = articleEntity.data(); | ||
@@ -85,3 +87,5 @@ console.log(article.title); // hello, world! | ||
var commentsCollection = articleMember.all('comments'); // http://api.example.com/articles/1/comments | ||
commentsCollection.getAll().then(function(commentEntities) { | ||
commentsCollection.getAll().then(function(response) { | ||
var commentEntities = response.body(); | ||
commentEntities.forEach(function(commentEntity) { | ||
@@ -100,3 +104,3 @@ var comment = commentEntity.data(); | ||
var commentMember = articleMember.one('comments', 4); | ||
commentMember.get().then(function(commentEntity) { | ||
commentMember.get().then(function(response) { | ||
// | ||
@@ -106,3 +110,3 @@ }); | ||
var commentsCollection = articleMember.all('comments'); | ||
commentsCollection.get(4).then(function(commentEntity) { | ||
commentsCollection.get(4).then(function(response) { | ||
// | ||
@@ -112,5 +116,8 @@ }); | ||
### Response | ||
A response is made from the HTTP response fetched from the endpoint. It exposes `status()`, `headers()`, and `body()` methods. For a `GET` request, the `body` method will return one or a an array of entities. Therefore you can disable this hydration by calling `body(false)`. | ||
### Entity Data | ||
An en entity is made from the HTTP response fetched from the endpoint. It exposes `status()`, `headers()`, and `data()` methods: | ||
An entity is made from the HTTP response data fetched from the endpoint. It exposes a `data()` method: | ||
@@ -121,6 +128,5 @@ ```js | ||
// http://api.example.com/articles/1 | ||
api.one('articles', 1).get().then(function(articleEntity) { | ||
if (articleEntity.status() !== 200) { | ||
throw new Error('Invalid response'); | ||
} | ||
api.one('articles', 1).get().then(function(response) { | ||
var articleEntity = response.body(); | ||
// if the server response was { id: 1, title: 'test', body: 'hello' } | ||
@@ -135,2 +141,5 @@ var article = articleEntity.data(); | ||
articleEntity.remove(); // will perform a DELETE request | ||
}, function(response) { | ||
// The reponse code is not >= 200 and < 400 | ||
throw new Error('Invalid response'); | ||
}); | ||
@@ -152,6 +161,10 @@ ``` | ||
commentMember.get() | ||
.then(function(commentEntity) { | ||
.then(function(response) { | ||
var commentEntity = response.body(); | ||
// You can also call `all` and `one` on an entity | ||
return comment.all('authors').getAll(); // http://api.example.com/articles/1/comments/3/authors | ||
}).then(function(authorEntities) { | ||
}).then(function(response) { | ||
var authorEntities = response.body(); | ||
authorEntities.forEach(function(authorEntity) { | ||
@@ -236,6 +249,10 @@ var author = authorEntity.data(); | ||
### Response methods | ||
* `response.status()`: Get the HTTP status code of the response | ||
* `response.headers()`: Get the HTTP headers of the response | ||
* `response.body()`: Get the HTTP body of the response. If it is a `GET` request, it will hydrate some entities. To get the raw body call it with `false` as argument. | ||
### Entity methods | ||
* `entity.status()`: Get the HTTP statuis code of the response | ||
* `entity.headers()`: Get the HTTP headers of the response | ||
* `entity.data()` : Get the JS object unserialized from the response body (which must be in JSON) | ||
@@ -242,0 +259,0 @@ * `entity.one(name, id)`: Query a member child of the entity. |
'use strict'; | ||
import endpoint from 'model/endpoint'; | ||
import entity from 'model/entity'; | ||
import responseBuilder from 'service/responseBuilder'; | ||
import member from 'model/member'; | ||
@@ -11,21 +11,21 @@ import resource from 'model/resource'; | ||
function memberFactory(id) { | ||
var _member = member(name, id, parent); | ||
// Configure the endpoint | ||
// We do it this way because the response must have a member which inherits from this collection config | ||
_member() | ||
.headers(refEndpoint.headers()) | ||
.responseInterceptors(refEndpoint.responseInterceptors()) | ||
.requestInterceptors(refEndpoint.requestInterceptors()); | ||
return _member; | ||
} | ||
var model = { | ||
get(id, params, headers) { | ||
var entityMember = member(name, id, parent); | ||
// Configure the endpoint | ||
// We do it this way because the entity must have a member which inherits from this collection config | ||
entityMember() | ||
.headers(refEndpoint.headers()) | ||
.responseInterceptors(refEndpoint.responseInterceptors()) | ||
.requestInterceptors(refEndpoint.requestInterceptors()); | ||
return refEndpoint | ||
.get(id, params, headers) | ||
.then(function(response) { | ||
return entity( | ||
id, | ||
response, | ||
entityMember | ||
); | ||
.then(function(serverResponse) { | ||
return responseBuilder(serverResponse, memberFactory); | ||
}); | ||
@@ -37,22 +37,4 @@ }, | ||
.getAll(params, headers) | ||
.then(function(response) { | ||
return response.data.map(function(data) { | ||
response = JSON.parse(JSON.stringify(response)); | ||
response.data = data; | ||
var entityMember = member(name, data.id, parent); | ||
// Configure the endpoint | ||
// We do it this way because the entity must have a member which inherits from this collection config | ||
entityMember() | ||
.headers(refEndpoint.headers()) | ||
.responseInterceptors(refEndpoint.responseInterceptors()) | ||
.requestInterceptors(refEndpoint.requestInterceptors()); | ||
return entity( | ||
data.id, | ||
response, | ||
entityMember | ||
); | ||
}); | ||
.then(function(serverResponse) { | ||
return responseBuilder(serverResponse, memberFactory); | ||
}); | ||
@@ -62,19 +44,34 @@ }, | ||
post(data, headers) { | ||
return refEndpoint.post(data, headers); | ||
return refEndpoint.post(data, headers) | ||
.then(function(serverResponse) { | ||
return responseBuilder(serverResponse); | ||
}); | ||
}, | ||
put(id, data, headers) { | ||
return refEndpoint.put(id, data, headers); | ||
return refEndpoint.put(id, data, headers) | ||
.then(function(serverResponse) { | ||
return responseBuilder(serverResponse); | ||
}); | ||
}, | ||
patch(id, data, headers) { | ||
return refEndpoint.patch(id, data, headers); | ||
return refEndpoint.patch(id, data, headers) | ||
.then(function(serverResponse) { | ||
return responseBuilder(serverResponse); | ||
}); | ||
}, | ||
head(id, data, headers) { | ||
return refEndpoint.head(id, data, headers); | ||
return refEndpoint.head(id, data, headers) | ||
.then(function(serverResponse) { | ||
return responseBuilder(serverResponse); | ||
}); | ||
}, | ||
delete(id, headers) { | ||
return refEndpoint.delete(id, headers); | ||
return refEndpoint.delete(id, headers) | ||
.then(function(serverResponse) { | ||
return responseBuilder(serverResponse); | ||
}); | ||
}, | ||
@@ -81,0 +78,0 @@ |
@@ -1,2 +0,2 @@ | ||
export default function entity(id, response, member) { | ||
export default function entity(id, data, member) { | ||
var model = { | ||
@@ -12,3 +12,3 @@ one(name, id) { | ||
save(headers) { | ||
return member.put(response.data, headers); | ||
return member.put(data, headers); | ||
}, | ||
@@ -28,18 +28,10 @@ | ||
status() { | ||
return response.status; | ||
}, | ||
data() { | ||
return response.data; | ||
}, | ||
headers() { | ||
return response.headers; | ||
}, | ||
return data; | ||
} | ||
}; | ||
return Object.assign(function () { | ||
return response; | ||
return data; | ||
}, model); | ||
}; |
import collection from 'model/collection'; | ||
import endpoint from 'model/endpoint'; | ||
import entity from 'model/entity'; | ||
import responseBuilder from 'service/responseBuilder'; | ||
import resource from 'model/resource'; | ||
@@ -14,8 +14,6 @@ | ||
.get(id, params, headers) | ||
.then(function(response) { | ||
return entity( | ||
id, | ||
response, | ||
model | ||
); | ||
.then(function(serverResponse) { | ||
return responseBuilder(serverResponse, function() { | ||
return model; | ||
}); | ||
}); | ||
@@ -25,15 +23,27 @@ }, | ||
put(data, headers) { | ||
return refEndpoint.put(id, data, headers); | ||
return refEndpoint.put(id, data, headers) | ||
.then(function(serverResponse) { | ||
return responseBuilder(serverResponse); | ||
}); | ||
}, | ||
patch(data, headers) { | ||
return refEndpoint.patch(id, data, headers); | ||
return refEndpoint.patch(id, data, headers) | ||
.then(function(serverResponse) { | ||
return responseBuilder(serverResponse); | ||
}); | ||
}, | ||
head(data, headers) { | ||
return refEndpoint.head(id, data, headers); | ||
return refEndpoint.head(id, data, headers) | ||
.then(function(serverResponse) { | ||
return responseBuilder(serverResponse); | ||
}); | ||
}, | ||
delete(headers) { | ||
return refEndpoint.delete(id, headers); | ||
return refEndpoint.delete(id, headers) | ||
.then(function(serverResponse) { | ||
return responseBuilder(serverResponse); | ||
}); | ||
}, | ||
@@ -40,0 +50,0 @@ |
@@ -1,2 +0,2 @@ | ||
import 'babel-core/polyfill'; | ||
import assign from 'object-assign'; | ||
@@ -10,2 +10,4 @@ import configurable from 'util/configurable'; | ||
assign(Object.prototype, { assign: assign }); | ||
export default function restful(baseUrl, port) { | ||
@@ -12,0 +14,0 @@ var config = { |
@@ -1,3 +0,3 @@ | ||
module.exports = function (config) { | ||
"use strict"; | ||
module.exports = function(config) { | ||
'use strict'; | ||
@@ -10,7 +10,10 @@ config.set({ | ||
{pattern: 'test/promise-mock.js', included: true}, | ||
// test files | ||
{pattern: 'test/src/**/*.js', included: true}, | ||
], | ||
reporters: ['spec'], | ||
frameworks: ['jasmine'], | ||
}); | ||
}; |
@@ -8,15 +8,12 @@ /*global describe,it,expect,beforeEach,jasmine*/ | ||
http, | ||
resource, | ||
q; | ||
resource; | ||
function q(result) { | ||
return new Promise(function(resolve, reject) { | ||
resolve(result); | ||
}); | ||
}; | ||
describe('restful', function() { | ||
beforeEach(function() { | ||
q = function q(result) { | ||
return { | ||
then: function(cb) { | ||
return q(cb(result)); | ||
} | ||
}; | ||
}; | ||
httpBackend = { | ||
@@ -217,6 +214,8 @@ get: function(config) { | ||
comment.get().then(function(entity) { | ||
comment.get().then(function(response) { | ||
var entity = response.body(); | ||
// As we use a promesse mock, this is always called synchronously | ||
expect(entity().data.title).toBe('test'); | ||
expect(entity().data.body).toBe('Hello, I am a test'); | ||
expect(entity.data().title).toBe('test'); | ||
expect(entity.data().body).toBe('Hello, I am a test'); | ||
}); | ||
@@ -233,6 +232,8 @@ | ||
comment.get({ test: 'test3' }, { bar: 'foo' }).then(function(entity) { | ||
comment.get({ test: 'test3' }, { bar: 'foo' }).then(function(response) { | ||
var entity = response.body(); | ||
// As we use a promesse mock, this is always called synchronously | ||
expect(entity().data.title).toBe('test'); | ||
expect(entity().data.body).toBe('Hello, I am a test'); | ||
expect(entity.data().title).toBe('test'); | ||
expect(entity.data().body).toBe('Hello, I am a test'); | ||
}); | ||
@@ -256,3 +257,3 @@ | ||
// As we use a promesse mock, this is always called synchronously | ||
expect(response).toEqual({ | ||
expect(response()).toEqual({ | ||
data: { | ||
@@ -289,3 +290,3 @@ result: 2 | ||
// As we use a promesse mock, this is always called synchronously | ||
expect(response).toEqual({ | ||
expect(response()).toEqual({ | ||
data: { | ||
@@ -316,3 +317,3 @@ result: 1 | ||
// As we use a promesse mock, this is always called synchronously | ||
expect(response).toEqual({ | ||
expect(response()).toEqual({ | ||
// `data` is the response that was provided by the server | ||
@@ -350,3 +351,3 @@ data: { | ||
// As we use a promesse mock, this is always called synchronously | ||
expect(response).toEqual({ | ||
expect(response()).toEqual({ | ||
// `data` is the response that was provided by the server | ||
@@ -390,10 +391,13 @@ data: { | ||
comment.get().then(function(entity) { | ||
comment.get().then(function(response) { | ||
var entity = response.body(); | ||
// As we use a promesse mock, this is always called synchronously | ||
expect(entity().data.title).toBe('test'); | ||
expect(entity().data.body).toBe('Hello, I am a test'); | ||
expect(entity().data['published_at']).toBe('2015-01-03'); | ||
expect(entity.data().title).toBe('test'); | ||
expect(entity.data().body).toBe('Hello, I am a test'); | ||
expect(entity.data()['published_at']).toBe('2015-01-03'); | ||
entity().data.body = 'Overriden'; | ||
entity().data['published_at'] = '2015-01-06'; | ||
entity.data().body = 'Overriden'; | ||
entity.data()['published_at'] = '2015-01-06'; | ||
entity.save(); | ||
@@ -427,3 +431,5 @@ }); | ||
comment.get().then(function(entity) { | ||
comment.get().then(function(response) { | ||
var entity = response.body(); | ||
// As we use a promesse mock, this is always called synchronously | ||
@@ -458,6 +464,8 @@ entity.save({ foo: 'bar' }); | ||
comment.get().then(function(entity) { | ||
comment.get().then(function(response) { | ||
var entity = response.body(); | ||
// As we use a promesse mock, this is always called synchronously | ||
expect(entity().data.title).toBe('test'); | ||
expect(entity().data.body).toBe('Hello, I am a test'); | ||
expect(entity.data().title).toBe('test'); | ||
expect(entity.data().body).toBe('Hello, I am a test'); | ||
@@ -483,3 +491,5 @@ entity.remove() | ||
comment.get().then(function(entity) { | ||
comment.get().then(function(response) { | ||
var entity = response.body(); | ||
// As we use a promesse mock, this is always called synchronously | ||
@@ -503,7 +513,9 @@ entity.remove({ foo: 'bar' }); | ||
comments.get(1, { page: 1 }, { foo: 'bar' }).then(function(entity) { | ||
comments.get(1, { page: 1 }, { foo: 'bar' }).then(function(response) { | ||
var entity = response.body(); | ||
// As we use a promesse mock, this is always called synchronously | ||
expect(entity().data.id).toBe(1); | ||
expect(entity().data.title).toBe('test'); | ||
expect(entity().data.body).toBe('Hello, I am a test'); | ||
expect(entity.data().id).toBe(1); | ||
expect(entity.data().title).toBe('test'); | ||
expect(entity.data().body).toBe('Hello, I am a test'); | ||
}); | ||
@@ -525,11 +537,13 @@ | ||
comments.getAll({ page: 1 }, { foo: 'bar' }).then(function(entities) { | ||
comments.getAll({ page: 1 }, { foo: 'bar' }).then(function(response) { | ||
var entities = response.body(); | ||
// As we use a promesse mock, this is always called synchronously | ||
expect(entities[0]().data.id).toBe(1); | ||
expect(entities[0]().data.title).toBe('test'); | ||
expect(entities[0]().data.body).toBe('Hello, I am a test'); | ||
expect(entities[0].data().id).toBe(1); | ||
expect(entities[0].data().title).toBe('test'); | ||
expect(entities[0].data().body).toBe('Hello, I am a test'); | ||
expect(entities[1]().data.id).toBe(2); | ||
expect(entities[1]().data.title).toBe('test2'); | ||
expect(entities[1]().data.body).toBe('Hello, I am a test2'); | ||
expect(entities[1].data().id).toBe(2); | ||
expect(entities[1].data().title).toBe('test2'); | ||
expect(entities[1].data().body).toBe('Hello, I am a test2'); | ||
}); | ||
@@ -553,3 +567,3 @@ | ||
// As we use a promesse mock, this is always called synchronously | ||
expect(response).toEqual({ | ||
expect(response()).toEqual({ | ||
// `data` is the response that was provided by the server | ||
@@ -594,3 +608,3 @@ data: { | ||
// As we use a promesse mock, this is always called synchronously | ||
expect(response).toEqual({ | ||
expect(response()).toEqual({ | ||
// `data` is the response that was provided by the server | ||
@@ -635,3 +649,3 @@ data: { | ||
// As we use a promesse mock, this is always called synchronously | ||
expect(response).toEqual({ | ||
expect(response()).toEqual({ | ||
// `data` is the response that was provided by the server | ||
@@ -669,3 +683,3 @@ data: { | ||
// As we use a promesse mock, this is always called synchronously | ||
expect(response).toEqual({ | ||
expect(response()).toEqual({ | ||
// `data` is the response that was provided by the server | ||
@@ -703,3 +717,3 @@ data: { | ||
// As we use a promesse mock, this is always called synchronously | ||
expect(response).toEqual({ | ||
expect(response()).toEqual({ | ||
// `data` is the response that was provided by the server | ||
@@ -773,8 +787,12 @@ data: { | ||
comments.get(1).then(function(comment) { | ||
expect(comment().data.title).toBe('Intercepted :)'); | ||
comments.get(1).then(function(response) { | ||
var comment = response.body(); | ||
expect(comment.data().title).toBe('Intercepted :)'); | ||
// test inheritance pattern | ||
resource.one('articles', 1).get().then(function(article) { | ||
expect(article().data.title).toBe('test'); | ||
resource.one('articles', 1).get().then(function(response) { | ||
var article = response.body(); | ||
expect(article.data().title).toBe('test'); | ||
}); | ||
@@ -820,3 +838,5 @@ | ||
resource.one('articles', 1).get().then(function(article) { | ||
resource.one('articles', 1).get().then(function(response) { | ||
var article = response.body(); | ||
expect(getArgs).toEqual({ | ||
@@ -823,0 +843,0 @@ url: 'https://localhost:3000/v1/articles/1', |
Sorry, the diff of this file is not supported yet
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
24
307
98409
10