UNPKG

drupal-jsonapi-client

Version:

Making working with Drupal 8's JSON:API easier, faster and cleaner.

112 lines (77 loc) 65.9 kB
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.DrupalJsonApi = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ module.exports=require("./lib/axios"); },{"./lib/axios":3}],2:[function(require,module,exports){ "use strict";var utils=require("./../utils"),settle=require("./../core/settle"),buildURL=require("./../helpers/buildURL"),parseHeaders=require("./../helpers/parseHeaders"),isURLSameOrigin=require("./../helpers/isURLSameOrigin"),createError=require("../core/createError");module.exports=function(e){return new Promise(function(r,t){var s=e.data,o=e.headers;utils.isFormData(s)&&delete o["Content-Type"];var n=new XMLHttpRequest;if(e.auth){var a=e.auth.username||"",i=e.auth.password||"";o.Authorization="Basic "+btoa(a+":"+i)}if(n.open(e.method.toUpperCase(),buildURL(e.url,e.params,e.paramsSerializer),!0),n.timeout=e.timeout,n.onreadystatechange=function(){if(n&&4===n.readyState&&(0!==n.status||n.responseURL&&0===n.responseURL.indexOf("file:"))){var s="getAllResponseHeaders"in n?parseHeaders(n.getAllResponseHeaders()):null,o={data:e.responseType&&"text"!==e.responseType?n.response:n.responseText,status:n.status,statusText:n.statusText,headers:s,config:e,request:n};settle(r,t,o),n=null}},n.onabort=function(){n&&(t(createError("Request aborted",e,"ECONNABORTED",n)),n=null)},n.onerror=function(){t(createError("Network Error",e,null,n)),n=null},n.ontimeout=function(){t(createError("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",n)),n=null},utils.isStandardBrowserEnv()){var u=require("./../helpers/cookies"),l=(e.withCredentials||isURLSameOrigin(e.url))&&e.xsrfCookieName?u.read(e.xsrfCookieName):void 0;l&&(o[e.xsrfHeaderName]=l)}if("setRequestHeader"in n&&utils.forEach(o,function(e,r){void 0===s&&"content-type"===r.toLowerCase()?delete o[r]:n.setRequestHeader(r,e)}),e.withCredentials&&(n.withCredentials=!0),e.responseType)try{n.responseType=e.responseType}catch(r){if("json"!==e.responseType)throw r}"function"==typeof e.onDownloadProgress&&n.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&n.upload&&n.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){n&&(n.abort(),t(e),n=null)}),void 0===s&&(s=null),n.send(s)})}; },{"../core/createError":9,"./../core/settle":13,"./../helpers/buildURL":17,"./../helpers/cookies":19,"./../helpers/isURLSameOrigin":21,"./../helpers/parseHeaders":23,"./../utils":25}],3:[function(require,module,exports){ "use strict";var utils=require("./utils"),bind=require("./helpers/bind"),Axios=require("./core/Axios"),mergeConfig=require("./core/mergeConfig"),defaults=require("./defaults");function createInstance(e){var r=new Axios(e),i=bind(Axios.prototype.request,r);return utils.extend(i,Axios.prototype,r),utils.extend(i,r),i}var axios=createInstance(defaults);axios.Axios=Axios,axios.create=function(e){return createInstance(mergeConfig(axios.defaults,e))},axios.Cancel=require("./cancel/Cancel"),axios.CancelToken=require("./cancel/CancelToken"),axios.isCancel=require("./cancel/isCancel"),axios.all=function(e){return Promise.all(e)},axios.spread=require("./helpers/spread"),module.exports=axios,module.exports.default=axios; },{"./cancel/Cancel":4,"./cancel/CancelToken":5,"./cancel/isCancel":6,"./core/Axios":7,"./core/mergeConfig":12,"./defaults":15,"./helpers/bind":16,"./helpers/spread":24,"./utils":25}],4:[function(require,module,exports){ "use strict";function Cancel(e){this.message=e}Cancel.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Cancel.prototype.__CANCEL__=!0,module.exports=Cancel; },{}],5:[function(require,module,exports){ "use strict";var Cancel=require("./Cancel");function CancelToken(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var n;this.promise=new Promise(function(e){n=e});var o=this;e(function(e){o.reason||(o.reason=new Cancel(e),n(o.reason))})}CancelToken.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},CancelToken.source=function(){var e;return{token:new CancelToken(function(n){e=n}),cancel:e}},module.exports=CancelToken; },{"./Cancel":4}],6:[function(require,module,exports){ "use strict";module.exports=function(t){return!(!t||!t.__CANCEL__)}; },{}],7:[function(require,module,exports){ "use strict";var utils=require("./../utils"),buildURL=require("../helpers/buildURL"),InterceptorManager=require("./InterceptorManager"),dispatchRequest=require("./dispatchRequest"),mergeConfig=require("./mergeConfig");function Axios(e){this.defaults=e,this.interceptors={request:new InterceptorManager,response:new InterceptorManager}}Axios.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=mergeConfig(this.defaults,e)).method=e.method?e.method.toLowerCase():"get";var t=[dispatchRequest,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)r=r.then(t.shift(),t.shift());return r},Axios.prototype.getUri=function(e){return e=mergeConfig(this.defaults,e),buildURL(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},utils.forEach(["delete","get","head","options"],function(e){Axios.prototype[e]=function(t,r){return this.request(utils.merge(r||{},{method:e,url:t}))}}),utils.forEach(["post","put","patch"],function(e){Axios.prototype[e]=function(t,r,i){return this.request(utils.merge(i||{},{method:e,url:t,data:r}))}}),module.exports=Axios; },{"../helpers/buildURL":17,"./../utils":25,"./InterceptorManager":8,"./dispatchRequest":10,"./mergeConfig":12}],8:[function(require,module,exports){ "use strict";var utils=require("./../utils");function InterceptorManager(){this.handlers=[]}InterceptorManager.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},InterceptorManager.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},InterceptorManager.prototype.forEach=function(e){utils.forEach(this.handlers,function(t){null!==t&&e(t)})},module.exports=InterceptorManager; },{"./../utils":25}],9:[function(require,module,exports){ "use strict";var enhanceError=require("./enhanceError");module.exports=function(r,e,n,o,a){var c=new Error(r);return enhanceError(c,e,n,o,a)}; },{"./enhanceError":11}],10:[function(require,module,exports){ "use strict";var utils=require("./../utils"),transformData=require("./transformData"),isCancel=require("../cancel/isCancel"),defaults=require("../defaults"),isAbsoluteURL=require("./../helpers/isAbsoluteURL"),combineURLs=require("./../helpers/combineURLs");function throwIfCancellationRequested(e){e.cancelToken&&e.cancelToken.throwIfRequested()}module.exports=function(e){return throwIfCancellationRequested(e),e.baseURL&&!isAbsoluteURL(e.url)&&(e.url=combineURLs(e.baseURL,e.url)),e.headers=e.headers||{},e.data=transformData(e.data,e.headers,e.transformRequest),e.headers=utils.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),utils.forEach(["delete","get","head","post","put","patch","common"],function(a){delete e.headers[a]}),(e.adapter||defaults.adapter)(e).then(function(a){return throwIfCancellationRequested(e),a.data=transformData(a.data,a.headers,e.transformResponse),a},function(a){return isCancel(a)||(throwIfCancellationRequested(e),a&&a.response&&(a.response.data=transformData(a.response.data,a.response.headers,e.transformResponse))),Promise.reject(a)})}; },{"../cancel/isCancel":6,"../defaults":15,"./../helpers/combineURLs":18,"./../helpers/isAbsoluteURL":20,"./../utils":25,"./transformData":14}],11:[function(require,module,exports){ "use strict";module.exports=function(e,i,s,t,n){return e.config=i,s&&(e.code=s),e.request=t,e.response=n,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}; },{}],12:[function(require,module,exports){ "use strict";var utils=require("../utils");module.exports=function(e,t){t=t||{};var s={};return utils.forEach(["url","method","params","data"],function(e){void 0!==t[e]&&(s[e]=t[e])}),utils.forEach(["headers","auth","proxy"],function(r){utils.isObject(t[r])?s[r]=utils.deepMerge(e[r],t[r]):void 0!==t[r]?s[r]=t[r]:utils.isObject(e[r])?s[r]=utils.deepMerge(e[r]):void 0!==e[r]&&(s[r]=e[r])}),utils.forEach(["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"],function(r){void 0!==t[r]?s[r]=t[r]:void 0!==e[r]&&(s[r]=e[r])}),s}; },{"../utils":25}],13:[function(require,module,exports){ "use strict";var createError=require("./createError");module.exports=function(r,t,e){var a=e.config.validateStatus;!a||a(e.status)?r(e):t(createError("Request failed with status code "+e.status,e.config,null,e.request,e))}; },{"./createError":9}],14:[function(require,module,exports){ "use strict";var utils=require("./../utils");module.exports=function(t,u,r){return utils.forEach(r,function(r){t=r(t,u)}),t}; },{"./../utils":25}],15:[function(require,module,exports){ (function (process){ "use strict";var utils=require("./utils"),normalizeHeaderName=require("./helpers/normalizeHeaderName"),DEFAULT_CONTENT_TYPE={"Content-Type":"application/x-www-form-urlencoded"};function setContentTypeIfUnset(e,t){!utils.isUndefined(e)&&utils.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}function getDefaultAdapter(){var e;return"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)?e=require("./adapters/http"):"undefined"!=typeof XMLHttpRequest&&(e=require("./adapters/xhr")),e}var defaults={adapter:getDefaultAdapter(),transformRequest:[function(e,t){return normalizeHeaderName(t,"Accept"),normalizeHeaderName(t,"Content-Type"),utils.isFormData(e)||utils.isArrayBuffer(e)||utils.isBuffer(e)||utils.isStream(e)||utils.isFile(e)||utils.isBlob(e)?e:utils.isArrayBufferView(e)?e.buffer:utils.isURLSearchParams(e)?(setContentTypeIfUnset(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):utils.isObject(e)?(setContentTypeIfUnset(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};utils.forEach(["delete","get","head"],function(e){defaults.headers[e]={}}),utils.forEach(["post","put","patch"],function(e){defaults.headers[e]=utils.merge(DEFAULT_CONTENT_TYPE)}),module.exports=defaults; }).call(this,require('_process')) },{"./adapters/http":2,"./adapters/xhr":2,"./helpers/normalizeHeaderName":22,"./utils":25,"_process":27}],16:[function(require,module,exports){ "use strict";module.exports=function(r,n){return function(){for(var t=new Array(arguments.length),e=0;e<t.length;e++)t[e]=arguments[e];return r.apply(n,t)}}; },{}],17:[function(require,module,exports){ "use strict";var utils=require("./../utils");function encode(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}module.exports=function(e,i,r){if(!i)return e;var t;if(r)t=r(i);else if(utils.isURLSearchParams(i))t=i.toString();else{var n=[];utils.forEach(i,function(e,i){null!=e&&(utils.isArray(e)?i+="[]":e=[e],utils.forEach(e,function(e){utils.isDate(e)?e=e.toISOString():utils.isObject(e)&&(e=JSON.stringify(e)),n.push(encode(i)+"="+encode(e))}))}),t=n.join("&")}if(t){var c=e.indexOf("#");-1!==c&&(e=e.slice(0,c)),e+=(-1===e.indexOf("?")?"?":"&")+t}return e}; },{"./../utils":25}],18:[function(require,module,exports){ "use strict";module.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}; },{}],19:[function(require,module,exports){ "use strict";var utils=require("./../utils");module.exports=utils.isStandardBrowserEnv()?{write:function(e,t,n,i,u,o){var r=[];r.push(e+"="+encodeURIComponent(t)),utils.isNumber(n)&&r.push("expires="+new Date(n).toGMTString()),utils.isString(i)&&r.push("path="+i),utils.isString(u)&&r.push("domain="+u),!0===o&&r.push("secure"),document.cookie=r.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}; },{"./../utils":25}],20:[function(require,module,exports){ "use strict";module.exports=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}; },{}],21:[function(require,module,exports){ "use strict";var utils=require("./../utils");module.exports=utils.isStandardBrowserEnv()?function(){var t,r=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a");function o(t){var o=t;return r&&(e.setAttribute("href",o),o=e.href),e.setAttribute("href",o),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:"/"===e.pathname.charAt(0)?e.pathname:"/"+e.pathname}}return t=o(window.location.href),function(r){var e=utils.isString(r)?o(r):r;return e.protocol===t.protocol&&e.host===t.host}}():function(){return!0}; },{"./../utils":25}],22:[function(require,module,exports){ "use strict";var utils=require("../utils");module.exports=function(e,t){utils.forEach(e,function(r,s){s!==t&&s.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[s])})}; },{"../utils":25}],23:[function(require,module,exports){ "use strict";var utils=require("./../utils"),ignoreDuplicateOf=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];module.exports=function(t){var e,i,r,o={};return t?(utils.forEach(t.split("\n"),function(t){if(r=t.indexOf(":"),e=utils.trim(t.substr(0,r)).toLowerCase(),i=utils.trim(t.substr(r+1)),e){if(o[e]&&ignoreDuplicateOf.indexOf(e)>=0)return;o[e]="set-cookie"===e?(o[e]?o[e]:[]).concat([i]):o[e]?o[e]+", "+i:i}}),o):o}; },{"./../utils":25}],24:[function(require,module,exports){ "use strict";module.exports=function(n){return function(t){return n.apply(null,t)}}; },{}],25:[function(require,module,exports){ "use strict";var bind=require("./helpers/bind"),isBuffer=require("is-buffer"),toString=Object.prototype.toString;function isArray(e){return"[object Array]"===toString.call(e)}function isArrayBuffer(e){return"[object ArrayBuffer]"===toString.call(e)}function isFormData(e){return"undefined"!=typeof FormData&&e instanceof FormData}function isArrayBufferView(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function isString(e){return"string"==typeof e}function isNumber(e){return"number"==typeof e}function isUndefined(e){return void 0===e}function isObject(e){return null!==e&&"object"==typeof e}function isDate(e){return"[object Date]"===toString.call(e)}function isFile(e){return"[object File]"===toString.call(e)}function isBlob(e){return"[object Blob]"===toString.call(e)}function isFunction(e){return"[object Function]"===toString.call(e)}function isStream(e){return isObject(e)&&isFunction(e.pipe)}function isURLSearchParams(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams}function trim(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function isStandardBrowserEnv(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function forEach(e,r){if(null!=e)if("object"!=typeof e&&(e=[e]),isArray(e))for(var t=0,n=e.length;t<n;t++)r.call(null,e[t],t,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&r.call(null,e[i],i,e)}function merge(){var e={};function r(r,t){"object"==typeof e[t]&&"object"==typeof r?e[t]=merge(e[t],r):e[t]=r}for(var t=0,n=arguments.length;t<n;t++)forEach(arguments[t],r);return e}function deepMerge(){var e={};function r(r,t){"object"==typeof e[t]&&"object"==typeof r?e[t]=deepMerge(e[t],r):e[t]="object"==typeof r?deepMerge({},r):r}for(var t=0,n=arguments.length;t<n;t++)forEach(arguments[t],r);return e}function extend(e,r,t){return forEach(r,function(r,n){e[n]=t&&"function"==typeof r?bind(r,t):r}),e}module.exports={isArray:isArray,isArrayBuffer:isArrayBuffer,isBuffer:isBuffer,isFormData:isFormData,isArrayBufferView:isArrayBufferView,isString:isString,isNumber:isNumber,isObject:isObject,isUndefined:isUndefined,isDate:isDate,isFile:isFile,isBlob:isBlob,isFunction:isFunction,isStream:isStream,isURLSearchParams:isURLSearchParams,isStandardBrowserEnv:isStandardBrowserEnv,forEach:forEach,merge:merge,deepMerge:deepMerge,extend:extend,trim:trim}; },{"./helpers/bind":16,"is-buffer":26}],26:[function(require,module,exports){ module.exports=function(o){return null!=o&&null!=o.constructor&&"function"==typeof o.constructor.isBuffer&&o.constructor.isBuffer(o)}; },{}],27:[function(require,module,exports){ var cachedSetTimeout,cachedClearTimeout,process=module.exports={};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(e){if(cachedSetTimeout===setTimeout)return setTimeout(e,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(e,0);try{return cachedSetTimeout(e,0)}catch(t){try{return cachedSetTimeout.call(null,e,0)}catch(t){return cachedSetTimeout.call(this,e,0)}}}function runClearTimeout(e){if(cachedClearTimeout===clearTimeout)return clearTimeout(e);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(e);try{return cachedClearTimeout(e)}catch(t){try{return cachedClearTimeout.call(null,e)}catch(t){return cachedClearTimeout.call(this,e)}}}!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var currentQueue,queue=[],draining=!1,queueIndex=-1;function cleanUpNextTick(){draining&&currentQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var e=runTimeout(cleanUpNextTick);draining=!0;for(var t=queue.length;t;){for(currentQueue=queue,queue=[];++queueIndex<t;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,t=queue.length}currentQueue=null,draining=!1,runClearTimeout(e)}}function Item(e,t){this.fun=e,this.array=t}function noop(){}process.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];queue.push(new Item(e,t)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.prependListener=noop,process.prependOnceListener=noop,process.listeners=function(e){return[]},process.binding=function(e){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(e){throw new Error("process.chdir is not supported")},process.umask=function(){return 0}; },{}],28:[function(require,module,exports){ (function (process,global){ !function(){var t="undefined"!=typeof process&&"[object process]"==={}.toString.call(process)||"undefined"!=typeof navigator&&"ReactNative"===navigator.product?global:self;t.Proxy||(t.Proxy=function(){function t(t){return!!t&&("object"==typeof t||"function"==typeof t)}var e=null,r=function(r,o){function n(){}if(!t(r)||!t(o))throw new TypeError("Cannot create proxy with a non-object as target or handler");e=function(){n=function(t){throw new TypeError("Cannot perform '"+t+"' on a proxy that has been revoked")}};var c=o;for(var i in o={get:null,set:null,apply:null,construct:null},c){if(!(i in o))throw new TypeError("Proxy polyfill does not support trap '"+i+"'");o[i]=c[i]}"function"==typeof c&&(o.apply=c.apply.bind(c));var a=this,p=!1,f=!1;"function"==typeof r?(a=function(){var t=this&&this.constructor===a,e=Array.prototype.slice.call(arguments);return n(t?"construct":"apply"),t&&o.construct?o.construct.call(this,r,e):!t&&o.apply?o.apply(r,this,e):t?(e.unshift(r),new(r.bind.apply(r,e))):r.apply(this,e)},p=!0):r instanceof Array&&(a=[],f=!0);var s=o.get?function(t){return n("get"),o.get(this,t,a)}:function(t){return n("get"),this[t]},u=o.set?function(t,e){n("set"),o.set(this,t,e,a)}:function(t,e){n("set"),this[t]=e},l={};if(Object.getOwnPropertyNames(r).forEach(function(t){if(!((p||f)&&t in a)){var e={enumerable:!!Object.getOwnPropertyDescriptor(r,t).enumerable,get:s.bind(r,t),set:u.bind(r,t)};Object.defineProperty(a,t,e),l[t]=!0}}),c=!0,Object.setPrototypeOf?Object.setPrototypeOf(a,Object.getPrototypeOf(r)):a.__proto__?a.__proto__=r.__proto__:c=!1,o.get||!c)for(var y in r)l[y]||Object.defineProperty(a,y,{get:s.bind(r,y)});return Object.seal(r),Object.seal(a),a};return r.revocable=function(t,o){return{proxy:new r(t,o),revoke:e}},r}(),t.Proxy.revocable=t.Proxy.revocable)}(); }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"_process":27}],29:[function(require,module,exports){ var runtime=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,r,e,n){var o=r&&r.prototype instanceof v?r:v,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(t,r,e){var n=f;return function(o,i){if(n===l)throw new Error("Generator is already running");if(n===p){if("throw"===o)throw i;return N()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=_(a,e);if(c){if(c===y)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===f)throw n=p,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=l;var u=h(t,r,e);if("normal"===u.type){if(n=e.done?p:s,u.arg===y)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n=p,e.method="throw",e.arg=u.arg)}}}(t,e,a),i}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var f="suspendedStart",s="suspendedYield",l="executing",p="completed",y={};function v(){}function d(){}function g(){}var m={};m[i]=function(){return this};var w=Object.getPrototypeOf,L=w&&w(w(G([])));L&&L!==e&&n.call(L,i)&&(m=L);var x=g.prototype=v.prototype=Object.create(m);function E(t){["next","throw","return"].forEach(function(r){t[r]=function(t){return this._invoke(r,t)}})}function b(t){var r;this._invoke=function(e,o){function i(){return new Promise(function(r,i){!function r(e,o,i,a){var c=h(t[e],t,o);if("throw"!==c.type){var u=c.arg,f=u.value;return f&&"object"==typeof f&&n.call(f,"__await")?Promise.resolve(f.__await).then(function(t){r("next",t,i,a)},function(t){r("throw",t,i,a)}):Promise.resolve(f).then(function(t){u.value=t,i(u)},function(t){return r("throw",t,i,a)})}a(c.arg)}(e,o,r,i)})}return r=r?r.then(i,i):i()}}function _(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,_(t,e),"throw"===e.method))return y;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=h(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,y;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,y):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,y)}function j(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function O(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function G(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function e(){for(;++o<t.length;)if(n.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=r,e.done=!0,e};return a.next=a}}return{next:N}}function N(){return{value:r,done:!0}}return d.prototype=x.constructor=g,g.constructor=d,g[c]=d.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===d||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,c in t||(t[c]="GeneratorFunction")),t.prototype=Object.create(x),t},t.awrap=function(t){return{__await:t}},E(b.prototype),b.prototype[a]=function(){return this},t.AsyncIterator=b,t.async=function(r,e,n,o){var i=new b(u(r,e,n,o));return t.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},E(x),x[c]="Generator",x[i]=function(){return this},x.toString=function(){return"[object Generator]"},t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=G,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function o(n,o){return c.type="throw",c.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),h=n.call(a,"finallyLoc");if(u&&h){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!h)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),y},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),O(e),y}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;O(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:G(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),y}},t}("object"==typeof module?module.exports:{});try{regeneratorRuntime=runtime}catch(t){Function("r","regeneratorRuntime = r")(runtime)} },{}],30:[function(require,module,exports){ "use strict";module.exports=require("./index"); },{"./index":42}],31:[function(require,module,exports){ "use strict";function asyncGeneratorStep(e,t,r,n,a,s,o){try{var i=e[s](o),u=i.value}catch(e){return void r(e)}i.done?t(u):Promise.resolve(u).then(n,a)}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var s=e.apply(t,r);function o(e){asyncGeneratorStep(s,n,a,o,i,"next",e)}function i(e){asyncGeneratorStep(s,n,a,o,i,"throw",e)}o(void 0)})}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var Client=function(){function e(t){var r=t.transport,n=t.baseUrl,a=t.authorization,s=t.sendCookies,o=void 0!==s&&s,i=t.middleware,u=void 0===i?[]:i;_classCallCheck(this,e),this.transport=r,this.baseUrl=n,this.authorization=a,this.sendCookies=o,this.middleware=u,this.user=null}return _createClass(e,[{key:"_fetchCSRFToken",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.user||!this.user._csrfToken){e.next=2;break}return e.abrupt("return",this.user._csrfToken);case 2:return e.next=4,this.send({url:"/rest/session/token",method:"GET"});case 4:return t=e.sent,e.abrupt("return",t.data);case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"send",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(t){var r,n,a,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.transport){e.next=2;break}throw new Error("No HTTP transport method provided. Pass a transport function to your Client or set GlobalClient.transport.");case 2:if(t.baseURL=this.baseUrl,t.headers=t.headers||{},!0!==this.sendCookies){e.next=11;break}if(t.withCredentials=!0,-1!==t.url.indexOf("/rest/session/token")){e.next=11;break}return e.next=9,this._fetchCSRFToken();case 9:r=e.sent,t.headers["X-CSRF-Token"]=r;case 11:"string"==typeof this.authorization&&(t.headers.Authorization=this.authorization),n=t,a=0;case 14:if(!(a<this.middleware.length)){e.next=21;break}return e.next=17,this.middleware[a](n);case 17:n=e.sent;case 18:a+=1,e.next=14;break;case 21:if(s=this.transport(n)){e.next=24;break}throw new Error("HTTP transport returned ".concat(s,". Expected a Response."));case 24:return e.abrupt("return",s);case 25:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),e}();exports.default=Client; },{}],32:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _EntityNotFound=_interopRequireDefault(require("./Error/EntityNotFound")),_MalformedEntity=_interopRequireDefault(require("./Error/MalformedEntity")),_GlobalClient=_interopRequireDefault(require("./GlobalClient")),_QueryParameters=_interopRequireDefault(require("./QueryParameters"));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(t,e){var n=[],i=!0,r=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(i=(o=s.next()).done)&&(n.push(o.value),!e||n.length!==e);i=!0);}catch(t){r=!0,a=t}finally{try{i||null==s.return||s.return()}finally{if(r)throw a}}return n}function _arrayWithHoles(t){if(Array.isArray(t))return t}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(e){_defineProperty(t,e,n[e])})}return t}function asyncGeneratorStep(t,e,n,i,r,a,o){try{var s=t[a](o),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(i,r)}function _asyncToGenerator(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var a=t.apply(e,n);function o(t){asyncGeneratorStep(a,i,r,o,s,"next",t)}function s(t){asyncGeneratorStep(a,i,r,o,s,"throw",t)}o(void 0)})}}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function _createClass(t,e,n){return e&&_defineProperties(t.prototype,e),n&&_defineProperties(t,n),t}function _defineProperty(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var TypeHeaders={Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json"},Entity=function(){function t(e,n,i){return _classCallCheck(this,t),this.entityType=e,this.entityBundle=n,this.entityUuid=i||null,this.enforceNew=!1,this._attributes={},this._relationships={},this._changes={attributes:{},relationships:{}},new Proxy(this,{get:function(t,e){var n=e,i={nid:"drupal_internal__nid",vid:"drupal_internal__vid"};return n in i&&(n=i[n]),n in t||!t._hasField(n)?t[e]:t.get(e)},set:function(t,e,n){var i=e,r={nid:"drupal_internal__nid",vid:"drupal_internal__vid"};return i in r&&(i=r[i]),i in t||!t._hasField(i)?(t[i]=n,!0):(t.set(i,n),!0)}})}return _createClass(t,null,[{key:"FromResponse",value:function(e){var n=new t;return n._applySerializedData(e),n}},{key:"Load",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(n,i,r){var a,o,s,u,l,c,d=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a=d.length>3&&void 0!==d[3]?d[3]:[],o=d.length>4&&void 0!==d[4]&&d[4],!t.Cache[r]||!1!==o){e.next=4;break}return e.abrupt("return",t.FromResponse(t.Cache[r]));case 4:return s=new _QueryParameters.default(["include=".concat(a.join(","))]),e.next=7,_GlobalClient.default.send({url:"/jsonapi/".concat(n,"/").concat(i,"/").concat(r).concat(a.length>0?"?".concat(s.toString()):""),method:"GET",headers:TypeHeaders});case 7:if(u=e.sent,!(l=u.data)||!l.data){e.next=14;break}return c=t.FromResponse(l.data),t.Cache[r]=_objectSpread({},c._serialize().data,{id:c.entityUuid}),l.included&&l.included.forEach(function(e){var n=t.FromResponse(e);t.Cache[n.entityUuid]=_objectSpread({},n._serialize().data,{id:n.entityUuid})}),e.abrupt("return",c);case 14:throw new _EntityNotFound.default("Failed to find entity matching entity type ".concat(n,", entity bundle ").concat(i," and uuid ").concat(r));case 15:case"end":return e.stop()}},e)}));return function(t,n,i){return e.apply(this,arguments)}}()},{key:"LoadMultiple",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(n){var i,r,a,o,s,u,l,c,d,h,p,y,f,_;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.entityType,r=n.entityBundle,a=n.filter,o=void 0===a?{}:a,s=n.include,u=void 0===s?[]:s,l=n.pageOffset,c=void 0===l?0:l,d=n.pageLimit,h=void 0===d?50:d,p="function"==typeof o.query?o.query():o,y=new _QueryParameters.default([p,u.length>0?"include=".concat(u.join(",")):null,"page[offset]=".concat(c),"page[limit]=".concat(h)]),e.next=5,_GlobalClient.default.send({url:"/jsonapi/".concat(i,"/").concat(r,"?").concat(y.toString(Number.MAX_SAFE_INTEGER)),method:"GET",headers:TypeHeaders});case 5:if(f=e.sent,!((_=f.data)&&_.data&&_.data.length&&_.data.length>0)){e.next=10;break}return _.included&&_.included.length&&_.included.forEach(function(e){var n=new t;n._applySerializedData(e),t.Cache[n.entityUuid]=_objectSpread({},n._serialize().data,{id:n.entityUuid})}),e.abrupt("return",_.data.map(function(e){var n=new t;return n._applySerializedData(e),t.Cache[n.entityUuid]=_objectSpread({},n._serialize().data,{id:n.entityUuid}),n}));case 10:return e.abrupt("return",_.data);case 11:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"Delete",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(n,i,r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new t(n,i,r).delete());case 1:case"end":return e.stop()}},e)}));return function(t,n,i){return e.apply(this,arguments)}}()}]),_createClass(t,[{key:"_applySerializedData",value:function(t){var e=_slicedToArray(t.type.split("--"),2),n=e[0],i=e[1];this.entityType=n,this.entityBundle=i,this.entityUuid=t.id,this._attributes=t.attributes||{},t.relationships?this._relationships=Object.keys(t.relationships).map(function(e){return{data:t.relationships[e].data,_$key:e}}).reduce(function(t,e){var n=e._$key,i=e;return delete i._$key,_objectSpread({},t,_defineProperty({},n,i))},{}):this._relationships={}}},{key:"_serializeChanges",value:function(){var t={data:{type:"".concat(this.entityType,"--").concat(this.entityBundle),attributes:this._changes.attributes,relationships:this._changes.relationships}};return 0===Object.keys(t.data.attributes).length&&delete t.data.attributes,0===Object.keys(t.data.relationships).length&&delete t.data.relationships,this.entityUuid&&(t.data.id=this.entityUuid),t}},{key:"_serializeChangesForField",value:function(t){return{data:this.getChange(t)}}},{key:"_serialize",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e={data:{type:"".concat(this.entityType,"--").concat(this.entityBundle),attributes:this._attributes,relationships:this._relationships}};return 0===Object.keys(e.data.attributes).length&&delete e.data.attributes,0===Object.keys(e.data.relationships).length&&delete e.data.relationships,t&&this.entityUuid&&(e.data.id=this.entityUuid),e}},{key:"_hasField",value:function(t){return t in this._attributes||t in this._relationships}},{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(void 0!==this._attributes[t])return this._attributes[t];if(void 0!==this._relationships[t])return this._relationships[t];if(e)throw new Error("Failed to find field ".concat(t,"."));return null}},{key:"set",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this._attributes[t])return this.setAttribute(t,e),!0;if(this._relationships[t])return this.setRelationship(t,e),!0;if(n)throw new Error("Failed to set ".concat(t," to ").concat(e,". Field does not exist."));return!1}},{key:"getChange",value:function(t){return void 0!==this._changes.attributes[t]?this._changes.attributes[t]:this._changes.relationships[t]}},{key:"expand",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(n){var i,r,a,o;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._relationships[n]){e.next=2;break}throw new _MalformedEntity.default("Failed to find related entity from field ".concat(n));case 2:if(!(this._relationships[n].data&&this._relationships[n].data.type&&"string"==typeof this._relationships[n].data.type&&this._relationships[n].data.id)){e.next=5;break}return i=this._relationships[n].data.type.split("--"),r=_slicedToArray(i,2),a=r[0],o=r[1],e.abrupt("return",t.Load(a,o,this._relationships[n].data.id));case 5:if(!this._relationships[n].data||this._relationships[n].data.constructor!==Array){e.next=7;break}return e.abrupt("return",Promise.all(this._relationships[n].data.map(function(e){if("string"==typeof e.type&&"string"==typeof e.id){var n=_slicedToArray(e.type.split("--"),2),i=n[0],r=n[1];return t.Load(i,r,e.id)}return null}).filter(function(t){return!!t})));case 7:throw new _MalformedEntity.default("Related field ".concat(n," doesn't have sufficient information to expand."));case 8:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"setAttribute",value:function(t,e){this._attributes[t]=e,this._changes.attributes[t]=e}},{key:"setRelationship",value:function(e,n){var i=n;n instanceof t&&(i={data:{type:"".concat(n.entityType,"--").concat(n.entityBundle),id:n.entityUuid}}),n.constructor===Array&&n.every(function(e){return e instanceof t})&&(i={data:n.map(function(t){return{type:"".concat(t.entityType,"--").concat(t.entityBundle),id:t.entityUuid}})}),this._relationships[e]=i,this._changes.relationships[e]=i}},{key:"save",value:function(){return _GlobalClient.default.send(!0!==this.enforceNew&&this.entityUuid?{url:"/jsonapi/".concat(this.entityType,"/").concat(this.entityBundle,"/").concat(this.entityUuid),method:"PATCH",headers:_objectSpread({},TypeHeaders),data:JSON.stringify(this._serializeChanges())}:{url:"/jsonapi/".concat(this.entityType,"/").concat(this.entityBundle),method:"POST",headers:_objectSpread({},TypeHeaders),data:JSON.stringify(this._serialize(!1))})}},{key:"delete",value:function(){if(!this.entityUuid)throw new _MalformedEntity.default("Cannot delete an entity without a UUID.");return _GlobalClient.default.send({url:"/jsonapi/".concat(this.entityType,"/").concat(this.entityBundle,"/").concat(this.entityUuid),method:"DELETE",headers:_objectSpread({},TypeHeaders)})}},{key:"copy",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=new t(this.entityType,this.entityBundle);return n._attributes=this._attributes,n._relationships=this._relationships,n._changes=this._changes,e&&(n.entityUuid=this.entityUuid),n}}]),t}();exports.default=Entity,_defineProperty(Entity,"Cache",{}); },{"./Error/EntityNotFound":33,"./Error/MalformedEntity":34,"./GlobalClient":39,"./QueryParameters":40}],33:[function(require,module,exports){ "use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(t,e){return!e||"object"!==_typeof(e)&&"function"!=typeof e?_assertThisInitialized(t):e}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_setPrototypeOf(t,e)}function _wrapNativeSuper(t){var e="function"==typeof Map?new Map:void 0;return(_wrapNativeSuper=function(t){if(null===t||!_isNativeFunction(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,o)}function o(){return _construct(t,arguments,_getPrototypeOf(this).constructor)}return o.prototype=Object.create(t.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(o,t)})(t)}function isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}function _construct(t,e,o){return(_construct=isNativeReflectConstruct()?Reflect.construct:function(t,e,o){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return o&&_setPrototypeOf(n,o.prototype),n}).apply(null,arguments)}function _isNativeFunction(t){return-1!==Function.toString.call(t).indexOf("[native code]")}function _setPrototypeOf(t,e){return(_setPrototypeOf=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function _getPrototypeOf(t){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var EntityNotFound=function(t){function e(){return _classCallCheck(this,e),_possibleConstructorReturn(this,_getPrototypeOf(e).apply(this,arguments))}return _inherits(e,_wrapNativeSuper(Error)),e}();exports.default=EntityNotFound; },{}],34:[function(require,module,exports){ "use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(t,e){return!e||"object"!==_typeof(e)&&"function"!=typeof e?_assertThisInitialized(t):e}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_setPrototypeOf(t,e)}function _wrapNativeSuper(t){var e="function"==typeof Map?new Map:void 0;return(_wrapNativeSuper=function(t){if(null===t||!_isNativeFunction(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,o)}function o(){return _construct(t,arguments,_getPrototypeOf(this).constructor)}return o.prototype=Object.create(t.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(o,t)})(t)}function isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}function _construct(t,e,o){return(_construct=isNativeReflectConstruct()?Reflect.construct:function(t,e,o){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return o&&_setPrototypeOf(n,o.prototype),n}).apply(null,arguments)}function _isNativeFunction(t){return-1!==Function.toString.call(t).indexOf("[native code]")}function _setPrototypeOf(t,e){return(_setPrototypeOf=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function _getPrototypeOf(t){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var MalformedEntity=function(t){function e(){return _classCallCheck(this,e),_possibleConstructorReturn(this,_getPrototypeOf(e).apply(this,arguments))}return _inherits(e,_wrapNativeSuper(Error)),e}();exports.default=MalformedEntity; },{}],35:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"EntityNotFound",{enumerable:!0,get:function(){return _EntityNotFound.default}}),Object.defineProperty(exports,"MalformedEntity",{enumerable:!0,get:function(){return _MalformedEntity.default}});var _EntityNotFound=_interopRequireDefault(require("./EntityNotFound")),_MalformedEntity=_interopRequireDefault(require("./MalformedEntity"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}} },{"./EntityNotFound":33,"./MalformedEntity":34}],36:[function(require,module,exports){ (function (process,global){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _GlobalClient=_interopRequireDefault(require("./GlobalClient")),_Entity2=_interopRequireDefault(require("./Entity"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function asyncGeneratorStep(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function _asyncToGenerator(e){return function(){var t=this,r=argumen